From a2adda516bdf790651283201a666f253a8bfcc49 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 10:38:38 +0200 Subject: [PATCH 0001/1332] AVALANCHE: Initial PtoC output. --- engines/avalanche/1stoff.cpp | 57 + engines/avalanche/access.cpp | 170 +++ engines/avalanche/access.h | 9 + engines/avalanche/acci.cpp | 1671 ++++++++++++++++++++++++++++ engines/avalanche/acci.h | 223 ++++ engines/avalanche/also.cpp | 1028 +++++++++++++++++ engines/avalanche/andexor.cpp | 122 +++ engines/avalanche/andexor2.cpp | 133 +++ engines/avalanche/andextst.cpp | 64 ++ engines/avalanche/arch.cpp | 122 +++ engines/avalanche/arch.h | 10 + engines/avalanche/avalot9.cpp | 114 ++ engines/avalanche/avbkgrnd.cpp | 88 ++ engines/avalanche/avmenu.cpp | 312 ++++++ engines/avalanche/avvyans.cpp | 84 ++ engines/avalanche/avvyans2.cpp | 185 ++++ engines/avalanche/avvymonk.cpp | 72 ++ engines/avalanche/bakchunk.cpp | 28 + engines/avalanche/basher.cpp | 385 +++++++ engines/avalanche/basher.h | 40 + engines/avalanche/bootstrp.cpp | 349 ++++++ engines/avalanche/cadburys.cpp | 109 ++ engines/avalanche/cadburys.h | 41 + engines/avalanche/celer.cpp | 472 ++++++++ engines/avalanche/celer.h | 53 + engines/avalanche/ch_egats.cpp | 155 +++ engines/avalanche/charmap.cpp | 30 + engines/avalanche/chunker.cpp | 86 ++ engines/avalanche/chunkxf1.cpp | 259 +++++ engines/avalanche/chunkxf2.cpp | 192 ++++ engines/avalanche/chunkxf3.cpp | 250 +++++ engines/avalanche/chunkxf4.cpp | 285 +++++ engines/avalanche/chunkxf5.cpp | 244 +++++ engines/avalanche/chunkxf6.cpp | 251 +++++ engines/avalanche/chunkxf7.cpp | 236 ++++ engines/avalanche/chunkxf8.cpp | 243 ++++ engines/avalanche/chunkxf9.cpp | 237 ++++ engines/avalanche/chunkxfa.cpp | 240 ++++ engines/avalanche/chunkxfb.cpp | 238 ++++ engines/avalanche/chunkxfc.cpp | 236 ++++ engines/avalanche/chunkxfd.cpp | 236 ++++ engines/avalanche/chunkxfe.cpp | 236 ++++ engines/avalanche/chunkxff.cpp | 236 ++++ engines/avalanche/chunkxfg.cpp | 236 ++++ engines/avalanche/chunkxfh.cpp | 237 ++++ engines/avalanche/chunkxfi.cpp | 246 +++++ engines/avalanche/chunkxfj.cpp | 237 ++++ engines/avalanche/chunkxfk.cpp | 237 ++++ engines/avalanche/chunkxfl.cpp | 127 +++ engines/avalanche/clock.cpp | 60 + engines/avalanche/closing.cpp | 119 ++ engines/avalanche/closing.h | 15 + engines/avalanche/convert.cpp | 79 ++ engines/avalanche/convmous.cpp | 80 ++ engines/avalanche/credits.cpp | 88 ++ engines/avalanche/displtxt.cpp | 34 + engines/avalanche/dropdown.cpp | 802 ++++++++++++++ engines/avalanche/dropdown.h | 94 ++ engines/avalanche/dwidth.cpp | 20 + engines/avalanche/edhead.cpp | 86 ++ engines/avalanche/edna.cpp | 337 ++++++ engines/avalanche/enhanced.cpp | 86 ++ engines/avalanche/enhanced.h | 22 + engines/avalanche/enid.cpp | 581 ++++++++++ engines/avalanche/enid.h | 22 + engines/avalanche/filer.cpp | 791 +++++++++++++ engines/avalanche/fileunit.cpp | 1118 +++++++++++++++++++ engines/avalanche/fileunit.h | 7 + engines/avalanche/filing.cpp | 144 +++ engines/avalanche/folktemp.cpp | 79 ++ engines/avalanche/fontslid.cpp | 25 + engines/avalanche/frere.cpp | 102 ++ engines/avalanche/g-room.cpp | 413 +++++++ engines/avalanche/golden.cpp | 437 ++++++++ engines/avalanche/gyro.cpp | 532 +++++++++ engines/avalanche/gyro.h | 702 ++++++++++++ engines/avalanche/help.cpp | 225 ++++ engines/avalanche/help2.cpp | 244 +++++ engines/avalanche/helpbak.cpp | 161 +++ engines/avalanche/helpbak.h | 11 + engines/avalanche/helper.cpp | 282 +++++ engines/avalanche/helper.h | 11 + engines/avalanche/hibits.cpp | 27 + engines/avalanche/highs.cpp | 116 ++ engines/avalanche/highs.h | 9 + engines/avalanche/hiz.cpp | 287 +++++ engines/avalanche/incline.cpp | 172 +++ engines/avalanche/incline.h | 10 + engines/avalanche/initxf.cpp | 32 + engines/avalanche/inputtes.cpp | 47 + engines/avalanche/intro.cpp | 596 ++++++++++ engines/avalanche/ints.cpp | 29 + engines/avalanche/joysetup.cpp | 97 ++ engines/avalanche/joystick.cpp | 183 ++++ engines/avalanche/joystick.h | 22 + engines/avalanche/loading.cpp | 23 + engines/avalanche/logger.cpp | 210 ++++ engines/avalanche/logger.h | 33 + engines/avalanche/lucerna.cpp | 1489 +++++++++++++++++++++++++ engines/avalanche/lucerna.h | 76 ++ engines/avalanche/magic2.cpp | 37 + engines/avalanche/magidraw.cpp | 34 + engines/avalanche/magishuf.cpp | 60 + engines/avalanche/make!.cpp | 62 ++ engines/avalanche/makeregi.cpp | 142 +++ engines/avalanche/makesez.cpp | 47 + engines/avalanche/makevmou.cpp | 270 +++++ engines/avalanche/menuxf.cpp | 48 + engines/avalanche/minstran.cpp | 37 + engines/avalanche/newsprit.cpp | 124 +++ engines/avalanche/nim.cpp | 381 +++++++ engines/avalanche/nimdraw.cpp | 94 ++ engines/avalanche/nimunit.cpp | 443 ++++++++ engines/avalanche/nimunit.h | 18 + engines/avalanche/oldfiler.cpp | 260 +++++ engines/avalanche/oldhighs.cpp | 249 +++++ engines/avalanche/oldincln.cpp | 249 +++++ engines/avalanche/oldincln.h | 10 + engines/avalanche/oldtrip.cpp | 448 ++++++++ engines/avalanche/oldtrip.h | 95 ++ engines/avalanche/omtest.cpp | 177 +++ engines/avalanche/oopmenu.cpp | 295 +++++ engines/avalanche/oopmenu.h | 82 ++ engines/avalanche/overlap.cpp | 53 + engines/avalanche/overscro.cpp | 53 + engines/avalanche/particle.cpp | 233 ++++ engines/avalanche/pictemp.cpp | 65 ++ engines/avalanche/pictemp2.cpp | 64 ++ engines/avalanche/pingo.cpp | 229 ++++ engines/avalanche/pingo.h | 19 + engines/avalanche/plottest.cpp | 42 + engines/avalanche/preview1.cpp | 122 +++ engines/avalanche/qintro.cpp | 277 +++++ engines/avalanche/qstars.cpp | 237 ++++ engines/avalanche/rawupd.cpp | 71 ++ engines/avalanche/readsez.cpp | 80 ++ engines/avalanche/reginam.cpp | 91 ++ engines/avalanche/sackb1.cpp | 52 + engines/avalanche/sackb1.h | 14 + engines/avalanche/sackb3.cpp | 23 + engines/avalanche/sackblas.cpp | 0 engines/avalanche/saving.cpp | 48 + engines/avalanche/scr_1.cpp | 89 ++ engines/avalanche/scr_2.cpp | 113 ++ engines/avalanche/scr_3.cpp | 93 ++ engines/avalanche/scr_4.cpp | 89 ++ engines/avalanche/scr_5.cpp | 93 ++ engines/avalanche/scr_9.cpp | 21 + engines/avalanche/scrolls.cpp | 781 +++++++++++++ engines/avalanche/scrolls.h | 33 + engines/avalanche/sequence.cpp | 92 ++ engines/avalanche/sequence.h | 32 + engines/avalanche/setup.cpp | 1268 +++++++++++++++++++++ engines/avalanche/seu.cpp | 977 +++++++++++++++++ engines/avalanche/seu_avvy.cpp | 90 ++ engines/avalanche/sez.cpp | 0 engines/avalanche/sezedit.cpp | 406 +++++++ engines/avalanche/sezunit.cpp | 76 ++ engines/avalanche/sezunit.h | 42 + engines/avalanche/sezxfr.cpp | 95 ++ engines/avalanche/shell1.cpp | 36 + engines/avalanche/shell2.cpp | 26 + engines/avalanche/slope.cpp | 349 ++++++ engines/avalanche/spread.cpp | 306 ++++++ engines/avalanche/spread2.cpp | 855 +++++++++++++++ engines/avalanche/squish.cpp | 455 ++++++++ engines/avalanche/ss_blank.cpp | 38 + engines/avalanche/ss_clock.cpp | 84 ++ engines/avalanche/stars.cpp | 562 ++++++++++ engines/avalanche/status.cpp | 34 + engines/avalanche/sticks.cpp | 90 ++ engines/avalanche/sticks.h | 13 + engines/avalanche/sunrise.cpp | 57 + engines/avalanche/tempo.cpp | 77 ++ engines/avalanche/test.cpp | 19 + engines/avalanche/test2.cpp | 17 + engines/avalanche/testblit.cpp | 49 + engines/avalanche/testcard.cpp | 56 + engines/avalanche/testenh.cpp | 18 + engines/avalanche/timeout.cpp | 594 ++++++++++ engines/avalanche/timeout.h | 229 ++++ engines/avalanche/travel.cpp | 64 ++ engines/avalanche/trip.cpp | 139 +++ engines/avalanche/trip.h | 17 + engines/avalanche/trip3.cpp | 231 ++++ engines/avalanche/trip3.h | 20 + engines/avalanche/trip42.cpp | 450 ++++++++ engines/avalanche/trip42.h | 90 ++ engines/avalanche/trip5.cpp | 1888 ++++++++++++++++++++++++++++++++ engines/avalanche/trip5.h | 175 +++ engines/avalanche/trip5tst.cpp | 135 +++ engines/avalanche/trip5xf.cpp | 172 +++ engines/avalanche/tripoop.cpp | 290 +++++ engines/avalanche/ttmenuxf.cpp | 112 ++ engines/avalanche/unsquish.cpp | 524 +++++++++ engines/avalanche/viewdocs.cpp | 522 +++++++++ engines/avalanche/visa.cpp | 264 +++++ engines/avalanche/visa.h | 9 + engines/avalanche/visatest.cpp | 84 ++ engines/avalanche/waver.cpp | 0 engines/avalanche/xf_gover.cpp | 95 ++ engines/avalanche/xf_help.cpp | 86 ++ engines/avalanche/xf_visa.cpp | 178 +++ engines/avalanche/xfbutton.cpp | 62 ++ engines/avalanche/xfghost.cpp | 246 +++++ engines/avalanche/zapdraw.cpp | 38 + 206 files changed, 42098 insertions(+) create mode 100644 engines/avalanche/1stoff.cpp create mode 100644 engines/avalanche/access.cpp create mode 100644 engines/avalanche/access.h create mode 100644 engines/avalanche/acci.cpp create mode 100644 engines/avalanche/acci.h create mode 100644 engines/avalanche/also.cpp create mode 100644 engines/avalanche/andexor.cpp create mode 100644 engines/avalanche/andexor2.cpp create mode 100644 engines/avalanche/andextst.cpp create mode 100644 engines/avalanche/arch.cpp create mode 100644 engines/avalanche/arch.h create mode 100644 engines/avalanche/avalot9.cpp create mode 100644 engines/avalanche/avbkgrnd.cpp create mode 100644 engines/avalanche/avmenu.cpp create mode 100644 engines/avalanche/avvyans.cpp create mode 100644 engines/avalanche/avvyans2.cpp create mode 100644 engines/avalanche/avvymonk.cpp create mode 100644 engines/avalanche/bakchunk.cpp create mode 100644 engines/avalanche/basher.cpp create mode 100644 engines/avalanche/basher.h create mode 100644 engines/avalanche/bootstrp.cpp create mode 100644 engines/avalanche/cadburys.cpp create mode 100644 engines/avalanche/cadburys.h create mode 100644 engines/avalanche/celer.cpp create mode 100644 engines/avalanche/celer.h create mode 100644 engines/avalanche/ch_egats.cpp create mode 100644 engines/avalanche/charmap.cpp create mode 100644 engines/avalanche/chunker.cpp create mode 100644 engines/avalanche/chunkxf1.cpp create mode 100644 engines/avalanche/chunkxf2.cpp create mode 100644 engines/avalanche/chunkxf3.cpp create mode 100644 engines/avalanche/chunkxf4.cpp create mode 100644 engines/avalanche/chunkxf5.cpp create mode 100644 engines/avalanche/chunkxf6.cpp create mode 100644 engines/avalanche/chunkxf7.cpp create mode 100644 engines/avalanche/chunkxf8.cpp create mode 100644 engines/avalanche/chunkxf9.cpp create mode 100644 engines/avalanche/chunkxfa.cpp create mode 100644 engines/avalanche/chunkxfb.cpp create mode 100644 engines/avalanche/chunkxfc.cpp create mode 100644 engines/avalanche/chunkxfd.cpp create mode 100644 engines/avalanche/chunkxfe.cpp create mode 100644 engines/avalanche/chunkxff.cpp create mode 100644 engines/avalanche/chunkxfg.cpp create mode 100644 engines/avalanche/chunkxfh.cpp create mode 100644 engines/avalanche/chunkxfi.cpp create mode 100644 engines/avalanche/chunkxfj.cpp create mode 100644 engines/avalanche/chunkxfk.cpp create mode 100644 engines/avalanche/chunkxfl.cpp create mode 100644 engines/avalanche/clock.cpp create mode 100644 engines/avalanche/closing.cpp create mode 100644 engines/avalanche/closing.h create mode 100644 engines/avalanche/convert.cpp create mode 100644 engines/avalanche/convmous.cpp create mode 100644 engines/avalanche/credits.cpp create mode 100644 engines/avalanche/displtxt.cpp create mode 100644 engines/avalanche/dropdown.cpp create mode 100644 engines/avalanche/dropdown.h create mode 100644 engines/avalanche/dwidth.cpp create mode 100644 engines/avalanche/edhead.cpp create mode 100644 engines/avalanche/edna.cpp create mode 100644 engines/avalanche/enhanced.cpp create mode 100644 engines/avalanche/enhanced.h create mode 100644 engines/avalanche/enid.cpp create mode 100644 engines/avalanche/enid.h create mode 100644 engines/avalanche/filer.cpp create mode 100644 engines/avalanche/fileunit.cpp create mode 100644 engines/avalanche/fileunit.h create mode 100644 engines/avalanche/filing.cpp create mode 100644 engines/avalanche/folktemp.cpp create mode 100644 engines/avalanche/fontslid.cpp create mode 100644 engines/avalanche/frere.cpp create mode 100644 engines/avalanche/g-room.cpp create mode 100644 engines/avalanche/golden.cpp create mode 100644 engines/avalanche/gyro.cpp create mode 100644 engines/avalanche/gyro.h create mode 100644 engines/avalanche/help.cpp create mode 100644 engines/avalanche/help2.cpp create mode 100644 engines/avalanche/helpbak.cpp create mode 100644 engines/avalanche/helpbak.h create mode 100644 engines/avalanche/helper.cpp create mode 100644 engines/avalanche/helper.h create mode 100644 engines/avalanche/hibits.cpp create mode 100644 engines/avalanche/highs.cpp create mode 100644 engines/avalanche/highs.h create mode 100644 engines/avalanche/hiz.cpp create mode 100644 engines/avalanche/incline.cpp create mode 100644 engines/avalanche/incline.h create mode 100644 engines/avalanche/initxf.cpp create mode 100644 engines/avalanche/inputtes.cpp create mode 100644 engines/avalanche/intro.cpp create mode 100644 engines/avalanche/ints.cpp create mode 100644 engines/avalanche/joysetup.cpp create mode 100644 engines/avalanche/joystick.cpp create mode 100644 engines/avalanche/joystick.h create mode 100644 engines/avalanche/loading.cpp create mode 100644 engines/avalanche/logger.cpp create mode 100644 engines/avalanche/logger.h create mode 100644 engines/avalanche/lucerna.cpp create mode 100644 engines/avalanche/lucerna.h create mode 100644 engines/avalanche/magic2.cpp create mode 100644 engines/avalanche/magidraw.cpp create mode 100644 engines/avalanche/magishuf.cpp create mode 100644 engines/avalanche/make!.cpp create mode 100644 engines/avalanche/makeregi.cpp create mode 100644 engines/avalanche/makesez.cpp create mode 100644 engines/avalanche/makevmou.cpp create mode 100644 engines/avalanche/menuxf.cpp create mode 100644 engines/avalanche/minstran.cpp create mode 100644 engines/avalanche/newsprit.cpp create mode 100644 engines/avalanche/nim.cpp create mode 100644 engines/avalanche/nimdraw.cpp create mode 100644 engines/avalanche/nimunit.cpp create mode 100644 engines/avalanche/nimunit.h create mode 100644 engines/avalanche/oldfiler.cpp create mode 100644 engines/avalanche/oldhighs.cpp create mode 100644 engines/avalanche/oldincln.cpp create mode 100644 engines/avalanche/oldincln.h create mode 100644 engines/avalanche/oldtrip.cpp create mode 100644 engines/avalanche/oldtrip.h create mode 100644 engines/avalanche/omtest.cpp create mode 100644 engines/avalanche/oopmenu.cpp create mode 100644 engines/avalanche/oopmenu.h create mode 100644 engines/avalanche/overlap.cpp create mode 100644 engines/avalanche/overscro.cpp create mode 100644 engines/avalanche/particle.cpp create mode 100644 engines/avalanche/pictemp.cpp create mode 100644 engines/avalanche/pictemp2.cpp create mode 100644 engines/avalanche/pingo.cpp create mode 100644 engines/avalanche/pingo.h create mode 100644 engines/avalanche/plottest.cpp create mode 100644 engines/avalanche/preview1.cpp create mode 100644 engines/avalanche/qintro.cpp create mode 100644 engines/avalanche/qstars.cpp create mode 100644 engines/avalanche/rawupd.cpp create mode 100644 engines/avalanche/readsez.cpp create mode 100644 engines/avalanche/reginam.cpp create mode 100644 engines/avalanche/sackb1.cpp create mode 100644 engines/avalanche/sackb1.h create mode 100644 engines/avalanche/sackb3.cpp create mode 100644 engines/avalanche/sackblas.cpp create mode 100644 engines/avalanche/saving.cpp create mode 100644 engines/avalanche/scr_1.cpp create mode 100644 engines/avalanche/scr_2.cpp create mode 100644 engines/avalanche/scr_3.cpp create mode 100644 engines/avalanche/scr_4.cpp create mode 100644 engines/avalanche/scr_5.cpp create mode 100644 engines/avalanche/scr_9.cpp create mode 100644 engines/avalanche/scrolls.cpp create mode 100644 engines/avalanche/scrolls.h create mode 100644 engines/avalanche/sequence.cpp create mode 100644 engines/avalanche/sequence.h create mode 100644 engines/avalanche/setup.cpp create mode 100644 engines/avalanche/seu.cpp create mode 100644 engines/avalanche/seu_avvy.cpp create mode 100644 engines/avalanche/sez.cpp create mode 100644 engines/avalanche/sezedit.cpp create mode 100644 engines/avalanche/sezunit.cpp create mode 100644 engines/avalanche/sezunit.h create mode 100644 engines/avalanche/sezxfr.cpp create mode 100644 engines/avalanche/shell1.cpp create mode 100644 engines/avalanche/shell2.cpp create mode 100644 engines/avalanche/slope.cpp create mode 100644 engines/avalanche/spread.cpp create mode 100644 engines/avalanche/spread2.cpp create mode 100644 engines/avalanche/squish.cpp create mode 100644 engines/avalanche/ss_blank.cpp create mode 100644 engines/avalanche/ss_clock.cpp create mode 100644 engines/avalanche/stars.cpp create mode 100644 engines/avalanche/status.cpp create mode 100644 engines/avalanche/sticks.cpp create mode 100644 engines/avalanche/sticks.h create mode 100644 engines/avalanche/sunrise.cpp create mode 100644 engines/avalanche/tempo.cpp create mode 100644 engines/avalanche/test.cpp create mode 100644 engines/avalanche/test2.cpp create mode 100644 engines/avalanche/testblit.cpp create mode 100644 engines/avalanche/testcard.cpp create mode 100644 engines/avalanche/testenh.cpp create mode 100644 engines/avalanche/timeout.cpp create mode 100644 engines/avalanche/timeout.h create mode 100644 engines/avalanche/travel.cpp create mode 100644 engines/avalanche/trip.cpp create mode 100644 engines/avalanche/trip.h create mode 100644 engines/avalanche/trip3.cpp create mode 100644 engines/avalanche/trip3.h create mode 100644 engines/avalanche/trip42.cpp create mode 100644 engines/avalanche/trip42.h create mode 100644 engines/avalanche/trip5.cpp create mode 100644 engines/avalanche/trip5.h create mode 100644 engines/avalanche/trip5tst.cpp create mode 100644 engines/avalanche/trip5xf.cpp create mode 100644 engines/avalanche/tripoop.cpp create mode 100644 engines/avalanche/ttmenuxf.cpp create mode 100644 engines/avalanche/unsquish.cpp create mode 100644 engines/avalanche/viewdocs.cpp create mode 100644 engines/avalanche/visa.cpp create mode 100644 engines/avalanche/visa.h create mode 100644 engines/avalanche/visatest.cpp create mode 100644 engines/avalanche/waver.cpp create mode 100644 engines/avalanche/xf_gover.cpp create mode 100644 engines/avalanche/xf_help.cpp create mode 100644 engines/avalanche/xf_visa.cpp create mode 100644 engines/avalanche/xfbutton.cpp create mode 100644 engines/avalanche/xfghost.cpp create mode 100644 engines/avalanche/zapdraw.cpp diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp new file mode 100644 index 000000000000..99198b463852 --- /dev/null +++ b/engines/avalanche/1stoff.cpp @@ -0,0 +1,57 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ +/*#include "Dos.h"*/ + + +matrix<1,7,1,3,byte> cols; +byte fv; + +void adjust() +{ + registers r; +; + {; + ax=0x1012; + bx=1; + cx=2; + es=seg(cols); + dx=ofs(cols); + + } + + intr(0x10,r); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=0; + clrscr; + + fillchar(cols,sizeof(cols),'\0'); + adjust(); + + gotoxy(29,10); textattr=1; output << "Thorsoft of Letchworth"; + gotoxy(36,12); textattr=2; output << "presents"; + + for( fv=1; fv <= 77; fv ++) + {; + delay(77); + if (fv<64) fillchar(cols[1],3,chr(fv)); + if (fv>14) fillchar(cols[2],3,chr(fv-14)); + adjust(); + } + + delay(100); + + for( fv=63; fv >= 1; fv --) + {; + fillchar(cols,sizeof(cols),chr(fv)); + delay(37); + adjust(); + } + +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp new file mode 100644 index 000000000000..37c9649193c5 --- /dev/null +++ b/engines/avalanche/access.cpp @@ -0,0 +1,170 @@ +#include "ptoc.h" + +/* + + + + + ACCESS The temporary Sez handler. */ + +#define __access_implementation__ + + +#include "access.h" + + +/*#include "Gyro.h"*/ +/*#include "Scrolls.h"*/ +/*#include "Acci.h"*/ +/*#include "Trip5.h"*/ +/*#include "Lucerna.h"*/ + + +boolean int_say_went_ok; + +void int_say(string filename, boolean bubble) + /* Internal use ONLY! */ +{ + untyped_file f; +; + /*$I-*/ + assign(f,filename); + reset(f,1); + if (ioresult!=0) + {; + int_say_went_ok=false; + return; + } + bufsize=filesize(f); + blockread(f,buffer,bufsize); + if (bubble) + {; + bufsize += 1; + buffer[bufsize]='\2'; + } + close(f); + /*$I+*/ + + calldrivers; + + int_say_went_ok=true; +} + +void dixi(char p, byte n) +{; exit(153); + int_say(string('s')+p+strf(n)+".raw",false); +} + +void talkto(byte whom) +{ + byte fv; + boolean no_matches; +; exit(153); + if (person==pardon) + {; + person=chr(subjnumber); + subjnumber=0; + } + + switch (chr(whom)) { + case pspludwick: + + if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) + {; + dixi('q',68); + dna.obj[potion]=true; + objectlist; points(3); return; + } else + {; + if (dna.talked_to_crapulus) + switch (dna.given2spludwick) { /* Spludwick - what does he need? */ + /* 0 - let it through to use normal routine. */ + case RANGE_2(1,2): {; + display(string("Can you get me ")+ + get_better(spludwick_order[dna.given2spludwick])+", please?"+ + "\232\2"); + return; + } + break; + case 3: {; + dixi('q',30); /* need any help with the game? */ + return; + } + break; + } + else dixi('q',42); /* Haven't talked to Crapulus. Go and talk to him. */ + } + break; + + case pibythneth: if (dna.givenbadgetoiby) + {; + dixi('q',33); /* Thanks a lot! */ + return; /* And leave the proc. */ + } + break; /* Or... just continue, 'cos he hasn't got it. */ + case pdogfood: if (dna.wonnim) + {; /* We've won the game. */ + dixi('q',6); /* "I'm Not Playing!" */ + return; /* Zap back. */ + } + break; + case payles: if (~ dna.ayles_is_awake) + {; + dixi('q',43); /* He's fast asleep! */ + return; + } + break; + case pgeida: if (dna.geida_given_potion) + dna.geida_follows=true; else + {; + dixi('u',17); + return; + } + break; + } + + if (whom>149) whom -= 149; + + no_matches=true; + for( fv=1; fv <= numtr; fv ++) + if (tr[fv].a.accinum==whom) + {; + display(string('\23')+chr(fv+48)+'\4'); + no_matches=false; + flush(); + } + + if (no_matches) display("\23\23\4"); + + if (subjnumber==0) /* For the moment... later we'll parse "say". */ + int_say(string("ss")+strf(whom)+".raw",true); + else + {; + int_say(string("ss")+strf(whom)+'-'+strf(subjnumber)+".raw",true); + if (! int_say_went_ok) /* File not found! */ + dixi('n',whom); + } + + switch (chr(whom+149)) { + case pcrapulus: + {; /* Crapulus: get the badge - first time only */ + dna.obj[badge]=true; + objectlist; + dixi('q',1); /* Circular from Cardiff. */ + dna.talked_to_crapulus=true; + + whereis[pcrapulus]=177; /* Crapulus walks off. */ + + tr[2].vanishifstill=true; + tr[2].walkto(4); /* Walks away. */ + + points(2); + } + break; + + case payles: dixi('q',44); break; /* Can you get me a pen? */ + + } +} + + diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h new file mode 100644 index 000000000000..825deeb59d42 --- /dev/null +++ b/engines/avalanche/access.h @@ -0,0 +1,9 @@ +#ifndef __access_h__ +#define __access_h__ + + +void dixi(char p, byte n); + +void talkto(byte whom); + +#endif diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp new file mode 100644 index 000000000000..86fac1858591 --- /dev/null +++ b/engines/avalanche/acci.cpp @@ -0,0 +1,1671 @@ +#include "ptoc.h" + +/* $D-*/ +/* + + + + + ACCIDENCE II The parser. */ +#define __acci_implementation__ + + +/*$V-*/ + +#include "acci.h" + +/*#include "Gyro.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Scrolls.h"*/ +/*#include "Pingo.h"*/ +/*#include "Trip5.h"*/ +/*#include "Visa.h"*/ +/*#include "Enid.h"*/ +/*#include "NimUnit.h"*/ +/*#include "Timeout.h"*/ +/*#include "Celer.h"*/ +/*#include "Highs.h"*/ +/*#include "Helper.h"*/ +/*#include "Sequence.h"*/ + + +byte fv; + +string wordnum(string x); +static char whatsit; +static word fv; +static boolean gotcha; + +static void checkword(string& x) /* Checks word "fv". */ +{ + { + vocab& with = words[fv]; + + if ((with.w==x) || ((copy(with.w,1,length(x))==x) && ! gotcha)) + whatsit=chr(with.n); + if (with.w==x) gotcha=true; + } +} + +string wordnum(string x) + +{ + string wordnum_result; + if (x=="") { wordnum_result=""; return wordnum_result; } + whatsit=pardon; gotcha=false; + for( fv=nowords; fv >= 1; fv --) checkword(x); + wordnum_result=whatsit; + return wordnum_result; +} + +void replace(string old1,string new1) +{ + byte q; + + q=pos(old1,thats); + while (q!=0) + { + thats=copy(thats,1,q-1)+new1+copy(thats,q+length(old1),255); + q=pos(old1,thats); + } +} + +/*procedure ninetydump; +var f:file; y:integer; bit:byte; a:byte absolute $A000:800; +begin + off; + assign(f,'avvydump.avd'); + rewrite(f,1); + blockwrite(f,dna,177); { just anything } + for bit:=0 to 3 do + begin + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + blockwrite(f,a,12080); + end; + close(f); on; + display('Dumped.'); +end;*/ + +string rank() +{ + byte fv; + + string rank_result; + for( fv=1; fv <= 8; fv ++) + if ((dna.score>=ranks[fv].score) + && (dna.score a; + + /* There are 65535 clock ticks in a second, + 1092.25 in a minute, and + 65535 in an hour. */ + string totaltime_result; + h=trunc(dna.total_time/ticks_in_1_sec); /* No. of seconds. */ + m=h % 3600; h=h / 3600; + s=m % 60; m=m / 60; + + a="You've been playing for "; + + if (h>0) a=a+strf(h)+" hours, "; + if ((m>0) || (h!=0)) a=a+strf(m)+" minutes and "; + a=a+strf(s)+" seconds."; + + totaltime_result=a; + return totaltime_result; +} + +void cheatparse(string codes); +static word num; +static integer e; + +static void number(string& codes) +{ + val(codes,num,e); +} + +void cheatparse(string codes) +{ + char cmd;integer se,sx,sy; + + if (~ cheat) + { /* put them off the scent! */ + display("Have you gone dotty\??!"); + return; + } + cmd=upcase(codes[2]); Delete(codes,1,2); /* strip header */ + display("\6Ninety: \22\4"); + switch (cmd) { + case 'R': { + number(codes); if (e!=0) return; + display(string("room swap to ")+codes+'.'); + fliproom(num,1); + } + break; + case 'Z': { zonk; display("Zonk OK!"); } break; + case 'W': { wobble; display("Ow my head!"); } break; + case 'A': { + tr[1].done; + tr[1].init(1,true); + dna.user_moves_avvy=true; + alive=true; + display("Reincat."); + } + break; + case 'B': { + sx=tr[1].x; + sy=tr[1].y; + se=tr[1].face; + delavvy; + number(codes); + { + void& with = tr[1]; + + done; + init(num,true); + display(string("Become ")+codes+':'+"\r\r"+a.name+'\15'+a.comment); + appear(sx,sy,se); + } + } + break; +/* 'D': ninetydump;*/ + case 'G': play_nim; break; + case '': display("\232\25"); break; + default: display("unknown code!"); + } +} + +void punctustrip(string& x) /* Strips punctuation from x. */ +{ + const varying_string<32> punct = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; + byte fv,p; + + for( fv=1; fv <= 32; fv ++) + do { + p=pos(punct[fv-1],x); + if (p==0) flush(); /* <<< The first time I've ever used it! */ + Delete(x,p,1); + } while (!false); +} + +boolean do_pronouns(); +static boolean ambiguous; + +static void displaywhat(char ch, boolean animate) /* << it's an adjective! */ +{ + byte ff; string z; + + if (ch==pardon) + { + ambiguous=true; + if (animate) display("Whom?"); else display("What?"); + } else + { + if (animate) display(string("{ ")+getname(ch)+" }"); + else + { + z=get_better(ch); + if (z!="") display(string("{ ")+z+" }"); + } + } +} + +boolean do_pronouns() +{ + byte fv; + + boolean do_pronouns_result; + ambiguous=false; + for( fv=1; fv <= length(thats); fv ++) + switch (thats[fv]) { + case '\310': { + displaywhat(him,true); + thats[fv]=him; + } + break; + case '\311': { + displaywhat(her,true); + thats[fv]=her; + } + break; + case '\312': { + displaywhat(it,false); + thats[fv]=it; + } + break; + } + do_pronouns_result=ambiguous; + return do_pronouns_result; +} + +void store_interrogation(byte interrogation); + + +static void lowercase() +{ + byte fv; + + for( fv=1; fv <= length(current); fv ++) + if (set::of(range('A','Z'), eos).has(current[fv])) + current[fv] += 32; +} + + + +static void propernouns() +{ + byte fv; + + lowercase(); + for( fv=2; fv <= length(current)-1; fv ++) + if (current[fv]==' ') + current[fv+1]=upcase(current[fv+1]); + current[1]=upcase(current[1]); +} + + + +static void sayit() /* This makes Avalot say the response. */ +{ + string x; + + x=current; x[1]=upcase(x[1]); + display(string("\231")+x+'.'+'\2'+'\23'+'2'); +} + +void store_interrogation(byte interrogation) +{ + byte fv; + + + if (current=="") return; + + /* Strip current: */ + while ((current[1]==' ') && (current!="")) Delete(current,1,1); + while ((current[length(current)]==' ') && (current!="")) current[0] -= 1; + + lose_timer(reason_cardiffsurvey); /* if you want to use any other timer, + put this into the case statement. */ + switch (interrogation) { + case 1: { + lowercase(); sayit(); + like2drink=current; + dna.cardiff_things=2; + } + break; + case 2: { + propernouns(); sayit(); + favourite_song=current; + dna.cardiff_things=3; + } + break; + case 3: { + propernouns(); sayit(); + worst_place_on_earth=current; + dna.cardiff_things=4; + } + break; + case 4: { + lowercase(); sayit(); + fillchar(spare_evening,sizeof(spare_evening),'\261'); + spare_evening=current; + dixi('z',5); /* His closing statement... */ + tr[2].walkto(4); /* The end of the drawbridge */ + tr[2].vanishifstill=true; /* Then go away! */ + magics[2].op=nix; + dna.cardiff_things=5; + } + break; + + case 99: store_high(current); break; + } + if (interrogation<4) cardiff_survey; +} + +void clearwords() +{ + fillchar(realwords,sizeof(realwords),'\0'); +} + +void parse() +{ + byte n,fv,ff; string c,cc,thisword; varying_string<1> answer; boolean notfound; + + /* first parsing - word identification */ + + thats=""; c=current+'\40'; n=1; polite=false; + verb=pardon; thing=pardon; thing2=pardon; person=pardon; + clearwords(); + if (current[1]=='.') + { /* a cheat mode attempt */ + cheatparse(current); thats=nowt; return; + } /* not our department! Otherwise... */ + + /* Are we being interrogated right now? */ + + if (interrogation>0) + { + store_interrogation(interrogation); + weirdword=true; + return; + } + + cc=c; for( fv=1; fv <= length(c); fv ++) c[fv]=upcase(c[fv]); + while (c!="") + { + while ((c[1]=='\40') && (c!="")) + { Delete(c,1,1); Delete(cc,1,1); } + thisword=copy(c,1,pos("\40",c)-1); + realwords[n]=copy(cc,1,pos("\40",cc)-1); + punctustrip(c); + + notfound=true; + + if (thisword!="") + { + for( ff=1; ff <= 30; ff ++) + { /* Check Also, FIRST! */ + if (pos(string(',')+thisword,also[ff][0])>0) + { + thats=thats+chr(99+ff); + notfound=false; + } + } + } + + if (notfound) + { + answer=wordnum(thisword); + if (answer==pardon) + { + notfound=true; + thats=thats+pardon; + } else + thats=thats+wordnum(thisword); + n += 1; + } + Delete(c,1,pos("\40",c)); Delete(cc,1,pos("\40",cc)); + } + + if (pos("\376",thats)>0) unknown=realwords[pos("\376",thats)]; else unknown=""; replace("\377",""); /* zap noise words */ + replace(string('\15')+'\342',"\1"); /* "look at" = "examine" */ + replace(string('\15')+'\344',"\1"); /* "look in" = "examine" */ + replace(string('\4')+'\343',"\21"); /* "get up" = "stand" */ + replace(string('\4')+'\347',"\21"); /* "get down" = "stand"... well, why not? */ + replace(string('\22')+'\344',"\2"); /* "go in" = "open [door]" */ + replace(string('\34')+'\345',"\375"); /* "P' off" is a swear word */ + replace(string('\4')+'\6',"\6"); /* "Take inventory" (remember Colossal Adventure?) */ + replace(string('\50')+'\350',"\25"); /* "put on" = "don" */ + replace(string('\4')+'\345',"\24"); /* "take off" = "doff" */ + + /* Words that could mean more than one person */ + { + if (room==r__nottspub) replace("\314","\244"); /* Barman = Port */ + else replace("\314","\232"); /* Barman = Malagauche */ + switch (room) { + case r__aylesoffice: replace("\313","\243"); break; /* Monk = Ayles */ + case r__musicroom: replace("\313","\246"); break; /* Monk = Jacques */ + default: replace("\313","\242"); /* Monk = Ibythneth */ + } + } + + if (do_pronouns()) + { + weirdword=true; + thats=nowt; + return; + } + + /* second parsing - accidence */ + + subject=""; subjnumber=0; /* Find subject of conversation. */ + for( fv=1; fv <= 11; fv ++) + if (set::of('`','\'', eos).has(realwords[fv][1])) + { + subjnumber=ord(thats[fv]); + thats[fv]=moved; + flush(); /* Only the second time I've used that! */ + } + if (subjnumber==0) /* Still not found. */ + for( fv=1; fv <= 10; fv ++) + if (thats[fv]=='\374') /* the word is "about", or something similar */ + { + subjnumber=ord(thats[fv+1]); + thats[fv+1]='\0'; + flush(); /* ...Third! */ + } + if (subjnumber==0) /* STILL not found! Must be the word after "say". */ + for( fv=1; fv <= 10; fv ++) + if ((thats[fv]=='\7') && ! (set::of('\0',range('\341','\345'), eos).has(thats[fv+1]))) + { /* SAY not followed by a preposition */ + subjnumber=ord(thats[fv+1]); + thats[fv+1]='\0'; + flush(); /* ...Fourth! */ + } + + for( fv=length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ + switch (thats[fv]) { + case '\1' ... '\61':case '\375':case '\371': verb=thats[fv]; break; + case '\62' ... '\225': { thing2=thing; thing=thats[fv]; } break; + case '\226' ... '\307': person=thats[fv]; break; + case '\373': polite=true; break; + } + + if ((unknown!="") && ! + (set::of(vb_exam,vb_talk,vb_save,vb_load,vb_dir, eos).has(verb))) + { + display(string("Sorry, but I have no idea what `")+unknown+ + "\" means. Can you rephrase it?"); + weirdword=true; + } else weirdword=false; + if (thats=="") thats=nowt; + + if (thing!=pardon) it=thing; + if (person!=pardon) + { + if (person<'\257') him=person; else her=person; + } +} + +void examobj() /* Examine a standard object-thing */ +{ + if (thing!=thinks) thinkabout(thing,a_thing); + switch (thing) { + case wine : switch (winestate) { + /* 4 is perfect wine. 0 is not holding the wine. */ + case 1: dixi('t',1); break; /* Normal examine wine scroll */ + case 2: dixi('d',6); break; /* Bad wine */ + case 3: dixi('d',7); break; /* Vinegar */ + } + break; + case onion: if (rotten_onion) + dixi('q',21); /* Yucky onion. */ + else + dixi('t',18); + break; /* Normal onion scroll */ + default: + dixi('t',ord(thing)); /* <<< Ordinarily */ + } +} + +boolean personshere() /* Person equivalent of "holding" */ +{ + boolean personshere_result; + if ((person==pardon) || (person=='\0') + || (whereis[person]==dna.room)) personshere_result=true; + else { + if (person<'\257') display("H\4"); else display("Sh\4"); + display("e isn't around at the moment."); + personshere_result=false; + } + return personshere_result; +} + +void exampers() +{ + if (personshere()) + { + if (thing!=thinks) thinkabout(person,a_person); + person -= 149; + switch (person) { /* Special cases */ + case '\13': if (wonnim) + { + dixi('Q',8); /* "I'm Not Playing!" */ + return; + } + break; + case '\11': if (lustie_is_asleep) + { dixi('Q',65); /* He's asleep. (65! Wow!) */ return; } + break; + } + /* Otherwise... */ dixi('p',ord(person)); + } /* And afterwards... */ + switch (person) { + case '\16': if (~ dna.ayles_is_awake) dixi('Q',13); break; /* u.f.s.? */ + } +} + +boolean holding() +{ + boolean holding_result; + if (set::of(range('\63','\143'), eos).has(thing)) { holding_result=true; return holding_result; } /* Also */ + holding_result=false; + if (thing>'\144') display("Be reasonable!"); else + if (~ dna.obj[thing]) /* verbs that need "thing" to be in the inventory */ + display("You're not holding it, Avvy."); else + holding_result=true; + return holding_result; +} + +void examine(); + +static void special(boolean before) +{ + switch (dna.room) { + case r__yours: switch (thing) { + case '\66': if (before) show_one(5); else show_one(6); break; + } + break; + } +} + +void examine() +{ + /* Examine. EITHER it's an object OR it's an Also OR it's a person OR + it's something else. */ + if ((person==pardon) && (thing!=pardon)) + { + if (holding()) + switch (thing) { /* remember it's been Slipped- ie subtract 49 */ + case '\1' ... '\61' : examobj(); break; /* Standard object */ + case '\62' ... '\144' : { + special(true); + display(also[ord(thing)-50][1]); /* Also thing */ + special(false); + } + break; + } + } else + if (person!=pardon) exampers(); + else display("It's just as it looks on the picture."); /* don't know- guess */ +} + +void inv() /* the time-honoured command... */ +{ + char fv; byte q; + + q=0; display(string("You're carrying ")+'\4'); + { + for( fv='\1'; fv <= numobjs; fv ++) + if (obj[fv]) + { + q += 1; if (q==carrying) display(string("and ")+'\4'); + display(get_better(fv)+'\4'); + if (fv==wearing) display(string(", which you're wearing")+'\4'); + if (q0) dixi('q',23); else others(); break; + case r__robins: { + if (dna.tied_up) dixi('q',38); + if (dna.mushroom_growing) dixi('q',55); + } + break; + case r__insidecardiffcastle: if (~ dna.taken_pen) dixi('q',49); break; + case r__lustiesroom: if (dna.lustie_is_asleep) dixi('q',65); break; + case r__catacombs: switch (dna.cat_y*256+dna.cat_x) { + case 258 : dixi('q',80); break; /* Inside art gallery */ + case 514 : dixi('q',81); break; /* Outside ditto */ + case 260 : dixi('q',82); break; /* Outside Geida's room. */ + } + break; + default: others(); + } +} + +void opendoor() /* so whaddya THINK this does?! */ +{ + byte fv; + + switch (dna.room) { /* Special cases. */ + case r__yours: if (infield(2)) + { /* Opening the box. */ + thing='\66'; /* The box. */ person=pardon; + examine(); + return; + } + break; + case r__spludwicks: if (thing=='\75') { + dixi('q',85); + return; + } + break; + } + + + if ((~ dna.user_moves_avvy) & (dna.room!=r__lusties)) + return; /* No doors can open if you can't move Avvy. */ + for( fv=9; fv <= 15; fv ++) + if (infield(fv)) + { + { void& with = portals[fv]; + switch (op) { + case exclaim: { tr[1].bounce; dixi('x',data); } break; + case transport: fliproom(hi(data),lo(data)); break; + case unfinished: { + tr[1].bounce; + display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case special: call_special(data); break; + case mopendoor: open_the_door(hi(data),lo(data),fv); break; + }} + return; + } + if (dna.room==r__map) + display(string("Avvy, you can complete the whole game without ever going ")+ + "to anywhere other than Argent, Birmingham, Cardiff, "+ + "Nottingham and Norwich."); + else display("Door? What door?"); +} + +void putproc(); + + +static void silly() +{ + display("Don't be silly!"); +} + +void putproc() /* Called when you call vb_put. */ +{ + char temp; + + + if (! holding()) return; + thing2 -= 49; /* Slip the second object */ + temp=thing; thing=thing2; if (! holding()) return; + thing=temp; + + /* Thing is the thing which you're putting in. Thing2 is where you're + putting it. */ + /* Convenience thing. */ + switch (thing2) { + case wine: if (thing==onion) + { + if (dna.rotten_onion) + display(string("That's a bit like shutting the stable door after the ")+ + "horse has bolted!"); + else { /* Put onion into wine? */ + if (dna.winestate!=3) + display("\6Oignon au vin\22 is a bit too strong for your tastes!"); + else { /* Put onion into vinegar! Yes! */ + onion_in_vinegar=true; + points(7); + dixi('u',9); + } + } + } else silly(); + break; + + case '\66': if (room==1) /* Put something into the box. */ + { + if (box_contents!=nowt) + display(string("There's something in the box already, Avvy. Try taking")+ + " that out first."); + else + switch (thing) { + case money: display("You'd better keep some ready cash on you!"); break; + case bell: display("That's a silly place to keep a bell."); break; + case bodkin: display("But you might need it!"); break; + case onion: display("Just give it to Spludwick, Avvy!"); break; + default: + { /* Put the object into the box... */ + if (wearing==thing) + display(string("You'd better take ")+get_better(thing)+" off first!"); + else + { + show_one(5); /* Open box. */ + box_contents=thing; + dna.obj[thing]=false; + objectlist; + display("OK, it's in the box."); + show_one(6); /* Shut box. */ + } + } + } + } else silly(); + break; + + default: silly(); + } +} + +boolean give2spludwick(); + + /* The result of this fn is whether or not he says "Hey, thanks!" */ +static void not_in_order() +{ + display(string("Sorry, I need the ingredients in the right order for this potion.")+ + " What I need next is "+ + get_better(spludwick_order[dna.given2spludwick])+".\232\2"); +} + + + +static void go_to_cauldron() +{ + tr[2].call_eachstep=false; /* Stops Geida_Procs. */ + set_up_timer(1,procspludwick_goes_to_cauldron,reason_spludwalk); + tr[2].walkto(2); +} + +boolean give2spludwick() + +{ + boolean give2spludwick_result; + { + + give2spludwick_result=false; + + if (spludwick_order[given2spludwick]!=thing) + { + not_in_order(); + return give2spludwick_result; + } + + switch (thing) { + case onion: + { + obj[onion]=false; + if (rotten_onion) + dixi('q',22); + else { + given2spludwick += 1; + dixi('q',20); + go_to_cauldron(); + points(3); + } + objectlist; + } + break; + case ink: { + obj[ink]=false; + objectlist; + given2spludwick += 1; + dixi('q',24); + go_to_cauldron(); + points(3); + } + break; + case mushroom: { + obj[mushroom]=false; + dixi('q',25); + points(5); + given2spludwick += 1; + go_to_cauldron(); + obj[potion]=true; + objectlist; + } + break; + default: give2spludwick_result=true; + } + } + return give2spludwick_result; +} + +void have_a_drink() +{ + { + alcohol += 1; + if (alcohol==5) + { + obj[key]=true; /* Get the key. */ + teetotal=true; + avvy_is_awake=false; + avvy_in_bed=true; + objectlist; + dusk; + hang_around_for_a_while; + fliproom(1,1); + background(14); + new_game_for_trippancy; /* Not really */ + } + } +} + +void cardiff_climbing() +{ + if (dna.standing_on_dais) + { /* Clamber up. */ + display("You climb down, back onto the floor."); + dna.standing_on_dais=false; + apped(1,3); + } else + { /* Clamber down. */ + if (infield(1)) + { + display("You clamber up onto the dais."); + dna.standing_on_dais=true; + apped(1,2); + } else + display("Get a bit closer, Avvy."); + } +} + +void stand_up(); + + /* Called when you ask Avvy to stand. */ +static void already() +{ + display("You're already standing!"); +} + +void stand_up() +{ + switch (dna.room) { + case r__yours: /* Avvy isn't asleep. */ + if (avvy_in_bed) /* But he's in bed. */ + { + if (teetotal) + { + dixi('d',12); + background(0); + dixi('d',14); + } + tr[1].visible=true; + user_moves_avvy=true; + apped(1,2); + dna.rw=left; + show_one(4); /* Picture of empty pillow. */ + points(1); + avvy_in_bed=false; + lose_timer(reason_arkata_shouts); + } else already(); + break; + + case r__insidecardiffcastle: cardiff_climbing(); break; + + case r__nottspub: if (sitting_in_pub) { + show_one(4); /* Not sitting down. */ + tr[1].visible=true; /* But standing up. */ + apped(1,4); /* And walking away. */ + sitting_in_pub=false; /* Really not sitting down. */ + user_moves_avvy=true; /* And ambulant. */ + } else already(); + break; + default: already(); + } +} + +void getproc(char thing) +{ + switch (room) { + case r__yours: + if (infield(2)) + { + if (box_contents==thing) + { + show_one(5); + display("OK, I've got it."); + obj[thing]=true; objectlist; + box_contents=nowt; + show_one(6); + } else + display(string("I can't see ")+get_better(thing)+" in the box."); + } else dixi('q',57); + break; + case r__insidecardiffcastle: + switch (thing) { + case pen: + { + if (infield(2)) + { /* Standing on the dais. */ + + if (dna.taken_pen) + display("It's not there, Avvy."); + else + { /* OK: we're taking the pen, and it's there. */ + show_one(4); /* No pen there now. */ + call_special(3); /* Zap! */ + dna.taken_pen=true; + dna.obj[pen]=true; + objectlist; + display("Taken."); + } + } else if (dna.standing_on_dais) dixi('q',53); else dixi('q',51); + } + break; + case bolt: dixi('q',52); break; + default: dixi('q',57); + } + break; + case r__robins: if ((thing==mushroom) & (infield(1)) & (dna.mushroom_growing)) + { + show_one(3); + display("Got it!"); + dna.mushroom_growing=false; + dna.taken_mushroom=true; + dna.obj[mushroom]=true; + objectlist; + points(3); + } else dixi('q',57); + break; + default: dixi('q',57); + } +} + +void give_geida_the_lute() +{ + { + if (room!=r__lustiesroom) + { + display("Not yet. Try later!\232\2"); + return; + } + dna.obj[lute]=false; + objectlist; + dixi('q',64); /* She plays it. */ + + /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ + + set_up_timer(1,procgive_lute_to_geida,reason_geida_sings); + back_to_bootstrap(4); + } +} + +void play_harp() +{ + if (infield(7)) + musical_scroll; + else display("Get a bit closer to it, Avvy!"); +} + +void winsequence() +{ + dixi('q',78); + first_show(7); then_show(8); then_show(9); + start_to_close; + set_up_timer(30,procwinning,reason_winning); +} + +void person_speaks() +{ + boolean found; byte fv; char cfv; + + + if ((person==pardon) || (person=='\0')) + { + if ((him==pardon) || (whereis[him]!=dna.room)) person=her; + else person=him; + } + + if (whereis[person]!=dna.room) + { + display("\231\4"); /* Avvy himself! */ + return; + } + + found=false; /* The person we're looking for's code is in Person. */ + + for( fv=1; fv <= numtr; fv ++) + if (tr[fv].quick & (chr(tr[fv].a.accinum+149)==person)) + { + display(string('\23')+chr(fv+48)+'\4'); + found=true; + } + + if (! found) + for( fv=10; fv <= 25; fv ++) + { void& with = quasipeds[fv]; + if ((who==person) && (room==dna.room)) + { + display(string('\23')+chr(fv+55)+'\4'); + }} +} + +void do_that(); + +static void heythanks() +{ + person_speaks(); + display("Hey, thanks!\2(But now, you've lost it!)"); + dna.obj[thing]=false; +} + +void do_that() +{ + const array<'\63','\72',varying_string<6> > booze = {{"Bitter","GIED","Whisky","Cider","","","","Mead"}}; + byte fv,ff; integer sx,sy; boolean ok; + + + if (thats==nowt) { thats=""; return; } + if (weirdword) return; + if (thing<'\310') thing -= 49; /* "Slip" */ + + if ((~ alive) & + ! (set::of(vb_load,vb_save,vb_quit,vb_info,vb_help,vb_larrypass, + vb_phaon,vb_boss,vb_cheat,vb_restart,vb_dir,vb_score, + vb_highscores,vb_smartalec, eos).has(verb))) + { + display(string("You're dead, so don't talk. What are you, a ghost ")+ + "or something? Try restarting, or restoring a saved game!"); return; + } + + if ((~ dna.avvy_is_awake) & + ! (set::of(vb_load,vb_save,vb_quit,vb_info,vb_help,vb_larrypass, + vb_phaon,vb_boss,vb_cheat,vb_restart,vb_dir,vb_die,vb_score, + vb_highscores,vb_smartalec,vb_expletive,vb_wake, eos).has(verb))) + { + display("Talking in your sleep? Try waking up!"); return; + } + + + switch (verb) { + case vb_exam: examine(); break; + case vb_open: opendoor(); break; + case vb_pause: display(string("Game paused.")+'\3'+'\15'+'\15'+"Press Enter, Esc, or click "+ + "the mouse on the `O.K.\" box to continue."); + break; + case vb_get: { + if (thing!=pardon) + { /* Legitimate try to pick something up. */ + if (dna.carrying>=maxobjs) display("You can't carry any more!"); + else getproc(thing); + + } else + { /* Not... ditto. */ + if (person!=pardon) + display("You can't sweep folk off their feet!"); else + display("I assure you, you don't need it."); + } + } + break; + case vb_drop: display(string("Two years ago you dropped a florin in the street. Three days ")+ + "later it was gone! So now you never leave ANYTHING lying around. OK?"); + break; +/* begin dna.obj[thing]:=false; objectlist; end;*/ + case vb_inv: inv(); break; + case vb_talk: if (person==pardon) + { + if (subjnumber==99) /* They typed "say password". */ + display("Yes, but what \6is\22 the password?"); + else if (set::of(range(1,49),253,249, eos).has(subjnumber)) + { + Delete(thats,1,1); + move(realwords[2],realwords[1],sizeof(realwords)-sizeof(realwords[1])); + verb=chr(subjnumber); + do_that(); return; + } else + { + person=chr(subjnumber); subjnumber=0; + if (set::of(pardon,'\0', eos).has(person)) display("Talk to whom?"); + else if (personshere()) talkto(ord(person)); + } + } else if (person==pardon) display("Talk to whom?"); + else if (personshere()) talkto(ord(person)); + break; + + case vb_give: if (holding()) + { + if (person==pardon) display("Give to whom?"); else + if (personshere()) + { + switch (thing) { + case money : display("You can't bring yourself to give away your moneybag."); break; + case bodkin:case bell:case clothes:case habit : + display("Don't give it away, it might be useful!"); + break; + default: switch (person) { + case pcrapulus: switch (thing) { + case wine: { + display("Crapulus grabs the wine and gulps it down."); + dna.obj[wine]=false; + } + break; + default: heythanks(); + } + break; + case pcwytalot: if (set::of(crossbow,bolt, eos).has(thing)) + display(string("You might be able to influence ")+ + "Cwytalot more if you used it!"); + else heythanks(); + break; + case pspludwick: if (give2spludwick()) heythanks(); break; + case pibythneth: if (thing==badge) + { + dixi('q',32); /* Thanks! Wow! */ + points(3); + dna.obj[badge]=false; + dna.obj[habit]=true; + dna.givenbadgetoiby=true; + show_one(8); show_one(9); + } else heythanks(); + break; + case payles: if (dna.ayles_is_awake) + { + if (thing==pen) + { + dna.obj[pen]=false; + dixi('q',54); + dna.obj[ink]=true; + dna.given_pen_to_ayles=true; + objectlist; + points(2); + } else heythanks(); + } else + display("But he's asleep!"); + break; + case pgeida: switch (thing) { + case potion : { + dna.obj[potion]=false; + dixi('u',16); /* She drinks it. */ + points(2); + dna.geida_given_potion=true; + objectlist; + } + break; + case lute: give_geida_the_lute(); break; + default: heythanks(); + } + break; + case parkata: switch (thing) { + case potion: if (dna.geida_given_potion) + winsequence(); + else dixi('q',77); + break; /* That Geida woman! */ + default: heythanks(); + } + break; + default: heythanks(); + } + } + } + objectlist; /* Just in case... */ + } + break; + + case vb_eat:case vb_drink: if (holding()) swallow(); break; + case vb_load: edna_load(realwords[2]); break; + case vb_save: if (alive) edna_save(realwords[2]); + else display("It's a bit late now to save your game!"); + break; + case vb_pay: display("No money need change hands."); break; + case vb_look: lookaround(); break; + case vb_break: display("Vandalism is prohibited within this game!"); break; + case vb_quit: { /* quit */ + if (demo) + { + dixi('q',31); + close(demofile); + exit(0); /* Change this later!!! */ + } + if (! polite) display("How about a `please\", Avvy?"); else + if (ask("\23C\26Do you really want to quit?")) lmo=true; + } + break; + case vb_go: display("Just use the arrow keys to walk there."); break; + case vb_info: { + aboutscroll=true; +/* display('Thorsoft of Letchworth presents:'+^c+^m+^m+ + 'The medival descendant of'+^m+ + 'Denarius Avaricius Sextus'+^m+'in:'+ + ^m+^m+'LORD AVALOT D''ARGENT'+ + ^m+'version '+vernum+^m+^m+'Copyright ' + +copyright+', Mark, Mike and Thomas Thurman.');*/ + display(string("\r\r\r\r\r\r\r")+"LORD AVALOT D'ARGENT"+"\3\r"+ + "The medival descendant of"+'\15'+ + "Denarius Avaricius Sextus"+ + '\15'+'\15'+"version "+vernum+'\15'+'\15'+"Copyright " + +copyright+", Mark, Mike and Thomas Thurman."+'\23'+'Y'+'\26'); + aboutscroll=false; + } + break; + case vb_undress: if (dna.wearing==nowt) display("You're already stark naked!"); + else + if (dna.avvys_in_the_cupboard) + { + display(string("You take off ")+get_better(dna.wearing)+'.'); + dna.wearing=nowt; objectlist; + } else + display("Hadn't you better find somewhere more private, Avvy?"); + break; + case vb_wear: if (holding()) + { /* wear something */ + switch (thing) { + case chastity: display("Hey, what kind of a weirdo are you\??!"); break; + case clothes:case habit: { /* Change this! */ + if (dna.wearing!=nowt) + { + if (dna.wearing==thing) + display("You're already wearing that."); + else + display(string("You'll be rather warm wearing two ")+ + "sets of clothes!"); + return; + } else + dna.wearing=thing; objectlist; + if (thing==habit) fv=3; else fv=0; + { void& with = tr[1]; + if (whichsprite!=fv) + { + sx=tr[1].x; sy=tr[1].y; + done; + init(fv,true); + appear(sx,sy,left); + tr[1].visible=false; + }} + } + break; + default: display(what); + } + } + break; + case vb_play: if (thing==pardon) + switch (dna.room) { /* They just typed "play"... */ + case r__argentpub: play_nim; break; /* ...in the pub, => play Nim. */ + case r__musicroom: play_harp(); break; + } + else if (holding()) + { + switch (thing) { + case lute : { + dixi('U',7); + if (whereis[pcwytalot]==dna.room) dixi('U',10); + if (whereis[pdulustie]==dna.room) dixi('U',15); + } + break; + case '\64' : if (dna.room==r__musicroom) play_harp(); + else display(what); + break; + case '\67' : if (dna.room==r__argentpub) play_nim; + else display(what); + break; + default: display(what); + } + } + break; + case vb_ring: if (holding()) + { + if (thing==bell) + { + display("Ding, dong, ding, dong, ding, dong, ding, dong..."); + if ((dna.ringing_bells) & (flagset('B'))) + display("(Are you trying to join in, Avvy\?\?!)"); + } else display(what); + } + break; + case vb_help: boot_help; break; + case vb_larrypass: display("Wrong game!"); break; + case vb_phaon: display("Hello, Phaon!"); break; + case vb_boss: bosskey; break; + case vb_pee: if (flagset('P')) + { + display("Hmm, I don't think anyone will notice..."); + set_up_timer(4,procurinate,reason_gototoilet); + } else display("It would be \6VERY\22 unwise to do that here, Avvy!"); + break; + case vb_cheat: { + display(string('\6')+"Cheat mode now enabled."); + cheat=true; + } + break; + case vb_magic: if (dna.avaricius_talk>0) + dixi('q',19); + else { + if ((dna.room==12) & (infield(2))) + { /* Avaricius appears! */ + dixi('q',17); + if (whereis['\227']==12) + dixi('q',18); + else + { + tr[2].init(1,false); /* Avaricius */ + apped(2,4); + tr[2].walkto(5); + tr[2].call_eachstep=true; + tr[2].eachstep=procback_and_forth; + dna.avaricius_talk=14; + set_up_timer(177,procavaricius_talks,reason_avariciustalks); + } + } else display("Nothing appears to happen..."); + } + break; + case vb_smartalec: display("Listen, smart alec, that was just rhetoric."); break; + case vb_expletive: { + switch (swore) { + case 0: display(string("Avvy! Do you mind? There might be kids playing!\r\r")+ + "(I shouldn't say it again, if I were you!)"); + break; + case 1: display(string("You hear a distant rumble of thunder. Must you always ")+ + "do things I tell you not to?\r\rDon't do it again!"); + break; + default: + { + zonk; + display(string("A crack of lightning shoots from the sky, ")+ + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); + gameover; + } + } + swore += 1; + } + break; + case vb_listen: if ((dna.ringing_bells) & (flagset('B'))) + display(string("All other noise is drowned out by the ringing of ")+ + "the bells."); + else + if (listen=="") + display("You can't hear anything much at the moment, Avvy."); + else display(listen); + break; + case vb_buy: { + /* What are they trying to buy? */ + switch (dna.room) { + case r__argentpub: if (infield(6)) + { /* We're in a pub, and near the bar. */ + switch (thing) { + case '\63':case '\65':case '\66':case '\72': { /* Beer, whisky, cider or mead */ + if (dna.malagauche==177) /* Already getting us one. */ + { dixi('D',15); return; } + if (dna.teetotal) { dixi('D',6); return; } + if (dna.alcohol==0) points(3); + show_one(12); + display(booze[thing]+", please.\231\2"); + dna.drinking=thing; + + show_one(10); + dna.malagauche=177; + set_up_timer(27,procbuydrinks,reason_drinks); + } + break; + case '\64': examine(); break; /* We have a right one here- buy Pepsi??! */ + case wine: if (dna.obj[wine]) /* We've already got the wine! */ + dixi('D',2); /* 1 bottle's shufishent! */ + else { + if (dna.malagauche==177) /* Already getting us one. */ + { dixi('D',15); return; } + if (dna.carrying>=maxobjs) + { display("Your hands are full."); return; } + show_one(12); display("Wine, please.\231\2"); + if (dna.alcohol==0) points(3); + show_one(10); + dna.malagauche=177; + + set_up_timer(27,procbuywine,reason_drinks); + } + break; + } + } else dixi('D',5); + break; /* Go to the bar! */ + + case r__outsideducks: if (infield(6)) + { + if (thing==onion) + { + if (dna.obj[onion]) + dixi('D',10); /* not planning to juggle with the things! */ + else + if (dna.carrying>=maxobjs) + display("Before you ask, you remember that your hands are full."); + else + { + if (dna.bought_onion) + dixi('D',11); else + { dixi('D',9); points(3); } + pennycheck(3); /* It costs thruppence. */ + dna.obj[onion]=true; + objectlist; + dna.bought_onion=true; + dna.rotten_onion=false; /* It's OK when it leaves the stall! */ + dna.onion_in_vinegar=false; + } + } else dixi('D',0); + } else dixi('D',0); + break; + + case r__nottspub: dixi('n',15); break; /* Can't sell to southerners. */ + default: dixi('D',0); /* Can't buy that. */ + } + } + break; + case vb_attack: { + if ((dna.room==r__brummieroad) && + ((person=='\235') || (thing==crossbow) || (thing==bolt)) + && (whereis['\235']==dna.room)) + { + switch (ord(dna.obj[bolt])+ord(dna.obj[crossbow])*2) { + /* 0 = neither, 1 = only bolt, 2 = only crossbow, + 3 = both. */ + case 0: { + dixi('Q',10); + display("(At the very least, don't use your bare hands!)"); + } + break; + case 1: display(string("Attack him with only a crossbow bolt? Are you ")+ + "planning on playing darts?!"); + break; + case 2: display(string("Come on, Avvy! You're not going to get very far ")+ + "with only a crossbow!"); + break; + case 3: { + dixi('Q',11); + dna.cwytalot_gone=true; + dna.obj[bolt]=false; dna.obj[crossbow]=false; + objectlist; + magics[12].op=nix; + points(7); + tr[2].walkto(2); + tr[2].vanishifstill=true; + tr[2].call_eachstep=false; + whereis['\235']=177; + } + break; + default: dixi('Q',10); /* Please try not to be so violent! */ + } + } else dixi('Q',10); + } + break; + case vb_password: if (dna.room!=r__bridge) + dixi('Q',12); else + { + ok=true; + for( ff=1; ff <= length(thats); ff ++) + for( fv=1; fv <= length(words[dna.pass_num+first_password].w); fv ++) + if (words[dna.pass_num+first_password].w[fv] != + upcase(realwords[ff][fv])) + ok=false; + if (ok) + { + if (dna.drawbridge_open!=0) + display("Contrary to your expectations, the drawbridge fails to close again."); + else + { + points(4); + display("The drawbridge opens!"); + set_up_timer(7,procopen_drawbridge,reason_drawbridgefalls); + dna.drawbridge_open=1; + } + } else dixi('Q',12); + } + break; + case vb_dir: dir(realwords[2]); break; + case vb_die: gameover; break; + case vb_score: display(string("Your score is ")+strf(dna.score)+",\3\rout of a "+ + "possible 128.\r\rThis gives you a rank of "+rank()+ + ".\r\r"+totaltime()); + break; + case vb_put: putproc(); break; + case vb_stand: stand_up(); break; + + case vb_kiss: if (person==pardon) + display("Kiss whom?"); + else if (personshere()) + switch (person) { + case '\226' ... '\256': display("Hey, what kind of a weirdo are you??"); break; + case parkata: dixi('U',12); break; + case pgeida: dixi('U',13); break; + case pwisewoman: dixi('U',14); break; + default: dixi('U',5); /* You WHAT? */ + } + break; + + case vb_climb: if (dna.room==r__insidecardiffcastle) cardiff_climbing(); + else /* In the wrong room! */ + display("Not with your head for heights, Avvy!"); + break; + + case vb_jump: { + set_up_timer(1,procjump,reason_jumping); + dna.user_moves_avvy=false; + } + break; + + case vb_highscores: show_highs; break; + + case vb_wake: if (personshere()) + switch (person) { + case pardon:case pavalot:case '\0': if (~ avvy_is_awake) + { + avvy_is_awake=true; + points(1); + avvy_in_bed=true; + show_one(3); /* Picture of Avvy, awake in bed. */ + if (teetotal) dixi('d',13); + } else display("You're already awake, Avvy!"); + break; + case payles: if (~ ayles_is_awake) display("You can't seem to wake him by yourself."); break; + case pjacques: display(string("Brother Jacques, Brother Jacques, are you asleep?\231\2")+ + "Hmmm... that doesn't seem to do any good..."); + break; + default: display("It's difficult to awaken people who aren't asleep...!"); + } + break; + + case vb_sit: if (dna.room==r__nottspub) + { + if (dna.sitting_in_pub) + display("You're already sitting!"); + else + { + tr[1].walkto(4); /* Move Avvy to the place, and sit him down. */ + set_up_timer(1,procavvy_sit_down,reason_sitting_down); + } + } else + { /* Default doodah. */ + dusk; + hang_around_for_a_while; + dawn; + display("A few hours later...\20nothing much has happened..."); + } + break; + + case vb_restart: if (ask("Restart game and lose changes?")) { + dusk; + newgame; + dawn; + } + break; + + case pardon: display("Hey, a verb would be helpful!"); break; + + case vb_hello: { person_speaks(); display("Hello.\2"); } break; + case vb_thanks: { person_speaks(); display("That's OK.\2"); } break; + default: display(string('\7')+"Parser bug!"); + } +} + +void verbopt(char n, string& answer, char& anskey) +{ + switch (n) { + case vb_exam: { answer="Examine"; anskey='x'; } break; /* the ubiqutous one */ + /* vb_give isn't dealt with by this procedure, but by ddm__with */ + case vb_drink: { answer="Drink"; anskey='D'; } break; + case vb_wear: { answer="Wear"; anskey='W'; } break; + case vb_ring: { answer="Ring"; anskey='R'; } break; /* only the bell! */ + case vb_play: { answer="Play"; anskey='P'; } break; + case vb_eat: { answer="Eat"; anskey='E'; } break; + default: { answer="? Unknown!"; anskey='?'; } /* Bug! */ + } +} + +class unit_acci_initialize { + public: unit_acci_initialize(); +}; +static unit_acci_initialize acci_constructor; + +unit_acci_initialize::unit_acci_initialize() { + weirdword=false; +} diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h new file mode 100644 index 000000000000..f9d1265b327b --- /dev/null +++ b/engines/avalanche/acci.h @@ -0,0 +1,223 @@ +#ifndef __acci_h__ +#define __acci_h__ + + +/* verb codes */ +const char vb_exam = '\1'; const char vb_open = '\2'; const char vb_pause = '\3'; const char vb_get = '\4'; const char vb_drop = '\5'; +const char vb_inv = '\6'; const char vb_talk = '\7'; const char vb_give = '\10'; const char vb_drink = '\11'; const char vb_load = '\12'; +const char vb_save = '\13'; const char vb_pay = '\14'; const char vb_look = '\15'; const char vb_break = '\16'; const char vb_quit = '\17'; +const char vb_sit = '\20'; const char vb_stand = '\21'; const char vb_go = '\22'; const char vb_info = '\23'; const char vb_undress = '\24'; +const char vb_wear = '\25'; const char vb_play = '\26'; const char vb_ring = '\27'; const char vb_help = '\30'; +const char vb_larrypass = '\31'; const char vb_phaon = '\32'; const char vb_boss = '\33'; const char vb_pee = '\34'; +const char vb_cheat = '\35'; const char vb_magic = '\36'; const char vb_restart = '\37'; const char vb_eat = '\40'; +const char vb_listen = '\41'; const char vb_buy = '\42'; const char vb_attack = '\43'; const char vb_password = '\44'; +const char vb_dir = '\45'; const char vb_die = '\46'; const char vb_score = '\47'; const char vb_put = '\50'; +const char vb_kiss = '\51'; const char vb_climb = '\52'; const char vb_jump = '\53'; const char vb_highscores = '\54'; +const char vb_wake = '\55'; const char vb_hello = '\56'; const char vb_thanks = '\57'; + +const char vb_smartalec = '\371'; const char vb_expletive = '\375'; + +const char pardon = '\376'; /* =didn't understand / wasn't given. */ + +struct vocab { + byte n; varying_string<11> w; +}; + +struct ranktype { + word score; varying_string<12> title; +}; + + +const integer nowords = 277; /* how many words does the parser know? */ +const char nowt = '\372'; +const char moved = '\0'; /* This word was moved. (Usually because it was the subject of + conversation.) */ + +const integer first_password = 89; /* Words[first_password] should equal "TIROS". */ + +const array<1,nowords,vocab> words = + +/* Verbs, 1-49 */ +{{{1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ + {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, + {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ + {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, + {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, + {7, "SAY"}, {7, "ASK"}, + {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, + {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, + {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, + {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, + {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, + {17, "STAND"}, + + {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, + {20, "DOFF"}, + {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, + {22, "PLAY"}, + {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, + {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, + {255,"NINET"}, /* block for NINETY */ + {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, + {30,"ABRACADABRA"},{30, "PLUGH"}, {30, "XYZZY"}, + {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, + {30, "WIZZY"}, {30, "PLOVER"}, + {30,"MELENKURION"},{30, "ZORTON"}, {30, "BLERBI"}, + {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, + {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, + {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, + {30, "BONESCROLLS"},{30, "RADOF"}, + + {31, "RESTART"}, + {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, + {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, + {34, "ORDER"}, {34, "DEMAND"}, + {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, + {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, + {35, "FIRE"}, + + /* Passwords, 36: */ + + {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, + {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, + {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, + {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, + {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, + {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, + {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, + {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, + {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, + {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, + + {37, "DIR"}, {37, "LS"}, {38, "DIE"}, + {39, "SCORE"}, + {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, + {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, + {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, + {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, + {46, "HELLO"}, {46, "HI"}, {46, "YO"}, + {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ + + +/* Nouns - Objects: 50-100. */ + + {50, "WINE"}, {50, "BOOZE"}, {50,"NASTY"}, + {50, "VINEGAR"}, {51, "MONEYBAG"}, + {51, "BAG"}, {51, "CASH"}, {51,"DOSH"}, + {51, "WALLET"}, + {52, "BODKIN"}, {52, "DAGGER"}, {53,"POTION"}, + {54, "CHASTITY"}, {54, "BELT"}, {55,"BOLT"}, + {55, "ARROW"}, {55, "DART"}, + {56, "CROSSBOW"}, {56, "BOW"}, {57,"LUTE"}, + {58, "PILGRIM"}, {58, "BADGE"}, {59,"MUSHROOMS"}, + {59, "TOADSTOOLS"},{60, "KEY"}, {61,"BELL"}, + {62, "PRESCRIPT"}, {62, "SCROLL"}, {62,"MESSAGE"}, + {63, "PEN"}, {63, "QUILL"}, {64,"INK"}, + {64, "INKPOT"}, {65, "CLOTHES"}, {66,"HABIT"}, + {66, "DISGUISE"}, {67, "ONION"}, + + {99,"PASSWORD"}, + +/* Objects from Also are placed between 101 and 131. */ + +/* Nouns - People - Male, 150-174 */ + {150, "AVVY"}, {150,"AVALOT"}, {150,"YOURSELF"}, + {150, "ME"}, {150,"MYSELF"}, {151,"SPLUDWICK"}, + {151, "THOMAS"}, {151,"ALCHEMIST"}, {151,"CHEMIST"}, + {152, "CRAPULUS"}, {152,"SERF"}, {152,"SLAVE"}, + {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ + {152, "CRAPPY"}, {153,"DUCK"}, {153,"DOCTOR"}, + {154, "MALAGAUCHE"}, + {155, "FRIAR"}, {155,"TUCK"}, {156,"ROBIN"}, + {156, "HOOD"}, {157,"CWYTALOT"}, {157,"GUARD"}, + {157, "BRIDGEKEEP"},{158,"BARON"}, {158,"LUSTIE"}, + {159, "DUKE"}, {159,"GRACE"}, {160,"DOGFOOD"}, + {160, "MINSTREL"}, {161,"TRADER"}, {161,"SHOPKEEPER"}, + {161,"STALLHOLDER"}, + {162, "PILGRIM"}, {162,"IBYTHNETH"}, {163,"ABBOT"}, + {163, "AYLES"}, {164,"PORT"}, {165,"SPURGE"}, + {166, "JACQUES"}, {166,"SLEEPER"}, {166,"RINGER"}, + +/* Nouns- People - Female: 175-199 */ + {175, "WIFE"}, {175,"ARKATA"}, {176,"GEDALODAVA"}, + {176, "GEIDA"}, {176,"PRINCESS"}, {178,"WISE"}, + {178, "WITCH"}, + +/* Pronouns, 200-224 */ + {200, "HIM"}, {200,"MAN"}, {200,"GUY"}, + {200, "DUDE"}, {200,"CHAP"}, {200,"FELLOW"}, + {201, "HER"}, {201,"GIRL"}, {201,"WOMAN"}, + {202, "IT"}, {202,"THING"}, + + {203,"MONK"}, {204,"BARMAN"}, {204,"BARTENDER"}, + +/* Prepositions, 225-249 */ + {225, "TO"}, {226,"AT"}, {227,"UP"}, + {228, "INTO"}, {228,"INSIDE"}, {229,"OFF"}, + {230, "UP"}, {231,"DOWN"}, {232,"ON"}, + + +/* Please, 251 */ + {251, "PLEASE"}, + +/* About, 252 */ + {252, "ABOUT"}, {252, "CONCERNING"}, + +/* Swear words, 253 */ + /* I M P O R T A N T M E S S A G E + + DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE + DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. + GOODNESS KNOWS WHO WROTE THEM. + READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. + WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ + + {253, "SHIT"}, {28 ,"PISS"}, {28 ,"PEE"}, + {253, "FART"}, {253,"FUCK"}, {253,"BALLS"}, + {253, "BLAST"}, {253,"BUGGER"}, {253,"KNICKERS"}, + {253, "BLOODY"}, {253,"HELL"}, {253,"DAMN"}, + {253, "SMEG"}, + /* and other even ruder words. You didn't read them, did you? Good. */ + +/* Answer-back smart-alec words, 249 */ + {249, "YES"}, {249,"NO"}, {249,"BECAUSE"}, + +/* Noise words, 255 */ + {255, "THE"}, {255,'A'}, {255,"NOW"}, + {255, "SOME"}, {255,"AND"}, {255,"THAT"}, + {255, "POCUS"}, {255,"HIS"}, + {255, "THIS"}, {255,"SENTINEL"}}}; /* for "Ken SENT Me" */ + +const char what[] = "That's not possible!"; + +const array<1,9,ranktype> ranks = +{{{0, "Beginner"}, {10, "Novice"}, +{20, "Improving"}, {35, "Not bad"}, +{50, "Passable"}, {65, "Good"}, +{80, "Experienced"}, {108, "The BEST!"}, +{maxint, "copyright'93"}}}; + + +#ifdef __acci_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN varying_string<11> thats; +EXTERN varying_string<20> unknown; +EXTERN array<1,11,varying_string<20> > realwords; +EXTERN char verb,person,thing,thing2; +EXTERN boolean polite; +#undef EXTERN +#define EXTERN extern + + +void clearwords(); +void parse(); +void lookaround(); +void opendoor(); +void do_that(); +void verbopt(char n, string& answer, char& anskey); +void have_a_drink(); + +#endif diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp new file mode 100644 index 000000000000..17853e618914 --- /dev/null +++ b/engines/avalanche/also.cpp @@ -0,0 +1,1028 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Rodent.h"*/ +/*#include "Crt.h"*/ + +/*$R+,V-*/ + +typedef matrix<0,255,0,15,byte> fonttype; + +class fieldtype { +public: + integer x1,y1,x2,y2; +}; + +class linetype : public fieldtype { +public: + byte col; +}; + +struct pedtype { + integer x,y; byte dir; +}; + +struct magictype { + byte op; /* one of the operations */ + word data; /* data for them */ +}; + +const integer numlines = 50; const integer up = 0; const integer right = 1; const integer down = 2; const integer left = 3; const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer still = 8; + +const integer nay = maxint; + +/* Magic commands are */ + +/*N*/ const integer nix = 0; /* ignore it if this line is touched */ +/*B*/ const integer bounce = 1; /* bounce off this line */ +/*E*/ const integer exclaim = 2; /* put up a chain of scrolls */ +/*T*/ const integer transport = 3; /* enter new room */ +/*U*/ const integer unfinished = 4; /* unfinished connection */ +/*S*/ const integer special = 5; /* special call */ +/*O*/ const integer opendoor = 6; /* slowly opening door. */ + +integer gd,gm; +array<1,numlines,linetype> lines; +array<1,numlines,fieldtype> fields; +boolean do1; +byte current; +string n; +matrix<0,29,1,2,string> names; +file f; +fonttype skinny; +byte tx,ty; +matrix<0,79,0,22,char> chars; +byte cursorflash; +array<1,15,pedtype> peds; +array<1,15,magictype> magics; +array<9,15,magictype> portals; +varying_string<26> flags; +string listen; + +const graphcursmasktype crosshairs = +{ + ((63551,63807,63807,63807,61727,257,897,32765,897,257,61727,63807,63807,63807,63551,65535), + (4368,21140,8840,53910,640,640,31868,33026,31868,640,640,53910,8840,21140,4368,0)), + 7, + 7}; + +const graphcursmasktype hook = +{ + ((32831,32831,49279,49279,57599,61695,61471,61447,63491,57089,36801,32771,49159,57375,63743,65535), + (0,16256,7936,7936,3584,1536,1792,2016,248,28,8220,12344,8160,1792,0,0)), + 2, + 9}; + +const graphcursmasktype tthand = +{ + ((62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443), + (3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092)), + 4, + 0}; + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void glimpse(byte ret) /* glimpse of screen 3 */ +{ + char sink; +; + hidemousecursor; setvisualpage(3); setcrtpagenumber(3); showmousecursor; + do {; } while (!(~ anymousekeypressed)); + do {; } while (!anymousekeypressed); + hidemousecursor; setvisualpage(ret); setcrtpagenumber(ret); showmousecursor; + while (keypressed()) sink=readkey(); +} + +void newline(byte t, integer p,integer q,integer r,integer s, byte c) +{; + { + linetype& with = lines[t]; + ; + x1=p; y1=q; x2=r; y2=s; with.col=c; + } +} + +void newfield(byte t, integer p,integer q,integer r,integer s) +{; { + fieldtype& with = fields[t]; ; with.x1=p; with.y1=q; with.x2=r; with.y2=s; } } + +void drawped(byte p) +{; + { pedtype& with = peds[p]; + if (with.dir<177) + {; + setcolor(p); circle(with.x,with.y,5); moveto(with.x,with.y); + switch (with.dir) { + case up: linerel(0,-5); break; case down: linerel(0,5); break; + case left: linerel(-7,0); break; case right: linerel(7,0); break; + case ul: linerel(-7,-5); break; case dl: linerel(-7, 5); break; + case ur: linerel( 7,-5); break; case dr: linerel( 7, 5); break; + } + }} +} + +void drawup() +{ + byte fv; +; + cleardevice(); + for( fv=1; fv <= numlines; fv ++) + { linetype& with = lines[fv]; + if (x1!=nay) + {; + setcolor(with.col); + line(x1,y1,x2,y2); + }} + for( fv=1; fv <= numlines; fv ++) + { fieldtype& with = fields[fv]; + if (with.x1!=nay) + {; + setcolor(fv); + rectangle(with.x1,with.y1,with.x2,with.y2); + }} + for( fv=1; fv <= 15; fv ++) drawped(fv); +} + +void addped() +{ + byte n,fv; +; + n=0; do { n += 1; } while (!((n==16) || (peds[n].dir==177))); + setcrtpagenumber(0); setactivepage(0); setvisualpage(0); + drawup(); setgraphicscursor(tthand); showmousecursor; + do { + if (rightmousekeypressed) return; + if (keypressed()) glimpse(0); + } while (!leftmousekeypressed); + hidemousecursor; + { + pedtype& with = peds[n]; + ; + with.x=mousex; with.y=mousey; + } + cleardevice(); setfillstyle(6,9); for( fv=1; fv <= 3; fv ++) bar(200*fv,0,200*fv,200); + for( fv=1; fv <= 2; fv ++) bar(0,60*fv,640,60*fv); + showmousecursor; + do { if (rightmousekeypressed) return; } while (!leftmousekeypressed); + hidemousecursor; + { pedtype& with = peds[n]; + switch (((mousex / 200)*10)+(mousey / 60)) { + case 0: with.dir=ul; break; case 10: with.dir=up; break; case 20: with.dir=ur; break; + case 1: with.dir=left; break; case 11: with.dir=still; break; case 21: with.dir=right; break; + case 2: with.dir=dl; break; case 12: with.dir=down; break; case 22: with.dir=dr; break; + }} +} + +void addline(byte ccc) +{ + byte fv; +; + do { + for( fv=1; fv <= numlines; fv ++) + { linetype& with = lines[fv]; + if (x1==nay) + {; + x1=fv*17; x2=x1; y1=200; y2=190; with.col=ccc; + return; /* bad style! */ + }} + } while (!false); +} + +byte colour() +{ + byte fv; +byte colour_result; +; + setactivepage(0); setvisualpage(0); setcrtpagenumber(0); + outtextxy(0,0,"Select a colour, please..."); + for( fv=1; fv <= 15; fv ++) + {; + setfillstyle(1,fv); + bar(fv*40,27,39+fv*40,200); + } + showmousecursor; + do { + if (rightmousekeypressed) {; hidemousecursor; return colour_result; } + if (keypressed()) glimpse(2); + } while (!leftmousekeypressed); + hidemousecursor; + colour_result=getpixel(mousex,mousey); cleardevice(); +return colour_result; +} + +void addfield() +{ + byte fv; boolean ok; +; + do { + fv=colour(); + ok=fields[fv].x1==nay; + if (! ok) output << '\7'; + } while (!ok); + { + fieldtype& with = fields[fv]; + ; + with.x1=300+fv*17; with.x2=with.x1+1; with.y1=200; with.y2=177; + } +} + +byte checkline() +{ + byte fv,ans; +byte checkline_result; +; + setgraphicscursor(crosshairs); + setcrtpagenumber(0); setactivepage(0); setvisualpage(0); drawup(); + do { + showmousecursor; + do { + if (rightmousekeypressed) {; checkline_result=255; return checkline_result; } + if (keypressed()) glimpse(0); + } while (!leftmousekeypressed); + hidemousecursor; + setactivepage(1); ans=177; + for( fv=1; fv <= numlines; fv ++) /* */ + {; + { linetype& with = lines[fv]; + if (x1!=nay) + {; + setcolor( 9); line(x1,y1,x2,y2); + if (getpixel(mousex,mousey)==9) ans=fv; + setcolor( 0); line(x1,y1,x2,y2); + }} + { fieldtype& with = fields[fv]; + if (with.x1!=nay) + {; + setcolor( 9); rectangle(with.x1,with.y1,with.x2,with.y2); + if (getpixel(mousex,mousey)==9) ans=fv+100; + setcolor( 0); rectangle(with.x1,with.y1,with.x2,with.y2); + }} + } + setactivepage(0); + } while (!(ans!=177)); + checkline_result=ans; +return checkline_result; +} + +void chooseside(); +static boolean itsaline; + +static void plotline() +{; + if (itsaline) + { linetype& with = lines[gd]; + if (do1) line(mousex,mousey,x2,y2); else + line(x1,y1,mousex,mousey);} + else + { fieldtype& with = fields[gd]; + if (do1) rectangle(mousex,mousey,with.x2,with.y2); else + rectangle(with.x1,with.y1,mousex,mousey);} +} + +void chooseside() +{ + byte clicol,savelcol;fieldtype current; integer temp; +; + do { + gd=checkline(); itsaline=gd<100; + if (gd==255) {; hidemousecursor; return; } + if (! itsaline) gd -= 100; + setactivepage(2); setvisualpage(2); cleardevice(); + setgraphicscursor(tthand); setcrtpagenumber(2); + if (itsaline) + {; + current=lines[gd]; + savelcol=lines[gd].col; + } else current=fields[gd]; + {; + setcolor(9); + if (itsaline) line(current.x1,current.y1,current.x2,current.y2); else rectangle(current.x1,current.y1,current.x2,current.y2); + setcolor(9); + setfillstyle(1,red); bar(current.x1-3,current.y1-3,current.x1+3,current.y1+3); + setfillstyle(1,green); bar(current.x2-3,current.y2-3,current.x2+3,current.y2+3); + do {; } while (!(~ anymousekeypressed)); + clicol=177; showmousecursor; + do { + if (anymousekeypressed) + {; + hidemousecursor; + clicol=getpixel(mousex,mousey); + showmousecursor; + } + if (rightmousekeypressed) + {; hidemousecursor; return; } + if (keypressed()) glimpse(2); + } while (!(set::of(red,green, eos).has(clicol))); + do1=clicol==red; hidemousecursor; + setgraphicscursor(hook); setcrtpagenumber(0); + setactivepage(0); setvisualpage(0); setcolor(0); + if (itsaline) + { + linetype& with1 = lines[gd]; ; line(current.x1,current.y1,current.x2,current.y2); setcolor(with1.col); } else + { + fieldtype& with1 = fields[gd]; ; rectangle(with1.x1,with1.y1,with1.x2,with1.y2); setcolor(gd); } + setwritemode(xorput); + while (~ anymousekeypressed) + {; + plotline(); + showmousecursor; delay(1); hidemousecursor; + plotline(); + if (rightmousekeypressed) {; hidemousecursor; return; } + if (keypressed()) glimpse(0); + } + /* update "current" rec */ + if (do1) {; current.x1=mousex; current.y1=mousey; } + else {; current.x2=mousex; current.y2=mousey; } + if (! itsaline) + {; + if (current.x1>current.x2) {; temp=current.x2; current.x2=current.x1; current.x1=temp; } + if (current.y1>current.y2) {; temp=current.y2; current.y2=current.y1; current.y1=temp; } + } + /* copy "current" to line/field */ + if (itsaline) + { + linetype& with1 = lines[gd]; + ; + current.x1=current.x1; current.x2=current.x2; current.y1=current.y1; current.y2=current.y2; + with1.col=savelcol; + } else fields[gd]=current; + } + setwritemode(0); + } while (!false); +} + +void delped() +{; + setcrtpagenumber(0); setactivepage(0); setvisualpage(0); + drawup(); setgraphicscursor(tthand); showmousecursor; + do {; } while (!leftmousekeypressed); peds[colour()].dir=177; +} + +byte menu(); + +static void say(byte y, string x) +{; + setfillstyle(1,y); + bar(0,y*17,100,y*17+15); outtextxy(123,y*17,x); +} + +byte menu() +{ + byte clicol; +byte menu_result; +; + setcolor(15); settextstyle(0,0,2); clicol=0; setgraphicscursor(tthand); + setvisualpage(2); setactivepage(2); setcrtpagenumber(2); cleardevice(); + say(3,"Move lines around"); + say(4,"Add a new line"); + say(5,"Delete a line"); + say(6,"Add a ped"); + say(7,"Delete a ped"); + say(8,"Add a field"); + say(10,"Return to Also."); + showmousecursor; + do { + if (leftmousekeypressed) + {; + hidemousecursor; + clicol=getpixel(mousex,mousey); + showmousecursor; + } + if (rightmousekeypressed) {; hidemousecursor; return menu_result; } + if (keypressed()) glimpse(2); + } while (!(clicol>0)); + do {; } while (!(~ anymousekeypressed)); + hidemousecursor; + menu_result=clicol; +return menu_result; +} + +void removeline() +{; + gd=checkline(); if (gd==255) {; hidemousecursor; return; } + if (gd>100) + fields[gd-100].x1=nay; + else lines[gd].x1=nay; /* cancels it out */ + cleardevice(); drawup(); +} + +void lino() +{; + resetmouse; + do { + switch (menu()) { + case 3: chooseside(); break; + case 4: addline(colour()); break; + case 5: removeline(); break; + case 6: addped(); break; + case 7: delped(); break; + case 8: addfield(); break; + case 10: return; break; + } + } while (!false); +} + +void loadscreen() /* load2 */ +{ + byte a /*absolute $A000:246560*/; + byte bit; + untyped_file f; +; + setactivepage(3); setvisualpage(3); + assign(f,string("c:\\avalot\\place")+n+".avd"); reset(f,1); seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,12080); + } + close(f); + setvisualpage(0); + outtextxy(0,190,"Look carefully, and then press any key..."); + setactivepage(0); +} + +void ctrlsout(string& x) /* Replace real ctrls with caret codes */ +{ + byte fv; string xx; +; + xx=""; + for( fv=1; fv <= length(x); fv ++) + if (x[fv]>'\37') xx=xx+x[fv]; else xx=xx+'^'+chr(ord(x[fv])+64); + x=xx; +} + +void ctrlsin(string& x) /* Opposite of ctrlsout */ +{ + byte fv; string xx; boolean ctrlwas; +; + xx=""; ctrlwas=false; + for( fv=1; fv <= length(x); fv ++) + if (ctrlwas) /* last char was a caret */ + {; + xx=xx+chr(ord(upcase(x[fv]))-64); + ctrlwas=false; + } + else + {; /* last char wasn't a caret... */ + if (x[fv]=='^') ctrlwas=true; else /* ...but this one is */ + xx=xx+x[fv]; /* ...but this one isn't */ + } + x=xx; +} + +void flipover() /* temp view other screen */ +{ + char r; +; + setvisualpage(3); r=readkey(); setvisualpage(0); +} + +void plotchar(byte x,byte y, char n) +{ + byte fv; +; + if (chars[x][y]==n) return; + for( fv=0; fv <= 15; fv ++) + mem[0xa000*y*1200+(fv+3)*80+x]=skinny[ord(n)][fv]; + chars[x][y]=n; +} + +void cursor() +{ + byte fv; +; + cursorflash += 1; + switch (cursorflash) { + case 1:case 127: for( fv=12; fv <= 14; fv ++) + mem[0xa000*ty*1200+(3+fv)*80+tx]=~(mem[0xa000*ty*1200+(3+fv)*80+tx]); + break; + case 255: cursorflash=0; break; + } +} + +void losecursor() +{; + if (cursorflash<127) {; cursorflash=126; cursor(); } + cursorflash=0; +} + +void gwrite(string x) +{ + byte fv; +; + for( fv=1; fv <= length(x); fv ++) + {; + plotchar(tx,ty,x[fv]); + tx += 1; + if (tx==80) {; ty += 1; tx=0; } + } +} + +string typein(string x) +{ + const char marker = '\2'; + byte p; char r; +string typein_result; +; + setvisualpage(0); setactivepage(0); cleardevice(); + settextstyle(0,0,1); setcolor(15); + outtextxy( 0, 0,"Press TAB to see the room..."); + outtextxy( 0, 20,"You may use any of these Control Codes:"); + outtextxy(30, 30,"Anywhere: ^M = new line, ^P = new scroll, |1 fix to speaker 1."); + outtextxy(90, 40,"^B = new bubble"); + outtextxy(30, 50,"At end of line: ^C = centre line, ^L = left justify."); + outtextxy(30, 60,"At end of scroll: ^D = Don't add automatic ^P here."); + outtextxy( 0, 80,"(Use by typing in (eg for ^P) ^ then P, not Ctrl-P.)"); + p=0; ctrlsout(x); fillchar(chars,sizeof(chars),'\40'); + do { + tx=0; ty=6; gwrite(x+'\4'+'\40'); + tx=(p % 80); ty=(p / 80)+6; + while (! keypressed()) {; delay(1); cursor(); } losecursor(); + r=readkey(); + switch (r) { + case '\10': if (p>0) {; x=copy(x,1,p-1)+copy(x,p+1,255); p -= 1; } break; /* backspace */ + case '\11': flipover(); break; + case '\40' ... '\377': {; x=copy(x,1,p)+r+copy(x,p+1,255); p += 1; } break; + case '\0': switch (readkey()) { /* extd. keystroke */ + case 'G': p=0; break; /* Home */ + case 'K': if (p>0) p -= 1; break; /* left */ + case 'M': if (p80) p -= 80; break; /* up */ + case 'P': if (p x; char r; integer e; word p; +byte typeno_result; +; + cleardevice(); x="000"; + settextstyle(0,0,3); setcolor(9); outtextxy(0,0,title); + setfillstyle(1,0); setcolor(10); fillchar(chars,sizeof(chars),'\40'); + do { + bar(100,100,150,125); + outtextxy(100,100,x); + do { r=readkey(); } while (!(set::of(range('0','9'),'\33','\15', eos).has(r))); + if (r=='\33') {; typeno_result=255; return typeno_result; } + if (r!='\15') x=string(x[2])+r; + } while (!(r=='\15')); + val(x,p,e); typeno_result=p; +return typeno_result; +} + +void showallnames() +{ + byte fv; varying_string<2> s; char r; +; + settextstyle(0,0,2); cleardevice(); setcolor(13); outtextxy(0,0,"Descriptions start..."); + settextstyle(0,0,1); setcolor(7); + for( fv=1; fv <= 29; fv ++) + {; + str(fv,2,s); + outtextxy((fv / 15)*320,((fv % 15)*10)+30,s+'='+copy(names[fv][1],0,33)); + } + setcolor(15); outtextxy(500,190,"Press any key..."); + r=readkey(); +} + +void showallassoc(); + + +static void saascreen() +{; + settextstyle(0,0,2); cleardevice(); setcolor(10); outtextxy(0,0,"Everything..."); + settextstyle(0,0,1); setcolor(2); + outtextxy(17,20,"(Format: : : )"); +} + +void showallassoc() +{ + byte fv; varying_string<2> s; char r; + +; + saascreen(); + for( fv=1; fv <= 30; fv ++) + {; + str(fv-1,2,s); + outtextxy(0,(((fv-1) % 10)*10)+30, + s+':'+copy(names[fv-1][1],1,7)+':'+copy(names[fv-1][2],1,70)); + if ((fv % 10)==0) {; r=readkey(); saascreen(); } + } + setcolor(15); outtextxy(500,190,"Press any key..."); + r=readkey(); +} + +void clear() +{ + byte fv; +; + fillchar(names ,sizeof(names ), '\0'); + for( fv=1; fv <= numlines; fv ++) {; lines[fv].x1=nay; fields[fv].x1=nay; } + fillchar(peds ,sizeof(peds ),'\261'); +} + +void scramble(); + +static void scram1(string& x) +{ + byte fz; +; + for( fz=1; fz <= length(x); fz ++) + x[fz]=chr(ord(x[fz]) ^ 177); +} + +void scramble() /* Works both ways. */ +{ + byte fv,ff; +; + for( fv=0; fv <= 29; fv ++) + for( ff=1; ff <= 2; ff ++) + scram1(names[fv][ff]); + scram1(listen); + scram1(flags); +} + +void save() +{ + string x; untyped_file f; byte minnames,minlines,minpeds,minfields,fv,ff; +; + minnames =0; for( fv=0; fv <= 29; fv ++) if (names[fv][1]!="") minnames =fv; + minlines =0; for( fv=1; fv <= numlines; fv ++) + if (lines[fv].x1!=nay) minlines =fv; + minpeds =0; for( fv=1; fv <= 15; fv ++) if (peds[fv].dir<177) minpeds =fv; + minfields=0; for( fv=1; fv <= 30; fv ++) if (fields[fv].x1!=nay) minfields=fv; + assign(f,string("c:\\avalot\\also")+n+".avd"); + rewrite(f,1); + x=string("This is an Also .AVD file, which belongs to AVALOT.EXE. Its contents")+ + '\15'+'\12'+"are subject to copyright, so there. Have fun!"+'\32'+" *Minstrel* "; + blockwrite(f,x[1],128); + scramble(); + blockwrite(f,minnames,1); + for( fv=0; fv <= minnames; fv ++) + for( ff=1; ff <= 2; ff ++) + blockwrite(f,names[fv][ff],length(names[fv][ff])+1); + blockwrite(f,minlines,1); + blockwrite(f,lines,sizeof(lines[1])*minlines); + blockwrite(f,minpeds,1); + blockwrite(f,peds,sizeof(peds[1])*minpeds); + blockwrite(f,minfields,1); + blockwrite(f,fields,sizeof(fields[1])*minfields); + blockwrite(f,magics,sizeof(magics)); + blockwrite(f,portals,sizeof(portals)); + blockwrite(f,flags,sizeof(flags)); + blockwrite(f,listen[0],1); + blockwrite(f,listen[1],length(listen)); + close(f); + scramble(); +} + +void load(); +static untyped_file f; + + +static string nextstring() +{ + byte l; string x; +string nextstring_result; +; + x=""; blockread(f,l,1); blockread(f,x[1],l); x[0]=chr(l); nextstring_result=x; +return nextstring_result; +} + +void load() +{ + byte minnames,minlines,minpeds,minfields; byte ff,fv; + +; + clear(); + assign(f,string("c:\\avalot\\also")+n+".avd"); +/*$I-*/ reset(f,1); /*$I+*/ if (ioresult!=0) return; /* no Also file */ + seek(f,128); blockread(f,minnames,1); + for( fv=0; fv <= minnames; fv ++) + for( ff=1; ff <= 2; ff ++) + names[fv][ff]=nextstring(); + blockread(f,minlines,1); + blockread(f,lines,sizeof(lines[1])*minlines); + blockread(f,minpeds,1); + blockread(f,peds,sizeof(peds[1])*minpeds); + blockread(f,minfields,1); + blockread(f,fields,sizeof(fields[1])*minfields); + blockread(f,magics,sizeof(magics)); + blockread(f,portals,sizeof(portals)); + blockread(f,flags,sizeof(flags)); + blockread(f,listen[0],1); + blockread(f,listen[1],length(listen)); + close(f); + scramble(); +} + +void editmagics(); +const array<1,15,char> codes = "123456789ABCDEF"; + +static integer y; + + +static void display() +{ + byte fv; +; + cleardevice(); + settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Magics."); + settextstyle(0,0,1); + for( fv=1; fv <= 15; fv ++) + {; + y=23+fv*10; + setcolor(fv); outtextxy(100,y,string('$')+codes[fv-1]); + { + magictype& with = magics[fv]; + ; + switch (with.op) { + case nix: {; setcolor(8); outtextxy(140,y,"Nix"); } break; + case bounce: {; setcolor(10); outtextxy(143,y,"Bounce!"); } break; + case exclaim: {; + setcolor(14); outtextxy(143,y,string("Exclaim: ")+strf(with.data)); + } + break; + case transport: {; + setcolor(12); + outtextxy(143,y,string("Transport to ")+strf(hi(with.data))+ + ", ped "+strf(lo(with.data))); + } + break; + case unfinished: {; + setcolor(15); outtextxy(143,y,"*** UNFINISHED! ***"); + } + break; + case special: {; + setcolor(6); outtextxy(143,y,string("Special call no. ")+strf(with.data)); + } + break; + case opendoor: {; + setcolor(11); + outtextxy(143,y,string("Opening door to ")+strf(hi(with.data))+ + ", ped "+strf(lo(with.data))); + } + break; + } + } + } + outtextxy(177,190,"Which do you want to change\? (Esc=Exit) $"); +} + + + +static word ask(string x) +{ + string q; word thomaswashere; integer e; +word ask_result; +; + cleardevice(); + setcolor(10); settextstyle(0,0,3); outtextxy(0,100,x); + do { + input >> q >> NL; val(q,thomaswashere,e); + } while (!(e==0)); ask_result=thomaswashere; +return ask_result; +} + +void editmagics() +{ + char r,rr; byte p; + +; + do { + display(); + do { + r=upcase(readkey()); + if (r=='\33') return; + p=pos(r,codes); /* which are we editing? */ + } while (!(p>0)); /* it must BE there... */ + setcolor(p); cleardevice(); + outtextxy(177,17,string("Editing magic $")+r+'.'); + outtextxy(0,30,"New operation ( (N)ix, (B)ounce, (E)xclaim, (T)ransport, (U)nfinished),"); + outtextxy(30,40,"(S)pecial, (O)pening Door?"); + do { rr=upcase(readkey()); } while (!(set::of('N','B','E','T','U','S','O','\33', eos).has(rr))); + { magictype& with = magics[p]; + switch (rr) { + case '\33': return; break; /* cancelling code */ + case 'N': with.op=nix; break; + case 'B': with.op=bounce; break; + case 'E': {; with.op=exclaim; with.data=ask("Which scroll?"); } break; + case 'T': {; with.op=transport; with.data=ask("Ped no.?")+ask("Whither?")*256; } break; + case 'U': with.op=unfinished; break; + case 'S': {; with.op=special; with.data=ask("Which call?"); } break; + case 'O': {; with.op=opendoor; with.data=ask("Ped no.?")+ask("Whither?")*256; } break; + }} + } while (!false); +} + +void editportals(); +const array<9,15,char> codes1 = "9ABCDEF"; + +static integer y2; + + +static void display1() +{ + byte fv; +; + cleardevice(); + settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Portals."); + settextstyle(0,0,1); + for( fv=9; fv <= 15; fv ++) + {; + y2=fv*10-53; + setcolor(fv); outtextxy(100,y2,string('$')+codes1[fv-1]); + { + magictype& with = portals[fv]; + ; + switch (with.op) { + case nix: {; setcolor(8); outtextxy(140,y2,"Nix"); } break; + case exclaim: {; + setcolor(14); outtextxy(143,y2,string("Exclaim: ")+strf(with.data)); + } + break; + case transport: {; + setcolor(12); + outtextxy(143,y2,string("Transport to ")+strf(hi(with.data))+ + ", ped "+strf(lo(with.data))); + } + break; + case unfinished: {; + setcolor(15); outtextxy(143,y2,"*** UNFINISHED! ***"); + } + break; + case special: {; + setcolor(6); outtextxy(143,y2,string("Special call no. ")+strf(with.data)); + } + break; + case opendoor: {; + setcolor(11); + outtextxy(143,y2,string("Opening door to ")+strf(hi(with.data))+ + ", ped "+strf(lo(with.data))); + } + break; + } + } + } + outtextxy(177,190,"Which do you want to change\? (Esc=Exit) $"); +} + + + +static word ask1(string x) +{ + string q; word thomaswashere; integer e; +word ask1_result; +; + cleardevice(); + setcolor(10); settextstyle(0,0,3); outtextxy(0,100,x); + do { + input >> q >> NL; val(q,thomaswashere,e); + } while (!(e==0)); ask1_result=thomaswashere; +return ask1_result; +} + +void editportals() /* much t'same as editmagics */ +{ + char r,rr; byte p; + +; + do { + display1(); + do { + r=upcase(readkey()); + if (r=='\33') return; + p=pos(r,codes1); /* which are we editing? */ + } while (!(p>0)); /* it must BE there... */ + p += 8; setcolor(p); cleardevice(); + outtextxy(177,17,string("Editing portal $")+r+'.'); + outtextxy(0,30,"New operation ( (N)ix, (E)xclaim, (T)ransport, (U)nfinished),"); + outtextxy(30,40,"(S)pecial, (O)pening Door?"); + do { rr=upcase(readkey()); } while (!(set::of('N','E','T','U','S','O','\33', eos).has(rr))); + { magictype& with = portals[p]; + switch (rr) { + case '\33': return; break; /* cancelling code */ + case 'N': with.op=nix; break; + case 'E': {; with.op=exclaim; with.data=ask1("Which scroll?"); } break; + case 'T': {; with.op=transport; with.data=ask1("Ped no.?")+ask1("Whither?")*256; } break; + case 'U': with.op=unfinished; break; + case 'S': {; with.op=special; with.data=ask1("Which call?"); } break; + case 'O': {; with.op=opendoor; with.data=ask1("Ped no.?")+ask1("Whither?")*256; } break; + }} + } while (!false); +} + +void editflags() +{ + char r; +; + cleardevice(); + settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Flags."); + settextstyle(0,0,1); setcolor(10); + outtextxy(100,30,"Press the letter of the flag you want to toggle."); + outtextxy(100,40,"Tab = flip screens, Esc/Enter = return to menu."); + setcolor(14); setfillstyle(1,0); + for( r='A'; r <= 'Z'; r ++) + if (pos(r,flags)>0) outtextxy(ord(r)*20-1223,77,r); + do { + do { r=upcase(readkey()); } while (!(set::of(range('A','Z'),'\33','\15','\11', eos).has(r))); + switch (r) { + case RANGE_26('A','Z'): {; + if (pos(r,flags)>0) + {; /* flag is on- switch it off */ + Delete(flags,pos(r,flags),1); + bar(ord(r)*20-1223,77,ord(r)*20-1213,87); + sound(1777); delay(7); nosound; + } else + {; /* flag is off- switch it on */ + flags=flags+r; + outtextxy(ord(r)*20-1223,77,r); + sound(177); delay(7); nosound; + } + } + break; + case '\33':case '\15': return; break; + case '\11': flipover(); break; + } + } while (!false); +} + +void alsomenu() +{ + char r; byte t; +; + do { + setactivepage(0); setvisualpage(0); + cleardevice(); setcolor(15); settextstyle(0,0,2); + outtextxy(0,0,"Also... Main Menu"); + settextstyle(0,0,1); setcolor(10); + outtextxy(100, 40,"1) Edit the names of an object"); + outtextxy(100, 50,"2) View all names"); + outtextxy(100, 60,"3) Edit the description of this object"); + outtextxy(100, 70,"4) View all associations."); + outtextxy(100, 80,"5) Enter Lino mode."); + outtextxy(100, 90,"6) Edit magics."); + outtextxy(100,100,"7) Edit portals."); + outtextxy(100,110,"8) Edit flags."); + outtextxy(100,120,"9) Edit listen field."); + outtextxy(100,160,"S) Save"); + outtextxy(100,170,"L) Load"); + outtextxy( 80,180,"Tab) View other screen"); + if (current==0) outtextxy(0,140,"< Main description of room >"); else + outtextxy(0,140,string('<')+names[current][1]+'>'); + do { + r=upcase(readkey()); if (r=='\11') flipover(); + } while (!(set::of(range('1','9'),'S','L','\0', eos).has(r))); + switch (r) { + case '1': {; + do { + t=typeno("Which object\? (0-30)"); + } while (!((t<30) || (t==255))); + if ((t!=255) && (t!=0)) names[t][1]=typein(names[t][1]); + current=t; + } + break; + case '2': showallnames(); break; + case '3': names[current][2]=typein(names[current][2]); break; + case '4': showallassoc(); break; + case '5': lino(); break; + case '6': editmagics(); break; + case '7': editportals(); break; + case '8': editflags(); break; + case '9': listen=typein(listen); break; + case 'S': save(); break; + case 'L': load(); break; + case '\0': if (readkey()=='\55') return; break; + } + } while (!false); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + output << "*** ALSO ***" << NL; + output << NL; + output << "No. of screen to edit?"; input >> n >> NL; load(); + assign(f,"v:avalot.fnt"); reset(f); f >> skinny; close(f); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); current=0; + loadscreen(); + alsomenu(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp new file mode 100644 index 000000000000..03cedfdfccf4 --- /dev/null +++ b/engines/avalanche/andexor.cpp @@ -0,0 +1,122 @@ +#include "ptoc.h" + + /* Trippancy IV - original file */ +#include "graph.h" + +const integer taboo = cyan; + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of all the pictures */ +}; + + +integer gd,gm; +adxtype adx; +matrix<1,24,0,1,pointer> adxpic; /* the pictures themselves */ +untyped_file f; string x; byte n; + +void load(string nam) +{ + byte z; + array<1,4,pointer> a; + untyped_file f; word s; + varying_string<40> xxx; + string check; + +; + assign(f,nam); + reset(f,1); + blockread(f,xxx,41); + blockread(f,check,13); + blockread(f,check,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(a[z],s); + blockread(f,a[z],s); + putimage(0,15+(z-1)*75,a[z],0); + freemem(a[z],s); + } + close(f); +} + +void silhouette() +{ + byte x,y,c; +; + setvisualpage(1); setactivepage(1); setfillstyle(1,15); + for( gm=0; gm <= 3; gm ++) + for( gd=1; gd <= 6; gd ++) + {; /* 26,15 */ +/* bar((gm div 2)*320+gd*40,20+(gm mod 2)*40,(gm div 2)*320+gd*40+35,(gm mod 2)*40+60); */ + for( y=1; y <= adx.yl; y ++) + for( x=1; x <= adx.xl; x ++) + {; + setactivepage(0); + c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); + setactivepage(1); +/* if c<>taboo then putpixel((gm div 2)*320+gd*40+x,20+(gm mod 2)*40+y,0); */ + if (c==taboo) putpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y,15); + } + getmem(adxpic[gm*6+gd][0],adx.size); + getimage((gm / 2)*320+gd*40+1,20+(gm % 2)*40+1, + (gm / 2)*320+gd*40+adx.xl,20+(gm % 2)*40+adx.yl, + adxpic[gm*6+gd][0]); + } +} + +void standard() +{ + byte x,y,c; +; + setvisualpage(2); setactivepage(2); + for( gm=0; gm <= 3; gm ++) + for( gd=1; gd <= 6; gd ++) + {; /* 26,15 */ + for( y=1; y <= adx.yl; y ++) + for( x=1; x <= adx.xl; x ++) + {; + setactivepage(0); + c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); + setactivepage(2); + if (c!=taboo) putpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y,c); + } + getmem(adxpic[gm*6+gd][1],adx.size); + getimage((gm / 2)*320+gd*40+1,20+(gm % 2)*40+1, + (gm / 2)*320+gd*40+adx.xl,20+(gm % 2)*40+adx.yl, + adxpic[gm*6+gd][1]); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); fillchar(adxpic,sizeof(adxpic),'\261'); + load("v:avalots.avd"); +/* getmem(adxpic[1,1,1],adx.size); getimage(40,20,75,60,adxpic[1,1,1]^); + putimage(100,100,adxpic[1,1,1]^,0); */ + {; + adx.name="Avalot"; + adx.num=24; adx.seq=6; + adx.xl=32; adx.yl=35; /* 35,40 */ + + adx.size=imagesize(40,20,40+adx.xl,60+adx.yl); + } + silhouette(); + standard(); + x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; + assign(f,"v:sprite1.avd"); + rewrite(f,1); + blockwrite(f,x[1],59); + blockwrite(f,adx,sizeof(adx)); + for( gd=1; gd <= adx.num; gd ++) + for( gm=0; gm <= 1; gm ++) + blockwrite(f,adxpic[gd][gm],adx.size); /* next image */ + close(f); + closegraph(); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp new file mode 100644 index 000000000000..41f27af209d0 --- /dev/null +++ b/engines/avalanche/andexor2.cpp @@ -0,0 +1,133 @@ +#include "ptoc.h" + + /* Trippancy IV - original file */ +#include "graph.h" + +const integer taboo = cyan; + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of all the pictures */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + + +integer gd,gm; +adxtype adx; +array<0,1,pointer> adxpic; /* the pictures themselves */ +untyped_file f; string x; byte n; integer side2; word bigsize; + +void load(string n) +{ + byte z; + array<1,4,pointer> a; + untyped_file f; word s; + varying_string<40> xxx; + string check; + +; + assign(f,n); + reset(f,1); + blockread(f,xxx,41); + blockread(f,check,13); + blockread(f,check,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(a[z],s); + blockread(f,a[z],s); + putimage(0,15+(z-1)*75,a[z],0); + freemem(a[z],s); + } + close(f); +} + +void silhouette() +{ + byte x,y,c; +; + setvisualpage(1); setactivepage(1); setfillstyle(1,15); + {; + for( gm=0; gm <= 3; gm ++) + for( gd=1; gd <= 6; gd ++) + {; /* 26,15 */ + side2=adx.xl*6; + for( y=1; y <= adx.yl; y ++) + for( x=1; x <= adx.xl; x ++) + {; + setactivepage(0); + c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); + setactivepage(1); + if (c==taboo) + putpixel((gm / 2)*side2+gd*adx.xl+x,20+(gm % 2)*adx.yl+y,15); + } + } + bigsize=imagesize(adx.xl+1,21,adx.xl*13,20+adx.yl*2); + getmem(adxpic[0],bigsize); + getimage(adx.xl+1,21,adx.xl*13,20+adx.yl*2,adxpic[0]); + putimage(adx.xl+1,21,adxpic[0],notput); + } +} + +void standard() +{ + byte x,y,c; +; + setvisualpage(2); setactivepage(2); + {; + for( gm=0; gm <= 3; gm ++) + for( gd=1; gd <= 6; gd ++) + {; /* 26,15 */ + for( y=1; y <= adx.yl; y ++) + for( x=1; x <= adx.xl; x ++) + {; + setactivepage(0); + c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); + setactivepage(2); + if (c!=taboo) + putpixel((gm / 2)*side2+gd*adx.xl+x,20+(gm % 2)*adx.yl+y,c); + } +/* getmem(adxpic[gm*6+gd,1],adx.size); + getimage((gm div 2)*side2+gd*xl+x,20+(gm mod 2)*yl+y, + (gm div 2)*side2+gd*xl*2+x,20+(gm mod 2)*yl*2+y, + adxpic[gm*6+gd,1]^); */ + } + getmem(adxpic[1],bigsize); + getimage(adx.xl+1,21,adx.xl*13,20+adx.yl*2,adxpic[1]); + putimage(adx.xl+1,21,adxpic[1],notput); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); fillchar(adxpic,sizeof(adxpic),'\261'); + load("v:avalots.avd"); + {; + adx.name="Avalot"; + adx.num=24; adx.seq=6; + adx.xl=33; adx.yl=35; /* 35,40 */ + adx.fgc=yellow; adx.bgc=red; + + adx.size=imagesize(40,20,40+adx.xl,60+adx.yl); + } + silhouette(); + standard(); + x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; + assign(f,"v:sprite1.avd"); + rewrite(f,1); + blockwrite(f,x[1],59); + blockwrite(f,adx,sizeof(adx)); + blockwrite(f,bigsize,2); + for( gm=0; gm <= 1; gm ++) + {; + putimage(0,0,adxpic[gm],0); + blockwrite(f,adxpic[gm],bigsize); /* next image */ + } + close(f); + closegraph(); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp new file mode 100644 index 000000000000..8aff7172d316 --- /dev/null +++ b/engines/avalanche/andextst.cpp @@ -0,0 +1,64 @@ +#include "ptoc.h" + + +#include "graph.h" + + +typedef matrix<1,24,0,1,pointer> adxtype; + +integer gd,gm; +word s; untyped_file f; byte n,anim,cp,t; +array<0,0,adxtype> adx; +array<0,1,pointer> back; +integer x; +array<0,1,integer> ox; + +void andex(integer x,integer y, byte n,byte num) +{; + putimage(x,y,adx[num][n][0],andput); + putimage(x,y,adx[num][n][1],xorput); +} + +void loadadx(byte num, string x) +{ + byte n; +; + assign(f,x); + reset(f,1); seek(f,59); + blockread(f,n,1); /* No. of images... */ + for( gd=1; gd <= n; gd ++) + for( gm=0; gm <= 1; gm ++) + {; + blockread(f,s,2); /* size of next image... */ + getmem(adx[num][gd][gm],s); + blockread(f,adx[num][gd][gm],s); /* next image */ + } + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + loadadx(0,"d:sprite0.avd"); + loadadx(1,"d:sprite0.avd"); + gd=3; gm=0; initgraph(gd,gm,""); + for( gd=0; gd <= 1; gd ++) + {; + setactivepage(gd); setfillstyle(6,1); bar(0,0,640,200); + getmem(back[gd],s); + } + x=0; anim=1; cp=0; t=2; setactivepage(0); + do { + setactivepage(cp); setvisualpage(1-cp); + for( gm=0; gm <= 1; gm ++) + {; + if (t>0) t -= 1; else + putimage(ox[cp],77,back[cp],copyput); + getimage(x,77,x+31,77+35,back[cp]); + andex(x,177,anim+6,gm); + ox[gm][cp]=x; x += 5; + } + anim += 1; if (anim==7) anim=1;cp=1-cp; + } while (!false); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp new file mode 100644 index 000000000000..1ff2f1fd2d98 --- /dev/null +++ b/engines/avalanche/arch.cpp @@ -0,0 +1,122 @@ +#include "ptoc.h" + +/* + + + + + ENID Edna's manager. */ + +#define __arch_implementation__ + /* Loads/ saves files. */ + +#include "arch.h" + + +/*#include "Dos.h"*/ +#include "scrolls.h" + + +struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS. See below for others.) */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + /* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ +const string crlf = string('\15')+'\12'; + +const array<1,177,char> ednafirst = + string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!")+crlf+ + '\32'+ /* 67 bytes... */ + crlf+crlf+ /* 71 bytes... */ + "12345678901234567890123456789012345678901234567890"+ + "12345678901234567890123456789012345678901234567890"+ + "123456"; + +const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; +const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; + +const integer ttage = 18; +const char ttwashere[] = "Thomas was here "; + +void save(string name) +{ + untyped_file f; + edhead eh; + word groi; + string groi2; +; + fillchar(eh,sizeof(eh),'\261'); /* Fill up the edhead */ + + dna.saves += 1; /* It's been saved one more time... */ + + {; + + /* Info about this program */ + + id=ednaid; /* Edna's signature */ + revision=2; /* Second revision of .ASG format */ + game="Lord Avalot d'Argent"; /* Title of game */ + shortname="Avalot"; + number=2; /* Second Avvy game */ + ver=100; /* Version 1.00 */ + verstr="1.00"; /* ditto */ + filename="AVALOT.EXE"; /* program's filename */ + os=1; /* Saved under DOS */ + + /* Info on this particular game */ + + fsplit(name,groi2,fn,groi2); /* fn = filename of this game */ + getdate(d,m,y,groi); /* Day, month & year when the game was saved */ + desc=roomname; /* Description of game (same as in Avaricius!) */ + len=sizeof(dna); /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + saves=dna.saves; /* no. of times this game has been saved */ + cash=dna.pence; /* contents of your wallet in numerical form */ + money=lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ + points=dna.score; /* your score */ + } + + assign(f,name); + rewrite(f,1); + + blockwrite(f,ednafirst,177); + blockwrite(f,eh,sizeof(eh)); + blockwrite(f,dna,sizeof(dna)); + + for( groi=1; groi <= ttage; groi ++) + blockwrite(f,ttwashere,sizeof(ttwashere)); + + close(f); +} + + diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h new file mode 100644 index 000000000000..cb0960f9ddbb --- /dev/null +++ b/engines/avalanche/arch.h @@ -0,0 +1,10 @@ +#ifndef __arch_h__ +#define __arch_h__ + + +#include "gyro.h" + + +void save(string name); + +#endif diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp new file mode 100644 index 000000000000..a439f87455f5 --- /dev/null +++ b/engines/avalanche/avalot9.cpp @@ -0,0 +1,114 @@ +#include "ptoc.h" + +/* + + + + + AVALOT The kernel of the program. */ + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Trip5.h"*/ +/*#include "Gyro.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Scrolls.h"*/ +/*#include "Basher.h"*/ +/*#include "Dropdown.h"*/ +/*#include "Pingo.h"*/ +/*#include "Logger.h"*/ +/*#include "Timeout.h"*/ +/*#include "Celer.h"*/ +/*#include "Enid.h"*/ +/*#include "Incline.h"*/ +/*#include "Closing.h"*/ +/*#include "Visa.h"*/ + + +void setup() +{ + integer gd,gm; + + checkbreak=false; visible=m_no; to_do=0; lmo=false; resetscroll; + Randomize(); setup_vmc; on_virtual; + gd=3; gm=0; initgraph(gd,gm,""); + holdthedawn=true; dusk; + cmp=177; mouse_init; /*on;*/ dropsok=true; ctrl=ckey; oldjw=177; + mousetext=""; c=999; settextjustify(0,0); ddmnow=false; load_digits; + cheat=false; cp=0; curpos=1; + quote=true; ledstatus=177; defaultled=2; +/* TSkellern:=0; { Replace with a more local variable sometime }*/ + dna.rw=stopped; enid_filename=""; /* undefined. */ + toolbar; state(2); copy03; lastscore="TJA"; + +/* for gd:=0 to 1 do + begin + setactivepage(gd); outtextxy(7,177,chr(48+gd)); + end;*/ + + loadtrip; + + if ((filetoload=="") & (~ reloaded)) + newgame; /* no game was requested- load the default */ + else { + if (~ reloaded) avvy_background; + standard_bar; sprite_run; + if (reloaded) edna_reload; else + { /* Filename given on the command line (or loadfirst) */ + edna_load(filetoload); + if (there_was_a_problem) + { + display("So let's start from the beginning instead..."); + holdthedawn=true; dusk; newgame; + } + } + } + + if (~ reloaded) + { + soundfx=~ soundfx; fxtoggle; + thinkabout(money,a_thing); + } + + get_back_loretta; gm=getpixel(0,0); setcolor(7); + holdthedawn=false; dawn; cursoron=false; cursor_on; newspeed; + + if (~ reloaded) + dixi('q',83); /* Info on the game, etc. */ +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + setup(); + + do { + + clock; + keyboard_link; + menu_link; + readstick; + force_numlock; + get_back_loretta; + trippancy_link; + pics_link; + checkclick; + + if (visible==m_virtual) plot_vmc(mx,my,cp); + flip_page; /* << fonttype; + +fonttype font; +word storage_seg,storage_ofs; +byte result; +string registrant; + +void icons() +{ + untyped_file f; + word gd,gm; byte bit; + byte v; + + assign(f,"menu.avd"); + reset(f,1); + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( gd=70; gd <= 266; gd ++) + blockread(f,mem[0xa000*gd*80+6],9); + + for( gd=0; gd <= 32; gd ++) + { + blockread(f,v,1); + for( gm=0; gm <= 5; gm ++) + mem[0xa000*73+((70+gd+gm*33)*80)]=v; /* 79 */ + } + + } + close(f); + + bit=getpixel(0,0); + + setfillstyle(1, 7); for( gd=0; gd <= 5; gd ++) bar(114, 73+gd*33,583, 99+gd*33); + setfillstyle(1,15); for( gd=0; gd <= 5; gd ++) bar(114, 70+gd*33,583, 72+gd*33); + setfillstyle(1, 8); for( gd=0; gd <= 5; gd ++) bar(114,100+gd*33,583,102+gd*33); + +} + +void load_regi_info(); + + +static char decode1(char c) +{ + byte b; + + char decode1_result; + b=ord(c)-32; + decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; +} + + + +static char decode2(char c) +{ + char decode2_result; + decode2_result=chr( ((ord(c) & 0xf) << 2) + 0x43); + return decode2_result; +} + + + +static boolean checker(string proper,string check) +{ + byte fv; boolean ok; + + boolean checker_result; + ok=true; + for( fv=1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) + ok=false; + + checker_result=ok; + return checker_result; +} + +void load_regi_info() +{ + text t; + byte fv; + string x; + byte namelen,numlen; + string namechk,numchk; + string reginum; + + + /*$I-*/ + assign(t,"register.dat"); reset(t); + /*$I+*/ + + if (ioresult!=0) + { + registrant="(Unregistered evaluation copy.)"; + return; + } + + for( fv=1; fv <= 53; fv ++) t >> NL; + t >> x >> NL; + close(t); + + namelen=107-ord(x[1]); numlen=107-ord(x[2]); + + registrant=copy(x,3,namelen); + reginum=copy(x,4+namelen,numlen); + namechk=copy(x,4+namelen+numlen,namelen); + numchk=copy(x,4+namelen+numlen+namelen,numlen); + + for( fv=1; fv <= namelen; fv ++) registrant[fv]=decode1(registrant[fv]); + for( fv=1; fv <= numlen; fv ++) reginum[fv]=decode1(reginum[fv]); + + if ((! checker(registrant,namechk)) || (! checker(reginum,numchk))) + registrant="\?\"!\? ((.)"; + else + registrant=registrant+" ("+reginum+")."; + +} + +void flesh_colours() {; /* assembler; +asm + mov ax,$1012; + mov bx,21; { 21 = light pink (why?) */ + /* mov cx,1; + mov dx,seg @flesh; + mov es,dx; + mov dx,offset @flesh; + int $10; + + mov dx,seg @darkflesh; + mov es,dx; + mov dx,offset @darkflesh; + mov bx,5; { 5 = dark pink. */ + /*int $10; + + jmp @TheEnd; + + @flesh: + db 56,35,35; + + @darkflesh: + db 43,22,22; + + @TheEnd: */ + } + +void setup() +{ + integer gd,gm; + file ff; + + if (paramstr(1)!="jsb") exit(255); + checkbreak=false; + val(paramstr(2),storage_seg,gd); + val(paramstr(3),storage_ofs,gd); + + assign(ff,"avalot.fnt"); + reset(ff); ff >> font; close(ff); + + gd=3; gm=1; initgraph(gd,gm,""); + setvisualpage(1); + + icons(); +} + +void big(word x,word y, string z, boolean notted); +static word start,image; + + +static void generate(byte from, boolean& notted) +{ + byte fv; + + image=0; + for( fv=0; fv <= 7; fv ++) + image += (from & (1 << fv)) << fv; + + image += image << 1; + image=hi(image)+lo(image)*256; + if (notted) image=~ image; +} + +void big(word x,word y, string z, boolean notted) +{ + byte fv,ff;byte bit; + + start=x+y*80; + + for( fv=1; fv <= length(z); fv ++) + { + for( ff=1; ff <= 12; ff ++) + { + generate(font[z[fv]][ff+1], notted); + for( bit=0; bit <= 2; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + memw[0xa000*start+ ff*160]=image; + memw[0xa000*start+80+ff*160]=image; + } + } + start += 2; + } + bit=getpixel(0,0); +} + +void centre(integer y, string z) +{ + big(40-(length(z)),y,z,false); +} + +void option(byte which, string what) +{ + big(16,41+which*33,string((char)(which+48))+')',true); + big(24,41+which*33,what,true); +} + +void invert(integer x1,integer y1,integer x2,integer y2) +{ + word s; pointer p; + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + putimage(x1,y1,p,4); + sound(y1); delay(30); + sound(600-y2); delay(20); + nosound; delay(200); + putimage(x1,y1,p,0); + delay(250); +} + +void wait() +{ + word x; char r; boolean pressed; + + x=0; pressed=false; + do { + setfillstyle(6,15); bar(x ,330,x-1,337); + setfillstyle(1, 0); bar(x-2,330,x-3,337); + delay(40); x += 1; + + if (keypressed()) + { + r=readkey(); + if (r=='\0') + { + r=readkey(); /* and...? */ + } else + { /* Not an extended keystroke. */ + if (set::of(range('1','6'),cspace,cescape,creturn, eos).has(r)) pressed=true; + } + } + + } while (!((x==640) || pressed)); + + if ((r==cspace) || (r==creturn)) r='1'; + if (r==cescape) r='6'; + if (pressed) + { + result=ord(r)-48; + invert(48,37+result*33,114,69+result*33); + } else result=177; +} + +void show_up() +{ + setvisualpage(0); +} + +void loadmenu() +{ + untyped_file f; byte bit; + + assign(f,"mainmenu.avd"); + reset(f,1); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[0xa000*0],59*80); + } + close(f); + bit=getpixel(0,0); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + setup(); + loadmenu(); + load_regi_info(); + option(1,"Play the game."); + option(2,"Read the background."); + option(3,"Preview... perhaps..."); + option(4,"View the documentation."); + option(5,"Registration info."); + option(6,"Exit back to DOS."); + centre(275,registrant); + centre(303,"Make your choice, or wait for the demo."); + + show_up(); + wait(); + mem[storage_seg*storage_ofs]=result; + closegraph(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp new file mode 100644 index 000000000000..68756874a864 --- /dev/null +++ b/engines/avalanche/avvyans.cpp @@ -0,0 +1,84 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +integer gd,gm; +untyped_file f; +array<1,16000,byte> aa; +matrix<0,27,0,35,byte> cols; +text t; +string x; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + fillchar(cols,sizeof(cols),'\0'); + assign(f,"v:avvypic.ptx"); + reset(f,1); + blockread(f,aa,filesize(f)); + close(f); + putimage(0,0,aa,0); + for( gd=0; gd <= 27; gd ++) + for( gm=0; gm <= 34; gm ++) + cols[gd][gm+1]=getpixel(gd,gm); + + restorecrtmode(); +/* + asm + mov ax,$1003 + mov bl,0 + int $10 + end; +*/ + for( gm=0; gm <= 17; gm ++) + for( gd=0; gd <= 27; gd ++) + {; + gotoxy(gd+1,gm+1); + if (cols[gd][2*gm]==cols[gd][2*gm+1]) + {; + textattr=cols[gd][2*gm]; output << ''; + } else + if ((cols[gd][2*gm]>7) && (cols[gd][2*gm+1]<8)) + {; + textattr=cols[gd][2*gm]+cols[gd][2*gm+1]*16; + output << ''; + } else + {; + textattr=cols[gd][2*gm]*16+cols[gd][2*gm+1]; + if (textattr>blink) textattr -= blink; + output << ''; + } + } + gotoxy(23,5); textattr=red; output << ''; + + assign(t,"v:avalot.txt"); reset(t); + textattr=9; gm=2; + do { + gm += 1; + t >> x >> NL; + gotoxy(30,gm); + output << x << NL; + } while (!(eof(t))); + + textattr=7; gotoxy(35,2); output << "Back in good old A.D. "; + textattr=15; output << "1176"; textattr=7; output << "..."; + textattr=9; gotoxy(40,4); output << "Lord"; + gotoxy(67,9); output << "d'Argent"; + textattr=yellow; + gotoxy(37,12); output << "He's back..."; + gotoxy(47,14); output << "And this time,"; + gotoxy(52,15); output << "he's wearing tights..."; + textattr=4; + gotoxy(36,17); output << "A Thorsoft of Letchworth game. * Requires EGA"; + gotoxy(38,18); output << "and HD. * By Mike, Mark and Thomas Thurman."; + gotoxy(40,19); output << "Sfx archive- "; + textattr=9; output << "Download "; + textattr=14; output << "AVLT10.EXE"; + textattr=9; output << " now!"; + gotoxy(1,1); + input >> NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp new file mode 100644 index 000000000000..915a33d3729e --- /dev/null +++ b/engines/avalanche/avvyans2.cpp @@ -0,0 +1,185 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Ansi.h"*/ + +integer gd,gm; +untyped_file f; +array<1,16000,byte> aa; +matrix<0,27,0,35,byte> cols; +text t; +string x; +byte n; +byte spaces; +byte cfg,cbg; /* Current foreground & background. */ +byte ofg,obg; /* Old fg & bg. */ + +void do_spaces() +{; + if (spaces==0) return; + along(spaces); + spaces=0; +} + +void finishline(); +static byte wx,wy; + +static void jumpto(byte xx) +{; + along(xx-wx); +} + +void finishline() +{; + wx=29-spaces; wy=gm+1; + switch (wy) { + case 1: {; + sgr(7); jumpto(35); output << "Back in good old A.D. "; + sgr(15); output << "1189"; sgr(7); output << "..." << NL; cfg=7; + } + break; + case RANGE_5(3,7): {; + t >> x >> NL; + while (x[length(x)]=='\40') x[0] -= 1; + if (x!="") + {; + jumpto(30); + sgr(9); + spaces=0; + while (x!="") + {; + if (x[1]==' ') + spaces += 1; + else + {; + do_spaces(); + output << x[1]; + } + Delete(x,1,1); + } + if (wy==7) close(t); + output << NL; + } + } + break; + case 8: {; + jumpto(67); sgr(9); output << "d'Argent" << NL; cfg=9; + } + break; + case 11: {; + jumpto(37); sgr(14); output << "He's back..." << NL; + } + break; + case 13: {; + jumpto(47); sgr(14); output << "And this time," << NL; + } + break; + case 14: {; + jumpto(52); sgr(14); output << "he's wearing tights..." << NL; + } + break; + case 16: {; + jumpto(35); sgr(4); + output << "A Thorsoft of Letchworth game. * Requires EGA" << NL; + } + break; + case 17: {; + jumpto(37); sgr(4); + output << "and HD. * By Mike, Mark and Thomas Thurman." << NL; + } + break; + case 18: {; + jumpto(39); + sgr( 4); output << "Sfx archive- "; + sgr( 9); output << "Download "; + sgr(14); output << "AVLT10.EXE"; + sgr( 9); output << " now!"; + } + break; + default: output << NL; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + fillchar(cols,sizeof(cols),'\0'); + assign(f,"v:avvypic.ptx"); + reset(f,1); + blockread(f,aa,filesize(f)); + close(f); + putimage(0,0,aa,0); + for( gd=0; gd <= 27; gd ++) + for( gm=0; gm <= 34; gm ++) + cols[gd][gm+1]=getpixel(gd,gm); + + restorecrtmode(); + + assign(output,"v:avalot.ans"); rewrite(output); normal; ed; +/* assign(output,''); rewrite(output); normal; ed;*/ + assign(t,"v:avalot.txt"); reset(t); + + for( gm=0; gm <= 17; gm ++) + {; + spaces=0; + for( gd=0; gd <= 27; gd ++) + {; + if ((gd==22) && (gm==4)) + {; + do_spaces(); + sgr(red); output << ''; + } else + {; + if (cols[gd][2*gm]==cols[gd][2*gm+1]) + {; + if (cols[gd][2*gm]==0) + spaces += 1; /* a blank space */ + else {; + do_spaces(); + + if (cfg==cols[gd][2*gm]) output << ''; else + if (cbg==cols[gd][2*gm]) output << ' '; else + {; + sgr((cols[gd][2*gm])+(cbg*16)); + cfg=cols[gd][2*gm]; + output << ''; + } + } + } else + if ((cols[gd][2*gm]>7) && (cols[gd][2*gm+1]<8)) + {; + do_spaces(); + sgr(cols[gd][2*gm]+cols[gd][2*gm+1]*16); + cfg=cols[gd][2*gm]; cbg=cols[gd][2*gm+1]*16; + output << ''; + } else + {; + do_spaces(); + + ofg=cfg; obg=cbg; + cbg=cols[gd][2*gm]; cfg=cols[gd][2*gm+1]; + + if ((cbg==ofg) && (cfg==obg)) + {; + n=cfg*16+cbg; + if (n>128) n -= 128; + output << ''; + } else + {; + n=cbg*16+cfg; + if (n>128) n -= 128; + if ((cfg!=ofg) || (cbg!=obg)) sgr(n); + output << ''; + } + + } + } + } finishline(); + } + output << NL; + normal; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp new file mode 100644 index 000000000000..5a4b70c81810 --- /dev/null +++ b/engines/avalanche/avvymonk.cpp @@ -0,0 +1,72 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; +byte z; +array<1,4,pointer> a; +untyped_file f; word s; +string check; +integer x,y; +void savesc() +{ + varying_string<40> adf; untyped_file f; byte z; array<1,2,pointer> c; word s; +varying_string<14> nam; varying_string<30> screenname; +; + nam="v:avvymonk.avd"; + adf=string("aved as a stuff file, so there! TJAT.")+'\15'+'\12'+'\32'; + adf[0]='S'; + screenname="Avalot in a monk's costume"; + assign(f,nam); /* not scrambled */ + rewrite(f,1); + blockwrite(f,adf,41); + blockwrite(f,nam,13); + blockwrite(f,screenname,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(c[z],s); + getimage(0,15+(z-1)*75,getmaxx(),15+(z)*75,c[z]); + blockwrite(f,c[z],s); + freemem(c[z],s); + } +} +void loadscreen(string nam) +{; + assign(f,nam); + reset(f,1); + blockread(f,check,41); + blockread(f,check,13); + blockread(f,check,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(a[z],s); + blockread(f,a[z],s); + setactivepage(0); + putimage(0,15+(z-1)*75,a[z],0); + freemem(a[z],s); + } + close(f); +} +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; + x=0; y=0; + initgraph(gd,gm,"o:"); + loadscreen("v:legion.avd"); + while (y<100) + {; + switch (getpixel(x,y)) { + case 7: putpixel(x,y,0); break; + case 8: putpixel(x,y,0); break; + case 9: putpixel(x,y,15); break; + } + x += 1; + if (x>640) {; y += 1; x=0; } + } + savesc(); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp new file mode 100644 index 000000000000..5cea62db1272 --- /dev/null +++ b/engines/avalanche/bakchunk.cpp @@ -0,0 +1,28 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Celer.h"*/ +/*#include "Lucerna.h"*/ + +integer gd,gm; +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=0; initgraph(gd,gm,""); + setvisualpage(3); + load_chunks('1'); + + for( gd=0; gd <= num_chunks; gd ++) + show_one_at(gd,0,gd*40); + + mblit(0,0,79,200,3,0); + + gd=getpixel(0,0); + setvisualpage(0); setactivepage(0); + + settextstyle(0,0,4); setcolor(15); + outtextxy(100,50,"Chunk1"); + input >> NL; + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp new file mode 100644 index 000000000000..56cfcca023bf --- /dev/null +++ b/engines/avalanche/basher.cpp @@ -0,0 +1,385 @@ +#include "ptoc.h" + +/* + + + + + BASHER Handles the keyboard. */ + +#define __basher_implementation__ + + + /* Note: this unit can record keystrokes, for the demo. If you want it + to do this, define the o.c.c. RECORD. Setting gyro.demo to True will + cause them to be played back. */ + +#include "basher.h" + + +#include "enhanced.h" +#include "lucerna.h" +#include "Graph.h" +#include "scrolls.h" +#include "acci.h" +#include "trip5.h" +#include "pingo.h" +#include "dropdown.h" +#include "logger.h" +#include "Sticks.h" +#include "enid.h" + + +boolean entering_filename; +byte left_margin; + +void plottext() +{ + const array<0,2,byte> p = {{0,1,3}}; + byte x,y,n; + + x=0; if (mouse_near_text()) super_off(); + cursor_off(); + for( n=0; n <= 2; n ++) + for( y=0; y <= 7; y ++) + { + for( x=1; x <= length(current); x ++) + mem[0xa000*p[n]*pagetop+12882+y*80+x]=little[current[x]][y]; + fillchar(mem[0xa000*p[n]*pagetop+12883+y*80+x],77-x,'\0'); + } + cursor_on(); + super_on(); +} + +void wipetext() +{ + const array<0,2,byte> n = {{0,1,3}}; + byte y,p; + + if (mouse_near_text()) super_off(); + cursor_off(); + for( y=0; y <= 7; y ++) + for( p=0; p <= 2; p ++) + fillchar(mem[0xa000*n[p]*pagetop+12883+y*80],77,'\0'); + quote=true; curpos=1; cursor_on(); + super_on(); +} + +/*procedure cursor; +begin + if curflash=0 then + begin + if mouse_near_text then Super_Off; + cursoron:=not cursoron; + mem[$A000*13442+curpos]:=not mem[$A000*13442+curpos]; + mem[$A000*pagetop+13442+curpos]:=not mem[$A000*pagetop+13442+curpos]; + curflash:=17; + Super_On; + end else dec(curflash); +end;*/ + +void do_cursor() +{ + bytefield bf; + byte fv; + + mem[0xac00*13442+curpos]=~ mem[0xac00*13442+curpos]; + { + bf.x1=curpos+1; bf.x2=curpos+2; bf.y1=168; bf.y2=168; + } + for( fv=0; fv <= 1; fv ++) getset[fv].remember(bf); +} + +void cursor_on() +{ + if (cursoron) return; + do_cursor(); cursoron=true; +} + +void cursor_off() +{ + if (! cursoron) return; + do_cursor(); cursoron=false; +} + + +void get_demorec() +{ + demofile >> demo_rec; + inchar=demo_rec.key; + extd=demo_rec.extd; + demo_rec.delay -= 1; +} + +#ifdef RECORD + void record_one() + { + demo_rec.delay=count; + demo_rec.key=inchar; + demo_rec.extd=extd; + + demofile << demo_rec; + count=0; + } +#endif +/* +procedure storeline(whatwhat:string); +var + fv:byte; + what:string[77]; + ok:boolean; + + function upline(x:string):string; + var fv:byte; n:string[77]; + begin + for fv:=1 to length(x) do n[fv]:=upcase(x[fv]); + n[0]:=x[0]; upline:=n; + end; +begin + + what:=upline(whatwhat); ok:=false; + for fv:=1 to 20 do + if what=upline(previous^[fv]) then + begin { it already exists, in string "fv" } + move(previous^[fv+1],previous^[fv],(20-fv)*78); + previous^[20]:=whatwhat; ok:=true; + end; + if ok then exit; + { it's not on the list, so add it } + move(previous^[2],previous^[1],1482); { shove up } + previous^[20]:=whatwhat; +end; +*/ +void typein(); + +static char firstchar(string x) { char firstchar_result; + firstchar_result=x[1]; return firstchar_result; + } + + +static void try_dd() /* This asks the Parsekey proc in Dropdown if it knows it. */ +{ + parsekey(inchar,extd); +} + +void typein() +{ + byte w; + + inkey(); + #ifdef RECORD record_one(); #endif + + switch (inchar) { + case RANGE_15('\40','\56'):case '\60' ... '\337':case '\341' ... '\377': if (ddm_o.menunow) + { + parsekey(inchar,extd); + } else + { + if (length(current)<76) + { + if ((inchar=='"') || (inchar=='`')) + { + if (quote) inchar='`'; else inchar='"'; + quote=! quote; /* Quote- Unquote... */ + } + insert(inchar,current,curpos); + curpos += 1; + plottext(); + } else blip(); + } + break; + case '\10': if (! ddm_o.menunow) + { + if (curpos>left_margin) + { + curpos -= 1; + if (set::of('"','`', eos).has(current[curpos])) quote=! quote; + Delete(current,curpos,1); + plottext(); + } else blip(); + } + break; + case '\0':case '\340': { + switch (extd) { + /* Function keys: */ + case cf1: callverb(vb_help); break; /* f1 - help (obviously) */ + case cf2: fxtoggle(); break; /* f2 - sound */ + case ccf2:case cf11: { clearwords(); callverb(vb_save); } break; /* ^f2 - save */ + case cf3: if (length(current)left_margin) + { cursor_off(); curpos -= 1; cursor_on(); } + break; /* ^left */ + case ccright: if (curpos<=length(current)) /* ^right */ + { cursor_off(); curpos += 1; cursor_on(); } + break; + case cchome: { cursor_off(); curpos=1; cursor_on(); } break; /* ^home */ + case ccend: { cursor_off(); curpos=length(current)+1; cursor_on(); } break; /* ^end */ + case c_ar: oh=177; break; /* alt-R = repeater (re-chime) */ + case cup:case cdown:case cleft:case cright:case cpgup:case cpgdn:case chome:case cend: if (ddm_o.menunow) try_dd(); + else tripkey(extd); + break; /* Up/Down/Left/Right/PgUp/PgDn */ + case cnum5: tripkey(extd); break; /* Numeric 5 */ + case cdel: if (! ddm_o.menunow) + { + if (curpos<=length(current)) + { + if (set::of('"','`', eos).has(current[curpos])) quote=! quote; + Delete(current,curpos,1); + plottext(); + } else blip(); + } + break; + default: try_dd(); + } + } + break; + case cescape:case '/': if (ddm_o.menunow) /* Escape */ + { ddm_o.wipe(); } else + if (entering_filename) + { normal_edit(); wipetext(); } else + ddm_m.getcertain(ddm_o.menunum); + break; + case creturn: if (ddm_o.menunow) try_dd(); /* Return */ + else { + log_command(current); + if (entering_filename) + { + edna_save(copy(current,24,255)); + normal_edit(); wipetext(); + } else + { + if (current!="") last=current; + parse(); do_that(); + if (! entering_filename) + { + current=""; + wipetext(); + } + } + } + break; + case '\11': callverb(vb_inv); break; /* Ctrl-I= inventory */ + case '\7': errorled(); break; + case '\25': { + current=""; + wipetext(); + } + break; + + case '\27': { tr[1].xs=walk; newspeed(); } break; + case '\22': { tr[1].xs=run; newspeed(); } break; + + case '\2': bosskey(); break; + case '\12': ctrl=cjoy; break; /* Joystick */ + case '\13': ctrl=ckey; break; /* Keyboard */ + case '\3': callverb(vb_quit); break; /* Ctrl-C= request to quit */ + + } + showrw(); + + if (demo) get_demorec(); +} + +/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; + '': begin setvisualpage(0); write(#7); inkey; end;*/ + +void keyboard_link() +{ + state(defaultled); /* if defaultled=1 then on; { For the menus }*/ + joykeys(); /* Test joystick buttons- I know that's not keyboard. */ + + if (demo) + { + if (keypressede()) exit(0); + if (demo_rec.delay>0) + demo_rec.delay -= 1; + else typein(); + return; + } + + #ifdef RECORD count += 1; #endif + + if (! keypressede()) return; + if (keyboardclick) click(); + typein(); +} + +boolean demo_ready() +{ + boolean demo_ready_result; + if (demo_rec.delay>0) + { + slowdown(); + demo_rec.delay -= 1; + } + demo_ready_result=demo_rec.delay==0; + return demo_ready_result; +} + +void filename_edit() +{ + entering_filename=true; + current="Filename\? (Esc=cancel):"; + left_margin=24; curpos=24; + plottext(); +} + +void normal_edit() +{ + entering_filename=false; + current=""; + left_margin=1; curpos=1; +} + +class unit_basher_initialize { + public: unit_basher_initialize(); +}; +static unit_basher_initialize basher_constructor; + +unit_basher_initialize::unit_basher_initialize() { +/* new(previous);*/ last=""; normal_edit(); + + if (demo) + { + assign(demofile,"demo.avd"); + reset(demofile); + } + + #ifdef RECORD + count=0; + assign(demofile,"demo.avd"); + rewrite(demofile); + #endif + +} diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h new file mode 100644 index 000000000000..1afecae44124 --- /dev/null +++ b/engines/avalanche/basher.h @@ -0,0 +1,40 @@ +#ifndef __basher_h__ +#define __basher_h__ + + +#include "gyro.h" +/*#include "Tommys.h"*/ + + +#ifdef RECORD + +#ifdef __basher_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN word count; +#undef EXTERN +#define EXTERN extern + +#endif + + void plottext(); + + void keyboard_link(); + + void cursor_on(); + + void get_demorec(); + + boolean demo_ready(); + + void cursor_off(); + + void filename_edit(); + void normal_edit(); +#ifdef RECORD + void record_one(); +#endif + +#endif diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp new file mode 100644 index 000000000000..a903679a903d --- /dev/null +++ b/engines/avalanche/bootstrp.cpp @@ -0,0 +1,349 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ + + +/*$M 8192,0,$6000, S-*/ + +enum elm {normal, musical, elmpoyten, regi, last_elm}; + +const integer run_shootemup = 1; +const integer run_dosshell = 2; +const integer run_ghostroom = 3; +const integer run_golden = 4; + +const array > runcodes = {{"et","Go"}}; + +const integer reset_ = 0; + +const boolean jsb = true; const boolean no_jsb = false; +const boolean bflight = true; const boolean no_bflight = false; + + +struct { + byte operation; + word skellern; + array<1,10000,byte> contents; +} storage; + +string arguments,demo_args,args_with_no_filename; + +boolean first_time; + +byte original_mode; +pointer old_1c; + +string segofs; + +boolean zoomy; + +longint soundcard,speed,baseaddr,irq,dma; + +void cursor_off() /*assembler; */ +{; +/* asm + mov ah,01; { Change cursor size. */ +/* mov cx,8224; { CH & CL are now 32. */ +/* int $10; { Call the Bios */ + +} /* That's all. */ + +void cursor_on() /*assembler; */ +{; +/* +asm + mov ah,01; { Change cursor size. */ +/* mov ch,5; { Top line is 5. */ +/* mov cl,7; { Bottom line is 7. */ +/* int $10; { Call the Bios. */ + +} + +void quit() +{ + cursor_on(); + exit(0); +} + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +string command_com() +{ + string temp; + + string command_com_result; + temp=getenv("comspec"); + if (temp=="") + output << "avvy_bootstrap: COMSPEC not defined, => cannot run Dos shell." << NL; + command_com_result=temp; + return command_com_result; +} + +void explain(byte error) +{ + output << " ("; + switch (error) { + case 2: output << "it's not there"; break; + case 8: output << "out of memory"; break; + default: output << "error " << error; + } + output << ")." << NL; +} + +/*$F+*/ + +void b_flight() /*interrupt;*/ +{ + storage.skellern += 1; +} + +/*$F-*/ + +void bflight_on() +{ + storage.skellern=reset_; + setintvec(0x1c,&b_flight); +} + +void bflight_off() +{ + setintvec(0x1c,old_1c); +} + +void run(string what, boolean with_jsb,boolean with_bflight, elm how); + + +static string elm2str(elm how) +{ + string elm2str_result; + switch (how) { + case normal: case musical: elm2str_result="jsb"; break; + case regi: elm2str_result="REGI"; break; + case elmpoyten: elm2str_result="ELMPOYTEN"; break; + } + return elm2str_result; +} + +void run(string what, boolean with_jsb,boolean with_bflight, elm how) +{ + string which_dir,args; + integer error; + + + if (what=="") return; + + getdir(0,which_dir); + + if (with_jsb) + { + if (how==musical) + args=elm2str(how)+' '+args_with_no_filename; /* FN is NOT given if musical*/ + else + args=elm2str(how)+' '+arguments; + } else args=""; + + if (how==musical) args=args+strf(soundcard)+' '+strf(speed)+' '+ + strf(baseaddr)+' '+strf(dma)+' '+strf(irq); + if (with_bflight) bflight_on(); + + swapvectors; + exec(what,args); + swapvectors; + cursor_off(); + + error=doserror; + + if (with_bflight) bflight_off(); + + chdir(which_dir); + + if (error!=0) + { + output << "avvy_bootstrap: cannot execute " << what << '!'; + explain(error); + output << "Press Enter:"; input >> NL; quit(); + } +} + +void run_avalot() +{ + integer error; + + + bflight_on(); + + swapvectors; + exec("avalot.avx",runcodes[first_time]+arguments); + swapvectors; + + error=doserror; + + bflight_off(); + + if (error!=0) + { + output << "avvy_bootstrap: error in loading AVALOT.AVX!"; + explain(error); + quit(); + } + + first_time=false; +} + +void run_the_demo() +{ + string args; + + args=arguments; + arguments=demo_args; /* Force the demo. */ + + run_avalot(); + + arguments=args; /* Put all back to normal again. */ + first_time=true; +} + +void get_arguments() +{ + byte fv; + + arguments=""; + + for( fv=1; fv <= paramcount; fv ++) + arguments=arguments+paramstr(fv)+' '; + + arguments[0] -= 1; /* Get rid of the trailing space. */ + + segofs=string(' ')+strf(seg(storage))+' '+strf(ofs(storage)); + + arguments=segofs+' '+arguments; +} + +void dos_shell() +{ + registers r; + + r.ax=original_mode; intr(0x10,r); + output << NL; + output << "The Avalot Dos Shell." << NL; + output << "---------------------" << NL; + output << NL; + output << "Type EXIT to return to Avalot." << NL; + output << NL; + + cursor_on(); + run(command_com(),no_jsb,no_bflight,normal); + cursor_off(); + + output << "Please wait, restoring your game..." << NL; +} + +boolean keypressed1() { + registers r; + + boolean keypressed1_result; + r.ah=0xb; + msdos(r); + keypressed1_result=r.al==0xff; + return keypressed1_result; + } + +void flush_buffer() { + registers r; r.ah=7; + while (keypressed1()) msdos(r); } + +void demo() +{ + run_the_demo(); if (keypressed1()) return; + run("intro.avx",jsb,bflight,musical); if (keypressed1()) return; + run("stars.avx",jsb,no_bflight,musical); if (keypressed1()) return; + + flush_buffer(); +} + +void call_menu() +{ + run("stars.avx",jsb,no_bflight,musical); + flush_buffer(); + do { + run("avmenu.avx",jsb,no_bflight,normal); + + switch (storage.operation) { + case 1: return; break; /* Play the game. */ + case 2: run("intro.avx",jsb,bflight,musical); break; + case 3: run("preview1.avd",jsb,no_bflight,normal); break; + case 4: run("viewdocs.avx",jsb,bflight,elmpoyten); break; + case 5: run("viewdocs.avx",jsb,bflight,regi); break; + case 6: quit(); break; + case 177: demo(); break; + } + + flush_buffer(); + } while (!false); +} + +void get_slope() +{ + run("slope.avx",jsb,no_bflight,normal); + if (dosexitcode!=0) + { + cursor_on(); + exit(0); + } + + move(storage.contents,arguments,sizeof(arguments)); + move(storage.contents[4998],soundcard,4); + move(storage.contents[5002],baseaddr,4); + move(storage.contents[5006],irq,4); + move(storage.contents[5010],dma,4); + move(storage.contents[5014],speed,4); + + zoomy=(arguments[8]=='y') || (arguments[2]=='y'); + demo_args=arguments; demo_args[7]='y'; + arguments=segofs+' '+arguments; + demo_args=segofs+' '+demo_args; + + args_with_no_filename=arguments; + if (arguments[length(arguments)]!=' ') + { /* Filename was given */ + args_with_no_filename=arguments; + while ((args_with_no_filename!="") + && (args_with_no_filename[length(args_with_no_filename)]!=' ')) + args_with_no_filename[0] -= 1; /* Strip off the filename. */ + } +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + original_mode=mem[seg0040*0x49]; getintvec(0x1c,old_1c); + first_time=true; cursor_off(); + + get_arguments(); + get_slope(); + + if (! zoomy) call_menu(); /* Not run when zoomy. */ + + do { + run_avalot(); + + if (dosexitcode!=77) quit(); /* Didn't stop for us. */ + + switch (storage.operation) { + case run_shootemup: run("seu.avx",jsb,bflight,normal); break; + case run_dosshell: dos_shell(); break; + case run_ghostroom: run("g-room.avx",jsb,no_bflight,normal); break; + case run_golden: run("golden.avx",jsb,bflight,musical); break; + } + + } while (!false); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp new file mode 100644 index 000000000000..b891123af511 --- /dev/null +++ b/engines/avalanche/cadburys.cpp @@ -0,0 +1,109 @@ +#include "ptoc.h" + +#define __cadburys_implementation__ + + +#include "cadburys.h" + + +#include "graph.h" + + + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + + diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h new file mode 100644 index 000000000000..65e7bd7c8b93 --- /dev/null +++ b/engines/avalanche/cadburys.h @@ -0,0 +1,41 @@ +#ifndef __cadburys_h__ +#define __cadburys_h__ + + +const integer arraysize = 12000; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + + +#ifdef __cadburys_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<0,arraysize,byte> aa; +EXTERN byte num_chunks,this_chunk; +EXTERN integer gd,gm; +EXTERN array<1,30,longint> offsets; +EXTERN untyped_file f; +#undef EXTERN +#define EXTERN extern + + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat); + +#endif diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp new file mode 100644 index 000000000000..61357f567bcc --- /dev/null +++ b/engines/avalanche/celer.cpp @@ -0,0 +1,472 @@ +#include "ptoc.h" + +/* + + + + + CELER The unit for updating the screen pics. */ + +#define __celer_implementation__ + + +#include "celer.h" + + +#include "Graph.h" +#include "trip5.h" +#include "lucerna.h" +/*#include "Crt.h"*/ + + +untyped_file f; /* Private variable- not accessible from elsewhere. */ + +const integer on_disk = -1; /* Value of memos[fv].x when it's not in memory. */ + +void pics_link() +{ + byte xx; + + if (ddmnow) return; /* No animation when the menus are up. */ + + { dnatype& with = dna; + switch (with.room) { + + case r__outsideargentpub: { + if ((roomtime % longint(12))==0) + show_one(longint(1)+(roomtime / longint(12)) % longint(4)); + } + break; + + case r__brummieroad: if ((roomtime % longint(2))==0) + show_one(longint(1)+(roomtime / longint(2)) % longint(4)); + break; + + case r__bridge: if ((roomtime % longint(2))==0) + show_one(longint(4)+(roomtime / longint(2)) % longint(4)); + break; + + case r__yours: if ((! with.avvy_is_awake) && ((roomtime % longint(4))==0)) + show_one(longint(1)+(roomtime / longint(12)) % longint(2)); + break; + + case r__argentpub: { + if (((roomtime % longint(7))==1) && (dna.malagauche!=177)) + { /* Malagauche cycle */ + dna.malagauche += 1; + switch (dna.malagauche) { + case 1:case 11:case 21: show_one(12); break; /* Looks forwards. */ + case 8:case 18:case 28:case 32: show_one(11); break; /* Looks at you. */ + case 30: show_one(13); break; /* Winks. */ + case 33: dna.malagauche=0; break; + } + } + + switch (roomtime % longint(200)) { + case 179:case 197: show_one(5); break; /* Dogfood's drinking cycle */ + case 182:case 194: show_one(6); break; + case 185: show_one(7); break; + case 199: dna.dogfoodpos=177; break; /* Impossible value for this. */ + case 0 ... 178: { /* Normally. */ + switch (bearing(2)) {/* Bearing of Avvy from Dogfood. */ + case 1 ... 90:case RANGE_3(358,360): xx=3; break; + case 293 ... 357: xx=2; break; + case 271 ... 292: xx=4; break; + } + if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ + { + show_one(xx); + dna.dogfoodpos=xx; + } + } + break; + } + } + break; + + case r__westhall: if ((roomtime % longint(3))==0) + switch ((roomtime / longint(3)) % longint(6)) { + case 4: show_one(1); break; + case 1:case 3:case 5: show_one(2); break; + case 0:case 2: show_one(3); break; + } + break; + case r__lustiesroom: if (! (dna.lustie_is_asleep)) { + if ((roomtime % longint(45))>42) xx=4; /* du Lustie blinks */ + else + switch (bearing(2)) {/* Bearing of Avvy from du Lustie. */ + case 0 ... 45:case 315 ... 360: xx=1; break; /* Middle. */ + case 45 ... 180: xx=2; break; /* Left. */ + case 181 ... 314: xx=3; break; /* Right. */ + } + if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ + { + show_one(xx); + dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + case r__aylesoffice: if ((! dna.ayles_is_awake) && (roomtime % longint(14)==0)) + { + switch ((roomtime / longint(14)) % longint(2)) { + case 0: show_one(1); break; /* Frame 2: EGA. */ + case 1: show_one(3); break; /* Frame 1: Natural. */ + } + } + break; + + case r__robins: if (dna.tied_up) + switch (roomtime % longint(54)) { + case 20: show_one(4); break; /* Frame 4: Avalot blinks. */ + case 23: show_one(2); break; /* Frame 1: Back to normal. */ + } + break; + + case r__nottspub: { + switch (bearing(5)) { /* Bearing of Avvy from Port. */ + case 0 ... 45:case 315 ... 360: xx=2; break; /* Middle. */ + case 45 ... 180: xx=6; break; /* Left. */ + case 181 ... 314: xx=8; break; /* Right. */ + } + + if ((roomtime % longint(60))>57) xx -= 1; /* Blinks */ + + if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ + { + show_one(xx); + dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ + } + + switch (roomtime % longint(50)) { + case 45 : show_one(9); break; /* Spurge blinks */ + case 49 : show_one(10); break; + } + } + break; + + case r__ducks: { + if ((roomtime % longint(3))==0) /* The fire flickers */ + show_one(longint(1)+(roomtime / longint(3)) % longint(3)); + + switch (bearing(2)) {/* Bearing of Avvy from Duck. */ + case 0 ... 45:case 315 ... 360: xx=4; break; /* Middle. */ + case 45 ... 180: xx=6; break; /* Left. */ + case 181 ... 314: xx=8; break; /* Right. */ + } + + if ((roomtime % longint(45))>42) xx += 1; /* Duck blinks */ + + if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ + { + show_one(xx); + dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + }} + + if ((dna.ringing_bells) && (flagset('B'))) + /* They're ringing the bells. */ + switch (roomtime % longint(4)) { + case 1: { + dnatype& with = dna; + + if (with.nextbell<5) with.nextbell=12; + with.nextbell -= 1; + note(notes[with.nextbell]); + } + break; + case 2: nosound; break; + } + +} + +void load_chunks(string xx) +{ + chunkblocktype ch; + byte fv; + + /*$I-*/ + assign(f,string("chunk")+xx+".avd"); /* strf is done for us by Lucerna. */ + reset(f,1); + if (ioresult!=0) return; /* no Chunk file. */ + seek(f,44); + blockread(f,num_chunks,1); + blockread(f,offsets,num_chunks*4); + + for( fv=1; fv <= num_chunks; fv ++) + { + seek(f,offsets[fv]); + blockread(f,ch,sizeof(ch)); + { + if (ch.memorise) + { + + { + memotype& with1 = memos[fv]; + + with1.x=ch.x; with1.xl=ch.xl; + with1.y=ch.y; with1.yl=ch.yl; + with1.flavour=ch.flavour; + with1.size=ch.size; + } + + getmem(memory[fv],ch.size); + + if (ch.natural) + { + getimage(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl,memory[fv]); + } else + blockread(f,memory[fv],ch.size); + } else memos[fv].x=on_disk; + } + } + + close(f); + /*$I+*/ +} + +void forget_chunks() +{ + byte fv; + + for( fv=1; fv <= num_chunks; fv ++) + if (memos[fv].x>on_disk) + freemem(memory[fv],memos[fv].size); + fillchar(memos,sizeof(memos),'\377'); /* x=-1, => on disk. */ +} + +void mdrop(integer x,integer y,integer xl,integer yl, pointer p) /* assembler; +asm + push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} + push bp; { Nor BP! } + + + { DI holds the offset on this page. It starts at the top left-hand corner. } + { (It should equal ch.y*80+ch.x. } + + mov ax,y; + mov dl,80; + mul dl; { Line offset now calculated. } + mov di,ax; { Move it into DI. } + mov ax,x; + add di,ax; { Full offset now calculated. } + + mov bx,yl; { No. of times to repeat lineloop. } + inc bx; { "loop" doesn't execute the zeroth time. } + mov bh,bl; { Put it into BH. } + + { BP holds the length of the string to copy. It's equal to ch.xl.} + + mov ax,word(p); { Data is held at DS:SI. } + mov si,ax; + mov ax,word(p+2); { This will be moved over into ds in just a tick... } + + mov bp,xl; + + mov ds,ax; + + + cld; { We're allowed to hack around with the flags! } + + mov ax,$AC00; { Top of the first EGA page. } + mov es,ax; { Offset on this page is calculated below... } + + +{ port[$3c4]:=2; port[$3ce]:=4; } + + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; + + mov cx,4; { This loop executes for 3, 2, 1, and 0. } + mov bl,0; + + + @mainloop: + + push di; + push cx; + +{ port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; +{ port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; + + xor ch,ch; + mov cl,bh; { BH = ch.yl. } + + @lineloop: + + push cx; + + mov cx,bp; + + repz movsb; { Copy the data. } + + sub di,bp; + add di,80; + + pop cx; + + loop @lineloop; + + inc bl; { One more on BL. } + + pop cx; + pop di; + + loop @mainloop; + + pop bp; + pop ds; { Get DS back again. } +*/ +{; +} + +void show_one(byte which); + +static bytefield r; + +static void display_it(integer x,integer y,integer xl,integer yl, flavourtype flavour, pointer p) +{ + { + switch (flavour) { + case ch_bgi : { + putimage(x*8,y,p,0); + r.x1=x; r.y1=y; + r.x2=x+xl+1; r.y2=y+yl; + } + break; + case ch_ega : { + mdrop(x,y,xl,yl,p); blitfix(); + r.x1=x; r.y1=y; r.x2=x+xl; r.y2=y+yl; + } + break; + } +} +} + +void show_one(byte which) +{ + chunkblocktype ch; + pointer p; + byte fv; + + + setactivepage(3); + + { + memotype& with = memos[which]; + + if (with.x>on_disk) + { + display_it(with.x,with.y,with.xl,with.yl,with.flavour,memory[which]); + } else + { + reset(f,1); + seek(f,offsets[which]); + blockread(f,ch,sizeof(ch)); + + { + getmem(p,ch.size); + blockread(f,p,ch.size); + + display_it(ch.x,ch.y,ch.xl,ch.yl,ch.flavour,p); + freemem(p,ch.size); + + close(f); + } + + } + + setactivepage(1-cp); + + for( fv=0; fv <= 1; fv ++) + getset[fv].remember(r); + } + +} + +void show_one_at(byte which, integer xxx,integer yyy); + +static bytefield r1; + +static void display_it1(integer xl,integer yl, flavourtype flavour, pointer p, integer& xxx, integer& yyy) +{ + { + switch (flavour) { + case ch_bgi : { + putimage(xxx,yyy,p,0); + r1.x1=xxx; r1.y1=yyy; + r1.x2=xxx+xl+1; r1.y2=yyy+yl; + } + break; + case ch_ega : { + mdrop(xxx / 8,yyy,xl,yl,p); blitfix(); + r1.x1=xxx / 8; r1.y1=yyy; r1.x2=(xxx / 8)+xl; r1.y2=yyy+yl; + } + break; + } +} +} + +void show_one_at(byte which, integer xxx,integer yyy) +{ + chunkblocktype ch; + pointer p; + byte fv; + + + setactivepage(3); + + { + memotype& with = memos[which]; + + if (with.x>on_disk) + { + display_it1(with.xl,with.yl,with.flavour,memory[which], xxx, yyy); + } else + { + reset(f,1); + seek(f,offsets[which]); + blockread(f,ch,sizeof(ch)); + + { + getmem(p,ch.size); + blockread(f,p,ch.size); + + display_it1(ch.xl,ch.yl,ch.flavour,p, xxx, yyy); + freemem(p,ch.size); + + close(f); + } + + } + + setactivepage(1-cp); + + for( fv=0; fv <= 1; fv ++) + getset[fv].remember(r1); + } +} + +class unit_celer_initialize { + public: unit_celer_initialize(); +}; +static unit_celer_initialize celer_constructor; + +unit_celer_initialize::unit_celer_initialize() { + num_chunks=0; +} diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h new file mode 100644 index 000000000000..f6ad52ffb1c7 --- /dev/null +++ b/engines/avalanche/celer.h @@ -0,0 +1,53 @@ +#ifndef __celer_h__ +#define __celer_h__ + + +#include "closing.h" +#include "incline.h" +#include "gyro.h" + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +struct memotype { + integer x,y; + integer xl,yl; + flavourtype flavour; + word size; +}; + + +#ifdef __celer_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,40,longint> offsets; +EXTERN byte num_chunks; +EXTERN array<1,40,memotype> memos; +EXTERN array<1,40,pointer> memory; +#undef EXTERN +#define EXTERN extern + + + void pics_link(); + + void load_chunks(string xx); + + void forget_chunks(); + + void show_one(byte which); + + void show_one_at(byte which, integer xxx,integer yyy); + +#endif diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp new file mode 100644 index 000000000000..a27c2612c164 --- /dev/null +++ b/engines/avalanche/ch_egats.cpp @@ -0,0 +1,155 @@ +#include "ptoc.h" + + +#include "graph.h" + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +untyped_file f; +longint offset; +chunkblocktype ch; +integer gd,gm; +byte bit; +pointer p; + +void mdrop(integer x,integer y,integer xl,integer yl, pointer p) /* assembler; +asm + push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} + push bp; { Nor BP! } + + + { DI holds the offset on this page. It starts at the top left-hand corner. } + { (It should equal ch.y*80+ch.x. } + + mov ax,y; + mov dl,80; + mul dl; { Line offset now calculated. } + mov di,ax; { Move it into DI. } + mov ax,x; + add di,ax; { Full offset now calculated. } + + mov bx,yl; { No. of times to repeat lineloop. } + inc bx; { "loop" doesn't execute the zeroth time. } + mov bh,bl; { Put it into BH. } + + { BP holds the length of the string to copy. It's equal to ch.xl.} + + mov ax,word(p); { Data is held at DS:SI. } + mov si,ax; + mov ax,word(p+2); { This will be moved over into ds in just a tick... } + + mov bp,xl; + + mov ds,ax; + + + cld; { We're allowed to hack around with the flags! } + + mov ax,$A000; { Top of the first EGA page. } + mov es,ax; { Offset on this page is calculated below... } + + +{ port[$3c4]:=2; port[$3ce]:=4; } + + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; + + mov cx,4; { This loop executes for 3, 2, 1, and 0. } + mov bl,0; + + + @mainloop: + + push di; + push cx; + +{ port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; +{ port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; + + xor ch,ch; + mov cl,bh; { BH = ch.yl. } + + @lineloop: + + push cx; + + mov cx,bp; + + repz movsb; { Copy the data. } + + sub di,bp; + add di,80; + + pop cx; + + loop @lineloop; + + inc bl; { One more on BL. } + + pop cx; + pop di; + + loop @mainloop; + + pop bp; + pop ds; { Get DS back again. } +*/ +{; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(f,"chunk21.avd"); + reset(f,1); + + seek(f,49); + blockread(f,offset,4); + + seek(f,offset); + + blockread(f,ch,sizeof(ch)); + + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + getmem(p,ch.size); + blockread(f,p,ch.size); +/* putimage(0,0,p^,0);*/ + + +/* with ch do + for bit:=0 to 3 do + begin; + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + for gm:=0 to yl do + blockread(f,mem[$A000*gm*80],(ch.xl+7) div 8); + end;*/ + + mdrop(ch.x,ch.y,ch.xl,ch.yl,p); + + close(f); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp new file mode 100644 index 000000000000..8b38f8ad62b6 --- /dev/null +++ b/engines/avalanche/charmap.cpp @@ -0,0 +1,30 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ + +struct infotype { + matrix<128,255,1,8,byte> chars; + string data; +}; +infotype table; +pointer where; +byte w,fv,ff,num; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1f,where); move(where,table,1024); + for( w=128; w <= 255; w ++) + {; output << w << NL; + for( fv=1; fv <= 8; fv ++) + {; + num=table.chars[w][fv]; + for( ff=1; ff <= 8; ff ++) + {; + if ((num & 128)==0) output << " "; else output << ""; + num=num << 1; + } + output << NL; + } } +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp new file mode 100644 index 000000000000..6d48054a2e13 --- /dev/null +++ b/engines/avalanche/chunker.cpp @@ -0,0 +1,86 @@ +#include "ptoc.h" + + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +untyped_file f; +string fn; +byte num_chunks,fv; +longint offset; +chunkblocktype ch; + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + output << NL; + output << "CHUNKER 12/3/1995 TT" << NL; + output << NL; + + if (paramcount!=1) + { + output << "which chunk file?" << NL; + exit(0); + } + + fn=paramstr(1); + assign(f,fn); + reset(f,1); + output << "----- In chunk file " << fn << ", there are: -----" << NL; + + seek(f,44); + blockread(f,num_chunks,1); + output << format(num_chunks,4) << " chunks:" << NL; + + output << " No Hdr Offset Flvr Mem Nat X Y Width Height Size of image" << NL; + + for( fv=1; fv <= num_chunks; fv ++) + { + + output << "Ch" << format(fv,2) << ':'; + + seek(f,41+fv*4); + + output << format(41+fv*4,4); + blockread(f,offset,4); + output << format(offset,10); + + seek(f,offset); + blockread(f,ch,sizeof(ch)); + { + if (ch.flavour==ch_bgi) + output << " ch_BGI"; + else + output << " ch_EGA"; + + if (ch.memorise) + output << " yes"; + else + output << " no "; + + if (ch.natural) + output << " yes"; + else + output << " no "; + + output << format(ch.x,7) << format(ch.y,7) << format(ch.xl,7) << format(ch.yl,7) << format(ch.size,10); + } + + output << NL; + } + + output << "---ENDS---" << NL; + + close(f); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp new file mode 100644 index 000000000000..dce372283738 --- /dev/null +++ b/engines/avalanche/chunkxf1.cpp @@ -0,0 +1,259 @@ +#include "ptoc.h" + + +#include "graph.h" +#include "cadburys.h" + + +/*type + flavourtype = (ch_EGA,ch_BGI); + + chunkblocktype = record + flavour:flavourtype; + x,y:integer; + xl,yl:integer; + size:longint; + natural:boolean; + + memorise:boolean; { Hold it in memory? } + end;*/ + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +/* arraysize = 12000;*/ + +/* offsets:array[1..30] of longint;*/ +byte num_chunks/*,this_chunk*/; +integer gd,gm; +/* f:file;*/ +/* aa:array[0..arraysize] of byte;*/ + +void load() +{ + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + assign(f,"chunkbit.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + assign(f,"place21.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); +} + +void open_chunk() +{; + assign(f,"chunk21.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} +/* +procedure mgrab(x1,y1,x2,y2:integer; size:word); +var yy:integer; aapos:word; length,bit:byte; +begin; + if size>arraysize then + begin; + writeln('*** SORRY! *** Increase the arraysize constant to be greater'); + writeln(' than ',size,'.'); + halt; + end; + + aapos:=0; + + length:=x2-x1; + + for bit:=0 to 3 do + begin; + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + for yy:=y1 to y2 do + begin; + move(mem[$A400*yy*80+x1],aa[aapos],length); + move(aa[aapos],mem[$A400*yy*80],length); +(* fillchar(mem[$A400:yy*80+x1],length,#177);*) + inc(aapos,length); + end; + end; + bit:=getpixel(0,0); + +end; +*/ +/*procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; + mem,nat:boolean); + { yes, I *do* know how to spell "really"! } +var + s:word; + p:pointer; + ch:chunkblocktype; +begin; + inc(this_chunk); + offsets[this_chunk]:=filepos(f); + + + s:=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p^); + + with ch do + begin; + flavour:=flav; + x:=realx; y:=realy; + + xl:=x2-x1; + yl:=y2-y1; + size:=s; + memorise:=mem; + natural:=nat; + end; + + setvisualpage(1); + setactivepage(1); + readln; + putimage(ch.x,ch.y,p^,0); + + if flav=ch_EGA then + begin; + freemem(p,s); + s:=4*((x2-x1+7) div 8)*(y2-y1+1); + with ch do + begin; + size:=s; + x:=x div 8; + xl:=(xl+7) div 8; + mgrab(x,y,x+xl,y+yl,s); + end; + end; + + readln; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + case flav of + ch_EGA : if not nat then blockwrite(f,aa,s); + ch_BGI : begin; + if not nat then blockwrite(f,p^,s); + freemem(p,s); + end; + end; +{ rectangle(x1,y1,x2,y2);} +end;*/ + +/*procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; + mem,nat:boolean);*/ + /* yes, I *do* know how to spell "really"! */ +/*var + s:word; + p:pointer; + ch:chunkblocktype; +begin; +(* rectangle(x1,y1,x2,y2); exit;*) + inc(this_chunk); + offsets[this_chunk]:=filepos(f); + + + s:=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p^); + + with ch do + begin; + flavour:=flav; + x:=realx; y:=realy; + + xl:=x2-x1; + yl:=y2-y1; + size:=s; + memorise:=mem; + natural:=nat; + end; + + setvisualpage(1); + setactivepage(1); + readln; + putimage(ch.x,ch.y,p^,0); + + if flav=ch_EGA then + begin; + freemem(p,s); + s:=4*(((x2 div 8)-(x1 div 8))+2)*(y2-y1+1); + with ch do + begin; + size:=s; + x:=x div 8; + xl:=(xl div 8)+2; + mgrab(x,y,x+xl,y+yl,s); + end; + end else + with ch do { For BGI pictures. *//* + begin; + x:=x div 8; + xl:=(xl+7) div 8; + size:=imagesize(x*8,y,(x+xl)*8,y+yl); + end; + + readln; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + case flav of + ch_EGA : if not nat then blockwrite(f,aa,s); + ch_BGI : begin; + if not nat then blockwrite(f,p^,s); + freemem(p,s); + end; + end; +(* rectangle(x1,y1,x2,y2);*) +end;*/ + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + setwritemode(xorput); + + num_chunks=7; + + open_chunk(); + + grab( 98,10,181,41,247,82,ch_ega,false,false); /* Drawbridge... */ + grab(223,10,320,41,233,82,ch_ega,false,false); + grab(361,10,458,64,233,82,ch_ega,false,false); + + grab( 11,10, 39,22,172,17,ch_bgi,true,true); + grab( 11,38, 39,50,172,17,ch_ega,true,false); /* Flag. */ + grab( 11,24, 39,36,172,17,ch_ega,true,false); + grab( 11,10, 39,22,172,17,ch_ega,true,false); + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp new file mode 100644 index 000000000000..5d77d298d27e --- /dev/null +++ b/engines/avalanche/chunkxf2.cpp @@ -0,0 +1,192 @@ +#include "ptoc.h" + + +#include "graph.h" + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 32000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void load() +{ + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place9.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); +} + +void load_temp(string which) +{ + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + assign(f,which); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + bit=getpixel(0,0); +} + +void open_chunk() +{; + assign(f,"chunk9.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); +} + +void grab(integer x1,integer y1,integer x2,integer y2, integer realx, integer realy, boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + if (nat) + ch.flavour=ch_bgi; + else ch.flavour=ch_ega; /* At the moment, Celer can't handle natural ch_EGAs. */ + ch.x=realx; + ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + freemem(p,s); + {; + if (ch.flavour==ch_bgi) s=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + else s=4*((x2-x1+7) / 8)*(y2-y1+1); + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + if (! nat) blockwrite(f,aa,s); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + load_temp("d:chunkbit.avd"); + setwritemode(xorput); + + num_chunks=7; + + open_chunk(); + + grab( 78, 78,232,102,212, 10,true,false); /* 154 across */ + grab(235, 78,389,102,212, 10,true,false); + grab(392, 78,546,102,212, 10,true,false); + grab(392, 78,546,102,212, 10,true,true); + + load_temp("d:chunkbi3.avd"); + + grab(437, 51,475, 78,147,120,false,false); /* 5 = door half-open. */ + grab(397, 51,435, 78,147,120,false,false); /* 6 = door open. */ + grab(397, 51,435, 78,147,120,true,true); /* 7 = door shut. */ + + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp new file mode 100644 index 000000000000..220d07b56328 --- /dev/null +++ b/engines/avalanche/chunkxf3.cpp @@ -0,0 +1,250 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ +#include "cadburys.h" + + +/*type + flavourtype = (ch_EGA,ch_BGI); + + chunkblocktype = record + flavour:flavourtype; + x,y:integer; + xl,yl:integer; + size:longint; + natural:boolean; + + memorise:boolean; { Hold it in memory? } + end; + +const + chunkheader : array[1..44] of char = + 'Chunk-type AVD file, for an Avvy game.'+#26+#177+#$30+#$01+#$75+#177; + + arraysize = 12000; + +var + offsets:array[1..30] of longint; + num_chunks,this_chunk:byte; + gd,gm:integer; + f:file; + aa:array[0..arraysize] of byte;*/ + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void loadtemp(string n) +{ + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + assign(f,n); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + bit=getpixel(0,0); + finder(); +} + +void load() +{ + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + assign(f,"place22.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setactivepage(1); setvisualpage(1); finder(); + setactivepage(0); setvisualpage(0); +} + +void open_chunk() +{; + assign(f,"chunk22.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +/*procedure mgrab(x1,y1,x2,y2:integer; size:word); +var yy:integer; aapos:word; length,bit:byte; +begin; + if size>arraysize then + begin; + writeln('*** SORRY! *** Increase the arraysize constant to be greater'); + writeln(' than ',size,'.'); + halt; + end; + + aapos:=0; + + length:=x2-x1; + + for bit:=0 to 3 do + begin; + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + for yy:=y1 to y2 do + begin; + move(mem[$A400*yy*80+x1],aa[aapos],length); + inc(aapos,length); + end; + end; + bit:=getpixel(0,0); + +end; + +procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; + mem,nat:boolean); + { yes, I *do* know how to spell "really"! } +var + s:word; + p:pointer; + ch:chunkblocktype; +begin; + inc(this_chunk); + offsets[this_chunk]:=filepos(f); + + + s:=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p^); + + with ch do + begin; + flavour:=flav; + x:=realx; y:=realy; + + xl:=x2-x1; + yl:=y2-y1; + size:=s; + memorise:=mem; + natural:=nat; + end; + + setvisualpage(1); + setactivepage(1); + readln; + putimage(ch.x,ch.y,p^,0); + + if flav=ch_EGA then + begin; + freemem(p,s); + s:=4*((x2-x1+7) div 8)*(y2-y1+1); + with ch do + begin; + size:=s; + x:=x div 8; + xl:=(xl+7) div 8; + mgrab(x,y,x+xl,y+yl,s); + end; + end; + + readln; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + case flav of + ch_EGA : if not nat then blockwrite(f,aa,s); + ch_BGI : begin; + if not nat then blockwrite(f,p^,s); + freemem(p,s); + end; + end; +{ rectangle(x1,y1,x2,y2);} +end;*/ + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + loadtemp("chunkbit.avd"); load(); + setwritemode(xorput); + + num_chunks=9; + + open_chunk(); + + grab( 0,103,169,159, 72,86,ch_ega,false,false); /* Stairs... */ + grab(172,103,341,159, 72,86,ch_ega,false,false); + + loadtemp("chunkbi3.avd"); + + grab( 0,130, 79,157,341,94,ch_bgi,true ,true ); + grab( 0,130, 79,157,341,94,ch_ega,false,false); + grab( 0,102, 79,129,341,94,ch_ega,false,false); + grab( 0, 74, 79,101,341,94,ch_ega,false,false); /* Far door. */ + + loadtemp("chunkbi2.avd"); + + grab(393, 92,451,137,512,98,ch_bgi,true ,true ); /* Right-hand door. */ + grab(393, 92,451,137,512,98,ch_ega,false,false); + grab(453, 92,511,137,512,98,ch_ega,false,false); + + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp new file mode 100644 index 000000000000..2dfa34dc2774 --- /dev/null +++ b/engines/avalanche/chunkxf4.cpp @@ -0,0 +1,285 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +enum kind {walled,unwalled, last_kind}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +const kind w = walled; const kind uw = unwalled; + +array<1,50,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void rdln() +{ + char r; + return; + do { r=readkey(); } while (!(! keypressed())); +} + +void load(kind k) +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + if (k==unwalled) assign(f,"place29.avd"); + else assign(f,"walled.avd"); + + reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); +} + +void finder() +{ + char r; integer x,y; + return; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void loadtemp(string which) +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f,string("corr")+which+"tmp.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{ + assign(f,"chunk29.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{ + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; + + if (size>arraysize) + { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + { + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat, kind k) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; + +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + { + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + load(k); + + setvisualpage(1); + setactivepage(1); + rdln(); + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + { + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + { + ch.size=s; + ch.x=ch.x / 8; + ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + { + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + rdln(); + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : { + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + setwritemode(xorput); + + loadtemp("2"); + + num_chunks=32; + + open_chunk(); + + grab( 0, 11,100,104,260,41,ch_ega,false,false,uw); /*1 Geida's door. */ + grab(103, 12,203, 55,207,61,ch_ega,false,false,uw); /*2 "Ite mingite" sign. */ + grab(123, 59,185,103,254,90,ch_ega,false,false,uw); /*3 Normal N door (rt handle)*/ + grab(227, 10,289, 56,254,88,ch_ega,false,false,uw); /*4 Normal N door (lt handle)*/ + grab(207, 63,294,105, 9,47,ch_ega,false,false, w); /*5 Window in left wall. */ + grab(312, 10,416, 56,233,88,ch_ega,false,false,uw); /*6 North archway */ + grab(331, 78,384,101, 32,64,ch_ega,false,false, w); /*7 2 torches, L wall. */ + grab(607,142,621,157,233,88,ch_ega,false,false,uw); /*8 1 torch, N wall. */ + grab(417, 11,577, 59,311,61,ch_ega,false,false,uw); /*9 "The Wrong Way!" sign. */ + + loadtemp("3"); + + grab( 0, 11, 62, 63,557,108,ch_ega,false,false, w); /*10 Near right candle */ + grab( 64, 11,120, 63, 18,108,ch_ega,false,false, w); /*11 Near left candle */ + grab(122, 11,169, 55, 93,100,ch_ega,false,false, w); /*12 Far left candle */ + grab(171, 11,222, 52,500,100,ch_ega,false,false, w); /*13 Far right candle */ + grab( 32, 68, 84,104,285, 70,ch_ega,false,false,uw); /*14 Far window */ + grab(138, 65,190, 92,233, 88,ch_ega,false,false,uw); /*15 Baron du Lustie pic 1 */ + grab(244, 65,296, 92,103, 51,ch_ega,false,false,uw); /*16 Baron du Lustie pic 2 */ + grab(172, 54,280, 63,233, 88,ch_ega,false,false,uw); /*17 "Art Gallery" sign */ + grab(341, 18,402, 47,563, 48,ch_ega,false,false, w); /*18 Right wall torches */ + grab(528, 10,639,160,528, 10,ch_ega,false,false,uw); /*19 Right wall */ + grab(430, 50,526, 88,543, 50,ch_ega,false,false, w); /*20 Window in right wall */ + grab(451, 91,494,152,566, 91,ch_ega,false,false, w); /*21 Door in right wall */ + grab(238, 10,307, 14,484,156,ch_ega,false,false, w); /*22 Near wall door: right */ + grab(239, 16,300, 20,300,156,ch_ega,false,false, w); /*23 Near wall door: middle */ + grab(234, 22,306, 26,100,156,ch_ega,false,false, w); /*24 Near wall door: left */ + grab( 25,113, 87,156,254, 90,ch_ega,false,false, w); /*25 Far door opening stage 1 */ + grab(131,113,193,156,254, 90,ch_ega,false,false, w); /*26 Far door opening stage 2 */ + grab(237,113,299,156,254, 90,ch_ega,false,false, w); /*27 Far door opening stage 3 */ + + loadtemp("4"); + + grab( 0, 11,112,160, 0, 11,ch_ega,false,false,uw); /*28 Left wall */ + grab(144, 44,197, 76, 30, 44,ch_ega,false,false, w); /*29 Shield on L wall. */ + grab(149, 90,192,152, 35, 90,ch_ega,false,false, w); /*30 Door in L wall. */ + grab(463, 28,527, 43,252,100,ch_ega,false,false, w); /*31 Archway x 2 */ + grab(463, 79,527, 94,252,100,ch_ega,false,false, w); /*32 Archway x 3 */ + + close_chunk(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp new file mode 100644 index 000000000000..c9766830aece --- /dev/null +++ b/engines/avalanche/chunkxf5.cpp @@ -0,0 +1,244 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"v:place1.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + + setvisualpage(1); setactivepage(1); + finder(); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi9.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + setvisualpage(0); setactivepage(0); + finder(); +} + +void open_chunk() +{; + assign(f,"chunk1.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + if (! nat) putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2+7) / 8)-(x1 / 8))*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=9; + + open_chunk(); + + grab( 48, 42, 94, 66,400,105,ch_ega, true,false); /*1 Avvy asleep. */ + grab(100, 42,146, 66,400,105,ch_ega, true,false); /*2 Avvy asleep again. */ + grab(152, 42,198, 66,400,105,ch_ega,false,false); /*3 Avvy awake in bed. */ + grab(106,113,152,137,400,105,ch_bgi,true ,true ); /*4 No Avvy in bed. */ + + grab(206, 42,279, 75,150, 91,ch_ega,false,false); /*5 Open trunk. */ + grab(206, 42,287, 75,150, 91,ch_bgi,true, true); /*6 Shut trunk. */ + + grab( 69, 70,102, 88,431,100,ch_ega,false,false); /*7 Arkata 1. */ + grab(118, 70,151, 88,431,100,ch_ega,false,false); /*8 Arkata 2. */ + grab(167, 70,200, 88,431,100,ch_ega,false,false); /*9 Arkata 3. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp new file mode 100644 index 000000000000..665222252a0b --- /dev/null +++ b/engines/avalanche/chunkxf6.cpp @@ -0,0 +1,251 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +const integer x_ofs = 165; +const integer y_ofs = 58; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"v:place19.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"d:temp1.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + +/* finder;*/ +} + +void open_chunk() +{; + assign(f,"chunk19.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; + x1 -= x_ofs; x2 -= x_ofs; + y1 -= y_ofs; y2 -= y_ofs; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); +/* readln;*/ + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + +/* readln;*/ + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=13; + + open_chunk(); + + grab(165, 68,207, 87,127,105,ch_ega,false,false); /*1 The settle with no lute*/ + grab(209, 68,255, 96,159, 84,ch_bgi, true, true); /*2 Dogfood looks right. */ + grab(209, 68,255, 96,159, 84,ch_ega, true,false); /*3 Dogfood- straight ahead. */ + grab(257, 68,303, 96,159, 84,ch_ega, true,false); /*4 Dogfood- left. */ + grab(305, 68,351, 96,159, 84,ch_ega, true,false); /*5 DF drinks: stage 1. */ + grab(353, 68,399, 96,159, 84,ch_ega, true,false); /*6 DF drinks: stage 2. */ + grab(401, 68,447, 96,159, 84,ch_ega, true,false); /*7 DF drinks: stage 3. */ + grab(449, 84,465, 94,392, 87,ch_ega, true,false); /*8 Ibythneth smiles. */ + grab(449, 75,488, 82,341,123,ch_ega, true,false); /*9 No habit under the settle. */ + grab(508, 68,580,106,485,105,ch_ega, true,false); /*10 M gets your drink. */ + grab(508, 68,580,106,485,105,ch_bgi, true, true); /*11 M gets up again. */ + grab(470, 84,486, 91,510,108,ch_ega, true,false); /*12 M looks right. */ + grab(488, 84,504, 91,510,108,ch_ega, true,false); /*13 M winks. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp new file mode 100644 index 000000000000..97bacb596741 --- /dev/null +++ b/engines/avalanche/chunkxf7.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place25.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk25.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab( 16, 24,101, 45,448,116,ch_ega, true,false); /*2 The fire again. */ + grab(118, 20,203, 45,448,112,ch_bgi, true, true); /*1 The natural fire. */ + grab(118, 20,203, 45,448,112,ch_ega, true,false); /*3 Third stage of the fire. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp new file mode 100644 index 000000000000..4435ee48bd92 --- /dev/null +++ b/engines/avalanche/chunkxf8.cpp @@ -0,0 +1,243 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place23.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp(string x) +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,x); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk23.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp("chunkbi3.avd"); + setwritemode(xorput); + + num_chunks=6; + + open_chunk(); + + grab(226, 21,242, 29,348, 96,ch_bgi, true,true ); /*1 Looking forwards. */ + grab(226, 21,242, 29,348, 96,ch_ega, true,false); /*2 Looking left. */ + grab(253, 21,269, 29,348, 96,ch_ega, true,false); /*3 Looking right. */ + grab(240, 11,256, 19,348, 96,ch_ega, true,false); /*4 Blinking. */ + + loadtemp("chunkbi4.avd"); + + grab( 48, 83,110,126,324, 96,ch_ega,false,false); /*5 Eyes shut... */ + grab(112, 83,173,126,325, 96,ch_ega,false,false); /*6 Asleep. */ + + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp new file mode 100644 index 000000000000..96241d1487d1 --- /dev/null +++ b/engines/avalanche/chunkxf9.cpp @@ -0,0 +1,237 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place42.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"a:chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk42.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=4; + + open_chunk(); + + grab(276, 36,329, 73, 94, 97,ch_bgi, true,true ); /*1 Not tied to the tree.*/ + grab(276, 36,329, 73, 94, 97,ch_ega,false,false); /*2 Tied to the tree. */ + grab(182, 80,226, 88,311,132,ch_ega,false,false); /*3 Mushrooms have gone! */ + grab(253, 75,267, 82,114, 98,ch_ega,false,false); /*4 Avalot blinks. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp new file mode 100644 index 000000000000..6493e5241f1b --- /dev/null +++ b/engines/avalanche/chunkxfa.cpp @@ -0,0 +1,240 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place7.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); +/* finder;*/ + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + +/* finder;*/ +} + +void open_chunk() +{; + assign(f,"chunk7.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=7; + + open_chunk(); + + grab(220, 32,269, 62,370,115,ch_ega,false,false); /*1 Jacques awake... */ + grab(400, 12,450, 48,369,112,ch_ega,false,false); /*2 Jacques gone! */ + grab(116, 47,176, 98,393, 87,ch_ega,false,false); /*3 Jacques going... */ + grab(333, 31,393, 82,393, 87,ch_ega,false,false); /*4 The open door. */ + grab(396, 80,452,135, 39, 91,ch_ega,false,false); /*5 The left door opening. */ + grab(455, 80,510,135, 39, 91,ch_ega,false,false); /*6 The left door open. */ + grab(455, 80,510,135, 39, 91,ch_bgi,true ,true ); /*7 The left door shut. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp new file mode 100644 index 000000000000..7fda96c375dd --- /dev/null +++ b/engines/avalanche/chunkxfb.cpp @@ -0,0 +1,238 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place71.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"d:chunkbi2.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk71.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=5; + + open_chunk(); + + grab( 54, 57,124,116,188, 94,ch_ega,false,false); /*1 Door half-shut. */ + grab(144, 57,203,116,188, 94,ch_ega,false,false); /*2 Door shut. */ + grab(513, 92,572,151,188, 94,ch_ega,false,false); /*3 Door with arrow. */ + grab(610, 94,627,106,367,122,ch_ega,false,false); /*4 Holder with no pen. */ + grab( 54, 57,124,116,188, 94,ch_bgi,true ,true ); /*5 Door wide open. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp new file mode 100644 index 000000000000..aefb15f8a261 --- /dev/null +++ b/engines/avalanche/chunkxfc.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place2.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"d:chunkbi2.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk2.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab( 59, 15,166, 55,226, 86,ch_ega,false,false); /*1 Door half-shut. */ + grab(171, 15,278, 55,226, 86,ch_ega,false,false); /*2 Door half-open. */ + grab(283, 15,390, 55,226, 86,ch_ega,false,false); /*3 Door open. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp new file mode 100644 index 000000000000..e87fbbabb18f --- /dev/null +++ b/engines/avalanche/chunkxfd.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place15.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"d:chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk15.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab(535, 11,633, 74, 46, 97,ch_ega,false,false); /*1 Door half-open. */ + grab(539, 76,637,139, 46, 97,ch_ega,false,false); /*2 Door open. */ + grab(539, 76,637,139, 46, 97,ch_bgi,true ,true ); /*3 Door shut. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp new file mode 100644 index 000000000000..adb7f8628e29 --- /dev/null +++ b/engines/avalanche/chunkxfe.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place5.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi2.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk5.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab(252, 57,375,132,501, 85,ch_ega,false,false); /*1 Door half-open. */ + grab(418, 15,553, 90,504, 85,ch_ega,false,false); /*2 Door open. */ + grab(252, 57,375,132,504, 85,ch_bgi,true ,true ); /*3 Door shut. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp new file mode 100644 index 000000000000..9fb2a2ed591e --- /dev/null +++ b/engines/avalanche/chunkxff.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place13.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk13.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab(323, 84,393,123,266, 72,ch_ega,false,false); /*1 Door half-open. */ + grab(251, 84,321,123,266, 72,ch_ega,false,false); /*2 Door open. */ + grab(251, 84,321,123,266, 72,ch_bgi,true ,true ); /*3 Door shut. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp new file mode 100644 index 000000000000..077a330afec5 --- /dev/null +++ b/engines/avalanche/chunkxfg.cpp @@ -0,0 +1,236 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place16.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi3.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk16.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=3; + + open_chunk(); + + grab(336, 12,365, 28,187, 89,ch_ega,false,false); /*1 Ayles asleep frame 2. */ + grab(368, 12,397, 28,187, 89,ch_ega,false,false); /*2 Ayles awake. */ + grab(336, 12,365, 28,187, 89,ch_bgi,true ,true ); /*3 Ayles asleep frame 1. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp new file mode 100644 index 000000000000..163ae512192a --- /dev/null +++ b/engines/avalanche/chunkxfh.cpp @@ -0,0 +1,237 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place46.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"d:chunkbi4.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk46.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=4; + + open_chunk(); + + grab(136, 11,216, 49,288,104,ch_ega,false,false); /*1 Door opening, frame 1.*/ + grab( 45, 11,124, 49,289,104,ch_ega,false,false); /*2 Door opening, frame 2.*/ + grab(227, 11,306, 49,289,104,ch_ega,false,false); /*3 Door opening, frame 3.*/ + grab(227, 11,306, 49,289,104,ch_bgi,true ,true ); /*4 Natural frame. */ + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp new file mode 100644 index 000000000000..84157a84c533 --- /dev/null +++ b/engines/avalanche/chunkxfi.cpp @@ -0,0 +1,246 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; +; + + assign(f,"place47.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; +; + + assign(f,"chunkbi9.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{; + assign(f,"chunk47.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{; + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; +; + if (size>arraysize) + {; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + {; + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; +; +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + {; + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + {; + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + {; + ch.size=s; + ch.x=ch.x / 8; + ch.xl=(ch.xl / 8)+2; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + {; + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : {; + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=10; + + open_chunk(); + + grab(323, 35,340, 43,337, 93,ch_ega,true ,false); /*1 Port blinks */ + grab(323, 35,340, 43,337, 93,ch_bgi,true ,true ); /*2 Port normally */ + grab(421, 22,511, 71,474,101,ch_ega,false,false); /*3 Avalot & Spurge */ + grab(421, 22,511, 71,474,101,ch_bgi,true ,true ); /*4 Just Spurge. */ + + grab(524, 40,540, 47,337, 93,ch_ega,true ,false); /*5 Port L blinks */ + grab(524, 22,540, 29,337, 93,ch_ega,true ,false); /*6 Port L */ + grab(563, 40,579, 47,337, 93,ch_ega,true ,false); /*7 Port R blinks */ + grab(563, 22,579, 29,337, 93,ch_ega,true ,false); /*8 Port R */ + + grab(307, 38,310, 38,493,104,ch_ega,true ,false); /*9 Spurge blinks */ + grab(307, 38,310, 38,493,104,ch_bgi,true ,true ); /*10 Spurge doesn't blink */ + + close_chunk(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp new file mode 100644 index 000000000000..34a7109acc62 --- /dev/null +++ b/engines/avalanche/chunkxfj.cpp @@ -0,0 +1,237 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; + + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f,"place20.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f,"chunkbit.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{ + assign(f,"chunk20.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{ + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; + + if (size>arraysize) + { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + { + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; + +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + { + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + { + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + { + ch.size=s; + ch.x=ch.x / 8; + ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + { + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : { + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=4; + + open_chunk(); + + grab( 57, 11, 72, 18,399, 13,ch_ega,true ,false); /* 1 - all numbers are */ + grab( 57, 21, 72, 28,399, 13,ch_ega,true ,false); /* 2 flags. */ + grab( 56, 31, 71, 38,399, 13,ch_ega,true ,false); /* 3 */ + grab( 56, 31, 71, 38,399, 13,ch_bgi,true ,true ); /* 4, the natural one. */ + close_chunk(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp new file mode 100644 index 000000000000..70748b9a5f1e --- /dev/null +++ b/engines/avalanche/chunkxfk.cpp @@ -0,0 +1,237 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + + +enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; + boolean natural; + + boolean memorise; /* Hold it in memory? */ +}; + +const array<1,44,char> chunkheader = +string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer arraysize = 12000; + +array<1,30,longint> offsets; +byte num_chunks,this_chunk; +integer gd,gm; +untyped_file f; +array<0,arraysize,byte> aa; + +void finder() +{ + char r; integer x,y; + + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f,"place50.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f,"chunkbi4.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{ + assign(f,"chunk50.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{ + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +void mgrab(integer x1,integer y1,integer x2,integer y2, word size) +{ + integer yy; word aapos; byte length,bit; + + if (size>arraysize) + { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos=0; + + length=x2-x1; + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( yy=y1; yy <= y2; yy ++) + { + move(mem[0xa400*yy*80+x1],aa[aapos],length); + aapos += length; + } + } + bit=getpixel(0,0); + +} + +void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, + boolean mem,boolean nat) + /* yes, I *do* know how to spell "really"! */ +{ + word s; + pointer p; + chunkblocktype ch; + +/* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk]=filepos(f); + + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + + { + ch.flavour=flav; + ch.x=realx; ch.y=realy; + + ch.xl=x2-x1; + ch.yl=y2-y1; + ch.size=s; + ch.memorise=mem; + ch.natural=nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x,ch.y,p,0); + + if (flav==ch_ega) + { + freemem(p,s); + s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); + { + ch.size=s; + ch.x=ch.x / 8; + ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; + mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); + } + } else + /* For BGI pictures. */ + { + ch.x=ch.x / 8; + ch.xl=(ch.xl+7) / 8; + ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f,ch,sizeof(ch)); + + switch (flav) { + case ch_ega : if (! nat) blockwrite(f,aa,s); break; + case ch_bgi : { + if (! nat) blockwrite(f,p,s); + freemem(p,s); + } + break; + } +/* rectangle(x1,y1,x2,y2);*/ +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=4; + + open_chunk(); + + grab( 46, 53,107, 81,246, 88,ch_ega,false,false); /*1 - all numbers are */ + grab(115, 53,175, 81,248, 88,ch_ega,false,false); /*2 door stages. */ + grab(180, 53,241, 81,246, 88,ch_ega,false,false); /*3 */ + grab(180, 53,246, 84,246, 88,ch_bgi,true ,true ); /*4 */ + close_chunk(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp new file mode 100644 index 000000000000..01a05509b6c3 --- /dev/null +++ b/engines/avalanche/chunkxfl.cpp @@ -0,0 +1,127 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ +#include "cadburys.h" + + +void finder() +{ + char r; integer x,y; + + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +void load() +{ + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f,"place51.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a1,12080); + } + + close(f); + bit=getpixel(0,0); + setvisualpage(1); setactivepage(1); + finder(); + setvisualpage(0); setactivepage(0); +} + +void loadtemp() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f,"chunkbi4.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + + bit=getpixel(0,0); + + finder(); +} + +void open_chunk() +{ + assign(f,"chunk51.avd"); + rewrite(f,1); + blockwrite(f,chunkheader,sizeof(chunkheader)); + blockwrite(f,num_chunks,1); + blockwrite(f,offsets,num_chunks*4); + + this_chunk=0; +} + +void close_chunk() +{ + seek(f,45); + blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ + close(f); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks=9; + + open_chunk(); + + grab(346,119,404,154,539,116,ch_ega,true ,false); /*1 fire */ + grab(435,119,490,154,541,116,ch_ega,true ,false); /*2 fire */ + grab(435,119,490,154,541,116,ch_bgi,true ,true ); /*3 natural fire */ + + grab(300, 58,315, 68,258, 95,ch_ega,true ,false); /*6 Duck's head 2 */ + grab(246, 52,259, 62,258, 95,ch_ega,true ,false); /*5 Duck blinks 1 */ + + grab(300, 58,315, 68,258, 95,ch_bgi,true ,true ); /*4 Duck's head 1 */ + grab(262, 52,278, 62,257, 95,ch_ega,true ,false); /*7 Duck blinks 2 */ + + grab(333, 58,347, 68,258, 95,ch_ega,true ,false); /*8 Duck's head 3 */ + grab(250, 63,265, 73,258, 95,ch_ega,true ,false); /*9 Duck blinks 3 */ + + close_chunk(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp new file mode 100644 index 000000000000..16ec6f552bb5 --- /dev/null +++ b/engines/avalanche/clock.cpp @@ -0,0 +1,60 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +#include "graph.h" +/*#include "Crt.h"*/ + +const integer xm = 511; const integer ym = 184; +integer gd,gm; +word oh,om,/*os,*/h,m,s,s1; char r; + +void hand(word ang,word length, byte colour) +{ + arccoordstype a; +; + if (ang>900) return; + setcolor(colour); + arc(xm,ym,449-ang,450-ang,length); + getarccoords(a); + line(xm,ym,a.xend,a.yend); /* "With a do-line???!", Liz said */ +} + +void chime() +{ + integer gd,gm,fv; +; + if (oh>177) return; /* too high- must be first time around */ + fv=h / 30; if (fv==0) fv=12; + for( gd=1; gd <= fv; gd ++) + {; + for( gm=1; gm <= 3; gm ++) + {; + sound(140-gm*30); delay(50-gm*3); + } + nosound; if ((cardinal)gd!=oh) delay(100); + } +} + +void plothands() +{; + hand(oh,17,brown); + hand(h,17,yellow); + hand(om*6,20,brown); + hand(m*6,20,yellow); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + setfillstyle(1,6); bar(0,0,640,200); oh=17717; om=17717; + do { + gettime(h,m,s,s1); + h=(h % 12)*30+m / 2; + if (oh!=h) {; plothands(); chime(); } + if (om!=m) plothands(); + oh=h; om=m; + } while (!false); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp new file mode 100644 index 000000000000..b2af98740fc9 --- /dev/null +++ b/engines/avalanche/closing.cpp @@ -0,0 +1,119 @@ +#include "ptoc.h" + +/* + + + + + CLOSING The closing screen and error handler. */ + +#define __closing_implementation__ + + +#include "closing.h" + + +#include "gyro.h" +#include "Graph.h" +/*#include "Crt.h"*/ +#include "lucerna.h" + + +typedef array<1,3840,char> scrtype; + +scrtype q /*absolute $B8FA:0*/; /* Nobody's using the graphics memory now. */ +file f; +pointer exitsave; + +void get_screen(byte which) +{; + closegraph(); + textattr=0; clrscr; + assign(f,string("text")+strf(which)+".scr"); reset(f); f >> q; close(f); +} + +void show_screen() +{ + byte fv,ff,fq, tl,bl; + scrtype a /*absolute $B800:0*/; +; + for( fv=1; fv <= 40; fv ++) + {; + if (fv>36) {; tl=1; bl=24; } + else {; tl=12-fv / 3; bl=12+fv / 3; } + for( fq=tl; fq <= bl; fq ++) + for( ff=80-fv*2; ff <= 80+fv*2; ff ++) + a[fq*160-ff]=q[fq*160-ff]; + delay(5); + } + gotoxy(1,25); textattr=31; clreol; gotoxy(1,24); +} + +void quit_with(byte which,byte errorlev) +{; + dusk(); + get_screen(which); + show_screen(); /* No changes. */ + exit(errorlev); +} + +void put_in(string x, word where) +{ + word fv; +; + for( fv=1; fv <= length(x); fv ++) + q[1+(where+fv)*2]=x[fv]; +} + +void end_of_program() + +{ + const array<0,11,varying_string<11> > nouns = + {{"sackbut","harpsichord","camel","conscience","ice-cream","serf", + "abacus","castle","carrots","megaphone","manticore","drawbridge"}}; + + const array<0,11,varying_string<9> > verbs = + {{"haunt","daunt","tickle","gobble","erase","provoke","surprise", + "ignore","stare at","shriek at","frighten","quieten"}}; + + string result; +; + nosound; + get_screen(scr_nagscreen); + result=nouns[Random(12)]+" will "+verbs[Random(12)]+" you"; + put_in(result,1628); + show_screen(); /* No halt- it's already set up. */ +} + +/*$F+*/ + +void bug_handler() +{; + exitproc=exitsave; + + if (erroraddr!=nil) + {; /* An error occurred! */ + if (exitcode==203) + get_screen(scr_ramcram); + else + {; + get_screen(scr_bugalert); + put_in(strf(exitcode),678); /* 678 = [38,8]. */ + put_in(strf(seg(erroraddr))+':'+strf(ofs(erroraddr)),758); /* 758 = [38,9]. */ + } + show_screen(); + erroraddr=nil; + } +} + +/*$F-*/ + +class unit_closing_initialize { + public: unit_closing_initialize(); +}; +static unit_closing_initialize closing_constructor; + +unit_closing_initialize::unit_closing_initialize() {; + exitsave=exitproc; + exitproc=&bug_handler; +} diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h new file mode 100644 index 000000000000..97dd37e0c3fb --- /dev/null +++ b/engines/avalanche/closing.h @@ -0,0 +1,15 @@ +#ifndef __closing_h__ +#define __closing_h__ + + +const integer scr_bugalert = 1; +const integer scr_ramcram = 2; +const integer scr_nagscreen = 3; +const integer scr_twocopies = 5; + + +void quit_with(byte which,byte errorlev); + +void end_of_program(); + +#endif diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp new file mode 100644 index 000000000000..08639eecd730 --- /dev/null +++ b/engines/avalanche/convert.cpp @@ -0,0 +1,79 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; +string fn1,fn2; +varying_string<30> desc; + +void loadscreen(string nam) +{ + byte z; + array<1,4,pointer> a; + untyped_file f; word s; + string check; +; + assign(f,nam); + reset(f,1); + blockread(f,check,41); + blockread(f,check,13); + blockread(f,check,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(a[z],s); + blockread(f,a[z],s); + setactivepage(0); + putimage(0,15+(z-1)*75,a[z],0); + freemem(a[z],s); + } + close(f); +} + +void load2(string name) +{ + byte a /*absolute $A000:1200*/; + byte bit; + untyped_file f; +; + assign(f,name); reset(f,1); seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,12080); + } + close(f); +} + +void save2(string name) +{ + const string header = + string("This is a file from an Avvy game, and its contents are subject to ")+ + "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; + byte a /*absolute $A000:1200*/; + byte bit; + untyped_file f; +; + assign(f,name); rewrite(f,1); blockwrite(f,header[1],146); /* really 90 */ + blockwrite(f,desc,31); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,a,12080); + } + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + output << "Filename?"; input >> fn1 >> NL; + output << "New name?"; input >> fn2 >> NL; + output << "Describe?"; input >> desc >> NL; + gd=3; gm=0; initgraph(gd,gm,""); + loadscreen(fn1); + save2(fn2); + closegraph(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp new file mode 100644 index 000000000000..c607b11e22aa --- /dev/null +++ b/engines/avalanche/convmous.cpp @@ -0,0 +1,80 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Binu.h"*/ +/*#include "Crt.h"*/ + + + /* ...gogogoch */struct cursor { + matrix<0,1,0,15,word> mask; + integer horzhotspot,verthotspot; + }; +typedef /* ha ha */matrix<0,1,0,15,varying_string<16> > precursor; + +const array<0,3,byte> colours = {{darkgray,blue,white,green}}; + +cursor c_current; +boolean usepointer; +precursor cpc; +byte hhs,vhs; +string fn,desc; +integer gd,gm; + +void recalc() +{ + byte a,b; +; + {; + for( a=0; a <= 1; a ++) + for( b=0; b <= 15; b ++) + c_current.mask[a][b]=bintoword(cpc[a][b]); + c_current.horzhotspot=hhs; c_current.verthotspot=vhs; + } +} + +void load() +{ + text t; string x; byte a,b; +; + assign(t,fn); + reset(t); + do { t >> x >> NL; } while (!(x=='|')); /* bypass junk */ + t >> desc >> NL; + for( a=0; a <= 1; a ++) + for( b=0; b <= 15; b ++) + t >> cpc[a][b] >> NL; + t >> hhs >> NL; t >> vhs >> NL; + close(t); recalc(); +} + +void display() +{ + const integer o0 = ord('0'); const integer o1 = ord('1'); + byte x,y,p1,p2; +; + for( y=0; y <= 15; y ++) + {; + for( x=1; x <= 16; x ++) + {; + switch (ord(cpc[0][y][x])*2+ord(cpc[1][y][x])) { + case o0*2+o0: {; p1= 0; p2= 0; } break; /* p1= silhouette, p2= real */ + case o0*2+o1: {; p1= 0; p2=15; } break; + case o1*2+o0: {; p1=15; p2= 0; } break; + case o1*2+o1: {; p1= 9; p2= 9; } break; /* invalid- can't use this */ + } + putpixel(x-1,y,p1); putpixel(x+99,y,p2); + } + output << NL; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=1; initgraph(gd,gm,""); + fn="d:screwdri.inc"; + load(); + display(); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp new file mode 100644 index 000000000000..7669c85eaad1 --- /dev/null +++ b/engines/avalanche/credits.cpp @@ -0,0 +1,88 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +/*$R+*/ + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +integer gd,gm; +text t; +array<1,2,fonttype> f; +file ff; +array<1,80,byte> l; +varying_string<80> x; + +void do_one(byte z) +{ + byte a /*absolute $A000:0*/; + byte aa /*absolute $A000:80*/; + byte az /*absolute $A000:27921*/; +; + a=getpixel(0,0); + move(l,az,z); + + port[0x3c5]=8; port[0x3cf]=0; + move(aa,a,27920); +} + +void background() +{ + byte y; +; + for( y=1; y <= 15; y ++) + {; + setcolor(y); + outtextxy(17,y*12,"Jesus is Lord!"); + } +} + +void scroll(string z) +{ + byte x,y,lz; char c; +; + fillchar(l,80,'\0'); + if (z=="") + for( y=1; y <= 12; y ++) do_one(0); + c=z[1]; Delete(z,1,1); + lz=length(z); + switch (c) { + case '*': for( y=0; y <= 15; y ++) + {; + for( x=1; x <= lz; x ++) + l[x]=f[2][z[x]][y]; + do_one(lz); + } + break; + case '>': {; + lz += 7; + for( y=0; y <= 13; y ++) + {; + for( x=1; x <= lz; x ++) + l[x+7]=f[1][z[x]][y]; + do_one(lz); do_one(lz); /* double-height characters */ + } + } + break; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=1; initgraph(gd,gm,""); + port[0x3c4]=2; port[0x3cf]=4; + assign(ff,"avalot.fnt"); reset(ff); ff >> f[1]; close(ff); + assign(ff,"avitalic.fnt"); reset(ff); ff >> f[2]; close(ff); + assign(t,"credits.txt"); reset(t); + background(); + for( gd=8; gd <= 15; gd ++) setpalette(gd,62); + do { + t >> x >> NL; + scroll(x); + } while (!(eof(t) || keypressed())); + close(t); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp new file mode 100644 index 000000000000..3c706dc14deb --- /dev/null +++ b/engines/avalanche/displtxt.cpp @@ -0,0 +1,34 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const char fn[] = "text3.scr"; + +typedef array<1,3840,char> atype; + +file f; +word fv,ff,fq,st; +char r; +byte tl,bl; +atype q; +atype a /*absolute $B800:0*/; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=0; clrscr; + assign(f,fn); reset(f); f >> q; close(f); + for( fv=1; fv <= 40; fv ++) + {; + if (fv>36) {; tl=1; bl=24; } + else {; tl=12-fv / 3; bl=12+fv / 3; } + for( fq=tl; fq <= bl; fq ++) + for( ff=80-fv*2; ff <= 80+fv*2; ff ++) + a[fq*160-ff]=q[fq*160-ff]; + delay(5); + } + gotoxy(1,25); textattr=31; clreol; gotoxy(1,24); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp new file mode 100644 index 000000000000..6c03a4724d1e --- /dev/null +++ b/engines/avalanche/dropdown.cpp @@ -0,0 +1,802 @@ +#include "ptoc.h" + +/* + + + + + DROPDOWN A customised version of Oopmenu (qv). */ + +#define __dropdown_implementation__ + + +#include "dropdown.h" + + +/*#include "Crt.h"*/ +#include "graph.h" +/*#include "Dos.h"*/ +#include "lucerna.h" +#include "Gyro.h" +#include "acci.h" +#include "trip5.h" +#include "enid.h" +#include "basher.h" + +/*$V-*/ +const integer indent = 5; +const integer spacing = 10; + +/* menu_b = blue; { Morpheus } + menu_f = yellow; + menu_border = black; + highlight_b = lightblue; + highlight_f = yellow; + disabled = lightgray; */ + +const integer menu_b = lightgray; /* Windowsy */ +const integer menu_f = black; +const integer menu_border = black; +const integer highlight_b = black; +const integer highlight_f = white; +const integer disabled = darkgray; + +char r; +byte fv; + +void find_what_you_can_do_with_it() +{; + switch (thinks) { + case wine:case ink: verbstr=string(vb_exam)+vb_drink; break; + case bell: verbstr=string(vb_exam)+vb_ring; break; + case potion:case wine: verbstr=string(vb_exam)+vb_drink; break; + case chastity: verbstr=string(vb_exam)+vb_wear; break; + case lute: verbstr=string(vb_exam)+vb_play; break; + case mushroom:case onion: verbstr=string(vb_exam)+vb_eat; break; + case clothes: verbstr=string(vb_exam)+vb_wear; break; + default: verbstr=vb_exam; /* anything else */ + } +} + +void chalk(integer x,integer y, char t, string z, boolean valid) +{ + byte fv,ff,p,bit; + word pageseg; + byte ander; +; + + pageseg=0xa000+cp*0x400; + + if (valid) ander=255; else ander=170; + + for( fv=1; fv <= length(z); fv ++) + for( ff=0; ff <= 7; ff ++) + for( bit=0; bit <= 2; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + mem[pageseg*x+fv-1+(y+ff)*80]=~ (little[z[fv]][ff] & ander); + } + + for( ff=0; ff <= 8; ff ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << 3; port[0x3cf]=3; + fillchar(mem[pageseg*x+(y+ff)*80],length(z),'\0'); /* blank it out. */ + } + + p=pos(t,z); if (p==0) return; p -= 1; + + for( bit=0; bit <= 2; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + mem[pageseg*x+p+(y+8)*80]=~ ander; + } + + blitfix(); +} + +void hlchalk(integer x,integer y, char t, string z, boolean valid) + /* Highlighted. */ +{ + byte fv,ff,p; + word pageseg; + byte ander; +; + + pageseg=0xa000+cp*0x400; + + if (valid) ander=255; else ander=170; + + for( fv=1; fv <= length(z); fv ++) + for( ff=0; ff <= 7; ff ++) + mem[pageseg*x+fv-1+(y+ff)*80]=little[z[fv]][ff] & ander; + + p=pos(t,z); if (p==0) return; p -= 1; + + mem[pageseg*x+p+(y+8)*80]=ander; + blitfix(); +} + +/*procedure say(x,y:integer; t:char; z:string; f,b:byte); +begin; + settextjustify(0,2); setfillstyle(1,b); setcolor(f); + bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)); + chalk(x,y,t,z); +end;*/ + +void bleep() +{; + sound(177); delay(7); nosound; +} + +void onemenu::start_afresh() +{; + number=0; width=0; firstlix=false; oldy=0; highlightnum=0; +} + +onemenu* onemenu::init() +{; + menunow=false; ddmnow=false; menunum=1; + return this; +} + +void onemenu::opt(string n, char tr, string key, boolean val) +{ + integer l; +; + number += 1; + l=length(n+key)+3; if (width'' then outtextxy(flx2,4+y*10,shortcut);*/ + + data=with.title; + + while (length(data+with.shortcut)=(unsigned char)number)) return; + highlightnum=hn; + } + setactivepage(cp); off(); + displayopt(oldy+1,false); + displayopt(highlightnum+1,true); + setactivepage(1-cp); + oldy=highlightnum; on(); +} + +void onemenu::lightup() /* This makes the menu highlight follow the mouse.*/ +{; + if ((mx<(cardinal)flx1*8) || (mx>(cardinal)flx2*8) || (my<=12) || (my>(cardinal)fly-3)) return; + highlightnum=(my-13) / 10; + if (highlightnum==oldy) return; + movehighlight(0); +} + +void onemenu::select(byte n) /* Choose which one you want. */ +{; + if (! oo[n+1].valid) return; + choicenum=n; wipe(); + + if (choicenum==number) choicenum -= 1; /* Off the bottom. */ + if (choicenum>number) choicenum=0; /* Off the top, I suppose. */ + + ddm_m.ddms[menunum].do_choose(); +} + +void onemenu::keystroke(char c) +{ + byte fv; boolean found; +; + c=upcase(c); found=false; + for( fv=1; fv <= number; fv ++) + { optiontype& with = oo[fv]; + if ((upcase(with.trigger)==c) && with.valid) + {; + select(fv-1); + found=true; + }} + if (! found) blip(); +} + + headtype* headtype::init + (char trig,char alttrig, string name, byte p, proc dw,proc dc) + {; + trigger=trig; alttrigger=alttrig; title=name; + position=p; xpos=(position-1)*spacing+indent; + xright=position*spacing+indent; + do_setup=dw; do_choose=dc; + return this; + } + + void headtype::display() + {; + off(); /*MT*/ + chalk(xpos,1,trigger,title,true); + on(); /*MT*/ + } + + void headtype::highlight() + {; + off(); off_virtual(); nosound; + setactivepage(cp); + hlchalk(xpos,1,trigger,title,true); + {; + ddm_o.left=xpos; + ddm_o.menunow=true; ddmnow=true; ddm_o.menunum=position; + } + cmp=177; /* Force redraw of cursor. */ + } + + boolean headtype::extdparse(char c) + {boolean extdparse_result; + ; + if (c!=alttrigger) {; extdparse_result=true; return extdparse_result; } + extdparse_result=false; + return extdparse_result; + } + + menuset* menuset::init() + {; + howmany=0; + return this; + } + + void menuset::create(char t, string n, char alttrig, proc dw,proc dc) + {; + howmany += 1; + ddms[howmany].init(t,alttrig,n,howmany,dw,dc); + } + + void menuset::update() + { + const bytefield menuspace = {0, 0, 80, 9}; + byte fv,page_,savecp; + ; + setactivepage(3); + setfillstyle(1,menu_b); bar(0, 0,640, 9); + savecp=cp; cp=3; + + for( fv=1; fv <= howmany; fv ++) + ddms[fv].display(); + + for( page_=0; page_ <= 1; page_ ++) + getset[page_].remember(menuspace); + + cp=savecp; + } + + void menuset::extd(char c) + { + byte fv; + ; + fv=1; + while ((fv<=howmany) && (ddms[fv].extdparse(c))) fv += 1; + if (fv>howmany) return; getcertain(fv); + } + + void menuset::getcertain(byte fv) + {; + { headtype& with = ddms[fv]; + {; + if (ddm_o.menunow) + {; + wipe(); /* get rid of menu */ + if (ddm_o.menunum==with.position) return; /* clicked on own highlight */ + } + highlight(); do_setup(); + }} + } + + void menuset::getmenu(integer x) + { + byte fv; + ; + fv=0; + do { + fv += 1; + if ((x>ddms[fv].xpos*8) && (xhowmany)); + } + +void parsekey(char r,char re) +{; + switch (r) { + case '\0':case '\340': {; + switch (re) { + case 'K': if (ddm_o.menunum>1) {; + wipe(); + ddm_m.getcertain(ddm_o.menunum-1); + } else + {; /* Get menu on the left-hand side */ + wipe(); + ddm_m.getmenu((ddm_m.howmany-1)*spacing+indent); + } + break; + case 'M': if (ddm_o.menunum verb; char vbchar; boolean n; +; + {; + start_afresh(); + + if (thinkthing) + {; + + find_what_you_can_do_with_it(); + + for( fv=1; fv <= length(verbstr); fv ++) + {; + verbopt(verbstr[fv],verb,vbchar); + opt(verb,vbchar,"",true); + } + + /* We disable the "give" option if: (a), you haven't selected anybody, + (b), the person you've selected isn't in the room, + or (c), the person you've selected is YOU! */ + + if ((set::of(nowt,pavalot, eos).has(last_person)) || + (whereis[last_person]!=dna.room)) + opt("Give to...",'G',"",false); /* Not here. */ else + {; + opt(string("Give to ")+getname(last_person),'G',"",true); + verbstr=verbstr+vb_give; + } + + } else + {; + opt("Examine",'x',"",true); + opt(string("Talk to h")+himher(thinks),'T',"",true); + verbstr=string(vb_exam)+vb_talk; + switch (thinks) { + + case pgeida:case parkata: + {; + opt("Kiss her",'K',"",true); + verbstr=verbstr+vb_kiss; + } + break; + + case pdogfood: + {; + opt("Play his game",'P',"",! dna.wonnim); /* True if you HAVEN'T won. */ + verbstr=verbstr+vb_play; + } + break; + + case pmalagauche: + {; + n=! dna.teetotal; + opt("Buy some wine",'w',"",! dna.obj[wine]); + opt("Buy some beer",'b',"",n); + opt("Buy some whisky",'h',"",n); opt("Buy some cider",'c',"",n); + opt("Buy some mead",'m',"",n); + verbstr=verbstr+'\145'+'\144'+'\146'+'\147'+'\150'; + } + break; + + case ptrader: + {; + opt("Buy an onion",'o',"",! dna.obj[onion]); + verbstr=verbstr+'\151'; + } + break; + + } + } + display(); + } +} + +/*procedure ddm__map; +begin; + with ddm_o do + begin; + start_afresh; + opt('Cancel map','G','f5',true); + opt('Pause game','P','f6',true); + opt('Journey thither','J','f7',neardoor); + opt('Explanation','L','f8',true); + display; + end; +end; + +procedure ddm__town; +begin; + with ddm_o do + begin; + start_afresh; + opt('Argent','A','',true); + opt('Birmingham','B','',true); + opt('Nottingham','N','',true); + opt('Cardiff','C','',true); + display; + end; +end;*/ + +void do__game() +{; + switch (ddm_o.choicenum) { + /* Help, boss, untrash screen. */ + case 0: callverb(vb_help); break; + case 1: callverb(vb_boss); break; + case 2: major_redraw(); break; + case 3: callverb(vb_score); break; + case 4: callverb(vb_info); break; + } +} + +void do__file() +{; + switch (ddm_o.choicenum) { + /* New game, load, save, save as, DOS shell, about, quit. */ + case 0: callverb(vb_restart); break; + case 1: {; realwords[2]=""; callverb(vb_load); } break; + case 2: {; realwords[2]=""; callverb(vb_save); } break; + case 3: filename_edit(); break; + case 4: back_to_bootstrap(2); break; + case 5: callverb(vb_quit); break; + } +} + +void do__action() +{ + string n; +; + switch (ddm_o.choicenum) { + /* Get up/pause game/open door/look/inv/walk-run */ + case 0: { + person=pardon; thing=pardon; + n=f5_does(); callverb(n[1]); + } + break; + case 1: callverb(vb_pause); break; + case 2: callverb(vb_open); break; + case 3: callverb(vb_look); break; + case 4: callverb(vb_inv); break; + case 5: { + if (tr[1].xs==walk) tr[1].xs=run; + else tr[1].xs=walk; + newspeed(); + } + break; + } +} + +void do__objects() +{; + thinkabout(objlist[ddm_o.choicenum+1],a_thing); +} + +void do__people() +{; + thinkabout(people[ddm_o.choicenum+1],a_person); + last_person=people[ddm_o.choicenum+1]; +} + +void do__with() +{; + thing=thinks; + + if (thinkthing) + {; + + thing += 49; + + if (verbstr[ddm_o.choicenum+1]==vb_give) + person=last_person; + else + person='\376'; + + } else + {; + switch (verbstr[ddm_o.choicenum+1]) { + case '\144': {; thing='\144'; callverb(vb_buy); return; } break; /* Beer */ + case '\145': {; thing= '\62'; callverb(vb_buy); return; } break; /* Wine */ + case '\146': {; thing='\146'; callverb(vb_buy); return; } break; /* Whisky */ + case '\147': {; thing='\147'; callverb(vb_buy); return; } break; /* Cider */ + case '\150': {; thing='\153'; callverb(vb_buy); return; } break; /* Mead */ + case '\151': {; thing= '\103'; callverb(vb_buy); return; } break; /* Onion (trader) */ + default: + {; + person=thing; + thing='\376'; + } + } + } + callverb(verbstr[ddm_o.choicenum+1]); +} + +/*$F- That's all. Now for the ...bar procs. */ + +void standard_bar() /* Standard menu bar */ +{; + ddm_m.init(); ddm_o.init(); + {; /* Set up menus */ + create('F',"File",'!',ddm__file,do__file); /* same ones in map_bar, below, */ + create('G',"Game",'\42',ddm__game,do__game); /* Don't forget to change the */ + create('A',"Action",'\36',ddm__action,do__action); /* if you change them */ + create('O',"Objects",'\30',ddm__objects,do__objects); /* here... */ + create('P',"People",'\31',ddm__people,do__people); + create('W',"With",'\21',ddm__with,do__with); + update(); + } +} + +/*procedure map_bar; { Special menu bar for the map (screen 99) } +begin; + ddm_m.init; ddm_o.init; + with ddm_m do + begin; { Set up menus } + create('G','Game','#',ddm__game,do__game); + create('F','File','!',ddm__file,do__test); + create('M','Map','2',ddm__map,do__test); + create('T','Town',#20,ddm__town,do__test); + update; + end; +end;*/ + +void checkclick() /* only for when the menu's displayed */ +{; + if (mpress>0) + {; + if (mpy>10) + {; + if (! ((ddm_o.firstlix) && + ((mpx>=(cardinal)ddm_o.flx1*8) && (mpx<=(cardinal)ddm_o.flx2*8) && + (mpy>=12) && (mpy<=(cardinal)ddm_o.fly)))) + {; /* Clicked OUTSIDE the menu. */ + if (ddm_o.menunow) wipe(); + } /* No "else"- clicking on menu has no effect (only releasing) */ + } else + {; /* Clicked on menu bar */ + ddm_m.getmenu(mpx); + } + } else + {; /* NOT clicked button... */ + if (mrelease>0) + {; + if ((ddm_o.firstlix) && + ((mrx>=(cardinal)ddm_o.flx1*8) && (mrx<=(cardinal)ddm_o.flx2*8) && + (mry>=12) && (mry<=(cardinal)ddm_o.fly))) + select((mry-13) / 10); + } + } +} + +void menu_link() +{; + {; + if (! ddm_o.menunow) return; + + check(); /* find mouse coords & click information */ + checkclick(); /* work out click codes */ + + /* Change arrow... */ + + switch (my) { + case RANGE_11(0, 10): newpointer(1); + break; /* up-arrow */ + case 11 ... 169: {; + if ((mx>=(cardinal)ddm_o.flx1*8) && (mx<=(cardinal)ddm_o.flx2*8) && (my>10) && (my<=(cardinal)ddm_o.fly)) + newpointer(3); /* right-arrow */ + else newpointer(4); /* fletch */ + } + break; + case RANGE_32(169,200): newpointer(2); + break; /* screwdriver */ + } + + if (! ddm_o.menunow) return; + + lightup(); + } +} + + diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h new file mode 100644 index 000000000000..9d32fb970594 --- /dev/null +++ b/engines/avalanche/dropdown.h @@ -0,0 +1,94 @@ +#ifndef __dropdown_h__ +#define __dropdown_h__ + + +typedef void(*proc)(); + +class headtype { +public: + varying_string<8> title; + char trigger,alttrigger; + byte position; + integer xpos,xright; + proc do_setup,do_choose; + + headtype* init + (char trig,char alttrig, string name, byte p, proc dw,proc dc); + void display(); + void highlight(); + boolean extdparse(char c); +}; + +struct optiontype { + string title; + char trigger; + varying_string<9> shortcut; + boolean valid; +}; + +class onemenu { +public: + array<1,12,optiontype> oo; + byte number; + integer width,left; + boolean firstlix; + integer flx1,flx2,fly; + byte oldy; /* used by Lightup */ + boolean menunow; /* Is there a menu now? */ + byte menunum; /* And if so, which is it? */ + byte choicenum; /* Your choice? */ + byte highlightnum; + + void start_afresh(); + void opt(string n, char tr, string key, boolean val); + void display(); + void wipe(); + void lightup(); + void displayopt(byte y, boolean highlit); + void movehighlight(shortint add); + void select(byte n); + void keystroke(char c); + onemenu* init(); +}; + +class menuset { +public: + array<1,8,headtype> ddms; + byte howmany; + + menuset* init(); + void create(char t, string n, char alttrig, proc dw,proc dc); + void update(); + void extd(char c); + void getcertain(byte fv); + void getmenu(integer x); +}; + + + +#ifdef __dropdown_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN onemenu ddm_o; +EXTERN menuset ddm_m; + +EXTERN varying_string<5> people; +#undef EXTERN +#define EXTERN extern + + + + void find_what_you_can_do_with_it(); + + void parsekey(char r,char re); + + void menu_link(); + + /* DDM menu-bar procs */ + + void standard_bar(); + /*procedure map_bar;*/ + +#endif diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp new file mode 100644 index 000000000000..f66a41761023 --- /dev/null +++ b/engines/avalanche/dwidth.cpp @@ -0,0 +1,20 @@ +#include "ptoc.h" + + +#include "graph.h" + + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +integer gd,gm; +fonttype f; +file ff; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(ff,"v:avalot.fnt"); reset(ff); ff >> f; close(ff); + gd=3; gm=0; initgraph(gd,gm,""); + for( gd=0; gd <= 15; gd ++) mem[0xa000*gd*80]=f['A'][gd]; +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp new file mode 100644 index 000000000000..9fcb68583b7a --- /dev/null +++ b/engines/avalanche/edhead.cpp @@ -0,0 +1,86 @@ +#include "ptoc.h" + + + +const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; +const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; + +struct edhead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS. See below for others.) */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + /* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ + +untyped_file f; +byte fv; +array<1,255,word> dna256; +boolean ok; +edhead e; + +void info(string x) /* info on .ASG files */ +{ + varying_string<40> describe; +; + assign(f,x); + /*$I-*/ reset(f,1); + seek(f,47); + blockread(f,describe,40); + blockread(f,dna256,sizeof(dna256)); + close(f); /*$I+*/ + e.revision=1; + game="Denarius Avaricius Sextus"; + shortname="Avaricius"; + number=1; + verstr="[?]"; + filename="AVVY.EXE"; + os=1; + fn=x; + d=dna256[7]; m=dna256[8]; y=dna256[9]; + desc=describe; + len=512; + saves=dna256[6]; + /*money:string[20]; { ditto in string form (eg 5/-, or 1 denarius)*/ + /*points:word; { your score */ +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + info("tt.asg"); + + output << "Filename: " << x << NL; + output << "Description: " << desc << NL; + output << "Cash: " << dna256[30] << NL; + output << "Score: " << dna256[36] << NL; + output << "Date: " << dna256[7] << ' ' << copy(months,dna256[8]*3-2,3) << ' ' << dna256[9] << NL; + output << "Number of saves: " << dna256[6] << NL; +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp new file mode 100644 index 000000000000..74352fe9f72e --- /dev/null +++ b/engines/avalanche/edna.cpp @@ -0,0 +1,337 @@ +#include "ptoc.h" + +/*$M 10000,0,1000*/ /*$V-*/ + +/*#include "Dos.h"*/ +/*#include "Tommys.h"*/ + + +struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST + 7 = Archimedes */ + +typedef array<1,4,char> fourtype; + +struct avaricius_dna { + varying_string<39> desc; + array<1,256,integer> dna; +}; + +const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; +const fourtype avaricius_file = "Avvy"; + +string filename; +boolean quiet,info; +ednahead eh; + +boolean avaricius; +fourtype id4; +avaricius_dna av_eh; +varying_string<4> av_ver; + +boolean ok; + +string first_dir; + +void explain() +{ + output << "EDNA Bucket v1.0 (c) 1993 Thomas Thurman." << NL; + output << " To load Avvy files." << NL; + output << NL; + output << "Associate .ASG files with EDNA.EXE to load them directly." << NL; + output << NL; + output << "Switches:" << NL; + output << " /q (quiet) will stop EDNA from printing text to the screen." << NL; + output << " /i (info) will print info about the file, but won't load it." << NL; + output << NL; + exit(1); +} + +void fix_filename() +{ + string p,n,groi; + + fsplit(filename,p,n,groi); + filename=p+n+".ASG"; +} + +void error(string x) +{ + output << "EDNA : " << x << NL; + exit(255); +} + +void paramparse() +{ + byte fv; + string x; + + if (paramcount==0) explain(); + + filename=""; + quiet=false; info=false; + + for( fv=1; fv <= paramcount; fv ++) + { + x=paramstr(fv); + + if ((x[1]=='/') || (x[1]=='-')) + switch (upcase(x[2])) { /* Parse switches */ + case 'Q': quiet=! quiet; break; + case 'I': info=! info; break; + default: error(string("Unknown switch! (")+x[2]+')'); + } + else + if (filename=="") filename=x; + else error("Please, only one filename at a time!"); + } + + if (quiet && info) error("How can you give info quietly??"); + + if (filename=="") error("No filename given! Use EDNA alone for help."); + + fix_filename(); +} + +void getfile() +{ + untyped_file f; + + assign(f,filename); + /*$I-*/ + reset(f,1); + /*$I+*/ + if (ioresult!=0) error(string("Can't read file \"")+filename+"\"."); + + seek(f,11); blockread(f,id4,4); + avaricius=id4==avaricius_file; + + if (avaricius) + { + seek(f,47); + blockread(f,av_eh,sizeof(av_eh)); + av_ver[0]='\4'; seek(f,31); blockread(f,av_ver[1],4); + } else + { + seek(f,177); + blockread(f,eh,sizeof(eh)); + } + + close(f); +} + +string plural(byte x) +{ + string plural_result; + if (x==1) plural_result=""; else plural_result='s'; + return plural_result; +} + +void show_info() +{ + string _game,_shortname,_verstr,_filename,_os,_fn,_desc,_money; + integer _revision,_number,_d,_m,_y,_saves,_points; + boolean readable,understandable; + + output << "Info on file " << filename << ':' << NL; + output << NL; + if (avaricius) + { /* DNA-256 file. */ + _verstr=av_ver; + _game="Denarius Avaricius Sextus"; _shortname="Avaricius"; + _filename="AVVY.EXE"; _os="DOS"; _desc=av_eh.desc; + _revision=1; _number=1; _fn="(as above)"; + + _money=strf(av_eh.dna[30])+" denari"; + if (av_eh.dna[30]==1) _money=_money+"us"; else _money=_money+'i'; + _d=av_eh.dna[7]; _m=av_eh.dna[8]; _y=av_eh.dna[9]; + _saves=av_eh.dna[6]; _points=av_eh.dna[36]; + + readable=true; understandable=true; + } else + { + if (eh.id==ednaid) + { /* EDNA file. */ + _game=eh.game; + _shortname=eh.shortname; + _verstr=eh.verstr; + _filename=eh.filename; + _os=eh.os; _fn=eh.fn; _desc=eh.desc; + _money=eh.money; _revision=eh.revision; + _number=eh.number; _d=eh.d; _m=eh.m; _y=eh.y; + _saves=eh.saves; _points=eh.points; + + readable=true; understandable=eh.revision==2; + } else + { + output << "Unknown format." << NL; + readable=false; + } + } + + if (_desc=="") _desc=""; + + if (readable) + { + output << "Signature is valid." << NL; + output << "Revision of .ASG format: " << _revision << NL; + output << NL; + if (understandable) + { + output << "The file was saved by " << _game << '.' << NL; + output << "Game number " << _number << " (" << _shortname << "), version " << + _verstr << ", filename " << _filename << '.' << NL; + output << "Saved under " << _os << '.' << NL; + output << NL; + output << "This is " << _fn << ".ASG, saved on " << _d << '/' << _m << '/' << _y << " (d/m/y)." << NL; + output << "Description: " << _desc << NL; + output << "It has been saved " << _saves << " time" << plural(_saves) << + ". You have " << _points << " point" << plural(_points) << ',' << NL; + output << "and " << _money << " in cash." << NL; + } else output << "Nothing else can be discovered." << NL; + } + + exit(2); +} + +void load_file() +{ + string progname,gamename,shortname,listname,exname,prog_dir; + + string localdir,groi; + + string x,y; + + text t; + + integer i,ii; + + gamename=fexpand(filename); + fsplit(fexpand(paramstr(0)),localdir,groi,groi); + listname=localdir+"EDNA.DAT"; + + if (avaricius) + { shortname="Avaricius"; exname="AVVY"; } + else { shortname=eh.shortname; fsplit(eh.filename,groi,exname,groi); } + + assign(t,listname); + /*$I-*/ + reset(t); + /*$I+*/ + progname=""; + if (ioresult==0) + { + do { + t >> x >> NL; t >> y >> NL; + if (x==shortname) + { + progname=y; + flush(); + } + } while (!(eof(t))); + } + + if (progname=="") + { /* No entry in EDNA.DAT */ + output << "This file was saved by " << shortname << '.' << NL; + output << "However, no entry was found in EDNA.DAT for that game." << NL; + output << NL; + output << "Please give the full path to that game, or press Enter to cancel." << NL; + output << string("(Example: C:\\")+exname+'\\'+exname+".EXE)" << NL; + output << NL; + input >> progname >> NL; + if (progname=="") exit(254); /* Quick exit! */ + + /*$I-*/ + append(t); + if (ioresult!=0) rewrite(t); + + t << shortname << NL; + t << progname << NL; + + if (ioresult!=0) + { + output << "Strange... could not write to EDNA.DAT. (Disk read-only or full?)" << NL; + output << "The path will be used this time only." << NL; + output << "Press Enter..."; input >> NL; + } + close(t); + /*$I+*/ + } + + if (! quiet) output << "Running " << shortname << ": " << progname << "..." << NL; + + fsplit(fexpand(progname),prog_dir,groi,groi); + if (prog_dir[length(prog_dir)]=='\\') prog_dir[0] -= 1; + + /*$I-*/ + chdir(prog_dir); i=ioresult; + swapvectors; + exec(progname,gamename); ii=ioresult; + swapvectors; + chdir(first_dir); + /*$I+*/ + + if ((i!=0) || (ii!=0)) + { + output << "WARNING: DOS reported an error. This probably means that the entry" << NL; + output << "for this game in " << listname << " is wrong." << NL; + output << NL; + output << "Please edit this file, using" << NL; + output << NL; + if (lo(dosversion)<0x5) + output << " edlin " << listname << " (or similar)" << NL; + else + output << " edit " << listname << NL; + output << NL; + output << "and change the line after \"" << shortname << "\" to show the correct path." << NL; + output << NL; + output << "More info is in the Avvy documentation. Good luck!" << NL; + output << NL; + output << "Press Enter..."; input >> NL; + } +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + getdir(0,first_dir); + paramparse(); + getfile(); + if (info) show_info(); + load_file(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp new file mode 100644 index 000000000000..299aec29143a --- /dev/null +++ b/engines/avalanche/enhanced.cpp @@ -0,0 +1,86 @@ +#include "ptoc.h" + +#define __enhanced_implementation__ + + +/* This is the unit set up by Thomas with help from all the people on + CIS:BPROGA to read the *enhanced* keyboard codes (as opposed to the + readkey-type ones.) */ + +#include "enhanced.h" + + +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ + + +boolean isenh() +{ + byte statefrom16; + registers r; + + boolean isenh_result; + isenh_result = false; + {; + ah=0x12; + intr(0x16,r); + statefrom16=al; + } + if (statefrom16 != shiftstate) return isenh_result; + shiftstate = shiftstate ^ 0x20; + {; + ah=0x12; + intr(0x16,r); + statefrom16=al; + } + isenh_result = statefrom16 == shiftstate; + shiftstate = shiftstate ^ 0x20; + return isenh_result; +} + +void readkeye() +/* function fancystuff:word; + inline( $B4/ $10/ { MOV AH,10 } + $CD/ $16); { INT 16 } + function notfancystuff:word; + inline( $B4/ $00/ { MOV AH,0 } + $CD/ $16); { INT 16 } +*/ +{ + registers r; word fs; +; + if (atbios) + fs=fancystuff; /* We're using an AT */ + else fs=notfancystuff; /* ditto, an XT */ + inchar=chr(lo(fs)); + extd=chr(hi(fs)); +} + +boolean keypressede() +/* + function fancystuff:boolean; + inline( $B4/ $11/ { MOV AH,11 } + $CD/ $16/ { INT 16 } + $B8/ $00/ $00/ { MOV AX, 0000 } + $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } + $40); { INC AX } +*/ +{ + registers r; +boolean keypressede_result; +; + if (atbios) + keypressede_result=fancystuff; /* ATs get the fancy stuff */ + else keypressede_result=keypressed(); /* XTs get the usual primitive... */ +return keypressede_result; +} + +class unit_enhanced_initialize { + public: unit_enhanced_initialize(); +}; +static unit_enhanced_initialize enhanced_constructor; + +unit_enhanced_initialize::unit_enhanced_initialize() {; + /* determine bios type */ + atbios=isenh(); +} diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h new file mode 100644 index 000000000000..a028648ced09 --- /dev/null +++ b/engines/avalanche/enhanced.h @@ -0,0 +1,22 @@ +#ifndef __enhanced_h__ +#define __enhanced_h__ + + + +#ifdef __enhanced_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN byte shiftstate;/*ABSOLUTE $40:$17;*/ +EXTERN boolean atbios; +EXTERN char inchar,extd; +#undef EXTERN +#define EXTERN extern + + +void readkeye(); + +boolean keypressede(); + +#endif diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp new file mode 100644 index 000000000000..89e1327191cf --- /dev/null +++ b/engines/avalanche/enid.cpp @@ -0,0 +1,581 @@ +#include "ptoc.h" + +/* + + + + + ENID Edna's manager. */ + +#define __enid_implementation__ + /* Loads/ saves files. */ + +/*$V-*/ + +#include "enid.h" + + +/*#include "Dos.h"*/ +#include "scrolls.h" +#include "lucerna.h" +#include "trip5.h" +#include "timeout.h" +#include "Celer.h" +#include "sequence.h" +#include "fileunit.h" +#include "basher.h" + + +const string crlf = string('\15')+'\12'; +const char tab = '\11'; +const char eof_ = '\32'; + +const array<1,177,char> ednafirst = + string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!")+ /*64*/ + crlf+eof_+crlf+crlf+ /*7*/ + tab+"Glory to God in the highest,"+crlf+ /*31*/ + tab+"and on earth peace, goodwill toward men."+ /*42*/ + crlf+tab+tab+tab+tab+ /*6*/ + "Luke 2:14."+ /*10*/ + crlf+crlf+crlf+ /* 6 */ + "1234567890"+crlf; /*11*/ + +const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; + +const integer ttage = 18; +const array<1,16,char> ttwashere = "Thomas was here "; + +boolean bug; + +string expanddate(byte d,byte m, word y); + +const array<1,12,varying_string<7> > months = +{{"Jan#","Febr#","March","April","May","June","July","August", +"Septem*","Octo*","Novem*","Decem*"}}; + + +static varying_string<10> month; + + +static void addon(string x) { month[0] -= 1; month=month+x; } + +string expanddate(byte d,byte m, word y) +{ + varying_string<4> day; + + + string expanddate_result; + month=months[m]; + switch (month[length(month)]) { + case '#': addon("uary"); break; + case '*': addon("ber"); break; + } + + day=strf(d); + + if (set::of(range(1,9),range(21,31), eos).has(d)) + switch (d % 10) { + case 1: day=day+"st"; break; + case 2: day=day+"nd"; break; + case 3: day=day+"rd"; break; + default: day=day+"th"; + } + + expanddate_result=day+' '+month+' '+strf(y); + return expanddate_result; +} + +void edna_save(string name); + + +static void show_bug(char icon, string strn) +{ display(string("\7\6\23")+icon+"\26\r"+strn+'\15'); } + + + +static boolean test_bug(byte what) +{ + boolean test_bug_result; + if (what==0) { test_bug_result=false; return test_bug_result; } + switch (what) { + case 2: show_bug('7',"Error in filename!"); break; + case 101: show_bug('6',"Disk full!"); break; + case 150: show_bug('4',"Disk is write-protected!"); break; + default: show_bug('B',"Saving error!"); + } + test_bug_result=true; + return test_bug_result; +} + +void edna_save(string name) +{ + untyped_file f; + ednahead eh; + word groi; + string groi2,path; + word tempd,tempm; + + if (name=="") + { /* We were given no name. Do we have a default? */ + if (enid_filename=="") + { /* No */ + filename_edit(); /* Request one. */ + return; + } else /* Yes */ + name=enid_filename; + } + + wait(); /* Put up hourglass pointer */ + + fillchar(eh,sizeof(eh),'\261'); /* Fill up the edhead */ + + dna.saves += 1; /* It's been saved one more time... */ + + { + + /* Info about this program */ + + eh.id=ednaid; /* Edna's signature */ + eh.revision=thisgamecode; /* 2- second revision of .ASG format */ + eh.game="Lord Avalot d'Argent"; /* Title of game */ + eh.shortname="Avalot"; + eh.number=2; /* Second Avvy game */ + eh.ver=thisvercode; /* Version 1.00 */ + eh.verstr=vernum; /* ditto */ + eh.filename="AVALOT.EXE"; /* program's filename */ + eh.osbyte=1; /* Saved under DOS */ + eh.os="DOS"; + + /* Info on this particular game */ + + fsplit(name,path,eh.fn,groi2); /* fn = filename of this game */ + getdate(eh.y,tempm,tempd,groi); /* Day, month & year when the game was saved */ + eh.d=tempd; eh.m=tempm; + eh.desc=roomname; /* Description of game (same as in Avaricius!) */ + eh.len=sizeof(dna); /* Length of DNA. */ + + /* Quick reference & miscellaneous */ + + eh.saves=dna.saves; /* no. of times this game has been saved */ + eh.cash=dna.pence; /* contents of your wallet in numerical form */ + eh.money=lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ + eh.points=dna.score; /* your score */ + + name=path+eh.fn+".ASG"; + } + + assign(f,name); + /*$I-*/ + rewrite(f,1); + if (test_bug(ioresult)) return; + + blockwrite(f,ednafirst,177); if (test_bug(ioresult)) return; + blockwrite(f,eh,sizeof(eh)); if (test_bug(ioresult)) return; + blockwrite(f,dna,sizeof(dna)); if (test_bug(ioresult)) return; + + for( groi=1; groi <= numtr; groi ++) + { triptype& with = tr[groi]; + if (with.quick) + { + blockwrite(f,groi,1); if (test_bug(ioresult)) return; + savedata(f); if (test_bug(ioresult)) return; + }} + + groi=177; blockwrite(f,groi,1); + + blockwrite(f,times,sizeof(times)); /* Timeout.times: Timers. */ + + if (test_bug(ioresult)) return; + + blockwrite(f,seq,sizeof(seq)); /* Sequencer information. */ + + if (test_bug(ioresult)) return; + + for( groi=1; groi <= ttage; groi ++) + blockwrite(f,ttwashere[1-1],16); + + if (test_bug(ioresult)) return; + + close(f); + if (test_bug(ioresult)) return; + /*$I+*/ + + display(string('\6')+"Saved: "+'\22'+name+'.'); + enid_filename=name; +} + +void loaderror(string x, char icon) +{ + if (holdthedawn) + { + holdthedawn=false; + dawn(); + } + display(string('\7')+'\6'+'\23'+icon+'\26'+"Loading error: "+"\r\r\22"+x); + bug=true; +} + + + +typedef array<1,4,char> fourtype; + + + +const fourtype avaricius_file = "Avvy"; + +void edna_load(string name) + +{ + untyped_file f; + ednahead eh; + byte fv; + byte io; + string path,fn,groi; + fourtype id4; + + word len2load; + + + + if (name=="") + { /* No filename specified, so let's call the filer. */ + name=do_filer(); + if (name=="") return; /* STILL no filename, so they must have cancelled. */ + } + + bug=false; + + wait(); /* Put up hourglass pointer */ + + fsplit(name,path,fn,groi); + name=path+fn+".ASG"; + + /* Load the file into memory */ + + /*$I-*/ + assign(f,name); + reset(f,1); + + io=ioresult; + if (io!=0) + switch (io) { + case 2: loaderror("File not found!",'8'); break; + case 3: loaderror("Directory not found!",'3'); break; + default: loaderror(string("Error no.")+strf(io),'1'); + } + + if (bug) return; + + seek(f,11); blockread(f,id4,4); + if (id4==avaricius_file) + { + loaderror("That's an Avaricius file!",'1'); + close(f); + return; + } + + seek(f,177); /* bypass ednafirst */ + + blockread(f,eh,sizeof(eh)); /* load ednahead */ + + /* Check ednahead for errors */ + + { + if ((eh.id!=ednaid) || (eh.revision!=2)) loaderror("Not an EDNA file!",'7'); else + if (eh.number!=2) loaderror(string("That file was saved by ")+eh.shortname+'!','1'); + } + + if (bug) + { + close(f); + return; + } + + len2load=eh.len; + + if (eh.len!=(cardinal)sizeof(dna)) + { + if (holdthedawn) + { + holdthedawn=false; + dawn(); + } + display("\233\26Warning: \3\rEDNA size doesn't match.\f"); + if (eh.len>(cardinal)sizeof(dna)) + len2load=sizeof(dna); /* BIGGER than ours */ + else fillchar(dna,sizeof(dna),'\0'); /* Otherwise, smaller. */ + } + + blockread(f,dna,len2load); + + for( fv=1; fv <= numtr; fv ++) + { triptype& with = tr[fv]; + if (with.quick) done();} /* Deallocate sprite */ + + do { + blockread(f,fv,1); + if (fv!=177) tr[fv].loaddata(f); + } while (!(fv==177)); + + blockread(f,times,sizeof(times)); /* Timeout.times: Timers. */ + + blockread(f,seq,sizeof(seq)); /* Sequencer information. */ + + close(f); + + seescroll=true; /* This prevents display of the new sprites before the + new picture is loaded. */ + + if (holdthedawn) + { + holdthedawn=false; + dawn(); + } + + display(string('\6')+"Loaded: "+'\22'+name+'\3'+"\r\r"+eh.desc+"\r\r"+"saved on "+ + expanddate(eh.d,eh.m,eh.y)+'.'); + + forget_chunks(); + + minor_redraw(); + + whereis[pavalot]=dna.room; +/* showscore;*/ + alive=true; + + objectlist(); +/*$I+*/ + + enid_filename=name; +} + +void dir(string where); + +static string path,groi; + + +static void showheader() +{ + display(string("Dir: ")+path+"\r\r\4"); +} + +void dir(string where) + /* OK, it worked in Avaricius, let's do it in Avalot! */ +{ + searchrec s; + byte count; + + if ((where!="") && (!(set::of('\\',':', eos).has(where[length(where)])))) + where=where+'\\'; + fsplit(where,path,groi,groi); + path=path+"*.asg"; + count=0; + + findfirst(path,anyfile,s); + showheader(); + + while (doserror==0) + { + count += 1; + if (count==11) + { + display("\r\nPress Enter..."); + showheader(); + count=1; + } + + display(s.name+"\r\4"); + + findnext(s); + } + + if (count==0) + display("No files found!"); + else display("\nThat's all!"); + +} + +void avvy_background() /* Not really a filing procedure, + but it's only called just before edna_load, so I thought I'd put it + in Enid instead of, say, Lucerna. */ +{ +/* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ +/* + asm + mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } + mov dx,$3ce; mov al,4; out dx,al; { register. } + mov dx,$3c5; mov al,1; out dx,al; + mov dx,$3cf; out dx,al; + + mov bx,$A000; call far ptr @drawup; + mov bx,$A400; call far ptr @drawup; + + jmp @the_end; + + @drawup: + + mov es,bx; { The segment to copy it to... } + mov di,$370; { The offset (10 pixels down, plus 1 offset.) } + + mov cx,10; + mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } + mov ax,$AEAA; call far ptr @sameline; + mov ax,$A4EA; call far ptr @sameline; + mov ax,$44A4; call far ptr @sameline; + + mov cx,9; + mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } + mov ax,$AAEA; call far ptr @sameline; + mov ax,$AA4E; call far ptr @sameline; + mov ax,$444A; call far ptr @sameline; + + mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } + mov ax,$AAAE; call far ptr @sameline; + mov ax,$EAA4; call far ptr @sameline; + mov ax,$A444; call far ptr @sameline; + + mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } + mov ax,$EAAA; call far ptr @sameline; + mov ax,$4EAA; call far ptr @sameline; + mov ax,$4A44; call far ptr @sameline; + + ret; + + + { Replicate the same line many times. } + + @sameline: + { Requires: + what to copy in AX, + how many lines in CX, and + original offset in DI. } + push cx; + push di; + + @samelineloop: + + push cx; + mov cx,40; { No. of times to repeat it on one line. } + + repz stosw; { Fast word-copying } + + pop cx; + + add di,1200; { The next one will be 16 lines down. } + + loop @samelineloop; + pop di; + add di,80; + pop cx; + + ret; + + @the_end: + end; +*/ +blitfix(); +} + +void to_sundry(sundry& sund) +{ + { + sund.qenid_filename=enid_filename; + sund.qsoundfx=soundfx; + sund.qthinks=thinks; + sund.qthinkthing=thinkthing; + } +} + +void from_sundry(sundry sund) +{ + { + enid_filename=sund.qenid_filename; + soundfx=sund.qsoundfx; + thinks=sund.qthinks; + thinkthing=sund.qthinkthing; + } +} + +void restore_dna() +{ + word here,fv; + sundry sund; + + move(mem[storage_seg*storage_ofs+3],dna,sizeof(dna)); + move(mem[storage_seg*storage_ofs+3+sizeof(dna)],times,sizeof(times)); + move(mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)], + seq,sizeof(seq)); + move(mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)], + sund,sizeof(sund)); + from_sundry(sund); + + here=storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)+sizeof(sund); + do { + fv=mem[storage_seg*here]; here += 1; + if (fv!=177) tr[fv].load_data_from_mem(here); + } while (!(fv==177)); +} + +void edna_reload() +{ + + restore_dna(); + + seescroll=true; /* This prevents display of the new sprites before the + new picture is loaded. */ + + major_redraw(); + + whereis[pavalot]=dna.room; + + alive=true; + + objectlist(); + + if (holdthedawn) + { + holdthedawn=false; + dawn(); + } +} + +void back_to_bootstrap(byte what) +{ + byte fv; + word here; + sundry sund; + + mem[storage_seg*storage_ofs]=what; /* Save the operation code. */ + to_sundry(sund); /* Save the sundry information. */ + + /* Save the DNA, times and sequencer info: */ + move(dna,mem[storage_seg*storage_ofs+3],sizeof(dna)); + move(times,mem[storage_seg*storage_ofs+3+sizeof(dna)],sizeof(times)); + move(seq,mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)], + sizeof(seq)); + move(sund, + mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)], + sizeof(sund)); + + here=storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)+sizeof(sund); + + for( fv=1; fv <= numtr; fv ++) + { triptype& with = tr[fv]; + if (with.quick) + { + mem[storage_seg*here]=fv; here += 1; + save_data_to_mem(here); + }} + mem[storage_seg*here]=177; + + exit(77); /* Code to return to the Bootstrap. */ +} + +boolean there_was_a_problem() +{ + boolean there_was_a_problem_result; + there_was_a_problem_result=bug; + return there_was_a_problem_result; +} + + diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h new file mode 100644 index 000000000000..abf20a27dcf5 --- /dev/null +++ b/engines/avalanche/enid.h @@ -0,0 +1,22 @@ +#ifndef __enid_h__ +#define __enid_h__ + + +#include "gyro.h" + + +void edna_save(string name); + +void edna_load(string name); + +void edna_reload(); /* From Bootstrap's storage. */ + +void dir(string where); + +void avvy_background(); + +void back_to_bootstrap(byte what); + +boolean there_was_a_problem(); + +#endif diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp new file mode 100644 index 000000000000..036aa945af81 --- /dev/null +++ b/engines/avalanche/filer.cpp @@ -0,0 +1,791 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ +/*#include "Tommys.h"*/ +#include "lucerna.h" + +/*$V-*/ + +struct windowtype { + integer x1,y1,x2,y2; + varying_string<20> title; +}; + + struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS (here 1=DOS. See below for others.*/ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ + }; + +const integer border = 1; /* size of border on shadowboxes */ + +const array<1,4,varying_string<7> > buttons = {{"Okay","Wipe","Cancel","Info..."}}; + +const integer files = 3; +const integer dirs = 4; + +const integer drlen = 15; /* no. of drives on one line */ + +const array<1,4,windowtype> threewins = + {{{155, 12, 630, 22, "Name"}, + {15, 25, 410, 70, "Drives"}, + {15, 83, 480, 179, "Files (*.ASG)"}, + {490, 83, 630, 179, "Subdirectories"}}}; + +const integer name_win = 1; +const integer drive_win = 2; +const integer file_win = 3; +const integer subdir_win = 4; + +matrix<3,4,1,77,varying_string<12> > lists; +array<1,77,varying_string<40> > descs; +array<3,4,byte> nums,where,top; +searchrec s; +boolean loading; +varying_string<26> drives; +pathstr current; +byte nowwin; +varying_string<17> doing; + +pathstr filename; +boolean filefound; + +void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) +{ + byte fv; +; + for( fv=0; fv <= border; fv ++) + {; + setfillstyle(1,hc); + bar(x1+fv,y1+fv,x1+fv,y2-fv); + bar(x1+fv,y1+fv,x2-fv,y1+fv); + + setfillstyle(1,sc); + bar(x2-fv,y1+fv,x2-fv,y2-fv); + bar(x1+fv,y2-fv,x2-fv,y2-fv); + } +} + +void shbox(integer x1,integer y1,integer x2,integer y2, string t) +{ + const integer fc = 7; +; + shadow(x1,y1,x2,y2,15,8); + setfillstyle(1,fc); + bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); + setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; + outtextxy(x1,y1,t); + if (length(t)>1) + {; + fillchar(t[2],length(t)-1,'\40'); t[1]='_'; + outtextxy(x1-1,y1+1,t); + } +} + +void show_drives() +{ + byte fv; +; + settextjustify(1,1); + for( fv=0; fv <= length(drives)-1; fv ++) + shbox((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,drives[fv+1]); + setcolor(11); + settextjustify(0,2); +} + +void box(integer x1,integer y1,integer x2,integer y2, string z) +{; + rectangle(x1,y1,x2,y2); + outtextxy(x1+1,y1-10,z+':'); + outtextxy(x1,y1-9,"_"); +} + +string lowstr(string x) +{ + byte fv; +string lowstr_result; +; + for( fv=1; fv <= length(x); fv ++) + if (set::of(range('A','Z'), eos).has(x[fv])) x[fv] += 32; + lowstr_result=x; +return lowstr_result; +} + +char lowchar(char x) +{ + char lowchar_result; + if (set::of(range('A','Z'), eos).has(x)) x -= 32; + lowchar_result=x; + return lowchar_result; +} + +void getcurrent() +{; + current=lowstr(fexpand("*.asg")); +} + +void setup() +{ + integer gd,gm; + registers r; + byte floppies; +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + dusk(); + setfillstyle(1,1); bar(2,2,637,197); shadow(0,0,639,199,15,7); + + if (loading) doing="LOAD"; else doing="SAV"; + doing=doing+"ING a file..."; + + /* Now... find all drives that exist. */ + drives=""; + intr(0x11,r); floppies=(((cardinal)r.ax >> 6) & 0x3)+1; /* useful bit of code! */ + for( gm=1; gm <= floppies; gm ++) drives=drives+chr(64+gm); + /* Winchesters, etc., can be found the easy way... */ + for( gd=3; gd <= 26; gd ++) /* C: to Z: */ + if (disksize(gd)>-1) drives=drives+chr(64+gd); + + fillchar(where,sizeof(where),'\1'); + fillchar(top,sizeof(top),'\1'); + + settextstyle(0,0,0); + settextjustify(1,1); + for( gd=1; gd <= 2; gd ++) + for( gm=0; gm <= 1; gm ++) + shbox(420+gm*110,gd*25,520+gm*110,gd*25+20,buttons[gm*2+gd]); + shbox(15,182,350,196,"Help... (press f1)"); + settextjustify(0,2); setcolor(11); + setcolor(15); outtextxy(15,5,"The Avvy Filer..."); + setcolor(11); outtextxy(317,3,string('(')+doing+')'); + outtextxy(357,185,"Copyright (c) 1993, Thomas Thurman."); + + /* Draw the boxes and names */ + setcolor(3); + for( gm=1; gm <= 4; gm ++) + { windowtype& with = threewins[gm]; + box(with.x1,with.y1,with.x2,with.y2,with.title);} + nowwin=1; getcurrent(); +} + +void quicksort(byte whichlist, integer lo, integer hi); + + +static void sort(integer l, integer r, byte& whichlist) +{ + integer i, j; + varying_string<12> x, y; + + i = l; j = r; x = lists[whichlist][(l+r) / 2]; + do { + while (lists[whichlist][i] < x) i = i + 1; + while (x < lists[whichlist][j]) j = j - 1; + if (i <= j) + { + y = lists[whichlist][i]; + lists[whichlist][i] = lists[whichlist][j]; + lists[whichlist][j] = y; + i = i + 1; j = j - 1; + } + } while (!(i > j)); + if (l < j) sort(l, j, whichlist); + if (i < r) sort(i, r, whichlist); +} + +void quicksort(byte whichlist, integer lo, integer hi) + +{ /*QuickSort*/; + sort(lo,hi, whichlist); +} + +void scandir() +{ + pathstr nix; + namestr name; + untyped_file f; + ednahead eh; + array<1,4,char> dna_type; + +; + nums[files]=0; + findfirst("*.asg",archive+hidden+readonly,s); + + while (doserror==0) + {; + fsplit(s.name,nix,name,nix); + nums[files] += 1; + lists[files][nums[files]]=lowstr(name); + + assign(f,s.name); + reset(f,1); + seek(f,11); + blockread(f,dna_type,4); + + if (dna_type=="Avvy") + {; /* A DNA256 file. */ + descs[nums[files]]="* Saved by Avaricius!"; + } else + {; /* EDNA-based files. */ + if (dna_type=="EDNA") + {; + seek(f,177); + blockread(f,eh,sizeof(eh)); + + if (eh.revision!=2) + descs[nums[files]]="* Unknown EDNA type!"; + else + {; + + if (eh.number!=2) + descs[nums[files]]=string("* Saved by ")+eh.shortname+'!'; + else + {; /* Well... everything seems to have gone OK! */ + descs[nums[files]]=eh.desc; + } + } + } else + descs[nums[files]]="* Not an Avvy saved game!"; + } + close(f); + findnext(s); + } + nums[dirs]=0; findfirst("*.*",directory,s); + while (doserror==0) + {; + if (((s.attr & directory)>0) && ((length(s.name))>1)) + {; + nums[dirs] += 1; + lists[dirs][nums[dirs]]=lowstr(s.name); + } + findnext(s); + } + + /* Now sort 'em! */ + + quicksort ( dirs,1,nums[ dirs]); + quicksort (files,1,nums[files]); + + where[dirs]=1; where[files]=1; + top[dirs]=1; top[files]=1; +} + +void show_file(integer x,integer y, byte which) +{ + varying_string<58> z; +; + fillchar(z[1],13,'\40'); + z=lists[files][which]+".asg"; + z[0]='\15'; z=z+descs[which]; + + if (descs[which][1]=='*') /* Can't load these! */ + setcolor(red); + else + setcolor(lightcyan); + + outtextxy(x,y,z); +} + +void showfiles() +{ + byte fv; +; + if (loading) setcolor(11); else setcolor(3); + if (nums[3]==0) + {; + outtextxy(22,86,"(None here!)"); + return; + } + for( fv=0; fv <= 8; fv ++) + if (where[3]+fv<=nums[3]) + show_file(19,87+fv*10,where[3]+fv); +} + +void showdirs() +{ + byte fv; +; + setcolor(11); + for( fv=0; fv <= 8; fv ++) + if (where[4]+fv<=nums[4]) + outtextxy(497,87+fv*10,string('[')+lists[dirs][fv+where[4]]+']'); +} + +void show() +{ + byte fv; + dirstr d; namestr n; extstr e; +; + setfillstyle(1,1); + for( fv=1; fv <= 4; fv ++) + if (fv!=2) + { windowtype& with = threewins[fv]; + bar(with.x1+1,with.y1+1,with.x2-1,with.y2-1);} + showfiles(); + showdirs(); + setcolor(7); outtextxy(159,14,current); +} + +void blip() +{; + sound(177); delay(77); nosound; +} + +void invert(integer x1,integer y1,integer x2,integer y2) +{ + pointer p,restore; word s; +; + s=imagesize(x1,y1,x2,y2); + mark(restore); getmem(p,s); + getimage(x1,y1,x2,y2,p); + putimage(x1,y1,p,notput); + release(restore); +} + +void changedrive(char drive) +{ + byte fv; +; + fv=pos(drive,drives); + if (fv==0) {; blip(); return; } + fv -= 1; + shadow((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,8,7); + chdir(string(drive)+':'); + getcurrent(); scandir(); show(); + shadow((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,15,8); +} + +void highlight(byte win,byte line) +{; + switch (win) { + case 3: invert(16,75+line*10,479,85+line*10); break; + case 4: invert(491,75+line*10,619,85+line*10); break; + } +} + +void repaint(byte whichwindow) +{ + setfillstyle(1,1); + { windowtype& with = threewins[whichwindow]; + bar(with.x1+1,with.y1+1,with.x2-1,with.y2-1);} + switch (whichwindow) { + case file_win: showfiles(); break; + case subdir_win: showdirs(); break; + } + highlight(whichwindow,1); + top[whichwindow]=where[whichwindow]; +} + +void fileblit(word xpos,word xlen,word y1,word y2, shortint dir, word ylen) +{ + word fv; byte bit; +; + for( bit=0; bit <= 3; bit ++) + {; + fv=0; + while (fvnums[whichlist]) wherenow=1; + } while (!((startedat==wherenow) || (lists[whichlist][wherenow][1]==whatfor))); + repaint(whichlist); +} + +void gotohome(byte whichlist) +{ + where[whichlist]=1; + repaint(whichlist); +} + +void gotoend(byte whichlist) +{ + where[whichlist]=nums[whichlist]; + repaint(whichlist); +} + +void pageup(byte whichlist) +{ + if (where[whichlist]>9) + { + where[whichlist] -= 9; + repaint(whichlist); + } +} + +void pagedown(byte whichlist) +{ + if (where[whichlist]0) && ((where[which]+howmuch)<=(unsigned char)nums[4])) + where[which]=where[which]+howmuch; + highlight(4,where[4]-top[4]+1); +} + + + +static void change_dir() +{; + dusk(); + /*$I-*/ chdir(lists[4][where[4]]); + /*$I+*/ + if (ioresult!=0) {; dawn(); blip(); return; } + where[4]=1; top[4]=1; + getcurrent(); scandir(); show(); + highlight(4,1); + dawn(); +} + +void subdirparse(string r) + +{; + switch (r[1]) { + case creturn: change_dir(); break; + + case '\0': switch (r[2]) { + case cup: if (where[4]-top[4]>0) /* Up */ + movehl(4,-1); /* Within range */ + else if (top[4]>1) + {; /* Outside range- must scroll */ + highlight(4,1); + top[4] -= 1; where[4] -= 1; + fileblit(61,18,166,176,-1,80); + setfillstyle(1,1); bar(490,85,630,95); setcolor(11); + outtextxy(497,87,string('[')+lists[dirs][where[4]]+']'); + highlight(4,1); + } + break; + case cdown: + if (where[4]-top[4]<8) /* Down */ + movehl(4,1); + else if (top[4]+8 os; + char r; + +; + + /* Firstly, we must check whether or not it's an Avalot file. This is easily + done, since the descriptions of all others always begin with a star. */ + + if ((descs[which][1]=='*') || (descs[which][1]=='(')) + {; /* it is. */ + blip(); /* Naaaarghh! */ + return; + } + + /* Anyway... it wasn't. */ + + assign(f,lists[files][which]+".asg"); + reset(f,1); + seek(f,177); + blockread(f,eh,sizeof(eh)); + close(f); + + /* We now hold its EDNA record. */ + + setfillstyle(1,1); bar(2,2,637,197); /* Interesting information coming up! */ + + {; + display(2,"Saved by:", eh.game); + display(3,"version:", eh.verstr); + +/* display(4,'under', os);*/ + + display(6,"Saved on ",strf(eh.d)+'-'+strf(eh.m)+'-'+strf(eh.y)); + + display(9,"No. of times saved:",strf(eh.saves)); + + display(11,"Money:",eh.money); + display(12,"Score:",strf(eh.points)); + } + + shbox(500,177,650,200,"Press any key..."); + r=readkey(); + + setfillstyle(1,1); bar(2,2,637,197); +} + +void filer_help() + /* This gives general help. */ +{ + char r; +; + outtextxy(100,100,"Just general help here."); + shbox(500,177,650,200,"Press any key..."); + r=readkey(); + + setfillstyle(1,1); bar(2,2,637,197); +} + +void wipe() + /* This allows you to delete files. */ +{ + char r; +; + outtextxy(100,100,"Are you sure you want to delete \"foo.bar\"?"); + shbox(500,177,650,200,"[Y/N]"); + r=readkey(); + + setfillstyle(1,1); bar(2,2,637,197); +} + +void filesparse(string r); + +static void movehl1(byte which, shortint howmuch) +{; + highlight(3,where[3]-top[3]+1); + if (((where[which]+howmuch)>0) && ((where[which]+howmuch)<=(unsigned char)nums[3])) + where[which]=where[which]+howmuch; + highlight(3,where[3]-top[3]+1); +} + + + +static boolean selected_file() +{boolean selected_file_result; +; + if (descs[where[file_win]][1]=='*') + { + blip(); + selected_file_result=false; + } else + { + filename=lists[file_win][where[file_win]]; + filefound=true; + selected_file_result=true; + } +return selected_file_result; +} + +void filesparse(string r) + +{; + switch (r[1]) { + case creturn: if (selected_file()) return; break; + case '\0': switch (r[2]) { + case cup: if (where[3]-top[3]>0) /* Up */ + movehl1(3,-1); /* Within range */ + else if (top[3]>1) + {; /* Outside range- must scroll */ + highlight(3,1); + top[3] -= 1; where[3] -= 1; + fileblit(1,59,166,176,-1,80); + setfillstyle(1,1); bar( 15,85,480,95); + show_file( 19,87,where[3]); + highlight(3,1); + } + break; + case cdown: if (where[3]-top[3]<8) /* Down */ + movehl1(3,1); + else if (top[3]+84) nowwin=1; + switch (nowwin) { + case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; + } +} + +string playaround() +{ + char r,r2; +string playaround_result; +; + filefound=false; dawn(); + + do { + setcolor(14); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} + r=readkey(); + switch (r) { + case ctab: changewin(nowwin+1); break; + case cescape: {; + playaround_result=""; + return playaround_result; + } + break; + case '\0': {; /* parse extd keystroke */ + r2=readkey(); + switch (r2) { + case cs_tab: changewin(nowwin-1); break; + case c_an: changewin(1); break; + case c_ad: changewin(2); break; + case c_af: changewin(3); break; + case c_as: changewin(4); break; + case c_ac: {; + playaround_result=""; + return playaround_result; + } + break; + default: + switch (nowwin) { + case 3: filesparse(string('\0')+r2); break; + case 4: subdirparse(string('\0')+r2); break; + } + } + } + break; + default: + {; /* Pass keystroke to current window */ + switch (nowwin) { + case 2: changedrive(upcase(r)); break; + case 4: subdirparse(r); break; + case 3: filesparse(r); break; + default: blip(); + } + } + + } + + if (filefound) + {; + dusk(); + playaround_result=filename; + return playaround_result; + } + } while (!false); +return playaround_result; +} + +void do_filer() +{ + pathstr p; +void do_filer_result; +; + loading=true; + setup(); + scandir(); + show(); show_drives(); + p=playaround(); + if (p!="") p=fexpand(p+".ASG"); + do_filer_result=p; +return do_filer_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + filename=do_filer(); + closegraph(); + if (filename=="") + output << "*** CANCELLED! ***" << NL; + else + output << "Selected: " << filename << NL; + input >> NL; +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp new file mode 100644 index 000000000000..a944fbc0a00c --- /dev/null +++ b/engines/avalanche/fileunit.cpp @@ -0,0 +1,1118 @@ +#include "ptoc.h" + +#define __fileunit_implementation__ + /* v:filer.pas - "avvyfiler" - in unit form. */ + +#include "fileunit.h" + + +#include "graph.h" +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ +/*#include "Tommys.h"*/ +#include "lucerna.h" +#include "pingo.h" +#include "Gyro.h" + +/*$V-*/ + +struct windowtype { + integer x1,y1,x2,y2; + varying_string<20> title; +}; + +const integer border = 1; /* size of border on shadowboxes */ + +const array<1,4,string> buttons = {{"Okay","Wipe","Cancel","Info..."}}; + +const integer files = 3; +const integer dirs = 4; + +const integer drlen = 15; /* no. of drives on one line */ + +const array<1,4,windowtype> threewins = + {{{155, 12, 630, 22, "Name"}, + {15, 25, 410, 70, "Drives"}, + {15, 83, 480, 179, "Files (*.ASG)"}, + {490, 83, 630, 179, "Subdirectories"}}}; + +const integer name_win = 1; +const integer drive_win = 2; +const integer file_win = 3; +const integer subdir_win = 4; + +const integer filer_page = 3; + +matrix<3,4,1,77,varying_string<12> > lists; +array<1,77,varying_string<40> > descs; +array<3,4,byte> nums,where,top,thumb_pos,thumb_len; +searchrec s; +boolean loading; +varying_string<26> drives; +pathstr current; +byte nowwin; + +pathstr filename; +boolean filefound; + +boolean cancelled; + +void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) +{ + byte fv; + + for( fv=0; fv <= border; fv ++) + { + setfillstyle(1,hc); + bar(x1+fv,y1+fv,x1+fv,y2-fv); + bar(x1+fv,y1+fv,x2-fv,y1+fv); + + setfillstyle(1,sc); + bar(x2-fv,y1+fv,x2-fv,y2-fv); + bar(x1+fv,y2-fv,x2-fv,y2-fv); + } +} + +void shbox(integer x1,integer y1,integer x2,integer y2, string t) +{ + const integer fc = 7; + + shadow(x1,y1,x2,y2,15,8); + setfillstyle(1,fc); + bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); + setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; + outtextxy(x1,y1,t); + if ((t[1]!='[') && (length(t)>1)) + { + fillchar(t[2],length(t)-1,'\40'); t[1]='_'; + outtextxy(x1-1,y1+1,t); + } +} + +void show_drives() +{ + byte fv; + + settextjustify(1,1); + for( fv=0; fv <= length(drives)-1; fv ++) + shbox((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,drives[fv+1]); + setcolor(11); + settextjustify(0,2); +} + +char which_drive(integer x,integer y) +{ + char which_drive_result; + x=(x-25) / 25; y=(y-32) / 19; + + which_drive_result= drives[1+x+y*drlen]; + return which_drive_result; +} + +void box(integer x1,integer y1,integer x2,integer y2, string z) +{ + rectangle(x1,y1,x2,y2); + outtextxy(x1+1,y1-10,z+':'); + outtextxy(x1,y1-9,"_"); +} + +string lowstr(string x) +{ + byte fv; + + string lowstr_result; + for( fv=1; fv <= length(x); fv ++) + if (set::of(range('A','Z'), eos).has(x[fv])) x[fv] += 32; + lowstr_result=x; + return lowstr_result; +} + +char lowchar(char x) +{ + char lowchar_result; + if (set::of(range('A','Z'), eos).has(x)) x -= 32; + lowchar_result=x; + return lowchar_result; +} + +void getcurrent() +{ + current=lowstr(fexpand("*.asg")); +} + +void firstsetup() +{ + integer gd,gm; + registers r; + byte floppies; + + /* Now... find all drives that exist. */ + drives=""; + intr(0x11,r); floppies=(((cardinal)r.ax >> 6) & 0x3)+1; /* useful bit of code! */ + for( gm=1; gm <= floppies; gm ++) drives=drives+chr(64+gm); + /* Winchesters, etc., can be found the easy way... */ + for( gd=3; gd <= 26; gd ++) /* C: to Z: */ + if (disksize(gd)>-1) drives=drives+chr(64+gd); + + fillchar(where,sizeof(where),'\1'); + fillchar(top,sizeof(top),'\1'); + + /* Set up mouse. */ + off_virtual(); + oncandopageswap=false; + newpointer(2); +} + +void draw_scroll_bar(byte which) +{ + setcolor(1); + { + windowtype& with = threewins[which]; + + setfillstyle(1,7); + bar(with.x2-7,with.y1+10,with.x2-1,with.y2-10); + setfillstyle(1,3); + bar(with.x2-7,with.y1+ 1,with.x2-1,with.y1+9); + bar(with.x2-7,with.y2- 9,with.x2-1,with.y2-1); + outtextxy(with.x2-7,with.y1+2,"\30"); + outtextxy(with.x2-7,with.y2-8,"\31"); + } +} + +void setup() +{ + integer gd,gm; + registers r; + byte floppies; + + setactivepage(filer_page); setvisualpage(filer_page); + setfillstyle(1,1); bar(2,2,637,197); shadow(0,0,639,199,15,7); + + settextstyle(0,0,0); + settextjustify(1,1); + for( gd=1; gd <= 2; gd ++) + for( gm=0; gm <= 1; gm ++) + shbox(420+gm*110,gd*25,520+gm*110,gd*25+20,buttons[gm*2+gd]); + shbox(15,182,350,196,"Help... (press f1)"); + settextjustify(0,2); setcolor(11); + setcolor(15); outtextxy(15,5,"The Avvy Filer..."); + setcolor(11); outtextxy(317,3,"Select a file to load."); + outtextxy(357,185,"Copyright (c) 1993, Thomas Thurman."); + + /* Draw the boxes and names */ + setcolor(3); + for( gm=1; gm <= 4; gm ++) + { windowtype& with = threewins[gm]; + box(with.x1,with.y1,with.x2,with.y2,with.title);} + + /* Draw the scroll bars. */ + + for( gm=3; gm <= 4; gm ++) draw_scroll_bar(gm); +} + +void thumb(byte whichwin) +{ + word length,the_top; + + if (nums[whichwin]<9) + { + length=76; + the_top=0; + } else + { + length=trunc(76*((real)(8)/nums[whichwin])); + the_top=trunc(((real)(where[whichwin])/nums[whichwin])*(76-length)); + } + + the_top += 93; /* Top of both the scrollbars. */ + + setfillstyle(1,7); + { windowtype& with = threewins[whichwin]; + bar(with.x2-6,thumb_pos[whichwin],with.x2-3,thumb_pos[whichwin]+length);} + setfillstyle(1,1); + { windowtype& with = threewins[whichwin]; + bar(with.x2-6,the_top,with.x2-3,the_top+length);} + + thumb_pos[whichwin]=the_top; + thumb_len[whichwin]=length; +} + +void quicksort(byte whichlist, integer lo, integer hi); + + +static void sort(integer l, integer r, byte& whichlist) +{ + integer i, j; + varying_string<12> x, y; + varying_string<40> d; + + i = l; j = r; x = lists[whichlist][(l+r) / 2]; + do { + while (lists[whichlist][i] < x) i = i + 1; + while (x < lists[whichlist][j]) j = j - 1; + if (i <= j) + { + y = lists[whichlist][i]; + lists[whichlist][i] = lists[whichlist][j]; + lists[whichlist][j] = y; + + d = descs[i]; + descs[i] = descs[j]; + descs[j] = d; + + i = i + 1; j = j - 1; + } + } while (!(i > j)); + +/* if j<1 then j:=1; + if r<1 then r:=1;*/ + + if (l < j) sort(l, j, whichlist); + if (i < r) sort(i, r, whichlist); +} + +void quicksort(byte whichlist, integer lo, integer hi) + +{ /*QuickSort*/; + sort(lo,hi, whichlist); +} + +void scandir() +{ + pathstr nix; + namestr name; + untyped_file f; + ednahead eh; + array<1,4,char> dna_type; + + + nums[files]=0; + findfirst("*.asg",archive+hidden+readonly,s); + + while ((doserror==0) && (nums[files]<77)) + { + fsplit(s.name,nix,name,nix); + nums[files] += 1; + lists[files][nums[files]]=lowstr(name); + + assign(f,s.name); + reset(f,1); + seek(f,11); + blockread(f,dna_type,4); + + if (dna_type=="Avvy") + { /* A DNA256 file. */ + descs[nums[files]]="* Saved by Avaricius!"; + } else + { /* EDNA-based files. */ + if (dna_type=="EDNA") + { + seek(f,177); + blockread(f,eh,sizeof(eh)); + + if (eh.revision!=2) + descs[nums[files]]="* Unknown EDNA type!"; + else + { + + if (eh.number!=2) + descs[nums[files]]=string("% Saved by ")+eh.shortname+'!'; + else + { /* Well... everything seems to have gone OK! */ + descs[nums[files]]=eh.desc; + } + } + } else + descs[nums[files]]="* Not an Avvy saved game!"; + } + close(f); + findnext(s); + } + nums[dirs]=0; findfirst("*.*",directory,s); + while ((doserror==0) && (nums[dirs]<77)) + { + if (((s.attr & directory)>0) && ((length(s.name))>1)) + { + nums[dirs] += 1; + lists[dirs][nums[dirs]]=lowstr(s.name); + } + findnext(s); + } + + /* Now sort 'em! */ + + if (nums[dirs ]!=0) quicksort ( dirs,1,nums[ dirs]); + if (nums[files]!=0) quicksort (files,1,nums[files]); + + where[dirs]=1; where[files]=1; + top[dirs]=1; top[files]=1; + + thumb_pos[3]=93; thumb_pos[4]=93; +} + +void show_file(integer x,integer y, byte which) +{ + varying_string<58> z; + + fillchar(z[1],13,'\40'); + z=lists[files][which]+".asg"; + z[0]='\15'; z=z+descs[which]; + + if (set::of('*','%', eos).has(descs[which][1])) /* Can't load these! */ + setcolor(red); + else + setcolor(lightcyan); + + outtextxy(x,y,z); +} + +void showfiles() +{ + byte fv; + + if (loading) setcolor(11); else setcolor(3); + if (nums[3]==0) + { + outtextxy(22,86,"(None here!)"); + return; + } + for( fv=0; fv <= 8; fv ++) + if (top[3]+fv<=nums[3]) + show_file(19,87+fv*10,top[3]+fv); + + draw_scroll_bar(files); +} + +void showdirs() +{ + byte fv; + + setcolor(11); + for( fv=0; fv <= 8; fv ++) + if (top[4]+fv<=nums[4]) + outtextxy(497,87+fv*10,string('[')+lists[dirs][fv+top[4]]+']'); + draw_scroll_bar(dirs); +} + +void show() +{ + byte fv; + dirstr d; namestr n; extstr e; + + setfillstyle(1,1); + for( fv=1; fv <= 4; fv ++) + if (fv!=2) + { windowtype& with = threewins[fv]; + bar(with.x1+1,with.y1+1,with.x2-8,with.y2-1);} + showfiles(); + showdirs(); + setcolor(7); outtextxy(159,14,current); + for( fv=3; fv <= 4; fv ++) thumb(fv); +} + +void blip() +{ + sound(177); delay(77); nosound; +} + +void invert(integer x1,integer y1,integer x2,integer y2) +{ + pointer p,restore; word s; + + s=imagesize(x1,y1,x2,y2); + mark(restore); getmem(p,s); + getimage(x1,y1,x2,y2,p); + putimage(x1,y1,p,notput); + release(restore); +} + +void changedrive(char drive) +{ + byte fv; + + fv=pos(drive,drives); + if (fv==0) { blip(); return; } + off(); + fv -= 1; + shadow((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,8,7); + chdir(string(drive)+':'); + getcurrent(); scandir(); show(); + shadow((fv % drlen)*25+25,(fv / drlen)*19+31, + (fv % drlen)*25+40,45+(fv / drlen)*19,15,8); + on(); +} + +void highlight(byte win,byte line) +{ + switch (win) { + case 3: invert(16,75+line*10,470,85+line*10); break; + case 4: invert(491,75+line*10,620,85+line*10); break; + } + thumb(win); +} + +void repaint(byte whichwindow) +{ + setfillstyle(1,1); + { windowtype& with = threewins[whichwindow]; + bar(with.x1+1,with.y1+1,with.x2-8,with.y2-1);} + top[whichwindow]=where[whichwindow]; + switch (whichwindow) { + case file_win: showfiles(); break; + case subdir_win: showdirs(); break; + } + thumb(whichwindow); +} + +void fileblit(word xpos,word xlen,word y1,word y2, shortint dir, word ylen) +{ + word fv; byte bit; + + for( bit=0; bit <= 3; bit ++) + { + fv=0; + while (fvnums[whichlist]) wherenow=1; + } while (!((startedat==wherenow) || (lists[whichlist][wherenow][1]==whatfor))); + off(); + repaint(whichlist); + on(); +} + +void gotohome(byte whichlist) +{ + off(); + where[whichlist]=1; + repaint(whichlist); + highlight(whichlist,1); + on(); +} + +void gotoend(byte whichlist) +{ + off(); + where[whichlist]=nums[whichlist]; + repaint(whichlist); + highlight(whichlist,1); + on(); +} + +void pageup(byte whichlist) +{ + off(); + if (where[whichlist]>9) + { + where[whichlist] -= 9; + repaint(whichlist); + highlight(whichlist,1); + } else gotohome(whichlist); + on(); +} + +void pagedown(byte whichlist) +{ + off(); + if (where[whichlist]0) && ((where[which]+howmuch)<=(unsigned char)nums[4])) + where[which]=where[which]+howmuch; + highlight(4,where[4]-top[4]+1); + on(); +} + + + +static void change_dir() +{ + off(); dusk(); + /*$I-*/ chdir(lists[4][where[4]]); + /*$I+*/ + if (ioresult!=0) { dawn(); blip(); return; } + where[4]=1; top[4]=1; + getcurrent(); scandir(); show(); + highlight(4,1); + dawn(); on(); +} + +void subdirparse(string r) + +{ + switch (r[1]) { + case creturn: change_dir(); break; + + case '\0': switch (r[2]) { + case cup: if (where[4]-top[4]>0) /* Up */ + movehl(4,-1); /* Within range */ + else if (top[4]>1) + { /* Outside range- must scroll */ + off(); + highlight(4,1); + top[4] -= 1; where[4] -= 1; + fileblit(61,17,166,176,-1,80); + setfillstyle(1,1); bar(490,85,622,95); setcolor(11); + outtextxy(497,87,string('[')+lists[dirs][where[4]]+']'); + highlight(4,1); + on(); + } + break; + case cdown: + if (where[4]-top[4]<8) /* Down */ + movehl(4,1); + else if (top[4]+80) && ((where[which]+howmuch)<=(unsigned char)nums[3])) + where[which]=where[which]+howmuch; + highlight(3,where[3]-top[3]+1); + on(); +} + + + +static boolean selected_file() +{ + boolean selected_file_result; + if ((set::of('*','%', eos).has(descs[where[file_win]][1])) || (nums[3]==0)) + { + blip(); + selected_file_result=false; + } else + { + filename=lists[file_win][where[file_win]]; + filefound=true; + selected_file_result=true; + } + return selected_file_result; +} + +void filesparse(string r) + +{ + switch (r[1]) { + case creturn: if (selected_file()) return; break; + case '\0': switch (r[2]) { + case cup: if (where[3]-top[3]>0) /* Up */ + movehl1(3,-1); /* Within range */ + else if (top[3]>1) + { /* Outside range- must scroll */ + off(); + highlight(3,1); + top[3] -= 1; where[3] -= 1; + fileblit(1,58,166,176,-1,80); + setfillstyle(1,1); bar( 15,85,472,95); + show_file( 19,87,where[3]); + highlight(3,1); + on(); + } + break; + case cdown: if (where[3]-top[3]<8) /* Down */ + movehl1(3,1); + else if (top[3]+84) nowwin=1; + switch (nowwin) { + case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; + } + on(); +} + +void checkmouse(); + +static void relevant(string x) +{ + setcolor(14); off(); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} + on(); if (nowwin==3) filesparse(x); else subdirparse(x); +} + +void checkmouse() +{ + byte fv,new,waswin; + + check(); + if (mrelease>0) + { /* Where did they click? */ + for( fv=1; fv <= 4; fv ++) + { windowtype& with = threewins[fv]; + if (((cardinal)with.x1<=mx) && ((cardinal)with.x2>=mx) && ((cardinal)with.y1<=my) && ((cardinal)with.y2>=my)) + { + waswin=nowwin; + + if (nowwin!=fv) + { + changewin(fv); + off(); + setcolor(14); { windowtype& with1 = threewins[nowwin]; box(with1.x1,with1.y1,with1.x2,with1.y2,with1.title);} + on(); + } + /* Now... individual windows should do their own checkclicking. */ + + switch (fv) { + /* 1: no effect. */ + case 2: changedrive(which_drive(mx,my)); break; /* Change drive w/mouse. */ + case 3:case 4: if (my<175) { /* Click on highlight users. */ + if (mx>(cardinal)threewins[nowwin].x2-9) + { /* Scroll bar. */ + if (my<(cardinal)threewins[nowwin].y1+10) + relevant(null+cup); /* scroll up */ + else if (my>(cardinal)threewins[nowwin].y2-10) + relevant(null+cdown); /* scroll down. */ + else if (my<(unsigned char)thumb_pos[nowwin]) + relevant(null+cpgup); /* above thumb-- page up. */ + else if (my>(unsigned char)thumb_pos[nowwin]+thumb_len[nowwin]) + relevant(null+cpgdn); /* above thumb-- page up. */ + else { /* On the thumb. */ + blip(); + } + } else + { + new=top[fv]+(my-75) / 10-1; + + if ((new==where[fv]) && (nowwin==waswin)) + { /* Double-clicked, --> "OK" */ + /* filefound:=true; + filename:=lists[fv,new];*/ + if (fv==3) filesparse("\15"); else subdirparse("\15"); + } else + { /* Single-clicked, --> move highlight */ + off(); + highlight(fv,where[fv]-top[fv]+1); + if ((new>0) && (new<=nums[fv])) + where[fv]=new; + highlight(fv,where[fv]-top[fv]+1); + on(); + } + } + } + break; + } + + return; /* Since they've clicked in a window... */ + }} + + /* Righto, they must have clicked on a button. Which? */ + + switch (my) { + case 25 ... 45: /* Top row: Okay, Cancel. */ + switch (mx) { + case 420 ... 520: switch (nowwin) { + case 1: entername('\15'); break; + case 3: filesparse("\15"); break; + case 4: subdirparse("\15"); break; + default: blip(); + } + break; + case 530 ... 630: cancelled=true; break; + } + break; + case 50 ... 95: /* Bottom row: Wipe, Info. */ + switch (mx) { + case 420 ... 520: if (nowwin==3) wipe(where[3]); else blip(); break; + case 530 ... 630: if (nowwin==3) fileinfo(where[3]); else blip(); break; + } + break; + case 180 ... 200: filer_help(); break; /* The "help" button. */ + } + } +} + +string playaround() +{ + char r,r2; + + string playaround_result; + filefound=false; dawn(); + + do { + setcolor(14); off(); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} on(); + do { checkmouse(); } while (!(keypressed() || filefound || cancelled)); + if (! (filefound || cancelled)) + { + r=readkey(); + switch (r) { + case ctab: changewin(nowwin+1); break; + case cescape: { + playaround_result=""; + return playaround_result; + } + break; + case '\0': { /* parse extd keystroke */ + r2=readkey(); + switch (r2) { + case cs_tab: changewin(nowwin-1); break; + case c_an: changewin(1); break; + case c_ad: changewin(2); break; + case c_af: changewin(3); break; + case c_as: changewin(4); break; + case c_ac: cancelled=false; break; + case c_ah:case cf1: filer_help(); break; /* alt-H: help. */ + default: + switch (nowwin) { + case 3: filesparse(string('\0')+r2); break; + case 4: subdirparse(string('\0')+r2); break; + } + } + } + break; + default: + { /* Pass keystroke to current window */ + switch (nowwin) { + case 1: entername(r); break; + case 2: changedrive(upcase(r)); break; + case 4: subdirparse(r); break; + case 3: filesparse(r); break; + default: blip(); + } + } + } + + } + + if (filefound) + { + dusk(); + playaround_result=filename; + return playaround_result; + } + + if (cancelled) + { + dusk(); + playaround_result=""; + return playaround_result; + } + } while (!false); + return playaround_result; +} + +void drawup() +{ + off(); + loading=true; + setup(); + show(); show_drives(); + on(); +} + +void little_cls() +{ + setfillstyle(1,1); bar(2,2,637,197); /* Interesting information coming up! */ +} + +void wait_for_keypress_or_mouse_click() +{ + char r; + + do { check(); } while (!((mrelease>0) || keypressed())); + while (keypressed()) r=readkey(); +} + +void fileinfo(byte which); + + +static void display(integer y, string left,string right) +{ + y=17+y*12; + settextjustify(2,1); setcolor(11); outtextxy(315,y,left); + settextjustify(0,1); setcolor(15); outtextxy(325,y,right); +} + +void fileinfo(byte which) + /* This gives information on the file whose name is in lists[files,which]. */ +{ + ednahead eh; + untyped_file f; + varying_string<4> os; + + + + /* Firstly, we must check whether or not it's an Avalot file. This is easily + done, since the descriptions of all others always begin with a star. */ + + if ((descs[which][1]=='*') || (nums[3]==0)) + { /* it is. */ + blip(); /* Naaaarghh! */ + return; + } + + /* Anyway... it wasn't. */ + + assign(f,lists[files][which]+".asg"); + reset(f,1); + seek(f,177); + blockread(f,eh,sizeof(eh)); + close(f); + + /* We now hold its EDNA record. */ + + off(); + little_cls(); /* Interesting information coming up! */ + + { + display(0,"File:",eh.fn); + display(1,"Description:",eh.desc); + display(2,"Saved by:", eh.game); + display(3,"version:", eh.verstr); + + display(4,"under", eh.os); + + display(6,"Saved on:",strf(eh.d)+'-'+strf(eh.m)+'-'+strf(eh.y)); + + display(9,"No. of times saved:",strf(eh.saves)); + + display(11,"Money:",eh.money); + display(12,"Score:",strf(eh.points)); + } + + settextjustify(1,1); + shbox(400,177,600,195,"[Press any key...]"); + settextjustify(0,2); on(); + wait_for_keypress_or_mouse_click(); + + off(); setfillstyle(1,1); bar(2,2,637,197); + drawup(); + off(); highlight(3,where[3]-top[3]+1); on(); +} + +void filer_help() + /* Just some general help... */ + +{ + off(); little_cls(); + + setcolor(15); + outtextxy(10, 10,"To change to a particular pane:"); + outtextxy(10, 50,"To choose a file:"); + outtextxy(10,100,"To change drives:"); + outtextxy(10,140,"Finally..."); + + setcolor(14); + outtextxy(20, 20,"Press Alt and the initial letter simultaneously."); + outtextxy(20, 30,"(e.g. to change to the Name pane, press Alt-N.)"); + outtextxy(20, 60,"Either type its name in the Name pane or choose it"); + outtextxy(20, 70,"from the list in the Files pane. You may either use"); + outtextxy(20, 80,"a mouse or the keyboard to do this."); + outtextxy(20,110,"Move into the Drives pane and press the letter of the"); + outtextxy(20,120,"drive you want."); + outtextxy(20,150,"Either select OK to load the file, or Cancel to back out."); + + settextjustify(1,1); + shbox(400,177,600,195,"[Press any key...]"); + settextjustify(0,2); on(); + wait_for_keypress_or_mouse_click(); + + off(); setfillstyle(1,1); bar(2,2,637,197); + drawup(); off(); + if (set::of(3,4, eos).has(nowwin)) highlight(nowwin,where[nowwin]-top[nowwin]+1); + on(); +} + +void wipe(byte which) + /* This wipes the file whose name is in lists[files,which]. */ +{ + char r; + untyped_file f; + + + off(); little_cls(); + + settextjustify(1,1); + outtextxy(320,100,string("Are you sure you want to delete \"")+ + lists[files][which]+".asg\"?"); + shbox(400,177,600,195,"[Y/N]"); + + do { + r=upcase(readkey()); + if (r=='Y') + { + assign(f,lists[files][which]+".asg"); /*$I-*/ erase(f); /*$I+*/ + + setcolor(14); + if (ioresult==0) + { + scandir(); + outtextxy(100,140,"Deleted."); + } else + outtextxy(100,140,"Not deleted (some problem...)"); + + shbox(400,177,600,195,"[Press any key...]"); + on(); + wait_for_keypress_or_mouse_click(); off(); + } + } while (!(set::of('Y','N', eos).has(r))); + + settextjustify(0,2); setcolor(14); + setfillstyle(1,1); bar(2,2,637,197); + drawup(); + off(); highlight(3,where[3]-top[3]+1); on(); +} + +string do_filer() +{ + pathstr p; byte groi; dirstr original_directory; + + string do_filer_result; + getdir(0,original_directory); + dusk(); + oncandopageswap=false; cancelled=false; + copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); + off(); + + firstsetup(); + scandir(); + nowwin=1; getcurrent(); + firstsetup(); drawup(); + on(); + mousepage(filer_page); + + p=playaround(); + if (p!="") p=fexpand(p+".ASG"); + do_filer_result=p; + filename=""; + + mousepage(cp); + dusk(); off(); + oncandopageswap=true; + copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); + on_virtual(); dawn(); fix_flashers(); + + setvisualpage(cp); + setactivepage(1-cp); + chdir(original_directory); + + return do_filer_result; +} + + diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h new file mode 100644 index 000000000000..08f9262653c0 --- /dev/null +++ b/engines/avalanche/fileunit.h @@ -0,0 +1,7 @@ +#ifndef __fileunit_h__ +#define __fileunit_h__ + + +string do_filer(); /* Result is filename, or "" if cancelled. */ + +#endif diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp new file mode 100644 index 000000000000..f990f8c338f2 --- /dev/null +++ b/engines/avalanche/filing.cpp @@ -0,0 +1,144 @@ +#include "ptoc.h" + +/* + + + + + FILING The saving and loading handler. */ + + +/*$R+*/ + +/*interface*/ + +/*#include "Gyro.h"*/ + + +const array<1,12,varying_string<6> > months = + {{"Jan*","Feb*","March","April","May","June","July","August", + "Sept&","Oct&","Nov&","Dec&"}}; +const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; +const array<1,6,varying_string<7> > systems = + {{"DOS","Windows","OS/2","Mac","Amiga","ST"}}; + +struct edhead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS). See below for others.*/ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + /* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ + +/*implementation*/ + +untyped_file f; +byte fv; +array<1,255,word> dna256; +boolean ok; +edhead e; + +void info256(string x) /* info on dna256 *.ASG files */ +{ + varying_string<40> describe; +; + assign(f,x); + /*$I-*/ reset(f,1); + seek(f,47); + blockread(f,describe,40); + blockread(f,dna256,sizeof(dna256)); + close(f); /*$I+*/ + {; + e.revision=1; + e.game="Denarius Avaricius Sextus"; + e.shortname="Avaricius"; + e.number=1; + e.verstr="[?]"; + e.filename="AVVY.EXE"; + e.os=1; /* Dos */ + e.fn=x; + e.d=dna256[7]; e.m=dna256[8]; e.y=dna256[9]; + e.desc=describe; + e.len=512; + e.saves=dna256[6]; + e.cash=dna256[30]; + e.money=strf(e.cash)+" denari"; + if (e.cash==1) e.money=e.money+"us"; else e.money=e.money+'i'; + e.points=dna256[36]; + } +} + +string enlarge(string x) +{string enlarge_result; +; + switch (x[length(x)]) { + case '*': {; x[0] -= 1; x=x+"uary"; } break; + case '&': {; x[0] -= 1; x=x+"ember"; } break; + } + enlarge_result=x; +return enlarge_result; +} + +string th(byte x) +{ + varying_string<4> n; +string th_result; +; + n=strf(x); + switch (x) { + case 1:case 21:case 31: n=n+"st"; break; + case 2:case 22: n=n+"nd"; break; + case 3:case 23: n=n+"rd"; break; + default: n=n+"th"; + } + th_result=n; +return th_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + info256("t:justb4.asg"); + + {; + output << "DNA coding: "; + switch (e.revision) { + case 1: output << "dna256" << NL; break; + case 2: output << "E.D.N.A." << NL; break; + default: output << "Unknown!" << NL; + } + output << "Filename: " << e.game << " (version " << e.verstr << ')' << NL; + output << "Description: " << e.desc << NL; + output << "Cash: " << e.money << NL; + output << "Score: " << e.points << NL; + output << "Date: " << th(e.d) << ' ' << enlarge(months[e.m]) << ' ' << e.y << NL; + output << "Number of saves: " << e.saves << NL; + } +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp new file mode 100644 index 000000000000..c715aa99362f --- /dev/null +++ b/engines/avalanche/folktemp.cpp @@ -0,0 +1,79 @@ +#include "ptoc.h" + + /* Get 'em back! */ +#include "graph.h" + + +const integer picsize = 966; +const integer number_of_objects = 19; + +const array<1,65,char> thinks_header = + string("This is an Avalot file, which is subject to copyright. Have fun.")+'\32'; + +const array<0,19,byte> order = + {{ 4, 19, 1, 18, 15, 9, 12, 13, 17, 10, 2, 6, 3, 5, 7, 14, + 16, + + 0, 11, 8}}; + +/* + pAvalot=#150; pSpludwick=#151; pCrapulus=#152; pDrDuck=#153; + pMalagauche=#154; pFriarTuck=#155; pRobinHood=#156; pCwytalot=#157; + pduLustie=#158; pDuke=#159; pDogfood=#160; pTrader=#161; + pIbythneth=#162; pAyles=#163; pPort=#164; pSpurge=#165; + pJacques=#166; + + pArkata=#175; pGeida=#176; pWiseWoman=#178; +*/ + +integer gd,gm; +untyped_file f; +pointer p; +byte noo; + +void load() +{ + byte a0 /*absolute $A000:1200*/; + byte bit; + untyped_file f; +; + assign(f,"d:folk.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); bit=getpixel(0,0); +} + +void get_one() +{; + + gd=((order[noo] % 9)*70+10); + gm=((order[noo] / 9)*40+20); + + getimage(gd,gm,gd+59,gm+29,p); + putimage(gd,gm,p,notput); + blockwrite(f,p,picsize); + +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + load(); noo=0; + + assign(f,"folk.avd"); + getmem(p,picsize); + rewrite(f,1); + blockwrite(f,thinks_header,65); + + for( noo=0; noo <= number_of_objects; noo ++) + get_one(); + + close(f); freemem(p,picsize); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp new file mode 100644 index 000000000000..4a2ceb21c6ae --- /dev/null +++ b/engines/avalanche/fontslid.cpp @@ -0,0 +1,25 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +fonttype font1; +byte fv; +char r; +file f; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(f,"v:avalot.fnt"); reset(f); f >> font1; close(f); + for( r='\0'; r <= '\377'; r ++) + {; + for( fv= 0; fv <= 3; fv ++) font1[r][fv]=(cardinal)font1[r][fv] >> 1; + for( fv= 7; fv <= 8; fv ++) font1[r][fv]=font1[r][fv] << 1; + for( fv= 9; fv <= 14; fv ++) font1[r][fv]=font1[r][fv] << 2; + } + assign(f,"v:avitalic.fnt"); rewrite(f); f << font1; close(f); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp new file mode 100644 index 000000000000..b3118ddd1d48 --- /dev/null +++ b/engines/avalanche/frere.cpp @@ -0,0 +1,102 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +typedef array<1,31,byte> tunetype; + +const integer lower = 0; + const integer same = 1; +const integer higher = 2; + +const array<1,12,char> keys = "QWERTYUIOP[]"; +const array<1,12,word> notes = +{{196,220,247,262,294,330,350,392,440,494,523,587}}; + +const tunetype tune = +{{higher,higher,lower,same,higher,higher,lower,higher,higher,higher, + lower,higher,higher, + same,higher,lower,lower,lower,lower,higher,higher,lower,lower,lower, + lower,same,lower,higher,same,lower,higher}}; + +byte this_one,last_one; + +char pressed; + +byte value; + +tunetype played; + +void store_(byte what) +{; + + move(played[2],played[1],sizeof(played)-1); + + played[31]=what; + +} + +boolean they_match() +{ + byte fv; +boolean they_match_result; +; + + for( fv=1; fv <= sizeof(played); fv ++) + if (played[fv]!=tune[fv]) + {; + they_match_result=false; + return they_match_result; + } + + they_match_result=true; + +return they_match_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + + textattr=30; clrscr; output << NL; + + do { + + pressed=upcase(readkey()); + + value=pos(pressed,keys); + + if (value>0) + {; + + last_one=this_one; + this_one=value; + + sound(notes[this_one]); + delay(100); + nosound; + + if (this_one> NL; + exit(0); + } + + } + + } while (!(pressed=='\33')); + + output << "*** PROGRAM STOPPED! ***" << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp new file mode 100644 index 000000000000..fc8f47ec513b --- /dev/null +++ b/engines/avalanche/g-room.cpp @@ -0,0 +1,413 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +/*$R+*/ + +const array<1,5,shortint> adjustment = {{7,0,7,7,7}}; + +const array<0,3,byte> plane_to_use = {{2,2,2,3}}; + +const array<1,5,byte> waveorder = {{5,1,2,3,4}}; + +const array<1,26,byte> glerkfade = + {{1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4,4,3,3,3,2,2,1}}; + +const array<1,18,byte> greldetfade = {{1,2,3,4,5,6,6,6,5,5,4,4,3,3,2,2,1,1}}; + +enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; +}; + +typedef array<1,6,0,3,0,34,1,9,byte> glerktype; + + +untyped_file f; +chunkblocktype cb; +array<1,5,2,3,0,65,0,25,byte> ghost; +byte fv; +pointer memlevel; +byte y,yy,bit,xofs; + +array<0,1,pointer> eyes; +pointer exclamation; +array<1,6,pointer> aargh; +array<1,3,pointer> bat; +glerktype* glerk; +array<1,5,pointer> green_eyes; +matrix<1,6,false,true,pointer> greldet; + +array<1,6,pointtype> aargh_where; + +integer gd,gm; boolean gb; + +byte glerkstage; + +integer bat_x,bat_y; word bat_count; shortint aargh_count; + +integer greldet_x,greldet_y; byte greldet_count; boolean red_greldet; + +void plain_grab() + /* Just grabs the next one and puts it where it's told to. */ +{ + integer xx,yy,xofs; +; + blockread(f,cb,sizeof(cb)); + + switch (cb.flavour) { + case ch_one: {; + xofs=cb.x / 8; + bit=3; + for( yy=0; yy <= cb.yl; yy ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + blockread(f,mem[0xa000*(yy+cb.y)*80+xofs],cb.xl / 8); + } + } + break; + case ch_ega: {; + xofs=cb.x / 8; + bit=3; + for( bit=0; bit <= 3; bit ++) + for( yy=0; yy <= cb.yl; yy ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + blockread(f,mem[0xa000*(yy+cb.y)*80+xofs],cb.xl / 8); + } + } + break; + } +} + +void get_me(pointer& p) +{; + blockread(f,cb,sizeof(cb)); + /* Take it for granted that cb.flavour = ch_BGI! */ + + {; + getmem(p,cb.size); + blockread(f,p,cb.size); + } +} + +void get_me_aargh(byte which) +{; + blockread(f,cb,sizeof(cb)); + /* Take it for granted that cb.flavour = ch_BGI! */ + + {; + getmem(aargh[which],cb.size); + blockread(f,aargh[which],cb.size); + } + + { + pointtype& with = aargh_where[which]; + + with.x=cb.x; + with.y=cb.y; + } +} + +void wait(word how_long) +{ + word i; char r; + + for( i=1; i <= how_long; i ++) + if (keypressed()) + { + sound(6177); + while (keypressed()) r=readkey(); + delay(1); + nosound; + } else + delay(1); +} + +void do_bat(); +static byte batimage; +static pointtype batsize; + +static void super_blank() +{ + pointtype oldsize; + + move(bat[batimage-1],oldsize,4); + bar(bat_x+batsize.x,bat_y,bat_x+oldsize.x,bat_y+oldsize.y); +} + +void do_bat() +{ + shortint dx,iy; + + bat_count += 1; + + if (odd(bat_count)) + { + switch (bat_count) { + case 1 ... 90: { dx=2; iy=1; batimage=1; } break; + case 91 ... 240: { dx=1; iy=1; batimage=2; } break; + case 241 ... 260: { dx=1; iy=4; batimage=3; } break; + } + + move(bat[batimage],batsize,4); + + if ((bat_count==91) || (bat_count==241)) + super_blank(); /* When the bat changes, blank out the old one. */ + + bar(bat_x,bat_y,bat_x+batsize.x,bat_y+iy); + bar(bat_x+batsize.x,bat_y,bat_x+batsize.x-dx,bat_y+batsize.y); + + bat_x -= dx; bat_y += 1; + putimage(bat_x,bat_y,bat[batimage],0); + } +} + +void big_green_eyes(byte how) +{ + putimage(330,103,green_eyes[how],0); + putimage(376,103,green_eyes[how],0); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + if (paramstr(1)!="jsb") exit(255); + gd=3; gm=0; initgraph(gd,gm,""); + fillchar(ghost,sizeof(ghost),'\0'); + + assign(f,"spooky.avd"); + reset(f,1); + seek(f,44); + + mark(memlevel); + + for( fv=1; fv <= 5; fv ++) + {; + blockread(f,cb,sizeof(cb)); + for( bit=2; bit <= 3; bit ++) + for( y=0; y <= cb.yl; y ++) + blockread(f,ghost[fv][bit][y],cb.xl / 8); + } + + get_me(eyes[0]); /* Get BGI-based ones */ + get_me(eyes[1]); + get_me(exclamation); + + plain_grab(); /* Grabs to screen (cobweb) */ + plain_grab(); /* Grabs to screen (Mark's signature) */ + plain_grab(); /* Grabs to screen (open door) */ + + for( fv=1; fv <= 3; fv ++) + get_me(bat[fv]); + +/* new(glerk); + for fv:=1 to 5 do { Grab the Glerk. } + begin; + blockread(f,cb,sizeof(cb)); + for bit:=0 to 3 do + for y:=0 to 34 do + blockread(f,glerk^[fv,bit,y],cb.xl div 8); + inc(gd,gm); + end; +*/ + + glerk = new glerktype; + + for( fv=1; fv <= 6; fv ++) + {; + blockread(f,cb,sizeof(cb)); + bit=3; + for( bit=0; bit <= 3; bit ++) + for( yy=0; yy <= cb.yl; yy ++) +/* begin; + port[$3c4]:=2; port[$3ce]:=4; + port[$3C5]:=1 shl bit; port[$3CF]:=bit;*/ + + blockread(f,(*glerk)[fv][bit][yy],cb.xl / 8); +/* move(glerk^[fv,bit,yy],mem[$A000:yy*80+177],xl div 8);*/ +/* blockread(f,mem[$A000:yy*80+177],xl div 8);*/ + +/* end;*/ + } + + for( fv=1; fv <= 6; fv ++) get_me_aargh(fv); + for( fv=1; fv <= 5; fv ++) get_me(green_eyes[fv]); + for( gb=false; gb <= true; gb ++) + for( fv=1; fv <= 6; fv ++) get_me(greldet[fv][gb]); + + close(f); + + /* Avvy walks over... */ + + setfillstyle(1,0); + glerkstage=0; bat_x=277; bat_y=40; bat_count=0; + + for( gd=500; gd >= 217; gd --) + {; + if (set::of(range(22,27), eos).has((gd % 30))) + {; + if ((gd % 30)==27) bar(gd,135,gd+16,136); + putimage(gd,136,eyes[0],0); + putpixel(gd+16,137,0); + } else + {; + if (gd % 30==21) bar(gd,137,gd+17,138); + + putimage(gd,135,eyes[0],0); + putpixel(gd+16,136,0); /* eyes would leave a trail 1 pixel high behind them */ + } + + /* Plot the Glerk: */ + if (gd % 10==0) + {; + glerkstage += 1; + if (glerkstage>26) flush(); + + for( gm=0; gm <= 34; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + move((*glerk)[glerkfade[glerkstage]][bit][gm], + mem[0xa000*1177+gm*80],9); + } + bit=getpixel(0,0); + } + + do_bat(); + + wait(15); + } + + setfillstyle(1,0); + bar(456,14,530,50); + + /* It descends... */ + + for( gm=-64; gm <= 103; gm ++) + {; + bit=getpixel(0,0); + + if (gm>0) + fillchar(mem[0xa000*(gm-1)*80],26,'\0'); + + for( y=0; y <= 65; y ++) + if ((y+gm)>=0) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + move(ghost[2+(abs(gm / 7) % 2)*3][plane_to_use[bit]][y], + mem[0xa000*(y+gm)*80],26); + } + + wait(27); + } + + /* And waves... */ + + aargh_count=-14; + + for( gd=1; gd <= 4; gd ++) + for( fv=1; fv <= 5; fv ++) + {; + + y=getpixel(0,0); + + for( y=0; y <= 7; y ++) + fillchar(mem[0xa000*7760+y*80],26,'\0'); + + for( y=0; y <= 65; y ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(ghost[waveorder[fv]][plane_to_use[bit]][y], + mem[0xa000*7760+(y+adjustment[fv])*80],26); + } + + aargh_count += 1; + + if (aargh_count>0) + { pointtype& with = aargh_where[aargh_count]; + putimage(with.x,with.y,aargh[aargh_count],0);} + + wait(177); + } + + /* ! appears */ + + gd=getpixel(0,0); + putimage(246,127,exclamation,0); + wait(777); + bar(172, 78,347,111); /* erase "aargh" */ + + for( gm=5; gm >= 1; gm --) + { + wait(377); + big_green_eyes(gm); + } + bar(246,127,251,133); /* erase the "!" */ + + /* He hurries back. */ + + glerkstage=1; greldet_count=18; red_greldet=false; + + for( gd=217; gd <= 479; gd ++) + {; + if (set::of(range(22,27), eos).has((gd % 30))) + {; + if ((gd % 30)==22) + bar(gd+22,134,gd+38,137); + putimage(gd+23,136,eyes[1],0); + putpixel(gd+22,137,0); + } else + {; + if (gd % 30==28) + bar(gd+22,135,gd+38,138); + + putimage(gd+23,135,eyes[1],0); + putpixel(gd+22,136,0); /* eyes would leave a trail 1 pixel high behind them */ + } + + /* Plot the Green Eyes: */ + if (gd % 53==5) + {; + big_green_eyes(glerkstage); + glerkstage += 1; + } + + /* Plot the Greldet: */ + + if (greldet_count==18) + { /* A new greldet. */ + greldet_x=Random(600); + greldet_y=Random(80); + greldet_count=0; + red_greldet=! red_greldet; + } + + greldet_count += 1; + putimage + (greldet_x,greldet_y,greldet[greldetfade[greldet_count]][red_greldet],0); + + wait(10); + } + + release(memlevel); + closegraph(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp new file mode 100644 index 000000000000..009a828e0ad8 --- /dev/null +++ b/engines/avalanche/golden.cpp @@ -0,0 +1,437 @@ +#include "ptoc.h" + + +/*$I c:\sleep5\DSMI.INC*/ #include "graph.h" +/*#include "Crt.h"*/ + + +const varying_string<255> song = +string("Golden slumbers kiss your eyes/Smiles awake you when you rise/")+ +"Sleep, pretty Baron, do not cry/And I will sing a lullaby.%Care you "+ +"know not, therefore sleep/While I o'er you watch do keep;/Sleep now, "+ +"du Lustie, do not cry/And I will leave the castle.*Bye!"; + +const integer scardcount = 13; + +const array<0,scardcount-1,integer> soundcards = + {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; + +const array<1,5,byte> holding = +{{ 24, /* 0 : 24 */ +64, /* 1 : 00 */ +128, /* 2 : 00 */ +152, /* 2 : 24 */ +170}}; /* 2 : 42 */ + +integer gd,gm; +byte fv; +word* skellern; +word s,o; +boolean firstverse; +word nexthangon; + +boolean nomusic; + +integer getsoundhardware(psoundcard scard) +{ + integer sc,i,autosel,select; + char ch; + integer e; + + + +integer getsoundhardware_result; +Lagain: + sc=detectgus(scard); + if (sc!=0) sc=detectpas(scard); + if (sc!=0) sc=detectaria(scard); + if (sc!=0) sc=detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); + + autosel=-1; +/* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13),select,e); + + /* Default entry? */ + if (select==0) select=autosel; + if (select!=autosel) { + /* clear all assumptions */ + sc=-1; + fillchar(scard,sizeof(tsoundcard),0); + scard->id=soundcards[select-1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id==id_dac) scard->ioport=0x378; + + /* Read user input */ + val(paramstr(15),i,e); + + if (i!=0) scard->ioport=i; + if (sc!=1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : scard->samplesize=2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: scard->stereo=true; + break; /* enable stereo */ + default: { + scard->samplesize=1; + scard->stereo=false; + } + } + + if (scard->id!=id_dac) { + val(paramstr(17),i,e); + + if (i!=0) scard->dmairq=i; + + val(paramstr(16),i,e); + + if (i!=0) scard->dmachannel=i; + } else { + /* Select correct DAC */ + scard->maxrate=44100; + if (select==11) { + scard->stereo=true; + scard->dmachannel=1; /* Special 'mark' */ + scard->maxrate=60000; + } else + if (select==12) { + scard->stereo=true; + scard->dmachannel=2; + scard->maxrate=60000; + if (scard->ioport==0) scard->ioport=0x378; + } else + if (select==13) { + scard->dmachannel=0; + scard->ioport=0x42; /* Special 'mark' */ + scard->maxrate=44100; + } + } + +/* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result=0; +return getsoundhardware_result; +} + +byte here() +{ + byte here_result; + here_result=(ampgetpattern % 3)*64+ampgetrow; + return here_result; +} + +void hold(word amount) +{ + *skellern=0; + do {; } while (!(*skellern>=amount)); +} + +void hangon(word forwhat) +{ + if (nomusic) + hold(40); + else + do { + if (keypressed()) exit(0); + } while (!(here()>=holding[forwhat])); +} + +tsoundcard scard; +tmcpstruct mcpstrc; +tdds dds; +pmodule module; +tsdi_init sdi; +integer e, +bufsize; +char ch; +boolean v86, +vdsok; +longint a,rate, +tempseg; +string answer; +pointer temp; +word flags; +word curch; +byte modulevolume; +array<0,4,tsampleinfo> sample; +array<0,31,word> voltable; + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + for( e=1; e <= paramcount; e ++) answer=paramstr(e); + + nomusic=paramstr(13)=='0'; + + if (! nomusic) + { + /* Read sound card information */ + if (getsoundhardware(&scard)==-1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id==id_gus) { + /* Initialize GUS player */ + #ifndef DPMI + scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ + #endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus,0,31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt,gus_timer); + } else { + /* Initialize Virtual DMA Specification */ + #ifndef DPMI + vdsok=vdsinit==0; + #else + vdsok=false; + #endif + + fillchar(mcpstrc,sizeof(tmcpstruct),0); + + /* Query for sampling rate */ + val(paramstr(14),a,e); + if (a>4000) rate=a; else rate=21000; + + /* Query for quality */ + mcpstrc.options=mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi=sdi_sb; + scard.maxrate=22000; + } + break; + case id_sbpro : { + sdi=sdi_sbpro; + scard.maxrate=22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi=sdi_pas; + scard.maxrate=44100; + } + break; + case id_sb16 : { + sdi=sdi_sb16; + scard.maxrate=44100; + } + break; + case id_aria : { + sdi=sdi_aria; + scard.maxrate=44100; + } + break; + case id_wss : { + sdi=sdi_wss; + scard.maxrate=48000; + } + break; + #ifndef DPMI + case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ + #endif + } + + mcpinitsounddevice(sdi,&scard); + a=mcp_tablesize; + mcpstrc.reqsize=0; + + /* Calculate mixing buffer size */ + bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize=0; + if ((mcpstrc.options & mcp_quality)>0) + if (scard.samplesize==1) a += mcp_qualitysize; else + a=mcp_tablesize16+mcp_qualitysize16; + if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; + + #ifdef DPMI + dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); + v86=(flags & 2)==0; + #endif + + /* Allocate volume table + mixing buffer */ + #ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg=0; + dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); + } else { + #endif + getmem(temp,a+longint(bufsize)); + if (temp==nil) exit(2); + #ifdef DPMI + tempseg=seg(temp); + } + #else + tempseg=seg(temp)+ofs(temp) / 16+1; + #endif + mcpstrc.bufferseg=tempseg; + mcpstrc.bufferphysical=-1; + + if (vdsok && (scard.id!=id_dac)) { + dds.size=bufsize; + dds.segment=tempseg; + dds.offset=0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; + } + if (mcpstrc.bufferphysical==-1) + #ifdef DPMI + mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); + #else + mcpstrc.bufferphysical=(longint)(tempseg) << 4; + #endif + + mcpstrc.buffersize=bufsize; + mcpstrc.samplingrate=rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc)!=0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp,0,31); + } + + /* Try to initialize AMP */ + if (ampinit(0)!=0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt,amp_timer); + + #ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id==id_dac) setdactimer(tsgettimerrate); + #endif + + if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; + + /* Load an example AMF */ + module=amploadmod("golden.mod",0); + if (module==nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) + && (scard.samplesize==2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); + cdisetupchannels(0,module->channelcount+2,&voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0,module->channelcount+2,nil); + } + + curch=module->channelcount; + modulevolume=64; + + /***/ ampplaymodule(module,0); + } + + val(paramstr(2),s,e); if (e!=0) exit(0); + val(paramstr(3),o,e); if (e!=0) exit(0); + skellern=ptr(s,o+1); + + gd=3; gm=0; initgraph(gd,gm,""); + + if (! nomusic) do {; } while (!(ampgetrow>=10)); + + setcolor(9); + for( gd=0; gd <= 320; gd ++) + { + rectangle(320-gd,100-gd / 2,320+gd,100+gd / 2); + } + + + gd=50; gm=20; + firstverse=true; + + hangon(1); nexthangon=2; + for( fv=1; fv <= 255; fv ++) + { + switch (song[fv]) { + case '/': { + gd=50; + gm += 15; + hangon(nexthangon); + nexthangon += 1; + } + break; + + case '%': { + gd=50; + gm += 35; + if (nomusic) + hold(15); + else + do {; } while (!(ampgetpattern>2)); + nexthangon=2; + hangon(1); + } + break; + + case '*': { + gd += 24; + hangon(5); + } + break; + + default: { + setcolor(1); outtextxy(gd+1,gm+1,song[fv]); + setcolor(0); outtextxy( gd , gm ,song[fv]); + gd += 12; + } + } + if (song[fv]==' ') hold(1); + if (keypressed()) exit(0); + } + + if (nomusic) + hold(25); + else + do {; } while (!(ampgetmodulestatus!=md_playing)); + + setcolor(0); + for( gd=320; gd >= 0; gd --) rectangle(320-gd,100-gd / 2,320+gd,100+gd / 2); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp new file mode 100644 index 000000000000..b530e45b08d2 --- /dev/null +++ b/engines/avalanche/gyro.cpp @@ -0,0 +1,532 @@ +#include "ptoc.h" + +/* + + + + + GYRO It all revolves around this bit! */ + +#define __gyro_implementation__ + + +#include "gyro.h" + + +#include "pingo.h" +#include "scrolls.h" +#include "lucerna.h" +#include "visa.h" +#include "acci.h" +#include "trip5.h" +#include "dropdown.h" +#include "basher.h" + + +const array<'\1',numobjs,varying_string<15> > things = + {{"Wine","Money-bag","Bodkin","Potion","Chastity belt", + "Crossbow bolt","Crossbow","Lute","Pilgrim's badge","Mushroom","Key", + "Bell","Scroll","Pen","Ink","Clothes","Habit","Onion"}}; + +const array<'\1',numobjs,char> thingchar = "WMBParCLguKeSnIohn"; /* V=Vinegar */ + +const array<'\1',numobjs,varying_string<17> > better = + {{"some wine","your money-bag","your bodkin","a potion","a chastity belt", + "a crossbow bolt","a crossbow","a lute","a pilgrim's badge","a mushroom", + "a key","a bell","a scroll","a pen","some ink","your clothes","a habit", + "an onion"}}; + +const array<'\1',numobjs,char> betterchar = "WMBParCLguKeSnIohn"; + +void newpointer(byte m) +{ + if (m==cmp) return; cmp=m; + { + ax=9; bx=(word)(mps[m].horzhotspot); cx=(word)(mps[m].verthotspot); + es=seg(mps[m].mask); dx=ofs(mps[m].mask); + } + intr(0x33,r); + load_a_mouse(m); +} + +void wait() /* makes hourglass */ +{ + newpointer(5); +} + +void on() +{ + if (set_of_enum()::of(m_yes,m_virtual, eos).has(visible)) return; + + r.ax=1; intr(0x33,r); visible=m_yes; + if (oncandopageswap) + { + r.ax=29; r.bx=cp; intr(0x33,r); /* show mouse on current page */ + } +} + +void on_virtual() +{ + switch (visible) { + case m_virtual: return; break; + case m_yes: off(); break; + } + + visible=m_virtual; +} + +void off() +{ + switch (visible) { + case m_no:case m_virtual : return; break; + case m_yes : { r.ax=2; intr(0x33,r); } break; + } + visible=m_no; +} + +void off_virtual() +{ + byte fv; + + if (visible!=m_virtual) return; + + for( fv=0; fv <= 1; fv ++) + { + setactivepage(fv); + wipe_vmc(1-fv); + } + setactivepage(1-cp); visible=m_no; +} + +void xycheck() /* only updates mx & my, not all other mouse vars */ +{ + r.ax=3; intr(0x33,r); /* getbuttonstatus */ + { + keystatus=bx; + mx=cx; my=dx; + } +} + +void hopto(integer x,integer y) /* Moves mouse pointer to x,y */ +{ + { + ax=4; + cx=x; + dx=y; + } + intr(0x33,r); +} + +void check() +{ + { ax=6; bx=0; } intr(0x33,r); /* getbuttonreleaseinfo */ + { + mrelease=bx; + mrx=cx; mry=dx; + } + { ax=5; bx=0; } intr(0x33,r); /* getbuttonpressinfo */ + { + mpress=bx; + mpx=cx; mpy=dx; + } + xycheck(); /* just to complete the job. */ +} + +void note(word hertz) +{ + if (soundfx) sound(hertz); +} + +void blip() +{ + byte fv; + + for( fv=1; fv <= 7; fv ++) { sound(177+(fv*200) % 177); delay(1); } + nosound; +} + +string strf(longint x) +{ + string q; + + string strf_result; + str(x,q); strf_result=q; + return strf_result; +} + +void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) +{ + byte fv; + + for( fv=0; fv <= border; fv ++) + { + setfillstyle(1,hc); + bar(x1+fv,y1+fv,x1+fv,y2-fv); + bar(x1+fv,y1+fv,x2-fv,y1+fv); + + setfillstyle(1,sc); + bar(x2-fv,y1+fv,x2-fv,y2-fv); + bar(x1+fv,y2-fv,x2-fv,y2-fv); + } +} + +void shbox(integer x1,integer y1,integer x2,integer y2, string t) +{ + const integer fc = 7; + + off(); + shadow(x1,y1,x2,y2,15,8); setfillstyle(1,fc); + bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); + setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; + outtextxy(x1,y1,t); + if (length(t)>1) + { + fillchar(t[2],length(t)-1,'\40'); t[1]='_'; + outtextxy(x1-1,y1+1,t); + } + on(); +} + +void newgame() /* This sets up the DNA for a completely new game. */ +{ + byte gd,gm; + + for( gm=1; gm <= numtr; gm ++) + { triptype& with = tr[gm]; + if (with.quick) done();} /* Deallocate sprite. Sorry, beta testers! */ + + tr[1].init(0,true); + alive=true; + + score=0; /*for gd:=0 to 5 do which[gd]:=1;*/ + fillchar(dna,sizeof(dna),'\0'); natural(); + normal_edit(); mousepage(0); + dna.spare_evening="answer a questionnaire"; + dna.like2drink="beer"; + + { + dna.pence=30; /* 2/6 */ dna.rw=stopped; dna.wearing=clothes; + dna.obj[money]=true; dna.obj[bodkin]=true; dna.obj[bell]=true; dna.obj[clothes]=true; + } + + thinks='\2'; objectlist(); + ontoolbar=false; seescroll=false; + + ppos[0][1]=-177; /*tr[1].appear(300,117,right);*/ gd=0; + for( gd=0; gd <= 30; gd ++) for( gm=0; gm <= 1; gm ++) also[gd][gm]=nil; +/* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ + him='\376'; her='\376'; it='\376'; last_person='\376'; /* = Pardon? */ + dna.pass_num=Random(30)+1; after_the_scroll=false; + dna.user_moves_avvy=false; doing_sprite_run=false; + dna.avvy_in_bed=true; enid_filename=""; + + for( gd=0; gd <= 1; gd ++) { cp=1-cp; getback(); } + + enterroom(1,1); new_game_for_trippancy(); + showscore(); + + standard_bar(); clock(); + sprite_run(); +} + +void click() /* "Audio keyboard feedback" */ +{ + sound(7177); delay(1); nosound; +} + +void slowdown() +{ +/* repeat until TSkellern>=howlong; TSkellern:=0;*/ + do {; } while (!(memw[storage_seg*skellern]>=howlong)); + memw[storage_seg*skellern]=0; +} + +boolean flagset(char x) +{ + boolean flagset_result; + flagset_result=pos(x,flags)>0; + return flagset_result; +} + +void force_numlock() +{ + if ((locks & num)>0) locks -= num; +} + +boolean pennycheck(word howmuchby) +{ + boolean pennycheck_result; + dna.pence -= howmuchby; + if (dna.pence<0) + { + dixi('Q',2); /* "you are now denariusless!" */ + pennycheck_result=false; + gameover(); + } else + pennycheck_result=true; + return pennycheck_result; +} + +string getname(char whose) +{ + string getname_result; + if (whose<'\257') getname_result=lads[whose]; else getname_result=lasses[whose]; + return getname_result; +} + +char getnamechar(char whose) +{ + char getnamechar_result; + if (whose<'\257') getnamechar_result=ladchar[whose-1]; + else getnamechar_result=lasschar[whose-1]; + return getnamechar_result; +} + +string get_thing(char which) +{ + string get_thing_result; + switch (which) { + case wine: switch (dna.winestate) { + case 1:case 4: get_thing_result=things[which]; break; + case 3: get_thing_result="Vinegar"; break; + } + break; + case onion: if (dna.rotten_onion) + get_thing_result="rotten onion"; + else get_thing_result=things[which]; + break; + default: get_thing_result=things[which]; + } + return get_thing_result; +} + +char get_thingchar(char which) +{ + char get_thingchar_result; + switch (which) { + case wine: if (dna.winestate==3) get_thingchar_result='V'; /* Vinegar */ + else get_thingchar_result=thingchar[which-1]; + break; + default: get_thingchar_result=thingchar[which-1]; + } + return get_thingchar_result; +} + +string get_better(char which) +{ + string get_better_result; + if (which>'\226') which -= 149; + switch (which) { + case wine: switch (dna.winestate) { + case 0:case 1:case 4: get_better_result=better[which]; break; + case 3: get_better_result="some vinegar"; break; + } + break; + case onion: if (dna.rotten_onion) + get_better_result="a rotten onion"; + else if (dna.onion_in_vinegar) + get_better_result="a pickled onion (in the vinegar)"; + else get_better_result=better[which]; + break; + default: + if ((which'\0')) + get_better_result=better[which]; else + get_better_result=""; + } + return get_better_result; +} + +string f5_does() + /* This procedure determines what f5 does. */ +{ + string f5_does_result; + switch (dna.room) { + case r__yours: + { + if (! dna.avvy_is_awake) + { /* He's asleep, =>= wake up. */ + f5_does_result=string(vb_wake)+"WWake up"; + return f5_does_result; + } + + if (dna.avvy_in_bed) + { /* In bed. => = get up. */ + f5_does_result=string(vb_stand)+"GGet up"; + return f5_does_result; + } + + } + break; + + case r__insidecardiffcastle: + { + if (dna.standing_on_dais) + f5_does_result=string(vb_climb)+"CClimb down"; + else + f5_does_result=string(vb_climb)+"CClimb up"; + return f5_does_result; + } + break; + + case r__nottspub: + { + if (dna.sitting_in_pub) + f5_does_result=string(vb_stand)+"SStand up"; + else + f5_does_result=string(vb_sit)+"SSit down"; + return f5_does_result; + } + break; + + case r__musicroom: + if (infield(7)) + { + f5_does_result=string(vb_play)+"PPlay the harp"; + return f5_does_result; + } + break; + } + + f5_does_result=pardon; /* If all else fails... */ + return f5_does_result; +} + +void plot_vmc(integer xx,integer yy, byte page_) +{ + if (visible!=m_virtual) return; + { + xx=xx+vmc.ofsx; if (xx<0) xx=0; + yy=yy+vmc.ofsy; if (yy<0) yy=0; + + setactivepage(1-cp); + getimage(xx,yy,xx+15,yy+15,vmc.backpic[page_]); + putimage(xx,yy,vmc.andpic,andput); + putimage(xx,yy,vmc.xorpic,xorput); + +/* setcolor( 0); outtextxy(xx+8,yy+16,''); outtextxy(xx,yy+16,''); + setcolor(11+page); + outtextxy(xx+8,yy+16,chr(48+roomtime mod 10)); + outtextxy(xx ,yy+16,chr(48+(roomtime div 10) mod 10));*/ + + { + pointtype& with1 = vmc.wherewas[page_]; + + with1.x=xx; + with1.y=yy; + } + } +} + +void wipe_vmc(byte page_) +{ + if (visible!=m_virtual) return; + { pointtype& with1 = vmc.wherewas[page_]; + if (with1.x!=maxint) + putimage(with1.x,with1.y,vmc.backpic[page_],0);} +} + +void setup_vmc() +{ + byte fv; + + { + getmem(vmc.andpic,mouse_size); + getmem(vmc.xorpic,mouse_size); + + for( fv=0; fv <= 1; fv ++) + { + getmem(vmc.backpic[fv],mouse_size); + vmc.wherewas[fv].x=maxint; + } + } +} + +void clear_vmc() +{ + byte fv; + + for( fv=0; fv <= 1; fv ++) vmc.wherewas[fv].x=maxint; +} + +void setminmaxhorzcurspos(word min,word max) /* phew */ +{ + { + ax=7; + cx=min; + dx=max; + } + intr(0x33,r); +} + +void setminmaxvertcurspos(word min,word max) +{ + { + ax=8; /* A guess. In the book, 7 */ + cx=min; + dx=max; + } + intr(0x33,r); +} + +void load_a_mouse(byte which) +{ + untyped_file f; + + assign(f,"mice.avd"); + reset(f,1); + seek(f,mouse_size*2*(which-1)+134); + + { + blockread(f,vmc.andpic,mouse_size); + blockread(f,vmc.xorpic,mouse_size); + close(f); + { + mp& with1 = mps[which]; + + vmc.ofsx=-with1.horzhotspot; + vmc.ofsy=-with1.verthotspot; + + setminmaxhorzcurspos(with1.horzhotspot+3,624+with1.horzhotspot); + setminmaxvertcurspos(with1.verthotspot,199); + } + } +} + +void background(byte x) { setbkcolor(x); } + +void hang_around_for_a_while() +{ + byte fv; + + for( fv=1; fv <= 28; fv ++) slowdown(); +} + +boolean mouse_near_text() +{ + boolean mouse_near_text_result; + mouse_near_text_result=(my>144) && (my<188); + return mouse_near_text_result; +} + +/* Super_Off and Super_On are two very useful procedures. Super_Off switches + the mouse cursor off, WHATEVER it's like. Super_On restores it again + afterwards. */ + +void super_off() +{ + super_was_off=visible==m_no; + if (super_was_off) return; + + super_was_virtual=visible==m_virtual; + + if (visible==m_virtual) off_virtual(); else off(); +} + +void super_on() +{ + if ((visible!=m_no) || (super_was_off)) return; + + if (super_was_virtual) on_virtual(); else on(); +} + + diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h new file mode 100644 index 000000000000..8a1fdb5c0a03 --- /dev/null +++ b/engines/avalanche/gyro.h @@ -0,0 +1,702 @@ +#ifndef __gyro_h__ +#define __gyro_h__ + + +#include "graph.h" +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ + + +const char numobjs = '\22'; /* always preface with a # */ +const integer maxobjs = 12; /* carry limit */ +const byte howlong = 1/*8*/; /* 18 ticks. */ + +const boolean oncandopageswap = true; /* Variable constant for overriding the + ability of On to switch pages. You may know better than On which page + to switch to. */ + +const integer num = 32; /* Code for Num Lock */ + +const integer mouse_size = 134; + +typedef void(*proc)(); + +struct postype { + word x,y,datapos; byte length; +}; + +struct mp { /* mouse-pointer */ + matrix<0,1,0,15,word> mask; + integer horzhotspot,verthotspot; +}; + +struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ + byte rw; /* Realway- just for convenience! */ + byte carrying; /* how many objects you're carrying... */ + array<'\1',numobjs,boolean> obj; /* ...and which ones they are. */ + integer score; /* your score, of course */ + longint pence; /* your current amount of dosh */ + byte room; /* your current room */ + char wearing; /* what you're wearing */ + byte swore; /* number of times you've sworn */ + byte saves; /* number of times this game has been saved */ + array<1,100,byte> rooms; /* Add one to each every time + you enter a room */ + byte alcohol; /* Your blood alcohol level. */ + byte playednim; /* How many times you've played Nim. */ + boolean wonnim; /* Have you *won* Nim? (That's harder.) */ + byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ + boolean cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ + + byte pass_num; /* Number of the password for this game. */ + boolean ayles_is_awake; /* pretty obvious! */ + byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ + byte avaricius_talk; /* How much Avaricius has said to you. */ + boolean bought_onion; /* Have you bought an onion yet? */ + boolean rotten_onion; /* And has it rotted? */ + boolean onion_in_vinegar; /* Is the onion in the vinegar? */ + + byte given2spludwick; /* 0 = nothing given, 1 = onion... */ + byte brummie_stairs; /* Progression through the stairs trick. */ + byte cardiff_things; /* Things you get asked in Cardiff. */ + + boolean cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ + + boolean avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ + boolean avvy_in_bed; /* True if Avvy's in bed, but awake. */ + + boolean user_moves_avvy; /* If this is false, the user has no + control over Avvy's movements. */ + + byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ + + boolean givenbadgetoiby; /* Have you given the badge to Iby yet? */ + + boolean friar_will_tie_you_up; /* If you're going to get tied up. */ + boolean tied_up; /* You ARE tied up! */ + + char box_contents; /* 0 = money (sixpence), 254 = empty, any + other number implies the contents of the box. */ + + boolean talked_to_crapulus; /* Pretty self-explanatory. */ + + byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ + + boolean ringing_bells; /* Is Jacques ringing the bells? */ + + boolean standing_on_dais; /* In room 71, inside Cardiff Castle. */ + boolean taken_pen; /* Have you taken the pen (in Cardiff?) */ + boolean arrow_triggered; /* And has the arrow been triggered? */ + boolean arrow_in_the_door; /* Did the arrow hit the wall? */ + + varying_string<77> like2drink, + favourite_song, + worst_place_on_earth, + spare_evening; /* Personalisation str's */ + + longint total_time; /* Your total time playing this game, in ticks.*/ + + byte jumpstatus; /* Fixes how high you're jumping. */ + + boolean mushroom_growing; /* Is the mushroom growing in 42? */ + + boolean spludwicks_here; /* Is Spludwick at home? */ + + byte last_room; + byte last_room_not_map; + + boolean crapulus_will_tell; /* Will Crapulus tell you about + Spludwick being away? */ + + boolean enter_catacombs_from_lusties_room; + boolean teetotal; /* Are we touching any more drinks? */ + byte malagauche; /* Position of Malagauche. See Celer for more info. */ + char drinking; /* What's he getting you? */ + + boolean entered_lusties_room_as_monk; + + byte cat_x, cat_y; /* XY coords in the catacombs. */ + + boolean avvys_in_the_cupboard; /* On screen 22. */ + + boolean geida_follows; /* Is Geida following you? */ + + byte geida_spin,geida_time; /* For the making "Geida dizzy" joke. */ + + byte nextbell; /* For the ringing. */ + + boolean geida_given_potion; /* Does Geida have the potion? */ + boolean lustie_is_asleep; /* Is BDL asleep? */ + + byte flip_to_where, flip_to_ped; /* For the sequencer. */ + + boolean been_tied_up; /* In r__Robins. */ + + boolean sitting_in_pub; /* Are you sitting down in the pub? */ + byte spurge_talk; /* Count for talking to Spurge. */ + + boolean met_avaroid; + + boolean taken_mushroom, + given_pen_to_ayles, + asked_dogfood_about_nim; +}; + +struct pedtype { + integer x,y; byte dir; +}; + +struct magictype { + byte op; /* one of the operations */ + word data; /* data for them */ +}; + +class fieldtype { +public: + integer x1,y1,x2,y2; +}; + +struct bytefield { + byte x1,y1,x2,y2; +}; + +class linetype : public fieldtype { +public: + byte col; +}; + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +typedef matrix<'\0','\377',0,15,byte> raw; /* raw_font_type */ + +enum controllers {cjoy,ckey, last_controllers}; + +typedef array<1,20,varying_string<77> > previoustype; + +struct corridor_type { /* Decarations for the corridors. */ + word doors; /* Door styles are calc'ed from this word. + Assign a different number to each one! */ +}; + +struct demo_type { + word delay; + char key,extd; +}; + +struct quasiped_type { + byte whichped,fgc,room,bgc; char who; +}; +/* A quasiped defines how people who aren't sprites talk. For example, + quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving + that to context. */ + +typedef array<1,31,byte> tunetype; + +struct vmctype { /* Virtual Mouse Cursor */ + pointer andpic,xorpic; + array<0,1,pointer> backpic; + array<0,1,pointtype> wherewas; + byte picnumber; + shortint ofsx,ofsy; +}; + +struct sundry { /* Things which must be saved over a backtobootstrap, + outside DNA. */ + pathstr qenid_filename; + boolean qsoundfx; + char qthinks; + boolean qthinkthing; +}; + +struct joysetup { + word xmid,ymid,xmin,ymin,xmax,ymax; + byte centre; /* Size of centre in tenths */ +}; + +struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1,9,char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + + /* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST + 7 = Archimedes */ + +const char vernum[] = "1.30"; +const char copyright[] = "1995"; +const integer thisvercode = 130; + /* as "vernum", but numerically & without the ".". */ +const integer thisgamecode = 2; /* Avalot's code number */ + +/* Objects you can hold: */ + const char wine = '\1'; const char money = '\2'; const char bodkin = '\3'; const char potion = '\4'; const char chastity = '\5'; const char bolt = '\6'; + const char crossbow = '\7'; const char lute = '\10'; const char badge = '\11'; const char mushroom = '\12'; const char key = '\13'; const char bell = '\14'; + const char prescription = '\15'; const char pen = '\16'; const char ink = '\17'; const char clothes = '\20'; const char habit = '\21'; const char onion = '\22'; + +/* People who hang around this game. */ + +/* Boys: */ +const char pavalot = '\226'; const char pspludwick = '\227'; const char pcrapulus = '\230'; const char pdrduck = '\231'; +const char pmalagauche = '\232'; const char pfriartuck = '\233'; const char probinhood = '\234'; const char pcwytalot = '\235'; +const char pdulustie = '\236'; const char pduke = '\237'; const char pdogfood = '\240'; const char ptrader = '\241'; +const char pibythneth = '\242'; const char payles = '\243'; const char pport = '\244'; const char pspurge = '\245'; const char pjacques = '\246'; + +/* Girls: */ +const char parkata = '\257'; const char pgeida = '\260'; const char pwisewoman = '\262'; + +const integer xw = 30; +const integer yw = 36; /* x width & y whatsit */ + +const integer margin = 5; + +const array<1,9,mp> mps = +{{{ /* 1 - up-arrow */ + {{{{65151,64575,64575,63519,63519,61455,61455,57351,57351,49155,49155,64575,64575,64575,64575,64575}}, + {{0,384,384,960,960,2016,2016,4080,4080,8184,384,384,384,384,384,0}}}}, + 8, + 0}, + +{ /* 2 - screwdriver */ + {{{{8191,4095,2047,34815,50175,61951,63743,64543,65039,65031,65027,65281,65408,65472,65505,65523}}, + {{0,24576,28672,12288,2048,1024,512,256,224,176,216,96,38,10,12,0}}}}, + 0, + 0}, + +{ /* 3 - right-arrow */ + {{{{65535,65535,64639,64543,7,1,0,1,7,64543,64639,65535,65535,65535,65535,65535}}, + {{0,0,0,384,480,32760,32766,32760,480,384,0,0,0,0,0,0}}}}, + 15, + 6}, + +{ /* 4 - fletch */ + {{{{255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511}}, + {{0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0}}}}, + 0, + 0}, + +{ /* 5 - hourglass */ + {{{{0,0,0,34785,50115,61455,61455,63519,63519,61839,61455,49155,32769,0,0,0}}, + {{0,32766,16386,12300,2064,1440,1440,576,576,1056,1440,3024,14316,16386,32766,0}}}}, + 8, + 7}, + +{ /* 6 - TTHand */ + {{{{62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443}}, + {{3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092}}}}, + 4, + 0}, + +{ /* 7- Mark's crosshairs */ + {{{{65535,65151,65151,65151,65151,0,65151,65151,65151,65151,65535,65535,65535,65535,65535,65535}}, + {{0,384,384,384,384,65535,384,384,384,384,0,0,0,0,0,0}}}}, + 8, + 5}, + +{ /* 8- I-beam. */ + {{{{65535,65535,63631,63503,63503,65087,65087,65087,65087,65087,63503,63503,63631,65535,65535,65535}}, + {{0,0,0,864,128,128,128,128,128,128,128,864,0,0,0,0}}}}, + 8, + 7}, + +{ /* 9- Question mark. */ + {{{{511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695}}, + {{65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840}}}}, + 0, + 0}}}; + +const array<'\226','\246',varying_string<19> > lads = + {{"Avalot","Spludwick","Crapulus","Dr. Duck","Malagauche","Friar Tuck", + "Robin Hood","Cwytalot","du Lustie","the Duke of Cardiff","Dogfood", + "A trader","Ibythneth","Ayles","Port","Spurge","Jacques"}}; + +const array<'\257','\262',varying_string<14> > lasses = + {{"Arkata","Geida",'',"the Wise Woman"}}; + + const array<'\226','\245',char> ladchar = "ASCDMTRwLfgeIyPu"; + +const array<'\257','\262',char> lasschar = "kGo"; + +const integer numtr = 2; /* current max no. of sprites */ + +const boolean a_thing = true; const boolean a_person = false; /* for Thinkabout */ + +/* Magic/portal commands are */ + +/*N*/ const integer nix = 0; /* ignore it if this line is touched */ +/*B*/ const integer bounces = 1; /* bounce off this line. Not valid for portals. */ +/*E*/ const integer exclaim = 2; /* put up a chain of scrolls */ +/*T*/ const integer transport = 3; /* enter new room */ +/*U*/ const integer unfinished = 4; /* unfinished connection */ +/*S*/ const integer special = 5; /* special function. */ +/*O*/ const integer mopendoor = 6; /* opening door. */ + +/* These following constants should be included in CFG when it's written. */ + + const boolean slow_computer = false; /* stops walking when mouse touches toolbar */ + +/* --- */ + +const integer border = 1; /* size of border on shadowboxes */ + +const integer pagetop = 81920; + + const integer up = 0; +const integer right = 1; + const integer down = 2; + const integer left = 3; +const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; + const integer stopped = 8; + +const integer walk = 3; +const integer run = 5; + +/*$I ROOMNUMS.INC - Room number constants (r__xxx) */ + +const array<'\226','\262',byte> whereis = + /* The Lads */ + {{r__yours, /* Avvy */ + r__spludwicks, /* Spludwick */ + r__outsideyours, /* Crapulus */ + r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + r__argentpub, /* Malagauche */ + r__robins, /* Friar Tuck. */ + 177, /* Robin Hood - can't meet him at the start. */ + r__brummieroad, /* Cwytalot */ + r__lustiesroom, /* Baron du Lustie. */ + r__outsidecardiffcastle, /* The Duke of Cardiff. */ + r__argentpub, /* Dogfood */ + r__outsideducks, /* Trader */ + r__argentpub, /* Ibythneth */ + r__aylesoffice, /* Ayles */ + r__nottspub, /* Port */ + r__nottspub, /* Spurge */ + r__musicroom, /* Jacques */ + 0,0,0,0,0,0,0,0, + /* The Lasses */ + r__yours, /* Arkata */ + r__geidas, /* Geida */ + 177, /* nobody allocated here! */ + r__wisewomans}}; /* The Wise Woman. */ + +/* Art gallery at 2,1; notice about this at 2,2. */ + +const matrix<1,8,1,8,longint> catamap = + /* Geida's room */ + /* 1 2 3 | 4 5 6 7 8*/ +{{{{0x204,0x200,0xd0f0,0xf0ff,0xff,0xd20f,0xd200,0x200}}, + {{0x50f1,0x20ff,0x2ff,0xff,0xe0ff,0x20ff,0x200f,0x7210}}, + {{0xe3f0,0xe10f,0x72f0,0xff,0xe0ff,0xff,0xff,0x800f}}, + {{0x2201,0x2030,0x800f,0x220,0x20f,0x30,0xff,0x23f}}, /* >> Oubliette */ + {{0x5024,0xf3,0xff,0x200f,0x22f0,0x20f,0x200,0x7260}}, + {{0xf0,0x2ff,0xe2ff,0xff,0x200f,0x50f0,0x72ff,0x201f}}, + {{0xf6,0x220f,0x22f0,0x30f,0xf0,0x20f,0x8200,0x2f0}}, /* <<< In here */ + {{0x34,0x200f,0x51f0,0x201f,0xf1,0x50ff,0x902f,0x2062}}}}; + /* vv Stairs trap. */ + +/* Explanation: $NSEW. + Nibble N: North. + 0 = no connection, + 2 = (left,) middle(, right) door with left-hand handle, + 5 = (left,) middle(, right) door with right-hand handle, + 7 = arch, + 8 = arch and 1 north of it, + 9 = arch and 2 north of it, + D = no connection + WINDOW, + E = no connection + TORCH, + F = recessed door (to Geida's room.) + + Nibble S: South. + 0 = no connection, + 1,2,3 = left, middle, right door. + + Nibble E: East. + 0 = no connection (wall), + 1 = no connection (wall + window), + 2 = wall with door, + 3 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. + + Nibble W: West. + 0 = no connection (wall), + 1 = no connection (wall + shield), + 2 = wall with door, + 3 = wall with door and shield, + 4 = no connection (window), + 5 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. */ + +const byte interrogation = 0; + /* If this is greater than zero, the next line you type is stored in + the DNA in a position dictated by the value. If a scroll comes up, + or you leave the room, it's automatically set to zero. */ + +const boolean demo = false; /* If this is true, we're in a demo of the game. */ + +const array<0,2,char> spludwick_order = {{onion,ink,mushroom}}; + +const array<10,25,quasiped_type> quasipeds = +{{{2,lightgray, 19,brown,pdogfood}, /* A: Dogfood (screen 19). */ +{3,green, 19,white,pibythneth}, /* B: Ibythneth (screen 19). */ +{3,white, 1,magenta,parkata}, /* C: Arkata (screen 1). */ +{3,black, 23,red,'\261'}, /* D: Hawk (screen 23). */ +{3,lightgreen,50,brown,ptrader}, /* E: Trader (screen 50). */ +{6,yellow, 42,red,pavalot}, /* F: Avvy, tied up (scr.42) */ +{2,blue, 16,white,payles}, /* G: Ayles (screen 16). */ +{2,brown, 7,white,pjacques}, /* H: Jacques (screen 7). */ +{2,lightgreen,47,green,pspurge}, /* I: Spurge (screen 47). */ +{3,yellow, 47,red,pavalot}, /* J: Avalot (screen 47). */ +{2,lightgray, 23,black,pdulustie}, /* K: du Lustie (screen 23). */ +{2,yellow, 27,red,pavalot}, /* L: Avalot (screen 27). */ +{3,white, 27,red,'\261'}, /* M: Avaroid (screen 27). */ +{4,lightgray, 19,darkgray,pmalagauche}, /*N: Malagauche (screen 19). */ +{5,lightmagenta,47,red,pport}, /* O: Port (screen 47). */ +{2,lightgreen, 51,darkgray,pdrduck}}}; /*P: Duck (screen 51). */ + + const integer lower = 0; + const integer same = 1; +const integer higher = 2; + +const array<1,12,char> keys = "QWERTYUIOP[]"; +const array<1,12,word> notes = + {{196,220,247,262,294,330,350,392,440,494,523,587}}; + +const tunetype tune = + {{higher,higher,lower,same,higher,higher,lower,higher,higher,higher, + lower,higher,higher, + same,higher,lower,lower,lower,lower,higher,higher,lower,lower,lower, + lower,same,lower,higher,same,lower,higher}}; + +/* special run-time errors */ + +const integer runerr_getset_overflow = 50; + + +#ifdef __gyro_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN varying_string<77> current; EXTERN byte curpos; EXTERN boolean cursoron; +/* previous:^previoustype;*/ +EXTERN varying_string<77> last; +EXTERN dnatype dna; +EXTERN array<1,50,linetype> lines; /* For Also. */ +EXTERN integer c; +EXTERN registers r; +EXTERN enum { m_no , m_yes , m_virtual } visible; +EXTERN boolean dropsok,screturn,soundfx,cheat; +EXTERN word mx,my; /* mouse x & y now */ +EXTERN word mpx,mpy; /* mouse x & y when pressed */ +EXTERN word mrx,mry; /* mouse x & y when released */ +EXTERN byte mpress,mrelease; /* times left mouse button has been pressed/released */ +EXTERN byte keystatus; /* Mouse key status */ +EXTERN array<1,10,varying_string<20> > un; +EXTERN byte unn; EXTERN string mousetext; +/* which:array[0..5] of byte;*/ +EXTERN pointer p; EXTERN boolean weirdword; +EXTERN byte to_do; EXTERN boolean lmo,mousemade; +EXTERN array<1,15,varying_string<50> > scroll; +EXTERN byte scrolln,score,whichwas; EXTERN char thinks; EXTERN boolean thinkthing; + +/* pp:array[1..1000] of postype; + bb:array[1..9000] of byte;*/ +EXTERN word pptr,bptr; +EXTERN matrix<0,0,0,1,integer> ppos; +EXTERN array<1,24,word> pozzes; +EXTERN byte anim; EXTERN pointer copier; +EXTERN integer talkx,talky; EXTERN byte talkb,talkf; +EXTERN byte scrollbells; /* no. of times to ring the bell */ +EXTERN boolean ontoolbar,seescroll; + +EXTERN array<1,10,char> objlist; +EXTERN array<'0','9',pointer> digit; +EXTERN array<0,8,pointer> rwlite; EXTERN byte oldrw; +EXTERN varying_string<3> lastscore; EXTERN byte cmp; /* current mouse-pointer */ +EXTERN varying_string<10> verbstr; /* what you can do with your object. :-) */ + +EXTERN matrix<0,30,0,1,string*> also; +EXTERN array<1,15,pedtype> peds; +EXTERN array<1,15,magictype> magics; +EXTERN array<9,15,magictype> portals; +EXTERN array<1,30,fieldtype> fields; EXTERN byte numfields; +EXTERN varying_string<26> flags; EXTERN string listen; + +EXTERN word oh,onh,om,h,m,s,s1; + +EXTERN varying_string<4> atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ + +EXTERN byte cp,ledstatus,defaultled; +EXTERN raw little; EXTERN boolean quote; /* 66 or 99 next? */ +EXTERN boolean alive; +EXTERN array<1,2000,char> buffer; EXTERN word bufsize; + +EXTERN byte oldjw; /* Old joystick-way */ +EXTERN controllers ctrl; + +EXTERN integer underscroll; /* Y-coord of just under the scroll text. */ + +/* TSkellern is only temporary, and I'll replace it + with a local version when it's all fixed up. */ + +/* tskellern:longint absolute $0:244; { Over int $61 }*/ + +EXTERN boolean ddmnow; /* Kludge so we don't have to keep referring to Dropdown */ +EXTERN varying_string<40> roomname; /* Name of this room */ + +EXTERN text logfile; EXTERN boolean logging,log_epson; + +EXTERN boolean cl_override; + +EXTERN byte locks; /*ABSOLUTE $40:$17;*/ + +EXTERN varying_string<20> subject; /* What you're talking to them about. */ +EXTERN byte subjnumber; /* The same thing. */ + +EXTERN boolean keyboardclick; /* Is a keyboard click noise wanted? */ + +EXTERN char him,her,it; +EXTERN longint roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ + +EXTERN boolean after_the_scroll; + + /* For the demo: */ +EXTERN demo_type demo_rec; +EXTERN file demofile; + +EXTERN char last_person; /* Last person to have been selected using the People + menu. */ + +EXTERN boolean doing_sprite_run; /* Only set to True if we're doing a sprite_run + at this moment. This stops the trippancy system from moving any of the + sprites. */ + +EXTERN vmctype vmc; +EXTERN string filetoload; + +EXTERN boolean holdthedawn; /* If this is true, calling Dawn will do nothing. + It's used, for example, at the start, to stop Load from dawning. */ + +EXTERN word storage_seg,storage_ofs; /* Seg and ofs of the Storage area. */ +EXTERN word skellern; /* Offset of the timer variable - 1 more than storage_OFS */ +EXTERN boolean reloaded; /* Is this NOT the primary loading? */ + +EXTERN boolean super_was_virtual,super_was_off; /* Used by Super_Off and Super_On */ + +EXTERN pathstr enid_filename; + +EXTERN joysetup js; +EXTERN word cxmin,cxmax,cymin,cymax; EXTERN boolean use_joy_a; +#undef EXTERN +#define EXTERN extern + + + void newpointer(byte m); + + void wait(); /* makes hourglass */ + + void on(); + + void off(); + + void on_virtual(); + + void off_virtual(); + + void xycheck(); + + void hopto(integer x,integer y); /* Moves mouse pointer to x,y */ + + void check(); + + void note(word hertz); + + void blip(); + + string strf(longint x); + + void shbox(integer x1,integer y1,integer x2,integer y2, string t); + + void newgame(); + + void click(); + + void slowdown(); + + boolean flagset(char x); + + void force_numlock(); + + boolean pennycheck(word howmuchby); + + string getname(char whose); + + char getnamechar(char whose); + + string get_thing(char which); + + char get_thingchar(char which); + + string get_better(char which); + + string f5_does(); + + void plot_vmc(integer xx,integer yy, byte page_); + + void wipe_vmc(byte page_); + + void setup_vmc(); + + void clear_vmc(); + + void load_a_mouse(byte which); + + void background(byte x); + + void hang_around_for_a_while(); + + void super_off(); + + void super_on(); + + boolean mouse_near_text(); + +#endif diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp new file mode 100644 index 000000000000..d155263306b8 --- /dev/null +++ b/engines/avalanche/help.cpp @@ -0,0 +1,225 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Rodent.h"*/ +/*#include "Crt.h"*/ + +typedef graphcursmasktype cursor; +const char vernum[] = "v100"; +const char copyright[] = "1992"; +const cursor questionmark = +{ + ((511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695), + (65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840)), + 0, + 0}; + +const array<1,7,varying_string<12> > topics = + {{"Front page","Background","Toolbar","Menus", + "Keyboard","Shareware","Exit Help"}}; + +const array<1,6,char> keys = "FBTMKS"; + +byte page_; +palettetype dp,dark; +char r; +boolean lmo; + +void hilight(integer x,integer y, byte c1,byte c2, string z) +{ + string w; +; + w=z; w[1]='\40'; setcolor(c1); outtextxy(x,y,w); + w=z; fillchar(w[2],length(z)-1,'\40'); setcolor(c2); + outtextxy(x,y,w); outtextxy(x-1,y,w); +} + +void showpage(byte x) +{; + if (x==page_) return; /* twit */ + if (x==7) {; lmo=true; return; } + setallpalette(dark); hidemousecursor; settextjustify(1,1); + if (page_!=177) + {; + setfillstyle(1,1); bar(507,page_*25+2,607,page_*25+22); + setfillstyle(1,9); bar(500,page_*25,600,page_*25+20); +/* setcolor(11); outtextxy(550,page*25+10,topics[page]);*/ + hilight(550,page_*25+10,11,14,topics[page_]); + } + page_=x; + setfillstyle(1,4); bar(507,page_*25+2,607,page_*25+22); + setfillstyle(1,12); bar(500,page_*25,600,page_*25+20); +/* setcolor(14); outtextxy(550,page*25+10,topics[page]); */ + hilight(550,page_*25+10,14,15,topics[page_]); + setfillstyle(1,7); bar(0,27,470,189); settextjustify(0,2); setcolor(1); + switch (page_) { + case 1: {; /* Front page */ + setcolor(black); + outtextxy( 10, 40,"Thorsoft of Letchworth presents"); + outtextxy(300, 80,vernum); + outtextxy( 10, 90,string("(c) ")+copyright+", Mike, Mark and Thomas Thurman."); + setcolor(red); + outtextxy(100,129,"Finding your way around it..."); + setcolor(blue); + outtextxy( 10,120,"You are now using the Help System."); + outtextxy( 10,138,"Press the first letter of the topic that you want to"); + outtextxy( 10,147,"read (eg T for (T)oolbar), or click on its button (on"); + outtextxy( 10,156,"the right) using the mouse. Use \"Exit Help\" to quit."); + outtextxy( 10,174,"(Fastest exit- just hit Esc!)"); + } + break; + case 2: {; /* Background */ + setcolor(red); + outtextxy(300, 30,"Remember this chap?"); + setcolor(blue); + outtextxy( 10, 55,"Back in good old A.D. 79, there lived a Roman"); + outtextxy( 10, 64,"whose name was Denarius Avaricius Sextus, known"); + outtextxy( 10, 73,"to his friends as Avvy. His wife was called Arkata,"); + outtextxy( 10, 82,"and he had a slave named Crapulus. His grandson"); + outtextxy( 10, 91,"joined the army, was posted to Gaul, and liked it"); + outtextxy( 10,100,"so much that he stayed there, telling everyone the"); + outtextxy( 10,109,"one about the centurion and the Turkish bath. His"); + outtextxy( 10,118,"thirty-sixth male-line descendant accidentally"); + outtextxy( 10,127,"poisoned an old enemy of William of Normandy, and"); + outtextxy( 10,136,"to his great surprise came so much into Bill's favour"); + outtextxy( 10,145,"that, after the Battle of Hastings a few years"); + outtextxy( 10,154,"later, he was made the lord of a small town in"); + outtextxy( 10,163,"Hertfordshire called Argent. It is his great-grandson"); + outtextxy( 10,172,"who stars in this game, back in good old A.D. 1189."); + } + break; + case 3: {; /* ? */ + outtextxy( 15, 30,"The Toolbar is there so that (along with the menus)"); + outtextxy( 15, 39,"you can perform a lot of the functions contained in"); + outtextxy( 15, 48,"the game, using the mouse."); + setcolor(red); + outtextxy( 15, 66,"COMPASS:"); + setcolor(blue); + outtextxy( 90, 66,"Used to point Avvy in the right direction."); + setcolor(red); + outtextxy( 15, 75,"THINKS:"); + setcolor(blue); + outtextxy( 90, 75,"Shows the person/object you're thinking of."); + setcolor(red); + outtextxy( 15, 84,"SCORE:"); + setcolor(blue); + outtextxy( 90, 84,"Shows how many points you've got."); + setcolor(red); + outtextxy( 15, 93,"SPEED:"); + setcolor(blue); + outtextxy( 90, 93,"Adjusts the speed of the game."); + setcolor(red); + outtextxy( 15,102,"L.E.D.s:"); + setcolor(blue); + outtextxy( 90,102,"Shows whether sound is on (toggle with ),"); + outtextxy( 90,111,"the computer is ready, or there is an error."); + setcolor(red); + outtextxy( 15,120,"CLOCK:"); + setcolor(blue); + outtextxy( 90,120,"Shows the time."); + setcolor(red); + outtextxy( 15,129,"'OK' box:"); + setcolor(blue); + outtextxy( 90,129,"Works the same as pressing ."); + setcolor(0); + outtextxy( 15,147,"N.B. The game action is suspended while you are"); + outtextxy( 15,156,"using the toolbar."); + } + break; + case 4: {; /* menus */ + outtextxy( 15, 60,"To use the drop-down menus, either click on the bar"); + outtextxy( 15, 69,"at the top with the mouse, or press Alt and the first"); + outtextxy( 15, 78,string("letter of the menu's name (eg alt-A = (A)ction.) The ")+'\3'); + outtextxy( 15, 87,"menu is alt-H, for (H)eart."); + outtextxy( 15,105,"When you have a menu, either click on the option you"); + outtextxy( 15,114,"want, or press its initial letter (eg O for \"OS Shell\")."); + outtextxy( 15,132,"To do something to, or with, an object or person, first"); + outtextxy( 15,141,"select them (or it) from the People or Things menu. Then"); + outtextxy( 15,150,"select whatever you wanted to do from the Use menu."); + setcolor(red); + outtextxy(15,177,"(OK, so it sounds complicated, but then it's intuitive!)"); + } + break; + case 5: {; /* Keyboard */ + outtextxy(15, 60,"The keyboard interface is even simpler than the mouse"); + outtextxy(15, 70,"interface! Just type what you want Avvy to do."); + outtextxy(15, 80,"For example, to open a door, type in:"); + setcolor(red); outtextxy(100,95,"open door"); setcolor(blue); + outtextxy(15,110,"And to look at Crapulus, type:"); + setcolor(red); outtextxy(100,125,"look at Crapulus"); + setcolor(blue); outtextxy(15,140,"(Don't forget to press Enter after each command!)"); + outtextxy(15,160,"This is a traditional command-line parser interface,"); + outtextxy(15,170,"similar to the one in \"Avaricius\", only more advanced."); + } + break; + case 6: {; /* ? */ + outtextxy(15, 30,"This game is Shareware. Most programs are sold through"); + outtextxy(15, 40,"shops, and the authors prevent you from copying them."); + outtextxy(15, 50,"Shareware is different. You may copy it and give it to"); + outtextxy(15, 60,"ANYBODY at all. You may post it on any BBS, give it to"); + outtextxy(15, 70,"friends, etc. If you like it, we ask you to pay us for"); + outtextxy(15, 80,"the software directly through the post. We're relying"); + outtextxy(15, 90,"on you to register!"); + outtextxy(99,177,"{ ETC }"); + } + break; + } + setallpalette(dp); showmousecursor; +} + +void helpsetup() +{ + integer gd,gm; +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); settextstyle(1,0,0); setcolor(11); + getpalette(dp); dark.size=dp.size; fillchar(dark.colors,dark.size,'\0'); + setallpalette(dark); setusercharsize(3,1,8,10); + for( gm=1; gm <= 3; gm ++) outtextxy(gm,0,"Avalot- HELP!"); + resetmouse; setgraphicscursor(questionmark); showmousecursor; + settextstyle(0,0,1); settextjustify(1,1); + for( gd=2; gd <= 7; gd ++) + {; + setfillstyle(1,1); bar(507,gd*25+2,607,gd*25+22); + setfillstyle(1,9); bar(500,gd*25,600,gd*25+20); +/* setcolor(11); outtextxy(550,gd*25+10,topics[gd]); */ + hilight(550,gd*25+10,11,14,topics[gd]); + } + showmousecursor; + page_=177; showpage(1); lmo=false; setfillstyle(1,7); + for( gd=1; gd <= 3; gd ++) + {; + bar( 10-gd*3,200-gd*3,490-gd*6,200-gd*3); + bar(490-gd*6, 37-gd*3,491-gd*6,200-gd*3); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + helpsetup(); + do { + do { getbuttonstatus; } while (!((mkey==left) || keypressed())); + if (keypressed()) + {; /* keyboard choice */ + r=upcase(readkey()); + if (pos(r,keys)>0) showpage(pos(r,keys)); else + if (r=='\0') + switch (readkey()) { /* grab extd keystroke */ + case 'H': if (page_>1) showpage(page_-1); break; + case 'P': if (page_<6) showpage(page_+1); break; + case 'G':case 'I': showpage(1); break; + case 'O':case 'Q': showpage(6); break; + } else + if (set::of('\33','Q','X','E','H', eos).has(r)) lmo=true; /* quit */ + } + else + {; /* mouse choice */ + if ((mousex>400) && (mousey>25)) + {; + showpage(mousey / 25); + } + } + } while (!lmo); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp new file mode 100644 index 000000000000..b062015aece0 --- /dev/null +++ b/engines/avalanche/help2.cpp @@ -0,0 +1,244 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +struct hypertype { + char trigger; + byte line; + byte start,finish; + word ref; +}; + +integer gd,gm; +array<1,2,fonttype> font; +matrix<0,7,1,80,byte> current; +array<1,250,varying_string<79> > data; +integer fv,position,size; +varying_string<79> title; +array<1,20,hypertype> link; +byte numlinks; +char r; +array<0,9,byte> reverse; +array<0,9,byte> revpos; + +void loadfont() +{ + file fontfile; +; + assign(fontfile,"c:\\thomas\\ttsmall.fnt"); reset(fontfile); + fontfile >> font[1]; close(fontfile); +/* assign(fontfile,'c:\avalot\avalot.fnt'); reset(fontfile); + read(fontfile,font[2]); close(fontfile);*/ + /* NB: We'll put BOTH of these fonts one after the other, in the same + file, in the final compilation. */ +} + +void scribe(byte which,byte what); + +static void underline(byte& x) {; x=x | 177; } + +void scribe(byte which,byte what) +{ + byte fv,ff; string x; +; + x=data[what]; + fillchar(current,sizeof(current),'\0'); + for( ff=1; ff <= length(x); ff ++) + for( fv=0; fv <= 7; fv ++) + {; + current[fv][ff]=font[which][x[ff]][fv]; + } + + for( fv=1; fv <= numlinks; fv ++) + { hypertype& with = link[fv]; + if (with.line==what) + for( ff=with.start; ff <= with.finish; ff ++) + underline(current[7][ff]);} + +} + +void display(word y) +{; + for( fv=0; fv <= 7; fv ++) + move(current[fv],mem[0xa000*(y+fv)*80],79); +} + +void update_link(char which, byte whence,byte whither) +{ + byte fv; +; + for( fv=1; fv <= numlinks; fv ++) + { hypertype& with = link[fv]; + if (with.trigger==which) + {; + with.line=size; + with.start=whence; + with.finish=whither; + }} +} + +void getlinks(string& x) +{ + byte p,q; +; + do { + p=pos("[",x); + if (p==0) return; /* lousy, huh? */ + q=pos("]",x); + update_link(x[p+1],p,q-3); + Delete(x,q,1); Delete(x,p,2); + } while (!false); +} + +void loaddata(byte which) +{ + text t; + string x; + integer e; +; + revpos[9]=position; + fillchar(data,sizeof(data),'\0'); + move(reverse[1],reverse[0],9); + move(revpos[1],revpos[0],9); + reverse[9]=which; revpos[9]=1; + + str(which,x); + assign(t,string('h')+x+".raw"); + reset(t); + t >> title >> NL; + size=0; numlinks=0; + while (! eof(t)) + {; + t >> x >> NL; + if (x[1]==':') + {; + numlinks += 1; + { + hypertype& with = link[numlinks]; + ; + with.trigger=x[2]; + Delete(x,1,3); + Delete(x,pos(" ",x),255); + val(x,with.ref,e); + } + } else {; + size += 1; + getlinks(x); + data[size]=x; + } + } + position=1; size -= 15; + close(t); +} + +void screen() +{; + setbkcolor(1); + setfillstyle(1,1); bar(0,0,640,38); + setfillstyle(1,14); bar(0,39,640,39); +} + +void showscreen() +{ + byte fv; +; + if (position<1) position=1; + for( fv=0; fv <= 15; fv ++) + {; + scribe(1,fv+position); + display(41+fv*10); + } +} + +void up() +{ + byte fv; +; + position -= 1; + scribe(1,position); + for( fv=0; fv <= 9; fv ++) + {; + move(mem[0xa000*3200],mem[0xa000*3280],12720); + if (set::of(0,9, eos).has(fv)) fillchar(mem[0xa000*3200],79,'\0'); else + move(current[8-fv],mem[0xa000*3200],80); + } +} + +void down() +{ + byte fv; +; + position += 1; + scribe(1,position+15); + for( fv=0; fv <= 9; fv ++) + {; + move(mem[0xa000*3280],mem[0xa000*3200],12720); + if (set::of(0,9, eos).has(fv)) fillchar(mem[0xa000*15920],79,'\0'); else + move(current[fv-1],mem[0xa000*15920],80); + } +} + +void newpage(char c) +{ + byte fv; +; + for( fv=1; fv <= numlinks; fv ++) + { hypertype& with = link[fv]; + if (with.trigger==c) + {; + loaddata(with.ref); + showscreen(); + }} +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + loadfont(); + screen(); + loaddata(0); + showscreen(); + fillchar(reverse,sizeof(reverse),'\0'); + fillchar(revpos,sizeof(revpos),'\1'); + do { + r=upcase(readkey()); + switch (r) { + case '\0': switch (readkey()) { + case 'H': if (position>1) up(); break; + case 'P': if (position buttons; + +void plot_button(integer y, byte which) +{ + untyped_file f; + pointer p; + + getmem(p,buttonsize); + assign(f,"buttons.avd"); + reset(f,1); + seek(f,which*buttonsize); + blockread(f,p,buttonsize); + putimage(470,y,p,0); + close(f); + freemem(p,buttonsize); +} + +void getme(byte which); + + +static void chalk(byte y, string z) +{ + outtextxy(16,41+y*10,z); +} + +void getme(byte which) /* Help icons are 80x20 */ +{ + string x; + text t; + byte y,fv; + + + str(which,x); + assign(t,string('h')+x+".raw"); + y=0; + reset(t); + + t >> x >> NL; + setfillstyle(1,1); bar(0,0,640,200); + setfillstyle(1,15); bar(8,40,450,200); + settextjustify(1,1); setcolor(14); + outtextxy(320,15,x); + settextjustify(0,2); + setcolor(3); settextstyle(0,0,2); + outtextxy(550,0,"help!"); + /***/ setcolor(0); settextstyle(0,0,1); + + do { + t >> x >> NL; + if (x=='!') flush(); /* End of the help text is signalled with a !. */ + chalk(y,x); + y += 1; + } while (!false); + + /* We are now at the end of the text. Next we must read the icons. */ + + y=0; settextjustify(1,1); setcolor(3); + while (! eof(t)) + { + y += 1; + t >> x >> NL; /* Get the name of this button, and... */ + if (x!='-') /* (hyphen signals an empty button.) */ + { + t >> buttons[y].trigger >> NL; + t >> fv >> NL; plot_button(13+y*27,fv); + t >> buttons[y].whither >> NL; /* this is the position to jump to */ + + switch (buttons[y].trigger) { + case '' : outtextxy(580,25+y*27,"Esc"); break; + case '' : outtextxy(580,25+y*27,"\30"); break; + case '' : outtextxy(580,25+y*27,"\31"); break; + default: + outtextxy(580,25+y*27,buttons[y].trigger); + } + + } else buttons[y].trigger='\0'; + } + + settextjustify(0,2); + close(t); +} + +void continue_help() +{ + char r; + byte fv; + + do { + r=upcase(readkey()); + switch (r) { + case '\33' : return; break; + case '\0' : switch (readkey()) { + case '\110':case '\111': r=''; break; + case '\120':case '\121': r=''; break; + case '\73': r='H'; break; /* Help on help */ + } + break; + } + + for( fv=1; fv <= 10; fv ++) + { buttontype& with = buttons[fv]; + if (with.trigger==r) + { + dusk; + getme(with.whither); + dawn; + flush(); + }} + + } while (!false); +} + +void boot_help() +{ + setactivepage(2); + + getme(0); + + dusk; + setvisualpage(2); + dawn; + + continue_help(); + + dusk; + setvisualpage(cp); + draw_also_lines; + setactivepage(1-cp); + dawn; +} + diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h new file mode 100644 index 000000000000..12a78690923d --- /dev/null +++ b/engines/avalanche/helpbak.h @@ -0,0 +1,11 @@ +#ifndef __helpbak_h__ +#define __helpbak_h__ + + +#include "graph.h" +/*#include "Gyro.h"*/ + + +void boot_help(); + +#endif diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp new file mode 100644 index 000000000000..50e6a074d830 --- /dev/null +++ b/engines/avalanche/helper.cpp @@ -0,0 +1,282 @@ +#include "ptoc.h" + +/* + + + + + HELPER The help system unit. */ + +#define __helper_implementation__ + + +#include "helper.h" + + +/*#include "Crt.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Pingo.h"*/ + + +struct buttontype { + char trigger; + byte whither; +}; + +const integer buttonsize = 930; + +const integer toolbar = 0; const integer nim = 1; const integer kbd = 2; const integer credits = 3; const integer joystick = 4; const integer troubleshooting = 5; const integer story = 6; +const integer mainscreen = 7; const integer registering = 8; const integer sound = 9; const integer mouse = 10; const integer filer = 11; const integer back2game = 12; +const integer helponhelp = 13; const integer pgdn = 14; const integer pgup = 15; + +array<1,10,buttontype> buttons; +byte highlight_was; + +void plot_button(integer y, byte which) +{ + untyped_file f; + pointer p; + + if (y>200) + { background(2); delay(10); background(0); return; } /* Silly buttons. */ + getmem(p,buttonsize); + assign(f,"buttons.avd"); + reset(f,1); + seek(f,which*buttonsize); + blockread(f,p,buttonsize); + + if (y==-177) + putimage(229,5,p,0); + else + putimage(470,y,p,0); + close(f); + freemem(p,buttonsize); +} + +void getme(byte which); + +static untyped_file f; + + +static void chalk(byte y, string z) +{ + outtextxy(16,41+y*10,z); +} + + + +static void getline(string& x) +{ + byte fz; + + blockread(f,x[0],1); + blockread(f,x[1],(byte)(x[0])); + for( fz=1; fz <= length(x); fz ++) + x[fz]=chr(ord(x[fz]) ^ 177); +} + +void getme(byte which) /* Help icons are 80x20 */ +{ + string x; + byte y,fv; + word offset; + + + off; + assign(f,"help.avd"); + y=0; + highlight_was=177; /* Forget where the highlight was. */ + reset(f,1); + seek(f,which*2); + blockread(f,offset,2); + seek(f,offset); + + getline(x); + setfillstyle(1,1); bar(0,0,640,200); + setfillstyle(1,15); bar(8,40,450,200); + settextjustify(2,2); + blockread(f,fv,1); + plot_button(-177,fv); + + setcolor(0); outtextxy(629,26,x); /* Plot the title. */ + setcolor(3); outtextxy(630,25,x); + + settextjustify(0,2); settextstyle(0,0,2); + setcolor(0); outtextxy(549,1,"help!"); + setcolor(3); outtextxy(550,0,"help!"); + /***/ settextstyle(0,0,1); + + do { + getline(x); + if (x=='!') flush(); /* End of the help text is signalled with a !. */ + if (x[1]=='\\') + { + setcolor(4); + chalk(y,copy(x,2,255)); + } else + { + setcolor(0); + chalk(y,x); + } + y += 1; + } while (!false); + + /* We are now at the end of the text. Next we must read the icons. */ + + y=0; settextjustify(1,1); settextstyle(0,0,2); + while (! eof(f)) + { + y += 1; + blockread(f,buttons[y].trigger,1); + if (buttons[y].trigger=='\261') flush(); + blockread(f,fv,1); + if (buttons[y].trigger!='\0') plot_button(13+y*27,fv); + blockread(f,buttons[y].whither,1); /* this is the position to jump to */ + + + switch (buttons[y].trigger) { + case '' : x="Esc"; break; + case '' : x='\30'; break; + case '' : x='\31'; break; + default: + x=buttons[y].trigger; + } + setcolor(0); outtextxy(589,26+y*27,x); + setcolor(3); outtextxy(590,25+y*27,x); + + } + + settextjustify(0,2); settextstyle(0,0,1); + close(f); on; +} + + +byte check_mouse(); + /* Returns clicked-on button, or 0 if none. */ +static void light(byte which,byte colour) +{ + if (which==177) return; /* Dummy value for "no button at all". */ + setcolor(colour); which=which & 31; + rectangle(466,11+which*27,555,35+which*27); +} + +byte check_mouse() +{ + byte h_is; + + byte check_mouse_result; + check; + + if (mrelease!=0) + { /* Clicked *somewhere*... */ + if ((mx<470) || (mx>550) || (((my-13) % 27)>20)) + check_mouse_result=0; else + /* Clicked on a button. */ + check_mouse_result=((my-13) / 27); + } else + { + if ((mx>470) && (mx<=550) && (((my-13) % 27)<=20)) + { /* No click, so highlight. */ + h_is=(my-13) / 27; + if ((h_is<1) || (h_is>6)) h_is=177; /* In case of silly values. */ + } else h_is=177; + + if ((h_is!=177) && ((keystatus & 1)>0)) h_is += 32; + + if (h_is!=highlight_was) + { + off; + light(highlight_was,1); + highlight_was=h_is; + if (buttons[h_is & 31].trigger!='\0') + { + if (h_is>31) light(h_is,11); else light(h_is,9); + } + on; + } + + check_mouse_result=0; + } + return check_mouse_result; +} + +void continue_help() +{ + char r; + byte fv; + + do { + while (! keypressed()) + { + fv=check_mouse(); + + if (fv>0) + switch (buttons[fv].trigger) { + case '\0':/*null*/; break; + case '\376': return; break; + default: { + dusk; + getme(buttons[fv].whither); + dawn; + continue_; + } + } + + } + r=upcase(readkey()); + switch (r) { + case '\33' : return; break; + case '\0' : switch (readkey()) { + case '\110':case '\111': r=''; break; + case '\120':case '\121': r=''; break; + case '\73': r='H'; break; /* Help on help */ + default: continue_; + } + break; + } + + for( fv=1; fv <= 10; fv ++) + { buttontype& with = buttons[fv]; + if (with.trigger==r) + { + dusk; + getme(with.whither); + dawn; + flush(); + }} + + } while (!false); +} + +void boot_help() +{ + byte groi; + + dusk; + off; + oncandopageswap=false; highlight_was=177; + copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); + + /* Set up mouse. */ + off_virtual; + newpointer(2); + setactivepage(3); setvisualpage(3); + + getme(0); + dawn; + + newpointer(9); on; + mousepage(3); + + continue_help(); + + mousepage(cp); + dusk; off; + oncandopageswap=true; + copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); + on_virtual; dawn; fix_flashers; + + setvisualpage(cp); + setactivepage(1-cp); +} + diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h new file mode 100644 index 000000000000..9c1c43ca4267 --- /dev/null +++ b/engines/avalanche/helper.h @@ -0,0 +1,11 @@ +#ifndef __helper_h__ +#define __helper_h__ + + +#include "graph.h" +/*#include "Gyro.h"*/ + + +void boot_help(); + +#endif diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp new file mode 100644 index 000000000000..8dba55c3c319 --- /dev/null +++ b/engines/avalanche/hibits.cpp @@ -0,0 +1,27 @@ +#include "ptoc.h" + + +file inf,outf; +char x; +string q; +byte fv; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(inf,"v:thank.you"); + assign(outf,"d:hibits.out"); + reset(inf); rewrite(outf); + + q=string('\40')+"(Seven is a bit of a lucky number.)"+'\40'+'\215'+'\212'+'\212'; + + for( fv=1; fv <= length(q); fv ++) outf << q[fv]; + + while (! eof(inf)) + {; + inf >> x; + if (x<'\200') x += 128; + outf << x; + } + close(inf); close(outf); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp new file mode 100644 index 000000000000..2ffd27198ba2 --- /dev/null +++ b/engines/avalanche/highs.cpp @@ -0,0 +1,116 @@ +#include "ptoc.h" + +/* + + + + + HIGHS This handles the high-scores. */ + +#define __highs_implementation__ + + +#include "highs.h" + + +/*#include "Gyro.h"*/ +/*#include "Scrolls.h"*/ + + +typedef array<1,12,struct A1 { + varying_string<30> name; + word score; + varying_string<12> rank; + }> highscoretype; + +highscoretype h; + +void get_new_highs() +{ + byte fv; +; + for( fv=1; fv <= 12; fv ++) + { + A1& with = h[fv]; + ; + with.score=32-fv*2; + with.rank="..."; + } + h[1].name="Mike"; h[2].name="Liz"; h[3].name="Thomas"; h[4].name="Mark"; + h[5].name="Mandy"; h[6].name="Andrew"; h[7].name="Lucy Tryphena"; + h[8].name="Tammy the dog"; + h[9].name="Avaricius"; h[10].name="Spellchick"; h[11].name="Caddelli"; + h[12].name="Spludwick"; +} + +void show_highs() + /* This procedure shows the high-scores. */ +{ + byte fv; + varying_string<40> x; + varying_string<5> y; +; + display("HIGH SCORERS\3\r Name\n\nScore Rank\r \"\"\"\"\n\n\"\"\"\"\" \"\"\"\"\f\4"); + for( fv=1; fv <= 12; fv ++) + { + A1& with = h[fv]; + ; + display(string('\15')+with.name+'\4'); + fillchar(x,sizeof(x),'\40'); + y=strf(with.score); + x[0]=chr(29-(length(with.name+y))); + display(x+y+' '+with.rank+'\4'); + } + + display(""); +} + +void store_high(string who) + /* This procedure shows the high-scores. */ +{ + byte fv,ff; +; + + for( fv=1; fv <= 12; fv ++) + if (h[fv].score f; +; + /*$I-*/ + assign(f,"scores.avd"); + reset(f); + /* Did we get it? */ + + if (ioresult!=0) + {; /* No. */ + get_new_highs(); /* Invent one. */ + } else + {; /* Yes. */ + f >> h; + close(f); + } +} + +class unit_highs_initialize { + public: unit_highs_initialize(); +}; +static unit_highs_initialize highs_constructor; + +unit_highs_initialize::unit_highs_initialize() {; + get_highs(); +} \ No newline at end of file diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h new file mode 100644 index 000000000000..3d6eb65807b5 --- /dev/null +++ b/engines/avalanche/highs.h @@ -0,0 +1,9 @@ +#ifndef __highs_h__ +#define __highs_h__ + + + void show_highs(); + + void store_high(string who); + +#endif diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp new file mode 100644 index 000000000000..bcff8ab2bd78 --- /dev/null +++ b/engines/avalanche/hiz.cpp @@ -0,0 +1,287 @@ +#include "ptoc.h" + + +/*$M 6000,600,600*/ +/*$V-,I-,R-,F+*/ /* Do not change these directives. */ +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Dos.h"*/ +/*#include "Tsru.h"*/ + + + /* program's signature */ +const varying_string<20> tsr_tmark = "FISH FISH FISH!!!"; + +integer gd,gm; +byte a /*absolute $A000:0*/; +matrix<1,800,0,3,byte> sv; +byte bit; string nam; +byte tsr_int; word tsr_ax; + +void grab() +{; + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(a,sv[1][bit],800); + } +} + +void drop() +{; + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(sv[1][bit],a,800); + } +} + +void say(string x) +{; + grab(); output << string('\15')+x; +} + +void pak(string x) +{ + char r; +; + say(x+" (press any key...)"); r=readkey(); drop(); +} + +string typein() +{ + char r; string x; +string typein_result; +; + x=""; + do { + r=readkey(); + switch (r) { + case '\10': if (x[0]>'\0') {; output << string('\10')+'\40'+'\10'; x[0] -= 1; } break; + case '\15': {; typein_result=x; return typein_result; } break; + case '\33': {; typein_result=""; return typein_result; } break; + default: if (x[0]<'\62') {; x=x+r; output << r; } + } + } while (!false); +return typein_result; +} + +void load() +{ + byte a /*absolute $A000:1200*/; untyped_file f; +; + say("LOAD: filename?"); nam=typein(); drop(); + if (nam=="") return; + assign(f,nam); reset(f,1); + if (ioresult!=0) + {; + pak("LOAD: file not found."); return; + } + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,12080); + if (ioresult!=0) + {; + pak("LOAD: error whilst loading."); close(f); return; + } + } + close(f); +} + +void save() +{ + const string header = + string("This is a file from an Avvy game, and its contents are subject to ")+ + "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; + untyped_file f; varying_string<30> screenname; searchrec s; char r; +byte a /*absolute $A000:1200*/; +; + say("SAVE: filename?"); nam=typein(); drop(); + if (nam=="") return; + findfirst(nam,anyfile,s); if (doserror==0) + {; + say("SAVE: That exists, are you sure\? (Y/N)"); + do { r=upcase(readkey()); } while (!(set::of('Y','N', eos).has(r))); drop(); + if (r=='N') return; + } + screenname="Saved with HIZ."; + assign(f,nam); rewrite(f,1); blockwrite(f,header[1],146); + blockwrite(f,screenname,31); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,a,12080); + if (ioresult!=0) + {; + pak("SAVE: error whilst saving."); close(f); return; + } + } +} + +void hedges() +{; + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + fillchar(mem[0xa000*14*80],80,'\377'); + fillchar(mem[0xa000*166*80],80,'\377'); + } +} + +void reset_() +{ + registers regs; +; + regs.ax=14; + intr(0x10,regs); + directvideo=false; +} + +void do_pop() +{ + char r; +; + do { + say("HIZ: Load Save Hedges Reset eXit?"); r=upcase(readkey()); drop(); + switch (r) { + case 'L': load(); break; + case 'S': save(); break; + case 'H': hedges(); break; + case 'R': reset_(); break; + case 'X': return; break; + } + } while (!false); +} + +/* Now for the TSR stuff */ + +void mypoprtn() +{ + registers r; +; + beginpop; + do_pop(); + endpop; +} +/**********************/ +void stop_tsr() +{; + if (tsrexit) + output << "HIZ stopped" << NL; + else + output << "Unable to stop HIZ - other TSR has been installed." << NL; +} +/**********************/ +/* This interrupt is called at program start-up. Its purpose is to provide + a way to communicate with an installed copy of the TSR through cmdline + params. The installation of the intrpt serves to prevent any attempt to + install a 2nd copy of the TSR */ +void tsr_intrtn(word flags,word cs,word ip,word ax,word bx,word cx,word dx,word si,word di,word ds,word es,word bp) +/*interrupt;*/ +{; + tsr_ax=ax; + cli; + beginint; + sti; + + switch (tsr_ax) { + case 1: {; + stop_tsr(); /* Terminate TSR, if poss.*/ + } + break; + case 2: {; + tsroff= true; /* Suspend TSR */ + output << "HIZ suspended." << NL; + } + break; + case 3: {; + tsroff=false; + output << "HIZ restarted" << NL; + } + break; + } + cli; + endint; + sti; +} +/*******************/ +byte i; +registers r; +string st; +boolean b; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + + /********************************************/ + /* Check to see if TSR is already installed */ + /********************************************/ + + tsr_int=dupcheck(tsr_tmark,&tsr_intrtn); + + /*****************************************/ + /* If it IS already installed, check for */ + /* parameter. */ + /*****************************************/ + + if (tsr_int > 0) + { + if (paramcount>0) + { + st=paramstr(1); + for( i=1; i <= length(st); i ++) + st[i]=upcase(st[i]); + if (st=="STOP") + r.ax=1; + else if (st=="HOLD") r.ax=2; + else if (st=="RSTR") r.ax=3; + else r.ax=4; + + if (r.ax<4) + {; + intr(tsr_int,r); + return 0; + } + else + {; + output << "HIZ: invalid parameter " << paramstr(1) << NL; + output << "Syntax: HIZ stop/hold/rstr" << NL; + return 0; + } + } + else + {; + output << "HIZ already installed." << NL; + output << "(If you're sure it isn't, try running BLANKINT /I." << NL; + output << "It's in the TURBO directory.)" << NL; + } + return 0; + } + + output << string("Wait...")+'\15'; /* tell 'em to wait...! */ + + /* Call PopSetUp to point to PopUp routine. Include the + scancode and the keymask to activate the program. In + this example, the scancode is $23 (H) and the + keymask is 08h (Alt.) */ + + popsetup(&mypoprtn,0x23,0x8); + + directvideo=false; + output << " v1.0, (c) 1992, Thomas Thurman." << NL; + output << " " << NL; + output << " The AVD saving/loading/hedging program." << NL; + output << " Use with Dr. Genius. The Hot Key is Ctrl-Alt-H." << NL; + + output << NL; + output << " Enter \"HIZ stop\" to remove Hiz from memory" << NL; + output << " \"HIZ hold\" to temporarily halt Hiz" << NL; + output << " \"HIZ rstr\" to restart Hiz" << NL; + stacksw=-1; + install_int; + keep(0); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp new file mode 100644 index 000000000000..4103089cf54c --- /dev/null +++ b/engines/avalanche/incline.cpp @@ -0,0 +1,172 @@ +#include "ptoc.h" + +/* + + + + + INCLINE The command-line parser. */ + +#define __incline_implementation__ + + +#include "incline.h" + +#include "gyro.h" +#include "logger.h" + + +byte fv; +char t; +string bugline; +boolean zoomy,numlockhold; + +boolean filename_specified; + +void syntax() +{ + assign(output,""); rewrite(output); + output << NL; + output << string("Lord Avalot d'Argent\n\n(c) ")+copyright+" Mark, Mike and Thomas Thurman." << NL; + output << string("~~~~~~~~~~~~~~~~~~~~~\n\n")+vernum << NL; + output << NL; + output << "Syntax:" << NL; + output << "\n/?\ndisplays this screen," << NL; + output << "\n/O\noverrides EGA check," << NL; + output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; + output << "\n/P\nlogs with Epson codes to , default PRN," << NL; + output << "\n/Q\ncancels sound effects," << NL; + output << "\n/Z\ngoes straight into the game." << NL; + output << NL; + output << "\n\n\n\n\n\n\n... Have fun!" << NL; + exit(177); +} + +void not_through_bootstrap() +{ + output << "Avalot must be loaded through the bootstrap." << NL; + exit(0); +} + +void get_storage_addr() +{ + integer e; + + val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); + val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); + skellern=storage_ofs+1; +} + +longint value(string x) +{ + longint q; integer e; + + longint value_result; + val(x,q,e); value_result=q; + return value_result; +} + +void undo_js() +{ + { + joysetup& with = js; + + cxmin=with.xmid-(((with.xmid-with.xmin) / 10)*with.centre); + cxmax=with.xmid+(((with.xmax-with.xmid) / 10)*with.centre); + cymin=with.ymid-(((with.ymid-with.ymin) / 10)*with.centre); + cymax=with.ymid+(((with.ymax-with.ymid) / 10)*with.centre); + +/* writeln(lst,'MID ',xmid,'x',ymid); + writeln(lst,'MAX ',xmax,'x',ymax); + writeln(lst,'MIN ',xmin,'x',ymin); + writeln(lst,'CENTRE ',xmid); + writeln(lst,cxmin); + writeln(lst,cxmax); + writeln(lst,cymin); + writeln(lst,cymax);*/ + } +} + +void check_slope_line(); +static string slope; + +static boolean yn1(byte where) { boolean yn1_result; + yn1_result=slope[where]=='y'; return yn1_result; + } + +void check_slope_line() +{ + slope=paramstr(4); + +/* if slope='' then fillchar(slope,sizeof(slope),'n');*/ + + if (slope[1]!='1') not_through_bootstrap(); + + if (yn1(2)) syntax(); + + soundfx=yn1(3); + cl_override=yn1(4); + keyboardclick=yn1(5); /* 6 - see below */ + demo=yn1(7); + zoomy=yn1(8); + numlockhold=yn1(9); + use_joy_a=yn1(10); + + { + joysetup& with = js; + + with.xmid=value(paramstr( 5)); + with.ymid=value(paramstr( 6)); + with.xmin=value(paramstr( 7)); + with.ymin=value(paramstr( 8)); + with.xmax=value(paramstr( 9)); + with.ymax=value(paramstr(10)); + with.centre=value(paramstr(11)); + + undo_js(); + } + + switch (slope[6]) { + case 'l': log_setup(paramstr(12),false); break; + case 'p': log_setup(paramstr(12),true); break; + } +} + +void get_extra_data() +{ + if (! reloaded) return; + + move(mem[storage_seg*storage_ofs+300],js,sizeof(js)); + + undo_js(); +} + +class unit_incline_initialize { + public: unit_incline_initialize(); +}; +static unit_incline_initialize incline_constructor; + +unit_incline_initialize::unit_incline_initialize() { +/* writeln('Load code: ',paramstr(1)); + writeln('Seg & ofs: ',paramstr(2),':',paramstr(3)); + writeln('Slope line: ',paramstr(4)); + writeln('Log file: ',paramstr(5)); + writeln('File to load: ',paramstr(6)); + readln;*/ + + filetoload=paramstr(13); + filename_specified = filetoload != ""; + + logging=false; + + if ((paramcount<3) || + ((paramstr(1)!="Go") && (paramstr(1)!="et"))) not_through_bootstrap(); + + reloaded=paramstr(1)=="et"; + + get_storage_addr(); + + get_extra_data(); + + check_slope_line(); +} diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h new file mode 100644 index 000000000000..4b252a146e2a --- /dev/null +++ b/engines/avalanche/incline.h @@ -0,0 +1,10 @@ +#ifndef __incline_h__ +#define __incline_h__ + + + +/* This unit has NO externally-callable procedures. Also note that + it MUST be called *first* (so if you load AVALOT.PAS and press f7 + twice you get to the "begin" statement.) */ + +#endif diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp new file mode 100644 index 000000000000..964aa514224a --- /dev/null +++ b/engines/avalanche/initxf.cpp @@ -0,0 +1,32 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + +struct inirex { + varying_string<12> a; + word num; +}; + +text i; +file o; +inirex x; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(i,"v:init0.dat"); reset(i); + assign(o,"v:init.avd"); rewrite(o); + + while (! eof(i)) + {; + i >> x.a >> NL; + i >> x.num >> NL; + o << x; + output << '.'; + } + + close(i); close(o); + output << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp new file mode 100644 index 000000000000..0c7300bfc84a --- /dev/null +++ b/engines/avalanche/inputtes.cpp @@ -0,0 +1,47 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +integer gd,gm; +fonttype font; +varying_string<79> current; +char r; + +void plottext() +{ + byte x,y; +; + for( y=0; y <= 7; y ++) + {; + for( x=1; x <= length(current); x ++) + mem[0xa000*12880+y*80+x]=font[current[x]][y]; + fillchar(mem[0xa000*12881+y*80+x],79-x,'\0'); + } +} + +void loadfont() +{ + file f; +; + assign(f,"c:\\thomas\\ttsmall.fnt"); reset(f); + f >> font; close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\turbo"); + loadfont(); + setfillstyle(1,6); bar(0,0,640,200); + current=""; + do { + r=readkey(); + current=current+r; + plottext(); + } while (!false); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp new file mode 100644 index 000000000000..5d34d69fc9ff --- /dev/null +++ b/engines/avalanche/intro.cpp @@ -0,0 +1,596 @@ +#include "ptoc.h" + + +/*$I c:\sleep5\DSMI.INC*/ +/*#include "Dos.h"*/ +#include "graph.h" +/*#include "Crt.h"*/ + + /* This is a stand-alone program. */ + +/* 0, black, remains 0. + Other numbers: the bits take precedence from the left. + e.g. for 9 = 1001, => fourth bit. + + First 1 is in: + + Fourth bit: 63 (egaWhite) + Third bit: 57 (egaLightBlue) + Second bit: 7 (light grey) + First bit: 1 (blue). */ + +const palettetype our_palette = + {16, + /* sic */ +{{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}}}; + + const integer scardcount = 13; + + const array<0,scardcount-1,integer> soundcards = + {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; + +typedef matrix<'\0','\377',1,16,byte> fonttype; + +fonttype f; +matrix<0,39,1,16,byte> next_line; + +byte next_bitline; + +byte displaycounter; + +boolean cut_out; + +word cut_out_time; + +array<1,117,varying_string<40> > x; + +byte this_line; + +word* skellern; +boolean nomusic; + +/*$L intro.obj*/ +extern void introduction(); + +void graphmode(integer mode) +{ + registers regs; + + regs.ax=mode; + intr(0x10,regs); +} + +/* Firstly, port[$3C4]:=2; port[$3CF]:=4;, + Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ + +void loadfont() +{ + file ff; + + assign(ff,"avalot.fnt"); + reset(ff); + ff >> f; + close(ff); +} + +void calc_next_line() + /* This proc sets up next_line. */ +{ + string l; + byte fv,ff; + boolean oddlen; + byte start; + byte this_; + + fillchar(next_line,sizeof(next_line),'\0'); /* All blanks. */ + + if (this_line==117) + { + cut_out=true; + return; + } + + l=x[this_line]; + this_line += 1; + + start=(20-length(l) / 2)-1; + oddlen=odd(length(l)); + + for( fv=1; fv <= length(l); fv ++) + for( ff=1; ff <= 16; ff ++) + { + this_=f[l[fv]][ff]; + if (oddlen) + { /* Odd, => 4 bits shift to the right. */ + next_line[start+fv][ff] += this_ << 4; + next_line[start+fv-1][ff] += (cardinal)this_ >> 4; + } else + { /* Even, => no bit shift. */ + next_line[start+fv][ff]=this_; + } + } + next_bitline=1; +} + +void display() +{ + byte fv,ff; + + + if (next_bitline == 17) calc_next_line(); + + if (cut_out) + { + if (nomusic) + cut_out_time -= 1; + else + if (ampgetmodulestatus != md_playing) cut_out_time=0; + return; + } + + move(mem[0xa000*40],mem[0xa000*0],7960); + for( fv=0; fv <= 39; fv ++) + mem[0xa1f1*8+fv]=next_line[fv][next_bitline]; + next_bitline += 1; + +} + +void plot_a_star(integer x,integer y) +{ + byte ofs; + + ofs=x % 8; + x=x / 8; + mem[0xa000*x+y*40] += (cardinal)128 >> ofs; +} + +void plot_some_stars(integer y) +{ + byte fv,times; + + switch (Random(7)) { + case 1: times=1; break; + case 2: times=2; break; + case 3: times=3; break; + default: return; + } + + for( fv=1; fv <= times; fv ++) + plot_a_star(Random(320),y); +} + +void starry_starry_night() +{ + integer y; + byte bit; + + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + + for( bit=0; bit <= 2; bit ++) + { + port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( y=1; y <= 200; y ++) + plot_some_stars(y); + } +} + +void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the + Graph unit. */ +{ + integer gd,gm; + + gd=3; gm=1; initgraph(gd,gm,""); +} + +void shovestars() +{ + move(mem[0xa000*0],mem[0xa000*40],7960); + fillchar(mem[0xa000*0],40,'\0'); + plot_some_stars(0); +} + +void do_next_line() +{ + byte bit; + + port[0x3c4]=2; port[0x3ce]=4; + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + switch (bit) { + case 0: if ((displaycounter % 10)==0) shovestars(); break; + case 1: if ((displaycounter % 2)==0) shovestars(); break; + case 2: shovestars(); break; + case 3: display(); break; /* The text. */ + } + } + + if (displaycounter==40) displaycounter=0; + +} + +void load_text() +{ + word fv; + char* c; + byte thisline; + + + c=addr(introduction()); + thisline=0; + fillchar(x,sizeof(x),'\0'); + + for( fv=1; fv <= 2456; fv ++) + { + switch (*c) { + case '\15': thisline += 1; break; + case '\12':/*nop*/; break; + default: x[thisline]=x[thisline]+*c; + } + + c += 1; + } +} + +void check_params() +{ + word s,o; integer e; + + if (paramstr(1)!="jsb") exit(0); + val(paramstr(2),s,e); if (e!=0) exit(0); + val(paramstr(3),o,e); if (e!=0) exit(0); + skellern=ptr(s,o+1); +} + +integer getsoundhardware(psoundcard scard) +{ + integer sc,i,autosel,select; + char ch; + integer e; + + + +integer getsoundhardware_result; +Lagain: + sc=detectgus(scard); + if (sc!=0) sc=detectpas(scard); + if (sc!=0) sc=detectaria(scard); + if (sc!=0) sc=detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); + + autosel=-1; +/* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13),select,e); + + /* Default entry? */ + if (select==0) select=autosel; + if (select!=autosel) { + /* clear all assumptions */ + sc=-1; + fillchar(scard,sizeof(tsoundcard),0); + scard->id=soundcards[select-1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id==id_dac) scard->ioport=0x378; + + /* Read user input */ + val(paramstr(15),i,e); + + if (i!=0) scard->ioport=i; + if (sc!=1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : scard->samplesize=2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: scard->stereo=true; + break; /* enable stereo */ + default: { + scard->samplesize=1; + scard->stereo=false; + } + } + + if (scard->id!=id_dac) { + val(paramstr(17),i,e); + + if (i!=0) scard->dmairq=i; + + val(paramstr(16),i,e); + + if (i!=0) scard->dmachannel=i; + } else { + /* Select correct DAC */ + scard->maxrate=44100; + if (select==11) { + scard->stereo=true; + scard->dmachannel=1; /* Special 'mark' */ + scard->maxrate=60000; + } else + if (select==12) { + scard->stereo=true; + scard->dmachannel=2; + scard->maxrate=60000; + if (scard->ioport==0) scard->ioport=0x378; + } else + if (select==13) { + scard->dmachannel=0; + scard->ioport=0x42; /* Special 'mark' */ + scard->maxrate=44100; + } + } + +/* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result=0; +return getsoundhardware_result; +} + +tsoundcard scard; +tmcpstruct mcpstrc; +tdds dds; +pmodule module; +tsdi_init sdi; +integer e, +bufsize; +char ch; +boolean v86, +vdsok; +longint a,rate, +tempseg; +string answer; +pointer temp; +word flags; +word curch; +byte modulevolume; +array<0,4,tsampleinfo> sample; +array<0,31,word> voltable; + +int main(int argc, const char* argv[]) +{ + + pio_initialize(argc, argv); + check_params(); + + nomusic=paramstr(13)=='0'; + + if (! nomusic) + { + /* Read sound card information */ + if (getsoundhardware(&scard)==-1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id==id_gus) { + /* Initialize GUS player */ + #ifndef DPMI + scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ + #endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus,0,31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt,gus_timer); + } else { + /* Initialize Virtual DMA Specification */ + #ifndef DPMI + vdsok=vdsinit==0; + #else + vdsok=false; + #endif + + fillchar(mcpstrc,sizeof(tmcpstruct),0); + + /* Query for sampling rate */ + val(paramstr(14),a,e); + if (a>4000) rate=a; else rate=21000; + + /* Query for quality */ + mcpstrc.options=mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi=sdi_sb; + scard.maxrate=22000; + } + break; + case id_sbpro : { + sdi=sdi_sbpro; + scard.maxrate=22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi=sdi_pas; + scard.maxrate=44100; + } + break; + case id_sb16 : { + sdi=sdi_sb16; + scard.maxrate=44100; + } + break; + case id_aria : { + sdi=sdi_aria; + scard.maxrate=44100; + } + break; + case id_wss : { + sdi=sdi_wss; + scard.maxrate=48000; + } + break; + #ifndef DPMI + case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ + #endif + } + + mcpinitsounddevice(sdi,&scard); + a=mcp_tablesize; + mcpstrc.reqsize=0; + + /* Calculate mixing buffer size */ + bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize=0; + if ((mcpstrc.options & mcp_quality)>0) + if (scard.samplesize==1) a += mcp_qualitysize; else + a=mcp_tablesize16+mcp_qualitysize16; + if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; + + #ifdef DPMI + dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); + v86=(flags & 2)==0; + #endif + + /* Allocate volume table + mixing buffer */ + #ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg=0; + dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); + } else { + #endif + getmem(temp,a+longint(bufsize)); + if (temp==nil) exit(2); + #ifdef DPMI + tempseg=seg(temp); + } + #else + tempseg=seg(temp)+ofs(temp) / 16+1; + #endif + mcpstrc.bufferseg=tempseg; + mcpstrc.bufferphysical=-1; + + if (vdsok && (scard.id!=id_dac)) { + dds.size=bufsize; + dds.segment=tempseg; + dds.offset=0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; + } + if (mcpstrc.bufferphysical==-1) + #ifdef DPMI + mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); + #else + mcpstrc.bufferphysical=(longint)(tempseg) << 4; + #endif + + mcpstrc.buffersize=bufsize; + mcpstrc.samplingrate=rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc)!=0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp,0,31); + } + + /* Try to initialize AMP */ + if (ampinit(0)!=0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt,amp_timer); + + #ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id==id_dac) setdactimer(tsgettimerrate); + #endif + + if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; + + /* Load an example AMF */ + module=amploadmod("glover.mod",0); + if (module==nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) + && (scard.samplesize==2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); + cdisetupchannels(0,module->channelcount+2,&voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0,module->channelcount+2,nil); + } + + curch=module->channelcount; + modulevolume=64; + + /***/ ampplaymodule(module,0); + } + + setupgraphics(); + + randseed=177; checkbreak=false; + + load_text(); + + this_line=1; + + graphmode(0xd); + loadfont(); + + next_bitline=17; + displaycounter=0; + + cut_out_time=333; + + setallpalette(our_palette); + + starry_starry_night(); + + while ((cut_out_time>0) && (! keypressed())) + { + + *skellern=0; + + do_next_line(); + + displaycounter += 1; + + do {; } while (!(*skellern>0)); + } + + if (! nomusic) ampstopmodule; + graphmode(3); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp new file mode 100644 index 000000000000..71c2d47577f5 --- /dev/null +++ b/engines/avalanche/ints.cpp @@ -0,0 +1,29 @@ +#include "ptoc.h" + + /* Avalot interrupt handler */ +/*#include "Dos.h"*/ + +/*$F+*/ +registers r; +void() old1b; + +boolean quicko; + +void new1b() /* interrupt; */ +{; + quicko=true; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1b,&old1b); + setintvec(0x1b,addr(new1b())); + quicko=false; + do {; } while (!quicko); + setintvec(0x1b,&old1b); +/* r.ah:=$02; intr($16,r); + writeln(r.al and 12); { Only checks Ctrl and Alt. Both on = 12. } + until false;*/ +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp new file mode 100644 index 000000000000..0c07a35961ab --- /dev/null +++ b/engines/avalanche/joysetup.cpp @@ -0,0 +1,97 @@ +#include "ptoc.h" + + /* Avalot joystick setup routines. To be incorporated + into Setup2 whenever I get a chance. */ +/*#include "Joystick.h"*/ +/*#include "Crt.h"*/ + + +struct joysetup { + word xmid,ymid,xmin,ymin,xmax,ymax; + byte centre; /* Size of centre in tenths */ +}; + +joysetup js; +file jf; + +boolean detect() +{ + word x,y,xo,yo; + byte count; +boolean detect_result; +; + count=0; + if (joystickpresent) + {; + detect_result=true; + return detect_result; + } + readjoya(xo,yo); + do { + if (count<7) count += 1; /* Take advantage of "flutter" */ + if (count==6) + {; + output << "The Bios says you don't have a joystick. However, it's often wrong" << NL; + output << "about such matters. So, do you? If you do, move joystick A to" << NL; + output << "continue. If you don't, press any key to cancel." << NL; + } + readjoya(x,y); + } while (!((keypressed()) | (x!=xo) || (y!=yo))); + detect_result=~ keypressed(); +return detect_result; +} + +void display() +{; + {; + gotoxy(20,10); output << "X min: " << js.xmin << " "; + gotoxy(20,11); output << "X max: " << js.xmax << " "; + gotoxy(20,12); output << "Y min: " << js.ymin << " "; + gotoxy(20,13); output << "Y max: " << js.ymax << " "; + } +} + +void getmaxmin() +{ + word x,y; +; + output << "Rotate the joystick around in a circle, as far from the centre as it" << NL; + output << "can get. Then click a button." << NL; + {; + js.xmax=0; js.xmin=maxint; + js.ymax=0; js.ymin=maxint; + } + do { + readjoya(x,y); + {; + if (xjs.xmax) js.xmax=x; + if (y>js.ymax) js.ymax=y; + display(); + } + } while (!(buttona1 | buttona2)); + do {; } while (!(~ (buttona1 | buttona2))); + output << NL; + output << "Thank you. Now please centre your joystick and hit a button." << NL; + do {; } while (!(buttona1 | buttona2)); + readjoya(js.xmid,js.ymid); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=2; + clrscr; + output << "Avalot joystick setup routine- by TT. Thanks go to David B. Howorth." << NL; + output << NL; + if (detect()) output << "You've got a joystick!" << NL; else return 0; + getmaxmin(); + do { + output << "Centring factor\? (3-9)"; + input >> js.centre >> NL; + } while (!(set::of(range(1,9), eos).has(js.centre))); + assign(jf,"v:joytmp.dat"); + rewrite(jf); jf << js; close(jf); /* write it all out to disk. */ +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp new file mode 100644 index 000000000000..20f803ec1191 --- /dev/null +++ b/engines/avalanche/joystick.cpp @@ -0,0 +1,183 @@ +#include "ptoc.h" + +#define __joystick_implementation__ + + +/* +Copyright (c) 1989, 1990 David B. Howorth + +Requires Turbo Pascal 5.0 or later. + +Unit last revised May 9, 1989. +This comment last revised October 22, 1990. + +This file, when compiled to disk, creates JOYSTICK.TPU, a Turbo Pascal unit +containing all necessary routines for joystick control. The routines can +be demonstrated by running the accompanying program JOYDEMO (after first +compiling JOYSTICK.PAS to disk). + +For further information see the accompanying file, JOYSTICK.DOC. + +Permission is granted to distribute this file and the accompanying files +(JOYDEMO.PAS and JOYSTICK.DOC) provided (1) all three files are distributed +together and (2) no fee is charged. + +Permission is granted to include compiled versions of the routines in these +files in any program, commercial or noncommercial, provided only that if the +program is distributed, whether commercially or noncommercially, a copy +(including any documentation) be sent to me; and, if you distribute your +program as shareware, treat me as registered. My address is 01960 SW Palatine +Hill Road, Portland, Oregon 97219. +*/ + +#include "joystick.h" + + +/*#include "Dos.h"*/ + + +typedef void(*readjoyproc)(byte a,byte b,word& c,word& d); +typedef boolean(*buttonfunc)(byte a); + +readjoyproc readjoy; +buttonfunc button; +registers reg; + +/*----------------------------- private routines ----------------------------*/ + +boolean newbios() +{ + char decadechar /*absolute $F000:$FFFB*/; + char yearchar /*absolute $F000:$FFFC*/; + + boolean newbios_result; + newbios_result = (set::of('9','0', eos).has(decadechar)) /*an optimistic view of software life*/ + || ((decadechar == '8') && (set::of(range('4','9'), eos).has(yearchar))); + return newbios_result; +} + +/*$F+*/ + +void oldreadjoy(byte xbit,byte ybit, word& xaxis, word& yaxis) +{; +/* +inline( + $BA/$01/$02/ {mov dx, 201h ;load dx with joystick port address } + $C4/$BE/>XAxis/ {les di, XAxis[bp] ;load es with segment and di w/offset } + $8A/$66/YAxis/ {les di, YAxis[bp] } + $8A/$66/'+double_off+' '+italic+x+italic_off << NL; + else + output << logfile << string("> ")+x << NL; +} + +void log_addstuff(string x) +{; + if (~ logging) return; + scroll_line=scroll_line+x; +} + +void log_scrollchar(string x) /* print one character */ +{ + varying_string<2> z; +; + if (~ logging) return; + switch (x[1]) { + case '`': z=quote; break; /* Open quotes: "66" */ + case '"': z=unquote; break; /* Close quotes: "99" */ + case '\357': z=copyright; break; /* Copyright sign. */ + default: z=x; + } + log_addstuff(z); + scroll_line_length += length(z); +} + +void log_italic() +{; + if (~ logging) return; + if (log_epson) + log_addstuff(italic); + else + log_addstuff("*"); +} + +void log_roman() +{; + if (~ logging) return; + if (log_epson) + log_addstuff(italic_off); + else + log_addstuff("*"); +} + +void log_epsonroman() /* This only sends the Roman code if you're on Epson.*/ +{; + if (~ logging) return; + if (log_epson) log_addstuff(italic_off); +} + +void log_scrollline() /* Set up a line for the scroll driver */ +{; + scroll_line_length=0; + scroll_line=""; +} + +void log_scrollendline(boolean centred) +{ + byte x,fv; +; + if (~ logging) return; + x=17; + if (centred) x += (50-scroll_line_length) / 2; + for( fv=1; fv <= x; fv ++) output << logfile << ' '; + output << logfile << scroll_line << NL; +} + +void log_bubbleline(byte linenum,byte whom, string x) +{ + byte fv; +; + if (~ logging) return; + if (linenum==1) + {; + for( fv=1; fv <= 15; fv ++) output << logfile << ' '; + output << logfile << italic+tr[whom].a.name+": "+italic_off+x << NL; + } else + {; + for( fv=1; fv <= 17; fv ++) output << logfile << ' '; + output << logfile << x << NL; + } +} + +void log_newline() +{; + if (logging) output << logfile << NL; +} + +void log_newroom(string where) +{ + byte fv; +; + if (~ logging) return; + for( fv=1; fv <= 20; fv ++) output << logfile << ' '; + if (log_epson) output << logfile << emph_on; + output << logfile << string('(')+where+')'; + if (log_epson) output << logfile << emph_off; + output << logfile << NL; +} + +void log_aside(string what) + /* This writes "asides" to the printer. For example, moves in Nim. */ +{; + if (~ logging) return; + output << logfile << " (" << italic << what << italic_off << ')' << NL; + /* "What" is what to write. */ +} + +void log_score(word credit,word now) +{ + byte fv; +; + if (~ logging) return; + for( fv=1; fv <= 50; fv ++) output << logfile << ' '; + output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; +} + + diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h new file mode 100644 index 000000000000..016bfb625835 --- /dev/null +++ b/engines/avalanche/logger.h @@ -0,0 +1,33 @@ +#ifndef __logger_h__ +#define __logger_h__ + + +void log_setup(string name, boolean printing); + +void log_divider(); /* Prints the divider sign. */ + +void log_command(string x); /* Prints a command */ + +void log_scrollchar(string x); /* print one character */ + +void log_italic(); + +void log_roman(); + +void log_epsonroman(); + +void log_scrollline(); /* Set up a line for the scroll driver */ + +void log_scrollendline(boolean centred); + +void log_bubbleline(byte linenum,byte whom, string x); + +void log_newline(); + +void log_newroom(string where); + +void log_aside(string what); + +void log_score(word credit,word now); + +#endif diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp new file mode 100644 index 000000000000..e268ac9ecf25 --- /dev/null +++ b/engines/avalanche/lucerna.cpp @@ -0,0 +1,1489 @@ +#include "ptoc.h" + +/* + + + + + LUCERNA The screen, [keyboard] and mouse handler. */ + +#define __lucerna_implementation__ + + +#include "lucerna.h" + + +#include "Graph.h" +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ +#include "trip5.h" +#include "Acci.h" +#include "pingo.h" +#include "scrolls.h" +#include "enhanced.h" +#include "dropdown.h" +#include "logger.h" +#include "visa.h" +#include "celer.h" +#include "timeout.h" +#include "basher.h" +#include "sequence.h" + + +/*$V-*/ /*$S-*/ +boolean fxhidden; array<0,3,palettetype> fxpal; + +void callverb(char n) +{ + if (n==pardon) + { + display(string("The f5 key lets you do a particular action in certain ")+ + "situations. However, at the moment there is nothing "+ + "assigned to it. You may press alt-A to see what the "+ + "current setting of this key is."); + } else + { + weirdword=false; polite=true; verb=n; + do_that(); + } +} + +void draw_also_lines() +{ + byte ff; + byte squeaky_code; + + switch (visible) { + case m_virtual : { squeaky_code = 1; off_virtual(); } break; + case m_no : squeaky_code = 2; break; + case m_yes : { squeaky_code = 3; off(); } break; + } + + setactivepage(2); + cleardevice(); + setcolor(15); rectangle(0,45,639,160); + for( ff=1; ff <= 50; ff ++) + { linetype& with = lines[ff]; + if (x1!=maxint) + { + setcolor(with.col); line(x1,y1,x2,y2); + }} + + switch (squeaky_code) { + case 1 : on_virtual(); break; + case 2 :; break; /* zzzz, it was off anyway */ + case 3 : on(); break; + } +} + +void load_also(string n); + +static untyped_file f; + + +static string nextstring() +{ + byte l; string x; + + string nextstring_result; + blockread(f,l,1); blockread(f,x[1],l); x[0]=chr(l); nextstring_result=x; + return nextstring_result; +} + +static void unscramble(); + +static void scram1(string& x) +{ + byte fz; +; + for( fz=1; fz <= length(x); fz ++) + x[fz]=chr(ord(x[fz]) ^ 177); +} + + + +static void unscramble() +{ + byte fv,ff; + + for( fv=0; fv <= 30; fv ++) + for( ff=0; ff <= 1; ff ++) + if (also[fv][ff]!=nil) + scram1(*also[fv][ff]); + scram1(listen); + scram1(flags); +/* for fz:=1 to length(also[fv,ff]^) do + also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ +} + +void load_also(string n) +{ + byte minnames; byte ff,fv; + + + for( fv=0; fv <= 30; fv ++) + for( ff=0; ff <= 1; ff ++) + if (also[fv][ff]!=nil) { delete also[fv][ff]; also[fv][ff]=nil; } + assign(f,string("also")+n+".avd"); +/*$I-*/ reset(f,1); /*$I+*/ if (ioresult!=0) return; /* no Also file */ + seek(f,128); blockread(f,minnames,1); + for( fv=0; fv <= minnames; fv ++) + { + for( ff=0; ff <= 1; ff ++) + { + also[fv][ff] = new string; + *also[fv][ff]=nextstring(); + } + *also[fv][0]=string('\235')+*also[fv][0]+'\235'; + } + fillchar(lines,sizeof(lines),0xff); + + fv=getpixel(0,0); blockread(f,fv,1); + blockread(f,lines,sizeof(lines[1])*fv); + blockread(f,fv,1); fillchar(peds,sizeof(peds),'\261'); + blockread(f,peds,sizeof(peds[1])*fv); + blockread(f,numfields,1); blockread(f,fields,sizeof(fields[1])*numfields); + blockread(f,magics,sizeof(magics)); + blockread(f,portals,sizeof(portals)); + blockread(f,flags,sizeof(flags)); + blockread(f,listen[0],1); + blockread(f,listen[1],length(listen)); + draw_also_lines(); + + setactivepage(1); close(f); + unscramble(); + for( fv=0; fv <= minnames; fv ++) + *also[fv][0]=string(',')+*also[fv][0]+','; +} + +void load(byte n) /* Load2, actually */ +{ + byte a0; /*absolute $A000:800;*/ + byte a1; /*absolute $A000:17184;*/ + byte bit; + untyped_file f; varying_string<2> xx; + boolean was_virtual; + + was_virtual=visible==m_virtual; + if (was_virtual) off_virtual(); else off(); + clear_vmc(); + + xx=strf(n); flesh_colours(); + assign(f,string("place")+xx+".avd"); reset(f,1); + seek(f,146); blockread(f,roomname,30); + /* Compression method byte follows this... */ + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); move(a0,a1,12080); + } + close(f); load_also(xx); load_chunks(xx); + + copy03(); bit=getpixel(0,0); + log_newroom(roomname); + + if (was_virtual) on_virtual(); else on(); +} + +void zoomout(integer x,integer y) +{ + integer x1,y1,x2,y2; + byte fv; + + setcolor(white); setwritemode(xorput); + setlinestyle(dottedln,0,1); + + for( fv=1; fv <= 20; fv ++) + { + x1=x-(x / 20)*fv; + y1=y-((y-10) / 20)*fv; + x2=x+(((639-x) / 20)*fv); + y2=y+(((161-y) / 20)*fv); + + rectangle(x1,y1,x2,y2); + delay(17); + rectangle(x1,y1,x2,y2); + } + setwritemode(copyput); setlinestyle(0,0,1); +} + +void find_people(byte room) +{ + char fv; + + for( fv='\227'; fv <= '\262'; fv ++) + if (whereis[fv]==room) + { + if (fv<'\257') him=fv; else her=fv; + } +} + +void exitroom(byte x) +{ + nosound; + forget_chunks(); + seescroll=true; /* This stops the trippancy system working over the + length of this procedure. */ + + { dnatype& with = dna; + switch (x) { + case r__spludwicks: { + lose_timer(reason_avariciustalks); + /* He doesn't HAVE to be talking for this to work. It just deletes it IF it + exists. */ with.avaricius_talk=0; + } + break; + case r__bridge: if (with.drawbridge_open>0) + { + with.drawbridge_open=4; /* Fully open. */ + lose_timer(reason_drawbridgefalls); + } + break; + case r__outsidecardiffcastle: lose_timer(reason_cardiffsurvey); break; + + case r__robins: lose_timer(reason_getting_tied_up); break; + }} + + interrogation=0; /* Leaving the room cancels all the questions automatically. */ + + seescroll=false; /* Now it can work again! */ + + dna.last_room=dna.room; + if (dna.room!=r__map) + dna.last_room_not_map=dna.room; +} + +void new_town() /* You've just entered a town from the map. */ +{ + standard_bar(); + + switch (dna.room) { + case r__outsidenottspub: /* Entry into Nottingham. */ + if ((dna.rooms[r__robins]>0) && (dna.been_tied_up) && + (! dna.taken_mushroom)) + dna.mushroom_growing=true; + break; + case r__wisewomans: /* Entry into Argent. */ + { + if (dna.talked_to_crapulus && (! dna.lustie_is_asleep)) + { + dna.spludwicks_here=! ((dna.rooms[r__wisewomans] % 3)==1); + dna.crapulus_will_tell=! dna.spludwicks_here; + } else + { + dna.spludwicks_here=true; + dna.crapulus_will_tell=false; + } + if (dna.box_contents==wine) dna.winestate=3; /* Vinegar */ + } + break; + } + + if (dna.room!=r__outsideducks) + { + if ((dna.obj[onion]) && ! (dna.onion_in_vinegar)) + dna.rotten_onion=true; /* You're holding the onion */ + } +} + +void enterroom(byte x,byte ped); + +static void put_geida_at(byte whichped, byte& ped) +{ + if (ped==0) return; + tr[2].init(5,false); /* load Geida */ + apped(2,whichped); + tr[2].call_eachstep=true; + tr[2].eachstep=procgeida_procs; +} + +void enterroom(byte x,byte ped) +{ + + seescroll=true; /* This stops the trippancy system working over the + length of this procedure. */ + + find_people(x); + dna.room=x; if (ped!=0) dna.rooms[x] += 1; + + load(x); + + if ((dna.rooms[x]==0) && (! flagset('S'))) points(1); + whereis[pavalot]=dna.room; + if (dna.geida_follows) whereis[pgeida]=x; + roomtime=0; + + { dnatype& with = dna; + if ((with.last_room==r__map) && (with.last_room_not_map!=with.room)) + new_town();} + + switch (x) { + case r__yours: if (dna.avvy_in_bed) + { + show_one(3); + set_up_timer(100,procarkata_shouts,reason_arkata_shouts); + } + break; + + case r__outsideyours: if (ped>0) + { + if (! dna.talked_to_crapulus) + { + + whereis[pcrapulus]=r__outsideyours; + tr[2].init(8,false); /* load Crapulus */ + + if (dna.rooms[r__outsideyours]==1) + { + apped(2,4); /* Start on the right-hand side of the screen. */ + tr[2].walkto(5); /* Walks up to greet you. */ + } else + { + apped(2,5); /* Starts where he was before. */ + tr[2].face=3; + } + + tr[2].call_eachstep=true; + tr[2].eachstep=procface_avvy; /* He always faces Avvy. */ + + } else whereis[pcrapulus]=r__nowhere; + + if (dna.crapulus_will_tell) + { + tr[2].init(8,false); + apped(2,2); + tr[2].walkto(4); + set_up_timer(20,proccrapulus_splud_out,reason_crapulus_says_spludwick_out); + dna.crapulus_will_tell=false; + } + } + break; + + case r__outsidespludwicks: + if ((dna.rooms[r__outsidespludwicks]==1) && (ped==1)) + { + set_up_timer(20,procbang,reason_explosion); + dna.spludwicks_here=true; + } + break; + + case r__spludwicks: + if (dna.spludwicks_here) + { + if (ped>0) + { + tr[2].init(2,false); /* load Spludwick */ + apped(2,2); + whereis['\227']=r__spludwicks; + } + + dna.dogfoodpos = 0; /* Also Spludwick pos. */ + + tr[2].call_eachstep =true; + tr[2].eachstep=procgeida_procs; + } else whereis['\227']=r__nowhere; + break; + + case r__brummieroad: + { + if (dna.geida_follows) put_geida_at(5, ped); + if (dna.cwytalot_gone) + { + magics[lightred].op=nix; + whereis[pcwytalot]=r__nowhere; + } else + { + if (ped>0) + { + tr[2].init(4,false); /* 4=Cwytalot*/ + tr[2].call_eachstep=true; + tr[2].eachstep=procfollow_avvy_y; + whereis[pcwytalot]=r__brummieroad; + + if (dna.rooms[r__brummieroad]==1) /* First time here... */ + { + apped(2,2); /* He appears on the right of the screen... */ + tr[2].walkto(4); /* ...and he walks up... */ + } else + { /* You've been here before. */ + apped(2,4); /* He's standing in your way straight away... */ + tr[2].face=left; + } + } + } + } + break; + + case r__argentroad: + { dnatype& with = dna; + if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped==2) && + (dna.rooms[r__argentroad]>3)) + { + tr[2].init(4,false); /* 4=Cwytalot again*/ + apped(2,1); + tr[2].walkto(2); + tr[2].vanishifstill=true; + with.cwytalot_in_herts=true; + /*whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ + set_up_timer(20,proc_cwytalot_in_herts,reason_cwytalot_in_herts); + }} + break; + + case r__bridge: + { + if (dna.drawbridge_open==4) /*open*/ + { + show_one(3); /* Position of drawbridge */ + magics[green].op=nix; /* You may enter the drawbridge. */ + } + if (dna.geida_follows) put_geida_at(ped+3, ped); /* load Geida */ + } + break; + + case r__robins: + { + if (ped>0) + { + if (! dna.been_tied_up) + { /* A welcome party... or maybe not... */ + tr[2].init(6,false); + apped(2,2); + tr[2].walkto(3); + set_up_timer(36,procget_tied_up,reason_getting_tied_up); + } + } + + if (dna.been_tied_up) + { + whereis[probinhood]=0; whereis[pfriartuck]=0; + } + + if (dna.tied_up) show_one(2); + + if (! dna.mushroom_growing) show_one(3); + } + break; + + case r__outsidecardiffcastle: + { + if (ped>0) + switch (dna.cardiff_things) { + case 0 : { /* You've answered NONE of his questions. */ + tr[2].init(9,false); + apped(2,2); + tr[2].walkto(3); + set_up_timer(47,proccardiffsurvey,reason_cardiffsurvey); + } + break; + case 5 : magics[2].op=nix; break; /* You've answered ALL his questions. => nothing happens. */ + default: { /* You've answered SOME of his questions. */ + tr[2].init(9,false); + apped(2,3); + tr[2].face=right; + set_up_timer(3,proccardiff_return,reason_cardiffsurvey); + } + } + if (dna.cardiff_things<5) + interrogation=dna.cardiff_things; else interrogation=0; + } + break; + + case r__map: + { /* You're entering the map. */ + dawn(); setactivepage(cp); + if (ped>0) zoomout(peds[ped].x,peds[ped].y); + setactivepage(1-cp); + + { dnatype& with = dna; + if ((with.obj[wine]) && (with.winestate!=3)) + { + dixi('q',9); /* Don't want to waste the wine! */ + with.obj[wine]=false; + objectlist(); + }} + + dixi('q',69); + } + break; + + case r__catacombs: + { + if (set::of(0,3,5,6, eos).has(ped)) + { + dnatype& with = dna; + + switch (ped) { + case 3 : { with.cat_x=8; with.cat_y=4; } break; /* Enter from oubliette */ + case 5 : { with.cat_x=8; with.cat_y=7; } break; /* Enter from du Lustie's */ + case 6 : { with.cat_x=4; with.cat_y=1; } break; /* Enter from Geida's */ + } + dna.enter_catacombs_from_lusties_room=true; + catamove(ped); + dna.enter_catacombs_from_lusties_room=false; + } + } + break; + + case r__argentpub: { + if (dna.wonnim) show_one(1); /* No lute by the settle. */ + dna.malagauche=0; /* Ready to boot Malagauche */ + if (dna.givenbadgetoiby) + { show_one(8); show_one(9); } + } + break; + + case r__lustiesroom: { + dna.dogfoodpos=1; /* Actually, du Lustie pos. */ + if (tr[1].whichsprite==0) /* Avvy in his normal clothes */ + set_up_timer(3,proccallsguards,reason_du_lustie_talks); + else + if (! dna.entered_lusties_room_as_monk) /*already*/ + /* Presumably, Avvy dressed as a monk. */ + set_up_timer(3,procgreetsmonk,reason_du_lustie_talks); + + if (dna.geida_follows) + { + put_geida_at(5, ped); + if (dna.lustie_is_asleep) show_one(5); + } + } + break; + + case r__musicroom: { + if (dna.jacques_awake>0) + { + dna.jacques_awake=5; + show_one(2); + show_one(4); + magics[brown].op=nix; + whereis[pjacques]=0; + } + if (ped!=0) + { + show_one(6); + first_show(5); then_show(7); + start_to_close(); + } + } + break; + + case r__outsidenottspub: if (ped==2) + { + show_one(3); first_show(2); + then_show(1); then_show(4); + start_to_close(); + } + break; + + case r__outsideargentpub: if (ped==2) { + show_one(6); + first_show(5); then_show(7); + start_to_close(); + } + break; + + case r__wisewomans: { + tr[2].init(11,false); + if ((dna.rooms[r__wisewomans]==1) && (ped>0)) + { + apped(2,2); /* Start on the right-hand side of the screen. */ + tr[2].walkto(4); /* Walks up to greet you. */ + } else + { + apped(2,4); /* Starts where she was before. */ + tr[2].face=3; + } + + tr[2].call_eachstep=true; + tr[2].eachstep=procface_avvy; /* She always faces Avvy. */ + } + break; + + case r__insidecardiffcastle: + if (ped>0) + { + tr[2].init(10,false); /* Define the dart. */ + first_show(1); + if (dna.arrow_in_the_door) then_show(3); else then_show(2); + if (dna.taken_pen) show_one(4); + start_to_close(); + } else + { + show_one(1); + if (dna.arrow_in_the_door) show_one(3); else show_one(2); + } + break; + + case r__avvysgarden: if (ped==1) { + show_one(2); + first_show(1); then_show(3); + start_to_close(); + } + break; + + case r__entrancehall:case r__insideabbey: if (ped==2) { + show_one(2); + first_show(1); then_show(3); + start_to_close(); + } + break; + + case r__aylesoffice: if (dna.ayles_is_awake) show_one(2); break; /* Ayles awake. */ + + case r__geidas: put_geida_at(2, ped); break; /* load Geida */ + + case r__easthall:case r__westhall: if (dna.geida_follows) put_geida_at(ped+2, ped); break; + + case r__lusties: if (dna.geida_follows) put_geida_at(ped+6, ped); break; + + case r__nottspub: { + if (dna.sitting_in_pub) show_one(3); + dna.dogfoodpos=1; /* Actually, du Lustie pos. */ + } + break; + + case r__outsideducks: if (ped==2) + { /* Shut the door */ + show_one(3); + first_show(2); then_show(1); + then_show(4); start_to_close(); + } + break; + case r__ducks: dna.dogfoodpos=1; break; /* Actually, Duck pos. */ + + } + + seescroll=false; /* Now it can work again! */ + +} + +void thinkabout(char z, boolean th) /* Hey!!! Get it and put it!!! */ +{ + const integer x = 205; const integer y = 170; const integer picsize = 966; + const bytefield thinkspace = + {25, 170, 32, 200}; + untyped_file f; pointer p; byte fv; + + + thinks=z; z -= 1; + + if (th) + { /* Things */ + assign(f,"thinks.avd"); wait(); getmem(p,picsize); + reset(f,1); seek(f,ord(z)*picsize+65); blockread(f,p,picsize); off(); + close(f); + } else + { /* People */ + assign(f,"folk.avd"); + wait(); + getmem(p,picsize); + reset(f,1); + + fv=ord(z)-149; + if (fv>=25) fv -= 8; + if (fv==20) fv -= 1; /* Last time... */ + + seek(f,fv*picsize+65); + blockread(f,p,picsize); + off(); + close(f); + } + + setactivepage(3); + putimage(x,y,p,0); + setactivepage(1-cp); + + for( fv=0; fv <= 1; fv ++) + getset[fv].remember(thinkspace); + + freemem(p,picsize); + on(); thinkthing=th; +} + +void load_digits() /* Load the scoring digits & rwlites */ +{ + const integer digitsize = 134; + const integer rwlitesize = 126; + untyped_file f; char fv; byte ff; + + assign(f,"digit.avd"); reset(f,1); + for( fv='0'; fv <= '9'; fv ++) + { + getmem(digit[fv],digitsize); blockread(f,digit[fv],digitsize); + } + for( ff=0; ff <= 8; ff ++) + { + getmem(rwlite[ff],rwlitesize); blockread(f,rwlite[ff],rwlitesize); + } + close(f); +} + +void toolbar() +{ + untyped_file f; word s; byte fv; pointer p; + + assign(f,"useful.avd"); reset(f,1); + s=filesize(f)-40; getmem(p,s); + seek(f,40); + blockread(f,p,s); + close(f); +/* off;*/ + + setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ + setfillstyle(1,6); + for( fv=0; fv <= 1; fv ++) + { + setactivepage(fv); putimage(5,169,p,0); + if (demo) + { + bar(264,177,307,190); + outtextxy(268,188,"Demo!"); /* well... actually only white now. */ + } + } + +/* on;*/ + freemem(p,s); + oldrw=177; showrw(); +} + +void showscore() +{ + const bytefield scorespace = {33, 177, 39, 200}; + varying_string<3> q; byte fv; + + if (demo) return; + + str(dna.score,q); while (q[0]<'\3') q=string('0')+q; off(); + setactivepage(3); + for( fv=1; fv <= 3; fv ++) + if (lastscore[fv]!=q[fv]) + putimage(250+fv*15,177,digit[q[fv]],0); + + for( fv=0; fv <= 1; fv ++) + getset[fv].remember(scorespace); + + setactivepage(1-cp); + on(); lastscore=q; +} + +void points(byte num) /* Add on no. of points */ +{ + byte q,fv; + + for( q=1; q <= num; q ++) + { + dna.score += 1; + if (soundfx) for( fv=1; fv <= 97; fv ++) sound(177+dna.score*3); nosound; + } + log_score(num,dna.score); showscore(); +} + +void topcheck() +{ + { menuset& with = ddm_m; /* Menuset */ + getmenu(mpx);} /* Do this one */ +} + +void mouseway() +{ + byte col; + + off(); col=getpixel(mx,my); on(); + { triptype& with = tr[1]; + { dnatype& with1 = dna; + switch (col) { + case green: { dna.rw=up; rwsp(1,up); showrw(); } break; + case brown: { dna.rw=down; rwsp(1,down); showrw(); } break; + case cyan: { dna.rw=left; rwsp(1,left); showrw(); } break; + case lightmagenta: { dna.rw=right; rwsp(1,right); showrw(); } break; + case red:case white:case lightcyan:case yellow: { stopwalking(); showrw(); } break; + }}} +} + +void inkey() +{ + char r; + + + if (demo) return; /* Demo handles this itself. */ + + if (mousetext=="") + { /* read keyboard */ + readkeye(); + if ((inchar==' ') && ((shiftstate & 8)>0)) + { + inchar='\0'; extd='#'; /* alt-spacebar = alt-H */ + } + } else + { + if (mousetext[1]=='`') mousetext[1]='\15'; /* Backquote = return in a macro */ + inchar=mousetext[1]; mousetext=copy(mousetext,2,255); + } +} + +void posxy() +{ + varying_string<3> xs,ys; + + setfillstyle(1,0); setcolor(10); + do { + check(); + if (mpress==1) + { + str(mx,xs); str(my,ys); + off(); bar(400,160,500,168); + outtextxy(400,168,xs); outtextxy(440,168,string(": ")+ys); on(); + } + } while (!(my==0)); + bar(400,161,640,168); +} + +void fxtoggle() +{ + byte page_; + const bytefield soundled = + {52, 175, 55, 177}; + + soundfx=! soundfx; + if (soundfx) + { + if (! fxhidden) + { /* ...but *not* when the screen's dark. */ + sound(1770); delay(77); nosound; + } + setfillstyle(1,cyan); + } else + setfillstyle(1,black); + setactivepage(3); bar(419,175,438,177); + setactivepage(1-cp); + for( page_=0; page_ <= 1; page_ ++) getset[page_].remember(soundled); +} + +void objectlist() +{ + char fv; + + dna.carrying=0; + if (thinkthing && ! dna.obj[thinks]) + thinkabout(money,a_thing); /* you always have money */ + for( fv='\1'; fv <= numobjs; fv ++) + if (dna.obj[fv]) + { + dna.carrying += 1; objlist[dna.carrying]=fv; + } +} + +void verte() +{ + byte what; + + if (! dna.user_moves_avvy) return; + { + triptype& with = tr[1]; /* that's the only one we're interested in here */ + + + if (mx<(cardinal)with.x) what=1; else + if (mx>(unsigned char)(with.x+with.a.xl)) what=2; else + what=0; /* On top */ + + if (my<(cardinal)with.y) what += 3; else + if (my>(unsigned char)(with.y+with.a.yl)) what += 6; + + switch (what) { + case 0: stopwalking(); break; /* Clicked on Avvy- no movement */ + case 1: rwsp(1,left); break; + case 2: rwsp(1,right); break; + case 3: rwsp(1,up); break; + case 4: rwsp(1,ul); break; + case 5: rwsp(1,ur); break; + case 6: rwsp(1,down); break; + case 7: rwsp(1,dl); break; + case 8: rwsp(1,dr); break; + } /* no other values are possible... */ + + showrw(); + + } +} + +void checkclick() +{ + bytefield b; + + check(); ontoolbar=slow_computer && ((my>=169) || (my<=10)); + + if (mrelease>0) after_the_scroll=false; + switch (my) { + case RANGE_11(0,10): newpointer(1); + break; /* up arrow */ + case RANGE_11(159,169): newpointer(8); + break; /* I-beam */ + case 170 ... 200: newpointer(2); break; /* screwdriver */ + default: + { + if (! ddmnow) /* Dropdown can handle its own pointers. */ + { + if (((keystatus & 1)==1) && (my>=11) && (my<=158)) + { + newpointer(7); /* Mark's crosshairs */ + verte(); + /* Normally, if you click on the picture, you're guiding Avvy around. */ + } else + newpointer(4); /* fletch */ + } + } + } + + if (mpress>0) + { + switch (mpy) { + case RANGE_11(0,10): if (dropsok) topcheck(); + break; + case 11 ... 158: if (! dropsok) + mousetext=string('\15')+mousetext; + break; /* But otherwise, it's + equivalent to pressing Enter. */ + case RANGE_11(159,169): { /* Click on command line */ + cursor_off(); curpos=(mx-16) / 8; + if (curpos>length(current)+1) curpos=length(current)+1; + if (curpos<1) curpos=1; + cursor_on(); + } + break; + case 170 ... 200: switch (mpx) { /* bottom check */ + case 0 ... 207: mouseway(); break; + case 208 ... 260: { /* Examine the thing */ + do { check(); } while (!(mrelease>0)); + if (thinkthing) + { + thing=thinks; thing += 49; + person=pardon; + } else + { + person=thinks; + thing=pardon; + } + callverb(vb_exam); + } + break; + case 261 ... 319: { + do { checkclick(); } while (!(mrelease>0)); + callverb(vb_score); + } + break; + case 320 ... 357: { tr[1].xs=walk; newspeed(); } break; + case 358 ... 395: { tr[1].xs=run; newspeed(); } break; + case 396 ... 483: fxtoggle(); break; /* "sound" */ +/* 484..534: begin { clock } + off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; + end;*/ + case 535 ... 640: mousetext=string('\15')+mousetext; break; + } + break; + } + } + +/* if mrelease>0 then + begin + if (cw<>177) and (mry>10) then + begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; + end;*/ +} + +void mouse_init() +{ + r.ax=0; + intr(0x33,r); /* Returns- no. keys in bx and whether present in ax. */ + wait(); +} + +void mousepage(word page_) +{ + boolean onstate,wason; + + if (visible!=m_virtual) + { + onstate=oncandopageswap; + oncandopageswap=false; + wason=visible==m_yes; + if (wason) off(); + { + void& with = r; ax=29; bx=page_; } intr(0x33,r); + if (wason) on(); + oncandopageswap=onstate; + } +} + +void errorled() +{ + byte fv; + + state(0); + for( fv=0; fv <= 1; fv ++) + { + setactivepage(fv); + off(); setfillstyle(1,red); bar(419,184,438,186); on(); + } + for( fv=177; fv >= 1; fv --) + { + sound(177+(fv*177177) / 999); + delay(1); nosound; + } + for( fv=0; fv <= 1; fv ++) + { + setactivepage(fv); + off(); setfillstyle(1,black); bar(419,184,438,186); on(); + } + state(defaultled); setactivepage(1-cp); +} + +shortint fades(shortint x) +{ + byte r,g,b; + + shortint fades_result; + r=x / 16; x=x % 16; + g=x / 4; b=x % 4; + if (r>0) r -= 1; if (g>0) g -= 1; if (b>0) b -= 1; + fades_result=(16*r+4*g+b); +/* fades:=x-1;*/ + return fades_result; +} + +void dusk(); + +static void fadeout(byte n) +{ + byte fv; + + getpalette(fxpal[n]); + for( fv=1; fv <= fxpal[n].size-1; fv ++) + fxpal[n].colors[fv]=fades(fxpal[n].colors[fv]); + setallpalette(fxpal[n]); + /*delay(50);*/ slowdown(); +} + +void dusk() +{ + byte fv; + + setbkcolor(0); + if (fxhidden) return; fxhidden=true; + getpalette(fxpal[0]); for( fv=1; fv <= 3; fv ++) fadeout(fv); +} + +void dawn(); + +static void fadein(byte n) +{ + setallpalette(fxpal[n]); + /*delay(50);*/ slowdown(); +} + +void dawn() +{ + byte fv; + + if ((holdthedawn) || (! fxhidden)) return; fxhidden=false; + for( fv=3; fv >= 0; fv --) fadein(fv); + { dnatype& with = dna; + if ((with.room==r__yours) && (with.avvy_in_bed) && (with.teetotal)) background(14);} +} + +void showrw() +{ + byte page_; + + { + dnatype& with = dna; + + if (oldrw==with.rw) return; + oldrw=with.rw; off(); + for( page_=0; page_ <= 1; page_ ++) + { + setactivepage(page_); putimage(0,161,rwlite[with.rw],0); + } on(); + setactivepage(1-cp); + } +} + +void mblit(byte x1,byte y1,byte x2,byte y2, byte f,byte t) /* assembler; */ +/* The Minstrel Blitter */ +/* asm +{ ofsfr:=f*$4000+x1+y1*80; + ofsto:=t*$4000+x1+y1*80;} + + mov bx,80; { We're multiplying by 80. } + mov al,y1; + mul bl; { AX now contains y1*80. } + xor cx,cx; { Zero CX. } + mov cl,x1; { CX now equals x1 } + add ax,cx; { AX now contains x1+y1*80. } + mov si,ax; + mov di,ax; + + mov ax,$4000; + mov bl,f; + mul bx; { Note that this is a *word*! } + add si,ax; + + mov ax,$4000; + mov bl,t; + mul bx; { Note that this is a *word*! } + add di,ax; + + push ds; { *** <<<< *** WE MUST PRESERVE THIS! } + cld; { Clear Direction flag - we're going forwards! } + + mov ax,$A000; { The screen memory. } + mov ds,ax; + mov es,ax; { The same. } + + { AH stores the number of bytes to copy. } + { len:=(x2-x1)+1; } + + mov ah,x2; + sub ah,x1; + inc ah; + + { Firstly, let's decide how many times we're going round. } + + mov cl,y2; { How many numbers between y1 and y2? } + sub cl,y1; + inc cl; { Inclusive reckoning (for example, from 3 to 5 is 5-3+1=3 turns. } + + { We'll use SI and DI to be Ofsfr and Ofsto. } + + @Y_axis_loop: + push cx; + + + { OK... We've changed this loop from a for-next loop. "Bit" is + represented by CX. } + +{ port[$3c4]:=2; port[$3ce]:=4; } + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; + + mov cx,4; { We have to copy planes 3, 2, 1 and Zero. We'll add 1 to the + number, because at zero it stops. } + + mov bx,3; { This has a similar function to that of CX. } + + @start_of_loop: + + push cx; + +{ port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; +{ port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; + +{ move(mem[$A000:ofsfr],mem[$A000:ofsto],len); } + + xor ch,ch; { Clear CH. } + mov cl,ah; + + repz movsb; { That's all we need to say! } + + mov cl,ah; + sub si,cx; { This is MUCH, MUCH faster than pushing and popping them! } + sub di,cx; + + pop cx; { Get the loop count back again. } + dec bx; { One less... } + loop @start_of_loop; { Until cx=0. } + + add si,80; { Do the next line... } + add di,80; + + pop cx; + loop @Y_axis_loop; + + pop ds; { Get it back again (or we'll be in trouble with TP!) } +*/ +{; +} + +void blitfix() +{ + byte fv; + + fv=getpixel(0,0); /* perform read & so cancel Xor effect! */ +} + +void clock(); +const integer xm = 510; +const integer ym = 183; +static arccoordstype ah,am; +static word nh; + +static void calchand(word ang,word length, arccoordstype& a, byte c) +{ + if (ang>900) { a.xend=177; return; } + setcolor(c); arc(xm,ym,449-ang,450-ang,length); getarccoords(a); +} + + +static void hand(arccoordstype a, byte c) +{ + if (a.xend==177) return; + setcolor(c); + line(xm,ym,a.xend,a.yend); /* "With a do-line???!", Liz said. */ +} + + +static void chime() +{ + word gd,gm,fv; + + if ((oh==17717) || (! soundfx)) return; /* too high- must be first time around */ + fv=h % 12; if (fv==0) fv=12; wait(); + for( gd=1; gd <= fv; gd ++) + { + for( gm=1; gm <= 3; gm ++) + { + sound((gd % 3)*64+140-gm*30); delay(50-gm*12); + } + nosound; if (gd!=fv) delay(100); + } +} + + + +static void refresh_hands() +{ + const bytefield clockspace = {61, 166, 66, 200}; + byte page_; + + for( page_=0; page_ <= 1; page_ ++) + getset[page_].remember(clockspace); +} + + + +static void plothands() +{ +/* off;*/ + setactivepage(3); + calchand(onh,14,ah,yellow); calchand(om*6,17,am,yellow); + hand(ah,brown); hand(am,brown); + calchand(nh,14,ah,brown); calchand(m*6,17,am,brown); + hand(ah,yellow); hand(am,yellow); + setactivepage(1-cp); + + refresh_hands(); + +/* on;*/ +} + +void clock() +{ /* ...Clock. */ + gettime(h,m,s,s1); + nh=(h % 12)*30+m / 2; + if (oh!=h) { plothands(); chime(); } + if (om!=m) plothands(); + if ((h==0) && (oh!=0) && (oh!=17717)) + display(string("Good morning!\r\rYes, it's just past midnight. Are you having")+ + " an all-night Avvy session? Glad you like the game that much!"); + oh=h; onh=nh; om=m; +} + +void flip_page() +{ + if (! ddm_o.menunow) + { + cp=1-cp; + setvisualpage(cp); + setactivepage(1-cp); + /*mousepage(cp);*/ + } + +} + +void delavvy() +{ + byte page_; + + off(); + { triptype& with = tr[1]; + for( page_=0; page_ <= 1; page_ ++) + mblit(with.x / 8,with.y,(with.x+with.a.xl) / 8+1,with.y+with.a.yl,3,page_);} + blitfix(); + on(); +} + +void gameover() +{ + byte fv; integer sx,sy; + + dna.user_moves_avvy=false; + + sx=tr[1].x; + sy=tr[1].y; + { + triptype& with = tr[1]; + + done(); + init(12,true); /* 12 = Avalot falls */ + tr[1].step=0; + appear(sx,sy,0); + } + set_up_timer(3,procavalot_falls,reason_falling_over); +/* display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ + alive=false; +} + +/* OK. There are two kinds of redraw: Major and Minor. Minor is what happens + when you load a game, etc. Major redraws EVERYTHING. */ + +void minor_redraw() +{ + byte fv; + + dusk(); + enterroom(dna.room,0); /* Ped unknown or non-existant. */ + + for( fv=0; fv <= 1; fv ++) + { + cp=1-cp; + getback(); + } + + { + dnatype& with = dna; + + lastscore="TJA"; /* impossible digits */ + showscore(); + } + + dawn(); +} + +void major_redraw() +{ + byte fv; + + dusk(); + setactivepage(0); cleardevice(); + + toolbar(); + copy03(); + + enterroom(dna.room,0); /* 0 = ped unknown or non-existant. */ + for( fv=0; fv <= 1; fv ++) { cp=1-cp; getback(); } + + om=177; + clock(); + + thinkabout(thinks,thinkthing); standard_bar(); + soundfx=! soundfx; fxtoggle(); + for( fv=0; fv <= 1; fv ++) { cp=1-cp; getback(); } + plottext(); + ledstatus=177; state(2); + + { + dnatype& with = dna; + + lastscore="TJA"; /* impossible digits */ + showscore(); + } + + dawn(); +} + +word bearing(byte whichped) + /* Returns the bearing from ped Whichped to Avvy, in degrees. */ +{ + const real rad2deg = 180/pi; + + word bearing_result; + { pedtype& with = peds[whichped]; + if (tr[1].x==with.x) + bearing_result=0; /* This would cause a division by zero if we let it through. */ + else + /* + bearing:=trunc(((arctan((tr[1].y-y)/(tr[1].x-x)))*rad2deg)+90) mod 360*/ + { + if (tr[1].x magic,out; +word next,gg; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + assign(magic,"v:magicirc.avd"); reset(magic); + assign(out,"v:magic2.avd"); rewrite(out); + move(mem[0xa000*0],mem[0xa000*pagetop],16000); + while (! eof(magic)) + {; + magic >> next; + if (next!=nextcode) + mem[0xa000*next]=255; + else + {; + for( gg=0; gg <= 16000; gg ++) + if (mem[0xa000*gg]!=mem[0xa000*gg+pagetop]) + out << gg; + out << nextcode; + move(mem[0xa000*0],mem[0xa000*pagetop],16000); + } + } + close(magic); close(out); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp new file mode 100644 index 000000000000..282eb5d18979 --- /dev/null +++ b/engines/avalanche/magidraw.cpp @@ -0,0 +1,34 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +const word nextcode = 17717; + +integer gd,gm; +untyped_file magic; /* of word;*/ +word next; +array<1,16401,word> buffer; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + assign(magic,"v:magic2.avd"); reset(magic,1); + blockread(magic,buffer,sizeof(buffer)); + close(magic); +/* while not eof(magic) do*/ + for( gd=1; gd <= 16401; gd ++) + {; +/* read(magic,next); + if next<>nextcode then*/ + if (buffer[gd]!=nextcode) + mem[0xa000*buffer[gd]]=255; + else + delay(1); + } +/* close(magic);*/ +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp new file mode 100644 index 000000000000..09db4d286d40 --- /dev/null +++ b/engines/avalanche/magishuf.cpp @@ -0,0 +1,60 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ + + +const word nextcode = 17717; + +typedef array<1,8000,word> big; +typedef array<1,16401,word> circle; + +big b; +file f; +registers r; +word gd; +circle c; +file fc; + +void melt(byte c) +{; + for( gd=1; gd <= 8000; gd ++) + {; + mem[0xa000*b[gd]]=c; + if ((gd % 17)==0) delay(1); + } +} + +void magicirc(byte cc) +{; + for( gd=1; gd <= 16401; gd ++) + {; + if (c[gd]!=nextcode) + {; + if (odd(c[gd])) mem[0xa000*c[gd] / 2]=cc; + } else + delay(1); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + r.ax=13; intr(0x10,r); + assign(f,"d:shuffle.avd"); reset(f); f >> b; close(f); + assign(fc,"v:magic2.avd"); reset(fc); fc >> c; close(fc); +/* repeat + melt(170); magicirc(85); + magicirc(170); melt(85); + magicirc(170); magicirc(85); + melt(170); melt(85); + until keypressed;*/ + do { + melt(255); magicirc(0); + magicirc(255); melt(0); + magicirc(255); magicirc(0); + melt(255); melt(0); + } while (!keypressed()); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp new file mode 100644 index 000000000000..447f540b8ad6 --- /dev/null +++ b/engines/avalanche/make!.cpp @@ -0,0 +1,62 @@ +#include "ptoc.h" + + /* Phew! */ +#include "graph.h" + +/*$S-*/ +integer gd,gm; +untyped_file f; +text t; +string x; + +boolean subpix(integer x,integer y) +{boolean subpix_result; +; + subpix_result=getpixel(x,y)==15; +return subpix_result; +} + +byte pixel(integer x,integer y) +{byte pixel_result; +; + pixel_result=(byte)( + subpix(x*4,y*2) || + subpix(x*4+1,y*2) || + subpix(x*4+2,y*2) || + subpix(x*4+3,y*2) || + subpix(x*4,y*2+1) || + subpix(x*4+1,y*2+1) || + subpix(x*4+2,y*2+1) || + subpix(x*4+3,y*2+1) + )*15; +return pixel_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=1; initgraph(gd,gm,"o:"); + assign(f,"v:logo.avd"); reset(f,1); + for( gd=0; gd <= 180; gd ++) + blockread(f,mem[0xa000*(gd*80)],53); + close(f); + for( gd=1; gd <= 106; gd ++) + for( gm=0; gm <= 145; gm ++) + putpixel(gd,gm+181,pixel(gd,gm)); + assign(t,"d:avalot.txt"); + rewrite(t); + for( gm=1; gm <= 36; gm ++) + {; + x=""; + for( gd=1; gd <= 106; gd ++) + switch (getpixel(gd,gm*2+181)*2+getpixel(gd,gm*2+182)) { + case 0: x=x+' '; break; + case 15: x=x+''; break; + case 30: x=x+''; break; + case 45: x=x+''; break; + } + t << x << NL; + } + close(t); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp new file mode 100644 index 000000000000..574d346660fd --- /dev/null +++ b/engines/avalanche/makeregi.cpp @@ -0,0 +1,142 @@ +#include "ptoc.h" + + /* regname's name starts at $7D1 (2001). */ + +const array<1,56,char> padding = +"For all the Etruscan armies were ranged beneath his eye"; + +text txi,txo; +string x,y; +word fv; +file f; +byte sum,n; +string name,number; + +string chkname,chknum,regname,regnum; + + + char decode1(char c) + { + byte b; + + char decode1_result; + b=ord(c)-32; + decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; + } + + char encode1(char c) + { + byte b; + + char encode1_result; + b=ord(c); + b=( (cardinal)(b & 0x78) >> 3) + ((b & 0x7) << 4); + encode1_result=chr(b+32); + return encode1_result; + } + + char encode2(char c) + { + char encode2_result; + encode2_result=chr((((ord(c) & 0xf) << 2)+0x43)); + return encode2_result; + } + + string enc1(string x) + { + string y; byte fv; + + string enc1_result; + y=x; for( fv=1; fv <= length(y); fv ++) y[fv]=encode1(y[fv]); + enc1_result=y; + return enc1_result; + } + + string enc2(string x) + { + string y; byte fv; + + string enc2_result; + y=x; for( fv=1; fv <= length(y); fv ++) y[fv]=encode2(y[fv]); + enc2_result=y; + return enc2_result; + } + + boolean checker(string proper,string check) + { + byte fv; boolean ok; + + boolean checker_result; + ok=true; + for( fv=1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) + ok=false; + + checker_result=ok; + return checker_result; + } + + void unscramble() + { + byte namelen,numlen; + + + namelen=107-ord(x[1]); numlen=107-ord(x[2]); + + regname=copy(x,3,namelen); + regnum=copy(x,4+namelen,numlen); + chkname=copy(x,4+namelen+numlen,namelen); + chknum=copy(x,4+namelen+numlen+namelen,numlen); + + for( fv=1; fv <= namelen; fv ++) regname[fv]=decode1(regname[fv]); + for( fv=1; fv <= numlen; fv ++) regnum[fv]=decode1(regnum[fv]); + + if ((! checker(regname,chkname)) || (! checker(regnum,chknum))) + { + output << "CHECK ERROR: " << regname << '/' << chkname << ';' << regnum << '/' << chknum << '.' << NL; + exit(0); + } else output << "--- Passed both checks. ---" << NL; + } + +int main(int argc, const char* argv[]) +{ + + pio_initialize(argc, argv); + output << "Name? "; input >> name >> NL; + output << "Number? "; input >> number >> NL; + + x=string(chr(107-ord(name[0])))+chr(107-ord(number[0])); + + + x=x+enc1(name)+'J'+enc1(number)+enc2(name)+enc2(number); + + number=""; fv=1; + while ((length(number)+length(x))<57) + { + number=number+padding[fv-1]; fv=fv+1; + } + x=x+enc1(number); + + + output << x << NL; output << NL; + unscramble(); + + assign(txi,"v:register.raw"); reset(txi); + assign(txo,"a:register.dat"); rewrite(txo); + + for( fv=1; fv <= 53; fv ++) + { + txi >> y >> NL; txo << y << NL; + } + + txi >> y >> NL; txo << x << NL; + + while (! eof(txi)) + { + txi >> y >> NL; txo << y << NL; + } + + close(txi); close(txo); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp new file mode 100644 index 000000000000..50e58109e6c0 --- /dev/null +++ b/engines/avalanche/makesez.cpp @@ -0,0 +1,47 @@ +#include "ptoc.h" + + + +struct sezheader { + array<1,2,char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all scroll chains */ +}; + +const string crlf = string('\15')+'\12'; +const string tabs = string('\11')+'\11'+'\11'+'\11'+'\11'+'\11'+'\11'; +const char eof_ = '\32'; + +untyped_file sez; +sezheader header; +string x; +char check; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + fillchar(x,sizeof(x),'\261'); + x=string("This is a Sez file for an Avvy game, and its contents are subject")+crlf+ + "to copyright. Have fun with the game!"+crlf+crlf+tabs+"tt"+crlf+crlf+ + "[Lord Avalot D'Argent]"+crlf+crlf+eof_+ + crlf+crlf+"Thomas was here!"; + {; + header.initials="TT"; + header.gamecode=2; /* code for Avalot */ + header.revision=100; /* version 1.00 */ + header.chains=0; /* no chains */ + header.size=0; /* empty! */ + } + check='\261'; + assign(sez,"avalot.sez"); + rewrite(sez,1); + blockwrite(sez,x[1],255); + blockwrite(sez,header,sizeof(header)); + blockwrite(sez,check,1); + x=string('\0')+'\0'+'\0'+"Thomas was here, too!"+crlf+crlf+"Good luck..."; + blockwrite(sez,x[1],39); /* footer */ + close(sez); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp new file mode 100644 index 000000000000..5ed388531cf3 --- /dev/null +++ b/engines/avalanche/makevmou.cpp @@ -0,0 +1,270 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Squeak.h"*/ +/*#include "Crt.h"*/ + +/*$R+*/ + +struct mp { /* mouse-pointer */ + matrix<0,1,0,15,word> mask; + integer horzhotspot,verthotspot; +}; + +struct vmctype { /* Virtual Mouse Cursor */ + pointer andpic,xorpic; + array<0,1,pointer> backpic; + array<0,1,pointtype> wherewas; + byte picnumber; + shortint ofsx,ofsy; +}; + +const array<1,9,arrowtype> mps = +{{{ /* 1 - up-arrow */ + ((65151,64575,64575,63519,63519,61455,61455,57351,57351,49155,49155,64575,64575,64575,64575,64575), + (0,384,384,960,960,2016,2016,4080,4080,8184,384,384,384,384,384,0)), + 8, + 0}, + +{ /* 2 - screwdriver */ + ((8191,4095,2047,34815,50175,61951,63743,64543,65039,65031,65027,65281,65408,65472,65505,65523), + (0,24576,28672,12288,2048,1024,512,256,224,176,216,96,38,10,12,0)), + 0, + 0}, + +{ /* 3 - right-arrow */ + ((65535,65535,64639,64543,7,1,0,1,7,64543,64639,65535,65535,65535,65535,65535), + (0,0,0,384,480,32760,32766,32760,480,384,0,0,0,0,0,0)), + 15, + 6}, + +{ /* 4 - fletch */ + ((255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511), + (0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0)), + 0, + 0}, + +{ /* 5 - hourglass */ + ((0,0,0,34785,50115,61455,61455,63519,63519,61839,61455,49155,32769,0,0,0), + (0,32766,16386,12300,2064,1440,1440,576,576,1056,1440,3024,14316,16386,32766,0)), + 8, + 7}, + +{ /* 6 - TTHand */ + ((62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443), + (3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092)), + 4, + 0}, + +{ /* 7- Mark's crosshairs */ + ((65535,65151,65151,65151,65151,0,65151,65151,65151,65151,65535,65535,65535,65535,65535,65535), + (0,384,384,384,384,65535,384,384,384,384,0,0,0,0,0,0)), + 8, + 5}, + +{ /* 8- I-beam. */ + ((65535,65535,63631,63503,63503,65087,65087,65087,65087,65087,63503,63503,63631,65535,65535,65535), + (0,0,0,864,128,128,128,128,128,128,128,864,0,0,0,0)), + 8, + 7}, + +{ /* 9- Question mark. */ + ((511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695), + (65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840)), + 0, + 0}}}; + +const integer mouse_size = 134; + +const array<1,134,char> mice_header = + string("Mouse file copyright (c) 1993. I saw a mouse! Where? SQUEEAAAKK!!! Cheese ")+ /* 74 */ + "cheese cheese. Cheddar, Stilton, Double Gloucester. Squeak."+'\32'; /* 60 */ + +integer gd,gm; +matrix<0,50,1,40,word> a /*absolute $A000:0i*/; +byte fv; +vmctype vmc; +byte plot; integer plx,ply; + +word swapbits(word a) +{word swapbits_result; +; + swapbits_result=lo(a)*256+hi(a); +return swapbits_result; +} + +void plot_vmc(integer xx,integer yy, byte page_) +{; + {; + xx=xx+vmc.ofsx; + yy=yy+vmc.ofsy; + + getimage(xx,yy,xx+15,yy+15,vmc.backpic[page_]); + putimage(xx,yy,vmc.andpic,andput); + putimage(xx,yy,vmc.xorpic,xorput); + { + pointtype& with1 = vmc.wherewas[page_]; + ; + with1.x=xx; + with1.y=yy; + } + } +} + +void wipe_vmc(byte page_) +{; + { pointtype& with1 = vmc.wherewas[page_]; + if (with1.x!=maxint) + putimage(with1.x,with1.y,vmc.backpic[page_],0);} +} + +void setup_vmc() +{ + byte fv; +; +/* gd:=imagesize(0,0,15,15);*/ + + {; + getmem(vmc.andpic,mouse_size); + getmem(vmc.xorpic,mouse_size); + + for( fv=0; fv <= 1; fv ++) + {; + getmem(vmc.backpic[fv],mouse_size); + vmc.wherewas[fv].x=maxint; + } + } +} + +void show_off_mouse() +{; + + setcolor(14); settextstyle(0,0,2); + + for( gm=0; gm <= 1; gm ++) + {; + setactivepage(gm); + setfillstyle(1,blue); bar(0,0,getmaxx(),getmaxy()); + outtextxy(400,20,chr(48+gm)); + } + + gd=0; + do { + setactivepage(gd); + setvisualpage(1-gd); + gd=1-gd; + + delay(56); + + getbuttonstatus; + wipe_vmc(gd); + + if (plot>0) + {; + putpixel(plx,ply,red); + plot -= 1; + } + + plot_vmc(mx,my,gd); + + if ((mkey==left) && (plot==0)) + {; + plot=2; + plx=mx; + ply=my; + } + + } while (!(mkey==right)); + + for( gm=0; gm <= 1; gm ++) + {; + setactivepage(1-gm); + wipe_vmc(gm); + } + + setvisualpage(0); + setactivepage(0); +} + +void grab_cursor(byte n) +{; + getimage(32*n-16, 0,32*n-1,15,vmc.andpic); + getimage(32*n-16,20,32*n-1,35,vmc.xorpic); +} + +void save_mice() +{ + untyped_file f; + byte fv; +; + assign(f,"v:mice.avd"); + rewrite(f,1); + + blockwrite(f,mice_header,mouse_size); + + for( fv=1; fv <= 9; fv ++) + {; + grab_cursor(fv); + putimage(100,100,vmc.xorpic,0); + blockwrite(f,vmc.andpic,mouse_size); + blockwrite(f,vmc.xorpic,mouse_size); + } + + close(f); +} + +void load_a_mouse(byte which) +{ + untyped_file f; +; + assign(f,"v:mice.avd"); + reset(f,1); + seek(f,mouse_size*2*(which-1)+134); + + {; + blockread(f,vmc.andpic,mouse_size); + blockread(f,vmc.xorpic,mouse_size); + close(f); + { + void& with1 = mps[which]; + ; + vmc.ofsx=-horzhotspot; + vmc.ofsy=-verthotspot; + + setminmaxhorzcurspos(horzhotspot,624+horzhotspot); + setminmaxvertcurspos(verthotspot,199); + } + } + +} + +void draw_mouse_cursors() +{; + for( fv=1; fv <= 9; fv ++) + for( gm=0; gm <= 1; gm ++) + for( gd=0; gd <= 15; gd ++) + a[gd+gm*20][fv*2]=swapbits(mps[fv].mask[gm][gd]); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + resetmouse; + setup_vmc(); + + draw_mouse_cursors(); + + + save_mice(); + +/* grab_cursor(3);*/ +/* load_a_mouse(4); + setgraphicscursor(mps[4]); + + show_off_mouse; + on; repeat getbuttonstatus until mkey=left; off; + show_off_mouse;*/ +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp new file mode 100644 index 000000000000..1919b118decf --- /dev/null +++ b/engines/avalanche/menuxf.cpp @@ -0,0 +1,48 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; + +void load() /* Load2, actually */ +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + assign(f,"maintemp.avd"); reset(f,1); + /* Compression method byte follows this... */ + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + bit=getpixel(0,0); +} + +void save() +{ + byte bit; untyped_file f; + + assign(f,"v:mainmenu.avd"); + rewrite(f,1); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,mem[0xa000*48*80],59*80); + } + close(f); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=1; initgraph(gd,gm,""); + load(); /* Between 48 and 107. */ + + save(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp new file mode 100644 index 000000000000..824fc806bcf7 --- /dev/null +++ b/engines/avalanche/minstran.cpp @@ -0,0 +1,37 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; +pointer p; word s; + +void mblit(integer x1,integer y1,integer x2,integer y2) /* Minstrel Blitter */ +{ + integer yy,len,pp; byte bit; const integer offset = 16384; +; + x1=x1 / 8; len=((x2 / 8)-x1)+1; + for( yy=y1; yy <= y2; yy ++) + {; + pp=yy*80+x1; + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(mem[0xa000*offset+pp],mem[0xa000*pp],len); + } + } +} + +const integer fx1 = 100; const integer fy1 = 100; const integer fx2 = 135; const integer fy2 = 145; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + setactivepage(1); setfillstyle(7,9); bar(0,0,640,200); + mblit(fx1,fy1,fx2,fy2); + s=imagesize(fx1,fy1,fx2,fy2); getmem(p,s); + getimage(fx1,fy1,fx2,fy2,p); setactivepage(0); + putimage(fx1+100,fy1,p,0); freemem(p,s); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp new file mode 100644 index 000000000000..073e546f250c --- /dev/null +++ b/engines/avalanche/newsprit.cpp @@ -0,0 +1,124 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +const string crlf = string('\15')+'\12'; const char eof_ = '\32'; +const array<1,177,char> trip5head = + string("Sprite*.AVD ... data file for Trippancy Five")+crlf+crlf+ + "[Thorsoft relocatable fiveplane sprite image format]"+crlf+crlf+ + "Thomas Thurman was here. ... Have fun!"+crlf+crlf+eof_+ + " * G. I. E. D. ! * "; + +const array<1,4,char> tripid = string('\x30')+'\x1'+'\x75'+'\261'; + +const array<1,50,char> trip5foot = crlf+crlf+ + " and that's it! Enjoy the game. "+'\3'+crlf+crlf+ + "\n\n\n\n\n\n\n"+"tt"; + +struct adxotype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +struct adxtype { + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +}; + +varying_string<2> sn; +adxotype oa; +adxtype a; +matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ +array<1,16000,byte> aa; +untyped_file out; +integer bigsize; + +void copyaoa() +{; + {; + a.name=oa.name; + a.comment="Transferred"; + a.num=oa.num; + a.xl=oa.xl; + a.yl=oa.yl; + a.seq=oa.seq; + a.size=oa.size; + a.fgc=oa.fgc; + a.bgc=oa.bgc; + } +} + +void setup() +{ + integer gd,gm; +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +} + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void save() +{ + byte sort,n; + word fv,ff; char r; byte xw; + byte nxl,nyl; + word soa; +; + cleardevice(); + {; + a.xl=45; a.yl=10; a.num=1; a.seq=1; + a.size=imagesize(0,0,a.xl,a.yl); + soa=sizeof(a); + + assign(out,"v:sprite10.avd"); rewrite(out,1); + blockwrite(out,trip5head,177); + blockwrite(out,tripid,4); + blockwrite(out,soa,2); + blockwrite(out,a,soa); + + nxl=a.xl; nyl=a.yl; + xw=nxl / 8; + if ((nxl % 8)>0) xw += 1; + + for( n=1; n <= a.num; n ++) + {; + getimage( 0,0,a.xl,a.yl,aa); + for( fv=0; fv <= nyl; fv ++) + blockwrite(out,aa[5+fv*xw*4],xw); + + getimage(100,0,100+a.xl,a.yl,aa); + blockwrite(out,aa[5],a.size-6); + } + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup(); + save(); + + blockwrite(out,trip5foot,50); + close(out); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp new file mode 100644 index 000000000000..e5da17adff5c --- /dev/null +++ b/engines/avalanche/nim.cpp @@ -0,0 +1,381 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Dos.h"*/ + + +const array > names = {{"Avalot","Dogfood"}}; + +array<1,3,byte> old,stones; +array<0,3,0,22,1,7,byte> stonepic; /* picture of Nimstone */ +byte turns; +boolean dogfoodsturn; byte fv; byte stonesleft; + +boolean clicked; + +byte row,number; + +boolean squeak; +shortint mnum,mrow; + +registers r; + +void resetmouse() +{; + r.ax=0; intr(0x33,r); + squeak=r.ax>0; +} + +void show() +{; + r.ax=1; intr(0x33,r); +} + +void hide() +{; + r.ax=2; intr(0x33,r); +} + +void chalk(integer x,integer y, string z) +{ + const array<0,3,byte> greys = {{0,8,7,15}}; + byte fv; +; + for( fv=0; fv <= 3; fv ++) + {; + setcolor(greys[fv]); + outtextxy(x-fv,y,z); + sound(fv*100*length(z)); delay(3); nosound; delay(30); + } +} + +void setup() +{ + untyped_file f; + integer gd,gm; + byte bit; +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + assign(f,"c:\\avalot\\nim.avd"); + reset(f,1); + seek(f,41); + for( gm=0; gm <= 22; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,stonepic[bit][gm],7); + } + for( gd=1; gd <= 3; gd ++) + for( gm=0; gm <= 22; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[0xa000*3200+gd*2800+gm*80],7); + } + for( gm=0; gm <= 36; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[0xa000*400+49+gm*80],30); + } + close(f); + + gd=getpixel(0,0); /* clear codes */ + setcolor(4); rectangle(394,50,634,197); + setfillstyle(1,6); bar(395,51,633,196); + rectangle(10,5,380,70); bar(11,6,379,69); + setcolor(15); + outtextxy(475,53,"SCOREBOARD:"); + setcolor(14); + outtextxy(420,63,"Turn:"); + outtextxy(490,63,"Player:"); + outtextxy(570,63,"Move:"); + + for( gd=1; gd <= 3; gd ++) stones[gd]=gd+2; + + turns=0; dogfoodsturn=true; + + chalk(27,15,"Take pieces away with:"); + chalk(77,25,"1) the mouse (click leftmost)"); + chalk(53,35,"or 2) the keyboard:"); + chalk(220,35,string('\30')+'/'+'\31'+": choose row,"); + chalk(164,45,string("+/- or ")+'\33'+'/'+'\32'+": more/fewer,"); + chalk(204,55,"Enter: take stones."); + + row=1; number=1; fillchar(old,sizeof(old),'\0'); stonesleft=12; + resetmouse(); +} + +void plotstone(byte x,byte y) +{ + byte fv,bit; word ofs; +; + ofs=3200+y*2800+x*8; + for( fv=0; fv <= 22; fv ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(stonepic[bit][fv],mem[0xa000*ofs+fv*80],7); + } +} + +void board() +{ + byte fv,ff; +; + for( fv=1; fv <= 3; fv ++) + for( ff=1; ff <= stones[fv]; ff ++) + plotstone(ff,fv); +} + +void startmove() +{ + varying_string<2> tstr; integer ypos; +; + turns += 1; str(turns,2,tstr); ypos=63+turns*10; + dogfoodsturn=! dogfoodsturn; + chalk(433,ypos,tstr); + chalk(493,ypos,names[dogfoodsturn]); + old=stones; +} + +void show_changes() +{ + byte fv,ff,fq; +; + chalk(573,63+turns*10,string(chr(64+row))+chr(48+number)); + for( fv=1; fv <= 3; fv ++) + if (old[fv]>stones[fv]) + for( ff=stones[fv]+1; ff <= old[fv]; ff ++) + for( fq=0; fq <= 22; fq ++) fillchar(mem[0xa000*3200+fv*2800+ff*8+fq*80],7,'\0'); + stonesleft -= number; +} + +void checkmouse(); + +static void blip() {; sound(1771); delay(3); nosound; clicked=false; } + +void checkmouse() +{; + {; ax=5; bx=0; } intr(0x33,r); + clicked=r.bx>0; + if (clicked) + {; /* The mouse was clicked. Where? */ + mrow=(dx-38) / 35; + if ((mrow<1) || (mrow>3)) blip(); + mnum=stones[mrow]-(cx / 64)+1; + if ((mnum<1) || (mnum>(unsigned char)stones[mrow])) blip(); + } +} + +void takesome(); + +static void less() {; if (number>1) number -= 1; } + +void takesome() +{ + char r; byte sr; +; + number=1; + do { + do { + sr=stones[row]; + if (sr==0) {; row=row % 3+1; number=1; } + } while (!(sr!=0)); + if (number>sr) number=sr; + setcolor(1); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); + /* Wait for choice */ + show(); + do { checkmouse(); } while (!(keypressed() || clicked)); + if (keypressed()) r=upcase(readkey()); + hide(); + + setcolor(0); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); + + if (clicked) + {; + number=mnum; + row=mrow; + return; + } else + {; + switch (r) { + case '\0': switch (readkey()) { + case 'H': if (row>1) row -= 1; break; /* Up */ + case 'P': if (row<3) row += 1; break; /* Down */ + case 'K': number += 1; break; + case 'M': less(); break; + case 'I': row=1; break; /* PgUp */ + case 'Q': row=3; break; /* PgDn */ + case 'G': number=5; break; /* Home- check routine will knock this down to size */ + case 'O': number=1; break; /* End */ + } + break; + case '+': number += 1; break; + case '-': less(); break; + case RANGE_3('A','C'): row=ord(r)-64; + break; + case RANGE_5('1','5'): number=ord(r)-48; + break; + case '\15': return; break; /* Enter was pressed */ + } + } + } while (!false); +} + +void endofgame() +{ + char rr; +; + chalk(595,63+turns*10,"Wins!"); + outtextxy(100,190,"- - - Press any key... - - -"); + while (keypressed()) rr=readkey(); + do { ax=5; bx=0; intr(0x33,r); } while (!(keypressed() || (bx>0))); + if (keypressed()) rr=readkey(); +} + +void dogfood(); + /* AI procedure to play the game */ +const matrix<1,3,1,2,byte> other = {{{{2,3}},{{1,3}},{{1,2}}}}; + + +static byte live,fv,ff,matches,thisone,where; + +static array<1,3,byte> r,sr; +static array<1,3,boolean> inap; + +static boolean lmo; /* Let Me Out! */ + +static byte ooo; /* Odd one out */ + + +static boolean find(byte x) + /* This gives True if there's a pile with x stones in. */ +{ + boolean q; byte p; +boolean find_result; +; + q=false; + for( p=1; p <= 3; p ++) if (stones[p]==x) {; q=true; inap[p]=true; } + find_result=q; +return find_result; +} + + + +static void find_ap(byte start,byte stepsize) +{ + byte ff; +; + matches=0; + fillchar(inap,sizeof(inap),'\0'); /* blank 'em all */ + for( ff=0; ff <= 2; ff ++) if (find(start+ff*stepsize)) matches += 1; + else thisone=ff; + + /* Now.. Matches must be 0, 1, 2, or 3. + 0/1 mean there are no A.P.s here, so we'll keep looking, + 2 means there is a potential A.P. that we can create (ideal!), and + 3 means that we're already in an A.P. (Trouble!). */ + + switch (matches) { + case 2: {; + for( ff=1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ + if (! inap[ff]) ooo=ff; + if (stones[ooo]>(start+thisone*stepsize)) /* check it's possible! */ + {; /* create an A.P. */ + row=ooo; /* already calculated */ + /* Start+thisone*stepsize will give the amount we SHOULD have here. */ + number=stones[row]-(start+thisone*stepsize); lmo=true; return; + } + } + break; + case 3: {; /* we're actually IN an A.P! Trouble! Oooh dear. */ + row=r[3]; number=1; lmo=true; return; /* take 1 from the largest pile */ + } + break; + } +} + +void dogfood() +{ + boolean sorted; byte temp; + +; + live=0; lmo=false; + for( fv=1; fv <= 3; fv ++) + {; + if (stones[fv]>0) + {; + live += 1; + r[live]=fv; sr[live]=stones[fv]; + } + } + switch (live) { + case 1: /* Only one is free- so take 'em all */ + {; row=r[1]; number=stones[r[1]]; return; } + break; + case 2: /* Two are free- make them equal */ + {; + if (sr[1]>sr[2]) + {; row=r[1]; number=sr[1]-sr[2]; return; } else /* T > b */ + if (sr[1] t */ + {; row=r[1]; number=1; return; } /* B = t... oh no, we've lost! */ + } + break; + case 3: /* Ho hum... this'll be difficult! */ + {; + /* There are three possible courses of action when we have 3 lines left: + 1) Look for 2 equal lines, then take the odd one out. + 2) Look for A.P.s, and capitalise on them. + 3) Go any old where. */ + + for( fv=1; fv <= 3; fv ++) /* Look for 2 equal lines */ + if (stones[other[fv][1]]==stones[other[fv][2]]) + {; + row=fv; /* this row */ number=stones[fv]; /* all of 'em */ return; + } + + do { + sorted=true; + for( fv=1; fv <= 2; fv ++) + if (sr[fv]>sr[fv+1]) + {; + temp=sr[fv+1]; sr[fv+1]=sr[fv]; sr[fv]=temp; + temp= r[fv+1]; r[fv+1]= r[fv]; r[fv]=temp; + sorted=false; + } + } while (!sorted); + /* Now we look for A.P.s ... */ + for( fv=1; fv <= 3; fv ++) + {; + find_ap(fv,1); /* there are 3 "1"s */ + if (lmo) return; /* cut-out */ + } + find_ap(1,2); /* only "2" possible */ + if (lmo) return; + + /* A.P. search must have failed- use the default move. */ + row=r[3]; number=1; return; + } + break; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup(); + board(); + do { + startmove(); + if (dogfoodsturn) dogfood(); else takesome(); + stones[row] -= number; + show_changes(); + } while (!(stonesleft==0)); + endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp new file mode 100644 index 000000000000..afcac6d85098 --- /dev/null +++ b/engines/avalanche/nimdraw.cpp @@ -0,0 +1,94 @@ +#include "ptoc.h" + + +#include "graph.h" + + +const string header = string("Datafile for Avalot, copyright (c) 1992.")+'\32'; + +integer gd,gm,x,y; +untyped_file f; +byte bit; + +void plot(char ch, byte x) +{; + setcolor(blue); outtextxy(x*80+4,0,ch); outtextxy(x*80+10,0,ch); + setcolor(lightblue); outtextxy(x*80+5,0,ch); outtextxy(x*80+9,0,ch); + setcolor(darkgray); outtextxy(x*80+6,0,ch); outtextxy(x*80+8,0,ch); + setcolor(yellow); outtextxy(x*80+7,0,ch); +} + +void load() +{ + byte z; + array<1,4,pointer> a; + varying_string<12> check; + untyped_file f; word s; +; + assign(f,"c:\\avalot\\nimstone.avd"); reset(f,1); + seek(f,85); z=3; + s=imagesize(0,0,getmaxx(),75); + getmem(a[z],s); + blockread(f,a[z],s); + putimage(0,7,a[z],0); + freemem(a[z],s); close(f); +} + +void spludge(integer x,integer y, string z) +{ + shortint dx,dy; +; + setcolor(15); + for( dx=-1; dx <= 1; dx ++) + for( dy=-1; dy <= 1; dy ++) + outtextxy(x+dx,y+dy,z); + setcolor(0); + outtextxy(x,y,z); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + load(); + settextstyle(4,0,0); setusercharsize(2,1,1,1); + plot('A',1); + plot('B',2); + plot('C',3); +/* rectangle(gd*80,7,56+gd*80,29); */ + + setfillstyle(1,1); setcolor(9); + fillellipse( 97,104,6,4); fillellipse(321,104,6,4); + fillellipse( 97,131,6,4); fillellipse(321,131,6,4); + bar(97,100,321,134); + bar(92,104,326,131); + setfillstyle(1,9); + bar(91,103, 91,131); bar(327,104,327,131); + bar(98, 99,321, 99); bar( 97,135,321,135); + + settextstyle(2,0,0); setusercharsize(20,10,11,10); + spludge( 99,100,"The Ancient Game of"); + settextstyle(1,0,0); setusercharsize(40,10,10,10); + spludge( 99,105,"NIM"); + + /* now save it all! */ + + assign(f,"c:\\avalot\\nim.avd"); + rewrite(f,1); + blockwrite(f,header[1],length(header)); + for( gd=0; gd <= 3; gd ++) + for( gm=7; gm <= 29; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,mem[0xa000*gd*10+gm*80],7); + } + for( gm=99; gm <= 135; gm ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,mem[0xa000*11+gm*80],30); + } + close(f); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp new file mode 100644 index 000000000000..0becd47d1087 --- /dev/null +++ b/engines/avalanche/nimunit.cpp @@ -0,0 +1,443 @@ +#include "ptoc.h" + +/* + + + + + NIM UNIT A unit version of the pub game (Nim). */ + +#define __nimunit_implementation__ + + +#include "nimunit.h" + + +const array > names = {{"Avalot","Dogfood"}}; + +array<1,3,byte> old,stones; +array<0,3,0,22,1,7,byte> stonepic; /* picture of Nimstone */ +byte turns; +boolean dogfoodsturn; byte fv; byte stonesleft; + +boolean clicked; + +byte row,number; + +boolean squeak; +shortint mnum,mrow; + +void chalk(integer x,integer y, string z) +{ + const array<0,3,byte> greys = {{0,8,7,15}}; + byte fv; + + for( fv=0; fv <= 3; fv ++) + { + setcolor(greys[fv]); + outtextxy(x-fv,y,z); + sound(fv*100*length(z)); delay(3); nosound; delay(30); + } +} + +void setup() +{ + const integer page3 = 0xac00; + byte gd,gm; + untyped_file f; + byte bit; + + setactivepage(3); + setvisualpage(3); + cleardevice(); + dawn(); + + assign(f,"nim.avd"); + reset(f,1); + seek(f,41); + for( gm=0; gm <= 22; gm ++) + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,stonepic[bit][gm],7); + } + for( gd=1; gd <= 3; gd ++) + for( gm=0; gm <= 22; gm ++) + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[page3*3200+gd*2800+gm*80],7); + } + for( gm=0; gm <= 36; gm ++) + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[page3*400+49+gm*80],30); + } + close(f); + + gd=getpixel(0,0); /* clear codes */ + setcolor(4); rectangle(394,50,634,197); + setfillstyle(1,6); bar(395,51,633,196); + rectangle(10,5,380,70); bar(11,6,379,69); + setcolor(15); + outtextxy(475,53,"SCOREBOARD:"); + setcolor(14); + outtextxy(420,63,"Turn:"); + outtextxy(490,63,"Player:"); + outtextxy(570,63,"Move:"); + + for( gd=1; gd <= 3; gd ++) stones[gd]=gd+2; + + turns=0; dogfoodsturn=true; + + chalk(27,15,"Take pieces away with:"); + chalk(77,25,"1) the mouse (click leftmost)"); + chalk(53,35,"or 2) the keyboard:"); + chalk(220,35,string('\30')+'/'+'\31'+": choose row,"); + chalk(164,45,string("+/- or ")+'\33'+'/'+'\32'+": more/fewer,"); + chalk(204,55,"Enter: take stones."); + + row=1; number=1; fillchar(old,sizeof(old),'\0'); stonesleft=12; + + /* Set up mouse. */ + off_virtual(); + oncandopageswap=false; + + setactivepage(3); + setvisualpage(3); +} + +void plotstone(byte x,byte y) +{ + byte fv,bit; word ofs; + + ofs=3200+y*2800+x*8; + for( fv=0; fv <= 22; fv ++) + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(stonepic[bit][fv],mem[0xac00*ofs+fv*80],7); + } +} + +void board() +{ + byte fv,ff; + + for( fv=1; fv <= 3; fv ++) + for( ff=1; ff <= stones[fv]; ff ++) + plotstone(ff,fv); +} + +void startmove() +{ + varying_string<2> tstr; integer ypos; + + turns += 1; str(turns,2,tstr); ypos=63+turns*10; + dogfoodsturn=! dogfoodsturn; + chalk(433,ypos,tstr); + chalk(493,ypos,names[dogfoodsturn]); + old=stones; +} + +void show_changes() +{ + byte fv,ff,fq; varying_string<2> move; + + move=string(chr(64+row))+chr(48+number); + chalk(573,63+turns*10,move); + log_aside(names[dogfoodsturn]+" plays "+move+'.'); + + for( fv=1; fv <= 3; fv ++) + if (old[fv]>stones[fv]) + for( ff=stones[fv]+1; ff <= old[fv]; ff ++) + for( fq=0; fq <= 22; fq ++) fillchar(mem[0xac00*3200+fv*2800+ff*8+fq*80],7,'\0'); + stonesleft -= number; +} + +void checkmouse(); + +static void blip() { note(1771); delay(3); nosound; clicked=false; } + +void checkmouse() +{ + xycheck(); /* Check the mouse */ + clicked=keystatus>0; + if (clicked) + { + void& with = r; + /* The mouse was clicked. Where? */ + mrow=(my-38) / 35; + if ((mrow<1) || (mrow>3)) blip(); + mnum=stones[mrow]-(mx / 64)+1; + if ((mnum<1) || (mnum>(unsigned char)stones[mrow])) blip(); + } +} + +void takesome(); + +static void less() { if (number>1) number -= 1; } + +void takesome() +{ + char r; byte sr; + + number=1; + do { + do { + sr=stones[row]; + if (sr==0) { row=row % 3+1; number=1; } + } while (!(sr!=0)); + if (number>sr) number=sr; + setcolor(1); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); + /* Wait for choice */ + on(); + do { checkmouse(); } while (!(keypressed() || clicked)); + if (keypressed()) r=upcase(readkey()); + off(); + + setcolor(0); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); + + if (clicked) + { + number=mnum; + row=mrow; + return; + } else + { + switch (r) { + case '\0': switch (readkey()) { + case 'H': if (row>1) row -= 1; break; /* Up */ + case 'P': if (row<3) row += 1; break; /* Down */ + case 'K': number += 1; break; + case 'M': less(); break; + case 'I': row=1; break; /* PgUp */ + case 'Q': row=3; break; /* PgDn */ + case 'G': number=5; break; /* Home- check routine will knock this down to size */ + case 'O': number=1; break; /* End */ + } + break; + case '+': number += 1; break; + case '-': less(); break; + case RANGE_3('A','C'): row=ord(r)-64; + break; + case RANGE_5('1','5'): number=ord(r)-48; + break; + case '\15': return; break; /* Enter was pressed */ + } + } + } while (!false); +} + +void endofgame() +{ + char rr; + + chalk(595,63+turns*10,"Wins!"); + outtextxy(100,190,"- - - Press any key... - - -"); + while (keypressed()) rr=readkey(); + do { check(); } while (!(mpress==0)); + + { void& with = r; do { check(); } while (!(keypressed() || (mrelease>0)));} + if (keypressed()) rr=readkey(); + + mousepage(cp); + off(); + on_virtual(); +} + +void dogfood(); + /* AI procedure to play the game */ +const matrix<1,3,1,2,byte> other = {{{{2,3}},{{1,3}},{{1,2}}}}; + + +static byte live,fv,ff,matches,thisone,where; + +static array<1,3,byte> r,sr; +static array<1,3,boolean> inap; + +static boolean lmo; /* Let Me Out! */ + +static byte ooo; /* Odd one out */ + + +static boolean find(byte x) + /* This gives True if there's a pile with x stones in. */ +{ + boolean q; byte p; + + boolean find_result; + q=false; + for( p=1; p <= 3; p ++) if (stones[p]==x) { q=true; inap[p]=true; } + find_result=q; + return find_result; +} + + + +static void find_ap(byte start,byte stepsize) +{ + byte ff; + + matches=0; + fillchar(inap,sizeof(inap),'\0'); /* blank 'em all */ + for( ff=0; ff <= 2; ff ++) if (find(start+ff*stepsize)) matches += 1; + else thisone=ff; + + /* Now.. Matches must be 0, 1, 2, or 3. + 0/1 mean there are no A.P.s here, so we'll keep looking, + 2 means there is a potential A.P. that we can create (ideal!), and + 3 means that we're already in an A.P. (Trouble!). */ + + switch (matches) { + case 2: { + for( ff=1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ + if (! inap[ff]) ooo=ff; + if (stones[ooo]>(start+thisone*stepsize)) /* check it's possible! */ + { /* create an A.P. */ + row=ooo; /* already calculated */ + /* Start+thisone*stepsize will give the amount we SHOULD have here. */ + number=stones[row]-(start+thisone*stepsize); lmo=true; return; + } + } + break; + case 3: { /* we're actually IN an A.P! Trouble! Oooh dear. */ + row=r[3]; number=1; lmo=true; return; /* take 1 from the largest pile */ + } + break; + } +} + +void dogfood() +{ + boolean sorted; byte temp; + + + live=0; lmo=false; + for( fv=1; fv <= 3; fv ++) + { + if (stones[fv]>0) + { + live += 1; + r[live]=fv; sr[live]=stones[fv]; + } + } + switch (live) { + case 1: /* Only one is free- so take 'em all */ + { row=r[1]; number=stones[r[1]]; return; } + break; + case 2: /* Two are free- make them equal */ + { + if (sr[1]>sr[2]) + { row=r[1]; number=sr[1]-sr[2]; return; } else /* T > b */ + if (sr[1] t */ + { row=r[1]; number=1; return; } /* B = t... oh no, we've lost! */ + } + break; + case 3: /* Ho hum... this'll be difficult! */ + { + /* There are three possible courses of action when we have 3 lines left: + 1) Look for 2 equal lines, then take the odd one out. + 2) Look for A.P.s, and capitalise on them. + 3) Go any old where. */ + + for( fv=1; fv <= 3; fv ++) /* Look for 2 equal lines */ + if (stones[other[fv][1]]==stones[other[fv][2]]) + { + row=fv; /* this row */ number=stones[fv]; /* all of 'em */ return; + } + + do { + sorted=true; + for( fv=1; fv <= 2; fv ++) + if (sr[fv]>sr[fv+1]) + { + temp=sr[fv+1]; sr[fv+1]=sr[fv]; sr[fv]=temp; + temp= r[fv+1]; r[fv+1]= r[fv]; r[fv]=temp; + sorted=false; + } + } while (!sorted); + /* Now we look for A.P.s ... */ + for( fv=1; fv <= 3; fv ++) + { + find_ap(fv,1); /* there are 3 "1"s */ + if (lmo) return; /* cut-out */ + } + find_ap(1,2); /* only "2" possible */ + if (lmo) return; + + /* A.P. search must have failed- use the default move. */ + row=r[3]; number=1; return; + } + break; + } +} + +void play_nim() /* Plays the game. Only procedure in this unit to + be declared in the interface section. */ +{ + byte groi; + + if (dna.wonnim) + { /* Already won the game. */ + dixi('Q',6); + return; + } + + if (! dna.asked_dogfood_about_nim) + { + dixi('q',84); + return; + } + + dixi('Q',3); + dna.playednim += 1; + dusk(); + oncandopageswap=false; + copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); + off(); + + setup(); + board(); + on(); + mousepage(3); + + do { + startmove(); + if (dogfoodsturn) dogfood(); else takesome(); + stones[row] -= number; + show_changes(); + } while (!(stonesleft==0)); + endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ + + dusk(); off(); + oncandopageswap=true; + copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); + on(); dawn(); + + if (dogfoodsturn) + { /* Dogfood won - as usual */ + log_aside("He won."); + if (dna.playednim==1) /* Your first game */ + dixi('Q',4); /* Goody! Play me again? */ + else + dixi('Q',5); /* Oh, look at that! I've won again! */ + pennycheck(4); /* And you've just lost 4d! */ + } else + { /* You won - strange! */ + log_aside("You won."); + dixi('Q',7); /* You won! Give us a lute! */ + dna.obj[lute]=true; + objectlist(); + dna.wonnim=true; + show_one(1); /* Show the settle with no lute on it. */ + points(7); /* 7 points for winning! */ + } + + if (dna.playednim==1) points(3); /* 3 points for playing your 1st game. */ + +} + + /* No init part. */ diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h new file mode 100644 index 000000000000..5e3386d47f6b --- /dev/null +++ b/engines/avalanche/nimunit.h @@ -0,0 +1,18 @@ +#ifndef __nimunit_h__ +#define __nimunit_h__ + + +#include "gyro.h" + #include "Graph.h" + /*#include "Crt.h"*/ +#include "pingo.h" +#include "visa.h" +#include "lucerna.h" +#include "logger.h" +#include "celer.h" + + + void play_nim(); + + +#endif diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp new file mode 100644 index 000000000000..c54a4696be0a --- /dev/null +++ b/engines/avalanche/oldfiler.cpp @@ -0,0 +1,260 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ +#include "graph.h" +/*#include "Dos.h"*/ +/*#include "Rodent.h"*/ + +/*$V-*/ + +const char more[] = " (more) "; +const string up = string('-')+'\30'+more+'\30'; +const string down = string('+')+'\31'+more+'\31'; + +const graphcursmasktype fletch = /* Mask 4 in Avalot */ + {( + (255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511), + (0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0)), + 0, + 0}; + +string cdir; +matrix<0,2,1,18,varying_string<15> > info; +matrix<0,2,1,100,varying_string<15> > possible; +byte fv; +array<0,2,byte> light,page_; +array<0,2,boolean> blank; +byte chtcode,where; +string answer; + +void split(string x) +{ + byte fv; +; + x=copy(x,4,255); if (x=="") {; blank[0]=true; return; } + x=x+'\\'; possible[0][1]="b\\"; fv=2; + while (pos("\\",x)!=0) + {; + possible[0][fv]=string('b')+copy(x,1,pos("\\",x)-1); fv += 1; + x=copy(x,pos("\\",x)+1,255); + } + possible[0][fv-1]=""; +} + +void block(integer x1,integer y1,integer x2,integer y2, string x) +{; + bar(x1,y1,x2,y2); + setcolor( 9); outtextxy(x1+(x2-x1) / 2-1,y1+5,x); + setcolor(15); outtextxy(x1+(x2-x1) / 2+1,y1+6,x); +} + +void message(string x) +{; + block(5,189,640,200,x); +} + +void bigbar(byte x) +{; + bar(15+210*x,36,210+210*x,187); +} + +void getem(); + + +static void sub_getem(char prefix, string spec, byte attrib,byte infonum) +{ + searchrec s; byte fv; +; + fv=0; + findfirst(spec,attrib,s); + while ((doserror==0) && (fv<100)) + {; + if (((s.attr & attrib)>0) && (s.name[1]!='.')) + {; /* circumvent inclusive searching! */ + fv += 1; + possible[infonum][fv]=string(prefix)+s.name; + } + findnext(s); + } + if (fv==0) blank[infonum]=true; +} + +void getem() + +{; + message("Please wait... scanning directory..."); + sub_getem('a',"*.asg",archive+hidden,1); /* Scan for .ASG files */ + sub_getem('f',"*.*",directory,2); /* Scan for sub-directories */ +} + +void minisc(string& x) /* Converts to lower-case */ +{ + byte fv; +; + for( fv=1; fv <= length(x); fv ++) + if ((x[fv]>='A') && (x[fv]<='Z')) x[fv] += 32; +} + +void showall() +{ + byte fv,ff; +; + for( fv=0; fv <= 2; fv ++) + {; + bigbar(fv); /* blank out anything else */ + if (blank[fv]) + {; /* nothing here at all */ +/* setcolor(14); + outtextxy(113+210*fv,43,'(Nothing here!)'); */ + setcolor(14); settextstyle(0,0,2); + outtextxy(113+210*fv, 77,"Nothing"); + outtextxy(113+210*fv,100,"here!"); + settextstyle(0,0,1); + } else + {; /* something here- what? */ + setcolor(11); + for( ff=0; ff <= 15; ff ++) + {; + info[fv][ff+2]=possible[fv][page_[fv]*15+ff+1]; minisc(info[fv][ff+2]); + } + if (page_[fv]>0) info[fv][1]=up; else info[fv][1]=""; + if (possible[fv][page_[fv]*15+17]!="") + info[fv][18]=down; else info[fv][18]=""; + for( ff=1; ff <= 18; ff ++) + {; + outtextxy(113+210*fv,35+ff*8,copy(info[fv][ff],2,255)); + } + } + } + block(5,12,640,22,cdir); +} + +void changedir(string x) +{; + + chdir(x); getdir(0,cdir); +} + +void drawup() +{ + integer gd; +; + block( 15, 0,630,10,"Choose an .ASG file to load or save."); + block( 15,24,210,34,"Looking back:"); + block(225,24,420,34,"Here:"); + block(435,24,630,34,"Looking forwards:"); + for( gd=0; gd <= 2; gd ++) bigbar(gd); /* just to tide us over the wait... */ + showall(); +} + +void setup() +{; + settextjustify(1,1); setfillstyle(1,1); + fillchar(blank,sizeof(blank),'\0'); fillchar( info,sizeof( info),'\0'); + fillchar(possible,sizeof(possible),'\0'); + fillchar( page_,sizeof( page_),'\0'); + split(cdir); getem(); drawup(); +} + +void setup1() +{ + integer gd,gm; +; + gd=3; gm=0; initgraph(gd,gm,""); answer=""; + getdir(0,cdir); resetmouse; setgraphicscursor(fletch); + fillchar(light,sizeof(light),'\0'); + setup(); +} + +void clickwait() +{ + const array<1,4,varying_string<30> > msg = + {{"change to another drive.", + "return to a lower directory.", + "use the file named.", + "enter a sub-directory."}}; + byte oldcht; /* Click Here To... code */ +; + showmousecursor; oldcht=177; + do { + if (mousey<38) chtcode=1; else + switch (mousex) { + case 0 ... 210: chtcode=2; break; + case 211 ... 421: chtcode=3; break; + default: chtcode=4; + } + if (oldcht!=chtcode) + {; + hidemousecursor; message(string("Click here to ")+msg[chtcode]); + showmousecursor; oldcht=chtcode; + } + } while (!leftmousekeypressed); + hidemousecursor; where=((mousey-39) / 8)+1; +} + +void blip() +{; + sound(32); delay(3); nosound; +} + +void do_cht() +{ + char r; byte fv; string x; +; + if (chtcode==1) + {; /* change drives */ + message("Enter the drive letter (e.g. A)..."); + r=readkey(); + changedir(string(r)+':'); setup(); + } else + {; + x=info[chtcode-2][where]; r=x[1]; x=copy(x,2,255); + switch (r) { + case 'b': {; /* back some dirs */ + if (x=='\\') x=""; + for( fv=where-1; fv >= 3; fv --) + x=copy(info[0][fv],2,255)+'\\'+x; + changedir(string('\\')+x); + setup(); + } + break; + case 'f': {; /* sub-directory */ + changedir(x); + setup(); + } + break; + case '+': {; /* scroll one panel down */ + page_[chtcode-2] += 1; + drawup(); + } + break; + case '-': {; /* scroll one panel up */ + page_[chtcode-2] -= 1; + drawup(); + } + break; + case 'a': answer=x; break; + } + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup1(); + do { + clickwait(); + do_cht(); + } while (!(answer!="")); + if (length(cdir)>3) cdir=cdir+'\\'; + answer=cdir+answer; + closegraph(); + output << "Routine completed." << NL; + output << "Answer: " << answer << NL; + output << "Hit Enter:"; input >> NL; +return EXIT_SUCCESS; +} + + + diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp new file mode 100644 index 000000000000..1aed0c5026f3 --- /dev/null +++ b/engines/avalanche/oldhighs.cpp @@ -0,0 +1,249 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +struct scoretype { + varying_string<39> name; + word score; +}; + +struct ratetype { + varying_string<10> rank; + word lowest; +}; + +struct tabletype { + array<1,12,scoretype> a; + byte light; +}; + +const array<1,9,ratetype> ratings = + {{{"Rubbish", 0}, + {"Beginner", 1}, + {"Poor", 10}, + {"Average", 30}, + {"Fair", 50}, + {"Not bad", 70}, + {"Good", 100}, + {"Great", 200}, + {"Fantastic!", 330}}}; + +integer gd,gm; +tabletype table; + +byte ratingname(word x) +{ + byte fv; +byte ratingname_result; +; + for( fv=9; fv >= 1; fv --) + if (x>=ratings[fv].lowest) + {; + ratingname_result=fv; + return ratingname_result; + } /* bad style */ +return ratingname_result; +} + +void title(); + +const string message = "A v a l o t : H i g h - S c o r e s"; + + +static void sayfast(integer x,integer y) +{ + integer anchor; byte fv; +; + anchor=-296; + for( fv=1; fv <= length(message); fv ++) + {; + if (message[fv-1]!='\40') outtextxy(x+anchor,y-8,message[fv-1]); + anchor += 16; + } +} + +void title() +{ + const array<0,6,byte> shades = + {{blue,lightgray,darkgray,blue,lightblue,blue,darkgray}}; + byte x; + integer len; + +; + settextstyle(0,0,2); /*settextjustify(1,1);*/ + len=textheight(message); + for( x=6; x >= 0; x --) + {; + setcolor(shades[x]); + sayfast(320-x*2,20-x); + if (x>0) + {; + sayfast(320+x*2,20-x); + sayfast(320+x*2,20+x); + sayfast(320-x*2,20+x); + } + } +} + +void newtable() +{ + const array<1,12,varying_string<15> > names = + {{"Mike","Liz","Thomas","Mark","Mandy","Andrew","Lucy Tryphena","", + "Thanks to all","who helped...","","Have fun!"}}; + byte fv; +; + fillchar(table,sizeof(table),'\261'); + for( fv=1; fv <= 12; fv ++) + { + scoretype& with = table.a[fv]; + ; + with.name=names[fv]; + with.score=193-fv*16; + } + table.light=1; +} + +string strf(longint x) /* From Gyro. Delete when integrated. */ +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void sparkle(integer x,integer y, string z) +{; + setcolor(cyan); outtextxy(x-1,y-1,z); + setcolor(blue); outtextxy(x+1,y+1,z); + setcolor(white); outtextxy(x ,y ,z); +} + +void drawtable() +{ + byte fv,last,now; +; + setfillstyle(1,8); + bar( 0, 40,105, 58); bar(110, 40,400, 58); + bar(405, 40,490, 58); bar(495, 40,640, 58); + bar( 5, 60,105,181); bar(110, 60,400,181); + bar(405, 60,490,181); bar(495, 60,635,181); + bar( 0,185,640,190); + setcolor(lightred); settextstyle(0,0,1); settextjustify(0,0); + outtextxy( 45,55,"Number:"); + outtextxy(120,55,"Name:"); + outtextxy(420,55,"Score:"); + outtextxy(500,55,"Rating:"); + setcolor(white); last=177; + for( fv=1; fv <= 12; fv ++) + { + scoretype& with = table.a[fv]; + ; + settextjustify(righttext,bottomtext); + sparkle(100,60+fv*10,strf(fv)+'.'); + sparkle(455,60+fv*10,strf(with.score)); + if (fv==table.light) sparkle(70,60+fv*10,string("")+'\20'); + + settextjustify(lefttext,bottomtext); + sparkle(120,60+fv*10,with.name); + now=ratingname(with.score); + if (now!=last) + sparkle(510,60+fv*10,ratings[ratingname(with.score)].rank); + else + sparkle(517,57+fv*10,",,"); + last=now; + } +} + +void message1(string x) +{; + setfillstyle(1,8); bar(0,190,640,200); + settextjustify(1,1); sparkle(320,195,x); +} + +void sorthst() +{ + byte fv; boolean ok; scoretype temp; +; + do { + ok=true; + for( fv=1; fv <= 11; fv ++) + if (table.a[fv].score i;char r; integer counter; byte flash; + +; + y=60+table.light*10; i=""; settextjustify(2,0); counter=999; flash=0; + do { + x=128+length(i)*8; + do { + counter += 1; + if (counter==1000) + {; + cursor(4+flash*10); + flash=1-flash; + counter=0; + } + delay(1); + } while (!keypressed()); + cursor(8); + sound(17177); r=readkey(); nosound; + if (r=='\10') {; + if (i[0]>'\0') {; + bar(x-17,y-10,x-8,y); + i[0] -= 1; sparkle(x-16,y,i[length(i)]); + } + } else {; + if ((i[0]<'\42') && (r!='\15')) {; + sparkle(x,y,r); + i=i+r; + } + } + counter=999; + } while (!(r=='\15')); +} + +void newscore(word sc) +{; + { scoretype& with = table.a[12]; + if (sc>with.score) + {; + with.name=""; with.score=sc; table.light=10; sorthst(); drawtable(); + message1("Well done! Please enter your name, then press Return..."); + entername(); + } else drawtable();} /* too low for score */ + message1("Press Space to continue..."); + do {; } while (!(keypressed() && (readkey()=='\40'))); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + title(); + newtable(); + newscore(/*177*/0); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp new file mode 100644 index 000000000000..252d8b36c3be --- /dev/null +++ b/engines/avalanche/oldincln.cpp @@ -0,0 +1,249 @@ +#include "ptoc.h" + +/* + + + + + INCLINE The command-line parser. */ + +#define __incline_implementation__ + + +#include "oldincln.h" + +#include "gyro.h" +#include "logger.h" + + +const integer bug_twonames = 255; +const integer bug_pandl = 254; +const integer bug_weirdswitch = 253; +const integer bug_invalidini = 252; +const integer bug_notyesorno = 251; + +byte fv; +char t; +string bugline; +boolean usingp,usingl; +boolean zoomy,numlockhold; + +boolean filename_specified; + +string inihead,initail; /* For reading the .INI file. */ + + +void linebug(byte which) +{; + output << "AVALOT : "; + switch (which) { + case bug_twonames : output << "You may only specify ONE filename." << NL; break; + case bug_pandl : output << "/p and /l cannot be used together." << NL; break; + case bug_weirdswitch : output << "Unknown switch (\"" << bugline << + "\"). Type AVALOT /? for a list of switches." << NL; + break; + case bug_invalidini: output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; break; + case bug_notyesorno: output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; break; + } + exit(which); +} + +void syntax() +{; + assign(output,""); rewrite(output); + output << NL; + output << string("Lord Avalot d'Argent\n\n(c) ")+copyright+" Mark, Mike and Thomas Thurman." << NL; + output << string("~~~~~~~~~~~~~~~~~~~~~\n\n")+vernum << NL; + output << NL; + output << "Syntax:" << NL; + output << "\n/?\ndisplays this screen," << NL; + output << "\n/O\noverrides EGA check," << NL; + output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; + output << "\n/P\nlogs with Epson codes to , default PRN," << NL; + output << "\n/Q\ncancels sound effects," << NL; + output << "\n/S\ndisables Soundblaster," << NL; + output << "\n/Z\ngoes straight into the game." << NL; + output << NL; + output << "\n\n\n\n\n\n\n... Have fun!" << NL; + exit(177); +} + +void upstr(string& x) +{ + byte fv; +; + for( fv=1; fv <= length(x); fv ++) x[fv]=upcase(x[fv]); +} + +boolean yesno() +{boolean yesno_result; +; + if (initail=="YES") yesno_result=true; else + if (initail=="NO") yesno_result=false; else + linebug(bug_notyesorno); +return yesno_result; +} + +void ini_parse() +{; + upstr(inihead); + upstr(initail); + + if (inihead=="QUIET") soundfx=! yesno(); else + if (inihead=="ZOOMYSTART") zoomy=yesno(); else + if (inihead=="NUMLOCKHOLD") numlockhold=yesno(); else + if (inihead=="LOADFIRST") filetoload=initail; else + if (inihead=="OVERRIDEEGACHECK") cl_override=yesno(); else + if (inihead=="KEYBOARDCLICK") keyboardclick=yesno(); +} + +void strip_ini() +{ + byte fv; +; + if (inihead=="") return; + + /* Firstly, delete any comments. */ + fv=pos(";",inihead); + if (fv>0) Delete(inihead,fv,255); + + /* Lose the whitespace... */ + + while (inihead[length(inihead)]==' ') inihead[0] -= 1; + while ((inihead!="") && (inihead[1]==' ')) Delete(inihead,1,1); + + /* It's possible that now we'll end up with a blank line. */ + + if ((inihead=="") || (inihead[1]=='[')) return; + + fv=pos("=",inihead); + + if (fv==0) + {; /* No "="! Weird! */ + bugline=inihead; + linebug(bug_invalidini); + } + + initail=copy(inihead,fv+1,255); + inihead[0]=chr(fv-1); +} + +void load_ini() +{ + text ini; +; + assign(ini,"AVALOT.INI"); + reset(ini); + + while (! eof(ini)) + {; + ini >> inihead >> NL; + strip_ini(); + if (inihead!="") ini_parse(); + } + + close(ini); +} + +void parse(string x); +static string arg; + +static string getarg(string otherwis) +{string getarg_result; +; + if (arg=="") getarg_result=otherwis; else getarg_result=""; +return getarg_result; +} + +void parse(string x) + +{; + switch (x[1]) { + case '/':case '-': {; + arg=copy(x,3,255); + switch (upcase(x[2])) { + case '?': syntax(); break; + case 'O': cl_override=true; break; + case 'L': if (! usingp) + {; + log_setup(getarg("avvy.log"),false); + usingl=true; + } else {; close(logfile); linebug(bug_pandl); } + break; + case 'P': if (! usingl) + {; + log_setup(getarg("prn"),true); + usingp=true; + } else {; close(logfile); linebug(bug_pandl); } + break; + case 'Q': soundfx=false; break; + case 'Z': zoomy=true; break; + case 'K': keyboardclick=true; break; + case 'D': demo=true; break; + default: {; + bugline=x; + linebug(bug_weirdswitch); + } + } + } + break; + case '*': {; + inihead=copy(x,2,255); + strip_ini(); + if (inihead!="") ini_parse(); + } + break; + default: {; /* filename */ + if (filename_specified) + linebug(bug_twonames); + else + filetoload=x; + filename_specified=true; + } + } +} + +void not_through_bootstrap() +{ + output << "Avalot must be loaded through the bootstrap." << NL; + exit(0); +} + +void get_storage_addr() +{ + integer e; + + val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); + val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); + skellern=storage_ofs+1; +} + +class unit_incline_initialize { + public: unit_incline_initialize(); +}; +static unit_incline_initialize incline_constructor; + +unit_incline_initialize::unit_incline_initialize() {; + filetoload=""; + usingl=false; + usingp=false; + logging=false; + cl_override=false; + soundfx=true; + zoomy=false; + numlockhold=false; + filename_specified=false; + keyboardclick=false; + + load_ini(); + + if ((paramcount<3) || + ((paramstr(1)!="Go") && (paramstr(1)!="et"))) not_through_bootstrap(); + + reloaded=paramstr(1)=="et"; + + get_storage_addr(); + + for( fv=4; fv <= paramcount; fv ++) + parse(paramstr(fv)); +} diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h new file mode 100644 index 000000000000..a0db659f92b0 --- /dev/null +++ b/engines/avalanche/oldincln.h @@ -0,0 +1,10 @@ +#ifndef __oldincln_h__ +#define __oldincln_h__ + + + +/* This unit has NO externally-callable procedures. Also note that + it MUST be called *first* (so if you load AVALOT.PAS and press f7 + twice you get to the "begin" statement.) */ + +#endif diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp new file mode 100644 index 000000000000..5e0fb99c4cca --- /dev/null +++ b/engines/avalanche/oldtrip.cpp @@ -0,0 +1,448 @@ +#include "ptoc.h" + +/* + + + + + TRIP4 Trippancy IV- "Trip Oop". */ + +#define __trip4_implementation__ + /* Trippancy IV (Trip Oop) */ +#include "oldtrip.h" + + +/*#include "Scrolls.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Gyro.h"*/ +/*#include "Dropdown.h"*/ + + +void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4); + + +static boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ +{boolean dropin_result; +; + dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); +return dropin_result; +} + + + +static integer lesser(integer a,integer b) +{integer lesser_result; +; + if (ab) greater_result=a; else greater_result=b; +return greater_result; +} + +void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) + +{; + if (dropin(x3,y3,x1,y1,x2,y2) + || dropin(x3,y4,x1,y1,x2,y2) + || dropin(x4,y3,x1,y1,x2,y2) + || dropin(x4,y4,x1,y1,x2,y2)) + {; /* Overlaps */ + mblit(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4),1,0); + } else + {; /* Doesn't overlap- copy both of them seperately */ + mblit(x3,y3,x4,y4,1,0); /* backwards- why not...? */ + mblit(x1,y1,x2,y2,1,0); + } +} + +void loadtrip() +{ + byte gm; +; + for( gm=1; gm <= numtr; gm ++) tr[gm].original(); + tr[1].init(0); +} + +byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) +{ + byte a,c; integer fv,ff; +byte checkfeet_result; +; + a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; + if (oya) a=c; + } else + for( fv=x1; fv <= x2; fv ++) + for( ff=y+yl; ff <= oy+yl; ff ++) + {; + c=getpixel(fv,ff); + if (c>a) a=c; + } + checkfeet_result=a; setactivepage(1); +return checkfeet_result; +} + +void touchcol(byte tc); +static boolean bug; + +static void fr(byte a,byte b) {; fliproom(a,b); bug=false; } + +void touchcol(byte tc) +{; + bug=true; /* j.i.c. */ + switch (dna.room) { + case 1: fr(2,3); break; + case 2: {; /* main corridor */ + switch (tc) { + case 1: fr(3,1); break; /* to the other corridor */ + case 2: fr(2,1); break; /* to this corridor! Fix this later... */ + } + } + break; + case 3: {; /* turn corridor */ + switch (tc) { + case 1: fr(2,1); break; /* to the other corridor */ + case 2: fr(12,1); break; /* through Spludwick's door */ + } + } + break; + case 12: fr(3,2); break; + } + if (bug) + {; + setactivepage(0); + display(string('\7')+"Unknown touchcolour ("+strf(tc)+')'+" in "+strf(dna.room) + +'.'); setactivepage(1); tr[1].bounce(); + } +} + +triptype* triptype::init(byte spritenum) +{ + integer gd,gm; word s; untyped_file f; varying_string<2> xx; byte sort,n; + word bigsize; pointer p,q; +; + str(spritenum,xx); assign(f,string("c:\\avalot\\sprite")+xx+".avd"); + reset(f,1); seek(f,59); + blockread(f,a,sizeof(a)); blockread(f,bigsize,2); + setactivepage(3); + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); + blockread(f,p,bigsize); + off; putimage(0,0,p,0); release(q); n=1; + { adxtype& with = a; + for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= with.seq-1; gd ++) /* steps */ + {; + getmem(pic[n][sort],a.size); /* grab the memory */ + getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, + (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, + pic[n][sort]); /* grab the pic */ + n += 1; + }} on; + } + close(f); setactivepage(0); + + x=0; y=0; quick=true; visible=false; getmem(behind,a.size); + homing=false; ix=0; iy=0; step=0; check_me=a.name=="Avalot"; +return this; +} + +void triptype::original() +{; + quick=false; +} + +void triptype::getback() +{; + tax=x; tay=y; + off; /*getimage(x,y,x+a.xl,y+a.yl,behind^);*/ + mblit(x,y,x+a.xl,y+a.yl,1,3); on; +} + +void triptype::andexor() +{ + byte picnum; /* Picnum, Picnic, what ye heck */ +; + picnum=face*a.seq+step+1; off; + putimage(x,y,pic[picnum][0],andput); + putimage(x,y,pic[picnum][1],xorput); on; +} + +void triptype::turn(byte whichway) +{; + face=whichway; +} + +void triptype::appear(integer wx,integer wy, byte wf) +{; + x=(wx / 8)*8; y=wy; ox=wx; oy=wy; turn(wf); visible=true; ix=0; iy=0; +} + +void triptype::walk() +{ + byte tc; +; + ox=x; oy=y; + if ((ix==0) && (iy==0)) return; + if (homing) homestep(); + x=x+ix; y=y+iy; + if (check_me) {; + tc=checkfeet(x,x+a.xl,oy,y,a.yl); + { void& with = magics[tc]; + switch (op) { + case exclaim: blip; break; + case bounces: bounce(); break; + case transport: fliproom(hi(data),lo(data)); break; + }} + } +/* if x<0 then x:=0; else if x+a.xl>640 then x:=640-a.xl;*/ + if (y<0) y=0; /* else if y+a.yl>161 then y:=161-a.yl; */ + step += 1; if (step==a.seq) step=0; getback(); +} + +void triptype::bounce() +{; setactivepage(1); putback(); x=ox; y=oy; stopwalk(); return; } + +void triptype::do_it() +{; + if (((ix!=0) || (iy!=0)) & (~ ddm_o.menunow)) + {; + off; copier(ox,oy,ox+a.xl,oy+a.yl,x,y,x+a.xl,y+a.yl); + putback(); on; + } +} + +void triptype::putback() +{; +/* putimage(tax,tay,behind^,0);*/ mblit(tax,tay,tax+a.xl,tay+a.yl,3,1); +} + +void triptype::walkto(integer xx,integer yy) +{; + speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; +} + +void triptype::stophoming() +{; + homing=false; +} + +void triptype::homestep() +{ + integer temp; +; + if ((hx==x) && (hy==y)) + {; /* touching the target */ + homing=false; return; + } + ix=0; iy=0; + if (hy!=y) + {; + temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; + } + if (hx!=x) + {; + temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; + } +} + +void triptype::speed(shortint xx,shortint yy) +{; + ix=xx; iy=yy; + if ((ix==0) && (iy==0)) return; /* no movement */ + if (ix==0) + {; /* No horz movement */ + if (iy<0) turn(up); else turn(down); + } else + {; + if (ix<0) turn(left); else turn(right); + } +} + +void triptype::stopwalk() +{; + ix=0; iy=0; homing=false; +} + +void triptype::chatter() +{; + talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; +} + + +getsettype* getsettype::init() +{; + numleft=0; /* initialise array pointer */ + return this; +} + +void remember(fieldtype r) +{; + numleft += 1; + gs[numleft]=r; +} + +void recall() +{void recall_result; +; + recall_result=gs[numleft]; + numleft -= 1; +return recall_result; +} + +void rwsp(byte t,byte r) +{ + const integer xs = 4; const integer ys = 2; +; + { triptype& with = tr[t]; switch (r) { + case up: speed( 0,-ys); break; case down: speed( 0, ys); break; case left: speed(-xs, 0); break; + case right: speed( xs, 0); break; case ul: speed(-xs,-ys); break; case ur: speed( xs,-ys); break; + case dl: speed(-xs, ys); break; case dr: speed( xs, ys); break; + }} +} + +void apped(byte trn,byte np) +{; + { + triptype& with = tr[trn]; + ; { void& with1 = peds[np]; appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir);} + rwsp(trn,tr[trn].face); } +} + +void trippancy(); + +static boolean allstill() +{ + boolean xxx; byte fv; +boolean allstill_result; +; + xxx=true; + for( fv=1; fv <= numtr; fv ++) + { triptype& with = tr[fv]; + if (with.quick && ((with.ix!=0) || (with.iy!=0))) xxx=false;} + allstill_result=xxx; +return allstill_result; +} + +void trippancy() +{ + byte fv; +; + if ((ddm_o.menunow) | ontoolbar | seescroll | allstill()) return; + setactivepage(1); + for( fv=1; fv <= numtr; fv ++) + { triptype& with = tr[fv]; + if (with.quick) + {; + walk(); + if (with.visible && ((with.ix!=0) || (with.iy!=0))) andexor(); + do_it(); + }} + setactivepage(0); +} + +void tripkey(char dir); + +static void stopwalking() +{; + tr[1].stopwalk(); dna.rw=stopped; +} + +void tripkey(char dir) +{; + { triptype& with = tr[1]; + {; + switch (dir) { + case 'H': if (rw!=up) + {; rw=up; rwsp(1,rw); } else stopwalking(); + break; + case 'P': if (rw!=down) + {; rw=down; rwsp(1,rw); } else stopwalking(); + break; + case 'K': if (rw!=left) + {; rw=left; rwsp(1,rw); } else stopwalking(); + break; + case 'M': if (rw!=right) + {; rw=right; rwsp(1,rw); } else stopwalking(); + break; + case 'I': if (rw!=ur) + {; rw=ur; rwsp(1,rw); } else stopwalking(); + break; + case 'Q': if (rw!=dr) + {; rw=dr; rwsp(1,rw); } else stopwalking(); + break; + case 'O': if (rw!=dl) + {; rw=dl; rwsp(1,rw); } else stopwalking(); + break; + case 'G': if (rw!=ul) + {; rw=ul; rwsp(1,rw); } else stopwalking(); + break; + case 'L': stopwalking(); break; + } + }} +} + +void fliproom(byte room,byte ped) +{; + dusk; tr[1].putback(); dna.room=room; load(room); apped(1,ped); + oldrw=dna.rw; dna.rw=tr[1].face; showrw; dawn; +} + +boolean infield(byte x) /* returns True if you're within field "x" */ +{ + integer ux,uy; +boolean infield_result; +; + { + triptype& with = tr[1]; + ; + ux=with.x; + uy=with.y+with.a.yl; + } + { + void& with = fields[x]; + ; + infield_result=(ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2); + } +return infield_result; +} + +boolean neardoor() /* returns True if you're near a door! */ +{ + integer ux,uy; byte fv; boolean nd; +boolean neardoor_result; +; + if (numfields<9) + {; /* there ARE no doors here! */ + neardoor_result=false; + return neardoor_result; + } + { + triptype& with = tr[1]; + ; + ux=with.x; + uy=with.y+with.a.yl; + } nd=false; + for( fv=9; fv <= numfields; fv ++) + { + void& with = fields[fv]; + ; + if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; + } + neardoor_result=nd; +return neardoor_result; +} + diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h new file mode 100644 index 000000000000..dc36efd2d644 --- /dev/null +++ b/engines/avalanche/oldtrip.h @@ -0,0 +1,95 @@ +#ifndef __oldtrip_h__ +#define __oldtrip_h__ + + +#include "graph.h" +/*#include "Crt.h"*/ + + +const integer maxgetset = 10; + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +class triptype { +public: + adxtype a; /* vital statistics */ + byte face,step; + integer x,y; /* current xy coords */ + integer ox,oy; /* last xy coords */ + integer tax,tay; /* "behind" taken at... */ + shortint ix,iy; /* amount to move sprite by, each step */ + matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ + boolean quick,visible,homing,check_me; + pointer behind; /* what's behind you */ + integer hx,hy; /* homing x & y coords */ + + triptype* init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen 1 */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx,integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for do_it, andexor, etc. */ + void do_it(); /* Actually copies the picture over */ + void getback(); /* gets background before sprite is drawn */ + void putback(); /* ...and wipes sprite from screen 1 */ + void walkto(integer xx,integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ +}; + +class getsettype { +public: + array<1,maxgetset,fieldtype> gs; + byte numleft; + + getsettype* init(); + void remember(fieldtype r); + void recall(); +}; + +const integer up = 0; +const integer right = 1; +const integer down = 2; +const integer left = 3; +const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer stopped = 8; + +const integer numtr = 5; /* current max no. of sprites */ + +void trippancy(); + +void loadtrip(); + +void tripkey(char dir); + +void apped(byte trn,byte np); + +void fliproom(byte room,byte ped); + +boolean infield(byte x); /* returns True if you're within field "x" */ + +boolean neardoor(); /* returns True if you're near a door! */ + + +#ifdef __trip4_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,numtr,triptype> tr; +#undef EXTERN +#define EXTERN extern + + +#endif diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp new file mode 100644 index 000000000000..52b1a0373e82 --- /dev/null +++ b/engines/avalanche/omtest.cpp @@ -0,0 +1,177 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Oopmenu.h"*/ +/*#include "Rodent.h"*/ +/*#include "Crt.h"*/ +/*#include "Enhanced.h"*/ + +varying_string<5> st; +byte fv; + +void graphics() + { + integer gd,gm; ; gd=3; gm=0; initgraph(gd,gm,""); } + +/*$F+ ... All ddm__procs and do__procs must be compiled in Far-Call state. */ + +void ddm__file() +{; + {; + start_afresh; + opt("Load...",'L',"f3",true); + opt("Save...",'S',"f2",false); + opt("Save As...",'A',"ctrl-f2",false); + opt("OS Shell...",'O',"f2",true); + opt("Untrash screen",'U',"f11",true); + display; + } +} + +void ddm__heart() +{; + {; + start_afresh; + opt("About...",'A',"shift-f10",true); + opt("Boss Key",'B',"alt-B",true); + opt("Help...",'H',"f1",true); + opt("Status screen",'S',"f12",true); + opt("Quit",'Q',"f10",true); + display; + } +} + +void ddm__action() +{; + {; + start_afresh; + opt("Get up",'G',"",true); + opt("Open door",'O',"",true); + opt("Pause game",'P',"",true); + opt("Look around",'L',"",true); + opt("Inventory",'I',"Tab",true); + opt("Do the boogie",'b',"",true); + display; + } +} + +void ddm__objects() +{; + {; + start_afresh; + opt("Bell",'B',"",true); + opt("Wine",'W',"",true); + opt("Chastity Belt",'C',"",true); + opt("Crossbow Bolt",'t',"",true); + opt("Crossbow",'r',"",true); + opt("Potion",'P',"",true); + display; + } +} + +void ddm__people() +{; + {; + start_afresh; + opt("Avalot",'A',"",true); + opt("Spludwick",'S',"",true); + opt("Arkata",'k',"",true); + opt("Dogfood",'D',"",true); + opt("Geida",'G',"",true); + display; + } +} + +void ddm__use() +{; + {; + start_afresh; + opt("Drink",'D',"",true); + opt("Wear",'W',"",true); + opt("Give to [du Lustie]",'G',"",true); + display; + } +} + +void do__stuff() +{ + varying_string<2> st; +; + str(o.choicenum+1,st); + setfillstyle(1,6); setcolor(14); + bar(0,177,640,200); + outtextxy(320,177,string("You just chose: ")+st); +} + +void do__heart() +{; + switch (o.choicenum) { + case 0: outtextxy(100,100,"A really funny game!"); break; + case 1: outtextxy(100,120,"You ought to be working!"); break; + case 2: outtextxy(100,140,"No help available, so THERE!"); break; + case 3: outtextxy(100,160,"Everything's COOL and FROODY!"); break; + case 4: exit(0); break; + } +} + +/*$F- ... End of ddm__procs */ + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + graphics(); + setfillstyle(6,6); bar(0,0,639,199); + resetmouse; + m.init; o.init; + {; + create('H','\3','#',ddm__heart(),do__heart()); + create('F',"File",'!',ddm__file(),do__stuff()); + create('A',"Action",'\36',ddm__action(),do__stuff()); + create('O',"Objects",'\30',ddm__objects(),do__stuff()); + create('P',"People",'\31',ddm__people(),do__stuff()); + create('W',"With",'\21',ddm__use(),do__stuff()); + update; + } + do { + showmousecursor; + do { + getbuttonpressinfo(1); + getbuttonreleaseinfo(1); + getbuttonstatus; + if (menunow) o.lightup; + } while (!((buttonpresscount>0) || (buttonreleasecount>0) | keypressede)); + hidemousecursor; + if (buttonpresscount>0) + {; + if (mousey>10) + {; + if (! ((o.firstlix) & + ((mousex>=flx1) && (mousex<=flx2) && + (mousey>=12) && (mousey<=fly)))) + {; /* Clicked OUTSIDE the menu. */ + if (o.menunow) wipe; + setcolor(2); for( fv=1; fv <= 17; fv ++) circle(mousex,mousey,fv*3); + setcolor(0); for( fv=1; fv <= 17; fv ++) circle(mousex,mousey,fv*3); + } + } else + {; /* Clicked on menu bar */ + m.getmenu(mousex); + } + } else + {; /* NOT clicked button... */ + if (buttonreleasecount>0) + {; + if ((firstlix) & + ((mousex>=flx1) && (mousex<=flx2) && + (mousey>=12) && (mousey<=fly))) + select((mousey-14) / 10); + } else + {; /* NOT clicked or released button, so must be keypress */ + readkeye; + parsekey(inchar,extd); + } + } + } while (!false); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp new file mode 100644 index 000000000000..5c1b13f08b44 --- /dev/null +++ b/engines/avalanche/oopmenu.cpp @@ -0,0 +1,295 @@ +#include "ptoc.h" + +#define __oopmenu_implementation__ + + +#include "oopmenu.h" + + +/*#include "Crt.h"*/ +#include "graph.h" +/*#include "Rodent.h"*/ +/*#include "Dos.h"*/ + + +const integer indent = 40; +const integer spacing = 83; + +const integer menu_b = blue; +const integer menu_f = yellow; +const integer menu_border = black; +const integer highlight_b = lightblue; +const integer highlight_f = yellow; +const integer disabled = lightgray; + +/* menu_b = lightgray; + menu_f = black; + menu_border = black; + highlight_b = black; + highlight_f = white; + disabled = darkgray;*/ + +/* Built-in mouse routine */ + +char r; +byte fv; + +void chalk(integer x,integer y, char t, string z) +{ + byte p; +; + outtextxy(x,y,z); + p=pos(t,z); if (p==0) return; p -= 1; + outtextxy(x+p*8,y+1,"_"); +} + +void say(integer x,integer y, char t, string z, byte f,byte b) +{; + settextjustify(0,2); setfillstyle(1,b); setcolor(f); + bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)+1); + chalk(x,y,t,z); +} + +void mblit(integer x1,integer y1,integer x2,integer y2, byte f,byte t) /* NOT The Minstrel Blitter */ +{ + pointer p,q; word s; +; + mark(q); + s=imagesize(x1,y1,x2,y2); getmem(p,s); + setactivepage(f); getimage(x1,y1,x2,y2,p); + setactivepage(t); putimage(x1,y1,p,0); + setactivepage(0); release(q); +} + +void onemenu::start_afresh() +{; + number=0; width=0; firstlix=false; oldy=0; highlightnum=0; +} + +onemenu* onemenu::init() +{; + menunow=false; + return this; +} + +void onemenu::opt(string n, char tr, string key, boolean val) +{ + integer l; +; + number += 1; + l=textwidth(n+key)+30; if (width"") outtextxy(flx2,4+y*10,with.shortcut); + settextjustify(0,2); + chalk(left+3,4+y*10,with.trigger,with.title); + } +} + +void onemenu::display() +{ + byte y; +; + setfillstyle(1,menu_b); setcolor(menu_border); + firstlix=true; + flx1=left-2; flx2=left+width; fly=14+number*10; + mblit(flx1-3,11,flx2+1,fly+1,0,1); + menunow=true; + + bar(flx1,12,flx2,fly); + rectangle(flx1-1,11,flx2+1,fly+1); + + setcolor(menu_f); settextjustify(0,2); + displayopt(1,highlight_b,highlight_f,177); + for( y=2; y <= number; y ++) + { optiontype& with = oo[y]; displayopt(y,177,menu_f,disabled);} +} + +void onemenu::wipe() +{; + { headtype& with = m.ddms[o.menunum]; say(flx1+2,1,with.trigger,with.title,menu_f,menu_b);} + mblit(flx1-3,11,flx2+1,fly+1,1,0); + menunow=false; firstlix=false; +} + +void onemenu::movehighlight(shortint add) +{ + shortint hn; +; + if (add!=0) + {; + hn=highlightnum+add; + if ((hn<0) || (hn>=(unsigned char)number)) return; + highlightnum=hn; + } + hidemousecursor; + displayopt(oldy+1,menu_b,menu_f,disabled); + displayopt(highlightnum+1,highlight_b,highlight_f,disabled); + showmousecursor; + oldy=highlightnum; +} + +void onemenu::lightup() /* This makes the menu highlight follow the mouse.*/ +{; + if ((mousexflx2) + || (mousey<=12) || (mousey>fly-3)) return; + highlightnum=(mousey-12) / 10; + if (highlightnum==oldy) return; + movehighlight(0); +} + +void onemenu::select(byte n) /* Choose which one you want. */ +{; + if (! oo[n+1].valid) return; + choicenum=n; + m.ddms[menunum].do_choose(); + wipe(); +} + +void onemenu::keystroke(char c) +{ + byte fv; +; + c=upcase(c); + for( fv=1; fv <= number; fv ++) + if (upcase(oo[fv].trigger)==c) select(fv-1); +} + +void bleep() +{; + sound(177); delay(7); nosound; +} + + headtype* headtype::init + (char trig,char alttrig, string name, byte p, proc dw,proc dc) + {; + trigger=trig; alttrigger=alttrig; title=name; + position=p; xpos=(position-1)*spacing+indent; + xright=xpos+textwidth(name)+3; + do_setup=dw; do_choose=dc; + return this; + } + + void headtype::display() + {; + say(xpos,1,trigger,title,menu_f,menu_b); + } + + void headtype::highlight() + {; + say(xpos,1,trigger,title,highlight_f,highlight_b); + {; + o.left=xpos; + o.menunow=true; o.menunum=position; + } + } + + boolean headtype::extdparse(char c) + {boolean extdparse_result; + ; + if (c!=alttrigger) {; extdparse_result=true; return extdparse_result; } + extdparse_result=false; + return extdparse_result; + } + + menuset* menuset::init() + {; + howmany=0; + return this; + } + + void menuset::create(char t, string n, char alttrig, proc dw,proc dc) + {; + howmany += 1; + ddms[howmany].init(t,alttrig,n,howmany,dw,dc); + } + + void menuset::update() + { + byte fv; + ; + setfillstyle(1,menu_b); bar(0,0,640,10); + for( fv=1; fv <= howmany; fv ++) ddms[fv].display(); + } + + void menuset::extd(char c) + { + byte fv; + ; + fv=1; + while ((fv<=howmany) && (ddms[fv].extdparse(c))) fv += 1; + if (fv>howmany) return; getmenu(fv*spacing-indent); + } + + void menuset::getmenu(integer x) + { + byte fv; + ; + fv=0; + do { + fv += 1; + if ((x>ddms[fv].xpos-3) && (xhowmany)); + } + +void parsekey(char r,char re) +{; + switch (r) { + case '\0': {; + switch (re) { + case 'K': {; + wipe(); + m.getmenu((o.menunum-2)*spacing+indent); + } + break; + case 'M': {; + wipe(); + m.getmenu((o.menunum*spacing+indent)); + } + break; + case 'H': movehighlight(-1); break; + case 'P': movehighlight(1); break; + default: m.extd(re); + } + } + break; + case '\33': if (o.menunow) wipe(); break; + case '\15': select(o.highlightnum); break; + default: + {; + if (o.menunow) keystroke(r); else + kbuffer=kbuffer+r+re; + } + } +} + diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h new file mode 100644 index 000000000000..ee928e2050ab --- /dev/null +++ b/engines/avalanche/oopmenu.h @@ -0,0 +1,82 @@ +#ifndef __oopmenu_h__ +#define __oopmenu_h__ + + +typedef void(*proc)(); + +class headtype { +public: + varying_string<8> title; + char trigger,alttrigger; + byte position; + integer xpos,xright; + proc do_setup,do_choose; + + headtype* init + (char trig,char alttrig, string name, byte p, proc dw,proc dc); + void display(); + void highlight(); + boolean extdparse(char c); +}; + +struct optiontype { + string title; + char trigger; + varying_string<9> shortcut; + boolean valid; +}; + +class onemenu { +public: + array<1,12,optiontype> oo; + byte number; + integer width,left; + boolean firstlix; + integer flx1,flx2,fly; + byte oldy; /* used by Lightup */ + boolean menunow; /* Is there a menu now? */ + byte menunum; /* And if so, which is it? */ + byte choicenum; /* Your choice? */ + byte highlightnum; + + void start_afresh(); + void opt(string n, char tr, string key, boolean val); + void display(); + void wipe(); + void lightup(); + void displayopt(byte y,byte b,byte f,byte d); + void movehighlight(shortint add); + void select(byte n); + void keystroke(char c); + onemenu* init(); +}; + +class menuset { +public: + array<1,8,headtype> ddms; + byte howmany; + + menuset* init(); + void create(char t, string n, char alttrig, proc dw,proc dc); + void update(); + void extd(char c); + void getmenu(integer x); +}; + + + +#ifdef __oopmenu_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN onemenu o; +EXTERN menuset m; +EXTERN string kbuffer; +#undef EXTERN +#define EXTERN extern + + + void parsekey(char r,char re); + +#endif diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp new file mode 100644 index 000000000000..973bafb79f84 --- /dev/null +++ b/engines/avalanche/overlap.cpp @@ -0,0 +1,53 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +integer gd,gm; + +void flash(integer x1,integer y1,integer x2,integer y2) +{; + setcolor(14); rectangle(x1,y1,x2,y2); + sound(x1+x2); delay(100); nosound; delay(500); + setcolor( 9); rectangle(x1,y1,x2,y2); delay(500); +} + +boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ +{boolean dropin_result; +; + dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); +return dropin_result; +} + +void test(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) +{; + cleardevice(); + rectangle(x1,y1,x2,y2); + rectangle(x3,y3,x4,y4); + flash(x1,y1,x2,y2); + flash(x3,y3,x4,y4); + + if (dropin(x3,y3,x1,y1,x2,y2) + || dropin(x3,y4,x1,y1,x2,y2) + || dropin(x4,y3,x1,y1,x2,y2) + || dropin(x4,y4,x1,y1,x2,y2)) + {; /* Overlaps */ + flash(x1,y1,x4,y4); + } else + {; /* Doesn't overlap- flash 'em both again */ + flash(x3,y3,x4,y4); /* backwards- why not...? */ + flash(x1,y1,x2,y2); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=1; initgraph(gd,gm,""); setcolor(9); + test(100,50,200,100,400,200,600,250); + test(100,50,200,100,120, 70,220,120); + test(100,50,200,100,150, 50,250,100); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp new file mode 100644 index 000000000000..6e0b9fca7a1a --- /dev/null +++ b/engines/avalanche/overscro.cpp @@ -0,0 +1,53 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + setactivepage(1); setcolor(9); + settextstyle(0,0,2); + outtextxy(0, 0,"This is a test to see whether you can"); + outtextxy(0, 20,"scroll text over the top of a picture."); + outtextxy(0, 40,"I was wondering whether it would work."); + outtextxy(0, 60,"Well, does it, or not?"); + outtextxy(0, 80,"If so, it could be useful for the"); + outtextxy(0,100,"Avalot title sequence."); + outtextxy(0,120,"Good, isn't it?"); + outtextxy(0,140,"The quick brown fox jumps over the"); + outtextxy(0,160,"lazy dog..."); + outtextxy(0,180,"This is the last line..."); + setactivepage(0); + gm=0; + for( gd=0; gd <= 640; gd ++) + {; + gm += 1; if (gm==8) gm=1; setcolor(gm); + line(gd,0,gm,350); + line(640-gd,0,640-gm,350); + } +/* for gd:=1 to 15 do + begin; + setfillstyle(1,gd); bar(gd*20,10,gd*20+19,100); + end;*/ +/* setfillstyle(1,6); bar(100,100,500,100);*/ gd=getpixel(0,0); + for( gm=8; gm <= 15; gm ++) setpalette(gm,egayellow); + for( gd=0; gd <= 199; gd ++) + {; + port[0x3c4]=2; port[0x3cf]=4; port[0x3c5]=8; port[0x3cf]=0; + move(mem[0xa000*80],mem[0xa000*0],16000); + port[0x3c4]=2; port[0x3cf]=4; port[0x3c5]=8; port[0x3cf]=0; + move(mem[0xa000*gd*80+16384],mem[0xa000*15920],80); + } +/* for gd:=0 to 199 do + begin; + port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; + move(mem[$A000*160],mem[$A000*0],15920); + port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; + move(mem[$A000*gd*80+16384],mem[$A000*15920],80); + move(mem[$A000*15920],mem[$A000*15840],80); + end;*/ +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp new file mode 100644 index 000000000000..e4c5b3ed9154 --- /dev/null +++ b/engines/avalanche/particle.cpp @@ -0,0 +1,233 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +/*$R+*/ + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +struct markertype { + word length; + longint offset; + byte checksum; +}; + +string rawname; +array<0,1999,char> buffer,was; +word bufpos,bufsize; +fonttype font; +integer cpos; +char r; +boolean ok; + +const char marker = '\33'; + +void cursor() +{ + byte fv; +; + for( fv=12; fv <= 15; fv ++) + mem[0xa000*cpos+fv*80]=~(mem[0xa000*cpos+fv*80]); +} + +void xy() +{; + cpos=(bufpos / 80)*1280+(bufpos % 80); +} + +void show() +{ + word fv,orig,y; +; + for( fv=0; fv <= 1999; fv ++) + if (buffer[fv]!=was[fv]) + {; + orig=(fv / 80)*1280+(fv % 80); + for( y=0; y <= 15; y ++) + mem[0xa000*orig+y*80]=(byte)(font[buffer[fv]][y]); + } + xy(); + move(buffer,was,sizeof(buffer)); +} + +void sizeup() +{; + do { + switch (buffer[bufsize]) { + case marker: return; break; /* we've found it OK! */ + case '\0': bufsize -= 1; break; + default: bufsize += 1; + } + } while (!false); +} + +void graphics() +{ + integer gd,gm; + file fontfile; +; + gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); + assign(fontfile,"c:\\thomas\\lanche.fnt"); + reset(fontfile); fontfile >> font; close(fontfile); +} + +void helpscreen(); + +static byte l,fv; + +static void addon(char b, string st) +{; + buffer[3+80*l]=b; b -= 64; + buffer[5+80*l]=b; + move(st[1],buffer[7+80*l],length(st)); + l += 1; +} + +void helpscreen() +{ + array<0,1999,char> temp; + char r; +; + l=0; move(buffer,temp,2000); fillchar(buffer,sizeof(buffer),'\0'); + addon('B',"Bubble"); + addon('C',"Centre text"); + addon('D',"Don't add \20 (at end)"); + addon('F',"Italic Font"); + addon('G',"Bell"); + addon('H',"Not allocated (=backspace)"); + addon('I',"Not allocated (=tab)"); + addon('L',"Left-justify text"); + addon('K',"Keyboard input"); + addon('M',"Carriage return (same as \r key)"); + addon('P',"Scroll (Paragraph break)"); + addon('Q',"Yes/no scroll (question)"); + addon('R',"Roman font"); + addon('S',"Fix to sprite"); + addon('U',"Money (in sd format)"); + addon('V',"View icon (number from ^S)"); + show(); do { r=readkey(); } while (!(! keypressed())); + cleardevice(); + fillchar(was,sizeof(was),'\0'); move(temp,buffer,2000); show(); +} + +void edit_it(); + +static void legit(char r) +{; /* it's a legit keystroke */ + move(buffer[bufpos],buffer[bufpos+1],1999-bufpos); + buffer[bufpos]=r; + bufpos += 1; show(); +} + +void edit_it() +{ + byte fv; +; + bufpos=0; + fillchar(was,sizeof(was),'\0'); show(); + do { + cursor(); r=readkey(); cursor(); + switch (r) { + case '\0': switch (readkey()) { /* extd keystrokes */ + case 'K': if (bufpos>0) {; bufpos -= 1; xy(); } break; /* Left */ + case 'M': if (bufpos80) {; bufpos -= 80; xy(); } break; /* Up */ + case 'P': if (bufpos<(cardinal)bufsize-79) {; bufpos += 80; xy(); } break; /* Down */ + case 's': if (bufpos>10) {; bufpos -= 10; xy(); } break; + case 't': if (bufpos<(cardinal)bufsize-10) {; bufpos += 10; xy(); } break; + case 'G': {; bufpos=0; xy(); } break; /* Home */ + case 'O': {; bufpos=bufsize; xy(); } break; /* End */ + case 'S': if (bufpos0) {; /* backspace */ + bufpos -= 1; + move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); + show(); + } + break; + case '\33': {; + restorecrtmode(); + return; + } + break; /* end of editing */ + default: legit(r); + } + sizeup(); + } while (!false); +} + +void loadit() +{ + untyped_file f; +; + if (pos(".",rawname)==0) rawname=rawname+".raw"; + fillchar(buffer,sizeof(buffer),'\0'); + /*$I-*/ + assign(f,rawname); + reset(f,1); + if (ioresult!=0) + {; + output << string('\7')+"New file!"+'\7' << NL; + buffer[0]=marker; + return; + } + bufsize=filesize(f); + blockread(f,buffer,bufsize); + close(f); + while (buffer[bufsize]=='\0') bufsize -= 1; + if (buffer[bufsize]!=marker) + {; /* add on a marker */ + bufsize += 1; + buffer[bufsize]=marker; + } +} + +void saveit() +{ + untyped_file f; +; + output << "Saving " << rawname << ", " << bufsize << " bytes..." << NL; + assign(f,rawname); rewrite(f,1); + blockwrite(f,buffer,bufsize); + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + output << "Filename of .RAW file?"; input >> rawname >> NL; + loadit(); + ok=false; + do { + graphics(); + edit_it(); + output << "Now what?" << NL; + output << NL; + output << " Filename: " << rawname << NL; + output << " Size of text: " << bufsize << NL; + output << " Cursor position: " << bufpos << NL; + output << NL; + output << " C) Cancel this & continue edit" << NL; + output << " S) Save under current name" << NL; + output << " A) Save under a different name" << NL; + output << " X) Exit & lose all changes." << NL; + output << NL; + output << "Pick one!" << NL; + do { r=upcase(readkey()); } while (!(set::of('C','S','A','X', eos).has(r))); + switch (r) { + case 'X': ok=true; break; + case 'S': {; saveit(); exit(0); } break; + } + } while (!ok); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp new file mode 100644 index 000000000000..144d9568532a --- /dev/null +++ b/engines/avalanche/pictemp.cpp @@ -0,0 +1,65 @@ +#include "ptoc.h" + + +#include "graph.h" + + +const integer picsize = 966; + +integer gd,gm; +untyped_file f; +pointer p; + +void save() +{ + varying_string<40> adf; untyped_file f; byte z; array<1,2,pointer> c; +string nam,screenname; + const string header = + string("This is a file from an Avvy game, and its contents are subject to ")+ + "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; + byte a /*absolute $A000:1200i*/; + byte bit; +; + nam="d:thingtmp.avd"; + screenname="Temp."; + assign(f,nam); + + assign(f,nam); rewrite(f,1); blockwrite(f,header[1],146); + blockwrite(f,screenname,31); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,a,12080); + } + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + assign(f,"thinks.avd"); + getmem(p,picsize); + reset(f,1); + seek(f,65); + gd=10; gm=20; + + while (gm<120) + {; + if (! eof(f)) + blockread(f,p,picsize); + putimage(gd,gm,p,0); + gd += 70; + + if (gd==640) + {; + gd=10; gm += 40; + } + + } + + close(f); freemem(p,picsize); + save(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp new file mode 100644 index 000000000000..54e9e0dafaf0 --- /dev/null +++ b/engines/avalanche/pictemp2.cpp @@ -0,0 +1,64 @@ +#include "ptoc.h" + + /* Get 'em back! */ +#include "graph.h" + + +const integer picsize = 966; +const integer number_of_objects = 17; + +const array<1,65,char> thinks_header = + string("This is an Avalot file, which is subject to copyright. Have fun.")+'\32'; + +integer gd,gm; +untyped_file f; +pointer p; +byte noo; + +void load() +{ + byte a0 /*absolute $A000:1200*/; + byte bit; + untyped_file f; +; + assign(f,"d:thingtmp.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); bit=getpixel(0,0); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + load(); noo=0; + + assign(f,"thinks.avd"); + getmem(p,picsize); + rewrite(f,1); + blockwrite(f,thinks_header,65); + gd=10; gm=20; + + while (noo<=number_of_objects) + {; + getimage(gd,gm,gd+59,gm+29,p); + putimage(gd,gm,p,notput); + blockwrite(f,p,picsize); + gd += 70; + + if (gd==640) + {; + gd=10; gm += 40; + } + + noo += 1; + } + + close(f); freemem(p,picsize); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp new file mode 100644 index 000000000000..1bb3066bffb3 --- /dev/null +++ b/engines/avalanche/pingo.cpp @@ -0,0 +1,229 @@ +#include "ptoc.h" + +/* + + + + + PINGO Full-screen sub-parts of the game. */ + +#define __pingo_implementation__ + + +#include "pingo.h" + + +#include "graph.h" +#include "gyro.h" +#include "lucerna.h" +/*#include "Crt.h"*/ +#include "trip5.h" +#include "scrolls.h" + + +void dplot(integer x,integer y, string z) +{; + setcolor( 9); outtextxy(x,y ,z); + setcolor(11); outtextxy(x,y-1,z); +} + +void bosskey() +/*const + months : array[0..11] of char = 'JFMAMJJASOND'; + title = 'Net Profits'; + fish = #224; { } +var fv:byte; gd,gm:integer; r:char; +begin; + dusk; delavvy; + setactivepage(3); mousepage(3); setvisualpage(3); off; + cleardevice; setfillstyle(xhatchfill,11); + settextstyle(1,0,4); settextjustify(1,1); + dplot(320,10,title); + settextstyle(1,0,0); setusercharsize(4,3,7,12); + for fv:=0 to 11 do + begin; + dplot(26+fv*52,187,months[fv]); + bar(fv*52,177-fv*14,51+fv*52,180); + rectangle(fv*52,177-fv*14,51+fv*52,180); + end; + settextstyle(0,0,1); + for fv:=1 to 177 do + begin; + gd:=random(630); gm:=random(160)+30; + setcolor(lightred); outtextxy(gd ,gm ,fish); + setcolor(yellow); outtextxy(gd+1,gm-1,fish); + end; + newpointer(6); { TTHand } + dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; + while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); + dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; + copy02;*/ +{ + byte fv; +; + dusk(); + off_virtual(); + for( fv=0; fv <= 1; fv ++) + {; + setactivepage(fv); + cleardevice(); + } + load(98); off(); + setactivepage(1); setvisualpage(1); + settextjustify(1,0); setcolor(8); + outtextxy(320,177,"Graph/Histo/Draw/Sample: \"JANJUN93.GRA\": (W3-AB3)"); + outtextxy(320,190,"Press any key or click the mouse to return."); + settextjustify(2,0); + on(); mousepage(1); newpointer(1); dawn(); + do { check(); } while (!((mpress>0) || keypressed())); + off(); on_virtual(); + major_redraw(); + + mousepage(cp); +} + +void copy02() /* taken from Wobble (below) */ +{ + byte a0 /*absolute $A000:0*/; byte a2/*absolute $A800:0*/; byte bit; +; + off(); + for( bit=0; bit <= 3; bit ++) {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; + port[0x3cf]=bit; + move(a0,a2,16000); + } on(); +} + +void copy03() /* taken from Wobble (below) */ +{ + byte a0 /*absolute $A000:0*/; byte a2/*absolute $AC00:0*/; byte bit; + byte squeaky_code; + + switch (visible) { + case m_virtual : { squeaky_code = 1; off_virtual(); } break; + case m_no : squeaky_code = 2; break; + case m_yes : { squeaky_code = 3; off(); } break; + } + + for( bit=0; bit <= 3; bit ++) {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; + port[0x3cf]=bit; + move(a0,a2,16000); + } + + switch (squeaky_code) { + case 1 : on_virtual(); break; + case 2 :; break; /* zzzz, it was off anyway */ + case 3 : on(); break; + } + +} + +void copypage(byte frp,byte top) /* taken from Copy02 (above) */ +{ + byte bit; +; + off(); + for( bit=0; bit <= 3; bit ++) {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; + port[0x3cf]=bit; + move(mem[0xa000*frp*pagetop],mem[0xa000*top*pagetop],16000); + } on(); +} + +void wobble() +{ + byte bit; + byte a2 /*absolute $A800:80i*/; +; + off(); + setactivepage(2); bit=getpixel(0,0); + cleardevice(); + for( bit=0; bit <= 3; bit ++) {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; + port[0x3cf]=bit; + move(mem[0xa000*cp*pagetop],a2,16000); + } + for( bit=0; bit <= 25; bit ++) + {; + setvisualpage(2); delay(bit*7); + setvisualpage(cp); delay(bit*7); + } + bit=getpixel(0,0); + draw_also_lines(); + setactivepage(1-cp); on(); +} + +void zonk(); + +static void zl(integer x1,integer y1,integer x2,integer y2) +{; + setlinestyle(0,0,3); setcolor( 1); line(x1,y1,x2,y2); + setlinestyle(0,0,1); setcolor(11); line(x1,y1,x2,y2); +} + +void zonk() +{ + integer xx,yy; +/* a0:byte absolute $A000:0; a3:byte absolute $A000:245760;*/ byte bit,fv; +; + off(); + copypage(3,1-cp); + { + triptype& with = tr[1]; + ; xx=with.x+with.a.xl / 2; yy=with.y; } + + setactivepage(3); cleardevice(); +/* for bit:=0 to 3 do begin; + port[$3C4]:=2; port[$3CE]:=4; + port[$3C5]:=1 shl bit; + port[$3CF]:=bit; + move(a0,a3,16000); + end;*/ + copypage(cp,3); off(); + zl(640,0,0,yy / 4); + zl(0,yy / 4,640,yy / 2); + zl(640,yy / 2,xx,yy); setbkcolor(yellow); + + for( bit=0; bit <= 255; bit ++) + {; + note(270-bit); setvisualpage(3); + note(2700-10*bit); delay(5); nosound; + note(270-bit); setvisualpage(cp); + note(2700-10*bit); delay(5); nosound; + } setactivepage(0); setbkcolor(black); on(); state(2); + copypage(1-cp,3); +} + +void winning_pic() +{ + byte bit; + untyped_file f; + char r; + + dusk(); + + assign(f,"finale.avd"); + reset(f,1); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[0xa000*0],16000); + } + close(f); blitfix(); + + setvisualpage(0); + + dawn(); + + do { check(); } while (!(keypressed() || (mrelease>0))); + while (keypressed()) r=readkey(); + major_redraw(); +} + + diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h new file mode 100644 index 000000000000..fdb49b7048c9 --- /dev/null +++ b/engines/avalanche/pingo.h @@ -0,0 +1,19 @@ +#ifndef __pingo_h__ +#define __pingo_h__ + + +void bosskey(); + +void copy02(); + +void copy03(); + +void copypage(byte frp,byte top); + +void wobble(); + +void zonk(); + +void winning_pic(); + +#endif diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp new file mode 100644 index 000000000000..80f7937ca50c --- /dev/null +++ b/engines/avalanche/plottest.cpp @@ -0,0 +1,42 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; byte fv; +matrix<1,35,0,39,byte> a; +array<0,3,0,4,1,35,byte> b; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + for( gd=0; gd <= 39; gd ++) + for( gm=1; gm <= 35; gm ++) + a[gm][gd]=(gd+gm) % 16; + for( gd=0; gd <= 39; gd ++) + for( gm=1; gm <= 35; gm ++) + putpixel(gd+100,gm+100,a[gm][gd]); + + fillchar(b,sizeof(b),'\0'); + for( gm=1; gm <= 35; gm ++) + for( gd=0; gd <= 39; gd ++) + {; + for( fv=0; fv <= 3; fv ++) + {; + b[fv][gd / 8][gm]=(b[fv][gd / 8][gm] << 1); + b[fv][gd / 8][gm] += ((cardinal)(a[gm][gd] & (1 << fv)) >> fv); + } + } + + for( gd=1; gd <= 35; gd ++) + for( gm=0; gm <= 4; gm ++) + {; + for( fv=0; fv <= 3; fv ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << fv; port[0x3cf]=fv; + mem[0xa000*gd*80+gm]=b[fv][gm][gd]; + } + } +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp new file mode 100644 index 000000000000..aff9f1b5e567 --- /dev/null +++ b/engines/avalanche/preview1.cpp @@ -0,0 +1,122 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +array<0,3,palettetype> fxpal; + +void load() +{ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f,"preview2.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + + close(f); + bit=getpixel(0,0); + + settextjustify(1,1); + setcolor(3); + outtextxy(320,166,"...This is a preview of things to come..."); + setcolor(14); + outtextxy(320,176,"AVAROID"); + outtextxy(320,183,"(a space so dizzy)"); + setcolor(9); + outtextxy(320,194,"the next Avvy adventure-- in 256 colours."); + setcolor(7); + outtextxy(590,195,"Any key..."); +} + +void setup() +{ + integer gd,gm; + palettetype p; + + if (paramstr(1)!="jsb") exit(255); + gd=3; gm=0; initgraph(gd,gm,""); + getpalette(fxpal[0]); + + fillchar(p.colors,sizeof(p.colors),'\0'); /* Blank out the screen. */ + p.size=16; setallpalette(p); +} + +void wait() +{ + word w; char r; + + w=0; + do { + delay(1); w += 1; + } while (!(keypressed() || (w==15000))); + + while (keypressed()) r=readkey(); /* Keyboard sink. */ +} + +void show(byte n) +{ + setallpalette(fxpal[n]); + delay(55); +} + +shortint fades(shortint x) +{ + byte r,g,b; + + shortint fades_result; + r=x / 16; x=x % 16; + g=x / 4; b=x % 4; + if (r>0) r -= 1; if (g>0) g -= 1; if (b>0) b -= 1; + fades_result=(16*r+4*g+b); +/* fades:=x-1;*/ + return fades_result; +} + +void dawn(); + +static void calc(byte n) +{ + byte fv; + + fxpal[n]=fxpal[n-1]; + + for( fv=1; fv <= fxpal[n].size-1; fv ++) + fxpal[n].colors[fv]=fades(fxpal[n].colors[fv]); +} + +void dawn() +{ + byte fv; + + for( fv=1; fv <= 3; fv ++) calc(fv); + + for( fv=3; fv >= 0; fv --) show(fv); +} + +void dusk() +{ + byte fv; + + for( fv=1; fv <= 3; fv ++) show(fv); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + setup(); + load(); + dawn(); + wait(); + dusk(); + closegraph(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp new file mode 100644 index 000000000000..3843d808727e --- /dev/null +++ b/engines/avalanche/qintro.cpp @@ -0,0 +1,277 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +#include "graph.h" +/*#include "Crt.h"*/ + + /* This is a stand-alone program. */ + +/* 0, black, remains 0. + Other numbers: the bits take precedence from the left. + e.g. for 9 = 1001, => fourth bit. + + First 1 is in: + + Fourth bit: 63 (egaWhite) + Third bit: 57 (egaLightBlue) + Second bit: 7 (light grey) + First bit: 1 (blue). */ + +const palettetype our_palette = + {16, + /* sic */ +{{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}}}; + +typedef matrix<'\0','\377',1,16,byte> fonttype; + +fonttype f; +matrix<0,39,1,16,byte> next_line; + +byte next_bitline; + +byte displaycounter; + +boolean cut_out; + +word cut_out_time; + +array<1,117,varying_string<40> > x; + +byte this_line; + +word* skellern; + +/*$L intro.obj*/ +extern void introduction(); + +void graphmode(integer mode) +{ + registers regs; + + regs.ax=mode; + intr(0x10,regs); +} + +/* Firstly, port[$3C4]:=2; port[$3CF]:=4;, + Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ + +void loadfont() +{ + file ff; + + assign(ff,"avalot.fnt"); + reset(ff); + ff >> f; + close(ff); +} + +void calc_next_line() + /* This proc sets up next_line. */ +{ + string l; + byte fv,ff; + boolean oddlen; + byte start; + byte this_; + + fillchar(next_line,sizeof(next_line),'\0'); /* All blanks. */ + + if (this_line==117) + { + cut_out=true; + return; + } + + l=x[this_line]; + this_line += 1; + + start=(20-length(l) / 2)-1; + oddlen=odd(length(l)); + + for( fv=1; fv <= length(l); fv ++) + for( ff=1; ff <= 16; ff ++) + { + this_=f[l[fv]][ff]; + if (oddlen) + { /* Odd, => 4 bits shift to the right. */ + next_line[start+fv][ff] += this_ << 4; + next_line[start+fv-1][ff] += (cardinal)this_ >> 4; + } else + { /* Even, => no bit shift. */ + next_line[start+fv][ff]=this_; + } + } + next_bitline=1; +} + +void display() +{ + byte fv,ff; + + + if (next_bitline == 17) calc_next_line(); + + if (cut_out) + { + cut_out_time -= 1; + return; + } + + move(mem[0xa000*40],mem[0xa000*0],7960); + for( fv=0; fv <= 39; fv ++) + mem[0xa1f1*8+fv]=next_line[fv][next_bitline]; + next_bitline += 1; + +} + +void plot_a_star(integer x,integer y) +{ + byte ofs; + + ofs=x % 8; + x=x / 8; + mem[0xa000*x+y*40] += (cardinal)128 >> ofs; +} + +void plot_some_stars(integer y) +{ + byte fv,times; + + switch (Random(7)) { + case 1: times=1; break; + case 2: times=2; break; + case 3: times=3; break; + default: return; + } + + for( fv=1; fv <= times; fv ++) + plot_a_star(Random(320),y); +} + +void starry_starry_night() +{ + integer y; + byte bit; + + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + + for( bit=0; bit <= 2; bit ++) + { + port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( y=1; y <= 200; y ++) + plot_some_stars(y); + } +} + +void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the + Graph unit. */ +{ + integer gd,gm; + + gd=3; gm=1; initgraph(gd,gm,""); +} + +void shovestars() +{ + move(mem[0xa000*0],mem[0xa000*40],7960); + fillchar(mem[0xa000*0],40,'\0'); + plot_some_stars(0); +} + +void do_next_line() +{ + byte bit; + + port[0x3c4]=2; port[0x3ce]=4; + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c5]=1 << bit; port[0x3cf]=bit; + + switch (bit) { + case 0: if ((displaycounter % 10)==0) shovestars(); break; + case 1: if ((displaycounter % 2)==0) shovestars(); break; + case 2: shovestars(); break; + case 3: display(); break; /* The text. */ + } + } + + if (displaycounter==40) displaycounter=0; + +} + +void load_text() +{ + word fv; + char* c; + byte thisline; + + + c=addr(introduction()); + thisline=0; + fillchar(x,sizeof(x),'\0'); + + for( fv=1; fv <= 2456; fv ++) + { + switch (*c) { + case '\15': thisline += 1; break; + case '\12':/*nop*/; break; + default: x[thisline]=x[thisline]+*c; + } + + c += 1; + } +} + +void check_params() +{ + word s,o; integer e; + + if (paramstr(1)!="jsb") exit(0); + val(paramstr(2),s,e); if (e!=0) exit(0); + val(paramstr(3),o,e); if (e!=0) exit(0); + skellern=ptr(s,o+1); +} + +int main(int argc, const char* argv[]) +{ + + pio_initialize(argc, argv); + check_params(); + + setupgraphics(); + + randseed=177; checkbreak=false; + + load_text(); + + this_line=1; + + graphmode(0xd); + loadfont(); + + next_bitline=17; + displaycounter=0; + + cut_out_time=333; + + setallpalette(our_palette); + + starry_starry_night(); + + while ((cut_out_time>0) && (! keypressed())) + { + + *skellern=0; + + do_next_line(); + + displaycounter += 1; + + do {; } while (!(*skellern>0)); + } + + graphmode(3); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp new file mode 100644 index 000000000000..3a31a9e67a24 --- /dev/null +++ b/engines/avalanche/qstars.cpp @@ -0,0 +1,237 @@ +#include "ptoc.h" + + /* Demonstration of the Bigo II system. */ +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Rodent.h"*/ +/*#include "Tommys.h"*/ + +integer gd,gm; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +boolean reverse; +word spinnum; +array<0,1,fonttype> f; +file ff; +array<0,7,0,15,0,79,byte> strip; +byte across; +word w; byte y; +byte charnum; +byte cfont; /* current font. 0=roman, 1=italic. */ + +char* c; + +const integer colours = 12; /* Run Workout to see possible values of these two. */ +const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ +const integer gmtop = 360 / steps; + +/*$L credits.obj*/ extern void credits(); + +void bigo2(string date) +{ + integer gd,gm; + byte c; + palettetype p; + untyped_file f; pointer pp; word s; + + + getpalette(p); + setvisualpage(1); setactivepage(0); + assign(f,"logo.avd"); reset(f,1); + for( gd=7; gd <= 194; gd ++) + blockread(f,mem[0xa000*(gd*80)],53); + close(f); + s=imagesize(0,7,415,194); getmem(pp,s); getimage(0,7,415,194,pp); + + cleardevice(); + for( gd=1; gd <= 64; gd ++) + { + for( gm=0; gm <= gmtop; gm ++) + { + c=(c % colours)+1; +/* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, + trunc(cos(gm*steps*n)*gd*3)+175,c); */ + if (c>5) continue_; + setcolor(c); arc(320,175,gm*steps,gm*steps+1,gd*6); + } + if (keypressed()) { closegraph(); exit(0); } + } + settextstyle(0,0,1); setcolor(13); + outtextxy(550,343,"(press any key)"); + + putimage(112,0,pp,orput); freemem(pp,s); + resetmouse; setvisualpage(0); +} + +void nextchar() /* Sets up charnum & cline for the next character. */ +{ + + c += 1; +} + +void getchar() +{ + do { + nextchar(); + + switch (*c) { + case '@': { cfont=1; nextchar(); } break; + case '^': { cfont=0; nextchar(); } break; + case '%': { closegraph(); exit(0); } break; + } + + } while (!((*c!='\15') && (*c!='\12'))); + + for( w=0; w <= 7; w ++) + for( y=0; y <= 15; y ++) + move(strip[w][y][1],strip[w][y][0],79); + + for( w=0; w <= 7; w ++) + for( y=0; y <= 15; y ++) + strip[w][y][79]=(byte)((strip[7][y][78] << (w+1)))+ + ((cardinal)f[cfont][*c][y] >> (7-w)); + + across=0; +} + +void scrolltext() +{ + byte c,w,y; + + across += 1; + if (across==8) getchar(); + + for( y=0; y <= 15; y ++) + for( w=0; w <= 1; w ++) + move(strip[across][y][0],mem[0xa000*24000+(y*2+w)*80],80); +} + +void do_stuff() +{ + switch (spinnum) { + case 50 ... 110: { + setfillstyle(1,14); + bar(0,315+(spinnum-50) / 3,640,315+(spinnum-50) / 3); + bar(0,316-(spinnum-50) / 3,640,316-(spinnum-50) / 3); + if (spinnum>56) + { + setfillstyle(1,13); + bar(0,315+(spinnum-56) / 3,640,315+(spinnum-56) / 3); + bar(0,316-(spinnum-56) / 3,640,316-(spinnum-56) / 3); + } + } + break; + case 150 ... 198: { + setfillstyle(1,0); + bar(0,315+(spinnum-150) / 3,640,315+(spinnum-150) / 3); + bar(0,316-(spinnum-150) / 3,640,316-(spinnum-150) / 3); + } + break; + case 200: scrolltext(); break; + } +} + +void setcol(byte which,byte what) +/*var dummy:byte;*/ +{; +/* setpalette(which,what); + asm +(* mov dx,$3DA; + in ax,dx; + + or ah,ah; + + mov dx,$3C0; + mov al,which; + out dx,al; + + mov dx,$3C0; + mov al,what; + out dx,al; + end; +(* dummy:=port[$3DA]; + port[$3C0]:=which; port[$3C0]:=what;*/ +} + +void bigo2go() +{ + palettetype p; byte c; boolean lmo; + boolean altnow,altbefore; + + for( gd=0; gd <= 13; gd ++) p.colors[gd]=0; + + setcol(13,24); /* murk */ setcol(14,38); /* gold */ + setcol(15,egawhite); /* white- of course */ + p.colors[13]=24; p.colors[14]=38; p.colors[15]=egawhite; + + /***/ + + p.colors[5]=egawhite; + p.colors[4]=egalightcyan; + p.colors[3]=egacyan; + p.colors[2]=egalightblue; + p.colors[1]=egablue; + + /***/ + + c=1; p.size=16; lmo=false; + setallpalette(p); + + do { +/* if reverse then + begin + dec(c); if c=0 then c:=colours; + end else + begin + inc(c); if c>colours then c:=1; + end; + for gm:=1 to colours do + case p.colors[gm] of + egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; + egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; + egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; + egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; + egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; + end; + p.colors[c]:=egaWhite; setcol(c,egaWhite); + + AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ + + if (anymousekeypressed) lmo=true; + if (keypressed()) lmo=true; + + /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ + + do_stuff(); + if (spinnum<200) spinnum += 1; + } while (!lmo); +} + +void parse_cline() +{ + integer e; + + if (paramstr(1)!="jsb") + { + output << "Not a standalone program." << NL; exit(255); + } +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + parse_cline(); + + gd=3; gm=1; initgraph(gd,gm,""); + assign(ff,"avalot.fnt"); reset(ff); ff >> f[0]; close(ff); + assign(ff,"avitalic.fnt"); reset(ff); ff >> f[1]; close(ff); + + c=addr(credits()); c -= 1; + + fillchar(strip,sizeof(strip),'\0'); + reverse=false; spinnum=0; across=7; charnum=1; cfont=0; + bigo2("1189"); /* 1189? 79? 2345? 1967? */ + bigo2go(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp new file mode 100644 index 000000000000..a911e1d9180d --- /dev/null +++ b/engines/avalanche/rawupd.cpp @@ -0,0 +1,71 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ + +searchrec s; +string x,y; +longint hash_time,s_time; +boolean s_exists; + +void find_out_about_s(string name) +{ + searchrec ss; +; + findfirst(name,anyfile,ss); + s_exists=doserror==0; + + if (s_exists) + s_time=ss.time; +} + +void get_y() +{ + y=x; + if (set::of(range('0','9'), eos).has(x[2])) + y[1]='h'; else + if (x[3]=='K') + y[1]='a'; else + y[1]='s'; +} + +void rename_it() +{ + untyped_file f; + + output << x << " -> " << y; + assign(f,x); reset(f); rename(f,y); close(f); + output << " ...done." << NL; +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + output << NL; + findfirst("#*.*",anyfile,s); + while (doserror==0) + { + x=s.name; + get_y(); + hash_time=s.time; + output << format(x,15); clreol; + find_out_about_s(y); + if (s_exists) + { + output << ": s exists and is "; + if (s_time initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ +}; + +untyped_file f; +longint number; +markertype marker; +sezheader sezhead; +array<0,1999,char> x; +word fv; +byte sum; + +byte sumup() +{ + word fv; byte total; +byte sumup_result; +; + total=0; + for( fv=0; fv <= marker.length; fv ++) + {; + total += ord(x[fv]); + } + sumup_result=total; +return sumup_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + output << "READ-SEZ by TT." << NL; output << NL; + assign(f,"avalot.sez"); reset(f,1); + seek(f,255); blockread(f,sezhead,sizeof(sezhead)); + {; + if (sezhead.initials!="TT") + {; + output << "Not a valid Sez file!" << NL; + exit(0); + } + output << "Number of chains in file = " << sezhead.chains << NL; + output << "Total size of all chains = " << sezhead.size << " bytes." << NL; + } + output << NL; + output << "Number of scrollchain to display?"; input >> number >> NL; + seek(f,longint(262)+number*longint(7)); blockread(f,marker,7); + {; + output << "Scrollchain no. " << number << NL; + output << "Length: " << marker.length << NL; + output << "Offset: " << marker.offset << NL; + output << NL; + output << "Contents:" << NL; + seek(f,longint(270)+sezhead.chains*longint(7)+marker.offset); + blockread(f,x,marker.length+1); + for( fv=0; fv <= marker.length; fv ++) x[fv] -= 3+177*fv*marker.length; /* unscramble */ + for( fv=0; fv <= marker.length; fv ++) output << x[fv]; + output << NL; sum=sumup(); + output << "Checksum in file: " << marker.checksum << ". Actual value: " << sum << '.' << NL; + output << NL; + if (sum!=marker.checksum) + {; + output << "Bleargh! Checksum failed!" << NL; + exit(0); + } + } + close(f); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp new file mode 100644 index 000000000000..c85dee39a971 --- /dev/null +++ b/engines/avalanche/reginam.cpp @@ -0,0 +1,91 @@ +#include "ptoc.h" + + +const array<1,36,char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; +varying_string<30> name; +varying_string<5> number; + +void alphanum(); + +static string z; + +static byte p; + + +static void replace(char what,char whatwith) +{; + p=pos(what,z); if (p>0) z[p]=whatwith; +} + +void alphanum() +{ + byte fv; + +; + z=""; + for( fv=1; fv <= length(name); fv ++) + if (set::of(range('A','Z'), eos).has(name[fv])) + z=z+'7'+name[fv]; else + z=z+upcase(name[fv]); + replace(' ','1'); + replace('.','2'); + replace('-','3'); + replace('\'','4'); + replace('"','5'); + replace('!','6'); + replace(',','9'); + replace('?','0'); + + for( fv=1; fv <= length(number); fv ++) + number[fv]=upcase(number[fv]); + + name=z+'8'+number; +} + +void scramble() +{ + byte fv,what; +; + for( fv=1; fv <= length(name); fv ++) + {; + what=pos(name[fv],letters); + what += 177; + what += (fv+1)*3; + name[fv]=letters[(what % 36)+1-1]; + } +} + +void checks() +{ + byte fv,total; +; + total=177; + for( fv=1; fv <= length(name); fv ++) + total += ord(name[fv]); + name=string('T')+name+letters[total % 36-1]; +} + +void negate() +{ + byte fv; +; + name[1]='N'; + for( fv=2; fv <= length(name); fv ++) + name[fv]=letters[37-pos(name[fv],letters)-1]; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + output << "Registrant's name?"; input >> name >> NL; + output << "And number (eg, A1)?"; input >> number >> NL; + alphanum(); + output << "Name = " << name << NL; + scramble(); + output << "Scrambled = " << name << NL; + checks(); + output << "With checks = " << name << NL; + negate(); + output << "Or, negated, = " << name << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp new file mode 100644 index 000000000000..800738821c52 --- /dev/null +++ b/engines/avalanche/sackb1.cpp @@ -0,0 +1,52 @@ +#include "ptoc.h" + +/* + + + + + SACKBLASTER-1 The temporary mod player. */ + +/* This is SackBlaster version 1.0, using Mark J. Cox's MODOBJ routines. + When Cameron finishes his mod player I'll use his routines, DV. However, + this will do for the time being. */ + +#define __sackb1_implementation__ + + +#include "sackb1.h" + + +/*$L v:MOD-obj.OBJ*/ /* Link in Object file */ +/*$F+*/ /* force calls to be 'far'*/ + +extern void modvolume(integer v1,integer v2,integer v3,integer v4); /*Can do while playing*/ +extern void moddevice(integer& device); +extern void modsetup(integer& status,integer device,integer mixspeed,integer pro,integer loop,string& stri); +extern void modstop(); +extern void modinit(); +/*$F-*/ + +void sb_start(string md) +{ + integer dev,mix,stat,pro,loop; + + modinit(); + dev=7; /* Sound Blaster */ + mix = 10000; /*use 10000 normally */ + pro = 0; /*Leave at 0*/ + loop =4; /*4 means mod will play forever*/ + modvolume (255,255,255,255); /* Full volume */ + modsetup ( stat, dev, mix, pro, loop, md ); +} + +void sb_stop() +{; + modstop(); +} + +void sb_link() /* At the moment, this does nothing. */ +{; +} + + diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h new file mode 100644 index 000000000000..b671da2a760e --- /dev/null +++ b/engines/avalanche/sackb1.h @@ -0,0 +1,14 @@ +#ifndef __sackb1_h__ +#define __sackb1_h__ + + +/*#include "Crt.h"*/ + + +void sb_start(string md); + +void sb_stop(); + +void sb_link(); /* At the moment, this does nothing. */ + +#endif diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp new file mode 100644 index 000000000000..b48379d364d4 --- /dev/null +++ b/engines/avalanche/sackb3.cpp @@ -0,0 +1,23 @@ +#include "ptoc.h" + +/*$M 16384,0,0*/ + + /* to demonstrate the SBVoice Unit */ + /* Copyright 1991 Amit K. Mathur, Windsor, Ontario */ + +/*#include "SBVoice.h"*/ + + +int main(int argc, const char* argv[]) +{ +pio_initialize(argc, argv); +if (paramcount>0) { + loadvoice(paramstr(1),0,0); + sb_output(seg(soundfile),ofs(soundfile)+26); + do { + output << "Demo of the SBVoice Unit, Copyright 1991 by Amit K. Mathur --- "; + } while (!(statusword==0)); +} else + output << "Usage: DEMO [d:\\path\\]filename.voc" << NL; +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp new file mode 100644 index 000000000000..6f35a21ada4d --- /dev/null +++ b/engines/avalanche/saving.cpp @@ -0,0 +1,48 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; +byte a /*absolute $A000:(15*80)*/; +byte bit; +untyped_file f; + +void load(string nam) +{ + byte z; + array<1,4,pointer> a; + untyped_file f; word s; + string check; +; + assign(f,nam); + reset(f,1); + blockread(f,check,41); + blockread(f,check,13); + blockread(f,check,31); + s=imagesize(0,0,getmaxx(),75); + for( z=1; z <= 2; z ++) + {; + getmem(a[z],s); + blockread(f,a[z],s); + setactivepage(0); + putimage(0,15+(z-1)*75,a[z],0); + freemem(a[z],s); + } + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + load("d:britain.avd"); + assign(f,"c:\\sleep\\test.ega"); rewrite(f,1); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,a,12000); + } + close(f); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp new file mode 100644 index 000000000000..5118cd8558e9 --- /dev/null +++ b/engines/avalanche/scr_1.cpp @@ -0,0 +1,89 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const varying_string<4> codes = " "; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +byte x,xx,y; +string title,fn; +file f; +fonttype font; +byte code; + + +typedef array<1,3840,byte> atype; + +void save() +{ + file f; + word fv; + atype a /*absolute $B800:0*/; +; + assign(f,"TEXT1.SCR"); + rewrite(f); f << a; close(f); +} + +void centre(byte y, string z) +{; + gotoxy(40-length(z) / 2,y); output << z; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; +/* write('Title?'); readln(title); + write('Font?'); readln(fn); */ + textattr=0; clrscr; + title="Bug Alert!"; fn=""; + for( xx=1; xx <= 77; xx ++) + {; + gotoxy(Random(80)+1,Random(24)+1); + switch (Random(2)) { + case 0: textattr=red; break; + case 1: textattr=lightred; break; + } + switch (Random(4)) { + case 0: output << '*'; break; + case 1: output << '\17'; break; + case 2: output << ''; break; + case 3: output << ''; break; + } + } + textattr=12; + assign(f,"c:\\thomas\\ttsmall.fnt"); + reset(f); f >> font; close(f); + for( y=0; y <= 3; y ++) + {; + for( x=1; x <= length(title); x ++) + {; + for( xx=7; xx >= 0; xx --) + {; + code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ + (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; + gotoxy(1+x*8-xx,y+1); + if (code>0) output << codes[code+1-1]; + } + } + /*if wherex<>1 then writeln;*/ + } + textattr=red; + centre(7,"An internal error has just occurred within the program."); + + textattr=white; gotoxy(26, 9); output << "Error number: "; + textattr=lightred; output << " "; + textattr=white; gotoxy(27,10); output << "at location: "; + textattr=lightred; output << " "; + centre(12,"This screen should never come up..."); + centre(13,"but it just has!"); + textattr=15; + centre(15,"So, please tell Thorsoft about this as soon as"); + centre(16,"possible, so that we can fix it."); + textattr=red; + centre(20,"Thanks..."); + save(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp new file mode 100644 index 000000000000..7a88efce95e5 --- /dev/null +++ b/engines/avalanche/scr_2.cpp @@ -0,0 +1,113 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const varying_string<4> codes = " "; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +byte x,xx,y; +string qq; +file f; +fonttype font; +byte code; + + +typedef array<1,3840,byte> atype; + +void save() +{ + file f; + word fv; + atype a /*absolute $B800:0*/; +; + assign(f,"TEXT2.SCR"); + rewrite(f); f << a; close(f); +} + +void centre(byte y, string z) +{ + byte fv; +; + for( fv=1; fv <= length(z); fv ++) + {; + gotoxy(39-length(z) / 2+fv,y); + if (odd(fv+y)) textattr=2; else textattr=cyan; + if (z[fv]!='\40') output << z[fv]; + } +} + +void line(byte yy, string title) +{ + const integer offset = 5; +; + for( y=1; y <= 6; y ++) + {; + qq=""; + for( x=1; x <= length(title); x ++) + {; + for( xx=7; xx >= 0; xx --) + {; + code=(byte)(((1 << xx) & font[title[x]][y*2-offset])>0)+ + (byte)(((1 << xx) & font[title[x]][y*2+1-offset])>0)*2; + qq=qq+codes[code+1-1]; + } + } + centre(y+yy,qq); + } +} + +void chips() +{ + byte fv,x,y; +; + for( fv=0; fv <= 1; fv ++) + {; + textattr=120; + for( y=2; y <= 6; y ++) + {; + gotoxy(fv*67+3,y); output << " "; if (fv==1) output << ' '; + } + gotoxy(fv*67+4,4); + if (fv==0) output << "RAM"; else output << "CRAM"; + textattr=7; + for( x=0; x <= 1; x ++) + for( y=2; y <= 6; y ++) + {; gotoxy(fv*67+2+x*(6+fv),y); output << ''; } + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=0; clrscr; + chips(); + assign(f,"c:\\thomas\\ttsmall.fnt"); + reset(f); f >> font; close(f); + line(0,"Out of"); + line(4,"memory!"); + centre(11,"Yes, RAM cram strikes again- Avvy has just run out of RAM (not the"); + centre(12,"hydraulic, woolly or village kinds.) Fortunately, there are a few things"); + centre(13,"you can do about this:"); + textattr=3; + for( xx=15; xx <= 17; xx ++) + {; + gotoxy(23,xx); output << '\20'; + } + textattr=2; + gotoxy(25,15); output << "Don't run Avvy in a DOS shell."; + gotoxy(25,16); output << "If that fails, try un-installing your TSRs."; + gotoxy(25,17); output << "If you've got DOS 50 or above, try using"; + gotoxy(28,18); textattr=3; output << "dos=high"; + textattr=2; output << ','; + textattr=3; output << " loadhigh"; + textattr=2; output << " and"; + textattr=3; output << " devicehigh"; + textattr=2; output << '.'; + gotoxy(28,19); output << "See your DOS manual for details..."; + centre(23,"Sorry for any inconvenience..."); + save(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp new file mode 100644 index 000000000000..0c866fc7daa2 --- /dev/null +++ b/engines/avalanche/scr_3.cpp @@ -0,0 +1,93 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const varying_string<4> codes = " "; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +byte x,xx,y; +string qq; +file f; +fonttype font; +byte code; + + +typedef array<1,3840,byte> atype; + +void save() +{ + file f; + word fv; + atype a /*absolute $B800:0*/; +; + assign(f,"TEXT3.SCR"); + rewrite(f); f << a; close(f); +} + +void centre(byte y, string z) +{ + byte fv; +; + for( fv=1; fv <= length(z); fv ++) + {; + gotoxy(39-length(z) / 2+fv,y); + if (z[fv]!='\40') output << z[fv]; + } +} + +void line(byte cx,byte cy, string title) +{; + for( y=0; y <= 4; y ++) + {; + qq=""; + for( x=1; x <= length(title); x ++) + {; + for( xx=7; xx >= 0; xx --) + {; + code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ + (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; + qq=qq+codes[code+1-1]; + } + } + gotoxy(cx,cy+y); output << qq; + } +} + +void big_t() +{ + text t; + string x; + byte y; +; + assign(t,"c:\\avalot\\t.txt"); reset(t); y=1; + while (! eof(t)) + {; + t >> x >> NL; + gotoxy(1,y); output << x; y += 1; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=4; clrscr; + assign(f,"c:\\thomas\\ttsmall.fnt"); + reset(f); f >> font; close(f); + textattr=4; line(19,4,"hanks"); + textattr=6; line(23,8,"for"); + line(7,12,"playing"); textattr += 8; + line(12,16,"Avalot."); + textattr=12; big_t(); + textattr=8; gotoxy(40,2); output << "(c) 1994, Mike, Mark and Thomas Thurman."; + textattr=11; gotoxy(50,10); output << "* Goodbyte! *"; + textattr=10; gotoxy(9,20); output << '\20'; + textattr=12; output << " If you'd like to see yet more of these games, then don't forget to"; + gotoxy(12,21); output << "register, or your"; clreol; + gotoxy(12,22); output << "for the rest of your life!"; + gotoxy(60,22); output << "(Only joking!)"; + save(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp new file mode 100644 index 000000000000..605a1dc51b1c --- /dev/null +++ b/engines/avalanche/scr_4.cpp @@ -0,0 +1,89 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const varying_string<4> codes = " "; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +byte x,xx,y; +string qq; +file f; +fonttype font; +byte code; + +void centre(byte y, string z) +{ + byte fv; +; + for( fv=1; fv <= length(z); fv ++) + {; + gotoxy(39-length(z) / 2+fv,y); + if (z[fv]!='\40') output << z[fv]; + } +} + +void line(byte cy, string title) +{; + for( y=0; y <= 6; y ++) + {; + qq=""; + for( x=1; x <= length(title); x ++) + {; + for( xx=3; xx >= 0; xx --) + {; + code=(byte)(((1 << (xx*2)) & font[title[x]][y])>0)+ + (byte)(((1 << (xx*2+1)) & font[title[x]][y])>0)*2; + qq=qq+codes[code+1-1]; + } + } + centre(cy+y,qq); + } +} + +void big_t() +{ + text t; + string x; + byte y; +; + assign(t,"c:\\avalot\\t.txt"); reset(t); y=1; + while (! eof(t)) + {; + t >> x >> NL; + gotoxy(1,y); output << x; y += 1; + } +} + +void box(byte x1,byte y1,byte x2,byte y2, string z) +{ + byte fv; +; + gotoxy(x1,y1); output << z[1]; /* tl */ + gotoxy(x2,y1); output << z[2]; /* tr */ + gotoxy(x1,y2); output << z[3]; /* bl */ + gotoxy(x2,y2); output << z[4]; /* br */ + for( fv=y1+1; fv <= y2-1; fv ++) + {; + gotoxy(x1,fv); output << z[5]; /* verticals */ + gotoxy(x2,fv); output << z[6]; + } + gotoxy(x1+1,y1); for( fv=x1+1; fv <= x2-1; fv ++) output << z[7]; + gotoxy(x1+1,y2); for( fv=x1+1; fv <= x2-1; fv ++) output << z[8]; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=26; clrscr; + assign(f,"c:\\thomas\\ttsmall.fnt"); + reset(f); f >> font; close(f); + line(3,"CONGRATULATIONS!"); + textattr=30; box(4,1,74,11,"ɻȼ"); + textattr=33; box(6,2,72,10,"/\\\\/"); + textattr=30; centre(12,"Well done!"); + textattr=27; centre(14,"You completed the game!"); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp new file mode 100644 index 000000000000..e90e55e45535 --- /dev/null +++ b/engines/avalanche/scr_5.cpp @@ -0,0 +1,93 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +const varying_string<4> codes = " "; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +byte x,xx,y; +string qq; +file f; +fonttype font; +byte code; + + +typedef array<1,3840,byte> atype; + +void save() +{ + file f; + word fv; + atype a /*absolute $B800:0*/; +; + assign(f,"TEXT5.SCR"); + rewrite(f); f << a; close(f); +} + +void line(byte cx,byte cy, string title) +{; + for( y=0; y <= 4; y ++) + {; + qq=""; + for( x=1; x <= length(title); x ++) + {; + for( xx=7; xx >= 0; xx --) + {; + code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ + (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; + qq=qq+codes[code+1-1]; + } + } + gotoxy(cx,cy+y); output << qq; + } +} + +void uline() +{ + byte fv,ff; +; + for( fv=1; fv <= 10; fv ++) + {; + gotoxy(16-fv,21-fv); textattr=fv; + for( ff=1; ff <= fv; ff ++) output << "-"; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + textattr=0; clrscr; + assign(f,"c:\\thomas\\ttsmall.fnt"); + reset(f); f >> font; close(f); + textattr=11; + line( 1, 3,"Two at"); + line( 3, 7,"once?!"); + textattr=9; gotoxy(55,4); output << string('\4')+'\377'; + textattr=3; output << "You're trying to run"; + gotoxy(54,5); output << "two copies of Avalot"; + gotoxy(54,6); output << "at once."; + gotoxy(57,8); output << "Although this "; textattr=9; output << "is"; + textattr=3; + gotoxy(54,9); output << "usually possible, it's"; + gotoxy(54,10); output << "probably more sensible"; + gotoxy(54,11); output << "to type "; + textattr=7; output << "EXIT "; + textattr=3; output << "now, which"; + gotoxy(54,12); output << "should return you to the"; + gotoxy(54,13); output << "first copy in memory."; + + textattr=11; gotoxy(55,15); output << "BUT:"; textattr=9; + gotoxy(40,16); output << "If you want to run two copies anyway,"; + gotoxy(40,17); output << "or you think that I've got it wrong,"; + gotoxy(40,18); output << "(even computers can make mistakes!) then"; + gotoxy(40,19); output << "try running the game again, but this time"; + gotoxy(40,20); output << "use "; textattr=7; output << "/i "; + textattr=9; output << "on the command line."; + uline(); + + save(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp new file mode 100644 index 000000000000..e1363470fde2 --- /dev/null +++ b/engines/avalanche/scr_9.cpp @@ -0,0 +1,21 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + +text t; +string x; +byte fv; +untyped_file f; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(f,"v:paralogo.scr"); + clrscr; + reset(f,1); + blockread(f,mem[0xb800*0],4000); + close(f); + gotoxy(1,1); insline; + gotoxy(1,23); clreol; +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp new file mode 100644 index 000000000000..4a2a0d9fc051 --- /dev/null +++ b/engines/avalanche/scrolls.cpp @@ -0,0 +1,781 @@ +#include "ptoc.h" + +/* + + + + + SCROLLS The scroll driver. */ +/* $D-*/ +#define __scrolls_implementation__ + +/*$V-*/ + +#include "scrolls.h" + +#include "lucerna.h" + #include "Graph.h" + /*#include "Crt.h"*/ +#include "trip5.h" +#include "enhanced.h" + /*#include "Dos.h"*/ +#include "logger.h" + #include "Acci.h" +#include "basher.h" +#include "visa.h" +#include "timeout.h" + + +const integer roman = 0; +const integer italic = 1; + +const integer halficonwidth = 19; /* Half the width of an icon. */ + +integer dix,diy; +array ch; +byte cfont; /* Current font */ + +integer dodgex,dodgey; +byte param; /* For using arguments code */ + +byte use_icon; + +void state(byte x) /* Sets "Ready" light to whatever */ +{ + byte page_; + + if (ledstatus==x) return; /* Already like that! */ + switch (x) { + case 0: setfillstyle(1,black); break; /* Off */ + case 1: setfillstyle(9,green); break; /* Half-on (menus) */ + case 2: setfillstyle(1,green); break; /* On (kbd) */ + case 3: setfillstyle(6,green); break; /* Hit a key */ + } + super_off(); + for( page_=0; page_ <= 1; page_ ++) + { setactivepage(page_); bar(419,195,438,197); } super_on(); + ledstatus=x; +} + +void easteregg() +{ + word fv,ff; + + background(15); + for( fv=4; fv <= 100; fv ++) + for( ff=0; ff <= 70; ff ++) + { sound(fv*100+ff*10); delay(1); } + nosound; setcolor(10); + settextstyle(0,0,3); settextjustify(1,1); outtextxy(320,100,"GIED"); + settextstyle(0,0,1); settextjustify(0,2); + background(0); +} + +void say(integer x,integer y, string z) /* Fancy FAST screenwriting */ +{ + const integer locol = 2; + byte xx,yy,ox,bit,lz,t; integer yp; boolean offset; + matrix<1,12,1,80,byte> itw; + + offset=x % 8==4; x=x / 8; lz=length(z); ox=0; + log_scrollline(); + + for( xx=1; xx <= lz; xx ++) + { + switch (z[xx]) { + case '\22': { cfont=roman; log_roman(); } break; + case '\6': { cfont=italic; log_italic(); } break; + default: { + ox += 1; + for( yy=1; yy <= 12; yy ++) itw[yy][ox]=~ ch[cfont][z[xx]][yy+1]; + log_scrollchar(z[xx]); + } + } + } + + lz=ox; + if (offset) + { /* offsetting routine */ + lz += 1; + for( yy=1; yy <= 12; yy ++) + { + bit=240; itw[yy][lz]=255; + for( xx=1; xx <= lz; xx ++) + { + t=itw[yy][xx]; + itw[yy][xx]=bit+t / 16; + bit=t << 4; + } + } + } + yp=x+y*80+(1-cp)*pagetop; + for( yy=1; yy <= 12; yy ++) + { + yp += 80; + for( bit=0; bit <= locol; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + move(itw[yy],mem[0xa000*yp],lz); + } + } +} + +/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ + +void normscroll() +{ + const array<1,8,char> egg = string("\20\f\25\7\b")+"***"; + const array<1,8,char> e = "(c) 1994"; + char r; + boolean oktoexit; + + state(3); seescroll=true; + off_virtual(); + on(); newpointer(4); + mousepage(1-cp); + + if (demo) get_demorec(); + + do { + do { + check(); /* was "checkclick;" */ + + #ifdef RECORD slowdown(); basher::count += 1; #endif + + if (demo) + { + if (demo_ready()) flush(); + if (keypressede()) exit(0); + } else + if (keypressede()) flush(); + } while (!((mrelease>0) || (buttona1()) || (buttonb1()))); + + + if (mrelease==0) + { + inkey(); + if (aboutscroll) + { + move(e[2-1],e[1-1],7); + e[8-1]=inchar; + if (egg==e) easteregg(); + } + oktoexit=set::of('\15','\33','+','#', eos).has(inchar); + if (! oktoexit) errorled(); + } + + } while (!((oktoexit) || (mrelease>0))); + #ifdef RECORD record_one(); #endif + screturn=r=='#'; /* "back door" */ + state(0); seescroll=false; mousepage(cp); off(); +} + +void dialogue() +{ + char r; + + state(3); seescroll=true; r='\0'; + newpointer(6); on(); + mousepage(1-cp); + do { + do { + check(); + if (mrelease>0) + { + if ((mx>=(cardinal)dix-65) && (my>=(cardinal)diy-24) && (mx<=(cardinal)dix- 5) && (my<=(cardinal)diy-10)) + r='Y'; + if ((mx>=(cardinal)dix+ 5) && (my>=(cardinal)diy-24) && (mx<=(cardinal)dix+65) && (my<=(cardinal)diy-10)) + r='N'; + } else + if (keypressede()) + { + inkey(); + r=upcase(inchar); + } + } while (!(r!='\0')); + } while (!(set::of('Y','N','O','J', eos).has(r))); /* Yes, Ja, Oui, or No, Non, Nein */ + screturn=r!='N'; + state(0); seescroll=false; mousepage(cp); off(); +} + +void music_scroll(); + + +static void store_(byte what, tunetype& played) +{ + move(played[2],played[1],sizeof(played)-1); + played[31]=what; +} + + + +static boolean they_match(tunetype& played) +{ + byte fv,mistakes; + + boolean they_match_result; + mistakes=0; + + for( fv=1; fv <= sizeof(played); fv ++) + if (played[fv]!=tune[fv]) + { + mistakes += 1; + } + + they_match_result=mistakes<5; + return they_match_result; +} + +void music_scroll() +{ + char r; + byte value; + + byte last_one,this_one; + + tunetype played; + + + state(3); seescroll=true; on(); + newpointer(4); + do { + do { + check(); /* was "checkclick;" */ + if (keypressede()) flush(); + } while (!((mpress>0) || (buttona1()) || (buttonb1()))); + + if (mpress==0) + { + inkey(); + r=upcase(inchar); if (r=='Z') r='Y'; /* Euro keyboards */ + + value=pos(r,keys); + + if (value>0) + { + + last_one=this_one; + this_one=value; + + sound(notes[this_one]); + delay(100); + nosound; + + if (! dna.ringing_bells) + { /* These handle playing the right tune. */ + + if (this_one0))); + screturn=false; + off(); + state(0); seescroll=false; +} + +/* ThatsAll, so put us back to */ /*$F-*/ + +void resetscrolldriver() /* phew */ +{ + scrollbells=0; cfont=roman; log_epsonroman(); use_icon=0; + interrogation=0; /* always reset after a scroll comes up. */ +} + +void dingdongbell() /* Pussy's in the well. Who put her in? Little... */ +{ + byte fv; + + for( fv=1; fv <= scrollbells; fv ++) errorled(); /* ring the bell "x" times */ +} + +void dodgem() /* This moves the mouse pointer off the scroll so that + you can read it. */ +{ + xycheck(); /* Mx & my now contain xy pos of mouse */ + dodgex=mx; dodgey=my; /* Store 'em */ + hopto(dodgex,underscroll); /* Move the pointer off the scroll. */ +} + +void undodgem() /* This is the opposite of Dodgem. It moves the + mouse pointer back, IF you haven't moved it in the meantime. */ +{ + xycheck(); + if ((mx==(cardinal)dodgex) && (my==(cardinal)underscroll)) + /* No change, so restore the pointer's original position. */ + hopto(dodgex,dodgey); +} + +void geticon(integer x,integer y, byte which) +{ + untyped_file f; + pointer p; + + assign(f,"icons.avd"); + reset(f,1); + which -= 1; + seek(f,which*426); + getmem(p,426); + blockread(f,p,426); + putimage(x,y,p,0); + freemem(p,426); + close(f); +} + +void block_drop(string fn, integer xl,integer yl,integer y) +{ + untyped_file f; byte bit; + integer fv; word st; + + st=(y-1)*80+(40-xl / 2)+((1-cp)*pagetop); + + assign(f,fn+".avd"); + reset(f,1); + + for( fv=1; fv <= yl; fv ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,mem[0xa000*st+(fv*80)],xl); + } + + close(f); + bit=getpixel(0,0); +} + +void drawscroll(proc gotoit) /* This is one of the oldest procs in the game. */ +{ + byte b,groi; integer lx,ly,mx,my,ex,ey; boolean centre; + byte icon_indent; + + off_virtual(); + setvisualpage(cp); setactivepage(1-cp); + oncandopageswap=false; /* On can now no longer swap pages. So we can + do what we want without its interference! */ + log_epsonroman(); /* Scrolls always START with Roman. */ + lx=0; ly=scrolln*6; + for( b=1; b <= scrolln; b ++) + { + ex=length(scroll[b])*8; if (lx0) after_the_scroll=true; +} + +void bubble(proc gotoit) +{ + integer xl,yl,my,xw,yw; byte fv; array<1,3,pointtype> p; + pointer rp1,rp2; /* replace: 1=bubble, 2=pointer */ + integer xc; /* x correction */ + + setvisualpage(cp); setactivepage(1-cp); + oncandopageswap=false; /* On can now no longer swap pages. So we can + do what we want without its interference! */ + mousepage(1-cp); /* Mousepage */ + + setfillstyle(1,talkb); setcolor(talkb); off(); + + xl=0; yl=scrolln*5; + for( fv=1; fv <= scrolln; fv ++) + if (textwidth(scroll[fv])>xl) xl=textwidth(scroll[fv]); + xl=xl / 2; + + xw=xl+18; yw=yl+7; + my=yw*2-2; xc=0; + + if ((talkx-xw)<0) xc=-(talkx-xw); + if ((talkx+xw)>639) xc=639-(talkx+xw); + + p[1].x=talkx-10; p[1].y=yw; + p[2].x=talkx+10; p[2].y=yw; + p[3].x=talkx; p[3].y=talky; + +/* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); + mblit(talkx-10,my,talkx+10,talky,0,3);*/ + bar(xc+talkx-xw+10,7,talkx+xw-10+xc,my); + bar(xc+talkx-xw,12,talkx+xw+xc,my-5); + pieslice(xc+talkx+xw-10,12,360,90,9); /* TR */ + pieslice(xc+talkx+xw-10,my-5,270,360,9); /* BR */ + pieslice(xc+talkx-xw+10,12,90,180,9); /* TL */ + pieslice(xc+talkx-xw+10,my-5,180,270,9); /* BL */ + fillpoly(3,p.body()); + + setcolor(talkf); yl -= 3; settextjustify(1,2); + for( fv=0; fv <= scrolln-1; fv ++) + outtextxy(talkx+xc,(fv*10)+12,scroll[fv+1]); + for( fv=1; fv <= scrolln; fv ++) /* These should be separate loops. */ + log_bubbleline(fv,param,scroll[fv]); + log_divider(); + + setvisualpage(1-cp); + dingdongbell(); + oncandopageswap=false; + on(); dropsok=false; gotoit(); off(); dropsok=true; + mblit((talkx-xw+xc) / 8,7,1+(talkx+xw+xc) / 8,my,3,1-cp); + mblit((talkx-10) / 8,my,1+(talkx+10) / 8,talky,3,1-cp); + blitfix(); + + setvisualpage(cp); + settextjustify(0,0); on(); /*sink;*/ + oncandopageswap=true; + resetscrolldriver(); + if (mpress>0) after_the_scroll=true; +} + +boolean ask(string question) +{ + boolean ask_result; + display(question+'\15'+'\21'); + if (screturn && (Random(2)==0)) /* half-and-half chance */ + { + display("...Positive about that?\23I\26\r\21"); /* be annoying! */ + if (screturn && (Random(4)==3)) /* another 25% chance */ + display("\n100% certain\??!\n\26\r\21"); /* be very annoying! */ + } + ask_result=screturn; + return ask_result; +} + +void resetscroll() +{ + scrolln=1; fillchar(scroll,sizeof(scroll),'\0'); +} + +void natural() /* Natural state of bubbles */ +{ + talkx=320; talky=200; talkb=8; talkf=15; +} + +string lsd() +{ + string x; + + string lsd_result; + if (dna.pence<12) + { /* just pence */ + x=strf(dna.pence)+'d'; + } else + if (dna.pence<240) + { /* shillings & pence */ + x=strf(dna.pence / longint(12))+'/'; + if ((dna.pence % longint(12))==0) x=x+'-'; else x=x+strf(dna.pence % longint(12)); + } else /* L, s & d */ + x=string('')+strf(dna.pence / longint(240))+'.'+strf((dna.pence / longint(12)) % longint(20))+'.'+ + strf(dna.pence % longint(12)); + if (dna.pence>12) x=x+" (that's "+strf(dna.pence)+"d)"; + lsd_result=x; + return lsd_result; +} + +void calldrivers(); + /* Was the mouse cursor virtual on entry to this proc? */ + +static void strip(string& q) +{ + while (pos("\40",q[length(q)])>0) q[0] -= 1; /* strip trailing spaces */ +} + + + +static void solidify(byte n) +{ + if (pos("\40",scroll[n])==0) return; /* no spaces */ + /* so there MUST be a space there, somewhere... */ + do { + scroll[n+1]=string(scroll[n][length(scroll[n])])+scroll[n+1]; + scroll[n][0] -= 1; + } while (!(scroll[n][length(scroll[n])]=='\40')); + strip(scroll[n]); +} + +void calldrivers() +{ + word fv; byte nn; char nnn; boolean mouthnext; + boolean call_spriterun; /* Only call sprite_run the FIRST time. */ + + boolean was_virtual; + + + nosound; state(0); screturn=false; mouthnext=false; + call_spriterun=true; + + switch (buffer[bufsize]) { + case '\4': bufsize -= 1; break; /* ^D = (D)on't include pagebreak */ + case '\2':case '\21':; break; /* ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box */ + default: { + bufsize += 1; buffer[bufsize]='\20'; + } + } + for( fv=1; fv <= bufsize; fv ++) + if (mouthnext) + { + if (buffer[fv]=='\23') param=0; else + switch (buffer[fv]) { + case RANGE_10('0','9'): param=ord(buffer[fv])-48; + break; + case RANGE_26('A','Z'): param=ord(buffer[fv])-55; + break; + } + mouthnext=false; + } else + switch (buffer[fv]) { + case '\20': { + if ((scrolln==1) && (scroll[1]=="")) flush(); + + if (call_spriterun) sprite_run(); + call_spriterun=false; + + was_virtual=visible==m_virtual; + if (was_virtual) off_virtual(); + drawscroll(normscroll); + if (was_virtual) on_virtual(); + resetscroll(); + if (screturn) return; + } + break; + case '\7': scrollbells += 1; break; /* #7 = "Bel" */ + case '\2': { + if ((scrolln==1) && (scroll[1]=="")) flush(); + + if (call_spriterun) sprite_run(); + call_spriterun=false; + switch (param) { + case 0: natural(); break; /* Not attached: generic bubble with no speaker. */ + case RANGE_9(1,9): if ((param>numtr) || (! tr[param].quick)) + { /* not valid */ + errorled(); + natural(); + } + else tr[param].chatter(); + break; /* Normal sprite talking routine. */ + case 10 ... 36: { + quasiped_type& with = quasipeds[param]; + /* Quasi-peds. (This routine performs the same + thing with QPs as triptype.chatter does with the + sprites.) */ + { + pedtype& with1 = peds[with.whichped]; + + talkx=with1.x; talky=with1.y; /* Position. */ + } + talkf=with.fgc; talkb=with.bgc; /* Colours. */ + } + break; + default: { errorled(); natural(); } /* not valid */ + } + + was_virtual=visible==m_virtual; + if (was_virtual) off_virtual(); + bubble(normscroll); + if (was_virtual) on_virtual(); + resetscroll(); + if (screturn) return; + } + break; + case '\25': { + { dnatype& with = dna; + switch (param) { + case 1: display(lsd()+'\4'); break; /* insert cash balance (recursion) */ + case 2: display(words[first_password+with.pass_num].w+'\4'); break; + case 3: display(with.like2drink+'\4'); break; + case 4: display(with.favourite_song+'\4'); break; + case 5: display(with.worst_place_on_earth+'\4'); break; + case 6: display(with.spare_evening+'\4'); break; + /* ... */ + case 9: display(strf(with.cat_x)+','+strf(with.cat_y)+'\4'); break; + case 10: switch (with.box_contents) { + case '\0': { /* Sixpence. */ + dixi('q',37); /* You find the sixpence. */ + with.pence += 6; + with.box_contents=nowt; + points(2); return; + } + break; + case nowt: display("nothing at all. It's completely empty."); break; + default: display(get_better(with.box_contents)+'.'); + } + break; + case 11: { + nn=1; + for( nnn='\1'; nnn <= numobjs; nnn ++) + if (with.obj[nnn]) + { + nn += 1; + display(get_better(nnn)+", "+'\4'); + } + } + break; + }} + } + break; + case '\26': use_icon=param; break; + case '\15': scrolln += 1; break; + case '\21': { + if (call_spriterun) sprite_run(); + call_spriterun=false; + + scrolln += 1; scroll[scrolln]='\21'; + was_virtual=visible==m_virtual; + if (was_virtual) off_virtual(); + drawscroll(dialogue); + if (was_virtual) on_virtual(); + resetscroll(); + } + break; + case '\23' : mouthnext=true; break; + case '\11' : for( nn=1; nn <= 9; nn ++) scroll[scrolln]=scroll[scrolln]+' '; + break; + default: + { /* add new char */ + if (length(scroll[scrolln])==50) + { + solidify(scrolln); + scrolln += 1; + } + scroll[scrolln]=scroll[scrolln]+buffer[fv]; + } + } +} + +void display(string z) +{ + bufsize=length(z); + move(z[1],buffer,bufsize); + calldrivers(); +} + +void loadfont() +{ + file f; + + assign(f,"avalot.fnt"); reset(f); f >> ch[0]; close(f); + assign(f,"avitalic.fnt"); reset(f); f >> ch[1]; close(f); + assign(f,"ttsmall.fnt"); reset(f); f >> little; close(f); +} + +void okay() +{ + display("Okay!"); +} + +void musical_scroll() +{ + boolean was_virtual; + + display(string("To play the harp...\r\rUse these keys:\r\n")+ + "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); + + sprite_run(); + + was_virtual=visible==m_virtual; + if (was_virtual) off_virtual(); + drawscroll(music_scroll); + if (was_virtual) on_virtual(); + resetscroll(); +} + +class unit_scrolls_initialize { + public: unit_scrolls_initialize(); +}; +static unit_scrolls_initialize scrolls_constructor; + +unit_scrolls_initialize::unit_scrolls_initialize() { + loadfont(); + resetscrolldriver(); +} diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h new file mode 100644 index 000000000000..d71ec5d5e295 --- /dev/null +++ b/engines/avalanche/scrolls.h @@ -0,0 +1,33 @@ +#ifndef __scrolls_h__ +#define __scrolls_h__ + + +#include "gyro.h" +#include "joystick.h" + + +const boolean aboutscroll = false; /* Is this the about box? */ + +void state(byte x); /* Sets "Ready" light to whatever */ + +void drawscroll(proc gotoit); /* This is one of the oldest procs in the game. */ + +void bubble(proc gotoit); + +void resetscroll(); + +void calldrivers(); + +void display(string z); + +boolean ask(string question); + +void natural(); + +string lsd(); + +void okay(); /* Says "Okay!" */ + +void musical_scroll(); + +#endif diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp new file mode 100644 index 000000000000..00c838a95a85 --- /dev/null +++ b/engines/avalanche/sequence.cpp @@ -0,0 +1,92 @@ +#include "ptoc.h" + +/* + + + + + SEQUENCE The sequencer. */ + +#define __sequence_implementation__ + + +#include "sequence.h" + + +/*#include "Gyro.h"*/ +/*#include "Timeout.h"*/ +/*#include "Celer.h"*/ +/*#include "Trip5.h"*/ + + +void then_show(byte what) +{ + byte fv; +; + for( fv=1; fv <= seq_length; fv ++) + if (seq[fv]==0) + {; + seq[fv]=what; + return; + } +} + +void first_show(byte what) +{; + /* First, we need to blank out the entire array. */ + fillchar(seq,sizeof(seq),'\0'); + + /* Then it's just the same as then_show. */ + then_show(what); + +} + +void then_flip(byte where,byte ped) +{; + then_show(now_flip); + + dna.flip_to_where=where; + dna.flip_to_ped=ped; +} + +void start_to_close() +{; + lose_timer(reason_sequencer); + set_up_timer(7,procsequence,reason_sequencer); +} + +void start_to_open() +{; + dna.user_moves_avvy=false; /* They can't move. */ + stopwalking; /* And they're not moving now. */ + start_to_close(); /* Apart from that, it's the same thing. */ +} + +void call_sequencer(); + + /* This proc is called by Timeout when it's time to do another frame. */ +static void shove_left() +{; + move(seq[2],seq[1],seq_length-1); /* Shift everything to the left. */ +} + +void call_sequencer() +{; + switch (seq[1]) { + case 0: return; break; /* No more routines. */ + case 1 ... 176: {; /* Show a frame. */ + show_one(seq[1]); + shove_left(); + } + break; + case 177: {; + user_moves_avvy=true; + fliproom(flip_to_where,flip_to_ped); /* 177 = Flip room. */ + if (seq[1]==177) shove_left(); + } + break; + } + + start_to_close(); /* Make sure this proc gets called again. */ +} + diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h new file mode 100644 index 000000000000..a6c59a612692 --- /dev/null +++ b/engines/avalanche/sequence.h @@ -0,0 +1,32 @@ +#ifndef __sequence_h__ +#define __sequence_h__ + + +const integer now_flip = 177; + +const integer seq_length = 10; + + +#ifdef __sequence_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,seq_length,byte> seq; +#undef EXTERN +#define EXTERN extern + + +void first_show(byte what); + +void then_show(byte what); + +void then_flip(byte where,byte ped); + +void start_to_close(); + +void start_to_open(); + +void call_sequencer(); + +#endif diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp new file mode 100644 index 000000000000..60f91e38f12d --- /dev/null +++ b/engines/avalanche/setup.cpp @@ -0,0 +1,1268 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ +/*#include "Tommys.h"*/ +#include "joystick.h" + + +const integer selected = 0x60; /* Background for selected lines of text. */ + +typedef array<1,400,varying_string<80> > mobytype; + +typedef set byteset; /* Define its typemark. */ + +enum option {_overrideegacheck, _zoomystart, _loadfirst, _numlockhold, _usemouse, + _controller, _logging, _logfile, + + _joystickinstalled, _joytop, _joybottom, _joyleft, _joyright, _joymidx, + _joymidy, _joycentringfactor, _whichjoy, _quiet, _soundcard, + _baseaddress, _irq, _dma, + _samplerate, _keyboardclick, + + _printer, + + option_error, last_option}; + + +mobytype* moby; +word mobylength; +byte background; /* The current background colour, times 16. */ +byte line; /* Which line you're on in the menus. */ + +string registrant,reginum; + +byte num_printers; +array<1,10,string> printers; +string this_printer; + +/* THE STATUS VARIABLES: */ + + /* general */ + +boolean override_ega; +boolean skip_loading_screens; +string load_particular; +boolean force_numlock; +boolean ignore_mouse; +boolean use_keyboard; +boolean log_to_printer; +boolean log_to_file; +string log_filename; +string autotype; + + /* joystick */ + +boolean has_a_joystick; +word jtop,jbottom,jleft,jright,jmidx,jmidy; +byte jcentre; +word whichjoy; + + /* sound */ + +boolean suppress_sfx; +byte your_card; +longint samplerate; +longint sound_addr,sound_irq,sound_dma; +boolean wants_keyclick; + + /* registration */ + +string regname,regnum,chkname,chknum; + + +string trim_and_caps(string this_) +{ + byte fv; + + string trim_and_caps_result; + while ((this_[1]==' ') && (this_!="")) + Delete(this_,1,1); /* Strip leading blanks. */ + while ((this_[length(this_)]==' ') && (this_!="")) + this_[0] -= 1; /* Strip trailing blanks. */ + for( fv=1; fv <= length(this_); fv ++) this_[fv]=upcase(this_[fv]);/* And capitalise. */ + trim_and_caps_result=this_; + return trim_and_caps_result; +} + +option string_2_option(string field) +{ + + option string_2_option_result; + field=trim_and_caps(field); + + if (field=="OVERRIDEEGACHECK") string_2_option_result=_overrideegacheck; else + if (field=="ZOOMYSTART") string_2_option_result=_zoomystart; else + if (field=="LOADFIRST") string_2_option_result=_loadfirst; else + if (field=="NUMLOCKHOLD") string_2_option_result=_numlockhold; else + if (field=="USEMOUSE") string_2_option_result=_usemouse; else + if (field=="CONTROLLER") string_2_option_result=_controller; else + if (field=="LOGGING") string_2_option_result=_logging; else + if (field=="LOGFILE") string_2_option_result=_logfile; else + + /* joystick */ + + if (field=="JOYSTICKINSTALLED") string_2_option_result=_joystickinstalled; else + if (field=="JOYTOP") string_2_option_result=_joytop; else + if (field=="JOYBOTTOM") string_2_option_result=_joybottom; else + if (field=="JOYLEFT") string_2_option_result=_joyleft; else + if (field=="JOYRIGHT") string_2_option_result=_joyright; else + if (field=="JOYMIDX") string_2_option_result=_joymidx; else + if (field=="JOYMIDY") string_2_option_result=_joymidy; else + if (field=="JOYCENTRINGFACTOR") string_2_option_result=_joycentringfactor; else + if (field=="WHICHJOY") string_2_option_result=_whichjoy; else + + /* sound */ + + if (field=="QUIET") string_2_option_result=_quiet; else + if (field=="SOUNDCARD") string_2_option_result=_soundcard; else + if (field=="SAMPLERATE") string_2_option_result=_samplerate; else + if (field=="KEYBOARDCLICK") string_2_option_result=_keyboardclick; else + if (field=="BASEADDRESS") string_2_option_result=_baseaddress; else + if (field=="IRQ") string_2_option_result=_irq; else + if (field=="DMA") string_2_option_result=_dma; else + + /* printer */ + + if (field=="PRINTER") string_2_option_result=_printer; else + + + string_2_option_result=option_error; + + return string_2_option_result; +} + +void clear_to(byte colour) +{ + window(1,1,80,24); background=colour*16; textattr=background; clrscr; +} + +void centre(byte where,byte colour, string what) +{ + textattr=background+colour; + gotoxy(40-length(what) / 2,where); + output << what; +} + +void load_file() +{ + text t; + + mobylength=0; + /*$I-*/ + assign(t,"avalot.ini"); + reset(t); + /*$I+*/ + + if (ioresult!=0) /* No file. */ + { + output << "SETUP: Avalot.ini not found!" << NL; + exit(255); + } + + while (! eof(t)) + { + mobylength += 1; /* Preincrement mode. */ + t >> (*moby)[mobylength] >> NL; + } + + close(t); + +} + +string strhf(longint x) /* assume x is +ve */ +{ + const array<0,16,char> hexdigits = "0123456789ABCDEF"; + string y; longint v; + + string strhf_result; + v=x; y=""; + + while (v!=0) + { + y=string(hexdigits[v % longint(16)-1])+y; + v=v / longint(16); + } + + strhf_result=string('$')+y; + return strhf_result; +} + +void update_moby(); + +static byte fv; + +static string field; + + +static void get_field(string x) +{ + if (pos(";",x)!=0) x=copy(x,1,pos(";",x)-1); + + if (pos("=",x)==0) + field=""; + else + { + field=copy(x,0,pos("=",x)-1); + while (field[1]==' ') field=copy(field,2,255); + } +} + + + +static string yn1(boolean x) + { string yn1_result; + if (x) yn1_result="Yes"; else yn1_result="No"; return yn1_result; + } + + + +static string kj(boolean x) + { string kj_result; + if (x) kj_result="Keyboard"; else kj_result="Joystick"; return kj_result; + } + + + +static string put_logcodes() +{ + byte q; + + string put_logcodes_result; + q=(byte)(log_to_file)+(byte)(log_to_printer)*2; + + switch (q) { + case 0: put_logcodes_result="No"; break; + case 1: put_logcodes_result="Disk"; break; + case 2: put_logcodes_result="Printer"; break; + } + return put_logcodes_result; +} + + + +static string card() +{ + string card_result; + switch (your_card) { + case 0: card_result="None"; break; + case 1: card_result="SB"; break; + case 2: card_result="SBPro"; break; + case 3: card_result="SB16"; break; + case 4: card_result="Pas"; break; + case 5: card_result="PasPlus"; break; + case 6: card_result="Pas16"; break; + case 7: card_result="Aria"; break; + case 8: card_result="WinSound"; break; + case 9: card_result="Gravis"; break; + case 10: card_result="DacLPT"; break; + case 11: card_result="StereoDacs"; break; + case 12: card_result="StereoOn1"; break; + case 13: card_result="Speaker"; break; + } + return card_result; +} + + + + +static void entail(string x) +{ + string before,after; + + before=copy((*moby)[fv],1,pos("=",(*moby)[fv])-1); + + if (pos(";",(*moby)[fv])==0) + { + (*moby)[fv]=before+'='+x; + } else + { + after=copy((*moby)[fv],pos(";",(*moby)[fv]),255); + + (*moby)[fv]=before+'='+x+' '; + while (length((*moby)[fv])<25) (*moby)[fv]=(*moby)[fv]+' '; + + (*moby)[fv]=(*moby)[fv]+after; + } +} + +void update_moby() +{ + option o; + + + + + + for( fv=1; fv <= mobylength; fv ++) + { + get_field((*moby)[fv]); + + if (field!="") + { + o=string_2_option(field); + + if (o==_overrideegacheck) entail(yn1(override_ega)); else + if (o==_zoomystart) entail(yn1(skip_loading_screens)); else + if (o==_loadfirst) entail(load_particular); else + if (o==_numlockhold) entail(yn1(force_numlock)); else + if (o==_usemouse) entail(yn1(ignore_mouse)); else + if (o==_controller) entail(kj(use_keyboard)); else + if (o==_logging) entail(put_logcodes()); else + if (o==_logfile) entail(log_filename); else + + /* joystick */ + + if (o==_joystickinstalled) entail(yn1(has_a_joystick)); else + if (o==_joytop) entail(strf(jtop)); else + if (o==_joybottom) entail(strf(jbottom)); else + if (o==_joyleft) entail(strf(jleft)); else + if (o==_joyright) entail(strf(jright)); else + if (o==_joymidx) entail(strf(jmidx)); else + if (o==_joymidy) entail(strf(jmidy)); else + if (o==_joycentringfactor) entail(strf(jcentre)); else + if (o==_whichjoy) entail(strf(whichjoy)); else + + /* sound */ + + if (o==_quiet) entail(yn1(suppress_sfx)); else + if (o==_soundcard) entail(card()); else + if (o==_samplerate) entail(strf(samplerate)); else + if (o==_baseaddress) entail(strhf(sound_addr)); else + if (o==_irq) entail(strf(sound_irq)); else + if (o==_dma) entail(strf(sound_dma)); else + if (o==_keyboardclick) entail(yn1(wants_keyclick)); else + + /* printer */ + + if (o==_printer) entail(this_printer); + + } + } +} + +void save_file() +{ + text t; + word fv; + + textattr=10; + update_moby(); + + clear_to(black); + centre(14,14,"Saving..."); + + assign(t,"avalot.ini"); + rewrite(t); + + for( fv=1; fv <= mobylength; fv ++) + { + t << (*moby)[fv] << NL; + } + + close(t); +} + +boolean detect() +{ + word x,y,xo,yo; + byte count; + + boolean detect_result; + count=0; + if (joystickpresent()) + { + detect_result=true; + return detect_result; + } + readjoya(xo,yo); + do { + if (count<7) count += 1; /* Take advantage of "flutter" */ + if (count==6) + { + centre(7,1,"The Bios says you don't have a joystick. However, it's often wrong"); + centre(8,1,"about such matters. So, do you? If you do, move joystick A to"); + centre(9,1,"continue. If you don't, press any key to cancel."); + } + readjoya(x,y); + } while (!((keypressed()) | (x!=xo) || (y!=yo))); + detect_result=~ keypressed(); + return detect_result; +} + +void display() +{ + gotoxy(28,10); output << jleft << " "; + gotoxy(28,11); output << jright; + gotoxy(28,12); output << jtop << " "; + gotoxy(28,13); output << jbottom; +} + +void readjoy(word& x,word& y) +{ + if (whichjoy==1) readjoya(x,y); else readjoyb(x,y); +} + +void getmaxmin() +{ + word x,y; char r; + + clear_to(green); + centre(5,1,"Rotate the joystick around in a circle, as far from the centre as it"); + centre(6,1,"can get. Then press any key."); + centre(7,1,"Press Esc to cancel this part."); + centre(16,1,"(To reset these figures, set \"Do you have a joystick?\" to No, then Yes.)"); + + gotoxy(20,10); output << "Left :"; + gotoxy(20,11); output << "Right :"; + gotoxy(20,12); output << "Top :"; + gotoxy(20,13); output << "Bottom:"; + + + if (jleft==0) jleft=maxint; + if (jtop==0) jtop=maxint; + do { + readjoy(x,y); + if (xjright) jright=x; + if (y>jbottom) jbottom=y; + display(); + } while (!keypressed()); + + do { r=readkey(); } while (!(~ keypressed())); + if (r=='\33') return; + + centre(19,1,"Thank you. Now please centre your joystick and hit a button."); + do {; } while (!(buttona1() || buttona2())); + + readjoya(jmidx,jmidy); + + has_a_joystick=true; +} + +void joysetup() +{ + clear_to(green); + if (! detect()) return; + getmaxmin(); +} + +byte choose_one_of(byteset which); + +static shortint direction; + + +static void move(shortint d) +{ + direction=d; line=line+d; +} + + + +static void highlight(word where,word how) +{ + byte fv; + + where=where*160-159; + for( fv=0; fv <= 79; fv ++) + mem[0xb800*where+fv*2]=(mem[0xb800*where+fv*2] & 0xf)+how; +} + +byte choose_one_of(byteset which) + +{ + const integer upwards = -1; + const integer downwards = 1; + + boolean done; + char r; + + + byte choose_one_of_result; + done=false; direction=1; + do { + while (! (which.has(line))) + { + line=line+direction; + if (line>26) line=1; + if (line==0) line=26; + } + + highlight(line,selected); + r=readkey(); + highlight(line,background); + switch (r) { + case '\0': switch (readkey()) { + case cup: move(upwards); break; + case cdown: move(downwards); break; + } + break; + case creturn: done=true; break; + case cescape: { + choose_one_of_result=15; /* bottom line is always 15. */ + return choose_one_of_result; + } + break; + } + + } while (!done); + + choose_one_of_result=line; + return choose_one_of_result; +} + +void bottom_bar(); +static void load_regi_info(); + + +static char decode1(char c) +{ + byte b; + + char decode1_result; + b=ord(c)-32; + decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; +} + + + +static char decode2(char c) +{ + char decode2_result; + decode2_result=chr( ((ord(c) & 0xf) << 2) + 0x43); + return decode2_result; +} + + + +static boolean checker(string proper,string check) +{ + byte fv; boolean ok; + + boolean checker_result; + ok=true; + for( fv=1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) + ok=false; + + checker_result=ok; + return checker_result; +} + + +static void load_regi_info() +{ + text t; + byte fv; + string x; + byte namelen,numlen; + string namechk,numchk; + + + /*$I-*/ + assign(t,"register.dat"); reset(t); + /*$I+*/ + + if (ioresult!=0) + { + registrant=""; + return; + } + + for( fv=1; fv <= 53; fv ++) t >> NL; + t >> x >> NL; + close(t); + + namelen=107-ord(x[1]); numlen=107-ord(x[2]); + + registrant=copy(x,3,namelen); + reginum=copy(x,4+namelen,numlen); + namechk=copy(x,4+namelen+numlen,namelen); + numchk=copy(x,4+namelen+numlen+namelen,numlen); + + for( fv=1; fv <= namelen; fv ++) registrant[fv]=decode1(registrant[fv]); + for( fv=1; fv <= numlen; fv ++) reginum[fv]=decode1(reginum[fv]); + + if ((! checker(registrant,namechk)) || (! checker(reginum,numchk))) + { registrant="\?\"!?"; reginum="(."; } +} + +void bottom_bar() +{ + load_regi_info(); + textattr=96; background=96; + window(1,1,80,25); + gotoxy(1,25); clreol; + if (registrant=="") + centre(25,15,"Unregistered copy."); + else + centre(25,15,string("Registered to ")+registrant+" ("+reginum+")."); +} + +void new_menu() +{ + line=1; /* now that we've got a new menu. */ +} + +string two_answers(string ans_true,string ans_false, boolean which) +{ + string two_answers_result; + if (which) + two_answers_result=string(" (")+ans_true+')'; + else + two_answers_result=string(" (")+ans_false+')'; + return two_answers_result; +} + +string yes_or_no(boolean which) +{ + string yes_or_no_result; + yes_or_no_result=two_answers("yes","no",which); + return yes_or_no_result; +} + +string give_name(string what) +{ + string give_name_result; + if (what=="") + give_name_result=" (none)"; + else + give_name_result=string(" (\"")+what+"\")"; + return give_name_result; +} + +string sound_card(byte which) +{ + string sound_card_result; + switch (which) { + case 0: sound_card_result="none"; break; + case 1: sound_card_result="SoundBlaster"; break; + case 2: sound_card_result="SoundBlaster Pro"; break; + case 3: sound_card_result="SoundBlaster 16"; break; + case 4: sound_card_result="Pro Audio Spectrum"; break; + case 5: sound_card_result="Pro Audio Spectrum+"; break; + case 6: sound_card_result="Pro Audio Spectrum 16"; break; + case 7: sound_card_result="Aria"; break; + case 8: sound_card_result="Windows Sound System or compatible"; break; + case 9: sound_card_result="Gravis Ultrasound"; break; + case 10: sound_card_result="DAC on LPT1"; break; + case 11: sound_card_result="Stereo DACs on LPT1 and LPT2"; break; + case 12: sound_card_result="Stereo-on-1 DAC on LPT"; break; + case 13: sound_card_result="PC speaker"; break; + } + return sound_card_result; +} + +void get_str(string& n) +{ + string x; + char r; + + clear_to(black); + centre(3,3,"Enter the new value. Press Enter to accept, or Esc to cancel."); + x=""; + + do { + + r=readkey(); + + switch (r) { + case cbackspace: if (x[0]>'\0') x[0] -= 1; break; + case creturn: { + n=x; + return; + } + break; + case cescape: return; break; + + default: + if (x[0]<'\106') x=x+r; + } + + + centre(7,2,string(' ')+x+' '); + + } while (!false); + +} + +void get_num(longint& n) +{ + string x; + char r; + integer e; + + clear_to(black); + centre(3,3,"Enter the new value. Press Enter to accept, or Esc to cancel."); + centre(4,3,"Precede with $ for a hex value."); + x=""; + + do { + + r=upcase(readkey()); + + switch (r) { + case cbackspace: if (x[0]>'\0') x[0] -= 1; break; + case creturn: { + val(x,n,e); + return; + } + break; + case cescape: return; break; + + default: + if ((x[0]<'\106') && + ((set::of(range('0','9'), eos).has(r)) || ((x[1]=='$') && (set::of(range('A','F'), eos).has(r))) || + ((x=="") && (r=='$')))) + x=x+r; + } + + + centre(7,2,string(' ')+x+' '); + + } while (!false); + +} + +void general_menu() +{ + new_menu(); + do { + clear_to(blue); + + centre( 3,15,"General Menu"); + + centre( 5, 7,string("Override EGA check?")+yes_or_no(override_ega)); + centre( 6, 7,string("Skip loading screens?")+yes_or_no(skip_loading_screens)); + centre( 7, 7,string("Load a particular file by default?")+give_name(load_particular)); + centre( 8, 7,string("Force NumLock off?")+yes_or_no(force_numlock)); +/* centre( 9, 7,'Ignore the mouse?'+yes_or_no(ignore_mouse));*/ + centre(10, 7,string("Default controller?")+two_answers("keyboard","joystick",use_keyboard)); + centre(12, 7,string("Log to printer?")+yes_or_no(log_to_printer)); + centre(13, 7,string("Log to file?")+yes_or_no(log_to_file)); + centre(14, 7,string("Filename to log to?")+give_name(log_filename)); + + centre(15,15,"Return to main menu."); + + switch (choose_one_of(set::of(5,6,7,8,/*9,*/10,12,13,14,15, eos))) { + case 5: override_ega=! override_ega; break; + case 6: skip_loading_screens=! skip_loading_screens; break; + case 7: get_str(load_particular); break; + case 8: force_numlock=! force_numlock; break; +/* 9: ignore_mouse:=not ignore_mouse;*/ + case 10: use_keyboard=! use_keyboard; break; + case 12: { + log_to_printer=! log_to_printer; + if (log_to_file && log_to_printer) log_to_file=false; + } + break; + case 13: { + log_to_file=! log_to_file; + if (log_to_file && log_to_printer) log_to_printer=false; + } + break; + case 14: get_str(log_filename); break; + case 15: { new_menu(); return; } break; + } + + } while (!false); +} + +void joystick_menu() +{ + new_menu(); + do { + clear_to(green); + + centre(3,15,"Joystick Menu"); + + centre(5,14,string("Do you have a joystick?")+yes_or_no(has_a_joystick)); + centre(6,14,string("Which joystick to use? ")+chr(whichjoy+48)); + centre(7,14,"Select this one to set it up."); + + centre(15,15,"Return to main menu"); + + switch (choose_one_of(set::of(5,6,7,15, eos))) { + case 5: { + has_a_joystick=! has_a_joystick; + if (! has_a_joystick) + { jleft=0; jright=0; jtop=0; jbottom=0; } + } + break; + case 6: whichjoy=3-whichjoy; break; /* Flips between 2 and 1. */ + case 7: joysetup(); break; + case 15: { new_menu(); return; } break; + } + + } while (!false); +} + +void cycle(byte& what, byte upper_limit) +{ + if (what==upper_limit) + what=0; + else + what += 1; +} + +void sound_menu() +{ + new_menu(); + do { + clear_to(cyan); + + centre(3, 0,"Sound menu"); + + centre(5, 0,string("Do you want to suppress sound effects?")+yes_or_no(suppress_sfx)); + centre(6, 0,string("Sound output device\? (")+sound_card(your_card)+')'); + centre(7, 0,string("Sampling rate\? (")+strf(samplerate)+"Hz)"); + centre(8, 0,string("Base address\? (")+strhf(sound_addr)+" *hex*)"); + centre(9, 0,string("IRQ\? (")+strf(sound_irq)+')'); + centre(10,0,string("DMA\? (")+strf(sound_dma)+')'); + centre(11,0,string("Do you want keyclick?")+yes_or_no(wants_keyclick)); + + centre(15,15,"Return to main menu"); + + centre(17,1,"WARNING: Incorrect values of IRQ and DMA may damage your computer!"); + centre(18,1,"Read AVALOT.INI for the correct values."); + + switch (choose_one_of(set::of(5,6,7,8,9,10,11,15, eos))) { + case 5: suppress_sfx=! suppress_sfx; break; + case 6: cycle(your_card,13); break; + case 7: get_num(samplerate); break; + case 8: get_num(sound_addr); break; + case 9: get_num(sound_irq); break; + case 10: get_num(sound_dma); break; + case 11: wants_keyclick=! wants_keyclick; break; + case 15: { new_menu(); return; } break; + } + + } while (!false); +} + +void printer_menu() +{ + byte fv; + byteset chooseable_lines; + + new_menu(); + + chooseable_lines=set::of(15, eos); + for( fv=1; fv <= num_printers; fv ++) + chooseable_lines=chooseable_lines+set::of(fv+8, eos); + + do { + clear_to(red); + + centre(3,15,"Printer menu"); + + centre(5,15,"Select one of the following printers:"); + centre(6,15,string("The current choice is ")+this_printer+'.'); + + for( fv=1; fv <= num_printers; fv ++) + centre(8+fv,14,printers[fv]); + + centre(15,15,"Return to main menu"); + + fv=choose_one_of(chooseable_lines); + + if (fv==15) { new_menu(); return; } + + this_printer=printers[fv-8]; + + } while (!false); +} + +void regi_split(string x) +{ + byte fv; + + regname[0]=chr(107-ord(x[1])); chkname[0]=regname[0]; + regnum[0]=chr(107-ord(x[2])); chknum[0]=chknum[0]; + + move(x[3],regname[1],ord(regname[0])); + for( fv=1; fv <= length(regname); fv ++) + regname[fv]=chr(abs(((ord(regname[fv])-33)-177*fv) % 94)+33); +} + + +void registration_menu() +{ + char r; + text t,o; + string x; + byte fv; + + clear_to(black); + + centre(3,15,"REGISTRATION"); + centre(5,14,"Please insert the disk you were sent when you registered"); + centre(6,14,"into any drive, and press its letter. For example, if the"); + centre(7,14,"disk is in drive A:, press A."); + centre(9,14,"Press Esc to cancel this menu."); + + do { r=upcase(readkey()); } while (!(set::of('\33',range('A','Z'), eos).has(r))); if (r=='\33') return; + + /*$I-*/ + assign(t,string(r)+":\\REGISTER.DAT"); + reset(t); + /*$I+*/ + if (ioresult!=0) + { + centre(17,15,"But it isn't in that drive..."); + centre(19,15,"Press any key."); + r=readkey(); + return; + } + for( fv=1; fv <= 54; fv ++) t >> x >> NL; + regi_split(x); + + /* Copy the file... */ + + assign(o,"register.dat"); rewrite(o); reset(t); + + while (! eof(t)) + { + t >> x >> NL; o << x << NL; + } + close(t); close(o); + + centre(17,15,"Done! Press any key..."); + bottom_bar(); + r=readkey(); + +} + +void menu() +{ + bottom_bar(); + new_menu(); + do { + clear_to(black); + + centre(3,15,"Avalot Setup - Main Menu"); + + centre(5, 9,"General setup"); + centre(6,10,"Joystick setup"); + centre(7,11,"Sound setup"); + centre(8,12,"Printer setup"); + centre(9,14,"REGISTRATION setup"); + + centre(15,15,"--- EXIT SETUP ---"); + + switch (choose_one_of(set::of(5,6,7,8,9,15, eos))) { + case 5: general_menu(); break; + case 6: joystick_menu(); break; + case 7: sound_menu(); break; + case 8: printer_menu(); break; + case 9: registration_menu(); break; + case 15: { + new_menu(); + clear_to(lightgray); + centre(3,0,"Quit: would you like to save changes?"); + centre(5,1,"Quit and SAVE changes."); + centre(6,1,"Quit and DON'T save changes."); + centre(15,0,"Cancel and return to the main menu."); + switch (choose_one_of(set::of(5,6,15, eos))) { + case 5: { + save_file(); + return; + } + break; + case 6: return; break; + } + new_menu(); + } + break; + } + + } while (!false); +} + +void defaults() /* Sets everything to its default value. */ +{ + /* general */ + + override_ega=false; + skip_loading_screens=false; + load_particular=""; + force_numlock=true; + ignore_mouse=false; + use_keyboard=true; + log_to_printer=false; + log_to_file=false; + log_filename="avalot.log"; + + /* joystick */ + + has_a_joystick=false; + /* jtop,jbottom,jleft,jright,jmidx,jmidy need no initialisation. */ + + /* sound */ + + suppress_sfx=false; + your_card=0; /* none */ + wants_keyclick=false; + + /* other stuff */ + + registrant=""; + + num_printers=0; this_printer="??"; +} + +void parse_file(); + +const integer parse_weird_field = 1; + +const integer parse_not_yes_or_no = 2; + +const integer parse_not_numeric = 3; + +const integer parse_not_kbd_or_joy = 4; + +const integer parse_weird_logcode = 5; + +const integer parse_weird_card = 6; + + +static varying_string<80> this_,thiswas; + +static boolean error_found,ignoring; + + +static void error(byte what) +{ + textattr=15; + if (! error_found) + { + clrscr; textattr=12; + output << "SETUP: *** ERROR FOUND IN AVALOT.INI! ***" << NL; textattr=15; + } + output << ' '; + switch (what) { + case parse_weird_field: output << "Unknown identifier on the left"; break; + case parse_not_yes_or_no: output << "Value on the right should be Yes or No"; break; + case parse_not_numeric: output << "Value on the right is not numeric"; break; + case parse_not_kbd_or_joy: output << "Value on the right should be Keyboard or Joystick"; break; + case parse_weird_logcode: output << "Value on the right should be No, Printer or Disk"; break; + case parse_weird_card: output << "Never heard of the card"; break; + } + output << " in:" << NL; textattr=10; output << thiswas << NL; + error_found=true; +} + + + +static boolean yesno(string x) +{ + boolean yesno_result; + if (x=="YES") + yesno_result=true; + else if (x=="NO") + yesno_result=false; + else + { + error(parse_not_yes_or_no); + yesno_result=false; + } + return yesno_result; +} + + + +static boolean kbdjoy(string x) +{ + boolean kbdjoy_result; + if (x=="KEYBOARD") + kbdjoy_result=true; + else if (x=="JOYSTICK") + kbdjoy_result=false; + else + { + error(parse_not_kbd_or_joy); + kbdjoy_result=false; + } + return kbdjoy_result; +} + + + +static word numeric(string x) +{ + const varying_string<15> hexdigits = "0123456789ABCDEF"; + word answer; integer e; + + word numeric_result; + if (x[1]=='$') + { + answer=0; + for( e=2; e <= length(x); e ++) + { + answer=answer << 4; + answer += pos(upcase(x[e]),hexdigits)-1; + } + } else + { + val(x,answer,e); + if (e!=0) error(parse_not_numeric); + } + numeric_result=answer; + return numeric_result; +} + + + +static void get_logcodes(string x) +{ + if (x=="NO") { log_to_file=false; log_to_printer=false; } else + if (x=="DISK") { log_to_file=true; log_to_printer=false; } else + if (x=="PRINTER") { log_to_file=false; log_to_printer=true; } else + error(parse_weird_logcode); +} + + + +static void get_card(string x) +{ + if (x=="NONE") your_card=0; else + if (x=="SB") your_card=1; else + if (x=="SBPRO") your_card=2; else + if (x=="SB16") your_card=3; else + if (x=="PAS") your_card=4; else + if (x=="PASPLUS") your_card=5; else + if (x=="PAS16") your_card=6; else + if (x=="ARIA") your_card=7; else + if (x=="WINSOUND") your_card=8; else + if (x=="GRAVIS") your_card=9; else + if (x=="DACLPT") your_card=10; else + if (x=="STEREODACS") your_card=11; else + if (x=="STEREOON1") your_card=12; else + if (x=="SPEAKER") your_card=13; else + error(parse_weird_card); +} + +void parse_file(){ + + + word where; + byte position; + varying_string<80> field,data,pure_data; + option o; + + + error_found=false; + ignoring=false; + + for( where=1; where <= mobylength; where ++) + { + this_=(*moby)[where]; thiswas=this_; + + position=pos(";",this_); + if (position>0) this_=copy(this_,1,position-1); + + if (this_=="") continue_; /* Don't carry on if by now it's empty. */ + + if (this_[1]=='[') + { + ignoring=! (trim_and_caps(this_)=="[END]"); + + if (copy(this_,1,8)=="[printer") + { + num_printers += 1; + printers[num_printers]=copy(this_,10,length(this_)-10); + } + } + + if (ignoring) continue_; + + position=pos("=",this_); + field=trim_and_caps(copy(this_,1,position-1)); if (field=="") continue_; + pure_data=copy(this_,position+1,255); + data=trim_and_caps(pure_data); + o=string_2_option(field); + + /* general */ + + if (o==_overrideegacheck) override_ega=yesno(data); else + if (o==_zoomystart) skip_loading_screens=yesno(data); else + if (o==_loadfirst) load_particular=data; else + if (o==_numlockhold) force_numlock=yesno(data); else + if (o==_usemouse) ignore_mouse=yesno(data); else + if (o==_controller) use_keyboard=kbdjoy(data); else + if (o==_logging) get_logcodes(data); else + if (o==_logfile) log_filename=data; else + + /* joystick */ + + if (o==_joystickinstalled) has_a_joystick=yesno(data); else + if (o==_joytop) jtop=numeric(data); else + if (o==_joybottom) jbottom=numeric(data); else + if (o==_joyleft) jleft=numeric(data); else + if (o==_joyright) jright=numeric(data); else + if (o==_joymidx) jmidx=numeric(data); else + if (o==_joymidy) jmidy=numeric(data); else + if (o==_joycentringfactor) jcentre=numeric(data); else + if (o==_whichjoy) whichjoy=numeric(data); else + + /* sound */ + + if (o==_quiet) suppress_sfx=yesno(data); else + if (o==_soundcard) get_card(data); else + if (o==_samplerate) samplerate=numeric(data); else + if (o==_baseaddress) sound_addr=numeric(data); else + if (o==_irq) sound_irq=numeric(data); else + if (o==_dma) sound_dma=numeric(data); else + if (o==_keyboardclick) wants_keyclick=yesno(data); else + + /* printer */ + + if (o==_printer) this_printer=pure_data; else + + /* others */ + + error(parse_weird_field); + } + + if (error_found) + { + textattr=15; + output << " Try and fix the above errors. As a last resort, try deleting or" << NL; + output << " renaming AVALOT.INI, and the default values will be used. Good luck." << NL; + exit(177); + } + } + +void clear_up() +{ + window(1,1,80,25); + textattr=31; + clrscr; + output << NL; + output << "Enjoy the game..." << NL; + output << NL; + cga_cursor_on; +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + cursor_off; + + moby = new mobytype; /* Allocate memory space */ + + defaults(); + + load_file(); + + parse_file(); + + menu(); + + delete moby; /* Deallocate memory space again */ + + clear_up(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp new file mode 100644 index 000000000000..9b1c1c23cca8 --- /dev/null +++ b/engines/avalanche/seu.cpp @@ -0,0 +1,977 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ +/*#include "Tommys.h"*/ + + +const integer msize = 100; +const integer flag = -20047; +const integer perm = -1; + +const integer avvy_shoot = 87; +const integer facing_right = 88; +const integer facing_left = 94; + +const integer avvy_y = 150; + +const integer left_margin = 10; +const integer right_margin = 605; + +const array<0,6,byte> shooting = {{87,80,81,82,81,80,87}}; + +const integer stocks = 28; + +const integer framedelaymax = 2; + +const integer maxrunners = 4; + +const integer times_a_second = /*31*/18; + +const integer flash_time = 20; /* If flash_time is <= this, the word "time" will flash. */ + /* Should be about 20. */ + +/* --- Scores for various things --- */ + +const integer score_for_hitting_face = 3; +const integer bonus_for_hitting_escaper = 5; + +struct mtype { + shortint ix,iy; + integer x,y; + byte p; + integer timeout; + boolean cameo; + byte cameo_frame; + boolean missile; + boolean wipe; +}; + +struct xtype { + word s; + pointer p; +}; + +class rectype { +public: + integer x1,y1,x2,y2; +}; + +class plottype : public rectype { +public: + byte which; +}; + +class plotmasktype : public plottype { +public: + byte whichmask; +}; + +array<1,100,xtype> x; +array<1,100,mtype> m; +matrix<0,1,1,100,rectype> r; +array<0,1,byte> rsize; +byte cp; +word score; byte time1; + +byte shiftstate; /*ABSOLUTE $40:$17; */ + +word avvypos; +word avvywas; +byte avvyanim; +byte avvyfacing; + +byte was_facing; + +boolean alt_was_pressed_before; + +byte throw_next; + +boolean firing; + +array<0,6,byte> stockstatus; + +array<1,maxrunners,struct A1 { + integer x,y; + byte frame; + byte toohigh,lowest; + shortint ix,iy; + byte framedelay; + }> running; + +varying_string<5> score_is; +varying_string<3> time_is; + +byte time_this_second; + +word escape_count; +byte escape_stock; +boolean escaping,got_out; + +array<0,6,boolean> has_escaped; + +byte count321; + +word storage_seg,storage_ofs; + +byte how_many_have_escaped; + +void flippage() +{ + setactivepage(cp); + cp=1-cp; + setvisualpage(cp); +} + +void flesh_colours() {; /*assembler; +asm + mov ax,$1012; + mov bx,21; { 21 = light pink (why?) */ + /*mov cx,1; + mov dx,seg @flesh; + mov es,dx; + mov dx,offset @flesh; + int $10; + + mov dx,seg @darkflesh; + mov es,dx; + mov dx,offset @darkflesh; + mov bx,5; { 5 = dark pink. */ + /*int $10; + + jmp @TheEnd; + + @flesh: + db 56,35,35; + + @darkflesh: + db 43,22,22; + + @TheEnd: */ + } + +boolean overlap(word a1x,word a1y,word a2x,word a2y,word b1x,word b1y,word b2x,word b2y) +{ /* By De Morgan's law: */ + boolean overlap_result; + overlap_result=(a2x>=b1x) && (b2x>=a1x) && (a2y>=b1y) && (b2y>=a1y); + return overlap_result; +} + +void getsize(byte w, integer& xx,integer& yy) +{ + array<0,1,integer> n; + + move(x[w].p,n,4); + xx=n[0]; yy=n[1]; +} + +void display(integer xx,integer yy, byte w) +{ + putimage(xx,yy,x[w].p,0); +} + +byte get_stock_number(byte x) +{ + byte get_stock_number_result; + while (has_escaped[x]) + { + x += 1; + if (x==7) x=0; + } + get_stock_number_result=x; + return get_stock_number_result; +} + +void cameo_display(integer xx,integer yy, byte w1,byte w2) +{ + putimage(xx,yy,x[w2].p,andput); + putimage(xx,yy,x[w1].p,xorput); +} + +void blankit() +{ + byte fv; + + for( fv=1; fv <= rsize[cp]; fv ++) + { rectype& with = r[cp][fv]; + bar(with.x1,with.y1,with.x2,with.y2);} + rsize[cp]=0; +} + +void blank(integer xx1,integer yy1,integer xx2,integer yy2) +{ + rsize[cp] += 1; + { + rectype& with = r[cp][rsize[cp]]; + + with.x1=xx1; + with.y1=yy1; + with.x2=xx2; + with.y2=yy2; + } +} + +void movethem() +{ + byte fv; + + for( fv=1; fv <= msize; fv ++) + { mtype& with = m[fv]; + if (with.x!=flag) + { + with.x=with.x+with.ix; + with.y=with.y+with.iy; + }} +} + +void plotthem() +{ + byte fv; integer xx,yy; + + for( fv=1; fv <= msize; fv ++) + { mtype& with = m[fv]; + if (with.x!=flag) + { + if (with.cameo) + { + cameo_display(with.x,with.y,with.p,with.cameo_frame); + if (cp==0) { with.cameo_frame += 2; with.p += 2; } + } else display(with.x,with.y,with.p); + getsize(with.p,xx,yy); + if (with.wipe) blank(with.x,with.y,with.x+xx,with.y+yy); + if (with.timeout>0) + { + with.timeout -= 1; + if (with.timeout==0) with.x=flag; + } + }} +} + +void define(integer xx,integer yy, byte pp, shortint ixx,shortint iyy, integer timetime, + boolean is_a_missile,boolean do_we_wipe) +{ + byte which; + + for( which=1; which <= msize; which ++) + { + mtype& with = m[which]; + + if (with.x==flag) + { + with.x=xx; + with.y=yy; + with.p=pp; + with.ix=ixx; + with.iy=iyy; + with.timeout=timetime; + with.cameo=false; + with.missile=is_a_missile; + with.wipe=do_we_wipe; + + return; + } + } +} + +void define_cameo(integer xx,integer yy, byte pp, integer timetime) +{ + byte which; + + for( which=1; which <= msize; which ++) + { + mtype& with = m[which]; + + if (with.x==flag) + { + with.x=xx; + with.y=yy; + with.p=pp; + with.ix=0; + with.iy=0; + with.timeout=timetime; + with.cameo=true; + with.cameo_frame=pp+1; + with.missile=false; + with.wipe=false; + + return; + } + } +} + +void get_score() +{ + byte fv; + + str(score,5,score_is); + for( fv=1; fv <= 5; fv ++) + if (score_is[fv]==' ') + score_is[fv]='0'; +} + +void get_time1() +{ + byte fv; + + str(time1,5,time_is); + for( fv=1; fv <= 3; fv ++) + if (time_is[fv]==' ') + time_is[fv]='0'; +} + +void display_const(integer x,integer y, byte what) +{ + byte page_; + + for( page_=0; page_ <= 1; page_ ++) + { + setactivepage(page_); + display(x,y,what); + } + setactivepage(1-cp); +} + +void show_stock(byte x) +{ + if (escaping && (x==escape_stock)) + { + display_const(x*90+20,30,stocks+2); + return; + } + if (stockstatus[x]>5) return; + display_const(x*90+20,30,stocks+stockstatus[x]); + stockstatus[x]=1-stockstatus[x]; +} + +void show_score() +{ + byte fv; + varying_string<5> score_was; + + score_was=score_is; get_score(); + for( fv=1; fv <= 5; fv ++) + if (score_was[fv]!=score_is[fv]) + display_const(30+fv*10,0,ord(score_is[fv])-47); +} + +void show_time() +{ + byte fv; + varying_string<3> time_was; + + time_was=time_is; get_time1(); + for( fv=1; fv <= 3; fv ++) + if (time_was[fv]!=time_is[fv]) + display_const(130+fv*10,0,ord(time_is[fv])-47); +} + +void gain(shortint howmuch) +{ + if (-howmuch>score) score=0; else + score=score+howmuch; + show_score(); +} + +void new_escape() +{ + escape_count=Random(18)*20; + escaping=false; +} + +void instructions(); + +static void nextpage() +{ + char c; + + outtextxy(400,190,"Press a key for next page >"); + c=readkey(); + cleardevice(); +} + +void instructions() +{ + display(25,25,facing_right); + outtextxy(60,35,"< Avvy, our hero, needs your help - you must move him around."); + outtextxy(80,45,"(He's too terrified to move himself!)"); + + outtextxy(0,75,"Your task is to prevent the people in the stocks from escaping"); + outtextxy(0,85,"by pelting them with rotten fruit, eggs and bread. The keys are:"); + outtextxy(80,115,"LEFT SHIFT"); outtextxy(200,115,"Move left."); + outtextxy(72,135,"RIGHT SHIFT"); outtextxy(200,135,"Move right."); + outtextxy(136,155,"ALT"); outtextxy(200,155,"Throw something."); + nextpage(); + + display(25,35,stocks); + outtextxy(80,35,"This man is in the stocks. Your job is to stop him getting out."); + outtextxy(88,45,"UNFORTUNATELY... the locks on the stocks are loose, and every"); + outtextxy(88,55,"so often, someone will discover this and try to get out."); + display(25, 85,stocks+2); + outtextxy(80, 85,"< Someone who has found a way out!"); + outtextxy(88, 95,"You MUST IMMEDIATELY hit people smiling like this, or they"); + outtextxy(88,105,"will disappear and lose you points."); + display(25,125,stocks+5); + display(25,155,stocks+4); + outtextxy(80,125,"< Oh dear!"); + nextpage(); + + outtextxy(0,35,"Your task is made harder by:"); + display(25,55,48); + outtextxy(60,55,"< Yokels. These people will run in front of you. If you hit"); + outtextxy(68,65,"them, you will lose MORE points than you get hitting people"); + outtextxy(68,75,"in the stocks. So BEWARE!"); + outtextxy(80,125,"Good luck with the game!"); + nextpage(); +} + +void setup() +{ + integer gd,gm; + untyped_file f; + char rkv; + + rkv=upcase(readkey()); + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + flesh_colours(); + + assign(f,"notts.avd"); + reset(f,1); gd=1; + score=0; time1=120; score_is="(c)94"; + time_this_second=0; + + while (! eof(f)) + { + xtype& with = x[gd]; + + blockread(f,with.s,2); + getmem(with.p,with.s); + blockread(f,with.p,with.s); + gd += 1; + } + close(f); + + if ((rkv=='I') || ((rkv=='\0') && (readkey()==cf1))) instructions(); + + for( gd=0; gd <= 6; gd ++) + { + stockstatus[gd]=Random(2); + show_stock(gd); + } + + fillchar(m,sizeof(m),'\261'); + setfillstyle(1,0); + cp=0; + flippage(); + fillchar(rsize,sizeof(rsize),'\0'); + avvywas=320; + avvypos=320; + avvyanim=1; + avvyfacing=facing_left; + + alt_was_pressed_before=false; + throw_next=74; + firing=false; + + for( gd=1; gd <= maxrunners; gd ++) + { + A1& with = running[gd]; + + with.x=flag; + } + + new_escape(); + fillchar(has_escaped,sizeof(has_escaped),'\0'); /* All false. */ + count321=255; /* Counting down. */ + + /* Set up status line. */ + + display_const(0,0,17); /* Score: */ + show_score(); /* value of score (00000 here) */ + display_const(110,0,20); /* Time: */ + show_time(); /* value of time */ + + Randomize(); + + how_many_have_escaped=0; +} + +void init_runner(integer xx,integer yy, byte f1,byte f2, shortint ixx,shortint iyy) +{ + byte fv; + + for( fv=1; fv <= maxrunners; fv ++) + { A1& with = running[fv]; + if (with.x==flag) + { + with.x=xx; with.y=yy; + with.frame=f1; + with.toohigh=f2; + with.lowest=f1; + with.ix=ixx; with.iy=iyy; + if ((with.ix==0) && (with.iy==0)) with.ix=2; /* To stop them running on the spot! */ + with.framedelay=framedelaymax; + return; + }} +} + +void titles() +{ + registers r; + byte a; /*absolute $A000:0; */ + untyped_file f; + byte bit; + + r.ax=0xd; + intr(0x10,r); + + assign(f,"shoot1.avd"); + reset(f,1); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,8000); + } + close(f); +} +/* +procedure animate3; +begin + define(100,100,10,1,0,perm,false,true); + define( 50,20 ,30,3,3,30,false,true); + repeat; + blankit; + plotthem; + movethem; + flippage; + delay(100); + until keypressed; +end; + +procedure animate2; +var + x,n:byte; + helpx:integer; + helpdir:shortint; + helpani:byte; +begin + x:=0; n:=0; helpani:=0; + helpx:=10; helpdir:=1; + setfillstyle(1,0); + + repeat + display(x*52,0,n+28); + inc(x); inc(n); + + if x=13 then + begin + bar(helpx-2,50,helpx+5,80); + if helpdir>0 then + display(helpx,50,80-helpani) + else + display(helpx,50,86-helpani); + helpx:=helpx+helpdir*5; + if (helpx>600) or (helpx<3) then helpdir:=-helpdir; + if helpani=0 then helpani:=5 else dec(helpani); + + x:=0; +(* delay(100);*) + end; + if n=6 then n:=0; + until keypressed; +end; +*/ + +void move_avvy() +{ + if (avvywasavvypos) + { +/* bar(avvyWas+32,Avvy_Y,avvyPos+33,Avvy_Y+85);*/ + avvyfacing=facing_left; + } + + if (! firing) + { + if (avvywas==avvypos) + avvyanim=1; + else + { + avvyanim += 1; + if (avvyanim==6) avvyanim=0; + } + } + + if (avvyfacing==avvy_shoot) + define(avvypos,avvy_y,shooting[avvyanim],0,0,1,false,true); + else + define(avvypos,avvy_y,avvyanim+avvyfacing,0,0,1,false,true); + + avvywas=avvypos; + + if (avvyfacing==avvy_shoot) + { + if (avvyanim==6) + { + avvyfacing=was_facing; + avvyanim=0; + firing=false; + } else avvyanim += 1; + } +} + +void read_kbd() +{ + + if (firing) return; + + if ((shiftstate & 8)>0) + { /* Alt - shoot */ + if ((alt_was_pressed_before) || (count321!=0)) return; + alt_was_pressed_before=true; + firing=true; + define(avvypos+27,avvy_y+5,throw_next,0,-2,53,true,true); + throw_next += 1; if (throw_next==80) throw_next=74; + avvyanim=0; + was_facing=avvyfacing; + avvyfacing=avvy_shoot; + return; + } + + alt_was_pressed_before=false; + + if ((shiftstate & 1)>0) + { /* Move right. */ + avvypos += 5; + if (avvypos>right_margin) avvypos=right_margin; + return; + } + + if ((shiftstate & 2)>0) + { /* Move left. */ + avvypos -= 5; + if (avvypos5) + { + stockstatus[fv] -= 1; + if (stockstatus[fv]==8) + { + stockstatus[fv]=0; + show_stock(fv); + } + } +} + +void collision_check() +{ + byte fv; + integer dist_from_side; + byte this_stock; + + for( fv=1; fv <= 100; fv ++) + { mtype& with = m[fv]; + if (with.x!=flag) + { + if ((with.missile) && (with.y<60) && (with.timeout==1)) + { +/* sound(177); delay(1); nosound;*/ + dist_from_side=(with.x-20) % 90; + this_stock=((with.x-20) / 90); + if ((! has_escaped[this_stock]) && + (dist_from_side>17) && (dist_from_side<34)) + { + sound(999); delay(3); nosound; + define(with.x+20,with.y,26+Random(2),3,1,12,false,true); /* Well done! */ + define(this_stock*90+20,30,31,0,0,7,false,false); /* Face of man */ + define_cameo(this_stock*90+20+10,35,40,7); /* Splat! */ + define(this_stock*90+20+20,50,34+Random(5),0,2,9,false,true); /* Oof! */ + stockstatus[this_stock]=17; + gain(score_for_hitting_face); + + if ((escaping) && (escape_stock==this_stock)) + { /* Hit the escaper. */ + sound(1777); delay(1); nosound; + gain(bonus_for_hitting_escaper); + escaping=false; new_escape(); + } + } else + { + define(with.x,with.y,83+Random(3),2,2,17,false,true); /* Missed! */ + if ((! has_escaped[this_stock]) && + ((dist_from_side>3) && (dist_from_side<43))) + { + define(this_stock*90+20,30,30,0,0,7,false,false); /* Face of man */ + if (dist_from_side>35) + define_cameo(with.x-27,35,40,7); /* Splat! */ + else + define_cameo(with.x-7,35,40,7); + stockstatus[this_stock]=17; + } + } + } + }} +} + +shortint sgn(integer a) +{ + shortint sgn_result; + if (a==0) { sgn_result=0; return sgn_result; } + if (a>0) { sgn_result=1; return sgn_result; } + sgn_result=-1; + return sgn_result; +} + +void turn_around(byte who, boolean randomx) +{ + { + A1& with = running[who]; + + if (randomx) + { + if (with.ix>0) with.ix=-(Random(5)+1); else with.ix=(Random(5)+1); + } else + with.ix=-with.ix; + with.iy=-with.iy; + } +} + +void bump_folk() +{ + byte fv,ff; + + for( fv=1; fv <= maxrunners; fv ++) + if (running[fv].x!=flag) + for( ff=fv+1; ff <= maxrunners; ff ++) + if ((running[ff].x!=flag) && + overlap(running[fv].x,running[fv].y, + running[fv].x+17,running[fv].y+24, + running[ff].x,running[ff].y, + running[ff].x+17,running[ff].y+24)) + { + turn_around(fv,false); /* Opp. directions. */ + turn_around(ff,false); + } +} + +void people_running() +{ + byte fv; + + if (count321!=0) return; + for( fv=1; fv <= maxrunners; fv ++) + { A1& with = running[fv]; + if (with.x!=flag) + { + if (((with.y+with.iy)<=53) || ((with.y+with.iy)>=120)) + { + with.iy=-with.iy; + } + + if (with.ix<0) + define(with.x,with.y,with.frame,0,0,1,false,true); + else + define(with.x,with.y,with.frame+7,0,0,1,false,true); + if (with.framedelay==0) + { + with.frame += 1; if (with.frame==with.toohigh) with.frame=with.lowest; + with.framedelay=framedelaymax; + with.y=with.y+with.iy; + } else with.framedelay -= 1; + + if (((with.x+with.ix)<=0) || ((with.x+with.ix)>=620)) turn_around(fv,true); + + with.x=with.x+with.ix; + }} +} + +void update_time() +{ + if (count321!=0) return; + time_this_second += 1; + if (time_this_second < times_a_second) return; + time1 -= 1; + show_time(); + time_this_second=0; + if (time1<=flash_time) + if (odd(time1)) display_const(110,0,20); /* Normal time */ + else display_const(110,0,86); /* Flash time */ +} + +void hit_people() +{ + byte fv,ff; + + if (count321!=0) return; + for( fv=1; fv <= 100; fv ++) + { mtype& with = m[fv]; + if (with.missile && (with.x!=flag)) + for( ff=1; ff <= maxrunners; ff ++) + if ((running[ff].x!=flag) && + overlap(with.x,with.y,with.x+7,with.y+10, + running[ff].x,running[ff].y, + running[ff].x+17, + running[ff].y+24)) + { + sound(7177); +/* setcolor(4); + rectangle(x,y,x+7,y+10); + rectangle(running[ff].x,running[ff].y, + running[ff].x+17, + running[ff].y+24);*/ + nosound; + with.x=flag; + gain(-5); + define(running[ff].x+20,running[ff].y+3, + 34+Random(6),1,3,9,false,true); /* Oof! */ + define(with.x,with.y,83,1,0,17,false,true); /* Oops! */ + }} +} + +void escape_check() +{ + if (count321!=0) return; + if (escape_count>0) { escape_count -= 1; return; } + + /* Escape_count = 0; now what? */ + + if (escaping) + { + if (got_out) + { + new_escape(); escaping=false; + display_const(escape_stock*90+20,30,stocks+4); + } else + { + display_const(escape_stock*90+20,30,stocks+5); + escape_count=20; got_out=true; + define(escape_stock*90+20,50,25,0,2,17,false,true); /* Escaped! */ + gain(-10); + has_escaped[escape_stock]=true; + + how_many_have_escaped += 1; + + if (how_many_have_escaped == 7) + { + for( time1=0; time1 <= 1; time1 ++) + { + setactivepage(time1); + cleardevice(); + } + setactivepage(1-cp); + + memw[storage_seg*storage_ofs+1]=0; + do {; } while (!(memw[storage_seg*storage_ofs+1]>9)); + + setvisualpage(1-cp); + display(266,90,23); + + memw[storage_seg*storage_ofs+1]=0; + do {; } while (!(memw[storage_seg*storage_ofs+1]>72)); + + setvisualpage(cp); + + memw[storage_seg*storage_ofs+1]=0; + do {; } while (!(memw[storage_seg*storage_ofs+1]>9)); + + time1=0; + } + } + } else + { + escape_stock=get_stock_number(Random(7)); escaping=true; got_out=false; + display_const(escape_stock*90+20,30,stocks+2); /* Smiling! */ + escape_count=200; + } +} + +void check321() +{ + if (count321==0) return; + count321 -= 1; + switch (count321) { + case 84: define(320, 60,16, 2, 1,94,false,true); break; + case 169: define(320, 60,15, 0, 1,94,false,true); break; + case 254: { + define(320, 60,14,-2, 1,94,false,true); + define( 0,100,18, 2, 0,254,false,true); + } + break; + } +} + +void check_params(); + +static void not_bootstrap() +{ + output << "This is not a standalone program!" << NL; + exit(255); +} + +void check_params() +{ + integer e; + + if (paramstr(1)!="jsb") not_bootstrap(); + + val(paramstr(2),storage_seg,e); if (e!=0) not_bootstrap(); + val(paramstr(3),storage_ofs,e); if (e!=0) not_bootstrap(); + +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + check_params(); + + titles(); + setup(); + init_runner( 20, 70,48,54, Random(5)+1,Random(4)-2); + init_runner(600, 70,48,54, Random(5)+1,Random(4)-2); + init_runner(600,100,61,67,-Random(5)+1,Random(4)-2); + init_runner( 20,100,61,67,-Random(5)+1,Random(4)-2); + do { + memw[storage_seg*storage_ofs+1]=0; + + blankit(); + hit_people(); + plotthem(); + movethem(); + move_avvy(); + bump_folk(); + people_running(); + animate(); + escape_check(); + + collision_check(); + + update_time(); + + check321(); + + read_kbd(); + flippage(); + do {; } while (!(memw[storage_seg*storage_ofs+1]>0)); + + } while (!(time1==0)); + +/* textmode(259); + textattr:=1; + writeln('Your final score was: ',score,'.'); + readln;*/ + mem[storage_seg*storage_ofs]=score; + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp new file mode 100644 index 000000000000..fb236b95bbce --- /dev/null +++ b/engines/avalanche/seu_avvy.cpp @@ -0,0 +1,90 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +struct adxtype { + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +}; + +integer gd,gm; +untyped_file sf; +longint id; +word soa; +adxtype a; +byte xw; +array<5,2053,byte> mani; +matrix<0,35,0,4,byte> sil; +array<1,16000,byte> aa; +untyped_file outfile; + +void plotat(integer xx,integer yy) /* Does NOT cameo the picture!*/ +{ + word soaa; +; + move(mani,aa[5],sizeof(mani)); + {; + aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ + } + putimage(xx,yy,aa,0); + soaa=sizeof(mani); + blockwrite(outfile,soaa,2); + blockwrite(outfile,aa,sizeof(mani)); +} + +const integer shouldid = -1317732048; + +void explode(byte which) /* 0 is the first one! */ + /* Each character takes five-quarters of (a.size-6) on disk. */ +{ + byte fv,ff; word so1; /* size of one */ +; + {; + so1=a.size-6; so1 += so1 / 4; + seek(sf,183+soa+so1*which); /* First is at 221 */ +/* where:=filepos(sf);*/ + xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; + + for( fv=0; fv <= a.yl; fv ++) + blockread(sf,sil[fv],xw); + blockread(sf,mani,a.size-6); + aa[a.size-1]=0; aa[a.size]=0; /* footer */ + } + plotat(100,100); + delay(100); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + assign(outfile,"notts.avd"); + reset(outfile,1); + seek(outfile,filesize(outfile)); + + assign(sf,"sprite0.avd"); + reset(sf,1); + + seek(sf,177); + blockread(sf,id,4); + blockread(sf,soa,2); + blockread(sf,a,soa); + + explode(1); + for( gd=6; gd <= 11; gd ++) explode(gd); + for( gd=18; gd <= 23; gd ++) explode(gd); + + close(sf); + close(outfile); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp new file mode 100644 index 000000000000..946e318ebb59 --- /dev/null +++ b/engines/avalanche/sezedit.cpp @@ -0,0 +1,406 @@ +#include "ptoc.h" + + +/*$M 65520,0,655360*/ +/*#include "Crt.h"*/ +#include "graph.h" + + +const char marker = '\33'; +const char game[] = "Avalot"; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +struct markertype { + word length; + longint offset; + byte checksum; +}; + +struct sezheader { + array<1,2,char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ +}; + +array<0,1999,char> buffer,was; +word bufpos,bufsize; +longint chainnum; +varying_string<40> nickname; +array<1,255,char> junk; +string temp; +char r; +fonttype font; +integer cpos; +sezheader sezhead; +untyped_file f,tempf; +text nicknames; + +byte sumup() +{ + word fv; byte total; +byte sumup_result; +; + total=0; + for( fv=0; fv <= bufsize-1; fv ++) + {; + total += ord(was[fv]); + } + sumup_result=total; +return sumup_result; +} + +string findname(longint which) +{ + string x; varying_string<10> q; +string findname_result; +; + str(which,q); + reset(nicknames); + do { nicknames >> x >> NL; } while (!(x=="{go}")); + do { + nicknames >> x >> NL; + } while (!(pos(q,x)>0)); + if (eof(nicknames)) + {; + findname_result="noname"; + } else + {; + Delete(x,1,3); /* lose "{__" */ + Delete(x,pos(" ",x),255); /* lose all chars after first space */ + findname_result=x; + } + close(nicknames); +return findname_result; +} + +void cursor() +{ + byte fv; +; + for( fv=12; fv <= 15; fv ++) + mem[0xa000*cpos+fv*80]=~(mem[0xa000*cpos+fv*80]); +} + +void xy() +{; + cpos=(bufpos / 80)*1280+(bufpos % 80); +} + +void show() +{ + word fv,orig,y; +; + for( fv=0; fv <= 1999; fv ++) + if (buffer[fv]!=was[fv]) + {; + orig=(fv / 80)*1280+(fv % 80); + for( y=0; y <= 15; y ++) + mem[0xa000*orig+y*80]=(byte)(font[buffer[fv]][y]); + } + xy(); + move(buffer,was,sizeof(buffer)); +} + +void sizeup() +{; + do { + switch (buffer[bufsize]) { + case marker: return; break; /* we've found it OK! */ + case '\0': bufsize -= 1; break; + default: bufsize += 1; + } + } while (!false); +} + +void graphics() +{ + integer gd,gm; + file fontfile; +; + gd=3; gm=1; initgraph(gd,gm,""); + assign(fontfile,"c:\\thomas\\lanche.fnt"); + reset(fontfile); fontfile >> font; close(fontfile); +} + +void edit_it(); + +static void legit(char r) +{; /* it's a legit keystroke */ + move(buffer[bufpos],buffer[bufpos+1],1999-bufpos); + buffer[bufpos]=r; + bufpos += 1; show(); +} + +void edit_it() +{ + byte fv; +; + for( fv=1; fv <= bufsize; fv ++) buffer[fv] -= (byte)(177*bufsize); + fillchar(was,sizeof(was),'\0'); show(); + do { + cursor(); r=readkey(); cursor(); + switch (r) { + case '\0': switch (readkey()) { /* extd keystrokes */ + case 'K': if (bufpos>0) {; bufpos -= 1; xy(); } break; /* Left */ + case 'M': if (bufpos80) {; bufpos -= 80; xy(); } break; /* Up */ + case 'P': if (bufpos<(cardinal)bufsize-79) {; bufpos += 80; xy(); } break; /* Down */ + case 'G': {; bufpos=0; xy(); } break; /* Home */ + case 'O': {; bufpos=bufsize; xy(); } break; /* End */ + case 'S': {; /* Del */ + move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); show(); + } + break; + case 'A': legit('\357'); break; /* copyright symbol */ + } + break; + case '\10': if (bufpos>0) {; /* backspace */ + bufpos -= 1; + move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); + show(); + } + break; + case '\33': {; + for( fv=1; fv <= bufsize; fv ++) buffer[fv] += (byte)(177*bufsize); + restorecrtmode(); + return; + } + break; /* end of editing */ + default: legit(r); + } + sizeup(); + } while (!false); +} + +void saveit(longint ourchain, word oldsize,word newsize) +{ + array<1,17777,byte> buffer; + word numread,numwritten,total; + char check; + word fv; + markertype m; + integer sizechange; /* so's it can be +ve or -ve */ + longint wheresit; /* "offset" value for "ourchain" */ +; + assign(tempf,"sez.tmp"); + /* OK, here goes... */ + sezhead.size=sezhead.size-longint(oldsize)+longint(newsize); /* adjust our size */ + sizechange=newsize-oldsize; /* +ve if bigger, -ve if smaller, 0 if same */ + textattr=27; + + rewrite(tempf,1); reset(f,1); + seek(f,255+sizeof(sezhead)); /* bypass the junk & sezhead (they're in RAM) */ + + blockwrite(tempf,junk,255); /* move the junk... */ + blockwrite(tempf,sezhead,sizeof(sezhead)); /* and the header to new files */ + + /* Now to move the markers */ + output << "Moving markers..." << NL; + for( fv=1; fv <= sezhead.chains; fv ++) + {; + output << fv << '\15'; + blockread(f,m,sizeof(m)); + if (fv==ourchain) /* Right, this one's ours! */ + {; + wheresit=m.offset; /* recorded for later */ + m.length=newsize-1; + m.checksum=sumup(); + } else + if (fv>ourchain) + {; /* After ours- its offset will have to be changed... */ + m.offset=m.offset+longint(sizechange); + } /* Otherwise, before ours- leave it well alone */ + blockwrite(tempf,m,sizeof(m)); + } + output << "Done OK." << NL; + + /* Right, that's the markers done... thank goodness... now it's just the + chains themselves! */ + + total=0; + + output << "Updating the chains..." << NL; + while (total<=wheresit) + {; + blockread(f,buffer,1,numread); + blockwrite(tempf,buffer,numread,numwritten); + output << '.'; + total += numwritten; + } + output << NL; output << "Updating our chain..." << NL; + /* We're now in the right place (at last...) */ + for( fv=0; fv <= (bufsize-1); fv ++) was[fv] += 3+177*fv*(bufsize-1); /* scramble "was" */ + blockwrite(tempf,was,newsize); /* "was" contains what the values *were* */ + seek(f,filepos(f)+oldsize); + output << NL; output << "Copying everything else..." << NL; + while (! eof(f)) /* high-speed copy */ + {; + blockread(f,buffer,17777,numread); + blockwrite(tempf,buffer,numread); + output << '.'; + } + output << NL; + + /* Closedown */ + close(f); close(tempf); + erase(f); rename(tempf,string(game)+".SEZ"); +} + +void particular() +{ + word origsize; +; + bufsize=0; + output << "Which one\? (? for a list)"; input >> chainnum >> NL; + if ((chainnum<0) || (chainnum>sezhead.chains)) + {; + output << "Don't be silly!" << NL; return; + } + + origsize=0 /*bufsize*/; bufpos=0; cpos=0; nickname=findname(chainnum); + fillchar(buffer,sizeof(buffer),'\0'); + buffer[0]=marker; + do { + textattr=30; output << NL; + output << "SEZ EDITOR (c) 1992, Thomas Thurman." << NL; + output << NL; + output << "Editing scrollchain no." << chainnum << NL; + output << "Your text is " << bufsize << " bytes long." << NL; + output << NL; + output << "Its nickname is \"" << nickname << "\"." << NL; + output << NL; + output << "Enter a command:" << NL; + output << " S) Save the text to disk," << NL; + output << " E) Edit this particular chain," << NL; + output << " N) change the Nickname," << NL; + output << " R) Revert text to the original," << NL; + output << "Esc) Exit and do something else!" << NL; + output << NL; + output << "Your choice? "; + r=upcase(readkey()); output << r << NL; + switch (r) { + case 'N': {; + output << NL; output << "New nickname (max 40 chars, Enter to cancel)?"; + input >> temp >> NL; + if (temp!="") nickname=temp; + } + break; + case 'E': {; setgraphmode(1); edit_it(); } break; + case 'S': saveit(chainnum,origsize,bufsize); break; + case '\33': return; break; + } + } while (!false); +} + +void titles() +{ + const varying_string<7> title = "SEZedit"; + byte fv; char r; +; + settextstyle(1,0,0); + for( fv=7; fv >= 1; fv --) + {; + setcolor(fv*2); + setusercharsize(8-fv,1,8-fv,1); + outtextxy(fv*65,fv*40-30,title[fv-1]); + } + setusercharsize(17,7,1,1); setcolor(green); + outtextxy(300,10,"Thorsoft"); + outtextxy(10,310,"Press any key..."); + do { r=readkey(); } while (!(! keypressed())); + restorecrtmode(); textattr=30; clrscr; +} + +void addone() /* Adds a new, empty chain to the end of the list. */ +{ + longint fv; + markertype m; + array<1,17777,byte> buffer; + word numread; +; + assign(tempf,"sez.tmp"); + textattr=27; + rewrite(tempf,1); reset(f,1); /* f = AVALOT.SEZ (original file) */ + seek(f,255+sizeof(sezhead)); + sezhead.chains += 1; /* we're adding a new chain */ + + blockwrite(tempf,junk,255); /* move the junk */ + blockwrite(tempf,sezhead,sizeof(sezhead)); /* move the header */ + + /* Now to move the markers */ + output << "Moving markers..." << NL; + for( fv=1; fv <= sezhead.chains-longint(1); fv ++) /* -1 because we've added 1 to it */ + {; + output << fv << '\12'; + blockread(f,m,sizeof(m)); + blockwrite(tempf,m,sizeof(m)); + } + output << "Done OK." << NL; + /* Now we add a new marker onto the end! */ + {; + m.offset=sezhead.size; /* right onto the end */ + m.length=0; /* it's empty */ + } + blockwrite(tempf,m,sizeof(m)); /* write it out to disk */ + + /* Copy everything else... including the #177 check char */ + output << "Copying everything else over..." << NL; + while (! eof(f)) + {; + blockread(f,buffer,17777,numread); + blockwrite(tempf,buffer,numread); + output << '.'; + } + output << NL; + close(f); close(tempf); + erase(f); rename(tempf,string(game)+".SEZ"); +} + +void general() +{ + char r; +; + do { + textattr=31; + output << NL; output << string(game)+".SEZ" << NL; + output << NL; + output << "No. of chains: " << sezhead.chains << NL; + output << NL; + output << "Choose one of these:" << NL; + output << " A) Add a new scrollchain" << NL; + output << " E) Edit one" << NL; + output << "Esc) Exit" << NL; + output << NL; + output << "Your choice? "; + r=upcase(readkey()); output << r << NL; + switch (r) { + case 'A': addone(); break; + case 'E': particular(); break; + case '\33': exit(0); break; + } + } while (!false); +} + +void loadit() +{; + reset(f,1); + blockread(f,junk,255); + blockread(f,sezhead,sizeof(sezhead)); + close(f); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + assign(f,string(game)+".SEZ"); + assign(tempf,"sez.tmp"); + assign(nicknames,string(game)+".NIK"); + loadit(); + graphics(); + titles(); + general(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp new file mode 100644 index 000000000000..755f247f8d56 --- /dev/null +++ b/engines/avalanche/sezunit.cpp @@ -0,0 +1,76 @@ +#include "ptoc.h" + +#define __sezunit_implementation__ + + +#include "sezunit.h" + + +struct markertype { + word length; + longint offset; + byte checksum; +}; + +untyped_file f; +longint number; +markertype marker; +word fv; +byte sum; + +void sez_setup() /* This procedure sets up the Sez system (obviously!) */ +{; + + /* Set up variables */ + + fillchar(chain,sizeof(chain),'\261'); /* blank out gunk in "chain" */ + chainsize=0; /* it's empty (for now...) */ + sezerror=sezok; /* everything's fine! */ + + /* Set up AVALOT.SEZ */ + + assign(f,"avalot.sez"); reset(f,1); + seek(f,255); blockread(f,sezhead,sizeof(sezhead)); + if (ioresult!=0) {; sezerror=sezgunkyfile; return; } /* too short */ + {; + if ((sezhead.initials!="TT") || (sezhead.gamecode!=thisgamecode) + || (sezhead.revision!=thisvercode)) + {; + sezerror=sezgunkyfile; /* not a valid file */ + return; + } + } +} + +byte sumup() +{ + word fv; byte total; +byte sumup_result; +; + total=0; + for( fv=0; fv <= chainsize; fv ++) + {; + total += ord(chain[fv]); + } + sumup_result=total; +return sumup_result; +} + +void getchain(longint number) +{; + seek(f,longint(262)+number*longint(7)); blockread(f,marker,7); + {; + seek(f,longint(270)+sezhead.chains*longint(7)+marker.offset); + blockread(f,chain,marker.length+1); + for( fv=0; fv <= marker.length; fv ++) chain[fv] -= 3+177*fv*marker.length; /* unscramble */ + chainsize=marker.length; + if (sumup()!=marker.checksum) + {; + sezerror=sezhacked; + return; + } + } + close(f); + sezerror=sezok; /* nowt went wrong */ +} + diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h new file mode 100644 index 000000000000..6b0a99ee54cd --- /dev/null +++ b/engines/avalanche/sezunit.h @@ -0,0 +1,42 @@ +#ifndef __sezunit_h__ +#define __sezunit_h__ + + +/*#include "Gyro.h"*/ + + +struct sezheader { + array<1,2,char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ +}; + + + +#ifdef __sezunit_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<0,1999,char> chain; /* This chain */ +EXTERN word chainsize; /* Length of "chain" */ +EXTERN byte sezerror; /* Error code */ +EXTERN sezheader sezhead; +#undef EXTERN +#define EXTERN extern + + + /* Error codes for "sezerror" */ +const integer sezok = 0; +const integer sezgunkyfile = 1; +const integer sezhacked = 2; + + +void sez_setup(); + +void getchain(longint number); + + +#endif diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp new file mode 100644 index 000000000000..bcc460346d2f --- /dev/null +++ b/engines/avalanche/sezxfr.cpp @@ -0,0 +1,95 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + /*$V-*/ +text t; +string x; +matrix<1,100,1,2,string> data; +word dp,ip,fv; +array<1,20,word> index1; +array<1,20,varying_string<10> > names; +array<1,1777,longint> thumb; longint total; +untyped_file f; + +void strip() {; x=copy(x,2,255); } + +void squish(string& q) +{ + string n; boolean ctrl; byte fv; +; + ctrl=false; n=""; + for( fv=1; fv <= length(q); fv ++) + if (q[fv]=='^') ctrl=true; else + {; /* not a caret */ + if (ctrl) q[fv]=chr(ord(upcase(q[fv]))-64); + n=n+q[fv]; ctrl=false; + } + while (n[length(n)]=='\40') n[0] -= 1; /* strip trailing spaces */ + for( fv=1; fv <= length(n); fv ++) n[fv] += 177; /* scramble */ + q=n; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + dp=0; ip=0; fillchar(data,sizeof(data),'\0'); + fillchar(thumb,sizeof(thumb),'\261'); + fillchar(index1,sizeof(index1),'\3'); + assign(t,"v:sez.dat"); reset(t); + while (! eof(t)) + {; + t >> x >> NL; + switch (x[1]) { + case ';': {; textattr=lightred; strip(); } break; + case ':': {; + textattr=lightblue; strip(); + if (dp>0) squish(data[dp][2]); + dp += 1; data[dp][1]=x; + if (pos("*",x)>0) + {; /* index */ + ip += 1; index1[ip]=dp; names[ip]=copy(x,1,pos("*",x)-1); + } + } + break; + default: + {; + textattr=white; + data[dp][2]=data[dp][2]+x+'\40'; + } + } + output << x << NL; + } + squish(data[dp][2]); + + total=1; + for( fv=1; fv <= dp; fv ++) + {; + thumb[fv]=total; + total += length(data[fv][2])+1; + } + + thumb[dp+1]=total; + + /* save it all! Firstly, the Sez file... */ + + assign(f,"v:avalot.sez"); rewrite(f,1); + x=string("This is a Sez file for an Avvy game, and it's copyright!")+'\32'; + blockwrite(f,x[1],57); + blockwrite(f,dp,2); blockwrite(f,ip,2); + blockwrite(f,index1,40); + blockwrite(f,thumb,dp*4+4); + for( fv=1; fv <= dp; fv ++) + blockwrite(f,data[fv][2],length(data[fv][2])+1); + close(f); + + /* ...then the Sed file. */ + + assign(t,"v:avalot.sed"); rewrite(t); + for( fv=1; fv <= ip; fv ++) t << names[fv] << NL; + for( fv=1; fv <= dp; fv ++) t << data[fv][1] << NL; + close(t); + + /* Done! */ +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp new file mode 100644 index 000000000000..e8dfb592a31d --- /dev/null +++ b/engines/avalanche/shell1.cpp @@ -0,0 +1,36 @@ +#include "ptoc.h" + + +/*$M $800,0,0*/ +/*#include "Dos.h"*/ + +struct infotype { + matrix<128,255,1,8,byte> chars; + string data; +}; +infotype table; +pointer where; +string comspec; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1f,where); move(where,table,1280); + comspec=getenv("comspec"); + table.data=table.data+"Avalot;"; + setintvec(0x1f,&table); + output << NL; + output << "The Astounding Avvy DOS Shell... don't forget to register!" << NL; + output << NL; + output << "Use the command EXIT to return to your game." << NL; + output << NL; + output << "Remember: You *mustn't* load any TSRs while in this DOS shell." << NL; + output << NL; + output << "This includes: GRAPHICS, PRINT, DOSKEY, and pop-up programs (like Sidekick.)" << NL; + output << NL; + output << "About to execute \"" << comspec << "\"..." << NL; + swapvectors; + exec("c:\\command.com",""); + swapvectors; + setintvec(0x1f,where); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp new file mode 100644 index 000000000000..053bca9eed5e --- /dev/null +++ b/engines/avalanche/shell2.cpp @@ -0,0 +1,26 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +#include "graph.h" + +struct infotype { + matrix<128,255,1,8,byte> chars; + string data; +}; +infotype table; +pointer where; +integer gd,gm; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1f,where); move(where,table,1280); + gd=1; gm=0; initgraph(gd,gm,"c:\\turbo"); + output << "Now in CGA low-res 320x200." << NL; + output << "High ASCII codes work- " << NL; + output << "And the code is..." << NL; + output << table.data << NL; + output << "Press Enter..." << NL; + input >> NL; closegraph(); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp new file mode 100644 index 000000000000..a4b2f8a2de0d --- /dev/null +++ b/engines/avalanche/slope.cpp @@ -0,0 +1,349 @@ +#include "ptoc.h" + + + +struct joysetup { + word xmid,ymid,xmin,ymin,xmax,ymax; + byte centre; /* Size of centre in tenths */ +}; + +const integer bug_twonames = 255; +const integer bug_pandl = 254; +const integer bug_weirdswitch = 253; +const integer bug_invalidini = 252; +const integer bug_notyesorno = 251; +const integer bug_weirdcard = 250; + +byte fv; +char t; +string bugline; +boolean usingp,usingl; +boolean zoomy,numlockhold; +boolean doing_syntax; +joysetup js; boolean use_joy_a; + +boolean filename_specified; +boolean soundfx; + +string inihead,initail; /* For reading the .INI file. */ + +string filetoload; + +boolean cl_override,keyboardclick,demo; + +string slopeline; + +word storage_seg,storage_ofs; + +string argon; + +longint soundcard,baseaddr,speed,irq,dma; + +string strf(longint x) +{ + string q; + + string strf_result; + str(x,q); strf_result=q; + return strf_result; +} + +void linebug(byte which) +{ + output << "AVALOT : "; + switch (which) { + case bug_twonames : output << "You may only specify ONE filename." << NL; break; + case bug_pandl : output << "/p and /l cannot be used together." << NL; break; + case bug_weirdswitch : output << "Unknown switch (\"" << bugline << + "\"). Type AVALOT /? for a list of switches." << NL; + break; + case bug_invalidini: output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; break; + case bug_notyesorno: output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; break; + case bug_weirdcard: output << "Unknown card: " << bugline << '.' << NL; break; + } + + exit(which); +} + +longint card(string x) +{ + longint card_result; + if (x=="NONE") card_result=0; else + if (x=="SB") card_result=1; else + if (x=="SBPRO") card_result=2; else + if (x=="SB16") card_result=3; else + if (x=="PAS") card_result=4; else + if (x=="PASPLUS") card_result=5; else + if (x=="PAS16") card_result=6; else + if (x=="ARIA") card_result=7; else + if (x=="WINSOUND") card_result=8; else + if (x=="GRAVIS") card_result=9; else + if (x=="DACLPT") card_result=10; else + if (x=="STEREODACS") card_result=11; else + if (x=="STEREOON1") card_result=12; else + if (x=="SPEAKER") card_result=13; else + linebug(bug_weirdcard); + return card_result; +} + +void upstr(string& x) +{ + byte fv; + + for( fv=1; fv <= length(x); fv ++) x[fv]=upcase(x[fv]); +} + +boolean yesno() +{ + boolean yesno_result; + if (initail=="YES") yesno_result=true; else + if (initail=="NO") yesno_result=false; else + linebug(bug_notyesorno); + return yesno_result; +} + +word value(string x) +{ + const varying_string<15> hexdigits = "0123456789ABCDEF"; + word w; integer e; + + word value_result; + if (x[1]=='$') + { + w=0; + for( e=2; e <= length(x); e ++) + { + w=w << 4; + w += pos(upcase(x[e]),hexdigits)-1; + } + value_result=w; + } else + { + val(x,w,e); + if (e==0) value_result=w; else value_result=0; + } + return value_result; +} + +void ini_parse() +{ + upstr(inihead); + upstr(initail); + + if (inihead=="QUIET") soundfx=! yesno(); else + if (inihead=="ZOOMYSTART") zoomy=yesno(); else + if (inihead=="NUMLOCKHOLD") numlockhold=yesno(); else + if (inihead=="LOADFIRST") filetoload=initail; else + if (inihead=="OVERRIDEEGACHECK") cl_override=yesno(); else + if (inihead=="KEYBOARDCLICK") keyboardclick=yesno(); else + if (inihead=="JOYTOP") js.ymin=value(initail); else + if (inihead=="JOYBOTTOM") js.ymax=value(initail); else + if (inihead=="JOYLEFT") js.xmin=value(initail); else + if (inihead=="JOYRIGHT") js.xmax=value(initail); else + if (inihead=="JOYMIDX") js.xmid=value(initail); else + if (inihead=="JOYMIDY") js.ymid=value(initail); else + if (inihead=="JOYCENTRINGFACTOR") js.centre=value(initail); else + if (inihead=="WHICHJOY") use_joy_a=value(initail)==1; else + if (inihead=="SOUNDCARD") soundcard=card(initail); else + if (inihead=="BASEADDRESS") baseaddr=value(initail); else + if (inihead=="IRQ") irq=value(initail); else + if (inihead=="DMA") dma=value(initail); else + if (inihead=="SAMPLERATE") speed=value(initail); +} + +void strip_ini() +{ + byte fv; + + if (inihead=="") return; + + /* Firstly, delete any comments. */ + fv=pos(";",inihead); + if (fv>0) Delete(inihead,fv,255); + + /* Lose the whitespace... */ + + while (inihead[length(inihead)]==' ') inihead[0] -= 1; + while ((inihead!="") && (inihead[1]==' ')) Delete(inihead,1,1); + + /* It's possible that now we'll end up with a blank line. */ + + if ((inihead=="") || (inihead[1]=='[')) return; + + fv=pos("=",inihead); + + if (fv==0) + { /* No "="! Weird! */ + bugline=inihead; + linebug(bug_invalidini); + } + + initail=copy(inihead,fv+1,255); + inihead[0]=chr(fv-1); +} + +void load_ini() +{ + text ini; + + assign(ini,"AVALOT.INI"); + reset(ini); + + while (! eof(ini)) + { + ini >> inihead >> NL; + strip_ini(); + if (inihead!="") ini_parse(); + } + + close(ini); +} + +void parse(string x); +static string arg; + +static string getarg(string otherwis) +{ + string getarg_result; + if (arg=="") getarg_result=otherwis; else getarg_result=arg; + return getarg_result; +} + +void parse(string x) + +{ + switch (x[1]) { + case '/':case '-': { + arg=copy(x,3,255); + switch (upcase(x[2])) { + case '?': doing_syntax=true; break; + case 'O': cl_override=true; break; + case 'L': if (! usingp) + { + usingl=true; + argon=getarg("avvy.log"); + } else linebug(bug_pandl); + break; + case 'P': if (! usingl) + { + usingp=true; + argon=getarg("prn"); + } else linebug(bug_pandl); + break; + case 'Q': soundfx=false; break; + case 'Z': zoomy=true; break; + case 'K': keyboardclick=true; break; + case 'D': demo=true; break; + default: { + bugline=x; + linebug(bug_weirdswitch); + } + } + } + break; + case '*': { + inihead=copy(x,2,255); + strip_ini(); + if (inihead!="") ini_parse(); + } + break; + default: { /* filename */ + if (filename_specified) + linebug(bug_twonames); + else + filetoload=x; + filename_specified=true; + } + } +} + +void make_slopeline(); + +static char yn1(boolean b) +{ + char yn1_result; + if (b) yn1_result='y'; else yn1_result='n'; + return yn1_result; +} + + + +static char pln() +{ + char pln_result; + if ((! usingp) && (! usingl)) pln_result='n'; else + if (usingp) pln_result='p'; else + if (usingl) pln_result='l'; + return pln_result; +} + +void make_slopeline() + +{ + if (argon=="") argon="nul"; + + slopeline=string('1')+yn1(doing_syntax)+yn1(soundfx)+yn1(cl_override)+ + yn1(keyboardclick)+pln()+yn1(demo)+yn1(zoomy)+yn1(numlockhold)+ + yn1(use_joy_a)+ + ' '+strf(js.xmid)+ + ' '+strf(js.ymid)+ + ' '+strf(js.xmin)+ + ' '+strf(js.ymin)+ + ' '+strf(js.xmax)+ + ' '+strf(js.ymax)+ + ' '+strf(js.centre)+ + ' '+argon+' '+filetoload; +} + +void store_slopeline() +{ + move(slopeline,mem[storage_seg*storage_ofs+3],sizeof(slopeline)); + move(js,mem[storage_seg*storage_ofs+300],sizeof(js)); + move(soundcard,mem[storage_seg*storage_ofs+5000],4); + move(baseaddr,mem[storage_seg*storage_ofs+5004],4); + move(irq,mem[storage_seg*storage_ofs+5008],4); + move(dma,mem[storage_seg*storage_ofs+5012],4); + move(speed,mem[storage_seg*storage_ofs+5016],4); +} + +void get_storage_addr(); + +static void not_through_bootstrap() +{ output << "Not standalone!" << NL; exit(255); } + +void get_storage_addr() +{ + integer e; + + if (paramstr(1)!="jsb") not_through_bootstrap(); + val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); + val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + get_storage_addr(); + + filetoload=""; argon=""; + usingl=false; + usingp=false; + cl_override=false; + soundfx=true; + zoomy=false; + numlockhold=false; + filename_specified=false; + keyboardclick=false; + doing_syntax=false; + soundcard=0; baseaddr=0; irq=0; dma=0; + + load_ini(); + + for( fv=4; fv <= paramcount; fv ++) + parse(paramstr(fv)); + + make_slopeline(); + + store_slopeline(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp new file mode 100644 index 000000000000..57361e8b46ad --- /dev/null +++ b/engines/avalanche/spread.cpp @@ -0,0 +1,306 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +varying_string<3> sn; +adxtype a; +matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ +word bigsize; + +const array<0,15,varying_string<6> > col = + {{"Black","Blue","Green","Cyan","Red","Pink","Brown","Grey+", + "Grey-","Blue+","Green+","Cyan+","Red+","Pink+","Yellow","White"}}; +const string prompt = string('\32')+'\257'; + +void load() +{ + untyped_file f; byte gd,gm,sort,n; pointer p,q; +; + assign(f,string("v:sprite")+sn+".avd"); reset(f,1); seek(f,59); + blockread(f,a,sizeof(a)); blockread(f,bigsize,2); + setactivepage(3); + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); + blockread(f,p,bigsize); + putimage(0,0,p,0); release(q); n=1; + for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= a.seq-1; gd ++) /* steps */ + {; + getmem(pic[n][sort],a.size); /* grab the memory */ + getimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, + (gm / 2)*(a.xl*6)+gd*a.xl+a.xl-1,(gm % 2)*a.yl+a.yl-1, + pic[n][sort]); /* grab the pic */ + n += 1; + } + } + close(f); setactivepage(0); +} + +void save() +{ + untyped_file f; byte gd,gm,sort,n; pointer p,q; + string x; integer txl,tyl; +; + {; + txl=a.seq*a.xl*2; tyl=a.yl*2; + } + + assign(f,string("v:sprite")+sn+".avd"); + x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; + rewrite(f,1); blockwrite(f,x[1],59); + + blockwrite(f,a,sizeof(a)); blockwrite(f,bigsize,2); + setactivepage(3); + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); n=1; + for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= a.seq-1; gd ++) /* steps */ + {; + putimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, + pic[n][sort],0); /* drop the pic */ + n += 1; + } + getimage(0,0,txl,tyl,p); + blockwrite(f,p,bigsize); release(q); + } + close(f); setactivepage(0); +} + +void setup() +{ + integer gd,gm; +; + output << "SPREAD (c) 1992, Thomas Thurman." << NL; output << NL; + output << "Enter number of SPRITE*.AVD file to edit:"; input >> sn >> NL; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); +} + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void likethis() +{; + {; + setfillstyle(1,a.bgc); setcolor(a.fgc); settextstyle(0,0,1); + bar(0,190,100,200); outtextxy(12,191,"Like this!"); + } +} + +void values() +{ + byte fv; +; + settextstyle(2,0,9); setcolor(14); + outtextxy(277,0,string("Spread: editing ")+sn); setcolor(15); + for( fv=0; fv <= 3; fv ++) putimage(77+(a.xl+10)*fv,17,pic[a.seq*fv+1][1],0); + settextstyle(2,0,7); + outtextxy(0, 30,"Views:"); + {; + outtextxy(0, 50,string("N: Name: ")+a.name); + outtextxy(0, 70,string("No. of pictures: ")+strf(a.num)+" ("+strf(a.num / a.seq)+" ways)"); + outtextxy(0, 90,string("XY: Size: ")+strf(a.xl)+'x'+strf(a.yl)); + outtextxy(0,110,string("S: Stride size: ")+strf(a.seq)); + outtextxy(0,130,string("Imagesize (bytes): ")+strf(a.size)); + outtextxy(0,150,string("B: Bubble background: ")+col[a.bgc]); + outtextxy(0,170,string("F: Bubble foreground: ")+col[a.fgc]); + likethis(); + } + setcolor(lightgreen); settextstyle(0,0,1); + outtextxy(400,50,"A) Animate"); + outtextxy(400,60,"E) Edit pictures"); + outtextxy(400,70,"alt-f2) Save"); + outtextxy(400,80,"ctrl-f3) Load"); + outtextxy(400,90,"or any key to the left..."); +} + +byte ccol() +{ + byte fv; +byte ccol_result; +; + restorecrtmode(); + output << "Choose a colour- one of these..." << NL; + for( fv=0; fv <= 15; fv ++) + {; + textattr=14; output << fv << ") "; textattr=fv; output << string('\376')+'\40'; + textattr=14; output << col[fv] << NL; + } + textattr=14; + do { + output << prompt; input >> fv >> NL; + } while (!(fv<16)); + ccol_result=fv; setgraphmode(0); +return ccol_result; +} + +string cstr(string oc) +{ + string x; +string cstr_result; +; + restorecrtmode(); + output << string("Old choice is: <")+oc+'>' << NL; + output << NL; + output << "(Anything after a semi-colon will not be displayed by the game, e.g. Avvy;Monk" << NL; + output << " will be displayed as Avvy.)" << NL; + output << NL; + output << string("New choice, Enter for no change, Space+Enter for a blank?")+prompt; input >> x >> NL; + if (x=="") cstr_result=oc; else if (x==' ') cstr_result=""; else cstr_result=x; + setgraphmode(0); +return cstr_result; +} + +longint cnum(longint on) +{ + string x; longint q; integer e; +longint cnum_result; +; + restorecrtmode(); + do { + output << "Old value is: " << on << '.' << NL; + output << string("New choice, or Enter for no change?")+prompt; input >> x >> NL; + if (x=="") + {; + e=0; /* must be OK here */ q=on; + } else val(x,q,e); + if (e!=0) output << x << " isn't a number, silly!" << NL; + } while (!(e==0)); + setgraphmode(0); cnum_result=q; +return cnum_result; +} + +void animate() +{ + byte facing,step,slow,fv; +; + cleardevice(); + settextstyle(0,0,2); setcolor(12); outtextxy(0,0,"Animate"); + settextstyle(0,0,1); setcolor(15); + outtextxy(0,20,"Enter = Turn, + = Faster, - = Slower, Esc = stop this."); + facing=0; step=1; slow=100; + do { + for( fv=0; fv <= 1; fv ++) + putimage(200*fv+177,77,pic[facing*a.seq+step][fv],4-fv*4); + if (keypressed()) + switch (upcase(readkey())) { + case '\15': {; + facing += 1; if (facing*a.seq>=a.num) facing=0; + } + break; + case '\33': {; cleardevice(); return; } break; + case '+': if (slow>0) slow -= 5; break; + case '-': if (slow<255) slow += 5; break; default: output << '\7'; + } + step += 1; if (step>a.seq) step=1; + delay(slow); + } while (!false); +} + +byte tabpel(integer x,integer y) +{byte tabpel_result; +; + if (getpixel(400+x,17+y)==15) tabpel_result=17; + else tabpel_result=getpixel(500+x,17+y); +return tabpel_result; +} + +void bigpixel(integer x,integer y, byte size,byte col) +{; + if (col==17) setfillstyle(9,8); else setfillstyle(1,col); + bar(x*size,y*size,x*size+size-2,y*size+size-2); +} + +void blowup(byte n) +{ + byte fv,x,y,xyl; +; + {; + for( fv=0; fv <= 1; fv ++) putimage(400+fv*100,17,pic[n][fv],0); + xyl=200 / a.yl; + for( x=0; x <= a.xl; x ++) + for( y=0; y <= a.yl; y ++) + bigpixel(x,y,xyl,tabpel(x,y)); + } +} + +void edit(); + +static void putnum(byte x,byte p) +{ + varying_string<2> z; +; + str(x,z); outtextxy(x*53+17,87,z); putimage(x*53,100,pic[p][1],0); +} + + +static void title() +{; + cleardevice(); setcolor(11); settextstyle(0,0,2); + outtextxy(0,0,"Edit- which one?"); settextstyle(0,0,1); setcolor(15); +} + +void edit() +{ + byte fv,ra,rb; +; + {; + title(); for( fv=1; fv <= (a.num / a.seq); fv ++) putnum(fv,fv*a.seq); + do { ra=ord(readkey())-48; } while (!(ra<(a.num / a.seq))); ra -= 1; + title(); for( fv=1; fv <= a.seq; fv ++) putnum(fv,ra*a.seq+fv); + do { rb=ord(readkey())-48; } while (!(rb> NL; + cleardevice(); + } +} + +void pickone() +{ + char r; +; + r=upcase(readkey()); + switch (r) { + case 'N': a.name=cstr(a.name); break; + case 'S': a.seq=cnum(a.seq); break; + case 'F': a.fgc=ccol(); break; + case 'B': a.bgc=ccol(); break; + case 'A': animate(); break; + case 'E': edit(); break; + case '\0': switch (readkey()) { + case 'i': save(); break; /* alt-f2 */ + } + break; + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup(); + do { + values(); + pickone(); + } while (!false); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp new file mode 100644 index 000000000000..96545c2bc822 --- /dev/null +++ b/engines/avalanche/spread2.cpp @@ -0,0 +1,855 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Squeak.h"*/ + +/*$V-,R+*/ + +const integer pattern = 12; /* Pattern for transparencies. */ +const fillpatterntype grey50 = {{0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0x55, 0xaa, 0x55}}; + +struct adxtype { + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +}; + +untyped_file sf; +adxtype a; +char r; +boolean adxmodi,picmodi; +array<5,2053,byte> mani; +matrix<0,99,0,10,byte> sil; +array<1,16000,byte> aa; +word soa; +byte xw; +byte leftc,rightc; +boolean lmo; +array<1,2,pointer> clip; +integer clipx,clipy; +boolean boardfull; +integer xofs,yofs; /* Distance of TL corner of cut from TL corner of pic. */ + +byte bigpix_size,bigpix_gap; /* Size & gap betwixt big pixels. */ + +void setup() +{ + const integer shouldid = -1317732048; + boolean ok; + longint id; + varying_string<2> sn; +; + output << "Sprite Editor 2 (c) 1993, Thomas Thurman." << NL; + bigpix_size=3; bigpix_gap=5; + do { + ok=true; + output << "Number of sprite?"; input >> sn >> NL; + assign(sf,string("v:\\sprite")+sn+".avd"); + reset(sf,1); + seek(sf,177); + blockread(sf,id,4); + if (id!=shouldid) + {; + output << "That isn't a valid Trip5 spritefile." << NL; + output << "Please choose another." << NL; + output << NL; + ok=false; close(sf); + } else + {; + blockread(sf,soa,2); + if (soa!=(cardinal)sizeof(a)) /* to change this, just change the "type adx=" bit.*/ + {; + output << "That spritefile contains an unknown ADX field type." << NL; + output << "Please choose another." << NL; + output << NL; + ok=false; close(sf); + } + } + } while (!ok); + blockread(sf,a,soa); + output << filepos(sf) << NL; + adxmodi=false; picmodi=false; + getmem(clip[1],a.size); getmem(clip[2],a.size); boardfull=false; +} + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void centre(byte y, string z) +{; + gotoxy(40-length(z) / 2,y); output << z; +} + +void info(byte x,byte y, string p,string q) +{; + gotoxy(x,y); + textattr=6; output << p+":"; + textattr=11; output << q; + textattr=8; output << ''; +} + +void colours(byte f,byte b) +{; + gotoxy(35,11); + textattr=6; + output << "Bubbles"; + textattr=b*16+f; + output << " like this! "; +} + +void adxinfo() +{; + {; + info( 5, 8,"Name",a.name); + info(35, 8,"Comment",a.comment); + info( 5, 9,"Width",strf(a.xl)); + info(15, 9,"Height",strf(a.yl)); + info(35, 9,"Size of one pic",strf(a.size)); + info( 5,10,"Number in a stride",strf(a.seq)); + info(35,10,"Number of strides",strf(a.num / a.seq)); + info( 5,11,"Total number",strf(a.num)); + info( 5,12,"Acci number",strf(a.accinum)); + colours(a.fgc,a.bgc); + } +} + +void status() +{; + textattr=7; + clrscr; + textattr=10; centre(3,"Sprite Editor 2 (c) 1993, Thomas Thurman."); + textattr=6; gotoxy(3,7); output << "ADX information:"; + adxinfo(); + textattr=6; + gotoxy(3,14); output << "Options:"; + gotoxy(5,15); output << "A) edit ADX information"; + gotoxy(5,16); output << "P) edit pictures"; + gotoxy(5,17); output << "S) save the ADX info (pics are saved automatically)"; +} + +void enterstring(string w, byte l, string& q) +{ + string t; +; + textattr=13; clrscr; + output << NL; + output << "Press Return for no change, Space+Return for a blank." << NL; + do { + output << "New value for " << w << " (max length " << l << ")?"; + input >> t >> NL; + } while (!(length(t)<=l)); + if (t==' ') q=""; else if (t!="") q=t; + adxmodi=true; +} + +void entercolour(string w, byte& c); +static byte fv; + +static void loseold() {; output << string('\10')+'\377'; } + + +static void drawnew() {; gotoxy(3+fv*5,11); output << '\30'; } + +void entercolour(string w, byte& c) +{; + textattr=13; clrscr; + output << NL; output << "New value for " << w << '?' << NL; + output << " Use \32\33 to move about, Enter=OK, Esc=Cancel." << NL; + for( fv=1; fv <= 15; fv ++) + {; + gotoxy(3+fv*5,10); textattr=fv; output << ''; + } + fv=c; + do { + drawnew(); + r=readkey(); + switch (r) { + case '\33': return; break; /* no change to c */ + case '\15': {; + c=fv; adxmodi=true; + return; + } + break; + case '\0': switch (readkey()) { + case 'G': {; loseold(); fv= 0; drawnew(); } break; /* home */ + case 'O': {; loseold(); fv=15; drawnew(); } break; /* end */ + case 'K': if (fv> 0) {; loseold(); fv -= 1; drawnew(); } break; /* left */ + case 'M': if (fv<15) {; loseold(); fv += 1; drawnew(); } break; /* right */ + } + break; + } + } while (!false); +} + +void enternum(string w, byte& q) +{ + string t; integer e; byte r; +; + textattr=13; clrscr; + output << NL; + output << "Press Return for no change." << NL; + do { + output << "New value for " << w << '?'; + input >> t >> NL; + if (t=="") return; /* No change... */ + val(t,r,e); + } while (!(e==0)); + q=r; /* Update variable. */ + adxmodi=true; +} + +void editadx() +{ + char r; +; + do { + clrscr; + textattr=10; centre(3,"ADX Editor:"); + textattr= 9; centre(5,"N: Name, C: Comment, F: Foreground, B: Background, A: Accinum, X: eXit."); + adxinfo(); + r=upcase(readkey()); + switch (r) { + case 'N': enterstring("Name",12,a.name); break; + case 'C': enterstring("Comment",16,a.comment); break; + case 'F': entercolour("Foreground",a.fgc); break; + case 'B': entercolour("Background",a.bgc); break; + case 'A': enternum("Accinum",a.accinum); break; + case 'X':case '\33': return; break; + default: output << '\7'; + } + } while (!false); +} + +void saveit() +{ + char pak; + integer oldsoa; +; + textattr=10; clrscr; + centre(7,"Saving!"); + if (adxmodi) + {; + centre(10,"ADX information being saved..."); + seek(sf,181); /* start of ADX info */ + soa=sizeof(a); + blockread(sf,oldsoa,2); +/* if soa=oldsoa then + begin;*/ + seek(sf,181); + blockwrite(sf,soa,2); + blockwrite(sf,a,soa); + adxmodi=false; +/* end else write(#7);*/ + } else centre(10,"No changes were made to ADX..."); + centre(25,"Press any key..."); pak=readkey(); +} + +void quit() +{; + close(sf); + exit(0); +} + +void getsilmani() /* Reclaims original sil & mani arrays */ +{ + byte x,y,z; word offs; +; + + /* Sil... */ + + getimage(500,150,500+a.xl,150+a.yl,aa); + + for( x=0; x <= 3; x ++) + for( y=0; y <= a.yl; y ++) + for( z=0; z <= (a.xl / 8); z ++) + {; + offs=5+y*xw*4+xw*x+z; + sil[y][z]=aa[offs]; + } + + /* ...Mani. */ + + getimage(500,50,500+a.xl,50+a.yl,aa); + + move(aa[5],mani,sizeof(mani)); + +} + +void explode(byte which) /* 0 is the first one! */ + /* Each character takes five-quarters of (a.size-6) on disk. */ +{ + byte fv,ff; word so1; /* size of one */ +; + {; + so1=a.size-6; so1 += so1 / 4; + seek(sf,183+soa+so1*which); /* First is at 221 */ +/* where:=filepos(sf);*/ + xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; + + for( fv=0; fv <= a.yl; fv ++) + blockread(sf,sil[fv],xw); + blockread(sf,mani,a.size-6); + aa[a.size-1]=0; aa[a.size]=0; /* footer */ + } +} + +void implode(byte which) /* Writes a pic back onto the disk */ +{ + byte fv,ff; word so1; /* size of one */ +; + {; + + getsilmani(); /* Restore original arrays */ + + so1=a.size-6; so1 += so1 / 4; + seek(sf,183+soa+so1*which); /* First is at 221 */ + + xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; + + for( fv=0; fv <= a.yl; fv ++) + blockwrite(sf,sil[fv],xw); + blockwrite(sf,mani,a.size-6); + aa[a.size-1]=0; aa[a.size]=0; /* footer */ + } +} + +void plotat(integer xx,integer yy) /* Does NOT cameo the picture!*/ +{; + move(mani,aa[5],sizeof(mani)); + {; + aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ + } + putimage(xx,yy,aa,0); +} + +void plotsil(integer xx,integer yy) /* Plots silhouette- rarely used */ +{ + byte x,y,z; word offs; +; + for( x=0; x <= 3; x ++) + for( y=0; y <= a.yl; y ++) + for( z=0; z <= (a.xl / 8); z ++) + {; + offs=5+y*xw*4+xw*x+z; + aa[offs]=sil[y][z]; + } + + {; + aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ + } + + putimage(xx,yy,aa,0); + +} + +void style(byte x) +{; + if (x==16) + /*setfillstyle(pattern,8)*/setfillpattern(grey50,8); + else + setfillstyle(1,x); +} + +void bigpixel(integer x,integer y) +{; + if (getpixel(500+x,150+y)==15) + /*setfillstyle(pattern,8)*/setfillpattern(grey50,8); + else + setfillstyle(1,getpixel(500+x,50+y)); + + bar(x*bigpix_gap,y*bigpix_gap, + x*bigpix_gap+bigpix_size,y*bigpix_gap+bigpix_size); +} + +void subplot(byte y, integer x, char c) +{; + setfillstyle(1,0); bar(x,0,x+9,170); outtextxy(x+5,y*10+5,c); +} + +void plotleft() {; subplot( leftc,239,'\32'); } /* palette arrows */ +void plotright() {; subplot(rightc,351,'\33'); } + +void plotbig(byte x,byte y,byte c) +{; + style(c); + bar(x*bigpix_gap,y*bigpix_gap, + x*bigpix_gap+bigpix_size,y*bigpix_gap+bigpix_size); + if (c==16) + {; + putpixel(500+x,150+y,15); + putpixel(500+x, 50+y,0); + } else + {; + putpixel(500+x,150+y,0); + putpixel(500+x, 50+y,c); + } +} + +void changepic() +{; + mx=mx / bigpix_gap; my=my / bigpix_gap; + if ((mx>a.xl) || (my>a.yl)) return; + if (mkey==left) + plotbig(mx,my,leftc); else + plotbig(mx,my,rightc); +} + +void changecol() +{; + my=my / 10; if (my>16) return; + if (mkey==left) + {; + leftc=my; plotleft(); + } else + {; + rightc=my; plotright(); + } +} + +void showcutpic() +{; + setfillstyle(5,1); bar(20,160,40+clipx,180+clipy); + putimage(30,170,clip[2],andput); + putimage(30,170,clip[1],xorput); +} + +void movesquare(integer& xc,integer& yc, integer xl,integer yl) +{ + integer x2,y2; +; + do { + x2=xl+xc; y2=yl+yc; + setcolor(15); + do { + rectangle(xc*bigpix_gap-1,yc*bigpix_gap-1, + x2*(bigpix_gap+1)-1,y2*(bigpix_gap+1)-1); + } while (!keypressed()); + setcolor(0); rectangle(xc*bigpix_gap-1,yc*bigpix_gap-1, + x2*(bigpix_gap+1)-1,y2*(bigpix_gap+1)-1); + switch (readkey()) { + case '\0': switch (readkey()) { + case '\110': yc -= 1; break; + case '\113': xc -= 1; break; + case '\115': xc += 1; break; + case '\120': yc += 1; break; + } + break; + case '\15': return; break; + } + while ((xl+xc)>a.xl) xc -= 1; + while ((yl+yc)>a.yl) yc -= 1; + if (xc<0) xc=0; + if (yc<0) yc=0; + } while (!false); +} + +void switch_(integer& v1,integer& v2) + /* Swaps over the values of v1 and v2. */ +{ + integer temp; +; + temp=v1; v1=v2; v2=temp; +} + +void choosesquare(integer& x1,integer& y1,integer& x2,integer& y2) +{ + boolean tl; +; + do { + setcolor(15); + do { + rectangle(x1*bigpix_gap-1,y1*bigpix_gap-1, + (x2+1)*bigpix_gap-1,(y2+1)*bigpix_gap-1); + } while (!keypressed()); + setcolor(0); + rectangle(x1*bigpix_gap-1,y1*bigpix_gap-1, + (x2+1)*bigpix_gap-1,(y2+1)*bigpix_gap-1); + switch (readkey()) { + case '\0': switch (readkey()) { + case '\110': if (tl) y1 -= 1; else y2 -= 1; break; + case '\113': if (tl) x1 -= 1; else x2 -= 1; break; + case '\115': if (tl) x1 += 1; else x2 += 1; break; + case '\120': if (tl) y1 += 1; else y2 += 1; break; + } + break; + case '\11': tl=! tl; break; + case '\15': {; + if (x1>x2) switch_(x1,x2); /* Get the square the right way up. */ + if (y1>y2) switch_(y1,y2); + y2 -= y1; x2 -= x1; /* y1 & y2 have to be the OFFSETS! */ + return; + } + break; + } + if (x1<0) x1=0; if (y1<0) y1=0; + {; + if (y2>a.yl) y2=a.yl; if (x2>a.xl) x2=a.xl; + } + } while (!false); +} + +void paste() +{ + byte x,y; +; + if (! boardfull) + {; + output << '\7'; + return; + } + if (! ((clipx==a.xl) && (clipy==a.yl))) + movesquare(xofs,yofs,clipx,clipy); + putimage(500+xofs, 50+yofs,clip[1],0); + putimage(500+xofs,150+yofs,clip[2],0); + for( x=0; x <= a.xl; x ++) + for( y=0; y <= a.yl; y ++) + {; + bigpixel(x,y); + } +} + +void cut() +{; + xofs=0; yofs=0; /* From the TL. */ + {; + getimage(500, 50,500+a.xl, 50+a.yl,clip[1]); + getimage(500,150,500+a.xl,150+a.yl,clip[2]); + clipx=a.xl; clipy=a.yl; + } + showcutpic(); + boardfull=true; +} + +void cutsome() +{; + {; + choosesquare(xofs,yofs,clipx,clipy); + getimage(500+xofs, 50+yofs,500+xofs+clipx, 50+yofs+clipy,clip[1]); + getimage(500+xofs,150+yofs,500+xofs+clipx,150+yofs+clipy,clip[2]); + } + showcutpic(); + boardfull=true; +} + +boolean confirm(char c, string x) +{ + byte col; char groi; +boolean confirm_result; +; + while (keypressed()) groi=readkey(); + x=x+"? "+c+" to confirm."; + col=1; + do { + setcolor(col); outtextxy(555,5,x); + col += 1; if (col==16) col=1; + } while (!keypressed()); + confirm_result=upcase(readkey())==c; + setfillstyle(1,0); bar(470,0,640,10); +return confirm_result; +} + +void checkbutton(byte which) +{; + my=(my-12) / 25; + switch (my) { + case 0: if (confirm('S',"Save")) {; implode(which); lmo=true; } break; + case 1: if (confirm('C',"Cancel")) lmo=true; break; + case 4: cut(); break; + case 5: if (confirm('P',"Paste")) paste(); break; + case 6: cutsome(); break; + } +} + +void animate() +{; +} + +void undo() +{; +} + +void fliplr(); + +static void flipline(integer x1,integer x2,integer y) +{ + integer fv,ff; +; + for( fv=x1; fv <= x2; fv ++) putpixel(fv,0,getpixel(fv,y)); + ff=x2; + for( fv=x1; fv <= x2; fv ++) + {; + putpixel(fv,y,getpixel(ff,0)); + ff -= 1; + } +} + +void fliplr() /* Flips left-to-right. */ +{ + integer fv,ff; +; + for( fv=0; fv <= a.yl; fv ++) + {; + flipline(500,500+a.xl, 50+fv); + flipline(500,500+a.xl,150+fv); + } + for( fv=0; fv <= a.xl; fv ++) + for( ff=0; ff <= a.yl; ff ++) + bigpixel(fv,ff); +} + +void change_colours() /* Swaps one colour with another. */ +{ + byte fv,ff; +; + + if ((leftc==16) || (rightc==16)) /* See-through can't be one of the colours. */ + {; + output << '\7'; /* Bleep! */ + return; + } + + for( fv=0; fv <= a.yl; fv ++) + for( ff=0; ff <= a.xl; ff ++) + if (getpixel(500+ff,50+fv)==leftc) + putpixel(500+ff,50+fv,rightc); + + for( fv=0; fv <= a.xl; fv ++) + for( ff=0; ff <= a.yl; ff ++) + bigpixel(fv,ff); +} + +void redraw() +{ + byte x,y; +; + setfillstyle(1,0); + bar(0,0,250,200); + + for( x=0; x <= a.xl; x ++) + for( y=0; y <= a.yl; y ++) + {; + bigpixel(x,y); + } +} + +void parse(char c) /* Parses keystrokes */ +{; + switch (upcase(c)) { + case '\26':case 'P': paste(); break; + case '\3':case 'C': cut(); break; + case '\30':case 'X': cutsome(); break; + case 'A': animate(); break; + case 'U': undo(); break; + case '@': fliplr(); break; + case '!': change_colours(); break; + case '<': if (bigpix_size>1) + {; + bigpix_size -= 1; bigpix_gap -= 1; + redraw(); + } + break; + case '>': if (bigpix_size<8) + {; + bigpix_size += 1; bigpix_gap += 1; + redraw(); + } + break; + case '\33': if (confirm('X',"Exit")) lmo=true; break; + } +} + +void editone(byte which) +{ + byte x,y; +; + cleardevice(); + explode(which); + plotat(500,50); + plotsil(500,150); + for( x=0; x <= a.xl; x ++) + for( y=0; y <= a.yl; y ++) + {; + bigpixel(x,y); + } + for( y=0; y <= 16; y ++) + {; + style(y); + bar(251,y*10+1,349,y*10+9); + rectangle(250,y*10,350,y*10+10); + } + + settextstyle(0,0,1); leftc=15; rightc=16; plotleft(); plotright(); lmo=false; + + outtextxy(410, 25,"Save"); + outtextxy(410, 50,"Cancel"); + outtextxy(410, 75,"Animate"); + outtextxy(410,100,"Undo"); + outtextxy(410,125,"Cut"); + outtextxy(410,150,"Paste"); + outtextxy(410,175,"X: Cut Some"); + if (boardfull) showcutpic(); + setfillstyle(6,15); + for( y=0; y <= 7; y ++) + bar(370,y*25+12,450,y*25+12); + + do { + on; + do { + if (keypressed()) parse(readkey()); + } while (!(anyo | lmo)); + off; + + if (! lmo) + {; + getbuttonstatus; + + switch (mx) { + case 1 ... 249: changepic(); break; + case 250 ... 350: changecol(); break; + case 370 ... 450: checkbutton(which); break; + } + } + } while (!lmo); + settextstyle(2,0,7); setcolor(15); +} + +void editstride(byte which); + +static char whichc; + +static shortint first; + +static void drawup(byte& which) +{ + byte fv; +; + whichc=chr(which+48); + cleardevice(); + outtextxy(320,10,string("Edit stride ")+whichc); + first=(which-1)*a.seq-1; + for( fv=1; fv <= a.seq; fv ++) + {; + explode(fv+first); + plotat(fv*73,77); + outtextxy(17+fv*73,64,chr(fv+48)); + } + outtextxy(320,177,"Which?"); +} + +void editstride(byte which) +{ + char r; +; + drawup(which); + do { + r=readkey(); + if ((r>'0') && (r<=chr(a.seq+48))) + {; + editone(ord(r)-48+first); + drawup(which); + } + } while (!(r=='\33')); +} + +void editpics(); + +static byte nds; /* num div seq */ + +static void drawup1() +{ + byte fv; +; + setgraphmode(0); directvideo=false; settextjustify(1,1); + nds=a.num / a.seq; + settextstyle(2,0,7); + outtextxy(320,10,"Edit pictures..."); + outtextxy(320,40,"(Usually, 1=away, 2=right, 3=towards, 4=left.)"); + for( fv=1; fv <= nds; fv ++) + {; + explode((fv-1)*a.seq); + plotat(fv*73,100); + outtextxy(17+fv*73,87,chr(fv+48)); + } + outtextxy(320,60,string("There are ")+strf(nds)+" strides available."); + outtextxy(320,177,"Which do you want?"); +} + +void editpics() +{ + char r; byte which; integer e; +; + drawup1(); + do { + r=readkey(); + if ((r>'0') && (r<=chr(nds+48))) + {; + editstride(ord(r)-48); + drawup1(); + } + } while (!(r=='\33')); + restorecrtmode(); +} + +void titles() +{ + integer gd,gm; + char pak; word wait; +; + gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); + settextstyle(5,0,10); settextjustify(1,1); + gm=getmaxy() / 2; wait=0; + do { + for( gm=0; gm <= 15; gm ++) + {; + setcolor(15-gm); + for( gd=0; gd <= (150-gm*10); gd ++) + {; + outtextxy(320,124-gd,"Spread 2"); + outtextxy(320,125+gd,"Spread 2"); + if ((gd==5) && (gm==0)) wait=2345; + if ((gd==6) && (gm==0)) wait=0; + do { + if (keypressed()) + {; + while (keypressed()) pak=readkey(); + restorecrtmode(); + return; + } + if (wait>0) {; wait -= 1; delay(1); } + } while (!(wait==0)); + } + } + } while (!false); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + titles(); + setup(); + do { + status(); + r=upcase(readkey()); + switch (r) { + case 'A': editadx(); break; + case 'P': editpics(); break; + case 'S': saveit(); break; + case 'X':case '\33': quit(); break; + } + } while (!false); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp new file mode 100644 index 000000000000..4f8cad4f550c --- /dev/null +++ b/engines/avalanche/squish.cpp @@ -0,0 +1,455 @@ +#include "ptoc.h" + + + +/* This is the first version. Thanks to Pib. */ + +/*--------------------------------------------------------------------------*/ +/* */ +/* Global declarations for PIBLZW */ +/* */ +/*--------------------------------------------------------------------------*/ + +const integer maxbuff = 8192 /* Buffer size for input and output files */; +const integer maxtab = 4095 /* Table size - 1 ==> 2**10-1 ==> 12 bits */; +const integer no_prev = 0x7fff /* Special code for no previous character */; +const integer eof_char = -2 /* Marks end of file */; +const integer end_list = -1 /* Marks end of a list */; +const integer empty = -3 /* Indicates empty */; + +typedef varying_string<255> anystr/* General string type */; + + /* One node in parsing table. */ +struct string_table_entry { + boolean used /* Is this node used yet? */; + integer prevchar /* Code for preceding string */; + integer follchar /* Code for current character */; + integer next /* Next dupl in collision list */; +}; + +untyped_file input_file /* Input file */; +untyped_file output_file /* Output file */; + +integer inbufsize /* Count of chars in input buffer */; + +array<1,maxbuff,byte> input_buffer /* Input buffer area */; +array<1,maxbuff,byte> output_buffer /* Output buffer area */; + +integer input_pos /* Cur. pos. in input buffer */; +integer output_pos /* Cur. pos. in output buffer */; + + /* String table */ + +array<0,maxtab,string_table_entry> string_table; + +integer table_used /* # string table entries used */; +integer output_code /* Output compressed code */; +integer input_code /* Input compressed code */; +boolean if_compressing /* TRUE if compressing file */; +integer ierr /* Input/output error */; + +string header; varying_string<30> describe; byte method; + +void terminate() + +{ /* Terminate */ + /* Write any remaining characters */ + /* to output file. */ + if ( output_pos > 0 ) + blockwrite( output_file, output_buffer, output_pos ); + + ierr = ioresult; + /* Close input and output files */ + close( input_file ); + ierr = ioresult; + + close( output_file ); + ierr = ioresult; + + output << "done." << NL; + +} /* Terminate */ + +/*--------------------------------------------------------------------------*/ +/* Get_Hash_Code --- Gets hash code for given C string */ +/*--------------------------------------------------------------------------*/ + +integer get_hash_code( integer prevc, integer follc ) + +{ + integer index; + integer index2; + + /* Get_Hash_Code */ + /* Get initial index using hashing */ + + integer get_hash_code_result; + index = ( ( prevc << 5 ) ^ follc ) & maxtab; + + /* If entry not already used, return */ + /* its index as hash code for C. */ + + if ( ! string_table[index].used ) + get_hash_code_result = index; + else + /* If entry already used, search to */ + /* end of list of hash collision */ + /* entries for this hash code. */ + /* Do linear probe to find an */ + /* available slot. */ + { + + /* Skip to end of collision list ... */ + + while ( string_table[index].next != end_list ) + index = string_table[index].next; + + /* Begin linear probe down a bit from */ + /* last entry in collision list ... */ + + index2 = ( index + 101 ) & maxtab; + + /* Look for unused entry using linear */ + /* probing ... */ + + while ( string_table[index2].used ) + index2 = succ(integer, index2 ) & maxtab; + + /* Point prior end of collision list */ + /* to this new node. */ + + string_table[index].next = index2; + + /* Return hash code for C */ + + get_hash_code_result = index2; + + } + + return get_hash_code_result; +} /* Get_Hash_Code */ + +/*--------------------------------------------------------------------------*/ +/* Make_Table_Entry --- Enter C string in string table */ +/*--------------------------------------------------------------------------*/ + +void make_table_entry( integer prevc, integer follc ) + +{ /* Make_Table_Entry */ + /* Only enter string if there is room left */ + + if ( table_used <= maxtab ) + { + { + string_table_entry& with = string_table[ get_hash_code( prevc , follc ) ]; + + with.used = true; + with.next = end_list; + with.prevchar = prevc; + with.follchar = follc; + } + /* Increment count of items used */ + + table_used += 1; +/* + IF ( Table_Used > ( MaxTab + 1 ) ) THEN + BEGIN + WRITELN('Hash table full.'); + END; +*/ + } + +} /* Make_Table_Entry */ + +/*--------------------------------------------------------------------------*/ +/* Initialize_String_Table --- Initialize string table */ +/*--------------------------------------------------------------------------*/ + +void initialize_string_table() + +{ + integer i; + + /* Initialize_String_Table */ + + /* No entries used in table yet */ + table_used = 0; + /* Clear all table entries */ + for( i = 0; i <= maxtab; i ++) + { + string_table_entry& with = string_table[i]; + + with.prevchar = no_prev; + with.follchar = no_prev; + with.next = -1; + with.used = false; + } + /* Enter all single characters into */ + /* table */ + for( i = 0; i <= 255; i ++) + make_table_entry( no_prev , i ); + +} /* Initialize_String_Table */ + +/*--------------------------------------------------------------------------*/ +/* Initialize --- Initialize compression/decompression */ +/*--------------------------------------------------------------------------*/ + +void initialize() + +{ + anystr input_name /* Input file name */; + anystr output_name /* Output file name */; + + /* Initialize */ + + output << "Number of file to compress:"; input >> input_name >> NL; + output << "For the moment, I'm writing the compressed version to v:compr" << + input_name << ".avd." << NL; + output_name=string("d:compr")+input_name+".avd"; + input_name=string("d:place")+input_name+".avd"; + + output << "Wait... "; + + /* Open input file */ + + assign ( input_file , input_name ); + reset ( input_file , 1 ); + ierr = ioresult; + + blockread(input_file,header,146); + blockread(input_file,describe,30); + blockread(input_file,method,1); + + if (method==177) + {; + output << "It's already compressed!" << NL; + exit(177); + } + + /* Open output file */ + + assign ( output_file , output_name ); + rewrite( output_file , 1 ); + ierr = ioresult; + + method=177; + + blockwrite(output_file,header,146); + blockwrite(output_file,describe,30); + blockwrite(output_file,method,1); + + /* Point input point past end of */ + /* buffer to force initial read */ + input_pos = maxbuff + 1; + /* Nothing written out yet */ + output_pos = 0; + /* Nothing read in yet */ + inbufsize = 0; + /* No input or output codes yet */ + /* constructed */ + output_code = empty; + input_code = empty; + /* Initialize string hash table */ + initialize_string_table(); + +} /* Initialize */ + +/*--------------------------------------------------------------------------*/ +/* Lookup_String --- Look for string C in string table */ +/*--------------------------------------------------------------------------*/ + +integer lookup_string( integer prevc, integer follc ) + +{ + integer index; + integer index2; + boolean found; + + /* Lookup_String */ + /* Initialize index to check from hash */ + + integer lookup_string_result; + index = ( ( prevc << 5 ) ^ follc ) & maxtab; + + /* Assume we won't find string */ + lookup_string_result = end_list; + /* Search through list of hash collision */ + /* entries for one that matches C */ + do { + + found = ( string_table[index].prevchar == prevc ) && + ( string_table[index].follchar == follc ); + + if ( ! found ) + index = string_table[index].next; + + } while (!(found || ( index == end_list ))); + + /* Return index if C found in table. */ + if (found) + lookup_string_result = index; + + return lookup_string_result; +} /* Lookup_String */ + +/*--------------------------------------------------------------------------*/ +/* Get_Char --- Read character from input file */ +/*--------------------------------------------------------------------------*/ + +void get_char( integer& c ) + +{ /* Get_Char */ + /* Point to next character in buffer */ + input_pos += 1; + /* If past end of block read in, then */ + /* reset input pointer and read in */ + /* next block. */ + + if ( input_pos > inbufsize ) + { + blockread( input_file, input_buffer, maxbuff, inbufsize ); + input_pos = 1; + ierr = ioresult; + } + /* If end of file hit, return EOF_Char */ + /* otherwise return next character in */ + /* input buffer. */ + if ( inbufsize == 0 ) + c = eof_char; + else + c = input_buffer[input_pos]; + +} /* Get_Char */ + +/*--------------------------------------------------------------------------*/ +/* Write_Char --- Write character to output file */ +/*--------------------------------------------------------------------------*/ + +void put_char( integer c ) + +{ /* Put_Char */ + /* If buffer full, write it out and */ + /* reset output buffer pointer. */ + + if ( output_pos >= maxbuff ) + { + blockwrite( output_file, output_buffer, maxbuff ); + output_pos = 0; + ierr = ioresult; + } + /* Place character in next slot in */ + /* output buffer. */ + + output_pos += 1; + output_buffer[output_pos] = c; + +} /* Put_Char */ + +/*--------------------------------------------------------------------------*/ +/* Put_Code --- Write hash code to output file. */ +/*--------------------------------------------------------------------------*/ + +void put_code( integer hash_code ) + +{ /* Put_Code */ + /* Output code word is empty. */ + /* Put out 1st 8 bits of compression */ + /* code and save last 4 bit for next */ + /* time through. */ + + if ( output_code == empty ) + { + put_char( ( (cardinal)hash_code >> 4 ) & 0xff ); + output_code = hash_code & 0xf; + } + else + /* Output code word not empty. */ + /* Put out last 4 bits of previous */ + /* code appended to 1st 4 bits of this */ + /* code. Then put out last 8 bits of */ + /* this code. */ + { + put_char( ( ( output_code << 4 ) & 0xff0 ) + + ( ( (cardinal)hash_code >> 8 ) & 0xf ) ); + put_char( hash_code & 0xff ); + output_code = empty; + } + +} /* Put_Code */ + +/*--------------------------------------------------------------------------*/ +/* Do_Compression --- Perform Lempel-Ziv-Welch compression */ +/*--------------------------------------------------------------------------*/ + +void do_compression() + +{ + integer c /* Current input character = C */; + integer wc /* Hash code value for C */; + integer w /* Hash code value for */; + + /* Do_Compression */ + /* Read first character ==> Step 2 */ + get_char( c ); + /* Initial hash code -- first character */ + /* has no previous string ( is null) */ + + w = lookup_string( no_prev , c ); + + /* Get next character ==> Step 3 */ + get_char( c ); + /* Loop over input characters until */ + /* end of file reached ==> Step 4. */ + while( c != eof_char ) + { + /* See if C is in table. */ + + wc = lookup_string( w , c ); + + /* If C is not in the table, */ + /* enter it into the table and */ + /* output . Reset to */ + /* be the code for C ==> Step 6 */ + + if ( wc == end_list ) + { + + make_table_entry( w , c ); + put_code( w ); + w = lookup_string( no_prev , c ); + + } + else /* If C is in table, keep looking */ + /* for longer strings == Step 5 */ + + w = wc; + + /* Get next input character ==> Step 3 */ + get_char( c ); + + } + /* Make sure last code is */ + /* written out ==> Step 4. */ + put_code( w ); + +} /* Do_Compression */ + +/*--------------------------------------------------------------------------*/ +/* PibCompr --- Main program */ +/*--------------------------------------------------------------------------*/ + +int main(int argc, const char* argv[]) +{ /* PibCompr */ + /* We are doing compression */ + pio_initialize(argc, argv); + if_compressing = true; + /* Initialize compression */ + initialize(); + /* Perform compression */ + do_compression(); + /* Clean up and exit */ + terminate(); + + return EXIT_SUCCESS; +} /* PibCompr */ diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp new file mode 100644 index 000000000000..670d12cf1dec --- /dev/null +++ b/engines/avalanche/ss_blank.cpp @@ -0,0 +1,38 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ + +byte fv; +boolean test; + +boolean the_cows_come_home() +{ + registers rmove,rclick; +boolean the_cows_come_home_result; +; + rmove.ax=11; intr(0x33,rmove); + rclick.ax=3; intr(0x33,rclick); + the_cows_come_home_result= + (keypressed()) | /* key pressed */ + (rmove.cx>0) || /* mouse moved */ + (rmove.dx>0) || + (rclick.bx>0); /* button clicked */ +return the_cows_come_home_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + test=the_cows_come_home(); + textattr=0; clrscr; + do {; } while (!the_cows_come_home()); + textattr=30; clrscr; + output << "*** Blank Screen *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; + for( fv=1; fv <= 46; fv ++) output << '~'; output << NL; + output << "This program may be freely copied." << NL; + output << NL; + output << "Have fun!" << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp new file mode 100644 index 000000000000..1880ee5c06a1 --- /dev/null +++ b/engines/avalanche/ss_clock.cpp @@ -0,0 +1,84 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ +/*#include "Crt.h"*/ +#include "graph.h" +/*#include "Drivers.h"*/ + + +const integer width = 88; +const integer height = 8; /* width & height of string returned by "time" */ + +integer gd,gm; +integer xx,yy; +shortint ix,iy; +byte cp; +byte count; +array<0,1,pointtype> pages; +boolean test; + +boolean the_cows_come_home() +{ + registers rmove,rclick; +boolean the_cows_come_home_result; +; + rmove.ax=11; intr(0x33,rmove); + rclick.ax=3; intr(0x33,rclick); + the_cows_come_home_result= + (keypressed()) || /* key pressed */ + (rmove.cx>0) || /* mouse moved */ + (rmove.dx>0) || + (rclick.bx>0); /* button clicked */ +return the_cows_come_home_result; +} + +string time1() +{ + word h,m,s,s1; varying_string<2> hh,mm,ss; char ampm; +string time1_result; +; + gettime(h,m,s,s1); + if (h<12) + ampm='a'; + else {; + ampm='p'; + if (h==0) h=12; else h -= 12; /* 24-hr adjustment */ + } + str(h,2,hh); str(m,2,mm); str(s,2,ss); /* stringify them */ + time1_result=hh+'.'+mm+'.'+ss+' '+ampm+'m'; +return time1_result; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + test=the_cows_come_home(); + gm=registerbgidriver(&egavgadriverproc); + gd=3; gm=1; initgraph(gd,gm,""); + ix=3; iy=1; xx=177; yy=177; setcolor(11); cp=0; + setfillstyle(1,0); count=2; + do { + setactivepage(cp); setvisualpage(1-cp); cp=1-cp; + delay(20); if (count>0) count -= 1; + { + pointtype& with = pages[cp]; + ; + if (count==0) + bar(with.x,with.y,with.x+width,with.y+height); + with.x=xx; with.y=yy; /* update record for next time */ + } + outtextxy(xx,yy,time1()); + xx=xx+ix; yy=yy+iy; + if (xx<= 10) ix=Random(9)+1; if (xx>=629-width) ix=-Random(9)+1; + if (yy<= 10) iy=Random(9)+1; if (yy>=339-height) iy=-Random(9)+1; + } while (!the_cows_come_home()); + closegraph(); + textattr=30; clrscr; + output << "*** Bouncing Clock *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; + for( gd=1; gd <= 48; gd ++) output << '~'; output << NL; + output << "This program may be freely copied." << NL; + output << NL; + output << "Have fun!" << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp new file mode 100644 index 000000000000..309d9a4743fe --- /dev/null +++ b/engines/avalanche/stars.cpp @@ -0,0 +1,562 @@ +#include "ptoc.h" + + /* Demonstration of the Bigo II system. */ +/* $I c:\sleep5\DSMI.INC*/ +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Rodent.h"*/ +/*#include "Tommys.h"*/ + +integer gd,gm; + +typedef matrix<'\0','\377',0,15,byte> fonttype; + +boolean reverse; +word spinnum; +array<0,1,fonttype> f; +file ff; +array<0,7,0,15,0,79,byte> strip; +byte across; +word w; byte y; +byte charnum; +byte cfont; /* current font. 0=roman, 1=italic. */ + +char* c; + +boolean nomusic; + +const integer colours = 12; /* Run Workout to see possible values of these two. */ +const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ +const integer gmtop = 360 / steps; + + const integer scardcount = 13; + + const array<0,scardcount-1,integer> soundcards = + {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; + +/*$L credits.obj*/ extern void credits(); + +void bigo2(string date) +{ + integer gd,gm; + byte c; + palettetype p; + untyped_file f; pointer pp; word s; + + + getpalette(p); + setvisualpage(1); setactivepage(0); + assign(f,"logo.avd"); reset(f,1); + for( gd=7; gd <= 194; gd ++) + blockread(f,mem[0xa000*(gd*80)],53); + close(f); + s=imagesize(0,7,415,194); getmem(pp,s); getimage(0,7,415,194,pp); + + cleardevice(); + for( gd=1; gd <= 64; gd ++) + { + for( gm=0; gm <= gmtop; gm ++) + { + c=(c % colours)+1; +/* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, + trunc(cos(gm*steps*n)*gd*3)+175,c); */ + if (c>5) continue_; + setcolor(c); arc(320,175,gm*steps,gm*steps+1,gd*6); + } + if (keypressed()) { closegraph(); exit(0); } + } + settextstyle(0,0,1); setcolor(13); + outtextxy(550,343,"(press any key)"); + + putimage(112,0,pp,orput); freemem(pp,s); + resetmouse; setvisualpage(0); +} + +void nextchar() /* Sets up charnum & cline for the next character. */ +{ + + c += 1; +} + +void getchar() +{ + do { + nextchar(); + + switch (*c) { + case '@': { cfont=1; nextchar(); } break; + case '^': { cfont=0; nextchar(); } break; + case '%': if (nomusic) + { + closegraph(); exit(0); /* End of text and no music => stop. */ + } + else c=addr(credits()); + break; /* End of test, but still playing => again. */ + } + + } while (!((*c!='\15') && (*c!='\12'))); + + for( w=0; w <= 7; w ++) + for( y=0; y <= 15; y ++) + move(strip[w][y][1],strip[w][y][0],79); + + for( w=0; w <= 7; w ++) + for( y=0; y <= 15; y ++) + strip[w][y][79]=(byte)((strip[7][y][78] << (w+1)))+ + ((cardinal)f[cfont][*c][y] >> (7-w)); + + across=0; +} + +void scrolltext() +{ + byte c,w,y; + + across += 1; + if (across==8) getchar(); + + for( y=0; y <= 15; y ++) + for( w=0; w <= 1; w ++) + move(strip[across][y][0],mem[0xa000*24000+(y*2+w)*80],80); +} + +void do_stuff() +{ + switch (spinnum) { + case 50 ... 110: { + setfillstyle(1,14); + bar(0,315+(spinnum-50) / 3,640,315+(spinnum-50) / 3); + bar(0,316-(spinnum-50) / 3,640,316-(spinnum-50) / 3); + if (spinnum>56) + { + setfillstyle(1,13); + bar(0,315+(spinnum-56) / 3,640,315+(spinnum-56) / 3); + bar(0,316-(spinnum-56) / 3,640,316-(spinnum-56) / 3); + } + } + break; + case 150 ... 198: { + setfillstyle(1,0); + bar(0,315+(spinnum-150) / 3,640,315+(spinnum-150) / 3); + bar(0,316-(spinnum-150) / 3,640,316-(spinnum-150) / 3); + } + break; + case 200: scrolltext(); break; + } +} + +void setcol(byte which,byte what) +/*var dummy:byte;*/ +{; +/* setpalette(which,what); + asm +(* mov dx,$3DA; + in ax,dx; + + or ah,ah; + + mov dx,$3C0; + mov al,which; + out dx,al; + + mov dx,$3C0; + mov al,what; + out dx,al; + end; +(* dummy:=port[$3DA]; + port[$3C0]:=which; port[$3C0]:=what;*/ +} + +void bigo2go() +{ + palettetype p; byte c; boolean lmo; + boolean altnow,altbefore; + + for( gd=0; gd <= 13; gd ++) p.colors[gd]=0; + + setcol(13,24); /* murk */ setcol(14,38); /* gold */ + setcol(15,egawhite); /* white- of course */ + p.colors[13]=24; p.colors[14]=38; p.colors[15]=egawhite; + + /***/ + + p.colors[5]=egawhite; + p.colors[4]=egalightcyan; + p.colors[3]=egacyan; + p.colors[2]=egalightblue; + p.colors[1]=egablue; + + /***/ + + c=1; p.size=16; lmo=false; + setallpalette(p); + + do { +/* if reverse then + begin + dec(c); if c=0 then c:=colours; + end else + begin + inc(c); if c>colours then c:=1; + end; + for gm:=1 to colours do + case p.colors[gm] of + egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; + egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; + egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; + egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; + egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; + end; + p.colors[c]:=egaWhite; setcol(c,egaWhite); + + AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ + + if (anymousekeypressed) lmo=true; + if (keypressed()) lmo=true; + if ((! nomusic) && (ampgetmodulestatus != md_playing)) lmo=true; + + /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ + + do_stuff(); + if (spinnum<200) spinnum += 1; + } while (!lmo); +} + +void parse_cline() +{ + integer e; + + if (paramstr(1)!="jsb") + { + output << "Not a standalone program." << NL; exit(255); + } +} + +integer getsoundhardware(psoundcard scard) +{ + integer sc,i,autosel,select; + char ch; + integer e; + + + +integer getsoundhardware_result; +Lagain: + sc=detectgus(scard); + if (sc!=0) sc=detectpas(scard); + if (sc!=0) sc=detectaria(scard); + if (sc!=0) sc=detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); + + autosel=-1; +/* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13),select,e); + + /* Default entry? */ + if (select==0) select=autosel; + if (select!=autosel) { + /* clear all assumptions */ + sc=-1; + fillchar(scard,sizeof(tsoundcard),0); + scard->id=soundcards[select-1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id==id_dac) scard->ioport=0x378; + + /* Read user input */ + val(paramstr(15),i,e); + + if (i!=0) scard->ioport=i; + if (sc!=1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : scard->samplesize=2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: scard->stereo=true; + break; /* enable stereo */ + default: { + scard->samplesize=1; + scard->stereo=false; + } + } + + if (scard->id!=id_dac) { + val(paramstr(17),i,e); + + if (i!=0) scard->dmairq=i; + + val(paramstr(16),i,e); + + if (i!=0) scard->dmachannel=i; + } else { + /* Select correct DAC */ + scard->maxrate=44100; + if (select==11) { + scard->stereo=true; + scard->dmachannel=1; /* Special 'mark' */ + scard->maxrate=60000; + } else + if (select==12) { + scard->stereo=true; + scard->dmachannel=2; + scard->maxrate=60000; + if (scard->ioport==0) scard->ioport=0x378; + } else + if (select==13) { + scard->dmachannel=0; + scard->ioport=0x42; /* Special 'mark' */ + scard->maxrate=44100; + } + } + +/* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result=0; +return getsoundhardware_result; +} + +tsoundcard scard; +tmcpstruct mcpstrc; +tdds dds; +pmodule module; +tsdi_init sdi; +integer e, +bufsize; +char ch; +boolean v86, +vdsok; +longint a,rate, +tempseg; +string answer; +pointer temp; +word flags; +word curch; +byte modulevolume; +array<0,4,tsampleinfo> sample; +array<0,31,word> voltable; + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + parse_cline(); + + nomusic=paramstr(13)=='0'; + + if (! nomusic) + { + /* Read sound card information */ + if (getsoundhardware(&scard)==-1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id==id_gus) { + /* Initialize GUS player */ + #ifndef DPMI + scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ + #endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus,0,31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt,gus_timer); + } else { + /* Initialize Virtual DMA Specification */ + #ifndef DPMI + vdsok=vdsinit==0; + #else + vdsok=false; + #endif + + fillchar(mcpstrc,sizeof(tmcpstruct),0); + + /* Query for sampling rate */ + val(paramstr(14),a,e); + if (a>4000) rate=a; else rate=21000; + + /* Query for quality */ + mcpstrc.options=mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi=sdi_sb; + scard.maxrate=22000; + } + break; + case id_sbpro : { + sdi=sdi_sbpro; + scard.maxrate=22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi=sdi_pas; + scard.maxrate=44100; + } + break; + case id_sb16 : { + sdi=sdi_sb16; + scard.maxrate=44100; + } + break; + case id_aria : { + sdi=sdi_aria; + scard.maxrate=44100; + } + break; + case id_wss : { + sdi=sdi_wss; + scard.maxrate=48000; + } + break; + #ifndef DPMI + case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ + #endif + } + + mcpinitsounddevice(sdi,&scard); + a=mcp_tablesize; + mcpstrc.reqsize=0; + + /* Calculate mixing buffer size */ + bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize=0; + if ((mcpstrc.options & mcp_quality)>0) + if (scard.samplesize==1) a += mcp_qualitysize; else + a=mcp_tablesize16+mcp_qualitysize16; + if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; + + #ifdef DPMI + dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); + v86=(flags & 2)==0; + #endif + + /* Allocate volume table + mixing buffer */ + #ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg=0; + dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); + } else { + #endif + getmem(temp,a+longint(bufsize)); + if (temp==nil) exit(2); + #ifdef DPMI + tempseg=seg(temp); + } + #else + tempseg=seg(temp)+ofs(temp) / 16+1; + #endif + mcpstrc.bufferseg=tempseg; + mcpstrc.bufferphysical=-1; + + if (vdsok && (scard.id!=id_dac)) { + dds.size=bufsize; + dds.segment=tempseg; + dds.offset=0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; + } + if (mcpstrc.bufferphysical==-1) + #ifdef DPMI + mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); + #else + mcpstrc.bufferphysical=(longint)(tempseg) << 4; + #endif + + mcpstrc.buffersize=bufsize; + mcpstrc.samplingrate=rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc)!=0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp,0,31); + } + + /* Try to initialize AMP */ + if (ampinit(0)!=0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt,amp_timer); + + #ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id==id_dac) setdactimer(tsgettimerrate); + #endif + + if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; + + /* Load an example AMF */ + module=amploadmod("avalot2.mod",0); + if (module==nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) + && (scard.samplesize==2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); + cdisetupchannels(0,module->channelcount+2,&voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0,module->channelcount+2,nil); + } + + curch=module->channelcount; + modulevolume=64; + + /***/ ampplaymodule(module,0); + } + + gd=3; gm=1; initgraph(gd,gm,""); + assign(ff,"avalot.fnt"); reset(ff); ff >> f[0]; close(ff); + assign(ff,"avitalic.fnt"); reset(ff); ff >> f[1]; close(ff); + + c=addr(credits()); c -= 1; + + fillchar(strip,sizeof(strip),'\0'); + reverse=false; spinnum=0; across=7; charnum=1; cfont=0; + bigo2("1189"); /* 1189? 79? 2345? 1967? */ + bigo2go(); + + if (! nomusic) ampstopmodule; + closegraph(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp new file mode 100644 index 000000000000..1e046fcc0c0a --- /dev/null +++ b/engines/avalanche/status.cpp @@ -0,0 +1,34 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer gd,gm; + +void data(integer y, string a,string b) +{; + setcolor(1); settextjustify(2,0); outtextxy(315,y,a+':'); + setcolor(0); settextjustify(0,0); outtextxy(325,y,b); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\turbo"); + setcolor(1); setfillstyle(1,7); bar(0,0,640,200); + settextstyle(1,0,0); setusercharsize(10,4,8,6); settextjustify(1,1); + outtextxy(317,20,"Status Screen"); + settextstyle(0,0,1); + data( 60,"Current game","NoName.ASG"); + data( 70,"Saved?","Yes"); + data( 90,"Current town","Thurringham"); + data(100,"Score","177"); + data(110,"Cash","1/-"); + data(130,"Game","Lord Avalot D'Argent"); + data(140,"Version","1.00 (beta)"); + data(150,"Registered to","Unregistered!"); + data(160,"Number","nix"); + data(177,"Bios/keyboard","AT (enhanced)"); /* or XT (bog standard) */ + data(187,"Display","VGA"); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp new file mode 100644 index 000000000000..1fc11cd31351 --- /dev/null +++ b/engines/avalanche/sticks.cpp @@ -0,0 +1,90 @@ +#include "ptoc.h" + +/* + + + + + STICKS The joystick handler. */ + +#define __sticks_implementation__ + + +#include "sticks.h" + + +enum lmc {l,m,r, last_lmc}; /* Left, middle & right */ + +file jf; + +byte joyway(); + + +static lmc getlmc(word n,word max,word min) +{lmc getlmc_result; +; + if (nmax) getlmc_result=r; else + getlmc_result=m; +return getlmc_result; +} + +byte joyway() +{ + word x,y; + lmc xx,yy; +byte joyway_result; +; + if (~ dna.user_moves_avvy) return joyway_result; + if (use_joy_a) readjoya(x,y); else readjoyb(x,y); + + {; + xx=getlmc(x,cxmax,cxmin); + yy=getlmc(y,cymax,cymin); + } + + switch (xx) { + case l: switch (yy) { + case l: joyway_result=ul; break; + case m: joyway_result=left; break; + case r: joyway_result=dl; break; + } + break; + case m: switch (yy) { + case l: joyway_result=up; break; + case m: joyway_result=stopped; break; + case r: joyway_result=down; break; + } + break; + case r: switch (yy) { + case l: joyway_result=ur; break; + case m: joyway_result=right; break; + case r: joyway_result=dr; break; + } + break; + } +return joyway_result; +} + +void joykeys() + /* The 2 joystick keys may be reprogrammed. This parses them. */ +{ + byte v; +; + if (use_joy_a) + { + v=(byte)(buttona1); v += (byte)(buttona2)*2; + } else + { + v=(byte)(buttonb1); v += (byte)(buttonb2)*2; + } + + switch (v) { + case 0: return; break; /* No buttons pressed. */ + case 1: opendoor; break; /* Button 1 pressed: open door. */ +/* 2: blip; { Button 2 pressed: nothing (joylock?). }*/ + case 2:case 3: lookaround; break; /* Both buttons pressed: look around. */ + } +} + + /* No init code. */ \ No newline at end of file diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h new file mode 100644 index 000000000000..5a54cd44bc2d --- /dev/null +++ b/engines/avalanche/sticks.h @@ -0,0 +1,13 @@ +#ifndef __sticks_h__ +#define __sticks_h__ + + +/*#include "Joystick.h"*/ +/*#include "Acci.h"*/ +/*#include "Gyro.h"*/ + /* for solidarity */ + +byte joyway(); +void joykeys(); + +#endif diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp new file mode 100644 index 000000000000..1ed894a46e77 --- /dev/null +++ b/engines/avalanche/sunrise.cpp @@ -0,0 +1,57 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +integer gd,gm; +longint tskellern /*absolute $0:244*/; /* Over int $61 */ + +void hold() +{; + do {; } while (!(tskellern>=1)); + tskellern=0; +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); + + setvisualpage(1); + setfillstyle(1,1); + for( gd=1; gd <= 640; gd ++) + bar(gd,177+trunc(20*sin((real)(gd)/39)),gd,350); + setfillstyle(1,3); setcolor(3); + fillellipse(320,277,60,50); + settextjustify(1,1); settextstyle(0,0,2); setcolor(9); + outtextxy(320,50,"The sun rises over Hertfordshire..."); + settextjustify(2,0); settextstyle(0,0,1); setcolor(0); + outtextxy(635,350,"Press any key..."); + + setpalette(0,egablue); + setpalette(1,egagreen); + setpalette(2,egayellow); + setpalette(3,egagreen); + setpalette(9,egalightblue); + setpalette(11,egalightblue); + setvisualpage(0); + + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << 1; port[0x3cf]=1; + + for( gm=227; gm >= 1; gm --) /* <<< try running this loop the other way round! */ + {; + move(mem[0xa000*gm*80+80],mem[0xa000*gm*80],8042); + hold(); + if (keypressed()) return 0; + } + + for( gm=101; gm >= 1; gm --) + {; + move(mem[0xa000*80],mem[0xa000*0],gm*80); + hold(); + if (keypressed()) return 0; + } +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp new file mode 100644 index 000000000000..634f3214b60e --- /dev/null +++ b/engines/avalanche/tempo.cpp @@ -0,0 +1,77 @@ +#include "ptoc.h" + + +#include "graph.h" + + +enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; + +struct chunkblocktype { + union { + struct {flavourtype flavour; + integer x,y; + integer xl,yl; + longint size;} s_true; + array<1,14,byte> all; + }; +}; + + +byte screennum; +untyped_file f; + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void load() +{ + byte a /*absolute $A000:1200*/; byte bit; +; + reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,12080); + } + close(f); + bit=getpixel(0,0); +} + +void init() +{ + integer gd,gm; +; + output << "*** Tempo file creater ***" << NL; + output << "Enter place*.avd number:"; + input >> screennum >> NL; + gd=3; gm=0; + initgraph(gd,gm,"c:\\bp\\bgi"); + assign(f,string("place")+strf(screennum)+".avd"); + load(); + setactivepage(1); + setcolor(10); + outtextxy(0,150,"CHUNK FILE: please don't change these codes! ->"); + setactivepage(0); +} + +void choose() +{ + integer x1,y1,xl,yl; +; + +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + init(); + choose(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp new file mode 100644 index 000000000000..6d480843f251 --- /dev/null +++ b/engines/avalanche/test.cpp @@ -0,0 +1,19 @@ +#include "ptoc.h" + + +/*$M 2048,0,0*/ +/*#include "Dos.h"*/ + +const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; +pointer saveint1f; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1f,saveint1f); + setintvec(0x1f,&signature); + swapvectors; + exec("c:\\command.com",""); + swapvectors; + setintvec(0x1f,saveint1f); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp new file mode 100644 index 000000000000..a4f678d6508f --- /dev/null +++ b/engines/avalanche/test2.cpp @@ -0,0 +1,17 @@ +#include "ptoc.h" + + +/*#include "Dos.h"*/ + +const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; +pointer getint1f; +array<1,22,char> x; +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + getintvec(0x1f,getint1f); + move(getint1f,x,22); + if (x==signature) + output << "Signature found." << NL; else output << "Signature NOT found!" << NL; +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp new file mode 100644 index 000000000000..bc00393150a9 --- /dev/null +++ b/engines/avalanche/testblit.cpp @@ -0,0 +1,49 @@ +#include "ptoc.h" + + +#include "graph.h" + + +const integer ttp = 81920; +const integer borland = xorput; +const integer mb1 = 2; /* 2 */ +const integer mb2 = 4; /* 4 */ + +integer gd,gm; +pointer p; +word s; + +void mblit() +{ + byte bit; longint st; +; + st=ttp; + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=mb1; + portw[0x3ce]=copyput*256+3; + portw[0x3ce]=0x205; + port[0x3ce]=0x8; + port[0x3c5]=1 << bit; + port[0x3cf]=bit; + move(mem[longint(0xa000)*st],mem[0xa000*0],7200); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,""); + settextstyle(1,0,7); + for( gd=0; gd <= 1; gd ++) + {; + setactivepage(gd); setcolor(6*gd+6); + outtextxy(0,0,chr(65+gd)); + } + s=imagesize(0,0,90,90); setactivepage(0); getmem(p,s); + getimage(0,0,90,90,p); putimage(100,100,p,0); + setactivepage(1); getimage(0,0,90,90,p); setactivepage(0); + putimage(100,100,p,borland); + mblit(); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp new file mode 100644 index 000000000000..064b0a10b590 --- /dev/null +++ b/engines/avalanche/testcard.cpp @@ -0,0 +1,56 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Dos.h"*/ + +integer gd,gm; +string filename; + +untyped_file f; byte bit; +byte a /*absolute $A000:800*/; +searchrec r; + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + for( gd=0; gd <= 14; gd ++) + for( gm=0; gm <= 11; gm ++) + {; + setfillstyle(gm,gd+1); + bar(gd*43,gm*12+10,42+gd*43,gm*12+21); + } + + output << NL; output << NL; output << NL; output << NL; + + output << "Thorsoft testcard." << NL; + output << NL; + output << "Room number? "; input >> filename >> NL; + + findfirst(string("place")+filename+".avd",anyfile,r); + if (doserror==0) + {; + output << "*** ALREADY EXISTS! CANCELLED! ***" << NL; + input >> NL; + exit(0); + } + + output << NL; + output << "*** Until this room is drawn, this screen is standing in for it. ***" << NL; + output << NL; + output << "Any other comments? "; + input >> NL; + + assign(f,string("place")+filename+".avd"); + rewrite(f,1); + blockwrite(f,gd,177); /* just anything */ + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,a,12080); + } + close(f); +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp new file mode 100644 index 000000000000..8077ca33d822 --- /dev/null +++ b/engines/avalanche/testenh.cpp @@ -0,0 +1,18 @@ +#include "ptoc.h" + + +/*#include "Enhanced.h"*/ + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + do { + readkeye; + switch (inchar) { + case '\0': output << string('[')+extd+']'; break; + case '\340': output << string('<')+extd+'>'; break; + default: output << inchar; + } + } while (!(inchar=='\33')); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp new file mode 100644 index 000000000000..26ab44989b69 --- /dev/null +++ b/engines/avalanche/timeout.cpp @@ -0,0 +1,594 @@ +#include "ptoc.h" + +/* + + + + + TIMEOUT The scheduling unit. */ + +#define __timeout_implementation__ + + +#include "timeout.h" + + +#include "visa.h" +#include "lucerna.h" +#include "trip5.h" +#include "scrolls.h" +#include "sequence.h" +#include "pingo.h" +#include "Acci.h" +#include "enid.h" + + +byte fv; + +void set_up_timer(longint howlong, byte whither,byte why) +{ + fv=1; + while ((fv<8) && (times[fv].time_left!=0)) fv += 1; + if (fv==8) return; /* Oh dear... */ + + { + timetype& with = times[fv]; /* Everything's OK here! */ + + with.time_left=howlong; + with.then_where=whither; + with.what_for=why; + } +} + +void one_tick() +{ + + if (ddmnow) return; + + for( fv=1; fv <= 7; fv ++) + { timetype& with = times[fv]; + if (with.time_left>0) + { + with.time_left -= 1; + + if (with.time_left==0) + switch (with.then_where) { + case procopen_drawbridge : open_drawbridge(); break; + case procavaricius_talks : avaricius_talks(); break; + case procurinate : urinate(); break; + case proctoilet2 : toilet2(); break; + case procbang: bang(); break; + case procbang2: bang2(); break; + case procstairs: stairs(); break; + case proccardiffsurvey: cardiff_survey(); break; + case proccardiff_return: cardiff_return(); break; + case proc_cwytalot_in_herts: cwytalot_in_herts(); break; + case procget_tied_up: get_tied_up(); break; + case procget_tied_up2: get_tied_up2(); break; + case prochang_around: hang_around(); break; + case prochang_around2: hang_around2(); break; + case procafter_the_shootemup: after_the_shootemup(); break; + case procjacques_wakes_up: jacques_wakes_up(); break; + case procnaughty_duke: naughty_duke(); break; + case procnaughty_duke2: naughty_duke2(); break; + case procnaughty_duke3: naughty_duke3(); break; + case procjump: jump(); break; + case procsequence: call_sequencer(); break; + case proccrapulus_splud_out: crapulus_says_splud_out(); break; + case procdawn_delay: dawn(); break; + case procbuydrinks: buydrinks(); break; + case procbuywine: buywine(); break; + case proccallsguards: callsguards(); break; + case procgreetsmonk: greetsmonk(); break; + case procfall_down_oubliette: fall_down_oubliette(); break; + case procmeet_avaroid: meet_avaroid(); break; + case procrise_up_oubliette: rise_up_oubliette(); break; + case procrobin_hood_and_geida: robin_hood_and_geida(); break; + case procrobin_hood_and_geida_talk: robin_hood_and_geida_talk(); break; + case procavalot_returns: avalot_returns(); break; + case procavvy_sit_down: avvy_sit_down(); break; + case procghost_room_phew: ghost_room_phew(); break; + case procarkata_shouts: arkata_shouts(); break; + case procwinning: winning(); break; + case procavalot_falls: avalot_falls(); break; + case procspludwick_goes_to_cauldron: spludwick_goes_to_cauldron(); break; + case procspludwick_leaves_cauldron: spludwick_leaves_cauldron(); break; + case procgive_lute_to_geida: give_lute_to_geida(); break; + } + }} + roomtime += 1; /* Cycles since you've been in this room. */ + dna.total_time += 1; /* Total amount of time for this game. */ +} + +void lose_timer(byte which) +{ + byte fv; + + for( fv=1; fv <= 7; fv ++) + { timetype& with = times[fv]; + if (with.what_for==which) + with.time_left=0;} /* Cancel this one! */ +} + +/*function timer_is_on(which:byte):boolean; +var fv:byte; +begin + for fv:=1 to 7 do + with times[fv] do + if (what_for=which) and (time_left>0) then + begin + timer_is_on:=true; + exit; + end; + timer_is_on:=false; +end;*/ + +/* Timeout procedures: */ + +void open_drawbridge() +{ + { + dnatype& with = dna; + + with.drawbridge_open += 1; + show_one(with.drawbridge_open-1); + + if (with.drawbridge_open==4) + magics[2].op=nix; /* You may enter the drawbridge. */ + else set_up_timer(7,procopen_drawbridge,reason_drawbridgefalls); + } +} + +/* --- */ + +void avaricius_talks() +{ + { + dnatype& with = dna; + + dixi('q',with.avaricius_talk); + with.avaricius_talk += 1; + + if (with.avaricius_talk<17) + set_up_timer(177,procavaricius_talks,reason_avariciustalks); + else points(3); + + } +} + +void urinate() +{ + tr[1].turn(up); + stopwalking(); + showrw(); + set_up_timer(14,proctoilet2,reason_gototoilet); +} + +void toilet2() +{ + display("That's better!"); +} + +void bang() +{ + display("\6< BANG! >"); + set_up_timer(30,procbang2,reason_explosion); +} + +void bang2() +{ + display("Hmm... sounds like Spludwick's up to something..."); +} + +void stairs() +{ + blip(); + tr[1].walkto(4); + show_one(2); + dna.brummie_stairs=2; + magics[11].op=special; + magics[11].data=2; /* Reached the bottom of the stairs. */ + magics[4].op=nix; /* Stop them hitting the sides (or the game will hang.) */ +} + +void cardiff_survey() +{ + { + dnatype& with = dna; + + switch (with.cardiff_things) { + case 0: { + with.cardiff_things += 1; + dixi('q',27); + } + break; + } + dixi('z',with.cardiff_things); + } + interrogation=dna.cardiff_things; + set_up_timer(182,proccardiffsurvey,reason_cardiffsurvey); +} + +void cardiff_return() +{ + dixi('q',28); + cardiff_survey(); /* add end of question. */ +} + +void cwytalot_in_herts() +{ + dixi('q',29); +} + +void get_tied_up() +{ + dixi('q',34); /* ...Trouble! */ + dna.user_moves_avvy=false; + dna.been_tied_up=true; + stopwalking(); + tr[2].stopwalk(); tr[2].stophoming(); + tr[2].call_eachstep=true; + tr[2].eachstep=procgrab_avvy; + set_up_timer(70,procget_tied_up2,reason_getting_tied_up); +} + +void get_tied_up2() +{ + tr[1].walkto(4); + tr[2].walkto(5); + magics[4].op=nix; /* No effect when you touch the boundaries. */ + dna.friar_will_tie_you_up=true; +} + +void hang_around() +{ + tr[2].check_me=false; + tr[1].init(7,true); /* Robin Hood */ + whereis[probinhood]=r__robins; + apped(1,2); + dixi('q',39); + tr[1].walkto(7); + set_up_timer(55,prochang_around2,reason_hanging_around); +} + +void hang_around2() +{ + dixi('q',40); + tr[2].vanishifstill=false; + tr[2].walkto(4); + whereis[pfriartuck]=r__robins; + dixi('q',41); + tr[1].done(); tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + + set_up_timer(1,procafter_the_shootemup,reason_hanging_around); /* Immediately + call the following proc (when you have a chance). */ + + dna.tied_up=false; + + back_to_bootstrap(1); /* Call the shoot-'em-up. */ +} + +void after_the_shootemup() +{ + byte shootscore,gain; + + tr[1].init(0,true); /* Avalot. */ + apped(1,2); dna.user_moves_avvy=true; + dna.obj[crossbow]=true; objectlist(); + + shootscore=mem[storage_seg*storage_ofs]; + gain=(shootscore+5) / 10; /* Rounding up. */ + + display(string("\6Your score was ")+strf(shootscore)+'.'+"\r\rYou gain ("+ + strf(shootscore)+" 10) = "+strf(gain)+" points."); + + if (gain>20) + { + display("But we won't let you have more than 20 points!"); + points(20); + } else + points(gain); + + dixi('q',70); +} + +void jacques_wakes_up() +{ + dna.jacques_awake += 1; + + switch (dna.jacques_awake) { /* Additional pictures. */ + case 1 : { + show_one(1); /* Eyes open. */ + dixi('Q',45); + } + break; + case 2 : { /* Going through the door. */ + show_one(2); /* Not on the floor. */ + show_one(3); /* But going through the door. */ + magics[6].op=nix; /* You can't wake him up now. */ + } + break; + case 3 : { /* Gone through the door. */ + show_one(2); /* Not on the floor, either. */ + show_one(4); /* He's gone... so the door's open. */ + whereis[pjacques]=0; /* Gone! */ + } + break; + } + + + if (dna.jacques_awake==5) + { + dna.ringing_bells=true; + dna.ayles_is_awake=true; + points(2); + } + + switch (dna.jacques_awake) { + case RANGE_3(1,3): set_up_timer(12,procjacques_wakes_up,reason_jacques_waking_up); + break; + case 4: set_up_timer(24,procjacques_wakes_up,reason_jacques_waking_up); break; + } + +} + +void naughty_duke() + /* This is when the Duke comes in and takes your money. */ +{ + tr[2].init(9,false); /* Here comes the Duke. */ + apped(2,1); /* He starts at the door... */ + tr[2].walkto(3); /* He walks over to you. */ + + /* Let's get the door opening. */ + + show_one(1); first_show(2); start_to_close(); + + set_up_timer(50,procnaughty_duke2,reason_naughty_duke); +} + +void naughty_duke2() +{ + dixi('q',48); /* Ha ha, it worked again! */ + tr[2].walkto(1); /* Walk to the door. */ + tr[2].vanishifstill=true; /* Then go away! */ + set_up_timer(32,procnaughty_duke3,reason_naughty_duke); +} + +void naughty_duke3() +{ + show_one(1); first_show(2); start_to_close(); +} + +void jump() +{ + { + dnatype& with = dna; + + with.jumpstatus += 1; + + { triptype& with1 = tr[1]; + switch (with.jumpstatus) { + case 1:case 2:case 3:case 5:case 7:case 9: with1.y -= 1; break; + case 12:case 13:case 14:case 16:case 18:case 19: with1.y += 1; break; + }} + + if (with.jumpstatus==20) + { /* End of jump. */ + dna.user_moves_avvy=true; + dna.jumpstatus=0; + } else + { /* Still jumping. */ + set_up_timer(1,procjump,reason_jumping); + } + + if ((with.jumpstatus==10) /* You're at the highest point of your jump. */ + && (dna.room==r__insidecardiffcastle) + && (dna.arrow_in_the_door==true) + && (infield(3))) /* beside the wall*/ + { /* Grab the arrow! */ + if (dna.carrying>=maxobjs) + display("You fail to grab it, because your hands are full."); + else + { + show_one(2); + dna.arrow_in_the_door=false; /* You've got it. */ + dna.obj[bolt]=true; + objectlist(); + dixi('q',50); + points(3); + } + } + } +} + +void crapulus_says_splud_out() +{ + dixi('q',56); + dna.crapulus_will_tell=false; +} + +void buydrinks() +{ + show_one(11); /* Malagauche gets up again. */ + dna.malagauche=0; + + dixi('D',ord(dna.drinking)); /* Display message about it. */ + wobble(); /* Do the special effects. */ + dixi('D',1); /* That'll be thruppence. */ + if (pennycheck(3)) /* Pay 3d. */ + dixi('D',3); /* Tell 'em you paid up. */ + have_a_drink(); +} + +void buywine() +{ + show_one(11); /* Malagauche gets up again. */ + dna.malagauche=0; + + dixi('D',50); /* You buy the wine. */ + dixi('D',1); /* It'll be thruppence. */ + if (pennycheck(3)) + { + dixi('D',4); /* You paid up. */ + dna.obj[wine]=true; + objectlist(); + dna.winestate=1; /* OK Wine */ + } +} + +void callsguards() +{ + dixi('Q',58); /* GUARDS!!! */ + gameover(); +} + +void greetsmonk() +{ + dixi('Q',59); dna.entered_lusties_room_as_monk=true; +} + +void fall_down_oubliette() +{ + magics[9].op=nix; + tr[1].iy += 1; /* increments dx/dy! */ + tr[1].y += tr[1].iy; /* Dowwwn we go... */ + set_up_timer(3,procfall_down_oubliette,reason_falling_down_oubliette); +} + +void meet_avaroid() +{ + if (dna.met_avaroid) + { + display("You can't expect to be \6that\22 lucky twice in a row!"); + gameover(); + } else + { + dixi('Q',60); dna.met_avaroid=true; + set_up_timer(1,procrise_up_oubliette,reason_rising_up_oubliette); + { + triptype& with = tr[1]; with.face=left; with.x=151; with.ix=-3; with.iy=-5; } + background(2); + } +} + +void rise_up_oubliette() +{ + { + triptype& with = tr[1]; + + with.visible=true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy>0) + set_up_timer(3,procrise_up_oubliette,reason_rising_up_oubliette); + else + dna.user_moves_avvy=true; + } +} + +void robin_hood_and_geida() +{ + tr[1].init(7,true); + apped(1,7); + tr[1].walkto(6); + tr[2].stopwalk(); + tr[2].face=left; + set_up_timer(20,procrobin_hood_and_geida_talk,reason_robin_hood_and_geida); + dna.geida_follows=false; +} + +void robin_hood_and_geida_talk() +{ + dixi('q',66); tr[1].walkto(2); tr[2].walkto(2); + tr[1].vanishifstill=true; tr[2].vanishifstill=true; + set_up_timer(162,procavalot_returns,reason_robin_hood_and_geida); +} + +void avalot_returns() +{ + tr[1].done(); tr[2].done(); + tr[1].init(0,true); + apped(1,1); + dixi('q',67); + dna.user_moves_avvy=true; +} + +void avvy_sit_down() + /* This is used when you sit down in the pub in Notts. It loops around so + that it will happen when Avvy stops walking. */ +{ + if (tr[1].homing) /* Still walking */ + set_up_timer(1,procavvy_sit_down,reason_sitting_down); + else + { + show_one(3); + dna.sitting_in_pub=true; + dna.user_moves_avvy=false; + tr[1].visible=false; + } +} + +void ghost_room_phew() +{ + display("\6PHEW!\22 You're glad to get out of \6there!"); +} + +void arkata_shouts() +{ + if (dna.teetotal) return; + dixi('q',76); + set_up_timer(160,procarkata_shouts,reason_arkata_shouts); +} + +void winning() +{ + dixi('q',79); + winning_pic(); + do { checkclick(); } while (!(mrelease==0)); + callverb(vb_score); + display(" T H E E N D "); + lmo=true; +} + +void avalot_falls() +{ + if (tr[1].step<5) + { + tr[1].step += 1; + set_up_timer(3,procavalot_falls,reason_falling_over); + } else + display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); +} + +void spludwick_goes_to_cauldron() +{ + if (tr[2].homing) + set_up_timer(1,procspludwick_goes_to_cauldron,reason_spludwalk); + else + set_up_timer(17,procspludwick_leaves_cauldron,reason_spludwalk); +} + +void spludwick_leaves_cauldron() +{ + tr[2].call_eachstep=true; /* So that normal procs will continue. */ +} + +void give_lute_to_geida() /* Moved here from Acci. */ +{ + dixi('Q',86); + points(4); + dna.lustie_is_asleep=true; + first_show(5); then_show(6); /* He falls asleep... */ + start_to_close(); /* Not really closing, but we're using the same procedure. */ +} + +/* "This is all!" */ + +class unit_timeout_initialize { + public: unit_timeout_initialize(); +}; +static unit_timeout_initialize timeout_constructor; + +unit_timeout_initialize::unit_timeout_initialize() { + fillchar(times,sizeof(times),'\0'); +} diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h new file mode 100644 index 000000000000..5fa9800388c7 --- /dev/null +++ b/engines/avalanche/timeout.h @@ -0,0 +1,229 @@ +#ifndef __timeout_h__ +#define __timeout_h__ + + +#include "gyro.h" +#include "celer.h" + + +/* reason_ now runs between 1 and 28. */ + +const integer reason_drawbridgefalls = 2; +const integer reason_avariciustalks = 3; +const integer reason_gototoilet = 4; +const integer reason_explosion = 5; +const integer reason_brummiestairs = 6; +const integer reason_cardiffsurvey = 7; +const integer reason_cwytalot_in_herts = 8; +const integer reason_getting_tied_up = 9; +const integer reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ +const integer reason_jacques_waking_up = 11; +const integer reason_naughty_duke = 12; +const integer reason_jumping = 13; +const integer reason_sequencer = 14; +const integer reason_crapulus_says_spludwick_out = 15; +const integer reason_dawndelay = 16; +const integer reason_drinks = 17; +const integer reason_du_lustie_talks = 18; +const integer reason_falling_down_oubliette = 19; +const integer reason_meeting_avaroid = 20; +const integer reason_rising_up_oubliette = 21; +const integer reason_robin_hood_and_geida = 22; +const integer reason_sitting_down = 23; +const integer reason_ghost_room_phew = 1; +const integer reason_arkata_shouts = 24; +const integer reason_winning = 25; +const integer reason_falling_over = 26; +const integer reason_spludwalk = 27; +const integer reason_geida_sings = 28; + +/* PROCx now runs between 1 and 41. */ + +const integer procopen_drawbridge = 3; + +const integer procavaricius_talks = 4; + +const integer procurinate = 5; + +const integer proctoilet2 = 6; + +const integer procbang = 7; + +const integer procbang2 = 8; + +const integer procstairs = 9; + +const integer proccardiffsurvey = 10; + +const integer proccardiff_return = 11; + +const integer proc_cwytalot_in_herts = 12; + +const integer procget_tied_up = 13; + +const integer procget_tied_up2 = 1; + +const integer prochang_around = 14; + +const integer prochang_around2 = 15; + +const integer procafter_the_shootemup = 32; + +const integer procjacques_wakes_up = 16; + +const integer procnaughty_duke = 17; + +const integer procnaughty_duke2 = 18; + +const integer procnaughty_duke3 = 38; + +const integer procjump = 19; + +const integer procsequence = 20; + +const integer proccrapulus_splud_out = 21; + +const integer procdawn_delay = 22; + +const integer procbuydrinks = 23; + +const integer procbuywine = 24; + +const integer proccallsguards = 25; + +const integer procgreetsmonk = 26; + +const integer procfall_down_oubliette = 27; + +const integer procmeet_avaroid = 28; + +const integer procrise_up_oubliette = 29; + +const integer procrobin_hood_and_geida = 2; + +const integer procrobin_hood_and_geida_talk = 30; + +const integer procavalot_returns = 31; + +const integer procavvy_sit_down = 33; /* In Nottingham. */ + +const integer procghost_room_phew = 34; + +const integer procarkata_shouts = 35; + +const integer procwinning = 36; + +const integer procavalot_falls = 37; + +const integer procspludwick_goes_to_cauldron = 39; + +const integer procspludwick_leaves_cauldron = 40; + +const integer procgive_lute_to_geida = 41; + +struct timetype { + longint time_left; + byte then_where; + byte what_for; +}; + + +#ifdef __timeout_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,7,timetype> times; +#undef EXTERN +#define EXTERN extern + + +void set_up_timer(longint howlong, byte whither,byte why); + +void one_tick(); + +void lose_timer(byte which); + +/*function timer_is_on(which:byte):boolean;*/ + + /* Procedures to do things at the end of amounts of time: */ + + void open_drawbridge(); + + void avaricius_talks(); + + void urinate(); + + void toilet2(); + + void bang(); + + void bang2(); + + void stairs(); + + void cardiff_survey(); + + void cardiff_return(); + + void cwytalot_in_herts(); + + void get_tied_up(); + + void get_tied_up2(); + + void hang_around(); + + void hang_around2(); + + void after_the_shootemup(); + + void jacques_wakes_up(); + + void naughty_duke(); + + void naughty_duke2(); + + void naughty_duke3(); + + void jump(); + + void crapulus_says_splud_out(); + + void buydrinks(); + + void buywine(); + + void callsguards(); + + void greetsmonk(); + + void fall_down_oubliette(); + + void meet_avaroid(); + + void rise_up_oubliette(); + + void robin_hood_and_geida(); + + void robin_hood_and_geida_talk(); + + void avalot_returns(); + + void avvy_sit_down(); + + void ghost_room_phew(); + + void arkata_shouts(); + + void winning(); + + void avalot_falls(); + + void spludwick_goes_to_cauldron(); + + void spludwick_leaves_cauldron(); + + void give_lute_to_geida(); + +#endif diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp new file mode 100644 index 000000000000..b7597670d6c5 --- /dev/null +++ b/engines/avalanche/travel.cpp @@ -0,0 +1,64 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +integer gd,gm; + +void zoomout(integer x,integer y) +{ + integer x1,y1,x2,y2; + byte fv; +; + setcolor(white); setwritemode(xorput); + setlinestyle(dottedln,0,1); + + for( fv=1; fv <= 20; fv ++) + {; + x1=x-(x / 20)*fv; + y1=y-((y-10) / 20)*fv; + x2=x+(((639-x) / 20)*fv); + y2=y+(((161-y) / 20)*fv); + + rectangle(x1,y1,x2,y2); + delay(17); + rectangle(x1,y1,x2,y2); + } +} + +void zoomin(integer x,integer y) +{ + integer x1,y1,x2,y2; + byte fv; +; + setcolor(white); setwritemode(xorput); + setlinestyle(dottedln,0,1); + + for( fv=20; fv >= 1; fv --) + {; + x1=x-(x / 20)*fv; + y1=y-((y-10) / 20)*fv; + x2=x+(((639-x) / 20)*fv); + y2=y+(((161-y) / 20)*fv); + + rectangle(x1,y1,x2,y2); + delay(17); + rectangle(x1,y1,x2,y2); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + zoomout(177,77); + zoomout(7,31); + zoomout(577,124); + zoomout(320,85); + zoomin(177,77); + zoomin(7,31); + zoomin(577,124); + zoomin(320,85); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp new file mode 100644 index 000000000000..3dc89ac9ec99 --- /dev/null +++ b/engines/avalanche/trip.cpp @@ -0,0 +1,139 @@ +#include "ptoc.h" + +/* + + + + + TRIP The trippancy handler. (Trippancy 2) */ + +#define __trip_implementation__ + + +#include "trip.h" + + +#include "graph.h" +#include "gyro.h" +/*#include "Dos.h"*/ + + +/* */ +/* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ +/* (C) 1986 by Kent Cedola, 2015 Meadow Lake Ct., Norfolk, VA, 23518 */ +/* */ +/* Description: Write a array of colors in a vertical line. The current */ +/* merge setting is used to control the combining of bits. */ +/* */ + void gpwtcol(void* buf, integer n) /* Cedola */ + {; /* + inline + ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ + GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ + $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ + $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ + $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ + } + + +void loadtrip() +{ + untyped_file inf; +; + assign(inf,"t:avvy.trp"); reset(inf,1); + seek(inf,0x27); + blockread(inf,pozzes,sizeof(pozzes)); + blockread(inf,blue3,sizeof(blue3)); close(inf); +} + +void plot(word count, integer ox,integer oy) /* orig x & y. Page is always 1. */ +{ + byte x,y,len; +; + do { + len=blue3[count]; if (len==177) return; + x=blue3[count+1]; y=blue3[count+2]; count += 3; + {; + gdcur_x=x+ox; gdcur_y=y+oy; + /* fiddle xy coords to match page 1 */ + gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ + if (gdcur_x<0) + {; gdcur_x += 640; gdcur_y -= 1; } + gpwtcol(&blue3[count],len); count += len; + } + } while (!false); +} + +void boundscheck() +{; + if (dna.uy>123) dna.uy=123; + if (dna.uy<10) dna.uy=10; + if (dna.ux<5) dna.ux=5; + if (dna.ux>600) dna.ux=600; +} + +void budge() +{; + if (set::of(up,ul,ur, eos).has(dna.rw)) dna.uy -= 3; + if (set::of(down,dl,dr, eos).has(dna.rw)) dna.uy += 3; + if (set::of(left,ul,dl, eos).has(dna.rw)) dna.ux -= 5; + if (set::of(right,ur,dr, eos).has(dna.rw)) dna.ux += 5; + + boundscheck(); + + if (dna.rw>0) + {; + anim += 1; if (anim==7) anim=1; + } +} + +void tripkey(char dir) +{; + if (cw!=177) return; + { + dnatype& with = dna; + ; + switch (dir) { + case 'H': if (with.rw!=up) {; with.rw=up; ww=up; } else with.rw=0; break; + case 'P': if (with.rw!=down) {; with.rw=down; ww=down; } else with.rw=0; break; + case 'K': if (with.rw!=left) {; with.rw=left; ww=left; } else with.rw=0; break; + case 'M': if (with.rw!=right) {; with.rw=right; ww=right; } else with.rw=0; break; + case 'I': if (with.rw!=ur) {; with.rw=ur; ww=right; } else with.rw=0; break; + case 'Q': if (with.rw!=dr) {; with.rw=dr; ww=right; } else with.rw=0; break; + case 'O': if (with.rw!=dl) {; with.rw=dl; ww=left; } else with.rw=0; break; + case 'G': if (with.rw!=ul) {; with.rw=ul; ww=left; } else with.rw=0; break; + } + if (with.rw==0) + {; + ux=ppos[0][0]; uy=ppos[0][1]; anim -= 1; + if (anim==0) anim=6; + } + } +} + +void trippancy() +{; + if ((dna.rw==0) || (cw!=177) || (! dropsok)) return; + r.ax=11; intr(0x33,r); + setactivepage(1); off(); + if (ppos[0][1]!=-177) + {; + putimage(ppos[0][0],ppos[0][1],replace[0],0); + } + + getimage(dna.ux,dna.uy,dna.ux+xw,dna.uy+yw,replace[0]); + ppos[0][0]=dna.ux; ppos[0][1]=dna.uy; + + plot(pozzes[anim*4+dna.ww-4],dna.ux,dna.uy); + + { void& with = r; if ((cx==0) && (dx==0)) on();} + getimage(dna.ux-margin,dna.uy-margin,dna.ux+xw+margin,dna.uy+yw+margin,copier); + setactivepage(0); off(); putimage(dna.ux-margin,dna.uy-margin,copier,0); on(); + + { + void& with = mouths[0]; ; x=dna.ux+20; y=dna.uy; } + + budge(); +} + + diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h new file mode 100644 index 000000000000..520e323fe892 --- /dev/null +++ b/engines/avalanche/trip.h @@ -0,0 +1,17 @@ +#ifndef __trip_h__ +#define __trip_h__ + + + void loadtrip(); + + void plot(word count, integer ox,integer oy); + + void boundscheck(); + + void budge(); + + void tripkey(char dir); + + void trippancy(); + +#endif diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp new file mode 100644 index 000000000000..c67f6e1f51b2 --- /dev/null +++ b/engines/avalanche/trip3.cpp @@ -0,0 +1,231 @@ +#include "ptoc.h" + +#define __trip3_implementation__ + /* Project Minstrel- Trippancy routines */ + +#include "trip3.h" + + +#include "Graph.h" +/*#include "Crt.h"*/ + +/*$S+*/ + +const integer avvy = 1; +const integer test = 177; + +struct triprec { + byte handle; /* who is it? */ + integer x,y; /* current x&y */ + byte xm,ym; /* x&y margins */ + shortint ix,iy; /* inc x&y */ + byte stage; /* animation */ + integer xl,yl; /* x&y length */ + boolean prime; /* true on first move */ + boolean alive; /* true if it moves */ +}; + +array<1,10,triprec> tr; +byte tramt; +array<1,20000,byte> blue3; +array<1,24,word> pozzes; + +const integer up = 1; const integer right = 2; const integer down = 3; const integer left = 4; const integer ur = 5; const integer dr = 6; const integer dl = 7; const integer ul = 8; + +/* */ +/* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ +/* (C) 1986 by Kent Cedola, 2015 Meadow Lake Ct., Norfolk, VA, 23518 */ +/* */ +/* Description: Write a array of colors in a vertical line. The current */ +/* merge setting is used to control the combining of bits. */ +/* */ + void gpwtcol(void* buf, integer n) /* Cedola */ + {; + /* inline + ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ + GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ + $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ + $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ + $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ + } + + +void loadtrip() +{ + untyped_file inf; +; + assign(inf,"t:avvy.trp"); reset(inf,1); + seek(inf,0x27); + blockread(inf,pozzes,sizeof(pozzes)); + blockread(inf,blue3,sizeof(blue3)); close(inf); +} + +void enter(byte what_handle, integer xx,integer yy,integer lx,integer ly, byte mmx,byte mmy,byte st) +{; + tramt += 1; + { + triprec& with = tr[tramt]; + ; + with.handle=what_handle; + with.ix=0; with.iy=0; + with.x=xx; with.y=yy; + with.xl=lx; with.yl=ly; + with.xm=mmx; with.ym=mmy; with.stage=st; + with.prime=true; with.alive=true; + } +} + +void plot(byte stage, integer ox,integer oy) /* orig x & y. Page is always 1/UNSEEN. */ +{ + byte x,y,len; word count; +; + count=pozzes[stage]; + do { + len=blue3[count]; if (len==177) return; + x=blue3[count+1]; y=blue3[count+2]; count += 3; + {; + gdcur_x=x+ox; gdcur_y=y+oy; + /* fiddle xy coords to match page 1 */ + gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ + if (gdcur_x<0) + {; gdcur_x += 640; gdcur_y -= 1; } + gpwtcol(&blue3[count],len); count += len; + } + } while (!false); +} + +void trippancy() +{ + byte fv; pointer p,saved1,saved2; word s; array<1,10,pointer> q; + boolean allstill; +; + if ((cw!=177) || (! dropsok) || keypressed()) return; + + /* Do the Avvy Walk */ + + switch (dna.rw) { + case up: budge(avvy, 0,-3,anim*4-3); break; + case down: budge(avvy, 0, 3,anim*4-1); break; + case right: budge(avvy, 5, 0,anim*4-2); break; + case left: budge(avvy,-5, 0,anim*4 ); break; + case ul: budge(avvy,-5,-3,anim*4 ); break; + case dl: budge(avvy,-5, 3,anim*4 ); break; + case ur: budge(avvy, 5,-3,anim*4-2); break; + case dr: budge(avvy, 5, 3,anim*4-2); break; + } + + for( fv=1; fv <= tramt; fv ++) { triprec& with = tr[fv]; boundscheck(with.x,with.y,with.xm,with.ym);} + + allstill=true; + for( fv=1; fv <= tramt; fv ++) + { triprec& with = tr[fv]; + if (((with.alive) && (! ((with.ix==0) && (with.iy==0)))) || with.prime) allstill=false;} + if (allstill) return; + + if (dna.rw>0) + {; + anim += 1; if (anim==7) anim=1; + } + + /* Trippancy Step 1 - Grab moon array of unmargined sprites (phew) */ + mark(saved1); + setactivepage(1); off(); + for( fv=1; fv <= tramt; fv ++) + { + triprec& with = tr[fv]; + ; + s=imagesize(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym); + getmem(q[fv],s); getimage(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym,q[fv]); + } + /* Step 2 - Plot sprites on 1/UNSEEN */ + for( fv=1; fv <= tramt; fv ++) + { + triprec& with = tr[fv]; + ; + plot(with.stage,with.x,with.y); + } + /* Step 3 - Copy all eligible from 1/UNSEEN to 0/SEEN */ + mark(saved2); + for( fv=1; fv <= tramt; fv ++) + { triprec& with = tr[fv]; + if (((with.alive) && (! ((with.ix==0) && (with.iy==0)))) || with.prime) + {; + s=imagesize(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym); + getmem(p,s); + setactivepage(1); getimage(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym,p); + setactivepage(0); putimage(with.x-with.xm,with.y-with.ym,p,0); + release(saved2); with.prime=false; + }} + /* Step 4 - Unplot sprites from 1/UNSEEN */ + setactivepage(1); + for( fv=1; fv <= tramt; fv ++) + { + triprec& with = tr[fv]; + ; + putimage(with.x-with.xm,with.y-with.ym,q[fv],0); + if (with.ix!=0) with.x=with.x+with.ix; + if (with.iy!=0) with.y=with.y+with.iy; + with.ix=0; with.iy=0; + if (with.handle==avvy) { + dnatype& with1 = dna; ; ux=with.x; uy=with.y; } + } + on(); release(saved1); + for( fv=1; fv <= tramt; fv ++) /* synch xy coords of mouths */ + { + triprec& with = tr[fv]; + ; mouths[fv].x=with.x+20; mouths[fv].y=with.y; } + + setactivepage(0); +} + +void budge(byte who, shortint xx,shortint yy, byte frame) /* Moving & animation controller */ +{ + byte fv; +; + for( fv=1; fv <= tramt; fv ++) + { triprec& with = tr[fv]; + if (with.handle==who) + {; + with.ix=xx; with.iy=yy; + with.stage=frame; + }} +} + +void tripkey(char dir) +{; + if (cw!=177) return; + { + dnatype& with = dna; + ; + switch (dir) { + case 'H': if (with.rw!=up) {; with.rw=up; ww=up; } else with.rw=0; break; + case 'P': if (with.rw!=down) {; with.rw=down; ww=down; } else with.rw=0; break; + case 'K': if (with.rw!=left) {; with.rw=left; ww=left; } else with.rw=0; break; + case 'M': if (with.rw!=right) {; with.rw=right; ww=right; } else with.rw=0; break; + case 'I': if (with.rw!=ur) {; with.rw=ur; ww=right; } else with.rw=0; break; + case 'Q': if (with.rw!=dr) {; with.rw=dr; ww=right; } else with.rw=0; break; + case 'O': if (with.rw!=dl) {; with.rw=dl; ww=left; } else with.rw=0; break; + case 'G': if (with.rw!=ul) {; with.rw=ul; ww=left; } else with.rw=0; break; + } + if (with.rw==0) + {; + ux=ppos[0][0]; uy=ppos[0][1]; anim -= 1; + if (anim==0) anim=6; + } + } +} + +void boundscheck(integer& x,integer& y, byte xm,byte ym) +{; + if (y>127-ym) y=127-ym; if (y640-xm) x=640-xm; +} + +class unit_trip3_initialize { + public: unit_trip3_initialize(); +}; +static unit_trip3_initialize trip3_constructor; + +unit_trip3_initialize::unit_trip3_initialize() {; /* init portion of Trip3 */ + tramt=0; +} diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h new file mode 100644 index 000000000000..ccad15346bb3 --- /dev/null +++ b/engines/avalanche/trip3.h @@ -0,0 +1,20 @@ +#ifndef __trip3_h__ +#define __trip3_h__ + + +#include "gyro.h" + + + void loadtrip(); + + void boundscheck(integer& x,integer& y, byte xm,byte ym); + + void budge(byte who, shortint xx,shortint yy, byte frame); /* Moving & animation controller */ + + void tripkey(char dir); + + void trippancy(); + + void enter(byte what_handle, integer xx,integer yy,integer lx,integer ly, byte mmx,byte mmy,byte st); + +#endif diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp new file mode 100644 index 000000000000..b55b209d132f --- /dev/null +++ b/engines/avalanche/trip42.cpp @@ -0,0 +1,450 @@ +#include "ptoc.h" + +/* + + + + + TRIP42 Trippancy IV point 2 - "Trip Oop 2" */ + +#define __trip42_implementation__ + /* Trippancy IV.2 (Trip Oop) */ +#include "trip42.h" + + +/*#include "Scrolls.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Dropdown.h"*/ +/*#include "Access.h"*/ + + +/*procedure copier(x1,y1,x2,y2,x3,y3,x4,y4:integer); + + function dropin(xc,yc,x1,y1,x2,y2:integer):boolean; + { Dropin returns True if the point xc,yc falls within the 1-2 rectangle. } + begin; + dropin:=((xc>=x1) and (xc<=x2) and (yc>=y1) and (yc<=y2)); + end; + + function lesser(a,b:integer):integer; + begin; + if ab then greater:=a else greater:=b; + end; + +begin; + if dropin(x3,y3,x1,y1,x2,y2) + or dropin(x3,y4,x1,y1,x2,y2) + or dropin(x4,y3,x1,y1,x2,y2) + or dropin(x4,y4,x1,y1,x2,y2) then + begin; { Overlaps } + mblit(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4),1,0); + end else + begin; { Doesn't overlap- copy both of them seperately } + mblit(x3,y3,x4,y4,1,0); { backwards- why not...? } + mblit(x1,y1,x2,y2,1,0); + end; +end; */ + +void loadtrip() +{ + byte gm; +; + for( gm=1; gm <= numtr; gm ++) tr[gm].original(); + tr[1].init(0); +} + +byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) +{ + byte a,c; integer fv,ff; +byte checkfeet_result; +; + a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; + if (oya) a=c; + } else + for( fv=x1; fv <= x2; fv ++) + for( ff=y+yl; ff <= oy+yl; ff ++) + {; + c=getpixel(fv,ff); + if (c>a) a=c; + } + checkfeet_result=a; setactivepage(1-cp); +return checkfeet_result; +} + +void touchcol(byte tc); +static boolean bug; + +static void fr(byte a,byte b) {; fliproom(a,b); bug=false; } + +void touchcol(byte tc) +{; + bug=true; /* j.i.c. */ + switch (dna.room) { + case 1: fr(2,3); break; + case 2: {; /* main corridor */ + switch (tc) { + case 1: fr(3,1); break; /* to the other corridor */ + case 2: fr(2,1); break; /* to this corridor! Fix this later... */ + } + } + break; + case 3: {; /* turn corridor */ + switch (tc) { + case 1: fr(2,1); break; /* to the other corridor */ + case 2: fr(12,1); break; /* through Spludwick's door */ + } + } + break; + case 12: fr(3,2); break; + } + if (bug) + {; + display(string('\7')+"Unknown touchcolour ("+strf(tc)+')'+" in "+strf(dna.room) + +'.'); tr[1].bounce(); + } +} + +triptype* triptype::init(byte spritenum) +{ + integer gd,gm; word s; untyped_file f; varying_string<2> xx; byte sort,n; + word bigsize; pointer p,q; +; + str(spritenum,xx); assign(f,string("c:\\avalot\\sprite")+xx+".avd"); + reset(f,1); seek(f,59); + blockread(f,a,sizeof(a)); blockread(f,bigsize,2); + setactivepage(3); + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); + blockread(f,p,bigsize); + off; putimage(0,0,p,0); release(q); n=1; + { adxtype& with = a; + for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= with.seq-1; gd ++) /* steps */ + {; + getmem(pic[n][sort],a.size); /* grab the memory */ + getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, + (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, + pic[n][sort]); /* grab the pic */ + n += 1; + }} /*on;*/ + } + close(f); setactivepage(1-cp); + + x=0; y=0; quick=true; visible=false; +/* for x:=0 to 1 do getmem(behind[x],a.size);*/ + homing=false; ix=0; iy=0; step=0; check_me=a.name=="Avalot"; + count=0; +return this; +} + +void triptype::original() +{; + quick=false; +} + +void triptype::andexor() +{ + byte picnum; /* Picnum, Picnic, what ye heck */ +; + picnum=face*a.seq+step+1; off; + putimage(x,y,pic[picnum][0],andput); + putimage(x,y,pic[picnum][1],xorput); /*on;*/ +} + +void triptype::turn(byte whichway) +{; + if (whichway==8) face=0; else face=whichway; +} + +void triptype::appear(integer wx,integer wy, byte wf) +{; + x=(wx / 8)*8; y=wy; ox[cp]=wx; oy[cp]=wy; turn(wf); + visible=true; ix=0; iy=0; +} + +void triptype::walk() +{ + byte tc; fieldtype r; +; + {; + x1=x-1; y1=y-2; x2=x+a.xl+1; y2=y+a.yl+2; + } + getset[1-cp].remember(r); + ox[cp]=x; oy[cp]=y; + if (homing) homestep(); + x=x+ix; y=y+iy; + if (check_me) {; + tc=checkfeet(x,x+a.xl,oy[cp],y,a.yl); + if (tc!=0) + { void& with = magics[tc]; + switch (op) { + case exclaim: {; bounce(); dixi('x',data); } break; + case bounces: bounce(); break; + case transport: fliproom(hi(data),lo(data)); break; + case unfinished: {; + bounce(); + display("\7Sorry.\3\rThis place is not avaliable yet!"); + } + break; + }} + } + count += 1; + if (((ix!=0) || (iy!=0)) && (count>1)) + {; + step += 1; if (step==a.seq) step=0; count=0; + } +} + +void triptype::bounce() +{; x=ox[cp]; y=oy[cp]; stopwalk(); return; } + +void triptype::walkto(integer xx,integer yy) +{; + speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; +} + +void triptype::stophoming() +{; + homing=false; +} + +void triptype::homestep() +{ + integer temp; +; + if ((hx==x) && (hy==y)) + {; /* touching the target */ + homing=false; return; + } + ix=0; iy=0; + if (hy!=y) + {; + temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; + } + if (hx!=x) + {; + temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; + } +} + +void triptype::speed(shortint xx,shortint yy) +{; + ix=xx; iy=yy; + if ((ix==0) && (iy==0)) return; /* no movement */ + if (ix==0) + {; /* No horz movement */ + if (iy<0) turn(up); else turn(down); + } else + {; + if (ix<0) turn(left); else turn(right); + } +} + +void triptype::stopwalk() +{; + ix=0; iy=0; homing=false; +} + +void triptype::chatter() +{; + talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; +} + +getsettype* getsettype::init() +{; + numleft=0; /* initialise array pointer */ + return this; +} + +void getsettype::remember(fieldtype r) +{; + numleft += 1; + gs[numleft]=r; +} + +void getsettype::recall(fieldtype& r) +{; + r=gs[numleft]; + numleft -= 1; +} + +void rwsp(byte t,byte r) +{ + const integer xs = 3; const integer ys = 1; +; + { triptype& with = tr[t]; switch (r) { + case up: speed( 0,-ys); break; case down: speed( 0, ys); break; case left: speed(-xs, 0); break; + case right: speed( xs, 0); break; case ul: speed(-xs,-ys); break; case ur: speed( xs,-ys); break; + case dl: speed(-xs, ys); break; case dr: speed( xs, ys); break; + }} +} + +void apped(byte trn,byte np) +{; + { + triptype& with = tr[trn]; + ; { void& with1 = peds[np]; appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir);} + rwsp(trn,tr[trn].face); } +} + +void getback() +{ + byte fv; + fieldtype r; +; + { getsettype& with = getset[1-cp]; + while (with.numleft>0) + {; + recall(r); + mblit(x1,y1,x2,y2,3,1-cp); + }} +} + +void trippancy_link() +{ + byte fv; +; + if ((ddm_o.menunow) | ontoolbar | seescroll | (~ alive)) return; + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) getback();} + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) walk();} + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick && with.visible) andexor();} +} + +void stopwalking() +{; + tr[1].stopwalk(); dna.rw=stopped; +} + +void tripkey(char dir) +{; + if (ctrl==cjoy) return; + + { triptype& with = tr[1]; + {; + switch (dir) { + case 'H': if (rw!=up) + {; rw=up; rwsp(1,rw); } else stopwalking(); + break; + case 'P': if (rw!=down) + {; rw=down; rwsp(1,rw); } else stopwalking(); + break; + case 'K': if (rw!=left) + {; rw=left; rwsp(1,rw); } else stopwalking(); + break; + case 'M': if (rw!=right) + {; rw=right; rwsp(1,rw); } else stopwalking(); + break; + case 'I': if (rw!=ur) + {; rw=ur; rwsp(1,rw); } else stopwalking(); + break; + case 'Q': if (rw!=dr) + {; rw=dr; rwsp(1,rw); } else stopwalking(); + break; + case 'O': if (rw!=dl) + {; rw=dl; rwsp(1,rw); } else stopwalking(); + break; + case 'G': if (rw!=ul) + {; rw=ul; rwsp(1,rw); } else stopwalking(); + break; + case 'L': stopwalking(); break; + } + }} +} + +void getsetclear() +{ + byte fv; +; + for( fv=0; fv <= 1; fv ++) getset[fv].init(); +} + +void fliproom(byte room,byte ped) +{; + dusk; getsetclear(); enterroom(room); apped(1,ped); + oldrw=dna.rw; dna.rw=tr[1].face; showrw; dawn; +} + +boolean infield(byte x) /* returns True if you're within field "x" */ +{ + integer yy; +boolean infield_result; +; + { void& with = fields[x]; { + triptype& with = tr[1]; + ; + yy=with.y+with.a.yl; + infield_result=(with.x>=x1) && (with.x<=x2) && (yy>=y1) && (yy<=y2); + }} +return infield_result; +} + +boolean neardoor() /* returns True if you're near a door! */ +{ + integer ux,uy; byte fv; boolean nd; +boolean neardoor_result; +; + if (numfields<9) + {; /* there ARE no doors here! */ + neardoor_result=false; + return neardoor_result; + } + { + triptype& with = tr[1]; + ; + ux=with.x; + uy=with.y+with.a.yl; + } nd=false; + for( fv=9; fv <= numfields; fv ++) + { + void& with = fields[fv]; + ; + if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; + } + neardoor_result=nd; +return neardoor_result; +} + +void readstick() +{ + byte jw; +; + if (ctrl==ckey) return; + + jw=joyway; + + { + triptype& with = tr[1]; + ; + if (jw==stopped) stopwalking(); else + {; + dna.rw=jw; rwsp(1,dna.rw); + } + } + + if (jw!=oldjw) + {; + showrw; + oldjw=jw; + } + +} + +class unit_trip42_initialize { + public: unit_trip42_initialize(); +}; +static unit_trip42_initialize trip42_constructor; + +unit_trip42_initialize::unit_trip42_initialize() {; + getsetclear(); +} diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h new file mode 100644 index 000000000000..b5e4f1361485 --- /dev/null +++ b/engines/avalanche/trip42.h @@ -0,0 +1,90 @@ +#ifndef __trip42_h__ +#define __trip42_h__ + +/* {$R+ but switch it off soon...} */ + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Gyro.h"*/ +/*#include "Sticks.h"*/ + + +const integer maxgetset = 10; + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +class triptype { +public: + adxtype a; /* vital statistics */ + byte face,step; + integer x,y; /* current xy coords */ + array<0,1,integer> ox,oy; /* last xy coords */ + shortint ix,iy; /* amount to move sprite by, each step */ + matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ + boolean quick,visible,homing,check_me; + integer hx,hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + + triptype* init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx,integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(integer xx,integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ +}; + +class getsettype { +public: + array<1,maxgetset,fieldtype> gs; + byte numleft; + + getsettype* init(); + void remember(fieldtype r); + void recall(fieldtype& r); +}; + +const integer numtr = 5; /* current max no. of sprites */ + +void trippancy_link(); + +void loadtrip(); + +void tripkey(char dir); + +void apped(byte trn,byte np); + +void fliproom(byte room,byte ped); + +boolean infield(byte x); /* returns True if you're within field "x" */ + +boolean neardoor(); /* returns True if you're near a door! */ + +void readstick(); + + +#ifdef __trip42_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,numtr,triptype> tr; +EXTERN array<0,1,getsettype> getset; +#undef EXTERN +#define EXTERN extern + + +#endif diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp new file mode 100644 index 000000000000..3674b1ffd745 --- /dev/null +++ b/engines/avalanche/trip5.cpp @@ -0,0 +1,1888 @@ +#include "ptoc.h" + +/* + + + + + TRIP5 Trippancy V */ + +#define __trip5_implementation__ + /* Trippancy V */ /* Define NOASM to use Pascal instead of asm. */ +/*$S- Fast!*/ +#include "trip5.h" + + +/*#include "Scrolls.h"*/ +/*#include "Lucerna.h"*/ +/*#include "Dropdown.h"*/ +/*#include "Visa.h"*/ +/*#include "Celer.h"*/ +/*#include "Timeout.h"*/ +/*#include "Sequence.h"*/ +/*#include "Enid.h"*/ + + +void loadtrip() +{ + byte gm; + + for( gm=1; gm <= numtr; gm ++) tr[gm].original(); + fillchar(aa,sizeof(aa),'\0'); +} + +byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) +{ + byte a,c; integer fv,ff; + +/* if not alive then begin checkfeet:=0; exit; end;*/ + byte checkfeet_result; + a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; + if (oya) a=c; + } else + for( fv=x1; fv <= x2; fv ++) + for( ff=y+yl; ff <= oy+yl; ff ++) + { + c=getpixel(fv,ff); + if (c>a) a=c; + } + checkfeet_result=a; setactivepage(1-cp); + return checkfeet_result; +} + +byte geida_ped(byte which) +{ + byte geida_ped_result; + switch (which) { + case 1: geida_ped_result= 7; break; + case 2:case 6: geida_ped_result= 8; break; + case 3:case 5: geida_ped_result= 9; break; + case 4: geida_ped_result=10; break; + } + return geida_ped_result; +} + +void catamove(byte ped) + /* When you enter a new position in the catacombs, this procedure should + be called. It changes the Also codes so that they may match the picture + on the screen. (Coming soon: It draws up the screen, too.) */ +{ + longint here; + word xy_word; + byte fv,ff; + +/* XY_word is cat_x+cat_y*256. Thus, every room in the + catacombs has a different number for it. */ + + + { + xy_word=cat_x+cat_y*256; + geida_spin=0; + } + switch (xy_word) { + case 1801: { /* Exit catacombs */ + fliproom(r__lustiesroom,4); + display("Phew! Nice to be out of there!"); + return; + } + break; + case 1033: { /* Oubliette */ + fliproom(r__oubliette,1); + display("Oh, NO!\231\2"); + return; + } + break; + case 4: { + fliproom(r__geidas,1); + return; + } + break; + case 2307: { + fliproom(r__lusties,5); + display("Oh no... here we go again..."); + dna.user_moves_avvy=false; + tr[1].iy=1; tr[1].ix=0; + return; + } + break; + } + + if (~ dna.enter_catacombs_from_lusties_room) load(29); + here=catamap[cat_y][cat_x]; + + switch (here & 0xf) { /* West. */ + case 0: { /* no connection (wall) */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=nix; /* Door. */ + show_one(28); + } + break; + case 0x1: { /* no connection (wall + shield), */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=nix; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(29); /* ...shield. */ + } + break; + case 0x2: { /* wall with door */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door. */ + } + break; + case 0x3: { /* wall with door and shield */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(29); /* ...shield. */ + } + break; + case 0x4: { /* no connection (wall + window), */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=nix; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(5); /* ...window. */ + } + break; + case 0x5: { /* wall with door and window */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(5); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=nix; /* No door. */ + show_one(28); /* Wall, plus... */ + show_one(7); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + magics[2].op=bounces; /* Sloping wall. */ + magics[3].op=nix; /* Straight wall. */ + portals[13].op=special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(7); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + magics[2].op=nix; /* Sloping wall. */ + magics[3].op=special; /* Straight wall. */ + } + break; + } + + /* ---- */ + + switch ((cardinal)(here & 0xf0) >> 4) { /* East */ + case 0: { /* no connection (wall) */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=nix; /* Door. */ + show_one(19); + } + break; + case 0x1: { /* no connection (wall + window), */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=nix; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(20); /* ...window. */ + } + break; + case 0x2: { /* wall with door */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(21); /* ...door. */ + } + break; + case 0x3: { /* wall with door and window */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(20); /* ...door, and... */ + show_one(21); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=nix; /* No door. */ + show_one(19); /* Wall, plus... */ + show_one(18); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + magics[5].op=bounces; /* Sloping wall. */ + magics[6].op=nix; /* Straight wall. */ + portals[15].op=special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(21); /* ...door, and... */ + show_one(18); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + magics[5].op=nix; /* Sloping wall. */ + magics[6].op=special; /* Straight wall. */ + portals[15].op=nix; /* Door. */ + } + break; + } + + /* ---- */ + + switch ((cardinal)(here & 0xf00) >> 8) { /* South */ + case 0: { /* No connection. */ + magics[7].op=bounces; + magics[12].op=bounces; + magics[13].op=bounces; + } + break; + case 0x1: { + show_one(22); + { void& with = magics[13]; + if ((xy_word==2051) & (dna.geida_follows)) + op=exclaim; + else op=special;} /* Right exit south. */ + magics[7].op=bounces; + magics[12].op=bounces; + } + break; + case 0x2: { + show_one(23); + magics[7].op=special; /* Middle exit south. */ + magics[12].op=bounces; + magics[13].op=bounces; + } + break; + case 0x3: { + show_one(24); + magics[12].op=special; /* Left exit south. */ + magics[7].op=bounces; + magics[13].op=bounces; + } + break; + } + + switch ((cardinal)(here & 0xf000) >> 12) { /* North */ + case 0: { /* No connection */ + magics[1].op=bounces; + portals[12].op=nix; /* Door. */ + } + break; + /* LEFT handles: */ +/* $1: begin + show_one(4); + magics[1].op:=bounces; { Left exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end;*/ + case 0x2: { + show_one(4); + magics[1].op=bounces; /* Middle exit north. */ + portals[12].op=special; /* Door. */ + } + break; +/* $3: begin + show_one(4); + magics[1].op:=bounces; { Right exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end; + { RIGHT handles: } + $4: begin + show_one(3); + magics[1].op:=bounces; { Left exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end;*/ + case 0x5: { + show_one(3); + magics[1].op=bounces; /* Middle exit north. */ + portals[12].op=special; /* Door. */ + } + break; +/* $6: begin + show_one(3); + magics[1].op:=bounces; { Right exit north. } + portals[12].op:=special; { Door. } + end;*/ + /* ARCHWAYS: */ + case 0x7:case 0x8:case 0x9: { + show_one(6); + + if (((cardinal)(here & 0xf000) >> 12)>0x7) show_one(31); + if (((cardinal)(here & 0xf000) >> 12)==0x9) show_one(32); + + magics[1].op=special; /* Middle arch north. */ + portals[12].op=nix; /* Door. */ + } + break; + /* DECORATIONS: */ + case 0xd: { /* No connection + WINDOW */ + magics[1].op=bounces; + portals[12].op=nix; /* Door. */ + show_one(14); + } + break; + case 0xe: { /* No connection + TORCH */ + magics[1].op=bounces; + portals[12].op=nix; /* Door. */ + show_one(8); + } + break; + /* Recessed door: */ + case 0xf: { + magics[1].op=nix; /* Door to Geida's room. */ + show_one(1); + portals[12].op=special; /* Door. */ + } + break; + } + + switch (xy_word) { + case 514: show_one(17); break; /* [2,2] : "Art Gallery" sign over door. */ + case 264: show_one(9); break; /* [8,1] : "The Wrong Way!" sign. */ + case 1797: show_one(2); break; /* [5,7] : "Ite Mingite" sign. */ + case 258: for( fv=0; fv <= 2; fv ++) /* [2,1] : Art gallery - pictures */ + { + show_one_at(15,130+fv*120,70); + show_one_at(16,184+fv*120,78); + } + break; + case 1287: for( fv=10; fv <= 13; fv ++) show_one(fv); break; /* [7,5] : 4 candles. */ + case 776: show_one(10); break; /* [8,3] : 1 candle. */ + case 2049: show_one(11); break; /* [1,8] : another candle. */ + case 257: { show_one(12); show_one(13); } break; /* [1,1] : the other two. */ + } + + if ((dna.geida_follows) & (ped>0)) + { + triptype& with = tr[2]; + + if (! with.quick) /* If we don't already have her... */ + tr[2].init(5,true); /* ...Load Geida. */ + apped(2,geida_ped(ped)); + tr[2].call_eachstep =true; + tr[2].eachstep=procgeida_procs; + } +} + +void call_special(word which); + + /* This proc gets called whenever you touch a line defined as Special. */ +static void dawndelay() + { set_up_timer(2,procdawn_delay,reason_dawndelay); } + +void call_special(word which) +{ + switch (which) { + case 1: { /* Special 1: Room 22: top of stairs. */ + show_one(1); + dna.brummie_stairs=1; + magics[10].op=nix; + set_up_timer(10,procstairs,reason_brummiestairs); + stopwalking(); + dna.user_moves_avvy=false; + } + break; + case 2: { /* Special 2: Room 22: bottom of stairs. */ + dna.brummie_stairs=3; + magics[11].op=nix; + magics[12].op=exclaim; + magics[12].data=5; + magics[4].op=bounces; /* Now works as planned! */ + stopwalking(); + dixi('q',26); + dna.user_moves_avvy=true; + } + break; + case 3: { /* Special 3: Room 71: triggers dart. */ + tr[1].bounce(); /* Must include that. */ + + if (~ dna.arrow_triggered) + { + dna.arrow_triggered=true; + apped(2,4); /* The dart starts at ped 4, and... */ + tr[2].walkto(5); /* flies to ped 5. */ + tr[2].face=0; /* Only face. */ + /* Should call some kind of Eachstep procedure which will deallocate + the sprite when it hits the wall, and replace it with the chunk + graphic of the arrow buried in the plaster. */ + /* OK! */ + tr[2].call_eachstep=true; + tr[2].eachstep=procarrow_procs; + } + } + break; + + case 4: { /* This is the ghost room link. */ + dusk; + tr[1].turn(right); /* you'll see this after we get back from bootstrap */ + set_up_timer(1,procghost_room_phew,reason_ghost_room_phew); + back_to_bootstrap(3); + } + break; + + case 5: if (dna.friar_will_tie_you_up) + { /* Special 5: Room 42: touched tree, and get tied up. */ + magics[4].op=bounces; /* Boundary effect is now working again. */ + dixi('q',35); + tr[1].done(); + /*tr[1].vanishifstill:=true;*/ + show_one(2); + dixi('q',36); + dna.tied_up=true; + dna.friar_will_tie_you_up=false; + tr[2].walkto(3); + tr[2].vanishifstill=true; + tr[2].check_me=true; /* One of them must have Check_Me switched on. */ + whereis[pfriartuck]=177; /* Not here, then. */ + set_up_timer(364,prochang_around,reason_hanging_around); + } + break; + + case 6: { /* Special 6: fall down oubliette. */ + dna.user_moves_avvy=false; + tr[1].ix=3; + tr[1].iy=0; + tr[1].face=right; + set_up_timer(1,procfall_down_oubliette,reason_falling_down_oubliette); + } + break; + + case 7: { /* Special 7: stop falling down oubliette. */ + tr[1].visible=false; + magics[10].op=nix; + stopwalking(); + lose_timer(reason_falling_down_oubliette); + mblit(12,80,38,160,3,0); + mblit(12,80,38,160,3,1); + display("Oh dear, you seem to be down the bottom of an oubliette."); + set_up_timer(200,procmeet_avaroid,reason_meeting_avaroid); + } + break; + + case 8: /* Special 8: leave du Lustie's room. */ + if ((geida_follows) & (~ lustie_is_asleep)) + { + dixi('q',63); + tr[2].turn(down); tr[2].stopwalk(); tr[2].call_eachstep=false; /* Geida */ + gameover; + } + break; + + case 9: { /* Special 9: lose Geida to Robin Hood... */ + if (~ dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + tr[2].call_eachstep=false; /* She no longer follows Avvy around. */ + tr[2].walkto(4); /* She walks to somewhere... */ + tr[1].done(); /* Lose Avvy. */ + dna.user_moves_avvy=false; + set_up_timer(40,procrobin_hood_and_geida,reason_robin_hood_and_geida); + } + break; + + case 10: { /* Special 10: transfer north in catacombs. */ + if ((dna.cat_x==4) && (dna.cat_y==1)) + { /* Into Geida's room. */ + if (dna.obj[key]) dixi('q',62); else + { + dixi('q',61); + return; + } + } + dusk; + dna.cat_y -= 1; + catamove(4); if (dna.room!=r__catacombs) return; + delavvy; + switch ((cardinal)(catamap[cat_y][cat_x] & 0xf00) >> 8) { + case 0x1: apped(1,12); break; + case 0x3: apped(1,11); break; + default: apped(1,4); + } + getback(); + dawndelay(); + } + break; + case 11: { /* Special 11: transfer east in catacombs. */ + dusk; + dna.cat_x += 1; + catamove(1); if (dna.room!=r__catacombs) return; + delavvy; + apped(1,1); + getback(); + dawndelay(); + } + break; + case 12: { /* Special 12: transfer south in catacombs. */ + dusk; + dna.cat_y += 1; + catamove(2); if (dna.room!=r__catacombs) return; + delavvy; + apped(1,2); + getback(); + dawndelay(); + } + break; + case 13: { /* Special 13: transfer west in catacombs. */ + dusk; + dna.cat_x -= 1; + catamove(3); if (dna.room!=r__catacombs) return; + delavvy; + apped(1,3); + getback(); + dawndelay(); + } + break; + } +} + +void hide_in_the_cupboard(); + +void open_the_door(byte whither,byte ped,byte magicnum) + /* This slides the door open. (The data really ought to be saved in + the Also file, and will be next time. However, for now, they're + here.) */ +{ + switch (dna.room) { + case r__outsideyours:case r__outsidenottspub:case r__outsideducks: + { + first_show(1); + then_show(2); + then_show(3); + } + break; + case r__insidecardiffcastle: + { + first_show(1); + then_show(5); + } + break; + case r__avvysgarden:case r__entrancehall:case r__insideabbey: + { + first_show(1); + then_show(2); + } + break; + case r__musicroom:case r__outsideargentpub: + { + first_show(5); + then_show(6); + } + break; + case r__lusties: + switch (magicnum) { + case 14: if (dna.avvys_in_the_cupboard) + { + hide_in_the_cupboard(); + first_show(8); then_show(7); + start_to_close; + return; + } else + { + apped(1,6); + tr[1].face=right; /* added by TT 12/3/1995 */ + first_show(8); then_show(9); + } + break; + case 12: { + first_show(4); then_show(5); then_show(6); + } + break; + } + break; + } + + then_flip(whither,ped); + start_to_open; +} + +void newspeed() + /* Given that you've just changed the speed in triptype.xs, this adjusts + ix. */ +{ + const bytefield lightspace = {40, 199, 47, 199}; + byte page_; + + { + triptype& with = tr[1]; + + with.ix=(with.ix / 3)*with.xs; + setactivepage(3); + + setfillstyle(1,14); + if (with.xs==run) bar(371,199,373,199); else bar(336,199,338,199); + setfillstyle(1,9); + if (with.xs==run) bar(336,199,338,199); else bar(371,199,373,199); + + setactivepage(1-cp); + for( page_=0; page_ <= 1; page_ ++) getset[page_].remember(lightspace); + } +} + +triptype* triptype::init(byte spritenum, boolean do_check) +{ + const integer idshould = -1317732048; + integer gd,gm; varying_string<2> xx; + byte fv/*,nds*/; + byte aa,bb; + longint id; word soa; + untyped_file inf; + + if (spritenum==177) return; /* Already running! */ + str(spritenum,xx); assign(inf,string("sprite")+xx+".avd"); + reset(inf,1); + seek(inf,177); + blockread(inf,id,4); + if (id!=idshould) + { + output << '\7'; + close(inf); + exit(0); + } + + blockread(inf,soa,2); + blockread(inf,a,soa); + + { + adxtype& with = a; + + /*nds:=num div seq;*/ totalnum=1; + xw=with.xl / 8; if ((with.xl % 8)>0) xw += 1; + for( aa=1; aa <= /*nds*seq*/with.num; aa ++) + { + getmem(sil[totalnum],11*(with.yl+1)); + getmem(mani[totalnum],with.size-6); + for( fv=0; fv <= with.yl; fv ++) + { + blockread(inf,(*sil[totalnum])[fv],xw); + } + blockread(inf,*mani[totalnum],with.size-6); + totalnum += 1; + } + } + + /* on; */ + x=0; y=0; quick=true; visible=false; xs=3; ys=1; +/* if spritenum=1 then newspeed; { Just for the lights. }*/ + + homing=false; ix=0; iy=0; step=0; check_me=do_check; + count=0; whichsprite=spritenum; vanishifstill=false; + call_eachstep=false; + close(inf); + return this; +} + +void triptype::original() +{ + quick=false; whichsprite=177; +} + +void triptype::andexor() +{ + byte picnum; /* Picnum, Picnic, what ye heck */ + byte lay,laz; /* Limits for Qaz and Qay or equivs. (Laz always = 3). */ +#ifdef NOASM + word offs,fv; + byte qax,qay,qaz; +#else + word segmani,ofsmani; + word ofsaa,realofsaa; + word segsil,ofssil; + word z; byte xwidth; + +#endif + + if ((vanishifstill) && (ix==0) && (iy==0)) return; + picnum=face*a.seq+step+1; + + { + adxtype& with = a; + + getimage(x,y,x+with.xl,y+with.yl,aa); /* Now loaded into our local buffer. */ + + /* Now we've got to modify it! */ + + /* Qaz ranges over the width of the sprite/8. + Qay " " the height. + Qax " " 1 to 4 (the planes). */ + + { + adxtype& with1 = a; + + #ifdef NOASM + laz=xw-1; lay=with1.yl; /* -1's only for Pascal. */ + #else + laz=xw; lay=with1.yl+1; /* +1's only for ASM! */ + #endif + } + + /* ASSEMBLERISED: */ +#ifdef NOASM + for( qax=0; qax <= 3; qax ++) /* 3 */ + for( qay=0; qay <= lay; qay ++) /* 35 */ + for( qaz=0; qaz <= laz; qaz ++) /* 4 */ + { + offs=5+qay*xw*4+xw*qax+qaz; + aa[offs]=aa[offs] & (*sil[picnum])[qay][qaz]; + } + + for( fv=5; fv <= with.size-2; fv ++) + aa[fv]=aa[fv] ^ (*mani[picnum])[fv]; + +#else + /* OK, here's the same thing in assembler... + + AL is Qax, + BL is Qay, + CL is Qaz, + DX is Offs */ + + /* For the first part: */ + xwidth=xw; + segsil=seg(*sil[picnum]); + ofssil=ofs(*sil[picnum]); + + /* For the first and second parts: */ + segmani=seg(*mani[picnum]); /* It's easier to do this in Pascal, and */ + ofsmani=ofs(*mani[picnum])+1; /* besides it only goes round once here. */ + /* Segment of AA is always the current data segment. */ + ofsaa=ofs(aa)+5; + realofsaa=ofs(aa)-1; /* We may not need this. */ + z=with.size-7; +/* + asm + + xor ax,ax; { Initialise ax, bx, and cx, using a rather } + @QAXloop: { AL } + + xor bx,bx; { nifty speed trick. } + @QAYloop: { BL } + + xor cx,cx; + @QAZloop: { CL } + + { Right, well, here we are. We have to do some rather nifty array + manipulation, stuff like that. We're trying to assemblerise: + DX:= 5 + BX * xw * 4 + xw * AX + CX; + aa[DX]:=aa[DX] and sil[picnum]^[BL,CL]; } + + push ax; {AXcdx} { OK, we're going to do some strange things } + { with ax, so we'd better save it. } + mov dx,5; { First of all... set dx to 5. } + add dx,cx; { DX now = 5+CX } + mul xwidth; { Multiply ax by xw (the Pascal variable.) } + add dx,ax; { DX now = 5+CX+xw*AX } + + { Right. Mul only works on ax. Don't ask me why. Ask Intel. Anyway, + since ax is saved on the stack, we can move bx over it. Note that + if xw was a word, using mul would have destroyed the contents of + dx. NOT a good idea! } + + push cx; {CXmul} { We must just borrow cx for a second. } + mov ax,bx; { Make ax = bx. } + mul xwidth; { Do the same to it as we did to ax before. } + mov cl,2; + shl ax,cl; { And multiply it by 4 (i.e., shl it by 2.) } + add dx,ax; { DX now = 5+CX+xw*AX+xw*BX*4. That's OK. } + + pop cx; {CXmul} + pop ax; {AXcdx} { Now we have to get ax and cx back again. } + + { Registers are now returned to original status. } + + { Righto. DX is now all worked out OK. We must now find out the + contents of: 1) aa[dx], and 2) (harder) sil[picnum]^[BL,CL]. Gulp. } + + { DS already points to the segment of AA. So... let's use CL to + put aa[dx] in, and use BX for the offset. Looks like we're going + to have to push a few registers! } + + push ax; { AXaa. Saving loop value of AX. } + { Let's use ax to do our dirty work with. } + push dx; { Saving Offs(DX.) } + + push bx; { BXaa. Saving loop value of BX. } + + mov bx,realofsaa; { aa is now pointed to by [ds:bx]. } + add bx,dx; { Offset is dx bytes. } + mov dl,[bx]; { cl now holds the contents of aa[dx]. } + + pop bx; { BXaa. Restoring loop value of BX. } + + { Stack now holds: Offs(DX). } + + { ^^^ That works. Now to find sil[picnum]^[BL,CL]. Our first task is + to find the address of sil[picnum]^. Since it's dynamic, we must + push and pop ds. } + + push ds; { DXaa. Saving value of Trip5's data segment. } + { Push ds. Now we can put the segment of sil[picnum]^... } + mov ds,segsil; { ...into ds, and... } + mov ax,ofssil; { ...its offset into ax. } + { Addr of sil[picnum]^ is now in [ds:ax]. BUT we want a particular + offset: to wit, [BL,CL]. Now, siltype is defined so that this offset + will be at an offset of (BL*11)+CL. } + + push bx; { Saving loop value of BX. } + push cx; { Saving loop value of CX. } + push ax; { Saving offset of sil[picnum]^. } + { Save them for a bit (!) } + mov al,bl; { Put bl into al. } + mov bl,11; { ... } + mul bl; { ...times it by 11. } + mov bx,ax; { Put it back into bx (now = bx*11) } + pop ax; { Restoring offset of sil[picnum]^. } + { Get ax back again. } + add ax,bx; { Add (original bl)*11 to al. } + add ax,cx; { Add cl to al. } + { AX now holds the offset of sil[picnum]^[bx,cl]. } + + { Stack now holds: loop value of AX, Trip5's DS, lv of BX, lv of CX. } + + { Right. Now the address of sil[picnum]^[bl,cl] is in [ds:ax]. Let's + get the elusive byte itself, and put it into ax. Firstly, we must + swap ax and bx. } + + xchg ax,bx; + mov al,[bx]; { AX now contains sil[picnum]^[bl,cl], AT LAST!! } + + { So now AL contains the sil stuff, and DL holds aa[offs]. } + + and al,dl; { aa[offs]:=aa[offs] and sil[picnum]^[Qay,Qaz]. } + + pop cx; { Restoring loop value of CX. } + pop bx; { Restoring loop value of BX. } + pop ds; { Restore value of Trip5's data segment. } + + { Right. AL contains the byte we need to replace aa[offs] with. + All that's left to do is to put it back. Remember that we already + have the segment of aa in the current DS, so... } + + pop dx; { Restore Offs(DX). } + + { Stack is now as when we entered the loop. Since this copy of DX + is now being used for the last time, we can muck around with it. } + + { Recap: DX now holds the offset from the start of AA. If we add + the offset of aa to it, we'll get the offset of the byte we want. + DS is already set up. } + + push bx; { I'm just borrowing bx for a sec. I'll put it back in 5 lines.} + mov bx,realofsaa; + add dx,bx; { Now aa[offs] is at aa[ds:dx]. } + mov bx,dx; { But we can't address memory with dx, so use bx. } + mov [bx],al; { Shove it into the memory! } + pop bx; { See! I said I would. } + + pop ax; { Restore loop value of AX. } + + { Right, the fancy stuff's all done now. Finish off the loop code. } + + inc cl; + cmp cl,laz; { CL must not reach 5. Does it? } + jnz @QAZloop; { no, keep going around the QAZloop. } + + inc bl; + cmp bl,lay; { BL must not reach 36. Does it? } + jnz @QAYloop; { no, keep going around the QAYloop. } + + inc al; + cmp al,4; { AL must not reach 4. Does it? } + jnz @QAXloop; { no, keep going around the QAXloop. } + + { al, bl and cl are now at their maxima, so we can stop the loops. } + + { *** SECOND ASSEMBLER BIT. *** } + + mov cx,z; { Find the size of the array, -7. } + mov bx,ofsmani; { Now find the offset and put that into bx. } + mov dx,ofsaa; { We'll use dx to be the same as fv, +5. } + + { DS should already hold the segment of aa. } + + @nextbyte: { Main loop... } + + { Firstly, we must get hold of aa[fv] (here called aa[dx].)} + push bx; { We need to "borrow" bx for a second... } + mov bx,dx; { Wrong register- shove it into bx. } + mov al,[bx]; { Get aa[fv] and put it into al. } + pop bx; { Right, you can have bx back again. } + + { Secondly, we must get hold of mani[picnum]^[fv]. } + push cx; { Let's borrow cx for this one. } + push ds; { we must use ds to point to segmani. } + mov ds,segmani; { Find the segment of mani[picnum]^, } + mov cl,[bx]; { now get the byte at [ds:bx] and put it into cl. } + pop ds; { Put ds back to being the current data segment. } + + { Right: now we can do what we came here for in the first place. + AL contains aa[fv], CL contains mani[picnum]^[fv]. } + + xor al,cl; { Xor al with bl. That's it! } + + pop cx; { We don't need cx any more for this now. } + + push bx; { Borrow bx... } + mov bx,dx; { Put dx into bx. } + mov [bx],al; { Put the changed al back into [ds:bx] (ie, [ds:dx].} + pop bx; { Get it back. } + + inc bx; { Add one to bx, for the next char. } + inc dx; { And dx, for the same reason. } + + loop @nextbyte; { Keep going round until cx=0. } +*/ +{; +} +#endif + + /* Now.. let's try pasting it back again! */ + + putimage(x,y,aa,0); + } +} + +void triptype::turn(byte whichway) +{ + if (whichway==8) face=0; else face=whichway; +} + +void triptype::appear(integer wx,integer wy, byte wf) +{ + x=(wx / 8)*8; y=wy; ox[cp]=wx; oy[cp]=wy; turn(wf); + visible=true; ix=0; iy=0; +} + + + + +static boolean collision_check() +{ + byte fv; + + boolean collision_check_result; + for( fv=1; fv <= numtr; fv ++) + if (tr[fv].quick && (tr[fv].whichsprite!=whichsprite) && + ((x+a.xl)>tr[fv].x) && + (x<(tr[fv].x+tr[fv].a.xl)) && + (tr[fv].y==y)) + { + collision_check_result=true; + return collision_check_result; + } + collision_check_result=false; + return collision_check_result; +} + +void triptype::walk() +{ + byte tc; bytefield r; + + + if (visible) + { + { + x1=(x / 8)-1; + if (x1==255) x1=0; + y1=y-2; + x2=((x+a.xl) / 8)+1; + y2=y+a.yl+2; + } + getset[1-cp].remember(r); + } + + if (~ doing_sprite_run) + { + ox[cp]=x; oy[cp]=y; + if (homing) homestep(); + x=x+ix; y=y+iy; + } + + if (check_me) + { + if (collision_check()) + { + bounce(); + return; + } + + tc=checkfeet(x,x+a.xl,oy[cp],y,a.yl); + + if ((tc!=0) & (~ doing_sprite_run)) + { void& with = magics[tc]; + switch (op) { + case exclaim: { + bounce(); mustexclaim=true; saywhat=data; + } + break; + case bounces: bounce(); break; + case transport: fliproom(hi(data),lo(data)); break; + case unfinished: { + bounce(); + display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case special: call_special(data); break; + case mopendoor: open_the_door(hi(data),lo(data),tc); break; + }} + } + + if (~ doing_sprite_run) + { + count += 1; + if (((ix!=0) || (iy!=0)) && (count>1)) + { + step += 1; if (step==a.seq) step=0; count=0; + } + } + +} + +void triptype::bounce() +{ + x=ox[cp]; y=oy[cp]; + if (check_me) stopwalking(); else stopwalk(); + oncandopageswap=false; + showrw; + oncandopageswap=true; +} + +shortint sgn(integer x) +{ + shortint sgn_result; + if (x>0) sgn_result=1; else + if (x<0) sgn_result=-1; else + sgn_result=0; /* x=0 */ + return sgn_result; +} + +void triptype::walkto(byte pednum) +{ + speed(sgn(peds[pednum].x-x)*4,sgn(peds[pednum].y-y)); + hx=peds[pednum].x-a.xl / 2; + hy=peds[pednum].y-a.yl; homing=true; +} + +void triptype::stophoming() +{ + homing=false; +} + +void triptype::homestep() +{ + integer temp; + + if ((hx==x) && (hy==y)) + { /* touching the target */ + stopwalk(); + return; + } + ix=0; iy=0; + if (hy!=y) + { + temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; + } + if (hx!=x) + { + temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; + } +} + +void triptype::speed(shortint xx,shortint yy) +{ + ix=xx; iy=yy; + if ((ix==0) && (iy==0)) return; /* no movement */ + if (ix==0) + { /* No horz movement */ + if (iy<0) turn(up); else turn(down); + } else + { + if (ix<0) turn(left); else turn(right); + } +} + +void triptype::stopwalk() +{ + ix=0; iy=0; homing=false; +} + +void triptype::chatter() +{ + talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; +} + +void triptype::set_up_saver(trip_saver_type& v) +{ + v.whichsprite=whichsprite; + v.face=face; + v.step=step; + v.x=x; + v.y=y; + v.ix=ix; + v.iy=iy; + v.visible=visible; + v.homing=homing; + v.check_me=check_me; + v.count=count; + v.xw=xw; + v.xs=xs; + v.ys=ys; + v.totalnum=totalnum; + v.hx=hx; + v.hy=hy; + v.call_eachstep=call_eachstep; + v.eachstep=eachstep; + v.vanishifstill=vanishifstill; +} + +void triptype::unload_saver(trip_saver_type v) +{ + whichsprite=v.whichsprite; + face=v.face; + step=v.step; + x=v.x; + y=v.y; + ix=v.ix; + iy=v.iy; + visible=v.visible; + homing=v.homing; + check_me=v.check_me; + count=v.count; + xw=v.xw; + xs=v.xs; + ys=v.ys; + totalnum=v.totalnum; + hx=v.hx; + hy=v.hy; + call_eachstep=v.call_eachstep; + eachstep=v.eachstep; + vanishifstill=v.vanishifstill; +} + +void triptype::savedata(untyped_file& f) +{ + trip_saver_type tripsaver; + + set_up_saver(tripsaver); + + { + blockwrite(f,tripsaver.whichsprite,1); + blockwrite(f,tripsaver.face,1); blockwrite(f,tripsaver.step,1); + blockwrite(f,tripsaver.x,2); blockwrite(f,tripsaver.y,2); + blockwrite(f,tripsaver.ix,1); blockwrite(f,tripsaver.iy,1); + blockwrite(f,tripsaver.visible,1); + blockwrite(f,tripsaver.homing,1); + blockwrite(f,tripsaver.check_me,1); + blockwrite(f,tripsaver.count,1); + blockwrite(f,tripsaver.xw,1); + blockwrite(f,tripsaver.xs,1); blockwrite(f,tripsaver.ys,1); + blockwrite(f,tripsaver.totalnum,1); + blockwrite(f,tripsaver.hx,2); blockwrite(f,tripsaver.hy,2); + blockwrite(f,tripsaver.call_eachstep,1); + blockwrite(f,tripsaver.eachstep,1); + blockwrite(f,tripsaver.vanishifstill,1); + } +} + +void triptype::loaddata(untyped_file& f) +{ + word spritewas,spriteis,saveface,savex,savey,savestep; + boolean wasquick; + trip_saver_type tripsaver; + + + wasquick=quick; + quick=true; spritewas=whichsprite; + + { + blockread(f,tripsaver.whichsprite,1); + blockread(f,tripsaver.face,1); blockread(f,tripsaver.step,1); + blockread(f,tripsaver.x,2); blockread(f,tripsaver.y,2); + blockread(f,tripsaver.ix,1); blockread(f,tripsaver.iy,1); + + if ((! wasquick) || ((unsigned char)tripsaver.whichsprite!=spritewas)) + { + spriteis=tripsaver.whichsprite; + savex=tripsaver.x; savey=tripsaver.y; saveface=tripsaver.face; savestep=tripsaver.step; + + if (wasquick) done(); + + init(spriteis,tripsaver.check_me); + + appear(savex,savey,saveface); tripsaver.step=savestep; + } + + blockread(f,tripsaver.visible,1); + blockread(f,tripsaver.homing,1); + blockread(f,tripsaver.check_me,1); + blockread(f,tripsaver.count,1); + blockread(f,tripsaver.xw,1); + blockread(f,tripsaver.xs,1); blockread(f,tripsaver.ys,1); + blockread(f,tripsaver.totalnum,1); + blockread(f,tripsaver.hx,2); blockread(f,tripsaver.hy,2); + blockread(f,tripsaver.call_eachstep,1); + blockread(f,tripsaver.eachstep,1); + blockread(f,tripsaver.vanishifstill,1); + } + + unload_saver(tripsaver); +} + +triptype* triptype::done() +{ + integer gd,gm; varying_string<2> xx; + byte fv/*,nds*/; + byte aa,bb; + longint id; word soa; + + { + adxtype& with = a; + +/* nds:=num div seq;*/ + xw=with.xl / 8; if ((with.xl % 8)>0) xw += 1; + for( aa=1; aa <= /*nds*seq*/ with.num; aa ++) + { + totalnum -= 1; + freemem(mani[totalnum],with.size-6); + freemem(sil[totalnum],11*(with.yl+1)); /* <<- Width of a siltype. */ + } + } + + quick=false; whichsprite=177; + return this; +} + +getsettype* getsettype::init() +{ + numleft=0; /* initialise array pointer */ + return this; +} + +void getsettype::remember(bytefield r) +{ + numleft += 1; + if (numleft>maxgetset) runerror(runerr_getset_overflow); + gs[numleft]=r; +} + +void getsettype::recall(bytefield& r) +{ + r=gs[numleft]; + numleft -= 1; +} + +void rwsp(byte t,byte r) +{ + { triptype& with = tr[t]; switch (r) { + case up: speed( 0,-with.ys); break; case down: speed( 0, with.ys); break; case left: speed(-with.xs, 0); break; + case right: speed( with.xs, 0); break; case ul: speed(-with.xs,-with.ys); break; case ur: speed( with.xs,-with.ys); break; + case dl: speed(-with.xs, with.ys); break; case dr: speed( with.xs, with.ys); break; + }} +} + +void apped(byte trn,byte np) +{ + { triptype& with = tr[trn]; + { + void& with1 = peds[np]; + + appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir); + rwsp(trn,dir); + }} +} + +void getback(); + +static bytefield r; + + +/* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:word):boolean; + begin { By De Morgan's law: } + overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); + end;*/ + /* x1,x2 - as bytefield, but *8. y1,y2 - as bytefield. + x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ +static boolean overlaps_with_mouse() +{ + boolean overlaps_with_mouse_result; + overlaps_with_mouse_result= + (x2*8>=mx) && (mx+16>=x1*8) && (y2>=my) && (my+16>=y1); + return overlaps_with_mouse_result; +} + +void getback() +{ + byte fv; + boolean endangered; + + + endangered=false; +/* Super_Off;*/ + + { getsettype& with = getset[1-cp]; + while (with.numleft>0) + { + recall(r); + +/* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ + + mblit(x1,y1,x2,y2,3,1-cp); + }} + + blitfix; + /*if endangered then*/ /*Super_On;*/ +} + +/* Eachstep procedures: */ +void follow_avvy_y(byte tripnum) +{ + { + triptype& with = tr[tripnum]; + + if (tr[1].face==left) return; + if (with.homing) with.hy=tr[1].y; else + { + if (with.ytr[1].y) + with.y -= 1; else + return; + if (with.ix==0) { with.step += 1; if (with.step==with.a.seq) with.step=0; with.count=0; } + } + } +} + +void back_and_forth(byte tripnum) +{ + { triptype& with = tr[tripnum]; + if (! with.homing) + { + if (with.face==right) walkto(4); else walkto(5); + }} +} + +void face_avvy(byte tripnum) +{ + { triptype& with = tr[tripnum]; + if (! with.homing) + { + if (tr[1].x>=with.x) with.face=right; + else with.face=left; + }} +} + +void arrow_procs(byte tripnum) +{ + byte fv; + + { triptype& with = tr[tripnum]; + if (with.homing) + { /* Arrow is still in flight. */ + /* We must check whether or not the arrow has collided with Avvy's head. + This is so if: a) the bottom of the arrow is below Avvy's head, + b) the left of the arrow is left of the right of Avvy's head, and + c) the right of the arrow is right of the left of Avvy's head. */ + if (((with.y+with.a.yl)>=tr[1].y) /* A */ + && (with.x<=(tr[1].x+tr[1].a.xl)) /* B */ + && ((with.x+with.a.xl)>=tr[1].x)) /* C */ + { /* OK, it's hit him... what now? */ + + tr[2].call_eachstep=false; /* prevent recursion. */ + dixi('Q',47); /* Complaint! */ + done(); /* Deallocate the arrow. */ +/* tr[1].done; { Deallocate normal pic of Avvy. } + + off; + for fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on;*/ + + gameover; + + dna.user_moves_avvy=false; /* Stop the user from moving him. */ + set_up_timer(55,procnaughty_duke,reason_naughty_duke); + } + } else /* Arrow has hit the wall! */ + { + done(); /* Deallocate the arrow. */ + show_one(3); /* Show pic of arrow stuck into the door. */ + dna.arrow_in_the_door=true; /* So that we can pick it up. */ + }} +} + +/*procedure Spludwick_procs(tripnum:byte); +var fv:byte; +begin + with tr[tripnum] do + if not homing then { We only need to do anything if Spludwick *stops* + walking. } + with dna do + begin + inc(DogfoodPos); + if DogfoodPos=8 then DogfoodPos:=1; + walkto(DogfoodPos); + end; +end;*/ + +void grab_avvy(byte tripnum) /* For Friar Tuck, in Nottingham. */ +{ + byte fv; integer tox,toy; + + { triptype& with = tr[tripnum]; + { + tox=tr[1].x + 17; + toy=tr[1].y - 1; + if ((with.x==tox) && (with.y==toy)) + { + with.call_eachstep=false; + with.face=left; + stopwalk(); + /* ... whatever ... */ + } else + { /* Still some way to go. */ + if (with.xtox) with.x=tox; + } + if (with.y0) + { + dna.geida_time -= 1; + if (dna.geida_time==0) dna.geida_spin=0; + } + + if (with.y<(tr[1].y-2)) + { /* Geida is further from the screen than Avvy. */ + spin(down, tripnum); + with.iy=1; with.ix=0; + take_a_step(tripnum); + return; + } else + if (with.y>(tr[1].y+2)) + { /* Avvy is further from the screen than Geida. */ + spin(up, tripnum); + with.iy=-1; with.ix=0; + take_a_step(tripnum); + return; + } + + with.iy=0; + if (with.xtr[1].x+tr[1].xs*8) + { + with.ix=-tr[1].xs; + spin(left, tripnum); + take_a_step(tripnum); + } else with.ix=0; + } +} + +/* That's all... */ + +void call_andexors() +{ + array<1,5,byte> order; + byte fv,temp; + boolean ok; + + fillchar(order,5,'\0'); + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; + if (with.quick && with.visible) + order[fv]=fv;} + + do { + ok=true; + for( fv=1; fv <= 4; fv ++) + if (((order[fv]!=0) && (order[fv+1]!=0)) + && (tr[order[fv]].y>tr[order[fv+1]].y)) + { /* Swap them! */ + temp=order[fv]; + order[fv]=order[fv+1]; + order[fv+1]=temp; + ok=false; + } + } while (!ok); + + for( fv=1; fv <= 5; fv ++) + if (order[fv]>0) + tr[order[fv]].andexor(); +} + +void trippancy_link() +{ + byte fv; + + if (ddmnow | ontoolbar | seescroll) return; + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) walk();} + call_andexors(); + for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; + if (with.quick && with.call_eachstep) + { + switch (tr[fv].eachstep) { + case procfollow_avvy_y : follow_avvy_y(fv); break; + case procback_and_forth : back_and_forth(fv); break; + case procface_avvy : face_avvy(fv); break; + case procarrow_procs : arrow_procs(fv); break; +/* PROCSpludwick_procs : spludwick_procs(fv);*/ + case procgrab_avvy : grab_avvy(fv); break; + case procgeida_procs : geida_procs(fv); break; + } + }} + if (mustexclaim) + { + mustexclaim=false; + dixi('x',saywhat); + } +} + +void get_back_loretta() +{ + byte fv; + +/* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ + for( fv=1; fv <= numtr; fv ++) if (tr[fv].quick) + { + getback(); + return; + } +/* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ +} + +void stopwalking() +{ + tr[1].stopwalk(); dna.rw=stopped; if (alive) tr[1].step=1; +} + +void tripkey(char dir) +{ + if ((ctrl==cjoy) | (~ dna.user_moves_avvy)) return; + + { triptype& with = tr[1]; + { + switch (dir) { + case 'H': if (rw!=up) + { rw=up; rwsp(1,rw); } else stopwalking(); + break; + case 'P': if (rw!=down) + { rw=down; rwsp(1,rw); } else stopwalking(); + break; + case 'K': if (rw!=left) + { rw=left; rwsp(1,rw); } else stopwalking(); + break; + case 'M': if (rw!=right) + { rw=right; rwsp(1,rw); } else stopwalking(); + break; + case 'I': if (rw!=ur) + { rw=ur; rwsp(1,rw); } else stopwalking(); + break; + case 'Q': if (rw!=dr) + { rw=dr; rwsp(1,rw); } else stopwalking(); + break; + case 'O': if (rw!=dl) + { rw=dl; rwsp(1,rw); } else stopwalking(); + break; + case 'G': if (rw!=ul) + { rw=ul; rwsp(1,rw); } else stopwalking(); + break; + case 'L': stopwalking(); break; + } + }} +} + +void readstick() +{ + byte jw; + + if (ctrl==ckey) return; + + jw=joyway; + + { + triptype& with = tr[1]; + + if (jw==stopped) stopwalking(); else + { + dna.rw=jw; rwsp(1,dna.rw); + } + } + + if (jw!=oldjw) + { + showrw; + oldjw=jw; + } + +} + +void getsetclear() +{ + byte fv; + + for( fv=0; fv <= 1; fv ++) getset[fv].init(); +} + +void hide_in_the_cupboard() +{ + const char nowt = '\372'; /* As in Acci. */ + + { + if (avvys_in_the_cupboard) + { + if (wearing==nowt) + display("\6AVVY!\22 Get dressed first!"); + else + { + tr[1].visible=true; + user_moves_avvy=true; + apped(1,3); /* Walk out of the cupboard. */ + display("You leave the cupboard. Nice to be out of there!"); + avvys_in_the_cupboard=false; + first_show(8); then_show(7); start_to_close; + } + } else + { /* Not hiding in the cupboard */ + tr[1].visible=false; + user_moves_avvy=false; + display(string("You walk into the room...\20It seems to be an empty, ")+ + "but dusty, cupboard. Hmmmm... you leave the door slightly open to "+ + "avoid suffocation."); + avvys_in_the_cupboard=true; + show_one(8); + } + } +} + +void fliproom(byte room,byte ped); +static integer beforex,beforey; +static void tidy_after_mouse(); + + +static void tidy_up(integer a,integer b,integer c,integer d) +{ + bytefield bf; + + { + x1=a / 8; + y1=b; + x2=(c+7) / 8; + y2=d; + setactivepage(0); + rectangle(x1*8,y1,x2*8+7,y2); + } + getset[0].remember(bf); + getset[1].remember(bf); +} + + + +static void tidy_after_mouse() +{ + tidy_up(beforex,beforey,beforex+15,beforey+15); + xycheck; + tidy_up(mx,my,mx+15,my+15); +} + +void fliproom(byte room,byte ped) +{ + byte fv; + + + if (~ alive) + { /* You can't leave the room if you're dead. */ + tr[1].ix=0; tr[1].iy=0; /* Stop him from moving. */ + return; + } + + if ((ped==177) && (dna.room==r__lusties)) + { + hide_in_the_cupboard(); + return; + } + + if ((dna.jumpstatus>0) && (dna.room==r__insidecardiffcastle)) + { /* You can't *jump* out of Cardiff Castle! */ + tr[1].ix=0; + return; + } + + xycheck; beforex=mx; beforey=my; + + exitroom(dna.room); + dusk; getsetclear(); + + + for( fv=2; fv <= numtr; fv ++) + { triptype& with = tr[fv]; + if (with.quick) done();} /* Deallocate sprite */ + + if (dna.room==r__lustiesroom) + dna.enter_catacombs_from_lusties_room=true; + + enterroom(room,ped); apped(1,ped); + dna.enter_catacombs_from_lusties_room=false; + oldrw=dna.rw; dna.rw=tr[1].face; showrw; + + for( fv=0; fv <= 1; fv ++) + { + cp=1-cp; + getback(); + } + dawn; + + /* Tidy up after mouse. I know it's a kludge... */ +/* tidy_after_mouse;*/ +} + +boolean infield(byte which) + /* returns True if you're within field "which" */ +{ + integer yy; + + boolean infield_result; + { void& with = fields[which]; { + triptype& with = tr[1]; + + yy=with.y+with.a.yl; + infield_result=(with.x>=x1) && (with.x<=x2) && (yy>=y1) && (yy<=y2); + }} + return infield_result; +} + +boolean neardoor() /* returns True if you're near a door! */ +{ + integer ux,uy; byte fv; boolean nd; + + boolean neardoor_result; + if (numfields<9) + { /* there ARE no doors here! */ + neardoor_result=false; + return neardoor_result; + } + { + triptype& with = tr[1]; + + ux=with.x; + uy=with.y+with.a.yl; + } nd=false; + for( fv=9; fv <= numfields; fv ++) + { + void& with = fields[fv]; + + if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; + } + neardoor_result=nd; + return neardoor_result; +} + +void new_game_for_trippancy() /* Called by gyro.newgame */ +{ + tr[1].visible=false; +} + +void triptype::save_data_to_mem(word& where) +{ + trip_saver_type tripsaver; + + set_up_saver(tripsaver); + move(tripsaver,mem[storage_seg*where],sizeof(tripsaver)); + where += sizeof(tripsaver); +} + +void triptype::load_data_from_mem(word& where) +{ + word spritewas,spriteis,saveface,savex,savey,savestep; + boolean wasquick; + trip_saver_type tripsaver; + + move(mem[storage_seg*where],tripsaver,sizeof(tripsaver)); + where += sizeof(tripsaver); + unload_saver(tripsaver); + + spriteis=whichsprite; + savex=x; savey=y; saveface=face; savestep=step; + + init(spriteis,check_me); + + appear(savex,savey,saveface); unload_saver(tripsaver); + step=savestep; +} + +class unit_trip5_initialize { + public: unit_trip5_initialize(); +}; +static unit_trip5_initialize trip5_constructor; + +unit_trip5_initialize::unit_trip5_initialize() { + getsetclear(); mustexclaim=false; +} diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h new file mode 100644 index 000000000000..9e7b3a33bce6 --- /dev/null +++ b/engines/avalanche/trip5.h @@ -0,0 +1,175 @@ +#ifndef __trip5_h__ +#define __trip5_h__ + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Gyro.h"*/ +/*#include "Sticks.h"*/ + + +const integer maxgetset = 35; + +typedef array<5,2053,byte> manitype; + +typedef matrix<0,50,0,10,byte> siltype; /* 35, 4 */ + +struct adxtype { /* Second revision of ADX type */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +}; + +struct trip_saver_type { + byte whichsprite; + byte face; byte step; + integer x; integer y; + shortint ix; shortint iy; + boolean visible; + boolean homing; + boolean check_me; + byte count; + byte xw,xs,ys; + byte totalnum; + integer hx; integer hy; + boolean call_eachstep; + byte eachstep; + boolean vanishifstill; +}; + +class triptype { +public: + adxtype a; /* vital statistics */ + byte face,step; + integer x,y; /* current xy coords */ + array<0,1,integer> ox,oy; /* last xy coords */ + shortint ix,iy; /* amount to move sprite by, each step */ + array<1,24,manitype*> mani; + array<1,24,siltype*> sil; + byte whichsprite; + boolean quick,visible,homing,check_me; + integer hx,hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + byte xw; /* x-width in bytes */ + byte xs,ys; /* x & y speed */ + byte totalnum; /* total number of sprites */ + boolean vanishifstill; /* Do we show this sprite if it's still? */ + + boolean call_eachstep; /* Do we call the eachstep procedure? */ + byte eachstep; + + triptype* init(byte spritenum, boolean do_check); + /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx,integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(byte pednum); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ + void set_up_saver(trip_saver_type& v); + void unload_saver(trip_saver_type v); + void savedata(untyped_file& f); /* Self-explanatory, */ + void loaddata(untyped_file& f); /* really. */ + void save_data_to_mem(word& where); + void load_data_from_mem(word& where); + triptype* done(); +}; + +class getsettype { +public: + array<1,maxgetset,bytefield> gs; + byte numleft; + + getsettype* init(); + void remember(bytefield r); + void recall(bytefield& r); +}; + + +const integer up = 0; +const integer right = 1; +const integer down = 2; +const integer left = 3; +const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer stopped = 8; + +const integer numtr = 5; /* current max no. of sprites */ + + + +const integer procfollow_avvy_y = 1; + +const integer procback_and_forth = 2; + +const integer procface_avvy = 3; + +const integer procarrow_procs = 4; + +const integer procspludwick_procs = 5; + +const integer procgrab_avvy = 6; + +const integer procgeida_procs = 7; + + +void trippancy_link(); + +void get_back_loretta(); + +void loadtrip(); + +void call_special(word which); + +void open_the_door(byte whither,byte ped,byte magicnum); /* Handles slidey-open doors. */ + +void catamove(byte ped); + +void stopwalking(); + +void tripkey(char dir); + +void rwsp(byte t,byte r); + +void apped(byte trn,byte np); + +void getback(); + +void fliproom(byte room,byte ped); + +boolean infield(byte which); /* returns True if you're within field "which" */ + +boolean neardoor(); /* returns True if you're near a door! */ + +void readstick(); + +void newspeed(); + +void new_game_for_trippancy(); + + +#ifdef __trip5_implementation__ +#undef EXTERN +#define EXTERN +#endif + +EXTERN array<1,numtr,triptype> tr; +EXTERN array<0,1,getsettype> getset; +EXTERN array<1,16000,byte> aa; + +EXTERN boolean mustexclaim; EXTERN word saywhat; +#undef EXTERN +#define EXTERN extern + + +#endif diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp new file mode 100644 index 000000000000..4b95ff44375a --- /dev/null +++ b/engines/avalanche/trip5tst.cpp @@ -0,0 +1,135 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + +/*$R+*/ + +struct adxtype { + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +integer gd,gm; +untyped_file inf; +adxtype a; +array<1,16000,byte> aa; +array<5,2053,byte> mani; +matrix<0,35,0,4,byte> sil; +byte xw; + +void filesetup() +{ + const integer idshould = -1317732048; + longint id; + word soa; +; + assign(inf,"v:sprite2.avd"); + reset(inf,1); + seek(inf,177); + blockread(inf,id,4); + if (id!=idshould) + {; + output << '\7'; + close(inf); + exit(0); + } + + blockread(inf,soa,2); + blockread(inf,a,soa); +} + +void loadpic() +{ + byte fv,ff; +; + {; + xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; + +/* aa[1]:=xl; aa[2]:=0; aa[3]:=yl; aa[4]:=0;*/ + /* The putimage x&y codes are words but xl & yl are bytes, hence the #0s. */ +/* seek(inf,filepos(inf)+xw*(yl+1));*/ + for( fv=0; fv <= a.yl; fv ++) + blockread(inf,sil[fv],xw); + blockread(inf,mani,a.size-6); +/* blockread(inf,aa[5+fv*xw*4+xw*ff],xw);*/ + aa[a.size-1]=0; aa[a.size]=0; /* footer */ + } +/* putimage(0,0,aa,0);*/ +} + +void plotone(integer xx,integer yy) +{ + word s; + word ofs,fv; + byte x,y,z; +; + {; + s=imagesize(x,y,xx+a.xl,yy+a.yl); + getimage(xx,yy,xx+a.xl,yy+a.yl,aa); /* Now loaded into our local buffer. */ + + /* Now we've got to modify it! */ + + for( x=0; x <= 3; x ++) + for( y=0; y <= 35; y ++) + for( z=0; z <= 4; z ++) + {; + ofs=5+y*xw*4+xw*x+z; + aa[ofs]=aa[ofs] & sil[y][z]; + } + + /* mov ax,5 ; AX = ofs + mov bx,xw ; wherever we get xw from + mov cx,x ; ditto + mov dx,y ; ditto + mul cx,bx ; x*xw + mul dx,bx ; y*yw + add ax,cx ; now add 'em all up + add ax,dx ; ... + mov bx,z ; get z (we don't need x any more) + mov cx,syz ; get silyz (where from??!) + add ax,bx ; add on the last part of the addition + and ax,cx ; AND ax with cx. That's it! */ + +/* + for x:=1 to 4 do + begin; + for y:=0 to 35 do + for z:=0 to 4 do + begin; + ofs:=5+y*xw*4+xw*x+z; + aa[ofs]:=aa[ofs] xor pic[x,y,z]; + end; + end; +*/ + + for( fv=5; fv <= a.size-2; fv ++) + aa[fv]=aa[fv] ^ mani[fv]; + + /* Now.. let's try pasting it back again! */ + + putimage(xx,yy,aa,0); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + initgraph(gd,gm,""); + setfillstyle(6,1); bar(0,0,640,200); + filesetup(); + for( gd=1; gd <= 9; gd ++) loadpic(); + do { + plotone(Random(500),Random(150)); + } while (!keypressed()); + plotone(0,0); + close(inf); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp new file mode 100644 index 000000000000..0aa5f32ae2e5 --- /dev/null +++ b/engines/avalanche/trip5xf.cpp @@ -0,0 +1,172 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +const string crlf = string('\15')+'\12'; const char eof_ = '\32'; +const array<1,177,char> trip5head = + string("Sprite*.AVD ... data file for Trippancy Five")+crlf+crlf+ + "[Thorsoft relocatable fiveplane sprite image format]"+crlf+crlf+ + "Thomas Thurman was here. ... Have fun!"+crlf+crlf+eof_+ + " * G. I. E. D. ! * "; + +const array<1,4,char> tripid = string('\x30')+'\x1'+'\x75'+'\261'; + +const array<1,50,char> trip5foot = crlf+crlf+ + " and that's it! Enjoy the game. "+'\3'+crlf+crlf+ + "\n\n\n\n\n\n\n"+"tt"; + +struct adxotype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +struct adxtype { + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +varying_string<2> sn; +adxotype oa; +adxtype a; +matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ +array<1,16000,byte> aa; +untyped_file out; +integer bigsize; + +void copyaoa() +{; + {; + a.name=oa.name; + a.comment="Transferred"; + a.num=oa.num; + a.xl=oa.xl; + a.yl=oa.yl; + a.seq=oa.seq; + a.size=oa.size; + a.fgc=oa.fgc; + a.bgc=oa.bgc; + } +} + +void load() +{ + untyped_file f; byte gd,gm,sort,n; pointer p,q; + pointer xf; +; + assign(f,string("v:osprte")+sn+".avd"); reset(f,1); seek(f,59); + blockread(f,oa,sizeof(oa)); blockread(f,bigsize,2); + copyaoa(); + + getmem(xf,a.size); + + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); + blockread(f,p,bigsize); + putimage(0,0,p,0); release(q); n=1; + + if (sort==0) setfillstyle(1,15); else setfillstyle(1,0); + bar(177,125,300,200); + + for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= a.seq-1; gd ++) /* steps */ + {; + getmem(pic[n][sort],a.size); /* grab the memory */ + getimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, + (gm / 2)*(a.xl*6)+gd*a.xl+a.xl-1,(gm % 2)*a.yl+a.yl-1, + xf); + putimage(177,125,xf,0); + getimage(177,125,177+a.xl,125+a.yl,pic[n][sort]); /* grab the pic */ + n += 1; + } + } + close(f); + freemem(xf,a.size); + cleardevice(); + for( gm=0; gm <= 1; gm ++) + for( gd=1; gd <= a.num; gd ++) + putimage(gd*15,gm*40,pic[gd][gm],0); +} + +void setup() +{ + integer gd,gm; +; + output << "TRIP5XF (c) 1992, Thomas Thurman." << NL; output << NL; + output << "Enter number of SPRITE*.AVD file to convert:"; input >> sn >> NL; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + load(); +} + +string strf(longint x) +{ + string q; +string strf_result; +; + str(x,q); strf_result=q; +return strf_result; +} + +void save() +{ + byte sort,n; + word fv,ff; char r; byte xw; + byte nxl,nyl; + word soa; +; + cleardevice(); + {; + a.size=imagesize(0,0,a.xl,a.yl); + soa=sizeof(a); + + assign(out,string("v:sprite")+sn+".avd"); rewrite(out,1); + blockwrite(out,trip5head,177); + blockwrite(out,tripid,4); + blockwrite(out,soa,2); + blockwrite(out,a,soa); + + nxl=a.xl; nyl=a.yl; + xw=nxl / 8; + if ((nxl % 8)>0) xw += 1; + + for( n=1; n <= a.num; n ++) + {; + putimage( 0,0,pic[n][0],0); + getimage( 0,0,a.xl,a.yl,aa); + for( fv=0; fv <= nyl; fv ++) + blockwrite(out,aa[5+fv*xw*4],xw); + + putimage(100,0,pic[n][1],0); + getimage(100,0,100+a.xl,a.yl,aa); + putimage(100,100,aa,4); +/* for ff:=1 to 4 do { actually 2 to 5, but it doesn't matter here } + for fv:=0 to nyl do*/ +/* for ff:=5 to size-2 do + blockwrite(out,aa[ff],1);*/ + blockwrite(out,aa[5],a.size-6); + } + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup(); + save(); + + blockwrite(out,trip5foot,50); + close(out); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp new file mode 100644 index 000000000000..15035c864dc2 --- /dev/null +++ b/engines/avalanche/tripoop.cpp @@ -0,0 +1,290 @@ +#include "ptoc.h" + + /* Trip Oop (Trippancy 4 Andexor */ +#include "graph.h" +/*#include "Crt.h"*/ + + +const integer up = 0; +const integer right = 1; +const integer down = 2; +const integer left = 3; + +const integer numtr = 1; /* current max no. of sprites */ + +struct adxtype { + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl,yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc,bgc; /* foreground & background bubble colours */ +}; + +class triptype { +public: + adxtype a; /* vital statistics */ + byte face,step; + integer x,y; /* current xy coords */ + integer ox,oy; /* last xy coords */ + integer tax,tay; /* "behind" taken at... */ + shortint ix,iy; /* amount to move sprite by, each step */ + matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ + boolean quick,visible,homing; + pointer behind; /* what's behind you */ + integer hx,hy; /* homing x & y coords */ + + triptype* init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen 1 */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx,integer wy, byte wf); /* switches him on */ + void walk(); /* prepares for do_it, andexor, etc. */ + void do_it(); /* Actually copies the picture over */ + void getback(); /* gets background before sprite is drawn */ + void putback(); /* ...and wipes sprite from screen 1 */ + void walkto(integer xx,integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ + void halt(); /* Stops the sprite from moving */ +}; + +integer gd,gm; +array<1,1,triptype> tr; + +void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4); + + +static boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ +{boolean dropin_result; +; + dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); +return dropin_result; +} + + + +static void transfer(integer x1,integer y1,integer x2,integer y2) +{ + pointer p,q; word s; +; + s=imagesize(x1,y1,x2,y2); setfillstyle(1,0); + mark(q); getmem(p,s); + setactivepage(1); getimage(x1,y1,x2,y2,p); + setactivepage(0); putimage(x1,y1,p,copyput); + setactivepage(1); release(q); +} + + + +static integer lesser(integer a,integer b) +{integer lesser_result; +; + if (ab) greater_result=a; else greater_result=b; +return greater_result; +} + +void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) + +{; + if (dropin(x3,y3,x1,y1,x2,y2) + || dropin(x3,y4,x1,y1,x2,y2) + || dropin(x4,y3,x1,y1,x2,y2) + || dropin(x4,y4,x1,y1,x2,y2)) + {; /* Overlaps */ + transfer(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4)); + } else + {; /* Doesn't overlap- copy both of them seperately */ + transfer(x3,y3,x4,y4); /* backwards- why not...? */ + transfer(x1,y1,x2,y2); + } +} + +void setup() +{ + integer gd,gm; +; + gd=3; gm=0; initgraph(gd,gm,""); + for( gd=0; gd <= 1; gd ++) + {; + setactivepage(gd); + setfillstyle(9,1); bar(0,0,640,200); + } + for( gm=1; gm <= numtr; gm ++) tr[gm].original(); +} + +triptype* triptype::init(byte spritenum) +{ + integer gd,gm; word s; untyped_file f; varying_string<2> xx; pointer p,q; word bigsize; + byte sort,n; +; + str(spritenum,xx); assign(f,string("v:sprite")+xx+".avd"); + reset(f,1); seek(f,59); + blockread(f,a,sizeof(a)); blockread(f,bigsize,2); + setvisualpage(3); setactivepage(3); + for( sort=0; sort <= 1; sort ++) + {; + mark(q); getmem(p,bigsize); + blockread(f,p,bigsize); + putimage(0,0,p,0); release(q); n=1; + { adxtype& with = a; + for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ + for( gd=0; gd <= with.seq-1; gd ++) /* steps */ + {; + getmem(pic[n][sort],a.size); /* grab the memory */ + getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, + (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, + pic[n][sort]); /* grab the pic */ + putimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, + pic[n][sort],notput); /* test the pic */ + n += 1; + }} + } + close(f); setactivepage(0); setvisualpage(0); + x=0; y=0; quick=true; visible=false; getmem(behind,a.size); + homing=false; ix=0; iy=0; +return this; +} + +void triptype::original() +{; + quick=false; +} + +void triptype::getback() +{; + tax=x; tay=y; + getimage(x,y,x+a.xl,y+a.yl,behind); +} + +void triptype::andexor() +{ + byte picnum; /* Picnum, Picnic, what ye heck */ +; + picnum=face*a.seq+step+1; + putimage(x,y,pic[picnum][0],andput); + putimage(x,y,pic[picnum][1],xorput); +} + +void triptype::turn(byte whichway) +{; + face=whichway; step=0; +} + +void triptype::appear(integer wx,integer wy, byte wf) +{; + x=wx; y=wy; ox=wx; oy=wy; turn(wf); visible=true; +} + +void triptype::walk() +{; + ox=x; oy=y; + if (homing) homestep(); + x=x+ix; y=y+iy; + step += 1; if (step==a.seq) step=0; getback(); +} + +void triptype::do_it() +{; + copier(ox,oy,ox+a.xl,oy+a.yl,x,y,x+a.xl,y+a.yl); +} + +void triptype::putback() +{; + putimage(tax,tay,behind,0); +} + +void triptype::walkto(integer xx,integer yy) +{; + speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; +} + +void triptype::stophoming() +{; + homing=false; +} + +void triptype::homestep() +{ + integer temp; +; + if ((hx==x) && (hy==y)) + {; /* touching the target */ + homing=false; return; + } + ix=0; iy=0; + if (hy!=y) + {; + temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; + } + if (hx!=x) + {; + temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; + } +} + +void triptype::speed(shortint xx,shortint yy) +{; + ix=xx; iy=yy; + if ((ix==0) && (iy==0)) return; /* no movement */ + if (ix==0) + {; /* No horz movement */ + if (iy<0) turn(up); else turn(down); + } else + {; + if (ix<0) turn(left); else turn(right); + } +} + +void triptype::halt() +{; + ix=0; iy=0; homing=false; +} + +void trip() +{ + byte fv; +; + for( fv=1; fv <= numtr; fv ++) + { + triptype& with = tr[fv]; + ; + walk(); + if (with.quick && with.visible) andexor(); + do_it(); + putback(); + } +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + setup(); + { + triptype& with = tr[1]; + ; + init(1); + appear(600,100,left); + do { + /* + speed(-5,0); repeat trip until keypressed or (x= 0); + speed( 5,0); repeat trip until keypressed or (x=600); + */ + walkto( 10, 10); do { trip(); } while (!(keypressed() || ! with.homing)); + walkto( 70,150); do { trip(); } while (!(keypressed() || ! with.homing)); + walkto(600, 77); do { trip(); } while (!(keypressed() || ! with.homing)); + } while (!keypressed()); + } +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp new file mode 100644 index 000000000000..51903e948bc4 --- /dev/null +++ b/engines/avalanche/ttmenuxf.cpp @@ -0,0 +1,112 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Tommys.h"*/ +/*#include "Crt.h"*/ + +integer gd,gm; +word s; pointer p; +file f; +byte bit; + +void load() /* Load2, actually */ +{ + byte a0; /*absolute $A000:800;*/ + byte a1; /*absolute $A000:17184;*/ + byte bit; + untyped_file f; varying_string<2> xx; + boolean was_virtual; + + assign(f,"v:ttmenu.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + bit=getpixel(0,0); +} + +void finder() +{ + char r; integer x,y; +; + setfillstyle(0,0); setcolor(14); + x=320; y=100; setwritemode(xorput); + do { + bar(0,0,200,10); + outtextxy(0,0,strf(x)+','+strf(y)); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + do {; } while (!keypressed()); + line(x-20,y,x+20,y); line(x,y-20,x,y+20); + switch (readkey()) { + case '\15': return; break; + case '8': y -= 10; break; + case '4': x -= 10; break; + case '6': x += 10; break; + case '2': y += 10; break; + case '\0': switch (readkey()) { + case cup: y -= 1; break; + case cdown: y += 1; break; + case cleft: x -= 1; break; + case cright: x += 1; break; + } + break; + } + } while (!false); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gd=3; gm=1; initgraph(gd,gm,""); + load(); + finder(); + s=imagesize(342,21,407,119); + getmem(p,s); + getimage(342,21,407,119,p); + putimage(342,21,p,4); + input >> NL; + putimage(264,120,p,0); + input >> NL; + freemem(p,s); + + s=imagesize(264,12,329,217); + getmem(p,s); + getimage(264,21,329,218,p); + putimage(264,21,p,4); + putimage(0,0,p,0); + freemem(p,s); + input >> NL; + + s=imagesize(180,103,188,135); + getmem(p,s); + getimage(180,103,188,135,p); + putimage(0,200,p,0); + input >> NL; + + assign(f,"v:menu.avd"); + rewrite(f); + + for( bit=0; bit <= 3; bit ++) + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( gd=0; gd <= 196; gd ++) + for( gm=0; gm <= 8; gm ++) + { + f << mem[0xa000*gd*80+gm]; + mem[0xa000*gd*80+gm]=~ mem[0xa000*gd*80+gm]; + } + + for( gd=200; gd <= 232; gd ++) + { + f << mem[0xa000*gd*80]; + mem[0xa000*gd*80]=~ mem[0xa000*gd*80]; + } + } + + close(f); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp new file mode 100644 index 000000000000..ad8bd58acecb --- /dev/null +++ b/engines/avalanche/unsquish.cpp @@ -0,0 +1,524 @@ +#include "ptoc.h" + + /*$S-*/ +#include "graph.h" + + +typedef array<1,50000,byte> buffertype; + +integer gd,gm; +varying_string<29> describe; +byte method; +shortint bit; +word offset; +byte a0; /*absolute $A000:800;*/ +array<1,12080,byte> a7; /*absolute $A000:800;*/ +buffertype* buffer; +word bufsize; + +void putup(byte what) +{; + if (offset>12080) + {; + bit += 1; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + offset=1; + } + + a7[offset]=what; + offset += 1; +} + +void load_uncomp(string xx) /* Load2, actually */ +/* a1:byte absolute $A000:17184;*/ +{ + byte this_; + untyped_file f; + word place; +; + assign(f,string("v:place")+xx+".avd"); reset(f,1); seek(f,146); + blockread(f,describe,30); blockread(f,method,1); + bufsize=filesize(f)-177; blockread(f,*buffer,bufsize); + close(f); + + bit=-1; offset=12081; place=1; + + while (place<=bufsize) + {; + this_=(*buffer)[place]; + place += 1; + putup(this_); + } + + output << method << " : \"" << describe << '"' << NL; +} + +void load_comp(string xx); + +const integer maxtab = 4095 /* Table size - 1 ==> 2**10-1 ==> 12 bits */; + +const integer no_prev = -1 /* Special code for no previous character */; + +const integer end_list = -1 /* Marks end of a list */; + +const integer maxstack = 4096 /* Decompression stack size */; + + + + + /* One node in parsing table. */ +struct string_table_entry { + boolean unused /* Is this node *NOT* used yet?*/; + integer prevchar /* Code for preceding string */; + integer follchar /* Code for current character */; + integer next /* Next dupl in collision list */; +}; + + + +typedef array<0,maxtab,string_table_entry> sttype; + + + /* String table */ + +static sttype* string_table; + + +static integer table_used /* # string table entries used */; + +static byte input_code /* Input compressed code */; + +static boolean inempty,popempty; + + /* Decompression stack */ + +static array<1,maxstack,byte> stack; + + +static integer stack_pointer /* Decompression stack depth */; + +static word place; + + +static integer get_hash_code( integer& prevc, integer& follc ) + +{ + integer index; + integer index2; + + /* Get_Hash_Code */ + /* Get initial index using hashing */ + + integer get_hash_code_result; + index = ( ( prevc << 5 ) ^ follc ) & maxtab; + + /* If entry not already used, return */ + /* its index as hash code for C. */ + + if ( (*string_table)[index].unused ) + get_hash_code_result = index; + else + /* If entry already used, search to */ + /* end of list of hash collision */ + /* entries for this hash code. */ + /* Do linear probe to find an */ + /* available slot. */ + { + + /* Skip to end of collision list ... */ + + while ( (*string_table)[index].next != end_list ) + index = (*string_table)[index].next; + + /* Begin linear probe down a bit from */ + /* last entry in collision list ... */ + + index2 = ( index + 101 ) & maxtab; + + /* Look for unused entry using linear */ + /* probing ... */ + + while ( ! (*string_table)[index2].unused ) + index2 = succ(integer, index2 ) & maxtab; + + /* Point prior end of collision list */ + /* to this new node. */ + + (*string_table)[index].next = index2; + + /* Return hash code for C */ + + get_hash_code_result = index2; + + } + + return get_hash_code_result; +} /* Get_Hash_Code */ + + + + /*--------------------------------------------------------------------------*/ + /* Make_Table_Entry --- Enter C string in string table */ + /*--------------------------------------------------------------------------*/ + +static void make_table_entry( integer& prevc, integer& follc ) + +{ /* Make_Table_Entry */ + /* Only enter string if there is room left */ + + if ( table_used <= maxtab ) + { + { + string_table_entry& with = (*string_table)[ get_hash_code( prevc , follc ) ]; + + with.unused = false; + with.next = end_list; + with.prevchar = prevc; + with.follchar = follc; + } + /* Increment count of items used */ + + table_used += 1; +/* + IF ( Table_Used > ( MaxTab + 1 ) ) THEN + BEGIN + WRITELN('Hash table full.'); + END; + */ + } + +} /* Make_Table_Entry */ + + + +static void firstentries() +/* This is just a fast version of the above, when PrevC = No_Prev. TT. */ + +{ + integer i,j; + + + /* There MUST be room- we've only just started! */ + + j=no_prev; + + for( i=0; i <= 255; i ++) + { + string_table_entry& with = (*string_table)[ ((no_prev << 5 ) ^ i) & maxtab]; + + with.unused = false; + with.next = end_list; + with.prevchar = no_prev; + with.follchar = i; + } + + table_used += 256; /* Increment count of items used */ + +} + + + + /*--------------------------------------------------------------------------*/ + /* Initialize_String_Table --- Initialize string table */ + /*--------------------------------------------------------------------------*/ + +static void initialize_string_table() + +{ + integer i; + + /* Initialize_String_Table */ + + /* No entries used in table yet */ + table_used = 0; + + fillchar(*string_table,(maxtab+1)*sizeof((*string_table)[1]),'\377'); + /* Enter all single characters into */ + /* table */ + firstentries(); + +} /* Initialize_String_Table */ + + + + /*--------------------------------------------------------------------------*/ + /* Lookup_String --- Look for string C in string table */ + /*--------------------------------------------------------------------------*/ + +static integer lookup_string( integer prevc, integer follc ) + +{ + integer index; + integer index2; + boolean found; + + /* Lookup_String */ + /* Initialize index to check from hash */ + + integer lookup_string_result; + index = ( ( prevc << 5 ) ^ follc ) & maxtab; + + /* Assume we won't find string */ + lookup_string_result = end_list; + /* Search through list of hash collision */ + /* entries for one that matches C */ + do { + + found = ( (*string_table)[index].prevchar == prevc ) && + ( (*string_table)[index].follchar == follc ); + + if ( ! found ) + index = (*string_table)[index].next; + + } while (!(found || ( index == end_list ))); + + /* Return index if C found in table. */ + if (found) + lookup_string_result = index; + + return lookup_string_result; +} /* Lookup_String */ + + + + /*--------------------------------------------------------------------------*/ + /* Push --- Push character onto stack */ + /*--------------------------------------------------------------------------*/ + +static void push( byte c) + +{ /* Push */ + + stack_pointer += 1; + stack[ stack_pointer ] = c; + + if ( stack_pointer >= maxstack ) + { + output << "Stack overflow!" << NL; + exit(0); + } + +} /* Push */ + + + + /*--------------------------------------------------------------------------*/ + /* Pop --- Pop character from stack */ + /*--------------------------------------------------------------------------*/ + +static void pop( integer& c ) + +{ /* Pop */ + + popempty=stack_pointer==0; + + if (! popempty) + { + c = stack[stack_pointer]; + stack_pointer -= 1; + } + +} /* Pop */ + + + + /*--------------------------------------------------------------------------*/ + /* Get_Code --- Get compression code from input file */ + /*--------------------------------------------------------------------------*/ + +static void get_code( integer& hash_code ) + +{ + byte local_buf; + + /* Get_Code */ + + if (inempty) + { + + if (place>bufsize) return; else + {; + local_buf=(*buffer)[place]; + place += 1; + } + + if (place>bufsize) return; else + {; + input_code=(*buffer)[place]; + place += 1; + } + + hash_code = ( ( local_buf << 4 ) & 0xff0 ) + + ( ( (cardinal)input_code >> 4 ) & 0xf ); + + input_code = input_code & 0xf; + inempty=false; + + } + else + { + + if (place>bufsize) return; else + {; + local_buf=(*buffer)[place]; + place += 1; + } + + hash_code = local_buf + ( ( input_code << 8 ) & 0xf00 ); + inempty=true; + + } + +} /* Get_Code */ + + + + /*--------------------------------------------------------------------------*/ + /* Do_Decompression --- Perform decompression */ + /*--------------------------------------------------------------------------*/ + +static void do_decompression() + +{ + integer c /* Current input character */; + integer code /* Current code string */; + integer old_code /* Previous code string */; + integer fin_char /* Final input character */; + integer in_code /* Current input code */; + integer last_char /* Previous character */; + boolean unknown /* TRUE if code not found */; + integer temp_c /* Char popped off stack */; + + /* Do_Decompression */ + + stack_pointer = 0; /* Decompression stack is empty */ + unknown = false; /* First string is always known */ + get_code( old_code ); /* Get first string == Step 1 */ + code = old_code; + + c=(*string_table)[code].follchar; /* Output corresponding character */ + putup( c ); + fin_char = c; /* Remember this character -- it */ + /* is final character of next string */ + + get_code( in_code ); /* Get next code == Step 2 */ + + while (place<=bufsize) + { + code = in_code; /* Set code to this input code */ + + /* If code not in table, do special */ + /* case ==> Step 3 */ + + if ( (*string_table)[code].unused ) + { + last_char = fin_char; + code = old_code; + unknown = true; + } + /* Run through code extracting single */ + /* characters from code string until */ + /* no more characters can be removed. */ + /* Push these onto stack. They will */ + /* be entered in reverse order, and */ + /* will come out in forwards order */ + /* when popped off. */ + /* */ + /* ==> Step 4 */ + + while( (*string_table)[code].prevchar != no_prev ) + { + string_table_entry& with = (*string_table)[code]; + + push( with.follchar ); + code = with.prevchar; + } + /* We now have the first character in */ + /* the string. */ + + fin_char = (*string_table)[code].follchar; + + /* Output first character ==> Step 5 */ + putup( fin_char ); + /* While the stack is not empty, remove */ + /* and output all characters from stack */ + /* which are rest of characters in the */ + /* string. */ + /* */ + /* ==> Step 6 */ + pop( temp_c ); + + while (! popempty) + { + putup( temp_c ); + pop( temp_c ); + } + /* If code isn't known, output the */ + /* follower character of last character */ + /* of string. */ + if (unknown) + { + fin_char = last_char; + putup( fin_char ); + unknown = false; + } + /* Enter code into table ==> Step 7 */ + + make_table_entry( old_code , fin_char ); + + /* Make current code the previous code */ + old_code = in_code; + + /* Get next code == Step 2 */ + get_code( in_code ); + + } + +} /* Do_Decompression */ + +void load_comp(string xx){ + + /* This loads in the compressed file. */ + +const integer maxbuff = 8192 /* Buffer size for input and output files */; + +integer output_code /* Output compressed code */; +boolean if_compressing /* TRUE if compressing file */; + +byte this_; +untyped_file f; + +; +string_table = new sttype; +inempty=true; +initialize_string_table(); + +assign(f,string("v:compr")+xx+".avd"); reset(f,1); seek(f,146); +blockread(f,describe,30); blockread(f,method,1); +bufsize=filesize(f)-177; blockread(f,*buffer,bufsize); +close(f); + +bit=-1; offset=12081; place=1; + +do_decompression(); + +output << method << " : \"" << describe << '"' << NL; + +delete string_table; + } + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; +gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +buffer = new buffertype; +#ifdef uncomp +load_uncomp("21"); +#else +load_comp("21"); +#endif +delete buffer; +return EXIT_SUCCESS; +} + + diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp new file mode 100644 index 000000000000..effb1c5474af --- /dev/null +++ b/engines/avalanche/viewdocs.cpp @@ -0,0 +1,522 @@ +#include "ptoc.h" + + /*$S-*/ +/*#include "dos.h"*/ +/*#include "crt.h"*/ +/*#include "tommys.h"*/ + + +typedef array<0,49999,byte> bigtextarray; +struct chaptertype { + varying_string<60> headername; + word headeroffset; +}; +typedef array<1,1120,byte> sbtype; + +const integer contsize = 29; /*number of headers in AVALOT.DOC*/ +const varying_string<80> contentsheader = " -=- The contents of the Lord AVALOT D'Argent (version 1.3) documentation -=-"; +const array<0,15,byte> listpal = {{1,0,3,0,7,0,7,7,0,0,0,0,0,0,0,0}}; +const array<0,15,byte> blankpal = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}}; +const integer tabstop = 8; /*length of tab stops*/ + +/*NOTE: Tabs are not properly implemented. The program just interprets them*/ +/*as a number of spaces.*/ + +matrix<1,256, 0,15,byte> textvar,textvar8; +array<0,1500,word> posof13; +array<1,65535,byte> scvar; /*absolute $A000:$0000;*/ +sbtype stbar,stbar2; +pointer dpt; +word sot,nol,bat,bab,tlab,nosl,bfseg,bfofs,useless; +bigtextarray* textmem; +boolean atsof,fast,regimode; +byte hol; +varying_string<80> stline; +array<1,contsize,chaptertype> contlist; +integer lat; + +void wipeit(longint pos, word count) /*Like fillchar, but wraps*/ +{ + longint wpos; + + wpos=(word)(pos); + fillchar(mem[longint(0xa000)+wpos / longint(16)*wpos % longint(16)],count,0); +} + +void wrapcopy(sbtype fromarr, longint pos) /*Like fillchar, but wraps*/ +{ + longint wpos; + + wpos=(word)(pos); + move(fromarr,mem[longint(0xa000)+wpos / longint(16)*wpos % longint(16)],1120); +} + +void blankscreen() /*blanks the screen (!)*/ +{ + registers r; + + r.ax=0x1002; + r.es=seg(blankpal); + r.dx=ofs(blankpal); + intr(0x10,r); +} + +void showscreen() /*shows the screen (!)*/ +{ + registers r; + + r.ax=0x1002; + r.es=seg(listpal); + r.dx=ofs(listpal); + intr(0x10,r); +} + +void wipesb(word wheretop) +{ + byte plane; + + for( plane=2; plane <= 3; plane ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; + fillchar(scvar[(wheretop+336)*80+1],1120,0); + } + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +} + +void displstat(byte wipepos) /*displays the status bar*/ +{ + byte plane; + + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=4; port[0x3cf]=2; + wrapcopy(stbar,(lat+336)*80); + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=8; port[0x3cf]=3; + wrapcopy(stbar2,(lat+336)*80); + for( plane=2; plane <= 3; plane ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; + switch (wipepos) { + case 0: wipeit((lat+335)*80-1,80); break; + case 1: wipeit(lat*80-1,80); break; + } + } + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +} + +void udstat() /*updates the status bar*/ +{ + varying_string<3> pt; + byte fv,fv2; + + fillchar(pt,4,'\0'); + str(round((real)((tlab-21))/(nol-21)*100),pt); + for( fv=1; fv <= 3; fv ++) + for( fv2=0; fv2 <= 13; fv2 ++) + {; + stbar[fv2*80+fv+68]=~ textvar[ord(pt[fv])+1][fv2]; + stbar2[fv2*80+fv+68]=textvar[ord(pt[fv])+1][fv2]; + } +} + +void finddocinfo() /*finds the line breaks in AVALOT.DOC & finds the +headers by searching for '"""'*/ +{ + word wv,oldwv,varpos,varpos2,contlpos; + boolean thisaheader; + varying_string<60> headerstring; + + thisaheader=false; + posof13[0]=65535; /*this +2 will wrap around to 1*/ + wv=1; + oldwv=1; + varpos=1; + contlist[1].headername="Start of documentation"; + contlist[1].headeroffset=0; + contlpos=2; + while (wv12) + && (thisaheader==false)) + { + thisaheader=true; + headerstring[0]='\0'; + varpos2=posof13[varpos-2]+2; + while (((*textmem)[varpos2]==32) || ((*textmem)[varpos2]==9)) varpos2 += 1; + while (varpos2!=posof13[varpos-1]) + {; + headerstring=headerstring+chr((*textmem)[varpos2]); + varpos2 += 1; + } + contlist[contlpos].headername=headerstring; + contlist[contlpos].headeroffset=varpos-2; + contlpos += 1; + } + break; + } + wv += 1; + } + nol=varpos-2; + nosl=nol*14; +} + +void graphmode(byte gm) /*puts the display adaptor into a specified mode*/ +{ + registers regs; + + regs.ax=gm; + intr(0x10,regs); +} + +void setoffset(word where_on_screen) {; /*assembler; {for scrolling the screen*/ +/*asm + mov bx, where_on_screen + mov dx, $03D4 + mov ah, bh + mov al, $C + out dx, ax + + mov ah, bl + inc al + out dx, ax*/ + } + +void setupsb(byte sbtype) /*sets up the status bar in several styles*/ +{ + integer fv; + + switch (sbtype) { + case 1: if (regimode==false) stline=string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits. C=") + +'\32'+"contents "+'\263'+" % through "; else + stline=string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits to main menu.") + +'\263'+" % through"; + break; + case 2: stline=string("Esc=to doc lister ")+'\263'+" Press the key listed next to the section you wish to jump to"; break; + } + for( fv=0; fv <= 1118; fv ++) {; + stbar[fv+1]=~ textvar[ord(stline[fv % 80+1])+1][fv / 80]; + stbar2[fv+1]=textvar[ord(stline[fv % 80+1])+1][fv / 80]; + } +} + +void setup() /*sets up graphics, variables, etc.*/ +{ + untyped_file f; + integer fv; + registers r; + + if ((paramstr(1)!="REGI") && (paramstr(1)!="ELMPOYTEN")) + + { + clrscr; + output << "This program cannot be run on its own. Run AVALOT.EXE." << NL; + exit(123); + } + val(paramstr(2),bfseg,useless); + val(paramstr(3),bfofs,useless); + bfofs += 1; + atsof=true; + fast=false; + assign(f,"avalot.fnt"); + reset(f,1); + blockread(f,textvar,4096); + close(f); + assign(f,"ttsmall.fnt"); + reset(f,1); + blockread(f,textvar8,4096); + close(f); + assign(f,"avalot.doc"); + reset(f,1); + sot=filesize(f); + mark(dpt); + textmem = new bigtextarray; + blockread(f,*textmem,sot); + close(f); + finddocinfo(); + if (paramstr(1)=="REGI") + {; + regimode=true; + tlab=contlist[contsize].headeroffset+24; + lat=contlist[contsize].headeroffset*14; + } + else + {; + lat=0; tlab=24; + regimode=false; + } + setupsb(1); + graphmode(16); + directvideo=false; + showscreen(); + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +} + +void drawscreenf(integer tl) /*draws a screen from a line forwards*/ +/*N.B. tl>1*/ +{ + word fv,fv2,curbyte,plane; + byte xpos; + + blankscreen(); + wipesb(lat); + if (tl>nol-24) tl=nol-24; + if (tl<0) tl=0; + lat=tl*14; + for( plane=2; plane <= 3; plane ++) /*wipe sb off*/ + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; + /*fillchar(mem [$A000:((lat-1)*80) mod 65536],26800,0);*/ + wipeit(lat*80,26800); + } + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; /*back to normal*/ + if (tl>0) curbyte=posof13[tl-1]+2; else curbyte=0; + bat=curbyte; + for( fv=lat; fv <= lat+335; fv ++) + { + fv2=curbyte; + xpos=1; + while (xpos<=80) + { + if (fv21) atsof=false; + showscreen(); +} + +void displcont() /*displays the contents*/ +{ + byte fv,fv2,fv3,keyon,jumppos,plane; + word olat; + varying_string<62> curstr; + char rkv; + + blankscreen(); + olat=lat; lat=0; keyon=1; jumppos=0; + setoffset(0); + for( plane=1; plane <= 3; plane ++) /*wipe sb off*/ + { + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; + fillchar(scvar,26800,0); + } + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; /*back to normal*/ + setupsb(2); + displstat(2); + for( fv=1; fv <= 80; fv ++) + for( fv2=0; fv2 <= 27; fv2 ++) + { + scvar[fv2*80+fv]=textvar[ord(contentsheader[fv-1])+1][fv2 / 2]; + } + for( fv=1; fv <= contsize; fv ++) + { + if (keyon<10) curstr=strf(keyon)+". "+contlist[fv].headername; else + curstr=string(chr(keyon+55))+". "+contlist[fv].headername; + for( fv2=1; fv2 <= length(curstr); fv2 ++) + for( fv3=0; fv3 <= 7; fv3 ++) + scvar[(fv+3)*640+fv3*80+fv2]=textvar8[ord(curstr[fv2])+1][fv3]; + keyon += 1; + } + showscreen(); + do {; } while (!keypressed()); + rkv=readkey(); + switch (rkv) { + case RANGE_9('\61','\71'): jumppos=ord(rkv)-48; + break; + case RANGE_26('\101','\132'): jumppos=ord(rkv)-55; + break; + case RANGE_26('\141','\172'): jumppos=ord(rkv)-87; + break; + default: lat=olat; + } + if (jumppos>0) lat=contlist[jumppos].headeroffset; + setupsb(1); + if (fast==false) wipesb(0); + drawscreenf(lat); +} + +void down() /*scrolls the screen down one line*/ +{ + word fv,xpos,wpos,lab; + + lat += 1; + lab=lat+335; + setoffset((word)(lat*80)); + if (lab % 14==0) { + bat=posof13[tlab-24]+2; bab=posof13[tlab]+2; tlab += 1; udstat(); } + fv=bab; + xpos=1; + while (xpos<=80) + { + if (fv24) + { + tlab -= 1; bat=posof13[tlab-24]+2; bab=posof13[tlab-1]+2; udstat(); } else + { atsof=true; udstat(); return; } + lat -= 1; + setoffset((word)(lat*80)); + fv=bat; + xpos=1; + while (xpos<=80) + { + if (fvcUp) or (atsof=true); + cDown: repeat; + down; + readkey; + until (readkey<>cDown) or (ateof=true);*/ + } + first=false; + } + break; + case '\33': return; break; + case '\103':case '\143': if (regimode==false) { wipesb(lat); displcont(); } break; + } + } while (!false); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + setup(); + control(); + endit(); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp new file mode 100644 index 000000000000..f5bd51131e8d --- /dev/null +++ b/engines/avalanche/visa.cpp @@ -0,0 +1,264 @@ +#include "ptoc.h" + +/* + + + + + VISA The new Sez handler. (Replaces Access.) */ + +#define __visa_implementation__ + + +#include "visa.h" + + +/*#include "Gyro.h"*/ +/*#include "Scrolls.h"*/ +/*#include "Acci.h"*/ +/*#include "Trip5.h"*/ +/*#include "Lucerna.h"*/ + + +const boolean bubbling = false; +const boolean report_dixi_errors = true; + +boolean went_ok; + +void unskrimble() +{ + word fv; + + for( fv=1; fv <= bufsize; fv ++) buffer[fv]=(char)((~(ord(buffer[fv])-fv)) % 256); +} + +void do_the_bubble() +{ + bufsize += 1; + buffer[bufsize]='\2'; +} + +void dixi(char block, byte point) +{ + untyped_file indexfile,sezfile; + word idx_offset,sez_offset; + boolean error; + + error=false; + + assign(indexfile,"avalot.idx"); assign(sezfile,"avalot.sez"); + + reset(indexfile,1); + seek(indexfile,(ord(upcase(block))-65)*2); + blockread(indexfile,idx_offset,2); + if (idx_offset==0) error=true; + seek(indexfile,idx_offset+point*2); + blockread(indexfile,sez_offset,2); + if (sez_offset==0) error=true; + close(indexfile); + + went_ok=! error; + + if (error) + { + if (report_dixi_errors) + display(string('\7')+"Error accessing scroll "+block+strf(point)); + return; + } + + reset(sezfile,1); + seek(sezfile,sez_offset); + blockread(sezfile,bufsize,2); + blockread(sezfile,buffer,bufsize); + close(sezfile); + unskrimble(); + + if (bubbling) do_the_bubble(); + + calldrivers; +} + +void speech(byte who, byte subject) +{ + untyped_file indexfile,sezfile; + word idx_offset,sez_offset,next_idx_offset; + + if (subject==0) + { /* No subject. */ + bubbling=true; report_dixi_errors=false; + dixi('s',who); + bubbling=false; report_dixi_errors=true; + } else + { /* Subject given. */ + assign(indexfile,"converse.avd"); assign(sezfile,"avalot.sez"); + + went_ok=false; /* Assume that until we know otherwise. */ + reset(indexfile,1); + seek(indexfile,who*2-2); + blockread(indexfile,idx_offset,2); + blockread(indexfile,next_idx_offset,2); + + if ((idx_offset==0) || + ((((next_idx_offset-idx_offset) / 2)-1) < subject)) return; + + seek(indexfile,idx_offset+subject*2); + /*$I-*/ + blockread(indexfile,sez_offset,2); + if ((sez_offset==0) || (ioresult!=0)) return; + /*$I+*/ + close(indexfile); + + reset(sezfile,1); + seek(sezfile,sez_offset); + blockread(sezfile,bufsize,2); + blockread(sezfile,buffer,bufsize); + close(sezfile); + + unskrimble(); + do_the_bubble(); + + calldrivers; + went_ok=true; + } +} + +void talkto(byte whom) +{ + byte fv; + boolean no_matches; + + if (person==pardon) + { + person=chr(subjnumber); + subjnumber=0; + } + + if (subjnumber==0) + switch (chr(whom)) { + case pspludwick: + + if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) + { + dixi('q',68); + dna.obj[potion]=true; + objectlist; points(3); return; + } else + { + if (dna.talked_to_crapulus) + switch (dna.given2spludwick) { /* Spludwick - what does he need? */ + /* 0 - let it through to use normal routine. */ + case RANGE_2(1,2): { + display(string("Can you get me ")+ + get_better(spludwick_order[dna.given2spludwick])+", please?"+ + "\232\2"); + return; + } + break; + case 3: { + dixi('q',30); /* need any help with the game? */ + return; + } + break; + } + else { + dixi('q',42); /* Haven't talked to Crapulus. Go and talk to him. */ + return; + } + } + break; + + case pibythneth: if (dna.givenbadgetoiby) + { + dixi('q',33); /* Thanks a lot! */ + return; /* And leave the proc. */ + } + break; /* Or... just continue, 'cos he hasn't got it. */ + case pdogfood: if (dna.wonnim) + { /* We've won the game. */ + dixi('q',6); /* "I'm Not Playing!" */ + return; /* Zap back. */ + } else dna.asked_dogfood_about_nim=true; + break; + case payles: if (~ dna.ayles_is_awake) + { + dixi('q',43); /* He's fast asleep! */ + return; + } else + if (~ dna.given_pen_to_ayles) + { + dixi('q',44); /* Can you get me a pen, Avvy? */ + return; + } + break; + + case pjacques: { dixi('q',43); return; } break; + case pgeida: if (dna.geida_given_potion) + dna.geida_follows=true; else + { + dixi('u',17); + return; + } + break; + case pspurge: if (~ dna.sitting_in_pub) + { + dixi('q',71); /* Try going over and sitting down. */ + return; + } else + { + if (spurge_talk<5) spurge_talk += 1; + if (spurge_talk>1) + { /* no. 1 falls through */ + dixi('q',70+spurge_talk); + return; + } + } + break; + } else /* On a subject. Is there any reason to block it? */ + switch (chr(whom)) { + case payles: if (~ dna.ayles_is_awake) + { + dixi('q',43); /* He's fast asleep! */ + return; + } + break; + } + + if (whom>149) whom -= 149; + + no_matches=true; + for( fv=1; fv <= numtr; fv ++) + if (tr[fv].a.accinum==whom) + { + display(string('\23')+chr(fv+48)+'\4'); + no_matches=false; + flush(); + } + + if (no_matches) display("\23\23\4"); + + speech(whom,subjnumber); + if (! went_ok) /* File not found! */ + dixi('n',whom); + + if (subjnumber==0) + switch (chr(whom+149)) { + case pcrapulus: + { /* Crapulus: get the badge - first time only */ + dna.obj[badge]=true; + objectlist; + dixi('q',1); /* Circular from Cardiff. */ + dna.talked_to_crapulus=true; + + whereis[pcrapulus]=177; /* Crapulus walks off. */ + + tr[2].vanishifstill=true; + tr[2].walkto(4); /* Walks away. */ + + points(2); + } + break; + + } +} + + diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h new file mode 100644 index 000000000000..8b79d6be1836 --- /dev/null +++ b/engines/avalanche/visa.h @@ -0,0 +1,9 @@ +#ifndef __visa_h__ +#define __visa_h__ + + +void dixi(char block, byte point); + +void talkto(byte whom); + +#endif diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp new file mode 100644 index 000000000000..52970adacbf5 --- /dev/null +++ b/engines/avalanche/visatest.cpp @@ -0,0 +1,84 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ + + +char block; +word point; + +array<1,2000,char> result; +word result_len; + +void unskrimble() +{ + word fv; + + for( fv=1; fv <= 2000; fv ++) result[fv]=(char)((~(ord(result[fv])-fv)) % 256); +} + +void visa_get_scroll(char block, word point) +{ + untyped_file indexfile,sezfile; + word idx_offset,sez_offset; + + assign(indexfile,"avalot.idx"); assign(sezfile,"avalot.sez"); + + reset(indexfile,1); + seek(indexfile,(ord(upcase(block))-65)*2); + blockread(indexfile,idx_offset,2); + seek(indexfile,idx_offset+point*2); + blockread(indexfile,sez_offset,2); + close(indexfile); + + reset(sezfile,1); + seek(sezfile,sez_offset); + blockread(sezfile,result_len,2); + blockread(sezfile,result,result_len); + close(sezfile); + unskrimble(); +} + +void access_get_scroll(char block, word point) +{ + string x; + untyped_file f; + + str(point,x); + x=string('S')+block+x+".RAW"; + assign(f,x); + reset(f,1); + result_len=filesize(f); + blockread(f,result,result_len); + close(f); +} + +void display_it() +{ + word fv; + + for( fv=1; fv <= result_len; fv ++) output << result[fv]; +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + do { + output << NL; + output << NL; + output << "Block?"; input >> block >> NL; + output << "Point?"; input >> point >> NL; + + output << "ACCESS reports (this one is always correct):" << NL; + output << NL; + access_get_scroll(block,point); + display_it(); + + output << NL; output << NL; + output << "VISA reports:" << NL; + output << NL; + visa_get_scroll(block,point); + display_it(); + } while (!false); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp new file mode 100644 index 000000000000..67bb5ff5619c --- /dev/null +++ b/engines/avalanche/xf_gover.cpp @@ -0,0 +1,95 @@ +#include "ptoc.h" + + +#include "graph.h" + + +void load() +{ + byte a; /*absolute $A000:1200;*/ byte bit; untyped_file f; +; + assign(f,"avagame.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,12080); + } + close(f); + bit=getpixel(0,0); +} + +void gfx() +{ + integer gd,gm; + + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +} + +void blit(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3) +{ + pointer p,q; word s; + + mark(q); + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + putimage(x3,y3,p,0); + + release(q); +} + +void copy_hammer() +{ + blit(274,47,311,67,92,10); +} + +void do_text() +{ + settextjustify(1,1); setcolor(0); + settextstyle(2,0,4); + setusercharsize(120,100,100,100); + outtextxy(112,32,"Thorsoft of Letchworth presents"); + blit(3,30,218,31,4,30); + blit(4,35,219,38,3,35); +} + +void dump_to_file(byte x1,byte y1,byte x2,byte y2, string fn) +{ + byte y,bit; + untyped_file f; + + assign(f,fn); + rewrite(f,1); + + for( y=y1; y <= y2; y ++) + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(f,mem[0xa000*y*80+x1],x2-x1); + } + + close(f); + +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + gfx(); + load(); + + setfillstyle(1,7); + bar(2,10,219,37); + bar(0,0,1,200); + bar(220,0,250, 88); + bar(0,88,213,147); + bar(622,88,640,147); + copy_hammer(); + do_text(); + + dump_to_file( 0,10,28,86,"about.avd"); + dump_to_file(26,88,78,147,"gameover.avd"); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp new file mode 100644 index 000000000000..1f8063952e22 --- /dev/null +++ b/engines/avalanche/xf_help.cpp @@ -0,0 +1,86 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ +/*#include "Tommys.h"*/ + + +const integer max_pages = 34; + +byte fv; +text i; +untyped_file o; +string x; +char t; +byte p,w; + +array<0,max_pages,word> where; + +void out(string x) +{ + byte fz; + + for( fz=1; fz <= length(x); fz ++) + x[fz]=chr(ord(x[fz]) ^ 177); + blockwrite(o,x[0],1); + blockwrite(o,x[1],length(x)); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + assign(o,"help.avd"); + rewrite(o,1); + + blockwrite(o,where,sizeof(where)); + + for( fv=0; fv <= max_pages; fv ++) + { + where[fv]=filepos(o); + + assign(i,string('h')+strf(fv)+".raw"); + reset(i); + + i >> x >> NL; /* Title. */ + out(x); + + i >> p >> NL; /* Picture. */ + blockwrite(o,p,1); + + do { + i >> x >> NL; + out(x); + } while (!(x=='!')); + + while (! eof(i)) + { + i >> x >> NL; + if (x=='-') + { /* Null point */ + t='\0'; p=0; w=177; + } else + { /* Has a point. */ + i >> t >> NL; + i >> p >> NL; + i >> w >> NL; + } + + blockwrite(o,t,1); + blockwrite(o,p,1); + blockwrite(o,w,1); + } + + t='\261'; + blockwrite(o,t,1); + blockwrite(o,p,1); + blockwrite(o,w,1); + + close(i); + + } + + seek(o,0); blockwrite(o,where,sizeof(where)); + + close(o); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp new file mode 100644 index 000000000000..888df55d4e18 --- /dev/null +++ b/engines/avalanche/xf_visa.cpp @@ -0,0 +1,178 @@ +#include "ptoc.h" + + +/*#include "Crt.h"*/ +/*#include "Dos.h"*/ + +/*$R+*/ + +const varying_string<9> used = "DNPQSTUXZ"; + +const varying_string<12> header = string("Avalot Sez:")+'\32'; + +untyped_file sez,infile; +searchrec s; + +matrix<'A','Z',0,99,word> positions; +array<'A','Z',word> maxlen; + +matrix<1,50,0,255,word> speak_positions; +array<1,50,word> speak_maxlen; + +array<1,2000,char> data; +word data_length; + +byte fv; + +byte numeric_bit() +{ + varying_string<5> x; integer e; byte result; + + byte numeric_bit_result; + x=copy(s.name,3,pos(".",s.name)-3); + val(x,result,e); + if (e!=0) + { + output << "NUMERIC ERROR: " << s.name << '/' << x << NL; + exit(255); + } + numeric_bit_result=result; + return numeric_bit_result; +} + +byte speak_left() +{ + string x; integer e; byte result; + + byte speak_left_result; + x=copy(s.name,3,pos(".",s.name)-3); + x=copy(x,1,pos("-",x)-1); + val(x,result,e); + if (e!=0) + { + output << "NUMERIC ERROR (left): " << s.name << '/' << x << NL; + exit(255); + } + speak_left_result=result; + return speak_left_result; +} + +byte speak_right() +{ + string x; integer e; byte result; + + byte speak_right_result; + x=copy(s.name,3,pos(".",s.name)-3); + x=copy(x,pos("-",x)+1,255); + val(x,result,e); + if (e!=0) + { + output << "NUMERIC ERROR (right): " << s.name << '/' << x << NL; + exit(255); + } + speak_right_result=result; + return speak_right_result; +} + +void write_out() +{ + array<'A','Z',word> points; + array<1,50,word> speak_points; + untyped_file outf; + byte fv; + + fillchar(points,sizeof(points),'\0'); + fillchar(speak_points,sizeof(speak_points),'\0'); + + assign(outf,"v:avalot.idx"); + rewrite(outf,1); + blockwrite(outf,points,sizeof(points)); + + for( fv=1; fv <= length(used); fv ++) + { + points[used[fv-1]]=filepos(outf); + blockwrite(outf,positions[used[fv-1]],maxlen[used[fv-1]]*2+2); + } + + seek(outf,0); + blockwrite(outf,points,sizeof(points)); + + close(outf); + + /* --- now the speech records --- */ + + assign(outf,"v:converse.avd"); + rewrite(outf,1); + blockwrite(outf,speak_points,sizeof(speak_points)); + + for( fv=1; fv <= 15; fv ++) + { + speak_points[fv]=filepos(outf); + + blockwrite(outf,speak_positions[fv],speak_maxlen[fv]*2+2); + } + + seek(outf,0); + blockwrite(outf,speak_points,sizeof(speak_points)); + + close(outf); +} + +void skrimble() +{ + word fv; + + for( fv=1; fv <= 2000; fv ++) data[fv]=(char)((~(ord(data[fv]))+fv) % 256); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + fillchar(positions,sizeof(positions),'\0'); + fillchar(maxlen,sizeof(maxlen),'\0'); + + clrscr; + + assign(sez,"v:avalot.sez"); + rewrite(sez,1); + blockwrite(sez,header[1],12); + + findfirst("s*.raw",anyfile,s); + while (doserror==0) + { + assign(infile,s.name); + reset(infile,1); + blockread(infile,data,2000,data_length); + close(infile); + + clrscr; + if (pos("-",s.name)==0) + { /* Not a speech record. */ + output << s.name << format(numeric_bit(),10) << NL; + + positions[s.name[2]][numeric_bit()]=filepos(sez); + if (maxlen[s.name[2]]<(unsigned char)numeric_bit()) maxlen[s.name[2]]=numeric_bit(); + + } else + { /* A speech record. */ + output << s.name << format(speak_left(),10) << format(speak_right(),10) << " SR" << NL; + + speak_positions[speak_left()][speak_right()]=filepos(sez); + if (speak_maxlen[speak_left()]<(unsigned char)speak_right()) + speak_maxlen[speak_left()]=speak_right(); + } + + skrimble(); + + blockwrite(sez,data_length,2); + blockwrite(sez,data,data_length); + + findnext(s); + clreol; + } + + close(sez); + + write_out(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp new file mode 100644 index 000000000000..dfbaf5e559bb --- /dev/null +++ b/engines/avalanche/xfbutton.cpp @@ -0,0 +1,62 @@ +#include "ptoc.h" + + +#include "graph.h" + +integer x,y; +untyped_file f,out; + +void load() /* Load2, actually */ +{ + byte a0; /*absolute $A000:800;*/ + byte bit; + untyped_file f; + integer gd,gm; + + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + + assign(f,"d:butnraw.avd"); reset(f,1); + seek(f,177); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a0,12080); + } + close(f); + bit=getpixel(0,0); +} + +void grab(integer x1,integer y1,integer x2,integer y2) /* s=930 */ +{ + word s; pointer p; + + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + putimage(0,0,p,0); + blockwrite(out,p,s); + freemem(p,s); + rectangle(x1,y1,x2,y2); +} + +int main(int argc, const char* argv[]) +{ + pio_initialize(argc, argv); + assign(f,"d:butnraw.avd"); + assign(out,"v:buttons.avd"); rewrite(out,1); + load(); + for( x=0; x <= 5; x ++) + for( y=0; y <= 3; y ++) + { + if (! + (((x==1) && (y==0)) + || ((x==4) && (y==2)) + || ((y==3) && (x>2) && (x<5)))) + { + input >> NL; + grab(100+x*83,51+y*22,180+x*83,71+y*22); + } + } + close(out); + return EXIT_SUCCESS; +} diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp new file mode 100644 index 000000000000..8809bb58a325 --- /dev/null +++ b/engines/avalanche/xfghost.cpp @@ -0,0 +1,246 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ + + +const array<1,44,char> chunkheader = +string("Spooky file! Nearly a Chunk... (c) MT.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; + +const integer n = -1; /* "No change" in new-whatever */ + +const integer aa = -2; /* This is an aargh. */ + +const integer aargh_x_ofs = -177; const integer aargh_y_ofs = 52; + +enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; + +struct chunkblocktype { + flavourtype flavour; + integer x,y; + integer xl,yl; + longint size; +}; + +integer gd,gm,x,y; +untyped_file f; byte bit; +byte a; /*absolute $A000:0;*/ +palettetype cc; +char r; text t; +word s; pointer p; + +untyped_file chunkfile; +chunkblocktype cb; + +pointer a_p; word a_s; + +void open_chunk() +{; + assign(chunkfile,"v:spooky.avd"); + rewrite(chunkfile,1); + blockwrite(chunkfile,chunkheader,sizeof(chunkheader)); +} + +void close_chunk() +{; + close(chunkfile); +} + +void grab(integer x1,integer y1,integer x2,integer y2, flavourtype how, integer newx,integer newy) +{ + pointer p; + word s; + integer y; + byte bit; + +; +#ifndef DRYRUN + {; + cb.flavour=how; + switch (newx) { + case n: cb.x=x1; break; + case aa: cb.x=x1+aargh_x_ofs; break; + default: cb.x=newx; + } + + switch (newy) { + case n: cb.y=y1; break; + case aa: cb.y=y1+aargh_y_ofs; break; + default: cb.y=newy; + } + + cb.xl=x2-x1; + if (set_of_enum(flavourtype)::of(ch_ega,ch_one,ch_two, eos).has(how)) cb.xl=((cb.xl+7) / 8)*8; + cb.yl=y2-y1; + } + + if (how!=ch_natural) + {; + s=imagesize(x1,y1,x2,y2); + getmem(p,s); + getimage(x1,y1,x2,y2,p); + } + + rectangle(x1,y1,x2,y2); + + switch (how) { + case ch_bgi: cb.size=s; break; + } + + blockwrite(chunkfile,cb,sizeof(cb)); + + switch (how) { + case ch_bgi: blockwrite(chunkfile,p,s); break; + case ch_ega: {; + setactivepage(1); + cleardevice(); + putimage(0,0,p,0); + setactivepage(0); + + for( bit=0; bit <= 3; bit ++) + for( y=0; y <= cb.yl; y ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); + } + + y=getpixel(0,0); + } + break; + case ch_two: {; /* Same as EGA, but with only 2 planes. */ + setactivepage(1); + cleardevice(); + putimage(0,0,p,0); + setactivepage(0); + + for( bit=2; bit <= 3; bit ++) /* << Bit to grab? */ + for( y=0; y <= cb.yl; y ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); + } + + y=getpixel(0,0); + } + break; + case ch_one: {; /* ...but with only one plane! */ + setactivepage(1); + cleardevice(); + putimage(0,0,p,0); + setactivepage(0); + + for( bit=3; bit <= 3; bit ++) + for( y=0; y <= cb.yl; y ++) + {; + port[0x3c4]=2; port[0x3ce]=4; + port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); + } + + y=getpixel(0,0); + } + break; + } + + freemem(p,s); #endif + rectangle(x1,y1,x2,y2); + +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; +#ifndef DRYRUN + open_chunk(); +#endif + + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + assign(f,"c:\\sleep4\\colour.ptx"); reset(f,1); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + blockread(f,a,16000); /* 28000 */ + } + close(f); + + setwritemode(xorput); + + /* Grab the big ghost. */ + + grab( 0, 0,160, 65,ch_two,n,n); /* First column, */ + grab( 0, 67,172,127,ch_two,n,n); + grab( 0,132,158,190,ch_two,n,n); + + a_s=imagesize(349,36,361,43); getmem(a_p,a_s); + getimage(349,36,361,43,a_p); + setfillstyle(1,0); bar(349,36,361,43); + + grab(173, 66,347,124,ch_two,n,n); /* Second column. */ + grab(173, 6,352, 64,ch_two,n,n); + + putimage(349,36,a_p,0); + + /* Grab Avvy's eyes and the exclamation mark. */ + + grab(605, 10,620, 12,ch_bgi,n,n); /* Eyes looking left */ + grab(622, 10,638, 12,ch_bgi,n,n); /* Ditto looking right (eye eye, sir) */ + grab(611, 0,616, 5,ch_bgi,n,n); /* ! */ + + /* Grab the cobweb. */ + + grab(535, 25,639, 75,ch_one,n,0); + /* ^^^ Interesting point here: the ch_EGA save routine pads with black + space to the RIGHT of the object. Since this cobweb needs to be right- + justified, we must decrease x1 until xl is a multiple of 8. */ + + /* Grab Mark's signature. */ + + grab(462, 61,525, 65,ch_ega,576,195); + + /* Grab the open door. */ + + grab(180,132,294,180,ch_ega,520,127); + + /* Grab the bat. */ + + grab(354, 0,474, 28,ch_bgi,n,n); + grab(484, 0,526, 23,ch_bgi,n,n); + grab(542, 2,564, 22,ch_bgi,n,n); + + /* Grab the big fade-in face. */ + + grab(350, 71,420,105,ch_ega,n,n); /* Top line. */ + grab(421, 71,491,105,ch_ega,n,n); + + grab(350,107,419,141,ch_ega,n,n); /* Second line. */ + grab(421,107,490,141,ch_ega,n,n); + + grab(350,143,420,177,ch_ega,n,n); /* Third line. */ + grab(422,143,489,177,ch_ega,n,n); + + /* Grab the "AARGH!" */ + + grab(349, 36,361, 43,ch_bgi,aa,aa); /* A */ + grab(366, 31,385, 46,ch_bgi,aa,aa); /* Aa */ + grab(394, 34,415, 52,ch_bgi,aa,aa); /* Aar */ + grab(428, 33,457, 57,ch_bgi,aa,aa); /* Aarg */ + grab(471, 30,508, 59,ch_bgi,aa,aa); /* Aargh */ + grab(524, 30,524, 58,ch_bgi,aa,aa); /* Aargh! */ + + for( gd=0; gd <= 4; gd ++) + grab(509, 76+gd*22,551, 96+gd*22,ch_bgi,n,n); /* The big green eyes. */ + + for( gd=5; gd >= 0; gd --) + grab(181+gd*34,186,214+gd*34,199,ch_bgi,n,n); /* The red greldet. */ + + for( gd=0; gd <= 5; gd ++) + grab(390+gd*34,186,423+gd*34,199,ch_bgi,n,n); /* The blue greldet. */ + +#ifndef DRYRUN + close_chunk(); +#endif +return EXIT_SUCCESS; +} diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp new file mode 100644 index 000000000000..5645fa93305d --- /dev/null +++ b/engines/avalanche/zapdraw.cpp @@ -0,0 +1,38 @@ +#include "ptoc.h" + + +#include "graph.h" +/*#include "Crt.h"*/ +/*#include "Dos.h"*/ + + +untyped_file f; +byte bit; +byte a; /*absolute $A000:0; */ +integer gd,gm; + +void graphmode(integer mode) +{ + registers regs; +; + regs.ax=(mode % 0x100); + intr(0x10,regs); +} + +int main(int argc, const char* argv[]) +{pio_initialize(argc, argv); +; + gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + assign(f,"d:avltzap.raw"); reset(f,1); + for( bit=0; bit <= 3; bit ++) + {; + port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; + for( gd=0; gd <= 199; gd ++) + blockread(f,mem[0xa000*gd*80],40); /* 28000 */ + } + close(f); + setwritemode(xorput); + rectangle( 0, 0, 5, 8); + rectangle( 0, 10, 27, 19); +return EXIT_SUCCESS; +} From cc5b8732bbd525c1e6a50ab73eadbd6b2bf2398c Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 11:57:27 +0200 Subject: [PATCH 0002/1332] AVALANCHE: Remove #include "ptoc.h" lines from the beginning every .cpp files. --- engines/avalanche/1stoff.cpp | 2 +- engines/avalanche/access.cpp | 2 +- engines/avalanche/acci.cpp | 2 +- engines/avalanche/also.cpp | 2 +- engines/avalanche/andexor.cpp | 2 +- engines/avalanche/andexor2.cpp | 2 +- engines/avalanche/andextst.cpp | 2 +- engines/avalanche/arch.cpp | 2 +- engines/avalanche/avalot9.cpp | 2 +- engines/avalanche/avbkgrnd.cpp | 2 +- engines/avalanche/avmenu.cpp | 2 +- engines/avalanche/avvyans.cpp | 2 +- engines/avalanche/avvyans2.cpp | 2 +- engines/avalanche/avvymonk.cpp | 2 +- engines/avalanche/bakchunk.cpp | 2 +- engines/avalanche/basher.cpp | 2 +- engines/avalanche/bootstrp.cpp | 2 +- engines/avalanche/cadburys.cpp | 2 +- engines/avalanche/celer.cpp | 2 +- engines/avalanche/ch_egats.cpp | 2 +- engines/avalanche/charmap.cpp | 2 +- engines/avalanche/chunker.cpp | 2 +- engines/avalanche/chunkxf1.cpp | 2 +- engines/avalanche/chunkxf2.cpp | 2 +- engines/avalanche/chunkxf3.cpp | 2 +- engines/avalanche/chunkxf4.cpp | 2 +- engines/avalanche/chunkxf5.cpp | 2 +- engines/avalanche/chunkxf6.cpp | 2 +- engines/avalanche/chunkxf7.cpp | 2 +- engines/avalanche/chunkxf8.cpp | 2 +- engines/avalanche/chunkxf9.cpp | 2 +- engines/avalanche/chunkxfa.cpp | 2 +- engines/avalanche/chunkxfb.cpp | 2 +- engines/avalanche/chunkxfc.cpp | 2 +- engines/avalanche/chunkxfd.cpp | 2 +- engines/avalanche/chunkxfe.cpp | 2 +- engines/avalanche/chunkxff.cpp | 2 +- engines/avalanche/chunkxfg.cpp | 2 +- engines/avalanche/chunkxfh.cpp | 2 +- engines/avalanche/chunkxfi.cpp | 2 +- engines/avalanche/chunkxfj.cpp | 2 +- engines/avalanche/chunkxfk.cpp | 2 +- engines/avalanche/chunkxfl.cpp | 2 +- engines/avalanche/clock.cpp | 2 +- engines/avalanche/closing.cpp | 2 +- engines/avalanche/convert.cpp | 2 +- engines/avalanche/convmous.cpp | 2 +- engines/avalanche/credits.cpp | 2 +- engines/avalanche/displtxt.cpp | 2 +- engines/avalanche/dropdown.cpp | 2 +- engines/avalanche/dwidth.cpp | 2 +- engines/avalanche/edhead.cpp | 2 +- engines/avalanche/edna.cpp | 2 +- engines/avalanche/enhanced.cpp | 2 +- engines/avalanche/enid.cpp | 2 +- engines/avalanche/filer.cpp | 2 +- engines/avalanche/fileunit.cpp | 2 +- engines/avalanche/filing.cpp | 2 +- engines/avalanche/folktemp.cpp | 2 +- engines/avalanche/fontslid.cpp | 2 +- engines/avalanche/frere.cpp | 2 +- engines/avalanche/g-room.cpp | 2 +- engines/avalanche/golden.cpp | 2 +- engines/avalanche/gyro.cpp | 2 +- engines/avalanche/help.cpp | 2 +- engines/avalanche/help2.cpp | 2 +- engines/avalanche/helpbak.cpp | 2 +- engines/avalanche/helper.cpp | 2 +- engines/avalanche/hibits.cpp | 2 +- engines/avalanche/highs.cpp | 2 +- engines/avalanche/hiz.cpp | 2 +- engines/avalanche/incline.cpp | 2 +- engines/avalanche/initxf.cpp | 2 +- engines/avalanche/inputtes.cpp | 2 +- engines/avalanche/intro.cpp | 2 +- engines/avalanche/ints.cpp | 2 +- engines/avalanche/joysetup.cpp | 2 +- engines/avalanche/joystick.cpp | 2 +- engines/avalanche/loading.cpp | 2 +- engines/avalanche/logger.cpp | 2 +- engines/avalanche/lucerna.cpp | 2 +- engines/avalanche/magic2.cpp | 2 +- engines/avalanche/magidraw.cpp | 2 +- engines/avalanche/magishuf.cpp | 2 +- engines/avalanche/make!.cpp | 2 +- engines/avalanche/makeregi.cpp | 2 +- engines/avalanche/makesez.cpp | 2 +- engines/avalanche/makevmou.cpp | 2 +- engines/avalanche/menuxf.cpp | 2 +- engines/avalanche/minstran.cpp | 2 +- engines/avalanche/newsprit.cpp | 2 +- engines/avalanche/nim.cpp | 2 +- engines/avalanche/nimdraw.cpp | 2 +- engines/avalanche/nimunit.cpp | 2 +- engines/avalanche/oldfiler.cpp | 2 +- engines/avalanche/oldhighs.cpp | 2 +- engines/avalanche/oldincln.cpp | 2 +- engines/avalanche/oldtrip.cpp | 2 +- engines/avalanche/omtest.cpp | 2 +- engines/avalanche/oopmenu.cpp | 2 +- engines/avalanche/overlap.cpp | 2 +- engines/avalanche/overscro.cpp | 2 +- engines/avalanche/particle.cpp | 2 +- engines/avalanche/pictemp.cpp | 2 +- engines/avalanche/pictemp2.cpp | 2 +- engines/avalanche/pingo.cpp | 2 +- engines/avalanche/plottest.cpp | 2 +- engines/avalanche/preview1.cpp | 2 +- engines/avalanche/qintro.cpp | 2 +- engines/avalanche/qstars.cpp | 2 +- engines/avalanche/rawupd.cpp | 2 +- engines/avalanche/readsez.cpp | 2 +- engines/avalanche/reginam.cpp | 2 +- engines/avalanche/sackb1.cpp | 2 +- engines/avalanche/sackb3.cpp | 2 +- engines/avalanche/saving.cpp | 2 +- engines/avalanche/scr_1.cpp | 2 +- engines/avalanche/scr_2.cpp | 2 +- engines/avalanche/scr_3.cpp | 2 +- engines/avalanche/scr_4.cpp | 2 +- engines/avalanche/scr_5.cpp | 2 +- engines/avalanche/scr_9.cpp | 2 +- engines/avalanche/scrolls.cpp | 2 +- engines/avalanche/sequence.cpp | 2 +- engines/avalanche/setup.cpp | 2 +- engines/avalanche/seu.cpp | 2 +- engines/avalanche/seu_avvy.cpp | 2 +- engines/avalanche/sezedit.cpp | 2 +- engines/avalanche/sezunit.cpp | 2 +- engines/avalanche/sezxfr.cpp | 2 +- engines/avalanche/shell1.cpp | 2 +- engines/avalanche/shell2.cpp | 2 +- engines/avalanche/slope.cpp | 2 +- engines/avalanche/spread.cpp | 2 +- engines/avalanche/spread2.cpp | 2 +- engines/avalanche/squish.cpp | 2 +- engines/avalanche/ss_blank.cpp | 2 +- engines/avalanche/ss_clock.cpp | 2 +- engines/avalanche/stars.cpp | 2 +- engines/avalanche/status.cpp | 2 +- engines/avalanche/sticks.cpp | 2 +- engines/avalanche/sunrise.cpp | 2 +- engines/avalanche/tempo.cpp | 2 +- engines/avalanche/test.cpp | 2 +- engines/avalanche/test2.cpp | 2 +- engines/avalanche/testblit.cpp | 2 +- engines/avalanche/testcard.cpp | 2 +- engines/avalanche/testenh.cpp | 2 +- engines/avalanche/timeout.cpp | 2 +- engines/avalanche/travel.cpp | 2 +- engines/avalanche/trip.cpp | 2 +- engines/avalanche/trip3.cpp | 2 +- engines/avalanche/trip42.cpp | 2 +- engines/avalanche/trip5.cpp | 2 +- engines/avalanche/trip5tst.cpp | 2 +- engines/avalanche/trip5xf.cpp | 2 +- engines/avalanche/tripoop.cpp | 2 +- engines/avalanche/ttmenuxf.cpp | 2 +- engines/avalanche/unsquish.cpp | 2 +- engines/avalanche/viewdocs.cpp | 2 +- engines/avalanche/visa.cpp | 2 +- engines/avalanche/visatest.cpp | 2 +- engines/avalanche/xf_gover.cpp | 2 +- engines/avalanche/xf_help.cpp | 2 +- engines/avalanche/xf_visa.cpp | 2 +- engines/avalanche/xfbutton.cpp | 2 +- engines/avalanche/xfghost.cpp | 2 +- engines/avalanche/zapdraw.cpp | 2 +- 168 files changed, 168 insertions(+), 168 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index 99198b463852..e8debc3fbf30 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index 37c9649193c5..faa00bbf8076 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 86fac1858591..32fde0c88232 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* $D-*/ /* diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index 17853e618914..e5af1314e99d 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index 03cedfdfccf4..9cf259e11b11 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Trippancy IV - original file */ #include "graph.h" diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index 41f27af209d0..b5355d7cb2ed 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Trippancy IV - original file */ #include "graph.h" diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index 8aff7172d316..db5c659f88f7 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index 1ff2f1fd2d98..e05f173a922a 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index a439f87455f5..3780b79c1e8b 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index 13e6ceaef8c7..6488fb82b106 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/avmenu.cpp b/engines/avalanche/avmenu.cpp index 3cfff7d8b6cf..9b366a966099 100644 --- a/engines/avalanche/avmenu.cpp +++ b/engines/avalanche/avmenu.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index 68756874a864..1985194f9116 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index 915a33d3729e..9702ec2d22bf 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 5a4b70c81810..7d5143b27a74 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index 5cea62db1272..296c55abc706 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index 56cfcca023bf..3ac401ed7fe0 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index a903679a903d..141c69b46c57 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index b891123af511..383987534ab3 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __cadburys_implementation__ diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 61357f567bcc..bedab4bb8c93 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index a27c2612c164..0488d2112126 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index 8b38f8ad62b6..0eb701be37f6 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 6d48054a2e13..00cb696beb64 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index dce372283738..4b8d99e560a9 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 5d77d298d27e..252f132cda8e 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index 220d07b56328..d8b89dda72eb 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 2dfa34dc2774..4a644d2623c5 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index c9766830aece..a2d02f9105c6 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index 665222252a0b..b319f2b2f94d 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index 97bacb596741..8d2f7a9df032 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 4435ee48bd92..98ada51b7083 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index 96241d1487d1..156827b6b636 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index 6493e5241f1b..1703d4f8054f 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 7fda96c375dd..71fd991d4103 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index aefb15f8a261..ec5ff4bf7535 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index e87fbbabb18f..9752345a7170 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index adb7f8628e29..bc11f36f1938 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index 9fb2a2ed591e..e2c6a274895b 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index 077a330afec5..762a44a5833f 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 163ae512192a..4736700211e8 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 84157a84c533..917d83bdbf14 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 34a7109acc62..1f7f23462ad6 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 70748b9a5f1e..38523f695fd6 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 01a05509b6c3..8b942d9da360 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 16ec6f552bb5..66744016ce0f 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index b2af98740fc9..bfed58ea7f7f 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index 08639eecd730..ca41b367606c 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index c607b11e22aa..b5efcba4d884 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index 7669c85eaad1..d37849b115e9 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index 3c706dc14deb..376c3464926a 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 6c03a4724d1e..931940801f32 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index f66a41761023..aa0fd75451af 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index 9fcb68583b7a..c06d2b1fb240 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index 74352fe9f72e..d700a85c4a6f 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M 10000,0,1000*/ /*$V-*/ diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 299aec29143a..34a46ff18e86 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __enhanced_implementation__ diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index 89e1327191cf..fb2577a5045c 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index 036aa945af81..4ae92c3f5f90 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index a944fbc0a00c..d9de21073faa 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __fileunit_implementation__ /* v:filer.pas - "avvyfiler" - in unit form. */ diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index f990f8c338f2..841163fcf43a 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index c715aa99362f..47d5d58d63fe 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Get 'em back! */ #include "graph.h" diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 4a2ceb21c6ae..31154aa6048e 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index b3118ddd1d48..5f1b51714e24 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index fc8f47ec513b..386a16c0b920 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index 009a828e0ad8..3643f43d3f20 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$I c:\sleep5\DSMI.INC*/ #include "graph.h" diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index b530e45b08d2..0e05d77d4712 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index d155263306b8..804ded4e651c 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index b062015aece0..148f578b98f9 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index 91825236fab2..367fd20afa4f 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 50e6a074d830..07084132d80a 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index 8dba55c3c319..c6a80cbf8ab3 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + file inf,outf; diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 2ffd27198ba2..38d929e30ef2 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index bcff8ab2bd78..d9508b56e5d8 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M 6000,600,600*/ diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index 4103089cf54c..8cc8170b0e80 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index 964aa514224a..a485c1bcfa6e 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index 0c7300bfc84a..7d95ff90f34d 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index 5d34d69fc9ff..54cd3e64615f 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$I c:\sleep5\DSMI.INC*/ diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index 71c2d47577f5..acb607c821c9 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Avalot interrupt handler */ /*#include "Dos.h"*/ diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 0c07a35961ab..7d22a503a893 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Avalot joystick setup routines. To be incorporated into Setup2 whenever I get a chance. */ diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index 20f803ec1191..c3ab14ab199a 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __joystick_implementation__ diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index 4e48cb50a097..9bc4a0ce67e4 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index 5029dab2aba8..b95e450ccb2a 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index e268ac9ecf25..777e9bdfefdc 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index 03f54d04feb3..b7e9d12046d1 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 282eb5d18979..3c6b35e5da14 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 09db4d286d40..0f1c494a1ef7 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index 447f540b8ad6..2079547c5c98 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Phew! */ #include "graph.h" diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index 574d346660fd..2e927c8dcf46 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* regname's name starts at $7D1 (2001). */ diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index 50e58109e6c0..c264dc19e1b2 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index 5ed388531cf3..a5f3e25dd17f 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index 1919b118decf..6a5342e1f1db 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index 824fc806bcf7..29b3da7897b7 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index 073e546f250c..5f21ecde57b9 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index e5da17adff5c..7dab81bc956d 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index afcac6d85098..21618d65f85a 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index 0becd47d1087..4aae41b26b3a 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index c54a4696be0a..c91706019313 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index 1aed0c5026f3..4286ee2ea69b 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index 252d8b36c3be..6dd38b634327 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index 5e0fb99c4cca..1dddecbced8c 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index 52b1a0373e82..a683bf2daad1 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 5c1b13f08b44..641b9ba8a3f6 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __oopmenu_implementation__ diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index 973bafb79f84..b39b5bacaf36 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index 6e0b9fca7a1a..e4a2fc938cf2 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index e4c5b3ed9154..30f0cd37f28a 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index 144d9568532a..cc5386dc147e 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index 54e9e0dafaf0..d396c679a5b3 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Get 'em back! */ #include "graph.h" diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 1bb3066bffb3..5a98ba3fc106 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index 80f7937ca50c..b9c7fc757a16 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index aff9f1b5e567..bd5e4d450d35 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index 3843d808727e..b72703385383 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index 3a31a9e67a24..d6877aeb4fb0 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Demonstration of the Bigo II system. */ #include "graph.h" diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index a911e1d9180d..d37a1131cf4e 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index 744d221fd0c6..9937a4667021 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index c85dee39a971..65bd0b5d0ba6 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + const array<1,36,char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index 800738821c52..b84788a13f4f 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index b48379d364d4..4d70bf6ed117 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M 16384,0,0*/ diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 6f35a21ada4d..962495f7de39 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 5118cd8558e9..258ca6be4ee4 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 7a88efce95e5..55eba417ab2c 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 0c866fc7daa2..96c9d9ec0193 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index 605a1dc51b1c..183104ea9b2f 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index e90e55e45535..ab2359fa3d4b 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index e1363470fde2..6d46fac1c415 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 4a2a0d9fc051..4f02f06824db 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 00c838a95a85..fccb01bf15e1 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 60f91e38f12d..32fee351eebf 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index 9b1c1c23cca8..f1729f2773b0 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index fb236b95bbce..c9c30f8bcc05 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 946e318ebb59..5db639cbe19c 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M 65520,0,655360*/ diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index 755f247f8d56..1f15cf1dcd67 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __sezunit_implementation__ diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index bcc460346d2f..37c9cf00c05e 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index e8dfb592a31d..75296bfa825b 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M $800,0,0*/ diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index 053bca9eed5e..b0ef13ab47a6 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index a4b2f8a2de0d..c56624637c52 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 57361e8b46ad..5e5222801b5e 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 96545c2bc822..267bf8eefdce 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index 4f8cad4f550c..6ff3b903fe55 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index 670d12cf1dec..f8bc96b68948 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index 1880ee5c06a1..e169f37d9245 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index 309d9a4743fe..518124170ac4 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Demonstration of the Bigo II system. */ /* $I c:\sleep5\DSMI.INC*/ diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index 1e046fcc0c0a..761f11c42bb6 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index 1fc11cd31351..b47b6fb20d5d 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index 1ed894a46e77..4a0e3ac01d2f 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index 634f3214b60e..b8887ef4597d 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index 6d480843f251..1ac567151628 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$M 2048,0,0*/ diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index a4f678d6508f..e5b23477d99d 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Dos.h"*/ diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index bc00393150a9..2949f301fe09 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index 064b0a10b590..e1e869691cd4 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index 8077ca33d822..34e1d67389ad 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Enhanced.h"*/ diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index 26ab44989b69..d5b964df0d9d 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index b7597670d6c5..6f48f99f7a4b 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 3dc89ac9ec99..58ae537d2461 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index c67f6e1f51b2..d95eba50c6fb 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #define __trip3_implementation__ /* Project Minstrel- Trippancy routines */ diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index b55b209d132f..923e32e60037 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 3674b1ffd745..721268ba43c4 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index 4b95ff44375a..c669cc72589b 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index 0aa5f32ae2e5..f6225b4f4d3f 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index 15035c864dc2..b8db1a70e51d 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* Trip Oop (Trippancy 4 Andexor */ #include "graph.h" diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index 51903e948bc4..2d870fa02f95 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index ad8bd58acecb..9183e1b2f196 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$S-*/ #include "graph.h" diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index effb1c5474af..a9e1e6ec590f 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*$S-*/ /*#include "dos.h"*/ diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index f5bd51131e8d..664dca963102 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /* diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index 52970adacbf5..df856f6ea291 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 67bb5ff5619c..683e6ca2ec8f 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index 1f8063952e22..b0f68447c843 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index 888df55d4e18..5fe7156907d5 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + /*#include "Crt.h"*/ diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index dfbaf5e559bb..980eff8f60fa 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 8809bb58a325..86996ba924fc 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index 5645fa93305d..2c4f712e2719 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -1,4 +1,4 @@ -#include "ptoc.h" + #include "graph.h" From a183d560c1bd2c234b9bc7a8aa32af9b0f0d6182 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 13:42:47 +0200 Subject: [PATCH 0003/1332] AVALANCHE: Add standard header. --- engines/avalanche/1stoff.cpp | 5 +++++ engines/avalanche/access.cpp | 5 +++++ engines/avalanche/access.h | 4 ++++ engines/avalanche/acci.cpp | 5 +++++ engines/avalanche/acci.h | 4 ++++ engines/avalanche/also.cpp | 4 ++++ engines/avalanche/andexor.cpp | 5 +++++ engines/avalanche/andexor2.cpp | 5 +++++ engines/avalanche/andextst.cpp | 4 ++++ engines/avalanche/arch.cpp | 5 +++++ engines/avalanche/arch.h | 4 ++++ engines/avalanche/avalot9.cpp | 5 +++++ engines/avalanche/avbkgrnd.cpp | 4 ++++ engines/avalanche/avmenu.cpp | 4 ++++ engines/avalanche/avvyans.cpp | 4 ++++ engines/avalanche/avvyans2.cpp | 4 ++++ engines/avalanche/avvymonk.cpp | 4 ++++ engines/avalanche/bakchunk.cpp | 4 ++++ engines/avalanche/basher.cpp | 5 +++++ engines/avalanche/basher.h | 4 ++++ engines/avalanche/bootstrp.cpp | 5 +++++ engines/avalanche/cadburys.cpp | 4 ++++ engines/avalanche/cadburys.h | 4 ++++ engines/avalanche/celer.cpp | 5 +++++ engines/avalanche/celer.h | 4 ++++ engines/avalanche/ch_egats.cpp | 4 ++++ engines/avalanche/charmap.cpp | 5 +++++ engines/avalanche/chunker.cpp | 4 ++++ engines/avalanche/chunkxf1.cpp | 4 ++++ engines/avalanche/chunkxf2.cpp | 4 ++++ engines/avalanche/chunkxf3.cpp | 4 ++++ engines/avalanche/chunkxf4.cpp | 4 ++++ engines/avalanche/chunkxf5.cpp | 4 ++++ engines/avalanche/chunkxf6.cpp | 4 ++++ engines/avalanche/chunkxf7.cpp | 4 ++++ engines/avalanche/chunkxf8.cpp | 4 ++++ engines/avalanche/chunkxf9.cpp | 4 ++++ engines/avalanche/chunkxfa.cpp | 4 ++++ engines/avalanche/chunkxfb.cpp | 4 ++++ engines/avalanche/chunkxfc.cpp | 4 ++++ engines/avalanche/chunkxfd.cpp | 4 ++++ engines/avalanche/chunkxfe.cpp | 4 ++++ engines/avalanche/chunkxff.cpp | 4 ++++ engines/avalanche/chunkxfg.cpp | 4 ++++ engines/avalanche/chunkxfh.cpp | 4 ++++ engines/avalanche/chunkxfi.cpp | 4 ++++ engines/avalanche/chunkxfj.cpp | 4 ++++ engines/avalanche/chunkxfk.cpp | 4 ++++ engines/avalanche/chunkxfl.cpp | 4 ++++ engines/avalanche/clock.cpp | 5 +++++ engines/avalanche/closing.cpp | 5 +++++ engines/avalanche/closing.h | 4 ++++ engines/avalanche/convert.cpp | 4 ++++ engines/avalanche/convmous.cpp | 4 ++++ engines/avalanche/credits.cpp | 4 ++++ engines/avalanche/displtxt.cpp | 5 +++++ engines/avalanche/dropdown.cpp | 5 +++++ engines/avalanche/dropdown.h | 4 ++++ engines/avalanche/dwidth.cpp | 4 ++++ engines/avalanche/edhead.cpp | 4 ++++ engines/avalanche/edna.cpp | 5 +++++ engines/avalanche/enhanced.cpp | 4 ++++ engines/avalanche/enhanced.h | 4 ++++ engines/avalanche/enid.cpp | 5 +++++ engines/avalanche/enid.h | 4 ++++ engines/avalanche/filer.cpp | 4 ++++ engines/avalanche/fileunit.cpp | 4 ++++ engines/avalanche/fileunit.h | 4 ++++ engines/avalanche/filing.cpp | 5 +++++ engines/avalanche/folktemp.cpp | 5 +++++ engines/avalanche/fontslid.cpp | 5 +++++ engines/avalanche/frere.cpp | 5 +++++ engines/avalanche/g-room.cpp | 4 ++++ engines/avalanche/golden.cpp | 5 +++++ engines/avalanche/gyro.cpp | 5 +++++ engines/avalanche/gyro.h | 4 ++++ engines/avalanche/help.cpp | 4 ++++ engines/avalanche/help2.cpp | 4 ++++ engines/avalanche/helpbak.cpp | 5 +++++ engines/avalanche/helpbak.h | 4 ++++ engines/avalanche/helper.cpp | 5 +++++ engines/avalanche/helper.h | 4 ++++ engines/avalanche/hibits.cpp | 4 ++++ engines/avalanche/highs.cpp | 5 +++++ engines/avalanche/highs.h | 4 ++++ engines/avalanche/hiz.cpp | 5 +++++ engines/avalanche/incline.cpp | 5 +++++ engines/avalanche/incline.h | 4 ++++ engines/avalanche/initxf.cpp | 5 +++++ engines/avalanche/inputtes.cpp | 4 ++++ engines/avalanche/intro.cpp | 5 +++++ engines/avalanche/ints.cpp | 5 +++++ engines/avalanche/joysetup.cpp | 5 +++++ engines/avalanche/joystick.cpp | 4 ++++ engines/avalanche/joystick.h | 4 ++++ engines/avalanche/loading.cpp | 4 ++++ engines/avalanche/logger.cpp | 5 +++++ engines/avalanche/logger.h | 4 ++++ engines/avalanche/lucerna.cpp | 5 +++++ engines/avalanche/lucerna.h | 4 ++++ engines/avalanche/magic2.cpp | 4 ++++ engines/avalanche/magidraw.cpp | 4 ++++ engines/avalanche/magishuf.cpp | 5 +++++ engines/avalanche/make!.cpp | 5 +++++ engines/avalanche/makeregi.cpp | 5 +++++ engines/avalanche/makesez.cpp | 4 ++++ engines/avalanche/makevmou.cpp | 4 ++++ engines/avalanche/menuxf.cpp | 4 ++++ engines/avalanche/minstran.cpp | 4 ++++ engines/avalanche/newsprit.cpp | 4 ++++ engines/avalanche/nim.cpp | 4 ++++ engines/avalanche/nimdraw.cpp | 4 ++++ engines/avalanche/nimunit.cpp | 5 +++++ engines/avalanche/nimunit.h | 4 ++++ engines/avalanche/oldfiler.cpp | 5 +++++ engines/avalanche/oldhighs.cpp | 4 ++++ engines/avalanche/oldincln.cpp | 5 +++++ engines/avalanche/oldincln.h | 4 ++++ engines/avalanche/oldtrip.cpp | 5 +++++ engines/avalanche/oldtrip.h | 4 ++++ engines/avalanche/omtest.cpp | 4 ++++ engines/avalanche/oopmenu.cpp | 4 ++++ engines/avalanche/oopmenu.h | 4 ++++ engines/avalanche/overlap.cpp | 4 ++++ engines/avalanche/overscro.cpp | 4 ++++ engines/avalanche/particle.cpp | 4 ++++ engines/avalanche/pictemp.cpp | 4 ++++ engines/avalanche/pictemp2.cpp | 5 +++++ engines/avalanche/pingo.cpp | 5 +++++ engines/avalanche/pingo.h | 4 ++++ engines/avalanche/plottest.cpp | 4 ++++ engines/avalanche/preview1.cpp | 4 ++++ engines/avalanche/qintro.cpp | 5 +++++ engines/avalanche/qstars.cpp | 5 +++++ engines/avalanche/rawupd.cpp | 5 +++++ engines/avalanche/readsez.cpp | 4 ++++ engines/avalanche/reginam.cpp | 4 ++++ engines/avalanche/sackb1.cpp | 5 +++++ engines/avalanche/sackb1.h | 4 ++++ engines/avalanche/sackb3.cpp | 5 +++++ engines/avalanche/sackblas.cpp | 4 ++++ engines/avalanche/saving.cpp | 4 ++++ engines/avalanche/scr_1.cpp | 5 +++++ engines/avalanche/scr_2.cpp | 5 +++++ engines/avalanche/scr_3.cpp | 5 +++++ engines/avalanche/scr_4.cpp | 5 +++++ engines/avalanche/scr_5.cpp | 5 +++++ engines/avalanche/scr_9.cpp | 5 +++++ engines/avalanche/scrolls.cpp | 5 +++++ engines/avalanche/scrolls.h | 4 ++++ engines/avalanche/sequence.cpp | 5 +++++ engines/avalanche/sequence.h | 4 ++++ engines/avalanche/setup.cpp | 5 +++++ engines/avalanche/seu.cpp | 4 ++++ engines/avalanche/seu_avvy.cpp | 4 ++++ engines/avalanche/sez.cpp | 4 ++++ engines/avalanche/sezedit.cpp | 5 +++++ engines/avalanche/sezunit.cpp | 4 ++++ engines/avalanche/sezunit.h | 4 ++++ engines/avalanche/sezxfr.cpp | 5 +++++ engines/avalanche/shell1.cpp | 5 +++++ engines/avalanche/shell2.cpp | 5 +++++ engines/avalanche/slope.cpp | 4 ++++ engines/avalanche/spread.cpp | 4 ++++ engines/avalanche/spread2.cpp | 4 ++++ engines/avalanche/squish.cpp | 5 +++++ engines/avalanche/ss_blank.cpp | 5 +++++ engines/avalanche/ss_clock.cpp | 5 +++++ engines/avalanche/stars.cpp | 5 +++++ engines/avalanche/status.cpp | 4 ++++ engines/avalanche/sticks.cpp | 5 +++++ engines/avalanche/sticks.h | 4 ++++ engines/avalanche/sunrise.cpp | 4 ++++ engines/avalanche/tempo.cpp | 4 ++++ engines/avalanche/test.cpp | 5 +++++ engines/avalanche/test2.cpp | 5 +++++ engines/avalanche/testblit.cpp | 4 ++++ engines/avalanche/testcard.cpp | 4 ++++ engines/avalanche/testenh.cpp | 5 +++++ engines/avalanche/timeout.cpp | 5 +++++ engines/avalanche/timeout.h | 4 ++++ engines/avalanche/travel.cpp | 4 ++++ engines/avalanche/trip.cpp | 5 +++++ engines/avalanche/trip.h | 4 ++++ engines/avalanche/trip3.cpp | 4 ++++ engines/avalanche/trip3.h | 4 ++++ engines/avalanche/trip42.cpp | 5 +++++ engines/avalanche/trip42.h | 4 ++++ engines/avalanche/trip5.cpp | 5 +++++ engines/avalanche/trip5.h | 4 ++++ engines/avalanche/trip5tst.cpp | 4 ++++ engines/avalanche/trip5xf.cpp | 4 ++++ engines/avalanche/tripoop.cpp | 5 +++++ engines/avalanche/ttmenuxf.cpp | 4 ++++ engines/avalanche/unsquish.cpp | 5 +++++ engines/avalanche/viewdocs.cpp | 5 +++++ engines/avalanche/visa.cpp | 5 +++++ engines/avalanche/visa.h | 4 ++++ engines/avalanche/visatest.cpp | 5 +++++ engines/avalanche/waver.cpp | 4 ++++ engines/avalanche/xf_gover.cpp | 4 ++++ engines/avalanche/xf_help.cpp | 5 +++++ engines/avalanche/xf_visa.cpp | 5 +++++ engines/avalanche/xfbutton.cpp | 4 ++++ engines/avalanche/xfghost.cpp | 4 ++++ engines/avalanche/zapdraw.cpp | 4 ++++ 206 files changed, 904 insertions(+) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index e8debc3fbf30..2ba27a603488 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index faa00bbf8076..71aaa7c1a907 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h index 825deeb59d42..a6d412fe62e7 100644 --- a/engines/avalanche/access.h +++ b/engines/avalanche/access.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __access_h__ #define __access_h__ diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 32fde0c88232..f816019ab74a 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* $D-*/ diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h index f9d1265b327b..ab220b3d98b3 100644 --- a/engines/avalanche/acci.h +++ b/engines/avalanche/acci.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __acci_h__ #define __acci_h__ diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index e5af1314e99d..9fac1d0184c1 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index 9cf259e11b11..f1db882ff418 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Trippancy IV - original file */ diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index b5355d7cb2ed..5c77fc8e2b99 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Trippancy IV - original file */ diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index db5c659f88f7..6e9ec9450b3b 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index e05f173a922a..f59d28d9d016 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h index cb0960f9ddbb..031f9f39c9d8 100644 --- a/engines/avalanche/arch.h +++ b/engines/avalanche/arch.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __arch_h__ #define __arch_h__ diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index 3780b79c1e8b..d960a3940dc3 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index 6488fb82b106..4b7beba10de9 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/avmenu.cpp b/engines/avalanche/avmenu.cpp index 9b366a966099..aa1ea6932714 100644 --- a/engines/avalanche/avmenu.cpp +++ b/engines/avalanche/avmenu.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index 1985194f9116..f45966b5eeb7 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index 9702ec2d22bf..7bdb1e9bcf82 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 7d5143b27a74..74cc61da9b9c 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index 296c55abc706..fb148e2fd463 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index 3ac401ed7fe0..0e6e1644690e 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h index 1afecae44124..22ad3066de80 100644 --- a/engines/avalanche/basher.h +++ b/engines/avalanche/basher.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __basher_h__ #define __basher_h__ diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index 141c69b46c57..1d741841e38a 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index 383987534ab3..e37821a0529a 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __cadburys_implementation__ diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h index 65e7bd7c8b93..917fd4b62664 100644 --- a/engines/avalanche/cadburys.h +++ b/engines/avalanche/cadburys.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __cadburys_h__ #define __cadburys_h__ diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index bedab4bb8c93..e700c626751f 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index f6ad52ffb1c7..409729f04702 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __celer_h__ #define __celer_h__ diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index 0488d2112126..64f1c9d23606 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index 0eb701be37f6..6839b8559766 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 00cb696beb64..69034398e7b6 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index 4b8d99e560a9..b2dc01a64fc7 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 252f132cda8e..2c25a5292364 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index d8b89dda72eb..7f3adf4269e0 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 4a644d2623c5..ad64d6e3542c 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index a2d02f9105c6..9c80b53bfe5c 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index b319f2b2f94d..a2089f473768 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index 8d2f7a9df032..8f020320c7dc 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 98ada51b7083..6dacd0c096a5 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index 156827b6b636..a94f43243b30 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index 1703d4f8054f..fd102583a490 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 71fd991d4103..4698be290f26 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index ec5ff4bf7535..30b13e26b8c0 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index 9752345a7170..e8e786028ef4 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index bc11f36f1938..f2eb675a8b6e 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index e2c6a274895b..1b0b7d7a16b6 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index 762a44a5833f..bb289b37a77a 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 4736700211e8..210c08bdc63d 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 917d83bdbf14..27d41226c442 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 1f7f23462ad6..0f19c65f3521 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 38523f695fd6..78083b6467f5 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 8b942d9da360..c5f97974306a 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 66744016ce0f..849846ab0c6a 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index bfed58ea7f7f..aa72aef5c7f8 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index 97dd37e0c3fb..2c4eec427fb6 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __closing_h__ #define __closing_h__ diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index ca41b367606c..d0b0f23cae3c 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index b5efcba4d884..ef79ff8ec6cb 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index d37849b115e9..2481229f5dbf 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index 376c3464926a..e002978fb18b 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 931940801f32..320a5555f370 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index 9d32fb970594..349b1a00bbd2 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __dropdown_h__ #define __dropdown_h__ diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index aa0fd75451af..ec9e250f28d3 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index c06d2b1fb240..e8eca655663a 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index d700a85c4a6f..ebc7e4cd28c2 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /*$M 10000,0,1000*/ /*$V-*/ diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 34a46ff18e86..543d7689ae61 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __enhanced_implementation__ diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h index a028648ced09..d7296ca36195 100644 --- a/engines/avalanche/enhanced.h +++ b/engines/avalanche/enhanced.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __enhanced_h__ #define __enhanced_h__ diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index fb2577a5045c..c3dd4a86cd77 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h index abf20a27dcf5..6ebfc3d04a89 100644 --- a/engines/avalanche/enid.h +++ b/engines/avalanche/enid.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __enid_h__ #define __enid_h__ diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index 4ae92c3f5f90..ba76ee2b67b7 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index d9de21073faa..6d758b67b88c 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __fileunit_implementation__ diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h index 08f9262653c0..0f5fb7a4b702 100644 --- a/engines/avalanche/fileunit.h +++ b/engines/avalanche/fileunit.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __fileunit_h__ #define __fileunit_h__ diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index 841163fcf43a..bc6ce174da10 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index 47d5d58d63fe..ac371f34e3a3 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Get 'em back! */ diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 31154aa6048e..863de0b70f72 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index 5f1b51714e24..a4a6951764a7 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index 386a16c0b920..521cbb261afc 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index 3643f43d3f20..3b64783b0f69 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 0e05d77d4712..e7fdc2ac0002 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 8a1fdb5c0a03..5d6128bcd69f 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __gyro_h__ #define __gyro_h__ diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 804ded4e651c..7768fb6563ae 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index 148f578b98f9..aae1cc840be1 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index 367fd20afa4f..087f199ddb40 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h index 12a78690923d..ac8898ae3d01 100644 --- a/engines/avalanche/helpbak.h +++ b/engines/avalanche/helpbak.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __helpbak_h__ #define __helpbak_h__ diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 07084132d80a..76680b0a4441 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h index 9c1c43ca4267..86d19303d889 100644 --- a/engines/avalanche/helper.h +++ b/engines/avalanche/helper.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __helper_h__ #define __helper_h__ diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index c6a80cbf8ab3..ed041f5096c9 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 38d929e30ef2..552211b52a32 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h index 3d6eb65807b5..187b31cfe6ed 100644 --- a/engines/avalanche/highs.h +++ b/engines/avalanche/highs.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __highs_h__ #define __highs_h__ diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index d9508b56e5d8..11c54f8ca1a3 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index 8cc8170b0e80..99433f9fecd3 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h index 4b252a146e2a..2d858bd0e2a6 100644 --- a/engines/avalanche/incline.h +++ b/engines/avalanche/incline.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __incline_h__ #define __incline_h__ diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index a485c1bcfa6e..2dfde79f61ef 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index 7d95ff90f34d..b34c59a07262 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index 54cd3e64615f..ba230c022736 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index acb607c821c9..48eab01fc861 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Avalot interrupt handler */ diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 7d22a503a893..e4e73dc83fd9 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Avalot joystick setup routines. To be incorporated diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index c3ab14ab199a..9d329ef543ec 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __joystick_implementation__ diff --git a/engines/avalanche/joystick.h b/engines/avalanche/joystick.h index 0a3147eda2ee..00da7f092df3 100644 --- a/engines/avalanche/joystick.h +++ b/engines/avalanche/joystick.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __joystick_h__ #define __joystick_h__ diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index 9bc4a0ce67e4..70acdd0284da 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index b95e450ccb2a..344f99f0a5f9 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h index 016bfb625835..803227df9c0f 100644 --- a/engines/avalanche/logger.h +++ b/engines/avalanche/logger.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __logger_h__ #define __logger_h__ diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 777e9bdfefdc..4bc776a8ce77 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h index a602f8c02605..578557a2cfb5 100644 --- a/engines/avalanche/lucerna.h +++ b/engines/avalanche/lucerna.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __lucerna_h__ #define __lucerna_h__ diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index b7e9d12046d1..3e9e98670993 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 3c6b35e5da14..3fe305baf7c9 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 0f1c494a1ef7..8099c32dd1cb 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index 2079547c5c98..b0353295a5e4 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Phew! */ diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index 2e927c8dcf46..eaedee4fcfd1 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* regname's name starts at $7D1 (2001). */ diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index c264dc19e1b2..4455fbc40c99 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index a5f3e25dd17f..9e933b3b71e0 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index 6a5342e1f1db..f1d8df6874f9 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index 29b3da7897b7..fa8f948780bc 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index 5f21ecde57b9..245bda66dd39 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 7dab81bc956d..4d05e34587a2 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index 21618d65f85a..0577410beb1a 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index 4aae41b26b3a..83a5260cbe8b 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h index 5e3386d47f6b..4e23124709f6 100644 --- a/engines/avalanche/nimunit.h +++ b/engines/avalanche/nimunit.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __nimunit_h__ #define __nimunit_h__ diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index c91706019313..cd1f8748f38c 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index 4286ee2ea69b..4fd83e054fe7 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index 6dd38b634327..4a2ee463bf67 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h index a0db659f92b0..18ed82eb5b5e 100644 --- a/engines/avalanche/oldincln.h +++ b/engines/avalanche/oldincln.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __oldincln_h__ #define __oldincln_h__ diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index 1dddecbced8c..bee02949074d 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h index dc36efd2d644..e73721492f6b 100644 --- a/engines/avalanche/oldtrip.h +++ b/engines/avalanche/oldtrip.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __oldtrip_h__ #define __oldtrip_h__ diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index a683bf2daad1..8e89fc7c1df6 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 641b9ba8a3f6..d2d24150adeb 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __oopmenu_implementation__ diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h index ee928e2050ab..f753f5edde03 100644 --- a/engines/avalanche/oopmenu.h +++ b/engines/avalanche/oopmenu.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __oopmenu_h__ #define __oopmenu_h__ diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index b39b5bacaf36..8659943a286c 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index e4a2fc938cf2..853a434918ce 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index 30f0cd37f28a..01657e79ac40 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index cc5386dc147e..009ced5973d5 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index d396c679a5b3..b2eddc255c7e 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Get 'em back! */ diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 5a98ba3fc106..8bc6149ad494 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index fdb49b7048c9..6979229d497d 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __pingo_h__ #define __pingo_h__ diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index b9c7fc757a16..12f378560dde 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index bd5e4d450d35..a5d8f05dde3e 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index b72703385383..477b1ffa9ff8 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index d6877aeb4fb0..08de16e765c7 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Demonstration of the Bigo II system. */ diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index d37a1131cf4e..c8e4b153f7c3 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index 9937a4667021..0417c286557f 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 65bd0b5d0ba6..590809c9e8a4 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index b84788a13f4f..3d3d172d40f2 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h index b671da2a760e..42fd668ec135 100644 --- a/engines/avalanche/sackb1.h +++ b/engines/avalanche/sackb1.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __sackb1_h__ #define __sackb1_h__ diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index 4d70bf6ed117..1bf586c4e409 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /*$M 16384,0,0*/ diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp index e69de29bb2d1..4bf6ebabc6c5 100644 --- a/engines/avalanche/sackblas.cpp +++ b/engines/avalanche/sackblas.cpp @@ -0,0 +1,4 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 962495f7de39..38270071913e 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 258ca6be4ee4..6e9ba57d9a5f 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 55eba417ab2c..3c5443852570 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 96c9d9ec0193..1d959b83c3bb 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index 183104ea9b2f..db9a43092bb8 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index ab2359fa3d4b..dfc3e9c42c73 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index 6d46fac1c415..d398a3efc89a 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 4f02f06824db..57aac3125bb4 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h index d71ec5d5e295..f035f3fc9789 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/scrolls.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __scrolls_h__ #define __scrolls_h__ diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index fccb01bf15e1..853d2fbaaf41 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index a6c59a612692..a14e0e040f11 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __sequence_h__ #define __sequence_h__ diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 32fee351eebf..94e969acf0de 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index f1729f2773b0..f896da8d09ab 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index c9c30f8bcc05..6e7d31c229cf 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp index e69de29bb2d1..4bf6ebabc6c5 100644 --- a/engines/avalanche/sez.cpp +++ b/engines/avalanche/sez.cpp @@ -0,0 +1,4 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 5db639cbe19c..3a57ee8ddd42 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index 1f15cf1dcd67..4a4ca608d3fe 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __sezunit_implementation__ diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h index 6b0a99ee54cd..b5644c95fda4 100644 --- a/engines/avalanche/sezunit.h +++ b/engines/avalanche/sezunit.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __sezunit_h__ #define __sezunit_h__ diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 37c9cf00c05e..3b48c437cc4e 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index 75296bfa825b..a5e0f13c4630 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index b0ef13ab47a6..d9bb2d168c17 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index c56624637c52..d9957df28d92 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 5e5222801b5e..87a8417ea090 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 267bf8eefdce..843550b36440 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index 6ff3b903fe55..521c144768e0 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index f8bc96b68948..40641c9b0f15 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index e169f37d9245..9b3d53836130 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index 518124170ac4..d626b359a10c 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Demonstration of the Bigo II system. */ diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index 761f11c42bb6..cae0182a91ae 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index b47b6fb20d5d..0297bfffdbb3 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h index 5a54cd44bc2d..2312d45cdb75 100644 --- a/engines/avalanche/sticks.h +++ b/engines/avalanche/sticks.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __sticks_h__ #define __sticks_h__ diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index 4a0e3ac01d2f..035d81be8bf1 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index b8887ef4597d..d58a818d0799 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index 1ac567151628..b13d73433044 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index e5b23477d99d..116344a0a12e 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index 2949f301fe09..11146a813742 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index e1e869691cd4..2ca0c0b9f696 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index 34e1d67389ad..0fc936f55abd 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index d5b964df0d9d..5a4cc9e896e6 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h index 5fa9800388c7..7068e7e5a309 100644 --- a/engines/avalanche/timeout.h +++ b/engines/avalanche/timeout.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __timeout_h__ #define __timeout_h__ diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index 6f48f99f7a4b..e27e48ce7a34 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 58ae537d2461..add6fa155c9a 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h index 520e323fe892..c018264cd1f2 100644 --- a/engines/avalanche/trip.h +++ b/engines/avalanche/trip.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __trip_h__ #define __trip_h__ diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index d95eba50c6fb..38227b0c760b 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __trip3_implementation__ diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h index ccad15346bb3..32144e1496d4 100644 --- a/engines/avalanche/trip3.h +++ b/engines/avalanche/trip3.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __trip3_h__ #define __trip3_h__ diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index 923e32e60037..5ae624cc6cdc 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h index b5e4f1361485..bed52bbcd000 100644 --- a/engines/avalanche/trip42.h +++ b/engines/avalanche/trip42.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __trip42_h__ #define __trip42_h__ diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 721268ba43c4..6dd411380a86 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h index 9e7b3a33bce6..a06b6e9efd77 100644 --- a/engines/avalanche/trip5.h +++ b/engines/avalanche/trip5.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __trip5_h__ #define __trip5_h__ diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index c669cc72589b..c4ab58e28d5d 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index f6225b4f4d3f..582c8af3452e 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index b8db1a70e51d..322dba8ad485 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* Trip Oop (Trippancy 4 Andexor */ diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index 2d870fa02f95..b92db51b88f7 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index 9183e1b2f196..a5f0840badfa 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /*$S-*/ diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index a9e1e6ec590f..09cd333d6a2b 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /*$S-*/ diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index 664dca963102..aec063f89e4a 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + /* diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h index 8b79d6be1836..1cfb77fecfe3 100644 --- a/engines/avalanche/visa.h +++ b/engines/avalanche/visa.h @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #ifndef __visa_h__ #define __visa_h__ diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index df856f6ea291..56c95950c722 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp index e69de29bb2d1..4bf6ebabc6c5 100644 --- a/engines/avalanche/waver.cpp +++ b/engines/avalanche/waver.cpp @@ -0,0 +1,4 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 683e6ca2ec8f..402f3ab33afa 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index b0f68447c843..162fcece39c0 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index 5fe7156907d5..2eb565abf8f6 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -1,3 +1,8 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index 980eff8f60fa..1881e97455f5 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 86996ba924fc..e03399a7d03c 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index 2c4f712e2719..5ab55d147eb4 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -1,3 +1,7 @@ +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ From d33da0a429b2c62b9ac9b72003beee4ee097c302 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 13:49:08 +0200 Subject: [PATCH 0004/1332] Revert "AVALANCHE: Add standard header." This reverts commit b87de38cc8dc270c272b681b8581decc602ae984. --- engines/avalanche/1stoff.cpp | 5 ----- engines/avalanche/access.cpp | 5 ----- engines/avalanche/access.h | 4 ---- engines/avalanche/acci.cpp | 5 ----- engines/avalanche/acci.h | 4 ---- engines/avalanche/also.cpp | 4 ---- engines/avalanche/andexor.cpp | 5 ----- engines/avalanche/andexor2.cpp | 5 ----- engines/avalanche/andextst.cpp | 4 ---- engines/avalanche/arch.cpp | 5 ----- engines/avalanche/arch.h | 4 ---- engines/avalanche/avalot9.cpp | 5 ----- engines/avalanche/avbkgrnd.cpp | 4 ---- engines/avalanche/avmenu.cpp | 4 ---- engines/avalanche/avvyans.cpp | 4 ---- engines/avalanche/avvyans2.cpp | 4 ---- engines/avalanche/avvymonk.cpp | 4 ---- engines/avalanche/bakchunk.cpp | 4 ---- engines/avalanche/basher.cpp | 5 ----- engines/avalanche/basher.h | 4 ---- engines/avalanche/bootstrp.cpp | 5 ----- engines/avalanche/cadburys.cpp | 4 ---- engines/avalanche/cadburys.h | 4 ---- engines/avalanche/celer.cpp | 5 ----- engines/avalanche/celer.h | 4 ---- engines/avalanche/ch_egats.cpp | 4 ---- engines/avalanche/charmap.cpp | 5 ----- engines/avalanche/chunker.cpp | 4 ---- engines/avalanche/chunkxf1.cpp | 4 ---- engines/avalanche/chunkxf2.cpp | 4 ---- engines/avalanche/chunkxf3.cpp | 4 ---- engines/avalanche/chunkxf4.cpp | 4 ---- engines/avalanche/chunkxf5.cpp | 4 ---- engines/avalanche/chunkxf6.cpp | 4 ---- engines/avalanche/chunkxf7.cpp | 4 ---- engines/avalanche/chunkxf8.cpp | 4 ---- engines/avalanche/chunkxf9.cpp | 4 ---- engines/avalanche/chunkxfa.cpp | 4 ---- engines/avalanche/chunkxfb.cpp | 4 ---- engines/avalanche/chunkxfc.cpp | 4 ---- engines/avalanche/chunkxfd.cpp | 4 ---- engines/avalanche/chunkxfe.cpp | 4 ---- engines/avalanche/chunkxff.cpp | 4 ---- engines/avalanche/chunkxfg.cpp | 4 ---- engines/avalanche/chunkxfh.cpp | 4 ---- engines/avalanche/chunkxfi.cpp | 4 ---- engines/avalanche/chunkxfj.cpp | 4 ---- engines/avalanche/chunkxfk.cpp | 4 ---- engines/avalanche/chunkxfl.cpp | 4 ---- engines/avalanche/clock.cpp | 5 ----- engines/avalanche/closing.cpp | 5 ----- engines/avalanche/closing.h | 4 ---- engines/avalanche/convert.cpp | 4 ---- engines/avalanche/convmous.cpp | 4 ---- engines/avalanche/credits.cpp | 4 ---- engines/avalanche/displtxt.cpp | 5 ----- engines/avalanche/dropdown.cpp | 5 ----- engines/avalanche/dropdown.h | 4 ---- engines/avalanche/dwidth.cpp | 4 ---- engines/avalanche/edhead.cpp | 4 ---- engines/avalanche/edna.cpp | 5 ----- engines/avalanche/enhanced.cpp | 4 ---- engines/avalanche/enhanced.h | 4 ---- engines/avalanche/enid.cpp | 5 ----- engines/avalanche/enid.h | 4 ---- engines/avalanche/filer.cpp | 4 ---- engines/avalanche/fileunit.cpp | 4 ---- engines/avalanche/fileunit.h | 4 ---- engines/avalanche/filing.cpp | 5 ----- engines/avalanche/folktemp.cpp | 5 ----- engines/avalanche/fontslid.cpp | 5 ----- engines/avalanche/frere.cpp | 5 ----- engines/avalanche/g-room.cpp | 4 ---- engines/avalanche/golden.cpp | 5 ----- engines/avalanche/gyro.cpp | 5 ----- engines/avalanche/gyro.h | 4 ---- engines/avalanche/help.cpp | 4 ---- engines/avalanche/help2.cpp | 4 ---- engines/avalanche/helpbak.cpp | 5 ----- engines/avalanche/helpbak.h | 4 ---- engines/avalanche/helper.cpp | 5 ----- engines/avalanche/helper.h | 4 ---- engines/avalanche/hibits.cpp | 4 ---- engines/avalanche/highs.cpp | 5 ----- engines/avalanche/highs.h | 4 ---- engines/avalanche/hiz.cpp | 5 ----- engines/avalanche/incline.cpp | 5 ----- engines/avalanche/incline.h | 4 ---- engines/avalanche/initxf.cpp | 5 ----- engines/avalanche/inputtes.cpp | 4 ---- engines/avalanche/intro.cpp | 5 ----- engines/avalanche/ints.cpp | 5 ----- engines/avalanche/joysetup.cpp | 5 ----- engines/avalanche/joystick.cpp | 4 ---- engines/avalanche/joystick.h | 4 ---- engines/avalanche/loading.cpp | 4 ---- engines/avalanche/logger.cpp | 5 ----- engines/avalanche/logger.h | 4 ---- engines/avalanche/lucerna.cpp | 5 ----- engines/avalanche/lucerna.h | 4 ---- engines/avalanche/magic2.cpp | 4 ---- engines/avalanche/magidraw.cpp | 4 ---- engines/avalanche/magishuf.cpp | 5 ----- engines/avalanche/make!.cpp | 5 ----- engines/avalanche/makeregi.cpp | 5 ----- engines/avalanche/makesez.cpp | 4 ---- engines/avalanche/makevmou.cpp | 4 ---- engines/avalanche/menuxf.cpp | 4 ---- engines/avalanche/minstran.cpp | 4 ---- engines/avalanche/newsprit.cpp | 4 ---- engines/avalanche/nim.cpp | 4 ---- engines/avalanche/nimdraw.cpp | 4 ---- engines/avalanche/nimunit.cpp | 5 ----- engines/avalanche/nimunit.h | 4 ---- engines/avalanche/oldfiler.cpp | 5 ----- engines/avalanche/oldhighs.cpp | 4 ---- engines/avalanche/oldincln.cpp | 5 ----- engines/avalanche/oldincln.h | 4 ---- engines/avalanche/oldtrip.cpp | 5 ----- engines/avalanche/oldtrip.h | 4 ---- engines/avalanche/omtest.cpp | 4 ---- engines/avalanche/oopmenu.cpp | 4 ---- engines/avalanche/oopmenu.h | 4 ---- engines/avalanche/overlap.cpp | 4 ---- engines/avalanche/overscro.cpp | 4 ---- engines/avalanche/particle.cpp | 4 ---- engines/avalanche/pictemp.cpp | 4 ---- engines/avalanche/pictemp2.cpp | 5 ----- engines/avalanche/pingo.cpp | 5 ----- engines/avalanche/pingo.h | 4 ---- engines/avalanche/plottest.cpp | 4 ---- engines/avalanche/preview1.cpp | 4 ---- engines/avalanche/qintro.cpp | 5 ----- engines/avalanche/qstars.cpp | 5 ----- engines/avalanche/rawupd.cpp | 5 ----- engines/avalanche/readsez.cpp | 4 ---- engines/avalanche/reginam.cpp | 4 ---- engines/avalanche/sackb1.cpp | 5 ----- engines/avalanche/sackb1.h | 4 ---- engines/avalanche/sackb3.cpp | 5 ----- engines/avalanche/sackblas.cpp | 4 ---- engines/avalanche/saving.cpp | 4 ---- engines/avalanche/scr_1.cpp | 5 ----- engines/avalanche/scr_2.cpp | 5 ----- engines/avalanche/scr_3.cpp | 5 ----- engines/avalanche/scr_4.cpp | 5 ----- engines/avalanche/scr_5.cpp | 5 ----- engines/avalanche/scr_9.cpp | 5 ----- engines/avalanche/scrolls.cpp | 5 ----- engines/avalanche/scrolls.h | 4 ---- engines/avalanche/sequence.cpp | 5 ----- engines/avalanche/sequence.h | 4 ---- engines/avalanche/setup.cpp | 5 ----- engines/avalanche/seu.cpp | 4 ---- engines/avalanche/seu_avvy.cpp | 4 ---- engines/avalanche/sez.cpp | 4 ---- engines/avalanche/sezedit.cpp | 5 ----- engines/avalanche/sezunit.cpp | 4 ---- engines/avalanche/sezunit.h | 4 ---- engines/avalanche/sezxfr.cpp | 5 ----- engines/avalanche/shell1.cpp | 5 ----- engines/avalanche/shell2.cpp | 5 ----- engines/avalanche/slope.cpp | 4 ---- engines/avalanche/spread.cpp | 4 ---- engines/avalanche/spread2.cpp | 4 ---- engines/avalanche/squish.cpp | 5 ----- engines/avalanche/ss_blank.cpp | 5 ----- engines/avalanche/ss_clock.cpp | 5 ----- engines/avalanche/stars.cpp | 5 ----- engines/avalanche/status.cpp | 4 ---- engines/avalanche/sticks.cpp | 5 ----- engines/avalanche/sticks.h | 4 ---- engines/avalanche/sunrise.cpp | 4 ---- engines/avalanche/tempo.cpp | 4 ---- engines/avalanche/test.cpp | 5 ----- engines/avalanche/test2.cpp | 5 ----- engines/avalanche/testblit.cpp | 4 ---- engines/avalanche/testcard.cpp | 4 ---- engines/avalanche/testenh.cpp | 5 ----- engines/avalanche/timeout.cpp | 5 ----- engines/avalanche/timeout.h | 4 ---- engines/avalanche/travel.cpp | 4 ---- engines/avalanche/trip.cpp | 5 ----- engines/avalanche/trip.h | 4 ---- engines/avalanche/trip3.cpp | 4 ---- engines/avalanche/trip3.h | 4 ---- engines/avalanche/trip42.cpp | 5 ----- engines/avalanche/trip42.h | 4 ---- engines/avalanche/trip5.cpp | 5 ----- engines/avalanche/trip5.h | 4 ---- engines/avalanche/trip5tst.cpp | 4 ---- engines/avalanche/trip5xf.cpp | 4 ---- engines/avalanche/tripoop.cpp | 5 ----- engines/avalanche/ttmenuxf.cpp | 4 ---- engines/avalanche/unsquish.cpp | 5 ----- engines/avalanche/viewdocs.cpp | 5 ----- engines/avalanche/visa.cpp | 5 ----- engines/avalanche/visa.h | 4 ---- engines/avalanche/visatest.cpp | 5 ----- engines/avalanche/waver.cpp | 4 ---- engines/avalanche/xf_gover.cpp | 4 ---- engines/avalanche/xf_help.cpp | 5 ----- engines/avalanche/xf_visa.cpp | 5 ----- engines/avalanche/xfbutton.cpp | 4 ---- engines/avalanche/xfghost.cpp | 4 ---- engines/avalanche/zapdraw.cpp | 4 ---- 206 files changed, 904 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index 2ba27a603488..e8debc3fbf30 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index 71aaa7c1a907..faa00bbf8076 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h index a6d412fe62e7..825deeb59d42 100644 --- a/engines/avalanche/access.h +++ b/engines/avalanche/access.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __access_h__ #define __access_h__ diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index f816019ab74a..32fde0c88232 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* $D-*/ diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h index ab220b3d98b3..f9d1265b327b 100644 --- a/engines/avalanche/acci.h +++ b/engines/avalanche/acci.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __acci_h__ #define __acci_h__ diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index 9fac1d0184c1..e5af1314e99d 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index f1db882ff418..9cf259e11b11 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Trippancy IV - original file */ diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index 5c77fc8e2b99..b5355d7cb2ed 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Trippancy IV - original file */ diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index 6e9ec9450b3b..db5c659f88f7 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index f59d28d9d016..e05f173a922a 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h index 031f9f39c9d8..cb0960f9ddbb 100644 --- a/engines/avalanche/arch.h +++ b/engines/avalanche/arch.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __arch_h__ #define __arch_h__ diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index d960a3940dc3..3780b79c1e8b 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index 4b7beba10de9..6488fb82b106 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/avmenu.cpp b/engines/avalanche/avmenu.cpp index aa1ea6932714..9b366a966099 100644 --- a/engines/avalanche/avmenu.cpp +++ b/engines/avalanche/avmenu.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index f45966b5eeb7..1985194f9116 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index 7bdb1e9bcf82..9702ec2d22bf 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 74cc61da9b9c..7d5143b27a74 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index fb148e2fd463..296c55abc706 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index 0e6e1644690e..3ac401ed7fe0 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h index 22ad3066de80..1afecae44124 100644 --- a/engines/avalanche/basher.h +++ b/engines/avalanche/basher.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __basher_h__ #define __basher_h__ diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index 1d741841e38a..141c69b46c57 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index e37821a0529a..383987534ab3 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __cadburys_implementation__ diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h index 917fd4b62664..65e7bd7c8b93 100644 --- a/engines/avalanche/cadburys.h +++ b/engines/avalanche/cadburys.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __cadburys_h__ #define __cadburys_h__ diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index e700c626751f..bedab4bb8c93 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index 409729f04702..f6ad52ffb1c7 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __celer_h__ #define __celer_h__ diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index 64f1c9d23606..0488d2112126 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index 6839b8559766..0eb701be37f6 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 69034398e7b6..00cb696beb64 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index b2dc01a64fc7..4b8d99e560a9 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 2c25a5292364..252f132cda8e 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index 7f3adf4269e0..d8b89dda72eb 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index ad64d6e3542c..4a644d2623c5 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index 9c80b53bfe5c..a2d02f9105c6 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index a2089f473768..b319f2b2f94d 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index 8f020320c7dc..8d2f7a9df032 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 6dacd0c096a5..98ada51b7083 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index a94f43243b30..156827b6b636 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index fd102583a490..1703d4f8054f 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 4698be290f26..71fd991d4103 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index 30b13e26b8c0..ec5ff4bf7535 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index e8e786028ef4..9752345a7170 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index f2eb675a8b6e..bc11f36f1938 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index 1b0b7d7a16b6..e2c6a274895b 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index bb289b37a77a..762a44a5833f 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 210c08bdc63d..4736700211e8 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 27d41226c442..917d83bdbf14 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 0f19c65f3521..1f7f23462ad6 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 78083b6467f5..38523f695fd6 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index c5f97974306a..8b942d9da360 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 849846ab0c6a..66744016ce0f 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index aa72aef5c7f8..bfed58ea7f7f 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index 2c4eec427fb6..97dd37e0c3fb 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __closing_h__ #define __closing_h__ diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index d0b0f23cae3c..ca41b367606c 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index ef79ff8ec6cb..b5efcba4d884 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index 2481229f5dbf..d37849b115e9 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index e002978fb18b..376c3464926a 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 320a5555f370..931940801f32 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index 349b1a00bbd2..9d32fb970594 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __dropdown_h__ #define __dropdown_h__ diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index ec9e250f28d3..aa0fd75451af 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index e8eca655663a..c06d2b1fb240 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index ebc7e4cd28c2..d700a85c4a6f 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /*$M 10000,0,1000*/ /*$V-*/ diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 543d7689ae61..34a46ff18e86 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __enhanced_implementation__ diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h index d7296ca36195..a028648ced09 100644 --- a/engines/avalanche/enhanced.h +++ b/engines/avalanche/enhanced.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __enhanced_h__ #define __enhanced_h__ diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index c3dd4a86cd77..fb2577a5045c 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h index 6ebfc3d04a89..abf20a27dcf5 100644 --- a/engines/avalanche/enid.h +++ b/engines/avalanche/enid.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __enid_h__ #define __enid_h__ diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index ba76ee2b67b7..4ae92c3f5f90 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index 6d758b67b88c..d9de21073faa 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __fileunit_implementation__ diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h index 0f5fb7a4b702..08f9262653c0 100644 --- a/engines/avalanche/fileunit.h +++ b/engines/avalanche/fileunit.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __fileunit_h__ #define __fileunit_h__ diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index bc6ce174da10..841163fcf43a 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index ac371f34e3a3..47d5d58d63fe 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Get 'em back! */ diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 863de0b70f72..31154aa6048e 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index a4a6951764a7..5f1b51714e24 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index 521cbb261afc..386a16c0b920 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index 3b64783b0f69..3643f43d3f20 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index e7fdc2ac0002..0e05d77d4712 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 5d6128bcd69f..8a1fdb5c0a03 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __gyro_h__ #define __gyro_h__ diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 7768fb6563ae..804ded4e651c 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index aae1cc840be1..148f578b98f9 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index 087f199ddb40..367fd20afa4f 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h index ac8898ae3d01..12a78690923d 100644 --- a/engines/avalanche/helpbak.h +++ b/engines/avalanche/helpbak.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __helpbak_h__ #define __helpbak_h__ diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 76680b0a4441..07084132d80a 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h index 86d19303d889..9c1c43ca4267 100644 --- a/engines/avalanche/helper.h +++ b/engines/avalanche/helper.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __helper_h__ #define __helper_h__ diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index ed041f5096c9..c6a80cbf8ab3 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 552211b52a32..38d929e30ef2 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h index 187b31cfe6ed..3d6eb65807b5 100644 --- a/engines/avalanche/highs.h +++ b/engines/avalanche/highs.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __highs_h__ #define __highs_h__ diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index 11c54f8ca1a3..d9508b56e5d8 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index 99433f9fecd3..8cc8170b0e80 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h index 2d858bd0e2a6..4b252a146e2a 100644 --- a/engines/avalanche/incline.h +++ b/engines/avalanche/incline.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __incline_h__ #define __incline_h__ diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index 2dfde79f61ef..a485c1bcfa6e 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index b34c59a07262..7d95ff90f34d 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index ba230c022736..54cd3e64615f 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index 48eab01fc861..acb607c821c9 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Avalot interrupt handler */ diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index e4e73dc83fd9..7d22a503a893 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Avalot joystick setup routines. To be incorporated diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index 9d329ef543ec..c3ab14ab199a 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __joystick_implementation__ diff --git a/engines/avalanche/joystick.h b/engines/avalanche/joystick.h index 00da7f092df3..0a3147eda2ee 100644 --- a/engines/avalanche/joystick.h +++ b/engines/avalanche/joystick.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __joystick_h__ #define __joystick_h__ diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index 70acdd0284da..9bc4a0ce67e4 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index 344f99f0a5f9..b95e450ccb2a 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h index 803227df9c0f..016bfb625835 100644 --- a/engines/avalanche/logger.h +++ b/engines/avalanche/logger.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __logger_h__ #define __logger_h__ diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 4bc776a8ce77..777e9bdfefdc 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h index 578557a2cfb5..a602f8c02605 100644 --- a/engines/avalanche/lucerna.h +++ b/engines/avalanche/lucerna.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __lucerna_h__ #define __lucerna_h__ diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index 3e9e98670993..b7e9d12046d1 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 3fe305baf7c9..3c6b35e5da14 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 8099c32dd1cb..0f1c494a1ef7 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index b0353295a5e4..2079547c5c98 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Phew! */ diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index eaedee4fcfd1..2e927c8dcf46 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* regname's name starts at $7D1 (2001). */ diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index 4455fbc40c99..c264dc19e1b2 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index 9e933b3b71e0..a5f3e25dd17f 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index f1d8df6874f9..6a5342e1f1db 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index fa8f948780bc..29b3da7897b7 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index 245bda66dd39..5f21ecde57b9 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 4d05e34587a2..7dab81bc956d 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index 0577410beb1a..21618d65f85a 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index 83a5260cbe8b..4aae41b26b3a 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h index 4e23124709f6..5e3386d47f6b 100644 --- a/engines/avalanche/nimunit.h +++ b/engines/avalanche/nimunit.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __nimunit_h__ #define __nimunit_h__ diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index cd1f8748f38c..c91706019313 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index 4fd83e054fe7..4286ee2ea69b 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index 4a2ee463bf67..6dd38b634327 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h index 18ed82eb5b5e..a0db659f92b0 100644 --- a/engines/avalanche/oldincln.h +++ b/engines/avalanche/oldincln.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __oldincln_h__ #define __oldincln_h__ diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index bee02949074d..1dddecbced8c 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h index e73721492f6b..dc36efd2d644 100644 --- a/engines/avalanche/oldtrip.h +++ b/engines/avalanche/oldtrip.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __oldtrip_h__ #define __oldtrip_h__ diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index 8e89fc7c1df6..a683bf2daad1 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index d2d24150adeb..641b9ba8a3f6 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __oopmenu_implementation__ diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h index f753f5edde03..ee928e2050ab 100644 --- a/engines/avalanche/oopmenu.h +++ b/engines/avalanche/oopmenu.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __oopmenu_h__ #define __oopmenu_h__ diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index 8659943a286c..b39b5bacaf36 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index 853a434918ce..e4a2fc938cf2 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index 01657e79ac40..30f0cd37f28a 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index 009ced5973d5..cc5386dc147e 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index b2eddc255c7e..d396c679a5b3 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Get 'em back! */ diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 8bc6149ad494..5a98ba3fc106 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index 6979229d497d..fdb49b7048c9 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __pingo_h__ #define __pingo_h__ diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index 12f378560dde..b9c7fc757a16 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index a5d8f05dde3e..bd5e4d450d35 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index 477b1ffa9ff8..b72703385383 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index 08de16e765c7..d6877aeb4fb0 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Demonstration of the Bigo II system. */ diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index c8e4b153f7c3..d37a1131cf4e 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index 0417c286557f..9937a4667021 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 590809c9e8a4..65bd0b5d0ba6 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index 3d3d172d40f2..b84788a13f4f 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h index 42fd668ec135..b671da2a760e 100644 --- a/engines/avalanche/sackb1.h +++ b/engines/avalanche/sackb1.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __sackb1_h__ #define __sackb1_h__ diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index 1bf586c4e409..4d70bf6ed117 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /*$M 16384,0,0*/ diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp index 4bf6ebabc6c5..e69de29bb2d1 100644 --- a/engines/avalanche/sackblas.cpp +++ b/engines/avalanche/sackblas.cpp @@ -1,4 +0,0 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 38270071913e..962495f7de39 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 6e9ba57d9a5f..258ca6be4ee4 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 3c5443852570..55eba417ab2c 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 1d959b83c3bb..96c9d9ec0193 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index db9a43092bb8..183104ea9b2f 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index dfc3e9c42c73..ab2359fa3d4b 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index d398a3efc89a..6d46fac1c415 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 57aac3125bb4..4f02f06824db 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h index f035f3fc9789..d71ec5d5e295 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/scrolls.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __scrolls_h__ #define __scrolls_h__ diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 853d2fbaaf41..fccb01bf15e1 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index a14e0e040f11..a6c59a612692 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __sequence_h__ #define __sequence_h__ diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 94e969acf0de..32fee351eebf 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index f896da8d09ab..f1729f2773b0 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index 6e7d31c229cf..c9c30f8bcc05 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp index 4bf6ebabc6c5..e69de29bb2d1 100644 --- a/engines/avalanche/sez.cpp +++ b/engines/avalanche/sez.cpp @@ -1,4 +0,0 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 3a57ee8ddd42..5db639cbe19c 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index 4a4ca608d3fe..1f15cf1dcd67 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __sezunit_implementation__ diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h index b5644c95fda4..6b0a99ee54cd 100644 --- a/engines/avalanche/sezunit.h +++ b/engines/avalanche/sezunit.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __sezunit_h__ #define __sezunit_h__ diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 3b48c437cc4e..37c9cf00c05e 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index a5e0f13c4630..75296bfa825b 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index d9bb2d168c17..b0ef13ab47a6 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index d9957df28d92..c56624637c52 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 87a8417ea090..5e5222801b5e 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 843550b36440..267bf8eefdce 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index 521c144768e0..6ff3b903fe55 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index 40641c9b0f15..f8bc96b68948 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index 9b3d53836130..e169f37d9245 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index d626b359a10c..518124170ac4 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Demonstration of the Bigo II system. */ diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index cae0182a91ae..761f11c42bb6 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index 0297bfffdbb3..b47b6fb20d5d 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h index 2312d45cdb75..5a54cd44bc2d 100644 --- a/engines/avalanche/sticks.h +++ b/engines/avalanche/sticks.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __sticks_h__ #define __sticks_h__ diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index 035d81be8bf1..4a0e3ac01d2f 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index d58a818d0799..b8887ef4597d 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index b13d73433044..1ac567151628 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index 116344a0a12e..e5b23477d99d 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index 11146a813742..2949f301fe09 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index 2ca0c0b9f696..e1e869691cd4 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index 0fc936f55abd..34e1d67389ad 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index 5a4cc9e896e6..d5b964df0d9d 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h index 7068e7e5a309..5fa9800388c7 100644 --- a/engines/avalanche/timeout.h +++ b/engines/avalanche/timeout.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __timeout_h__ #define __timeout_h__ diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index e27e48ce7a34..6f48f99f7a4b 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index add6fa155c9a..58ae537d2461 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h index c018264cd1f2..520e323fe892 100644 --- a/engines/avalanche/trip.h +++ b/engines/avalanche/trip.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __trip_h__ #define __trip_h__ diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index 38227b0c760b..d95eba50c6fb 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #define __trip3_implementation__ diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h index 32144e1496d4..ccad15346bb3 100644 --- a/engines/avalanche/trip3.h +++ b/engines/avalanche/trip3.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __trip3_h__ #define __trip3_h__ diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index 5ae624cc6cdc..923e32e60037 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h index bed52bbcd000..b5e4f1361485 100644 --- a/engines/avalanche/trip42.h +++ b/engines/avalanche/trip42.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __trip42_h__ #define __trip42_h__ diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 6dd411380a86..721268ba43c4 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h index a06b6e9efd77..9e7b3a33bce6 100644 --- a/engines/avalanche/trip5.h +++ b/engines/avalanche/trip5.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __trip5_h__ #define __trip5_h__ diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index c4ab58e28d5d..c669cc72589b 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index 582c8af3452e..f6225b4f4d3f 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index 322dba8ad485..b8db1a70e51d 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* Trip Oop (Trippancy 4 Andexor */ diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index b92db51b88f7..2d870fa02f95 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index a5f0840badfa..9183e1b2f196 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /*$S-*/ diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index 09cd333d6a2b..a9e1e6ec590f 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /*$S-*/ diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index aec063f89e4a..664dca963102 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - /* diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h index 1cfb77fecfe3..8b79d6be1836 100644 --- a/engines/avalanche/visa.h +++ b/engines/avalanche/visa.h @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ #ifndef __visa_h__ #define __visa_h__ diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index 56c95950c722..df856f6ea291 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp index 4bf6ebabc6c5..e69de29bb2d1 100644 --- a/engines/avalanche/waver.cpp +++ b/engines/avalanche/waver.cpp @@ -1,4 +0,0 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 402f3ab33afa..683e6ca2ec8f 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index 162fcece39c0..b0f68447c843 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index 2eb565abf8f6..5fe7156907d5 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -1,8 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index 1881e97455f5..980eff8f60fa 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index e03399a7d03c..86996ba924fc 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index 5ab55d147eb4..2c4f712e2719 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -1,7 +1,3 @@ -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ From 7939ab1f62959c19a18dfe3d54aef0d0175a3b1d Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 13:52:44 +0200 Subject: [PATCH 0005/1332] AVALANCHE: Add standard header. (Now the right one...) --- engines/avalanche/1stoff.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/access.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/access.h | 27 +++++++++++++++++++++++++++ engines/avalanche/acci.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/acci.h | 27 +++++++++++++++++++++++++++ engines/avalanche/also.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/andexor.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/andexor2.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/andextst.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/arch.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/arch.h | 27 +++++++++++++++++++++++++++ engines/avalanche/avalot9.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/avbkgrnd.cpp | 26 +++++++++++++++++++++++++- engines/avalanche/avmenu.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/avvyans.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/avvyans2.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/avvymonk.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/bakchunk.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/basher.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/basher.h | 27 +++++++++++++++++++++++++++ engines/avalanche/bootstrp.cpp | 26 +++++++++++++++++++++++++- engines/avalanche/cadburys.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/cadburys.h | 27 +++++++++++++++++++++++++++ engines/avalanche/celer.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/celer.h | 27 +++++++++++++++++++++++++++ engines/avalanche/ch_egats.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/charmap.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/chunker.cpp | 29 ++++++++++++++++++++++++++--- engines/avalanche/chunkxf1.cpp | 26 +++++++++++++++++++++++++- engines/avalanche/chunkxf2.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf3.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf4.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf5.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf6.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf7.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf8.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxf9.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfa.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfb.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfc.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfd.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfe.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxff.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfg.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfh.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfi.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfj.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfk.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/chunkxfl.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/clock.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/closing.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/closing.h | 27 +++++++++++++++++++++++++++ engines/avalanche/convert.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/convmous.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/credits.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/displtxt.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/dropdown.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/dropdown.h | 27 +++++++++++++++++++++++++++ engines/avalanche/dwidth.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/edhead.cpp | 23 +++++++++++++++++++++++ engines/avalanche/edna.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/enhanced.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/enhanced.h | 27 +++++++++++++++++++++++++++ engines/avalanche/enid.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/enid.h | 27 +++++++++++++++++++++++++++ engines/avalanche/filer.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/fileunit.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/fileunit.h | 27 +++++++++++++++++++++++++++ engines/avalanche/filing.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/folktemp.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/fontslid.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/frere.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/g-room.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/golden.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/gyro.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/gyro.h | 27 +++++++++++++++++++++++++++ engines/avalanche/help.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/help2.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/helpbak.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/helpbak.h | 27 +++++++++++++++++++++++++++ engines/avalanche/helper.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/helper.h | 27 +++++++++++++++++++++++++++ engines/avalanche/hibits.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/highs.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/highs.h | 27 +++++++++++++++++++++++++++ engines/avalanche/hiz.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/incline.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/incline.h | 27 +++++++++++++++++++++++++++ engines/avalanche/initxf.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/inputtes.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/intro.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/ints.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/joysetup.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/joystick.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/joystick.h | 27 +++++++++++++++++++++++++++ engines/avalanche/loading.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/logger.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/logger.h | 27 +++++++++++++++++++++++++++ engines/avalanche/lucerna.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/lucerna.h | 27 +++++++++++++++++++++++++++ engines/avalanche/magic2.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/magidraw.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/magishuf.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/make!.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/makeregi.cpp | 31 ++++++++++++++++++++++++++++--- engines/avalanche/makesez.cpp | 23 +++++++++++++++++++++++ engines/avalanche/makevmou.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/menuxf.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/minstran.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/newsprit.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/nim.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/nimdraw.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/nimunit.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/nimunit.h | 27 +++++++++++++++++++++++++++ engines/avalanche/oldfiler.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/oldhighs.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/oldincln.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/oldincln.h | 27 +++++++++++++++++++++++++++ engines/avalanche/oldtrip.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/oldtrip.h | 27 +++++++++++++++++++++++++++ engines/avalanche/omtest.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/oopmenu.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/oopmenu.h | 27 +++++++++++++++++++++++++++ engines/avalanche/overlap.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/overscro.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/particle.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/pictemp.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/pictemp2.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/pingo.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/pingo.h | 27 +++++++++++++++++++++++++++ engines/avalanche/plottest.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/preview1.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/qintro.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/qstars.cpp | 31 ++++++++++++++++++++++++++++--- engines/avalanche/rawupd.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/readsez.cpp | 23 +++++++++++++++++++++++ engines/avalanche/reginam.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/sackb1.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/sackb1.h | 27 +++++++++++++++++++++++++++ engines/avalanche/sackb3.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/sackblas.cpp | 27 +++++++++++++++++++++++++++ engines/avalanche/saving.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_1.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_2.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_3.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_4.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_5.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scr_9.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/scrolls.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/scrolls.h | 27 +++++++++++++++++++++++++++ engines/avalanche/sequence.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/sequence.h | 27 +++++++++++++++++++++++++++ engines/avalanche/setup.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/seu.cpp | 26 +++++++++++++++++++++++++- engines/avalanche/seu_avvy.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/sez.cpp | 27 +++++++++++++++++++++++++++ engines/avalanche/sezedit.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/sezunit.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/sezunit.h | 27 +++++++++++++++++++++++++++ engines/avalanche/sezxfr.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/shell1.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/shell2.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/slope.cpp | 29 ++++++++++++++++++++++++++--- engines/avalanche/spread.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/spread2.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/squish.cpp | 27 +++++++++++++++++++++++++-- engines/avalanche/ss_blank.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/ss_clock.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/stars.cpp | 31 ++++++++++++++++++++++++++++--- engines/avalanche/status.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/sticks.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/sticks.h | 27 +++++++++++++++++++++++++++ engines/avalanche/sunrise.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/tempo.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/test.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/test2.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/testblit.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/testcard.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/testenh.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/timeout.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/timeout.h | 27 +++++++++++++++++++++++++++ engines/avalanche/travel.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/trip.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/trip.h | 27 +++++++++++++++++++++++++++ engines/avalanche/trip3.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/trip3.h | 27 +++++++++++++++++++++++++++ engines/avalanche/trip42.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/trip42.h | 27 +++++++++++++++++++++++++++ engines/avalanche/trip5.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/trip5.h | 27 +++++++++++++++++++++++++++ engines/avalanche/trip5tst.cpp | 26 +++++++++++++++++++++++++- engines/avalanche/trip5xf.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/tripoop.cpp | 31 ++++++++++++++++++++++++++++--- engines/avalanche/ttmenuxf.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/unsquish.cpp | 27 ++++++++++++++++++++++++++- engines/avalanche/viewdocs.cpp | 31 ++++++++++++++++++++++++++++--- engines/avalanche/visa.cpp | 25 +++++++++++++++++++++++++ engines/avalanche/visa.h | 27 +++++++++++++++++++++++++++ engines/avalanche/visatest.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/waver.cpp | 27 +++++++++++++++++++++++++++ engines/avalanche/xf_gover.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/xf_help.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/xf_visa.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/xfbutton.cpp | 24 ++++++++++++++++++++++++ engines/avalanche/xfghost.cpp | 28 ++++++++++++++++++++++++++-- engines/avalanche/zapdraw.cpp | 24 ++++++++++++++++++++++++ 206 files changed, 5242 insertions(+), 138 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index e8debc3fbf30..12db75ae57fd 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ /*#include "Dos.h"*/ diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index faa00bbf8076..a36a3e5bd935 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h index 825deeb59d42..ff2d3af7663c 100644 --- a/engines/avalanche/access.h +++ b/engines/avalanche/access.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __access_h__ #define __access_h__ diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 32fde0c88232..703785f14817 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* $D-*/ /* diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h index f9d1265b327b..7049199aed67 100644 --- a/engines/avalanche/acci.h +++ b/engines/avalanche/acci.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __acci_h__ #define __acci_h__ diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index e5af1314e99d..542933174338 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Rodent.h"*/ diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index 9cf259e11b11..1902ecd1dd67 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -1,6 +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. - /* Trippancy IV - original file */ + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Trippancy IV - original file */ #include "graph.h" const integer taboo = cyan; diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index b5355d7cb2ed..670a3ded46d9 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -1,6 +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. - /* Trippancy IV - original file */ + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Trippancy IV - original file */ #include "graph.h" const integer taboo = cyan; diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index db5c659f88f7..3abfbacfc467 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index e05f173a922a..f488a86189a8 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h index cb0960f9ddbb..781217a978d7 100644 --- a/engines/avalanche/arch.h +++ b/engines/avalanche/arch.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __arch_h__ #define __arch_h__ diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index 3780b79c1e8b..8f36226d53b5 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index 6488fb82b106..f57b0f4a46f8 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/avmenu.cpp b/engines/avalanche/avmenu.cpp index 9b366a966099..d7bfac56ff9d 100644 --- a/engines/avalanche/avmenu.cpp +++ b/engines/avalanche/avmenu.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index 1985194f9116..4105eaf9d117 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index 9702ec2d22bf..b425b56c1e61 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 7d5143b27a74..6267a047e656 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index 296c55abc706..b005b03819d6 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Celer.h"*/ diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index 3ac401ed7fe0..5210631033ab 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h index 1afecae44124..a1996c82ee5e 100644 --- a/engines/avalanche/basher.h +++ b/engines/avalanche/basher.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __basher_h__ #define __basher_h__ diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index 141c69b46c57..ff4ab389f7cf 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index 383987534ab3..21c65ae3b528 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -1,4 +1,29 @@ - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __cadburys_implementation__ diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h index 65e7bd7c8b93..b513510cecb2 100644 --- a/engines/avalanche/cadburys.h +++ b/engines/avalanche/cadburys.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __cadburys_h__ #define __cadburys_h__ diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index bedab4bb8c93..c45637841955 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index f6ad52ffb1c7..ff608ea83cd0 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __celer_h__ #define __celer_h__ diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index 0488d2112126..9a9718b55b59 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index 0eb701be37f6..f42bf31264b5 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 00cb696beb64..46848dac7cf7 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -1,6 +1,29 @@ - - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index 4b8d99e560a9..44e17254014a 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" #include "cadburys.h" diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 252f132cda8e..ee7908578caa 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index d8b89dda72eb..26b3b49ac5d7 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 4a644d2623c5..2083f5b48095 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index a2d02f9105c6..9300c7b6ced4 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index b319f2b2f94d..3798e5cc72b1 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index 8d2f7a9df032..fc8da304f822 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 98ada51b7083..30be8450e6d6 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index 156827b6b636..48f5bd28badc 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index 1703d4f8054f..a574a04f946f 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 71fd991d4103..2ae8f852d827 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index ec5ff4bf7535..292cc1a32841 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index 9752345a7170..270d2534665b 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index bc11f36f1938..ef42c8af409b 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index e2c6a274895b..eddbc2ddec95 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index 762a44a5833f..0e980e6f0f86 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 4736700211e8..bd303ad1631e 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 917d83bdbf14..52f3be110fa1 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 1f7f23462ad6..792c0b52e304 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 38523f695fd6..86f49359c325 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 8b942d9da360..7fdb52bd1c4b 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 66744016ce0f..ebdc85b1fad5 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ #include "graph.h" diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index bfed58ea7f7f..722ff3764c60 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index 97dd37e0c3fb..3d33cd65d0dc 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __closing_h__ #define __closing_h__ diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index ca41b367606c..d350f2339607 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index b5efcba4d884..53147ca4ed4a 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Binu.h"*/ diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index d37849b115e9..6d33127d47ca 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index 376c3464926a..be0679011259 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 931940801f32..c88d06a200fb 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index 9d32fb970594..ac225713500b 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __dropdown_h__ #define __dropdown_h__ diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index aa0fd75451af..67dbdc7beab2 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index c06d2b1fb240..9907281c8902 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -1,6 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index d700a85c4a6f..03d9c232fb4a 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -1,4 +1,29 @@ - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M 10000,0,1000*/ /*$V-*/ diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 34a46ff18e86..634ad63a7192 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __enhanced_implementation__ diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h index a028648ced09..c7031a213bfe 100644 --- a/engines/avalanche/enhanced.h +++ b/engines/avalanche/enhanced.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __enhanced_h__ #define __enhanced_h__ diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index fb2577a5045c..e6d9106b82e3 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h index abf20a27dcf5..ce9f5fd69dfc 100644 --- a/engines/avalanche/enid.h +++ b/engines/avalanche/enid.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __enid_h__ #define __enid_h__ diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index 4ae92c3f5f90..5fbc5b39a387 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Dos.h"*/ diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index d9de21073faa..26ab496844b0 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -1,4 +1,29 @@ - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __fileunit_implementation__ /* v:filer.pas - "avvyfiler" - in unit form. */ diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h index 08f9262653c0..ce7d07a85cdd 100644 --- a/engines/avalanche/fileunit.h +++ b/engines/avalanche/fileunit.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __fileunit_h__ #define __fileunit_h__ diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index 841163fcf43a..a272107b2cc0 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index 47d5d58d63fe..6d9fe754dfd7 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -1,6 +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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ - /* Get 'em back! */ +/* Get 'em back! */ #include "graph.h" diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 31154aa6048e..0d2a4125444a 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index 5f1b51714e24..574fc8d85d14 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index 386a16c0b920..b8dab2838d33 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index 3643f43d3f20..e5ad0d6fde81 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$I c:\sleep5\DSMI.INC*/ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 0e05d77d4712..f4f82bb2c6c3 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 8a1fdb5c0a03..22b8552e4745 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __gyro_h__ #define __gyro_h__ diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 804ded4e651c..c53e4d8999ea 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Rodent.h"*/ diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index 148f578b98f9..fe9cbec76d20 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index 367fd20afa4f..1a7138b3ce06 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h index 12a78690923d..3d8f5d82836e 100644 --- a/engines/avalanche/helpbak.h +++ b/engines/avalanche/helpbak.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __helpbak_h__ #define __helpbak_h__ diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 07084132d80a..ad489a86694a 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h index 9c1c43ca4267..22c6b0657386 100644 --- a/engines/avalanche/helper.h +++ b/engines/avalanche/helper.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __helper_h__ #define __helper_h__ diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index c6a80cbf8ab3..dc3d0ab766eb 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ file inf,outf; char x; diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 38d929e30ef2..419eb38e2b8d 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h index 3d6eb65807b5..f147c0598505 100644 --- a/engines/avalanche/highs.h +++ b/engines/avalanche/highs.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __highs_h__ #define __highs_h__ diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index d9508b56e5d8..cb0a6271ccaa 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M 6000,600,600*/ /*$V-,I-,R-,F+*/ /* Do not change these directives. */ diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index 8cc8170b0e80..f6d79266ca84 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h index 4b252a146e2a..799ad79ad5ec 100644 --- a/engines/avalanche/incline.h +++ b/engines/avalanche/incline.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __incline_h__ #define __incline_h__ diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index a485c1bcfa6e..342f3ef51d8f 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index 7d95ff90f34d..4400fa549473 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index 54cd3e64615f..854db43df0fa 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$I c:\sleep5\DSMI.INC*/ /*#include "Dos.h"*/ diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index acb607c821c9..0d966883a14c 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -1,6 +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. - /* Avalot interrupt handler */ + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Avalot interrupt handler */ /*#include "Dos.h"*/ /*$F+*/ diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 7d22a503a893..4326ac8b31f2 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -1,6 +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. - /* Avalot joystick setup routines. To be incorporated + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Avalot joystick setup routines. To be incorporated into Setup2 whenever I get a chance. */ /*#include "Joystick.h"*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index c3ab14ab199a..b18fdd04fc53 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __joystick_implementation__ diff --git a/engines/avalanche/joystick.h b/engines/avalanche/joystick.h index 0a3147eda2ee..8a1bcf1edb8b 100644 --- a/engines/avalanche/joystick.h +++ b/engines/avalanche/joystick.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __joystick_h__ #define __joystick_h__ diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index 9bc4a0ce67e4..a53e3edbd78c 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index b95e450ccb2a..4d14e3cbe8ed 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h index 016bfb625835..b068f202ecd2 100644 --- a/engines/avalanche/logger.h +++ b/engines/avalanche/logger.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __logger_h__ #define __logger_h__ diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 777e9bdfefdc..9ef67fdb7d7a 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h index a602f8c02605..f40364a2ba06 100644 --- a/engines/avalanche/lucerna.h +++ b/engines/avalanche/lucerna.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __lucerna_h__ #define __lucerna_h__ diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index b7e9d12046d1..e1729f7ad2f1 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 3c6b35e5da14..139f216f8443 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 0f1c494a1ef7..0fdb82930aa0 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index 2079547c5c98..32d8a6c9b9c6 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -1,6 +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. - /* Phew! */ + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Phew! */ #include "graph.h" /*$S-*/ diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index 2e927c8dcf46..89b66d73ebaf 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -1,6 +1,31 @@ - - - /* regname's name starts at $7D1 (2001). */ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* regname's name starts at $7D1 (2001). */ const array<1,56,char> padding = "For all the Etruscan armies were ranged beneath his eye"; diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index c264dc19e1b2..cfb9974667aa 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -1,6 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ struct sezheader { array<1,2,char> initials; /* should be "TT" */ diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index a5f3e25dd17f..7d3c5f39122e 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Squeak.h"*/ diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index 6a5342e1f1db..be0920e07db7 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index 29b3da7897b7..d404c60bf75d 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index 5f21ecde57b9..095fc407a7de 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 7dab81bc956d..a81dfc6720f2 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index 21618d65f85a..45b1c6813d9e 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index 4aae41b26b3a..e2d5f6f45a5d 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h index 5e3386d47f6b..4b5f79b89e1e 100644 --- a/engines/avalanche/nimunit.h +++ b/engines/avalanche/nimunit.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __nimunit_h__ #define __nimunit_h__ diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index c91706019313..f8020269abf5 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ #include "graph.h" diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index 4286ee2ea69b..5fa205cb4f61 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index 6dd38b634327..c627407dafc1 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h index a0db659f92b0..9590d66c4dbd 100644 --- a/engines/avalanche/oldincln.h +++ b/engines/avalanche/oldincln.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __oldincln_h__ #define __oldincln_h__ diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index 1dddecbced8c..e7df00fd6861 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h index dc36efd2d644..7a5e40238acf 100644 --- a/engines/avalanche/oldtrip.h +++ b/engines/avalanche/oldtrip.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __oldtrip_h__ #define __oldtrip_h__ diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index a683bf2daad1..0209619c189b 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Oopmenu.h"*/ diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 641b9ba8a3f6..9f8445b7f712 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -1,4 +1,29 @@ - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __oopmenu_implementation__ diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h index ee928e2050ab..4ac4efb1eb00 100644 --- a/engines/avalanche/oopmenu.h +++ b/engines/avalanche/oopmenu.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __oopmenu_h__ #define __oopmenu_h__ diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index b39b5bacaf36..d68a292d584a 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index e4a2fc938cf2..307b9e28332b 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index 30f0cd37f28a..ef1141e3aed5 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index cc5386dc147e..c2a05aee4f5f 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index d396c679a5b3..39087b17415b 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -1,6 +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. - /* Get 'em back! */ + * 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Get 'em back! */ #include "graph.h" diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 5a98ba3fc106..6b0f4902cfb3 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index fdb49b7048c9..71af98e0ea28 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __pingo_h__ #define __pingo_h__ diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index b9c7fc757a16..799f1f1adb7f 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index bd5e4d450d35..f76486da9c0e 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index b72703385383..b3e2eb60deea 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ #include "graph.h" diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index d6877aeb4fb0..2ed399dcc470 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -1,6 +1,31 @@ - - - /* Demonstration of the Bigo II system. */ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Demonstration of the Bigo II system. */ #include "graph.h" /*#include "Crt.h"*/ /*#include "Rodent.h"*/ diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index d37a1131cf4e..6d8a3005b855 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index 9937a4667021..76cfc77d6ec6 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -1,6 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ struct markertype { word length; diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 65bd0b5d0ba6..7a2cbac0cbfd 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ const array<1,36,char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; varying_string<30> name; diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index b84788a13f4f..cc1193527083 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h index b671da2a760e..e226946560c0 100644 --- a/engines/avalanche/sackb1.h +++ b/engines/avalanche/sackb1.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __sackb1_h__ #define __sackb1_h__ diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index 4d70bf6ed117..60a259c1f49e 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M 16384,0,0*/ diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp index e69de29bb2d1..e3261d7c1eb5 100644 --- a/engines/avalanche/sackblas.cpp +++ b/engines/avalanche/sackblas.cpp @@ -0,0 +1,27 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 962495f7de39..fce157e440c1 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 258ca6be4ee4..5a9d55d33080 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 55eba417ab2c..2d5a78c8dd57 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 96c9d9ec0193..0e4ff0dbf283 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index 183104ea9b2f..44099e171e73 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index ab2359fa3d4b..82686317f572 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index 6d46fac1c415..2dac08ca3912 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 4f02f06824db..7bf6c6de05fa 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h index d71ec5d5e295..d20d3619dec1 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/scrolls.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __scrolls_h__ #define __scrolls_h__ diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index fccb01bf15e1..243caf42b1e7 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index a6c59a612692..86d2d89d6351 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __sequence_h__ #define __sequence_h__ diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 32fee351eebf..1416a5128ed3 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ /*#include "Tommys.h"*/ diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index f1729f2773b0..9e8f4aaa4732 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Dos.h"*/ diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index c9c30f8bcc05..206c844c55e8 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp index e69de29bb2d1..e3261d7c1eb5 100644 --- a/engines/avalanche/sez.cpp +++ b/engines/avalanche/sez.cpp @@ -0,0 +1,27 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 5db639cbe19c..d9f0e484f919 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M 65520,0,655360*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index 1f15cf1dcd67..c98e6f8367a6 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __sezunit_implementation__ diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h index 6b0a99ee54cd..76feb6665bb5 100644 --- a/engines/avalanche/sezunit.h +++ b/engines/avalanche/sezunit.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __sezunit_h__ #define __sezunit_h__ diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 37c9cf00c05e..7ae6cec3d0d1 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ /*$V-*/ diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index 75296bfa825b..5d6e2c9e2d61 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M $800,0,0*/ /*#include "Dos.h"*/ diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index b0ef13ab47a6..cd6fec2d2731 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ #include "graph.h" diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index c56624637c52..83bb1d7a8e60 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -1,6 +1,29 @@ - - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ struct joysetup { word xmid,ymid,xmin,ymin,xmax,ymax; diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 5e5222801b5e..3ee713486206 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 267bf8eefdce..5a42427d64ff 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index 6ff3b903fe55..d9077ed29f63 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -1,6 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* This is the first version. Thanks to Pib. */ diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index f8bc96b68948..7e9765407c3e 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index e169f37d9245..ae466bc9cff1 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ /*#include "Crt.h"*/ diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index 518124170ac4..d6bc8ef145ca 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -1,6 +1,31 @@ - - - /* Demonstration of the Bigo II system. */ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Demonstration of the Bigo II system. */ /* $I c:\sleep5\DSMI.INC*/ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index 761f11c42bb6..c8931e6d22a9 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index b47b6fb20d5d..0e18be004f48 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h index 5a54cd44bc2d..24f59c4d5994 100644 --- a/engines/avalanche/sticks.h +++ b/engines/avalanche/sticks.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __sticks_h__ #define __sticks_h__ diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index 4a0e3ac01d2f..d512892093d2 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index b8887ef4597d..908e7629b8e5 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index 1ac567151628..ead8a372af34 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*$M 2048,0,0*/ /*#include "Dos.h"*/ diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index e5b23477d99d..0001ac0c0cf6 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Dos.h"*/ diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index 2949f301fe09..4154dcbe46b0 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index e1e869691cd4..3a3fba589530 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Dos.h"*/ diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index 34e1d67389ad..b304a57623a3 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Enhanced.h"*/ diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index d5b964df0d9d..073d415b98de 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h index 5fa9800388c7..99090dd69ad6 100644 --- a/engines/avalanche/timeout.h +++ b/engines/avalanche/timeout.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __timeout_h__ #define __timeout_h__ diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index 6f48f99f7a4b..4ce11d5d3ed7 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 58ae537d2461..64b88786689d 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h index 520e323fe892..abef80334100 100644 --- a/engines/avalanche/trip.h +++ b/engines/avalanche/trip.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __trip_h__ #define __trip_h__ diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index d95eba50c6fb..4c04ef45b7b0 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #define __trip3_implementation__ /* Project Minstrel- Trippancy routines */ diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h index ccad15346bb3..9318726e45e1 100644 --- a/engines/avalanche/trip3.h +++ b/engines/avalanche/trip3.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __trip3_h__ #define __trip3_h__ diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index 923e32e60037..2dee6699e8ab 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h index b5e4f1361485..72b94994b1d1 100644 --- a/engines/avalanche/trip42.h +++ b/engines/avalanche/trip42.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __trip42_h__ #define __trip42_h__ diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 721268ba43c4..5742bf3342f9 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h index 9e7b3a33bce6..3811c85adec6 100644 --- a/engines/avalanche/trip5.h +++ b/engines/avalanche/trip5.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __trip5_h__ #define __trip5_h__ diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index c669cc72589b..5b78efa9c5d1 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index f6225b4f4d3f..09a8eac89d24 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index b8db1a70e51d..6ddc12c115f2 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -1,6 +1,31 @@ - - - /* Trip Oop (Trippancy 4 Andexor */ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Trip Oop (Trippancy 4 Andexor */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index 2d870fa02f95..ad986e1822c4 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Tommys.h"*/ diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index 9183e1b2f196..bf98aebc0c9a 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -1,6 +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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ - /*$S-*/ +/*$S-*/ #include "graph.h" diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index a9e1e6ec590f..52edfe4fbdd3 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -1,6 +1,31 @@ - - - /*$S-*/ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/*$S-*/ /*#include "dos.h"*/ /*#include "crt.h"*/ /*#include "tommys.h"*/ diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index 664dca963102..dea03b179d86 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -1,4 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /* diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h index 8b79d6be1836..0c695fb0711e 100644 --- a/engines/avalanche/visa.h +++ b/engines/avalanche/visa.h @@ -1,3 +1,30 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + #ifndef __visa_h__ #define __visa_h__ diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index df856f6ea291..5cbcf6432606 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp index e69de29bb2d1..e3261d7c1eb5 100644 --- a/engines/avalanche/waver.cpp +++ b/engines/avalanche/waver.cpp @@ -0,0 +1,27 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 683e6ca2ec8f..98590e63b936 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index b0f68447c843..ec7b1d1405fb 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ /*#include "Tommys.h"*/ diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index 5fe7156907d5..c0b2573ba8bb 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ /*#include "Crt.h"*/ /*#include "Dos.h"*/ diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index 980eff8f60fa..197aa960a3c6 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 86996ba924fc..6eeec2862882 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -1,5 +1,29 @@ - - +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index 2c4f712e2719..9b13dbbec974 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -1,5 +1,29 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ #include "graph.h" /*#include "Crt.h"*/ From a3025b8dad7abfe845c57aee3703451c223fc2e6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 17 Jun 2013 15:45:25 +0200 Subject: [PATCH 0006/1332] AVALANCHE: Add namespace. --- engines/avalanche/1stoff.cpp | 5 ++++- engines/avalanche/access.cpp | 3 ++- engines/avalanche/access.h | 3 +++ engines/avalanche/acci.cpp | 3 +++ engines/avalanche/acci.h | 5 ++++- engines/avalanche/also.cpp | 4 ++++ engines/avalanche/andexor.cpp | 6 +++++- engines/avalanche/andexor2.cpp | 6 +++++- engines/avalanche/andextst.cpp | 5 ++++- engines/avalanche/arch.cpp | 3 ++- engines/avalanche/arch.h | 3 +++ engines/avalanche/avalot9.cpp | 4 ++++ engines/avalanche/avbkgrnd.cpp | 5 +++++ engines/avalanche/avmenu.cpp | 4 ++++ engines/avalanche/avvyans.cpp | 6 +++++- engines/avalanche/avvyans2.cpp | 6 +++++- engines/avalanche/avvymonk.cpp | 6 +++++- engines/avalanche/bakchunk.cpp | 6 +++++- engines/avalanche/basher.cpp | 3 +++ engines/avalanche/basher.h | 5 ++++- engines/avalanche/bootstrp.cpp | 4 ++++ engines/avalanche/cadburys.cpp | 4 ++-- engines/avalanche/cadburys.h | 3 +++ engines/avalanche/celer.cpp | 4 +++- engines/avalanche/celer.h | 3 +++ engines/avalanche/ch_egats.cpp | 3 +++ engines/avalanche/charmap.cpp | 6 +++++- engines/avalanche/chunker.cpp | 6 +++++- engines/avalanche/chunkxf1.cpp | 3 +++ engines/avalanche/chunkxf2.cpp | 3 +++ engines/avalanche/chunkxf3.cpp | 3 +++ engines/avalanche/chunkxf4.cpp | 3 +++ engines/avalanche/chunkxf5.cpp | 3 +++ engines/avalanche/chunkxf6.cpp | 4 ++++ engines/avalanche/chunkxf7.cpp | 3 +++ engines/avalanche/chunkxf8.cpp | 3 +++ engines/avalanche/chunkxf9.cpp | 3 +++ engines/avalanche/chunkxfa.cpp | 3 +++ engines/avalanche/chunkxfb.cpp | 3 +++ engines/avalanche/chunkxfc.cpp | 3 +++ engines/avalanche/chunkxfd.cpp | 3 +++ engines/avalanche/chunkxfe.cpp | 3 +++ engines/avalanche/chunkxff.cpp | 3 +++ engines/avalanche/chunkxfg.cpp | 3 +++ engines/avalanche/chunkxfh.cpp | 3 +++ engines/avalanche/chunkxfi.cpp | 3 +++ engines/avalanche/chunkxfj.cpp | 3 +++ engines/avalanche/chunkxfk.cpp | 3 +++ engines/avalanche/chunkxfl.cpp | 3 +++ engines/avalanche/clock.cpp | 6 +++++- engines/avalanche/closing.cpp | 3 +++ engines/avalanche/closing.h | 3 +++ engines/avalanche/convert.cpp | 4 ++++ engines/avalanche/convmous.cpp | 5 ++++- engines/avalanche/credits.cpp | 4 ++++ engines/avalanche/displtxt.cpp | 3 +++ engines/avalanche/dropdown.cpp | 4 +++- engines/avalanche/dropdown.h | 3 +++ engines/avalanche/dwidth.cpp | 3 +++ engines/avalanche/edhead.cpp | 4 ++++ engines/avalanche/edna.cpp | 5 ++++- engines/avalanche/enhanced.cpp | 3 +++ engines/avalanche/enhanced.h | 6 ++++-- engines/avalanche/enid.cpp | 3 ++- engines/avalanche/enid.h | 3 +++ engines/avalanche/filer.cpp | 4 ++++ engines/avalanche/fileunit.cpp | 4 +++- engines/avalanche/fileunit.h | 5 ++++- engines/avalanche/filing.cpp | 5 ++++- engines/avalanche/folktemp.cpp | 3 +++ engines/avalanche/fontslid.cpp | 6 +++++- engines/avalanche/frere.cpp | 5 ++++- engines/avalanche/g-room.cpp | 4 ++++ engines/avalanche/golden.cpp | 3 +++ engines/avalanche/gyro.cpp | 3 ++- engines/avalanche/gyro.h | 5 ++++- engines/avalanche/help.cpp | 6 +++++- engines/avalanche/help2.cpp | 4 ++++ engines/avalanche/helpbak.cpp | 2 ++ engines/avalanche/helpbak.h | 3 +++ engines/avalanche/helper.cpp | 2 ++ engines/avalanche/helper.h | 3 +++ engines/avalanche/hibits.cpp | 6 +++++- engines/avalanche/highs.cpp | 5 ++++- engines/avalanche/highs.h | 5 ++++- engines/avalanche/hiz.cpp | 3 +++ engines/avalanche/incline.cpp | 3 +++ engines/avalanche/initxf.cpp | 6 +++++- engines/avalanche/inputtes.cpp | 4 ++++ engines/avalanche/intro.cpp | 4 ++++ engines/avalanche/ints.cpp | 4 ++++ engines/avalanche/joysetup.cpp | 5 ++++- engines/avalanche/joystick.cpp | 4 +++- engines/avalanche/joystick.h | 3 +++ engines/avalanche/loading.cpp | 4 ++++ engines/avalanche/logger.cpp | 3 ++- engines/avalanche/logger.h | 5 ++++- engines/avalanche/lucerna.cpp | 3 +++ engines/avalanche/lucerna.h | 5 ++++- engines/avalanche/magic2.cpp | 3 +++ engines/avalanche/magidraw.cpp | 3 +++ engines/avalanche/magishuf.cpp | 3 +++ engines/avalanche/make!.cpp | 4 ++++ engines/avalanche/makeregi.cpp | 6 +++++- engines/avalanche/makesez.cpp | 7 ++++++- engines/avalanche/makevmou.cpp | 3 +++ engines/avalanche/menuxf.cpp | 4 ++++ engines/avalanche/minstran.cpp | 4 ++++ engines/avalanche/newsprit.cpp | 5 ++++- engines/avalanche/nim.cpp | 3 +++ engines/avalanche/nimdraw.cpp | 3 +++ engines/avalanche/nimunit.cpp | 3 +++ engines/avalanche/nimunit.h | 3 ++- engines/avalanche/oldfiler.cpp | 4 ++-- engines/avalanche/oldhighs.cpp | 5 ++++- engines/avalanche/oldincln.cpp | 3 +++ engines/avalanche/oldtrip.cpp | 2 ++ engines/avalanche/oldtrip.h | 4 +++- engines/avalanche/omtest.cpp | 6 +++++- engines/avalanche/oopmenu.cpp | 2 ++ engines/avalanche/oopmenu.h | 3 +++ engines/avalanche/overlap.cpp | 6 +++++- engines/avalanche/overscro.cpp | 4 ++++ engines/avalanche/particle.cpp | 4 ++++ engines/avalanche/pictemp.cpp | 3 +++ engines/avalanche/pictemp2.cpp | 3 +++ engines/avalanche/pingo.cpp | 3 ++- engines/avalanche/pingo.h | 5 ++++- engines/avalanche/plottest.cpp | 4 ++++ engines/avalanche/preview1.cpp | 3 +++ engines/avalanche/qintro.cpp | 4 ++++ engines/avalanche/qstars.cpp | 4 ++++ engines/avalanche/rawupd.cpp | 6 +++++- engines/avalanche/readsez.cpp | 6 +++++- engines/avalanche/reginam.cpp | 6 +++++- engines/avalanche/sackb1.cpp | 4 +++- engines/avalanche/sackb1.h | 5 ++++- engines/avalanche/sackb3.cpp | 3 +++ engines/avalanche/sackblas.cpp | 3 +-- engines/avalanche/saving.cpp | 4 ++++ engines/avalanche/scr_1.cpp | 3 +++ engines/avalanche/scr_2.cpp | 3 +++ engines/avalanche/scr_3.cpp | 3 +++ engines/avalanche/scr_4.cpp | 5 ++++- engines/avalanche/scr_5.cpp | 3 +++ engines/avalanche/scr_9.cpp | 4 ++++ engines/avalanche/scrolls.cpp | 3 +++ engines/avalanche/scrolls.h | 5 ++++- engines/avalanche/sequence.cpp | 2 ++ engines/avalanche/sequence.h | 5 ++++- engines/avalanche/setup.cpp | 3 +++ engines/avalanche/seu.cpp | 3 +++ engines/avalanche/seu_avvy.cpp | 5 ++++- engines/avalanche/sezedit.cpp | 3 +++ engines/avalanche/sezunit.cpp | 2 ++ engines/avalanche/sezunit.h | 4 +++- engines/avalanche/sezxfr.cpp | 7 ++++++- engines/avalanche/shell1.cpp | 6 +++++- engines/avalanche/shell2.cpp | 6 +++++- engines/avalanche/slope.cpp | 4 ++++ engines/avalanche/spread.cpp | 5 ++++- engines/avalanche/spread2.cpp | 6 +++++- engines/avalanche/squish.cpp | 4 ++++ engines/avalanche/ss_blank.cpp | 6 +++++- engines/avalanche/ss_clock.cpp | 5 ++++- engines/avalanche/stars.cpp | 4 ++++ engines/avalanche/status.cpp | 6 +++++- engines/avalanche/sticks.cpp | 5 ++++- engines/avalanche/sticks.h | 4 ++++ engines/avalanche/sunrise.cpp | 4 ++++ engines/avalanche/tempo.cpp | 3 +++ engines/avalanche/test.cpp | 4 ++++ engines/avalanche/test2.cpp | 6 +++++- engines/avalanche/testblit.cpp | 3 +++ engines/avalanche/testcard.cpp | 4 ++++ engines/avalanche/testenh.cpp | 6 +++++- engines/avalanche/timeout.cpp | 3 +++ engines/avalanche/timeout.h | 5 ++++- engines/avalanche/travel.cpp | 6 +++++- engines/avalanche/trip.cpp | 3 ++- engines/avalanche/trip.h | 5 ++++- engines/avalanche/trip3.cpp | 4 ++++ engines/avalanche/trip3.h | 5 ++++- engines/avalanche/trip42.cpp | 3 +++ engines/avalanche/trip42.h | 4 +++- engines/avalanche/trip5.cpp | 3 +++ engines/avalanche/trip5.h | 5 ++++- engines/avalanche/trip5tst.cpp | 6 +++++- engines/avalanche/trip5xf.cpp | 5 ++++- engines/avalanche/tripoop.cpp | 5 ++++- engines/avalanche/ttmenuxf.cpp | 4 ++++ engines/avalanche/unsquish.cpp | 3 ++- engines/avalanche/viewdocs.cpp | 3 +++ engines/avalanche/visa.cpp | 3 ++- engines/avalanche/visa.h | 5 ++++- engines/avalanche/visatest.cpp | 5 ++++- engines/avalanche/xf_gover.cpp | 3 +++ engines/avalanche/xf_help.cpp | 5 ++++- engines/avalanche/xf_visa.cpp | 6 +++++- engines/avalanche/xfbutton.cpp | 4 ++++ engines/avalanche/xfghost.cpp | 3 +++ engines/avalanche/zapdraw.cpp | 3 +++ 202 files changed, 723 insertions(+), 92 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index 12db75ae57fd..0f9e19b940a2 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -28,6 +28,7 @@ /*#include "Crt.h"*/ /*#include "Dos.h"*/ +namespace Avalanche { matrix<1,7,1,3,byte> cols; byte fv; @@ -78,4 +79,6 @@ int main(int argc, const char* argv[]) } return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index a36a3e5bd935..951bc1c81846 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -44,6 +44,7 @@ /*#include "Trip5.h"*/ /*#include "Lucerna.h"*/ +namespace Avalanche { boolean int_say_went_ok; @@ -192,4 +193,4 @@ void talkto(byte whom) } } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h index ff2d3af7663c..e985953c7fab 100644 --- a/engines/avalanche/access.h +++ b/engines/avalanche/access.h @@ -28,9 +28,12 @@ #ifndef __access_h__ #define __access_h__ +namespace Avalanche { void dixi(char p, byte n); void talkto(byte whom); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 703785f14817..f33d7c2ea063 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -53,6 +53,7 @@ /*#include "Helper.h"*/ /*#include "Sequence.h"*/ +namespace Avalanche { byte fv; @@ -1694,3 +1695,5 @@ static unit_acci_initialize acci_constructor; unit_acci_initialize::unit_acci_initialize() { weirdword=false; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h index 7049199aed67..6734f6658e83 100644 --- a/engines/avalanche/acci.h +++ b/engines/avalanche/acci.h @@ -28,6 +28,7 @@ #ifndef __acci_h__ #define __acci_h__ +namespace Avalanche { /* verb codes */ const char vb_exam = '\1'; const char vb_open = '\2'; const char vb_pause = '\3'; const char vb_get = '\4'; const char vb_drop = '\5'; @@ -247,4 +248,6 @@ void do_that(); void verbopt(char n, string& answer, char& anskey); void have_a_drink(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index 542933174338..83dce5241bec 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -31,6 +31,8 @@ /*$R+,V-*/ +namespace Avalanche { + typedef matrix<0,255,0,15,byte> fonttype; class fieldtype { @@ -1050,3 +1052,5 @@ int main(int argc, const char* argv[]) alsomenu(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index 1902ecd1dd67..df654117b8e6 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -28,6 +28,8 @@ /* Trippancy IV - original file */ #include "graph.h" +namespace Avalanche { + const integer taboo = cyan; struct adxtype { @@ -144,4 +146,6 @@ int main(int argc, const char* argv[]) close(f); closegraph(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index 670a3ded46d9..136f719afe5c 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -28,6 +28,8 @@ /* Trippancy IV - original file */ #include "graph.h" +namespace Avalanche { + const integer taboo = cyan; struct adxtype { @@ -155,4 +157,6 @@ int main(int argc, const char* argv[]) close(f); closegraph(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index 3abfbacfc467..2cfe410b9863 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { typedef matrix<1,24,0,1,pointer> adxtype; @@ -85,4 +86,6 @@ int main(int argc, const char* argv[]) anim += 1; if (anim==7) anim=1;cp=1-cp; } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index f488a86189a8..815018df8a33 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -41,6 +41,7 @@ /*#include "Dos.h"*/ #include "scrolls.h" +namespace Avalanche { struct ednahead { /* Edna header */ /* This header starts at byte offset 177 in the .ASG file. */ @@ -144,4 +145,4 @@ void save(string name) close(f); } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h index 781217a978d7..840ceb446eff 100644 --- a/engines/avalanche/arch.h +++ b/engines/avalanche/arch.h @@ -31,7 +31,10 @@ #include "gyro.h" +namespace Avalanche { void save(string name); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index 8f36226d53b5..f793fa5402be 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -51,6 +51,8 @@ /*#include "Visa.h"*/ +namespace Avalanche { + void setup() { integer gd,gm; @@ -137,3 +139,5 @@ int main(int argc, const char* argv[]) } /* typein; commanded; last:=current; */ + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index f57b0f4a46f8..0ca6b721a060 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -27,6 +27,9 @@ #include "graph.h" + +namespace Avalanche { + integer gd,gm; int main(int argc, const char* argv[]) {pio_initialize(argc, argv); @@ -110,3 +113,5 @@ int main(int argc, const char* argv[]) */ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avmenu.cpp b/engines/avalanche/avmenu.cpp index d7bfac56ff9d..31c26929b6f2 100644 --- a/engines/avalanche/avmenu.cpp +++ b/engines/avalanche/avmenu.cpp @@ -29,6 +29,8 @@ /*#include "Crt.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; fonttype font; @@ -334,3 +336,5 @@ int main(int argc, const char* argv[]) closegraph(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index 4105eaf9d117..fa70ca1751c4 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + integer gd,gm; untyped_file f; array<1,16000,byte> aa; @@ -105,4 +107,6 @@ int main(int argc, const char* argv[]) gotoxy(1,1); input >> NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index b425b56c1e61..b7f96a5b5d26 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -29,6 +29,8 @@ /*#include "Crt.h"*/ /*#include "Ansi.h"*/ +namespace Avalanche { + integer gd,gm; untyped_file f; array<1,16000,byte> aa; @@ -206,4 +208,6 @@ int main(int argc, const char* argv[]) output << NL; normal; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 6267a047e656..25fc83e40553 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; byte z; array<1,4,pointer> a; @@ -93,4 +95,6 @@ int main(int argc, const char* argv[]) } savesc(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index b005b03819d6..fabda148f7a0 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -29,6 +29,8 @@ /*#include "Celer.h"*/ /*#include "Lucerna.h"*/ +namespace Avalanche { + integer gd,gm; int main(int argc, const char* argv[]) { @@ -49,4 +51,6 @@ int main(int argc, const char* argv[]) outtextxy(100,50,"Chunk1"); input >> NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index 5210631033ab..b4ceeb389a49 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -54,6 +54,7 @@ #include "Sticks.h" #include "enid.h" +namespace Avalanche { boolean entering_filename; byte left_margin; @@ -408,3 +409,5 @@ unit_basher_initialize::unit_basher_initialize() { #endif } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h index a1996c82ee5e..ba26d926a94d 100644 --- a/engines/avalanche/basher.h +++ b/engines/avalanche/basher.h @@ -32,6 +32,7 @@ #include "gyro.h" /*#include "Tommys.h"*/ +namespace Avalanche { #ifdef RECORD @@ -64,4 +65,6 @@ EXTERN word count; void record_one(); #endif -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index ff4ab389f7cf..905944796a28 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -30,6 +30,8 @@ /*$M 8192,0,$6000, S-*/ +namespace Avalanche { + enum elm {normal, musical, elmpoyten, regi, last_elm}; const integer run_shootemup = 1; @@ -371,3 +373,5 @@ int main(int argc, const char* argv[]) } while (!false); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index 21c65ae3b528..8d1e0c33ad24 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -33,7 +33,7 @@ #include "graph.h" - +namespace Avalanche { void mgrab(integer x1,integer y1,integer x2,integer y2, word size) { @@ -131,4 +131,4 @@ void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer real /* rectangle(x1,y1,x2,y2);*/ } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h index b513510cecb2..325bd35e474f 100644 --- a/engines/avalanche/cadburys.h +++ b/engines/avalanche/cadburys.h @@ -28,6 +28,7 @@ #ifndef __cadburys_h__ #define __cadburys_h__ +namespace Avalanche { const integer arraysize = 12000; @@ -65,4 +66,6 @@ EXTERN untyped_file f; void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, boolean mem,boolean nat); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index c45637841955..1038e6f77783 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -34,7 +34,6 @@ #define __celer_implementation__ - #include "celer.h" @@ -43,6 +42,7 @@ #include "lucerna.h" /*#include "Crt.h"*/ +namespace Avalanche { untyped_file f; /* Private variable- not accessible from elsewhere. */ @@ -495,3 +495,5 @@ static unit_celer_initialize celer_constructor; unit_celer_initialize::unit_celer_initialize() { num_chunks=0; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index ff608ea83cd0..c48bb468e79f 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -33,6 +33,7 @@ #include "incline.h" #include "gyro.h" +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -77,4 +78,6 @@ EXTERN array<1,40,pointer> memory; void show_one_at(byte which, integer xxx,integer yyy); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index 9a9718b55b59..a1091276645d 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -177,3 +178,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index f42bf31264b5..985bbf0707f6 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -27,6 +27,8 @@ /*#include "Dos.h"*/ +namespace Avalanche { + struct infotype { matrix<128,255,1,8,byte> chars; string data; @@ -51,4 +53,6 @@ int main(int argc, const char* argv[]) output << NL; } } return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 46848dac7cf7..4b7dd0e9fd0e 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; struct chunkblocktype { @@ -106,4 +108,6 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index 44e17254014a..5118d7d91696 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -28,6 +28,7 @@ #include "graph.h" #include "cadburys.h" +namespace Avalanche { /*type flavourtype = (ch_EGA,ch_BGI); @@ -281,3 +282,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index ee7908578caa..3b6caa78e7e7 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -214,3 +215,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index 26b3b49ac5d7..ab27863f3b6e 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -30,6 +30,7 @@ /*#include "Crt.h"*/ #include "cadburys.h" +namespace Avalanche { /*type flavourtype = (ch_EGA,ch_BGI); @@ -272,3 +273,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 2083f5b48095..0ac2e1f85c29 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -307,3 +308,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index 9300c7b6ced4..c4041d67f445 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -266,3 +267,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index 3798e5cc72b1..b2c6cf4b020d 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -273,3 +274,6 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index fc8da304f822..c1f189b2ced5 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 30be8450e6d6..97b9502dc3c4 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -265,3 +266,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index 48f5bd28badc..ddf079c7af80 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -259,3 +260,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index a574a04f946f..b2faafe4d507 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -262,3 +263,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 2ae8f852d827..5249e6c6f53d 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -260,3 +261,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index 292cc1a32841..4c2e58b6ed6b 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index 270d2534665b..efc94acfeef4 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index ef42c8af409b..16e4aa1d0444 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index eddbc2ddec95..fa9224be0f63 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index 0e980e6f0f86..cc43d7d93325 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -258,3 +259,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index bd303ad1631e..9ebdbfa614a4 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -259,3 +260,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 52f3be110fa1..3dd81b249181 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -268,3 +269,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 792c0b52e304..4c37792546cf 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -259,3 +260,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 86f49359c325..505c4fd8c25f 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; @@ -259,3 +260,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 7fdb52bd1c4b..4091890beffa 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -30,6 +30,7 @@ /*#include "Crt.h"*/ #include "cadburys.h" +namespace Avalanche { void finder() { @@ -149,3 +150,5 @@ int main(int argc, const char* argv[]) close_chunk(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index ebdc85b1fad5..fb05ad5497e6 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -29,6 +29,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + const integer xm = 511; const integer ym = 184; integer gd,gm; word oh,om,/*os,*/h,m,s,s1; char r; @@ -81,4 +83,6 @@ int main(int argc, const char* argv[]) oh=h; om=m; } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 722ff3764c60..bc3134b2e0e9 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -43,6 +43,7 @@ /*#include "Crt.h"*/ #include "lucerna.h" +namespace Avalanche { typedef array<1,3840,char> scrtype; @@ -142,3 +143,5 @@ unit_closing_initialize::unit_closing_initialize() {; exitsave=exitproc; exitproc=&bug_handler; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index 3d33cd65d0dc..a4d539fe7b04 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -28,6 +28,7 @@ #ifndef __closing_h__ #define __closing_h__ +namespace Avalanche { const integer scr_bugalert = 1; const integer scr_ramcram = 2; @@ -39,4 +40,6 @@ void quit_with(byte which,byte errorlev); void end_of_program(); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index d350f2339607..b8d986d73e9a 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; string fn1,fn2; varying_string<30> desc; @@ -101,3 +103,5 @@ int main(int argc, const char* argv[]) closegraph(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index 53147ca4ed4a..97da69a4d34a 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -29,6 +29,7 @@ /*#include "Binu.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { /* ...gogogoch */struct cursor { matrix<0,1,0,15,word> mask; @@ -101,4 +102,6 @@ int main(int argc, const char* argv[]) load(); display(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index 6d33127d47ca..b3db08e392dd 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -30,6 +30,8 @@ /*$R+*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; integer gd,gm; @@ -110,3 +112,5 @@ int main(int argc, const char* argv[]) close(t); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index be0679011259..0db15d55c744 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const char fn[] = "text3.scr"; @@ -56,3 +57,5 @@ int main(int argc, const char* argv[]) gotoxy(1,25); textattr=31; clreol; gotoxy(1,24); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index c88d06a200fb..56374012592e 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -48,6 +48,8 @@ #include "enid.h" #include "basher.h" +namespace Avalanche { + /*$V-*/ const integer indent = 5; const integer spacing = 10; @@ -824,4 +826,4 @@ void menu_link() } } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index ac225713500b..4eae8982ed00 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -28,6 +28,7 @@ #ifndef __dropdown_h__ #define __dropdown_h__ +namespace Avalanche { typedef void(*proc)(); @@ -118,4 +119,6 @@ EXTERN varying_string<5> people; void standard_bar(); /*procedure map_bar;*/ +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index 67dbdc7beab2..450ee7b532f2 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { typedef matrix<'\0','\377',0,15,byte> fonttype; @@ -42,3 +43,5 @@ int main(int argc, const char* argv[]) for( gd=0; gd <= 15; gd ++) mem[0xa000*gd*80]=f['A'][gd]; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index 9907281c8902..ab7b1b8b3d07 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; @@ -107,3 +109,5 @@ int main(int argc, const char* argv[]) output << "Number of saves: " << dna256[6] << NL; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index 03d9c232fb4a..1c4d8d76b5ef 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -30,6 +30,7 @@ /*#include "Dos.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { struct ednahead { /* Edna header */ /* This header starts at byte offset 177 in the .ASG file. */ @@ -359,4 +360,6 @@ int main(int argc, const char* argv[]) if (info) show_info(); load_file(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 634ad63a7192..212e6fe6a15e 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -38,6 +38,7 @@ /*#include "Dos.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { boolean isenh() { @@ -109,3 +110,5 @@ unit_enhanced_initialize::unit_enhanced_initialize() {; /* determine bios type */ atbios=isenh(); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h index c7031a213bfe..c7bd48f8a126 100644 --- a/engines/avalanche/enhanced.h +++ b/engines/avalanche/enhanced.h @@ -28,7 +28,7 @@ #ifndef __enhanced_h__ #define __enhanced_h__ - +namespace Avalanche { #ifdef __enhanced_implementation__ #undef EXTERN @@ -46,4 +46,6 @@ void readkeye(); boolean keypressede(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index e6d9106b82e3..7305d94d0320 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -50,6 +50,7 @@ #include "fileunit.h" #include "basher.h" +namespace Avalanche { const string crlf = string('\15')+'\12'; const char tab = '\11'; @@ -603,4 +604,4 @@ boolean there_was_a_problem() return there_was_a_problem_result; } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h index ce9f5fd69dfc..d9f0a5416f86 100644 --- a/engines/avalanche/enid.h +++ b/engines/avalanche/enid.h @@ -31,6 +31,7 @@ #include "gyro.h" +namespace Avalanche { void edna_save(string name); @@ -46,4 +47,6 @@ void back_to_bootstrap(byte what); boolean there_was_a_problem(); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index 5fbc5b39a387..c96f445bdeaf 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -33,6 +33,8 @@ /*$V-*/ +namespace Avalanche { + struct windowtype { integer x1,y1,x2,y2; varying_string<20> title; @@ -813,3 +815,5 @@ int main(int argc, const char* argv[]) input >> NL; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index 26ab496844b0..00c19ede686d 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -41,6 +41,8 @@ /*$V-*/ +namespace Avalanche { + struct windowtype { integer x1,y1,x2,y2; varying_string<20> title; @@ -1140,4 +1142,4 @@ string do_filer() return do_filer_result; } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h index ce7d07a85cdd..034d1e591470 100644 --- a/engines/avalanche/fileunit.h +++ b/engines/avalanche/fileunit.h @@ -28,7 +28,10 @@ #ifndef __fileunit_h__ #define __fileunit_h__ +namespace Avalanche { string do_filer(); /* Result is filename, or "" if cancelled. */ -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index a272107b2cc0..51c9334b7d21 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -39,6 +39,7 @@ /*#include "Gyro.h"*/ +namespace Avalanche { const array<1,12,varying_string<6> > months = {{"Jan*","Feb*","March","April","May","June","July","August", @@ -166,4 +167,6 @@ int main(int argc, const char* argv[]) output << "Number of saves: " << e.saves << NL; } return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index 6d9fe754dfd7..4745d959d016 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -28,6 +28,7 @@ /* Get 'em back! */ #include "graph.h" +namespace Avalanche { const integer picsize = 966; const integer number_of_objects = 19; @@ -102,3 +103,5 @@ int main(int argc, const char* argv[]) close(f); freemem(p,picsize); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 0d2a4125444a..8955546b03e7 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -27,6 +27,8 @@ /*#include "Crt.h"*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; fonttype font1; @@ -46,4 +48,6 @@ int main(int argc, const char* argv[]) } assign(f,"v:avitalic.fnt"); rewrite(f); f << font1; close(f); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index 574fc8d85d14..ddd622cb9a41 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { typedef array<1,31,byte> tunetype; @@ -123,4 +124,6 @@ int main(int argc, const char* argv[]) output << "*** PROGRAM STOPPED! ***" << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index b8dab2838d33..c1e81e0525ca 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -30,6 +30,8 @@ /*$R+*/ +namespace Avalanche { + const array<1,5,shortint> adjustment = {{7,0,7,7,7}}; const array<0,3,byte> plane_to_use = {{2,2,2,3}}; @@ -435,3 +437,5 @@ int main(int argc, const char* argv[]) closegraph(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index e5ad0d6fde81..ec20034f159c 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -28,6 +28,7 @@ /*$I c:\sleep5\DSMI.INC*/ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<255> song = string("Golden slumbers kiss your eyes/Smiles awake you when you rise/")+ @@ -459,3 +460,5 @@ int main(int argc, const char* argv[]) for( gd=320; gd >= 0; gd --) rectangle(320-gd,100-gd / 2,320+gd,100+gd / 2); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index f4f82bb2c6c3..651c55b1f31d 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -47,6 +47,7 @@ #include "dropdown.h" #include "basher.h" +namespace Avalanche { const array<'\1',numobjs,varying_string<15> > things = {{"Wine","Money-bag","Bodkin","Potion","Chastity belt", @@ -554,4 +555,4 @@ void super_on() if (super_was_virtual) on_virtual(); else on(); } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 22b8552e4745..22d7544dab00 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -33,6 +33,7 @@ /*#include "Dos.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { const char numobjs = '\22'; /* always preface with a # */ const integer maxobjs = 12; /* carry limit */ @@ -726,4 +727,6 @@ EXTERN word cxmin,cxmax,cymin,cymax; EXTERN boolean use_joy_a; boolean mouse_near_text(); -#endif + } // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index c53e4d8999ea..70f7582eded9 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -29,6 +29,8 @@ /*#include "Rodent.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { + typedef graphcursmasktype cursor; const char vernum[] = "v100"; const char copyright[] = "1992"; @@ -246,4 +248,6 @@ int main(int argc, const char* argv[]) } } while (!lmo); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index fe9cbec76d20..1fc41b6e48be 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; struct hypertype { @@ -266,3 +268,5 @@ int main(int argc, const char* argv[]) } while (!false); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index 1a7138b3ce06..b5513f3be644 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -41,6 +41,7 @@ /*#include "Crt.h"*/ /*#include "Lucerna.h"*/ +namespace Avalanche { struct buttontype { char trigger; @@ -184,3 +185,4 @@ void boot_help() dawn; } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h index 3d8f5d82836e..4025aa882ddd 100644 --- a/engines/avalanche/helpbak.h +++ b/engines/avalanche/helpbak.h @@ -32,7 +32,10 @@ #include "graph.h" /*#include "Gyro.h"*/ +namespace Avalanche { void boot_help(); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index ad489a86694a..397c63fd7f6e 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -42,6 +42,7 @@ /*#include "Lucerna.h"*/ /*#include "Pingo.h"*/ +namespace Avalanche { struct buttontype { char trigger; @@ -305,3 +306,4 @@ void boot_help() setactivepage(1-cp); } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h index 22c6b0657386..bc4afbd54bef 100644 --- a/engines/avalanche/helper.h +++ b/engines/avalanche/helper.h @@ -28,6 +28,7 @@ #ifndef __helper_h__ #define __helper_h__ +namespace Avalanche { #include "graph.h" /*#include "Gyro.h"*/ @@ -35,4 +36,6 @@ void boot_help(); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index dc3d0ab766eb..fbdc66291142 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + file inf,outf; char x; string q; @@ -48,4 +50,6 @@ int main(int argc, const char* argv[]) } close(inf); close(outf); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 419eb38e2b8d..bb4909b06738 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -41,6 +41,7 @@ /*#include "Gyro.h"*/ /*#include "Scrolls.h"*/ +namespace Avalanche { typedef array<1,12,struct A1 { varying_string<30> name; @@ -138,4 +139,6 @@ static unit_highs_initialize highs_constructor; unit_highs_initialize::unit_highs_initialize() {; get_highs(); -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h index f147c0598505..a4937cbab418 100644 --- a/engines/avalanche/highs.h +++ b/engines/avalanche/highs.h @@ -28,9 +28,12 @@ #ifndef __highs_h__ #define __highs_h__ +namespace Avalanche { void show_highs(); void store_high(string who); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index cb0a6271ccaa..f5f106ea0bf4 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -32,6 +32,7 @@ /*#include "Dos.h"*/ /*#include "Tsru.h"*/ +namespace Avalanche { /* program's signature */ const varying_string<20> tsr_tmark = "FISH FISH FISH!!!"; @@ -309,3 +310,5 @@ int main(int argc, const char* argv[]) keep(0); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index f6d79266ca84..32dad7487413 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -40,6 +40,7 @@ #include "gyro.h" #include "logger.h" +namespace Avalanche { byte fv; char t; @@ -195,3 +196,5 @@ unit_incline_initialize::unit_incline_initialize() { check_slope_line(); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index 342f3ef51d8f..e6ebcfb9f7e7 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -27,6 +27,8 @@ /*#include "Crt.h"*/ +namespace Avalanche { + struct inirex { varying_string<12> a; word num; @@ -53,4 +55,6 @@ int main(int argc, const char* argv[]) close(i); close(o); output << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index 4400fa549473..c24a933ed13f 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; integer gd,gm; @@ -69,3 +71,5 @@ int main(int argc, const char* argv[]) } while (!false); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index 854db43df0fa..010e024b942c 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -30,6 +30,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + /* This is a stand-alone program. */ /* 0, black, remains 0. @@ -618,3 +620,5 @@ int main(int argc, const char* argv[]) graphmode(3); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index 0d966883a14c..a14ee5561887 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -28,6 +28,8 @@ /* Avalot interrupt handler */ /*#include "Dos.h"*/ +namespace Avalanche { + /*$F+*/ registers r; void() old1b; @@ -52,3 +54,5 @@ int main(int argc, const char* argv[]) until false;*/ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 4326ac8b31f2..1ebbc4fb663d 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -30,6 +30,7 @@ /*#include "Joystick.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { struct joysetup { word xmid,ymid,xmin,ymin,xmax,ymax; @@ -119,4 +120,6 @@ int main(int argc, const char* argv[]) assign(jf,"v:joytmp.dat"); rewrite(jf); jf << js; close(jf); /* write it all out to disk. */ return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index b18fdd04fc53..8ebea363250d 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -27,7 +27,6 @@ #define __joystick_implementation__ - /* Copyright (c) 1989, 1990 David B. Howorth @@ -60,6 +59,7 @@ Hill Road, Portland, Oregon 97219. /*#include "Dos.h"*/ +namespace Avalanche { typedef void(*readjoyproc)(byte a,byte b,word& c,word& d); typedef boolean(*buttonfunc)(byte a); @@ -206,3 +206,5 @@ unit_joystick_initialize::unit_joystick_initialize() { button = oldbutton; } } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joystick.h b/engines/avalanche/joystick.h index 8a1bcf1edb8b..2cbcd3c455ef 100644 --- a/engines/avalanche/joystick.h +++ b/engines/avalanche/joystick.h @@ -28,6 +28,7 @@ #ifndef __joystick_h__ #define __joystick_h__ +namespace Avalanche { void readjoya(word& xaxis, word& yaxis); /* Reads the X and Y coordinates of Joystick A. */ @@ -46,4 +47,6 @@ boolean buttonb2(); boolean joystickpresent(); /* This function indicates whether a joystick is installed. */ +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index a53e3edbd78c..3f161eda8b39 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; byte a /*absolute $A000:1200*/; byte bit; @@ -45,3 +47,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index 4d14e3cbe8ed..7da976d45c4a 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -41,6 +41,7 @@ /*#include "Gyro.h"*/ /*#include "Trip5.h"*/ +namespace Avalanche { const char divide[] = "--- oOo ---"; @@ -232,4 +233,4 @@ void log_score(word credit,word now) output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h index b068f202ecd2..94cd9383b0f8 100644 --- a/engines/avalanche/logger.h +++ b/engines/avalanche/logger.h @@ -28,6 +28,7 @@ #ifndef __logger_h__ #define __logger_h__ +namespace Avalanche { void log_setup(string name, boolean printing); @@ -57,4 +58,6 @@ void log_aside(string what); void log_score(word credit,word now); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 9ef67fdb7d7a..19466f4b3f8a 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -54,6 +54,7 @@ #include "basher.h" #include "sequence.h" +namespace Avalanche { /*$V-*/ /*$S-*/ boolean fxhidden; array<0,3,palettetype> fxpal; @@ -1512,3 +1513,5 @@ unit_lucerna_initialize::unit_lucerna_initialize() { fxhidden=false; oh=17717; om=17717; if (atbios) atkey="f1"; else atkey="alt-"; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h index f40364a2ba06..5bf0782a8e45 100644 --- a/engines/avalanche/lucerna.h +++ b/engines/avalanche/lucerna.h @@ -28,6 +28,7 @@ #ifndef __lucerna_h__ #define __lucerna_h__ +namespace Avalanche { #include "gyro.h" @@ -100,4 +101,6 @@ void fix_flashers(); -#endif + } // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index e1729f7ad2f1..130e18809200 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { const longint pagetop = 81920; const word nextcode = 17717; @@ -59,3 +60,5 @@ int main(int argc, const char* argv[]) close(magic); close(out); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 139f216f8443..241f69265b57 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const word nextcode = 17717; @@ -56,3 +57,5 @@ int main(int argc, const char* argv[]) /* close(magic);*/ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 0fdb82930aa0..6706ceb56fe6 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -28,6 +28,7 @@ /*#include "Dos.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { const word nextcode = 17717; @@ -82,3 +83,5 @@ int main(int argc, const char* argv[]) } while (!keypressed()); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index 32d8a6c9b9c6..353b461387ac 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -28,6 +28,8 @@ /* Phew! */ #include "graph.h" +namespace Avalanche { + /*$S-*/ integer gd,gm; untyped_file f; @@ -85,3 +87,5 @@ int main(int argc, const char* argv[]) close(t); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index 89b66d73ebaf..35b37d227fea 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -27,6 +27,8 @@ /* regname's name starts at $7D1 (2001). */ +namespace Avalanche { + const array<1,56,char> padding = "For all the Etruscan armies were ranged beneath his eye"; @@ -164,4 +166,6 @@ int main(int argc, const char* argv[]) close(txi); close(txo); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index cfb9974667aa..3c46e18e46e0 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + struct sezheader { array<1,2,char> initials; /* should be "TT" */ word gamecode; @@ -67,4 +69,7 @@ int main(int argc, const char* argv[]) blockwrite(sez,x[1],39); /* footer */ close(sez); return EXIT_SUCCESS; -} \ No newline at end of file +} + + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index 7d3c5f39122e..9f509f16c638 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -30,6 +30,7 @@ /*#include "Crt.h"*/ /*$R+*/ +namespace Avalanche { struct mp { /* mouse-pointer */ matrix<0,1,0,15,word> mask; @@ -292,3 +293,5 @@ int main(int argc, const char* argv[]) show_off_mouse;*/ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index be0920e07db7..17fa553afe23 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; void load() /* Load2, actually */ @@ -70,3 +72,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index d404c60bf75d..38608c8ca0ca 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; pointer p; word s; @@ -59,3 +61,5 @@ int main(int argc, const char* argv[]) putimage(fx1+100,fy1,p,0); freemem(p,s); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index 095fc407a7de..e18c0bea40fe 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const string crlf = string('\15')+'\12'; const char eof_ = '\32'; const array<1,177,char> trip5head = @@ -145,4 +146,6 @@ int main(int argc, const char* argv[]) blockwrite(out,trip5foot,50); close(out); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index a81dfc6720f2..86dd2b2a9d89 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -29,6 +29,7 @@ /*#include "Crt.h"*/ /*#include "Dos.h"*/ +namespace Avalanche { const array > names = {{"Avalot","Dogfood"}}; @@ -403,3 +404,5 @@ int main(int argc, const char* argv[]) endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index 45b1c6813d9e..a81d69fd2455 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { const string header = string("Datafile for Avalot, copyright (c) 1992.")+'\32'; @@ -116,3 +117,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index e2d5f6f45a5d..cfec877c332f 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -37,6 +37,7 @@ #include "nimunit.h" +namespace Avalanche { const array > names = {{"Avalot","Dogfood"}}; @@ -466,3 +467,5 @@ void play_nim() /* Plays the game. Only procedure in this unit to } /* No init part. */ + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h index 4b5f79b89e1e..8919b1af3ad9 100644 --- a/engines/avalanche/nimunit.h +++ b/engines/avalanche/nimunit.h @@ -28,7 +28,6 @@ #ifndef __nimunit_h__ #define __nimunit_h__ - #include "gyro.h" #include "Graph.h" /*#include "Crt.h"*/ @@ -38,8 +37,10 @@ #include "logger.h" #include "celer.h" +namespace Avalanche { void play_nim(); +} // End of namespace Avalanche. #endif diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index f8020269abf5..c813f3764855 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -31,6 +31,7 @@ /*#include "Rodent.h"*/ /*$V-*/ +namespace Avalanche { const char more[] = " (more) "; const string up = string('-')+'\30'+more+'\30'; @@ -280,5 +281,4 @@ int main(int argc, const char* argv[]) return EXIT_SUCCESS; } - - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index 5fa205cb4f61..eaee8eb5026c 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { struct scoretype { varying_string<39> name; @@ -270,4 +271,6 @@ int main(int argc, const char* argv[]) newtable(); newscore(/*177*/0); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index c627407dafc1..a364cbcfdd7f 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -40,6 +40,7 @@ #include "gyro.h" #include "logger.h" +namespace Avalanche { const integer bug_twonames = 255; const integer bug_pandl = 254; @@ -272,3 +273,5 @@ unit_incline_initialize::unit_incline_initialize() {; for( fv=4; fv <= paramcount; fv ++) parse(paramstr(fv)); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index e7df00fd6861..9a3476e82d1e 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -42,6 +42,7 @@ /*#include "Gyro.h"*/ /*#include "Dropdown.h"*/ +namespace Avalanche { void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4); @@ -471,3 +472,4 @@ boolean neardoor_result; return neardoor_result; } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h index 7a5e40238acf..70782ee7dab2 100644 --- a/engines/avalanche/oldtrip.h +++ b/engines/avalanche/oldtrip.h @@ -32,6 +32,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const integer maxgetset = 10; @@ -118,5 +119,6 @@ EXTERN array<1,numtr,triptype> tr; #undef EXTERN #define EXTERN extern +} // End of namespace Avalanche. -#endif +#endif \ No newline at end of file diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index 0209619c189b..c102b3f0ecfc 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -31,6 +31,8 @@ /*#include "Crt.h"*/ /*#include "Enhanced.h"*/ +namespace Avalanche { + varying_string<5> st; byte fv; @@ -198,4 +200,6 @@ int main(int argc, const char* argv[]) } } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 9f8445b7f712..2d8ae42d846f 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -36,6 +36,7 @@ /*#include "Rodent.h"*/ /*#include "Dos.h"*/ +namespace Avalanche { const integer indent = 40; const integer spacing = 83; @@ -318,3 +319,4 @@ void parsekey(char r,char re) } } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h index 4ac4efb1eb00..32f171e82452 100644 --- a/engines/avalanche/oopmenu.h +++ b/engines/avalanche/oopmenu.h @@ -28,6 +28,7 @@ #ifndef __oopmenu_h__ #define __oopmenu_h__ +namespace Avalanche { typedef void(*proc)(); @@ -106,4 +107,6 @@ EXTERN string kbuffer; void parsekey(char r,char re); +} // End of namespace Avalanche. + #endif diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index d68a292d584a..14d5dc8a17cb 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + integer gd,gm; void flash(integer x1,integer y1,integer x2,integer y2) @@ -74,4 +76,6 @@ int main(int argc, const char* argv[]) test(100,50,200,100,120, 70,220,120); test(100,50,200,100,150, 50,250,100); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index 307b9e28332b..9617e2efb4f7 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; int main(int argc, const char* argv[]) {pio_initialize(argc, argv); @@ -75,3 +77,5 @@ int main(int argc, const char* argv[]) end;*/ return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index ef1141e3aed5..bcccdb9bb863 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -30,6 +30,8 @@ /*$R+*/ +namespace Avalanche { + typedef matrix<'\0','\377',0,15,byte> fonttype; struct markertype { @@ -255,3 +257,5 @@ int main(int argc, const char* argv[]) } while (!ok); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index c2a05aee4f5f..cbc84748283d 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { const integer picsize = 966; @@ -87,3 +88,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index 39087b17415b..f0ebccde0313 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -28,6 +28,7 @@ /* Get 'em back! */ #include "graph.h" +namespace Avalanche { const integer picsize = 966; const integer number_of_objects = 17; @@ -87,3 +88,5 @@ int main(int argc, const char* argv[]) close(f); freemem(p,picsize); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 6b0f4902cfb3..2c68a8c3a94c 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -45,6 +45,7 @@ #include "trip5.h" #include "scrolls.h" +namespace Avalanche { void dplot(integer x,integer y, string z) {; @@ -251,4 +252,4 @@ void winning_pic() major_redraw(); } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index 71af98e0ea28..2bda4780c7d8 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -28,6 +28,7 @@ #ifndef __pingo_h__ #define __pingo_h__ +namespace Avalanche { void bosskey(); @@ -43,4 +44,6 @@ void zonk(); void winning_pic(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index 799f1f1adb7f..909088c0e59b 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; byte fv; matrix<1,35,0,39,byte> a; array<0,3,0,4,1,35,byte> b; @@ -64,3 +66,5 @@ int main(int argc, const char* argv[]) } return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index f76486da9c0e..861127714b27 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { array<0,3,palettetype> fxpal; @@ -144,3 +145,5 @@ int main(int argc, const char* argv[]) closegraph(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index b3e2eb60deea..22e6f3f1b804 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -29,6 +29,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + /* This is a stand-alone program. */ /* 0, black, remains 0. @@ -299,3 +301,5 @@ int main(int argc, const char* argv[]) graphmode(3); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index 2ed399dcc470..d51283812145 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -31,6 +31,8 @@ /*#include "Rodent.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { + integer gd,gm; typedef matrix<'\0','\377',0,15,byte> fonttype; @@ -260,3 +262,5 @@ int main(int argc, const char* argv[]) bigo2go(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index 6d8a3005b855..4f2a5f7b3675 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -28,6 +28,8 @@ /*#include "Dos.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { + searchrec s; string x,y; longint hash_time,s_time; @@ -92,4 +94,6 @@ int main(int argc, const char* argv[]) findnext(s); } return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index 76cfc77d6ec6..b55d45ab3b13 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + struct markertype { word length; longint offset; @@ -100,4 +102,6 @@ int main(int argc, const char* argv[]) } close(f); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 7a2cbac0cbfd..0458acb3372e 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + const array<1,36,char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; varying_string<30> name; varying_string<5> number; @@ -112,4 +114,6 @@ int main(int argc, const char* argv[]) negate(); output << "Or, negated, = " << name << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index cc1193527083..e3369db8c7bf 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -45,6 +45,8 @@ /*$L v:MOD-obj.OBJ*/ /* Link in Object file */ /*$F+*/ /* force calls to be 'far'*/ +namespace Avalanche { + extern void modvolume(integer v1,integer v2,integer v3,integer v4); /*Can do while playing*/ extern void moddevice(integer& device); extern void modsetup(integer& status,integer device,integer mixspeed,integer pro,integer loop,string& stri); @@ -74,4 +76,4 @@ void sb_link() /* At the moment, this does nothing. */ {; } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h index e226946560c0..c660c3611789 100644 --- a/engines/avalanche/sackb1.h +++ b/engines/avalanche/sackb1.h @@ -31,6 +31,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { void sb_start(string md); @@ -38,4 +39,6 @@ void sb_stop(); void sb_link(); /* At the moment, this does nothing. */ -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index 60a259c1f49e..0abca98d1747 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -32,6 +32,7 @@ /*#include "SBVoice.h"*/ +namespace Avalanche { int main(int argc, const char* argv[]) { @@ -46,3 +47,5 @@ if (paramcount>0) { output << "Usage: DEMO [d:\\path\\]filename.voc" << NL; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp index e3261d7c1eb5..9cec14da2911 100644 --- a/engines/avalanche/sackblas.cpp +++ b/engines/avalanche/sackblas.cpp @@ -23,5 +23,4 @@ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - + */ \ No newline at end of file diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index fce157e440c1..5385a6c28fa5 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; byte a /*absolute $A000:(15*80)*/; byte bit; @@ -70,3 +72,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 5a9d55d33080..6228bf86f5dc 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<4> codes = " "; @@ -111,3 +112,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 2d5a78c8dd57..6cb6fca6e905 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<4> codes = " "; @@ -135,3 +136,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 0e4ff0dbf283..b71353c9e027 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<4> codes = " "; @@ -115,3 +116,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index 44099e171e73..7f5cb6ada0f0 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<4> codes = " "; @@ -110,4 +111,6 @@ int main(int argc, const char* argv[]) textattr=30; centre(12,"Well done!"); textattr=27; centre(14,"You completed the game!"); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index 82686317f572..5a4aa12b2289 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { const varying_string<4> codes = " "; @@ -115,3 +116,5 @@ int main(int argc, const char* argv[]) save(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index 2dac08ca3912..1fb494257e86 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -27,6 +27,8 @@ /*#include "Crt.h"*/ +namespace Avalanche { + text t; string x; byte fv; @@ -43,3 +45,5 @@ int main(int argc, const char* argv[]) gotoxy(1,23); clreol; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 7bf6c6de05fa..c109624671e3 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -50,6 +50,7 @@ #include "visa.h" #include "timeout.h" +namespace Avalanche { const integer roman = 0; const integer italic = 1; @@ -804,3 +805,5 @@ unit_scrolls_initialize::unit_scrolls_initialize() { loadfont(); resetscrolldriver(); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h index d20d3619dec1..a22cfb7c2e60 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/scrolls.h @@ -32,6 +32,7 @@ #include "gyro.h" #include "joystick.h" +namespace Avalanche { const boolean aboutscroll = false; /* Is this the about box? */ @@ -57,4 +58,6 @@ void okay(); /* Says "Okay!" */ void musical_scroll(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 243caf42b1e7..cf1cb0ae3fe6 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -43,6 +43,7 @@ /*#include "Celer.h"*/ /*#include "Trip5.h"*/ +namespace Avalanche { void then_show(byte what) { @@ -115,3 +116,4 @@ void call_sequencer() start_to_close(); /* Make sure this proc gets called again. */ } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 86d2d89d6351..2d773ca18122 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -28,6 +28,7 @@ #ifndef __sequence_h__ #define __sequence_h__ +namespace Avalanche { const integer now_flip = 177; @@ -56,4 +57,6 @@ void start_to_open(); void call_sequencer(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 1416a5128ed3..245a119bd687 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -29,6 +29,7 @@ /*#include "Tommys.h"*/ #include "joystick.h" +namespace Avalanche { const integer selected = 0x60; /* Background for selected lines of text. */ @@ -1290,3 +1291,5 @@ int main(int argc, const char* argv[]) clear_up(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index 9e8f4aaa4732..883a810cdbe6 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -30,6 +30,7 @@ /*#include "Crt.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { const integer msize = 100; const integer flag = -20047; @@ -999,3 +1000,5 @@ int main(int argc, const char* argv[]) mem[storage_seg*storage_ofs]=score; return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index 206c844c55e8..479f8c174a8a 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { struct adxtype { varying_string<12> name; /* name of character */ @@ -111,4 +112,6 @@ int main(int argc, const char* argv[]) close(sf); close(outfile); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index d9f0e484f919..4ec0bf37b017 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -29,6 +29,7 @@ /*#include "Crt.h"*/ #include "graph.h" +namespace Avalanche { const char marker = '\33'; const char game[] = "Avalot"; @@ -428,3 +429,5 @@ int main(int argc, const char* argv[]) general(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index c98e6f8367a6..e9dda1326719 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -30,6 +30,7 @@ #include "sezunit.h" +namespace Avalanche { struct markertype { word length; @@ -99,3 +100,4 @@ void getchain(longint number) sezerror=sezok; /* nowt went wrong */ } +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h index 76feb6665bb5..fa1f750b0a99 100644 --- a/engines/avalanche/sezunit.h +++ b/engines/avalanche/sezunit.h @@ -31,6 +31,7 @@ /*#include "Gyro.h"*/ +namespace Avalanche { struct sezheader { array<1,2,char> initials; /* should be "TT" */ @@ -65,5 +66,6 @@ void sez_setup(); void getchain(longint number); +} // End of namespace Avalanche. -#endif +#endif \ No newline at end of file diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 7ae6cec3d0d1..3c2cff62f592 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -27,6 +27,9 @@ /*#include "Crt.h"*/ /*$V-*/ + +namespace Avalanche { + text t; string x; matrix<1,100,1,2,string> data; @@ -116,4 +119,6 @@ int main(int argc, const char* argv[]) /* Done! */ return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index 5d6e2c9e2d61..1618174fe4a0 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -28,6 +28,8 @@ /*$M $800,0,0*/ /*#include "Dos.h"*/ +namespace Avalanche { + struct infotype { matrix<128,255,1,8,byte> chars; string data; @@ -57,4 +59,6 @@ int main(int argc, const char* argv[]) swapvectors; setintvec(0x1f,where); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index cd6fec2d2731..1bc68dfc1c68 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -28,6 +28,8 @@ /*#include "Dos.h"*/ #include "graph.h" +namespace Avalanche { + struct infotype { matrix<128,255,1,8,byte> chars; string data; @@ -47,4 +49,6 @@ int main(int argc, const char* argv[]) output << "Press Enter..." << NL; input >> NL; closegraph(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index 83bb1d7a8e60..54ab3d0aa847 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +namespace Avalanche { + struct joysetup { word xmid,ymid,xmin,ymin,xmax,ymax; byte centre; /* Size of centre in tenths */ @@ -370,3 +372,5 @@ int main(int argc, const char* argv[]) store_slopeline(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 3ee713486206..acc9535b64d1 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { struct adxtype { varying_string<12> name; /* name of character */ @@ -327,4 +328,6 @@ int main(int argc, const char* argv[]) pickone(); } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 5a42427d64ff..6fa215900e88 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -31,6 +31,8 @@ /*$V-,R+*/ +namespace Avalanche { + const integer pattern = 12; /* Pattern for transparencies. */ const fillpatterntype grey50 = {{0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}}; @@ -876,4 +878,6 @@ int main(int argc, const char* argv[]) } } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index d9077ed29f63..231aae2168d5 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -33,6 +33,8 @@ /* */ /*--------------------------------------------------------------------------*/ +namespace Avalanche { + const integer maxbuff = 8192 /* Buffer size for input and output files */; const integer maxtab = 4095 /* Table size - 1 ==> 2**10-1 ==> 12 bits */; const integer no_prev = 0x7fff /* Special code for no previous character */; @@ -476,3 +478,5 @@ int main(int argc, const char* argv[]) return EXIT_SUCCESS; } /* PibCompr */ + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index 7e9765407c3e..907c09f91c59 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -28,6 +28,8 @@ /*#include "Dos.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { + byte fv; boolean test; @@ -59,4 +61,6 @@ int main(int argc, const char* argv[]) output << NL; output << "Have fun!" << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index ae466bc9cff1..b73576506be0 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -30,6 +30,7 @@ #include "graph.h" /*#include "Drivers.h"*/ +namespace Avalanche { const integer width = 88; const integer height = 8; /* width & height of string returned by "time" */ @@ -105,4 +106,6 @@ int main(int argc, const char* argv[]) output << NL; output << "Have fun!" << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index d6bc8ef145ca..aaeada2a3682 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -32,6 +32,8 @@ /*#include "Rodent.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { + integer gd,gm; typedef matrix<'\0','\377',0,15,byte> fonttype; @@ -585,3 +587,5 @@ int main(int argc, const char* argv[]) closegraph(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index c8931e6d22a9..f9c5ddb75b4a 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer gd,gm; void data(integer y, string a,string b) @@ -55,4 +57,6 @@ int main(int argc, const char* argv[]) data(177,"Bios/keyboard","AT (enhanced)"); /* or XT (bog standard) */ data(187,"Display","VGA"); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index 0e18be004f48..840ca27ab791 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -37,6 +37,7 @@ #include "sticks.h" +namespace Avalanche { enum lmc {l,m,r, last_lmc}; /* Left, middle & right */ @@ -112,4 +113,6 @@ void joykeys() } } - /* No init code. */ \ No newline at end of file + /* No init code. */ + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h index 24f59c4d5994..c9235c065d09 100644 --- a/engines/avalanche/sticks.h +++ b/engines/avalanche/sticks.h @@ -34,7 +34,11 @@ /*#include "Gyro.h"*/ /* for solidarity */ +namespace Avalanche { + byte joyway(); void joykeys(); #endif + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index d512892093d2..a5c6b28d9b70 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + integer gd,gm; longint tskellern /*absolute $0:244*/; /* Over int $61 */ @@ -79,3 +81,5 @@ int main(int argc, const char* argv[]) } return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index 908e7629b8e5..21ee150ea1a0 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; @@ -99,3 +100,5 @@ int main(int argc, const char* argv[]) choose(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index ead8a372af34..22e49d0872b3 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -28,6 +28,8 @@ /*$M 2048,0,0*/ /*#include "Dos.h"*/ +namespace Avalanche { + const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; pointer saveint1f; int main(int argc, const char* argv[]) @@ -41,3 +43,5 @@ int main(int argc, const char* argv[]) setintvec(0x1f,saveint1f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index 0001ac0c0cf6..7efe64e77ec9 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -27,6 +27,8 @@ /*#include "Dos.h"*/ +namespace Avalanche { + const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; pointer getint1f; array<1,22,char> x; @@ -38,4 +40,6 @@ int main(int argc, const char* argv[]) if (x==signature) output << "Signature found." << NL; else output << "Signature NOT found!" << NL; return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index 4154dcbe46b0..5fe1e3aca177 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { const integer ttp = 81920; const integer borland = xorput; @@ -71,3 +72,5 @@ int main(int argc, const char* argv[]) mblit(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index 3a3fba589530..f435df0c9bdd 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Dos.h"*/ +namespace Avalanche { + integer gd,gm; string filename; @@ -78,3 +80,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index b304a57623a3..86b01b57374b 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -27,6 +27,8 @@ /*#include "Enhanced.h"*/ +namespace Avalanche { + int main(int argc, const char* argv[]) {pio_initialize(argc, argv); ; @@ -39,4 +41,6 @@ int main(int argc, const char* argv[]) } } while (!(inchar=='\33')); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index 073d415b98de..2c83104a5d55 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -47,6 +47,7 @@ #include "Acci.h" #include "enid.h" +namespace Avalanche { byte fv; @@ -617,3 +618,5 @@ static unit_timeout_initialize timeout_constructor; unit_timeout_initialize::unit_timeout_initialize() { fillchar(times,sizeof(times),'\0'); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h index 99090dd69ad6..ceb8c36dccc1 100644 --- a/engines/avalanche/timeout.h +++ b/engines/avalanche/timeout.h @@ -32,6 +32,7 @@ #include "gyro.h" #include "celer.h" +namespace Avalanche { /* reason_ now runs between 1 and 28. */ @@ -253,4 +254,6 @@ void lose_timer(byte which); void give_lute_to_geida(); -#endif + } // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index 4ce11d5d3ed7..a9117c2e74ad 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -28,6 +28,8 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { + integer gd,gm; void zoomout(integer x,integer y) @@ -85,4 +87,6 @@ int main(int argc, const char* argv[]) zoomin(577,124); zoomin(320,85); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 64b88786689d..867ea344bce9 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -42,6 +42,7 @@ #include "gyro.h" /*#include "Dos.h"*/ +namespace Avalanche { /* */ /* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ @@ -161,4 +162,4 @@ void trippancy() budge(); } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h index abef80334100..bfb645e3b563 100644 --- a/engines/avalanche/trip.h +++ b/engines/avalanche/trip.h @@ -28,6 +28,7 @@ #ifndef __trip_h__ #define __trip_h__ +namespace Avalanche { void loadtrip(); @@ -41,4 +42,6 @@ void trippancy(); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index 4c04ef45b7b0..1ca78fbf4767 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -36,6 +36,8 @@ /*$S+*/ +namespace Avalanche { + const integer avvy = 1; const integer test = 177; @@ -254,3 +256,5 @@ static unit_trip3_initialize trip3_constructor; unit_trip3_initialize::unit_trip3_initialize() {; /* init portion of Trip3 */ tramt=0; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h index 9318726e45e1..4a5f6fb9d070 100644 --- a/engines/avalanche/trip3.h +++ b/engines/avalanche/trip3.h @@ -31,6 +31,7 @@ #include "gyro.h" +namespace Avalanche { void loadtrip(); @@ -44,4 +45,6 @@ void enter(byte what_handle, integer xx,integer yy,integer lx,integer ly, byte mmx,byte mmy,byte st); -#endif + } // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index 2dee6699e8ab..a587dc1e7eeb 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -42,6 +42,7 @@ /*#include "Dropdown.h"*/ /*#include "Access.h"*/ +namespace Avalanche { /*procedure copier(x1,y1,x2,y2,x3,y3,x4,y4:integer); @@ -473,3 +474,5 @@ static unit_trip42_initialize trip42_constructor; unit_trip42_initialize::unit_trip42_initialize() {; getsetclear(); } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h index 72b94994b1d1..644a72190ed2 100644 --- a/engines/avalanche/trip42.h +++ b/engines/avalanche/trip42.h @@ -35,6 +35,7 @@ /*#include "Gyro.h"*/ /*#include "Sticks.h"*/ +namespace Avalanche { const integer maxgetset = 10; @@ -113,5 +114,6 @@ EXTERN array<0,1,getsettype> getset; #undef EXTERN #define EXTERN extern +} // End of namespace Avalanche. -#endif +#endif \ No newline at end of file diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 5742bf3342f9..fc9429bc9521 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -47,6 +47,7 @@ /*#include "Sequence.h"*/ /*#include "Enid.h"*/ +namespace Avalanche { void loadtrip() { @@ -1911,3 +1912,5 @@ static unit_trip5_initialize trip5_constructor; unit_trip5_initialize::unit_trip5_initialize() { getsetclear(); mustexclaim=false; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h index 3811c85adec6..6c1823211010 100644 --- a/engines/avalanche/trip5.h +++ b/engines/avalanche/trip5.h @@ -34,6 +34,8 @@ /*#include "Gyro.h"*/ /*#include "Sticks.h"*/ +namespace Avalanche { + const integer maxgetset = 35; @@ -198,5 +200,6 @@ EXTERN boolean mustexclaim; EXTERN word saywhat; #undef EXTERN #define EXTERN extern +} // End of namespace Avalanche. -#endif +#endif \ No newline at end of file diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index 5b78efa9c5d1..8dbd985ab44c 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -30,6 +30,8 @@ /*$R+*/ +namespace Avalanche { + struct adxtype { varying_string<12> name; /* name of character */ varying_string<16> comment; /* comment */ @@ -156,4 +158,6 @@ int main(int argc, const char* argv[]) plotone(0,0); close(inf); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index 09a8eac89d24..f83f9c7ec245 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const string crlf = string('\15')+'\12'; const char eof_ = '\32'; const array<1,177,char> trip5head = @@ -193,4 +194,6 @@ int main(int argc, const char* argv[]) blockwrite(out,trip5foot,50); close(out); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index 6ddc12c115f2..0edd926628d4 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -29,6 +29,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const integer up = 0; const integer right = 1; @@ -312,4 +313,6 @@ int main(int argc, const char* argv[]) } while (!keypressed()); } return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index ad986e1822c4..536ebcdcccef 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -29,6 +29,8 @@ /*#include "Tommys.h"*/ /*#include "Crt.h"*/ +namespace Avalanche { + integer gd,gm; word s; pointer p; file f; @@ -134,3 +136,5 @@ int main(int argc, const char* argv[]) close(f); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index bf98aebc0c9a..e0ede8e35dde 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -28,6 +28,7 @@ /*$S-*/ #include "graph.h" +namespace Avalanche { typedef array<1,50000,byte> buffertype; @@ -546,4 +547,4 @@ delete buffer; return EXIT_SUCCESS; } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index 52edfe4fbdd3..58dc7b6e3582 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -30,6 +30,7 @@ /*#include "crt.h"*/ /*#include "tommys.h"*/ +namespace Avalanche { typedef array<0,49999,byte> bigtextarray; struct chaptertype { @@ -545,3 +546,5 @@ int main(int argc, const char* argv[]) endit(); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index dea03b179d86..c801a741d66a 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -44,6 +44,7 @@ /*#include "Trip5.h"*/ /*#include "Lucerna.h"*/ +namespace Avalanche { const boolean bubbling = false; const boolean report_dixi_errors = true; @@ -286,4 +287,4 @@ void talkto(byte whom) } } - +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h index 0c695fb0711e..474a0098c67e 100644 --- a/engines/avalanche/visa.h +++ b/engines/avalanche/visa.h @@ -28,9 +28,12 @@ #ifndef __visa_h__ #define __visa_h__ +namespace Avalanche { void dixi(char block, byte point); void talkto(byte whom); -#endif +} // End of namespace Avalanche. + +#endif \ No newline at end of file diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index 5cbcf6432606..854423947334 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -27,6 +27,7 @@ /*#include "Crt.h"*/ +namespace Avalanche { char block; word point; @@ -105,4 +106,6 @@ int main(int argc, const char* argv[]) display_it(); } while (!false); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 98590e63b936..074c3b1178fb 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -27,6 +27,7 @@ #include "graph.h" +namespace Avalanche { void load() { @@ -117,3 +118,5 @@ int main(int argc, const char* argv[]) dump_to_file(26,88,78,147,"gameover.avd"); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index ec7b1d1405fb..7a99b50646f0 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -28,6 +28,7 @@ /*#include "Crt.h"*/ /*#include "Tommys.h"*/ +namespace Avalanche { const integer max_pages = 34; @@ -107,4 +108,6 @@ int main(int argc, const char* argv[]) close(o); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index c0b2573ba8bb..4df55cdce53a 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -30,6 +30,8 @@ /*$R+*/ +namespace Avalanche { + const varying_string<9> used = "DNPQSTUXZ"; const varying_string<12> header = string("Avalot Sez:")+'\32'; @@ -199,4 +201,6 @@ int main(int argc, const char* argv[]) write_out(); return EXIT_SUCCESS; -} \ No newline at end of file +} + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index 197aa960a3c6..013a121666a4 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -27,6 +27,8 @@ #include "graph.h" +namespace Avalanche { + integer x,y; untyped_file f,out; @@ -84,3 +86,5 @@ int main(int argc, const char* argv[]) close(out); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 6eeec2862882..1c7673c4014f 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -28,6 +28,7 @@ #include "graph.h" /*#include "Crt.h"*/ +namespace Avalanche { const array<1,44,char> chunkheader = string("Spooky file! Nearly a Chunk... (c) MT.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; @@ -268,3 +269,5 @@ int main(int argc, const char* argv[]) #endif return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index 9b13dbbec974..fe1619a4c382 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -29,6 +29,7 @@ /*#include "Crt.h"*/ /*#include "Dos.h"*/ +namespace Avalanche { untyped_file f; byte bit; @@ -60,3 +61,5 @@ int main(int argc, const char* argv[]) rectangle( 0, 10, 27, 19); return EXIT_SUCCESS; } + +} // End of namespace Avalanche. \ No newline at end of file From 38bc20a0763f0f83ea3c0a94a68a1edea0d08514 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Jun 2013 10:23:29 +0200 Subject: [PATCH 0007/1332] AVALANCHE: Use Artistic Style. --- engines/avalanche/1stoff.cpp | 92 +- engines/avalanche/access.cpp | 288 +-- engines/avalanche/access.h | 2 +- engines/avalanche/acci.cpp | 3201 ++++++++++++++++-------------- engines/avalanche/acci.h | 397 ++-- engines/avalanche/also.cpp | 2216 ++++++++++++--------- engines/avalanche/andexor.cpp | 217 +- engines/avalanche/andexor2.cpp | 244 +-- engines/avalanche/andextst.cpp | 117 +- engines/avalanche/arch.cpp | 164 +- engines/avalanche/arch.h | 2 +- engines/avalanche/avalot9.cpp | 181 +- engines/avalanche/avbkgrnd.cpp | 168 +- engines/avalanche/avmenu.cpp | 478 ++--- engines/avalanche/avvyans.cpp | 165 +- engines/avalanche/avvyans2.cpp | 374 ++-- engines/avalanche/avvymonk.cpp | 143 +- engines/avalanche/bakchunk.cpp | 45 +- engines/avalanche/basher.cpp | 633 +++--- engines/avalanche/basher.h | 20 +- engines/avalanche/cadburys.cpp | 193 +- engines/avalanche/cadburys.h | 32 +- engines/avalanche/celer.cpp | 686 ++++--- engines/avalanche/celer.h | 40 +- engines/avalanche/ch_egats.cpp | 71 +- engines/avalanche/charmap.cpp | 46 +- engines/avalanche/chunker.cpp | 111 +- engines/avalanche/chunkxf1.cpp | 139 +- engines/avalanche/chunkxf2.cpp | 328 ++-- engines/avalanche/chunkxf3.cpp | 248 ++- engines/avalanche/chunkxf4.cpp | 511 ++--- engines/avalanche/chunkxf5.cpp | 466 +++-- engines/avalanche/chunkxf6.cpp | 477 +++-- engines/avalanche/chunkxf7.cpp | 451 +++-- engines/avalanche/chunkxf8.cpp | 453 +++-- engines/avalanche/chunkxf9.cpp | 453 +++-- engines/avalanche/chunkxfa.cpp | 459 +++-- engines/avalanche/chunkxfb.cpp | 455 +++-- engines/avalanche/chunkxfc.cpp | 451 +++-- engines/avalanche/chunkxfd.cpp | 451 +++-- engines/avalanche/chunkxfe.cpp | 451 +++-- engines/avalanche/chunkxff.cpp | 451 +++-- engines/avalanche/chunkxfg.cpp | 451 +++-- engines/avalanche/chunkxfh.cpp | 453 +++-- engines/avalanche/chunkxfi.cpp | 459 +++-- engines/avalanche/chunkxfj.cpp | 432 ++-- engines/avalanche/chunkxfk.cpp | 432 ++-- engines/avalanche/chunkxfl.cpp | 223 ++- engines/avalanche/clock.cpp | 105 +- engines/avalanche/closing.cpp | 160 +- engines/avalanche/closing.h | 4 +- engines/avalanche/convert.cpp | 145 +- engines/avalanche/convmous.cpp | 149 +- engines/avalanche/credits.cpp | 149 +- engines/avalanche/displtxt.cpp | 54 +- engines/avalanche/dropdown.cpp | 1469 ++++++++------ engines/avalanche/dropdown.h | 104 +- engines/avalanche/dwidth.cpp | 25 +- engines/avalanche/edhead.cpp | 141 +- engines/avalanche/edna.cpp | 572 +++--- engines/avalanche/enhanced.cpp | 86 +- engines/avalanche/enhanced.h | 4 +- engines/avalanche/enid.cpp | 806 ++++---- engines/avalanche/enid.h | 2 +- engines/avalanche/filer.cpp | 1495 +++++++------- engines/avalanche/fileunit.cpp | 1991 ++++++++++--------- engines/avalanche/fileunit.h | 2 +- engines/avalanche/filing.cpp | 252 +-- engines/avalanche/folktemp.cpp | 95 +- engines/avalanche/fontslid.cpp | 34 +- engines/avalanche/frere.cpp | 126 +- engines/avalanche/g-room.cpp | 751 +++---- engines/avalanche/golden.cpp | 804 ++++---- engines/avalanche/gyro.cpp | 976 ++++----- engines/avalanche/gyro.h | 859 ++++---- engines/avalanche/help.cpp | 461 +++-- engines/avalanche/help2.cpp | 449 +++-- engines/avalanche/helpbak.cpp | 273 +-- engines/avalanche/helpbak.h | 2 +- engines/avalanche/helper.cpp | 506 ++--- engines/avalanche/helper.h | 2 +- engines/avalanche/hibits.cpp | 44 +- engines/avalanche/highs.cpp | 153 +- engines/avalanche/highs.h | 6 +- engines/avalanche/hiz.cpp | 537 ++--- engines/avalanche/incline.cpp | 233 +-- engines/avalanche/incline.h | 2 +- engines/avalanche/initxf.cpp | 43 +- engines/avalanche/inputtes.cpp | 67 +- engines/avalanche/intro.cpp | 991 +++++----- engines/avalanche/ints.cpp | 34 +- engines/avalanche/joysetup.cpp | 168 +- engines/avalanche/joystick.cpp | 203 +- engines/avalanche/joystick.h | 6 +- engines/avalanche/loading.cpp | 34 +- engines/avalanche/logger.cpp | 321 +-- engines/avalanche/logger.h | 6 +- engines/avalanche/lucerna.cpp | 2497 ++++++++++++----------- engines/avalanche/lucerna.h | 72 +- engines/avalanche/magic2.cpp | 59 +- engines/avalanche/magidraw.cpp | 49 +- engines/avalanche/magishuf.cpp | 89 +- engines/avalanche/make!.cpp | 107 +- engines/avalanche/makesez.cpp | 67 +- engines/avalanche/makevmou.cpp | 455 +++-- engines/avalanche/menuxf.cpp | 75 +- engines/avalanche/minstran.cpp | 72 +- engines/avalanche/newsprit.cpp | 196 +- engines/avalanche/nim.cpp | 741 ++++--- engines/avalanche/nimdraw.cpp | 181 +- engines/avalanche/nimunit.cpp | 820 ++++---- engines/avalanche/nimunit.h | 8 +- engines/avalanche/oldfiler.cpp | 453 +++-- engines/avalanche/oldhighs.cpp | 435 +++-- engines/avalanche/oldincln.cpp | 387 ++-- engines/avalanche/oldincln.h | 2 +- engines/avalanche/oldtrip.cpp | 979 ++++++---- engines/avalanche/oldtrip.h | 89 +- engines/avalanche/omtest.cpp | 312 +-- engines/avalanche/oopmenu.cpp | 506 ++--- engines/avalanche/oopmenu.h | 92 +- engines/avalanche/overlap.cpp | 86 +- engines/avalanche/overscro.cpp | 107 +- engines/avalanche/particle.cpp | 459 +++-- engines/avalanche/pictemp.cpp | 116 +- engines/avalanche/pictemp2.cpp | 106 +- engines/avalanche/pingo.cpp | 369 ++-- engines/avalanche/pingo.h | 4 +- engines/avalanche/plottest.cpp | 75 +- engines/avalanche/preview1.cpp | 180 +- engines/avalanche/qintro.cpp | 379 ++-- engines/avalanche/qstars.cpp | 425 ++-- engines/avalanche/rawupd.cpp | 104 +- engines/avalanche/readsez.cpp | 130 +- engines/avalanche/reginam.cpp | 136 +- engines/avalanche/sackb1.cpp | 47 +- engines/avalanche/sackb1.h | 2 +- engines/avalanche/sackb3.cpp | 29 +- engines/avalanche/sackblas.cpp | 2 +- engines/avalanche/saving.cpp | 80 +- engines/avalanche/scr_1.cpp | 162 +- engines/avalanche/scr_2.cpp | 198 +- engines/avalanche/scr_3.cpp | 160 +- engines/avalanche/scr_4.cpp | 150 +- engines/avalanche/scr_5.cpp | 173 +- engines/avalanche/scr_9.cpp | 26 +- engines/avalanche/scrolls.cpp | 1414 ++++++++------ engines/avalanche/scrolls.h | 2 +- engines/avalanche/sequence.cpp | 109 +- engines/avalanche/sequence.h | 6 +- engines/avalanche/setup.cpp | 1998 ++++++++++--------- engines/avalanche/seu.cpp | 1597 ++++++++------- engines/avalanche/seu_avvy.cpp | 130 +- engines/avalanche/sez.cpp | 2 +- engines/avalanche/sezedit.cpp | 783 ++++---- engines/avalanche/sezunit.cpp | 117 +- engines/avalanche/sezunit.h | 16 +- engines/avalanche/sezxfr.cpp | 194 +- engines/avalanche/shell1.cpp | 51 +- engines/avalanche/shell2.cpp | 36 +- engines/avalanche/slope.cpp | 529 ++--- engines/avalanche/spread.cpp | 591 +++--- engines/avalanche/spread2.cpp | 1771 +++++++++-------- engines/avalanche/squish.cpp | 575 +++--- engines/avalanche/ss_blank.cpp | 60 +- engines/avalanche/ss_clock.cpp | 151 +- engines/avalanche/stars.cpp | 1030 +++++----- engines/avalanche/status.cpp | 62 +- engines/avalanche/sticks.cpp | 154 +- engines/avalanche/sticks.h | 4 +- engines/avalanche/sunrise.cpp | 95 +- engines/avalanche/tempo.cpp | 112 +- engines/avalanche/test.cpp | 24 +- engines/avalanche/test2.cpp | 23 +- engines/avalanche/testblit.cpp | 74 +- engines/avalanche/testcard.cpp | 88 +- engines/avalanche/testenh.cpp | 31 +- engines/avalanche/timeout.cpp | 1019 +++++----- engines/avalanche/timeout.h | 94 +- engines/avalanche/travel.cpp | 100 +- engines/avalanche/trip.cpp | 252 ++- engines/avalanche/trip.h | 14 +- engines/avalanche/trip3.cpp | 483 +++-- engines/avalanche/trip3.h | 16 +- engines/avalanche/trip42.cpp | 959 +++++---- engines/avalanche/trip42.h | 78 +- engines/avalanche/trip5.cpp | 3366 +++++++++++++++++--------------- engines/avalanche/trip5.h | 166 +- engines/avalanche/trip5tst.cpp | 232 +-- engines/avalanche/trip5xf.cpp | 295 +-- engines/avalanche/tripoop.cpp | 498 +++-- engines/avalanche/ttmenuxf.cpp | 227 ++- engines/avalanche/unsquish.cpp | 685 +++---- engines/avalanche/viewdocs.cpp | 948 ++++----- engines/avalanche/visa.cpp | 436 ++--- engines/avalanche/visa.h | 2 +- engines/avalanche/visatest.cpp | 125 +- engines/avalanche/waver.cpp | 2 +- engines/avalanche/xf_gover.cpp | 143 +- engines/avalanche/xf_help.cpp | 107 +- engines/avalanche/xf_visa.cpp | 244 ++- engines/avalanche/xfbutton.cpp | 101 +- engines/avalanche/xfghost.cpp | 401 ++-- engines/avalanche/zapdraw.cpp | 53 +- 204 files changed, 38190 insertions(+), 32054 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index 0f9e19b940a2..97486055036c 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,55 +30,59 @@ namespace Avalanche { -matrix<1,7,1,3,byte> cols; +matrix<1, 7, 1, 3, byte> cols; byte fv; -void adjust() -{ - registers r; -; - {; - ax=0x1012; - bx=1; - cx=2; - es=seg(cols); - dx=ofs(cols); +void adjust() { + registers r; + ; + { + ; + ax = 0x1012; + bx = 1; + cx = 2; + es = seg(cols); + dx = ofs(cols); - } + } - intr(0x10,r); + intr(0x10, r); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=0; - clrscr; - - fillchar(cols,sizeof(cols),'\0'); - adjust(); - - gotoxy(29,10); textattr=1; output << "Thorsoft of Letchworth"; - gotoxy(36,12); textattr=2; output << "presents"; - - for( fv=1; fv <= 77; fv ++) - {; - delay(77); - if (fv<64) fillchar(cols[1],3,chr(fv)); - if (fv>14) fillchar(cols[2],3,chr(fv-14)); - adjust(); - } - - delay(100); - - for( fv=63; fv >= 1; fv --) - {; - fillchar(cols,sizeof(cols),chr(fv)); - delay(37); - adjust(); - } - -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 0; + clrscr; + + fillchar(cols, sizeof(cols), '\0'); + adjust(); + + gotoxy(29, 10); + textattr = 1; + output << "Thorsoft of Letchworth"; + gotoxy(36, 12); + textattr = 2; + output << "presents"; + + for (fv = 1; fv <= 77; fv ++) { + ; + delay(77); + if (fv < 64) fillchar(cols[1], 3, chr(fv)); + if (fv > 14) fillchar(cols[2], 3, chr(fv - 14)); + adjust(); + } + + delay(100); + + for (fv = 63; fv >= 1; fv --) { + ; + fillchar(cols, sizeof(cols), chr(fv)); + delay(37); + adjust(); + } + + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index 951bc1c81846..abc944f4dcb0 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -49,148 +49,160 @@ namespace Avalanche { boolean int_say_went_ok; void int_say(string filename, boolean bubble) - /* Internal use ONLY! */ +/* Internal use ONLY! */ { - untyped_file f; -; - /*$I-*/ - assign(f,filename); - reset(f,1); - if (ioresult!=0) - {; - int_say_went_ok=false; - return; - } - bufsize=filesize(f); - blockread(f,buffer,bufsize); - if (bubble) - {; - bufsize += 1; - buffer[bufsize]='\2'; - } - close(f); - /*$I+*/ - - calldrivers; - - int_say_went_ok=true; + untyped_file f; + ; + /*$I-*/ + assign(f, filename); + reset(f, 1); + if (ioresult != 0) { + ; + int_say_went_ok = false; + return; + } + bufsize = filesize(f); + blockread(f, buffer, bufsize); + if (bubble) { + ; + bufsize += 1; + buffer[bufsize] = '\2'; + } + close(f); + /*$I+*/ + + calldrivers; + + int_say_went_ok = true; } -void dixi(char p, byte n) -{; exit(153); - int_say(string('s')+p+strf(n)+".raw",false); +void dixi(char p, byte n) { + ; + exit(153); + int_say(string('s') + p + strf(n) + ".raw", false); } -void talkto(byte whom) -{ - byte fv; - boolean no_matches; -; exit(153); - if (person==pardon) - {; - person=chr(subjnumber); - subjnumber=0; - } - - switch (chr(whom)) { - case pspludwick: - - if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) - {; - dixi('q',68); - dna.obj[potion]=true; - objectlist; points(3); return; - } else - {; - if (dna.talked_to_crapulus) - switch (dna.given2spludwick) { /* Spludwick - what does he need? */ - /* 0 - let it through to use normal routine. */ - case RANGE_2(1,2): {; - display(string("Can you get me ")+ - get_better(spludwick_order[dna.given2spludwick])+", please?"+ - "\232\2"); - return; - } - break; - case 3: {; - dixi('q',30); /* need any help with the game? */ - return; - } - break; - } - else dixi('q',42); /* Haven't talked to Crapulus. Go and talk to him. */ - } - break; - - case pibythneth: if (dna.givenbadgetoiby) - {; - dixi('q',33); /* Thanks a lot! */ - return; /* And leave the proc. */ - } - break; /* Or... just continue, 'cos he hasn't got it. */ - case pdogfood: if (dna.wonnim) - {; /* We've won the game. */ - dixi('q',6); /* "I'm Not Playing!" */ - return; /* Zap back. */ - } - break; - case payles: if (~ dna.ayles_is_awake) - {; - dixi('q',43); /* He's fast asleep! */ - return; - } - break; - case pgeida: if (dna.geida_given_potion) - dna.geida_follows=true; else - {; - dixi('u',17); - return; - } - break; - } - - if (whom>149) whom -= 149; - - no_matches=true; - for( fv=1; fv <= numtr; fv ++) - if (tr[fv].a.accinum==whom) - {; - display(string('\23')+chr(fv+48)+'\4'); - no_matches=false; - flush(); - } - - if (no_matches) display("\23\23\4"); - - if (subjnumber==0) /* For the moment... later we'll parse "say". */ - int_say(string("ss")+strf(whom)+".raw",true); - else - {; - int_say(string("ss")+strf(whom)+'-'+strf(subjnumber)+".raw",true); - if (! int_say_went_ok) /* File not found! */ - dixi('n',whom); - } - - switch (chr(whom+149)) { - case pcrapulus: - {; /* Crapulus: get the badge - first time only */ - dna.obj[badge]=true; - objectlist; - dixi('q',1); /* Circular from Cardiff. */ - dna.talked_to_crapulus=true; - - whereis[pcrapulus]=177; /* Crapulus walks off. */ - - tr[2].vanishifstill=true; - tr[2].walkto(4); /* Walks away. */ - - points(2); - } - break; - - case payles: dixi('q',44); break; /* Can you get me a pen? */ - - } +void talkto(byte whom) { + byte fv; + boolean no_matches; + ; + exit(153); + if (person == pardon) { + ; + person = chr(subjnumber); + subjnumber = 0; + } + + switch (chr(whom)) { + case pspludwick: + + if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) { + ; + dixi('q', 68); + dna.obj[potion] = true; + objectlist; + points(3); + return; + } else { + ; + if (dna.talked_to_crapulus) + switch (dna.given2spludwick) { /* Spludwick - what does he need? */ + /* 0 - let it through to use normal routine. */ + case RANGE_2(1, 2): { + ; + display(string("Can you get me ") + + get_better(spludwick_order[dna.given2spludwick]) + ", please?" + + "\232\2"); + return; + } + break; + case 3: { + ; + dixi('q', 30); /* need any help with the game? */ + return; + } + break; + } + else dixi('q', 42); /* Haven't talked to Crapulus. Go and talk to him. */ + } + break; + + case pibythneth: + if (dna.givenbadgetoiby) { + ; + dixi('q', 33); /* Thanks a lot! */ + return; /* And leave the proc. */ + } + break; /* Or... just continue, 'cos he hasn't got it. */ + case pdogfood: + if (dna.wonnim) { + ; /* We've won the game. */ + dixi('q', 6); /* "I'm Not Playing!" */ + return; /* Zap back. */ + } + break; + case payles: + if (~ dna.ayles_is_awake) { + ; + dixi('q', 43); /* He's fast asleep! */ + return; + } + break; + case pgeida: + if (dna.geida_given_potion) + dna.geida_follows = true; + else { + ; + dixi('u', 17); + return; + } + break; + } + + if (whom > 149) whom -= 149; + + no_matches = true; + for (fv = 1; fv <= numtr; fv ++) + if (tr[fv].a.accinum == whom) { + ; + display(string('\23') + chr(fv + 48) + '\4'); + no_matches = false; + flush(); + } + + if (no_matches) display("\23\23\4"); + + if (subjnumber == 0) /* For the moment... later we'll parse "say". */ + int_say(string("ss") + strf(whom) + ".raw", true); + else { + ; + int_say(string("ss") + strf(whom) + '-' + strf(subjnumber) + ".raw", true); + if (! int_say_went_ok) /* File not found! */ + dixi('n', whom); + } + + switch (chr(whom + 149)) { + case pcrapulus: { + ; /* Crapulus: get the badge - first time only */ + dna.obj[badge] = true; + objectlist; + dixi('q', 1); /* Circular from Cardiff. */ + dna.talked_to_crapulus = true; + + whereis[pcrapulus] = 177; /* Crapulus walks off. */ + + tr[2].vanishifstill = true; + tr[2].walkto(4); /* Walks away. */ + + points(2); + } + break; + + case payles: + dixi('q', 44); + break; /* Can you get me a pen? */ + + } } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h index e985953c7fab..2e4a08177365 100644 --- a/engines/avalanche/access.h +++ b/engines/avalanche/access.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index f33d7c2ea063..adaad697d41f 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -58,42 +58,43 @@ namespace Avalanche { byte fv; string wordnum(string x); -static char whatsit; -static word fv; +static char whatsit; +static word fv; static boolean gotcha; -static void checkword(string& x) /* Checks word "fv". */ -{ - { - vocab& with = words[fv]; +static void checkword(string &x) { /* Checks word "fv". */ + { + vocab &with = words[fv]; - if ((with.w==x) || ((copy(with.w,1,length(x))==x) && ! gotcha)) - whatsit=chr(with.n); - if (with.w==x) gotcha=true; - } + if ((with.w == x) || ((copy(with.w, 1, length(x)) == x) && ! gotcha)) + whatsit = chr(with.n); + if (with.w == x) gotcha = true; + } } string wordnum(string x) { - string wordnum_result; - if (x=="") { wordnum_result=""; return wordnum_result; } - whatsit=pardon; gotcha=false; - for( fv=nowords; fv >= 1; fv --) checkword(x); - wordnum_result=whatsit; - return wordnum_result; + string wordnum_result; + if (x == "") { + wordnum_result = ""; + return wordnum_result; + } + whatsit = pardon; + gotcha = false; + for (fv = nowords; fv >= 1; fv --) checkword(x); + wordnum_result = whatsit; + return wordnum_result; } -void replace(string old1,string new1) -{ - byte q; - - q=pos(old1,thats); - while (q!=0) - { - thats=copy(thats,1,q-1)+new1+copy(thats,q+length(old1),255); - q=pos(old1,thats); - } +void replace(string old1, string new1) { + byte q; + + q = pos(old1, thats); + while (q != 0) { + thats = copy(thats, 1, q - 1) + new1 + copy(thats, q + length(old1), 255); + q = pos(old1, thats); + } } /*procedure ninetydump; @@ -112,1588 +113,1844 @@ begin display('Dumped.'); end;*/ -string rank() -{ - byte fv; - - string rank_result; - for( fv=1; fv <= 8; fv ++) - if ((dna.score>=ranks[fv].score) - && (dna.score= ranks[fv].score) + && (dna.score < ranks[fv + 1].score)) { + rank_result = ranks[fv].title; + return rank_result; + } + return rank_result; } -string totaltime() -{ - const real ticks_in_1_sec = (real)(65535)/3600; - word h,m,s; varying_string<70> a; - - /* There are 65535 clock ticks in a second, - 1092.25 in a minute, and - 65535 in an hour. */ - string totaltime_result; - h=trunc(dna.total_time/ticks_in_1_sec); /* No. of seconds. */ - m=h % 3600; h=h / 3600; - s=m % 60; m=m / 60; - - a="You've been playing for "; - - if (h>0) a=a+strf(h)+" hours, "; - if ((m>0) || (h!=0)) a=a+strf(m)+" minutes and "; - a=a+strf(s)+" seconds."; - - totaltime_result=a; - return totaltime_result; +string totaltime() { + const real ticks_in_1_sec = (real)(65535) / 3600; + word h, m, s; + varying_string<70> a; + + /* There are 65535 clock ticks in a second, + 1092.25 in a minute, and + 65535 in an hour. */ + string totaltime_result; + h = trunc(dna.total_time / ticks_in_1_sec); /* No. of seconds. */ + m = h % 3600; + h = h / 3600; + s = m % 60; + m = m / 60; + + a = "You've been playing for "; + + if (h > 0) a = a + strf(h) + " hours, "; + if ((m > 0) || (h != 0)) a = a + strf(m) + " minutes and "; + a = a + strf(s) + " seconds."; + + totaltime_result = a; + return totaltime_result; } void cheatparse(string codes); -static word num; +static word num; static integer e; -static void number(string& codes) -{ - val(codes,num,e); +static void number(string &codes) { + val(codes, num, e); } -void cheatparse(string codes) -{ - char cmd;integer se,sx,sy; - - if (~ cheat) - { /* put them off the scent! */ - display("Have you gone dotty\??!"); - return; - } - cmd=upcase(codes[2]); Delete(codes,1,2); /* strip header */ - display("\6Ninety: \22\4"); - switch (cmd) { - case 'R': { - number(codes); if (e!=0) return; - display(string("room swap to ")+codes+'.'); - fliproom(num,1); - } - break; - case 'Z': { zonk; display("Zonk OK!"); } break; - case 'W': { wobble; display("Ow my head!"); } break; - case 'A': { - tr[1].done; - tr[1].init(1,true); - dna.user_moves_avvy=true; - alive=true; - display("Reincat."); - } - break; - case 'B': { - sx=tr[1].x; - sy=tr[1].y; - se=tr[1].face; - delavvy; - number(codes); - { - void& with = tr[1]; - - done; - init(num,true); - display(string("Become ")+codes+':'+"\r\r"+a.name+'\15'+a.comment); - appear(sx,sy,se); - } - } - break; -/* 'D': ninetydump;*/ - case 'G': play_nim; break; - case '': display("\232\25"); break; - default: display("unknown code!"); - } +void cheatparse(string codes) { + char cmd; + integer se, sx, sy; + + if (~ cheat) { + /* put them off the scent! */ + display("Have you gone dotty\??!"); + return; + } + cmd = upcase(codes[2]); + Delete(codes, 1, 2); /* strip header */ + display("\6Ninety: \22\4"); + switch (cmd) { + case 'R': { + number(codes); + if (e != 0) return; + display(string("room swap to ") + codes + '.'); + fliproom(num, 1); + } + break; + case 'Z': { + zonk; + display("Zonk OK!"); + } + break; + case 'W': { + wobble; + display("Ow my head!"); + } + break; + case 'A': { + tr[1].done; + tr[1].init(1, true); + dna.user_moves_avvy = true; + alive = true; + display("Reincat."); + } + break; + case 'B': { + sx = tr[1].x; + sy = tr[1].y; + se = tr[1].face; + delavvy; + number(codes); + { + void &with = tr[1]; + + done; + init(num, true); + display(string("Become ") + codes + ':' + "\r\r" + a.name + '\15' + a.comment); + appear(sx, sy, se); + } + } + break; + /* 'D': ninetydump;*/ + case 'G': + play_nim; + break; + case '': + display("\232\25"); + break; + default: + display("unknown code!"); + } } -void punctustrip(string& x) /* Strips punctuation from x. */ -{ - const varying_string<32> punct = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - byte fv,p; - - for( fv=1; fv <= 32; fv ++) - do { - p=pos(punct[fv-1],x); - if (p==0) flush(); /* <<< The first time I've ever used it! */ - Delete(x,p,1); - } while (!false); +void punctustrip(string &x) { /* Strips punctuation from x. */ + const varying_string<32> punct = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; + byte fv, p; + + for (fv = 1; fv <= 32; fv ++) + do { + p = pos(punct[fv - 1], x); + if (p == 0) flush(); /* <<< The first time I've ever used it! */ + Delete(x, p, 1); + } while (!false); } boolean do_pronouns(); static boolean ambiguous; -static void displaywhat(char ch, boolean animate) /* << it's an adjective! */ -{ - byte ff; string z; - - if (ch==pardon) - { - ambiguous=true; - if (animate) display("Whom?"); else display("What?"); - } else - { - if (animate) display(string("{ ")+getname(ch)+" }"); - else - { - z=get_better(ch); - if (z!="") display(string("{ ")+z+" }"); - } - } +static void displaywhat(char ch, boolean animate) { /* << it's an adjective! */ + byte ff; + string z; + + if (ch == pardon) { + ambiguous = true; + if (animate) display("Whom?"); + else display("What?"); + } else { + if (animate) display(string("{ ") + getname(ch) + " }"); + else { + z = get_better(ch); + if (z != "") display(string("{ ") + z + " }"); + } + } } -boolean do_pronouns() -{ - byte fv; - - boolean do_pronouns_result; - ambiguous=false; - for( fv=1; fv <= length(thats); fv ++) - switch (thats[fv]) { - case '\310': { - displaywhat(him,true); - thats[fv]=him; - } - break; - case '\311': { - displaywhat(her,true); - thats[fv]=her; - } - break; - case '\312': { - displaywhat(it,false); - thats[fv]=it; - } - break; - } - do_pronouns_result=ambiguous; - return do_pronouns_result; +boolean do_pronouns() { + byte fv; + + boolean do_pronouns_result; + ambiguous = false; + for (fv = 1; fv <= length(thats); fv ++) + switch (thats[fv]) { + case '\310': { + displaywhat(him, true); + thats[fv] = him; + } + break; + case '\311': { + displaywhat(her, true); + thats[fv] = her; + } + break; + case '\312': { + displaywhat(it, false); + thats[fv] = it; + } + break; + } + do_pronouns_result = ambiguous; + return do_pronouns_result; } void store_interrogation(byte interrogation); -static void lowercase() -{ - byte fv; +static void lowercase() { + byte fv; - for( fv=1; fv <= length(current); fv ++) - if (set::of(range('A','Z'), eos).has(current[fv])) - current[fv] += 32; + for (fv = 1; fv <= length(current); fv ++) + if (set::of(range('A', 'Z'), eos).has(current[fv])) + current[fv] += 32; } -static void propernouns() -{ - byte fv; +static void propernouns() { + byte fv; - lowercase(); - for( fv=2; fv <= length(current)-1; fv ++) - if (current[fv]==' ') - current[fv+1]=upcase(current[fv+1]); - current[1]=upcase(current[1]); + lowercase(); + for (fv = 2; fv <= length(current) - 1; fv ++) + if (current[fv] == ' ') + current[fv + 1] = upcase(current[fv + 1]); + current[1] = upcase(current[1]); } -static void sayit() /* This makes Avalot say the response. */ -{ - string x; +static void sayit() { /* This makes Avalot say the response. */ + string x; - x=current; x[1]=upcase(x[1]); - display(string("\231")+x+'.'+'\2'+'\23'+'2'); + x = current; + x[1] = upcase(x[1]); + display(string("\231") + x + '.' + '\2' + '\23' + '2'); } -void store_interrogation(byte interrogation) -{ - byte fv; +void store_interrogation(byte interrogation) { + byte fv; - if (current=="") return; + if (current == "") return; - /* Strip current: */ - while ((current[1]==' ') && (current!="")) Delete(current,1,1); - while ((current[length(current)]==' ') && (current!="")) current[0] -= 1; + /* Strip current: */ + while ((current[1] == ' ') && (current != "")) Delete(current, 1, 1); + while ((current[length(current)] == ' ') && (current != "")) current[0] -= 1; - lose_timer(reason_cardiffsurvey); /* if you want to use any other timer, + lose_timer(reason_cardiffsurvey); /* if you want to use any other timer, put this into the case statement. */ - switch (interrogation) { - case 1: { - lowercase(); sayit(); - like2drink=current; - dna.cardiff_things=2; - } - break; - case 2: { - propernouns(); sayit(); - favourite_song=current; - dna.cardiff_things=3; - } - break; - case 3: { - propernouns(); sayit(); - worst_place_on_earth=current; - dna.cardiff_things=4; - } - break; - case 4: { - lowercase(); sayit(); - fillchar(spare_evening,sizeof(spare_evening),'\261'); - spare_evening=current; - dixi('z',5); /* His closing statement... */ - tr[2].walkto(4); /* The end of the drawbridge */ - tr[2].vanishifstill=true; /* Then go away! */ - magics[2].op=nix; - dna.cardiff_things=5; - } - break; - - case 99: store_high(current); break; - } - if (interrogation<4) cardiff_survey; + switch (interrogation) { + case 1: { + lowercase(); + sayit(); + like2drink = current; + dna.cardiff_things = 2; + } + break; + case 2: { + propernouns(); + sayit(); + favourite_song = current; + dna.cardiff_things = 3; + } + break; + case 3: { + propernouns(); + sayit(); + worst_place_on_earth = current; + dna.cardiff_things = 4; + } + break; + case 4: { + lowercase(); + sayit(); + fillchar(spare_evening, sizeof(spare_evening), '\261'); + spare_evening = current; + dixi('z', 5); /* His closing statement... */ + tr[2].walkto(4); /* The end of the drawbridge */ + tr[2].vanishifstill = true; /* Then go away! */ + magics[2].op = nix; + dna.cardiff_things = 5; + } + break; + + case 99: + store_high(current); + break; + } + if (interrogation < 4) cardiff_survey; } -void clearwords() -{ - fillchar(realwords,sizeof(realwords),'\0'); +void clearwords() { + fillchar(realwords, sizeof(realwords), '\0'); } -void parse() -{ - byte n,fv,ff; string c,cc,thisword; varying_string<1> answer; boolean notfound; - - /* first parsing - word identification */ - - thats=""; c=current+'\40'; n=1; polite=false; - verb=pardon; thing=pardon; thing2=pardon; person=pardon; - clearwords(); - if (current[1]=='.') - { /* a cheat mode attempt */ - cheatparse(current); thats=nowt; return; - } /* not our department! Otherwise... */ - - /* Are we being interrogated right now? */ - - if (interrogation>0) - { - store_interrogation(interrogation); - weirdword=true; - return; - } - - cc=c; for( fv=1; fv <= length(c); fv ++) c[fv]=upcase(c[fv]); - while (c!="") - { - while ((c[1]=='\40') && (c!="")) - { Delete(c,1,1); Delete(cc,1,1); } - thisword=copy(c,1,pos("\40",c)-1); - realwords[n]=copy(cc,1,pos("\40",cc)-1); - punctustrip(c); - - notfound=true; - - if (thisword!="") - { - for( ff=1; ff <= 30; ff ++) - { /* Check Also, FIRST! */ - if (pos(string(',')+thisword,also[ff][0])>0) - { - thats=thats+chr(99+ff); - notfound=false; - } - } - } - - if (notfound) - { - answer=wordnum(thisword); - if (answer==pardon) - { - notfound=true; - thats=thats+pardon; - } else - thats=thats+wordnum(thisword); - n += 1; - } - Delete(c,1,pos("\40",c)); Delete(cc,1,pos("\40",cc)); - } - - if (pos("\376",thats)>0) unknown=realwords[pos("\376",thats)]; else unknown=""; replace("\377",""); /* zap noise words */ - replace(string('\15')+'\342',"\1"); /* "look at" = "examine" */ - replace(string('\15')+'\344',"\1"); /* "look in" = "examine" */ - replace(string('\4')+'\343',"\21"); /* "get up" = "stand" */ - replace(string('\4')+'\347',"\21"); /* "get down" = "stand"... well, why not? */ - replace(string('\22')+'\344',"\2"); /* "go in" = "open [door]" */ - replace(string('\34')+'\345',"\375"); /* "P' off" is a swear word */ - replace(string('\4')+'\6',"\6"); /* "Take inventory" (remember Colossal Adventure?) */ - replace(string('\50')+'\350',"\25"); /* "put on" = "don" */ - replace(string('\4')+'\345',"\24"); /* "take off" = "doff" */ - - /* Words that could mean more than one person */ - { - if (room==r__nottspub) replace("\314","\244"); /* Barman = Port */ - else replace("\314","\232"); /* Barman = Malagauche */ - switch (room) { - case r__aylesoffice: replace("\313","\243"); break; /* Monk = Ayles */ - case r__musicroom: replace("\313","\246"); break; /* Monk = Jacques */ - default: replace("\313","\242"); /* Monk = Ibythneth */ - } - } - - if (do_pronouns()) - { - weirdword=true; - thats=nowt; - return; - } - - /* second parsing - accidence */ - - subject=""; subjnumber=0; /* Find subject of conversation. */ - for( fv=1; fv <= 11; fv ++) - if (set::of('`','\'', eos).has(realwords[fv][1])) - { - subjnumber=ord(thats[fv]); - thats[fv]=moved; - flush(); /* Only the second time I've used that! */ - } - if (subjnumber==0) /* Still not found. */ - for( fv=1; fv <= 10; fv ++) - if (thats[fv]=='\374') /* the word is "about", or something similar */ - { - subjnumber=ord(thats[fv+1]); - thats[fv+1]='\0'; - flush(); /* ...Third! */ - } - if (subjnumber==0) /* STILL not found! Must be the word after "say". */ - for( fv=1; fv <= 10; fv ++) - if ((thats[fv]=='\7') && ! (set::of('\0',range('\341','\345'), eos).has(thats[fv+1]))) - { /* SAY not followed by a preposition */ - subjnumber=ord(thats[fv+1]); - thats[fv+1]='\0'; - flush(); /* ...Fourth! */ - } - - for( fv=length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ - switch (thats[fv]) { - case '\1' ... '\61':case '\375':case '\371': verb=thats[fv]; break; - case '\62' ... '\225': { thing2=thing; thing=thats[fv]; } break; - case '\226' ... '\307': person=thats[fv]; break; - case '\373': polite=true; break; - } - - if ((unknown!="") && ! - (set::of(vb_exam,vb_talk,vb_save,vb_load,vb_dir, eos).has(verb))) - { - display(string("Sorry, but I have no idea what `")+unknown+ - "\" means. Can you rephrase it?"); - weirdword=true; - } else weirdword=false; - if (thats=="") thats=nowt; - - if (thing!=pardon) it=thing; - if (person!=pardon) - { - if (person<'\257') him=person; else her=person; - } +void parse() { + byte n, fv, ff; + string c, cc, thisword; + varying_string<1> answer; + boolean notfound; + + /* first parsing - word identification */ + + thats = ""; + c = current + '\40'; + n = 1; + polite = false; + verb = pardon; + thing = pardon; + thing2 = pardon; + person = pardon; + clearwords(); + if (current[1] == '.') { + /* a cheat mode attempt */ + cheatparse(current); + thats = nowt; + return; + } /* not our department! Otherwise... */ + + /* Are we being interrogated right now? */ + + if (interrogation > 0) { + store_interrogation(interrogation); + weirdword = true; + return; + } + + cc = c; + for (fv = 1; fv <= length(c); fv ++) c[fv] = upcase(c[fv]); + while (c != "") { + while ((c[1] == '\40') && (c != "")) { + Delete(c, 1, 1); + Delete(cc, 1, 1); + } + thisword = copy(c, 1, pos("\40", c) - 1); + realwords[n] = copy(cc, 1, pos("\40", cc) - 1); + punctustrip(c); + + notfound = true; + + if (thisword != "") { + for (ff = 1; ff <= 30; ff ++) { + /* Check Also, FIRST! */ + if (pos(string(',') + thisword, also[ff][0]) > 0) { + thats = thats + chr(99 + ff); + notfound = false; + } + } + } + + if (notfound) { + answer = wordnum(thisword); + if (answer == pardon) { + notfound = true; + thats = thats + pardon; + } else + thats = thats + wordnum(thisword); + n += 1; + } + Delete(c, 1, pos("\40", c)); + Delete(cc, 1, pos("\40", cc)); + } + + if (pos("\376", thats) > 0) unknown = realwords[pos("\376", thats)]; + else unknown = ""; + replace("\377", ""); /* zap noise words */ + replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */ + replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */ + replace(string('\4') + '\343', "\21"); /* "get up" = "stand" */ + replace(string('\4') + '\347', "\21"); /* "get down" = "stand"... well, why not? */ + replace(string('\22') + '\344', "\2"); /* "go in" = "open [door]" */ + replace(string('\34') + '\345', "\375"); /* "P' off" is a swear word */ + replace(string('\4') + '\6', "\6"); /* "Take inventory" (remember Colossal Adventure?) */ + replace(string('\50') + '\350', "\25"); /* "put on" = "don" */ + replace(string('\4') + '\345', "\24"); /* "take off" = "doff" */ + + /* Words that could mean more than one person */ + { + if (room == r__nottspub) replace("\314", "\244"); /* Barman = Port */ + else replace("\314", "\232"); /* Barman = Malagauche */ + switch (room) { + case r__aylesoffice: + replace("\313", "\243"); + break; /* Monk = Ayles */ + case r__musicroom: + replace("\313", "\246"); + break; /* Monk = Jacques */ + default: + replace("\313", "\242"); /* Monk = Ibythneth */ + } + } + + if (do_pronouns()) { + weirdword = true; + thats = nowt; + return; + } + + /* second parsing - accidence */ + + subject = ""; + subjnumber = 0; /* Find subject of conversation. */ + for (fv = 1; fv <= 11; fv ++) + if (set::of('`', '\'', eos).has(realwords[fv][1])) { + subjnumber = ord(thats[fv]); + thats[fv] = moved; + flush(); /* Only the second time I've used that! */ + } + if (subjnumber == 0) /* Still not found. */ + for (fv = 1; fv <= 10; fv ++) + if (thats[fv] == '\374') { /* the word is "about", or something similar */ + subjnumber = ord(thats[fv + 1]); + thats[fv + 1] = '\0'; + flush(); /* ...Third! */ + } + if (subjnumber == 0) /* STILL not found! Must be the word after "say". */ + for (fv = 1; fv <= 10; fv ++) + if ((thats[fv] == '\7') && !(set::of('\0', range('\341', '\345'), eos).has(thats[fv + 1]))) { + /* SAY not followed by a preposition */ + subjnumber = ord(thats[fv + 1]); + thats[fv + 1] = '\0'; + flush(); /* ...Fourth! */ + } + + for (fv = length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ + switch (thats[fv]) { + case '\1' ... '\61': + case '\375': + case '\371': + verb = thats[fv]; + break; + case '\62' ... '\225': { + thing2 = thing; + thing = thats[fv]; + } + break; + case '\226' ... '\307': + person = thats[fv]; + break; + case '\373': + polite = true; + break; + } + + if ((unknown != "") && ! + (set::of(vb_exam, vb_talk, vb_save, vb_load, vb_dir, eos).has(verb))) { + display(string("Sorry, but I have no idea what `") + unknown + + "\" means. Can you rephrase it?"); + weirdword = true; + } else weirdword = false; + if (thats == "") thats = nowt; + + if (thing != pardon) it = thing; + if (person != pardon) { + if (person < '\257') him = person; + else her = person; + } } -void examobj() /* Examine a standard object-thing */ -{ - if (thing!=thinks) thinkabout(thing,a_thing); - switch (thing) { - case wine : switch (winestate) { - /* 4 is perfect wine. 0 is not holding the wine. */ - case 1: dixi('t',1); break; /* Normal examine wine scroll */ - case 2: dixi('d',6); break; /* Bad wine */ - case 3: dixi('d',7); break; /* Vinegar */ - } - break; - case onion: if (rotten_onion) - dixi('q',21); /* Yucky onion. */ - else - dixi('t',18); - break; /* Normal onion scroll */ - default: - dixi('t',ord(thing)); /* <<< Ordinarily */ - } +void examobj() { /* Examine a standard object-thing */ + if (thing != thinks) thinkabout(thing, a_thing); + switch (thing) { + case wine : + switch (winestate) { + /* 4 is perfect wine. 0 is not holding the wine. */ + case 1: + dixi('t', 1); + break; /* Normal examine wine scroll */ + case 2: + dixi('d', 6); + break; /* Bad wine */ + case 3: + dixi('d', 7); + break; /* Vinegar */ + } + break; + case onion: + if (rotten_onion) + dixi('q', 21); /* Yucky onion. */ + else + dixi('t', 18); + break; /* Normal onion scroll */ + default: + dixi('t', ord(thing)); /* <<< Ordinarily */ + } } -boolean personshere() /* Person equivalent of "holding" */ -{ - boolean personshere_result; - if ((person==pardon) || (person=='\0') - || (whereis[person]==dna.room)) personshere_result=true; - else { - if (person<'\257') display("H\4"); else display("Sh\4"); - display("e isn't around at the moment."); - personshere_result=false; - } - return personshere_result; +boolean personshere() { /* Person equivalent of "holding" */ + boolean personshere_result; + if ((person == pardon) || (person == '\0') + || (whereis[person] == dna.room)) personshere_result = true; + else { + if (person < '\257') display("H\4"); + else display("Sh\4"); + display("e isn't around at the moment."); + personshere_result = false; + } + return personshere_result; } -void exampers() -{ - if (personshere()) - { - if (thing!=thinks) thinkabout(person,a_person); - person -= 149; - switch (person) { /* Special cases */ - case '\13': if (wonnim) - { - dixi('Q',8); /* "I'm Not Playing!" */ - return; - } - break; - case '\11': if (lustie_is_asleep) - { dixi('Q',65); /* He's asleep. (65! Wow!) */ return; } - break; - } - /* Otherwise... */ dixi('p',ord(person)); - } /* And afterwards... */ - switch (person) { - case '\16': if (~ dna.ayles_is_awake) dixi('Q',13); break; /* u.f.s.? */ - } +void exampers() { + if (personshere()) { + if (thing != thinks) thinkabout(person, a_person); + person -= 149; + switch (person) { /* Special cases */ + case '\13': + if (wonnim) { + dixi('Q', 8); /* "I'm Not Playing!" */ + return; + } + break; + case '\11': + if (lustie_is_asleep) { + dixi('Q', 65); /* He's asleep. (65! Wow!) */ return; + } + break; + } + /* Otherwise... */ dixi('p', ord(person)); + } /* And afterwards... */ + switch (person) { + case '\16': + if (~ dna.ayles_is_awake) dixi('Q', 13); + break; /* u.f.s.? */ + } } -boolean holding() -{ - boolean holding_result; - if (set::of(range('\63','\143'), eos).has(thing)) { holding_result=true; return holding_result; } /* Also */ - holding_result=false; - if (thing>'\144') display("Be reasonable!"); else - if (~ dna.obj[thing]) /* verbs that need "thing" to be in the inventory */ - display("You're not holding it, Avvy."); else - holding_result=true; - return holding_result; +boolean holding() { + boolean holding_result; + if (set::of(range('\63', '\143'), eos).has(thing)) { + holding_result = true; /* Also */ + return holding_result; + } + holding_result = false; + if (thing > '\144') display("Be reasonable!"); + else if (~ dna.obj[thing]) /* verbs that need "thing" to be in the inventory */ + display("You're not holding it, Avvy."); + else + holding_result = true; + return holding_result; } void examine(); -static void special(boolean before) -{ - switch (dna.room) { - case r__yours: switch (thing) { - case '\66': if (before) show_one(5); else show_one(6); break; - } - break; - } +static void special(boolean before) { + switch (dna.room) { + case r__yours: + switch (thing) { + case '\66': + if (before) show_one(5); + else show_one(6); + break; + } + break; + } } -void examine() -{ - /* Examine. EITHER it's an object OR it's an Also OR it's a person OR - it's something else. */ - if ((person==pardon) && (thing!=pardon)) - { - if (holding()) - switch (thing) { /* remember it's been Slipped- ie subtract 49 */ - case '\1' ... '\61' : examobj(); break; /* Standard object */ - case '\62' ... '\144' : { - special(true); - display(also[ord(thing)-50][1]); /* Also thing */ - special(false); - } - break; - } - } else - if (person!=pardon) exampers(); - else display("It's just as it looks on the picture."); /* don't know- guess */ +void examine() { + /* Examine. EITHER it's an object OR it's an Also OR it's a person OR + it's something else. */ + if ((person == pardon) && (thing != pardon)) { + if (holding()) + switch (thing) { /* remember it's been Slipped- ie subtract 49 */ + case '\1' ... '\61' : + examobj(); + break; /* Standard object */ + case '\62' ... '\144' : { + special(true); + display(also[ord(thing) - 50][1]); /* Also thing */ + special(false); + } + break; + } + } else if (person != pardon) exampers(); + else display("It's just as it looks on the picture."); /* don't know- guess */ } -void inv() /* the time-honoured command... */ -{ - char fv; byte q; - - q=0; display(string("You're carrying ")+'\4'); - { - for( fv='\1'; fv <= numobjs; fv ++) - if (obj[fv]) - { - q += 1; if (q==carrying) display(string("and ")+'\4'); - display(get_better(fv)+'\4'); - if (fv==wearing) display(string(", which you're wearing")+'\4'); - if (q0) dixi('q',23); else others(); break; - case r__robins: { - if (dna.tied_up) dixi('q',38); - if (dna.mushroom_growing) dixi('q',55); - } - break; - case r__insidecardiffcastle: if (~ dna.taken_pen) dixi('q',49); break; - case r__lustiesroom: if (dna.lustie_is_asleep) dixi('q',65); break; - case r__catacombs: switch (dna.cat_y*256+dna.cat_x) { - case 258 : dixi('q',80); break; /* Inside art gallery */ - case 514 : dixi('q',81); break; /* Outside ditto */ - case 260 : dixi('q',82); break; /* Outside Geida's room. */ - } - break; - default: others(); - } + display(also[0][1]); + switch (dna.room) { + case r__spludwicks: + if (dna.avaricius_talk > 0) dixi('q', 23); + else others(); + break; + case r__robins: { + if (dna.tied_up) dixi('q', 38); + if (dna.mushroom_growing) dixi('q', 55); + } + break; + case r__insidecardiffcastle: + if (~ dna.taken_pen) dixi('q', 49); + break; + case r__lustiesroom: + if (dna.lustie_is_asleep) dixi('q', 65); + break; + case r__catacombs: + switch (dna.cat_y * 256 + dna.cat_x) { + case 258 : + dixi('q', 80); + break; /* Inside art gallery */ + case 514 : + dixi('q', 81); + break; /* Outside ditto */ + case 260 : + dixi('q', 82); + break; /* Outside Geida's room. */ + } + break; + default: + others(); + } } -void opendoor() /* so whaddya THINK this does?! */ -{ - byte fv; - - switch (dna.room) { /* Special cases. */ - case r__yours: if (infield(2)) - { /* Opening the box. */ - thing='\66'; /* The box. */ person=pardon; - examine(); - return; - } - break; - case r__spludwicks: if (thing=='\75') { - dixi('q',85); - return; - } - break; - } - - - if ((~ dna.user_moves_avvy) & (dna.room!=r__lusties)) - return; /* No doors can open if you can't move Avvy. */ - for( fv=9; fv <= 15; fv ++) - if (infield(fv)) - { - { void& with = portals[fv]; - switch (op) { - case exclaim: { tr[1].bounce; dixi('x',data); } break; - case transport: fliproom(hi(data),lo(data)); break; - case unfinished: { - tr[1].bounce; - display("\7Sorry.\3\rThis place is not available yet!"); - } - break; - case special: call_special(data); break; - case mopendoor: open_the_door(hi(data),lo(data),fv); break; - }} - return; - } - if (dna.room==r__map) - display(string("Avvy, you can complete the whole game without ever going ")+ - "to anywhere other than Argent, Birmingham, Cardiff, "+ - "Nottingham and Norwich."); - else display("Door? What door?"); +void opendoor() { /* so whaddya THINK this does?! */ + byte fv; + + switch (dna.room) { /* Special cases. */ + case r__yours: + if (infield(2)) { + /* Opening the box. */ + thing = '\66'; /* The box. */ person = pardon; + examine(); + return; + } + break; + case r__spludwicks: + if (thing == '\75') { + dixi('q', 85); + return; + } + break; + } + + + if ((~ dna.user_moves_avvy) & (dna.room != r__lusties)) + return; /* No doors can open if you can't move Avvy. */ + for (fv = 9; fv <= 15; fv ++) + if (infield(fv)) { + { + void &with = portals[fv]; + switch (op) { + case exclaim: { + tr[1].bounce; + dixi('x', data); + } + break; + case transport: + fliproom(hi(data), lo(data)); + break; + case unfinished: { + tr[1].bounce; + display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case special: + call_special(data); + break; + case mopendoor: + open_the_door(hi(data), lo(data), fv); + break; + } + } + return; + } + if (dna.room == r__map) + display(string("Avvy, you can complete the whole game without ever going ") + + "to anywhere other than Argent, Birmingham, Cardiff, " + + "Nottingham and Norwich."); + else display("Door? What door?"); } void putproc(); -static void silly() -{ - display("Don't be silly!"); +static void silly() { + display("Don't be silly!"); } -void putproc() /* Called when you call vb_put. */ -{ - char temp; - - - if (! holding()) return; - thing2 -= 49; /* Slip the second object */ - temp=thing; thing=thing2; if (! holding()) return; - thing=temp; - - /* Thing is the thing which you're putting in. Thing2 is where you're - putting it. */ - /* Convenience thing. */ - switch (thing2) { - case wine: if (thing==onion) - { - if (dna.rotten_onion) - display(string("That's a bit like shutting the stable door after the ")+ - "horse has bolted!"); - else { /* Put onion into wine? */ - if (dna.winestate!=3) - display("\6Oignon au vin\22 is a bit too strong for your tastes!"); - else { /* Put onion into vinegar! Yes! */ - onion_in_vinegar=true; - points(7); - dixi('u',9); - } - } - } else silly(); - break; - - case '\66': if (room==1) /* Put something into the box. */ - { - if (box_contents!=nowt) - display(string("There's something in the box already, Avvy. Try taking")+ - " that out first."); - else - switch (thing) { - case money: display("You'd better keep some ready cash on you!"); break; - case bell: display("That's a silly place to keep a bell."); break; - case bodkin: display("But you might need it!"); break; - case onion: display("Just give it to Spludwick, Avvy!"); break; - default: - { /* Put the object into the box... */ - if (wearing==thing) - display(string("You'd better take ")+get_better(thing)+" off first!"); - else - { - show_one(5); /* Open box. */ - box_contents=thing; - dna.obj[thing]=false; - objectlist; - display("OK, it's in the box."); - show_one(6); /* Shut box. */ - } - } - } - } else silly(); - break; - - default: silly(); - } +void putproc() { /* Called when you call vb_put. */ + char temp; + + + if (! holding()) return; + thing2 -= 49; /* Slip the second object */ + temp = thing; + thing = thing2; + if (! holding()) return; + thing = temp; + + /* Thing is the thing which you're putting in. Thing2 is where you're + putting it. */ + /* Convenience thing. */ + switch (thing2) { + case wine: + if (thing == onion) { + if (dna.rotten_onion) + display(string("That's a bit like shutting the stable door after the ") + + "horse has bolted!"); + else { /* Put onion into wine? */ + if (dna.winestate != 3) + display("\6Oignon au vin\22 is a bit too strong for your tastes!"); + else { /* Put onion into vinegar! Yes! */ + onion_in_vinegar = true; + points(7); + dixi('u', 9); + } + } + } else silly(); + break; + + case '\66': + if (room == 1) { /* Put something into the box. */ + if (box_contents != nowt) + display(string("There's something in the box already, Avvy. Try taking") + + " that out first."); + else + switch (thing) { + case money: + display("You'd better keep some ready cash on you!"); + break; + case bell: + display("That's a silly place to keep a bell."); + break; + case bodkin: + display("But you might need it!"); + break; + case onion: + display("Just give it to Spludwick, Avvy!"); + break; + default: { + /* Put the object into the box... */ + if (wearing == thing) + display(string("You'd better take ") + get_better(thing) + " off first!"); + else { + show_one(5); /* Open box. */ + box_contents = thing; + dna.obj[thing] = false; + objectlist; + display("OK, it's in the box."); + show_one(6); /* Shut box. */ + } + } + } + } else silly(); + break; + + default: + silly(); + } } boolean give2spludwick(); - /* The result of this fn is whether or not he says "Hey, thanks!" */ -static void not_in_order() -{ - display(string("Sorry, I need the ingredients in the right order for this potion.")+ - " What I need next is "+ - get_better(spludwick_order[dna.given2spludwick])+".\232\2"); +/* The result of this fn is whether or not he says "Hey, thanks!" */ +static void not_in_order() { + display(string("Sorry, I need the ingredients in the right order for this potion.") + + " What I need next is " + + get_better(spludwick_order[dna.given2spludwick]) + ".\232\2"); } -static void go_to_cauldron() -{ - tr[2].call_eachstep=false; /* Stops Geida_Procs. */ - set_up_timer(1,procspludwick_goes_to_cauldron,reason_spludwalk); - tr[2].walkto(2); +static void go_to_cauldron() { + tr[2].call_eachstep = false; /* Stops Geida_Procs. */ + set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + tr[2].walkto(2); } boolean give2spludwick() { - boolean give2spludwick_result; - { - - give2spludwick_result=false; - - if (spludwick_order[given2spludwick]!=thing) - { - not_in_order(); - return give2spludwick_result; - } - - switch (thing) { - case onion: - { - obj[onion]=false; - if (rotten_onion) - dixi('q',22); - else { - given2spludwick += 1; - dixi('q',20); - go_to_cauldron(); - points(3); - } - objectlist; - } - break; - case ink: { - obj[ink]=false; - objectlist; - given2spludwick += 1; - dixi('q',24); - go_to_cauldron(); - points(3); - } - break; - case mushroom: { - obj[mushroom]=false; - dixi('q',25); - points(5); - given2spludwick += 1; - go_to_cauldron(); - obj[potion]=true; - objectlist; - } - break; - default: give2spludwick_result=true; - } - } - return give2spludwick_result; + boolean give2spludwick_result; + { + + give2spludwick_result = false; + + if (spludwick_order[given2spludwick] != thing) { + not_in_order(); + return give2spludwick_result; + } + + switch (thing) { + case onion: { + obj[onion] = false; + if (rotten_onion) + dixi('q', 22); + else { + given2spludwick += 1; + dixi('q', 20); + go_to_cauldron(); + points(3); + } + objectlist; + } + break; + case ink: { + obj[ink] = false; + objectlist; + given2spludwick += 1; + dixi('q', 24); + go_to_cauldron(); + points(3); + } + break; + case mushroom: { + obj[mushroom] = false; + dixi('q', 25); + points(5); + given2spludwick += 1; + go_to_cauldron(); + obj[potion] = true; + objectlist; + } + break; + default: + give2spludwick_result = true; + } + } + return give2spludwick_result; } -void have_a_drink() -{ - { - alcohol += 1; - if (alcohol==5) - { - obj[key]=true; /* Get the key. */ - teetotal=true; - avvy_is_awake=false; - avvy_in_bed=true; - objectlist; - dusk; - hang_around_for_a_while; - fliproom(1,1); - background(14); - new_game_for_trippancy; /* Not really */ - } - } +void have_a_drink() { + { + alcohol += 1; + if (alcohol == 5) { + obj[key] = true; /* Get the key. */ + teetotal = true; + avvy_is_awake = false; + avvy_in_bed = true; + objectlist; + dusk; + hang_around_for_a_while; + fliproom(1, 1); + background(14); + new_game_for_trippancy; /* Not really */ + } + } } -void cardiff_climbing() -{ - if (dna.standing_on_dais) - { /* Clamber up. */ - display("You climb down, back onto the floor."); - dna.standing_on_dais=false; - apped(1,3); - } else - { /* Clamber down. */ - if (infield(1)) - { - display("You clamber up onto the dais."); - dna.standing_on_dais=true; - apped(1,2); - } else - display("Get a bit closer, Avvy."); - } +void cardiff_climbing() { + if (dna.standing_on_dais) { + /* Clamber up. */ + display("You climb down, back onto the floor."); + dna.standing_on_dais = false; + apped(1, 3); + } else { + /* Clamber down. */ + if (infield(1)) { + display("You clamber up onto the dais."); + dna.standing_on_dais = true; + apped(1, 2); + } else + display("Get a bit closer, Avvy."); + } } void stand_up(); - /* Called when you ask Avvy to stand. */ -static void already() -{ - display("You're already standing!"); +/* Called when you ask Avvy to stand. */ +static void already() { + display("You're already standing!"); } -void stand_up() -{ - switch (dna.room) { - case r__yours: /* Avvy isn't asleep. */ - if (avvy_in_bed) /* But he's in bed. */ - { - if (teetotal) - { - dixi('d',12); - background(0); - dixi('d',14); - } - tr[1].visible=true; - user_moves_avvy=true; - apped(1,2); - dna.rw=left; - show_one(4); /* Picture of empty pillow. */ - points(1); - avvy_in_bed=false; - lose_timer(reason_arkata_shouts); - } else already(); - break; - - case r__insidecardiffcastle: cardiff_climbing(); break; - - case r__nottspub: if (sitting_in_pub) { - show_one(4); /* Not sitting down. */ - tr[1].visible=true; /* But standing up. */ - apped(1,4); /* And walking away. */ - sitting_in_pub=false; /* Really not sitting down. */ - user_moves_avvy=true; /* And ambulant. */ - } else already(); - break; - default: already(); - } +void stand_up() { + switch (dna.room) { + case r__yours: /* Avvy isn't asleep. */ + if (avvy_in_bed) { /* But he's in bed. */ + if (teetotal) { + dixi('d', 12); + background(0); + dixi('d', 14); + } + tr[1].visible = true; + user_moves_avvy = true; + apped(1, 2); + dna.rw = left; + show_one(4); /* Picture of empty pillow. */ + points(1); + avvy_in_bed = false; + lose_timer(reason_arkata_shouts); + } else already(); + break; + + case r__insidecardiffcastle: + cardiff_climbing(); + break; + + case r__nottspub: + if (sitting_in_pub) { + show_one(4); /* Not sitting down. */ + tr[1].visible = true; /* But standing up. */ + apped(1, 4); /* And walking away. */ + sitting_in_pub = false; /* Really not sitting down. */ + user_moves_avvy = true; /* And ambulant. */ + } else already(); + break; + default: + already(); + } } -void getproc(char thing) -{ - switch (room) { - case r__yours: - if (infield(2)) - { - if (box_contents==thing) - { - show_one(5); - display("OK, I've got it."); - obj[thing]=true; objectlist; - box_contents=nowt; - show_one(6); - } else - display(string("I can't see ")+get_better(thing)+" in the box."); - } else dixi('q',57); - break; - case r__insidecardiffcastle: - switch (thing) { - case pen: - { - if (infield(2)) - { /* Standing on the dais. */ - - if (dna.taken_pen) - display("It's not there, Avvy."); - else - { /* OK: we're taking the pen, and it's there. */ - show_one(4); /* No pen there now. */ - call_special(3); /* Zap! */ - dna.taken_pen=true; - dna.obj[pen]=true; - objectlist; - display("Taken."); - } - } else if (dna.standing_on_dais) dixi('q',53); else dixi('q',51); - } - break; - case bolt: dixi('q',52); break; - default: dixi('q',57); - } - break; - case r__robins: if ((thing==mushroom) & (infield(1)) & (dna.mushroom_growing)) - { - show_one(3); - display("Got it!"); - dna.mushroom_growing=false; - dna.taken_mushroom=true; - dna.obj[mushroom]=true; - objectlist; - points(3); - } else dixi('q',57); - break; - default: dixi('q',57); - } +void getproc(char thing) { + switch (room) { + case r__yours: + if (infield(2)) { + if (box_contents == thing) { + show_one(5); + display("OK, I've got it."); + obj[thing] = true; + objectlist; + box_contents = nowt; + show_one(6); + } else + display(string("I can't see ") + get_better(thing) + " in the box."); + } else dixi('q', 57); + break; + case r__insidecardiffcastle: + switch (thing) { + case pen: { + if (infield(2)) { + /* Standing on the dais. */ + + if (dna.taken_pen) + display("It's not there, Avvy."); + else { + /* OK: we're taking the pen, and it's there. */ + show_one(4); /* No pen there now. */ + call_special(3); /* Zap! */ + dna.taken_pen = true; + dna.obj[pen] = true; + objectlist; + display("Taken."); + } + } else if (dna.standing_on_dais) dixi('q', 53); + else dixi('q', 51); + } + break; + case bolt: + dixi('q', 52); + break; + default: + dixi('q', 57); + } + break; + case r__robins: + if ((thing == mushroom) & (infield(1)) & (dna.mushroom_growing)) { + show_one(3); + display("Got it!"); + dna.mushroom_growing = false; + dna.taken_mushroom = true; + dna.obj[mushroom] = true; + objectlist; + points(3); + } else dixi('q', 57); + break; + default: + dixi('q', 57); + } } -void give_geida_the_lute() -{ - { - if (room!=r__lustiesroom) - { - display("Not yet. Try later!\232\2"); - return; - } - dna.obj[lute]=false; - objectlist; - dixi('q',64); /* She plays it. */ - - /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ - - set_up_timer(1,procgive_lute_to_geida,reason_geida_sings); - back_to_bootstrap(4); - } +void give_geida_the_lute() { + { + if (room != r__lustiesroom) { + display("Not yet. Try later!\232\2"); + return; + } + dna.obj[lute] = false; + objectlist; + dixi('q', 64); /* She plays it. */ + + /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ + + set_up_timer(1, procgive_lute_to_geida, reason_geida_sings); + back_to_bootstrap(4); + } } -void play_harp() -{ - if (infield(7)) - musical_scroll; - else display("Get a bit closer to it, Avvy!"); +void play_harp() { + if (infield(7)) + musical_scroll; + else display("Get a bit closer to it, Avvy!"); } -void winsequence() -{ - dixi('q',78); - first_show(7); then_show(8); then_show(9); - start_to_close; - set_up_timer(30,procwinning,reason_winning); +void winsequence() { + dixi('q', 78); + first_show(7); + then_show(8); + then_show(9); + start_to_close; + set_up_timer(30, procwinning, reason_winning); } -void person_speaks() -{ - boolean found; byte fv; char cfv; - - - if ((person==pardon) || (person=='\0')) - { - if ((him==pardon) || (whereis[him]!=dna.room)) person=her; - else person=him; - } - - if (whereis[person]!=dna.room) - { - display("\231\4"); /* Avvy himself! */ - return; - } - - found=false; /* The person we're looking for's code is in Person. */ - - for( fv=1; fv <= numtr; fv ++) - if (tr[fv].quick & (chr(tr[fv].a.accinum+149)==person)) - { - display(string('\23')+chr(fv+48)+'\4'); - found=true; - } - - if (! found) - for( fv=10; fv <= 25; fv ++) - { void& with = quasipeds[fv]; - if ((who==person) && (room==dna.room)) - { - display(string('\23')+chr(fv+55)+'\4'); - }} +void person_speaks() { + boolean found; + byte fv; + char cfv; + + + if ((person == pardon) || (person == '\0')) { + if ((him == pardon) || (whereis[him] != dna.room)) person = her; + else person = him; + } + + if (whereis[person] != dna.room) { + display("\231\4"); /* Avvy himself! */ + return; + } + + found = false; /* The person we're looking for's code is in Person. */ + + for (fv = 1; fv <= numtr; fv ++) + if (tr[fv].quick & (chr(tr[fv].a.accinum + 149) == person)) { + display(string('\23') + chr(fv + 48) + '\4'); + found = true; + } + + if (! found) + for (fv = 10; fv <= 25; fv ++) { + void &with = quasipeds[fv]; + if ((who == person) && (room == dna.room)) { + display(string('\23') + chr(fv + 55) + '\4'); + } + } } void do_that(); -static void heythanks() -{ - person_speaks(); - display("Hey, thanks!\2(But now, you've lost it!)"); - dna.obj[thing]=false; +static void heythanks() { + person_speaks(); + display("Hey, thanks!\2(But now, you've lost it!)"); + dna.obj[thing] = false; } -void do_that() -{ - const array<'\63','\72',varying_string<6> > booze = {{"Bitter","GIED","Whisky","Cider","","","","Mead"}}; - byte fv,ff; integer sx,sy; boolean ok; - - - if (thats==nowt) { thats=""; return; } - if (weirdword) return; - if (thing<'\310') thing -= 49; /* "Slip" */ - - if ((~ alive) & - ! (set::of(vb_load,vb_save,vb_quit,vb_info,vb_help,vb_larrypass, - vb_phaon,vb_boss,vb_cheat,vb_restart,vb_dir,vb_score, - vb_highscores,vb_smartalec, eos).has(verb))) - { - display(string("You're dead, so don't talk. What are you, a ghost ")+ - "or something? Try restarting, or restoring a saved game!"); return; - } - - if ((~ dna.avvy_is_awake) & - ! (set::of(vb_load,vb_save,vb_quit,vb_info,vb_help,vb_larrypass, - vb_phaon,vb_boss,vb_cheat,vb_restart,vb_dir,vb_die,vb_score, - vb_highscores,vb_smartalec,vb_expletive,vb_wake, eos).has(verb))) - { - display("Talking in your sleep? Try waking up!"); return; - } - - - switch (verb) { - case vb_exam: examine(); break; - case vb_open: opendoor(); break; - case vb_pause: display(string("Game paused.")+'\3'+'\15'+'\15'+"Press Enter, Esc, or click "+ - "the mouse on the `O.K.\" box to continue."); - break; - case vb_get: { - if (thing!=pardon) - { /* Legitimate try to pick something up. */ - if (dna.carrying>=maxobjs) display("You can't carry any more!"); - else getproc(thing); - - } else - { /* Not... ditto. */ - if (person!=pardon) - display("You can't sweep folk off their feet!"); else - display("I assure you, you don't need it."); - } - } - break; - case vb_drop: display(string("Two years ago you dropped a florin in the street. Three days ")+ - "later it was gone! So now you never leave ANYTHING lying around. OK?"); - break; -/* begin dna.obj[thing]:=false; objectlist; end;*/ - case vb_inv: inv(); break; - case vb_talk: if (person==pardon) - { - if (subjnumber==99) /* They typed "say password". */ - display("Yes, but what \6is\22 the password?"); - else if (set::of(range(1,49),253,249, eos).has(subjnumber)) - { - Delete(thats,1,1); - move(realwords[2],realwords[1],sizeof(realwords)-sizeof(realwords[1])); - verb=chr(subjnumber); - do_that(); return; - } else - { - person=chr(subjnumber); subjnumber=0; - if (set::of(pardon,'\0', eos).has(person)) display("Talk to whom?"); - else if (personshere()) talkto(ord(person)); - } - } else if (person==pardon) display("Talk to whom?"); - else if (personshere()) talkto(ord(person)); - break; - - case vb_give: if (holding()) - { - if (person==pardon) display("Give to whom?"); else - if (personshere()) - { - switch (thing) { - case money : display("You can't bring yourself to give away your moneybag."); break; - case bodkin:case bell:case clothes:case habit : - display("Don't give it away, it might be useful!"); - break; - default: switch (person) { - case pcrapulus: switch (thing) { - case wine: { - display("Crapulus grabs the wine and gulps it down."); - dna.obj[wine]=false; - } - break; - default: heythanks(); - } - break; - case pcwytalot: if (set::of(crossbow,bolt, eos).has(thing)) - display(string("You might be able to influence ")+ - "Cwytalot more if you used it!"); - else heythanks(); - break; - case pspludwick: if (give2spludwick()) heythanks(); break; - case pibythneth: if (thing==badge) - { - dixi('q',32); /* Thanks! Wow! */ - points(3); - dna.obj[badge]=false; - dna.obj[habit]=true; - dna.givenbadgetoiby=true; - show_one(8); show_one(9); - } else heythanks(); - break; - case payles: if (dna.ayles_is_awake) - { - if (thing==pen) - { - dna.obj[pen]=false; - dixi('q',54); - dna.obj[ink]=true; - dna.given_pen_to_ayles=true; - objectlist; - points(2); - } else heythanks(); - } else - display("But he's asleep!"); - break; - case pgeida: switch (thing) { - case potion : { - dna.obj[potion]=false; - dixi('u',16); /* She drinks it. */ - points(2); - dna.geida_given_potion=true; - objectlist; - } - break; - case lute: give_geida_the_lute(); break; - default: heythanks(); - } - break; - case parkata: switch (thing) { - case potion: if (dna.geida_given_potion) - winsequence(); - else dixi('q',77); - break; /* That Geida woman! */ - default: heythanks(); - } - break; - default: heythanks(); - } - } - } - objectlist; /* Just in case... */ - } - break; - - case vb_eat:case vb_drink: if (holding()) swallow(); break; - case vb_load: edna_load(realwords[2]); break; - case vb_save: if (alive) edna_save(realwords[2]); - else display("It's a bit late now to save your game!"); - break; - case vb_pay: display("No money need change hands."); break; - case vb_look: lookaround(); break; - case vb_break: display("Vandalism is prohibited within this game!"); break; - case vb_quit: { /* quit */ - if (demo) - { - dixi('q',31); - close(demofile); - exit(0); /* Change this later!!! */ - } - if (! polite) display("How about a `please\", Avvy?"); else - if (ask("\23C\26Do you really want to quit?")) lmo=true; - } - break; - case vb_go: display("Just use the arrow keys to walk there."); break; - case vb_info: { - aboutscroll=true; -/* display('Thorsoft of Letchworth presents:'+^c+^m+^m+ - 'The medival descendant of'+^m+ - 'Denarius Avaricius Sextus'+^m+'in:'+ - ^m+^m+'LORD AVALOT D''ARGENT'+ - ^m+'version '+vernum+^m+^m+'Copyright ' - +copyright+', Mark, Mike and Thomas Thurman.');*/ - display(string("\r\r\r\r\r\r\r")+"LORD AVALOT D'ARGENT"+"\3\r"+ - "The medival descendant of"+'\15'+ - "Denarius Avaricius Sextus"+ - '\15'+'\15'+"version "+vernum+'\15'+'\15'+"Copyright " - +copyright+", Mark, Mike and Thomas Thurman."+'\23'+'Y'+'\26'); - aboutscroll=false; - } - break; - case vb_undress: if (dna.wearing==nowt) display("You're already stark naked!"); - else - if (dna.avvys_in_the_cupboard) - { - display(string("You take off ")+get_better(dna.wearing)+'.'); - dna.wearing=nowt; objectlist; - } else - display("Hadn't you better find somewhere more private, Avvy?"); - break; - case vb_wear: if (holding()) - { /* wear something */ - switch (thing) { - case chastity: display("Hey, what kind of a weirdo are you\??!"); break; - case clothes:case habit: { /* Change this! */ - if (dna.wearing!=nowt) - { - if (dna.wearing==thing) - display("You're already wearing that."); - else - display(string("You'll be rather warm wearing two ")+ - "sets of clothes!"); - return; - } else - dna.wearing=thing; objectlist; - if (thing==habit) fv=3; else fv=0; - { void& with = tr[1]; - if (whichsprite!=fv) - { - sx=tr[1].x; sy=tr[1].y; - done; - init(fv,true); - appear(sx,sy,left); - tr[1].visible=false; - }} - } - break; - default: display(what); - } - } - break; - case vb_play: if (thing==pardon) - switch (dna.room) { /* They just typed "play"... */ - case r__argentpub: play_nim; break; /* ...in the pub, => play Nim. */ - case r__musicroom: play_harp(); break; - } - else if (holding()) - { - switch (thing) { - case lute : { - dixi('U',7); - if (whereis[pcwytalot]==dna.room) dixi('U',10); - if (whereis[pdulustie]==dna.room) dixi('U',15); - } - break; - case '\64' : if (dna.room==r__musicroom) play_harp(); - else display(what); - break; - case '\67' : if (dna.room==r__argentpub) play_nim; - else display(what); - break; - default: display(what); - } - } - break; - case vb_ring: if (holding()) - { - if (thing==bell) - { - display("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((dna.ringing_bells) & (flagset('B'))) - display("(Are you trying to join in, Avvy\?\?!)"); - } else display(what); - } - break; - case vb_help: boot_help; break; - case vb_larrypass: display("Wrong game!"); break; - case vb_phaon: display("Hello, Phaon!"); break; - case vb_boss: bosskey; break; - case vb_pee: if (flagset('P')) - { - display("Hmm, I don't think anyone will notice..."); - set_up_timer(4,procurinate,reason_gototoilet); - } else display("It would be \6VERY\22 unwise to do that here, Avvy!"); - break; - case vb_cheat: { - display(string('\6')+"Cheat mode now enabled."); - cheat=true; - } - break; - case vb_magic: if (dna.avaricius_talk>0) - dixi('q',19); - else { - if ((dna.room==12) & (infield(2))) - { /* Avaricius appears! */ - dixi('q',17); - if (whereis['\227']==12) - dixi('q',18); - else - { - tr[2].init(1,false); /* Avaricius */ - apped(2,4); - tr[2].walkto(5); - tr[2].call_eachstep=true; - tr[2].eachstep=procback_and_forth; - dna.avaricius_talk=14; - set_up_timer(177,procavaricius_talks,reason_avariciustalks); - } - } else display("Nothing appears to happen..."); - } - break; - case vb_smartalec: display("Listen, smart alec, that was just rhetoric."); break; - case vb_expletive: { - switch (swore) { - case 0: display(string("Avvy! Do you mind? There might be kids playing!\r\r")+ - "(I shouldn't say it again, if I were you!)"); - break; - case 1: display(string("You hear a distant rumble of thunder. Must you always ")+ - "do things I tell you not to?\r\rDon't do it again!"); - break; - default: - { - zonk; - display(string("A crack of lightning shoots from the sky, ")+ - "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); - gameover; - } - } - swore += 1; - } - break; - case vb_listen: if ((dna.ringing_bells) & (flagset('B'))) - display(string("All other noise is drowned out by the ringing of ")+ - "the bells."); - else - if (listen=="") - display("You can't hear anything much at the moment, Avvy."); - else display(listen); - break; - case vb_buy: { - /* What are they trying to buy? */ - switch (dna.room) { - case r__argentpub: if (infield(6)) - { /* We're in a pub, and near the bar. */ - switch (thing) { - case '\63':case '\65':case '\66':case '\72': { /* Beer, whisky, cider or mead */ - if (dna.malagauche==177) /* Already getting us one. */ - { dixi('D',15); return; } - if (dna.teetotal) { dixi('D',6); return; } - if (dna.alcohol==0) points(3); - show_one(12); - display(booze[thing]+", please.\231\2"); - dna.drinking=thing; - - show_one(10); - dna.malagauche=177; - set_up_timer(27,procbuydrinks,reason_drinks); - } - break; - case '\64': examine(); break; /* We have a right one here- buy Pepsi??! */ - case wine: if (dna.obj[wine]) /* We've already got the wine! */ - dixi('D',2); /* 1 bottle's shufishent! */ - else { - if (dna.malagauche==177) /* Already getting us one. */ - { dixi('D',15); return; } - if (dna.carrying>=maxobjs) - { display("Your hands are full."); return; } - show_one(12); display("Wine, please.\231\2"); - if (dna.alcohol==0) points(3); - show_one(10); - dna.malagauche=177; - - set_up_timer(27,procbuywine,reason_drinks); - } - break; - } - } else dixi('D',5); - break; /* Go to the bar! */ - - case r__outsideducks: if (infield(6)) - { - if (thing==onion) - { - if (dna.obj[onion]) - dixi('D',10); /* not planning to juggle with the things! */ - else - if (dna.carrying>=maxobjs) - display("Before you ask, you remember that your hands are full."); - else - { - if (dna.bought_onion) - dixi('D',11); else - { dixi('D',9); points(3); } - pennycheck(3); /* It costs thruppence. */ - dna.obj[onion]=true; - objectlist; - dna.bought_onion=true; - dna.rotten_onion=false; /* It's OK when it leaves the stall! */ - dna.onion_in_vinegar=false; - } - } else dixi('D',0); - } else dixi('D',0); - break; - - case r__nottspub: dixi('n',15); break; /* Can't sell to southerners. */ - default: dixi('D',0); /* Can't buy that. */ - } - } - break; - case vb_attack: { - if ((dna.room==r__brummieroad) && - ((person=='\235') || (thing==crossbow) || (thing==bolt)) - && (whereis['\235']==dna.room)) - { - switch (ord(dna.obj[bolt])+ord(dna.obj[crossbow])*2) { - /* 0 = neither, 1 = only bolt, 2 = only crossbow, - 3 = both. */ - case 0: { - dixi('Q',10); - display("(At the very least, don't use your bare hands!)"); - } - break; - case 1: display(string("Attack him with only a crossbow bolt? Are you ")+ - "planning on playing darts?!"); - break; - case 2: display(string("Come on, Avvy! You're not going to get very far ")+ - "with only a crossbow!"); - break; - case 3: { - dixi('Q',11); - dna.cwytalot_gone=true; - dna.obj[bolt]=false; dna.obj[crossbow]=false; - objectlist; - magics[12].op=nix; - points(7); - tr[2].walkto(2); - tr[2].vanishifstill=true; - tr[2].call_eachstep=false; - whereis['\235']=177; - } - break; - default: dixi('Q',10); /* Please try not to be so violent! */ - } - } else dixi('Q',10); - } - break; - case vb_password: if (dna.room!=r__bridge) - dixi('Q',12); else - { - ok=true; - for( ff=1; ff <= length(thats); ff ++) - for( fv=1; fv <= length(words[dna.pass_num+first_password].w); fv ++) - if (words[dna.pass_num+first_password].w[fv] != - upcase(realwords[ff][fv])) - ok=false; - if (ok) - { - if (dna.drawbridge_open!=0) - display("Contrary to your expectations, the drawbridge fails to close again."); - else - { - points(4); - display("The drawbridge opens!"); - set_up_timer(7,procopen_drawbridge,reason_drawbridgefalls); - dna.drawbridge_open=1; - } - } else dixi('Q',12); - } - break; - case vb_dir: dir(realwords[2]); break; - case vb_die: gameover; break; - case vb_score: display(string("Your score is ")+strf(dna.score)+",\3\rout of a "+ - "possible 128.\r\rThis gives you a rank of "+rank()+ - ".\r\r"+totaltime()); - break; - case vb_put: putproc(); break; - case vb_stand: stand_up(); break; - - case vb_kiss: if (person==pardon) - display("Kiss whom?"); - else if (personshere()) - switch (person) { - case '\226' ... '\256': display("Hey, what kind of a weirdo are you??"); break; - case parkata: dixi('U',12); break; - case pgeida: dixi('U',13); break; - case pwisewoman: dixi('U',14); break; - default: dixi('U',5); /* You WHAT? */ - } - break; - - case vb_climb: if (dna.room==r__insidecardiffcastle) cardiff_climbing(); - else /* In the wrong room! */ - display("Not with your head for heights, Avvy!"); - break; - - case vb_jump: { - set_up_timer(1,procjump,reason_jumping); - dna.user_moves_avvy=false; - } - break; - - case vb_highscores: show_highs; break; - - case vb_wake: if (personshere()) - switch (person) { - case pardon:case pavalot:case '\0': if (~ avvy_is_awake) - { - avvy_is_awake=true; - points(1); - avvy_in_bed=true; - show_one(3); /* Picture of Avvy, awake in bed. */ - if (teetotal) dixi('d',13); - } else display("You're already awake, Avvy!"); - break; - case payles: if (~ ayles_is_awake) display("You can't seem to wake him by yourself."); break; - case pjacques: display(string("Brother Jacques, Brother Jacques, are you asleep?\231\2")+ - "Hmmm... that doesn't seem to do any good..."); - break; - default: display("It's difficult to awaken people who aren't asleep...!"); - } - break; - - case vb_sit: if (dna.room==r__nottspub) - { - if (dna.sitting_in_pub) - display("You're already sitting!"); - else - { - tr[1].walkto(4); /* Move Avvy to the place, and sit him down. */ - set_up_timer(1,procavvy_sit_down,reason_sitting_down); - } - } else - { /* Default doodah. */ - dusk; - hang_around_for_a_while; - dawn; - display("A few hours later...\20nothing much has happened..."); - } - break; - - case vb_restart: if (ask("Restart game and lose changes?")) { - dusk; - newgame; - dawn; - } - break; - - case pardon: display("Hey, a verb would be helpful!"); break; - - case vb_hello: { person_speaks(); display("Hello.\2"); } break; - case vb_thanks: { person_speaks(); display("That's OK.\2"); } break; - default: display(string('\7')+"Parser bug!"); - } +void do_that() { + const array < '\63', '\72', varying_string<6> > booze = {{"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}}; + byte fv, ff; + integer sx, sy; + boolean ok; + + + if (thats == nowt) { + thats = ""; + return; + } + if (weirdword) return; + if (thing < '\310') thing -= 49; /* "Slip" */ + + if ((~ alive) & + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, + vb_highscores, vb_smartalec, eos).has(verb))) { + display(string("You're dead, so don't talk. What are you, a ghost ") + + "or something? Try restarting, or restoring a saved game!"); + return; + } + + if ((~ dna.avvy_is_awake) & + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, + vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { + display("Talking in your sleep? Try waking up!"); + return; + } + + + switch (verb) { + case vb_exam: + examine(); + break; + case vb_open: + opendoor(); + break; + case vb_pause: + display(string("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + + "the mouse on the `O.K.\" box to continue."); + break; + case vb_get: { + if (thing != pardon) { + /* Legitimate try to pick something up. */ + if (dna.carrying >= maxobjs) display("You can't carry any more!"); + else getproc(thing); + + } else { + /* Not... ditto. */ + if (person != pardon) + display("You can't sweep folk off their feet!"); + else + display("I assure you, you don't need it."); + } + } + break; + case vb_drop: + display(string("Two years ago you dropped a florin in the street. Three days ") + + "later it was gone! So now you never leave ANYTHING lying around. OK?"); + break; + /* begin dna.obj[thing]:=false; objectlist; end;*/ + case vb_inv: + inv(); + break; + case vb_talk: + if (person == pardon) { + if (subjnumber == 99) /* They typed "say password". */ + display("Yes, but what \6is\22 the password?"); + else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { + Delete(thats, 1, 1); + move(realwords[2], realwords[1], sizeof(realwords) - sizeof(realwords[1])); + verb = chr(subjnumber); + do_that(); + return; + } else { + person = chr(subjnumber); + subjnumber = 0; + if (set::of(pardon, '\0', eos).has(person)) display("Talk to whom?"); + else if (personshere()) talkto(ord(person)); + } + } else if (person == pardon) display("Talk to whom?"); + else if (personshere()) talkto(ord(person)); + break; + + case vb_give: + if (holding()) { + if (person == pardon) display("Give to whom?"); + else if (personshere()) { + switch (thing) { + case money : + display("You can't bring yourself to give away your moneybag."); + break; + case bodkin: + case bell: + case clothes: + case habit : + display("Don't give it away, it might be useful!"); + break; + default: + switch (person) { + case pcrapulus: + switch (thing) { + case wine: { + display("Crapulus grabs the wine and gulps it down."); + dna.obj[wine] = false; + } + break; + default: + heythanks(); + } + break; + case pcwytalot: + if (set::of(crossbow, bolt, eos).has(thing)) + display(string("You might be able to influence ") + + "Cwytalot more if you used it!"); + else heythanks(); + break; + case pspludwick: + if (give2spludwick()) heythanks(); + break; + case pibythneth: + if (thing == badge) { + dixi('q', 32); /* Thanks! Wow! */ + points(3); + dna.obj[badge] = false; + dna.obj[habit] = true; + dna.givenbadgetoiby = true; + show_one(8); + show_one(9); + } else heythanks(); + break; + case payles: + if (dna.ayles_is_awake) { + if (thing == pen) { + dna.obj[pen] = false; + dixi('q', 54); + dna.obj[ink] = true; + dna.given_pen_to_ayles = true; + objectlist; + points(2); + } else heythanks(); + } else + display("But he's asleep!"); + break; + case pgeida: + switch (thing) { + case potion : { + dna.obj[potion] = false; + dixi('u', 16); /* She drinks it. */ + points(2); + dna.geida_given_potion = true; + objectlist; + } + break; + case lute: + give_geida_the_lute(); + break; + default: + heythanks(); + } + break; + case parkata: + switch (thing) { + case potion: + if (dna.geida_given_potion) + winsequence(); + else dixi('q', 77); + break; /* That Geida woman! */ + default: + heythanks(); + } + break; + default: + heythanks(); + } + } + } + objectlist; /* Just in case... */ + } + break; + + case vb_eat: + case vb_drink: + if (holding()) swallow(); + break; + case vb_load: + edna_load(realwords[2]); + break; + case vb_save: + if (alive) edna_save(realwords[2]); + else display("It's a bit late now to save your game!"); + break; + case vb_pay: + display("No money need change hands."); + break; + case vb_look: + lookaround(); + break; + case vb_break: + display("Vandalism is prohibited within this game!"); + break; + case vb_quit: { /* quit */ + if (demo) { + dixi('q', 31); + close(demofile); + exit(0); /* Change this later!!! */ + } + if (! polite) display("How about a `please\", Avvy?"); + else if (ask("\23C\26Do you really want to quit?")) lmo = true; + } + break; + case vb_go: + display("Just use the arrow keys to walk there."); + break; + case vb_info: { + aboutscroll = true; + /* display('Thorsoft of Letchworth presents:'+^c+^m+^m+ + 'The medival descendant of'+^m+ + 'Denarius Avaricius Sextus'+^m+'in:'+ + ^m+^m+'LORD AVALOT D''ARGENT'+ + ^m+'version '+vernum+^m+^m+'Copyright ' + +copyright+', Mark, Mike and Thomas Thurman.');*/ + display(string("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + + "The medival descendant of" + '\15' + + "Denarius Avaricius Sextus" + + '\15' + '\15' + "version " + vernum + '\15' + '\15' + "Copyright " + + copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); + aboutscroll = false; + } + break; + case vb_undress: + if (dna.wearing == nowt) display("You're already stark naked!"); + else if (dna.avvys_in_the_cupboard) { + display(string("You take off ") + get_better(dna.wearing) + '.'); + dna.wearing = nowt; + objectlist; + } else + display("Hadn't you better find somewhere more private, Avvy?"); + break; + case vb_wear: + if (holding()) { + /* wear something */ + switch (thing) { + case chastity: + display("Hey, what kind of a weirdo are you\??!"); + break; + case clothes: + case habit: { /* Change this! */ + if (dna.wearing != nowt) { + if (dna.wearing == thing) + display("You're already wearing that."); + else + display(string("You'll be rather warm wearing two ") + + "sets of clothes!"); + return; + } else + dna.wearing = thing; + objectlist; + if (thing == habit) fv = 3; + else fv = 0; + { + void &with = tr[1]; + if (whichsprite != fv) { + sx = tr[1].x; + sy = tr[1].y; + done; + init(fv, true); + appear(sx, sy, left); + tr[1].visible = false; + } + } + } + break; + default: + display(what); + } + } + break; + case vb_play: + if (thing == pardon) + switch (dna.room) { /* They just typed "play"... */ + case r__argentpub: + play_nim; + break; /* ...in the pub, => play Nim. */ + case r__musicroom: + play_harp(); + break; + } + else if (holding()) { + switch (thing) { + case lute : { + dixi('U', 7); + if (whereis[pcwytalot] == dna.room) dixi('U', 10); + if (whereis[pdulustie] == dna.room) dixi('U', 15); + } + break; + case '\64' : + if (dna.room == r__musicroom) play_harp(); + else display(what); + break; + case '\67' : + if (dna.room == r__argentpub) play_nim; + else display(what); + break; + default: + display(what); + } + } + break; + case vb_ring: + if (holding()) { + if (thing == bell) { + display("Ding, dong, ding, dong, ding, dong, ding, dong..."); + if ((dna.ringing_bells) & (flagset('B'))) + display("(Are you trying to join in, Avvy\?\?!)"); + } else display(what); + } + break; + case vb_help: + boot_help; + break; + case vb_larrypass: + display("Wrong game!"); + break; + case vb_phaon: + display("Hello, Phaon!"); + break; + case vb_boss: + bosskey; + break; + case vb_pee: + if (flagset('P')) { + display("Hmm, I don't think anyone will notice..."); + set_up_timer(4, procurinate, reason_gototoilet); + } else display("It would be \6VERY\22 unwise to do that here, Avvy!"); + break; + case vb_cheat: { + display(string('\6') + "Cheat mode now enabled."); + cheat = true; + } + break; + case vb_magic: + if (dna.avaricius_talk > 0) + dixi('q', 19); + else { + if ((dna.room == 12) & (infield(2))) { + /* Avaricius appears! */ + dixi('q', 17); + if (whereis['\227'] == 12) + dixi('q', 18); + else { + tr[2].init(1, false); /* Avaricius */ + apped(2, 4); + tr[2].walkto(5); + tr[2].call_eachstep = true; + tr[2].eachstep = procback_and_forth; + dna.avaricius_talk = 14; + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + } + } else display("Nothing appears to happen..."); + } + break; + case vb_smartalec: + display("Listen, smart alec, that was just rhetoric."); + break; + case vb_expletive: { + switch (swore) { + case 0: + display(string("Avvy! Do you mind? There might be kids playing!\r\r") + + "(I shouldn't say it again, if I were you!)"); + break; + case 1: + display(string("You hear a distant rumble of thunder. Must you always ") + + "do things I tell you not to?\r\rDon't do it again!"); + break; + default: { + zonk; + display(string("A crack of lightning shoots from the sky, ") + + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); + gameover; + } + } + swore += 1; + } + break; + case vb_listen: + if ((dna.ringing_bells) & (flagset('B'))) + display(string("All other noise is drowned out by the ringing of ") + + "the bells."); + else if (listen == "") + display("You can't hear anything much at the moment, Avvy."); + else display(listen); + break; + case vb_buy: { + /* What are they trying to buy? */ + switch (dna.room) { + case r__argentpub: + if (infield(6)) { + /* We're in a pub, and near the bar. */ + switch (thing) { + case '\63': + case '\65': + case '\66': + case '\72': { /* Beer, whisky, cider or mead */ + if (dna.malagauche == 177) { /* Already getting us one. */ + dixi('D', 15); + return; + } + if (dna.teetotal) { + dixi('D', 6); + return; + } + if (dna.alcohol == 0) points(3); + show_one(12); + display(booze[thing] + ", please.\231\2"); + dna.drinking = thing; + + show_one(10); + dna.malagauche = 177; + set_up_timer(27, procbuydrinks, reason_drinks); + } + break; + case '\64': + examine(); + break; /* We have a right one here- buy Pepsi??! */ + case wine: + if (dna.obj[wine]) /* We've already got the wine! */ + dixi('D', 2); /* 1 bottle's shufishent! */ + else { + if (dna.malagauche == 177) { /* Already getting us one. */ + dixi('D', 15); + return; + } + if (dna.carrying >= maxobjs) { + display("Your hands are full."); + return; + } + show_one(12); + display("Wine, please.\231\2"); + if (dna.alcohol == 0) points(3); + show_one(10); + dna.malagauche = 177; + + set_up_timer(27, procbuywine, reason_drinks); + } + break; + } + } else dixi('D', 5); + break; /* Go to the bar! */ + + case r__outsideducks: + if (infield(6)) { + if (thing == onion) { + if (dna.obj[onion]) + dixi('D', 10); /* not planning to juggle with the things! */ + else if (dna.carrying >= maxobjs) + display("Before you ask, you remember that your hands are full."); + else { + if (dna.bought_onion) + dixi('D', 11); + else { + dixi('D', 9); + points(3); + } + pennycheck(3); /* It costs thruppence. */ + dna.obj[onion] = true; + objectlist; + dna.bought_onion = true; + dna.rotten_onion = false; /* It's OK when it leaves the stall! */ + dna.onion_in_vinegar = false; + } + } else dixi('D', 0); + } else dixi('D', 0); + break; + + case r__nottspub: + dixi('n', 15); + break; /* Can't sell to southerners. */ + default: + dixi('D', 0); /* Can't buy that. */ + } + } + break; + case vb_attack: { + if ((dna.room == r__brummieroad) && + ((person == '\235') || (thing == crossbow) || (thing == bolt)) + && (whereis['\235'] == dna.room)) { + switch (ord(dna.obj[bolt]) + ord(dna.obj[crossbow]) * 2) { + /* 0 = neither, 1 = only bolt, 2 = only crossbow, + 3 = both. */ + case 0: { + dixi('Q', 10); + display("(At the very least, don't use your bare hands!)"); + } + break; + case 1: + display(string("Attack him with only a crossbow bolt? Are you ") + + "planning on playing darts?!"); + break; + case 2: + display(string("Come on, Avvy! You're not going to get very far ") + + "with only a crossbow!"); + break; + case 3: { + dixi('Q', 11); + dna.cwytalot_gone = true; + dna.obj[bolt] = false; + dna.obj[crossbow] = false; + objectlist; + magics[12].op = nix; + points(7); + tr[2].walkto(2); + tr[2].vanishifstill = true; + tr[2].call_eachstep = false; + whereis['\235'] = 177; + } + break; + default: + dixi('Q', 10); /* Please try not to be so violent! */ + } + } else dixi('Q', 10); + } + break; + case vb_password: + if (dna.room != r__bridge) + dixi('Q', 12); + else { + ok = true; + for (ff = 1; ff <= length(thats); ff ++) + for (fv = 1; fv <= length(words[dna.pass_num + first_password].w); fv ++) + if (words[dna.pass_num + first_password].w[fv] != + upcase(realwords[ff][fv])) + ok = false; + if (ok) { + if (dna.drawbridge_open != 0) + display("Contrary to your expectations, the drawbridge fails to close again."); + else { + points(4); + display("The drawbridge opens!"); + set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); + dna.drawbridge_open = 1; + } + } else dixi('Q', 12); + } + break; + case vb_dir: + dir(realwords[2]); + break; + case vb_die: + gameover; + break; + case vb_score: + display(string("Your score is ") + strf(dna.score) + ",\3\rout of a " + + "possible 128.\r\rThis gives you a rank of " + rank() + + ".\r\r" + totaltime()); + break; + case vb_put: + putproc(); + break; + case vb_stand: + stand_up(); + break; + + case vb_kiss: + if (person == pardon) + display("Kiss whom?"); + else if (personshere()) + switch (person) { + case '\226' ... '\256': + display("Hey, what kind of a weirdo are you??"); + break; + case parkata: + dixi('U', 12); + break; + case pgeida: + dixi('U', 13); + break; + case pwisewoman: + dixi('U', 14); + break; + default: + dixi('U', 5); /* You WHAT? */ + } + break; + + case vb_climb: + if (dna.room == r__insidecardiffcastle) cardiff_climbing(); + else /* In the wrong room! */ + display("Not with your head for heights, Avvy!"); + break; + + case vb_jump: { + set_up_timer(1, procjump, reason_jumping); + dna.user_moves_avvy = false; + } + break; + + case vb_highscores: + show_highs; + break; + + case vb_wake: + if (personshere()) + switch (person) { + case pardon: + case pavalot: + case '\0': + if (~ avvy_is_awake) { + avvy_is_awake = true; + points(1); + avvy_in_bed = true; + show_one(3); /* Picture of Avvy, awake in bed. */ + if (teetotal) dixi('d', 13); + } else display("You're already awake, Avvy!"); + break; + case payles: + if (~ ayles_is_awake) display("You can't seem to wake him by yourself."); + break; + case pjacques: + display(string("Brother Jacques, Brother Jacques, are you asleep?\231\2") + + "Hmmm... that doesn't seem to do any good..."); + break; + default: + display("It's difficult to awaken people who aren't asleep...!"); + } + break; + + case vb_sit: + if (dna.room == r__nottspub) { + if (dna.sitting_in_pub) + display("You're already sitting!"); + else { + tr[1].walkto(4); /* Move Avvy to the place, and sit him down. */ + set_up_timer(1, procavvy_sit_down, reason_sitting_down); + } + } else { + /* Default doodah. */ + dusk; + hang_around_for_a_while; + dawn; + display("A few hours later...\20nothing much has happened..."); + } + break; + + case vb_restart: + if (ask("Restart game and lose changes?")) { + dusk; + newgame; + dawn; + } + break; + + case pardon: + display("Hey, a verb would be helpful!"); + break; + + case vb_hello: { + person_speaks(); + display("Hello.\2"); + } + break; + case vb_thanks: { + person_speaks(); + display("That's OK.\2"); + } + break; + default: + display(string('\7') + "Parser bug!"); + } } -void verbopt(char n, string& answer, char& anskey) -{ - switch (n) { - case vb_exam: { answer="Examine"; anskey='x'; } break; /* the ubiqutous one */ - /* vb_give isn't dealt with by this procedure, but by ddm__with */ - case vb_drink: { answer="Drink"; anskey='D'; } break; - case vb_wear: { answer="Wear"; anskey='W'; } break; - case vb_ring: { answer="Ring"; anskey='R'; } break; /* only the bell! */ - case vb_play: { answer="Play"; anskey='P'; } break; - case vb_eat: { answer="Eat"; anskey='E'; } break; - default: { answer="? Unknown!"; anskey='?'; } /* Bug! */ - } +void verbopt(char n, string &answer, char &anskey) { + switch (n) { + case vb_exam: { + answer = "Examine"; + anskey = 'x'; + } + break; /* the ubiqutous one */ + /* vb_give isn't dealt with by this procedure, but by ddm__with */ + case vb_drink: { + answer = "Drink"; + anskey = 'D'; + } + break; + case vb_wear: { + answer = "Wear"; + anskey = 'W'; + } + break; + case vb_ring: { + answer = "Ring"; + anskey = 'R'; + } + break; /* only the bell! */ + case vb_play: { + answer = "Play"; + anskey = 'P'; + } + break; + case vb_eat: { + answer = "Eat"; + anskey = 'E'; + } + break; + default: { + answer = "? Unknown!"; /* Bug! */ + anskey = '?'; + } + } } class unit_acci_initialize { - public: unit_acci_initialize(); +public: + unit_acci_initialize(); }; static unit_acci_initialize acci_constructor; unit_acci_initialize::unit_acci_initialize() { - weirdword=false; + weirdword = false; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h index 6734f6658e83..c80f09d9b98c 100644 --- a/engines/avalanche/acci.h +++ b/engines/avalanche/acci.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,28 +31,67 @@ namespace Avalanche { /* verb codes */ -const char vb_exam = '\1'; const char vb_open = '\2'; const char vb_pause = '\3'; const char vb_get = '\4'; const char vb_drop = '\5'; -const char vb_inv = '\6'; const char vb_talk = '\7'; const char vb_give = '\10'; const char vb_drink = '\11'; const char vb_load = '\12'; -const char vb_save = '\13'; const char vb_pay = '\14'; const char vb_look = '\15'; const char vb_break = '\16'; const char vb_quit = '\17'; -const char vb_sit = '\20'; const char vb_stand = '\21'; const char vb_go = '\22'; const char vb_info = '\23'; const char vb_undress = '\24'; -const char vb_wear = '\25'; const char vb_play = '\26'; const char vb_ring = '\27'; const char vb_help = '\30'; -const char vb_larrypass = '\31'; const char vb_phaon = '\32'; const char vb_boss = '\33'; const char vb_pee = '\34'; -const char vb_cheat = '\35'; const char vb_magic = '\36'; const char vb_restart = '\37'; const char vb_eat = '\40'; -const char vb_listen = '\41'; const char vb_buy = '\42'; const char vb_attack = '\43'; const char vb_password = '\44'; -const char vb_dir = '\45'; const char vb_die = '\46'; const char vb_score = '\47'; const char vb_put = '\50'; -const char vb_kiss = '\51'; const char vb_climb = '\52'; const char vb_jump = '\53'; const char vb_highscores = '\54'; -const char vb_wake = '\55'; const char vb_hello = '\56'; const char vb_thanks = '\57'; - -const char vb_smartalec = '\371'; const char vb_expletive = '\375'; +const char vb_exam = '\1'; +const char vb_open = '\2'; +const char vb_pause = '\3'; +const char vb_get = '\4'; +const char vb_drop = '\5'; +const char vb_inv = '\6'; +const char vb_talk = '\7'; +const char vb_give = '\10'; +const char vb_drink = '\11'; +const char vb_load = '\12'; +const char vb_save = '\13'; +const char vb_pay = '\14'; +const char vb_look = '\15'; +const char vb_break = '\16'; +const char vb_quit = '\17'; +const char vb_sit = '\20'; +const char vb_stand = '\21'; +const char vb_go = '\22'; +const char vb_info = '\23'; +const char vb_undress = '\24'; +const char vb_wear = '\25'; +const char vb_play = '\26'; +const char vb_ring = '\27'; +const char vb_help = '\30'; +const char vb_larrypass = '\31'; +const char vb_phaon = '\32'; +const char vb_boss = '\33'; +const char vb_pee = '\34'; +const char vb_cheat = '\35'; +const char vb_magic = '\36'; +const char vb_restart = '\37'; +const char vb_eat = '\40'; +const char vb_listen = '\41'; +const char vb_buy = '\42'; +const char vb_attack = '\43'; +const char vb_password = '\44'; +const char vb_dir = '\45'; +const char vb_die = '\46'; +const char vb_score = '\47'; +const char vb_put = '\50'; +const char vb_kiss = '\51'; +const char vb_climb = '\52'; +const char vb_jump = '\53'; +const char vb_highscores = '\54'; +const char vb_wake = '\55'; +const char vb_hello = '\56'; +const char vb_thanks = '\57'; + +const char vb_smartalec = '\371'; +const char vb_expletive = '\375'; const char pardon = '\376'; /* =didn't understand / wasn't given. */ struct vocab { - byte n; varying_string<11> w; + byte n; + varying_string<11> w; }; struct ranktype { - word score; varying_string<12> title; + word score; + varying_string<12> title; }; @@ -63,167 +102,171 @@ const char moved = '\0'; /* This word was moved. (Usually because it was the sub const integer first_password = 89; /* Words[first_password] should equal "TIROS". */ -const array<1,nowords,vocab> words = - -/* Verbs, 1-49 */ -{{{1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ - {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, - {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ - {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, - {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, - {7, "SAY"}, {7, "ASK"}, - {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, - {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, - {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, - {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, - {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, - {17, "STAND"}, - - {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, - {20, "DOFF"}, - {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, - {22, "PLAY"}, - {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, - {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, - {255,"NINET"}, /* block for NINETY */ - {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, - {30,"ABRACADABRA"},{30, "PLUGH"}, {30, "XYZZY"}, - {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, - {30, "WIZZY"}, {30, "PLOVER"}, - {30,"MELENKURION"},{30, "ZORTON"}, {30, "BLERBI"}, - {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, - {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, - {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, - {30, "BONESCROLLS"},{30, "RADOF"}, - - {31, "RESTART"}, - {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, - {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, - {34, "ORDER"}, {34, "DEMAND"}, - {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, - {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, - {35, "FIRE"}, - - /* Passwords, 36: */ - - {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, - {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, - {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, - {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, - {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, - {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, - {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, - {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, - {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, - {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, - - {37, "DIR"}, {37, "LS"}, {38, "DIE"}, - {39, "SCORE"}, - {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, - {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, - {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, - {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, - {46, "HELLO"}, {46, "HI"}, {46, "YO"}, - {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ - - -/* Nouns - Objects: 50-100. */ - - {50, "WINE"}, {50, "BOOZE"}, {50,"NASTY"}, - {50, "VINEGAR"}, {51, "MONEYBAG"}, - {51, "BAG"}, {51, "CASH"}, {51,"DOSH"}, - {51, "WALLET"}, - {52, "BODKIN"}, {52, "DAGGER"}, {53,"POTION"}, - {54, "CHASTITY"}, {54, "BELT"}, {55,"BOLT"}, - {55, "ARROW"}, {55, "DART"}, - {56, "CROSSBOW"}, {56, "BOW"}, {57,"LUTE"}, - {58, "PILGRIM"}, {58, "BADGE"}, {59,"MUSHROOMS"}, - {59, "TOADSTOOLS"},{60, "KEY"}, {61,"BELL"}, - {62, "PRESCRIPT"}, {62, "SCROLL"}, {62,"MESSAGE"}, - {63, "PEN"}, {63, "QUILL"}, {64,"INK"}, - {64, "INKPOT"}, {65, "CLOTHES"}, {66,"HABIT"}, - {66, "DISGUISE"}, {67, "ONION"}, - - {99,"PASSWORD"}, - -/* Objects from Also are placed between 101 and 131. */ - -/* Nouns - People - Male, 150-174 */ - {150, "AVVY"}, {150,"AVALOT"}, {150,"YOURSELF"}, - {150, "ME"}, {150,"MYSELF"}, {151,"SPLUDWICK"}, - {151, "THOMAS"}, {151,"ALCHEMIST"}, {151,"CHEMIST"}, - {152, "CRAPULUS"}, {152,"SERF"}, {152,"SLAVE"}, - {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ - {152, "CRAPPY"}, {153,"DUCK"}, {153,"DOCTOR"}, - {154, "MALAGAUCHE"}, - {155, "FRIAR"}, {155,"TUCK"}, {156,"ROBIN"}, - {156, "HOOD"}, {157,"CWYTALOT"}, {157,"GUARD"}, - {157, "BRIDGEKEEP"},{158,"BARON"}, {158,"LUSTIE"}, - {159, "DUKE"}, {159,"GRACE"}, {160,"DOGFOOD"}, - {160, "MINSTREL"}, {161,"TRADER"}, {161,"SHOPKEEPER"}, - {161,"STALLHOLDER"}, - {162, "PILGRIM"}, {162,"IBYTHNETH"}, {163,"ABBOT"}, - {163, "AYLES"}, {164,"PORT"}, {165,"SPURGE"}, - {166, "JACQUES"}, {166,"SLEEPER"}, {166,"RINGER"}, - -/* Nouns- People - Female: 175-199 */ - {175, "WIFE"}, {175,"ARKATA"}, {176,"GEDALODAVA"}, - {176, "GEIDA"}, {176,"PRINCESS"}, {178,"WISE"}, - {178, "WITCH"}, - -/* Pronouns, 200-224 */ - {200, "HIM"}, {200,"MAN"}, {200,"GUY"}, - {200, "DUDE"}, {200,"CHAP"}, {200,"FELLOW"}, - {201, "HER"}, {201,"GIRL"}, {201,"WOMAN"}, - {202, "IT"}, {202,"THING"}, - - {203,"MONK"}, {204,"BARMAN"}, {204,"BARTENDER"}, - -/* Prepositions, 225-249 */ - {225, "TO"}, {226,"AT"}, {227,"UP"}, - {228, "INTO"}, {228,"INSIDE"}, {229,"OFF"}, - {230, "UP"}, {231,"DOWN"}, {232,"ON"}, - - -/* Please, 251 */ - {251, "PLEASE"}, - -/* About, 252 */ - {252, "ABOUT"}, {252, "CONCERNING"}, - -/* Swear words, 253 */ - /* I M P O R T A N T M E S S A G E - - DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE - DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. - GOODNESS KNOWS WHO WROTE THEM. - READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. - WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ - - {253, "SHIT"}, {28 ,"PISS"}, {28 ,"PEE"}, - {253, "FART"}, {253,"FUCK"}, {253,"BALLS"}, - {253, "BLAST"}, {253,"BUGGER"}, {253,"KNICKERS"}, - {253, "BLOODY"}, {253,"HELL"}, {253,"DAMN"}, - {253, "SMEG"}, - /* and other even ruder words. You didn't read them, did you? Good. */ - -/* Answer-back smart-alec words, 249 */ - {249, "YES"}, {249,"NO"}, {249,"BECAUSE"}, - -/* Noise words, 255 */ - {255, "THE"}, {255,'A'}, {255,"NOW"}, - {255, "SOME"}, {255,"AND"}, {255,"THAT"}, - {255, "POCUS"}, {255,"HIS"}, - {255, "THIS"}, {255,"SENTINEL"}}}; /* for "Ken SENT Me" */ +const array<1, nowords, vocab> words = + + /* Verbs, 1-49 */ +{ { {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ + {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, + {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ + {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, + {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, + {7, "SAY"}, {7, "ASK"}, + {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, + {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, + {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, + {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, + {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, + {17, "STAND"}, + + {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, + {20, "DOFF"}, + {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, + {22, "PLAY"}, + {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, + {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, + {255, "NINET"}, /* block for NINETY */ + {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, + {30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"}, + {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, + {30, "WIZZY"}, {30, "PLOVER"}, + {30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"}, + {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, + {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, + {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, + {30, "BONESCROLLS"}, {30, "RADOF"}, + + {31, "RESTART"}, + {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, + {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, + {34, "ORDER"}, {34, "DEMAND"}, + {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, + {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, + {35, "FIRE"}, + + /* Passwords, 36: */ + + {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, + {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, + {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, + {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, + {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, + {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, + {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, + {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, + {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, + {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, + + {37, "DIR"}, {37, "LS"}, {38, "DIE"}, + {39, "SCORE"}, + {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, + {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, + {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, + {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, + {46, "HELLO"}, {46, "HI"}, {46, "YO"}, + {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ + + + /* Nouns - Objects: 50-100. */ + + {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, + {50, "VINEGAR"}, {51, "MONEYBAG"}, + {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, + {51, "WALLET"}, + {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, + {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, + {55, "ARROW"}, {55, "DART"}, + {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, + {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, + {59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"}, + {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, + {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, + {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, + {66, "DISGUISE"}, {67, "ONION"}, + + {99, "PASSWORD"}, + + /* Objects from Also are placed between 101 and 131. */ + + /* Nouns - People - Male, 150-174 */ + {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, + {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, + {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, + {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, + {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ + {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, + {154, "MALAGAUCHE"}, + {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, + {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, + {157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"}, + {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, + {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, + {161, "STALLHOLDER"}, + {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, + {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, + {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, + + /* Nouns- People - Female: 175-199 */ + {175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"}, + {176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"}, + {178, "WITCH"}, + + /* Pronouns, 200-224 */ + {200, "HIM"}, {200, "MAN"}, {200, "GUY"}, + {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, + {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, + {202, "IT"}, {202, "THING"}, + + {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, + + /* Prepositions, 225-249 */ + {225, "TO"}, {226, "AT"}, {227, "UP"}, + {228, "INTO"}, {228, "INSIDE"}, {229, "OFF"}, + {230, "UP"}, {231, "DOWN"}, {232, "ON"}, + + + /* Please, 251 */ + {251, "PLEASE"}, + + /* About, 252 */ + {252, "ABOUT"}, {252, "CONCERNING"}, + + /* Swear words, 253 */ + /* I M P O R T A N T M E S S A G E + + DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE + DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. + GOODNESS KNOWS WHO WROTE THEM. + READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. + WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ + + {253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"}, + {253, "FART"}, {253, "FUCK"}, {253, "BALLS"}, + {253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"}, + {253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"}, + {253, "SMEG"}, + /* and other even ruder words. You didn't read them, did you? Good. */ + + /* Answer-back smart-alec words, 249 */ + {249, "YES"}, {249, "NO"}, {249, "BECAUSE"}, + + /* Noise words, 255 */ + {255, "THE"}, {255, 'A'}, {255, "NOW"}, + {255, "SOME"}, {255, "AND"}, {255, "THAT"}, + {255, "POCUS"}, {255, "HIS"}, + {255, "THIS"}, {255, "SENTINEL"} + } +}; /* for "Ken SENT Me" */ const char what[] = "That's not possible!"; -const array<1,9,ranktype> ranks = -{{{0, "Beginner"}, {10, "Novice"}, -{20, "Improving"}, {35, "Not bad"}, -{50, "Passable"}, {65, "Good"}, -{80, "Experienced"}, {108, "The BEST!"}, -{maxint, "copyright'93"}}}; +const array<1, 9, ranktype> ranks = { + { {0, "Beginner"}, {10, "Novice"}, + {20, "Improving"}, {35, "Not bad"}, + {50, "Passable"}, {65, "Good"}, + {80, "Experienced"}, {108, "The BEST!"}, + {maxint, "copyright'93"} + } +}; #ifdef __acci_implementation__ @@ -233,8 +276,8 @@ const array<1,9,ranktype> ranks = EXTERN varying_string<11> thats; EXTERN varying_string<20> unknown; -EXTERN array<1,11,varying_string<20> > realwords; -EXTERN char verb,person,thing,thing2; +EXTERN array<1, 11, varying_string<20> > realwords; +EXTERN char verb, person, thing, thing2; EXTERN boolean polite; #undef EXTERN #define EXTERN extern @@ -245,7 +288,7 @@ void parse(); void lookaround(); void opendoor(); void do_that(); -void verbopt(char n, string& answer, char& anskey); +void verbopt(char n, string &answer, char &anskey); void have_a_drink(); } // End of namespace Avalanche. diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index 83dce5241bec..3f3e32a09a75 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,28 +33,37 @@ namespace Avalanche { -typedef matrix<0,255,0,15,byte> fonttype; +typedef matrix<0, 255, 0, 15, byte> fonttype; class fieldtype { public: - integer x1,y1,x2,y2; + integer x1, y1, x2, y2; }; class linetype : public fieldtype { public: - byte col; + byte col; }; struct pedtype { - integer x,y; byte dir; + integer x, y; + byte dir; }; struct magictype { - byte op; /* one of the operations */ - word data; /* data for them */ + byte op; /* one of the operations */ + word data; /* data for them */ }; -const integer numlines = 50; const integer up = 0; const integer right = 1; const integer down = 2; const integer left = 3; const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer numlines = 50; +const integer up = 0; +const integer right = 1; +const integer down = 2; +const integer left = 3; +const integer ur = 4; +const integer dr = 5; +const integer dl = 6; +const integer ul = 7; const integer still = 8; const integer nay = maxint; @@ -69,988 +78,1455 @@ const integer nay = maxint; /*S*/ const integer special = 5; /* special call */ /*O*/ const integer opendoor = 6; /* slowly opening door. */ -integer gd,gm; -array<1,numlines,linetype> lines; -array<1,numlines,fieldtype> fields; +integer gd, gm; +array<1, numlines, linetype> lines; +array<1, numlines, fieldtype> fields; boolean do1; byte current; string n; -matrix<0,29,1,2,string> names; +matrix<0, 29, 1, 2, string> names; file f; fonttype skinny; -byte tx,ty; -matrix<0,79,0,22,char> chars; +byte tx, ty; +matrix<0, 79, 0, 22, char> chars; byte cursorflash; -array<1,15,pedtype> peds; -array<1,15,magictype> magics; -array<9,15,magictype> portals; +array<1, 15, pedtype> peds; +array<1, 15, magictype> magics; +array<9, 15, magictype> portals; varying_string<26> flags; string listen; -const graphcursmasktype crosshairs = -{ - ((63551,63807,63807,63807,61727,257,897,32765,897,257,61727,63807,63807,63807,63551,65535), - (4368,21140,8840,53910,640,640,31868,33026,31868,640,640,53910,8840,21140,4368,0)), - 7, - 7}; - -const graphcursmasktype hook = -{ - ((32831,32831,49279,49279,57599,61695,61471,61447,63491,57089,36801,32771,49159,57375,63743,65535), - (0,16256,7936,7936,3584,1536,1792,2016,248,28,8220,12344,8160,1792,0,0)), - 2, - 9}; - -const graphcursmasktype tthand = -{ - ((62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443), - (3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092)), - 4, - 0}; - -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +const graphcursmasktype crosshairs = { + ((63551, 63807, 63807, 63807, 61727, 257, 897, 32765, 897, 257, 61727, 63807, 63807, 63807, 63551, 65535), + (4368, 21140, 8840, 53910, 640, 640, 31868, 33026, 31868, 640, 640, 53910, 8840, 21140, 4368, 0)), + 7, + 7 +}; + +const graphcursmasktype hook = { + ((32831, 32831, 49279, 49279, 57599, 61695, 61471, 61447, 63491, 57089, 36801, 32771, 49159, 57375, 63743, 65535), + (0, 16256, 7936, 7936, 3584, 1536, 1792, 2016, 248, 28, 8220, 12344, 8160, 1792, 0, 0)), + 2, + 9 +}; + +const graphcursmasktype tthand = { + ((62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443), + (3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092)), + 4, + 0 +}; + +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; +} + +void glimpse(byte ret) { /* glimpse of screen 3 */ + char sink; + ; + hidemousecursor; + setvisualpage(3); + setcrtpagenumber(3); + showmousecursor; + do { + ; + } while (!(~ anymousekeypressed)); + do { + ; + } while (!anymousekeypressed); + hidemousecursor; + setvisualpage(ret); + setcrtpagenumber(ret); + showmousecursor; + while (keypressed()) sink = readkey(); } -void glimpse(byte ret) /* glimpse of screen 3 */ -{ - char sink; -; - hidemousecursor; setvisualpage(3); setcrtpagenumber(3); showmousecursor; - do {; } while (!(~ anymousekeypressed)); - do {; } while (!anymousekeypressed); - hidemousecursor; setvisualpage(ret); setcrtpagenumber(ret); showmousecursor; - while (keypressed()) sink=readkey(); +void newline(byte t, integer p, integer q, integer r, integer s, byte c) { + ; + { + linetype &with = lines[t]; + ; + x1 = p; + y1 = q; + x2 = r; + y2 = s; + with.col = c; + } } -void newline(byte t, integer p,integer q,integer r,integer s, byte c) -{; - { - linetype& with = lines[t]; - ; - x1=p; y1=q; x2=r; y2=s; with.col=c; - } +void newfield(byte t, integer p, integer q, integer r, integer s) { + ; + { + fieldtype &with = fields[t]; ; + with.x1 = p; + with.y1 = q; + with.x2 = r; + with.y2 = s; + } } -void newfield(byte t, integer p,integer q,integer r,integer s) -{; { - fieldtype& with = fields[t]; ; with.x1=p; with.y1=q; with.x2=r; with.y2=s; } } - -void drawped(byte p) -{; - { pedtype& with = peds[p]; - if (with.dir<177) - {; - setcolor(p); circle(with.x,with.y,5); moveto(with.x,with.y); - switch (with.dir) { - case up: linerel(0,-5); break; case down: linerel(0,5); break; - case left: linerel(-7,0); break; case right: linerel(7,0); break; - case ul: linerel(-7,-5); break; case dl: linerel(-7, 5); break; - case ur: linerel( 7,-5); break; case dr: linerel( 7, 5); break; - } - }} +void drawped(byte p) { + ; + { + pedtype &with = peds[p]; + if (with.dir < 177) { + ; + setcolor(p); + circle(with.x, with.y, 5); + moveto(with.x, with.y); + switch (with.dir) { + case up: + linerel(0, -5); + break; + case down: + linerel(0, 5); + break; + case left: + linerel(-7, 0); + break; + case right: + linerel(7, 0); + break; + case ul: + linerel(-7, -5); + break; + case dl: + linerel(-7, 5); + break; + case ur: + linerel(7, -5); + break; + case dr: + linerel(7, 5); + break; + } + } + } } -void drawup() -{ - byte fv; -; - cleardevice(); - for( fv=1; fv <= numlines; fv ++) - { linetype& with = lines[fv]; - if (x1!=nay) - {; - setcolor(with.col); - line(x1,y1,x2,y2); - }} - for( fv=1; fv <= numlines; fv ++) - { fieldtype& with = fields[fv]; - if (with.x1!=nay) - {; - setcolor(fv); - rectangle(with.x1,with.y1,with.x2,with.y2); - }} - for( fv=1; fv <= 15; fv ++) drawped(fv); +void drawup() { + byte fv; + ; + cleardevice(); + for (fv = 1; fv <= numlines; fv ++) { + linetype &with = lines[fv]; + if (x1 != nay) { + ; + setcolor(with.col); + line(x1, y1, x2, y2); + } + } + for (fv = 1; fv <= numlines; fv ++) { + fieldtype &with = fields[fv]; + if (with.x1 != nay) { + ; + setcolor(fv); + rectangle(with.x1, with.y1, with.x2, with.y2); + } + } + for (fv = 1; fv <= 15; fv ++) drawped(fv); } -void addped() -{ - byte n,fv; -; - n=0; do { n += 1; } while (!((n==16) || (peds[n].dir==177))); - setcrtpagenumber(0); setactivepage(0); setvisualpage(0); - drawup(); setgraphicscursor(tthand); showmousecursor; - do { - if (rightmousekeypressed) return; - if (keypressed()) glimpse(0); - } while (!leftmousekeypressed); - hidemousecursor; - { - pedtype& with = peds[n]; - ; - with.x=mousex; with.y=mousey; - } - cleardevice(); setfillstyle(6,9); for( fv=1; fv <= 3; fv ++) bar(200*fv,0,200*fv,200); - for( fv=1; fv <= 2; fv ++) bar(0,60*fv,640,60*fv); - showmousecursor; - do { if (rightmousekeypressed) return; } while (!leftmousekeypressed); - hidemousecursor; - { pedtype& with = peds[n]; - switch (((mousex / 200)*10)+(mousey / 60)) { - case 0: with.dir=ul; break; case 10: with.dir=up; break; case 20: with.dir=ur; break; - case 1: with.dir=left; break; case 11: with.dir=still; break; case 21: with.dir=right; break; - case 2: with.dir=dl; break; case 12: with.dir=down; break; case 22: with.dir=dr; break; - }} +void addped() { + byte n, fv; + ; + n = 0; + do { + n += 1; + } while (!((n == 16) || (peds[n].dir == 177))); + setcrtpagenumber(0); + setactivepage(0); + setvisualpage(0); + drawup(); + setgraphicscursor(tthand); + showmousecursor; + do { + if (rightmousekeypressed) return; + if (keypressed()) glimpse(0); + } while (!leftmousekeypressed); + hidemousecursor; + { + pedtype &with = peds[n]; + ; + with.x = mousex; + with.y = mousey; + } + cleardevice(); + setfillstyle(6, 9); + for (fv = 1; fv <= 3; fv ++) bar(200 * fv, 0, 200 * fv, 200); + for (fv = 1; fv <= 2; fv ++) bar(0, 60 * fv, 640, 60 * fv); + showmousecursor; + do { + if (rightmousekeypressed) return; + } while (!leftmousekeypressed); + hidemousecursor; + { + pedtype &with = peds[n]; + switch (((mousex / 200) * 10) + (mousey / 60)) { + case 0: + with.dir = ul; + break; + case 10: + with.dir = up; + break; + case 20: + with.dir = ur; + break; + case 1: + with.dir = left; + break; + case 11: + with.dir = still; + break; + case 21: + with.dir = right; + break; + case 2: + with.dir = dl; + break; + case 12: + with.dir = down; + break; + case 22: + with.dir = dr; + break; + } + } } -void addline(byte ccc) -{ - byte fv; -; - do { - for( fv=1; fv <= numlines; fv ++) - { linetype& with = lines[fv]; - if (x1==nay) - {; - x1=fv*17; x2=x1; y1=200; y2=190; with.col=ccc; - return; /* bad style! */ - }} - } while (!false); +void addline(byte ccc) { + byte fv; + ; + do { + for (fv = 1; fv <= numlines; fv ++) { + linetype &with = lines[fv]; + if (x1 == nay) { + ; + x1 = fv * 17; + x2 = x1; + y1 = 200; + y2 = 190; + with.col = ccc; + return; /* bad style! */ + } + } + } while (!false); } -byte colour() -{ - byte fv; -byte colour_result; -; - setactivepage(0); setvisualpage(0); setcrtpagenumber(0); - outtextxy(0,0,"Select a colour, please..."); - for( fv=1; fv <= 15; fv ++) - {; - setfillstyle(1,fv); - bar(fv*40,27,39+fv*40,200); - } - showmousecursor; - do { - if (rightmousekeypressed) {; hidemousecursor; return colour_result; } - if (keypressed()) glimpse(2); - } while (!leftmousekeypressed); - hidemousecursor; - colour_result=getpixel(mousex,mousey); cleardevice(); -return colour_result; +byte colour() { + byte fv; + byte colour_result; + ; + setactivepage(0); + setvisualpage(0); + setcrtpagenumber(0); + outtextxy(0, 0, "Select a colour, please..."); + for (fv = 1; fv <= 15; fv ++) { + ; + setfillstyle(1, fv); + bar(fv * 40, 27, 39 + fv * 40, 200); + } + showmousecursor; + do { + if (rightmousekeypressed) { + ; + hidemousecursor; + return colour_result; + } + if (keypressed()) glimpse(2); + } while (!leftmousekeypressed); + hidemousecursor; + colour_result = getpixel(mousex, mousey); + cleardevice(); + return colour_result; } -void addfield() -{ - byte fv; boolean ok; -; - do { - fv=colour(); - ok=fields[fv].x1==nay; - if (! ok) output << '\7'; - } while (!ok); - { - fieldtype& with = fields[fv]; - ; - with.x1=300+fv*17; with.x2=with.x1+1; with.y1=200; with.y2=177; - } +void addfield() { + byte fv; + boolean ok; + ; + do { + fv = colour(); + ok = fields[fv].x1 == nay; + if (! ok) output << '\7'; + } while (!ok); + { + fieldtype &with = fields[fv]; + ; + with.x1 = 300 + fv * 17; + with.x2 = with.x1 + 1; + with.y1 = 200; + with.y2 = 177; + } } -byte checkline() -{ - byte fv,ans; -byte checkline_result; -; - setgraphicscursor(crosshairs); - setcrtpagenumber(0); setactivepage(0); setvisualpage(0); drawup(); - do { - showmousecursor; - do { - if (rightmousekeypressed) {; checkline_result=255; return checkline_result; } - if (keypressed()) glimpse(0); - } while (!leftmousekeypressed); - hidemousecursor; - setactivepage(1); ans=177; - for( fv=1; fv <= numlines; fv ++) /* */ - {; - { linetype& with = lines[fv]; - if (x1!=nay) - {; - setcolor( 9); line(x1,y1,x2,y2); - if (getpixel(mousex,mousey)==9) ans=fv; - setcolor( 0); line(x1,y1,x2,y2); - }} - { fieldtype& with = fields[fv]; - if (with.x1!=nay) - {; - setcolor( 9); rectangle(with.x1,with.y1,with.x2,with.y2); - if (getpixel(mousex,mousey)==9) ans=fv+100; - setcolor( 0); rectangle(with.x1,with.y1,with.x2,with.y2); - }} - } - setactivepage(0); - } while (!(ans!=177)); - checkline_result=ans; -return checkline_result; +byte checkline() { + byte fv, ans; + byte checkline_result; + ; + setgraphicscursor(crosshairs); + setcrtpagenumber(0); + setactivepage(0); + setvisualpage(0); + drawup(); + do { + showmousecursor; + do { + if (rightmousekeypressed) { + ; + checkline_result = 255; + return checkline_result; + } + if (keypressed()) glimpse(0); + } while (!leftmousekeypressed); + hidemousecursor; + setactivepage(1); + ans = 177; + for (fv = 1; fv <= numlines; fv ++) { /* */ + ; + { + linetype &with = lines[fv]; + if (x1 != nay) { + ; + setcolor(9); + line(x1, y1, x2, y2); + if (getpixel(mousex, mousey) == 9) ans = fv; + setcolor(0); + line(x1, y1, x2, y2); + } + } + { + fieldtype &with = fields[fv]; + if (with.x1 != nay) { + ; + setcolor(9); + rectangle(with.x1, with.y1, with.x2, with.y2); + if (getpixel(mousex, mousey) == 9) ans = fv + 100; + setcolor(0); + rectangle(with.x1, with.y1, with.x2, with.y2); + } + } + } + setactivepage(0); + } while (!(ans != 177)); + checkline_result = ans; + return checkline_result; } void chooseside(); -static boolean itsaline; - -static void plotline() -{; - if (itsaline) - { linetype& with = lines[gd]; - if (do1) line(mousex,mousey,x2,y2); else - line(x1,y1,mousex,mousey);} - else - { fieldtype& with = fields[gd]; - if (do1) rectangle(mousex,mousey,with.x2,with.y2); else - rectangle(with.x1,with.y1,mousex,mousey);} +static boolean itsaline; + +static void plotline() { + ; + if (itsaline) { + linetype &with = lines[gd]; + if (do1) line(mousex, mousey, x2, y2); + else + line(x1, y1, mousex, mousey); + } else { + fieldtype &with = fields[gd]; + if (do1) rectangle(mousex, mousey, with.x2, with.y2); + else + rectangle(with.x1, with.y1, mousex, mousey); + } } -void chooseside() -{ - byte clicol,savelcol;fieldtype current; integer temp; -; - do { - gd=checkline(); itsaline=gd<100; - if (gd==255) {; hidemousecursor; return; } - if (! itsaline) gd -= 100; - setactivepage(2); setvisualpage(2); cleardevice(); - setgraphicscursor(tthand); setcrtpagenumber(2); - if (itsaline) - {; - current=lines[gd]; - savelcol=lines[gd].col; - } else current=fields[gd]; - {; - setcolor(9); - if (itsaline) line(current.x1,current.y1,current.x2,current.y2); else rectangle(current.x1,current.y1,current.x2,current.y2); - setcolor(9); - setfillstyle(1,red); bar(current.x1-3,current.y1-3,current.x1+3,current.y1+3); - setfillstyle(1,green); bar(current.x2-3,current.y2-3,current.x2+3,current.y2+3); - do {; } while (!(~ anymousekeypressed)); - clicol=177; showmousecursor; - do { - if (anymousekeypressed) - {; - hidemousecursor; - clicol=getpixel(mousex,mousey); - showmousecursor; - } - if (rightmousekeypressed) - {; hidemousecursor; return; } - if (keypressed()) glimpse(2); - } while (!(set::of(red,green, eos).has(clicol))); - do1=clicol==red; hidemousecursor; - setgraphicscursor(hook); setcrtpagenumber(0); - setactivepage(0); setvisualpage(0); setcolor(0); - if (itsaline) - { - linetype& with1 = lines[gd]; ; line(current.x1,current.y1,current.x2,current.y2); setcolor(with1.col); } else - { - fieldtype& with1 = fields[gd]; ; rectangle(with1.x1,with1.y1,with1.x2,with1.y2); setcolor(gd); } - setwritemode(xorput); - while (~ anymousekeypressed) - {; - plotline(); - showmousecursor; delay(1); hidemousecursor; - plotline(); - if (rightmousekeypressed) {; hidemousecursor; return; } - if (keypressed()) glimpse(0); - } - /* update "current" rec */ - if (do1) {; current.x1=mousex; current.y1=mousey; } - else {; current.x2=mousex; current.y2=mousey; } - if (! itsaline) - {; - if (current.x1>current.x2) {; temp=current.x2; current.x2=current.x1; current.x1=temp; } - if (current.y1>current.y2) {; temp=current.y2; current.y2=current.y1; current.y1=temp; } - } - /* copy "current" to line/field */ - if (itsaline) - { - linetype& with1 = lines[gd]; - ; - current.x1=current.x1; current.x2=current.x2; current.y1=current.y1; current.y2=current.y2; - with1.col=savelcol; - } else fields[gd]=current; - } - setwritemode(0); - } while (!false); +void chooseside() { + byte clicol, savelcol; + fieldtype current; + integer temp; + ; + do { + gd = checkline(); + itsaline = gd < 100; + if (gd == 255) { + ; + hidemousecursor; + return; + } + if (! itsaline) gd -= 100; + setactivepage(2); + setvisualpage(2); + cleardevice(); + setgraphicscursor(tthand); + setcrtpagenumber(2); + if (itsaline) { + ; + current = lines[gd]; + savelcol = lines[gd].col; + } else current = fields[gd]; + { + ; + setcolor(9); + if (itsaline) line(current.x1, current.y1, current.x2, current.y2); + else rectangle(current.x1, current.y1, current.x2, current.y2); + setcolor(9); + setfillstyle(1, red); + bar(current.x1 - 3, current.y1 - 3, current.x1 + 3, current.y1 + 3); + setfillstyle(1, green); + bar(current.x2 - 3, current.y2 - 3, current.x2 + 3, current.y2 + 3); + do { + ; + } while (!(~ anymousekeypressed)); + clicol = 177; + showmousecursor; + do { + if (anymousekeypressed) { + ; + hidemousecursor; + clicol = getpixel(mousex, mousey); + showmousecursor; + } + if (rightmousekeypressed) { + ; + hidemousecursor; + return; + } + if (keypressed()) glimpse(2); + } while (!(set::of(red, green, eos).has(clicol))); + do1 = clicol == red; + hidemousecursor; + setgraphicscursor(hook); + setcrtpagenumber(0); + setactivepage(0); + setvisualpage(0); + setcolor(0); + if (itsaline) { + linetype &with1 = lines[gd]; ; + line(current.x1, current.y1, current.x2, current.y2); + setcolor(with1.col); + } else { + fieldtype &with1 = fields[gd]; ; + rectangle(with1.x1, with1.y1, with1.x2, with1.y2); + setcolor(gd); + } + setwritemode(xorput); + while (~ anymousekeypressed) { + ; + plotline(); + showmousecursor; + delay(1); + hidemousecursor; + plotline(); + if (rightmousekeypressed) { + ; + hidemousecursor; + return; + } + if (keypressed()) glimpse(0); + } + /* update "current" rec */ + if (do1) { + ; + current.x1 = mousex; + current.y1 = mousey; + } else { + ; + current.x2 = mousex; + current.y2 = mousey; + } + if (! itsaline) { + ; + if (current.x1 > current.x2) { + ; + temp = current.x2; + current.x2 = current.x1; + current.x1 = temp; + } + if (current.y1 > current.y2) { + ; + temp = current.y2; + current.y2 = current.y1; + current.y1 = temp; + } + } + /* copy "current" to line/field */ + if (itsaline) { + linetype &with1 = lines[gd]; + ; + current.x1 = current.x1; + current.x2 = current.x2; + current.y1 = current.y1; + current.y2 = current.y2; + with1.col = savelcol; + } else fields[gd] = current; + } + setwritemode(0); + } while (!false); } -void delped() -{; - setcrtpagenumber(0); setactivepage(0); setvisualpage(0); - drawup(); setgraphicscursor(tthand); showmousecursor; - do {; } while (!leftmousekeypressed); peds[colour()].dir=177; +void delped() { + ; + setcrtpagenumber(0); + setactivepage(0); + setvisualpage(0); + drawup(); + setgraphicscursor(tthand); + showmousecursor; + do { + ; + } while (!leftmousekeypressed); + peds[colour()].dir = 177; } byte menu(); -static void say(byte y, string x) -{; - setfillstyle(1,y); - bar(0,y*17,100,y*17+15); outtextxy(123,y*17,x); +static void say(byte y, string x) { + ; + setfillstyle(1, y); + bar(0, y * 17, 100, y * 17 + 15); + outtextxy(123, y * 17, x); } -byte menu() -{ - byte clicol; -byte menu_result; -; - setcolor(15); settextstyle(0,0,2); clicol=0; setgraphicscursor(tthand); - setvisualpage(2); setactivepage(2); setcrtpagenumber(2); cleardevice(); - say(3,"Move lines around"); - say(4,"Add a new line"); - say(5,"Delete a line"); - say(6,"Add a ped"); - say(7,"Delete a ped"); - say(8,"Add a field"); - say(10,"Return to Also."); - showmousecursor; - do { - if (leftmousekeypressed) - {; - hidemousecursor; - clicol=getpixel(mousex,mousey); - showmousecursor; - } - if (rightmousekeypressed) {; hidemousecursor; return menu_result; } - if (keypressed()) glimpse(2); - } while (!(clicol>0)); - do {; } while (!(~ anymousekeypressed)); - hidemousecursor; - menu_result=clicol; -return menu_result; +byte menu() { + byte clicol; + byte menu_result; + ; + setcolor(15); + settextstyle(0, 0, 2); + clicol = 0; + setgraphicscursor(tthand); + setvisualpage(2); + setactivepage(2); + setcrtpagenumber(2); + cleardevice(); + say(3, "Move lines around"); + say(4, "Add a new line"); + say(5, "Delete a line"); + say(6, "Add a ped"); + say(7, "Delete a ped"); + say(8, "Add a field"); + say(10, "Return to Also."); + showmousecursor; + do { + if (leftmousekeypressed) { + ; + hidemousecursor; + clicol = getpixel(mousex, mousey); + showmousecursor; + } + if (rightmousekeypressed) { + ; + hidemousecursor; + return menu_result; + } + if (keypressed()) glimpse(2); + } while (!(clicol > 0)); + do { + ; + } while (!(~ anymousekeypressed)); + hidemousecursor; + menu_result = clicol; + return menu_result; } -void removeline() -{; - gd=checkline(); if (gd==255) {; hidemousecursor; return; } - if (gd>100) - fields[gd-100].x1=nay; - else lines[gd].x1=nay; /* cancels it out */ - cleardevice(); drawup(); +void removeline() { + ; + gd = checkline(); + if (gd == 255) { + ; + hidemousecursor; + return; + } + if (gd > 100) + fields[gd - 100].x1 = nay; + else lines[gd].x1 = nay; /* cancels it out */ + cleardevice(); + drawup(); } -void lino() -{; - resetmouse; - do { - switch (menu()) { - case 3: chooseside(); break; - case 4: addline(colour()); break; - case 5: removeline(); break; - case 6: addped(); break; - case 7: delped(); break; - case 8: addfield(); break; - case 10: return; break; - } - } while (!false); +void lino() { + ; + resetmouse; + do { + switch (menu()) { + case 3: + chooseside(); + break; + case 4: + addline(colour()); + break; + case 5: + removeline(); + break; + case 6: + addped(); + break; + case 7: + delped(); + break; + case 8: + addfield(); + break; + case 10: + return; + break; + } + } while (!false); } -void loadscreen() /* load2 */ -{ - byte a /*absolute $A000:246560*/; - byte bit; - untyped_file f; -; - setactivepage(3); setvisualpage(3); - assign(f,string("c:\\avalot\\place")+n+".avd"); reset(f,1); seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,12080); - } - close(f); - setvisualpage(0); - outtextxy(0,190,"Look carefully, and then press any key..."); - setactivepage(0); +void loadscreen() { /* load2 */ + byte a /*absolute $A000:246560*/; + byte bit; + untyped_file f; + ; + setactivepage(3); + setvisualpage(3); + assign(f, string("c:\\avalot\\place") + n + ".avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 12080); + } + close(f); + setvisualpage(0); + outtextxy(0, 190, "Look carefully, and then press any key..."); + setactivepage(0); } -void ctrlsout(string& x) /* Replace real ctrls with caret codes */ -{ - byte fv; string xx; -; - xx=""; - for( fv=1; fv <= length(x); fv ++) - if (x[fv]>'\37') xx=xx+x[fv]; else xx=xx+'^'+chr(ord(x[fv])+64); - x=xx; +void ctrlsout(string &x) { /* Replace real ctrls with caret codes */ + byte fv; + string xx; + ; + xx = ""; + for (fv = 1; fv <= length(x); fv ++) + if (x[fv] > '\37') xx = xx + x[fv]; + else xx = xx + '^' + chr(ord(x[fv]) + 64); + x = xx; } -void ctrlsin(string& x) /* Opposite of ctrlsout */ -{ - byte fv; string xx; boolean ctrlwas; -; - xx=""; ctrlwas=false; - for( fv=1; fv <= length(x); fv ++) - if (ctrlwas) /* last char was a caret */ - {; - xx=xx+chr(ord(upcase(x[fv]))-64); - ctrlwas=false; - } - else - {; /* last char wasn't a caret... */ - if (x[fv]=='^') ctrlwas=true; else /* ...but this one is */ - xx=xx+x[fv]; /* ...but this one isn't */ - } - x=xx; +void ctrlsin(string &x) { /* Opposite of ctrlsout */ + byte fv; + string xx; + boolean ctrlwas; + ; + xx = ""; + ctrlwas = false; + for (fv = 1; fv <= length(x); fv ++) + if (ctrlwas) { /* last char was a caret */ + ; + xx = xx + chr(ord(upcase(x[fv])) - 64); + ctrlwas = false; + } else { + ; /* last char wasn't a caret... */ + if (x[fv] == '^') ctrlwas = true; + else /* ...but this one is */ + xx = xx + x[fv]; /* ...but this one isn't */ + } + x = xx; } -void flipover() /* temp view other screen */ -{ - char r; -; - setvisualpage(3); r=readkey(); setvisualpage(0); +void flipover() { /* temp view other screen */ + char r; + ; + setvisualpage(3); + r = readkey(); + setvisualpage(0); } -void plotchar(byte x,byte y, char n) -{ - byte fv; -; - if (chars[x][y]==n) return; - for( fv=0; fv <= 15; fv ++) - mem[0xa000*y*1200+(fv+3)*80+x]=skinny[ord(n)][fv]; - chars[x][y]=n; +void plotchar(byte x, byte y, char n) { + byte fv; + ; + if (chars[x][y] == n) return; + for (fv = 0; fv <= 15; fv ++) + mem[0xa000 * y * 1200 + (fv + 3) * 80 + x] = skinny[ord(n)][fv]; + chars[x][y] = n; } -void cursor() -{ - byte fv; -; - cursorflash += 1; - switch (cursorflash) { - case 1:case 127: for( fv=12; fv <= 14; fv ++) - mem[0xa000*ty*1200+(3+fv)*80+tx]=~(mem[0xa000*ty*1200+(3+fv)*80+tx]); - break; - case 255: cursorflash=0; break; - } +void cursor() { + byte fv; + ; + cursorflash += 1; + switch (cursorflash) { + case 1: + case 127: + for (fv = 12; fv <= 14; fv ++) + mem[0xa000 * ty * 1200 + (3 + fv) * 80 + tx] = ~(mem[0xa000 * ty * 1200 + (3 + fv) * 80 + tx]); + break; + case 255: + cursorflash = 0; + break; + } } -void losecursor() -{; - if (cursorflash<127) {; cursorflash=126; cursor(); } - cursorflash=0; +void losecursor() { + ; + if (cursorflash < 127) { + ; + cursorflash = 126; + cursor(); + } + cursorflash = 0; } -void gwrite(string x) -{ - byte fv; -; - for( fv=1; fv <= length(x); fv ++) - {; - plotchar(tx,ty,x[fv]); - tx += 1; - if (tx==80) {; ty += 1; tx=0; } - } +void gwrite(string x) { + byte fv; + ; + for (fv = 1; fv <= length(x); fv ++) { + ; + plotchar(tx, ty, x[fv]); + tx += 1; + if (tx == 80) { + ; + ty += 1; + tx = 0; + } + } } -string typein(string x) -{ - const char marker = '\2'; - byte p; char r; -string typein_result; -; - setvisualpage(0); setactivepage(0); cleardevice(); - settextstyle(0,0,1); setcolor(15); - outtextxy( 0, 0,"Press TAB to see the room..."); - outtextxy( 0, 20,"You may use any of these Control Codes:"); - outtextxy(30, 30,"Anywhere: ^M = new line, ^P = new scroll, |1 fix to speaker 1."); - outtextxy(90, 40,"^B = new bubble"); - outtextxy(30, 50,"At end of line: ^C = centre line, ^L = left justify."); - outtextxy(30, 60,"At end of scroll: ^D = Don't add automatic ^P here."); - outtextxy( 0, 80,"(Use by typing in (eg for ^P) ^ then P, not Ctrl-P.)"); - p=0; ctrlsout(x); fillchar(chars,sizeof(chars),'\40'); - do { - tx=0; ty=6; gwrite(x+'\4'+'\40'); - tx=(p % 80); ty=(p / 80)+6; - while (! keypressed()) {; delay(1); cursor(); } losecursor(); - r=readkey(); - switch (r) { - case '\10': if (p>0) {; x=copy(x,1,p-1)+copy(x,p+1,255); p -= 1; } break; /* backspace */ - case '\11': flipover(); break; - case '\40' ... '\377': {; x=copy(x,1,p)+r+copy(x,p+1,255); p += 1; } break; - case '\0': switch (readkey()) { /* extd. keystroke */ - case 'G': p=0; break; /* Home */ - case 'K': if (p>0) p -= 1; break; /* left */ - case 'M': if (p80) p -= 80; break; /* up */ - case 'P': if (p 0) { + ; + x = copy(x, 1, p - 1) + copy(x, p + 1, 255); + p -= 1; + } + break; /* backspace */ + case '\11': + flipover(); + break; + case '\40' ... '\377': { + ; + x = copy(x, 1, p) + r + copy(x, p + 1, 255); + p += 1; + } + break; + case '\0': + switch (readkey()) { /* extd. keystroke */ + case 'G': + p = 0; + break; /* Home */ + case 'K': + if (p > 0) p -= 1; + break; /* left */ + case 'M': + if (p < length(x)) p += 1; + break; /* right */ + case 'H': + if (p > 80) p -= 80; + break; /* up */ + case 'P': + if (p < length(x) - 80) p += 80; + break; /* down */ + case 'O': + p = length(x); + break; /* End */ + case 'S': + x = copy(x, 1, p) + copy(x, p + 2, 255); + break; /* Del */ + } + break; + } + } while (!(r == '\15')); + ctrlsin(x); + typein_result = x; + return typein_result; } -byte typeno(string title) -{ - varying_string<2> x; char r; integer e; word p; -byte typeno_result; -; - cleardevice(); x="000"; - settextstyle(0,0,3); setcolor(9); outtextxy(0,0,title); - setfillstyle(1,0); setcolor(10); fillchar(chars,sizeof(chars),'\40'); - do { - bar(100,100,150,125); - outtextxy(100,100,x); - do { r=readkey(); } while (!(set::of(range('0','9'),'\33','\15', eos).has(r))); - if (r=='\33') {; typeno_result=255; return typeno_result; } - if (r!='\15') x=string(x[2])+r; - } while (!(r=='\15')); - val(x,p,e); typeno_result=p; -return typeno_result; +byte typeno(string title) { + varying_string<2> x; + char r; + integer e; + word p; + byte typeno_result; + ; + cleardevice(); + x = "000"; + settextstyle(0, 0, 3); + setcolor(9); + outtextxy(0, 0, title); + setfillstyle(1, 0); + setcolor(10); + fillchar(chars, sizeof(chars), '\40'); + do { + bar(100, 100, 150, 125); + outtextxy(100, 100, x); + do { + r = readkey(); + } while (!(set::of(range('0', '9'), '\33', '\15', eos).has(r))); + if (r == '\33') { + ; + typeno_result = 255; + return typeno_result; + } + if (r != '\15') x = string(x[2]) + r; + } while (!(r == '\15')); + val(x, p, e); + typeno_result = p; + return typeno_result; } -void showallnames() -{ - byte fv; varying_string<2> s; char r; -; - settextstyle(0,0,2); cleardevice(); setcolor(13); outtextxy(0,0,"Descriptions start..."); - settextstyle(0,0,1); setcolor(7); - for( fv=1; fv <= 29; fv ++) - {; - str(fv,2,s); - outtextxy((fv / 15)*320,((fv % 15)*10)+30,s+'='+copy(names[fv][1],0,33)); - } - setcolor(15); outtextxy(500,190,"Press any key..."); - r=readkey(); +void showallnames() { + byte fv; + varying_string<2> s; + char r; + ; + settextstyle(0, 0, 2); + cleardevice(); + setcolor(13); + outtextxy(0, 0, "Descriptions start..."); + settextstyle(0, 0, 1); + setcolor(7); + for (fv = 1; fv <= 29; fv ++) { + ; + str(fv, 2, s); + outtextxy((fv / 15) * 320, ((fv % 15) * 10) + 30, s + '=' + copy(names[fv][1], 0, 33)); + } + setcolor(15); + outtextxy(500, 190, "Press any key..."); + r = readkey(); } void showallassoc(); -static void saascreen() -{; - settextstyle(0,0,2); cleardevice(); setcolor(10); outtextxy(0,0,"Everything..."); - settextstyle(0,0,1); setcolor(2); - outtextxy(17,20,"(Format: : : )"); +static void saascreen() { + ; + settextstyle(0, 0, 2); + cleardevice(); + setcolor(10); + outtextxy(0, 0, "Everything..."); + settextstyle(0, 0, 1); + setcolor(2); + outtextxy(17, 20, "(Format: : : )"); } -void showallassoc() -{ - byte fv; varying_string<2> s; char r; - -; - saascreen(); - for( fv=1; fv <= 30; fv ++) - {; - str(fv-1,2,s); - outtextxy(0,(((fv-1) % 10)*10)+30, - s+':'+copy(names[fv-1][1],1,7)+':'+copy(names[fv-1][2],1,70)); - if ((fv % 10)==0) {; r=readkey(); saascreen(); } - } - setcolor(15); outtextxy(500,190,"Press any key..."); - r=readkey(); +void showallassoc() { + byte fv; + varying_string<2> s; + char r; + + ; + saascreen(); + for (fv = 1; fv <= 30; fv ++) { + ; + str(fv - 1, 2, s); + outtextxy(0, (((fv - 1) % 10) * 10) + 30, + s + ':' + copy(names[fv - 1][1], 1, 7) + ':' + copy(names[fv - 1][2], 1, 70)); + if ((fv % 10) == 0) { + ; + r = readkey(); + saascreen(); + } + } + setcolor(15); + outtextxy(500, 190, "Press any key..."); + r = readkey(); } -void clear() -{ - byte fv; -; - fillchar(names ,sizeof(names ), '\0'); - for( fv=1; fv <= numlines; fv ++) {; lines[fv].x1=nay; fields[fv].x1=nay; } - fillchar(peds ,sizeof(peds ),'\261'); +void clear() { + byte fv; + ; + fillchar(names , sizeof(names), '\0'); + for (fv = 1; fv <= numlines; fv ++) { + ; + lines[fv].x1 = nay; + fields[fv].x1 = nay; + } + fillchar(peds , sizeof(peds), '\261'); } void scramble(); -static void scram1(string& x) -{ - byte fz; -; - for( fz=1; fz <= length(x); fz ++) - x[fz]=chr(ord(x[fz]) ^ 177); +static void scram1(string &x) { + byte fz; + ; + for (fz = 1; fz <= length(x); fz ++) + x[fz] = chr(ord(x[fz]) ^ 177); } -void scramble() /* Works both ways. */ -{ - byte fv,ff; -; - for( fv=0; fv <= 29; fv ++) - for( ff=1; ff <= 2; ff ++) - scram1(names[fv][ff]); - scram1(listen); - scram1(flags); +void scramble() { /* Works both ways. */ + byte fv, ff; + ; + for (fv = 0; fv <= 29; fv ++) + for (ff = 1; ff <= 2; ff ++) + scram1(names[fv][ff]); + scram1(listen); + scram1(flags); } -void save() -{ - string x; untyped_file f; byte minnames,minlines,minpeds,minfields,fv,ff; -; - minnames =0; for( fv=0; fv <= 29; fv ++) if (names[fv][1]!="") minnames =fv; - minlines =0; for( fv=1; fv <= numlines; fv ++) - if (lines[fv].x1!=nay) minlines =fv; - minpeds =0; for( fv=1; fv <= 15; fv ++) if (peds[fv].dir<177) minpeds =fv; - minfields=0; for( fv=1; fv <= 30; fv ++) if (fields[fv].x1!=nay) minfields=fv; - assign(f,string("c:\\avalot\\also")+n+".avd"); - rewrite(f,1); - x=string("This is an Also .AVD file, which belongs to AVALOT.EXE. Its contents")+ - '\15'+'\12'+"are subject to copyright, so there. Have fun!"+'\32'+" *Minstrel* "; - blockwrite(f,x[1],128); - scramble(); - blockwrite(f,minnames,1); - for( fv=0; fv <= minnames; fv ++) - for( ff=1; ff <= 2; ff ++) - blockwrite(f,names[fv][ff],length(names[fv][ff])+1); - blockwrite(f,minlines,1); - blockwrite(f,lines,sizeof(lines[1])*minlines); - blockwrite(f,minpeds,1); - blockwrite(f,peds,sizeof(peds[1])*minpeds); - blockwrite(f,minfields,1); - blockwrite(f,fields,sizeof(fields[1])*minfields); - blockwrite(f,magics,sizeof(magics)); - blockwrite(f,portals,sizeof(portals)); - blockwrite(f,flags,sizeof(flags)); - blockwrite(f,listen[0],1); - blockwrite(f,listen[1],length(listen)); - close(f); - scramble(); +void save() { + string x; + untyped_file f; + byte minnames, minlines, minpeds, minfields, fv, ff; + ; + minnames = 0; + for (fv = 0; fv <= 29; fv ++) if (names[fv][1] != "") minnames = fv; + minlines = 0; + for (fv = 1; fv <= numlines; fv ++) + if (lines[fv].x1 != nay) minlines = fv; + minpeds = 0; + for (fv = 1; fv <= 15; fv ++) if (peds[fv].dir < 177) minpeds = fv; + minfields = 0; + for (fv = 1; fv <= 30; fv ++) if (fields[fv].x1 != nay) minfields = fv; + assign(f, string("c:\\avalot\\also") + n + ".avd"); + rewrite(f, 1); + x = string("This is an Also .AVD file, which belongs to AVALOT.EXE. Its contents") + + '\15' + '\12' + "are subject to copyright, so there. Have fun!" + '\32' + " *Minstrel* "; + blockwrite(f, x[1], 128); + scramble(); + blockwrite(f, minnames, 1); + for (fv = 0; fv <= minnames; fv ++) + for (ff = 1; ff <= 2; ff ++) + blockwrite(f, names[fv][ff], length(names[fv][ff]) + 1); + blockwrite(f, minlines, 1); + blockwrite(f, lines, sizeof(lines[1])*minlines); + blockwrite(f, minpeds, 1); + blockwrite(f, peds, sizeof(peds[1])*minpeds); + blockwrite(f, minfields, 1); + blockwrite(f, fields, sizeof(fields[1])*minfields); + blockwrite(f, magics, sizeof(magics)); + blockwrite(f, portals, sizeof(portals)); + blockwrite(f, flags, sizeof(flags)); + blockwrite(f, listen[0], 1); + blockwrite(f, listen[1], length(listen)); + close(f); + scramble(); } void load(); -static untyped_file f; - - -static string nextstring() -{ - byte l; string x; -string nextstring_result; -; - x=""; blockread(f,l,1); blockread(f,x[1],l); x[0]=chr(l); nextstring_result=x; -return nextstring_result; +static untyped_file f; + + +static string nextstring() { + byte l; + string x; + string nextstring_result; + ; + x = ""; + blockread(f, l, 1); + blockread(f, x[1], l); + x[0] = chr(l); + nextstring_result = x; + return nextstring_result; } -void load() -{ - byte minnames,minlines,minpeds,minfields; byte ff,fv; - -; - clear(); - assign(f,string("c:\\avalot\\also")+n+".avd"); -/*$I-*/ reset(f,1); /*$I+*/ if (ioresult!=0) return; /* no Also file */ - seek(f,128); blockread(f,minnames,1); - for( fv=0; fv <= minnames; fv ++) - for( ff=1; ff <= 2; ff ++) - names[fv][ff]=nextstring(); - blockread(f,minlines,1); - blockread(f,lines,sizeof(lines[1])*minlines); - blockread(f,minpeds,1); - blockread(f,peds,sizeof(peds[1])*minpeds); - blockread(f,minfields,1); - blockread(f,fields,sizeof(fields[1])*minfields); - blockread(f,magics,sizeof(magics)); - blockread(f,portals,sizeof(portals)); - blockread(f,flags,sizeof(flags)); - blockread(f,listen[0],1); - blockread(f,listen[1],length(listen)); - close(f); - scramble(); +void load() { + byte minnames, minlines, minpeds, minfields; + byte ff, fv; + + ; + clear(); + assign(f, string("c:\\avalot\\also") + n + ".avd"); + /*$I-*/ reset(f, 1); /*$I+*/ if (ioresult != 0) return; /* no Also file */ + seek(f, 128); + blockread(f, minnames, 1); + for (fv = 0; fv <= minnames; fv ++) + for (ff = 1; ff <= 2; ff ++) + names[fv][ff] = nextstring(); + blockread(f, minlines, 1); + blockread(f, lines, sizeof(lines[1])*minlines); + blockread(f, minpeds, 1); + blockread(f, peds, sizeof(peds[1])*minpeds); + blockread(f, minfields, 1); + blockread(f, fields, sizeof(fields[1])*minfields); + blockread(f, magics, sizeof(magics)); + blockread(f, portals, sizeof(portals)); + blockread(f, flags, sizeof(flags)); + blockread(f, listen[0], 1); + blockread(f, listen[1], length(listen)); + close(f); + scramble(); } void editmagics(); -const array<1,15,char> codes = "123456789ABCDEF"; +const array<1, 15, char> codes = "123456789ABCDEF"; static integer y; -static void display() -{ - byte fv; -; - cleardevice(); - settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Magics."); - settextstyle(0,0,1); - for( fv=1; fv <= 15; fv ++) - {; - y=23+fv*10; - setcolor(fv); outtextxy(100,y,string('$')+codes[fv-1]); - { - magictype& with = magics[fv]; - ; - switch (with.op) { - case nix: {; setcolor(8); outtextxy(140,y,"Nix"); } break; - case bounce: {; setcolor(10); outtextxy(143,y,"Bounce!"); } break; - case exclaim: {; - setcolor(14); outtextxy(143,y,string("Exclaim: ")+strf(with.data)); - } - break; - case transport: {; - setcolor(12); - outtextxy(143,y,string("Transport to ")+strf(hi(with.data))+ - ", ped "+strf(lo(with.data))); - } - break; - case unfinished: {; - setcolor(15); outtextxy(143,y,"*** UNFINISHED! ***"); - } - break; - case special: {; - setcolor(6); outtextxy(143,y,string("Special call no. ")+strf(with.data)); - } - break; - case opendoor: {; - setcolor(11); - outtextxy(143,y,string("Opening door to ")+strf(hi(with.data))+ - ", ped "+strf(lo(with.data))); - } - break; - } - } - } - outtextxy(177,190,"Which do you want to change\? (Esc=Exit) $"); +static void display() { + byte fv; + ; + cleardevice(); + settextstyle(0, 0, 2); + setcolor(15); + outtextxy(0, 0, "Magics."); + settextstyle(0, 0, 1); + for (fv = 1; fv <= 15; fv ++) { + ; + y = 23 + fv * 10; + setcolor(fv); + outtextxy(100, y, string('$') + codes[fv - 1]); + { + magictype &with = magics[fv]; + ; + switch (with.op) { + case nix: { + ; + setcolor(8); + outtextxy(140, y, "Nix"); + } + break; + case bounce: { + ; + setcolor(10); + outtextxy(143, y, "Bounce!"); + } + break; + case exclaim: { + ; + setcolor(14); + outtextxy(143, y, string("Exclaim: ") + strf(with.data)); + } + break; + case transport: { + ; + setcolor(12); + outtextxy(143, y, string("Transport to ") + strf(hi(with.data)) + + ", ped " + strf(lo(with.data))); + } + break; + case unfinished: { + ; + setcolor(15); + outtextxy(143, y, "*** UNFINISHED! ***"); + } + break; + case special: { + ; + setcolor(6); + outtextxy(143, y, string("Special call no. ") + strf(with.data)); + } + break; + case opendoor: { + ; + setcolor(11); + outtextxy(143, y, string("Opening door to ") + strf(hi(with.data)) + + ", ped " + strf(lo(with.data))); + } + break; + } + } + } + outtextxy(177, 190, "Which do you want to change\? (Esc=Exit) $"); } -static word ask(string x) -{ - string q; word thomaswashere; integer e; -word ask_result; -; - cleardevice(); - setcolor(10); settextstyle(0,0,3); outtextxy(0,100,x); - do { - input >> q >> NL; val(q,thomaswashere,e); - } while (!(e==0)); ask_result=thomaswashere; -return ask_result; +static word ask(string x) { + string q; + word thomaswashere; + integer e; + word ask_result; + ; + cleardevice(); + setcolor(10); + settextstyle(0, 0, 3); + outtextxy(0, 100, x); + do { + input >> q >> NL; + val(q, thomaswashere, e); + } while (!(e == 0)); + ask_result = thomaswashere; + return ask_result; } -void editmagics() -{ - char r,rr; byte p; - -; - do { - display(); - do { - r=upcase(readkey()); - if (r=='\33') return; - p=pos(r,codes); /* which are we editing? */ - } while (!(p>0)); /* it must BE there... */ - setcolor(p); cleardevice(); - outtextxy(177,17,string("Editing magic $")+r+'.'); - outtextxy(0,30,"New operation ( (N)ix, (B)ounce, (E)xclaim, (T)ransport, (U)nfinished),"); - outtextxy(30,40,"(S)pecial, (O)pening Door?"); - do { rr=upcase(readkey()); } while (!(set::of('N','B','E','T','U','S','O','\33', eos).has(rr))); - { magictype& with = magics[p]; - switch (rr) { - case '\33': return; break; /* cancelling code */ - case 'N': with.op=nix; break; - case 'B': with.op=bounce; break; - case 'E': {; with.op=exclaim; with.data=ask("Which scroll?"); } break; - case 'T': {; with.op=transport; with.data=ask("Ped no.?")+ask("Whither?")*256; } break; - case 'U': with.op=unfinished; break; - case 'S': {; with.op=special; with.data=ask("Which call?"); } break; - case 'O': {; with.op=opendoor; with.data=ask("Ped no.?")+ask("Whither?")*256; } break; - }} - } while (!false); +void editmagics() { + char r, rr; + byte p; + + ; + do { + display(); + do { + r = upcase(readkey()); + if (r == '\33') return; + p = pos(r, codes); /* which are we editing? */ + } while (!(p > 0)); /* it must BE there... */ + setcolor(p); + cleardevice(); + outtextxy(177, 17, string("Editing magic $") + r + '.'); + outtextxy(0, 30, "New operation ( (N)ix, (B)ounce, (E)xclaim, (T)ransport, (U)nfinished),"); + outtextxy(30, 40, "(S)pecial, (O)pening Door?"); + do { + rr = upcase(readkey()); + } while (!(set::of('N', 'B', 'E', 'T', 'U', 'S', 'O', '\33', eos).has(rr))); + { + magictype &with = magics[p]; + switch (rr) { + case '\33': + return; + break; /* cancelling code */ + case 'N': + with.op = nix; + break; + case 'B': + with.op = bounce; + break; + case 'E': { + ; + with.op = exclaim; + with.data = ask("Which scroll?"); + } + break; + case 'T': { + ; + with.op = transport; + with.data = ask("Ped no.?") + ask("Whither?") * 256; + } + break; + case 'U': + with.op = unfinished; + break; + case 'S': { + ; + with.op = special; + with.data = ask("Which call?"); + } + break; + case 'O': { + ; + with.op = opendoor; + with.data = ask("Ped no.?") + ask("Whither?") * 256; + } + break; + } + } + } while (!false); } void editportals(); -const array<9,15,char> codes1 = "9ABCDEF"; +const array<9, 15, char> codes1 = "9ABCDEF"; static integer y2; -static void display1() -{ - byte fv; -; - cleardevice(); - settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Portals."); - settextstyle(0,0,1); - for( fv=9; fv <= 15; fv ++) - {; - y2=fv*10-53; - setcolor(fv); outtextxy(100,y2,string('$')+codes1[fv-1]); - { - magictype& with = portals[fv]; - ; - switch (with.op) { - case nix: {; setcolor(8); outtextxy(140,y2,"Nix"); } break; - case exclaim: {; - setcolor(14); outtextxy(143,y2,string("Exclaim: ")+strf(with.data)); - } - break; - case transport: {; - setcolor(12); - outtextxy(143,y2,string("Transport to ")+strf(hi(with.data))+ - ", ped "+strf(lo(with.data))); - } - break; - case unfinished: {; - setcolor(15); outtextxy(143,y2,"*** UNFINISHED! ***"); - } - break; - case special: {; - setcolor(6); outtextxy(143,y2,string("Special call no. ")+strf(with.data)); - } - break; - case opendoor: {; - setcolor(11); - outtextxy(143,y2,string("Opening door to ")+strf(hi(with.data))+ - ", ped "+strf(lo(with.data))); - } - break; - } - } - } - outtextxy(177,190,"Which do you want to change\? (Esc=Exit) $"); +static void display1() { + byte fv; + ; + cleardevice(); + settextstyle(0, 0, 2); + setcolor(15); + outtextxy(0, 0, "Portals."); + settextstyle(0, 0, 1); + for (fv = 9; fv <= 15; fv ++) { + ; + y2 = fv * 10 - 53; + setcolor(fv); + outtextxy(100, y2, string('$') + codes1[fv - 1]); + { + magictype &with = portals[fv]; + ; + switch (with.op) { + case nix: { + ; + setcolor(8); + outtextxy(140, y2, "Nix"); + } + break; + case exclaim: { + ; + setcolor(14); + outtextxy(143, y2, string("Exclaim: ") + strf(with.data)); + } + break; + case transport: { + ; + setcolor(12); + outtextxy(143, y2, string("Transport to ") + strf(hi(with.data)) + + ", ped " + strf(lo(with.data))); + } + break; + case unfinished: { + ; + setcolor(15); + outtextxy(143, y2, "*** UNFINISHED! ***"); + } + break; + case special: { + ; + setcolor(6); + outtextxy(143, y2, string("Special call no. ") + strf(with.data)); + } + break; + case opendoor: { + ; + setcolor(11); + outtextxy(143, y2, string("Opening door to ") + strf(hi(with.data)) + + ", ped " + strf(lo(with.data))); + } + break; + } + } + } + outtextxy(177, 190, "Which do you want to change\? (Esc=Exit) $"); } -static word ask1(string x) -{ - string q; word thomaswashere; integer e; -word ask1_result; -; - cleardevice(); - setcolor(10); settextstyle(0,0,3); outtextxy(0,100,x); - do { - input >> q >> NL; val(q,thomaswashere,e); - } while (!(e==0)); ask1_result=thomaswashere; -return ask1_result; +static word ask1(string x) { + string q; + word thomaswashere; + integer e; + word ask1_result; + ; + cleardevice(); + setcolor(10); + settextstyle(0, 0, 3); + outtextxy(0, 100, x); + do { + input >> q >> NL; + val(q, thomaswashere, e); + } while (!(e == 0)); + ask1_result = thomaswashere; + return ask1_result; } -void editportals() /* much t'same as editmagics */ -{ - char r,rr; byte p; - -; - do { - display1(); - do { - r=upcase(readkey()); - if (r=='\33') return; - p=pos(r,codes1); /* which are we editing? */ - } while (!(p>0)); /* it must BE there... */ - p += 8; setcolor(p); cleardevice(); - outtextxy(177,17,string("Editing portal $")+r+'.'); - outtextxy(0,30,"New operation ( (N)ix, (E)xclaim, (T)ransport, (U)nfinished),"); - outtextxy(30,40,"(S)pecial, (O)pening Door?"); - do { rr=upcase(readkey()); } while (!(set::of('N','E','T','U','S','O','\33', eos).has(rr))); - { magictype& with = portals[p]; - switch (rr) { - case '\33': return; break; /* cancelling code */ - case 'N': with.op=nix; break; - case 'E': {; with.op=exclaim; with.data=ask1("Which scroll?"); } break; - case 'T': {; with.op=transport; with.data=ask1("Ped no.?")+ask1("Whither?")*256; } break; - case 'U': with.op=unfinished; break; - case 'S': {; with.op=special; with.data=ask1("Which call?"); } break; - case 'O': {; with.op=opendoor; with.data=ask1("Ped no.?")+ask1("Whither?")*256; } break; - }} - } while (!false); +void editportals() { /* much t'same as editmagics */ + char r, rr; + byte p; + + ; + do { + display1(); + do { + r = upcase(readkey()); + if (r == '\33') return; + p = pos(r, codes1); /* which are we editing? */ + } while (!(p > 0)); /* it must BE there... */ + p += 8; + setcolor(p); + cleardevice(); + outtextxy(177, 17, string("Editing portal $") + r + '.'); + outtextxy(0, 30, "New operation ( (N)ix, (E)xclaim, (T)ransport, (U)nfinished),"); + outtextxy(30, 40, "(S)pecial, (O)pening Door?"); + do { + rr = upcase(readkey()); + } while (!(set::of('N', 'E', 'T', 'U', 'S', 'O', '\33', eos).has(rr))); + { + magictype &with = portals[p]; + switch (rr) { + case '\33': + return; + break; /* cancelling code */ + case 'N': + with.op = nix; + break; + case 'E': { + ; + with.op = exclaim; + with.data = ask1("Which scroll?"); + } + break; + case 'T': { + ; + with.op = transport; + with.data = ask1("Ped no.?") + ask1("Whither?") * 256; + } + break; + case 'U': + with.op = unfinished; + break; + case 'S': { + ; + with.op = special; + with.data = ask1("Which call?"); + } + break; + case 'O': { + ; + with.op = opendoor; + with.data = ask1("Ped no.?") + ask1("Whither?") * 256; + } + break; + } + } + } while (!false); } -void editflags() -{ - char r; -; - cleardevice(); - settextstyle(0,0,2); setcolor(15); outtextxy(0,0,"Flags."); - settextstyle(0,0,1); setcolor(10); - outtextxy(100,30,"Press the letter of the flag you want to toggle."); - outtextxy(100,40,"Tab = flip screens, Esc/Enter = return to menu."); - setcolor(14); setfillstyle(1,0); - for( r='A'; r <= 'Z'; r ++) - if (pos(r,flags)>0) outtextxy(ord(r)*20-1223,77,r); - do { - do { r=upcase(readkey()); } while (!(set::of(range('A','Z'),'\33','\15','\11', eos).has(r))); - switch (r) { - case RANGE_26('A','Z'): {; - if (pos(r,flags)>0) - {; /* flag is on- switch it off */ - Delete(flags,pos(r,flags),1); - bar(ord(r)*20-1223,77,ord(r)*20-1213,87); - sound(1777); delay(7); nosound; - } else - {; /* flag is off- switch it on */ - flags=flags+r; - outtextxy(ord(r)*20-1223,77,r); - sound(177); delay(7); nosound; - } - } - break; - case '\33':case '\15': return; break; - case '\11': flipover(); break; - } - } while (!false); +void editflags() { + char r; + ; + cleardevice(); + settextstyle(0, 0, 2); + setcolor(15); + outtextxy(0, 0, "Flags."); + settextstyle(0, 0, 1); + setcolor(10); + outtextxy(100, 30, "Press the letter of the flag you want to toggle."); + outtextxy(100, 40, "Tab = flip screens, Esc/Enter = return to menu."); + setcolor(14); + setfillstyle(1, 0); + for (r = 'A'; r <= 'Z'; r ++) + if (pos(r, flags) > 0) outtextxy(ord(r) * 20 - 1223, 77, r); + do { + do { + r = upcase(readkey()); + } while (!(set::of(range('A', 'Z'), '\33', '\15', '\11', eos).has(r))); + switch (r) { + case RANGE_26('A', 'Z'): { + ; + if (pos(r, flags) > 0) { + ; /* flag is on- switch it off */ + Delete(flags, pos(r, flags), 1); + bar(ord(r) * 20 - 1223, 77, ord(r) * 20 - 1213, 87); + sound(1777); + delay(7); + nosound; + } else { + ; /* flag is off- switch it on */ + flags = flags + r; + outtextxy(ord(r) * 20 - 1223, 77, r); + sound(177); + delay(7); + nosound; + } + } + break; + case '\33': + case '\15': + return; + break; + case '\11': + flipover(); + break; + } + } while (!false); } -void alsomenu() -{ - char r; byte t; -; - do { - setactivepage(0); setvisualpage(0); - cleardevice(); setcolor(15); settextstyle(0,0,2); - outtextxy(0,0,"Also... Main Menu"); - settextstyle(0,0,1); setcolor(10); - outtextxy(100, 40,"1) Edit the names of an object"); - outtextxy(100, 50,"2) View all names"); - outtextxy(100, 60,"3) Edit the description of this object"); - outtextxy(100, 70,"4) View all associations."); - outtextxy(100, 80,"5) Enter Lino mode."); - outtextxy(100, 90,"6) Edit magics."); - outtextxy(100,100,"7) Edit portals."); - outtextxy(100,110,"8) Edit flags."); - outtextxy(100,120,"9) Edit listen field."); - outtextxy(100,160,"S) Save"); - outtextxy(100,170,"L) Load"); - outtextxy( 80,180,"Tab) View other screen"); - if (current==0) outtextxy(0,140,"< Main description of room >"); else - outtextxy(0,140,string('<')+names[current][1]+'>'); - do { - r=upcase(readkey()); if (r=='\11') flipover(); - } while (!(set::of(range('1','9'),'S','L','\0', eos).has(r))); - switch (r) { - case '1': {; - do { - t=typeno("Which object\? (0-30)"); - } while (!((t<30) || (t==255))); - if ((t!=255) && (t!=0)) names[t][1]=typein(names[t][1]); - current=t; - } - break; - case '2': showallnames(); break; - case '3': names[current][2]=typein(names[current][2]); break; - case '4': showallassoc(); break; - case '5': lino(); break; - case '6': editmagics(); break; - case '7': editportals(); break; - case '8': editflags(); break; - case '9': listen=typein(listen); break; - case 'S': save(); break; - case 'L': load(); break; - case '\0': if (readkey()=='\55') return; break; - } - } while (!false); +void alsomenu() { + char r; + byte t; + ; + do { + setactivepage(0); + setvisualpage(0); + cleardevice(); + setcolor(15); + settextstyle(0, 0, 2); + outtextxy(0, 0, "Also... Main Menu"); + settextstyle(0, 0, 1); + setcolor(10); + outtextxy(100, 40, "1) Edit the names of an object"); + outtextxy(100, 50, "2) View all names"); + outtextxy(100, 60, "3) Edit the description of this object"); + outtextxy(100, 70, "4) View all associations."); + outtextxy(100, 80, "5) Enter Lino mode."); + outtextxy(100, 90, "6) Edit magics."); + outtextxy(100, 100, "7) Edit portals."); + outtextxy(100, 110, "8) Edit flags."); + outtextxy(100, 120, "9) Edit listen field."); + outtextxy(100, 160, "S) Save"); + outtextxy(100, 170, "L) Load"); + outtextxy(80, 180, "Tab) View other screen"); + if (current == 0) outtextxy(0, 140, "< Main description of room >"); + else + outtextxy(0, 140, string('<') + names[current][1] + '>'); + do { + r = upcase(readkey()); + if (r == '\11') flipover(); + } while (!(set::of(range('1', '9'), 'S', 'L', '\0', eos).has(r))); + switch (r) { + case '1': { + ; + do { + t = typeno("Which object\? (0-30)"); + } while (!((t < 30) || (t == 255))); + if ((t != 255) && (t != 0)) names[t][1] = typein(names[t][1]); + current = t; + } + break; + case '2': + showallnames(); + break; + case '3': + names[current][2] = typein(names[current][2]); + break; + case '4': + showallassoc(); + break; + case '5': + lino(); + break; + case '6': + editmagics(); + break; + case '7': + editportals(); + break; + case '8': + editflags(); + break; + case '9': + listen = typein(listen); + break; + case 'S': + save(); + break; + case 'L': + load(); + break; + case '\0': + if (readkey() == '\55') return; + break; + } + } while (!false); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - output << "*** ALSO ***" << NL; - output << NL; - output << "No. of screen to edit?"; input >> n >> NL; load(); - assign(f,"v:avalot.fnt"); reset(f); f >> skinny; close(f); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); current=0; - loadscreen(); - alsomenu(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + output << "*** ALSO ***" << NL; + output << NL; + output << "No. of screen to edit?"; + input >> n >> NL; + load(); + assign(f, "v:avalot.fnt"); + reset(f); + f >> skinny; + close(f); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + current = 0; + loadscreen(); + alsomenu(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index df654117b8e6..b57585d3c6d4 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,119 +33,128 @@ namespace Avalanche { const integer taboo = cyan; struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of all the pictures */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of all the pictures */ }; -integer gd,gm; +integer gd, gm; adxtype adx; -matrix<1,24,0,1,pointer> adxpic; /* the pictures themselves */ -untyped_file f; string x; byte n; - -void load(string nam) -{ - byte z; - array<1,4,pointer> a; - untyped_file f; word s; - varying_string<40> xxx; - string check; - -; - assign(f,nam); - reset(f,1); - blockread(f,xxx,41); - blockread(f,check,13); - blockread(f,check,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(a[z],s); - blockread(f,a[z],s); - putimage(0,15+(z-1)*75,a[z],0); - freemem(a[z],s); - } - close(f); +matrix<1, 24, 0, 1, pointer> adxpic; /* the pictures themselves */ +untyped_file f; +string x; +byte n; + +void load(string nam) { + byte z; + array<1, 4, pointer> a; + untyped_file f; + word s; + varying_string<40> xxx; + string check; + + ; + assign(f, nam); + reset(f, 1); + blockread(f, xxx, 41); + blockread(f, check, 13); + blockread(f, check, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(a[z], s); + blockread(f, a[z], s); + putimage(0, 15 + (z - 1) * 75, a[z], 0); + freemem(a[z], s); + } + close(f); } -void silhouette() -{ - byte x,y,c; -; - setvisualpage(1); setactivepage(1); setfillstyle(1,15); - for( gm=0; gm <= 3; gm ++) - for( gd=1; gd <= 6; gd ++) - {; /* 26,15 */ -/* bar((gm div 2)*320+gd*40,20+(gm mod 2)*40,(gm div 2)*320+gd*40+35,(gm mod 2)*40+60); */ - for( y=1; y <= adx.yl; y ++) - for( x=1; x <= adx.xl; x ++) - {; - setactivepage(0); - c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); - setactivepage(1); -/* if c<>taboo then putpixel((gm div 2)*320+gd*40+x,20+(gm mod 2)*40+y,0); */ - if (c==taboo) putpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y,15); - } - getmem(adxpic[gm*6+gd][0],adx.size); - getimage((gm / 2)*320+gd*40+1,20+(gm % 2)*40+1, - (gm / 2)*320+gd*40+adx.xl,20+(gm % 2)*40+adx.yl, - adxpic[gm*6+gd][0]); - } +void silhouette() { + byte x, y, c; + ; + setvisualpage(1); + setactivepage(1); + setfillstyle(1, 15); + for (gm = 0; gm <= 3; gm ++) + for (gd = 1; gd <= 6; gd ++) { + ; /* 26,15 */ + /* bar((gm div 2)*320+gd*40,20+(gm mod 2)*40,(gm div 2)*320+gd*40+35,(gm mod 2)*40+60); */ + for (y = 1; y <= adx.yl; y ++) + for (x = 1; x <= adx.xl; x ++) { + ; + setactivepage(0); + c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); + setactivepage(1); + /* if c<>taboo then putpixel((gm div 2)*320+gd*40+x,20+(gm mod 2)*40+y,0); */ + if (c == taboo) putpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y, 15); + } + getmem(adxpic[gm * 6 + gd][0], adx.size); + getimage((gm / 2) * 320 + gd * 40 + 1, 20 + (gm % 2) * 40 + 1, + (gm / 2) * 320 + gd * 40 + adx.xl, 20 + (gm % 2) * 40 + adx.yl, + adxpic[gm * 6 + gd][0]); + } } -void standard() -{ - byte x,y,c; -; - setvisualpage(2); setactivepage(2); - for( gm=0; gm <= 3; gm ++) - for( gd=1; gd <= 6; gd ++) - {; /* 26,15 */ - for( y=1; y <= adx.yl; y ++) - for( x=1; x <= adx.xl; x ++) - {; - setactivepage(0); - c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); - setactivepage(2); - if (c!=taboo) putpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y,c); - } - getmem(adxpic[gm*6+gd][1],adx.size); - getimage((gm / 2)*320+gd*40+1,20+(gm % 2)*40+1, - (gm / 2)*320+gd*40+adx.xl,20+(gm % 2)*40+adx.yl, - adxpic[gm*6+gd][1]); - } +void standard() { + byte x, y, c; + ; + setvisualpage(2); + setactivepage(2); + for (gm = 0; gm <= 3; gm ++) + for (gd = 1; gd <= 6; gd ++) { + ; /* 26,15 */ + for (y = 1; y <= adx.yl; y ++) + for (x = 1; x <= adx.xl; x ++) { + ; + setactivepage(0); + c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); + setactivepage(2); + if (c != taboo) putpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y, c); + } + getmem(adxpic[gm * 6 + gd][1], adx.size); + getimage((gm / 2) * 320 + gd * 40 + 1, 20 + (gm % 2) * 40 + 1, + (gm / 2) * 320 + gd * 40 + adx.xl, 20 + (gm % 2) * 40 + adx.yl, + adxpic[gm * 6 + gd][1]); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); fillchar(adxpic,sizeof(adxpic),'\261'); - load("v:avalots.avd"); -/* getmem(adxpic[1,1,1],adx.size); getimage(40,20,75,60,adxpic[1,1,1]^); - putimage(100,100,adxpic[1,1,1]^,0); */ - {; - adx.name="Avalot"; - adx.num=24; adx.seq=6; - adx.xl=32; adx.yl=35; /* 35,40 */ - - adx.size=imagesize(40,20,40+adx.xl,60+adx.yl); - } - silhouette(); - standard(); - x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; - assign(f,"v:sprite1.avd"); - rewrite(f,1); - blockwrite(f,x[1],59); - blockwrite(f,adx,sizeof(adx)); - for( gd=1; gd <= adx.num; gd ++) - for( gm=0; gm <= 1; gm ++) - blockwrite(f,adxpic[gd][gm],adx.size); /* next image */ - close(f); - closegraph(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + fillchar(adxpic, sizeof(adxpic), '\261'); + load("v:avalots.avd"); + /* getmem(adxpic[1,1,1],adx.size); getimage(40,20,75,60,adxpic[1,1,1]^); + putimage(100,100,adxpic[1,1,1]^,0); */ + { + ; + adx.name = "Avalot"; + adx.num = 24; + adx.seq = 6; + adx.xl = 32; + adx.yl = 35; /* 35,40 */ + + adx.size = imagesize(40, 20, 40 + adx.xl, 60 + adx.yl); + } + silhouette(); + standard(); + x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; + assign(f, "v:sprite1.avd"); + rewrite(f, 1); + blockwrite(f, x[1], 59); + blockwrite(f, adx, sizeof(adx)); + for (gd = 1; gd <= adx.num; gd ++) + for (gm = 0; gm <= 1; gm ++) + blockwrite(f, adxpic[gd][gm], adx.size); /* next image */ + close(f); + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index 136f719afe5c..605a18534308 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,130 +33,144 @@ namespace Avalanche { const integer taboo = cyan; struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of all the pictures */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of all the pictures */ + byte fgc, bgc; /* foreground & background bubble colours */ }; -integer gd,gm; +integer gd, gm; adxtype adx; -array<0,1,pointer> adxpic; /* the pictures themselves */ -untyped_file f; string x; byte n; integer side2; word bigsize; - -void load(string n) -{ - byte z; - array<1,4,pointer> a; - untyped_file f; word s; - varying_string<40> xxx; - string check; - -; - assign(f,n); - reset(f,1); - blockread(f,xxx,41); - blockread(f,check,13); - blockread(f,check,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(a[z],s); - blockread(f,a[z],s); - putimage(0,15+(z-1)*75,a[z],0); - freemem(a[z],s); - } - close(f); +array<0, 1, pointer> adxpic; /* the pictures themselves */ +untyped_file f; +string x; +byte n; +integer side2; +word bigsize; + +void load(string n) { + byte z; + array<1, 4, pointer> a; + untyped_file f; + word s; + varying_string<40> xxx; + string check; + + ; + assign(f, n); + reset(f, 1); + blockread(f, xxx, 41); + blockread(f, check, 13); + blockread(f, check, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(a[z], s); + blockread(f, a[z], s); + putimage(0, 15 + (z - 1) * 75, a[z], 0); + freemem(a[z], s); + } + close(f); } -void silhouette() -{ - byte x,y,c; -; - setvisualpage(1); setactivepage(1); setfillstyle(1,15); - {; - for( gm=0; gm <= 3; gm ++) - for( gd=1; gd <= 6; gd ++) - {; /* 26,15 */ - side2=adx.xl*6; - for( y=1; y <= adx.yl; y ++) - for( x=1; x <= adx.xl; x ++) - {; - setactivepage(0); - c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); - setactivepage(1); - if (c==taboo) - putpixel((gm / 2)*side2+gd*adx.xl+x,20+(gm % 2)*adx.yl+y,15); - } - } - bigsize=imagesize(adx.xl+1,21,adx.xl*13,20+adx.yl*2); - getmem(adxpic[0],bigsize); - getimage(adx.xl+1,21,adx.xl*13,20+adx.yl*2,adxpic[0]); - putimage(adx.xl+1,21,adxpic[0],notput); - } +void silhouette() { + byte x, y, c; + ; + setvisualpage(1); + setactivepage(1); + setfillstyle(1, 15); + { + ; + for (gm = 0; gm <= 3; gm ++) + for (gd = 1; gd <= 6; gd ++) { + ; /* 26,15 */ + side2 = adx.xl * 6; + for (y = 1; y <= adx.yl; y ++) + for (x = 1; x <= adx.xl; x ++) { + ; + setactivepage(0); + c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); + setactivepage(1); + if (c == taboo) + putpixel((gm / 2)*side2 + gd * adx.xl + x, 20 + (gm % 2)*adx.yl + y, 15); + } + } + bigsize = imagesize(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2); + getmem(adxpic[0], bigsize); + getimage(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2, adxpic[0]); + putimage(adx.xl + 1, 21, adxpic[0], notput); + } } -void standard() -{ - byte x,y,c; -; - setvisualpage(2); setactivepage(2); - {; - for( gm=0; gm <= 3; gm ++) - for( gd=1; gd <= 6; gd ++) - {; /* 26,15 */ - for( y=1; y <= adx.yl; y ++) - for( x=1; x <= adx.xl; x ++) - {; - setactivepage(0); - c=getpixel((gm / 2)*320+gd*40+x,20+(gm % 2)*40+y); - setactivepage(2); - if (c!=taboo) - putpixel((gm / 2)*side2+gd*adx.xl+x,20+(gm % 2)*adx.yl+y,c); - } -/* getmem(adxpic[gm*6+gd,1],adx.size); - getimage((gm div 2)*side2+gd*xl+x,20+(gm mod 2)*yl+y, - (gm div 2)*side2+gd*xl*2+x,20+(gm mod 2)*yl*2+y, - adxpic[gm*6+gd,1]^); */ - } - getmem(adxpic[1],bigsize); - getimage(adx.xl+1,21,adx.xl*13,20+adx.yl*2,adxpic[1]); - putimage(adx.xl+1,21,adxpic[1],notput); - } +void standard() { + byte x, y, c; + ; + setvisualpage(2); + setactivepage(2); + { + ; + for (gm = 0; gm <= 3; gm ++) + for (gd = 1; gd <= 6; gd ++) { + ; /* 26,15 */ + for (y = 1; y <= adx.yl; y ++) + for (x = 1; x <= adx.xl; x ++) { + ; + setactivepage(0); + c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); + setactivepage(2); + if (c != taboo) + putpixel((gm / 2)*side2 + gd * adx.xl + x, 20 + (gm % 2)*adx.yl + y, c); + } + /* getmem(adxpic[gm*6+gd,1],adx.size); + getimage((gm div 2)*side2+gd*xl+x,20+(gm mod 2)*yl+y, + (gm div 2)*side2+gd*xl*2+x,20+(gm mod 2)*yl*2+y, + adxpic[gm*6+gd,1]^); */ + } + getmem(adxpic[1], bigsize); + getimage(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2, adxpic[1]); + putimage(adx.xl + 1, 21, adxpic[1], notput); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); fillchar(adxpic,sizeof(adxpic),'\261'); - load("v:avalots.avd"); - {; - adx.name="Avalot"; - adx.num=24; adx.seq=6; - adx.xl=33; adx.yl=35; /* 35,40 */ - adx.fgc=yellow; adx.bgc=red; - - adx.size=imagesize(40,20,40+adx.xl,60+adx.yl); - } - silhouette(); - standard(); - x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; - assign(f,"v:sprite1.avd"); - rewrite(f,1); - blockwrite(f,x[1],59); - blockwrite(f,adx,sizeof(adx)); - blockwrite(f,bigsize,2); - for( gm=0; gm <= 1; gm ++) - {; - putimage(0,0,adxpic[gm],0); - blockwrite(f,adxpic[gm],bigsize); /* next image */ - } - close(f); - closegraph(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + fillchar(adxpic, sizeof(adxpic), '\261'); + load("v:avalots.avd"); + { + ; + adx.name = "Avalot"; + adx.num = 24; + adx.seq = 6; + adx.xl = 33; + adx.yl = 35; /* 35,40 */ + adx.fgc = yellow; + adx.bgc = red; + + adx.size = imagesize(40, 20, 40 + adx.xl, 60 + adx.yl); + } + silhouette(); + standard(); + x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; + assign(f, "v:sprite1.avd"); + rewrite(f, 1); + blockwrite(f, x[1], 59); + blockwrite(f, adx, sizeof(adx)); + blockwrite(f, bigsize, 2); + for (gm = 0; gm <= 1; gm ++) { + ; + putimage(0, 0, adxpic[gm], 0); + blockwrite(f, adxpic[gm], bigsize); /* next image */ + } + close(f); + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index 2cfe410b9863..b5e1d9a5badf 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,63 +29,78 @@ namespace Avalanche { -typedef matrix<1,24,0,1,pointer> adxtype; +typedef matrix<1, 24, 0, 1, pointer> adxtype; -integer gd,gm; -word s; untyped_file f; byte n,anim,cp,t; -array<0,0,adxtype> adx; -array<0,1,pointer> back; +integer gd, gm; +word s; +untyped_file f; +byte n, anim, cp, t; +array<0, 0, adxtype> adx; +array<0, 1, pointer> back; integer x; -array<0,1,integer> ox; +array<0, 1, integer> ox; -void andex(integer x,integer y, byte n,byte num) -{; - putimage(x,y,adx[num][n][0],andput); - putimage(x,y,adx[num][n][1],xorput); +void andex(integer x, integer y, byte n, byte num) { + ; + putimage(x, y, adx[num][n][0], andput); + putimage(x, y, adx[num][n][1], xorput); } -void loadadx(byte num, string x) -{ - byte n; -; - assign(f,x); - reset(f,1); seek(f,59); - blockread(f,n,1); /* No. of images... */ - for( gd=1; gd <= n; gd ++) - for( gm=0; gm <= 1; gm ++) - {; - blockread(f,s,2); /* size of next image... */ - getmem(adx[num][gd][gm],s); - blockread(f,adx[num][gd][gm],s); /* next image */ - } - close(f); +void loadadx(byte num, string x) { + byte n; + ; + assign(f, x); + reset(f, 1); + seek(f, 59); + blockread(f, n, 1); /* No. of images... */ + for (gd = 1; gd <= n; gd ++) + for (gm = 0; gm <= 1; gm ++) { + ; + blockread(f, s, 2); /* size of next image... */ + getmem(adx[num][gd][gm], s); + blockread(f, adx[num][gd][gm], s); /* next image */ + } + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - loadadx(0,"d:sprite0.avd"); - loadadx(1,"d:sprite0.avd"); - gd=3; gm=0; initgraph(gd,gm,""); - for( gd=0; gd <= 1; gd ++) - {; - setactivepage(gd); setfillstyle(6,1); bar(0,0,640,200); - getmem(back[gd],s); - } - x=0; anim=1; cp=0; t=2; setactivepage(0); - do { - setactivepage(cp); setvisualpage(1-cp); - for( gm=0; gm <= 1; gm ++) - {; - if (t>0) t -= 1; else - putimage(ox[cp],77,back[cp],copyput); - getimage(x,77,x+31,77+35,back[cp]); - andex(x,177,anim+6,gm); - ox[gm][cp]=x; x += 5; - } - anim += 1; if (anim==7) anim=1;cp=1-cp; - } while (!false); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + loadadx(0, "d:sprite0.avd"); + loadadx(1, "d:sprite0.avd"); + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + for (gd = 0; gd <= 1; gd ++) { + ; + setactivepage(gd); + setfillstyle(6, 1); + bar(0, 0, 640, 200); + getmem(back[gd], s); + } + x = 0; + anim = 1; + cp = 0; + t = 2; + setactivepage(0); + do { + setactivepage(cp); + setvisualpage(1 - cp); + for (gm = 0; gm <= 1; gm ++) { + ; + if (t > 0) t -= 1; + else + putimage(ox[cp], 77, back[cp], copyput); + getimage(x, 77, x + 31, 77 + 35, back[cp]); + andex(x, 177, anim + 6, gm); + ox[gm][cp] = x; + x += 5; + } + anim += 1; + if (anim == 7) anim = 1; + cp = 1 - cp; + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index 815018df8a33..2172a574a0e4 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,7 +33,7 @@ ENID Edna's manager. */ #define __arch_implementation__ - /* Loads/ saves files. */ +/* Loads/ saves files. */ #include "arch.h" @@ -44,105 +44,105 @@ namespace Avalanche { struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS. See below for others.) */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS. See below for others.) */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ }; - /* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ -const string crlf = string('\15')+'\12'; - -const array<1,177,char> ednafirst = - string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!")+crlf+ - '\32'+ /* 67 bytes... */ - crlf+crlf+ /* 71 bytes... */ - "12345678901234567890123456789012345678901234567890"+ - "12345678901234567890123456789012345678901234567890"+ - "123456"; +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ +const string crlf = string('\15') + '\12'; + +const array<1, 177, char> ednafirst = + string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + crlf + + '\32' + /* 67 bytes... */ + crlf + crlf + /* 71 bytes... */ + "12345678901234567890123456789012345678901234567890" + + "12345678901234567890123456789012345678901234567890" + + "123456"; const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; -const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; +const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; const integer ttage = 18; const char ttwashere[] = "Thomas was here "; -void save(string name) -{ - untyped_file f; - edhead eh; - word groi; - string groi2; -; - fillchar(eh,sizeof(eh),'\261'); /* Fill up the edhead */ +void save(string name) { + untyped_file f; + edhead eh; + word groi; + string groi2; + ; + fillchar(eh, sizeof(eh), '\261'); /* Fill up the edhead */ - dna.saves += 1; /* It's been saved one more time... */ + dna.saves += 1; /* It's been saved one more time... */ - {; + { + ; - /* Info about this program */ + /* Info about this program */ - id=ednaid; /* Edna's signature */ - revision=2; /* Second revision of .ASG format */ - game="Lord Avalot d'Argent"; /* Title of game */ - shortname="Avalot"; - number=2; /* Second Avvy game */ - ver=100; /* Version 1.00 */ - verstr="1.00"; /* ditto */ - filename="AVALOT.EXE"; /* program's filename */ - os=1; /* Saved under DOS */ + id = ednaid; /* Edna's signature */ + revision = 2; /* Second revision of .ASG format */ + game = "Lord Avalot d'Argent"; /* Title of game */ + shortname = "Avalot"; + number = 2; /* Second Avvy game */ + ver = 100; /* Version 1.00 */ + verstr = "1.00"; /* ditto */ + filename = "AVALOT.EXE"; /* program's filename */ + os = 1; /* Saved under DOS */ - /* Info on this particular game */ + /* Info on this particular game */ - fsplit(name,groi2,fn,groi2); /* fn = filename of this game */ - getdate(d,m,y,groi); /* Day, month & year when the game was saved */ - desc=roomname; /* Description of game (same as in Avaricius!) */ - len=sizeof(dna); /* Length of DNA (it's not going to be above 65535!) */ + fsplit(name, groi2, fn, groi2); /* fn = filename of this game */ + getdate(d, m, y, groi); /* Day, month & year when the game was saved */ + desc = roomname; /* Description of game (same as in Avaricius!) */ + len = sizeof(dna); /* Length of DNA (it's not going to be above 65535!) */ - /* Quick reference & miscellaneous */ + /* Quick reference & miscellaneous */ - saves=dna.saves; /* no. of times this game has been saved */ - cash=dna.pence; /* contents of your wallet in numerical form */ - money=lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ - points=dna.score; /* your score */ - } + saves = dna.saves; /* no. of times this game has been saved */ + cash = dna.pence; /* contents of your wallet in numerical form */ + money = lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ + points = dna.score; /* your score */ + } - assign(f,name); - rewrite(f,1); + assign(f, name); + rewrite(f, 1); - blockwrite(f,ednafirst,177); - blockwrite(f,eh,sizeof(eh)); - blockwrite(f,dna,sizeof(dna)); + blockwrite(f, ednafirst, 177); + blockwrite(f, eh, sizeof(eh)); + blockwrite(f, dna, sizeof(dna)); - for( groi=1; groi <= ttage; groi ++) - blockwrite(f,ttwashere,sizeof(ttwashere)); + for (groi = 1; groi <= ttage; groi ++) + blockwrite(f, ttwashere, sizeof(ttwashere)); - close(f); + close(f); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h index 840ceb446eff..3bff07ad2cd7 100644 --- a/engines/avalanche/arch.h +++ b/engines/avalanche/arch.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp index f793fa5402be..7351d0806079 100644 --- a/engines/avalanche/avalot9.cpp +++ b/engines/avalanche/avalot9.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -53,89 +53,120 @@ namespace Avalanche { -void setup() -{ - integer gd,gm; - - checkbreak=false; visible=m_no; to_do=0; lmo=false; resetscroll; - Randomize(); setup_vmc; on_virtual; - gd=3; gm=0; initgraph(gd,gm,""); - holdthedawn=true; dusk; - cmp=177; mouse_init; /*on;*/ dropsok=true; ctrl=ckey; oldjw=177; - mousetext=""; c=999; settextjustify(0,0); ddmnow=false; load_digits; - cheat=false; cp=0; curpos=1; - quote=true; ledstatus=177; defaultled=2; -/* TSkellern:=0; { Replace with a more local variable sometime }*/ - dna.rw=stopped; enid_filename=""; /* undefined. */ - toolbar; state(2); copy03; lastscore="TJA"; - -/* for gd:=0 to 1 do - begin - setactivepage(gd); outtextxy(7,177,chr(48+gd)); - end;*/ - - loadtrip; - - if ((filetoload=="") & (~ reloaded)) - newgame; /* no game was requested- load the default */ - else { - if (~ reloaded) avvy_background; - standard_bar; sprite_run; - if (reloaded) edna_reload; else - { /* Filename given on the command line (or loadfirst) */ - edna_load(filetoload); - if (there_was_a_problem) - { - display("So let's start from the beginning instead..."); - holdthedawn=true; dusk; newgame; - } - } - } - - if (~ reloaded) - { - soundfx=~ soundfx; fxtoggle; - thinkabout(money,a_thing); - } - - get_back_loretta; gm=getpixel(0,0); setcolor(7); - holdthedawn=false; dawn; cursoron=false; cursor_on; newspeed; - - if (~ reloaded) - dixi('q',83); /* Info on the game, etc. */ +void setup() { + integer gd, gm; + + checkbreak = false; + visible = m_no; + to_do = 0; + lmo = false; + resetscroll; + Randomize(); + setup_vmc; + on_virtual; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + holdthedawn = true; + dusk; + cmp = 177; + mouse_init; /*on;*/ dropsok = true; + ctrl = ckey; + oldjw = 177; + mousetext = ""; + c = 999; + settextjustify(0, 0); + ddmnow = false; + load_digits; + cheat = false; + cp = 0; + curpos = 1; + quote = true; + ledstatus = 177; + defaultled = 2; + /* TSkellern:=0; { Replace with a more local variable sometime }*/ + dna.rw = stopped; + enid_filename = ""; /* undefined. */ + toolbar; + state(2); + copy03; + lastscore = "TJA"; + + /* for gd:=0 to 1 do + begin + setactivepage(gd); outtextxy(7,177,chr(48+gd)); + end;*/ + + loadtrip; + + if ((filetoload == "") & (~ reloaded)) + newgame; /* no game was requested- load the default */ + else { + if (~ reloaded) avvy_background; + standard_bar; + sprite_run; + if (reloaded) edna_reload; + else { + /* Filename given on the command line (or loadfirst) */ + edna_load(filetoload); + if (there_was_a_problem) { + display("So let's start from the beginning instead..."); + holdthedawn = true; + dusk; + newgame; + } + } + } + + if (~ reloaded) { + soundfx = ~ soundfx; + fxtoggle; + thinkabout(money, a_thing); + } + + get_back_loretta; + gm = getpixel(0, 0); + setcolor(7); + holdthedawn = false; + dawn; + cursoron = false; + cursor_on; + newspeed; + + if (~ reloaded) + dixi('q', 83); /* Info on the game, etc. */ } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - setup(); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + setup(); - do { + do { - clock; - keyboard_link; - menu_link; - readstick; - force_numlock; - get_back_loretta; - trippancy_link; - pics_link; - checkclick; + clock; + keyboard_link; + menu_link; + readstick; + force_numlock; + get_back_loretta; + trippancy_link; + pics_link; + checkclick; - if (visible==m_virtual) plot_vmc(mx,my,cp); - flip_page; /* << fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; fonttype font; -word storage_seg,storage_ofs; +word storage_seg, storage_ofs; byte result; string registrant; -void icons() -{ - untyped_file f; - word gd,gm; byte bit; - byte v; - - assign(f,"menu.avd"); - reset(f,1); - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( gd=70; gd <= 266; gd ++) - blockread(f,mem[0xa000*gd*80+6],9); - - for( gd=0; gd <= 32; gd ++) - { - blockread(f,v,1); - for( gm=0; gm <= 5; gm ++) - mem[0xa000*73+((70+gd+gm*33)*80)]=v; /* 79 */ - } - - } - close(f); - - bit=getpixel(0,0); - - setfillstyle(1, 7); for( gd=0; gd <= 5; gd ++) bar(114, 73+gd*33,583, 99+gd*33); - setfillstyle(1,15); for( gd=0; gd <= 5; gd ++) bar(114, 70+gd*33,583, 72+gd*33); - setfillstyle(1, 8); for( gd=0; gd <= 5; gd ++) bar(114,100+gd*33,583,102+gd*33); +void icons() { + untyped_file f; + word gd, gm; + byte bit; + byte v; + + assign(f, "menu.avd"); + reset(f, 1); + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (gd = 70; gd <= 266; gd ++) + blockread(f, mem[0xa000 * gd * 80 + 6], 9); + + for (gd = 0; gd <= 32; gd ++) { + blockread(f, v, 1); + for (gm = 0; gm <= 5; gm ++) + mem[0xa000 * 73 + ((70 + gd + gm * 33) * 80)] = v; /* 79 */ + } + + } + close(f); + + bit = getpixel(0, 0); + + setfillstyle(1, 7); + for (gd = 0; gd <= 5; gd ++) bar(114, 73 + gd * 33, 583, 99 + gd * 33); + setfillstyle(1, 15); + for (gd = 0; gd <= 5; gd ++) bar(114, 70 + gd * 33, 583, 72 + gd * 33); + setfillstyle(1, 8); + for (gd = 0; gd <= 5; gd ++) bar(114, 100 + gd * 33, 583, 102 + gd * 33); } void load_regi_info(); -static char decode1(char c) -{ - byte b; +static char decode1(char c) { + byte b; - char decode1_result; - b=ord(c)-32; - decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; + char decode1_result; + b = ord(c) - 32; + decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; } -static char decode2(char c) -{ - char decode2_result; - decode2_result=chr( ((ord(c) & 0xf) << 2) + 0x43); - return decode2_result; +static char decode2(char c) { + char decode2_result; + decode2_result = chr(((ord(c) & 0xf) << 2) + 0x43); + return decode2_result; } -static boolean checker(string proper,string check) -{ - byte fv; boolean ok; +static boolean checker(string proper, string check) { + byte fv; + boolean ok; - boolean checker_result; - ok=true; - for( fv=1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) - ok=false; + boolean checker_result; + ok = true; + for (fv = 1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) + ok = false; - checker_result=ok; - return checker_result; + checker_result = ok; + return checker_result; } -void load_regi_info() -{ - text t; - byte fv; - string x; - byte namelen,numlen; - string namechk,numchk; - string reginum; +void load_regi_info() { + text t; + byte fv; + string x; + byte namelen, numlen; + string namechk, numchk; + string reginum; - /*$I-*/ - assign(t,"register.dat"); reset(t); - /*$I+*/ + /*$I-*/ + assign(t, "register.dat"); + reset(t); + /*$I+*/ - if (ioresult!=0) - { - registrant="(Unregistered evaluation copy.)"; - return; - } + if (ioresult != 0) { + registrant = "(Unregistered evaluation copy.)"; + return; + } - for( fv=1; fv <= 53; fv ++) t >> NL; - t >> x >> NL; - close(t); + for (fv = 1; fv <= 53; fv ++) t >> NL; + t >> x >> NL; + close(t); - namelen=107-ord(x[1]); numlen=107-ord(x[2]); + namelen = 107 - ord(x[1]); + numlen = 107 - ord(x[2]); - registrant=copy(x,3,namelen); - reginum=copy(x,4+namelen,numlen); - namechk=copy(x,4+namelen+numlen,namelen); - numchk=copy(x,4+namelen+numlen+namelen,numlen); + registrant = copy(x, 3, namelen); + reginum = copy(x, 4 + namelen, numlen); + namechk = copy(x, 4 + namelen + numlen, namelen); + numchk = copy(x, 4 + namelen + numlen + namelen, numlen); - for( fv=1; fv <= namelen; fv ++) registrant[fv]=decode1(registrant[fv]); - for( fv=1; fv <= numlen; fv ++) reginum[fv]=decode1(reginum[fv]); + for (fv = 1; fv <= namelen; fv ++) registrant[fv] = decode1(registrant[fv]); + for (fv = 1; fv <= numlen; fv ++) reginum[fv] = decode1(reginum[fv]); - if ((! checker(registrant,namechk)) || (! checker(reginum,numchk))) - registrant="\?\"!\? ((.)"; - else - registrant=registrant+" ("+reginum+")."; + if ((! checker(registrant, namechk)) || (! checker(reginum, numchk))) + registrant = "\?\"!\? ((.)"; + else + registrant = registrant + " (" + reginum + ")."; } -void flesh_colours() {; /* assembler; +void flesh_colours() { + ; /* assembler; asm mov ax,$1012; mov bx,21; { 21 = light pink (why?) */ - /* mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; + /* mov cx,1; + mov dx,seg @flesh; + mov es,dx; + mov dx,offset @flesh; + int $10; - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. */ - /*int $10; + mov dx,seg @darkflesh; + mov es,dx; + mov dx,offset @darkflesh; + mov bx,5; { 5 = dark pink. */ + /*int $10; - jmp @TheEnd; + jmp @TheEnd; - @flesh: - db 56,35,35; + @flesh: + db 56,35,35; - @darkflesh: - db 43,22,22; + @darkflesh: + db 43,22,22; - @TheEnd: */ - } + @TheEnd: */ +} -void setup() -{ - integer gd,gm; - file ff; +void setup() { + integer gd, gm; + file ff; - if (paramstr(1)!="jsb") exit(255); - checkbreak=false; - val(paramstr(2),storage_seg,gd); - val(paramstr(3),storage_ofs,gd); + if (paramstr(1) != "jsb") exit(255); + checkbreak = false; + val(paramstr(2), storage_seg, gd); + val(paramstr(3), storage_ofs, gd); - assign(ff,"avalot.fnt"); - reset(ff); ff >> font; close(ff); + assign(ff, "avalot.fnt"); + reset(ff); + ff >> font; + close(ff); - gd=3; gm=1; initgraph(gd,gm,""); - setvisualpage(1); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + setvisualpage(1); - icons(); + icons(); } -void big(word x,word y, string z, boolean notted); -static word start,image; +void big(word x, word y, string z, boolean notted); +static word start, image; -static void generate(byte from, boolean& notted) -{ - byte fv; +static void generate(byte from, boolean ¬ted) { + byte fv; - image=0; - for( fv=0; fv <= 7; fv ++) - image += (from & (1 << fv)) << fv; + image = 0; + for (fv = 0; fv <= 7; fv ++) + image += (from & (1 << fv)) << fv; - image += image << 1; - image=hi(image)+lo(image)*256; - if (notted) image=~ image; + image += image << 1; + image = hi(image) + lo(image) * 256; + if (notted) image = ~ image; } -void big(word x,word y, string z, boolean notted) -{ - byte fv,ff;byte bit; - - start=x+y*80; - - for( fv=1; fv <= length(z); fv ++) - { - for( ff=1; ff <= 12; ff ++) - { - generate(font[z[fv]][ff+1], notted); - for( bit=0; bit <= 2; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - memw[0xa000*start+ ff*160]=image; - memw[0xa000*start+80+ff*160]=image; - } - } - start += 2; - } - bit=getpixel(0,0); +void big(word x, word y, string z, boolean notted) { + byte fv, ff; + byte bit; + + start = x + y * 80; + + for (fv = 1; fv <= length(z); fv ++) { + for (ff = 1; ff <= 12; ff ++) { + generate(font[z[fv]][ff + 1], notted); + for (bit = 0; bit <= 2; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + memw[0xa000 * start + ff * 160] = image; + memw[0xa000 * start + 80 + ff * 160] = image; + } + } + start += 2; + } + bit = getpixel(0, 0); } -void centre(integer y, string z) -{ - big(40-(length(z)),y,z,false); +void centre(integer y, string z) { + big(40 - (length(z)), y, z, false); } -void option(byte which, string what) -{ - big(16,41+which*33,string((char)(which+48))+')',true); - big(24,41+which*33,what,true); +void option(byte which, string what) { + big(16, 41 + which * 33, string((char)(which + 48)) + ')', true); + big(24, 41 + which * 33, what, true); } -void invert(integer x1,integer y1,integer x2,integer y2) -{ - word s; pointer p; - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - putimage(x1,y1,p,4); - sound(y1); delay(30); - sound(600-y2); delay(20); - nosound; delay(200); - putimage(x1,y1,p,0); - delay(250); +void invert(integer x1, integer y1, integer x2, integer y2) { + word s; + pointer p; + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + putimage(x1, y1, p, 4); + sound(y1); + delay(30); + sound(600 - y2); + delay(20); + nosound; + delay(200); + putimage(x1, y1, p, 0); + delay(250); } -void wait() -{ - word x; char r; boolean pressed; - - x=0; pressed=false; - do { - setfillstyle(6,15); bar(x ,330,x-1,337); - setfillstyle(1, 0); bar(x-2,330,x-3,337); - delay(40); x += 1; - - if (keypressed()) - { - r=readkey(); - if (r=='\0') - { - r=readkey(); /* and...? */ - } else - { /* Not an extended keystroke. */ - if (set::of(range('1','6'),cspace,cescape,creturn, eos).has(r)) pressed=true; - } - } - - } while (!((x==640) || pressed)); - - if ((r==cspace) || (r==creturn)) r='1'; - if (r==cescape) r='6'; - if (pressed) - { - result=ord(r)-48; - invert(48,37+result*33,114,69+result*33); - } else result=177; +void wait() { + word x; + char r; + boolean pressed; + + x = 0; + pressed = false; + do { + setfillstyle(6, 15); + bar(x , 330, x - 1, 337); + setfillstyle(1, 0); + bar(x - 2, 330, x - 3, 337); + delay(40); + x += 1; + + if (keypressed()) { + r = readkey(); + if (r == '\0') { + r = readkey(); /* and...? */ + } else { + /* Not an extended keystroke. */ + if (set::of(range('1', '6'), cspace, cescape, creturn, eos).has(r)) pressed = true; + } + } + + } while (!((x == 640) || pressed)); + + if ((r == cspace) || (r == creturn)) r = '1'; + if (r == cescape) r = '6'; + if (pressed) { + result = ord(r) - 48; + invert(48, 37 + result * 33, 114, 69 + result * 33); + } else result = 177; } -void show_up() -{ - setvisualpage(0); +void show_up() { + setvisualpage(0); } -void loadmenu() -{ - untyped_file f; byte bit; - - assign(f,"mainmenu.avd"); - reset(f,1); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[0xa000*0],59*80); - } - close(f); - bit=getpixel(0,0); +void loadmenu() { + untyped_file f; + byte bit; + + assign(f, "mainmenu.avd"); + reset(f, 1); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * 0], 59 * 80); + } + close(f); + bit = getpixel(0, 0); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - setup(); - loadmenu(); - load_regi_info(); - option(1,"Play the game."); - option(2,"Read the background."); - option(3,"Preview... perhaps..."); - option(4,"View the documentation."); - option(5,"Registration info."); - option(6,"Exit back to DOS."); - centre(275,registrant); - centre(303,"Make your choice, or wait for the demo."); - - show_up(); - wait(); - mem[storage_seg*storage_ofs]=result; - closegraph(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + setup(); + loadmenu(); + load_regi_info(); + option(1, "Play the game."); + option(2, "Read the background."); + option(3, "Preview... perhaps..."); + option(4, "View the documentation."); + option(5, "Registration info."); + option(6, "Exit back to DOS."); + centre(275, registrant); + centre(303, "Make your choice, or wait for the demo."); + + show_up(); + wait(); + mem[storage_seg * storage_ofs] = result; + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index fa70ca1751c4..f91435fef277 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,83 +30,106 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; untyped_file f; -array<1,16000,byte> aa; -matrix<0,27,0,35,byte> cols; +array<1, 16000, byte> aa; +matrix<0, 27, 0, 35, byte> cols; text t; string x; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - fillchar(cols,sizeof(cols),'\0'); - assign(f,"v:avvypic.ptx"); - reset(f,1); - blockread(f,aa,filesize(f)); - close(f); - putimage(0,0,aa,0); - for( gd=0; gd <= 27; gd ++) - for( gm=0; gm <= 34; gm ++) - cols[gd][gm+1]=getpixel(gd,gm); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + fillchar(cols, sizeof(cols), '\0'); + assign(f, "v:avvypic.ptx"); + reset(f, 1); + blockread(f, aa, filesize(f)); + close(f); + putimage(0, 0, aa, 0); + for (gd = 0; gd <= 27; gd ++) + for (gm = 0; gm <= 34; gm ++) + cols[gd][gm + 1] = getpixel(gd, gm); - restorecrtmode(); -/* - asm - mov ax,$1003 - mov bl,0 - int $10 - end; -*/ - for( gm=0; gm <= 17; gm ++) - for( gd=0; gd <= 27; gd ++) - {; - gotoxy(gd+1,gm+1); - if (cols[gd][2*gm]==cols[gd][2*gm+1]) - {; - textattr=cols[gd][2*gm]; output << ''; - } else - if ((cols[gd][2*gm]>7) && (cols[gd][2*gm+1]<8)) - {; - textattr=cols[gd][2*gm]+cols[gd][2*gm+1]*16; - output << ''; - } else - {; - textattr=cols[gd][2*gm]*16+cols[gd][2*gm+1]; - if (textattr>blink) textattr -= blink; - output << ''; - } - } - gotoxy(23,5); textattr=red; output << ''; + restorecrtmode(); + /* + asm + mov ax,$1003 + mov bl,0 + int $10 + end; + */ + for (gm = 0; gm <= 17; gm ++) + for (gd = 0; gd <= 27; gd ++) { + ; + gotoxy(gd + 1, gm + 1); + if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { + ; + textattr = cols[gd][2 * gm]; + output << ''; + } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { + ; + textattr = cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16; + output << ''; + } else { + ; + textattr = cols[gd][2 * gm] * 16 + cols[gd][2 * gm + 1]; + if (textattr > blink) textattr -= blink; + output << ''; + } + } + gotoxy(23, 5); + textattr = red; + output << ''; - assign(t,"v:avalot.txt"); reset(t); - textattr=9; gm=2; - do { - gm += 1; - t >> x >> NL; - gotoxy(30,gm); - output << x << NL; - } while (!(eof(t))); + assign(t, "v:avalot.txt"); + reset(t); + textattr = 9; + gm = 2; + do { + gm += 1; + t >> x >> NL; + gotoxy(30, gm); + output << x << NL; + } while (!(eof(t))); - textattr=7; gotoxy(35,2); output << "Back in good old A.D. "; - textattr=15; output << "1176"; textattr=7; output << "..."; - textattr=9; gotoxy(40,4); output << "Lord"; - gotoxy(67,9); output << "d'Argent"; - textattr=yellow; - gotoxy(37,12); output << "He's back..."; - gotoxy(47,14); output << "And this time,"; - gotoxy(52,15); output << "he's wearing tights..."; - textattr=4; - gotoxy(36,17); output << "A Thorsoft of Letchworth game. * Requires EGA"; - gotoxy(38,18); output << "and HD. * By Mike, Mark and Thomas Thurman."; - gotoxy(40,19); output << "Sfx archive- "; - textattr=9; output << "Download "; - textattr=14; output << "AVLT10.EXE"; - textattr=9; output << " now!"; - gotoxy(1,1); - input >> NL; -return EXIT_SUCCESS; + textattr = 7; + gotoxy(35, 2); + output << "Back in good old A.D. "; + textattr = 15; + output << "1176"; + textattr = 7; + output << "..."; + textattr = 9; + gotoxy(40, 4); + output << "Lord"; + gotoxy(67, 9); + output << "d'Argent"; + textattr = yellow; + gotoxy(37, 12); + output << "He's back..."; + gotoxy(47, 14); + output << "And this time,"; + gotoxy(52, 15); + output << "he's wearing tights..."; + textattr = 4; + gotoxy(36, 17); + output << "A Thorsoft of Letchworth game. * Requires EGA"; + gotoxy(38, 18); + output << "and HD. * By Mike, Mark and Thomas Thurman."; + gotoxy(40, 19); + output << "Sfx archive- "; + textattr = 9; + output << "Download "; + textattr = 14; + output << "AVLT10.EXE"; + textattr = 9; + output << " now!"; + gotoxy(1, 1); + input >> NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index b7f96a5b5d26..a4fb34aad647 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,183 +31,227 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; untyped_file f; -array<1,16000,byte> aa; -matrix<0,27,0,35,byte> cols; +array<1, 16000, byte> aa; +matrix<0, 27, 0, 35, byte> cols; text t; string x; byte n; byte spaces; -byte cfg,cbg; /* Current foreground & background. */ -byte ofg,obg; /* Old fg & bg. */ - -void do_spaces() -{; - if (spaces==0) return; - along(spaces); - spaces=0; +byte cfg, cbg; /* Current foreground & background. */ +byte ofg, obg; /* Old fg & bg. */ + +void do_spaces() { + ; + if (spaces == 0) return; + along(spaces); + spaces = 0; } void finishline(); -static byte wx,wy; +static byte wx, wy; -static void jumpto(byte xx) -{; - along(xx-wx); +static void jumpto(byte xx) { + ; + along(xx - wx); } -void finishline() -{; - wx=29-spaces; wy=gm+1; - switch (wy) { - case 1: {; - sgr(7); jumpto(35); output << "Back in good old A.D. "; - sgr(15); output << "1189"; sgr(7); output << "..." << NL; cfg=7; - } - break; - case RANGE_5(3,7): {; - t >> x >> NL; - while (x[length(x)]=='\40') x[0] -= 1; - if (x!="") - {; - jumpto(30); - sgr(9); - spaces=0; - while (x!="") - {; - if (x[1]==' ') - spaces += 1; - else - {; - do_spaces(); - output << x[1]; - } - Delete(x,1,1); - } - if (wy==7) close(t); - output << NL; - } - } - break; - case 8: {; - jumpto(67); sgr(9); output << "d'Argent" << NL; cfg=9; - } - break; - case 11: {; - jumpto(37); sgr(14); output << "He's back..." << NL; - } - break; - case 13: {; - jumpto(47); sgr(14); output << "And this time," << NL; - } - break; - case 14: {; - jumpto(52); sgr(14); output << "he's wearing tights..." << NL; - } - break; - case 16: {; - jumpto(35); sgr(4); - output << "A Thorsoft of Letchworth game. * Requires EGA" << NL; - } - break; - case 17: {; - jumpto(37); sgr(4); - output << "and HD. * By Mike, Mark and Thomas Thurman." << NL; - } - break; - case 18: {; - jumpto(39); - sgr( 4); output << "Sfx archive- "; - sgr( 9); output << "Download "; - sgr(14); output << "AVLT10.EXE"; - sgr( 9); output << " now!"; - } - break; - default: output << NL; - } +void finishline() { + ; + wx = 29 - spaces; + wy = gm + 1; + switch (wy) { + case 1: { + ; + sgr(7); + jumpto(35); + output << "Back in good old A.D. "; + sgr(15); + output << "1189"; + sgr(7); + output << "..." << NL; + cfg = 7; + } + break; + case RANGE_5(3, 7): { + ; + t >> x >> NL; + while (x[length(x)] == '\40') x[0] -= 1; + if (x != "") { + ; + jumpto(30); + sgr(9); + spaces = 0; + while (x != "") { + ; + if (x[1] == ' ') + spaces += 1; + else { + ; + do_spaces(); + output << x[1]; + } + Delete(x, 1, 1); + } + if (wy == 7) close(t); + output << NL; + } + } + break; + case 8: { + ; + jumpto(67); + sgr(9); + output << "d'Argent" << NL; + cfg = 9; + } + break; + case 11: { + ; + jumpto(37); + sgr(14); + output << "He's back..." << NL; + } + break; + case 13: { + ; + jumpto(47); + sgr(14); + output << "And this time," << NL; + } + break; + case 14: { + ; + jumpto(52); + sgr(14); + output << "he's wearing tights..." << NL; + } + break; + case 16: { + ; + jumpto(35); + sgr(4); + output << "A Thorsoft of Letchworth game. * Requires EGA" << NL; + } + break; + case 17: { + ; + jumpto(37); + sgr(4); + output << "and HD. * By Mike, Mark and Thomas Thurman." << NL; + } + break; + case 18: { + ; + jumpto(39); + sgr(4); + output << "Sfx archive- "; + sgr(9); + output << "Download "; + sgr(14); + output << "AVLT10.EXE"; + sgr(9); + output << " now!"; + } + break; + default: + output << NL; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - fillchar(cols,sizeof(cols),'\0'); - assign(f,"v:avvypic.ptx"); - reset(f,1); - blockread(f,aa,filesize(f)); - close(f); - putimage(0,0,aa,0); - for( gd=0; gd <= 27; gd ++) - for( gm=0; gm <= 34; gm ++) - cols[gd][gm+1]=getpixel(gd,gm); - - restorecrtmode(); - - assign(output,"v:avalot.ans"); rewrite(output); normal; ed; -/* assign(output,''); rewrite(output); normal; ed;*/ - assign(t,"v:avalot.txt"); reset(t); - - for( gm=0; gm <= 17; gm ++) - {; - spaces=0; - for( gd=0; gd <= 27; gd ++) - {; - if ((gd==22) && (gm==4)) - {; - do_spaces(); - sgr(red); output << ''; - } else - {; - if (cols[gd][2*gm]==cols[gd][2*gm+1]) - {; - if (cols[gd][2*gm]==0) - spaces += 1; /* a blank space */ - else {; - do_spaces(); - - if (cfg==cols[gd][2*gm]) output << ''; else - if (cbg==cols[gd][2*gm]) output << ' '; else - {; - sgr((cols[gd][2*gm])+(cbg*16)); - cfg=cols[gd][2*gm]; - output << ''; - } - } - } else - if ((cols[gd][2*gm]>7) && (cols[gd][2*gm+1]<8)) - {; - do_spaces(); - sgr(cols[gd][2*gm]+cols[gd][2*gm+1]*16); - cfg=cols[gd][2*gm]; cbg=cols[gd][2*gm+1]*16; - output << ''; - } else - {; - do_spaces(); - - ofg=cfg; obg=cbg; - cbg=cols[gd][2*gm]; cfg=cols[gd][2*gm+1]; - - if ((cbg==ofg) && (cfg==obg)) - {; - n=cfg*16+cbg; - if (n>128) n -= 128; - output << ''; - } else - {; - n=cbg*16+cfg; - if (n>128) n -= 128; - if ((cfg!=ofg) || (cbg!=obg)) sgr(n); - output << ''; - } - - } - } - } finishline(); - } - output << NL; - normal; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + fillchar(cols, sizeof(cols), '\0'); + assign(f, "v:avvypic.ptx"); + reset(f, 1); + blockread(f, aa, filesize(f)); + close(f); + putimage(0, 0, aa, 0); + for (gd = 0; gd <= 27; gd ++) + for (gm = 0; gm <= 34; gm ++) + cols[gd][gm + 1] = getpixel(gd, gm); + + restorecrtmode(); + + assign(output, "v:avalot.ans"); + rewrite(output); + normal; + ed; + /* assign(output,''); rewrite(output); normal; ed;*/ + assign(t, "v:avalot.txt"); + reset(t); + + for (gm = 0; gm <= 17; gm ++) { + ; + spaces = 0; + for (gd = 0; gd <= 27; gd ++) { + ; + if ((gd == 22) && (gm == 4)) { + ; + do_spaces(); + sgr(red); + output << ''; + } else { + ; + if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { + ; + if (cols[gd][2 * gm] == 0) + spaces += 1; /* a blank space */ + else { + ; + do_spaces(); + + if (cfg == cols[gd][2 * gm]) output << ''; + else if (cbg == cols[gd][2 * gm]) output << ' '; + else { + ; + sgr((cols[gd][2 * gm]) + (cbg * 16)); + cfg = cols[gd][2 * gm]; + output << ''; + } + } + } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { + ; + do_spaces(); + sgr(cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16); + cfg = cols[gd][2 * gm]; + cbg = cols[gd][2 * gm + 1] * 16; + output << ''; + } else { + ; + do_spaces(); + + ofg = cfg; + obg = cbg; + cbg = cols[gd][2 * gm]; + cfg = cols[gd][2 * gm + 1]; + + if ((cbg == ofg) && (cfg == obg)) { + ; + n = cfg * 16 + cbg; + if (n > 128) n -= 128; + output << ''; + } else { + ; + n = cbg * 16 + cfg; + if (n > 128) n -= 128; + if ((cfg != ofg) || (cbg != obg)) sgr(n); + output << ''; + } + + } + } + } + finishline(); + } + output << NL; + normal; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 25fc83e40553..4f150e33d7a9 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,72 +29,89 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; byte z; -array<1,4,pointer> a; -untyped_file f; word s; +array<1, 4, pointer> a; +untyped_file f; +word s; string check; -integer x,y; -void savesc() -{ - varying_string<40> adf; untyped_file f; byte z; array<1,2,pointer> c; word s; -varying_string<14> nam; varying_string<30> screenname; -; - nam="v:avvymonk.avd"; - adf=string("aved as a stuff file, so there! TJAT.")+'\15'+'\12'+'\32'; - adf[0]='S'; - screenname="Avalot in a monk's costume"; - assign(f,nam); /* not scrambled */ - rewrite(f,1); - blockwrite(f,adf,41); - blockwrite(f,nam,13); - blockwrite(f,screenname,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(c[z],s); - getimage(0,15+(z-1)*75,getmaxx(),15+(z)*75,c[z]); - blockwrite(f,c[z],s); - freemem(c[z],s); - } +integer x, y; +void savesc() { + varying_string<40> adf; + untyped_file f; + byte z; + array<1, 2, pointer> c; + word s; + varying_string<14> nam; + varying_string<30> screenname; + ; + nam = "v:avvymonk.avd"; + adf = string("aved as a stuff file, so there! TJAT.") + '\15' + '\12' + '\32'; + adf[0] = 'S'; + screenname = "Avalot in a monk's costume"; + assign(f, nam); /* not scrambled */ + rewrite(f, 1); + blockwrite(f, adf, 41); + blockwrite(f, nam, 13); + blockwrite(f, screenname, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(c[z], s); + getimage(0, 15 + (z - 1) * 75, getmaxx(), 15 + (z) * 75, c[z]); + blockwrite(f, c[z], s); + freemem(c[z], s); + } } -void loadscreen(string nam) -{; - assign(f,nam); - reset(f,1); - blockread(f,check,41); - blockread(f,check,13); - blockread(f,check,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(a[z],s); - blockread(f,a[z],s); - setactivepage(0); - putimage(0,15+(z-1)*75,a[z],0); - freemem(a[z],s); - } - close(f); +void loadscreen(string nam) { + ; + assign(f, nam); + reset(f, 1); + blockread(f, check, 41); + blockread(f, check, 13); + blockread(f, check, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(a[z], s); + blockread(f, a[z], s); + setactivepage(0); + putimage(0, 15 + (z - 1) * 75, a[z], 0); + freemem(a[z], s); + } + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; - x=0; y=0; - initgraph(gd,gm,"o:"); - loadscreen("v:legion.avd"); - while (y<100) - {; - switch (getpixel(x,y)) { - case 7: putpixel(x,y,0); break; - case 8: putpixel(x,y,0); break; - case 9: putpixel(x,y,15); break; - } - x += 1; - if (x>640) {; y += 1; x=0; } - } - savesc(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + x = 0; + y = 0; + initgraph(gd, gm, "o:"); + loadscreen("v:legion.avd"); + while (y < 100) { + ; + switch (getpixel(x, y)) { + case 7: + putpixel(x, y, 0); + break; + case 8: + putpixel(x, y, 0); + break; + case 9: + putpixel(x, y, 15); + break; + } + x += 1; + if (x > 640) { + ; + y += 1; + x = 0; + } + } + savesc(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp index fabda148f7a0..94e00da55701 100644 --- a/engines/avalanche/bakchunk.cpp +++ b/engines/avalanche/bakchunk.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,26 +31,29 @@ namespace Avalanche { -integer gd,gm; -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=0; initgraph(gd,gm,""); - setvisualpage(3); - load_chunks('1'); - - for( gd=0; gd <= num_chunks; gd ++) - show_one_at(gd,0,gd*40); - - mblit(0,0,79,200,3,0); - - gd=getpixel(0,0); - setvisualpage(0); setactivepage(0); - - settextstyle(0,0,4); setcolor(15); - outtextxy(100,50,"Chunk1"); - input >> NL; - return EXIT_SUCCESS; +integer gd, gm; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + setvisualpage(3); + load_chunks('1'); + + for (gd = 0; gd <= num_chunks; gd ++) + show_one_at(gd, 0, gd * 40); + + mblit(0, 0, 79, 200, 3, 0); + + gd = getpixel(0, 0); + setvisualpage(0); + setactivepage(0); + + settextstyle(0, 0, 4); + setcolor(15); + outtextxy(100, 50, "Chunk1"); + input >> NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp index b4ceeb389a49..dcab52540e16 100644 --- a/engines/avalanche/basher.cpp +++ b/engines/avalanche/basher.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -35,9 +35,9 @@ #define __basher_implementation__ - /* Note: this unit can record keystrokes, for the demo. If you want it - to do this, define the o.c.c. RECORD. Setting gyro.demo to True will - cause them to be played back. */ +/* Note: this unit can record keystrokes, for the demo. If you want it + to do this, define the o.c.c. RECORD. Setting gyro.demo to True will + cause them to be played back. */ #include "basher.h" @@ -59,36 +59,36 @@ namespace Avalanche { boolean entering_filename; byte left_margin; -void plottext() -{ - const array<0,2,byte> p = {{0,1,3}}; - byte x,y,n; - - x=0; if (mouse_near_text()) super_off(); - cursor_off(); - for( n=0; n <= 2; n ++) - for( y=0; y <= 7; y ++) - { - for( x=1; x <= length(current); x ++) - mem[0xa000*p[n]*pagetop+12882+y*80+x]=little[current[x]][y]; - fillchar(mem[0xa000*p[n]*pagetop+12883+y*80+x],77-x,'\0'); - } - cursor_on(); - super_on(); +void plottext() { + const array<0, 2, byte> p = {{0, 1, 3}}; + byte x, y, n; + + x = 0; + if (mouse_near_text()) super_off(); + cursor_off(); + for (n = 0; n <= 2; n ++) + for (y = 0; y <= 7; y ++) { + for (x = 1; x <= length(current); x ++) + mem[0xa000 * p[n]*pagetop + 12882 + y * 80 + x] = little[current[x]][y]; + fillchar(mem[0xa000 * p[n]*pagetop + 12883 + y * 80 + x], 77 - x, '\0'); + } + cursor_on(); + super_on(); } -void wipetext() -{ - const array<0,2,byte> n = {{0,1,3}}; - byte y,p; - - if (mouse_near_text()) super_off(); - cursor_off(); - for( y=0; y <= 7; y ++) - for( p=0; p <= 2; p ++) - fillchar(mem[0xa000*n[p]*pagetop+12883+y*80],77,'\0'); - quote=true; curpos=1; cursor_on(); - super_on(); +void wipetext() { + const array<0, 2, byte> n = {{0, 1, 3}}; + byte y, p; + + if (mouse_near_text()) super_off(); + cursor_off(); + for (y = 0; y <= 7; y ++) + for (p = 0; p <= 2; p ++) + fillchar(mem[0xa000 * n[p]*pagetop + 12883 + y * 80], 77, '\0'); + quote = true; + curpos = 1; + cursor_on(); + super_on(); } /*procedure cursor; @@ -104,49 +104,49 @@ begin end else dec(curflash); end;*/ -void do_cursor() -{ - bytefield bf; - byte fv; - - mem[0xac00*13442+curpos]=~ mem[0xac00*13442+curpos]; - { - bf.x1=curpos+1; bf.x2=curpos+2; bf.y1=168; bf.y2=168; - } - for( fv=0; fv <= 1; fv ++) getset[fv].remember(bf); +void do_cursor() { + bytefield bf; + byte fv; + + mem[0xac00 * 13442 + curpos] = ~ mem[0xac00 * 13442 + curpos]; + { + bf.x1 = curpos + 1; + bf.x2 = curpos + 2; + bf.y1 = 168; + bf.y2 = 168; + } + for (fv = 0; fv <= 1; fv ++) getset[fv].remember(bf); } -void cursor_on() -{ - if (cursoron) return; - do_cursor(); cursoron=true; +void cursor_on() { + if (cursoron) return; + do_cursor(); + cursoron = true; } -void cursor_off() -{ - if (! cursoron) return; - do_cursor(); cursoron=false; +void cursor_off() { + if (! cursoron) return; + do_cursor(); + cursoron = false; } -void get_demorec() -{ - demofile >> demo_rec; - inchar=demo_rec.key; - extd=demo_rec.extd; - demo_rec.delay -= 1; +void get_demorec() { + demofile >> demo_rec; + inchar = demo_rec.key; + extd = demo_rec.extd; + demo_rec.delay -= 1; } #ifdef RECORD - void record_one() - { - demo_rec.delay=count; - demo_rec.key=inchar; - demo_rec.extd=extd; - - demofile << demo_rec; - count=0; - } +void record_one() { + demo_rec.delay = count; + demo_rec.key = inchar; + demo_rec.extd = extd; + + demofile << demo_rec; + count = 0; +} #endif /* procedure storeline(whatwhat:string); @@ -178,235 +178,324 @@ end; */ void typein(); -static char firstchar(string x) { char firstchar_result; - firstchar_result=x[1]; return firstchar_result; - } +static char firstchar(string x) { + char firstchar_result; + firstchar_result = x[1]; + return firstchar_result; +} -static void try_dd() /* This asks the Parsekey proc in Dropdown if it knows it. */ -{ - parsekey(inchar,extd); +static void try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */ + parsekey(inchar, extd); } -void typein() -{ - byte w; - - inkey(); - #ifdef RECORD record_one(); #endif - - switch (inchar) { - case RANGE_15('\40','\56'):case '\60' ... '\337':case '\341' ... '\377': if (ddm_o.menunow) - { - parsekey(inchar,extd); - } else - { - if (length(current)<76) - { - if ((inchar=='"') || (inchar=='`')) - { - if (quote) inchar='`'; else inchar='"'; - quote=! quote; /* Quote- Unquote... */ - } - insert(inchar,current,curpos); - curpos += 1; - plottext(); - } else blip(); - } - break; - case '\10': if (! ddm_o.menunow) - { - if (curpos>left_margin) - { - curpos -= 1; - if (set::of('"','`', eos).has(current[curpos])) quote=! quote; - Delete(current,curpos,1); - plottext(); - } else blip(); - } - break; - case '\0':case '\340': { - switch (extd) { - /* Function keys: */ - case cf1: callverb(vb_help); break; /* f1 - help (obviously) */ - case cf2: fxtoggle(); break; /* f2 - sound */ - case ccf2:case cf11: { clearwords(); callverb(vb_save); } break; /* ^f2 - save */ - case cf3: if (length(current)left_margin) - { cursor_off(); curpos -= 1; cursor_on(); } - break; /* ^left */ - case ccright: if (curpos<=length(current)) /* ^right */ - { cursor_off(); curpos += 1; cursor_on(); } - break; - case cchome: { cursor_off(); curpos=1; cursor_on(); } break; /* ^home */ - case ccend: { cursor_off(); curpos=length(current)+1; cursor_on(); } break; /* ^end */ - case c_ar: oh=177; break; /* alt-R = repeater (re-chime) */ - case cup:case cdown:case cleft:case cright:case cpgup:case cpgdn:case chome:case cend: if (ddm_o.menunow) try_dd(); - else tripkey(extd); - break; /* Up/Down/Left/Right/PgUp/PgDn */ - case cnum5: tripkey(extd); break; /* Numeric 5 */ - case cdel: if (! ddm_o.menunow) - { - if (curpos<=length(current)) - { - if (set::of('"','`', eos).has(current[curpos])) quote=! quote; - Delete(current,curpos,1); - plottext(); - } else blip(); - } - break; - default: try_dd(); - } - } - break; - case cescape:case '/': if (ddm_o.menunow) /* Escape */ - { ddm_o.wipe(); } else - if (entering_filename) - { normal_edit(); wipetext(); } else - ddm_m.getcertain(ddm_o.menunum); - break; - case creturn: if (ddm_o.menunow) try_dd(); /* Return */ - else { - log_command(current); - if (entering_filename) - { - edna_save(copy(current,24,255)); - normal_edit(); wipetext(); - } else - { - if (current!="") last=current; - parse(); do_that(); - if (! entering_filename) - { - current=""; - wipetext(); - } - } - } - break; - case '\11': callverb(vb_inv); break; /* Ctrl-I= inventory */ - case '\7': errorled(); break; - case '\25': { - current=""; - wipetext(); - } - break; - - case '\27': { tr[1].xs=walk; newspeed(); } break; - case '\22': { tr[1].xs=run; newspeed(); } break; - - case '\2': bosskey(); break; - case '\12': ctrl=cjoy; break; /* Joystick */ - case '\13': ctrl=ckey; break; /* Keyboard */ - case '\3': callverb(vb_quit); break; /* Ctrl-C= request to quit */ - - } - showrw(); - - if (demo) get_demorec(); +void typein() { + byte w; + + inkey(); +#ifdef RECORD record_one(); #endif + + switch (inchar) { + case RANGE_15('\40', '\56'): + case '\60' ... '\337': + case '\341' ... '\377': + if (ddm_o.menunow) { + parsekey(inchar, extd); + } else { + if (length(current) < 76) { + if ((inchar == '"') || (inchar == '`')) { + if (quote) inchar = '`'; + else inchar = '"'; + quote = ! quote; /* Quote- Unquote... */ + } + insert(inchar, current, curpos); + curpos += 1; + plottext(); + } else blip(); + } + break; + case '\10': + if (! ddm_o.menunow) { + if (curpos > left_margin) { + curpos -= 1; + if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote; + Delete(current, curpos, 1); + plottext(); + } else blip(); + } + break; + case '\0': + case '\340': { + switch (extd) { + /* Function keys: */ + case cf1: + callverb(vb_help); + break; /* f1 - help (obviously) */ + case cf2: + fxtoggle(); + break; /* f2 - sound */ + case ccf2: + case cf11: { + clearwords(); + callverb(vb_save); + } + break; /* ^f2 - save */ + case cf3: + if (length(current) < length(/*previous^[20]*/last)) { /* f3 - rec last */ + current = current + copy(/*previous^[20]*/last, length(current) + 1, 255); + curpos = length(current) + 1; + plottext(); + } + break; + case ccf3: + case cf12: { + clearwords(); + callverb(vb_load); + } + break; /* ^f3 - load */ + case cf4: + callverb(vb_restart); + break; /* f4 - restart game */ + case cf5: { + person = pardon; + thing = pardon; + callverb(firstchar(f5_does())); /* f5 - get up/ whatever */ + } + break; + case cf6: + callverb(vb_pause); + break; /* f6 - pause */ + case cf7: + callverb(vb_open); + break; /* f7 - open door */ + case cf8: + callverb(vb_look); + break; /* f8 - look */ + case cf9: + callverb(vb_score); + break; /* f9 - score */ + case ccf7: + major_redraw(); + break; /* ^f7 - open door */ + case cf10: + case c_ax: + case caf4: { +#ifdef RECORD + display("Hi. You have just finished recording. GIED."); + close(demofile); + exit(0); +#endif + callverb(vb_quit); /* f10, alt-X, alt-f4 - quit */ + } + break; + case ccf5: + back_to_bootstrap(2); + break; /* ^f5 - Dos shell. */ + case csf10: + callverb(vb_info); + break; /* sf10 - version */ + + case c_ab: + callverb(vb_boss); + break; /* alt-B */ + case c_ad: + display("Wrong game!"); + break; /* alt-D */ + case ccleft: + if (curpos > left_margin) { + cursor_off(); + curpos -= 1; + cursor_on(); + } + break; /* ^left */ + case ccright: + if (curpos <= length(current)) { /* ^right */ + cursor_off(); + curpos += 1; + cursor_on(); + } + break; + case cchome: { + cursor_off(); + curpos = 1; + cursor_on(); + } + break; /* ^home */ + case ccend: { + cursor_off(); + curpos = length(current) + 1; + cursor_on(); + } + break; /* ^end */ + case c_ar: + oh = 177; + break; /* alt-R = repeater (re-chime) */ + case cup: + case cdown: + case cleft: + case cright: + case cpgup: + case cpgdn: + case chome: + case cend: + if (ddm_o.menunow) try_dd(); + else tripkey(extd); + break; /* Up/Down/Left/Right/PgUp/PgDn */ + case cnum5: + tripkey(extd); + break; /* Numeric 5 */ + case cdel: + if (! ddm_o.menunow) { + if (curpos <= length(current)) { + if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote; + Delete(current, curpos, 1); + plottext(); + } else blip(); + } + break; + default: + try_dd(); + } + } + break; + case cescape: + case '/': + if (ddm_o.menunow) { /* Escape */ + ddm_o.wipe(); + } else if (entering_filename) { + normal_edit(); + wipetext(); + } else + ddm_m.getcertain(ddm_o.menunum); + break; + case creturn: + if (ddm_o.menunow) try_dd(); /* Return */ + else { + log_command(current); + if (entering_filename) { + edna_save(copy(current, 24, 255)); + normal_edit(); + wipetext(); + } else { + if (current != "") last = current; + parse(); + do_that(); + if (! entering_filename) { + current = ""; + wipetext(); + } + } + } + break; + case '\11': + callverb(vb_inv); + break; /* Ctrl-I= inventory */ + case '\7': + errorled(); + break; + case '\25': { + current = ""; + wipetext(); + } + break; + + case '\27': { + tr[1].xs = walk; + newspeed(); + } + break; + case '\22': { + tr[1].xs = run; + newspeed(); + } + break; + + case '\2': + bosskey(); + break; + case '\12': + ctrl = cjoy; + break; /* Joystick */ + case '\13': + ctrl = ckey; + break; /* Keyboard */ + case '\3': + callverb(vb_quit); + break; /* Ctrl-C= request to quit */ + + } + showrw(); + + if (demo) get_demorec(); } /* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; '': begin setvisualpage(0); write(#7); inkey; end;*/ -void keyboard_link() -{ - state(defaultled); /* if defaultled=1 then on; { For the menus }*/ - joykeys(); /* Test joystick buttons- I know that's not keyboard. */ - - if (demo) - { - if (keypressede()) exit(0); - if (demo_rec.delay>0) - demo_rec.delay -= 1; - else typein(); - return; - } - - #ifdef RECORD count += 1; #endif - - if (! keypressede()) return; - if (keyboardclick) click(); - typein(); +void keyboard_link() { + state(defaultled); /* if defaultled=1 then on; { For the menus }*/ + joykeys(); /* Test joystick buttons- I know that's not keyboard. */ + + if (demo) { + if (keypressede()) exit(0); + if (demo_rec.delay > 0) + demo_rec.delay -= 1; + else typein(); + return; + } + +#ifdef RECORD count += 1; #endif + + if (! keypressede()) return; + if (keyboardclick) click(); + typein(); } -boolean demo_ready() -{ - boolean demo_ready_result; - if (demo_rec.delay>0) - { - slowdown(); - demo_rec.delay -= 1; - } - demo_ready_result=demo_rec.delay==0; - return demo_ready_result; +boolean demo_ready() { + boolean demo_ready_result; + if (demo_rec.delay > 0) { + slowdown(); + demo_rec.delay -= 1; + } + demo_ready_result = demo_rec.delay == 0; + return demo_ready_result; } -void filename_edit() -{ - entering_filename=true; - current="Filename\? (Esc=cancel):"; - left_margin=24; curpos=24; - plottext(); +void filename_edit() { + entering_filename = true; + current = "Filename\? (Esc=cancel):"; + left_margin = 24; + curpos = 24; + plottext(); } -void normal_edit() -{ - entering_filename=false; - current=""; - left_margin=1; curpos=1; +void normal_edit() { + entering_filename = false; + current = ""; + left_margin = 1; + curpos = 1; } class unit_basher_initialize { - public: unit_basher_initialize(); +public: + unit_basher_initialize(); }; static unit_basher_initialize basher_constructor; unit_basher_initialize::unit_basher_initialize() { -/* new(previous);*/ last=""; normal_edit(); - - if (demo) - { - assign(demofile,"demo.avd"); - reset(demofile); - } - - #ifdef RECORD - count=0; - assign(demofile,"demo.avd"); - rewrite(demofile); - #endif + /* new(previous);*/ last = ""; + normal_edit(); + + if (demo) { + assign(demofile, "demo.avd"); + reset(demofile); + } + +#ifdef RECORD + count = 0; + assign(demofile, "demo.avd"); + rewrite(demofile); +#endif } diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h index ba26d926a94d..1cc42b5b6cbf 100644 --- a/engines/avalanche/basher.h +++ b/engines/avalanche/basher.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -47,22 +47,22 @@ EXTERN word count; #endif - void plottext(); +void plottext(); - void keyboard_link(); +void keyboard_link(); - void cursor_on(); +void cursor_on(); - void get_demorec(); +void get_demorec(); - boolean demo_ready(); +boolean demo_ready(); - void cursor_off(); +void cursor_off(); - void filename_edit(); - void normal_edit(); +void filename_edit(); +void normal_edit(); #ifdef RECORD - void record_one(); +void record_one(); #endif } // End of namespace Avalanche. diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index 8d1e0c33ad24..f653ad892495 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -35,100 +35,111 @@ namespace Avalanche { -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h index 325bd35e474f..6afb4532f226 100644 --- a/engines/avalanche/cadburys.h +++ b/engines/avalanche/cadburys.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,20 +32,20 @@ namespace Avalanche { const integer arraysize = 12000; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; @@ -54,17 +54,17 @@ struct chunkblocktype { #define EXTERN #endif -EXTERN array<0,arraysize,byte> aa; -EXTERN byte num_chunks,this_chunk; -EXTERN integer gd,gm; -EXTERN array<1,30,longint> offsets; +EXTERN array<0, arraysize, byte> aa; +EXTERN byte num_chunks, this_chunk; +EXTERN integer gd, gm; +EXTERN array<1, 30, longint> offsets; EXTERN untyped_file f; #undef EXTERN #define EXTERN extern -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat); +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat); } // End of namespace Avalanche. diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 1038e6f77783..d444845cef97 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -48,222 +48,296 @@ untyped_file f; /* Private variable- not accessible from elsewhere. */ const integer on_disk = -1; /* Value of memos[fv].x when it's not in memory. */ -void pics_link() -{ - byte xx; - - if (ddmnow) return; /* No animation when the menus are up. */ - - { dnatype& with = dna; - switch (with.room) { - - case r__outsideargentpub: { - if ((roomtime % longint(12))==0) - show_one(longint(1)+(roomtime / longint(12)) % longint(4)); - } - break; - - case r__brummieroad: if ((roomtime % longint(2))==0) - show_one(longint(1)+(roomtime / longint(2)) % longint(4)); - break; - - case r__bridge: if ((roomtime % longint(2))==0) - show_one(longint(4)+(roomtime / longint(2)) % longint(4)); - break; - - case r__yours: if ((! with.avvy_is_awake) && ((roomtime % longint(4))==0)) - show_one(longint(1)+(roomtime / longint(12)) % longint(2)); - break; - - case r__argentpub: { - if (((roomtime % longint(7))==1) && (dna.malagauche!=177)) - { /* Malagauche cycle */ - dna.malagauche += 1; - switch (dna.malagauche) { - case 1:case 11:case 21: show_one(12); break; /* Looks forwards. */ - case 8:case 18:case 28:case 32: show_one(11); break; /* Looks at you. */ - case 30: show_one(13); break; /* Winks. */ - case 33: dna.malagauche=0; break; - } - } - - switch (roomtime % longint(200)) { - case 179:case 197: show_one(5); break; /* Dogfood's drinking cycle */ - case 182:case 194: show_one(6); break; - case 185: show_one(7); break; - case 199: dna.dogfoodpos=177; break; /* Impossible value for this. */ - case 0 ... 178: { /* Normally. */ - switch (bearing(2)) {/* Bearing of Avvy from Dogfood. */ - case 1 ... 90:case RANGE_3(358,360): xx=3; break; - case 293 ... 357: xx=2; break; - case 271 ... 292: xx=4; break; - } - if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ - { - show_one(xx); - dna.dogfoodpos=xx; - } - } - break; - } - } - break; - - case r__westhall: if ((roomtime % longint(3))==0) - switch ((roomtime / longint(3)) % longint(6)) { - case 4: show_one(1); break; - case 1:case 3:case 5: show_one(2); break; - case 0:case 2: show_one(3); break; - } - break; - case r__lustiesroom: if (! (dna.lustie_is_asleep)) { - if ((roomtime % longint(45))>42) xx=4; /* du Lustie blinks */ - else - switch (bearing(2)) {/* Bearing of Avvy from du Lustie. */ - case 0 ... 45:case 315 ... 360: xx=1; break; /* Middle. */ - case 45 ... 180: xx=2; break; /* Left. */ - case 181 ... 314: xx=3; break; /* Right. */ - } - if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ - { - show_one(xx); - dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ - } - } - break; - - case r__aylesoffice: if ((! dna.ayles_is_awake) && (roomtime % longint(14)==0)) - { - switch ((roomtime / longint(14)) % longint(2)) { - case 0: show_one(1); break; /* Frame 2: EGA. */ - case 1: show_one(3); break; /* Frame 1: Natural. */ - } - } - break; - - case r__robins: if (dna.tied_up) - switch (roomtime % longint(54)) { - case 20: show_one(4); break; /* Frame 4: Avalot blinks. */ - case 23: show_one(2); break; /* Frame 1: Back to normal. */ - } - break; - - case r__nottspub: { - switch (bearing(5)) { /* Bearing of Avvy from Port. */ - case 0 ... 45:case 315 ... 360: xx=2; break; /* Middle. */ - case 45 ... 180: xx=6; break; /* Left. */ - case 181 ... 314: xx=8; break; /* Right. */ - } - - if ((roomtime % longint(60))>57) xx -= 1; /* Blinks */ - - if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ - { - show_one(xx); - dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ - } - - switch (roomtime % longint(50)) { - case 45 : show_one(9); break; /* Spurge blinks */ - case 49 : show_one(10); break; - } - } - break; - - case r__ducks: { - if ((roomtime % longint(3))==0) /* The fire flickers */ - show_one(longint(1)+(roomtime / longint(3)) % longint(3)); - - switch (bearing(2)) {/* Bearing of Avvy from Duck. */ - case 0 ... 45:case 315 ... 360: xx=4; break; /* Middle. */ - case 45 ... 180: xx=6; break; /* Left. */ - case 181 ... 314: xx=8; break; /* Right. */ - } - - if ((roomtime % longint(45))>42) xx += 1; /* Duck blinks */ - - if (xx!=dna.dogfoodpos) /* Only if it's changed.*/ - { - show_one(xx); - dna.dogfoodpos=xx; /* We use DogfoodPos here too- why not? */ - } - } - break; - - }} - - if ((dna.ringing_bells) && (flagset('B'))) - /* They're ringing the bells. */ - switch (roomtime % longint(4)) { - case 1: { - dnatype& with = dna; - - if (with.nextbell<5) with.nextbell=12; - with.nextbell -= 1; - note(notes[with.nextbell]); - } - break; - case 2: nosound; break; - } +void pics_link() { + byte xx; + + if (ddmnow) return; /* No animation when the menus are up. */ + + { + dnatype &with = dna; + switch (with.room) { + + case r__outsideargentpub: { + if ((roomtime % longint(12)) == 0) + show_one(longint(1) + (roomtime / longint(12)) % longint(4)); + } + break; + + case r__brummieroad: + if ((roomtime % longint(2)) == 0) + show_one(longint(1) + (roomtime / longint(2)) % longint(4)); + break; + + case r__bridge: + if ((roomtime % longint(2)) == 0) + show_one(longint(4) + (roomtime / longint(2)) % longint(4)); + break; + + case r__yours: + if ((! with.avvy_is_awake) && ((roomtime % longint(4)) == 0)) + show_one(longint(1) + (roomtime / longint(12)) % longint(2)); + break; + + case r__argentpub: { + if (((roomtime % longint(7)) == 1) && (dna.malagauche != 177)) { + /* Malagauche cycle */ + dna.malagauche += 1; + switch (dna.malagauche) { + case 1: + case 11: + case 21: + show_one(12); + break; /* Looks forwards. */ + case 8: + case 18: + case 28: + case 32: + show_one(11); + break; /* Looks at you. */ + case 30: + show_one(13); + break; /* Winks. */ + case 33: + dna.malagauche = 0; + break; + } + } + + switch (roomtime % longint(200)) { + case 179: + case 197: + show_one(5); + break; /* Dogfood's drinking cycle */ + case 182: + case 194: + show_one(6); + break; + case 185: + show_one(7); + break; + case 199: + dna.dogfoodpos = 177; + break; /* Impossible value for this. */ + case 0 ... 178: { /* Normally. */ + switch (bearing(2)) {/* Bearing of Avvy from Dogfood. */ + case 1 ... 90: + case RANGE_3(358, 360): + xx = 3; + break; + case 293 ... 357: + xx = 2; + break; + case 271 ... 292: + xx = 4; + break; + } + if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + dna.dogfoodpos = xx; + } + } + break; + } + } + break; + + case r__westhall: + if ((roomtime % longint(3)) == 0) + switch ((roomtime / longint(3)) % longint(6)) { + case 4: + show_one(1); + break; + case 1: + case 3: + case 5: + show_one(2); + break; + case 0: + case 2: + show_one(3); + break; + } + break; + case r__lustiesroom: + if (!(dna.lustie_is_asleep)) { + if ((roomtime % longint(45)) > 42) xx = 4; /* du Lustie blinks */ + else + switch (bearing(2)) {/* Bearing of Avvy from du Lustie. */ + case 0 ... 45: + case 315 ... 360: + xx = 1; + break; /* Middle. */ + case 45 ... 180: + xx = 2; + break; /* Left. */ + case 181 ... 314: + xx = 3; + break; /* Right. */ + } + if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + case r__aylesoffice: + if ((! dna.ayles_is_awake) && (roomtime % longint(14) == 0)) { + switch ((roomtime / longint(14)) % longint(2)) { + case 0: + show_one(1); + break; /* Frame 2: EGA. */ + case 1: + show_one(3); + break; /* Frame 1: Natural. */ + } + } + break; + + case r__robins: + if (dna.tied_up) + switch (roomtime % longint(54)) { + case 20: + show_one(4); + break; /* Frame 4: Avalot blinks. */ + case 23: + show_one(2); + break; /* Frame 1: Back to normal. */ + } + break; + + case r__nottspub: { + switch (bearing(5)) { /* Bearing of Avvy from Port. */ + case 0 ... 45: + case 315 ... 360: + xx = 2; + break; /* Middle. */ + case 45 ... 180: + xx = 6; + break; /* Left. */ + case 181 ... 314: + xx = 8; + break; /* Right. */ + } + + if ((roomtime % longint(60)) > 57) xx -= 1; /* Blinks */ + + if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + + switch (roomtime % longint(50)) { + case 45 : + show_one(9); + break; /* Spurge blinks */ + case 49 : + show_one(10); + break; + } + } + break; + + case r__ducks: { + if ((roomtime % longint(3)) == 0) /* The fire flickers */ + show_one(longint(1) + (roomtime / longint(3)) % longint(3)); + + switch (bearing(2)) {/* Bearing of Avvy from Duck. */ + case 0 ... 45: + case 315 ... 360: + xx = 4; + break; /* Middle. */ + case 45 ... 180: + xx = 6; + break; /* Left. */ + case 181 ... 314: + xx = 8; + break; /* Right. */ + } + + if ((roomtime % longint(45)) > 42) xx += 1; /* Duck blinks */ + + if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + } + } + + if ((dna.ringing_bells) && (flagset('B'))) + /* They're ringing the bells. */ + switch (roomtime % longint(4)) { + case 1: { + dnatype &with = dna; + + if (with.nextbell < 5) with.nextbell = 12; + with.nextbell -= 1; + note(notes[with.nextbell]); + } + break; + case 2: + nosound; + break; + } } -void load_chunks(string xx) -{ - chunkblocktype ch; - byte fv; - - /*$I-*/ - assign(f,string("chunk")+xx+".avd"); /* strf is done for us by Lucerna. */ - reset(f,1); - if (ioresult!=0) return; /* no Chunk file. */ - seek(f,44); - blockread(f,num_chunks,1); - blockread(f,offsets,num_chunks*4); - - for( fv=1; fv <= num_chunks; fv ++) - { - seek(f,offsets[fv]); - blockread(f,ch,sizeof(ch)); - { - if (ch.memorise) - { - - { - memotype& with1 = memos[fv]; - - with1.x=ch.x; with1.xl=ch.xl; - with1.y=ch.y; with1.yl=ch.yl; - with1.flavour=ch.flavour; - with1.size=ch.size; - } - - getmem(memory[fv],ch.size); - - if (ch.natural) - { - getimage(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl,memory[fv]); - } else - blockread(f,memory[fv],ch.size); - } else memos[fv].x=on_disk; - } - } - - close(f); - /*$I+*/ +void load_chunks(string xx) { + chunkblocktype ch; + byte fv; + + /*$I-*/ + assign(f, string("chunk") + xx + ".avd"); /* strf is done for us by Lucerna. */ + reset(f, 1); + if (ioresult != 0) return; /* no Chunk file. */ + seek(f, 44); + blockread(f, num_chunks, 1); + blockread(f, offsets, num_chunks * 4); + + for (fv = 1; fv <= num_chunks; fv ++) { + seek(f, offsets[fv]); + blockread(f, ch, sizeof(ch)); + { + if (ch.memorise) { + + { + memotype &with1 = memos[fv]; + + with1.x = ch.x; + with1.xl = ch.xl; + with1.y = ch.y; + with1.yl = ch.yl; + with1.flavour = ch.flavour; + with1.size = ch.size; + } + + getmem(memory[fv], ch.size); + + if (ch.natural) { + getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); + } else + blockread(f, memory[fv], ch.size); + } else memos[fv].x = on_disk; + } + } + + close(f); + /*$I+*/ } -void forget_chunks() -{ - byte fv; +void forget_chunks() { + byte fv; - for( fv=1; fv <= num_chunks; fv ++) - if (memos[fv].x>on_disk) - freemem(memory[fv],memos[fv].size); - fillchar(memos,sizeof(memos),'\377'); /* x=-1, => on disk. */ + for (fv = 1; fv <= num_chunks; fv ++) + if (memos[fv].x > on_disk) + freemem(memory[fv], memos[fv].size); + fillchar(memos, sizeof(memos), '\377'); /* x=-1, => on disk. */ } -void mdrop(integer x,integer y,integer xl,integer yl, pointer p) /* assembler; +void mdrop(integer x, integer y, integer xl, integer yl, pointer p) /* assembler; asm push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} push bp; { Nor BP! } @@ -357,143 +431,149 @@ asm pop bp; pop ds; { Get DS back again. } */ -{; +{ + ; } void show_one(byte which); static bytefield r; -static void display_it(integer x,integer y,integer xl,integer yl, flavourtype flavour, pointer p) -{ - { - switch (flavour) { - case ch_bgi : { - putimage(x*8,y,p,0); - r.x1=x; r.y1=y; - r.x2=x+xl+1; r.y2=y+yl; - } - break; - case ch_ega : { - mdrop(x,y,xl,yl,p); blitfix(); - r.x1=x; r.y1=y; r.x2=x+xl; r.y2=y+yl; - } - break; - } -} +static void display_it(integer x, integer y, integer xl, integer yl, flavourtype flavour, pointer p) { + { + switch (flavour) { + case ch_bgi : { + putimage(x * 8, y, p, 0); + r.x1 = x; + r.y1 = y; + r.x2 = x + xl + 1; + r.y2 = y + yl; + } + break; + case ch_ega : { + mdrop(x, y, xl, yl, p); + blitfix(); + r.x1 = x; + r.y1 = y; + r.x2 = x + xl; + r.y2 = y + yl; + } + break; + } + } } -void show_one(byte which) -{ - chunkblocktype ch; - pointer p; - byte fv; +void show_one(byte which) { + chunkblocktype ch; + pointer p; + byte fv; - setactivepage(3); + setactivepage(3); - { - memotype& with = memos[which]; + { + memotype &with = memos[which]; - if (with.x>on_disk) - { - display_it(with.x,with.y,with.xl,with.yl,with.flavour,memory[which]); - } else - { - reset(f,1); - seek(f,offsets[which]); - blockread(f,ch,sizeof(ch)); + if (with.x > on_disk) { + display_it(with.x, with.y, with.xl, with.yl, with.flavour, memory[which]); + } else { + reset(f, 1); + seek(f, offsets[which]); + blockread(f, ch, sizeof(ch)); - { - getmem(p,ch.size); - blockread(f,p,ch.size); + { + getmem(p, ch.size); + blockread(f, p, ch.size); - display_it(ch.x,ch.y,ch.xl,ch.yl,ch.flavour,p); - freemem(p,ch.size); + display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, p); + freemem(p, ch.size); - close(f); - } + close(f); + } - } + } - setactivepage(1-cp); + setactivepage(1 - cp); - for( fv=0; fv <= 1; fv ++) - getset[fv].remember(r); - } + for (fv = 0; fv <= 1; fv ++) + getset[fv].remember(r); + } } -void show_one_at(byte which, integer xxx,integer yyy); +void show_one_at(byte which, integer xxx, integer yyy); static bytefield r1; -static void display_it1(integer xl,integer yl, flavourtype flavour, pointer p, integer& xxx, integer& yyy) -{ - { - switch (flavour) { - case ch_bgi : { - putimage(xxx,yyy,p,0); - r1.x1=xxx; r1.y1=yyy; - r1.x2=xxx+xl+1; r1.y2=yyy+yl; - } - break; - case ch_ega : { - mdrop(xxx / 8,yyy,xl,yl,p); blitfix(); - r1.x1=xxx / 8; r1.y1=yyy; r1.x2=(xxx / 8)+xl; r1.y2=yyy+yl; - } - break; - } -} +static void display_it1(integer xl, integer yl, flavourtype flavour, pointer p, integer &xxx, integer &yyy) { + { + switch (flavour) { + case ch_bgi : { + putimage(xxx, yyy, p, 0); + r1.x1 = xxx; + r1.y1 = yyy; + r1.x2 = xxx + xl + 1; + r1.y2 = yyy + yl; + } + break; + case ch_ega : { + mdrop(xxx / 8, yyy, xl, yl, p); + blitfix(); + r1.x1 = xxx / 8; + r1.y1 = yyy; + r1.x2 = (xxx / 8) + xl; + r1.y2 = yyy + yl; + } + break; + } + } } -void show_one_at(byte which, integer xxx,integer yyy) -{ - chunkblocktype ch; - pointer p; - byte fv; +void show_one_at(byte which, integer xxx, integer yyy) { + chunkblocktype ch; + pointer p; + byte fv; - setactivepage(3); + setactivepage(3); - { - memotype& with = memos[which]; + { + memotype &with = memos[which]; - if (with.x>on_disk) - { - display_it1(with.xl,with.yl,with.flavour,memory[which], xxx, yyy); - } else - { - reset(f,1); - seek(f,offsets[which]); - blockread(f,ch,sizeof(ch)); + if (with.x > on_disk) { + display_it1(with.xl, with.yl, with.flavour, memory[which], xxx, yyy); + } else { + reset(f, 1); + seek(f, offsets[which]); + blockread(f, ch, sizeof(ch)); - { - getmem(p,ch.size); - blockread(f,p,ch.size); + { + getmem(p, ch.size); + blockread(f, p, ch.size); - display_it1(ch.xl,ch.yl,ch.flavour,p, xxx, yyy); - freemem(p,ch.size); + display_it1(ch.xl, ch.yl, ch.flavour, p, xxx, yyy); + freemem(p, ch.size); - close(f); - } + close(f); + } - } + } - setactivepage(1-cp); + setactivepage(1 - cp); - for( fv=0; fv <= 1; fv ++) - getset[fv].remember(r1); - } + for (fv = 0; fv <= 1; fv ++) + getset[fv].remember(r1); + } } class unit_celer_initialize { - public: unit_celer_initialize(); +public: + unit_celer_initialize(); }; static unit_celer_initialize celer_constructor; unit_celer_initialize::unit_celer_initialize() { - num_chunks=0; + num_chunks = 0; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index c48bb468e79f..9db53b57eb42 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -35,23 +35,23 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; struct memotype { - integer x,y; - integer xl,yl; - flavourtype flavour; - word size; + integer x, y; + integer xl, yl; + flavourtype flavour; + word size; }; @@ -60,23 +60,23 @@ struct memotype { #define EXTERN #endif -EXTERN array<1,40,longint> offsets; +EXTERN array<1, 40, longint> offsets; EXTERN byte num_chunks; -EXTERN array<1,40,memotype> memos; -EXTERN array<1,40,pointer> memory; +EXTERN array<1, 40, memotype> memos; +EXTERN array<1, 40, pointer> memory; #undef EXTERN #define EXTERN extern - void pics_link(); +void pics_link(); - void load_chunks(string xx); +void load_chunks(string xx); - void forget_chunks(); +void forget_chunks(); - void show_one(byte which); +void show_one(byte which); - void show_one_at(byte which, integer xxx,integer yyy); +void show_one_at(byte which, integer xxx, integer yyy); } // End of namespace Avalanche. diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index a1091276645d..98ea2a51e420 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,26 +29,26 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; untyped_file f; longint offset; chunkblocktype ch; -integer gd,gm; +integer gd, gm; byte bit; pointer p; -void mdrop(integer x,integer y,integer xl,integer yl, pointer p) /* assembler; +void mdrop(integer x, integer y, integer xl, integer yl, pointer p) /* assembler; asm push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} push bp; { Nor BP! } @@ -142,41 +142,44 @@ asm pop bp; pop ds; { Get DS back again. } */ -{; +{ + ; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(f,"chunk21.avd"); - reset(f,1); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(f, "chunk21.avd"); + reset(f, 1); - seek(f,49); - blockread(f,offset,4); + seek(f, 49); + blockread(f, offset, 4); - seek(f,offset); + seek(f, offset); - blockread(f,ch,sizeof(ch)); + blockread(f, ch, sizeof(ch)); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); - getmem(p,ch.size); - blockread(f,p,ch.size); -/* putimage(0,0,p^,0);*/ + getmem(p, ch.size); + blockread(f, p, ch.size); + /* putimage(0,0,p^,0);*/ -/* with ch do - for bit:=0 to 3 do - begin; - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - for gm:=0 to yl do - blockread(f,mem[$A000*gm*80],(ch.xl+7) div 8); - end;*/ + /* with ch do + for bit:=0 to 3 do + begin; + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + for gm:=0 to yl do + blockread(f,mem[$A000*gm*80],(ch.xl+7) div 8); + end;*/ - mdrop(ch.x,ch.y,ch.xl,ch.yl,p); + mdrop(ch.x, ch.y, ch.xl, ch.yl, p); - close(f); -return EXIT_SUCCESS; + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index 985bbf0707f6..d599ef5881f0 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,29 +30,33 @@ namespace Avalanche { struct infotype { - matrix<128,255,1,8,byte> chars; - string data; + matrix<128, 255, 1, 8, byte> chars; + string data; }; infotype table; pointer where; -byte w,fv,ff,num; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1f,where); move(where,table,1024); - for( w=128; w <= 255; w ++) - {; output << w << NL; - for( fv=1; fv <= 8; fv ++) - {; - num=table.chars[w][fv]; - for( ff=1; ff <= 8; ff ++) - {; - if ((num & 128)==0) output << " "; else output << ""; - num=num << 1; - } - output << NL; - } } -return EXIT_SUCCESS; +byte w, fv, ff, num; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1f, where); + move(where, table, 1024); + for (w = 128; w <= 255; w ++) { + ; + output << w << NL; + for (fv = 1; fv <= 8; fv ++) { + ; + num = table.chars[w][fv]; + for (ff = 1; ff <= 8; ff ++) { + ; + if ((num & 128) == 0) output << " "; + else output << ""; + num = num << 1; + } + output << NL; + } + } + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp index 4b7dd0e9fd0e..68d269def970 100644 --- a/engines/avalanche/chunker.cpp +++ b/engines/avalanche/chunker.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -27,87 +27,84 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; untyped_file f; string fn; -byte num_chunks,fv; +byte num_chunks, fv; longint offset; chunkblocktype ch; -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - output << NL; - output << "CHUNKER 12/3/1995 TT" << NL; - output << NL; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + output << NL; + output << "CHUNKER 12/3/1995 TT" << NL; + output << NL; - if (paramcount!=1) - { - output << "which chunk file?" << NL; - exit(0); - } + if (paramcount != 1) { + output << "which chunk file?" << NL; + exit(0); + } - fn=paramstr(1); - assign(f,fn); - reset(f,1); - output << "----- In chunk file " << fn << ", there are: -----" << NL; + fn = paramstr(1); + assign(f, fn); + reset(f, 1); + output << "----- In chunk file " << fn << ", there are: -----" << NL; - seek(f,44); - blockread(f,num_chunks,1); - output << format(num_chunks,4) << " chunks:" << NL; + seek(f, 44); + blockread(f, num_chunks, 1); + output << format(num_chunks, 4) << " chunks:" << NL; - output << " No Hdr Offset Flvr Mem Nat X Y Width Height Size of image" << NL; + output << " No Hdr Offset Flvr Mem Nat X Y Width Height Size of image" << NL; - for( fv=1; fv <= num_chunks; fv ++) - { + for (fv = 1; fv <= num_chunks; fv ++) { - output << "Ch" << format(fv,2) << ':'; + output << "Ch" << format(fv, 2) << ':'; - seek(f,41+fv*4); + seek(f, 41 + fv * 4); - output << format(41+fv*4,4); - blockread(f,offset,4); - output << format(offset,10); + output << format(41 + fv * 4, 4); + blockread(f, offset, 4); + output << format(offset, 10); - seek(f,offset); - blockread(f,ch,sizeof(ch)); - { - if (ch.flavour==ch_bgi) - output << " ch_BGI"; - else - output << " ch_EGA"; + seek(f, offset); + blockread(f, ch, sizeof(ch)); + { + if (ch.flavour == ch_bgi) + output << " ch_BGI"; + else + output << " ch_EGA"; - if (ch.memorise) - output << " yes"; - else - output << " no "; + if (ch.memorise) + output << " yes"; + else + output << " no "; - if (ch.natural) - output << " yes"; - else - output << " no "; + if (ch.natural) + output << " yes"; + else + output << " no "; - output << format(ch.x,7) << format(ch.y,7) << format(ch.xl,7) << format(ch.yl,7) << format(ch.size,10); - } + output << format(ch.x, 7) << format(ch.y, 7) << format(ch.xl, 7) << format(ch.yl, 7) << format(ch.size, 10); + } - output << NL; - } + output << NL; + } - output << "---ENDS---" << NL; + output << "---ENDS---" << NL; - close(f); - return EXIT_SUCCESS; + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index 5118d7d91696..ba6ab57bf33d 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -43,61 +43,68 @@ namespace Avalanche { memorise:boolean; { Hold it in memory? } end;*/ -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; /* arraysize = 12000;*/ /* offsets:array[1..30] of longint;*/ byte num_chunks/*,this_chunk*/; -integer gd,gm; +integer gd, gm; /* f:file;*/ /* aa:array[0..arraysize] of byte;*/ -void load() -{ - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - assign(f,"chunkbit.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - assign(f,"place21.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); +void load() { + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + assign(f, "chunkbit.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + assign(f, "place21.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); } -void open_chunk() -{; - assign(f,"chunk21.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk21.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } /* procedure mgrab(x1,y1,x2,y2:integer; size:word); @@ -193,7 +200,7 @@ end;*/ /*procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; mem,nat:boolean);*/ - /* yes, I *do* know how to spell "really"! */ +/* yes, I *do* know how to spell "really"! */ /*var s:word; p:pointer; @@ -260,27 +267,29 @@ begin; (* rectangle(x1,y1,x2,y2);*) end;*/ -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - setwritemode(xorput); - - num_chunks=7; - - open_chunk(); - - grab( 98,10,181,41,247,82,ch_ega,false,false); /* Drawbridge... */ - grab(223,10,320,41,233,82,ch_ega,false,false); - grab(361,10,458,64,233,82,ch_ega,false,false); - - grab( 11,10, 39,22,172,17,ch_bgi,true,true); - grab( 11,38, 39,50,172,17,ch_ega,true,false); /* Flag. */ - grab( 11,24, 39,36,172,17,ch_ega,true,false); - grab( 11,10, 39,22,172,17,ch_ega,true,false); - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + setwritemode(xorput); + + num_chunks = 7; + + open_chunk(); + + grab(98, 10, 181, 41, 247, 82, ch_ega, false, false); /* Drawbridge... */ + grab(223, 10, 320, 41, 233, 82, ch_ega, false, false); + grab(361, 10, 458, 64, 233, 82, ch_ega, false, false); + + grab(11, 10, 39, 22, 172, 17, ch_bgi, true, true); + grab(11, 38, 39, 50, 172, 17, ch_ega, true, false); /* Flag. */ + grab(11, 24, 39, 36, 172, 17, ch_ega, true, false); + grab(11, 10, 39, 22, 172, 17, ch_ega, true, false); + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 3b6caa78e7e7..781f798d176d 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,191 +29,205 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 32000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void load() -{ - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place9.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); +array<0, arraysize, byte> aa; + +void load() { + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place9.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); } -void load_temp(string which) -{ - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - assign(f,which); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - bit=getpixel(0,0); +void load_temp(string which) { + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + assign(f, which); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -void open_chunk() -{; - assign(f,"chunk9.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk9.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2, integer realx, integer realy, boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - if (nat) - ch.flavour=ch_bgi; - else ch.flavour=ch_ega; /* At the moment, Celer can't handle natural ch_EGAs. */ - ch.x=realx; - ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - freemem(p,s); - {; - if (ch.flavour==ch_bgi) s=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - else s=4*((x2-x1+7) / 8)*(y2-y1+1); - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - if (! nat) blockwrite(f,aa,s); + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + if (nat) + ch.flavour = ch_bgi; + else ch.flavour = ch_ega; /* At the moment, Celer can't handle natural ch_EGAs. */ + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + freemem(p, s); + { + ; + if (ch.flavour == ch_bgi) s = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + else s = 4 * ((x2 - x1 + 7) / 8) * (y2 - y1 + 1); + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + if (! nat) blockwrite(f, aa, s); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - load_temp("d:chunkbit.avd"); - setwritemode(xorput); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + load_temp("d:chunkbit.avd"); + setwritemode(xorput); - num_chunks=7; + num_chunks = 7; - open_chunk(); + open_chunk(); - grab( 78, 78,232,102,212, 10,true,false); /* 154 across */ - grab(235, 78,389,102,212, 10,true,false); - grab(392, 78,546,102,212, 10,true,false); - grab(392, 78,546,102,212, 10,true,true); + grab(78, 78, 232, 102, 212, 10, true, false); /* 154 across */ + grab(235, 78, 389, 102, 212, 10, true, false); + grab(392, 78, 546, 102, 212, 10, true, false); + grab(392, 78, 546, 102, 212, 10, true, true); - load_temp("d:chunkbi3.avd"); + load_temp("d:chunkbi3.avd"); - grab(437, 51,475, 78,147,120,false,false); /* 5 = door half-open. */ - grab(397, 51,435, 78,147,120,false,false); /* 6 = door open. */ - grab(397, 51,435, 78,147,120,true,true); /* 7 = door shut. */ + grab(437, 51, 475, 78, 147, 120, false, false); /* 5 = door half-open. */ + grab(397, 51, 435, 78, 147, 120, false, false); /* 6 = door open. */ + grab(397, 51, 435, 78, 147, 120, true, true); /* 7 = door shut. */ - close_chunk(); -return EXIT_SUCCESS; + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index ab27863f3b6e..b0bb23242f29 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -58,100 +58,135 @@ var f:file; aa:array[0..arraysize] of byte;*/ -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void loadtemp(string n) -{ - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - assign(f,n); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - bit=getpixel(0,0); - finder(); +void loadtemp(string n) { + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + assign(f, n); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); + finder(); } -void load() -{ - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - assign(f,"place22.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setactivepage(1); setvisualpage(1); finder(); - setactivepage(0); setvisualpage(0); +void load() { + byte a0 /*absolute $A000:800*/; + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + assign(f, "place22.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setactivepage(1); + setvisualpage(1); + finder(); + setactivepage(0); + setvisualpage(0); } -void open_chunk() -{; - assign(f,"chunk22.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk22.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } /*procedure mgrab(x1,y1,x2,y2:integer; size:word); @@ -243,35 +278,38 @@ begin; { rectangle(x1,y1,x2,y2);} end;*/ -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - loadtemp("chunkbit.avd"); load(); - setwritemode(xorput); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + loadtemp("chunkbit.avd"); + load(); + setwritemode(xorput); - num_chunks=9; + num_chunks = 9; - open_chunk(); + open_chunk(); - grab( 0,103,169,159, 72,86,ch_ega,false,false); /* Stairs... */ - grab(172,103,341,159, 72,86,ch_ega,false,false); + grab(0, 103, 169, 159, 72, 86, ch_ega, false, false); /* Stairs... */ + grab(172, 103, 341, 159, 72, 86, ch_ega, false, false); - loadtemp("chunkbi3.avd"); + loadtemp("chunkbi3.avd"); - grab( 0,130, 79,157,341,94,ch_bgi,true ,true ); - grab( 0,130, 79,157,341,94,ch_ega,false,false); - grab( 0,102, 79,129,341,94,ch_ega,false,false); - grab( 0, 74, 79,101,341,94,ch_ega,false,false); /* Far door. */ + grab(0, 130, 79, 157, 341, 94, ch_bgi, true , true); + grab(0, 130, 79, 157, 341, 94, ch_ega, false, false); + grab(0, 102, 79, 129, 341, 94, ch_ega, false, false); + grab(0, 74, 79, 101, 341, 94, ch_ega, false, false); /* Far door. */ - loadtemp("chunkbi2.avd"); + loadtemp("chunkbi2.avd"); - grab(393, 92,451,137,512,98,ch_bgi,true ,true ); /* Right-hand door. */ - grab(393, 92,451,137,512,98,ch_ega,false,false); - grab(453, 92,511,137,512,98,ch_ega,false,false); + grab(393, 92, 451, 137, 512, 98, ch_bgi, true , true); /* Right-hand door. */ + grab(393, 92, 451, 137, 512, 98, ch_ega, false, false); + grab(453, 92, 511, 137, 512, 98, ch_ega, false, false); - close_chunk(); -return EXIT_SUCCESS; + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 0ac2e1f85c29..8648964d9e85 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,282 +31,315 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -enum kind {walled,unwalled, last_kind}; +enum kind {walled, unwalled, last_kind}; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -const kind w = walled; const kind uw = unwalled; +const kind w = walled; +const kind uw = unwalled; -array<1,50,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 50, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void rdln() -{ - char r; - return; - do { r=readkey(); } while (!(! keypressed())); +array<0, arraysize, byte> aa; + +void rdln() { + char r; + return; + do { + r = readkey(); + } while (!(! keypressed())); } -void load(kind k) -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; +void load(kind k) { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; - if (k==unwalled) assign(f,"place29.avd"); - else assign(f,"walled.avd"); + if (k == unwalled) assign(f, "place29.avd"); + else assign(f, "walled.avd"); - reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } - close(f); - bit=getpixel(0,0); + close(f); + bit = getpixel(0, 0); } -void finder() -{ - char r; integer x,y; - return; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +void finder() { + char r; + integer x, y; + return; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void loadtemp(string which) -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; +void loadtemp(string which) { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; - assign(f,string("corr")+which+"tmp.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); + assign(f, string("corr") + which + "tmp.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); - bit=getpixel(0,0); + bit = getpixel(0, 0); - finder(); + finder(); } -void open_chunk() -{ - assign(f,"chunk29.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + assign(f, "chunk29.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{ - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; - - if (size>arraysize) - { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - { - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + + if (size > arraysize) { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat, kind k) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat, kind k) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; - -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - { - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - load(k); - - setvisualpage(1); - setactivepage(1); - rdln(); - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - { - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - { - ch.size=s; - ch.x=ch.x / 8; - ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - { - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - rdln(); - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : { - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + load(k); + + setvisualpage(1); + setactivepage(1); + rdln(); + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ch.size = s; + ch.x = ch.x / 8; + ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + rdln(); + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - setwritemode(xorput); - - loadtemp("2"); - - num_chunks=32; - - open_chunk(); - - grab( 0, 11,100,104,260,41,ch_ega,false,false,uw); /*1 Geida's door. */ - grab(103, 12,203, 55,207,61,ch_ega,false,false,uw); /*2 "Ite mingite" sign. */ - grab(123, 59,185,103,254,90,ch_ega,false,false,uw); /*3 Normal N door (rt handle)*/ - grab(227, 10,289, 56,254,88,ch_ega,false,false,uw); /*4 Normal N door (lt handle)*/ - grab(207, 63,294,105, 9,47,ch_ega,false,false, w); /*5 Window in left wall. */ - grab(312, 10,416, 56,233,88,ch_ega,false,false,uw); /*6 North archway */ - grab(331, 78,384,101, 32,64,ch_ega,false,false, w); /*7 2 torches, L wall. */ - grab(607,142,621,157,233,88,ch_ega,false,false,uw); /*8 1 torch, N wall. */ - grab(417, 11,577, 59,311,61,ch_ega,false,false,uw); /*9 "The Wrong Way!" sign. */ - - loadtemp("3"); - - grab( 0, 11, 62, 63,557,108,ch_ega,false,false, w); /*10 Near right candle */ - grab( 64, 11,120, 63, 18,108,ch_ega,false,false, w); /*11 Near left candle */ - grab(122, 11,169, 55, 93,100,ch_ega,false,false, w); /*12 Far left candle */ - grab(171, 11,222, 52,500,100,ch_ega,false,false, w); /*13 Far right candle */ - grab( 32, 68, 84,104,285, 70,ch_ega,false,false,uw); /*14 Far window */ - grab(138, 65,190, 92,233, 88,ch_ega,false,false,uw); /*15 Baron du Lustie pic 1 */ - grab(244, 65,296, 92,103, 51,ch_ega,false,false,uw); /*16 Baron du Lustie pic 2 */ - grab(172, 54,280, 63,233, 88,ch_ega,false,false,uw); /*17 "Art Gallery" sign */ - grab(341, 18,402, 47,563, 48,ch_ega,false,false, w); /*18 Right wall torches */ - grab(528, 10,639,160,528, 10,ch_ega,false,false,uw); /*19 Right wall */ - grab(430, 50,526, 88,543, 50,ch_ega,false,false, w); /*20 Window in right wall */ - grab(451, 91,494,152,566, 91,ch_ega,false,false, w); /*21 Door in right wall */ - grab(238, 10,307, 14,484,156,ch_ega,false,false, w); /*22 Near wall door: right */ - grab(239, 16,300, 20,300,156,ch_ega,false,false, w); /*23 Near wall door: middle */ - grab(234, 22,306, 26,100,156,ch_ega,false,false, w); /*24 Near wall door: left */ - grab( 25,113, 87,156,254, 90,ch_ega,false,false, w); /*25 Far door opening stage 1 */ - grab(131,113,193,156,254, 90,ch_ega,false,false, w); /*26 Far door opening stage 2 */ - grab(237,113,299,156,254, 90,ch_ega,false,false, w); /*27 Far door opening stage 3 */ - - loadtemp("4"); - - grab( 0, 11,112,160, 0, 11,ch_ega,false,false,uw); /*28 Left wall */ - grab(144, 44,197, 76, 30, 44,ch_ega,false,false, w); /*29 Shield on L wall. */ - grab(149, 90,192,152, 35, 90,ch_ega,false,false, w); /*30 Door in L wall. */ - grab(463, 28,527, 43,252,100,ch_ega,false,false, w); /*31 Archway x 2 */ - grab(463, 79,527, 94,252,100,ch_ega,false,false, w); /*32 Archway x 3 */ - - close_chunk(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + setwritemode(xorput); + + loadtemp("2"); + + num_chunks = 32; + + open_chunk(); + + grab(0, 11, 100, 104, 260, 41, ch_ega, false, false, uw); /*1 Geida's door. */ + grab(103, 12, 203, 55, 207, 61, ch_ega, false, false, uw); /*2 "Ite mingite" sign. */ + grab(123, 59, 185, 103, 254, 90, ch_ega, false, false, uw); /*3 Normal N door (rt handle)*/ + grab(227, 10, 289, 56, 254, 88, ch_ega, false, false, uw); /*4 Normal N door (lt handle)*/ + grab(207, 63, 294, 105, 9, 47, ch_ega, false, false, w); /*5 Window in left wall. */ + grab(312, 10, 416, 56, 233, 88, ch_ega, false, false, uw); /*6 North archway */ + grab(331, 78, 384, 101, 32, 64, ch_ega, false, false, w); /*7 2 torches, L wall. */ + grab(607, 142, 621, 157, 233, 88, ch_ega, false, false, uw); /*8 1 torch, N wall. */ + grab(417, 11, 577, 59, 311, 61, ch_ega, false, false, uw); /*9 "The Wrong Way!" sign. */ + + loadtemp("3"); + + grab(0, 11, 62, 63, 557, 108, ch_ega, false, false, w); /*10 Near right candle */ + grab(64, 11, 120, 63, 18, 108, ch_ega, false, false, w); /*11 Near left candle */ + grab(122, 11, 169, 55, 93, 100, ch_ega, false, false, w); /*12 Far left candle */ + grab(171, 11, 222, 52, 500, 100, ch_ega, false, false, w); /*13 Far right candle */ + grab(32, 68, 84, 104, 285, 70, ch_ega, false, false, uw); /*14 Far window */ + grab(138, 65, 190, 92, 233, 88, ch_ega, false, false, uw); /*15 Baron du Lustie pic 1 */ + grab(244, 65, 296, 92, 103, 51, ch_ega, false, false, uw); /*16 Baron du Lustie pic 2 */ + grab(172, 54, 280, 63, 233, 88, ch_ega, false, false, uw); /*17 "Art Gallery" sign */ + grab(341, 18, 402, 47, 563, 48, ch_ega, false, false, w); /*18 Right wall torches */ + grab(528, 10, 639, 160, 528, 10, ch_ega, false, false, uw); /*19 Right wall */ + grab(430, 50, 526, 88, 543, 50, ch_ega, false, false, w); /*20 Window in right wall */ + grab(451, 91, 494, 152, 566, 91, ch_ega, false, false, w); /*21 Door in right wall */ + grab(238, 10, 307, 14, 484, 156, ch_ega, false, false, w); /*22 Near wall door: right */ + grab(239, 16, 300, 20, 300, 156, ch_ega, false, false, w); /*23 Near wall door: middle */ + grab(234, 22, 306, 26, 100, 156, ch_ega, false, false, w); /*24 Near wall door: left */ + grab(25, 113, 87, 156, 254, 90, ch_ega, false, false, w); /*25 Far door opening stage 1 */ + grab(131, 113, 193, 156, 254, 90, ch_ega, false, false, w); /*26 Far door opening stage 2 */ + grab(237, 113, 299, 156, 254, 90, ch_ega, false, false, w); /*27 Far door opening stage 3 */ + + loadtemp("4"); + + grab(0, 11, 112, 160, 0, 11, ch_ega, false, false, uw); /*28 Left wall */ + grab(144, 44, 197, 76, 30, 44, ch_ega, false, false, w); /*29 Shield on L wall. */ + grab(149, 90, 192, 152, 35, 90, ch_ega, false, false, w); /*30 Door in L wall. */ + grab(463, 28, 527, 43, 252, 100, ch_ega, false, false, w); /*31 Archway x 2 */ + grab(463, 79, 527, 94, 252, 100, ch_ega, false, false, w); /*32 Archway x 3 */ + + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index c4041d67f445..72cc0c39b796 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,241 +31,287 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"v:place1.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - - setvisualpage(1); setactivepage(1); - finder(); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "v:place1.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + + setvisualpage(1); + setactivepage(1); + finder(); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi9.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - setvisualpage(0); setactivepage(0); - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi9.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + setvisualpage(0); + setactivepage(0); + finder(); } -void open_chunk() -{; - assign(f,"chunk1.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk1.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - if (! nat) putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2+7) / 8)-(x1 / 8))*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + if (! nat) putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 + 7) / 8) - (x1 / 8)) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=9; - - open_chunk(); - - grab( 48, 42, 94, 66,400,105,ch_ega, true,false); /*1 Avvy asleep. */ - grab(100, 42,146, 66,400,105,ch_ega, true,false); /*2 Avvy asleep again. */ - grab(152, 42,198, 66,400,105,ch_ega,false,false); /*3 Avvy awake in bed. */ - grab(106,113,152,137,400,105,ch_bgi,true ,true ); /*4 No Avvy in bed. */ - - grab(206, 42,279, 75,150, 91,ch_ega,false,false); /*5 Open trunk. */ - grab(206, 42,287, 75,150, 91,ch_bgi,true, true); /*6 Shut trunk. */ - - grab( 69, 70,102, 88,431,100,ch_ega,false,false); /*7 Arkata 1. */ - grab(118, 70,151, 88,431,100,ch_ega,false,false); /*8 Arkata 2. */ - grab(167, 70,200, 88,431,100,ch_ega,false,false); /*9 Arkata 3. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 9; + + open_chunk(); + + grab(48, 42, 94, 66, 400, 105, ch_ega, true, false); /*1 Avvy asleep. */ + grab(100, 42, 146, 66, 400, 105, ch_ega, true, false); /*2 Avvy asleep again. */ + grab(152, 42, 198, 66, 400, 105, ch_ega, false, false); /*3 Avvy awake in bed. */ + grab(106, 113, 152, 137, 400, 105, ch_bgi, true , true); /*4 No Avvy in bed. */ + + grab(206, 42, 279, 75, 150, 91, ch_ega, false, false); /*5 Open trunk. */ + grab(206, 42, 287, 75, 150, 91, ch_bgi, true, true); /*6 Shut trunk. */ + + grab(69, 70, 102, 88, 431, 100, ch_ega, false, false); /*7 Arkata 1. */ + grab(118, 70, 151, 88, 431, 100, ch_ega, false, false); /*8 Arkata 2. */ + grab(167, 70, 200, 88, 431, 100, ch_ega, false, false); /*9 Arkata 3. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index b2c6cf4b020d..b02a9d2e24df 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,248 +31,297 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; const integer x_ofs = 165; const integer y_ofs = 58; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"v:place19.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "v:place19.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"d:temp1.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - -/* finder;*/ +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "d:temp1.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + /* finder;*/ } -void open_chunk() -{; - assign(f,"chunk19.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk19.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; - x1 -= x_ofs; x2 -= x_ofs; - y1 -= y_ofs; y2 -= y_ofs; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); -/* readln;*/ - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - -/* readln;*/ - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + x1 -= x_ofs; + x2 -= x_ofs; + y1 -= y_ofs; + y2 -= y_ofs; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + /* readln;*/ + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + /* readln;*/ + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=13; - - open_chunk(); - - grab(165, 68,207, 87,127,105,ch_ega,false,false); /*1 The settle with no lute*/ - grab(209, 68,255, 96,159, 84,ch_bgi, true, true); /*2 Dogfood looks right. */ - grab(209, 68,255, 96,159, 84,ch_ega, true,false); /*3 Dogfood- straight ahead. */ - grab(257, 68,303, 96,159, 84,ch_ega, true,false); /*4 Dogfood- left. */ - grab(305, 68,351, 96,159, 84,ch_ega, true,false); /*5 DF drinks: stage 1. */ - grab(353, 68,399, 96,159, 84,ch_ega, true,false); /*6 DF drinks: stage 2. */ - grab(401, 68,447, 96,159, 84,ch_ega, true,false); /*7 DF drinks: stage 3. */ - grab(449, 84,465, 94,392, 87,ch_ega, true,false); /*8 Ibythneth smiles. */ - grab(449, 75,488, 82,341,123,ch_ega, true,false); /*9 No habit under the settle. */ - grab(508, 68,580,106,485,105,ch_ega, true,false); /*10 M gets your drink. */ - grab(508, 68,580,106,485,105,ch_bgi, true, true); /*11 M gets up again. */ - grab(470, 84,486, 91,510,108,ch_ega, true,false); /*12 M looks right. */ - grab(488, 84,504, 91,510,108,ch_ega, true,false); /*13 M winks. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 13; + + open_chunk(); + + grab(165, 68, 207, 87, 127, 105, ch_ega, false, false); /*1 The settle with no lute*/ + grab(209, 68, 255, 96, 159, 84, ch_bgi, true, true); /*2 Dogfood looks right. */ + grab(209, 68, 255, 96, 159, 84, ch_ega, true, false); /*3 Dogfood- straight ahead. */ + grab(257, 68, 303, 96, 159, 84, ch_ega, true, false); /*4 Dogfood- left. */ + grab(305, 68, 351, 96, 159, 84, ch_ega, true, false); /*5 DF drinks: stage 1. */ + grab(353, 68, 399, 96, 159, 84, ch_ega, true, false); /*6 DF drinks: stage 2. */ + grab(401, 68, 447, 96, 159, 84, ch_ega, true, false); /*7 DF drinks: stage 3. */ + grab(449, 84, 465, 94, 392, 87, ch_ega, true, false); /*8 Ibythneth smiles. */ + grab(449, 75, 488, 82, 341, 123, ch_ega, true, false); /*9 No habit under the settle. */ + grab(508, 68, 580, 106, 485, 105, ch_ega, true, false); /*10 M gets your drink. */ + grab(508, 68, 580, 106, 485, 105, ch_bgi, true, true); /*11 M gets up again. */ + grab(470, 84, 486, 91, 510, 108, ch_ega, true, false); /*12 M looks right. */ + grab(488, 84, 504, 91, 510, 108, ch_ega, true, false); /*13 M winks. */ + close_chunk(); + return EXIT_SUCCESS; } diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index c1f189b2ced5..6137bc3056fb 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place25.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place25.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk25.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk25.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab( 16, 24,101, 45,448,116,ch_ega, true,false); /*2 The fire again. */ - grab(118, 20,203, 45,448,112,ch_bgi, true, true); /*1 The natural fire. */ - grab(118, 20,203, 45,448,112,ch_ega, true,false); /*3 Third stage of the fire. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(16, 24, 101, 45, 448, 116, ch_ega, true, false); /*2 The fire again. */ + grab(118, 20, 203, 45, 448, 112, ch_bgi, true, true); /*1 The natural fire. */ + grab(118, 20, 203, 45, 448, 112, ch_ega, true, false); /*3 Third stage of the fire. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index 97b9502dc3c4..a3a8b14b3ed8 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,240 +31,287 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place23.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place23.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp(string x) -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,x); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp(string x) { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, x); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk23.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk23.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp("chunkbi3.avd"); - setwritemode(xorput); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp("chunkbi3.avd"); + setwritemode(xorput); - num_chunks=6; + num_chunks = 6; - open_chunk(); + open_chunk(); - grab(226, 21,242, 29,348, 96,ch_bgi, true,true ); /*1 Looking forwards. */ - grab(226, 21,242, 29,348, 96,ch_ega, true,false); /*2 Looking left. */ - grab(253, 21,269, 29,348, 96,ch_ega, true,false); /*3 Looking right. */ - grab(240, 11,256, 19,348, 96,ch_ega, true,false); /*4 Blinking. */ + grab(226, 21, 242, 29, 348, 96, ch_bgi, true, true); /*1 Looking forwards. */ + grab(226, 21, 242, 29, 348, 96, ch_ega, true, false); /*2 Looking left. */ + grab(253, 21, 269, 29, 348, 96, ch_ega, true, false); /*3 Looking right. */ + grab(240, 11, 256, 19, 348, 96, ch_ega, true, false); /*4 Blinking. */ - loadtemp("chunkbi4.avd"); + loadtemp("chunkbi4.avd"); - grab( 48, 83,110,126,324, 96,ch_ega,false,false); /*5 Eyes shut... */ - grab(112, 83,173,126,325, 96,ch_ega,false,false); /*6 Asleep. */ + grab(48, 83, 110, 126, 324, 96, ch_ega, false, false); /*5 Eyes shut... */ + grab(112, 83, 173, 126, 325, 96, ch_ega, false, false); /*6 Asleep. */ - close_chunk(); -return EXIT_SUCCESS; + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index ddf079c7af80..dbd342ada2df 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,234 +31,281 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place42.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place42.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"a:chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "a:chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk42.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk42.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=4; - - open_chunk(); - - grab(276, 36,329, 73, 94, 97,ch_bgi, true,true ); /*1 Not tied to the tree.*/ - grab(276, 36,329, 73, 94, 97,ch_ega,false,false); /*2 Tied to the tree. */ - grab(182, 80,226, 88,311,132,ch_ega,false,false); /*3 Mushrooms have gone! */ - grab(253, 75,267, 82,114, 98,ch_ega,false,false); /*4 Avalot blinks. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 4; + + open_chunk(); + + grab(276, 36, 329, 73, 94, 97, ch_bgi, true, true); /*1 Not tied to the tree.*/ + grab(276, 36, 329, 73, 94, 97, ch_ega, false, false); /*2 Tied to the tree. */ + grab(182, 80, 226, 88, 311, 132, ch_ega, false, false); /*3 Mushrooms have gone! */ + grab(253, 75, 267, 82, 114, 98, ch_ega, false, false); /*4 Avalot blinks. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index b2faafe4d507..622e6be2dbca 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,237 +31,284 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place7.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); -/* finder;*/ - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place7.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + /* finder;*/ + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - -/* finder;*/ +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + /* finder;*/ } -void open_chunk() -{; - assign(f,"chunk7.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk7.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=7; - - open_chunk(); - - grab(220, 32,269, 62,370,115,ch_ega,false,false); /*1 Jacques awake... */ - grab(400, 12,450, 48,369,112,ch_ega,false,false); /*2 Jacques gone! */ - grab(116, 47,176, 98,393, 87,ch_ega,false,false); /*3 Jacques going... */ - grab(333, 31,393, 82,393, 87,ch_ega,false,false); /*4 The open door. */ - grab(396, 80,452,135, 39, 91,ch_ega,false,false); /*5 The left door opening. */ - grab(455, 80,510,135, 39, 91,ch_ega,false,false); /*6 The left door open. */ - grab(455, 80,510,135, 39, 91,ch_bgi,true ,true ); /*7 The left door shut. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 7; + + open_chunk(); + + grab(220, 32, 269, 62, 370, 115, ch_ega, false, false); /*1 Jacques awake... */ + grab(400, 12, 450, 48, 369, 112, ch_ega, false, false); /*2 Jacques gone! */ + grab(116, 47, 176, 98, 393, 87, ch_ega, false, false); /*3 Jacques going... */ + grab(333, 31, 393, 82, 393, 87, ch_ega, false, false); /*4 The open door. */ + grab(396, 80, 452, 135, 39, 91, ch_ega, false, false); /*5 The left door opening. */ + grab(455, 80, 510, 135, 39, 91, ch_ega, false, false); /*6 The left door open. */ + grab(455, 80, 510, 135, 39, 91, ch_bgi, true , true); /*7 The left door shut. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 5249e6c6f53d..820bd7816c9d 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,235 +31,282 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place71.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place71.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"d:chunkbi2.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "d:chunkbi2.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk71.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk71.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=5; - - open_chunk(); - - grab( 54, 57,124,116,188, 94,ch_ega,false,false); /*1 Door half-shut. */ - grab(144, 57,203,116,188, 94,ch_ega,false,false); /*2 Door shut. */ - grab(513, 92,572,151,188, 94,ch_ega,false,false); /*3 Door with arrow. */ - grab(610, 94,627,106,367,122,ch_ega,false,false); /*4 Holder with no pen. */ - grab( 54, 57,124,116,188, 94,ch_bgi,true ,true ); /*5 Door wide open. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 5; + + open_chunk(); + + grab(54, 57, 124, 116, 188, 94, ch_ega, false, false); /*1 Door half-shut. */ + grab(144, 57, 203, 116, 188, 94, ch_ega, false, false); /*2 Door shut. */ + grab(513, 92, 572, 151, 188, 94, ch_ega, false, false); /*3 Door with arrow. */ + grab(610, 94, 627, 106, 367, 122, ch_ega, false, false); /*4 Holder with no pen. */ + grab(54, 57, 124, 116, 188, 94, ch_bgi, true , true); /*5 Door wide open. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index 4c2e58b6ed6b..da5ffc531f78 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place2.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place2.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"d:chunkbi2.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "d:chunkbi2.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk2.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk2.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab( 59, 15,166, 55,226, 86,ch_ega,false,false); /*1 Door half-shut. */ - grab(171, 15,278, 55,226, 86,ch_ega,false,false); /*2 Door half-open. */ - grab(283, 15,390, 55,226, 86,ch_ega,false,false); /*3 Door open. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(59, 15, 166, 55, 226, 86, ch_ega, false, false); /*1 Door half-shut. */ + grab(171, 15, 278, 55, 226, 86, ch_ega, false, false); /*2 Door half-open. */ + grab(283, 15, 390, 55, 226, 86, ch_ega, false, false); /*3 Door open. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index efc94acfeef4..11aa04c3d890 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place15.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place15.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"d:chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "d:chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk15.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk15.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab(535, 11,633, 74, 46, 97,ch_ega,false,false); /*1 Door half-open. */ - grab(539, 76,637,139, 46, 97,ch_ega,false,false); /*2 Door open. */ - grab(539, 76,637,139, 46, 97,ch_bgi,true ,true ); /*3 Door shut. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(535, 11, 633, 74, 46, 97, ch_ega, false, false); /*1 Door half-open. */ + grab(539, 76, 637, 139, 46, 97, ch_ega, false, false); /*2 Door open. */ + grab(539, 76, 637, 139, 46, 97, ch_bgi, true , true); /*3 Door shut. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index 16e4aa1d0444..0b2757a7b402 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place5.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place5.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi2.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi2.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk5.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk5.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab(252, 57,375,132,501, 85,ch_ega,false,false); /*1 Door half-open. */ - grab(418, 15,553, 90,504, 85,ch_ega,false,false); /*2 Door open. */ - grab(252, 57,375,132,504, 85,ch_bgi,true ,true ); /*3 Door shut. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(252, 57, 375, 132, 501, 85, ch_ega, false, false); /*1 Door half-open. */ + grab(418, 15, 553, 90, 504, 85, ch_ega, false, false); /*2 Door open. */ + grab(252, 57, 375, 132, 504, 85, ch_bgi, true , true); /*3 Door shut. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index fa9224be0f63..0ff578ba5e0c 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place13.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place13.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk13.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk13.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab(323, 84,393,123,266, 72,ch_ega,false,false); /*1 Door half-open. */ - grab(251, 84,321,123,266, 72,ch_ega,false,false); /*2 Door open. */ - grab(251, 84,321,123,266, 72,ch_bgi,true ,true ); /*3 Door shut. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(323, 84, 393, 123, 266, 72, ch_ega, false, false); /*1 Door half-open. */ + grab(251, 84, 321, 123, 266, 72, ch_ega, false, false); /*2 Door open. */ + grab(251, 84, 321, 123, 266, 72, ch_bgi, true , true); /*3 Door shut. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index cc43d7d93325..ead50a6e9c35 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,233 +31,280 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place16.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place16.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi3.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi3.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk16.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk16.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=3; - - open_chunk(); - - grab(336, 12,365, 28,187, 89,ch_ega,false,false); /*1 Ayles asleep frame 2. */ - grab(368, 12,397, 28,187, 89,ch_ega,false,false); /*2 Ayles awake. */ - grab(336, 12,365, 28,187, 89,ch_bgi,true ,true ); /*3 Ayles asleep frame 1. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 3; + + open_chunk(); + + grab(336, 12, 365, 28, 187, 89, ch_ega, false, false); /*1 Ayles asleep frame 2. */ + grab(368, 12, 397, 28, 187, 89, ch_ega, false, false); /*2 Ayles awake. */ + grab(336, 12, 365, 28, 187, 89, ch_bgi, true , true); /*3 Ayles asleep frame 1. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 9ebdbfa614a4..6d8c0e8278c1 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,234 +31,281 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place46.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place46.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"d:chunkbi4.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "d:chunkbi4.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk46.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk46.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=4; - - open_chunk(); - - grab(136, 11,216, 49,288,104,ch_ega,false,false); /*1 Door opening, frame 1.*/ - grab( 45, 11,124, 49,289,104,ch_ega,false,false); /*2 Door opening, frame 2.*/ - grab(227, 11,306, 49,289,104,ch_ega,false,false); /*3 Door opening, frame 3.*/ - grab(227, 11,306, 49,289,104,ch_bgi,true ,true ); /*4 Natural frame. */ - close_chunk(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 4; + + open_chunk(); + + grab(136, 11, 216, 49, 288, 104, ch_ega, false, false); /*1 Door opening, frame 1.*/ + grab(45, 11, 124, 49, 289, 104, ch_ega, false, false); /*2 Door opening, frame 2.*/ + grab(227, 11, 306, 49, 289, 104, ch_ega, false, false); /*3 Door opening, frame 3.*/ + grab(227, 11, 306, 49, 289, 104, ch_bgi, true , true); /*4 Natural frame. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index 3dd81b249181..b28add0bb764 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,243 +31,290 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; -; - - assign(f,"place47.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "place47.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; -; - - assign(f,"chunkbi9.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - - bit=getpixel(0,0); - - finder(); +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + ; + + assign(f, "chunkbi9.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + + bit = getpixel(0, 0); + + finder(); } -void open_chunk() -{; - assign(f,"chunk47.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + ; + assign(f, "chunk47.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{; - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + ; + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; -; - if (size>arraysize) - {; - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - {; - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + ; + if (size > arraysize) { + ; + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + ; + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; -; -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - {; - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - {; - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - {; - ch.size=s; - ch.x=ch.x / 8; - ch.xl=(ch.xl / 8)+2; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - {; - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : {; - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + ; + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ; + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + ; + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ; + ch.size = s; + ch.x = ch.x / 8; + ch.xl = (ch.xl / 8) + 2; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ; + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + ; + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); - num_chunks=10; + num_chunks = 10; - open_chunk(); + open_chunk(); - grab(323, 35,340, 43,337, 93,ch_ega,true ,false); /*1 Port blinks */ - grab(323, 35,340, 43,337, 93,ch_bgi,true ,true ); /*2 Port normally */ - grab(421, 22,511, 71,474,101,ch_ega,false,false); /*3 Avalot & Spurge */ - grab(421, 22,511, 71,474,101,ch_bgi,true ,true ); /*4 Just Spurge. */ + grab(323, 35, 340, 43, 337, 93, ch_ega, true , false); /*1 Port blinks */ + grab(323, 35, 340, 43, 337, 93, ch_bgi, true , true); /*2 Port normally */ + grab(421, 22, 511, 71, 474, 101, ch_ega, false, false); /*3 Avalot & Spurge */ + grab(421, 22, 511, 71, 474, 101, ch_bgi, true , true); /*4 Just Spurge. */ - grab(524, 40,540, 47,337, 93,ch_ega,true ,false); /*5 Port L blinks */ - grab(524, 22,540, 29,337, 93,ch_ega,true ,false); /*6 Port L */ - grab(563, 40,579, 47,337, 93,ch_ega,true ,false); /*7 Port R blinks */ - grab(563, 22,579, 29,337, 93,ch_ega,true ,false); /*8 Port R */ + grab(524, 40, 540, 47, 337, 93, ch_ega, true , false); /*5 Port L blinks */ + grab(524, 22, 540, 29, 337, 93, ch_ega, true , false); /*6 Port L */ + grab(563, 40, 579, 47, 337, 93, ch_ega, true , false); /*7 Port R blinks */ + grab(563, 22, 579, 29, 337, 93, ch_ega, true , false); /*8 Port R */ - grab(307, 38,310, 38,493,104,ch_ega,true ,false); /*9 Spurge blinks */ - grab(307, 38,310, 38,493,104,ch_bgi,true ,true ); /*10 Spurge doesn't blink */ + grab(307, 38, 310, 38, 493, 104, ch_ega, true , false); /*9 Spurge blinks */ + grab(307, 38, 310, 38, 493, 104, ch_bgi, true , true); /*10 Spurge doesn't blink */ - close_chunk(); -return EXIT_SUCCESS; + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 4c37792546cf..83c379d9268b 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,234 +31,268 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; - - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f,"place20.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f, "place20.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; - assign(f,"chunkbit.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); + assign(f, "chunkbit.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); - bit=getpixel(0,0); + bit = getpixel(0, 0); - finder(); + finder(); } -void open_chunk() -{ - assign(f,"chunk20.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + assign(f, "chunk20.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{ - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; - - if (size>arraysize) - { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - { - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + + if (size > arraysize) { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; - -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - { - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - { - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - { - ch.size=s; - ch.x=ch.x / 8; - ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - { - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : { - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ch.size = s; + ch.x = ch.x / 8; + ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=4; - - open_chunk(); - - grab( 57, 11, 72, 18,399, 13,ch_ega,true ,false); /* 1 - all numbers are */ - grab( 57, 21, 72, 28,399, 13,ch_ega,true ,false); /* 2 flags. */ - grab( 56, 31, 71, 38,399, 13,ch_ega,true ,false); /* 3 */ - grab( 56, 31, 71, 38,399, 13,ch_bgi,true ,true ); /* 4, the natural one. */ - close_chunk(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 4; + + open_chunk(); + + grab(57, 11, 72, 18, 399, 13, ch_ega, true , false); /* 1 - all numbers are */ + grab(57, 21, 72, 28, 399, 13, ch_ega, true , false); /* 2 flags. */ + grab(56, 31, 71, 38, 399, 13, ch_ega, true , false); /* 3 */ + grab(56, 31, 71, 38, 399, 13, ch_bgi, true , true); /* 4, the natural one. */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 505c4fd8c25f..5779d27b41b9 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,234 +31,268 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; - boolean natural; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + boolean natural; - boolean memorise; /* Hold it in memory? */ + boolean memorise; /* Hold it in memory? */ }; -const array<1,44,char> chunkheader = -string("Chunk-type AVD file, for an Avvy game.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer arraysize = 12000; -array<1,30,longint> offsets; -byte num_chunks,this_chunk; -integer gd,gm; +array<1, 30, longint> offsets; +byte num_chunks, this_chunk; +integer gd, gm; untyped_file f; -array<0,arraysize,byte> aa; - -void finder() -{ - char r; integer x,y; - - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +array<0, arraysize, byte> aa; + +void finder() { + char r; + integer x, y; + + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f,"place50.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f, "place50.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; - assign(f,"chunkbi4.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); + assign(f, "chunkbi4.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); - bit=getpixel(0,0); + bit = getpixel(0, 0); - finder(); + finder(); } -void open_chunk() -{ - assign(f,"chunk50.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + assign(f, "chunk50.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{ - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -void mgrab(integer x1,integer y1,integer x2,integer y2, word size) -{ - integer yy; word aapos; byte length,bit; - - if (size>arraysize) - { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos=0; - - length=x2-x1; - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( yy=y1; yy <= y2; yy ++) - { - move(mem[0xa400*yy*80+x1],aa[aapos],length); - aapos += length; - } - } - bit=getpixel(0,0); +void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { + integer yy; + word aapos; + byte length, bit; + + if (size > arraysize) { + restorecrtmode(); + output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; + output << " than " << size << '.' << NL; + exit(0); + } + + aapos = 0; + + length = x2 - x1; + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (yy = y1; yy <= y2; yy ++) { + move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); + aapos += length; + } + } + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2,integer realx,integer realy, flavourtype flav, - boolean mem,boolean nat) - /* yes, I *do* know how to spell "really"! */ +void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, + boolean mem, boolean nat) +/* yes, I *do* know how to spell "really"! */ { - word s; - pointer p; - chunkblocktype ch; - -/* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk]=filepos(f); - - - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - - { - ch.flavour=flav; - ch.x=realx; ch.y=realy; - - ch.xl=x2-x1; - ch.yl=y2-y1; - ch.size=s; - ch.memorise=mem; - ch.natural=nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x,ch.y,p,0); - - if (flav==ch_ega) - { - freemem(p,s); - s=4*(((x2 / 8)-(x1 / 8))+2)*(y2-y1+1); - { - ch.size=s; - ch.x=ch.x / 8; - ch.xl=((realx-ch.x*8)+(x2-x1)+7) / 8; - mgrab(ch.x,ch.y,ch.x+ch.xl,ch.y+ch.yl,s); - } - } else - /* For BGI pictures. */ - { - ch.x=ch.x / 8; - ch.xl=(ch.xl+7) / 8; - ch.size=imagesize(ch.x*8,ch.y,(ch.x+ch.xl)*8,ch.y+ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - switch (flav) { - case ch_ega : if (! nat) blockwrite(f,aa,s); break; - case ch_bgi : { - if (! nat) blockwrite(f,p,s); - freemem(p,s); - } - break; - } -/* rectangle(x1,y1,x2,y2);*/ + word s; + pointer p; + chunkblocktype ch; + + /* rectangle(x1,y1,x2,y2); exit;*/ + this_chunk += 1; + offsets[this_chunk] = filepos(f); + + + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + + { + ch.flavour = flav; + ch.x = realx; + ch.y = realy; + + ch.xl = x2 - x1; + ch.yl = y2 - y1; + ch.size = s; + ch.memorise = mem; + ch.natural = nat; + } + + setvisualpage(1); + setactivepage(1); + input >> NL; + putimage(ch.x, ch.y, p, 0); + + if (flav == ch_ega) { + freemem(p, s); + s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); + { + ch.size = s; + ch.x = ch.x / 8; + ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; + mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); + } + } else + /* For BGI pictures. */ + { + ch.x = ch.x / 8; + ch.xl = (ch.xl + 7) / 8; + ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); + } + + input >> NL; + setvisualpage(0); + setactivepage(0); + + blockwrite(f, ch, sizeof(ch)); + + switch (flav) { + case ch_ega : + if (! nat) blockwrite(f, aa, s); + break; + case ch_bgi : { + if (! nat) blockwrite(f, p, s); + freemem(p, s); + } + break; + } + /* rectangle(x1,y1,x2,y2);*/ } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks=4; - - open_chunk(); - - grab( 46, 53,107, 81,246, 88,ch_ega,false,false); /*1 - all numbers are */ - grab(115, 53,175, 81,248, 88,ch_ega,false,false); /*2 door stages. */ - grab(180, 53,241, 81,246, 88,ch_ega,false,false); /*3 */ - grab(180, 53,246, 84,246, 88,ch_bgi,true ,true ); /*4 */ - close_chunk(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); + + num_chunks = 4; + + open_chunk(); + + grab(46, 53, 107, 81, 246, 88, ch_ega, false, false); /*1 - all numbers are */ + grab(115, 53, 175, 81, 248, 88, ch_ega, false, false); /*2 door stages. */ + grab(180, 53, 241, 81, 246, 88, ch_ega, false, false); /*3 */ + grab(180, 53, 246, 84, 246, 88, ch_bgi, true , true); /*4 */ + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 4091890beffa..935245002a32 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,123 +32,154 @@ namespace Avalanche { -void finder() -{ - char r; integer x,y; - - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +void finder() { + char r; + integer x, y; + + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -void load() -{ - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f,"place51.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a1,12080); - } - - close(f); - bit=getpixel(0,0); - setvisualpage(1); setactivepage(1); - finder(); - setvisualpage(0); setactivepage(0); +void load() { + byte a1 /*absolute $A400:800*/; + byte bit; + untyped_file f; + + + assign(f, "place51.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a1, 12080); + } + + close(f); + bit = getpixel(0, 0); + setvisualpage(1); + setactivepage(1); + finder(); + setvisualpage(0); + setactivepage(0); } -void loadtemp() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; +void loadtemp() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; - assign(f,"chunkbi4.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); + assign(f, "chunkbi4.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); - bit=getpixel(0,0); + bit = getpixel(0, 0); - finder(); + finder(); } -void open_chunk() -{ - assign(f,"chunk51.avd"); - rewrite(f,1); - blockwrite(f,chunkheader,sizeof(chunkheader)); - blockwrite(f,num_chunks,1); - blockwrite(f,offsets,num_chunks*4); +void open_chunk() { + assign(f, "chunk51.avd"); + rewrite(f, 1); + blockwrite(f, chunkheader, sizeof(chunkheader)); + blockwrite(f, num_chunks, 1); + blockwrite(f, offsets, num_chunks * 4); - this_chunk=0; + this_chunk = 0; } -void close_chunk() -{ - seek(f,45); - blockwrite(f,offsets,num_chunks*4); /* make sure they're right! */ - close(f); +void close_chunk() { + seek(f, 45); + blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ + close(f); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); + loadtemp(); + setwritemode(xorput); - num_chunks=9; + num_chunks = 9; - open_chunk(); + open_chunk(); - grab(346,119,404,154,539,116,ch_ega,true ,false); /*1 fire */ - grab(435,119,490,154,541,116,ch_ega,true ,false); /*2 fire */ - grab(435,119,490,154,541,116,ch_bgi,true ,true ); /*3 natural fire */ + grab(346, 119, 404, 154, 539, 116, ch_ega, true , false); /*1 fire */ + grab(435, 119, 490, 154, 541, 116, ch_ega, true , false); /*2 fire */ + grab(435, 119, 490, 154, 541, 116, ch_bgi, true , true); /*3 natural fire */ - grab(300, 58,315, 68,258, 95,ch_ega,true ,false); /*6 Duck's head 2 */ - grab(246, 52,259, 62,258, 95,ch_ega,true ,false); /*5 Duck blinks 1 */ + grab(300, 58, 315, 68, 258, 95, ch_ega, true , false); /*6 Duck's head 2 */ + grab(246, 52, 259, 62, 258, 95, ch_ega, true , false); /*5 Duck blinks 1 */ - grab(300, 58,315, 68,258, 95,ch_bgi,true ,true ); /*4 Duck's head 1 */ - grab(262, 52,278, 62,257, 95,ch_ega,true ,false); /*7 Duck blinks 2 */ + grab(300, 58, 315, 68, 258, 95, ch_bgi, true , true); /*4 Duck's head 1 */ + grab(262, 52, 278, 62, 257, 95, ch_ega, true , false); /*7 Duck blinks 2 */ - grab(333, 58,347, 68,258, 95,ch_ega,true ,false); /*8 Duck's head 3 */ - grab(250, 63,265, 73,258, 95,ch_ega,true ,false); /*9 Duck blinks 3 */ + grab(333, 58, 347, 68, 258, 95, ch_ega, true , false); /*8 Duck's head 3 */ + grab(250, 63, 265, 73, 258, 95, ch_ega, true , false); /*9 Duck blinks 3 */ - close_chunk(); - return EXIT_SUCCESS; + close_chunk(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index fb05ad5497e6..3cec28881995 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,58 +31,71 @@ namespace Avalanche { -const integer xm = 511; const integer ym = 184; -integer gd,gm; -word oh,om,/*os,*/h,m,s,s1; char r; +const integer xm = 511; +const integer ym = 184; +integer gd, gm; +word oh, om,/*os,*/h, m, s, s1; +char r; -void hand(word ang,word length, byte colour) -{ - arccoordstype a; -; - if (ang>900) return; - setcolor(colour); - arc(xm,ym,449-ang,450-ang,length); - getarccoords(a); - line(xm,ym,a.xend,a.yend); /* "With a do-line???!", Liz said */ +void hand(word ang, word length, byte colour) { + arccoordstype a; + ; + if (ang > 900) return; + setcolor(colour); + arc(xm, ym, 449 - ang, 450 - ang, length); + getarccoords(a); + line(xm, ym, a.xend, a.yend); /* "With a do-line???!", Liz said */ } -void chime() -{ - integer gd,gm,fv; -; - if (oh>177) return; /* too high- must be first time around */ - fv=h / 30; if (fv==0) fv=12; - for( gd=1; gd <= fv; gd ++) - {; - for( gm=1; gm <= 3; gm ++) - {; - sound(140-gm*30); delay(50-gm*3); - } - nosound; if ((cardinal)gd!=oh) delay(100); - } +void chime() { + integer gd, gm, fv; + ; + if (oh > 177) return; /* too high- must be first time around */ + fv = h / 30; + if (fv == 0) fv = 12; + for (gd = 1; gd <= fv; gd ++) { + ; + for (gm = 1; gm <= 3; gm ++) { + ; + sound(140 - gm * 30); + delay(50 - gm * 3); + } + nosound; + if ((cardinal)gd != oh) delay(100); + } } -void plothands() -{; - hand(oh,17,brown); - hand(h,17,yellow); - hand(om*6,20,brown); - hand(m*6,20,yellow); +void plothands() { + ; + hand(oh, 17, brown); + hand(h, 17, yellow); + hand(om * 6, 20, brown); + hand(m * 6, 20, yellow); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - setfillstyle(1,6); bar(0,0,640,200); oh=17717; om=17717; - do { - gettime(h,m,s,s1); - h=(h % 12)*30+m / 2; - if (oh!=h) {; plothands(); chime(); } - if (om!=m) plothands(); - oh=h; om=m; - } while (!false); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + setfillstyle(1, 6); + bar(0, 0, 640, 200); + oh = 17717; + om = 17717; + do { + gettime(h, m, s, s1); + h = (h % 12) * 30 + m / 2; + if (oh != h) { + ; + plothands(); + chime(); + } + if (om != m) plothands(); + oh = h; + om = m; + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index bc3134b2e0e9..ddd31fc34b45 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -45,103 +45,123 @@ namespace Avalanche { -typedef array<1,3840,char> scrtype; +typedef array<1, 3840, char> scrtype; scrtype q /*absolute $B8FA:0*/; /* Nobody's using the graphics memory now. */ file f; pointer exitsave; -void get_screen(byte which) -{; - closegraph(); - textattr=0; clrscr; - assign(f,string("text")+strf(which)+".scr"); reset(f); f >> q; close(f); +void get_screen(byte which) { + ; + closegraph(); + textattr = 0; + clrscr; + assign(f, string("text") + strf(which) + ".scr"); + reset(f); + f >> q; + close(f); } -void show_screen() -{ - byte fv,ff,fq, tl,bl; - scrtype a /*absolute $B800:0*/; -; - for( fv=1; fv <= 40; fv ++) - {; - if (fv>36) {; tl=1; bl=24; } - else {; tl=12-fv / 3; bl=12+fv / 3; } - for( fq=tl; fq <= bl; fq ++) - for( ff=80-fv*2; ff <= 80+fv*2; ff ++) - a[fq*160-ff]=q[fq*160-ff]; - delay(5); - } - gotoxy(1,25); textattr=31; clreol; gotoxy(1,24); +void show_screen() { + byte fv, ff, fq, tl, bl; + scrtype a /*absolute $B800:0*/; + ; + for (fv = 1; fv <= 40; fv ++) { + ; + if (fv > 36) { + ; + tl = 1; + bl = 24; + } else { + ; + tl = 12 - fv / 3; + bl = 12 + fv / 3; + } + for (fq = tl; fq <= bl; fq ++) + for (ff = 80 - fv * 2; ff <= 80 + fv * 2; ff ++) + a[fq * 160 - ff] = q[fq * 160 - ff]; + delay(5); + } + gotoxy(1, 25); + textattr = 31; + clreol; + gotoxy(1, 24); } -void quit_with(byte which,byte errorlev) -{; - dusk(); - get_screen(which); - show_screen(); /* No changes. */ - exit(errorlev); +void quit_with(byte which, byte errorlev) { + ; + dusk(); + get_screen(which); + show_screen(); /* No changes. */ + exit(errorlev); } -void put_in(string x, word where) -{ - word fv; -; - for( fv=1; fv <= length(x); fv ++) - q[1+(where+fv)*2]=x[fv]; +void put_in(string x, word where) { + word fv; + ; + for (fv = 1; fv <= length(x); fv ++) + q[1 + (where + fv) * 2] = x[fv]; } void end_of_program() { - const array<0,11,varying_string<11> > nouns = - {{"sackbut","harpsichord","camel","conscience","ice-cream","serf", - "abacus","castle","carrots","megaphone","manticore","drawbridge"}}; - - const array<0,11,varying_string<9> > verbs = - {{"haunt","daunt","tickle","gobble","erase","provoke","surprise", - "ignore","stare at","shriek at","frighten","quieten"}}; - - string result; -; - nosound; - get_screen(scr_nagscreen); - result=nouns[Random(12)]+" will "+verbs[Random(12)]+" you"; - put_in(result,1628); - show_screen(); /* No halt- it's already set up. */ + const array<0, 11, varying_string<11> > nouns = { + { + "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", + "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" + } + }; + + const array<0, 11, varying_string<9> > verbs = { + { + "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", + "ignore", "stare at", "shriek at", "frighten", "quieten" + } + }; + + string result; + ; + nosound; + get_screen(scr_nagscreen); + result = nouns[Random(12)] + " will " + verbs[Random(12)] + " you"; + put_in(result, 1628); + show_screen(); /* No halt- it's already set up. */ } /*$F+*/ -void bug_handler() -{; - exitproc=exitsave; - - if (erroraddr!=nil) - {; /* An error occurred! */ - if (exitcode==203) - get_screen(scr_ramcram); - else - {; - get_screen(scr_bugalert); - put_in(strf(exitcode),678); /* 678 = [38,8]. */ - put_in(strf(seg(erroraddr))+':'+strf(ofs(erroraddr)),758); /* 758 = [38,9]. */ - } - show_screen(); - erroraddr=nil; - } +void bug_handler() { + ; + exitproc = exitsave; + + if (erroraddr != nil) { + ; /* An error occurred! */ + if (exitcode == 203) + get_screen(scr_ramcram); + else { + ; + get_screen(scr_bugalert); + put_in(strf(exitcode), 678); /* 678 = [38,8]. */ + put_in(strf(seg(erroraddr)) + ':' + strf(ofs(erroraddr)), 758); /* 758 = [38,9]. */ + } + show_screen(); + erroraddr = nil; + } } /*$F-*/ class unit_closing_initialize { - public: unit_closing_initialize(); +public: + unit_closing_initialize(); }; static unit_closing_initialize closing_constructor; -unit_closing_initialize::unit_closing_initialize() {; - exitsave=exitproc; - exitproc=&bug_handler; +unit_closing_initialize::unit_closing_initialize() { + ; + exitsave = exitproc; + exitproc = &bug_handler; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index a4d539fe7b04..3e63e368150a 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -36,7 +36,7 @@ const integer scr_nagscreen = 3; const integer scr_twocopies = 5; -void quit_with(byte which,byte errorlev); +void quit_with(byte which, byte errorlev); void end_of_program(); diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index b8d986d73e9a..f7ae1ecf7778 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,79 +29,92 @@ namespace Avalanche { -integer gd,gm; -string fn1,fn2; +integer gd, gm; +string fn1, fn2; varying_string<30> desc; -void loadscreen(string nam) -{ - byte z; - array<1,4,pointer> a; - untyped_file f; word s; - string check; -; - assign(f,nam); - reset(f,1); - blockread(f,check,41); - blockread(f,check,13); - blockread(f,check,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(a[z],s); - blockread(f,a[z],s); - setactivepage(0); - putimage(0,15+(z-1)*75,a[z],0); - freemem(a[z],s); - } - close(f); +void loadscreen(string nam) { + byte z; + array<1, 4, pointer> a; + untyped_file f; + word s; + string check; + ; + assign(f, nam); + reset(f, 1); + blockread(f, check, 41); + blockread(f, check, 13); + blockread(f, check, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(a[z], s); + blockread(f, a[z], s); + setactivepage(0); + putimage(0, 15 + (z - 1) * 75, a[z], 0); + freemem(a[z], s); + } + close(f); } -void load2(string name) -{ - byte a /*absolute $A000:1200*/; - byte bit; - untyped_file f; -; - assign(f,name); reset(f,1); seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,12080); - } - close(f); +void load2(string name) { + byte a /*absolute $A000:1200*/; + byte bit; + untyped_file f; + ; + assign(f, name); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 12080); + } + close(f); } -void save2(string name) -{ - const string header = - string("This is a file from an Avvy game, and its contents are subject to ")+ - "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; - byte a /*absolute $A000:1200*/; - byte bit; - untyped_file f; -; - assign(f,name); rewrite(f,1); blockwrite(f,header[1],146); /* really 90 */ - blockwrite(f,desc,31); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,a,12080); - } - close(f); +void save2(string name) { + const string header = + string("This is a file from an Avvy game, and its contents are subject to ") + + "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; + byte a /*absolute $A000:1200*/; + byte bit; + untyped_file f; + ; + assign(f, name); + rewrite(f, 1); + blockwrite(f, header[1], 146); /* really 90 */ + blockwrite(f, desc, 31); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, a, 12080); + } + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - output << "Filename?"; input >> fn1 >> NL; - output << "New name?"; input >> fn2 >> NL; - output << "Describe?"; input >> desc >> NL; - gd=3; gm=0; initgraph(gd,gm,""); - loadscreen(fn1); - save2(fn2); - closegraph(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + output << "Filename?"; + input >> fn1 >> NL; + output << "New name?"; + input >> fn2 >> NL; + output << "Describe?"; + input >> desc >> NL; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + loadscreen(fn1); + save2(fn2); + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index 97da69a4d34a..6316b61c3d46 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,77 +31,106 @@ namespace Avalanche { - /* ...gogogoch */struct cursor { - matrix<0,1,0,15,word> mask; - integer horzhotspot,verthotspot; - }; -typedef /* ha ha */matrix<0,1,0,15,varying_string<16> > precursor; +/* ...gogogoch */struct cursor { + matrix<0, 1, 0, 15, word> mask; + integer horzhotspot, verthotspot; +}; +typedef /* ha ha */matrix<0, 1, 0, 15, varying_string<16> > precursor; -const array<0,3,byte> colours = {{darkgray,blue,white,green}}; +const array<0, 3, byte> colours = {{darkgray, blue, white, green}}; cursor c_current; boolean usepointer; precursor cpc; -byte hhs,vhs; -string fn,desc; -integer gd,gm; +byte hhs, vhs; +string fn, desc; +integer gd, gm; -void recalc() -{ - byte a,b; -; - {; - for( a=0; a <= 1; a ++) - for( b=0; b <= 15; b ++) - c_current.mask[a][b]=bintoword(cpc[a][b]); - c_current.horzhotspot=hhs; c_current.verthotspot=vhs; - } +void recalc() { + byte a, b; + ; + { + ; + for (a = 0; a <= 1; a ++) + for (b = 0; b <= 15; b ++) + c_current.mask[a][b] = bintoword(cpc[a][b]); + c_current.horzhotspot = hhs; + c_current.verthotspot = vhs; + } } -void load() -{ - text t; string x; byte a,b; -; - assign(t,fn); - reset(t); - do { t >> x >> NL; } while (!(x=='|')); /* bypass junk */ - t >> desc >> NL; - for( a=0; a <= 1; a ++) - for( b=0; b <= 15; b ++) - t >> cpc[a][b] >> NL; - t >> hhs >> NL; t >> vhs >> NL; - close(t); recalc(); +void load() { + text t; + string x; + byte a, b; + ; + assign(t, fn); + reset(t); + do { + t >> x >> NL; + } while (!(x == '|')); /* bypass junk */ + t >> desc >> NL; + for (a = 0; a <= 1; a ++) + for (b = 0; b <= 15; b ++) + t >> cpc[a][b] >> NL; + t >> hhs >> NL; + t >> vhs >> NL; + close(t); + recalc(); } -void display() -{ - const integer o0 = ord('0'); const integer o1 = ord('1'); - byte x,y,p1,p2; -; - for( y=0; y <= 15; y ++) - {; - for( x=1; x <= 16; x ++) - {; - switch (ord(cpc[0][y][x])*2+ord(cpc[1][y][x])) { - case o0*2+o0: {; p1= 0; p2= 0; } break; /* p1= silhouette, p2= real */ - case o0*2+o1: {; p1= 0; p2=15; } break; - case o1*2+o0: {; p1=15; p2= 0; } break; - case o1*2+o1: {; p1= 9; p2= 9; } break; /* invalid- can't use this */ - } - putpixel(x-1,y,p1); putpixel(x+99,y,p2); - } - output << NL; - } +void display() { + const integer o0 = ord('0'); + const integer o1 = ord('1'); + byte x, y, p1, p2; + ; + for (y = 0; y <= 15; y ++) { + ; + for (x = 1; x <= 16; x ++) { + ; + switch (ord(cpc[0][y][x]) * 2 + ord(cpc[1][y][x])) { + case o0*2+o0: { + ; + p1 = 0; + p2 = 0; + } + break; /* p1= silhouette, p2= real */ + case o0*2+o1: { + ; + p1 = 0; + p2 = 15; + } + break; + case o1*2+o0: { + ; + p1 = 15; + p2 = 0; + } + break; + case o1*2+o1: { + ; + p1 = 9; + p2 = 9; + } + break; /* invalid- can't use this */ + } + putpixel(x - 1, y, p1); + putpixel(x + 99, y, p2); + } + output << NL; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=1; initgraph(gd,gm,""); - fn="d:screwdri.inc"; - load(); - display(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + fn = "d:screwdri.inc"; + load(); + display(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index b3db08e392dd..377c34c7bff6 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,85 +32,98 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -integer gd,gm; +integer gd, gm; text t; -array<1,2,fonttype> f; +array<1, 2, fonttype> f; file ff; -array<1,80,byte> l; +array<1, 80, byte> l; varying_string<80> x; -void do_one(byte z) -{ - byte a /*absolute $A000:0*/; - byte aa /*absolute $A000:80*/; - byte az /*absolute $A000:27921*/; -; - a=getpixel(0,0); - move(l,az,z); +void do_one(byte z) { + byte a /*absolute $A000:0*/; + byte aa /*absolute $A000:80*/; + byte az /*absolute $A000:27921*/; + ; + a = getpixel(0, 0); + move(l, az, z); - port[0x3c5]=8; port[0x3cf]=0; - move(aa,a,27920); + port[0x3c5] = 8; + port[0x3cf] = 0; + move(aa, a, 27920); } -void background() -{ - byte y; -; - for( y=1; y <= 15; y ++) - {; - setcolor(y); - outtextxy(17,y*12,"Jesus is Lord!"); - } +void background() { + byte y; + ; + for (y = 1; y <= 15; y ++) { + ; + setcolor(y); + outtextxy(17, y * 12, "Jesus is Lord!"); + } } -void scroll(string z) -{ - byte x,y,lz; char c; -; - fillchar(l,80,'\0'); - if (z=="") - for( y=1; y <= 12; y ++) do_one(0); - c=z[1]; Delete(z,1,1); - lz=length(z); - switch (c) { - case '*': for( y=0; y <= 15; y ++) - {; - for( x=1; x <= lz; x ++) - l[x]=f[2][z[x]][y]; - do_one(lz); - } - break; - case '>': {; - lz += 7; - for( y=0; y <= 13; y ++) - {; - for( x=1; x <= lz; x ++) - l[x+7]=f[1][z[x]][y]; - do_one(lz); do_one(lz); /* double-height characters */ - } - } - break; - } +void scroll(string z) { + byte x, y, lz; + char c; + ; + fillchar(l, 80, '\0'); + if (z == "") + for (y = 1; y <= 12; y ++) do_one(0); + c = z[1]; + Delete(z, 1, 1); + lz = length(z); + switch (c) { + case '*': + for (y = 0; y <= 15; y ++) { + ; + for (x = 1; x <= lz; x ++) + l[x] = f[2][z[x]][y]; + do_one(lz); + } + break; + case '>': { + ; + lz += 7; + for (y = 0; y <= 13; y ++) { + ; + for (x = 1; x <= lz; x ++) + l[x + 7] = f[1][z[x]][y]; + do_one(lz); + do_one(lz); /* double-height characters */ + } + } + break; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=1; initgraph(gd,gm,""); - port[0x3c4]=2; port[0x3cf]=4; - assign(ff,"avalot.fnt"); reset(ff); ff >> f[1]; close(ff); - assign(ff,"avitalic.fnt"); reset(ff); ff >> f[2]; close(ff); - assign(t,"credits.txt"); reset(t); - background(); - for( gd=8; gd <= 15; gd ++) setpalette(gd,62); - do { - t >> x >> NL; - scroll(x); - } while (!(eof(t) || keypressed())); - close(t); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + port[0x3c4] = 2; + port[0x3cf] = 4; + assign(ff, "avalot.fnt"); + reset(ff); + ff >> f[1]; + close(ff); + assign(ff, "avitalic.fnt"); + reset(ff); + ff >> f[2]; + close(ff); + assign(t, "credits.txt"); + reset(t); + background(); + for (gd = 8; gd <= 15; gd ++) setpalette(gd, 62); + do { + t >> x >> NL; + scroll(x); + } while (!(eof(t) || keypressed())); + close(t); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index 0db15d55c744..41ebe4434c37 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,31 +31,45 @@ namespace Avalanche { const char fn[] = "text3.scr"; -typedef array<1,3840,char> atype; +typedef array<1, 3840, char> atype; file f; -word fv,ff,fq,st; +word fv, ff, fq, st; char r; -byte tl,bl; +byte tl, bl; atype q; atype a /*absolute $B800:0*/; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=0; clrscr; - assign(f,fn); reset(f); f >> q; close(f); - for( fv=1; fv <= 40; fv ++) - {; - if (fv>36) {; tl=1; bl=24; } - else {; tl=12-fv / 3; bl=12+fv / 3; } - for( fq=tl; fq <= bl; fq ++) - for( ff=80-fv*2; ff <= 80+fv*2; ff ++) - a[fq*160-ff]=q[fq*160-ff]; - delay(5); - } - gotoxy(1,25); textattr=31; clreol; gotoxy(1,24); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 0; + clrscr; + assign(f, fn); + reset(f); + f >> q; + close(f); + for (fv = 1; fv <= 40; fv ++) { + ; + if (fv > 36) { + ; + tl = 1; + bl = 24; + } else { + ; + tl = 12 - fv / 3; + bl = 12 + fv / 3; + } + for (fq = tl; fq <= bl; fq ++) + for (ff = 80 - fv * 2; ff <= 80 + fv * 2; ff ++) + a[fq * 160 - ff] = q[fq * 160 - ff]; + delay(5); + } + gotoxy(1, 25); + textattr = 31; + clreol; + gotoxy(1, 24); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 56374012592e..0f3d078f121c 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -71,76 +71,108 @@ const integer disabled = darkgray; char r; byte fv; -void find_what_you_can_do_with_it() -{; - switch (thinks) { - case wine:case ink: verbstr=string(vb_exam)+vb_drink; break; - case bell: verbstr=string(vb_exam)+vb_ring; break; - case potion:case wine: verbstr=string(vb_exam)+vb_drink; break; - case chastity: verbstr=string(vb_exam)+vb_wear; break; - case lute: verbstr=string(vb_exam)+vb_play; break; - case mushroom:case onion: verbstr=string(vb_exam)+vb_eat; break; - case clothes: verbstr=string(vb_exam)+vb_wear; break; - default: verbstr=vb_exam; /* anything else */ - } -} - -void chalk(integer x,integer y, char t, string z, boolean valid) -{ - byte fv,ff,p,bit; - word pageseg; - byte ander; -; - - pageseg=0xa000+cp*0x400; - - if (valid) ander=255; else ander=170; - - for( fv=1; fv <= length(z); fv ++) - for( ff=0; ff <= 7; ff ++) - for( bit=0; bit <= 2; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - mem[pageseg*x+fv-1+(y+ff)*80]=~ (little[z[fv]][ff] & ander); - } - - for( ff=0; ff <= 8; ff ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << 3; port[0x3cf]=3; - fillchar(mem[pageseg*x+(y+ff)*80],length(z),'\0'); /* blank it out. */ - } - - p=pos(t,z); if (p==0) return; p -= 1; - - for( bit=0; bit <= 2; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - mem[pageseg*x+p+(y+8)*80]=~ ander; - } +void find_what_you_can_do_with_it() { + ; + switch (thinks) { + case wine: + case ink: + verbstr = string(vb_exam) + vb_drink; + break; + case bell: + verbstr = string(vb_exam) + vb_ring; + break; + case potion: + case wine: + verbstr = string(vb_exam) + vb_drink; + break; + case chastity: + verbstr = string(vb_exam) + vb_wear; + break; + case lute: + verbstr = string(vb_exam) + vb_play; + break; + case mushroom: + case onion: + verbstr = string(vb_exam) + vb_eat; + break; + case clothes: + verbstr = string(vb_exam) + vb_wear; + break; + default: + verbstr = vb_exam; /* anything else */ + } +} - blitfix(); +void chalk(integer x, integer y, char t, string z, boolean valid) { + byte fv, ff, p, bit; + word pageseg; + byte ander; + ; + + pageseg = 0xa000 + cp * 0x400; + + if (valid) ander = 255; + else ander = 170; + + for (fv = 1; fv <= length(z); fv ++) + for (ff = 0; ff <= 7; ff ++) + for (bit = 0; bit <= 2; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + mem[pageseg * x + fv - 1 + (y + ff) * 80] = ~(little[z[fv]][ff] & ander); + } + + for (ff = 0; ff <= 8; ff ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << 3; + port[0x3cf] = 3; + fillchar(mem[pageseg * x + (y + ff) * 80], length(z), '\0'); /* blank it out. */ + } + + p = pos(t, z); + if (p == 0) return; + p -= 1; + + for (bit = 0; bit <= 2; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + mem[pageseg * x + p + (y + 8) * 80] = ~ ander; + } + + blitfix(); } -void hlchalk(integer x,integer y, char t, string z, boolean valid) - /* Highlighted. */ +void hlchalk(integer x, integer y, char t, string z, boolean valid) +/* Highlighted. */ { - byte fv,ff,p; - word pageseg; - byte ander; -; + byte fv, ff, p; + word pageseg; + byte ander; + ; - pageseg=0xa000+cp*0x400; + pageseg = 0xa000 + cp * 0x400; - if (valid) ander=255; else ander=170; + if (valid) ander = 255; + else ander = 170; - for( fv=1; fv <= length(z); fv ++) - for( ff=0; ff <= 7; ff ++) - mem[pageseg*x+fv-1+(y+ff)*80]=little[z[fv]][ff] & ander; + for (fv = 1; fv <= length(z); fv ++) + for (ff = 0; ff <= 7; ff ++) + mem[pageseg * x + fv - 1 + (y + ff) * 80] = little[z[fv]][ff] & ander; - p=pos(t,z); if (p==0) return; p -= 1; + p = pos(t, z); + if (p == 0) return; + p -= 1; - mem[pageseg*x+p+(y+8)*80]=ander; - blitfix(); + mem[pageseg * x + p + (y + 8) * 80] = ander; + blitfix(); } /*procedure say(x,y:integer; t:char; z:string; f,b:byte); @@ -150,475 +182,539 @@ begin; chalk(x,y,t,z); end;*/ -void bleep() -{; - sound(177); delay(7); nosound; +void bleep() { + ; + sound(177); + delay(7); + nosound; } -void onemenu::start_afresh() -{; - number=0; width=0; firstlix=false; oldy=0; highlightnum=0; +void onemenu::start_afresh() { + ; + number = 0; + width = 0; + firstlix = false; + oldy = 0; + highlightnum = 0; } -onemenu* onemenu::init() -{; - menunow=false; ddmnow=false; menunum=1; - return this; +onemenu *onemenu::init() { + ; + menunow = false; + ddmnow = false; + menunum = 1; + return this; } -void onemenu::opt(string n, char tr, string key, boolean val) -{ - integer l; -; - number += 1; - l=length(n+key)+3; if (width'' then outtextxy(flx2,4+y*10,shortcut);*/ + /* settextjustify(2,2); + if shortcut>'' then outtextxy(flx2,4+y*10,shortcut);*/ - data=with.title; + data = with.title; - while (length(data+with.shortcut)= (unsigned char)number)) return; + highlightnum = hn; + } + setactivepage(cp); + off(); + displayopt(oldy + 1, false); + displayopt(highlightnum + 1, true); + setactivepage(1 - cp); + oldy = highlightnum; + on(); } -void onemenu::wipe() -{ - bytefield r; -; - setactivepage(cp); - off(); - { headtype& with = ddm_m.ddms[ddm_o.menunum]; - chalk(with.xpos,1,with.trigger,with.title,true);} -/* mblit((flx1-3) div 8,11,((flx2+1) div 8)+1,fly+1,3,cp);*/ - -/* with r do - begin; - x1:=flx1; - y1:=11; - x2:=flx2+1; - y2:=fly+1; - end; - getset[cp].remember(r);*/ +void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ + ; + if ((mx < (cardinal)flx1 * 8) || (mx > (cardinal)flx2 * 8) || (my <= 12) || (my > (cardinal)fly - 3)) return; + highlightnum = (my - 13) / 10; + if (highlightnum == oldy) return; + movehighlight(0); +} + +void onemenu::select(byte n) { /* Choose which one you want. */ + ; + if (! oo[n + 1].valid) return; + choicenum = n; + wipe(); - mblit(flx1,11,flx2+1,fly+1,3,cp); blitfix(); - menunow=false; ddmnow=false; firstlix=false; defaultled=2; - on_virtual(); + if (choicenum == number) choicenum -= 1; /* Off the bottom. */ + if (choicenum > number) choicenum = 0; /* Off the top, I suppose. */ + + ddm_m.ddms[menunum].do_choose(); } -void onemenu::movehighlight(shortint add) -{ - shortint hn; -; - if (add!=0) - {; - hn=highlightnum+add; - if ((hn<0) || (hn>=(unsigned char)number)) return; - highlightnum=hn; - } - setactivepage(cp); off(); - displayopt(oldy+1,false); - displayopt(highlightnum+1,true); - setactivepage(1-cp); - oldy=highlightnum; on(); +void onemenu::keystroke(char c) { + byte fv; + boolean found; + ; + c = upcase(c); + found = false; + for (fv = 1; fv <= number; fv ++) { + optiontype &with = oo[fv]; + if ((upcase(with.trigger) == c) && with.valid) { + ; + select(fv - 1); + found = true; + } + } + if (! found) blip(); } -void onemenu::lightup() /* This makes the menu highlight follow the mouse.*/ -{; - if ((mx<(cardinal)flx1*8) || (mx>(cardinal)flx2*8) || (my<=12) || (my>(cardinal)fly-3)) return; - highlightnum=(my-13) / 10; - if (highlightnum==oldy) return; - movehighlight(0); +headtype *headtype::init +(char trig, char alttrig, string name, byte p, proc dw, proc dc) { + ; + trigger = trig; + alttrigger = alttrig; + title = name; + position = p; + xpos = (position - 1) * spacing + indent; + xright = position * spacing + indent; + do_setup = dw; + do_choose = dc; + return this; } -void onemenu::select(byte n) /* Choose which one you want. */ -{; - if (! oo[n+1].valid) return; - choicenum=n; wipe(); +void headtype::display() { + ; + off(); /*MT*/ + chalk(xpos, 1, trigger, title, true); + on(); /*MT*/ +} - if (choicenum==number) choicenum -= 1; /* Off the bottom. */ - if (choicenum>number) choicenum=0; /* Off the top, I suppose. */ +void headtype::highlight() { + ; + off(); + off_virtual(); + nosound; + setactivepage(cp); + hlchalk(xpos, 1, trigger, title, true); + { + ; + ddm_o.left = xpos; + ddm_o.menunow = true; + ddmnow = true; + ddm_o.menunum = position; + } + cmp = 177; /* Force redraw of cursor. */ +} - ddm_m.ddms[menunum].do_choose(); +boolean headtype::extdparse(char c) { + boolean extdparse_result; + ; + if (c != alttrigger) { + ; + extdparse_result = true; + return extdparse_result; + } + extdparse_result = false; + return extdparse_result; } -void onemenu::keystroke(char c) -{ - byte fv; boolean found; -; - c=upcase(c); found=false; - for( fv=1; fv <= number; fv ++) - { optiontype& with = oo[fv]; - if ((upcase(with.trigger)==c) && with.valid) - {; - select(fv-1); - found=true; - }} - if (! found) blip(); -} - - headtype* headtype::init - (char trig,char alttrig, string name, byte p, proc dw,proc dc) - {; - trigger=trig; alttrigger=alttrig; title=name; - position=p; xpos=(position-1)*spacing+indent; - xright=position*spacing+indent; - do_setup=dw; do_choose=dc; - return this; - } - - void headtype::display() - {; - off(); /*MT*/ - chalk(xpos,1,trigger,title,true); - on(); /*MT*/ - } - - void headtype::highlight() - {; - off(); off_virtual(); nosound; - setactivepage(cp); - hlchalk(xpos,1,trigger,title,true); - {; - ddm_o.left=xpos; - ddm_o.menunow=true; ddmnow=true; ddm_o.menunum=position; - } - cmp=177; /* Force redraw of cursor. */ - } - - boolean headtype::extdparse(char c) - {boolean extdparse_result; - ; - if (c!=alttrigger) {; extdparse_result=true; return extdparse_result; } - extdparse_result=false; - return extdparse_result; - } - - menuset* menuset::init() - {; - howmany=0; - return this; - } - - void menuset::create(char t, string n, char alttrig, proc dw,proc dc) - {; - howmany += 1; - ddms[howmany].init(t,alttrig,n,howmany,dw,dc); - } - - void menuset::update() - { - const bytefield menuspace = {0, 0, 80, 9}; - byte fv,page_,savecp; - ; - setactivepage(3); - setfillstyle(1,menu_b); bar(0, 0,640, 9); - savecp=cp; cp=3; - - for( fv=1; fv <= howmany; fv ++) - ddms[fv].display(); - - for( page_=0; page_ <= 1; page_ ++) - getset[page_].remember(menuspace); - - cp=savecp; - } - - void menuset::extd(char c) - { - byte fv; - ; - fv=1; - while ((fv<=howmany) && (ddms[fv].extdparse(c))) fv += 1; - if (fv>howmany) return; getcertain(fv); - } - - void menuset::getcertain(byte fv) - {; - { headtype& with = ddms[fv]; - {; - if (ddm_o.menunow) - {; - wipe(); /* get rid of menu */ - if (ddm_o.menunum==with.position) return; /* clicked on own highlight */ - } - highlight(); do_setup(); - }} - } - - void menuset::getmenu(integer x) - { - byte fv; - ; - fv=0; - do { - fv += 1; - if ((x>ddms[fv].xpos*8) && (xhowmany)); - } - -void parsekey(char r,char re) -{; - switch (r) { - case '\0':case '\340': {; - switch (re) { - case 'K': if (ddm_o.menunum>1) {; - wipe(); - ddm_m.getcertain(ddm_o.menunum-1); - } else - {; /* Get menu on the left-hand side */ - wipe(); - ddm_m.getmenu((ddm_m.howmany-1)*spacing+indent); - } - break; - case 'M': if (ddm_o.menunum howmany) return; + getcertain(fv); +} + +void menuset::getcertain(byte fv) { + ; + { + headtype &with = ddms[fv]; + { + ; + if (ddm_o.menunow) { + ; + wipe(); /* get rid of menu */ + if (ddm_o.menunum == with.position) return; /* clicked on own highlight */ + } + highlight(); + do_setup(); + } + } +} + +void menuset::getmenu(integer x) { + byte fv; + ; + fv = 0; + do { + fv += 1; + if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { + ; + getcertain(fv); + return; + } + } while (!(fv > howmany)); +} + +void parsekey(char r, char re) { + ; + switch (r) { + case '\0': + case '\340': { + ; + switch (re) { + case 'K': + if (ddm_o.menunum > 1) { + ; + wipe(); + ddm_m.getcertain(ddm_o.menunum - 1); + } else { + ; /* Get menu on the left-hand side */ + wipe(); + ddm_m.getmenu((ddm_m.howmany - 1)*spacing + indent); + } + break; + case 'M': + if (ddm_o.menunum < ddm_m.howmany) { + ; + wipe(); + ddm_m.getcertain(ddm_o.menunum + 1); + } else { + ; /* Get menu on the far right-hand side */ + wipe(); + ddm_m.getmenu(indent); + } + break; + case 'H': + movehighlight(-1); + break; + case 'P': + movehighlight(1); + break; + default: + ddm_m.extd(re); + } + } + break; + case '\15': + select(ddm_o.highlightnum); + break; + default: { + ; + if (ddm_o.menunow) keystroke(r); + } + } } /*$F+ *** Here follow all the ddm__ and do__ procedures for the DDM system. */ -void ddm__game() -{; - {; - start_afresh(); - opt("Help...",'H',"f1",true); - opt("Boss Key",'B',"alt-B",true); - opt("Untrash screen",'U',"ctrl-f7",true); - opt("Score and rank",'S',"f9",true); - opt("About Avvy...",'A',"shift-f10",true); - display(); - } -} - -void ddm__file() -{; - {; - start_afresh(); - opt("New game",'N',"f4",true); - opt("Load...",'L',"^f3",true); - opt("Save",'S',"^f2",alive); - opt("Save As...",'v',"",alive); - opt("DOS Shell",'D',atkey+'1',true); - opt("Quit",'Q',"alt-X",true); - display(); - } -} - -void ddm__action() -{ - string n; -; - n=copy(f5_does(),2,255); - - {; - start_afresh(); - if (n=="") - opt("Do something",'D',"f5",false); - else - opt(copy(n,2,255),n[1],"f5",true); - opt("Pause game",'P',"f6",true); - if (dna.room==99) - opt("Journey thither",'J',"f7",neardoor()); - else - opt("Open the door",'O',"f7",neardoor()); - opt("Look around",'L',"f8",true); - opt("Inventory",'I',"Tab",true); - if (tr[1].xs==walk) - opt("Run fast",'R',"^R",true); - else - opt("Walk slowly",'W',"^W",true); - display(); - } -} - -void ddm__people() -{ - byte here; char fv; -; +void ddm__game() { + ; + { + ; + start_afresh(); + opt("Help...", 'H', "f1", true); + opt("Boss Key", 'B', "alt-B", true); + opt("Untrash screen", 'U', "ctrl-f7", true); + opt("Score and rank", 'S', "f9", true); + opt("About Avvy...", 'A', "shift-f10", true); + display(); + } +} - people=""; - here=dna.room; +void ddm__file() { + ; + { + ; + start_afresh(); + opt("New game", 'N', "f4", true); + opt("Load...", 'L', "^f3", true); + opt("Save", 'S', "^f2", alive); + opt("Save As...", 'v', "", alive); + opt("DOS Shell", 'D', atkey + '1', true); + opt("Quit", 'Q', "alt-X", true); + display(); + } +} - {; - start_afresh(); - for( fv='\226'; fv <= '\262'; fv ++) - if (whereis[fv]==here) - {; - opt(getname(fv),getnamechar(fv),"",true); - people=people+fv; - } - display(); - } +void ddm__action() { + string n; + ; + n = copy(f5_does(), 2, 255); + + { + ; + start_afresh(); + if (n == "") + opt("Do something", 'D', "f5", false); + else + opt(copy(n, 2, 255), n[1], "f5", true); + opt("Pause game", 'P', "f6", true); + if (dna.room == 99) + opt("Journey thither", 'J', "f7", neardoor()); + else + opt("Open the door", 'O', "f7", neardoor()); + opt("Look around", 'L', "f8", true); + opt("Inventory", 'I', "Tab", true); + if (tr[1].xs == walk) + opt("Run fast", 'R', "^R", true); + else + opt("Walk slowly", 'W', "^W", true); + display(); + } } -void ddm__objects() -{ - char fv; -; - {; - start_afresh(); - for( fv='\1'; fv <= numobjs; fv ++) - if (dna.obj[fv]) - opt(get_thing(fv),get_thingchar(fv),"",true); - display(); - } +void ddm__people() { + byte here; + char fv; + ; + + people = ""; + here = dna.room; + + { + ; + start_afresh(); + for (fv = '\226'; fv <= '\262'; fv ++) + if (whereis[fv] == here) { + ; + opt(getname(fv), getnamechar(fv), "", true); + people = people + fv; + } + display(); + } } -string himher(char x) /* Returns "im" for boys, and "er" for girls.*/ -{string himher_result; -; - if (x<'\257') himher_result="im"; else himher_result="er"; -return himher_result; +void ddm__objects() { + char fv; + ; + { + ; + start_afresh(); + for (fv = '\1'; fv <= numobjs; fv ++) + if (dna.obj[fv]) + opt(get_thing(fv), get_thingchar(fv), "", true); + display(); + } } -void ddm__with() -{ - byte fv; varying_string<7> verb; char vbchar; boolean n; -; - {; - start_afresh(); - - if (thinkthing) - {; - - find_what_you_can_do_with_it(); - - for( fv=1; fv <= length(verbstr); fv ++) - {; - verbopt(verbstr[fv],verb,vbchar); - opt(verb,vbchar,"",true); - } - - /* We disable the "give" option if: (a), you haven't selected anybody, - (b), the person you've selected isn't in the room, - or (c), the person you've selected is YOU! */ - - if ((set::of(nowt,pavalot, eos).has(last_person)) || - (whereis[last_person]!=dna.room)) - opt("Give to...",'G',"",false); /* Not here. */ else - {; - opt(string("Give to ")+getname(last_person),'G',"",true); - verbstr=verbstr+vb_give; - } - - } else - {; - opt("Examine",'x',"",true); - opt(string("Talk to h")+himher(thinks),'T',"",true); - verbstr=string(vb_exam)+vb_talk; - switch (thinks) { - - case pgeida:case parkata: - {; - opt("Kiss her",'K',"",true); - verbstr=verbstr+vb_kiss; - } - break; - - case pdogfood: - {; - opt("Play his game",'P',"",! dna.wonnim); /* True if you HAVEN'T won. */ - verbstr=verbstr+vb_play; - } - break; - - case pmalagauche: - {; - n=! dna.teetotal; - opt("Buy some wine",'w',"",! dna.obj[wine]); - opt("Buy some beer",'b',"",n); - opt("Buy some whisky",'h',"",n); opt("Buy some cider",'c',"",n); - opt("Buy some mead",'m',"",n); - verbstr=verbstr+'\145'+'\144'+'\146'+'\147'+'\150'; - } - break; - - case ptrader: - {; - opt("Buy an onion",'o',"",! dna.obj[onion]); - verbstr=verbstr+'\151'; - } - break; - - } - } - display(); - } +string himher(char x) { /* Returns "im" for boys, and "er" for girls.*/ + string himher_result; + ; + if (x < '\257') himher_result = "im"; + else himher_result = "er"; + return himher_result; +} + +void ddm__with() { + byte fv; + varying_string<7> verb; + char vbchar; + boolean n; + ; + { + ; + start_afresh(); + + if (thinkthing) { + ; + + find_what_you_can_do_with_it(); + + for (fv = 1; fv <= length(verbstr); fv ++) { + ; + verbopt(verbstr[fv], verb, vbchar); + opt(verb, vbchar, "", true); + } + + /* We disable the "give" option if: (a), you haven't selected anybody, + (b), the person you've selected isn't in the room, + or (c), the person you've selected is YOU! */ + + if ((set::of(nowt, pavalot, eos).has(last_person)) || + (whereis[last_person] != dna.room)) + opt("Give to...", 'G', "", false); /* Not here. */ else { + ; + opt(string("Give to ") + getname(last_person), 'G', "", true); + verbstr = verbstr + vb_give; + } + + } else { + ; + opt("Examine", 'x', "", true); + opt(string("Talk to h") + himher(thinks), 'T', "", true); + verbstr = string(vb_exam) + vb_talk; + switch (thinks) { + + case pgeida: + case parkata: { + ; + opt("Kiss her", 'K', "", true); + verbstr = verbstr + vb_kiss; + } + break; + + case pdogfood: { + ; + opt("Play his game", 'P', "", ! dna.wonnim); /* True if you HAVEN'T won. */ + verbstr = verbstr + vb_play; + } + break; + + case pmalagauche: { + ; + n = ! dna.teetotal; + opt("Buy some wine", 'w', "", ! dna.obj[wine]); + opt("Buy some beer", 'b', "", n); + opt("Buy some whisky", 'h', "", n); + opt("Buy some cider", 'c', "", n); + opt("Buy some mead", 'm', "", n); + verbstr = verbstr + '\145' + '\144' + '\146' + '\147' + '\150'; + } + break; + + case ptrader: { + ; + opt("Buy an onion", 'o', "", ! dna.obj[onion]); + verbstr = verbstr + '\151'; + } + break; + + } + } + display(); + } } /*procedure ddm__map; @@ -647,113 +743,188 @@ begin; end; end;*/ -void do__game() -{; - switch (ddm_o.choicenum) { - /* Help, boss, untrash screen. */ - case 0: callverb(vb_help); break; - case 1: callverb(vb_boss); break; - case 2: major_redraw(); break; - case 3: callverb(vb_score); break; - case 4: callverb(vb_info); break; - } -} - -void do__file() -{; - switch (ddm_o.choicenum) { - /* New game, load, save, save as, DOS shell, about, quit. */ - case 0: callverb(vb_restart); break; - case 1: {; realwords[2]=""; callverb(vb_load); } break; - case 2: {; realwords[2]=""; callverb(vb_save); } break; - case 3: filename_edit(); break; - case 4: back_to_bootstrap(2); break; - case 5: callverb(vb_quit); break; - } -} - -void do__action() -{ - string n; -; - switch (ddm_o.choicenum) { - /* Get up/pause game/open door/look/inv/walk-run */ - case 0: { - person=pardon; thing=pardon; - n=f5_does(); callverb(n[1]); - } - break; - case 1: callverb(vb_pause); break; - case 2: callverb(vb_open); break; - case 3: callverb(vb_look); break; - case 4: callverb(vb_inv); break; - case 5: { - if (tr[1].xs==walk) tr[1].xs=run; - else tr[1].xs=walk; - newspeed(); - } - break; - } -} - -void do__objects() -{; - thinkabout(objlist[ddm_o.choicenum+1],a_thing); -} - -void do__people() -{; - thinkabout(people[ddm_o.choicenum+1],a_person); - last_person=people[ddm_o.choicenum+1]; -} - -void do__with() -{; - thing=thinks; - - if (thinkthing) - {; - - thing += 49; - - if (verbstr[ddm_o.choicenum+1]==vb_give) - person=last_person; - else - person='\376'; - - } else - {; - switch (verbstr[ddm_o.choicenum+1]) { - case '\144': {; thing='\144'; callverb(vb_buy); return; } break; /* Beer */ - case '\145': {; thing= '\62'; callverb(vb_buy); return; } break; /* Wine */ - case '\146': {; thing='\146'; callverb(vb_buy); return; } break; /* Whisky */ - case '\147': {; thing='\147'; callverb(vb_buy); return; } break; /* Cider */ - case '\150': {; thing='\153'; callverb(vb_buy); return; } break; /* Mead */ - case '\151': {; thing= '\103'; callverb(vb_buy); return; } break; /* Onion (trader) */ - default: - {; - person=thing; - thing='\376'; - } - } - } - callverb(verbstr[ddm_o.choicenum+1]); +void do__game() { + ; + switch (ddm_o.choicenum) { + /* Help, boss, untrash screen. */ + case 0: + callverb(vb_help); + break; + case 1: + callverb(vb_boss); + break; + case 2: + major_redraw(); + break; + case 3: + callverb(vb_score); + break; + case 4: + callverb(vb_info); + break; + } +} + +void do__file() { + ; + switch (ddm_o.choicenum) { + /* New game, load, save, save as, DOS shell, about, quit. */ + case 0: + callverb(vb_restart); + break; + case 1: { + ; + realwords[2] = ""; + callverb(vb_load); + } + break; + case 2: { + ; + realwords[2] = ""; + callverb(vb_save); + } + break; + case 3: + filename_edit(); + break; + case 4: + back_to_bootstrap(2); + break; + case 5: + callverb(vb_quit); + break; + } +} + +void do__action() { + string n; + ; + switch (ddm_o.choicenum) { + /* Get up/pause game/open door/look/inv/walk-run */ + case 0: { + person = pardon; + thing = pardon; + n = f5_does(); + callverb(n[1]); + } + break; + case 1: + callverb(vb_pause); + break; + case 2: + callverb(vb_open); + break; + case 3: + callverb(vb_look); + break; + case 4: + callverb(vb_inv); + break; + case 5: { + if (tr[1].xs == walk) tr[1].xs = run; + else tr[1].xs = walk; + newspeed(); + } + break; + } +} + +void do__objects() { + ; + thinkabout(objlist[ddm_o.choicenum + 1], a_thing); +} + +void do__people() { + ; + thinkabout(people[ddm_o.choicenum + 1], a_person); + last_person = people[ddm_o.choicenum + 1]; +} + +void do__with() { + ; + thing = thinks; + + if (thinkthing) { + ; + + thing += 49; + + if (verbstr[ddm_o.choicenum + 1] == vb_give) + person = last_person; + else + person = '\376'; + + } else { + ; + switch (verbstr[ddm_o.choicenum + 1]) { + case '\144': { + ; + thing = '\144'; + callverb(vb_buy); + return; + } + break; /* Beer */ + case '\145': { + ; + thing = '\62'; + callverb(vb_buy); + return; + } + break; /* Wine */ + case '\146': { + ; + thing = '\146'; + callverb(vb_buy); + return; + } + break; /* Whisky */ + case '\147': { + ; + thing = '\147'; + callverb(vb_buy); + return; + } + break; /* Cider */ + case '\150': { + ; + thing = '\153'; + callverb(vb_buy); + return; + } + break; /* Mead */ + case '\151': { + ; + thing = '\103'; + callverb(vb_buy); + return; + } + break; /* Onion (trader) */ + default: { + ; + person = thing; + thing = '\376'; + } + } + } + callverb(verbstr[ddm_o.choicenum + 1]); } /*$F- That's all. Now for the ...bar procs. */ -void standard_bar() /* Standard menu bar */ -{; - ddm_m.init(); ddm_o.init(); - {; /* Set up menus */ - create('F',"File",'!',ddm__file,do__file); /* same ones in map_bar, below, */ - create('G',"Game",'\42',ddm__game,do__game); /* Don't forget to change the */ - create('A',"Action",'\36',ddm__action,do__action); /* if you change them */ - create('O',"Objects",'\30',ddm__objects,do__objects); /* here... */ - create('P',"People",'\31',ddm__people,do__people); - create('W',"With",'\21',ddm__with,do__with); - update(); - } +void standard_bar() { /* Standard menu bar */ + ; + ddm_m.init(); + ddm_o.init(); + { + ; /* Set up menus */ + create('F', "File", '!', ddm__file, do__file); /* same ones in map_bar, below, */ + create('G', "Game", '\42', ddm__game, do__game); /* Don't forget to change the */ + create('A', "Action", '\36', ddm__action, do__action); /* if you change them */ + create('O', "Objects", '\30', ddm__objects, do__objects); /* here... */ + create('P', "People", '\31', ddm__people, do__people); + create('W', "With", '\21', ddm__with, do__with); + update(); + } } /*procedure map_bar; { Special menu bar for the map (screen 99) } @@ -769,61 +940,65 @@ begin; end; end;*/ -void checkclick() /* only for when the menu's displayed */ -{; - if (mpress>0) - {; - if (mpy>10) - {; - if (! ((ddm_o.firstlix) && - ((mpx>=(cardinal)ddm_o.flx1*8) && (mpx<=(cardinal)ddm_o.flx2*8) && - (mpy>=12) && (mpy<=(cardinal)ddm_o.fly)))) - {; /* Clicked OUTSIDE the menu. */ - if (ddm_o.menunow) wipe(); - } /* No "else"- clicking on menu has no effect (only releasing) */ - } else - {; /* Clicked on menu bar */ - ddm_m.getmenu(mpx); - } - } else - {; /* NOT clicked button... */ - if (mrelease>0) - {; - if ((ddm_o.firstlix) && - ((mrx>=(cardinal)ddm_o.flx1*8) && (mrx<=(cardinal)ddm_o.flx2*8) && - (mry>=12) && (mry<=(cardinal)ddm_o.fly))) - select((mry-13) / 10); - } - } -} - -void menu_link() -{; - {; - if (! ddm_o.menunow) return; - - check(); /* find mouse coords & click information */ - checkclick(); /* work out click codes */ - - /* Change arrow... */ - - switch (my) { - case RANGE_11(0, 10): newpointer(1); - break; /* up-arrow */ - case 11 ... 169: {; - if ((mx>=(cardinal)ddm_o.flx1*8) && (mx<=(cardinal)ddm_o.flx2*8) && (my>10) && (my<=(cardinal)ddm_o.fly)) - newpointer(3); /* right-arrow */ - else newpointer(4); /* fletch */ - } - break; - case RANGE_32(169,200): newpointer(2); - break; /* screwdriver */ - } - - if (! ddm_o.menunow) return; - - lightup(); - } +void checkclick() { /* only for when the menu's displayed */ + ; + if (mpress > 0) { + ; + if (mpy > 10) { + ; + if (!((ddm_o.firstlix) && + ((mpx >= (cardinal)ddm_o.flx1 * 8) && (mpx <= (cardinal)ddm_o.flx2 * 8) && + (mpy >= 12) && (mpy <= (cardinal)ddm_o.fly)))) { + ; /* Clicked OUTSIDE the menu. */ + if (ddm_o.menunow) wipe(); + } /* No "else"- clicking on menu has no effect (only releasing) */ + } else { + ; /* Clicked on menu bar */ + ddm_m.getmenu(mpx); + } + } else { + ; /* NOT clicked button... */ + if (mrelease > 0) { + ; + if ((ddm_o.firstlix) && + ((mrx >= (cardinal)ddm_o.flx1 * 8) && (mrx <= (cardinal)ddm_o.flx2 * 8) && + (mry >= 12) && (mry <= (cardinal)ddm_o.fly))) + select((mry - 13) / 10); + } + } +} + +void menu_link() { + ; + { + ; + if (! ddm_o.menunow) return; + + check(); /* find mouse coords & click information */ + checkclick(); /* work out click codes */ + + /* Change arrow... */ + + switch (my) { + case RANGE_11(0, 10): + newpointer(1); + break; /* up-arrow */ + case 11 ... 169: { + ; + if ((mx >= (cardinal)ddm_o.flx1 * 8) && (mx <= (cardinal)ddm_o.flx2 * 8) && (my > 10) && (my <= (cardinal)ddm_o.fly)) + newpointer(3); /* right-arrow */ + else newpointer(4); /* fletch */ + } + break; + case RANGE_32(169, 200): + newpointer(2); + break; /* screwdriver */ + } + + if (! ddm_o.menunow) return; + + lightup(); + } } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index 4eae8982ed00..e39e6f1d671e 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,62 +34,62 @@ typedef void(*proc)(); class headtype { public: - varying_string<8> title; - char trigger,alttrigger; - byte position; - integer xpos,xright; - proc do_setup,do_choose; - - headtype* init - (char trig,char alttrig, string name, byte p, proc dw,proc dc); - void display(); - void highlight(); - boolean extdparse(char c); + varying_string<8> title; + char trigger, alttrigger; + byte position; + integer xpos, xright; + proc do_setup, do_choose; + + headtype *init + (char trig, char alttrig, string name, byte p, proc dw, proc dc); + void display(); + void highlight(); + boolean extdparse(char c); }; struct optiontype { - string title; - char trigger; - varying_string<9> shortcut; - boolean valid; + string title; + char trigger; + varying_string<9> shortcut; + boolean valid; }; class onemenu { public: - array<1,12,optiontype> oo; - byte number; - integer width,left; - boolean firstlix; - integer flx1,flx2,fly; - byte oldy; /* used by Lightup */ - boolean menunow; /* Is there a menu now? */ - byte menunum; /* And if so, which is it? */ - byte choicenum; /* Your choice? */ - byte highlightnum; - - void start_afresh(); - void opt(string n, char tr, string key, boolean val); - void display(); - void wipe(); - void lightup(); - void displayopt(byte y, boolean highlit); - void movehighlight(shortint add); - void select(byte n); - void keystroke(char c); - onemenu* init(); + array<1, 12, optiontype> oo; + byte number; + integer width, left; + boolean firstlix; + integer flx1, flx2, fly; + byte oldy; /* used by Lightup */ + boolean menunow; /* Is there a menu now? */ + byte menunum; /* And if so, which is it? */ + byte choicenum; /* Your choice? */ + byte highlightnum; + + void start_afresh(); + void opt(string n, char tr, string key, boolean val); + void display(); + void wipe(); + void lightup(); + void displayopt(byte y, boolean highlit); + void movehighlight(shortint add); + void select(byte n); + void keystroke(char c); + onemenu *init(); }; class menuset { public: - array<1,8,headtype> ddms; - byte howmany; - - menuset* init(); - void create(char t, string n, char alttrig, proc dw,proc dc); - void update(); - void extd(char c); - void getcertain(byte fv); - void getmenu(integer x); + array<1, 8, headtype> ddms; + byte howmany; + + menuset *init(); + void create(char t, string n, char alttrig, proc dw, proc dc); + void update(); + void extd(char c); + void getcertain(byte fv); + void getmenu(integer x); }; @@ -108,16 +108,16 @@ EXTERN varying_string<5> people; - void find_what_you_can_do_with_it(); +void find_what_you_can_do_with_it(); - void parsekey(char r,char re); +void parsekey(char r, char re); - void menu_link(); +void menu_link(); - /* DDM menu-bar procs */ +/* DDM menu-bar procs */ - void standard_bar(); - /*procedure map_bar;*/ +void standard_bar(); +/*procedure map_bar;*/ } // End of namespace Avalanche. diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index 450ee7b532f2..56bf5093b75f 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,19 +29,24 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -integer gd,gm; +integer gd, gm; fonttype f; file ff; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(ff,"v:avalot.fnt"); reset(ff); ff >> f; close(ff); - gd=3; gm=0; initgraph(gd,gm,""); - for( gd=0; gd <= 15; gd ++) mem[0xa000*gd*80]=f['A'][gd]; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(ff, "v:avalot.fnt"); + reset(ff); + ff >> f; + close(ff); + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + for (gd = 0; gd <= 15; gd ++) mem[0xa000 * gd * 80] = f['A'][gd]; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index ab7b1b8b3d07..3aed1a371357 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -28,86 +28,87 @@ namespace Avalanche { const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; -const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; +const string ednaid = string("TT") + '\261' + '\36' + '\1' + '\113' + '\261' + '\231' + '\261'; struct edhead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS. See below for others.) */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS. See below for others.) */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ }; - /* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ untyped_file f; byte fv; -array<1,255,word> dna256; +array<1, 255, word> dna256; boolean ok; edhead e; -void info(string x) /* info on .ASG files */ -{ - varying_string<40> describe; -; - assign(f,x); - /*$I-*/ reset(f,1); - seek(f,47); - blockread(f,describe,40); - blockread(f,dna256,sizeof(dna256)); - close(f); /*$I+*/ - e.revision=1; - game="Denarius Avaricius Sextus"; - shortname="Avaricius"; - number=1; - verstr="[?]"; - filename="AVVY.EXE"; - os=1; - fn=x; - d=dna256[7]; m=dna256[8]; y=dna256[9]; - desc=describe; - len=512; - saves=dna256[6]; - /*money:string[20]; { ditto in string form (eg 5/-, or 1 denarius)*/ - /*points:word; { your score */ +void info(string x) { /* info on .ASG files */ + varying_string<40> describe; + ; + assign(f, x); + /*$I-*/ reset(f, 1); + seek(f, 47); + blockread(f, describe, 40); + blockread(f, dna256, sizeof(dna256)); + close(f); /*$I+*/ + e.revision = 1; + game = "Denarius Avaricius Sextus"; + shortname = "Avaricius"; + number = 1; + verstr = "[?]"; + filename = "AVVY.EXE"; + os = 1; + fn = x; + d = dna256[7]; + m = dna256[8]; + y = dna256[9]; + desc = describe; + len = 512; + saves = dna256[6]; + /*money:string[20]; { ditto in string form (eg 5/-, or 1 denarius)*/ + /*points:word; { your score */ } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - info("tt.asg"); - - output << "Filename: " << x << NL; - output << "Description: " << desc << NL; - output << "Cash: " << dna256[30] << NL; - output << "Score: " << dna256[36] << NL; - output << "Date: " << dna256[7] << ' ' << copy(months,dna256[8]*3-2,3) << ' ' << dna256[9] << NL; - output << "Number of saves: " << dna256[6] << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + info("tt.asg"); + + output << "Filename: " << x << NL; + output << "Description: " << desc << NL; + output << "Cash: " << dna256[30] << NL; + output << "Score: " << dna256[36] << NL; + output << "Date: " << dna256[7] << ' ' << copy(months, dna256[8] * 3 - 2, 3) << ' ' << dna256[9] << NL; + output << "Number of saves: " << dna256[6] << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp index 1c4d8d76b5ef..7299f7c7aa30 100644 --- a/engines/avalanche/edna.cpp +++ b/engines/avalanche/edna.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,34 +33,34 @@ namespace Avalanche { struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ }; /* Possible values of edhead.os: @@ -69,18 +69,18 @@ struct ednahead { /* Edna header */ 3 = OS/2 6 = ST 7 = Archimedes */ -typedef array<1,4,char> fourtype; +typedef array<1, 4, char> fourtype; struct avaricius_dna { - varying_string<39> desc; - array<1,256,integer> dna; + varying_string<39> desc; + array<1, 256, integer> dna; }; -const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; +const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; const fourtype avaricius_file = "Avvy"; string filename; -boolean quiet,info; +boolean quiet, info; ednahead eh; boolean avaricius; @@ -92,274 +92,290 @@ boolean ok; string first_dir; -void explain() -{ - output << "EDNA Bucket v1.0 (c) 1993 Thomas Thurman." << NL; - output << " To load Avvy files." << NL; - output << NL; - output << "Associate .ASG files with EDNA.EXE to load them directly." << NL; - output << NL; - output << "Switches:" << NL; - output << " /q (quiet) will stop EDNA from printing text to the screen." << NL; - output << " /i (info) will print info about the file, but won't load it." << NL; - output << NL; - exit(1); +void explain() { + output << "EDNA Bucket v1.0 (c) 1993 Thomas Thurman." << NL; + output << " To load Avvy files." << NL; + output << NL; + output << "Associate .ASG files with EDNA.EXE to load them directly." << NL; + output << NL; + output << "Switches:" << NL; + output << " /q (quiet) will stop EDNA from printing text to the screen." << NL; + output << " /i (info) will print info about the file, but won't load it." << NL; + output << NL; + exit(1); } -void fix_filename() -{ - string p,n,groi; +void fix_filename() { + string p, n, groi; - fsplit(filename,p,n,groi); - filename=p+n+".ASG"; + fsplit(filename, p, n, groi); + filename = p + n + ".ASG"; } -void error(string x) -{ - output << "EDNA : " << x << NL; - exit(255); +void error(string x) { + output << "EDNA : " << x << NL; + exit(255); } -void paramparse() -{ - byte fv; - string x; +void paramparse() { + byte fv; + string x; - if (paramcount==0) explain(); + if (paramcount == 0) explain(); - filename=""; - quiet=false; info=false; + filename = ""; + quiet = false; + info = false; - for( fv=1; fv <= paramcount; fv ++) - { - x=paramstr(fv); + for (fv = 1; fv <= paramcount; fv ++) { + x = paramstr(fv); - if ((x[1]=='/') || (x[1]=='-')) - switch (upcase(x[2])) { /* Parse switches */ - case 'Q': quiet=! quiet; break; - case 'I': info=! info; break; - default: error(string("Unknown switch! (")+x[2]+')'); - } - else - if (filename=="") filename=x; - else error("Please, only one filename at a time!"); - } + if ((x[1] == '/') || (x[1] == '-')) + switch (upcase(x[2])) { /* Parse switches */ + case 'Q': + quiet = ! quiet; + break; + case 'I': + info = ! info; + break; + default: + error(string("Unknown switch! (") + x[2] + ')'); + } + else if (filename == "") filename = x; + else error("Please, only one filename at a time!"); + } - if (quiet && info) error("How can you give info quietly??"); + if (quiet && info) error("How can you give info quietly??"); - if (filename=="") error("No filename given! Use EDNA alone for help."); + if (filename == "") error("No filename given! Use EDNA alone for help."); - fix_filename(); + fix_filename(); } -void getfile() -{ - untyped_file f; - - assign(f,filename); - /*$I-*/ - reset(f,1); - /*$I+*/ - if (ioresult!=0) error(string("Can't read file \"")+filename+"\"."); - - seek(f,11); blockread(f,id4,4); - avaricius=id4==avaricius_file; - - if (avaricius) - { - seek(f,47); - blockread(f,av_eh,sizeof(av_eh)); - av_ver[0]='\4'; seek(f,31); blockread(f,av_ver[1],4); - } else - { - seek(f,177); - blockread(f,eh,sizeof(eh)); - } - - close(f); +void getfile() { + untyped_file f; + + assign(f, filename); + /*$I-*/ + reset(f, 1); + /*$I+*/ + if (ioresult != 0) error(string("Can't read file \"") + filename + "\"."); + + seek(f, 11); + blockread(f, id4, 4); + avaricius = id4 == avaricius_file; + + if (avaricius) { + seek(f, 47); + blockread(f, av_eh, sizeof(av_eh)); + av_ver[0] = '\4'; + seek(f, 31); + blockread(f, av_ver[1], 4); + } else { + seek(f, 177); + blockread(f, eh, sizeof(eh)); + } + + close(f); } -string plural(byte x) -{ - string plural_result; - if (x==1) plural_result=""; else plural_result='s'; - return plural_result; +string plural(byte x) { + string plural_result; + if (x == 1) plural_result = ""; + else plural_result = 's'; + return plural_result; } -void show_info() -{ - string _game,_shortname,_verstr,_filename,_os,_fn,_desc,_money; - integer _revision,_number,_d,_m,_y,_saves,_points; - boolean readable,understandable; - - output << "Info on file " << filename << ':' << NL; - output << NL; - if (avaricius) - { /* DNA-256 file. */ - _verstr=av_ver; - _game="Denarius Avaricius Sextus"; _shortname="Avaricius"; - _filename="AVVY.EXE"; _os="DOS"; _desc=av_eh.desc; - _revision=1; _number=1; _fn="(as above)"; - - _money=strf(av_eh.dna[30])+" denari"; - if (av_eh.dna[30]==1) _money=_money+"us"; else _money=_money+'i'; - _d=av_eh.dna[7]; _m=av_eh.dna[8]; _y=av_eh.dna[9]; - _saves=av_eh.dna[6]; _points=av_eh.dna[36]; - - readable=true; understandable=true; - } else - { - if (eh.id==ednaid) - { /* EDNA file. */ - _game=eh.game; - _shortname=eh.shortname; - _verstr=eh.verstr; - _filename=eh.filename; - _os=eh.os; _fn=eh.fn; _desc=eh.desc; - _money=eh.money; _revision=eh.revision; - _number=eh.number; _d=eh.d; _m=eh.m; _y=eh.y; - _saves=eh.saves; _points=eh.points; - - readable=true; understandable=eh.revision==2; - } else - { - output << "Unknown format." << NL; - readable=false; - } - } - - if (_desc=="") _desc=""; - - if (readable) - { - output << "Signature is valid." << NL; - output << "Revision of .ASG format: " << _revision << NL; - output << NL; - if (understandable) - { - output << "The file was saved by " << _game << '.' << NL; - output << "Game number " << _number << " (" << _shortname << "), version " << - _verstr << ", filename " << _filename << '.' << NL; - output << "Saved under " << _os << '.' << NL; - output << NL; - output << "This is " << _fn << ".ASG, saved on " << _d << '/' << _m << '/' << _y << " (d/m/y)." << NL; - output << "Description: " << _desc << NL; - output << "It has been saved " << _saves << " time" << plural(_saves) << - ". You have " << _points << " point" << plural(_points) << ',' << NL; - output << "and " << _money << " in cash." << NL; - } else output << "Nothing else can be discovered." << NL; - } - - exit(2); +void show_info() { + string _game, _shortname, _verstr, _filename, _os, _fn, _desc, _money; + integer _revision, _number, _d, _m, _y, _saves, _points; + boolean readable, understandable; + + output << "Info on file " << filename << ':' << NL; + output << NL; + if (avaricius) { + /* DNA-256 file. */ + _verstr = av_ver; + _game = "Denarius Avaricius Sextus"; + _shortname = "Avaricius"; + _filename = "AVVY.EXE"; + _os = "DOS"; + _desc = av_eh.desc; + _revision = 1; + _number = 1; + _fn = "(as above)"; + + _money = strf(av_eh.dna[30]) + " denari"; + if (av_eh.dna[30] == 1) _money = _money + "us"; + else _money = _money + 'i'; + _d = av_eh.dna[7]; + _m = av_eh.dna[8]; + _y = av_eh.dna[9]; + _saves = av_eh.dna[6]; + _points = av_eh.dna[36]; + + readable = true; + understandable = true; + } else { + if (eh.id == ednaid) { + /* EDNA file. */ + _game = eh.game; + _shortname = eh.shortname; + _verstr = eh.verstr; + _filename = eh.filename; + _os = eh.os; + _fn = eh.fn; + _desc = eh.desc; + _money = eh.money; + _revision = eh.revision; + _number = eh.number; + _d = eh.d; + _m = eh.m; + _y = eh.y; + _saves = eh.saves; + _points = eh.points; + + readable = true; + understandable = eh.revision == 2; + } else { + output << "Unknown format." << NL; + readable = false; + } + } + + if (_desc == "") _desc = ""; + + if (readable) { + output << "Signature is valid." << NL; + output << "Revision of .ASG format: " << _revision << NL; + output << NL; + if (understandable) { + output << "The file was saved by " << _game << '.' << NL; + output << "Game number " << _number << " (" << _shortname << "), version " << + _verstr << ", filename " << _filename << '.' << NL; + output << "Saved under " << _os << '.' << NL; + output << NL; + output << "This is " << _fn << ".ASG, saved on " << _d << '/' << _m << '/' << _y << " (d/m/y)." << NL; + output << "Description: " << _desc << NL; + output << "It has been saved " << _saves << " time" << plural(_saves) << + ". You have " << _points << " point" << plural(_points) << ',' << NL; + output << "and " << _money << " in cash." << NL; + } else output << "Nothing else can be discovered." << NL; + } + + exit(2); } -void load_file() -{ - string progname,gamename,shortname,listname,exname,prog_dir; - - string localdir,groi; - - string x,y; - - text t; - - integer i,ii; - - gamename=fexpand(filename); - fsplit(fexpand(paramstr(0)),localdir,groi,groi); - listname=localdir+"EDNA.DAT"; - - if (avaricius) - { shortname="Avaricius"; exname="AVVY"; } - else { shortname=eh.shortname; fsplit(eh.filename,groi,exname,groi); } - - assign(t,listname); - /*$I-*/ - reset(t); - /*$I+*/ - progname=""; - if (ioresult==0) - { - do { - t >> x >> NL; t >> y >> NL; - if (x==shortname) - { - progname=y; - flush(); - } - } while (!(eof(t))); - } - - if (progname=="") - { /* No entry in EDNA.DAT */ - output << "This file was saved by " << shortname << '.' << NL; - output << "However, no entry was found in EDNA.DAT for that game." << NL; - output << NL; - output << "Please give the full path to that game, or press Enter to cancel." << NL; - output << string("(Example: C:\\")+exname+'\\'+exname+".EXE)" << NL; - output << NL; - input >> progname >> NL; - if (progname=="") exit(254); /* Quick exit! */ - - /*$I-*/ - append(t); - if (ioresult!=0) rewrite(t); - - t << shortname << NL; - t << progname << NL; - - if (ioresult!=0) - { - output << "Strange... could not write to EDNA.DAT. (Disk read-only or full?)" << NL; - output << "The path will be used this time only." << NL; - output << "Press Enter..."; input >> NL; - } - close(t); - /*$I+*/ - } - - if (! quiet) output << "Running " << shortname << ": " << progname << "..." << NL; - - fsplit(fexpand(progname),prog_dir,groi,groi); - if (prog_dir[length(prog_dir)]=='\\') prog_dir[0] -= 1; - - /*$I-*/ - chdir(prog_dir); i=ioresult; - swapvectors; - exec(progname,gamename); ii=ioresult; - swapvectors; - chdir(first_dir); - /*$I+*/ - - if ((i!=0) || (ii!=0)) - { - output << "WARNING: DOS reported an error. This probably means that the entry" << NL; - output << "for this game in " << listname << " is wrong." << NL; - output << NL; - output << "Please edit this file, using" << NL; - output << NL; - if (lo(dosversion)<0x5) - output << " edlin " << listname << " (or similar)" << NL; - else - output << " edit " << listname << NL; - output << NL; - output << "and change the line after \"" << shortname << "\" to show the correct path." << NL; - output << NL; - output << "More info is in the Avvy documentation. Good luck!" << NL; - output << NL; - output << "Press Enter..."; input >> NL; - } +void load_file() { + string progname, gamename, shortname, listname, exname, prog_dir; + + string localdir, groi; + + string x, y; + + text t; + + integer i, ii; + + gamename = fexpand(filename); + fsplit(fexpand(paramstr(0)), localdir, groi, groi); + listname = localdir + "EDNA.DAT"; + + if (avaricius) { + shortname = "Avaricius"; + exname = "AVVY"; + } else { + shortname = eh.shortname; + fsplit(eh.filename, groi, exname, groi); + } + + assign(t, listname); + /*$I-*/ + reset(t); + /*$I+*/ + progname = ""; + if (ioresult == 0) { + do { + t >> x >> NL; + t >> y >> NL; + if (x == shortname) { + progname = y; + flush(); + } + } while (!(eof(t))); + } + + if (progname == "") { + /* No entry in EDNA.DAT */ + output << "This file was saved by " << shortname << '.' << NL; + output << "However, no entry was found in EDNA.DAT for that game." << NL; + output << NL; + output << "Please give the full path to that game, or press Enter to cancel." << NL; + output << string("(Example: C:\\") + exname + '\\' + exname + ".EXE)" << NL; + output << NL; + input >> progname >> NL; + if (progname == "") exit(254); /* Quick exit! */ + + /*$I-*/ + append(t); + if (ioresult != 0) rewrite(t); + + t << shortname << NL; + t << progname << NL; + + if (ioresult != 0) { + output << "Strange... could not write to EDNA.DAT. (Disk read-only or full?)" << NL; + output << "The path will be used this time only." << NL; + output << "Press Enter..."; + input >> NL; + } + close(t); + /*$I+*/ + } + + if (! quiet) output << "Running " << shortname << ": " << progname << "..." << NL; + + fsplit(fexpand(progname), prog_dir, groi, groi); + if (prog_dir[length(prog_dir)] == '\\') prog_dir[0] -= 1; + + /*$I-*/ + chdir(prog_dir); + i = ioresult; + swapvectors; + exec(progname, gamename); + ii = ioresult; + swapvectors; + chdir(first_dir); + /*$I+*/ + + if ((i != 0) || (ii != 0)) { + output << "WARNING: DOS reported an error. This probably means that the entry" << NL; + output << "for this game in " << listname << " is wrong." << NL; + output << NL; + output << "Please edit this file, using" << NL; + output << NL; + if (lo(dosversion) < 0x5) + output << " edlin " << listname << " (or similar)" << NL; + else + output << " edit " << listname << NL; + output << NL; + output << "and change the line after \"" << shortname << "\" to show the correct path." << NL; + output << NL; + output << "More info is in the Avvy documentation. Good luck!" << NL; + output << NL; + output << "Press Enter..."; + input >> NL; + } } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - getdir(0,first_dir); - paramparse(); - getfile(); - if (info) show_info(); - load_file(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + getdir(0, first_dir); + paramparse(); + getfile(); + if (info) show_info(); + load_file(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index 212e6fe6a15e..bfe427419155 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -40,28 +40,29 @@ namespace Avalanche { -boolean isenh() -{ - byte statefrom16; - registers r; - - boolean isenh_result; - isenh_result = false; - {; - ah=0x12; - intr(0x16,r); - statefrom16=al; - } - if (statefrom16 != shiftstate) return isenh_result; - shiftstate = shiftstate ^ 0x20; - {; - ah=0x12; - intr(0x16,r); - statefrom16=al; - } - isenh_result = statefrom16 == shiftstate; - shiftstate = shiftstate ^ 0x20; - return isenh_result; +boolean isenh() { + byte statefrom16; + registers r; + + boolean isenh_result; + isenh_result = false; + { + ; + ah = 0x12; + intr(0x16, r); + statefrom16 = al; + } + if (statefrom16 != shiftstate) return isenh_result; + shiftstate = shiftstate ^ 0x20; + { + ; + ah = 0x12; + intr(0x16, r); + statefrom16 = al; + } + isenh_result = statefrom16 == shiftstate; + shiftstate = shiftstate ^ 0x20; + return isenh_result; } void readkeye() @@ -73,13 +74,14 @@ void readkeye() $CD/ $16); { INT 16 } */ { - registers r; word fs; -; - if (atbios) - fs=fancystuff; /* We're using an AT */ - else fs=notfancystuff; /* ditto, an XT */ - inchar=chr(lo(fs)); - extd=chr(hi(fs)); + registers r; + word fs; + ; + if (atbios) + fs = fancystuff; /* We're using an AT */ + else fs = notfancystuff; /* ditto, an XT */ + inchar = chr(lo(fs)); + extd = chr(hi(fs)); } boolean keypressede() @@ -92,23 +94,25 @@ boolean keypressede() $40); { INC AX } */ { - registers r; -boolean keypressede_result; -; - if (atbios) - keypressede_result=fancystuff; /* ATs get the fancy stuff */ - else keypressede_result=keypressed(); /* XTs get the usual primitive... */ -return keypressede_result; + registers r; + boolean keypressede_result; + ; + if (atbios) + keypressede_result = fancystuff; /* ATs get the fancy stuff */ + else keypressede_result = keypressed(); /* XTs get the usual primitive... */ + return keypressede_result; } class unit_enhanced_initialize { - public: unit_enhanced_initialize(); +public: + unit_enhanced_initialize(); }; static unit_enhanced_initialize enhanced_constructor; -unit_enhanced_initialize::unit_enhanced_initialize() {; - /* determine bios type */ - atbios=isenh(); +unit_enhanced_initialize::unit_enhanced_initialize() { + ; + /* determine bios type */ + atbios = isenh(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h index c7bd48f8a126..13885f3c1a3c 100644 --- a/engines/avalanche/enhanced.h +++ b/engines/avalanche/enhanced.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -37,7 +37,7 @@ namespace Avalanche { EXTERN byte shiftstate;/*ABSOLUTE $40:$17;*/ EXTERN boolean atbios; -EXTERN char inchar,extd; +EXTERN char inchar, extd; #undef EXTERN #define EXTERN extern diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp index 7305d94d0320..08c37796ca84 100644 --- a/engines/avalanche/enid.cpp +++ b/engines/avalanche/enid.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,7 +33,7 @@ ENID Edna's manager. */ #define __enid_implementation__ - /* Loads/ saves files. */ +/* Loads/ saves files. */ /*$V-*/ @@ -52,198 +52,228 @@ namespace Avalanche { -const string crlf = string('\15')+'\12'; +const string crlf = string('\15') + '\12'; const char tab = '\11'; const char eof_ = '\32'; -const array<1,177,char> ednafirst = - string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!")+ /*64*/ - crlf+eof_+crlf+crlf+ /*7*/ - tab+"Glory to God in the highest,"+crlf+ /*31*/ - tab+"and on earth peace, goodwill toward men."+ /*42*/ - crlf+tab+tab+tab+tab+ /*6*/ - "Luke 2:14."+ /*10*/ - crlf+crlf+crlf+ /* 6 */ - "1234567890"+crlf; /*11*/ +const array<1, 177, char> ednafirst = + string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ + crlf + eof_ + crlf + crlf + /*7*/ + tab + "Glory to God in the highest," + crlf + /*31*/ + tab + "and on earth peace, goodwill toward men." + /*42*/ + crlf + tab + tab + tab + tab + /*6*/ + "Luke 2:14." + /*10*/ + crlf + crlf + crlf + /* 6 */ + "1234567890" +crlf; /*11*/ -const string ednaid = string("TT")+'\261'+'\60'+'\1'+'\165'+'\261'+'\231'+'\261'; +const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; const integer ttage = 18; -const array<1,16,char> ttwashere = "Thomas was here "; +const array<1, 16, char> ttwashere = "Thomas was here "; boolean bug; -string expanddate(byte d,byte m, word y); +string expanddate(byte d, byte m, word y); -const array<1,12,varying_string<7> > months = -{{"Jan#","Febr#","March","April","May","June","July","August", -"Septem*","Octo*","Novem*","Decem*"}}; +const array<1, 12, varying_string<7> > months = { + { + "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", + "Septem*", "Octo*", "Novem*", "Decem*" + } +}; static varying_string<10> month; -static void addon(string x) { month[0] -= 1; month=month+x; } - -string expanddate(byte d,byte m, word y) -{ - varying_string<4> day; - - - string expanddate_result; - month=months[m]; - switch (month[length(month)]) { - case '#': addon("uary"); break; - case '*': addon("ber"); break; - } - - day=strf(d); - - if (set::of(range(1,9),range(21,31), eos).has(d)) - switch (d % 10) { - case 1: day=day+"st"; break; - case 2: day=day+"nd"; break; - case 3: day=day+"rd"; break; - default: day=day+"th"; - } +static void addon(string x) { + month[0] -= 1; + month = month + x; +} - expanddate_result=day+' '+month+' '+strf(y); - return expanddate_result; +string expanddate(byte d, byte m, word y) { + varying_string<4> day; + + + string expanddate_result; + month = months[m]; + switch (month[length(month)]) { + case '#': + addon("uary"); + break; + case '*': + addon("ber"); + break; + } + + day = strf(d); + + if (set::of(range(1, 9), range(21, 31), eos).has(d)) + switch (d % 10) { + case 1: + day = day + "st"; + break; + case 2: + day = day + "nd"; + break; + case 3: + day = day + "rd"; + break; + default: + day = day + "th"; + } + + expanddate_result = day + ' ' + month + ' ' + strf(y); + return expanddate_result; } void edna_save(string name); -static void show_bug(char icon, string strn) -{ display(string("\7\6\23")+icon+"\26\r"+strn+'\15'); } +static void show_bug(char icon, string strn) { + display(string("\7\6\23") + icon + "\26\r" + strn + '\15'); +} -static boolean test_bug(byte what) -{ - boolean test_bug_result; - if (what==0) { test_bug_result=false; return test_bug_result; } - switch (what) { - case 2: show_bug('7',"Error in filename!"); break; - case 101: show_bug('6',"Disk full!"); break; - case 150: show_bug('4',"Disk is write-protected!"); break; - default: show_bug('B',"Saving error!"); - } - test_bug_result=true; - return test_bug_result; +static boolean test_bug(byte what) { + boolean test_bug_result; + if (what == 0) { + test_bug_result = false; + return test_bug_result; + } + switch (what) { + case 2: + show_bug('7', "Error in filename!"); + break; + case 101: + show_bug('6', "Disk full!"); + break; + case 150: + show_bug('4', "Disk is write-protected!"); + break; + default: + show_bug('B', "Saving error!"); + } + test_bug_result = true; + return test_bug_result; } -void edna_save(string name) -{ - untyped_file f; - ednahead eh; - word groi; - string groi2,path; - word tempd,tempm; +void edna_save(string name) { + untyped_file f; + ednahead eh; + word groi; + string groi2, path; + word tempd, tempm; - if (name=="") - { /* We were given no name. Do we have a default? */ - if (enid_filename=="") - { /* No */ - filename_edit(); /* Request one. */ - return; - } else /* Yes */ - name=enid_filename; - } + if (name == "") { + /* We were given no name. Do we have a default? */ + if (enid_filename == "") { + /* No */ + filename_edit(); /* Request one. */ + return; + } else /* Yes */ + name = enid_filename; + } - wait(); /* Put up hourglass pointer */ + wait(); /* Put up hourglass pointer */ - fillchar(eh,sizeof(eh),'\261'); /* Fill up the edhead */ + fillchar(eh, sizeof(eh), '\261'); /* Fill up the edhead */ - dna.saves += 1; /* It's been saved one more time... */ + dna.saves += 1; /* It's been saved one more time... */ - { + { - /* Info about this program */ + /* Info about this program */ - eh.id=ednaid; /* Edna's signature */ - eh.revision=thisgamecode; /* 2- second revision of .ASG format */ - eh.game="Lord Avalot d'Argent"; /* Title of game */ - eh.shortname="Avalot"; - eh.number=2; /* Second Avvy game */ - eh.ver=thisvercode; /* Version 1.00 */ - eh.verstr=vernum; /* ditto */ - eh.filename="AVALOT.EXE"; /* program's filename */ - eh.osbyte=1; /* Saved under DOS */ - eh.os="DOS"; + eh.id = ednaid; /* Edna's signature */ + eh.revision = thisgamecode; /* 2- second revision of .ASG format */ + eh.game = "Lord Avalot d'Argent"; /* Title of game */ + eh.shortname = "Avalot"; + eh.number = 2; /* Second Avvy game */ + eh.ver = thisvercode; /* Version 1.00 */ + eh.verstr = vernum; /* ditto */ + eh.filename = "AVALOT.EXE"; /* program's filename */ + eh.osbyte = 1; /* Saved under DOS */ + eh.os = "DOS"; - /* Info on this particular game */ + /* Info on this particular game */ - fsplit(name,path,eh.fn,groi2); /* fn = filename of this game */ - getdate(eh.y,tempm,tempd,groi); /* Day, month & year when the game was saved */ - eh.d=tempd; eh.m=tempm; - eh.desc=roomname; /* Description of game (same as in Avaricius!) */ - eh.len=sizeof(dna); /* Length of DNA. */ + fsplit(name, path, eh.fn, groi2); /* fn = filename of this game */ + getdate(eh.y, tempm, tempd, groi); /* Day, month & year when the game was saved */ + eh.d = tempd; + eh.m = tempm; + eh.desc = roomname; /* Description of game (same as in Avaricius!) */ + eh.len = sizeof(dna); /* Length of DNA. */ - /* Quick reference & miscellaneous */ + /* Quick reference & miscellaneous */ - eh.saves=dna.saves; /* no. of times this game has been saved */ - eh.cash=dna.pence; /* contents of your wallet in numerical form */ - eh.money=lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ - eh.points=dna.score; /* your score */ + eh.saves = dna.saves; /* no. of times this game has been saved */ + eh.cash = dna.pence; /* contents of your wallet in numerical form */ + eh.money = lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ + eh.points = dna.score; /* your score */ - name=path+eh.fn+".ASG"; - } + name = path + eh.fn + ".ASG"; + } - assign(f,name); - /*$I-*/ - rewrite(f,1); - if (test_bug(ioresult)) return; + assign(f, name); + /*$I-*/ + rewrite(f, 1); + if (test_bug(ioresult)) return; - blockwrite(f,ednafirst,177); if (test_bug(ioresult)) return; - blockwrite(f,eh,sizeof(eh)); if (test_bug(ioresult)) return; - blockwrite(f,dna,sizeof(dna)); if (test_bug(ioresult)) return; + blockwrite(f, ednafirst, 177); + if (test_bug(ioresult)) return; + blockwrite(f, eh, sizeof(eh)); + if (test_bug(ioresult)) return; + blockwrite(f, dna, sizeof(dna)); + if (test_bug(ioresult)) return; - for( groi=1; groi <= numtr; groi ++) - { triptype& with = tr[groi]; - if (with.quick) - { - blockwrite(f,groi,1); if (test_bug(ioresult)) return; - savedata(f); if (test_bug(ioresult)) return; - }} + for (groi = 1; groi <= numtr; groi ++) { + triptype &with = tr[groi]; + if (with.quick) { + blockwrite(f, groi, 1); + if (test_bug(ioresult)) return; + savedata(f); + if (test_bug(ioresult)) return; + } + } - groi=177; blockwrite(f,groi,1); + groi = 177; + blockwrite(f, groi, 1); - blockwrite(f,times,sizeof(times)); /* Timeout.times: Timers. */ + blockwrite(f, times, sizeof(times)); /* Timeout.times: Timers. */ - if (test_bug(ioresult)) return; + if (test_bug(ioresult)) return; - blockwrite(f,seq,sizeof(seq)); /* Sequencer information. */ + blockwrite(f, seq, sizeof(seq)); /* Sequencer information. */ - if (test_bug(ioresult)) return; + if (test_bug(ioresult)) return; - for( groi=1; groi <= ttage; groi ++) - blockwrite(f,ttwashere[1-1],16); + for (groi = 1; groi <= ttage; groi ++) + blockwrite(f, ttwashere[1 - 1], 16); - if (test_bug(ioresult)) return; + if (test_bug(ioresult)) return; - close(f); - if (test_bug(ioresult)) return; - /*$I+*/ + close(f); + if (test_bug(ioresult)) return; + /*$I+*/ - display(string('\6')+"Saved: "+'\22'+name+'.'); - enid_filename=name; + display(string('\6') + "Saved: " + '\22' + name + '.'); + enid_filename = name; } -void loaderror(string x, char icon) -{ - if (holdthedawn) - { - holdthedawn=false; - dawn(); - } - display(string('\7')+'\6'+'\23'+icon+'\26'+"Loading error: "+"\r\r\22"+x); - bug=true; +void loaderror(string x, char icon) { + if (holdthedawn) { + holdthedawn = false; + dawn(); + } + display(string('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); + bug = true; } -typedef array<1,4,char> fourtype; +typedef array<1, 4, char> fourtype; @@ -252,172 +282,171 @@ const fourtype avaricius_file = "Avvy"; void edna_load(string name) { - untyped_file f; - ednahead eh; - byte fv; - byte io; - string path,fn,groi; - fourtype id4; + untyped_file f; + ednahead eh; + byte fv; + byte io; + string path, fn, groi; + fourtype id4; - word len2load; + word len2load; - if (name=="") - { /* No filename specified, so let's call the filer. */ - name=do_filer(); - if (name=="") return; /* STILL no filename, so they must have cancelled. */ - } + if (name == "") { + /* No filename specified, so let's call the filer. */ + name = do_filer(); + if (name == "") return; /* STILL no filename, so they must have cancelled. */ + } - bug=false; + bug = false; - wait(); /* Put up hourglass pointer */ + wait(); /* Put up hourglass pointer */ - fsplit(name,path,fn,groi); - name=path+fn+".ASG"; + fsplit(name, path, fn, groi); + name = path + fn + ".ASG"; - /* Load the file into memory */ + /* Load the file into memory */ - /*$I-*/ - assign(f,name); - reset(f,1); + /*$I-*/ + assign(f, name); + reset(f, 1); - io=ioresult; - if (io!=0) - switch (io) { - case 2: loaderror("File not found!",'8'); break; - case 3: loaderror("Directory not found!",'3'); break; - default: loaderror(string("Error no.")+strf(io),'1'); - } + io = ioresult; + if (io != 0) + switch (io) { + case 2: + loaderror("File not found!", '8'); + break; + case 3: + loaderror("Directory not found!", '3'); + break; + default: + loaderror(string("Error no.") + strf(io), '1'); + } - if (bug) return; + if (bug) return; - seek(f,11); blockread(f,id4,4); - if (id4==avaricius_file) - { - loaderror("That's an Avaricius file!",'1'); - close(f); - return; - } + seek(f, 11); + blockread(f, id4, 4); + if (id4 == avaricius_file) { + loaderror("That's an Avaricius file!", '1'); + close(f); + return; + } - seek(f,177); /* bypass ednafirst */ + seek(f, 177); /* bypass ednafirst */ - blockread(f,eh,sizeof(eh)); /* load ednahead */ + blockread(f, eh, sizeof(eh)); /* load ednahead */ - /* Check ednahead for errors */ + /* Check ednahead for errors */ - { - if ((eh.id!=ednaid) || (eh.revision!=2)) loaderror("Not an EDNA file!",'7'); else - if (eh.number!=2) loaderror(string("That file was saved by ")+eh.shortname+'!','1'); - } + { + if ((eh.id != ednaid) || (eh.revision != 2)) loaderror("Not an EDNA file!", '7'); + else if (eh.number != 2) loaderror(string("That file was saved by ") + eh.shortname + '!', '1'); + } - if (bug) - { - close(f); - return; - } + if (bug) { + close(f); + return; + } - len2load=eh.len; + len2load = eh.len; - if (eh.len!=(cardinal)sizeof(dna)) - { - if (holdthedawn) - { - holdthedawn=false; - dawn(); - } - display("\233\26Warning: \3\rEDNA size doesn't match.\f"); - if (eh.len>(cardinal)sizeof(dna)) - len2load=sizeof(dna); /* BIGGER than ours */ - else fillchar(dna,sizeof(dna),'\0'); /* Otherwise, smaller. */ - } + if (eh.len != (cardinal)sizeof(dna)) { + if (holdthedawn) { + holdthedawn = false; + dawn(); + } + display("\233\26Warning: \3\rEDNA size doesn't match.\f"); + if (eh.len > (cardinal)sizeof(dna)) + len2load = sizeof(dna); /* BIGGER than ours */ + else fillchar(dna, sizeof(dna), '\0'); /* Otherwise, smaller. */ + } - blockread(f,dna,len2load); + blockread(f, dna, len2load); - for( fv=1; fv <= numtr; fv ++) - { triptype& with = tr[fv]; - if (with.quick) done();} /* Deallocate sprite */ + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) done(); + } /* Deallocate sprite */ - do { - blockread(f,fv,1); - if (fv!=177) tr[fv].loaddata(f); - } while (!(fv==177)); + do { + blockread(f, fv, 1); + if (fv != 177) tr[fv].loaddata(f); + } while (!(fv == 177)); - blockread(f,times,sizeof(times)); /* Timeout.times: Timers. */ + blockread(f, times, sizeof(times)); /* Timeout.times: Timers. */ - blockread(f,seq,sizeof(seq)); /* Sequencer information. */ + blockread(f, seq, sizeof(seq)); /* Sequencer information. */ - close(f); + close(f); - seescroll=true; /* This prevents display of the new sprites before the + seescroll = true; /* This prevents display of the new sprites before the new picture is loaded. */ - if (holdthedawn) - { - holdthedawn=false; - dawn(); - } + if (holdthedawn) { + holdthedawn = false; + dawn(); + } - display(string('\6')+"Loaded: "+'\22'+name+'\3'+"\r\r"+eh.desc+"\r\r"+"saved on "+ - expanddate(eh.d,eh.m,eh.y)+'.'); + display(string('\6') + "Loaded: " + '\22' + name + '\3' + "\r\r" + eh.desc + "\r\r" + "saved on " + + expanddate(eh.d, eh.m, eh.y) + '.'); - forget_chunks(); + forget_chunks(); - minor_redraw(); + minor_redraw(); - whereis[pavalot]=dna.room; -/* showscore;*/ - alive=true; + whereis[pavalot] = dna.room; + /* showscore;*/ + alive = true; - objectlist(); -/*$I+*/ + objectlist(); + /*$I+*/ - enid_filename=name; + enid_filename = name; } void dir(string where); -static string path,groi; +static string path, groi; -static void showheader() -{ - display(string("Dir: ")+path+"\r\r\4"); +static void showheader() { + display(string("Dir: ") + path + "\r\r\4"); } void dir(string where) - /* OK, it worked in Avaricius, let's do it in Avalot! */ +/* OK, it worked in Avaricius, let's do it in Avalot! */ { - searchrec s; - byte count; + searchrec s; + byte count; - if ((where!="") && (!(set::of('\\',':', eos).has(where[length(where)])))) - where=where+'\\'; - fsplit(where,path,groi,groi); - path=path+"*.asg"; - count=0; + if ((where != "") && (!(set::of('\\', ':', eos).has(where[length(where)])))) + where = where + '\\'; + fsplit(where, path, groi, groi); + path = path + "*.asg"; + count = 0; - findfirst(path,anyfile,s); - showheader(); + findfirst(path, anyfile, s); + showheader(); - while (doserror==0) - { - count += 1; - if (count==11) - { - display("\r\nPress Enter..."); - showheader(); - count=1; - } + while (doserror == 0) { + count += 1; + if (count == 11) { + display("\r\nPress Enter..."); + showheader(); + count = 1; + } - display(s.name+"\r\4"); + display(s.name + "\r\4"); - findnext(s); - } + findnext(s); + } - if (count==0) - display("No files found!"); - else display("\nThat's all!"); + if (count == 0) + display("No files found!"); + else display("\nThat's all!"); } @@ -425,183 +454,178 @@ void avvy_background() /* Not really a filing procedure, but it's only called just before edna_load, so I thought I'd put it in Enid instead of, say, Lucerna. */ { -/* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ -/* - asm - mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } - mov dx,$3ce; mov al,4; out dx,al; { register. } - mov dx,$3c5; mov al,1; out dx,al; - mov dx,$3cf; out dx,al; + /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ + /* + asm + mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } + mov dx,$3ce; mov al,4; out dx,al; { register. } + mov dx,$3c5; mov al,1; out dx,al; + mov dx,$3cf; out dx,al; - mov bx,$A000; call far ptr @drawup; - mov bx,$A400; call far ptr @drawup; + mov bx,$A000; call far ptr @drawup; + mov bx,$A400; call far ptr @drawup; - jmp @the_end; + jmp @the_end; - @drawup: + @drawup: - mov es,bx; { The segment to copy it to... } - mov di,$370; { The offset (10 pixels down, plus 1 offset.) } + mov es,bx; { The segment to copy it to... } + mov di,$370; { The offset (10 pixels down, plus 1 offset.) } - mov cx,10; - mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } - mov ax,$AEAA; call far ptr @sameline; - mov ax,$A4EA; call far ptr @sameline; - mov ax,$44A4; call far ptr @sameline; + mov cx,10; + mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } + mov ax,$AEAA; call far ptr @sameline; + mov ax,$A4EA; call far ptr @sameline; + mov ax,$44A4; call far ptr @sameline; - mov cx,9; - mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } - mov ax,$AAEA; call far ptr @sameline; - mov ax,$AA4E; call far ptr @sameline; - mov ax,$444A; call far ptr @sameline; + mov cx,9; + mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } + mov ax,$AAEA; call far ptr @sameline; + mov ax,$AA4E; call far ptr @sameline; + mov ax,$444A; call far ptr @sameline; - mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } - mov ax,$AAAE; call far ptr @sameline; - mov ax,$EAA4; call far ptr @sameline; - mov ax,$A444; call far ptr @sameline; + mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } + mov ax,$AAAE; call far ptr @sameline; + mov ax,$EAA4; call far ptr @sameline; + mov ax,$A444; call far ptr @sameline; - mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } - mov ax,$EAAA; call far ptr @sameline; - mov ax,$4EAA; call far ptr @sameline; - mov ax,$4A44; call far ptr @sameline; + mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } + mov ax,$EAAA; call far ptr @sameline; + mov ax,$4EAA; call far ptr @sameline; + mov ax,$4A44; call far ptr @sameline; - ret; + ret; - { Replicate the same line many times. } + { Replicate the same line many times. } - @sameline: - { Requires: - what to copy in AX, - how many lines in CX, and - original offset in DI. } - push cx; - push di; + @sameline: + { Requires: + what to copy in AX, + how many lines in CX, and + original offset in DI. } + push cx; + push di; - @samelineloop: + @samelineloop: - push cx; - mov cx,40; { No. of times to repeat it on one line. } + push cx; + mov cx,40; { No. of times to repeat it on one line. } - repz stosw; { Fast word-copying } + repz stosw; { Fast word-copying } - pop cx; + pop cx; - add di,1200; { The next one will be 16 lines down. } + add di,1200; { The next one will be 16 lines down. } - loop @samelineloop; - pop di; - add di,80; - pop cx; + loop @samelineloop; + pop di; + add di,80; + pop cx; - ret; + ret; - @the_end: - end; -*/ -blitfix(); + @the_end: + end; + */ + blitfix(); } -void to_sundry(sundry& sund) -{ - { - sund.qenid_filename=enid_filename; - sund.qsoundfx=soundfx; - sund.qthinks=thinks; - sund.qthinkthing=thinkthing; - } +void to_sundry(sundry &sund) { + { + sund.qenid_filename = enid_filename; + sund.qsoundfx = soundfx; + sund.qthinks = thinks; + sund.qthinkthing = thinkthing; + } } -void from_sundry(sundry sund) -{ - { - enid_filename=sund.qenid_filename; - soundfx=sund.qsoundfx; - thinks=sund.qthinks; - thinkthing=sund.qthinkthing; - } +void from_sundry(sundry sund) { + { + enid_filename = sund.qenid_filename; + soundfx = sund.qsoundfx; + thinks = sund.qthinks; + thinkthing = sund.qthinkthing; + } } -void restore_dna() -{ - word here,fv; - sundry sund; - - move(mem[storage_seg*storage_ofs+3],dna,sizeof(dna)); - move(mem[storage_seg*storage_ofs+3+sizeof(dna)],times,sizeof(times)); - move(mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)], - seq,sizeof(seq)); - move(mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)], - sund,sizeof(sund)); - from_sundry(sund); - - here=storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)+sizeof(sund); - do { - fv=mem[storage_seg*here]; here += 1; - if (fv!=177) tr[fv].load_data_from_mem(here); - } while (!(fv==177)); +void restore_dna() { + word here, fv; + sundry sund; + + move(mem[storage_seg * storage_ofs + 3], dna, sizeof(dna)); + move(mem[storage_seg * storage_ofs + 3 + sizeof(dna)], times, sizeof(times)); + move(mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times)], + seq, sizeof(seq)); + move(mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq)], + sund, sizeof(sund)); + from_sundry(sund); + + here = storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq) + sizeof(sund); + do { + fv = mem[storage_seg * here]; + here += 1; + if (fv != 177) tr[fv].load_data_from_mem(here); + } while (!(fv == 177)); } -void edna_reload() -{ +void edna_reload() { - restore_dna(); + restore_dna(); - seescroll=true; /* This prevents display of the new sprites before the + seescroll = true; /* This prevents display of the new sprites before the new picture is loaded. */ - major_redraw(); + major_redraw(); - whereis[pavalot]=dna.room; + whereis[pavalot] = dna.room; - alive=true; + alive = true; - objectlist(); + objectlist(); - if (holdthedawn) - { - holdthedawn=false; - dawn(); - } + if (holdthedawn) { + holdthedawn = false; + dawn(); + } } -void back_to_bootstrap(byte what) -{ - byte fv; - word here; - sundry sund; - - mem[storage_seg*storage_ofs]=what; /* Save the operation code. */ - to_sundry(sund); /* Save the sundry information. */ - - /* Save the DNA, times and sequencer info: */ - move(dna,mem[storage_seg*storage_ofs+3],sizeof(dna)); - move(times,mem[storage_seg*storage_ofs+3+sizeof(dna)],sizeof(times)); - move(seq,mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)], - sizeof(seq)); - move(sund, - mem[storage_seg*storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)], - sizeof(sund)); - - here=storage_ofs+3+sizeof(dna)+sizeof(times)+sizeof(seq)+sizeof(sund); - - for( fv=1; fv <= numtr; fv ++) - { triptype& with = tr[fv]; - if (with.quick) - { - mem[storage_seg*here]=fv; here += 1; - save_data_to_mem(here); - }} - mem[storage_seg*here]=177; - - exit(77); /* Code to return to the Bootstrap. */ +void back_to_bootstrap(byte what) { + byte fv; + word here; + sundry sund; + + mem[storage_seg * storage_ofs] = what; /* Save the operation code. */ + to_sundry(sund); /* Save the sundry information. */ + + /* Save the DNA, times and sequencer info: */ + move(dna, mem[storage_seg * storage_ofs + 3], sizeof(dna)); + move(times, mem[storage_seg * storage_ofs + 3 + sizeof(dna)], sizeof(times)); + move(seq, mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times)], + sizeof(seq)); + move(sund, + mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq)], + sizeof(sund)); + + here = storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq) + sizeof(sund); + + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) { + mem[storage_seg * here] = fv; + here += 1; + save_data_to_mem(here); + } + } + mem[storage_seg * here] = 177; + + exit(77); /* Code to return to the Bootstrap. */ } -boolean there_was_a_problem() -{ - boolean there_was_a_problem_result; - there_was_a_problem_result=bug; - return there_was_a_problem_result; +boolean there_was_a_problem() { + boolean there_was_a_problem_result; + there_was_a_problem_result = bug; + return there_was_a_problem_result; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h index d9f0a5416f86..95b03b77495c 100644 --- a/engines/avalanche/enid.h +++ b/engines/avalanche/enid.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index c96f445bdeaf..b8e3c8bfe092 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -36,64 +36,66 @@ namespace Avalanche { struct windowtype { - integer x1,y1,x2,y2; - varying_string<20> title; + integer x1, y1, x2, y2; + varying_string<20> title; }; - struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS (here 1=DOS. See below for others.*/ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ - }; +struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS (here 1=DOS. See below for others.*/ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; const integer border = 1; /* size of border on shadowboxes */ -const array<1,4,varying_string<7> > buttons = {{"Okay","Wipe","Cancel","Info..."}}; +const array<1, 4, varying_string<7> > buttons = {{"Okay", "Wipe", "Cancel", "Info..."}}; const integer files = 3; const integer dirs = 4; const integer drlen = 15; /* no. of drives on one line */ -const array<1,4,windowtype> threewins = - {{{155, 12, 630, 22, "Name"}, - {15, 25, 410, 70, "Drives"}, - {15, 83, 480, 179, "Files (*.ASG)"}, - {490, 83, 630, 179, "Subdirectories"}}}; +const array<1, 4, windowtype> threewins = { + { {155, 12, 630, 22, "Name"}, + {15, 25, 410, 70, "Drives"}, + {15, 83, 480, 179, "Files (*.ASG)"}, + {490, 83, 630, 179, "Subdirectories"} + } +}; const integer name_win = 1; const integer drive_win = 2; const integer file_win = 3; const integer subdir_win = 4; -matrix<3,4,1,77,varying_string<12> > lists; -array<1,77,varying_string<40> > descs; -array<3,4,byte> nums,where,top; +matrix<3, 4, 1, 77, varying_string<12> > lists; +array<1, 77, varying_string<40> > descs; +array<3, 4, byte> nums, where, top; searchrec s; boolean loading; varying_string<26> drives; @@ -104,716 +106,847 @@ varying_string<17> doing; pathstr filename; boolean filefound; -void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) -{ - byte fv; -; - for( fv=0; fv <= border; fv ++) - {; - setfillstyle(1,hc); - bar(x1+fv,y1+fv,x1+fv,y2-fv); - bar(x1+fv,y1+fv,x2-fv,y1+fv); - - setfillstyle(1,sc); - bar(x2-fv,y1+fv,x2-fv,y2-fv); - bar(x1+fv,y2-fv,x2-fv,y2-fv); - } -} - -void shbox(integer x1,integer y1,integer x2,integer y2, string t) -{ - const integer fc = 7; -; - shadow(x1,y1,x2,y2,15,8); - setfillstyle(1,fc); - bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); - setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; - outtextxy(x1,y1,t); - if (length(t)>1) - {; - fillchar(t[2],length(t)-1,'\40'); t[1]='_'; - outtextxy(x1-1,y1+1,t); - } -} - -void show_drives() -{ - byte fv; -; - settextjustify(1,1); - for( fv=0; fv <= length(drives)-1; fv ++) - shbox((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,drives[fv+1]); - setcolor(11); - settextjustify(0,2); -} - -void box(integer x1,integer y1,integer x2,integer y2, string z) -{; - rectangle(x1,y1,x2,y2); - outtextxy(x1+1,y1-10,z+':'); - outtextxy(x1,y1-9,"_"); -} - -string lowstr(string x) -{ - byte fv; -string lowstr_result; -; - for( fv=1; fv <= length(x); fv ++) - if (set::of(range('A','Z'), eos).has(x[fv])) x[fv] += 32; - lowstr_result=x; -return lowstr_result; -} - -char lowchar(char x) -{ - char lowchar_result; - if (set::of(range('A','Z'), eos).has(x)) x -= 32; - lowchar_result=x; - return lowchar_result; -} - -void getcurrent() -{; - current=lowstr(fexpand("*.asg")); -} - -void setup() -{ - integer gd,gm; - registers r; - byte floppies; -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - dusk(); - setfillstyle(1,1); bar(2,2,637,197); shadow(0,0,639,199,15,7); - - if (loading) doing="LOAD"; else doing="SAV"; - doing=doing+"ING a file..."; - - /* Now... find all drives that exist. */ - drives=""; - intr(0x11,r); floppies=(((cardinal)r.ax >> 6) & 0x3)+1; /* useful bit of code! */ - for( gm=1; gm <= floppies; gm ++) drives=drives+chr(64+gm); - /* Winchesters, etc., can be found the easy way... */ - for( gd=3; gd <= 26; gd ++) /* C: to Z: */ - if (disksize(gd)>-1) drives=drives+chr(64+gd); - - fillchar(where,sizeof(where),'\1'); - fillchar(top,sizeof(top),'\1'); - - settextstyle(0,0,0); - settextjustify(1,1); - for( gd=1; gd <= 2; gd ++) - for( gm=0; gm <= 1; gm ++) - shbox(420+gm*110,gd*25,520+gm*110,gd*25+20,buttons[gm*2+gd]); - shbox(15,182,350,196,"Help... (press f1)"); - settextjustify(0,2); setcolor(11); - setcolor(15); outtextxy(15,5,"The Avvy Filer..."); - setcolor(11); outtextxy(317,3,string('(')+doing+')'); - outtextxy(357,185,"Copyright (c) 1993, Thomas Thurman."); - - /* Draw the boxes and names */ - setcolor(3); - for( gm=1; gm <= 4; gm ++) - { windowtype& with = threewins[gm]; - box(with.x1,with.y1,with.x2,with.y2,with.title);} - nowwin=1; getcurrent(); +void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { + byte fv; + ; + for (fv = 0; fv <= border; fv ++) { + ; + setfillstyle(1, hc); + bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); + bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); + + setfillstyle(1, sc); + bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); + bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); + } +} + +void shbox(integer x1, integer y1, integer x2, integer y2, string t) { + const integer fc = 7; + ; + shadow(x1, y1, x2, y2, 15, 8); + setfillstyle(1, fc); + bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); + setcolor(1); + x1 = (x2 - x1) / 2 + x1; + y1 = (y2 - y1) / 2 + y1; + outtextxy(x1, y1, t); + if (length(t) > 1) { + ; + fillchar(t[2], length(t) - 1, '\40'); + t[1] = '_'; + outtextxy(x1 - 1, y1 + 1, t); + } +} + +void show_drives() { + byte fv; + ; + settextjustify(1, 1); + for (fv = 0; fv <= length(drives) - 1; fv ++) + shbox((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, drives[fv + 1]); + setcolor(11); + settextjustify(0, 2); +} + +void box(integer x1, integer y1, integer x2, integer y2, string z) { + ; + rectangle(x1, y1, x2, y2); + outtextxy(x1 + 1, y1 - 10, z + ':'); + outtextxy(x1, y1 - 9, "_"); +} + +string lowstr(string x) { + byte fv; + string lowstr_result; + ; + for (fv = 1; fv <= length(x); fv ++) + if (set::of(range('A', 'Z'), eos).has(x[fv])) x[fv] += 32; + lowstr_result = x; + return lowstr_result; +} + +char lowchar(char x) { + char lowchar_result; + if (set::of(range('A', 'Z'), eos).has(x)) x -= 32; + lowchar_result = x; + return lowchar_result; +} + +void getcurrent() { + ; + current = lowstr(fexpand("*.asg")); +} + +void setup() { + integer gd, gm; + registers r; + byte floppies; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + dusk(); + setfillstyle(1, 1); + bar(2, 2, 637, 197); + shadow(0, 0, 639, 199, 15, 7); + + if (loading) doing = "LOAD"; + else doing = "SAV"; + doing = doing + "ING a file..."; + + /* Now... find all drives that exist. */ + drives = ""; + intr(0x11, r); + floppies = (((cardinal)r.ax >> 6) & 0x3) + 1; /* useful bit of code! */ + for (gm = 1; gm <= floppies; gm ++) drives = drives + chr(64 + gm); + /* Winchesters, etc., can be found the easy way... */ + for (gd = 3; gd <= 26; gd ++) /* C: to Z: */ + if (disksize(gd) > -1) drives = drives + chr(64 + gd); + + fillchar(where, sizeof(where), '\1'); + fillchar(top, sizeof(top), '\1'); + + settextstyle(0, 0, 0); + settextjustify(1, 1); + for (gd = 1; gd <= 2; gd ++) + for (gm = 0; gm <= 1; gm ++) + shbox(420 + gm * 110, gd * 25, 520 + gm * 110, gd * 25 + 20, buttons[gm * 2 + gd]); + shbox(15, 182, 350, 196, "Help... (press f1)"); + settextjustify(0, 2); + setcolor(11); + setcolor(15); + outtextxy(15, 5, "The Avvy Filer..."); + setcolor(11); + outtextxy(317, 3, string('(') + doing + ')'); + outtextxy(357, 185, "Copyright (c) 1993, Thomas Thurman."); + + /* Draw the boxes and names */ + setcolor(3); + for (gm = 1; gm <= 4; gm ++) { + windowtype &with = threewins[gm]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + nowwin = 1; + getcurrent(); } void quicksort(byte whichlist, integer lo, integer hi); -static void sort(integer l, integer r, byte& whichlist) -{ - integer i, j; - varying_string<12> x, y; - - i = l; j = r; x = lists[whichlist][(l+r) / 2]; - do { - while (lists[whichlist][i] < x) i = i + 1; - while (x < lists[whichlist][j]) j = j - 1; - if (i <= j) - { - y = lists[whichlist][i]; - lists[whichlist][i] = lists[whichlist][j]; - lists[whichlist][j] = y; - i = i + 1; j = j - 1; - } - } while (!(i > j)); - if (l < j) sort(l, j, whichlist); - if (i < r) sort(i, r, whichlist); +static void sort(integer l, integer r, byte &whichlist) { + integer i, j; + varying_string<12> x, y; + + i = l; + j = r; + x = lists[whichlist][(l + r) / 2]; + do { + while (lists[whichlist][i] < x) i = i + 1; + while (x < lists[whichlist][j]) j = j - 1; + if (i <= j) { + y = lists[whichlist][i]; + lists[whichlist][i] = lists[whichlist][j]; + lists[whichlist][j] = y; + i = i + 1; + j = j - 1; + } + } while (!(i > j)); + if (l < j) sort(l, j, whichlist); + if (i < r) sort(i, r, whichlist); } void quicksort(byte whichlist, integer lo, integer hi) -{ /*QuickSort*/; - sort(lo,hi, whichlist); -} - -void scandir() -{ - pathstr nix; - namestr name; - untyped_file f; - ednahead eh; - array<1,4,char> dna_type; - -; - nums[files]=0; - findfirst("*.asg",archive+hidden+readonly,s); - - while (doserror==0) - {; - fsplit(s.name,nix,name,nix); - nums[files] += 1; - lists[files][nums[files]]=lowstr(name); - - assign(f,s.name); - reset(f,1); - seek(f,11); - blockread(f,dna_type,4); - - if (dna_type=="Avvy") - {; /* A DNA256 file. */ - descs[nums[files]]="* Saved by Avaricius!"; - } else - {; /* EDNA-based files. */ - if (dna_type=="EDNA") - {; - seek(f,177); - blockread(f,eh,sizeof(eh)); - - if (eh.revision!=2) - descs[nums[files]]="* Unknown EDNA type!"; - else - {; - - if (eh.number!=2) - descs[nums[files]]=string("* Saved by ")+eh.shortname+'!'; - else - {; /* Well... everything seems to have gone OK! */ - descs[nums[files]]=eh.desc; - } - } - } else - descs[nums[files]]="* Not an Avvy saved game!"; - } - close(f); - findnext(s); - } - nums[dirs]=0; findfirst("*.*",directory,s); - while (doserror==0) - {; - if (((s.attr & directory)>0) && ((length(s.name))>1)) - {; - nums[dirs] += 1; - lists[dirs][nums[dirs]]=lowstr(s.name); - } - findnext(s); - } - - /* Now sort 'em! */ - - quicksort ( dirs,1,nums[ dirs]); - quicksort (files,1,nums[files]); - - where[dirs]=1; where[files]=1; - top[dirs]=1; top[files]=1; -} - -void show_file(integer x,integer y, byte which) -{ - varying_string<58> z; -; - fillchar(z[1],13,'\40'); - z=lists[files][which]+".asg"; - z[0]='\15'; z=z+descs[which]; - - if (descs[which][1]=='*') /* Can't load these! */ - setcolor(red); - else - setcolor(lightcyan); - - outtextxy(x,y,z); -} - -void showfiles() -{ - byte fv; -; - if (loading) setcolor(11); else setcolor(3); - if (nums[3]==0) - {; - outtextxy(22,86,"(None here!)"); - return; - } - for( fv=0; fv <= 8; fv ++) - if (where[3]+fv<=nums[3]) - show_file(19,87+fv*10,where[3]+fv); -} - -void showdirs() -{ - byte fv; -; - setcolor(11); - for( fv=0; fv <= 8; fv ++) - if (where[4]+fv<=nums[4]) - outtextxy(497,87+fv*10,string('[')+lists[dirs][fv+where[4]]+']'); -} - -void show() -{ - byte fv; - dirstr d; namestr n; extstr e; -; - setfillstyle(1,1); - for( fv=1; fv <= 4; fv ++) - if (fv!=2) - { windowtype& with = threewins[fv]; - bar(with.x1+1,with.y1+1,with.x2-1,with.y2-1);} - showfiles(); - showdirs(); - setcolor(7); outtextxy(159,14,current); -} - -void blip() -{; - sound(177); delay(77); nosound; -} - -void invert(integer x1,integer y1,integer x2,integer y2) -{ - pointer p,restore; word s; -; - s=imagesize(x1,y1,x2,y2); - mark(restore); getmem(p,s); - getimage(x1,y1,x2,y2,p); - putimage(x1,y1,p,notput); - release(restore); -} - -void changedrive(char drive) -{ - byte fv; -; - fv=pos(drive,drives); - if (fv==0) {; blip(); return; } - fv -= 1; - shadow((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,8,7); - chdir(string(drive)+':'); - getcurrent(); scandir(); show(); - shadow((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,15,8); -} - -void highlight(byte win,byte line) -{; - switch (win) { - case 3: invert(16,75+line*10,479,85+line*10); break; - case 4: invert(491,75+line*10,619,85+line*10); break; - } -} - -void repaint(byte whichwindow) -{ - setfillstyle(1,1); - { windowtype& with = threewins[whichwindow]; - bar(with.x1+1,with.y1+1,with.x2-1,with.y2-1);} - switch (whichwindow) { - case file_win: showfiles(); break; - case subdir_win: showdirs(); break; - } - highlight(whichwindow,1); - top[whichwindow]=where[whichwindow]; -} - -void fileblit(word xpos,word xlen,word y1,word y2, shortint dir, word ylen) -{ - word fv; byte bit; -; - for( bit=0; bit <= 3; bit ++) - {; - fv=0; - while (fvnums[whichlist]) wherenow=1; - } while (!((startedat==wherenow) || (lists[whichlist][wherenow][1]==whatfor))); - repaint(whichlist); -} - -void gotohome(byte whichlist) -{ - where[whichlist]=1; - repaint(whichlist); -} - -void gotoend(byte whichlist) -{ - where[whichlist]=nums[whichlist]; - repaint(whichlist); -} - -void pageup(byte whichlist) -{ - if (where[whichlist]>9) - { - where[whichlist] -= 9; - repaint(whichlist); - } -} - -void pagedown(byte whichlist) { - if (where[whichlist] dna_type; + + ; + nums[files] = 0; + findfirst("*.asg", archive + hidden + readonly, s); + + while (doserror == 0) { + ; + fsplit(s.name, nix, name, nix); + nums[files] += 1; + lists[files][nums[files]] = lowstr(name); + + assign(f, s.name); + reset(f, 1); + seek(f, 11); + blockread(f, dna_type, 4); + + if (dna_type == "Avvy") { + ; /* A DNA256 file. */ + descs[nums[files]] = "* Saved by Avaricius!"; + } else { + ; /* EDNA-based files. */ + if (dna_type == "EDNA") { + ; + seek(f, 177); + blockread(f, eh, sizeof(eh)); + + if (eh.revision != 2) + descs[nums[files]] = "* Unknown EDNA type!"; + else { + ; + + if (eh.number != 2) + descs[nums[files]] = string("* Saved by ") + eh.shortname + '!'; + else { + ; /* Well... everything seems to have gone OK! */ + descs[nums[files]] = eh.desc; + } + } + } else + descs[nums[files]] = "* Not an Avvy saved game!"; + } + close(f); + findnext(s); + } + nums[dirs] = 0; + findfirst("*.*", directory, s); + while (doserror == 0) { + ; + if (((s.attr & directory) > 0) && ((length(s.name)) > 1)) { + ; + nums[dirs] += 1; + lists[dirs][nums[dirs]] = lowstr(s.name); + } + findnext(s); + } + + /* Now sort 'em! */ + + quicksort(dirs, 1, nums[ dirs]); + quicksort(files, 1, nums[files]); + + where[dirs] = 1; + where[files] = 1; + top[dirs] = 1; + top[files] = 1; +} + +void show_file(integer x, integer y, byte which) { + varying_string<58> z; + ; + fillchar(z[1], 13, '\40'); + z = lists[files][which] + ".asg"; + z[0] = '\15'; + z = z + descs[which]; + + if (descs[which][1] == '*') /* Can't load these! */ + setcolor(red); + else + setcolor(lightcyan); + + outtextxy(x, y, z); +} + +void showfiles() { + byte fv; + ; + if (loading) setcolor(11); + else setcolor(3); + if (nums[3] == 0) { + ; + outtextxy(22, 86, "(None here!)"); + return; + } + for (fv = 0; fv <= 8; fv ++) + if (where[3] + fv <= nums[3]) + show_file(19, 87 + fv * 10, where[3] + fv); +} + +void showdirs() { + byte fv; + ; + setcolor(11); + for (fv = 0; fv <= 8; fv ++) + if (where[4] + fv <= nums[4]) + outtextxy(497, 87 + fv * 10, string('[') + lists[dirs][fv + where[4]] + ']'); +} + +void show() { + byte fv; + dirstr d; + namestr n; + extstr e; + ; + setfillstyle(1, 1); + for (fv = 1; fv <= 4; fv ++) + if (fv != 2) { + windowtype &with = threewins[fv]; + bar(with.x1 + 1, with.y1 + 1, with.x2 - 1, with.y2 - 1); + } + showfiles(); + showdirs(); + setcolor(7); + outtextxy(159, 14, current); +} + +void blip() { + ; + sound(177); + delay(77); + nosound; +} + +void invert(integer x1, integer y1, integer x2, integer y2) { + pointer p, restore; + word s; + ; + s = imagesize(x1, y1, x2, y2); + mark(restore); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + putimage(x1, y1, p, notput); + release(restore); +} + +void changedrive(char drive) { + byte fv; + ; + fv = pos(drive, drives); + if (fv == 0) { + ; + blip(); + return; + } + fv -= 1; + shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 8, 7); + chdir(string(drive) + ':'); + getcurrent(); + scandir(); + show(); + shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 15, 8); +} + +void highlight(byte win, byte line) { + ; + switch (win) { + case 3: + invert(16, 75 + line * 10, 479, 85 + line * 10); + break; + case 4: + invert(491, 75 + line * 10, 619, 85 + line * 10); + break; + } +} + +void repaint(byte whichwindow) { + setfillstyle(1, 1); + { + windowtype &with = threewins[whichwindow]; + bar(with.x1 + 1, with.y1 + 1, with.x2 - 1, with.y2 - 1); + } + switch (whichwindow) { + case file_win: + showfiles(); + break; + case subdir_win: + showdirs(); + break; + } + highlight(whichwindow, 1); + top[whichwindow] = where[whichwindow]; +} + +void fileblit(word xpos, word xlen, word y1, word y2, shortint dir, word ylen) { + word fv; + byte bit; + ; + for (bit = 0; bit <= 3; bit ++) { + ; + fv = 0; + while (fv < ylen) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(mem[0xa000 * (y1 + fv * dir) * 80 + xpos], mem[0xa000 * (y2 + fv * dir) * 80 + xpos], xlen); + fv += 1; + } + } + bit = getpixel(0, 0); +} + +void seekthrough(byte whichlist, byte &wherenow, char whatfor) { + byte startedat; + + startedat = wherenow; + do { + wherenow += 1; + if (wherenow > nums[whichlist]) wherenow = 1; + } while (!((startedat == wherenow) || (lists[whichlist][wherenow][1] == whatfor))); + repaint(whichlist); +} + +void gotohome(byte whichlist) { + where[whichlist] = 1; + repaint(whichlist); +} + +void gotoend(byte whichlist) { + where[whichlist] = nums[whichlist]; + repaint(whichlist); +} + +void pageup(byte whichlist) { + if (where[whichlist] > 9) { + where[whichlist] -= 9; + repaint(whichlist); + } +} + +void pagedown(byte whichlist) { + if (where[whichlist] < nums[whichlist] - 9) { + where[whichlist] += 9; + repaint(whichlist); + } } void subdirparse(string r); -static void movehl(byte which, shortint howmuch) -{; - highlight(4,where[4]-top[4]+1); - if (((where[which]+howmuch)>0) && ((where[which]+howmuch)<=(unsigned char)nums[4])) - where[which]=where[which]+howmuch; - highlight(4,where[4]-top[4]+1); +static void movehl(byte which, shortint howmuch) { + ; + highlight(4, where[4] - top[4] + 1); + if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[4])) + where[which] = where[which] + howmuch; + highlight(4, where[4] - top[4] + 1); } -static void change_dir() -{; - dusk(); - /*$I-*/ chdir(lists[4][where[4]]); - /*$I+*/ - if (ioresult!=0) {; dawn(); blip(); return; } - where[4]=1; top[4]=1; - getcurrent(); scandir(); show(); - highlight(4,1); - dawn(); +static void change_dir() { + ; + dusk(); + /*$I-*/ chdir(lists[4][where[4]]); + /*$I+*/ + if (ioresult != 0) { + ; + dawn(); + blip(); + return; + } + where[4] = 1; + top[4] = 1; + getcurrent(); + scandir(); + show(); + highlight(4, 1); + dawn(); } void subdirparse(string r) -{; - switch (r[1]) { - case creturn: change_dir(); break; - - case '\0': switch (r[2]) { - case cup: if (where[4]-top[4]>0) /* Up */ - movehl(4,-1); /* Within range */ - else if (top[4]>1) - {; /* Outside range- must scroll */ - highlight(4,1); - top[4] -= 1; where[4] -= 1; - fileblit(61,18,166,176,-1,80); - setfillstyle(1,1); bar(490,85,630,95); setcolor(11); - outtextxy(497,87,string('[')+lists[dirs][where[4]]+']'); - highlight(4,1); - } - break; - case cdown: - if (where[4]-top[4]<8) /* Down */ - movehl(4,1); - else if (top[4]+8 0) /* Up */ + movehl(4, -1); /* Within range */ + else if (top[4] > 1) { + ; /* Outside range- must scroll */ + highlight(4, 1); + top[4] -= 1; + where[4] -= 1; + fileblit(61, 18, 166, 176, -1, 80); + setfillstyle(1, 1); + bar(490, 85, 630, 95); + setcolor(11); + outtextxy(497, 87, string('[') + lists[dirs][where[4]] + ']'); + highlight(4, 1); + } + break; + case cdown: + if (where[4] - top[4] < 8) /* Down */ + movehl(4, 1); + else if (top[4] + 8 < nums[4]) { + ; + highlight(4, 9); + top[4] += 1; + where[4] += 1; + fileblit(60, 18, 97, 87, 1, 80); + setfillstyle(1, 1); + bar(490, 165, 630, 175); + setcolor(11); + outtextxy(497, 167, string('[') + lists[dirs][where[4]] + ']'); + highlight(4, 9); + } + break; + case chome: + gotohome(4); + break; + case cend: + gotoend(4); + break; + case cpgup: + pageup(4); + break; + case cpgdn: + pagedown(4); + break; + case c_ao: + change_dir(); + break; + } + break; + default: + seekthrough(4, where[4], lowchar(r[1])); + } } void fileinfo(byte which); -static void display(integer y, string left,string right) -{; - y=17+y*12; - settextjustify(2,1); setcolor(11); outtextxy(315,y,left); - settextjustify(0,1); setcolor(15); outtextxy(325,y,right); +static void display(integer y, string left, string right) { + ; + y = 17 + y * 12; + settextjustify(2, 1); + setcolor(11); + outtextxy(315, y, left); + settextjustify(0, 1); + setcolor(15); + outtextxy(325, y, right); } void fileinfo(byte which) - /* This gives information on the file whose name is in lists[files,which]. */ +/* This gives information on the file whose name is in lists[files,which]. */ { - ednahead eh; - untyped_file f; - varying_string<4> os; - char r; + ednahead eh; + untyped_file f; + varying_string<4> os; + char r; -; + ; - /* Firstly, we must check whether or not it's an Avalot file. This is easily - done, since the descriptions of all others always begin with a star. */ + /* Firstly, we must check whether or not it's an Avalot file. This is easily + done, since the descriptions of all others always begin with a star. */ - if ((descs[which][1]=='*') || (descs[which][1]=='(')) - {; /* it is. */ - blip(); /* Naaaarghh! */ - return; - } + if ((descs[which][1] == '*') || (descs[which][1] == '(')) { + ; /* it is. */ + blip(); /* Naaaarghh! */ + return; + } - /* Anyway... it wasn't. */ + /* Anyway... it wasn't. */ - assign(f,lists[files][which]+".asg"); - reset(f,1); - seek(f,177); - blockread(f,eh,sizeof(eh)); - close(f); + assign(f, lists[files][which] + ".asg"); + reset(f, 1); + seek(f, 177); + blockread(f, eh, sizeof(eh)); + close(f); - /* We now hold its EDNA record. */ + /* We now hold its EDNA record. */ - setfillstyle(1,1); bar(2,2,637,197); /* Interesting information coming up! */ + setfillstyle(1, 1); + bar(2, 2, 637, 197); /* Interesting information coming up! */ - {; - display(2,"Saved by:", eh.game); - display(3,"version:", eh.verstr); + { + ; + display(2, "Saved by:", eh.game); + display(3, "version:", eh.verstr); -/* display(4,'under', os);*/ + /* display(4,'under', os);*/ - display(6,"Saved on ",strf(eh.d)+'-'+strf(eh.m)+'-'+strf(eh.y)); + display(6, "Saved on ", strf(eh.d) + '-' + strf(eh.m) + '-' + strf(eh.y)); - display(9,"No. of times saved:",strf(eh.saves)); + display(9, "No. of times saved:", strf(eh.saves)); - display(11,"Money:",eh.money); - display(12,"Score:",strf(eh.points)); - } + display(11, "Money:", eh.money); + display(12, "Score:", strf(eh.points)); + } - shbox(500,177,650,200,"Press any key..."); - r=readkey(); + shbox(500, 177, 650, 200, "Press any key..."); + r = readkey(); - setfillstyle(1,1); bar(2,2,637,197); + setfillstyle(1, 1); + bar(2, 2, 637, 197); } void filer_help() - /* This gives general help. */ +/* This gives general help. */ { - char r; -; - outtextxy(100,100,"Just general help here."); - shbox(500,177,650,200,"Press any key..."); - r=readkey(); + char r; + ; + outtextxy(100, 100, "Just general help here."); + shbox(500, 177, 650, 200, "Press any key..."); + r = readkey(); - setfillstyle(1,1); bar(2,2,637,197); + setfillstyle(1, 1); + bar(2, 2, 637, 197); } void wipe() - /* This allows you to delete files. */ +/* This allows you to delete files. */ { - char r; -; - outtextxy(100,100,"Are you sure you want to delete \"foo.bar\"?"); - shbox(500,177,650,200,"[Y/N]"); - r=readkey(); + char r; + ; + outtextxy(100, 100, "Are you sure you want to delete \"foo.bar\"?"); + shbox(500, 177, 650, 200, "[Y/N]"); + r = readkey(); - setfillstyle(1,1); bar(2,2,637,197); + setfillstyle(1, 1); + bar(2, 2, 637, 197); } void filesparse(string r); -static void movehl1(byte which, shortint howmuch) -{; - highlight(3,where[3]-top[3]+1); - if (((where[which]+howmuch)>0) && ((where[which]+howmuch)<=(unsigned char)nums[3])) - where[which]=where[which]+howmuch; - highlight(3,where[3]-top[3]+1); +static void movehl1(byte which, shortint howmuch) { + ; + highlight(3, where[3] - top[3] + 1); + if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[3])) + where[which] = where[which] + howmuch; + highlight(3, where[3] - top[3] + 1); } -static boolean selected_file() -{boolean selected_file_result; -; - if (descs[where[file_win]][1]=='*') - { - blip(); - selected_file_result=false; - } else - { - filename=lists[file_win][where[file_win]]; - filefound=true; - selected_file_result=true; - } -return selected_file_result; +static boolean selected_file() { + boolean selected_file_result; + ; + if (descs[where[file_win]][1] == '*') { + blip(); + selected_file_result = false; + } else { + filename = lists[file_win][where[file_win]]; + filefound = true; + selected_file_result = true; + } + return selected_file_result; } void filesparse(string r) -{; - switch (r[1]) { - case creturn: if (selected_file()) return; break; - case '\0': switch (r[2]) { - case cup: if (where[3]-top[3]>0) /* Up */ - movehl1(3,-1); /* Within range */ - else if (top[3]>1) - {; /* Outside range- must scroll */ - highlight(3,1); - top[3] -= 1; where[3] -= 1; - fileblit(1,59,166,176,-1,80); - setfillstyle(1,1); bar( 15,85,480,95); - show_file( 19,87,where[3]); - highlight(3,1); - } - break; - case cdown: if (where[3]-top[3]<8) /* Down */ - movehl1(3,1); - else if (top[3]+8 0) /* Up */ + movehl1(3, -1); /* Within range */ + else if (top[3] > 1) { + ; /* Outside range- must scroll */ + highlight(3, 1); + top[3] -= 1; + where[3] -= 1; + fileblit(1, 59, 166, 176, -1, 80); + setfillstyle(1, 1); + bar(15, 85, 480, 95); + show_file(19, 87, where[3]); + highlight(3, 1); + } + break; + case cdown: + if (where[3] - top[3] < 8) /* Down */ + movehl1(3, 1); + else if (top[3] + 8 < nums[3]) { + ; + highlight(3, 9); + top[3] += 1; + where[3] += 1; + fileblit(1, 59, 97, 87, 1, 80); + setfillstyle(1, 1); + bar(15, 165, 480, 175); + show_file(19, 167, where[3]); + highlight(3, 9); + } + break; + case c_ai: + fileinfo(where[3]); + break; /* alt-I: information. */ + case c_ah: + case c_f1: + filer_help(); + break; /* alt-I: information. */ + case chome: + gotohome(3); + break; + case cend: + gotoend(3); + break; + case cpgup: + pageup(3); + break; + case cpgdn: + pagedown(3); + break; + case c_ao: + if (selected_file()) return; + break; + } + break; + default: + seekthrough(3, where[3], lowchar(r[1])); + } } string playaround(); -static void changewin(byte i) -{; - switch (nowwin) { - case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; - } - setcolor(3); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} - nowwin=i; - if (nowwin<1) nowwin=4; if (nowwin>4) nowwin=1; - switch (nowwin) { - case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; - } -} - -string playaround() -{ - char r,r2; -string playaround_result; -; - filefound=false; dawn(); - - do { - setcolor(14); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} - r=readkey(); - switch (r) { - case ctab: changewin(nowwin+1); break; - case cescape: {; - playaround_result=""; - return playaround_result; - } - break; - case '\0': {; /* parse extd keystroke */ - r2=readkey(); - switch (r2) { - case cs_tab: changewin(nowwin-1); break; - case c_an: changewin(1); break; - case c_ad: changewin(2); break; - case c_af: changewin(3); break; - case c_as: changewin(4); break; - case c_ac: {; - playaround_result=""; - return playaround_result; - } - break; - default: - switch (nowwin) { - case 3: filesparse(string('\0')+r2); break; - case 4: subdirparse(string('\0')+r2); break; - } - } - } - break; - default: - {; /* Pass keystroke to current window */ - switch (nowwin) { - case 2: changedrive(upcase(r)); break; - case 4: subdirparse(r); break; - case 3: filesparse(r); break; - default: blip(); - } - } - - } - - if (filefound) - {; - dusk(); - playaround_result=filename; - return playaround_result; - } - } while (!false); -return playaround_result; -} - -void do_filer() -{ - pathstr p; -void do_filer_result; -; - loading=true; - setup(); - scandir(); - show(); show_drives(); - p=playaround(); - if (p!="") p=fexpand(p+".ASG"); - do_filer_result=p; -return do_filer_result; -} - -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - filename=do_filer(); - closegraph(); - if (filename=="") - output << "*** CANCELLED! ***" << NL; - else - output << "Selected: " << filename << NL; - input >> NL; -return EXIT_SUCCESS; +static void changewin(byte i) { + ; + switch (nowwin) { + case 3: + case 4: + highlight(nowwin, where[nowwin] - top[nowwin] + 1); + break; + } + setcolor(3); + { + windowtype &with = threewins[nowwin]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + nowwin = i; + if (nowwin < 1) nowwin = 4; + if (nowwin > 4) nowwin = 1; + switch (nowwin) { + case 3: + case 4: + highlight(nowwin, where[nowwin] - top[nowwin] + 1); + break; + } +} + +string playaround() { + char r, r2; + string playaround_result; + ; + filefound = false; + dawn(); + + do { + setcolor(14); + { + windowtype &with = threewins[nowwin]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + r = readkey(); + switch (r) { + case ctab: + changewin(nowwin + 1); + break; + case cescape: { + ; + playaround_result = ""; + return playaround_result; + } + break; + case '\0': { + ; /* parse extd keystroke */ + r2 = readkey(); + switch (r2) { + case cs_tab: + changewin(nowwin - 1); + break; + case c_an: + changewin(1); + break; + case c_ad: + changewin(2); + break; + case c_af: + changewin(3); + break; + case c_as: + changewin(4); + break; + case c_ac: { + ; + playaround_result = ""; + return playaround_result; + } + break; + default: + switch (nowwin) { + case 3: + filesparse(string('\0') + r2); + break; + case 4: + subdirparse(string('\0') + r2); + break; + } + } + } + break; + default: { + ; /* Pass keystroke to current window */ + switch (nowwin) { + case 2: + changedrive(upcase(r)); + break; + case 4: + subdirparse(r); + break; + case 3: + filesparse(r); + break; + default: + blip(); + } + } + + } + + if (filefound) { + ; + dusk(); + playaround_result = filename; + return playaround_result; + } + } while (!false); + return playaround_result; +} + +void do_filer() { + pathstr p; + void do_filer_result; + ; + loading = true; + setup(); + scandir(); + show(); + show_drives(); + p = playaround(); + if (p != "") p = fexpand(p + ".ASG"); + do_filer_result = p; + return do_filer_result; +} + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + filename = do_filer(); + closegraph(); + if (filename == "") + output << "*** CANCELLED! ***" << NL; + else + output << "Selected: " << filename << NL; + input >> NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index 00c19ede686d..6b1c9b196baa 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -26,7 +26,7 @@ */ #define __fileunit_implementation__ - /* v:filer.pas - "avvyfiler" - in unit form. */ +/* v:filer.pas - "avvyfiler" - in unit form. */ #include "fileunit.h" @@ -44,24 +44,26 @@ namespace Avalanche { struct windowtype { - integer x1,y1,x2,y2; - varying_string<20> title; + integer x1, y1, x2, y2; + varying_string<20> title; }; const integer border = 1; /* size of border on shadowboxes */ -const array<1,4,string> buttons = {{"Okay","Wipe","Cancel","Info..."}}; +const array<1, 4, string> buttons = {{"Okay", "Wipe", "Cancel", "Info..."}}; const integer files = 3; const integer dirs = 4; const integer drlen = 15; /* no. of drives on one line */ -const array<1,4,windowtype> threewins = - {{{155, 12, 630, 22, "Name"}, - {15, 25, 410, 70, "Drives"}, - {15, 83, 480, 179, "Files (*.ASG)"}, - {490, 83, 630, 179, "Subdirectories"}}}; +const array<1, 4, windowtype> threewins = { + { {155, 12, 630, 22, "Name"}, + {15, 25, 410, 70, "Drives"}, + {15, 83, 480, 179, "Files (*.ASG)"}, + {490, 83, 630, 179, "Subdirectories"} + } +}; const integer name_win = 1; const integer drive_win = 2; @@ -70,9 +72,9 @@ const integer subdir_win = 4; const integer filer_page = 3; -matrix<3,4,1,77,varying_string<12> > lists; -array<1,77,varying_string<40> > descs; -array<3,4,byte> nums,where,top,thumb_pos,thumb_len; +matrix<3, 4, 1, 77, varying_string<12> > lists; +array<1, 77, varying_string<40> > descs; +array<3, 4, byte> nums, where, top, thumb_pos, thumb_len; searchrec s; boolean loading; varying_string<26> drives; @@ -84,1062 +86,1219 @@ boolean filefound; boolean cancelled; -void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) -{ - byte fv; - - for( fv=0; fv <= border; fv ++) - { - setfillstyle(1,hc); - bar(x1+fv,y1+fv,x1+fv,y2-fv); - bar(x1+fv,y1+fv,x2-fv,y1+fv); - - setfillstyle(1,sc); - bar(x2-fv,y1+fv,x2-fv,y2-fv); - bar(x1+fv,y2-fv,x2-fv,y2-fv); - } +void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { + byte fv; + + for (fv = 0; fv <= border; fv ++) { + setfillstyle(1, hc); + bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); + bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); + + setfillstyle(1, sc); + bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); + bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); + } } -void shbox(integer x1,integer y1,integer x2,integer y2, string t) -{ - const integer fc = 7; - - shadow(x1,y1,x2,y2,15,8); - setfillstyle(1,fc); - bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); - setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; - outtextxy(x1,y1,t); - if ((t[1]!='[') && (length(t)>1)) - { - fillchar(t[2],length(t)-1,'\40'); t[1]='_'; - outtextxy(x1-1,y1+1,t); - } +void shbox(integer x1, integer y1, integer x2, integer y2, string t) { + const integer fc = 7; + + shadow(x1, y1, x2, y2, 15, 8); + setfillstyle(1, fc); + bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); + setcolor(1); + x1 = (x2 - x1) / 2 + x1; + y1 = (y2 - y1) / 2 + y1; + outtextxy(x1, y1, t); + if ((t[1] != '[') && (length(t) > 1)) { + fillchar(t[2], length(t) - 1, '\40'); + t[1] = '_'; + outtextxy(x1 - 1, y1 + 1, t); + } } -void show_drives() -{ - byte fv; - - settextjustify(1,1); - for( fv=0; fv <= length(drives)-1; fv ++) - shbox((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,drives[fv+1]); - setcolor(11); - settextjustify(0,2); +void show_drives() { + byte fv; + + settextjustify(1, 1); + for (fv = 0; fv <= length(drives) - 1; fv ++) + shbox((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, drives[fv + 1]); + setcolor(11); + settextjustify(0, 2); } -char which_drive(integer x,integer y) -{ - char which_drive_result; - x=(x-25) / 25; y=(y-32) / 19; +char which_drive(integer x, integer y) { + char which_drive_result; + x = (x - 25) / 25; + y = (y - 32) / 19; - which_drive_result= drives[1+x+y*drlen]; - return which_drive_result; + which_drive_result = drives[1 + x + y * drlen]; + return which_drive_result; } -void box(integer x1,integer y1,integer x2,integer y2, string z) -{ - rectangle(x1,y1,x2,y2); - outtextxy(x1+1,y1-10,z+':'); - outtextxy(x1,y1-9,"_"); +void box(integer x1, integer y1, integer x2, integer y2, string z) { + rectangle(x1, y1, x2, y2); + outtextxy(x1 + 1, y1 - 10, z + ':'); + outtextxy(x1, y1 - 9, "_"); } -string lowstr(string x) -{ - byte fv; +string lowstr(string x) { + byte fv; - string lowstr_result; - for( fv=1; fv <= length(x); fv ++) - if (set::of(range('A','Z'), eos).has(x[fv])) x[fv] += 32; - lowstr_result=x; - return lowstr_result; + string lowstr_result; + for (fv = 1; fv <= length(x); fv ++) + if (set::of(range('A', 'Z'), eos).has(x[fv])) x[fv] += 32; + lowstr_result = x; + return lowstr_result; } -char lowchar(char x) -{ - char lowchar_result; - if (set::of(range('A','Z'), eos).has(x)) x -= 32; - lowchar_result=x; - return lowchar_result; +char lowchar(char x) { + char lowchar_result; + if (set::of(range('A', 'Z'), eos).has(x)) x -= 32; + lowchar_result = x; + return lowchar_result; } -void getcurrent() -{ - current=lowstr(fexpand("*.asg")); +void getcurrent() { + current = lowstr(fexpand("*.asg")); } -void firstsetup() -{ - integer gd,gm; - registers r; - byte floppies; - - /* Now... find all drives that exist. */ - drives=""; - intr(0x11,r); floppies=(((cardinal)r.ax >> 6) & 0x3)+1; /* useful bit of code! */ - for( gm=1; gm <= floppies; gm ++) drives=drives+chr(64+gm); - /* Winchesters, etc., can be found the easy way... */ - for( gd=3; gd <= 26; gd ++) /* C: to Z: */ - if (disksize(gd)>-1) drives=drives+chr(64+gd); - - fillchar(where,sizeof(where),'\1'); - fillchar(top,sizeof(top),'\1'); - - /* Set up mouse. */ - off_virtual(); - oncandopageswap=false; - newpointer(2); +void firstsetup() { + integer gd, gm; + registers r; + byte floppies; + + /* Now... find all drives that exist. */ + drives = ""; + intr(0x11, r); + floppies = (((cardinal)r.ax >> 6) & 0x3) + 1; /* useful bit of code! */ + for (gm = 1; gm <= floppies; gm ++) drives = drives + chr(64 + gm); + /* Winchesters, etc., can be found the easy way... */ + for (gd = 3; gd <= 26; gd ++) /* C: to Z: */ + if (disksize(gd) > -1) drives = drives + chr(64 + gd); + + fillchar(where, sizeof(where), '\1'); + fillchar(top, sizeof(top), '\1'); + + /* Set up mouse. */ + off_virtual(); + oncandopageswap = false; + newpointer(2); } -void draw_scroll_bar(byte which) -{ - setcolor(1); - { - windowtype& with = threewins[which]; - - setfillstyle(1,7); - bar(with.x2-7,with.y1+10,with.x2-1,with.y2-10); - setfillstyle(1,3); - bar(with.x2-7,with.y1+ 1,with.x2-1,with.y1+9); - bar(with.x2-7,with.y2- 9,with.x2-1,with.y2-1); - outtextxy(with.x2-7,with.y1+2,"\30"); - outtextxy(with.x2-7,with.y2-8,"\31"); - } +void draw_scroll_bar(byte which) { + setcolor(1); + { + windowtype &with = threewins[which]; + + setfillstyle(1, 7); + bar(with.x2 - 7, with.y1 + 10, with.x2 - 1, with.y2 - 10); + setfillstyle(1, 3); + bar(with.x2 - 7, with.y1 + 1, with.x2 - 1, with.y1 + 9); + bar(with.x2 - 7, with.y2 - 9, with.x2 - 1, with.y2 - 1); + outtextxy(with.x2 - 7, with.y1 + 2, "\30"); + outtextxy(with.x2 - 7, with.y2 - 8, "\31"); + } } -void setup() -{ - integer gd,gm; - registers r; - byte floppies; - - setactivepage(filer_page); setvisualpage(filer_page); - setfillstyle(1,1); bar(2,2,637,197); shadow(0,0,639,199,15,7); - - settextstyle(0,0,0); - settextjustify(1,1); - for( gd=1; gd <= 2; gd ++) - for( gm=0; gm <= 1; gm ++) - shbox(420+gm*110,gd*25,520+gm*110,gd*25+20,buttons[gm*2+gd]); - shbox(15,182,350,196,"Help... (press f1)"); - settextjustify(0,2); setcolor(11); - setcolor(15); outtextxy(15,5,"The Avvy Filer..."); - setcolor(11); outtextxy(317,3,"Select a file to load."); - outtextxy(357,185,"Copyright (c) 1993, Thomas Thurman."); - - /* Draw the boxes and names */ - setcolor(3); - for( gm=1; gm <= 4; gm ++) - { windowtype& with = threewins[gm]; - box(with.x1,with.y1,with.x2,with.y2,with.title);} - - /* Draw the scroll bars. */ - - for( gm=3; gm <= 4; gm ++) draw_scroll_bar(gm); +void setup() { + integer gd, gm; + registers r; + byte floppies; + + setactivepage(filer_page); + setvisualpage(filer_page); + setfillstyle(1, 1); + bar(2, 2, 637, 197); + shadow(0, 0, 639, 199, 15, 7); + + settextstyle(0, 0, 0); + settextjustify(1, 1); + for (gd = 1; gd <= 2; gd ++) + for (gm = 0; gm <= 1; gm ++) + shbox(420 + gm * 110, gd * 25, 520 + gm * 110, gd * 25 + 20, buttons[gm * 2 + gd]); + shbox(15, 182, 350, 196, "Help... (press f1)"); + settextjustify(0, 2); + setcolor(11); + setcolor(15); + outtextxy(15, 5, "The Avvy Filer..."); + setcolor(11); + outtextxy(317, 3, "Select a file to load."); + outtextxy(357, 185, "Copyright (c) 1993, Thomas Thurman."); + + /* Draw the boxes and names */ + setcolor(3); + for (gm = 1; gm <= 4; gm ++) { + windowtype &with = threewins[gm]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + + /* Draw the scroll bars. */ + + for (gm = 3; gm <= 4; gm ++) draw_scroll_bar(gm); } -void thumb(byte whichwin) -{ - word length,the_top; - - if (nums[whichwin]<9) - { - length=76; - the_top=0; - } else - { - length=trunc(76*((real)(8)/nums[whichwin])); - the_top=trunc(((real)(where[whichwin])/nums[whichwin])*(76-length)); - } - - the_top += 93; /* Top of both the scrollbars. */ - - setfillstyle(1,7); - { windowtype& with = threewins[whichwin]; - bar(with.x2-6,thumb_pos[whichwin],with.x2-3,thumb_pos[whichwin]+length);} - setfillstyle(1,1); - { windowtype& with = threewins[whichwin]; - bar(with.x2-6,the_top,with.x2-3,the_top+length);} - - thumb_pos[whichwin]=the_top; - thumb_len[whichwin]=length; +void thumb(byte whichwin) { + word length, the_top; + + if (nums[whichwin] < 9) { + length = 76; + the_top = 0; + } else { + length = trunc(76 * ((real)(8) / nums[whichwin])); + the_top = trunc(((real)(where[whichwin]) / nums[whichwin]) * (76 - length)); + } + + the_top += 93; /* Top of both the scrollbars. */ + + setfillstyle(1, 7); + { + windowtype &with = threewins[whichwin]; + bar(with.x2 - 6, thumb_pos[whichwin], with.x2 - 3, thumb_pos[whichwin] + length); + } + setfillstyle(1, 1); + { + windowtype &with = threewins[whichwin]; + bar(with.x2 - 6, the_top, with.x2 - 3, the_top + length); + } + + thumb_pos[whichwin] = the_top; + thumb_len[whichwin] = length; } void quicksort(byte whichlist, integer lo, integer hi); -static void sort(integer l, integer r, byte& whichlist) -{ - integer i, j; - varying_string<12> x, y; - varying_string<40> d; - - i = l; j = r; x = lists[whichlist][(l+r) / 2]; - do { - while (lists[whichlist][i] < x) i = i + 1; - while (x < lists[whichlist][j]) j = j - 1; - if (i <= j) - { - y = lists[whichlist][i]; - lists[whichlist][i] = lists[whichlist][j]; - lists[whichlist][j] = y; - - d = descs[i]; - descs[i] = descs[j]; - descs[j] = d; - - i = i + 1; j = j - 1; - } - } while (!(i > j)); - -/* if j<1 then j:=1; - if r<1 then r:=1;*/ - - if (l < j) sort(l, j, whichlist); - if (i < r) sort(i, r, whichlist); +static void sort(integer l, integer r, byte &whichlist) { + integer i, j; + varying_string<12> x, y; + varying_string<40> d; + + i = l; + j = r; + x = lists[whichlist][(l + r) / 2]; + do { + while (lists[whichlist][i] < x) i = i + 1; + while (x < lists[whichlist][j]) j = j - 1; + if (i <= j) { + y = lists[whichlist][i]; + lists[whichlist][i] = lists[whichlist][j]; + lists[whichlist][j] = y; + + d = descs[i]; + descs[i] = descs[j]; + descs[j] = d; + + i = i + 1; + j = j - 1; + } + } while (!(i > j)); + + /* if j<1 then j:=1; + if r<1 then r:=1;*/ + + if (l < j) sort(l, j, whichlist); + if (i < r) sort(i, r, whichlist); } void quicksort(byte whichlist, integer lo, integer hi) -{ /*QuickSort*/; - sort(lo,hi, whichlist); +{ + /*QuickSort*/; + sort(lo, hi, whichlist); } -void scandir() -{ - pathstr nix; - namestr name; - untyped_file f; - ednahead eh; - array<1,4,char> dna_type; - - - nums[files]=0; - findfirst("*.asg",archive+hidden+readonly,s); - - while ((doserror==0) && (nums[files]<77)) - { - fsplit(s.name,nix,name,nix); - nums[files] += 1; - lists[files][nums[files]]=lowstr(name); - - assign(f,s.name); - reset(f,1); - seek(f,11); - blockread(f,dna_type,4); - - if (dna_type=="Avvy") - { /* A DNA256 file. */ - descs[nums[files]]="* Saved by Avaricius!"; - } else - { /* EDNA-based files. */ - if (dna_type=="EDNA") - { - seek(f,177); - blockread(f,eh,sizeof(eh)); - - if (eh.revision!=2) - descs[nums[files]]="* Unknown EDNA type!"; - else - { - - if (eh.number!=2) - descs[nums[files]]=string("% Saved by ")+eh.shortname+'!'; - else - { /* Well... everything seems to have gone OK! */ - descs[nums[files]]=eh.desc; - } - } - } else - descs[nums[files]]="* Not an Avvy saved game!"; - } - close(f); - findnext(s); - } - nums[dirs]=0; findfirst("*.*",directory,s); - while ((doserror==0) && (nums[dirs]<77)) - { - if (((s.attr & directory)>0) && ((length(s.name))>1)) - { - nums[dirs] += 1; - lists[dirs][nums[dirs]]=lowstr(s.name); - } - findnext(s); - } - - /* Now sort 'em! */ - - if (nums[dirs ]!=0) quicksort ( dirs,1,nums[ dirs]); - if (nums[files]!=0) quicksort (files,1,nums[files]); - - where[dirs]=1; where[files]=1; - top[dirs]=1; top[files]=1; - - thumb_pos[3]=93; thumb_pos[4]=93; +void scandir() { + pathstr nix; + namestr name; + untyped_file f; + ednahead eh; + array<1, 4, char> dna_type; + + + nums[files] = 0; + findfirst("*.asg", archive + hidden + readonly, s); + + while ((doserror == 0) && (nums[files] < 77)) { + fsplit(s.name, nix, name, nix); + nums[files] += 1; + lists[files][nums[files]] = lowstr(name); + + assign(f, s.name); + reset(f, 1); + seek(f, 11); + blockread(f, dna_type, 4); + + if (dna_type == "Avvy") { + /* A DNA256 file. */ + descs[nums[files]] = "* Saved by Avaricius!"; + } else { + /* EDNA-based files. */ + if (dna_type == "EDNA") { + seek(f, 177); + blockread(f, eh, sizeof(eh)); + + if (eh.revision != 2) + descs[nums[files]] = "* Unknown EDNA type!"; + else { + + if (eh.number != 2) + descs[nums[files]] = string("% Saved by ") + eh.shortname + '!'; + else { + /* Well... everything seems to have gone OK! */ + descs[nums[files]] = eh.desc; + } + } + } else + descs[nums[files]] = "* Not an Avvy saved game!"; + } + close(f); + findnext(s); + } + nums[dirs] = 0; + findfirst("*.*", directory, s); + while ((doserror == 0) && (nums[dirs] < 77)) { + if (((s.attr & directory) > 0) && ((length(s.name)) > 1)) { + nums[dirs] += 1; + lists[dirs][nums[dirs]] = lowstr(s.name); + } + findnext(s); + } + + /* Now sort 'em! */ + + if (nums[dirs ] != 0) quicksort(dirs, 1, nums[ dirs]); + if (nums[files] != 0) quicksort(files, 1, nums[files]); + + where[dirs] = 1; + where[files] = 1; + top[dirs] = 1; + top[files] = 1; + + thumb_pos[3] = 93; + thumb_pos[4] = 93; } -void show_file(integer x,integer y, byte which) -{ - varying_string<58> z; +void show_file(integer x, integer y, byte which) { + varying_string<58> z; - fillchar(z[1],13,'\40'); - z=lists[files][which]+".asg"; - z[0]='\15'; z=z+descs[which]; + fillchar(z[1], 13, '\40'); + z = lists[files][which] + ".asg"; + z[0] = '\15'; + z = z + descs[which]; - if (set::of('*','%', eos).has(descs[which][1])) /* Can't load these! */ - setcolor(red); - else - setcolor(lightcyan); + if (set::of('*', '%', eos).has(descs[which][1])) /* Can't load these! */ + setcolor(red); + else + setcolor(lightcyan); - outtextxy(x,y,z); + outtextxy(x, y, z); } -void showfiles() -{ - byte fv; - - if (loading) setcolor(11); else setcolor(3); - if (nums[3]==0) - { - outtextxy(22,86,"(None here!)"); - return; - } - for( fv=0; fv <= 8; fv ++) - if (top[3]+fv<=nums[3]) - show_file(19,87+fv*10,top[3]+fv); - - draw_scroll_bar(files); +void showfiles() { + byte fv; + + if (loading) setcolor(11); + else setcolor(3); + if (nums[3] == 0) { + outtextxy(22, 86, "(None here!)"); + return; + } + for (fv = 0; fv <= 8; fv ++) + if (top[3] + fv <= nums[3]) + show_file(19, 87 + fv * 10, top[3] + fv); + + draw_scroll_bar(files); } -void showdirs() -{ - byte fv; +void showdirs() { + byte fv; - setcolor(11); - for( fv=0; fv <= 8; fv ++) - if (top[4]+fv<=nums[4]) - outtextxy(497,87+fv*10,string('[')+lists[dirs][fv+top[4]]+']'); - draw_scroll_bar(dirs); + setcolor(11); + for (fv = 0; fv <= 8; fv ++) + if (top[4] + fv <= nums[4]) + outtextxy(497, 87 + fv * 10, string('[') + lists[dirs][fv + top[4]] + ']'); + draw_scroll_bar(dirs); } -void show() -{ - byte fv; - dirstr d; namestr n; extstr e; - - setfillstyle(1,1); - for( fv=1; fv <= 4; fv ++) - if (fv!=2) - { windowtype& with = threewins[fv]; - bar(with.x1+1,with.y1+1,with.x2-8,with.y2-1);} - showfiles(); - showdirs(); - setcolor(7); outtextxy(159,14,current); - for( fv=3; fv <= 4; fv ++) thumb(fv); +void show() { + byte fv; + dirstr d; + namestr n; + extstr e; + + setfillstyle(1, 1); + for (fv = 1; fv <= 4; fv ++) + if (fv != 2) { + windowtype &with = threewins[fv]; + bar(with.x1 + 1, with.y1 + 1, with.x2 - 8, with.y2 - 1); + } + showfiles(); + showdirs(); + setcolor(7); + outtextxy(159, 14, current); + for (fv = 3; fv <= 4; fv ++) thumb(fv); } -void blip() -{ - sound(177); delay(77); nosound; +void blip() { + sound(177); + delay(77); + nosound; } -void invert(integer x1,integer y1,integer x2,integer y2) -{ - pointer p,restore; word s; +void invert(integer x1, integer y1, integer x2, integer y2) { + pointer p, restore; + word s; - s=imagesize(x1,y1,x2,y2); - mark(restore); getmem(p,s); - getimage(x1,y1,x2,y2,p); - putimage(x1,y1,p,notput); - release(restore); + s = imagesize(x1, y1, x2, y2); + mark(restore); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + putimage(x1, y1, p, notput); + release(restore); } -void changedrive(char drive) -{ - byte fv; - - fv=pos(drive,drives); - if (fv==0) { blip(); return; } - off(); - fv -= 1; - shadow((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,8,7); - chdir(string(drive)+':'); - getcurrent(); scandir(); show(); - shadow((fv % drlen)*25+25,(fv / drlen)*19+31, - (fv % drlen)*25+40,45+(fv / drlen)*19,15,8); - on(); +void changedrive(char drive) { + byte fv; + + fv = pos(drive, drives); + if (fv == 0) { + blip(); + return; + } + off(); + fv -= 1; + shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 8, 7); + chdir(string(drive) + ':'); + getcurrent(); + scandir(); + show(); + shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, + (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 15, 8); + on(); } -void highlight(byte win,byte line) -{ - switch (win) { - case 3: invert(16,75+line*10,470,85+line*10); break; - case 4: invert(491,75+line*10,620,85+line*10); break; - } - thumb(win); +void highlight(byte win, byte line) { + switch (win) { + case 3: + invert(16, 75 + line * 10, 470, 85 + line * 10); + break; + case 4: + invert(491, 75 + line * 10, 620, 85 + line * 10); + break; + } + thumb(win); } -void repaint(byte whichwindow) -{ - setfillstyle(1,1); - { windowtype& with = threewins[whichwindow]; - bar(with.x1+1,with.y1+1,with.x2-8,with.y2-1);} - top[whichwindow]=where[whichwindow]; - switch (whichwindow) { - case file_win: showfiles(); break; - case subdir_win: showdirs(); break; - } - thumb(whichwindow); +void repaint(byte whichwindow) { + setfillstyle(1, 1); + { + windowtype &with = threewins[whichwindow]; + bar(with.x1 + 1, with.y1 + 1, with.x2 - 8, with.y2 - 1); + } + top[whichwindow] = where[whichwindow]; + switch (whichwindow) { + case file_win: + showfiles(); + break; + case subdir_win: + showdirs(); + break; + } + thumb(whichwindow); } -void fileblit(word xpos,word xlen,word y1,word y2, shortint dir, word ylen) -{ - word fv; byte bit; - - for( bit=0; bit <= 3; bit ++) - { - fv=0; - while (fvnums[whichlist]) wherenow=1; - } while (!((startedat==wherenow) || (lists[whichlist][wherenow][1]==whatfor))); - off(); - repaint(whichlist); - on(); +void seekthrough(byte whichlist, byte &wherenow, char whatfor) { + byte startedat; + + startedat = wherenow; + do { + wherenow += 1; + if (wherenow > nums[whichlist]) wherenow = 1; + } while (!((startedat == wherenow) || (lists[whichlist][wherenow][1] == whatfor))); + off(); + repaint(whichlist); + on(); } -void gotohome(byte whichlist) -{ - off(); - where[whichlist]=1; - repaint(whichlist); - highlight(whichlist,1); - on(); +void gotohome(byte whichlist) { + off(); + where[whichlist] = 1; + repaint(whichlist); + highlight(whichlist, 1); + on(); } -void gotoend(byte whichlist) -{ - off(); - where[whichlist]=nums[whichlist]; - repaint(whichlist); - highlight(whichlist,1); - on(); +void gotoend(byte whichlist) { + off(); + where[whichlist] = nums[whichlist]; + repaint(whichlist); + highlight(whichlist, 1); + on(); } -void pageup(byte whichlist) -{ - off(); - if (where[whichlist]>9) - { - where[whichlist] -= 9; - repaint(whichlist); - highlight(whichlist,1); - } else gotohome(whichlist); - on(); +void pageup(byte whichlist) { + off(); + if (where[whichlist] > 9) { + where[whichlist] -= 9; + repaint(whichlist); + highlight(whichlist, 1); + } else gotohome(whichlist); + on(); } -void pagedown(byte whichlist) -{ - off(); - if (where[whichlist]0) && ((where[which]+howmuch)<=(unsigned char)nums[4])) - where[which]=where[which]+howmuch; - highlight(4,where[4]-top[4]+1); - on(); +static void movehl(byte which, shortint howmuch) { + off(); + highlight(4, where[4] - top[4] + 1); + if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[4])) + where[which] = where[which] + howmuch; + highlight(4, where[4] - top[4] + 1); + on(); } -static void change_dir() -{ - off(); dusk(); - /*$I-*/ chdir(lists[4][where[4]]); - /*$I+*/ - if (ioresult!=0) { dawn(); blip(); return; } - where[4]=1; top[4]=1; - getcurrent(); scandir(); show(); - highlight(4,1); - dawn(); on(); +static void change_dir() { + off(); + dusk(); + /*$I-*/ chdir(lists[4][where[4]]); + /*$I+*/ + if (ioresult != 0) { + dawn(); + blip(); + return; + } + where[4] = 1; + top[4] = 1; + getcurrent(); + scandir(); + show(); + highlight(4, 1); + dawn(); + on(); } void subdirparse(string r) { - switch (r[1]) { - case creturn: change_dir(); break; - - case '\0': switch (r[2]) { - case cup: if (where[4]-top[4]>0) /* Up */ - movehl(4,-1); /* Within range */ - else if (top[4]>1) - { /* Outside range- must scroll */ - off(); - highlight(4,1); - top[4] -= 1; where[4] -= 1; - fileblit(61,17,166,176,-1,80); - setfillstyle(1,1); bar(490,85,622,95); setcolor(11); - outtextxy(497,87,string('[')+lists[dirs][where[4]]+']'); - highlight(4,1); - on(); - } - break; - case cdown: - if (where[4]-top[4]<8) /* Down */ - movehl(4,1); - else if (top[4]+8 0) /* Up */ + movehl(4, -1); /* Within range */ + else if (top[4] > 1) { + /* Outside range- must scroll */ + off(); + highlight(4, 1); + top[4] -= 1; + where[4] -= 1; + fileblit(61, 17, 166, 176, -1, 80); + setfillstyle(1, 1); + bar(490, 85, 622, 95); + setcolor(11); + outtextxy(497, 87, string('[') + lists[dirs][where[4]] + ']'); + highlight(4, 1); + on(); + } + break; + case cdown: + if (where[4] - top[4] < 8) /* Down */ + movehl(4, 1); + else if (top[4] + 8 < nums[4]) { + off(); + highlight(4, 9); + top[4] += 1; + where[4] += 1; + fileblit(60, 17, 97, 87, 1, 80); + setfillstyle(1, 1); + bar(490, 165, 622, 175); + setcolor(11); + outtextxy(497, 167, string('[') + lists[dirs][where[4]] + ']'); + highlight(4, 9); + on(); + } + break; + case chome: + gotohome(4); + break; + case cend: + gotoend(4); + break; + case cpgup: + pageup(4); + break; + case cpgdn: + pagedown(4); + break; + case c_ao: + change_dir(); + break; + } + break; + default: { + off(); + seekthrough(4, where[4], lowchar(r[1])); + highlight(4, 1); + on(); + } + } } -void fileinfo(byte which); -void filer_help(); -void wipe(byte which); - -void in_name_box(string x) -{ - off(); - setfillstyle(1,1); bar(156,13,629,21); - setcolor(7); outtextxy(159,14,x); - on(); +void fileinfo(byte which); +void filer_help(); +void wipe(byte which); + +void in_name_box(string x) { + off(); + setfillstyle(1, 1); + bar(156, 13, 629, 21); + setcolor(7); + outtextxy(159, 14, x); + on(); } void filesparse(string r); -static void movehl1(byte which, shortint howmuch) -{ - off(); - highlight(3,where[3]-top[3]+1); - if (((where[which]+howmuch)>0) && ((where[which]+howmuch)<=(unsigned char)nums[3])) - where[which]=where[which]+howmuch; - highlight(3,where[3]-top[3]+1); - on(); +static void movehl1(byte which, shortint howmuch) { + off(); + highlight(3, where[3] - top[3] + 1); + if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[3])) + where[which] = where[which] + howmuch; + highlight(3, where[3] - top[3] + 1); + on(); } -static boolean selected_file() -{ - boolean selected_file_result; - if ((set::of('*','%', eos).has(descs[where[file_win]][1])) || (nums[3]==0)) - { - blip(); - selected_file_result=false; - } else - { - filename=lists[file_win][where[file_win]]; - filefound=true; - selected_file_result=true; - } - return selected_file_result; +static boolean selected_file() { + boolean selected_file_result; + if ((set::of('*', '%', eos).has(descs[where[file_win]][1])) || (nums[3] == 0)) { + blip(); + selected_file_result = false; + } else { + filename = lists[file_win][where[file_win]]; + filefound = true; + selected_file_result = true; + } + return selected_file_result; } void filesparse(string r) { - switch (r[1]) { - case creturn: if (selected_file()) return; break; - case '\0': switch (r[2]) { - case cup: if (where[3]-top[3]>0) /* Up */ - movehl1(3,-1); /* Within range */ - else if (top[3]>1) - { /* Outside range- must scroll */ - off(); - highlight(3,1); - top[3] -= 1; where[3] -= 1; - fileblit(1,58,166,176,-1,80); - setfillstyle(1,1); bar( 15,85,472,95); - show_file( 19,87,where[3]); - highlight(3,1); - on(); - } - break; - case cdown: if (where[3]-top[3]<8) /* Down */ - movehl1(3,1); - else if (top[3]+8 0) /* Up */ + movehl1(3, -1); /* Within range */ + else if (top[3] > 1) { + /* Outside range- must scroll */ + off(); + highlight(3, 1); + top[3] -= 1; + where[3] -= 1; + fileblit(1, 58, 166, 176, -1, 80); + setfillstyle(1, 1); + bar(15, 85, 472, 95); + show_file(19, 87, where[3]); + highlight(3, 1); + on(); + } + break; + case cdown: + if (where[3] - top[3] < 8) /* Down */ + movehl1(3, 1); + else if (top[3] + 8 < nums[3]) { + off(); + highlight(3, 9); + top[3] += 1; + where[3] += 1; + fileblit(1, 58, 97, 87, 1, 80); + setfillstyle(1, 1); + bar(15, 165, 472, 175); + show_file(19, 167, where[3]); + highlight(3, 9); + on(); + } + break; + case c_ai: + fileinfo(where[3]); + break; /* alt-I: information. */ + case c_aw: + wipe(where[3]); + break; /* alt-W: wipe. */ + case chome: + gotohome(3); + break; + case cend: + gotoend(3); + break; + case cpgup: + pageup(3); + break; + case cpgdn: + pagedown(3); + break; + case c_ao: + if (selected_file()) return; + break; + } + break; + default: { + off(); + seekthrough(3, where[3], lowchar(r[1])); + highlight(3, 1); + on(); + } + } + in_name_box(lists[files][where[3]] + ".asg"); } -void entername(char r) -{ - switch (r) { - case '\10': if (filename[0]!='\0') filename[0] -= 1; break; - case '\15': filefound=true; break; - case '\40':; break; /* ignore spaces. */ - default: - { - if (length(filename)<55) filename=filename+r; - - if (length(filename)==1) - { - where[3]=1; - seekthrough(3,where[3],filename[1]); - } - } - } - - in_name_box(filename+".asg"); +void entername(char r) { + switch (r) { + case '\10': + if (filename[0] != '\0') filename[0] -= 1; + break; + case '\15': + filefound = true; + break; + case '\40': + ; + break; /* ignore spaces. */ + default: { + if (length(filename) < 55) filename = filename + r; + + if (length(filename) == 1) { + where[3] = 1; + seekthrough(3, where[3], filename[1]); + } + } + } + + in_name_box(filename + ".asg"); } -void changewin(byte i) -{ - off(); - switch (nowwin) { - case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; - } - setcolor(3); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} - nowwin=i; - if (nowwin<1) nowwin=4; if (nowwin>4) nowwin=1; - switch (nowwin) { - case 3:case 4: highlight(nowwin,where[nowwin]-top[nowwin]+1); break; - } - on(); +void changewin(byte i) { + off(); + switch (nowwin) { + case 3: + case 4: + highlight(nowwin, where[nowwin] - top[nowwin] + 1); + break; + } + setcolor(3); + { + windowtype &with = threewins[nowwin]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + nowwin = i; + if (nowwin < 1) nowwin = 4; + if (nowwin > 4) nowwin = 1; + switch (nowwin) { + case 3: + case 4: + highlight(nowwin, where[nowwin] - top[nowwin] + 1); + break; + } + on(); } void checkmouse(); -static void relevant(string x) -{ - setcolor(14); off(); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} - on(); if (nowwin==3) filesparse(x); else subdirparse(x); +static void relevant(string x) { + setcolor(14); + off(); + { + windowtype &with = threewins[nowwin]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + on(); + if (nowwin == 3) filesparse(x); + else subdirparse(x); } -void checkmouse() -{ - byte fv,new,waswin; - - check(); - if (mrelease>0) - { /* Where did they click? */ - for( fv=1; fv <= 4; fv ++) - { windowtype& with = threewins[fv]; - if (((cardinal)with.x1<=mx) && ((cardinal)with.x2>=mx) && ((cardinal)with.y1<=my) && ((cardinal)with.y2>=my)) - { - waswin=nowwin; - - if (nowwin!=fv) - { - changewin(fv); - off(); - setcolor(14); { windowtype& with1 = threewins[nowwin]; box(with1.x1,with1.y1,with1.x2,with1.y2,with1.title);} - on(); - } - /* Now... individual windows should do their own checkclicking. */ - - switch (fv) { - /* 1: no effect. */ - case 2: changedrive(which_drive(mx,my)); break; /* Change drive w/mouse. */ - case 3:case 4: if (my<175) { /* Click on highlight users. */ - if (mx>(cardinal)threewins[nowwin].x2-9) - { /* Scroll bar. */ - if (my<(cardinal)threewins[nowwin].y1+10) - relevant(null+cup); /* scroll up */ - else if (my>(cardinal)threewins[nowwin].y2-10) - relevant(null+cdown); /* scroll down. */ - else if (my<(unsigned char)thumb_pos[nowwin]) - relevant(null+cpgup); /* above thumb-- page up. */ - else if (my>(unsigned char)thumb_pos[nowwin]+thumb_len[nowwin]) - relevant(null+cpgdn); /* above thumb-- page up. */ - else { /* On the thumb. */ - blip(); - } - } else - { - new=top[fv]+(my-75) / 10-1; - - if ((new==where[fv]) && (nowwin==waswin)) - { /* Double-clicked, --> "OK" */ - /* filefound:=true; - filename:=lists[fv,new];*/ - if (fv==3) filesparse("\15"); else subdirparse("\15"); - } else - { /* Single-clicked, --> move highlight */ - off(); - highlight(fv,where[fv]-top[fv]+1); - if ((new>0) && (new<=nums[fv])) - where[fv]=new; - highlight(fv,where[fv]-top[fv]+1); - on(); - } - } - } - break; - } - - return; /* Since they've clicked in a window... */ - }} - - /* Righto, they must have clicked on a button. Which? */ - - switch (my) { - case 25 ... 45: /* Top row: Okay, Cancel. */ - switch (mx) { - case 420 ... 520: switch (nowwin) { - case 1: entername('\15'); break; - case 3: filesparse("\15"); break; - case 4: subdirparse("\15"); break; - default: blip(); - } - break; - case 530 ... 630: cancelled=true; break; - } - break; - case 50 ... 95: /* Bottom row: Wipe, Info. */ - switch (mx) { - case 420 ... 520: if (nowwin==3) wipe(where[3]); else blip(); break; - case 530 ... 630: if (nowwin==3) fileinfo(where[3]); else blip(); break; - } - break; - case 180 ... 200: filer_help(); break; /* The "help" button. */ - } - } +void checkmouse() { + byte fv, new, waswin; + + check(); + if (mrelease > 0) { + /* Where did they click? */ + for (fv = 1; fv <= 4; fv ++) { + windowtype &with = threewins[fv]; + if (((cardinal)with.x1 <= mx) && ((cardinal)with.x2 >= mx) && ((cardinal)with.y1 <= my) && ((cardinal)with.y2 >= my)) { + waswin = nowwin; + + if (nowwin != fv) { + changewin(fv); + off(); + setcolor(14); + { + windowtype &with1 = threewins[nowwin]; + box(with1.x1, with1.y1, with1.x2, with1.y2, with1.title); + } + on(); + } + /* Now... individual windows should do their own checkclicking. */ + + switch (fv) { + /* 1: no effect. */ + case 2: + changedrive(which_drive(mx, my)); + break; /* Change drive w/mouse. */ + case 3: + case 4: + if (my < 175) { /* Click on highlight users. */ + if (mx > (cardinal)threewins[nowwin].x2 - 9) { + /* Scroll bar. */ + if (my < (cardinal)threewins[nowwin].y1 + 10) + relevant(null + cup); /* scroll up */ + else if (my > (cardinal)threewins[nowwin].y2 - 10) + relevant(null + cdown); /* scroll down. */ + else if (my < (unsigned char)thumb_pos[nowwin]) + relevant(null + cpgup); /* above thumb-- page up. */ + else if (my > (unsigned char)thumb_pos[nowwin] + thumb_len[nowwin]) + relevant(null + cpgdn); /* above thumb-- page up. */ + else { /* On the thumb. */ + blip(); + } + } else { + new = top[fv] + (my - 75) / 10 - 1; + + if ((new == where[fv]) && (nowwin == waswin)) { + /* Double-clicked, --> "OK" */ + /* filefound:=true; + filename:=lists[fv,new];*/ + if (fv == 3) filesparse("\15"); + else subdirparse("\15"); + } else { + /* Single-clicked, --> move highlight */ + off(); + highlight(fv, where[fv] - top[fv] + 1); + if ((new > 0) && (new <= nums[fv])) + where[fv] = new; + highlight(fv, where[fv] - top[fv] + 1); + on(); + } + } + } + break; + } + + return; /* Since they've clicked in a window... */ + } + } + + /* Righto, they must have clicked on a button. Which? */ + + switch (my) { + case 25 ... 45: /* Top row: Okay, Cancel. */ + switch (mx) { + case 420 ... 520: + switch (nowwin) { + case 1: + entername('\15'); + break; + case 3: + filesparse("\15"); + break; + case 4: + subdirparse("\15"); + break; + default: + blip(); + } + break; + case 530 ... 630: + cancelled = true; + break; + } + break; + case 50 ... 95: /* Bottom row: Wipe, Info. */ + switch (mx) { + case 420 ... 520: + if (nowwin == 3) wipe(where[3]); + else blip(); + break; + case 530 ... 630: + if (nowwin == 3) fileinfo(where[3]); + else blip(); + break; + } + break; + case 180 ... 200: + filer_help(); + break; /* The "help" button. */ + } + } } -string playaround() -{ - char r,r2; - - string playaround_result; - filefound=false; dawn(); - - do { - setcolor(14); off(); { windowtype& with = threewins[nowwin]; box(with.x1,with.y1,with.x2,with.y2,with.title);} on(); - do { checkmouse(); } while (!(keypressed() || filefound || cancelled)); - if (! (filefound || cancelled)) - { - r=readkey(); - switch (r) { - case ctab: changewin(nowwin+1); break; - case cescape: { - playaround_result=""; - return playaround_result; - } - break; - case '\0': { /* parse extd keystroke */ - r2=readkey(); - switch (r2) { - case cs_tab: changewin(nowwin-1); break; - case c_an: changewin(1); break; - case c_ad: changewin(2); break; - case c_af: changewin(3); break; - case c_as: changewin(4); break; - case c_ac: cancelled=false; break; - case c_ah:case cf1: filer_help(); break; /* alt-H: help. */ - default: - switch (nowwin) { - case 3: filesparse(string('\0')+r2); break; - case 4: subdirparse(string('\0')+r2); break; - } - } - } - break; - default: - { /* Pass keystroke to current window */ - switch (nowwin) { - case 1: entername(r); break; - case 2: changedrive(upcase(r)); break; - case 4: subdirparse(r); break; - case 3: filesparse(r); break; - default: blip(); - } - } - } - - } - - if (filefound) - { - dusk(); - playaround_result=filename; - return playaround_result; - } - - if (cancelled) - { - dusk(); - playaround_result=""; - return playaround_result; - } - } while (!false); - return playaround_result; +string playaround() { + char r, r2; + + string playaround_result; + filefound = false; + dawn(); + + do { + setcolor(14); + off(); + { + windowtype &with = threewins[nowwin]; + box(with.x1, with.y1, with.x2, with.y2, with.title); + } + on(); + do { + checkmouse(); + } while (!(keypressed() || filefound || cancelled)); + if (!(filefound || cancelled)) { + r = readkey(); + switch (r) { + case ctab: + changewin(nowwin + 1); + break; + case cescape: { + playaround_result = ""; + return playaround_result; + } + break; + case '\0': { /* parse extd keystroke */ + r2 = readkey(); + switch (r2) { + case cs_tab: + changewin(nowwin - 1); + break; + case c_an: + changewin(1); + break; + case c_ad: + changewin(2); + break; + case c_af: + changewin(3); + break; + case c_as: + changewin(4); + break; + case c_ac: + cancelled = false; + break; + case c_ah: + case cf1: + filer_help(); + break; /* alt-H: help. */ + default: + switch (nowwin) { + case 3: + filesparse(string('\0') + r2); + break; + case 4: + subdirparse(string('\0') + r2); + break; + } + } + } + break; + default: { + /* Pass keystroke to current window */ + switch (nowwin) { + case 1: + entername(r); + break; + case 2: + changedrive(upcase(r)); + break; + case 4: + subdirparse(r); + break; + case 3: + filesparse(r); + break; + default: + blip(); + } + } + } + + } + + if (filefound) { + dusk(); + playaround_result = filename; + return playaround_result; + } + + if (cancelled) { + dusk(); + playaround_result = ""; + return playaround_result; + } + } while (!false); + return playaround_result; } -void drawup() -{ - off(); - loading=true; - setup(); - show(); show_drives(); - on(); +void drawup() { + off(); + loading = true; + setup(); + show(); + show_drives(); + on(); } -void little_cls() -{ - setfillstyle(1,1); bar(2,2,637,197); /* Interesting information coming up! */ +void little_cls() { + setfillstyle(1, 1); + bar(2, 2, 637, 197); /* Interesting information coming up! */ } -void wait_for_keypress_or_mouse_click() -{ - char r; +void wait_for_keypress_or_mouse_click() { + char r; - do { check(); } while (!((mrelease>0) || keypressed())); - while (keypressed()) r=readkey(); + do { + check(); + } while (!((mrelease > 0) || keypressed())); + while (keypressed()) r = readkey(); } void fileinfo(byte which); -static void display(integer y, string left,string right) -{ - y=17+y*12; - settextjustify(2,1); setcolor(11); outtextxy(315,y,left); - settextjustify(0,1); setcolor(15); outtextxy(325,y,right); +static void display(integer y, string left, string right) { + y = 17 + y * 12; + settextjustify(2, 1); + setcolor(11); + outtextxy(315, y, left); + settextjustify(0, 1); + setcolor(15); + outtextxy(325, y, right); } void fileinfo(byte which) - /* This gives information on the file whose name is in lists[files,which]. */ +/* This gives information on the file whose name is in lists[files,which]. */ { - ednahead eh; - untyped_file f; - varying_string<4> os; + ednahead eh; + untyped_file f; + varying_string<4> os; - /* Firstly, we must check whether or not it's an Avalot file. This is easily - done, since the descriptions of all others always begin with a star. */ + /* Firstly, we must check whether or not it's an Avalot file. This is easily + done, since the descriptions of all others always begin with a star. */ - if ((descs[which][1]=='*') || (nums[3]==0)) - { /* it is. */ - blip(); /* Naaaarghh! */ - return; - } + if ((descs[which][1] == '*') || (nums[3] == 0)) { + /* it is. */ + blip(); /* Naaaarghh! */ + return; + } - /* Anyway... it wasn't. */ + /* Anyway... it wasn't. */ - assign(f,lists[files][which]+".asg"); - reset(f,1); - seek(f,177); - blockread(f,eh,sizeof(eh)); - close(f); + assign(f, lists[files][which] + ".asg"); + reset(f, 1); + seek(f, 177); + blockread(f, eh, sizeof(eh)); + close(f); - /* We now hold its EDNA record. */ + /* We now hold its EDNA record. */ - off(); - little_cls(); /* Interesting information coming up! */ + off(); + little_cls(); /* Interesting information coming up! */ - { - display(0,"File:",eh.fn); - display(1,"Description:",eh.desc); - display(2,"Saved by:", eh.game); - display(3,"version:", eh.verstr); + { + display(0, "File:", eh.fn); + display(1, "Description:", eh.desc); + display(2, "Saved by:", eh.game); + display(3, "version:", eh.verstr); - display(4,"under", eh.os); + display(4, "under", eh.os); - display(6,"Saved on:",strf(eh.d)+'-'+strf(eh.m)+'-'+strf(eh.y)); + display(6, "Saved on:", strf(eh.d) + '-' + strf(eh.m) + '-' + strf(eh.y)); - display(9,"No. of times saved:",strf(eh.saves)); + display(9, "No. of times saved:", strf(eh.saves)); - display(11,"Money:",eh.money); - display(12,"Score:",strf(eh.points)); - } + display(11, "Money:", eh.money); + display(12, "Score:", strf(eh.points)); + } - settextjustify(1,1); - shbox(400,177,600,195,"[Press any key...]"); - settextjustify(0,2); on(); - wait_for_keypress_or_mouse_click(); + settextjustify(1, 1); + shbox(400, 177, 600, 195, "[Press any key...]"); + settextjustify(0, 2); + on(); + wait_for_keypress_or_mouse_click(); - off(); setfillstyle(1,1); bar(2,2,637,197); - drawup(); - off(); highlight(3,where[3]-top[3]+1); on(); + off(); + setfillstyle(1, 1); + bar(2, 2, 637, 197); + drawup(); + off(); + highlight(3, where[3] - top[3] + 1); + on(); } void filer_help() - /* Just some general help... */ +/* Just some general help... */ { - off(); little_cls(); - - setcolor(15); - outtextxy(10, 10,"To change to a particular pane:"); - outtextxy(10, 50,"To choose a file:"); - outtextxy(10,100,"To change drives:"); - outtextxy(10,140,"Finally..."); - - setcolor(14); - outtextxy(20, 20,"Press Alt and the initial letter simultaneously."); - outtextxy(20, 30,"(e.g. to change to the Name pane, press Alt-N.)"); - outtextxy(20, 60,"Either type its name in the Name pane or choose it"); - outtextxy(20, 70,"from the list in the Files pane. You may either use"); - outtextxy(20, 80,"a mouse or the keyboard to do this."); - outtextxy(20,110,"Move into the Drives pane and press the letter of the"); - outtextxy(20,120,"drive you want."); - outtextxy(20,150,"Either select OK to load the file, or Cancel to back out."); - - settextjustify(1,1); - shbox(400,177,600,195,"[Press any key...]"); - settextjustify(0,2); on(); - wait_for_keypress_or_mouse_click(); - - off(); setfillstyle(1,1); bar(2,2,637,197); - drawup(); off(); - if (set::of(3,4, eos).has(nowwin)) highlight(nowwin,where[nowwin]-top[nowwin]+1); - on(); + off(); + little_cls(); + + setcolor(15); + outtextxy(10, 10, "To change to a particular pane:"); + outtextxy(10, 50, "To choose a file:"); + outtextxy(10, 100, "To change drives:"); + outtextxy(10, 140, "Finally..."); + + setcolor(14); + outtextxy(20, 20, "Press Alt and the initial letter simultaneously."); + outtextxy(20, 30, "(e.g. to change to the Name pane, press Alt-N.)"); + outtextxy(20, 60, "Either type its name in the Name pane or choose it"); + outtextxy(20, 70, "from the list in the Files pane. You may either use"); + outtextxy(20, 80, "a mouse or the keyboard to do this."); + outtextxy(20, 110, "Move into the Drives pane and press the letter of the"); + outtextxy(20, 120, "drive you want."); + outtextxy(20, 150, "Either select OK to load the file, or Cancel to back out."); + + settextjustify(1, 1); + shbox(400, 177, 600, 195, "[Press any key...]"); + settextjustify(0, 2); + on(); + wait_for_keypress_or_mouse_click(); + + off(); + setfillstyle(1, 1); + bar(2, 2, 637, 197); + drawup(); + off(); + if (set::of(3, 4, eos).has(nowwin)) highlight(nowwin, where[nowwin] - top[nowwin] + 1); + on(); } void wipe(byte which) - /* This wipes the file whose name is in lists[files,which]. */ +/* This wipes the file whose name is in lists[files,which]. */ { - char r; - untyped_file f; - - - off(); little_cls(); - - settextjustify(1,1); - outtextxy(320,100,string("Are you sure you want to delete \"")+ - lists[files][which]+".asg\"?"); - shbox(400,177,600,195,"[Y/N]"); - - do { - r=upcase(readkey()); - if (r=='Y') - { - assign(f,lists[files][which]+".asg"); /*$I-*/ erase(f); /*$I+*/ - - setcolor(14); - if (ioresult==0) - { - scandir(); - outtextxy(100,140,"Deleted."); - } else - outtextxy(100,140,"Not deleted (some problem...)"); - - shbox(400,177,600,195,"[Press any key...]"); - on(); - wait_for_keypress_or_mouse_click(); off(); - } - } while (!(set::of('Y','N', eos).has(r))); - - settextjustify(0,2); setcolor(14); - setfillstyle(1,1); bar(2,2,637,197); - drawup(); - off(); highlight(3,where[3]-top[3]+1); on(); + char r; + untyped_file f; + + + off(); + little_cls(); + + settextjustify(1, 1); + outtextxy(320, 100, string("Are you sure you want to delete \"") + + lists[files][which] + ".asg\"?"); + shbox(400, 177, 600, 195, "[Y/N]"); + + do { + r = upcase(readkey()); + if (r == 'Y') { + assign(f, lists[files][which] + ".asg"); /*$I-*/ erase(f); /*$I+*/ + + setcolor(14); + if (ioresult == 0) { + scandir(); + outtextxy(100, 140, "Deleted."); + } else + outtextxy(100, 140, "Not deleted (some problem...)"); + + shbox(400, 177, 600, 195, "[Press any key...]"); + on(); + wait_for_keypress_or_mouse_click(); + off(); + } + } while (!(set::of('Y', 'N', eos).has(r))); + + settextjustify(0, 2); + setcolor(14); + setfillstyle(1, 1); + bar(2, 2, 637, 197); + drawup(); + off(); + highlight(3, where[3] - top[3] + 1); + on(); } -string do_filer() -{ - pathstr p; byte groi; dirstr original_directory; - - string do_filer_result; - getdir(0,original_directory); - dusk(); - oncandopageswap=false; cancelled=false; - copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); - off(); - - firstsetup(); - scandir(); - nowwin=1; getcurrent(); - firstsetup(); drawup(); - on(); - mousepage(filer_page); - - p=playaround(); - if (p!="") p=fexpand(p+".ASG"); - do_filer_result=p; - filename=""; - - mousepage(cp); - dusk(); off(); - oncandopageswap=true; - copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); - on_virtual(); dawn(); fix_flashers(); - - setvisualpage(cp); - setactivepage(1-cp); - chdir(original_directory); - - return do_filer_result; +string do_filer() { + pathstr p; + byte groi; + dirstr original_directory; + + string do_filer_result; + getdir(0, original_directory); + dusk(); + oncandopageswap = false; + cancelled = false; + copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); + off(); + + firstsetup(); + scandir(); + nowwin = 1; + getcurrent(); + firstsetup(); + drawup(); + on(); + mousepage(filer_page); + + p = playaround(); + if (p != "") p = fexpand(p + ".ASG"); + do_filer_result = p; + filename = ""; + + mousepage(cp); + dusk(); + off(); + oncandopageswap = true; + copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); + on_virtual(); + dawn(); + fix_flashers(); + + setvisualpage(cp); + setactivepage(1 - cp); + chdir(original_directory); + + return do_filer_result; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h index 034d1e591470..e891ff90e202 100644 --- a/engines/avalanche/fileunit.h +++ b/engines/avalanche/fileunit.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index 51c9334b7d21..78abec7e414e 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -41,132 +41,164 @@ namespace Avalanche { -const array<1,12,varying_string<6> > months = - {{"Jan*","Feb*","March","April","May","June","July","August", - "Sept&","Oct&","Nov&","Dec&"}}; -const string ednaid = string("TT")+'\261'+'\36'+'\1'+'\113'+'\261'+'\231'+'\261'; -const array<1,6,varying_string<7> > systems = - {{"DOS","Windows","OS/2","Mac","Amiga","ST"}}; +const array<1, 12, varying_string<6> > months = { + { + "Jan*", "Feb*", "March", "April", "May", "June", "July", "August", + "Sept&", "Oct&", "Nov&", "Dec&" + } +}; +const string ednaid = string("TT") + '\261' + '\36' + '\1' + '\113' + '\261' + '\231' + '\261'; +const array<1, 6, varying_string<7> > systems = +{{"DOS", "Windows", "OS/2", "Mac", "Amiga", "ST"}}; struct edhead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS). See below for others.*/ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte os; /* Saving OS (here 1=DOS). See below for others.*/ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ }; - /* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST */ /*implementation*/ untyped_file f; byte fv; -array<1,255,word> dna256; +array<1, 255, word> dna256; boolean ok; edhead e; -void info256(string x) /* info on dna256 *.ASG files */ -{ - varying_string<40> describe; -; - assign(f,x); - /*$I-*/ reset(f,1); - seek(f,47); - blockread(f,describe,40); - blockread(f,dna256,sizeof(dna256)); - close(f); /*$I+*/ - {; - e.revision=1; - e.game="Denarius Avaricius Sextus"; - e.shortname="Avaricius"; - e.number=1; - e.verstr="[?]"; - e.filename="AVVY.EXE"; - e.os=1; /* Dos */ - e.fn=x; - e.d=dna256[7]; e.m=dna256[8]; e.y=dna256[9]; - e.desc=describe; - e.len=512; - e.saves=dna256[6]; - e.cash=dna256[30]; - e.money=strf(e.cash)+" denari"; - if (e.cash==1) e.money=e.money+"us"; else e.money=e.money+'i'; - e.points=dna256[36]; - } +void info256(string x) { /* info on dna256 *.ASG files */ + varying_string<40> describe; + ; + assign(f, x); + /*$I-*/ reset(f, 1); + seek(f, 47); + blockread(f, describe, 40); + blockread(f, dna256, sizeof(dna256)); + close(f); /*$I+*/ + { + ; + e.revision = 1; + e.game = "Denarius Avaricius Sextus"; + e.shortname = "Avaricius"; + e.number = 1; + e.verstr = "[?]"; + e.filename = "AVVY.EXE"; + e.os = 1; /* Dos */ + e.fn = x; + e.d = dna256[7]; + e.m = dna256[8]; + e.y = dna256[9]; + e.desc = describe; + e.len = 512; + e.saves = dna256[6]; + e.cash = dna256[30]; + e.money = strf(e.cash) + " denari"; + if (e.cash == 1) e.money = e.money + "us"; + else e.money = e.money + 'i'; + e.points = dna256[36]; + } } -string enlarge(string x) -{string enlarge_result; -; - switch (x[length(x)]) { - case '*': {; x[0] -= 1; x=x+"uary"; } break; - case '&': {; x[0] -= 1; x=x+"ember"; } break; - } - enlarge_result=x; -return enlarge_result; +string enlarge(string x) { + string enlarge_result; + ; + switch (x[length(x)]) { + case '*': { + ; + x[0] -= 1; + x = x + "uary"; + } + break; + case '&': { + ; + x[0] -= 1; + x = x + "ember"; + } + break; + } + enlarge_result = x; + return enlarge_result; } -string th(byte x) -{ - varying_string<4> n; -string th_result; -; - n=strf(x); - switch (x) { - case 1:case 21:case 31: n=n+"st"; break; - case 2:case 22: n=n+"nd"; break; - case 3:case 23: n=n+"rd"; break; - default: n=n+"th"; - } - th_result=n; -return th_result; +string th(byte x) { + varying_string<4> n; + string th_result; + ; + n = strf(x); + switch (x) { + case 1: + case 21: + case 31: + n = n + "st"; + break; + case 2: + case 22: + n = n + "nd"; + break; + case 3: + case 23: + n = n + "rd"; + break; + default: + n = n + "th"; + } + th_result = n; + return th_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - info256("t:justb4.asg"); - - {; - output << "DNA coding: "; - switch (e.revision) { - case 1: output << "dna256" << NL; break; - case 2: output << "E.D.N.A." << NL; break; - default: output << "Unknown!" << NL; - } - output << "Filename: " << e.game << " (version " << e.verstr << ')' << NL; - output << "Description: " << e.desc << NL; - output << "Cash: " << e.money << NL; - output << "Score: " << e.points << NL; - output << "Date: " << th(e.d) << ' ' << enlarge(months[e.m]) << ' ' << e.y << NL; - output << "Number of saves: " << e.saves << NL; - } -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + info256("t:justb4.asg"); + + { + ; + output << "DNA coding: "; + switch (e.revision) { + case 1: + output << "dna256" << NL; + break; + case 2: + output << "E.D.N.A." << NL; + break; + default: + output << "Unknown!" << NL; + } + output << "Filename: " << e.game << " (version " << e.verstr << ')' << NL; + output << "Description: " << e.desc << NL; + output << "Cash: " << e.money << NL; + output << "Score: " << e.points << NL; + output << "Date: " << th(e.d) << ' ' << enlarge(months[e.m]) << ' ' << e.y << NL; + output << "Number of saves: " << e.saves << NL; + } + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index 4745d959d016..03da49f3751c 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,14 +33,17 @@ namespace Avalanche { const integer picsize = 966; const integer number_of_objects = 19; -const array<1,65,char> thinks_header = - string("This is an Avalot file, which is subject to copyright. Have fun.")+'\32'; +const array<1, 65, char> thinks_header = + string("This is an Avalot file, which is subject to copyright. Have fun.") + '\32'; -const array<0,19,byte> order = - {{ 4, 19, 1, 18, 15, 9, 12, 13, 17, 10, 2, 6, 3, 5, 7, 14, - 16, +const array<0, 19, byte> order = { + { + 4, 19, 1, 18, 15, 9, 12, 13, 17, 10, 2, 6, 3, 5, 7, 14, + 16, - 0, 11, 8}}; + 0, 11, 8 + } +}; /* pAvalot=#150; pSpludwick=#151; pCrapulus=#152; pDrDuck=#153; @@ -52,56 +55,64 @@ const array<0,19,byte> order = pArkata=#175; pGeida=#176; pWiseWoman=#178; */ -integer gd,gm; +integer gd, gm; untyped_file f; pointer p; byte noo; -void load() -{ - byte a0 /*absolute $A000:1200*/; - byte bit; - untyped_file f; -; - assign(f,"d:folk.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); bit=getpixel(0,0); +void load() { + byte a0 /*absolute $A000:1200*/; + byte bit; + untyped_file f; + ; + assign(f, "d:folk.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -void get_one() -{; +void get_one() { + ; - gd=((order[noo] % 9)*70+10); - gm=((order[noo] / 9)*40+20); + gd = ((order[noo] % 9) * 70 + 10); + gm = ((order[noo] / 9) * 40 + 20); - getimage(gd,gm,gd+59,gm+29,p); - putimage(gd,gm,p,notput); - blockwrite(f,p,picsize); + getimage(gd, gm, gd + 59, gm + 29, p); + putimage(gd, gm, p, notput); + blockwrite(f, p, picsize); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); - load(); noo=0; + load(); + noo = 0; - assign(f,"folk.avd"); - getmem(p,picsize); - rewrite(f,1); - blockwrite(f,thinks_header,65); + assign(f, "folk.avd"); + getmem(p, picsize); + rewrite(f, 1); + blockwrite(f, thinks_header, 65); - for( noo=0; noo <= number_of_objects; noo ++) - get_one(); + for (noo = 0; noo <= number_of_objects; noo ++) + get_one(); - close(f); freemem(p,picsize); -return EXIT_SUCCESS; + close(f); + freemem(p, picsize); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 8955546b03e7..3173c6921c02 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,25 +29,31 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; fonttype font1; byte fv; char r; file f; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(f,"v:avalot.fnt"); reset(f); f >> font1; close(f); - for( r='\0'; r <= '\377'; r ++) - {; - for( fv= 0; fv <= 3; fv ++) font1[r][fv]=(cardinal)font1[r][fv] >> 1; - for( fv= 7; fv <= 8; fv ++) font1[r][fv]=font1[r][fv] << 1; - for( fv= 9; fv <= 14; fv ++) font1[r][fv]=font1[r][fv] << 2; - } - assign(f,"v:avitalic.fnt"); rewrite(f); f << font1; close(f); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(f, "v:avalot.fnt"); + reset(f); + f >> font1; + close(f); + for (r = '\0'; r <= '\377'; r ++) { + ; + for (fv = 0; fv <= 3; fv ++) font1[r][fv] = (cardinal)font1[r][fv] >> 1; + for (fv = 7; fv <= 8; fv ++) font1[r][fv] = font1[r][fv] << 1; + for (fv = 9; fv <= 14; fv ++) font1[r][fv] = font1[r][fv] << 2; + } + assign(f, "v:avitalic.fnt"); + rewrite(f); + f << font1; + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index ddd622cb9a41..257e2b342c9b 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,23 +29,26 @@ namespace Avalanche { -typedef array<1,31,byte> tunetype; +typedef array<1, 31, byte> tunetype; const integer lower = 0; - const integer same = 1; +const integer same = 1; const integer higher = 2; -const array<1,12,char> keys = "QWERTYUIOP[]"; -const array<1,12,word> notes = -{{196,220,247,262,294,330,350,392,440,494,523,587}}; +const array<1, 12, char> keys = "QWERTYUIOP[]"; +const array<1, 12, word> notes = +{{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}}; -const tunetype tune = -{{higher,higher,lower,same,higher,higher,lower,higher,higher,higher, - lower,higher,higher, - same,higher,lower,lower,lower,lower,higher,higher,lower,lower,lower, - lower,same,lower,higher,same,lower,higher}}; +const tunetype tune = { + { + higher, higher, lower, same, higher, higher, lower, higher, higher, higher, + lower, higher, higher, + same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, + lower, same, lower, higher, same, lower, higher + } +}; -byte this_one,last_one; +byte this_one, last_one; char pressed; @@ -53,77 +56,82 @@ byte value; tunetype played; -void store_(byte what) -{; +void store_(byte what) { + ; - move(played[2],played[1],sizeof(played)-1); + move(played[2], played[1], sizeof(played) - 1); - played[31]=what; + played[31] = what; } -boolean they_match() -{ - byte fv; -boolean they_match_result; -; +boolean they_match() { + byte fv; + boolean they_match_result; + ; - for( fv=1; fv <= sizeof(played); fv ++) - if (played[fv]!=tune[fv]) - {; - they_match_result=false; - return they_match_result; - } + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != tune[fv]) { + ; + they_match_result = false; + return they_match_result; + } - they_match_result=true; + they_match_result = true; -return they_match_result; + return they_match_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; - textattr=30; clrscr; output << NL; + textattr = 30; + clrscr; + output << NL; - do { + do { - pressed=upcase(readkey()); + pressed = upcase(readkey()); - value=pos(pressed,keys); + value = pos(pressed, keys); - if (value>0) - {; + if (value > 0) { + ; - last_one=this_one; - this_one=value; + last_one = this_one; + this_one = value; - sound(notes[this_one]); - delay(100); - nosound; + sound(notes[this_one]); + delay(100); + nosound; - if (this_one> NL; - exit(0); - } + if (they_match()) { + ; + textattr = 94; + clrscr; + output << NL; + output << string('\7') + "It matches!" << NL; + input >> NL; + exit(0); + } - } + } - } while (!(pressed=='\33')); + } while (!(pressed == '\33')); - output << "*** PROGRAM STOPPED! ***" << NL; -return EXIT_SUCCESS; + output << "*** PROGRAM STOPPED! ***" << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index c1e81e0525ca..8f84e53100d4 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,410 +32,447 @@ namespace Avalanche { -const array<1,5,shortint> adjustment = {{7,0,7,7,7}}; +const array<1, 5, shortint> adjustment = {{7, 0, 7, 7, 7}}; -const array<0,3,byte> plane_to_use = {{2,2,2,3}}; +const array<0, 3, byte> plane_to_use = {{2, 2, 2, 3}}; -const array<1,5,byte> waveorder = {{5,1,2,3,4}}; +const array<1, 5, byte> waveorder = {{5, 1, 2, 3, 4}}; -const array<1,26,byte> glerkfade = - {{1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4,4,3,3,3,2,2,1}}; +const array<1, 26, byte> glerkfade = +{{1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1}}; -const array<1,18,byte> greldetfade = {{1,2,3,4,5,6,6,6,5,5,4,4,3,3,2,2,1,1}}; +const array<1, 18, byte> greldetfade = {{1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1}}; -enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; }; -typedef array<1,6,0,3,0,34,1,9,byte> glerktype; +typedef array<1, 6, 0, 3, 0, 34, 1, 9, byte> glerktype; untyped_file f; chunkblocktype cb; -array<1,5,2,3,0,65,0,25,byte> ghost; +array<1, 5, 2, 3, 0, 65, 0, 25, byte> ghost; byte fv; pointer memlevel; -byte y,yy,bit,xofs; +byte y, yy, bit, xofs; -array<0,1,pointer> eyes; +array<0, 1, pointer> eyes; pointer exclamation; -array<1,6,pointer> aargh; -array<1,3,pointer> bat; -glerktype* glerk; -array<1,5,pointer> green_eyes; -matrix<1,6,false,true,pointer> greldet; +array<1, 6, pointer> aargh; +array<1, 3, pointer> bat; +glerktype *glerk; +array<1, 5, pointer> green_eyes; +matrix<1, 6, false, true, pointer> greldet; -array<1,6,pointtype> aargh_where; +array<1, 6, pointtype> aargh_where; -integer gd,gm; boolean gb; +integer gd, gm; +boolean gb; byte glerkstage; -integer bat_x,bat_y; word bat_count; shortint aargh_count; +integer bat_x, bat_y; +word bat_count; +shortint aargh_count; -integer greldet_x,greldet_y; byte greldet_count; boolean red_greldet; +integer greldet_x, greldet_y; +byte greldet_count; +boolean red_greldet; void plain_grab() - /* Just grabs the next one and puts it where it's told to. */ +/* Just grabs the next one and puts it where it's told to. */ { - integer xx,yy,xofs; -; - blockread(f,cb,sizeof(cb)); - - switch (cb.flavour) { - case ch_one: {; - xofs=cb.x / 8; - bit=3; - for( yy=0; yy <= cb.yl; yy ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - blockread(f,mem[0xa000*(yy+cb.y)*80+xofs],cb.xl / 8); - } - } - break; - case ch_ega: {; - xofs=cb.x / 8; - bit=3; - for( bit=0; bit <= 3; bit ++) - for( yy=0; yy <= cb.yl; yy ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - blockread(f,mem[0xa000*(yy+cb.y)*80+xofs],cb.xl / 8); - } - } - break; - } + integer xx, yy, xofs; + ; + blockread(f, cb, sizeof(cb)); + + switch (cb.flavour) { + case ch_one: { + ; + xofs = cb.x / 8; + bit = 3; + for (yy = 0; yy <= cb.yl; yy ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + blockread(f, mem[0xa000 * (yy + cb.y) * 80 + xofs], cb.xl / 8); + } + } + break; + case ch_ega: { + ; + xofs = cb.x / 8; + bit = 3; + for (bit = 0; bit <= 3; bit ++) + for (yy = 0; yy <= cb.yl; yy ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + blockread(f, mem[0xa000 * (yy + cb.y) * 80 + xofs], cb.xl / 8); + } + } + break; + } } -void get_me(pointer& p) -{; - blockread(f,cb,sizeof(cb)); - /* Take it for granted that cb.flavour = ch_BGI! */ +void get_me(pointer &p) { + ; + blockread(f, cb, sizeof(cb)); + /* Take it for granted that cb.flavour = ch_BGI! */ - {; - getmem(p,cb.size); - blockread(f,p,cb.size); - } + { + ; + getmem(p, cb.size); + blockread(f, p, cb.size); + } } -void get_me_aargh(byte which) -{; - blockread(f,cb,sizeof(cb)); - /* Take it for granted that cb.flavour = ch_BGI! */ +void get_me_aargh(byte which) { + ; + blockread(f, cb, sizeof(cb)); + /* Take it for granted that cb.flavour = ch_BGI! */ - {; - getmem(aargh[which],cb.size); - blockread(f,aargh[which],cb.size); - } + { + ; + getmem(aargh[which], cb.size); + blockread(f, aargh[which], cb.size); + } - { - pointtype& with = aargh_where[which]; + { + pointtype &with = aargh_where[which]; - with.x=cb.x; - with.y=cb.y; - } + with.x = cb.x; + with.y = cb.y; + } } -void wait(word how_long) -{ - word i; char r; - - for( i=1; i <= how_long; i ++) - if (keypressed()) - { - sound(6177); - while (keypressed()) r=readkey(); - delay(1); - nosound; - } else - delay(1); +void wait(word how_long) { + word i; + char r; + + for (i = 1; i <= how_long; i ++) + if (keypressed()) { + sound(6177); + while (keypressed()) r = readkey(); + delay(1); + nosound; + } else + delay(1); } void do_bat(); -static byte batimage; +static byte batimage; static pointtype batsize; -static void super_blank() -{ - pointtype oldsize; +static void super_blank() { + pointtype oldsize; - move(bat[batimage-1],oldsize,4); - bar(bat_x+batsize.x,bat_y,bat_x+oldsize.x,bat_y+oldsize.y); + move(bat[batimage - 1], oldsize, 4); + bar(bat_x + batsize.x, bat_y, bat_x + oldsize.x, bat_y + oldsize.y); } -void do_bat() -{ - shortint dx,iy; - - bat_count += 1; - - if (odd(bat_count)) - { - switch (bat_count) { - case 1 ... 90: { dx=2; iy=1; batimage=1; } break; - case 91 ... 240: { dx=1; iy=1; batimage=2; } break; - case 241 ... 260: { dx=1; iy=4; batimage=3; } break; - } - - move(bat[batimage],batsize,4); - - if ((bat_count==91) || (bat_count==241)) - super_blank(); /* When the bat changes, blank out the old one. */ - - bar(bat_x,bat_y,bat_x+batsize.x,bat_y+iy); - bar(bat_x+batsize.x,bat_y,bat_x+batsize.x-dx,bat_y+batsize.y); - - bat_x -= dx; bat_y += 1; - putimage(bat_x,bat_y,bat[batimage],0); - } +void do_bat() { + shortint dx, iy; + + bat_count += 1; + + if (odd(bat_count)) { + switch (bat_count) { + case 1 ... 90: { + dx = 2; + iy = 1; + batimage = 1; + } + break; + case 91 ... 240: { + dx = 1; + iy = 1; + batimage = 2; + } + break; + case 241 ... 260: { + dx = 1; + iy = 4; + batimage = 3; + } + break; + } + + move(bat[batimage], batsize, 4); + + if ((bat_count == 91) || (bat_count == 241)) + super_blank(); /* When the bat changes, blank out the old one. */ + + bar(bat_x, bat_y, bat_x + batsize.x, bat_y + iy); + bar(bat_x + batsize.x, bat_y, bat_x + batsize.x - dx, bat_y + batsize.y); + + bat_x -= dx; + bat_y += 1; + putimage(bat_x, bat_y, bat[batimage], 0); + } } -void big_green_eyes(byte how) -{ - putimage(330,103,green_eyes[how],0); - putimage(376,103,green_eyes[how],0); +void big_green_eyes(byte how) { + putimage(330, 103, green_eyes[how], 0); + putimage(376, 103, green_eyes[how], 0); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - if (paramstr(1)!="jsb") exit(255); - gd=3; gm=0; initgraph(gd,gm,""); - fillchar(ghost,sizeof(ghost),'\0'); - - assign(f,"spooky.avd"); - reset(f,1); - seek(f,44); - - mark(memlevel); - - for( fv=1; fv <= 5; fv ++) - {; - blockread(f,cb,sizeof(cb)); - for( bit=2; bit <= 3; bit ++) - for( y=0; y <= cb.yl; y ++) - blockread(f,ghost[fv][bit][y],cb.xl / 8); - } - - get_me(eyes[0]); /* Get BGI-based ones */ - get_me(eyes[1]); - get_me(exclamation); - - plain_grab(); /* Grabs to screen (cobweb) */ - plain_grab(); /* Grabs to screen (Mark's signature) */ - plain_grab(); /* Grabs to screen (open door) */ - - for( fv=1; fv <= 3; fv ++) - get_me(bat[fv]); - -/* new(glerk); - for fv:=1 to 5 do { Grab the Glerk. } - begin; - blockread(f,cb,sizeof(cb)); - for bit:=0 to 3 do - for y:=0 to 34 do - blockread(f,glerk^[fv,bit,y],cb.xl div 8); - inc(gd,gm); - end; -*/ - - glerk = new glerktype; - - for( fv=1; fv <= 6; fv ++) - {; - blockread(f,cb,sizeof(cb)); - bit=3; - for( bit=0; bit <= 3; bit ++) - for( yy=0; yy <= cb.yl; yy ++) -/* begin; - port[$3c4]:=2; port[$3ce]:=4; - port[$3C5]:=1 shl bit; port[$3CF]:=bit;*/ - - blockread(f,(*glerk)[fv][bit][yy],cb.xl / 8); -/* move(glerk^[fv,bit,yy],mem[$A000:yy*80+177],xl div 8);*/ -/* blockread(f,mem[$A000:yy*80+177],xl div 8);*/ - -/* end;*/ - } - - for( fv=1; fv <= 6; fv ++) get_me_aargh(fv); - for( fv=1; fv <= 5; fv ++) get_me(green_eyes[fv]); - for( gb=false; gb <= true; gb ++) - for( fv=1; fv <= 6; fv ++) get_me(greldet[fv][gb]); - - close(f); - - /* Avvy walks over... */ - - setfillstyle(1,0); - glerkstage=0; bat_x=277; bat_y=40; bat_count=0; - - for( gd=500; gd >= 217; gd --) - {; - if (set::of(range(22,27), eos).has((gd % 30))) - {; - if ((gd % 30)==27) bar(gd,135,gd+16,136); - putimage(gd,136,eyes[0],0); - putpixel(gd+16,137,0); - } else - {; - if (gd % 30==21) bar(gd,137,gd+17,138); - - putimage(gd,135,eyes[0],0); - putpixel(gd+16,136,0); /* eyes would leave a trail 1 pixel high behind them */ - } - - /* Plot the Glerk: */ - if (gd % 10==0) - {; - glerkstage += 1; - if (glerkstage>26) flush(); - - for( gm=0; gm <= 34; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - move((*glerk)[glerkfade[glerkstage]][bit][gm], - mem[0xa000*1177+gm*80],9); - } - bit=getpixel(0,0); - } - - do_bat(); - - wait(15); - } - - setfillstyle(1,0); - bar(456,14,530,50); - - /* It descends... */ - - for( gm=-64; gm <= 103; gm ++) - {; - bit=getpixel(0,0); - - if (gm>0) - fillchar(mem[0xa000*(gm-1)*80],26,'\0'); - - for( y=0; y <= 65; y ++) - if ((y+gm)>=0) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - move(ghost[2+(abs(gm / 7) % 2)*3][plane_to_use[bit]][y], - mem[0xa000*(y+gm)*80],26); - } - - wait(27); - } - - /* And waves... */ - - aargh_count=-14; - - for( gd=1; gd <= 4; gd ++) - for( fv=1; fv <= 5; fv ++) - {; - - y=getpixel(0,0); - - for( y=0; y <= 7; y ++) - fillchar(mem[0xa000*7760+y*80],26,'\0'); - - for( y=0; y <= 65; y ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(ghost[waveorder[fv]][plane_to_use[bit]][y], - mem[0xa000*7760+(y+adjustment[fv])*80],26); - } - - aargh_count += 1; - - if (aargh_count>0) - { pointtype& with = aargh_where[aargh_count]; - putimage(with.x,with.y,aargh[aargh_count],0);} - - wait(177); - } - - /* ! appears */ - - gd=getpixel(0,0); - putimage(246,127,exclamation,0); - wait(777); - bar(172, 78,347,111); /* erase "aargh" */ - - for( gm=5; gm >= 1; gm --) - { - wait(377); - big_green_eyes(gm); - } - bar(246,127,251,133); /* erase the "!" */ - - /* He hurries back. */ - - glerkstage=1; greldet_count=18; red_greldet=false; - - for( gd=217; gd <= 479; gd ++) - {; - if (set::of(range(22,27), eos).has((gd % 30))) - {; - if ((gd % 30)==22) - bar(gd+22,134,gd+38,137); - putimage(gd+23,136,eyes[1],0); - putpixel(gd+22,137,0); - } else - {; - if (gd % 30==28) - bar(gd+22,135,gd+38,138); - - putimage(gd+23,135,eyes[1],0); - putpixel(gd+22,136,0); /* eyes would leave a trail 1 pixel high behind them */ - } - - /* Plot the Green Eyes: */ - if (gd % 53==5) - {; - big_green_eyes(glerkstage); - glerkstage += 1; - } - - /* Plot the Greldet: */ - - if (greldet_count==18) - { /* A new greldet. */ - greldet_x=Random(600); - greldet_y=Random(80); - greldet_count=0; - red_greldet=! red_greldet; - } - - greldet_count += 1; - putimage - (greldet_x,greldet_y,greldet[greldetfade[greldet_count]][red_greldet],0); - - wait(10); - } - - release(memlevel); - closegraph(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + if (paramstr(1) != "jsb") exit(255); + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + fillchar(ghost, sizeof(ghost), '\0'); + + assign(f, "spooky.avd"); + reset(f, 1); + seek(f, 44); + + mark(memlevel); + + for (fv = 1; fv <= 5; fv ++) { + ; + blockread(f, cb, sizeof(cb)); + for (bit = 2; bit <= 3; bit ++) + for (y = 0; y <= cb.yl; y ++) + blockread(f, ghost[fv][bit][y], cb.xl / 8); + } + + get_me(eyes[0]); /* Get BGI-based ones */ + get_me(eyes[1]); + get_me(exclamation); + + plain_grab(); /* Grabs to screen (cobweb) */ + plain_grab(); /* Grabs to screen (Mark's signature) */ + plain_grab(); /* Grabs to screen (open door) */ + + for (fv = 1; fv <= 3; fv ++) + get_me(bat[fv]); + + /* new(glerk); + for fv:=1 to 5 do { Grab the Glerk. } + begin; + blockread(f,cb,sizeof(cb)); + for bit:=0 to 3 do + for y:=0 to 34 do + blockread(f,glerk^[fv,bit,y],cb.xl div 8); + inc(gd,gm); + end; + */ + + glerk = new glerktype; + + for (fv = 1; fv <= 6; fv ++) { + ; + blockread(f, cb, sizeof(cb)); + bit = 3; + for (bit = 0; bit <= 3; bit ++) + for (yy = 0; yy <= cb.yl; yy ++) + /* begin; + port[$3c4]:=2; port[$3ce]:=4; + port[$3C5]:=1 shl bit; port[$3CF]:=bit;*/ + + blockread(f, (*glerk)[fv][bit][yy], cb.xl / 8); + /* move(glerk^[fv,bit,yy],mem[$A000:yy*80+177],xl div 8);*/ + /* blockread(f,mem[$A000:yy*80+177],xl div 8);*/ + + /* end;*/ + } + + for (fv = 1; fv <= 6; fv ++) get_me_aargh(fv); + for (fv = 1; fv <= 5; fv ++) get_me(green_eyes[fv]); + for (gb = false; gb <= true; gb ++) + for (fv = 1; fv <= 6; fv ++) get_me(greldet[fv][gb]); + + close(f); + + /* Avvy walks over... */ + + setfillstyle(1, 0); + glerkstage = 0; + bat_x = 277; + bat_y = 40; + bat_count = 0; + + for (gd = 500; gd >= 217; gd --) { + ; + if (set::of(range(22, 27), eos).has((gd % 30))) { + ; + if ((gd % 30) == 27) bar(gd, 135, gd + 16, 136); + putimage(gd, 136, eyes[0], 0); + putpixel(gd + 16, 137, 0); + } else { + ; + if (gd % 30 == 21) bar(gd, 137, gd + 17, 138); + + putimage(gd, 135, eyes[0], 0); + putpixel(gd + 16, 136, 0); /* eyes would leave a trail 1 pixel high behind them */ + } + + /* Plot the Glerk: */ + if (gd % 10 == 0) { + ; + glerkstage += 1; + if (glerkstage > 26) flush(); + + for (gm = 0; gm <= 34; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + move((*glerk)[glerkfade[glerkstage]][bit][gm], + mem[0xa000 * 1177 + gm * 80], 9); + } + bit = getpixel(0, 0); + } + + do_bat(); + + wait(15); + } + + setfillstyle(1, 0); + bar(456, 14, 530, 50); + + /* It descends... */ + + for (gm = -64; gm <= 103; gm ++) { + ; + bit = getpixel(0, 0); + + if (gm > 0) + fillchar(mem[0xa000 * (gm - 1) * 80], 26, '\0'); + + for (y = 0; y <= 65; y ++) + if ((y + gm) >= 0) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + move(ghost[2 + (abs(gm / 7) % 2) * 3][plane_to_use[bit]][y], + mem[0xa000 * (y + gm) * 80], 26); + } + + wait(27); + } + + /* And waves... */ + + aargh_count = -14; + + for (gd = 1; gd <= 4; gd ++) + for (fv = 1; fv <= 5; fv ++) { + ; + + y = getpixel(0, 0); + + for (y = 0; y <= 7; y ++) + fillchar(mem[0xa000 * 7760 + y * 80], 26, '\0'); + + for (y = 0; y <= 65; y ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(ghost[waveorder[fv]][plane_to_use[bit]][y], + mem[0xa000 * 7760 + (y + adjustment[fv]) * 80], 26); + } + + aargh_count += 1; + + if (aargh_count > 0) { + pointtype &with = aargh_where[aargh_count]; + putimage(with.x, with.y, aargh[aargh_count], 0); + } + + wait(177); + } + + /* ! appears */ + + gd = getpixel(0, 0); + putimage(246, 127, exclamation, 0); + wait(777); + bar(172, 78, 347, 111); /* erase "aargh" */ + + for (gm = 5; gm >= 1; gm --) { + wait(377); + big_green_eyes(gm); + } + bar(246, 127, 251, 133); /* erase the "!" */ + + /* He hurries back. */ + + glerkstage = 1; + greldet_count = 18; + red_greldet = false; + + for (gd = 217; gd <= 479; gd ++) { + ; + if (set::of(range(22, 27), eos).has((gd % 30))) { + ; + if ((gd % 30) == 22) + bar(gd + 22, 134, gd + 38, 137); + putimage(gd + 23, 136, eyes[1], 0); + putpixel(gd + 22, 137, 0); + } else { + ; + if (gd % 30 == 28) + bar(gd + 22, 135, gd + 38, 138); + + putimage(gd + 23, 135, eyes[1], 0); + putpixel(gd + 22, 136, 0); /* eyes would leave a trail 1 pixel high behind them */ + } + + /* Plot the Green Eyes: */ + if (gd % 53 == 5) { + ; + big_green_eyes(glerkstage); + glerkstage += 1; + } + + /* Plot the Greldet: */ + + if (greldet_count == 18) { + /* A new greldet. */ + greldet_x = Random(600); + greldet_y = Random(80); + greldet_count = 0; + red_greldet = ! red_greldet; + } + + greldet_count += 1; + putimage + (greldet_x, greldet_y, greldet[greldetfade[greldet_count]][red_greldet], 0); + + wait(10); + } + + release(memlevel); + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index ec20034f159c..2ea9aec1a77f 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,156 +30,157 @@ namespace Avalanche { -const varying_string<255> song = -string("Golden slumbers kiss your eyes/Smiles awake you when you rise/")+ -"Sleep, pretty Baron, do not cry/And I will sing a lullaby.%Care you "+ -"know not, therefore sleep/While I o'er you watch do keep;/Sleep now, "+ -"du Lustie, do not cry/And I will leave the castle.*Bye!"; +const varying_string<255> song = + string("Golden slumbers kiss your eyes/Smiles awake you when you rise/") + + "Sleep, pretty Baron, do not cry/And I will sing a lullaby.%Care you " + + "know not, therefore sleep/While I o'er you watch do keep;/Sleep now, " + + "du Lustie, do not cry/And I will leave the castle.*Bye!"; const integer scardcount = 13; -const array<0,scardcount-1,integer> soundcards = - {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; +const array < 0, scardcount - 1, integer > soundcards = +{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; -const array<1,5,byte> holding = -{{ 24, /* 0 : 24 */ -64, /* 1 : 00 */ -128, /* 2 : 00 */ -152, /* 2 : 24 */ -170}}; /* 2 : 42 */ +const array<1, 5, byte> holding = { + { + 24, /* 0 : 24 */ + 64, /* 1 : 00 */ + 128, /* 2 : 00 */ + 152, /* 2 : 24 */ + 170 + } +}; /* 2 : 42 */ -integer gd,gm; +integer gd, gm; byte fv; -word* skellern; -word s,o; +word *skellern; +word s, o; boolean firstverse; word nexthangon; boolean nomusic; -integer getsoundhardware(psoundcard scard) -{ - integer sc,i,autosel,select; - char ch; - integer e; +integer getsoundhardware(psoundcard scard) { + integer sc, i, autosel, select; + char ch; + integer e; -integer getsoundhardware_result; + integer getsoundhardware_result; Lagain: - sc=detectgus(scard); - if (sc!=0) sc=detectpas(scard); - if (sc!=0) sc=detectaria(scard); - if (sc!=0) sc=detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); - - autosel=-1; -/* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13),select,e); - - /* Default entry? */ - if (select==0) select=autosel; - if (select!=autosel) { - /* clear all assumptions */ - sc=-1; - fillchar(scard,sizeof(tsoundcard),0); - scard->id=soundcards[select-1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id==id_dac) scard->ioport=0x378; - - /* Read user input */ - val(paramstr(15),i,e); - - if (i!=0) scard->ioport=i; - if (sc!=1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : scard->samplesize=2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: scard->stereo=true; - break; /* enable stereo */ - default: { - scard->samplesize=1; - scard->stereo=false; - } - } - - if (scard->id!=id_dac) { - val(paramstr(17),i,e); - - if (i!=0) scard->dmairq=i; - - val(paramstr(16),i,e); - - if (i!=0) scard->dmachannel=i; - } else { - /* Select correct DAC */ - scard->maxrate=44100; - if (select==11) { - scard->stereo=true; - scard->dmachannel=1; /* Special 'mark' */ - scard->maxrate=60000; - } else - if (select==12) { - scard->stereo=true; - scard->dmachannel=2; - scard->maxrate=60000; - if (scard->ioport==0) scard->ioport=0x378; - } else - if (select==13) { - scard->dmachannel=0; - scard->ioport=0x42; /* Special 'mark' */ - scard->maxrate=44100; - } - } - -/* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result=0; -return getsoundhardware_result; + sc = detectgus(scard); + if (sc != 0) sc = detectpas(scard); + if (sc != 0) sc = detectaria(scard); + if (sc != 0) sc = detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); + + autosel = -1; + /* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13), select, e); + + /* Default entry? */ + if (select == 0) select = autosel; + if (select != autosel) { + /* clear all assumptions */ + sc = -1; + fillchar(scard, sizeof(tsoundcard), 0); + scard->id = soundcards[select - 1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id == id_dac) scard->ioport = 0x378; + + /* Read user input */ + val(paramstr(15), i, e); + + if (i != 0) scard->ioport = i; + if (sc != 1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : + scard->samplesize = 2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: + scard->stereo = true; + break; /* enable stereo */ + default: { + scard->samplesize = 1; + scard->stereo = false; + } + } + + if (scard->id != id_dac) { + val(paramstr(17), i, e); + + if (i != 0) scard->dmairq = i; + + val(paramstr(16), i, e); + + if (i != 0) scard->dmachannel = i; + } else { + /* Select correct DAC */ + scard->maxrate = 44100; + if (select == 11) { + scard->stereo = true; + scard->dmachannel = 1; /* Special 'mark' */ + scard->maxrate = 60000; + } else if (select == 12) { + scard->stereo = true; + scard->dmachannel = 2; + scard->maxrate = 60000; + if (scard->ioport == 0) scard->ioport = 0x378; + } else if (select == 13) { + scard->dmachannel = 0; + scard->ioport = 0x42; /* Special 'mark' */ + scard->maxrate = 44100; + } + } + + /* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result = 0; + return getsoundhardware_result; } -byte here() -{ - byte here_result; - here_result=(ampgetpattern % 3)*64+ampgetrow; - return here_result; +byte here() { + byte here_result; + here_result = (ampgetpattern % 3) * 64 + ampgetrow; + return here_result; } -void hold(word amount) -{ - *skellern=0; - do {; } while (!(*skellern>=amount)); +void hold(word amount) { + *skellern = 0; + do { + ; + } while (!(*skellern >= amount)); } -void hangon(word forwhat) -{ - if (nomusic) - hold(40); - else - do { - if (keypressed()) exit(0); - } while (!(here()>=holding[forwhat])); +void hangon(word forwhat) { + if (nomusic) + hold(40); + else + do { + if (keypressed()) exit(0); + } while (!(here() >= holding[forwhat])); } tsoundcard scard; @@ -188,277 +189,292 @@ tdds dds; pmodule module; tsdi_init sdi; integer e, -bufsize; + bufsize; char ch; boolean v86, -vdsok; -longint a,rate, -tempseg; + vdsok; +longint a, rate, + tempseg; string answer; pointer temp; word flags; word curch; byte modulevolume; -array<0,4,tsampleinfo> sample; -array<0,31,word> voltable; - -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - for( e=1; e <= paramcount; e ++) answer=paramstr(e); - - nomusic=paramstr(13)=='0'; - - if (! nomusic) - { - /* Read sound card information */ - if (getsoundhardware(&scard)==-1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id==id_gus) { - /* Initialize GUS player */ - #ifndef DPMI - scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ - #endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus,0,31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt,gus_timer); - } else { - /* Initialize Virtual DMA Specification */ - #ifndef DPMI - vdsok=vdsinit==0; - #else - vdsok=false; - #endif - - fillchar(mcpstrc,sizeof(tmcpstruct),0); - - /* Query for sampling rate */ - val(paramstr(14),a,e); - if (a>4000) rate=a; else rate=21000; - - /* Query for quality */ - mcpstrc.options=mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi=sdi_sb; - scard.maxrate=22000; - } - break; - case id_sbpro : { - sdi=sdi_sbpro; - scard.maxrate=22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi=sdi_pas; - scard.maxrate=44100; - } - break; - case id_sb16 : { - sdi=sdi_sb16; - scard.maxrate=44100; - } - break; - case id_aria : { - sdi=sdi_aria; - scard.maxrate=44100; - } - break; - case id_wss : { - sdi=sdi_wss; - scard.maxrate=48000; - } - break; - #ifndef DPMI - case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ - #endif - } - - mcpinitsounddevice(sdi,&scard); - a=mcp_tablesize; - mcpstrc.reqsize=0; - - /* Calculate mixing buffer size */ - bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize=0; - if ((mcpstrc.options & mcp_quality)>0) - if (scard.samplesize==1) a += mcp_qualitysize; else - a=mcp_tablesize16+mcp_qualitysize16; - if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; - - #ifdef DPMI - dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); - v86=(flags & 2)==0; - #endif - - /* Allocate volume table + mixing buffer */ - #ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg=0; - dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); - } else { - #endif - getmem(temp,a+longint(bufsize)); - if (temp==nil) exit(2); - #ifdef DPMI - tempseg=seg(temp); - } - #else - tempseg=seg(temp)+ofs(temp) / 16+1; - #endif - mcpstrc.bufferseg=tempseg; - mcpstrc.bufferphysical=-1; - - if (vdsok && (scard.id!=id_dac)) { - dds.size=bufsize; - dds.segment=tempseg; - dds.offset=0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; - } - if (mcpstrc.bufferphysical==-1) - #ifdef DPMI - mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); - #else - mcpstrc.bufferphysical=(longint)(tempseg) << 4; - #endif - - mcpstrc.buffersize=bufsize; - mcpstrc.samplingrate=rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc)!=0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp,0,31); - } - - /* Try to initialize AMP */ - if (ampinit(0)!=0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt,amp_timer); - - #ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id==id_dac) setdactimer(tsgettimerrate); - #endif - - if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; - - /* Load an example AMF */ - module=amploadmod("golden.mod",0); - if (module==nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) - && (scard.samplesize==2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); - cdisetupchannels(0,module->channelcount+2,&voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0,module->channelcount+2,nil); - } - - curch=module->channelcount; - modulevolume=64; - - /***/ ampplaymodule(module,0); - } - - val(paramstr(2),s,e); if (e!=0) exit(0); - val(paramstr(3),o,e); if (e!=0) exit(0); - skellern=ptr(s,o+1); - - gd=3; gm=0; initgraph(gd,gm,""); - - if (! nomusic) do {; } while (!(ampgetrow>=10)); - - setcolor(9); - for( gd=0; gd <= 320; gd ++) - { - rectangle(320-gd,100-gd / 2,320+gd,100+gd / 2); - } - - - gd=50; gm=20; - firstverse=true; - - hangon(1); nexthangon=2; - for( fv=1; fv <= 255; fv ++) - { - switch (song[fv]) { - case '/': { - gd=50; - gm += 15; - hangon(nexthangon); - nexthangon += 1; - } - break; - - case '%': { - gd=50; - gm += 35; - if (nomusic) - hold(15); - else - do {; } while (!(ampgetpattern>2)); - nexthangon=2; - hangon(1); - } - break; - - case '*': { - gd += 24; - hangon(5); - } - break; - - default: { - setcolor(1); outtextxy(gd+1,gm+1,song[fv]); - setcolor(0); outtextxy( gd , gm ,song[fv]); - gd += 12; - } - } - if (song[fv]==' ') hold(1); - if (keypressed()) exit(0); - } - - if (nomusic) - hold(25); - else - do {; } while (!(ampgetmodulestatus!=md_playing)); - - setcolor(0); - for( gd=320; gd >= 0; gd --) rectangle(320-gd,100-gd / 2,320+gd,100+gd / 2); - return EXIT_SUCCESS; +array<0, 4, tsampleinfo> sample; +array<0, 31, word> voltable; + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + for (e = 1; e <= paramcount; e ++) answer = paramstr(e); + + nomusic = paramstr(13) == '0'; + + if (! nomusic) { + /* Read sound card information */ + if (getsoundhardware(&scard) == -1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id == id_gus) { + /* Initialize GUS player */ +#ifndef DPMI + scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ +#endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus, 0, 31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt, gus_timer); + } else { + /* Initialize Virtual DMA Specification */ +#ifndef DPMI + vdsok = vdsinit == 0; +#else + vdsok = false; +#endif + + fillchar(mcpstrc, sizeof(tmcpstruct), 0); + + /* Query for sampling rate */ + val(paramstr(14), a, e); + if (a > 4000) rate = a; + else rate = 21000; + + /* Query for quality */ + mcpstrc.options = mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi = sdi_sb; + scard.maxrate = 22000; + } + break; + case id_sbpro : { + sdi = sdi_sbpro; + scard.maxrate = 22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi = sdi_pas; + scard.maxrate = 44100; + } + break; + case id_sb16 : { + sdi = sdi_sb16; + scard.maxrate = 44100; + } + break; + case id_aria : { + sdi = sdi_aria; + scard.maxrate = 44100; + } + break; + case id_wss : { + sdi = sdi_wss; + scard.maxrate = 48000; + } + break; +#ifndef DPMI + case id_dac : + sdi = sdi_dac; + break; /* Only available in real mode */ +#endif + } + + mcpinitsounddevice(sdi, &scard); + a = mcp_tablesize; + mcpstrc.reqsize = 0; + + /* Calculate mixing buffer size */ + bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize = 0; + if ((mcpstrc.options & mcp_quality) > 0) + if (scard.samplesize == 1) a += mcp_qualitysize; + else + a = mcp_tablesize16 + mcp_qualitysize16; + if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; + +#ifdef DPMI + dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); + v86 = (flags & 2) == 0; +#endif + + /* Allocate volume table + mixing buffer */ +#ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg = 0; + dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); + } else { +#endif + getmem(temp, a + longint(bufsize)); + if (temp == nil) exit(2); +#ifdef DPMI + tempseg = seg(temp); + } +#else + tempseg = seg(temp) + ofs(temp) / 16 + 1; +#endif + mcpstrc.bufferseg = tempseg; + mcpstrc.bufferphysical = -1; + + if (vdsok && (scard.id != id_dac)) { + dds.size = bufsize; + dds.segment = tempseg; + dds.offset = 0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; + } + if (mcpstrc.bufferphysical == -1) +#ifdef DPMI + mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); +#else + mcpstrc.bufferphysical = (longint)(tempseg) << 4; +#endif + + mcpstrc.buffersize = bufsize; + mcpstrc.samplingrate = rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc) != 0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp, 0, 31); + } + + /* Try to initialize AMP */ + if (ampinit(0) != 0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt, amp_timer); + +#ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id == id_dac) setdactimer(tsgettimerrate); +#endif + + if (scard.id != id_gus) mcpstartvoice; + else gusstartvoice; + + /* Load an example AMF */ + module = amploadmod("golden.mod", 0); + if (module == nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) + && (scard.samplesize == 2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); + cdisetupchannels(0, module->channelcount + 2, &voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0, module->channelcount + 2, nil); + } + + curch = module->channelcount; + modulevolume = 64; + + /***/ ampplaymodule(module, 0); + } + + val(paramstr(2), s, e); + if (e != 0) exit(0); + val(paramstr(3), o, e); + if (e != 0) exit(0); + skellern = ptr(s, o + 1); + + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + + if (! nomusic) do { + ; + } while (!(ampgetrow >= 10)); + + setcolor(9); + for (gd = 0; gd <= 320; gd ++) { + rectangle(320 - gd, 100 - gd / 2, 320 + gd, 100 + gd / 2); + } + + + gd = 50; + gm = 20; + firstverse = true; + + hangon(1); + nexthangon = 2; + for (fv = 1; fv <= 255; fv ++) { + switch (song[fv]) { + case '/': { + gd = 50; + gm += 15; + hangon(nexthangon); + nexthangon += 1; + } + break; + + case '%': { + gd = 50; + gm += 35; + if (nomusic) + hold(15); + else + do { + ; + } while (!(ampgetpattern > 2)); + nexthangon = 2; + hangon(1); + } + break; + + case '*': { + gd += 24; + hangon(5); + } + break; + + default: { + setcolor(1); + outtextxy(gd + 1, gm + 1, song[fv]); + setcolor(0); + outtextxy(gd , gm , song[fv]); + gd += 12; + } + } + if (song[fv] == ' ') hold(1); + if (keypressed()) exit(0); + } + + if (nomusic) + hold(25); + else + do { + ; + } while (!(ampgetmodulestatus != md_playing)); + + setcolor(0); + for (gd = 320; gd >= 0; gd --) rectangle(320 - gd, 100 - gd / 2, 320 + gd, 100 + gd / 2); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 651c55b1f31d..25b2c00797c9 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -49,510 +49,562 @@ namespace Avalanche { -const array<'\1',numobjs,varying_string<15> > things = - {{"Wine","Money-bag","Bodkin","Potion","Chastity belt", - "Crossbow bolt","Crossbow","Lute","Pilgrim's badge","Mushroom","Key", - "Bell","Scroll","Pen","Ink","Clothes","Habit","Onion"}}; - -const array<'\1',numobjs,char> thingchar = "WMBParCLguKeSnIohn"; /* V=Vinegar */ - -const array<'\1',numobjs,varying_string<17> > better = - {{"some wine","your money-bag","your bodkin","a potion","a chastity belt", - "a crossbow bolt","a crossbow","a lute","a pilgrim's badge","a mushroom", - "a key","a bell","a scroll","a pen","some ink","your clothes","a habit", - "an onion"}}; - -const array<'\1',numobjs,char> betterchar = "WMBParCLguKeSnIohn"; - -void newpointer(byte m) -{ - if (m==cmp) return; cmp=m; - { - ax=9; bx=(word)(mps[m].horzhotspot); cx=(word)(mps[m].verthotspot); - es=seg(mps[m].mask); dx=ofs(mps[m].mask); - } - intr(0x33,r); - load_a_mouse(m); -} - -void wait() /* makes hourglass */ -{ - newpointer(5); -} - -void on() -{ - if (set_of_enum()::of(m_yes,m_virtual, eos).has(visible)) return; - - r.ax=1; intr(0x33,r); visible=m_yes; - if (oncandopageswap) - { - r.ax=29; r.bx=cp; intr(0x33,r); /* show mouse on current page */ - } -} - -void on_virtual() -{ - switch (visible) { - case m_virtual: return; break; - case m_yes: off(); break; - } - - visible=m_virtual; -} - -void off() -{ - switch (visible) { - case m_no:case m_virtual : return; break; - case m_yes : { r.ax=2; intr(0x33,r); } break; - } - visible=m_no; -} - -void off_virtual() -{ - byte fv; - - if (visible!=m_virtual) return; - - for( fv=0; fv <= 1; fv ++) - { - setactivepage(fv); - wipe_vmc(1-fv); - } - setactivepage(1-cp); visible=m_no; -} - -void xycheck() /* only updates mx & my, not all other mouse vars */ -{ - r.ax=3; intr(0x33,r); /* getbuttonstatus */ - { - keystatus=bx; - mx=cx; my=dx; - } -} - -void hopto(integer x,integer y) /* Moves mouse pointer to x,y */ -{ - { - ax=4; - cx=x; - dx=y; - } - intr(0x33,r); -} - -void check() -{ - { ax=6; bx=0; } intr(0x33,r); /* getbuttonreleaseinfo */ - { - mrelease=bx; - mrx=cx; mry=dx; - } - { ax=5; bx=0; } intr(0x33,r); /* getbuttonpressinfo */ - { - mpress=bx; - mpx=cx; mpy=dx; - } - xycheck(); /* just to complete the job. */ -} - -void note(word hertz) -{ - if (soundfx) sound(hertz); -} - -void blip() -{ - byte fv; - - for( fv=1; fv <= 7; fv ++) { sound(177+(fv*200) % 177); delay(1); } - nosound; -} - -string strf(longint x) -{ - string q; - - string strf_result; - str(x,q); strf_result=q; - return strf_result; -} - -void shadow(integer x1,integer y1,integer x2,integer y2, byte hc,byte sc) -{ - byte fv; - - for( fv=0; fv <= border; fv ++) - { - setfillstyle(1,hc); - bar(x1+fv,y1+fv,x1+fv,y2-fv); - bar(x1+fv,y1+fv,x2-fv,y1+fv); - - setfillstyle(1,sc); - bar(x2-fv,y1+fv,x2-fv,y2-fv); - bar(x1+fv,y2-fv,x2-fv,y2-fv); - } -} - -void shbox(integer x1,integer y1,integer x2,integer y2, string t) -{ - const integer fc = 7; - - off(); - shadow(x1,y1,x2,y2,15,8); setfillstyle(1,fc); - bar(x1+border+1,y1+border+1,x2-border-1,y2-border-1); - setcolor(1); x1=(x2-x1) / 2+x1; y1=(y2-y1) / 2+y1; - outtextxy(x1,y1,t); - if (length(t)>1) - { - fillchar(t[2],length(t)-1,'\40'); t[1]='_'; - outtextxy(x1-1,y1+1,t); - } - on(); -} - -void newgame() /* This sets up the DNA for a completely new game. */ -{ - byte gd,gm; - - for( gm=1; gm <= numtr; gm ++) - { triptype& with = tr[gm]; - if (with.quick) done();} /* Deallocate sprite. Sorry, beta testers! */ - - tr[1].init(0,true); - alive=true; - - score=0; /*for gd:=0 to 5 do which[gd]:=1;*/ - fillchar(dna,sizeof(dna),'\0'); natural(); - normal_edit(); mousepage(0); - dna.spare_evening="answer a questionnaire"; - dna.like2drink="beer"; - - { - dna.pence=30; /* 2/6 */ dna.rw=stopped; dna.wearing=clothes; - dna.obj[money]=true; dna.obj[bodkin]=true; dna.obj[bell]=true; dna.obj[clothes]=true; - } - - thinks='\2'; objectlist(); - ontoolbar=false; seescroll=false; - - ppos[0][1]=-177; /*tr[1].appear(300,117,right);*/ gd=0; - for( gd=0; gd <= 30; gd ++) for( gm=0; gm <= 1; gm ++) also[gd][gm]=nil; -/* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ - him='\376'; her='\376'; it='\376'; last_person='\376'; /* = Pardon? */ - dna.pass_num=Random(30)+1; after_the_scroll=false; - dna.user_moves_avvy=false; doing_sprite_run=false; - dna.avvy_in_bed=true; enid_filename=""; - - for( gd=0; gd <= 1; gd ++) { cp=1-cp; getback(); } - - enterroom(1,1); new_game_for_trippancy(); - showscore(); - - standard_bar(); clock(); - sprite_run(); -} - -void click() /* "Audio keyboard feedback" */ -{ - sound(7177); delay(1); nosound; -} - -void slowdown() -{ -/* repeat until TSkellern>=howlong; TSkellern:=0;*/ - do {; } while (!(memw[storage_seg*skellern]>=howlong)); - memw[storage_seg*skellern]=0; -} - -boolean flagset(char x) -{ - boolean flagset_result; - flagset_result=pos(x,flags)>0; - return flagset_result; -} - -void force_numlock() -{ - if ((locks & num)>0) locks -= num; -} - -boolean pennycheck(word howmuchby) -{ - boolean pennycheck_result; - dna.pence -= howmuchby; - if (dna.pence<0) - { - dixi('Q',2); /* "you are now denariusless!" */ - pennycheck_result=false; - gameover(); - } else - pennycheck_result=true; - return pennycheck_result; -} - -string getname(char whose) -{ - string getname_result; - if (whose<'\257') getname_result=lads[whose]; else getname_result=lasses[whose]; - return getname_result; -} - -char getnamechar(char whose) -{ - char getnamechar_result; - if (whose<'\257') getnamechar_result=ladchar[whose-1]; - else getnamechar_result=lasschar[whose-1]; - return getnamechar_result; -} - -string get_thing(char which) -{ - string get_thing_result; - switch (which) { - case wine: switch (dna.winestate) { - case 1:case 4: get_thing_result=things[which]; break; - case 3: get_thing_result="Vinegar"; break; - } - break; - case onion: if (dna.rotten_onion) - get_thing_result="rotten onion"; - else get_thing_result=things[which]; - break; - default: get_thing_result=things[which]; - } - return get_thing_result; -} - -char get_thingchar(char which) -{ - char get_thingchar_result; - switch (which) { - case wine: if (dna.winestate==3) get_thingchar_result='V'; /* Vinegar */ - else get_thingchar_result=thingchar[which-1]; - break; - default: get_thingchar_result=thingchar[which-1]; - } - return get_thingchar_result; -} - -string get_better(char which) -{ - string get_better_result; - if (which>'\226') which -= 149; - switch (which) { - case wine: switch (dna.winestate) { - case 0:case 1:case 4: get_better_result=better[which]; break; - case 3: get_better_result="some vinegar"; break; - } - break; - case onion: if (dna.rotten_onion) - get_better_result="a rotten onion"; - else if (dna.onion_in_vinegar) - get_better_result="a pickled onion (in the vinegar)"; - else get_better_result=better[which]; - break; - default: - if ((which'\0')) - get_better_result=better[which]; else - get_better_result=""; - } - return get_better_result; +const array < '\1', numobjs, varying_string<15> > things = { + { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + } +}; + +const array < '\1', numobjs, char > thingchar = "WMBParCLguKeSnIohn"; /* V=Vinegar */ + +const array < '\1', numobjs, varying_string<17> > better = { + { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", + "an onion" + } +}; + +const array < '\1', numobjs, char > betterchar = "WMBParCLguKeSnIohn"; + +void newpointer(byte m) { + if (m == cmp) return; + cmp = m; + { + ax = 9; + bx = (word)(mps[m].horzhotspot); + cx = (word)(mps[m].verthotspot); + es = seg(mps[m].mask); + dx = ofs(mps[m].mask); + } + intr(0x33, r); + load_a_mouse(m); +} + +void wait() { /* makes hourglass */ + newpointer(5); +} + +void on() { + if (set_of_enum()::of(m_yes, m_virtual, eos).has(visible)) return; + + r.ax = 1; + intr(0x33, r); + visible = m_yes; + if (oncandopageswap) { + r.ax = 29; + r.bx = cp; + intr(0x33, r); /* show mouse on current page */ + } +} + +void on_virtual() { + switch (visible) { + case m_virtual: + return; + break; + case m_yes: + off(); + break; + } + + visible = m_virtual; +} + +void off() { + switch (visible) { + case m_no: + case m_virtual : + return; + break; + case m_yes : { + r.ax = 2; + intr(0x33, r); + } + break; + } + visible = m_no; +} + +void off_virtual() { + byte fv; + + if (visible != m_virtual) return; + + for (fv = 0; fv <= 1; fv ++) { + setactivepage(fv); + wipe_vmc(1 - fv); + } + setactivepage(1 - cp); + visible = m_no; +} + +void xycheck() { /* only updates mx & my, not all other mouse vars */ + r.ax = 3; + intr(0x33, r); /* getbuttonstatus */ + { + keystatus = bx; + mx = cx; + my = dx; + } +} + +void hopto(integer x, integer y) { /* Moves mouse pointer to x,y */ + { + ax = 4; + cx = x; + dx = y; + } + intr(0x33, r); +} + +void check() { + { + ax = 6; + bx = 0; + } + intr(0x33, r); /* getbuttonreleaseinfo */ + { + mrelease = bx; + mrx = cx; + mry = dx; + } + { + ax = 5; + bx = 0; + } + intr(0x33, r); /* getbuttonpressinfo */ + { + mpress = bx; + mpx = cx; + mpy = dx; + } + xycheck(); /* just to complete the job. */ +} + +void note(word hertz) { + if (soundfx) sound(hertz); +} + +void blip() { + byte fv; + + for (fv = 1; fv <= 7; fv ++) { + sound(177 + (fv * 200) % 177); + delay(1); + } + nosound; +} + +string strf(longint x) { + string q; + + string strf_result; + str(x, q); + strf_result = q; + return strf_result; +} + +void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { + byte fv; + + for (fv = 0; fv <= border; fv ++) { + setfillstyle(1, hc); + bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); + bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); + + setfillstyle(1, sc); + bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); + bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); + } +} + +void shbox(integer x1, integer y1, integer x2, integer y2, string t) { + const integer fc = 7; + + off(); + shadow(x1, y1, x2, y2, 15, 8); + setfillstyle(1, fc); + bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); + setcolor(1); + x1 = (x2 - x1) / 2 + x1; + y1 = (y2 - y1) / 2 + y1; + outtextxy(x1, y1, t); + if (length(t) > 1) { + fillchar(t[2], length(t) - 1, '\40'); + t[1] = '_'; + outtextxy(x1 - 1, y1 + 1, t); + } + on(); +} + +void newgame() { /* This sets up the DNA for a completely new game. */ + byte gd, gm; + + for (gm = 1; gm <= numtr; gm ++) { + triptype &with = tr[gm]; + if (with.quick) done(); + } /* Deallocate sprite. Sorry, beta testers! */ + + tr[1].init(0, true); + alive = true; + + score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ + fillchar(dna, sizeof(dna), '\0'); + natural(); + normal_edit(); + mousepage(0); + dna.spare_evening = "answer a questionnaire"; + dna.like2drink = "beer"; + + { + dna.pence = 30; /* 2/6 */ dna.rw = stopped; + dna.wearing = clothes; + dna.obj[money] = true; + dna.obj[bodkin] = true; + dna.obj[bell] = true; + dna.obj[clothes] = true; + } + + thinks = '\2'; + objectlist(); + ontoolbar = false; + seescroll = false; + + ppos[0][1] = -177; /*tr[1].appear(300,117,right);*/ gd = 0; + for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; + /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ + him = '\376'; + her = '\376'; + it = '\376'; + last_person = '\376'; /* = Pardon? */ + dna.pass_num = Random(30) + 1; + after_the_scroll = false; + dna.user_moves_avvy = false; + doing_sprite_run = false; + dna.avvy_in_bed = true; + enid_filename = ""; + + for (gd = 0; gd <= 1; gd ++) { + cp = 1 - cp; + getback(); + } + + enterroom(1, 1); + new_game_for_trippancy(); + showscore(); + + standard_bar(); + clock(); + sprite_run(); +} + +void click() { /* "Audio keyboard feedback" */ + sound(7177); + delay(1); + nosound; +} + +void slowdown() { + /* repeat until TSkellern>=howlong; TSkellern:=0;*/ + do { + ; + } while (!(memw[storage_seg * skellern] >= howlong)); + memw[storage_seg * skellern] = 0; +} + +boolean flagset(char x) { + boolean flagset_result; + flagset_result = pos(x, flags) > 0; + return flagset_result; +} + +void force_numlock() { + if ((locks & num) > 0) locks -= num; +} + +boolean pennycheck(word howmuchby) { + boolean pennycheck_result; + dna.pence -= howmuchby; + if (dna.pence < 0) { + dixi('Q', 2); /* "you are now denariusless!" */ + pennycheck_result = false; + gameover(); + } else + pennycheck_result = true; + return pennycheck_result; +} + +string getname(char whose) { + string getname_result; + if (whose < '\257') getname_result = lads[whose]; + else getname_result = lasses[whose]; + return getname_result; +} + +char getnamechar(char whose) { + char getnamechar_result; + if (whose < '\257') getnamechar_result = ladchar[whose - 1]; + else getnamechar_result = lasschar[whose - 1]; + return getnamechar_result; +} + +string get_thing(char which) { + string get_thing_result; + switch (which) { + case wine: + switch (dna.winestate) { + case 1: + case 4: + get_thing_result = things[which]; + break; + case 3: + get_thing_result = "Vinegar"; + break; + } + break; + case onion: + if (dna.rotten_onion) + get_thing_result = "rotten onion"; + else get_thing_result = things[which]; + break; + default: + get_thing_result = things[which]; + } + return get_thing_result; +} + +char get_thingchar(char which) { + char get_thingchar_result; + switch (which) { + case wine: + if (dna.winestate == 3) get_thingchar_result = 'V'; /* Vinegar */ + else get_thingchar_result = thingchar[which - 1]; + break; + default: + get_thingchar_result = thingchar[which - 1]; + } + return get_thingchar_result; +} + +string get_better(char which) { + string get_better_result; + if (which > '\226') which -= 149; + switch (which) { + case wine: + switch (dna.winestate) { + case 0: + case 1: + case 4: + get_better_result = better[which]; + break; + case 3: + get_better_result = "some vinegar"; + break; + } + break; + case onion: + if (dna.rotten_onion) + get_better_result = "a rotten onion"; + else if (dna.onion_in_vinegar) + get_better_result = "a pickled onion (in the vinegar)"; + else get_better_result = better[which]; + break; + default: + if ((which < numobjs) && (which > '\0')) + get_better_result = better[which]; + else + get_better_result = ""; + } + return get_better_result; } string f5_does() - /* This procedure determines what f5 does. */ -{ - string f5_does_result; - switch (dna.room) { - case r__yours: - { - if (! dna.avvy_is_awake) - { /* He's asleep, =>= wake up. */ - f5_does_result=string(vb_wake)+"WWake up"; - return f5_does_result; - } - - if (dna.avvy_in_bed) - { /* In bed. => = get up. */ - f5_does_result=string(vb_stand)+"GGet up"; - return f5_does_result; - } - - } - break; - - case r__insidecardiffcastle: - { - if (dna.standing_on_dais) - f5_does_result=string(vb_climb)+"CClimb down"; - else - f5_does_result=string(vb_climb)+"CClimb up"; - return f5_does_result; - } - break; - - case r__nottspub: - { - if (dna.sitting_in_pub) - f5_does_result=string(vb_stand)+"SStand up"; - else - f5_does_result=string(vb_sit)+"SSit down"; - return f5_does_result; - } - break; - - case r__musicroom: - if (infield(7)) - { - f5_does_result=string(vb_play)+"PPlay the harp"; - return f5_does_result; - } - break; - } - - f5_does_result=pardon; /* If all else fails... */ - return f5_does_result; -} - -void plot_vmc(integer xx,integer yy, byte page_) -{ - if (visible!=m_virtual) return; - { - xx=xx+vmc.ofsx; if (xx<0) xx=0; - yy=yy+vmc.ofsy; if (yy<0) yy=0; +/* This procedure determines what f5 does. */ +{ + string f5_does_result; + switch (dna.room) { + case r__yours: { + if (! dna.avvy_is_awake) { + /* He's asleep, =>= wake up. */ + f5_does_result = string(vb_wake) + "WWake up"; + return f5_does_result; + } + + if (dna.avvy_in_bed) { + /* In bed. => = get up. */ + f5_does_result = string(vb_stand) + "GGet up"; + return f5_does_result; + } + + } + break; + + case r__insidecardiffcastle: { + if (dna.standing_on_dais) + f5_does_result = string(vb_climb) + "CClimb down"; + else + f5_does_result = string(vb_climb) + "CClimb up"; + return f5_does_result; + } + break; + + case r__nottspub: { + if (dna.sitting_in_pub) + f5_does_result = string(vb_stand) + "SStand up"; + else + f5_does_result = string(vb_sit) + "SSit down"; + return f5_does_result; + } + break; + + case r__musicroom: + if (infield(7)) { + f5_does_result = string(vb_play) + "PPlay the harp"; + return f5_does_result; + } + break; + } + + f5_does_result = pardon; /* If all else fails... */ + return f5_does_result; +} + +void plot_vmc(integer xx, integer yy, byte page_) { + if (visible != m_virtual) return; + { + xx = xx + vmc.ofsx; + if (xx < 0) xx = 0; + yy = yy + vmc.ofsy; + if (yy < 0) yy = 0; - setactivepage(1-cp); - getimage(xx,yy,xx+15,yy+15,vmc.backpic[page_]); - putimage(xx,yy,vmc.andpic,andput); - putimage(xx,yy,vmc.xorpic,xorput); + setactivepage(1 - cp); + getimage(xx, yy, xx + 15, yy + 15, vmc.backpic[page_]); + putimage(xx, yy, vmc.andpic, andput); + putimage(xx, yy, vmc.xorpic, xorput); -/* setcolor( 0); outtextxy(xx+8,yy+16,''); outtextxy(xx,yy+16,''); - setcolor(11+page); - outtextxy(xx+8,yy+16,chr(48+roomtime mod 10)); - outtextxy(xx ,yy+16,chr(48+(roomtime div 10) mod 10));*/ + /* setcolor( 0); outtextxy(xx+8,yy+16,''); outtextxy(xx,yy+16,''); + setcolor(11+page); + outtextxy(xx+8,yy+16,chr(48+roomtime mod 10)); + outtextxy(xx ,yy+16,chr(48+(roomtime div 10) mod 10));*/ - { - pointtype& with1 = vmc.wherewas[page_]; + { + pointtype &with1 = vmc.wherewas[page_]; - with1.x=xx; - with1.y=yy; - } - } + with1.x = xx; + with1.y = yy; + } + } } -void wipe_vmc(byte page_) -{ - if (visible!=m_virtual) return; - { pointtype& with1 = vmc.wherewas[page_]; - if (with1.x!=maxint) - putimage(with1.x,with1.y,vmc.backpic[page_],0);} +void wipe_vmc(byte page_) { + if (visible != m_virtual) return; + { + pointtype &with1 = vmc.wherewas[page_]; + if (with1.x != maxint) + putimage(with1.x, with1.y, vmc.backpic[page_], 0); + } } -void setup_vmc() -{ - byte fv; +void setup_vmc() { + byte fv; - { - getmem(vmc.andpic,mouse_size); - getmem(vmc.xorpic,mouse_size); + { + getmem(vmc.andpic, mouse_size); + getmem(vmc.xorpic, mouse_size); - for( fv=0; fv <= 1; fv ++) - { - getmem(vmc.backpic[fv],mouse_size); - vmc.wherewas[fv].x=maxint; - } - } + for (fv = 0; fv <= 1; fv ++) { + getmem(vmc.backpic[fv], mouse_size); + vmc.wherewas[fv].x = maxint; + } + } } -void clear_vmc() -{ - byte fv; +void clear_vmc() { + byte fv; - for( fv=0; fv <= 1; fv ++) vmc.wherewas[fv].x=maxint; + for (fv = 0; fv <= 1; fv ++) vmc.wherewas[fv].x = maxint; } -void setminmaxhorzcurspos(word min,word max) /* phew */ -{ - { - ax=7; - cx=min; - dx=max; - } - intr(0x33,r); +void setminmaxhorzcurspos(word min, word max) { /* phew */ + { + ax = 7; + cx = min; + dx = max; + } + intr(0x33, r); } -void setminmaxvertcurspos(word min,word max) -{ - { - ax=8; /* A guess. In the book, 7 */ - cx=min; - dx=max; - } - intr(0x33,r); +void setminmaxvertcurspos(word min, word max) { + { + ax = 8; /* A guess. In the book, 7 */ + cx = min; + dx = max; + } + intr(0x33, r); } -void load_a_mouse(byte which) -{ - untyped_file f; +void load_a_mouse(byte which) { + untyped_file f; - assign(f,"mice.avd"); - reset(f,1); - seek(f,mouse_size*2*(which-1)+134); + assign(f, "mice.avd"); + reset(f, 1); + seek(f, mouse_size * 2 * (which - 1) + 134); - { - blockread(f,vmc.andpic,mouse_size); - blockread(f,vmc.xorpic,mouse_size); - close(f); - { - mp& with1 = mps[which]; + { + blockread(f, vmc.andpic, mouse_size); + blockread(f, vmc.xorpic, mouse_size); + close(f); + { + mp &with1 = mps[which]; - vmc.ofsx=-with1.horzhotspot; - vmc.ofsy=-with1.verthotspot; + vmc.ofsx = -with1.horzhotspot; + vmc.ofsy = -with1.verthotspot; - setminmaxhorzcurspos(with1.horzhotspot+3,624+with1.horzhotspot); - setminmaxvertcurspos(with1.verthotspot,199); - } - } + setminmaxhorzcurspos(with1.horzhotspot + 3, 624 + with1.horzhotspot); + setminmaxvertcurspos(with1.verthotspot, 199); + } + } } -void background(byte x) { setbkcolor(x); } +void background(byte x) { + setbkcolor(x); +} -void hang_around_for_a_while() -{ - byte fv; +void hang_around_for_a_while() { + byte fv; - for( fv=1; fv <= 28; fv ++) slowdown(); + for (fv = 1; fv <= 28; fv ++) slowdown(); } -boolean mouse_near_text() -{ - boolean mouse_near_text_result; - mouse_near_text_result=(my>144) && (my<188); - return mouse_near_text_result; +boolean mouse_near_text() { + boolean mouse_near_text_result; + mouse_near_text_result = (my > 144) && (my < 188); + return mouse_near_text_result; } /* Super_Off and Super_On are two very useful procedures. Super_Off switches the mouse cursor off, WHATEVER it's like. Super_On restores it again afterwards. */ -void super_off() -{ - super_was_off=visible==m_no; - if (super_was_off) return; +void super_off() { + super_was_off = visible == m_no; + if (super_was_off) return; - super_was_virtual=visible==m_virtual; + super_was_virtual = visible == m_virtual; - if (visible==m_virtual) off_virtual(); else off(); + if (visible == m_virtual) off_virtual(); + else off(); } -void super_on() -{ - if ((visible!=m_no) || (super_was_off)) return; +void super_on() { + if ((visible != m_no) || (super_was_off)) return; - if (super_was_virtual) on_virtual(); else on(); + if (super_was_virtual) on_virtual(); + else on(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 22d7544dab00..d08bf8667008 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -50,338 +50,415 @@ const integer mouse_size = 134; typedef void(*proc)(); struct postype { - word x,y,datapos; byte length; + word x, y, datapos; + byte length; }; struct mp { /* mouse-pointer */ - matrix<0,1,0,15,word> mask; - integer horzhotspot,verthotspot; + matrix<0, 1, 0, 15, word> mask; + integer horzhotspot, verthotspot; }; -struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ - byte rw; /* Realway- just for convenience! */ - byte carrying; /* how many objects you're carrying... */ - array<'\1',numobjs,boolean> obj; /* ...and which ones they are. */ - integer score; /* your score, of course */ - longint pence; /* your current amount of dosh */ - byte room; /* your current room */ - char wearing; /* what you're wearing */ - byte swore; /* number of times you've sworn */ - byte saves; /* number of times this game has been saved */ - array<1,100,byte> rooms; /* Add one to each every time +struct dnatype { + /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ + byte rw; /* Realway- just for convenience! */ + byte carrying; /* how many objects you're carrying... */ + array < '\1', numobjs, boolean > obj; /* ...and which ones they are. */ + integer score; /* your score, of course */ + longint pence; /* your current amount of dosh */ + byte room; /* your current room */ + char wearing; /* what you're wearing */ + byte swore; /* number of times you've sworn */ + byte saves; /* number of times this game has been saved */ + array<1, 100, byte> rooms; /* Add one to each every time you enter a room */ - byte alcohol; /* Your blood alcohol level. */ - byte playednim; /* How many times you've played Nim. */ - boolean wonnim; /* Have you *won* Nim? (That's harder.) */ - byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ - boolean cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ - - byte pass_num; /* Number of the password for this game. */ - boolean ayles_is_awake; /* pretty obvious! */ - byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ - byte avaricius_talk; /* How much Avaricius has said to you. */ - boolean bought_onion; /* Have you bought an onion yet? */ - boolean rotten_onion; /* And has it rotted? */ - boolean onion_in_vinegar; /* Is the onion in the vinegar? */ - - byte given2spludwick; /* 0 = nothing given, 1 = onion... */ - byte brummie_stairs; /* Progression through the stairs trick. */ - byte cardiff_things; /* Things you get asked in Cardiff. */ - - boolean cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ - - boolean avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ - boolean avvy_in_bed; /* True if Avvy's in bed, but awake. */ - - boolean user_moves_avvy; /* If this is false, the user has no + byte alcohol; /* Your blood alcohol level. */ + byte playednim; /* How many times you've played Nim. */ + boolean wonnim; /* Have you *won* Nim? (That's harder.) */ + byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ + boolean cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ + + byte pass_num; /* Number of the password for this game. */ + boolean ayles_is_awake; /* pretty obvious! */ + byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ + byte avaricius_talk; /* How much Avaricius has said to you. */ + boolean bought_onion; /* Have you bought an onion yet? */ + boolean rotten_onion; /* And has it rotted? */ + boolean onion_in_vinegar; /* Is the onion in the vinegar? */ + + byte given2spludwick; /* 0 = nothing given, 1 = onion... */ + byte brummie_stairs; /* Progression through the stairs trick. */ + byte cardiff_things; /* Things you get asked in Cardiff. */ + + boolean cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ + + boolean avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ + boolean avvy_in_bed; /* True if Avvy's in bed, but awake. */ + + boolean user_moves_avvy; /* If this is false, the user has no control over Avvy's movements. */ - byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ + byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ - boolean givenbadgetoiby; /* Have you given the badge to Iby yet? */ + boolean givenbadgetoiby; /* Have you given the badge to Iby yet? */ - boolean friar_will_tie_you_up; /* If you're going to get tied up. */ - boolean tied_up; /* You ARE tied up! */ + boolean friar_will_tie_you_up; /* If you're going to get tied up. */ + boolean tied_up; /* You ARE tied up! */ - char box_contents; /* 0 = money (sixpence), 254 = empty, any + char box_contents; /* 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. */ - boolean talked_to_crapulus; /* Pretty self-explanatory. */ + boolean talked_to_crapulus; /* Pretty self-explanatory. */ - byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ + byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ - boolean ringing_bells; /* Is Jacques ringing the bells? */ + boolean ringing_bells; /* Is Jacques ringing the bells? */ - boolean standing_on_dais; /* In room 71, inside Cardiff Castle. */ - boolean taken_pen; /* Have you taken the pen (in Cardiff?) */ - boolean arrow_triggered; /* And has the arrow been triggered? */ - boolean arrow_in_the_door; /* Did the arrow hit the wall? */ + boolean standing_on_dais; /* In room 71, inside Cardiff Castle. */ + boolean taken_pen; /* Have you taken the pen (in Cardiff?) */ + boolean arrow_triggered; /* And has the arrow been triggered? */ + boolean arrow_in_the_door; /* Did the arrow hit the wall? */ - varying_string<77> like2drink, - favourite_song, - worst_place_on_earth, - spare_evening; /* Personalisation str's */ + varying_string<77> like2drink, + favourite_song, + worst_place_on_earth, + spare_evening; /* Personalisation str's */ - longint total_time; /* Your total time playing this game, in ticks.*/ + longint total_time; /* Your total time playing this game, in ticks.*/ - byte jumpstatus; /* Fixes how high you're jumping. */ + byte jumpstatus; /* Fixes how high you're jumping. */ - boolean mushroom_growing; /* Is the mushroom growing in 42? */ + boolean mushroom_growing; /* Is the mushroom growing in 42? */ - boolean spludwicks_here; /* Is Spludwick at home? */ + boolean spludwicks_here; /* Is Spludwick at home? */ - byte last_room; - byte last_room_not_map; + byte last_room; + byte last_room_not_map; - boolean crapulus_will_tell; /* Will Crapulus tell you about + boolean crapulus_will_tell; /* Will Crapulus tell you about Spludwick being away? */ - boolean enter_catacombs_from_lusties_room; - boolean teetotal; /* Are we touching any more drinks? */ - byte malagauche; /* Position of Malagauche. See Celer for more info. */ - char drinking; /* What's he getting you? */ + boolean enter_catacombs_from_lusties_room; + boolean teetotal; /* Are we touching any more drinks? */ + byte malagauche; /* Position of Malagauche. See Celer for more info. */ + char drinking; /* What's he getting you? */ - boolean entered_lusties_room_as_monk; + boolean entered_lusties_room_as_monk; - byte cat_x, cat_y; /* XY coords in the catacombs. */ + byte cat_x, cat_y; /* XY coords in the catacombs. */ - boolean avvys_in_the_cupboard; /* On screen 22. */ + boolean avvys_in_the_cupboard; /* On screen 22. */ - boolean geida_follows; /* Is Geida following you? */ + boolean geida_follows; /* Is Geida following you? */ - byte geida_spin,geida_time; /* For the making "Geida dizzy" joke. */ + byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ - byte nextbell; /* For the ringing. */ + byte nextbell; /* For the ringing. */ - boolean geida_given_potion; /* Does Geida have the potion? */ - boolean lustie_is_asleep; /* Is BDL asleep? */ + boolean geida_given_potion; /* Does Geida have the potion? */ + boolean lustie_is_asleep; /* Is BDL asleep? */ - byte flip_to_where, flip_to_ped; /* For the sequencer. */ + byte flip_to_where, flip_to_ped; /* For the sequencer. */ - boolean been_tied_up; /* In r__Robins. */ + boolean been_tied_up; /* In r__Robins. */ - boolean sitting_in_pub; /* Are you sitting down in the pub? */ - byte spurge_talk; /* Count for talking to Spurge. */ + boolean sitting_in_pub; /* Are you sitting down in the pub? */ + byte spurge_talk; /* Count for talking to Spurge. */ - boolean met_avaroid; + boolean met_avaroid; - boolean taken_mushroom, - given_pen_to_ayles, - asked_dogfood_about_nim; + boolean taken_mushroom, + given_pen_to_ayles, + asked_dogfood_about_nim; }; struct pedtype { - integer x,y; byte dir; + integer x, y; + byte dir; }; struct magictype { - byte op; /* one of the operations */ - word data; /* data for them */ + byte op; /* one of the operations */ + word data; /* data for them */ }; class fieldtype { public: - integer x1,y1,x2,y2; + integer x1, y1, x2, y2; }; struct bytefield { - byte x1,y1,x2,y2; + byte x1, y1, x2, y2; }; class linetype : public fieldtype { public: - byte col; + byte col; }; struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; -typedef matrix<'\0','\377',0,15,byte> raw; /* raw_font_type */ +typedef matrix < '\0', '\377', 0, 15, byte > raw; /* raw_font_type */ -enum controllers {cjoy,ckey, last_controllers}; +enum controllers {cjoy, ckey, last_controllers}; -typedef array<1,20,varying_string<77> > previoustype; +typedef array<1, 20, varying_string<77> > previoustype; struct corridor_type { /* Decarations for the corridors. */ - word doors; /* Door styles are calc'ed from this word. + word doors; /* Door styles are calc'ed from this word. Assign a different number to each one! */ }; struct demo_type { - word delay; - char key,extd; + word delay; + char key, extd; }; struct quasiped_type { - byte whichped,fgc,room,bgc; char who; + byte whichped, fgc, room, bgc; + char who; }; /* A quasiped defines how people who aren't sprites talk. For example, quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. */ -typedef array<1,31,byte> tunetype; +typedef array<1, 31, byte> tunetype; struct vmctype { /* Virtual Mouse Cursor */ - pointer andpic,xorpic; - array<0,1,pointer> backpic; - array<0,1,pointtype> wherewas; - byte picnumber; - shortint ofsx,ofsy; + pointer andpic, xorpic; + array<0, 1, pointer> backpic; + array<0, 1, pointtype> wherewas; + byte picnumber; + shortint ofsx, ofsy; }; -struct sundry { /* Things which must be saved over a backtobootstrap, - outside DNA. */ - pathstr qenid_filename; - boolean qsoundfx; - char qthinks; - boolean qthinkthing; +struct sundry { + /* Things which must be saved over a backtobootstrap, + outside DNA. */ + pathstr qenid_filename; + boolean qsoundfx; + char qthinks; + boolean qthinkthing; }; struct joysetup { - word xmid,ymid,xmin,ymin,xmax,ymax; - byte centre; /* Size of centre in tenths */ + word xmid, ymid, xmin, ymin, xmax, ymax; + byte centre; /* Size of centre in tenths */ }; struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1,9,char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d,m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ + /* This header starts at byte offset 177 in the .ASG file. */ + array<1, 9, char> id; /* signature */ + word revision; /* EDNA revision, here 2 (1=dna256) */ + varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ + varying_string<15> shortname; /* Short name, eg Avalot */ + word number; /* Game's code number, here 2 */ + word ver; /* Version number as integer (eg 1.00 = 100) */ + varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ + varying_string<12> filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + varying_string<5> os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + word y; /* ...saved on. */ + varying_string<40> desc; /* Description of game (same as in Avaricius!) */ + word len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + word saves; /* no. of times this game has been saved */ + integer cash; /* contents of your wallet in numerical form */ + varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ + word points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ }; - /* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST + 7 = Archimedes */ const char vernum[] = "1.30"; const char copyright[] = "1995"; const integer thisvercode = 130; - /* as "vernum", but numerically & without the ".". */ +/* as "vernum", but numerically & without the ".". */ const integer thisgamecode = 2; /* Avalot's code number */ /* Objects you can hold: */ - const char wine = '\1'; const char money = '\2'; const char bodkin = '\3'; const char potion = '\4'; const char chastity = '\5'; const char bolt = '\6'; - const char crossbow = '\7'; const char lute = '\10'; const char badge = '\11'; const char mushroom = '\12'; const char key = '\13'; const char bell = '\14'; - const char prescription = '\15'; const char pen = '\16'; const char ink = '\17'; const char clothes = '\20'; const char habit = '\21'; const char onion = '\22'; +const char wine = '\1'; +const char money = '\2'; +const char bodkin = '\3'; +const char potion = '\4'; +const char chastity = '\5'; +const char bolt = '\6'; +const char crossbow = '\7'; +const char lute = '\10'; +const char badge = '\11'; +const char mushroom = '\12'; +const char key = '\13'; +const char bell = '\14'; +const char prescription = '\15'; +const char pen = '\16'; +const char ink = '\17'; +const char clothes = '\20'; +const char habit = '\21'; +const char onion = '\22'; /* People who hang around this game. */ /* Boys: */ -const char pavalot = '\226'; const char pspludwick = '\227'; const char pcrapulus = '\230'; const char pdrduck = '\231'; -const char pmalagauche = '\232'; const char pfriartuck = '\233'; const char probinhood = '\234'; const char pcwytalot = '\235'; -const char pdulustie = '\236'; const char pduke = '\237'; const char pdogfood = '\240'; const char ptrader = '\241'; -const char pibythneth = '\242'; const char payles = '\243'; const char pport = '\244'; const char pspurge = '\245'; const char pjacques = '\246'; +const char pavalot = '\226'; +const char pspludwick = '\227'; +const char pcrapulus = '\230'; +const char pdrduck = '\231'; +const char pmalagauche = '\232'; +const char pfriartuck = '\233'; +const char probinhood = '\234'; +const char pcwytalot = '\235'; +const char pdulustie = '\236'; +const char pduke = '\237'; +const char pdogfood = '\240'; +const char ptrader = '\241'; +const char pibythneth = '\242'; +const char payles = '\243'; +const char pport = '\244'; +const char pspurge = '\245'; +const char pjacques = '\246'; /* Girls: */ -const char parkata = '\257'; const char pgeida = '\260'; const char pwisewoman = '\262'; +const char parkata = '\257'; +const char pgeida = '\260'; +const char pwisewoman = '\262'; const integer xw = 30; const integer yw = 36; /* x width & y whatsit */ const integer margin = 5; -const array<1,9,mp> mps = -{{{ /* 1 - up-arrow */ - {{{{65151,64575,64575,63519,63519,61455,61455,57351,57351,49155,49155,64575,64575,64575,64575,64575}}, - {{0,384,384,960,960,2016,2016,4080,4080,8184,384,384,384,384,384,0}}}}, - 8, - 0}, - -{ /* 2 - screwdriver */ - {{{{8191,4095,2047,34815,50175,61951,63743,64543,65039,65031,65027,65281,65408,65472,65505,65523}}, - {{0,24576,28672,12288,2048,1024,512,256,224,176,216,96,38,10,12,0}}}}, - 0, - 0}, - -{ /* 3 - right-arrow */ - {{{{65535,65535,64639,64543,7,1,0,1,7,64543,64639,65535,65535,65535,65535,65535}}, - {{0,0,0,384,480,32760,32766,32760,480,384,0,0,0,0,0,0}}}}, - 15, - 6}, - -{ /* 4 - fletch */ - {{{{255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511}}, - {{0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0}}}}, - 0, - 0}, - -{ /* 5 - hourglass */ - {{{{0,0,0,34785,50115,61455,61455,63519,63519,61839,61455,49155,32769,0,0,0}}, - {{0,32766,16386,12300,2064,1440,1440,576,576,1056,1440,3024,14316,16386,32766,0}}}}, - 8, - 7}, - -{ /* 6 - TTHand */ - {{{{62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443}}, - {{3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092}}}}, - 4, - 0}, - -{ /* 7- Mark's crosshairs */ - {{{{65535,65151,65151,65151,65151,0,65151,65151,65151,65151,65535,65535,65535,65535,65535,65535}}, - {{0,384,384,384,384,65535,384,384,384,384,0,0,0,0,0,0}}}}, - 8, - 5}, - -{ /* 8- I-beam. */ - {{{{65535,65535,63631,63503,63503,65087,65087,65087,65087,65087,63503,63503,63631,65535,65535,65535}}, - {{0,0,0,864,128,128,128,128,128,128,128,864,0,0,0,0}}}}, - 8, - 7}, - -{ /* 9- Question mark. */ - {{{{511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695}}, - {{65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840}}}}, - 0, - 0}}}; - -const array<'\226','\246',varying_string<19> > lads = - {{"Avalot","Spludwick","Crapulus","Dr. Duck","Malagauche","Friar Tuck", - "Robin Hood","Cwytalot","du Lustie","the Duke of Cardiff","Dogfood", - "A trader","Ibythneth","Ayles","Port","Spurge","Jacques"}}; - -const array<'\257','\262',varying_string<14> > lasses = - {{"Arkata","Geida",'',"the Wise Woman"}}; - - const array<'\226','\245',char> ladchar = "ASCDMTRwLfgeIyPu"; - -const array<'\257','\262',char> lasschar = "kGo"; +const array<1, 9, mp> mps = { + { { + /* 1 - up-arrow */ + { { {{65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}}, + {{0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0}} + } + }, + 8, + 0 + }, + + { + /* 2 - screwdriver */ + { { {{8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}}, + {{0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0}} + } + }, + 0, + 0 + }, + + { + /* 3 - right-arrow */ + { { {{65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}}, + {{0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0}} + } + }, + 15, + 6 + }, + + { + /* 4 - fletch */ + { { {{255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}}, + {{0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0}} + } + }, + 0, + 0 + }, + + { + /* 5 - hourglass */ + { { {{0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}}, + {{0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0}} + } + }, + 8, + 7 + }, + + { + /* 6 - TTHand */ + { { {{62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}}, + {{3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092}} + } + }, + 4, + 0 + }, + + { + /* 7- Mark's crosshairs */ + { { {{65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}}, + {{0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0}} + } + }, + 8, + 5 + }, + + { + /* 8- I-beam. */ + { { {{65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}}, + {{0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0}} + } + }, + 8, + 7 + }, + + { + /* 9- Question mark. */ + { { {{511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}}, + {{65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840}} + } + }, + 0, + 0 + } + } +}; + +const array < '\226', '\246', varying_string<19> > lads = { + { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", + "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", + "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + } +}; + +const array < '\257', '\262', varying_string<14> > lasses = +{{"Arkata", "Geida", '', "the Wise Woman"}}; + +const array < '\226', '\245', char > ladchar = "ASCDMTRwLfgeIyPu"; + +const array < '\257', '\262', char > lasschar = "kGo"; const integer numtr = 2; /* current max no. of sprites */ -const boolean a_thing = true; const boolean a_person = false; /* for Thinkabout */ +const boolean a_thing = true; +const boolean a_person = false; /* for Thinkabout */ /* Magic/portal commands are */ @@ -395,7 +472,7 @@ const boolean a_thing = true; const boolean a_person = false; /* for Thinkabout /* These following constants should be included in CFG when it's written. */ - const boolean slow_computer = false; /* stops walking when mouse touches toolbar */ +const boolean slow_computer = false; /* stops walking when mouse touches toolbar */ /* --- */ @@ -403,58 +480,66 @@ const integer border = 1; /* size of border on shadowboxes */ const integer pagetop = 81920; - const integer up = 0; +const integer up = 0; const integer right = 1; - const integer down = 2; - const integer left = 3; -const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; - const integer stopped = 8; +const integer down = 2; +const integer left = 3; +const integer ur = 4; +const integer dr = 5; +const integer dl = 6; +const integer ul = 7; +const integer stopped = 8; const integer walk = 3; const integer run = 5; /*$I ROOMNUMS.INC - Room number constants (r__xxx) */ -const array<'\226','\262',byte> whereis = +const array < '\226', '\262', byte > whereis = /* The Lads */ - {{r__yours, /* Avvy */ - r__spludwicks, /* Spludwick */ - r__outsideyours, /* Crapulus */ - r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - r__argentpub, /* Malagauche */ - r__robins, /* Friar Tuck. */ - 177, /* Robin Hood - can't meet him at the start. */ - r__brummieroad, /* Cwytalot */ - r__lustiesroom, /* Baron du Lustie. */ - r__outsidecardiffcastle, /* The Duke of Cardiff. */ - r__argentpub, /* Dogfood */ - r__outsideducks, /* Trader */ - r__argentpub, /* Ibythneth */ - r__aylesoffice, /* Ayles */ - r__nottspub, /* Port */ - r__nottspub, /* Spurge */ - r__musicroom, /* Jacques */ - 0,0,0,0,0,0,0,0, - /* The Lasses */ - r__yours, /* Arkata */ - r__geidas, /* Geida */ - 177, /* nobody allocated here! */ - r__wisewomans}}; /* The Wise Woman. */ +{ { + r__yours, /* Avvy */ + r__spludwicks, /* Spludwick */ + r__outsideyours, /* Crapulus */ + r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + r__argentpub, /* Malagauche */ + r__robins, /* Friar Tuck. */ + 177, /* Robin Hood - can't meet him at the start. */ + r__brummieroad, /* Cwytalot */ + r__lustiesroom, /* Baron du Lustie. */ + r__outsidecardiffcastle, /* The Duke of Cardiff. */ + r__argentpub, /* Dogfood */ + r__outsideducks, /* Trader */ + r__argentpub, /* Ibythneth */ + r__aylesoffice, /* Ayles */ + r__nottspub, /* Port */ + r__nottspub, /* Spurge */ + r__musicroom, /* Jacques */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* The Lasses */ + r__yours, /* Arkata */ + r__geidas, /* Geida */ + 177, /* nobody allocated here! */ + r__wisewomans + } +}; /* The Wise Woman. */ /* Art gallery at 2,1; notice about this at 2,2. */ -const matrix<1,8,1,8,longint> catamap = - /* Geida's room */ - /* 1 2 3 | 4 5 6 7 8*/ -{{{{0x204,0x200,0xd0f0,0xf0ff,0xff,0xd20f,0xd200,0x200}}, - {{0x50f1,0x20ff,0x2ff,0xff,0xe0ff,0x20ff,0x200f,0x7210}}, - {{0xe3f0,0xe10f,0x72f0,0xff,0xe0ff,0xff,0xff,0x800f}}, - {{0x2201,0x2030,0x800f,0x220,0x20f,0x30,0xff,0x23f}}, /* >> Oubliette */ - {{0x5024,0xf3,0xff,0x200f,0x22f0,0x20f,0x200,0x7260}}, - {{0xf0,0x2ff,0xe2ff,0xff,0x200f,0x50f0,0x72ff,0x201f}}, - {{0xf6,0x220f,0x22f0,0x30f,0xf0,0x20f,0x8200,0x2f0}}, /* <<< In here */ - {{0x34,0x200f,0x51f0,0x201f,0xf1,0x50ff,0x902f,0x2062}}}}; - /* vv Stairs trap. */ +const matrix<1, 8, 1, 8, longint> catamap = + /* Geida's room */ + /* 1 2 3 | 4 5 6 7 8*/ +{ { {{0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}}, + {{0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}}, + {{0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}}, + {{0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}}, /* >> Oubliette */ + {{0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}}, + {{0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}}, + {{0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}}, /* <<< In here */ + {{0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062}} + } +}; +/* vv Stairs trap. */ /* Explanation: $NSEW. Nibble N: North. @@ -493,45 +578,50 @@ const matrix<1,8,1,8,longint> catamap = F = straight-through corridor. */ const byte interrogation = 0; - /* If this is greater than zero, the next line you type is stored in - the DNA in a position dictated by the value. If a scroll comes up, - or you leave the room, it's automatically set to zero. */ +/* If this is greater than zero, the next line you type is stored in + the DNA in a position dictated by the value. If a scroll comes up, + or you leave the room, it's automatically set to zero. */ const boolean demo = false; /* If this is true, we're in a demo of the game. */ -const array<0,2,char> spludwick_order = {{onion,ink,mushroom}}; - -const array<10,25,quasiped_type> quasipeds = -{{{2,lightgray, 19,brown,pdogfood}, /* A: Dogfood (screen 19). */ -{3,green, 19,white,pibythneth}, /* B: Ibythneth (screen 19). */ -{3,white, 1,magenta,parkata}, /* C: Arkata (screen 1). */ -{3,black, 23,red,'\261'}, /* D: Hawk (screen 23). */ -{3,lightgreen,50,brown,ptrader}, /* E: Trader (screen 50). */ -{6,yellow, 42,red,pavalot}, /* F: Avvy, tied up (scr.42) */ -{2,blue, 16,white,payles}, /* G: Ayles (screen 16). */ -{2,brown, 7,white,pjacques}, /* H: Jacques (screen 7). */ -{2,lightgreen,47,green,pspurge}, /* I: Spurge (screen 47). */ -{3,yellow, 47,red,pavalot}, /* J: Avalot (screen 47). */ -{2,lightgray, 23,black,pdulustie}, /* K: du Lustie (screen 23). */ -{2,yellow, 27,red,pavalot}, /* L: Avalot (screen 27). */ -{3,white, 27,red,'\261'}, /* M: Avaroid (screen 27). */ -{4,lightgray, 19,darkgray,pmalagauche}, /*N: Malagauche (screen 19). */ -{5,lightmagenta,47,red,pport}, /* O: Port (screen 47). */ -{2,lightgreen, 51,darkgray,pdrduck}}}; /*P: Duck (screen 51). */ - - const integer lower = 0; - const integer same = 1; +const array<0, 2, char> spludwick_order = {{onion, ink, mushroom}}; + +const array<10, 25, quasiped_type> quasipeds = { + { {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ + {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ + {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ + {3, black, 23, red, '\261'}, /* D: Hawk (screen 23). */ + {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ + {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ + {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ + {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ + {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ + {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ + {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ + {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ + {3, white, 27, red, '\261'}, /* M: Avaroid (screen 27). */ + {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ + {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ + {2, lightgreen, 51, darkgray, pdrduck} + } +}; /*P: Duck (screen 51). */ + +const integer lower = 0; +const integer same = 1; const integer higher = 2; -const array<1,12,char> keys = "QWERTYUIOP[]"; -const array<1,12,word> notes = - {{196,220,247,262,294,330,350,392,440,494,523,587}}; - -const tunetype tune = - {{higher,higher,lower,same,higher,higher,lower,higher,higher,higher, - lower,higher,higher, - same,higher,lower,lower,lower,lower,higher,higher,lower,lower,lower, - lower,same,lower,higher,same,lower,higher}}; +const array<1, 12, char> keys = "QWERTYUIOP[]"; +const array<1, 12, word> notes = +{{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}}; + +const tunetype tune = { + { + higher, higher, lower, same, higher, higher, lower, higher, higher, higher, + lower, higher, higher, + same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, + lower, same, lower, higher, same, lower, higher + } +}; /* special run-time errors */ @@ -543,59 +633,74 @@ const integer runerr_getset_overflow = 50; #define EXTERN #endif -EXTERN varying_string<77> current; EXTERN byte curpos; EXTERN boolean cursoron; +EXTERN varying_string<77> current; +EXTERN byte curpos; +EXTERN boolean cursoron; /* previous:^previoustype;*/ EXTERN varying_string<77> last; EXTERN dnatype dna; -EXTERN array<1,50,linetype> lines; /* For Also. */ +EXTERN array<1, 50, linetype> lines; /* For Also. */ EXTERN integer c; EXTERN registers r; EXTERN enum { m_no , m_yes , m_virtual } visible; -EXTERN boolean dropsok,screturn,soundfx,cheat; -EXTERN word mx,my; /* mouse x & y now */ -EXTERN word mpx,mpy; /* mouse x & y when pressed */ -EXTERN word mrx,mry; /* mouse x & y when released */ -EXTERN byte mpress,mrelease; /* times left mouse button has been pressed/released */ +EXTERN boolean dropsok, screturn, soundfx, cheat; +EXTERN word mx, my; /* mouse x & y now */ +EXTERN word mpx, mpy; /* mouse x & y when pressed */ +EXTERN word mrx, mry; /* mouse x & y when released */ +EXTERN byte mpress, mrelease; /* times left mouse button has been pressed/released */ EXTERN byte keystatus; /* Mouse key status */ -EXTERN array<1,10,varying_string<20> > un; -EXTERN byte unn; EXTERN string mousetext; +EXTERN array<1, 10, varying_string<20> > un; +EXTERN byte unn; +EXTERN string mousetext; /* which:array[0..5] of byte;*/ -EXTERN pointer p; EXTERN boolean weirdword; -EXTERN byte to_do; EXTERN boolean lmo,mousemade; -EXTERN array<1,15,varying_string<50> > scroll; -EXTERN byte scrolln,score,whichwas; EXTERN char thinks; EXTERN boolean thinkthing; +EXTERN pointer p; +EXTERN boolean weirdword; +EXTERN byte to_do; +EXTERN boolean lmo, mousemade; +EXTERN array<1, 15, varying_string<50> > scroll; +EXTERN byte scrolln, score, whichwas; +EXTERN char thinks; +EXTERN boolean thinkthing; /* pp:array[1..1000] of postype; bb:array[1..9000] of byte;*/ -EXTERN word pptr,bptr; -EXTERN matrix<0,0,0,1,integer> ppos; -EXTERN array<1,24,word> pozzes; -EXTERN byte anim; EXTERN pointer copier; -EXTERN integer talkx,talky; EXTERN byte talkb,talkf; +EXTERN word pptr, bptr; +EXTERN matrix<0, 0, 0, 1, integer> ppos; +EXTERN array<1, 24, word> pozzes; +EXTERN byte anim; +EXTERN pointer copier; +EXTERN integer talkx, talky; +EXTERN byte talkb, talkf; EXTERN byte scrollbells; /* no. of times to ring the bell */ -EXTERN boolean ontoolbar,seescroll; - -EXTERN array<1,10,char> objlist; -EXTERN array<'0','9',pointer> digit; -EXTERN array<0,8,pointer> rwlite; EXTERN byte oldrw; -EXTERN varying_string<3> lastscore; EXTERN byte cmp; /* current mouse-pointer */ +EXTERN boolean ontoolbar, seescroll; + +EXTERN array<1, 10, char> objlist; +EXTERN array < '0', '9', pointer > digit; +EXTERN array<0, 8, pointer> rwlite; +EXTERN byte oldrw; +EXTERN varying_string<3> lastscore; +EXTERN byte cmp; /* current mouse-pointer */ EXTERN varying_string<10> verbstr; /* what you can do with your object. :-) */ -EXTERN matrix<0,30,0,1,string*> also; -EXTERN array<1,15,pedtype> peds; -EXTERN array<1,15,magictype> magics; -EXTERN array<9,15,magictype> portals; -EXTERN array<1,30,fieldtype> fields; EXTERN byte numfields; -EXTERN varying_string<26> flags; EXTERN string listen; +EXTERN matrix<0, 30, 0, 1, string *> also; +EXTERN array<1, 15, pedtype> peds; +EXTERN array<1, 15, magictype> magics; +EXTERN array<9, 15, magictype> portals; +EXTERN array<1, 30, fieldtype> fields; +EXTERN byte numfields; +EXTERN varying_string<26> flags; +EXTERN string listen; -EXTERN word oh,onh,om,h,m,s,s1; +EXTERN word oh, onh, om, h, m, s, s1; EXTERN varying_string<4> atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ -EXTERN byte cp,ledstatus,defaultled; -EXTERN raw little; EXTERN boolean quote; /* 66 or 99 next? */ +EXTERN byte cp, ledstatus, defaultled; +EXTERN raw little; +EXTERN boolean quote; /* 66 or 99 next? */ EXTERN boolean alive; -EXTERN array<1,2000,char> buffer; EXTERN word bufsize; +EXTERN array<1, 2000, char> buffer; +EXTERN word bufsize; EXTERN byte oldjw; /* Old joystick-way */ EXTERN controllers ctrl; @@ -610,7 +715,8 @@ EXTERN integer underscroll; /* Y-coord of just under the scroll text. */ EXTERN boolean ddmnow; /* Kludge so we don't have to keep referring to Dropdown */ EXTERN varying_string<40> roomname; /* Name of this room */ -EXTERN text logfile; EXTERN boolean logging,log_epson; +EXTERN text logfile; +EXTERN boolean logging, log_epson; EXTERN boolean cl_override; @@ -621,12 +727,12 @@ EXTERN byte subjnumber; /* The same thing. */ EXTERN boolean keyboardclick; /* Is a keyboard click noise wanted? */ -EXTERN char him,her,it; +EXTERN char him, her, it; EXTERN longint roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ EXTERN boolean after_the_scroll; - /* For the demo: */ +/* For the demo: */ EXTERN demo_type demo_rec; EXTERN file demofile; @@ -643,90 +749,91 @@ EXTERN string filetoload; EXTERN boolean holdthedawn; /* If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. */ -EXTERN word storage_seg,storage_ofs; /* Seg and ofs of the Storage area. */ +EXTERN word storage_seg, storage_ofs; /* Seg and ofs of the Storage area. */ EXTERN word skellern; /* Offset of the timer variable - 1 more than storage_OFS */ EXTERN boolean reloaded; /* Is this NOT the primary loading? */ -EXTERN boolean super_was_virtual,super_was_off; /* Used by Super_Off and Super_On */ +EXTERN boolean super_was_virtual, super_was_off; /* Used by Super_Off and Super_On */ EXTERN pathstr enid_filename; EXTERN joysetup js; -EXTERN word cxmin,cxmax,cymin,cymax; EXTERN boolean use_joy_a; +EXTERN word cxmin, cxmax, cymin, cymax; +EXTERN boolean use_joy_a; #undef EXTERN #define EXTERN extern - void newpointer(byte m); +void newpointer(byte m); - void wait(); /* makes hourglass */ +void wait(); /* makes hourglass */ - void on(); +void on(); - void off(); +void off(); - void on_virtual(); +void on_virtual(); - void off_virtual(); +void off_virtual(); - void xycheck(); +void xycheck(); - void hopto(integer x,integer y); /* Moves mouse pointer to x,y */ +void hopto(integer x, integer y); /* Moves mouse pointer to x,y */ - void check(); +void check(); - void note(word hertz); +void note(word hertz); - void blip(); +void blip(); - string strf(longint x); +string strf(longint x); - void shbox(integer x1,integer y1,integer x2,integer y2, string t); +void shbox(integer x1, integer y1, integer x2, integer y2, string t); - void newgame(); +void newgame(); - void click(); +void click(); - void slowdown(); +void slowdown(); - boolean flagset(char x); +boolean flagset(char x); - void force_numlock(); +void force_numlock(); - boolean pennycheck(word howmuchby); +boolean pennycheck(word howmuchby); - string getname(char whose); +string getname(char whose); - char getnamechar(char whose); +char getnamechar(char whose); - string get_thing(char which); +string get_thing(char which); - char get_thingchar(char which); +char get_thingchar(char which); - string get_better(char which); +string get_better(char which); - string f5_does(); +string f5_does(); - void plot_vmc(integer xx,integer yy, byte page_); +void plot_vmc(integer xx, integer yy, byte page_); - void wipe_vmc(byte page_); +void wipe_vmc(byte page_); - void setup_vmc(); +void setup_vmc(); - void clear_vmc(); +void clear_vmc(); - void load_a_mouse(byte which); +void load_a_mouse(byte which); - void background(byte x); +void background(byte x); - void hang_around_for_a_while(); +void hang_around_for_a_while(); - void super_off(); +void super_off(); - void super_on(); +void super_on(); - boolean mouse_near_text(); +boolean mouse_near_text(); - } // End of namespace Avalanche. +} // End of namespace Avalanche. #endif \ No newline at end of file diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 70f7582eded9..3074091a0b5d 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,220 +34,277 @@ namespace Avalanche { typedef graphcursmasktype cursor; const char vernum[] = "v100"; const char copyright[] = "1992"; -const cursor questionmark = -{ - ((511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695), - (65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840)), - 0, - 0}; +const cursor questionmark = { + ((511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695), + (65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840)), + 0, + 0 +}; -const array<1,7,varying_string<12> > topics = - {{"Front page","Background","Toolbar","Menus", - "Keyboard","Shareware","Exit Help"}}; +const array<1, 7, varying_string<12> > topics = { + { + "Front page", "Background", "Toolbar", "Menus", + "Keyboard", "Shareware", "Exit Help" + } +}; -const array<1,6,char> keys = "FBTMKS"; +const array<1, 6, char> keys = "FBTMKS"; byte page_; -palettetype dp,dark; +palettetype dp, dark; char r; boolean lmo; -void hilight(integer x,integer y, byte c1,byte c2, string z) -{ - string w; -; - w=z; w[1]='\40'; setcolor(c1); outtextxy(x,y,w); - w=z; fillchar(w[2],length(z)-1,'\40'); setcolor(c2); - outtextxy(x,y,w); outtextxy(x-1,y,w); +void hilight(integer x, integer y, byte c1, byte c2, string z) { + string w; + ; + w = z; + w[1] = '\40'; + setcolor(c1); + outtextxy(x, y, w); + w = z; + fillchar(w[2], length(z) - 1, '\40'); + setcolor(c2); + outtextxy(x, y, w); + outtextxy(x - 1, y, w); } -void showpage(byte x) -{; - if (x==page_) return; /* twit */ - if (x==7) {; lmo=true; return; } - setallpalette(dark); hidemousecursor; settextjustify(1,1); - if (page_!=177) - {; - setfillstyle(1,1); bar(507,page_*25+2,607,page_*25+22); - setfillstyle(1,9); bar(500,page_*25,600,page_*25+20); -/* setcolor(11); outtextxy(550,page*25+10,topics[page]);*/ - hilight(550,page_*25+10,11,14,topics[page_]); - } - page_=x; - setfillstyle(1,4); bar(507,page_*25+2,607,page_*25+22); - setfillstyle(1,12); bar(500,page_*25,600,page_*25+20); -/* setcolor(14); outtextxy(550,page*25+10,topics[page]); */ - hilight(550,page_*25+10,14,15,topics[page_]); - setfillstyle(1,7); bar(0,27,470,189); settextjustify(0,2); setcolor(1); - switch (page_) { - case 1: {; /* Front page */ - setcolor(black); - outtextxy( 10, 40,"Thorsoft of Letchworth presents"); - outtextxy(300, 80,vernum); - outtextxy( 10, 90,string("(c) ")+copyright+", Mike, Mark and Thomas Thurman."); - setcolor(red); - outtextxy(100,129,"Finding your way around it..."); - setcolor(blue); - outtextxy( 10,120,"You are now using the Help System."); - outtextxy( 10,138,"Press the first letter of the topic that you want to"); - outtextxy( 10,147,"read (eg T for (T)oolbar), or click on its button (on"); - outtextxy( 10,156,"the right) using the mouse. Use \"Exit Help\" to quit."); - outtextxy( 10,174,"(Fastest exit- just hit Esc!)"); - } - break; - case 2: {; /* Background */ - setcolor(red); - outtextxy(300, 30,"Remember this chap?"); - setcolor(blue); - outtextxy( 10, 55,"Back in good old A.D. 79, there lived a Roman"); - outtextxy( 10, 64,"whose name was Denarius Avaricius Sextus, known"); - outtextxy( 10, 73,"to his friends as Avvy. His wife was called Arkata,"); - outtextxy( 10, 82,"and he had a slave named Crapulus. His grandson"); - outtextxy( 10, 91,"joined the army, was posted to Gaul, and liked it"); - outtextxy( 10,100,"so much that he stayed there, telling everyone the"); - outtextxy( 10,109,"one about the centurion and the Turkish bath. His"); - outtextxy( 10,118,"thirty-sixth male-line descendant accidentally"); - outtextxy( 10,127,"poisoned an old enemy of William of Normandy, and"); - outtextxy( 10,136,"to his great surprise came so much into Bill's favour"); - outtextxy( 10,145,"that, after the Battle of Hastings a few years"); - outtextxy( 10,154,"later, he was made the lord of a small town in"); - outtextxy( 10,163,"Hertfordshire called Argent. It is his great-grandson"); - outtextxy( 10,172,"who stars in this game, back in good old A.D. 1189."); - } - break; - case 3: {; /* ? */ - outtextxy( 15, 30,"The Toolbar is there so that (along with the menus)"); - outtextxy( 15, 39,"you can perform a lot of the functions contained in"); - outtextxy( 15, 48,"the game, using the mouse."); - setcolor(red); - outtextxy( 15, 66,"COMPASS:"); - setcolor(blue); - outtextxy( 90, 66,"Used to point Avvy in the right direction."); - setcolor(red); - outtextxy( 15, 75,"THINKS:"); - setcolor(blue); - outtextxy( 90, 75,"Shows the person/object you're thinking of."); - setcolor(red); - outtextxy( 15, 84,"SCORE:"); - setcolor(blue); - outtextxy( 90, 84,"Shows how many points you've got."); - setcolor(red); - outtextxy( 15, 93,"SPEED:"); - setcolor(blue); - outtextxy( 90, 93,"Adjusts the speed of the game."); - setcolor(red); - outtextxy( 15,102,"L.E.D.s:"); - setcolor(blue); - outtextxy( 90,102,"Shows whether sound is on (toggle with ),"); - outtextxy( 90,111,"the computer is ready, or there is an error."); - setcolor(red); - outtextxy( 15,120,"CLOCK:"); - setcolor(blue); - outtextxy( 90,120,"Shows the time."); - setcolor(red); - outtextxy( 15,129,"'OK' box:"); - setcolor(blue); - outtextxy( 90,129,"Works the same as pressing ."); - setcolor(0); - outtextxy( 15,147,"N.B. The game action is suspended while you are"); - outtextxy( 15,156,"using the toolbar."); - } - break; - case 4: {; /* menus */ - outtextxy( 15, 60,"To use the drop-down menus, either click on the bar"); - outtextxy( 15, 69,"at the top with the mouse, or press Alt and the first"); - outtextxy( 15, 78,string("letter of the menu's name (eg alt-A = (A)ction.) The ")+'\3'); - outtextxy( 15, 87,"menu is alt-H, for (H)eart."); - outtextxy( 15,105,"When you have a menu, either click on the option you"); - outtextxy( 15,114,"want, or press its initial letter (eg O for \"OS Shell\")."); - outtextxy( 15,132,"To do something to, or with, an object or person, first"); - outtextxy( 15,141,"select them (or it) from the People or Things menu. Then"); - outtextxy( 15,150,"select whatever you wanted to do from the Use menu."); - setcolor(red); - outtextxy(15,177,"(OK, so it sounds complicated, but then it's intuitive!)"); - } - break; - case 5: {; /* Keyboard */ - outtextxy(15, 60,"The keyboard interface is even simpler than the mouse"); - outtextxy(15, 70,"interface! Just type what you want Avvy to do."); - outtextxy(15, 80,"For example, to open a door, type in:"); - setcolor(red); outtextxy(100,95,"open door"); setcolor(blue); - outtextxy(15,110,"And to look at Crapulus, type:"); - setcolor(red); outtextxy(100,125,"look at Crapulus"); - setcolor(blue); outtextxy(15,140,"(Don't forget to press Enter after each command!)"); - outtextxy(15,160,"This is a traditional command-line parser interface,"); - outtextxy(15,170,"similar to the one in \"Avaricius\", only more advanced."); - } - break; - case 6: {; /* ? */ - outtextxy(15, 30,"This game is Shareware. Most programs are sold through"); - outtextxy(15, 40,"shops, and the authors prevent you from copying them."); - outtextxy(15, 50,"Shareware is different. You may copy it and give it to"); - outtextxy(15, 60,"ANYBODY at all. You may post it on any BBS, give it to"); - outtextxy(15, 70,"friends, etc. If you like it, we ask you to pay us for"); - outtextxy(15, 80,"the software directly through the post. We're relying"); - outtextxy(15, 90,"on you to register!"); - outtextxy(99,177,"{ ETC }"); - } - break; - } - setallpalette(dp); showmousecursor; +void showpage(byte x) { + ; + if (x == page_) return; /* twit */ + if (x == 7) { + ; + lmo = true; + return; + } + setallpalette(dark); + hidemousecursor; + settextjustify(1, 1); + if (page_ != 177) { + ; + setfillstyle(1, 1); + bar(507, page_ * 25 + 2, 607, page_ * 25 + 22); + setfillstyle(1, 9); + bar(500, page_ * 25, 600, page_ * 25 + 20); + /* setcolor(11); outtextxy(550,page*25+10,topics[page]);*/ + hilight(550, page_ * 25 + 10, 11, 14, topics[page_]); + } + page_ = x; + setfillstyle(1, 4); + bar(507, page_ * 25 + 2, 607, page_ * 25 + 22); + setfillstyle(1, 12); + bar(500, page_ * 25, 600, page_ * 25 + 20); + /* setcolor(14); outtextxy(550,page*25+10,topics[page]); */ + hilight(550, page_ * 25 + 10, 14, 15, topics[page_]); + setfillstyle(1, 7); + bar(0, 27, 470, 189); + settextjustify(0, 2); + setcolor(1); + switch (page_) { + case 1: { + ; /* Front page */ + setcolor(black); + outtextxy(10, 40, "Thorsoft of Letchworth presents"); + outtextxy(300, 80, vernum); + outtextxy(10, 90, string("(c) ") + copyright + ", Mike, Mark and Thomas Thurman."); + setcolor(red); + outtextxy(100, 129, "Finding your way around it..."); + setcolor(blue); + outtextxy(10, 120, "You are now using the Help System."); + outtextxy(10, 138, "Press the first letter of the topic that you want to"); + outtextxy(10, 147, "read (eg T for (T)oolbar), or click on its button (on"); + outtextxy(10, 156, "the right) using the mouse. Use \"Exit Help\" to quit."); + outtextxy(10, 174, "(Fastest exit- just hit Esc!)"); + } + break; + case 2: { + ; /* Background */ + setcolor(red); + outtextxy(300, 30, "Remember this chap?"); + setcolor(blue); + outtextxy(10, 55, "Back in good old A.D. 79, there lived a Roman"); + outtextxy(10, 64, "whose name was Denarius Avaricius Sextus, known"); + outtextxy(10, 73, "to his friends as Avvy. His wife was called Arkata,"); + outtextxy(10, 82, "and he had a slave named Crapulus. His grandson"); + outtextxy(10, 91, "joined the army, was posted to Gaul, and liked it"); + outtextxy(10, 100, "so much that he stayed there, telling everyone the"); + outtextxy(10, 109, "one about the centurion and the Turkish bath. His"); + outtextxy(10, 118, "thirty-sixth male-line descendant accidentally"); + outtextxy(10, 127, "poisoned an old enemy of William of Normandy, and"); + outtextxy(10, 136, "to his great surprise came so much into Bill's favour"); + outtextxy(10, 145, "that, after the Battle of Hastings a few years"); + outtextxy(10, 154, "later, he was made the lord of a small town in"); + outtextxy(10, 163, "Hertfordshire called Argent. It is his great-grandson"); + outtextxy(10, 172, "who stars in this game, back in good old A.D. 1189."); + } + break; + case 3: { + ; /* ? */ + outtextxy(15, 30, "The Toolbar is there so that (along with the menus)"); + outtextxy(15, 39, "you can perform a lot of the functions contained in"); + outtextxy(15, 48, "the game, using the mouse."); + setcolor(red); + outtextxy(15, 66, "COMPASS:"); + setcolor(blue); + outtextxy(90, 66, "Used to point Avvy in the right direction."); + setcolor(red); + outtextxy(15, 75, "THINKS:"); + setcolor(blue); + outtextxy(90, 75, "Shows the person/object you're thinking of."); + setcolor(red); + outtextxy(15, 84, "SCORE:"); + setcolor(blue); + outtextxy(90, 84, "Shows how many points you've got."); + setcolor(red); + outtextxy(15, 93, "SPEED:"); + setcolor(blue); + outtextxy(90, 93, "Adjusts the speed of the game."); + setcolor(red); + outtextxy(15, 102, "L.E.D.s:"); + setcolor(blue); + outtextxy(90, 102, "Shows whether sound is on (toggle with ),"); + outtextxy(90, 111, "the computer is ready, or there is an error."); + setcolor(red); + outtextxy(15, 120, "CLOCK:"); + setcolor(blue); + outtextxy(90, 120, "Shows the time."); + setcolor(red); + outtextxy(15, 129, "'OK' box:"); + setcolor(blue); + outtextxy(90, 129, "Works the same as pressing ."); + setcolor(0); + outtextxy(15, 147, "N.B. The game action is suspended while you are"); + outtextxy(15, 156, "using the toolbar."); + } + break; + case 4: { + ; /* menus */ + outtextxy(15, 60, "To use the drop-down menus, either click on the bar"); + outtextxy(15, 69, "at the top with the mouse, or press Alt and the first"); + outtextxy(15, 78, string("letter of the menu's name (eg alt-A = (A)ction.) The ") + '\3'); + outtextxy(15, 87, "menu is alt-H, for (H)eart."); + outtextxy(15, 105, "When you have a menu, either click on the option you"); + outtextxy(15, 114, "want, or press its initial letter (eg O for \"OS Shell\")."); + outtextxy(15, 132, "To do something to, or with, an object or person, first"); + outtextxy(15, 141, "select them (or it) from the People or Things menu. Then"); + outtextxy(15, 150, "select whatever you wanted to do from the Use menu."); + setcolor(red); + outtextxy(15, 177, "(OK, so it sounds complicated, but then it's intuitive!)"); + } + break; + case 5: { + ; /* Keyboard */ + outtextxy(15, 60, "The keyboard interface is even simpler than the mouse"); + outtextxy(15, 70, "interface! Just type what you want Avvy to do."); + outtextxy(15, 80, "For example, to open a door, type in:"); + setcolor(red); + outtextxy(100, 95, "open door"); + setcolor(blue); + outtextxy(15, 110, "And to look at Crapulus, type:"); + setcolor(red); + outtextxy(100, 125, "look at Crapulus"); + setcolor(blue); + outtextxy(15, 140, "(Don't forget to press Enter after each command!)"); + outtextxy(15, 160, "This is a traditional command-line parser interface,"); + outtextxy(15, 170, "similar to the one in \"Avaricius\", only more advanced."); + } + break; + case 6: { + ; /* ? */ + outtextxy(15, 30, "This game is Shareware. Most programs are sold through"); + outtextxy(15, 40, "shops, and the authors prevent you from copying them."); + outtextxy(15, 50, "Shareware is different. You may copy it and give it to"); + outtextxy(15, 60, "ANYBODY at all. You may post it on any BBS, give it to"); + outtextxy(15, 70, "friends, etc. If you like it, we ask you to pay us for"); + outtextxy(15, 80, "the software directly through the post. We're relying"); + outtextxy(15, 90, "on you to register!"); + outtextxy(99, 177, "{ ETC }"); + } + break; + } + setallpalette(dp); + showmousecursor; } -void helpsetup() -{ - integer gd,gm; -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); settextstyle(1,0,0); setcolor(11); - getpalette(dp); dark.size=dp.size; fillchar(dark.colors,dark.size,'\0'); - setallpalette(dark); setusercharsize(3,1,8,10); - for( gm=1; gm <= 3; gm ++) outtextxy(gm,0,"Avalot- HELP!"); - resetmouse; setgraphicscursor(questionmark); showmousecursor; - settextstyle(0,0,1); settextjustify(1,1); - for( gd=2; gd <= 7; gd ++) - {; - setfillstyle(1,1); bar(507,gd*25+2,607,gd*25+22); - setfillstyle(1,9); bar(500,gd*25,600,gd*25+20); -/* setcolor(11); outtextxy(550,gd*25+10,topics[gd]); */ - hilight(550,gd*25+10,11,14,topics[gd]); - } - showmousecursor; - page_=177; showpage(1); lmo=false; setfillstyle(1,7); - for( gd=1; gd <= 3; gd ++) - {; - bar( 10-gd*3,200-gd*3,490-gd*6,200-gd*3); - bar(490-gd*6, 37-gd*3,491-gd*6,200-gd*3); - } +void helpsetup() { + integer gd, gm; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + settextstyle(1, 0, 0); + setcolor(11); + getpalette(dp); + dark.size = dp.size; + fillchar(dark.colors, dark.size, '\0'); + setallpalette(dark); + setusercharsize(3, 1, 8, 10); + for (gm = 1; gm <= 3; gm ++) outtextxy(gm, 0, "Avalot- HELP!"); + resetmouse; + setgraphicscursor(questionmark); + showmousecursor; + settextstyle(0, 0, 1); + settextjustify(1, 1); + for (gd = 2; gd <= 7; gd ++) { + ; + setfillstyle(1, 1); + bar(507, gd * 25 + 2, 607, gd * 25 + 22); + setfillstyle(1, 9); + bar(500, gd * 25, 600, gd * 25 + 20); + /* setcolor(11); outtextxy(550,gd*25+10,topics[gd]); */ + hilight(550, gd * 25 + 10, 11, 14, topics[gd]); + } + showmousecursor; + page_ = 177; + showpage(1); + lmo = false; + setfillstyle(1, 7); + for (gd = 1; gd <= 3; gd ++) { + ; + bar(10 - gd * 3, 200 - gd * 3, 490 - gd * 6, 200 - gd * 3); + bar(490 - gd * 6, 37 - gd * 3, 491 - gd * 6, 200 - gd * 3); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - helpsetup(); - do { - do { getbuttonstatus; } while (!((mkey==left) || keypressed())); - if (keypressed()) - {; /* keyboard choice */ - r=upcase(readkey()); - if (pos(r,keys)>0) showpage(pos(r,keys)); else - if (r=='\0') - switch (readkey()) { /* grab extd keystroke */ - case 'H': if (page_>1) showpage(page_-1); break; - case 'P': if (page_<6) showpage(page_+1); break; - case 'G':case 'I': showpage(1); break; - case 'O':case 'Q': showpage(6); break; - } else - if (set::of('\33','Q','X','E','H', eos).has(r)) lmo=true; /* quit */ - } - else - {; /* mouse choice */ - if ((mousex>400) && (mousey>25)) - {; - showpage(mousey / 25); - } - } - } while (!lmo); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + helpsetup(); + do { + do { + getbuttonstatus; + } while (!((mkey == left) || keypressed())); + if (keypressed()) { + ; /* keyboard choice */ + r = upcase(readkey()); + if (pos(r, keys) > 0) showpage(pos(r, keys)); + else if (r == '\0') + switch (readkey()) { /* grab extd keystroke */ + case 'H': + if (page_ > 1) showpage(page_ - 1); + break; + case 'P': + if (page_ < 6) showpage(page_ + 1); + break; + case 'G': + case 'I': + showpage(1); + break; + case 'O': + case 'Q': + showpage(6); + break; + } + else if (set::of('\33', 'Q', 'X', 'E', 'H', eos).has(r)) lmo = true; /* quit */ + } else { + ; /* mouse choice */ + if ((mousex > 400) && (mousey > 25)) { + ; + showpage(mousey / 25); + } + } + } while (!lmo); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index 1fc41b6e48be..1ef6443fc79d 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,243 +30,286 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; struct hypertype { - char trigger; - byte line; - byte start,finish; - word ref; + char trigger; + byte line; + byte start, finish; + word ref; }; -integer gd,gm; -array<1,2,fonttype> font; -matrix<0,7,1,80,byte> current; -array<1,250,varying_string<79> > data; -integer fv,position,size; +integer gd, gm; +array<1, 2, fonttype> font; +matrix<0, 7, 1, 80, byte> current; +array<1, 250, varying_string<79> > data; +integer fv, position, size; varying_string<79> title; -array<1,20,hypertype> link; +array<1, 20, hypertype> link; byte numlinks; char r; -array<0,9,byte> reverse; -array<0,9,byte> revpos; +array<0, 9, byte> reverse; +array<0, 9, byte> revpos; -void loadfont() -{ - file fontfile; -; - assign(fontfile,"c:\\thomas\\ttsmall.fnt"); reset(fontfile); - fontfile >> font[1]; close(fontfile); -/* assign(fontfile,'c:\avalot\avalot.fnt'); reset(fontfile); - read(fontfile,font[2]); close(fontfile);*/ - /* NB: We'll put BOTH of these fonts one after the other, in the same - file, in the final compilation. */ +void loadfont() { + file fontfile; + ; + assign(fontfile, "c:\\thomas\\ttsmall.fnt"); + reset(fontfile); + fontfile >> font[1]; + close(fontfile); + /* assign(fontfile,'c:\avalot\avalot.fnt'); reset(fontfile); + read(fontfile,font[2]); close(fontfile);*/ + /* NB: We'll put BOTH of these fonts one after the other, in the same + file, in the final compilation. */ } -void scribe(byte which,byte what); +void scribe(byte which, byte what); -static void underline(byte& x) {; x=x | 177; } +static void underline(byte &x) { + ; + x = x | 177; +} -void scribe(byte which,byte what) -{ - byte fv,ff; string x; -; - x=data[what]; - fillchar(current,sizeof(current),'\0'); - for( ff=1; ff <= length(x); ff ++) - for( fv=0; fv <= 7; fv ++) - {; - current[fv][ff]=font[which][x[ff]][fv]; - } +void scribe(byte which, byte what) { + byte fv, ff; + string x; + ; + x = data[what]; + fillchar(current, sizeof(current), '\0'); + for (ff = 1; ff <= length(x); ff ++) + for (fv = 0; fv <= 7; fv ++) { + ; + current[fv][ff] = font[which][x[ff]][fv]; + } - for( fv=1; fv <= numlinks; fv ++) - { hypertype& with = link[fv]; - if (with.line==what) - for( ff=with.start; ff <= with.finish; ff ++) - underline(current[7][ff]);} + for (fv = 1; fv <= numlinks; fv ++) { + hypertype &with = link[fv]; + if (with.line == what) + for (ff = with.start; ff <= with.finish; ff ++) + underline(current[7][ff]); + } } -void display(word y) -{; - for( fv=0; fv <= 7; fv ++) - move(current[fv],mem[0xa000*(y+fv)*80],79); +void display(word y) { + ; + for (fv = 0; fv <= 7; fv ++) + move(current[fv], mem[0xa000 * (y + fv) * 80], 79); } -void update_link(char which, byte whence,byte whither) -{ - byte fv; -; - for( fv=1; fv <= numlinks; fv ++) - { hypertype& with = link[fv]; - if (with.trigger==which) - {; - with.line=size; - with.start=whence; - with.finish=whither; - }} +void update_link(char which, byte whence, byte whither) { + byte fv; + ; + for (fv = 1; fv <= numlinks; fv ++) { + hypertype &with = link[fv]; + if (with.trigger == which) { + ; + with.line = size; + with.start = whence; + with.finish = whither; + } + } } -void getlinks(string& x) -{ - byte p,q; -; - do { - p=pos("[",x); - if (p==0) return; /* lousy, huh? */ - q=pos("]",x); - update_link(x[p+1],p,q-3); - Delete(x,q,1); Delete(x,p,2); - } while (!false); +void getlinks(string &x) { + byte p, q; + ; + do { + p = pos("[", x); + if (p == 0) return; /* lousy, huh? */ + q = pos("]", x); + update_link(x[p + 1], p, q - 3); + Delete(x, q, 1); + Delete(x, p, 2); + } while (!false); } -void loaddata(byte which) -{ - text t; - string x; - integer e; -; - revpos[9]=position; - fillchar(data,sizeof(data),'\0'); - move(reverse[1],reverse[0],9); - move(revpos[1],revpos[0],9); - reverse[9]=which; revpos[9]=1; +void loaddata(byte which) { + text t; + string x; + integer e; + ; + revpos[9] = position; + fillchar(data, sizeof(data), '\0'); + move(reverse[1], reverse[0], 9); + move(revpos[1], revpos[0], 9); + reverse[9] = which; + revpos[9] = 1; - str(which,x); - assign(t,string('h')+x+".raw"); - reset(t); - t >> title >> NL; - size=0; numlinks=0; - while (! eof(t)) - {; - t >> x >> NL; - if (x[1]==':') - {; - numlinks += 1; - { - hypertype& with = link[numlinks]; - ; - with.trigger=x[2]; - Delete(x,1,3); - Delete(x,pos(" ",x),255); - val(x,with.ref,e); - } - } else {; - size += 1; - getlinks(x); - data[size]=x; - } - } - position=1; size -= 15; - close(t); + str(which, x); + assign(t, string('h') + x + ".raw"); + reset(t); + t >> title >> NL; + size = 0; + numlinks = 0; + while (! eof(t)) { + ; + t >> x >> NL; + if (x[1] == ':') { + ; + numlinks += 1; + { + hypertype &with = link[numlinks]; + ; + with.trigger = x[2]; + Delete(x, 1, 3); + Delete(x, pos(" ", x), 255); + val(x, with.ref, e); + } + } else { + ; + size += 1; + getlinks(x); + data[size] = x; + } + } + position = 1; + size -= 15; + close(t); } -void screen() -{; - setbkcolor(1); - setfillstyle(1,1); bar(0,0,640,38); - setfillstyle(1,14); bar(0,39,640,39); +void screen() { + ; + setbkcolor(1); + setfillstyle(1, 1); + bar(0, 0, 640, 38); + setfillstyle(1, 14); + bar(0, 39, 640, 39); } -void showscreen() -{ - byte fv; -; - if (position<1) position=1; - for( fv=0; fv <= 15; fv ++) - {; - scribe(1,fv+position); - display(41+fv*10); - } +void showscreen() { + byte fv; + ; + if (position < 1) position = 1; + for (fv = 0; fv <= 15; fv ++) { + ; + scribe(1, fv + position); + display(41 + fv * 10); + } } -void up() -{ - byte fv; -; - position -= 1; - scribe(1,position); - for( fv=0; fv <= 9; fv ++) - {; - move(mem[0xa000*3200],mem[0xa000*3280],12720); - if (set::of(0,9, eos).has(fv)) fillchar(mem[0xa000*3200],79,'\0'); else - move(current[8-fv],mem[0xa000*3200],80); - } +void up() { + byte fv; + ; + position -= 1; + scribe(1, position); + for (fv = 0; fv <= 9; fv ++) { + ; + move(mem[0xa000 * 3200], mem[0xa000 * 3280], 12720); + if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 3200], 79, '\0'); + else + move(current[8 - fv], mem[0xa000 * 3200], 80); + } } -void down() -{ - byte fv; -; - position += 1; - scribe(1,position+15); - for( fv=0; fv <= 9; fv ++) - {; - move(mem[0xa000*3280],mem[0xa000*3200],12720); - if (set::of(0,9, eos).has(fv)) fillchar(mem[0xa000*15920],79,'\0'); else - move(current[fv-1],mem[0xa000*15920],80); - } +void down() { + byte fv; + ; + position += 1; + scribe(1, position + 15); + for (fv = 0; fv <= 9; fv ++) { + ; + move(mem[0xa000 * 3280], mem[0xa000 * 3200], 12720); + if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 15920], 79, '\0'); + else + move(current[fv - 1], mem[0xa000 * 15920], 80); + } } -void newpage(char c) -{ - byte fv; -; - for( fv=1; fv <= numlinks; fv ++) - { hypertype& with = link[fv]; - if (with.trigger==c) - {; - loaddata(with.ref); - showscreen(); - }} +void newpage(char c) { + byte fv; + ; + for (fv = 1; fv <= numlinks; fv ++) { + hypertype &with = link[fv]; + if (with.trigger == c) { + ; + loaddata(with.ref); + showscreen(); + } + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - loadfont(); - screen(); - loaddata(0); - showscreen(); - fillchar(reverse,sizeof(reverse),'\0'); - fillchar(revpos,sizeof(revpos),'\1'); - do { - r=upcase(readkey()); - switch (r) { - case '\0': switch (readkey()) { - case 'H': if (position>1) up(); break; - case 'P': if (position 1) up(); + break; + case 'P': + if (position < size) down(); + break; + case 'I': { + ; + position -= 16; + showscreen(); + } + break; + case 'Q': { + ; + position += 16; + showscreen(); + } + break; + case 'G': { + ; + position = 1; + showscreen(); + } + break; + case 'O': { + ; + position = size; + showscreen(); + } + break; + } + break; + case 'B': { + ; /* go Back */ + gd = reverse[8]; + gm = revpos[8]; + move(reverse[0], reverse[2], 8); + move(revpos[0], revpos[2], 8); + loaddata(gd); + position = gm; + showscreen(); + } + break; + case 'C': { + ; /* Contents */ + loaddata(0); + showscreen(); + } + break; + case 'H': { + ; + loaddata(7); /* help on help */ + showscreen(); + } + break; + case '\33': + exit(0); + break; + default: + newpage(r); + } + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp index b5513f3be644..3e60289a3308 100644 --- a/engines/avalanche/helpbak.cpp +++ b/engines/avalanche/helpbak.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -44,145 +44,176 @@ namespace Avalanche { struct buttontype { - char trigger; - byte whither; + char trigger; + byte whither; }; const integer buttonsize = 930; -const integer toolbar = 0; const integer nim = 1; const integer kbd = 2; const integer credits = 3; const integer joystick = 4; const integer troubleshooting = 5; const integer story = 6; -const integer mainscreen = 7; const integer registering = 8; const integer sound = 9; const integer mouse = 10; const integer filer = 11; const integer back2game = 12; -const integer helponhelp = 13; const integer pgdn = 14; const integer pgup = 15; - -array<1,10,buttontype> buttons; - -void plot_button(integer y, byte which) -{ - untyped_file f; - pointer p; - - getmem(p,buttonsize); - assign(f,"buttons.avd"); - reset(f,1); - seek(f,which*buttonsize); - blockread(f,p,buttonsize); - putimage(470,y,p,0); - close(f); - freemem(p,buttonsize); +const integer toolbar = 0; +const integer nim = 1; +const integer kbd = 2; +const integer credits = 3; +const integer joystick = 4; +const integer troubleshooting = 5; +const integer story = 6; +const integer mainscreen = 7; +const integer registering = 8; +const integer sound = 9; +const integer mouse = 10; +const integer filer = 11; +const integer back2game = 12; +const integer helponhelp = 13; +const integer pgdn = 14; +const integer pgup = 15; + +array<1, 10, buttontype> buttons; + +void plot_button(integer y, byte which) { + untyped_file f; + pointer p; + + getmem(p, buttonsize); + assign(f, "buttons.avd"); + reset(f, 1); + seek(f, which * buttonsize); + blockread(f, p, buttonsize); + putimage(470, y, p, 0); + close(f); + freemem(p, buttonsize); } void getme(byte which); -static void chalk(byte y, string z) -{ - outtextxy(16,41+y*10,z); +static void chalk(byte y, string z) { + outtextxy(16, 41 + y * 10, z); } -void getme(byte which) /* Help icons are 80x20 */ -{ - string x; - text t; - byte y,fv; - - - str(which,x); - assign(t,string('h')+x+".raw"); - y=0; - reset(t); - - t >> x >> NL; - setfillstyle(1,1); bar(0,0,640,200); - setfillstyle(1,15); bar(8,40,450,200); - settextjustify(1,1); setcolor(14); - outtextxy(320,15,x); - settextjustify(0,2); - setcolor(3); settextstyle(0,0,2); - outtextxy(550,0,"help!"); - /***/ setcolor(0); settextstyle(0,0,1); - - do { - t >> x >> NL; - if (x=='!') flush(); /* End of the help text is signalled with a !. */ - chalk(y,x); - y += 1; - } while (!false); - - /* We are now at the end of the text. Next we must read the icons. */ - - y=0; settextjustify(1,1); setcolor(3); - while (! eof(t)) - { - y += 1; - t >> x >> NL; /* Get the name of this button, and... */ - if (x!='-') /* (hyphen signals an empty button.) */ - { - t >> buttons[y].trigger >> NL; - t >> fv >> NL; plot_button(13+y*27,fv); - t >> buttons[y].whither >> NL; /* this is the position to jump to */ - - switch (buttons[y].trigger) { - case '' : outtextxy(580,25+y*27,"Esc"); break; - case '' : outtextxy(580,25+y*27,"\30"); break; - case '' : outtextxy(580,25+y*27,"\31"); break; - default: - outtextxy(580,25+y*27,buttons[y].trigger); - } - - } else buttons[y].trigger='\0'; - } - - settextjustify(0,2); - close(t); +void getme(byte which) { /* Help icons are 80x20 */ + string x; + text t; + byte y, fv; + + + str(which, x); + assign(t, string('h') + x + ".raw"); + y = 0; + reset(t); + + t >> x >> NL; + setfillstyle(1, 1); + bar(0, 0, 640, 200); + setfillstyle(1, 15); + bar(8, 40, 450, 200); + settextjustify(1, 1); + setcolor(14); + outtextxy(320, 15, x); + settextjustify(0, 2); + setcolor(3); + settextstyle(0, 0, 2); + outtextxy(550, 0, "help!"); + /***/ setcolor(0); + settextstyle(0, 0, 1); + + do { + t >> x >> NL; + if (x == '!') flush(); /* End of the help text is signalled with a !. */ + chalk(y, x); + y += 1; + } while (!false); + + /* We are now at the end of the text. Next we must read the icons. */ + + y = 0; + settextjustify(1, 1); + setcolor(3); + while (! eof(t)) { + y += 1; + t >> x >> NL; /* Get the name of this button, and... */ + if (x != '-') { /* (hyphen signals an empty button.) */ + t >> buttons[y].trigger >> NL; + t >> fv >> NL; + plot_button(13 + y * 27, fv); + t >> buttons[y].whither >> NL; /* this is the position to jump to */ + + switch (buttons[y].trigger) { + case '' : + outtextxy(580, 25 + y * 27, "Esc"); + break; + case '' : + outtextxy(580, 25 + y * 27, "\30"); + break; + case '' : + outtextxy(580, 25 + y * 27, "\31"); + break; + default: + outtextxy(580, 25 + y * 27, buttons[y].trigger); + } + + } else buttons[y].trigger = '\0'; + } + + settextjustify(0, 2); + close(t); } -void continue_help() -{ - char r; - byte fv; - - do { - r=upcase(readkey()); - switch (r) { - case '\33' : return; break; - case '\0' : switch (readkey()) { - case '\110':case '\111': r=''; break; - case '\120':case '\121': r=''; break; - case '\73': r='H'; break; /* Help on help */ - } - break; - } - - for( fv=1; fv <= 10; fv ++) - { buttontype& with = buttons[fv]; - if (with.trigger==r) - { - dusk; - getme(with.whither); - dawn; - flush(); - }} - - } while (!false); +void continue_help() { + char r; + byte fv; + + do { + r = upcase(readkey()); + switch (r) { + case '\33' : + return; + break; + case '\0' : + switch (readkey()) { + case '\110': + case '\111': + r = ''; + break; + case '\120': + case '\121': + r = ''; + break; + case '\73': + r = 'H'; + break; /* Help on help */ + } + break; + } + + for (fv = 1; fv <= 10; fv ++) { + buttontype &with = buttons[fv]; + if (with.trigger == r) { + dusk; + getme(with.whither); + dawn; + flush(); + } + } + + } while (!false); } -void boot_help() -{ - setactivepage(2); +void boot_help() { + setactivepage(2); - getme(0); + getme(0); - dusk; - setvisualpage(2); - dawn; + dusk; + setvisualpage(2); + dawn; - continue_help(); + continue_help(); - dusk; - setvisualpage(cp); - draw_also_lines; - setactivepage(1-cp); - dawn; + dusk; + setvisualpage(cp); + draw_also_lines; + setactivepage(1 - cp); + dawn; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h index 4025aa882ddd..e2efd967e133 100644 --- a/engines/avalanche/helpbak.h +++ b/engines/avalanche/helpbak.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 397c63fd7f6e..76948b85da60 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -45,38 +45,54 @@ namespace Avalanche { struct buttontype { - char trigger; - byte whither; + char trigger; + byte whither; }; const integer buttonsize = 930; -const integer toolbar = 0; const integer nim = 1; const integer kbd = 2; const integer credits = 3; const integer joystick = 4; const integer troubleshooting = 5; const integer story = 6; -const integer mainscreen = 7; const integer registering = 8; const integer sound = 9; const integer mouse = 10; const integer filer = 11; const integer back2game = 12; -const integer helponhelp = 13; const integer pgdn = 14; const integer pgup = 15; - -array<1,10,buttontype> buttons; +const integer toolbar = 0; +const integer nim = 1; +const integer kbd = 2; +const integer credits = 3; +const integer joystick = 4; +const integer troubleshooting = 5; +const integer story = 6; +const integer mainscreen = 7; +const integer registering = 8; +const integer sound = 9; +const integer mouse = 10; +const integer filer = 11; +const integer back2game = 12; +const integer helponhelp = 13; +const integer pgdn = 14; +const integer pgup = 15; + +array<1, 10, buttontype> buttons; byte highlight_was; -void plot_button(integer y, byte which) -{ - untyped_file f; - pointer p; - - if (y>200) - { background(2); delay(10); background(0); return; } /* Silly buttons. */ - getmem(p,buttonsize); - assign(f,"buttons.avd"); - reset(f,1); - seek(f,which*buttonsize); - blockread(f,p,buttonsize); - - if (y==-177) - putimage(229,5,p,0); - else - putimage(470,y,p,0); - close(f); - freemem(p,buttonsize); +void plot_button(integer y, byte which) { + untyped_file f; + pointer p; + + if (y > 200) { + background(2); /* Silly buttons. */ + delay(10); + background(0); + return; + } + getmem(p, buttonsize); + assign(f, "buttons.avd"); + reset(f, 1); + seek(f, which * buttonsize); + blockread(f, p, buttonsize); + + if (y == -177) + putimage(229, 5, p, 0); + else + putimage(470, y, p, 0); + close(f); + freemem(p, buttonsize); } void getme(byte which); @@ -84,226 +100,256 @@ void getme(byte which); static untyped_file f; -static void chalk(byte y, string z) -{ - outtextxy(16,41+y*10,z); +static void chalk(byte y, string z) { + outtextxy(16, 41 + y * 10, z); } -static void getline(string& x) -{ - byte fz; +static void getline(string &x) { + byte fz; - blockread(f,x[0],1); - blockread(f,x[1],(byte)(x[0])); - for( fz=1; fz <= length(x); fz ++) - x[fz]=chr(ord(x[fz]) ^ 177); + blockread(f, x[0], 1); + blockread(f, x[1], (byte)(x[0])); + for (fz = 1; fz <= length(x); fz ++) + x[fz] = chr(ord(x[fz]) ^ 177); } -void getme(byte which) /* Help icons are 80x20 */ -{ - string x; - byte y,fv; - word offset; - - - off; - assign(f,"help.avd"); - y=0; - highlight_was=177; /* Forget where the highlight was. */ - reset(f,1); - seek(f,which*2); - blockread(f,offset,2); - seek(f,offset); - - getline(x); - setfillstyle(1,1); bar(0,0,640,200); - setfillstyle(1,15); bar(8,40,450,200); - settextjustify(2,2); - blockread(f,fv,1); - plot_button(-177,fv); - - setcolor(0); outtextxy(629,26,x); /* Plot the title. */ - setcolor(3); outtextxy(630,25,x); - - settextjustify(0,2); settextstyle(0,0,2); - setcolor(0); outtextxy(549,1,"help!"); - setcolor(3); outtextxy(550,0,"help!"); - /***/ settextstyle(0,0,1); - - do { - getline(x); - if (x=='!') flush(); /* End of the help text is signalled with a !. */ - if (x[1]=='\\') - { - setcolor(4); - chalk(y,copy(x,2,255)); - } else - { - setcolor(0); - chalk(y,x); - } - y += 1; - } while (!false); - - /* We are now at the end of the text. Next we must read the icons. */ - - y=0; settextjustify(1,1); settextstyle(0,0,2); - while (! eof(f)) - { - y += 1; - blockread(f,buttons[y].trigger,1); - if (buttons[y].trigger=='\261') flush(); - blockread(f,fv,1); - if (buttons[y].trigger!='\0') plot_button(13+y*27,fv); - blockread(f,buttons[y].whither,1); /* this is the position to jump to */ - - - switch (buttons[y].trigger) { - case '' : x="Esc"; break; - case '' : x='\30'; break; - case '' : x='\31'; break; - default: - x=buttons[y].trigger; - } - setcolor(0); outtextxy(589,26+y*27,x); - setcolor(3); outtextxy(590,25+y*27,x); - - } - - settextjustify(0,2); settextstyle(0,0,1); - close(f); on; +void getme(byte which) { /* Help icons are 80x20 */ + string x; + byte y, fv; + word offset; + + + off; + assign(f, "help.avd"); + y = 0; + highlight_was = 177; /* Forget where the highlight was. */ + reset(f, 1); + seek(f, which * 2); + blockread(f, offset, 2); + seek(f, offset); + + getline(x); + setfillstyle(1, 1); + bar(0, 0, 640, 200); + setfillstyle(1, 15); + bar(8, 40, 450, 200); + settextjustify(2, 2); + blockread(f, fv, 1); + plot_button(-177, fv); + + setcolor(0); + outtextxy(629, 26, x); /* Plot the title. */ + setcolor(3); + outtextxy(630, 25, x); + + settextjustify(0, 2); + settextstyle(0, 0, 2); + setcolor(0); + outtextxy(549, 1, "help!"); + setcolor(3); + outtextxy(550, 0, "help!"); + /***/ settextstyle(0, 0, 1); + + do { + getline(x); + if (x == '!') flush(); /* End of the help text is signalled with a !. */ + if (x[1] == '\\') { + setcolor(4); + chalk(y, copy(x, 2, 255)); + } else { + setcolor(0); + chalk(y, x); + } + y += 1; + } while (!false); + + /* We are now at the end of the text. Next we must read the icons. */ + + y = 0; + settextjustify(1, 1); + settextstyle(0, 0, 2); + while (! eof(f)) { + y += 1; + blockread(f, buttons[y].trigger, 1); + if (buttons[y].trigger == '\261') flush(); + blockread(f, fv, 1); + if (buttons[y].trigger != '\0') plot_button(13 + y * 27, fv); + blockread(f, buttons[y].whither, 1); /* this is the position to jump to */ + + + switch (buttons[y].trigger) { + case '' : + x = "Esc"; + break; + case '' : + x = '\30'; + break; + case '' : + x = '\31'; + break; + default: + x = buttons[y].trigger; + } + setcolor(0); + outtextxy(589, 26 + y * 27, x); + setcolor(3); + outtextxy(590, 25 + y * 27, x); + + } + + settextjustify(0, 2); + settextstyle(0, 0, 1); + close(f); + on; } byte check_mouse(); - /* Returns clicked-on button, or 0 if none. */ -static void light(byte which,byte colour) -{ - if (which==177) return; /* Dummy value for "no button at all". */ - setcolor(colour); which=which & 31; - rectangle(466,11+which*27,555,35+which*27); +/* Returns clicked-on button, or 0 if none. */ +static void light(byte which, byte colour) { + if (which == 177) return; /* Dummy value for "no button at all". */ + setcolor(colour); + which = which & 31; + rectangle(466, 11 + which * 27, 555, 35 + which * 27); } -byte check_mouse() -{ - byte h_is; - - byte check_mouse_result; - check; - - if (mrelease!=0) - { /* Clicked *somewhere*... */ - if ((mx<470) || (mx>550) || (((my-13) % 27)>20)) - check_mouse_result=0; else - /* Clicked on a button. */ - check_mouse_result=((my-13) / 27); - } else - { - if ((mx>470) && (mx<=550) && (((my-13) % 27)<=20)) - { /* No click, so highlight. */ - h_is=(my-13) / 27; - if ((h_is<1) || (h_is>6)) h_is=177; /* In case of silly values. */ - } else h_is=177; - - if ((h_is!=177) && ((keystatus & 1)>0)) h_is += 32; - - if (h_is!=highlight_was) - { - off; - light(highlight_was,1); - highlight_was=h_is; - if (buttons[h_is & 31].trigger!='\0') - { - if (h_is>31) light(h_is,11); else light(h_is,9); - } - on; - } - - check_mouse_result=0; - } - return check_mouse_result; +byte check_mouse() { + byte h_is; + + byte check_mouse_result; + check; + + if (mrelease != 0) { + /* Clicked *somewhere*... */ + if ((mx < 470) || (mx > 550) || (((my - 13) % 27) > 20)) + check_mouse_result = 0; + else + /* Clicked on a button. */ + check_mouse_result = ((my - 13) / 27); + } else { + if ((mx > 470) && (mx <= 550) && (((my - 13) % 27) <= 20)) { + /* No click, so highlight. */ + h_is = (my - 13) / 27; + if ((h_is < 1) || (h_is > 6)) h_is = 177; /* In case of silly values. */ + } else h_is = 177; + + if ((h_is != 177) && ((keystatus & 1) > 0)) h_is += 32; + + if (h_is != highlight_was) { + off; + light(highlight_was, 1); + highlight_was = h_is; + if (buttons[h_is & 31].trigger != '\0') { + if (h_is > 31) light(h_is, 11); + else light(h_is, 9); + } + on; + } + + check_mouse_result = 0; + } + return check_mouse_result; } -void continue_help() -{ - char r; - byte fv; - - do { - while (! keypressed()) - { - fv=check_mouse(); - - if (fv>0) - switch (buttons[fv].trigger) { - case '\0':/*null*/; break; - case '\376': return; break; - default: { - dusk; - getme(buttons[fv].whither); - dawn; - continue_; - } - } - - } - r=upcase(readkey()); - switch (r) { - case '\33' : return; break; - case '\0' : switch (readkey()) { - case '\110':case '\111': r=''; break; - case '\120':case '\121': r=''; break; - case '\73': r='H'; break; /* Help on help */ - default: continue_; - } - break; - } - - for( fv=1; fv <= 10; fv ++) - { buttontype& with = buttons[fv]; - if (with.trigger==r) - { - dusk; - getme(with.whither); - dawn; - flush(); - }} - - } while (!false); +void continue_help() { + char r; + byte fv; + + do { + while (! keypressed()) { + fv = check_mouse(); + + if (fv > 0) + switch (buttons[fv].trigger) { + case '\0':/*null*/ + ; + break; + case '\376': + return; + break; + default: { + dusk; + getme(buttons[fv].whither); + dawn; + continue_; + } + } + + } + r = upcase(readkey()); + switch (r) { + case '\33' : + return; + break; + case '\0' : + switch (readkey()) { + case '\110': + case '\111': + r = ''; + break; + case '\120': + case '\121': + r = ''; + break; + case '\73': + r = 'H'; + break; /* Help on help */ + default: + continue_; + } + break; + } + + for (fv = 1; fv <= 10; fv ++) { + buttontype &with = buttons[fv]; + if (with.trigger == r) { + dusk; + getme(with.whither); + dawn; + flush(); + } + } + + } while (!false); } -void boot_help() -{ - byte groi; - - dusk; - off; - oncandopageswap=false; highlight_was=177; - copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); - - /* Set up mouse. */ - off_virtual; - newpointer(2); - setactivepage(3); setvisualpage(3); - - getme(0); - dawn; - - newpointer(9); on; - mousepage(3); - - continue_help(); - - mousepage(cp); - dusk; off; - oncandopageswap=true; - copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); - on_virtual; dawn; fix_flashers; - - setvisualpage(cp); - setactivepage(1-cp); +void boot_help() { + byte groi; + + dusk; + off; + oncandopageswap = false; + highlight_was = 177; + copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); + + /* Set up mouse. */ + off_virtual; + newpointer(2); + setactivepage(3); + setvisualpage(3); + + getme(0); + dawn; + + newpointer(9); + on; + mousepage(3); + + continue_help(); + + mousepage(cp); + dusk; + off; + oncandopageswap = true; + copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); + on_virtual; + dawn; + fix_flashers; + + setvisualpage(cp); + setactivepage(1 - cp); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h index bc4afbd54bef..0c4d2c786016 100644 --- a/engines/avalanche/helper.h +++ b/engines/avalanche/helper.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index fbdc66291142..013141998c7a 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -27,29 +27,31 @@ namespace Avalanche { -file inf,outf; +file inf, outf; char x; string q; byte fv; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(inf,"v:thank.you"); - assign(outf,"d:hibits.out"); - reset(inf); rewrite(outf); - - q=string('\40')+"(Seven is a bit of a lucky number.)"+'\40'+'\215'+'\212'+'\212'; - - for( fv=1; fv <= length(q); fv ++) outf << q[fv]; - - while (! eof(inf)) - {; - inf >> x; - if (x<'\200') x += 128; - outf << x; - } - close(inf); close(outf); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(inf, "v:thank.you"); + assign(outf, "d:hibits.out"); + reset(inf); + rewrite(outf); + + q = string('\40') + "(Seven is a bit of a lucky number.)" + '\40' + '\215' + '\212' + '\212'; + + for (fv = 1; fv <= length(q); fv ++) outf << q[fv]; + + while (! eof(inf)) { + ; + inf >> x; + if (x < '\200') x += 128; + outf << x; + } + close(inf); + close(outf); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index bb4909b06738..09d073d3a76c 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -43,102 +43,107 @@ namespace Avalanche { -typedef array<1,12,struct A1 { - varying_string<30> name; - word score; - varying_string<12> rank; - }> highscoretype; +typedef array < 1, 12, struct A1 { + varying_string<30> name; + word score; + varying_string<12> rank; +} > highscoretype; highscoretype h; -void get_new_highs() -{ - byte fv; -; - for( fv=1; fv <= 12; fv ++) - { - A1& with = h[fv]; - ; - with.score=32-fv*2; - with.rank="..."; - } - h[1].name="Mike"; h[2].name="Liz"; h[3].name="Thomas"; h[4].name="Mark"; - h[5].name="Mandy"; h[6].name="Andrew"; h[7].name="Lucy Tryphena"; - h[8].name="Tammy the dog"; - h[9].name="Avaricius"; h[10].name="Spellchick"; h[11].name="Caddelli"; - h[12].name="Spludwick"; +void get_new_highs() { + byte fv; + ; + for (fv = 1; fv <= 12; fv ++) { + A1 &with = h[fv]; + ; + with.score = 32 - fv * 2; + with.rank = "..."; + } + h[1].name = "Mike"; + h[2].name = "Liz"; + h[3].name = "Thomas"; + h[4].name = "Mark"; + h[5].name = "Mandy"; + h[6].name = "Andrew"; + h[7].name = "Lucy Tryphena"; + h[8].name = "Tammy the dog"; + h[9].name = "Avaricius"; + h[10].name = "Spellchick"; + h[11].name = "Caddelli"; + h[12].name = "Spludwick"; } void show_highs() - /* This procedure shows the high-scores. */ +/* This procedure shows the high-scores. */ { - byte fv; - varying_string<40> x; - varying_string<5> y; -; - display("HIGH SCORERS\3\r Name\n\nScore Rank\r \"\"\"\"\n\n\"\"\"\"\" \"\"\"\"\f\4"); - for( fv=1; fv <= 12; fv ++) - { - A1& with = h[fv]; - ; - display(string('\15')+with.name+'\4'); - fillchar(x,sizeof(x),'\40'); - y=strf(with.score); - x[0]=chr(29-(length(with.name+y))); - display(x+y+' '+with.rank+'\4'); - } - - display(""); + byte fv; + varying_string<40> x; + varying_string<5> y; + ; + display("HIGH SCORERS\3\r Name\n\nScore Rank\r \"\"\"\"\n\n\"\"\"\"\" \"\"\"\"\f\4"); + for (fv = 1; fv <= 12; fv ++) { + A1 &with = h[fv]; + ; + display(string('\15') + with.name + '\4'); + fillchar(x, sizeof(x), '\40'); + y = strf(with.score); + x[0] = chr(29 - (length(with.name + y))); + display(x + y + ' ' + with.rank + '\4'); + } + + display(""); } void store_high(string who) - /* This procedure shows the high-scores. */ +/* This procedure shows the high-scores. */ { - byte fv,ff; -; + byte fv, ff; + ; - for( fv=1; fv <= 12; fv ++) - if (h[fv].score f; -; - /*$I-*/ - assign(f,"scores.avd"); - reset(f); - /* Did we get it? */ - - if (ioresult!=0) - {; /* No. */ - get_new_highs(); /* Invent one. */ - } else - {; /* Yes. */ - f >> h; - close(f); - } +void get_highs() { + file f; + ; + /*$I-*/ + assign(f, "scores.avd"); + reset(f); + /* Did we get it? */ + + if (ioresult != 0) { + ; /* No. */ + get_new_highs(); /* Invent one. */ + } else { + ; /* Yes. */ + f >> h; + close(f); + } } class unit_highs_initialize { - public: unit_highs_initialize(); +public: + unit_highs_initialize(); }; static unit_highs_initialize highs_constructor; -unit_highs_initialize::unit_highs_initialize() {; - get_highs(); +unit_highs_initialize::unit_highs_initialize() { + ; + get_highs(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h index a4937cbab418..2d9061cd9969 100644 --- a/engines/avalanche/highs.h +++ b/engines/avalanche/highs.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,9 +30,9 @@ namespace Avalanche { - void show_highs(); +void show_highs(); - void store_high(string who); +void store_high(string who); } // End of namespace Avalanche. diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index f5f106ea0bf4..2f9e603b9e45 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,202 +34,273 @@ namespace Avalanche { - /* program's signature */ +/* program's signature */ const varying_string<20> tsr_tmark = "FISH FISH FISH!!!"; -integer gd,gm; +integer gd, gm; byte a /*absolute $A000:0*/; -matrix<1,800,0,3,byte> sv; -byte bit; string nam; -byte tsr_int; word tsr_ax; - -void grab() -{; - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(a,sv[1][bit],800); - } +matrix<1, 800, 0, 3, byte> sv; +byte bit; +string nam; +byte tsr_int; +word tsr_ax; + +void grab() { + ; + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(a, sv[1][bit], 800); + } } -void drop() -{; - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(sv[1][bit],a,800); - } +void drop() { + ; + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(sv[1][bit], a, 800); + } } -void say(string x) -{; - grab(); output << string('\15')+x; +void say(string x) { + ; + grab(); + output << string('\15') + x; } -void pak(string x) -{ - char r; -; - say(x+" (press any key...)"); r=readkey(); drop(); +void pak(string x) { + char r; + ; + say(x + " (press any key...)"); + r = readkey(); + drop(); } -string typein() -{ - char r; string x; -string typein_result; -; - x=""; - do { - r=readkey(); - switch (r) { - case '\10': if (x[0]>'\0') {; output << string('\10')+'\40'+'\10'; x[0] -= 1; } break; - case '\15': {; typein_result=x; return typein_result; } break; - case '\33': {; typein_result=""; return typein_result; } break; - default: if (x[0]<'\62') {; x=x+r; output << r; } - } - } while (!false); -return typein_result; +string typein() { + char r; + string x; + string typein_result; + ; + x = ""; + do { + r = readkey(); + switch (r) { + case '\10': + if (x[0] > '\0') { + ; + output << string('\10') + '\40' + '\10'; + x[0] -= 1; + } + break; + case '\15': { + ; + typein_result = x; + return typein_result; + } + break; + case '\33': { + ; + typein_result = ""; + return typein_result; + } + break; + default: + if (x[0] < '\62') { + ; + x = x + r; + output << r; + } + } + } while (!false); + return typein_result; } -void load() -{ - byte a /*absolute $A000:1200*/; untyped_file f; -; - say("LOAD: filename?"); nam=typein(); drop(); - if (nam=="") return; - assign(f,nam); reset(f,1); - if (ioresult!=0) - {; - pak("LOAD: file not found."); return; - } - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,12080); - if (ioresult!=0) - {; - pak("LOAD: error whilst loading."); close(f); return; - } - } - close(f); +void load() { + byte a /*absolute $A000:1200*/; + untyped_file f; + ; + say("LOAD: filename?"); + nam = typein(); + drop(); + if (nam == "") return; + assign(f, nam); + reset(f, 1); + if (ioresult != 0) { + ; + pak("LOAD: file not found."); + return; + } + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 12080); + if (ioresult != 0) { + ; + pak("LOAD: error whilst loading."); + close(f); + return; + } + } + close(f); } -void save() -{ - const string header = - string("This is a file from an Avvy game, and its contents are subject to ")+ - "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; - untyped_file f; varying_string<30> screenname; searchrec s; char r; -byte a /*absolute $A000:1200*/; -; - say("SAVE: filename?"); nam=typein(); drop(); - if (nam=="") return; - findfirst(nam,anyfile,s); if (doserror==0) - {; - say("SAVE: That exists, are you sure\? (Y/N)"); - do { r=upcase(readkey()); } while (!(set::of('Y','N', eos).has(r))); drop(); - if (r=='N') return; - } - screenname="Saved with HIZ."; - assign(f,nam); rewrite(f,1); blockwrite(f,header[1],146); - blockwrite(f,screenname,31); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,a,12080); - if (ioresult!=0) - {; - pak("SAVE: error whilst saving."); close(f); return; - } - } +void save() { + const string header = + string("This is a file from an Avvy game, and its contents are subject to ") + + "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; + untyped_file f; + varying_string<30> screenname; + searchrec s; + char r; + byte a /*absolute $A000:1200*/; + ; + say("SAVE: filename?"); + nam = typein(); + drop(); + if (nam == "") return; + findfirst(nam, anyfile, s); + if (doserror == 0) { + ; + say("SAVE: That exists, are you sure\? (Y/N)"); + do { + r = upcase(readkey()); + } while (!(set::of('Y', 'N', eos).has(r))); + drop(); + if (r == 'N') return; + } + screenname = "Saved with HIZ."; + assign(f, nam); + rewrite(f, 1); + blockwrite(f, header[1], 146); + blockwrite(f, screenname, 31); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, a, 12080); + if (ioresult != 0) { + ; + pak("SAVE: error whilst saving."); + close(f); + return; + } + } } -void hedges() -{; - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - fillchar(mem[0xa000*14*80],80,'\377'); - fillchar(mem[0xa000*166*80],80,'\377'); - } +void hedges() { + ; + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + fillchar(mem[0xa000 * 14 * 80], 80, '\377'); + fillchar(mem[0xa000 * 166 * 80], 80, '\377'); + } } -void reset_() -{ - registers regs; -; - regs.ax=14; - intr(0x10,regs); - directvideo=false; +void reset_() { + registers regs; + ; + regs.ax = 14; + intr(0x10, regs); + directvideo = false; } -void do_pop() -{ - char r; -; - do { - say("HIZ: Load Save Hedges Reset eXit?"); r=upcase(readkey()); drop(); - switch (r) { - case 'L': load(); break; - case 'S': save(); break; - case 'H': hedges(); break; - case 'R': reset_(); break; - case 'X': return; break; - } - } while (!false); +void do_pop() { + char r; + ; + do { + say("HIZ: Load Save Hedges Reset eXit?"); + r = upcase(readkey()); + drop(); + switch (r) { + case 'L': + load(); + break; + case 'S': + save(); + break; + case 'H': + hedges(); + break; + case 'R': + reset_(); + break; + case 'X': + return; + break; + } + } while (!false); } /* Now for the TSR stuff */ -void mypoprtn() -{ - registers r; -; - beginpop; - do_pop(); - endpop; +void mypoprtn() { + registers r; + ; + beginpop; + do_pop(); + endpop; } /**********************/ -void stop_tsr() -{; - if (tsrexit) - output << "HIZ stopped" << NL; - else - output << "Unable to stop HIZ - other TSR has been installed." << NL; +void stop_tsr() { + ; + if (tsrexit) + output << "HIZ stopped" << NL; + else + output << "Unable to stop HIZ - other TSR has been installed." << NL; } /**********************/ /* This interrupt is called at program start-up. Its purpose is to provide a way to communicate with an installed copy of the TSR through cmdline params. The installation of the intrpt serves to prevent any attempt to install a 2nd copy of the TSR */ -void tsr_intrtn(word flags,word cs,word ip,word ax,word bx,word cx,word dx,word si,word di,word ds,word es,word bp) +void tsr_intrtn(word flags, word cs, word ip, word ax, word bx, word cx, word dx, word si, word di, word ds, word es, word bp) /*interrupt;*/ -{; - tsr_ax=ax; - cli; - beginint; - sti; - - switch (tsr_ax) { - case 1: {; - stop_tsr(); /* Terminate TSR, if poss.*/ - } - break; - case 2: {; - tsroff= true; /* Suspend TSR */ - output << "HIZ suspended." << NL; - } - break; - case 3: {; - tsroff=false; - output << "HIZ restarted" << NL; - } - break; - } - cli; - endint; - sti; +{ + ; + tsr_ax = ax; + cli; + beginint; + sti; + + switch (tsr_ax) { + case 1: { + ; + stop_tsr(); /* Terminate TSR, if poss.*/ + } + break; + case 2: { + ; + tsroff = true; /* Suspend TSR */ + output << "HIZ suspended." << NL; + } + break; + case 3: { + ; + tsroff = false; + output << "HIZ restarted" << NL; + } + break; + } + cli; + endint; + sti; } /*******************/ byte i; @@ -237,78 +308,74 @@ registers r; string st; boolean b; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - - /********************************************/ - /* Check to see if TSR is already installed */ - /********************************************/ - - tsr_int=dupcheck(tsr_tmark,&tsr_intrtn); - - /*****************************************/ - /* If it IS already installed, check for */ - /* parameter. */ - /*****************************************/ - - if (tsr_int > 0) - { - if (paramcount>0) - { - st=paramstr(1); - for( i=1; i <= length(st); i ++) - st[i]=upcase(st[i]); - if (st=="STOP") - r.ax=1; - else if (st=="HOLD") r.ax=2; - else if (st=="RSTR") r.ax=3; - else r.ax=4; - - if (r.ax<4) - {; - intr(tsr_int,r); - return 0; - } - else - {; - output << "HIZ: invalid parameter " << paramstr(1) << NL; - output << "Syntax: HIZ stop/hold/rstr" << NL; - return 0; - } - } - else - {; - output << "HIZ already installed." << NL; - output << "(If you're sure it isn't, try running BLANKINT /I." << NL; - output << "It's in the TURBO directory.)" << NL; - } - return 0; - } - - output << string("Wait...")+'\15'; /* tell 'em to wait...! */ - - /* Call PopSetUp to point to PopUp routine. Include the - scancode and the keymask to activate the program. In - this example, the scancode is $23 (H) and the - keymask is 08h (Alt.) */ - - popsetup(&mypoprtn,0x23,0x8); - - directvideo=false; - output << " v1.0, (c) 1992, Thomas Thurman." << NL; - output << " " << NL; - output << " The AVD saving/loading/hedging program." << NL; - output << " Use with Dr. Genius. The Hot Key is Ctrl-Alt-H." << NL; - - output << NL; - output << " Enter \"HIZ stop\" to remove Hiz from memory" << NL; - output << " \"HIZ hold\" to temporarily halt Hiz" << NL; - output << " \"HIZ rstr\" to restart Hiz" << NL; - stacksw=-1; - install_int; - keep(0); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + + /********************************************/ + /* Check to see if TSR is already installed */ + /********************************************/ + + tsr_int = dupcheck(tsr_tmark, &tsr_intrtn); + + /*****************************************/ + /* If it IS already installed, check for */ + /* parameter. */ + /*****************************************/ + + if (tsr_int > 0) { + if (paramcount > 0) { + st = paramstr(1); + for (i = 1; i <= length(st); i ++) + st[i] = upcase(st[i]); + if (st == "STOP") + r.ax = 1; + else if (st == "HOLD") r.ax = 2; + else if (st == "RSTR") r.ax = 3; + else r.ax = 4; + + if (r.ax < 4) { + ; + intr(tsr_int, r); + return 0; + } else { + ; + output << "HIZ: invalid parameter " << paramstr(1) << NL; + output << "Syntax: HIZ stop/hold/rstr" << NL; + return 0; + } + } else { + ; + output << "HIZ already installed." << NL; + output << "(If you're sure it isn't, try running BLANKINT /I." << NL; + output << "It's in the TURBO directory.)" << NL; + } + return 0; + } + + output << string("Wait...") + '\15'; /* tell 'em to wait...! */ + + /* Call PopSetUp to point to PopUp routine. Include the + scancode and the keymask to activate the program. In + this example, the scancode is $23 (H) and the + keymask is 08h (Alt.) */ + + popsetup(&mypoprtn, 0x23, 0x8); + + directvideo = false; + output << " v1.0, (c) 1992, Thomas Thurman." << NL; + output << " " << NL; + output << " The AVD saving/loading/hedging program." << NL; + output << " Use with Dr. Genius. The Hot Key is Ctrl-Alt-H." << NL; + + output << NL; + output << " Enter \"HIZ stop\" to remove Hiz from memory" << NL; + output << " \"HIZ hold\" to temporarily halt Hiz" << NL; + output << " \"HIZ rstr\" to restart Hiz" << NL; + stacksw = -1; + install_int; + keep(0); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp index 32dad7487413..2c47cee29991 100644 --- a/engines/avalanche/incline.cpp +++ b/engines/avalanche/incline.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -45,156 +45,161 @@ namespace Avalanche { byte fv; char t; string bugline; -boolean zoomy,numlockhold; +boolean zoomy, numlockhold; boolean filename_specified; -void syntax() -{ - assign(output,""); rewrite(output); - output << NL; - output << string("Lord Avalot d'Argent\n\n(c) ")+copyright+" Mark, Mike and Thomas Thurman." << NL; - output << string("~~~~~~~~~~~~~~~~~~~~~\n\n")+vernum << NL; - output << NL; - output << "Syntax:" << NL; - output << "\n/?\ndisplays this screen," << NL; - output << "\n/O\noverrides EGA check," << NL; - output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; - output << "\n/P\nlogs with Epson codes to , default PRN," << NL; - output << "\n/Q\ncancels sound effects," << NL; - output << "\n/Z\ngoes straight into the game." << NL; - output << NL; - output << "\n\n\n\n\n\n\n... Have fun!" << NL; - exit(177); +void syntax() { + assign(output, ""); + rewrite(output); + output << NL; + output << string("Lord Avalot d'Argent\n\n(c) ") + copyright + " Mark, Mike and Thomas Thurman." << NL; + output << string("~~~~~~~~~~~~~~~~~~~~~\n\n") + vernum << NL; + output << NL; + output << "Syntax:" << NL; + output << "\n/?\ndisplays this screen," << NL; + output << "\n/O\noverrides EGA check," << NL; + output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; + output << "\n/P\nlogs with Epson codes to , default PRN," << NL; + output << "\n/Q\ncancels sound effects," << NL; + output << "\n/Z\ngoes straight into the game." << NL; + output << NL; + output << "\n\n\n\n\n\n\n... Have fun!" << NL; + exit(177); } -void not_through_bootstrap() -{ - output << "Avalot must be loaded through the bootstrap." << NL; - exit(0); +void not_through_bootstrap() { + output << "Avalot must be loaded through the bootstrap." << NL; + exit(0); } -void get_storage_addr() -{ - integer e; +void get_storage_addr() { + integer e; - val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); - val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); - skellern=storage_ofs+1; + val(paramstr(2), storage_seg, e); + if (e != 0) not_through_bootstrap(); + val(paramstr(3), storage_ofs, e); + if (e != 0) not_through_bootstrap(); + skellern = storage_ofs + 1; } -longint value(string x) -{ - longint q; integer e; +longint value(string x) { + longint q; + integer e; - longint value_result; - val(x,q,e); value_result=q; - return value_result; + longint value_result; + val(x, q, e); + value_result = q; + return value_result; } -void undo_js() -{ - { - joysetup& with = js; - - cxmin=with.xmid-(((with.xmid-with.xmin) / 10)*with.centre); - cxmax=with.xmid+(((with.xmax-with.xmid) / 10)*with.centre); - cymin=with.ymid-(((with.ymid-with.ymin) / 10)*with.centre); - cymax=with.ymid+(((with.ymax-with.ymid) / 10)*with.centre); - -/* writeln(lst,'MID ',xmid,'x',ymid); - writeln(lst,'MAX ',xmax,'x',ymax); - writeln(lst,'MIN ',xmin,'x',ymin); - writeln(lst,'CENTRE ',xmid); - writeln(lst,cxmin); - writeln(lst,cxmax); - writeln(lst,cymin); - writeln(lst,cymax);*/ - } +void undo_js() { + { + joysetup &with = js; + + cxmin = with.xmid - (((with.xmid - with.xmin) / 10) * with.centre); + cxmax = with.xmid + (((with.xmax - with.xmid) / 10) * with.centre); + cymin = with.ymid - (((with.ymid - with.ymin) / 10) * with.centre); + cymax = with.ymid + (((with.ymax - with.ymid) / 10) * with.centre); + + /* writeln(lst,'MID ',xmid,'x',ymid); + writeln(lst,'MAX ',xmax,'x',ymax); + writeln(lst,'MIN ',xmin,'x',ymin); + writeln(lst,'CENTRE ',xmid); + writeln(lst,cxmin); + writeln(lst,cxmax); + writeln(lst,cymin); + writeln(lst,cymax);*/ + } } void check_slope_line(); static string slope; -static boolean yn1(byte where) { boolean yn1_result; - yn1_result=slope[where]=='y'; return yn1_result; - } - -void check_slope_line() -{ - slope=paramstr(4); - -/* if slope='' then fillchar(slope,sizeof(slope),'n');*/ - - if (slope[1]!='1') not_through_bootstrap(); - - if (yn1(2)) syntax(); - - soundfx=yn1(3); - cl_override=yn1(4); - keyboardclick=yn1(5); /* 6 - see below */ - demo=yn1(7); - zoomy=yn1(8); - numlockhold=yn1(9); - use_joy_a=yn1(10); - - { - joysetup& with = js; - - with.xmid=value(paramstr( 5)); - with.ymid=value(paramstr( 6)); - with.xmin=value(paramstr( 7)); - with.ymin=value(paramstr( 8)); - with.xmax=value(paramstr( 9)); - with.ymax=value(paramstr(10)); - with.centre=value(paramstr(11)); - - undo_js(); - } +static boolean yn1(byte where) { + boolean yn1_result; + yn1_result = slope[where] == 'y'; + return yn1_result; +} - switch (slope[6]) { - case 'l': log_setup(paramstr(12),false); break; - case 'p': log_setup(paramstr(12),true); break; - } +void check_slope_line() { + slope = paramstr(4); + + /* if slope='' then fillchar(slope,sizeof(slope),'n');*/ + + if (slope[1] != '1') not_through_bootstrap(); + + if (yn1(2)) syntax(); + + soundfx = yn1(3); + cl_override = yn1(4); + keyboardclick = yn1(5); /* 6 - see below */ + demo = yn1(7); + zoomy = yn1(8); + numlockhold = yn1(9); + use_joy_a = yn1(10); + + { + joysetup &with = js; + + with.xmid = value(paramstr(5)); + with.ymid = value(paramstr(6)); + with.xmin = value(paramstr(7)); + with.ymin = value(paramstr(8)); + with.xmax = value(paramstr(9)); + with.ymax = value(paramstr(10)); + with.centre = value(paramstr(11)); + + undo_js(); + } + + switch (slope[6]) { + case 'l': + log_setup(paramstr(12), false); + break; + case 'p': + log_setup(paramstr(12), true); + break; + } } -void get_extra_data() -{ - if (! reloaded) return; +void get_extra_data() { + if (! reloaded) return; - move(mem[storage_seg*storage_ofs+300],js,sizeof(js)); + move(mem[storage_seg * storage_ofs + 300], js, sizeof(js)); - undo_js(); + undo_js(); } class unit_incline_initialize { - public: unit_incline_initialize(); +public: + unit_incline_initialize(); }; static unit_incline_initialize incline_constructor; unit_incline_initialize::unit_incline_initialize() { -/* writeln('Load code: ',paramstr(1)); - writeln('Seg & ofs: ',paramstr(2),':',paramstr(3)); - writeln('Slope line: ',paramstr(4)); - writeln('Log file: ',paramstr(5)); - writeln('File to load: ',paramstr(6)); - readln;*/ + /* writeln('Load code: ',paramstr(1)); + writeln('Seg & ofs: ',paramstr(2),':',paramstr(3)); + writeln('Slope line: ',paramstr(4)); + writeln('Log file: ',paramstr(5)); + writeln('File to load: ',paramstr(6)); + readln;*/ - filetoload=paramstr(13); - filename_specified = filetoload != ""; + filetoload = paramstr(13); + filename_specified = filetoload != ""; - logging=false; + logging = false; - if ((paramcount<3) || - ((paramstr(1)!="Go") && (paramstr(1)!="et"))) not_through_bootstrap(); + if ((paramcount < 3) || + ((paramstr(1) != "Go") && (paramstr(1) != "et"))) not_through_bootstrap(); - reloaded=paramstr(1)=="et"; + reloaded = paramstr(1) == "et"; - get_storage_addr(); + get_storage_addr(); - get_extra_data(); + get_extra_data(); - check_slope_line(); + check_slope_line(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h index 799ad79ad5ec..736dd199d84e 100644 --- a/engines/avalanche/incline.h +++ b/engines/avalanche/incline.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index e6ebcfb9f7e7..46ad0a4b2c1b 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,31 +30,34 @@ namespace Avalanche { struct inirex { - varying_string<12> a; - word num; + varying_string<12> a; + word num; }; text i; file o; inirex x; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(i,"v:init0.dat"); reset(i); - assign(o,"v:init.avd"); rewrite(o); - - while (! eof(i)) - {; - i >> x.a >> NL; - i >> x.num >> NL; - o << x; - output << '.'; - } - - close(i); close(o); - output << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(i, "v:init0.dat"); + reset(i); + assign(o, "v:init.avd"); + rewrite(o); + + while (! eof(i)) { + ; + i >> x.a >> NL; + i >> x.num >> NL; + o << x; + output << '.'; + } + + close(i); + close(o); + output << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index c24a933ed13f..bfb2db11e968 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,46 +30,49 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -integer gd,gm; +integer gd, gm; fonttype font; varying_string<79> current; char r; -void plottext() -{ - byte x,y; -; - for( y=0; y <= 7; y ++) - {; - for( x=1; x <= length(current); x ++) - mem[0xa000*12880+y*80+x]=font[current[x]][y]; - fillchar(mem[0xa000*12881+y*80+x],79-x,'\0'); - } +void plottext() { + byte x, y; + ; + for (y = 0; y <= 7; y ++) { + ; + for (x = 1; x <= length(current); x ++) + mem[0xa000 * 12880 + y * 80 + x] = font[current[x]][y]; + fillchar(mem[0xa000 * 12881 + y * 80 + x], 79 - x, '\0'); + } } -void loadfont() -{ - file f; -; - assign(f,"c:\\thomas\\ttsmall.fnt"); reset(f); - f >> font; close(f); +void loadfont() { + file f; + ; + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\turbo"); - loadfont(); - setfillstyle(1,6); bar(0,0,640,200); - current=""; - do { - r=readkey(); - current=current+r; - plottext(); - } while (!false); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\turbo"); + loadfont(); + setfillstyle(1, 6); + bar(0, 0, 640, 200); + current = ""; + do { + r = readkey(); + current = current + r; + plottext(); + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index 010e024b942c..b23bd1cc6592 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,7 +32,7 @@ namespace Avalanche { - /* This is a stand-alone program. */ +/* This is a stand-alone program. */ /* 0, black, remains 0. Other numbers: the bits take precedence from the left. @@ -45,20 +45,21 @@ namespace Avalanche { Second bit: 7 (light grey) First bit: 1 (blue). */ -const palettetype our_palette = - {16, - /* sic */ -{{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}}}; +const palettetype our_palette = { + 16, + /* sic */ + {{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}} +}; - const integer scardcount = 13; +const integer scardcount = 13; - const array<0,scardcount-1,integer> soundcards = - {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; +const array < 0, scardcount - 1, integer > soundcards = +{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; -typedef matrix<'\0','\377',1,16,byte> fonttype; +typedef matrix < '\0', '\377', 1, 16, byte > fonttype; fonttype f; -matrix<0,39,1,16,byte> next_line; +matrix<0, 39, 1, 16, byte> next_line; byte next_bitline; @@ -68,308 +69,321 @@ boolean cut_out; word cut_out_time; -array<1,117,varying_string<40> > x; +array<1, 117, varying_string<40> > x; byte this_line; -word* skellern; +word *skellern; boolean nomusic; /*$L intro.obj*/ -extern void introduction(); +extern void introduction(); -void graphmode(integer mode) -{ - registers regs; +void graphmode(integer mode) { + registers regs; - regs.ax=mode; - intr(0x10,regs); + regs.ax = mode; + intr(0x10, regs); } /* Firstly, port[$3C4]:=2; port[$3CF]:=4;, Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ -void loadfont() -{ - file ff; +void loadfont() { + file ff; - assign(ff,"avalot.fnt"); - reset(ff); - ff >> f; - close(ff); + assign(ff, "avalot.fnt"); + reset(ff); + ff >> f; + close(ff); } void calc_next_line() - /* This proc sets up next_line. */ +/* This proc sets up next_line. */ { - string l; - byte fv,ff; - boolean oddlen; - byte start; - byte this_; - - fillchar(next_line,sizeof(next_line),'\0'); /* All blanks. */ - - if (this_line==117) - { - cut_out=true; - return; - } - - l=x[this_line]; - this_line += 1; - - start=(20-length(l) / 2)-1; - oddlen=odd(length(l)); - - for( fv=1; fv <= length(l); fv ++) - for( ff=1; ff <= 16; ff ++) - { - this_=f[l[fv]][ff]; - if (oddlen) - { /* Odd, => 4 bits shift to the right. */ - next_line[start+fv][ff] += this_ << 4; - next_line[start+fv-1][ff] += (cardinal)this_ >> 4; - } else - { /* Even, => no bit shift. */ - next_line[start+fv][ff]=this_; - } - } - next_bitline=1; + string l; + byte fv, ff; + boolean oddlen; + byte start; + byte this_; + + fillchar(next_line, sizeof(next_line), '\0'); /* All blanks. */ + + if (this_line == 117) { + cut_out = true; + return; + } + + l = x[this_line]; + this_line += 1; + + start = (20 - length(l) / 2) - 1; + oddlen = odd(length(l)); + + for (fv = 1; fv <= length(l); fv ++) + for (ff = 1; ff <= 16; ff ++) { + this_ = f[l[fv]][ff]; + if (oddlen) { + /* Odd, => 4 bits shift to the right. */ + next_line[start + fv][ff] += this_ << 4; + next_line[start + fv - 1][ff] += (cardinal)this_ >> 4; + } else { + /* Even, => no bit shift. */ + next_line[start + fv][ff] = this_; + } + } + next_bitline = 1; } -void display() -{ - byte fv,ff; +void display() { + byte fv, ff; - if (next_bitline == 17) calc_next_line(); + if (next_bitline == 17) calc_next_line(); - if (cut_out) - { - if (nomusic) - cut_out_time -= 1; - else - if (ampgetmodulestatus != md_playing) cut_out_time=0; - return; - } + if (cut_out) { + if (nomusic) + cut_out_time -= 1; + else if (ampgetmodulestatus != md_playing) cut_out_time = 0; + return; + } - move(mem[0xa000*40],mem[0xa000*0],7960); - for( fv=0; fv <= 39; fv ++) - mem[0xa1f1*8+fv]=next_line[fv][next_bitline]; - next_bitline += 1; + move(mem[0xa000 * 40], mem[0xa000 * 0], 7960); + for (fv = 0; fv <= 39; fv ++) + mem[0xa1f1 * 8 + fv] = next_line[fv][next_bitline]; + next_bitline += 1; } -void plot_a_star(integer x,integer y) -{ - byte ofs; +void plot_a_star(integer x, integer y) { + byte ofs; - ofs=x % 8; - x=x / 8; - mem[0xa000*x+y*40] += (cardinal)128 >> ofs; + ofs = x % 8; + x = x / 8; + mem[0xa000 * x + y * 40] += (cardinal)128 >> ofs; } -void plot_some_stars(integer y) -{ - byte fv,times; - - switch (Random(7)) { - case 1: times=1; break; - case 2: times=2; break; - case 3: times=3; break; - default: return; - } - - for( fv=1; fv <= times; fv ++) - plot_a_star(Random(320),y); +void plot_some_stars(integer y) { + byte fv, times; + + switch (Random(7)) { + case 1: + times = 1; + break; + case 2: + times = 2; + break; + case 3: + times = 3; + break; + default: + return; + } + + for (fv = 1; fv <= times; fv ++) + plot_a_star(Random(320), y); } -void starry_starry_night() -{ - integer y; - byte bit; - - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - - for( bit=0; bit <= 2; bit ++) - { - port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( y=1; y <= 200; y ++) - plot_some_stars(y); - } +void starry_starry_night() { + integer y; + byte bit; + + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + for (bit = 0; bit <= 2; bit ++) { + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (y = 1; y <= 200; y ++) + plot_some_stars(y); + } } void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the Graph unit. */ { - integer gd,gm; + integer gd, gm; - gd=3; gm=1; initgraph(gd,gm,""); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); } -void shovestars() -{ - move(mem[0xa000*0],mem[0xa000*40],7960); - fillchar(mem[0xa000*0],40,'\0'); - plot_some_stars(0); +void shovestars() { + move(mem[0xa000 * 0], mem[0xa000 * 40], 7960); + fillchar(mem[0xa000 * 0], 40, '\0'); + plot_some_stars(0); } -void do_next_line() -{ - byte bit; - - port[0x3c4]=2; port[0x3ce]=4; - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - switch (bit) { - case 0: if ((displaycounter % 10)==0) shovestars(); break; - case 1: if ((displaycounter % 2)==0) shovestars(); break; - case 2: shovestars(); break; - case 3: display(); break; /* The text. */ - } - } - - if (displaycounter==40) displaycounter=0; +void do_next_line() { + byte bit; + + port[0x3c4] = 2; + port[0x3ce] = 4; + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + switch (bit) { + case 0: + if ((displaycounter % 10) == 0) shovestars(); + break; + case 1: + if ((displaycounter % 2) == 0) shovestars(); + break; + case 2: + shovestars(); + break; + case 3: + display(); + break; /* The text. */ + } + } + + if (displaycounter == 40) displaycounter = 0; } -void load_text() -{ - word fv; - char* c; - byte thisline; - - - c=addr(introduction()); - thisline=0; - fillchar(x,sizeof(x),'\0'); - - for( fv=1; fv <= 2456; fv ++) - { - switch (*c) { - case '\15': thisline += 1; break; - case '\12':/*nop*/; break; - default: x[thisline]=x[thisline]+*c; - } - - c += 1; - } +void load_text() { + word fv; + char *c; + byte thisline; + + + c = addr(introduction()); + thisline = 0; + fillchar(x, sizeof(x), '\0'); + + for (fv = 1; fv <= 2456; fv ++) { + switch (*c) { + case '\15': + thisline += 1; + break; + case '\12':/*nop*/ + ; + break; + default: + x[thisline] = x[thisline] + *c; + } + + c += 1; + } } -void check_params() -{ - word s,o; integer e; +void check_params() { + word s, o; + integer e; - if (paramstr(1)!="jsb") exit(0); - val(paramstr(2),s,e); if (e!=0) exit(0); - val(paramstr(3),o,e); if (e!=0) exit(0); - skellern=ptr(s,o+1); + if (paramstr(1) != "jsb") exit(0); + val(paramstr(2), s, e); + if (e != 0) exit(0); + val(paramstr(3), o, e); + if (e != 0) exit(0); + skellern = ptr(s, o + 1); } -integer getsoundhardware(psoundcard scard) -{ - integer sc,i,autosel,select; - char ch; - integer e; +integer getsoundhardware(psoundcard scard) { + integer sc, i, autosel, select; + char ch; + integer e; -integer getsoundhardware_result; + integer getsoundhardware_result; Lagain: - sc=detectgus(scard); - if (sc!=0) sc=detectpas(scard); - if (sc!=0) sc=detectaria(scard); - if (sc!=0) sc=detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); - - autosel=-1; -/* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13),select,e); - - /* Default entry? */ - if (select==0) select=autosel; - if (select!=autosel) { - /* clear all assumptions */ - sc=-1; - fillchar(scard,sizeof(tsoundcard),0); - scard->id=soundcards[select-1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id==id_dac) scard->ioport=0x378; - - /* Read user input */ - val(paramstr(15),i,e); - - if (i!=0) scard->ioport=i; - if (sc!=1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : scard->samplesize=2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: scard->stereo=true; - break; /* enable stereo */ - default: { - scard->samplesize=1; - scard->stereo=false; - } - } - - if (scard->id!=id_dac) { - val(paramstr(17),i,e); - - if (i!=0) scard->dmairq=i; - - val(paramstr(16),i,e); - - if (i!=0) scard->dmachannel=i; - } else { - /* Select correct DAC */ - scard->maxrate=44100; - if (select==11) { - scard->stereo=true; - scard->dmachannel=1; /* Special 'mark' */ - scard->maxrate=60000; - } else - if (select==12) { - scard->stereo=true; - scard->dmachannel=2; - scard->maxrate=60000; - if (scard->ioport==0) scard->ioport=0x378; - } else - if (select==13) { - scard->dmachannel=0; - scard->ioport=0x42; /* Special 'mark' */ - scard->maxrate=44100; - } - } - -/* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result=0; -return getsoundhardware_result; + sc = detectgus(scard); + if (sc != 0) sc = detectpas(scard); + if (sc != 0) sc = detectaria(scard); + if (sc != 0) sc = detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); + + autosel = -1; + /* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13), select, e); + + /* Default entry? */ + if (select == 0) select = autosel; + if (select != autosel) { + /* clear all assumptions */ + sc = -1; + fillchar(scard, sizeof(tsoundcard), 0); + scard->id = soundcards[select - 1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id == id_dac) scard->ioport = 0x378; + + /* Read user input */ + val(paramstr(15), i, e); + + if (i != 0) scard->ioport = i; + if (sc != 1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : + scard->samplesize = 2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: + scard->stereo = true; + break; /* enable stereo */ + default: { + scard->samplesize = 1; + scard->stereo = false; + } + } + + if (scard->id != id_dac) { + val(paramstr(17), i, e); + + if (i != 0) scard->dmairq = i; + + val(paramstr(16), i, e); + + if (i != 0) scard->dmachannel = i; + } else { + /* Select correct DAC */ + scard->maxrate = 44100; + if (select == 11) { + scard->stereo = true; + scard->dmachannel = 1; /* Special 'mark' */ + scard->maxrate = 60000; + } else if (select == 12) { + scard->stereo = true; + scard->dmachannel = 2; + scard->maxrate = 60000; + if (scard->ioport == 0) scard->ioport = 0x378; + } else if (select == 13) { + scard->dmachannel = 0; + scard->ioport = 0x42; /* Special 'mark' */ + scard->maxrate = 44100; + } + } + + /* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result = 0; + return getsoundhardware_result; } tsoundcard scard; @@ -378,247 +392,252 @@ tdds dds; pmodule module; tsdi_init sdi; integer e, -bufsize; + bufsize; char ch; boolean v86, -vdsok; -longint a,rate, -tempseg; + vdsok; +longint a, rate, + tempseg; string answer; pointer temp; word flags; word curch; byte modulevolume; -array<0,4,tsampleinfo> sample; -array<0,31,word> voltable; - -int main(int argc, const char* argv[]) -{ - - pio_initialize(argc, argv); - check_params(); - - nomusic=paramstr(13)=='0'; - - if (! nomusic) - { - /* Read sound card information */ - if (getsoundhardware(&scard)==-1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id==id_gus) { - /* Initialize GUS player */ - #ifndef DPMI - scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ - #endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus,0,31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt,gus_timer); - } else { - /* Initialize Virtual DMA Specification */ - #ifndef DPMI - vdsok=vdsinit==0; - #else - vdsok=false; - #endif - - fillchar(mcpstrc,sizeof(tmcpstruct),0); - - /* Query for sampling rate */ - val(paramstr(14),a,e); - if (a>4000) rate=a; else rate=21000; - - /* Query for quality */ - mcpstrc.options=mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi=sdi_sb; - scard.maxrate=22000; - } - break; - case id_sbpro : { - sdi=sdi_sbpro; - scard.maxrate=22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi=sdi_pas; - scard.maxrate=44100; - } - break; - case id_sb16 : { - sdi=sdi_sb16; - scard.maxrate=44100; - } - break; - case id_aria : { - sdi=sdi_aria; - scard.maxrate=44100; - } - break; - case id_wss : { - sdi=sdi_wss; - scard.maxrate=48000; - } - break; - #ifndef DPMI - case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ - #endif - } - - mcpinitsounddevice(sdi,&scard); - a=mcp_tablesize; - mcpstrc.reqsize=0; - - /* Calculate mixing buffer size */ - bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize=0; - if ((mcpstrc.options & mcp_quality)>0) - if (scard.samplesize==1) a += mcp_qualitysize; else - a=mcp_tablesize16+mcp_qualitysize16; - if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; - - #ifdef DPMI - dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); - v86=(flags & 2)==0; - #endif - - /* Allocate volume table + mixing buffer */ - #ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg=0; - dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); - } else { - #endif - getmem(temp,a+longint(bufsize)); - if (temp==nil) exit(2); - #ifdef DPMI - tempseg=seg(temp); - } - #else - tempseg=seg(temp)+ofs(temp) / 16+1; - #endif - mcpstrc.bufferseg=tempseg; - mcpstrc.bufferphysical=-1; - - if (vdsok && (scard.id!=id_dac)) { - dds.size=bufsize; - dds.segment=tempseg; - dds.offset=0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; - } - if (mcpstrc.bufferphysical==-1) - #ifdef DPMI - mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); - #else - mcpstrc.bufferphysical=(longint)(tempseg) << 4; - #endif - - mcpstrc.buffersize=bufsize; - mcpstrc.samplingrate=rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc)!=0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp,0,31); - } - - /* Try to initialize AMP */ - if (ampinit(0)!=0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt,amp_timer); - - #ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id==id_dac) setdactimer(tsgettimerrate); - #endif - - if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; - - /* Load an example AMF */ - module=amploadmod("glover.mod",0); - if (module==nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) - && (scard.samplesize==2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); - cdisetupchannels(0,module->channelcount+2,&voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0,module->channelcount+2,nil); - } - - curch=module->channelcount; - modulevolume=64; - - /***/ ampplaymodule(module,0); - } - - setupgraphics(); - - randseed=177; checkbreak=false; - - load_text(); - - this_line=1; - - graphmode(0xd); - loadfont(); - - next_bitline=17; - displaycounter=0; - - cut_out_time=333; - - setallpalette(our_palette); +array<0, 4, tsampleinfo> sample; +array<0, 31, word> voltable; + +int main(int argc, const char *argv[]) { + + pio_initialize(argc, argv); + check_params(); + + nomusic = paramstr(13) == '0'; + + if (! nomusic) { + /* Read sound card information */ + if (getsoundhardware(&scard) == -1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id == id_gus) { + /* Initialize GUS player */ +#ifndef DPMI + scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ +#endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus, 0, 31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt, gus_timer); + } else { + /* Initialize Virtual DMA Specification */ +#ifndef DPMI + vdsok = vdsinit == 0; +#else + vdsok = false; +#endif + + fillchar(mcpstrc, sizeof(tmcpstruct), 0); + + /* Query for sampling rate */ + val(paramstr(14), a, e); + if (a > 4000) rate = a; + else rate = 21000; + + /* Query for quality */ + mcpstrc.options = mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi = sdi_sb; + scard.maxrate = 22000; + } + break; + case id_sbpro : { + sdi = sdi_sbpro; + scard.maxrate = 22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi = sdi_pas; + scard.maxrate = 44100; + } + break; + case id_sb16 : { + sdi = sdi_sb16; + scard.maxrate = 44100; + } + break; + case id_aria : { + sdi = sdi_aria; + scard.maxrate = 44100; + } + break; + case id_wss : { + sdi = sdi_wss; + scard.maxrate = 48000; + } + break; +#ifndef DPMI + case id_dac : + sdi = sdi_dac; + break; /* Only available in real mode */ +#endif + } + + mcpinitsounddevice(sdi, &scard); + a = mcp_tablesize; + mcpstrc.reqsize = 0; + + /* Calculate mixing buffer size */ + bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize = 0; + if ((mcpstrc.options & mcp_quality) > 0) + if (scard.samplesize == 1) a += mcp_qualitysize; + else + a = mcp_tablesize16 + mcp_qualitysize16; + if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; + +#ifdef DPMI + dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); + v86 = (flags & 2) == 0; +#endif + + /* Allocate volume table + mixing buffer */ +#ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg = 0; + dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); + } else { +#endif + getmem(temp, a + longint(bufsize)); + if (temp == nil) exit(2); +#ifdef DPMI + tempseg = seg(temp); + } +#else + tempseg = seg(temp) + ofs(temp) / 16 + 1; +#endif + mcpstrc.bufferseg = tempseg; + mcpstrc.bufferphysical = -1; + + if (vdsok && (scard.id != id_dac)) { + dds.size = bufsize; + dds.segment = tempseg; + dds.offset = 0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; + } + if (mcpstrc.bufferphysical == -1) +#ifdef DPMI + mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); +#else + mcpstrc.bufferphysical = (longint)(tempseg) << 4; +#endif + + mcpstrc.buffersize = bufsize; + mcpstrc.samplingrate = rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc) != 0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp, 0, 31); + } + + /* Try to initialize AMP */ + if (ampinit(0) != 0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt, amp_timer); + +#ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id == id_dac) setdactimer(tsgettimerrate); +#endif + + if (scard.id != id_gus) mcpstartvoice; + else gusstartvoice; + + /* Load an example AMF */ + module = amploadmod("glover.mod", 0); + if (module == nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) + && (scard.samplesize == 2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); + cdisetupchannels(0, module->channelcount + 2, &voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0, module->channelcount + 2, nil); + } + + curch = module->channelcount; + modulevolume = 64; + + /***/ ampplaymodule(module, 0); + } + + setupgraphics(); + + randseed = 177; + checkbreak = false; + + load_text(); + + this_line = 1; + + graphmode(0xd); + loadfont(); + + next_bitline = 17; + displaycounter = 0; - starry_starry_night(); + cut_out_time = 333; + + setallpalette(our_palette); - while ((cut_out_time>0) && (! keypressed())) - { + starry_starry_night(); + + while ((cut_out_time > 0) && (! keypressed())) { - *skellern=0; + *skellern = 0; - do_next_line(); + do_next_line(); - displaycounter += 1; + displaycounter += 1; - do {; } while (!(*skellern>0)); - } + do { + ; + } while (!(*skellern > 0)); + } - if (! nomusic) ampstopmodule; - graphmode(3); - return EXIT_SUCCESS; + if (! nomusic) ampstopmodule; + graphmode(3); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index a14ee5561887..f15e68bef6b6 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -36,23 +36,25 @@ void() old1b; boolean quicko; -void new1b() /* interrupt; */ -{; - quicko=true; +void new1b() { /* interrupt; */ + ; + quicko = true; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1b,&old1b); - setintvec(0x1b,addr(new1b())); - quicko=false; - do {; } while (!quicko); - setintvec(0x1b,&old1b); -/* r.ah:=$02; intr($16,r); - writeln(r.al and 12); { Only checks Ctrl and Alt. Both on = 12. } - until false;*/ -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1b, &old1b); + setintvec(0x1b, addr(new1b())); + quicko = false; + do { + ; + } while (!quicko); + setintvec(0x1b, &old1b); + /* r.ah:=$02; intr($16,r); + writeln(r.al and 12); { Only checks Ctrl and Alt. Both on = 12. } + until false;*/ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 1ebbc4fb663d..7569199d33dc 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,93 +33,107 @@ namespace Avalanche { struct joysetup { - word xmid,ymid,xmin,ymin,xmax,ymax; - byte centre; /* Size of centre in tenths */ + word xmid, ymid, xmin, ymin, xmax, ymax; + byte centre; /* Size of centre in tenths */ }; joysetup js; file jf; -boolean detect() -{ - word x,y,xo,yo; - byte count; -boolean detect_result; -; - count=0; - if (joystickpresent) - {; - detect_result=true; - return detect_result; - } - readjoya(xo,yo); - do { - if (count<7) count += 1; /* Take advantage of "flutter" */ - if (count==6) - {; - output << "The Bios says you don't have a joystick. However, it's often wrong" << NL; - output << "about such matters. So, do you? If you do, move joystick A to" << NL; - output << "continue. If you don't, press any key to cancel." << NL; - } - readjoya(x,y); - } while (!((keypressed()) | (x!=xo) || (y!=yo))); - detect_result=~ keypressed(); -return detect_result; +boolean detect() { + word x, y, xo, yo; + byte count; + boolean detect_result; + ; + count = 0; + if (joystickpresent) { + ; + detect_result = true; + return detect_result; + } + readjoya(xo, yo); + do { + if (count < 7) count += 1; /* Take advantage of "flutter" */ + if (count == 6) { + ; + output << "The Bios says you don't have a joystick. However, it's often wrong" << NL; + output << "about such matters. So, do you? If you do, move joystick A to" << NL; + output << "continue. If you don't, press any key to cancel." << NL; + } + readjoya(x, y); + } while (!((keypressed()) | (x != xo) || (y != yo))); + detect_result = ~ keypressed(); + return detect_result; } -void display() -{; - {; - gotoxy(20,10); output << "X min: " << js.xmin << " "; - gotoxy(20,11); output << "X max: " << js.xmax << " "; - gotoxy(20,12); output << "Y min: " << js.ymin << " "; - gotoxy(20,13); output << "Y max: " << js.ymax << " "; - } +void display() { + ; + { + ; + gotoxy(20, 10); + output << "X min: " << js.xmin << " "; + gotoxy(20, 11); + output << "X max: " << js.xmax << " "; + gotoxy(20, 12); + output << "Y min: " << js.ymin << " "; + gotoxy(20, 13); + output << "Y max: " << js.ymax << " "; + } } -void getmaxmin() -{ - word x,y; -; - output << "Rotate the joystick around in a circle, as far from the centre as it" << NL; - output << "can get. Then click a button." << NL; - {; - js.xmax=0; js.xmin=maxint; - js.ymax=0; js.ymin=maxint; - } - do { - readjoya(x,y); - {; - if (xjs.xmax) js.xmax=x; - if (y>js.ymax) js.ymax=y; - display(); - } - } while (!(buttona1 | buttona2)); - do {; } while (!(~ (buttona1 | buttona2))); - output << NL; - output << "Thank you. Now please centre your joystick and hit a button." << NL; - do {; } while (!(buttona1 | buttona2)); - readjoya(js.xmid,js.ymid); +void getmaxmin() { + word x, y; + ; + output << "Rotate the joystick around in a circle, as far from the centre as it" << NL; + output << "can get. Then click a button." << NL; + { + ; + js.xmax = 0; + js.xmin = maxint; + js.ymax = 0; + js.ymin = maxint; + } + do { + readjoya(x, y); + { + ; + if (x < js.xmin) js.xmin = x; + if (y < js.ymin) js.ymin = y; + if (x > js.xmax) js.xmax = x; + if (y > js.ymax) js.ymax = y; + display(); + } + } while (!(buttona1 | buttona2)); + do { + ; + } while (!(~(buttona1 | buttona2))); + output << NL; + output << "Thank you. Now please centre your joystick and hit a button." << NL; + do { + ; + } while (!(buttona1 | buttona2)); + readjoya(js.xmid, js.ymid); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=2; - clrscr; - output << "Avalot joystick setup routine- by TT. Thanks go to David B. Howorth." << NL; - output << NL; - if (detect()) output << "You've got a joystick!" << NL; else return 0; - getmaxmin(); - do { - output << "Centring factor\? (3-9)"; - input >> js.centre >> NL; - } while (!(set::of(range(1,9), eos).has(js.centre))); - assign(jf,"v:joytmp.dat"); - rewrite(jf); jf << js; close(jf); /* write it all out to disk. */ -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 2; + clrscr; + output << "Avalot joystick setup routine- by TT. Thanks go to David B. Howorth." << NL; + output << NL; + if (detect()) output << "You've got a joystick!" << NL; + else return 0; + getmaxmin(); + do { + output << "Centring factor\? (3-9)"; + input >> js.centre >> NL; + } while (!(set::of(range(1, 9), eos).has(js.centre))); + assign(jf, "v:joytmp.dat"); + rewrite(jf); + jf << js; + close(jf); /* write it all out to disk. */ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index 8ebea363250d..8b9496ccf1db 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -61,7 +61,7 @@ Hill Road, Portland, Oregon 97219. namespace Avalanche { -typedef void(*readjoyproc)(byte a,byte b,word& c,word& d); +typedef void(*readjoyproc)(byte a, byte b, word &c, word &d); typedef boolean(*buttonfunc)(byte a); readjoyproc readjoy; @@ -70,141 +70,142 @@ registers reg; /*----------------------------- private routines ----------------------------*/ -boolean newbios() -{ - char decadechar /*absolute $F000:$FFFB*/; - char yearchar /*absolute $F000:$FFFC*/; +boolean newbios() { + char decadechar /*absolute $F000:$FFFB*/; + char yearchar /*absolute $F000:$FFFC*/; - boolean newbios_result; - newbios_result = (set::of('9','0', eos).has(decadechar)) /*an optimistic view of software life*/ - || ((decadechar == '8') && (set::of(range('4','9'), eos).has(yearchar))); - return newbios_result; + boolean newbios_result; + newbios_result = (set::of('9', '0', eos).has(decadechar)) /*an optimistic view of software life*/ + || ((decadechar == '8') && (set::of(range('4', '9'), eos).has(yearchar))); + return newbios_result; } /*$F+*/ -void oldreadjoy(byte xbit,byte ybit, word& xaxis, word& yaxis) -{; -/* -inline( - $BA/$01/$02/ {mov dx, 201h ;load dx with joystick port address } - $C4/$BE/>XAxis/ {les di, XAxis[bp] ;load es with segment and di w/offset } - $8A/$66/YAxis/ {les di, YAxis[bp] } - $8A/$66/XAxis/ {les di, XAxis[bp] ;load es with segment and di w/offset } + $8A/$66/YAxis/ {les di, YAxis[bp] } + $8A/$66/'+double_off+' '+italic+x+italic_off << NL; - else - output << logfile << string("> ")+x << NL; -} - -void log_addstuff(string x) -{; - if (~ logging) return; - scroll_line=scroll_line+x; -} - -void log_scrollchar(string x) /* print one character */ -{ - varying_string<2> z; -; - if (~ logging) return; - switch (x[1]) { - case '`': z=quote; break; /* Open quotes: "66" */ - case '"': z=unquote; break; /* Close quotes: "99" */ - case '\357': z=copyright; break; /* Copyright sign. */ - default: z=x; - } - log_addstuff(z); - scroll_line_length += length(z); -} - -void log_italic() -{; - if (~ logging) return; - if (log_epson) - log_addstuff(italic); - else - log_addstuff("*"); -} - -void log_roman() -{; - if (~ logging) return; - if (log_epson) - log_addstuff(italic_off); - else - log_addstuff("*"); -} - -void log_epsonroman() /* This only sends the Roman code if you're on Epson.*/ -{; - if (~ logging) return; - if (log_epson) log_addstuff(italic_off); -} - -void log_scrollline() /* Set up a line for the scroll driver */ -{; - scroll_line_length=0; - scroll_line=""; -} - -void log_scrollendline(boolean centred) -{ - byte x,fv; -; - if (~ logging) return; - x=17; - if (centred) x += (50-scroll_line_length) / 2; - for( fv=1; fv <= x; fv ++) output << logfile << ' '; - output << logfile << scroll_line << NL; -} - -void log_bubbleline(byte linenum,byte whom, string x) -{ - byte fv; -; - if (~ logging) return; - if (linenum==1) - {; - for( fv=1; fv <= 15; fv ++) output << logfile << ' '; - output << logfile << italic+tr[whom].a.name+": "+italic_off+x << NL; - } else - {; - for( fv=1; fv <= 17; fv ++) output << logfile << ' '; - output << logfile << x << NL; - } -} - -void log_newline() -{; - if (logging) output << logfile << NL; -} - -void log_newroom(string where) -{ - byte fv; -; - if (~ logging) return; - for( fv=1; fv <= 20; fv ++) output << logfile << ' '; - if (log_epson) output << logfile << emph_on; - output << logfile << string('(')+where+')'; - if (log_epson) output << logfile << emph_off; - output << logfile << NL; +void centre(byte size, byte x) { /* Prints req'd number of spaces. */ + byte fv; + ; + if (~ logging) return; + for (fv = 1; fv <= size - (x / 2); fv ++) + output << logfile << ' '; +} + +void log_setup(string name, boolean printing) { /* Sets up. */ + ; + assign(logfile, name); + rewrite(logfile); + output << logfile << startwith; + log_epson = printing; + logging = true; + + if (! printing) { + quote = '"'; + unquote = '"'; + copyright = "(c)"; + } +} + +void log_divider() { /* Prints the divider sign. */ + byte fv; + ; + if (~ logging) return; + if (log_epson) { + ; + output << logfile << string(' ') + double_width; + for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; + output << logfile << string(' ') + double_off; + } else + for (fv = 1; fv <= 36; fv ++) output << logfile << ' '; + output << logfile << divide << NL; +} + +void log_command(string x) { /* Prints a command */ + ; + if (~ logging) return; + if (log_epson) + output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; + else + output << logfile << string("> ") + x << NL; +} + +void log_addstuff(string x) { + ; + if (~ logging) return; + scroll_line = scroll_line + x; +} + +void log_scrollchar(string x) { /* print one character */ + varying_string<2> z; + ; + if (~ logging) return; + switch (x[1]) { + case '`': + z = quote; + break; /* Open quotes: "66" */ + case '"': + z = unquote; + break; /* Close quotes: "99" */ + case '\357': + z = copyright; + break; /* Copyright sign. */ + default: + z = x; + } + log_addstuff(z); + scroll_line_length += length(z); +} + +void log_italic() { + ; + if (~ logging) return; + if (log_epson) + log_addstuff(italic); + else + log_addstuff("*"); +} + +void log_roman() { + ; + if (~ logging) return; + if (log_epson) + log_addstuff(italic_off); + else + log_addstuff("*"); +} + +void log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ + ; + if (~ logging) return; + if (log_epson) log_addstuff(italic_off); +} + +void log_scrollline() { /* Set up a line for the scroll driver */ + ; + scroll_line_length = 0; + scroll_line = ""; +} + +void log_scrollendline(boolean centred) { + byte x, fv; + ; + if (~ logging) return; + x = 17; + if (centred) x += (50 - scroll_line_length) / 2; + for (fv = 1; fv <= x; fv ++) output << logfile << ' '; + output << logfile << scroll_line << NL; +} + +void log_bubbleline(byte linenum, byte whom, string x) { + byte fv; + ; + if (~ logging) return; + if (linenum == 1) { + ; + for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; + output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; + } else { + ; + for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; + output << logfile << x << NL; + } +} + +void log_newline() { + ; + if (logging) output << logfile << NL; +} + +void log_newroom(string where) { + byte fv; + ; + if (~ logging) return; + for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; + if (log_epson) output << logfile << emph_on; + output << logfile << string('(') + where + ')'; + if (log_epson) output << logfile << emph_off; + output << logfile << NL; } void log_aside(string what) - /* This writes "asides" to the printer. For example, moves in Nim. */ -{; - if (~ logging) return; - output << logfile << " (" << italic << what << italic_off << ')' << NL; - /* "What" is what to write. */ -} - -void log_score(word credit,word now) +/* This writes "asides" to the printer. For example, moves in Nim. */ { - byte fv; -; - if (~ logging) return; - for( fv=1; fv <= 50; fv ++) output << logfile << ' '; - output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; + ; + if (~ logging) return; + output << logfile << " (" << italic << what << italic_off << ')' << NL; + /* "What" is what to write. */ +} + +void log_score(word credit, word now) { + byte fv; + ; + if (~ logging) return; + for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; + output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h index 94cd9383b0f8..cff43365872a 100644 --- a/engines/avalanche/logger.h +++ b/engines/avalanche/logger.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -48,7 +48,7 @@ void log_scrollline(); /* Set up a line for the scroll driver */ void log_scrollendline(boolean centred); -void log_bubbleline(byte linenum,byte whom, string x); +void log_bubbleline(byte linenum, byte whom, string x); void log_newline(); @@ -56,7 +56,7 @@ void log_newroom(string where); void log_aside(string what); -void log_score(word credit,word now); +void log_score(word credit, word now); } // End of namespace Avalanche. diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 19466f4b3f8a..01916ce049b6 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -57,1084 +57,1240 @@ namespace Avalanche { /*$V-*/ /*$S-*/ -boolean fxhidden; array<0,3,palettetype> fxpal; - -void callverb(char n) -{ - if (n==pardon) - { - display(string("The f5 key lets you do a particular action in certain ")+ - "situations. However, at the moment there is nothing "+ - "assigned to it. You may press alt-A to see what the "+ - "current setting of this key is."); - } else - { - weirdword=false; polite=true; verb=n; - do_that(); - } +boolean fxhidden; +array<0, 3, palettetype> fxpal; + +void callverb(char n) { + if (n == pardon) { + display(string("The f5 key lets you do a particular action in certain ") + + "situations. However, at the moment there is nothing " + + "assigned to it. You may press alt-A to see what the " + + "current setting of this key is."); + } else { + weirdword = false; + polite = true; + verb = n; + do_that(); + } } -void draw_also_lines() -{ - byte ff; - byte squeaky_code; - - switch (visible) { - case m_virtual : { squeaky_code = 1; off_virtual(); } break; - case m_no : squeaky_code = 2; break; - case m_yes : { squeaky_code = 3; off(); } break; - } - - setactivepage(2); - cleardevice(); - setcolor(15); rectangle(0,45,639,160); - for( ff=1; ff <= 50; ff ++) - { linetype& with = lines[ff]; - if (x1!=maxint) - { - setcolor(with.col); line(x1,y1,x2,y2); - }} - - switch (squeaky_code) { - case 1 : on_virtual(); break; - case 2 :; break; /* zzzz, it was off anyway */ - case 3 : on(); break; - } +void draw_also_lines() { + byte ff; + byte squeaky_code; + + switch (visible) { + case m_virtual : { + squeaky_code = 1; + off_virtual(); + } + break; + case m_no : + squeaky_code = 2; + break; + case m_yes : { + squeaky_code = 3; + off(); + } + break; + } + + setactivepage(2); + cleardevice(); + setcolor(15); + rectangle(0, 45, 639, 160); + for (ff = 1; ff <= 50; ff ++) { + linetype &with = lines[ff]; + if (x1 != maxint) { + setcolor(with.col); + line(x1, y1, x2, y2); + } + } + + switch (squeaky_code) { + case 1 : + on_virtual(); + break; + case 2 : + ; + break; /* zzzz, it was off anyway */ + case 3 : + on(); + break; + } } void load_also(string n); -static untyped_file f; +static untyped_file f; -static string nextstring() -{ - byte l; string x; +static string nextstring() { + byte l; + string x; - string nextstring_result; - blockread(f,l,1); blockread(f,x[1],l); x[0]=chr(l); nextstring_result=x; - return nextstring_result; + string nextstring_result; + blockread(f, l, 1); + blockread(f, x[1], l); + x[0] = chr(l); + nextstring_result = x; + return nextstring_result; } static void unscramble(); -static void scram1(string& x) -{ - byte fz; -; - for( fz=1; fz <= length(x); fz ++) - x[fz]=chr(ord(x[fz]) ^ 177); +static void scram1(string &x) { + byte fz; + ; + for (fz = 1; fz <= length(x); fz ++) + x[fz] = chr(ord(x[fz]) ^ 177); } -static void unscramble() -{ - byte fv,ff; - - for( fv=0; fv <= 30; fv ++) - for( ff=0; ff <= 1; ff ++) - if (also[fv][ff]!=nil) - scram1(*also[fv][ff]); - scram1(listen); - scram1(flags); -/* for fz:=1 to length(also[fv,ff]^) do - also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ +static void unscramble() { + byte fv, ff; + + for (fv = 0; fv <= 30; fv ++) + for (ff = 0; ff <= 1; ff ++) + if (also[fv][ff] != nil) + scram1(*also[fv][ff]); + scram1(listen); + scram1(flags); + /* for fz:=1 to length(also[fv,ff]^) do + also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ } -void load_also(string n) -{ - byte minnames; byte ff,fv; - - - for( fv=0; fv <= 30; fv ++) - for( ff=0; ff <= 1; ff ++) - if (also[fv][ff]!=nil) { delete also[fv][ff]; also[fv][ff]=nil; } - assign(f,string("also")+n+".avd"); -/*$I-*/ reset(f,1); /*$I+*/ if (ioresult!=0) return; /* no Also file */ - seek(f,128); blockread(f,minnames,1); - for( fv=0; fv <= minnames; fv ++) - { - for( ff=0; ff <= 1; ff ++) - { - also[fv][ff] = new string; - *also[fv][ff]=nextstring(); - } - *also[fv][0]=string('\235')+*also[fv][0]+'\235'; - } - fillchar(lines,sizeof(lines),0xff); - - fv=getpixel(0,0); blockread(f,fv,1); - blockread(f,lines,sizeof(lines[1])*fv); - blockread(f,fv,1); fillchar(peds,sizeof(peds),'\261'); - blockread(f,peds,sizeof(peds[1])*fv); - blockread(f,numfields,1); blockread(f,fields,sizeof(fields[1])*numfields); - blockread(f,magics,sizeof(magics)); - blockread(f,portals,sizeof(portals)); - blockread(f,flags,sizeof(flags)); - blockread(f,listen[0],1); - blockread(f,listen[1],length(listen)); - draw_also_lines(); - - setactivepage(1); close(f); - unscramble(); - for( fv=0; fv <= minnames; fv ++) - *also[fv][0]=string(',')+*also[fv][0]+','; +void load_also(string n) { + byte minnames; + byte ff, fv; + + + for (fv = 0; fv <= 30; fv ++) + for (ff = 0; ff <= 1; ff ++) + if (also[fv][ff] != nil) { + delete also[fv][ff]; + also[fv][ff] = nil; + } + assign(f, string("also") + n + ".avd"); + /*$I-*/ reset(f, 1); /*$I+*/ if (ioresult != 0) return; /* no Also file */ + seek(f, 128); + blockread(f, minnames, 1); + for (fv = 0; fv <= minnames; fv ++) { + for (ff = 0; ff <= 1; ff ++) { + also[fv][ff] = new string; + *also[fv][ff] = nextstring(); + } + *also[fv][0] = string('\235') + *also[fv][0] + '\235'; + } + fillchar(lines, sizeof(lines), 0xff); + + fv = getpixel(0, 0); + blockread(f, fv, 1); + blockread(f, lines, sizeof(lines[1])*fv); + blockread(f, fv, 1); + fillchar(peds, sizeof(peds), '\261'); + blockread(f, peds, sizeof(peds[1])*fv); + blockread(f, numfields, 1); + blockread(f, fields, sizeof(fields[1])*numfields); + blockread(f, magics, sizeof(magics)); + blockread(f, portals, sizeof(portals)); + blockread(f, flags, sizeof(flags)); + blockread(f, listen[0], 1); + blockread(f, listen[1], length(listen)); + draw_also_lines(); + + setactivepage(1); + close(f); + unscramble(); + for (fv = 0; fv <= minnames; fv ++) + *also[fv][0] = string(',') + *also[fv][0] + ','; } -void load(byte n) /* Load2, actually */ -{ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ - byte bit; - untyped_file f; varying_string<2> xx; - boolean was_virtual; - - was_virtual=visible==m_virtual; - if (was_virtual) off_virtual(); else off(); - clear_vmc(); - - xx=strf(n); flesh_colours(); - assign(f,string("place")+xx+".avd"); reset(f,1); - seek(f,146); blockread(f,roomname,30); - /* Compression method byte follows this... */ - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); move(a0,a1,12080); - } - close(f); load_also(xx); load_chunks(xx); - - copy03(); bit=getpixel(0,0); - log_newroom(roomname); - - if (was_virtual) on_virtual(); else on(); +void load(byte n) { /* Load2, actually */ + byte a0; /*absolute $A000:800;*/ + byte a1; /*absolute $A000:17184;*/ + byte bit; + untyped_file f; + varying_string<2> xx; + boolean was_virtual; + + was_virtual = visible == m_virtual; + if (was_virtual) off_virtual(); + else off(); + clear_vmc(); + + xx = strf(n); + flesh_colours(); + assign(f, string("place") + xx + ".avd"); + reset(f, 1); + seek(f, 146); + blockread(f, roomname, 30); + /* Compression method byte follows this... */ + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + move(a0, a1, 12080); + } + close(f); + load_also(xx); + load_chunks(xx); + + copy03(); + bit = getpixel(0, 0); + log_newroom(roomname); + + if (was_virtual) on_virtual(); + else on(); } -void zoomout(integer x,integer y) -{ - integer x1,y1,x2,y2; - byte fv; - - setcolor(white); setwritemode(xorput); - setlinestyle(dottedln,0,1); - - for( fv=1; fv <= 20; fv ++) - { - x1=x-(x / 20)*fv; - y1=y-((y-10) / 20)*fv; - x2=x+(((639-x) / 20)*fv); - y2=y+(((161-y) / 20)*fv); - - rectangle(x1,y1,x2,y2); - delay(17); - rectangle(x1,y1,x2,y2); - } - setwritemode(copyput); setlinestyle(0,0,1); +void zoomout(integer x, integer y) { + integer x1, y1, x2, y2; + byte fv; + + setcolor(white); + setwritemode(xorput); + setlinestyle(dottedln, 0, 1); + + for (fv = 1; fv <= 20; fv ++) { + x1 = x - (x / 20) * fv; + y1 = y - ((y - 10) / 20) * fv; + x2 = x + (((639 - x) / 20) * fv); + y2 = y + (((161 - y) / 20) * fv); + + rectangle(x1, y1, x2, y2); + delay(17); + rectangle(x1, y1, x2, y2); + } + setwritemode(copyput); + setlinestyle(0, 0, 1); } -void find_people(byte room) -{ - char fv; +void find_people(byte room) { + char fv; - for( fv='\227'; fv <= '\262'; fv ++) - if (whereis[fv]==room) - { - if (fv<'\257') him=fv; else her=fv; - } + for (fv = '\227'; fv <= '\262'; fv ++) + if (whereis[fv] == room) { + if (fv < '\257') him = fv; + else her = fv; + } } -void exitroom(byte x) -{ - nosound; - forget_chunks(); - seescroll=true; /* This stops the trippancy system working over the +void exitroom(byte x) { + nosound; + forget_chunks(); + seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ - { dnatype& with = dna; - switch (x) { - case r__spludwicks: { - lose_timer(reason_avariciustalks); - /* He doesn't HAVE to be talking for this to work. It just deletes it IF it - exists. */ with.avaricius_talk=0; - } - break; - case r__bridge: if (with.drawbridge_open>0) - { - with.drawbridge_open=4; /* Fully open. */ - lose_timer(reason_drawbridgefalls); - } - break; - case r__outsidecardiffcastle: lose_timer(reason_cardiffsurvey); break; - - case r__robins: lose_timer(reason_getting_tied_up); break; - }} - - interrogation=0; /* Leaving the room cancels all the questions automatically. */ - - seescroll=false; /* Now it can work again! */ - - dna.last_room=dna.room; - if (dna.room!=r__map) - dna.last_room_not_map=dna.room; + { + dnatype &with = dna; + switch (x) { + case r__spludwicks: { + lose_timer(reason_avariciustalks); + /* He doesn't HAVE to be talking for this to work. It just deletes it IF it + exists. */ with.avaricius_talk = 0; + } + break; + case r__bridge: + if (with.drawbridge_open > 0) { + with.drawbridge_open = 4; /* Fully open. */ + lose_timer(reason_drawbridgefalls); + } + break; + case r__outsidecardiffcastle: + lose_timer(reason_cardiffsurvey); + break; + + case r__robins: + lose_timer(reason_getting_tied_up); + break; + } + } + + interrogation = 0; /* Leaving the room cancels all the questions automatically. */ + + seescroll = false; /* Now it can work again! */ + + dna.last_room = dna.room; + if (dna.room != r__map) + dna.last_room_not_map = dna.room; } -void new_town() /* You've just entered a town from the map. */ -{ - standard_bar(); - - switch (dna.room) { - case r__outsidenottspub: /* Entry into Nottingham. */ - if ((dna.rooms[r__robins]>0) && (dna.been_tied_up) && - (! dna.taken_mushroom)) - dna.mushroom_growing=true; - break; - case r__wisewomans: /* Entry into Argent. */ - { - if (dna.talked_to_crapulus && (! dna.lustie_is_asleep)) - { - dna.spludwicks_here=! ((dna.rooms[r__wisewomans] % 3)==1); - dna.crapulus_will_tell=! dna.spludwicks_here; - } else - { - dna.spludwicks_here=true; - dna.crapulus_will_tell=false; - } - if (dna.box_contents==wine) dna.winestate=3; /* Vinegar */ - } - break; - } - - if (dna.room!=r__outsideducks) - { - if ((dna.obj[onion]) && ! (dna.onion_in_vinegar)) - dna.rotten_onion=true; /* You're holding the onion */ - } +void new_town() { /* You've just entered a town from the map. */ + standard_bar(); + + switch (dna.room) { + case r__outsidenottspub: /* Entry into Nottingham. */ + if ((dna.rooms[r__robins] > 0) && (dna.been_tied_up) && + (! dna.taken_mushroom)) + dna.mushroom_growing = true; + break; + case r__wisewomans: { /* Entry into Argent. */ + if (dna.talked_to_crapulus && (! dna.lustie_is_asleep)) { + dna.spludwicks_here = !((dna.rooms[r__wisewomans] % 3) == 1); + dna.crapulus_will_tell = ! dna.spludwicks_here; + } else { + dna.spludwicks_here = true; + dna.crapulus_will_tell = false; + } + if (dna.box_contents == wine) dna.winestate = 3; /* Vinegar */ + } + break; + } + + if (dna.room != r__outsideducks) { + if ((dna.obj[onion]) && !(dna.onion_in_vinegar)) + dna.rotten_onion = true; /* You're holding the onion */ + } } -void enterroom(byte x,byte ped); +void enterroom(byte x, byte ped); -static void put_geida_at(byte whichped, byte& ped) -{ - if (ped==0) return; - tr[2].init(5,false); /* load Geida */ - apped(2,whichped); - tr[2].call_eachstep=true; - tr[2].eachstep=procgeida_procs; +static void put_geida_at(byte whichped, byte &ped) { + if (ped == 0) return; + tr[2].init(5, false); /* load Geida */ + apped(2, whichped); + tr[2].call_eachstep = true; + tr[2].eachstep = procgeida_procs; } -void enterroom(byte x,byte ped) -{ +void enterroom(byte x, byte ped) { - seescroll=true; /* This stops the trippancy system working over the + seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ - find_people(x); - dna.room=x; if (ped!=0) dna.rooms[x] += 1; - - load(x); - - if ((dna.rooms[x]==0) && (! flagset('S'))) points(1); - whereis[pavalot]=dna.room; - if (dna.geida_follows) whereis[pgeida]=x; - roomtime=0; - - { dnatype& with = dna; - if ((with.last_room==r__map) && (with.last_room_not_map!=with.room)) - new_town();} - - switch (x) { - case r__yours: if (dna.avvy_in_bed) - { - show_one(3); - set_up_timer(100,procarkata_shouts,reason_arkata_shouts); - } - break; - - case r__outsideyours: if (ped>0) - { - if (! dna.talked_to_crapulus) - { - - whereis[pcrapulus]=r__outsideyours; - tr[2].init(8,false); /* load Crapulus */ - - if (dna.rooms[r__outsideyours]==1) - { - apped(2,4); /* Start on the right-hand side of the screen. */ - tr[2].walkto(5); /* Walks up to greet you. */ - } else - { - apped(2,5); /* Starts where he was before. */ - tr[2].face=3; - } - - tr[2].call_eachstep=true; - tr[2].eachstep=procface_avvy; /* He always faces Avvy. */ - - } else whereis[pcrapulus]=r__nowhere; - - if (dna.crapulus_will_tell) - { - tr[2].init(8,false); - apped(2,2); - tr[2].walkto(4); - set_up_timer(20,proccrapulus_splud_out,reason_crapulus_says_spludwick_out); - dna.crapulus_will_tell=false; - } - } - break; - - case r__outsidespludwicks: - if ((dna.rooms[r__outsidespludwicks]==1) && (ped==1)) - { - set_up_timer(20,procbang,reason_explosion); - dna.spludwicks_here=true; - } - break; - - case r__spludwicks: - if (dna.spludwicks_here) - { - if (ped>0) - { - tr[2].init(2,false); /* load Spludwick */ - apped(2,2); - whereis['\227']=r__spludwicks; - } - - dna.dogfoodpos = 0; /* Also Spludwick pos. */ - - tr[2].call_eachstep =true; - tr[2].eachstep=procgeida_procs; - } else whereis['\227']=r__nowhere; - break; - - case r__brummieroad: - { - if (dna.geida_follows) put_geida_at(5, ped); - if (dna.cwytalot_gone) - { - magics[lightred].op=nix; - whereis[pcwytalot]=r__nowhere; - } else - { - if (ped>0) - { - tr[2].init(4,false); /* 4=Cwytalot*/ - tr[2].call_eachstep=true; - tr[2].eachstep=procfollow_avvy_y; - whereis[pcwytalot]=r__brummieroad; - - if (dna.rooms[r__brummieroad]==1) /* First time here... */ - { - apped(2,2); /* He appears on the right of the screen... */ - tr[2].walkto(4); /* ...and he walks up... */ - } else - { /* You've been here before. */ - apped(2,4); /* He's standing in your way straight away... */ - tr[2].face=left; - } - } - } - } - break; - - case r__argentroad: - { dnatype& with = dna; - if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped==2) && - (dna.rooms[r__argentroad]>3)) - { - tr[2].init(4,false); /* 4=Cwytalot again*/ - apped(2,1); - tr[2].walkto(2); - tr[2].vanishifstill=true; - with.cwytalot_in_herts=true; - /*whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ - set_up_timer(20,proc_cwytalot_in_herts,reason_cwytalot_in_herts); - }} - break; - - case r__bridge: - { - if (dna.drawbridge_open==4) /*open*/ - { - show_one(3); /* Position of drawbridge */ - magics[green].op=nix; /* You may enter the drawbridge. */ - } - if (dna.geida_follows) put_geida_at(ped+3, ped); /* load Geida */ - } - break; - - case r__robins: - { - if (ped>0) - { - if (! dna.been_tied_up) - { /* A welcome party... or maybe not... */ - tr[2].init(6,false); - apped(2,2); - tr[2].walkto(3); - set_up_timer(36,procget_tied_up,reason_getting_tied_up); - } - } - - if (dna.been_tied_up) - { - whereis[probinhood]=0; whereis[pfriartuck]=0; - } - - if (dna.tied_up) show_one(2); - - if (! dna.mushroom_growing) show_one(3); - } - break; - - case r__outsidecardiffcastle: - { - if (ped>0) - switch (dna.cardiff_things) { - case 0 : { /* You've answered NONE of his questions. */ - tr[2].init(9,false); - apped(2,2); - tr[2].walkto(3); - set_up_timer(47,proccardiffsurvey,reason_cardiffsurvey); - } - break; - case 5 : magics[2].op=nix; break; /* You've answered ALL his questions. => nothing happens. */ - default: { /* You've answered SOME of his questions. */ - tr[2].init(9,false); - apped(2,3); - tr[2].face=right; - set_up_timer(3,proccardiff_return,reason_cardiffsurvey); - } - } - if (dna.cardiff_things<5) - interrogation=dna.cardiff_things; else interrogation=0; - } - break; - - case r__map: - { /* You're entering the map. */ - dawn(); setactivepage(cp); - if (ped>0) zoomout(peds[ped].x,peds[ped].y); - setactivepage(1-cp); - - { dnatype& with = dna; - if ((with.obj[wine]) && (with.winestate!=3)) - { - dixi('q',9); /* Don't want to waste the wine! */ - with.obj[wine]=false; - objectlist(); - }} - - dixi('q',69); - } - break; - - case r__catacombs: - { - if (set::of(0,3,5,6, eos).has(ped)) - { - dnatype& with = dna; - - switch (ped) { - case 3 : { with.cat_x=8; with.cat_y=4; } break; /* Enter from oubliette */ - case 5 : { with.cat_x=8; with.cat_y=7; } break; /* Enter from du Lustie's */ - case 6 : { with.cat_x=4; with.cat_y=1; } break; /* Enter from Geida's */ - } - dna.enter_catacombs_from_lusties_room=true; - catamove(ped); - dna.enter_catacombs_from_lusties_room=false; - } - } - break; - - case r__argentpub: { - if (dna.wonnim) show_one(1); /* No lute by the settle. */ - dna.malagauche=0; /* Ready to boot Malagauche */ - if (dna.givenbadgetoiby) - { show_one(8); show_one(9); } - } - break; - - case r__lustiesroom: { - dna.dogfoodpos=1; /* Actually, du Lustie pos. */ - if (tr[1].whichsprite==0) /* Avvy in his normal clothes */ - set_up_timer(3,proccallsguards,reason_du_lustie_talks); - else - if (! dna.entered_lusties_room_as_monk) /*already*/ - /* Presumably, Avvy dressed as a monk. */ - set_up_timer(3,procgreetsmonk,reason_du_lustie_talks); - - if (dna.geida_follows) - { - put_geida_at(5, ped); - if (dna.lustie_is_asleep) show_one(5); - } - } - break; - - case r__musicroom: { - if (dna.jacques_awake>0) - { - dna.jacques_awake=5; - show_one(2); - show_one(4); - magics[brown].op=nix; - whereis[pjacques]=0; - } - if (ped!=0) - { - show_one(6); - first_show(5); then_show(7); - start_to_close(); - } - } - break; - - case r__outsidenottspub: if (ped==2) - { - show_one(3); first_show(2); - then_show(1); then_show(4); - start_to_close(); - } - break; - - case r__outsideargentpub: if (ped==2) { - show_one(6); - first_show(5); then_show(7); - start_to_close(); - } - break; - - case r__wisewomans: { - tr[2].init(11,false); - if ((dna.rooms[r__wisewomans]==1) && (ped>0)) - { - apped(2,2); /* Start on the right-hand side of the screen. */ - tr[2].walkto(4); /* Walks up to greet you. */ - } else - { - apped(2,4); /* Starts where she was before. */ - tr[2].face=3; - } - - tr[2].call_eachstep=true; - tr[2].eachstep=procface_avvy; /* She always faces Avvy. */ - } - break; - - case r__insidecardiffcastle: - if (ped>0) - { - tr[2].init(10,false); /* Define the dart. */ - first_show(1); - if (dna.arrow_in_the_door) then_show(3); else then_show(2); - if (dna.taken_pen) show_one(4); - start_to_close(); - } else - { - show_one(1); - if (dna.arrow_in_the_door) show_one(3); else show_one(2); - } - break; - - case r__avvysgarden: if (ped==1) { - show_one(2); - first_show(1); then_show(3); - start_to_close(); - } - break; - - case r__entrancehall:case r__insideabbey: if (ped==2) { - show_one(2); - first_show(1); then_show(3); - start_to_close(); - } - break; - - case r__aylesoffice: if (dna.ayles_is_awake) show_one(2); break; /* Ayles awake. */ - - case r__geidas: put_geida_at(2, ped); break; /* load Geida */ - - case r__easthall:case r__westhall: if (dna.geida_follows) put_geida_at(ped+2, ped); break; - - case r__lusties: if (dna.geida_follows) put_geida_at(ped+6, ped); break; - - case r__nottspub: { - if (dna.sitting_in_pub) show_one(3); - dna.dogfoodpos=1; /* Actually, du Lustie pos. */ - } - break; - - case r__outsideducks: if (ped==2) - { /* Shut the door */ - show_one(3); - first_show(2); then_show(1); - then_show(4); start_to_close(); - } - break; - case r__ducks: dna.dogfoodpos=1; break; /* Actually, Duck pos. */ - - } - - seescroll=false; /* Now it can work again! */ + find_people(x); + dna.room = x; + if (ped != 0) dna.rooms[x] += 1; + + load(x); + + if ((dna.rooms[x] == 0) && (! flagset('S'))) points(1); + whereis[pavalot] = dna.room; + if (dna.geida_follows) whereis[pgeida] = x; + roomtime = 0; + + { + dnatype &with = dna; + if ((with.last_room == r__map) && (with.last_room_not_map != with.room)) + new_town(); + } + + switch (x) { + case r__yours: + if (dna.avvy_in_bed) { + show_one(3); + set_up_timer(100, procarkata_shouts, reason_arkata_shouts); + } + break; + + case r__outsideyours: + if (ped > 0) { + if (! dna.talked_to_crapulus) { + + whereis[pcrapulus] = r__outsideyours; + tr[2].init(8, false); /* load Crapulus */ + + if (dna.rooms[r__outsideyours] == 1) { + apped(2, 4); /* Start on the right-hand side of the screen. */ + tr[2].walkto(5); /* Walks up to greet you. */ + } else { + apped(2, 5); /* Starts where he was before. */ + tr[2].face = 3; + } + + tr[2].call_eachstep = true; + tr[2].eachstep = procface_avvy; /* He always faces Avvy. */ + + } else whereis[pcrapulus] = r__nowhere; + + if (dna.crapulus_will_tell) { + tr[2].init(8, false); + apped(2, 2); + tr[2].walkto(4); + set_up_timer(20, proccrapulus_splud_out, reason_crapulus_says_spludwick_out); + dna.crapulus_will_tell = false; + } + } + break; + + case r__outsidespludwicks: + if ((dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { + set_up_timer(20, procbang, reason_explosion); + dna.spludwicks_here = true; + } + break; + + case r__spludwicks: + if (dna.spludwicks_here) { + if (ped > 0) { + tr[2].init(2, false); /* load Spludwick */ + apped(2, 2); + whereis['\227'] = r__spludwicks; + } + + dna.dogfoodpos = 0; /* Also Spludwick pos. */ + + tr[2].call_eachstep = true; + tr[2].eachstep = procgeida_procs; + } else whereis['\227'] = r__nowhere; + break; + + case r__brummieroad: { + if (dna.geida_follows) put_geida_at(5, ped); + if (dna.cwytalot_gone) { + magics[lightred].op = nix; + whereis[pcwytalot] = r__nowhere; + } else { + if (ped > 0) { + tr[2].init(4, false); /* 4=Cwytalot*/ + tr[2].call_eachstep = true; + tr[2].eachstep = procfollow_avvy_y; + whereis[pcwytalot] = r__brummieroad; + + if (dna.rooms[r__brummieroad] == 1) { /* First time here... */ + apped(2, 2); /* He appears on the right of the screen... */ + tr[2].walkto(4); /* ...and he walks up... */ + } else { + /* You've been here before. */ + apped(2, 4); /* He's standing in your way straight away... */ + tr[2].face = left; + } + } + } + } + break; + + case r__argentroad: { + dnatype &with = dna; + if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && + (dna.rooms[r__argentroad] > 3)) { + tr[2].init(4, false); /* 4=Cwytalot again*/ + apped(2, 1); + tr[2].walkto(2); + tr[2].vanishifstill = true; + with.cwytalot_in_herts = true; + /*whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ + set_up_timer(20, proc_cwytalot_in_herts, reason_cwytalot_in_herts); + } + } + break; + + case r__bridge: { + if (dna.drawbridge_open == 4) { /*open*/ + show_one(3); /* Position of drawbridge */ + magics[green].op = nix; /* You may enter the drawbridge. */ + } + if (dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ + } + break; + + case r__robins: { + if (ped > 0) { + if (! dna.been_tied_up) { + /* A welcome party... or maybe not... */ + tr[2].init(6, false); + apped(2, 2); + tr[2].walkto(3); + set_up_timer(36, procget_tied_up, reason_getting_tied_up); + } + } + + if (dna.been_tied_up) { + whereis[probinhood] = 0; + whereis[pfriartuck] = 0; + } + + if (dna.tied_up) show_one(2); + + if (! dna.mushroom_growing) show_one(3); + } + break; + + case r__outsidecardiffcastle: { + if (ped > 0) + switch (dna.cardiff_things) { + case 0 : { /* You've answered NONE of his questions. */ + tr[2].init(9, false); + apped(2, 2); + tr[2].walkto(3); + set_up_timer(47, proccardiffsurvey, reason_cardiffsurvey); + } + break; + case 5 : + magics[2].op = nix; + break; /* You've answered ALL his questions. => nothing happens. */ + default: { /* You've answered SOME of his questions. */ + tr[2].init(9, false); + apped(2, 3); + tr[2].face = right; + set_up_timer(3, proccardiff_return, reason_cardiffsurvey); + } + } + if (dna.cardiff_things < 5) + interrogation = dna.cardiff_things; + else interrogation = 0; + } + break; + + case r__map: { + /* You're entering the map. */ + dawn(); + setactivepage(cp); + if (ped > 0) zoomout(peds[ped].x, peds[ped].y); + setactivepage(1 - cp); + + { + dnatype &with = dna; + if ((with.obj[wine]) && (with.winestate != 3)) { + dixi('q', 9); /* Don't want to waste the wine! */ + with.obj[wine] = false; + objectlist(); + } + } + + dixi('q', 69); + } + break; + + case r__catacombs: { + if (set::of(0, 3, 5, 6, eos).has(ped)) { + dnatype &with = dna; + + switch (ped) { + case 3 : { + with.cat_x = 8; + with.cat_y = 4; + } + break; /* Enter from oubliette */ + case 5 : { + with.cat_x = 8; + with.cat_y = 7; + } + break; /* Enter from du Lustie's */ + case 6 : { + with.cat_x = 4; + with.cat_y = 1; + } + break; /* Enter from Geida's */ + } + dna.enter_catacombs_from_lusties_room = true; + catamove(ped); + dna.enter_catacombs_from_lusties_room = false; + } + } + break; + + case r__argentpub: { + if (dna.wonnim) show_one(1); /* No lute by the settle. */ + dna.malagauche = 0; /* Ready to boot Malagauche */ + if (dna.givenbadgetoiby) { + show_one(8); + show_one(9); + } + } + break; + + case r__lustiesroom: { + dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + if (tr[1].whichsprite == 0) /* Avvy in his normal clothes */ + set_up_timer(3, proccallsguards, reason_du_lustie_talks); + else if (! dna.entered_lusties_room_as_monk) /*already*/ + /* Presumably, Avvy dressed as a monk. */ + set_up_timer(3, procgreetsmonk, reason_du_lustie_talks); + + if (dna.geida_follows) { + put_geida_at(5, ped); + if (dna.lustie_is_asleep) show_one(5); + } + } + break; + + case r__musicroom: { + if (dna.jacques_awake > 0) { + dna.jacques_awake = 5; + show_one(2); + show_one(4); + magics[brown].op = nix; + whereis[pjacques] = 0; + } + if (ped != 0) { + show_one(6); + first_show(5); + then_show(7); + start_to_close(); + } + } + break; + + case r__outsidenottspub: + if (ped == 2) { + show_one(3); + first_show(2); + then_show(1); + then_show(4); + start_to_close(); + } + break; + + case r__outsideargentpub: + if (ped == 2) { + show_one(6); + first_show(5); + then_show(7); + start_to_close(); + } + break; + + case r__wisewomans: { + tr[2].init(11, false); + if ((dna.rooms[r__wisewomans] == 1) && (ped > 0)) { + apped(2, 2); /* Start on the right-hand side of the screen. */ + tr[2].walkto(4); /* Walks up to greet you. */ + } else { + apped(2, 4); /* Starts where she was before. */ + tr[2].face = 3; + } + + tr[2].call_eachstep = true; + tr[2].eachstep = procface_avvy; /* She always faces Avvy. */ + } + break; + + case r__insidecardiffcastle: + if (ped > 0) { + tr[2].init(10, false); /* Define the dart. */ + first_show(1); + if (dna.arrow_in_the_door) then_show(3); + else then_show(2); + if (dna.taken_pen) show_one(4); + start_to_close(); + } else { + show_one(1); + if (dna.arrow_in_the_door) show_one(3); + else show_one(2); + } + break; + + case r__avvysgarden: + if (ped == 1) { + show_one(2); + first_show(1); + then_show(3); + start_to_close(); + } + break; + + case r__entrancehall: + case r__insideabbey: + if (ped == 2) { + show_one(2); + first_show(1); + then_show(3); + start_to_close(); + } + break; + + case r__aylesoffice: + if (dna.ayles_is_awake) show_one(2); + break; /* Ayles awake. */ + + case r__geidas: + put_geida_at(2, ped); + break; /* load Geida */ + + case r__easthall: + case r__westhall: + if (dna.geida_follows) put_geida_at(ped + 2, ped); + break; + + case r__lusties: + if (dna.geida_follows) put_geida_at(ped + 6, ped); + break; + + case r__nottspub: { + if (dna.sitting_in_pub) show_one(3); + dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + } + break; + + case r__outsideducks: + if (ped == 2) { + /* Shut the door */ + show_one(3); + first_show(2); + then_show(1); + then_show(4); + start_to_close(); + } + break; + case r__ducks: + dna.dogfoodpos = 1; + break; /* Actually, Duck pos. */ + + } + + seescroll = false; /* Now it can work again! */ } -void thinkabout(char z, boolean th) /* Hey!!! Get it and put it!!! */ -{ - const integer x = 205; const integer y = 170; const integer picsize = 966; - const bytefield thinkspace = - {25, 170, 32, 200}; - untyped_file f; pointer p; byte fv; - - - thinks=z; z -= 1; - - if (th) - { /* Things */ - assign(f,"thinks.avd"); wait(); getmem(p,picsize); - reset(f,1); seek(f,ord(z)*picsize+65); blockread(f,p,picsize); off(); - close(f); - } else - { /* People */ - assign(f,"folk.avd"); - wait(); - getmem(p,picsize); - reset(f,1); - - fv=ord(z)-149; - if (fv>=25) fv -= 8; - if (fv==20) fv -= 1; /* Last time... */ - - seek(f,fv*picsize+65); - blockread(f,p,picsize); - off(); - close(f); - } - - setactivepage(3); - putimage(x,y,p,0); - setactivepage(1-cp); - - for( fv=0; fv <= 1; fv ++) - getset[fv].remember(thinkspace); - - freemem(p,picsize); - on(); thinkthing=th; +void thinkabout(char z, boolean th) { /* Hey!!! Get it and put it!!! */ + const integer x = 205; + const integer y = 170; + const integer picsize = 966; + const bytefield thinkspace = + {25, 170, 32, 200}; + untyped_file f; + pointer p; + byte fv; + + + thinks = z; + z -= 1; + + if (th) { + /* Things */ + assign(f, "thinks.avd"); + wait(); + getmem(p, picsize); + reset(f, 1); + seek(f, ord(z)*picsize + 65); + blockread(f, p, picsize); + off(); + close(f); + } else { + /* People */ + assign(f, "folk.avd"); + wait(); + getmem(p, picsize); + reset(f, 1); + + fv = ord(z) - 149; + if (fv >= 25) fv -= 8; + if (fv == 20) fv -= 1; /* Last time... */ + + seek(f, fv * picsize + 65); + blockread(f, p, picsize); + off(); + close(f); + } + + setactivepage(3); + putimage(x, y, p, 0); + setactivepage(1 - cp); + + for (fv = 0; fv <= 1; fv ++) + getset[fv].remember(thinkspace); + + freemem(p, picsize); + on(); + thinkthing = th; } -void load_digits() /* Load the scoring digits & rwlites */ -{ - const integer digitsize = 134; - const integer rwlitesize = 126; - untyped_file f; char fv; byte ff; - - assign(f,"digit.avd"); reset(f,1); - for( fv='0'; fv <= '9'; fv ++) - { - getmem(digit[fv],digitsize); blockread(f,digit[fv],digitsize); - } - for( ff=0; ff <= 8; ff ++) - { - getmem(rwlite[ff],rwlitesize); blockread(f,rwlite[ff],rwlitesize); - } - close(f); +void load_digits() { /* Load the scoring digits & rwlites */ + const integer digitsize = 134; + const integer rwlitesize = 126; + untyped_file f; + char fv; + byte ff; + + assign(f, "digit.avd"); + reset(f, 1); + for (fv = '0'; fv <= '9'; fv ++) { + getmem(digit[fv], digitsize); + blockread(f, digit[fv], digitsize); + } + for (ff = 0; ff <= 8; ff ++) { + getmem(rwlite[ff], rwlitesize); + blockread(f, rwlite[ff], rwlitesize); + } + close(f); } -void toolbar() -{ - untyped_file f; word s; byte fv; pointer p; - - assign(f,"useful.avd"); reset(f,1); - s=filesize(f)-40; getmem(p,s); - seek(f,40); - blockread(f,p,s); - close(f); -/* off;*/ - - setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ - setfillstyle(1,6); - for( fv=0; fv <= 1; fv ++) - { - setactivepage(fv); putimage(5,169,p,0); - if (demo) - { - bar(264,177,307,190); - outtextxy(268,188,"Demo!"); /* well... actually only white now. */ - } - } - -/* on;*/ - freemem(p,s); - oldrw=177; showrw(); +void toolbar() { + untyped_file f; + word s; + byte fv; + pointer p; + + assign(f, "useful.avd"); + reset(f, 1); + s = filesize(f) - 40; + getmem(p, s); + seek(f, 40); + blockread(f, p, s); + close(f); + /* off;*/ + + setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ + setfillstyle(1, 6); + for (fv = 0; fv <= 1; fv ++) { + setactivepage(fv); + putimage(5, 169, p, 0); + if (demo) { + bar(264, 177, 307, 190); + outtextxy(268, 188, "Demo!"); /* well... actually only white now. */ + } + } + + /* on;*/ + freemem(p, s); + oldrw = 177; + showrw(); } -void showscore() -{ - const bytefield scorespace = {33, 177, 39, 200}; - varying_string<3> q; byte fv; +void showscore() { + const bytefield scorespace = {33, 177, 39, 200}; + varying_string<3> q; + byte fv; - if (demo) return; + if (demo) return; - str(dna.score,q); while (q[0]<'\3') q=string('0')+q; off(); - setactivepage(3); - for( fv=1; fv <= 3; fv ++) - if (lastscore[fv]!=q[fv]) - putimage(250+fv*15,177,digit[q[fv]],0); + str(dna.score, q); + while (q[0] < '\3') q = string('0') + q; + off(); + setactivepage(3); + for (fv = 1; fv <= 3; fv ++) + if (lastscore[fv] != q[fv]) + putimage(250 + fv * 15, 177, digit[q[fv]], 0); - for( fv=0; fv <= 1; fv ++) - getset[fv].remember(scorespace); + for (fv = 0; fv <= 1; fv ++) + getset[fv].remember(scorespace); - setactivepage(1-cp); - on(); lastscore=q; + setactivepage(1 - cp); + on(); + lastscore = q; } -void points(byte num) /* Add on no. of points */ -{ - byte q,fv; - - for( q=1; q <= num; q ++) - { - dna.score += 1; - if (soundfx) for( fv=1; fv <= 97; fv ++) sound(177+dna.score*3); nosound; - } - log_score(num,dna.score); showscore(); -} +void points(byte num) { /* Add on no. of points */ + byte q, fv; -void topcheck() -{ - { menuset& with = ddm_m; /* Menuset */ - getmenu(mpx);} /* Do this one */ + for (q = 1; q <= num; q ++) { + dna.score += 1; + if (soundfx) for (fv = 1; fv <= 97; fv ++) sound(177 + dna.score * 3); + nosound; + } + log_score(num, dna.score); + showscore(); } -void mouseway() -{ - byte col; - - off(); col=getpixel(mx,my); on(); - { triptype& with = tr[1]; - { dnatype& with1 = dna; - switch (col) { - case green: { dna.rw=up; rwsp(1,up); showrw(); } break; - case brown: { dna.rw=down; rwsp(1,down); showrw(); } break; - case cyan: { dna.rw=left; rwsp(1,left); showrw(); } break; - case lightmagenta: { dna.rw=right; rwsp(1,right); showrw(); } break; - case red:case white:case lightcyan:case yellow: { stopwalking(); showrw(); } break; - }}} +void topcheck() { + { + menuset &with = ddm_m; /* Menuset */ + getmenu(mpx); + } /* Do this one */ } -void inkey() -{ - char r; - - - if (demo) return; /* Demo handles this itself. */ - - if (mousetext=="") - { /* read keyboard */ - readkeye(); - if ((inchar==' ') && ((shiftstate & 8)>0)) - { - inchar='\0'; extd='#'; /* alt-spacebar = alt-H */ - } - } else - { - if (mousetext[1]=='`') mousetext[1]='\15'; /* Backquote = return in a macro */ - inchar=mousetext[1]; mousetext=copy(mousetext,2,255); - } +void mouseway() { + byte col; + + off(); + col = getpixel(mx, my); + on(); + { + triptype &with = tr[1]; + { + dnatype &with1 = dna; + switch (col) { + case green: { + dna.rw = up; + rwsp(1, up); + showrw(); + } + break; + case brown: { + dna.rw = down; + rwsp(1, down); + showrw(); + } + break; + case cyan: { + dna.rw = left; + rwsp(1, left); + showrw(); + } + break; + case lightmagenta: { + dna.rw = right; + rwsp(1, right); + showrw(); + } + break; + case red: + case white: + case lightcyan: + case yellow: { + stopwalking(); + showrw(); + } + break; + } + } + } } -void posxy() -{ - varying_string<3> xs,ys; - - setfillstyle(1,0); setcolor(10); - do { - check(); - if (mpress==1) - { - str(mx,xs); str(my,ys); - off(); bar(400,160,500,168); - outtextxy(400,168,xs); outtextxy(440,168,string(": ")+ys); on(); - } - } while (!(my==0)); - bar(400,161,640,168); -} +void inkey() { + char r; -void fxtoggle() -{ - byte page_; - const bytefield soundled = - {52, 175, 55, 177}; - - soundfx=! soundfx; - if (soundfx) - { - if (! fxhidden) - { /* ...but *not* when the screen's dark. */ - sound(1770); delay(77); nosound; - } - setfillstyle(1,cyan); - } else - setfillstyle(1,black); - setactivepage(3); bar(419,175,438,177); - setactivepage(1-cp); - for( page_=0; page_ <= 1; page_ ++) getset[page_].remember(soundled); -} - -void objectlist() -{ - char fv; - - dna.carrying=0; - if (thinkthing && ! dna.obj[thinks]) - thinkabout(money,a_thing); /* you always have money */ - for( fv='\1'; fv <= numobjs; fv ++) - if (dna.obj[fv]) - { - dna.carrying += 1; objlist[dna.carrying]=fv; - } -} -void verte() -{ - byte what; - - if (! dna.user_moves_avvy) return; - { - triptype& with = tr[1]; /* that's the only one we're interested in here */ + if (demo) return; /* Demo handles this itself. */ + if (mousetext == "") { + /* read keyboard */ + readkeye(); + if ((inchar == ' ') && ((shiftstate & 8) > 0)) { + inchar = '\0'; + extd = '#'; /* alt-spacebar = alt-H */ + } + } else { + if (mousetext[1] == '`') mousetext[1] = '\15'; /* Backquote = return in a macro */ + inchar = mousetext[1]; + mousetext = copy(mousetext, 2, 255); + } +} - if (mx<(cardinal)with.x) what=1; else - if (mx>(unsigned char)(with.x+with.a.xl)) what=2; else - what=0; /* On top */ - - if (my<(cardinal)with.y) what += 3; else - if (my>(unsigned char)(with.y+with.a.yl)) what += 6; +void posxy() { + varying_string<3> xs, ys; + + setfillstyle(1, 0); + setcolor(10); + do { + check(); + if (mpress == 1) { + str(mx, xs); + str(my, ys); + off(); + bar(400, 160, 500, 168); + outtextxy(400, 168, xs); + outtextxy(440, 168, string(": ") + ys); + on(); + } + } while (!(my == 0)); + bar(400, 161, 640, 168); +} - switch (what) { - case 0: stopwalking(); break; /* Clicked on Avvy- no movement */ - case 1: rwsp(1,left); break; - case 2: rwsp(1,right); break; - case 3: rwsp(1,up); break; - case 4: rwsp(1,ul); break; - case 5: rwsp(1,ur); break; - case 6: rwsp(1,down); break; - case 7: rwsp(1,dl); break; - case 8: rwsp(1,dr); break; - } /* no other values are possible... */ +void fxtoggle() { + byte page_; + const bytefield soundled = + {52, 175, 55, 177}; + + soundfx = ! soundfx; + if (soundfx) { + if (! fxhidden) { + /* ...but *not* when the screen's dark. */ + sound(1770); + delay(77); + nosound; + } + setfillstyle(1, cyan); + } else + setfillstyle(1, black); + setactivepage(3); + bar(419, 175, 438, 177); + setactivepage(1 - cp); + for (page_ = 0; page_ <= 1; page_ ++) getset[page_].remember(soundled); +} - showrw(); +void objectlist() { + char fv; + + dna.carrying = 0; + if (thinkthing && ! dna.obj[thinks]) + thinkabout(money, a_thing); /* you always have money */ + for (fv = '\1'; fv <= numobjs; fv ++) + if (dna.obj[fv]) { + dna.carrying += 1; + objlist[dna.carrying] = fv; + } +} - } +void verte() { + byte what; + + if (! dna.user_moves_avvy) return; + { + triptype &with = tr[1]; /* that's the only one we're interested in here */ + + + if (mx < (cardinal)with.x) what = 1; + else if (mx > (unsigned char)(with.x + with.a.xl)) what = 2; + else + what = 0; /* On top */ + + if (my < (cardinal)with.y) what += 3; + else if (my > (unsigned char)(with.y + with.a.yl)) what += 6; + + switch (what) { + case 0: + stopwalking(); + break; /* Clicked on Avvy- no movement */ + case 1: + rwsp(1, left); + break; + case 2: + rwsp(1, right); + break; + case 3: + rwsp(1, up); + break; + case 4: + rwsp(1, ul); + break; + case 5: + rwsp(1, ur); + break; + case 6: + rwsp(1, down); + break; + case 7: + rwsp(1, dl); + break; + case 8: + rwsp(1, dr); + break; + } /* no other values are possible... */ + + showrw(); + + } } -void checkclick() -{ - bytefield b; - - check(); ontoolbar=slow_computer && ((my>=169) || (my<=10)); - - if (mrelease>0) after_the_scroll=false; - switch (my) { - case RANGE_11(0,10): newpointer(1); - break; /* up arrow */ - case RANGE_11(159,169): newpointer(8); - break; /* I-beam */ - case 170 ... 200: newpointer(2); break; /* screwdriver */ - default: - { - if (! ddmnow) /* Dropdown can handle its own pointers. */ - { - if (((keystatus & 1)==1) && (my>=11) && (my<=158)) - { - newpointer(7); /* Mark's crosshairs */ - verte(); - /* Normally, if you click on the picture, you're guiding Avvy around. */ - } else - newpointer(4); /* fletch */ - } - } - } - - if (mpress>0) - { - switch (mpy) { - case RANGE_11(0,10): if (dropsok) topcheck(); - break; - case 11 ... 158: if (! dropsok) - mousetext=string('\15')+mousetext; - break; /* But otherwise, it's +void checkclick() { + bytefield b; + + check(); + ontoolbar = slow_computer && ((my >= 169) || (my <= 10)); + + if (mrelease > 0) after_the_scroll = false; + switch (my) { + case RANGE_11(0, 10): + newpointer(1); + break; /* up arrow */ + case RANGE_11(159, 169): + newpointer(8); + break; /* I-beam */ + case 170 ... 200: + newpointer(2); + break; /* screwdriver */ + default: { + if (! ddmnow) { /* Dropdown can handle its own pointers. */ + if (((keystatus & 1) == 1) && (my >= 11) && (my <= 158)) { + newpointer(7); /* Mark's crosshairs */ + verte(); + /* Normally, if you click on the picture, you're guiding Avvy around. */ + } else + newpointer(4); /* fletch */ + } + } + } + + if (mpress > 0) { + switch (mpy) { + case RANGE_11(0, 10): + if (dropsok) topcheck(); + break; + case 11 ... 158: + if (! dropsok) + mousetext = string('\15') + mousetext; + break; /* But otherwise, it's equivalent to pressing Enter. */ - case RANGE_11(159,169): { /* Click on command line */ - cursor_off(); curpos=(mx-16) / 8; - if (curpos>length(current)+1) curpos=length(current)+1; - if (curpos<1) curpos=1; - cursor_on(); - } - break; - case 170 ... 200: switch (mpx) { /* bottom check */ - case 0 ... 207: mouseway(); break; - case 208 ... 260: { /* Examine the thing */ - do { check(); } while (!(mrelease>0)); - if (thinkthing) - { - thing=thinks; thing += 49; - person=pardon; - } else - { - person=thinks; - thing=pardon; - } - callverb(vb_exam); - } - break; - case 261 ... 319: { - do { checkclick(); } while (!(mrelease>0)); - callverb(vb_score); - } - break; - case 320 ... 357: { tr[1].xs=walk; newspeed(); } break; - case 358 ... 395: { tr[1].xs=run; newspeed(); } break; - case 396 ... 483: fxtoggle(); break; /* "sound" */ -/* 484..534: begin { clock } - off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; - end;*/ - case 535 ... 640: mousetext=string('\15')+mousetext; break; - } - break; - } - } - -/* if mrelease>0 then - begin - if (cw<>177) and (mry>10) then - begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; - end;*/ + case RANGE_11(159, 169): { /* Click on command line */ + cursor_off(); + curpos = (mx - 16) / 8; + if (curpos > length(current) + 1) curpos = length(current) + 1; + if (curpos < 1) curpos = 1; + cursor_on(); + } + break; + case 170 ... 200: + switch (mpx) { /* bottom check */ + case 0 ... 207: + mouseway(); + break; + case 208 ... 260: { /* Examine the thing */ + do { + check(); + } while (!(mrelease > 0)); + if (thinkthing) { + thing = thinks; + thing += 49; + person = pardon; + } else { + person = thinks; + thing = pardon; + } + callverb(vb_exam); + } + break; + case 261 ... 319: { + do { + checkclick(); + } while (!(mrelease > 0)); + callverb(vb_score); + } + break; + case 320 ... 357: { + tr[1].xs = walk; + newspeed(); + } + break; + case 358 ... 395: { + tr[1].xs = run; + newspeed(); + } + break; + case 396 ... 483: + fxtoggle(); + break; /* "sound" */ + /* 484..534: begin { clock } + off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; + end;*/ + case 535 ... 640: + mousetext = string('\15') + mousetext; + break; + } + break; + } + } + + /* if mrelease>0 then + begin + if (cw<>177) and (mry>10) then + begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; + end;*/ } -void mouse_init() -{ - r.ax=0; - intr(0x33,r); /* Returns- no. keys in bx and whether present in ax. */ - wait(); +void mouse_init() { + r.ax = 0; + intr(0x33, r); /* Returns- no. keys in bx and whether present in ax. */ + wait(); } -void mousepage(word page_) -{ - boolean onstate,wason; - - if (visible!=m_virtual) - { - onstate=oncandopageswap; - oncandopageswap=false; - wason=visible==m_yes; - if (wason) off(); - { - void& with = r; ax=29; bx=page_; } intr(0x33,r); - if (wason) on(); - oncandopageswap=onstate; - } +void mousepage(word page_) { + boolean onstate, wason; + + if (visible != m_virtual) { + onstate = oncandopageswap; + oncandopageswap = false; + wason = visible == m_yes; + if (wason) off(); + { + void &with = r; + ax = 29; + bx = page_; + } + intr(0x33, r); + if (wason) on(); + oncandopageswap = onstate; + } } -void errorled() -{ - byte fv; - - state(0); - for( fv=0; fv <= 1; fv ++) - { - setactivepage(fv); - off(); setfillstyle(1,red); bar(419,184,438,186); on(); - } - for( fv=177; fv >= 1; fv --) - { - sound(177+(fv*177177) / 999); - delay(1); nosound; - } - for( fv=0; fv <= 1; fv ++) - { - setactivepage(fv); - off(); setfillstyle(1,black); bar(419,184,438,186); on(); - } - state(defaultled); setactivepage(1-cp); +void errorled() { + byte fv; + + state(0); + for (fv = 0; fv <= 1; fv ++) { + setactivepage(fv); + off(); + setfillstyle(1, red); + bar(419, 184, 438, 186); + on(); + } + for (fv = 177; fv >= 1; fv --) { + sound(177 + (fv * 177177) / 999); + delay(1); + nosound; + } + for (fv = 0; fv <= 1; fv ++) { + setactivepage(fv); + off(); + setfillstyle(1, black); + bar(419, 184, 438, 186); + on(); + } + state(defaultled); + setactivepage(1 - cp); } -shortint fades(shortint x) -{ - byte r,g,b; - - shortint fades_result; - r=x / 16; x=x % 16; - g=x / 4; b=x % 4; - if (r>0) r -= 1; if (g>0) g -= 1; if (b>0) b -= 1; - fades_result=(16*r+4*g+b); -/* fades:=x-1;*/ - return fades_result; +shortint fades(shortint x) { + byte r, g, b; + + shortint fades_result; + r = x / 16; + x = x % 16; + g = x / 4; + b = x % 4; + if (r > 0) r -= 1; + if (g > 0) g -= 1; + if (b > 0) b -= 1; + fades_result = (16 * r + 4 * g + b); + /* fades:=x-1;*/ + return fades_result; } void dusk(); -static void fadeout(byte n) -{ - byte fv; +static void fadeout(byte n) { + byte fv; - getpalette(fxpal[n]); - for( fv=1; fv <= fxpal[n].size-1; fv ++) - fxpal[n].colors[fv]=fades(fxpal[n].colors[fv]); - setallpalette(fxpal[n]); - /*delay(50);*/ slowdown(); + getpalette(fxpal[n]); + for (fv = 1; fv <= fxpal[n].size - 1; fv ++) + fxpal[n].colors[fv] = fades(fxpal[n].colors[fv]); + setallpalette(fxpal[n]); + /*delay(50);*/ slowdown(); } -void dusk() -{ - byte fv; +void dusk() { + byte fv; - setbkcolor(0); - if (fxhidden) return; fxhidden=true; - getpalette(fxpal[0]); for( fv=1; fv <= 3; fv ++) fadeout(fv); + setbkcolor(0); + if (fxhidden) return; + fxhidden = true; + getpalette(fxpal[0]); + for (fv = 1; fv <= 3; fv ++) fadeout(fv); } void dawn(); -static void fadein(byte n) -{ - setallpalette(fxpal[n]); - /*delay(50);*/ slowdown(); +static void fadein(byte n) { + setallpalette(fxpal[n]); + /*delay(50);*/ slowdown(); } -void dawn() -{ - byte fv; +void dawn() { + byte fv; - if ((holdthedawn) || (! fxhidden)) return; fxhidden=false; - for( fv=3; fv >= 0; fv --) fadein(fv); - { dnatype& with = dna; - if ((with.room==r__yours) && (with.avvy_in_bed) && (with.teetotal)) background(14);} + if ((holdthedawn) || (! fxhidden)) return; + fxhidden = false; + for (fv = 3; fv >= 0; fv --) fadein(fv); + { + dnatype &with = dna; + if ((with.room == r__yours) && (with.avvy_in_bed) && (with.teetotal)) background(14); + } } -void showrw() -{ - byte page_; - - { - dnatype& with = dna; - - if (oldrw==with.rw) return; - oldrw=with.rw; off(); - for( page_=0; page_ <= 1; page_ ++) - { - setactivepage(page_); putimage(0,161,rwlite[with.rw],0); - } on(); - setactivepage(1-cp); - } +void showrw() { + byte page_; + + { + dnatype &with = dna; + + if (oldrw == with.rw) return; + oldrw = with.rw; + off(); + for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + putimage(0, 161, rwlite[with.rw], 0); + } + on(); + setactivepage(1 - cp); + } } -void mblit(byte x1,byte y1,byte x2,byte y2, byte f,byte t) /* assembler; */ +void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t) /* assembler; */ /* The Minstrel Blitter */ /* asm { ofsfr:=f*$4000+x1+y1*80; @@ -1239,215 +1395,234 @@ void mblit(byte x1,byte y1,byte x2,byte y2, byte f,byte t) /* assembler; */ pop ds; { Get it back again (or we'll be in trouble with TP!) } */ -{; +{ + ; } -void blitfix() -{ - byte fv; +void blitfix() { + byte fv; - fv=getpixel(0,0); /* perform read & so cancel Xor effect! */ + fv = getpixel(0, 0); /* perform read & so cancel Xor effect! */ } void clock(); -const integer xm = 510; +const integer xm = 510; const integer ym = 183; -static arccoordstype ah,am; +static arccoordstype ah, am; static word nh; -static void calchand(word ang,word length, arccoordstype& a, byte c) -{ - if (ang>900) { a.xend=177; return; } - setcolor(c); arc(xm,ym,449-ang,450-ang,length); getarccoords(a); +static void calchand(word ang, word length, arccoordstype &a, byte c) { + if (ang > 900) { + a.xend = 177; + return; + } + setcolor(c); + arc(xm, ym, 449 - ang, 450 - ang, length); + getarccoords(a); } -static void hand(arccoordstype a, byte c) -{ - if (a.xend==177) return; - setcolor(c); - line(xm,ym,a.xend,a.yend); /* "With a do-line???!", Liz said. */ +static void hand(arccoordstype a, byte c) { + if (a.xend == 177) return; + setcolor(c); + line(xm, ym, a.xend, a.yend); /* "With a do-line???!", Liz said. */ } -static void chime() -{ - word gd,gm,fv; - - if ((oh==17717) || (! soundfx)) return; /* too high- must be first time around */ - fv=h % 12; if (fv==0) fv=12; wait(); - for( gd=1; gd <= fv; gd ++) - { - for( gm=1; gm <= 3; gm ++) - { - sound((gd % 3)*64+140-gm*30); delay(50-gm*12); - } - nosound; if (gd!=fv) delay(100); - } +static void chime() { + word gd, gm, fv; + + if ((oh == 17717) || (! soundfx)) return; /* too high- must be first time around */ + fv = h % 12; + if (fv == 0) fv = 12; + wait(); + for (gd = 1; gd <= fv; gd ++) { + for (gm = 1; gm <= 3; gm ++) { + sound((gd % 3) * 64 + 140 - gm * 30); + delay(50 - gm * 12); + } + nosound; + if (gd != fv) delay(100); + } } -static void refresh_hands() -{ - const bytefield clockspace = {61, 166, 66, 200}; - byte page_; +static void refresh_hands() { + const bytefield clockspace = {61, 166, 66, 200}; + byte page_; - for( page_=0; page_ <= 1; page_ ++) - getset[page_].remember(clockspace); + for (page_ = 0; page_ <= 1; page_ ++) + getset[page_].remember(clockspace); } -static void plothands() -{ -/* off;*/ - setactivepage(3); - calchand(onh,14,ah,yellow); calchand(om*6,17,am,yellow); - hand(ah,brown); hand(am,brown); - calchand(nh,14,ah,brown); calchand(m*6,17,am,brown); - hand(ah,yellow); hand(am,yellow); - setactivepage(1-cp); +static void plothands() { + /* off;*/ + setactivepage(3); + calchand(onh, 14, ah, yellow); + calchand(om * 6, 17, am, yellow); + hand(ah, brown); + hand(am, brown); + calchand(nh, 14, ah, brown); + calchand(m * 6, 17, am, brown); + hand(ah, yellow); + hand(am, yellow); + setactivepage(1 - cp); - refresh_hands(); + refresh_hands(); -/* on;*/ + /* on;*/ } -void clock() -{ /* ...Clock. */ - gettime(h,m,s,s1); - nh=(h % 12)*30+m / 2; - if (oh!=h) { plothands(); chime(); } - if (om!=m) plothands(); - if ((h==0) && (oh!=0) && (oh!=17717)) - display(string("Good morning!\r\rYes, it's just past midnight. Are you having")+ - " an all-night Avvy session? Glad you like the game that much!"); - oh=h; onh=nh; om=m; +void clock() { + /* ...Clock. */ + gettime(h, m, s, s1); + nh = (h % 12) * 30 + m / 2; + if (oh != h) { + plothands(); + chime(); + } + if (om != m) plothands(); + if ((h == 0) && (oh != 0) && (oh != 17717)) + display(string("Good morning!\r\rYes, it's just past midnight. Are you having") + + " an all-night Avvy session? Glad you like the game that much!"); + oh = h; + onh = nh; + om = m; } -void flip_page() -{ - if (! ddm_o.menunow) - { - cp=1-cp; - setvisualpage(cp); - setactivepage(1-cp); - /*mousepage(cp);*/ - } +void flip_page() { + if (! ddm_o.menunow) { + cp = 1 - cp; + setvisualpage(cp); + setactivepage(1 - cp); + /*mousepage(cp);*/ + } } -void delavvy() -{ - byte page_; - - off(); - { triptype& with = tr[1]; - for( page_=0; page_ <= 1; page_ ++) - mblit(with.x / 8,with.y,(with.x+with.a.xl) / 8+1,with.y+with.a.yl,3,page_);} - blitfix(); - on(); +void delavvy() { + byte page_; + + off(); + { + triptype &with = tr[1]; + for (page_ = 0; page_ <= 1; page_ ++) + mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); + } + blitfix(); + on(); } -void gameover() -{ - byte fv; integer sx,sy; - - dna.user_moves_avvy=false; - - sx=tr[1].x; - sy=tr[1].y; - { - triptype& with = tr[1]; - - done(); - init(12,true); /* 12 = Avalot falls */ - tr[1].step=0; - appear(sx,sy,0); - } - set_up_timer(3,procavalot_falls,reason_falling_over); -/* display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ - alive=false; +void gameover() { + byte fv; + integer sx, sy; + + dna.user_moves_avvy = false; + + sx = tr[1].x; + sy = tr[1].y; + { + triptype &with = tr[1]; + + done(); + init(12, true); /* 12 = Avalot falls */ + tr[1].step = 0; + appear(sx, sy, 0); + } + set_up_timer(3, procavalot_falls, reason_falling_over); + /* display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ + alive = false; } /* OK. There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. */ -void minor_redraw() -{ - byte fv; +void minor_redraw() { + byte fv; - dusk(); - enterroom(dna.room,0); /* Ped unknown or non-existant. */ + dusk(); + enterroom(dna.room, 0); /* Ped unknown or non-existant. */ - for( fv=0; fv <= 1; fv ++) - { - cp=1-cp; - getback(); - } + for (fv = 0; fv <= 1; fv ++) { + cp = 1 - cp; + getback(); + } - { - dnatype& with = dna; + { + dnatype &with = dna; - lastscore="TJA"; /* impossible digits */ - showscore(); - } + lastscore = "TJA"; /* impossible digits */ + showscore(); + } - dawn(); + dawn(); } -void major_redraw() -{ - byte fv; - - dusk(); - setactivepage(0); cleardevice(); - - toolbar(); - copy03(); - - enterroom(dna.room,0); /* 0 = ped unknown or non-existant. */ - for( fv=0; fv <= 1; fv ++) { cp=1-cp; getback(); } - - om=177; - clock(); - - thinkabout(thinks,thinkthing); standard_bar(); - soundfx=! soundfx; fxtoggle(); - for( fv=0; fv <= 1; fv ++) { cp=1-cp; getback(); } - plottext(); - ledstatus=177; state(2); - - { - dnatype& with = dna; - - lastscore="TJA"; /* impossible digits */ - showscore(); - } - - dawn(); +void major_redraw() { + byte fv; + + dusk(); + setactivepage(0); + cleardevice(); + + toolbar(); + copy03(); + + enterroom(dna.room, 0); /* 0 = ped unknown or non-existant. */ + for (fv = 0; fv <= 1; fv ++) { + cp = 1 - cp; + getback(); + } + + om = 177; + clock(); + + thinkabout(thinks, thinkthing); + standard_bar(); + soundfx = ! soundfx; + fxtoggle(); + for (fv = 0; fv <= 1; fv ++) { + cp = 1 - cp; + getback(); + } + plottext(); + ledstatus = 177; + state(2); + + { + dnatype &with = dna; + + lastscore = "TJA"; /* impossible digits */ + showscore(); + } + + dawn(); } word bearing(byte whichped) - /* Returns the bearing from ped Whichped to Avvy, in degrees. */ +/* Returns the bearing from ped Whichped to Avvy, in degrees. */ { - const real rad2deg = 180/pi; - - word bearing_result; - { pedtype& with = peds[whichped]; - if (tr[1].x==with.x) - bearing_result=0; /* This would cause a division by zero if we let it through. */ - else - /* - bearing:=trunc(((arctan((tr[1].y-y)/(tr[1].x-x)))*rad2deg)+90) mod 360*/ - { - if (tr[1].x magic,out; -word next,gg; +integer gd, gm; +file magic, out; +word next, gg; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - assign(magic,"v:magicirc.avd"); reset(magic); - assign(out,"v:magic2.avd"); rewrite(out); - move(mem[0xa000*0],mem[0xa000*pagetop],16000); - while (! eof(magic)) - {; - magic >> next; - if (next!=nextcode) - mem[0xa000*next]=255; - else - {; - for( gg=0; gg <= 16000; gg ++) - if (mem[0xa000*gg]!=mem[0xa000*gg+pagetop]) - out << gg; - out << nextcode; - move(mem[0xa000*0],mem[0xa000*pagetop],16000); - } - } - close(magic); close(out); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(magic, "v:magicirc.avd"); + reset(magic); + assign(out, "v:magic2.avd"); + rewrite(out); + move(mem[0xa000 * 0], mem[0xa000 * pagetop], 16000); + while (! eof(magic)) { + ; + magic >> next; + if (next != nextcode) + mem[0xa000 * next] = 255; + else { + ; + for (gg = 0; gg <= 16000; gg ++) + if (mem[0xa000 * gg] != mem[0xa000 * gg + pagetop]) + out << gg; + out << nextcode; + move(mem[0xa000 * 0], mem[0xa000 * pagetop], 16000); + } + } + close(magic); + close(out); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 241f69265b57..0f280c29e0bb 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,30 +32,33 @@ namespace Avalanche { const word nextcode = 17717; -integer gd,gm; +integer gd, gm; untyped_file magic; /* of word;*/ word next; -array<1,16401,word> buffer; - -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - assign(magic,"v:magic2.avd"); reset(magic,1); - blockread(magic,buffer,sizeof(buffer)); - close(magic); -/* while not eof(magic) do*/ - for( gd=1; gd <= 16401; gd ++) - {; -/* read(magic,next); - if next<>nextcode then*/ - if (buffer[gd]!=nextcode) - mem[0xa000*buffer[gd]]=255; - else - delay(1); - } -/* close(magic);*/ -return EXIT_SUCCESS; +array<1, 16401, word> buffer; + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(magic, "v:magic2.avd"); + reset(magic, 1); + blockread(magic, buffer, sizeof(buffer)); + close(magic); + /* while not eof(magic) do*/ + for (gd = 1; gd <= 16401; gd ++) { + ; + /* read(magic,next); + if next<>nextcode then*/ + if (buffer[gd] != nextcode) + mem[0xa000 * buffer[gd]] = 255; + else + delay(1); + } + /* close(magic);*/ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 6706ceb56fe6..2ef6e37fed4c 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,8 +32,8 @@ namespace Avalanche { const word nextcode = 17717; -typedef array<1,8000,word> big; -typedef array<1,16401,word> circle; +typedef array<1, 8000, word> big; +typedef array<1, 16401, word> circle; big b; file f; @@ -42,46 +42,57 @@ word gd; circle c; file fc; -void melt(byte c) -{; - for( gd=1; gd <= 8000; gd ++) - {; - mem[0xa000*b[gd]]=c; - if ((gd % 17)==0) delay(1); - } +void melt(byte c) { + ; + for (gd = 1; gd <= 8000; gd ++) { + ; + mem[0xa000 * b[gd]] = c; + if ((gd % 17) == 0) delay(1); + } } -void magicirc(byte cc) -{; - for( gd=1; gd <= 16401; gd ++) - {; - if (c[gd]!=nextcode) - {; - if (odd(c[gd])) mem[0xa000*c[gd] / 2]=cc; - } else - delay(1); - } +void magicirc(byte cc) { + ; + for (gd = 1; gd <= 16401; gd ++) { + ; + if (c[gd] != nextcode) { + ; + if (odd(c[gd])) mem[0xa000 * c[gd] / 2] = cc; + } else + delay(1); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - r.ax=13; intr(0x10,r); - assign(f,"d:shuffle.avd"); reset(f); f >> b; close(f); - assign(fc,"v:magic2.avd"); reset(fc); fc >> c; close(fc); -/* repeat - melt(170); magicirc(85); - magicirc(170); melt(85); - magicirc(170); magicirc(85); - melt(170); melt(85); - until keypressed;*/ - do { - melt(255); magicirc(0); - magicirc(255); melt(0); - magicirc(255); magicirc(0); - melt(255); melt(0); - } while (!keypressed()); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + r.ax = 13; + intr(0x10, r); + assign(f, "d:shuffle.avd"); + reset(f); + f >> b; + close(f); + assign(fc, "v:magic2.avd"); + reset(fc); + fc >> c; + close(fc); + /* repeat + melt(170); magicirc(85); + magicirc(170); melt(85); + magicirc(170); magicirc(85); + melt(170); melt(85); + until keypressed;*/ + do { + melt(255); + magicirc(0); + magicirc(255); + melt(0); + magicirc(255); + magicirc(0); + melt(255); + melt(0); + } while (!keypressed()); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index 353b461387ac..a4cf27801f94 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,61 +31,72 @@ namespace Avalanche { /*$S-*/ -integer gd,gm; +integer gd, gm; untyped_file f; text t; string x; -boolean subpix(integer x,integer y) -{boolean subpix_result; -; - subpix_result=getpixel(x,y)==15; -return subpix_result; +boolean subpix(integer x, integer y) { + boolean subpix_result; + ; + subpix_result = getpixel(x, y) == 15; + return subpix_result; } -byte pixel(integer x,integer y) -{byte pixel_result; -; - pixel_result=(byte)( - subpix(x*4,y*2) || - subpix(x*4+1,y*2) || - subpix(x*4+2,y*2) || - subpix(x*4+3,y*2) || - subpix(x*4,y*2+1) || - subpix(x*4+1,y*2+1) || - subpix(x*4+2,y*2+1) || - subpix(x*4+3,y*2+1) - )*15; -return pixel_result; +byte pixel(integer x, integer y) { + byte pixel_result; + ; + pixel_result = (byte)( + subpix(x * 4, y * 2) || + subpix(x * 4 + 1, y * 2) || + subpix(x * 4 + 2, y * 2) || + subpix(x * 4 + 3, y * 2) || + subpix(x * 4, y * 2 + 1) || + subpix(x * 4 + 1, y * 2 + 1) || + subpix(x * 4 + 2, y * 2 + 1) || + subpix(x * 4 + 3, y * 2 + 1) + ) * 15; + return pixel_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=1; initgraph(gd,gm,"o:"); - assign(f,"v:logo.avd"); reset(f,1); - for( gd=0; gd <= 180; gd ++) - blockread(f,mem[0xa000*(gd*80)],53); - close(f); - for( gd=1; gd <= 106; gd ++) - for( gm=0; gm <= 145; gm ++) - putpixel(gd,gm+181,pixel(gd,gm)); - assign(t,"d:avalot.txt"); - rewrite(t); - for( gm=1; gm <= 36; gm ++) - {; - x=""; - for( gd=1; gd <= 106; gd ++) - switch (getpixel(gd,gm*2+181)*2+getpixel(gd,gm*2+182)) { - case 0: x=x+' '; break; - case 15: x=x+''; break; - case 30: x=x+''; break; - case 45: x=x+''; break; - } - t << x << NL; - } - close(t); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 1; + initgraph(gd, gm, "o:"); + assign(f, "v:logo.avd"); + reset(f, 1); + for (gd = 0; gd <= 180; gd ++) + blockread(f, mem[0xa000 * (gd * 80)], 53); + close(f); + for (gd = 1; gd <= 106; gd ++) + for (gm = 0; gm <= 145; gm ++) + putpixel(gd, gm + 181, pixel(gd, gm)); + assign(t, "d:avalot.txt"); + rewrite(t); + for (gm = 1; gm <= 36; gm ++) { + ; + x = ""; + for (gd = 1; gd <= 106; gd ++) + switch (getpixel(gd, gm * 2 + 181) * 2 + getpixel(gd, gm * 2 + 182)) { + case 0: + x = x + ' '; + break; + case 15: + x = x + ''; + break; + case 30: + x = x + ''; + break; + case 45: + x = x + ''; + break; + } + t << x << NL; + } + close(t); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index 3c46e18e46e0..1307f175152c 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -28,15 +28,15 @@ namespace Avalanche { struct sezheader { - array<1,2,char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all scroll chains */ + array<1, 2, char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all scroll chains */ }; -const string crlf = string('\15')+'\12'; -const string tabs = string('\11')+'\11'+'\11'+'\11'+'\11'+'\11'+'\11'; +const string crlf = string('\15') + '\12'; +const string tabs = string('\11') + '\11' + '\11' + '\11' + '\11' + '\11' + '\11'; const char eof_ = '\32'; untyped_file sez; @@ -44,31 +44,32 @@ sezheader header; string x; char check; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - fillchar(x,sizeof(x),'\261'); - x=string("This is a Sez file for an Avvy game, and its contents are subject")+crlf+ - "to copyright. Have fun with the game!"+crlf+crlf+tabs+"tt"+crlf+crlf+ - "[Lord Avalot D'Argent]"+crlf+crlf+eof_+ - crlf+crlf+"Thomas was here!"; - {; - header.initials="TT"; - header.gamecode=2; /* code for Avalot */ - header.revision=100; /* version 1.00 */ - header.chains=0; /* no chains */ - header.size=0; /* empty! */ - } - check='\261'; - assign(sez,"avalot.sez"); - rewrite(sez,1); - blockwrite(sez,x[1],255); - blockwrite(sez,header,sizeof(header)); - blockwrite(sez,check,1); - x=string('\0')+'\0'+'\0'+"Thomas was here, too!"+crlf+crlf+"Good luck..."; - blockwrite(sez,x[1],39); /* footer */ - close(sez); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + fillchar(x, sizeof(x), '\261'); + x = string("This is a Sez file for an Avvy game, and its contents are subject") + crlf + + "to copyright. Have fun with the game!" + crlf + crlf + tabs + "tt" + crlf + crlf + + "[Lord Avalot D'Argent]" + crlf + crlf + eof_ + + crlf + crlf + "Thomas was here!"; + { + ; + header.initials = "TT"; + header.gamecode = 2; /* code for Avalot */ + header.revision = 100; /* version 1.00 */ + header.chains = 0; /* no chains */ + header.size = 0; /* empty! */ + } + check = '\261'; + assign(sez, "avalot.sez"); + rewrite(sez, 1); + blockwrite(sez, x[1], 255); + blockwrite(sez, header, sizeof(header)); + blockwrite(sez, check, 1); + x = string('\0') + '\0' + '\0' + "Thomas was here, too!" + crlf + crlf + "Good luck..."; + blockwrite(sez, x[1], 39); /* footer */ + close(sez); + return EXIT_SUCCESS; } diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index 9f509f16c638..3b71276a619c 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,265 +33,292 @@ namespace Avalanche { struct mp { /* mouse-pointer */ - matrix<0,1,0,15,word> mask; - integer horzhotspot,verthotspot; + matrix<0, 1, 0, 15, word> mask; + integer horzhotspot, verthotspot; }; struct vmctype { /* Virtual Mouse Cursor */ - pointer andpic,xorpic; - array<0,1,pointer> backpic; - array<0,1,pointtype> wherewas; - byte picnumber; - shortint ofsx,ofsy; + pointer andpic, xorpic; + array<0, 1, pointer> backpic; + array<0, 1, pointtype> wherewas; + byte picnumber; + shortint ofsx, ofsy; }; -const array<1,9,arrowtype> mps = -{{{ /* 1 - up-arrow */ - ((65151,64575,64575,63519,63519,61455,61455,57351,57351,49155,49155,64575,64575,64575,64575,64575), - (0,384,384,960,960,2016,2016,4080,4080,8184,384,384,384,384,384,0)), - 8, - 0}, - -{ /* 2 - screwdriver */ - ((8191,4095,2047,34815,50175,61951,63743,64543,65039,65031,65027,65281,65408,65472,65505,65523), - (0,24576,28672,12288,2048,1024,512,256,224,176,216,96,38,10,12,0)), - 0, - 0}, - -{ /* 3 - right-arrow */ - ((65535,65535,64639,64543,7,1,0,1,7,64543,64639,65535,65535,65535,65535,65535), - (0,0,0,384,480,32760,32766,32760,480,384,0,0,0,0,0,0)), - 15, - 6}, - -{ /* 4 - fletch */ - ((255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511), - (0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0)), - 0, - 0}, - -{ /* 5 - hourglass */ - ((0,0,0,34785,50115,61455,61455,63519,63519,61839,61455,49155,32769,0,0,0), - (0,32766,16386,12300,2064,1440,1440,576,576,1056,1440,3024,14316,16386,32766,0)), - 8, - 7}, - -{ /* 6 - TTHand */ - ((62463,57855,57855,57855,57471,49167,32769,0,0,0,0,32768,49152,57344,61441,61443), - (3072,4608,4608,4608,4992,12912,21070,36937,36873,36865,32769,16385,8193,4097,2050,4092)), - 4, - 0}, - -{ /* 7- Mark's crosshairs */ - ((65535,65151,65151,65151,65151,0,65151,65151,65151,65151,65535,65535,65535,65535,65535,65535), - (0,384,384,384,384,65535,384,384,384,384,0,0,0,0,0,0)), - 8, - 5}, - -{ /* 8- I-beam. */ - ((65535,65535,63631,63503,63503,65087,65087,65087,65087,65087,63503,63503,63631,65535,65535,65535), - (0,0,0,864,128,128,128,128,128,128,128,864,0,0,0,0)), - 8, - 7}, - -{ /* 9- Question mark. */ - ((511,1023,2047,31,15,8199,32647,65415,63503,61471,61503,61695,63999,63999,61695,61695), - (65024,33792,34816,34784,40976,57224,32840,72,1936,2080,2496,2304,1536,1536,2304,3840)), - 0, - 0}}}; +const array<1, 9, arrowtype> mps = { + { { + /* 1 - up-arrow */ + ((65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575), + (0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0)), + 8, + 0 + }, + + { + /* 2 - screwdriver */ + ((8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523), + (0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0)), + 0, + 0 + }, + + { + /* 3 - right-arrow */ + ((65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535), + (0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0)), + 15, + 6 + }, + + { + /* 4 - fletch */ + ((255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511), + (0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0)), + 0, + 0 + }, + + { + /* 5 - hourglass */ + ((0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0), + (0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0)), + 8, + 7 + }, + + { + /* 6 - TTHand */ + ((62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443), + (3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092)), + 4, + 0 + }, + + { + /* 7- Mark's crosshairs */ + ((65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535), + (0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0)), + 8, + 5 + }, + + { + /* 8- I-beam. */ + ((65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535), + (0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0)), + 8, + 7 + }, + + { + /* 9- Question mark. */ + ((511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695), + (65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840)), + 0, + 0 + } + } +}; const integer mouse_size = 134; -const array<1,134,char> mice_header = - string("Mouse file copyright (c) 1993. I saw a mouse! Where? SQUEEAAAKK!!! Cheese ")+ /* 74 */ - "cheese cheese. Cheddar, Stilton, Double Gloucester. Squeak."+'\32'; /* 60 */ +const array<1, 134, char> mice_header = + string("Mouse file copyright (c) 1993. I saw a mouse! Where? SQUEEAAAKK!!! Cheese ") + /* 74 */ + "cheese cheese. Cheddar, Stilton, Double Gloucester. Squeak." +'\32'; /* 60 */ -integer gd,gm; -matrix<0,50,1,40,word> a /*absolute $A000:0i*/; +integer gd, gm; +matrix<0, 50, 1, 40, word> a /*absolute $A000:0i*/; byte fv; vmctype vmc; -byte plot; integer plx,ply; - -word swapbits(word a) -{word swapbits_result; -; - swapbits_result=lo(a)*256+hi(a); -return swapbits_result; +byte plot; +integer plx, ply; + +word swapbits(word a) { + word swapbits_result; + ; + swapbits_result = lo(a) * 256 + hi(a); + return swapbits_result; } -void plot_vmc(integer xx,integer yy, byte page_) -{; - {; - xx=xx+vmc.ofsx; - yy=yy+vmc.ofsy; - - getimage(xx,yy,xx+15,yy+15,vmc.backpic[page_]); - putimage(xx,yy,vmc.andpic,andput); - putimage(xx,yy,vmc.xorpic,xorput); - { - pointtype& with1 = vmc.wherewas[page_]; - ; - with1.x=xx; - with1.y=yy; - } - } +void plot_vmc(integer xx, integer yy, byte page_) { + ; + { + ; + xx = xx + vmc.ofsx; + yy = yy + vmc.ofsy; + + getimage(xx, yy, xx + 15, yy + 15, vmc.backpic[page_]); + putimage(xx, yy, vmc.andpic, andput); + putimage(xx, yy, vmc.xorpic, xorput); + { + pointtype &with1 = vmc.wherewas[page_]; + ; + with1.x = xx; + with1.y = yy; + } + } } -void wipe_vmc(byte page_) -{; - { pointtype& with1 = vmc.wherewas[page_]; - if (with1.x!=maxint) - putimage(with1.x,with1.y,vmc.backpic[page_],0);} +void wipe_vmc(byte page_) { + ; + { + pointtype &with1 = vmc.wherewas[page_]; + if (with1.x != maxint) + putimage(with1.x, with1.y, vmc.backpic[page_], 0); + } } -void setup_vmc() -{ - byte fv; -; -/* gd:=imagesize(0,0,15,15);*/ - - {; - getmem(vmc.andpic,mouse_size); - getmem(vmc.xorpic,mouse_size); - - for( fv=0; fv <= 1; fv ++) - {; - getmem(vmc.backpic[fv],mouse_size); - vmc.wherewas[fv].x=maxint; - } - } +void setup_vmc() { + byte fv; + ; + /* gd:=imagesize(0,0,15,15);*/ + + { + ; + getmem(vmc.andpic, mouse_size); + getmem(vmc.xorpic, mouse_size); + + for (fv = 0; fv <= 1; fv ++) { + ; + getmem(vmc.backpic[fv], mouse_size); + vmc.wherewas[fv].x = maxint; + } + } } -void show_off_mouse() -{; +void show_off_mouse() { + ; - setcolor(14); settextstyle(0,0,2); + setcolor(14); + settextstyle(0, 0, 2); - for( gm=0; gm <= 1; gm ++) - {; - setactivepage(gm); - setfillstyle(1,blue); bar(0,0,getmaxx(),getmaxy()); - outtextxy(400,20,chr(48+gm)); - } + for (gm = 0; gm <= 1; gm ++) { + ; + setactivepage(gm); + setfillstyle(1, blue); + bar(0, 0, getmaxx(), getmaxy()); + outtextxy(400, 20, chr(48 + gm)); + } - gd=0; - do { - setactivepage(gd); - setvisualpage(1-gd); - gd=1-gd; + gd = 0; + do { + setactivepage(gd); + setvisualpage(1 - gd); + gd = 1 - gd; - delay(56); + delay(56); - getbuttonstatus; - wipe_vmc(gd); + getbuttonstatus; + wipe_vmc(gd); - if (plot>0) - {; - putpixel(plx,ply,red); - plot -= 1; - } + if (plot > 0) { + ; + putpixel(plx, ply, red); + plot -= 1; + } - plot_vmc(mx,my,gd); + plot_vmc(mx, my, gd); - if ((mkey==left) && (plot==0)) - {; - plot=2; - plx=mx; - ply=my; - } + if ((mkey == left) && (plot == 0)) { + ; + plot = 2; + plx = mx; + ply = my; + } - } while (!(mkey==right)); + } while (!(mkey == right)); - for( gm=0; gm <= 1; gm ++) - {; - setactivepage(1-gm); - wipe_vmc(gm); - } + for (gm = 0; gm <= 1; gm ++) { + ; + setactivepage(1 - gm); + wipe_vmc(gm); + } - setvisualpage(0); - setactivepage(0); + setvisualpage(0); + setactivepage(0); } -void grab_cursor(byte n) -{; - getimage(32*n-16, 0,32*n-1,15,vmc.andpic); - getimage(32*n-16,20,32*n-1,35,vmc.xorpic); +void grab_cursor(byte n) { + ; + getimage(32 * n - 16, 0, 32 * n - 1, 15, vmc.andpic); + getimage(32 * n - 16, 20, 32 * n - 1, 35, vmc.xorpic); } -void save_mice() -{ - untyped_file f; - byte fv; -; - assign(f,"v:mice.avd"); - rewrite(f,1); - - blockwrite(f,mice_header,mouse_size); - - for( fv=1; fv <= 9; fv ++) - {; - grab_cursor(fv); - putimage(100,100,vmc.xorpic,0); - blockwrite(f,vmc.andpic,mouse_size); - blockwrite(f,vmc.xorpic,mouse_size); - } - - close(f); +void save_mice() { + untyped_file f; + byte fv; + ; + assign(f, "v:mice.avd"); + rewrite(f, 1); + + blockwrite(f, mice_header, mouse_size); + + for (fv = 1; fv <= 9; fv ++) { + ; + grab_cursor(fv); + putimage(100, 100, vmc.xorpic, 0); + blockwrite(f, vmc.andpic, mouse_size); + blockwrite(f, vmc.xorpic, mouse_size); + } + + close(f); } -void load_a_mouse(byte which) -{ - untyped_file f; -; - assign(f,"v:mice.avd"); - reset(f,1); - seek(f,mouse_size*2*(which-1)+134); - - {; - blockread(f,vmc.andpic,mouse_size); - blockread(f,vmc.xorpic,mouse_size); - close(f); - { - void& with1 = mps[which]; - ; - vmc.ofsx=-horzhotspot; - vmc.ofsy=-verthotspot; - - setminmaxhorzcurspos(horzhotspot,624+horzhotspot); - setminmaxvertcurspos(verthotspot,199); - } - } +void load_a_mouse(byte which) { + untyped_file f; + ; + assign(f, "v:mice.avd"); + reset(f, 1); + seek(f, mouse_size * 2 * (which - 1) + 134); + + { + ; + blockread(f, vmc.andpic, mouse_size); + blockread(f, vmc.xorpic, mouse_size); + close(f); + { + void &with1 = mps[which]; + ; + vmc.ofsx = -horzhotspot; + vmc.ofsy = -verthotspot; + + setminmaxhorzcurspos(horzhotspot, 624 + horzhotspot); + setminmaxvertcurspos(verthotspot, 199); + } + } } -void draw_mouse_cursors() -{; - for( fv=1; fv <= 9; fv ++) - for( gm=0; gm <= 1; gm ++) - for( gd=0; gd <= 15; gd ++) - a[gd+gm*20][fv*2]=swapbits(mps[fv].mask[gm][gd]); +void draw_mouse_cursors() { + ; + for (fv = 1; fv <= 9; fv ++) + for (gm = 0; gm <= 1; gm ++) + for (gd = 0; gd <= 15; gd ++) + a[gd + gm * 20][fv * 2] = swapbits(mps[fv].mask[gm][gd]); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - resetmouse; - setup_vmc(); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + resetmouse; + setup_vmc(); - draw_mouse_cursors(); + draw_mouse_cursors(); - save_mice(); + save_mice(); -/* grab_cursor(3);*/ -/* load_a_mouse(4); - setgraphicscursor(mps[4]); + /* grab_cursor(3);*/ + /* load_a_mouse(4); + setgraphicscursor(mps[4]); - show_off_mouse; - on; repeat getbuttonstatus until mkey=left; off; - show_off_mouse;*/ -return EXIT_SUCCESS; + show_off_mouse; + on; repeat getbuttonstatus until mkey=left; off; + show_off_mouse;*/ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp index 17fa553afe23..704d6eb26022 100644 --- a/engines/avalanche/menuxf.cpp +++ b/engines/avalanche/menuxf.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,48 +29,53 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -void load() /* Load2, actually */ -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; +void load() { /* Load2, actually */ + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; - assign(f,"maintemp.avd"); reset(f,1); - /* Compression method byte follows this... */ - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - bit=getpixel(0,0); + assign(f, "maintemp.avd"); + reset(f, 1); + /* Compression method byte follows this... */ + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -void save() -{ - byte bit; untyped_file f; +void save() { + byte bit; + untyped_file f; - assign(f,"v:mainmenu.avd"); - rewrite(f,1); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,mem[0xa000*48*80],59*80); - } - close(f); + assign(f, "v:mainmenu.avd"); + rewrite(f, 1); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, mem[0xa000 * 48 * 80], 59 * 80); + } + close(f); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=1; initgraph(gd,gm,""); - load(); /* Between 48 and 107. */ +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + load(); /* Between 48 and 107. */ - save(); - return EXIT_SUCCESS; + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index 38608c8ca0ca..3a88863accc9 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,37 +29,53 @@ namespace Avalanche { -integer gd,gm; -pointer p; word s; +integer gd, gm; +pointer p; +word s; -void mblit(integer x1,integer y1,integer x2,integer y2) /* Minstrel Blitter */ -{ - integer yy,len,pp; byte bit; const integer offset = 16384; -; - x1=x1 / 8; len=((x2 / 8)-x1)+1; - for( yy=y1; yy <= y2; yy ++) - {; - pp=yy*80+x1; - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(mem[0xa000*offset+pp],mem[0xa000*pp],len); - } - } +void mblit(integer x1, integer y1, integer x2, integer y2) { /* Minstrel Blitter */ + integer yy, len, pp; + byte bit; + const integer offset = 16384; + ; + x1 = x1 / 8; + len = ((x2 / 8) - x1) + 1; + for (yy = y1; yy <= y2; yy ++) { + ; + pp = yy * 80 + x1; + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(mem[0xa000 * offset + pp], mem[0xa000 * pp], len); + } + } } -const integer fx1 = 100; const integer fy1 = 100; const integer fx2 = 135; const integer fy2 = 145; +const integer fx1 = 100; +const integer fy1 = 100; +const integer fx2 = 135; +const integer fy2 = 145; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - setactivepage(1); setfillstyle(7,9); bar(0,0,640,200); - mblit(fx1,fy1,fx2,fy2); - s=imagesize(fx1,fy1,fx2,fy2); getmem(p,s); - getimage(fx1,fy1,fx2,fy2,p); setactivepage(0); - putimage(fx1+100,fy1,p,0); freemem(p,s); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + setactivepage(1); + setfillstyle(7, 9); + bar(0, 0, 640, 200); + mblit(fx1, fy1, fx2, fy2); + s = imagesize(fx1, fy1, fx2, fy2); + getmem(p, s); + getimage(fx1, fy1, fx2, fy2, p); + setactivepage(0); + putimage(fx1 + 100, fy1, p, 0); + freemem(p, s); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index e18c0bea40fe..e5c47744282e 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,122 +30,132 @@ namespace Avalanche { -const string crlf = string('\15')+'\12'; const char eof_ = '\32'; -const array<1,177,char> trip5head = - string("Sprite*.AVD ... data file for Trippancy Five")+crlf+crlf+ - "[Thorsoft relocatable fiveplane sprite image format]"+crlf+crlf+ - "Thomas Thurman was here. ... Have fun!"+crlf+crlf+eof_+ - " * G. I. E. D. ! * "; +const string crlf = string('\15') + '\12'; +const char eof_ = '\32'; +const array<1, 177, char> trip5head = + string("Sprite*.AVD ... data file for Trippancy Five") + crlf + crlf + + "[Thorsoft relocatable fiveplane sprite image format]" + crlf + crlf + + "Thomas Thurman was here. ... Have fun!" + crlf + crlf + eof_ + + " * G. I. E. D. ! * "; -const array<1,4,char> tripid = string('\x30')+'\x1'+'\x75'+'\261'; +const array<1, 4, char> tripid = string('\x30') + '\x1' + '\x75' + '\261'; -const array<1,50,char> trip5foot = crlf+crlf+ - " and that's it! Enjoy the game. "+'\3'+crlf+crlf+ - "\n\n\n\n\n\n\n"+"tt"; +const array<1, 50, char> trip5foot = crlf + crlf + + " and that's it! Enjoy the game. " + '\3' + crlf + crlf + + "\n\n\n\n\n\n\n" + "tt"; struct adxotype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; varying_string<2> sn; adxotype oa; adxtype a; -matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ -array<1,16000,byte> aa; +matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ +array<1, 16000, byte> aa; untyped_file out; integer bigsize; -void copyaoa() -{; - {; - a.name=oa.name; - a.comment="Transferred"; - a.num=oa.num; - a.xl=oa.xl; - a.yl=oa.yl; - a.seq=oa.seq; - a.size=oa.size; - a.fgc=oa.fgc; - a.bgc=oa.bgc; - } +void copyaoa() { + ; + { + ; + a.name = oa.name; + a.comment = "Transferred"; + a.num = oa.num; + a.xl = oa.xl; + a.yl = oa.yl; + a.seq = oa.seq; + a.size = oa.size; + a.fgc = oa.fgc; + a.bgc = oa.bgc; + } } -void setup() -{ - integer gd,gm; -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +void setup() { + integer gd, gm; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); } -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void save() -{ - byte sort,n; - word fv,ff; char r; byte xw; - byte nxl,nyl; - word soa; -; - cleardevice(); - {; - a.xl=45; a.yl=10; a.num=1; a.seq=1; - a.size=imagesize(0,0,a.xl,a.yl); - soa=sizeof(a); - - assign(out,"v:sprite10.avd"); rewrite(out,1); - blockwrite(out,trip5head,177); - blockwrite(out,tripid,4); - blockwrite(out,soa,2); - blockwrite(out,a,soa); - - nxl=a.xl; nyl=a.yl; - xw=nxl / 8; - if ((nxl % 8)>0) xw += 1; - - for( n=1; n <= a.num; n ++) - {; - getimage( 0,0,a.xl,a.yl,aa); - for( fv=0; fv <= nyl; fv ++) - blockwrite(out,aa[5+fv*xw*4],xw); - - getimage(100,0,100+a.xl,a.yl,aa); - blockwrite(out,aa[5],a.size-6); - } - } +void save() { + byte sort, n; + word fv, ff; + char r; + byte xw; + byte nxl, nyl; + word soa; + ; + cleardevice(); + { + ; + a.xl = 45; + a.yl = 10; + a.num = 1; + a.seq = 1; + a.size = imagesize(0, 0, a.xl, a.yl); + soa = sizeof(a); + + assign(out, "v:sprite10.avd"); + rewrite(out, 1); + blockwrite(out, trip5head, 177); + blockwrite(out, tripid, 4); + blockwrite(out, soa, 2); + blockwrite(out, a, soa); + + nxl = a.xl; + nyl = a.yl; + xw = nxl / 8; + if ((nxl % 8) > 0) xw += 1; + + for (n = 1; n <= a.num; n ++) { + ; + getimage(0, 0, a.xl, a.yl, aa); + for (fv = 0; fv <= nyl; fv ++) + blockwrite(out, aa[5 + fv * xw * 4], xw); + + getimage(100, 0, 100 + a.xl, a.yl, aa); + blockwrite(out, aa[5], a.size - 6); + } + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup(); - save(); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup(); + save(); - blockwrite(out,trip5foot,50); - close(out); -return EXIT_SUCCESS; + blockwrite(out, trip5foot, 50); + close(out); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 86dd2b2a9d89..238908cf9f58 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,246 +31,323 @@ namespace Avalanche { -const array > names = {{"Avalot","Dogfood"}}; +const array > names = {{"Avalot", "Dogfood"}}; -array<1,3,byte> old,stones; -array<0,3,0,22,1,7,byte> stonepic; /* picture of Nimstone */ +array<1, 3, byte> old, stones; +array<0, 3, 0, 22, 1, 7, byte> stonepic; /* picture of Nimstone */ byte turns; -boolean dogfoodsturn; byte fv; byte stonesleft; +boolean dogfoodsturn; +byte fv; +byte stonesleft; boolean clicked; -byte row,number; +byte row, number; boolean squeak; -shortint mnum,mrow; +shortint mnum, mrow; registers r; -void resetmouse() -{; - r.ax=0; intr(0x33,r); - squeak=r.ax>0; +void resetmouse() { + ; + r.ax = 0; + intr(0x33, r); + squeak = r.ax > 0; } -void show() -{; - r.ax=1; intr(0x33,r); +void show() { + ; + r.ax = 1; + intr(0x33, r); } -void hide() -{; - r.ax=2; intr(0x33,r); +void hide() { + ; + r.ax = 2; + intr(0x33, r); } -void chalk(integer x,integer y, string z) -{ - const array<0,3,byte> greys = {{0,8,7,15}}; - byte fv; -; - for( fv=0; fv <= 3; fv ++) - {; - setcolor(greys[fv]); - outtextxy(x-fv,y,z); - sound(fv*100*length(z)); delay(3); nosound; delay(30); - } +void chalk(integer x, integer y, string z) { + const array<0, 3, byte> greys = {{0, 8, 7, 15}}; + byte fv; + ; + for (fv = 0; fv <= 3; fv ++) { + ; + setcolor(greys[fv]); + outtextxy(x - fv, y, z); + sound(fv * 100 * length(z)); + delay(3); + nosound; + delay(30); + } } -void setup() -{ - untyped_file f; - integer gd,gm; - byte bit; -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - - assign(f,"c:\\avalot\\nim.avd"); - reset(f,1); - seek(f,41); - for( gm=0; gm <= 22; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,stonepic[bit][gm],7); - } - for( gd=1; gd <= 3; gd ++) - for( gm=0; gm <= 22; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[0xa000*3200+gd*2800+gm*80],7); - } - for( gm=0; gm <= 36; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[0xa000*400+49+gm*80],30); - } - close(f); - - gd=getpixel(0,0); /* clear codes */ - setcolor(4); rectangle(394,50,634,197); - setfillstyle(1,6); bar(395,51,633,196); - rectangle(10,5,380,70); bar(11,6,379,69); - setcolor(15); - outtextxy(475,53,"SCOREBOARD:"); - setcolor(14); - outtextxy(420,63,"Turn:"); - outtextxy(490,63,"Player:"); - outtextxy(570,63,"Move:"); - - for( gd=1; gd <= 3; gd ++) stones[gd]=gd+2; - - turns=0; dogfoodsturn=true; - - chalk(27,15,"Take pieces away with:"); - chalk(77,25,"1) the mouse (click leftmost)"); - chalk(53,35,"or 2) the keyboard:"); - chalk(220,35,string('\30')+'/'+'\31'+": choose row,"); - chalk(164,45,string("+/- or ")+'\33'+'/'+'\32'+": more/fewer,"); - chalk(204,55,"Enter: take stones."); - - row=1; number=1; fillchar(old,sizeof(old),'\0'); stonesleft=12; - resetmouse(); +void setup() { + untyped_file f; + integer gd, gm; + byte bit; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + + assign(f, "c:\\avalot\\nim.avd"); + reset(f, 1); + seek(f, 41); + for (gm = 0; gm <= 22; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, stonepic[bit][gm], 7); + } + for (gd = 1; gd <= 3; gd ++) + for (gm = 0; gm <= 22; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * 3200 + gd * 2800 + gm * 80], 7); + } + for (gm = 0; gm <= 36; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * 400 + 49 + gm * 80], 30); + } + close(f); + + gd = getpixel(0, 0); /* clear codes */ + setcolor(4); + rectangle(394, 50, 634, 197); + setfillstyle(1, 6); + bar(395, 51, 633, 196); + rectangle(10, 5, 380, 70); + bar(11, 6, 379, 69); + setcolor(15); + outtextxy(475, 53, "SCOREBOARD:"); + setcolor(14); + outtextxy(420, 63, "Turn:"); + outtextxy(490, 63, "Player:"); + outtextxy(570, 63, "Move:"); + + for (gd = 1; gd <= 3; gd ++) stones[gd] = gd + 2; + + turns = 0; + dogfoodsturn = true; + + chalk(27, 15, "Take pieces away with:"); + chalk(77, 25, "1) the mouse (click leftmost)"); + chalk(53, 35, "or 2) the keyboard:"); + chalk(220, 35, string('\30') + '/' + '\31' + ": choose row,"); + chalk(164, 45, string("+/- or ") + '\33' + '/' + '\32' + ": more/fewer,"); + chalk(204, 55, "Enter: take stones."); + + row = 1; + number = 1; + fillchar(old, sizeof(old), '\0'); + stonesleft = 12; + resetmouse(); } -void plotstone(byte x,byte y) -{ - byte fv,bit; word ofs; -; - ofs=3200+y*2800+x*8; - for( fv=0; fv <= 22; fv ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(stonepic[bit][fv],mem[0xa000*ofs+fv*80],7); - } +void plotstone(byte x, byte y) { + byte fv, bit; + word ofs; + ; + ofs = 3200 + y * 2800 + x * 8; + for (fv = 0; fv <= 22; fv ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(stonepic[bit][fv], mem[0xa000 * ofs + fv * 80], 7); + } } -void board() -{ - byte fv,ff; -; - for( fv=1; fv <= 3; fv ++) - for( ff=1; ff <= stones[fv]; ff ++) - plotstone(ff,fv); +void board() { + byte fv, ff; + ; + for (fv = 1; fv <= 3; fv ++) + for (ff = 1; ff <= stones[fv]; ff ++) + plotstone(ff, fv); } -void startmove() -{ - varying_string<2> tstr; integer ypos; -; - turns += 1; str(turns,2,tstr); ypos=63+turns*10; - dogfoodsturn=! dogfoodsturn; - chalk(433,ypos,tstr); - chalk(493,ypos,names[dogfoodsturn]); - old=stones; +void startmove() { + varying_string<2> tstr; + integer ypos; + ; + turns += 1; + str(turns, 2, tstr); + ypos = 63 + turns * 10; + dogfoodsturn = ! dogfoodsturn; + chalk(433, ypos, tstr); + chalk(493, ypos, names[dogfoodsturn]); + old = stones; } -void show_changes() -{ - byte fv,ff,fq; -; - chalk(573,63+turns*10,string(chr(64+row))+chr(48+number)); - for( fv=1; fv <= 3; fv ++) - if (old[fv]>stones[fv]) - for( ff=stones[fv]+1; ff <= old[fv]; ff ++) - for( fq=0; fq <= 22; fq ++) fillchar(mem[0xa000*3200+fv*2800+ff*8+fq*80],7,'\0'); - stonesleft -= number; +void show_changes() { + byte fv, ff, fq; + ; + chalk(573, 63 + turns * 10, string(chr(64 + row)) + chr(48 + number)); + for (fv = 1; fv <= 3; fv ++) + if (old[fv] > stones[fv]) + for (ff = stones[fv] + 1; ff <= old[fv]; ff ++) + for (fq = 0; fq <= 22; fq ++) fillchar(mem[0xa000 * 3200 + fv * 2800 + ff * 8 + fq * 80], 7, '\0'); + stonesleft -= number; } void checkmouse(); -static void blip() {; sound(1771); delay(3); nosound; clicked=false; } - -void checkmouse() -{; - {; ax=5; bx=0; } intr(0x33,r); - clicked=r.bx>0; - if (clicked) - {; /* The mouse was clicked. Where? */ - mrow=(dx-38) / 35; - if ((mrow<1) || (mrow>3)) blip(); - mnum=stones[mrow]-(cx / 64)+1; - if ((mnum<1) || (mnum>(unsigned char)stones[mrow])) blip(); - } +static void blip() { + ; + sound(1771); + delay(3); + nosound; + clicked = false; +} + +void checkmouse() { + ; + { + ; + ax = 5; + bx = 0; + } + intr(0x33, r); + clicked = r.bx > 0; + if (clicked) { + ; /* The mouse was clicked. Where? */ + mrow = (dx - 38) / 35; + if ((mrow < 1) || (mrow > 3)) blip(); + mnum = stones[mrow] - (cx / 64) + 1; + if ((mnum < 1) || (mnum > (unsigned char)stones[mrow])) blip(); + } } void takesome(); -static void less() {; if (number>1) number -= 1; } +static void less() { + ; + if (number > 1) number -= 1; +} -void takesome() -{ - char r; byte sr; -; - number=1; - do { - do { - sr=stones[row]; - if (sr==0) {; row=row % 3+1; number=1; } - } while (!(sr!=0)); - if (number>sr) number=sr; - setcolor(1); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); - /* Wait for choice */ - show(); - do { checkmouse(); } while (!(keypressed() || clicked)); - if (keypressed()) r=upcase(readkey()); - hide(); - - setcolor(0); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); - - if (clicked) - {; - number=mnum; - row=mrow; - return; - } else - {; - switch (r) { - case '\0': switch (readkey()) { - case 'H': if (row>1) row -= 1; break; /* Up */ - case 'P': if (row<3) row += 1; break; /* Down */ - case 'K': number += 1; break; - case 'M': less(); break; - case 'I': row=1; break; /* PgUp */ - case 'Q': row=3; break; /* PgDn */ - case 'G': number=5; break; /* Home- check routine will knock this down to size */ - case 'O': number=1; break; /* End */ - } - break; - case '+': number += 1; break; - case '-': less(); break; - case RANGE_3('A','C'): row=ord(r)-64; - break; - case RANGE_5('1','5'): number=ord(r)-48; - break; - case '\15': return; break; /* Enter was pressed */ - } - } - } while (!false); +void takesome() { + char r; + byte sr; + ; + number = 1; + do { + do { + sr = stones[row]; + if (sr == 0) { + ; + row = row % 3 + 1; + number = 1; + } + } while (!(sr != 0)); + if (number > sr) number = sr; + setcolor(1); + rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); + /* Wait for choice */ + show(); + do { + checkmouse(); + } while (!(keypressed() || clicked)); + if (keypressed()) r = upcase(readkey()); + hide(); + + setcolor(0); + rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); + + if (clicked) { + ; + number = mnum; + row = mrow; + return; + } else { + ; + switch (r) { + case '\0': + switch (readkey()) { + case 'H': + if (row > 1) row -= 1; + break; /* Up */ + case 'P': + if (row < 3) row += 1; + break; /* Down */ + case 'K': + number += 1; + break; + case 'M': + less(); + break; + case 'I': + row = 1; + break; /* PgUp */ + case 'Q': + row = 3; + break; /* PgDn */ + case 'G': + number = 5; + break; /* Home- check routine will knock this down to size */ + case 'O': + number = 1; + break; /* End */ + } + break; + case '+': + number += 1; + break; + case '-': + less(); + break; + case RANGE_3('A', 'C'): + row = ord(r) - 64; + break; + case RANGE_5('1', '5'): + number = ord(r) - 48; + break; + case '\15': + return; + break; /* Enter was pressed */ + } + } + } while (!false); } -void endofgame() -{ - char rr; -; - chalk(595,63+turns*10,"Wins!"); - outtextxy(100,190,"- - - Press any key... - - -"); - while (keypressed()) rr=readkey(); - do { ax=5; bx=0; intr(0x33,r); } while (!(keypressed() || (bx>0))); - if (keypressed()) rr=readkey(); +void endofgame() { + char rr; + ; + chalk(595, 63 + turns * 10, "Wins!"); + outtextxy(100, 190, "- - - Press any key... - - -"); + while (keypressed()) rr = readkey(); + do { + ax = 5; + bx = 0; + intr(0x33, r); + } while (!(keypressed() || (bx > 0))); + if (keypressed()) rr = readkey(); } void dogfood(); - /* AI procedure to play the game */ -const matrix<1,3,1,2,byte> other = {{{{2,3}},{{1,3}},{{1,2}}}}; +/* AI procedure to play the game */ +const matrix<1, 3, 1, 2, byte> other = {{{{2, 3}}, {{1, 3}}, {{1, 2}}}}; -static byte live,fv,ff,matches,thisone,where; +static byte live, fv, ff, matches, thisone, where; -static array<1,3,byte> r,sr; -static array<1,3,boolean> inap; +static array<1, 3, byte> r, sr; +static array<1, 3, boolean> inap; static boolean lmo; /* Let Me Out! */ @@ -278,131 +355,167 @@ static byte ooo; /* Odd one out */ static boolean find(byte x) - /* This gives True if there's a pile with x stones in. */ +/* This gives True if there's a pile with x stones in. */ { - boolean q; byte p; -boolean find_result; -; - q=false; - for( p=1; p <= 3; p ++) if (stones[p]==x) {; q=true; inap[p]=true; } - find_result=q; -return find_result; + boolean q; + byte p; + boolean find_result; + ; + q = false; + for (p = 1; p <= 3; p ++) if (stones[p] == x) { + ; + q = true; + inap[p] = true; + } + find_result = q; + return find_result; } -static void find_ap(byte start,byte stepsize) -{ - byte ff; -; - matches=0; - fillchar(inap,sizeof(inap),'\0'); /* blank 'em all */ - for( ff=0; ff <= 2; ff ++) if (find(start+ff*stepsize)) matches += 1; - else thisone=ff; - - /* Now.. Matches must be 0, 1, 2, or 3. - 0/1 mean there are no A.P.s here, so we'll keep looking, - 2 means there is a potential A.P. that we can create (ideal!), and - 3 means that we're already in an A.P. (Trouble!). */ - - switch (matches) { - case 2: {; - for( ff=1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ - if (! inap[ff]) ooo=ff; - if (stones[ooo]>(start+thisone*stepsize)) /* check it's possible! */ - {; /* create an A.P. */ - row=ooo; /* already calculated */ - /* Start+thisone*stepsize will give the amount we SHOULD have here. */ - number=stones[row]-(start+thisone*stepsize); lmo=true; return; - } - } - break; - case 3: {; /* we're actually IN an A.P! Trouble! Oooh dear. */ - row=r[3]; number=1; lmo=true; return; /* take 1 from the largest pile */ - } - break; - } +static void find_ap(byte start, byte stepsize) { + byte ff; + ; + matches = 0; + fillchar(inap, sizeof(inap), '\0'); /* blank 'em all */ + for (ff = 0; ff <= 2; ff ++) if (find(start + ff * stepsize)) matches += 1; + else thisone = ff; + + /* Now.. Matches must be 0, 1, 2, or 3. + 0/1 mean there are no A.P.s here, so we'll keep looking, + 2 means there is a potential A.P. that we can create (ideal!), and + 3 means that we're already in an A.P. (Trouble!). */ + + switch (matches) { + case 2: { + ; + for (ff = 1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ + if (! inap[ff]) ooo = ff; + if (stones[ooo] > (start + thisone * stepsize)) { /* check it's possible! */ + ; /* create an A.P. */ + row = ooo; /* already calculated */ + /* Start+thisone*stepsize will give the amount we SHOULD have here. */ + number = stones[row] - (start + thisone * stepsize); + lmo = true; + return; + } + } + break; + case 3: { + ; /* we're actually IN an A.P! Trouble! Oooh dear. */ + row = r[3]; + number = 1; + lmo = true; + return; /* take 1 from the largest pile */ + } + break; + } } -void dogfood() -{ - boolean sorted; byte temp; - -; - live=0; lmo=false; - for( fv=1; fv <= 3; fv ++) - {; - if (stones[fv]>0) - {; - live += 1; - r[live]=fv; sr[live]=stones[fv]; - } - } - switch (live) { - case 1: /* Only one is free- so take 'em all */ - {; row=r[1]; number=stones[r[1]]; return; } - break; - case 2: /* Two are free- make them equal */ - {; - if (sr[1]>sr[2]) - {; row=r[1]; number=sr[1]-sr[2]; return; } else /* T > b */ - if (sr[1] t */ - {; row=r[1]; number=1; return; } /* B = t... oh no, we've lost! */ - } - break; - case 3: /* Ho hum... this'll be difficult! */ - {; - /* There are three possible courses of action when we have 3 lines left: - 1) Look for 2 equal lines, then take the odd one out. - 2) Look for A.P.s, and capitalise on them. - 3) Go any old where. */ - - for( fv=1; fv <= 3; fv ++) /* Look for 2 equal lines */ - if (stones[other[fv][1]]==stones[other[fv][2]]) - {; - row=fv; /* this row */ number=stones[fv]; /* all of 'em */ return; - } - - do { - sorted=true; - for( fv=1; fv <= 2; fv ++) - if (sr[fv]>sr[fv+1]) - {; - temp=sr[fv+1]; sr[fv+1]=sr[fv]; sr[fv]=temp; - temp= r[fv+1]; r[fv+1]= r[fv]; r[fv]=temp; - sorted=false; - } - } while (!sorted); - /* Now we look for A.P.s ... */ - for( fv=1; fv <= 3; fv ++) - {; - find_ap(fv,1); /* there are 3 "1"s */ - if (lmo) return; /* cut-out */ - } - find_ap(1,2); /* only "2" possible */ - if (lmo) return; - - /* A.P. search must have failed- use the default move. */ - row=r[3]; number=1; return; - } - break; - } +void dogfood() { + boolean sorted; + byte temp; + + ; + live = 0; + lmo = false; + for (fv = 1; fv <= 3; fv ++) { + ; + if (stones[fv] > 0) { + ; + live += 1; + r[live] = fv; + sr[live] = stones[fv]; + } + } + switch (live) { + case 1: { /* Only one is free- so take 'em all */ + ; + row = r[1]; + number = stones[r[1]]; + return; + } + break; + case 2: { /* Two are free- make them equal */ + ; + if (sr[1] > sr[2]) { + ; + row = r[1]; + number = sr[1] - sr[2]; + return; + } else /* T > b */ + if (sr[1] < sr[2]) { + ; + row = r[2]; + number = sr[2] - sr[1]; + return; + } else { /* B > t */ + ; /* B = t... oh no, we've lost! */ + row = r[1]; + number = 1; + return; + } + } + break; + case 3: { /* Ho hum... this'll be difficult! */ + ; + /* There are three possible courses of action when we have 3 lines left: + 1) Look for 2 equal lines, then take the odd one out. + 2) Look for A.P.s, and capitalise on them. + 3) Go any old where. */ + + for (fv = 1; fv <= 3; fv ++) /* Look for 2 equal lines */ + if (stones[other[fv][1]] == stones[other[fv][2]]) { + ; + row = fv; /* this row */ number = stones[fv]; /* all of 'em */ return; + } + + do { + sorted = true; + for (fv = 1; fv <= 2; fv ++) + if (sr[fv] > sr[fv + 1]) { + ; + temp = sr[fv + 1]; + sr[fv + 1] = sr[fv]; + sr[fv] = temp; + temp = r[fv + 1]; + r[fv + 1] = r[fv]; + r[fv] = temp; + sorted = false; + } + } while (!sorted); + /* Now we look for A.P.s ... */ + for (fv = 1; fv <= 3; fv ++) { + ; + find_ap(fv, 1); /* there are 3 "1"s */ + if (lmo) return; /* cut-out */ + } + find_ap(1, 2); /* only "2" possible */ + if (lmo) return; + + /* A.P. search must have failed- use the default move. */ + row = r[3]; + number = 1; + return; + } + break; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup(); - board(); - do { - startmove(); - if (dogfoodsturn) dogfood(); else takesome(); - stones[row] -= number; - show_changes(); - } while (!(stonesleft==0)); - endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup(); + board(); + do { + startmove(); + if (dogfoodsturn) dogfood(); + else takesome(); + stones[row] -= number; + show_changes(); + } while (!(stonesleft == 0)); + endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index a81d69fd2455..9464d64d8e31 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,93 +29,118 @@ namespace Avalanche { -const string header = string("Datafile for Avalot, copyright (c) 1992.")+'\32'; +const string header = string("Datafile for Avalot, copyright (c) 1992.") + '\32'; -integer gd,gm,x,y; +integer gd, gm, x, y; untyped_file f; byte bit; -void plot(char ch, byte x) -{; - setcolor(blue); outtextxy(x*80+4,0,ch); outtextxy(x*80+10,0,ch); - setcolor(lightblue); outtextxy(x*80+5,0,ch); outtextxy(x*80+9,0,ch); - setcolor(darkgray); outtextxy(x*80+6,0,ch); outtextxy(x*80+8,0,ch); - setcolor(yellow); outtextxy(x*80+7,0,ch); +void plot(char ch, byte x) { + ; + setcolor(blue); + outtextxy(x * 80 + 4, 0, ch); + outtextxy(x * 80 + 10, 0, ch); + setcolor(lightblue); + outtextxy(x * 80 + 5, 0, ch); + outtextxy(x * 80 + 9, 0, ch); + setcolor(darkgray); + outtextxy(x * 80 + 6, 0, ch); + outtextxy(x * 80 + 8, 0, ch); + setcolor(yellow); + outtextxy(x * 80 + 7, 0, ch); } -void load() -{ - byte z; - array<1,4,pointer> a; - varying_string<12> check; - untyped_file f; word s; -; - assign(f,"c:\\avalot\\nimstone.avd"); reset(f,1); - seek(f,85); z=3; - s=imagesize(0,0,getmaxx(),75); - getmem(a[z],s); - blockread(f,a[z],s); - putimage(0,7,a[z],0); - freemem(a[z],s); close(f); +void load() { + byte z; + array<1, 4, pointer> a; + varying_string<12> check; + untyped_file f; + word s; + ; + assign(f, "c:\\avalot\\nimstone.avd"); + reset(f, 1); + seek(f, 85); + z = 3; + s = imagesize(0, 0, getmaxx(), 75); + getmem(a[z], s); + blockread(f, a[z], s); + putimage(0, 7, a[z], 0); + freemem(a[z], s); + close(f); } -void spludge(integer x,integer y, string z) -{ - shortint dx,dy; -; - setcolor(15); - for( dx=-1; dx <= 1; dx ++) - for( dy=-1; dy <= 1; dy ++) - outtextxy(x+dx,y+dy,z); - setcolor(0); - outtextxy(x,y,z); +void spludge(integer x, integer y, string z) { + shortint dx, dy; + ; + setcolor(15); + for (dx = -1; dx <= 1; dx ++) + for (dy = -1; dy <= 1; dy ++) + outtextxy(x + dx, y + dy, z); + setcolor(0); + outtextxy(x, y, z); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - load(); - settextstyle(4,0,0); setusercharsize(2,1,1,1); - plot('A',1); - plot('B',2); - plot('C',3); -/* rectangle(gd*80,7,56+gd*80,29); */ - - setfillstyle(1,1); setcolor(9); - fillellipse( 97,104,6,4); fillellipse(321,104,6,4); - fillellipse( 97,131,6,4); fillellipse(321,131,6,4); - bar(97,100,321,134); - bar(92,104,326,131); - setfillstyle(1,9); - bar(91,103, 91,131); bar(327,104,327,131); - bar(98, 99,321, 99); bar( 97,135,321,135); - - settextstyle(2,0,0); setusercharsize(20,10,11,10); - spludge( 99,100,"The Ancient Game of"); - settextstyle(1,0,0); setusercharsize(40,10,10,10); - spludge( 99,105,"NIM"); - - /* now save it all! */ - - assign(f,"c:\\avalot\\nim.avd"); - rewrite(f,1); - blockwrite(f,header[1],length(header)); - for( gd=0; gd <= 3; gd ++) - for( gm=7; gm <= 29; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,mem[0xa000*gd*10+gm*80],7); - } - for( gm=99; gm <= 135; gm ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,mem[0xa000*11+gm*80],30); - } - close(f); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + load(); + settextstyle(4, 0, 0); + setusercharsize(2, 1, 1, 1); + plot('A', 1); + plot('B', 2); + plot('C', 3); + /* rectangle(gd*80,7,56+gd*80,29); */ + + setfillstyle(1, 1); + setcolor(9); + fillellipse(97, 104, 6, 4); + fillellipse(321, 104, 6, 4); + fillellipse(97, 131, 6, 4); + fillellipse(321, 131, 6, 4); + bar(97, 100, 321, 134); + bar(92, 104, 326, 131); + setfillstyle(1, 9); + bar(91, 103, 91, 131); + bar(327, 104, 327, 131); + bar(98, 99, 321, 99); + bar(97, 135, 321, 135); + + settextstyle(2, 0, 0); + setusercharsize(20, 10, 11, 10); + spludge(99, 100, "The Ancient Game of"); + settextstyle(1, 0, 0); + setusercharsize(40, 10, 10, 10); + spludge(99, 105, "NIM"); + + /* now save it all! */ + + assign(f, "c:\\avalot\\nim.avd"); + rewrite(f, 1); + blockwrite(f, header[1], length(header)); + for (gd = 0; gd <= 3; gd ++) + for (gm = 7; gm <= 29; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, mem[0xa000 * gd * 10 + gm * 80], 7); + } + for (gm = 99; gm <= 135; gm ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, mem[0xa000 * 11 + gm * 80], 30); + } + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp index cfec877c332f..785dbe6759ed 100644 --- a/engines/avalanche/nimunit.cpp +++ b/engines/avalanche/nimunit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,249 +39,308 @@ namespace Avalanche { -const array > names = {{"Avalot","Dogfood"}}; +const array > names = {{"Avalot", "Dogfood"}}; -array<1,3,byte> old,stones; -array<0,3,0,22,1,7,byte> stonepic; /* picture of Nimstone */ +array<1, 3, byte> old, stones; +array<0, 3, 0, 22, 1, 7, byte> stonepic; /* picture of Nimstone */ byte turns; -boolean dogfoodsturn; byte fv; byte stonesleft; +boolean dogfoodsturn; +byte fv; +byte stonesleft; boolean clicked; -byte row,number; +byte row, number; boolean squeak; -shortint mnum,mrow; - -void chalk(integer x,integer y, string z) -{ - const array<0,3,byte> greys = {{0,8,7,15}}; - byte fv; - - for( fv=0; fv <= 3; fv ++) - { - setcolor(greys[fv]); - outtextxy(x-fv,y,z); - sound(fv*100*length(z)); delay(3); nosound; delay(30); - } +shortint mnum, mrow; + +void chalk(integer x, integer y, string z) { + const array<0, 3, byte> greys = {{0, 8, 7, 15}}; + byte fv; + + for (fv = 0; fv <= 3; fv ++) { + setcolor(greys[fv]); + outtextxy(x - fv, y, z); + sound(fv * 100 * length(z)); + delay(3); + nosound; + delay(30); + } } -void setup() -{ - const integer page3 = 0xac00; - byte gd,gm; - untyped_file f; - byte bit; - - setactivepage(3); - setvisualpage(3); - cleardevice(); - dawn(); - - assign(f,"nim.avd"); - reset(f,1); - seek(f,41); - for( gm=0; gm <= 22; gm ++) - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,stonepic[bit][gm],7); - } - for( gd=1; gd <= 3; gd ++) - for( gm=0; gm <= 22; gm ++) - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[page3*3200+gd*2800+gm*80],7); - } - for( gm=0; gm <= 36; gm ++) - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[page3*400+49+gm*80],30); - } - close(f); - - gd=getpixel(0,0); /* clear codes */ - setcolor(4); rectangle(394,50,634,197); - setfillstyle(1,6); bar(395,51,633,196); - rectangle(10,5,380,70); bar(11,6,379,69); - setcolor(15); - outtextxy(475,53,"SCOREBOARD:"); - setcolor(14); - outtextxy(420,63,"Turn:"); - outtextxy(490,63,"Player:"); - outtextxy(570,63,"Move:"); - - for( gd=1; gd <= 3; gd ++) stones[gd]=gd+2; - - turns=0; dogfoodsturn=true; - - chalk(27,15,"Take pieces away with:"); - chalk(77,25,"1) the mouse (click leftmost)"); - chalk(53,35,"or 2) the keyboard:"); - chalk(220,35,string('\30')+'/'+'\31'+": choose row,"); - chalk(164,45,string("+/- or ")+'\33'+'/'+'\32'+": more/fewer,"); - chalk(204,55,"Enter: take stones."); - - row=1; number=1; fillchar(old,sizeof(old),'\0'); stonesleft=12; - - /* Set up mouse. */ - off_virtual(); - oncandopageswap=false; - - setactivepage(3); - setvisualpage(3); +void setup() { + const integer page3 = 0xac00; + byte gd, gm; + untyped_file f; + byte bit; + + setactivepage(3); + setvisualpage(3); + cleardevice(); + dawn(); + + assign(f, "nim.avd"); + reset(f, 1); + seek(f, 41); + for (gm = 0; gm <= 22; gm ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, stonepic[bit][gm], 7); + } + for (gd = 1; gd <= 3; gd ++) + for (gm = 0; gm <= 22; gm ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[page3 * 3200 + gd * 2800 + gm * 80], 7); + } + for (gm = 0; gm <= 36; gm ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[page3 * 400 + 49 + gm * 80], 30); + } + close(f); + + gd = getpixel(0, 0); /* clear codes */ + setcolor(4); + rectangle(394, 50, 634, 197); + setfillstyle(1, 6); + bar(395, 51, 633, 196); + rectangle(10, 5, 380, 70); + bar(11, 6, 379, 69); + setcolor(15); + outtextxy(475, 53, "SCOREBOARD:"); + setcolor(14); + outtextxy(420, 63, "Turn:"); + outtextxy(490, 63, "Player:"); + outtextxy(570, 63, "Move:"); + + for (gd = 1; gd <= 3; gd ++) stones[gd] = gd + 2; + + turns = 0; + dogfoodsturn = true; + + chalk(27, 15, "Take pieces away with:"); + chalk(77, 25, "1) the mouse (click leftmost)"); + chalk(53, 35, "or 2) the keyboard:"); + chalk(220, 35, string('\30') + '/' + '\31' + ": choose row,"); + chalk(164, 45, string("+/- or ") + '\33' + '/' + '\32' + ": more/fewer,"); + chalk(204, 55, "Enter: take stones."); + + row = 1; + number = 1; + fillchar(old, sizeof(old), '\0'); + stonesleft = 12; + + /* Set up mouse. */ + off_virtual(); + oncandopageswap = false; + + setactivepage(3); + setvisualpage(3); } -void plotstone(byte x,byte y) -{ - byte fv,bit; word ofs; - - ofs=3200+y*2800+x*8; - for( fv=0; fv <= 22; fv ++) - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(stonepic[bit][fv],mem[0xac00*ofs+fv*80],7); - } +void plotstone(byte x, byte y) { + byte fv, bit; + word ofs; + + ofs = 3200 + y * 2800 + x * 8; + for (fv = 0; fv <= 22; fv ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(stonepic[bit][fv], mem[0xac00 * ofs + fv * 80], 7); + } } -void board() -{ - byte fv,ff; +void board() { + byte fv, ff; - for( fv=1; fv <= 3; fv ++) - for( ff=1; ff <= stones[fv]; ff ++) - plotstone(ff,fv); + for (fv = 1; fv <= 3; fv ++) + for (ff = 1; ff <= stones[fv]; ff ++) + plotstone(ff, fv); } -void startmove() -{ - varying_string<2> tstr; integer ypos; - - turns += 1; str(turns,2,tstr); ypos=63+turns*10; - dogfoodsturn=! dogfoodsturn; - chalk(433,ypos,tstr); - chalk(493,ypos,names[dogfoodsturn]); - old=stones; +void startmove() { + varying_string<2> tstr; + integer ypos; + + turns += 1; + str(turns, 2, tstr); + ypos = 63 + turns * 10; + dogfoodsturn = ! dogfoodsturn; + chalk(433, ypos, tstr); + chalk(493, ypos, names[dogfoodsturn]); + old = stones; } -void show_changes() -{ - byte fv,ff,fq; varying_string<2> move; +void show_changes() { + byte fv, ff, fq; + varying_string<2> move; - move=string(chr(64+row))+chr(48+number); - chalk(573,63+turns*10,move); - log_aside(names[dogfoodsturn]+" plays "+move+'.'); + move = string(chr(64 + row)) + chr(48 + number); + chalk(573, 63 + turns * 10, move); + log_aside(names[dogfoodsturn] + " plays " + move + '.'); - for( fv=1; fv <= 3; fv ++) - if (old[fv]>stones[fv]) - for( ff=stones[fv]+1; ff <= old[fv]; ff ++) - for( fq=0; fq <= 22; fq ++) fillchar(mem[0xac00*3200+fv*2800+ff*8+fq*80],7,'\0'); - stonesleft -= number; + for (fv = 1; fv <= 3; fv ++) + if (old[fv] > stones[fv]) + for (ff = stones[fv] + 1; ff <= old[fv]; ff ++) + for (fq = 0; fq <= 22; fq ++) fillchar(mem[0xac00 * 3200 + fv * 2800 + ff * 8 + fq * 80], 7, '\0'); + stonesleft -= number; } void checkmouse(); -static void blip() { note(1771); delay(3); nosound; clicked=false; } +static void blip() { + note(1771); + delay(3); + nosound; + clicked = false; +} -void checkmouse() -{ - xycheck(); /* Check the mouse */ - clicked=keystatus>0; - if (clicked) - { - void& with = r; - /* The mouse was clicked. Where? */ - mrow=(my-38) / 35; - if ((mrow<1) || (mrow>3)) blip(); - mnum=stones[mrow]-(mx / 64)+1; - if ((mnum<1) || (mnum>(unsigned char)stones[mrow])) blip(); - } +void checkmouse() { + xycheck(); /* Check the mouse */ + clicked = keystatus > 0; + if (clicked) { + void &with = r; + /* The mouse was clicked. Where? */ + mrow = (my - 38) / 35; + if ((mrow < 1) || (mrow > 3)) blip(); + mnum = stones[mrow] - (mx / 64) + 1; + if ((mnum < 1) || (mnum > (unsigned char)stones[mrow])) blip(); + } } void takesome(); -static void less() { if (number>1) number -= 1; } - -void takesome() -{ - char r; byte sr; - - number=1; - do { - do { - sr=stones[row]; - if (sr==0) { row=row % 3+1; number=1; } - } while (!(sr!=0)); - if (number>sr) number=sr; - setcolor(1); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); - /* Wait for choice */ - on(); - do { checkmouse(); } while (!(keypressed() || clicked)); - if (keypressed()) r=upcase(readkey()); - off(); - - setcolor(0); rectangle(63+(sr-number)*64,38+35*row,54+sr*64,63+35*row); - - if (clicked) - { - number=mnum; - row=mrow; - return; - } else - { - switch (r) { - case '\0': switch (readkey()) { - case 'H': if (row>1) row -= 1; break; /* Up */ - case 'P': if (row<3) row += 1; break; /* Down */ - case 'K': number += 1; break; - case 'M': less(); break; - case 'I': row=1; break; /* PgUp */ - case 'Q': row=3; break; /* PgDn */ - case 'G': number=5; break; /* Home- check routine will knock this down to size */ - case 'O': number=1; break; /* End */ - } - break; - case '+': number += 1; break; - case '-': less(); break; - case RANGE_3('A','C'): row=ord(r)-64; - break; - case RANGE_5('1','5'): number=ord(r)-48; - break; - case '\15': return; break; /* Enter was pressed */ - } - } - } while (!false); +static void less() { + if (number > 1) number -= 1; } -void endofgame() -{ - char rr; - - chalk(595,63+turns*10,"Wins!"); - outtextxy(100,190,"- - - Press any key... - - -"); - while (keypressed()) rr=readkey(); - do { check(); } while (!(mpress==0)); - - { void& with = r; do { check(); } while (!(keypressed() || (mrelease>0)));} - if (keypressed()) rr=readkey(); +void takesome() { + char r; + byte sr; + + number = 1; + do { + do { + sr = stones[row]; + if (sr == 0) { + row = row % 3 + 1; + number = 1; + } + } while (!(sr != 0)); + if (number > sr) number = sr; + setcolor(1); + rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); + /* Wait for choice */ + on(); + do { + checkmouse(); + } while (!(keypressed() || clicked)); + if (keypressed()) r = upcase(readkey()); + off(); + + setcolor(0); + rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); + + if (clicked) { + number = mnum; + row = mrow; + return; + } else { + switch (r) { + case '\0': + switch (readkey()) { + case 'H': + if (row > 1) row -= 1; + break; /* Up */ + case 'P': + if (row < 3) row += 1; + break; /* Down */ + case 'K': + number += 1; + break; + case 'M': + less(); + break; + case 'I': + row = 1; + break; /* PgUp */ + case 'Q': + row = 3; + break; /* PgDn */ + case 'G': + number = 5; + break; /* Home- check routine will knock this down to size */ + case 'O': + number = 1; + break; /* End */ + } + break; + case '+': + number += 1; + break; + case '-': + less(); + break; + case RANGE_3('A', 'C'): + row = ord(r) - 64; + break; + case RANGE_5('1', '5'): + number = ord(r) - 48; + break; + case '\15': + return; + break; /* Enter was pressed */ + } + } + } while (!false); +} - mousepage(cp); - off(); - on_virtual(); +void endofgame() { + char rr; + + chalk(595, 63 + turns * 10, "Wins!"); + outtextxy(100, 190, "- - - Press any key... - - -"); + while (keypressed()) rr = readkey(); + do { + check(); + } while (!(mpress == 0)); + + { + void &with = r; + do { + check(); + } while (!(keypressed() || (mrelease > 0))); + } + if (keypressed()) rr = readkey(); + + mousepage(cp); + off(); + on_virtual(); } void dogfood(); - /* AI procedure to play the game */ -const matrix<1,3,1,2,byte> other = {{{{2,3}},{{1,3}},{{1,2}}}}; +/* AI procedure to play the game */ +const matrix<1, 3, 1, 2, byte> other = {{{{2, 3}}, {{1, 3}}, {{1, 2}}}}; -static byte live,fv,ff,matches,thisone,where; +static byte live, fv, ff, matches, thisone, where; -static array<1,3,byte> r,sr; -static array<1,3,boolean> inap; +static array<1, 3, byte> r, sr; +static array<1, 3, boolean> inap; static boolean lmo; /* Let Me Out! */ @@ -289,183 +348,206 @@ static byte ooo; /* Odd one out */ static boolean find(byte x) - /* This gives True if there's a pile with x stones in. */ +/* This gives True if there's a pile with x stones in. */ { - boolean q; byte p; - - boolean find_result; - q=false; - for( p=1; p <= 3; p ++) if (stones[p]==x) { q=true; inap[p]=true; } - find_result=q; - return find_result; + boolean q; + byte p; + + boolean find_result; + q = false; + for (p = 1; p <= 3; p ++) if (stones[p] == x) { + q = true; + inap[p] = true; + } + find_result = q; + return find_result; } -static void find_ap(byte start,byte stepsize) -{ - byte ff; - - matches=0; - fillchar(inap,sizeof(inap),'\0'); /* blank 'em all */ - for( ff=0; ff <= 2; ff ++) if (find(start+ff*stepsize)) matches += 1; - else thisone=ff; - - /* Now.. Matches must be 0, 1, 2, or 3. - 0/1 mean there are no A.P.s here, so we'll keep looking, - 2 means there is a potential A.P. that we can create (ideal!), and - 3 means that we're already in an A.P. (Trouble!). */ - - switch (matches) { - case 2: { - for( ff=1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ - if (! inap[ff]) ooo=ff; - if (stones[ooo]>(start+thisone*stepsize)) /* check it's possible! */ - { /* create an A.P. */ - row=ooo; /* already calculated */ - /* Start+thisone*stepsize will give the amount we SHOULD have here. */ - number=stones[row]-(start+thisone*stepsize); lmo=true; return; - } - } - break; - case 3: { /* we're actually IN an A.P! Trouble! Oooh dear. */ - row=r[3]; number=1; lmo=true; return; /* take 1 from the largest pile */ - } - break; - } +static void find_ap(byte start, byte stepsize) { + byte ff; + + matches = 0; + fillchar(inap, sizeof(inap), '\0'); /* blank 'em all */ + for (ff = 0; ff <= 2; ff ++) if (find(start + ff * stepsize)) matches += 1; + else thisone = ff; + + /* Now.. Matches must be 0, 1, 2, or 3. + 0/1 mean there are no A.P.s here, so we'll keep looking, + 2 means there is a potential A.P. that we can create (ideal!), and + 3 means that we're already in an A.P. (Trouble!). */ + + switch (matches) { + case 2: { + for (ff = 1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ + if (! inap[ff]) ooo = ff; + if (stones[ooo] > (start + thisone * stepsize)) { /* check it's possible! */ + /* create an A.P. */ + row = ooo; /* already calculated */ + /* Start+thisone*stepsize will give the amount we SHOULD have here. */ + number = stones[row] - (start + thisone * stepsize); + lmo = true; + return; + } + } + break; + case 3: { /* we're actually IN an A.P! Trouble! Oooh dear. */ + row = r[3]; + number = 1; + lmo = true; + return; /* take 1 from the largest pile */ + } + break; + } } -void dogfood() -{ - boolean sorted; byte temp; - - - live=0; lmo=false; - for( fv=1; fv <= 3; fv ++) - { - if (stones[fv]>0) - { - live += 1; - r[live]=fv; sr[live]=stones[fv]; - } - } - switch (live) { - case 1: /* Only one is free- so take 'em all */ - { row=r[1]; number=stones[r[1]]; return; } - break; - case 2: /* Two are free- make them equal */ - { - if (sr[1]>sr[2]) - { row=r[1]; number=sr[1]-sr[2]; return; } else /* T > b */ - if (sr[1] t */ - { row=r[1]; number=1; return; } /* B = t... oh no, we've lost! */ - } - break; - case 3: /* Ho hum... this'll be difficult! */ - { - /* There are three possible courses of action when we have 3 lines left: - 1) Look for 2 equal lines, then take the odd one out. - 2) Look for A.P.s, and capitalise on them. - 3) Go any old where. */ - - for( fv=1; fv <= 3; fv ++) /* Look for 2 equal lines */ - if (stones[other[fv][1]]==stones[other[fv][2]]) - { - row=fv; /* this row */ number=stones[fv]; /* all of 'em */ return; - } - - do { - sorted=true; - for( fv=1; fv <= 2; fv ++) - if (sr[fv]>sr[fv+1]) - { - temp=sr[fv+1]; sr[fv+1]=sr[fv]; sr[fv]=temp; - temp= r[fv+1]; r[fv+1]= r[fv]; r[fv]=temp; - sorted=false; - } - } while (!sorted); - /* Now we look for A.P.s ... */ - for( fv=1; fv <= 3; fv ++) - { - find_ap(fv,1); /* there are 3 "1"s */ - if (lmo) return; /* cut-out */ - } - find_ap(1,2); /* only "2" possible */ - if (lmo) return; - - /* A.P. search must have failed- use the default move. */ - row=r[3]; number=1; return; - } - break; - } +void dogfood() { + boolean sorted; + byte temp; + + + live = 0; + lmo = false; + for (fv = 1; fv <= 3; fv ++) { + if (stones[fv] > 0) { + live += 1; + r[live] = fv; + sr[live] = stones[fv]; + } + } + switch (live) { + case 1: { /* Only one is free- so take 'em all */ + row = r[1]; + number = stones[r[1]]; + return; + } + break; + case 2: { /* Two are free- make them equal */ + if (sr[1] > sr[2]) { + row = r[1]; + number = sr[1] - sr[2]; + return; + } else /* T > b */ + if (sr[1] < sr[2]) { + row = r[2]; + number = sr[2] - sr[1]; + return; + } else { /* B > t */ + row = r[1]; /* B = t... oh no, we've lost! */ + number = 1; + return; + } + } + break; + case 3: { /* Ho hum... this'll be difficult! */ + /* There are three possible courses of action when we have 3 lines left: + 1) Look for 2 equal lines, then take the odd one out. + 2) Look for A.P.s, and capitalise on them. + 3) Go any old where. */ + + for (fv = 1; fv <= 3; fv ++) /* Look for 2 equal lines */ + if (stones[other[fv][1]] == stones[other[fv][2]]) { + row = fv; /* this row */ number = stones[fv]; /* all of 'em */ return; + } + + do { + sorted = true; + for (fv = 1; fv <= 2; fv ++) + if (sr[fv] > sr[fv + 1]) { + temp = sr[fv + 1]; + sr[fv + 1] = sr[fv]; + sr[fv] = temp; + temp = r[fv + 1]; + r[fv + 1] = r[fv]; + r[fv] = temp; + sorted = false; + } + } while (!sorted); + /* Now we look for A.P.s ... */ + for (fv = 1; fv <= 3; fv ++) { + find_ap(fv, 1); /* there are 3 "1"s */ + if (lmo) return; /* cut-out */ + } + find_ap(1, 2); /* only "2" possible */ + if (lmo) return; + + /* A.P. search must have failed- use the default move. */ + row = r[3]; + number = 1; + return; + } + break; + } } void play_nim() /* Plays the game. Only procedure in this unit to be declared in the interface section. */ { - byte groi; - - if (dna.wonnim) - { /* Already won the game. */ - dixi('Q',6); - return; - } - - if (! dna.asked_dogfood_about_nim) - { - dixi('q',84); - return; - } - - dixi('Q',3); - dna.playednim += 1; - dusk(); - oncandopageswap=false; - copypage(3,1-cp); /* Store old screen. */ groi=getpixel(0,0); - off(); - - setup(); - board(); - on(); - mousepage(3); - - do { - startmove(); - if (dogfoodsturn) dogfood(); else takesome(); - stones[row] -= number; - show_changes(); - } while (!(stonesleft==0)); - endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ - - dusk(); off(); - oncandopageswap=true; - copypage(1-cp,3); /* Restore old screen. */ groi=getpixel(0,0); - on(); dawn(); - - if (dogfoodsturn) - { /* Dogfood won - as usual */ - log_aside("He won."); - if (dna.playednim==1) /* Your first game */ - dixi('Q',4); /* Goody! Play me again? */ - else - dixi('Q',5); /* Oh, look at that! I've won again! */ - pennycheck(4); /* And you've just lost 4d! */ - } else - { /* You won - strange! */ - log_aside("You won."); - dixi('Q',7); /* You won! Give us a lute! */ - dna.obj[lute]=true; - objectlist(); - dna.wonnim=true; - show_one(1); /* Show the settle with no lute on it. */ - points(7); /* 7 points for winning! */ - } - - if (dna.playednim==1) points(3); /* 3 points for playing your 1st game. */ + byte groi; + + if (dna.wonnim) { + /* Already won the game. */ + dixi('Q', 6); + return; + } + + if (! dna.asked_dogfood_about_nim) { + dixi('q', 84); + return; + } + + dixi('Q', 3); + dna.playednim += 1; + dusk(); + oncandopageswap = false; + copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); + off(); + + setup(); + board(); + on(); + mousepage(3); + + do { + startmove(); + if (dogfoodsturn) dogfood(); + else takesome(); + stones[row] -= number; + show_changes(); + } while (!(stonesleft == 0)); + endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ + + dusk(); + off(); + oncandopageswap = true; + copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); + on(); + dawn(); + + if (dogfoodsturn) { + /* Dogfood won - as usual */ + log_aside("He won."); + if (dna.playednim == 1) /* Your first game */ + dixi('Q', 4); /* Goody! Play me again? */ + else + dixi('Q', 5); /* Oh, look at that! I've won again! */ + pennycheck(4); /* And you've just lost 4d! */ + } else { + /* You won - strange! */ + log_aside("You won."); + dixi('Q', 7); /* You won! Give us a lute! */ + dna.obj[lute] = true; + objectlist(); + dna.wonnim = true; + show_one(1); /* Show the settle with no lute on it. */ + points(7); /* 7 points for winning! */ + } + + if (dna.playednim == 1) points(3); /* 3 points for playing your 1st game. */ } - /* No init part. */ +/* No init part. */ } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h index 8919b1af3ad9..1397367d16b9 100644 --- a/engines/avalanche/nimunit.h +++ b/engines/avalanche/nimunit.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,8 +29,8 @@ #define __nimunit_h__ #include "gyro.h" - #include "Graph.h" - /*#include "Crt.h"*/ +#include "Graph.h" +/*#include "Crt.h"*/ #include "pingo.h" #include "visa.h" #include "lucerna.h" @@ -39,7 +39,7 @@ namespace Avalanche { - void play_nim(); +void play_nim(); } // End of namespace Avalanche. diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index c813f3764855..581f68abfb59 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,251 +34,298 @@ namespace Avalanche { const char more[] = " (more) "; -const string up = string('-')+'\30'+more+'\30'; -const string down = string('+')+'\31'+more+'\31'; +const string up = string('-') + '\30' + more + '\30'; +const string down = string('+') + '\31' + more + '\31'; const graphcursmasktype fletch = /* Mask 4 in Avalot */ - {( - (255,511,1023,2047,1023,4607,14591,31871,65031,65283,65281,65280,65280,65409,65473,65511), - (0,10240,20480,24576,26624,17408,512,256,128,88,32,86,72,20,16,0)), - 0, - 0}; +{ + ( + (255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511), + (0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0)), + 0, + 0 +}; string cdir; -matrix<0,2,1,18,varying_string<15> > info; -matrix<0,2,1,100,varying_string<15> > possible; +matrix<0, 2, 1, 18, varying_string<15> > info; +matrix<0, 2, 1, 100, varying_string<15> > possible; byte fv; -array<0,2,byte> light,page_; -array<0,2,boolean> blank; -byte chtcode,where; +array<0, 2, byte> light, page_; +array<0, 2, boolean> blank; +byte chtcode, where; string answer; -void split(string x) -{ - byte fv; -; - x=copy(x,4,255); if (x=="") {; blank[0]=true; return; } - x=x+'\\'; possible[0][1]="b\\"; fv=2; - while (pos("\\",x)!=0) - {; - possible[0][fv]=string('b')+copy(x,1,pos("\\",x)-1); fv += 1; - x=copy(x,pos("\\",x)+1,255); - } - possible[0][fv-1]=""; +void split(string x) { + byte fv; + ; + x = copy(x, 4, 255); + if (x == "") { + ; + blank[0] = true; + return; + } + x = x + '\\'; + possible[0][1] = "b\\"; + fv = 2; + while (pos("\\", x) != 0) { + ; + possible[0][fv] = string('b') + copy(x, 1, pos("\\", x) - 1); + fv += 1; + x = copy(x, pos("\\", x) + 1, 255); + } + possible[0][fv - 1] = ""; } -void block(integer x1,integer y1,integer x2,integer y2, string x) -{; - bar(x1,y1,x2,y2); - setcolor( 9); outtextxy(x1+(x2-x1) / 2-1,y1+5,x); - setcolor(15); outtextxy(x1+(x2-x1) / 2+1,y1+6,x); +void block(integer x1, integer y1, integer x2, integer y2, string x) { + ; + bar(x1, y1, x2, y2); + setcolor(9); + outtextxy(x1 + (x2 - x1) / 2 - 1, y1 + 5, x); + setcolor(15); + outtextxy(x1 + (x2 - x1) / 2 + 1, y1 + 6, x); } -void message(string x) -{; - block(5,189,640,200,x); +void message(string x) { + ; + block(5, 189, 640, 200, x); } -void bigbar(byte x) -{; - bar(15+210*x,36,210+210*x,187); +void bigbar(byte x) { + ; + bar(15 + 210 * x, 36, 210 + 210 * x, 187); } void getem(); -static void sub_getem(char prefix, string spec, byte attrib,byte infonum) -{ - searchrec s; byte fv; -; - fv=0; - findfirst(spec,attrib,s); - while ((doserror==0) && (fv<100)) - {; - if (((s.attr & attrib)>0) && (s.name[1]!='.')) - {; /* circumvent inclusive searching! */ - fv += 1; - possible[infonum][fv]=string(prefix)+s.name; - } - findnext(s); - } - if (fv==0) blank[infonum]=true; +static void sub_getem(char prefix, string spec, byte attrib, byte infonum) { + searchrec s; + byte fv; + ; + fv = 0; + findfirst(spec, attrib, s); + while ((doserror == 0) && (fv < 100)) { + ; + if (((s.attr & attrib) > 0) && (s.name[1] != '.')) { + ; /* circumvent inclusive searching! */ + fv += 1; + possible[infonum][fv] = string(prefix) + s.name; + } + findnext(s); + } + if (fv == 0) blank[infonum] = true; } void getem() -{; - message("Please wait... scanning directory..."); - sub_getem('a',"*.asg",archive+hidden,1); /* Scan for .ASG files */ - sub_getem('f',"*.*",directory,2); /* Scan for sub-directories */ +{ + ; + message("Please wait... scanning directory..."); + sub_getem('a', "*.asg", archive + hidden, 1); /* Scan for .ASG files */ + sub_getem('f', "*.*", directory, 2); /* Scan for sub-directories */ } -void minisc(string& x) /* Converts to lower-case */ -{ - byte fv; -; - for( fv=1; fv <= length(x); fv ++) - if ((x[fv]>='A') && (x[fv]<='Z')) x[fv] += 32; +void minisc(string &x) { /* Converts to lower-case */ + byte fv; + ; + for (fv = 1; fv <= length(x); fv ++) + if ((x[fv] >= 'A') && (x[fv] <= 'Z')) x[fv] += 32; } -void showall() -{ - byte fv,ff; -; - for( fv=0; fv <= 2; fv ++) - {; - bigbar(fv); /* blank out anything else */ - if (blank[fv]) - {; /* nothing here at all */ -/* setcolor(14); - outtextxy(113+210*fv,43,'(Nothing here!)'); */ - setcolor(14); settextstyle(0,0,2); - outtextxy(113+210*fv, 77,"Nothing"); - outtextxy(113+210*fv,100,"here!"); - settextstyle(0,0,1); - } else - {; /* something here- what? */ - setcolor(11); - for( ff=0; ff <= 15; ff ++) - {; - info[fv][ff+2]=possible[fv][page_[fv]*15+ff+1]; minisc(info[fv][ff+2]); - } - if (page_[fv]>0) info[fv][1]=up; else info[fv][1]=""; - if (possible[fv][page_[fv]*15+17]!="") - info[fv][18]=down; else info[fv][18]=""; - for( ff=1; ff <= 18; ff ++) - {; - outtextxy(113+210*fv,35+ff*8,copy(info[fv][ff],2,255)); - } - } - } - block(5,12,640,22,cdir); +void showall() { + byte fv, ff; + ; + for (fv = 0; fv <= 2; fv ++) { + ; + bigbar(fv); /* blank out anything else */ + if (blank[fv]) { + ; /* nothing here at all */ + /* setcolor(14); + outtextxy(113+210*fv,43,'(Nothing here!)'); */ + setcolor(14); + settextstyle(0, 0, 2); + outtextxy(113 + 210 * fv, 77, "Nothing"); + outtextxy(113 + 210 * fv, 100, "here!"); + settextstyle(0, 0, 1); + } else { + ; /* something here- what? */ + setcolor(11); + for (ff = 0; ff <= 15; ff ++) { + ; + info[fv][ff + 2] = possible[fv][page_[fv] * 15 + ff + 1]; + minisc(info[fv][ff + 2]); + } + if (page_[fv] > 0) info[fv][1] = up; + else info[fv][1] = ""; + if (possible[fv][page_[fv] * 15 + 17] != "") + info[fv][18] = down; + else info[fv][18] = ""; + for (ff = 1; ff <= 18; ff ++) { + ; + outtextxy(113 + 210 * fv, 35 + ff * 8, copy(info[fv][ff], 2, 255)); + } + } + } + block(5, 12, 640, 22, cdir); } -void changedir(string x) -{; +void changedir(string x) { + ; - chdir(x); getdir(0,cdir); + chdir(x); + getdir(0, cdir); } -void drawup() -{ - integer gd; -; - block( 15, 0,630,10,"Choose an .ASG file to load or save."); - block( 15,24,210,34,"Looking back:"); - block(225,24,420,34,"Here:"); - block(435,24,630,34,"Looking forwards:"); - for( gd=0; gd <= 2; gd ++) bigbar(gd); /* just to tide us over the wait... */ - showall(); +void drawup() { + integer gd; + ; + block(15, 0, 630, 10, "Choose an .ASG file to load or save."); + block(15, 24, 210, 34, "Looking back:"); + block(225, 24, 420, 34, "Here:"); + block(435, 24, 630, 34, "Looking forwards:"); + for (gd = 0; gd <= 2; gd ++) bigbar(gd); /* just to tide us over the wait... */ + showall(); } -void setup() -{; - settextjustify(1,1); setfillstyle(1,1); - fillchar(blank,sizeof(blank),'\0'); fillchar( info,sizeof( info),'\0'); - fillchar(possible,sizeof(possible),'\0'); - fillchar( page_,sizeof( page_),'\0'); - split(cdir); getem(); drawup(); +void setup() { + ; + settextjustify(1, 1); + setfillstyle(1, 1); + fillchar(blank, sizeof(blank), '\0'); + fillchar(info, sizeof(info), '\0'); + fillchar(possible, sizeof(possible), '\0'); + fillchar(page_, sizeof(page_), '\0'); + split(cdir); + getem(); + drawup(); } -void setup1() -{ - integer gd,gm; -; - gd=3; gm=0; initgraph(gd,gm,""); answer=""; - getdir(0,cdir); resetmouse; setgraphicscursor(fletch); - fillchar(light,sizeof(light),'\0'); - setup(); +void setup1() { + integer gd, gm; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + answer = ""; + getdir(0, cdir); + resetmouse; + setgraphicscursor(fletch); + fillchar(light, sizeof(light), '\0'); + setup(); } -void clickwait() -{ - const array<1,4,varying_string<30> > msg = - {{"change to another drive.", - "return to a lower directory.", - "use the file named.", - "enter a sub-directory."}}; - byte oldcht; /* Click Here To... code */ -; - showmousecursor; oldcht=177; - do { - if (mousey<38) chtcode=1; else - switch (mousex) { - case 0 ... 210: chtcode=2; break; - case 211 ... 421: chtcode=3; break; - default: chtcode=4; - } - if (oldcht!=chtcode) - {; - hidemousecursor; message(string("Click here to ")+msg[chtcode]); - showmousecursor; oldcht=chtcode; - } - } while (!leftmousekeypressed); - hidemousecursor; where=((mousey-39) / 8)+1; +void clickwait() { + const array<1, 4, varying_string<30> > msg = { + { + "change to another drive.", + "return to a lower directory.", + "use the file named.", + "enter a sub-directory." + } + }; + byte oldcht; /* Click Here To... code */ + ; + showmousecursor; + oldcht = 177; + do { + if (mousey < 38) chtcode = 1; + else + switch (mousex) { + case 0 ... 210: + chtcode = 2; + break; + case 211 ... 421: + chtcode = 3; + break; + default: + chtcode = 4; + } + if (oldcht != chtcode) { + ; + hidemousecursor; + message(string("Click here to ") + msg[chtcode]); + showmousecursor; + oldcht = chtcode; + } + } while (!leftmousekeypressed); + hidemousecursor; + where = ((mousey - 39) / 8) + 1; } -void blip() -{; - sound(32); delay(3); nosound; +void blip() { + ; + sound(32); + delay(3); + nosound; } -void do_cht() -{ - char r; byte fv; string x; -; - if (chtcode==1) - {; /* change drives */ - message("Enter the drive letter (e.g. A)..."); - r=readkey(); - changedir(string(r)+':'); setup(); - } else - {; - x=info[chtcode-2][where]; r=x[1]; x=copy(x,2,255); - switch (r) { - case 'b': {; /* back some dirs */ - if (x=='\\') x=""; - for( fv=where-1; fv >= 3; fv --) - x=copy(info[0][fv],2,255)+'\\'+x; - changedir(string('\\')+x); - setup(); - } - break; - case 'f': {; /* sub-directory */ - changedir(x); - setup(); - } - break; - case '+': {; /* scroll one panel down */ - page_[chtcode-2] += 1; - drawup(); - } - break; - case '-': {; /* scroll one panel up */ - page_[chtcode-2] -= 1; - drawup(); - } - break; - case 'a': answer=x; break; - } - } +void do_cht() { + char r; + byte fv; + string x; + ; + if (chtcode == 1) { + ; /* change drives */ + message("Enter the drive letter (e.g. A)..."); + r = readkey(); + changedir(string(r) + ':'); + setup(); + } else { + ; + x = info[chtcode - 2][where]; + r = x[1]; + x = copy(x, 2, 255); + switch (r) { + case 'b': { + ; /* back some dirs */ + if (x == '\\') x = ""; + for (fv = where - 1; fv >= 3; fv --) + x = copy(info[0][fv], 2, 255) + '\\' + x; + changedir(string('\\') + x); + setup(); + } + break; + case 'f': { + ; /* sub-directory */ + changedir(x); + setup(); + } + break; + case '+': { + ; /* scroll one panel down */ + page_[chtcode - 2] += 1; + drawup(); + } + break; + case '-': { + ; /* scroll one panel up */ + page_[chtcode - 2] -= 1; + drawup(); + } + break; + case 'a': + answer = x; + break; + } + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup1(); - do { - clickwait(); - do_cht(); - } while (!(answer!="")); - if (length(cdir)>3) cdir=cdir+'\\'; - answer=cdir+answer; - closegraph(); - output << "Routine completed." << NL; - output << "Answer: " << answer << NL; - output << "Hit Enter:"; input >> NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup1(); + do { + clickwait(); + do_cht(); + } while (!(answer != "")); + if (length(cdir) > 3) cdir = cdir + '\\'; + answer = cdir + answer; + closegraph(); + output << "Routine completed." << NL; + output << "Answer: " << answer << NL; + output << "Hit Enter:"; + input >> NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index eaee8eb5026c..b53768f893df 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,46 +31,47 @@ namespace Avalanche { struct scoretype { - varying_string<39> name; - word score; + varying_string<39> name; + word score; }; struct ratetype { - varying_string<10> rank; - word lowest; + varying_string<10> rank; + word lowest; }; struct tabletype { - array<1,12,scoretype> a; - byte light; + array<1, 12, scoretype> a; + byte light; }; -const array<1,9,ratetype> ratings = - {{{"Rubbish", 0}, - {"Beginner", 1}, - {"Poor", 10}, - {"Average", 30}, - {"Fair", 50}, - {"Not bad", 70}, - {"Good", 100}, - {"Great", 200}, - {"Fantastic!", 330}}}; - -integer gd,gm; +const array<1, 9, ratetype> ratings = { + { {"Rubbish", 0}, + {"Beginner", 1}, + {"Poor", 10}, + {"Average", 30}, + {"Fair", 50}, + {"Not bad", 70}, + {"Good", 100}, + {"Great", 200}, + {"Fantastic!", 330} + } +}; + +integer gd, gm; tabletype table; -byte ratingname(word x) -{ - byte fv; -byte ratingname_result; -; - for( fv=9; fv >= 1; fv --) - if (x>=ratings[fv].lowest) - {; - ratingname_result=fv; - return ratingname_result; - } /* bad style */ -return ratingname_result; +byte ratingname(word x) { + byte fv; + byte ratingname_result; + ; + for (fv = 9; fv >= 1; fv --) + if (x >= ratings[fv].lowest) { + ; + ratingname_result = fv; + return ratingname_result; + } /* bad style */ + return ratingname_result; } void title(); @@ -78,199 +79,235 @@ void title(); const string message = "A v a l o t : H i g h - S c o r e s"; -static void sayfast(integer x,integer y) -{ - integer anchor; byte fv; -; - anchor=-296; - for( fv=1; fv <= length(message); fv ++) - {; - if (message[fv-1]!='\40') outtextxy(x+anchor,y-8,message[fv-1]); - anchor += 16; - } +static void sayfast(integer x, integer y) { + integer anchor; + byte fv; + ; + anchor = -296; + for (fv = 1; fv <= length(message); fv ++) { + ; + if (message[fv - 1] != '\40') outtextxy(x + anchor, y - 8, message[fv - 1]); + anchor += 16; + } } -void title() -{ - const array<0,6,byte> shades = - {{blue,lightgray,darkgray,blue,lightblue,blue,darkgray}}; - byte x; - integer len; - -; - settextstyle(0,0,2); /*settextjustify(1,1);*/ - len=textheight(message); - for( x=6; x >= 0; x --) - {; - setcolor(shades[x]); - sayfast(320-x*2,20-x); - if (x>0) - {; - sayfast(320+x*2,20-x); - sayfast(320+x*2,20+x); - sayfast(320-x*2,20+x); - } - } +void title() { + const array<0, 6, byte> shades = + {{blue, lightgray, darkgray, blue, lightblue, blue, darkgray}}; + byte x; + integer len; + + ; + settextstyle(0, 0, 2); /*settextjustify(1,1);*/ + len = textheight(message); + for (x = 6; x >= 0; x --) { + ; + setcolor(shades[x]); + sayfast(320 - x * 2, 20 - x); + if (x > 0) { + ; + sayfast(320 + x * 2, 20 - x); + sayfast(320 + x * 2, 20 + x); + sayfast(320 - x * 2, 20 + x); + } + } } -void newtable() -{ - const array<1,12,varying_string<15> > names = - {{"Mike","Liz","Thomas","Mark","Mandy","Andrew","Lucy Tryphena","", - "Thanks to all","who helped...","","Have fun!"}}; - byte fv; -; - fillchar(table,sizeof(table),'\261'); - for( fv=1; fv <= 12; fv ++) - { - scoretype& with = table.a[fv]; - ; - with.name=names[fv]; - with.score=193-fv*16; - } - table.light=1; +void newtable() { + const array<1, 12, varying_string<15> > names = { + { + "Mike", "Liz", "Thomas", "Mark", "Mandy", "Andrew", "Lucy Tryphena", "", + "Thanks to all", "who helped...", "", "Have fun!" + } + }; + byte fv; + ; + fillchar(table, sizeof(table), '\261'); + for (fv = 1; fv <= 12; fv ++) { + scoretype &with = table.a[fv]; + ; + with.name = names[fv]; + with.score = 193 - fv * 16; + } + table.light = 1; } -string strf(longint x) /* From Gyro. Delete when integrated. */ -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { /* From Gyro. Delete when integrated. */ + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void sparkle(integer x,integer y, string z) -{; - setcolor(cyan); outtextxy(x-1,y-1,z); - setcolor(blue); outtextxy(x+1,y+1,z); - setcolor(white); outtextxy(x ,y ,z); +void sparkle(integer x, integer y, string z) { + ; + setcolor(cyan); + outtextxy(x - 1, y - 1, z); + setcolor(blue); + outtextxy(x + 1, y + 1, z); + setcolor(white); + outtextxy(x , y , z); } -void drawtable() -{ - byte fv,last,now; -; - setfillstyle(1,8); - bar( 0, 40,105, 58); bar(110, 40,400, 58); - bar(405, 40,490, 58); bar(495, 40,640, 58); - bar( 5, 60,105,181); bar(110, 60,400,181); - bar(405, 60,490,181); bar(495, 60,635,181); - bar( 0,185,640,190); - setcolor(lightred); settextstyle(0,0,1); settextjustify(0,0); - outtextxy( 45,55,"Number:"); - outtextxy(120,55,"Name:"); - outtextxy(420,55,"Score:"); - outtextxy(500,55,"Rating:"); - setcolor(white); last=177; - for( fv=1; fv <= 12; fv ++) - { - scoretype& with = table.a[fv]; - ; - settextjustify(righttext,bottomtext); - sparkle(100,60+fv*10,strf(fv)+'.'); - sparkle(455,60+fv*10,strf(with.score)); - if (fv==table.light) sparkle(70,60+fv*10,string("")+'\20'); - - settextjustify(lefttext,bottomtext); - sparkle(120,60+fv*10,with.name); - now=ratingname(with.score); - if (now!=last) - sparkle(510,60+fv*10,ratings[ratingname(with.score)].rank); - else - sparkle(517,57+fv*10,",,"); - last=now; - } +void drawtable() { + byte fv, last, now; + ; + setfillstyle(1, 8); + bar(0, 40, 105, 58); + bar(110, 40, 400, 58); + bar(405, 40, 490, 58); + bar(495, 40, 640, 58); + bar(5, 60, 105, 181); + bar(110, 60, 400, 181); + bar(405, 60, 490, 181); + bar(495, 60, 635, 181); + bar(0, 185, 640, 190); + setcolor(lightred); + settextstyle(0, 0, 1); + settextjustify(0, 0); + outtextxy(45, 55, "Number:"); + outtextxy(120, 55, "Name:"); + outtextxy(420, 55, "Score:"); + outtextxy(500, 55, "Rating:"); + setcolor(white); + last = 177; + for (fv = 1; fv <= 12; fv ++) { + scoretype &with = table.a[fv]; + ; + settextjustify(righttext, bottomtext); + sparkle(100, 60 + fv * 10, strf(fv) + '.'); + sparkle(455, 60 + fv * 10, strf(with.score)); + if (fv == table.light) sparkle(70, 60 + fv * 10, string("") + '\20'); + + settextjustify(lefttext, bottomtext); + sparkle(120, 60 + fv * 10, with.name); + now = ratingname(with.score); + if (now != last) + sparkle(510, 60 + fv * 10, ratings[ratingname(with.score)].rank); + else + sparkle(517, 57 + fv * 10, ",,"); + last = now; + } } -void message1(string x) -{; - setfillstyle(1,8); bar(0,190,640,200); - settextjustify(1,1); sparkle(320,195,x); +void message1(string x) { + ; + setfillstyle(1, 8); + bar(0, 190, 640, 200); + settextjustify(1, 1); + sparkle(320, 195, x); } -void sorthst() -{ - byte fv; boolean ok; scoretype temp; -; - do { - ok=true; - for( fv=1; fv <= 11; fv ++) - if (table.a[fv].score i;char r; integer counter; byte flash; - -; - y=60+table.light*10; i=""; settextjustify(2,0); counter=999; flash=0; - do { - x=128+length(i)*8; - do { - counter += 1; - if (counter==1000) - {; - cursor(4+flash*10); - flash=1-flash; - counter=0; - } - delay(1); - } while (!keypressed()); - cursor(8); - sound(17177); r=readkey(); nosound; - if (r=='\10') {; - if (i[0]>'\0') {; - bar(x-17,y-10,x-8,y); - i[0] -= 1; sparkle(x-16,y,i[length(i)]); - } - } else {; - if ((i[0]<'\42') && (r!='\15')) {; - sparkle(x,y,r); - i=i+r; - } - } - counter=999; - } while (!(r=='\15')); +void entername() { + varying_string<34> i; + char r; + integer counter; + byte flash; + + ; + y = 60 + table.light * 10; + i = ""; + settextjustify(2, 0); + counter = 999; + flash = 0; + do { + x = 128 + length(i) * 8; + do { + counter += 1; + if (counter == 1000) { + ; + cursor(4 + flash * 10); + flash = 1 - flash; + counter = 0; + } + delay(1); + } while (!keypressed()); + cursor(8); + sound(17177); + r = readkey(); + nosound; + if (r == '\10') { + ; + if (i[0] > '\0') { + ; + bar(x - 17, y - 10, x - 8, y); + i[0] -= 1; + sparkle(x - 16, y, i[length(i)]); + } + } else { + ; + if ((i[0] < '\42') && (r != '\15')) { + ; + sparkle(x, y, r); + i = i + r; + } + } + counter = 999; + } while (!(r == '\15')); } -void newscore(word sc) -{; - { scoretype& with = table.a[12]; - if (sc>with.score) - {; - with.name=""; with.score=sc; table.light=10; sorthst(); drawtable(); - message1("Well done! Please enter your name, then press Return..."); - entername(); - } else drawtable();} /* too low for score */ - message1("Press Space to continue..."); - do {; } while (!(keypressed() && (readkey()=='\40'))); +void newscore(word sc) { + ; + { + scoretype &with = table.a[12]; + if (sc > with.score) { + ; + with.name = ""; + with.score = sc; + table.light = 10; + sorthst(); + drawtable(); + message1("Well done! Please enter your name, then press Return..."); + entername(); + } else drawtable(); + } /* too low for score */ + message1("Press Space to continue..."); + do { + ; + } while (!(keypressed() && (readkey() == '\40'))); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - title(); - newtable(); - newscore(/*177*/0); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + title(); + newtable(); + newscore(/*177*/0); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index a364cbcfdd7f..89bc90705121 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -51,227 +51,266 @@ const integer bug_notyesorno = 251; byte fv; char t; string bugline; -boolean usingp,usingl; -boolean zoomy,numlockhold; +boolean usingp, usingl; +boolean zoomy, numlockhold; boolean filename_specified; -string inihead,initail; /* For reading the .INI file. */ - - -void linebug(byte which) -{; - output << "AVALOT : "; - switch (which) { - case bug_twonames : output << "You may only specify ONE filename." << NL; break; - case bug_pandl : output << "/p and /l cannot be used together." << NL; break; - case bug_weirdswitch : output << "Unknown switch (\"" << bugline << - "\"). Type AVALOT /? for a list of switches." << NL; - break; - case bug_invalidini: output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; break; - case bug_notyesorno: output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; break; - } - exit(which); +string inihead, initail; /* For reading the .INI file. */ + + +void linebug(byte which) { + ; + output << "AVALOT : "; + switch (which) { + case bug_twonames : + output << "You may only specify ONE filename." << NL; + break; + case bug_pandl : + output << "/p and /l cannot be used together." << NL; + break; + case bug_weirdswitch : + output << "Unknown switch (\"" << bugline << + "\"). Type AVALOT /? for a list of switches." << NL; + break; + case bug_invalidini: + output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; + break; + case bug_notyesorno: + output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; + break; + } + exit(which); } -void syntax() -{; - assign(output,""); rewrite(output); - output << NL; - output << string("Lord Avalot d'Argent\n\n(c) ")+copyright+" Mark, Mike and Thomas Thurman." << NL; - output << string("~~~~~~~~~~~~~~~~~~~~~\n\n")+vernum << NL; - output << NL; - output << "Syntax:" << NL; - output << "\n/?\ndisplays this screen," << NL; - output << "\n/O\noverrides EGA check," << NL; - output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; - output << "\n/P\nlogs with Epson codes to , default PRN," << NL; - output << "\n/Q\ncancels sound effects," << NL; - output << "\n/S\ndisables Soundblaster," << NL; - output << "\n/Z\ngoes straight into the game." << NL; - output << NL; - output << "\n\n\n\n\n\n\n... Have fun!" << NL; - exit(177); +void syntax() { + ; + assign(output, ""); + rewrite(output); + output << NL; + output << string("Lord Avalot d'Argent\n\n(c) ") + copyright + " Mark, Mike and Thomas Thurman." << NL; + output << string("~~~~~~~~~~~~~~~~~~~~~\n\n") + vernum << NL; + output << NL; + output << "Syntax:" << NL; + output << "\n/?\ndisplays this screen," << NL; + output << "\n/O\noverrides EGA check," << NL; + output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; + output << "\n/P\nlogs with Epson codes to , default PRN," << NL; + output << "\n/Q\ncancels sound effects," << NL; + output << "\n/S\ndisables Soundblaster," << NL; + output << "\n/Z\ngoes straight into the game." << NL; + output << NL; + output << "\n\n\n\n\n\n\n... Have fun!" << NL; + exit(177); } -void upstr(string& x) -{ - byte fv; -; - for( fv=1; fv <= length(x); fv ++) x[fv]=upcase(x[fv]); +void upstr(string &x) { + byte fv; + ; + for (fv = 1; fv <= length(x); fv ++) x[fv] = upcase(x[fv]); } -boolean yesno() -{boolean yesno_result; -; - if (initail=="YES") yesno_result=true; else - if (initail=="NO") yesno_result=false; else - linebug(bug_notyesorno); -return yesno_result; +boolean yesno() { + boolean yesno_result; + ; + if (initail == "YES") yesno_result = true; + else if (initail == "NO") yesno_result = false; + else + linebug(bug_notyesorno); + return yesno_result; } -void ini_parse() -{; - upstr(inihead); - upstr(initail); - - if (inihead=="QUIET") soundfx=! yesno(); else - if (inihead=="ZOOMYSTART") zoomy=yesno(); else - if (inihead=="NUMLOCKHOLD") numlockhold=yesno(); else - if (inihead=="LOADFIRST") filetoload=initail; else - if (inihead=="OVERRIDEEGACHECK") cl_override=yesno(); else - if (inihead=="KEYBOARDCLICK") keyboardclick=yesno(); +void ini_parse() { + ; + upstr(inihead); + upstr(initail); + + if (inihead == "QUIET") soundfx = ! yesno(); + else if (inihead == "ZOOMYSTART") zoomy = yesno(); + else if (inihead == "NUMLOCKHOLD") numlockhold = yesno(); + else if (inihead == "LOADFIRST") filetoload = initail; + else if (inihead == "OVERRIDEEGACHECK") cl_override = yesno(); + else if (inihead == "KEYBOARDCLICK") keyboardclick = yesno(); } -void strip_ini() -{ - byte fv; -; - if (inihead=="") return; +void strip_ini() { + byte fv; + ; + if (inihead == "") return; - /* Firstly, delete any comments. */ - fv=pos(";",inihead); - if (fv>0) Delete(inihead,fv,255); + /* Firstly, delete any comments. */ + fv = pos(";", inihead); + if (fv > 0) Delete(inihead, fv, 255); - /* Lose the whitespace... */ + /* Lose the whitespace... */ - while (inihead[length(inihead)]==' ') inihead[0] -= 1; - while ((inihead!="") && (inihead[1]==' ')) Delete(inihead,1,1); + while (inihead[length(inihead)] == ' ') inihead[0] -= 1; + while ((inihead != "") && (inihead[1] == ' ')) Delete(inihead, 1, 1); - /* It's possible that now we'll end up with a blank line. */ + /* It's possible that now we'll end up with a blank line. */ - if ((inihead=="") || (inihead[1]=='[')) return; + if ((inihead == "") || (inihead[1] == '[')) return; - fv=pos("=",inihead); + fv = pos("=", inihead); - if (fv==0) - {; /* No "="! Weird! */ - bugline=inihead; - linebug(bug_invalidini); - } + if (fv == 0) { + ; /* No "="! Weird! */ + bugline = inihead; + linebug(bug_invalidini); + } - initail=copy(inihead,fv+1,255); - inihead[0]=chr(fv-1); + initail = copy(inihead, fv + 1, 255); + inihead[0] = chr(fv - 1); } -void load_ini() -{ - text ini; -; - assign(ini,"AVALOT.INI"); - reset(ini); - - while (! eof(ini)) - {; - ini >> inihead >> NL; - strip_ini(); - if (inihead!="") ini_parse(); - } - - close(ini); +void load_ini() { + text ini; + ; + assign(ini, "AVALOT.INI"); + reset(ini); + + while (! eof(ini)) { + ; + ini >> inihead >> NL; + strip_ini(); + if (inihead != "") ini_parse(); + } + + close(ini); } void parse(string x); static string arg; -static string getarg(string otherwis) -{string getarg_result; -; - if (arg=="") getarg_result=otherwis; else getarg_result=""; -return getarg_result; +static string getarg(string otherwis) { + string getarg_result; + ; + if (arg == "") getarg_result = otherwis; + else getarg_result = ""; + return getarg_result; } void parse(string x) -{; - switch (x[1]) { - case '/':case '-': {; - arg=copy(x,3,255); - switch (upcase(x[2])) { - case '?': syntax(); break; - case 'O': cl_override=true; break; - case 'L': if (! usingp) - {; - log_setup(getarg("avvy.log"),false); - usingl=true; - } else {; close(logfile); linebug(bug_pandl); } - break; - case 'P': if (! usingl) - {; - log_setup(getarg("prn"),true); - usingp=true; - } else {; close(logfile); linebug(bug_pandl); } - break; - case 'Q': soundfx=false; break; - case 'Z': zoomy=true; break; - case 'K': keyboardclick=true; break; - case 'D': demo=true; break; - default: {; - bugline=x; - linebug(bug_weirdswitch); - } - } - } - break; - case '*': {; - inihead=copy(x,2,255); - strip_ini(); - if (inihead!="") ini_parse(); - } - break; - default: {; /* filename */ - if (filename_specified) - linebug(bug_twonames); - else - filetoload=x; - filename_specified=true; - } - } +{ + ; + switch (x[1]) { + case '/': + case '-': { + ; + arg = copy(x, 3, 255); + switch (upcase(x[2])) { + case '?': + syntax(); + break; + case 'O': + cl_override = true; + break; + case 'L': + if (! usingp) { + ; + log_setup(getarg("avvy.log"), false); + usingl = true; + } else { + ; + close(logfile); + linebug(bug_pandl); + } + break; + case 'P': + if (! usingl) { + ; + log_setup(getarg("prn"), true); + usingp = true; + } else { + ; + close(logfile); + linebug(bug_pandl); + } + break; + case 'Q': + soundfx = false; + break; + case 'Z': + zoomy = true; + break; + case 'K': + keyboardclick = true; + break; + case 'D': + demo = true; + break; + default: { + ; + bugline = x; + linebug(bug_weirdswitch); + } + } + } + break; + case '*': { + ; + inihead = copy(x, 2, 255); + strip_ini(); + if (inihead != "") ini_parse(); + } + break; + default: { + ; /* filename */ + if (filename_specified) + linebug(bug_twonames); + else + filetoload = x; + filename_specified = true; + } + } } -void not_through_bootstrap() -{ - output << "Avalot must be loaded through the bootstrap." << NL; - exit(0); +void not_through_bootstrap() { + output << "Avalot must be loaded through the bootstrap." << NL; + exit(0); } -void get_storage_addr() -{ - integer e; +void get_storage_addr() { + integer e; - val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); - val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); - skellern=storage_ofs+1; + val(paramstr(2), storage_seg, e); + if (e != 0) not_through_bootstrap(); + val(paramstr(3), storage_ofs, e); + if (e != 0) not_through_bootstrap(); + skellern = storage_ofs + 1; } class unit_incline_initialize { - public: unit_incline_initialize(); +public: + unit_incline_initialize(); }; static unit_incline_initialize incline_constructor; -unit_incline_initialize::unit_incline_initialize() {; - filetoload=""; - usingl=false; - usingp=false; - logging=false; - cl_override=false; - soundfx=true; - zoomy=false; - numlockhold=false; - filename_specified=false; - keyboardclick=false; +unit_incline_initialize::unit_incline_initialize() { + ; + filetoload = ""; + usingl = false; + usingp = false; + logging = false; + cl_override = false; + soundfx = true; + zoomy = false; + numlockhold = false; + filename_specified = false; + keyboardclick = false; - load_ini(); + load_ini(); - if ((paramcount<3) || - ((paramstr(1)!="Go") && (paramstr(1)!="et"))) not_through_bootstrap(); + if ((paramcount < 3) || + ((paramstr(1) != "Go") && (paramstr(1) != "et"))) not_through_bootstrap(); - reloaded=paramstr(1)=="et"; + reloaded = paramstr(1) == "et"; - get_storage_addr(); + get_storage_addr(); - for( fv=4; fv <= paramcount; fv ++) - parse(paramstr(fv)); + for (fv = 4; fv <= paramcount; fv ++) + parse(paramstr(fv)); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h index 9590d66c4dbd..2e872e77bb85 100644 --- a/engines/avalanche/oldincln.h +++ b/engines/avalanche/oldincln.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index 9a3476e82d1e..0c0665180e2b 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,7 +33,7 @@ TRIP4 Trippancy IV- "Trip Oop". */ #define __trip4_implementation__ - /* Trippancy IV (Trip Oop) */ +/* Trippancy IV (Trip Oop) */ #include "oldtrip.h" @@ -44,432 +44,607 @@ namespace Avalanche { -void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4); +void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4); -static boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{boolean dropin_result; -; - dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); -return dropin_result; -} - - - -static integer lesser(integer a,integer b) -{integer lesser_result; -; - if (ab) greater_result=a; else greater_result=b; -return greater_result; -} - -void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) - -{; - if (dropin(x3,y3,x1,y1,x2,y2) - || dropin(x3,y4,x1,y1,x2,y2) - || dropin(x4,y3,x1,y1,x2,y2) - || dropin(x4,y4,x1,y1,x2,y2)) - {; /* Overlaps */ - mblit(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4),1,0); - } else - {; /* Doesn't overlap- copy both of them seperately */ - mblit(x3,y3,x4,y4,1,0); /* backwards- why not...? */ - mblit(x1,y1,x2,y2,1,0); - } -} - -void loadtrip() -{ - byte gm; -; - for( gm=1; gm <= numtr; gm ++) tr[gm].original(); - tr[1].init(0); -} - -byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) -{ - byte a,c; integer fv,ff; -byte checkfeet_result; -; - a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; - if (oya) a=c; - } else - for( fv=x1; fv <= x2; fv ++) - for( ff=y+yl; ff <= oy+yl; ff ++) - {; - c=getpixel(fv,ff); - if (c>a) a=c; - } - checkfeet_result=a; setactivepage(1); -return checkfeet_result; -} - -void touchcol(byte tc); -static boolean bug; - -static void fr(byte a,byte b) {; fliproom(a,b); bug=false; } - -void touchcol(byte tc) -{; - bug=true; /* j.i.c. */ - switch (dna.room) { - case 1: fr(2,3); break; - case 2: {; /* main corridor */ - switch (tc) { - case 1: fr(3,1); break; /* to the other corridor */ - case 2: fr(2,1); break; /* to this corridor! Fix this later... */ - } - } - break; - case 3: {; /* turn corridor */ - switch (tc) { - case 1: fr(2,1); break; /* to the other corridor */ - case 2: fr(12,1); break; /* through Spludwick's door */ - } - } - break; - case 12: fr(3,2); break; - } - if (bug) - {; - setactivepage(0); - display(string('\7')+"Unknown touchcolour ("+strf(tc)+')'+" in "+strf(dna.room) - +'.'); setactivepage(1); tr[1].bounce(); - } -} - -triptype* triptype::init(byte spritenum) -{ - integer gd,gm; word s; untyped_file f; varying_string<2> xx; byte sort,n; - word bigsize; pointer p,q; -; - str(spritenum,xx); assign(f,string("c:\\avalot\\sprite")+xx+".avd"); - reset(f,1); seek(f,59); - blockread(f,a,sizeof(a)); blockread(f,bigsize,2); - setactivepage(3); - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); - blockread(f,p,bigsize); - off; putimage(0,0,p,0); release(q); n=1; - { adxtype& with = a; - for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= with.seq-1; gd ++) /* steps */ - {; - getmem(pic[n][sort],a.size); /* grab the memory */ - getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, - (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, - pic[n][sort]); /* grab the pic */ - n += 1; - }} on; - } - close(f); setactivepage(0); - - x=0; y=0; quick=true; visible=false; getmem(behind,a.size); - homing=false; ix=0; iy=0; step=0; check_me=a.name=="Avalot"; -return this; -} - -void triptype::original() -{; - quick=false; -} - -void triptype::getback() -{; - tax=x; tay=y; - off; /*getimage(x,y,x+a.xl,y+a.yl,behind^);*/ - mblit(x,y,x+a.xl,y+a.yl,1,3); on; -} - -void triptype::andexor() { - byte picnum; /* Picnum, Picnic, what ye heck */ -; - picnum=face*a.seq+step+1; off; - putimage(x,y,pic[picnum][0],andput); - putimage(x,y,pic[picnum][1],xorput); on; + boolean dropin_result; + ; + dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); + return dropin_result; } -void triptype::turn(byte whichway) -{; - face=whichway; -} -void triptype::appear(integer wx,integer wy, byte wf) -{; - x=(wx / 8)*8; y=wy; ox=wx; oy=wy; turn(wf); visible=true; ix=0; iy=0; -} -void triptype::walk() -{ - byte tc; -; - ox=x; oy=y; - if ((ix==0) && (iy==0)) return; - if (homing) homestep(); - x=x+ix; y=y+iy; - if (check_me) {; - tc=checkfeet(x,x+a.xl,oy,y,a.yl); - { void& with = magics[tc]; - switch (op) { - case exclaim: blip; break; - case bounces: bounce(); break; - case transport: fliproom(hi(data),lo(data)); break; - }} - } -/* if x<0 then x:=0; else if x+a.xl>640 then x:=640-a.xl;*/ - if (y<0) y=0; /* else if y+a.yl>161 then y:=161-a.yl; */ - step += 1; if (step==a.seq) step=0; getback(); -} - -void triptype::bounce() -{; setactivepage(1); putback(); x=ox; y=oy; stopwalk(); return; } - -void triptype::do_it() -{; - if (((ix!=0) || (iy!=0)) & (~ ddm_o.menunow)) - {; - off; copier(ox,oy,ox+a.xl,oy+a.yl,x,y,x+a.xl,y+a.yl); - putback(); on; - } -} - -void triptype::putback() -{; -/* putimage(tax,tay,behind^,0);*/ mblit(tax,tay,tax+a.xl,tay+a.yl,3,1); -} - -void triptype::walkto(integer xx,integer yy) -{; - speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; -} - -void triptype::stophoming() -{; - homing=false; -} - -void triptype::homestep() -{ - integer temp; -; - if ((hx==x) && (hy==y)) - {; /* touching the target */ - homing=false; return; - } - ix=0; iy=0; - if (hy!=y) - {; - temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; - } - if (hx!=x) - {; - temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; - } +static integer lesser(integer a, integer b) { + integer lesser_result; + ; + if (a < b) lesser_result = a; + else lesser_result = b; + return lesser_result; } -void triptype::speed(shortint xx,shortint yy) -{; - ix=xx; iy=yy; - if ((ix==0) && (iy==0)) return; /* no movement */ - if (ix==0) - {; /* No horz movement */ - if (iy<0) turn(up); else turn(down); - } else - {; - if (ix<0) turn(left); else turn(right); - } -} -void triptype::stopwalk() -{; - ix=0; iy=0; homing=false; -} -void triptype::chatter() -{; - talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; +static integer greater(integer a, integer b) { + integer greater_result; + ; + if (a > b) greater_result = a; + else greater_result = b; + return greater_result; } +void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) -getsettype* getsettype::init() -{; - numleft=0; /* initialise array pointer */ - return this; -} - -void remember(fieldtype r) -{; - numleft += 1; - gs[numleft]=r; -} - -void recall() -{void recall_result; -; - recall_result=gs[numleft]; - numleft -= 1; -return recall_result; -} - -void rwsp(byte t,byte r) { - const integer xs = 4; const integer ys = 2; -; - { triptype& with = tr[t]; switch (r) { - case up: speed( 0,-ys); break; case down: speed( 0, ys); break; case left: speed(-xs, 0); break; - case right: speed( xs, 0); break; case ul: speed(-xs,-ys); break; case ur: speed( xs,-ys); break; - case dl: speed(-xs, ys); break; case dr: speed( xs, ys); break; - }} + ; + if (dropin(x3, y3, x1, y1, x2, y2) + || dropin(x3, y4, x1, y1, x2, y2) + || dropin(x4, y3, x1, y1, x2, y2) + || dropin(x4, y4, x1, y1, x2, y2)) { + ; /* Overlaps */ + mblit(lesser(x1, x3), lesser(y1, y3), greater(x2, x4), greater(y2, y4), 1, 0); + } else { + ; /* Doesn't overlap- copy both of them seperately */ + mblit(x3, y3, x4, y4, 1, 0); /* backwards- why not...? */ + mblit(x1, y1, x2, y2, 1, 0); + } +} + +void loadtrip() { + byte gm; + ; + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + tr[1].init(0); +} + +byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { + byte a, c; + integer fv, ff; + byte checkfeet_result; + ; + a = 0; + setactivepage(2); + if (x1 < 0) x1 = 0; + if (x2 > 639) x2 = 639; + if (oy < y) + for (fv = x1; fv <= x2; fv ++) + for (ff = oy + yl; ff <= y + yl; ff ++) { + ; + c = getpixel(fv, ff); + if (c > a) a = c; + } + else + for (fv = x1; fv <= x2; fv ++) + for (ff = y + yl; ff <= oy + yl; ff ++) { + ; + c = getpixel(fv, ff); + if (c > a) a = c; + } + checkfeet_result = a; + setactivepage(1); + return checkfeet_result; } -void apped(byte trn,byte np) -{; - { - triptype& with = tr[trn]; - ; { void& with1 = peds[np]; appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir);} - rwsp(trn,tr[trn].face); } +void touchcol(byte tc); +static boolean bug; + +static void fr(byte a, byte b) { + ; + fliproom(a, b); + bug = false; +} + +void touchcol(byte tc) { + ; + bug = true; /* j.i.c. */ + switch (dna.room) { + case 1: + fr(2, 3); + break; + case 2: { + ; /* main corridor */ + switch (tc) { + case 1: + fr(3, 1); + break; /* to the other corridor */ + case 2: + fr(2, 1); + break; /* to this corridor! Fix this later... */ + } + } + break; + case 3: { + ; /* turn corridor */ + switch (tc) { + case 1: + fr(2, 1); + break; /* to the other corridor */ + case 2: + fr(12, 1); + break; /* through Spludwick's door */ + } + } + break; + case 12: + fr(3, 2); + break; + } + if (bug) { + ; + setactivepage(0); + display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) + + '.'); + setactivepage(1); + tr[1].bounce(); + } +} + +triptype *triptype::init(byte spritenum) { + integer gd, gm; + word s; + untyped_file f; + varying_string<2> xx; + byte sort, n; + word bigsize; + pointer p, q; + ; + str(spritenum, xx); + assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); + reset(f, 1); + seek(f, 59); + blockread(f, a, sizeof(a)); + blockread(f, bigsize, 2); + setactivepage(3); + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + blockread(f, p, bigsize); + off; + putimage(0, 0, p, 0); + release(q); + n = 1; + { + adxtype &with = a; + for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ + ; + getmem(pic[n][sort], a.size); /* grab the memory */ + getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, + (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, + pic[n][sort]); /* grab the pic */ + n += 1; + } + } + on; + } + close(f); + setactivepage(0); + + x = 0; + y = 0; + quick = true; + visible = false; + getmem(behind, a.size); + homing = false; + ix = 0; + iy = 0; + step = 0; + check_me = a.name == "Avalot"; + return this; +} + +void triptype::original() { + ; + quick = false; +} + +void triptype::getback() { + ; + tax = x; + tay = y; + off; /*getimage(x,y,x+a.xl,y+a.yl,behind^);*/ + mblit(x, y, x + a.xl, y + a.yl, 1, 3); + on; +} + +void triptype::andexor() { + byte picnum; /* Picnum, Picnic, what ye heck */ + ; + picnum = face * a.seq + step + 1; + off; + putimage(x, y, pic[picnum][0], andput); + putimage(x, y, pic[picnum][1], xorput); + on; +} + +void triptype::turn(byte whichway) { + ; + face = whichway; +} + +void triptype::appear(integer wx, integer wy, byte wf) { + ; + x = (wx / 8) * 8; + y = wy; + ox = wx; + oy = wy; + turn(wf); + visible = true; + ix = 0; + iy = 0; +} + +void triptype::walk() { + byte tc; + ; + ox = x; + oy = y; + if ((ix == 0) && (iy == 0)) return; + if (homing) homestep(); + x = x + ix; + y = y + iy; + if (check_me) { + ; + tc = checkfeet(x, x + a.xl, oy, y, a.yl); + { + void &with = magics[tc]; + switch (op) { + case exclaim: + blip; + break; + case bounces: + bounce(); + break; + case transport: + fliproom(hi(data), lo(data)); + break; + } + } + } + /* if x<0 then x:=0; else if x+a.xl>640 then x:=640-a.xl;*/ + if (y < 0) y = 0; /* else if y+a.yl>161 then y:=161-a.yl; */ + step += 1; + if (step == a.seq) step = 0; + getback(); +} + +void triptype::bounce() { + ; + setactivepage(1); + putback(); + x = ox; + y = oy; + stopwalk(); + return; +} + +void triptype::do_it() { + ; + if (((ix != 0) || (iy != 0)) & (~ ddm_o.menunow)) { + ; + off; + copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); + putback(); + on; + } +} + +void triptype::putback() { + ; + /* putimage(tax,tay,behind^,0);*/ mblit(tax, tay, tax + a.xl, tay + a.yl, 3, 1); +} + +void triptype::walkto(integer xx, integer yy) { + ; + speed(xx - x, yy - y); + hx = xx; + hy = yy; + homing = true; +} + +void triptype::stophoming() { + ; + homing = false; +} + +void triptype::homestep() { + integer temp; + ; + if ((hx == x) && (hy == y)) { + ; /* touching the target */ + homing = false; + return; + } + ix = 0; + iy = 0; + if (hy != y) { + ; + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; + } + if (hx != x) { + ; + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } +} + +void triptype::speed(shortint xx, shortint yy) { + ; + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + ; /* No horz movement */ + if (iy < 0) turn(up); + else turn(down); + } else { + ; + if (ix < 0) turn(left); + else turn(right); + } +} + +void triptype::stopwalk() { + ; + ix = 0; + iy = 0; + homing = false; +} + +void triptype::chatter() { + ; + talkx = x + a.xl / 2; + talky = y; + talkf = a.fgc; + talkb = a.bgc; +} + + +getsettype *getsettype::init() { + ; + numleft = 0; /* initialise array pointer */ + return this; +} + +void remember(fieldtype r) { + ; + numleft += 1; + gs[numleft] = r; +} + +void recall() { + void recall_result; + ; + recall_result = gs[numleft]; + numleft -= 1; + return recall_result; +} + +void rwsp(byte t, byte r) { + const integer xs = 4; + const integer ys = 2; + ; + { + triptype &with = tr[t]; + switch (r) { + case up: + speed(0, -ys); + break; + case down: + speed(0, ys); + break; + case left: + speed(-xs, 0); + break; + case right: + speed(xs, 0); + break; + case ul: + speed(-xs, -ys); + break; + case ur: + speed(xs, -ys); + break; + case dl: + speed(-xs, ys); + break; + case dr: + speed(xs, ys); + break; + } + } +} + +void apped(byte trn, byte np) { + ; + { + triptype &with = tr[trn]; + ; + { + void &with1 = peds[np]; + appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); + } + rwsp(trn, tr[trn].face); + } } void trippancy(); -static boolean allstill() -{ - boolean xxx; byte fv; -boolean allstill_result; -; - xxx=true; - for( fv=1; fv <= numtr; fv ++) - { triptype& with = tr[fv]; - if (with.quick && ((with.ix!=0) || (with.iy!=0))) xxx=false;} - allstill_result=xxx; -return allstill_result; -} - -void trippancy() -{ - byte fv; -; - if ((ddm_o.menunow) | ontoolbar | seescroll | allstill()) return; - setactivepage(1); - for( fv=1; fv <= numtr; fv ++) - { triptype& with = tr[fv]; - if (with.quick) - {; - walk(); - if (with.visible && ((with.ix!=0) || (with.iy!=0))) andexor(); - do_it(); - }} - setactivepage(0); +static boolean allstill() { + boolean xxx; + byte fv; + boolean allstill_result; + ; + xxx = true; + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && ((with.ix != 0) || (with.iy != 0))) xxx = false; + } + allstill_result = xxx; + return allstill_result; +} + +void trippancy() { + byte fv; + ; + if ((ddm_o.menunow) | ontoolbar | seescroll | allstill()) return; + setactivepage(1); + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) { + ; + walk(); + if (with.visible && ((with.ix != 0) || (with.iy != 0))) andexor(); + do_it(); + } + } + setactivepage(0); } void tripkey(char dir); -static void stopwalking() -{; - tr[1].stopwalk(); dna.rw=stopped; -} - -void tripkey(char dir) -{; - { triptype& with = tr[1]; - {; - switch (dir) { - case 'H': if (rw!=up) - {; rw=up; rwsp(1,rw); } else stopwalking(); - break; - case 'P': if (rw!=down) - {; rw=down; rwsp(1,rw); } else stopwalking(); - break; - case 'K': if (rw!=left) - {; rw=left; rwsp(1,rw); } else stopwalking(); - break; - case 'M': if (rw!=right) - {; rw=right; rwsp(1,rw); } else stopwalking(); - break; - case 'I': if (rw!=ur) - {; rw=ur; rwsp(1,rw); } else stopwalking(); - break; - case 'Q': if (rw!=dr) - {; rw=dr; rwsp(1,rw); } else stopwalking(); - break; - case 'O': if (rw!=dl) - {; rw=dl; rwsp(1,rw); } else stopwalking(); - break; - case 'G': if (rw!=ul) - {; rw=ul; rwsp(1,rw); } else stopwalking(); - break; - case 'L': stopwalking(); break; - } - }} -} - -void fliproom(byte room,byte ped) -{; - dusk; tr[1].putback(); dna.room=room; load(room); apped(1,ped); - oldrw=dna.rw; dna.rw=tr[1].face; showrw; dawn; -} - -boolean infield(byte x) /* returns True if you're within field "x" */ -{ - integer ux,uy; -boolean infield_result; -; - { - triptype& with = tr[1]; - ; - ux=with.x; - uy=with.y+with.a.yl; - } - { - void& with = fields[x]; - ; - infield_result=(ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2); - } -return infield_result; -} - -boolean neardoor() /* returns True if you're near a door! */ -{ - integer ux,uy; byte fv; boolean nd; -boolean neardoor_result; -; - if (numfields<9) - {; /* there ARE no doors here! */ - neardoor_result=false; - return neardoor_result; - } - { - triptype& with = tr[1]; - ; - ux=with.x; - uy=with.y+with.a.yl; - } nd=false; - for( fv=9; fv <= numfields; fv ++) - { - void& with = fields[fv]; - ; - if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; - } - neardoor_result=nd; -return neardoor_result; +static void stopwalking() { + ; + tr[1].stopwalk(); + dna.rw = stopped; +} + +void tripkey(char dir) { + ; + { + triptype &with = tr[1]; + { + ; + switch (dir) { + case 'H': + if (rw != up) { + ; + rw = up; + rwsp(1, rw); + } else stopwalking(); + break; + case 'P': + if (rw != down) { + ; + rw = down; + rwsp(1, rw); + } else stopwalking(); + break; + case 'K': + if (rw != left) { + ; + rw = left; + rwsp(1, rw); + } else stopwalking(); + break; + case 'M': + if (rw != right) { + ; + rw = right; + rwsp(1, rw); + } else stopwalking(); + break; + case 'I': + if (rw != ur) { + ; + rw = ur; + rwsp(1, rw); + } else stopwalking(); + break; + case 'Q': + if (rw != dr) { + ; + rw = dr; + rwsp(1, rw); + } else stopwalking(); + break; + case 'O': + if (rw != dl) { + ; + rw = dl; + rwsp(1, rw); + } else stopwalking(); + break; + case 'G': + if (rw != ul) { + ; + rw = ul; + rwsp(1, rw); + } else stopwalking(); + break; + case 'L': + stopwalking(); + break; + } + } + } +} + +void fliproom(byte room, byte ped) { + ; + dusk; + tr[1].putback(); + dna.room = room; + load(room); + apped(1, ped); + oldrw = dna.rw; + dna.rw = tr[1].face; + showrw; + dawn; +} + +boolean infield(byte x) { /* returns True if you're within field "x" */ + integer ux, uy; + boolean infield_result; + ; + { + triptype &with = tr[1]; + ; + ux = with.x; + uy = with.y + with.a.yl; + } + { + void &with = fields[x]; + ; + infield_result = (ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2); + } + return infield_result; +} + +boolean neardoor() { /* returns True if you're near a door! */ + integer ux, uy; + byte fv; + boolean nd; + boolean neardoor_result; + ; + if (numfields < 9) { + ; /* there ARE no doors here! */ + neardoor_result = false; + return neardoor_result; + } + { + triptype &with = tr[1]; + ; + ux = with.x; + uy = with.y + with.a.yl; + } + nd = false; + for (fv = 9; fv <= numfields; fv ++) { + void &with = fields[fv]; + ; + if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; + } + neardoor_result = nd; + return neardoor_result; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h index 70782ee7dab2..eb5e7d28dc3d 100644 --- a/engines/avalanche/oldtrip.h +++ b/engines/avalanche/oldtrip.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -37,60 +37,63 @@ namespace Avalanche { const integer maxgetset = 10; struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; class triptype { public: - adxtype a; /* vital statistics */ - byte face,step; - integer x,y; /* current xy coords */ - integer ox,oy; /* last xy coords */ - integer tax,tay; /* "behind" taken at... */ - shortint ix,iy; /* amount to move sprite by, each step */ - matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ - boolean quick,visible,homing,check_me; - pointer behind; /* what's behind you */ - integer hx,hy; /* homing x & y coords */ - - triptype* init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen 1 */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx,integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for do_it, andexor, etc. */ - void do_it(); /* Actually copies the picture over */ - void getback(); /* gets background before sprite is drawn */ - void putback(); /* ...and wipes sprite from screen 1 */ - void walkto(integer xx,integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ + adxtype a; /* vital statistics */ + byte face, step; + integer x, y; /* current xy coords */ + integer ox, oy; /* last xy coords */ + integer tax, tay; /* "behind" taken at... */ + shortint ix, iy; /* amount to move sprite by, each step */ + matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ + boolean quick, visible, homing, check_me; + pointer behind; /* what's behind you */ + integer hx, hy; /* homing x & y coords */ + + triptype *init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen 1 */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx, integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for do_it, andexor, etc. */ + void do_it(); /* Actually copies the picture over */ + void getback(); /* gets background before sprite is drawn */ + void putback(); /* ...and wipes sprite from screen 1 */ + void walkto(integer xx, integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ }; class getsettype { public: - array<1,maxgetset,fieldtype> gs; - byte numleft; + array<1, maxgetset, fieldtype> gs; + byte numleft; - getsettype* init(); - void remember(fieldtype r); - void recall(); + getsettype *init(); + void remember(fieldtype r); + void recall(); }; const integer up = 0; const integer right = 1; const integer down = 2; const integer left = 3; -const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer ur = 4; +const integer dr = 5; +const integer dl = 6; +const integer ul = 7; const integer stopped = 8; const integer numtr = 5; /* current max no. of sprites */ @@ -101,9 +104,9 @@ void loadtrip(); void tripkey(char dir); -void apped(byte trn,byte np); +void apped(byte trn, byte np); -void fliproom(byte room,byte ped); +void fliproom(byte room, byte ped); boolean infield(byte x); /* returns True if you're within field "x" */ @@ -115,7 +118,7 @@ boolean neardoor(); /* returns True if you're near a door! */ #define EXTERN #endif -EXTERN array<1,numtr,triptype> tr; +EXTERN array<1, numtr, triptype> tr; #undef EXTERN #define EXTERN extern diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index c102b3f0ecfc..9cab8796f59e 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -36,170 +36,194 @@ namespace Avalanche { varying_string<5> st; byte fv; -void graphics() - { - integer gd,gm; ; gd=3; gm=0; initgraph(gd,gm,""); } +void graphics() { + integer gd, gm; ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); +} /*$F+ ... All ddm__procs and do__procs must be compiled in Far-Call state. */ -void ddm__file() -{; - {; - start_afresh; - opt("Load...",'L',"f3",true); - opt("Save...",'S',"f2",false); - opt("Save As...",'A',"ctrl-f2",false); - opt("OS Shell...",'O',"f2",true); - opt("Untrash screen",'U',"f11",true); - display; - } +void ddm__file() { + ; + { + ; + start_afresh; + opt("Load...", 'L', "f3", true); + opt("Save...", 'S', "f2", false); + opt("Save As...", 'A', "ctrl-f2", false); + opt("OS Shell...", 'O', "f2", true); + opt("Untrash screen", 'U', "f11", true); + display; + } } -void ddm__heart() -{; - {; - start_afresh; - opt("About...",'A',"shift-f10",true); - opt("Boss Key",'B',"alt-B",true); - opt("Help...",'H',"f1",true); - opt("Status screen",'S',"f12",true); - opt("Quit",'Q',"f10",true); - display; - } +void ddm__heart() { + ; + { + ; + start_afresh; + opt("About...", 'A', "shift-f10", true); + opt("Boss Key", 'B', "alt-B", true); + opt("Help...", 'H', "f1", true); + opt("Status screen", 'S', "f12", true); + opt("Quit", 'Q', "f10", true); + display; + } } -void ddm__action() -{; - {; - start_afresh; - opt("Get up",'G',"",true); - opt("Open door",'O',"",true); - opt("Pause game",'P',"",true); - opt("Look around",'L',"",true); - opt("Inventory",'I',"Tab",true); - opt("Do the boogie",'b',"",true); - display; - } +void ddm__action() { + ; + { + ; + start_afresh; + opt("Get up", 'G', "", true); + opt("Open door", 'O', "", true); + opt("Pause game", 'P', "", true); + opt("Look around", 'L', "", true); + opt("Inventory", 'I', "Tab", true); + opt("Do the boogie", 'b', "", true); + display; + } } -void ddm__objects() -{; - {; - start_afresh; - opt("Bell",'B',"",true); - opt("Wine",'W',"",true); - opt("Chastity Belt",'C',"",true); - opt("Crossbow Bolt",'t',"",true); - opt("Crossbow",'r',"",true); - opt("Potion",'P',"",true); - display; - } +void ddm__objects() { + ; + { + ; + start_afresh; + opt("Bell", 'B', "", true); + opt("Wine", 'W', "", true); + opt("Chastity Belt", 'C', "", true); + opt("Crossbow Bolt", 't', "", true); + opt("Crossbow", 'r', "", true); + opt("Potion", 'P', "", true); + display; + } } -void ddm__people() -{; - {; - start_afresh; - opt("Avalot",'A',"",true); - opt("Spludwick",'S',"",true); - opt("Arkata",'k',"",true); - opt("Dogfood",'D',"",true); - opt("Geida",'G',"",true); - display; - } +void ddm__people() { + ; + { + ; + start_afresh; + opt("Avalot", 'A', "", true); + opt("Spludwick", 'S', "", true); + opt("Arkata", 'k', "", true); + opt("Dogfood", 'D', "", true); + opt("Geida", 'G', "", true); + display; + } } -void ddm__use() -{; - {; - start_afresh; - opt("Drink",'D',"",true); - opt("Wear",'W',"",true); - opt("Give to [du Lustie]",'G',"",true); - display; - } +void ddm__use() { + ; + { + ; + start_afresh; + opt("Drink", 'D', "", true); + opt("Wear", 'W', "", true); + opt("Give to [du Lustie]", 'G', "", true); + display; + } } -void do__stuff() -{ - varying_string<2> st; -; - str(o.choicenum+1,st); - setfillstyle(1,6); setcolor(14); - bar(0,177,640,200); - outtextxy(320,177,string("You just chose: ")+st); +void do__stuff() { + varying_string<2> st; + ; + str(o.choicenum + 1, st); + setfillstyle(1, 6); + setcolor(14); + bar(0, 177, 640, 200); + outtextxy(320, 177, string("You just chose: ") + st); } -void do__heart() -{; - switch (o.choicenum) { - case 0: outtextxy(100,100,"A really funny game!"); break; - case 1: outtextxy(100,120,"You ought to be working!"); break; - case 2: outtextxy(100,140,"No help available, so THERE!"); break; - case 3: outtextxy(100,160,"Everything's COOL and FROODY!"); break; - case 4: exit(0); break; - } +void do__heart() { + ; + switch (o.choicenum) { + case 0: + outtextxy(100, 100, "A really funny game!"); + break; + case 1: + outtextxy(100, 120, "You ought to be working!"); + break; + case 2: + outtextxy(100, 140, "No help available, so THERE!"); + break; + case 3: + outtextxy(100, 160, "Everything's COOL and FROODY!"); + break; + case 4: + exit(0); + break; + } } /*$F- ... End of ddm__procs */ -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - graphics(); - setfillstyle(6,6); bar(0,0,639,199); - resetmouse; - m.init; o.init; - {; - create('H','\3','#',ddm__heart(),do__heart()); - create('F',"File",'!',ddm__file(),do__stuff()); - create('A',"Action",'\36',ddm__action(),do__stuff()); - create('O',"Objects",'\30',ddm__objects(),do__stuff()); - create('P',"People",'\31',ddm__people(),do__stuff()); - create('W',"With",'\21',ddm__use(),do__stuff()); - update; - } - do { - showmousecursor; - do { - getbuttonpressinfo(1); - getbuttonreleaseinfo(1); - getbuttonstatus; - if (menunow) o.lightup; - } while (!((buttonpresscount>0) || (buttonreleasecount>0) | keypressede)); - hidemousecursor; - if (buttonpresscount>0) - {; - if (mousey>10) - {; - if (! ((o.firstlix) & - ((mousex>=flx1) && (mousex<=flx2) && - (mousey>=12) && (mousey<=fly)))) - {; /* Clicked OUTSIDE the menu. */ - if (o.menunow) wipe; - setcolor(2); for( fv=1; fv <= 17; fv ++) circle(mousex,mousey,fv*3); - setcolor(0); for( fv=1; fv <= 17; fv ++) circle(mousex,mousey,fv*3); - } - } else - {; /* Clicked on menu bar */ - m.getmenu(mousex); - } - } else - {; /* NOT clicked button... */ - if (buttonreleasecount>0) - {; - if ((firstlix) & - ((mousex>=flx1) && (mousex<=flx2) && - (mousey>=12) && (mousey<=fly))) - select((mousey-14) / 10); - } else - {; /* NOT clicked or released button, so must be keypress */ - readkeye; - parsekey(inchar,extd); - } - } - } while (!false); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + graphics(); + setfillstyle(6, 6); + bar(0, 0, 639, 199); + resetmouse; + m.init; + o.init; + { + ; + create('H', '\3', '#', ddm__heart(), do__heart()); + create('F', "File", '!', ddm__file(), do__stuff()); + create('A', "Action", '\36', ddm__action(), do__stuff()); + create('O', "Objects", '\30', ddm__objects(), do__stuff()); + create('P', "People", '\31', ddm__people(), do__stuff()); + create('W', "With", '\21', ddm__use(), do__stuff()); + update; + } + do { + showmousecursor; + do { + getbuttonpressinfo(1); + getbuttonreleaseinfo(1); + getbuttonstatus; + if (menunow) o.lightup; + } while (!((buttonpresscount > 0) || (buttonreleasecount > 0) | keypressede)); + hidemousecursor; + if (buttonpresscount > 0) { + ; + if (mousey > 10) { + ; + if (!((o.firstlix) & + ((mousex >= flx1) && (mousex <= flx2) && + (mousey >= 12) && (mousey <= fly)))) { + ; /* Clicked OUTSIDE the menu. */ + if (o.menunow) wipe; + setcolor(2); + for (fv = 1; fv <= 17; fv ++) circle(mousex, mousey, fv * 3); + setcolor(0); + for (fv = 1; fv <= 17; fv ++) circle(mousex, mousey, fv * 3); + } + } else { + ; /* Clicked on menu bar */ + m.getmenu(mousex); + } + } else { + ; /* NOT clicked button... */ + if (buttonreleasecount > 0) { + ; + if ((firstlix) & + ((mousex >= flx1) && (mousex <= flx2) && + (mousey >= 12) && (mousey <= fly))) + select((mousey - 14) / 10); + } else { + ; /* NOT clicked or released button, so must be keypress */ + readkeye; + parsekey(inchar, extd); + } + } + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 2d8ae42d846f..94b3b0d34399 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -60,263 +60,309 @@ const integer disabled = lightgray; char r; byte fv; -void chalk(integer x,integer y, char t, string z) -{ - byte p; -; - outtextxy(x,y,z); - p=pos(t,z); if (p==0) return; p -= 1; - outtextxy(x+p*8,y+1,"_"); +void chalk(integer x, integer y, char t, string z) { + byte p; + ; + outtextxy(x, y, z); + p = pos(t, z); + if (p == 0) return; + p -= 1; + outtextxy(x + p * 8, y + 1, "_"); } -void say(integer x,integer y, char t, string z, byte f,byte b) -{; - settextjustify(0,2); setfillstyle(1,b); setcolor(f); - bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)+1); - chalk(x,y,t,z); +void say(integer x, integer y, char t, string z, byte f, byte b) { + ; + settextjustify(0, 2); + setfillstyle(1, b); + setcolor(f); + bar(x - 3, y - 1, x + textwidth(z) + 3, y + textheight(z) + 1); + chalk(x, y, t, z); } -void mblit(integer x1,integer y1,integer x2,integer y2, byte f,byte t) /* NOT The Minstrel Blitter */ -{ - pointer p,q; word s; -; - mark(q); - s=imagesize(x1,y1,x2,y2); getmem(p,s); - setactivepage(f); getimage(x1,y1,x2,y2,p); - setactivepage(t); putimage(x1,y1,p,0); - setactivepage(0); release(q); +void mblit(integer x1, integer y1, integer x2, integer y2, byte f, byte t) { /* NOT The Minstrel Blitter */ + pointer p, q; + word s; + ; + mark(q); + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + setactivepage(f); + getimage(x1, y1, x2, y2, p); + setactivepage(t); + putimage(x1, y1, p, 0); + setactivepage(0); + release(q); } -void onemenu::start_afresh() -{; - number=0; width=0; firstlix=false; oldy=0; highlightnum=0; +void onemenu::start_afresh() { + ; + number = 0; + width = 0; + firstlix = false; + oldy = 0; + highlightnum = 0; } -onemenu* onemenu::init() -{; - menunow=false; - return this; +onemenu *onemenu::init() { + ; + menunow = false; + return this; } -void onemenu::opt(string n, char tr, string key, boolean val) -{ - integer l; -; - number += 1; - l=textwidth(n+key)+30; if (width"") outtextxy(flx2,4+y*10,with.shortcut); - settextjustify(0,2); - chalk(left+3,4+y*10,with.trigger,with.title); - } +void onemenu::displayopt(byte y, byte b, byte f, byte d) { + ; + { + optiontype &with = oo[y]; + ; + if (with.valid) setcolor(f); + else setcolor(d); + if (b != 177) { + ; + setfillstyle(1, b); + bar(flx1, 3 + y * 10, flx2, 12 + y * 10); + } + settextjustify(2, 2); + if (with.shortcut > "") outtextxy(flx2, 4 + y * 10, with.shortcut); + settextjustify(0, 2); + chalk(left + 3, 4 + y * 10, with.trigger, with.title); + } } -void onemenu::display() -{ - byte y; -; - setfillstyle(1,menu_b); setcolor(menu_border); - firstlix=true; - flx1=left-2; flx2=left+width; fly=14+number*10; - mblit(flx1-3,11,flx2+1,fly+1,0,1); - menunow=true; - - bar(flx1,12,flx2,fly); - rectangle(flx1-1,11,flx2+1,fly+1); - - setcolor(menu_f); settextjustify(0,2); - displayopt(1,highlight_b,highlight_f,177); - for( y=2; y <= number; y ++) - { optiontype& with = oo[y]; displayopt(y,177,menu_f,disabled);} +void onemenu::display() { + byte y; + ; + setfillstyle(1, menu_b); + setcolor(menu_border); + firstlix = true; + flx1 = left - 2; + flx2 = left + width; + fly = 14 + number * 10; + mblit(flx1 - 3, 11, flx2 + 1, fly + 1, 0, 1); + menunow = true; + + bar(flx1, 12, flx2, fly); + rectangle(flx1 - 1, 11, flx2 + 1, fly + 1); + + setcolor(menu_f); + settextjustify(0, 2); + displayopt(1, highlight_b, highlight_f, 177); + for (y = 2; y <= number; y ++) { + optiontype &with = oo[y]; + displayopt(y, 177, menu_f, disabled); + } } -void onemenu::wipe() -{; - { headtype& with = m.ddms[o.menunum]; say(flx1+2,1,with.trigger,with.title,menu_f,menu_b);} - mblit(flx1-3,11,flx2+1,fly+1,1,0); - menunow=false; firstlix=false; +void onemenu::wipe() { + ; + { + headtype &with = m.ddms[o.menunum]; + say(flx1 + 2, 1, with.trigger, with.title, menu_f, menu_b); + } + mblit(flx1 - 3, 11, flx2 + 1, fly + 1, 1, 0); + menunow = false; + firstlix = false; } -void onemenu::movehighlight(shortint add) -{ - shortint hn; -; - if (add!=0) - {; - hn=highlightnum+add; - if ((hn<0) || (hn>=(unsigned char)number)) return; - highlightnum=hn; - } - hidemousecursor; - displayopt(oldy+1,menu_b,menu_f,disabled); - displayopt(highlightnum+1,highlight_b,highlight_f,disabled); - showmousecursor; - oldy=highlightnum; +void onemenu::movehighlight(shortint add) { + shortint hn; + ; + if (add != 0) { + ; + hn = highlightnum + add; + if ((hn < 0) || (hn >= (unsigned char)number)) return; + highlightnum = hn; + } + hidemousecursor; + displayopt(oldy + 1, menu_b, menu_f, disabled); + displayopt(highlightnum + 1, highlight_b, highlight_f, disabled); + showmousecursor; + oldy = highlightnum; } -void onemenu::lightup() /* This makes the menu highlight follow the mouse.*/ -{; - if ((mousexflx2) - || (mousey<=12) || (mousey>fly-3)) return; - highlightnum=(mousey-12) / 10; - if (highlightnum==oldy) return; - movehighlight(0); +void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ + ; + if ((mousex < flx1) || (mousex > flx2) + || (mousey <= 12) || (mousey > fly - 3)) return; + highlightnum = (mousey - 12) / 10; + if (highlightnum == oldy) return; + movehighlight(0); } -void onemenu::select(byte n) /* Choose which one you want. */ -{; - if (! oo[n+1].valid) return; - choicenum=n; - m.ddms[menunum].do_choose(); - wipe(); +void onemenu::select(byte n) { /* Choose which one you want. */ + ; + if (! oo[n + 1].valid) return; + choicenum = n; + m.ddms[menunum].do_choose(); + wipe(); } -void onemenu::keystroke(char c) -{ - byte fv; -; - c=upcase(c); - for( fv=1; fv <= number; fv ++) - if (upcase(oo[fv].trigger)==c) select(fv-1); +void onemenu::keystroke(char c) { + byte fv; + ; + c = upcase(c); + for (fv = 1; fv <= number; fv ++) + if (upcase(oo[fv].trigger) == c) select(fv - 1); } -void bleep() -{; - sound(177); delay(7); nosound; +void bleep() { + ; + sound(177); + delay(7); + nosound; } - headtype* headtype::init - (char trig,char alttrig, string name, byte p, proc dw,proc dc) - {; - trigger=trig; alttrigger=alttrig; title=name; - position=p; xpos=(position-1)*spacing+indent; - xright=xpos+textwidth(name)+3; - do_setup=dw; do_choose=dc; - return this; - } - - void headtype::display() - {; - say(xpos,1,trigger,title,menu_f,menu_b); - } - - void headtype::highlight() - {; - say(xpos,1,trigger,title,highlight_f,highlight_b); - {; - o.left=xpos; - o.menunow=true; o.menunum=position; - } - } - - boolean headtype::extdparse(char c) - {boolean extdparse_result; - ; - if (c!=alttrigger) {; extdparse_result=true; return extdparse_result; } - extdparse_result=false; - return extdparse_result; - } - - menuset* menuset::init() - {; - howmany=0; - return this; - } - - void menuset::create(char t, string n, char alttrig, proc dw,proc dc) - {; - howmany += 1; - ddms[howmany].init(t,alttrig,n,howmany,dw,dc); - } - - void menuset::update() - { - byte fv; - ; - setfillstyle(1,menu_b); bar(0,0,640,10); - for( fv=1; fv <= howmany; fv ++) ddms[fv].display(); - } - - void menuset::extd(char c) - { - byte fv; - ; - fv=1; - while ((fv<=howmany) && (ddms[fv].extdparse(c))) fv += 1; - if (fv>howmany) return; getmenu(fv*spacing-indent); - } - - void menuset::getmenu(integer x) - { - byte fv; - ; - fv=0; - do { - fv += 1; - if ((x>ddms[fv].xpos-3) && (xhowmany)); - } - -void parsekey(char r,char re) -{; - switch (r) { - case '\0': {; - switch (re) { - case 'K': {; - wipe(); - m.getmenu((o.menunum-2)*spacing+indent); - } - break; - case 'M': {; - wipe(); - m.getmenu((o.menunum*spacing+indent)); - } - break; - case 'H': movehighlight(-1); break; - case 'P': movehighlight(1); break; - default: m.extd(re); - } - } - break; - case '\33': if (o.menunow) wipe(); break; - case '\15': select(o.highlightnum); break; - default: - {; - if (o.menunow) keystroke(r); else - kbuffer=kbuffer+r+re; - } - } +headtype *headtype::init +(char trig, char alttrig, string name, byte p, proc dw, proc dc) { + ; + trigger = trig; + alttrigger = alttrig; + title = name; + position = p; + xpos = (position - 1) * spacing + indent; + xright = xpos + textwidth(name) + 3; + do_setup = dw; + do_choose = dc; + return this; +} + +void headtype::display() { + ; + say(xpos, 1, trigger, title, menu_f, menu_b); +} + +void headtype::highlight() { + ; + say(xpos, 1, trigger, title, highlight_f, highlight_b); + { + ; + o.left = xpos; + o.menunow = true; + o.menunum = position; + } +} + +boolean headtype::extdparse(char c) { + boolean extdparse_result; + ; + if (c != alttrigger) { + ; + extdparse_result = true; + return extdparse_result; + } + extdparse_result = false; + return extdparse_result; +} + +menuset *menuset::init() { + ; + howmany = 0; + return this; +} + +void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { + ; + howmany += 1; + ddms[howmany].init(t, alttrig, n, howmany, dw, dc); +} + +void menuset::update() { + byte fv; + ; + setfillstyle(1, menu_b); + bar(0, 0, 640, 10); + for (fv = 1; fv <= howmany; fv ++) ddms[fv].display(); +} + +void menuset::extd(char c) { + byte fv; + ; + fv = 1; + while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; + if (fv > howmany) return; + getmenu(fv * spacing - indent); +} + +void menuset::getmenu(integer x) { + byte fv; + ; + fv = 0; + do { + fv += 1; + if ((x > ddms[fv].xpos - 3) && (x < ddms[fv].xright)) { + headtype &with = ddms[fv]; + { + ; + if (o.menunow) { + ; + wipe(); /* get rid of menu */ + if (o.menunum == with.position) return; /* click on own highlight */ + } + highlight(); + do_setup(); + return; + } + } + } while (!(fv > howmany)); +} + +void parsekey(char r, char re) { + ; + switch (r) { + case '\0': { + ; + switch (re) { + case 'K': { + ; + wipe(); + m.getmenu((o.menunum - 2)*spacing + indent); + } + break; + case 'M': { + ; + wipe(); + m.getmenu((o.menunum * spacing + indent)); + } + break; + case 'H': + movehighlight(-1); + break; + case 'P': + movehighlight(1); + break; + default: + m.extd(re); + } + } + break; + case '\33': + if (o.menunow) wipe(); + break; + case '\15': + select(o.highlightnum); + break; + default: { + ; + if (o.menunow) keystroke(r); + else + kbuffer = kbuffer + r + re; + } + } } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h index 32f171e82452..b80b5ad31d76 100644 --- a/engines/avalanche/oopmenu.h +++ b/engines/avalanche/oopmenu.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,61 +34,61 @@ typedef void(*proc)(); class headtype { public: - varying_string<8> title; - char trigger,alttrigger; - byte position; - integer xpos,xright; - proc do_setup,do_choose; - - headtype* init - (char trig,char alttrig, string name, byte p, proc dw,proc dc); - void display(); - void highlight(); - boolean extdparse(char c); + varying_string<8> title; + char trigger, alttrigger; + byte position; + integer xpos, xright; + proc do_setup, do_choose; + + headtype *init + (char trig, char alttrig, string name, byte p, proc dw, proc dc); + void display(); + void highlight(); + boolean extdparse(char c); }; struct optiontype { - string title; - char trigger; - varying_string<9> shortcut; - boolean valid; + string title; + char trigger; + varying_string<9> shortcut; + boolean valid; }; class onemenu { public: - array<1,12,optiontype> oo; - byte number; - integer width,left; - boolean firstlix; - integer flx1,flx2,fly; - byte oldy; /* used by Lightup */ - boolean menunow; /* Is there a menu now? */ - byte menunum; /* And if so, which is it? */ - byte choicenum; /* Your choice? */ - byte highlightnum; - - void start_afresh(); - void opt(string n, char tr, string key, boolean val); - void display(); - void wipe(); - void lightup(); - void displayopt(byte y,byte b,byte f,byte d); - void movehighlight(shortint add); - void select(byte n); - void keystroke(char c); - onemenu* init(); + array<1, 12, optiontype> oo; + byte number; + integer width, left; + boolean firstlix; + integer flx1, flx2, fly; + byte oldy; /* used by Lightup */ + boolean menunow; /* Is there a menu now? */ + byte menunum; /* And if so, which is it? */ + byte choicenum; /* Your choice? */ + byte highlightnum; + + void start_afresh(); + void opt(string n, char tr, string key, boolean val); + void display(); + void wipe(); + void lightup(); + void displayopt(byte y, byte b, byte f, byte d); + void movehighlight(shortint add); + void select(byte n); + void keystroke(char c); + onemenu *init(); }; class menuset { public: - array<1,8,headtype> ddms; - byte howmany; - - menuset* init(); - void create(char t, string n, char alttrig, proc dw,proc dc); - void update(); - void extd(char c); - void getmenu(integer x); + array<1, 8, headtype> ddms; + byte howmany; + + menuset *init(); + void create(char t, string n, char alttrig, proc dw, proc dc); + void update(); + void extd(char c); + void getmenu(integer x); }; @@ -105,7 +105,7 @@ EXTERN string kbuffer; #define EXTERN extern - void parsekey(char r,char re); +void parsekey(char r, char re); } // End of namespace Avalanche. diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index 14d5dc8a17cb..3c72e1178b70 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,52 +30,62 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -void flash(integer x1,integer y1,integer x2,integer y2) -{; - setcolor(14); rectangle(x1,y1,x2,y2); - sound(x1+x2); delay(100); nosound; delay(500); - setcolor( 9); rectangle(x1,y1,x2,y2); delay(500); +void flash(integer x1, integer y1, integer x2, integer y2) { + ; + setcolor(14); + rectangle(x1, y1, x2, y2); + sound(x1 + x2); + delay(100); + nosound; + delay(500); + setcolor(9); + rectangle(x1, y1, x2, y2); + delay(500); } -boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{boolean dropin_result; -; - dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); -return dropin_result; +{ + boolean dropin_result; + ; + dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); + return dropin_result; } -void test(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) -{; - cleardevice(); - rectangle(x1,y1,x2,y2); - rectangle(x3,y3,x4,y4); - flash(x1,y1,x2,y2); - flash(x3,y3,x4,y4); +void test(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) { + ; + cleardevice(); + rectangle(x1, y1, x2, y2); + rectangle(x3, y3, x4, y4); + flash(x1, y1, x2, y2); + flash(x3, y3, x4, y4); - if (dropin(x3,y3,x1,y1,x2,y2) - || dropin(x3,y4,x1,y1,x2,y2) - || dropin(x4,y3,x1,y1,x2,y2) - || dropin(x4,y4,x1,y1,x2,y2)) - {; /* Overlaps */ - flash(x1,y1,x4,y4); - } else - {; /* Doesn't overlap- flash 'em both again */ - flash(x3,y3,x4,y4); /* backwards- why not...? */ - flash(x1,y1,x2,y2); - } + if (dropin(x3, y3, x1, y1, x2, y2) + || dropin(x3, y4, x1, y1, x2, y2) + || dropin(x4, y3, x1, y1, x2, y2) + || dropin(x4, y4, x1, y1, x2, y2)) { + ; /* Overlaps */ + flash(x1, y1, x4, y4); + } else { + ; /* Doesn't overlap- flash 'em both again */ + flash(x3, y3, x4, y4); /* backwards- why not...? */ + flash(x1, y1, x2, y2); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=1; initgraph(gd,gm,""); setcolor(9); - test(100,50,200,100,400,200,600,250); - test(100,50,200,100,120, 70,220,120); - test(100,50,200,100,150, 50,250,100); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + setcolor(9); + test(100, 50, 200, 100, 400, 200, 600, 250); + test(100, 50, 200, 100, 120, 70, 220, 120); + test(100, 50, 200, 100, 150, 50, 250, 100); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index 9617e2efb4f7..58ab27041932 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,53 +29,64 @@ namespace Avalanche { -integer gd,gm; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - setactivepage(1); setcolor(9); - settextstyle(0,0,2); - outtextxy(0, 0,"This is a test to see whether you can"); - outtextxy(0, 20,"scroll text over the top of a picture."); - outtextxy(0, 40,"I was wondering whether it would work."); - outtextxy(0, 60,"Well, does it, or not?"); - outtextxy(0, 80,"If so, it could be useful for the"); - outtextxy(0,100,"Avalot title sequence."); - outtextxy(0,120,"Good, isn't it?"); - outtextxy(0,140,"The quick brown fox jumps over the"); - outtextxy(0,160,"lazy dog..."); - outtextxy(0,180,"This is the last line..."); - setactivepage(0); - gm=0; - for( gd=0; gd <= 640; gd ++) - {; - gm += 1; if (gm==8) gm=1; setcolor(gm); - line(gd,0,gm,350); - line(640-gd,0,640-gm,350); - } -/* for gd:=1 to 15 do - begin; - setfillstyle(1,gd); bar(gd*20,10,gd*20+19,100); - end;*/ -/* setfillstyle(1,6); bar(100,100,500,100);*/ gd=getpixel(0,0); - for( gm=8; gm <= 15; gm ++) setpalette(gm,egayellow); - for( gd=0; gd <= 199; gd ++) - {; - port[0x3c4]=2; port[0x3cf]=4; port[0x3c5]=8; port[0x3cf]=0; - move(mem[0xa000*80],mem[0xa000*0],16000); - port[0x3c4]=2; port[0x3cf]=4; port[0x3c5]=8; port[0x3cf]=0; - move(mem[0xa000*gd*80+16384],mem[0xa000*15920],80); - } -/* for gd:=0 to 199 do - begin; - port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; - move(mem[$A000*160],mem[$A000*0],15920); - port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; - move(mem[$A000*gd*80+16384],mem[$A000*15920],80); - move(mem[$A000*15920],mem[$A000*15840],80); - end;*/ -return EXIT_SUCCESS; +integer gd, gm; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + setactivepage(1); + setcolor(9); + settextstyle(0, 0, 2); + outtextxy(0, 0, "This is a test to see whether you can"); + outtextxy(0, 20, "scroll text over the top of a picture."); + outtextxy(0, 40, "I was wondering whether it would work."); + outtextxy(0, 60, "Well, does it, or not?"); + outtextxy(0, 80, "If so, it could be useful for the"); + outtextxy(0, 100, "Avalot title sequence."); + outtextxy(0, 120, "Good, isn't it?"); + outtextxy(0, 140, "The quick brown fox jumps over the"); + outtextxy(0, 160, "lazy dog..."); + outtextxy(0, 180, "This is the last line..."); + setactivepage(0); + gm = 0; + for (gd = 0; gd <= 640; gd ++) { + ; + gm += 1; + if (gm == 8) gm = 1; + setcolor(gm); + line(gd, 0, gm, 350); + line(640 - gd, 0, 640 - gm, 350); + } + /* for gd:=1 to 15 do + begin; + setfillstyle(1,gd); bar(gd*20,10,gd*20+19,100); + end;*/ + /* setfillstyle(1,6); bar(100,100,500,100);*/ gd = getpixel(0, 0); + for (gm = 8; gm <= 15; gm ++) setpalette(gm, egayellow); + for (gd = 0; gd <= 199; gd ++) { + ; + port[0x3c4] = 2; + port[0x3cf] = 4; + port[0x3c5] = 8; + port[0x3cf] = 0; + move(mem[0xa000 * 80], mem[0xa000 * 0], 16000); + port[0x3c4] = 2; + port[0x3cf] = 4; + port[0x3c5] = 8; + port[0x3cf] = 0; + move(mem[0xa000 * gd * 80 + 16384], mem[0xa000 * 15920], 80); + } + /* for gd:=0 to 199 do + begin; + port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; + move(mem[$A000*160],mem[$A000*0],15920); + port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; + move(mem[$A000*gd*80+16384],mem[$A000*15920],80); + move(mem[$A000*15920],mem[$A000*15840],80); + end;*/ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index bcccdb9bb863..b6b830542bad 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,17 +32,17 @@ namespace Avalanche { -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; struct markertype { - word length; - longint offset; - byte checksum; + word length; + longint offset; + byte checksum; }; string rawname; -array<0,1999,char> buffer,was; -word bufpos,bufsize; +array<0, 1999, char> buffer, was; +word bufpos, bufsize; fonttype font; integer cpos; char r; @@ -50,212 +50,299 @@ boolean ok; const char marker = '\33'; -void cursor() -{ - byte fv; -; - for( fv=12; fv <= 15; fv ++) - mem[0xa000*cpos+fv*80]=~(mem[0xa000*cpos+fv*80]); +void cursor() { + byte fv; + ; + for (fv = 12; fv <= 15; fv ++) + mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); } -void xy() -{; - cpos=(bufpos / 80)*1280+(bufpos % 80); +void xy() { + ; + cpos = (bufpos / 80) * 1280 + (bufpos % 80); } -void show() -{ - word fv,orig,y; -; - for( fv=0; fv <= 1999; fv ++) - if (buffer[fv]!=was[fv]) - {; - orig=(fv / 80)*1280+(fv % 80); - for( y=0; y <= 15; y ++) - mem[0xa000*orig+y*80]=(byte)(font[buffer[fv]][y]); - } - xy(); - move(buffer,was,sizeof(buffer)); +void show() { + word fv, orig, y; + ; + for (fv = 0; fv <= 1999; fv ++) + if (buffer[fv] != was[fv]) { + ; + orig = (fv / 80) * 1280 + (fv % 80); + for (y = 0; y <= 15; y ++) + mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); + } + xy(); + move(buffer, was, sizeof(buffer)); } -void sizeup() -{; - do { - switch (buffer[bufsize]) { - case marker: return; break; /* we've found it OK! */ - case '\0': bufsize -= 1; break; - default: bufsize += 1; - } - } while (!false); +void sizeup() { + ; + do { + switch (buffer[bufsize]) { + case marker: + return; + break; /* we've found it OK! */ + case '\0': + bufsize -= 1; + break; + default: + bufsize += 1; + } + } while (!false); } -void graphics() -{ - integer gd,gm; - file fontfile; -; - gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); - assign(fontfile,"c:\\thomas\\lanche.fnt"); - reset(fontfile); fontfile >> font; close(fontfile); +void graphics() { + integer gd, gm; + file fontfile; + ; + gd = 3; + gm = 1; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(fontfile, "c:\\thomas\\lanche.fnt"); + reset(fontfile); + fontfile >> font; + close(fontfile); } void helpscreen(); -static byte l,fv; +static byte l, fv; -static void addon(char b, string st) -{; - buffer[3+80*l]=b; b -= 64; - buffer[5+80*l]=b; - move(st[1],buffer[7+80*l],length(st)); - l += 1; +static void addon(char b, string st) { + ; + buffer[3 + 80 * l] = b; + b -= 64; + buffer[5 + 80 * l] = b; + move(st[1], buffer[7 + 80 * l], length(st)); + l += 1; } -void helpscreen() -{ - array<0,1999,char> temp; - char r; -; - l=0; move(buffer,temp,2000); fillchar(buffer,sizeof(buffer),'\0'); - addon('B',"Bubble"); - addon('C',"Centre text"); - addon('D',"Don't add \20 (at end)"); - addon('F',"Italic Font"); - addon('G',"Bell"); - addon('H',"Not allocated (=backspace)"); - addon('I',"Not allocated (=tab)"); - addon('L',"Left-justify text"); - addon('K',"Keyboard input"); - addon('M',"Carriage return (same as \r key)"); - addon('P',"Scroll (Paragraph break)"); - addon('Q',"Yes/no scroll (question)"); - addon('R',"Roman font"); - addon('S',"Fix to sprite"); - addon('U',"Money (in sd format)"); - addon('V',"View icon (number from ^S)"); - show(); do { r=readkey(); } while (!(! keypressed())); - cleardevice(); - fillchar(was,sizeof(was),'\0'); move(temp,buffer,2000); show(); +void helpscreen() { + array<0, 1999, char> temp; + char r; + ; + l = 0; + move(buffer, temp, 2000); + fillchar(buffer, sizeof(buffer), '\0'); + addon('B', "Bubble"); + addon('C', "Centre text"); + addon('D', "Don't add \20 (at end)"); + addon('F', "Italic Font"); + addon('G', "Bell"); + addon('H', "Not allocated (=backspace)"); + addon('I', "Not allocated (=tab)"); + addon('L', "Left-justify text"); + addon('K', "Keyboard input"); + addon('M', "Carriage return (same as \r key)"); + addon('P', "Scroll (Paragraph break)"); + addon('Q', "Yes/no scroll (question)"); + addon('R', "Roman font"); + addon('S', "Fix to sprite"); + addon('U', "Money (in sd format)"); + addon('V', "View icon (number from ^S)"); + show(); + do { + r = readkey(); + } while (!(! keypressed())); + cleardevice(); + fillchar(was, sizeof(was), '\0'); + move(temp, buffer, 2000); + show(); } void edit_it(); -static void legit(char r) -{; /* it's a legit keystroke */ - move(buffer[bufpos],buffer[bufpos+1],1999-bufpos); - buffer[bufpos]=r; - bufpos += 1; show(); +static void legit(char r) { + ; /* it's a legit keystroke */ + move(buffer[bufpos], buffer[bufpos + 1], 1999 - bufpos); + buffer[bufpos] = r; + bufpos += 1; + show(); } -void edit_it() -{ - byte fv; -; - bufpos=0; - fillchar(was,sizeof(was),'\0'); show(); - do { - cursor(); r=readkey(); cursor(); - switch (r) { - case '\0': switch (readkey()) { /* extd keystrokes */ - case 'K': if (bufpos>0) {; bufpos -= 1; xy(); } break; /* Left */ - case 'M': if (bufpos80) {; bufpos -= 80; xy(); } break; /* Up */ - case 'P': if (bufpos<(cardinal)bufsize-79) {; bufpos += 80; xy(); } break; /* Down */ - case 's': if (bufpos>10) {; bufpos -= 10; xy(); } break; - case 't': if (bufpos<(cardinal)bufsize-10) {; bufpos += 10; xy(); } break; - case 'G': {; bufpos=0; xy(); } break; /* Home */ - case 'O': {; bufpos=bufsize; xy(); } break; /* End */ - case 'S': if (bufpos0) {; /* backspace */ - bufpos -= 1; - move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); - show(); - } - break; - case '\33': {; - restorecrtmode(); - return; - } - break; /* end of editing */ - default: legit(r); - } - sizeup(); - } while (!false); +void edit_it() { + byte fv; + ; + bufpos = 0; + fillchar(was, sizeof(was), '\0'); + show(); + do { + cursor(); + r = readkey(); + cursor(); + switch (r) { + case '\0': + switch (readkey()) { /* extd keystrokes */ + case 'K': + if (bufpos > 0) { + ; + bufpos -= 1; + xy(); + } + break; /* Left */ + case 'M': + if (bufpos < bufsize) { + ; + bufpos += 1; + xy(); + } + break; /* Right */ + case 'H': + if (bufpos > 80) { + ; + bufpos -= 80; + xy(); + } + break; /* Up */ + case 'P': + if (bufpos < (cardinal)bufsize - 79) { + ; + bufpos += 80; + xy(); + } + break; /* Down */ + case 's': + if (bufpos > 10) { + ; + bufpos -= 10; + xy(); + } + break; + case 't': + if (bufpos < (cardinal)bufsize - 10) { + ; + bufpos += 10; + xy(); + } + break; + case 'G': { + ; + bufpos = 0; + xy(); + } + break; /* Home */ + case 'O': { + ; + bufpos = bufsize; + xy(); + } + break; /* End */ + case 'S': + if (bufpos < bufsize) { + ; /* Del */ + move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); + show(); + } + break; + case ';': + helpscreen(); + break; + case 'A': + legit('\357'); + break; /* copyright symbol */ + case 'B': + legit('\221'); + break; /* uppercase AE */ + case 'C': + legit('\222'); + break; /* lowercase AE */ + } + break; + case '\10': + if (bufpos > 0) { + ; /* backspace */ + bufpos -= 1; + move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); + show(); + } + break; + case '\33': { + ; + restorecrtmode(); + return; + } + break; /* end of editing */ + default: + legit(r); + } + sizeup(); + } while (!false); } -void loadit() -{ - untyped_file f; -; - if (pos(".",rawname)==0) rawname=rawname+".raw"; - fillchar(buffer,sizeof(buffer),'\0'); - /*$I-*/ - assign(f,rawname); - reset(f,1); - if (ioresult!=0) - {; - output << string('\7')+"New file!"+'\7' << NL; - buffer[0]=marker; - return; - } - bufsize=filesize(f); - blockread(f,buffer,bufsize); - close(f); - while (buffer[bufsize]=='\0') bufsize -= 1; - if (buffer[bufsize]!=marker) - {; /* add on a marker */ - bufsize += 1; - buffer[bufsize]=marker; - } +void loadit() { + untyped_file f; + ; + if (pos(".", rawname) == 0) rawname = rawname + ".raw"; + fillchar(buffer, sizeof(buffer), '\0'); + /*$I-*/ + assign(f, rawname); + reset(f, 1); + if (ioresult != 0) { + ; + output << string('\7') + "New file!" + '\7' << NL; + buffer[0] = marker; + return; + } + bufsize = filesize(f); + blockread(f, buffer, bufsize); + close(f); + while (buffer[bufsize] == '\0') bufsize -= 1; + if (buffer[bufsize] != marker) { + ; /* add on a marker */ + bufsize += 1; + buffer[bufsize] = marker; + } } -void saveit() -{ - untyped_file f; -; - output << "Saving " << rawname << ", " << bufsize << " bytes..." << NL; - assign(f,rawname); rewrite(f,1); - blockwrite(f,buffer,bufsize); - close(f); +void saveit() { + untyped_file f; + ; + output << "Saving " << rawname << ", " << bufsize << " bytes..." << NL; + assign(f, rawname); + rewrite(f, 1); + blockwrite(f, buffer, bufsize); + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - output << "Filename of .RAW file?"; input >> rawname >> NL; - loadit(); - ok=false; - do { - graphics(); - edit_it(); - output << "Now what?" << NL; - output << NL; - output << " Filename: " << rawname << NL; - output << " Size of text: " << bufsize << NL; - output << " Cursor position: " << bufpos << NL; - output << NL; - output << " C) Cancel this & continue edit" << NL; - output << " S) Save under current name" << NL; - output << " A) Save under a different name" << NL; - output << " X) Exit & lose all changes." << NL; - output << NL; - output << "Pick one!" << NL; - do { r=upcase(readkey()); } while (!(set::of('C','S','A','X', eos).has(r))); - switch (r) { - case 'X': ok=true; break; - case 'S': {; saveit(); exit(0); } break; - } - } while (!ok); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + output << "Filename of .RAW file?"; + input >> rawname >> NL; + loadit(); + ok = false; + do { + graphics(); + edit_it(); + output << "Now what?" << NL; + output << NL; + output << " Filename: " << rawname << NL; + output << " Size of text: " << bufsize << NL; + output << " Cursor position: " << bufpos << NL; + output << NL; + output << " C) Cancel this & continue edit" << NL; + output << " S) Save under current name" << NL; + output << " A) Save under a different name" << NL; + output << " X) Exit & lose all changes." << NL; + output << NL; + output << "Pick one!" << NL; + do { + r = upcase(readkey()); + } while (!(set::of('C', 'S', 'A', 'X', eos).has(r))); + switch (r) { + case 'X': + ok = true; + break; + case 'S': { + ; + saveit(); + exit(0); + } + break; + } + } while (!ok); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index cbc84748283d..261e59297f1c 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,62 +31,74 @@ namespace Avalanche { const integer picsize = 966; -integer gd,gm; +integer gd, gm; untyped_file f; pointer p; -void save() -{ - varying_string<40> adf; untyped_file f; byte z; array<1,2,pointer> c; -string nam,screenname; - const string header = - string("This is a file from an Avvy game, and its contents are subject to ")+ - "copyright."+'\15'+'\12'+'\15'+'\12'+"Have fun!"+'\32'; - byte a /*absolute $A000:1200i*/; - byte bit; -; - nam="d:thingtmp.avd"; - screenname="Temp."; - assign(f,nam); - - assign(f,nam); rewrite(f,1); blockwrite(f,header[1],146); - blockwrite(f,screenname,31); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,a,12080); - } - close(f); +void save() { + varying_string<40> adf; + untyped_file f; + byte z; + array<1, 2, pointer> c; + string nam, screenname; + const string header = + string("This is a file from an Avvy game, and its contents are subject to ") + + "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; + byte a /*absolute $A000:1200i*/; + byte bit; + ; + nam = "d:thingtmp.avd"; + screenname = "Temp."; + assign(f, nam); + + assign(f, nam); + rewrite(f, 1); + blockwrite(f, header[1], 146); + blockwrite(f, screenname, 31); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, a, 12080); + } + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - - assign(f,"thinks.avd"); - getmem(p,picsize); - reset(f,1); - seek(f,65); - gd=10; gm=20; - - while (gm<120) - {; - if (! eof(f)) - blockread(f,p,picsize); - putimage(gd,gm,p,0); - gd += 70; - - if (gd==640) - {; - gd=10; gm += 40; - } - - } - - close(f); freemem(p,picsize); - save(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + + assign(f, "thinks.avd"); + getmem(p, picsize); + reset(f, 1); + seek(f, 65); + gd = 10; + gm = 20; + + while (gm < 120) { + ; + if (! eof(f)) + blockread(f, p, picsize); + putimage(gd, gm, p, 0); + gd += 70; + + if (gd == 640) { + ; + gd = 10; + gm += 40; + } + + } + + close(f); + freemem(p, picsize); + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index f0ebccde0313..8d5cdfe4c29f 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,60 +33,70 @@ namespace Avalanche { const integer picsize = 966; const integer number_of_objects = 17; -const array<1,65,char> thinks_header = - string("This is an Avalot file, which is subject to copyright. Have fun.")+'\32'; +const array<1, 65, char> thinks_header = + string("This is an Avalot file, which is subject to copyright. Have fun.") + '\32'; -integer gd,gm; +integer gd, gm; untyped_file f; pointer p; byte noo; -void load() -{ - byte a0 /*absolute $A000:1200*/; - byte bit; - untyped_file f; -; - assign(f,"d:thingtmp.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); bit=getpixel(0,0); +void load() { + byte a0 /*absolute $A000:1200*/; + byte bit; + untyped_file f; + ; + assign(f, "d:thingtmp.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - - load(); noo=0; - - assign(f,"thinks.avd"); - getmem(p,picsize); - rewrite(f,1); - blockwrite(f,thinks_header,65); - gd=10; gm=20; - - while (noo<=number_of_objects) - {; - getimage(gd,gm,gd+59,gm+29,p); - putimage(gd,gm,p,notput); - blockwrite(f,p,picsize); - gd += 70; - - if (gd==640) - {; - gd=10; gm += 40; - } - - noo += 1; - } - - close(f); freemem(p,picsize); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + + load(); + noo = 0; + + assign(f, "thinks.avd"); + getmem(p, picsize); + rewrite(f, 1); + blockwrite(f, thinks_header, 65); + gd = 10; + gm = 20; + + while (noo <= number_of_objects) { + ; + getimage(gd, gm, gd + 59, gm + 29, p); + putimage(gd, gm, p, notput); + blockwrite(f, p, picsize); + gd += 70; + + if (gd == 640) { + ; + gd = 10; + gm += 40; + } + + noo += 1; + } + + close(f); + freemem(p, picsize); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 2c68a8c3a94c..df50cb0b9412 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -47,10 +47,12 @@ namespace Avalanche { -void dplot(integer x,integer y, string z) -{; - setcolor( 9); outtextxy(x,y ,z); - setcolor(11); outtextxy(x,y-1,z); +void dplot(integer x, integer y, string z) { + ; + setcolor(9); + outtextxy(x, y , z); + setcolor(11); + outtextxy(x, y - 1, z); } void bosskey() @@ -85,171 +87,232 @@ begin; dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; copy02;*/ { - byte fv; -; - dusk(); - off_virtual(); - for( fv=0; fv <= 1; fv ++) - {; - setactivepage(fv); - cleardevice(); - } - load(98); off(); - setactivepage(1); setvisualpage(1); - settextjustify(1,0); setcolor(8); - outtextxy(320,177,"Graph/Histo/Draw/Sample: \"JANJUN93.GRA\": (W3-AB3)"); - outtextxy(320,190,"Press any key or click the mouse to return."); - settextjustify(2,0); - on(); mousepage(1); newpointer(1); dawn(); - do { check(); } while (!((mpress>0) || keypressed())); - off(); on_virtual(); - major_redraw(); - - mousepage(cp); + byte fv; + ; + dusk(); + off_virtual(); + for (fv = 0; fv <= 1; fv ++) { + ; + setactivepage(fv); + cleardevice(); + } + load(98); + off(); + setactivepage(1); + setvisualpage(1); + settextjustify(1, 0); + setcolor(8); + outtextxy(320, 177, "Graph/Histo/Draw/Sample: \"JANJUN93.GRA\": (W3-AB3)"); + outtextxy(320, 190, "Press any key or click the mouse to return."); + settextjustify(2, 0); + on(); + mousepage(1); + newpointer(1); + dawn(); + do { + check(); + } while (!((mpress > 0) || keypressed())); + off(); + on_virtual(); + major_redraw(); + + mousepage(cp); } -void copy02() /* taken from Wobble (below) */ -{ - byte a0 /*absolute $A000:0*/; byte a2/*absolute $A800:0*/; byte bit; -; - off(); - for( bit=0; bit <= 3; bit ++) {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; - port[0x3cf]=bit; - move(a0,a2,16000); - } on(); +void copy02() { /* taken from Wobble (below) */ + byte a0 /*absolute $A000:0*/; + byte a2/*absolute $A800:0*/; + byte bit; + ; + off(); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(a0, a2, 16000); + } + on(); } -void copy03() /* taken from Wobble (below) */ -{ - byte a0 /*absolute $A000:0*/; byte a2/*absolute $AC00:0*/; byte bit; - byte squeaky_code; - - switch (visible) { - case m_virtual : { squeaky_code = 1; off_virtual(); } break; - case m_no : squeaky_code = 2; break; - case m_yes : { squeaky_code = 3; off(); } break; - } - - for( bit=0; bit <= 3; bit ++) {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; - port[0x3cf]=bit; - move(a0,a2,16000); - } - - switch (squeaky_code) { - case 1 : on_virtual(); break; - case 2 :; break; /* zzzz, it was off anyway */ - case 3 : on(); break; - } +void copy03() { /* taken from Wobble (below) */ + byte a0 /*absolute $A000:0*/; + byte a2/*absolute $AC00:0*/; + byte bit; + byte squeaky_code; + + switch (visible) { + case m_virtual : { + squeaky_code = 1; + off_virtual(); + } + break; + case m_no : + squeaky_code = 2; + break; + case m_yes : { + squeaky_code = 3; + off(); + } + break; + } + + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(a0, a2, 16000); + } + + switch (squeaky_code) { + case 1 : + on_virtual(); + break; + case 2 : + ; + break; /* zzzz, it was off anyway */ + case 3 : + on(); + break; + } } -void copypage(byte frp,byte top) /* taken from Copy02 (above) */ -{ - byte bit; -; - off(); - for( bit=0; bit <= 3; bit ++) {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; - port[0x3cf]=bit; - move(mem[0xa000*frp*pagetop],mem[0xa000*top*pagetop],16000); - } on(); +void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ + byte bit; + ; + off(); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(mem[0xa000 * frp * pagetop], mem[0xa000 * top * pagetop], 16000); + } + on(); } -void wobble() -{ - byte bit; - byte a2 /*absolute $A800:80i*/; -; - off(); - setactivepage(2); bit=getpixel(0,0); - cleardevice(); - for( bit=0; bit <= 3; bit ++) {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; - port[0x3cf]=bit; - move(mem[0xa000*cp*pagetop],a2,16000); - } - for( bit=0; bit <= 25; bit ++) - {; - setvisualpage(2); delay(bit*7); - setvisualpage(cp); delay(bit*7); - } - bit=getpixel(0,0); - draw_also_lines(); - setactivepage(1-cp); on(); +void wobble() { + byte bit; + byte a2 /*absolute $A800:80i*/; + ; + off(); + setactivepage(2); + bit = getpixel(0, 0); + cleardevice(); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(mem[0xa000 * cp * pagetop], a2, 16000); + } + for (bit = 0; bit <= 25; bit ++) { + ; + setvisualpage(2); + delay(bit * 7); + setvisualpage(cp); + delay(bit * 7); + } + bit = getpixel(0, 0); + draw_also_lines(); + setactivepage(1 - cp); + on(); } void zonk(); -static void zl(integer x1,integer y1,integer x2,integer y2) -{; - setlinestyle(0,0,3); setcolor( 1); line(x1,y1,x2,y2); - setlinestyle(0,0,1); setcolor(11); line(x1,y1,x2,y2); +static void zl(integer x1, integer y1, integer x2, integer y2) { + ; + setlinestyle(0, 0, 3); + setcolor(1); + line(x1, y1, x2, y2); + setlinestyle(0, 0, 1); + setcolor(11); + line(x1, y1, x2, y2); } -void zonk() -{ - integer xx,yy; -/* a0:byte absolute $A000:0; a3:byte absolute $A000:245760;*/ byte bit,fv; -; - off(); - copypage(3,1-cp); - { - triptype& with = tr[1]; - ; xx=with.x+with.a.xl / 2; yy=with.y; } - - setactivepage(3); cleardevice(); -/* for bit:=0 to 3 do begin; - port[$3C4]:=2; port[$3CE]:=4; - port[$3C5]:=1 shl bit; - port[$3CF]:=bit; - move(a0,a3,16000); - end;*/ - copypage(cp,3); off(); - zl(640,0,0,yy / 4); - zl(0,yy / 4,640,yy / 2); - zl(640,yy / 2,xx,yy); setbkcolor(yellow); - - for( bit=0; bit <= 255; bit ++) - {; - note(270-bit); setvisualpage(3); - note(2700-10*bit); delay(5); nosound; - note(270-bit); setvisualpage(cp); - note(2700-10*bit); delay(5); nosound; - } setactivepage(0); setbkcolor(black); on(); state(2); - copypage(1-cp,3); +void zonk() { + integer xx, yy; + /* a0:byte absolute $A000:0; a3:byte absolute $A000:245760;*/ byte bit, fv; + ; + off(); + copypage(3, 1 - cp); + { + triptype &with = tr[1]; + ; + xx = with.x + with.a.xl / 2; + yy = with.y; + } + + setactivepage(3); + cleardevice(); + /* for bit:=0 to 3 do begin; + port[$3C4]:=2; port[$3CE]:=4; + port[$3C5]:=1 shl bit; + port[$3CF]:=bit; + move(a0,a3,16000); + end;*/ + copypage(cp, 3); + off(); + zl(640, 0, 0, yy / 4); + zl(0, yy / 4, 640, yy / 2); + zl(640, yy / 2, xx, yy); + setbkcolor(yellow); + + for (bit = 0; bit <= 255; bit ++) { + ; + note(270 - bit); + setvisualpage(3); + note(2700 - 10 * bit); + delay(5); + nosound; + note(270 - bit); + setvisualpage(cp); + note(2700 - 10 * bit); + delay(5); + nosound; + } + setactivepage(0); + setbkcolor(black); + on(); + state(2); + copypage(1 - cp, 3); } -void winning_pic() -{ - byte bit; - untyped_file f; - char r; - - dusk(); - - assign(f,"finale.avd"); - reset(f,1); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[0xa000*0],16000); - } - close(f); blitfix(); - - setvisualpage(0); - - dawn(); - - do { check(); } while (!(keypressed() || (mrelease>0))); - while (keypressed()) r=readkey(); - major_redraw(); +void winning_pic() { + byte bit; + untyped_file f; + char r; + + dusk(); + + assign(f, "finale.avd"); + reset(f, 1); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * 0], 16000); + } + close(f); + blitfix(); + + setvisualpage(0); + + dawn(); + + do { + check(); + } while (!(keypressed() || (mrelease > 0))); + while (keypressed()) r = readkey(); + major_redraw(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index 2bda4780c7d8..9d76db63b673 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -36,7 +36,7 @@ void copy02(); void copy03(); -void copypage(byte frp,byte top); +void copypage(byte frp, byte top); void wobble(); diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index 909088c0e59b..9a0371806779 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,42 +29,47 @@ namespace Avalanche { -integer gd,gm; byte fv; -matrix<1,35,0,39,byte> a; -array<0,3,0,4,1,35,byte> b; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - for( gd=0; gd <= 39; gd ++) - for( gm=1; gm <= 35; gm ++) - a[gm][gd]=(gd+gm) % 16; - for( gd=0; gd <= 39; gd ++) - for( gm=1; gm <= 35; gm ++) - putpixel(gd+100,gm+100,a[gm][gd]); +integer gd, gm; +byte fv; +matrix<1, 35, 0, 39, byte> a; +array<0, 3, 0, 4, 1, 35, byte> b; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + for (gd = 0; gd <= 39; gd ++) + for (gm = 1; gm <= 35; gm ++) + a[gm][gd] = (gd + gm) % 16; + for (gd = 0; gd <= 39; gd ++) + for (gm = 1; gm <= 35; gm ++) + putpixel(gd + 100, gm + 100, a[gm][gd]); - fillchar(b,sizeof(b),'\0'); - for( gm=1; gm <= 35; gm ++) - for( gd=0; gd <= 39; gd ++) - {; - for( fv=0; fv <= 3; fv ++) - {; - b[fv][gd / 8][gm]=(b[fv][gd / 8][gm] << 1); - b[fv][gd / 8][gm] += ((cardinal)(a[gm][gd] & (1 << fv)) >> fv); - } - } + fillchar(b, sizeof(b), '\0'); + for (gm = 1; gm <= 35; gm ++) + for (gd = 0; gd <= 39; gd ++) { + ; + for (fv = 0; fv <= 3; fv ++) { + ; + b[fv][gd / 8][gm] = (b[fv][gd / 8][gm] << 1); + b[fv][gd / 8][gm] += ((cardinal)(a[gm][gd] & (1 << fv)) >> fv); + } + } - for( gd=1; gd <= 35; gd ++) - for( gm=0; gm <= 4; gm ++) - {; - for( fv=0; fv <= 3; fv ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << fv; port[0x3cf]=fv; - mem[0xa000*gd*80+gm]=b[fv][gm][gd]; - } - } -return EXIT_SUCCESS; + for (gd = 1; gd <= 35; gd ++) + for (gm = 0; gm <= 4; gm ++) { + ; + for (fv = 0; fv <= 3; fv ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << fv; + port[0x3cf] = fv; + mem[0xa000 * gd * 80 + gm] = b[fv][gm][gd]; + } + } + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index 861127714b27..da5b71dae7b6 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,120 +30,124 @@ namespace Avalanche { -array<0,3,palettetype> fxpal; - -void load() -{ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f,"preview2.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - - close(f); - bit=getpixel(0,0); - - settextjustify(1,1); - setcolor(3); - outtextxy(320,166,"...This is a preview of things to come..."); - setcolor(14); - outtextxy(320,176,"AVAROID"); - outtextxy(320,183,"(a space so dizzy)"); - setcolor(9); - outtextxy(320,194,"the next Avvy adventure-- in 256 colours."); - setcolor(7); - outtextxy(590,195,"Any key..."); +array<0, 3, palettetype> fxpal; + +void load() { + byte a0 /*absolute $A000:800*/; + byte bit; + untyped_file f; + + + assign(f, "preview2.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + + close(f); + bit = getpixel(0, 0); + + settextjustify(1, 1); + setcolor(3); + outtextxy(320, 166, "...This is a preview of things to come..."); + setcolor(14); + outtextxy(320, 176, "AVAROID"); + outtextxy(320, 183, "(a space so dizzy)"); + setcolor(9); + outtextxy(320, 194, "the next Avvy adventure-- in 256 colours."); + setcolor(7); + outtextxy(590, 195, "Any key..."); } -void setup() -{ - integer gd,gm; - palettetype p; +void setup() { + integer gd, gm; + palettetype p; - if (paramstr(1)!="jsb") exit(255); - gd=3; gm=0; initgraph(gd,gm,""); - getpalette(fxpal[0]); + if (paramstr(1) != "jsb") exit(255); + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + getpalette(fxpal[0]); - fillchar(p.colors,sizeof(p.colors),'\0'); /* Blank out the screen. */ - p.size=16; setallpalette(p); + fillchar(p.colors, sizeof(p.colors), '\0'); /* Blank out the screen. */ + p.size = 16; + setallpalette(p); } -void wait() -{ - word w; char r; +void wait() { + word w; + char r; - w=0; - do { - delay(1); w += 1; - } while (!(keypressed() || (w==15000))); + w = 0; + do { + delay(1); + w += 1; + } while (!(keypressed() || (w == 15000))); - while (keypressed()) r=readkey(); /* Keyboard sink. */ + while (keypressed()) r = readkey(); /* Keyboard sink. */ } -void show(byte n) -{ - setallpalette(fxpal[n]); - delay(55); +void show(byte n) { + setallpalette(fxpal[n]); + delay(55); } -shortint fades(shortint x) -{ - byte r,g,b; - - shortint fades_result; - r=x / 16; x=x % 16; - g=x / 4; b=x % 4; - if (r>0) r -= 1; if (g>0) g -= 1; if (b>0) b -= 1; - fades_result=(16*r+4*g+b); -/* fades:=x-1;*/ - return fades_result; +shortint fades(shortint x) { + byte r, g, b; + + shortint fades_result; + r = x / 16; + x = x % 16; + g = x / 4; + b = x % 4; + if (r > 0) r -= 1; + if (g > 0) g -= 1; + if (b > 0) b -= 1; + fades_result = (16 * r + 4 * g + b); + /* fades:=x-1;*/ + return fades_result; } void dawn(); -static void calc(byte n) -{ - byte fv; +static void calc(byte n) { + byte fv; - fxpal[n]=fxpal[n-1]; + fxpal[n] = fxpal[n - 1]; - for( fv=1; fv <= fxpal[n].size-1; fv ++) - fxpal[n].colors[fv]=fades(fxpal[n].colors[fv]); + for (fv = 1; fv <= fxpal[n].size - 1; fv ++) + fxpal[n].colors[fv] = fades(fxpal[n].colors[fv]); } -void dawn() -{ - byte fv; +void dawn() { + byte fv; - for( fv=1; fv <= 3; fv ++) calc(fv); + for (fv = 1; fv <= 3; fv ++) calc(fv); - for( fv=3; fv >= 0; fv --) show(fv); + for (fv = 3; fv >= 0; fv --) show(fv); } -void dusk() -{ - byte fv; +void dusk() { + byte fv; - for( fv=1; fv <= 3; fv ++) show(fv); + for (fv = 1; fv <= 3; fv ++) show(fv); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - setup(); - load(); - dawn(); - wait(); - dusk(); - closegraph(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + setup(); + load(); + dawn(); + wait(); + dusk(); + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index 22e6f3f1b804..0d15a9d7daa1 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,7 +31,7 @@ namespace Avalanche { - /* This is a stand-alone program. */ +/* This is a stand-alone program. */ /* 0, black, remains 0. Other numbers: the bits take precedence from the left. @@ -44,15 +44,16 @@ namespace Avalanche { Second bit: 7 (light grey) First bit: 1 (blue). */ -const palettetype our_palette = - {16, - /* sic */ -{{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}}}; +const palettetype our_palette = { + 16, + /* sic */ + {{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}} +}; -typedef matrix<'\0','\377',1,16,byte> fonttype; +typedef matrix < '\0', '\377', 1, 16, byte > fonttype; fonttype f; -matrix<0,39,1,16,byte> next_line; +matrix<0, 39, 1, 16, byte> next_line; byte next_bitline; @@ -62,244 +63,260 @@ boolean cut_out; word cut_out_time; -array<1,117,varying_string<40> > x; +array<1, 117, varying_string<40> > x; byte this_line; -word* skellern; +word *skellern; /*$L intro.obj*/ -extern void introduction(); +extern void introduction(); -void graphmode(integer mode) -{ - registers regs; +void graphmode(integer mode) { + registers regs; - regs.ax=mode; - intr(0x10,regs); + regs.ax = mode; + intr(0x10, regs); } /* Firstly, port[$3C4]:=2; port[$3CF]:=4;, Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ -void loadfont() -{ - file ff; +void loadfont() { + file ff; - assign(ff,"avalot.fnt"); - reset(ff); - ff >> f; - close(ff); + assign(ff, "avalot.fnt"); + reset(ff); + ff >> f; + close(ff); } void calc_next_line() - /* This proc sets up next_line. */ +/* This proc sets up next_line. */ { - string l; - byte fv,ff; - boolean oddlen; - byte start; - byte this_; - - fillchar(next_line,sizeof(next_line),'\0'); /* All blanks. */ - - if (this_line==117) - { - cut_out=true; - return; - } - - l=x[this_line]; - this_line += 1; - - start=(20-length(l) / 2)-1; - oddlen=odd(length(l)); - - for( fv=1; fv <= length(l); fv ++) - for( ff=1; ff <= 16; ff ++) - { - this_=f[l[fv]][ff]; - if (oddlen) - { /* Odd, => 4 bits shift to the right. */ - next_line[start+fv][ff] += this_ << 4; - next_line[start+fv-1][ff] += (cardinal)this_ >> 4; - } else - { /* Even, => no bit shift. */ - next_line[start+fv][ff]=this_; - } - } - next_bitline=1; + string l; + byte fv, ff; + boolean oddlen; + byte start; + byte this_; + + fillchar(next_line, sizeof(next_line), '\0'); /* All blanks. */ + + if (this_line == 117) { + cut_out = true; + return; + } + + l = x[this_line]; + this_line += 1; + + start = (20 - length(l) / 2) - 1; + oddlen = odd(length(l)); + + for (fv = 1; fv <= length(l); fv ++) + for (ff = 1; ff <= 16; ff ++) { + this_ = f[l[fv]][ff]; + if (oddlen) { + /* Odd, => 4 bits shift to the right. */ + next_line[start + fv][ff] += this_ << 4; + next_line[start + fv - 1][ff] += (cardinal)this_ >> 4; + } else { + /* Even, => no bit shift. */ + next_line[start + fv][ff] = this_; + } + } + next_bitline = 1; } -void display() -{ - byte fv,ff; +void display() { + byte fv, ff; - if (next_bitline == 17) calc_next_line(); + if (next_bitline == 17) calc_next_line(); - if (cut_out) - { - cut_out_time -= 1; - return; - } + if (cut_out) { + cut_out_time -= 1; + return; + } - move(mem[0xa000*40],mem[0xa000*0],7960); - for( fv=0; fv <= 39; fv ++) - mem[0xa1f1*8+fv]=next_line[fv][next_bitline]; - next_bitline += 1; + move(mem[0xa000 * 40], mem[0xa000 * 0], 7960); + for (fv = 0; fv <= 39; fv ++) + mem[0xa1f1 * 8 + fv] = next_line[fv][next_bitline]; + next_bitline += 1; } -void plot_a_star(integer x,integer y) -{ - byte ofs; +void plot_a_star(integer x, integer y) { + byte ofs; - ofs=x % 8; - x=x / 8; - mem[0xa000*x+y*40] += (cardinal)128 >> ofs; + ofs = x % 8; + x = x / 8; + mem[0xa000 * x + y * 40] += (cardinal)128 >> ofs; } -void plot_some_stars(integer y) -{ - byte fv,times; - - switch (Random(7)) { - case 1: times=1; break; - case 2: times=2; break; - case 3: times=3; break; - default: return; - } - - for( fv=1; fv <= times; fv ++) - plot_a_star(Random(320),y); +void plot_some_stars(integer y) { + byte fv, times; + + switch (Random(7)) { + case 1: + times = 1; + break; + case 2: + times = 2; + break; + case 3: + times = 3; + break; + default: + return; + } + + for (fv = 1; fv <= times; fv ++) + plot_a_star(Random(320), y); } -void starry_starry_night() -{ - integer y; - byte bit; - - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - - for( bit=0; bit <= 2; bit ++) - { - port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( y=1; y <= 200; y ++) - plot_some_stars(y); - } +void starry_starry_night() { + integer y; + byte bit; + + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + for (bit = 0; bit <= 2; bit ++) { + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (y = 1; y <= 200; y ++) + plot_some_stars(y); + } } void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the Graph unit. */ { - integer gd,gm; + integer gd, gm; - gd=3; gm=1; initgraph(gd,gm,""); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); } -void shovestars() -{ - move(mem[0xa000*0],mem[0xa000*40],7960); - fillchar(mem[0xa000*0],40,'\0'); - plot_some_stars(0); +void shovestars() { + move(mem[0xa000 * 0], mem[0xa000 * 40], 7960); + fillchar(mem[0xa000 * 0], 40, '\0'); + plot_some_stars(0); } -void do_next_line() -{ - byte bit; - - port[0x3c4]=2; port[0x3ce]=4; - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c5]=1 << bit; port[0x3cf]=bit; - - switch (bit) { - case 0: if ((displaycounter % 10)==0) shovestars(); break; - case 1: if ((displaycounter % 2)==0) shovestars(); break; - case 2: shovestars(); break; - case 3: display(); break; /* The text. */ - } - } - - if (displaycounter==40) displaycounter=0; +void do_next_line() { + byte bit; + + port[0x3c4] = 2; + port[0x3ce] = 4; + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + + switch (bit) { + case 0: + if ((displaycounter % 10) == 0) shovestars(); + break; + case 1: + if ((displaycounter % 2) == 0) shovestars(); + break; + case 2: + shovestars(); + break; + case 3: + display(); + break; /* The text. */ + } + } + + if (displaycounter == 40) displaycounter = 0; } -void load_text() -{ - word fv; - char* c; - byte thisline; - - - c=addr(introduction()); - thisline=0; - fillchar(x,sizeof(x),'\0'); - - for( fv=1; fv <= 2456; fv ++) - { - switch (*c) { - case '\15': thisline += 1; break; - case '\12':/*nop*/; break; - default: x[thisline]=x[thisline]+*c; - } - - c += 1; - } +void load_text() { + word fv; + char *c; + byte thisline; + + + c = addr(introduction()); + thisline = 0; + fillchar(x, sizeof(x), '\0'); + + for (fv = 1; fv <= 2456; fv ++) { + switch (*c) { + case '\15': + thisline += 1; + break; + case '\12':/*nop*/ + ; + break; + default: + x[thisline] = x[thisline] + *c; + } + + c += 1; + } } -void check_params() -{ - word s,o; integer e; +void check_params() { + word s, o; + integer e; - if (paramstr(1)!="jsb") exit(0); - val(paramstr(2),s,e); if (e!=0) exit(0); - val(paramstr(3),o,e); if (e!=0) exit(0); - skellern=ptr(s,o+1); + if (paramstr(1) != "jsb") exit(0); + val(paramstr(2), s, e); + if (e != 0) exit(0); + val(paramstr(3), o, e); + if (e != 0) exit(0); + skellern = ptr(s, o + 1); } -int main(int argc, const char* argv[]) -{ +int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - check_params(); + pio_initialize(argc, argv); + check_params(); - setupgraphics(); + setupgraphics(); - randseed=177; checkbreak=false; + randseed = 177; + checkbreak = false; - load_text(); + load_text(); - this_line=1; + this_line = 1; - graphmode(0xd); - loadfont(); + graphmode(0xd); + loadfont(); - next_bitline=17; - displaycounter=0; + next_bitline = 17; + displaycounter = 0; - cut_out_time=333; + cut_out_time = 333; - setallpalette(our_palette); + setallpalette(our_palette); - starry_starry_night(); + starry_starry_night(); - while ((cut_out_time>0) && (! keypressed())) - { + while ((cut_out_time > 0) && (! keypressed())) { - *skellern=0; + *skellern = 0; - do_next_line(); + do_next_line(); - displaycounter += 1; + displaycounter += 1; - do {; } while (!(*skellern>0)); - } + do { + ; + } while (!(*skellern > 0)); + } - graphmode(3); - return EXIT_SUCCESS; + graphmode(3); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index d51283812145..69920ef292b4 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,234 +33,271 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; boolean reverse; word spinnum; -array<0,1,fonttype> f; +array<0, 1, fonttype> f; file ff; -array<0,7,0,15,0,79,byte> strip; +array<0, 7, 0, 15, 0, 79, byte> strip; byte across; -word w; byte y; +word w; +byte y; byte charnum; byte cfont; /* current font. 0=roman, 1=italic. */ -char* c; +char *c; const integer colours = 12; /* Run Workout to see possible values of these two. */ const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ const integer gmtop = 360 / steps; -/*$L credits.obj*/ extern void credits(); - -void bigo2(string date) -{ - integer gd,gm; - byte c; - palettetype p; - untyped_file f; pointer pp; word s; - - - getpalette(p); - setvisualpage(1); setactivepage(0); - assign(f,"logo.avd"); reset(f,1); - for( gd=7; gd <= 194; gd ++) - blockread(f,mem[0xa000*(gd*80)],53); - close(f); - s=imagesize(0,7,415,194); getmem(pp,s); getimage(0,7,415,194,pp); - - cleardevice(); - for( gd=1; gd <= 64; gd ++) - { - for( gm=0; gm <= gmtop; gm ++) - { - c=(c % colours)+1; -/* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, - trunc(cos(gm*steps*n)*gd*3)+175,c); */ - if (c>5) continue_; - setcolor(c); arc(320,175,gm*steps,gm*steps+1,gd*6); - } - if (keypressed()) { closegraph(); exit(0); } - } - settextstyle(0,0,1); setcolor(13); - outtextxy(550,343,"(press any key)"); - - putimage(112,0,pp,orput); freemem(pp,s); - resetmouse; setvisualpage(0); +/*$L credits.obj*/ extern void credits(); + +void bigo2(string date) { + integer gd, gm; + byte c; + palettetype p; + untyped_file f; + pointer pp; + word s; + + + getpalette(p); + setvisualpage(1); + setactivepage(0); + assign(f, "logo.avd"); + reset(f, 1); + for (gd = 7; gd <= 194; gd ++) + blockread(f, mem[0xa000 * (gd * 80)], 53); + close(f); + s = imagesize(0, 7, 415, 194); + getmem(pp, s); + getimage(0, 7, 415, 194, pp); + + cleardevice(); + for (gd = 1; gd <= 64; gd ++) { + for (gm = 0; gm <= gmtop; gm ++) { + c = (c % colours) + 1; + /* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, + trunc(cos(gm*steps*n)*gd*3)+175,c); */ + if (c > 5) continue_; + setcolor(c); + arc(320, 175, gm * steps, gm * steps + 1, gd * 6); + } + if (keypressed()) { + closegraph(); + exit(0); + } + } + settextstyle(0, 0, 1); + setcolor(13); + outtextxy(550, 343, "(press any key)"); + + putimage(112, 0, pp, orput); + freemem(pp, s); + resetmouse; + setvisualpage(0); } -void nextchar() /* Sets up charnum & cline for the next character. */ -{ +void nextchar() { /* Sets up charnum & cline for the next character. */ - c += 1; + c += 1; } -void getchar() -{ - do { - nextchar(); - - switch (*c) { - case '@': { cfont=1; nextchar(); } break; - case '^': { cfont=0; nextchar(); } break; - case '%': { closegraph(); exit(0); } break; - } - - } while (!((*c!='\15') && (*c!='\12'))); - - for( w=0; w <= 7; w ++) - for( y=0; y <= 15; y ++) - move(strip[w][y][1],strip[w][y][0],79); - - for( w=0; w <= 7; w ++) - for( y=0; y <= 15; y ++) - strip[w][y][79]=(byte)((strip[7][y][78] << (w+1)))+ - ((cardinal)f[cfont][*c][y] >> (7-w)); - - across=0; +void getchar() { + do { + nextchar(); + + switch (*c) { + case '@': { + cfont = 1; + nextchar(); + } + break; + case '^': { + cfont = 0; + nextchar(); + } + break; + case '%': { + closegraph(); + exit(0); + } + break; + } + + } while (!((*c != '\15') && (*c != '\12'))); + + for (w = 0; w <= 7; w ++) + for (y = 0; y <= 15; y ++) + move(strip[w][y][1], strip[w][y][0], 79); + + for (w = 0; w <= 7; w ++) + for (y = 0; y <= 15; y ++) + strip[w][y][79] = (byte)((strip[7][y][78] << (w + 1))) + + ((cardinal)f[cfont][*c][y] >> (7 - w)); + + across = 0; } -void scrolltext() -{ - byte c,w,y; +void scrolltext() { + byte c, w, y; - across += 1; - if (across==8) getchar(); + across += 1; + if (across == 8) getchar(); - for( y=0; y <= 15; y ++) - for( w=0; w <= 1; w ++) - move(strip[across][y][0],mem[0xa000*24000+(y*2+w)*80],80); + for (y = 0; y <= 15; y ++) + for (w = 0; w <= 1; w ++) + move(strip[across][y][0], mem[0xa000 * 24000 + (y * 2 + w) * 80], 80); } -void do_stuff() -{ - switch (spinnum) { - case 50 ... 110: { - setfillstyle(1,14); - bar(0,315+(spinnum-50) / 3,640,315+(spinnum-50) / 3); - bar(0,316-(spinnum-50) / 3,640,316-(spinnum-50) / 3); - if (spinnum>56) - { - setfillstyle(1,13); - bar(0,315+(spinnum-56) / 3,640,315+(spinnum-56) / 3); - bar(0,316-(spinnum-56) / 3,640,316-(spinnum-56) / 3); - } - } - break; - case 150 ... 198: { - setfillstyle(1,0); - bar(0,315+(spinnum-150) / 3,640,315+(spinnum-150) / 3); - bar(0,316-(spinnum-150) / 3,640,316-(spinnum-150) / 3); - } - break; - case 200: scrolltext(); break; - } +void do_stuff() { + switch (spinnum) { + case 50 ... 110: { + setfillstyle(1, 14); + bar(0, 315 + (spinnum - 50) / 3, 640, 315 + (spinnum - 50) / 3); + bar(0, 316 - (spinnum - 50) / 3, 640, 316 - (spinnum - 50) / 3); + if (spinnum > 56) { + setfillstyle(1, 13); + bar(0, 315 + (spinnum - 56) / 3, 640, 315 + (spinnum - 56) / 3); + bar(0, 316 - (spinnum - 56) / 3, 640, 316 - (spinnum - 56) / 3); + } + } + break; + case 150 ... 198: { + setfillstyle(1, 0); + bar(0, 315 + (spinnum - 150) / 3, 640, 315 + (spinnum - 150) / 3); + bar(0, 316 - (spinnum - 150) / 3, 640, 316 - (spinnum - 150) / 3); + } + break; + case 200: + scrolltext(); + break; + } } -void setcol(byte which,byte what) +void setcol(byte which, byte what) /*var dummy:byte;*/ -{; -/* setpalette(which,what); - asm -(* mov dx,$3DA; - in ax,dx; - - or ah,ah; - - mov dx,$3C0; - mov al,which; - out dx,al; - - mov dx,$3C0; - mov al,what; - out dx,al; - end; -(* dummy:=port[$3DA]; - port[$3C0]:=which; port[$3C0]:=what;*/ -} - -void bigo2go() { - palettetype p; byte c; boolean lmo; - boolean altnow,altbefore; - - for( gd=0; gd <= 13; gd ++) p.colors[gd]=0; - - setcol(13,24); /* murk */ setcol(14,38); /* gold */ - setcol(15,egawhite); /* white- of course */ - p.colors[13]=24; p.colors[14]=38; p.colors[15]=egawhite; - - /***/ - - p.colors[5]=egawhite; - p.colors[4]=egalightcyan; - p.colors[3]=egacyan; - p.colors[2]=egalightblue; - p.colors[1]=egablue; - - /***/ - - c=1; p.size=16; lmo=false; - setallpalette(p); - - do { -/* if reverse then - begin - dec(c); if c=0 then c:=colours; - end else - begin - inc(c); if c>colours then c:=1; - end; - for gm:=1 to colours do - case p.colors[gm] of - egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; - egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; - egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; - egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; - egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; - end; - p.colors[c]:=egaWhite; setcol(c,egaWhite); - - AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ - - if (anymousekeypressed) lmo=true; - if (keypressed()) lmo=true; - - /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ - - do_stuff(); - if (spinnum<200) spinnum += 1; - } while (!lmo); + ; + /* setpalette(which,what); + asm + (* mov dx,$3DA; + in ax,dx; + + or ah,ah; + + mov dx,$3C0; + mov al,which; + out dx,al; + + mov dx,$3C0; + mov al,what; + out dx,al; + end; + (* dummy:=port[$3DA]; + port[$3C0]:=which; port[$3C0]:=what;*/ } -void parse_cline() -{ - integer e; - - if (paramstr(1)!="jsb") - { - output << "Not a standalone program." << NL; exit(255); - } +void bigo2go() { + palettetype p; + byte c; + boolean lmo; + boolean altnow, altbefore; + + for (gd = 0; gd <= 13; gd ++) p.colors[gd] = 0; + + setcol(13, 24); /* murk */ setcol(14, 38); /* gold */ + setcol(15, egawhite); /* white- of course */ + p.colors[13] = 24; + p.colors[14] = 38; + p.colors[15] = egawhite; + + /***/ + + p.colors[5] = egawhite; + p.colors[4] = egalightcyan; + p.colors[3] = egacyan; + p.colors[2] = egalightblue; + p.colors[1] = egablue; + + /***/ + + c = 1; + p.size = 16; + lmo = false; + setallpalette(p); + + do { + /* if reverse then + begin + dec(c); if c=0 then c:=colours; + end else + begin + inc(c); if c>colours then c:=1; + end; + for gm:=1 to colours do + case p.colors[gm] of + egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; + egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; + egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; + egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; + egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; + end; + p.colors[c]:=egaWhite; setcol(c,egaWhite); + + AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ + + if (anymousekeypressed) lmo = true; + if (keypressed()) lmo = true; + + /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ + + do_stuff(); + if (spinnum < 200) spinnum += 1; + } while (!lmo); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - parse_cline(); - - gd=3; gm=1; initgraph(gd,gm,""); - assign(ff,"avalot.fnt"); reset(ff); ff >> f[0]; close(ff); - assign(ff,"avitalic.fnt"); reset(ff); ff >> f[1]; close(ff); +void parse_cline() { + integer e; - c=addr(credits()); c -= 1; + if (paramstr(1) != "jsb") { + output << "Not a standalone program." << NL; + exit(255); + } +} - fillchar(strip,sizeof(strip),'\0'); - reverse=false; spinnum=0; across=7; charnum=1; cfont=0; - bigo2("1189"); /* 1189? 79? 2345? 1967? */ - bigo2go(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + parse_cline(); + + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + assign(ff, "avalot.fnt"); + reset(ff); + ff >> f[0]; + close(ff); + assign(ff, "avitalic.fnt"); + reset(ff); + ff >> f[1]; + close(ff); + + c = addr(credits()); + c -= 1; + + fillchar(strip, sizeof(strip), '\0'); + reverse = false; + spinnum = 0; + across = 7; + charnum = 1; + cfont = 0; + bigo2("1189"); /* 1189? 79? 2345? 1967? */ + bigo2go(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index 4f2a5f7b3675..8c2c36784f92 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,69 +31,67 @@ namespace Avalanche { searchrec s; -string x,y; -longint hash_time,s_time; +string x, y; +longint hash_time, s_time; boolean s_exists; -void find_out_about_s(string name) -{ - searchrec ss; -; - findfirst(name,anyfile,ss); - s_exists=doserror==0; +void find_out_about_s(string name) { + searchrec ss; + ; + findfirst(name, anyfile, ss); + s_exists = doserror == 0; - if (s_exists) - s_time=ss.time; + if (s_exists) + s_time = ss.time; } -void get_y() -{ - y=x; - if (set::of(range('0','9'), eos).has(x[2])) - y[1]='h'; else - if (x[3]=='K') - y[1]='a'; else - y[1]='s'; +void get_y() { + y = x; + if (set::of(range('0', '9'), eos).has(x[2])) + y[1] = 'h'; + else if (x[3] == 'K') + y[1] = 'a'; + else + y[1] = 's'; } -void rename_it() -{ - untyped_file f; +void rename_it() { + untyped_file f; - output << x << " -> " << y; - assign(f,x); reset(f); rename(f,y); close(f); - output << " ...done." << NL; + output << x << " -> " << y; + assign(f, x); + reset(f); + rename(f, y); + close(f); + output << " ...done." << NL; } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - output << NL; - findfirst("#*.*",anyfile,s); - while (doserror==0) - { - x=s.name; - get_y(); - hash_time=s.time; - output << format(x,15); clreol; - find_out_about_s(y); - if (s_exists) - { - output << ": s exists and is "; - if (s_time initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ + array<1, 2, char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ }; untyped_file f; longint number; markertype marker; sezheader sezhead; -array<0,1999,char> x; +array<0, 1999, char> x; word fv; byte sum; -byte sumup() -{ - word fv; byte total; -byte sumup_result; -; - total=0; - for( fv=0; fv <= marker.length; fv ++) - {; - total += ord(x[fv]); - } - sumup_result=total; -return sumup_result; +byte sumup() { + word fv; + byte total; + byte sumup_result; + ; + total = 0; + for (fv = 0; fv <= marker.length; fv ++) { + ; + total += ord(x[fv]); + } + sumup_result = total; + return sumup_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - output << "READ-SEZ by TT." << NL; output << NL; - assign(f,"avalot.sez"); reset(f,1); - seek(f,255); blockread(f,sezhead,sizeof(sezhead)); - {; - if (sezhead.initials!="TT") - {; - output << "Not a valid Sez file!" << NL; - exit(0); - } - output << "Number of chains in file = " << sezhead.chains << NL; - output << "Total size of all chains = " << sezhead.size << " bytes." << NL; - } - output << NL; - output << "Number of scrollchain to display?"; input >> number >> NL; - seek(f,longint(262)+number*longint(7)); blockread(f,marker,7); - {; - output << "Scrollchain no. " << number << NL; - output << "Length: " << marker.length << NL; - output << "Offset: " << marker.offset << NL; - output << NL; - output << "Contents:" << NL; - seek(f,longint(270)+sezhead.chains*longint(7)+marker.offset); - blockread(f,x,marker.length+1); - for( fv=0; fv <= marker.length; fv ++) x[fv] -= 3+177*fv*marker.length; /* unscramble */ - for( fv=0; fv <= marker.length; fv ++) output << x[fv]; - output << NL; sum=sumup(); - output << "Checksum in file: " << marker.checksum << ". Actual value: " << sum << '.' << NL; - output << NL; - if (sum!=marker.checksum) - {; - output << "Bleargh! Checksum failed!" << NL; - exit(0); - } - } - close(f); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + output << "READ-SEZ by TT." << NL; + output << NL; + assign(f, "avalot.sez"); + reset(f, 1); + seek(f, 255); + blockread(f, sezhead, sizeof(sezhead)); + { + ; + if (sezhead.initials != "TT") { + ; + output << "Not a valid Sez file!" << NL; + exit(0); + } + output << "Number of chains in file = " << sezhead.chains << NL; + output << "Total size of all chains = " << sezhead.size << " bytes." << NL; + } + output << NL; + output << "Number of scrollchain to display?"; + input >> number >> NL; + seek(f, longint(262) + number * longint(7)); + blockread(f, marker, 7); + { + ; + output << "Scrollchain no. " << number << NL; + output << "Length: " << marker.length << NL; + output << "Offset: " << marker.offset << NL; + output << NL; + output << "Contents:" << NL; + seek(f, longint(270) + sezhead.chains * longint(7) + marker.offset); + blockread(f, x, marker.length + 1); + for (fv = 0; fv <= marker.length; fv ++) x[fv] -= 3 + 177 * fv * marker.length; /* unscramble */ + for (fv = 0; fv <= marker.length; fv ++) output << x[fv]; + output << NL; + sum = sumup(); + output << "Checksum in file: " << marker.checksum << ". Actual value: " << sum << '.' << NL; + output << NL; + if (sum != marker.checksum) { + ; + output << "Bleargh! Checksum failed!" << NL; + exit(0); + } + } + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 0458acb3372e..441a35ace0f0 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -27,7 +27,7 @@ namespace Avalanche { -const array<1,36,char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; +const array<1, 36, char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; varying_string<30> name; varying_string<5> number; @@ -38,82 +38,82 @@ static string z; static byte p; -static void replace(char what,char whatwith) -{; - p=pos(what,z); if (p>0) z[p]=whatwith; +static void replace(char what, char whatwith) { + ; + p = pos(what, z); + if (p > 0) z[p] = whatwith; } -void alphanum() -{ - byte fv; - -; - z=""; - for( fv=1; fv <= length(name); fv ++) - if (set::of(range('A','Z'), eos).has(name[fv])) - z=z+'7'+name[fv]; else - z=z+upcase(name[fv]); - replace(' ','1'); - replace('.','2'); - replace('-','3'); - replace('\'','4'); - replace('"','5'); - replace('!','6'); - replace(',','9'); - replace('?','0'); - - for( fv=1; fv <= length(number); fv ++) - number[fv]=upcase(number[fv]); - - name=z+'8'+number; +void alphanum() { + byte fv; + + ; + z = ""; + for (fv = 1; fv <= length(name); fv ++) + if (set::of(range('A', 'Z'), eos).has(name[fv])) + z = z + '7' + name[fv]; + else + z = z + upcase(name[fv]); + replace(' ', '1'); + replace('.', '2'); + replace('-', '3'); + replace('\'', '4'); + replace('"', '5'); + replace('!', '6'); + replace(',', '9'); + replace('?', '0'); + + for (fv = 1; fv <= length(number); fv ++) + number[fv] = upcase(number[fv]); + + name = z + '8' + number; } -void scramble() -{ - byte fv,what; -; - for( fv=1; fv <= length(name); fv ++) - {; - what=pos(name[fv],letters); - what += 177; - what += (fv+1)*3; - name[fv]=letters[(what % 36)+1-1]; - } +void scramble() { + byte fv, what; + ; + for (fv = 1; fv <= length(name); fv ++) { + ; + what = pos(name[fv], letters); + what += 177; + what += (fv + 1) * 3; + name[fv] = letters[(what % 36) + 1 - 1]; + } } -void checks() -{ - byte fv,total; -; - total=177; - for( fv=1; fv <= length(name); fv ++) - total += ord(name[fv]); - name=string('T')+name+letters[total % 36-1]; +void checks() { + byte fv, total; + ; + total = 177; + for (fv = 1; fv <= length(name); fv ++) + total += ord(name[fv]); + name = string('T') + name + letters[total % 36 - 1]; } -void negate() -{ - byte fv; -; - name[1]='N'; - for( fv=2; fv <= length(name); fv ++) - name[fv]=letters[37-pos(name[fv],letters)-1]; +void negate() { + byte fv; + ; + name[1] = 'N'; + for (fv = 2; fv <= length(name); fv ++) + name[fv] = letters[37 - pos(name[fv], letters) - 1]; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - output << "Registrant's name?"; input >> name >> NL; - output << "And number (eg, A1)?"; input >> number >> NL; - alphanum(); - output << "Name = " << name << NL; - scramble(); - output << "Scrambled = " << name << NL; - checks(); - output << "With checks = " << name << NL; - negate(); - output << "Or, negated, = " << name << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + output << "Registrant's name?"; + input >> name >> NL; + output << "And number (eg, A1)?"; + input >> number >> NL; + alphanum(); + output << "Name = " << name << NL; + scramble(); + output << "Scrambled = " << name << NL; + checks(); + output << "With checks = " << name << NL; + negate(); + output << "Or, negated, = " << name << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index e3369db8c7bf..54d860c5c6fb 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -42,38 +42,37 @@ #include "sackb1.h" -/*$L v:MOD-obj.OBJ*/ /* Link in Object file */ -/*$F+*/ /* force calls to be 'far'*/ +/*$L v:MOD-obj.OBJ*/ /* Link in Object file */ +/*$F+*/ /* force calls to be 'far'*/ namespace Avalanche { -extern void modvolume(integer v1,integer v2,integer v3,integer v4); /*Can do while playing*/ -extern void moddevice(integer& device); -extern void modsetup(integer& status,integer device,integer mixspeed,integer pro,integer loop,string& stri); -extern void modstop(); -extern void modinit(); +extern void modvolume(integer v1, integer v2, integer v3, integer v4); /*Can do while playing*/ +extern void moddevice(integer &device); +extern void modsetup(integer &status, integer device, integer mixspeed, integer pro, integer loop, string &stri); +extern void modstop(); +extern void modinit(); /*$F-*/ -void sb_start(string md) -{ - integer dev,mix,stat,pro,loop; - - modinit(); - dev=7; /* Sound Blaster */ - mix = 10000; /*use 10000 normally */ - pro = 0; /*Leave at 0*/ - loop =4; /*4 means mod will play forever*/ - modvolume (255,255,255,255); /* Full volume */ - modsetup ( stat, dev, mix, pro, loop, md ); +void sb_start(string md) { + integer dev, mix, stat, pro, loop; + + modinit(); + dev = 7; /* Sound Blaster */ + mix = 10000; /*use 10000 normally */ + pro = 0; /*Leave at 0*/ + loop = 4; /*4 means mod will play forever*/ + modvolume(255, 255, 255, 255); /* Full volume */ + modsetup(stat, dev, mix, pro, loop, md); } -void sb_stop() -{; - modstop(); +void sb_stop() { + ; + modstop(); } -void sb_link() /* At the moment, this does nothing. */ -{; +void sb_link() { /* At the moment, this does nothing. */ + ; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h index c660c3611789..7ac3cce0a388 100644 --- a/engines/avalanche/sackb1.h +++ b/engines/avalanche/sackb1.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp index 0abca98d1747..a77431077f2a 100644 --- a/engines/avalanche/sackb3.cpp +++ b/engines/avalanche/sackb3.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -27,25 +27,24 @@ /*$M 16384,0,0*/ - /* to demonstrate the SBVoice Unit */ - /* Copyright 1991 Amit K. Mathur, Windsor, Ontario */ +/* to demonstrate the SBVoice Unit */ +/* Copyright 1991 Amit K. Mathur, Windsor, Ontario */ /*#include "SBVoice.h"*/ namespace Avalanche { -int main(int argc, const char* argv[]) -{ -pio_initialize(argc, argv); -if (paramcount>0) { - loadvoice(paramstr(1),0,0); - sb_output(seg(soundfile),ofs(soundfile)+26); - do { - output << "Demo of the SBVoice Unit, Copyright 1991 by Amit K. Mathur --- "; - } while (!(statusword==0)); -} else - output << "Usage: DEMO [d:\\path\\]filename.voc" << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + if (paramcount > 0) { + loadvoice(paramstr(1), 0, 0); + sb_output(seg(soundfile), ofs(soundfile) + 26); + do { + output << "Demo of the SBVoice Unit, Copyright 1991 by Amit K. Mathur --- "; + } while (!(statusword == 0)); + } else + output << "Usage: DEMO [d:\\path\\]filename.voc" << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp index 9cec14da2911..0c35671e9b42 100644 --- a/engines/avalanche/sackblas.cpp +++ b/engines/avalanche/sackblas.cpp @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 5385a6c28fa5..8075225e7b45 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,48 +29,54 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; byte a /*absolute $A000:(15*80)*/; byte bit; untyped_file f; -void load(string nam) -{ - byte z; - array<1,4,pointer> a; - untyped_file f; word s; - string check; -; - assign(f,nam); - reset(f,1); - blockread(f,check,41); - blockread(f,check,13); - blockread(f,check,31); - s=imagesize(0,0,getmaxx(),75); - for( z=1; z <= 2; z ++) - {; - getmem(a[z],s); - blockread(f,a[z],s); - setactivepage(0); - putimage(0,15+(z-1)*75,a[z],0); - freemem(a[z],s); - } - close(f); +void load(string nam) { + byte z; + array<1, 4, pointer> a; + untyped_file f; + word s; + string check; + ; + assign(f, nam); + reset(f, 1); + blockread(f, check, 41); + blockread(f, check, 13); + blockread(f, check, 31); + s = imagesize(0, 0, getmaxx(), 75); + for (z = 1; z <= 2; z ++) { + ; + getmem(a[z], s); + blockread(f, a[z], s); + setactivepage(0); + putimage(0, 15 + (z - 1) * 75, a[z], 0); + freemem(a[z], s); + } + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - load("d:britain.avd"); - assign(f,"c:\\sleep\\test.ega"); rewrite(f,1); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,a,12000); - } - close(f); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + load("d:britain.avd"); + assign(f, "c:\\sleep\\test.ega"); + rewrite(f, 1); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, a, 12000); + } + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 6228bf86f5dc..5d8bc7d23be4 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,86 +31,110 @@ namespace Avalanche { const varying_string<4> codes = " "; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -byte x,xx,y; -string title,fn; +byte x, xx, y; +string title, fn; file f; fonttype font; byte code; -typedef array<1,3840,byte> atype; +typedef array<1, 3840, byte> atype; -void save() -{ - file f; - word fv; - atype a /*absolute $B800:0*/; -; - assign(f,"TEXT1.SCR"); - rewrite(f); f << a; close(f); +void save() { + file f; + word fv; + atype a /*absolute $B800:0*/; + ; + assign(f, "TEXT1.SCR"); + rewrite(f); + f << a; + close(f); } -void centre(byte y, string z) -{; - gotoxy(40-length(z) / 2,y); output << z; +void centre(byte y, string z) { + ; + gotoxy(40 - length(z) / 2, y); + output << z; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; -/* write('Title?'); readln(title); - write('Font?'); readln(fn); */ - textattr=0; clrscr; - title="Bug Alert!"; fn=""; - for( xx=1; xx <= 77; xx ++) - {; - gotoxy(Random(80)+1,Random(24)+1); - switch (Random(2)) { - case 0: textattr=red; break; - case 1: textattr=lightred; break; - } - switch (Random(4)) { - case 0: output << '*'; break; - case 1: output << '\17'; break; - case 2: output << ''; break; - case 3: output << ''; break; - } - } - textattr=12; - assign(f,"c:\\thomas\\ttsmall.fnt"); - reset(f); f >> font; close(f); - for( y=0; y <= 3; y ++) - {; - for( x=1; x <= length(title); x ++) - {; - for( xx=7; xx >= 0; xx --) - {; - code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ - (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; - gotoxy(1+x*8-xx,y+1); - if (code>0) output << codes[code+1-1]; - } - } - /*if wherex<>1 then writeln;*/ - } - textattr=red; - centre(7,"An internal error has just occurred within the program."); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + /* write('Title?'); readln(title); + write('Font?'); readln(fn); */ + textattr = 0; + clrscr; + title = "Bug Alert!"; + fn = ""; + for (xx = 1; xx <= 77; xx ++) { + ; + gotoxy(Random(80) + 1, Random(24) + 1); + switch (Random(2)) { + case 0: + textattr = red; + break; + case 1: + textattr = lightred; + break; + } + switch (Random(4)) { + case 0: + output << '*'; + break; + case 1: + output << '\17'; + break; + case 2: + output << ''; + break; + case 3: + output << ''; + break; + } + } + textattr = 12; + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); + for (y = 0; y <= 3; y ++) { + ; + for (x = 1; x <= length(title); x ++) { + ; + for (xx = 7; xx >= 0; xx --) { + ; + code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; + gotoxy(1 + x * 8 - xx, y + 1); + if (code > 0) output << codes[code + 1 - 1]; + } + } + /*if wherex<>1 then writeln;*/ + } + textattr = red; + centre(7, "An internal error has just occurred within the program."); - textattr=white; gotoxy(26, 9); output << "Error number: "; - textattr=lightred; output << " "; - textattr=white; gotoxy(27,10); output << "at location: "; - textattr=lightred; output << " "; - centre(12,"This screen should never come up..."); - centre(13,"but it just has!"); - textattr=15; - centre(15,"So, please tell Thorsoft about this as soon as"); - centre(16,"possible, so that we can fix it."); - textattr=red; - centre(20,"Thanks..."); - save(); -return EXIT_SUCCESS; + textattr = white; + gotoxy(26, 9); + output << "Error number: "; + textattr = lightred; + output << " "; + textattr = white; + gotoxy(27, 10); + output << "at location: "; + textattr = lightred; + output << " "; + centre(12, "This screen should never come up..."); + centre(13, "but it just has!"); + textattr = 15; + centre(15, "So, please tell Thorsoft about this as soon as"); + centre(16, "possible, so that we can fix it."); + textattr = red; + centre(20, "Thanks..."); + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index 6cb6fca6e905..c3de473a0a8d 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,110 +31,130 @@ namespace Avalanche { const varying_string<4> codes = " "; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -byte x,xx,y; +byte x, xx, y; string qq; file f; fonttype font; byte code; -typedef array<1,3840,byte> atype; +typedef array<1, 3840, byte> atype; -void save() -{ - file f; - word fv; - atype a /*absolute $B800:0*/; -; - assign(f,"TEXT2.SCR"); - rewrite(f); f << a; close(f); +void save() { + file f; + word fv; + atype a /*absolute $B800:0*/; + ; + assign(f, "TEXT2.SCR"); + rewrite(f); + f << a; + close(f); } -void centre(byte y, string z) -{ - byte fv; -; - for( fv=1; fv <= length(z); fv ++) - {; - gotoxy(39-length(z) / 2+fv,y); - if (odd(fv+y)) textattr=2; else textattr=cyan; - if (z[fv]!='\40') output << z[fv]; - } +void centre(byte y, string z) { + byte fv; + ; + for (fv = 1; fv <= length(z); fv ++) { + ; + gotoxy(39 - length(z) / 2 + fv, y); + if (odd(fv + y)) textattr = 2; + else textattr = cyan; + if (z[fv] != '\40') output << z[fv]; + } } -void line(byte yy, string title) -{ - const integer offset = 5; -; - for( y=1; y <= 6; y ++) - {; - qq=""; - for( x=1; x <= length(title); x ++) - {; - for( xx=7; xx >= 0; xx --) - {; - code=(byte)(((1 << xx) & font[title[x]][y*2-offset])>0)+ - (byte)(((1 << xx) & font[title[x]][y*2+1-offset])>0)*2; - qq=qq+codes[code+1-1]; - } - } - centre(y+yy,qq); - } +void line(byte yy, string title) { + const integer offset = 5; + ; + for (y = 1; y <= 6; y ++) { + ; + qq = ""; + for (x = 1; x <= length(title); x ++) { + ; + for (xx = 7; xx >= 0; xx --) { + ; + code = (byte)(((1 << xx) & font[title[x]][y * 2 - offset]) > 0) + + (byte)(((1 << xx) & font[title[x]][y * 2 + 1 - offset]) > 0) * 2; + qq = qq + codes[code + 1 - 1]; + } + } + centre(y + yy, qq); + } } -void chips() -{ - byte fv,x,y; -; - for( fv=0; fv <= 1; fv ++) - {; - textattr=120; - for( y=2; y <= 6; y ++) - {; - gotoxy(fv*67+3,y); output << " "; if (fv==1) output << ' '; - } - gotoxy(fv*67+4,4); - if (fv==0) output << "RAM"; else output << "CRAM"; - textattr=7; - for( x=0; x <= 1; x ++) - for( y=2; y <= 6; y ++) - {; gotoxy(fv*67+2+x*(6+fv),y); output << ''; } - } +void chips() { + byte fv, x, y; + ; + for (fv = 0; fv <= 1; fv ++) { + ; + textattr = 120; + for (y = 2; y <= 6; y ++) { + ; + gotoxy(fv * 67 + 3, y); + output << " "; + if (fv == 1) output << ' '; + } + gotoxy(fv * 67 + 4, 4); + if (fv == 0) output << "RAM"; + else output << "CRAM"; + textattr = 7; + for (x = 0; x <= 1; x ++) + for (y = 2; y <= 6; y ++) { + ; + gotoxy(fv * 67 + 2 + x * (6 + fv), y); + output << ''; + } + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=0; clrscr; - chips(); - assign(f,"c:\\thomas\\ttsmall.fnt"); - reset(f); f >> font; close(f); - line(0,"Out of"); - line(4,"memory!"); - centre(11,"Yes, RAM cram strikes again- Avvy has just run out of RAM (not the"); - centre(12,"hydraulic, woolly or village kinds.) Fortunately, there are a few things"); - centre(13,"you can do about this:"); - textattr=3; - for( xx=15; xx <= 17; xx ++) - {; - gotoxy(23,xx); output << '\20'; - } - textattr=2; - gotoxy(25,15); output << "Don't run Avvy in a DOS shell."; - gotoxy(25,16); output << "If that fails, try un-installing your TSRs."; - gotoxy(25,17); output << "If you've got DOS 50 or above, try using"; - gotoxy(28,18); textattr=3; output << "dos=high"; - textattr=2; output << ','; - textattr=3; output << " loadhigh"; - textattr=2; output << " and"; - textattr=3; output << " devicehigh"; - textattr=2; output << '.'; - gotoxy(28,19); output << "See your DOS manual for details..."; - centre(23,"Sorry for any inconvenience..."); - save(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 0; + clrscr; + chips(); + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); + line(0, "Out of"); + line(4, "memory!"); + centre(11, "Yes, RAM cram strikes again- Avvy has just run out of RAM (not the"); + centre(12, "hydraulic, woolly or village kinds.) Fortunately, there are a few things"); + centre(13, "you can do about this:"); + textattr = 3; + for (xx = 15; xx <= 17; xx ++) { + ; + gotoxy(23, xx); + output << '\20'; + } + textattr = 2; + gotoxy(25, 15); + output << "Don't run Avvy in a DOS shell."; + gotoxy(25, 16); + output << "If that fails, try un-installing your TSRs."; + gotoxy(25, 17); + output << "If you've got DOS 50 or above, try using"; + gotoxy(28, 18); + textattr = 3; + output << "dos=high"; + textattr = 2; + output << ','; + textattr = 3; + output << " loadhigh"; + textattr = 2; + output << " and"; + textattr = 3; + output << " devicehigh"; + textattr = 2; + output << '.'; + gotoxy(28, 19); + output << "See your DOS manual for details..."; + centre(23, "Sorry for any inconvenience..."); + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index b71353c9e027..54ad5b0f4dc6 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,90 +31,112 @@ namespace Avalanche { const varying_string<4> codes = " "; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -byte x,xx,y; +byte x, xx, y; string qq; file f; fonttype font; byte code; -typedef array<1,3840,byte> atype; +typedef array<1, 3840, byte> atype; -void save() -{ - file f; - word fv; - atype a /*absolute $B800:0*/; -; - assign(f,"TEXT3.SCR"); - rewrite(f); f << a; close(f); +void save() { + file f; + word fv; + atype a /*absolute $B800:0*/; + ; + assign(f, "TEXT3.SCR"); + rewrite(f); + f << a; + close(f); } -void centre(byte y, string z) -{ - byte fv; -; - for( fv=1; fv <= length(z); fv ++) - {; - gotoxy(39-length(z) / 2+fv,y); - if (z[fv]!='\40') output << z[fv]; - } +void centre(byte y, string z) { + byte fv; + ; + for (fv = 1; fv <= length(z); fv ++) { + ; + gotoxy(39 - length(z) / 2 + fv, y); + if (z[fv] != '\40') output << z[fv]; + } } -void line(byte cx,byte cy, string title) -{; - for( y=0; y <= 4; y ++) - {; - qq=""; - for( x=1; x <= length(title); x ++) - {; - for( xx=7; xx >= 0; xx --) - {; - code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ - (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; - qq=qq+codes[code+1-1]; - } - } - gotoxy(cx,cy+y); output << qq; - } +void line(byte cx, byte cy, string title) { + ; + for (y = 0; y <= 4; y ++) { + ; + qq = ""; + for (x = 1; x <= length(title); x ++) { + ; + for (xx = 7; xx >= 0; xx --) { + ; + code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; + qq = qq + codes[code + 1 - 1]; + } + } + gotoxy(cx, cy + y); + output << qq; + } } -void big_t() -{ - text t; - string x; - byte y; -; - assign(t,"c:\\avalot\\t.txt"); reset(t); y=1; - while (! eof(t)) - {; - t >> x >> NL; - gotoxy(1,y); output << x; y += 1; - } +void big_t() { + text t; + string x; + byte y; + ; + assign(t, "c:\\avalot\\t.txt"); + reset(t); + y = 1; + while (! eof(t)) { + ; + t >> x >> NL; + gotoxy(1, y); + output << x; + y += 1; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=4; clrscr; - assign(f,"c:\\thomas\\ttsmall.fnt"); - reset(f); f >> font; close(f); - textattr=4; line(19,4,"hanks"); - textattr=6; line(23,8,"for"); - line(7,12,"playing"); textattr += 8; - line(12,16,"Avalot."); - textattr=12; big_t(); - textattr=8; gotoxy(40,2); output << "(c) 1994, Mike, Mark and Thomas Thurman."; - textattr=11; gotoxy(50,10); output << "* Goodbyte! *"; - textattr=10; gotoxy(9,20); output << '\20'; - textattr=12; output << " If you'd like to see yet more of these games, then don't forget to"; - gotoxy(12,21); output << "register, or your"; clreol; - gotoxy(12,22); output << "for the rest of your life!"; - gotoxy(60,22); output << "(Only joking!)"; - save(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 4; + clrscr; + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); + textattr = 4; + line(19, 4, "hanks"); + textattr = 6; + line(23, 8, "for"); + line(7, 12, "playing"); + textattr += 8; + line(12, 16, "Avalot."); + textattr = 12; + big_t(); + textattr = 8; + gotoxy(40, 2); + output << "(c) 1994, Mike, Mark and Thomas Thurman."; + textattr = 11; + gotoxy(50, 10); + output << "* Goodbyte! *"; + textattr = 10; + gotoxy(9, 20); + output << '\20'; + textattr = 12; + output << " If you'd like to see yet more of these games, then don't forget to"; + gotoxy(12, 21); + output << "register, or your"; + clreol; + gotoxy(12, 22); + output << "for the rest of your life!"; + gotoxy(60, 22); + output << "(Only joking!)"; + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index 7f5cb6ada0f0..befde2a7f383 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,86 +31,102 @@ namespace Avalanche { const varying_string<4> codes = " "; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -byte x,xx,y; +byte x, xx, y; string qq; file f; fonttype font; byte code; -void centre(byte y, string z) -{ - byte fv; -; - for( fv=1; fv <= length(z); fv ++) - {; - gotoxy(39-length(z) / 2+fv,y); - if (z[fv]!='\40') output << z[fv]; - } +void centre(byte y, string z) { + byte fv; + ; + for (fv = 1; fv <= length(z); fv ++) { + ; + gotoxy(39 - length(z) / 2 + fv, y); + if (z[fv] != '\40') output << z[fv]; + } } -void line(byte cy, string title) -{; - for( y=0; y <= 6; y ++) - {; - qq=""; - for( x=1; x <= length(title); x ++) - {; - for( xx=3; xx >= 0; xx --) - {; - code=(byte)(((1 << (xx*2)) & font[title[x]][y])>0)+ - (byte)(((1 << (xx*2+1)) & font[title[x]][y])>0)*2; - qq=qq+codes[code+1-1]; - } - } - centre(cy+y,qq); - } +void line(byte cy, string title) { + ; + for (y = 0; y <= 6; y ++) { + ; + qq = ""; + for (x = 1; x <= length(title); x ++) { + ; + for (xx = 3; xx >= 0; xx --) { + ; + code = (byte)(((1 << (xx * 2)) & font[title[x]][y]) > 0) + + (byte)(((1 << (xx * 2 + 1)) & font[title[x]][y]) > 0) * 2; + qq = qq + codes[code + 1 - 1]; + } + } + centre(cy + y, qq); + } } -void big_t() -{ - text t; - string x; - byte y; -; - assign(t,"c:\\avalot\\t.txt"); reset(t); y=1; - while (! eof(t)) - {; - t >> x >> NL; - gotoxy(1,y); output << x; y += 1; - } +void big_t() { + text t; + string x; + byte y; + ; + assign(t, "c:\\avalot\\t.txt"); + reset(t); + y = 1; + while (! eof(t)) { + ; + t >> x >> NL; + gotoxy(1, y); + output << x; + y += 1; + } } -void box(byte x1,byte y1,byte x2,byte y2, string z) -{ - byte fv; -; - gotoxy(x1,y1); output << z[1]; /* tl */ - gotoxy(x2,y1); output << z[2]; /* tr */ - gotoxy(x1,y2); output << z[3]; /* bl */ - gotoxy(x2,y2); output << z[4]; /* br */ - for( fv=y1+1; fv <= y2-1; fv ++) - {; - gotoxy(x1,fv); output << z[5]; /* verticals */ - gotoxy(x2,fv); output << z[6]; - } - gotoxy(x1+1,y1); for( fv=x1+1; fv <= x2-1; fv ++) output << z[7]; - gotoxy(x1+1,y2); for( fv=x1+1; fv <= x2-1; fv ++) output << z[8]; +void box(byte x1, byte y1, byte x2, byte y2, string z) { + byte fv; + ; + gotoxy(x1, y1); + output << z[1]; /* tl */ + gotoxy(x2, y1); + output << z[2]; /* tr */ + gotoxy(x1, y2); + output << z[3]; /* bl */ + gotoxy(x2, y2); + output << z[4]; /* br */ + for (fv = y1 + 1; fv <= y2 - 1; fv ++) { + ; + gotoxy(x1, fv); + output << z[5]; /* verticals */ + gotoxy(x2, fv); + output << z[6]; + } + gotoxy(x1 + 1, y1); + for (fv = x1 + 1; fv <= x2 - 1; fv ++) output << z[7]; + gotoxy(x1 + 1, y2); + for (fv = x1 + 1; fv <= x2 - 1; fv ++) output << z[8]; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=26; clrscr; - assign(f,"c:\\thomas\\ttsmall.fnt"); - reset(f); f >> font; close(f); - line(3,"CONGRATULATIONS!"); - textattr=30; box(4,1,74,11,"ɻȼ"); - textattr=33; box(6,2,72,10,"/\\\\/"); - textattr=30; centre(12,"Well done!"); - textattr=27; centre(14,"You completed the game!"); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 26; + clrscr; + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); + line(3, "CONGRATULATIONS!"); + textattr = 30; + box(4, 1, 74, 11, "ɻȼ"); + textattr = 33; + box(6, 2, 72, 10, "/\\\\/"); + textattr = 30; + centre(12, "Well done!"); + textattr = 27; + centre(14, "You completed the game!"); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index 5a4aa12b2289..bc4472a6c8b8 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,90 +31,121 @@ namespace Avalanche { const varying_string<4> codes = " "; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; -byte x,xx,y; +byte x, xx, y; string qq; file f; fonttype font; byte code; -typedef array<1,3840,byte> atype; +typedef array<1, 3840, byte> atype; -void save() -{ - file f; - word fv; - atype a /*absolute $B800:0*/; -; - assign(f,"TEXT5.SCR"); - rewrite(f); f << a; close(f); +void save() { + file f; + word fv; + atype a /*absolute $B800:0*/; + ; + assign(f, "TEXT5.SCR"); + rewrite(f); + f << a; + close(f); } -void line(byte cx,byte cy, string title) -{; - for( y=0; y <= 4; y ++) - {; - qq=""; - for( x=1; x <= length(title); x ++) - {; - for( xx=7; xx >= 0; xx --) - {; - code=(byte)(((1 << xx) & font[title[x]][y*2])>0)+ - (byte)(((1 << xx) & font[title[x]][y*2+1])>0)*2; - qq=qq+codes[code+1-1]; - } - } - gotoxy(cx,cy+y); output << qq; - } +void line(byte cx, byte cy, string title) { + ; + for (y = 0; y <= 4; y ++) { + ; + qq = ""; + for (x = 1; x <= length(title); x ++) { + ; + for (xx = 7; xx >= 0; xx --) { + ; + code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; + qq = qq + codes[code + 1 - 1]; + } + } + gotoxy(cx, cy + y); + output << qq; + } } -void uline() -{ - byte fv,ff; -; - for( fv=1; fv <= 10; fv ++) - {; - gotoxy(16-fv,21-fv); textattr=fv; - for( ff=1; ff <= fv; ff ++) output << "-"; - } +void uline() { + byte fv, ff; + ; + for (fv = 1; fv <= 10; fv ++) { + ; + gotoxy(16 - fv, 21 - fv); + textattr = fv; + for (ff = 1; ff <= fv; ff ++) output << "-"; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - textattr=0; clrscr; - assign(f,"c:\\thomas\\ttsmall.fnt"); - reset(f); f >> font; close(f); - textattr=11; - line( 1, 3,"Two at"); - line( 3, 7,"once?!"); - textattr=9; gotoxy(55,4); output << string('\4')+'\377'; - textattr=3; output << "You're trying to run"; - gotoxy(54,5); output << "two copies of Avalot"; - gotoxy(54,6); output << "at once."; - gotoxy(57,8); output << "Although this "; textattr=9; output << "is"; - textattr=3; - gotoxy(54,9); output << "usually possible, it's"; - gotoxy(54,10); output << "probably more sensible"; - gotoxy(54,11); output << "to type "; - textattr=7; output << "EXIT "; - textattr=3; output << "now, which"; - gotoxy(54,12); output << "should return you to the"; - gotoxy(54,13); output << "first copy in memory."; - - textattr=11; gotoxy(55,15); output << "BUT:"; textattr=9; - gotoxy(40,16); output << "If you want to run two copies anyway,"; - gotoxy(40,17); output << "or you think that I've got it wrong,"; - gotoxy(40,18); output << "(even computers can make mistakes!) then"; - gotoxy(40,19); output << "try running the game again, but this time"; - gotoxy(40,20); output << "use "; textattr=7; output << "/i "; - textattr=9; output << "on the command line."; - uline(); - - save(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + textattr = 0; + clrscr; + assign(f, "c:\\thomas\\ttsmall.fnt"); + reset(f); + f >> font; + close(f); + textattr = 11; + line(1, 3, "Two at"); + line(3, 7, "once?!"); + textattr = 9; + gotoxy(55, 4); + output << string('\4') + '\377'; + textattr = 3; + output << "You're trying to run"; + gotoxy(54, 5); + output << "two copies of Avalot"; + gotoxy(54, 6); + output << "at once."; + gotoxy(57, 8); + output << "Although this "; + textattr = 9; + output << "is"; + textattr = 3; + gotoxy(54, 9); + output << "usually possible, it's"; + gotoxy(54, 10); + output << "probably more sensible"; + gotoxy(54, 11); + output << "to type "; + textattr = 7; + output << "EXIT "; + textattr = 3; + output << "now, which"; + gotoxy(54, 12); + output << "should return you to the"; + gotoxy(54, 13); + output << "first copy in memory."; + + textattr = 11; + gotoxy(55, 15); + output << "BUT:"; + textattr = 9; + gotoxy(40, 16); + output << "If you want to run two copies anyway,"; + gotoxy(40, 17); + output << "or you think that I've got it wrong,"; + gotoxy(40, 18); + output << "(even computers can make mistakes!) then"; + gotoxy(40, 19); + output << "try running the game again, but this time"; + gotoxy(40, 20); + output << "use "; + textattr = 7; + output << "/i "; + textattr = 9; + output << "on the command line."; + uline(); + + save(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index 1fb494257e86..f71afd0f61ff 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,17 +33,19 @@ text t; string x; byte fv; untyped_file f; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(f,"v:paralogo.scr"); - clrscr; - reset(f,1); - blockread(f,mem[0xb800*0],4000); - close(f); - gotoxy(1,1); insline; - gotoxy(1,23); clreol; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(f, "v:paralogo.scr"); + clrscr; + reset(f, 1); + blockread(f, mem[0xb800 * 0], 4000); + close(f); + gotoxy(1, 1); + insline; + gotoxy(1, 23); + clreol; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index c109624671e3..878f8d0f786f 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,13 +39,13 @@ #include "scrolls.h" #include "lucerna.h" - #include "Graph.h" - /*#include "Crt.h"*/ +#include "Graph.h" +/*#include "Crt.h"*/ #include "trip5.h" #include "enhanced.h" - /*#include "Dos.h"*/ +/*#include "Dos.h"*/ #include "logger.h" - #include "Acci.h" +#include "Acci.h" #include "basher.h" #include "visa.h" #include "timeout.h" @@ -57,753 +57,891 @@ const integer italic = 1; const integer halficonwidth = 19; /* Half the width of an icon. */ -integer dix,diy; -array ch; +integer dix, diy; +array ch; byte cfont; /* Current font */ -integer dodgex,dodgey; +integer dodgex, dodgey; byte param; /* For using arguments code */ byte use_icon; -void state(byte x) /* Sets "Ready" light to whatever */ -{ - byte page_; - - if (ledstatus==x) return; /* Already like that! */ - switch (x) { - case 0: setfillstyle(1,black); break; /* Off */ - case 1: setfillstyle(9,green); break; /* Half-on (menus) */ - case 2: setfillstyle(1,green); break; /* On (kbd) */ - case 3: setfillstyle(6,green); break; /* Hit a key */ - } - super_off(); - for( page_=0; page_ <= 1; page_ ++) - { setactivepage(page_); bar(419,195,438,197); } super_on(); - ledstatus=x; +void state(byte x) { /* Sets "Ready" light to whatever */ + byte page_; + + if (ledstatus == x) return; /* Already like that! */ + switch (x) { + case 0: + setfillstyle(1, black); + break; /* Off */ + case 1: + setfillstyle(9, green); + break; /* Half-on (menus) */ + case 2: + setfillstyle(1, green); + break; /* On (kbd) */ + case 3: + setfillstyle(6, green); + break; /* Hit a key */ + } + super_off(); + for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + bar(419, 195, 438, 197); + } + super_on(); + ledstatus = x; } -void easteregg() -{ - word fv,ff; - - background(15); - for( fv=4; fv <= 100; fv ++) - for( ff=0; ff <= 70; ff ++) - { sound(fv*100+ff*10); delay(1); } - nosound; setcolor(10); - settextstyle(0,0,3); settextjustify(1,1); outtextxy(320,100,"GIED"); - settextstyle(0,0,1); settextjustify(0,2); - background(0); +void easteregg() { + word fv, ff; + + background(15); + for (fv = 4; fv <= 100; fv ++) + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } + nosound; + setcolor(10); + settextstyle(0, 0, 3); + settextjustify(1, 1); + outtextxy(320, 100, "GIED"); + settextstyle(0, 0, 1); + settextjustify(0, 2); + background(0); } -void say(integer x,integer y, string z) /* Fancy FAST screenwriting */ -{ - const integer locol = 2; - byte xx,yy,ox,bit,lz,t; integer yp; boolean offset; - matrix<1,12,1,80,byte> itw; - - offset=x % 8==4; x=x / 8; lz=length(z); ox=0; - log_scrollline(); - - for( xx=1; xx <= lz; xx ++) - { - switch (z[xx]) { - case '\22': { cfont=roman; log_roman(); } break; - case '\6': { cfont=italic; log_italic(); } break; - default: { - ox += 1; - for( yy=1; yy <= 12; yy ++) itw[yy][ox]=~ ch[cfont][z[xx]][yy+1]; - log_scrollchar(z[xx]); - } - } - } - - lz=ox; - if (offset) - { /* offsetting routine */ - lz += 1; - for( yy=1; yy <= 12; yy ++) - { - bit=240; itw[yy][lz]=255; - for( xx=1; xx <= lz; xx ++) - { - t=itw[yy][xx]; - itw[yy][xx]=bit+t / 16; - bit=t << 4; - } - } - } - yp=x+y*80+(1-cp)*pagetop; - for( yy=1; yy <= 12; yy ++) - { - yp += 80; - for( bit=0; bit <= locol; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - move(itw[yy],mem[0xa000*yp],lz); - } - } +void say(integer x, integer y, string z) { /* Fancy FAST screenwriting */ + const integer locol = 2; + byte xx, yy, ox, bit, lz, t; + integer yp; + boolean offset; + matrix<1, 12, 1, 80, byte> itw; + + offset = x % 8 == 4; + x = x / 8; + lz = length(z); + ox = 0; + log_scrollline(); + + for (xx = 1; xx <= lz; xx ++) { + switch (z[xx]) { + case '\22': { + cfont = roman; + log_roman(); + } + break; + case '\6': { + cfont = italic; + log_italic(); + } + break; + default: { + ox += 1; + for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; + log_scrollchar(z[xx]); + } + } + } + + lz = ox; + if (offset) { + /* offsetting routine */ + lz += 1; + for (yy = 1; yy <= 12; yy ++) { + bit = 240; + itw[yy][lz] = 255; + for (xx = 1; xx <= lz; xx ++) { + t = itw[yy][xx]; + itw[yy][xx] = bit + t / 16; + bit = t << 4; + } + } + } + yp = x + y * 80 + (1 - cp) * pagetop; + for (yy = 1; yy <= 12; yy ++) { + yp += 80; + for (bit = 0; bit <= locol; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(itw[yy], mem[0xa000 * yp], lz); + } + } } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ -void normscroll() -{ - const array<1,8,char> egg = string("\20\f\25\7\b")+"***"; - const array<1,8,char> e = "(c) 1994"; - char r; - boolean oktoexit; - - state(3); seescroll=true; - off_virtual(); - on(); newpointer(4); - mousepage(1-cp); - - if (demo) get_demorec(); - - do { - do { - check(); /* was "checkclick;" */ - - #ifdef RECORD slowdown(); basher::count += 1; #endif - - if (demo) - { - if (demo_ready()) flush(); - if (keypressede()) exit(0); - } else - if (keypressede()) flush(); - } while (!((mrelease>0) || (buttona1()) || (buttonb1()))); - - - if (mrelease==0) - { - inkey(); - if (aboutscroll) - { - move(e[2-1],e[1-1],7); - e[8-1]=inchar; - if (egg==e) easteregg(); - } - oktoexit=set::of('\15','\33','+','#', eos).has(inchar); - if (! oktoexit) errorled(); - } - - } while (!((oktoexit) || (mrelease>0))); - #ifdef RECORD record_one(); #endif - screturn=r=='#'; /* "back door" */ - state(0); seescroll=false; mousepage(cp); off(); +void normscroll() { + const array<1, 8, char> egg = string("\20\f\25\7\b") + "***"; + const array<1, 8, char> e = "(c) 1994"; + char r; + boolean oktoexit; + + state(3); + seescroll = true; + off_virtual(); + on(); + newpointer(4); + mousepage(1 - cp); + + if (demo) get_demorec(); + + do { + do { + check(); /* was "checkclick;" */ + +#ifdef RECORD slowdown(); basher::count += 1; #endif + + if (demo) { + if (demo_ready()) flush(); + if (keypressede()) exit(0); + } else if (keypressede()) flush(); + } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); + + + if (mrelease == 0) { + inkey(); + if (aboutscroll) { + move(e[2 - 1], e[1 - 1], 7); + e[8 - 1] = inchar; + if (egg == e) easteregg(); + } + oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); + if (! oktoexit) errorled(); + } + + } while (!((oktoexit) || (mrelease > 0))); +#ifdef RECORD record_one(); #endif + screturn = r == '#'; /* "back door" */ + state(0); + seescroll = false; + mousepage(cp); + off(); } -void dialogue() -{ - char r; - - state(3); seescroll=true; r='\0'; - newpointer(6); on(); - mousepage(1-cp); - do { - do { - check(); - if (mrelease>0) - { - if ((mx>=(cardinal)dix-65) && (my>=(cardinal)diy-24) && (mx<=(cardinal)dix- 5) && (my<=(cardinal)diy-10)) - r='Y'; - if ((mx>=(cardinal)dix+ 5) && (my>=(cardinal)diy-24) && (mx<=(cardinal)dix+65) && (my<=(cardinal)diy-10)) - r='N'; - } else - if (keypressede()) - { - inkey(); - r=upcase(inchar); - } - } while (!(r!='\0')); - } while (!(set::of('Y','N','O','J', eos).has(r))); /* Yes, Ja, Oui, or No, Non, Nein */ - screturn=r!='N'; - state(0); seescroll=false; mousepage(cp); off(); +void dialogue() { + char r; + + state(3); + seescroll = true; + r = '\0'; + newpointer(6); + on(); + mousepage(1 - cp); + do { + do { + check(); + if (mrelease > 0) { + if ((mx >= (cardinal)dix - 65) && (my >= (cardinal)diy - 24) && (mx <= (cardinal)dix - 5) && (my <= (cardinal)diy - 10)) + r = 'Y'; + if ((mx >= (cardinal)dix + 5) && (my >= (cardinal)diy - 24) && (mx <= (cardinal)dix + 65) && (my <= (cardinal)diy - 10)) + r = 'N'; + } else if (keypressede()) { + inkey(); + r = upcase(inchar); + } + } while (!(r != '\0')); + } while (!(set::of('Y', 'N', 'O', 'J', eos).has(r))); /* Yes, Ja, Oui, or No, Non, Nein */ + screturn = r != 'N'; + state(0); + seescroll = false; + mousepage(cp); + off(); } void music_scroll(); -static void store_(byte what, tunetype& played) -{ - move(played[2],played[1],sizeof(played)-1); - played[31]=what; +static void store_(byte what, tunetype &played) { + move(played[2], played[1], sizeof(played) - 1); + played[31] = what; } -static boolean they_match(tunetype& played) -{ - byte fv,mistakes; +static boolean they_match(tunetype &played) { + byte fv, mistakes; - boolean they_match_result; - mistakes=0; + boolean they_match_result; + mistakes = 0; - for( fv=1; fv <= sizeof(played); fv ++) - if (played[fv]!=tune[fv]) - { - mistakes += 1; - } + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != tune[fv]) { + mistakes += 1; + } - they_match_result=mistakes<5; - return they_match_result; + they_match_result = mistakes < 5; + return they_match_result; } -void music_scroll() -{ - char r; - byte value; +void music_scroll() { + char r; + byte value; - byte last_one,this_one; + byte last_one, this_one; - tunetype played; + tunetype played; - state(3); seescroll=true; on(); - newpointer(4); - do { - do { - check(); /* was "checkclick;" */ - if (keypressede()) flush(); - } while (!((mpress>0) || (buttona1()) || (buttonb1()))); + state(3); + seescroll = true; + on(); + newpointer(4); + do { + do { + check(); /* was "checkclick;" */ + if (keypressede()) flush(); + } while (!((mpress > 0) || (buttona1()) || (buttonb1()))); - if (mpress==0) - { - inkey(); - r=upcase(inchar); if (r=='Z') r='Y'; /* Euro keyboards */ + if (mpress == 0) { + inkey(); + r = upcase(inchar); + if (r == 'Z') r = 'Y'; /* Euro keyboards */ - value=pos(r,keys); + value = pos(r, keys); - if (value>0) - { + if (value > 0) { - last_one=this_one; - this_one=value; + last_one = this_one; + this_one = value; - sound(notes[this_one]); - delay(100); - nosound; + sound(notes[this_one]); + delay(100); + nosound; - if (! dna.ringing_bells) - { /* These handle playing the right tune. */ + if (! dna.ringing_bells) { + /* These handle playing the right tune. */ - if (this_one0))); - screturn=false; - off(); - state(0); seescroll=false; + } while (!((set::of('\15', '\33', '+', '#', eos).has(r)) || (mpress > 0))); + screturn = false; + off(); + state(0); + seescroll = false; } /* ThatsAll, so put us back to */ /*$F-*/ -void resetscrolldriver() /* phew */ -{ - scrollbells=0; cfont=roman; log_epsonroman(); use_icon=0; - interrogation=0; /* always reset after a scroll comes up. */ +void resetscrolldriver() { /* phew */ + scrollbells = 0; + cfont = roman; + log_epsonroman(); + use_icon = 0; + interrogation = 0; /* always reset after a scroll comes up. */ } -void dingdongbell() /* Pussy's in the well. Who put her in? Little... */ -{ - byte fv; +void dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ + byte fv; - for( fv=1; fv <= scrollbells; fv ++) errorled(); /* ring the bell "x" times */ + for (fv = 1; fv <= scrollbells; fv ++) errorled(); /* ring the bell "x" times */ } void dodgem() /* This moves the mouse pointer off the scroll so that you can read it. */ { - xycheck(); /* Mx & my now contain xy pos of mouse */ - dodgex=mx; dodgey=my; /* Store 'em */ - hopto(dodgex,underscroll); /* Move the pointer off the scroll. */ + xycheck(); /* Mx & my now contain xy pos of mouse */ + dodgex = mx; + dodgey = my; /* Store 'em */ + hopto(dodgex, underscroll); /* Move the pointer off the scroll. */ } void undodgem() /* This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. */ { - xycheck(); - if ((mx==(cardinal)dodgex) && (my==(cardinal)underscroll)) - /* No change, so restore the pointer's original position. */ - hopto(dodgex,dodgey); + xycheck(); + if ((mx == (cardinal)dodgex) && (my == (cardinal)underscroll)) + /* No change, so restore the pointer's original position. */ + hopto(dodgex, dodgey); } -void geticon(integer x,integer y, byte which) -{ - untyped_file f; - pointer p; - - assign(f,"icons.avd"); - reset(f,1); - which -= 1; - seek(f,which*426); - getmem(p,426); - blockread(f,p,426); - putimage(x,y,p,0); - freemem(p,426); - close(f); +void geticon(integer x, integer y, byte which) { + untyped_file f; + pointer p; + + assign(f, "icons.avd"); + reset(f, 1); + which -= 1; + seek(f, which * 426); + getmem(p, 426); + blockread(f, p, 426); + putimage(x, y, p, 0); + freemem(p, 426); + close(f); } -void block_drop(string fn, integer xl,integer yl,integer y) -{ - untyped_file f; byte bit; - integer fv; word st; - - st=(y-1)*80+(40-xl / 2)+((1-cp)*pagetop); - - assign(f,fn+".avd"); - reset(f,1); - - for( fv=1; fv <= yl; fv ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,mem[0xa000*st+(fv*80)],xl); - } - - close(f); - bit=getpixel(0,0); +void block_drop(string fn, integer xl, integer yl, integer y) { + untyped_file f; + byte bit; + integer fv; + word st; + + st = (y - 1) * 80 + (40 - xl / 2) + ((1 - cp) * pagetop); + + assign(f, fn + ".avd"); + reset(f, 1); + + for (fv = 1; fv <= yl; fv ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * st + (fv * 80)], xl); + } + + close(f); + bit = getpixel(0, 0); } -void drawscroll(proc gotoit) /* This is one of the oldest procs in the game. */ -{ - byte b,groi; integer lx,ly,mx,my,ex,ey; boolean centre; - byte icon_indent; +void drawscroll(proc gotoit) { /* This is one of the oldest procs in the game. */ + byte b, groi; + integer lx, ly, mx, my, ex, ey; + boolean centre; + byte icon_indent; - off_virtual(); - setvisualpage(cp); setactivepage(1-cp); - oncandopageswap=false; /* On can now no longer swap pages. So we can + off_virtual(); + setvisualpage(cp); + setactivepage(1 - cp); + oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ - log_epsonroman(); /* Scrolls always START with Roman. */ - lx=0; ly=scrolln*6; - for( b=1; b <= scrolln; b ++) - { - ex=length(scroll[b])*8; if (lx0) after_the_scroll=true; + log_epsonroman(); /* Scrolls always START with Roman. */ + lx = 0; + ly = scrolln * 6; + for (b = 1; b <= scrolln; b ++) { + ex = length(scroll[b]) * 8; + if (lx < ex) lx = ex; + } + mx = 320; + my = 100; /* Getmaxx & getmaxy div 2, both. */ + lx = lx / 2; + ly -= 2; + + if (set::of(range(1, 34), eos).has(use_icon)) lx += halficonwidth; + + off(); + /* mblit(mx-lx-46,my-ly-6,mx+lx+15,my+ly+6,0,3);*/ + setfillstyle(1, 7); + setcolor(7); + pieslice(mx + lx, my - ly, 360, 90, 15); + pieslice(mx + lx, my + ly, 270, 360, 15); + setcolor(4); + arc(mx + lx, my - ly, 360, 90, 15); + arc(mx + lx, my + ly, 270, 360, 15); + bar(mx - lx - 30, my + ly + 6, mx + lx, my + ly); + bar(mx - lx - 30, my - ly - 6, mx + lx, my - ly); + bar(mx - lx - 15, my - ly, mx + lx + 15, my + ly); + setfillstyle(1, 8); + pieslice(mx - lx - 31, my - ly, 360, 180, 15); + pieslice(mx - lx - 31, my + ly, 180, 360, 15); + setfillstyle(1, 4); + bar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 6); + bar(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 6); + bar(mx - lx - 15, my - ly, mx - lx - 15, my + ly); + bar(mx + lx + 15, my - ly, mx + lx + 15, my + ly); + ex = mx - lx; + ey = my - ly; + mx -= lx; + my -= ly + 2; + setcolor(0); + centre = false; + + switch (use_icon) { + case 0: + icon_indent = 0; + break; /* No icon. */ + case 1 ... 33: { /* Standard icon */ + geticon(mx, my + ly / 2, use_icon); + icon_indent = 53; + } + break; + case 34: { + block_drop("about", 28, 76, 15); + icon_indent = 0; + } + break; + case 35: { + block_drop("gameover", 52, 59, 71); + icon_indent = 0; + } + break; + } + + for (b = 1; b <= scrolln; b ++) { + switch (scroll[b][length(scroll[b])]) { + case '\3' : { + centre = true; + scroll[b][0] -= 1; + } + break; + case '\14' : { + centre = false; + scroll[b][0] -= 1; + } + break; + case '\21' : { + settextjustify(1, 1); + dix = mx + lx; + diy = my + ly; + scroll[b][1] = '\40'; + groi = getpixel(0, 0); + /* inc(diy,14);*/ + shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); + shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + } + break; + } + + if (centre) + say(320 - length(scroll[b]) * 4 + icon_indent, my, scroll[b]); + else + say(mx + icon_indent, my, scroll[b]); + log_scrollendline(centre); + my += 12; + } + + underscroll = my + 3; + setvisualpage(1 - cp); + dingdongbell(); + my = getpixel(0, 0); + dropsok = false; + dodgem(); + + gotoit(); + + undodgem(); + dropsok = true; + log_divider(); + setvisualpage(cp); + mousepage(cp); + off(); + /* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/ + mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); + blitfix(); + oncandopageswap = true; /* Normality again */ + on(); + settextjustify(0, 0); /*sink*/ + resetscrolldriver(); + if (mpress > 0) after_the_scroll = true; } -void bubble(proc gotoit) -{ - integer xl,yl,my,xw,yw; byte fv; array<1,3,pointtype> p; - pointer rp1,rp2; /* replace: 1=bubble, 2=pointer */ - integer xc; /* x correction */ +void bubble(proc gotoit) { + integer xl, yl, my, xw, yw; + byte fv; + array<1, 3, pointtype> p; + pointer rp1, rp2; /* replace: 1=bubble, 2=pointer */ + integer xc; /* x correction */ - setvisualpage(cp); setactivepage(1-cp); - oncandopageswap=false; /* On can now no longer swap pages. So we can + setvisualpage(cp); + setactivepage(1 - cp); + oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ - mousepage(1-cp); /* Mousepage */ - - setfillstyle(1,talkb); setcolor(talkb); off(); - - xl=0; yl=scrolln*5; - for( fv=1; fv <= scrolln; fv ++) - if (textwidth(scroll[fv])>xl) xl=textwidth(scroll[fv]); - xl=xl / 2; - - xw=xl+18; yw=yl+7; - my=yw*2-2; xc=0; - - if ((talkx-xw)<0) xc=-(talkx-xw); - if ((talkx+xw)>639) xc=639-(talkx+xw); - - p[1].x=talkx-10; p[1].y=yw; - p[2].x=talkx+10; p[2].y=yw; - p[3].x=talkx; p[3].y=talky; - -/* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); - mblit(talkx-10,my,talkx+10,talky,0,3);*/ - bar(xc+talkx-xw+10,7,talkx+xw-10+xc,my); - bar(xc+talkx-xw,12,talkx+xw+xc,my-5); - pieslice(xc+talkx+xw-10,12,360,90,9); /* TR */ - pieslice(xc+talkx+xw-10,my-5,270,360,9); /* BR */ - pieslice(xc+talkx-xw+10,12,90,180,9); /* TL */ - pieslice(xc+talkx-xw+10,my-5,180,270,9); /* BL */ - fillpoly(3,p.body()); - - setcolor(talkf); yl -= 3; settextjustify(1,2); - for( fv=0; fv <= scrolln-1; fv ++) - outtextxy(talkx+xc,(fv*10)+12,scroll[fv+1]); - for( fv=1; fv <= scrolln; fv ++) /* These should be separate loops. */ - log_bubbleline(fv,param,scroll[fv]); - log_divider(); - - setvisualpage(1-cp); - dingdongbell(); - oncandopageswap=false; - on(); dropsok=false; gotoit(); off(); dropsok=true; - mblit((talkx-xw+xc) / 8,7,1+(talkx+xw+xc) / 8,my,3,1-cp); - mblit((talkx-10) / 8,my,1+(talkx+10) / 8,talky,3,1-cp); - blitfix(); - - setvisualpage(cp); - settextjustify(0,0); on(); /*sink;*/ - oncandopageswap=true; - resetscrolldriver(); - if (mpress>0) after_the_scroll=true; + mousepage(1 - cp); /* Mousepage */ + + setfillstyle(1, talkb); + setcolor(talkb); + off(); + + xl = 0; + yl = scrolln * 5; + for (fv = 1; fv <= scrolln; fv ++) + if (textwidth(scroll[fv]) > xl) xl = textwidth(scroll[fv]); + xl = xl / 2; + + xw = xl + 18; + yw = yl + 7; + my = yw * 2 - 2; + xc = 0; + + if ((talkx - xw) < 0) xc = -(talkx - xw); + if ((talkx + xw) > 639) xc = 639 - (talkx + xw); + + p[1].x = talkx - 10; + p[1].y = yw; + p[2].x = talkx + 10; + p[2].y = yw; + p[3].x = talkx; + p[3].y = talky; + + /* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); + mblit(talkx-10,my,talkx+10,talky,0,3);*/ + bar(xc + talkx - xw + 10, 7, talkx + xw - 10 + xc, my); + bar(xc + talkx - xw, 12, talkx + xw + xc, my - 5); + pieslice(xc + talkx + xw - 10, 12, 360, 90, 9); /* TR */ + pieslice(xc + talkx + xw - 10, my - 5, 270, 360, 9); /* BR */ + pieslice(xc + talkx - xw + 10, 12, 90, 180, 9); /* TL */ + pieslice(xc + talkx - xw + 10, my - 5, 180, 270, 9); /* BL */ + fillpoly(3, p.body()); + + setcolor(talkf); + yl -= 3; + settextjustify(1, 2); + for (fv = 0; fv <= scrolln - 1; fv ++) + outtextxy(talkx + xc, (fv * 10) + 12, scroll[fv + 1]); + for (fv = 1; fv <= scrolln; fv ++) /* These should be separate loops. */ + log_bubbleline(fv, param, scroll[fv]); + log_divider(); + + setvisualpage(1 - cp); + dingdongbell(); + oncandopageswap = false; + on(); + dropsok = false; + gotoit(); + off(); + dropsok = true; + mblit((talkx - xw + xc) / 8, 7, 1 + (talkx + xw + xc) / 8, my, 3, 1 - cp); + mblit((talkx - 10) / 8, my, 1 + (talkx + 10) / 8, talky, 3, 1 - cp); + blitfix(); + + setvisualpage(cp); + settextjustify(0, 0); + on(); /*sink;*/ + oncandopageswap = true; + resetscrolldriver(); + if (mpress > 0) after_the_scroll = true; } -boolean ask(string question) -{ - boolean ask_result; - display(question+'\15'+'\21'); - if (screturn && (Random(2)==0)) /* half-and-half chance */ - { - display("...Positive about that?\23I\26\r\21"); /* be annoying! */ - if (screturn && (Random(4)==3)) /* another 25% chance */ - display("\n100% certain\??!\n\26\r\21"); /* be very annoying! */ - } - ask_result=screturn; - return ask_result; +boolean ask(string question) { + boolean ask_result; + display(question + '\15' + '\21'); + if (screturn && (Random(2) == 0)) { /* half-and-half chance */ + display("...Positive about that?\23I\26\r\21"); /* be annoying! */ + if (screturn && (Random(4) == 3)) /* another 25% chance */ + display("\n100% certain\??!\n\26\r\21"); /* be very annoying! */ + } + ask_result = screturn; + return ask_result; } -void resetscroll() -{ - scrolln=1; fillchar(scroll,sizeof(scroll),'\0'); +void resetscroll() { + scrolln = 1; + fillchar(scroll, sizeof(scroll), '\0'); } -void natural() /* Natural state of bubbles */ -{ - talkx=320; talky=200; talkb=8; talkf=15; +void natural() { /* Natural state of bubbles */ + talkx = 320; + talky = 200; + talkb = 8; + talkf = 15; } -string lsd() -{ - string x; - - string lsd_result; - if (dna.pence<12) - { /* just pence */ - x=strf(dna.pence)+'d'; - } else - if (dna.pence<240) - { /* shillings & pence */ - x=strf(dna.pence / longint(12))+'/'; - if ((dna.pence % longint(12))==0) x=x+'-'; else x=x+strf(dna.pence % longint(12)); - } else /* L, s & d */ - x=string('')+strf(dna.pence / longint(240))+'.'+strf((dna.pence / longint(12)) % longint(20))+'.'+ - strf(dna.pence % longint(12)); - if (dna.pence>12) x=x+" (that's "+strf(dna.pence)+"d)"; - lsd_result=x; - return lsd_result; +string lsd() { + string x; + + string lsd_result; + if (dna.pence < 12) { + /* just pence */ + x = strf(dna.pence) + 'd'; + } else if (dna.pence < 240) { + /* shillings & pence */ + x = strf(dna.pence / longint(12)) + '/'; + if ((dna.pence % longint(12)) == 0) x = x + '-'; + else x = x + strf(dna.pence % longint(12)); + } else /* L, s & d */ + x = string('') + strf(dna.pence / longint(240)) + '.' + strf((dna.pence / longint(12)) % longint(20)) + '.' + + strf(dna.pence % longint(12)); + if (dna.pence > 12) x = x + " (that's " + strf(dna.pence) + "d)"; + lsd_result = x; + return lsd_result; } void calldrivers(); - /* Was the mouse cursor virtual on entry to this proc? */ +/* Was the mouse cursor virtual on entry to this proc? */ -static void strip(string& q) -{ - while (pos("\40",q[length(q)])>0) q[0] -= 1; /* strip trailing spaces */ +static void strip(string &q) { + while (pos("\40", q[length(q)]) > 0) q[0] -= 1; /* strip trailing spaces */ } -static void solidify(byte n) -{ - if (pos("\40",scroll[n])==0) return; /* no spaces */ - /* so there MUST be a space there, somewhere... */ - do { - scroll[n+1]=string(scroll[n][length(scroll[n])])+scroll[n+1]; - scroll[n][0] -= 1; - } while (!(scroll[n][length(scroll[n])]=='\40')); - strip(scroll[n]); +static void solidify(byte n) { + if (pos("\40", scroll[n]) == 0) return; /* no spaces */ + /* so there MUST be a space there, somewhere... */ + do { + scroll[n + 1] = string(scroll[n][length(scroll[n])]) + scroll[n + 1]; + scroll[n][0] -= 1; + } while (!(scroll[n][length(scroll[n])] == '\40')); + strip(scroll[n]); } -void calldrivers() -{ - word fv; byte nn; char nnn; boolean mouthnext; - boolean call_spriterun; /* Only call sprite_run the FIRST time. */ - - boolean was_virtual; - - - nosound; state(0); screturn=false; mouthnext=false; - call_spriterun=true; - - switch (buffer[bufsize]) { - case '\4': bufsize -= 1; break; /* ^D = (D)on't include pagebreak */ - case '\2':case '\21':; break; /* ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box */ - default: { - bufsize += 1; buffer[bufsize]='\20'; - } - } - for( fv=1; fv <= bufsize; fv ++) - if (mouthnext) - { - if (buffer[fv]=='\23') param=0; else - switch (buffer[fv]) { - case RANGE_10('0','9'): param=ord(buffer[fv])-48; - break; - case RANGE_26('A','Z'): param=ord(buffer[fv])-55; - break; - } - mouthnext=false; - } else - switch (buffer[fv]) { - case '\20': { - if ((scrolln==1) && (scroll[1]=="")) flush(); - - if (call_spriterun) sprite_run(); - call_spriterun=false; - - was_virtual=visible==m_virtual; - if (was_virtual) off_virtual(); - drawscroll(normscroll); - if (was_virtual) on_virtual(); - resetscroll(); - if (screturn) return; - } - break; - case '\7': scrollbells += 1; break; /* #7 = "Bel" */ - case '\2': { - if ((scrolln==1) && (scroll[1]=="")) flush(); - - if (call_spriterun) sprite_run(); - call_spriterun=false; - switch (param) { - case 0: natural(); break; /* Not attached: generic bubble with no speaker. */ - case RANGE_9(1,9): if ((param>numtr) || (! tr[param].quick)) - { /* not valid */ - errorled(); - natural(); - } - else tr[param].chatter(); - break; /* Normal sprite talking routine. */ - case 10 ... 36: { - quasiped_type& with = quasipeds[param]; - /* Quasi-peds. (This routine performs the same - thing with QPs as triptype.chatter does with the - sprites.) */ - { - pedtype& with1 = peds[with.whichped]; - - talkx=with1.x; talky=with1.y; /* Position. */ - } - talkf=with.fgc; talkb=with.bgc; /* Colours. */ - } - break; - default: { errorled(); natural(); } /* not valid */ - } - - was_virtual=visible==m_virtual; - if (was_virtual) off_virtual(); - bubble(normscroll); - if (was_virtual) on_virtual(); - resetscroll(); - if (screturn) return; - } - break; - case '\25': { - { dnatype& with = dna; - switch (param) { - case 1: display(lsd()+'\4'); break; /* insert cash balance (recursion) */ - case 2: display(words[first_password+with.pass_num].w+'\4'); break; - case 3: display(with.like2drink+'\4'); break; - case 4: display(with.favourite_song+'\4'); break; - case 5: display(with.worst_place_on_earth+'\4'); break; - case 6: display(with.spare_evening+'\4'); break; - /* ... */ - case 9: display(strf(with.cat_x)+','+strf(with.cat_y)+'\4'); break; - case 10: switch (with.box_contents) { - case '\0': { /* Sixpence. */ - dixi('q',37); /* You find the sixpence. */ - with.pence += 6; - with.box_contents=nowt; - points(2); return; - } - break; - case nowt: display("nothing at all. It's completely empty."); break; - default: display(get_better(with.box_contents)+'.'); - } - break; - case 11: { - nn=1; - for( nnn='\1'; nnn <= numobjs; nnn ++) - if (with.obj[nnn]) - { - nn += 1; - display(get_better(nnn)+", "+'\4'); - } - } - break; - }} - } - break; - case '\26': use_icon=param; break; - case '\15': scrolln += 1; break; - case '\21': { - if (call_spriterun) sprite_run(); - call_spriterun=false; - - scrolln += 1; scroll[scrolln]='\21'; - was_virtual=visible==m_virtual; - if (was_virtual) off_virtual(); - drawscroll(dialogue); - if (was_virtual) on_virtual(); - resetscroll(); - } - break; - case '\23' : mouthnext=true; break; - case '\11' : for( nn=1; nn <= 9; nn ++) scroll[scrolln]=scroll[scrolln]+' '; - break; - default: - { /* add new char */ - if (length(scroll[scrolln])==50) - { - solidify(scrolln); - scrolln += 1; - } - scroll[scrolln]=scroll[scrolln]+buffer[fv]; - } - } +void calldrivers() { + word fv; + byte nn; + char nnn; + boolean mouthnext; + boolean call_spriterun; /* Only call sprite_run the FIRST time. */ + + boolean was_virtual; + + + nosound; + state(0); + screturn = false; + mouthnext = false; + call_spriterun = true; + + switch (buffer[bufsize]) { + case '\4': + bufsize -= 1; + break; /* ^D = (D)on't include pagebreak */ + case '\2': + case '\21': + ; + break; /* ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box */ + default: { + bufsize += 1; + buffer[bufsize] = '\20'; + } + } + for (fv = 1; fv <= bufsize; fv ++) + if (mouthnext) { + if (buffer[fv] == '\23') param = 0; + else + switch (buffer[fv]) { + case RANGE_10('0', '9'): + param = ord(buffer[fv]) - 48; + break; + case RANGE_26('A', 'Z'): + param = ord(buffer[fv]) - 55; + break; + } + mouthnext = false; + } else + switch (buffer[fv]) { + case '\20': { + if ((scrolln == 1) && (scroll[1] == "")) flush(); + + if (call_spriterun) sprite_run(); + call_spriterun = false; + + was_virtual = visible == m_virtual; + if (was_virtual) off_virtual(); + drawscroll(normscroll); + if (was_virtual) on_virtual(); + resetscroll(); + if (screturn) return; + } + break; + case '\7': + scrollbells += 1; + break; /* #7 = "Bel" */ + case '\2': { + if ((scrolln == 1) && (scroll[1] == "")) flush(); + + if (call_spriterun) sprite_run(); + call_spriterun = false; + switch (param) { + case 0: + natural(); + break; /* Not attached: generic bubble with no speaker. */ + case RANGE_9(1, 9): + if ((param > numtr) || (! tr[param].quick)) { + /* not valid */ + errorled(); + natural(); + } else tr[param].chatter(); + break; /* Normal sprite talking routine. */ + case 10 ... 36: { + quasiped_type &with = quasipeds[param]; + /* Quasi-peds. (This routine performs the same + thing with QPs as triptype.chatter does with the + sprites.) */ + { + pedtype &with1 = peds[with.whichped]; + + talkx = with1.x; + talky = with1.y; /* Position. */ + } + talkf = with.fgc; + talkb = with.bgc; /* Colours. */ + } + break; + default: { + errorled(); /* not valid */ + natural(); + } + } + + was_virtual = visible == m_virtual; + if (was_virtual) off_virtual(); + bubble(normscroll); + if (was_virtual) on_virtual(); + resetscroll(); + if (screturn) return; + } + break; + case '\25': { + { + dnatype &with = dna; + switch (param) { + case 1: + display(lsd() + '\4'); + break; /* insert cash balance (recursion) */ + case 2: + display(words[first_password + with.pass_num].w + '\4'); + break; + case 3: + display(with.like2drink + '\4'); + break; + case 4: + display(with.favourite_song + '\4'); + break; + case 5: + display(with.worst_place_on_earth + '\4'); + break; + case 6: + display(with.spare_evening + '\4'); + break; + /* ... */ + case 9: + display(strf(with.cat_x) + ',' + strf(with.cat_y) + '\4'); + break; + case 10: + switch (with.box_contents) { + case '\0': { /* Sixpence. */ + dixi('q', 37); /* You find the sixpence. */ + with.pence += 6; + with.box_contents = nowt; + points(2); + return; + } + break; + case nowt: + display("nothing at all. It's completely empty."); + break; + default: + display(get_better(with.box_contents) + '.'); + } + break; + case 11: { + nn = 1; + for (nnn = '\1'; nnn <= numobjs; nnn ++) + if (with.obj[nnn]) { + nn += 1; + display(get_better(nnn) + ", " + '\4'); + } + } + break; + } + } + } + break; + case '\26': + use_icon = param; + break; + case '\15': + scrolln += 1; + break; + case '\21': { + if (call_spriterun) sprite_run(); + call_spriterun = false; + + scrolln += 1; + scroll[scrolln] = '\21'; + was_virtual = visible == m_virtual; + if (was_virtual) off_virtual(); + drawscroll(dialogue); + if (was_virtual) on_virtual(); + resetscroll(); + } + break; + case '\23' : + mouthnext = true; + break; + case '\11' : + for (nn = 1; nn <= 9; nn ++) scroll[scrolln] = scroll[scrolln] + ' '; + break; + default: { + /* add new char */ + if (length(scroll[scrolln]) == 50) { + solidify(scrolln); + scrolln += 1; + } + scroll[scrolln] = scroll[scrolln] + buffer[fv]; + } + } } -void display(string z) -{ - bufsize=length(z); - move(z[1],buffer,bufsize); - calldrivers(); +void display(string z) { + bufsize = length(z); + move(z[1], buffer, bufsize); + calldrivers(); } -void loadfont() -{ - file f; - - assign(f,"avalot.fnt"); reset(f); f >> ch[0]; close(f); - assign(f,"avitalic.fnt"); reset(f); f >> ch[1]; close(f); - assign(f,"ttsmall.fnt"); reset(f); f >> little; close(f); +void loadfont() { + file f; + + assign(f, "avalot.fnt"); + reset(f); + f >> ch[0]; + close(f); + assign(f, "avitalic.fnt"); + reset(f); + f >> ch[1]; + close(f); + assign(f, "ttsmall.fnt"); + reset(f); + f >> little; + close(f); } -void okay() -{ - display("Okay!"); +void okay() { + display("Okay!"); } -void musical_scroll() -{ - boolean was_virtual; +void musical_scroll() { + boolean was_virtual; - display(string("To play the harp...\r\rUse these keys:\r\n")+ - "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); + display(string("To play the harp...\r\rUse these keys:\r\n") + + "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); - sprite_run(); + sprite_run(); - was_virtual=visible==m_virtual; - if (was_virtual) off_virtual(); - drawscroll(music_scroll); - if (was_virtual) on_virtual(); - resetscroll(); + was_virtual = visible == m_virtual; + if (was_virtual) off_virtual(); + drawscroll(music_scroll); + if (was_virtual) on_virtual(); + resetscroll(); } class unit_scrolls_initialize { - public: unit_scrolls_initialize(); +public: + unit_scrolls_initialize(); }; static unit_scrolls_initialize scrolls_constructor; unit_scrolls_initialize::unit_scrolls_initialize() { - loadfont(); - resetscrolldriver(); + loadfont(); + resetscrolldriver(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h index a22cfb7c2e60..13928ef4ff0a 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/scrolls.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index cf1cb0ae3fe6..2715e648b31b 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -45,75 +45,78 @@ namespace Avalanche { -void then_show(byte what) -{ - byte fv; -; - for( fv=1; fv <= seq_length; fv ++) - if (seq[fv]==0) - {; - seq[fv]=what; - return; - } +void then_show(byte what) { + byte fv; + ; + for (fv = 1; fv <= seq_length; fv ++) + if (seq[fv] == 0) { + ; + seq[fv] = what; + return; + } } -void first_show(byte what) -{; - /* First, we need to blank out the entire array. */ - fillchar(seq,sizeof(seq),'\0'); +void first_show(byte what) { + ; + /* First, we need to blank out the entire array. */ + fillchar(seq, sizeof(seq), '\0'); - /* Then it's just the same as then_show. */ - then_show(what); + /* Then it's just the same as then_show. */ + then_show(what); } -void then_flip(byte where,byte ped) -{; - then_show(now_flip); +void then_flip(byte where, byte ped) { + ; + then_show(now_flip); - dna.flip_to_where=where; - dna.flip_to_ped=ped; + dna.flip_to_where = where; + dna.flip_to_ped = ped; } -void start_to_close() -{; - lose_timer(reason_sequencer); - set_up_timer(7,procsequence,reason_sequencer); +void start_to_close() { + ; + lose_timer(reason_sequencer); + set_up_timer(7, procsequence, reason_sequencer); } -void start_to_open() -{; - dna.user_moves_avvy=false; /* They can't move. */ - stopwalking; /* And they're not moving now. */ - start_to_close(); /* Apart from that, it's the same thing. */ +void start_to_open() { + ; + dna.user_moves_avvy = false; /* They can't move. */ + stopwalking; /* And they're not moving now. */ + start_to_close(); /* Apart from that, it's the same thing. */ } void call_sequencer(); - /* This proc is called by Timeout when it's time to do another frame. */ -static void shove_left() -{; - move(seq[2],seq[1],seq_length-1); /* Shift everything to the left. */ +/* This proc is called by Timeout when it's time to do another frame. */ +static void shove_left() { + ; + move(seq[2], seq[1], seq_length - 1); /* Shift everything to the left. */ } -void call_sequencer() -{; - switch (seq[1]) { - case 0: return; break; /* No more routines. */ - case 1 ... 176: {; /* Show a frame. */ - show_one(seq[1]); - shove_left(); - } - break; - case 177: {; - user_moves_avvy=true; - fliproom(flip_to_where,flip_to_ped); /* 177 = Flip room. */ - if (seq[1]==177) shove_left(); - } - break; - } - - start_to_close(); /* Make sure this proc gets called again. */ +void call_sequencer() { + ; + switch (seq[1]) { + case 0: + return; + break; /* No more routines. */ + case 1 ... 176: { + ; /* Show a frame. */ + show_one(seq[1]); + shove_left(); + } + break; + case 177: { + ; + user_moves_avvy = true; + fliproom(flip_to_where, flip_to_ped); /* 177 = Flip room. */ + if (seq[1] == 177) shove_left(); + } + break; + } + + start_to_close(); /* Make sure this proc gets called again. */ } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 2d773ca18122..54bb1e72f2bb 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -40,7 +40,7 @@ const integer seq_length = 10; #define EXTERN #endif -EXTERN array<1,seq_length,byte> seq; +EXTERN array<1, seq_length, byte> seq; #undef EXTERN #define EXTERN extern @@ -49,7 +49,7 @@ void first_show(byte what); void then_show(byte what); -void then_flip(byte where,byte ped); +void then_flip(byte where, byte ped); void start_to_close(); diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 245a119bd687..072c3ef2a48f 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,37 +33,38 @@ namespace Avalanche { const integer selected = 0x60; /* Background for selected lines of text. */ -typedef array<1,400,varying_string<80> > mobytype; +typedef array<1, 400, varying_string<80> > mobytype; typedef set byteset; /* Define its typemark. */ enum option {_overrideegacheck, _zoomystart, _loadfirst, _numlockhold, _usemouse, - _controller, _logging, _logfile, + _controller, _logging, _logfile, - _joystickinstalled, _joytop, _joybottom, _joyleft, _joyright, _joymidx, - _joymidy, _joycentringfactor, _whichjoy, _quiet, _soundcard, - _baseaddress, _irq, _dma, - _samplerate, _keyboardclick, + _joystickinstalled, _joytop, _joybottom, _joyleft, _joyright, _joymidx, + _joymidy, _joycentringfactor, _whichjoy, _quiet, _soundcard, + _baseaddress, _irq, _dma, + _samplerate, _keyboardclick, - _printer, + _printer, - option_error, last_option}; + option_error, last_option + }; -mobytype* moby; +mobytype *moby; word mobylength; byte background; /* The current background colour, times 16. */ byte line; /* Which line you're on in the menus. */ -string registrant,reginum; +string registrant, reginum; byte num_printers; -array<1,10,string> printers; +array<1, 10, string> printers; string this_printer; /* THE STATUS VARIABLES: */ - /* general */ +/* general */ boolean override_ega; boolean skip_loading_screens; @@ -76,141 +77,141 @@ boolean log_to_file; string log_filename; string autotype; - /* joystick */ +/* joystick */ boolean has_a_joystick; -word jtop,jbottom,jleft,jright,jmidx,jmidy; +word jtop, jbottom, jleft, jright, jmidx, jmidy; byte jcentre; word whichjoy; - /* sound */ +/* sound */ boolean suppress_sfx; byte your_card; longint samplerate; -longint sound_addr,sound_irq,sound_dma; +longint sound_addr, sound_irq, sound_dma; boolean wants_keyclick; - /* registration */ +/* registration */ -string regname,regnum,chkname,chknum; +string regname, regnum, chkname, chknum; -string trim_and_caps(string this_) -{ - byte fv; - - string trim_and_caps_result; - while ((this_[1]==' ') && (this_!="")) - Delete(this_,1,1); /* Strip leading blanks. */ - while ((this_[length(this_)]==' ') && (this_!="")) - this_[0] -= 1; /* Strip trailing blanks. */ - for( fv=1; fv <= length(this_); fv ++) this_[fv]=upcase(this_[fv]);/* And capitalise. */ - trim_and_caps_result=this_; - return trim_and_caps_result; +string trim_and_caps(string this_) { + byte fv; + + string trim_and_caps_result; + while ((this_[1] == ' ') && (this_ != "")) + Delete(this_, 1, 1); /* Strip leading blanks. */ + while ((this_[length(this_)] == ' ') && (this_ != "")) + this_[0] -= 1; /* Strip trailing blanks. */ + for (fv = 1; fv <= length(this_); fv ++) this_[fv] = upcase(this_[fv]); /* And capitalise. */ + trim_and_caps_result = this_; + return trim_and_caps_result; } -option string_2_option(string field) -{ +option string_2_option(string field) { - option string_2_option_result; - field=trim_and_caps(field); + option string_2_option_result; + field = trim_and_caps(field); - if (field=="OVERRIDEEGACHECK") string_2_option_result=_overrideegacheck; else - if (field=="ZOOMYSTART") string_2_option_result=_zoomystart; else - if (field=="LOADFIRST") string_2_option_result=_loadfirst; else - if (field=="NUMLOCKHOLD") string_2_option_result=_numlockhold; else - if (field=="USEMOUSE") string_2_option_result=_usemouse; else - if (field=="CONTROLLER") string_2_option_result=_controller; else - if (field=="LOGGING") string_2_option_result=_logging; else - if (field=="LOGFILE") string_2_option_result=_logfile; else + if (field == "OVERRIDEEGACHECK") string_2_option_result = _overrideegacheck; + else if (field == "ZOOMYSTART") string_2_option_result = _zoomystart; + else if (field == "LOADFIRST") string_2_option_result = _loadfirst; + else if (field == "NUMLOCKHOLD") string_2_option_result = _numlockhold; + else if (field == "USEMOUSE") string_2_option_result = _usemouse; + else if (field == "CONTROLLER") string_2_option_result = _controller; + else if (field == "LOGGING") string_2_option_result = _logging; + else if (field == "LOGFILE") string_2_option_result = _logfile; + else - /* joystick */ + /* joystick */ - if (field=="JOYSTICKINSTALLED") string_2_option_result=_joystickinstalled; else - if (field=="JOYTOP") string_2_option_result=_joytop; else - if (field=="JOYBOTTOM") string_2_option_result=_joybottom; else - if (field=="JOYLEFT") string_2_option_result=_joyleft; else - if (field=="JOYRIGHT") string_2_option_result=_joyright; else - if (field=="JOYMIDX") string_2_option_result=_joymidx; else - if (field=="JOYMIDY") string_2_option_result=_joymidy; else - if (field=="JOYCENTRINGFACTOR") string_2_option_result=_joycentringfactor; else - if (field=="WHICHJOY") string_2_option_result=_whichjoy; else + if (field == "JOYSTICKINSTALLED") string_2_option_result = _joystickinstalled; + else if (field == "JOYTOP") string_2_option_result = _joytop; + else if (field == "JOYBOTTOM") string_2_option_result = _joybottom; + else if (field == "JOYLEFT") string_2_option_result = _joyleft; + else if (field == "JOYRIGHT") string_2_option_result = _joyright; + else if (field == "JOYMIDX") string_2_option_result = _joymidx; + else if (field == "JOYMIDY") string_2_option_result = _joymidy; + else if (field == "JOYCENTRINGFACTOR") string_2_option_result = _joycentringfactor; + else if (field == "WHICHJOY") string_2_option_result = _whichjoy; + else - /* sound */ + /* sound */ - if (field=="QUIET") string_2_option_result=_quiet; else - if (field=="SOUNDCARD") string_2_option_result=_soundcard; else - if (field=="SAMPLERATE") string_2_option_result=_samplerate; else - if (field=="KEYBOARDCLICK") string_2_option_result=_keyboardclick; else - if (field=="BASEADDRESS") string_2_option_result=_baseaddress; else - if (field=="IRQ") string_2_option_result=_irq; else - if (field=="DMA") string_2_option_result=_dma; else + if (field == "QUIET") string_2_option_result = _quiet; + else if (field == "SOUNDCARD") string_2_option_result = _soundcard; + else if (field == "SAMPLERATE") string_2_option_result = _samplerate; + else if (field == "KEYBOARDCLICK") string_2_option_result = _keyboardclick; + else if (field == "BASEADDRESS") string_2_option_result = _baseaddress; + else if (field == "IRQ") string_2_option_result = _irq; + else if (field == "DMA") string_2_option_result = _dma; + else - /* printer */ + /* printer */ - if (field=="PRINTER") string_2_option_result=_printer; else + if (field == "PRINTER") string_2_option_result = _printer; + else - string_2_option_result=option_error; + string_2_option_result = option_error; - return string_2_option_result; + return string_2_option_result; } -void clear_to(byte colour) -{ - window(1,1,80,24); background=colour*16; textattr=background; clrscr; +void clear_to(byte colour) { + window(1, 1, 80, 24); + background = colour * 16; + textattr = background; + clrscr; } -void centre(byte where,byte colour, string what) -{ - textattr=background+colour; - gotoxy(40-length(what) / 2,where); - output << what; +void centre(byte where, byte colour, string what) { + textattr = background + colour; + gotoxy(40 - length(what) / 2, where); + output << what; } -void load_file() -{ - text t; +void load_file() { + text t; - mobylength=0; - /*$I-*/ - assign(t,"avalot.ini"); - reset(t); - /*$I+*/ + mobylength = 0; + /*$I-*/ + assign(t, "avalot.ini"); + reset(t); + /*$I+*/ - if (ioresult!=0) /* No file. */ - { - output << "SETUP: Avalot.ini not found!" << NL; - exit(255); - } + if (ioresult != 0) { /* No file. */ + output << "SETUP: Avalot.ini not found!" << NL; + exit(255); + } - while (! eof(t)) - { - mobylength += 1; /* Preincrement mode. */ - t >> (*moby)[mobylength] >> NL; - } + while (! eof(t)) { + mobylength += 1; /* Preincrement mode. */ + t >> (*moby)[mobylength] >> NL; + } - close(t); + close(t); } -string strhf(longint x) /* assume x is +ve */ -{ - const array<0,16,char> hexdigits = "0123456789ABCDEF"; - string y; longint v; +string strhf(longint x) { /* assume x is +ve */ + const array<0, 16, char> hexdigits = "0123456789ABCDEF"; + string y; + longint v; - string strhf_result; - v=x; y=""; + string strhf_result; + v = x; + y = ""; - while (v!=0) - { - y=string(hexdigits[v % longint(16)-1])+y; - v=v / longint(16); - } + while (v != 0) { + y = string(hexdigits[v % longint(16) - 1]) + y; + v = v / longint(16); + } - strhf_result=string('$')+y; - return strhf_result; + strhf_result = string('$') + y; + return strhf_result; } void update_moby(); @@ -220,257 +221,293 @@ static byte fv; static string field; -static void get_field(string x) -{ - if (pos(";",x)!=0) x=copy(x,1,pos(";",x)-1); - - if (pos("=",x)==0) - field=""; - else - { - field=copy(x,0,pos("=",x)-1); - while (field[1]==' ') field=copy(field,2,255); - } +static void get_field(string x) { + if (pos(";", x) != 0) x = copy(x, 1, pos(";", x) - 1); + + if (pos("=", x) == 0) + field = ""; + else { + field = copy(x, 0, pos("=", x) - 1); + while (field[1] == ' ') field = copy(field, 2, 255); + } } -static string yn1(boolean x) - { string yn1_result; - if (x) yn1_result="Yes"; else yn1_result="No"; return yn1_result; - } +static string yn1(boolean x) { + string yn1_result; + if (x) yn1_result = "Yes"; + else yn1_result = "No"; + return yn1_result; +} -static string kj(boolean x) - { string kj_result; - if (x) kj_result="Keyboard"; else kj_result="Joystick"; return kj_result; - } +static string kj(boolean x) { + string kj_result; + if (x) kj_result = "Keyboard"; + else kj_result = "Joystick"; + return kj_result; +} -static string put_logcodes() -{ - byte q; +static string put_logcodes() { + byte q; - string put_logcodes_result; - q=(byte)(log_to_file)+(byte)(log_to_printer)*2; + string put_logcodes_result; + q = (byte)(log_to_file) + (byte)(log_to_printer) * 2; - switch (q) { - case 0: put_logcodes_result="No"; break; - case 1: put_logcodes_result="Disk"; break; - case 2: put_logcodes_result="Printer"; break; - } - return put_logcodes_result; + switch (q) { + case 0: + put_logcodes_result = "No"; + break; + case 1: + put_logcodes_result = "Disk"; + break; + case 2: + put_logcodes_result = "Printer"; + break; + } + return put_logcodes_result; } -static string card() -{ - string card_result; - switch (your_card) { - case 0: card_result="None"; break; - case 1: card_result="SB"; break; - case 2: card_result="SBPro"; break; - case 3: card_result="SB16"; break; - case 4: card_result="Pas"; break; - case 5: card_result="PasPlus"; break; - case 6: card_result="Pas16"; break; - case 7: card_result="Aria"; break; - case 8: card_result="WinSound"; break; - case 9: card_result="Gravis"; break; - case 10: card_result="DacLPT"; break; - case 11: card_result="StereoDacs"; break; - case 12: card_result="StereoOn1"; break; - case 13: card_result="Speaker"; break; - } - return card_result; +static string card() { + string card_result; + switch (your_card) { + case 0: + card_result = "None"; + break; + case 1: + card_result = "SB"; + break; + case 2: + card_result = "SBPro"; + break; + case 3: + card_result = "SB16"; + break; + case 4: + card_result = "Pas"; + break; + case 5: + card_result = "PasPlus"; + break; + case 6: + card_result = "Pas16"; + break; + case 7: + card_result = "Aria"; + break; + case 8: + card_result = "WinSound"; + break; + case 9: + card_result = "Gravis"; + break; + case 10: + card_result = "DacLPT"; + break; + case 11: + card_result = "StereoDacs"; + break; + case 12: + card_result = "StereoOn1"; + break; + case 13: + card_result = "Speaker"; + break; + } + return card_result; } -static void entail(string x) -{ - string before,after; +static void entail(string x) { + string before, after; - before=copy((*moby)[fv],1,pos("=",(*moby)[fv])-1); + before = copy((*moby)[fv], 1, pos("=", (*moby)[fv]) - 1); - if (pos(";",(*moby)[fv])==0) - { - (*moby)[fv]=before+'='+x; - } else - { - after=copy((*moby)[fv],pos(";",(*moby)[fv]),255); + if (pos(";", (*moby)[fv]) == 0) { + (*moby)[fv] = before + '=' + x; + } else { + after = copy((*moby)[fv], pos(";", (*moby)[fv]), 255); - (*moby)[fv]=before+'='+x+' '; - while (length((*moby)[fv])<25) (*moby)[fv]=(*moby)[fv]+' '; + (*moby)[fv] = before + '=' + x + ' '; + while (length((*moby)[fv]) < 25)(*moby)[fv] = (*moby)[fv] + ' '; - (*moby)[fv]=(*moby)[fv]+after; - } + (*moby)[fv] = (*moby)[fv] + after; + } } -void update_moby() -{ - option o; +void update_moby() { + option o; - for( fv=1; fv <= mobylength; fv ++) - { - get_field((*moby)[fv]); + for (fv = 1; fv <= mobylength; fv ++) { + get_field((*moby)[fv]); - if (field!="") - { - o=string_2_option(field); + if (field != "") { + o = string_2_option(field); - if (o==_overrideegacheck) entail(yn1(override_ega)); else - if (o==_zoomystart) entail(yn1(skip_loading_screens)); else - if (o==_loadfirst) entail(load_particular); else - if (o==_numlockhold) entail(yn1(force_numlock)); else - if (o==_usemouse) entail(yn1(ignore_mouse)); else - if (o==_controller) entail(kj(use_keyboard)); else - if (o==_logging) entail(put_logcodes()); else - if (o==_logfile) entail(log_filename); else + if (o == _overrideegacheck) entail(yn1(override_ega)); + else if (o == _zoomystart) entail(yn1(skip_loading_screens)); + else if (o == _loadfirst) entail(load_particular); + else if (o == _numlockhold) entail(yn1(force_numlock)); + else if (o == _usemouse) entail(yn1(ignore_mouse)); + else if (o == _controller) entail(kj(use_keyboard)); + else if (o == _logging) entail(put_logcodes()); + else if (o == _logfile) entail(log_filename); + else - /* joystick */ + /* joystick */ - if (o==_joystickinstalled) entail(yn1(has_a_joystick)); else - if (o==_joytop) entail(strf(jtop)); else - if (o==_joybottom) entail(strf(jbottom)); else - if (o==_joyleft) entail(strf(jleft)); else - if (o==_joyright) entail(strf(jright)); else - if (o==_joymidx) entail(strf(jmidx)); else - if (o==_joymidy) entail(strf(jmidy)); else - if (o==_joycentringfactor) entail(strf(jcentre)); else - if (o==_whichjoy) entail(strf(whichjoy)); else + if (o == _joystickinstalled) entail(yn1(has_a_joystick)); + else if (o == _joytop) entail(strf(jtop)); + else if (o == _joybottom) entail(strf(jbottom)); + else if (o == _joyleft) entail(strf(jleft)); + else if (o == _joyright) entail(strf(jright)); + else if (o == _joymidx) entail(strf(jmidx)); + else if (o == _joymidy) entail(strf(jmidy)); + else if (o == _joycentringfactor) entail(strf(jcentre)); + else if (o == _whichjoy) entail(strf(whichjoy)); + else - /* sound */ + /* sound */ - if (o==_quiet) entail(yn1(suppress_sfx)); else - if (o==_soundcard) entail(card()); else - if (o==_samplerate) entail(strf(samplerate)); else - if (o==_baseaddress) entail(strhf(sound_addr)); else - if (o==_irq) entail(strf(sound_irq)); else - if (o==_dma) entail(strf(sound_dma)); else - if (o==_keyboardclick) entail(yn1(wants_keyclick)); else + if (o == _quiet) entail(yn1(suppress_sfx)); + else if (o == _soundcard) entail(card()); + else if (o == _samplerate) entail(strf(samplerate)); + else if (o == _baseaddress) entail(strhf(sound_addr)); + else if (o == _irq) entail(strf(sound_irq)); + else if (o == _dma) entail(strf(sound_dma)); + else if (o == _keyboardclick) entail(yn1(wants_keyclick)); + else - /* printer */ + /* printer */ - if (o==_printer) entail(this_printer); + if (o == _printer) entail(this_printer); - } - } + } + } } -void save_file() -{ - text t; - word fv; +void save_file() { + text t; + word fv; - textattr=10; - update_moby(); + textattr = 10; + update_moby(); - clear_to(black); - centre(14,14,"Saving..."); + clear_to(black); + centre(14, 14, "Saving..."); - assign(t,"avalot.ini"); - rewrite(t); + assign(t, "avalot.ini"); + rewrite(t); - for( fv=1; fv <= mobylength; fv ++) - { - t << (*moby)[fv] << NL; - } + for (fv = 1; fv <= mobylength; fv ++) { + t << (*moby)[fv] << NL; + } - close(t); + close(t); } -boolean detect() -{ - word x,y,xo,yo; - byte count; - - boolean detect_result; - count=0; - if (joystickpresent()) - { - detect_result=true; - return detect_result; - } - readjoya(xo,yo); - do { - if (count<7) count += 1; /* Take advantage of "flutter" */ - if (count==6) - { - centre(7,1,"The Bios says you don't have a joystick. However, it's often wrong"); - centre(8,1,"about such matters. So, do you? If you do, move joystick A to"); - centre(9,1,"continue. If you don't, press any key to cancel."); - } - readjoya(x,y); - } while (!((keypressed()) | (x!=xo) || (y!=yo))); - detect_result=~ keypressed(); - return detect_result; +boolean detect() { + word x, y, xo, yo; + byte count; + + boolean detect_result; + count = 0; + if (joystickpresent()) { + detect_result = true; + return detect_result; + } + readjoya(xo, yo); + do { + if (count < 7) count += 1; /* Take advantage of "flutter" */ + if (count == 6) { + centre(7, 1, "The Bios says you don't have a joystick. However, it's often wrong"); + centre(8, 1, "about such matters. So, do you? If you do, move joystick A to"); + centre(9, 1, "continue. If you don't, press any key to cancel."); + } + readjoya(x, y); + } while (!((keypressed()) | (x != xo) || (y != yo))); + detect_result = ~ keypressed(); + return detect_result; } -void display() -{ - gotoxy(28,10); output << jleft << " "; - gotoxy(28,11); output << jright; - gotoxy(28,12); output << jtop << " "; - gotoxy(28,13); output << jbottom; +void display() { + gotoxy(28, 10); + output << jleft << " "; + gotoxy(28, 11); + output << jright; + gotoxy(28, 12); + output << jtop << " "; + gotoxy(28, 13); + output << jbottom; } -void readjoy(word& x,word& y) -{ - if (whichjoy==1) readjoya(x,y); else readjoyb(x,y); +void readjoy(word &x, word &y) { + if (whichjoy == 1) readjoya(x, y); + else readjoyb(x, y); } -void getmaxmin() -{ - word x,y; char r; - - clear_to(green); - centre(5,1,"Rotate the joystick around in a circle, as far from the centre as it"); - centre(6,1,"can get. Then press any key."); - centre(7,1,"Press Esc to cancel this part."); - centre(16,1,"(To reset these figures, set \"Do you have a joystick?\" to No, then Yes.)"); - - gotoxy(20,10); output << "Left :"; - gotoxy(20,11); output << "Right :"; - gotoxy(20,12); output << "Top :"; - gotoxy(20,13); output << "Bottom:"; - - - if (jleft==0) jleft=maxint; - if (jtop==0) jtop=maxint; - do { - readjoy(x,y); - if (xjright) jright=x; - if (y>jbottom) jbottom=y; - display(); - } while (!keypressed()); - - do { r=readkey(); } while (!(~ keypressed())); - if (r=='\33') return; - - centre(19,1,"Thank you. Now please centre your joystick and hit a button."); - do {; } while (!(buttona1() || buttona2())); - - readjoya(jmidx,jmidy); - - has_a_joystick=true; +void getmaxmin() { + word x, y; + char r; + + clear_to(green); + centre(5, 1, "Rotate the joystick around in a circle, as far from the centre as it"); + centre(6, 1, "can get. Then press any key."); + centre(7, 1, "Press Esc to cancel this part."); + centre(16, 1, "(To reset these figures, set \"Do you have a joystick?\" to No, then Yes.)"); + + gotoxy(20, 10); + output << "Left :"; + gotoxy(20, 11); + output << "Right :"; + gotoxy(20, 12); + output << "Top :"; + gotoxy(20, 13); + output << "Bottom:"; + + + if (jleft == 0) jleft = maxint; + if (jtop == 0) jtop = maxint; + do { + readjoy(x, y); + if (x < jleft) jleft = x; + if (y < jtop) jtop = y; + if (x > jright) jright = x; + if (y > jbottom) jbottom = y; + display(); + } while (!keypressed()); + + do { + r = readkey(); + } while (!(~ keypressed())); + if (r == '\33') return; + + centre(19, 1, "Thank you. Now please centre your joystick and hit a button."); + do { + ; + } while (!(buttona1() || buttona2())); + + readjoya(jmidx, jmidy); + + has_a_joystick = true; } -void joysetup() -{ - clear_to(green); - if (! detect()) return; - getmaxmin(); +void joysetup() { + clear_to(green); + if (! detect()) return; + getmaxmin(); } byte choose_one_of(byteset which); @@ -478,564 +515,660 @@ byte choose_one_of(byteset which); static shortint direction; -static void move(shortint d) -{ - direction=d; line=line+d; +static void move(shortint d) { + direction = d; + line = line + d; } -static void highlight(word where,word how) -{ - byte fv; +static void highlight(word where, word how) { + byte fv; - where=where*160-159; - for( fv=0; fv <= 79; fv ++) - mem[0xb800*where+fv*2]=(mem[0xb800*where+fv*2] & 0xf)+how; + where = where * 160 - 159; + for (fv = 0; fv <= 79; fv ++) + mem[0xb800 * where + fv * 2] = (mem[0xb800 * where + fv * 2] & 0xf) + how; } byte choose_one_of(byteset which) { - const integer upwards = -1; - const integer downwards = 1; - - boolean done; - char r; - - - byte choose_one_of_result; - done=false; direction=1; - do { - while (! (which.has(line))) - { - line=line+direction; - if (line>26) line=1; - if (line==0) line=26; - } - - highlight(line,selected); - r=readkey(); - highlight(line,background); - switch (r) { - case '\0': switch (readkey()) { - case cup: move(upwards); break; - case cdown: move(downwards); break; - } - break; - case creturn: done=true; break; - case cescape: { - choose_one_of_result=15; /* bottom line is always 15. */ - return choose_one_of_result; - } - break; - } - - } while (!done); - - choose_one_of_result=line; - return choose_one_of_result; + const integer upwards = -1; + const integer downwards = 1; + + boolean done; + char r; + + + byte choose_one_of_result; + done = false; + direction = 1; + do { + while (!(which.has(line))) { + line = line + direction; + if (line > 26) line = 1; + if (line == 0) line = 26; + } + + highlight(line, selected); + r = readkey(); + highlight(line, background); + switch (r) { + case '\0': + switch (readkey()) { + case cup: + move(upwards); + break; + case cdown: + move(downwards); + break; + } + break; + case creturn: + done = true; + break; + case cescape: { + choose_one_of_result = 15; /* bottom line is always 15. */ + return choose_one_of_result; + } + break; + } + + } while (!done); + + choose_one_of_result = line; + return choose_one_of_result; } void bottom_bar(); static void load_regi_info(); -static char decode1(char c) -{ - byte b; +static char decode1(char c) { + byte b; - char decode1_result; - b=ord(c)-32; - decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; + char decode1_result; + b = ord(c) - 32; + decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; } -static char decode2(char c) -{ - char decode2_result; - decode2_result=chr( ((ord(c) & 0xf) << 2) + 0x43); - return decode2_result; +static char decode2(char c) { + char decode2_result; + decode2_result = chr(((ord(c) & 0xf) << 2) + 0x43); + return decode2_result; } -static boolean checker(string proper,string check) -{ - byte fv; boolean ok; +static boolean checker(string proper, string check) { + byte fv; + boolean ok; - boolean checker_result; - ok=true; - for( fv=1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) - ok=false; + boolean checker_result; + ok = true; + for (fv = 1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) + ok = false; - checker_result=ok; - return checker_result; + checker_result = ok; + return checker_result; } -static void load_regi_info() -{ - text t; - byte fv; - string x; - byte namelen,numlen; - string namechk,numchk; +static void load_regi_info() { + text t; + byte fv; + string x; + byte namelen, numlen; + string namechk, numchk; - /*$I-*/ - assign(t,"register.dat"); reset(t); - /*$I+*/ + /*$I-*/ + assign(t, "register.dat"); + reset(t); + /*$I+*/ - if (ioresult!=0) - { - registrant=""; - return; - } + if (ioresult != 0) { + registrant = ""; + return; + } - for( fv=1; fv <= 53; fv ++) t >> NL; - t >> x >> NL; - close(t); + for (fv = 1; fv <= 53; fv ++) t >> NL; + t >> x >> NL; + close(t); - namelen=107-ord(x[1]); numlen=107-ord(x[2]); + namelen = 107 - ord(x[1]); + numlen = 107 - ord(x[2]); - registrant=copy(x,3,namelen); - reginum=copy(x,4+namelen,numlen); - namechk=copy(x,4+namelen+numlen,namelen); - numchk=copy(x,4+namelen+numlen+namelen,numlen); + registrant = copy(x, 3, namelen); + reginum = copy(x, 4 + namelen, numlen); + namechk = copy(x, 4 + namelen + numlen, namelen); + numchk = copy(x, 4 + namelen + numlen + namelen, numlen); - for( fv=1; fv <= namelen; fv ++) registrant[fv]=decode1(registrant[fv]); - for( fv=1; fv <= numlen; fv ++) reginum[fv]=decode1(reginum[fv]); + for (fv = 1; fv <= namelen; fv ++) registrant[fv] = decode1(registrant[fv]); + for (fv = 1; fv <= numlen; fv ++) reginum[fv] = decode1(reginum[fv]); - if ((! checker(registrant,namechk)) || (! checker(reginum,numchk))) - { registrant="\?\"!?"; reginum="(."; } + if ((! checker(registrant, namechk)) || (! checker(reginum, numchk))) { + registrant = "\?\"!?"; + reginum = "(."; + } } -void bottom_bar() -{ - load_regi_info(); - textattr=96; background=96; - window(1,1,80,25); - gotoxy(1,25); clreol; - if (registrant=="") - centre(25,15,"Unregistered copy."); - else - centre(25,15,string("Registered to ")+registrant+" ("+reginum+")."); +void bottom_bar() { + load_regi_info(); + textattr = 96; + background = 96; + window(1, 1, 80, 25); + gotoxy(1, 25); + clreol; + if (registrant == "") + centre(25, 15, "Unregistered copy."); + else + centre(25, 15, string("Registered to ") + registrant + " (" + reginum + ")."); } -void new_menu() -{ - line=1; /* now that we've got a new menu. */ +void new_menu() { + line = 1; /* now that we've got a new menu. */ } -string two_answers(string ans_true,string ans_false, boolean which) -{ - string two_answers_result; - if (which) - two_answers_result=string(" (")+ans_true+')'; - else - two_answers_result=string(" (")+ans_false+')'; - return two_answers_result; +string two_answers(string ans_true, string ans_false, boolean which) { + string two_answers_result; + if (which) + two_answers_result = string(" (") + ans_true + ')'; + else + two_answers_result = string(" (") + ans_false + ')'; + return two_answers_result; } -string yes_or_no(boolean which) -{ - string yes_or_no_result; - yes_or_no_result=two_answers("yes","no",which); - return yes_or_no_result; +string yes_or_no(boolean which) { + string yes_or_no_result; + yes_or_no_result = two_answers("yes", "no", which); + return yes_or_no_result; } -string give_name(string what) -{ - string give_name_result; - if (what=="") - give_name_result=" (none)"; - else - give_name_result=string(" (\"")+what+"\")"; - return give_name_result; +string give_name(string what) { + string give_name_result; + if (what == "") + give_name_result = " (none)"; + else + give_name_result = string(" (\"") + what + "\")"; + return give_name_result; } -string sound_card(byte which) -{ - string sound_card_result; - switch (which) { - case 0: sound_card_result="none"; break; - case 1: sound_card_result="SoundBlaster"; break; - case 2: sound_card_result="SoundBlaster Pro"; break; - case 3: sound_card_result="SoundBlaster 16"; break; - case 4: sound_card_result="Pro Audio Spectrum"; break; - case 5: sound_card_result="Pro Audio Spectrum+"; break; - case 6: sound_card_result="Pro Audio Spectrum 16"; break; - case 7: sound_card_result="Aria"; break; - case 8: sound_card_result="Windows Sound System or compatible"; break; - case 9: sound_card_result="Gravis Ultrasound"; break; - case 10: sound_card_result="DAC on LPT1"; break; - case 11: sound_card_result="Stereo DACs on LPT1 and LPT2"; break; - case 12: sound_card_result="Stereo-on-1 DAC on LPT"; break; - case 13: sound_card_result="PC speaker"; break; - } - return sound_card_result; +string sound_card(byte which) { + string sound_card_result; + switch (which) { + case 0: + sound_card_result = "none"; + break; + case 1: + sound_card_result = "SoundBlaster"; + break; + case 2: + sound_card_result = "SoundBlaster Pro"; + break; + case 3: + sound_card_result = "SoundBlaster 16"; + break; + case 4: + sound_card_result = "Pro Audio Spectrum"; + break; + case 5: + sound_card_result = "Pro Audio Spectrum+"; + break; + case 6: + sound_card_result = "Pro Audio Spectrum 16"; + break; + case 7: + sound_card_result = "Aria"; + break; + case 8: + sound_card_result = "Windows Sound System or compatible"; + break; + case 9: + sound_card_result = "Gravis Ultrasound"; + break; + case 10: + sound_card_result = "DAC on LPT1"; + break; + case 11: + sound_card_result = "Stereo DACs on LPT1 and LPT2"; + break; + case 12: + sound_card_result = "Stereo-on-1 DAC on LPT"; + break; + case 13: + sound_card_result = "PC speaker"; + break; + } + return sound_card_result; } -void get_str(string& n) -{ - string x; - char r; +void get_str(string &n) { + string x; + char r; - clear_to(black); - centre(3,3,"Enter the new value. Press Enter to accept, or Esc to cancel."); - x=""; + clear_to(black); + centre(3, 3, "Enter the new value. Press Enter to accept, or Esc to cancel."); + x = ""; - do { + do { - r=readkey(); + r = readkey(); - switch (r) { - case cbackspace: if (x[0]>'\0') x[0] -= 1; break; - case creturn: { - n=x; - return; - } - break; - case cescape: return; break; + switch (r) { + case cbackspace: + if (x[0] > '\0') x[0] -= 1; + break; + case creturn: { + n = x; + return; + } + break; + case cescape: + return; + break; - default: - if (x[0]<'\106') x=x+r; - } + default: + if (x[0] < '\106') x = x + r; + } - centre(7,2,string(' ')+x+' '); + centre(7, 2, string(' ') + x + ' '); - } while (!false); + } while (!false); } -void get_num(longint& n) -{ - string x; - char r; - integer e; +void get_num(longint &n) { + string x; + char r; + integer e; - clear_to(black); - centre(3,3,"Enter the new value. Press Enter to accept, or Esc to cancel."); - centre(4,3,"Precede with $ for a hex value."); - x=""; + clear_to(black); + centre(3, 3, "Enter the new value. Press Enter to accept, or Esc to cancel."); + centre(4, 3, "Precede with $ for a hex value."); + x = ""; - do { + do { - r=upcase(readkey()); + r = upcase(readkey()); - switch (r) { - case cbackspace: if (x[0]>'\0') x[0] -= 1; break; - case creturn: { - val(x,n,e); - return; - } - break; - case cescape: return; break; + switch (r) { + case cbackspace: + if (x[0] > '\0') x[0] -= 1; + break; + case creturn: { + val(x, n, e); + return; + } + break; + case cescape: + return; + break; - default: - if ((x[0]<'\106') && - ((set::of(range('0','9'), eos).has(r)) || ((x[1]=='$') && (set::of(range('A','F'), eos).has(r))) || - ((x=="") && (r=='$')))) - x=x+r; - } + default: + if ((x[0] < '\106') && + ((set::of(range('0', '9'), eos).has(r)) || ((x[1] == '$') && (set::of(range('A', 'F'), eos).has(r))) || + ((x == "") && (r == '$')))) + x = x + r; + } - centre(7,2,string(' ')+x+' '); + centre(7, 2, string(' ') + x + ' '); - } while (!false); + } while (!false); } -void general_menu() -{ - new_menu(); - do { - clear_to(blue); - - centre( 3,15,"General Menu"); - - centre( 5, 7,string("Override EGA check?")+yes_or_no(override_ega)); - centre( 6, 7,string("Skip loading screens?")+yes_or_no(skip_loading_screens)); - centre( 7, 7,string("Load a particular file by default?")+give_name(load_particular)); - centre( 8, 7,string("Force NumLock off?")+yes_or_no(force_numlock)); -/* centre( 9, 7,'Ignore the mouse?'+yes_or_no(ignore_mouse));*/ - centre(10, 7,string("Default controller?")+two_answers("keyboard","joystick",use_keyboard)); - centre(12, 7,string("Log to printer?")+yes_or_no(log_to_printer)); - centre(13, 7,string("Log to file?")+yes_or_no(log_to_file)); - centre(14, 7,string("Filename to log to?")+give_name(log_filename)); - - centre(15,15,"Return to main menu."); - - switch (choose_one_of(set::of(5,6,7,8,/*9,*/10,12,13,14,15, eos))) { - case 5: override_ega=! override_ega; break; - case 6: skip_loading_screens=! skip_loading_screens; break; - case 7: get_str(load_particular); break; - case 8: force_numlock=! force_numlock; break; -/* 9: ignore_mouse:=not ignore_mouse;*/ - case 10: use_keyboard=! use_keyboard; break; - case 12: { - log_to_printer=! log_to_printer; - if (log_to_file && log_to_printer) log_to_file=false; - } - break; - case 13: { - log_to_file=! log_to_file; - if (log_to_file && log_to_printer) log_to_printer=false; - } - break; - case 14: get_str(log_filename); break; - case 15: { new_menu(); return; } break; - } - - } while (!false); +void general_menu() { + new_menu(); + do { + clear_to(blue); + + centre(3, 15, "General Menu"); + + centre(5, 7, string("Override EGA check?") + yes_or_no(override_ega)); + centre(6, 7, string("Skip loading screens?") + yes_or_no(skip_loading_screens)); + centre(7, 7, string("Load a particular file by default?") + give_name(load_particular)); + centre(8, 7, string("Force NumLock off?") + yes_or_no(force_numlock)); + /* centre( 9, 7,'Ignore the mouse?'+yes_or_no(ignore_mouse));*/ + centre(10, 7, string("Default controller?") + two_answers("keyboard", "joystick", use_keyboard)); + centre(12, 7, string("Log to printer?") + yes_or_no(log_to_printer)); + centre(13, 7, string("Log to file?") + yes_or_no(log_to_file)); + centre(14, 7, string("Filename to log to?") + give_name(log_filename)); + + centre(15, 15, "Return to main menu."); + + switch (choose_one_of(set::of(5, 6, 7, 8,/*9,*/10, 12, 13, 14, 15, eos))) { + case 5: + override_ega = ! override_ega; + break; + case 6: + skip_loading_screens = ! skip_loading_screens; + break; + case 7: + get_str(load_particular); + break; + case 8: + force_numlock = ! force_numlock; + break; + /* 9: ignore_mouse:=not ignore_mouse;*/ + case 10: + use_keyboard = ! use_keyboard; + break; + case 12: { + log_to_printer = ! log_to_printer; + if (log_to_file && log_to_printer) log_to_file = false; + } + break; + case 13: { + log_to_file = ! log_to_file; + if (log_to_file && log_to_printer) log_to_printer = false; + } + break; + case 14: + get_str(log_filename); + break; + case 15: { + new_menu(); + return; + } + break; + } + + } while (!false); } -void joystick_menu() -{ - new_menu(); - do { - clear_to(green); - - centre(3,15,"Joystick Menu"); - - centre(5,14,string("Do you have a joystick?")+yes_or_no(has_a_joystick)); - centre(6,14,string("Which joystick to use? ")+chr(whichjoy+48)); - centre(7,14,"Select this one to set it up."); - - centre(15,15,"Return to main menu"); - - switch (choose_one_of(set::of(5,6,7,15, eos))) { - case 5: { - has_a_joystick=! has_a_joystick; - if (! has_a_joystick) - { jleft=0; jright=0; jtop=0; jbottom=0; } - } - break; - case 6: whichjoy=3-whichjoy; break; /* Flips between 2 and 1. */ - case 7: joysetup(); break; - case 15: { new_menu(); return; } break; - } - - } while (!false); +void joystick_menu() { + new_menu(); + do { + clear_to(green); + + centre(3, 15, "Joystick Menu"); + + centre(5, 14, string("Do you have a joystick?") + yes_or_no(has_a_joystick)); + centre(6, 14, string("Which joystick to use? ") + chr(whichjoy + 48)); + centre(7, 14, "Select this one to set it up."); + + centre(15, 15, "Return to main menu"); + + switch (choose_one_of(set::of(5, 6, 7, 15, eos))) { + case 5: { + has_a_joystick = ! has_a_joystick; + if (! has_a_joystick) { + jleft = 0; + jright = 0; + jtop = 0; + jbottom = 0; + } + } + break; + case 6: + whichjoy = 3 - whichjoy; + break; /* Flips between 2 and 1. */ + case 7: + joysetup(); + break; + case 15: { + new_menu(); + return; + } + break; + } + + } while (!false); } -void cycle(byte& what, byte upper_limit) -{ - if (what==upper_limit) - what=0; - else - what += 1; +void cycle(byte &what, byte upper_limit) { + if (what == upper_limit) + what = 0; + else + what += 1; } -void sound_menu() -{ - new_menu(); - do { - clear_to(cyan); - - centre(3, 0,"Sound menu"); - - centre(5, 0,string("Do you want to suppress sound effects?")+yes_or_no(suppress_sfx)); - centre(6, 0,string("Sound output device\? (")+sound_card(your_card)+')'); - centre(7, 0,string("Sampling rate\? (")+strf(samplerate)+"Hz)"); - centre(8, 0,string("Base address\? (")+strhf(sound_addr)+" *hex*)"); - centre(9, 0,string("IRQ\? (")+strf(sound_irq)+')'); - centre(10,0,string("DMA\? (")+strf(sound_dma)+')'); - centre(11,0,string("Do you want keyclick?")+yes_or_no(wants_keyclick)); - - centre(15,15,"Return to main menu"); - - centre(17,1,"WARNING: Incorrect values of IRQ and DMA may damage your computer!"); - centre(18,1,"Read AVALOT.INI for the correct values."); - - switch (choose_one_of(set::of(5,6,7,8,9,10,11,15, eos))) { - case 5: suppress_sfx=! suppress_sfx; break; - case 6: cycle(your_card,13); break; - case 7: get_num(samplerate); break; - case 8: get_num(sound_addr); break; - case 9: get_num(sound_irq); break; - case 10: get_num(sound_dma); break; - case 11: wants_keyclick=! wants_keyclick; break; - case 15: { new_menu(); return; } break; - } - - } while (!false); +void sound_menu() { + new_menu(); + do { + clear_to(cyan); + + centre(3, 0, "Sound menu"); + + centre(5, 0, string("Do you want to suppress sound effects?") + yes_or_no(suppress_sfx)); + centre(6, 0, string("Sound output device\? (") + sound_card(your_card) + ')'); + centre(7, 0, string("Sampling rate\? (") + strf(samplerate) + "Hz)"); + centre(8, 0, string("Base address\? (") + strhf(sound_addr) + " *hex*)"); + centre(9, 0, string("IRQ\? (") + strf(sound_irq) + ')'); + centre(10, 0, string("DMA\? (") + strf(sound_dma) + ')'); + centre(11, 0, string("Do you want keyclick?") + yes_or_no(wants_keyclick)); + + centre(15, 15, "Return to main menu"); + + centre(17, 1, "WARNING: Incorrect values of IRQ and DMA may damage your computer!"); + centre(18, 1, "Read AVALOT.INI for the correct values."); + + switch (choose_one_of(set::of(5, 6, 7, 8, 9, 10, 11, 15, eos))) { + case 5: + suppress_sfx = ! suppress_sfx; + break; + case 6: + cycle(your_card, 13); + break; + case 7: + get_num(samplerate); + break; + case 8: + get_num(sound_addr); + break; + case 9: + get_num(sound_irq); + break; + case 10: + get_num(sound_dma); + break; + case 11: + wants_keyclick = ! wants_keyclick; + break; + case 15: { + new_menu(); + return; + } + break; + } + + } while (!false); } -void printer_menu() -{ - byte fv; - byteset chooseable_lines; +void printer_menu() { + byte fv; + byteset chooseable_lines; - new_menu(); + new_menu(); - chooseable_lines=set::of(15, eos); - for( fv=1; fv <= num_printers; fv ++) - chooseable_lines=chooseable_lines+set::of(fv+8, eos); + chooseable_lines = set::of(15, eos); + for (fv = 1; fv <= num_printers; fv ++) + chooseable_lines = chooseable_lines + set::of(fv + 8, eos); - do { - clear_to(red); + do { + clear_to(red); - centre(3,15,"Printer menu"); + centre(3, 15, "Printer menu"); - centre(5,15,"Select one of the following printers:"); - centre(6,15,string("The current choice is ")+this_printer+'.'); + centre(5, 15, "Select one of the following printers:"); + centre(6, 15, string("The current choice is ") + this_printer + '.'); - for( fv=1; fv <= num_printers; fv ++) - centre(8+fv,14,printers[fv]); + for (fv = 1; fv <= num_printers; fv ++) + centre(8 + fv, 14, printers[fv]); - centre(15,15,"Return to main menu"); + centre(15, 15, "Return to main menu"); - fv=choose_one_of(chooseable_lines); + fv = choose_one_of(chooseable_lines); - if (fv==15) { new_menu(); return; } + if (fv == 15) { + new_menu(); + return; + } - this_printer=printers[fv-8]; + this_printer = printers[fv - 8]; - } while (!false); + } while (!false); } -void regi_split(string x) -{ - byte fv; +void regi_split(string x) { + byte fv; - regname[0]=chr(107-ord(x[1])); chkname[0]=regname[0]; - regnum[0]=chr(107-ord(x[2])); chknum[0]=chknum[0]; + regname[0] = chr(107 - ord(x[1])); + chkname[0] = regname[0]; + regnum[0] = chr(107 - ord(x[2])); + chknum[0] = chknum[0]; - move(x[3],regname[1],ord(regname[0])); - for( fv=1; fv <= length(regname); fv ++) - regname[fv]=chr(abs(((ord(regname[fv])-33)-177*fv) % 94)+33); + move(x[3], regname[1], ord(regname[0])); + for (fv = 1; fv <= length(regname); fv ++) + regname[fv] = chr(abs(((ord(regname[fv]) - 33) - 177 * fv) % 94) + 33); } -void registration_menu() -{ - char r; - text t,o; - string x; - byte fv; - - clear_to(black); - - centre(3,15,"REGISTRATION"); - centre(5,14,"Please insert the disk you were sent when you registered"); - centre(6,14,"into any drive, and press its letter. For example, if the"); - centre(7,14,"disk is in drive A:, press A."); - centre(9,14,"Press Esc to cancel this menu."); - - do { r=upcase(readkey()); } while (!(set::of('\33',range('A','Z'), eos).has(r))); if (r=='\33') return; - - /*$I-*/ - assign(t,string(r)+":\\REGISTER.DAT"); - reset(t); - /*$I+*/ - if (ioresult!=0) - { - centre(17,15,"But it isn't in that drive..."); - centre(19,15,"Press any key."); - r=readkey(); - return; - } - for( fv=1; fv <= 54; fv ++) t >> x >> NL; - regi_split(x); - - /* Copy the file... */ - - assign(o,"register.dat"); rewrite(o); reset(t); - - while (! eof(t)) - { - t >> x >> NL; o << x << NL; - } - close(t); close(o); - - centre(17,15,"Done! Press any key..."); - bottom_bar(); - r=readkey(); +void registration_menu() { + char r; + text t, o; + string x; + byte fv; + + clear_to(black); + + centre(3, 15, "REGISTRATION"); + centre(5, 14, "Please insert the disk you were sent when you registered"); + centre(6, 14, "into any drive, and press its letter. For example, if the"); + centre(7, 14, "disk is in drive A:, press A."); + centre(9, 14, "Press Esc to cancel this menu."); + + do { + r = upcase(readkey()); + } while (!(set::of('\33', range('A', 'Z'), eos).has(r))); + if (r == '\33') return; + + /*$I-*/ + assign(t, string(r) + ":\\REGISTER.DAT"); + reset(t); + /*$I+*/ + if (ioresult != 0) { + centre(17, 15, "But it isn't in that drive..."); + centre(19, 15, "Press any key."); + r = readkey(); + return; + } + for (fv = 1; fv <= 54; fv ++) t >> x >> NL; + regi_split(x); + + /* Copy the file... */ + + assign(o, "register.dat"); + rewrite(o); + reset(t); + + while (! eof(t)) { + t >> x >> NL; + o << x << NL; + } + close(t); + close(o); + + centre(17, 15, "Done! Press any key..."); + bottom_bar(); + r = readkey(); } -void menu() -{ - bottom_bar(); - new_menu(); - do { - clear_to(black); - - centre(3,15,"Avalot Setup - Main Menu"); - - centre(5, 9,"General setup"); - centre(6,10,"Joystick setup"); - centre(7,11,"Sound setup"); - centre(8,12,"Printer setup"); - centre(9,14,"REGISTRATION setup"); - - centre(15,15,"--- EXIT SETUP ---"); - - switch (choose_one_of(set::of(5,6,7,8,9,15, eos))) { - case 5: general_menu(); break; - case 6: joystick_menu(); break; - case 7: sound_menu(); break; - case 8: printer_menu(); break; - case 9: registration_menu(); break; - case 15: { - new_menu(); - clear_to(lightgray); - centre(3,0,"Quit: would you like to save changes?"); - centre(5,1,"Quit and SAVE changes."); - centre(6,1,"Quit and DON'T save changes."); - centre(15,0,"Cancel and return to the main menu."); - switch (choose_one_of(set::of(5,6,15, eos))) { - case 5: { - save_file(); - return; - } - break; - case 6: return; break; - } - new_menu(); - } - break; - } - - } while (!false); +void menu() { + bottom_bar(); + new_menu(); + do { + clear_to(black); + + centre(3, 15, "Avalot Setup - Main Menu"); + + centre(5, 9, "General setup"); + centre(6, 10, "Joystick setup"); + centre(7, 11, "Sound setup"); + centre(8, 12, "Printer setup"); + centre(9, 14, "REGISTRATION setup"); + + centre(15, 15, "--- EXIT SETUP ---"); + + switch (choose_one_of(set::of(5, 6, 7, 8, 9, 15, eos))) { + case 5: + general_menu(); + break; + case 6: + joystick_menu(); + break; + case 7: + sound_menu(); + break; + case 8: + printer_menu(); + break; + case 9: + registration_menu(); + break; + case 15: { + new_menu(); + clear_to(lightgray); + centre(3, 0, "Quit: would you like to save changes?"); + centre(5, 1, "Quit and SAVE changes."); + centre(6, 1, "Quit and DON'T save changes."); + centre(15, 0, "Cancel and return to the main menu."); + switch (choose_one_of(set::of(5, 6, 15, eos))) { + case 5: { + save_file(); + return; + } + break; + case 6: + return; + break; + } + new_menu(); + } + break; + } + + } while (!false); } -void defaults() /* Sets everything to its default value. */ -{ - /* general */ +void defaults() { /* Sets everything to its default value. */ + /* general */ - override_ega=false; - skip_loading_screens=false; - load_particular=""; - force_numlock=true; - ignore_mouse=false; - use_keyboard=true; - log_to_printer=false; - log_to_file=false; - log_filename="avalot.log"; + override_ega = false; + skip_loading_screens = false; + load_particular = ""; + force_numlock = true; + ignore_mouse = false; + use_keyboard = true; + log_to_printer = false; + log_to_file = false; + log_filename = "avalot.log"; - /* joystick */ + /* joystick */ - has_a_joystick=false; - /* jtop,jbottom,jleft,jright,jmidx,jmidy need no initialisation. */ + has_a_joystick = false; + /* jtop,jbottom,jleft,jright,jmidx,jmidy need no initialisation. */ - /* sound */ + /* sound */ - suppress_sfx=false; - your_card=0; /* none */ - wants_keyclick=false; + suppress_sfx = false; + your_card = 0; /* none */ + wants_keyclick = false; - /* other stuff */ + /* other stuff */ - registrant=""; + registrant = ""; - num_printers=0; this_printer="??"; + num_printers = 0; + this_printer = "??"; } void parse_file(); @@ -1053,243 +1186,256 @@ const integer parse_weird_logcode = 5; const integer parse_weird_card = 6; -static varying_string<80> this_,thiswas; - -static boolean error_found,ignoring; - - -static void error(byte what) -{ - textattr=15; - if (! error_found) - { - clrscr; textattr=12; - output << "SETUP: *** ERROR FOUND IN AVALOT.INI! ***" << NL; textattr=15; - } - output << ' '; - switch (what) { - case parse_weird_field: output << "Unknown identifier on the left"; break; - case parse_not_yes_or_no: output << "Value on the right should be Yes or No"; break; - case parse_not_numeric: output << "Value on the right is not numeric"; break; - case parse_not_kbd_or_joy: output << "Value on the right should be Keyboard or Joystick"; break; - case parse_weird_logcode: output << "Value on the right should be No, Printer or Disk"; break; - case parse_weird_card: output << "Never heard of the card"; break; - } - output << " in:" << NL; textattr=10; output << thiswas << NL; - error_found=true; +static varying_string<80> this_, thiswas; + +static boolean error_found, ignoring; + + +static void error(byte what) { + textattr = 15; + if (! error_found) { + clrscr; + textattr = 12; + output << "SETUP: *** ERROR FOUND IN AVALOT.INI! ***" << NL; + textattr = 15; + } + output << ' '; + switch (what) { + case parse_weird_field: + output << "Unknown identifier on the left"; + break; + case parse_not_yes_or_no: + output << "Value on the right should be Yes or No"; + break; + case parse_not_numeric: + output << "Value on the right is not numeric"; + break; + case parse_not_kbd_or_joy: + output << "Value on the right should be Keyboard or Joystick"; + break; + case parse_weird_logcode: + output << "Value on the right should be No, Printer or Disk"; + break; + case parse_weird_card: + output << "Never heard of the card"; + break; + } + output << " in:" << NL; + textattr = 10; + output << thiswas << NL; + error_found = true; } -static boolean yesno(string x) -{ - boolean yesno_result; - if (x=="YES") - yesno_result=true; - else if (x=="NO") - yesno_result=false; - else - { - error(parse_not_yes_or_no); - yesno_result=false; - } - return yesno_result; +static boolean yesno(string x) { + boolean yesno_result; + if (x == "YES") + yesno_result = true; + else if (x == "NO") + yesno_result = false; + else { + error(parse_not_yes_or_no); + yesno_result = false; + } + return yesno_result; } -static boolean kbdjoy(string x) -{ - boolean kbdjoy_result; - if (x=="KEYBOARD") - kbdjoy_result=true; - else if (x=="JOYSTICK") - kbdjoy_result=false; - else - { - error(parse_not_kbd_or_joy); - kbdjoy_result=false; - } - return kbdjoy_result; +static boolean kbdjoy(string x) { + boolean kbdjoy_result; + if (x == "KEYBOARD") + kbdjoy_result = true; + else if (x == "JOYSTICK") + kbdjoy_result = false; + else { + error(parse_not_kbd_or_joy); + kbdjoy_result = false; + } + return kbdjoy_result; } -static word numeric(string x) -{ - const varying_string<15> hexdigits = "0123456789ABCDEF"; - word answer; integer e; - - word numeric_result; - if (x[1]=='$') - { - answer=0; - for( e=2; e <= length(x); e ++) - { - answer=answer << 4; - answer += pos(upcase(x[e]),hexdigits)-1; - } - } else - { - val(x,answer,e); - if (e!=0) error(parse_not_numeric); - } - numeric_result=answer; - return numeric_result; +static word numeric(string x) { + const varying_string<15> hexdigits = "0123456789ABCDEF"; + word answer; + integer e; + + word numeric_result; + if (x[1] == '$') { + answer = 0; + for (e = 2; e <= length(x); e ++) { + answer = answer << 4; + answer += pos(upcase(x[e]), hexdigits) - 1; + } + } else { + val(x, answer, e); + if (e != 0) error(parse_not_numeric); + } + numeric_result = answer; + return numeric_result; } -static void get_logcodes(string x) -{ - if (x=="NO") { log_to_file=false; log_to_printer=false; } else - if (x=="DISK") { log_to_file=true; log_to_printer=false; } else - if (x=="PRINTER") { log_to_file=false; log_to_printer=true; } else - error(parse_weird_logcode); +static void get_logcodes(string x) { + if (x == "NO") { + log_to_file = false; + log_to_printer = false; + } else if (x == "DISK") { + log_to_file = true; + log_to_printer = false; + } else if (x == "PRINTER") { + log_to_file = false; + log_to_printer = true; + } else + error(parse_weird_logcode); } -static void get_card(string x) -{ - if (x=="NONE") your_card=0; else - if (x=="SB") your_card=1; else - if (x=="SBPRO") your_card=2; else - if (x=="SB16") your_card=3; else - if (x=="PAS") your_card=4; else - if (x=="PASPLUS") your_card=5; else - if (x=="PAS16") your_card=6; else - if (x=="ARIA") your_card=7; else - if (x=="WINSOUND") your_card=8; else - if (x=="GRAVIS") your_card=9; else - if (x=="DACLPT") your_card=10; else - if (x=="STEREODACS") your_card=11; else - if (x=="STEREOON1") your_card=12; else - if (x=="SPEAKER") your_card=13; else - error(parse_weird_card); +static void get_card(string x) { + if (x == "NONE") your_card = 0; + else if (x == "SB") your_card = 1; + else if (x == "SBPRO") your_card = 2; + else if (x == "SB16") your_card = 3; + else if (x == "PAS") your_card = 4; + else if (x == "PASPLUS") your_card = 5; + else if (x == "PAS16") your_card = 6; + else if (x == "ARIA") your_card = 7; + else if (x == "WINSOUND") your_card = 8; + else if (x == "GRAVIS") your_card = 9; + else if (x == "DACLPT") your_card = 10; + else if (x == "STEREODACS") your_card = 11; + else if (x == "STEREOON1") your_card = 12; + else if (x == "SPEAKER") your_card = 13; + else + error(parse_weird_card); } -void parse_file(){ +void parse_file() { - word where; - byte position; - varying_string<80> field,data,pure_data; - option o; + word where; + byte position; + varying_string<80> field, data, pure_data; + option o; - error_found=false; - ignoring=false; + error_found = false; + ignoring = false; - for( where=1; where <= mobylength; where ++) - { - this_=(*moby)[where]; thiswas=this_; + for (where = 1; where <= mobylength; where ++) { + this_ = (*moby)[where]; + thiswas = this_; - position=pos(";",this_); - if (position>0) this_=copy(this_,1,position-1); + position = pos(";", this_); + if (position > 0) this_ = copy(this_, 1, position - 1); - if (this_=="") continue_; /* Don't carry on if by now it's empty. */ + if (this_ == "") continue_; /* Don't carry on if by now it's empty. */ - if (this_[1]=='[') - { - ignoring=! (trim_and_caps(this_)=="[END]"); + if (this_[1] == '[') { + ignoring = !(trim_and_caps(this_) == "[END]"); - if (copy(this_,1,8)=="[printer") - { - num_printers += 1; - printers[num_printers]=copy(this_,10,length(this_)-10); - } - } + if (copy(this_, 1, 8) == "[printer") { + num_printers += 1; + printers[num_printers] = copy(this_, 10, length(this_) - 10); + } + } - if (ignoring) continue_; + if (ignoring) continue_; - position=pos("=",this_); - field=trim_and_caps(copy(this_,1,position-1)); if (field=="") continue_; - pure_data=copy(this_,position+1,255); - data=trim_and_caps(pure_data); - o=string_2_option(field); + position = pos("=", this_); + field = trim_and_caps(copy(this_, 1, position - 1)); + if (field == "") continue_; + pure_data = copy(this_, position + 1, 255); + data = trim_and_caps(pure_data); + o = string_2_option(field); - /* general */ + /* general */ - if (o==_overrideegacheck) override_ega=yesno(data); else - if (o==_zoomystart) skip_loading_screens=yesno(data); else - if (o==_loadfirst) load_particular=data; else - if (o==_numlockhold) force_numlock=yesno(data); else - if (o==_usemouse) ignore_mouse=yesno(data); else - if (o==_controller) use_keyboard=kbdjoy(data); else - if (o==_logging) get_logcodes(data); else - if (o==_logfile) log_filename=data; else + if (o == _overrideegacheck) override_ega = yesno(data); + else if (o == _zoomystart) skip_loading_screens = yesno(data); + else if (o == _loadfirst) load_particular = data; + else if (o == _numlockhold) force_numlock = yesno(data); + else if (o == _usemouse) ignore_mouse = yesno(data); + else if (o == _controller) use_keyboard = kbdjoy(data); + else if (o == _logging) get_logcodes(data); + else if (o == _logfile) log_filename = data; + else - /* joystick */ + /* joystick */ - if (o==_joystickinstalled) has_a_joystick=yesno(data); else - if (o==_joytop) jtop=numeric(data); else - if (o==_joybottom) jbottom=numeric(data); else - if (o==_joyleft) jleft=numeric(data); else - if (o==_joyright) jright=numeric(data); else - if (o==_joymidx) jmidx=numeric(data); else - if (o==_joymidy) jmidy=numeric(data); else - if (o==_joycentringfactor) jcentre=numeric(data); else - if (o==_whichjoy) whichjoy=numeric(data); else + if (o == _joystickinstalled) has_a_joystick = yesno(data); + else if (o == _joytop) jtop = numeric(data); + else if (o == _joybottom) jbottom = numeric(data); + else if (o == _joyleft) jleft = numeric(data); + else if (o == _joyright) jright = numeric(data); + else if (o == _joymidx) jmidx = numeric(data); + else if (o == _joymidy) jmidy = numeric(data); + else if (o == _joycentringfactor) jcentre = numeric(data); + else if (o == _whichjoy) whichjoy = numeric(data); + else - /* sound */ + /* sound */ - if (o==_quiet) suppress_sfx=yesno(data); else - if (o==_soundcard) get_card(data); else - if (o==_samplerate) samplerate=numeric(data); else - if (o==_baseaddress) sound_addr=numeric(data); else - if (o==_irq) sound_irq=numeric(data); else - if (o==_dma) sound_dma=numeric(data); else - if (o==_keyboardclick) wants_keyclick=yesno(data); else + if (o == _quiet) suppress_sfx = yesno(data); + else if (o == _soundcard) get_card(data); + else if (o == _samplerate) samplerate = numeric(data); + else if (o == _baseaddress) sound_addr = numeric(data); + else if (o == _irq) sound_irq = numeric(data); + else if (o == _dma) sound_dma = numeric(data); + else if (o == _keyboardclick) wants_keyclick = yesno(data); + else - /* printer */ + /* printer */ - if (o==_printer) this_printer=pure_data; else + if (o == _printer) this_printer = pure_data; + else - /* others */ + /* others */ - error(parse_weird_field); - } + error(parse_weird_field); + } - if (error_found) - { - textattr=15; - output << " Try and fix the above errors. As a last resort, try deleting or" << NL; - output << " renaming AVALOT.INI, and the default values will be used. Good luck." << NL; - exit(177); - } - } + if (error_found) { + textattr = 15; + output << " Try and fix the above errors. As a last resort, try deleting or" << NL; + output << " renaming AVALOT.INI, and the default values will be used. Good luck." << NL; + exit(177); + } +} -void clear_up() -{ - window(1,1,80,25); - textattr=31; - clrscr; - output << NL; - output << "Enjoy the game..." << NL; - output << NL; - cga_cursor_on; +void clear_up() { + window(1, 1, 80, 25); + textattr = 31; + clrscr; + output << NL; + output << "Enjoy the game..." << NL; + output << NL; + cga_cursor_on; } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - cursor_off; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + cursor_off; - moby = new mobytype; /* Allocate memory space */ + moby = new mobytype; /* Allocate memory space */ - defaults(); + defaults(); - load_file(); + load_file(); - parse_file(); + parse_file(); - menu(); + menu(); - delete moby; /* Deallocate memory space again */ + delete moby; /* Deallocate memory space again */ - clear_up(); - return EXIT_SUCCESS; + clear_up(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index 883a810cdbe6..8025b9a4c139 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -45,7 +45,7 @@ const integer avvy_y = 150; const integer left_margin = 10; const integer right_margin = 605; -const array<0,6,byte> shooting = {{87,80,81,82,81,80,87}}; +const array<0, 6, byte> shooting = {{87, 80, 81, 82, 81, 80, 87}}; const integer stocks = 28; @@ -56,7 +56,7 @@ const integer maxrunners = 4; const integer times_a_second = /*31*/18; const integer flash_time = 20; /* If flash_time is <= this, the word "time" will flash. */ - /* Should be about 20. */ +/* Should be about 20. */ /* --- Scores for various things --- */ @@ -64,42 +64,43 @@ const integer score_for_hitting_face = 3; const integer bonus_for_hitting_escaper = 5; struct mtype { - shortint ix,iy; - integer x,y; - byte p; - integer timeout; - boolean cameo; - byte cameo_frame; - boolean missile; - boolean wipe; + shortint ix, iy; + integer x, y; + byte p; + integer timeout; + boolean cameo; + byte cameo_frame; + boolean missile; + boolean wipe; }; struct xtype { - word s; - pointer p; + word s; + pointer p; }; class rectype { public: - integer x1,y1,x2,y2; + integer x1, y1, x2, y2; }; class plottype : public rectype { public: - byte which; + byte which; }; class plotmasktype : public plottype { public: - byte whichmask; + byte whichmask; }; -array<1,100,xtype> x; -array<1,100,mtype> m; -matrix<0,1,1,100,rectype> r; -array<0,1,byte> rsize; +array<1, 100, xtype> x; +array<1, 100, mtype> m; +matrix<0, 1, 1, 100, rectype> r; +array<0, 1, byte> rsize; byte cp; -word score; byte time1; +word score; +byte time1; byte shiftstate; /*ABSOLUTE $40:$17; */ @@ -116,15 +117,15 @@ byte throw_next; boolean firing; -array<0,6,byte> stockstatus; +array<0, 6, byte> stockstatus; -array<1,maxrunners,struct A1 { - integer x,y; - byte frame; - byte toohigh,lowest; - shortint ix,iy; - byte framedelay; - }> running; +array < 1, maxrunners, struct A1 { + integer x, y; + byte frame; + byte toohigh, lowest; + shortint ix, iy; + byte framedelay; +} > running; varying_string<5> score_is; varying_string<3> time_is; @@ -133,432 +134,418 @@ byte time_this_second; word escape_count; byte escape_stock; -boolean escaping,got_out; +boolean escaping, got_out; -array<0,6,boolean> has_escaped; +array<0, 6, boolean> has_escaped; byte count321; -word storage_seg,storage_ofs; +word storage_seg, storage_ofs; byte how_many_have_escaped; -void flippage() -{ - setactivepage(cp); - cp=1-cp; - setvisualpage(cp); +void flippage() { + setactivepage(cp); + cp = 1 - cp; + setvisualpage(cp); } -void flesh_colours() {; /*assembler; +void flesh_colours() { + ; /*assembler; asm mov ax,$1012; mov bx,21; { 21 = light pink (why?) */ - /*mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; + /*mov cx,1; + mov dx,seg @flesh; + mov es,dx; + mov dx,offset @flesh; + int $10; - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. */ - /*int $10; - - jmp @TheEnd; - - @flesh: - db 56,35,35; - - @darkflesh: - db 43,22,22; - - @TheEnd: */ - } - -boolean overlap(word a1x,word a1y,word a2x,word a2y,word b1x,word b1y,word b2x,word b2y) -{ /* By De Morgan's law: */ - boolean overlap_result; - overlap_result=(a2x>=b1x) && (b2x>=a1x) && (a2y>=b1y) && (b2y>=a1y); - return overlap_result; -} - -void getsize(byte w, integer& xx,integer& yy) -{ - array<0,1,integer> n; - - move(x[w].p,n,4); - xx=n[0]; yy=n[1]; -} - -void display(integer xx,integer yy, byte w) -{ - putimage(xx,yy,x[w].p,0); -} - -byte get_stock_number(byte x) -{ - byte get_stock_number_result; - while (has_escaped[x]) - { - x += 1; - if (x==7) x=0; - } - get_stock_number_result=x; - return get_stock_number_result; -} - -void cameo_display(integer xx,integer yy, byte w1,byte w2) -{ - putimage(xx,yy,x[w2].p,andput); - putimage(xx,yy,x[w1].p,xorput); -} - -void blankit() -{ - byte fv; - - for( fv=1; fv <= rsize[cp]; fv ++) - { rectype& with = r[cp][fv]; - bar(with.x1,with.y1,with.x2,with.y2);} - rsize[cp]=0; -} - -void blank(integer xx1,integer yy1,integer xx2,integer yy2) -{ - rsize[cp] += 1; - { - rectype& with = r[cp][rsize[cp]]; - - with.x1=xx1; - with.y1=yy1; - with.x2=xx2; - with.y2=yy2; - } -} - -void movethem() -{ - byte fv; - - for( fv=1; fv <= msize; fv ++) - { mtype& with = m[fv]; - if (with.x!=flag) - { - with.x=with.x+with.ix; - with.y=with.y+with.iy; - }} -} - -void plotthem() -{ - byte fv; integer xx,yy; - - for( fv=1; fv <= msize; fv ++) - { mtype& with = m[fv]; - if (with.x!=flag) - { - if (with.cameo) - { - cameo_display(with.x,with.y,with.p,with.cameo_frame); - if (cp==0) { with.cameo_frame += 2; with.p += 2; } - } else display(with.x,with.y,with.p); - getsize(with.p,xx,yy); - if (with.wipe) blank(with.x,with.y,with.x+xx,with.y+yy); - if (with.timeout>0) - { - with.timeout -= 1; - if (with.timeout==0) with.x=flag; - } - }} -} - -void define(integer xx,integer yy, byte pp, shortint ixx,shortint iyy, integer timetime, - boolean is_a_missile,boolean do_we_wipe) -{ - byte which; - - for( which=1; which <= msize; which ++) - { - mtype& with = m[which]; - - if (with.x==flag) - { - with.x=xx; - with.y=yy; - with.p=pp; - with.ix=ixx; - with.iy=iyy; - with.timeout=timetime; - with.cameo=false; - with.missile=is_a_missile; - with.wipe=do_we_wipe; - - return; - } - } -} - -void define_cameo(integer xx,integer yy, byte pp, integer timetime) -{ - byte which; - - for( which=1; which <= msize; which ++) - { - mtype& with = m[which]; - - if (with.x==flag) - { - with.x=xx; - with.y=yy; - with.p=pp; - with.ix=0; - with.iy=0; - with.timeout=timetime; - with.cameo=true; - with.cameo_frame=pp+1; - with.missile=false; - with.wipe=false; - - return; - } - } -} - -void get_score() -{ - byte fv; - - str(score,5,score_is); - for( fv=1; fv <= 5; fv ++) - if (score_is[fv]==' ') - score_is[fv]='0'; -} - -void get_time1() -{ - byte fv; - - str(time1,5,time_is); - for( fv=1; fv <= 3; fv ++) - if (time_is[fv]==' ') - time_is[fv]='0'; -} - -void display_const(integer x,integer y, byte what) -{ - byte page_; - - for( page_=0; page_ <= 1; page_ ++) - { - setactivepage(page_); - display(x,y,what); - } - setactivepage(1-cp); -} - -void show_stock(byte x) -{ - if (escaping && (x==escape_stock)) - { - display_const(x*90+20,30,stocks+2); - return; - } - if (stockstatus[x]>5) return; - display_const(x*90+20,30,stocks+stockstatus[x]); - stockstatus[x]=1-stockstatus[x]; -} - -void show_score() -{ - byte fv; - varying_string<5> score_was; - - score_was=score_is; get_score(); - for( fv=1; fv <= 5; fv ++) - if (score_was[fv]!=score_is[fv]) - display_const(30+fv*10,0,ord(score_is[fv])-47); -} - -void show_time() -{ - byte fv; - varying_string<3> time_was; - - time_was=time_is; get_time1(); - for( fv=1; fv <= 3; fv ++) - if (time_was[fv]!=time_is[fv]) - display_const(130+fv*10,0,ord(time_is[fv])-47); + mov dx,seg @darkflesh; + mov es,dx; + mov dx,offset @darkflesh; + mov bx,5; { 5 = dark pink. */ + /*int $10; + + jmp @TheEnd; + + @flesh: + db 56,35,35; + + @darkflesh: + db 43,22,22; + + @TheEnd: */ +} + +boolean overlap(word a1x, word a1y, word a2x, word a2y, word b1x, word b1y, word b2x, word b2y) { + /* By De Morgan's law: */ + boolean overlap_result; + overlap_result = (a2x >= b1x) && (b2x >= a1x) && (a2y >= b1y) && (b2y >= a1y); + return overlap_result; +} + +void getsize(byte w, integer &xx, integer &yy) { + array<0, 1, integer> n; + + move(x[w].p, n, 4); + xx = n[0]; + yy = n[1]; +} + +void display(integer xx, integer yy, byte w) { + putimage(xx, yy, x[w].p, 0); +} + +byte get_stock_number(byte x) { + byte get_stock_number_result; + while (has_escaped[x]) { + x += 1; + if (x == 7) x = 0; + } + get_stock_number_result = x; + return get_stock_number_result; +} + +void cameo_display(integer xx, integer yy, byte w1, byte w2) { + putimage(xx, yy, x[w2].p, andput); + putimage(xx, yy, x[w1].p, xorput); +} + +void blankit() { + byte fv; + + for (fv = 1; fv <= rsize[cp]; fv ++) { + rectype &with = r[cp][fv]; + bar(with.x1, with.y1, with.x2, with.y2); + } + rsize[cp] = 0; +} + +void blank(integer xx1, integer yy1, integer xx2, integer yy2) { + rsize[cp] += 1; + { + rectype &with = r[cp][rsize[cp]]; + + with.x1 = xx1; + with.y1 = yy1; + with.x2 = xx2; + with.y2 = yy2; + } +} + +void movethem() { + byte fv; + + for (fv = 1; fv <= msize; fv ++) { + mtype &with = m[fv]; + if (with.x != flag) { + with.x = with.x + with.ix; + with.y = with.y + with.iy; + } + } +} + +void plotthem() { + byte fv; + integer xx, yy; + + for (fv = 1; fv <= msize; fv ++) { + mtype &with = m[fv]; + if (with.x != flag) { + if (with.cameo) { + cameo_display(with.x, with.y, with.p, with.cameo_frame); + if (cp == 0) { + with.cameo_frame += 2; + with.p += 2; + } + } else display(with.x, with.y, with.p); + getsize(with.p, xx, yy); + if (with.wipe) blank(with.x, with.y, with.x + xx, with.y + yy); + if (with.timeout > 0) { + with.timeout -= 1; + if (with.timeout == 0) with.x = flag; + } + } + } } -void gain(shortint howmuch) -{ - if (-howmuch>score) score=0; else - score=score+howmuch; - show_score(); +void define(integer xx, integer yy, byte pp, shortint ixx, shortint iyy, integer timetime, + boolean is_a_missile, boolean do_we_wipe) { + byte which; + + for (which = 1; which <= msize; which ++) { + mtype &with = m[which]; + + if (with.x == flag) { + with.x = xx; + with.y = yy; + with.p = pp; + with.ix = ixx; + with.iy = iyy; + with.timeout = timetime; + with.cameo = false; + with.missile = is_a_missile; + with.wipe = do_we_wipe; + + return; + } + } +} + +void define_cameo(integer xx, integer yy, byte pp, integer timetime) { + byte which; + + for (which = 1; which <= msize; which ++) { + mtype &with = m[which]; + + if (with.x == flag) { + with.x = xx; + with.y = yy; + with.p = pp; + with.ix = 0; + with.iy = 0; + with.timeout = timetime; + with.cameo = true; + with.cameo_frame = pp + 1; + with.missile = false; + with.wipe = false; + + return; + } + } +} + +void get_score() { + byte fv; + + str(score, 5, score_is); + for (fv = 1; fv <= 5; fv ++) + if (score_is[fv] == ' ') + score_is[fv] = '0'; +} + +void get_time1() { + byte fv; + + str(time1, 5, time_is); + for (fv = 1; fv <= 3; fv ++) + if (time_is[fv] == ' ') + time_is[fv] = '0'; } -void new_escape() -{ - escape_count=Random(18)*20; - escaping=false; +void display_const(integer x, integer y, byte what) { + byte page_; + + for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + display(x, y, what); + } + setactivepage(1 - cp); +} + +void show_stock(byte x) { + if (escaping && (x == escape_stock)) { + display_const(x * 90 + 20, 30, stocks + 2); + return; + } + if (stockstatus[x] > 5) return; + display_const(x * 90 + 20, 30, stocks + stockstatus[x]); + stockstatus[x] = 1 - stockstatus[x]; +} + +void show_score() { + byte fv; + varying_string<5> score_was; + + score_was = score_is; + get_score(); + for (fv = 1; fv <= 5; fv ++) + if (score_was[fv] != score_is[fv]) + display_const(30 + fv * 10, 0, ord(score_is[fv]) - 47); +} + +void show_time() { + byte fv; + varying_string<3> time_was; + + time_was = time_is; + get_time1(); + for (fv = 1; fv <= 3; fv ++) + if (time_was[fv] != time_is[fv]) + display_const(130 + fv * 10, 0, ord(time_is[fv]) - 47); +} + +void gain(shortint howmuch) { + if (-howmuch > score) score = 0; + else + score = score + howmuch; + show_score(); +} + +void new_escape() { + escape_count = Random(18) * 20; + escaping = false; } void instructions(); -static void nextpage() -{ - char c; - - outtextxy(400,190,"Press a key for next page >"); - c=readkey(); - cleardevice(); -} - -void instructions() -{ - display(25,25,facing_right); - outtextxy(60,35,"< Avvy, our hero, needs your help - you must move him around."); - outtextxy(80,45,"(He's too terrified to move himself!)"); - - outtextxy(0,75,"Your task is to prevent the people in the stocks from escaping"); - outtextxy(0,85,"by pelting them with rotten fruit, eggs and bread. The keys are:"); - outtextxy(80,115,"LEFT SHIFT"); outtextxy(200,115,"Move left."); - outtextxy(72,135,"RIGHT SHIFT"); outtextxy(200,135,"Move right."); - outtextxy(136,155,"ALT"); outtextxy(200,155,"Throw something."); - nextpage(); - - display(25,35,stocks); - outtextxy(80,35,"This man is in the stocks. Your job is to stop him getting out."); - outtextxy(88,45,"UNFORTUNATELY... the locks on the stocks are loose, and every"); - outtextxy(88,55,"so often, someone will discover this and try to get out."); - display(25, 85,stocks+2); - outtextxy(80, 85,"< Someone who has found a way out!"); - outtextxy(88, 95,"You MUST IMMEDIATELY hit people smiling like this, or they"); - outtextxy(88,105,"will disappear and lose you points."); - display(25,125,stocks+5); - display(25,155,stocks+4); - outtextxy(80,125,"< Oh dear!"); - nextpage(); - - outtextxy(0,35,"Your task is made harder by:"); - display(25,55,48); - outtextxy(60,55,"< Yokels. These people will run in front of you. If you hit"); - outtextxy(68,65,"them, you will lose MORE points than you get hitting people"); - outtextxy(68,75,"in the stocks. So BEWARE!"); - outtextxy(80,125,"Good luck with the game!"); - nextpage(); -} - -void setup() -{ - integer gd,gm; - untyped_file f; - char rkv; - - rkv=upcase(readkey()); - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - flesh_colours(); - - assign(f,"notts.avd"); - reset(f,1); gd=1; - score=0; time1=120; score_is="(c)94"; - time_this_second=0; - - while (! eof(f)) - { - xtype& with = x[gd]; - - blockread(f,with.s,2); - getmem(with.p,with.s); - blockread(f,with.p,with.s); - gd += 1; - } - close(f); - - if ((rkv=='I') || ((rkv=='\0') && (readkey()==cf1))) instructions(); - - for( gd=0; gd <= 6; gd ++) - { - stockstatus[gd]=Random(2); - show_stock(gd); - } - - fillchar(m,sizeof(m),'\261'); - setfillstyle(1,0); - cp=0; - flippage(); - fillchar(rsize,sizeof(rsize),'\0'); - avvywas=320; - avvypos=320; - avvyanim=1; - avvyfacing=facing_left; - - alt_was_pressed_before=false; - throw_next=74; - firing=false; - - for( gd=1; gd <= maxrunners; gd ++) - { - A1& with = running[gd]; - - with.x=flag; - } - - new_escape(); - fillchar(has_escaped,sizeof(has_escaped),'\0'); /* All false. */ - count321=255; /* Counting down. */ - - /* Set up status line. */ - - display_const(0,0,17); /* Score: */ - show_score(); /* value of score (00000 here) */ - display_const(110,0,20); /* Time: */ - show_time(); /* value of time */ - - Randomize(); - - how_many_have_escaped=0; -} - -void init_runner(integer xx,integer yy, byte f1,byte f2, shortint ixx,shortint iyy) -{ - byte fv; - - for( fv=1; fv <= maxrunners; fv ++) - { A1& with = running[fv]; - if (with.x==flag) - { - with.x=xx; with.y=yy; - with.frame=f1; - with.toohigh=f2; - with.lowest=f1; - with.ix=ixx; with.iy=iyy; - if ((with.ix==0) && (with.iy==0)) with.ix=2; /* To stop them running on the spot! */ - with.framedelay=framedelaymax; - return; - }} -} - -void titles() -{ - registers r; - byte a; /*absolute $A000:0; */ - untyped_file f; - byte bit; - - r.ax=0xd; - intr(0x10,r); - - assign(f,"shoot1.avd"); - reset(f,1); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,8000); - } - close(f); +static void nextpage() { + char c; + + outtextxy(400, 190, "Press a key for next page >"); + c = readkey(); + cleardevice(); +} + +void instructions() { + display(25, 25, facing_right); + outtextxy(60, 35, "< Avvy, our hero, needs your help - you must move him around."); + outtextxy(80, 45, "(He's too terrified to move himself!)"); + + outtextxy(0, 75, "Your task is to prevent the people in the stocks from escaping"); + outtextxy(0, 85, "by pelting them with rotten fruit, eggs and bread. The keys are:"); + outtextxy(80, 115, "LEFT SHIFT"); + outtextxy(200, 115, "Move left."); + outtextxy(72, 135, "RIGHT SHIFT"); + outtextxy(200, 135, "Move right."); + outtextxy(136, 155, "ALT"); + outtextxy(200, 155, "Throw something."); + nextpage(); + + display(25, 35, stocks); + outtextxy(80, 35, "This man is in the stocks. Your job is to stop him getting out."); + outtextxy(88, 45, "UNFORTUNATELY... the locks on the stocks are loose, and every"); + outtextxy(88, 55, "so often, someone will discover this and try to get out."); + display(25, 85, stocks + 2); + outtextxy(80, 85, "< Someone who has found a way out!"); + outtextxy(88, 95, "You MUST IMMEDIATELY hit people smiling like this, or they"); + outtextxy(88, 105, "will disappear and lose you points."); + display(25, 125, stocks + 5); + display(25, 155, stocks + 4); + outtextxy(80, 125, "< Oh dear!"); + nextpage(); + + outtextxy(0, 35, "Your task is made harder by:"); + display(25, 55, 48); + outtextxy(60, 55, "< Yokels. These people will run in front of you. If you hit"); + outtextxy(68, 65, "them, you will lose MORE points than you get hitting people"); + outtextxy(68, 75, "in the stocks. So BEWARE!"); + outtextxy(80, 125, "Good luck with the game!"); + nextpage(); +} + +void setup() { + integer gd, gm; + untyped_file f; + char rkv; + + rkv = upcase(readkey()); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + flesh_colours(); + + assign(f, "notts.avd"); + reset(f, 1); + gd = 1; + score = 0; + time1 = 120; + score_is = "(c)94"; + time_this_second = 0; + + while (! eof(f)) { + xtype &with = x[gd]; + + blockread(f, with.s, 2); + getmem(with.p, with.s); + blockread(f, with.p, with.s); + gd += 1; + } + close(f); + + if ((rkv == 'I') || ((rkv == '\0') && (readkey() == cf1))) instructions(); + + for (gd = 0; gd <= 6; gd ++) { + stockstatus[gd] = Random(2); + show_stock(gd); + } + + fillchar(m, sizeof(m), '\261'); + setfillstyle(1, 0); + cp = 0; + flippage(); + fillchar(rsize, sizeof(rsize), '\0'); + avvywas = 320; + avvypos = 320; + avvyanim = 1; + avvyfacing = facing_left; + + alt_was_pressed_before = false; + throw_next = 74; + firing = false; + + for (gd = 1; gd <= maxrunners; gd ++) { + A1 &with = running[gd]; + + with.x = flag; + } + + new_escape(); + fillchar(has_escaped, sizeof(has_escaped), '\0'); /* All false. */ + count321 = 255; /* Counting down. */ + + /* Set up status line. */ + + display_const(0, 0, 17); /* Score: */ + show_score(); /* value of score (00000 here) */ + display_const(110, 0, 20); /* Time: */ + show_time(); /* value of time */ + + Randomize(); + + how_many_have_escaped = 0; +} + +void init_runner(integer xx, integer yy, byte f1, byte f2, shortint ixx, shortint iyy) { + byte fv; + + for (fv = 1; fv <= maxrunners; fv ++) { + A1 &with = running[fv]; + if (with.x == flag) { + with.x = xx; + with.y = yy; + with.frame = f1; + with.toohigh = f2; + with.lowest = f1; + with.ix = ixx; + with.iy = iyy; + if ((with.ix == 0) && (with.iy == 0)) with.ix = 2; /* To stop them running on the spot! */ + with.framedelay = framedelaymax; + return; + } + } +} + +void titles() { + registers r; + byte a; /*absolute $A000:0; */ + untyped_file f; + byte bit; + + r.ax = 0xd; + intr(0x10, r); + + assign(f, "shoot1.avd"); + reset(f, 1); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 8000); + } + close(f); } /* procedure animate3; @@ -608,397 +595,395 @@ begin end; */ -void move_avvy() -{ - if (avvywasavvypos) - { -/* bar(avvyWas+32,Avvy_Y,avvyPos+33,Avvy_Y+85);*/ - avvyfacing=facing_left; - } - - if (! firing) - { - if (avvywas==avvypos) - avvyanim=1; - else - { - avvyanim += 1; - if (avvyanim==6) avvyanim=0; - } - } - - if (avvyfacing==avvy_shoot) - define(avvypos,avvy_y,shooting[avvyanim],0,0,1,false,true); - else - define(avvypos,avvy_y,avvyanim+avvyfacing,0,0,1,false,true); - - avvywas=avvypos; - - if (avvyfacing==avvy_shoot) - { - if (avvyanim==6) - { - avvyfacing=was_facing; - avvyanim=0; - firing=false; - } else avvyanim += 1; - } -} - -void read_kbd() -{ - - if (firing) return; - - if ((shiftstate & 8)>0) - { /* Alt - shoot */ - if ((alt_was_pressed_before) || (count321!=0)) return; - alt_was_pressed_before=true; - firing=true; - define(avvypos+27,avvy_y+5,throw_next,0,-2,53,true,true); - throw_next += 1; if (throw_next==80) throw_next=74; - avvyanim=0; - was_facing=avvyfacing; - avvyfacing=avvy_shoot; - return; - } - - alt_was_pressed_before=false; - - if ((shiftstate & 1)>0) - { /* Move right. */ - avvypos += 5; - if (avvypos>right_margin) avvypos=right_margin; - return; - } - - if ((shiftstate & 2)>0) - { /* Move left. */ - avvypos -= 5; - if (avvypos5) - { - stockstatus[fv] -= 1; - if (stockstatus[fv]==8) - { - stockstatus[fv]=0; - show_stock(fv); - } - } -} - -void collision_check() -{ - byte fv; - integer dist_from_side; - byte this_stock; - - for( fv=1; fv <= 100; fv ++) - { mtype& with = m[fv]; - if (with.x!=flag) - { - if ((with.missile) && (with.y<60) && (with.timeout==1)) - { -/* sound(177); delay(1); nosound;*/ - dist_from_side=(with.x-20) % 90; - this_stock=((with.x-20) / 90); - if ((! has_escaped[this_stock]) && - (dist_from_side>17) && (dist_from_side<34)) - { - sound(999); delay(3); nosound; - define(with.x+20,with.y,26+Random(2),3,1,12,false,true); /* Well done! */ - define(this_stock*90+20,30,31,0,0,7,false,false); /* Face of man */ - define_cameo(this_stock*90+20+10,35,40,7); /* Splat! */ - define(this_stock*90+20+20,50,34+Random(5),0,2,9,false,true); /* Oof! */ - stockstatus[this_stock]=17; - gain(score_for_hitting_face); - - if ((escaping) && (escape_stock==this_stock)) - { /* Hit the escaper. */ - sound(1777); delay(1); nosound; - gain(bonus_for_hitting_escaper); - escaping=false; new_escape(); - } - } else - { - define(with.x,with.y,83+Random(3),2,2,17,false,true); /* Missed! */ - if ((! has_escaped[this_stock]) && - ((dist_from_side>3) && (dist_from_side<43))) - { - define(this_stock*90+20,30,30,0,0,7,false,false); /* Face of man */ - if (dist_from_side>35) - define_cameo(with.x-27,35,40,7); /* Splat! */ - else - define_cameo(with.x-7,35,40,7); - stockstatus[this_stock]=17; - } - } - } - }} -} - -shortint sgn(integer a) -{ - shortint sgn_result; - if (a==0) { sgn_result=0; return sgn_result; } - if (a>0) { sgn_result=1; return sgn_result; } - sgn_result=-1; - return sgn_result; -} - -void turn_around(byte who, boolean randomx) -{ - { - A1& with = running[who]; - - if (randomx) - { - if (with.ix>0) with.ix=-(Random(5)+1); else with.ix=(Random(5)+1); - } else - with.ix=-with.ix; - with.iy=-with.iy; - } -} - -void bump_folk() -{ - byte fv,ff; - - for( fv=1; fv <= maxrunners; fv ++) - if (running[fv].x!=flag) - for( ff=fv+1; ff <= maxrunners; ff ++) - if ((running[ff].x!=flag) && - overlap(running[fv].x,running[fv].y, - running[fv].x+17,running[fv].y+24, - running[ff].x,running[ff].y, - running[ff].x+17,running[ff].y+24)) - { - turn_around(fv,false); /* Opp. directions. */ - turn_around(ff,false); - } -} - -void people_running() -{ - byte fv; - - if (count321!=0) return; - for( fv=1; fv <= maxrunners; fv ++) - { A1& with = running[fv]; - if (with.x!=flag) - { - if (((with.y+with.iy)<=53) || ((with.y+with.iy)>=120)) - { - with.iy=-with.iy; - } - - if (with.ix<0) - define(with.x,with.y,with.frame,0,0,1,false,true); - else - define(with.x,with.y,with.frame+7,0,0,1,false,true); - if (with.framedelay==0) - { - with.frame += 1; if (with.frame==with.toohigh) with.frame=with.lowest; - with.framedelay=framedelaymax; - with.y=with.y+with.iy; - } else with.framedelay -= 1; - - if (((with.x+with.ix)<=0) || ((with.x+with.ix)>=620)) turn_around(fv,true); - - with.x=with.x+with.ix; - }} -} - -void update_time() -{ - if (count321!=0) return; - time_this_second += 1; - if (time_this_second < times_a_second) return; - time1 -= 1; - show_time(); - time_this_second=0; - if (time1<=flash_time) - if (odd(time1)) display_const(110,0,20); /* Normal time */ - else display_const(110,0,86); /* Flash time */ -} - -void hit_people() -{ - byte fv,ff; - - if (count321!=0) return; - for( fv=1; fv <= 100; fv ++) - { mtype& with = m[fv]; - if (with.missile && (with.x!=flag)) - for( ff=1; ff <= maxrunners; ff ++) - if ((running[ff].x!=flag) && - overlap(with.x,with.y,with.x+7,with.y+10, - running[ff].x,running[ff].y, - running[ff].x+17, - running[ff].y+24)) - { - sound(7177); -/* setcolor(4); - rectangle(x,y,x+7,y+10); - rectangle(running[ff].x,running[ff].y, - running[ff].x+17, - running[ff].y+24);*/ - nosound; - with.x=flag; - gain(-5); - define(running[ff].x+20,running[ff].y+3, - 34+Random(6),1,3,9,false,true); /* Oof! */ - define(with.x,with.y,83,1,0,17,false,true); /* Oops! */ - }} -} - -void escape_check() -{ - if (count321!=0) return; - if (escape_count>0) { escape_count -= 1; return; } - - /* Escape_count = 0; now what? */ - - if (escaping) - { - if (got_out) - { - new_escape(); escaping=false; - display_const(escape_stock*90+20,30,stocks+4); - } else - { - display_const(escape_stock*90+20,30,stocks+5); - escape_count=20; got_out=true; - define(escape_stock*90+20,50,25,0,2,17,false,true); /* Escaped! */ - gain(-10); - has_escaped[escape_stock]=true; - - how_many_have_escaped += 1; - - if (how_many_have_escaped == 7) - { - for( time1=0; time1 <= 1; time1 ++) - { - setactivepage(time1); - cleardevice(); - } - setactivepage(1-cp); - - memw[storage_seg*storage_ofs+1]=0; - do {; } while (!(memw[storage_seg*storage_ofs+1]>9)); - - setvisualpage(1-cp); - display(266,90,23); - - memw[storage_seg*storage_ofs+1]=0; - do {; } while (!(memw[storage_seg*storage_ofs+1]>72)); - - setvisualpage(cp); - - memw[storage_seg*storage_ofs+1]=0; - do {; } while (!(memw[storage_seg*storage_ofs+1]>9)); - - time1=0; - } - } - } else - { - escape_stock=get_stock_number(Random(7)); escaping=true; got_out=false; - display_const(escape_stock*90+20,30,stocks+2); /* Smiling! */ - escape_count=200; - } -} - -void check321() -{ - if (count321==0) return; - count321 -= 1; - switch (count321) { - case 84: define(320, 60,16, 2, 1,94,false,true); break; - case 169: define(320, 60,15, 0, 1,94,false,true); break; - case 254: { - define(320, 60,14,-2, 1,94,false,true); - define( 0,100,18, 2, 0,254,false,true); - } - break; - } +void move_avvy() { + if (avvywas < avvypos) { + /* bar(avvyWas,avvy_Y,avvyPos,Avvy_Y+85);*/ + avvyfacing = facing_right; + } else if (avvywas > avvypos) { + /* bar(avvyWas+32,Avvy_Y,avvyPos+33,Avvy_Y+85);*/ + avvyfacing = facing_left; + } + + if (! firing) { + if (avvywas == avvypos) + avvyanim = 1; + else { + avvyanim += 1; + if (avvyanim == 6) avvyanim = 0; + } + } + + if (avvyfacing == avvy_shoot) + define(avvypos, avvy_y, shooting[avvyanim], 0, 0, 1, false, true); + else + define(avvypos, avvy_y, avvyanim + avvyfacing, 0, 0, 1, false, true); + + avvywas = avvypos; + + if (avvyfacing == avvy_shoot) { + if (avvyanim == 6) { + avvyfacing = was_facing; + avvyanim = 0; + firing = false; + } else avvyanim += 1; + } +} + +void read_kbd() { + + if (firing) return; + + if ((shiftstate & 8) > 0) { + /* Alt - shoot */ + if ((alt_was_pressed_before) || (count321 != 0)) return; + alt_was_pressed_before = true; + firing = true; + define(avvypos + 27, avvy_y + 5, throw_next, 0, -2, 53, true, true); + throw_next += 1; + if (throw_next == 80) throw_next = 74; + avvyanim = 0; + was_facing = avvyfacing; + avvyfacing = avvy_shoot; + return; + } + + alt_was_pressed_before = false; + + if ((shiftstate & 1) > 0) { + /* Move right. */ + avvypos += 5; + if (avvypos > right_margin) avvypos = right_margin; + return; + } + + if ((shiftstate & 2) > 0) { + /* Move left. */ + avvypos -= 5; + if (avvypos < left_margin) avvypos = left_margin; + } + +} + +void animate() { + byte fv; + + if (Random(10) == 1) show_stock(get_stock_number(Random(6))); + for (fv = 0; fv <= 6; fv ++) + if (stockstatus[fv] > 5) { + stockstatus[fv] -= 1; + if (stockstatus[fv] == 8) { + stockstatus[fv] = 0; + show_stock(fv); + } + } +} + +void collision_check() { + byte fv; + integer dist_from_side; + byte this_stock; + + for (fv = 1; fv <= 100; fv ++) { + mtype &with = m[fv]; + if (with.x != flag) { + if ((with.missile) && (with.y < 60) && (with.timeout == 1)) { + /* sound(177); delay(1); nosound;*/ + dist_from_side = (with.x - 20) % 90; + this_stock = ((with.x - 20) / 90); + if ((! has_escaped[this_stock]) && + (dist_from_side > 17) && (dist_from_side < 34)) { + sound(999); + delay(3); + nosound; + define(with.x + 20, with.y, 26 + Random(2), 3, 1, 12, false, true); /* Well done! */ + define(this_stock * 90 + 20, 30, 31, 0, 0, 7, false, false); /* Face of man */ + define_cameo(this_stock * 90 + 20 + 10, 35, 40, 7); /* Splat! */ + define(this_stock * 90 + 20 + 20, 50, 34 + Random(5), 0, 2, 9, false, true); /* Oof! */ + stockstatus[this_stock] = 17; + gain(score_for_hitting_face); + + if ((escaping) && (escape_stock == this_stock)) { + /* Hit the escaper. */ + sound(1777); + delay(1); + nosound; + gain(bonus_for_hitting_escaper); + escaping = false; + new_escape(); + } + } else { + define(with.x, with.y, 83 + Random(3), 2, 2, 17, false, true); /* Missed! */ + if ((! has_escaped[this_stock]) && + ((dist_from_side > 3) && (dist_from_side < 43))) { + define(this_stock * 90 + 20, 30, 30, 0, 0, 7, false, false); /* Face of man */ + if (dist_from_side > 35) + define_cameo(with.x - 27, 35, 40, 7); /* Splat! */ + else + define_cameo(with.x - 7, 35, 40, 7); + stockstatus[this_stock] = 17; + } + } + } + } + } +} + +shortint sgn(integer a) { + shortint sgn_result; + if (a == 0) { + sgn_result = 0; + return sgn_result; + } + if (a > 0) { + sgn_result = 1; + return sgn_result; + } + sgn_result = -1; + return sgn_result; +} + +void turn_around(byte who, boolean randomx) { + { + A1 &with = running[who]; + + if (randomx) { + if (with.ix > 0) with.ix = -(Random(5) + 1); + else with.ix = (Random(5) + 1); + } else + with.ix = -with.ix; + with.iy = -with.iy; + } +} + +void bump_folk() { + byte fv, ff; + + for (fv = 1; fv <= maxrunners; fv ++) + if (running[fv].x != flag) + for (ff = fv + 1; ff <= maxrunners; ff ++) + if ((running[ff].x != flag) && + overlap(running[fv].x, running[fv].y, + running[fv].x + 17, running[fv].y + 24, + running[ff].x, running[ff].y, + running[ff].x + 17, running[ff].y + 24)) { + turn_around(fv, false); /* Opp. directions. */ + turn_around(ff, false); + } +} + +void people_running() { + byte fv; + + if (count321 != 0) return; + for (fv = 1; fv <= maxrunners; fv ++) { + A1 &with = running[fv]; + if (with.x != flag) { + if (((with.y + with.iy) <= 53) || ((with.y + with.iy) >= 120)) { + with.iy = -with.iy; + } + + if (with.ix < 0) + define(with.x, with.y, with.frame, 0, 0, 1, false, true); + else + define(with.x, with.y, with.frame + 7, 0, 0, 1, false, true); + if (with.framedelay == 0) { + with.frame += 1; + if (with.frame == with.toohigh) with.frame = with.lowest; + with.framedelay = framedelaymax; + with.y = with.y + with.iy; + } else with.framedelay -= 1; + + if (((with.x + with.ix) <= 0) || ((with.x + with.ix) >= 620)) turn_around(fv, true); + + with.x = with.x + with.ix; + } + } +} + +void update_time() { + if (count321 != 0) return; + time_this_second += 1; + if (time_this_second < times_a_second) return; + time1 -= 1; + show_time(); + time_this_second = 0; + if (time1 <= flash_time) + if (odd(time1)) display_const(110, 0, 20); /* Normal time */ + else display_const(110, 0, 86); /* Flash time */ +} + +void hit_people() { + byte fv, ff; + + if (count321 != 0) return; + for (fv = 1; fv <= 100; fv ++) { + mtype &with = m[fv]; + if (with.missile && (with.x != flag)) + for (ff = 1; ff <= maxrunners; ff ++) + if ((running[ff].x != flag) && + overlap(with.x, with.y, with.x + 7, with.y + 10, + running[ff].x, running[ff].y, + running[ff].x + 17, + running[ff].y + 24)) { + sound(7177); + /* setcolor(4); + rectangle(x,y,x+7,y+10); + rectangle(running[ff].x,running[ff].y, + running[ff].x+17, + running[ff].y+24);*/ + nosound; + with.x = flag; + gain(-5); + define(running[ff].x + 20, running[ff].y + 3, + 34 + Random(6), 1, 3, 9, false, true); /* Oof! */ + define(with.x, with.y, 83, 1, 0, 17, false, true); /* Oops! */ + } + } +} + +void escape_check() { + if (count321 != 0) return; + if (escape_count > 0) { + escape_count -= 1; + return; + } + + /* Escape_count = 0; now what? */ + + if (escaping) { + if (got_out) { + new_escape(); + escaping = false; + display_const(escape_stock * 90 + 20, 30, stocks + 4); + } else { + display_const(escape_stock * 90 + 20, 30, stocks + 5); + escape_count = 20; + got_out = true; + define(escape_stock * 90 + 20, 50, 25, 0, 2, 17, false, true); /* Escaped! */ + gain(-10); + has_escaped[escape_stock] = true; + + how_many_have_escaped += 1; + + if (how_many_have_escaped == 7) { + for (time1 = 0; time1 <= 1; time1 ++) { + setactivepage(time1); + cleardevice(); + } + setactivepage(1 - cp); + + memw[storage_seg * storage_ofs + 1] = 0; + do { + ; + } while (!(memw[storage_seg * storage_ofs + 1] > 9)); + + setvisualpage(1 - cp); + display(266, 90, 23); + + memw[storage_seg * storage_ofs + 1] = 0; + do { + ; + } while (!(memw[storage_seg * storage_ofs + 1] > 72)); + + setvisualpage(cp); + + memw[storage_seg * storage_ofs + 1] = 0; + do { + ; + } while (!(memw[storage_seg * storage_ofs + 1] > 9)); + + time1 = 0; + } + } + } else { + escape_stock = get_stock_number(Random(7)); + escaping = true; + got_out = false; + display_const(escape_stock * 90 + 20, 30, stocks + 2); /* Smiling! */ + escape_count = 200; + } +} + +void check321() { + if (count321 == 0) return; + count321 -= 1; + switch (count321) { + case 84: + define(320, 60, 16, 2, 1, 94, false, true); + break; + case 169: + define(320, 60, 15, 0, 1, 94, false, true); + break; + case 254: { + define(320, 60, 14, -2, 1, 94, false, true); + define(0, 100, 18, 2, 0, 254, false, true); + } + break; + } } void check_params(); -static void not_bootstrap() -{ - output << "This is not a standalone program!" << NL; - exit(255); +static void not_bootstrap() { + output << "This is not a standalone program!" << NL; + exit(255); } -void check_params() -{ - integer e; +void check_params() { + integer e; - if (paramstr(1)!="jsb") not_bootstrap(); + if (paramstr(1) != "jsb") not_bootstrap(); - val(paramstr(2),storage_seg,e); if (e!=0) not_bootstrap(); - val(paramstr(3),storage_ofs,e); if (e!=0) not_bootstrap(); + val(paramstr(2), storage_seg, e); + if (e != 0) not_bootstrap(); + val(paramstr(3), storage_ofs, e); + if (e != 0) not_bootstrap(); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - check_params(); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + check_params(); - titles(); - setup(); - init_runner( 20, 70,48,54, Random(5)+1,Random(4)-2); - init_runner(600, 70,48,54, Random(5)+1,Random(4)-2); - init_runner(600,100,61,67,-Random(5)+1,Random(4)-2); - init_runner( 20,100,61,67,-Random(5)+1,Random(4)-2); - do { - memw[storage_seg*storage_ofs+1]=0; + titles(); + setup(); + init_runner(20, 70, 48, 54, Random(5) + 1, Random(4) - 2); + init_runner(600, 70, 48, 54, Random(5) + 1, Random(4) - 2); + init_runner(600, 100, 61, 67, -Random(5) + 1, Random(4) - 2); + init_runner(20, 100, 61, 67, -Random(5) + 1, Random(4) - 2); + do { + memw[storage_seg * storage_ofs + 1] = 0; - blankit(); - hit_people(); - plotthem(); - movethem(); - move_avvy(); - bump_folk(); - people_running(); - animate(); - escape_check(); + blankit(); + hit_people(); + plotthem(); + movethem(); + move_avvy(); + bump_folk(); + people_running(); + animate(); + escape_check(); - collision_check(); + collision_check(); - update_time(); + update_time(); - check321(); + check321(); - read_kbd(); - flippage(); - do {; } while (!(memw[storage_seg*storage_ofs+1]>0)); + read_kbd(); + flippage(); + do { + ; + } while (!(memw[storage_seg * storage_ofs + 1] > 0)); - } while (!(time1==0)); + } while (!(time1 == 0)); -/* textmode(259); - textattr:=1; - writeln('Your final score was: ',score,'.'); - readln;*/ - mem[storage_seg*storage_ofs]=score; - return EXIT_SUCCESS; + /* textmode(259); + textattr:=1; + writeln('Your final score was: ',score,'.'); + readln;*/ + mem[storage_seg * storage_ofs] = score; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index 479f8c174a8a..931fbf05b699 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,87 +31,97 @@ namespace Avalanche { struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; -integer gd,gm; +integer gd, gm; untyped_file sf; longint id; word soa; adxtype a; byte xw; -array<5,2053,byte> mani; -matrix<0,35,0,4,byte> sil; -array<1,16000,byte> aa; +array<5, 2053, byte> mani; +matrix<0, 35, 0, 4, byte> sil; +array<1, 16000, byte> aa; untyped_file outfile; -void plotat(integer xx,integer yy) /* Does NOT cameo the picture!*/ -{ - word soaa; -; - move(mani,aa[5],sizeof(mani)); - {; - aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ - } - putimage(xx,yy,aa,0); - soaa=sizeof(mani); - blockwrite(outfile,soaa,2); - blockwrite(outfile,aa,sizeof(mani)); +void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ + word soaa; + ; + move(mani, aa[5], sizeof(mani)); + { + ; + aa[1] = a.xl; + aa[2] = 0; + aa[3] = a.yl; + aa[4] = 0; /* set up x&y codes */ + } + putimage(xx, yy, aa, 0); + soaa = sizeof(mani); + blockwrite(outfile, soaa, 2); + blockwrite(outfile, aa, sizeof(mani)); } const integer shouldid = -1317732048; void explode(byte which) /* 0 is the first one! */ - /* Each character takes five-quarters of (a.size-6) on disk. */ +/* Each character takes five-quarters of (a.size-6) on disk. */ { - byte fv,ff; word so1; /* size of one */ -; - {; - so1=a.size-6; so1 += so1 / 4; - seek(sf,183+soa+so1*which); /* First is at 221 */ -/* where:=filepos(sf);*/ - xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; - - for( fv=0; fv <= a.yl; fv ++) - blockread(sf,sil[fv],xw); - blockread(sf,mani,a.size-6); - aa[a.size-1]=0; aa[a.size]=0; /* footer */ - } - plotat(100,100); - delay(100); + byte fv, ff; + word so1; /* size of one */ + ; + { + ; + so1 = a.size - 6; + so1 += so1 / 4; + seek(sf, 183 + soa + so1 * which); /* First is at 221 */ + /* where:=filepos(sf);*/ + xw = a.xl / 8; + if ((a.xl % 8) > 0) xw += 1; + + for (fv = 0; fv <= a.yl; fv ++) + blockread(sf, sil[fv], xw); + blockread(sf, mani, a.size - 6); + aa[a.size - 1] = 0; + aa[a.size] = 0; /* footer */ + } + plotat(100, 100); + delay(100); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); - assign(outfile,"notts.avd"); - reset(outfile,1); - seek(outfile,filesize(outfile)); + assign(outfile, "notts.avd"); + reset(outfile, 1); + seek(outfile, filesize(outfile)); - assign(sf,"sprite0.avd"); - reset(sf,1); + assign(sf, "sprite0.avd"); + reset(sf, 1); - seek(sf,177); - blockread(sf,id,4); - blockread(sf,soa,2); - blockread(sf,a,soa); + seek(sf, 177); + blockread(sf, id, 4); + blockread(sf, soa, 2); + blockread(sf, a, soa); - explode(1); - for( gd=6; gd <= 11; gd ++) explode(gd); - for( gd=18; gd <= 23; gd ++) explode(gd); + explode(1); + for (gd = 6; gd <= 11; gd ++) explode(gd); + for (gd = 18; gd <= 23; gd ++) explode(gd); - close(sf); - close(outfile); -return EXIT_SUCCESS; + close(sf); + close(outfile); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp index e3261d7c1eb5..d0f88a1e85c2 100644 --- a/engines/avalanche/sez.cpp +++ b/engines/avalanche/sez.cpp @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 4ec0bf37b017..73f5be19cf2b 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,400 +34,489 @@ namespace Avalanche { const char marker = '\33'; const char game[] = "Avalot"; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; struct markertype { - word length; - longint offset; - byte checksum; + word length; + longint offset; + byte checksum; }; struct sezheader { - array<1,2,char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ + array<1, 2, char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ }; -array<0,1999,char> buffer,was; -word bufpos,bufsize; +array<0, 1999, char> buffer, was; +word bufpos, bufsize; longint chainnum; varying_string<40> nickname; -array<1,255,char> junk; +array<1, 255, char> junk; string temp; char r; fonttype font; integer cpos; sezheader sezhead; -untyped_file f,tempf; +untyped_file f, tempf; text nicknames; -byte sumup() -{ - word fv; byte total; -byte sumup_result; -; - total=0; - for( fv=0; fv <= bufsize-1; fv ++) - {; - total += ord(was[fv]); - } - sumup_result=total; -return sumup_result; +byte sumup() { + word fv; + byte total; + byte sumup_result; + ; + total = 0; + for (fv = 0; fv <= bufsize - 1; fv ++) { + ; + total += ord(was[fv]); + } + sumup_result = total; + return sumup_result; } -string findname(longint which) -{ - string x; varying_string<10> q; -string findname_result; -; - str(which,q); - reset(nicknames); - do { nicknames >> x >> NL; } while (!(x=="{go}")); - do { - nicknames >> x >> NL; - } while (!(pos(q,x)>0)); - if (eof(nicknames)) - {; - findname_result="noname"; - } else - {; - Delete(x,1,3); /* lose "{__" */ - Delete(x,pos(" ",x),255); /* lose all chars after first space */ - findname_result=x; - } - close(nicknames); -return findname_result; +string findname(longint which) { + string x; + varying_string<10> q; + string findname_result; + ; + str(which, q); + reset(nicknames); + do { + nicknames >> x >> NL; + } while (!(x == "{go}")); + do { + nicknames >> x >> NL; + } while (!(pos(q, x) > 0)); + if (eof(nicknames)) { + ; + findname_result = "noname"; + } else { + ; + Delete(x, 1, 3); /* lose "{__" */ + Delete(x, pos(" ", x), 255); /* lose all chars after first space */ + findname_result = x; + } + close(nicknames); + return findname_result; } -void cursor() -{ - byte fv; -; - for( fv=12; fv <= 15; fv ++) - mem[0xa000*cpos+fv*80]=~(mem[0xa000*cpos+fv*80]); +void cursor() { + byte fv; + ; + for (fv = 12; fv <= 15; fv ++) + mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); } -void xy() -{; - cpos=(bufpos / 80)*1280+(bufpos % 80); +void xy() { + ; + cpos = (bufpos / 80) * 1280 + (bufpos % 80); } -void show() -{ - word fv,orig,y; -; - for( fv=0; fv <= 1999; fv ++) - if (buffer[fv]!=was[fv]) - {; - orig=(fv / 80)*1280+(fv % 80); - for( y=0; y <= 15; y ++) - mem[0xa000*orig+y*80]=(byte)(font[buffer[fv]][y]); - } - xy(); - move(buffer,was,sizeof(buffer)); +void show() { + word fv, orig, y; + ; + for (fv = 0; fv <= 1999; fv ++) + if (buffer[fv] != was[fv]) { + ; + orig = (fv / 80) * 1280 + (fv % 80); + for (y = 0; y <= 15; y ++) + mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); + } + xy(); + move(buffer, was, sizeof(buffer)); } -void sizeup() -{; - do { - switch (buffer[bufsize]) { - case marker: return; break; /* we've found it OK! */ - case '\0': bufsize -= 1; break; - default: bufsize += 1; - } - } while (!false); +void sizeup() { + ; + do { + switch (buffer[bufsize]) { + case marker: + return; + break; /* we've found it OK! */ + case '\0': + bufsize -= 1; + break; + default: + bufsize += 1; + } + } while (!false); } -void graphics() -{ - integer gd,gm; - file fontfile; -; - gd=3; gm=1; initgraph(gd,gm,""); - assign(fontfile,"c:\\thomas\\lanche.fnt"); - reset(fontfile); fontfile >> font; close(fontfile); +void graphics() { + integer gd, gm; + file fontfile; + ; + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + assign(fontfile, "c:\\thomas\\lanche.fnt"); + reset(fontfile); + fontfile >> font; + close(fontfile); } void edit_it(); -static void legit(char r) -{; /* it's a legit keystroke */ - move(buffer[bufpos],buffer[bufpos+1],1999-bufpos); - buffer[bufpos]=r; - bufpos += 1; show(); +static void legit(char r) { + ; /* it's a legit keystroke */ + move(buffer[bufpos], buffer[bufpos + 1], 1999 - bufpos); + buffer[bufpos] = r; + bufpos += 1; + show(); } -void edit_it() -{ - byte fv; -; - for( fv=1; fv <= bufsize; fv ++) buffer[fv] -= (byte)(177*bufsize); - fillchar(was,sizeof(was),'\0'); show(); - do { - cursor(); r=readkey(); cursor(); - switch (r) { - case '\0': switch (readkey()) { /* extd keystrokes */ - case 'K': if (bufpos>0) {; bufpos -= 1; xy(); } break; /* Left */ - case 'M': if (bufpos80) {; bufpos -= 80; xy(); } break; /* Up */ - case 'P': if (bufpos<(cardinal)bufsize-79) {; bufpos += 80; xy(); } break; /* Down */ - case 'G': {; bufpos=0; xy(); } break; /* Home */ - case 'O': {; bufpos=bufsize; xy(); } break; /* End */ - case 'S': {; /* Del */ - move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); show(); - } - break; - case 'A': legit('\357'); break; /* copyright symbol */ - } - break; - case '\10': if (bufpos>0) {; /* backspace */ - bufpos -= 1; - move(buffer[bufpos+1],buffer[bufpos],1999-bufpos); - show(); - } - break; - case '\33': {; - for( fv=1; fv <= bufsize; fv ++) buffer[fv] += (byte)(177*bufsize); - restorecrtmode(); - return; - } - break; /* end of editing */ - default: legit(r); - } - sizeup(); - } while (!false); +void edit_it() { + byte fv; + ; + for (fv = 1; fv <= bufsize; fv ++) buffer[fv] -= (byte)(177 * bufsize); + fillchar(was, sizeof(was), '\0'); + show(); + do { + cursor(); + r = readkey(); + cursor(); + switch (r) { + case '\0': + switch (readkey()) { /* extd keystrokes */ + case 'K': + if (bufpos > 0) { + ; + bufpos -= 1; + xy(); + } + break; /* Left */ + case 'M': + if (bufpos < bufsize) { + ; + bufpos += 1; + xy(); + } + break; /* Right */ + case 'H': + if (bufpos > 80) { + ; + bufpos -= 80; + xy(); + } + break; /* Up */ + case 'P': + if (bufpos < (cardinal)bufsize - 79) { + ; + bufpos += 80; + xy(); + } + break; /* Down */ + case 'G': { + ; + bufpos = 0; + xy(); + } + break; /* Home */ + case 'O': { + ; + bufpos = bufsize; + xy(); + } + break; /* End */ + case 'S': { + ; /* Del */ + move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); + show(); + } + break; + case 'A': + legit('\357'); + break; /* copyright symbol */ + } + break; + case '\10': + if (bufpos > 0) { + ; /* backspace */ + bufpos -= 1; + move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); + show(); + } + break; + case '\33': { + ; + for (fv = 1; fv <= bufsize; fv ++) buffer[fv] += (byte)(177 * bufsize); + restorecrtmode(); + return; + } + break; /* end of editing */ + default: + legit(r); + } + sizeup(); + } while (!false); } -void saveit(longint ourchain, word oldsize,word newsize) -{ - array<1,17777,byte> buffer; - word numread,numwritten,total; - char check; - word fv; - markertype m; - integer sizechange; /* so's it can be +ve or -ve */ - longint wheresit; /* "offset" value for "ourchain" */ -; - assign(tempf,"sez.tmp"); - /* OK, here goes... */ - sezhead.size=sezhead.size-longint(oldsize)+longint(newsize); /* adjust our size */ - sizechange=newsize-oldsize; /* +ve if bigger, -ve if smaller, 0 if same */ - textattr=27; - - rewrite(tempf,1); reset(f,1); - seek(f,255+sizeof(sezhead)); /* bypass the junk & sezhead (they're in RAM) */ - - blockwrite(tempf,junk,255); /* move the junk... */ - blockwrite(tempf,sezhead,sizeof(sezhead)); /* and the header to new files */ - - /* Now to move the markers */ - output << "Moving markers..." << NL; - for( fv=1; fv <= sezhead.chains; fv ++) - {; - output << fv << '\15'; - blockread(f,m,sizeof(m)); - if (fv==ourchain) /* Right, this one's ours! */ - {; - wheresit=m.offset; /* recorded for later */ - m.length=newsize-1; - m.checksum=sumup(); - } else - if (fv>ourchain) - {; /* After ours- its offset will have to be changed... */ - m.offset=m.offset+longint(sizechange); - } /* Otherwise, before ours- leave it well alone */ - blockwrite(tempf,m,sizeof(m)); - } - output << "Done OK." << NL; - - /* Right, that's the markers done... thank goodness... now it's just the - chains themselves! */ - - total=0; - - output << "Updating the chains..." << NL; - while (total<=wheresit) - {; - blockread(f,buffer,1,numread); - blockwrite(tempf,buffer,numread,numwritten); - output << '.'; - total += numwritten; - } - output << NL; output << "Updating our chain..." << NL; - /* We're now in the right place (at last...) */ - for( fv=0; fv <= (bufsize-1); fv ++) was[fv] += 3+177*fv*(bufsize-1); /* scramble "was" */ - blockwrite(tempf,was,newsize); /* "was" contains what the values *were* */ - seek(f,filepos(f)+oldsize); - output << NL; output << "Copying everything else..." << NL; - while (! eof(f)) /* high-speed copy */ - {; - blockread(f,buffer,17777,numread); - blockwrite(tempf,buffer,numread); - output << '.'; - } - output << NL; - - /* Closedown */ - close(f); close(tempf); - erase(f); rename(tempf,string(game)+".SEZ"); +void saveit(longint ourchain, word oldsize, word newsize) { + array<1, 17777, byte> buffer; + word numread, numwritten, total; + char check; + word fv; + markertype m; + integer sizechange; /* so's it can be +ve or -ve */ + longint wheresit; /* "offset" value for "ourchain" */ + ; + assign(tempf, "sez.tmp"); + /* OK, here goes... */ + sezhead.size = sezhead.size - longint(oldsize) + longint(newsize); /* adjust our size */ + sizechange = newsize - oldsize; /* +ve if bigger, -ve if smaller, 0 if same */ + textattr = 27; + + rewrite(tempf, 1); + reset(f, 1); + seek(f, 255 + sizeof(sezhead)); /* bypass the junk & sezhead (they're in RAM) */ + + blockwrite(tempf, junk, 255); /* move the junk... */ + blockwrite(tempf, sezhead, sizeof(sezhead)); /* and the header to new files */ + + /* Now to move the markers */ + output << "Moving markers..." << NL; + for (fv = 1; fv <= sezhead.chains; fv ++) { + ; + output << fv << '\15'; + blockread(f, m, sizeof(m)); + if (fv == ourchain) { /* Right, this one's ours! */ + ; + wheresit = m.offset; /* recorded for later */ + m.length = newsize - 1; + m.checksum = sumup(); + } else if (fv > ourchain) { + ; /* After ours- its offset will have to be changed... */ + m.offset = m.offset + longint(sizechange); + } /* Otherwise, before ours- leave it well alone */ + blockwrite(tempf, m, sizeof(m)); + } + output << "Done OK." << NL; + + /* Right, that's the markers done... thank goodness... now it's just the + chains themselves! */ + + total = 0; + + output << "Updating the chains..." << NL; + while (total <= wheresit) { + ; + blockread(f, buffer, 1, numread); + blockwrite(tempf, buffer, numread, numwritten); + output << '.'; + total += numwritten; + } + output << NL; + output << "Updating our chain..." << NL; + /* We're now in the right place (at last...) */ + for (fv = 0; fv <= (bufsize - 1); fv ++) was[fv] += 3 + 177 * fv * (bufsize - 1); /* scramble "was" */ + blockwrite(tempf, was, newsize); /* "was" contains what the values *were* */ + seek(f, filepos(f) + oldsize); + output << NL; + output << "Copying everything else..." << NL; + while (! eof(f)) { /* high-speed copy */ + ; + blockread(f, buffer, 17777, numread); + blockwrite(tempf, buffer, numread); + output << '.'; + } + output << NL; + + /* Closedown */ + close(f); + close(tempf); + erase(f); + rename(tempf, string(game) + ".SEZ"); } -void particular() -{ - word origsize; -; - bufsize=0; - output << "Which one\? (? for a list)"; input >> chainnum >> NL; - if ((chainnum<0) || (chainnum>sezhead.chains)) - {; - output << "Don't be silly!" << NL; return; - } - - origsize=0 /*bufsize*/; bufpos=0; cpos=0; nickname=findname(chainnum); - fillchar(buffer,sizeof(buffer),'\0'); - buffer[0]=marker; - do { - textattr=30; output << NL; - output << "SEZ EDITOR (c) 1992, Thomas Thurman." << NL; - output << NL; - output << "Editing scrollchain no." << chainnum << NL; - output << "Your text is " << bufsize << " bytes long." << NL; - output << NL; - output << "Its nickname is \"" << nickname << "\"." << NL; - output << NL; - output << "Enter a command:" << NL; - output << " S) Save the text to disk," << NL; - output << " E) Edit this particular chain," << NL; - output << " N) change the Nickname," << NL; - output << " R) Revert text to the original," << NL; - output << "Esc) Exit and do something else!" << NL; - output << NL; - output << "Your choice? "; - r=upcase(readkey()); output << r << NL; - switch (r) { - case 'N': {; - output << NL; output << "New nickname (max 40 chars, Enter to cancel)?"; - input >> temp >> NL; - if (temp!="") nickname=temp; - } - break; - case 'E': {; setgraphmode(1); edit_it(); } break; - case 'S': saveit(chainnum,origsize,bufsize); break; - case '\33': return; break; - } - } while (!false); +void particular() { + word origsize; + ; + bufsize = 0; + output << "Which one\? (? for a list)"; + input >> chainnum >> NL; + if ((chainnum < 0) || (chainnum > sezhead.chains)) { + ; + output << "Don't be silly!" << NL; + return; + } + + origsize = 0 /*bufsize*/; + bufpos = 0; + cpos = 0; + nickname = findname(chainnum); + fillchar(buffer, sizeof(buffer), '\0'); + buffer[0] = marker; + do { + textattr = 30; + output << NL; + output << "SEZ EDITOR (c) 1992, Thomas Thurman." << NL; + output << NL; + output << "Editing scrollchain no." << chainnum << NL; + output << "Your text is " << bufsize << " bytes long." << NL; + output << NL; + output << "Its nickname is \"" << nickname << "\"." << NL; + output << NL; + output << "Enter a command:" << NL; + output << " S) Save the text to disk," << NL; + output << " E) Edit this particular chain," << NL; + output << " N) change the Nickname," << NL; + output << " R) Revert text to the original," << NL; + output << "Esc) Exit and do something else!" << NL; + output << NL; + output << "Your choice? "; + r = upcase(readkey()); + output << r << NL; + switch (r) { + case 'N': { + ; + output << NL; + output << "New nickname (max 40 chars, Enter to cancel)?"; + input >> temp >> NL; + if (temp != "") nickname = temp; + } + break; + case 'E': { + ; + setgraphmode(1); + edit_it(); + } + break; + case 'S': + saveit(chainnum, origsize, bufsize); + break; + case '\33': + return; + break; + } + } while (!false); } -void titles() -{ - const varying_string<7> title = "SEZedit"; - byte fv; char r; -; - settextstyle(1,0,0); - for( fv=7; fv >= 1; fv --) - {; - setcolor(fv*2); - setusercharsize(8-fv,1,8-fv,1); - outtextxy(fv*65,fv*40-30,title[fv-1]); - } - setusercharsize(17,7,1,1); setcolor(green); - outtextxy(300,10,"Thorsoft"); - outtextxy(10,310,"Press any key..."); - do { r=readkey(); } while (!(! keypressed())); - restorecrtmode(); textattr=30; clrscr; +void titles() { + const varying_string<7> title = "SEZedit"; + byte fv; + char r; + ; + settextstyle(1, 0, 0); + for (fv = 7; fv >= 1; fv --) { + ; + setcolor(fv * 2); + setusercharsize(8 - fv, 1, 8 - fv, 1); + outtextxy(fv * 65, fv * 40 - 30, title[fv - 1]); + } + setusercharsize(17, 7, 1, 1); + setcolor(green); + outtextxy(300, 10, "Thorsoft"); + outtextxy(10, 310, "Press any key..."); + do { + r = readkey(); + } while (!(! keypressed())); + restorecrtmode(); + textattr = 30; + clrscr; } -void addone() /* Adds a new, empty chain to the end of the list. */ -{ - longint fv; - markertype m; - array<1,17777,byte> buffer; - word numread; -; - assign(tempf,"sez.tmp"); - textattr=27; - rewrite(tempf,1); reset(f,1); /* f = AVALOT.SEZ (original file) */ - seek(f,255+sizeof(sezhead)); - sezhead.chains += 1; /* we're adding a new chain */ - - blockwrite(tempf,junk,255); /* move the junk */ - blockwrite(tempf,sezhead,sizeof(sezhead)); /* move the header */ - - /* Now to move the markers */ - output << "Moving markers..." << NL; - for( fv=1; fv <= sezhead.chains-longint(1); fv ++) /* -1 because we've added 1 to it */ - {; - output << fv << '\12'; - blockread(f,m,sizeof(m)); - blockwrite(tempf,m,sizeof(m)); - } - output << "Done OK." << NL; - /* Now we add a new marker onto the end! */ - {; - m.offset=sezhead.size; /* right onto the end */ - m.length=0; /* it's empty */ - } - blockwrite(tempf,m,sizeof(m)); /* write it out to disk */ - - /* Copy everything else... including the #177 check char */ - output << "Copying everything else over..." << NL; - while (! eof(f)) - {; - blockread(f,buffer,17777,numread); - blockwrite(tempf,buffer,numread); - output << '.'; - } - output << NL; - close(f); close(tempf); - erase(f); rename(tempf,string(game)+".SEZ"); +void addone() { /* Adds a new, empty chain to the end of the list. */ + longint fv; + markertype m; + array<1, 17777, byte> buffer; + word numread; + ; + assign(tempf, "sez.tmp"); + textattr = 27; + rewrite(tempf, 1); + reset(f, 1); /* f = AVALOT.SEZ (original file) */ + seek(f, 255 + sizeof(sezhead)); + sezhead.chains += 1; /* we're adding a new chain */ + + blockwrite(tempf, junk, 255); /* move the junk */ + blockwrite(tempf, sezhead, sizeof(sezhead)); /* move the header */ + + /* Now to move the markers */ + output << "Moving markers..." << NL; + for (fv = 1; fv <= sezhead.chains - longint(1); fv ++) { /* -1 because we've added 1 to it */ + ; + output << fv << '\12'; + blockread(f, m, sizeof(m)); + blockwrite(tempf, m, sizeof(m)); + } + output << "Done OK." << NL; + /* Now we add a new marker onto the end! */ + { + ; + m.offset = sezhead.size; /* right onto the end */ + m.length = 0; /* it's empty */ + } + blockwrite(tempf, m, sizeof(m)); /* write it out to disk */ + + /* Copy everything else... including the #177 check char */ + output << "Copying everything else over..." << NL; + while (! eof(f)) { + ; + blockread(f, buffer, 17777, numread); + blockwrite(tempf, buffer, numread); + output << '.'; + } + output << NL; + close(f); + close(tempf); + erase(f); + rename(tempf, string(game) + ".SEZ"); } -void general() -{ - char r; -; - do { - textattr=31; - output << NL; output << string(game)+".SEZ" << NL; - output << NL; - output << "No. of chains: " << sezhead.chains << NL; - output << NL; - output << "Choose one of these:" << NL; - output << " A) Add a new scrollchain" << NL; - output << " E) Edit one" << NL; - output << "Esc) Exit" << NL; - output << NL; - output << "Your choice? "; - r=upcase(readkey()); output << r << NL; - switch (r) { - case 'A': addone(); break; - case 'E': particular(); break; - case '\33': exit(0); break; - } - } while (!false); +void general() { + char r; + ; + do { + textattr = 31; + output << NL; + output << string(game) + ".SEZ" << NL; + output << NL; + output << "No. of chains: " << sezhead.chains << NL; + output << NL; + output << "Choose one of these:" << NL; + output << " A) Add a new scrollchain" << NL; + output << " E) Edit one" << NL; + output << "Esc) Exit" << NL; + output << NL; + output << "Your choice? "; + r = upcase(readkey()); + output << r << NL; + switch (r) { + case 'A': + addone(); + break; + case 'E': + particular(); + break; + case '\33': + exit(0); + break; + } + } while (!false); } -void loadit() -{; - reset(f,1); - blockread(f,junk,255); - blockread(f,sezhead,sizeof(sezhead)); - close(f); +void loadit() { + ; + reset(f, 1); + blockread(f, junk, 255); + blockread(f, sezhead, sizeof(sezhead)); + close(f); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - assign(f,string(game)+".SEZ"); - assign(tempf,"sez.tmp"); - assign(nicknames,string(game)+".NIK"); - loadit(); - graphics(); - titles(); - general(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + assign(f, string(game) + ".SEZ"); + assign(tempf, "sez.tmp"); + assign(nicknames, string(game) + ".NIK"); + loadit(); + graphics(); + titles(); + general(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index e9dda1326719..fa7bbb8c797a 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,9 +33,9 @@ namespace Avalanche { struct markertype { - word length; - longint offset; - byte checksum; + word length; + longint offset; + byte checksum; }; untyped_file f; @@ -44,60 +44,69 @@ markertype marker; word fv; byte sum; -void sez_setup() /* This procedure sets up the Sez system (obviously!) */ -{; - - /* Set up variables */ - - fillchar(chain,sizeof(chain),'\261'); /* blank out gunk in "chain" */ - chainsize=0; /* it's empty (for now...) */ - sezerror=sezok; /* everything's fine! */ - - /* Set up AVALOT.SEZ */ - - assign(f,"avalot.sez"); reset(f,1); - seek(f,255); blockread(f,sezhead,sizeof(sezhead)); - if (ioresult!=0) {; sezerror=sezgunkyfile; return; } /* too short */ - {; - if ((sezhead.initials!="TT") || (sezhead.gamecode!=thisgamecode) - || (sezhead.revision!=thisvercode)) - {; - sezerror=sezgunkyfile; /* not a valid file */ - return; - } - } +void sez_setup() { /* This procedure sets up the Sez system (obviously!) */ + ; + + /* Set up variables */ + + fillchar(chain, sizeof(chain), '\261'); /* blank out gunk in "chain" */ + chainsize = 0; /* it's empty (for now...) */ + sezerror = sezok; /* everything's fine! */ + + /* Set up AVALOT.SEZ */ + + assign(f, "avalot.sez"); + reset(f, 1); + seek(f, 255); + blockread(f, sezhead, sizeof(sezhead)); + if (ioresult != 0) { + ; /* too short */ + sezerror = sezgunkyfile; + return; + } + { + ; + if ((sezhead.initials != "TT") || (sezhead.gamecode != thisgamecode) + || (sezhead.revision != thisvercode)) { + ; + sezerror = sezgunkyfile; /* not a valid file */ + return; + } + } } -byte sumup() -{ - word fv; byte total; -byte sumup_result; -; - total=0; - for( fv=0; fv <= chainsize; fv ++) - {; - total += ord(chain[fv]); - } - sumup_result=total; -return sumup_result; +byte sumup() { + word fv; + byte total; + byte sumup_result; + ; + total = 0; + for (fv = 0; fv <= chainsize; fv ++) { + ; + total += ord(chain[fv]); + } + sumup_result = total; + return sumup_result; } -void getchain(longint number) -{; - seek(f,longint(262)+number*longint(7)); blockread(f,marker,7); - {; - seek(f,longint(270)+sezhead.chains*longint(7)+marker.offset); - blockread(f,chain,marker.length+1); - for( fv=0; fv <= marker.length; fv ++) chain[fv] -= 3+177*fv*marker.length; /* unscramble */ - chainsize=marker.length; - if (sumup()!=marker.checksum) - {; - sezerror=sezhacked; - return; - } - } - close(f); - sezerror=sezok; /* nowt went wrong */ +void getchain(longint number) { + ; + seek(f, longint(262) + number * longint(7)); + blockread(f, marker, 7); + { + ; + seek(f, longint(270) + sezhead.chains * longint(7) + marker.offset); + blockread(f, chain, marker.length + 1); + for (fv = 0; fv <= marker.length; fv ++) chain[fv] -= 3 + 177 * fv * marker.length; /* unscramble */ + chainsize = marker.length; + if (sumup() != marker.checksum) { + ; + sezerror = sezhacked; + return; + } + } + close(f); + sezerror = sezok; /* nowt went wrong */ } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h index fa1f750b0a99..5f067e537ef6 100644 --- a/engines/avalanche/sezunit.h +++ b/engines/avalanche/sezunit.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,11 +34,11 @@ namespace Avalanche { struct sezheader { - array<1,2,char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ + array<1, 2, char> initials; /* should be "TT" */ + word gamecode; + word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ + longint chains; /* number of scroll chains */ + longint size; /* total size of all chains */ }; @@ -48,7 +48,7 @@ struct sezheader { #define EXTERN #endif -EXTERN array<0,1999,char> chain; /* This chain */ +EXTERN array<0, 1999, char> chain; /* This chain */ EXTERN word chainsize; /* Length of "chain" */ EXTERN byte sezerror; /* Error code */ EXTERN sezheader sezhead; @@ -56,7 +56,7 @@ EXTERN sezheader sezhead; #define EXTERN extern - /* Error codes for "sezerror" */ +/* Error codes for "sezerror" */ const integer sezok = 0; const integer sezgunkyfile = 1; const integer sezhacked = 2; diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 3c2cff62f592..7d56e668fec9 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -26,99 +26,123 @@ */ /*#include "Crt.h"*/ - /*$V-*/ +/*$V-*/ namespace Avalanche { text t; string x; -matrix<1,100,1,2,string> data; -word dp,ip,fv; -array<1,20,word> index1; -array<1,20,varying_string<10> > names; -array<1,1777,longint> thumb; longint total; +matrix<1, 100, 1, 2, string> data; +word dp, ip, fv; +array<1, 20, word> index1; +array<1, 20, varying_string<10> > names; +array<1, 1777, longint> thumb; +longint total; untyped_file f; -void strip() {; x=copy(x,2,255); } - -void squish(string& q) -{ - string n; boolean ctrl; byte fv; -; - ctrl=false; n=""; - for( fv=1; fv <= length(q); fv ++) - if (q[fv]=='^') ctrl=true; else - {; /* not a caret */ - if (ctrl) q[fv]=chr(ord(upcase(q[fv]))-64); - n=n+q[fv]; ctrl=false; - } - while (n[length(n)]=='\40') n[0] -= 1; /* strip trailing spaces */ - for( fv=1; fv <= length(n); fv ++) n[fv] += 177; /* scramble */ - q=n; +void strip() { + ; + x = copy(x, 2, 255); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - dp=0; ip=0; fillchar(data,sizeof(data),'\0'); - fillchar(thumb,sizeof(thumb),'\261'); - fillchar(index1,sizeof(index1),'\3'); - assign(t,"v:sez.dat"); reset(t); - while (! eof(t)) - {; - t >> x >> NL; - switch (x[1]) { - case ';': {; textattr=lightred; strip(); } break; - case ':': {; - textattr=lightblue; strip(); - if (dp>0) squish(data[dp][2]); - dp += 1; data[dp][1]=x; - if (pos("*",x)>0) - {; /* index */ - ip += 1; index1[ip]=dp; names[ip]=copy(x,1,pos("*",x)-1); - } - } - break; - default: - {; - textattr=white; - data[dp][2]=data[dp][2]+x+'\40'; - } - } - output << x << NL; - } - squish(data[dp][2]); - - total=1; - for( fv=1; fv <= dp; fv ++) - {; - thumb[fv]=total; - total += length(data[fv][2])+1; - } - - thumb[dp+1]=total; - - /* save it all! Firstly, the Sez file... */ - - assign(f,"v:avalot.sez"); rewrite(f,1); - x=string("This is a Sez file for an Avvy game, and it's copyright!")+'\32'; - blockwrite(f,x[1],57); - blockwrite(f,dp,2); blockwrite(f,ip,2); - blockwrite(f,index1,40); - blockwrite(f,thumb,dp*4+4); - for( fv=1; fv <= dp; fv ++) - blockwrite(f,data[fv][2],length(data[fv][2])+1); - close(f); - - /* ...then the Sed file. */ - - assign(t,"v:avalot.sed"); rewrite(t); - for( fv=1; fv <= ip; fv ++) t << names[fv] << NL; - for( fv=1; fv <= dp; fv ++) t << data[fv][1] << NL; - close(t); - - /* Done! */ -return EXIT_SUCCESS; +void squish(string &q) { + string n; + boolean ctrl; + byte fv; + ; + ctrl = false; + n = ""; + for (fv = 1; fv <= length(q); fv ++) + if (q[fv] == '^') ctrl = true; + else { + ; /* not a caret */ + if (ctrl) q[fv] = chr(ord(upcase(q[fv])) - 64); + n = n + q[fv]; + ctrl = false; + } + while (n[length(n)] == '\40') n[0] -= 1; /* strip trailing spaces */ + for (fv = 1; fv <= length(n); fv ++) n[fv] += 177; /* scramble */ + q = n; +} + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + dp = 0; + ip = 0; + fillchar(data, sizeof(data), '\0'); + fillchar(thumb, sizeof(thumb), '\261'); + fillchar(index1, sizeof(index1), '\3'); + assign(t, "v:sez.dat"); + reset(t); + while (! eof(t)) { + ; + t >> x >> NL; + switch (x[1]) { + case ';': { + ; + textattr = lightred; + strip(); + } + break; + case ':': { + ; + textattr = lightblue; + strip(); + if (dp > 0) squish(data[dp][2]); + dp += 1; + data[dp][1] = x; + if (pos("*", x) > 0) { + ; /* index */ + ip += 1; + index1[ip] = dp; + names[ip] = copy(x, 1, pos("*", x) - 1); + } + } + break; + default: { + ; + textattr = white; + data[dp][2] = data[dp][2] + x + '\40'; + } + } + output << x << NL; + } + squish(data[dp][2]); + + total = 1; + for (fv = 1; fv <= dp; fv ++) { + ; + thumb[fv] = total; + total += length(data[fv][2]) + 1; + } + + thumb[dp + 1] = total; + + /* save it all! Firstly, the Sez file... */ + + assign(f, "v:avalot.sez"); + rewrite(f, 1); + x = string("This is a Sez file for an Avvy game, and it's copyright!") + '\32'; + blockwrite(f, x[1], 57); + blockwrite(f, dp, 2); + blockwrite(f, ip, 2); + blockwrite(f, index1, 40); + blockwrite(f, thumb, dp * 4 + 4); + for (fv = 1; fv <= dp; fv ++) + blockwrite(f, data[fv][2], length(data[fv][2]) + 1); + close(f); + + /* ...then the Sed file. */ + + assign(t, "v:avalot.sed"); + rewrite(t); + for (fv = 1; fv <= ip; fv ++) t << names[fv] << NL; + for (fv = 1; fv <= dp; fv ++) t << data[fv][1] << NL; + close(t); + + /* Done! */ + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index 1618174fe4a0..358f679e61df 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,34 +31,35 @@ namespace Avalanche { struct infotype { - matrix<128,255,1,8,byte> chars; - string data; + matrix<128, 255, 1, 8, byte> chars; + string data; }; infotype table; pointer where; string comspec; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1f,where); move(where,table,1280); - comspec=getenv("comspec"); - table.data=table.data+"Avalot;"; - setintvec(0x1f,&table); - output << NL; - output << "The Astounding Avvy DOS Shell... don't forget to register!" << NL; - output << NL; - output << "Use the command EXIT to return to your game." << NL; - output << NL; - output << "Remember: You *mustn't* load any TSRs while in this DOS shell." << NL; - output << NL; - output << "This includes: GRAPHICS, PRINT, DOSKEY, and pop-up programs (like Sidekick.)" << NL; - output << NL; - output << "About to execute \"" << comspec << "\"..." << NL; - swapvectors; - exec("c:\\command.com",""); - swapvectors; - setintvec(0x1f,where); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1f, where); + move(where, table, 1280); + comspec = getenv("comspec"); + table.data = table.data + "Avalot;"; + setintvec(0x1f, &table); + output << NL; + output << "The Astounding Avvy DOS Shell... don't forget to register!" << NL; + output << NL; + output << "Use the command EXIT to return to your game." << NL; + output << NL; + output << "Remember: You *mustn't* load any TSRs while in this DOS shell." << NL; + output << NL; + output << "This includes: GRAPHICS, PRINT, DOSKEY, and pop-up programs (like Sidekick.)" << NL; + output << NL; + output << "About to execute \"" << comspec << "\"..." << NL; + swapvectors; + exec("c:\\command.com", ""); + swapvectors; + setintvec(0x1f, where); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index 1bc68dfc1c68..9ca4e2959915 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,24 +31,28 @@ namespace Avalanche { struct infotype { - matrix<128,255,1,8,byte> chars; - string data; + matrix<128, 255, 1, 8, byte> chars; + string data; }; infotype table; pointer where; -integer gd,gm; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1f,where); move(where,table,1280); - gd=1; gm=0; initgraph(gd,gm,"c:\\turbo"); - output << "Now in CGA low-res 320x200." << NL; - output << "High ASCII codes work- " << NL; - output << "And the code is..." << NL; - output << table.data << NL; - output << "Press Enter..." << NL; - input >> NL; closegraph(); -return EXIT_SUCCESS; +integer gd, gm; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1f, where); + move(where, table, 1280); + gd = 1; + gm = 0; + initgraph(gd, gm, "c:\\turbo"); + output << "Now in CGA low-res 320x200." << NL; + output << "High ASCII codes work- " << NL; + output << "And the code is..." << NL; + output << table.data << NL; + output << "Press Enter..." << NL; + input >> NL; + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp index 54ab3d0aa847..f54439178bc9 100644 --- a/engines/avalanche/slope.cpp +++ b/engines/avalanche/slope.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -28,8 +28,8 @@ namespace Avalanche { struct joysetup { - word xmid,ymid,xmin,ymin,xmax,ymax; - byte centre; /* Size of centre in tenths */ + word xmid, ymid, xmin, ymin, xmax, ymax; + byte centre; /* Size of centre in tenths */ }; const integer bug_twonames = 255; @@ -42,335 +42,356 @@ const integer bug_weirdcard = 250; byte fv; char t; string bugline; -boolean usingp,usingl; -boolean zoomy,numlockhold; +boolean usingp, usingl; +boolean zoomy, numlockhold; boolean doing_syntax; -joysetup js; boolean use_joy_a; +joysetup js; +boolean use_joy_a; boolean filename_specified; boolean soundfx; -string inihead,initail; /* For reading the .INI file. */ +string inihead, initail; /* For reading the .INI file. */ string filetoload; -boolean cl_override,keyboardclick,demo; +boolean cl_override, keyboardclick, demo; string slopeline; -word storage_seg,storage_ofs; +word storage_seg, storage_ofs; string argon; -longint soundcard,baseaddr,speed,irq,dma; +longint soundcard, baseaddr, speed, irq, dma; -string strf(longint x) -{ - string q; +string strf(longint x) { + string q; - string strf_result; - str(x,q); strf_result=q; - return strf_result; + string strf_result; + str(x, q); + strf_result = q; + return strf_result; } -void linebug(byte which) -{ - output << "AVALOT : "; - switch (which) { - case bug_twonames : output << "You may only specify ONE filename." << NL; break; - case bug_pandl : output << "/p and /l cannot be used together." << NL; break; - case bug_weirdswitch : output << "Unknown switch (\"" << bugline << - "\"). Type AVALOT /? for a list of switches." << NL; - break; - case bug_invalidini: output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; break; - case bug_notyesorno: output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; break; - case bug_weirdcard: output << "Unknown card: " << bugline << '.' << NL; break; - } - - exit(which); +void linebug(byte which) { + output << "AVALOT : "; + switch (which) { + case bug_twonames : + output << "You may only specify ONE filename." << NL; + break; + case bug_pandl : + output << "/p and /l cannot be used together." << NL; + break; + case bug_weirdswitch : + output << "Unknown switch (\"" << bugline << + "\"). Type AVALOT /? for a list of switches." << NL; + break; + case bug_invalidini: + output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; + break; + case bug_notyesorno: + output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; + break; + case bug_weirdcard: + output << "Unknown card: " << bugline << '.' << NL; + break; + } + + exit(which); } -longint card(string x) -{ - longint card_result; - if (x=="NONE") card_result=0; else - if (x=="SB") card_result=1; else - if (x=="SBPRO") card_result=2; else - if (x=="SB16") card_result=3; else - if (x=="PAS") card_result=4; else - if (x=="PASPLUS") card_result=5; else - if (x=="PAS16") card_result=6; else - if (x=="ARIA") card_result=7; else - if (x=="WINSOUND") card_result=8; else - if (x=="GRAVIS") card_result=9; else - if (x=="DACLPT") card_result=10; else - if (x=="STEREODACS") card_result=11; else - if (x=="STEREOON1") card_result=12; else - if (x=="SPEAKER") card_result=13; else - linebug(bug_weirdcard); - return card_result; +longint card(string x) { + longint card_result; + if (x == "NONE") card_result = 0; + else if (x == "SB") card_result = 1; + else if (x == "SBPRO") card_result = 2; + else if (x == "SB16") card_result = 3; + else if (x == "PAS") card_result = 4; + else if (x == "PASPLUS") card_result = 5; + else if (x == "PAS16") card_result = 6; + else if (x == "ARIA") card_result = 7; + else if (x == "WINSOUND") card_result = 8; + else if (x == "GRAVIS") card_result = 9; + else if (x == "DACLPT") card_result = 10; + else if (x == "STEREODACS") card_result = 11; + else if (x == "STEREOON1") card_result = 12; + else if (x == "SPEAKER") card_result = 13; + else + linebug(bug_weirdcard); + return card_result; } -void upstr(string& x) -{ - byte fv; +void upstr(string &x) { + byte fv; - for( fv=1; fv <= length(x); fv ++) x[fv]=upcase(x[fv]); + for (fv = 1; fv <= length(x); fv ++) x[fv] = upcase(x[fv]); } -boolean yesno() -{ - boolean yesno_result; - if (initail=="YES") yesno_result=true; else - if (initail=="NO") yesno_result=false; else - linebug(bug_notyesorno); - return yesno_result; +boolean yesno() { + boolean yesno_result; + if (initail == "YES") yesno_result = true; + else if (initail == "NO") yesno_result = false; + else + linebug(bug_notyesorno); + return yesno_result; } -word value(string x) -{ - const varying_string<15> hexdigits = "0123456789ABCDEF"; - word w; integer e; - - word value_result; - if (x[1]=='$') - { - w=0; - for( e=2; e <= length(x); e ++) - { - w=w << 4; - w += pos(upcase(x[e]),hexdigits)-1; - } - value_result=w; - } else - { - val(x,w,e); - if (e==0) value_result=w; else value_result=0; - } - return value_result; +word value(string x) { + const varying_string<15> hexdigits = "0123456789ABCDEF"; + word w; + integer e; + + word value_result; + if (x[1] == '$') { + w = 0; + for (e = 2; e <= length(x); e ++) { + w = w << 4; + w += pos(upcase(x[e]), hexdigits) - 1; + } + value_result = w; + } else { + val(x, w, e); + if (e == 0) value_result = w; + else value_result = 0; + } + return value_result; } -void ini_parse() -{ - upstr(inihead); - upstr(initail); - - if (inihead=="QUIET") soundfx=! yesno(); else - if (inihead=="ZOOMYSTART") zoomy=yesno(); else - if (inihead=="NUMLOCKHOLD") numlockhold=yesno(); else - if (inihead=="LOADFIRST") filetoload=initail; else - if (inihead=="OVERRIDEEGACHECK") cl_override=yesno(); else - if (inihead=="KEYBOARDCLICK") keyboardclick=yesno(); else - if (inihead=="JOYTOP") js.ymin=value(initail); else - if (inihead=="JOYBOTTOM") js.ymax=value(initail); else - if (inihead=="JOYLEFT") js.xmin=value(initail); else - if (inihead=="JOYRIGHT") js.xmax=value(initail); else - if (inihead=="JOYMIDX") js.xmid=value(initail); else - if (inihead=="JOYMIDY") js.ymid=value(initail); else - if (inihead=="JOYCENTRINGFACTOR") js.centre=value(initail); else - if (inihead=="WHICHJOY") use_joy_a=value(initail)==1; else - if (inihead=="SOUNDCARD") soundcard=card(initail); else - if (inihead=="BASEADDRESS") baseaddr=value(initail); else - if (inihead=="IRQ") irq=value(initail); else - if (inihead=="DMA") dma=value(initail); else - if (inihead=="SAMPLERATE") speed=value(initail); +void ini_parse() { + upstr(inihead); + upstr(initail); + + if (inihead == "QUIET") soundfx = ! yesno(); + else if (inihead == "ZOOMYSTART") zoomy = yesno(); + else if (inihead == "NUMLOCKHOLD") numlockhold = yesno(); + else if (inihead == "LOADFIRST") filetoload = initail; + else if (inihead == "OVERRIDEEGACHECK") cl_override = yesno(); + else if (inihead == "KEYBOARDCLICK") keyboardclick = yesno(); + else if (inihead == "JOYTOP") js.ymin = value(initail); + else if (inihead == "JOYBOTTOM") js.ymax = value(initail); + else if (inihead == "JOYLEFT") js.xmin = value(initail); + else if (inihead == "JOYRIGHT") js.xmax = value(initail); + else if (inihead == "JOYMIDX") js.xmid = value(initail); + else if (inihead == "JOYMIDY") js.ymid = value(initail); + else if (inihead == "JOYCENTRINGFACTOR") js.centre = value(initail); + else if (inihead == "WHICHJOY") use_joy_a = value(initail) == 1; + else if (inihead == "SOUNDCARD") soundcard = card(initail); + else if (inihead == "BASEADDRESS") baseaddr = value(initail); + else if (inihead == "IRQ") irq = value(initail); + else if (inihead == "DMA") dma = value(initail); + else if (inihead == "SAMPLERATE") speed = value(initail); } -void strip_ini() -{ - byte fv; +void strip_ini() { + byte fv; - if (inihead=="") return; + if (inihead == "") return; - /* Firstly, delete any comments. */ - fv=pos(";",inihead); - if (fv>0) Delete(inihead,fv,255); + /* Firstly, delete any comments. */ + fv = pos(";", inihead); + if (fv > 0) Delete(inihead, fv, 255); - /* Lose the whitespace... */ + /* Lose the whitespace... */ - while (inihead[length(inihead)]==' ') inihead[0] -= 1; - while ((inihead!="") && (inihead[1]==' ')) Delete(inihead,1,1); + while (inihead[length(inihead)] == ' ') inihead[0] -= 1; + while ((inihead != "") && (inihead[1] == ' ')) Delete(inihead, 1, 1); - /* It's possible that now we'll end up with a blank line. */ + /* It's possible that now we'll end up with a blank line. */ - if ((inihead=="") || (inihead[1]=='[')) return; + if ((inihead == "") || (inihead[1] == '[')) return; - fv=pos("=",inihead); + fv = pos("=", inihead); - if (fv==0) - { /* No "="! Weird! */ - bugline=inihead; - linebug(bug_invalidini); - } + if (fv == 0) { + /* No "="! Weird! */ + bugline = inihead; + linebug(bug_invalidini); + } - initail=copy(inihead,fv+1,255); - inihead[0]=chr(fv-1); + initail = copy(inihead, fv + 1, 255); + inihead[0] = chr(fv - 1); } -void load_ini() -{ - text ini; +void load_ini() { + text ini; - assign(ini,"AVALOT.INI"); - reset(ini); + assign(ini, "AVALOT.INI"); + reset(ini); - while (! eof(ini)) - { - ini >> inihead >> NL; - strip_ini(); - if (inihead!="") ini_parse(); - } + while (! eof(ini)) { + ini >> inihead >> NL; + strip_ini(); + if (inihead != "") ini_parse(); + } - close(ini); + close(ini); } void parse(string x); static string arg; -static string getarg(string otherwis) -{ - string getarg_result; - if (arg=="") getarg_result=otherwis; else getarg_result=arg; - return getarg_result; +static string getarg(string otherwis) { + string getarg_result; + if (arg == "") getarg_result = otherwis; + else getarg_result = arg; + return getarg_result; } void parse(string x) { - switch (x[1]) { - case '/':case '-': { - arg=copy(x,3,255); - switch (upcase(x[2])) { - case '?': doing_syntax=true; break; - case 'O': cl_override=true; break; - case 'L': if (! usingp) - { - usingl=true; - argon=getarg("avvy.log"); - } else linebug(bug_pandl); - break; - case 'P': if (! usingl) - { - usingp=true; - argon=getarg("prn"); - } else linebug(bug_pandl); - break; - case 'Q': soundfx=false; break; - case 'Z': zoomy=true; break; - case 'K': keyboardclick=true; break; - case 'D': demo=true; break; - default: { - bugline=x; - linebug(bug_weirdswitch); - } - } - } - break; - case '*': { - inihead=copy(x,2,255); - strip_ini(); - if (inihead!="") ini_parse(); - } - break; - default: { /* filename */ - if (filename_specified) - linebug(bug_twonames); - else - filetoload=x; - filename_specified=true; - } - } + switch (x[1]) { + case '/': + case '-': { + arg = copy(x, 3, 255); + switch (upcase(x[2])) { + case '?': + doing_syntax = true; + break; + case 'O': + cl_override = true; + break; + case 'L': + if (! usingp) { + usingl = true; + argon = getarg("avvy.log"); + } else linebug(bug_pandl); + break; + case 'P': + if (! usingl) { + usingp = true; + argon = getarg("prn"); + } else linebug(bug_pandl); + break; + case 'Q': + soundfx = false; + break; + case 'Z': + zoomy = true; + break; + case 'K': + keyboardclick = true; + break; + case 'D': + demo = true; + break; + default: { + bugline = x; + linebug(bug_weirdswitch); + } + } + } + break; + case '*': { + inihead = copy(x, 2, 255); + strip_ini(); + if (inihead != "") ini_parse(); + } + break; + default: { /* filename */ + if (filename_specified) + linebug(bug_twonames); + else + filetoload = x; + filename_specified = true; + } + } } void make_slopeline(); -static char yn1(boolean b) -{ - char yn1_result; - if (b) yn1_result='y'; else yn1_result='n'; - return yn1_result; +static char yn1(boolean b) { + char yn1_result; + if (b) yn1_result = 'y'; + else yn1_result = 'n'; + return yn1_result; } -static char pln() -{ - char pln_result; - if ((! usingp) && (! usingl)) pln_result='n'; else - if (usingp) pln_result='p'; else - if (usingl) pln_result='l'; - return pln_result; +static char pln() { + char pln_result; + if ((! usingp) && (! usingl)) pln_result = 'n'; + else if (usingp) pln_result = 'p'; + else if (usingl) pln_result = 'l'; + return pln_result; } void make_slopeline() { - if (argon=="") argon="nul"; - - slopeline=string('1')+yn1(doing_syntax)+yn1(soundfx)+yn1(cl_override)+ - yn1(keyboardclick)+pln()+yn1(demo)+yn1(zoomy)+yn1(numlockhold)+ - yn1(use_joy_a)+ - ' '+strf(js.xmid)+ - ' '+strf(js.ymid)+ - ' '+strf(js.xmin)+ - ' '+strf(js.ymin)+ - ' '+strf(js.xmax)+ - ' '+strf(js.ymax)+ - ' '+strf(js.centre)+ - ' '+argon+' '+filetoload; + if (argon == "") argon = "nul"; + + slopeline = string('1') + yn1(doing_syntax) + yn1(soundfx) + yn1(cl_override) + + yn1(keyboardclick) + pln() + yn1(demo) + yn1(zoomy) + yn1(numlockhold) + + yn1(use_joy_a) + + ' ' + strf(js.xmid) + + ' ' + strf(js.ymid) + + ' ' + strf(js.xmin) + + ' ' + strf(js.ymin) + + ' ' + strf(js.xmax) + + ' ' + strf(js.ymax) + + ' ' + strf(js.centre) + + ' ' + argon + ' ' + filetoload; } -void store_slopeline() -{ - move(slopeline,mem[storage_seg*storage_ofs+3],sizeof(slopeline)); - move(js,mem[storage_seg*storage_ofs+300],sizeof(js)); - move(soundcard,mem[storage_seg*storage_ofs+5000],4); - move(baseaddr,mem[storage_seg*storage_ofs+5004],4); - move(irq,mem[storage_seg*storage_ofs+5008],4); - move(dma,mem[storage_seg*storage_ofs+5012],4); - move(speed,mem[storage_seg*storage_ofs+5016],4); +void store_slopeline() { + move(slopeline, mem[storage_seg * storage_ofs + 3], sizeof(slopeline)); + move(js, mem[storage_seg * storage_ofs + 300], sizeof(js)); + move(soundcard, mem[storage_seg * storage_ofs + 5000], 4); + move(baseaddr, mem[storage_seg * storage_ofs + 5004], 4); + move(irq, mem[storage_seg * storage_ofs + 5008], 4); + move(dma, mem[storage_seg * storage_ofs + 5012], 4); + move(speed, mem[storage_seg * storage_ofs + 5016], 4); } void get_storage_addr(); -static void not_through_bootstrap() -{ output << "Not standalone!" << NL; exit(255); } +static void not_through_bootstrap() { + output << "Not standalone!" << NL; + exit(255); +} -void get_storage_addr() -{ - integer e; +void get_storage_addr() { + integer e; - if (paramstr(1)!="jsb") not_through_bootstrap(); - val(paramstr(2),storage_seg,e); if (e!=0) not_through_bootstrap(); - val(paramstr(3),storage_ofs,e); if (e!=0) not_through_bootstrap(); + if (paramstr(1) != "jsb") not_through_bootstrap(); + val(paramstr(2), storage_seg, e); + if (e != 0) not_through_bootstrap(); + val(paramstr(3), storage_ofs, e); + if (e != 0) not_through_bootstrap(); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - get_storage_addr(); - - filetoload=""; argon=""; - usingl=false; - usingp=false; - cl_override=false; - soundfx=true; - zoomy=false; - numlockhold=false; - filename_specified=false; - keyboardclick=false; - doing_syntax=false; - soundcard=0; baseaddr=0; irq=0; dma=0; - - load_ini(); - - for( fv=4; fv <= paramcount; fv ++) - parse(paramstr(fv)); - - make_slopeline(); - - store_slopeline(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + get_storage_addr(); + + filetoload = ""; + argon = ""; + usingl = false; + usingp = false; + cl_override = false; + soundfx = true; + zoomy = false; + numlockhold = false; + filename_specified = false; + keyboardclick = false; + doing_syntax = false; + soundcard = 0; + baseaddr = 0; + irq = 0; + dma = 0; + + load_ini(); + + for (fv = 4; fv <= paramcount; fv ++) + parse(paramstr(fv)); + + make_slopeline(); + + store_slopeline(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index acc9535b64d1..21e73cac4639 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,303 +31,390 @@ namespace Avalanche { struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; varying_string<3> sn; adxtype a; -matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ +matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ word bigsize; -const array<0,15,varying_string<6> > col = - {{"Black","Blue","Green","Cyan","Red","Pink","Brown","Grey+", - "Grey-","Blue+","Green+","Cyan+","Red+","Pink+","Yellow","White"}}; -const string prompt = string('\32')+'\257'; +const array<0, 15, varying_string<6> > col = { + { + "Black", "Blue", "Green", "Cyan", "Red", "Pink", "Brown", "Grey+", + "Grey-", "Blue+", "Green+", "Cyan+", "Red+", "Pink+", "Yellow", "White" + } +}; +const string prompt = string('\32') + '\257'; -void load() -{ - untyped_file f; byte gd,gm,sort,n; pointer p,q; -; - assign(f,string("v:sprite")+sn+".avd"); reset(f,1); seek(f,59); - blockread(f,a,sizeof(a)); blockread(f,bigsize,2); - setactivepage(3); - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); - blockread(f,p,bigsize); - putimage(0,0,p,0); release(q); n=1; - for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= a.seq-1; gd ++) /* steps */ - {; - getmem(pic[n][sort],a.size); /* grab the memory */ - getimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, - (gm / 2)*(a.xl*6)+gd*a.xl+a.xl-1,(gm % 2)*a.yl+a.yl-1, - pic[n][sort]); /* grab the pic */ - n += 1; - } - } - close(f); setactivepage(0); +void load() { + untyped_file f; + byte gd, gm, sort, n; + pointer p, q; + ; + assign(f, string("v:sprite") + sn + ".avd"); + reset(f, 1); + seek(f, 59); + blockread(f, a, sizeof(a)); + blockread(f, bigsize, 2); + setactivepage(3); + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + blockread(f, p, bigsize); + putimage(0, 0, p, 0); + release(q); + n = 1; + for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ + ; + getmem(pic[n][sort], a.size); /* grab the memory */ + getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, + (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, + pic[n][sort]); /* grab the pic */ + n += 1; + } + } + close(f); + setactivepage(0); } -void save() -{ - untyped_file f; byte gd,gm,sort,n; pointer p,q; - string x; integer txl,tyl; -; - {; - txl=a.seq*a.xl*2; tyl=a.yl*2; - } +void save() { + untyped_file f; + byte gd, gm, sort, n; + pointer p, q; + string x; + integer txl, tyl; + ; + { + ; + txl = a.seq * a.xl * 2; + tyl = a.yl * 2; + } - assign(f,string("v:sprite")+sn+".avd"); - x=string("Sprite file for Avvy - Trippancy IV. Subject to copyright.")+'\32'; - rewrite(f,1); blockwrite(f,x[1],59); + assign(f, string("v:sprite") + sn + ".avd"); + x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; + rewrite(f, 1); + blockwrite(f, x[1], 59); - blockwrite(f,a,sizeof(a)); blockwrite(f,bigsize,2); - setactivepage(3); - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); n=1; - for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= a.seq-1; gd ++) /* steps */ - {; - putimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, - pic[n][sort],0); /* drop the pic */ - n += 1; - } - getimage(0,0,txl,tyl,p); - blockwrite(f,p,bigsize); release(q); - } - close(f); setactivepage(0); + blockwrite(f, a, sizeof(a)); + blockwrite(f, bigsize, 2); + setactivepage(3); + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + n = 1; + for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ + ; + putimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, + pic[n][sort], 0); /* drop the pic */ + n += 1; + } + getimage(0, 0, txl, tyl, p); + blockwrite(f, p, bigsize); + release(q); + } + close(f); + setactivepage(0); } -void setup() -{ - integer gd,gm; -; - output << "SPREAD (c) 1992, Thomas Thurman." << NL; output << NL; - output << "Enter number of SPRITE*.AVD file to edit:"; input >> sn >> NL; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); +void setup() { + integer gd, gm; + ; + output << "SPREAD (c) 1992, Thomas Thurman." << NL; + output << NL; + output << "Enter number of SPRITE*.AVD file to edit:"; + input >> sn >> NL; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); } -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void likethis() -{; - {; - setfillstyle(1,a.bgc); setcolor(a.fgc); settextstyle(0,0,1); - bar(0,190,100,200); outtextxy(12,191,"Like this!"); - } +void likethis() { + ; + { + ; + setfillstyle(1, a.bgc); + setcolor(a.fgc); + settextstyle(0, 0, 1); + bar(0, 190, 100, 200); + outtextxy(12, 191, "Like this!"); + } } -void values() -{ - byte fv; -; - settextstyle(2,0,9); setcolor(14); - outtextxy(277,0,string("Spread: editing ")+sn); setcolor(15); - for( fv=0; fv <= 3; fv ++) putimage(77+(a.xl+10)*fv,17,pic[a.seq*fv+1][1],0); - settextstyle(2,0,7); - outtextxy(0, 30,"Views:"); - {; - outtextxy(0, 50,string("N: Name: ")+a.name); - outtextxy(0, 70,string("No. of pictures: ")+strf(a.num)+" ("+strf(a.num / a.seq)+" ways)"); - outtextxy(0, 90,string("XY: Size: ")+strf(a.xl)+'x'+strf(a.yl)); - outtextxy(0,110,string("S: Stride size: ")+strf(a.seq)); - outtextxy(0,130,string("Imagesize (bytes): ")+strf(a.size)); - outtextxy(0,150,string("B: Bubble background: ")+col[a.bgc]); - outtextxy(0,170,string("F: Bubble foreground: ")+col[a.fgc]); - likethis(); - } - setcolor(lightgreen); settextstyle(0,0,1); - outtextxy(400,50,"A) Animate"); - outtextxy(400,60,"E) Edit pictures"); - outtextxy(400,70,"alt-f2) Save"); - outtextxy(400,80,"ctrl-f3) Load"); - outtextxy(400,90,"or any key to the left..."); +void values() { + byte fv; + ; + settextstyle(2, 0, 9); + setcolor(14); + outtextxy(277, 0, string("Spread: editing ") + sn); + setcolor(15); + for (fv = 0; fv <= 3; fv ++) putimage(77 + (a.xl + 10)*fv, 17, pic[a.seq * fv + 1][1], 0); + settextstyle(2, 0, 7); + outtextxy(0, 30, "Views:"); + { + ; + outtextxy(0, 50, string("N: Name: ") + a.name); + outtextxy(0, 70, string("No. of pictures: ") + strf(a.num) + " (" + strf(a.num / a.seq) + " ways)"); + outtextxy(0, 90, string("XY: Size: ") + strf(a.xl) + 'x' + strf(a.yl)); + outtextxy(0, 110, string("S: Stride size: ") + strf(a.seq)); + outtextxy(0, 130, string("Imagesize (bytes): ") + strf(a.size)); + outtextxy(0, 150, string("B: Bubble background: ") + col[a.bgc]); + outtextxy(0, 170, string("F: Bubble foreground: ") + col[a.fgc]); + likethis(); + } + setcolor(lightgreen); + settextstyle(0, 0, 1); + outtextxy(400, 50, "A) Animate"); + outtextxy(400, 60, "E) Edit pictures"); + outtextxy(400, 70, "alt-f2) Save"); + outtextxy(400, 80, "ctrl-f3) Load"); + outtextxy(400, 90, "or any key to the left..."); } -byte ccol() -{ - byte fv; -byte ccol_result; -; - restorecrtmode(); - output << "Choose a colour- one of these..." << NL; - for( fv=0; fv <= 15; fv ++) - {; - textattr=14; output << fv << ") "; textattr=fv; output << string('\376')+'\40'; - textattr=14; output << col[fv] << NL; - } - textattr=14; - do { - output << prompt; input >> fv >> NL; - } while (!(fv<16)); - ccol_result=fv; setgraphmode(0); -return ccol_result; +byte ccol() { + byte fv; + byte ccol_result; + ; + restorecrtmode(); + output << "Choose a colour- one of these..." << NL; + for (fv = 0; fv <= 15; fv ++) { + ; + textattr = 14; + output << fv << ") "; + textattr = fv; + output << string('\376') + '\40'; + textattr = 14; + output << col[fv] << NL; + } + textattr = 14; + do { + output << prompt; + input >> fv >> NL; + } while (!(fv < 16)); + ccol_result = fv; + setgraphmode(0); + return ccol_result; } -string cstr(string oc) -{ - string x; -string cstr_result; -; - restorecrtmode(); - output << string("Old choice is: <")+oc+'>' << NL; - output << NL; - output << "(Anything after a semi-colon will not be displayed by the game, e.g. Avvy;Monk" << NL; - output << " will be displayed as Avvy.)" << NL; - output << NL; - output << string("New choice, Enter for no change, Space+Enter for a blank?")+prompt; input >> x >> NL; - if (x=="") cstr_result=oc; else if (x==' ') cstr_result=""; else cstr_result=x; - setgraphmode(0); -return cstr_result; +string cstr(string oc) { + string x; + string cstr_result; + ; + restorecrtmode(); + output << string("Old choice is: <") + oc + '>' << NL; + output << NL; + output << "(Anything after a semi-colon will not be displayed by the game, e.g. Avvy;Monk" << NL; + output << " will be displayed as Avvy.)" << NL; + output << NL; + output << string("New choice, Enter for no change, Space+Enter for a blank?") + prompt; + input >> x >> NL; + if (x == "") cstr_result = oc; + else if (x == ' ') cstr_result = ""; + else cstr_result = x; + setgraphmode(0); + return cstr_result; } -longint cnum(longint on) -{ - string x; longint q; integer e; -longint cnum_result; -; - restorecrtmode(); - do { - output << "Old value is: " << on << '.' << NL; - output << string("New choice, or Enter for no change?")+prompt; input >> x >> NL; - if (x=="") - {; - e=0; /* must be OK here */ q=on; - } else val(x,q,e); - if (e!=0) output << x << " isn't a number, silly!" << NL; - } while (!(e==0)); - setgraphmode(0); cnum_result=q; -return cnum_result; +longint cnum(longint on) { + string x; + longint q; + integer e; + longint cnum_result; + ; + restorecrtmode(); + do { + output << "Old value is: " << on << '.' << NL; + output << string("New choice, or Enter for no change?") + prompt; + input >> x >> NL; + if (x == "") { + ; + e = 0; /* must be OK here */ q = on; + } else val(x, q, e); + if (e != 0) output << x << " isn't a number, silly!" << NL; + } while (!(e == 0)); + setgraphmode(0); + cnum_result = q; + return cnum_result; } -void animate() -{ - byte facing,step,slow,fv; -; - cleardevice(); - settextstyle(0,0,2); setcolor(12); outtextxy(0,0,"Animate"); - settextstyle(0,0,1); setcolor(15); - outtextxy(0,20,"Enter = Turn, + = Faster, - = Slower, Esc = stop this."); - facing=0; step=1; slow=100; - do { - for( fv=0; fv <= 1; fv ++) - putimage(200*fv+177,77,pic[facing*a.seq+step][fv],4-fv*4); - if (keypressed()) - switch (upcase(readkey())) { - case '\15': {; - facing += 1; if (facing*a.seq>=a.num) facing=0; - } - break; - case '\33': {; cleardevice(); return; } break; - case '+': if (slow>0) slow -= 5; break; - case '-': if (slow<255) slow += 5; break; default: output << '\7'; - } - step += 1; if (step>a.seq) step=1; - delay(slow); - } while (!false); +void animate() { + byte facing, step, slow, fv; + ; + cleardevice(); + settextstyle(0, 0, 2); + setcolor(12); + outtextxy(0, 0, "Animate"); + settextstyle(0, 0, 1); + setcolor(15); + outtextxy(0, 20, "Enter = Turn, + = Faster, - = Slower, Esc = stop this."); + facing = 0; + step = 1; + slow = 100; + do { + for (fv = 0; fv <= 1; fv ++) + putimage(200 * fv + 177, 77, pic[facing * a.seq + step][fv], 4 - fv * 4); + if (keypressed()) + switch (upcase(readkey())) { + case '\15': { + ; + facing += 1; + if (facing * a.seq >= a.num) facing = 0; + } + break; + case '\33': { + ; + cleardevice(); + return; + } + break; + case '+': + if (slow > 0) slow -= 5; + break; + case '-': + if (slow < 255) slow += 5; + break; + default: + output << '\7'; + } + step += 1; + if (step > a.seq) step = 1; + delay(slow); + } while (!false); } -byte tabpel(integer x,integer y) -{byte tabpel_result; -; - if (getpixel(400+x,17+y)==15) tabpel_result=17; - else tabpel_result=getpixel(500+x,17+y); -return tabpel_result; +byte tabpel(integer x, integer y) { + byte tabpel_result; + ; + if (getpixel(400 + x, 17 + y) == 15) tabpel_result = 17; + else tabpel_result = getpixel(500 + x, 17 + y); + return tabpel_result; } -void bigpixel(integer x,integer y, byte size,byte col) -{; - if (col==17) setfillstyle(9,8); else setfillstyle(1,col); - bar(x*size,y*size,x*size+size-2,y*size+size-2); +void bigpixel(integer x, integer y, byte size, byte col) { + ; + if (col == 17) setfillstyle(9, 8); + else setfillstyle(1, col); + bar(x * size, y * size, x * size + size - 2, y * size + size - 2); } -void blowup(byte n) -{ - byte fv,x,y,xyl; -; - {; - for( fv=0; fv <= 1; fv ++) putimage(400+fv*100,17,pic[n][fv],0); - xyl=200 / a.yl; - for( x=0; x <= a.xl; x ++) - for( y=0; y <= a.yl; y ++) - bigpixel(x,y,xyl,tabpel(x,y)); - } +void blowup(byte n) { + byte fv, x, y, xyl; + ; + { + ; + for (fv = 0; fv <= 1; fv ++) putimage(400 + fv * 100, 17, pic[n][fv], 0); + xyl = 200 / a.yl; + for (x = 0; x <= a.xl; x ++) + for (y = 0; y <= a.yl; y ++) + bigpixel(x, y, xyl, tabpel(x, y)); + } } void edit(); -static void putnum(byte x,byte p) -{ - varying_string<2> z; -; - str(x,z); outtextxy(x*53+17,87,z); putimage(x*53,100,pic[p][1],0); +static void putnum(byte x, byte p) { + varying_string<2> z; + ; + str(x, z); + outtextxy(x * 53 + 17, 87, z); + putimage(x * 53, 100, pic[p][1], 0); } -static void title() -{; - cleardevice(); setcolor(11); settextstyle(0,0,2); - outtextxy(0,0,"Edit- which one?"); settextstyle(0,0,1); setcolor(15); +static void title() { + ; + cleardevice(); + setcolor(11); + settextstyle(0, 0, 2); + outtextxy(0, 0, "Edit- which one?"); + settextstyle(0, 0, 1); + setcolor(15); } -void edit() -{ - byte fv,ra,rb; -; - {; - title(); for( fv=1; fv <= (a.num / a.seq); fv ++) putnum(fv,fv*a.seq); - do { ra=ord(readkey())-48; } while (!(ra<(a.num / a.seq))); ra -= 1; - title(); for( fv=1; fv <= a.seq; fv ++) putnum(fv,ra*a.seq+fv); - do { rb=ord(readkey())-48; } while (!(rb> NL; - cleardevice(); - } +void edit() { + byte fv, ra, rb; + ; + { + ; + title(); + for (fv = 1; fv <= (a.num / a.seq); fv ++) putnum(fv, fv * a.seq); + do { + ra = ord(readkey()) - 48; + } while (!(ra < (a.num / a.seq))); + ra -= 1; + title(); + for (fv = 1; fv <= a.seq; fv ++) putnum(fv, ra * a.seq + fv); + do { + rb = ord(readkey()) - 48; + } while (!(rb < a.seq)); + cleardevice(); + blowup(ra * a.seq + rb); + input >> NL; + cleardevice(); + } } -void pickone() -{ - char r; -; - r=upcase(readkey()); - switch (r) { - case 'N': a.name=cstr(a.name); break; - case 'S': a.seq=cnum(a.seq); break; - case 'F': a.fgc=ccol(); break; - case 'B': a.bgc=ccol(); break; - case 'A': animate(); break; - case 'E': edit(); break; - case '\0': switch (readkey()) { - case 'i': save(); break; /* alt-f2 */ - } - break; - } +void pickone() { + char r; + ; + r = upcase(readkey()); + switch (r) { + case 'N': + a.name = cstr(a.name); + break; + case 'S': + a.seq = cnum(a.seq); + break; + case 'F': + a.fgc = ccol(); + break; + case 'B': + a.bgc = ccol(); + break; + case 'A': + animate(); + break; + case 'E': + edit(); + break; + case '\0': + switch (readkey()) { + case 'i': + save(); + break; /* alt-f2 */ + } + break; + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup(); - do { - values(); - pickone(); - } while (!false); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup(); + do { + values(); + pickone(); + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index 6fa215900e88..c6c586921d2b 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,723 +34,919 @@ namespace Avalanche { const integer pattern = 12; /* Pattern for transparencies. */ -const fillpatterntype grey50 = {{0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, 0x55}}; +const fillpatterntype grey50 = {{ + 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0x55, 0xaa, 0x55 + } +}; struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; untyped_file sf; adxtype a; char r; -boolean adxmodi,picmodi; -array<5,2053,byte> mani; -matrix<0,99,0,10,byte> sil; -array<1,16000,byte> aa; +boolean adxmodi, picmodi; +array<5, 2053, byte> mani; +matrix<0, 99, 0, 10, byte> sil; +array<1, 16000, byte> aa; word soa; byte xw; -byte leftc,rightc; +byte leftc, rightc; boolean lmo; -array<1,2,pointer> clip; -integer clipx,clipy; +array<1, 2, pointer> clip; +integer clipx, clipy; boolean boardfull; -integer xofs,yofs; /* Distance of TL corner of cut from TL corner of pic. */ +integer xofs, yofs; /* Distance of TL corner of cut from TL corner of pic. */ + +byte bigpix_size, bigpix_gap; /* Size & gap betwixt big pixels. */ + +void setup() { + const integer shouldid = -1317732048; + boolean ok; + longint id; + varying_string<2> sn; + ; + output << "Sprite Editor 2 (c) 1993, Thomas Thurman." << NL; + bigpix_size = 3; + bigpix_gap = 5; + do { + ok = true; + output << "Number of sprite?"; + input >> sn >> NL; + assign(sf, string("v:\\sprite") + sn + ".avd"); + reset(sf, 1); + seek(sf, 177); + blockread(sf, id, 4); + if (id != shouldid) { + ; + output << "That isn't a valid Trip5 spritefile." << NL; + output << "Please choose another." << NL; + output << NL; + ok = false; + close(sf); + } else { + ; + blockread(sf, soa, 2); + if (soa != (cardinal)sizeof(a)) { /* to change this, just change the "type adx=" bit.*/ + ; + output << "That spritefile contains an unknown ADX field type." << NL; + output << "Please choose another." << NL; + output << NL; + ok = false; + close(sf); + } + } + } while (!ok); + blockread(sf, a, soa); + output << filepos(sf) << NL; + adxmodi = false; + picmodi = false; + getmem(clip[1], a.size); + getmem(clip[2], a.size); + boardfull = false; +} -byte bigpix_size,bigpix_gap; /* Size & gap betwixt big pixels. */ +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; +} -void setup() -{ - const integer shouldid = -1317732048; - boolean ok; - longint id; - varying_string<2> sn; -; - output << "Sprite Editor 2 (c) 1993, Thomas Thurman." << NL; - bigpix_size=3; bigpix_gap=5; - do { - ok=true; - output << "Number of sprite?"; input >> sn >> NL; - assign(sf,string("v:\\sprite")+sn+".avd"); - reset(sf,1); - seek(sf,177); - blockread(sf,id,4); - if (id!=shouldid) - {; - output << "That isn't a valid Trip5 spritefile." << NL; - output << "Please choose another." << NL; - output << NL; - ok=false; close(sf); - } else - {; - blockread(sf,soa,2); - if (soa!=(cardinal)sizeof(a)) /* to change this, just change the "type adx=" bit.*/ - {; - output << "That spritefile contains an unknown ADX field type." << NL; - output << "Please choose another." << NL; - output << NL; - ok=false; close(sf); - } - } - } while (!ok); - blockread(sf,a,soa); - output << filepos(sf) << NL; - adxmodi=false; picmodi=false; - getmem(clip[1],a.size); getmem(clip[2],a.size); boardfull=false; -} - -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; -} - -void centre(byte y, string z) -{; - gotoxy(40-length(z) / 2,y); output << z; -} - -void info(byte x,byte y, string p,string q) -{; - gotoxy(x,y); - textattr=6; output << p+":"; - textattr=11; output << q; - textattr=8; output << ''; -} - -void colours(byte f,byte b) -{; - gotoxy(35,11); - textattr=6; - output << "Bubbles"; - textattr=b*16+f; - output << " like this! "; -} - -void adxinfo() -{; - {; - info( 5, 8,"Name",a.name); - info(35, 8,"Comment",a.comment); - info( 5, 9,"Width",strf(a.xl)); - info(15, 9,"Height",strf(a.yl)); - info(35, 9,"Size of one pic",strf(a.size)); - info( 5,10,"Number in a stride",strf(a.seq)); - info(35,10,"Number of strides",strf(a.num / a.seq)); - info( 5,11,"Total number",strf(a.num)); - info( 5,12,"Acci number",strf(a.accinum)); - colours(a.fgc,a.bgc); - } -} - -void status() -{; - textattr=7; - clrscr; - textattr=10; centre(3,"Sprite Editor 2 (c) 1993, Thomas Thurman."); - textattr=6; gotoxy(3,7); output << "ADX information:"; - adxinfo(); - textattr=6; - gotoxy(3,14); output << "Options:"; - gotoxy(5,15); output << "A) edit ADX information"; - gotoxy(5,16); output << "P) edit pictures"; - gotoxy(5,17); output << "S) save the ADX info (pics are saved automatically)"; -} - -void enterstring(string w, byte l, string& q) -{ - string t; -; - textattr=13; clrscr; - output << NL; - output << "Press Return for no change, Space+Return for a blank." << NL; - do { - output << "New value for " << w << " (max length " << l << ")?"; - input >> t >> NL; - } while (!(length(t)<=l)); - if (t==' ') q=""; else if (t!="") q=t; - adxmodi=true; -} - -void entercolour(string w, byte& c); +void centre(byte y, string z) { + ; + gotoxy(40 - length(z) / 2, y); + output << z; +} + +void info(byte x, byte y, string p, string q) { + ; + gotoxy(x, y); + textattr = 6; + output << p + ":"; + textattr = 11; + output << q; + textattr = 8; + output << ''; +} + +void colours(byte f, byte b) { + ; + gotoxy(35, 11); + textattr = 6; + output << "Bubbles"; + textattr = b * 16 + f; + output << " like this! "; +} + +void adxinfo() { + ; + { + ; + info(5, 8, "Name", a.name); + info(35, 8, "Comment", a.comment); + info(5, 9, "Width", strf(a.xl)); + info(15, 9, "Height", strf(a.yl)); + info(35, 9, "Size of one pic", strf(a.size)); + info(5, 10, "Number in a stride", strf(a.seq)); + info(35, 10, "Number of strides", strf(a.num / a.seq)); + info(5, 11, "Total number", strf(a.num)); + info(5, 12, "Acci number", strf(a.accinum)); + colours(a.fgc, a.bgc); + } +} + +void status() { + ; + textattr = 7; + clrscr; + textattr = 10; + centre(3, "Sprite Editor 2 (c) 1993, Thomas Thurman."); + textattr = 6; + gotoxy(3, 7); + output << "ADX information:"; + adxinfo(); + textattr = 6; + gotoxy(3, 14); + output << "Options:"; + gotoxy(5, 15); + output << "A) edit ADX information"; + gotoxy(5, 16); + output << "P) edit pictures"; + gotoxy(5, 17); + output << "S) save the ADX info (pics are saved automatically)"; +} + +void enterstring(string w, byte l, string &q) { + string t; + ; + textattr = 13; + clrscr; + output << NL; + output << "Press Return for no change, Space+Return for a blank." << NL; + do { + output << "New value for " << w << " (max length " << l << ")?"; + input >> t >> NL; + } while (!(length(t) <= l)); + if (t == ' ') q = ""; + else if (t != "") q = t; + adxmodi = true; +} + +void entercolour(string w, byte &c); static byte fv; -static void loseold() {; output << string('\10')+'\377'; } - - -static void drawnew() {; gotoxy(3+fv*5,11); output << '\30'; } - -void entercolour(string w, byte& c) -{; - textattr=13; clrscr; - output << NL; output << "New value for " << w << '?' << NL; - output << " Use \32\33 to move about, Enter=OK, Esc=Cancel." << NL; - for( fv=1; fv <= 15; fv ++) - {; - gotoxy(3+fv*5,10); textattr=fv; output << ''; - } - fv=c; - do { - drawnew(); - r=readkey(); - switch (r) { - case '\33': return; break; /* no change to c */ - case '\15': {; - c=fv; adxmodi=true; - return; - } - break; - case '\0': switch (readkey()) { - case 'G': {; loseold(); fv= 0; drawnew(); } break; /* home */ - case 'O': {; loseold(); fv=15; drawnew(); } break; /* end */ - case 'K': if (fv> 0) {; loseold(); fv -= 1; drawnew(); } break; /* left */ - case 'M': if (fv<15) {; loseold(); fv += 1; drawnew(); } break; /* right */ - } - break; - } - } while (!false); -} - -void enternum(string w, byte& q) -{ - string t; integer e; byte r; -; - textattr=13; clrscr; - output << NL; - output << "Press Return for no change." << NL; - do { - output << "New value for " << w << '?'; - input >> t >> NL; - if (t=="") return; /* No change... */ - val(t,r,e); - } while (!(e==0)); - q=r; /* Update variable. */ - adxmodi=true; -} - -void editadx() -{ - char r; -; - do { - clrscr; - textattr=10; centre(3,"ADX Editor:"); - textattr= 9; centre(5,"N: Name, C: Comment, F: Foreground, B: Background, A: Accinum, X: eXit."); - adxinfo(); - r=upcase(readkey()); - switch (r) { - case 'N': enterstring("Name",12,a.name); break; - case 'C': enterstring("Comment",16,a.comment); break; - case 'F': entercolour("Foreground",a.fgc); break; - case 'B': entercolour("Background",a.bgc); break; - case 'A': enternum("Accinum",a.accinum); break; - case 'X':case '\33': return; break; - default: output << '\7'; - } - } while (!false); -} - -void saveit() -{ - char pak; - integer oldsoa; -; - textattr=10; clrscr; - centre(7,"Saving!"); - if (adxmodi) - {; - centre(10,"ADX information being saved..."); - seek(sf,181); /* start of ADX info */ - soa=sizeof(a); - blockread(sf,oldsoa,2); -/* if soa=oldsoa then - begin;*/ - seek(sf,181); - blockwrite(sf,soa,2); - blockwrite(sf,a,soa); - adxmodi=false; -/* end else write(#7);*/ - } else centre(10,"No changes were made to ADX..."); - centre(25,"Press any key..."); pak=readkey(); -} - -void quit() -{; - close(sf); - exit(0); -} - -void getsilmani() /* Reclaims original sil & mani arrays */ -{ - byte x,y,z; word offs; -; +static void loseold() { + ; + output << string('\10') + '\377'; +} - /* Sil... */ - getimage(500,150,500+a.xl,150+a.yl,aa); +static void drawnew() { + ; + gotoxy(3 + fv * 5, 11); + output << '\30'; +} - for( x=0; x <= 3; x ++) - for( y=0; y <= a.yl; y ++) - for( z=0; z <= (a.xl / 8); z ++) - {; - offs=5+y*xw*4+xw*x+z; - sil[y][z]=aa[offs]; - } +void entercolour(string w, byte &c) { + ; + textattr = 13; + clrscr; + output << NL; + output << "New value for " << w << '?' << NL; + output << " Use \32\33 to move about, Enter=OK, Esc=Cancel." << NL; + for (fv = 1; fv <= 15; fv ++) { + ; + gotoxy(3 + fv * 5, 10); + textattr = fv; + output << ''; + } + fv = c; + do { + drawnew(); + r = readkey(); + switch (r) { + case '\33': + return; + break; /* no change to c */ + case '\15': { + ; + c = fv; + adxmodi = true; + return; + } + break; + case '\0': + switch (readkey()) { + case 'G': { + ; + loseold(); + fv = 0; + drawnew(); + } + break; /* home */ + case 'O': { + ; + loseold(); + fv = 15; + drawnew(); + } + break; /* end */ + case 'K': + if (fv > 0) { + ; + loseold(); + fv -= 1; + drawnew(); + } + break; /* left */ + case 'M': + if (fv < 15) { + ; + loseold(); + fv += 1; + drawnew(); + } + break; /* right */ + } + break; + } + } while (!false); +} - /* ...Mani. */ +void enternum(string w, byte &q) { + string t; + integer e; + byte r; + ; + textattr = 13; + clrscr; + output << NL; + output << "Press Return for no change." << NL; + do { + output << "New value for " << w << '?'; + input >> t >> NL; + if (t == "") return; /* No change... */ + val(t, r, e); + } while (!(e == 0)); + q = r; /* Update variable. */ + adxmodi = true; +} - getimage(500,50,500+a.xl,50+a.yl,aa); +void editadx() { + char r; + ; + do { + clrscr; + textattr = 10; + centre(3, "ADX Editor:"); + textattr = 9; + centre(5, "N: Name, C: Comment, F: Foreground, B: Background, A: Accinum, X: eXit."); + adxinfo(); + r = upcase(readkey()); + switch (r) { + case 'N': + enterstring("Name", 12, a.name); + break; + case 'C': + enterstring("Comment", 16, a.comment); + break; + case 'F': + entercolour("Foreground", a.fgc); + break; + case 'B': + entercolour("Background", a.bgc); + break; + case 'A': + enternum("Accinum", a.accinum); + break; + case 'X': + case '\33': + return; + break; + default: + output << '\7'; + } + } while (!false); +} - move(aa[5],mani,sizeof(mani)); +void saveit() { + char pak; + integer oldsoa; + ; + textattr = 10; + clrscr; + centre(7, "Saving!"); + if (adxmodi) { + ; + centre(10, "ADX information being saved..."); + seek(sf, 181); /* start of ADX info */ + soa = sizeof(a); + blockread(sf, oldsoa, 2); + /* if soa=oldsoa then + begin;*/ + seek(sf, 181); + blockwrite(sf, soa, 2); + blockwrite(sf, a, soa); + adxmodi = false; + /* end else write(#7);*/ + } else centre(10, "No changes were made to ADX..."); + centre(25, "Press any key..."); + pak = readkey(); +} + +void quit() { + ; + close(sf); + exit(0); +} + +void getsilmani() { /* Reclaims original sil & mani arrays */ + byte x, y, z; + word offs; + ; + + /* Sil... */ + + getimage(500, 150, 500 + a.xl, 150 + a.yl, aa); + + for (x = 0; x <= 3; x ++) + for (y = 0; y <= a.yl; y ++) + for (z = 0; z <= (a.xl / 8); z ++) { + ; + offs = 5 + y * xw * 4 + xw * x + z; + sil[y][z] = aa[offs]; + } + + /* ...Mani. */ + + getimage(500, 50, 500 + a.xl, 50 + a.yl, aa); + + move(aa[5], mani, sizeof(mani)); } void explode(byte which) /* 0 is the first one! */ - /* Each character takes five-quarters of (a.size-6) on disk. */ -{ - byte fv,ff; word so1; /* size of one */ -; - {; - so1=a.size-6; so1 += so1 / 4; - seek(sf,183+soa+so1*which); /* First is at 221 */ -/* where:=filepos(sf);*/ - xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; - - for( fv=0; fv <= a.yl; fv ++) - blockread(sf,sil[fv],xw); - blockread(sf,mani,a.size-6); - aa[a.size-1]=0; aa[a.size]=0; /* footer */ - } -} - -void implode(byte which) /* Writes a pic back onto the disk */ +/* Each character takes five-quarters of (a.size-6) on disk. */ { - byte fv,ff; word so1; /* size of one */ -; - {; + byte fv, ff; + word so1; /* size of one */ + ; + { + ; + so1 = a.size - 6; + so1 += so1 / 4; + seek(sf, 183 + soa + so1 * which); /* First is at 221 */ + /* where:=filepos(sf);*/ + xw = a.xl / 8; + if ((a.xl % 8) > 0) xw += 1; + + for (fv = 0; fv <= a.yl; fv ++) + blockread(sf, sil[fv], xw); + blockread(sf, mani, a.size - 6); + aa[a.size - 1] = 0; + aa[a.size] = 0; /* footer */ + } +} - getsilmani(); /* Restore original arrays */ +void implode(byte which) { /* Writes a pic back onto the disk */ + byte fv, ff; + word so1; /* size of one */ + ; + { + ; - so1=a.size-6; so1 += so1 / 4; - seek(sf,183+soa+so1*which); /* First is at 221 */ + getsilmani(); /* Restore original arrays */ - xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; + so1 = a.size - 6; + so1 += so1 / 4; + seek(sf, 183 + soa + so1 * which); /* First is at 221 */ - for( fv=0; fv <= a.yl; fv ++) - blockwrite(sf,sil[fv],xw); - blockwrite(sf,mani,a.size-6); - aa[a.size-1]=0; aa[a.size]=0; /* footer */ - } + xw = a.xl / 8; + if ((a.xl % 8) > 0) xw += 1; + + for (fv = 0; fv <= a.yl; fv ++) + blockwrite(sf, sil[fv], xw); + blockwrite(sf, mani, a.size - 6); + aa[a.size - 1] = 0; + aa[a.size] = 0; /* footer */ + } } -void plotat(integer xx,integer yy) /* Does NOT cameo the picture!*/ -{; - move(mani,aa[5],sizeof(mani)); - {; - aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ - } - putimage(xx,yy,aa,0); +void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ + ; + move(mani, aa[5], sizeof(mani)); + { + ; + aa[1] = a.xl; + aa[2] = 0; + aa[3] = a.yl; + aa[4] = 0; /* set up x&y codes */ + } + putimage(xx, yy, aa, 0); } -void plotsil(integer xx,integer yy) /* Plots silhouette- rarely used */ -{ - byte x,y,z; word offs; -; - for( x=0; x <= 3; x ++) - for( y=0; y <= a.yl; y ++) - for( z=0; z <= (a.xl / 8); z ++) - {; - offs=5+y*xw*4+xw*x+z; - aa[offs]=sil[y][z]; - } - - {; - aa[1]=a.xl; aa[2]=0; aa[3]=a.yl; aa[4]=0; /* set up x&y codes */ - } - - putimage(xx,yy,aa,0); - -} - -void style(byte x) -{; - if (x==16) - /*setfillstyle(pattern,8)*/setfillpattern(grey50,8); - else - setfillstyle(1,x); -} - -void bigpixel(integer x,integer y) -{; - if (getpixel(500+x,150+y)==15) - /*setfillstyle(pattern,8)*/setfillpattern(grey50,8); - else - setfillstyle(1,getpixel(500+x,50+y)); - - bar(x*bigpix_gap,y*bigpix_gap, - x*bigpix_gap+bigpix_size,y*bigpix_gap+bigpix_size); -} - -void subplot(byte y, integer x, char c) -{; - setfillstyle(1,0); bar(x,0,x+9,170); outtextxy(x+5,y*10+5,c); -} - -void plotleft() {; subplot( leftc,239,'\32'); } /* palette arrows */ -void plotright() {; subplot(rightc,351,'\33'); } - -void plotbig(byte x,byte y,byte c) -{; - style(c); - bar(x*bigpix_gap,y*bigpix_gap, - x*bigpix_gap+bigpix_size,y*bigpix_gap+bigpix_size); - if (c==16) - {; - putpixel(500+x,150+y,15); - putpixel(500+x, 50+y,0); - } else - {; - putpixel(500+x,150+y,0); - putpixel(500+x, 50+y,c); - } -} - -void changepic() -{; - mx=mx / bigpix_gap; my=my / bigpix_gap; - if ((mx>a.xl) || (my>a.yl)) return; - if (mkey==left) - plotbig(mx,my,leftc); else - plotbig(mx,my,rightc); -} - -void changecol() -{; - my=my / 10; if (my>16) return; - if (mkey==left) - {; - leftc=my; plotleft(); - } else - {; - rightc=my; plotright(); - } -} - -void showcutpic() -{; - setfillstyle(5,1); bar(20,160,40+clipx,180+clipy); - putimage(30,170,clip[2],andput); - putimage(30,170,clip[1],xorput); -} - -void movesquare(integer& xc,integer& yc, integer xl,integer yl) -{ - integer x2,y2; -; - do { - x2=xl+xc; y2=yl+yc; - setcolor(15); - do { - rectangle(xc*bigpix_gap-1,yc*bigpix_gap-1, - x2*(bigpix_gap+1)-1,y2*(bigpix_gap+1)-1); - } while (!keypressed()); - setcolor(0); rectangle(xc*bigpix_gap-1,yc*bigpix_gap-1, - x2*(bigpix_gap+1)-1,y2*(bigpix_gap+1)-1); - switch (readkey()) { - case '\0': switch (readkey()) { - case '\110': yc -= 1; break; - case '\113': xc -= 1; break; - case '\115': xc += 1; break; - case '\120': yc += 1; break; - } - break; - case '\15': return; break; - } - while ((xl+xc)>a.xl) xc -= 1; - while ((yl+yc)>a.yl) yc -= 1; - if (xc<0) xc=0; - if (yc<0) yc=0; - } while (!false); -} - -void switch_(integer& v1,integer& v2) - /* Swaps over the values of v1 and v2. */ -{ - integer temp; -; - temp=v1; v1=v2; v2=temp; +void plotsil(integer xx, integer yy) { /* Plots silhouette- rarely used */ + byte x, y, z; + word offs; + ; + for (x = 0; x <= 3; x ++) + for (y = 0; y <= a.yl; y ++) + for (z = 0; z <= (a.xl / 8); z ++) { + ; + offs = 5 + y * xw * 4 + xw * x + z; + aa[offs] = sil[y][z]; + } + + { + ; + aa[1] = a.xl; + aa[2] = 0; + aa[3] = a.yl; + aa[4] = 0; /* set up x&y codes */ + } + + putimage(xx, yy, aa, 0); + } -void choosesquare(integer& x1,integer& y1,integer& x2,integer& y2) -{ - boolean tl; -; - do { - setcolor(15); - do { - rectangle(x1*bigpix_gap-1,y1*bigpix_gap-1, - (x2+1)*bigpix_gap-1,(y2+1)*bigpix_gap-1); - } while (!keypressed()); - setcolor(0); - rectangle(x1*bigpix_gap-1,y1*bigpix_gap-1, - (x2+1)*bigpix_gap-1,(y2+1)*bigpix_gap-1); - switch (readkey()) { - case '\0': switch (readkey()) { - case '\110': if (tl) y1 -= 1; else y2 -= 1; break; - case '\113': if (tl) x1 -= 1; else x2 -= 1; break; - case '\115': if (tl) x1 += 1; else x2 += 1; break; - case '\120': if (tl) y1 += 1; else y2 += 1; break; - } - break; - case '\11': tl=! tl; break; - case '\15': {; - if (x1>x2) switch_(x1,x2); /* Get the square the right way up. */ - if (y1>y2) switch_(y1,y2); - y2 -= y1; x2 -= x1; /* y1 & y2 have to be the OFFSETS! */ - return; - } - break; - } - if (x1<0) x1=0; if (y1<0) y1=0; - {; - if (y2>a.yl) y2=a.yl; if (x2>a.xl) x2=a.xl; - } - } while (!false); -} - -void paste() -{ - byte x,y; -; - if (! boardfull) - {; - output << '\7'; - return; - } - if (! ((clipx==a.xl) && (clipy==a.yl))) - movesquare(xofs,yofs,clipx,clipy); - putimage(500+xofs, 50+yofs,clip[1],0); - putimage(500+xofs,150+yofs,clip[2],0); - for( x=0; x <= a.xl; x ++) - for( y=0; y <= a.yl; y ++) - {; - bigpixel(x,y); - } -} - -void cut() -{; - xofs=0; yofs=0; /* From the TL. */ - {; - getimage(500, 50,500+a.xl, 50+a.yl,clip[1]); - getimage(500,150,500+a.xl,150+a.yl,clip[2]); - clipx=a.xl; clipy=a.yl; - } - showcutpic(); - boardfull=true; -} - -void cutsome() -{; - {; - choosesquare(xofs,yofs,clipx,clipy); - getimage(500+xofs, 50+yofs,500+xofs+clipx, 50+yofs+clipy,clip[1]); - getimage(500+xofs,150+yofs,500+xofs+clipx,150+yofs+clipy,clip[2]); - } - showcutpic(); - boardfull=true; -} - -boolean confirm(char c, string x) +void style(byte x) { + ; + if (x == 16) + /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); + else + setfillstyle(1, x); +} + +void bigpixel(integer x, integer y) { + ; + if (getpixel(500 + x, 150 + y) == 15) + /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); + else + setfillstyle(1, getpixel(500 + x, 50 + y)); + + bar(x * bigpix_gap, y * bigpix_gap, + x * bigpix_gap + bigpix_size, y * bigpix_gap + bigpix_size); +} + +void subplot(byte y, integer x, char c) { + ; + setfillstyle(1, 0); + bar(x, 0, x + 9, 170); + outtextxy(x + 5, y * 10 + 5, c); +} + +void plotleft() { + ; /* palette arrows */ + subplot(leftc, 239, '\32'); +} +void plotright() { + ; + subplot(rightc, 351, '\33'); +} + +void plotbig(byte x, byte y, byte c) { + ; + style(c); + bar(x * bigpix_gap, y * bigpix_gap, + x * bigpix_gap + bigpix_size, y * bigpix_gap + bigpix_size); + if (c == 16) { + ; + putpixel(500 + x, 150 + y, 15); + putpixel(500 + x, 50 + y, 0); + } else { + ; + putpixel(500 + x, 150 + y, 0); + putpixel(500 + x, 50 + y, c); + } +} + +void changepic() { + ; + mx = mx / bigpix_gap; + my = my / bigpix_gap; + if ((mx > a.xl) || (my > a.yl)) return; + if (mkey == left) + plotbig(mx, my, leftc); + else + plotbig(mx, my, rightc); +} + +void changecol() { + ; + my = my / 10; + if (my > 16) return; + if (mkey == left) { + ; + leftc = my; + plotleft(); + } else { + ; + rightc = my; + plotright(); + } +} + +void showcutpic() { + ; + setfillstyle(5, 1); + bar(20, 160, 40 + clipx, 180 + clipy); + putimage(30, 170, clip[2], andput); + putimage(30, 170, clip[1], xorput); +} + +void movesquare(integer &xc, integer &yc, integer xl, integer yl) { + integer x2, y2; + ; + do { + x2 = xl + xc; + y2 = yl + yc; + setcolor(15); + do { + rectangle(xc * bigpix_gap - 1, yc * bigpix_gap - 1, + x2 * (bigpix_gap + 1) - 1, y2 * (bigpix_gap + 1) - 1); + } while (!keypressed()); + setcolor(0); + rectangle(xc * bigpix_gap - 1, yc * bigpix_gap - 1, + x2 * (bigpix_gap + 1) - 1, y2 * (bigpix_gap + 1) - 1); + switch (readkey()) { + case '\0': + switch (readkey()) { + case '\110': + yc -= 1; + break; + case '\113': + xc -= 1; + break; + case '\115': + xc += 1; + break; + case '\120': + yc += 1; + break; + } + break; + case '\15': + return; + break; + } + while ((xl + xc) > a.xl) xc -= 1; + while ((yl + yc) > a.yl) yc -= 1; + if (xc < 0) xc = 0; + if (yc < 0) yc = 0; + } while (!false); +} + +void switch_(integer &v1, integer &v2) +/* Swaps over the values of v1 and v2. */ { - byte col; char groi; -boolean confirm_result; -; - while (keypressed()) groi=readkey(); - x=x+"? "+c+" to confirm."; - col=1; - do { - setcolor(col); outtextxy(555,5,x); - col += 1; if (col==16) col=1; - } while (!keypressed()); - confirm_result=upcase(readkey())==c; - setfillstyle(1,0); bar(470,0,640,10); -return confirm_result; + integer temp; + ; + temp = v1; + v1 = v2; + v2 = temp; +} + +void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { + boolean tl; + ; + do { + setcolor(15); + do { + rectangle(x1 * bigpix_gap - 1, y1 * bigpix_gap - 1, + (x2 + 1)*bigpix_gap - 1, (y2 + 1)*bigpix_gap - 1); + } while (!keypressed()); + setcolor(0); + rectangle(x1 * bigpix_gap - 1, y1 * bigpix_gap - 1, + (x2 + 1)*bigpix_gap - 1, (y2 + 1)*bigpix_gap - 1); + switch (readkey()) { + case '\0': + switch (readkey()) { + case '\110': + if (tl) y1 -= 1; + else y2 -= 1; + break; + case '\113': + if (tl) x1 -= 1; + else x2 -= 1; + break; + case '\115': + if (tl) x1 += 1; + else x2 += 1; + break; + case '\120': + if (tl) y1 += 1; + else y2 += 1; + break; + } + break; + case '\11': + tl = ! tl; + break; + case '\15': { + ; + if (x1 > x2) switch_(x1, x2); /* Get the square the right way up. */ + if (y1 > y2) switch_(y1, y2); + y2 -= y1; + x2 -= x1; /* y1 & y2 have to be the OFFSETS! */ + return; + } + break; + } + if (x1 < 0) x1 = 0; + if (y1 < 0) y1 = 0; + { + ; + if (y2 > a.yl) y2 = a.yl; + if (x2 > a.xl) x2 = a.xl; + } + } while (!false); } -void checkbutton(byte which) -{; - my=(my-12) / 25; - switch (my) { - case 0: if (confirm('S',"Save")) {; implode(which); lmo=true; } break; - case 1: if (confirm('C',"Cancel")) lmo=true; break; - case 4: cut(); break; - case 5: if (confirm('P',"Paste")) paste(); break; - case 6: cutsome(); break; - } +void paste() { + byte x, y; + ; + if (! boardfull) { + ; + output << '\7'; + return; + } + if (!((clipx == a.xl) && (clipy == a.yl))) + movesquare(xofs, yofs, clipx, clipy); + putimage(500 + xofs, 50 + yofs, clip[1], 0); + putimage(500 + xofs, 150 + yofs, clip[2], 0); + for (x = 0; x <= a.xl; x ++) + for (y = 0; y <= a.yl; y ++) { + ; + bigpixel(x, y); + } } -void animate() -{; +void cut() { + ; + xofs = 0; + yofs = 0; /* From the TL. */ + { + ; + getimage(500, 50, 500 + a.xl, 50 + a.yl, clip[1]); + getimage(500, 150, 500 + a.xl, 150 + a.yl, clip[2]); + clipx = a.xl; + clipy = a.yl; + } + showcutpic(); + boardfull = true; } -void undo() -{; +void cutsome() { + ; + { + ; + choosesquare(xofs, yofs, clipx, clipy); + getimage(500 + xofs, 50 + yofs, 500 + xofs + clipx, 50 + yofs + clipy, clip[1]); + getimage(500 + xofs, 150 + yofs, 500 + xofs + clipx, 150 + yofs + clipy, clip[2]); + } + showcutpic(); + boardfull = true; +} + +boolean confirm(char c, string x) { + byte col; + char groi; + boolean confirm_result; + ; + while (keypressed()) groi = readkey(); + x = x + "? " + c + " to confirm."; + col = 1; + do { + setcolor(col); + outtextxy(555, 5, x); + col += 1; + if (col == 16) col = 1; + } while (!keypressed()); + confirm_result = upcase(readkey()) == c; + setfillstyle(1, 0); + bar(470, 0, 640, 10); + return confirm_result; +} + +void checkbutton(byte which) { + ; + my = (my - 12) / 25; + switch (my) { + case 0: + if (confirm('S', "Save")) { + ; + implode(which); + lmo = true; + } + break; + case 1: + if (confirm('C', "Cancel")) lmo = true; + break; + case 4: + cut(); + break; + case 5: + if (confirm('P', "Paste")) paste(); + break; + case 6: + cutsome(); + break; + } +} + +void animate() { + ; +} + +void undo() { + ; } void fliplr(); -static void flipline(integer x1,integer x2,integer y) -{ - integer fv,ff; -; - for( fv=x1; fv <= x2; fv ++) putpixel(fv,0,getpixel(fv,y)); - ff=x2; - for( fv=x1; fv <= x2; fv ++) - {; - putpixel(fv,y,getpixel(ff,0)); - ff -= 1; - } -} - -void fliplr() /* Flips left-to-right. */ -{ - integer fv,ff; -; - for( fv=0; fv <= a.yl; fv ++) - {; - flipline(500,500+a.xl, 50+fv); - flipline(500,500+a.xl,150+fv); - } - for( fv=0; fv <= a.xl; fv ++) - for( ff=0; ff <= a.yl; ff ++) - bigpixel(fv,ff); -} - -void change_colours() /* Swaps one colour with another. */ -{ - byte fv,ff; -; +static void flipline(integer x1, integer x2, integer y) { + integer fv, ff; + ; + for (fv = x1; fv <= x2; fv ++) putpixel(fv, 0, getpixel(fv, y)); + ff = x2; + for (fv = x1; fv <= x2; fv ++) { + ; + putpixel(fv, y, getpixel(ff, 0)); + ff -= 1; + } +} - if ((leftc==16) || (rightc==16)) /* See-through can't be one of the colours. */ - {; - output << '\7'; /* Bleep! */ - return; - } +void fliplr() { /* Flips left-to-right. */ + integer fv, ff; + ; + for (fv = 0; fv <= a.yl; fv ++) { + ; + flipline(500, 500 + a.xl, 50 + fv); + flipline(500, 500 + a.xl, 150 + fv); + } + for (fv = 0; fv <= a.xl; fv ++) + for (ff = 0; ff <= a.yl; ff ++) + bigpixel(fv, ff); +} - for( fv=0; fv <= a.yl; fv ++) - for( ff=0; ff <= a.xl; ff ++) - if (getpixel(500+ff,50+fv)==leftc) - putpixel(500+ff,50+fv,rightc); +void change_colours() { /* Swaps one colour with another. */ + byte fv, ff; + ; - for( fv=0; fv <= a.xl; fv ++) - for( ff=0; ff <= a.yl; ff ++) - bigpixel(fv,ff); + if ((leftc == 16) || (rightc == 16)) { /* See-through can't be one of the colours. */ + ; + output << '\7'; /* Bleep! */ + return; + } + + for (fv = 0; fv <= a.yl; fv ++) + for (ff = 0; ff <= a.xl; ff ++) + if (getpixel(500 + ff, 50 + fv) == leftc) + putpixel(500 + ff, 50 + fv, rightc); + + for (fv = 0; fv <= a.xl; fv ++) + for (ff = 0; ff <= a.yl; ff ++) + bigpixel(fv, ff); } -void redraw() -{ - byte x,y; -; - setfillstyle(1,0); - bar(0,0,250,200); - - for( x=0; x <= a.xl; x ++) - for( y=0; y <= a.yl; y ++) - {; - bigpixel(x,y); - } -} - -void parse(char c) /* Parses keystrokes */ -{; - switch (upcase(c)) { - case '\26':case 'P': paste(); break; - case '\3':case 'C': cut(); break; - case '\30':case 'X': cutsome(); break; - case 'A': animate(); break; - case 'U': undo(); break; - case '@': fliplr(); break; - case '!': change_colours(); break; - case '<': if (bigpix_size>1) - {; - bigpix_size -= 1; bigpix_gap -= 1; - redraw(); - } - break; - case '>': if (bigpix_size<8) - {; - bigpix_size += 1; bigpix_gap += 1; - redraw(); - } - break; - case '\33': if (confirm('X',"Exit")) lmo=true; break; - } -} - -void editone(byte which) -{ - byte x,y; -; - cleardevice(); - explode(which); - plotat(500,50); - plotsil(500,150); - for( x=0; x <= a.xl; x ++) - for( y=0; y <= a.yl; y ++) - {; - bigpixel(x,y); - } - for( y=0; y <= 16; y ++) - {; - style(y); - bar(251,y*10+1,349,y*10+9); - rectangle(250,y*10,350,y*10+10); - } - - settextstyle(0,0,1); leftc=15; rightc=16; plotleft(); plotright(); lmo=false; - - outtextxy(410, 25,"Save"); - outtextxy(410, 50,"Cancel"); - outtextxy(410, 75,"Animate"); - outtextxy(410,100,"Undo"); - outtextxy(410,125,"Cut"); - outtextxy(410,150,"Paste"); - outtextxy(410,175,"X: Cut Some"); - if (boardfull) showcutpic(); - setfillstyle(6,15); - for( y=0; y <= 7; y ++) - bar(370,y*25+12,450,y*25+12); - - do { - on; - do { - if (keypressed()) parse(readkey()); - } while (!(anyo | lmo)); - off; - - if (! lmo) - {; - getbuttonstatus; - - switch (mx) { - case 1 ... 249: changepic(); break; - case 250 ... 350: changecol(); break; - case 370 ... 450: checkbutton(which); break; - } - } - } while (!lmo); - settextstyle(2,0,7); setcolor(15); +void redraw() { + byte x, y; + ; + setfillstyle(1, 0); + bar(0, 0, 250, 200); + + for (x = 0; x <= a.xl; x ++) + for (y = 0; y <= a.yl; y ++) { + ; + bigpixel(x, y); + } +} + +void parse(char c) { /* Parses keystrokes */ + ; + switch (upcase(c)) { + case '\26': + case 'P': + paste(); + break; + case '\3': + case 'C': + cut(); + break; + case '\30': + case 'X': + cutsome(); + break; + case 'A': + animate(); + break; + case 'U': + undo(); + break; + case '@': + fliplr(); + break; + case '!': + change_colours(); + break; + case '<': + if (bigpix_size > 1) { + ; + bigpix_size -= 1; + bigpix_gap -= 1; + redraw(); + } + break; + case '>': + if (bigpix_size < 8) { + ; + bigpix_size += 1; + bigpix_gap += 1; + redraw(); + } + break; + case '\33': + if (confirm('X', "Exit")) lmo = true; + break; + } +} + +void editone(byte which) { + byte x, y; + ; + cleardevice(); + explode(which); + plotat(500, 50); + plotsil(500, 150); + for (x = 0; x <= a.xl; x ++) + for (y = 0; y <= a.yl; y ++) { + ; + bigpixel(x, y); + } + for (y = 0; y <= 16; y ++) { + ; + style(y); + bar(251, y * 10 + 1, 349, y * 10 + 9); + rectangle(250, y * 10, 350, y * 10 + 10); + } + + settextstyle(0, 0, 1); + leftc = 15; + rightc = 16; + plotleft(); + plotright(); + lmo = false; + + outtextxy(410, 25, "Save"); + outtextxy(410, 50, "Cancel"); + outtextxy(410, 75, "Animate"); + outtextxy(410, 100, "Undo"); + outtextxy(410, 125, "Cut"); + outtextxy(410, 150, "Paste"); + outtextxy(410, 175, "X: Cut Some"); + if (boardfull) showcutpic(); + setfillstyle(6, 15); + for (y = 0; y <= 7; y ++) + bar(370, y * 25 + 12, 450, y * 25 + 12); + + do { + on; + do { + if (keypressed()) parse(readkey()); + } while (!(anyo | lmo)); + off; + + if (! lmo) { + ; + getbuttonstatus; + + switch (mx) { + case 1 ... 249: + changepic(); + break; + case 250 ... 350: + changecol(); + break; + case 370 ... 450: + checkbutton(which); + break; + } + } + } while (!lmo); + settextstyle(2, 0, 7); + setcolor(15); } void editstride(byte which); @@ -759,125 +955,142 @@ static char whichc; static shortint first; -static void drawup(byte& which) -{ - byte fv; -; - whichc=chr(which+48); - cleardevice(); - outtextxy(320,10,string("Edit stride ")+whichc); - first=(which-1)*a.seq-1; - for( fv=1; fv <= a.seq; fv ++) - {; - explode(fv+first); - plotat(fv*73,77); - outtextxy(17+fv*73,64,chr(fv+48)); - } - outtextxy(320,177,"Which?"); -} - -void editstride(byte which) -{ - char r; -; - drawup(which); - do { - r=readkey(); - if ((r>'0') && (r<=chr(a.seq+48))) - {; - editone(ord(r)-48+first); - drawup(which); - } - } while (!(r=='\33')); +static void drawup(byte &which) { + byte fv; + ; + whichc = chr(which + 48); + cleardevice(); + outtextxy(320, 10, string("Edit stride ") + whichc); + first = (which - 1) * a.seq - 1; + for (fv = 1; fv <= a.seq; fv ++) { + ; + explode(fv + first); + plotat(fv * 73, 77); + outtextxy(17 + fv * 73, 64, chr(fv + 48)); + } + outtextxy(320, 177, "Which?"); +} + +void editstride(byte which) { + char r; + ; + drawup(which); + do { + r = readkey(); + if ((r > '0') && (r <= chr(a.seq + 48))) { + ; + editone(ord(r) - 48 + first); + drawup(which); + } + } while (!(r == '\33')); } void editpics(); static byte nds; /* num div seq */ -static void drawup1() -{ - byte fv; -; - setgraphmode(0); directvideo=false; settextjustify(1,1); - nds=a.num / a.seq; - settextstyle(2,0,7); - outtextxy(320,10,"Edit pictures..."); - outtextxy(320,40,"(Usually, 1=away, 2=right, 3=towards, 4=left.)"); - for( fv=1; fv <= nds; fv ++) - {; - explode((fv-1)*a.seq); - plotat(fv*73,100); - outtextxy(17+fv*73,87,chr(fv+48)); - } - outtextxy(320,60,string("There are ")+strf(nds)+" strides available."); - outtextxy(320,177,"Which do you want?"); -} - -void editpics() -{ - char r; byte which; integer e; -; - drawup1(); - do { - r=readkey(); - if ((r>'0') && (r<=chr(nds+48))) - {; - editstride(ord(r)-48); - drawup1(); - } - } while (!(r=='\33')); - restorecrtmode(); -} - -void titles() -{ - integer gd,gm; - char pak; word wait; -; - gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); - settextstyle(5,0,10); settextjustify(1,1); - gm=getmaxy() / 2; wait=0; - do { - for( gm=0; gm <= 15; gm ++) - {; - setcolor(15-gm); - for( gd=0; gd <= (150-gm*10); gd ++) - {; - outtextxy(320,124-gd,"Spread 2"); - outtextxy(320,125+gd,"Spread 2"); - if ((gd==5) && (gm==0)) wait=2345; - if ((gd==6) && (gm==0)) wait=0; - do { - if (keypressed()) - {; - while (keypressed()) pak=readkey(); - restorecrtmode(); - return; - } - if (wait>0) {; wait -= 1; delay(1); } - } while (!(wait==0)); - } - } - } while (!false); -} - -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - titles(); - setup(); - do { - status(); - r=upcase(readkey()); - switch (r) { - case 'A': editadx(); break; - case 'P': editpics(); break; - case 'S': saveit(); break; - case 'X':case '\33': quit(); break; - } - } while (!false); -return EXIT_SUCCESS; +static void drawup1() { + byte fv; + ; + setgraphmode(0); + directvideo = false; + settextjustify(1, 1); + nds = a.num / a.seq; + settextstyle(2, 0, 7); + outtextxy(320, 10, "Edit pictures..."); + outtextxy(320, 40, "(Usually, 1=away, 2=right, 3=towards, 4=left.)"); + for (fv = 1; fv <= nds; fv ++) { + ; + explode((fv - 1)*a.seq); + plotat(fv * 73, 100); + outtextxy(17 + fv * 73, 87, chr(fv + 48)); + } + outtextxy(320, 60, string("There are ") + strf(nds) + " strides available."); + outtextxy(320, 177, "Which do you want?"); +} + +void editpics() { + char r; + byte which; + integer e; + ; + drawup1(); + do { + r = readkey(); + if ((r > '0') && (r <= chr(nds + 48))) { + ; + editstride(ord(r) - 48); + drawup1(); + } + } while (!(r == '\33')); + restorecrtmode(); +} + +void titles() { + integer gd, gm; + char pak; + word wait; + ; + gd = 3; + gm = 1; + initgraph(gd, gm, "c:\\bp\\bgi"); + settextstyle(5, 0, 10); + settextjustify(1, 1); + gm = getmaxy() / 2; + wait = 0; + do { + for (gm = 0; gm <= 15; gm ++) { + ; + setcolor(15 - gm); + for (gd = 0; gd <= (150 - gm * 10); gd ++) { + ; + outtextxy(320, 124 - gd, "Spread 2"); + outtextxy(320, 125 + gd, "Spread 2"); + if ((gd == 5) && (gm == 0)) wait = 2345; + if ((gd == 6) && (gm == 0)) wait = 0; + do { + if (keypressed()) { + ; + while (keypressed()) pak = readkey(); + restorecrtmode(); + return; + } + if (wait > 0) { + ; + wait -= 1; + delay(1); + } + } while (!(wait == 0)); + } + } + } while (!false); +} + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + titles(); + setup(); + do { + status(); + r = upcase(readkey()); + switch (r) { + case 'A': + editadx(); + break; + case 'P': + editpics(); + break; + case 'S': + saveit(); + break; + case 'X': + case '\33': + quit(); + break; + } + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index 231aae2168d5..fc49a5e7f1c5 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -44,12 +44,12 @@ const integer empty = -3 /* Indicates empty */; typedef varying_string<255> anystr/* General string type */; - /* One node in parsing table. */ +/* One node in parsing table. */ struct string_table_entry { - boolean used /* Is this node used yet? */; - integer prevchar /* Code for preceding string */; - integer follchar /* Code for current character */; - integer next /* Next dupl in collision list */; + boolean used /* Is this node used yet? */; + integer prevchar /* Code for preceding string */; + integer follchar /* Code for current character */; + integer next /* Next dupl in collision list */; }; untyped_file input_file /* Input file */; @@ -57,15 +57,15 @@ untyped_file output_file /* Output file */; integer inbufsize /* Count of chars in input buffer */; -array<1,maxbuff,byte> input_buffer /* Input buffer area */; -array<1,maxbuff,byte> output_buffer /* Output buffer area */; +array<1, maxbuff, byte> input_buffer /* Input buffer area */; +array<1, maxbuff, byte> output_buffer /* Output buffer area */; integer input_pos /* Cur. pos. in input buffer */; integer output_pos /* Cur. pos. in output buffer */; - /* String table */ +/* String table */ -array<0,maxtab,string_table_entry> string_table; +array<0, maxtab, string_table_entry> string_table; integer table_used /* # string table entries used */; integer output_code /* Output compressed code */; @@ -73,25 +73,28 @@ integer input_code /* Input compressed code */; boolean if_compressing /* TRUE if compressing file */; integer ierr /* Input/output error */; -string header; varying_string<30> describe; byte method; +string header; +varying_string<30> describe; +byte method; void terminate() -{ /* Terminate */ - /* Write any remaining characters */ - /* to output file. */ - if ( output_pos > 0 ) - blockwrite( output_file, output_buffer, output_pos ); +{ + /* Terminate */ + /* Write any remaining characters */ + /* to output file. */ + if (output_pos > 0) + blockwrite(output_file, output_buffer, output_pos); - ierr = ioresult; - /* Close input and output files */ - close( input_file ); - ierr = ioresult; + ierr = ioresult; + /* Close input and output files */ + close(input_file); + ierr = ioresult; - close( output_file ); - ierr = ioresult; + close(output_file); + ierr = ioresult; - output << "done." << NL; + output << "done." << NL; } /* Terminate */ @@ -99,90 +102,90 @@ void terminate() /* Get_Hash_Code --- Gets hash code for given C string */ /*--------------------------------------------------------------------------*/ -integer get_hash_code( integer prevc, integer follc ) +integer get_hash_code(integer prevc, integer follc) { - integer index; - integer index2; + integer index; + integer index2; - /* Get_Hash_Code */ - /* Get initial index using hashing */ + /* Get_Hash_Code */ + /* Get initial index using hashing */ - integer get_hash_code_result; - index = ( ( prevc << 5 ) ^ follc ) & maxtab; + integer get_hash_code_result; + index = ((prevc << 5) ^ follc) & maxtab; - /* If entry not already used, return */ - /* its index as hash code for C. */ + /* If entry not already used, return */ + /* its index as hash code for C. */ - if ( ! string_table[index].used ) - get_hash_code_result = index; - else - /* If entry already used, search to */ - /* end of list of hash collision */ - /* entries for this hash code. */ - /* Do linear probe to find an */ - /* available slot. */ - { + if (! string_table[index].used) + get_hash_code_result = index; + else + /* If entry already used, search to */ + /* end of list of hash collision */ + /* entries for this hash code. */ + /* Do linear probe to find an */ + /* available slot. */ + { - /* Skip to end of collision list ... */ + /* Skip to end of collision list ... */ - while ( string_table[index].next != end_list ) - index = string_table[index].next; + while (string_table[index].next != end_list) + index = string_table[index].next; - /* Begin linear probe down a bit from */ - /* last entry in collision list ... */ + /* Begin linear probe down a bit from */ + /* last entry in collision list ... */ - index2 = ( index + 101 ) & maxtab; + index2 = (index + 101) & maxtab; - /* Look for unused entry using linear */ - /* probing ... */ + /* Look for unused entry using linear */ + /* probing ... */ - while ( string_table[index2].used ) - index2 = succ(integer, index2 ) & maxtab; + while (string_table[index2].used) + index2 = succ(integer, index2) & maxtab; - /* Point prior end of collision list */ - /* to this new node. */ + /* Point prior end of collision list */ + /* to this new node. */ - string_table[index].next = index2; + string_table[index].next = index2; - /* Return hash code for C */ + /* Return hash code for C */ - get_hash_code_result = index2; + get_hash_code_result = index2; - } + } - return get_hash_code_result; + return get_hash_code_result; } /* Get_Hash_Code */ /*--------------------------------------------------------------------------*/ /* Make_Table_Entry --- Enter C string in string table */ /*--------------------------------------------------------------------------*/ -void make_table_entry( integer prevc, integer follc ) - -{ /* Make_Table_Entry */ - /* Only enter string if there is room left */ - - if ( table_used <= maxtab ) - { - { - string_table_entry& with = string_table[ get_hash_code( prevc , follc ) ]; +void make_table_entry(integer prevc, integer follc) - with.used = true; - with.next = end_list; - with.prevchar = prevc; - with.follchar = follc; - } - /* Increment count of items used */ - - table_used += 1; -/* - IF ( Table_Used > ( MaxTab + 1 ) ) THEN - BEGIN - WRITELN('Hash table full.'); - END; -*/ - } +{ + /* Make_Table_Entry */ + /* Only enter string if there is room left */ + + if (table_used <= maxtab) { + { + string_table_entry &with = string_table[ get_hash_code(prevc , follc) ]; + + with.used = true; + with.next = end_list; + with.prevchar = prevc; + with.follchar = follc; + } + /* Increment count of items used */ + + table_used += 1; + /* + IF ( Table_Used > ( MaxTab + 1 ) ) THEN + BEGIN + WRITELN('Hash table full.'); + END; + */ + } } /* Make_Table_Entry */ @@ -193,26 +196,25 @@ void make_table_entry( integer prevc, integer follc ) void initialize_string_table() { - integer i; - - /* Initialize_String_Table */ - - /* No entries used in table yet */ - table_used = 0; - /* Clear all table entries */ - for( i = 0; i <= maxtab; i ++) - { - string_table_entry& with = string_table[i]; - - with.prevchar = no_prev; - with.follchar = no_prev; - with.next = -1; - with.used = false; - } - /* Enter all single characters into */ - /* table */ - for( i = 0; i <= 255; i ++) - make_table_entry( no_prev , i ); + integer i; + + /* Initialize_String_Table */ + + /* No entries used in table yet */ + table_used = 0; + /* Clear all table entries */ + for (i = 0; i <= maxtab; i ++) { + string_table_entry &with = string_table[i]; + + with.prevchar = no_prev; + with.follchar = no_prev; + with.next = -1; + with.used = false; + } + /* Enter all single characters into */ + /* table */ + for (i = 0; i <= 255; i ++) + make_table_entry(no_prev , i); } /* Initialize_String_Table */ @@ -223,60 +225,61 @@ void initialize_string_table() void initialize() { - anystr input_name /* Input file name */; - anystr output_name /* Output file name */; - - /* Initialize */ - - output << "Number of file to compress:"; input >> input_name >> NL; - output << "For the moment, I'm writing the compressed version to v:compr" << - input_name << ".avd." << NL; - output_name=string("d:compr")+input_name+".avd"; - input_name=string("d:place")+input_name+".avd"; - - output << "Wait... "; - - /* Open input file */ - - assign ( input_file , input_name ); - reset ( input_file , 1 ); - ierr = ioresult; - - blockread(input_file,header,146); - blockread(input_file,describe,30); - blockread(input_file,method,1); - - if (method==177) - {; - output << "It's already compressed!" << NL; - exit(177); - } - - /* Open output file */ - - assign ( output_file , output_name ); - rewrite( output_file , 1 ); - ierr = ioresult; - - method=177; - - blockwrite(output_file,header,146); - blockwrite(output_file,describe,30); - blockwrite(output_file,method,1); - - /* Point input point past end of */ - /* buffer to force initial read */ - input_pos = maxbuff + 1; - /* Nothing written out yet */ - output_pos = 0; - /* Nothing read in yet */ - inbufsize = 0; - /* No input or output codes yet */ - /* constructed */ - output_code = empty; - input_code = empty; - /* Initialize string hash table */ - initialize_string_table(); + anystr input_name /* Input file name */; + anystr output_name /* Output file name */; + + /* Initialize */ + + output << "Number of file to compress:"; + input >> input_name >> NL; + output << "For the moment, I'm writing the compressed version to v:compr" << + input_name << ".avd." << NL; + output_name = string("d:compr") + input_name + ".avd"; + input_name = string("d:place") + input_name + ".avd"; + + output << "Wait... "; + + /* Open input file */ + + assign(input_file , input_name); + reset(input_file , 1); + ierr = ioresult; + + blockread(input_file, header, 146); + blockread(input_file, describe, 30); + blockread(input_file, method, 1); + + if (method == 177) { + ; + output << "It's already compressed!" << NL; + exit(177); + } + + /* Open output file */ + + assign(output_file , output_name); + rewrite(output_file , 1); + ierr = ioresult; + + method = 177; + + blockwrite(output_file, header, 146); + blockwrite(output_file, describe, 30); + blockwrite(output_file, method, 1); + + /* Point input point past end of */ + /* buffer to force initial read */ + input_pos = maxbuff + 1; + /* Nothing written out yet */ + output_pos = 0; + /* Nothing read in yet */ + inbufsize = 0; + /* No input or output codes yet */ + /* constructed */ + output_code = empty; + input_code = empty; + /* Initialize string hash table */ + initialize_string_table(); } /* Initialize */ @@ -284,66 +287,66 @@ void initialize() /* Lookup_String --- Look for string C in string table */ /*--------------------------------------------------------------------------*/ -integer lookup_string( integer prevc, integer follc ) +integer lookup_string(integer prevc, integer follc) { - integer index; - integer index2; - boolean found; + integer index; + integer index2; + boolean found; - /* Lookup_String */ - /* Initialize index to check from hash */ + /* Lookup_String */ + /* Initialize index to check from hash */ - integer lookup_string_result; - index = ( ( prevc << 5 ) ^ follc ) & maxtab; + integer lookup_string_result; + index = ((prevc << 5) ^ follc) & maxtab; - /* Assume we won't find string */ - lookup_string_result = end_list; - /* Search through list of hash collision */ - /* entries for one that matches C */ - do { + /* Assume we won't find string */ + lookup_string_result = end_list; + /* Search through list of hash collision */ + /* entries for one that matches C */ + do { - found = ( string_table[index].prevchar == prevc ) && - ( string_table[index].follchar == follc ); + found = (string_table[index].prevchar == prevc) && + (string_table[index].follchar == follc); - if ( ! found ) - index = string_table[index].next; + if (! found) + index = string_table[index].next; - } while (!(found || ( index == end_list ))); + } while (!(found || (index == end_list))); - /* Return index if C found in table. */ - if (found) - lookup_string_result = index; + /* Return index if C found in table. */ + if (found) + lookup_string_result = index; - return lookup_string_result; + return lookup_string_result; } /* Lookup_String */ /*--------------------------------------------------------------------------*/ /* Get_Char --- Read character from input file */ /*--------------------------------------------------------------------------*/ -void get_char( integer& c ) - -{ /* Get_Char */ - /* Point to next character in buffer */ - input_pos += 1; - /* If past end of block read in, then */ - /* reset input pointer and read in */ - /* next block. */ - - if ( input_pos > inbufsize ) - { - blockread( input_file, input_buffer, maxbuff, inbufsize ); - input_pos = 1; - ierr = ioresult; - } - /* If end of file hit, return EOF_Char */ - /* otherwise return next character in */ - /* input buffer. */ - if ( inbufsize == 0 ) - c = eof_char; - else - c = input_buffer[input_pos]; +void get_char(integer &c) + +{ + /* Get_Char */ + /* Point to next character in buffer */ + input_pos += 1; + /* If past end of block read in, then */ + /* reset input pointer and read in */ + /* next block. */ + + if (input_pos > inbufsize) { + blockread(input_file, input_buffer, maxbuff, inbufsize); + input_pos = 1; + ierr = ioresult; + } + /* If end of file hit, return EOF_Char */ + /* otherwise return next character in */ + /* input buffer. */ + if (inbufsize == 0) + c = eof_char; + else + c = input_buffer[input_pos]; } /* Get_Char */ @@ -351,23 +354,23 @@ void get_char( integer& c ) /* Write_Char --- Write character to output file */ /*--------------------------------------------------------------------------*/ -void put_char( integer c ) +void put_char(integer c) -{ /* Put_Char */ - /* If buffer full, write it out and */ - /* reset output buffer pointer. */ +{ + /* Put_Char */ + /* If buffer full, write it out and */ + /* reset output buffer pointer. */ - if ( output_pos >= maxbuff ) - { - blockwrite( output_file, output_buffer, maxbuff ); - output_pos = 0; - ierr = ioresult; - } - /* Place character in next slot in */ - /* output buffer. */ + if (output_pos >= maxbuff) { + blockwrite(output_file, output_buffer, maxbuff); + output_pos = 0; + ierr = ioresult; + } + /* Place character in next slot in */ + /* output buffer. */ - output_pos += 1; - output_buffer[output_pos] = c; + output_pos += 1; + output_buffer[output_pos] = c; } /* Put_Char */ @@ -375,31 +378,30 @@ void put_char( integer c ) /* Put_Code --- Write hash code to output file. */ /*--------------------------------------------------------------------------*/ -void put_code( integer hash_code ) - -{ /* Put_Code */ - /* Output code word is empty. */ - /* Put out 1st 8 bits of compression */ - /* code and save last 4 bit for next */ - /* time through. */ - - if ( output_code == empty ) - { - put_char( ( (cardinal)hash_code >> 4 ) & 0xff ); - output_code = hash_code & 0xf; - } - else - /* Output code word not empty. */ - /* Put out last 4 bits of previous */ - /* code appended to 1st 4 bits of this */ - /* code. Then put out last 8 bits of */ - /* this code. */ - { - put_char( ( ( output_code << 4 ) & 0xff0 ) + - ( ( (cardinal)hash_code >> 8 ) & 0xf ) ); - put_char( hash_code & 0xff ); - output_code = empty; - } +void put_code(integer hash_code) + +{ + /* Put_Code */ + /* Output code word is empty. */ + /* Put out 1st 8 bits of compression */ + /* code and save last 4 bit for next */ + /* time through. */ + + if (output_code == empty) { + put_char(((cardinal)hash_code >> 4) & 0xff); + output_code = hash_code & 0xf; + } else + /* Output code word not empty. */ + /* Put out last 4 bits of previous */ + /* code appended to 1st 4 bits of this */ + /* code. Then put out last 8 bits of */ + /* this code. */ + { + put_char(((output_code << 4) & 0xff0) + + (((cardinal)hash_code >> 8) & 0xf)); + put_char(hash_code & 0xff); + output_code = empty; + } } /* Put_Code */ @@ -410,53 +412,50 @@ void put_code( integer hash_code ) void do_compression() { - integer c /* Current input character = C */; - integer wc /* Hash code value for C */; - integer w /* Hash code value for */; + integer c /* Current input character = C */; + integer wc /* Hash code value for C */; + integer w /* Hash code value for */; - /* Do_Compression */ - /* Read first character ==> Step 2 */ - get_char( c ); - /* Initial hash code -- first character */ - /* has no previous string ( is null) */ + /* Do_Compression */ + /* Read first character ==> Step 2 */ + get_char(c); + /* Initial hash code -- first character */ + /* has no previous string ( is null) */ - w = lookup_string( no_prev , c ); + w = lookup_string(no_prev , c); - /* Get next character ==> Step 3 */ - get_char( c ); - /* Loop over input characters until */ - /* end of file reached ==> Step 4. */ - while( c != eof_char ) - { - /* See if C is in table. */ + /* Get next character ==> Step 3 */ + get_char(c); + /* Loop over input characters until */ + /* end of file reached ==> Step 4. */ + while (c != eof_char) { + /* See if C is in table. */ - wc = lookup_string( w , c ); + wc = lookup_string(w , c); - /* If C is not in the table, */ - /* enter it into the table and */ - /* output . Reset to */ - /* be the code for C ==> Step 6 */ + /* If C is not in the table, */ + /* enter it into the table and */ + /* output . Reset to */ + /* be the code for C ==> Step 6 */ - if ( wc == end_list ) - { + if (wc == end_list) { - make_table_entry( w , c ); - put_code( w ); - w = lookup_string( no_prev , c ); + make_table_entry(w , c); + put_code(w); + w = lookup_string(no_prev , c); - } - else /* If C is in table, keep looking */ - /* for longer strings == Step 5 */ + } else /* If C is in table, keep looking */ + /* for longer strings == Step 5 */ - w = wc; + w = wc; - /* Get next input character ==> Step 3 */ - get_char( c ); + /* Get next input character ==> Step 3 */ + get_char(c); - } - /* Make sure last code is */ - /* written out ==> Step 4. */ - put_code( w ); + } + /* Make sure last code is */ + /* written out ==> Step 4. */ + put_code(w); } /* Do_Compression */ @@ -464,19 +463,19 @@ void do_compression() /* PibCompr --- Main program */ /*--------------------------------------------------------------------------*/ -int main(int argc, const char* argv[]) -{ /* PibCompr */ - /* We are doing compression */ - pio_initialize(argc, argv); - if_compressing = true; - /* Initialize compression */ - initialize(); - /* Perform compression */ - do_compression(); - /* Clean up and exit */ - terminate(); - - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + /* PibCompr */ + /* We are doing compression */ + pio_initialize(argc, argv); + if_compressing = true; + /* Initialize compression */ + initialize(); + /* Perform compression */ + do_compression(); + /* Clean up and exit */ + terminate(); + + return EXIT_SUCCESS; } /* PibCompr */ } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index 907c09f91c59..04f0da9e6b1b 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,34 +33,40 @@ namespace Avalanche { byte fv; boolean test; -boolean the_cows_come_home() -{ - registers rmove,rclick; -boolean the_cows_come_home_result; -; - rmove.ax=11; intr(0x33,rmove); - rclick.ax=3; intr(0x33,rclick); - the_cows_come_home_result= - (keypressed()) | /* key pressed */ - (rmove.cx>0) || /* mouse moved */ - (rmove.dx>0) || - (rclick.bx>0); /* button clicked */ -return the_cows_come_home_result; +boolean the_cows_come_home() { + registers rmove, rclick; + boolean the_cows_come_home_result; + ; + rmove.ax = 11; + intr(0x33, rmove); + rclick.ax = 3; + intr(0x33, rclick); + the_cows_come_home_result = + (keypressed()) | /* key pressed */ + (rmove.cx > 0) || /* mouse moved */ + (rmove.dx > 0) || + (rclick.bx > 0); /* button clicked */ + return the_cows_come_home_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - test=the_cows_come_home(); - textattr=0; clrscr; - do {; } while (!the_cows_come_home()); - textattr=30; clrscr; - output << "*** Blank Screen *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; - for( fv=1; fv <= 46; fv ++) output << '~'; output << NL; - output << "This program may be freely copied." << NL; - output << NL; - output << "Have fun!" << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + test = the_cows_come_home(); + textattr = 0; + clrscr; + do { + ; + } while (!the_cows_come_home()); + textattr = 30; + clrscr; + output << "*** Blank Screen *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; + for (fv = 1; fv <= 46; fv ++) output << '~'; + output << NL; + output << "This program may be freely copied." << NL; + output << NL; + output << "Have fun!" << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index b73576506be0..aa74b806ed7c 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -35,77 +35,100 @@ namespace Avalanche { const integer width = 88; const integer height = 8; /* width & height of string returned by "time" */ -integer gd,gm; -integer xx,yy; -shortint ix,iy; +integer gd, gm; +integer xx, yy; +shortint ix, iy; byte cp; byte count; -array<0,1,pointtype> pages; +array<0, 1, pointtype> pages; boolean test; -boolean the_cows_come_home() -{ - registers rmove,rclick; -boolean the_cows_come_home_result; -; - rmove.ax=11; intr(0x33,rmove); - rclick.ax=3; intr(0x33,rclick); - the_cows_come_home_result= - (keypressed()) || /* key pressed */ - (rmove.cx>0) || /* mouse moved */ - (rmove.dx>0) || - (rclick.bx>0); /* button clicked */ -return the_cows_come_home_result; +boolean the_cows_come_home() { + registers rmove, rclick; + boolean the_cows_come_home_result; + ; + rmove.ax = 11; + intr(0x33, rmove); + rclick.ax = 3; + intr(0x33, rclick); + the_cows_come_home_result = + (keypressed()) || /* key pressed */ + (rmove.cx > 0) || /* mouse moved */ + (rmove.dx > 0) || + (rclick.bx > 0); /* button clicked */ + return the_cows_come_home_result; } -string time1() -{ - word h,m,s,s1; varying_string<2> hh,mm,ss; char ampm; -string time1_result; -; - gettime(h,m,s,s1); - if (h<12) - ampm='a'; - else {; - ampm='p'; - if (h==0) h=12; else h -= 12; /* 24-hr adjustment */ - } - str(h,2,hh); str(m,2,mm); str(s,2,ss); /* stringify them */ - time1_result=hh+'.'+mm+'.'+ss+' '+ampm+'m'; -return time1_result; +string time1() { + word h, m, s, s1; + varying_string<2> hh, mm, ss; + char ampm; + string time1_result; + ; + gettime(h, m, s, s1); + if (h < 12) + ampm = 'a'; + else { + ; + ampm = 'p'; + if (h == 0) h = 12; + else h -= 12; /* 24-hr adjustment */ + } + str(h, 2, hh); + str(m, 2, mm); + str(s, 2, ss); /* stringify them */ + time1_result = hh + '.' + mm + '.' + ss + ' ' + ampm + 'm'; + return time1_result; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - test=the_cows_come_home(); - gm=registerbgidriver(&egavgadriverproc); - gd=3; gm=1; initgraph(gd,gm,""); - ix=3; iy=1; xx=177; yy=177; setcolor(11); cp=0; - setfillstyle(1,0); count=2; - do { - setactivepage(cp); setvisualpage(1-cp); cp=1-cp; - delay(20); if (count>0) count -= 1; - { - pointtype& with = pages[cp]; - ; - if (count==0) - bar(with.x,with.y,with.x+width,with.y+height); - with.x=xx; with.y=yy; /* update record for next time */ - } - outtextxy(xx,yy,time1()); - xx=xx+ix; yy=yy+iy; - if (xx<= 10) ix=Random(9)+1; if (xx>=629-width) ix=-Random(9)+1; - if (yy<= 10) iy=Random(9)+1; if (yy>=339-height) iy=-Random(9)+1; - } while (!the_cows_come_home()); - closegraph(); - textattr=30; clrscr; - output << "*** Bouncing Clock *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; - for( gd=1; gd <= 48; gd ++) output << '~'; output << NL; - output << "This program may be freely copied." << NL; - output << NL; - output << "Have fun!" << NL; -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + test = the_cows_come_home(); + gm = registerbgidriver(&egavgadriverproc); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + ix = 3; + iy = 1; + xx = 177; + yy = 177; + setcolor(11); + cp = 0; + setfillstyle(1, 0); + count = 2; + do { + setactivepage(cp); + setvisualpage(1 - cp); + cp = 1 - cp; + delay(20); + if (count > 0) count -= 1; + { + pointtype &with = pages[cp]; + ; + if (count == 0) + bar(with.x, with.y, with.x + width, with.y + height); + with.x = xx; + with.y = yy; /* update record for next time */ + } + outtextxy(xx, yy, time1()); + xx = xx + ix; + yy = yy + iy; + if (xx <= 10) ix = Random(9) + 1; + if (xx >= 629 - width) ix = -Random(9) + 1; + if (yy <= 10) iy = Random(9) + 1; + if (yy >= 339 - height) iy = -Random(9) + 1; + } while (!the_cows_come_home()); + closegraph(); + textattr = 30; + clrscr; + output << "*** Bouncing Clock *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; + for (gd = 1; gd <= 48; gd ++) output << '~'; + output << NL; + output << "This program may be freely copied." << NL; + output << NL; + output << "Have fun!" << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index aaeada2a3682..83490de6d590 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,21 +34,22 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -typedef matrix<'\0','\377',0,15,byte> fonttype; +typedef matrix < '\0', '\377', 0, 15, byte > fonttype; boolean reverse; word spinnum; -array<0,1,fonttype> f; +array<0, 1, fonttype> f; file ff; -array<0,7,0,15,0,79,byte> strip; +array<0, 7, 0, 15, 0, 79, byte> strip; byte across; -word w; byte y; +word w; +byte y; byte charnum; byte cfont; /* current font. 0=roman, 1=italic. */ -char* c; +char *c; boolean nomusic; @@ -56,309 +57,328 @@ const integer colours = 12; /* Run Workout to see possible values of these two. const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ const integer gmtop = 360 / steps; - const integer scardcount = 13; - - const array<0,scardcount-1,integer> soundcards = - {{1,2,6,3,4,5,8,9,10,7,7,7,7}}; - -/*$L credits.obj*/ extern void credits(); - -void bigo2(string date) -{ - integer gd,gm; - byte c; - palettetype p; - untyped_file f; pointer pp; word s; - - - getpalette(p); - setvisualpage(1); setactivepage(0); - assign(f,"logo.avd"); reset(f,1); - for( gd=7; gd <= 194; gd ++) - blockread(f,mem[0xa000*(gd*80)],53); - close(f); - s=imagesize(0,7,415,194); getmem(pp,s); getimage(0,7,415,194,pp); - - cleardevice(); - for( gd=1; gd <= 64; gd ++) - { - for( gm=0; gm <= gmtop; gm ++) - { - c=(c % colours)+1; -/* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, - trunc(cos(gm*steps*n)*gd*3)+175,c); */ - if (c>5) continue_; - setcolor(c); arc(320,175,gm*steps,gm*steps+1,gd*6); - } - if (keypressed()) { closegraph(); exit(0); } - } - settextstyle(0,0,1); setcolor(13); - outtextxy(550,343,"(press any key)"); - - putimage(112,0,pp,orput); freemem(pp,s); - resetmouse; setvisualpage(0); +const integer scardcount = 13; + +const array < 0, scardcount - 1, integer > soundcards = +{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; + +/*$L credits.obj*/ extern void credits(); + +void bigo2(string date) { + integer gd, gm; + byte c; + palettetype p; + untyped_file f; + pointer pp; + word s; + + + getpalette(p); + setvisualpage(1); + setactivepage(0); + assign(f, "logo.avd"); + reset(f, 1); + for (gd = 7; gd <= 194; gd ++) + blockread(f, mem[0xa000 * (gd * 80)], 53); + close(f); + s = imagesize(0, 7, 415, 194); + getmem(pp, s); + getimage(0, 7, 415, 194, pp); + + cleardevice(); + for (gd = 1; gd <= 64; gd ++) { + for (gm = 0; gm <= gmtop; gm ++) { + c = (c % colours) + 1; + /* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, + trunc(cos(gm*steps*n)*gd*3)+175,c); */ + if (c > 5) continue_; + setcolor(c); + arc(320, 175, gm * steps, gm * steps + 1, gd * 6); + } + if (keypressed()) { + closegraph(); + exit(0); + } + } + settextstyle(0, 0, 1); + setcolor(13); + outtextxy(550, 343, "(press any key)"); + + putimage(112, 0, pp, orput); + freemem(pp, s); + resetmouse; + setvisualpage(0); } -void nextchar() /* Sets up charnum & cline for the next character. */ -{ +void nextchar() { /* Sets up charnum & cline for the next character. */ - c += 1; + c += 1; } -void getchar() -{ - do { - nextchar(); - - switch (*c) { - case '@': { cfont=1; nextchar(); } break; - case '^': { cfont=0; nextchar(); } break; - case '%': if (nomusic) - { - closegraph(); exit(0); /* End of text and no music => stop. */ - } - else c=addr(credits()); - break; /* End of test, but still playing => again. */ - } - - } while (!((*c!='\15') && (*c!='\12'))); - - for( w=0; w <= 7; w ++) - for( y=0; y <= 15; y ++) - move(strip[w][y][1],strip[w][y][0],79); - - for( w=0; w <= 7; w ++) - for( y=0; y <= 15; y ++) - strip[w][y][79]=(byte)((strip[7][y][78] << (w+1)))+ - ((cardinal)f[cfont][*c][y] >> (7-w)); - - across=0; +void getchar() { + do { + nextchar(); + + switch (*c) { + case '@': { + cfont = 1; + nextchar(); + } + break; + case '^': { + cfont = 0; + nextchar(); + } + break; + case '%': + if (nomusic) { + closegraph(); + exit(0); /* End of text and no music => stop. */ + } else c = addr(credits()); + break; /* End of test, but still playing => again. */ + } + + } while (!((*c != '\15') && (*c != '\12'))); + + for (w = 0; w <= 7; w ++) + for (y = 0; y <= 15; y ++) + move(strip[w][y][1], strip[w][y][0], 79); + + for (w = 0; w <= 7; w ++) + for (y = 0; y <= 15; y ++) + strip[w][y][79] = (byte)((strip[7][y][78] << (w + 1))) + + ((cardinal)f[cfont][*c][y] >> (7 - w)); + + across = 0; } -void scrolltext() -{ - byte c,w,y; +void scrolltext() { + byte c, w, y; - across += 1; - if (across==8) getchar(); + across += 1; + if (across == 8) getchar(); - for( y=0; y <= 15; y ++) - for( w=0; w <= 1; w ++) - move(strip[across][y][0],mem[0xa000*24000+(y*2+w)*80],80); + for (y = 0; y <= 15; y ++) + for (w = 0; w <= 1; w ++) + move(strip[across][y][0], mem[0xa000 * 24000 + (y * 2 + w) * 80], 80); } -void do_stuff() -{ - switch (spinnum) { - case 50 ... 110: { - setfillstyle(1,14); - bar(0,315+(spinnum-50) / 3,640,315+(spinnum-50) / 3); - bar(0,316-(spinnum-50) / 3,640,316-(spinnum-50) / 3); - if (spinnum>56) - { - setfillstyle(1,13); - bar(0,315+(spinnum-56) / 3,640,315+(spinnum-56) / 3); - bar(0,316-(spinnum-56) / 3,640,316-(spinnum-56) / 3); - } - } - break; - case 150 ... 198: { - setfillstyle(1,0); - bar(0,315+(spinnum-150) / 3,640,315+(spinnum-150) / 3); - bar(0,316-(spinnum-150) / 3,640,316-(spinnum-150) / 3); - } - break; - case 200: scrolltext(); break; - } +void do_stuff() { + switch (spinnum) { + case 50 ... 110: { + setfillstyle(1, 14); + bar(0, 315 + (spinnum - 50) / 3, 640, 315 + (spinnum - 50) / 3); + bar(0, 316 - (spinnum - 50) / 3, 640, 316 - (spinnum - 50) / 3); + if (spinnum > 56) { + setfillstyle(1, 13); + bar(0, 315 + (spinnum - 56) / 3, 640, 315 + (spinnum - 56) / 3); + bar(0, 316 - (spinnum - 56) / 3, 640, 316 - (spinnum - 56) / 3); + } + } + break; + case 150 ... 198: { + setfillstyle(1, 0); + bar(0, 315 + (spinnum - 150) / 3, 640, 315 + (spinnum - 150) / 3); + bar(0, 316 - (spinnum - 150) / 3, 640, 316 - (spinnum - 150) / 3); + } + break; + case 200: + scrolltext(); + break; + } } -void setcol(byte which,byte what) +void setcol(byte which, byte what) /*var dummy:byte;*/ -{; -/* setpalette(which,what); - asm -(* mov dx,$3DA; - in ax,dx; - - or ah,ah; - - mov dx,$3C0; - mov al,which; - out dx,al; - - mov dx,$3C0; - mov al,what; - out dx,al; - end; -(* dummy:=port[$3DA]; - port[$3C0]:=which; port[$3C0]:=what;*/ +{ + ; + /* setpalette(which,what); + asm + (* mov dx,$3DA; + in ax,dx; + + or ah,ah; + + mov dx,$3C0; + mov al,which; + out dx,al; + + mov dx,$3C0; + mov al,what; + out dx,al; + end; + (* dummy:=port[$3DA]; + port[$3C0]:=which; port[$3C0]:=what;*/ } -void bigo2go() -{ - palettetype p; byte c; boolean lmo; - boolean altnow,altbefore; - - for( gd=0; gd <= 13; gd ++) p.colors[gd]=0; - - setcol(13,24); /* murk */ setcol(14,38); /* gold */ - setcol(15,egawhite); /* white- of course */ - p.colors[13]=24; p.colors[14]=38; p.colors[15]=egawhite; - - /***/ - - p.colors[5]=egawhite; - p.colors[4]=egalightcyan; - p.colors[3]=egacyan; - p.colors[2]=egalightblue; - p.colors[1]=egablue; - - /***/ - - c=1; p.size=16; lmo=false; - setallpalette(p); - - do { -/* if reverse then - begin - dec(c); if c=0 then c:=colours; - end else - begin - inc(c); if c>colours then c:=1; - end; - for gm:=1 to colours do - case p.colors[gm] of - egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; - egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; - egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; - egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; - egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; - end; - p.colors[c]:=egaWhite; setcol(c,egaWhite); - - AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ - - if (anymousekeypressed) lmo=true; - if (keypressed()) lmo=true; - if ((! nomusic) && (ampgetmodulestatus != md_playing)) lmo=true; - - /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ - - do_stuff(); - if (spinnum<200) spinnum += 1; - } while (!lmo); +void bigo2go() { + palettetype p; + byte c; + boolean lmo; + boolean altnow, altbefore; + + for (gd = 0; gd <= 13; gd ++) p.colors[gd] = 0; + + setcol(13, 24); /* murk */ setcol(14, 38); /* gold */ + setcol(15, egawhite); /* white- of course */ + p.colors[13] = 24; + p.colors[14] = 38; + p.colors[15] = egawhite; + + /***/ + + p.colors[5] = egawhite; + p.colors[4] = egalightcyan; + p.colors[3] = egacyan; + p.colors[2] = egalightblue; + p.colors[1] = egablue; + + /***/ + + c = 1; + p.size = 16; + lmo = false; + setallpalette(p); + + do { + /* if reverse then + begin + dec(c); if c=0 then c:=colours; + end else + begin + inc(c); if c>colours then c:=1; + end; + for gm:=1 to colours do + case p.colors[gm] of + egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; + egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; + egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; + egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; + egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; + end; + p.colors[c]:=egaWhite; setcol(c,egaWhite); + + AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ + + if (anymousekeypressed) lmo = true; + if (keypressed()) lmo = true; + if ((! nomusic) && (ampgetmodulestatus != md_playing)) lmo = true; + + /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ + + do_stuff(); + if (spinnum < 200) spinnum += 1; + } while (!lmo); } -void parse_cline() -{ - integer e; +void parse_cline() { + integer e; - if (paramstr(1)!="jsb") - { - output << "Not a standalone program." << NL; exit(255); - } + if (paramstr(1) != "jsb") { + output << "Not a standalone program." << NL; + exit(255); + } } -integer getsoundhardware(psoundcard scard) -{ - integer sc,i,autosel,select; - char ch; - integer e; +integer getsoundhardware(psoundcard scard) { + integer sc, i, autosel, select; + char ch; + integer e; -integer getsoundhardware_result; + integer getsoundhardware_result; Lagain: - sc=detectgus(scard); - if (sc!=0) sc=detectpas(scard); - if (sc!=0) sc=detectaria(scard); - if (sc!=0) sc=detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc!=0) fillchar(scard,sizeof(tsoundcard),0); - - autosel=-1; -/* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13),select,e); - - /* Default entry? */ - if (select==0) select=autosel; - if (select!=autosel) { - /* clear all assumptions */ - sc=-1; - fillchar(scard,sizeof(tsoundcard),0); - scard->id=soundcards[select-1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id==id_dac) scard->ioport=0x378; - - /* Read user input */ - val(paramstr(15),i,e); - - if (i!=0) scard->ioport=i; - if (sc!=1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : scard->samplesize=2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: scard->stereo=true; - break; /* enable stereo */ - default: { - scard->samplesize=1; - scard->stereo=false; - } - } - - if (scard->id!=id_dac) { - val(paramstr(17),i,e); - - if (i!=0) scard->dmairq=i; - - val(paramstr(16),i,e); - - if (i!=0) scard->dmachannel=i; - } else { - /* Select correct DAC */ - scard->maxrate=44100; - if (select==11) { - scard->stereo=true; - scard->dmachannel=1; /* Special 'mark' */ - scard->maxrate=60000; - } else - if (select==12) { - scard->stereo=true; - scard->dmachannel=2; - scard->maxrate=60000; - if (scard->ioport==0) scard->ioport=0x378; - } else - if (select==13) { - scard->dmachannel=0; - scard->ioport=0x42; /* Special 'mark' */ - scard->maxrate=44100; - } - } - -/* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result=0; -return getsoundhardware_result; + sc = detectgus(scard); + if (sc != 0) sc = detectpas(scard); + if (sc != 0) sc = detectaria(scard); + if (sc != 0) sc = detectsb(scard); + + /* if no sound card found, zero scard */ + if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); + + autosel = -1; + /* if sc=0 then + for i:=0 to scardcount-1 do + if scard^.ID=soundcards[i].ID then begin + { Set auto selection mark } + autosel:=i+1; + break; + end;*/ + + /* Print the list of sound cards */ + + val(paramstr(13), select, e); + + /* Default entry? */ + if (select == 0) select = autosel; + if (select != autosel) { + /* clear all assumptions */ + sc = -1; + fillchar(scard, sizeof(tsoundcard), 0); + scard->id = soundcards[select - 1]; /* set correct ID */ + } + + /* Query I/O address */ + if (scard->id == id_dac) scard->ioport = 0x378; + + /* Read user input */ + val(paramstr(15), i, e); + + if (i != 0) scard->ioport = i; + if (sc != 1) /* Not autodetected */ + switch (scard->id) { + case id_sb16: + case id_pas16: + case id_wss: + case id_aria: + case id_gus : + scard->samplesize = 2; + break; /* 16-bit card */ + case id_sbpro: + case id_pas: + case id_pasplus: + scard->stereo = true; + break; /* enable stereo */ + default: { + scard->samplesize = 1; + scard->stereo = false; + } + } + + if (scard->id != id_dac) { + val(paramstr(17), i, e); + + if (i != 0) scard->dmairq = i; + + val(paramstr(16), i, e); + + if (i != 0) scard->dmachannel = i; + } else { + /* Select correct DAC */ + scard->maxrate = 44100; + if (select == 11) { + scard->stereo = true; + scard->dmachannel = 1; /* Special 'mark' */ + scard->maxrate = 60000; + } else if (select == 12) { + scard->stereo = true; + scard->dmachannel = 2; + scard->maxrate = 60000; + if (scard->ioport == 0) scard->ioport = 0x378; + } else if (select == 13) { + scard->dmachannel = 0; + scard->ioport = 0x42; /* Special 'mark' */ + scard->maxrate = 44100; + } + } + + /* writeln('Your selection: ',select,' at ',scard^.ioPort, + ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); + readln;*/ + + getsoundhardware_result = 0; + return getsoundhardware_result; } tsoundcard scard; @@ -367,225 +387,241 @@ tdds dds; pmodule module; tsdi_init sdi; integer e, -bufsize; + bufsize; char ch; boolean v86, -vdsok; -longint a,rate, -tempseg; + vdsok; +longint a, rate, + tempseg; string answer; pointer temp; word flags; word curch; byte modulevolume; -array<0,4,tsampleinfo> sample; -array<0,31,word> voltable; - -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - parse_cline(); - - nomusic=paramstr(13)=='0'; - - if (! nomusic) - { - /* Read sound card information */ - if (getsoundhardware(&scard)==-1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id==id_gus) { - /* Initialize GUS player */ - #ifndef DPMI - scard.extrafield[2]=1; /* GUS DMA transfer does not work in V86 */ - #endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus,0,31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt,gus_timer); - } else { - /* Initialize Virtual DMA Specification */ - #ifndef DPMI - vdsok=vdsinit==0; - #else - vdsok=false; - #endif - - fillchar(mcpstrc,sizeof(tmcpstruct),0); - - /* Query for sampling rate */ - val(paramstr(14),a,e); - if (a>4000) rate=a; else rate=21000; - - /* Query for quality */ - mcpstrc.options=mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi=sdi_sb; - scard.maxrate=22000; - } - break; - case id_sbpro : { - sdi=sdi_sbpro; - scard.maxrate=22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi=sdi_pas; - scard.maxrate=44100; - } - break; - case id_sb16 : { - sdi=sdi_sb16; - scard.maxrate=44100; - } - break; - case id_aria : { - sdi=sdi_aria; - scard.maxrate=44100; - } - break; - case id_wss : { - sdi=sdi_wss; - scard.maxrate=48000; - } - break; - #ifndef DPMI - case id_dac : sdi=sdi_dac; break; /* Only available in real mode */ - #endif - } - - mcpinitsounddevice(sdi,&scard); - a=mcp_tablesize; - mcpstrc.reqsize=0; - - /* Calculate mixing buffer size */ - bufsize=(longint)(2800*(integer)(scard.samplesize) << (byte)(scard.stereo))* - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize=0; - if ((mcpstrc.options & mcp_quality)>0) - if (scard.samplesize==1) a += mcp_qualitysize; else - a=mcp_tablesize16+mcp_qualitysize16; - if ((longint)(bufsize)+(longint)(a)>65500) bufsize=longint(65500)-a; - - #ifdef DPMI - dpmiversion((byte)(e),(byte)(e),(byte)(e),flags); - v86=(flags & 2)==0; - #endif - - /* Allocate volume table + mixing buffer */ - #ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg=0; - dpmiallocdos((a+longint(bufsize)) / longint(16)+longint(1),flags,(word)(tempseg)); - } else { - #endif - getmem(temp,a+longint(bufsize)); - if (temp==nil) exit(2); - #ifdef DPMI - tempseg=seg(temp); - } - #else - tempseg=seg(temp)+ofs(temp) / 16+1; - #endif - mcpstrc.bufferseg=tempseg; - mcpstrc.bufferphysical=-1; - - if (vdsok && (scard.id!=id_dac)) { - dds.size=bufsize; - dds.segment=tempseg; - dds.offset=0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds)==0) mcpstrc.bufferphysical=dds.address; - } - if (mcpstrc.bufferphysical==-1) - #ifdef DPMI - mcpstrc.bufferphysical=dpmigetlinearaddr(tempseg); - #else - mcpstrc.bufferphysical=(longint)(tempseg) << 4; - #endif - - mcpstrc.buffersize=bufsize; - mcpstrc.samplingrate=rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc)!=0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp,0,31); - } - - /* Try to initialize AMP */ - if (ampinit(0)!=0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt,amp_timer); - - #ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id==id_dac) setdactimer(tsgettimerrate); - #endif - - if (scard.id!=id_gus) mcpstartvoice; else gusstartvoice; - - /* Load an example AMF */ - module=amploadmod("avalot2.mod",0); - if (module==nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id!=id_gus) && ((mcpstrc.options & mcp_quality)>0) - && (scard.samplesize==2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for( a=1; a <= 32; a ++) voltable[a-longint(1)]=a*longint(150) / longint(32); - cdisetupchannels(0,module->channelcount+2,&voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0,module->channelcount+2,nil); - } - - curch=module->channelcount; - modulevolume=64; - - /***/ ampplaymodule(module,0); - } - - gd=3; gm=1; initgraph(gd,gm,""); - assign(ff,"avalot.fnt"); reset(ff); ff >> f[0]; close(ff); - assign(ff,"avitalic.fnt"); reset(ff); ff >> f[1]; close(ff); - - c=addr(credits()); c -= 1; - - fillchar(strip,sizeof(strip),'\0'); - reverse=false; spinnum=0; across=7; charnum=1; cfont=0; - bigo2("1189"); /* 1189? 79? 2345? 1967? */ - bigo2go(); - - if (! nomusic) ampstopmodule; - closegraph(); - return EXIT_SUCCESS; +array<0, 4, tsampleinfo> sample; +array<0, 31, word> voltable; + +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + parse_cline(); + + nomusic = paramstr(13) == '0'; + + if (! nomusic) { + /* Read sound card information */ + if (getsoundhardware(&scard) == -1) exit(1); + + + /* Initialize Timer Service */ + tsinit; + atexit(&tsclose); + if (scard.id == id_gus) { + /* Initialize GUS player */ +#ifndef DPMI + scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ +#endif + gusinit(&scard); + atexit(&gusclose); + + /* Initialize GUS heap manager */ + gushminit; + + /* Init CDI */ + cdiinit; + + /* Register GUS into CDI */ + cdiregister(&cdi_gus, 0, 31); + + /* Add GUS event player engine into Timer Service */ + tsaddroutine(&gusinterrupt, gus_timer); + } else { + /* Initialize Virtual DMA Specification */ +#ifndef DPMI + vdsok = vdsinit == 0; +#else + vdsok = false; +#endif + + fillchar(mcpstrc, sizeof(tmcpstruct), 0); + + /* Query for sampling rate */ + val(paramstr(14), a, e); + if (a > 4000) rate = a; + else rate = 21000; + + /* Query for quality */ + mcpstrc.options = mcp_quality; + + switch (scard.id) { + case id_sb : { + sdi = sdi_sb; + scard.maxrate = 22000; + } + break; + case id_sbpro : { + sdi = sdi_sbpro; + scard.maxrate = 22000; + } + break; + case id_pas: + case id_pasplus: + case id_pas16 : { + sdi = sdi_pas; + scard.maxrate = 44100; + } + break; + case id_sb16 : { + sdi = sdi_sb16; + scard.maxrate = 44100; + } + break; + case id_aria : { + sdi = sdi_aria; + scard.maxrate = 44100; + } + break; + case id_wss : { + sdi = sdi_wss; + scard.maxrate = 48000; + } + break; +#ifndef DPMI + case id_dac : + sdi = sdi_dac; + break; /* Only available in real mode */ +#endif + } + + mcpinitsounddevice(sdi, &scard); + a = mcp_tablesize; + mcpstrc.reqsize = 0; + + /* Calculate mixing buffer size */ + bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * + (longint)(rate) / (longint)(22000); + mcpstrc.reqsize = 0; + if ((mcpstrc.options & mcp_quality) > 0) + if (scard.samplesize == 1) a += mcp_qualitysize; + else + a = mcp_tablesize16 + mcp_qualitysize16; + if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; + +#ifdef DPMI + dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); + v86 = (flags & 2) == 0; +#endif + + /* Allocate volume table + mixing buffer */ +#ifdef DPMI + + /* In the V86 mode, the buffer must be allocated below 1M */ + if (v86) { + tempseg = 0; + dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); + } else { +#endif + getmem(temp, a + longint(bufsize)); + if (temp == nil) exit(2); +#ifdef DPMI + tempseg = seg(temp); + } +#else + tempseg = seg(temp) + ofs(temp) / 16 + 1; +#endif + mcpstrc.bufferseg = tempseg; + mcpstrc.bufferphysical = -1; + + if (vdsok && (scard.id != id_dac)) { + dds.size = bufsize; + dds.segment = tempseg; + dds.offset = 0; + + /* Lock DMA buffer if VDS present */ + if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; + } + if (mcpstrc.bufferphysical == -1) +#ifdef DPMI + mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); +#else + mcpstrc.bufferphysical = (longint)(tempseg) << 4; +#endif + + mcpstrc.buffersize = bufsize; + mcpstrc.samplingrate = rate; + /* Initialize Multi Channel Player */ + if (mcpinit(&mcpstrc) != 0) exit(3); + atexit(&mcpclose); + + /* Initialize Channel Distributor */ + cdiinit; + + /* Register MCP into CDI*/ + cdiregister(&cdi_mcp, 0, 31); + } + + /* Try to initialize AMP */ + if (ampinit(0) != 0) exit(3); + atexit(&close); + + /* Hook AMP player routine into Timer Service */ + tsaddroutine(&interrupt, amp_timer); + +#ifndef DPMI + /* If using DAC, then adjust DAC timer */ + if (scard.id == id_dac) setdactimer(tsgettimerrate); +#endif + + if (scard.id != id_gus) mcpstartvoice; + else gusstartvoice; + + /* Load an example AMF */ + module = amploadmod("avalot2.mod", 0); + if (module == nil) exit(4); + + /* Is it MCP, Quality mode and 16-bit card? */ + if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) + && (scard.samplesize == 2)) { + /* Open module+2 channels with amplified volumetable (4.7 gain) */ + for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); + cdisetupchannels(0, module->channelcount + 2, &voltable); + } else { + /* Open module+2 channels with regular volumetable */ + cdisetupchannels(0, module->channelcount + 2, nil); + } + + curch = module->channelcount; + modulevolume = 64; + + /***/ ampplaymodule(module, 0); + } + + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + assign(ff, "avalot.fnt"); + reset(ff); + ff >> f[0]; + close(ff); + assign(ff, "avitalic.fnt"); + reset(ff); + ff >> f[1]; + close(ff); + + c = addr(credits()); + c -= 1; + + fillchar(strip, sizeof(strip), '\0'); + reverse = false; + spinnum = 0; + across = 7; + charnum = 1; + cfont = 0; + bigo2("1189"); /* 1189? 79? 2345? 1967? */ + bigo2go(); + + if (! nomusic) ampstopmodule; + closegraph(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index f9c5ddb75b4a..b4dd206c2ad1 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,34 +29,44 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -void data(integer y, string a,string b) -{; - setcolor(1); settextjustify(2,0); outtextxy(315,y,a+':'); - setcolor(0); settextjustify(0,0); outtextxy(325,y,b); +void data(integer y, string a, string b) { + ; + setcolor(1); + settextjustify(2, 0); + outtextxy(315, y, a + ':'); + setcolor(0); + settextjustify(0, 0); + outtextxy(325, y, b); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\turbo"); - setcolor(1); setfillstyle(1,7); bar(0,0,640,200); - settextstyle(1,0,0); setusercharsize(10,4,8,6); settextjustify(1,1); - outtextxy(317,20,"Status Screen"); - settextstyle(0,0,1); - data( 60,"Current game","NoName.ASG"); - data( 70,"Saved?","Yes"); - data( 90,"Current town","Thurringham"); - data(100,"Score","177"); - data(110,"Cash","1/-"); - data(130,"Game","Lord Avalot D'Argent"); - data(140,"Version","1.00 (beta)"); - data(150,"Registered to","Unregistered!"); - data(160,"Number","nix"); - data(177,"Bios/keyboard","AT (enhanced)"); /* or XT (bog standard) */ - data(187,"Display","VGA"); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\turbo"); + setcolor(1); + setfillstyle(1, 7); + bar(0, 0, 640, 200); + settextstyle(1, 0, 0); + setusercharsize(10, 4, 8, 6); + settextjustify(1, 1); + outtextxy(317, 20, "Status Screen"); + settextstyle(0, 0, 1); + data(60, "Current game", "NoName.ASG"); + data(70, "Saved?", "Yes"); + data(90, "Current town", "Thurringham"); + data(100, "Score", "177"); + data(110, "Cash", "1/-"); + data(130, "Game", "Lord Avalot D'Argent"); + data(140, "Version", "1.00 (beta)"); + data(150, "Registered to", "Unregistered!"); + data(160, "Number", "nix"); + data(177, "Bios/keyboard", "AT (enhanced)"); /* or XT (bog standard) */ + data(187, "Display", "VGA"); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index 840ca27ab791..97b60f74f6b2 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,80 +39,110 @@ namespace Avalanche { -enum lmc {l,m,r, last_lmc}; /* Left, middle & right */ +enum lmc {l, m, r, last_lmc}; /* Left, middle & right */ file jf; byte joyway(); -static lmc getlmc(word n,word max,word min) -{lmc getlmc_result; -; - if (nmax) getlmc_result=r; else - getlmc_result=m; -return getlmc_result; +static lmc getlmc(word n, word max, word min) { + lmc getlmc_result; + ; + if (n < min) getlmc_result = l; + else if (n > max) getlmc_result = r; + else + getlmc_result = m; + return getlmc_result; } -byte joyway() -{ - word x,y; - lmc xx,yy; -byte joyway_result; -; - if (~ dna.user_moves_avvy) return joyway_result; - if (use_joy_a) readjoya(x,y); else readjoyb(x,y); - - {; - xx=getlmc(x,cxmax,cxmin); - yy=getlmc(y,cymax,cymin); - } - - switch (xx) { - case l: switch (yy) { - case l: joyway_result=ul; break; - case m: joyway_result=left; break; - case r: joyway_result=dl; break; - } - break; - case m: switch (yy) { - case l: joyway_result=up; break; - case m: joyway_result=stopped; break; - case r: joyway_result=down; break; - } - break; - case r: switch (yy) { - case l: joyway_result=ur; break; - case m: joyway_result=right; break; - case r: joyway_result=dr; break; - } - break; - } -return joyway_result; +byte joyway() { + word x, y; + lmc xx, yy; + byte joyway_result; + ; + if (~ dna.user_moves_avvy) return joyway_result; + if (use_joy_a) readjoya(x, y); + else readjoyb(x, y); + + { + ; + xx = getlmc(x, cxmax, cxmin); + yy = getlmc(y, cymax, cymin); + } + + switch (xx) { + case l: + switch (yy) { + case l: + joyway_result = ul; + break; + case m: + joyway_result = left; + break; + case r: + joyway_result = dl; + break; + } + break; + case m: + switch (yy) { + case l: + joyway_result = up; + break; + case m: + joyway_result = stopped; + break; + case r: + joyway_result = down; + break; + } + break; + case r: + switch (yy) { + case l: + joyway_result = ur; + break; + case m: + joyway_result = right; + break; + case r: + joyway_result = dr; + break; + } + break; + } + return joyway_result; } void joykeys() - /* The 2 joystick keys may be reprogrammed. This parses them. */ +/* The 2 joystick keys may be reprogrammed. This parses them. */ { - byte v; -; - if (use_joy_a) - { - v=(byte)(buttona1); v += (byte)(buttona2)*2; - } else - { - v=(byte)(buttonb1); v += (byte)(buttonb2)*2; - } - - switch (v) { - case 0: return; break; /* No buttons pressed. */ - case 1: opendoor; break; /* Button 1 pressed: open door. */ -/* 2: blip; { Button 2 pressed: nothing (joylock?). }*/ - case 2:case 3: lookaround; break; /* Both buttons pressed: look around. */ - } + byte v; + ; + if (use_joy_a) { + v = (byte)(buttona1); + v += (byte)(buttona2) * 2; + } else { + v = (byte)(buttonb1); + v += (byte)(buttonb2) * 2; + } + + switch (v) { + case 0: + return; + break; /* No buttons pressed. */ + case 1: + opendoor; + break; /* Button 1 pressed: open door. */ + /* 2: blip; { Button 2 pressed: nothing (joylock?). }*/ + case 2: + case 3: + lookaround; + break; /* Both buttons pressed: look around. */ + } } - /* No init code. */ +/* No init code. */ } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h index c9235c065d09..fef3464d22da 100644 --- a/engines/avalanche/sticks.h +++ b/engines/avalanche/sticks.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,7 +32,7 @@ /*#include "Joystick.h"*/ /*#include "Acci.h"*/ /*#include "Gyro.h"*/ - /* for solidarity */ +/* for solidarity */ namespace Avalanche { diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index a5c6b28d9b70..7baa88fe8793 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,56 +30,67 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; longint tskellern /*absolute $0:244*/; /* Over int $61 */ -void hold() -{; - do {; } while (!(tskellern>=1)); - tskellern=0; +void hold() { + ; + do { + ; + } while (!(tskellern >= 1)); + tskellern = 0; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=1; initgraph(gd,gm,"c:\\bp\\bgi"); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 1; + initgraph(gd, gm, "c:\\bp\\bgi"); - setvisualpage(1); - setfillstyle(1,1); - for( gd=1; gd <= 640; gd ++) - bar(gd,177+trunc(20*sin((real)(gd)/39)),gd,350); - setfillstyle(1,3); setcolor(3); - fillellipse(320,277,60,50); - settextjustify(1,1); settextstyle(0,0,2); setcolor(9); - outtextxy(320,50,"The sun rises over Hertfordshire..."); - settextjustify(2,0); settextstyle(0,0,1); setcolor(0); - outtextxy(635,350,"Press any key..."); + setvisualpage(1); + setfillstyle(1, 1); + for (gd = 1; gd <= 640; gd ++) + bar(gd, 177 + trunc(20 * sin((real)(gd) / 39)), gd, 350); + setfillstyle(1, 3); + setcolor(3); + fillellipse(320, 277, 60, 50); + settextjustify(1, 1); + settextstyle(0, 0, 2); + setcolor(9); + outtextxy(320, 50, "The sun rises over Hertfordshire..."); + settextjustify(2, 0); + settextstyle(0, 0, 1); + setcolor(0); + outtextxy(635, 350, "Press any key..."); - setpalette(0,egablue); - setpalette(1,egagreen); - setpalette(2,egayellow); - setpalette(3,egagreen); - setpalette(9,egalightblue); - setpalette(11,egalightblue); - setvisualpage(0); + setpalette(0, egablue); + setpalette(1, egagreen); + setpalette(2, egayellow); + setpalette(3, egagreen); + setpalette(9, egalightblue); + setpalette(11, egalightblue); + setvisualpage(0); - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << 1; port[0x3cf]=1; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << 1; + port[0x3cf] = 1; - for( gm=227; gm >= 1; gm --) /* <<< try running this loop the other way round! */ - {; - move(mem[0xa000*gm*80+80],mem[0xa000*gm*80],8042); - hold(); - if (keypressed()) return 0; - } + for (gm = 227; gm >= 1; gm --) { /* <<< try running this loop the other way round! */ + ; + move(mem[0xa000 * gm * 80 + 80], mem[0xa000 * gm * 80], 8042); + hold(); + if (keypressed()) return 0; + } - for( gm=101; gm >= 1; gm --) - {; - move(mem[0xa000*80],mem[0xa000*0],gm*80); - hold(); - if (keypressed()) return 0; - } -return EXIT_SUCCESS; + for (gm = 101; gm >= 1; gm --) { + ; + move(mem[0xa000 * 80], mem[0xa000 * 0], gm * 80); + hold(); + if (keypressed()) return 0; + } + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index 21ee150ea1a0..914ba60d3a94 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,76 +29,80 @@ namespace Avalanche { -enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; struct chunkblocktype { - union { - struct {flavourtype flavour; - integer x,y; - integer xl,yl; - longint size;} s_true; - array<1,14,byte> all; - }; + union { + struct { + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; + } s_true; + array<1, 14, byte> all; + }; }; byte screennum; untyped_file f; -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void load() -{ - byte a /*absolute $A000:1200*/; byte bit; -; - reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,12080); - } - close(f); - bit=getpixel(0,0); +void load() { + byte a /*absolute $A000:1200*/; + byte bit; + ; + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 12080); + } + close(f); + bit = getpixel(0, 0); } -void init() -{ - integer gd,gm; -; - output << "*** Tempo file creater ***" << NL; - output << "Enter place*.avd number:"; - input >> screennum >> NL; - gd=3; gm=0; - initgraph(gd,gm,"c:\\bp\\bgi"); - assign(f,string("place")+strf(screennum)+".avd"); - load(); - setactivepage(1); - setcolor(10); - outtextxy(0,150,"CHUNK FILE: please don't change these codes! ->"); - setactivepage(0); +void init() { + integer gd, gm; + ; + output << "*** Tempo file creater ***" << NL; + output << "Enter place*.avd number:"; + input >> screennum >> NL; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(f, string("place") + strf(screennum) + ".avd"); + load(); + setactivepage(1); + setcolor(10); + outtextxy(0, 150, "CHUNK FILE: please don't change these codes! ->"); + setactivepage(0); } -void choose() -{ - integer x1,y1,xl,yl; -; +void choose() { + integer x1, y1, xl, yl; + ; } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - init(); - choose(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + init(); + choose(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index 22e49d0872b3..220c92c2c287 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,18 +30,18 @@ namespace Avalanche { -const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; +const array<1, 22, char> signature = string("*AVALOT* v1.00 tt ") + '\3' + '\0'; pointer saveint1f; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1f,saveint1f); - setintvec(0x1f,&signature); - swapvectors; - exec("c:\\command.com",""); - swapvectors; - setintvec(0x1f,saveint1f); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1f, saveint1f); + setintvec(0x1f, &signature); + swapvectors; + exec("c:\\command.com", ""); + swapvectors; + setintvec(0x1f, saveint1f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index 7efe64e77ec9..dfdaae5227cc 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,17 +29,18 @@ namespace Avalanche { -const array<1,22,char> signature = string("*AVALOT* v1.00 tt ")+'\3'+'\0'; +const array<1, 22, char> signature = string("*AVALOT* v1.00 tt ") + '\3' + '\0'; pointer getint1f; -array<1,22,char> x; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - getintvec(0x1f,getint1f); - move(getint1f,x,22); - if (x==signature) - output << "Signature found." << NL; else output << "Signature NOT found!" << NL; -return EXIT_SUCCESS; +array<1, 22, char> x; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + getintvec(0x1f, getint1f); + move(getint1f, x, 22); + if (x == signature) + output << "Signature found." << NL; + else output << "Signature NOT found!" << NL; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index 5fe1e3aca177..b58ddc628d0a 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,43 +34,51 @@ const integer borland = xorput; const integer mb1 = 2; /* 2 */ const integer mb2 = 4; /* 4 */ -integer gd,gm; +integer gd, gm; pointer p; word s; -void mblit() -{ - byte bit; longint st; -; - st=ttp; - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=mb1; - portw[0x3ce]=copyput*256+3; - portw[0x3ce]=0x205; - port[0x3ce]=0x8; - port[0x3c5]=1 << bit; - port[0x3cf]=bit; - move(mem[longint(0xa000)*st],mem[0xa000*0],7200); - } +void mblit() { + byte bit; + longint st; + ; + st = ttp; + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = mb1; + portw[0x3ce] = copyput * 256 + 3; + portw[0x3ce] = 0x205; + port[0x3ce] = 0x8; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(mem[longint(0xa000)*st], mem[0xa000 * 0], 7200); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,""); - settextstyle(1,0,7); - for( gd=0; gd <= 1; gd ++) - {; - setactivepage(gd); setcolor(6*gd+6); - outtextxy(0,0,chr(65+gd)); - } - s=imagesize(0,0,90,90); setactivepage(0); getmem(p,s); - getimage(0,0,90,90,p); putimage(100,100,p,0); - setactivepage(1); getimage(0,0,90,90,p); setactivepage(0); - putimage(100,100,p,borland); - mblit(); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + settextstyle(1, 0, 7); + for (gd = 0; gd <= 1; gd ++) { + ; + setactivepage(gd); + setcolor(6 * gd + 6); + outtextxy(0, 0, chr(65 + gd)); + } + s = imagesize(0, 0, 90, 90); + setactivepage(0); + getmem(p, s); + getimage(0, 0, 90, 90, p); + putimage(100, 100, p, 0); + setactivepage(1); + getimage(0, 0, 90, 90, p); + setactivepage(0); + putimage(100, 100, p, borland); + mblit(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index f435df0c9bdd..aec0d92aed39 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,55 +30,65 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; string filename; -untyped_file f; byte bit; +untyped_file f; +byte bit; byte a /*absolute $A000:800*/; searchrec r; -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); - for( gd=0; gd <= 14; gd ++) - for( gm=0; gm <= 11; gm ++) - {; - setfillstyle(gm,gd+1); - bar(gd*43,gm*12+10,42+gd*43,gm*12+21); - } + for (gd = 0; gd <= 14; gd ++) + for (gm = 0; gm <= 11; gm ++) { + ; + setfillstyle(gm, gd + 1); + bar(gd * 43, gm * 12 + 10, 42 + gd * 43, gm * 12 + 21); + } - output << NL; output << NL; output << NL; output << NL; + output << NL; + output << NL; + output << NL; + output << NL; - output << "Thorsoft testcard." << NL; - output << NL; - output << "Room number? "; input >> filename >> NL; + output << "Thorsoft testcard." << NL; + output << NL; + output << "Room number? "; + input >> filename >> NL; - findfirst(string("place")+filename+".avd",anyfile,r); - if (doserror==0) - {; - output << "*** ALREADY EXISTS! CANCELLED! ***" << NL; - input >> NL; - exit(0); - } + findfirst(string("place") + filename + ".avd", anyfile, r); + if (doserror == 0) { + ; + output << "*** ALREADY EXISTS! CANCELLED! ***" << NL; + input >> NL; + exit(0); + } - output << NL; - output << "*** Until this room is drawn, this screen is standing in for it. ***" << NL; - output << NL; - output << "Any other comments? "; - input >> NL; + output << NL; + output << "*** Until this room is drawn, this screen is standing in for it. ***" << NL; + output << NL; + output << "Any other comments? "; + input >> NL; - assign(f,string("place")+filename+".avd"); - rewrite(f,1); - blockwrite(f,gd,177); /* just anything */ - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,a,12080); - } - close(f); -return EXIT_SUCCESS; + assign(f, string("place") + filename + ".avd"); + rewrite(f, 1); + blockwrite(f, gd, 177); /* just anything */ + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, a, 12080); + } + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index 86b01b57374b..d0a0ac31f66d 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,18 +29,23 @@ namespace Avalanche { -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - do { - readkeye; - switch (inchar) { - case '\0': output << string('[')+extd+']'; break; - case '\340': output << string('<')+extd+'>'; break; - default: output << inchar; - } - } while (!(inchar=='\33')); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + do { + readkeye; + switch (inchar) { + case '\0': + output << string('[') + extd + ']'; + break; + case '\340': + output << string('<') + extd + '>'; + break; + default: + output << inchar; + } + } while (!(inchar == '\33')); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp index 2c83104a5d55..553d503d0d2a 100644 --- a/engines/avalanche/timeout.cpp +++ b/engines/avalanche/timeout.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -51,89 +51,169 @@ namespace Avalanche { byte fv; -void set_up_timer(longint howlong, byte whither,byte why) -{ - fv=1; - while ((fv<8) && (times[fv].time_left!=0)) fv += 1; - if (fv==8) return; /* Oh dear... */ - - { - timetype& with = times[fv]; /* Everything's OK here! */ - - with.time_left=howlong; - with.then_where=whither; - with.what_for=why; - } -} - -void one_tick() -{ - - if (ddmnow) return; - - for( fv=1; fv <= 7; fv ++) - { timetype& with = times[fv]; - if (with.time_left>0) - { - with.time_left -= 1; - - if (with.time_left==0) - switch (with.then_where) { - case procopen_drawbridge : open_drawbridge(); break; - case procavaricius_talks : avaricius_talks(); break; - case procurinate : urinate(); break; - case proctoilet2 : toilet2(); break; - case procbang: bang(); break; - case procbang2: bang2(); break; - case procstairs: stairs(); break; - case proccardiffsurvey: cardiff_survey(); break; - case proccardiff_return: cardiff_return(); break; - case proc_cwytalot_in_herts: cwytalot_in_herts(); break; - case procget_tied_up: get_tied_up(); break; - case procget_tied_up2: get_tied_up2(); break; - case prochang_around: hang_around(); break; - case prochang_around2: hang_around2(); break; - case procafter_the_shootemup: after_the_shootemup(); break; - case procjacques_wakes_up: jacques_wakes_up(); break; - case procnaughty_duke: naughty_duke(); break; - case procnaughty_duke2: naughty_duke2(); break; - case procnaughty_duke3: naughty_duke3(); break; - case procjump: jump(); break; - case procsequence: call_sequencer(); break; - case proccrapulus_splud_out: crapulus_says_splud_out(); break; - case procdawn_delay: dawn(); break; - case procbuydrinks: buydrinks(); break; - case procbuywine: buywine(); break; - case proccallsguards: callsguards(); break; - case procgreetsmonk: greetsmonk(); break; - case procfall_down_oubliette: fall_down_oubliette(); break; - case procmeet_avaroid: meet_avaroid(); break; - case procrise_up_oubliette: rise_up_oubliette(); break; - case procrobin_hood_and_geida: robin_hood_and_geida(); break; - case procrobin_hood_and_geida_talk: robin_hood_and_geida_talk(); break; - case procavalot_returns: avalot_returns(); break; - case procavvy_sit_down: avvy_sit_down(); break; - case procghost_room_phew: ghost_room_phew(); break; - case procarkata_shouts: arkata_shouts(); break; - case procwinning: winning(); break; - case procavalot_falls: avalot_falls(); break; - case procspludwick_goes_to_cauldron: spludwick_goes_to_cauldron(); break; - case procspludwick_leaves_cauldron: spludwick_leaves_cauldron(); break; - case procgive_lute_to_geida: give_lute_to_geida(); break; - } - }} - roomtime += 1; /* Cycles since you've been in this room. */ - dna.total_time += 1; /* Total amount of time for this game. */ -} - -void lose_timer(byte which) -{ - byte fv; - - for( fv=1; fv <= 7; fv ++) - { timetype& with = times[fv]; - if (with.what_for==which) - with.time_left=0;} /* Cancel this one! */ +void set_up_timer(longint howlong, byte whither, byte why) { + fv = 1; + while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; + if (fv == 8) return; /* Oh dear... */ + + { + timetype &with = times[fv]; /* Everything's OK here! */ + + with.time_left = howlong; + with.then_where = whither; + with.what_for = why; + } +} + +void one_tick() { + + if (ddmnow) return; + + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.time_left > 0) { + with.time_left -= 1; + + if (with.time_left == 0) + switch (with.then_where) { + case procopen_drawbridge : + open_drawbridge(); + break; + case procavaricius_talks : + avaricius_talks(); + break; + case procurinate : + urinate(); + break; + case proctoilet2 : + toilet2(); + break; + case procbang: + bang(); + break; + case procbang2: + bang2(); + break; + case procstairs: + stairs(); + break; + case proccardiffsurvey: + cardiff_survey(); + break; + case proccardiff_return: + cardiff_return(); + break; + case proc_cwytalot_in_herts: + cwytalot_in_herts(); + break; + case procget_tied_up: + get_tied_up(); + break; + case procget_tied_up2: + get_tied_up2(); + break; + case prochang_around: + hang_around(); + break; + case prochang_around2: + hang_around2(); + break; + case procafter_the_shootemup: + after_the_shootemup(); + break; + case procjacques_wakes_up: + jacques_wakes_up(); + break; + case procnaughty_duke: + naughty_duke(); + break; + case procnaughty_duke2: + naughty_duke2(); + break; + case procnaughty_duke3: + naughty_duke3(); + break; + case procjump: + jump(); + break; + case procsequence: + call_sequencer(); + break; + case proccrapulus_splud_out: + crapulus_says_splud_out(); + break; + case procdawn_delay: + dawn(); + break; + case procbuydrinks: + buydrinks(); + break; + case procbuywine: + buywine(); + break; + case proccallsguards: + callsguards(); + break; + case procgreetsmonk: + greetsmonk(); + break; + case procfall_down_oubliette: + fall_down_oubliette(); + break; + case procmeet_avaroid: + meet_avaroid(); + break; + case procrise_up_oubliette: + rise_up_oubliette(); + break; + case procrobin_hood_and_geida: + robin_hood_and_geida(); + break; + case procrobin_hood_and_geida_talk: + robin_hood_and_geida_talk(); + break; + case procavalot_returns: + avalot_returns(); + break; + case procavvy_sit_down: + avvy_sit_down(); + break; + case procghost_room_phew: + ghost_room_phew(); + break; + case procarkata_shouts: + arkata_shouts(); + break; + case procwinning: + winning(); + break; + case procavalot_falls: + avalot_falls(); + break; + case procspludwick_goes_to_cauldron: + spludwick_goes_to_cauldron(); + break; + case procspludwick_leaves_cauldron: + spludwick_leaves_cauldron(); + break; + case procgive_lute_to_geida: + give_lute_to_geida(); + break; + } + } + } + roomtime += 1; /* Cycles since you've been in this room. */ + dna.total_time += 1; /* Total amount of time for this game. */ +} + +void lose_timer(byte which) { + byte fv; + + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.what_for == which) + with.time_left = 0; + } /* Cancel this one! */ } /*function timer_is_on(which:byte):boolean; @@ -151,472 +231,469 @@ end;*/ /* Timeout procedures: */ -void open_drawbridge() -{ - { - dnatype& with = dna; +void open_drawbridge() { + { + dnatype &with = dna; - with.drawbridge_open += 1; - show_one(with.drawbridge_open-1); + with.drawbridge_open += 1; + show_one(with.drawbridge_open - 1); - if (with.drawbridge_open==4) - magics[2].op=nix; /* You may enter the drawbridge. */ - else set_up_timer(7,procopen_drawbridge,reason_drawbridgefalls); - } + if (with.drawbridge_open == 4) + magics[2].op = nix; /* You may enter the drawbridge. */ + else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); + } } /* --- */ -void avaricius_talks() -{ - { - dnatype& with = dna; +void avaricius_talks() { + { + dnatype &with = dna; - dixi('q',with.avaricius_talk); - with.avaricius_talk += 1; + dixi('q', with.avaricius_talk); + with.avaricius_talk += 1; - if (with.avaricius_talk<17) - set_up_timer(177,procavaricius_talks,reason_avariciustalks); - else points(3); + if (with.avaricius_talk < 17) + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + else points(3); - } + } } -void urinate() -{ - tr[1].turn(up); - stopwalking(); - showrw(); - set_up_timer(14,proctoilet2,reason_gototoilet); +void urinate() { + tr[1].turn(up); + stopwalking(); + showrw(); + set_up_timer(14, proctoilet2, reason_gototoilet); } -void toilet2() -{ - display("That's better!"); +void toilet2() { + display("That's better!"); } -void bang() -{ - display("\6< BANG! >"); - set_up_timer(30,procbang2,reason_explosion); +void bang() { + display("\6< BANG! >"); + set_up_timer(30, procbang2, reason_explosion); } -void bang2() -{ - display("Hmm... sounds like Spludwick's up to something..."); +void bang2() { + display("Hmm... sounds like Spludwick's up to something..."); } -void stairs() -{ - blip(); - tr[1].walkto(4); - show_one(2); - dna.brummie_stairs=2; - magics[11].op=special; - magics[11].data=2; /* Reached the bottom of the stairs. */ - magics[4].op=nix; /* Stop them hitting the sides (or the game will hang.) */ +void stairs() { + blip(); + tr[1].walkto(4); + show_one(2); + dna.brummie_stairs = 2; + magics[11].op = special; + magics[11].data = 2; /* Reached the bottom of the stairs. */ + magics[4].op = nix; /* Stop them hitting the sides (or the game will hang.) */ } -void cardiff_survey() -{ - { - dnatype& with = dna; - - switch (with.cardiff_things) { - case 0: { - with.cardiff_things += 1; - dixi('q',27); - } - break; - } - dixi('z',with.cardiff_things); - } - interrogation=dna.cardiff_things; - set_up_timer(182,proccardiffsurvey,reason_cardiffsurvey); -} - -void cardiff_return() -{ - dixi('q',28); - cardiff_survey(); /* add end of question. */ -} +void cardiff_survey() { + { + dnatype &with = dna; -void cwytalot_in_herts() -{ - dixi('q',29); + switch (with.cardiff_things) { + case 0: { + with.cardiff_things += 1; + dixi('q', 27); + } + break; + } + dixi('z', with.cardiff_things); + } + interrogation = dna.cardiff_things; + set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } -void get_tied_up() -{ - dixi('q',34); /* ...Trouble! */ - dna.user_moves_avvy=false; - dna.been_tied_up=true; - stopwalking(); - tr[2].stopwalk(); tr[2].stophoming(); - tr[2].call_eachstep=true; - tr[2].eachstep=procgrab_avvy; - set_up_timer(70,procget_tied_up2,reason_getting_tied_up); +void cardiff_return() { + dixi('q', 28); + cardiff_survey(); /* add end of question. */ } -void get_tied_up2() -{ - tr[1].walkto(4); - tr[2].walkto(5); - magics[4].op=nix; /* No effect when you touch the boundaries. */ - dna.friar_will_tie_you_up=true; +void cwytalot_in_herts() { + dixi('q', 29); } -void hang_around() -{ - tr[2].check_me=false; - tr[1].init(7,true); /* Robin Hood */ - whereis[probinhood]=r__robins; - apped(1,2); - dixi('q',39); - tr[1].walkto(7); - set_up_timer(55,prochang_around2,reason_hanging_around); -} - -void hang_around2() -{ - dixi('q',40); - tr[2].vanishifstill=false; - tr[2].walkto(4); - whereis[pfriartuck]=r__robins; - dixi('q',41); - tr[1].done(); tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ - - set_up_timer(1,procafter_the_shootemup,reason_hanging_around); /* Immediately - call the following proc (when you have a chance). */ - - dna.tied_up=false; - - back_to_bootstrap(1); /* Call the shoot-'em-up. */ +void get_tied_up() { + dixi('q', 34); /* ...Trouble! */ + dna.user_moves_avvy = false; + dna.been_tied_up = true; + stopwalking(); + tr[2].stopwalk(); + tr[2].stophoming(); + tr[2].call_eachstep = true; + tr[2].eachstep = procgrab_avvy; + set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } -void after_the_shootemup() -{ - byte shootscore,gain; - - tr[1].init(0,true); /* Avalot. */ - apped(1,2); dna.user_moves_avvy=true; - dna.obj[crossbow]=true; objectlist(); - - shootscore=mem[storage_seg*storage_ofs]; - gain=(shootscore+5) / 10; /* Rounding up. */ - - display(string("\6Your score was ")+strf(shootscore)+'.'+"\r\rYou gain ("+ - strf(shootscore)+" 10) = "+strf(gain)+" points."); - - if (gain>20) - { - display("But we won't let you have more than 20 points!"); - points(20); - } else - points(gain); - - dixi('q',70); +void get_tied_up2() { + tr[1].walkto(4); + tr[2].walkto(5); + magics[4].op = nix; /* No effect when you touch the boundaries. */ + dna.friar_will_tie_you_up = true; } -void jacques_wakes_up() -{ - dna.jacques_awake += 1; - - switch (dna.jacques_awake) { /* Additional pictures. */ - case 1 : { - show_one(1); /* Eyes open. */ - dixi('Q',45); - } - break; - case 2 : { /* Going through the door. */ - show_one(2); /* Not on the floor. */ - show_one(3); /* But going through the door. */ - magics[6].op=nix; /* You can't wake him up now. */ - } - break; - case 3 : { /* Gone through the door. */ - show_one(2); /* Not on the floor, either. */ - show_one(4); /* He's gone... so the door's open. */ - whereis[pjacques]=0; /* Gone! */ - } - break; - } - - - if (dna.jacques_awake==5) - { - dna.ringing_bells=true; - dna.ayles_is_awake=true; - points(2); - } - - switch (dna.jacques_awake) { - case RANGE_3(1,3): set_up_timer(12,procjacques_wakes_up,reason_jacques_waking_up); - break; - case 4: set_up_timer(24,procjacques_wakes_up,reason_jacques_waking_up); break; - } - +void hang_around() { + tr[2].check_me = false; + tr[1].init(7, true); /* Robin Hood */ + whereis[probinhood] = r__robins; + apped(1, 2); + dixi('q', 39); + tr[1].walkto(7); + set_up_timer(55, prochang_around2, reason_hanging_around); } -void naughty_duke() - /* This is when the Duke comes in and takes your money. */ -{ - tr[2].init(9,false); /* Here comes the Duke. */ - apped(2,1); /* He starts at the door... */ - tr[2].walkto(3); /* He walks over to you. */ +void hang_around2() { + dixi('q', 40); + tr[2].vanishifstill = false; + tr[2].walkto(4); + whereis[pfriartuck] = r__robins; + dixi('q', 41); + tr[1].done(); + tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ - /* Let's get the door opening. */ + set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately + call the following proc (when you have a chance). */ - show_one(1); first_show(2); start_to_close(); + dna.tied_up = false; - set_up_timer(50,procnaughty_duke2,reason_naughty_duke); + back_to_bootstrap(1); /* Call the shoot-'em-up. */ } -void naughty_duke2() -{ - dixi('q',48); /* Ha ha, it worked again! */ - tr[2].walkto(1); /* Walk to the door. */ - tr[2].vanishifstill=true; /* Then go away! */ - set_up_timer(32,procnaughty_duke3,reason_naughty_duke); -} +void after_the_shootemup() { + byte shootscore, gain; -void naughty_duke3() -{ - show_one(1); first_show(2); start_to_close(); -} + tr[1].init(0, true); /* Avalot. */ + apped(1, 2); + dna.user_moves_avvy = true; + dna.obj[crossbow] = true; + objectlist(); -void jump() -{ - { - dnatype& with = dna; - - with.jumpstatus += 1; - - { triptype& with1 = tr[1]; - switch (with.jumpstatus) { - case 1:case 2:case 3:case 5:case 7:case 9: with1.y -= 1; break; - case 12:case 13:case 14:case 16:case 18:case 19: with1.y += 1; break; - }} - - if (with.jumpstatus==20) - { /* End of jump. */ - dna.user_moves_avvy=true; - dna.jumpstatus=0; - } else - { /* Still jumping. */ - set_up_timer(1,procjump,reason_jumping); - } - - if ((with.jumpstatus==10) /* You're at the highest point of your jump. */ - && (dna.room==r__insidecardiffcastle) - && (dna.arrow_in_the_door==true) - && (infield(3))) /* beside the wall*/ - { /* Grab the arrow! */ - if (dna.carrying>=maxobjs) - display("You fail to grab it, because your hands are full."); - else - { - show_one(2); - dna.arrow_in_the_door=false; /* You've got it. */ - dna.obj[bolt]=true; - objectlist(); - dixi('q',50); - points(3); - } - } - } -} - -void crapulus_says_splud_out() -{ - dixi('q',56); - dna.crapulus_will_tell=false; -} + shootscore = mem[storage_seg * storage_ofs]; + gain = (shootscore + 5) / 10; /* Rounding up. */ -void buydrinks() -{ - show_one(11); /* Malagauche gets up again. */ - dna.malagauche=0; + display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + + strf(shootscore) + " 10) = " + strf(gain) + " points."); - dixi('D',ord(dna.drinking)); /* Display message about it. */ - wobble(); /* Do the special effects. */ - dixi('D',1); /* That'll be thruppence. */ - if (pennycheck(3)) /* Pay 3d. */ - dixi('D',3); /* Tell 'em you paid up. */ - have_a_drink(); -} + if (gain > 20) { + display("But we won't let you have more than 20 points!"); + points(20); + } else + points(gain); -void buywine() -{ - show_one(11); /* Malagauche gets up again. */ - dna.malagauche=0; - - dixi('D',50); /* You buy the wine. */ - dixi('D',1); /* It'll be thruppence. */ - if (pennycheck(3)) - { - dixi('D',4); /* You paid up. */ - dna.obj[wine]=true; - objectlist(); - dna.winestate=1; /* OK Wine */ - } + dixi('q', 70); } -void callsguards() -{ - dixi('Q',58); /* GUARDS!!! */ - gameover(); -} +void jacques_wakes_up() { + dna.jacques_awake += 1; -void greetsmonk() -{ - dixi('Q',59); dna.entered_lusties_room_as_monk=true; -} + switch (dna.jacques_awake) { /* Additional pictures. */ + case 1 : { + show_one(1); /* Eyes open. */ + dixi('Q', 45); + } + break; + case 2 : { /* Going through the door. */ + show_one(2); /* Not on the floor. */ + show_one(3); /* But going through the door. */ + magics[6].op = nix; /* You can't wake him up now. */ + } + break; + case 3 : { /* Gone through the door. */ + show_one(2); /* Not on the floor, either. */ + show_one(4); /* He's gone... so the door's open. */ + whereis[pjacques] = 0; /* Gone! */ + } + break; + } -void fall_down_oubliette() -{ - magics[9].op=nix; - tr[1].iy += 1; /* increments dx/dy! */ - tr[1].y += tr[1].iy; /* Dowwwn we go... */ - set_up_timer(3,procfall_down_oubliette,reason_falling_down_oubliette); -} -void meet_avaroid() -{ - if (dna.met_avaroid) - { - display("You can't expect to be \6that\22 lucky twice in a row!"); - gameover(); - } else - { - dixi('Q',60); dna.met_avaroid=true; - set_up_timer(1,procrise_up_oubliette,reason_rising_up_oubliette); - { - triptype& with = tr[1]; with.face=left; with.x=151; with.ix=-3; with.iy=-5; } - background(2); - } -} - -void rise_up_oubliette() -{ - { - triptype& with = tr[1]; + if (dna.jacques_awake == 5) { + dna.ringing_bells = true; + dna.ayles_is_awake = true; + points(2); + } - with.visible=true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy>0) - set_up_timer(3,procrise_up_oubliette,reason_rising_up_oubliette); - else - dna.user_moves_avvy=true; - } -} + switch (dna.jacques_awake) { + case RANGE_3(1, 3): + set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); + break; + case 4: + set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); + break; + } -void robin_hood_and_geida() -{ - tr[1].init(7,true); - apped(1,7); - tr[1].walkto(6); - tr[2].stopwalk(); - tr[2].face=left; - set_up_timer(20,procrobin_hood_and_geida_talk,reason_robin_hood_and_geida); - dna.geida_follows=false; } -void robin_hood_and_geida_talk() -{ - dixi('q',66); tr[1].walkto(2); tr[2].walkto(2); - tr[1].vanishifstill=true; tr[2].vanishifstill=true; - set_up_timer(162,procavalot_returns,reason_robin_hood_and_geida); +void naughty_duke() +/* This is when the Duke comes in and takes your money. */ +{ + tr[2].init(9, false); /* Here comes the Duke. */ + apped(2, 1); /* He starts at the door... */ + tr[2].walkto(3); /* He walks over to you. */ + + /* Let's get the door opening. */ + + show_one(1); + first_show(2); + start_to_close(); + + set_up_timer(50, procnaughty_duke2, reason_naughty_duke); +} + +void naughty_duke2() { + dixi('q', 48); /* Ha ha, it worked again! */ + tr[2].walkto(1); /* Walk to the door. */ + tr[2].vanishifstill = true; /* Then go away! */ + set_up_timer(32, procnaughty_duke3, reason_naughty_duke); +} + +void naughty_duke3() { + show_one(1); + first_show(2); + start_to_close(); +} + +void jump() { + { + dnatype &with = dna; + + with.jumpstatus += 1; + + { + triptype &with1 = tr[1]; + switch (with.jumpstatus) { + case 1: + case 2: + case 3: + case 5: + case 7: + case 9: + with1.y -= 1; + break; + case 12: + case 13: + case 14: + case 16: + case 18: + case 19: + with1.y += 1; + break; + } + } + + if (with.jumpstatus == 20) { + /* End of jump. */ + dna.user_moves_avvy = true; + dna.jumpstatus = 0; + } else { + /* Still jumping. */ + set_up_timer(1, procjump, reason_jumping); + } + + if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + && (dna.room == r__insidecardiffcastle) + && (dna.arrow_in_the_door == true) + && (infield(3))) { /* beside the wall*/ + /* Grab the arrow! */ + if (dna.carrying >= maxobjs) + display("You fail to grab it, because your hands are full."); + else { + show_one(2); + dna.arrow_in_the_door = false; /* You've got it. */ + dna.obj[bolt] = true; + objectlist(); + dixi('q', 50); + points(3); + } + } + } +} + +void crapulus_says_splud_out() { + dixi('q', 56); + dna.crapulus_will_tell = false; +} + +void buydrinks() { + show_one(11); /* Malagauche gets up again. */ + dna.malagauche = 0; + + dixi('D', ord(dna.drinking)); /* Display message about it. */ + wobble(); /* Do the special effects. */ + dixi('D', 1); /* That'll be thruppence. */ + if (pennycheck(3)) /* Pay 3d. */ + dixi('D', 3); /* Tell 'em you paid up. */ + have_a_drink(); +} + +void buywine() { + show_one(11); /* Malagauche gets up again. */ + dna.malagauche = 0; + + dixi('D', 50); /* You buy the wine. */ + dixi('D', 1); /* It'll be thruppence. */ + if (pennycheck(3)) { + dixi('D', 4); /* You paid up. */ + dna.obj[wine] = true; + objectlist(); + dna.winestate = 1; /* OK Wine */ + } +} + +void callsguards() { + dixi('Q', 58); /* GUARDS!!! */ + gameover(); +} + +void greetsmonk() { + dixi('Q', 59); + dna.entered_lusties_room_as_monk = true; +} + +void fall_down_oubliette() { + magics[9].op = nix; + tr[1].iy += 1; /* increments dx/dy! */ + tr[1].y += tr[1].iy; /* Dowwwn we go... */ + set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); +} + +void meet_avaroid() { + if (dna.met_avaroid) { + display("You can't expect to be \6that\22 lucky twice in a row!"); + gameover(); + } else { + dixi('Q', 60); + dna.met_avaroid = true; + set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); + { + triptype &with = tr[1]; + with.face = left; + with.x = 151; + with.ix = -3; + with.iy = -5; + } + background(2); + } +} + +void rise_up_oubliette() { + { + triptype &with = tr[1]; + + with.visible = true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy > 0) + set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); + else + dna.user_moves_avvy = true; + } +} + +void robin_hood_and_geida() { + tr[1].init(7, true); + apped(1, 7); + tr[1].walkto(6); + tr[2].stopwalk(); + tr[2].face = left; + set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); + dna.geida_follows = false; +} + +void robin_hood_and_geida_talk() { + dixi('q', 66); + tr[1].walkto(2); + tr[2].walkto(2); + tr[1].vanishifstill = true; + tr[2].vanishifstill = true; + set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } - -void avalot_returns() -{ - tr[1].done(); tr[2].done(); - tr[1].init(0,true); - apped(1,1); - dixi('q',67); - dna.user_moves_avvy=true; + +void avalot_returns() { + tr[1].done(); + tr[2].done(); + tr[1].init(0, true); + apped(1, 1); + dixi('q', 67); + dna.user_moves_avvy = true; } void avvy_sit_down() - /* This is used when you sit down in the pub in Notts. It loops around so - that it will happen when Avvy stops walking. */ +/* This is used when you sit down in the pub in Notts. It loops around so + that it will happen when Avvy stops walking. */ { - if (tr[1].homing) /* Still walking */ - set_up_timer(1,procavvy_sit_down,reason_sitting_down); - else - { - show_one(3); - dna.sitting_in_pub=true; - dna.user_moves_avvy=false; - tr[1].visible=false; - } -} - -void ghost_room_phew() -{ - display("\6PHEW!\22 You're glad to get out of \6there!"); + if (tr[1].homing) /* Still walking */ + set_up_timer(1, procavvy_sit_down, reason_sitting_down); + else { + show_one(3); + dna.sitting_in_pub = true; + dna.user_moves_avvy = false; + tr[1].visible = false; + } } -void arkata_shouts() -{ - if (dna.teetotal) return; - dixi('q',76); - set_up_timer(160,procarkata_shouts,reason_arkata_shouts); +void ghost_room_phew() { + display("\6PHEW!\22 You're glad to get out of \6there!"); } -void winning() -{ - dixi('q',79); - winning_pic(); - do { checkclick(); } while (!(mrelease==0)); - callverb(vb_score); - display(" T H E E N D "); - lmo=true; +void arkata_shouts() { + if (dna.teetotal) return; + dixi('q', 76); + set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } -void avalot_falls() -{ - if (tr[1].step<5) - { - tr[1].step += 1; - set_up_timer(3,procavalot_falls,reason_falling_over); - } else - display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); +void winning() { + dixi('q', 79); + winning_pic(); + do { + checkclick(); + } while (!(mrelease == 0)); + callverb(vb_score); + display(" T H E E N D "); + lmo = true; } -void spludwick_goes_to_cauldron() -{ - if (tr[2].homing) - set_up_timer(1,procspludwick_goes_to_cauldron,reason_spludwalk); - else - set_up_timer(17,procspludwick_leaves_cauldron,reason_spludwalk); +void avalot_falls() { + if (tr[1].step < 5) { + tr[1].step += 1; + set_up_timer(3, procavalot_falls, reason_falling_over); + } else + display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); } -void spludwick_leaves_cauldron() -{ - tr[2].call_eachstep=true; /* So that normal procs will continue. */ +void spludwick_goes_to_cauldron() { + if (tr[2].homing) + set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + else + set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } -void give_lute_to_geida() /* Moved here from Acci. */ -{ - dixi('Q',86); - points(4); - dna.lustie_is_asleep=true; - first_show(5); then_show(6); /* He falls asleep... */ - start_to_close(); /* Not really closing, but we're using the same procedure. */ +void spludwick_leaves_cauldron() { + tr[2].call_eachstep = true; /* So that normal procs will continue. */ +} + +void give_lute_to_geida() { /* Moved here from Acci. */ + dixi('Q', 86); + points(4); + dna.lustie_is_asleep = true; + first_show(5); + then_show(6); /* He falls asleep... */ + start_to_close(); /* Not really closing, but we're using the same procedure. */ } /* "This is all!" */ class unit_timeout_initialize { - public: unit_timeout_initialize(); +public: + unit_timeout_initialize(); }; static unit_timeout_initialize timeout_constructor; unit_timeout_initialize::unit_timeout_initialize() { - fillchar(times,sizeof(times),'\0'); + fillchar(times, sizeof(times), '\0'); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h index ceb8c36dccc1..8bb2f8798c8c 100644 --- a/engines/avalanche/timeout.h +++ b/engines/avalanche/timeout.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -150,9 +150,9 @@ const integer procspludwick_leaves_cauldron = 40; const integer procgive_lute_to_geida = 41; struct timetype { - longint time_left; - byte then_where; - byte what_for; + longint time_left; + byte then_where; + byte what_for; }; @@ -161,12 +161,12 @@ struct timetype { #define EXTERN #endif -EXTERN array<1,7,timetype> times; +EXTERN array<1, 7, timetype> times; #undef EXTERN #define EXTERN extern -void set_up_timer(longint howlong, byte whither,byte why); +void set_up_timer(longint howlong, byte whither, byte why); void one_tick(); @@ -174,86 +174,86 @@ void lose_timer(byte which); /*function timer_is_on(which:byte):boolean;*/ - /* Procedures to do things at the end of amounts of time: */ +/* Procedures to do things at the end of amounts of time: */ - void open_drawbridge(); +void open_drawbridge(); - void avaricius_talks(); +void avaricius_talks(); - void urinate(); +void urinate(); - void toilet2(); +void toilet2(); - void bang(); +void bang(); - void bang2(); +void bang2(); - void stairs(); +void stairs(); - void cardiff_survey(); +void cardiff_survey(); - void cardiff_return(); +void cardiff_return(); - void cwytalot_in_herts(); +void cwytalot_in_herts(); - void get_tied_up(); +void get_tied_up(); - void get_tied_up2(); +void get_tied_up2(); - void hang_around(); +void hang_around(); - void hang_around2(); +void hang_around2(); - void after_the_shootemup(); +void after_the_shootemup(); - void jacques_wakes_up(); +void jacques_wakes_up(); - void naughty_duke(); +void naughty_duke(); - void naughty_duke2(); +void naughty_duke2(); - void naughty_duke3(); +void naughty_duke3(); - void jump(); +void jump(); - void crapulus_says_splud_out(); +void crapulus_says_splud_out(); - void buydrinks(); +void buydrinks(); - void buywine(); +void buywine(); - void callsguards(); +void callsguards(); - void greetsmonk(); +void greetsmonk(); - void fall_down_oubliette(); +void fall_down_oubliette(); - void meet_avaroid(); +void meet_avaroid(); - void rise_up_oubliette(); +void rise_up_oubliette(); - void robin_hood_and_geida(); +void robin_hood_and_geida(); - void robin_hood_and_geida_talk(); +void robin_hood_and_geida_talk(); - void avalot_returns(); +void avalot_returns(); - void avvy_sit_down(); +void avvy_sit_down(); - void ghost_room_phew(); +void ghost_room_phew(); - void arkata_shouts(); +void arkata_shouts(); - void winning(); +void winning(); - void avalot_falls(); +void avalot_falls(); - void spludwick_goes_to_cauldron(); +void spludwick_goes_to_cauldron(); - void spludwick_leaves_cauldron(); +void spludwick_leaves_cauldron(); - void give_lute_to_geida(); +void give_lute_to_geida(); - } // End of namespace Avalanche. +} // End of namespace Avalanche. #endif \ No newline at end of file diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index a9117c2e74ad..84b6f04ed77d 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,63 +30,65 @@ namespace Avalanche { -integer gd,gm; +integer gd, gm; -void zoomout(integer x,integer y) -{ - integer x1,y1,x2,y2; - byte fv; -; - setcolor(white); setwritemode(xorput); - setlinestyle(dottedln,0,1); +void zoomout(integer x, integer y) { + integer x1, y1, x2, y2; + byte fv; + ; + setcolor(white); + setwritemode(xorput); + setlinestyle(dottedln, 0, 1); - for( fv=1; fv <= 20; fv ++) - {; - x1=x-(x / 20)*fv; - y1=y-((y-10) / 20)*fv; - x2=x+(((639-x) / 20)*fv); - y2=y+(((161-y) / 20)*fv); + for (fv = 1; fv <= 20; fv ++) { + ; + x1 = x - (x / 20) * fv; + y1 = y - ((y - 10) / 20) * fv; + x2 = x + (((639 - x) / 20) * fv); + y2 = y + (((161 - y) / 20) * fv); - rectangle(x1,y1,x2,y2); - delay(17); - rectangle(x1,y1,x2,y2); - } + rectangle(x1, y1, x2, y2); + delay(17); + rectangle(x1, y1, x2, y2); + } } -void zoomin(integer x,integer y) -{ - integer x1,y1,x2,y2; - byte fv; -; - setcolor(white); setwritemode(xorput); - setlinestyle(dottedln,0,1); +void zoomin(integer x, integer y) { + integer x1, y1, x2, y2; + byte fv; + ; + setcolor(white); + setwritemode(xorput); + setlinestyle(dottedln, 0, 1); - for( fv=20; fv >= 1; fv --) - {; - x1=x-(x / 20)*fv; - y1=y-((y-10) / 20)*fv; - x2=x+(((639-x) / 20)*fv); - y2=y+(((161-y) / 20)*fv); + for (fv = 20; fv >= 1; fv --) { + ; + x1 = x - (x / 20) * fv; + y1 = y - ((y - 10) / 20) * fv; + x2 = x + (((639 - x) / 20) * fv); + y2 = y + (((161 - y) / 20) * fv); - rectangle(x1,y1,x2,y2); - delay(17); - rectangle(x1,y1,x2,y2); - } + rectangle(x1, y1, x2, y2); + delay(17); + rectangle(x1, y1, x2, y2); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - zoomout(177,77); - zoomout(7,31); - zoomout(577,124); - zoomout(320,85); - zoomin(177,77); - zoomin(7,31); - zoomin(577,124); - zoomin(320,85); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + zoomout(177, 77); + zoomout(7, 31); + zoomout(577, 124); + zoomout(320, 85); + zoomin(177, 77); + zoomin(7, 31); + zoomin(577, 124); + zoomin(320, 85); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 867ea344bce9..8ef57c591a4a 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -51,115 +51,187 @@ namespace Avalanche { /* Description: Write a array of colors in a vertical line. The current */ /* merge setting is used to control the combining of bits. */ /* */ - void gpwtcol(void* buf, integer n) /* Cedola */ - {; /* +void gpwtcol(void *buf, integer n) { /* Cedola */ + ; /* inline ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ - } +} -void loadtrip() -{ - untyped_file inf; -; - assign(inf,"t:avvy.trp"); reset(inf,1); - seek(inf,0x27); - blockread(inf,pozzes,sizeof(pozzes)); - blockread(inf,blue3,sizeof(blue3)); close(inf); +void loadtrip() { + untyped_file inf; + ; + assign(inf, "t:avvy.trp"); + reset(inf, 1); + seek(inf, 0x27); + blockread(inf, pozzes, sizeof(pozzes)); + blockread(inf, blue3, sizeof(blue3)); + close(inf); } -void plot(word count, integer ox,integer oy) /* orig x & y. Page is always 1. */ -{ - byte x,y,len; -; - do { - len=blue3[count]; if (len==177) return; - x=blue3[count+1]; y=blue3[count+2]; count += 3; - {; - gdcur_x=x+ox; gdcur_y=y+oy; - /* fiddle xy coords to match page 1 */ - gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ - if (gdcur_x<0) - {; gdcur_x += 640; gdcur_y -= 1; } - gpwtcol(&blue3[count],len); count += len; - } - } while (!false); +void plot(word count, integer ox, integer oy) { /* orig x & y. Page is always 1. */ + byte x, y, len; + ; + do { + len = blue3[count]; + if (len == 177) return; + x = blue3[count + 1]; + y = blue3[count + 2]; + count += 3; + { + ; + gdcur_x = x + ox; + gdcur_y = y + oy; + /* fiddle xy coords to match page 1 */ + gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ + if (gdcur_x < 0) { + ; + gdcur_x += 640; + gdcur_y -= 1; + } + gpwtcol(&blue3[count], len); + count += len; + } + } while (!false); } -void boundscheck() -{; - if (dna.uy>123) dna.uy=123; - if (dna.uy<10) dna.uy=10; - if (dna.ux<5) dna.ux=5; - if (dna.ux>600) dna.ux=600; +void boundscheck() { + ; + if (dna.uy > 123) dna.uy = 123; + if (dna.uy < 10) dna.uy = 10; + if (dna.ux < 5) dna.ux = 5; + if (dna.ux > 600) dna.ux = 600; } -void budge() -{; - if (set::of(up,ul,ur, eos).has(dna.rw)) dna.uy -= 3; - if (set::of(down,dl,dr, eos).has(dna.rw)) dna.uy += 3; - if (set::of(left,ul,dl, eos).has(dna.rw)) dna.ux -= 5; - if (set::of(right,ur,dr, eos).has(dna.rw)) dna.ux += 5; +void budge() { + ; + if (set::of(up, ul, ur, eos).has(dna.rw)) dna.uy -= 3; + if (set::of(down, dl, dr, eos).has(dna.rw)) dna.uy += 3; + if (set::of(left, ul, dl, eos).has(dna.rw)) dna.ux -= 5; + if (set::of(right, ur, dr, eos).has(dna.rw)) dna.ux += 5; - boundscheck(); + boundscheck(); - if (dna.rw>0) - {; - anim += 1; if (anim==7) anim=1; - } + if (dna.rw > 0) { + ; + anim += 1; + if (anim == 7) anim = 1; + } } -void tripkey(char dir) -{; - if (cw!=177) return; - { - dnatype& with = dna; - ; - switch (dir) { - case 'H': if (with.rw!=up) {; with.rw=up; ww=up; } else with.rw=0; break; - case 'P': if (with.rw!=down) {; with.rw=down; ww=down; } else with.rw=0; break; - case 'K': if (with.rw!=left) {; with.rw=left; ww=left; } else with.rw=0; break; - case 'M': if (with.rw!=right) {; with.rw=right; ww=right; } else with.rw=0; break; - case 'I': if (with.rw!=ur) {; with.rw=ur; ww=right; } else with.rw=0; break; - case 'Q': if (with.rw!=dr) {; with.rw=dr; ww=right; } else with.rw=0; break; - case 'O': if (with.rw!=dl) {; with.rw=dl; ww=left; } else with.rw=0; break; - case 'G': if (with.rw!=ul) {; with.rw=ul; ww=left; } else with.rw=0; break; - } - if (with.rw==0) - {; - ux=ppos[0][0]; uy=ppos[0][1]; anim -= 1; - if (anim==0) anim=6; - } - } +void tripkey(char dir) { + ; + if (cw != 177) return; + { + dnatype &with = dna; + ; + switch (dir) { + case 'H': + if (with.rw != up) { + ; + with.rw = up; + ww = up; + } else with.rw = 0; + break; + case 'P': + if (with.rw != down) { + ; + with.rw = down; + ww = down; + } else with.rw = 0; + break; + case 'K': + if (with.rw != left) { + ; + with.rw = left; + ww = left; + } else with.rw = 0; + break; + case 'M': + if (with.rw != right) { + ; + with.rw = right; + ww = right; + } else with.rw = 0; + break; + case 'I': + if (with.rw != ur) { + ; + with.rw = ur; + ww = right; + } else with.rw = 0; + break; + case 'Q': + if (with.rw != dr) { + ; + with.rw = dr; + ww = right; + } else with.rw = 0; + break; + case 'O': + if (with.rw != dl) { + ; + with.rw = dl; + ww = left; + } else with.rw = 0; + break; + case 'G': + if (with.rw != ul) { + ; + with.rw = ul; + ww = left; + } else with.rw = 0; + break; + } + if (with.rw == 0) { + ; + ux = ppos[0][0]; + uy = ppos[0][1]; + anim -= 1; + if (anim == 0) anim = 6; + } + } } -void trippancy() -{; - if ((dna.rw==0) || (cw!=177) || (! dropsok)) return; - r.ax=11; intr(0x33,r); - setactivepage(1); off(); - if (ppos[0][1]!=-177) - {; - putimage(ppos[0][0],ppos[0][1],replace[0],0); - } - - getimage(dna.ux,dna.uy,dna.ux+xw,dna.uy+yw,replace[0]); - ppos[0][0]=dna.ux; ppos[0][1]=dna.uy; - - plot(pozzes[anim*4+dna.ww-4],dna.ux,dna.uy); - - { void& with = r; if ((cx==0) && (dx==0)) on();} - getimage(dna.ux-margin,dna.uy-margin,dna.ux+xw+margin,dna.uy+yw+margin,copier); - setactivepage(0); off(); putimage(dna.ux-margin,dna.uy-margin,copier,0); on(); - - { - void& with = mouths[0]; ; x=dna.ux+20; y=dna.uy; } - - budge(); +void trippancy() { + ; + if ((dna.rw == 0) || (cw != 177) || (! dropsok)) return; + r.ax = 11; + intr(0x33, r); + setactivepage(1); + off(); + if (ppos[0][1] != -177) { + ; + putimage(ppos[0][0], ppos[0][1], replace[0], 0); + } + + getimage(dna.ux, dna.uy, dna.ux + xw, dna.uy + yw, replace[0]); + ppos[0][0] = dna.ux; + ppos[0][1] = dna.uy; + + plot(pozzes[anim * 4 + dna.ww - 4], dna.ux, dna.uy); + + { + void &with = r; + if ((cx == 0) && (dx == 0)) on(); + } + getimage(dna.ux - margin, dna.uy - margin, dna.ux + xw + margin, dna.uy + yw + margin, copier); + setactivepage(0); + off(); + putimage(dna.ux - margin, dna.uy - margin, copier, 0); + on(); + + { + void &with = mouths[0]; ; + x = dna.ux + 20; + y = dna.uy; + } + + budge(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h index bfb645e3b563..0e5571715847 100644 --- a/engines/avalanche/trip.h +++ b/engines/avalanche/trip.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,17 +30,17 @@ namespace Avalanche { - void loadtrip(); +void loadtrip(); - void plot(word count, integer ox,integer oy); +void plot(word count, integer ox, integer oy); - void boundscheck(); +void boundscheck(); - void budge(); +void budge(); - void tripkey(char dir); +void tripkey(char dir); - void trippancy(); +void trippancy(); } // End of namespace Avalanche. diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index 1ca78fbf4767..4889b264a590 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -26,7 +26,7 @@ */ #define __trip3_implementation__ - /* Project Minstrel- Trippancy routines */ +/* Project Minstrel- Trippancy routines */ #include "trip3.h" @@ -42,22 +42,29 @@ const integer avvy = 1; const integer test = 177; struct triprec { - byte handle; /* who is it? */ - integer x,y; /* current x&y */ - byte xm,ym; /* x&y margins */ - shortint ix,iy; /* inc x&y */ - byte stage; /* animation */ - integer xl,yl; /* x&y length */ - boolean prime; /* true on first move */ - boolean alive; /* true if it moves */ + byte handle; /* who is it? */ + integer x, y; /* current x&y */ + byte xm, ym; /* x&y margins */ + shortint ix, iy; /* inc x&y */ + byte stage; /* animation */ + integer xl, yl; /* x&y length */ + boolean prime; /* true on first move */ + boolean alive; /* true if it moves */ }; -array<1,10,triprec> tr; +array<1, 10, triprec> tr; byte tramt; -array<1,20000,byte> blue3; -array<1,24,word> pozzes; - -const integer up = 1; const integer right = 2; const integer down = 3; const integer left = 4; const integer ur = 5; const integer dr = 6; const integer dl = 7; const integer ul = 8; +array<1, 20000, byte> blue3; +array<1, 24, word> pozzes; + +const integer up = 1; +const integer right = 2; +const integer down = 3; +const integer left = 4; +const integer ur = 5; +const integer dr = 6; +const integer dl = 7; +const integer ul = 8; /* */ /* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ @@ -66,195 +73,299 @@ const integer up = 1; const integer right = 2; const integer down = 3; const int /* Description: Write a array of colors in a vertical line. The current */ /* merge setting is used to control the combining of bits. */ /* */ - void gpwtcol(void* buf, integer n) /* Cedola */ - {; - /* inline - ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ - GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ - $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ - $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ - $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ - } - - -void loadtrip() -{ - untyped_file inf; -; - assign(inf,"t:avvy.trp"); reset(inf,1); - seek(inf,0x27); - blockread(inf,pozzes,sizeof(pozzes)); - blockread(inf,blue3,sizeof(blue3)); close(inf); +void gpwtcol(void *buf, integer n) { /* Cedola */ + ; + /* inline + ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ + GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ + $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ + $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ + $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ +} + + +void loadtrip() { + untyped_file inf; + ; + assign(inf, "t:avvy.trp"); + reset(inf, 1); + seek(inf, 0x27); + blockread(inf, pozzes, sizeof(pozzes)); + blockread(inf, blue3, sizeof(blue3)); + close(inf); } -void enter(byte what_handle, integer xx,integer yy,integer lx,integer ly, byte mmx,byte mmy,byte st) -{; - tramt += 1; - { - triprec& with = tr[tramt]; - ; - with.handle=what_handle; - with.ix=0; with.iy=0; - with.x=xx; with.y=yy; - with.xl=lx; with.yl=ly; - with.xm=mmx; with.ym=mmy; with.stage=st; - with.prime=true; with.alive=true; - } +void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byte mmx, byte mmy, byte st) { + ; + tramt += 1; + { + triprec &with = tr[tramt]; + ; + with.handle = what_handle; + with.ix = 0; + with.iy = 0; + with.x = xx; + with.y = yy; + with.xl = lx; + with.yl = ly; + with.xm = mmx; + with.ym = mmy; + with.stage = st; + with.prime = true; + with.alive = true; + } } -void plot(byte stage, integer ox,integer oy) /* orig x & y. Page is always 1/UNSEEN. */ -{ - byte x,y,len; word count; -; - count=pozzes[stage]; - do { - len=blue3[count]; if (len==177) return; - x=blue3[count+1]; y=blue3[count+2]; count += 3; - {; - gdcur_x=x+ox; gdcur_y=y+oy; - /* fiddle xy coords to match page 1 */ - gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ - if (gdcur_x<0) - {; gdcur_x += 640; gdcur_y -= 1; } - gpwtcol(&blue3[count],len); count += len; - } - } while (!false); +void plot(byte stage, integer ox, integer oy) { /* orig x & y. Page is always 1/UNSEEN. */ + byte x, y, len; + word count; + ; + count = pozzes[stage]; + do { + len = blue3[count]; + if (len == 177) return; + x = blue3[count + 1]; + y = blue3[count + 2]; + count += 3; + { + ; + gdcur_x = x + ox; + gdcur_y = y + oy; + /* fiddle xy coords to match page 1 */ + gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ + if (gdcur_x < 0) { + ; + gdcur_x += 640; + gdcur_y -= 1; + } + gpwtcol(&blue3[count], len); + count += len; + } + } while (!false); } -void trippancy() -{ - byte fv; pointer p,saved1,saved2; word s; array<1,10,pointer> q; - boolean allstill; -; - if ((cw!=177) || (! dropsok) || keypressed()) return; - - /* Do the Avvy Walk */ - - switch (dna.rw) { - case up: budge(avvy, 0,-3,anim*4-3); break; - case down: budge(avvy, 0, 3,anim*4-1); break; - case right: budge(avvy, 5, 0,anim*4-2); break; - case left: budge(avvy,-5, 0,anim*4 ); break; - case ul: budge(avvy,-5,-3,anim*4 ); break; - case dl: budge(avvy,-5, 3,anim*4 ); break; - case ur: budge(avvy, 5,-3,anim*4-2); break; - case dr: budge(avvy, 5, 3,anim*4-2); break; - } - - for( fv=1; fv <= tramt; fv ++) { triprec& with = tr[fv]; boundscheck(with.x,with.y,with.xm,with.ym);} - - allstill=true; - for( fv=1; fv <= tramt; fv ++) - { triprec& with = tr[fv]; - if (((with.alive) && (! ((with.ix==0) && (with.iy==0)))) || with.prime) allstill=false;} - if (allstill) return; - - if (dna.rw>0) - {; - anim += 1; if (anim==7) anim=1; - } - - /* Trippancy Step 1 - Grab moon array of unmargined sprites (phew) */ - mark(saved1); - setactivepage(1); off(); - for( fv=1; fv <= tramt; fv ++) - { - triprec& with = tr[fv]; - ; - s=imagesize(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym); - getmem(q[fv],s); getimage(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym,q[fv]); - } - /* Step 2 - Plot sprites on 1/UNSEEN */ - for( fv=1; fv <= tramt; fv ++) - { - triprec& with = tr[fv]; - ; - plot(with.stage,with.x,with.y); - } - /* Step 3 - Copy all eligible from 1/UNSEEN to 0/SEEN */ - mark(saved2); - for( fv=1; fv <= tramt; fv ++) - { triprec& with = tr[fv]; - if (((with.alive) && (! ((with.ix==0) && (with.iy==0)))) || with.prime) - {; - s=imagesize(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym); - getmem(p,s); - setactivepage(1); getimage(with.x-with.xm,with.y-with.ym,with.x+with.xl+with.xm,with.y+with.yl+with.ym,p); - setactivepage(0); putimage(with.x-with.xm,with.y-with.ym,p,0); - release(saved2); with.prime=false; - }} - /* Step 4 - Unplot sprites from 1/UNSEEN */ - setactivepage(1); - for( fv=1; fv <= tramt; fv ++) - { - triprec& with = tr[fv]; - ; - putimage(with.x-with.xm,with.y-with.ym,q[fv],0); - if (with.ix!=0) with.x=with.x+with.ix; - if (with.iy!=0) with.y=with.y+with.iy; - with.ix=0; with.iy=0; - if (with.handle==avvy) { - dnatype& with1 = dna; ; ux=with.x; uy=with.y; } - } - on(); release(saved1); - for( fv=1; fv <= tramt; fv ++) /* synch xy coords of mouths */ - { - triprec& with = tr[fv]; - ; mouths[fv].x=with.x+20; mouths[fv].y=with.y; } - - setactivepage(0); +void trippancy() { + byte fv; + pointer p, saved1, saved2; + word s; + array<1, 10, pointer> q; + boolean allstill; + ; + if ((cw != 177) || (! dropsok) || keypressed()) return; + + /* Do the Avvy Walk */ + + switch (dna.rw) { + case up: + budge(avvy, 0, -3, anim * 4 - 3); + break; + case down: + budge(avvy, 0, 3, anim * 4 - 1); + break; + case right: + budge(avvy, 5, 0, anim * 4 - 2); + break; + case left: + budge(avvy, -5, 0, anim * 4); + break; + case ul: + budge(avvy, -5, -3, anim * 4); + break; + case dl: + budge(avvy, -5, 3, anim * 4); + break; + case ur: + budge(avvy, 5, -3, anim * 4 - 2); + break; + case dr: + budge(avvy, 5, 3, anim * 4 - 2); + break; + } + + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + boundscheck(with.x, with.y, with.xm, with.ym); + } + + allstill = true; + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + if (((with.alive) && (!((with.ix == 0) && (with.iy == 0)))) || with.prime) allstill = false; + } + if (allstill) return; + + if (dna.rw > 0) { + ; + anim += 1; + if (anim == 7) anim = 1; + } + + /* Trippancy Step 1 - Grab moon array of unmargined sprites (phew) */ + mark(saved1); + setactivepage(1); + off(); + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + ; + s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); + getmem(q[fv], s); + getimage(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym, q[fv]); + } + /* Step 2 - Plot sprites on 1/UNSEEN */ + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + ; + plot(with.stage, with.x, with.y); + } + /* Step 3 - Copy all eligible from 1/UNSEEN to 0/SEEN */ + mark(saved2); + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + if (((with.alive) && (!((with.ix == 0) && (with.iy == 0)))) || with.prime) { + ; + s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); + getmem(p, s); + setactivepage(1); + getimage(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym, p); + setactivepage(0); + putimage(with.x - with.xm, with.y - with.ym, p, 0); + release(saved2); + with.prime = false; + } + } + /* Step 4 - Unplot sprites from 1/UNSEEN */ + setactivepage(1); + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + ; + putimage(with.x - with.xm, with.y - with.ym, q[fv], 0); + if (with.ix != 0) with.x = with.x + with.ix; + if (with.iy != 0) with.y = with.y + with.iy; + with.ix = 0; + with.iy = 0; + if (with.handle == avvy) { + dnatype &with1 = dna; ; + ux = with.x; + uy = with.y; + } + } + on(); + release(saved1); + for (fv = 1; fv <= tramt; fv ++) { /* synch xy coords of mouths */ + triprec &with = tr[fv]; + ; + mouths[fv].x = with.x + 20; + mouths[fv].y = with.y; + } + + setactivepage(0); } -void budge(byte who, shortint xx,shortint yy, byte frame) /* Moving & animation controller */ -{ - byte fv; -; - for( fv=1; fv <= tramt; fv ++) - { triprec& with = tr[fv]; - if (with.handle==who) - {; - with.ix=xx; with.iy=yy; - with.stage=frame; - }} +void budge(byte who, shortint xx, shortint yy, byte frame) { /* Moving & animation controller */ + byte fv; + ; + for (fv = 1; fv <= tramt; fv ++) { + triprec &with = tr[fv]; + if (with.handle == who) { + ; + with.ix = xx; + with.iy = yy; + with.stage = frame; + } + } } -void tripkey(char dir) -{; - if (cw!=177) return; - { - dnatype& with = dna; - ; - switch (dir) { - case 'H': if (with.rw!=up) {; with.rw=up; ww=up; } else with.rw=0; break; - case 'P': if (with.rw!=down) {; with.rw=down; ww=down; } else with.rw=0; break; - case 'K': if (with.rw!=left) {; with.rw=left; ww=left; } else with.rw=0; break; - case 'M': if (with.rw!=right) {; with.rw=right; ww=right; } else with.rw=0; break; - case 'I': if (with.rw!=ur) {; with.rw=ur; ww=right; } else with.rw=0; break; - case 'Q': if (with.rw!=dr) {; with.rw=dr; ww=right; } else with.rw=0; break; - case 'O': if (with.rw!=dl) {; with.rw=dl; ww=left; } else with.rw=0; break; - case 'G': if (with.rw!=ul) {; with.rw=ul; ww=left; } else with.rw=0; break; - } - if (with.rw==0) - {; - ux=ppos[0][0]; uy=ppos[0][1]; anim -= 1; - if (anim==0) anim=6; - } - } +void tripkey(char dir) { + ; + if (cw != 177) return; + { + dnatype &with = dna; + ; + switch (dir) { + case 'H': + if (with.rw != up) { + ; + with.rw = up; + ww = up; + } else with.rw = 0; + break; + case 'P': + if (with.rw != down) { + ; + with.rw = down; + ww = down; + } else with.rw = 0; + break; + case 'K': + if (with.rw != left) { + ; + with.rw = left; + ww = left; + } else with.rw = 0; + break; + case 'M': + if (with.rw != right) { + ; + with.rw = right; + ww = right; + } else with.rw = 0; + break; + case 'I': + if (with.rw != ur) { + ; + with.rw = ur; + ww = right; + } else with.rw = 0; + break; + case 'Q': + if (with.rw != dr) { + ; + with.rw = dr; + ww = right; + } else with.rw = 0; + break; + case 'O': + if (with.rw != dl) { + ; + with.rw = dl; + ww = left; + } else with.rw = 0; + break; + case 'G': + if (with.rw != ul) { + ; + with.rw = ul; + ww = left; + } else with.rw = 0; + break; + } + if (with.rw == 0) { + ; + ux = ppos[0][0]; + uy = ppos[0][1]; + anim -= 1; + if (anim == 0) anim = 6; + } + } } -void boundscheck(integer& x,integer& y, byte xm,byte ym) -{; - if (y>127-ym) y=127-ym; if (y640-xm) x=640-xm; +void boundscheck(integer &x, integer &y, byte xm, byte ym) { + ; + if (y > 127 - ym) y = 127 - ym; + if (y < ym + 10) y = ym + 10; + if (x < xm) x = xm; + if (x > 640 - xm) x = 640 - xm; } class unit_trip3_initialize { - public: unit_trip3_initialize(); +public: + unit_trip3_initialize(); }; static unit_trip3_initialize trip3_constructor; -unit_trip3_initialize::unit_trip3_initialize() {; /* init portion of Trip3 */ - tramt=0; +unit_trip3_initialize::unit_trip3_initialize() { + ; /* init portion of Trip3 */ + tramt = 0; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h index 4a5f6fb9d070..01428081d6dd 100644 --- a/engines/avalanche/trip3.h +++ b/engines/avalanche/trip3.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,18 +33,18 @@ namespace Avalanche { - void loadtrip(); +void loadtrip(); - void boundscheck(integer& x,integer& y, byte xm,byte ym); +void boundscheck(integer &x, integer &y, byte xm, byte ym); - void budge(byte who, shortint xx,shortint yy, byte frame); /* Moving & animation controller */ +void budge(byte who, shortint xx, shortint yy, byte frame); /* Moving & animation controller */ - void tripkey(char dir); +void tripkey(char dir); - void trippancy(); +void trippancy(); - void enter(byte what_handle, integer xx,integer yy,integer lx,integer ly, byte mmx,byte mmy,byte st); +void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byte mmx, byte mmy, byte st); - } // End of namespace Avalanche. +} // End of namespace Avalanche. #endif \ No newline at end of file diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index a587dc1e7eeb..04acf36f74c8 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,7 +33,7 @@ TRIP42 Trippancy IV point 2 - "Trip Oop 2" */ #define __trip42_implementation__ - /* Trippancy IV.2 (Trip Oop) */ +/* Trippancy IV.2 (Trip Oop) */ #include "trip42.h" @@ -76,403 +76,584 @@ begin; end; end; */ -void loadtrip() -{ - byte gm; -; - for( gm=1; gm <= numtr; gm ++) tr[gm].original(); - tr[1].init(0); -} - -byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) -{ - byte a,c; integer fv,ff; -byte checkfeet_result; -; - a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; - if (oya) a=c; - } else - for( fv=x1; fv <= x2; fv ++) - for( ff=y+yl; ff <= oy+yl; ff ++) - {; - c=getpixel(fv,ff); - if (c>a) a=c; - } - checkfeet_result=a; setactivepage(1-cp); -return checkfeet_result; +void loadtrip() { + byte gm; + ; + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + tr[1].init(0); +} + +byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { + byte a, c; + integer fv, ff; + byte checkfeet_result; + ; + a = 0; + setactivepage(2); + if (x1 < 0) x1 = 0; + if (x2 > 639) x2 = 639; + if (oy < y) + for (fv = x1; fv <= x2; fv ++) + for (ff = oy + yl; ff <= y + yl; ff ++) { + ; + c = getpixel(fv, ff); + if (c > a) a = c; + } + else + for (fv = x1; fv <= x2; fv ++) + for (ff = y + yl; ff <= oy + yl; ff ++) { + ; + c = getpixel(fv, ff); + if (c > a) a = c; + } + checkfeet_result = a; + setactivepage(1 - cp); + return checkfeet_result; } void touchcol(byte tc); -static boolean bug; - -static void fr(byte a,byte b) {; fliproom(a,b); bug=false; } - -void touchcol(byte tc) -{; - bug=true; /* j.i.c. */ - switch (dna.room) { - case 1: fr(2,3); break; - case 2: {; /* main corridor */ - switch (tc) { - case 1: fr(3,1); break; /* to the other corridor */ - case 2: fr(2,1); break; /* to this corridor! Fix this later... */ - } - } - break; - case 3: {; /* turn corridor */ - switch (tc) { - case 1: fr(2,1); break; /* to the other corridor */ - case 2: fr(12,1); break; /* through Spludwick's door */ - } - } - break; - case 12: fr(3,2); break; - } - if (bug) - {; - display(string('\7')+"Unknown touchcolour ("+strf(tc)+')'+" in "+strf(dna.room) - +'.'); tr[1].bounce(); - } -} - -triptype* triptype::init(byte spritenum) -{ - integer gd,gm; word s; untyped_file f; varying_string<2> xx; byte sort,n; - word bigsize; pointer p,q; -; - str(spritenum,xx); assign(f,string("c:\\avalot\\sprite")+xx+".avd"); - reset(f,1); seek(f,59); - blockread(f,a,sizeof(a)); blockread(f,bigsize,2); - setactivepage(3); - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); - blockread(f,p,bigsize); - off; putimage(0,0,p,0); release(q); n=1; - { adxtype& with = a; - for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= with.seq-1; gd ++) /* steps */ - {; - getmem(pic[n][sort],a.size); /* grab the memory */ - getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, - (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, - pic[n][sort]); /* grab the pic */ - n += 1; - }} /*on;*/ - } - close(f); setactivepage(1-cp); - - x=0; y=0; quick=true; visible=false; -/* for x:=0 to 1 do getmem(behind[x],a.size);*/ - homing=false; ix=0; iy=0; step=0; check_me=a.name=="Avalot"; - count=0; -return this; -} - -void triptype::original() -{; - quick=false; -} - -void triptype::andexor() -{ - byte picnum; /* Picnum, Picnic, what ye heck */ -; - picnum=face*a.seq+step+1; off; - putimage(x,y,pic[picnum][0],andput); - putimage(x,y,pic[picnum][1],xorput); /*on;*/ -} - -void triptype::turn(byte whichway) -{; - if (whichway==8) face=0; else face=whichway; -} - -void triptype::appear(integer wx,integer wy, byte wf) -{; - x=(wx / 8)*8; y=wy; ox[cp]=wx; oy[cp]=wy; turn(wf); - visible=true; ix=0; iy=0; -} - -void triptype::walk() -{ - byte tc; fieldtype r; -; - {; - x1=x-1; y1=y-2; x2=x+a.xl+1; y2=y+a.yl+2; - } - getset[1-cp].remember(r); - ox[cp]=x; oy[cp]=y; - if (homing) homestep(); - x=x+ix; y=y+iy; - if (check_me) {; - tc=checkfeet(x,x+a.xl,oy[cp],y,a.yl); - if (tc!=0) - { void& with = magics[tc]; - switch (op) { - case exclaim: {; bounce(); dixi('x',data); } break; - case bounces: bounce(); break; - case transport: fliproom(hi(data),lo(data)); break; - case unfinished: {; - bounce(); - display("\7Sorry.\3\rThis place is not avaliable yet!"); - } - break; - }} - } - count += 1; - if (((ix!=0) || (iy!=0)) && (count>1)) - {; - step += 1; if (step==a.seq) step=0; count=0; - } -} - -void triptype::bounce() -{; x=ox[cp]; y=oy[cp]; stopwalk(); return; } - -void triptype::walkto(integer xx,integer yy) -{; - speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; -} - -void triptype::stophoming() -{; - homing=false; -} - -void triptype::homestep() -{ - integer temp; -; - if ((hx==x) && (hy==y)) - {; /* touching the target */ - homing=false; return; - } - ix=0; iy=0; - if (hy!=y) - {; - temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; - } - if (hx!=x) - {; - temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; - } -} - -void triptype::speed(shortint xx,shortint yy) -{; - ix=xx; iy=yy; - if ((ix==0) && (iy==0)) return; /* no movement */ - if (ix==0) - {; /* No horz movement */ - if (iy<0) turn(up); else turn(down); - } else - {; - if (ix<0) turn(left); else turn(right); - } -} - -void triptype::stopwalk() -{; - ix=0; iy=0; homing=false; -} - -void triptype::chatter() -{; - talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; -} - -getsettype* getsettype::init() -{; - numleft=0; /* initialise array pointer */ - return this; -} - -void getsettype::remember(fieldtype r) -{; - numleft += 1; - gs[numleft]=r; -} - -void getsettype::recall(fieldtype& r) -{; - r=gs[numleft]; - numleft -= 1; -} - -void rwsp(byte t,byte r) -{ - const integer xs = 3; const integer ys = 1; -; - { triptype& with = tr[t]; switch (r) { - case up: speed( 0,-ys); break; case down: speed( 0, ys); break; case left: speed(-xs, 0); break; - case right: speed( xs, 0); break; case ul: speed(-xs,-ys); break; case ur: speed( xs,-ys); break; - case dl: speed(-xs, ys); break; case dr: speed( xs, ys); break; - }} -} - -void apped(byte trn,byte np) -{; - { - triptype& with = tr[trn]; - ; { void& with1 = peds[np]; appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir);} - rwsp(trn,tr[trn].face); } -} - -void getback() -{ - byte fv; - fieldtype r; -; - { getsettype& with = getset[1-cp]; - while (with.numleft>0) - {; - recall(r); - mblit(x1,y1,x2,y2,3,1-cp); - }} -} - -void trippancy_link() -{ - byte fv; -; - if ((ddm_o.menunow) | ontoolbar | seescroll | (~ alive)) return; - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) getback();} - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) walk();} - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick && with.visible) andexor();} -} - -void stopwalking() -{; - tr[1].stopwalk(); dna.rw=stopped; -} - -void tripkey(char dir) -{; - if (ctrl==cjoy) return; - - { triptype& with = tr[1]; - {; - switch (dir) { - case 'H': if (rw!=up) - {; rw=up; rwsp(1,rw); } else stopwalking(); - break; - case 'P': if (rw!=down) - {; rw=down; rwsp(1,rw); } else stopwalking(); - break; - case 'K': if (rw!=left) - {; rw=left; rwsp(1,rw); } else stopwalking(); - break; - case 'M': if (rw!=right) - {; rw=right; rwsp(1,rw); } else stopwalking(); - break; - case 'I': if (rw!=ur) - {; rw=ur; rwsp(1,rw); } else stopwalking(); - break; - case 'Q': if (rw!=dr) - {; rw=dr; rwsp(1,rw); } else stopwalking(); - break; - case 'O': if (rw!=dl) - {; rw=dl; rwsp(1,rw); } else stopwalking(); - break; - case 'G': if (rw!=ul) - {; rw=ul; rwsp(1,rw); } else stopwalking(); - break; - case 'L': stopwalking(); break; - } - }} -} - -void getsetclear() -{ - byte fv; -; - for( fv=0; fv <= 1; fv ++) getset[fv].init(); -} - -void fliproom(byte room,byte ped) -{; - dusk; getsetclear(); enterroom(room); apped(1,ped); - oldrw=dna.rw; dna.rw=tr[1].face; showrw; dawn; -} - -boolean infield(byte x) /* returns True if you're within field "x" */ -{ - integer yy; -boolean infield_result; -; - { void& with = fields[x]; { - triptype& with = tr[1]; - ; - yy=with.y+with.a.yl; - infield_result=(with.x>=x1) && (with.x<=x2) && (yy>=y1) && (yy<=y2); - }} -return infield_result; -} - -boolean neardoor() /* returns True if you're near a door! */ -{ - integer ux,uy; byte fv; boolean nd; -boolean neardoor_result; -; - if (numfields<9) - {; /* there ARE no doors here! */ - neardoor_result=false; - return neardoor_result; - } - { - triptype& with = tr[1]; - ; - ux=with.x; - uy=with.y+with.a.yl; - } nd=false; - for( fv=9; fv <= numfields; fv ++) - { - void& with = fields[fv]; - ; - if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; - } - neardoor_result=nd; -return neardoor_result; -} - -void readstick() -{ - byte jw; -; - if (ctrl==ckey) return; - - jw=joyway; - - { - triptype& with = tr[1]; - ; - if (jw==stopped) stopwalking(); else - {; - dna.rw=jw; rwsp(1,dna.rw); - } - } - - if (jw!=oldjw) - {; - showrw; - oldjw=jw; - } +static boolean bug; + +static void fr(byte a, byte b) { + ; + fliproom(a, b); + bug = false; +} + +void touchcol(byte tc) { + ; + bug = true; /* j.i.c. */ + switch (dna.room) { + case 1: + fr(2, 3); + break; + case 2: { + ; /* main corridor */ + switch (tc) { + case 1: + fr(3, 1); + break; /* to the other corridor */ + case 2: + fr(2, 1); + break; /* to this corridor! Fix this later... */ + } + } + break; + case 3: { + ; /* turn corridor */ + switch (tc) { + case 1: + fr(2, 1); + break; /* to the other corridor */ + case 2: + fr(12, 1); + break; /* through Spludwick's door */ + } + } + break; + case 12: + fr(3, 2); + break; + } + if (bug) { + ; + display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) + + '.'); + tr[1].bounce(); + } +} + +triptype *triptype::init(byte spritenum) { + integer gd, gm; + word s; + untyped_file f; + varying_string<2> xx; + byte sort, n; + word bigsize; + pointer p, q; + ; + str(spritenum, xx); + assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); + reset(f, 1); + seek(f, 59); + blockread(f, a, sizeof(a)); + blockread(f, bigsize, 2); + setactivepage(3); + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + blockread(f, p, bigsize); + off; + putimage(0, 0, p, 0); + release(q); + n = 1; + { + adxtype &with = a; + for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ + ; + getmem(pic[n][sort], a.size); /* grab the memory */ + getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, + (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, + pic[n][sort]); /* grab the pic */ + n += 1; + } + } /*on;*/ + } + close(f); + setactivepage(1 - cp); + + x = 0; + y = 0; + quick = true; + visible = false; + /* for x:=0 to 1 do getmem(behind[x],a.size);*/ + homing = false; + ix = 0; + iy = 0; + step = 0; + check_me = a.name == "Avalot"; + count = 0; + return this; +} + +void triptype::original() { + ; + quick = false; +} + +void triptype::andexor() { + byte picnum; /* Picnum, Picnic, what ye heck */ + ; + picnum = face * a.seq + step + 1; + off; + putimage(x, y, pic[picnum][0], andput); + putimage(x, y, pic[picnum][1], xorput); /*on;*/ +} + +void triptype::turn(byte whichway) { + ; + if (whichway == 8) face = 0; + else face = whichway; +} + +void triptype::appear(integer wx, integer wy, byte wf) { + ; + x = (wx / 8) * 8; + y = wy; + ox[cp] = wx; + oy[cp] = wy; + turn(wf); + visible = true; + ix = 0; + iy = 0; +} + +void triptype::walk() { + byte tc; + fieldtype r; + ; + { + ; + x1 = x - 1; + y1 = y - 2; + x2 = x + a.xl + 1; + y2 = y + a.yl + 2; + } + getset[1 - cp].remember(r); + ox[cp] = x; + oy[cp] = y; + if (homing) homestep(); + x = x + ix; + y = y + iy; + if (check_me) { + ; + tc = checkfeet(x, x + a.xl, oy[cp], y, a.yl); + if (tc != 0) { + void &with = magics[tc]; + switch (op) { + case exclaim: { + ; + bounce(); + dixi('x', data); + } + break; + case bounces: + bounce(); + break; + case transport: + fliproom(hi(data), lo(data)); + break; + case unfinished: { + ; + bounce(); + display("\7Sorry.\3\rThis place is not avaliable yet!"); + } + break; + } + } + } + count += 1; + if (((ix != 0) || (iy != 0)) && (count > 1)) { + ; + step += 1; + if (step == a.seq) step = 0; + count = 0; + } +} + +void triptype::bounce() { + ; + x = ox[cp]; + y = oy[cp]; + stopwalk(); + return; +} + +void triptype::walkto(integer xx, integer yy) { + ; + speed(xx - x, yy - y); + hx = xx; + hy = yy; + homing = true; +} + +void triptype::stophoming() { + ; + homing = false; +} + +void triptype::homestep() { + integer temp; + ; + if ((hx == x) && (hy == y)) { + ; /* touching the target */ + homing = false; + return; + } + ix = 0; + iy = 0; + if (hy != y) { + ; + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; + } + if (hx != x) { + ; + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } +} + +void triptype::speed(shortint xx, shortint yy) { + ; + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + ; /* No horz movement */ + if (iy < 0) turn(up); + else turn(down); + } else { + ; + if (ix < 0) turn(left); + else turn(right); + } +} + +void triptype::stopwalk() { + ; + ix = 0; + iy = 0; + homing = false; +} + +void triptype::chatter() { + ; + talkx = x + a.xl / 2; + talky = y; + talkf = a.fgc; + talkb = a.bgc; +} + +getsettype *getsettype::init() { + ; + numleft = 0; /* initialise array pointer */ + return this; +} + +void getsettype::remember(fieldtype r) { + ; + numleft += 1; + gs[numleft] = r; +} + +void getsettype::recall(fieldtype &r) { + ; + r = gs[numleft]; + numleft -= 1; +} + +void rwsp(byte t, byte r) { + const integer xs = 3; + const integer ys = 1; + ; + { + triptype &with = tr[t]; + switch (r) { + case up: + speed(0, -ys); + break; + case down: + speed(0, ys); + break; + case left: + speed(-xs, 0); + break; + case right: + speed(xs, 0); + break; + case ul: + speed(-xs, -ys); + break; + case ur: + speed(xs, -ys); + break; + case dl: + speed(-xs, ys); + break; + case dr: + speed(xs, ys); + break; + } + } +} + +void apped(byte trn, byte np) { + ; + { + triptype &with = tr[trn]; + ; + { + void &with1 = peds[np]; + appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); + } + rwsp(trn, tr[trn].face); + } +} + +void getback() { + byte fv; + fieldtype r; + ; + { + getsettype &with = getset[1 - cp]; + while (with.numleft > 0) { + ; + recall(r); + mblit(x1, y1, x2, y2, 3, 1 - cp); + } + } +} + +void trippancy_link() { + byte fv; + ; + if ((ddm_o.menunow) | ontoolbar | seescroll | (~ alive)) return; + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) getback(); + } + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) walk(); + } + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && with.visible) andexor(); + } +} + +void stopwalking() { + ; + tr[1].stopwalk(); + dna.rw = stopped; +} + +void tripkey(char dir) { + ; + if (ctrl == cjoy) return; + + { + triptype &with = tr[1]; + { + ; + switch (dir) { + case 'H': + if (rw != up) { + ; + rw = up; + rwsp(1, rw); + } else stopwalking(); + break; + case 'P': + if (rw != down) { + ; + rw = down; + rwsp(1, rw); + } else stopwalking(); + break; + case 'K': + if (rw != left) { + ; + rw = left; + rwsp(1, rw); + } else stopwalking(); + break; + case 'M': + if (rw != right) { + ; + rw = right; + rwsp(1, rw); + } else stopwalking(); + break; + case 'I': + if (rw != ur) { + ; + rw = ur; + rwsp(1, rw); + } else stopwalking(); + break; + case 'Q': + if (rw != dr) { + ; + rw = dr; + rwsp(1, rw); + } else stopwalking(); + break; + case 'O': + if (rw != dl) { + ; + rw = dl; + rwsp(1, rw); + } else stopwalking(); + break; + case 'G': + if (rw != ul) { + ; + rw = ul; + rwsp(1, rw); + } else stopwalking(); + break; + case 'L': + stopwalking(); + break; + } + } + } +} + +void getsetclear() { + byte fv; + ; + for (fv = 0; fv <= 1; fv ++) getset[fv].init(); +} + +void fliproom(byte room, byte ped) { + ; + dusk; + getsetclear(); + enterroom(room); + apped(1, ped); + oldrw = dna.rw; + dna.rw = tr[1].face; + showrw; + dawn; +} + +boolean infield(byte x) { /* returns True if you're within field "x" */ + integer yy; + boolean infield_result; + ; + { + void &with = fields[x]; + { + triptype &with = tr[1]; + ; + yy = with.y + with.a.yl; + infield_result = (with.x >= x1) && (with.x <= x2) && (yy >= y1) && (yy <= y2); + } + } + return infield_result; +} + +boolean neardoor() { /* returns True if you're near a door! */ + integer ux, uy; + byte fv; + boolean nd; + boolean neardoor_result; + ; + if (numfields < 9) { + ; /* there ARE no doors here! */ + neardoor_result = false; + return neardoor_result; + } + { + triptype &with = tr[1]; + ; + ux = with.x; + uy = with.y + with.a.yl; + } + nd = false; + for (fv = 9; fv <= numfields; fv ++) { + void &with = fields[fv]; + ; + if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; + } + neardoor_result = nd; + return neardoor_result; +} + +void readstick() { + byte jw; + ; + if (ctrl == ckey) return; + + jw = joyway; + + { + triptype &with = tr[1]; + ; + if (jw == stopped) stopwalking(); + else { + ; + dna.rw = jw; + rwsp(1, dna.rw); + } + } + + if (jw != oldjw) { + ; + showrw; + oldjw = jw; + } } class unit_trip42_initialize { - public: unit_trip42_initialize(); +public: + unit_trip42_initialize(); }; static unit_trip42_initialize trip42_constructor; -unit_trip42_initialize::unit_trip42_initialize() {; - getsetclear(); +unit_trip42_initialize::unit_trip42_initialize() { + ; + getsetclear(); } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h index 644a72190ed2..69f01c34ac2c 100644 --- a/engines/avalanche/trip42.h +++ b/engines/avalanche/trip42.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -40,49 +40,49 @@ namespace Avalanche { const integer maxgetset = 10; struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; class triptype { public: - adxtype a; /* vital statistics */ - byte face,step; - integer x,y; /* current xy coords */ - array<0,1,integer> ox,oy; /* last xy coords */ - shortint ix,iy; /* amount to move sprite by, each step */ - matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ - boolean quick,visible,homing,check_me; - integer hx,hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - - triptype* init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx,integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(integer xx,integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ + adxtype a; /* vital statistics */ + byte face, step; + integer x, y; /* current xy coords */ + array<0, 1, integer> ox, oy; /* last xy coords */ + shortint ix, iy; /* amount to move sprite by, each step */ + matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ + boolean quick, visible, homing, check_me; + integer hx, hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + + triptype *init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx, integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(integer xx, integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ }; class getsettype { public: - array<1,maxgetset,fieldtype> gs; - byte numleft; + array<1, maxgetset, fieldtype> gs; + byte numleft; - getsettype* init(); - void remember(fieldtype r); - void recall(fieldtype& r); + getsettype *init(); + void remember(fieldtype r); + void recall(fieldtype &r); }; const integer numtr = 5; /* current max no. of sprites */ @@ -93,9 +93,9 @@ void loadtrip(); void tripkey(char dir); -void apped(byte trn,byte np); +void apped(byte trn, byte np); -void fliproom(byte room,byte ped); +void fliproom(byte room, byte ped); boolean infield(byte x); /* returns True if you're within field "x" */ @@ -109,8 +109,8 @@ void readstick(); #define EXTERN #endif -EXTERN array<1,numtr,triptype> tr; -EXTERN array<0,1,getsettype> getset; +EXTERN array<1, numtr, triptype> tr; +EXTERN array<0, 1, getsettype> getset; #undef EXTERN #define EXTERN extern diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index fc9429bc9521..9a6a82f6377a 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,7 +33,7 @@ TRIP5 Trippancy V */ #define __trip5_implementation__ - /* Trippancy V */ /* Define NOASM to use Pascal instead of asm. */ +/* Trippancy V */ /* Define NOASM to use Pascal instead of asm. */ /*$S- Fast!*/ #include "trip5.h" @@ -49,1290 +49,1403 @@ namespace Avalanche { -void loadtrip() -{ - byte gm; +void loadtrip() { + byte gm; - for( gm=1; gm <= numtr; gm ++) tr[gm].original(); - fillchar(aa,sizeof(aa),'\0'); + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + fillchar(aa, sizeof(aa), '\0'); } -byte checkfeet(integer x1,integer x2,integer oy,integer y, byte yl) -{ - byte a,c; integer fv,ff; - -/* if not alive then begin checkfeet:=0; exit; end;*/ - byte checkfeet_result; - a=0; setactivepage(2); if (x1<0) x1=0; if (x2>639) x2=639; - if (oya) a=c; - } else - for( fv=x1; fv <= x2; fv ++) - for( ff=y+yl; ff <= oy+yl; ff ++) - { - c=getpixel(fv,ff); - if (c>a) a=c; - } - checkfeet_result=a; setactivepage(1-cp); - return checkfeet_result; +byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { + byte a, c; + integer fv, ff; + + /* if not alive then begin checkfeet:=0; exit; end;*/ + byte checkfeet_result; + a = 0; + setactivepage(2); + if (x1 < 0) x1 = 0; + if (x2 > 639) x2 = 639; + if (oy < y) + for (fv = x1; fv <= x2; fv ++) + for (ff = oy + yl; ff <= y + yl; ff ++) { + c = getpixel(fv, ff); + if (c > a) a = c; + } + else + for (fv = x1; fv <= x2; fv ++) + for (ff = y + yl; ff <= oy + yl; ff ++) { + c = getpixel(fv, ff); + if (c > a) a = c; + } + checkfeet_result = a; + setactivepage(1 - cp); + return checkfeet_result; } -byte geida_ped(byte which) -{ - byte geida_ped_result; - switch (which) { - case 1: geida_ped_result= 7; break; - case 2:case 6: geida_ped_result= 8; break; - case 3:case 5: geida_ped_result= 9; break; - case 4: geida_ped_result=10; break; - } - return geida_ped_result; +byte geida_ped(byte which) { + byte geida_ped_result; + switch (which) { + case 1: + geida_ped_result = 7; + break; + case 2: + case 6: + geida_ped_result = 8; + break; + case 3: + case 5: + geida_ped_result = 9; + break; + case 4: + geida_ped_result = 10; + break; + } + return geida_ped_result; } void catamove(byte ped) - /* When you enter a new position in the catacombs, this procedure should - be called. It changes the Also codes so that they may match the picture - on the screen. (Coming soon: It draws up the screen, too.) */ +/* When you enter a new position in the catacombs, this procedure should + be called. It changes the Also codes so that they may match the picture + on the screen. (Coming soon: It draws up the screen, too.) */ { - longint here; - word xy_word; - byte fv,ff; - -/* XY_word is cat_x+cat_y*256. Thus, every room in the - catacombs has a different number for it. */ - - - { - xy_word=cat_x+cat_y*256; - geida_spin=0; - } - switch (xy_word) { - case 1801: { /* Exit catacombs */ - fliproom(r__lustiesroom,4); - display("Phew! Nice to be out of there!"); - return; - } - break; - case 1033: { /* Oubliette */ - fliproom(r__oubliette,1); - display("Oh, NO!\231\2"); - return; - } - break; - case 4: { - fliproom(r__geidas,1); - return; - } - break; - case 2307: { - fliproom(r__lusties,5); - display("Oh no... here we go again..."); - dna.user_moves_avvy=false; - tr[1].iy=1; tr[1].ix=0; - return; - } - break; - } - - if (~ dna.enter_catacombs_from_lusties_room) load(29); - here=catamap[cat_y][cat_x]; - - switch (here & 0xf) { /* West. */ - case 0: { /* no connection (wall) */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=nix; /* Door. */ - show_one(28); - } - break; - case 0x1: { /* no connection (wall + shield), */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=nix; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(29); /* ...shield. */ - } - break; - case 0x2: { /* wall with door */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door. */ - } - break; - case 0x3: { /* wall with door and shield */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(29); /* ...shield. */ - } - break; - case 0x4: { /* no connection (wall + window), */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=nix; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(5); /* ...window. */ - } - break; - case 0x5: { /* wall with door and window */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(5); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=nix; /* No door. */ - show_one(28); /* Wall, plus... */ - show_one(7); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - magics[2].op=bounces; /* Sloping wall. */ - magics[3].op=nix; /* Straight wall. */ - portals[13].op=special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(7); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - magics[2].op=nix; /* Sloping wall. */ - magics[3].op=special; /* Straight wall. */ - } - break; - } - - /* ---- */ - - switch ((cardinal)(here & 0xf0) >> 4) { /* East */ - case 0: { /* no connection (wall) */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=nix; /* Door. */ - show_one(19); - } - break; - case 0x1: { /* no connection (wall + window), */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=nix; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(20); /* ...window. */ - } - break; - case 0x2: { /* wall with door */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(21); /* ...door. */ - } - break; - case 0x3: { /* wall with door and window */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(20); /* ...door, and... */ - show_one(21); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=nix; /* No door. */ - show_one(19); /* Wall, plus... */ - show_one(18); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - magics[5].op=bounces; /* Sloping wall. */ - magics[6].op=nix; /* Straight wall. */ - portals[15].op=special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(21); /* ...door, and... */ - show_one(18); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - magics[5].op=nix; /* Sloping wall. */ - magics[6].op=special; /* Straight wall. */ - portals[15].op=nix; /* Door. */ - } - break; - } - - /* ---- */ - - switch ((cardinal)(here & 0xf00) >> 8) { /* South */ - case 0: { /* No connection. */ - magics[7].op=bounces; - magics[12].op=bounces; - magics[13].op=bounces; - } - break; - case 0x1: { - show_one(22); - { void& with = magics[13]; - if ((xy_word==2051) & (dna.geida_follows)) - op=exclaim; - else op=special;} /* Right exit south. */ - magics[7].op=bounces; - magics[12].op=bounces; - } - break; - case 0x2: { - show_one(23); - magics[7].op=special; /* Middle exit south. */ - magics[12].op=bounces; - magics[13].op=bounces; - } - break; - case 0x3: { - show_one(24); - magics[12].op=special; /* Left exit south. */ - magics[7].op=bounces; - magics[13].op=bounces; - } - break; - } - - switch ((cardinal)(here & 0xf000) >> 12) { /* North */ - case 0: { /* No connection */ - magics[1].op=bounces; - portals[12].op=nix; /* Door. */ - } - break; - /* LEFT handles: */ -/* $1: begin - show_one(4); - magics[1].op:=bounces; { Left exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end;*/ - case 0x2: { - show_one(4); - magics[1].op=bounces; /* Middle exit north. */ - portals[12].op=special; /* Door. */ - } - break; -/* $3: begin - show_one(4); - magics[1].op:=bounces; { Right exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end; - { RIGHT handles: } - $4: begin - show_one(3); - magics[1].op:=bounces; { Left exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end;*/ - case 0x5: { - show_one(3); - magics[1].op=bounces; /* Middle exit north. */ - portals[12].op=special; /* Door. */ - } - break; -/* $6: begin - show_one(3); - magics[1].op:=bounces; { Right exit north. } - portals[12].op:=special; { Door. } - end;*/ - /* ARCHWAYS: */ - case 0x7:case 0x8:case 0x9: { - show_one(6); - - if (((cardinal)(here & 0xf000) >> 12)>0x7) show_one(31); - if (((cardinal)(here & 0xf000) >> 12)==0x9) show_one(32); - - magics[1].op=special; /* Middle arch north. */ - portals[12].op=nix; /* Door. */ - } - break; - /* DECORATIONS: */ - case 0xd: { /* No connection + WINDOW */ - magics[1].op=bounces; - portals[12].op=nix; /* Door. */ - show_one(14); - } - break; - case 0xe: { /* No connection + TORCH */ - magics[1].op=bounces; - portals[12].op=nix; /* Door. */ - show_one(8); - } - break; - /* Recessed door: */ - case 0xf: { - magics[1].op=nix; /* Door to Geida's room. */ - show_one(1); - portals[12].op=special; /* Door. */ - } - break; - } - - switch (xy_word) { - case 514: show_one(17); break; /* [2,2] : "Art Gallery" sign over door. */ - case 264: show_one(9); break; /* [8,1] : "The Wrong Way!" sign. */ - case 1797: show_one(2); break; /* [5,7] : "Ite Mingite" sign. */ - case 258: for( fv=0; fv <= 2; fv ++) /* [2,1] : Art gallery - pictures */ - { - show_one_at(15,130+fv*120,70); - show_one_at(16,184+fv*120,78); - } - break; - case 1287: for( fv=10; fv <= 13; fv ++) show_one(fv); break; /* [7,5] : 4 candles. */ - case 776: show_one(10); break; /* [8,3] : 1 candle. */ - case 2049: show_one(11); break; /* [1,8] : another candle. */ - case 257: { show_one(12); show_one(13); } break; /* [1,1] : the other two. */ - } - - if ((dna.geida_follows) & (ped>0)) - { - triptype& with = tr[2]; - - if (! with.quick) /* If we don't already have her... */ - tr[2].init(5,true); /* ...Load Geida. */ - apped(2,geida_ped(ped)); - tr[2].call_eachstep =true; - tr[2].eachstep=procgeida_procs; - } + longint here; + word xy_word; + byte fv, ff; + + /* XY_word is cat_x+cat_y*256. Thus, every room in the + catacombs has a different number for it. */ + + + { + xy_word = cat_x + cat_y * 256; + geida_spin = 0; + } + switch (xy_word) { + case 1801: { /* Exit catacombs */ + fliproom(r__lustiesroom, 4); + display("Phew! Nice to be out of there!"); + return; + } + break; + case 1033: { /* Oubliette */ + fliproom(r__oubliette, 1); + display("Oh, NO!\231\2"); + return; + } + break; + case 4: { + fliproom(r__geidas, 1); + return; + } + break; + case 2307: { + fliproom(r__lusties, 5); + display("Oh no... here we go again..."); + dna.user_moves_avvy = false; + tr[1].iy = 1; + tr[1].ix = 0; + return; + } + break; + } + + if (~ dna.enter_catacombs_from_lusties_room) load(29); + here = catamap[cat_y][cat_x]; + + switch (here & 0xf) { /* West. */ + case 0: { /* no connection (wall) */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = nix; /* Door. */ + show_one(28); + } + break; + case 0x1: { /* no connection (wall + shield), */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = nix; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(29); /* ...shield. */ + } + break; + case 0x2: { /* wall with door */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door. */ + } + break; + case 0x3: { /* wall with door and shield */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(29); /* ...shield. */ + } + break; + case 0x4: { /* no connection (wall + window), */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = nix; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(5); /* ...window. */ + } + break; + case 0x5: { /* wall with door and window */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(5); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = nix; /* No door. */ + show_one(28); /* Wall, plus... */ + show_one(7); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + magics[2].op = bounces; /* Sloping wall. */ + magics[3].op = nix; /* Straight wall. */ + portals[13].op = special; /* Door. */ + show_one(28); /* Wall, plus... */ + show_one(30); /* ...door, and... */ + show_one(7); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + magics[2].op = nix; /* Sloping wall. */ + magics[3].op = special; /* Straight wall. */ + } + break; + } + + /* ---- */ + + switch ((cardinal)(here & 0xf0) >> 4) { /* East */ + case 0: { /* no connection (wall) */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = nix; /* Door. */ + show_one(19); + } + break; + case 0x1: { /* no connection (wall + window), */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = nix; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(20); /* ...window. */ + } + break; + case 0x2: { /* wall with door */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(21); /* ...door. */ + } + break; + case 0x3: { /* wall with door and window */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(20); /* ...door, and... */ + show_one(21); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = nix; /* No door. */ + show_one(19); /* Wall, plus... */ + show_one(18); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + magics[5].op = bounces; /* Sloping wall. */ + magics[6].op = nix; /* Straight wall. */ + portals[15].op = special; /* Door. */ + show_one(19); /* Wall, plus... */ + show_one(21); /* ...door, and... */ + show_one(18); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + magics[5].op = nix; /* Sloping wall. */ + magics[6].op = special; /* Straight wall. */ + portals[15].op = nix; /* Door. */ + } + break; + } + + /* ---- */ + + switch ((cardinal)(here & 0xf00) >> 8) { /* South */ + case 0: { /* No connection. */ + magics[7].op = bounces; + magics[12].op = bounces; + magics[13].op = bounces; + } + break; + case 0x1: { + show_one(22); + { + void &with = magics[13]; + if ((xy_word == 2051) & (dna.geida_follows)) + op = exclaim; + else op = special; + } /* Right exit south. */ + magics[7].op = bounces; + magics[12].op = bounces; + } + break; + case 0x2: { + show_one(23); + magics[7].op = special; /* Middle exit south. */ + magics[12].op = bounces; + magics[13].op = bounces; + } + break; + case 0x3: { + show_one(24); + magics[12].op = special; /* Left exit south. */ + magics[7].op = bounces; + magics[13].op = bounces; + } + break; + } + + switch ((cardinal)(here & 0xf000) >> 12) { /* North */ + case 0: { /* No connection */ + magics[1].op = bounces; + portals[12].op = nix; /* Door. */ + } + break; + /* LEFT handles: */ + /* $1: begin + show_one(4); + magics[1].op:=bounces; { Left exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end;*/ + case 0x2: { + show_one(4); + magics[1].op = bounces; /* Middle exit north. */ + portals[12].op = special; /* Door. */ + } + break; + /* $3: begin + show_one(4); + magics[1].op:=bounces; { Right exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end; + { RIGHT handles: } + $4: begin + show_one(3); + magics[1].op:=bounces; { Left exit north. } { Change magic number! } + portals[12].op:=special; { Door. } + end;*/ + case 0x5: { + show_one(3); + magics[1].op = bounces; /* Middle exit north. */ + portals[12].op = special; /* Door. */ + } + break; + /* $6: begin + show_one(3); + magics[1].op:=bounces; { Right exit north. } + portals[12].op:=special; { Door. } + end;*/ + /* ARCHWAYS: */ + case 0x7: + case 0x8: + case 0x9: { + show_one(6); + + if (((cardinal)(here & 0xf000) >> 12) > 0x7) show_one(31); + if (((cardinal)(here & 0xf000) >> 12) == 0x9) show_one(32); + + magics[1].op = special; /* Middle arch north. */ + portals[12].op = nix; /* Door. */ + } + break; + /* DECORATIONS: */ + case 0xd: { /* No connection + WINDOW */ + magics[1].op = bounces; + portals[12].op = nix; /* Door. */ + show_one(14); + } + break; + case 0xe: { /* No connection + TORCH */ + magics[1].op = bounces; + portals[12].op = nix; /* Door. */ + show_one(8); + } + break; + /* Recessed door: */ + case 0xf: { + magics[1].op = nix; /* Door to Geida's room. */ + show_one(1); + portals[12].op = special; /* Door. */ + } + break; + } + + switch (xy_word) { + case 514: + show_one(17); + break; /* [2,2] : "Art Gallery" sign over door. */ + case 264: + show_one(9); + break; /* [8,1] : "The Wrong Way!" sign. */ + case 1797: + show_one(2); + break; /* [5,7] : "Ite Mingite" sign. */ + case 258: + for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ + show_one_at(15, 130 + fv * 120, 70); + show_one_at(16, 184 + fv * 120, 78); + } + break; + case 1287: + for (fv = 10; fv <= 13; fv ++) show_one(fv); + break; /* [7,5] : 4 candles. */ + case 776: + show_one(10); + break; /* [8,3] : 1 candle. */ + case 2049: + show_one(11); + break; /* [1,8] : another candle. */ + case 257: { + show_one(12); + show_one(13); + } + break; /* [1,1] : the other two. */ + } + + if ((dna.geida_follows) & (ped > 0)) { + triptype &with = tr[2]; + + if (! with.quick) /* If we don't already have her... */ + tr[2].init(5, true); /* ...Load Geida. */ + apped(2, geida_ped(ped)); + tr[2].call_eachstep = true; + tr[2].eachstep = procgeida_procs; + } } void call_special(word which); - /* This proc gets called whenever you touch a line defined as Special. */ -static void dawndelay() - { set_up_timer(2,procdawn_delay,reason_dawndelay); } +/* This proc gets called whenever you touch a line defined as Special. */ +static void dawndelay() { + set_up_timer(2, procdawn_delay, reason_dawndelay); +} -void call_special(word which) -{ - switch (which) { - case 1: { /* Special 1: Room 22: top of stairs. */ - show_one(1); - dna.brummie_stairs=1; - magics[10].op=nix; - set_up_timer(10,procstairs,reason_brummiestairs); - stopwalking(); - dna.user_moves_avvy=false; - } - break; - case 2: { /* Special 2: Room 22: bottom of stairs. */ - dna.brummie_stairs=3; - magics[11].op=nix; - magics[12].op=exclaim; - magics[12].data=5; - magics[4].op=bounces; /* Now works as planned! */ - stopwalking(); - dixi('q',26); - dna.user_moves_avvy=true; - } - break; - case 3: { /* Special 3: Room 71: triggers dart. */ - tr[1].bounce(); /* Must include that. */ - - if (~ dna.arrow_triggered) - { - dna.arrow_triggered=true; - apped(2,4); /* The dart starts at ped 4, and... */ - tr[2].walkto(5); /* flies to ped 5. */ - tr[2].face=0; /* Only face. */ - /* Should call some kind of Eachstep procedure which will deallocate - the sprite when it hits the wall, and replace it with the chunk - graphic of the arrow buried in the plaster. */ - /* OK! */ - tr[2].call_eachstep=true; - tr[2].eachstep=procarrow_procs; - } - } - break; - - case 4: { /* This is the ghost room link. */ - dusk; - tr[1].turn(right); /* you'll see this after we get back from bootstrap */ - set_up_timer(1,procghost_room_phew,reason_ghost_room_phew); - back_to_bootstrap(3); - } - break; - - case 5: if (dna.friar_will_tie_you_up) - { /* Special 5: Room 42: touched tree, and get tied up. */ - magics[4].op=bounces; /* Boundary effect is now working again. */ - dixi('q',35); - tr[1].done(); - /*tr[1].vanishifstill:=true;*/ - show_one(2); - dixi('q',36); - dna.tied_up=true; - dna.friar_will_tie_you_up=false; - tr[2].walkto(3); - tr[2].vanishifstill=true; - tr[2].check_me=true; /* One of them must have Check_Me switched on. */ - whereis[pfriartuck]=177; /* Not here, then. */ - set_up_timer(364,prochang_around,reason_hanging_around); - } - break; - - case 6: { /* Special 6: fall down oubliette. */ - dna.user_moves_avvy=false; - tr[1].ix=3; - tr[1].iy=0; - tr[1].face=right; - set_up_timer(1,procfall_down_oubliette,reason_falling_down_oubliette); - } - break; - - case 7: { /* Special 7: stop falling down oubliette. */ - tr[1].visible=false; - magics[10].op=nix; - stopwalking(); - lose_timer(reason_falling_down_oubliette); - mblit(12,80,38,160,3,0); - mblit(12,80,38,160,3,1); - display("Oh dear, you seem to be down the bottom of an oubliette."); - set_up_timer(200,procmeet_avaroid,reason_meeting_avaroid); - } - break; - - case 8: /* Special 8: leave du Lustie's room. */ - if ((geida_follows) & (~ lustie_is_asleep)) - { - dixi('q',63); - tr[2].turn(down); tr[2].stopwalk(); tr[2].call_eachstep=false; /* Geida */ - gameover; - } - break; - - case 9: { /* Special 9: lose Geida to Robin Hood... */ - if (~ dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ - tr[2].call_eachstep=false; /* She no longer follows Avvy around. */ - tr[2].walkto(4); /* She walks to somewhere... */ - tr[1].done(); /* Lose Avvy. */ - dna.user_moves_avvy=false; - set_up_timer(40,procrobin_hood_and_geida,reason_robin_hood_and_geida); - } - break; - - case 10: { /* Special 10: transfer north in catacombs. */ - if ((dna.cat_x==4) && (dna.cat_y==1)) - { /* Into Geida's room. */ - if (dna.obj[key]) dixi('q',62); else - { - dixi('q',61); - return; - } - } - dusk; - dna.cat_y -= 1; - catamove(4); if (dna.room!=r__catacombs) return; - delavvy; - switch ((cardinal)(catamap[cat_y][cat_x] & 0xf00) >> 8) { - case 0x1: apped(1,12); break; - case 0x3: apped(1,11); break; - default: apped(1,4); - } - getback(); - dawndelay(); - } - break; - case 11: { /* Special 11: transfer east in catacombs. */ - dusk; - dna.cat_x += 1; - catamove(1); if (dna.room!=r__catacombs) return; - delavvy; - apped(1,1); - getback(); - dawndelay(); - } - break; - case 12: { /* Special 12: transfer south in catacombs. */ - dusk; - dna.cat_y += 1; - catamove(2); if (dna.room!=r__catacombs) return; - delavvy; - apped(1,2); - getback(); - dawndelay(); - } - break; - case 13: { /* Special 13: transfer west in catacombs. */ - dusk; - dna.cat_x -= 1; - catamove(3); if (dna.room!=r__catacombs) return; - delavvy; - apped(1,3); - getback(); - dawndelay(); - } - break; - } +void call_special(word which) { + switch (which) { + case 1: { /* Special 1: Room 22: top of stairs. */ + show_one(1); + dna.brummie_stairs = 1; + magics[10].op = nix; + set_up_timer(10, procstairs, reason_brummiestairs); + stopwalking(); + dna.user_moves_avvy = false; + } + break; + case 2: { /* Special 2: Room 22: bottom of stairs. */ + dna.brummie_stairs = 3; + magics[11].op = nix; + magics[12].op = exclaim; + magics[12].data = 5; + magics[4].op = bounces; /* Now works as planned! */ + stopwalking(); + dixi('q', 26); + dna.user_moves_avvy = true; + } + break; + case 3: { /* Special 3: Room 71: triggers dart. */ + tr[1].bounce(); /* Must include that. */ + + if (~ dna.arrow_triggered) { + dna.arrow_triggered = true; + apped(2, 4); /* The dart starts at ped 4, and... */ + tr[2].walkto(5); /* flies to ped 5. */ + tr[2].face = 0; /* Only face. */ + /* Should call some kind of Eachstep procedure which will deallocate + the sprite when it hits the wall, and replace it with the chunk + graphic of the arrow buried in the plaster. */ + /* OK! */ + tr[2].call_eachstep = true; + tr[2].eachstep = procarrow_procs; + } + } + break; + + case 4: { /* This is the ghost room link. */ + dusk; + tr[1].turn(right); /* you'll see this after we get back from bootstrap */ + set_up_timer(1, procghost_room_phew, reason_ghost_room_phew); + back_to_bootstrap(3); + } + break; + + case 5: + if (dna.friar_will_tie_you_up) { + /* Special 5: Room 42: touched tree, and get tied up. */ + magics[4].op = bounces; /* Boundary effect is now working again. */ + dixi('q', 35); + tr[1].done(); + /*tr[1].vanishifstill:=true;*/ + show_one(2); + dixi('q', 36); + dna.tied_up = true; + dna.friar_will_tie_you_up = false; + tr[2].walkto(3); + tr[2].vanishifstill = true; + tr[2].check_me = true; /* One of them must have Check_Me switched on. */ + whereis[pfriartuck] = 177; /* Not here, then. */ + set_up_timer(364, prochang_around, reason_hanging_around); + } + break; + + case 6: { /* Special 6: fall down oubliette. */ + dna.user_moves_avvy = false; + tr[1].ix = 3; + tr[1].iy = 0; + tr[1].face = right; + set_up_timer(1, procfall_down_oubliette, reason_falling_down_oubliette); + } + break; + + case 7: { /* Special 7: stop falling down oubliette. */ + tr[1].visible = false; + magics[10].op = nix; + stopwalking(); + lose_timer(reason_falling_down_oubliette); + mblit(12, 80, 38, 160, 3, 0); + mblit(12, 80, 38, 160, 3, 1); + display("Oh dear, you seem to be down the bottom of an oubliette."); + set_up_timer(200, procmeet_avaroid, reason_meeting_avaroid); + } + break; + + case 8: /* Special 8: leave du Lustie's room. */ + if ((geida_follows) & (~ lustie_is_asleep)) { + dixi('q', 63); + tr[2].turn(down); + tr[2].stopwalk(); + tr[2].call_eachstep = false; /* Geida */ + gameover; + } + break; + + case 9: { /* Special 9: lose Geida to Robin Hood... */ + if (~ dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ + tr[2].walkto(4); /* She walks to somewhere... */ + tr[1].done(); /* Lose Avvy. */ + dna.user_moves_avvy = false; + set_up_timer(40, procrobin_hood_and_geida, reason_robin_hood_and_geida); + } + break; + + case 10: { /* Special 10: transfer north in catacombs. */ + if ((dna.cat_x == 4) && (dna.cat_y == 1)) { + /* Into Geida's room. */ + if (dna.obj[key]) dixi('q', 62); + else { + dixi('q', 61); + return; + } + } + dusk; + dna.cat_y -= 1; + catamove(4); + if (dna.room != r__catacombs) return; + delavvy; + switch ((cardinal)(catamap[cat_y][cat_x] & 0xf00) >> 8) { + case 0x1: + apped(1, 12); + break; + case 0x3: + apped(1, 11); + break; + default: + apped(1, 4); + } + getback(); + dawndelay(); + } + break; + case 11: { /* Special 11: transfer east in catacombs. */ + dusk; + dna.cat_x += 1; + catamove(1); + if (dna.room != r__catacombs) return; + delavvy; + apped(1, 1); + getback(); + dawndelay(); + } + break; + case 12: { /* Special 12: transfer south in catacombs. */ + dusk; + dna.cat_y += 1; + catamove(2); + if (dna.room != r__catacombs) return; + delavvy; + apped(1, 2); + getback(); + dawndelay(); + } + break; + case 13: { /* Special 13: transfer west in catacombs. */ + dusk; + dna.cat_x -= 1; + catamove(3); + if (dna.room != r__catacombs) return; + delavvy; + apped(1, 3); + getback(); + dawndelay(); + } + break; + } } -void hide_in_the_cupboard(); +void hide_in_the_cupboard(); -void open_the_door(byte whither,byte ped,byte magicnum) - /* This slides the door open. (The data really ought to be saved in - the Also file, and will be next time. However, for now, they're - here.) */ +void open_the_door(byte whither, byte ped, byte magicnum) +/* This slides the door open. (The data really ought to be saved in + the Also file, and will be next time. However, for now, they're + here.) */ { - switch (dna.room) { - case r__outsideyours:case r__outsidenottspub:case r__outsideducks: - { - first_show(1); - then_show(2); - then_show(3); - } - break; - case r__insidecardiffcastle: - { - first_show(1); - then_show(5); - } - break; - case r__avvysgarden:case r__entrancehall:case r__insideabbey: - { - first_show(1); - then_show(2); - } - break; - case r__musicroom:case r__outsideargentpub: - { - first_show(5); - then_show(6); - } - break; - case r__lusties: - switch (magicnum) { - case 14: if (dna.avvys_in_the_cupboard) - { - hide_in_the_cupboard(); - first_show(8); then_show(7); - start_to_close; - return; - } else - { - apped(1,6); - tr[1].face=right; /* added by TT 12/3/1995 */ - first_show(8); then_show(9); - } - break; - case 12: { - first_show(4); then_show(5); then_show(6); - } - break; - } - break; - } - - then_flip(whither,ped); - start_to_open; + switch (dna.room) { + case r__outsideyours: + case r__outsidenottspub: + case r__outsideducks: { + first_show(1); + then_show(2); + then_show(3); + } + break; + case r__insidecardiffcastle: { + first_show(1); + then_show(5); + } + break; + case r__avvysgarden: + case r__entrancehall: + case r__insideabbey: { + first_show(1); + then_show(2); + } + break; + case r__musicroom: + case r__outsideargentpub: { + first_show(5); + then_show(6); + } + break; + case r__lusties: + switch (magicnum) { + case 14: + if (dna.avvys_in_the_cupboard) { + hide_in_the_cupboard(); + first_show(8); + then_show(7); + start_to_close; + return; + } else { + apped(1, 6); + tr[1].face = right; /* added by TT 12/3/1995 */ + first_show(8); + then_show(9); + } + break; + case 12: { + first_show(4); + then_show(5); + then_show(6); + } + break; + } + break; + } + + then_flip(whither, ped); + start_to_open; } void newspeed() - /* Given that you've just changed the speed in triptype.xs, this adjusts - ix. */ +/* Given that you've just changed the speed in triptype.xs, this adjusts + ix. */ { - const bytefield lightspace = {40, 199, 47, 199}; - byte page_; + const bytefield lightspace = {40, 199, 47, 199}; + byte page_; - { - triptype& with = tr[1]; + { + triptype &with = tr[1]; - with.ix=(with.ix / 3)*with.xs; - setactivepage(3); + with.ix = (with.ix / 3) * with.xs; + setactivepage(3); - setfillstyle(1,14); - if (with.xs==run) bar(371,199,373,199); else bar(336,199,338,199); - setfillstyle(1,9); - if (with.xs==run) bar(336,199,338,199); else bar(371,199,373,199); + setfillstyle(1, 14); + if (with.xs == run) bar(371, 199, 373, 199); + else bar(336, 199, 338, 199); + setfillstyle(1, 9); + if (with.xs == run) bar(336, 199, 338, 199); + else bar(371, 199, 373, 199); - setactivepage(1-cp); - for( page_=0; page_ <= 1; page_ ++) getset[page_].remember(lightspace); - } + setactivepage(1 - cp); + for (page_ = 0; page_ <= 1; page_ ++) getset[page_].remember(lightspace); + } } -triptype* triptype::init(byte spritenum, boolean do_check) -{ - const integer idshould = -1317732048; - integer gd,gm; varying_string<2> xx; - byte fv/*,nds*/; - byte aa,bb; - longint id; word soa; - untyped_file inf; - - if (spritenum==177) return; /* Already running! */ - str(spritenum,xx); assign(inf,string("sprite")+xx+".avd"); - reset(inf,1); - seek(inf,177); - blockread(inf,id,4); - if (id!=idshould) - { - output << '\7'; - close(inf); - exit(0); - } - - blockread(inf,soa,2); - blockread(inf,a,soa); - - { - adxtype& with = a; - - /*nds:=num div seq;*/ totalnum=1; - xw=with.xl / 8; if ((with.xl % 8)>0) xw += 1; - for( aa=1; aa <= /*nds*seq*/with.num; aa ++) - { - getmem(sil[totalnum],11*(with.yl+1)); - getmem(mani[totalnum],with.size-6); - for( fv=0; fv <= with.yl; fv ++) - { - blockread(inf,(*sil[totalnum])[fv],xw); - } - blockread(inf,*mani[totalnum],with.size-6); - totalnum += 1; - } - } - - /* on; */ - x=0; y=0; quick=true; visible=false; xs=3; ys=1; -/* if spritenum=1 then newspeed; { Just for the lights. }*/ - - homing=false; ix=0; iy=0; step=0; check_me=do_check; - count=0; whichsprite=spritenum; vanishifstill=false; - call_eachstep=false; - close(inf); - return this; +triptype *triptype::init(byte spritenum, boolean do_check) { + const integer idshould = -1317732048; + integer gd, gm; + varying_string<2> xx; + byte fv/*,nds*/; + byte aa, bb; + longint id; + word soa; + untyped_file inf; + + if (spritenum == 177) return; /* Already running! */ + str(spritenum, xx); + assign(inf, string("sprite") + xx + ".avd"); + reset(inf, 1); + seek(inf, 177); + blockread(inf, id, 4); + if (id != idshould) { + output << '\7'; + close(inf); + exit(0); + } + + blockread(inf, soa, 2); + blockread(inf, a, soa); + + { + adxtype &with = a; + + /*nds:=num div seq;*/ totalnum = 1; + xw = with.xl / 8; + if ((with.xl % 8) > 0) xw += 1; + for (aa = 1; aa <= /*nds*seq*/with.num; aa ++) { + getmem(sil[totalnum], 11 * (with.yl + 1)); + getmem(mani[totalnum], with.size - 6); + for (fv = 0; fv <= with.yl; fv ++) { + blockread(inf, (*sil[totalnum])[fv], xw); + } + blockread(inf, *mani[totalnum], with.size - 6); + totalnum += 1; + } + } + + /* on; */ + x = 0; + y = 0; + quick = true; + visible = false; + xs = 3; + ys = 1; + /* if spritenum=1 then newspeed; { Just for the lights. }*/ + + homing = false; + ix = 0; + iy = 0; + step = 0; + check_me = do_check; + count = 0; + whichsprite = spritenum; + vanishifstill = false; + call_eachstep = false; + close(inf); + return this; } -void triptype::original() -{ - quick=false; whichsprite=177; +void triptype::original() { + quick = false; + whichsprite = 177; } -void triptype::andexor() -{ - byte picnum; /* Picnum, Picnic, what ye heck */ - byte lay,laz; /* Limits for Qaz and Qay or equivs. (Laz always = 3). */ +void triptype::andexor() { + byte picnum; /* Picnum, Picnic, what ye heck */ + byte lay, laz; /* Limits for Qaz and Qay or equivs. (Laz always = 3). */ #ifdef NOASM - word offs,fv; - byte qax,qay,qaz; + word offs, fv; + byte qax, qay, qaz; #else - word segmani,ofsmani; - word ofsaa,realofsaa; - word segsil,ofssil; - word z; byte xwidth; + word segmani, ofsmani; + word ofsaa, realofsaa; + word segsil, ofssil; + word z; + byte xwidth; #endif - if ((vanishifstill) && (ix==0) && (iy==0)) return; - picnum=face*a.seq+step+1; + if ((vanishifstill) && (ix == 0) && (iy == 0)) return; + picnum = face * a.seq + step + 1; - { - adxtype& with = a; + { + adxtype &with = a; - getimage(x,y,x+with.xl,y+with.yl,aa); /* Now loaded into our local buffer. */ + getimage(x, y, x + with.xl, y + with.yl, aa); /* Now loaded into our local buffer. */ - /* Now we've got to modify it! */ + /* Now we've got to modify it! */ - /* Qaz ranges over the width of the sprite/8. - Qay " " the height. - Qax " " 1 to 4 (the planes). */ + /* Qaz ranges over the width of the sprite/8. + Qay " " the height. + Qax " " 1 to 4 (the planes). */ - { - adxtype& with1 = a; + { + adxtype &with1 = a; - #ifdef NOASM - laz=xw-1; lay=with1.yl; /* -1's only for Pascal. */ - #else - laz=xw; lay=with1.yl+1; /* +1's only for ASM! */ - #endif - } - - /* ASSEMBLERISED: */ #ifdef NOASM - for( qax=0; qax <= 3; qax ++) /* 3 */ - for( qay=0; qay <= lay; qay ++) /* 35 */ - for( qaz=0; qaz <= laz; qaz ++) /* 4 */ - { - offs=5+qay*xw*4+xw*qax+qaz; - aa[offs]=aa[offs] & (*sil[picnum])[qay][qaz]; - } - - for( fv=5; fv <= with.size-2; fv ++) - aa[fv]=aa[fv] ^ (*mani[picnum])[fv]; - + laz = xw - 1; + lay = with1.yl; /* -1's only for Pascal. */ #else - /* OK, here's the same thing in assembler... - - AL is Qax, - BL is Qay, - CL is Qaz, - DX is Offs */ - - /* For the first part: */ - xwidth=xw; - segsil=seg(*sil[picnum]); - ofssil=ofs(*sil[picnum]); - - /* For the first and second parts: */ - segmani=seg(*mani[picnum]); /* It's easier to do this in Pascal, and */ - ofsmani=ofs(*mani[picnum])+1; /* besides it only goes round once here. */ - /* Segment of AA is always the current data segment. */ - ofsaa=ofs(aa)+5; - realofsaa=ofs(aa)-1; /* We may not need this. */ - z=with.size-7; -/* - asm - - xor ax,ax; { Initialise ax, bx, and cx, using a rather } - @QAXloop: { AL } - - xor bx,bx; { nifty speed trick. } - @QAYloop: { BL } - - xor cx,cx; - @QAZloop: { CL } - - { Right, well, here we are. We have to do some rather nifty array - manipulation, stuff like that. We're trying to assemblerise: - DX:= 5 + BX * xw * 4 + xw * AX + CX; - aa[DX]:=aa[DX] and sil[picnum]^[BL,CL]; } - - push ax; {AXcdx} { OK, we're going to do some strange things } - { with ax, so we'd better save it. } - mov dx,5; { First of all... set dx to 5. } - add dx,cx; { DX now = 5+CX } - mul xwidth; { Multiply ax by xw (the Pascal variable.) } - add dx,ax; { DX now = 5+CX+xw*AX } - - { Right. Mul only works on ax. Don't ask me why. Ask Intel. Anyway, - since ax is saved on the stack, we can move bx over it. Note that - if xw was a word, using mul would have destroyed the contents of - dx. NOT a good idea! } - - push cx; {CXmul} { We must just borrow cx for a second. } - mov ax,bx; { Make ax = bx. } - mul xwidth; { Do the same to it as we did to ax before. } - mov cl,2; - shl ax,cl; { And multiply it by 4 (i.e., shl it by 2.) } - add dx,ax; { DX now = 5+CX+xw*AX+xw*BX*4. That's OK. } + laz = xw; + lay = with1.yl + 1; /* +1's only for ASM! */ +#endif + } - pop cx; {CXmul} - pop ax; {AXcdx} { Now we have to get ax and cx back again. } + /* ASSEMBLERISED: */ +#ifdef NOASM + for (qax = 0; qax <= 3; qax ++) /* 3 */ + for (qay = 0; qay <= lay; qay ++) /* 35 */ + for (qaz = 0; qaz <= laz; qaz ++) { /* 4 */ + offs = 5 + qay * xw * 4 + xw * qax + qaz; + aa[offs] = aa[offs] & (*sil[picnum])[qay][qaz]; + } - { Registers are now returned to original status. } + for (fv = 5; fv <= with.size - 2; fv ++) + aa[fv] = aa[fv] ^ (*mani[picnum])[fv]; - { Righto. DX is now all worked out OK. We must now find out the - contents of: 1) aa[dx], and 2) (harder) sil[picnum]^[BL,CL]. Gulp. } +#else + /* OK, here's the same thing in assembler... + + AL is Qax, + BL is Qay, + CL is Qaz, + DX is Offs */ + + /* For the first part: */ + xwidth = xw; + segsil = seg(*sil[picnum]); + ofssil = ofs(*sil[picnum]); + + /* For the first and second parts: */ + segmani = seg(*mani[picnum]); /* It's easier to do this in Pascal, and */ + ofsmani = ofs(*mani[picnum]) + 1; /* besides it only goes round once here. */ + /* Segment of AA is always the current data segment. */ + ofsaa = ofs(aa) + 5; + realofsaa = ofs(aa) - 1; /* We may not need this. */ + z = with.size - 7; + /* + asm + + xor ax,ax; { Initialise ax, bx, and cx, using a rather } + @QAXloop: { AL } + + xor bx,bx; { nifty speed trick. } + @QAYloop: { BL } + + xor cx,cx; + @QAZloop: { CL } + + { Right, well, here we are. We have to do some rather nifty array + manipulation, stuff like that. We're trying to assemblerise: + DX:= 5 + BX * xw * 4 + xw * AX + CX; + aa[DX]:=aa[DX] and sil[picnum]^[BL,CL]; } + + push ax; {AXcdx} { OK, we're going to do some strange things } + { with ax, so we'd better save it. } + mov dx,5; { First of all... set dx to 5. } + add dx,cx; { DX now = 5+CX } + mul xwidth; { Multiply ax by xw (the Pascal variable.) } + add dx,ax; { DX now = 5+CX+xw*AX } + + { Right. Mul only works on ax. Don't ask me why. Ask Intel. Anyway, + since ax is saved on the stack, we can move bx over it. Note that + if xw was a word, using mul would have destroyed the contents of + dx. NOT a good idea! } + + push cx; {CXmul} { We must just borrow cx for a second. } + mov ax,bx; { Make ax = bx. } + mul xwidth; { Do the same to it as we did to ax before. } + mov cl,2; + shl ax,cl; { And multiply it by 4 (i.e., shl it by 2.) } + add dx,ax; { DX now = 5+CX+xw*AX+xw*BX*4. That's OK. } + + pop cx; {CXmul} + pop ax; {AXcdx} { Now we have to get ax and cx back again. } + + { Registers are now returned to original status. } + + { Righto. DX is now all worked out OK. We must now find out the + contents of: 1) aa[dx], and 2) (harder) sil[picnum]^[BL,CL]. Gulp. } - { DS already points to the segment of AA. So... let's use CL to - put aa[dx] in, and use BX for the offset. Looks like we're going - to have to push a few registers! } + { DS already points to the segment of AA. So... let's use CL to + put aa[dx] in, and use BX for the offset. Looks like we're going + to have to push a few registers! } - push ax; { AXaa. Saving loop value of AX. } - { Let's use ax to do our dirty work with. } - push dx; { Saving Offs(DX.) } + push ax; { AXaa. Saving loop value of AX. } + { Let's use ax to do our dirty work with. } + push dx; { Saving Offs(DX.) } - push bx; { BXaa. Saving loop value of BX. } + push bx; { BXaa. Saving loop value of BX. } - mov bx,realofsaa; { aa is now pointed to by [ds:bx]. } - add bx,dx; { Offset is dx bytes. } - mov dl,[bx]; { cl now holds the contents of aa[dx]. } + mov bx,realofsaa; { aa is now pointed to by [ds:bx]. } + add bx,dx; { Offset is dx bytes. } + mov dl,[bx]; { cl now holds the contents of aa[dx]. } - pop bx; { BXaa. Restoring loop value of BX. } + pop bx; { BXaa. Restoring loop value of BX. } - { Stack now holds: Offs(DX). } + { Stack now holds: Offs(DX). } - { ^^^ That works. Now to find sil[picnum]^[BL,CL]. Our first task is - to find the address of sil[picnum]^. Since it's dynamic, we must - push and pop ds. } + { ^^^ That works. Now to find sil[picnum]^[BL,CL]. Our first task is + to find the address of sil[picnum]^. Since it's dynamic, we must + push and pop ds. } - push ds; { DXaa. Saving value of Trip5's data segment. } - { Push ds. Now we can put the segment of sil[picnum]^... } - mov ds,segsil; { ...into ds, and... } - mov ax,ofssil; { ...its offset into ax. } - { Addr of sil[picnum]^ is now in [ds:ax]. BUT we want a particular - offset: to wit, [BL,CL]. Now, siltype is defined so that this offset - will be at an offset of (BL*11)+CL. } + push ds; { DXaa. Saving value of Trip5's data segment. } + { Push ds. Now we can put the segment of sil[picnum]^... } + mov ds,segsil; { ...into ds, and... } + mov ax,ofssil; { ...its offset into ax. } + { Addr of sil[picnum]^ is now in [ds:ax]. BUT we want a particular + offset: to wit, [BL,CL]. Now, siltype is defined so that this offset + will be at an offset of (BL*11)+CL. } - push bx; { Saving loop value of BX. } - push cx; { Saving loop value of CX. } - push ax; { Saving offset of sil[picnum]^. } - { Save them for a bit (!) } - mov al,bl; { Put bl into al. } - mov bl,11; { ... } - mul bl; { ...times it by 11. } - mov bx,ax; { Put it back into bx (now = bx*11) } - pop ax; { Restoring offset of sil[picnum]^. } - { Get ax back again. } - add ax,bx; { Add (original bl)*11 to al. } - add ax,cx; { Add cl to al. } - { AX now holds the offset of sil[picnum]^[bx,cl]. } + push bx; { Saving loop value of BX. } + push cx; { Saving loop value of CX. } + push ax; { Saving offset of sil[picnum]^. } + { Save them for a bit (!) } + mov al,bl; { Put bl into al. } + mov bl,11; { ... } + mul bl; { ...times it by 11. } + mov bx,ax; { Put it back into bx (now = bx*11) } + pop ax; { Restoring offset of sil[picnum]^. } + { Get ax back again. } + add ax,bx; { Add (original bl)*11 to al. } + add ax,cx; { Add cl to al. } + { AX now holds the offset of sil[picnum]^[bx,cl]. } - { Stack now holds: loop value of AX, Trip5's DS, lv of BX, lv of CX. } + { Stack now holds: loop value of AX, Trip5's DS, lv of BX, lv of CX. } - { Right. Now the address of sil[picnum]^[bl,cl] is in [ds:ax]. Let's - get the elusive byte itself, and put it into ax. Firstly, we must - swap ax and bx. } + { Right. Now the address of sil[picnum]^[bl,cl] is in [ds:ax]. Let's + get the elusive byte itself, and put it into ax. Firstly, we must + swap ax and bx. } - xchg ax,bx; - mov al,[bx]; { AX now contains sil[picnum]^[bl,cl], AT LAST!! } + xchg ax,bx; + mov al,[bx]; { AX now contains sil[picnum]^[bl,cl], AT LAST!! } - { So now AL contains the sil stuff, and DL holds aa[offs]. } + { So now AL contains the sil stuff, and DL holds aa[offs]. } - and al,dl; { aa[offs]:=aa[offs] and sil[picnum]^[Qay,Qaz]. } + and al,dl; { aa[offs]:=aa[offs] and sil[picnum]^[Qay,Qaz]. } - pop cx; { Restoring loop value of CX. } - pop bx; { Restoring loop value of BX. } - pop ds; { Restore value of Trip5's data segment. } + pop cx; { Restoring loop value of CX. } + pop bx; { Restoring loop value of BX. } + pop ds; { Restore value of Trip5's data segment. } - { Right. AL contains the byte we need to replace aa[offs] with. - All that's left to do is to put it back. Remember that we already - have the segment of aa in the current DS, so... } + { Right. AL contains the byte we need to replace aa[offs] with. + All that's left to do is to put it back. Remember that we already + have the segment of aa in the current DS, so... } - pop dx; { Restore Offs(DX). } + pop dx; { Restore Offs(DX). } - { Stack is now as when we entered the loop. Since this copy of DX - is now being used for the last time, we can muck around with it. } + { Stack is now as when we entered the loop. Since this copy of DX + is now being used for the last time, we can muck around with it. } - { Recap: DX now holds the offset from the start of AA. If we add - the offset of aa to it, we'll get the offset of the byte we want. - DS is already set up. } + { Recap: DX now holds the offset from the start of AA. If we add + the offset of aa to it, we'll get the offset of the byte we want. + DS is already set up. } - push bx; { I'm just borrowing bx for a sec. I'll put it back in 5 lines.} - mov bx,realofsaa; - add dx,bx; { Now aa[offs] is at aa[ds:dx]. } - mov bx,dx; { But we can't address memory with dx, so use bx. } - mov [bx],al; { Shove it into the memory! } - pop bx; { See! I said I would. } + push bx; { I'm just borrowing bx for a sec. I'll put it back in 5 lines.} + mov bx,realofsaa; + add dx,bx; { Now aa[offs] is at aa[ds:dx]. } + mov bx,dx; { But we can't address memory with dx, so use bx. } + mov [bx],al; { Shove it into the memory! } + pop bx; { See! I said I would. } - pop ax; { Restore loop value of AX. } + pop ax; { Restore loop value of AX. } - { Right, the fancy stuff's all done now. Finish off the loop code. } + { Right, the fancy stuff's all done now. Finish off the loop code. } - inc cl; - cmp cl,laz; { CL must not reach 5. Does it? } - jnz @QAZloop; { no, keep going around the QAZloop. } + inc cl; + cmp cl,laz; { CL must not reach 5. Does it? } + jnz @QAZloop; { no, keep going around the QAZloop. } - inc bl; - cmp bl,lay; { BL must not reach 36. Does it? } - jnz @QAYloop; { no, keep going around the QAYloop. } + inc bl; + cmp bl,lay; { BL must not reach 36. Does it? } + jnz @QAYloop; { no, keep going around the QAYloop. } - inc al; - cmp al,4; { AL must not reach 4. Does it? } - jnz @QAXloop; { no, keep going around the QAXloop. } + inc al; + cmp al,4; { AL must not reach 4. Does it? } + jnz @QAXloop; { no, keep going around the QAXloop. } - { al, bl and cl are now at their maxima, so we can stop the loops. } + { al, bl and cl are now at their maxima, so we can stop the loops. } - { *** SECOND ASSEMBLER BIT. *** } + { *** SECOND ASSEMBLER BIT. *** } - mov cx,z; { Find the size of the array, -7. } - mov bx,ofsmani; { Now find the offset and put that into bx. } - mov dx,ofsaa; { We'll use dx to be the same as fv, +5. } + mov cx,z; { Find the size of the array, -7. } + mov bx,ofsmani; { Now find the offset and put that into bx. } + mov dx,ofsaa; { We'll use dx to be the same as fv, +5. } - { DS should already hold the segment of aa. } + { DS should already hold the segment of aa. } - @nextbyte: { Main loop... } + @nextbyte: { Main loop... } - { Firstly, we must get hold of aa[fv] (here called aa[dx].)} - push bx; { We need to "borrow" bx for a second... } - mov bx,dx; { Wrong register- shove it into bx. } - mov al,[bx]; { Get aa[fv] and put it into al. } - pop bx; { Right, you can have bx back again. } + { Firstly, we must get hold of aa[fv] (here called aa[dx].)} + push bx; { We need to "borrow" bx for a second... } + mov bx,dx; { Wrong register- shove it into bx. } + mov al,[bx]; { Get aa[fv] and put it into al. } + pop bx; { Right, you can have bx back again. } - { Secondly, we must get hold of mani[picnum]^[fv]. } - push cx; { Let's borrow cx for this one. } - push ds; { we must use ds to point to segmani. } - mov ds,segmani; { Find the segment of mani[picnum]^, } - mov cl,[bx]; { now get the byte at [ds:bx] and put it into cl. } - pop ds; { Put ds back to being the current data segment. } + { Secondly, we must get hold of mani[picnum]^[fv]. } + push cx; { Let's borrow cx for this one. } + push ds; { we must use ds to point to segmani. } + mov ds,segmani; { Find the segment of mani[picnum]^, } + mov cl,[bx]; { now get the byte at [ds:bx] and put it into cl. } + pop ds; { Put ds back to being the current data segment. } - { Right: now we can do what we came here for in the first place. - AL contains aa[fv], CL contains mani[picnum]^[fv]. } + { Right: now we can do what we came here for in the first place. + AL contains aa[fv], CL contains mani[picnum]^[fv]. } - xor al,cl; { Xor al with bl. That's it! } + xor al,cl; { Xor al with bl. That's it! } - pop cx; { We don't need cx any more for this now. } + pop cx; { We don't need cx any more for this now. } - push bx; { Borrow bx... } - mov bx,dx; { Put dx into bx. } - mov [bx],al; { Put the changed al back into [ds:bx] (ie, [ds:dx].} - pop bx; { Get it back. } + push bx; { Borrow bx... } + mov bx,dx; { Put dx into bx. } + mov [bx],al; { Put the changed al back into [ds:bx] (ie, [ds:dx].} + pop bx; { Get it back. } - inc bx; { Add one to bx, for the next char. } - inc dx; { And dx, for the same reason. } + inc bx; { Add one to bx, for the next char. } + inc dx; { And dx, for the same reason. } - loop @nextbyte; { Keep going round until cx=0. } -*/ -{; -} + loop @nextbyte; { Keep going round until cx=0. } + */ + { + ; + } #endif - /* Now.. let's try pasting it back again! */ + /* Now.. let's try pasting it back again! */ - putimage(x,y,aa,0); - } + putimage(x, y, aa, 0); + } } -void triptype::turn(byte whichway) -{ - if (whichway==8) face=0; else face=whichway; +void triptype::turn(byte whichway) { + if (whichway == 8) face = 0; + else face = whichway; } -void triptype::appear(integer wx,integer wy, byte wf) -{ - x=(wx / 8)*8; y=wy; ox[cp]=wx; oy[cp]=wy; turn(wf); - visible=true; ix=0; iy=0; +void triptype::appear(integer wx, integer wy, byte wf) { + x = (wx / 8) * 8; + y = wy; + ox[cp] = wx; + oy[cp] = wy; + turn(wf); + visible = true; + ix = 0; + iy = 0; } -static boolean collision_check() -{ - byte fv; - - boolean collision_check_result; - for( fv=1; fv <= numtr; fv ++) - if (tr[fv].quick && (tr[fv].whichsprite!=whichsprite) && - ((x+a.xl)>tr[fv].x) && - (x<(tr[fv].x+tr[fv].a.xl)) && - (tr[fv].y==y)) - { - collision_check_result=true; - return collision_check_result; - } - collision_check_result=false; - return collision_check_result; +static boolean collision_check() { + byte fv; + + boolean collision_check_result; + for (fv = 1; fv <= numtr; fv ++) + if (tr[fv].quick && (tr[fv].whichsprite != whichsprite) && + ((x + a.xl) > tr[fv].x) && + (x < (tr[fv].x + tr[fv].a.xl)) && + (tr[fv].y == y)) { + collision_check_result = true; + return collision_check_result; + } + collision_check_result = false; + return collision_check_result; } -void triptype::walk() -{ - byte tc; bytefield r; - - - if (visible) - { - { - x1=(x / 8)-1; - if (x1==255) x1=0; - y1=y-2; - x2=((x+a.xl) / 8)+1; - y2=y+a.yl+2; - } - getset[1-cp].remember(r); - } - - if (~ doing_sprite_run) - { - ox[cp]=x; oy[cp]=y; - if (homing) homestep(); - x=x+ix; y=y+iy; - } - - if (check_me) - { - if (collision_check()) - { - bounce(); - return; - } - - tc=checkfeet(x,x+a.xl,oy[cp],y,a.yl); - - if ((tc!=0) & (~ doing_sprite_run)) - { void& with = magics[tc]; - switch (op) { - case exclaim: { - bounce(); mustexclaim=true; saywhat=data; - } - break; - case bounces: bounce(); break; - case transport: fliproom(hi(data),lo(data)); break; - case unfinished: { - bounce(); - display("\7Sorry.\3\rThis place is not available yet!"); - } - break; - case special: call_special(data); break; - case mopendoor: open_the_door(hi(data),lo(data),tc); break; - }} - } - - if (~ doing_sprite_run) - { - count += 1; - if (((ix!=0) || (iy!=0)) && (count>1)) - { - step += 1; if (step==a.seq) step=0; count=0; - } - } +void triptype::walk() { + byte tc; + bytefield r; + + + if (visible) { + { + x1 = (x / 8) - 1; + if (x1 == 255) x1 = 0; + y1 = y - 2; + x2 = ((x + a.xl) / 8) + 1; + y2 = y + a.yl + 2; + } + getset[1 - cp].remember(r); + } + + if (~ doing_sprite_run) { + ox[cp] = x; + oy[cp] = y; + if (homing) homestep(); + x = x + ix; + y = y + iy; + } + + if (check_me) { + if (collision_check()) { + bounce(); + return; + } + + tc = checkfeet(x, x + a.xl, oy[cp], y, a.yl); + + if ((tc != 0) & (~ doing_sprite_run)) { + void &with = magics[tc]; + switch (op) { + case exclaim: { + bounce(); + mustexclaim = true; + saywhat = data; + } + break; + case bounces: + bounce(); + break; + case transport: + fliproom(hi(data), lo(data)); + break; + case unfinished: { + bounce(); + display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case special: + call_special(data); + break; + case mopendoor: + open_the_door(hi(data), lo(data), tc); + break; + } + } + } + + if (~ doing_sprite_run) { + count += 1; + if (((ix != 0) || (iy != 0)) && (count > 1)) { + step += 1; + if (step == a.seq) step = 0; + count = 0; + } + } } -void triptype::bounce() -{ - x=ox[cp]; y=oy[cp]; - if (check_me) stopwalking(); else stopwalk(); - oncandopageswap=false; - showrw; - oncandopageswap=true; +void triptype::bounce() { + x = ox[cp]; + y = oy[cp]; + if (check_me) stopwalking(); + else stopwalk(); + oncandopageswap = false; + showrw; + oncandopageswap = true; } -shortint sgn(integer x) -{ - shortint sgn_result; - if (x>0) sgn_result=1; else - if (x<0) sgn_result=-1; else - sgn_result=0; /* x=0 */ - return sgn_result; +shortint sgn(integer x) { + shortint sgn_result; + if (x > 0) sgn_result = 1; + else if (x < 0) sgn_result = -1; + else + sgn_result = 0; /* x=0 */ + return sgn_result; } -void triptype::walkto(byte pednum) -{ - speed(sgn(peds[pednum].x-x)*4,sgn(peds[pednum].y-y)); - hx=peds[pednum].x-a.xl / 2; - hy=peds[pednum].y-a.yl; homing=true; +void triptype::walkto(byte pednum) { + speed(sgn(peds[pednum].x - x) * 4, sgn(peds[pednum].y - y)); + hx = peds[pednum].x - a.xl / 2; + hy = peds[pednum].y - a.yl; + homing = true; } -void triptype::stophoming() -{ - homing=false; +void triptype::stophoming() { + homing = false; } -void triptype::homestep() -{ - integer temp; - - if ((hx==x) && (hy==y)) - { /* touching the target */ - stopwalk(); - return; - } - ix=0; iy=0; - if (hy!=y) - { - temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; - } - if (hx!=x) - { - temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; - } +void triptype::homestep() { + integer temp; + + if ((hx == x) && (hy == y)) { + /* touching the target */ + stopwalk(); + return; + } + ix = 0; + iy = 0; + if (hy != y) { + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; + } + if (hx != x) { + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } } -void triptype::speed(shortint xx,shortint yy) -{ - ix=xx; iy=yy; - if ((ix==0) && (iy==0)) return; /* no movement */ - if (ix==0) - { /* No horz movement */ - if (iy<0) turn(up); else turn(down); - } else - { - if (ix<0) turn(left); else turn(right); - } +void triptype::speed(shortint xx, shortint yy) { + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + /* No horz movement */ + if (iy < 0) turn(up); + else turn(down); + } else { + if (ix < 0) turn(left); + else turn(right); + } } -void triptype::stopwalk() -{ - ix=0; iy=0; homing=false; +void triptype::stopwalk() { + ix = 0; + iy = 0; + homing = false; } -void triptype::chatter() -{ - talkx=x+a.xl / 2; talky=y; talkf=a.fgc; talkb=a.bgc; +void triptype::chatter() { + talkx = x + a.xl / 2; + talky = y; + talkf = a.fgc; + talkb = a.bgc; } -void triptype::set_up_saver(trip_saver_type& v) -{ - v.whichsprite=whichsprite; - v.face=face; - v.step=step; - v.x=x; - v.y=y; - v.ix=ix; - v.iy=iy; - v.visible=visible; - v.homing=homing; - v.check_me=check_me; - v.count=count; - v.xw=xw; - v.xs=xs; - v.ys=ys; - v.totalnum=totalnum; - v.hx=hx; - v.hy=hy; - v.call_eachstep=call_eachstep; - v.eachstep=eachstep; - v.vanishifstill=vanishifstill; +void triptype::set_up_saver(trip_saver_type &v) { + v.whichsprite = whichsprite; + v.face = face; + v.step = step; + v.x = x; + v.y = y; + v.ix = ix; + v.iy = iy; + v.visible = visible; + v.homing = homing; + v.check_me = check_me; + v.count = count; + v.xw = xw; + v.xs = xs; + v.ys = ys; + v.totalnum = totalnum; + v.hx = hx; + v.hy = hy; + v.call_eachstep = call_eachstep; + v.eachstep = eachstep; + v.vanishifstill = vanishifstill; } -void triptype::unload_saver(trip_saver_type v) -{ - whichsprite=v.whichsprite; - face=v.face; - step=v.step; - x=v.x; - y=v.y; - ix=v.ix; - iy=v.iy; - visible=v.visible; - homing=v.homing; - check_me=v.check_me; - count=v.count; - xw=v.xw; - xs=v.xs; - ys=v.ys; - totalnum=v.totalnum; - hx=v.hx; - hy=v.hy; - call_eachstep=v.call_eachstep; - eachstep=v.eachstep; - vanishifstill=v.vanishifstill; +void triptype::unload_saver(trip_saver_type v) { + whichsprite = v.whichsprite; + face = v.face; + step = v.step; + x = v.x; + y = v.y; + ix = v.ix; + iy = v.iy; + visible = v.visible; + homing = v.homing; + check_me = v.check_me; + count = v.count; + xw = v.xw; + xs = v.xs; + ys = v.ys; + totalnum = v.totalnum; + hx = v.hx; + hy = v.hy; + call_eachstep = v.call_eachstep; + eachstep = v.eachstep; + vanishifstill = v.vanishifstill; } -void triptype::savedata(untyped_file& f) -{ - trip_saver_type tripsaver; - - set_up_saver(tripsaver); - - { - blockwrite(f,tripsaver.whichsprite,1); - blockwrite(f,tripsaver.face,1); blockwrite(f,tripsaver.step,1); - blockwrite(f,tripsaver.x,2); blockwrite(f,tripsaver.y,2); - blockwrite(f,tripsaver.ix,1); blockwrite(f,tripsaver.iy,1); - blockwrite(f,tripsaver.visible,1); - blockwrite(f,tripsaver.homing,1); - blockwrite(f,tripsaver.check_me,1); - blockwrite(f,tripsaver.count,1); - blockwrite(f,tripsaver.xw,1); - blockwrite(f,tripsaver.xs,1); blockwrite(f,tripsaver.ys,1); - blockwrite(f,tripsaver.totalnum,1); - blockwrite(f,tripsaver.hx,2); blockwrite(f,tripsaver.hy,2); - blockwrite(f,tripsaver.call_eachstep,1); - blockwrite(f,tripsaver.eachstep,1); - blockwrite(f,tripsaver.vanishifstill,1); - } +void triptype::savedata(untyped_file &f) { + trip_saver_type tripsaver; + + set_up_saver(tripsaver); + + { + blockwrite(f, tripsaver.whichsprite, 1); + blockwrite(f, tripsaver.face, 1); + blockwrite(f, tripsaver.step, 1); + blockwrite(f, tripsaver.x, 2); + blockwrite(f, tripsaver.y, 2); + blockwrite(f, tripsaver.ix, 1); + blockwrite(f, tripsaver.iy, 1); + blockwrite(f, tripsaver.visible, 1); + blockwrite(f, tripsaver.homing, 1); + blockwrite(f, tripsaver.check_me, 1); + blockwrite(f, tripsaver.count, 1); + blockwrite(f, tripsaver.xw, 1); + blockwrite(f, tripsaver.xs, 1); + blockwrite(f, tripsaver.ys, 1); + blockwrite(f, tripsaver.totalnum, 1); + blockwrite(f, tripsaver.hx, 2); + blockwrite(f, tripsaver.hy, 2); + blockwrite(f, tripsaver.call_eachstep, 1); + blockwrite(f, tripsaver.eachstep, 1); + blockwrite(f, tripsaver.vanishifstill, 1); + } } -void triptype::loaddata(untyped_file& f) -{ - word spritewas,spriteis,saveface,savex,savey,savestep; - boolean wasquick; - trip_saver_type tripsaver; - - - wasquick=quick; - quick=true; spritewas=whichsprite; - - { - blockread(f,tripsaver.whichsprite,1); - blockread(f,tripsaver.face,1); blockread(f,tripsaver.step,1); - blockread(f,tripsaver.x,2); blockread(f,tripsaver.y,2); - blockread(f,tripsaver.ix,1); blockread(f,tripsaver.iy,1); - - if ((! wasquick) || ((unsigned char)tripsaver.whichsprite!=spritewas)) - { - spriteis=tripsaver.whichsprite; - savex=tripsaver.x; savey=tripsaver.y; saveface=tripsaver.face; savestep=tripsaver.step; - - if (wasquick) done(); - - init(spriteis,tripsaver.check_me); - - appear(savex,savey,saveface); tripsaver.step=savestep; - } - - blockread(f,tripsaver.visible,1); - blockread(f,tripsaver.homing,1); - blockread(f,tripsaver.check_me,1); - blockread(f,tripsaver.count,1); - blockread(f,tripsaver.xw,1); - blockread(f,tripsaver.xs,1); blockread(f,tripsaver.ys,1); - blockread(f,tripsaver.totalnum,1); - blockread(f,tripsaver.hx,2); blockread(f,tripsaver.hy,2); - blockread(f,tripsaver.call_eachstep,1); - blockread(f,tripsaver.eachstep,1); - blockread(f,tripsaver.vanishifstill,1); - } - - unload_saver(tripsaver); +void triptype::loaddata(untyped_file &f) { + word spritewas, spriteis, saveface, savex, savey, savestep; + boolean wasquick; + trip_saver_type tripsaver; + + + wasquick = quick; + quick = true; + spritewas = whichsprite; + + { + blockread(f, tripsaver.whichsprite, 1); + blockread(f, tripsaver.face, 1); + blockread(f, tripsaver.step, 1); + blockread(f, tripsaver.x, 2); + blockread(f, tripsaver.y, 2); + blockread(f, tripsaver.ix, 1); + blockread(f, tripsaver.iy, 1); + + if ((! wasquick) || ((unsigned char)tripsaver.whichsprite != spritewas)) { + spriteis = tripsaver.whichsprite; + savex = tripsaver.x; + savey = tripsaver.y; + saveface = tripsaver.face; + savestep = tripsaver.step; + + if (wasquick) done(); + + init(spriteis, tripsaver.check_me); + + appear(savex, savey, saveface); + tripsaver.step = savestep; + } + + blockread(f, tripsaver.visible, 1); + blockread(f, tripsaver.homing, 1); + blockread(f, tripsaver.check_me, 1); + blockread(f, tripsaver.count, 1); + blockread(f, tripsaver.xw, 1); + blockread(f, tripsaver.xs, 1); + blockread(f, tripsaver.ys, 1); + blockread(f, tripsaver.totalnum, 1); + blockread(f, tripsaver.hx, 2); + blockread(f, tripsaver.hy, 2); + blockread(f, tripsaver.call_eachstep, 1); + blockread(f, tripsaver.eachstep, 1); + blockread(f, tripsaver.vanishifstill, 1); + } + + unload_saver(tripsaver); } -triptype* triptype::done() -{ - integer gd,gm; varying_string<2> xx; - byte fv/*,nds*/; - byte aa,bb; - longint id; word soa; - - { - adxtype& with = a; - -/* nds:=num div seq;*/ - xw=with.xl / 8; if ((with.xl % 8)>0) xw += 1; - for( aa=1; aa <= /*nds*seq*/ with.num; aa ++) - { - totalnum -= 1; - freemem(mani[totalnum],with.size-6); - freemem(sil[totalnum],11*(with.yl+1)); /* <<- Width of a siltype. */ - } - } - - quick=false; whichsprite=177; - return this; +triptype *triptype::done() { + integer gd, gm; + varying_string<2> xx; + byte fv/*,nds*/; + byte aa, bb; + longint id; + word soa; + + { + adxtype &with = a; + + /* nds:=num div seq;*/ + xw = with.xl / 8; + if ((with.xl % 8) > 0) xw += 1; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { + totalnum -= 1; + freemem(mani[totalnum], with.size - 6); + freemem(sil[totalnum], 11 * (with.yl + 1)); /* <<- Width of a siltype. */ + } + } + + quick = false; + whichsprite = 177; + return this; } -getsettype* getsettype::init() -{ - numleft=0; /* initialise array pointer */ - return this; +getsettype *getsettype::init() { + numleft = 0; /* initialise array pointer */ + return this; } -void getsettype::remember(bytefield r) -{ - numleft += 1; - if (numleft>maxgetset) runerror(runerr_getset_overflow); - gs[numleft]=r; +void getsettype::remember(bytefield r) { + numleft += 1; + if (numleft > maxgetset) runerror(runerr_getset_overflow); + gs[numleft] = r; } -void getsettype::recall(bytefield& r) -{ - r=gs[numleft]; - numleft -= 1; +void getsettype::recall(bytefield &r) { + r = gs[numleft]; + numleft -= 1; } -void rwsp(byte t,byte r) -{ - { triptype& with = tr[t]; switch (r) { - case up: speed( 0,-with.ys); break; case down: speed( 0, with.ys); break; case left: speed(-with.xs, 0); break; - case right: speed( with.xs, 0); break; case ul: speed(-with.xs,-with.ys); break; case ur: speed( with.xs,-with.ys); break; - case dl: speed(-with.xs, with.ys); break; case dr: speed( with.xs, with.ys); break; - }} +void rwsp(byte t, byte r) { + { + triptype &with = tr[t]; + switch (r) { + case up: + speed(0, -with.ys); + break; + case down: + speed(0, with.ys); + break; + case left: + speed(-with.xs, 0); + break; + case right: + speed(with.xs, 0); + break; + case ul: + speed(-with.xs, -with.ys); + break; + case ur: + speed(with.xs, -with.ys); + break; + case dl: + speed(-with.xs, with.ys); + break; + case dr: + speed(with.xs, with.ys); + break; + } + } } -void apped(byte trn,byte np) -{ - { triptype& with = tr[trn]; - { - void& with1 = peds[np]; +void apped(byte trn, byte np) { + { + triptype &with = tr[trn]; + { + void &with1 = peds[np]; - appear(with.x-with.a.xl / 2,with.y-with.a.yl,dir); - rwsp(trn,dir); - }} + appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); + rwsp(trn, dir); + } + } } void getback(); @@ -1344,122 +1457,126 @@ static bytefield r; begin { By De Morgan's law: } overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); end;*/ - /* x1,x2 - as bytefield, but *8. y1,y2 - as bytefield. - x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ -static boolean overlaps_with_mouse() -{ - boolean overlaps_with_mouse_result; - overlaps_with_mouse_result= - (x2*8>=mx) && (mx+16>=x1*8) && (y2>=my) && (my+16>=y1); - return overlaps_with_mouse_result; +/* x1,x2 - as bytefield, but *8. y1,y2 - as bytefield. + x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ +static boolean overlaps_with_mouse() { + boolean overlaps_with_mouse_result; + overlaps_with_mouse_result = + (x2 * 8 >= mx) && (mx + 16 >= x1 * 8) && (y2 >= my) && (my + 16 >= y1); + return overlaps_with_mouse_result; } -void getback() -{ - byte fv; - boolean endangered; +void getback() { + byte fv; + boolean endangered; - endangered=false; -/* Super_Off;*/ + endangered = false; + /* Super_Off;*/ - { getsettype& with = getset[1-cp]; - while (with.numleft>0) - { - recall(r); + { + getsettype &with = getset[1 - cp]; + while (with.numleft > 0) { + recall(r); -/* if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end;*/ + /* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ - mblit(x1,y1,x2,y2,3,1-cp); - }} + mblit(x1, y1, x2, y2, 3, 1 - cp); + } + } - blitfix; - /*if endangered then*/ /*Super_On;*/ + blitfix; + /*if endangered then*/ /*Super_On;*/ } /* Eachstep procedures: */ -void follow_avvy_y(byte tripnum) -{ - { - triptype& with = tr[tripnum]; - - if (tr[1].face==left) return; - if (with.homing) with.hy=tr[1].y; else - { - if (with.ytr[1].y) - with.y -= 1; else - return; - if (with.ix==0) { with.step += 1; if (with.step==with.a.seq) with.step=0; with.count=0; } - } - } +void follow_avvy_y(byte tripnum) { + { + triptype &with = tr[tripnum]; + + if (tr[1].face == left) return; + if (with.homing) with.hy = tr[1].y; + else { + if (with.y < tr[1].y) + with.y += 1; + else if (with.y > tr[1].y) + with.y -= 1; + else + return; + if (with.ix == 0) { + with.step += 1; + if (with.step == with.a.seq) with.step = 0; + with.count = 0; + } + } + } } -void back_and_forth(byte tripnum) -{ - { triptype& with = tr[tripnum]; - if (! with.homing) - { - if (with.face==right) walkto(4); else walkto(5); - }} +void back_and_forth(byte tripnum) { + { + triptype &with = tr[tripnum]; + if (! with.homing) { + if (with.face == right) walkto(4); + else walkto(5); + } + } } -void face_avvy(byte tripnum) -{ - { triptype& with = tr[tripnum]; - if (! with.homing) - { - if (tr[1].x>=with.x) with.face=right; - else with.face=left; - }} +void face_avvy(byte tripnum) { + { + triptype &with = tr[tripnum]; + if (! with.homing) { + if (tr[1].x >= with.x) with.face = right; + else with.face = left; + } + } } -void arrow_procs(byte tripnum) -{ - byte fv; - - { triptype& with = tr[tripnum]; - if (with.homing) - { /* Arrow is still in flight. */ - /* We must check whether or not the arrow has collided with Avvy's head. - This is so if: a) the bottom of the arrow is below Avvy's head, - b) the left of the arrow is left of the right of Avvy's head, and - c) the right of the arrow is right of the left of Avvy's head. */ - if (((with.y+with.a.yl)>=tr[1].y) /* A */ - && (with.x<=(tr[1].x+tr[1].a.xl)) /* B */ - && ((with.x+with.a.xl)>=tr[1].x)) /* C */ - { /* OK, it's hit him... what now? */ - - tr[2].call_eachstep=false; /* prevent recursion. */ - dixi('Q',47); /* Complaint! */ - done(); /* Deallocate the arrow. */ -/* tr[1].done; { Deallocate normal pic of Avvy. } - - off; - for fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - on;*/ - - gameover; - - dna.user_moves_avvy=false; /* Stop the user from moving him. */ - set_up_timer(55,procnaughty_duke,reason_naughty_duke); - } - } else /* Arrow has hit the wall! */ - { - done(); /* Deallocate the arrow. */ - show_one(3); /* Show pic of arrow stuck into the door. */ - dna.arrow_in_the_door=true; /* So that we can pick it up. */ - }} +void arrow_procs(byte tripnum) { + byte fv; + + { + triptype &with = tr[tripnum]; + if (with.homing) { + /* Arrow is still in flight. */ + /* We must check whether or not the arrow has collided with Avvy's head. + This is so if: a) the bottom of the arrow is below Avvy's head, + b) the left of the arrow is left of the right of Avvy's head, and + c) the right of the arrow is right of the left of Avvy's head. */ + if (((with.y + with.a.yl) >= tr[1].y) /* A */ + && (with.x <= (tr[1].x + tr[1].a.xl)) /* B */ + && ((with.x + with.a.xl) >= tr[1].x)) { /* C */ + /* OK, it's hit him... what now? */ + + tr[2].call_eachstep = false; /* prevent recursion. */ + dixi('Q', 47); /* Complaint! */ + done(); /* Deallocate the arrow. */ + /* tr[1].done; { Deallocate normal pic of Avvy. } + + off; + for fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on;*/ + + gameover; + + dna.user_moves_avvy = false; /* Stop the user from moving him. */ + set_up_timer(55, procnaughty_duke, reason_naughty_duke); + } + } else { /* Arrow has hit the wall! */ + done(); /* Deallocate the arrow. */ + show_one(3); /* Show pic of arrow stuck into the door. */ + dna.arrow_in_the_door = true; /* So that we can pick it up. */ + } + } } /*procedure Spludwick_procs(tripnum:byte); @@ -1476,441 +1593,490 @@ begin end; end;*/ -void grab_avvy(byte tripnum) /* For Friar Tuck, in Nottingham. */ -{ - byte fv; integer tox,toy; - - { triptype& with = tr[tripnum]; - { - tox=tr[1].x + 17; - toy=tr[1].y - 1; - if ((with.x==tox) && (with.y==toy)) - { - with.call_eachstep=false; - with.face=left; - stopwalk(); - /* ... whatever ... */ - } else - { /* Still some way to go. */ - if (with.xtox) with.x=tox; - } - if (with.y tox) with.x = tox; + } + if (with.y < toy) with.y += 1; + with.step += 1; + if (with.step == with.a.seq) with.step = 0; + } + } + } } void geida_procs(byte tripnum); -static void take_a_step(byte& tripnum) -{ - { triptype& with = tr[tripnum]; - if (with.ix==0) - { with.step += 1; if (with.step==with.a.seq) with.step=0; with.count=0; }} +static void take_a_step(byte &tripnum) { + { + triptype &with = tr[tripnum]; + if (with.ix == 0) { + with.step += 1; + if (with.step == with.a.seq) with.step = 0; + with.count = 0; + } + } } -static void spin(byte whichway, byte& tripnum) -{ - { triptype& with = tr[tripnum]; - if (with.face!=whichway) - { - with.face=whichway; - if (with.whichsprite==2) return; /* Not for Spludwick */ - - dna.geida_spin += 1; - dna.geida_time=20; - if (dna.geida_spin==5) - { - display("Steady on, Avvy, you'll make the poor girl dizzy!"); - dna.geida_spin=0; dna.geida_time=0; /* knock out records */ - } - }} +static void spin(byte whichway, byte &tripnum) { + { + triptype &with = tr[tripnum]; + if (with.face != whichway) { + with.face = whichway; + if (with.whichsprite == 2) return; /* Not for Spludwick */ + + dna.geida_spin += 1; + dna.geida_time = 20; + if (dna.geida_spin == 5) { + display("Steady on, Avvy, you'll make the poor girl dizzy!"); + dna.geida_spin = 0; + dna.geida_time = 0; /* knock out records */ + } + } + } } -void geida_procs(byte tripnum) -{ - { - triptype& with = tr[tripnum]; - - if (dna.geida_time>0) - { - dna.geida_time -= 1; - if (dna.geida_time==0) dna.geida_spin=0; - } - - if (with.y<(tr[1].y-2)) - { /* Geida is further from the screen than Avvy. */ - spin(down, tripnum); - with.iy=1; with.ix=0; - take_a_step(tripnum); - return; - } else - if (with.y>(tr[1].y+2)) - { /* Avvy is further from the screen than Geida. */ - spin(up, tripnum); - with.iy=-1; with.ix=0; - take_a_step(tripnum); - return; - } - - with.iy=0; - if (with.xtr[1].x+tr[1].xs*8) - { - with.ix=-tr[1].xs; - spin(left, tripnum); - take_a_step(tripnum); - } else with.ix=0; - } +void geida_procs(byte tripnum) { + { + triptype &with = tr[tripnum]; + + if (dna.geida_time > 0) { + dna.geida_time -= 1; + if (dna.geida_time == 0) dna.geida_spin = 0; + } + + if (with.y < (tr[1].y - 2)) { + /* Geida is further from the screen than Avvy. */ + spin(down, tripnum); + with.iy = 1; + with.ix = 0; + take_a_step(tripnum); + return; + } else if (with.y > (tr[1].y + 2)) { + /* Avvy is further from the screen than Geida. */ + spin(up, tripnum); + with.iy = -1; + with.ix = 0; + take_a_step(tripnum); + return; + } + + with.iy = 0; + if (with.x < tr[1].x - tr[1].xs * 8) { + with.ix = tr[1].xs; + spin(right, tripnum); + take_a_step(tripnum); + } else if (with.x > tr[1].x + tr[1].xs * 8) { + with.ix = -tr[1].xs; + spin(left, tripnum); + take_a_step(tripnum); + } else with.ix = 0; + } } /* That's all... */ -void call_andexors() -{ - array<1,5,byte> order; - byte fv,temp; - boolean ok; - - fillchar(order,5,'\0'); - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; - if (with.quick && with.visible) - order[fv]=fv;} - - do { - ok=true; - for( fv=1; fv <= 4; fv ++) - if (((order[fv]!=0) && (order[fv+1]!=0)) - && (tr[order[fv]].y>tr[order[fv+1]].y)) - { /* Swap them! */ - temp=order[fv]; - order[fv]=order[fv+1]; - order[fv+1]=temp; - ok=false; - } - } while (!ok); - - for( fv=1; fv <= 5; fv ++) - if (order[fv]>0) - tr[order[fv]].andexor(); +void call_andexors() { + array<1, 5, byte> order; + byte fv, temp; + boolean ok; + + fillchar(order, 5, '\0'); + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && with.visible) + order[fv] = fv; + } + + do { + ok = true; + for (fv = 1; fv <= 4; fv ++) + if (((order[fv] != 0) && (order[fv + 1] != 0)) + && (tr[order[fv]].y > tr[order[fv + 1]].y)) { + /* Swap them! */ + temp = order[fv]; + order[fv] = order[fv + 1]; + order[fv + 1] = temp; + ok = false; + } + } while (!ok); + + for (fv = 1; fv <= 5; fv ++) + if (order[fv] > 0) + tr[order[fv]].andexor(); } -void trippancy_link() -{ - byte fv; - - if (ddmnow | ontoolbar | seescroll) return; - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; if (with.quick) walk();} - call_andexors(); - for( fv=1; fv <= numtr; fv ++) { triptype& with = tr[fv]; - if (with.quick && with.call_eachstep) - { - switch (tr[fv].eachstep) { - case procfollow_avvy_y : follow_avvy_y(fv); break; - case procback_and_forth : back_and_forth(fv); break; - case procface_avvy : face_avvy(fv); break; - case procarrow_procs : arrow_procs(fv); break; -/* PROCSpludwick_procs : spludwick_procs(fv);*/ - case procgrab_avvy : grab_avvy(fv); break; - case procgeida_procs : geida_procs(fv); break; - } - }} - if (mustexclaim) - { - mustexclaim=false; - dixi('x',saywhat); - } +void trippancy_link() { + byte fv; + + if (ddmnow | ontoolbar | seescroll) return; + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) walk(); + } + call_andexors(); + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && with.call_eachstep) { + switch (tr[fv].eachstep) { + case procfollow_avvy_y : + follow_avvy_y(fv); + break; + case procback_and_forth : + back_and_forth(fv); + break; + case procface_avvy : + face_avvy(fv); + break; + case procarrow_procs : + arrow_procs(fv); + break; + /* PROCSpludwick_procs : spludwick_procs(fv);*/ + case procgrab_avvy : + grab_avvy(fv); + break; + case procgeida_procs : + geida_procs(fv); + break; + } + } + } + if (mustexclaim) { + mustexclaim = false; + dixi('x', saywhat); + } } -void get_back_loretta() -{ - byte fv; - -/* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ - for( fv=1; fv <= numtr; fv ++) if (tr[fv].quick) - { - getback(); - return; - } -/* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ +void get_back_loretta() { + byte fv; + + /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ + for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { + getback(); + return; + } + /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ } -void stopwalking() -{ - tr[1].stopwalk(); dna.rw=stopped; if (alive) tr[1].step=1; +void stopwalking() { + tr[1].stopwalk(); + dna.rw = stopped; + if (alive) tr[1].step = 1; } -void tripkey(char dir) -{ - if ((ctrl==cjoy) | (~ dna.user_moves_avvy)) return; - - { triptype& with = tr[1]; - { - switch (dir) { - case 'H': if (rw!=up) - { rw=up; rwsp(1,rw); } else stopwalking(); - break; - case 'P': if (rw!=down) - { rw=down; rwsp(1,rw); } else stopwalking(); - break; - case 'K': if (rw!=left) - { rw=left; rwsp(1,rw); } else stopwalking(); - break; - case 'M': if (rw!=right) - { rw=right; rwsp(1,rw); } else stopwalking(); - break; - case 'I': if (rw!=ur) - { rw=ur; rwsp(1,rw); } else stopwalking(); - break; - case 'Q': if (rw!=dr) - { rw=dr; rwsp(1,rw); } else stopwalking(); - break; - case 'O': if (rw!=dl) - { rw=dl; rwsp(1,rw); } else stopwalking(); - break; - case 'G': if (rw!=ul) - { rw=ul; rwsp(1,rw); } else stopwalking(); - break; - case 'L': stopwalking(); break; - } - }} +void tripkey(char dir) { + if ((ctrl == cjoy) | (~ dna.user_moves_avvy)) return; + + { + triptype &with = tr[1]; + { + switch (dir) { + case 'H': + if (rw != up) { + rw = up; + rwsp(1, rw); + } else stopwalking(); + break; + case 'P': + if (rw != down) { + rw = down; + rwsp(1, rw); + } else stopwalking(); + break; + case 'K': + if (rw != left) { + rw = left; + rwsp(1, rw); + } else stopwalking(); + break; + case 'M': + if (rw != right) { + rw = right; + rwsp(1, rw); + } else stopwalking(); + break; + case 'I': + if (rw != ur) { + rw = ur; + rwsp(1, rw); + } else stopwalking(); + break; + case 'Q': + if (rw != dr) { + rw = dr; + rwsp(1, rw); + } else stopwalking(); + break; + case 'O': + if (rw != dl) { + rw = dl; + rwsp(1, rw); + } else stopwalking(); + break; + case 'G': + if (rw != ul) { + rw = ul; + rwsp(1, rw); + } else stopwalking(); + break; + case 'L': + stopwalking(); + break; + } + } + } } -void readstick() -{ - byte jw; +void readstick() { + byte jw; - if (ctrl==ckey) return; + if (ctrl == ckey) return; - jw=joyway; + jw = joyway; - { - triptype& with = tr[1]; + { + triptype &with = tr[1]; - if (jw==stopped) stopwalking(); else - { - dna.rw=jw; rwsp(1,dna.rw); - } - } + if (jw == stopped) stopwalking(); + else { + dna.rw = jw; + rwsp(1, dna.rw); + } + } - if (jw!=oldjw) - { - showrw; - oldjw=jw; - } + if (jw != oldjw) { + showrw; + oldjw = jw; + } } -void getsetclear() -{ - byte fv; +void getsetclear() { + byte fv; - for( fv=0; fv <= 1; fv ++) getset[fv].init(); + for (fv = 0; fv <= 1; fv ++) getset[fv].init(); } -void hide_in_the_cupboard() -{ - const char nowt = '\372'; /* As in Acci. */ - - { - if (avvys_in_the_cupboard) - { - if (wearing==nowt) - display("\6AVVY!\22 Get dressed first!"); - else - { - tr[1].visible=true; - user_moves_avvy=true; - apped(1,3); /* Walk out of the cupboard. */ - display("You leave the cupboard. Nice to be out of there!"); - avvys_in_the_cupboard=false; - first_show(8); then_show(7); start_to_close; - } - } else - { /* Not hiding in the cupboard */ - tr[1].visible=false; - user_moves_avvy=false; - display(string("You walk into the room...\20It seems to be an empty, ")+ - "but dusty, cupboard. Hmmmm... you leave the door slightly open to "+ - "avoid suffocation."); - avvys_in_the_cupboard=true; - show_one(8); - } - } +void hide_in_the_cupboard() { + const char nowt = '\372'; /* As in Acci. */ + + { + if (avvys_in_the_cupboard) { + if (wearing == nowt) + display("\6AVVY!\22 Get dressed first!"); + else { + tr[1].visible = true; + user_moves_avvy = true; + apped(1, 3); /* Walk out of the cupboard. */ + display("You leave the cupboard. Nice to be out of there!"); + avvys_in_the_cupboard = false; + first_show(8); + then_show(7); + start_to_close; + } + } else { + /* Not hiding in the cupboard */ + tr[1].visible = false; + user_moves_avvy = false; + display(string("You walk into the room...\20It seems to be an empty, ") + + "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + + "avoid suffocation."); + avvys_in_the_cupboard = true; + show_one(8); + } + } } -void fliproom(byte room,byte ped); -static integer beforex,beforey; +void fliproom(byte room, byte ped); +static integer beforex, beforey; static void tidy_after_mouse(); -static void tidy_up(integer a,integer b,integer c,integer d) -{ - bytefield bf; - - { - x1=a / 8; - y1=b; - x2=(c+7) / 8; - y2=d; - setactivepage(0); - rectangle(x1*8,y1,x2*8+7,y2); - } - getset[0].remember(bf); - getset[1].remember(bf); +static void tidy_up(integer a, integer b, integer c, integer d) { + bytefield bf; + + { + x1 = a / 8; + y1 = b; + x2 = (c + 7) / 8; + y2 = d; + setactivepage(0); + rectangle(x1 * 8, y1, x2 * 8 + 7, y2); + } + getset[0].remember(bf); + getset[1].remember(bf); } -static void tidy_after_mouse() -{ - tidy_up(beforex,beforey,beforex+15,beforey+15); - xycheck; - tidy_up(mx,my,mx+15,my+15); +static void tidy_after_mouse() { + tidy_up(beforex, beforey, beforex + 15, beforey + 15); + xycheck; + tidy_up(mx, my, mx + 15, my + 15); } -void fliproom(byte room,byte ped) -{ - byte fv; +void fliproom(byte room, byte ped) { + byte fv; - if (~ alive) - { /* You can't leave the room if you're dead. */ - tr[1].ix=0; tr[1].iy=0; /* Stop him from moving. */ - return; - } + if (~ alive) { + /* You can't leave the room if you're dead. */ + tr[1].ix = 0; + tr[1].iy = 0; /* Stop him from moving. */ + return; + } - if ((ped==177) && (dna.room==r__lusties)) - { - hide_in_the_cupboard(); - return; - } + if ((ped == 177) && (dna.room == r__lusties)) { + hide_in_the_cupboard(); + return; + } - if ((dna.jumpstatus>0) && (dna.room==r__insidecardiffcastle)) - { /* You can't *jump* out of Cardiff Castle! */ - tr[1].ix=0; - return; - } + if ((dna.jumpstatus > 0) && (dna.room == r__insidecardiffcastle)) { + /* You can't *jump* out of Cardiff Castle! */ + tr[1].ix = 0; + return; + } - xycheck; beforex=mx; beforey=my; + xycheck; + beforex = mx; + beforey = my; - exitroom(dna.room); - dusk; getsetclear(); + exitroom(dna.room); + dusk; + getsetclear(); - for( fv=2; fv <= numtr; fv ++) - { triptype& with = tr[fv]; - if (with.quick) done();} /* Deallocate sprite */ + for (fv = 2; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick) done(); + } /* Deallocate sprite */ - if (dna.room==r__lustiesroom) - dna.enter_catacombs_from_lusties_room=true; + if (dna.room == r__lustiesroom) + dna.enter_catacombs_from_lusties_room = true; - enterroom(room,ped); apped(1,ped); - dna.enter_catacombs_from_lusties_room=false; - oldrw=dna.rw; dna.rw=tr[1].face; showrw; + enterroom(room, ped); + apped(1, ped); + dna.enter_catacombs_from_lusties_room = false; + oldrw = dna.rw; + dna.rw = tr[1].face; + showrw; - for( fv=0; fv <= 1; fv ++) - { - cp=1-cp; - getback(); - } - dawn; + for (fv = 0; fv <= 1; fv ++) { + cp = 1 - cp; + getback(); + } + dawn; - /* Tidy up after mouse. I know it's a kludge... */ -/* tidy_after_mouse;*/ + /* Tidy up after mouse. I know it's a kludge... */ + /* tidy_after_mouse;*/ } boolean infield(byte which) - /* returns True if you're within field "which" */ +/* returns True if you're within field "which" */ { - integer yy; - - boolean infield_result; - { void& with = fields[which]; { - triptype& with = tr[1]; - - yy=with.y+with.a.yl; - infield_result=(with.x>=x1) && (with.x<=x2) && (yy>=y1) && (yy<=y2); - }} - return infield_result; + integer yy; + + boolean infield_result; + { + void &with = fields[which]; + { + triptype &with = tr[1]; + + yy = with.y + with.a.yl; + infield_result = (with.x >= x1) && (with.x <= x2) && (yy >= y1) && (yy <= y2); + } + } + return infield_result; } -boolean neardoor() /* returns True if you're near a door! */ -{ - integer ux,uy; byte fv; boolean nd; - - boolean neardoor_result; - if (numfields<9) - { /* there ARE no doors here! */ - neardoor_result=false; - return neardoor_result; - } - { - triptype& with = tr[1]; - - ux=with.x; - uy=with.y+with.a.yl; - } nd=false; - for( fv=9; fv <= numfields; fv ++) - { - void& with = fields[fv]; - - if ((ux>=x1) && (ux<=x2) && (uy>=y1) && (uy<=y2)) nd=true; - } - neardoor_result=nd; - return neardoor_result; +boolean neardoor() { /* returns True if you're near a door! */ + integer ux, uy; + byte fv; + boolean nd; + + boolean neardoor_result; + if (numfields < 9) { + /* there ARE no doors here! */ + neardoor_result = false; + return neardoor_result; + } + { + triptype &with = tr[1]; + + ux = with.x; + uy = with.y + with.a.yl; + } + nd = false; + for (fv = 9; fv <= numfields; fv ++) { + void &with = fields[fv]; + + if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; + } + neardoor_result = nd; + return neardoor_result; } -void new_game_for_trippancy() /* Called by gyro.newgame */ -{ - tr[1].visible=false; +void new_game_for_trippancy() { /* Called by gyro.newgame */ + tr[1].visible = false; } -void triptype::save_data_to_mem(word& where) -{ - trip_saver_type tripsaver; +void triptype::save_data_to_mem(word &where) { + trip_saver_type tripsaver; - set_up_saver(tripsaver); - move(tripsaver,mem[storage_seg*where],sizeof(tripsaver)); - where += sizeof(tripsaver); + set_up_saver(tripsaver); + move(tripsaver, mem[storage_seg * where], sizeof(tripsaver)); + where += sizeof(tripsaver); } -void triptype::load_data_from_mem(word& where) -{ - word spritewas,spriteis,saveface,savex,savey,savestep; - boolean wasquick; - trip_saver_type tripsaver; +void triptype::load_data_from_mem(word &where) { + word spritewas, spriteis, saveface, savex, savey, savestep; + boolean wasquick; + trip_saver_type tripsaver; - move(mem[storage_seg*where],tripsaver,sizeof(tripsaver)); - where += sizeof(tripsaver); - unload_saver(tripsaver); + move(mem[storage_seg * where], tripsaver, sizeof(tripsaver)); + where += sizeof(tripsaver); + unload_saver(tripsaver); - spriteis=whichsprite; - savex=x; savey=y; saveface=face; savestep=step; + spriteis = whichsprite; + savex = x; + savey = y; + saveface = face; + savestep = step; - init(spriteis,check_me); + init(spriteis, check_me); - appear(savex,savey,saveface); unload_saver(tripsaver); - step=savestep; + appear(savex, savey, saveface); + unload_saver(tripsaver); + step = savestep; } class unit_trip5_initialize { - public: unit_trip5_initialize(); +public: + unit_trip5_initialize(); }; static unit_trip5_initialize trip5_constructor; unit_trip5_initialize::unit_trip5_initialize() { - getsetclear(); mustexclaim=false; + getsetclear(); + mustexclaim = false; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h index 6c1823211010..06642813e6ef 100644 --- a/engines/avalanche/trip5.h +++ b/engines/avalanche/trip5.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,90 +39,94 @@ namespace Avalanche { const integer maxgetset = 35; -typedef array<5,2053,byte> manitype; +typedef array<5, 2053, byte> manitype; -typedef matrix<0,50,0,10,byte> siltype; /* 35, 4 */ +typedef matrix<0, 50, 0, 10, byte> siltype; /* 35, 4 */ struct adxtype { /* Second revision of ADX type */ - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; struct trip_saver_type { - byte whichsprite; - byte face; byte step; - integer x; integer y; - shortint ix; shortint iy; - boolean visible; - boolean homing; - boolean check_me; - byte count; - byte xw,xs,ys; - byte totalnum; - integer hx; integer hy; - boolean call_eachstep; - byte eachstep; - boolean vanishifstill; + byte whichsprite; + byte face; + byte step; + integer x; + integer y; + shortint ix; + shortint iy; + boolean visible; + boolean homing; + boolean check_me; + byte count; + byte xw, xs, ys; + byte totalnum; + integer hx; + integer hy; + boolean call_eachstep; + byte eachstep; + boolean vanishifstill; }; class triptype { public: - adxtype a; /* vital statistics */ - byte face,step; - integer x,y; /* current xy coords */ - array<0,1,integer> ox,oy; /* last xy coords */ - shortint ix,iy; /* amount to move sprite by, each step */ - array<1,24,manitype*> mani; - array<1,24,siltype*> sil; - byte whichsprite; - boolean quick,visible,homing,check_me; - integer hx,hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - byte xw; /* x-width in bytes */ - byte xs,ys; /* x & y speed */ - byte totalnum; /* total number of sprites */ - boolean vanishifstill; /* Do we show this sprite if it's still? */ - - boolean call_eachstep; /* Do we call the eachstep procedure? */ - byte eachstep; - - triptype* init(byte spritenum, boolean do_check); - /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx,integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(byte pednum); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ - void set_up_saver(trip_saver_type& v); - void unload_saver(trip_saver_type v); - void savedata(untyped_file& f); /* Self-explanatory, */ - void loaddata(untyped_file& f); /* really. */ - void save_data_to_mem(word& where); - void load_data_from_mem(word& where); - triptype* done(); + adxtype a; /* vital statistics */ + byte face, step; + integer x, y; /* current xy coords */ + array<0, 1, integer> ox, oy; /* last xy coords */ + shortint ix, iy; /* amount to move sprite by, each step */ + array<1, 24, manitype *> mani; + array<1, 24, siltype *> sil; + byte whichsprite; + boolean quick, visible, homing, check_me; + integer hx, hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + byte xw; /* x-width in bytes */ + byte xs, ys; /* x & y speed */ + byte totalnum; /* total number of sprites */ + boolean vanishifstill; /* Do we show this sprite if it's still? */ + + boolean call_eachstep; /* Do we call the eachstep procedure? */ + byte eachstep; + + triptype *init(byte spritenum, boolean do_check); + /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx, integer wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(byte pednum); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ + void set_up_saver(trip_saver_type &v); + void unload_saver(trip_saver_type v); + void savedata(untyped_file &f); /* Self-explanatory, */ + void loaddata(untyped_file &f); /* really. */ + void save_data_to_mem(word &where); + void load_data_from_mem(word &where); + triptype *done(); }; class getsettype { public: - array<1,maxgetset,bytefield> gs; - byte numleft; + array<1, maxgetset, bytefield> gs; + byte numleft; - getsettype* init(); - void remember(bytefield r); - void recall(bytefield& r); + getsettype *init(); + void remember(bytefield r); + void recall(bytefield &r); }; @@ -130,7 +134,10 @@ const integer up = 0; const integer right = 1; const integer down = 2; const integer left = 3; -const integer ur = 4; const integer dr = 5; const integer dl = 6; const integer ul = 7; +const integer ur = 4; +const integer dr = 5; +const integer dl = 6; +const integer ul = 7; const integer stopped = 8; const integer numtr = 5; /* current max no. of sprites */ @@ -160,7 +167,7 @@ void loadtrip(); void call_special(word which); -void open_the_door(byte whither,byte ped,byte magicnum); /* Handles slidey-open doors. */ +void open_the_door(byte whither, byte ped, byte magicnum); /* Handles slidey-open doors. */ void catamove(byte ped); @@ -168,13 +175,13 @@ void stopwalking(); void tripkey(char dir); -void rwsp(byte t,byte r); +void rwsp(byte t, byte r); -void apped(byte trn,byte np); +void apped(byte trn, byte np); void getback(); -void fliproom(byte room,byte ped); +void fliproom(byte room, byte ped); boolean infield(byte which); /* returns True if you're within field "which" */ @@ -192,11 +199,12 @@ void new_game_for_trippancy(); #define EXTERN #endif -EXTERN array<1,numtr,triptype> tr; -EXTERN array<0,1,getsettype> getset; -EXTERN array<1,16000,byte> aa; +EXTERN array<1, numtr, triptype> tr; +EXTERN array<0, 1, getsettype> getset; +EXTERN array<1, 16000, byte> aa; -EXTERN boolean mustexclaim; EXTERN word saywhat; +EXTERN boolean mustexclaim; +EXTERN word saywhat; #undef EXTERN #define EXTERN extern diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index 8dbd985ab44c..191d8f3756b1 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -33,131 +33,135 @@ namespace Avalanche { struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; -integer gd,gm; +integer gd, gm; untyped_file inf; adxtype a; -array<1,16000,byte> aa; -array<5,2053,byte> mani; -matrix<0,35,0,4,byte> sil; +array<1, 16000, byte> aa; +array<5, 2053, byte> mani; +matrix<0, 35, 0, 4, byte> sil; byte xw; -void filesetup() -{ - const integer idshould = -1317732048; - longint id; - word soa; -; - assign(inf,"v:sprite2.avd"); - reset(inf,1); - seek(inf,177); - blockread(inf,id,4); - if (id!=idshould) - {; - output << '\7'; - close(inf); - exit(0); - } - - blockread(inf,soa,2); - blockread(inf,a,soa); +void filesetup() { + const integer idshould = -1317732048; + longint id; + word soa; + ; + assign(inf, "v:sprite2.avd"); + reset(inf, 1); + seek(inf, 177); + blockread(inf, id, 4); + if (id != idshould) { + ; + output << '\7'; + close(inf); + exit(0); + } + + blockread(inf, soa, 2); + blockread(inf, a, soa); } -void loadpic() -{ - byte fv,ff; -; - {; - xw=a.xl / 8; if ((a.xl % 8)>0) xw += 1; - -/* aa[1]:=xl; aa[2]:=0; aa[3]:=yl; aa[4]:=0;*/ - /* The putimage x&y codes are words but xl & yl are bytes, hence the #0s. */ -/* seek(inf,filepos(inf)+xw*(yl+1));*/ - for( fv=0; fv <= a.yl; fv ++) - blockread(inf,sil[fv],xw); - blockread(inf,mani,a.size-6); -/* blockread(inf,aa[5+fv*xw*4+xw*ff],xw);*/ - aa[a.size-1]=0; aa[a.size]=0; /* footer */ - } -/* putimage(0,0,aa,0);*/ +void loadpic() { + byte fv, ff; + ; + { + ; + xw = a.xl / 8; + if ((a.xl % 8) > 0) xw += 1; + + /* aa[1]:=xl; aa[2]:=0; aa[3]:=yl; aa[4]:=0;*/ + /* The putimage x&y codes are words but xl & yl are bytes, hence the #0s. */ + /* seek(inf,filepos(inf)+xw*(yl+1));*/ + for (fv = 0; fv <= a.yl; fv ++) + blockread(inf, sil[fv], xw); + blockread(inf, mani, a.size - 6); + /* blockread(inf,aa[5+fv*xw*4+xw*ff],xw);*/ + aa[a.size - 1] = 0; + aa[a.size] = 0; /* footer */ + } + /* putimage(0,0,aa,0);*/ } -void plotone(integer xx,integer yy) -{ - word s; - word ofs,fv; - byte x,y,z; -; - {; - s=imagesize(x,y,xx+a.xl,yy+a.yl); - getimage(xx,yy,xx+a.xl,yy+a.yl,aa); /* Now loaded into our local buffer. */ - - /* Now we've got to modify it! */ - - for( x=0; x <= 3; x ++) - for( y=0; y <= 35; y ++) - for( z=0; z <= 4; z ++) - {; - ofs=5+y*xw*4+xw*x+z; - aa[ofs]=aa[ofs] & sil[y][z]; - } - - /* mov ax,5 ; AX = ofs - mov bx,xw ; wherever we get xw from - mov cx,x ; ditto - mov dx,y ; ditto - mul cx,bx ; x*xw - mul dx,bx ; y*yw - add ax,cx ; now add 'em all up - add ax,dx ; ... - mov bx,z ; get z (we don't need x any more) - mov cx,syz ; get silyz (where from??!) - add ax,bx ; add on the last part of the addition - and ax,cx ; AND ax with cx. That's it! */ - -/* - for x:=1 to 4 do - begin; - for y:=0 to 35 do - for z:=0 to 4 do - begin; - ofs:=5+y*xw*4+xw*x+z; - aa[ofs]:=aa[ofs] xor pic[x,y,z]; - end; - end; -*/ - - for( fv=5; fv <= a.size-2; fv ++) - aa[fv]=aa[fv] ^ mani[fv]; - - /* Now.. let's try pasting it back again! */ - - putimage(xx,yy,aa,0); - } +void plotone(integer xx, integer yy) { + word s; + word ofs, fv; + byte x, y, z; + ; + { + ; + s = imagesize(x, y, xx + a.xl, yy + a.yl); + getimage(xx, yy, xx + a.xl, yy + a.yl, aa); /* Now loaded into our local buffer. */ + + /* Now we've got to modify it! */ + + for (x = 0; x <= 3; x ++) + for (y = 0; y <= 35; y ++) + for (z = 0; z <= 4; z ++) { + ; + ofs = 5 + y * xw * 4 + xw * x + z; + aa[ofs] = aa[ofs] & sil[y][z]; + } + + /* mov ax,5 ; AX = ofs + mov bx,xw ; wherever we get xw from + mov cx,x ; ditto + mov dx,y ; ditto + mul cx,bx ; x*xw + mul dx,bx ; y*yw + add ax,cx ; now add 'em all up + add ax,dx ; ... + mov bx,z ; get z (we don't need x any more) + mov cx,syz ; get silyz (where from??!) + add ax,bx ; add on the last part of the addition + and ax,cx ; AND ax with cx. That's it! */ + + /* + for x:=1 to 4 do + begin; + for y:=0 to 35 do + for z:=0 to 4 do + begin; + ofs:=5+y*xw*4+xw*x+z; + aa[ofs]:=aa[ofs] xor pic[x,y,z]; + end; + end; + */ + + for (fv = 5; fv <= a.size - 2; fv ++) + aa[fv] = aa[fv] ^ mani[fv]; + + /* Now.. let's try pasting it back again! */ + + putimage(xx, yy, aa, 0); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - initgraph(gd,gm,""); - setfillstyle(6,1); bar(0,0,640,200); - filesetup(); - for( gd=1; gd <= 9; gd ++) loadpic(); - do { - plotone(Random(500),Random(150)); - } while (!keypressed()); - plotone(0,0); - close(inf); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + initgraph(gd, gm, ""); + setfillstyle(6, 1); + bar(0, 0, 640, 200); + filesetup(); + for (gd = 1; gd <= 9; gd ++) loadpic(); + do { + plotone(Random(500), Random(150)); + } while (!keypressed()); + plotone(0, 0); + close(inf); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index f83f9c7ec245..eecfa75de2cc 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,170 +30,187 @@ namespace Avalanche { -const string crlf = string('\15')+'\12'; const char eof_ = '\32'; -const array<1,177,char> trip5head = - string("Sprite*.AVD ... data file for Trippancy Five")+crlf+crlf+ - "[Thorsoft relocatable fiveplane sprite image format]"+crlf+crlf+ - "Thomas Thurman was here. ... Have fun!"+crlf+crlf+eof_+ - " * G. I. E. D. ! * "; +const string crlf = string('\15') + '\12'; +const char eof_ = '\32'; +const array<1, 177, char> trip5head = + string("Sprite*.AVD ... data file for Trippancy Five") + crlf + crlf + + "[Thorsoft relocatable fiveplane sprite image format]" + crlf + crlf + + "Thomas Thurman was here. ... Have fun!" + crlf + crlf + eof_ + + " * G. I. E. D. ! * "; -const array<1,4,char> tripid = string('\x30')+'\x1'+'\x75'+'\261'; +const array<1, 4, char> tripid = string('\x30') + '\x1' + '\x75' + '\261'; -const array<1,50,char> trip5foot = crlf+crlf+ - " and that's it! Enjoy the game. "+'\3'+crlf+crlf+ - "\n\n\n\n\n\n\n"+"tt"; +const array<1, 50, char> trip5foot = crlf + crlf + + " and that's it! Enjoy the game. " + '\3' + crlf + crlf + + "\n\n\n\n\n\n\n" + "tt"; struct adxotype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + varying_string<16> comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; varying_string<2> sn; adxotype oa; adxtype a; -matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ -array<1,16000,byte> aa; +matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ +array<1, 16000, byte> aa; untyped_file out; integer bigsize; -void copyaoa() -{; - {; - a.name=oa.name; - a.comment="Transferred"; - a.num=oa.num; - a.xl=oa.xl; - a.yl=oa.yl; - a.seq=oa.seq; - a.size=oa.size; - a.fgc=oa.fgc; - a.bgc=oa.bgc; - } +void copyaoa() { + ; + { + ; + a.name = oa.name; + a.comment = "Transferred"; + a.num = oa.num; + a.xl = oa.xl; + a.yl = oa.yl; + a.seq = oa.seq; + a.size = oa.size; + a.fgc = oa.fgc; + a.bgc = oa.bgc; + } } -void load() -{ - untyped_file f; byte gd,gm,sort,n; pointer p,q; - pointer xf; -; - assign(f,string("v:osprte")+sn+".avd"); reset(f,1); seek(f,59); - blockread(f,oa,sizeof(oa)); blockread(f,bigsize,2); - copyaoa(); - - getmem(xf,a.size); - - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); - blockread(f,p,bigsize); - putimage(0,0,p,0); release(q); n=1; - - if (sort==0) setfillstyle(1,15); else setfillstyle(1,0); - bar(177,125,300,200); - - for( gm=0; gm <= (a.num / a.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= a.seq-1; gd ++) /* steps */ - {; - getmem(pic[n][sort],a.size); /* grab the memory */ - getimage((gm / 2)*(a.xl*6)+gd*a.xl,(gm % 2)*a.yl, - (gm / 2)*(a.xl*6)+gd*a.xl+a.xl-1,(gm % 2)*a.yl+a.yl-1, - xf); - putimage(177,125,xf,0); - getimage(177,125,177+a.xl,125+a.yl,pic[n][sort]); /* grab the pic */ - n += 1; - } - } - close(f); - freemem(xf,a.size); - cleardevice(); - for( gm=0; gm <= 1; gm ++) - for( gd=1; gd <= a.num; gd ++) - putimage(gd*15,gm*40,pic[gd][gm],0); +void load() { + untyped_file f; + byte gd, gm, sort, n; + pointer p, q; + pointer xf; + ; + assign(f, string("v:osprte") + sn + ".avd"); + reset(f, 1); + seek(f, 59); + blockread(f, oa, sizeof(oa)); + blockread(f, bigsize, 2); + copyaoa(); + + getmem(xf, a.size); + + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + blockread(f, p, bigsize); + putimage(0, 0, p, 0); + release(q); + n = 1; + + if (sort == 0) setfillstyle(1, 15); + else setfillstyle(1, 0); + bar(177, 125, 300, 200); + + for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ + ; + getmem(pic[n][sort], a.size); /* grab the memory */ + getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, + (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, + xf); + putimage(177, 125, xf, 0); + getimage(177, 125, 177 + a.xl, 125 + a.yl, pic[n][sort]); /* grab the pic */ + n += 1; + } + } + close(f); + freemem(xf, a.size); + cleardevice(); + for (gm = 0; gm <= 1; gm ++) + for (gd = 1; gd <= a.num; gd ++) + putimage(gd * 15, gm * 40, pic[gd][gm], 0); } -void setup() -{ - integer gd,gm; -; - output << "TRIP5XF (c) 1992, Thomas Thurman." << NL; output << NL; - output << "Enter number of SPRITE*.AVD file to convert:"; input >> sn >> NL; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - load(); +void setup() { + integer gd, gm; + ; + output << "TRIP5XF (c) 1992, Thomas Thurman." << NL; + output << NL; + output << "Enter number of SPRITE*.AVD file to convert:"; + input >> sn >> NL; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + load(); } -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -void save() -{ - byte sort,n; - word fv,ff; char r; byte xw; - byte nxl,nyl; - word soa; -; - cleardevice(); - {; - a.size=imagesize(0,0,a.xl,a.yl); - soa=sizeof(a); - - assign(out,string("v:sprite")+sn+".avd"); rewrite(out,1); - blockwrite(out,trip5head,177); - blockwrite(out,tripid,4); - blockwrite(out,soa,2); - blockwrite(out,a,soa); - - nxl=a.xl; nyl=a.yl; - xw=nxl / 8; - if ((nxl % 8)>0) xw += 1; - - for( n=1; n <= a.num; n ++) - {; - putimage( 0,0,pic[n][0],0); - getimage( 0,0,a.xl,a.yl,aa); - for( fv=0; fv <= nyl; fv ++) - blockwrite(out,aa[5+fv*xw*4],xw); - - putimage(100,0,pic[n][1],0); - getimage(100,0,100+a.xl,a.yl,aa); - putimage(100,100,aa,4); -/* for ff:=1 to 4 do { actually 2 to 5, but it doesn't matter here } - for fv:=0 to nyl do*/ -/* for ff:=5 to size-2 do - blockwrite(out,aa[ff],1);*/ - blockwrite(out,aa[5],a.size-6); - } - } +void save() { + byte sort, n; + word fv, ff; + char r; + byte xw; + byte nxl, nyl; + word soa; + ; + cleardevice(); + { + ; + a.size = imagesize(0, 0, a.xl, a.yl); + soa = sizeof(a); + + assign(out, string("v:sprite") + sn + ".avd"); + rewrite(out, 1); + blockwrite(out, trip5head, 177); + blockwrite(out, tripid, 4); + blockwrite(out, soa, 2); + blockwrite(out, a, soa); + + nxl = a.xl; + nyl = a.yl; + xw = nxl / 8; + if ((nxl % 8) > 0) xw += 1; + + for (n = 1; n <= a.num; n ++) { + ; + putimage(0, 0, pic[n][0], 0); + getimage(0, 0, a.xl, a.yl, aa); + for (fv = 0; fv <= nyl; fv ++) + blockwrite(out, aa[5 + fv * xw * 4], xw); + + putimage(100, 0, pic[n][1], 0); + getimage(100, 0, 100 + a.xl, a.yl, aa); + putimage(100, 100, aa, 4); + /* for ff:=1 to 4 do { actually 2 to 5, but it doesn't matter here } + for fv:=0 to nyl do*/ + /* for ff:=5 to size-2 do + blockwrite(out,aa[ff],1);*/ + blockwrite(out, aa[5], a.size - 6); + } + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup(); - save(); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup(); + save(); - blockwrite(out,trip5foot,50); - close(out); -return EXIT_SUCCESS; + blockwrite(out, trip5foot, 50); + close(out); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index 0edd926628d4..2fe8f5f4cbb4 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,280 +39,344 @@ const integer left = 3; const integer numtr = 1; /* current max no. of sprites */ struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl,yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc,bgc; /* foreground & background bubble colours */ + varying_string<12> name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + word size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ }; class triptype { public: - adxtype a; /* vital statistics */ - byte face,step; - integer x,y; /* current xy coords */ - integer ox,oy; /* last xy coords */ - integer tax,tay; /* "behind" taken at... */ - shortint ix,iy; /* amount to move sprite by, each step */ - matrix<1,24,0,1,pointer> pic; /* the pictures themselves */ - boolean quick,visible,homing; - pointer behind; /* what's behind you */ - integer hx,hy; /* homing x & y coords */ - - triptype* init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen 1 */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx,integer wy, byte wf); /* switches him on */ - void walk(); /* prepares for do_it, andexor, etc. */ - void do_it(); /* Actually copies the picture over */ - void getback(); /* gets background before sprite is drawn */ - void putback(); /* ...and wipes sprite from screen 1 */ - void walkto(integer xx,integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx,shortint yy); /* sets ix & iy, non-homing, etc */ - void halt(); /* Stops the sprite from moving */ + adxtype a; /* vital statistics */ + byte face, step; + integer x, y; /* current xy coords */ + integer ox, oy; /* last xy coords */ + integer tax, tay; /* "behind" taken at... */ + shortint ix, iy; /* amount to move sprite by, each step */ + matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ + boolean quick, visible, homing; + pointer behind; /* what's behind you */ + integer hx, hy; /* homing x & y coords */ + + triptype *init(byte spritenum); /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen 1 */ + void turn(byte whichway); /* turns him round */ + void appear(integer wx, integer wy, byte wf); /* switches him on */ + void walk(); /* prepares for do_it, andexor, etc. */ + void do_it(); /* Actually copies the picture over */ + void getback(); /* gets background before sprite is drawn */ + void putback(); /* ...and wipes sprite from screen 1 */ + void walkto(integer xx, integer yy); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ + void halt(); /* Stops the sprite from moving */ }; -integer gd,gm; -array<1,1,triptype> tr; +integer gd, gm; +array<1, 1, triptype> tr; -void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4); +void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4); -static boolean dropin(integer xc,integer yc,integer x1,integer y1,integer x2,integer y2) +static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{boolean dropin_result; -; - dropin_result=((xc>=x1) && (xc<=x2) && (yc>=y1) && (yc<=y2)); -return dropin_result; +{ + boolean dropin_result; + ; + dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); + return dropin_result; } -static void transfer(integer x1,integer y1,integer x2,integer y2) -{ - pointer p,q; word s; -; - s=imagesize(x1,y1,x2,y2); setfillstyle(1,0); - mark(q); getmem(p,s); - setactivepage(1); getimage(x1,y1,x2,y2,p); - setactivepage(0); putimage(x1,y1,p,copyput); - setactivepage(1); release(q); +static void transfer(integer x1, integer y1, integer x2, integer y2) { + pointer p, q; + word s; + ; + s = imagesize(x1, y1, x2, y2); + setfillstyle(1, 0); + mark(q); + getmem(p, s); + setactivepage(1); + getimage(x1, y1, x2, y2, p); + setactivepage(0); + putimage(x1, y1, p, copyput); + setactivepage(1); + release(q); } -static integer lesser(integer a,integer b) -{integer lesser_result; -; - if (ab) greater_result=a; else greater_result=b; -return greater_result; +static integer greater(integer a, integer b) { + integer greater_result; + ; + if (a > b) greater_result = a; + else greater_result = b; + return greater_result; } -void copier(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3,integer x4,integer y4) - -{; - if (dropin(x3,y3,x1,y1,x2,y2) - || dropin(x3,y4,x1,y1,x2,y2) - || dropin(x4,y3,x1,y1,x2,y2) - || dropin(x4,y4,x1,y1,x2,y2)) - {; /* Overlaps */ - transfer(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4)); - } else - {; /* Doesn't overlap- copy both of them seperately */ - transfer(x3,y3,x4,y4); /* backwards- why not...? */ - transfer(x1,y1,x2,y2); - } -} +void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) -void setup() { - integer gd,gm; -; - gd=3; gm=0; initgraph(gd,gm,""); - for( gd=0; gd <= 1; gd ++) - {; - setactivepage(gd); - setfillstyle(9,1); bar(0,0,640,200); - } - for( gm=1; gm <= numtr; gm ++) tr[gm].original(); + ; + if (dropin(x3, y3, x1, y1, x2, y2) + || dropin(x3, y4, x1, y1, x2, y2) + || dropin(x4, y3, x1, y1, x2, y2) + || dropin(x4, y4, x1, y1, x2, y2)) { + ; /* Overlaps */ + transfer(lesser(x1, x3), lesser(y1, y3), greater(x2, x4), greater(y2, y4)); + } else { + ; /* Doesn't overlap- copy both of them seperately */ + transfer(x3, y3, x4, y4); /* backwards- why not...? */ + transfer(x1, y1, x2, y2); + } } -triptype* triptype::init(byte spritenum) -{ - integer gd,gm; word s; untyped_file f; varying_string<2> xx; pointer p,q; word bigsize; - byte sort,n; -; - str(spritenum,xx); assign(f,string("v:sprite")+xx+".avd"); - reset(f,1); seek(f,59); - blockread(f,a,sizeof(a)); blockread(f,bigsize,2); - setvisualpage(3); setactivepage(3); - for( sort=0; sort <= 1; sort ++) - {; - mark(q); getmem(p,bigsize); - blockread(f,p,bigsize); - putimage(0,0,p,0); release(q); n=1; - { adxtype& with = a; - for( gm=0; gm <= (with.num / with.seq)-1; gm ++) /* directions */ - for( gd=0; gd <= with.seq-1; gd ++) /* steps */ - {; - getmem(pic[n][sort],a.size); /* grab the memory */ - getimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, - (gm / 2)*(with.xl*6)+gd*with.xl+with.xl-1,(gm % 2)*with.yl+with.yl-1, - pic[n][sort]); /* grab the pic */ - putimage((gm / 2)*(with.xl*6)+gd*with.xl,(gm % 2)*with.yl, - pic[n][sort],notput); /* test the pic */ - n += 1; - }} - } - close(f); setactivepage(0); setvisualpage(0); - x=0; y=0; quick=true; visible=false; getmem(behind,a.size); - homing=false; ix=0; iy=0; -return this; +void setup() { + integer gd, gm; + ; + gd = 3; + gm = 0; + initgraph(gd, gm, ""); + for (gd = 0; gd <= 1; gd ++) { + ; + setactivepage(gd); + setfillstyle(9, 1); + bar(0, 0, 640, 200); + } + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); } -void triptype::original() -{; - quick=false; +triptype *triptype::init(byte spritenum) { + integer gd, gm; + word s; + untyped_file f; + varying_string<2> xx; + pointer p, q; + word bigsize; + byte sort, n; + ; + str(spritenum, xx); + assign(f, string("v:sprite") + xx + ".avd"); + reset(f, 1); + seek(f, 59); + blockread(f, a, sizeof(a)); + blockread(f, bigsize, 2); + setvisualpage(3); + setactivepage(3); + for (sort = 0; sort <= 1; sort ++) { + ; + mark(q); + getmem(p, bigsize); + blockread(f, p, bigsize); + putimage(0, 0, p, 0); + release(q); + n = 1; + { + adxtype &with = a; + for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ + for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ + ; + getmem(pic[n][sort], a.size); /* grab the memory */ + getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, + (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, + pic[n][sort]); /* grab the pic */ + putimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, + pic[n][sort], notput); /* test the pic */ + n += 1; + } + } + } + close(f); + setactivepage(0); + setvisualpage(0); + x = 0; + y = 0; + quick = true; + visible = false; + getmem(behind, a.size); + homing = false; + ix = 0; + iy = 0; + return this; } -void triptype::getback() -{; - tax=x; tay=y; - getimage(x,y,x+a.xl,y+a.yl,behind); +void triptype::original() { + ; + quick = false; } -void triptype::andexor() -{ - byte picnum; /* Picnum, Picnic, what ye heck */ -; - picnum=face*a.seq+step+1; - putimage(x,y,pic[picnum][0],andput); - putimage(x,y,pic[picnum][1],xorput); +void triptype::getback() { + ; + tax = x; + tay = y; + getimage(x, y, x + a.xl, y + a.yl, behind); } -void triptype::turn(byte whichway) -{; - face=whichway; step=0; +void triptype::andexor() { + byte picnum; /* Picnum, Picnic, what ye heck */ + ; + picnum = face * a.seq + step + 1; + putimage(x, y, pic[picnum][0], andput); + putimage(x, y, pic[picnum][1], xorput); } -void triptype::appear(integer wx,integer wy, byte wf) -{; - x=wx; y=wy; ox=wx; oy=wy; turn(wf); visible=true; +void triptype::turn(byte whichway) { + ; + face = whichway; + step = 0; } -void triptype::walk() -{; - ox=x; oy=y; - if (homing) homestep(); - x=x+ix; y=y+iy; - step += 1; if (step==a.seq) step=0; getback(); +void triptype::appear(integer wx, integer wy, byte wf) { + ; + x = wx; + y = wy; + ox = wx; + oy = wy; + turn(wf); + visible = true; } -void triptype::do_it() -{; - copier(ox,oy,ox+a.xl,oy+a.yl,x,y,x+a.xl,y+a.yl); +void triptype::walk() { + ; + ox = x; + oy = y; + if (homing) homestep(); + x = x + ix; + y = y + iy; + step += 1; + if (step == a.seq) step = 0; + getback(); } -void triptype::putback() -{; - putimage(tax,tay,behind,0); +void triptype::do_it() { + ; + copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); } -void triptype::walkto(integer xx,integer yy) -{; - speed(xx-x,yy-y); hx=xx; hy=yy; homing=true; +void triptype::putback() { + ; + putimage(tax, tay, behind, 0); } -void triptype::stophoming() -{; - homing=false; +void triptype::walkto(integer xx, integer yy) { + ; + speed(xx - x, yy - y); + hx = xx; + hy = yy; + homing = true; } -void triptype::homestep() -{ - integer temp; -; - if ((hx==x) && (hy==y)) - {; /* touching the target */ - homing=false; return; - } - ix=0; iy=0; - if (hy!=y) - {; - temp=hy-y; if (temp>4) iy=4; else if (temp<-4) iy=-4; else iy=temp; - } - if (hx!=x) - {; - temp=hx-x; if (temp>4) ix=4; else if (temp<-4) ix=-4; else ix=temp; - } +void triptype::stophoming() { + ; + homing = false; } -void triptype::speed(shortint xx,shortint yy) -{; - ix=xx; iy=yy; - if ((ix==0) && (iy==0)) return; /* no movement */ - if (ix==0) - {; /* No horz movement */ - if (iy<0) turn(up); else turn(down); - } else - {; - if (ix<0) turn(left); else turn(right); - } +void triptype::homestep() { + integer temp; + ; + if ((hx == x) && (hy == y)) { + ; /* touching the target */ + homing = false; + return; + } + ix = 0; + iy = 0; + if (hy != y) { + ; + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; + } + if (hx != x) { + ; + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } } -void triptype::halt() -{; - ix=0; iy=0; homing=false; +void triptype::speed(shortint xx, shortint yy) { + ; + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + ; /* No horz movement */ + if (iy < 0) turn(up); + else turn(down); + } else { + ; + if (ix < 0) turn(left); + else turn(right); + } } -void trip() -{ - byte fv; -; - for( fv=1; fv <= numtr; fv ++) - { - triptype& with = tr[fv]; - ; - walk(); - if (with.quick && with.visible) andexor(); - do_it(); - putback(); - } +void triptype::halt() { + ; + ix = 0; + iy = 0; + homing = false; +} + +void trip() { + byte fv; + ; + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + ; + walk(); + if (with.quick && with.visible) andexor(); + do_it(); + putback(); + } } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - setup(); - { - triptype& with = tr[1]; - ; - init(1); - appear(600,100,left); - do { - /* - speed(-5,0); repeat trip until keypressed or (x= 0); - speed( 5,0); repeat trip until keypressed or (x=600); - */ - walkto( 10, 10); do { trip(); } while (!(keypressed() || ! with.homing)); - walkto( 70,150); do { trip(); } while (!(keypressed() || ! with.homing)); - walkto(600, 77); do { trip(); } while (!(keypressed() || ! with.homing)); - } while (!keypressed()); - } -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + setup(); + { + triptype &with = tr[1]; + ; + init(1); + appear(600, 100, left); + do { + /* + speed(-5,0); repeat trip until keypressed or (x= 0); + speed( 5,0); repeat trip until keypressed or (x=600); + */ + walkto(10, 10); + do { + trip(); + } while (!(keypressed() || ! with.homing)); + walkto(70, 150); + do { + trip(); + } while (!(keypressed() || ! with.homing)); + walkto(600, 77); + do { + trip(); + } while (!(keypressed() || ! with.homing)); + } while (!keypressed()); + } + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index 536ebcdcccef..1a10794940d1 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -31,110 +31,141 @@ namespace Avalanche { -integer gd,gm; -word s; pointer p; +integer gd, gm; +word s; +pointer p; file f; byte bit; -void load() /* Load2, actually */ -{ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ - byte bit; - untyped_file f; varying_string<2> xx; - boolean was_virtual; - - assign(f,"v:ttmenu.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - bit=getpixel(0,0); +void load() { /* Load2, actually */ + byte a0; /*absolute $A000:800;*/ + byte a1; /*absolute $A000:17184;*/ + byte bit; + untyped_file f; + varying_string<2> xx; + boolean was_virtual; + + assign(f, "v:ttmenu.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -void finder() -{ - char r; integer x,y; -; - setfillstyle(0,0); setcolor(14); - x=320; y=100; setwritemode(xorput); - do { - bar(0,0,200,10); - outtextxy(0,0,strf(x)+','+strf(y)); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - do {; } while (!keypressed()); - line(x-20,y,x+20,y); line(x,y-20,x,y+20); - switch (readkey()) { - case '\15': return; break; - case '8': y -= 10; break; - case '4': x -= 10; break; - case '6': x += 10; break; - case '2': y += 10; break; - case '\0': switch (readkey()) { - case cup: y -= 1; break; - case cdown: y += 1; break; - case cleft: x -= 1; break; - case cright: x += 1; break; - } - break; - } - } while (!false); +void finder() { + char r; + integer x, y; + ; + setfillstyle(0, 0); + setcolor(14); + x = 320; + y = 100; + setwritemode(xorput); + do { + bar(0, 0, 200, 10); + outtextxy(0, 0, strf(x) + ',' + strf(y)); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + do { + ; + } while (!keypressed()); + line(x - 20, y, x + 20, y); + line(x, y - 20, x, y + 20); + switch (readkey()) { + case '\15': + return; + break; + case '8': + y -= 10; + break; + case '4': + x -= 10; + break; + case '6': + x += 10; + break; + case '2': + y += 10; + break; + case '\0': + switch (readkey()) { + case cup: + y -= 1; + break; + case cdown: + y += 1; + break; + case cleft: + x -= 1; + break; + case cright: + x += 1; + break; + } + break; + } + } while (!false); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gd=3; gm=1; initgraph(gd,gm,""); - load(); - finder(); - s=imagesize(342,21,407,119); - getmem(p,s); - getimage(342,21,407,119,p); - putimage(342,21,p,4); - input >> NL; - putimage(264,120,p,0); - input >> NL; - freemem(p,s); - - s=imagesize(264,12,329,217); - getmem(p,s); - getimage(264,21,329,218,p); - putimage(264,21,p,4); - putimage(0,0,p,0); - freemem(p,s); - input >> NL; - - s=imagesize(180,103,188,135); - getmem(p,s); - getimage(180,103,188,135,p); - putimage(0,200,p,0); - input >> NL; - - assign(f,"v:menu.avd"); - rewrite(f); - - for( bit=0; bit <= 3; bit ++) - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( gd=0; gd <= 196; gd ++) - for( gm=0; gm <= 8; gm ++) - { - f << mem[0xa000*gd*80+gm]; - mem[0xa000*gd*80+gm]=~ mem[0xa000*gd*80+gm]; - } - - for( gd=200; gd <= 232; gd ++) - { - f << mem[0xa000*gd*80]; - mem[0xa000*gd*80]=~ mem[0xa000*gd*80]; - } - } - - close(f); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gd = 3; + gm = 1; + initgraph(gd, gm, ""); + load(); + finder(); + s = imagesize(342, 21, 407, 119); + getmem(p, s); + getimage(342, 21, 407, 119, p); + putimage(342, 21, p, 4); + input >> NL; + putimage(264, 120, p, 0); + input >> NL; + freemem(p, s); + + s = imagesize(264, 12, 329, 217); + getmem(p, s); + getimage(264, 21, 329, 218, p); + putimage(264, 21, p, 4); + putimage(0, 0, p, 0); + freemem(p, s); + input >> NL; + + s = imagesize(180, 103, 188, 135); + getmem(p, s); + getimage(180, 103, 188, 135, p); + putimage(0, 200, p, 0); + input >> NL; + + assign(f, "v:menu.avd"); + rewrite(f); + + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (gd = 0; gd <= 196; gd ++) + for (gm = 0; gm <= 8; gm ++) { + f << mem[0xa000 * gd * 80 + gm]; + mem[0xa000 * gd * 80 + gm] = ~ mem[0xa000 * gd * 80 + gm]; + } + + for (gd = 200; gd <= 232; gd ++) { + f << mem[0xa000 * gd * 80]; + mem[0xa000 * gd * 80] = ~ mem[0xa000 * gd * 80]; + } + } + + close(f); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index e0ede8e35dde..63d2562f8bcd 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,53 +30,62 @@ namespace Avalanche { -typedef array<1,50000,byte> buffertype; +typedef array<1, 50000, byte> buffertype; -integer gd,gm; +integer gd, gm; varying_string<29> describe; byte method; shortint bit; word offset; byte a0; /*absolute $A000:800;*/ -array<1,12080,byte> a7; /*absolute $A000:800;*/ -buffertype* buffer; +array<1, 12080, byte> a7; /*absolute $A000:800;*/ +buffertype *buffer; word bufsize; -void putup(byte what) -{; - if (offset>12080) - {; - bit += 1; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - offset=1; - } - - a7[offset]=what; - offset += 1; +void putup(byte what) { + ; + if (offset > 12080) { + ; + bit += 1; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + offset = 1; + } + + a7[offset] = what; + offset += 1; } void load_uncomp(string xx) /* Load2, actually */ /* a1:byte absolute $A000:17184;*/ { - byte this_; - untyped_file f; - word place; -; - assign(f,string("v:place")+xx+".avd"); reset(f,1); seek(f,146); - blockread(f,describe,30); blockread(f,method,1); - bufsize=filesize(f)-177; blockread(f,*buffer,bufsize); - close(f); - - bit=-1; offset=12081; place=1; - - while (place<=bufsize) - {; - this_=(*buffer)[place]; - place += 1; - putup(this_); - } - - output << method << " : \"" << describe << '"' << NL; + byte this_; + untyped_file f; + word place; + ; + assign(f, string("v:place") + xx + ".avd"); + reset(f, 1); + seek(f, 146); + blockread(f, describe, 30); + blockread(f, method, 1); + bufsize = filesize(f) - 177; + blockread(f, *buffer, bufsize); + close(f); + + bit = -1; + offset = 12081; + place = 1; + + while (place <= bufsize) { + ; + this_ = (*buffer)[place]; + place += 1; + putup(this_); + } + + output << method << " : \"" << describe << '"' << NL; } void load_comp(string xx); @@ -92,33 +101,33 @@ const integer maxstack = 4096 /* Decompression stack size */; - /* One node in parsing table. */ +/* One node in parsing table. */ struct string_table_entry { - boolean unused /* Is this node *NOT* used yet?*/; - integer prevchar /* Code for preceding string */; - integer follchar /* Code for current character */; - integer next /* Next dupl in collision list */; + boolean unused /* Is this node *NOT* used yet?*/; + integer prevchar /* Code for preceding string */; + integer follchar /* Code for current character */; + integer next /* Next dupl in collision list */; }; -typedef array<0,maxtab,string_table_entry> sttype; +typedef array<0, maxtab, string_table_entry> sttype; - /* String table */ +/* String table */ -static sttype* string_table; +static sttype *string_table; static integer table_used /* # string table entries used */; static byte input_code /* Input compressed code */; -static boolean inempty,popempty; +static boolean inempty, popempty; - /* Decompression stack */ +/* Decompression stack */ -static array<1,maxstack,byte> stack; +static array<1, maxstack, byte> stack; static integer stack_pointer /* Decompression stack depth */; @@ -126,92 +135,92 @@ static integer stack_pointer /* Decompression stack depth */; static word place; -static integer get_hash_code( integer& prevc, integer& follc ) +static integer get_hash_code(integer &prevc, integer &follc) { - integer index; - integer index2; + integer index; + integer index2; - /* Get_Hash_Code */ - /* Get initial index using hashing */ + /* Get_Hash_Code */ + /* Get initial index using hashing */ - integer get_hash_code_result; - index = ( ( prevc << 5 ) ^ follc ) & maxtab; + integer get_hash_code_result; + index = ((prevc << 5) ^ follc) & maxtab; - /* If entry not already used, return */ - /* its index as hash code for C. */ + /* If entry not already used, return */ + /* its index as hash code for C. */ - if ( (*string_table)[index].unused ) - get_hash_code_result = index; - else - /* If entry already used, search to */ - /* end of list of hash collision */ - /* entries for this hash code. */ - /* Do linear probe to find an */ - /* available slot. */ - { + if ((*string_table)[index].unused) + get_hash_code_result = index; + else + /* If entry already used, search to */ + /* end of list of hash collision */ + /* entries for this hash code. */ + /* Do linear probe to find an */ + /* available slot. */ + { - /* Skip to end of collision list ... */ + /* Skip to end of collision list ... */ - while ( (*string_table)[index].next != end_list ) - index = (*string_table)[index].next; + while ((*string_table)[index].next != end_list) + index = (*string_table)[index].next; - /* Begin linear probe down a bit from */ - /* last entry in collision list ... */ + /* Begin linear probe down a bit from */ + /* last entry in collision list ... */ - index2 = ( index + 101 ) & maxtab; + index2 = (index + 101) & maxtab; - /* Look for unused entry using linear */ - /* probing ... */ + /* Look for unused entry using linear */ + /* probing ... */ - while ( ! (*string_table)[index2].unused ) - index2 = succ(integer, index2 ) & maxtab; + while (!(*string_table)[index2].unused) + index2 = succ(integer, index2) & maxtab; - /* Point prior end of collision list */ - /* to this new node. */ + /* Point prior end of collision list */ + /* to this new node. */ - (*string_table)[index].next = index2; + (*string_table)[index].next = index2; - /* Return hash code for C */ + /* Return hash code for C */ - get_hash_code_result = index2; + get_hash_code_result = index2; - } + } - return get_hash_code_result; + return get_hash_code_result; } /* Get_Hash_Code */ - /*--------------------------------------------------------------------------*/ - /* Make_Table_Entry --- Enter C string in string table */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Make_Table_Entry --- Enter C string in string table */ +/*--------------------------------------------------------------------------*/ -static void make_table_entry( integer& prevc, integer& follc ) +static void make_table_entry(integer &prevc, integer &follc) -{ /* Make_Table_Entry */ - /* Only enter string if there is room left */ - - if ( table_used <= maxtab ) - { - { - string_table_entry& with = (*string_table)[ get_hash_code( prevc , follc ) ]; - - with.unused = false; - with.next = end_list; - with.prevchar = prevc; - with.follchar = follc; - } - /* Increment count of items used */ - - table_used += 1; -/* - IF ( Table_Used > ( MaxTab + 1 ) ) THEN - BEGIN - WRITELN('Hash table full.'); - END; - */ - } +{ + /* Make_Table_Entry */ + /* Only enter string if there is room left */ + + if (table_used <= maxtab) { + { + string_table_entry &with = (*string_table)[ get_hash_code(prevc , follc) ]; + + with.unused = false; + with.next = end_list; + with.prevchar = prevc; + with.follchar = follc; + } + /* Increment count of items used */ + + table_used += 1; + /* + IF ( Table_Used > ( MaxTab + 1 ) ) THEN + BEGIN + WRITELN('Hash table full.'); + END; + */ + } } /* Make_Table_Entry */ @@ -221,330 +230,332 @@ static void firstentries() /* This is just a fast version of the above, when PrevC = No_Prev. TT. */ { - integer i,j; + integer i, j; - /* There MUST be room- we've only just started! */ + /* There MUST be room- we've only just started! */ - j=no_prev; + j = no_prev; - for( i=0; i <= 255; i ++) - { - string_table_entry& with = (*string_table)[ ((no_prev << 5 ) ^ i) & maxtab]; + for (i = 0; i <= 255; i ++) { + string_table_entry &with = (*string_table)[((no_prev << 5) ^ i) & maxtab]; - with.unused = false; - with.next = end_list; - with.prevchar = no_prev; - with.follchar = i; - } + with.unused = false; + with.next = end_list; + with.prevchar = no_prev; + with.follchar = i; + } - table_used += 256; /* Increment count of items used */ + table_used += 256; /* Increment count of items used */ } - /*--------------------------------------------------------------------------*/ - /* Initialize_String_Table --- Initialize string table */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Initialize_String_Table --- Initialize string table */ +/*--------------------------------------------------------------------------*/ static void initialize_string_table() { - integer i; + integer i; - /* Initialize_String_Table */ + /* Initialize_String_Table */ - /* No entries used in table yet */ - table_used = 0; + /* No entries used in table yet */ + table_used = 0; - fillchar(*string_table,(maxtab+1)*sizeof((*string_table)[1]),'\377'); - /* Enter all single characters into */ - /* table */ - firstentries(); + fillchar(*string_table, (maxtab + 1)*sizeof((*string_table)[1]), '\377'); + /* Enter all single characters into */ + /* table */ + firstentries(); } /* Initialize_String_Table */ - /*--------------------------------------------------------------------------*/ - /* Lookup_String --- Look for string C in string table */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Lookup_String --- Look for string C in string table */ +/*--------------------------------------------------------------------------*/ -static integer lookup_string( integer prevc, integer follc ) +static integer lookup_string(integer prevc, integer follc) { - integer index; - integer index2; - boolean found; + integer index; + integer index2; + boolean found; - /* Lookup_String */ - /* Initialize index to check from hash */ + /* Lookup_String */ + /* Initialize index to check from hash */ - integer lookup_string_result; - index = ( ( prevc << 5 ) ^ follc ) & maxtab; + integer lookup_string_result; + index = ((prevc << 5) ^ follc) & maxtab; - /* Assume we won't find string */ - lookup_string_result = end_list; - /* Search through list of hash collision */ - /* entries for one that matches C */ - do { + /* Assume we won't find string */ + lookup_string_result = end_list; + /* Search through list of hash collision */ + /* entries for one that matches C */ + do { - found = ( (*string_table)[index].prevchar == prevc ) && - ( (*string_table)[index].follchar == follc ); + found = ((*string_table)[index].prevchar == prevc) && + ((*string_table)[index].follchar == follc); - if ( ! found ) - index = (*string_table)[index].next; + if (! found) + index = (*string_table)[index].next; - } while (!(found || ( index == end_list ))); + } while (!(found || (index == end_list))); - /* Return index if C found in table. */ - if (found) - lookup_string_result = index; + /* Return index if C found in table. */ + if (found) + lookup_string_result = index; - return lookup_string_result; + return lookup_string_result; } /* Lookup_String */ - /*--------------------------------------------------------------------------*/ - /* Push --- Push character onto stack */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Push --- Push character onto stack */ +/*--------------------------------------------------------------------------*/ -static void push( byte c) +static void push(byte c) -{ /* Push */ +{ + /* Push */ - stack_pointer += 1; - stack[ stack_pointer ] = c; + stack_pointer += 1; + stack[ stack_pointer ] = c; - if ( stack_pointer >= maxstack ) - { - output << "Stack overflow!" << NL; - exit(0); - } + if (stack_pointer >= maxstack) { + output << "Stack overflow!" << NL; + exit(0); + } } /* Push */ - /*--------------------------------------------------------------------------*/ - /* Pop --- Pop character from stack */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Pop --- Pop character from stack */ +/*--------------------------------------------------------------------------*/ -static void pop( integer& c ) +static void pop(integer &c) -{ /* Pop */ +{ + /* Pop */ - popempty=stack_pointer==0; + popempty = stack_pointer == 0; - if (! popempty) - { - c = stack[stack_pointer]; - stack_pointer -= 1; - } + if (! popempty) { + c = stack[stack_pointer]; + stack_pointer -= 1; + } } /* Pop */ - /*--------------------------------------------------------------------------*/ - /* Get_Code --- Get compression code from input file */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Get_Code --- Get compression code from input file */ +/*--------------------------------------------------------------------------*/ -static void get_code( integer& hash_code ) +static void get_code(integer &hash_code) { - byte local_buf; + byte local_buf; - /* Get_Code */ + /* Get_Code */ - if (inempty) - { + if (inempty) { - if (place>bufsize) return; else - {; - local_buf=(*buffer)[place]; - place += 1; - } + if (place > bufsize) return; + else { + ; + local_buf = (*buffer)[place]; + place += 1; + } - if (place>bufsize) return; else - {; - input_code=(*buffer)[place]; - place += 1; - } + if (place > bufsize) return; + else { + ; + input_code = (*buffer)[place]; + place += 1; + } - hash_code = ( ( local_buf << 4 ) & 0xff0 ) + - ( ( (cardinal)input_code >> 4 ) & 0xf ); + hash_code = ((local_buf << 4) & 0xff0) + + (((cardinal)input_code >> 4) & 0xf); - input_code = input_code & 0xf; - inempty=false; + input_code = input_code & 0xf; + inempty = false; - } - else - { + } else { - if (place>bufsize) return; else - {; - local_buf=(*buffer)[place]; - place += 1; - } + if (place > bufsize) return; + else { + ; + local_buf = (*buffer)[place]; + place += 1; + } - hash_code = local_buf + ( ( input_code << 8 ) & 0xf00 ); - inempty=true; + hash_code = local_buf + ((input_code << 8) & 0xf00); + inempty = true; - } + } } /* Get_Code */ - /*--------------------------------------------------------------------------*/ - /* Do_Decompression --- Perform decompression */ - /*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Do_Decompression --- Perform decompression */ +/*--------------------------------------------------------------------------*/ static void do_decompression() { - integer c /* Current input character */; - integer code /* Current code string */; - integer old_code /* Previous code string */; - integer fin_char /* Final input character */; - integer in_code /* Current input code */; - integer last_char /* Previous character */; - boolean unknown /* TRUE if code not found */; - integer temp_c /* Char popped off stack */; - - /* Do_Decompression */ - - stack_pointer = 0; /* Decompression stack is empty */ - unknown = false; /* First string is always known */ - get_code( old_code ); /* Get first string == Step 1 */ - code = old_code; - - c=(*string_table)[code].follchar; /* Output corresponding character */ - putup( c ); - fin_char = c; /* Remember this character -- it */ - /* is final character of next string */ - - get_code( in_code ); /* Get next code == Step 2 */ - - while (place<=bufsize) - { - code = in_code; /* Set code to this input code */ - - /* If code not in table, do special */ - /* case ==> Step 3 */ - - if ( (*string_table)[code].unused ) - { - last_char = fin_char; - code = old_code; - unknown = true; - } - /* Run through code extracting single */ - /* characters from code string until */ - /* no more characters can be removed. */ - /* Push these onto stack. They will */ - /* be entered in reverse order, and */ - /* will come out in forwards order */ - /* when popped off. */ - /* */ - /* ==> Step 4 */ - - while( (*string_table)[code].prevchar != no_prev ) - { - string_table_entry& with = (*string_table)[code]; - - push( with.follchar ); - code = with.prevchar; - } - /* We now have the first character in */ - /* the string. */ - - fin_char = (*string_table)[code].follchar; - - /* Output first character ==> Step 5 */ - putup( fin_char ); - /* While the stack is not empty, remove */ - /* and output all characters from stack */ - /* which are rest of characters in the */ - /* string. */ - /* */ - /* ==> Step 6 */ - pop( temp_c ); - - while (! popempty) - { - putup( temp_c ); - pop( temp_c ); - } - /* If code isn't known, output the */ - /* follower character of last character */ - /* of string. */ - if (unknown) - { - fin_char = last_char; - putup( fin_char ); - unknown = false; - } - /* Enter code into table ==> Step 7 */ - - make_table_entry( old_code , fin_char ); - - /* Make current code the previous code */ - old_code = in_code; - - /* Get next code == Step 2 */ - get_code( in_code ); - - } + integer c /* Current input character */; + integer code /* Current code string */; + integer old_code /* Previous code string */; + integer fin_char /* Final input character */; + integer in_code /* Current input code */; + integer last_char /* Previous character */; + boolean unknown /* TRUE if code not found */; + integer temp_c /* Char popped off stack */; + + /* Do_Decompression */ + + stack_pointer = 0; /* Decompression stack is empty */ + unknown = false; /* First string is always known */ + get_code(old_code); /* Get first string == Step 1 */ + code = old_code; + + c = (*string_table)[code].follchar; /* Output corresponding character */ + putup(c); + fin_char = c; /* Remember this character -- it */ + /* is final character of next string */ + + get_code(in_code); /* Get next code == Step 2 */ + + while (place <= bufsize) { + code = in_code; /* Set code to this input code */ + + /* If code not in table, do special */ + /* case ==> Step 3 */ + + if ((*string_table)[code].unused) { + last_char = fin_char; + code = old_code; + unknown = true; + } + /* Run through code extracting single */ + /* characters from code string until */ + /* no more characters can be removed. */ + /* Push these onto stack. They will */ + /* be entered in reverse order, and */ + /* will come out in forwards order */ + /* when popped off. */ + /* */ + /* ==> Step 4 */ + + while ((*string_table)[code].prevchar != no_prev) { + string_table_entry &with = (*string_table)[code]; + + push(with.follchar); + code = with.prevchar; + } + /* We now have the first character in */ + /* the string. */ + + fin_char = (*string_table)[code].follchar; + + /* Output first character ==> Step 5 */ + putup(fin_char); + /* While the stack is not empty, remove */ + /* and output all characters from stack */ + /* which are rest of characters in the */ + /* string. */ + /* */ + /* ==> Step 6 */ + pop(temp_c); + + while (! popempty) { + putup(temp_c); + pop(temp_c); + } + /* If code isn't known, output the */ + /* follower character of last character */ + /* of string. */ + if (unknown) { + fin_char = last_char; + putup(fin_char); + unknown = false; + } + /* Enter code into table ==> Step 7 */ + + make_table_entry(old_code , fin_char); + + /* Make current code the previous code */ + old_code = in_code; + + /* Get next code == Step 2 */ + get_code(in_code); + + } } /* Do_Decompression */ -void load_comp(string xx){ +void load_comp(string xx) { - /* This loads in the compressed file. */ + /* This loads in the compressed file. */ -const integer maxbuff = 8192 /* Buffer size for input and output files */; + const integer maxbuff = 8192 /* Buffer size for input and output files */; -integer output_code /* Output compressed code */; -boolean if_compressing /* TRUE if compressing file */; + integer output_code /* Output compressed code */; + boolean if_compressing /* TRUE if compressing file */; -byte this_; -untyped_file f; + byte this_; + untyped_file f; -; -string_table = new sttype; -inempty=true; -initialize_string_table(); + ; + string_table = new sttype; + inempty = true; + initialize_string_table(); -assign(f,string("v:compr")+xx+".avd"); reset(f,1); seek(f,146); -blockread(f,describe,30); blockread(f,method,1); -bufsize=filesize(f)-177; blockread(f,*buffer,bufsize); -close(f); + assign(f, string("v:compr") + xx + ".avd"); + reset(f, 1); + seek(f, 146); + blockread(f, describe, 30); + blockread(f, method, 1); + bufsize = filesize(f) - 177; + blockread(f, *buffer, bufsize); + close(f); -bit=-1; offset=12081; place=1; + bit = -1; + offset = 12081; + place = 1; -do_decompression(); + do_decompression(); -output << method << " : \"" << describe << '"' << NL; + output << method << " : \"" << describe << '"' << NL; -delete string_table; - } + delete string_table; +} -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; -gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); -buffer = new buffertype; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + buffer = new buffertype; #ifdef uncomp -load_uncomp("21"); + load_uncomp("21"); #else -load_comp("21"); + load_comp("21"); #endif -delete buffer; -return EXIT_SUCCESS; + delete buffer; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index 58dc7b6e3582..b205474879d9 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,519 +32,561 @@ namespace Avalanche { -typedef array<0,49999,byte> bigtextarray; +typedef array<0, 49999, byte> bigtextarray; struct chaptertype { - varying_string<60> headername; - word headeroffset; + varying_string<60> headername; + word headeroffset; }; -typedef array<1,1120,byte> sbtype; +typedef array<1, 1120, byte> sbtype; const integer contsize = 29; /*number of headers in AVALOT.DOC*/ const varying_string<80> contentsheader = " -=- The contents of the Lord AVALOT D'Argent (version 1.3) documentation -=-"; -const array<0,15,byte> listpal = {{1,0,3,0,7,0,7,7,0,0,0,0,0,0,0,0}}; -const array<0,15,byte> blankpal = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}}; +const array<0, 15, byte> listpal = {{1, 0, 3, 0, 7, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0}}; +const array<0, 15, byte> blankpal = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; const integer tabstop = 8; /*length of tab stops*/ /*NOTE: Tabs are not properly implemented. The program just interprets them*/ /*as a number of spaces.*/ -matrix<1,256, 0,15,byte> textvar,textvar8; -array<0,1500,word> posof13; -array<1,65535,byte> scvar; /*absolute $A000:$0000;*/ -sbtype stbar,stbar2; +matrix<1, 256, 0, 15, byte> textvar, textvar8; +array<0, 1500, word> posof13; +array<1, 65535, byte> scvar; /*absolute $A000:$0000;*/ +sbtype stbar, stbar2; pointer dpt; -word sot,nol,bat,bab,tlab,nosl,bfseg,bfofs,useless; -bigtextarray* textmem; -boolean atsof,fast,regimode; +word sot, nol, bat, bab, tlab, nosl, bfseg, bfofs, useless; +bigtextarray *textmem; +boolean atsof, fast, regimode; byte hol; varying_string<80> stline; -array<1,contsize,chaptertype> contlist; +array<1, contsize, chaptertype> contlist; integer lat; -void wipeit(longint pos, word count) /*Like fillchar, but wraps*/ -{ - longint wpos; +void wipeit(longint pos, word count) { /*Like fillchar, but wraps*/ + longint wpos; - wpos=(word)(pos); - fillchar(mem[longint(0xa000)+wpos / longint(16)*wpos % longint(16)],count,0); + wpos = (word)(pos); + fillchar(mem[longint(0xa000) + wpos / longint(16)*wpos % longint(16)], count, 0); } -void wrapcopy(sbtype fromarr, longint pos) /*Like fillchar, but wraps*/ -{ - longint wpos; +void wrapcopy(sbtype fromarr, longint pos) { /*Like fillchar, but wraps*/ + longint wpos; - wpos=(word)(pos); - move(fromarr,mem[longint(0xa000)+wpos / longint(16)*wpos % longint(16)],1120); + wpos = (word)(pos); + move(fromarr, mem[longint(0xa000) + wpos / longint(16)*wpos % longint(16)], 1120); } -void blankscreen() /*blanks the screen (!)*/ -{ - registers r; +void blankscreen() { /*blanks the screen (!)*/ + registers r; - r.ax=0x1002; - r.es=seg(blankpal); - r.dx=ofs(blankpal); - intr(0x10,r); + r.ax = 0x1002; + r.es = seg(blankpal); + r.dx = ofs(blankpal); + intr(0x10, r); } -void showscreen() /*shows the screen (!)*/ -{ - registers r; +void showscreen() { /*shows the screen (!)*/ + registers r; - r.ax=0x1002; - r.es=seg(listpal); - r.dx=ofs(listpal); - intr(0x10,r); + r.ax = 0x1002; + r.es = seg(listpal); + r.dx = ofs(listpal); + intr(0x10, r); } -void wipesb(word wheretop) -{ - byte plane; - - for( plane=2; plane <= 3; plane ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; - fillchar(scvar[(wheretop+336)*80+1],1120,0); - } - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +void wipesb(word wheretop) { + byte plane; + + for (plane = 2; plane <= 3; plane ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << plane; + port[0x3cf] = plane; + fillchar(scvar[(wheretop + 336) * 80 + 1], 1120, 0); + } + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 2; + port[0x3cf] = 1; } -void displstat(byte wipepos) /*displays the status bar*/ -{ - byte plane; - - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=4; port[0x3cf]=2; - wrapcopy(stbar,(lat+336)*80); - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=8; port[0x3cf]=3; - wrapcopy(stbar2,(lat+336)*80); - for( plane=2; plane <= 3; plane ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; - switch (wipepos) { - case 0: wipeit((lat+335)*80-1,80); break; - case 1: wipeit(lat*80-1,80); break; - } - } - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +void displstat(byte wipepos) { /*displays the status bar*/ + byte plane; + + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 4; + port[0x3cf] = 2; + wrapcopy(stbar, (lat + 336) * 80); + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 8; + port[0x3cf] = 3; + wrapcopy(stbar2, (lat + 336) * 80); + for (plane = 2; plane <= 3; plane ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << plane; + port[0x3cf] = plane; + switch (wipepos) { + case 0: + wipeit((lat + 335) * 80 - 1, 80); + break; + case 1: + wipeit(lat * 80 - 1, 80); + break; + } + } + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 2; + port[0x3cf] = 1; } -void udstat() /*updates the status bar*/ -{ - varying_string<3> pt; - byte fv,fv2; - - fillchar(pt,4,'\0'); - str(round((real)((tlab-21))/(nol-21)*100),pt); - for( fv=1; fv <= 3; fv ++) - for( fv2=0; fv2 <= 13; fv2 ++) - {; - stbar[fv2*80+fv+68]=~ textvar[ord(pt[fv])+1][fv2]; - stbar2[fv2*80+fv+68]=textvar[ord(pt[fv])+1][fv2]; - } +void udstat() { /*updates the status bar*/ + varying_string<3> pt; + byte fv, fv2; + + fillchar(pt, 4, '\0'); + str(round((real)((tlab - 21)) / (nol - 21) * 100), pt); + for (fv = 1; fv <= 3; fv ++) + for (fv2 = 0; fv2 <= 13; fv2 ++) { + ; + stbar[fv2 * 80 + fv + 68] = ~ textvar[ord(pt[fv]) + 1][fv2]; + stbar2[fv2 * 80 + fv + 68] = textvar[ord(pt[fv]) + 1][fv2]; + } } void finddocinfo() /*finds the line breaks in AVALOT.DOC & finds the headers by searching for '"""'*/ { - word wv,oldwv,varpos,varpos2,contlpos; - boolean thisaheader; - varying_string<60> headerstring; - - thisaheader=false; - posof13[0]=65535; /*this +2 will wrap around to 1*/ - wv=1; - oldwv=1; - varpos=1; - contlist[1].headername="Start of documentation"; - contlist[1].headeroffset=0; - contlpos=2; - while (wv12) - && (thisaheader==false)) - { - thisaheader=true; - headerstring[0]='\0'; - varpos2=posof13[varpos-2]+2; - while (((*textmem)[varpos2]==32) || ((*textmem)[varpos2]==9)) varpos2 += 1; - while (varpos2!=posof13[varpos-1]) - {; - headerstring=headerstring+chr((*textmem)[varpos2]); - varpos2 += 1; - } - contlist[contlpos].headername=headerstring; - contlist[contlpos].headeroffset=varpos-2; - contlpos += 1; - } - break; - } - wv += 1; - } - nol=varpos-2; - nosl=nol*14; + word wv, oldwv, varpos, varpos2, contlpos; + boolean thisaheader; + varying_string<60> headerstring; + + thisaheader = false; + posof13[0] = 65535; /*this +2 will wrap around to 1*/ + wv = 1; + oldwv = 1; + varpos = 1; + contlist[1].headername = "Start of documentation"; + contlist[1].headeroffset = 0; + contlpos = 2; + while (wv < sot) { + while (((*textmem)[wv] != 13) && ((*textmem)[wv] != 34) && (wv - oldwv < 80)) wv += 1; + switch ((*textmem)[wv]) { + case 13: { + posof13[varpos] = wv; + varpos += 1; + oldwv = wv + 1; + thisaheader = false; + } + break; + case 34: + if (((*textmem)[wv - 1] == 34) && ((*textmem)[wv - 2] == 34) && (varpos > 12) + && (thisaheader == false)) { + thisaheader = true; + headerstring[0] = '\0'; + varpos2 = posof13[varpos - 2] + 2; + while (((*textmem)[varpos2] == 32) || ((*textmem)[varpos2] == 9)) varpos2 += 1; + while (varpos2 != posof13[varpos - 1]) { + ; + headerstring = headerstring + chr((*textmem)[varpos2]); + varpos2 += 1; + } + contlist[contlpos].headername = headerstring; + contlist[contlpos].headeroffset = varpos - 2; + contlpos += 1; + } + break; + } + wv += 1; + } + nol = varpos - 2; + nosl = nol * 14; } -void graphmode(byte gm) /*puts the display adaptor into a specified mode*/ -{ - registers regs; +void graphmode(byte gm) { /*puts the display adaptor into a specified mode*/ + registers regs; - regs.ax=gm; - intr(0x10,regs); + regs.ax = gm; + intr(0x10, regs); } -void setoffset(word where_on_screen) {; /*assembler; {for scrolling the screen*/ -/*asm - mov bx, where_on_screen - mov dx, $03D4 - mov ah, bh - mov al, $C - out dx, ax - - mov ah, bl - inc al - out dx, ax*/ - } +void setoffset(word where_on_screen) { + ; /*assembler; {for scrolling the screen*/ + /*asm + mov bx, where_on_screen + mov dx, $03D4 + mov ah, bh + mov al, $C + out dx, ax + + mov ah, bl + inc al + out dx, ax*/ +} -void setupsb(byte sbtype) /*sets up the status bar in several styles*/ -{ - integer fv; - - switch (sbtype) { - case 1: if (regimode==false) stline=string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits. C=") - +'\32'+"contents "+'\263'+" % through "; else - stline=string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits to main menu.") - +'\263'+" % through"; - break; - case 2: stline=string("Esc=to doc lister ")+'\263'+" Press the key listed next to the section you wish to jump to"; break; - } - for( fv=0; fv <= 1118; fv ++) {; - stbar[fv+1]=~ textvar[ord(stline[fv % 80+1])+1][fv / 80]; - stbar2[fv+1]=textvar[ord(stline[fv % 80+1])+1][fv / 80]; - } +void setupsb(byte sbtype) { /*sets up the status bar in several styles*/ + integer fv; + + switch (sbtype) { + case 1: + if (regimode == false) stline = string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits. C=") + + '\32' + "contents " + '\263' + " % through "; + else + stline = string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits to main menu.") + + '\263' + " % through"; + break; + case 2: + stline = string("Esc=to doc lister ") + '\263' + " Press the key listed next to the section you wish to jump to"; + break; + } + for (fv = 0; fv <= 1118; fv ++) { + ; + stbar[fv + 1] = ~ textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; + stbar2[fv + 1] = textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; + } } -void setup() /*sets up graphics, variables, etc.*/ -{ - untyped_file f; - integer fv; - registers r; - - if ((paramstr(1)!="REGI") && (paramstr(1)!="ELMPOYTEN")) - - { - clrscr; - output << "This program cannot be run on its own. Run AVALOT.EXE." << NL; - exit(123); - } - val(paramstr(2),bfseg,useless); - val(paramstr(3),bfofs,useless); - bfofs += 1; - atsof=true; - fast=false; - assign(f,"avalot.fnt"); - reset(f,1); - blockread(f,textvar,4096); - close(f); - assign(f,"ttsmall.fnt"); - reset(f,1); - blockread(f,textvar8,4096); - close(f); - assign(f,"avalot.doc"); - reset(f,1); - sot=filesize(f); - mark(dpt); - textmem = new bigtextarray; - blockread(f,*textmem,sot); - close(f); - finddocinfo(); - if (paramstr(1)=="REGI") - {; - regimode=true; - tlab=contlist[contsize].headeroffset+24; - lat=contlist[contsize].headeroffset*14; - } - else - {; - lat=0; tlab=24; - regimode=false; - } - setupsb(1); - graphmode(16); - directvideo=false; - showscreen(); - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; +void setup() { /*sets up graphics, variables, etc.*/ + untyped_file f; + integer fv; + registers r; + + if ((paramstr(1) != "REGI") && (paramstr(1) != "ELMPOYTEN")) + + { + clrscr; + output << "This program cannot be run on its own. Run AVALOT.EXE." << NL; + exit(123); + } + val(paramstr(2), bfseg, useless); + val(paramstr(3), bfofs, useless); + bfofs += 1; + atsof = true; + fast = false; + assign(f, "avalot.fnt"); + reset(f, 1); + blockread(f, textvar, 4096); + close(f); + assign(f, "ttsmall.fnt"); + reset(f, 1); + blockread(f, textvar8, 4096); + close(f); + assign(f, "avalot.doc"); + reset(f, 1); + sot = filesize(f); + mark(dpt); + textmem = new bigtextarray; + blockread(f, *textmem, sot); + close(f); + finddocinfo(); + if (paramstr(1) == "REGI") { + ; + regimode = true; + tlab = contlist[contsize].headeroffset + 24; + lat = contlist[contsize].headeroffset * 14; + } else { + ; + lat = 0; + tlab = 24; + regimode = false; + } + setupsb(1); + graphmode(16); + directvideo = false; + showscreen(); + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 2; + port[0x3cf] = 1; } void drawscreenf(integer tl) /*draws a screen from a line forwards*/ /*N.B. tl>1*/ { - word fv,fv2,curbyte,plane; - byte xpos; - - blankscreen(); - wipesb(lat); - if (tl>nol-24) tl=nol-24; - if (tl<0) tl=0; - lat=tl*14; - for( plane=2; plane <= 3; plane ++) /*wipe sb off*/ - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; - /*fillchar(mem [$A000:((lat-1)*80) mod 65536],26800,0);*/ - wipeit(lat*80,26800); - } - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; /*back to normal*/ - if (tl>0) curbyte=posof13[tl-1]+2; else curbyte=0; - bat=curbyte; - for( fv=lat; fv <= lat+335; fv ++) - { - fv2=curbyte; - xpos=1; - while (xpos<=80) - { - if (fv21) atsof=false; - showscreen(); + word fv, fv2, curbyte, plane; + byte xpos; + + blankscreen(); + wipesb(lat); + if (tl > nol - 24) tl = nol - 24; + if (tl < 0) tl = 0; + lat = tl * 14; + for (plane = 2; plane <= 3; plane ++) { /*wipe sb off*/ + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << plane; + port[0x3cf] = plane; + /*fillchar(mem [$A000:((lat-1)*80) mod 65536],26800,0);*/ + wipeit(lat * 80, 26800); + } + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 2; + port[0x3cf] = 1; /*back to normal*/ + if (tl > 0) curbyte = posof13[tl - 1] + 2; + else curbyte = 0; + bat = curbyte; + for (fv = lat; fv <= lat + 335; fv ++) { + fv2 = curbyte; + xpos = 1; + while (xpos <= 80) { + if (fv2 < posof13[tl]) { + if ((*textmem)[fv2] == 9) { + wipeit(fv * 80 + xpos, tabstop); + xpos += tabstop; + } else { + mem[0xa000 * (word)(fv * 80 + xpos - 1)] = + textvar[(*textmem)[fv2] + 1][fv % 14]; + xpos += 1; + } + } else { + wipeit(fv * 80 + xpos - 1, 82 - xpos); + xpos = 81; + } + fv2 += 1; + } + if (fv % 14 == 0) { + tl += 1; + curbyte = posof13[tl - 1] + 2; + } + } + bab = curbyte; + tlab = tl; + udstat(); + displstat(2); + setoffset((word)(lat * 80)); + if (tl - 23 > 1) atsof = false; + showscreen(); } -void displcont() /*displays the contents*/ -{ - byte fv,fv2,fv3,keyon,jumppos,plane; - word olat; - varying_string<62> curstr; - char rkv; - - blankscreen(); - olat=lat; lat=0; keyon=1; jumppos=0; - setoffset(0); - for( plane=1; plane <= 3; plane ++) /*wipe sb off*/ - { - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << plane; port[0x3cf]=plane; - fillchar(scvar,26800,0); - } - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=2; port[0x3cf]=1; /*back to normal*/ - setupsb(2); - displstat(2); - for( fv=1; fv <= 80; fv ++) - for( fv2=0; fv2 <= 27; fv2 ++) - { - scvar[fv2*80+fv]=textvar[ord(contentsheader[fv-1])+1][fv2 / 2]; - } - for( fv=1; fv <= contsize; fv ++) - { - if (keyon<10) curstr=strf(keyon)+". "+contlist[fv].headername; else - curstr=string(chr(keyon+55))+". "+contlist[fv].headername; - for( fv2=1; fv2 <= length(curstr); fv2 ++) - for( fv3=0; fv3 <= 7; fv3 ++) - scvar[(fv+3)*640+fv3*80+fv2]=textvar8[ord(curstr[fv2])+1][fv3]; - keyon += 1; - } - showscreen(); - do {; } while (!keypressed()); - rkv=readkey(); - switch (rkv) { - case RANGE_9('\61','\71'): jumppos=ord(rkv)-48; - break; - case RANGE_26('\101','\132'): jumppos=ord(rkv)-55; - break; - case RANGE_26('\141','\172'): jumppos=ord(rkv)-87; - break; - default: lat=olat; - } - if (jumppos>0) lat=contlist[jumppos].headeroffset; - setupsb(1); - if (fast==false) wipesb(0); - drawscreenf(lat); +void displcont() { /*displays the contents*/ + byte fv, fv2, fv3, keyon, jumppos, plane; + word olat; + varying_string<62> curstr; + char rkv; + + blankscreen(); + olat = lat; + lat = 0; + keyon = 1; + jumppos = 0; + setoffset(0); + for (plane = 1; plane <= 3; plane ++) { /*wipe sb off*/ + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << plane; + port[0x3cf] = plane; + fillchar(scvar, 26800, 0); + } + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 2; + port[0x3cf] = 1; /*back to normal*/ + setupsb(2); + displstat(2); + for (fv = 1; fv <= 80; fv ++) + for (fv2 = 0; fv2 <= 27; fv2 ++) { + scvar[fv2 * 80 + fv] = textvar[ord(contentsheader[fv - 1]) + 1][fv2 / 2]; + } + for (fv = 1; fv <= contsize; fv ++) { + if (keyon < 10) curstr = strf(keyon) + ". " + contlist[fv].headername; + else + curstr = string(chr(keyon + 55)) + ". " + contlist[fv].headername; + for (fv2 = 1; fv2 <= length(curstr); fv2 ++) + for (fv3 = 0; fv3 <= 7; fv3 ++) + scvar[(fv + 3) * 640 + fv3 * 80 + fv2] = textvar8[ord(curstr[fv2]) + 1][fv3]; + keyon += 1; + } + showscreen(); + do { + ; + } while (!keypressed()); + rkv = readkey(); + switch (rkv) { + case RANGE_9('\61', '\71'): + jumppos = ord(rkv) - 48; + break; + case RANGE_26('\101', '\132'): + jumppos = ord(rkv) - 55; + break; + case RANGE_26('\141', '\172'): + jumppos = ord(rkv) - 87; + break; + default: + lat = olat; + } + if (jumppos > 0) lat = contlist[jumppos].headeroffset; + setupsb(1); + if (fast == false) wipesb(0); + drawscreenf(lat); } -void down() /*scrolls the screen down one line*/ -{ - word fv,xpos,wpos,lab; - - lat += 1; - lab=lat+335; - setoffset((word)(lat*80)); - if (lab % 14==0) { - bat=posof13[tlab-24]+2; bab=posof13[tlab]+2; tlab += 1; udstat(); } - fv=bab; - xpos=1; - while (xpos<=80) - { - if (fv24) - { - tlab -= 1; bat=posof13[tlab-24]+2; bab=posof13[tlab-1]+2; udstat(); } else - { atsof=true; udstat(); return; } - lat -= 1; - setoffset((word)(lat*80)); - fv=bat; - xpos=1; - while (xpos<=80) - { - if (fv 24) { + tlab -= 1; + bat = posof13[tlab - 24] + 2; + bab = posof13[tlab - 1] + 2; + udstat(); + } else { + atsof = true; + udstat(); + return; + } + lat -= 1; + setoffset((word)(lat * 80)); + fv = bat; + xpos = 1; + while (xpos <= 80) { + if (fv < posof13[tlab - 23]) { + if ((*textmem)[fv] == 9) { + wipeit(lat * 80 + xpos - 1, tabstop); + xpos += tabstop; + } else { + wpos = (word)((lat * 80 + xpos) % 65536); + mem[0xa000 * wpos - 1] = textvar[(*textmem)[fv] + 1][lat % 14]; + xpos += 1; + } + } else { + wipeit(lat * 80 + xpos - 1, 81 - xpos); + xpos = 81; + } + fv += 1; + } + if (fast == true) displstat(1); + /*ateof:=false;*/ } -void endit() /*Ends the program*/ -{ - release(dpt); - graphmode(2); +void endit() { /*Ends the program*/ + release(dpt); + graphmode(2); } -void control() /*User control*/ -{ - char rkv,rkv2/*the sequel*/,rkv3; - integer fv; - boolean first; - - if (regimode==false) displcont(); else drawscreenf(tlab-24); - first=true; - do {; - rkv=readkey(); - switch (rkv) { - case '\0': { - rkv2=readkey(); - switch (rkv2) { - case chome:drawscreenf(0); break; - case cend: drawscreenf(nol-24); break; - case cpgdn: - {; - memw[bfseg*bfofs]=0; - if (fast==false) wipesb(lat); - fv=1; - while (((cardinal)lat+336cUp) or (atsof=true); - cDown: repeat; - down; - readkey; - until (readkey<>cDown) or (ateof=true);*/ - } - first=false; - } - break; - case '\33': return; break; - case '\103':case '\143': if (regimode==false) { wipesb(lat); displcont(); } break; - } - } while (!false); +void control() { /*User control*/ + char rkv, rkv2/*the sequel*/, rkv3; + integer fv; + boolean first; + + if (regimode == false) displcont(); + else drawscreenf(tlab - 24); + first = true; + do { + ; + rkv = readkey(); + switch (rkv) { + case '\0': { + rkv2 = readkey(); + switch (rkv2) { + case chome: + drawscreenf(0); + break; + case cend: + drawscreenf(nol - 24); + break; + case cpgdn: { + ; + memw[bfseg * bfofs] = 0; + if (fast == false) wipesb(lat); + fv = 1; + while (((cardinal)lat + 336 < nosl) && (fv < 337)) { + fv += 1; + down(); + } + if ((first == true) && (memw[bfseg * bfofs] <= 2)) fast = true; + if ((fast == false) || (first == true)) displstat(0); + } + break; + case cpgup: { + ; + memw[bfseg * bfofs] = 0; + if (fast == false) wipesb(lat); + fv = 1; + while ((atsof == false) && (fv < 337)) { + fv += 1; + up(); + } + if ((first == true) && (memw[bfseg * bfofs] <= 2)) fast = true; + if ((fast == false) || (first == true)) displstat(0); + } + break; + /* cUp:repeat; + up; + readkey; + until (readkey<>cUp) or (atsof=true); + cDown: repeat; + down; + readkey; + until (readkey<>cDown) or (ateof=true);*/ + } + first = false; + } + break; + case '\33': + return; + break; + case '\103': + case '\143': + if (regimode == false) { + wipesb(lat); + displcont(); + } + break; + } + } while (!false); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - setup(); - control(); - endit(); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + setup(); + control(); + endit(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp index c801a741d66a..b705fac67528 100644 --- a/engines/avalanche/visa.cpp +++ b/engines/avalanche/visa.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -51,240 +51,240 @@ const boolean report_dixi_errors = true; boolean went_ok; -void unskrimble() -{ - word fv; +void unskrimble() { + word fv; - for( fv=1; fv <= bufsize; fv ++) buffer[fv]=(char)((~(ord(buffer[fv])-fv)) % 256); + for (fv = 1; fv <= bufsize; fv ++) buffer[fv] = (char)((~(ord(buffer[fv]) - fv)) % 256); } -void do_the_bubble() -{ - bufsize += 1; - buffer[bufsize]='\2'; +void do_the_bubble() { + bufsize += 1; + buffer[bufsize] = '\2'; } -void dixi(char block, byte point) -{ - untyped_file indexfile,sezfile; - word idx_offset,sez_offset; - boolean error; +void dixi(char block, byte point) { + untyped_file indexfile, sezfile; + word idx_offset, sez_offset; + boolean error; - error=false; + error = false; - assign(indexfile,"avalot.idx"); assign(sezfile,"avalot.sez"); + assign(indexfile, "avalot.idx"); + assign(sezfile, "avalot.sez"); - reset(indexfile,1); - seek(indexfile,(ord(upcase(block))-65)*2); - blockread(indexfile,idx_offset,2); - if (idx_offset==0) error=true; - seek(indexfile,idx_offset+point*2); - blockread(indexfile,sez_offset,2); - if (sez_offset==0) error=true; - close(indexfile); + reset(indexfile, 1); + seek(indexfile, (ord(upcase(block)) - 65) * 2); + blockread(indexfile, idx_offset, 2); + if (idx_offset == 0) error = true; + seek(indexfile, idx_offset + point * 2); + blockread(indexfile, sez_offset, 2); + if (sez_offset == 0) error = true; + close(indexfile); - went_ok=! error; + went_ok = ! error; - if (error) - { - if (report_dixi_errors) - display(string('\7')+"Error accessing scroll "+block+strf(point)); - return; - } + if (error) { + if (report_dixi_errors) + display(string('\7') + "Error accessing scroll " + block + strf(point)); + return; + } - reset(sezfile,1); - seek(sezfile,sez_offset); - blockread(sezfile,bufsize,2); - blockread(sezfile,buffer,bufsize); - close(sezfile); - unskrimble(); + reset(sezfile, 1); + seek(sezfile, sez_offset); + blockread(sezfile, bufsize, 2); + blockread(sezfile, buffer, bufsize); + close(sezfile); + unskrimble(); - if (bubbling) do_the_bubble(); + if (bubbling) do_the_bubble(); - calldrivers; + calldrivers; } -void speech(byte who, byte subject) -{ - untyped_file indexfile,sezfile; - word idx_offset,sez_offset,next_idx_offset; - - if (subject==0) - { /* No subject. */ - bubbling=true; report_dixi_errors=false; - dixi('s',who); - bubbling=false; report_dixi_errors=true; - } else - { /* Subject given. */ - assign(indexfile,"converse.avd"); assign(sezfile,"avalot.sez"); - - went_ok=false; /* Assume that until we know otherwise. */ - reset(indexfile,1); - seek(indexfile,who*2-2); - blockread(indexfile,idx_offset,2); - blockread(indexfile,next_idx_offset,2); - - if ((idx_offset==0) || - ((((next_idx_offset-idx_offset) / 2)-1) < subject)) return; - - seek(indexfile,idx_offset+subject*2); - /*$I-*/ - blockread(indexfile,sez_offset,2); - if ((sez_offset==0) || (ioresult!=0)) return; - /*$I+*/ - close(indexfile); - - reset(sezfile,1); - seek(sezfile,sez_offset); - blockread(sezfile,bufsize,2); - blockread(sezfile,buffer,bufsize); - close(sezfile); - - unskrimble(); - do_the_bubble(); - - calldrivers; - went_ok=true; - } +void speech(byte who, byte subject) { + untyped_file indexfile, sezfile; + word idx_offset, sez_offset, next_idx_offset; + + if (subject == 0) { + /* No subject. */ + bubbling = true; + report_dixi_errors = false; + dixi('s', who); + bubbling = false; + report_dixi_errors = true; + } else { + /* Subject given. */ + assign(indexfile, "converse.avd"); + assign(sezfile, "avalot.sez"); + + went_ok = false; /* Assume that until we know otherwise. */ + reset(indexfile, 1); + seek(indexfile, who * 2 - 2); + blockread(indexfile, idx_offset, 2); + blockread(indexfile, next_idx_offset, 2); + + if ((idx_offset == 0) || + ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; + + seek(indexfile, idx_offset + subject * 2); + /*$I-*/ + blockread(indexfile, sez_offset, 2); + if ((sez_offset == 0) || (ioresult != 0)) return; + /*$I+*/ + close(indexfile); + + reset(sezfile, 1); + seek(sezfile, sez_offset); + blockread(sezfile, bufsize, 2); + blockread(sezfile, buffer, bufsize); + close(sezfile); + + unskrimble(); + do_the_bubble(); + + calldrivers; + went_ok = true; + } } -void talkto(byte whom) -{ - byte fv; - boolean no_matches; - - if (person==pardon) - { - person=chr(subjnumber); - subjnumber=0; - } - - if (subjnumber==0) - switch (chr(whom)) { - case pspludwick: - - if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) - { - dixi('q',68); - dna.obj[potion]=true; - objectlist; points(3); return; - } else - { - if (dna.talked_to_crapulus) - switch (dna.given2spludwick) { /* Spludwick - what does he need? */ - /* 0 - let it through to use normal routine. */ - case RANGE_2(1,2): { - display(string("Can you get me ")+ - get_better(spludwick_order[dna.given2spludwick])+", please?"+ - "\232\2"); - return; - } - break; - case 3: { - dixi('q',30); /* need any help with the game? */ - return; - } - break; - } - else { - dixi('q',42); /* Haven't talked to Crapulus. Go and talk to him. */ - return; - } - } - break; - - case pibythneth: if (dna.givenbadgetoiby) - { - dixi('q',33); /* Thanks a lot! */ - return; /* And leave the proc. */ - } - break; /* Or... just continue, 'cos he hasn't got it. */ - case pdogfood: if (dna.wonnim) - { /* We've won the game. */ - dixi('q',6); /* "I'm Not Playing!" */ - return; /* Zap back. */ - } else dna.asked_dogfood_about_nim=true; - break; - case payles: if (~ dna.ayles_is_awake) - { - dixi('q',43); /* He's fast asleep! */ - return; - } else - if (~ dna.given_pen_to_ayles) - { - dixi('q',44); /* Can you get me a pen, Avvy? */ - return; - } - break; - - case pjacques: { dixi('q',43); return; } break; - case pgeida: if (dna.geida_given_potion) - dna.geida_follows=true; else - { - dixi('u',17); - return; - } - break; - case pspurge: if (~ dna.sitting_in_pub) - { - dixi('q',71); /* Try going over and sitting down. */ - return; - } else - { - if (spurge_talk<5) spurge_talk += 1; - if (spurge_talk>1) - { /* no. 1 falls through */ - dixi('q',70+spurge_talk); - return; - } - } - break; - } else /* On a subject. Is there any reason to block it? */ - switch (chr(whom)) { - case payles: if (~ dna.ayles_is_awake) - { - dixi('q',43); /* He's fast asleep! */ - return; - } - break; - } - - if (whom>149) whom -= 149; - - no_matches=true; - for( fv=1; fv <= numtr; fv ++) - if (tr[fv].a.accinum==whom) - { - display(string('\23')+chr(fv+48)+'\4'); - no_matches=false; - flush(); - } - - if (no_matches) display("\23\23\4"); - - speech(whom,subjnumber); - if (! went_ok) /* File not found! */ - dixi('n',whom); - - if (subjnumber==0) - switch (chr(whom+149)) { - case pcrapulus: - { /* Crapulus: get the badge - first time only */ - dna.obj[badge]=true; - objectlist; - dixi('q',1); /* Circular from Cardiff. */ - dna.talked_to_crapulus=true; - - whereis[pcrapulus]=177; /* Crapulus walks off. */ - - tr[2].vanishifstill=true; - tr[2].walkto(4); /* Walks away. */ - - points(2); - } - break; - - } +void talkto(byte whom) { + byte fv; + boolean no_matches; + + if (person == pardon) { + person = chr(subjnumber); + subjnumber = 0; + } + + if (subjnumber == 0) + switch (chr(whom)) { + case pspludwick: + + if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) { + dixi('q', 68); + dna.obj[potion] = true; + objectlist; + points(3); + return; + } else { + if (dna.talked_to_crapulus) + switch (dna.given2spludwick) { /* Spludwick - what does he need? */ + /* 0 - let it through to use normal routine. */ + case RANGE_2(1, 2): { + display(string("Can you get me ") + + get_better(spludwick_order[dna.given2spludwick]) + ", please?" + + "\232\2"); + return; + } + break; + case 3: { + dixi('q', 30); /* need any help with the game? */ + return; + } + break; + } + else { + dixi('q', 42); /* Haven't talked to Crapulus. Go and talk to him. */ + return; + } + } + break; + + case pibythneth: + if (dna.givenbadgetoiby) { + dixi('q', 33); /* Thanks a lot! */ + return; /* And leave the proc. */ + } + break; /* Or... just continue, 'cos he hasn't got it. */ + case pdogfood: + if (dna.wonnim) { + /* We've won the game. */ + dixi('q', 6); /* "I'm Not Playing!" */ + return; /* Zap back. */ + } else dna.asked_dogfood_about_nim = true; + break; + case payles: + if (~ dna.ayles_is_awake) { + dixi('q', 43); /* He's fast asleep! */ + return; + } else if (~ dna.given_pen_to_ayles) { + dixi('q', 44); /* Can you get me a pen, Avvy? */ + return; + } + break; + + case pjacques: { + dixi('q', 43); + return; + } + break; + case pgeida: + if (dna.geida_given_potion) + dna.geida_follows = true; + else { + dixi('u', 17); + return; + } + break; + case pspurge: + if (~ dna.sitting_in_pub) { + dixi('q', 71); /* Try going over and sitting down. */ + return; + } else { + if (spurge_talk < 5) spurge_talk += 1; + if (spurge_talk > 1) { + /* no. 1 falls through */ + dixi('q', 70 + spurge_talk); + return; + } + } + break; + } + else /* On a subject. Is there any reason to block it? */ + switch (chr(whom)) { + case payles: + if (~ dna.ayles_is_awake) { + dixi('q', 43); /* He's fast asleep! */ + return; + } + break; + } + + if (whom > 149) whom -= 149; + + no_matches = true; + for (fv = 1; fv <= numtr; fv ++) + if (tr[fv].a.accinum == whom) { + display(string('\23') + chr(fv + 48) + '\4'); + no_matches = false; + flush(); + } + + if (no_matches) display("\23\23\4"); + + speech(whom, subjnumber); + if (! went_ok) /* File not found! */ + dixi('n', whom); + + if (subjnumber == 0) + switch (chr(whom + 149)) { + case pcrapulus: { + /* Crapulus: get the badge - first time only */ + dna.obj[badge] = true; + objectlist; + dixi('q', 1); /* Circular from Cardiff. */ + dna.talked_to_crapulus = true; + + whereis[pcrapulus] = 177; /* Crapulus walks off. */ + + tr[2].vanishifstill = true; + tr[2].walkto(4); /* Walks away. */ + + points(2); + } + break; + + } } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h index 474a0098c67e..6a1ee6265ea5 100644 --- a/engines/avalanche/visa.h +++ b/engines/avalanche/visa.h @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp index 854423947334..487cc142abc8 100644 --- a/engines/avalanche/visatest.cpp +++ b/engines/avalanche/visatest.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -32,80 +32,79 @@ namespace Avalanche { char block; word point; -array<1,2000,char> result; +array<1, 2000, char> result; word result_len; -void unskrimble() -{ - word fv; +void unskrimble() { + word fv; - for( fv=1; fv <= 2000; fv ++) result[fv]=(char)((~(ord(result[fv])-fv)) % 256); + for (fv = 1; fv <= 2000; fv ++) result[fv] = (char)((~(ord(result[fv]) - fv)) % 256); } -void visa_get_scroll(char block, word point) -{ - untyped_file indexfile,sezfile; - word idx_offset,sez_offset; - - assign(indexfile,"avalot.idx"); assign(sezfile,"avalot.sez"); - - reset(indexfile,1); - seek(indexfile,(ord(upcase(block))-65)*2); - blockread(indexfile,idx_offset,2); - seek(indexfile,idx_offset+point*2); - blockread(indexfile,sez_offset,2); - close(indexfile); - - reset(sezfile,1); - seek(sezfile,sez_offset); - blockread(sezfile,result_len,2); - blockread(sezfile,result,result_len); - close(sezfile); - unskrimble(); +void visa_get_scroll(char block, word point) { + untyped_file indexfile, sezfile; + word idx_offset, sez_offset; + + assign(indexfile, "avalot.idx"); + assign(sezfile, "avalot.sez"); + + reset(indexfile, 1); + seek(indexfile, (ord(upcase(block)) - 65) * 2); + blockread(indexfile, idx_offset, 2); + seek(indexfile, idx_offset + point * 2); + blockread(indexfile, sez_offset, 2); + close(indexfile); + + reset(sezfile, 1); + seek(sezfile, sez_offset); + blockread(sezfile, result_len, 2); + blockread(sezfile, result, result_len); + close(sezfile); + unskrimble(); } -void access_get_scroll(char block, word point) -{ - string x; - untyped_file f; - - str(point,x); - x=string('S')+block+x+".RAW"; - assign(f,x); - reset(f,1); - result_len=filesize(f); - blockread(f,result,result_len); - close(f); +void access_get_scroll(char block, word point) { + string x; + untyped_file f; + + str(point, x); + x = string('S') + block + x + ".RAW"; + assign(f, x); + reset(f, 1); + result_len = filesize(f); + blockread(f, result, result_len); + close(f); } -void display_it() -{ - word fv; +void display_it() { + word fv; - for( fv=1; fv <= result_len; fv ++) output << result[fv]; + for (fv = 1; fv <= result_len; fv ++) output << result[fv]; } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - do { - output << NL; - output << NL; - output << "Block?"; input >> block >> NL; - output << "Point?"; input >> point >> NL; - - output << "ACCESS reports (this one is always correct):" << NL; - output << NL; - access_get_scroll(block,point); - display_it(); - - output << NL; output << NL; - output << "VISA reports:" << NL; - output << NL; - visa_get_scroll(block,point); - display_it(); - } while (!false); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + do { + output << NL; + output << NL; + output << "Block?"; + input >> block >> NL; + output << "Point?"; + input >> point >> NL; + + output << "ACCESS reports (this one is always correct):" << NL; + output << NL; + access_get_scroll(block, point); + display_it(); + + output << NL; + output << NL; + output << "VISA reports:" << NL; + output << NL; + visa_get_scroll(block, point); + display_it(); + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp index e3261d7c1eb5..d0f88a1e85c2 100644 --- a/engines/avalanche/waver.cpp +++ b/engines/avalanche/waver.cpp @@ -11,7 +11,7 @@ * 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 + * 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 diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index 074c3b1178fb..f8726c3a62fa 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,94 +29,99 @@ namespace Avalanche { -void load() -{ - byte a; /*absolute $A000:1200;*/ byte bit; untyped_file f; -; - assign(f,"avagame.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,12080); - } - close(f); - bit=getpixel(0,0); +void load() { + byte a; /*absolute $A000:1200;*/ byte bit; + untyped_file f; + ; + assign(f, "avagame.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 12080); + } + close(f); + bit = getpixel(0, 0); } -void gfx() -{ - integer gd,gm; +void gfx() { + integer gd, gm; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); } -void blit(integer x1,integer y1,integer x2,integer y2,integer x3,integer y3) -{ - pointer p,q; word s; +void blit(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3) { + pointer p, q; + word s; - mark(q); + mark(q); - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - putimage(x3,y3,p,0); + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + putimage(x3, y3, p, 0); - release(q); + release(q); } -void copy_hammer() -{ - blit(274,47,311,67,92,10); +void copy_hammer() { + blit(274, 47, 311, 67, 92, 10); } -void do_text() -{ - settextjustify(1,1); setcolor(0); - settextstyle(2,0,4); - setusercharsize(120,100,100,100); - outtextxy(112,32,"Thorsoft of Letchworth presents"); - blit(3,30,218,31,4,30); - blit(4,35,219,38,3,35); +void do_text() { + settextjustify(1, 1); + setcolor(0); + settextstyle(2, 0, 4); + setusercharsize(120, 100, 100, 100); + outtextxy(112, 32, "Thorsoft of Letchworth presents"); + blit(3, 30, 218, 31, 4, 30); + blit(4, 35, 219, 38, 3, 35); } -void dump_to_file(byte x1,byte y1,byte x2,byte y2, string fn) -{ - byte y,bit; - untyped_file f; +void dump_to_file(byte x1, byte y1, byte x2, byte y2, string fn) { + byte y, bit; + untyped_file f; - assign(f,fn); - rewrite(f,1); + assign(f, fn); + rewrite(f, 1); - for( y=y1; y <= y2; y ++) - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(f,mem[0xa000*y*80+x1],x2-x1); - } + for (y = y1; y <= y2; y ++) + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(f, mem[0xa000 * y * 80 + x1], x2 - x1); + } - close(f); + close(f); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - gfx(); - load(); - - setfillstyle(1,7); - bar(2,10,219,37); - bar(0,0,1,200); - bar(220,0,250, 88); - bar(0,88,213,147); - bar(622,88,640,147); - copy_hammer(); - do_text(); - - dump_to_file( 0,10,28,86,"about.avd"); - dump_to_file(26,88,78,147,"gameover.avd"); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + gfx(); + load(); + + setfillstyle(1, 7); + bar(2, 10, 219, 37); + bar(0, 0, 1, 200); + bar(220, 0, 250, 88); + bar(0, 88, 213, 147); + bar(622, 88, 640, 147); + copy_hammer(); + do_text(); + + dump_to_file(0, 10, 28, 86, "about.avd"); + dump_to_file(26, 88, 78, 147, "gameover.avd"); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp index 7a99b50646f0..fc953a56282f 100644 --- a/engines/avalanche/xf_help.cpp +++ b/engines/avalanche/xf_help.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -37,77 +37,76 @@ text i; untyped_file o; string x; char t; -byte p,w; +byte p, w; -array<0,max_pages,word> where; +array<0, max_pages, word> where; -void out(string x) -{ - byte fz; +void out(string x) { + byte fz; - for( fz=1; fz <= length(x); fz ++) - x[fz]=chr(ord(x[fz]) ^ 177); - blockwrite(o,x[0],1); - blockwrite(o,x[1],length(x)); + for (fz = 1; fz <= length(x); fz ++) + x[fz] = chr(ord(x[fz]) ^ 177); + blockwrite(o, x[0], 1); + blockwrite(o, x[1], length(x)); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - assign(o,"help.avd"); - rewrite(o,1); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + assign(o, "help.avd"); + rewrite(o, 1); - blockwrite(o,where,sizeof(where)); + blockwrite(o, where, sizeof(where)); - for( fv=0; fv <= max_pages; fv ++) - { - where[fv]=filepos(o); + for (fv = 0; fv <= max_pages; fv ++) { + where[fv] = filepos(o); - assign(i,string('h')+strf(fv)+".raw"); - reset(i); + assign(i, string('h') + strf(fv) + ".raw"); + reset(i); - i >> x >> NL; /* Title. */ - out(x); + i >> x >> NL; /* Title. */ + out(x); - i >> p >> NL; /* Picture. */ - blockwrite(o,p,1); + i >> p >> NL; /* Picture. */ + blockwrite(o, p, 1); - do { - i >> x >> NL; - out(x); - } while (!(x=='!')); + do { + i >> x >> NL; + out(x); + } while (!(x == '!')); - while (! eof(i)) - { - i >> x >> NL; - if (x=='-') - { /* Null point */ - t='\0'; p=0; w=177; - } else - { /* Has a point. */ - i >> t >> NL; - i >> p >> NL; - i >> w >> NL; - } + while (! eof(i)) { + i >> x >> NL; + if (x == '-') { + /* Null point */ + t = '\0'; + p = 0; + w = 177; + } else { + /* Has a point. */ + i >> t >> NL; + i >> p >> NL; + i >> w >> NL; + } - blockwrite(o,t,1); - blockwrite(o,p,1); - blockwrite(o,w,1); - } + blockwrite(o, t, 1); + blockwrite(o, p, 1); + blockwrite(o, w, 1); + } - t='\261'; - blockwrite(o,t,1); - blockwrite(o,p,1); - blockwrite(o,w,1); + t = '\261'; + blockwrite(o, t, 1); + blockwrite(o, p, 1); + blockwrite(o, w, 1); - close(i); + close(i); - } + } - seek(o,0); blockwrite(o,where,sizeof(where)); + seek(o, 0); + blockwrite(o, where, sizeof(where)); - close(o); - return EXIT_SUCCESS; + close(o); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp index 4df55cdce53a..4dde0e3fc42b 100644 --- a/engines/avalanche/xf_visa.cpp +++ b/engines/avalanche/xf_visa.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,173 +34,167 @@ namespace Avalanche { const varying_string<9> used = "DNPQSTUXZ"; -const varying_string<12> header = string("Avalot Sez:")+'\32'; +const varying_string<12> header = string("Avalot Sez:") + '\32'; -untyped_file sez,infile; +untyped_file sez, infile; searchrec s; -matrix<'A','Z',0,99,word> positions; -array<'A','Z',word> maxlen; +matrix < 'A', 'Z', 0, 99, word > positions; +array < 'A', 'Z', word > maxlen; -matrix<1,50,0,255,word> speak_positions; -array<1,50,word> speak_maxlen; +matrix<1, 50, 0, 255, word> speak_positions; +array<1, 50, word> speak_maxlen; -array<1,2000,char> data; +array<1, 2000, char> data; word data_length; byte fv; -byte numeric_bit() -{ - varying_string<5> x; integer e; byte result; - - byte numeric_bit_result; - x=copy(s.name,3,pos(".",s.name)-3); - val(x,result,e); - if (e!=0) - { - output << "NUMERIC ERROR: " << s.name << '/' << x << NL; - exit(255); - } - numeric_bit_result=result; - return numeric_bit_result; +byte numeric_bit() { + varying_string<5> x; + integer e; + byte result; + + byte numeric_bit_result; + x = copy(s.name, 3, pos(".", s.name) - 3); + val(x, result, e); + if (e != 0) { + output << "NUMERIC ERROR: " << s.name << '/' << x << NL; + exit(255); + } + numeric_bit_result = result; + return numeric_bit_result; } -byte speak_left() -{ - string x; integer e; byte result; - - byte speak_left_result; - x=copy(s.name,3,pos(".",s.name)-3); - x=copy(x,1,pos("-",x)-1); - val(x,result,e); - if (e!=0) - { - output << "NUMERIC ERROR (left): " << s.name << '/' << x << NL; - exit(255); - } - speak_left_result=result; - return speak_left_result; +byte speak_left() { + string x; + integer e; + byte result; + + byte speak_left_result; + x = copy(s.name, 3, pos(".", s.name) - 3); + x = copy(x, 1, pos("-", x) - 1); + val(x, result, e); + if (e != 0) { + output << "NUMERIC ERROR (left): " << s.name << '/' << x << NL; + exit(255); + } + speak_left_result = result; + return speak_left_result; } -byte speak_right() -{ - string x; integer e; byte result; - - byte speak_right_result; - x=copy(s.name,3,pos(".",s.name)-3); - x=copy(x,pos("-",x)+1,255); - val(x,result,e); - if (e!=0) - { - output << "NUMERIC ERROR (right): " << s.name << '/' << x << NL; - exit(255); - } - speak_right_result=result; - return speak_right_result; +byte speak_right() { + string x; + integer e; + byte result; + + byte speak_right_result; + x = copy(s.name, 3, pos(".", s.name) - 3); + x = copy(x, pos("-", x) + 1, 255); + val(x, result, e); + if (e != 0) { + output << "NUMERIC ERROR (right): " << s.name << '/' << x << NL; + exit(255); + } + speak_right_result = result; + return speak_right_result; } -void write_out() -{ - array<'A','Z',word> points; - array<1,50,word> speak_points; - untyped_file outf; - byte fv; +void write_out() { + array < 'A', 'Z', word > points; + array<1, 50, word> speak_points; + untyped_file outf; + byte fv; - fillchar(points,sizeof(points),'\0'); - fillchar(speak_points,sizeof(speak_points),'\0'); + fillchar(points, sizeof(points), '\0'); + fillchar(speak_points, sizeof(speak_points), '\0'); - assign(outf,"v:avalot.idx"); - rewrite(outf,1); - blockwrite(outf,points,sizeof(points)); + assign(outf, "v:avalot.idx"); + rewrite(outf, 1); + blockwrite(outf, points, sizeof(points)); - for( fv=1; fv <= length(used); fv ++) - { - points[used[fv-1]]=filepos(outf); - blockwrite(outf,positions[used[fv-1]],maxlen[used[fv-1]]*2+2); - } + for (fv = 1; fv <= length(used); fv ++) { + points[used[fv - 1]] = filepos(outf); + blockwrite(outf, positions[used[fv - 1]], maxlen[used[fv - 1]] * 2 + 2); + } - seek(outf,0); - blockwrite(outf,points,sizeof(points)); + seek(outf, 0); + blockwrite(outf, points, sizeof(points)); - close(outf); + close(outf); - /* --- now the speech records --- */ + /* --- now the speech records --- */ - assign(outf,"v:converse.avd"); - rewrite(outf,1); - blockwrite(outf,speak_points,sizeof(speak_points)); + assign(outf, "v:converse.avd"); + rewrite(outf, 1); + blockwrite(outf, speak_points, sizeof(speak_points)); - for( fv=1; fv <= 15; fv ++) - { - speak_points[fv]=filepos(outf); + for (fv = 1; fv <= 15; fv ++) { + speak_points[fv] = filepos(outf); - blockwrite(outf,speak_positions[fv],speak_maxlen[fv]*2+2); - } + blockwrite(outf, speak_positions[fv], speak_maxlen[fv] * 2 + 2); + } - seek(outf,0); - blockwrite(outf,speak_points,sizeof(speak_points)); + seek(outf, 0); + blockwrite(outf, speak_points, sizeof(speak_points)); - close(outf); + close(outf); } -void skrimble() -{ - word fv; +void skrimble() { + word fv; - for( fv=1; fv <= 2000; fv ++) data[fv]=(char)((~(ord(data[fv]))+fv) % 256); + for (fv = 1; fv <= 2000; fv ++) data[fv] = (char)((~(ord(data[fv])) + fv) % 256); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - fillchar(positions,sizeof(positions),'\0'); - fillchar(maxlen,sizeof(maxlen),'\0'); +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + fillchar(positions, sizeof(positions), '\0'); + fillchar(maxlen, sizeof(maxlen), '\0'); - clrscr; + clrscr; - assign(sez,"v:avalot.sez"); - rewrite(sez,1); - blockwrite(sez,header[1],12); + assign(sez, "v:avalot.sez"); + rewrite(sez, 1); + blockwrite(sez, header[1], 12); - findfirst("s*.raw",anyfile,s); - while (doserror==0) - { - assign(infile,s.name); - reset(infile,1); - blockread(infile,data,2000,data_length); - close(infile); + findfirst("s*.raw", anyfile, s); + while (doserror == 0) { + assign(infile, s.name); + reset(infile, 1); + blockread(infile, data, 2000, data_length); + close(infile); - clrscr; - if (pos("-",s.name)==0) - { /* Not a speech record. */ - output << s.name << format(numeric_bit(),10) << NL; + clrscr; + if (pos("-", s.name) == 0) { + /* Not a speech record. */ + output << s.name << format(numeric_bit(), 10) << NL; - positions[s.name[2]][numeric_bit()]=filepos(sez); - if (maxlen[s.name[2]]<(unsigned char)numeric_bit()) maxlen[s.name[2]]=numeric_bit(); + positions[s.name[2]][numeric_bit()] = filepos(sez); + if (maxlen[s.name[2]] < (unsigned char)numeric_bit()) maxlen[s.name[2]] = numeric_bit(); - } else - { /* A speech record. */ - output << s.name << format(speak_left(),10) << format(speak_right(),10) << " SR" << NL; + } else { + /* A speech record. */ + output << s.name << format(speak_left(), 10) << format(speak_right(), 10) << " SR" << NL; - speak_positions[speak_left()][speak_right()]=filepos(sez); - if (speak_maxlen[speak_left()]<(unsigned char)speak_right()) - speak_maxlen[speak_left()]=speak_right(); - } + speak_positions[speak_left()][speak_right()] = filepos(sez); + if (speak_maxlen[speak_left()] < (unsigned char)speak_right()) + speak_maxlen[speak_left()] = speak_right(); + } - skrimble(); + skrimble(); - blockwrite(sez,data_length,2); - blockwrite(sez,data,data_length); + blockwrite(sez, data_length, 2); + blockwrite(sez, data, data_length); - findnext(s); - clreol; - } + findnext(s); + clreol; + } - close(sez); + close(sez); - write_out(); - return EXIT_SUCCESS; + write_out(); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index 013a121666a4..d2c552dae939 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,62 +29,65 @@ namespace Avalanche { -integer x,y; -untyped_file f,out; +integer x, y; +untyped_file f, out; -void load() /* Load2, actually */ -{ - byte a0; /*absolute $A000:800;*/ - byte bit; - untyped_file f; - integer gd,gm; +void load() { /* Load2, actually */ + byte a0; /*absolute $A000:800;*/ + byte bit; + untyped_file f; + integer gd, gm; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); - assign(f,"d:butnraw.avd"); reset(f,1); - seek(f,177); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a0,12080); - } - close(f); - bit=getpixel(0,0); + assign(f, "d:butnraw.avd"); + reset(f, 1); + seek(f, 177); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + } + close(f); + bit = getpixel(0, 0); } -void grab(integer x1,integer y1,integer x2,integer y2) /* s=930 */ -{ - word s; pointer p; +void grab(integer x1, integer y1, integer x2, integer y2) { /* s=930 */ + word s; + pointer p; - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - putimage(0,0,p,0); - blockwrite(out,p,s); - freemem(p,s); - rectangle(x1,y1,x2,y2); + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + putimage(0, 0, p, 0); + blockwrite(out, p, s); + freemem(p, s); + rectangle(x1, y1, x2, y2); } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - assign(f,"d:butnraw.avd"); - assign(out,"v:buttons.avd"); rewrite(out,1); - load(); - for( x=0; x <= 5; x ++) - for( y=0; y <= 3; y ++) - { - if (! - (((x==1) && (y==0)) - || ((x==4) && (y==2)) - || ((y==3) && (x>2) && (x<5)))) - { - input >> NL; - grab(100+x*83,51+y*22,180+x*83,71+y*22); - } - } - close(out); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + assign(f, "d:butnraw.avd"); + assign(out, "v:buttons.avd"); + rewrite(out, 1); + load(); + for (x = 0; x <= 5; x ++) + for (y = 0; y <= 3; y ++) { + if (! + (((x == 1) && (y == 0)) + || ((x == 4) && (y == 2)) + || ((y == 3) && (x > 2) && (x < 5)))) { + input >> NL; + grab(100 + x * 83, 51 + y * 22, 180 + x * 83, 71 + y * 22); + } + } + close(out); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 1c7673c4014f..28e7efddd62b 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -30,244 +30,281 @@ namespace Avalanche { -const array<1,44,char> chunkheader = -string("Spooky file! Nearly a Chunk... (c) MT.")+'\32'+'\261'+'\x30'+'\x1'+'\x75'+'\261'; +const array<1, 44, char> chunkheader = + string("Spooky file! Nearly a Chunk... (c) MT.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; const integer n = -1; /* "No change" in new-whatever */ const integer aa = -2; /* This is an aargh. */ -const integer aargh_x_ofs = -177; const integer aargh_y_ofs = 52; +const integer aargh_x_ofs = -177; +const integer aargh_y_ofs = 52; -enum flavourtype {ch_ega,ch_bgi,ch_natural,ch_two,ch_one, last_flavourtype}; +enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; struct chunkblocktype { - flavourtype flavour; - integer x,y; - integer xl,yl; - longint size; + flavourtype flavour; + integer x, y; + integer xl, yl; + longint size; }; -integer gd,gm,x,y; -untyped_file f; byte bit; +integer gd, gm, x, y; +untyped_file f; +byte bit; byte a; /*absolute $A000:0;*/ palettetype cc; -char r; text t; -word s; pointer p; +char r; +text t; +word s; +pointer p; untyped_file chunkfile; chunkblocktype cb; -pointer a_p; word a_s; +pointer a_p; +word a_s; -void open_chunk() -{; - assign(chunkfile,"v:spooky.avd"); - rewrite(chunkfile,1); - blockwrite(chunkfile,chunkheader,sizeof(chunkheader)); +void open_chunk() { + ; + assign(chunkfile, "v:spooky.avd"); + rewrite(chunkfile, 1); + blockwrite(chunkfile, chunkheader, sizeof(chunkheader)); } -void close_chunk() -{; - close(chunkfile); +void close_chunk() { + ; + close(chunkfile); } -void grab(integer x1,integer y1,integer x2,integer y2, flavourtype how, integer newx,integer newy) -{ - pointer p; - word s; - integer y; - byte bit; +void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integer newx, integer newy) { + pointer p; + word s; + integer y; + byte bit; -; + ; #ifndef DRYRUN - {; - cb.flavour=how; - switch (newx) { - case n: cb.x=x1; break; - case aa: cb.x=x1+aargh_x_ofs; break; - default: cb.x=newx; - } - - switch (newy) { - case n: cb.y=y1; break; - case aa: cb.y=y1+aargh_y_ofs; break; - default: cb.y=newy; - } - - cb.xl=x2-x1; - if (set_of_enum(flavourtype)::of(ch_ega,ch_one,ch_two, eos).has(how)) cb.xl=((cb.xl+7) / 8)*8; - cb.yl=y2-y1; - } - - if (how!=ch_natural) - {; - s=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p); - } - - rectangle(x1,y1,x2,y2); - - switch (how) { - case ch_bgi: cb.size=s; break; - } - - blockwrite(chunkfile,cb,sizeof(cb)); - - switch (how) { - case ch_bgi: blockwrite(chunkfile,p,s); break; - case ch_ega: {; - setactivepage(1); - cleardevice(); - putimage(0,0,p,0); - setactivepage(0); - - for( bit=0; bit <= 3; bit ++) - for( y=0; y <= cb.yl; y ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); - } - - y=getpixel(0,0); - } - break; - case ch_two: {; /* Same as EGA, but with only 2 planes. */ - setactivepage(1); - cleardevice(); - putimage(0,0,p,0); - setactivepage(0); - - for( bit=2; bit <= 3; bit ++) /* << Bit to grab? */ - for( y=0; y <= cb.yl; y ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); - } - - y=getpixel(0,0); - } - break; - case ch_one: {; /* ...but with only one plane! */ - setactivepage(1); - cleardevice(); - putimage(0,0,p,0); - setactivepage(0); - - for( bit=3; bit <= 3; bit ++) - for( y=0; y <= cb.yl; y ++) - {; - port[0x3c4]=2; port[0x3ce]=4; - port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockwrite(chunkfile,mem[0xa400*y*80],cb.xl / 8); - } - - y=getpixel(0,0); - } - break; - } - - freemem(p,s); #endif - rectangle(x1,y1,x2,y2); + { + ; + cb.flavour = how; + switch (newx) { + case n: + cb.x = x1; + break; + case aa: + cb.x = x1 + aargh_x_ofs; + break; + default: + cb.x = newx; + } + + switch (newy) { + case n: + cb.y = y1; + break; + case aa: + cb.y = y1 + aargh_y_ofs; + break; + default: + cb.y = newy; + } + + cb.xl = x2 - x1; + if (set_of_enum(flavourtype)::of(ch_ega, ch_one, ch_two, eos).has(how)) cb.xl = ((cb.xl + 7) / 8) * 8; + cb.yl = y2 - y1; + } + + if (how != ch_natural) { + ; + s = imagesize(x1, y1, x2, y2); + getmem(p, s); + getimage(x1, y1, x2, y2, p); + } + + rectangle(x1, y1, x2, y2); + + switch (how) { + case ch_bgi: + cb.size = s; + break; + } + + blockwrite(chunkfile, cb, sizeof(cb)); + + switch (how) { + case ch_bgi: + blockwrite(chunkfile, p, s); + break; + case ch_ega: { + ; + setactivepage(1); + cleardevice(); + putimage(0, 0, p, 0); + setactivepage(0); + + for (bit = 0; bit <= 3; bit ++) + for (y = 0; y <= cb.yl; y ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); + } + + y = getpixel(0, 0); + } + break; + case ch_two: { + ; /* Same as EGA, but with only 2 planes. */ + setactivepage(1); + cleardevice(); + putimage(0, 0, p, 0); + setactivepage(0); + + for (bit = 2; bit <= 3; bit ++) /* << Bit to grab? */ + for (y = 0; y <= cb.yl; y ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); + } + + y = getpixel(0, 0); + } + break; + case ch_one: { + ; /* ...but with only one plane! */ + setactivepage(1); + cleardevice(); + putimage(0, 0, p, 0); + setactivepage(0); + + for (bit = 3; bit <= 3; bit ++) + for (y = 0; y <= cb.yl; y ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); + } + + y = getpixel(0, 0); + } + break; + } + + freemem(p, s); +#endif + rectangle(x1, y1, x2, y2); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; #ifndef DRYRUN - open_chunk(); + open_chunk(); #endif - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - assign(f,"c:\\sleep4\\colour.ptx"); reset(f,1); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - blockread(f,a,16000); /* 28000 */ - } - close(f); + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(f, "c:\\sleep4\\colour.ptx"); + reset(f, 1); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a, 16000); /* 28000 */ + } + close(f); - setwritemode(xorput); + setwritemode(xorput); - /* Grab the big ghost. */ + /* Grab the big ghost. */ - grab( 0, 0,160, 65,ch_two,n,n); /* First column, */ - grab( 0, 67,172,127,ch_two,n,n); - grab( 0,132,158,190,ch_two,n,n); + grab(0, 0, 160, 65, ch_two, n, n); /* First column, */ + grab(0, 67, 172, 127, ch_two, n, n); + grab(0, 132, 158, 190, ch_two, n, n); - a_s=imagesize(349,36,361,43); getmem(a_p,a_s); - getimage(349,36,361,43,a_p); - setfillstyle(1,0); bar(349,36,361,43); + a_s = imagesize(349, 36, 361, 43); + getmem(a_p, a_s); + getimage(349, 36, 361, 43, a_p); + setfillstyle(1, 0); + bar(349, 36, 361, 43); - grab(173, 66,347,124,ch_two,n,n); /* Second column. */ - grab(173, 6,352, 64,ch_two,n,n); + grab(173, 66, 347, 124, ch_two, n, n); /* Second column. */ + grab(173, 6, 352, 64, ch_two, n, n); - putimage(349,36,a_p,0); + putimage(349, 36, a_p, 0); - /* Grab Avvy's eyes and the exclamation mark. */ + /* Grab Avvy's eyes and the exclamation mark. */ - grab(605, 10,620, 12,ch_bgi,n,n); /* Eyes looking left */ - grab(622, 10,638, 12,ch_bgi,n,n); /* Ditto looking right (eye eye, sir) */ - grab(611, 0,616, 5,ch_bgi,n,n); /* ! */ + grab(605, 10, 620, 12, ch_bgi, n, n); /* Eyes looking left */ + grab(622, 10, 638, 12, ch_bgi, n, n); /* Ditto looking right (eye eye, sir) */ + grab(611, 0, 616, 5, ch_bgi, n, n); /* ! */ - /* Grab the cobweb. */ + /* Grab the cobweb. */ - grab(535, 25,639, 75,ch_one,n,0); - /* ^^^ Interesting point here: the ch_EGA save routine pads with black - space to the RIGHT of the object. Since this cobweb needs to be right- - justified, we must decrease x1 until xl is a multiple of 8. */ + grab(535, 25, 639, 75, ch_one, n, 0); + /* ^^^ Interesting point here: the ch_EGA save routine pads with black + space to the RIGHT of the object. Since this cobweb needs to be right- + justified, we must decrease x1 until xl is a multiple of 8. */ - /* Grab Mark's signature. */ + /* Grab Mark's signature. */ - grab(462, 61,525, 65,ch_ega,576,195); + grab(462, 61, 525, 65, ch_ega, 576, 195); - /* Grab the open door. */ + /* Grab the open door. */ - grab(180,132,294,180,ch_ega,520,127); + grab(180, 132, 294, 180, ch_ega, 520, 127); - /* Grab the bat. */ + /* Grab the bat. */ - grab(354, 0,474, 28,ch_bgi,n,n); - grab(484, 0,526, 23,ch_bgi,n,n); - grab(542, 2,564, 22,ch_bgi,n,n); + grab(354, 0, 474, 28, ch_bgi, n, n); + grab(484, 0, 526, 23, ch_bgi, n, n); + grab(542, 2, 564, 22, ch_bgi, n, n); - /* Grab the big fade-in face. */ + /* Grab the big fade-in face. */ - grab(350, 71,420,105,ch_ega,n,n); /* Top line. */ - grab(421, 71,491,105,ch_ega,n,n); + grab(350, 71, 420, 105, ch_ega, n, n); /* Top line. */ + grab(421, 71, 491, 105, ch_ega, n, n); - grab(350,107,419,141,ch_ega,n,n); /* Second line. */ - grab(421,107,490,141,ch_ega,n,n); + grab(350, 107, 419, 141, ch_ega, n, n); /* Second line. */ + grab(421, 107, 490, 141, ch_ega, n, n); - grab(350,143,420,177,ch_ega,n,n); /* Third line. */ - grab(422,143,489,177,ch_ega,n,n); + grab(350, 143, 420, 177, ch_ega, n, n); /* Third line. */ + grab(422, 143, 489, 177, ch_ega, n, n); - /* Grab the "AARGH!" */ + /* Grab the "AARGH!" */ - grab(349, 36,361, 43,ch_bgi,aa,aa); /* A */ - grab(366, 31,385, 46,ch_bgi,aa,aa); /* Aa */ - grab(394, 34,415, 52,ch_bgi,aa,aa); /* Aar */ - grab(428, 33,457, 57,ch_bgi,aa,aa); /* Aarg */ - grab(471, 30,508, 59,ch_bgi,aa,aa); /* Aargh */ - grab(524, 30,524, 58,ch_bgi,aa,aa); /* Aargh! */ + grab(349, 36, 361, 43, ch_bgi, aa, aa); /* A */ + grab(366, 31, 385, 46, ch_bgi, aa, aa); /* Aa */ + grab(394, 34, 415, 52, ch_bgi, aa, aa); /* Aar */ + grab(428, 33, 457, 57, ch_bgi, aa, aa); /* Aarg */ + grab(471, 30, 508, 59, ch_bgi, aa, aa); /* Aargh */ + grab(524, 30, 524, 58, ch_bgi, aa, aa); /* Aargh! */ - for( gd=0; gd <= 4; gd ++) - grab(509, 76+gd*22,551, 96+gd*22,ch_bgi,n,n); /* The big green eyes. */ + for (gd = 0; gd <= 4; gd ++) + grab(509, 76 + gd * 22, 551, 96 + gd * 22, ch_bgi, n, n); /* The big green eyes. */ - for( gd=5; gd >= 0; gd --) - grab(181+gd*34,186,214+gd*34,199,ch_bgi,n,n); /* The red greldet. */ + for (gd = 5; gd >= 0; gd --) + grab(181 + gd * 34, 186, 214 + gd * 34, 199, ch_bgi, n, n); /* The red greldet. */ - for( gd=0; gd <= 5; gd ++) - grab(390+gd*34,186,423+gd*34,199,ch_bgi,n,n); /* The blue greldet. */ + for (gd = 0; gd <= 5; gd ++) + grab(390 + gd * 34, 186, 423 + gd * 34, 199, ch_bgi, n, n); /* The blue greldet. */ #ifndef DRYRUN - close_chunk(); + close_chunk(); #endif -return EXIT_SUCCESS; + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index fe1619a4c382..cae7b04cf6ed 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -34,32 +34,37 @@ namespace Avalanche { untyped_file f; byte bit; byte a; /*absolute $A000:0; */ -integer gd,gm; +integer gd, gm; -void graphmode(integer mode) -{ - registers regs; -; - regs.ax=(mode % 0x100); - intr(0x10,regs); +void graphmode(integer mode) { + registers regs; + ; + regs.ax = (mode % 0x100); + intr(0x10, regs); } -int main(int argc, const char* argv[]) -{pio_initialize(argc, argv); -; - gd=3; gm=0; initgraph(gd,gm,"c:\\bp\\bgi"); - assign(f,"d:avltzap.raw"); reset(f,1); - for( bit=0; bit <= 3; bit ++) - {; - port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit; - for( gd=0; gd <= 199; gd ++) - blockread(f,mem[0xa000*gd*80],40); /* 28000 */ - } - close(f); - setwritemode(xorput); - rectangle( 0, 0, 5, 8); - rectangle( 0, 10, 27, 19); -return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + ; + gd = 3; + gm = 0; + initgraph(gd, gm, "c:\\bp\\bgi"); + assign(f, "d:avltzap.raw"); + reset(f, 1); + for (bit = 0; bit <= 3; bit ++) { + ; + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + for (gd = 0; gd <= 199; gd ++) + blockread(f, mem[0xa000 * gd * 80], 40); /* 28000 */ + } + close(f); + setwritemode(xorput); + rectangle(0, 0, 5, 8); + rectangle(0, 10, 27, 19); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file From f974bccbb0071c61521f072ecf803cb40910e8ab Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Jun 2013 11:50:18 +0200 Subject: [PATCH 0008/1332] AVALANCHE: Remove empty lines with only ";" characters in them. --- engines/avalanche/1stoff.cpp | 5 - engines/avalanche/access.cpp | 15 - engines/avalanche/also.cpp | 120 -------- engines/avalanche/andexor.cpp | 8 - engines/avalanche/andexor2.cpp | 11 - engines/avalanche/andextst.cpp | 6 - engines/avalanche/arch.cpp | 2 - engines/avalanche/avbkgrnd.cpp | 1 - engines/avalanche/avvyans.cpp | 5 - engines/avalanche/avvyans2.cpp | 27 -- engines/avalanche/avvymonk.cpp | 7 - engines/avalanche/bootstrp.cpp | 503 +++++++++++++++++---------------- engines/avalanche/cadburys.cpp | 10 - engines/avalanche/celer.cpp | 1 - engines/avalanche/ch_egats.cpp | 2 - engines/avalanche/charmap.cpp | 4 - engines/avalanche/chunkxf1.cpp | 6 - engines/avalanche/chunkxf2.cpp | 14 - engines/avalanche/chunkxf3.cpp | 10 - engines/avalanche/chunkxf4.cpp | 1 - engines/avalanche/chunkxf5.cpp | 19 -- engines/avalanche/chunkxf6.cpp | 19 -- engines/avalanche/chunkxf7.cpp | 19 -- engines/avalanche/chunkxf8.cpp | 19 -- engines/avalanche/chunkxf9.cpp | 19 -- engines/avalanche/chunkxfa.cpp | 19 -- engines/avalanche/chunkxfb.cpp | 19 -- engines/avalanche/chunkxfc.cpp | 19 -- engines/avalanche/chunkxfd.cpp | 19 -- engines/avalanche/chunkxfe.cpp | 19 -- engines/avalanche/chunkxff.cpp | 19 -- engines/avalanche/chunkxfg.cpp | 19 -- engines/avalanche/chunkxfh.cpp | 19 -- engines/avalanche/chunkxfi.cpp | 19 -- engines/avalanche/chunkxfj.cpp | 1 - engines/avalanche/chunkxfk.cpp | 1 - engines/avalanche/chunkxfl.cpp | 1 - engines/avalanche/clock.cpp | 7 - engines/avalanche/closing.cpp | 11 - engines/avalanche/convert.cpp | 7 - engines/avalanche/convmous.cpp | 11 - engines/avalanche/credits.cpp | 8 - engines/avalanche/displtxt.cpp | 4 - engines/avalanche/dropdown.cpp | 88 ------ engines/avalanche/dwidth.cpp | 1 - engines/avalanche/edhead.cpp | 2 - engines/avalanche/enhanced.cpp | 5 - engines/avalanche/filer.cpp | 49 ---- engines/avalanche/fileunit.cpp | 1 - engines/avalanche/filing.cpp | 8 - engines/avalanche/folktemp.cpp | 4 - engines/avalanche/fontslid.cpp | 2 - engines/avalanche/frere.cpp | 6 - engines/avalanche/g-room.cpp | 25 -- engines/avalanche/golden.cpp | 4 - engines/avalanche/gyro.cpp | 1 - engines/avalanche/gyro.h | 4 +- engines/avalanche/help.cpp | 9 - engines/avalanche/help2.cpp | 28 -- engines/avalanche/helper.cpp | 1 - engines/avalanche/hibits.cpp | 2 - engines/avalanche/highs.cpp | 8 - engines/avalanche/hiz.cpp | 33 --- engines/avalanche/initxf.cpp | 2 - engines/avalanche/inputtes.cpp | 4 - engines/avalanche/intro.cpp | 2 - engines/avalanche/ints.cpp | 3 - engines/avalanche/joysetup.cpp | 11 - engines/avalanche/joystick.cpp | 1 - engines/avalanche/loading.cpp | 2 - engines/avalanche/logger.cpp | 19 -- engines/avalanche/lucerna.cpp | 4 - engines/avalanche/magic2.cpp | 3 - engines/avalanche/magidraw.cpp | 4 +- engines/avalanche/magishuf.cpp | 6 - engines/avalanche/make!.cpp | 4 - engines/avalanche/makeregi.cpp | 209 +++++++------- engines/avalanche/makesez.cpp | 2 - engines/avalanche/makevmou.cpp | 23 +- engines/avalanche/minstran.cpp | 4 - engines/avalanche/newsprit.cpp | 8 - engines/avalanche/nim.cpp | 45 +-- engines/avalanche/nimdraw.cpp | 6 - engines/avalanche/oldfiler.cpp | 24 -- engines/avalanche/oldhighs.cpp | 27 -- engines/avalanche/oldincln.cpp | 18 -- engines/avalanche/oldtrip.cpp | 61 ---- engines/avalanche/omtest.cpp | 19 -- engines/avalanche/oopmenu.cpp | 36 --- engines/avalanche/overlap.cpp | 4 - engines/avalanche/overscro.cpp | 3 - engines/avalanche/particle.cpp | 23 -- engines/avalanche/pictemp.cpp | 5 - engines/avalanche/pictemp2.cpp | 5 - engines/avalanche/pingo.cpp | 16 -- engines/avalanche/plottest.cpp | 5 - engines/avalanche/preview1.cpp | 1 - engines/avalanche/qintro.cpp | 2 - engines/avalanche/qstars.cpp | 1 - engines/avalanche/rawupd.cpp | 1 - engines/avalanche/readsez.cpp | 7 - engines/avalanche/reginam.cpp | 7 - engines/avalanche/sackb1.cpp | 2 - engines/avalanche/saving.cpp | 4 - engines/avalanche/scr_1.cpp | 7 - engines/avalanche/scr_2.cpp | 13 - engines/avalanche/scr_3.cpp | 10 - engines/avalanche/scr_4.cpp | 11 - engines/avalanche/scr_5.cpp | 8 - engines/avalanche/scr_9.cpp | 1 - engines/avalanche/scrolls.cpp | 2 - engines/avalanche/sequence.cpp | 9 - engines/avalanche/setup.cpp | 1 - engines/avalanche/seu.cpp | 4 - engines/avalanche/seu_avvy.cpp | 5 - engines/avalanche/sezedit.cpp | 37 --- engines/avalanche/sezunit.cpp | 8 - engines/avalanche/sezxfr.cpp | 8 - engines/avalanche/shell1.cpp | 1 - engines/avalanche/shell2.cpp | 1 - engines/avalanche/spread.cpp | 31 -- engines/avalanche/spread2.cpp | 95 ------- engines/avalanche/squish.cpp | 1 - engines/avalanche/ss_blank.cpp | 3 - engines/avalanche/ss_clock.cpp | 5 - engines/avalanche/stars.cpp | 1 - engines/avalanche/status.cpp | 2 - engines/avalanche/sticks.cpp | 4 - engines/avalanche/sunrise.cpp | 5 - engines/avalanche/tempo.cpp | 6 - engines/avalanche/test.cpp | 1 - engines/avalanche/test2.cpp | 1 - engines/avalanche/testblit.cpp | 4 - engines/avalanche/testcard.cpp | 4 - engines/avalanche/testenh.cpp | 1 - engines/avalanche/travel.cpp | 5 - engines/avalanche/trip.cpp | 20 -- engines/avalanche/trip3.cpp | 28 -- engines/avalanche/trip42.cpp | 62 ---- engines/avalanche/trip5.cpp | 1 - engines/avalanche/trip5tst.cpp | 8 - engines/avalanche/trip5xf.cpp | 11 - engines/avalanche/tripoop.cpp | 30 -- engines/avalanche/ttmenuxf.cpp | 2 - engines/avalanche/unsquish.cpp | 9 - engines/avalanche/viewdocs.cpp | 12 - engines/avalanche/xf_gover.cpp | 3 - engines/avalanche/xfbutton.cpp | 1 - engines/avalanche/xfghost.cpp | 11 - engines/avalanche/zapdraw.cpp | 3 - 150 files changed, 379 insertions(+), 2106 deletions(-) diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp index 97486055036c..31c87a894d2b 100644 --- a/engines/avalanche/1stoff.cpp +++ b/engines/avalanche/1stoff.cpp @@ -35,9 +35,7 @@ byte fv; void adjust() { registers r; - ; { - ; ax = 0x1012; bx = 1; cx = 2; @@ -51,7 +49,6 @@ void adjust() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 0; clrscr; @@ -66,7 +63,6 @@ int main(int argc, const char *argv[]) { output << "presents"; for (fv = 1; fv <= 77; fv ++) { - ; delay(77); if (fv < 64) fillchar(cols[1], 3, chr(fv)); if (fv > 14) fillchar(cols[2], 3, chr(fv - 14)); @@ -76,7 +72,6 @@ int main(int argc, const char *argv[]) { delay(100); for (fv = 63; fv >= 1; fv --) { - ; fillchar(cols, sizeof(cols), chr(fv)); delay(37); adjust(); diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp index abc944f4dcb0..ba87cd64a4c4 100644 --- a/engines/avalanche/access.cpp +++ b/engines/avalanche/access.cpp @@ -52,19 +52,16 @@ void int_say(string filename, boolean bubble) /* Internal use ONLY! */ { untyped_file f; - ; /*$I-*/ assign(f, filename); reset(f, 1); if (ioresult != 0) { - ; int_say_went_ok = false; return; } bufsize = filesize(f); blockread(f, buffer, bufsize); if (bubble) { - ; bufsize += 1; buffer[bufsize] = '\2'; } @@ -77,7 +74,6 @@ void int_say(string filename, boolean bubble) } void dixi(char p, byte n) { - ; exit(153); int_say(string('s') + p + strf(n) + ".raw", false); } @@ -85,10 +81,8 @@ void dixi(char p, byte n) { void talkto(byte whom) { byte fv; boolean no_matches; - ; exit(153); if (person == pardon) { - ; person = chr(subjnumber); subjnumber = 0; } @@ -97,19 +91,16 @@ void talkto(byte whom) { case pspludwick: if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) { - ; dixi('q', 68); dna.obj[potion] = true; objectlist; points(3); return; } else { - ; if (dna.talked_to_crapulus) switch (dna.given2spludwick) { /* Spludwick - what does he need? */ /* 0 - let it through to use normal routine. */ case RANGE_2(1, 2): { - ; display(string("Can you get me ") + get_better(spludwick_order[dna.given2spludwick]) + ", please?" + "\232\2"); @@ -117,7 +108,6 @@ void talkto(byte whom) { } break; case 3: { - ; dixi('q', 30); /* need any help with the game? */ return; } @@ -129,7 +119,6 @@ void talkto(byte whom) { case pibythneth: if (dna.givenbadgetoiby) { - ; dixi('q', 33); /* Thanks a lot! */ return; /* And leave the proc. */ } @@ -143,7 +132,6 @@ void talkto(byte whom) { break; case payles: if (~ dna.ayles_is_awake) { - ; dixi('q', 43); /* He's fast asleep! */ return; } @@ -152,7 +140,6 @@ void talkto(byte whom) { if (dna.geida_given_potion) dna.geida_follows = true; else { - ; dixi('u', 17); return; } @@ -164,7 +151,6 @@ void talkto(byte whom) { no_matches = true; for (fv = 1; fv <= numtr; fv ++) if (tr[fv].a.accinum == whom) { - ; display(string('\23') + chr(fv + 48) + '\4'); no_matches = false; flush(); @@ -175,7 +161,6 @@ void talkto(byte whom) { if (subjnumber == 0) /* For the moment... later we'll parse "say". */ int_say(string("ss") + strf(whom) + ".raw", true); else { - ; int_say(string("ss") + strf(whom) + '-' + strf(subjnumber) + ".raw", true); if (! int_say_went_ok) /* File not found! */ dixi('n', whom); diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp index 3f3e32a09a75..af3b6c325e78 100644 --- a/engines/avalanche/also.cpp +++ b/engines/avalanche/also.cpp @@ -120,7 +120,6 @@ const graphcursmasktype tthand = { string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; @@ -128,16 +127,13 @@ string strf(longint x) { void glimpse(byte ret) { /* glimpse of screen 3 */ char sink; - ; hidemousecursor; setvisualpage(3); setcrtpagenumber(3); showmousecursor; do { - ; } while (!(~ anymousekeypressed)); do { - ; } while (!anymousekeypressed); hidemousecursor; setvisualpage(ret); @@ -147,10 +143,8 @@ void glimpse(byte ret) { /* glimpse of screen 3 */ } void newline(byte t, integer p, integer q, integer r, integer s, byte c) { - ; { linetype &with = lines[t]; - ; x1 = p; y1 = q; x2 = r; @@ -160,7 +154,6 @@ void newline(byte t, integer p, integer q, integer r, integer s, byte c) { } void newfield(byte t, integer p, integer q, integer r, integer s) { - ; { fieldtype &with = fields[t]; ; with.x1 = p; @@ -171,11 +164,9 @@ void newfield(byte t, integer p, integer q, integer r, integer s) { } void drawped(byte p) { - ; { pedtype &with = peds[p]; if (with.dir < 177) { - ; setcolor(p); circle(with.x, with.y, 5); moveto(with.x, with.y); @@ -211,12 +202,10 @@ void drawped(byte p) { void drawup() { byte fv; - ; cleardevice(); for (fv = 1; fv <= numlines; fv ++) { linetype &with = lines[fv]; if (x1 != nay) { - ; setcolor(with.col); line(x1, y1, x2, y2); } @@ -224,7 +213,6 @@ void drawup() { for (fv = 1; fv <= numlines; fv ++) { fieldtype &with = fields[fv]; if (with.x1 != nay) { - ; setcolor(fv); rectangle(with.x1, with.y1, with.x2, with.y2); } @@ -234,7 +222,6 @@ void drawup() { void addped() { byte n, fv; - ; n = 0; do { n += 1; @@ -252,7 +239,6 @@ void addped() { hidemousecursor; { pedtype &with = peds[n]; - ; with.x = mousex; with.y = mousey; } @@ -301,12 +287,10 @@ void addped() { void addline(byte ccc) { byte fv; - ; do { for (fv = 1; fv <= numlines; fv ++) { linetype &with = lines[fv]; if (x1 == nay) { - ; x1 = fv * 17; x2 = x1; y1 = 200; @@ -321,20 +305,17 @@ void addline(byte ccc) { byte colour() { byte fv; byte colour_result; - ; setactivepage(0); setvisualpage(0); setcrtpagenumber(0); outtextxy(0, 0, "Select a colour, please..."); for (fv = 1; fv <= 15; fv ++) { - ; setfillstyle(1, fv); bar(fv * 40, 27, 39 + fv * 40, 200); } showmousecursor; do { if (rightmousekeypressed) { - ; hidemousecursor; return colour_result; } @@ -349,7 +330,6 @@ byte colour() { void addfield() { byte fv; boolean ok; - ; do { fv = colour(); ok = fields[fv].x1 == nay; @@ -357,7 +337,6 @@ void addfield() { } while (!ok); { fieldtype &with = fields[fv]; - ; with.x1 = 300 + fv * 17; with.x2 = with.x1 + 1; with.y1 = 200; @@ -368,7 +347,6 @@ void addfield() { byte checkline() { byte fv, ans; byte checkline_result; - ; setgraphicscursor(crosshairs); setcrtpagenumber(0); setactivepage(0); @@ -378,7 +356,6 @@ byte checkline() { showmousecursor; do { if (rightmousekeypressed) { - ; checkline_result = 255; return checkline_result; } @@ -388,11 +365,9 @@ byte checkline() { setactivepage(1); ans = 177; for (fv = 1; fv <= numlines; fv ++) { /* */ - ; { linetype &with = lines[fv]; if (x1 != nay) { - ; setcolor(9); line(x1, y1, x2, y2); if (getpixel(mousex, mousey) == 9) ans = fv; @@ -403,7 +378,6 @@ byte checkline() { { fieldtype &with = fields[fv]; if (with.x1 != nay) { - ; setcolor(9); rectangle(with.x1, with.y1, with.x2, with.y2); if (getpixel(mousex, mousey) == 9) ans = fv + 100; @@ -422,7 +396,6 @@ void chooseside(); static boolean itsaline; static void plotline() { - ; if (itsaline) { linetype &with = lines[gd]; if (do1) line(mousex, mousey, x2, y2); @@ -440,12 +413,10 @@ void chooseside() { byte clicol, savelcol; fieldtype current; integer temp; - ; do { gd = checkline(); itsaline = gd < 100; if (gd == 255) { - ; hidemousecursor; return; } @@ -456,12 +427,10 @@ void chooseside() { setgraphicscursor(tthand); setcrtpagenumber(2); if (itsaline) { - ; current = lines[gd]; savelcol = lines[gd].col; } else current = fields[gd]; { - ; setcolor(9); if (itsaline) line(current.x1, current.y1, current.x2, current.y2); else rectangle(current.x1, current.y1, current.x2, current.y2); @@ -471,19 +440,16 @@ void chooseside() { setfillstyle(1, green); bar(current.x2 - 3, current.y2 - 3, current.x2 + 3, current.y2 + 3); do { - ; } while (!(~ anymousekeypressed)); clicol = 177; showmousecursor; do { if (anymousekeypressed) { - ; hidemousecursor; clicol = getpixel(mousex, mousey); showmousecursor; } if (rightmousekeypressed) { - ; hidemousecursor; return; } @@ -507,14 +473,12 @@ void chooseside() { } setwritemode(xorput); while (~ anymousekeypressed) { - ; plotline(); showmousecursor; delay(1); hidemousecursor; plotline(); if (rightmousekeypressed) { - ; hidemousecursor; return; } @@ -522,24 +486,19 @@ void chooseside() { } /* update "current" rec */ if (do1) { - ; current.x1 = mousex; current.y1 = mousey; } else { - ; current.x2 = mousex; current.y2 = mousey; } if (! itsaline) { - ; if (current.x1 > current.x2) { - ; temp = current.x2; current.x2 = current.x1; current.x1 = temp; } if (current.y1 > current.y2) { - ; temp = current.y2; current.y2 = current.y1; current.y1 = temp; @@ -548,7 +507,6 @@ void chooseside() { /* copy "current" to line/field */ if (itsaline) { linetype &with1 = lines[gd]; - ; current.x1 = current.x1; current.x2 = current.x2; current.y1 = current.y1; @@ -561,7 +519,6 @@ void chooseside() { } void delped() { - ; setcrtpagenumber(0); setactivepage(0); setvisualpage(0); @@ -569,7 +526,6 @@ void delped() { setgraphicscursor(tthand); showmousecursor; do { - ; } while (!leftmousekeypressed); peds[colour()].dir = 177; } @@ -577,7 +533,6 @@ void delped() { byte menu(); static void say(byte y, string x) { - ; setfillstyle(1, y); bar(0, y * 17, 100, y * 17 + 15); outtextxy(123, y * 17, x); @@ -586,7 +541,6 @@ static void say(byte y, string x) { byte menu() { byte clicol; byte menu_result; - ; setcolor(15); settextstyle(0, 0, 2); clicol = 0; @@ -605,20 +559,17 @@ byte menu() { showmousecursor; do { if (leftmousekeypressed) { - ; hidemousecursor; clicol = getpixel(mousex, mousey); showmousecursor; } if (rightmousekeypressed) { - ; hidemousecursor; return menu_result; } if (keypressed()) glimpse(2); } while (!(clicol > 0)); do { - ; } while (!(~ anymousekeypressed)); hidemousecursor; menu_result = clicol; @@ -626,10 +577,8 @@ byte menu() { } void removeline() { - ; gd = checkline(); if (gd == 255) { - ; hidemousecursor; return; } @@ -641,7 +590,6 @@ void removeline() { } void lino() { - ; resetmouse; do { switch (menu()) { @@ -674,14 +622,12 @@ void loadscreen() { /* load2 */ byte a /*absolute $A000:246560*/; byte bit; untyped_file f; - ; setactivepage(3); setvisualpage(3); assign(f, string("c:\\avalot\\place") + n + ".avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -697,7 +643,6 @@ void loadscreen() { /* load2 */ void ctrlsout(string &x) { /* Replace real ctrls with caret codes */ byte fv; string xx; - ; xx = ""; for (fv = 1; fv <= length(x); fv ++) if (x[fv] > '\37') xx = xx + x[fv]; @@ -709,12 +654,10 @@ void ctrlsin(string &x) { /* Opposite of ctrlsout */ byte fv; string xx; boolean ctrlwas; - ; xx = ""; ctrlwas = false; for (fv = 1; fv <= length(x); fv ++) if (ctrlwas) { /* last char was a caret */ - ; xx = xx + chr(ord(upcase(x[fv])) - 64); ctrlwas = false; } else { @@ -728,7 +671,6 @@ void ctrlsin(string &x) { /* Opposite of ctrlsout */ void flipover() { /* temp view other screen */ char r; - ; setvisualpage(3); r = readkey(); setvisualpage(0); @@ -736,7 +678,6 @@ void flipover() { /* temp view other screen */ void plotchar(byte x, byte y, char n) { byte fv; - ; if (chars[x][y] == n) return; for (fv = 0; fv <= 15; fv ++) mem[0xa000 * y * 1200 + (fv + 3) * 80 + x] = skinny[ord(n)][fv]; @@ -745,7 +686,6 @@ void plotchar(byte x, byte y, char n) { void cursor() { byte fv; - ; cursorflash += 1; switch (cursorflash) { case 1: @@ -760,9 +700,7 @@ void cursor() { } void losecursor() { - ; if (cursorflash < 127) { - ; cursorflash = 126; cursor(); } @@ -771,13 +709,10 @@ void losecursor() { void gwrite(string x) { byte fv; - ; for (fv = 1; fv <= length(x); fv ++) { - ; plotchar(tx, ty, x[fv]); tx += 1; if (tx == 80) { - ; ty += 1; tx = 0; } @@ -789,7 +724,6 @@ string typein(string x) { byte p; char r; string typein_result; - ; setvisualpage(0); setactivepage(0); cleardevice(); @@ -812,7 +746,6 @@ string typein(string x) { tx = (p % 80); ty = (p / 80) + 6; while (! keypressed()) { - ; delay(1); cursor(); } @@ -821,7 +754,6 @@ string typein(string x) { switch (r) { case '\10': if (p > 0) { - ; x = copy(x, 1, p - 1) + copy(x, p + 1, 255); p -= 1; } @@ -830,7 +762,6 @@ string typein(string x) { flipover(); break; case '\40' ... '\377': { - ; x = copy(x, 1, p) + r + copy(x, p + 1, 255); p += 1; } @@ -873,7 +804,6 @@ byte typeno(string title) { integer e; word p; byte typeno_result; - ; cleardevice(); x = "000"; settextstyle(0, 0, 3); @@ -889,7 +819,6 @@ byte typeno(string title) { r = readkey(); } while (!(set::of(range('0', '9'), '\33', '\15', eos).has(r))); if (r == '\33') { - ; typeno_result = 255; return typeno_result; } @@ -904,7 +833,6 @@ void showallnames() { byte fv; varying_string<2> s; char r; - ; settextstyle(0, 0, 2); cleardevice(); setcolor(13); @@ -912,7 +840,6 @@ void showallnames() { settextstyle(0, 0, 1); setcolor(7); for (fv = 1; fv <= 29; fv ++) { - ; str(fv, 2, s); outtextxy((fv / 15) * 320, ((fv % 15) * 10) + 30, s + '=' + copy(names[fv][1], 0, 33)); } @@ -925,7 +852,6 @@ void showallassoc(); static void saascreen() { - ; settextstyle(0, 0, 2); cleardevice(); setcolor(10); @@ -940,15 +866,12 @@ void showallassoc() { varying_string<2> s; char r; - ; saascreen(); for (fv = 1; fv <= 30; fv ++) { - ; str(fv - 1, 2, s); outtextxy(0, (((fv - 1) % 10) * 10) + 30, s + ':' + copy(names[fv - 1][1], 1, 7) + ':' + copy(names[fv - 1][2], 1, 70)); if ((fv % 10) == 0) { - ; r = readkey(); saascreen(); } @@ -960,10 +883,8 @@ void showallassoc() { void clear() { byte fv; - ; fillchar(names , sizeof(names), '\0'); for (fv = 1; fv <= numlines; fv ++) { - ; lines[fv].x1 = nay; fields[fv].x1 = nay; } @@ -974,14 +895,12 @@ void scramble(); static void scram1(string &x) { byte fz; - ; for (fz = 1; fz <= length(x); fz ++) x[fz] = chr(ord(x[fz]) ^ 177); } void scramble() { /* Works both ways. */ byte fv, ff; - ; for (fv = 0; fv <= 29; fv ++) for (ff = 1; ff <= 2; ff ++) scram1(names[fv][ff]); @@ -993,7 +912,6 @@ void save() { string x; untyped_file f; byte minnames, minlines, minpeds, minfields, fv, ff; - ; minnames = 0; for (fv = 0; fv <= 29; fv ++) if (names[fv][1] != "") minnames = fv; minlines = 0; @@ -1036,7 +954,6 @@ static string nextstring() { byte l; string x; string nextstring_result; - ; x = ""; blockread(f, l, 1); blockread(f, x[1], l); @@ -1049,7 +966,6 @@ void load() { byte minnames, minlines, minpeds, minfields; byte ff, fv; - ; clear(); assign(f, string("c:\\avalot\\also") + n + ".avd"); /*$I-*/ reset(f, 1); /*$I+*/ if (ioresult != 0) return; /* no Also file */ @@ -1081,60 +997,50 @@ static integer y; static void display() { byte fv; - ; cleardevice(); settextstyle(0, 0, 2); setcolor(15); outtextxy(0, 0, "Magics."); settextstyle(0, 0, 1); for (fv = 1; fv <= 15; fv ++) { - ; y = 23 + fv * 10; setcolor(fv); outtextxy(100, y, string('$') + codes[fv - 1]); { magictype &with = magics[fv]; - ; switch (with.op) { case nix: { - ; setcolor(8); outtextxy(140, y, "Nix"); } break; case bounce: { - ; setcolor(10); outtextxy(143, y, "Bounce!"); } break; case exclaim: { - ; setcolor(14); outtextxy(143, y, string("Exclaim: ") + strf(with.data)); } break; case transport: { - ; setcolor(12); outtextxy(143, y, string("Transport to ") + strf(hi(with.data)) + ", ped " + strf(lo(with.data))); } break; case unfinished: { - ; setcolor(15); outtextxy(143, y, "*** UNFINISHED! ***"); } break; case special: { - ; setcolor(6); outtextxy(143, y, string("Special call no. ") + strf(with.data)); } break; case opendoor: { - ; setcolor(11); outtextxy(143, y, string("Opening door to ") + strf(hi(with.data)) + ", ped " + strf(lo(with.data))); @@ -1153,7 +1059,6 @@ static word ask(string x) { word thomaswashere; integer e; word ask_result; - ; cleardevice(); setcolor(10); settextstyle(0, 0, 3); @@ -1170,7 +1075,6 @@ void editmagics() { char r, rr; byte p; - ; do { display(); do { @@ -1199,13 +1103,11 @@ void editmagics() { with.op = bounce; break; case 'E': { - ; with.op = exclaim; with.data = ask("Which scroll?"); } break; case 'T': { - ; with.op = transport; with.data = ask("Ped no.?") + ask("Whither?") * 256; } @@ -1214,13 +1116,11 @@ void editmagics() { with.op = unfinished; break; case 'S': { - ; with.op = special; with.data = ask("Which call?"); } break; case 'O': { - ; with.op = opendoor; with.data = ask("Ped no.?") + ask("Whither?") * 256; } @@ -1238,54 +1138,45 @@ static integer y2; static void display1() { byte fv; - ; cleardevice(); settextstyle(0, 0, 2); setcolor(15); outtextxy(0, 0, "Portals."); settextstyle(0, 0, 1); for (fv = 9; fv <= 15; fv ++) { - ; y2 = fv * 10 - 53; setcolor(fv); outtextxy(100, y2, string('$') + codes1[fv - 1]); { magictype &with = portals[fv]; - ; switch (with.op) { case nix: { - ; setcolor(8); outtextxy(140, y2, "Nix"); } break; case exclaim: { - ; setcolor(14); outtextxy(143, y2, string("Exclaim: ") + strf(with.data)); } break; case transport: { - ; setcolor(12); outtextxy(143, y2, string("Transport to ") + strf(hi(with.data)) + ", ped " + strf(lo(with.data))); } break; case unfinished: { - ; setcolor(15); outtextxy(143, y2, "*** UNFINISHED! ***"); } break; case special: { - ; setcolor(6); outtextxy(143, y2, string("Special call no. ") + strf(with.data)); } break; case opendoor: { - ; setcolor(11); outtextxy(143, y2, string("Opening door to ") + strf(hi(with.data)) + ", ped " + strf(lo(with.data))); @@ -1304,7 +1195,6 @@ static word ask1(string x) { word thomaswashere; integer e; word ask1_result; - ; cleardevice(); setcolor(10); settextstyle(0, 0, 3); @@ -1321,7 +1211,6 @@ void editportals() { /* much t'same as editmagics */ char r, rr; byte p; - ; do { display1(); do { @@ -1348,13 +1237,11 @@ void editportals() { /* much t'same as editmagics */ with.op = nix; break; case 'E': { - ; with.op = exclaim; with.data = ask1("Which scroll?"); } break; case 'T': { - ; with.op = transport; with.data = ask1("Ped no.?") + ask1("Whither?") * 256; } @@ -1363,13 +1250,11 @@ void editportals() { /* much t'same as editmagics */ with.op = unfinished; break; case 'S': { - ; with.op = special; with.data = ask1("Which call?"); } break; case 'O': { - ; with.op = opendoor; with.data = ask1("Ped no.?") + ask1("Whither?") * 256; } @@ -1381,7 +1266,6 @@ void editportals() { /* much t'same as editmagics */ void editflags() { char r; - ; cleardevice(); settextstyle(0, 0, 2); setcolor(15); @@ -1400,7 +1284,6 @@ void editflags() { } while (!(set::of(range('A', 'Z'), '\33', '\15', '\11', eos).has(r))); switch (r) { case RANGE_26('A', 'Z'): { - ; if (pos(r, flags) > 0) { ; /* flag is on- switch it off */ Delete(flags, pos(r, flags), 1); @@ -1432,7 +1315,6 @@ void editflags() { void alsomenu() { char r; byte t; - ; do { setactivepage(0); setvisualpage(0); @@ -1463,7 +1345,6 @@ void alsomenu() { } while (!(set::of(range('1', '9'), 'S', 'L', '\0', eos).has(r))); switch (r) { case '1': { - ; do { t = typeno("Which object\? (0-30)"); } while (!((t < 30) || (t == 255))); @@ -1510,7 +1391,6 @@ void alsomenu() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; output << "*** ALSO ***" << NL; output << NL; output << "No. of screen to edit?"; diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp index b57585d3c6d4..74b5967f1b45 100644 --- a/engines/avalanche/andexor.cpp +++ b/engines/avalanche/andexor.cpp @@ -56,7 +56,6 @@ void load(string nam) { varying_string<40> xxx; string check; - ; assign(f, nam); reset(f, 1); blockread(f, xxx, 41); @@ -64,7 +63,6 @@ void load(string nam) { blockread(f, check, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(a[z], s); blockread(f, a[z], s); putimage(0, 15 + (z - 1) * 75, a[z], 0); @@ -75,7 +73,6 @@ void load(string nam) { void silhouette() { byte x, y, c; - ; setvisualpage(1); setactivepage(1); setfillstyle(1, 15); @@ -85,7 +82,6 @@ void silhouette() { /* bar((gm div 2)*320+gd*40,20+(gm mod 2)*40,(gm div 2)*320+gd*40+35,(gm mod 2)*40+60); */ for (y = 1; y <= adx.yl; y ++) for (x = 1; x <= adx.xl; x ++) { - ; setactivepage(0); c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); setactivepage(1); @@ -101,7 +97,6 @@ void silhouette() { void standard() { byte x, y, c; - ; setvisualpage(2); setactivepage(2); for (gm = 0; gm <= 3; gm ++) @@ -109,7 +104,6 @@ void standard() { ; /* 26,15 */ for (y = 1; y <= adx.yl; y ++) for (x = 1; x <= adx.xl; x ++) { - ; setactivepage(0); c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); setactivepage(2); @@ -124,7 +118,6 @@ void standard() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -133,7 +126,6 @@ int main(int argc, const char *argv[]) { /* getmem(adxpic[1,1,1],adx.size); getimage(40,20,75,60,adxpic[1,1,1]^); putimage(100,100,adxpic[1,1,1]^,0); */ { - ; adx.name = "Avalot"; adx.num = 24; adx.seq = 6; diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp index 605a18534308..27c62cf0363f 100644 --- a/engines/avalanche/andexor2.cpp +++ b/engines/avalanche/andexor2.cpp @@ -59,7 +59,6 @@ void load(string n) { varying_string<40> xxx; string check; - ; assign(f, n); reset(f, 1); blockread(f, xxx, 41); @@ -67,7 +66,6 @@ void load(string n) { blockread(f, check, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(a[z], s); blockread(f, a[z], s); putimage(0, 15 + (z - 1) * 75, a[z], 0); @@ -78,19 +76,16 @@ void load(string n) { void silhouette() { byte x, y, c; - ; setvisualpage(1); setactivepage(1); setfillstyle(1, 15); { - ; for (gm = 0; gm <= 3; gm ++) for (gd = 1; gd <= 6; gd ++) { ; /* 26,15 */ side2 = adx.xl * 6; for (y = 1; y <= adx.yl; y ++) for (x = 1; x <= adx.xl; x ++) { - ; setactivepage(0); c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); setactivepage(1); @@ -107,17 +102,14 @@ void silhouette() { void standard() { byte x, y, c; - ; setvisualpage(2); setactivepage(2); { - ; for (gm = 0; gm <= 3; gm ++) for (gd = 1; gd <= 6; gd ++) { ; /* 26,15 */ for (y = 1; y <= adx.yl; y ++) for (x = 1; x <= adx.xl; x ++) { - ; setactivepage(0); c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); setactivepage(2); @@ -137,14 +129,12 @@ void standard() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); fillchar(adxpic, sizeof(adxpic), '\261'); load("v:avalots.avd"); { - ; adx.name = "Avalot"; adx.num = 24; adx.seq = 6; @@ -164,7 +154,6 @@ int main(int argc, const char *argv[]) { blockwrite(f, adx, sizeof(adx)); blockwrite(f, bigsize, 2); for (gm = 0; gm <= 1; gm ++) { - ; putimage(0, 0, adxpic[gm], 0); blockwrite(f, adxpic[gm], bigsize); /* next image */ } diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp index b5e1d9a5badf..39ba3df4056e 100644 --- a/engines/avalanche/andextst.cpp +++ b/engines/avalanche/andextst.cpp @@ -41,21 +41,18 @@ integer x; array<0, 1, integer> ox; void andex(integer x, integer y, byte n, byte num) { - ; putimage(x, y, adx[num][n][0], andput); putimage(x, y, adx[num][n][1], xorput); } void loadadx(byte num, string x) { byte n; - ; assign(f, x); reset(f, 1); seek(f, 59); blockread(f, n, 1); /* No. of images... */ for (gd = 1; gd <= n; gd ++) for (gm = 0; gm <= 1; gm ++) { - ; blockread(f, s, 2); /* size of next image... */ getmem(adx[num][gd][gm], s); blockread(f, adx[num][gd][gm], s); /* next image */ @@ -65,14 +62,12 @@ void loadadx(byte num, string x) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; loadadx(0, "d:sprite0.avd"); loadadx(1, "d:sprite0.avd"); gd = 3; gm = 0; initgraph(gd, gm, ""); for (gd = 0; gd <= 1; gd ++) { - ; setactivepage(gd); setfillstyle(6, 1); bar(0, 0, 640, 200); @@ -87,7 +82,6 @@ int main(int argc, const char *argv[]) { setactivepage(cp); setvisualpage(1 - cp); for (gm = 0; gm <= 1; gm ++) { - ; if (t > 0) t -= 1; else putimage(ox[cp], 77, back[cp], copyput); diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp index 2172a574a0e4..1f0e1a4bde4e 100644 --- a/engines/avalanche/arch.cpp +++ b/engines/avalanche/arch.cpp @@ -97,13 +97,11 @@ void save(string name) { edhead eh; word groi; string groi2; - ; fillchar(eh, sizeof(eh), '\261'); /* Fill up the edhead */ dna.saves += 1; /* It's been saved one more time... */ { - ; /* Info about this program */ diff --git a/engines/avalanche/avbkgrnd.cpp b/engines/avalanche/avbkgrnd.cpp index 7ab263049b1e..2bb628828e04 100644 --- a/engines/avalanche/avbkgrnd.cpp +++ b/engines/avalanche/avbkgrnd.cpp @@ -33,7 +33,6 @@ namespace Avalanche { integer gd, gm; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp index f91435fef277..8e0876061e14 100644 --- a/engines/avalanche/avvyans.cpp +++ b/engines/avalanche/avvyans.cpp @@ -39,7 +39,6 @@ string x; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -63,18 +62,14 @@ int main(int argc, const char *argv[]) { */ for (gm = 0; gm <= 17; gm ++) for (gd = 0; gd <= 27; gd ++) { - ; gotoxy(gd + 1, gm + 1); if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { - ; textattr = cols[gd][2 * gm]; output << ''; } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { - ; textattr = cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16; output << ''; } else { - ; textattr = cols[gd][2 * gm] * 16 + cols[gd][2 * gm + 1]; if (textattr > blink) textattr -= blink; output << ''; diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp index a4fb34aad647..fe238b309eaa 100644 --- a/engines/avalanche/avvyans2.cpp +++ b/engines/avalanche/avvyans2.cpp @@ -43,7 +43,6 @@ byte cfg, cbg; /* Current foreground & background. */ byte ofg, obg; /* Old fg & bg. */ void do_spaces() { - ; if (spaces == 0) return; along(spaces); spaces = 0; @@ -53,17 +52,14 @@ void finishline(); static byte wx, wy; static void jumpto(byte xx) { - ; along(xx - wx); } void finishline() { - ; wx = 29 - spaces; wy = gm + 1; switch (wy) { case 1: { - ; sgr(7); jumpto(35); output << "Back in good old A.D. "; @@ -75,20 +71,16 @@ void finishline() { } break; case RANGE_5(3, 7): { - ; t >> x >> NL; while (x[length(x)] == '\40') x[0] -= 1; if (x != "") { - ; jumpto(30); sgr(9); spaces = 0; while (x != "") { - ; if (x[1] == ' ') spaces += 1; else { - ; do_spaces(); output << x[1]; } @@ -100,7 +92,6 @@ void finishline() { } break; case 8: { - ; jumpto(67); sgr(9); output << "d'Argent" << NL; @@ -108,42 +99,36 @@ void finishline() { } break; case 11: { - ; jumpto(37); sgr(14); output << "He's back..." << NL; } break; case 13: { - ; jumpto(47); sgr(14); output << "And this time," << NL; } break; case 14: { - ; jumpto(52); sgr(14); output << "he's wearing tights..." << NL; } break; case 16: { - ; jumpto(35); sgr(4); output << "A Thorsoft of Letchworth game. * Requires EGA" << NL; } break; case 17: { - ; jumpto(37); sgr(4); output << "and HD. * By Mike, Mark and Thomas Thurman." << NL; } break; case 18: { - ; jumpto(39); sgr(4); output << "Sfx archive- "; @@ -162,7 +147,6 @@ void finishline() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -187,43 +171,34 @@ int main(int argc, const char *argv[]) { reset(t); for (gm = 0; gm <= 17; gm ++) { - ; spaces = 0; for (gd = 0; gd <= 27; gd ++) { - ; if ((gd == 22) && (gm == 4)) { - ; do_spaces(); sgr(red); output << ''; } else { - ; if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { - ; if (cols[gd][2 * gm] == 0) spaces += 1; /* a blank space */ else { - ; do_spaces(); if (cfg == cols[gd][2 * gm]) output << ''; else if (cbg == cols[gd][2 * gm]) output << ' '; else { - ; sgr((cols[gd][2 * gm]) + (cbg * 16)); cfg = cols[gd][2 * gm]; output << ''; } } } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { - ; do_spaces(); sgr(cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16); cfg = cols[gd][2 * gm]; cbg = cols[gd][2 * gm + 1] * 16; output << ''; } else { - ; do_spaces(); ofg = cfg; @@ -232,12 +207,10 @@ int main(int argc, const char *argv[]) { cfg = cols[gd][2 * gm + 1]; if ((cbg == ofg) && (cfg == obg)) { - ; n = cfg * 16 + cbg; if (n > 128) n -= 128; output << ''; } else { - ; n = cbg * 16 + cfg; if (n > 128) n -= 128; if ((cfg != ofg) || (cbg != obg)) sgr(n); diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp index 4f150e33d7a9..b29072f359ce 100644 --- a/engines/avalanche/avvymonk.cpp +++ b/engines/avalanche/avvymonk.cpp @@ -44,7 +44,6 @@ void savesc() { word s; varying_string<14> nam; varying_string<30> screenname; - ; nam = "v:avvymonk.avd"; adf = string("aved as a stuff file, so there! TJAT.") + '\15' + '\12' + '\32'; adf[0] = 'S'; @@ -56,7 +55,6 @@ void savesc() { blockwrite(f, screenname, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(c[z], s); getimage(0, 15 + (z - 1) * 75, getmaxx(), 15 + (z) * 75, c[z]); blockwrite(f, c[z], s); @@ -64,7 +62,6 @@ void savesc() { } } void loadscreen(string nam) { - ; assign(f, nam); reset(f, 1); blockread(f, check, 41); @@ -72,7 +69,6 @@ void loadscreen(string nam) { blockread(f, check, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(a[z], s); blockread(f, a[z], s); setactivepage(0); @@ -83,7 +79,6 @@ void loadscreen(string nam) { } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; x = 0; @@ -91,7 +86,6 @@ int main(int argc, const char *argv[]) { initgraph(gd, gm, "o:"); loadscreen("v:legion.avd"); while (y < 100) { - ; switch (getpixel(x, y)) { case 7: putpixel(x, y, 0); @@ -105,7 +99,6 @@ int main(int argc, const char *argv[]) { } x += 1; if (x > 640) { - ; y += 1; x = 0; } diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp index 905944796a28..add361327a0f 100644 --- a/engines/avalanche/bootstrp.cpp +++ b/engines/avalanche/bootstrp.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -39,21 +39,23 @@ const integer run_dosshell = 2; const integer run_ghostroom = 3; const integer run_golden = 4; -const array > runcodes = {{"et","Go"}}; +const array > runcodes = {{"et", "Go"}}; const integer reset_ = 0; -const boolean jsb = true; const boolean no_jsb = false; -const boolean bflight = true; const boolean no_bflight = false; +const boolean jsb = true; +const boolean no_jsb = false; +const boolean bflight = true; +const boolean no_bflight = false; struct { - byte operation; - word skellern; - array<1,10000,byte> contents; + byte operation; + word skellern; + array<1, 10000, byte> contents; } storage; -string arguments,demo_args,args_with_no_filename; +string arguments, demo_args, args_with_no_filename; boolean first_time; @@ -64,314 +66,339 @@ string segofs; boolean zoomy; -longint soundcard,speed,baseaddr,irq,dma; +longint soundcard, speed, baseaddr, irq, dma; -void cursor_off() /*assembler; */ -{; -/* asm - mov ah,01; { Change cursor size. */ -/* mov cx,8224; { CH & CL are now 32. */ -/* int $10; { Call the Bios */ +void cursor_off() { /*assembler; */ + ; + /* asm + mov ah,01; { Change cursor size. */ + /* mov cx,8224; { CH & CL are now 32. */ + /* int $10; { Call the Bios */ } /* That's all. */ -void cursor_on() /*assembler; */ -{; -/* -asm - mov ah,01; { Change cursor size. */ -/* mov ch,5; { Top line is 5. */ -/* mov cl,7; { Bottom line is 7. */ -/* int $10; { Call the Bios. */ +void cursor_on() { /*assembler; */ + ; + /* + asm + mov ah,01; { Change cursor size. */ + /* mov ch,5; { Top line is 5. */ + /* mov cl,7; { Bottom line is 7. */ + /* int $10; { Call the Bios. */ } -void quit() -{ - cursor_on(); - exit(0); +void quit() { + cursor_on(); + exit(0); } -string strf(longint x) -{ - string q; -string strf_result; -; - str(x,q); strf_result=q; -return strf_result; +string strf(longint x) { + string q; + string strf_result; + ; + str(x, q); + strf_result = q; + return strf_result; } -string command_com() -{ - string temp; +string command_com() { + string temp; - string command_com_result; - temp=getenv("comspec"); - if (temp=="") - output << "avvy_bootstrap: COMSPEC not defined, => cannot run Dos shell." << NL; - command_com_result=temp; - return command_com_result; + string command_com_result; + temp = getenv("comspec"); + if (temp == "") + output << "avvy_bootstrap: COMSPEC not defined, => cannot run Dos shell." << NL; + command_com_result = temp; + return command_com_result; } -void explain(byte error) -{ - output << " ("; - switch (error) { - case 2: output << "it's not there"; break; - case 8: output << "out of memory"; break; - default: output << "error " << error; - } - output << ")." << NL; +void explain(byte error) { + output << " ("; + switch (error) { + case 2: + output << "it's not there"; + break; + case 8: + output << "out of memory"; + break; + default: + output << "error " << error; + } + output << ")." << NL; } /*$F+*/ -void b_flight() /*interrupt;*/ -{ - storage.skellern += 1; +void b_flight() { /*interrupt;*/ + storage.skellern += 1; } /*$F-*/ -void bflight_on() -{ - storage.skellern=reset_; - setintvec(0x1c,&b_flight); +void bflight_on() { + storage.skellern = reset_; + setintvec(0x1c, &b_flight); } -void bflight_off() -{ - setintvec(0x1c,old_1c); +void bflight_off() { + setintvec(0x1c, old_1c); } -void run(string what, boolean with_jsb,boolean with_bflight, elm how); - - -static string elm2str(elm how) -{ - string elm2str_result; - switch (how) { - case normal: case musical: elm2str_result="jsb"; break; - case regi: elm2str_result="REGI"; break; - case elmpoyten: elm2str_result="ELMPOYTEN"; break; - } - return elm2str_result; +void run(string what, boolean with_jsb, boolean with_bflight, elm how); + + +static string elm2str(elm how) { + string elm2str_result; + switch (how) { + case normal: + case musical: + elm2str_result = "jsb"; + break; + case regi: + elm2str_result = "REGI"; + break; + case elmpoyten: + elm2str_result = "ELMPOYTEN"; + break; + } + return elm2str_result; } -void run(string what, boolean with_jsb,boolean with_bflight, elm how) -{ - string which_dir,args; - integer error; +void run(string what, boolean with_jsb, boolean with_bflight, elm how) { + string which_dir, args; + integer error; - if (what=="") return; + if (what == "") return; - getdir(0,which_dir); + getdir(0, which_dir); - if (with_jsb) - { - if (how==musical) - args=elm2str(how)+' '+args_with_no_filename; /* FN is NOT given if musical*/ - else - args=elm2str(how)+' '+arguments; - } else args=""; + if (with_jsb) { + if (how == musical) + args = elm2str(how) + ' ' + args_with_no_filename; /* FN is NOT given if musical*/ + else + args = elm2str(how) + ' ' + arguments; + } else args = ""; - if (how==musical) args=args+strf(soundcard)+' '+strf(speed)+' '+ - strf(baseaddr)+' '+strf(dma)+' '+strf(irq); - if (with_bflight) bflight_on(); + if (how == musical) args = args + strf(soundcard) + ' ' + strf(speed) + ' ' + + strf(baseaddr) + ' ' + strf(dma) + ' ' + strf(irq); + if (with_bflight) bflight_on(); - swapvectors; - exec(what,args); - swapvectors; - cursor_off(); + swapvectors; + exec(what, args); + swapvectors; + cursor_off(); - error=doserror; + error = doserror; - if (with_bflight) bflight_off(); + if (with_bflight) bflight_off(); - chdir(which_dir); + chdir(which_dir); - if (error!=0) - { - output << "avvy_bootstrap: cannot execute " << what << '!'; - explain(error); - output << "Press Enter:"; input >> NL; quit(); - } + if (error != 0) { + output << "avvy_bootstrap: cannot execute " << what << '!'; + explain(error); + output << "Press Enter:"; + input >> NL; + quit(); + } } -void run_avalot() -{ - integer error; +void run_avalot() { + integer error; - bflight_on(); + bflight_on(); - swapvectors; - exec("avalot.avx",runcodes[first_time]+arguments); - swapvectors; + swapvectors; + exec("avalot.avx", runcodes[first_time] + arguments); + swapvectors; - error=doserror; + error = doserror; - bflight_off(); + bflight_off(); - if (error!=0) - { - output << "avvy_bootstrap: error in loading AVALOT.AVX!"; - explain(error); - quit(); - } + if (error != 0) { + output << "avvy_bootstrap: error in loading AVALOT.AVX!"; + explain(error); + quit(); + } - first_time=false; + first_time = false; } -void run_the_demo() -{ - string args; +void run_the_demo() { + string args; - args=arguments; - arguments=demo_args; /* Force the demo. */ + args = arguments; + arguments = demo_args; /* Force the demo. */ - run_avalot(); + run_avalot(); - arguments=args; /* Put all back to normal again. */ - first_time=true; + arguments = args; /* Put all back to normal again. */ + first_time = true; } -void get_arguments() -{ - byte fv; +void get_arguments() { + byte fv; - arguments=""; + arguments = ""; - for( fv=1; fv <= paramcount; fv ++) - arguments=arguments+paramstr(fv)+' '; + for (fv = 1; fv <= paramcount; fv ++) + arguments = arguments + paramstr(fv) + ' '; - arguments[0] -= 1; /* Get rid of the trailing space. */ + arguments[0] -= 1; /* Get rid of the trailing space. */ - segofs=string(' ')+strf(seg(storage))+' '+strf(ofs(storage)); + segofs = string(' ') + strf(seg(storage)) + ' ' + strf(ofs(storage)); - arguments=segofs+' '+arguments; + arguments = segofs + ' ' + arguments; } -void dos_shell() -{ - registers r; +void dos_shell() { + registers r; - r.ax=original_mode; intr(0x10,r); - output << NL; - output << "The Avalot Dos Shell." << NL; - output << "---------------------" << NL; - output << NL; - output << "Type EXIT to return to Avalot." << NL; - output << NL; + r.ax = original_mode; + intr(0x10, r); + output << NL; + output << "The Avalot Dos Shell." << NL; + output << "---------------------" << NL; + output << NL; + output << "Type EXIT to return to Avalot." << NL; + output << NL; - cursor_on(); - run(command_com(),no_jsb,no_bflight,normal); - cursor_off(); + cursor_on(); + run(command_com(), no_jsb, no_bflight, normal); + cursor_off(); - output << "Please wait, restoring your game..." << NL; + output << "Please wait, restoring your game..." << NL; } boolean keypressed1() { - registers r; + registers r; - boolean keypressed1_result; - r.ah=0xb; - msdos(r); - keypressed1_result=r.al==0xff; - return keypressed1_result; - } + boolean keypressed1_result; + r.ah = 0xb; + msdos(r); + keypressed1_result = r.al == 0xff; + return keypressed1_result; +} void flush_buffer() { - registers r; r.ah=7; - while (keypressed1()) msdos(r); } + registers r; + r.ah = 7; + while (keypressed1()) msdos(r); +} -void demo() -{ - run_the_demo(); if (keypressed1()) return; - run("intro.avx",jsb,bflight,musical); if (keypressed1()) return; - run("stars.avx",jsb,no_bflight,musical); if (keypressed1()) return; +void demo() { + run_the_demo(); + if (keypressed1()) return; + run("intro.avx", jsb, bflight, musical); + if (keypressed1()) return; + run("stars.avx", jsb, no_bflight, musical); + if (keypressed1()) return; - flush_buffer(); + flush_buffer(); } -void call_menu() -{ - run("stars.avx",jsb,no_bflight,musical); - flush_buffer(); - do { - run("avmenu.avx",jsb,no_bflight,normal); - - switch (storage.operation) { - case 1: return; break; /* Play the game. */ - case 2: run("intro.avx",jsb,bflight,musical); break; - case 3: run("preview1.avd",jsb,no_bflight,normal); break; - case 4: run("viewdocs.avx",jsb,bflight,elmpoyten); break; - case 5: run("viewdocs.avx",jsb,bflight,regi); break; - case 6: quit(); break; - case 177: demo(); break; - } - - flush_buffer(); - } while (!false); +void call_menu() { + run("stars.avx", jsb, no_bflight, musical); + flush_buffer(); + do { + run("avmenu.avx", jsb, no_bflight, normal); + + switch (storage.operation) { + case 1: + return; + break; /* Play the game. */ + case 2: + run("intro.avx", jsb, bflight, musical); + break; + case 3: + run("preview1.avd", jsb, no_bflight, normal); + break; + case 4: + run("viewdocs.avx", jsb, bflight, elmpoyten); + break; + case 5: + run("viewdocs.avx", jsb, bflight, regi); + break; + case 6: + quit(); + break; + case 177: + demo(); + break; + } + + flush_buffer(); + } while (!false); } -void get_slope() -{ - run("slope.avx",jsb,no_bflight,normal); - if (dosexitcode!=0) - { - cursor_on(); - exit(0); - } - - move(storage.contents,arguments,sizeof(arguments)); - move(storage.contents[4998],soundcard,4); - move(storage.contents[5002],baseaddr,4); - move(storage.contents[5006],irq,4); - move(storage.contents[5010],dma,4); - move(storage.contents[5014],speed,4); - - zoomy=(arguments[8]=='y') || (arguments[2]=='y'); - demo_args=arguments; demo_args[7]='y'; - arguments=segofs+' '+arguments; - demo_args=segofs+' '+demo_args; - - args_with_no_filename=arguments; - if (arguments[length(arguments)]!=' ') - { /* Filename was given */ - args_with_no_filename=arguments; - while ((args_with_no_filename!="") - && (args_with_no_filename[length(args_with_no_filename)]!=' ')) - args_with_no_filename[0] -= 1; /* Strip off the filename. */ - } +void get_slope() { + run("slope.avx", jsb, no_bflight, normal); + if (dosexitcode != 0) { + cursor_on(); + exit(0); + } + + move(storage.contents, arguments, sizeof(arguments)); + move(storage.contents[4998], soundcard, 4); + move(storage.contents[5002], baseaddr, 4); + move(storage.contents[5006], irq, 4); + move(storage.contents[5010], dma, 4); + move(storage.contents[5014], speed, 4); + + zoomy = (arguments[8] == 'y') || (arguments[2] == 'y'); + demo_args = arguments; + demo_args[7] = 'y'; + arguments = segofs + ' ' + arguments; + demo_args = segofs + ' ' + demo_args; + + args_with_no_filename = arguments; + if (arguments[length(arguments)] != ' ') { + /* Filename was given */ + args_with_no_filename = arguments; + while ((args_with_no_filename != "") + && (args_with_no_filename[length(args_with_no_filename)] != ' ')) + args_with_no_filename[0] -= 1; /* Strip off the filename. */ + } } -int main(int argc, const char* argv[]) -{ - pio_initialize(argc, argv); - original_mode=mem[seg0040*0x49]; getintvec(0x1c,old_1c); - first_time=true; cursor_off(); - - get_arguments(); - get_slope(); - - if (! zoomy) call_menu(); /* Not run when zoomy. */ - - do { - run_avalot(); - - if (dosexitcode!=77) quit(); /* Didn't stop for us. */ - - switch (storage.operation) { - case run_shootemup: run("seu.avx",jsb,bflight,normal); break; - case run_dosshell: dos_shell(); break; - case run_ghostroom: run("g-room.avx",jsb,no_bflight,normal); break; - case run_golden: run("golden.avx",jsb,bflight,musical); break; - } - - } while (!false); - return EXIT_SUCCESS; +int main(int argc, const char *argv[]) { + pio_initialize(argc, argv); + original_mode = mem[seg0040 * 0x49]; + getintvec(0x1c, old_1c); + first_time = true; + cursor_off(); + + get_arguments(); + get_slope(); + + if (! zoomy) call_menu(); /* Not run when zoomy. */ + + do { + run_avalot(); + + if (dosexitcode != 77) quit(); /* Didn't stop for us. */ + + switch (storage.operation) { + case run_shootemup: + run("seu.avx", jsb, bflight, normal); + break; + case run_dosshell: + dos_shell(); + break; + case run_ghostroom: + run("g-room.avx", jsb, no_bflight, normal); + break; + case run_golden: + run("golden.avx", jsb, bflight, musical); + break; + } + + } while (!false); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp index f653ad892495..9b12b39555b1 100644 --- a/engines/avalanche/cadburys.cpp +++ b/engines/avalanche/cadburys.cpp @@ -39,9 +39,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; exit(0); @@ -52,13 +50,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -74,7 +70,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -85,7 +80,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -103,11 +97,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; @@ -116,7 +108,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -133,7 +124,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index d444845cef97..62ae94d36e05 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -432,7 +432,6 @@ asm pop ds; { Get DS back again. } */ { - ; } void show_one(byte which); diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp index 98ea2a51e420..d96eb89b36d3 100644 --- a/engines/avalanche/ch_egats.cpp +++ b/engines/avalanche/ch_egats.cpp @@ -143,12 +143,10 @@ asm pop ds; { Get DS back again. } */ { - ; } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(f, "chunk21.avd"); reset(f, 1); diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp index d599ef5881f0..c970e1a4c1d7 100644 --- a/engines/avalanche/charmap.cpp +++ b/engines/avalanche/charmap.cpp @@ -38,17 +38,13 @@ pointer where; byte w, fv, ff, num; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1f, where); move(where, table, 1024); for (w = 128; w <= 255; w ++) { - ; output << w << NL; for (fv = 1; fv <= 8; fv ++) { - ; num = table.chars[w][fv]; for (ff = 1; ff <= 8; ff ++) { - ; if ((num & 128) == 0) output << " "; else output << ""; num = num << 1; diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp index ba6ab57bf33d..ed2999148db1 100644 --- a/engines/avalanche/chunkxf1.cpp +++ b/engines/avalanche/chunkxf1.cpp @@ -59,12 +59,10 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbit.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -77,7 +75,6 @@ void load() { reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -90,7 +87,6 @@ void load() { } void open_chunk() { - ; assign(f, "chunk21.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -101,7 +97,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -269,7 +264,6 @@ end;*/ int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp index 781f798d176d..d7ae8e4ef320 100644 --- a/engines/avalanche/chunkxf2.cpp +++ b/engines/avalanche/chunkxf2.cpp @@ -57,13 +57,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place9.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -80,12 +78,10 @@ void load_temp(string which) { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, which); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -97,7 +93,6 @@ void load_temp(string which) { } void open_chunk() { - ; assign(f, "chunk9.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -108,7 +103,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -118,9 +112,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; exit(0); @@ -131,13 +123,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -151,7 +141,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -162,7 +151,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; if (nat) ch.flavour = ch_bgi; else ch.flavour = ch_ega; /* At the moment, Celer can't handle natural ch_EGAs. */ @@ -183,7 +171,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer freemem(p, s); { - ; if (ch.flavour == ch_bgi) s = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); else s = 4 * ((x2 - x1 + 7) / 8) * (y2 - y1 + 1); ch.size = s; @@ -203,7 +190,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp index b0bb23242f29..c693fdc1be88 100644 --- a/engines/avalanche/chunkxf3.cpp +++ b/engines/avalanche/chunkxf3.cpp @@ -61,7 +61,6 @@ var string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; @@ -70,7 +69,6 @@ string strf(longint x) { void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -82,7 +80,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -127,12 +124,10 @@ void loadtemp(string n) { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, n); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -149,12 +144,10 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place22.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -172,7 +165,6 @@ void load() { } void open_chunk() { - ; assign(f, "chunk22.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -183,7 +175,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -280,7 +271,6 @@ end;*/ int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp index 8648964d9e85..6659aa91aafb 100644 --- a/engines/avalanche/chunkxf4.cpp +++ b/engines/avalanche/chunkxf4.cpp @@ -105,7 +105,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp index 72cc0c39b796..c4b49e791182 100644 --- a/engines/avalanche/chunkxf5.cpp +++ b/engines/avalanche/chunkxf5.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "v:place1.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -139,13 +135,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi9.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -162,7 +156,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk1.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -173,7 +166,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -183,9 +175,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -197,13 +187,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -219,7 +207,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -230,7 +217,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -248,18 +234,15 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 + 7) / 8) - (x1 / 8)) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); } } else { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -276,7 +259,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -287,7 +269,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp index b02a9d2e24df..a1ce3ee680d4 100644 --- a/engines/avalanche/chunkxf6.cpp +++ b/engines/avalanche/chunkxf6.cpp @@ -60,7 +60,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -72,7 +71,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -116,13 +114,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "v:place19.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -143,13 +139,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "d:temp1.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -164,7 +158,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk19.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -175,7 +168,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -185,9 +177,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -199,13 +189,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -221,7 +209,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; x1 -= x_ofs; x2 -= x_ofs; y1 -= y_ofs; @@ -236,7 +223,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -254,11 +240,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -267,7 +251,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -284,7 +267,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -295,7 +277,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp index 6137bc3056fb..4b03e3a2f2d9 100644 --- a/engines/avalanche/chunkxf7.cpp +++ b/engines/avalanche/chunkxf7.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place25.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk25.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp index a3a8b14b3ed8..7e94b29d5116 100644 --- a/engines/avalanche/chunkxf8.cpp +++ b/engines/avalanche/chunkxf8.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place23.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp(string x) { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, x); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp(string x) { } void open_chunk() { - ; assign(f, "chunk23.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp index dbd342ada2df..f03674477ffc 100644 --- a/engines/avalanche/chunkxf9.cpp +++ b/engines/avalanche/chunkxf9.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place42.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "a:chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk42.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp index 622e6be2dbca..31c68a0a8b31 100644 --- a/engines/avalanche/chunkxfa.cpp +++ b/engines/avalanche/chunkxfa.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place7.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk7.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp index 820bd7816c9d..0b5beb7a9dfe 100644 --- a/engines/avalanche/chunkxfb.cpp +++ b/engines/avalanche/chunkxfb.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place71.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "d:chunkbi2.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk71.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp index da5ffc531f78..5dfc0afabe83 100644 --- a/engines/avalanche/chunkxfc.cpp +++ b/engines/avalanche/chunkxfc.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place2.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "d:chunkbi2.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk2.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp index 11aa04c3d890..97c4084a9f60 100644 --- a/engines/avalanche/chunkxfd.cpp +++ b/engines/avalanche/chunkxfd.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place15.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "d:chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk15.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp index 0b2757a7b402..81e14772683d 100644 --- a/engines/avalanche/chunkxfe.cpp +++ b/engines/avalanche/chunkxfe.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place5.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi2.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk5.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp index 0ff578ba5e0c..777e224cbd16 100644 --- a/engines/avalanche/chunkxff.cpp +++ b/engines/avalanche/chunkxff.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place13.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk13.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp index ead50a6e9c35..e1357ef83eeb 100644 --- a/engines/avalanche/chunkxfg.cpp +++ b/engines/avalanche/chunkxfg.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place16.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi3.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk16.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp index 6d8c0e8278c1..bf2da8f4529b 100644 --- a/engines/avalanche/chunkxfh.cpp +++ b/engines/avalanche/chunkxfh.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place46.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "d:chunkbi4.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk46.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -247,11 +233,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -260,7 +244,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp index b28add0bb764..7a5df66941db 100644 --- a/engines/avalanche/chunkxfi.cpp +++ b/engines/avalanche/chunkxfi.cpp @@ -57,7 +57,6 @@ array<0, arraysize, byte> aa; void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -69,7 +68,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); @@ -113,13 +111,11 @@ void load() { byte a1 /*absolute $A400:800*/; byte bit; untyped_file f; - ; assign(f, "place47.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -140,13 +136,11 @@ void loadtemp() { byte a0 /*absolute $A000:800*/; byte bit; untyped_file f; - ; assign(f, "chunkbi9.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,7 +155,6 @@ void loadtemp() { } void open_chunk() { - ; assign(f, "chunk47.avd"); rewrite(f, 1); blockwrite(f, chunkheader, sizeof(chunkheader)); @@ -172,7 +165,6 @@ void open_chunk() { } void close_chunk() { - ; seek(f, 45); blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ close(f); @@ -182,9 +174,7 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { integer yy; word aapos; byte length, bit; - ; if (size > arraysize) { - ; restorecrtmode(); output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; output << " than " << size << '.' << NL; @@ -196,13 +186,11 @@ void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { length = x2 - x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; for (yy = y1; yy <= y2; yy ++) { - ; move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); aapos += length; } @@ -218,7 +206,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer word s; pointer p; chunkblocktype ch; - ; /* rectangle(x1,y1,x2,y2); exit;*/ this_chunk += 1; offsets[this_chunk] = filepos(f); @@ -229,7 +216,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer getimage(x1, y1, x2, y2, p); { - ; ch.flavour = flav; ch.x = realx; ch.y = realy; @@ -248,11 +234,9 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer putimage(ch.x, ch.y, p, 0); if (flav == ch_ega) { - ; freemem(p, s); s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); { - ; ch.size = s; ch.x = ch.x / 8; ch.xl = (ch.xl / 8) + 2; @@ -261,7 +245,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer } else /* For BGI pictures. */ { - ; ch.x = ch.x / 8; ch.xl = (ch.xl + 7) / 8; ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); @@ -277,7 +260,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer if (! nat) blockwrite(f, aa, s); break; case ch_bgi : { - ; if (! nat) blockwrite(f, p, s); freemem(p, s); } @@ -288,7 +270,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp index 83c379d9268b..558be2ae73fc 100644 --- a/engines/avalanche/chunkxfj.cpp +++ b/engines/avalanche/chunkxfj.cpp @@ -69,7 +69,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp index 5779d27b41b9..cafd2e3695fa 100644 --- a/engines/avalanche/chunkxfk.cpp +++ b/engines/avalanche/chunkxfk.cpp @@ -69,7 +69,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp index 935245002a32..78ecd177934f 100644 --- a/engines/avalanche/chunkxfl.cpp +++ b/engines/avalanche/chunkxfl.cpp @@ -47,7 +47,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 3cec28881995..4f36cb7caa04 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -39,7 +39,6 @@ char r; void hand(word ang, word length, byte colour) { arccoordstype a; - ; if (ang > 900) return; setcolor(colour); arc(xm, ym, 449 - ang, 450 - ang, length); @@ -49,14 +48,11 @@ void hand(word ang, word length, byte colour) { void chime() { integer gd, gm, fv; - ; if (oh > 177) return; /* too high- must be first time around */ fv = h / 30; if (fv == 0) fv = 12; for (gd = 1; gd <= fv; gd ++) { - ; for (gm = 1; gm <= 3; gm ++) { - ; sound(140 - gm * 30); delay(50 - gm * 3); } @@ -66,7 +62,6 @@ void chime() { } void plothands() { - ; hand(oh, 17, brown); hand(h, 17, yellow); hand(om * 6, 20, brown); @@ -75,7 +70,6 @@ void plothands() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -87,7 +81,6 @@ int main(int argc, const char *argv[]) { gettime(h, m, s, s1); h = (h % 12) * 30 + m / 2; if (oh != h) { - ; plothands(); chime(); } diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index ddd31fc34b45..52a09b1b4799 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -52,7 +52,6 @@ file f; pointer exitsave; void get_screen(byte which) { - ; closegraph(); textattr = 0; clrscr; @@ -65,15 +64,11 @@ void get_screen(byte which) { void show_screen() { byte fv, ff, fq, tl, bl; scrtype a /*absolute $B800:0*/; - ; for (fv = 1; fv <= 40; fv ++) { - ; if (fv > 36) { - ; tl = 1; bl = 24; } else { - ; tl = 12 - fv / 3; bl = 12 + fv / 3; } @@ -89,7 +84,6 @@ void show_screen() { } void quit_with(byte which, byte errorlev) { - ; dusk(); get_screen(which); show_screen(); /* No changes. */ @@ -98,7 +92,6 @@ void quit_with(byte which, byte errorlev) { void put_in(string x, word where) { word fv; - ; for (fv = 1; fv <= length(x); fv ++) q[1 + (where + fv) * 2] = x[fv]; } @@ -121,7 +114,6 @@ void end_of_program() }; string result; - ; nosound; get_screen(scr_nagscreen); result = nouns[Random(12)] + " will " + verbs[Random(12)] + " you"; @@ -132,7 +124,6 @@ void end_of_program() /*$F+*/ void bug_handler() { - ; exitproc = exitsave; if (erroraddr != nil) { @@ -140,7 +131,6 @@ void bug_handler() { if (exitcode == 203) get_screen(scr_ramcram); else { - ; get_screen(scr_bugalert); put_in(strf(exitcode), 678); /* 678 = [38,8]. */ put_in(strf(seg(erroraddr)) + ':' + strf(ofs(erroraddr)), 758); /* 758 = [38,9]. */ @@ -159,7 +149,6 @@ class unit_closing_initialize { static unit_closing_initialize closing_constructor; unit_closing_initialize::unit_closing_initialize() { - ; exitsave = exitproc; exitproc = &bug_handler; } diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp index f7ae1ecf7778..8ab4b2d979ab 100644 --- a/engines/avalanche/convert.cpp +++ b/engines/avalanche/convert.cpp @@ -39,7 +39,6 @@ void loadscreen(string nam) { untyped_file f; word s; string check; - ; assign(f, nam); reset(f, 1); blockread(f, check, 41); @@ -47,7 +46,6 @@ void loadscreen(string nam) { blockread(f, check, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(a[z], s); blockread(f, a[z], s); setactivepage(0); @@ -61,12 +59,10 @@ void load2(string name) { byte a /*absolute $A000:1200*/; byte bit; untyped_file f; - ; assign(f, name); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -83,13 +79,11 @@ void save2(string name) { byte a /*absolute $A000:1200*/; byte bit; untyped_file f; - ; assign(f, name); rewrite(f, 1); blockwrite(f, header[1], 146); /* really 90 */ blockwrite(f, desc, 31); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -101,7 +95,6 @@ void save2(string name) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; output << "Filename?"; input >> fn1 >> NL; output << "New name?"; diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp index 6316b61c3d46..0a0bbce97880 100644 --- a/engines/avalanche/convmous.cpp +++ b/engines/avalanche/convmous.cpp @@ -48,9 +48,7 @@ integer gd, gm; void recalc() { byte a, b; - ; { - ; for (a = 0; a <= 1; a ++) for (b = 0; b <= 15; b ++) c_current.mask[a][b] = bintoword(cpc[a][b]); @@ -63,7 +61,6 @@ void load() { text t; string x; byte a, b; - ; assign(t, fn); reset(t); do { @@ -83,32 +80,25 @@ void display() { const integer o0 = ord('0'); const integer o1 = ord('1'); byte x, y, p1, p2; - ; for (y = 0; y <= 15; y ++) { - ; for (x = 1; x <= 16; x ++) { - ; switch (ord(cpc[0][y][x]) * 2 + ord(cpc[1][y][x])) { case o0*2+o0: { - ; p1 = 0; p2 = 0; } break; /* p1= silhouette, p2= real */ case o0*2+o1: { - ; p1 = 0; p2 = 15; } break; case o1*2+o0: { - ; p1 = 15; p2 = 0; } break; case o1*2+o1: { - ; p1 = 9; p2 = 9; } @@ -123,7 +113,6 @@ void display() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 1; initgraph(gd, gm, ""); diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp index 377c34c7bff6..adb2057ec93d 100644 --- a/engines/avalanche/credits.cpp +++ b/engines/avalanche/credits.cpp @@ -45,7 +45,6 @@ void do_one(byte z) { byte a /*absolute $A000:0*/; byte aa /*absolute $A000:80*/; byte az /*absolute $A000:27921*/; - ; a = getpixel(0, 0); move(l, az, z); @@ -56,9 +55,7 @@ void do_one(byte z) { void background() { byte y; - ; for (y = 1; y <= 15; y ++) { - ; setcolor(y); outtextxy(17, y * 12, "Jesus is Lord!"); } @@ -67,7 +64,6 @@ void background() { void scroll(string z) { byte x, y, lz; char c; - ; fillchar(l, 80, '\0'); if (z == "") for (y = 1; y <= 12; y ++) do_one(0); @@ -77,17 +73,14 @@ void scroll(string z) { switch (c) { case '*': for (y = 0; y <= 15; y ++) { - ; for (x = 1; x <= lz; x ++) l[x] = f[2][z[x]][y]; do_one(lz); } break; case '>': { - ; lz += 7; for (y = 0; y <= 13; y ++) { - ; for (x = 1; x <= lz; x ++) l[x + 7] = f[1][z[x]][y]; do_one(lz); @@ -100,7 +93,6 @@ void scroll(string z) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 1; initgraph(gd, gm, ""); diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp index 41ebe4434c37..a807743a1e03 100644 --- a/engines/avalanche/displtxt.cpp +++ b/engines/avalanche/displtxt.cpp @@ -42,7 +42,6 @@ atype a /*absolute $B800:0*/; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 0; clrscr; assign(f, fn); @@ -50,13 +49,10 @@ int main(int argc, const char *argv[]) { f >> q; close(f); for (fv = 1; fv <= 40; fv ++) { - ; if (fv > 36) { - ; tl = 1; bl = 24; } else { - ; tl = 12 - fv / 3; bl = 12 + fv / 3; } diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 0f3d078f121c..c5b2c5004204 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -72,7 +72,6 @@ char r; byte fv; void find_what_you_can_do_with_it() { - ; switch (thinks) { case wine: case ink: @@ -107,7 +106,6 @@ void chalk(integer x, integer y, char t, string z, boolean valid) { byte fv, ff, p, bit; word pageseg; byte ander; - ; pageseg = 0xa000 + cp * 0x400; @@ -117,7 +115,6 @@ void chalk(integer x, integer y, char t, string z, boolean valid) { for (fv = 1; fv <= length(z); fv ++) for (ff = 0; ff <= 7; ff ++) for (bit = 0; bit <= 2; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -126,7 +123,6 @@ void chalk(integer x, integer y, char t, string z, boolean valid) { } for (ff = 0; ff <= 8; ff ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << 3; @@ -139,7 +135,6 @@ void chalk(integer x, integer y, char t, string z, boolean valid) { p -= 1; for (bit = 0; bit <= 2; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -156,7 +151,6 @@ void hlchalk(integer x, integer y, char t, string z, boolean valid) byte fv, ff, p; word pageseg; byte ander; - ; pageseg = 0xa000 + cp * 0x400; @@ -183,14 +177,12 @@ begin; end;*/ void bleep() { - ; sound(177); delay(7); nosound; } void onemenu::start_afresh() { - ; number = 0; width = 0; firstlix = false; @@ -199,7 +191,6 @@ void onemenu::start_afresh() { } onemenu *onemenu::init() { - ; menunow = false; ddmnow = false; menunum = 1; @@ -208,13 +199,11 @@ onemenu *onemenu::init() { void onemenu::opt(string n, char tr, string key, boolean val) { integer l; - ; number += 1; l = length(n + key) + 3; if (width < l) width = l; { optiontype &with = oo[number]; - ; with.title = n; with.trigger = tr; with.shortcut = key; @@ -224,10 +213,8 @@ void onemenu::opt(string n, char tr, string key, boolean val) { void onemenu::displayopt(byte y, boolean highlit) { string data; - ; { optiontype &with = oo[y]; - ; if (highlit) setfillstyle(1, 0); @@ -255,7 +242,6 @@ void onemenu::displayopt(byte y, boolean highlit) { void onemenu::display() { byte y; - ; off(); setactivepage(cp); setvisualpage(cp); @@ -284,7 +270,6 @@ void onemenu::display() { void onemenu::wipe() { bytefield r; - ; setactivepage(cp); off(); { @@ -313,9 +298,7 @@ void onemenu::wipe() { void onemenu::movehighlight(shortint add) { shortint hn; - ; if (add != 0) { - ; hn = highlightnum + add; if ((hn < 0) || (hn >= (unsigned char)number)) return; highlightnum = hn; @@ -330,7 +313,6 @@ void onemenu::movehighlight(shortint add) { } void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - ; if ((mx < (cardinal)flx1 * 8) || (mx > (cardinal)flx2 * 8) || (my <= 12) || (my > (cardinal)fly - 3)) return; highlightnum = (my - 13) / 10; if (highlightnum == oldy) return; @@ -338,7 +320,6 @@ void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ } void onemenu::select(byte n) { /* Choose which one you want. */ - ; if (! oo[n + 1].valid) return; choicenum = n; wipe(); @@ -352,13 +333,11 @@ void onemenu::select(byte n) { /* Choose which one you want. */ void onemenu::keystroke(char c) { byte fv; boolean found; - ; c = upcase(c); found = false; for (fv = 1; fv <= number; fv ++) { optiontype &with = oo[fv]; if ((upcase(with.trigger) == c) && with.valid) { - ; select(fv - 1); found = true; } @@ -368,7 +347,6 @@ void onemenu::keystroke(char c) { headtype *headtype::init (char trig, char alttrig, string name, byte p, proc dw, proc dc) { - ; trigger = trig; alttrigger = alttrig; title = name; @@ -381,21 +359,18 @@ headtype *headtype::init } void headtype::display() { - ; off(); /*MT*/ chalk(xpos, 1, trigger, title, true); on(); /*MT*/ } void headtype::highlight() { - ; off(); off_virtual(); nosound; setactivepage(cp); hlchalk(xpos, 1, trigger, title, true); { - ; ddm_o.left = xpos; ddm_o.menunow = true; ddmnow = true; @@ -406,9 +381,7 @@ void headtype::highlight() { boolean headtype::extdparse(char c) { boolean extdparse_result; - ; if (c != alttrigger) { - ; extdparse_result = true; return extdparse_result; } @@ -417,13 +390,11 @@ boolean headtype::extdparse(char c) { } menuset *menuset::init() { - ; howmany = 0; return this; } void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { - ; howmany += 1; ddms[howmany].init(t, alttrig, n, howmany, dw, dc); } @@ -431,7 +402,6 @@ void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { void menuset::update() { const bytefield menuspace = {0, 0, 80, 9}; byte fv, page_, savecp; - ; setactivepage(3); setfillstyle(1, menu_b); bar(0, 0, 640, 9); @@ -449,7 +419,6 @@ void menuset::update() { void menuset::extd(char c) { byte fv; - ; fv = 1; while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; if (fv > howmany) return; @@ -457,13 +426,10 @@ void menuset::extd(char c) { } void menuset::getcertain(byte fv) { - ; { headtype &with = ddms[fv]; { - ; if (ddm_o.menunow) { - ; wipe(); /* get rid of menu */ if (ddm_o.menunum == with.position) return; /* clicked on own highlight */ } @@ -475,12 +441,10 @@ void menuset::getcertain(byte fv) { void menuset::getmenu(integer x) { byte fv; - ; fv = 0; do { fv += 1; if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { - ; getcertain(fv); return; } @@ -488,15 +452,12 @@ void menuset::getmenu(integer x) { } void parsekey(char r, char re) { - ; switch (r) { case '\0': case '\340': { - ; switch (re) { case 'K': if (ddm_o.menunum > 1) { - ; wipe(); ddm_m.getcertain(ddm_o.menunum - 1); } else { @@ -507,7 +468,6 @@ void parsekey(char r, char re) { break; case 'M': if (ddm_o.menunum < ddm_m.howmany) { - ; wipe(); ddm_m.getcertain(ddm_o.menunum + 1); } else { @@ -531,7 +491,6 @@ void parsekey(char r, char re) { select(ddm_o.highlightnum); break; default: { - ; if (ddm_o.menunow) keystroke(r); } } @@ -540,9 +499,7 @@ void parsekey(char r, char re) { /*$F+ *** Here follow all the ddm__ and do__ procedures for the DDM system. */ void ddm__game() { - ; { - ; start_afresh(); opt("Help...", 'H', "f1", true); opt("Boss Key", 'B', "alt-B", true); @@ -554,9 +511,7 @@ void ddm__game() { } void ddm__file() { - ; { - ; start_afresh(); opt("New game", 'N', "f4", true); opt("Load...", 'L', "^f3", true); @@ -570,11 +525,9 @@ void ddm__file() { void ddm__action() { string n; - ; n = copy(f5_does(), 2, 255); { - ; start_afresh(); if (n == "") opt("Do something", 'D', "f5", false); @@ -598,17 +551,14 @@ void ddm__action() { void ddm__people() { byte here; char fv; - ; people = ""; here = dna.room; { - ; start_afresh(); for (fv = '\226'; fv <= '\262'; fv ++) if (whereis[fv] == here) { - ; opt(getname(fv), getnamechar(fv), "", true); people = people + fv; } @@ -618,9 +568,7 @@ void ddm__people() { void ddm__objects() { char fv; - ; { - ; start_afresh(); for (fv = '\1'; fv <= numobjs; fv ++) if (dna.obj[fv]) @@ -631,7 +579,6 @@ void ddm__objects() { string himher(char x) { /* Returns "im" for boys, and "er" for girls.*/ string himher_result; - ; if (x < '\257') himher_result = "im"; else himher_result = "er"; return himher_result; @@ -642,18 +589,14 @@ void ddm__with() { varying_string<7> verb; char vbchar; boolean n; - ; { - ; start_afresh(); if (thinkthing) { - ; find_what_you_can_do_with_it(); for (fv = 1; fv <= length(verbstr); fv ++) { - ; verbopt(verbstr[fv], verb, vbchar); opt(verb, vbchar, "", true); } @@ -665,13 +608,11 @@ void ddm__with() { if ((set::of(nowt, pavalot, eos).has(last_person)) || (whereis[last_person] != dna.room)) opt("Give to...", 'G', "", false); /* Not here. */ else { - ; opt(string("Give to ") + getname(last_person), 'G', "", true); verbstr = verbstr + vb_give; } } else { - ; opt("Examine", 'x', "", true); opt(string("Talk to h") + himher(thinks), 'T', "", true); verbstr = string(vb_exam) + vb_talk; @@ -679,21 +620,18 @@ void ddm__with() { case pgeida: case parkata: { - ; opt("Kiss her", 'K', "", true); verbstr = verbstr + vb_kiss; } break; case pdogfood: { - ; opt("Play his game", 'P', "", ! dna.wonnim); /* True if you HAVEN'T won. */ verbstr = verbstr + vb_play; } break; case pmalagauche: { - ; n = ! dna.teetotal; opt("Buy some wine", 'w', "", ! dna.obj[wine]); opt("Buy some beer", 'b', "", n); @@ -705,7 +643,6 @@ void ddm__with() { break; case ptrader: { - ; opt("Buy an onion", 'o', "", ! dna.obj[onion]); verbstr = verbstr + '\151'; } @@ -744,7 +681,6 @@ begin; end;*/ void do__game() { - ; switch (ddm_o.choicenum) { /* Help, boss, untrash screen. */ case 0: @@ -766,20 +702,17 @@ void do__game() { } void do__file() { - ; switch (ddm_o.choicenum) { /* New game, load, save, save as, DOS shell, about, quit. */ case 0: callverb(vb_restart); break; case 1: { - ; realwords[2] = ""; callverb(vb_load); } break; case 2: { - ; realwords[2] = ""; callverb(vb_save); } @@ -798,7 +731,6 @@ void do__file() { void do__action() { string n; - ; switch (ddm_o.choicenum) { /* Get up/pause game/open door/look/inv/walk-run */ case 0: { @@ -830,22 +762,18 @@ void do__action() { } void do__objects() { - ; thinkabout(objlist[ddm_o.choicenum + 1], a_thing); } void do__people() { - ; thinkabout(people[ddm_o.choicenum + 1], a_person); last_person = people[ddm_o.choicenum + 1]; } void do__with() { - ; thing = thinks; if (thinkthing) { - ; thing += 49; @@ -855,52 +783,44 @@ void do__with() { person = '\376'; } else { - ; switch (verbstr[ddm_o.choicenum + 1]) { case '\144': { - ; thing = '\144'; callverb(vb_buy); return; } break; /* Beer */ case '\145': { - ; thing = '\62'; callverb(vb_buy); return; } break; /* Wine */ case '\146': { - ; thing = '\146'; callverb(vb_buy); return; } break; /* Whisky */ case '\147': { - ; thing = '\147'; callverb(vb_buy); return; } break; /* Cider */ case '\150': { - ; thing = '\153'; callverb(vb_buy); return; } break; /* Mead */ case '\151': { - ; thing = '\103'; callverb(vb_buy); return; } break; /* Onion (trader) */ default: { - ; person = thing; thing = '\376'; } @@ -912,7 +832,6 @@ void do__with() { /*$F- That's all. Now for the ...bar procs. */ void standard_bar() { /* Standard menu bar */ - ; ddm_m.init(); ddm_o.init(); { @@ -941,11 +860,8 @@ begin; end;*/ void checkclick() { /* only for when the menu's displayed */ - ; if (mpress > 0) { - ; if (mpy > 10) { - ; if (!((ddm_o.firstlix) && ((mpx >= (cardinal)ddm_o.flx1 * 8) && (mpx <= (cardinal)ddm_o.flx2 * 8) && (mpy >= 12) && (mpy <= (cardinal)ddm_o.fly)))) { @@ -959,7 +875,6 @@ void checkclick() { /* only for when the menu's displayed */ } else { ; /* NOT clicked button... */ if (mrelease > 0) { - ; if ((ddm_o.firstlix) && ((mrx >= (cardinal)ddm_o.flx1 * 8) && (mrx <= (cardinal)ddm_o.flx2 * 8) && (mry >= 12) && (mry <= (cardinal)ddm_o.fly))) @@ -969,9 +884,7 @@ void checkclick() { /* only for when the menu's displayed */ } void menu_link() { - ; { - ; if (! ddm_o.menunow) return; check(); /* find mouse coords & click information */ @@ -984,7 +897,6 @@ void menu_link() { newpointer(1); break; /* up-arrow */ case 11 ... 169: { - ; if ((mx >= (cardinal)ddm_o.flx1 * 8) && (mx <= (cardinal)ddm_o.flx2 * 8) && (my > 10) && (my <= (cardinal)ddm_o.fly)) newpointer(3); /* right-arrow */ else newpointer(4); /* fletch */ diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp index 56bf5093b75f..206ad216314d 100644 --- a/engines/avalanche/dwidth.cpp +++ b/engines/avalanche/dwidth.cpp @@ -37,7 +37,6 @@ file ff; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(ff, "v:avalot.fnt"); reset(ff); ff >> f; diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp index 3aed1a371357..af0eea97fcac 100644 --- a/engines/avalanche/edhead.cpp +++ b/engines/avalanche/edhead.cpp @@ -72,7 +72,6 @@ edhead e; void info(string x) { /* info on .ASG files */ varying_string<40> describe; - ; assign(f, x); /*$I-*/ reset(f, 1); seek(f, 47); @@ -99,7 +98,6 @@ void info(string x) { /* info on .ASG files */ int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; info("tt.asg"); output << "Filename: " << x << NL; diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp index bfe427419155..befc4dff35a2 100644 --- a/engines/avalanche/enhanced.cpp +++ b/engines/avalanche/enhanced.cpp @@ -47,7 +47,6 @@ boolean isenh() { boolean isenh_result; isenh_result = false; { - ; ah = 0x12; intr(0x16, r); statefrom16 = al; @@ -55,7 +54,6 @@ boolean isenh() { if (statefrom16 != shiftstate) return isenh_result; shiftstate = shiftstate ^ 0x20; { - ; ah = 0x12; intr(0x16, r); statefrom16 = al; @@ -76,7 +74,6 @@ void readkeye() { registers r; word fs; - ; if (atbios) fs = fancystuff; /* We're using an AT */ else fs = notfancystuff; /* ditto, an XT */ @@ -96,7 +93,6 @@ boolean keypressede() { registers r; boolean keypressede_result; - ; if (atbios) keypressede_result = fancystuff; /* ATs get the fancy stuff */ else keypressede_result = keypressed(); /* XTs get the usual primitive... */ @@ -110,7 +106,6 @@ class unit_enhanced_initialize { static unit_enhanced_initialize enhanced_constructor; unit_enhanced_initialize::unit_enhanced_initialize() { - ; /* determine bios type */ atbios = isenh(); } diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp index b8e3c8bfe092..a98161796b97 100644 --- a/engines/avalanche/filer.cpp +++ b/engines/avalanche/filer.cpp @@ -108,9 +108,7 @@ boolean filefound; void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { byte fv; - ; for (fv = 0; fv <= border; fv ++) { - ; setfillstyle(1, hc); bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); @@ -123,7 +121,6 @@ void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { void shbox(integer x1, integer y1, integer x2, integer y2, string t) { const integer fc = 7; - ; shadow(x1, y1, x2, y2, 15, 8); setfillstyle(1, fc); bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); @@ -132,7 +129,6 @@ void shbox(integer x1, integer y1, integer x2, integer y2, string t) { y1 = (y2 - y1) / 2 + y1; outtextxy(x1, y1, t); if (length(t) > 1) { - ; fillchar(t[2], length(t) - 1, '\40'); t[1] = '_'; outtextxy(x1 - 1, y1 + 1, t); @@ -141,7 +137,6 @@ void shbox(integer x1, integer y1, integer x2, integer y2, string t) { void show_drives() { byte fv; - ; settextjustify(1, 1); for (fv = 0; fv <= length(drives) - 1; fv ++) shbox((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, @@ -151,7 +146,6 @@ void show_drives() { } void box(integer x1, integer y1, integer x2, integer y2, string z) { - ; rectangle(x1, y1, x2, y2); outtextxy(x1 + 1, y1 - 10, z + ':'); outtextxy(x1, y1 - 9, "_"); @@ -160,7 +154,6 @@ void box(integer x1, integer y1, integer x2, integer y2, string z) { string lowstr(string x) { byte fv; string lowstr_result; - ; for (fv = 1; fv <= length(x); fv ++) if (set::of(range('A', 'Z'), eos).has(x[fv])) x[fv] += 32; lowstr_result = x; @@ -175,7 +168,6 @@ char lowchar(char x) { } void getcurrent() { - ; current = lowstr(fexpand("*.asg")); } @@ -183,7 +175,6 @@ void setup() { integer gd, gm; registers r; byte floppies; - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -271,12 +262,10 @@ void scandir() { ednahead eh; array<1, 4, char> dna_type; - ; nums[files] = 0; findfirst("*.asg", archive + hidden + readonly, s); while (doserror == 0) { - ; fsplit(s.name, nix, name, nix); nums[files] += 1; lists[files][nums[files]] = lowstr(name); @@ -292,14 +281,12 @@ void scandir() { } else { ; /* EDNA-based files. */ if (dna_type == "EDNA") { - ; seek(f, 177); blockread(f, eh, sizeof(eh)); if (eh.revision != 2) descs[nums[files]] = "* Unknown EDNA type!"; else { - ; if (eh.number != 2) descs[nums[files]] = string("* Saved by ") + eh.shortname + '!'; @@ -317,9 +304,7 @@ void scandir() { nums[dirs] = 0; findfirst("*.*", directory, s); while (doserror == 0) { - ; if (((s.attr & directory) > 0) && ((length(s.name)) > 1)) { - ; nums[dirs] += 1; lists[dirs][nums[dirs]] = lowstr(s.name); } @@ -339,7 +324,6 @@ void scandir() { void show_file(integer x, integer y, byte which) { varying_string<58> z; - ; fillchar(z[1], 13, '\40'); z = lists[files][which] + ".asg"; z[0] = '\15'; @@ -355,11 +339,9 @@ void show_file(integer x, integer y, byte which) { void showfiles() { byte fv; - ; if (loading) setcolor(11); else setcolor(3); if (nums[3] == 0) { - ; outtextxy(22, 86, "(None here!)"); return; } @@ -370,7 +352,6 @@ void showfiles() { void showdirs() { byte fv; - ; setcolor(11); for (fv = 0; fv <= 8; fv ++) if (where[4] + fv <= nums[4]) @@ -382,7 +363,6 @@ void show() { dirstr d; namestr n; extstr e; - ; setfillstyle(1, 1); for (fv = 1; fv <= 4; fv ++) if (fv != 2) { @@ -396,7 +376,6 @@ void show() { } void blip() { - ; sound(177); delay(77); nosound; @@ -405,7 +384,6 @@ void blip() { void invert(integer x1, integer y1, integer x2, integer y2) { pointer p, restore; word s; - ; s = imagesize(x1, y1, x2, y2); mark(restore); getmem(p, s); @@ -416,10 +394,8 @@ void invert(integer x1, integer y1, integer x2, integer y2) { void changedrive(char drive) { byte fv; - ; fv = pos(drive, drives); if (fv == 0) { - ; blip(); return; } @@ -435,7 +411,6 @@ void changedrive(char drive) { } void highlight(byte win, byte line) { - ; switch (win) { case 3: invert(16, 75 + line * 10, 479, 85 + line * 10); @@ -467,12 +442,9 @@ void repaint(byte whichwindow) { void fileblit(word xpos, word xlen, word y1, word y2, shortint dir, word ylen) { word fv; byte bit; - ; for (bit = 0; bit <= 3; bit ++) { - ; fv = 0; while (fv < ylen) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -522,7 +494,6 @@ void pagedown(byte whichlist) { void subdirparse(string r); static void movehl(byte which, shortint howmuch) { - ; highlight(4, where[4] - top[4] + 1); if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[4])) where[which] = where[which] + howmuch; @@ -532,12 +503,10 @@ static void movehl(byte which, shortint howmuch) { static void change_dir() { - ; dusk(); /*$I-*/ chdir(lists[4][where[4]]); /*$I+*/ if (ioresult != 0) { - ; dawn(); blip(); return; @@ -554,7 +523,6 @@ static void change_dir() { void subdirparse(string r) { - ; switch (r[1]) { case creturn: change_dir(); @@ -582,7 +550,6 @@ void subdirparse(string r) if (where[4] - top[4] < 8) /* Down */ movehl(4, 1); else if (top[4] + 8 < nums[4]) { - ; highlight(4, 9); top[4] += 1; where[4] += 1; @@ -620,7 +587,6 @@ void fileinfo(byte which); static void display(integer y, string left, string right) { - ; y = 17 + y * 12; settextjustify(2, 1); setcolor(11); @@ -638,7 +604,6 @@ void fileinfo(byte which) varying_string<4> os; char r; - ; /* Firstly, we must check whether or not it's an Avalot file. This is easily done, since the descriptions of all others always begin with a star. */ @@ -663,7 +628,6 @@ void fileinfo(byte which) bar(2, 2, 637, 197); /* Interesting information coming up! */ { - ; display(2, "Saved by:", eh.game); display(3, "version:", eh.verstr); @@ -688,7 +652,6 @@ void filer_help() /* This gives general help. */ { char r; - ; outtextxy(100, 100, "Just general help here."); shbox(500, 177, 650, 200, "Press any key..."); r = readkey(); @@ -701,7 +664,6 @@ void wipe() /* This allows you to delete files. */ { char r; - ; outtextxy(100, 100, "Are you sure you want to delete \"foo.bar\"?"); shbox(500, 177, 650, 200, "[Y/N]"); r = readkey(); @@ -713,7 +675,6 @@ void wipe() void filesparse(string r); static void movehl1(byte which, shortint howmuch) { - ; highlight(3, where[3] - top[3] + 1); if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[3])) where[which] = where[which] + howmuch; @@ -724,7 +685,6 @@ static void movehl1(byte which, shortint howmuch) { static boolean selected_file() { boolean selected_file_result; - ; if (descs[where[file_win]][1] == '*') { blip(); selected_file_result = false; @@ -739,7 +699,6 @@ static boolean selected_file() { void filesparse(string r) { - ; switch (r[1]) { case creturn: if (selected_file()) return; @@ -765,7 +724,6 @@ void filesparse(string r) if (where[3] - top[3] < 8) /* Down */ movehl1(3, 1); else if (top[3] + 8 < nums[3]) { - ; highlight(3, 9); top[3] += 1; where[3] += 1; @@ -808,7 +766,6 @@ void filesparse(string r) string playaround(); static void changewin(byte i) { - ; switch (nowwin) { case 3: case 4: @@ -834,7 +791,6 @@ static void changewin(byte i) { string playaround() { char r, r2; string playaround_result; - ; filefound = false; dawn(); @@ -850,7 +806,6 @@ string playaround() { changewin(nowwin + 1); break; case cescape: { - ; playaround_result = ""; return playaround_result; } @@ -875,7 +830,6 @@ string playaround() { changewin(4); break; case c_ac: { - ; playaround_result = ""; return playaround_result; } @@ -912,7 +866,6 @@ string playaround() { } if (filefound) { - ; dusk(); playaround_result = filename; return playaround_result; @@ -924,7 +877,6 @@ string playaround() { void do_filer() { pathstr p; void do_filer_result; - ; loading = true; setup(); scandir(); @@ -938,7 +890,6 @@ void do_filer() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; filename = do_filer(); closegraph(); if (filename == "") diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp index 6b1c9b196baa..11c82fa64a06 100644 --- a/engines/avalanche/fileunit.cpp +++ b/engines/avalanche/fileunit.cpp @@ -804,7 +804,6 @@ void entername(char r) { filefound = true; break; case '\40': - ; break; /* ignore spaces. */ default: { if (length(filename) < 55) filename = filename + r; diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp index 78abec7e414e..dce34e9b5730 100644 --- a/engines/avalanche/filing.cpp +++ b/engines/avalanche/filing.cpp @@ -95,7 +95,6 @@ edhead e; void info256(string x) { /* info on dna256 *.ASG files */ varying_string<40> describe; - ; assign(f, x); /*$I-*/ reset(f, 1); seek(f, 47); @@ -103,7 +102,6 @@ void info256(string x) { /* info on dna256 *.ASG files */ blockread(f, dna256, sizeof(dna256)); close(f); /*$I+*/ { - ; e.revision = 1; e.game = "Denarius Avaricius Sextus"; e.shortname = "Avaricius"; @@ -128,16 +126,13 @@ void info256(string x) { /* info on dna256 *.ASG files */ string enlarge(string x) { string enlarge_result; - ; switch (x[length(x)]) { case '*': { - ; x[0] -= 1; x = x + "uary"; } break; case '&': { - ; x[0] -= 1; x = x + "ember"; } @@ -150,7 +145,6 @@ string enlarge(string x) { string th(byte x) { varying_string<4> n; string th_result; - ; n = strf(x); switch (x) { case 1: @@ -175,11 +169,9 @@ string th(byte x) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; info256("t:justb4.asg"); { - ; output << "DNA coding: "; switch (e.revision) { case 1: diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp index 03da49f3751c..c32618209c5e 100644 --- a/engines/avalanche/folktemp.cpp +++ b/engines/avalanche/folktemp.cpp @@ -64,12 +64,10 @@ void load() { byte a0 /*absolute $A000:1200*/; byte bit; untyped_file f; - ; assign(f, "d:folk.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -81,7 +79,6 @@ void load() { } void get_one() { - ; gd = ((order[noo] % 9) * 70 + 10); gm = ((order[noo] / 9) * 40 + 20); @@ -94,7 +91,6 @@ void get_one() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp index 3173c6921c02..43dbd785572f 100644 --- a/engines/avalanche/fontslid.cpp +++ b/engines/avalanche/fontslid.cpp @@ -38,13 +38,11 @@ file f; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(f, "v:avalot.fnt"); reset(f); f >> font1; close(f); for (r = '\0'; r <= '\377'; r ++) { - ; for (fv = 0; fv <= 3; fv ++) font1[r][fv] = (cardinal)font1[r][fv] >> 1; for (fv = 7; fv <= 8; fv ++) font1[r][fv] = font1[r][fv] << 1; for (fv = 9; fv <= 14; fv ++) font1[r][fv] = font1[r][fv] << 2; diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp index 257e2b342c9b..fd4ffd4d0257 100644 --- a/engines/avalanche/frere.cpp +++ b/engines/avalanche/frere.cpp @@ -57,7 +57,6 @@ byte value; tunetype played; void store_(byte what) { - ; move(played[2], played[1], sizeof(played) - 1); @@ -68,11 +67,9 @@ void store_(byte what) { boolean they_match() { byte fv; boolean they_match_result; - ; for (fv = 1; fv <= sizeof(played); fv ++) if (played[fv] != tune[fv]) { - ; they_match_result = false; return they_match_result; } @@ -84,7 +81,6 @@ boolean they_match() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 30; clrscr; @@ -97,7 +93,6 @@ int main(int argc, const char *argv[]) { value = pos(pressed, keys); if (value > 0) { - ; last_one = this_one; this_one = value; @@ -117,7 +112,6 @@ int main(int argc, const char *argv[]) { store_(higher); if (they_match()) { - ; textattr = 94; clrscr; output << NL; diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp index 8f84e53100d4..2db249ba60c3 100644 --- a/engines/avalanche/g-room.cpp +++ b/engines/avalanche/g-room.cpp @@ -89,16 +89,13 @@ void plain_grab() /* Just grabs the next one and puts it where it's told to. */ { integer xx, yy, xofs; - ; blockread(f, cb, sizeof(cb)); switch (cb.flavour) { case ch_one: { - ; xofs = cb.x / 8; bit = 3; for (yy = 0; yy <= cb.yl; yy ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -109,12 +106,10 @@ void plain_grab() } break; case ch_ega: { - ; xofs = cb.x / 8; bit = 3; for (bit = 0; bit <= 3; bit ++) for (yy = 0; yy <= cb.yl; yy ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -128,24 +123,20 @@ void plain_grab() } void get_me(pointer &p) { - ; blockread(f, cb, sizeof(cb)); /* Take it for granted that cb.flavour = ch_BGI! */ { - ; getmem(p, cb.size); blockread(f, p, cb.size); } } void get_me_aargh(byte which) { - ; blockread(f, cb, sizeof(cb)); /* Take it for granted that cb.flavour = ch_BGI! */ { - ; getmem(aargh[which], cb.size); blockread(f, aargh[which], cb.size); } @@ -231,7 +222,6 @@ void big_green_eyes(byte how) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; if (paramstr(1) != "jsb") exit(255); gd = 3; gm = 0; @@ -245,7 +235,6 @@ int main(int argc, const char *argv[]) { mark(memlevel); for (fv = 1; fv <= 5; fv ++) { - ; blockread(f, cb, sizeof(cb)); for (bit = 2; bit <= 3; bit ++) for (y = 0; y <= cb.yl; y ++) @@ -277,7 +266,6 @@ int main(int argc, const char *argv[]) { glerk = new glerktype; for (fv = 1; fv <= 6; fv ++) { - ; blockread(f, cb, sizeof(cb)); bit = 3; for (bit = 0; bit <= 3; bit ++) @@ -309,14 +297,11 @@ int main(int argc, const char *argv[]) { bat_count = 0; for (gd = 500; gd >= 217; gd --) { - ; if (set::of(range(22, 27), eos).has((gd % 30))) { - ; if ((gd % 30) == 27) bar(gd, 135, gd + 16, 136); putimage(gd, 136, eyes[0], 0); putpixel(gd + 16, 137, 0); } else { - ; if (gd % 30 == 21) bar(gd, 137, gd + 17, 138); putimage(gd, 135, eyes[0], 0); @@ -325,13 +310,11 @@ int main(int argc, const char *argv[]) { /* Plot the Glerk: */ if (gd % 10 == 0) { - ; glerkstage += 1; if (glerkstage > 26) flush(); for (gm = 0; gm <= 34; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -354,7 +337,6 @@ int main(int argc, const char *argv[]) { /* It descends... */ for (gm = -64; gm <= 103; gm ++) { - ; bit = getpixel(0, 0); if (gm > 0) @@ -363,7 +345,6 @@ int main(int argc, const char *argv[]) { for (y = 0; y <= 65; y ++) if ((y + gm) >= 0) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -382,7 +363,6 @@ int main(int argc, const char *argv[]) { for (gd = 1; gd <= 4; gd ++) for (fv = 1; fv <= 5; fv ++) { - ; y = getpixel(0, 0); @@ -391,7 +371,6 @@ int main(int argc, const char *argv[]) { for (y = 0; y <= 65; y ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -430,15 +409,12 @@ int main(int argc, const char *argv[]) { red_greldet = false; for (gd = 217; gd <= 479; gd ++) { - ; if (set::of(range(22, 27), eos).has((gd % 30))) { - ; if ((gd % 30) == 22) bar(gd + 22, 134, gd + 38, 137); putimage(gd + 23, 136, eyes[1], 0); putpixel(gd + 22, 137, 0); } else { - ; if (gd % 30 == 28) bar(gd + 22, 135, gd + 38, 138); @@ -448,7 +424,6 @@ int main(int argc, const char *argv[]) { /* Plot the Green Eyes: */ if (gd % 53 == 5) { - ; big_green_eyes(glerkstage); glerkstage += 1; } diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp index 2ea9aec1a77f..b5a6388b69af 100644 --- a/engines/avalanche/golden.cpp +++ b/engines/avalanche/golden.cpp @@ -170,7 +170,6 @@ byte here() { void hold(word amount) { *skellern = 0; do { - ; } while (!(*skellern >= amount)); } @@ -408,7 +407,6 @@ int main(int argc, const char *argv[]) { initgraph(gd, gm, ""); if (! nomusic) do { - ; } while (!(ampgetrow >= 10)); setcolor(9); @@ -440,7 +438,6 @@ int main(int argc, const char *argv[]) { hold(15); else do { - ; } while (!(ampgetpattern > 2)); nexthangon = 2; hangon(1); @@ -469,7 +466,6 @@ int main(int argc, const char *argv[]) { hold(25); else do { - ; } while (!(ampgetmodulestatus != md_playing)); setcolor(0); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 25b2c00797c9..bcdd4c14d699 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -311,7 +311,6 @@ void click() { /* "Audio keyboard feedback" */ void slowdown() { /* repeat until TSkellern>=howlong; TSkellern:=0;*/ do { - ; } while (!(memw[storage_seg * skellern] >= howlong)); memw[storage_seg * skellern] = 0; } diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index d08bf8667008..7a7e2aa3aef3 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -348,7 +348,7 @@ const integer yw = 36; /* x width & y whatsit */ const integer margin = 5; const array<1, 9, mp> mps = { - { { + { { /* 1 - up-arrow */ { { {{65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}}, {{0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0}} @@ -497,7 +497,7 @@ const integer run = 5; const array < '\226', '\262', byte > whereis = /* The Lads */ -{ { +{ { r__yours, /* Avvy */ r__spludwicks, /* Spludwick */ r__outsideyours, /* Crapulus */ diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 3074091a0b5d..23ee06819a7e 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -57,7 +57,6 @@ boolean lmo; void hilight(integer x, integer y, byte c1, byte c2, string z) { string w; - ; w = z; w[1] = '\40'; setcolor(c1); @@ -70,10 +69,8 @@ void hilight(integer x, integer y, byte c1, byte c2, string z) { } void showpage(byte x) { - ; if (x == page_) return; /* twit */ if (x == 7) { - ; lmo = true; return; } @@ -81,7 +78,6 @@ void showpage(byte x) { hidemousecursor; settextjustify(1, 1); if (page_ != 177) { - ; setfillstyle(1, 1); bar(507, page_ * 25 + 2, 607, page_ * 25 + 22); setfillstyle(1, 9); @@ -228,7 +224,6 @@ void showpage(byte x) { void helpsetup() { integer gd, gm; - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -246,7 +241,6 @@ void helpsetup() { settextstyle(0, 0, 1); settextjustify(1, 1); for (gd = 2; gd <= 7; gd ++) { - ; setfillstyle(1, 1); bar(507, gd * 25 + 2, 607, gd * 25 + 22); setfillstyle(1, 9); @@ -260,7 +254,6 @@ void helpsetup() { lmo = false; setfillstyle(1, 7); for (gd = 1; gd <= 3; gd ++) { - ; bar(10 - gd * 3, 200 - gd * 3, 490 - gd * 6, 200 - gd * 3); bar(490 - gd * 6, 37 - gd * 3, 491 - gd * 6, 200 - gd * 3); } @@ -268,7 +261,6 @@ void helpsetup() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; helpsetup(); do { do { @@ -299,7 +291,6 @@ int main(int argc, const char *argv[]) { } else { ; /* mouse choice */ if ((mousex > 400) && (mousey > 25)) { - ; showpage(mousey / 25); } } diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp index 1ef6443fc79d..37e23ac335eb 100644 --- a/engines/avalanche/help2.cpp +++ b/engines/avalanche/help2.cpp @@ -53,7 +53,6 @@ array<0, 9, byte> revpos; void loadfont() { file fontfile; - ; assign(fontfile, "c:\\thomas\\ttsmall.fnt"); reset(fontfile); fontfile >> font[1]; @@ -67,19 +66,16 @@ void loadfont() { void scribe(byte which, byte what); static void underline(byte &x) { - ; x = x | 177; } void scribe(byte which, byte what) { byte fv, ff; string x; - ; x = data[what]; fillchar(current, sizeof(current), '\0'); for (ff = 1; ff <= length(x); ff ++) for (fv = 0; fv <= 7; fv ++) { - ; current[fv][ff] = font[which][x[ff]][fv]; } @@ -93,18 +89,15 @@ void scribe(byte which, byte what) { } void display(word y) { - ; for (fv = 0; fv <= 7; fv ++) move(current[fv], mem[0xa000 * (y + fv) * 80], 79); } void update_link(char which, byte whence, byte whither) { byte fv; - ; for (fv = 1; fv <= numlinks; fv ++) { hypertype &with = link[fv]; if (with.trigger == which) { - ; with.line = size; with.start = whence; with.finish = whither; @@ -114,7 +107,6 @@ void update_link(char which, byte whence, byte whither) { void getlinks(string &x) { byte p, q; - ; do { p = pos("[", x); if (p == 0) return; /* lousy, huh? */ @@ -129,7 +121,6 @@ void loaddata(byte which) { text t; string x; integer e; - ; revpos[9] = position; fillchar(data, sizeof(data), '\0'); move(reverse[1], reverse[0], 9); @@ -144,21 +135,17 @@ void loaddata(byte which) { size = 0; numlinks = 0; while (! eof(t)) { - ; t >> x >> NL; if (x[1] == ':') { - ; numlinks += 1; { hypertype &with = link[numlinks]; - ; with.trigger = x[2]; Delete(x, 1, 3); Delete(x, pos(" ", x), 255); val(x, with.ref, e); } } else { - ; size += 1; getlinks(x); data[size] = x; @@ -170,7 +157,6 @@ void loaddata(byte which) { } void screen() { - ; setbkcolor(1); setfillstyle(1, 1); bar(0, 0, 640, 38); @@ -180,10 +166,8 @@ void screen() { void showscreen() { byte fv; - ; if (position < 1) position = 1; for (fv = 0; fv <= 15; fv ++) { - ; scribe(1, fv + position); display(41 + fv * 10); } @@ -191,11 +175,9 @@ void showscreen() { void up() { byte fv; - ; position -= 1; scribe(1, position); for (fv = 0; fv <= 9; fv ++) { - ; move(mem[0xa000 * 3200], mem[0xa000 * 3280], 12720); if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 3200], 79, '\0'); else @@ -205,11 +187,9 @@ void up() { void down() { byte fv; - ; position += 1; scribe(1, position + 15); for (fv = 0; fv <= 9; fv ++) { - ; move(mem[0xa000 * 3280], mem[0xa000 * 3200], 12720); if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 15920], 79, '\0'); else @@ -219,11 +199,9 @@ void down() { void newpage(char c) { byte fv; - ; for (fv = 1; fv <= numlinks; fv ++) { hypertype &with = link[fv]; if (with.trigger == c) { - ; loaddata(with.ref); showscreen(); } @@ -232,7 +210,6 @@ void newpage(char c) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -254,25 +231,21 @@ int main(int argc, const char *argv[]) { if (position < size) down(); break; case 'I': { - ; position -= 16; showscreen(); } break; case 'Q': { - ; position += 16; showscreen(); } break; case 'G': { - ; position = 1; showscreen(); } break; case 'O': { - ; position = size; showscreen(); } @@ -297,7 +270,6 @@ int main(int argc, const char *argv[]) { } break; case 'H': { - ; loaddata(7); /* help on help */ showscreen(); } diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp index 76948b85da60..622244e13377 100644 --- a/engines/avalanche/helper.cpp +++ b/engines/avalanche/helper.cpp @@ -264,7 +264,6 @@ void continue_help() { if (fv > 0) switch (buttons[fv].trigger) { case '\0':/*null*/ - ; break; case '\376': return; diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp index 013141998c7a..638f25d757ef 100644 --- a/engines/avalanche/hibits.cpp +++ b/engines/avalanche/hibits.cpp @@ -33,7 +33,6 @@ string q; byte fv; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(inf, "v:thank.you"); assign(outf, "d:hibits.out"); reset(inf); @@ -44,7 +43,6 @@ int main(int argc, const char *argv[]) { for (fv = 1; fv <= length(q); fv ++) outf << q[fv]; while (! eof(inf)) { - ; inf >> x; if (x < '\200') x += 128; outf << x; diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp index 09d073d3a76c..bd8a5c3ce43d 100644 --- a/engines/avalanche/highs.cpp +++ b/engines/avalanche/highs.cpp @@ -53,10 +53,8 @@ highscoretype h; void get_new_highs() { byte fv; - ; for (fv = 1; fv <= 12; fv ++) { A1 &with = h[fv]; - ; with.score = 32 - fv * 2; with.rank = "..."; } @@ -80,11 +78,9 @@ void show_highs() byte fv; varying_string<40> x; varying_string<5> y; - ; display("HIGH SCORERS\3\r Name\n\nScore Rank\r \"\"\"\"\n\n\"\"\"\"\" \"\"\"\"\f\4"); for (fv = 1; fv <= 12; fv ++) { A1 &with = h[fv]; - ; display(string('\15') + with.name + '\4'); fillchar(x, sizeof(x), '\40'); y = strf(with.score); @@ -99,7 +95,6 @@ void store_high(string who) /* This procedure shows the high-scores. */ { byte fv, ff; - ; for (fv = 1; fv <= 12; fv ++) if (h[fv].score < dna.score) flush(); @@ -110,7 +105,6 @@ void store_high(string who) { A1 &with = h[fv]; - ; with.name = who; with.score = dna.score; } @@ -119,7 +113,6 @@ void store_high(string who) void get_highs() { file f; - ; /*$I-*/ assign(f, "scores.avd"); reset(f); @@ -142,7 +135,6 @@ class unit_highs_initialize { static unit_highs_initialize highs_constructor; unit_highs_initialize::unit_highs_initialize() { - ; get_highs(); } diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp index 2f9e603b9e45..af924a0600c0 100644 --- a/engines/avalanche/hiz.cpp +++ b/engines/avalanche/hiz.cpp @@ -46,9 +46,7 @@ byte tsr_int; word tsr_ax; void grab() { - ; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -58,9 +56,7 @@ void grab() { } void drop() { - ; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -70,14 +66,12 @@ void drop() { } void say(string x) { - ; grab(); output << string('\15') + x; } void pak(string x) { char r; - ; say(x + " (press any key...)"); r = readkey(); drop(); @@ -87,33 +81,28 @@ string typein() { char r; string x; string typein_result; - ; x = ""; do { r = readkey(); switch (r) { case '\10': if (x[0] > '\0') { - ; output << string('\10') + '\40' + '\10'; x[0] -= 1; } break; case '\15': { - ; typein_result = x; return typein_result; } break; case '\33': { - ; typein_result = ""; return typein_result; } break; default: if (x[0] < '\62') { - ; x = x + r; output << r; } @@ -125,7 +114,6 @@ string typein() { void load() { byte a /*absolute $A000:1200*/; untyped_file f; - ; say("LOAD: filename?"); nam = typein(); drop(); @@ -133,20 +121,17 @@ void load() { assign(f, nam); reset(f, 1); if (ioresult != 0) { - ; pak("LOAD: file not found."); return; } seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; blockread(f, a, 12080); if (ioresult != 0) { - ; pak("LOAD: error whilst loading."); close(f); return; @@ -164,14 +149,12 @@ void save() { searchrec s; char r; byte a /*absolute $A000:1200*/; - ; say("SAVE: filename?"); nam = typein(); drop(); if (nam == "") return; findfirst(nam, anyfile, s); if (doserror == 0) { - ; say("SAVE: That exists, are you sure\? (Y/N)"); do { r = upcase(readkey()); @@ -185,14 +168,12 @@ void save() { blockwrite(f, header[1], 146); blockwrite(f, screenname, 31); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; blockwrite(f, a, 12080); if (ioresult != 0) { - ; pak("SAVE: error whilst saving."); close(f); return; @@ -201,9 +182,7 @@ void save() { } void hedges() { - ; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -215,7 +194,6 @@ void hedges() { void reset_() { registers regs; - ; regs.ax = 14; intr(0x10, regs); directvideo = false; @@ -223,7 +201,6 @@ void reset_() { void do_pop() { char r; - ; do { say("HIZ: Load Save Hedges Reset eXit?"); r = upcase(readkey()); @@ -252,14 +229,12 @@ void do_pop() { void mypoprtn() { registers r; - ; beginpop; do_pop(); endpop; } /**********************/ void stop_tsr() { - ; if (tsrexit) output << "HIZ stopped" << NL; else @@ -273,7 +248,6 @@ void stop_tsr() { void tsr_intrtn(word flags, word cs, word ip, word ax, word bx, word cx, word dx, word si, word di, word ds, word es, word bp) /*interrupt;*/ { - ; tsr_ax = ax; cli; beginint; @@ -281,18 +255,15 @@ void tsr_intrtn(word flags, word cs, word ip, word ax, word bx, word cx, word dx switch (tsr_ax) { case 1: { - ; stop_tsr(); /* Terminate TSR, if poss.*/ } break; case 2: { - ; tsroff = true; /* Suspend TSR */ output << "HIZ suspended." << NL; } break; case 3: { - ; tsroff = false; output << "HIZ restarted" << NL; } @@ -310,7 +281,6 @@ boolean b; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; /********************************************/ /* Check to see if TSR is already installed */ @@ -335,17 +305,14 @@ int main(int argc, const char *argv[]) { else r.ax = 4; if (r.ax < 4) { - ; intr(tsr_int, r); return 0; } else { - ; output << "HIZ: invalid parameter " << paramstr(1) << NL; output << "Syntax: HIZ stop/hold/rstr" << NL; return 0; } } else { - ; output << "HIZ already installed." << NL; output << "(If you're sure it isn't, try running BLANKINT /I." << NL; output << "It's in the TURBO directory.)" << NL; diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp index 46ad0a4b2c1b..ba91e79874f6 100644 --- a/engines/avalanche/initxf.cpp +++ b/engines/avalanche/initxf.cpp @@ -40,14 +40,12 @@ inirex x; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(i, "v:init0.dat"); reset(i); assign(o, "v:init.avd"); rewrite(o); while (! eof(i)) { - ; i >> x.a >> NL; i >> x.num >> NL; o << x; diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp index bfb2db11e968..c1fbc214a6e2 100644 --- a/engines/avalanche/inputtes.cpp +++ b/engines/avalanche/inputtes.cpp @@ -39,9 +39,7 @@ char r; void plottext() { byte x, y; - ; for (y = 0; y <= 7; y ++) { - ; for (x = 1; x <= length(current); x ++) mem[0xa000 * 12880 + y * 80 + x] = font[current[x]][y]; fillchar(mem[0xa000 * 12881 + y * 80 + x], 79 - x, '\0'); @@ -50,7 +48,6 @@ void plottext() { void loadfont() { file f; - ; assign(f, "c:\\thomas\\ttsmall.fnt"); reset(f); f >> font; @@ -59,7 +56,6 @@ void loadfont() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\turbo"); diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp index b23bd1cc6592..b2583acde947 100644 --- a/engines/avalanche/intro.cpp +++ b/engines/avalanche/intro.cpp @@ -263,7 +263,6 @@ void load_text() { thisline += 1; break; case '\12':/*nop*/ - ; break; default: x[thisline] = x[thisline] + *c; @@ -631,7 +630,6 @@ int main(int argc, const char *argv[]) { displaycounter += 1; do { - ; } while (!(*skellern > 0)); } diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp index f15e68bef6b6..3a9459ced937 100644 --- a/engines/avalanche/ints.cpp +++ b/engines/avalanche/ints.cpp @@ -37,18 +37,15 @@ void() old1b; boolean quicko; void new1b() { /* interrupt; */ - ; quicko = true; } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1b, &old1b); setintvec(0x1b, addr(new1b())); quicko = false; do { - ; } while (!quicko); setintvec(0x1b, &old1b); /* r.ah:=$02; intr($16,r); diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp index 7569199d33dc..1faef823ff77 100644 --- a/engines/avalanche/joysetup.cpp +++ b/engines/avalanche/joysetup.cpp @@ -44,10 +44,8 @@ boolean detect() { word x, y, xo, yo; byte count; boolean detect_result; - ; count = 0; if (joystickpresent) { - ; detect_result = true; return detect_result; } @@ -55,7 +53,6 @@ boolean detect() { do { if (count < 7) count += 1; /* Take advantage of "flutter" */ if (count == 6) { - ; output << "The Bios says you don't have a joystick. However, it's often wrong" << NL; output << "about such matters. So, do you? If you do, move joystick A to" << NL; output << "continue. If you don't, press any key to cancel." << NL; @@ -67,9 +64,7 @@ boolean detect() { } void display() { - ; { - ; gotoxy(20, 10); output << "X min: " << js.xmin << " "; gotoxy(20, 11); @@ -83,11 +78,9 @@ void display() { void getmaxmin() { word x, y; - ; output << "Rotate the joystick around in a circle, as far from the centre as it" << NL; output << "can get. Then click a button." << NL; { - ; js.xmax = 0; js.xmin = maxint; js.ymax = 0; @@ -96,7 +89,6 @@ void getmaxmin() { do { readjoya(x, y); { - ; if (x < js.xmin) js.xmin = x; if (y < js.ymin) js.ymin = y; if (x > js.xmax) js.xmax = x; @@ -105,19 +97,16 @@ void getmaxmin() { } } while (!(buttona1 | buttona2)); do { - ; } while (!(~(buttona1 | buttona2))); output << NL; output << "Thank you. Now please centre your joystick and hit a button." << NL; do { - ; } while (!(buttona1 | buttona2)); readjoya(js.xmid, js.ymid); } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 2; clrscr; output << "Avalot joystick setup routine- by TT. Thanks go to David B. Howorth." << NL; diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp index 8b9496ccf1db..57efc1854635 100644 --- a/engines/avalanche/joystick.cpp +++ b/engines/avalanche/joystick.cpp @@ -83,7 +83,6 @@ boolean newbios() { /*$F+*/ void oldreadjoy(byte xbit, byte ybit, word &xaxis, word &yaxis) { - ; /* inline( $BA/$01/$02/ {mov dx, 201h ;load dx with joystick port address } diff --git a/engines/avalanche/loading.cpp b/engines/avalanche/loading.cpp index 234b5773b865..faacafc4f4b8 100644 --- a/engines/avalanche/loading.cpp +++ b/engines/avalanche/loading.cpp @@ -36,14 +36,12 @@ untyped_file f; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); assign(f, "c:\\sleep\\test.ega"); reset(f, 1); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/logger.cpp b/engines/avalanche/logger.cpp index 06c2f2969a9a..3b1225188f1e 100644 --- a/engines/avalanche/logger.cpp +++ b/engines/avalanche/logger.cpp @@ -79,14 +79,12 @@ byte scroll_line_length; void centre(byte size, byte x) { /* Prints req'd number of spaces. */ byte fv; - ; if (~ logging) return; for (fv = 1; fv <= size - (x / 2); fv ++) output << logfile << ' '; } void log_setup(string name, boolean printing) { /* Sets up. */ - ; assign(logfile, name); rewrite(logfile); output << logfile << startwith; @@ -102,10 +100,8 @@ void log_setup(string name, boolean printing) { /* Sets up. */ void log_divider() { /* Prints the divider sign. */ byte fv; - ; if (~ logging) return; if (log_epson) { - ; output << logfile << string(' ') + double_width; for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; output << logfile << string(' ') + double_off; @@ -115,7 +111,6 @@ void log_divider() { /* Prints the divider sign. */ } void log_command(string x) { /* Prints a command */ - ; if (~ logging) return; if (log_epson) output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; @@ -124,14 +119,12 @@ void log_command(string x) { /* Prints a command */ } void log_addstuff(string x) { - ; if (~ logging) return; scroll_line = scroll_line + x; } void log_scrollchar(string x) { /* print one character */ varying_string<2> z; - ; if (~ logging) return; switch (x[1]) { case '`': @@ -151,7 +144,6 @@ void log_scrollchar(string x) { /* print one character */ } void log_italic() { - ; if (~ logging) return; if (log_epson) log_addstuff(italic); @@ -160,7 +152,6 @@ void log_italic() { } void log_roman() { - ; if (~ logging) return; if (log_epson) log_addstuff(italic_off); @@ -169,20 +160,17 @@ void log_roman() { } void log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - ; if (~ logging) return; if (log_epson) log_addstuff(italic_off); } void log_scrollline() { /* Set up a line for the scroll driver */ - ; scroll_line_length = 0; scroll_line = ""; } void log_scrollendline(boolean centred) { byte x, fv; - ; if (~ logging) return; x = 17; if (centred) x += (50 - scroll_line_length) / 2; @@ -192,27 +180,22 @@ void log_scrollendline(boolean centred) { void log_bubbleline(byte linenum, byte whom, string x) { byte fv; - ; if (~ logging) return; if (linenum == 1) { - ; for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; } else { - ; for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; output << logfile << x << NL; } } void log_newline() { - ; if (logging) output << logfile << NL; } void log_newroom(string where) { byte fv; - ; if (~ logging) return; for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; if (log_epson) output << logfile << emph_on; @@ -224,7 +207,6 @@ void log_newroom(string where) { void log_aside(string what) /* This writes "asides" to the printer. For example, moves in Nim. */ { - ; if (~ logging) return; output << logfile << " (" << italic << what << italic_off << ')' << NL; /* "What" is what to write. */ @@ -232,7 +214,6 @@ void log_aside(string what) void log_score(word credit, word now) { byte fv; - ; if (~ logging) return; for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 01916ce049b6..f7afeec9314a 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -111,7 +111,6 @@ void draw_also_lines() { on_virtual(); break; case 2 : - ; break; /* zzzz, it was off anyway */ case 3 : on(); @@ -140,7 +139,6 @@ static void unscramble(); static void scram1(string &x) { byte fz; - ; for (fz = 1; fz <= length(x); fz ++) x[fz] = chr(ord(x[fz]) ^ 177); } @@ -1396,7 +1394,6 @@ void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t) /* assembler; */ pop ds; { Get it back again (or we'll be in trouble with TP!) } */ { - ; } void blitfix() { @@ -1651,7 +1648,6 @@ asm @TheEnd: */ { - ; } void sprite_run() diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp index 0845a052716f..c3822a392a99 100644 --- a/engines/avalanche/magic2.cpp +++ b/engines/avalanche/magic2.cpp @@ -38,7 +38,6 @@ word next, gg; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -48,12 +47,10 @@ int main(int argc, const char *argv[]) { rewrite(out); move(mem[0xa000 * 0], mem[0xa000 * pagetop], 16000); while (! eof(magic)) { - ; magic >> next; if (next != nextcode) mem[0xa000 * next] = 255; else { - ; for (gg = 0; gg <= 16000; gg ++) if (mem[0xa000 * gg] != mem[0xa000 * gg + pagetop]) out << gg; diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp index 0f280c29e0bb..32f85108f29c 100644 --- a/engines/avalanche/magidraw.cpp +++ b/engines/avalanche/magidraw.cpp @@ -39,7 +39,6 @@ array<1, 16401, word> buffer; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -49,9 +48,8 @@ int main(int argc, const char *argv[]) { close(magic); /* while not eof(magic) do*/ for (gd = 1; gd <= 16401; gd ++) { - ; /* read(magic,next); - if next<>nextcode then*/ + if next<>nextcode then*/ if (buffer[gd] != nextcode) mem[0xa000 * buffer[gd]] = 255; else diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp index 2ef6e37fed4c..9d7edd76a5c2 100644 --- a/engines/avalanche/magishuf.cpp +++ b/engines/avalanche/magishuf.cpp @@ -43,20 +43,15 @@ circle c; file fc; void melt(byte c) { - ; for (gd = 1; gd <= 8000; gd ++) { - ; mem[0xa000 * b[gd]] = c; if ((gd % 17) == 0) delay(1); } } void magicirc(byte cc) { - ; for (gd = 1; gd <= 16401; gd ++) { - ; if (c[gd] != nextcode) { - ; if (odd(c[gd])) mem[0xa000 * c[gd] / 2] = cc; } else delay(1); @@ -65,7 +60,6 @@ void magicirc(byte cc) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; r.ax = 13; intr(0x10, r); assign(f, "d:shuffle.avd"); diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp index a4cf27801f94..4a4b2740098b 100644 --- a/engines/avalanche/make!.cpp +++ b/engines/avalanche/make!.cpp @@ -38,14 +38,12 @@ string x; boolean subpix(integer x, integer y) { boolean subpix_result; - ; subpix_result = getpixel(x, y) == 15; return subpix_result; } byte pixel(integer x, integer y) { byte pixel_result; - ; pixel_result = (byte)( subpix(x * 4, y * 2) || subpix(x * 4 + 1, y * 2) || @@ -61,7 +59,6 @@ byte pixel(integer x, integer y) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 1; initgraph(gd, gm, "o:"); @@ -76,7 +73,6 @@ int main(int argc, const char *argv[]) { assign(t, "d:avalot.txt"); rewrite(t); for (gm = 1; gm <= 36; gm ++) { - ; x = ""; for (gd = 1; gd <= 106; gd ++) switch (getpixel(gd, gm * 2 + 181) * 2 + getpixel(gd, gm * 2 + 182)) { diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp index 35b37d227fea..f3b5c4cb0787 100644 --- a/engines/avalanche/makeregi.cpp +++ b/engines/avalanche/makeregi.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -29,143 +29,148 @@ namespace Avalanche { -const array<1,56,char> padding = -"For all the Etruscan armies were ranged beneath his eye"; +const array<1, 56, char> padding = + "For all the Etruscan armies were ranged beneath his eye"; -text txi,txo; -string x,y; +text txi, txo; +string x, y; word fv; file f; -byte sum,n; -string name,number; +byte sum, n; +string name, number; -string chkname,chknum,regname,regnum; +string chkname, chknum, regname, regnum; - char decode1(char c) - { - byte b; +char decode1(char c) { + byte b; - char decode1_result; - b=ord(c)-32; - decode1_result=chr(( (b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; - } + char decode1_result; + b = ord(c) - 32; + decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); + return decode1_result; +} - char encode1(char c) - { - byte b; +char encode1(char c) { + byte b; - char encode1_result; - b=ord(c); - b=( (cardinal)(b & 0x78) >> 3) + ((b & 0x7) << 4); - encode1_result=chr(b+32); - return encode1_result; - } + char encode1_result; + b = ord(c); + b = ((cardinal)(b & 0x78) >> 3) + ((b & 0x7) << 4); + encode1_result = chr(b + 32); + return encode1_result; +} - char encode2(char c) - { - char encode2_result; - encode2_result=chr((((ord(c) & 0xf) << 2)+0x43)); - return encode2_result; - } +char encode2(char c) { + char encode2_result; + encode2_result = chr((((ord(c) & 0xf) << 2) + 0x43)); + return encode2_result; +} - string enc1(string x) - { - string y; byte fv; +string enc1(string x) { + string y; + byte fv; - string enc1_result; - y=x; for( fv=1; fv <= length(y); fv ++) y[fv]=encode1(y[fv]); - enc1_result=y; - return enc1_result; - } + string enc1_result; + y = x; + for (fv = 1; fv <= length(y); fv ++) y[fv] = encode1(y[fv]); + enc1_result = y; + return enc1_result; +} - string enc2(string x) - { - string y; byte fv; +string enc2(string x) { + string y; + byte fv; - string enc2_result; - y=x; for( fv=1; fv <= length(y); fv ++) y[fv]=encode2(y[fv]); - enc2_result=y; - return enc2_result; - } + string enc2_result; + y = x; + for (fv = 1; fv <= length(y); fv ++) y[fv] = encode2(y[fv]); + enc2_result = y; + return enc2_result; +} - boolean checker(string proper,string check) - { - byte fv; boolean ok; +boolean checker(string proper, string check) { + byte fv; + boolean ok; - boolean checker_result; - ok=true; - for( fv=1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf)!=((cardinal)(ord(check[fv])-0x43) >> 2)) - ok=false; + boolean checker_result; + ok = true; + for (fv = 1; fv <= length(proper); fv ++) + if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) + ok = false; - checker_result=ok; - return checker_result; - } + checker_result = ok; + return checker_result; +} - void unscramble() - { - byte namelen,numlen; +void unscramble() { + byte namelen, numlen; - namelen=107-ord(x[1]); numlen=107-ord(x[2]); + namelen = 107 - ord(x[1]); + numlen = 107 - ord(x[2]); - regname=copy(x,3,namelen); - regnum=copy(x,4+namelen,numlen); - chkname=copy(x,4+namelen+numlen,namelen); - chknum=copy(x,4+namelen+numlen+namelen,numlen); + regname = copy(x, 3, namelen); + regnum = copy(x, 4 + namelen, numlen); + chkname = copy(x, 4 + namelen + numlen, namelen); + chknum = copy(x, 4 + namelen + numlen + namelen, numlen); - for( fv=1; fv <= namelen; fv ++) regname[fv]=decode1(regname[fv]); - for( fv=1; fv <= numlen; fv ++) regnum[fv]=decode1(regnum[fv]); + for (fv = 1; fv <= namelen; fv ++) regname[fv] = decode1(regname[fv]); + for (fv = 1; fv <= numlen; fv ++) regnum[fv] = decode1(regnum[fv]); - if ((! checker(regname,chkname)) || (! checker(regnum,chknum))) - { - output << "CHECK ERROR: " << regname << '/' << chkname << ';' << regnum << '/' << chknum << '.' << NL; - exit(0); - } else output << "--- Passed both checks. ---" << NL; - } + if ((! checker(regname, chkname)) || (! checker(regnum, chknum))) { + output << "CHECK ERROR: " << regname << '/' << chkname << ';' << regnum << '/' << chknum << '.' << NL; + exit(0); + } else output << "--- Passed both checks. ---" << NL; +} -int main(int argc, const char* argv[]) -{ +int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "Name? "; input >> name >> NL; - output << "Number? "; input >> number >> NL; + pio_initialize(argc, argv); + output << "Name? "; + input >> name >> NL; + output << "Number? "; + input >> number >> NL; - x=string(chr(107-ord(name[0])))+chr(107-ord(number[0])); + x = string(chr(107 - ord(name[0]))) + chr(107 - ord(number[0])); - x=x+enc1(name)+'J'+enc1(number)+enc2(name)+enc2(number); + x = x + enc1(name) + 'J' + enc1(number) + enc2(name) + enc2(number); - number=""; fv=1; - while ((length(number)+length(x))<57) - { - number=number+padding[fv-1]; fv=fv+1; - } - x=x+enc1(number); + number = ""; + fv = 1; + while ((length(number) + length(x)) < 57) { + number = number + padding[fv - 1]; + fv = fv + 1; + } + x = x + enc1(number); - output << x << NL; output << NL; - unscramble(); + output << x << NL; + output << NL; + unscramble(); - assign(txi,"v:register.raw"); reset(txi); - assign(txo,"a:register.dat"); rewrite(txo); + assign(txi, "v:register.raw"); + reset(txi); + assign(txo, "a:register.dat"); + rewrite(txo); - for( fv=1; fv <= 53; fv ++) - { - txi >> y >> NL; txo << y << NL; - } + for (fv = 1; fv <= 53; fv ++) { + txi >> y >> NL; + txo << y << NL; + } - txi >> y >> NL; txo << x << NL; + txi >> y >> NL; + txo << x << NL; - while (! eof(txi)) - { - txi >> y >> NL; txo << y << NL; - } + while (! eof(txi)) { + txi >> y >> NL; + txo << y << NL; + } - close(txi); close(txo); - return EXIT_SUCCESS; + close(txi); + close(txo); + return EXIT_SUCCESS; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp index 1307f175152c..cba5b61b5bd9 100644 --- a/engines/avalanche/makesez.cpp +++ b/engines/avalanche/makesez.cpp @@ -46,14 +46,12 @@ char check; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; fillchar(x, sizeof(x), '\261'); x = string("This is a Sez file for an Avvy game, and its contents are subject") + crlf + "to copyright. Have fun with the game!" + crlf + crlf + tabs + "tt" + crlf + crlf + "[Lord Avalot D'Argent]" + crlf + crlf + eof_ + crlf + crlf + "Thomas was here!"; { - ; header.initials = "TT"; header.gamecode = 2; /* code for Avalot */ header.revision = 100; /* version 1.00 */ diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp index 3b71276a619c..4d3b3ba22f4d 100644 --- a/engines/avalanche/makevmou.cpp +++ b/engines/avalanche/makevmou.cpp @@ -46,7 +46,7 @@ struct vmctype { /* Virtual Mouse Cursor */ }; const array<1, 9, arrowtype> mps = { - { { + { { /* 1 - up-arrow */ ((65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575), (0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0)), @@ -135,15 +135,12 @@ integer plx, ply; word swapbits(word a) { word swapbits_result; - ; swapbits_result = lo(a) * 256 + hi(a); return swapbits_result; } void plot_vmc(integer xx, integer yy, byte page_) { - ; { - ; xx = xx + vmc.ofsx; yy = yy + vmc.ofsy; @@ -152,7 +149,6 @@ void plot_vmc(integer xx, integer yy, byte page_) { putimage(xx, yy, vmc.xorpic, xorput); { pointtype &with1 = vmc.wherewas[page_]; - ; with1.x = xx; with1.y = yy; } @@ -160,7 +156,6 @@ void plot_vmc(integer xx, integer yy, byte page_) { } void wipe_vmc(byte page_) { - ; { pointtype &with1 = vmc.wherewas[page_]; if (with1.x != maxint) @@ -170,16 +165,13 @@ void wipe_vmc(byte page_) { void setup_vmc() { byte fv; - ; /* gd:=imagesize(0,0,15,15);*/ { - ; getmem(vmc.andpic, mouse_size); getmem(vmc.xorpic, mouse_size); for (fv = 0; fv <= 1; fv ++) { - ; getmem(vmc.backpic[fv], mouse_size); vmc.wherewas[fv].x = maxint; } @@ -187,13 +179,11 @@ void setup_vmc() { } void show_off_mouse() { - ; setcolor(14); settextstyle(0, 0, 2); for (gm = 0; gm <= 1; gm ++) { - ; setactivepage(gm); setfillstyle(1, blue); bar(0, 0, getmaxx(), getmaxy()); @@ -212,7 +202,6 @@ void show_off_mouse() { wipe_vmc(gd); if (plot > 0) { - ; putpixel(plx, ply, red); plot -= 1; } @@ -220,7 +209,6 @@ void show_off_mouse() { plot_vmc(mx, my, gd); if ((mkey == left) && (plot == 0)) { - ; plot = 2; plx = mx; ply = my; @@ -229,7 +217,6 @@ void show_off_mouse() { } while (!(mkey == right)); for (gm = 0; gm <= 1; gm ++) { - ; setactivepage(1 - gm); wipe_vmc(gm); } @@ -239,7 +226,6 @@ void show_off_mouse() { } void grab_cursor(byte n) { - ; getimage(32 * n - 16, 0, 32 * n - 1, 15, vmc.andpic); getimage(32 * n - 16, 20, 32 * n - 1, 35, vmc.xorpic); } @@ -247,14 +233,12 @@ void grab_cursor(byte n) { void save_mice() { untyped_file f; byte fv; - ; assign(f, "v:mice.avd"); rewrite(f, 1); blockwrite(f, mice_header, mouse_size); for (fv = 1; fv <= 9; fv ++) { - ; grab_cursor(fv); putimage(100, 100, vmc.xorpic, 0); blockwrite(f, vmc.andpic, mouse_size); @@ -266,19 +250,16 @@ void save_mice() { void load_a_mouse(byte which) { untyped_file f; - ; assign(f, "v:mice.avd"); reset(f, 1); seek(f, mouse_size * 2 * (which - 1) + 134); { - ; blockread(f, vmc.andpic, mouse_size); blockread(f, vmc.xorpic, mouse_size); close(f); { void &with1 = mps[which]; - ; vmc.ofsx = -horzhotspot; vmc.ofsy = -verthotspot; @@ -290,7 +271,6 @@ void load_a_mouse(byte which) { } void draw_mouse_cursors() { - ; for (fv = 1; fv <= 9; fv ++) for (gm = 0; gm <= 1; gm ++) for (gd = 0; gd <= 15; gd ++) @@ -299,7 +279,6 @@ void draw_mouse_cursors() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp index 3a88863accc9..b60796461f4a 100644 --- a/engines/avalanche/minstran.cpp +++ b/engines/avalanche/minstran.cpp @@ -37,14 +37,11 @@ void mblit(integer x1, integer y1, integer x2, integer y2) { /* Minstrel Blitter integer yy, len, pp; byte bit; const integer offset = 16384; - ; x1 = x1 / 8; len = ((x2 / 8) - x1) + 1; for (yy = y1; yy <= y2; yy ++) { - ; pp = yy * 80 + x1; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -61,7 +58,6 @@ const integer fy2 = 145; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp index e5c47744282e..579799a2bd0e 100644 --- a/engines/avalanche/newsprit.cpp +++ b/engines/avalanche/newsprit.cpp @@ -73,9 +73,7 @@ untyped_file out; integer bigsize; void copyaoa() { - ; { - ; a.name = oa.name; a.comment = "Transferred"; a.num = oa.num; @@ -90,7 +88,6 @@ void copyaoa() { void setup() { integer gd, gm; - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -99,7 +96,6 @@ void setup() { string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; @@ -112,10 +108,8 @@ void save() { byte xw; byte nxl, nyl; word soa; - ; cleardevice(); { - ; a.xl = 45; a.yl = 10; a.num = 1; @@ -136,7 +130,6 @@ void save() { if ((nxl % 8) > 0) xw += 1; for (n = 1; n <= a.num; n ++) { - ; getimage(0, 0, a.xl, a.yl, aa); for (fv = 0; fv <= nyl; fv ++) blockwrite(out, aa[5 + fv * xw * 4], xw); @@ -149,7 +142,6 @@ void save() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup(); save(); diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 238908cf9f58..9c1f2c6a23f1 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -50,20 +50,17 @@ shortint mnum, mrow; registers r; void resetmouse() { - ; r.ax = 0; intr(0x33, r); squeak = r.ax > 0; } void show() { - ; r.ax = 1; intr(0x33, r); } void hide() { - ; r.ax = 2; intr(0x33, r); } @@ -71,9 +68,7 @@ void hide() { void chalk(integer x, integer y, string z) { const array<0, 3, byte> greys = {{0, 8, 7, 15}}; byte fv; - ; for (fv = 0; fv <= 3; fv ++) { - ; setcolor(greys[fv]); outtextxy(x - fv, y, z); sound(fv * 100 * length(z)); @@ -87,7 +82,6 @@ void setup() { untyped_file f; integer gd, gm; byte bit; - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -97,7 +91,6 @@ void setup() { seek(f, 41); for (gm = 0; gm <= 22; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -107,7 +100,6 @@ void setup() { for (gd = 1; gd <= 3; gd ++) for (gm = 0; gm <= 22; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -116,7 +108,6 @@ void setup() { } for (gm = 0; gm <= 36; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -161,11 +152,9 @@ void setup() { void plotstone(byte x, byte y) { byte fv, bit; word ofs; - ; ofs = 3200 + y * 2800 + x * 8; for (fv = 0; fv <= 22; fv ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -176,7 +165,6 @@ void plotstone(byte x, byte y) { void board() { byte fv, ff; - ; for (fv = 1; fv <= 3; fv ++) for (ff = 1; ff <= stones[fv]; ff ++) plotstone(ff, fv); @@ -185,7 +173,6 @@ void board() { void startmove() { varying_string<2> tstr; integer ypos; - ; turns += 1; str(turns, 2, tstr); ypos = 63 + turns * 10; @@ -197,7 +184,6 @@ void startmove() { void show_changes() { byte fv, ff, fq; - ; chalk(573, 63 + turns * 10, string(chr(64 + row)) + chr(48 + number)); for (fv = 1; fv <= 3; fv ++) if (old[fv] > stones[fv]) @@ -209,7 +195,6 @@ void show_changes() { void checkmouse(); static void blip() { - ; sound(1771); delay(3); nosound; @@ -217,9 +202,7 @@ static void blip() { } void checkmouse() { - ; { - ; ax = 5; bx = 0; } @@ -237,20 +220,17 @@ void checkmouse() { void takesome(); static void less() { - ; if (number > 1) number -= 1; } void takesome() { char r; byte sr; - ; number = 1; do { do { sr = stones[row]; if (sr == 0) { - ; row = row % 3 + 1; number = 1; } @@ -270,12 +250,10 @@ void takesome() { rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); if (clicked) { - ; number = mnum; row = mrow; return; } else { - ; switch (r) { case '\0': switch (readkey()) { @@ -327,7 +305,6 @@ void takesome() { void endofgame() { char rr; - ; chalk(595, 63 + turns * 10, "Wins!"); outtextxy(100, 190, "- - - Press any key... - - -"); while (keypressed()) rr = readkey(); @@ -360,10 +337,8 @@ static boolean find(byte x) boolean q; byte p; boolean find_result; - ; q = false; for (p = 1; p <= 3; p ++) if (stones[p] == x) { - ; q = true; inap[p] = true; } @@ -375,7 +350,6 @@ static boolean find(byte x) static void find_ap(byte start, byte stepsize) { byte ff; - ; matches = 0; fillchar(inap, sizeof(inap), '\0'); /* blank 'em all */ for (ff = 0; ff <= 2; ff ++) if (find(start + ff * stepsize)) matches += 1; @@ -388,7 +362,6 @@ static void find_ap(byte start, byte stepsize) { switch (matches) { case 2: { - ; for (ff = 1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ if (! inap[ff]) ooo = ff; if (stones[ooo] > (start + thisone * stepsize)) { /* check it's possible! */ @@ -416,13 +389,10 @@ void dogfood() { boolean sorted; byte temp; - ; live = 0; lmo = false; for (fv = 1; fv <= 3; fv ++) { - ; if (stones[fv] > 0) { - ; live += 1; r[live] = fv; sr[live] = stones[fv]; @@ -430,22 +400,18 @@ void dogfood() { } switch (live) { case 1: { /* Only one is free- so take 'em all */ - ; row = r[1]; number = stones[r[1]]; return; } break; case 2: { /* Two are free- make them equal */ - ; if (sr[1] > sr[2]) { - ; row = r[1]; number = sr[1] - sr[2]; return; } else /* T > b */ if (sr[1] < sr[2]) { - ; row = r[2]; number = sr[2] - sr[1]; return; @@ -458,15 +424,13 @@ void dogfood() { } break; case 3: { /* Ho hum... this'll be difficult! */ - ; /* There are three possible courses of action when we have 3 lines left: - 1) Look for 2 equal lines, then take the odd one out. - 2) Look for A.P.s, and capitalise on them. - 3) Go any old where. */ + 1) Look for 2 equal lines, then take the odd one out. + 2) Look for A.P.s, and capitalise on them. + 3) Go any old where. */ for (fv = 1; fv <= 3; fv ++) /* Look for 2 equal lines */ if (stones[other[fv][1]] == stones[other[fv][2]]) { - ; row = fv; /* this row */ number = stones[fv]; /* all of 'em */ return; } @@ -474,7 +438,6 @@ void dogfood() { sorted = true; for (fv = 1; fv <= 2; fv ++) if (sr[fv] > sr[fv + 1]) { - ; temp = sr[fv + 1]; sr[fv + 1] = sr[fv]; sr[fv] = temp; @@ -486,7 +449,6 @@ void dogfood() { } while (!sorted); /* Now we look for A.P.s ... */ for (fv = 1; fv <= 3; fv ++) { - ; find_ap(fv, 1); /* there are 3 "1"s */ if (lmo) return; /* cut-out */ } @@ -504,7 +466,6 @@ void dogfood() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup(); board(); do { diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp index 9464d64d8e31..7a40e93b2d24 100644 --- a/engines/avalanche/nimdraw.cpp +++ b/engines/avalanche/nimdraw.cpp @@ -36,7 +36,6 @@ untyped_file f; byte bit; void plot(char ch, byte x) { - ; setcolor(blue); outtextxy(x * 80 + 4, 0, ch); outtextxy(x * 80 + 10, 0, ch); @@ -56,7 +55,6 @@ void load() { varying_string<12> check; untyped_file f; word s; - ; assign(f, "c:\\avalot\\nimstone.avd"); reset(f, 1); seek(f, 85); @@ -71,7 +69,6 @@ void load() { void spludge(integer x, integer y, string z) { shortint dx, dy; - ; setcolor(15); for (dx = -1; dx <= 1; dx ++) for (dy = -1; dy <= 1; dy ++) @@ -82,7 +79,6 @@ void spludge(integer x, integer y, string z) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -123,7 +119,6 @@ int main(int argc, const char *argv[]) { for (gd = 0; gd <= 3; gd ++) for (gm = 7; gm <= 29; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -132,7 +127,6 @@ int main(int argc, const char *argv[]) { } for (gm = 99; gm <= 135; gm ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp index 581f68abfb59..e38ec30fa3b0 100644 --- a/engines/avalanche/oldfiler.cpp +++ b/engines/avalanche/oldfiler.cpp @@ -57,10 +57,8 @@ string answer; void split(string x) { byte fv; - ; x = copy(x, 4, 255); if (x == "") { - ; blank[0] = true; return; } @@ -68,7 +66,6 @@ void split(string x) { possible[0][1] = "b\\"; fv = 2; while (pos("\\", x) != 0) { - ; possible[0][fv] = string('b') + copy(x, 1, pos("\\", x) - 1); fv += 1; x = copy(x, pos("\\", x) + 1, 255); @@ -77,7 +74,6 @@ void split(string x) { } void block(integer x1, integer y1, integer x2, integer y2, string x) { - ; bar(x1, y1, x2, y2); setcolor(9); outtextxy(x1 + (x2 - x1) / 2 - 1, y1 + 5, x); @@ -86,12 +82,10 @@ void block(integer x1, integer y1, integer x2, integer y2, string x) { } void message(string x) { - ; block(5, 189, 640, 200, x); } void bigbar(byte x) { - ; bar(15 + 210 * x, 36, 210 + 210 * x, 187); } @@ -101,11 +95,9 @@ void getem(); static void sub_getem(char prefix, string spec, byte attrib, byte infonum) { searchrec s; byte fv; - ; fv = 0; findfirst(spec, attrib, s); while ((doserror == 0) && (fv < 100)) { - ; if (((s.attr & attrib) > 0) && (s.name[1] != '.')) { ; /* circumvent inclusive searching! */ fv += 1; @@ -119,7 +111,6 @@ static void sub_getem(char prefix, string spec, byte attrib, byte infonum) { void getem() { - ; message("Please wait... scanning directory..."); sub_getem('a', "*.asg", archive + hidden, 1); /* Scan for .ASG files */ sub_getem('f', "*.*", directory, 2); /* Scan for sub-directories */ @@ -127,16 +118,13 @@ void getem() void minisc(string &x) { /* Converts to lower-case */ byte fv; - ; for (fv = 1; fv <= length(x); fv ++) if ((x[fv] >= 'A') && (x[fv] <= 'Z')) x[fv] += 32; } void showall() { byte fv, ff; - ; for (fv = 0; fv <= 2; fv ++) { - ; bigbar(fv); /* blank out anything else */ if (blank[fv]) { ; /* nothing here at all */ @@ -151,7 +139,6 @@ void showall() { ; /* something here- what? */ setcolor(11); for (ff = 0; ff <= 15; ff ++) { - ; info[fv][ff + 2] = possible[fv][page_[fv] * 15 + ff + 1]; minisc(info[fv][ff + 2]); } @@ -161,7 +148,6 @@ void showall() { info[fv][18] = down; else info[fv][18] = ""; for (ff = 1; ff <= 18; ff ++) { - ; outtextxy(113 + 210 * fv, 35 + ff * 8, copy(info[fv][ff], 2, 255)); } } @@ -170,7 +156,6 @@ void showall() { } void changedir(string x) { - ; chdir(x); getdir(0, cdir); @@ -178,7 +163,6 @@ void changedir(string x) { void drawup() { integer gd; - ; block(15, 0, 630, 10, "Choose an .ASG file to load or save."); block(15, 24, 210, 34, "Looking back:"); block(225, 24, 420, 34, "Here:"); @@ -188,7 +172,6 @@ void drawup() { } void setup() { - ; settextjustify(1, 1); setfillstyle(1, 1); fillchar(blank, sizeof(blank), '\0'); @@ -202,7 +185,6 @@ void setup() { void setup1() { integer gd, gm; - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -224,7 +206,6 @@ void clickwait() { } }; byte oldcht; /* Click Here To... code */ - ; showmousecursor; oldcht = 177; do { @@ -241,7 +222,6 @@ void clickwait() { chtcode = 4; } if (oldcht != chtcode) { - ; hidemousecursor; message(string("Click here to ") + msg[chtcode]); showmousecursor; @@ -253,7 +233,6 @@ void clickwait() { } void blip() { - ; sound(32); delay(3); nosound; @@ -263,7 +242,6 @@ void do_cht() { char r; byte fv; string x; - ; if (chtcode == 1) { ; /* change drives */ message("Enter the drive letter (e.g. A)..."); @@ -271,7 +249,6 @@ void do_cht() { changedir(string(r) + ':'); setup(); } else { - ; x = info[chtcode - 2][where]; r = x[1]; x = copy(x, 2, 255); @@ -312,7 +289,6 @@ void do_cht() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup1(); do { clickwait(); diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp index b53768f893df..c95b9a2d91c8 100644 --- a/engines/avalanche/oldhighs.cpp +++ b/engines/avalanche/oldhighs.cpp @@ -64,10 +64,8 @@ tabletype table; byte ratingname(word x) { byte fv; byte ratingname_result; - ; for (fv = 9; fv >= 1; fv --) if (x >= ratings[fv].lowest) { - ; ratingname_result = fv; return ratingname_result; } /* bad style */ @@ -82,10 +80,8 @@ const string message = "A v a l o t : H i g h - S c o r e s"; static void sayfast(integer x, integer y) { integer anchor; byte fv; - ; anchor = -296; for (fv = 1; fv <= length(message); fv ++) { - ; if (message[fv - 1] != '\40') outtextxy(x + anchor, y - 8, message[fv - 1]); anchor += 16; } @@ -97,15 +93,12 @@ void title() { byte x; integer len; - ; settextstyle(0, 0, 2); /*settextjustify(1,1);*/ len = textheight(message); for (x = 6; x >= 0; x --) { - ; setcolor(shades[x]); sayfast(320 - x * 2, 20 - x); if (x > 0) { - ; sayfast(320 + x * 2, 20 - x); sayfast(320 + x * 2, 20 + x); sayfast(320 - x * 2, 20 + x); @@ -121,11 +114,9 @@ void newtable() { } }; byte fv; - ; fillchar(table, sizeof(table), '\261'); for (fv = 1; fv <= 12; fv ++) { scoretype &with = table.a[fv]; - ; with.name = names[fv]; with.score = 193 - fv * 16; } @@ -135,14 +126,12 @@ void newtable() { string strf(longint x) { /* From Gyro. Delete when integrated. */ string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; } void sparkle(integer x, integer y, string z) { - ; setcolor(cyan); outtextxy(x - 1, y - 1, z); setcolor(blue); @@ -153,7 +142,6 @@ void sparkle(integer x, integer y, string z) { void drawtable() { byte fv, last, now; - ; setfillstyle(1, 8); bar(0, 40, 105, 58); bar(110, 40, 400, 58); @@ -175,7 +163,6 @@ void drawtable() { last = 177; for (fv = 1; fv <= 12; fv ++) { scoretype &with = table.a[fv]; - ; settextjustify(righttext, bottomtext); sparkle(100, 60 + fv * 10, strf(fv) + '.'); sparkle(455, 60 + fv * 10, strf(with.score)); @@ -193,7 +180,6 @@ void drawtable() { } void message1(string x) { - ; setfillstyle(1, 8); bar(0, 190, 640, 200); settextjustify(1, 1); @@ -204,12 +190,10 @@ void sorthst() { byte fv; boolean ok; scoretype temp; - ; do { ok = true; for (fv = 1; fv <= 11; fv ++) if (table.a[fv].score < table.a[fv + 1].score) { - ; temp = table.a[fv]; table.a[fv] = table.a[fv + 1]; table.a[fv + 1] = temp; /* swap 'em */ @@ -224,7 +208,6 @@ static integer x, y; static void cursor(byte col) { - ; setcolor(col); outtextxy(x, y, "?"); } @@ -235,7 +218,6 @@ void entername() { integer counter; byte flash; - ; y = 60 + table.light * 10; i = ""; settextjustify(2, 0); @@ -246,7 +228,6 @@ void entername() { do { counter += 1; if (counter == 1000) { - ; cursor(4 + flash * 10); flash = 1 - flash; counter = 0; @@ -258,17 +239,13 @@ void entername() { r = readkey(); nosound; if (r == '\10') { - ; if (i[0] > '\0') { - ; bar(x - 17, y - 10, x - 8, y); i[0] -= 1; sparkle(x - 16, y, i[length(i)]); } } else { - ; if ((i[0] < '\42') && (r != '\15')) { - ; sparkle(x, y, r); i = i + r; } @@ -278,11 +255,9 @@ void entername() { } void newscore(word sc) { - ; { scoretype &with = table.a[12]; if (sc > with.score) { - ; with.name = ""; with.score = sc; table.light = 10; @@ -294,13 +269,11 @@ void newscore(word sc) { } /* too low for score */ message1("Press Space to continue..."); do { - ; } while (!(keypressed() && (readkey() == '\40'))); } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp index 89bc90705121..b9b58265bfa6 100644 --- a/engines/avalanche/oldincln.cpp +++ b/engines/avalanche/oldincln.cpp @@ -60,7 +60,6 @@ string inihead, initail; /* For reading the .INI file. */ void linebug(byte which) { - ; output << "AVALOT : "; switch (which) { case bug_twonames : @@ -84,7 +83,6 @@ void linebug(byte which) { } void syntax() { - ; assign(output, ""); rewrite(output); output << NL; @@ -106,13 +104,11 @@ void syntax() { void upstr(string &x) { byte fv; - ; for (fv = 1; fv <= length(x); fv ++) x[fv] = upcase(x[fv]); } boolean yesno() { boolean yesno_result; - ; if (initail == "YES") yesno_result = true; else if (initail == "NO") yesno_result = false; else @@ -121,7 +117,6 @@ boolean yesno() { } void ini_parse() { - ; upstr(inihead); upstr(initail); @@ -135,7 +130,6 @@ void ini_parse() { void strip_ini() { byte fv; - ; if (inihead == "") return; /* Firstly, delete any comments. */ @@ -165,12 +159,10 @@ void strip_ini() { void load_ini() { text ini; - ; assign(ini, "AVALOT.INI"); reset(ini); while (! eof(ini)) { - ; ini >> inihead >> NL; strip_ini(); if (inihead != "") ini_parse(); @@ -184,7 +176,6 @@ static string arg; static string getarg(string otherwis) { string getarg_result; - ; if (arg == "") getarg_result = otherwis; else getarg_result = ""; return getarg_result; @@ -193,11 +184,9 @@ static string getarg(string otherwis) { void parse(string x) { - ; switch (x[1]) { case '/': case '-': { - ; arg = copy(x, 3, 255); switch (upcase(x[2])) { case '?': @@ -208,22 +197,18 @@ void parse(string x) break; case 'L': if (! usingp) { - ; log_setup(getarg("avvy.log"), false); usingl = true; } else { - ; close(logfile); linebug(bug_pandl); } break; case 'P': if (! usingl) { - ; log_setup(getarg("prn"), true); usingp = true; } else { - ; close(logfile); linebug(bug_pandl); } @@ -241,7 +226,6 @@ void parse(string x) demo = true; break; default: { - ; bugline = x; linebug(bug_weirdswitch); } @@ -249,7 +233,6 @@ void parse(string x) } break; case '*': { - ; inihead = copy(x, 2, 255); strip_ini(); if (inihead != "") ini_parse(); @@ -288,7 +271,6 @@ class unit_incline_initialize { static unit_incline_initialize incline_constructor; unit_incline_initialize::unit_incline_initialize() { - ; filetoload = ""; usingl = false; usingp = false; diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp index 0c0665180e2b..721a3f5a250e 100644 --- a/engines/avalanche/oldtrip.cpp +++ b/engines/avalanche/oldtrip.cpp @@ -51,7 +51,6 @@ static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2 /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ { boolean dropin_result; - ; dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); return dropin_result; } @@ -60,7 +59,6 @@ static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2 static integer lesser(integer a, integer b) { integer lesser_result; - ; if (a < b) lesser_result = a; else lesser_result = b; return lesser_result; @@ -70,7 +68,6 @@ static integer lesser(integer a, integer b) { static integer greater(integer a, integer b) { integer greater_result; - ; if (a > b) greater_result = a; else greater_result = b; return greater_result; @@ -79,7 +76,6 @@ static integer greater(integer a, integer b) { void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) { - ; if (dropin(x3, y3, x1, y1, x2, y2) || dropin(x3, y4, x1, y1, x2, y2) || dropin(x4, y3, x1, y1, x2, y2) @@ -95,7 +91,6 @@ void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer void loadtrip() { byte gm; - ; for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); tr[1].init(0); } @@ -104,7 +99,6 @@ byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { byte a, c; integer fv, ff; byte checkfeet_result; - ; a = 0; setactivepage(2); if (x1 < 0) x1 = 0; @@ -112,14 +106,12 @@ byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { if (oy < y) for (fv = x1; fv <= x2; fv ++) for (ff = oy + yl; ff <= y + yl; ff ++) { - ; c = getpixel(fv, ff); if (c > a) a = c; } else for (fv = x1; fv <= x2; fv ++) for (ff = y + yl; ff <= oy + yl; ff ++) { - ; c = getpixel(fv, ff); if (c > a) a = c; } @@ -132,13 +124,11 @@ void touchcol(byte tc); static boolean bug; static void fr(byte a, byte b) { - ; fliproom(a, b); bug = false; } void touchcol(byte tc) { - ; bug = true; /* j.i.c. */ switch (dna.room) { case 1: @@ -173,7 +163,6 @@ void touchcol(byte tc) { break; } if (bug) { - ; setactivepage(0); display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) + '.'); @@ -190,7 +179,6 @@ triptype *triptype::init(byte spritenum) { byte sort, n; word bigsize; pointer p, q; - ; str(spritenum, xx); assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); reset(f, 1); @@ -199,7 +187,6 @@ triptype *triptype::init(byte spritenum) { blockread(f, bigsize, 2); setactivepage(3); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); blockread(f, p, bigsize); @@ -211,7 +198,6 @@ triptype *triptype::init(byte spritenum) { adxtype &with = a; for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - ; getmem(pic[n][sort], a.size); /* grab the memory */ getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, @@ -238,12 +224,10 @@ triptype *triptype::init(byte spritenum) { } void triptype::original() { - ; quick = false; } void triptype::getback() { - ; tax = x; tay = y; off; /*getimage(x,y,x+a.xl,y+a.yl,behind^);*/ @@ -253,7 +237,6 @@ void triptype::getback() { void triptype::andexor() { byte picnum; /* Picnum, Picnic, what ye heck */ - ; picnum = face * a.seq + step + 1; off; putimage(x, y, pic[picnum][0], andput); @@ -262,12 +245,10 @@ void triptype::andexor() { } void triptype::turn(byte whichway) { - ; face = whichway; } void triptype::appear(integer wx, integer wy, byte wf) { - ; x = (wx / 8) * 8; y = wy; ox = wx; @@ -280,7 +261,6 @@ void triptype::appear(integer wx, integer wy, byte wf) { void triptype::walk() { byte tc; - ; ox = x; oy = y; if ((ix == 0) && (iy == 0)) return; @@ -288,7 +268,6 @@ void triptype::walk() { x = x + ix; y = y + iy; if (check_me) { - ; tc = checkfeet(x, x + a.xl, oy, y, a.yl); { void &with = magics[tc]; @@ -313,7 +292,6 @@ void triptype::walk() { } void triptype::bounce() { - ; setactivepage(1); putback(); x = ox; @@ -323,9 +301,7 @@ void triptype::bounce() { } void triptype::do_it() { - ; if (((ix != 0) || (iy != 0)) & (~ ddm_o.menunow)) { - ; off; copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); putback(); @@ -334,12 +310,10 @@ void triptype::do_it() { } void triptype::putback() { - ; /* putimage(tax,tay,behind^,0);*/ mblit(tax, tay, tax + a.xl, tay + a.yl, 3, 1); } void triptype::walkto(integer xx, integer yy) { - ; speed(xx - x, yy - y); hx = xx; hy = yy; @@ -347,13 +321,11 @@ void triptype::walkto(integer xx, integer yy) { } void triptype::stophoming() { - ; homing = false; } void triptype::homestep() { integer temp; - ; if ((hx == x) && (hy == y)) { ; /* touching the target */ homing = false; @@ -362,14 +334,12 @@ void triptype::homestep() { ix = 0; iy = 0; if (hy != y) { - ; temp = hy - y; if (temp > 4) iy = 4; else if (temp < -4) iy = -4; else iy = temp; } if (hx != x) { - ; temp = hx - x; if (temp > 4) ix = 4; else if (temp < -4) ix = -4; @@ -378,7 +348,6 @@ void triptype::homestep() { } void triptype::speed(shortint xx, shortint yy) { - ; ix = xx; iy = yy; if ((ix == 0) && (iy == 0)) return; /* no movement */ @@ -387,21 +356,18 @@ void triptype::speed(shortint xx, shortint yy) { if (iy < 0) turn(up); else turn(down); } else { - ; if (ix < 0) turn(left); else turn(right); } } void triptype::stopwalk() { - ; ix = 0; iy = 0; homing = false; } void triptype::chatter() { - ; talkx = x + a.xl / 2; talky = y; talkf = a.fgc; @@ -410,20 +376,17 @@ void triptype::chatter() { getsettype *getsettype::init() { - ; numleft = 0; /* initialise array pointer */ return this; } void remember(fieldtype r) { - ; numleft += 1; gs[numleft] = r; } void recall() { void recall_result; - ; recall_result = gs[numleft]; numleft -= 1; return recall_result; @@ -432,7 +395,6 @@ void recall() { void rwsp(byte t, byte r) { const integer xs = 4; const integer ys = 2; - ; { triptype &with = tr[t]; switch (r) { @@ -465,10 +427,8 @@ void rwsp(byte t, byte r) { } void apped(byte trn, byte np) { - ; { triptype &with = tr[trn]; - ; { void &with1 = peds[np]; appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); @@ -483,7 +443,6 @@ static boolean allstill() { boolean xxx; byte fv; boolean allstill_result; - ; xxx = true; for (fv = 1; fv <= numtr; fv ++) { triptype &with = tr[fv]; @@ -495,13 +454,11 @@ static boolean allstill() { void trippancy() { byte fv; - ; if ((ddm_o.menunow) | ontoolbar | seescroll | allstill()) return; setactivepage(1); for (fv = 1; fv <= numtr; fv ++) { triptype &with = tr[fv]; if (with.quick) { - ; walk(); if (with.visible && ((with.ix != 0) || (with.iy != 0))) andexor(); do_it(); @@ -513,70 +470,59 @@ void trippancy() { void tripkey(char dir); static void stopwalking() { - ; tr[1].stopwalk(); dna.rw = stopped; } void tripkey(char dir) { - ; { triptype &with = tr[1]; { - ; switch (dir) { case 'H': if (rw != up) { - ; rw = up; rwsp(1, rw); } else stopwalking(); break; case 'P': if (rw != down) { - ; rw = down; rwsp(1, rw); } else stopwalking(); break; case 'K': if (rw != left) { - ; rw = left; rwsp(1, rw); } else stopwalking(); break; case 'M': if (rw != right) { - ; rw = right; rwsp(1, rw); } else stopwalking(); break; case 'I': if (rw != ur) { - ; rw = ur; rwsp(1, rw); } else stopwalking(); break; case 'Q': if (rw != dr) { - ; rw = dr; rwsp(1, rw); } else stopwalking(); break; case 'O': if (rw != dl) { - ; rw = dl; rwsp(1, rw); } else stopwalking(); break; case 'G': if (rw != ul) { - ; rw = ul; rwsp(1, rw); } else stopwalking(); @@ -590,7 +536,6 @@ void tripkey(char dir) { } void fliproom(byte room, byte ped) { - ; dusk; tr[1].putback(); dna.room = room; @@ -605,16 +550,13 @@ void fliproom(byte room, byte ped) { boolean infield(byte x) { /* returns True if you're within field "x" */ integer ux, uy; boolean infield_result; - ; { triptype &with = tr[1]; - ; ux = with.x; uy = with.y + with.a.yl; } { void &with = fields[x]; - ; infield_result = (ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2); } return infield_result; @@ -625,7 +567,6 @@ boolean neardoor() { /* returns True if you're near a door! */ byte fv; boolean nd; boolean neardoor_result; - ; if (numfields < 9) { ; /* there ARE no doors here! */ neardoor_result = false; @@ -633,14 +574,12 @@ boolean neardoor() { /* returns True if you're near a door! */ } { triptype &with = tr[1]; - ; ux = with.x; uy = with.y + with.a.yl; } nd = false; for (fv = 9; fv <= numfields; fv ++) { void &with = fields[fv]; - ; if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; } neardoor_result = nd; diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp index 9cab8796f59e..f373c50affad 100644 --- a/engines/avalanche/omtest.cpp +++ b/engines/avalanche/omtest.cpp @@ -46,9 +46,7 @@ void graphics() { /*$F+ ... All ddm__procs and do__procs must be compiled in Far-Call state. */ void ddm__file() { - ; { - ; start_afresh; opt("Load...", 'L', "f3", true); opt("Save...", 'S', "f2", false); @@ -60,9 +58,7 @@ void ddm__file() { } void ddm__heart() { - ; { - ; start_afresh; opt("About...", 'A', "shift-f10", true); opt("Boss Key", 'B', "alt-B", true); @@ -74,9 +70,7 @@ void ddm__heart() { } void ddm__action() { - ; { - ; start_afresh; opt("Get up", 'G', "", true); opt("Open door", 'O', "", true); @@ -89,9 +83,7 @@ void ddm__action() { } void ddm__objects() { - ; { - ; start_afresh; opt("Bell", 'B', "", true); opt("Wine", 'W', "", true); @@ -104,9 +96,7 @@ void ddm__objects() { } void ddm__people() { - ; { - ; start_afresh; opt("Avalot", 'A', "", true); opt("Spludwick", 'S', "", true); @@ -118,9 +108,7 @@ void ddm__people() { } void ddm__use() { - ; { - ; start_afresh; opt("Drink", 'D', "", true); opt("Wear", 'W', "", true); @@ -131,7 +119,6 @@ void ddm__use() { void do__stuff() { varying_string<2> st; - ; str(o.choicenum + 1, st); setfillstyle(1, 6); setcolor(14); @@ -140,7 +127,6 @@ void do__stuff() { } void do__heart() { - ; switch (o.choicenum) { case 0: outtextxy(100, 100, "A really funny game!"); @@ -164,7 +150,6 @@ void do__heart() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; graphics(); setfillstyle(6, 6); bar(0, 0, 639, 199); @@ -172,7 +157,6 @@ int main(int argc, const char *argv[]) { m.init; o.init; { - ; create('H', '\3', '#', ddm__heart(), do__heart()); create('F', "File", '!', ddm__file(), do__stuff()); create('A', "Action", '\36', ddm__action(), do__stuff()); @@ -191,9 +175,7 @@ int main(int argc, const char *argv[]) { } while (!((buttonpresscount > 0) || (buttonreleasecount > 0) | keypressede)); hidemousecursor; if (buttonpresscount > 0) { - ; if (mousey > 10) { - ; if (!((o.firstlix) & ((mousex >= flx1) && (mousex <= flx2) && (mousey >= 12) && (mousey <= fly)))) { @@ -211,7 +193,6 @@ int main(int argc, const char *argv[]) { } else { ; /* NOT clicked button... */ if (buttonreleasecount > 0) { - ; if ((firstlix) & ((mousex >= flx1) && (mousex <= flx2) && (mousey >= 12) && (mousey <= fly))) diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp index 94b3b0d34399..9c47d18b6dfd 100644 --- a/engines/avalanche/oopmenu.cpp +++ b/engines/avalanche/oopmenu.cpp @@ -62,7 +62,6 @@ byte fv; void chalk(integer x, integer y, char t, string z) { byte p; - ; outtextxy(x, y, z); p = pos(t, z); if (p == 0) return; @@ -71,7 +70,6 @@ void chalk(integer x, integer y, char t, string z) { } void say(integer x, integer y, char t, string z, byte f, byte b) { - ; settextjustify(0, 2); setfillstyle(1, b); setcolor(f); @@ -82,7 +80,6 @@ void say(integer x, integer y, char t, string z, byte f, byte b) { void mblit(integer x1, integer y1, integer x2, integer y2, byte f, byte t) { /* NOT The Minstrel Blitter */ pointer p, q; word s; - ; mark(q); s = imagesize(x1, y1, x2, y2); getmem(p, s); @@ -95,7 +92,6 @@ void mblit(integer x1, integer y1, integer x2, integer y2, byte f, byte t) { /* } void onemenu::start_afresh() { - ; number = 0; width = 0; firstlix = false; @@ -104,20 +100,17 @@ void onemenu::start_afresh() { } onemenu *onemenu::init() { - ; menunow = false; return this; } void onemenu::opt(string n, char tr, string key, boolean val) { integer l; - ; number += 1; l = textwidth(n + key) + 30; if (width < l) width = l; { optiontype &with = oo[number]; - ; with.title = n; with.trigger = tr; with.shortcut = key; @@ -126,14 +119,11 @@ void onemenu::opt(string n, char tr, string key, boolean val) { } void onemenu::displayopt(byte y, byte b, byte f, byte d) { - ; { optiontype &with = oo[y]; - ; if (with.valid) setcolor(f); else setcolor(d); if (b != 177) { - ; setfillstyle(1, b); bar(flx1, 3 + y * 10, flx2, 12 + y * 10); } @@ -146,7 +136,6 @@ void onemenu::displayopt(byte y, byte b, byte f, byte d) { void onemenu::display() { byte y; - ; setfillstyle(1, menu_b); setcolor(menu_border); firstlix = true; @@ -169,7 +158,6 @@ void onemenu::display() { } void onemenu::wipe() { - ; { headtype &with = m.ddms[o.menunum]; say(flx1 + 2, 1, with.trigger, with.title, menu_f, menu_b); @@ -181,9 +169,7 @@ void onemenu::wipe() { void onemenu::movehighlight(shortint add) { shortint hn; - ; if (add != 0) { - ; hn = highlightnum + add; if ((hn < 0) || (hn >= (unsigned char)number)) return; highlightnum = hn; @@ -196,7 +182,6 @@ void onemenu::movehighlight(shortint add) { } void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - ; if ((mousex < flx1) || (mousex > flx2) || (mousey <= 12) || (mousey > fly - 3)) return; highlightnum = (mousey - 12) / 10; @@ -205,7 +190,6 @@ void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ } void onemenu::select(byte n) { /* Choose which one you want. */ - ; if (! oo[n + 1].valid) return; choicenum = n; m.ddms[menunum].do_choose(); @@ -214,14 +198,12 @@ void onemenu::select(byte n) { /* Choose which one you want. */ void onemenu::keystroke(char c) { byte fv; - ; c = upcase(c); for (fv = 1; fv <= number; fv ++) if (upcase(oo[fv].trigger) == c) select(fv - 1); } void bleep() { - ; sound(177); delay(7); nosound; @@ -229,7 +211,6 @@ void bleep() { headtype *headtype::init (char trig, char alttrig, string name, byte p, proc dw, proc dc) { - ; trigger = trig; alttrigger = alttrig; title = name; @@ -242,15 +223,12 @@ headtype *headtype::init } void headtype::display() { - ; say(xpos, 1, trigger, title, menu_f, menu_b); } void headtype::highlight() { - ; say(xpos, 1, trigger, title, highlight_f, highlight_b); { - ; o.left = xpos; o.menunow = true; o.menunum = position; @@ -259,9 +237,7 @@ void headtype::highlight() { boolean headtype::extdparse(char c) { boolean extdparse_result; - ; if (c != alttrigger) { - ; extdparse_result = true; return extdparse_result; } @@ -270,20 +246,17 @@ boolean headtype::extdparse(char c) { } menuset *menuset::init() { - ; howmany = 0; return this; } void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { - ; howmany += 1; ddms[howmany].init(t, alttrig, n, howmany, dw, dc); } void menuset::update() { byte fv; - ; setfillstyle(1, menu_b); bar(0, 0, 640, 10); for (fv = 1; fv <= howmany; fv ++) ddms[fv].display(); @@ -291,7 +264,6 @@ void menuset::update() { void menuset::extd(char c) { byte fv; - ; fv = 1; while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; if (fv > howmany) return; @@ -300,16 +272,13 @@ void menuset::extd(char c) { void menuset::getmenu(integer x) { byte fv; - ; fv = 0; do { fv += 1; if ((x > ddms[fv].xpos - 3) && (x < ddms[fv].xright)) { headtype &with = ddms[fv]; { - ; if (o.menunow) { - ; wipe(); /* get rid of menu */ if (o.menunum == with.position) return; /* click on own highlight */ } @@ -322,19 +291,15 @@ void menuset::getmenu(integer x) { } void parsekey(char r, char re) { - ; switch (r) { case '\0': { - ; switch (re) { case 'K': { - ; wipe(); m.getmenu((o.menunum - 2)*spacing + indent); } break; case 'M': { - ; wipe(); m.getmenu((o.menunum * spacing + indent)); } @@ -357,7 +322,6 @@ void parsekey(char r, char re) { select(o.highlightnum); break; default: { - ; if (o.menunow) keystroke(r); else kbuffer = kbuffer + r + re; diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp index 3c72e1178b70..4b498fd500ad 100644 --- a/engines/avalanche/overlap.cpp +++ b/engines/avalanche/overlap.cpp @@ -33,7 +33,6 @@ namespace Avalanche { integer gd, gm; void flash(integer x1, integer y1, integer x2, integer y2) { - ; setcolor(14); rectangle(x1, y1, x2, y2); sound(x1 + x2); @@ -49,13 +48,11 @@ boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integ /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ { boolean dropin_result; - ; dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); return dropin_result; } void test(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) { - ; cleardevice(); rectangle(x1, y1, x2, y2); rectangle(x3, y3, x4, y4); @@ -77,7 +74,6 @@ void test(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3 int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 1; initgraph(gd, gm, ""); diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp index 58ab27041932..bf0825c1a23d 100644 --- a/engines/avalanche/overscro.cpp +++ b/engines/avalanche/overscro.cpp @@ -32,7 +32,6 @@ namespace Avalanche { integer gd, gm; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -52,7 +51,6 @@ int main(int argc, const char *argv[]) { setactivepage(0); gm = 0; for (gd = 0; gd <= 640; gd ++) { - ; gm += 1; if (gm == 8) gm = 1; setcolor(gm); @@ -66,7 +64,6 @@ int main(int argc, const char *argv[]) { /* setfillstyle(1,6); bar(100,100,500,100);*/ gd = getpixel(0, 0); for (gm = 8; gm <= 15; gm ++) setpalette(gm, egayellow); for (gd = 0; gd <= 199; gd ++) { - ; port[0x3c4] = 2; port[0x3cf] = 4; port[0x3c5] = 8; diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp index b6b830542bad..74f9dbb65e21 100644 --- a/engines/avalanche/particle.cpp +++ b/engines/avalanche/particle.cpp @@ -52,22 +52,18 @@ const char marker = '\33'; void cursor() { byte fv; - ; for (fv = 12; fv <= 15; fv ++) mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); } void xy() { - ; cpos = (bufpos / 80) * 1280 + (bufpos % 80); } void show() { word fv, orig, y; - ; for (fv = 0; fv <= 1999; fv ++) if (buffer[fv] != was[fv]) { - ; orig = (fv / 80) * 1280 + (fv % 80); for (y = 0; y <= 15; y ++) mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); @@ -77,7 +73,6 @@ void show() { } void sizeup() { - ; do { switch (buffer[bufsize]) { case marker: @@ -95,7 +90,6 @@ void sizeup() { void graphics() { integer gd, gm; file fontfile; - ; gd = 3; gm = 1; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -110,7 +104,6 @@ void helpscreen(); static byte l, fv; static void addon(char b, string st) { - ; buffer[3 + 80 * l] = b; b -= 64; buffer[5 + 80 * l] = b; @@ -121,7 +114,6 @@ static void addon(char b, string st) { void helpscreen() { array<0, 1999, char> temp; char r; - ; l = 0; move(buffer, temp, 2000); fillchar(buffer, sizeof(buffer), '\0'); @@ -163,7 +155,6 @@ static void legit(char r) { void edit_it() { byte fv; - ; bufpos = 0; fillchar(was, sizeof(was), '\0'); show(); @@ -176,54 +167,46 @@ void edit_it() { switch (readkey()) { /* extd keystrokes */ case 'K': if (bufpos > 0) { - ; bufpos -= 1; xy(); } break; /* Left */ case 'M': if (bufpos < bufsize) { - ; bufpos += 1; xy(); } break; /* Right */ case 'H': if (bufpos > 80) { - ; bufpos -= 80; xy(); } break; /* Up */ case 'P': if (bufpos < (cardinal)bufsize - 79) { - ; bufpos += 80; xy(); } break; /* Down */ case 's': if (bufpos > 10) { - ; bufpos -= 10; xy(); } break; case 't': if (bufpos < (cardinal)bufsize - 10) { - ; bufpos += 10; xy(); } break; case 'G': { - ; bufpos = 0; xy(); } break; /* Home */ case 'O': { - ; bufpos = bufsize; xy(); } @@ -258,7 +241,6 @@ void edit_it() { } break; case '\33': { - ; restorecrtmode(); return; } @@ -272,14 +254,12 @@ void edit_it() { void loadit() { untyped_file f; - ; if (pos(".", rawname) == 0) rawname = rawname + ".raw"; fillchar(buffer, sizeof(buffer), '\0'); /*$I-*/ assign(f, rawname); reset(f, 1); if (ioresult != 0) { - ; output << string('\7') + "New file!" + '\7' << NL; buffer[0] = marker; return; @@ -297,7 +277,6 @@ void loadit() { void saveit() { untyped_file f; - ; output << "Saving " << rawname << ", " << bufsize << " bytes..." << NL; assign(f, rawname); rewrite(f, 1); @@ -307,7 +286,6 @@ void saveit() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; output << "Filename of .RAW file?"; input >> rawname >> NL; loadit(); @@ -335,7 +313,6 @@ int main(int argc, const char *argv[]) { ok = true; break; case 'S': { - ; saveit(); exit(0); } diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp index 261e59297f1c..e41c395d7148 100644 --- a/engines/avalanche/pictemp.cpp +++ b/engines/avalanche/pictemp.cpp @@ -46,7 +46,6 @@ void save() { "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; byte a /*absolute $A000:1200i*/; byte bit; - ; nam = "d:thingtmp.avd"; screenname = "Temp."; assign(f, nam); @@ -56,7 +55,6 @@ void save() { blockwrite(f, header[1], 146); blockwrite(f, screenname, 31); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -68,7 +66,6 @@ void save() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -81,14 +78,12 @@ int main(int argc, const char *argv[]) { gm = 20; while (gm < 120) { - ; if (! eof(f)) blockread(f, p, picsize); putimage(gd, gm, p, 0); gd += 70; if (gd == 640) { - ; gd = 10; gm += 40; } diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp index 8d5cdfe4c29f..656987fe3c10 100644 --- a/engines/avalanche/pictemp2.cpp +++ b/engines/avalanche/pictemp2.cpp @@ -45,12 +45,10 @@ void load() { byte a0 /*absolute $A000:1200*/; byte bit; untyped_file f; - ; assign(f, "d:thingtmp.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -63,7 +61,6 @@ void load() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -79,14 +76,12 @@ int main(int argc, const char *argv[]) { gm = 20; while (noo <= number_of_objects) { - ; getimage(gd, gm, gd + 59, gm + 29, p); putimage(gd, gm, p, notput); blockwrite(f, p, picsize); gd += 70; if (gd == 640) { - ; gd = 10; gm += 40; } diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index df50cb0b9412..f9d3571ce832 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -48,7 +48,6 @@ namespace Avalanche { void dplot(integer x, integer y, string z) { - ; setcolor(9); outtextxy(x, y , z); setcolor(11); @@ -88,11 +87,9 @@ begin; copy02;*/ { byte fv; - ; dusk(); off_virtual(); for (fv = 0; fv <= 1; fv ++) { - ; setactivepage(fv); cleardevice(); } @@ -123,10 +120,8 @@ void copy02() { /* taken from Wobble (below) */ byte a0 /*absolute $A000:0*/; byte a2/*absolute $A800:0*/; byte bit; - ; off(); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -159,7 +154,6 @@ void copy03() { /* taken from Wobble (below) */ } for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -172,7 +166,6 @@ void copy03() { /* taken from Wobble (below) */ on_virtual(); break; case 2 : - ; break; /* zzzz, it was off anyway */ case 3 : on(); @@ -183,10 +176,8 @@ void copy03() { /* taken from Wobble (below) */ void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ byte bit; - ; off(); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -199,13 +190,11 @@ void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ void wobble() { byte bit; byte a2 /*absolute $A800:80i*/; - ; off(); setactivepage(2); bit = getpixel(0, 0); cleardevice(); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -213,7 +202,6 @@ void wobble() { move(mem[0xa000 * cp * pagetop], a2, 16000); } for (bit = 0; bit <= 25; bit ++) { - ; setvisualpage(2); delay(bit * 7); setvisualpage(cp); @@ -228,7 +216,6 @@ void wobble() { void zonk(); static void zl(integer x1, integer y1, integer x2, integer y2) { - ; setlinestyle(0, 0, 3); setcolor(1); line(x1, y1, x2, y2); @@ -240,12 +227,10 @@ static void zl(integer x1, integer y1, integer x2, integer y2) { void zonk() { integer xx, yy; /* a0:byte absolute $A000:0; a3:byte absolute $A000:245760;*/ byte bit, fv; - ; off(); copypage(3, 1 - cp); { triptype &with = tr[1]; - ; xx = with.x + with.a.xl / 2; yy = with.y; } @@ -266,7 +251,6 @@ void zonk() { setbkcolor(yellow); for (bit = 0; bit <= 255; bit ++) { - ; note(270 - bit); setvisualpage(3); note(2700 - 10 * bit); diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp index 9a0371806779..8ff0c364756d 100644 --- a/engines/avalanche/plottest.cpp +++ b/engines/avalanche/plottest.cpp @@ -35,7 +35,6 @@ matrix<1, 35, 0, 39, byte> a; array<0, 3, 0, 4, 1, 35, byte> b; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -49,9 +48,7 @@ int main(int argc, const char *argv[]) { fillchar(b, sizeof(b), '\0'); for (gm = 1; gm <= 35; gm ++) for (gd = 0; gd <= 39; gd ++) { - ; for (fv = 0; fv <= 3; fv ++) { - ; b[fv][gd / 8][gm] = (b[fv][gd / 8][gm] << 1); b[fv][gd / 8][gm] += ((cardinal)(a[gm][gd] & (1 << fv)) >> fv); } @@ -59,9 +56,7 @@ int main(int argc, const char *argv[]) { for (gd = 1; gd <= 35; gd ++) for (gm = 0; gm <= 4; gm ++) { - ; for (fv = 0; fv <= 3; fv ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << fv; diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp index da5b71dae7b6..bdb5f4089690 100644 --- a/engines/avalanche/preview1.cpp +++ b/engines/avalanche/preview1.cpp @@ -42,7 +42,6 @@ void load() { reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp index 0d15a9d7daa1..695dda45ae7e 100644 --- a/engines/avalanche/qintro.cpp +++ b/engines/avalanche/qintro.cpp @@ -254,7 +254,6 @@ void load_text() { thisline += 1; break; case '\12':/*nop*/ - ; break; default: x[thisline] = x[thisline] + *c; @@ -311,7 +310,6 @@ int main(int argc, const char *argv[]) { displaycounter += 1; do { - ; } while (!(*skellern > 0)); } diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp index 69920ef292b4..553aee4c836e 100644 --- a/engines/avalanche/qstars.cpp +++ b/engines/avalanche/qstars.cpp @@ -182,7 +182,6 @@ void do_stuff() { void setcol(byte which, byte what) /*var dummy:byte;*/ { - ; /* setpalette(which,what); asm (* mov dx,$3DA; diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp index 8c2c36784f92..e3ed388eeb3d 100644 --- a/engines/avalanche/rawupd.cpp +++ b/engines/avalanche/rawupd.cpp @@ -37,7 +37,6 @@ boolean s_exists; void find_out_about_s(string name) { searchrec ss; - ; findfirst(name, anyfile, ss); s_exists = doserror == 0; diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp index bdf3a7ee8c14..cd4cd62e8be5 100644 --- a/engines/avalanche/readsez.cpp +++ b/engines/avalanche/readsez.cpp @@ -53,10 +53,8 @@ byte sumup() { word fv; byte total; byte sumup_result; - ; total = 0; for (fv = 0; fv <= marker.length; fv ++) { - ; total += ord(x[fv]); } sumup_result = total; @@ -65,7 +63,6 @@ byte sumup() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; output << "READ-SEZ by TT." << NL; output << NL; assign(f, "avalot.sez"); @@ -73,9 +70,7 @@ int main(int argc, const char *argv[]) { seek(f, 255); blockread(f, sezhead, sizeof(sezhead)); { - ; if (sezhead.initials != "TT") { - ; output << "Not a valid Sez file!" << NL; exit(0); } @@ -88,7 +83,6 @@ int main(int argc, const char *argv[]) { seek(f, longint(262) + number * longint(7)); blockread(f, marker, 7); { - ; output << "Scrollchain no. " << number << NL; output << "Length: " << marker.length << NL; output << "Offset: " << marker.offset << NL; @@ -103,7 +97,6 @@ int main(int argc, const char *argv[]) { output << "Checksum in file: " << marker.checksum << ". Actual value: " << sum << '.' << NL; output << NL; if (sum != marker.checksum) { - ; output << "Bleargh! Checksum failed!" << NL; exit(0); } diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp index 441a35ace0f0..2ed33bea742d 100644 --- a/engines/avalanche/reginam.cpp +++ b/engines/avalanche/reginam.cpp @@ -39,7 +39,6 @@ static byte p; static void replace(char what, char whatwith) { - ; p = pos(what, z); if (p > 0) z[p] = whatwith; } @@ -47,7 +46,6 @@ static void replace(char what, char whatwith) { void alphanum() { byte fv; - ; z = ""; for (fv = 1; fv <= length(name); fv ++) if (set::of(range('A', 'Z'), eos).has(name[fv])) @@ -71,9 +69,7 @@ void alphanum() { void scramble() { byte fv, what; - ; for (fv = 1; fv <= length(name); fv ++) { - ; what = pos(name[fv], letters); what += 177; what += (fv + 1) * 3; @@ -83,7 +79,6 @@ void scramble() { void checks() { byte fv, total; - ; total = 177; for (fv = 1; fv <= length(name); fv ++) total += ord(name[fv]); @@ -92,7 +87,6 @@ void checks() { void negate() { byte fv; - ; name[1] = 'N'; for (fv = 2; fv <= length(name); fv ++) name[fv] = letters[37 - pos(name[fv], letters) - 1]; @@ -100,7 +94,6 @@ void negate() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; output << "Registrant's name?"; input >> name >> NL; output << "And number (eg, A1)?"; diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp index 54d860c5c6fb..b197977c8e5b 100644 --- a/engines/avalanche/sackb1.cpp +++ b/engines/avalanche/sackb1.cpp @@ -67,12 +67,10 @@ void sb_start(string md) { } void sb_stop() { - ; modstop(); } void sb_link() { /* At the moment, this does nothing. */ - ; } } // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp index 8075225e7b45..8d52e76a65ed 100644 --- a/engines/avalanche/saving.cpp +++ b/engines/avalanche/saving.cpp @@ -40,7 +40,6 @@ void load(string nam) { untyped_file f; word s; string check; - ; assign(f, nam); reset(f, 1); blockread(f, check, 41); @@ -48,7 +47,6 @@ void load(string nam) { blockread(f, check, 31); s = imagesize(0, 0, getmaxx(), 75); for (z = 1; z <= 2; z ++) { - ; getmem(a[z], s); blockread(f, a[z], s); setactivepage(0); @@ -60,7 +58,6 @@ void load(string nam) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); @@ -68,7 +65,6 @@ int main(int argc, const char *argv[]) { assign(f, "c:\\sleep\\test.ega"); rewrite(f, 1); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp index 5d8bc7d23be4..bb5fa1d84f11 100644 --- a/engines/avalanche/scr_1.cpp +++ b/engines/avalanche/scr_1.cpp @@ -46,7 +46,6 @@ void save() { file f; word fv; atype a /*absolute $B800:0*/; - ; assign(f, "TEXT1.SCR"); rewrite(f); f << a; @@ -54,14 +53,12 @@ void save() { } void centre(byte y, string z) { - ; gotoxy(40 - length(z) / 2, y); output << z; } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; /* write('Title?'); readln(title); write('Font?'); readln(fn); */ textattr = 0; @@ -69,7 +66,6 @@ int main(int argc, const char *argv[]) { title = "Bug Alert!"; fn = ""; for (xx = 1; xx <= 77; xx ++) { - ; gotoxy(Random(80) + 1, Random(24) + 1); switch (Random(2)) { case 0: @@ -100,11 +96,8 @@ int main(int argc, const char *argv[]) { f >> font; close(f); for (y = 0; y <= 3; y ++) { - ; for (x = 1; x <= length(title); x ++) { - ; for (xx = 7; xx >= 0; xx --) { - ; code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; gotoxy(1 + x * 8 - xx, y + 1); diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp index c3de473a0a8d..039583a0212f 100644 --- a/engines/avalanche/scr_2.cpp +++ b/engines/avalanche/scr_2.cpp @@ -46,7 +46,6 @@ void save() { file f; word fv; atype a /*absolute $B800:0*/; - ; assign(f, "TEXT2.SCR"); rewrite(f); f << a; @@ -55,9 +54,7 @@ void save() { void centre(byte y, string z) { byte fv; - ; for (fv = 1; fv <= length(z); fv ++) { - ; gotoxy(39 - length(z) / 2 + fv, y); if (odd(fv + y)) textattr = 2; else textattr = cyan; @@ -67,14 +64,10 @@ void centre(byte y, string z) { void line(byte yy, string title) { const integer offset = 5; - ; for (y = 1; y <= 6; y ++) { - ; qq = ""; for (x = 1; x <= length(title); x ++) { - ; for (xx = 7; xx >= 0; xx --) { - ; code = (byte)(((1 << xx) & font[title[x]][y * 2 - offset]) > 0) + (byte)(((1 << xx) & font[title[x]][y * 2 + 1 - offset]) > 0) * 2; qq = qq + codes[code + 1 - 1]; @@ -86,12 +79,9 @@ void line(byte yy, string title) { void chips() { byte fv, x, y; - ; for (fv = 0; fv <= 1; fv ++) { - ; textattr = 120; for (y = 2; y <= 6; y ++) { - ; gotoxy(fv * 67 + 3, y); output << " "; if (fv == 1) output << ' '; @@ -102,7 +92,6 @@ void chips() { textattr = 7; for (x = 0; x <= 1; x ++) for (y = 2; y <= 6; y ++) { - ; gotoxy(fv * 67 + 2 + x * (6 + fv), y); output << ''; } @@ -111,7 +100,6 @@ void chips() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 0; clrscr; chips(); @@ -126,7 +114,6 @@ int main(int argc, const char *argv[]) { centre(13, "you can do about this:"); textattr = 3; for (xx = 15; xx <= 17; xx ++) { - ; gotoxy(23, xx); output << '\20'; } diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp index 54ad5b0f4dc6..3dd3373cea0f 100644 --- a/engines/avalanche/scr_3.cpp +++ b/engines/avalanche/scr_3.cpp @@ -46,7 +46,6 @@ void save() { file f; word fv; atype a /*absolute $B800:0*/; - ; assign(f, "TEXT3.SCR"); rewrite(f); f << a; @@ -55,23 +54,17 @@ void save() { void centre(byte y, string z) { byte fv; - ; for (fv = 1; fv <= length(z); fv ++) { - ; gotoxy(39 - length(z) / 2 + fv, y); if (z[fv] != '\40') output << z[fv]; } } void line(byte cx, byte cy, string title) { - ; for (y = 0; y <= 4; y ++) { - ; qq = ""; for (x = 1; x <= length(title); x ++) { - ; for (xx = 7; xx >= 0; xx --) { - ; code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; qq = qq + codes[code + 1 - 1]; @@ -86,12 +79,10 @@ void big_t() { text t; string x; byte y; - ; assign(t, "c:\\avalot\\t.txt"); reset(t); y = 1; while (! eof(t)) { - ; t >> x >> NL; gotoxy(1, y); output << x; @@ -101,7 +92,6 @@ void big_t() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 4; clrscr; assign(f, "c:\\thomas\\ttsmall.fnt"); diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp index befde2a7f383..05e5fdcc3fda 100644 --- a/engines/avalanche/scr_4.cpp +++ b/engines/avalanche/scr_4.cpp @@ -41,23 +41,17 @@ byte code; void centre(byte y, string z) { byte fv; - ; for (fv = 1; fv <= length(z); fv ++) { - ; gotoxy(39 - length(z) / 2 + fv, y); if (z[fv] != '\40') output << z[fv]; } } void line(byte cy, string title) { - ; for (y = 0; y <= 6; y ++) { - ; qq = ""; for (x = 1; x <= length(title); x ++) { - ; for (xx = 3; xx >= 0; xx --) { - ; code = (byte)(((1 << (xx * 2)) & font[title[x]][y]) > 0) + (byte)(((1 << (xx * 2 + 1)) & font[title[x]][y]) > 0) * 2; qq = qq + codes[code + 1 - 1]; @@ -71,12 +65,10 @@ void big_t() { text t; string x; byte y; - ; assign(t, "c:\\avalot\\t.txt"); reset(t); y = 1; while (! eof(t)) { - ; t >> x >> NL; gotoxy(1, y); output << x; @@ -86,7 +78,6 @@ void big_t() { void box(byte x1, byte y1, byte x2, byte y2, string z) { byte fv; - ; gotoxy(x1, y1); output << z[1]; /* tl */ gotoxy(x2, y1); @@ -96,7 +87,6 @@ void box(byte x1, byte y1, byte x2, byte y2, string z) { gotoxy(x2, y2); output << z[4]; /* br */ for (fv = y1 + 1; fv <= y2 - 1; fv ++) { - ; gotoxy(x1, fv); output << z[5]; /* verticals */ gotoxy(x2, fv); @@ -110,7 +100,6 @@ void box(byte x1, byte y1, byte x2, byte y2, string z) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 26; clrscr; assign(f, "c:\\thomas\\ttsmall.fnt"); diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp index bc4472a6c8b8..a61bf86e9f23 100644 --- a/engines/avalanche/scr_5.cpp +++ b/engines/avalanche/scr_5.cpp @@ -46,7 +46,6 @@ void save() { file f; word fv; atype a /*absolute $B800:0*/; - ; assign(f, "TEXT5.SCR"); rewrite(f); f << a; @@ -54,14 +53,10 @@ void save() { } void line(byte cx, byte cy, string title) { - ; for (y = 0; y <= 4; y ++) { - ; qq = ""; for (x = 1; x <= length(title); x ++) { - ; for (xx = 7; xx >= 0; xx --) { - ; code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; qq = qq + codes[code + 1 - 1]; @@ -74,9 +69,7 @@ void line(byte cx, byte cy, string title) { void uline() { byte fv, ff; - ; for (fv = 1; fv <= 10; fv ++) { - ; gotoxy(16 - fv, 21 - fv); textattr = fv; for (ff = 1; ff <= fv; ff ++) output << "-"; @@ -85,7 +78,6 @@ void uline() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; textattr = 0; clrscr; assign(f, "c:\\thomas\\ttsmall.fnt"); diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp index f71afd0f61ff..6b0f3cd79454 100644 --- a/engines/avalanche/scr_9.cpp +++ b/engines/avalanche/scr_9.cpp @@ -35,7 +35,6 @@ byte fv; untyped_file f; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(f, "v:paralogo.scr"); clrscr; reset(f, 1); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 878f8d0f786f..71bb0360eab4 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -410,7 +410,6 @@ void block_drop(string fn, integer xl, integer yl, integer y) { for (fv = 1; fv <= yl; fv ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -715,7 +714,6 @@ void calldrivers() { break; /* ^D = (D)on't include pagebreak */ case '\2': case '\21': - ; break; /* ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box */ default: { bufsize += 1; diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 2715e648b31b..57d39a91db09 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -47,17 +47,14 @@ namespace Avalanche { void then_show(byte what) { byte fv; - ; for (fv = 1; fv <= seq_length; fv ++) if (seq[fv] == 0) { - ; seq[fv] = what; return; } } void first_show(byte what) { - ; /* First, we need to blank out the entire array. */ fillchar(seq, sizeof(seq), '\0'); @@ -67,7 +64,6 @@ void first_show(byte what) { } void then_flip(byte where, byte ped) { - ; then_show(now_flip); dna.flip_to_where = where; @@ -75,13 +71,11 @@ void then_flip(byte where, byte ped) { } void start_to_close() { - ; lose_timer(reason_sequencer); set_up_timer(7, procsequence, reason_sequencer); } void start_to_open() { - ; dna.user_moves_avvy = false; /* They can't move. */ stopwalking; /* And they're not moving now. */ start_to_close(); /* Apart from that, it's the same thing. */ @@ -91,12 +85,10 @@ void call_sequencer(); /* This proc is called by Timeout when it's time to do another frame. */ static void shove_left() { - ; move(seq[2], seq[1], seq_length - 1); /* Shift everything to the left. */ } void call_sequencer() { - ; switch (seq[1]) { case 0: return; @@ -108,7 +100,6 @@ void call_sequencer() { } break; case 177: { - ; user_moves_avvy = true; fliproom(flip_to_where, flip_to_ped); /* 177 = Flip room. */ if (seq[1] == 177) shove_left(); diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp index 072c3ef2a48f..184e42f9a922 100644 --- a/engines/avalanche/setup.cpp +++ b/engines/avalanche/setup.cpp @@ -496,7 +496,6 @@ void getmaxmin() { centre(19, 1, "Thank you. Now please centre your joystick and hit a button."); do { - ; } while (!(buttona1() || buttona2())); readjoya(jmidx, jmidy); diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp index 8025b9a4c139..4374de9c13bc 100644 --- a/engines/avalanche/seu.cpp +++ b/engines/avalanche/seu.cpp @@ -874,7 +874,6 @@ void escape_check() { memw[storage_seg * storage_ofs + 1] = 0; do { - ; } while (!(memw[storage_seg * storage_ofs + 1] > 9)); setvisualpage(1 - cp); @@ -882,14 +881,12 @@ void escape_check() { memw[storage_seg * storage_ofs + 1] = 0; do { - ; } while (!(memw[storage_seg * storage_ofs + 1] > 72)); setvisualpage(cp); memw[storage_seg * storage_ofs + 1] = 0; do { - ; } while (!(memw[storage_seg * storage_ofs + 1] > 9)); time1 = 0; @@ -973,7 +970,6 @@ int main(int argc, const char *argv[]) { read_kbd(); flippage(); do { - ; } while (!(memw[storage_seg * storage_ofs + 1] > 0)); } while (!(time1 == 0)); diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp index 931fbf05b699..e0c29309cff6 100644 --- a/engines/avalanche/seu_avvy.cpp +++ b/engines/avalanche/seu_avvy.cpp @@ -54,10 +54,8 @@ untyped_file outfile; void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ word soaa; - ; move(mani, aa[5], sizeof(mani)); { - ; aa[1] = a.xl; aa[2] = 0; aa[3] = a.yl; @@ -76,9 +74,7 @@ void explode(byte which) /* 0 is the first one! */ { byte fv, ff; word so1; /* size of one */ - ; { - ; so1 = a.size - 6; so1 += so1 / 4; seek(sf, 183 + soa + so1 * which); /* First is at 221 */ @@ -98,7 +94,6 @@ void explode(byte which) /* 0 is the first one! */ int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp index 73f5be19cf2b..1b90ed94bfb5 100644 --- a/engines/avalanche/sezedit.cpp +++ b/engines/avalanche/sezedit.cpp @@ -67,10 +67,8 @@ byte sumup() { word fv; byte total; byte sumup_result; - ; total = 0; for (fv = 0; fv <= bufsize - 1; fv ++) { - ; total += ord(was[fv]); } sumup_result = total; @@ -81,7 +79,6 @@ string findname(longint which) { string x; varying_string<10> q; string findname_result; - ; str(which, q); reset(nicknames); do { @@ -91,10 +88,8 @@ string findname(longint which) { nicknames >> x >> NL; } while (!(pos(q, x) > 0)); if (eof(nicknames)) { - ; findname_result = "noname"; } else { - ; Delete(x, 1, 3); /* lose "{__" */ Delete(x, pos(" ", x), 255); /* lose all chars after first space */ findname_result = x; @@ -105,22 +100,18 @@ string findname(longint which) { void cursor() { byte fv; - ; for (fv = 12; fv <= 15; fv ++) mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); } void xy() { - ; cpos = (bufpos / 80) * 1280 + (bufpos % 80); } void show() { word fv, orig, y; - ; for (fv = 0; fv <= 1999; fv ++) if (buffer[fv] != was[fv]) { - ; orig = (fv / 80) * 1280 + (fv % 80); for (y = 0; y <= 15; y ++) mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); @@ -130,7 +121,6 @@ void show() { } void sizeup() { - ; do { switch (buffer[bufsize]) { case marker: @@ -148,7 +138,6 @@ void sizeup() { void graphics() { integer gd, gm; file fontfile; - ; gd = 3; gm = 1; initgraph(gd, gm, ""); @@ -170,7 +159,6 @@ static void legit(char r) { void edit_it() { byte fv; - ; for (fv = 1; fv <= bufsize; fv ++) buffer[fv] -= (byte)(177 * bufsize); fillchar(was, sizeof(was), '\0'); show(); @@ -183,40 +171,34 @@ void edit_it() { switch (readkey()) { /* extd keystrokes */ case 'K': if (bufpos > 0) { - ; bufpos -= 1; xy(); } break; /* Left */ case 'M': if (bufpos < bufsize) { - ; bufpos += 1; xy(); } break; /* Right */ case 'H': if (bufpos > 80) { - ; bufpos -= 80; xy(); } break; /* Up */ case 'P': if (bufpos < (cardinal)bufsize - 79) { - ; bufpos += 80; xy(); } break; /* Down */ case 'G': { - ; bufpos = 0; xy(); } break; /* Home */ case 'O': { - ; bufpos = bufsize; xy(); } @@ -241,7 +223,6 @@ void edit_it() { } break; case '\33': { - ; for (fv = 1; fv <= bufsize; fv ++) buffer[fv] += (byte)(177 * bufsize); restorecrtmode(); return; @@ -262,7 +243,6 @@ void saveit(longint ourchain, word oldsize, word newsize) { markertype m; integer sizechange; /* so's it can be +ve or -ve */ longint wheresit; /* "offset" value for "ourchain" */ - ; assign(tempf, "sez.tmp"); /* OK, here goes... */ sezhead.size = sezhead.size - longint(oldsize) + longint(newsize); /* adjust our size */ @@ -279,11 +259,9 @@ void saveit(longint ourchain, word oldsize, word newsize) { /* Now to move the markers */ output << "Moving markers..." << NL; for (fv = 1; fv <= sezhead.chains; fv ++) { - ; output << fv << '\15'; blockread(f, m, sizeof(m)); if (fv == ourchain) { /* Right, this one's ours! */ - ; wheresit = m.offset; /* recorded for later */ m.length = newsize - 1; m.checksum = sumup(); @@ -302,7 +280,6 @@ void saveit(longint ourchain, word oldsize, word newsize) { output << "Updating the chains..." << NL; while (total <= wheresit) { - ; blockread(f, buffer, 1, numread); blockwrite(tempf, buffer, numread, numwritten); output << '.'; @@ -317,7 +294,6 @@ void saveit(longint ourchain, word oldsize, word newsize) { output << NL; output << "Copying everything else..." << NL; while (! eof(f)) { /* high-speed copy */ - ; blockread(f, buffer, 17777, numread); blockwrite(tempf, buffer, numread); output << '.'; @@ -333,12 +309,10 @@ void saveit(longint ourchain, word oldsize, word newsize) { void particular() { word origsize; - ; bufsize = 0; output << "Which one\? (? for a list)"; input >> chainnum >> NL; if ((chainnum < 0) || (chainnum > sezhead.chains)) { - ; output << "Don't be silly!" << NL; return; } @@ -371,7 +345,6 @@ void particular() { output << r << NL; switch (r) { case 'N': { - ; output << NL; output << "New nickname (max 40 chars, Enter to cancel)?"; input >> temp >> NL; @@ -379,7 +352,6 @@ void particular() { } break; case 'E': { - ; setgraphmode(1); edit_it(); } @@ -398,10 +370,8 @@ void titles() { const varying_string<7> title = "SEZedit"; byte fv; char r; - ; settextstyle(1, 0, 0); for (fv = 7; fv >= 1; fv --) { - ; setcolor(fv * 2); setusercharsize(8 - fv, 1, 8 - fv, 1); outtextxy(fv * 65, fv * 40 - 30, title[fv - 1]); @@ -423,7 +393,6 @@ void addone() { /* Adds a new, empty chain to the end of the list. */ markertype m; array<1, 17777, byte> buffer; word numread; - ; assign(tempf, "sez.tmp"); textattr = 27; rewrite(tempf, 1); @@ -437,7 +406,6 @@ void addone() { /* Adds a new, empty chain to the end of the list. */ /* Now to move the markers */ output << "Moving markers..." << NL; for (fv = 1; fv <= sezhead.chains - longint(1); fv ++) { /* -1 because we've added 1 to it */ - ; output << fv << '\12'; blockread(f, m, sizeof(m)); blockwrite(tempf, m, sizeof(m)); @@ -445,7 +413,6 @@ void addone() { /* Adds a new, empty chain to the end of the list. */ output << "Done OK." << NL; /* Now we add a new marker onto the end! */ { - ; m.offset = sezhead.size; /* right onto the end */ m.length = 0; /* it's empty */ } @@ -454,7 +421,6 @@ void addone() { /* Adds a new, empty chain to the end of the list. */ /* Copy everything else... including the #177 check char */ output << "Copying everything else over..." << NL; while (! eof(f)) { - ; blockread(f, buffer, 17777, numread); blockwrite(tempf, buffer, numread); output << '.'; @@ -468,7 +434,6 @@ void addone() { /* Adds a new, empty chain to the end of the list. */ void general() { char r; - ; do { textattr = 31; output << NL; @@ -499,7 +464,6 @@ void general() { } void loadit() { - ; reset(f, 1); blockread(f, junk, 255); blockread(f, sezhead, sizeof(sezhead)); @@ -508,7 +472,6 @@ void loadit() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; assign(f, string(game) + ".SEZ"); assign(tempf, "sez.tmp"); assign(nicknames, string(game) + ".NIK"); diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp index fa7bbb8c797a..2841a960ff0d 100644 --- a/engines/avalanche/sezunit.cpp +++ b/engines/avalanche/sezunit.cpp @@ -45,7 +45,6 @@ word fv; byte sum; void sez_setup() { /* This procedure sets up the Sez system (obviously!) */ - ; /* Set up variables */ @@ -65,10 +64,8 @@ void sez_setup() { /* This procedure sets up the Sez system (obviously!) */ return; } { - ; if ((sezhead.initials != "TT") || (sezhead.gamecode != thisgamecode) || (sezhead.revision != thisvercode)) { - ; sezerror = sezgunkyfile; /* not a valid file */ return; } @@ -79,10 +76,8 @@ byte sumup() { word fv; byte total; byte sumup_result; - ; total = 0; for (fv = 0; fv <= chainsize; fv ++) { - ; total += ord(chain[fv]); } sumup_result = total; @@ -90,17 +85,14 @@ byte sumup() { } void getchain(longint number) { - ; seek(f, longint(262) + number * longint(7)); blockread(f, marker, 7); { - ; seek(f, longint(270) + sezhead.chains * longint(7) + marker.offset); blockread(f, chain, marker.length + 1); for (fv = 0; fv <= marker.length; fv ++) chain[fv] -= 3 + 177 * fv * marker.length; /* unscramble */ chainsize = marker.length; if (sumup() != marker.checksum) { - ; sezerror = sezhacked; return; } diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp index 7d56e668fec9..79876930d498 100644 --- a/engines/avalanche/sezxfr.cpp +++ b/engines/avalanche/sezxfr.cpp @@ -41,7 +41,6 @@ longint total; untyped_file f; void strip() { - ; x = copy(x, 2, 255); } @@ -49,7 +48,6 @@ void squish(string &q) { string n; boolean ctrl; byte fv; - ; ctrl = false; n = ""; for (fv = 1; fv <= length(q); fv ++) @@ -67,7 +65,6 @@ void squish(string &q) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; dp = 0; ip = 0; fillchar(data, sizeof(data), '\0'); @@ -76,17 +73,14 @@ int main(int argc, const char *argv[]) { assign(t, "v:sez.dat"); reset(t); while (! eof(t)) { - ; t >> x >> NL; switch (x[1]) { case ';': { - ; textattr = lightred; strip(); } break; case ':': { - ; textattr = lightblue; strip(); if (dp > 0) squish(data[dp][2]); @@ -101,7 +95,6 @@ int main(int argc, const char *argv[]) { } break; default: { - ; textattr = white; data[dp][2] = data[dp][2] + x + '\40'; } @@ -112,7 +105,6 @@ int main(int argc, const char *argv[]) { total = 1; for (fv = 1; fv <= dp; fv ++) { - ; thumb[fv] = total; total += length(data[fv][2]) + 1; } diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp index 358f679e61df..fa9513960a40 100644 --- a/engines/avalanche/shell1.cpp +++ b/engines/avalanche/shell1.cpp @@ -39,7 +39,6 @@ pointer where; string comspec; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1f, where); move(where, table, 1280); comspec = getenv("comspec"); diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp index 9ca4e2959915..1c7e52217bb4 100644 --- a/engines/avalanche/shell2.cpp +++ b/engines/avalanche/shell2.cpp @@ -39,7 +39,6 @@ pointer where; integer gd, gm; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1f, where); move(where, table, 1280); gd = 1; diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp index 21e73cac4639..17a494cf4155 100644 --- a/engines/avalanche/spread.cpp +++ b/engines/avalanche/spread.cpp @@ -56,7 +56,6 @@ void load() { untyped_file f; byte gd, gm, sort, n; pointer p, q; - ; assign(f, string("v:sprite") + sn + ".avd"); reset(f, 1); seek(f, 59); @@ -64,7 +63,6 @@ void load() { blockread(f, bigsize, 2); setactivepage(3); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); blockread(f, p, bigsize); @@ -73,7 +71,6 @@ void load() { n = 1; for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - ; getmem(pic[n][sort], a.size); /* grab the memory */ getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, @@ -91,9 +88,7 @@ void save() { pointer p, q; string x; integer txl, tyl; - ; { - ; txl = a.seq * a.xl * 2; tyl = a.yl * 2; } @@ -107,13 +102,11 @@ void save() { blockwrite(f, bigsize, 2); setactivepage(3); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); n = 1; for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - ; putimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, pic[n][sort], 0); /* drop the pic */ n += 1; @@ -128,7 +121,6 @@ void save() { void setup() { integer gd, gm; - ; output << "SPREAD (c) 1992, Thomas Thurman." << NL; output << NL; output << "Enter number of SPRITE*.AVD file to edit:"; @@ -142,16 +134,13 @@ void setup() { string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; } void likethis() { - ; { - ; setfillstyle(1, a.bgc); setcolor(a.fgc); settextstyle(0, 0, 1); @@ -162,7 +151,6 @@ void likethis() { void values() { byte fv; - ; settextstyle(2, 0, 9); setcolor(14); outtextxy(277, 0, string("Spread: editing ") + sn); @@ -171,7 +159,6 @@ void values() { settextstyle(2, 0, 7); outtextxy(0, 30, "Views:"); { - ; outtextxy(0, 50, string("N: Name: ") + a.name); outtextxy(0, 70, string("No. of pictures: ") + strf(a.num) + " (" + strf(a.num / a.seq) + " ways)"); outtextxy(0, 90, string("XY: Size: ") + strf(a.xl) + 'x' + strf(a.yl)); @@ -193,11 +180,9 @@ void values() { byte ccol() { byte fv; byte ccol_result; - ; restorecrtmode(); output << "Choose a colour- one of these..." << NL; for (fv = 0; fv <= 15; fv ++) { - ; textattr = 14; output << fv << ") "; textattr = fv; @@ -218,7 +203,6 @@ byte ccol() { string cstr(string oc) { string x; string cstr_result; - ; restorecrtmode(); output << string("Old choice is: <") + oc + '>' << NL; output << NL; @@ -239,14 +223,12 @@ longint cnum(longint on) { longint q; integer e; longint cnum_result; - ; restorecrtmode(); do { output << "Old value is: " << on << '.' << NL; output << string("New choice, or Enter for no change?") + prompt; input >> x >> NL; if (x == "") { - ; e = 0; /* must be OK here */ q = on; } else val(x, q, e); if (e != 0) output << x << " isn't a number, silly!" << NL; @@ -258,7 +240,6 @@ longint cnum(longint on) { void animate() { byte facing, step, slow, fv; - ; cleardevice(); settextstyle(0, 0, 2); setcolor(12); @@ -275,13 +256,11 @@ void animate() { if (keypressed()) switch (upcase(readkey())) { case '\15': { - ; facing += 1; if (facing * a.seq >= a.num) facing = 0; } break; case '\33': { - ; cleardevice(); return; } @@ -303,14 +282,12 @@ void animate() { byte tabpel(integer x, integer y) { byte tabpel_result; - ; if (getpixel(400 + x, 17 + y) == 15) tabpel_result = 17; else tabpel_result = getpixel(500 + x, 17 + y); return tabpel_result; } void bigpixel(integer x, integer y, byte size, byte col) { - ; if (col == 17) setfillstyle(9, 8); else setfillstyle(1, col); bar(x * size, y * size, x * size + size - 2, y * size + size - 2); @@ -318,9 +295,7 @@ void bigpixel(integer x, integer y, byte size, byte col) { void blowup(byte n) { byte fv, x, y, xyl; - ; { - ; for (fv = 0; fv <= 1; fv ++) putimage(400 + fv * 100, 17, pic[n][fv], 0); xyl = 200 / a.yl; for (x = 0; x <= a.xl; x ++) @@ -333,7 +308,6 @@ void edit(); static void putnum(byte x, byte p) { varying_string<2> z; - ; str(x, z); outtextxy(x * 53 + 17, 87, z); putimage(x * 53, 100, pic[p][1], 0); @@ -341,7 +315,6 @@ static void putnum(byte x, byte p) { static void title() { - ; cleardevice(); setcolor(11); settextstyle(0, 0, 2); @@ -352,9 +325,7 @@ static void title() { void edit() { byte fv, ra, rb; - ; { - ; title(); for (fv = 1; fv <= (a.num / a.seq); fv ++) putnum(fv, fv * a.seq); do { @@ -375,7 +346,6 @@ void edit() { void pickone() { char r; - ; r = upcase(readkey()); switch (r) { case 'N': @@ -408,7 +378,6 @@ void pickone() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup(); do { values(); diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp index c6c586921d2b..b2faed350859 100644 --- a/engines/avalanche/spread2.cpp +++ b/engines/avalanche/spread2.cpp @@ -74,7 +74,6 @@ void setup() { boolean ok; longint id; varying_string<2> sn; - ; output << "Sprite Editor 2 (c) 1993, Thomas Thurman." << NL; bigpix_size = 3; bigpix_gap = 5; @@ -87,17 +86,14 @@ void setup() { seek(sf, 177); blockread(sf, id, 4); if (id != shouldid) { - ; output << "That isn't a valid Trip5 spritefile." << NL; output << "Please choose another." << NL; output << NL; ok = false; close(sf); } else { - ; blockread(sf, soa, 2); if (soa != (cardinal)sizeof(a)) { /* to change this, just change the "type adx=" bit.*/ - ; output << "That spritefile contains an unknown ADX field type." << NL; output << "Please choose another." << NL; output << NL; @@ -118,20 +114,17 @@ void setup() { string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; } void centre(byte y, string z) { - ; gotoxy(40 - length(z) / 2, y); output << z; } void info(byte x, byte y, string p, string q) { - ; gotoxy(x, y); textattr = 6; output << p + ":"; @@ -142,7 +135,6 @@ void info(byte x, byte y, string p, string q) { } void colours(byte f, byte b) { - ; gotoxy(35, 11); textattr = 6; output << "Bubbles"; @@ -151,9 +143,7 @@ void colours(byte f, byte b) { } void adxinfo() { - ; { - ; info(5, 8, "Name", a.name); info(35, 8, "Comment", a.comment); info(5, 9, "Width", strf(a.xl)); @@ -168,7 +158,6 @@ void adxinfo() { } void status() { - ; textattr = 7; clrscr; textattr = 10; @@ -190,7 +179,6 @@ void status() { void enterstring(string w, byte l, string &q) { string t; - ; textattr = 13; clrscr; output << NL; @@ -208,26 +196,22 @@ void entercolour(string w, byte &c); static byte fv; static void loseold() { - ; output << string('\10') + '\377'; } static void drawnew() { - ; gotoxy(3 + fv * 5, 11); output << '\30'; } void entercolour(string w, byte &c) { - ; textattr = 13; clrscr; output << NL; output << "New value for " << w << '?' << NL; output << " Use \32\33 to move about, Enter=OK, Esc=Cancel." << NL; for (fv = 1; fv <= 15; fv ++) { - ; gotoxy(3 + fv * 5, 10); textattr = fv; output << ''; @@ -241,7 +225,6 @@ void entercolour(string w, byte &c) { return; break; /* no change to c */ case '\15': { - ; c = fv; adxmodi = true; return; @@ -250,14 +233,12 @@ void entercolour(string w, byte &c) { case '\0': switch (readkey()) { case 'G': { - ; loseold(); fv = 0; drawnew(); } break; /* home */ case 'O': { - ; loseold(); fv = 15; drawnew(); @@ -265,7 +246,6 @@ void entercolour(string w, byte &c) { break; /* end */ case 'K': if (fv > 0) { - ; loseold(); fv -= 1; drawnew(); @@ -273,7 +253,6 @@ void entercolour(string w, byte &c) { break; /* left */ case 'M': if (fv < 15) { - ; loseold(); fv += 1; drawnew(); @@ -289,7 +268,6 @@ void enternum(string w, byte &q) { string t; integer e; byte r; - ; textattr = 13; clrscr; output << NL; @@ -306,7 +284,6 @@ void enternum(string w, byte &q) { void editadx() { char r; - ; do { clrscr; textattr = 10; @@ -344,12 +321,10 @@ void editadx() { void saveit() { char pak; integer oldsoa; - ; textattr = 10; clrscr; centre(7, "Saving!"); if (adxmodi) { - ; centre(10, "ADX information being saved..."); seek(sf, 181); /* start of ADX info */ soa = sizeof(a); @@ -367,7 +342,6 @@ void saveit() { } void quit() { - ; close(sf); exit(0); } @@ -375,7 +349,6 @@ void quit() { void getsilmani() { /* Reclaims original sil & mani arrays */ byte x, y, z; word offs; - ; /* Sil... */ @@ -384,7 +357,6 @@ void getsilmani() { /* Reclaims original sil & mani arrays */ for (x = 0; x <= 3; x ++) for (y = 0; y <= a.yl; y ++) for (z = 0; z <= (a.xl / 8); z ++) { - ; offs = 5 + y * xw * 4 + xw * x + z; sil[y][z] = aa[offs]; } @@ -402,9 +374,7 @@ void explode(byte which) /* 0 is the first one! */ { byte fv, ff; word so1; /* size of one */ - ; { - ; so1 = a.size - 6; so1 += so1 / 4; seek(sf, 183 + soa + so1 * which); /* First is at 221 */ @@ -423,9 +393,7 @@ void explode(byte which) /* 0 is the first one! */ void implode(byte which) { /* Writes a pic back onto the disk */ byte fv, ff; word so1; /* size of one */ - ; { - ; getsilmani(); /* Restore original arrays */ @@ -445,10 +413,8 @@ void implode(byte which) { /* Writes a pic back onto the disk */ } void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ - ; move(mani, aa[5], sizeof(mani)); { - ; aa[1] = a.xl; aa[2] = 0; aa[3] = a.yl; @@ -460,17 +426,14 @@ void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ void plotsil(integer xx, integer yy) { /* Plots silhouette- rarely used */ byte x, y, z; word offs; - ; for (x = 0; x <= 3; x ++) for (y = 0; y <= a.yl; y ++) for (z = 0; z <= (a.xl / 8); z ++) { - ; offs = 5 + y * xw * 4 + xw * x + z; aa[offs] = sil[y][z]; } { - ; aa[1] = a.xl; aa[2] = 0; aa[3] = a.yl; @@ -482,7 +445,6 @@ void plotsil(integer xx, integer yy) { /* Plots silhouette- rarely used */ } void style(byte x) { - ; if (x == 16) /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); else @@ -490,7 +452,6 @@ void style(byte x) { } void bigpixel(integer x, integer y) { - ; if (getpixel(500 + x, 150 + y) == 15) /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); else @@ -501,7 +462,6 @@ void bigpixel(integer x, integer y) { } void subplot(byte y, integer x, char c) { - ; setfillstyle(1, 0); bar(x, 0, x + 9, 170); outtextxy(x + 5, y * 10 + 5, c); @@ -512,28 +472,23 @@ void plotleft() { subplot(leftc, 239, '\32'); } void plotright() { - ; subplot(rightc, 351, '\33'); } void plotbig(byte x, byte y, byte c) { - ; style(c); bar(x * bigpix_gap, y * bigpix_gap, x * bigpix_gap + bigpix_size, y * bigpix_gap + bigpix_size); if (c == 16) { - ; putpixel(500 + x, 150 + y, 15); putpixel(500 + x, 50 + y, 0); } else { - ; putpixel(500 + x, 150 + y, 0); putpixel(500 + x, 50 + y, c); } } void changepic() { - ; mx = mx / bigpix_gap; my = my / bigpix_gap; if ((mx > a.xl) || (my > a.yl)) return; @@ -544,22 +499,18 @@ void changepic() { } void changecol() { - ; my = my / 10; if (my > 16) return; if (mkey == left) { - ; leftc = my; plotleft(); } else { - ; rightc = my; plotright(); } } void showcutpic() { - ; setfillstyle(5, 1); bar(20, 160, 40 + clipx, 180 + clipy); putimage(30, 170, clip[2], andput); @@ -568,7 +519,6 @@ void showcutpic() { void movesquare(integer &xc, integer &yc, integer xl, integer yl) { integer x2, y2; - ; do { x2 = xl + xc; y2 = yl + yc; @@ -612,7 +562,6 @@ void switch_(integer &v1, integer &v2) /* Swaps over the values of v1 and v2. */ { integer temp; - ; temp = v1; v1 = v2; v2 = temp; @@ -620,7 +569,6 @@ void switch_(integer &v1, integer &v2) void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { boolean tl; - ; do { setcolor(15); do { @@ -655,7 +603,6 @@ void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { tl = ! tl; break; case '\15': { - ; if (x1 > x2) switch_(x1, x2); /* Get the square the right way up. */ if (y1 > y2) switch_(y1, y2); y2 -= y1; @@ -667,7 +614,6 @@ void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; { - ; if (y2 > a.yl) y2 = a.yl; if (x2 > a.xl) x2 = a.xl; } @@ -676,9 +622,7 @@ void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { void paste() { byte x, y; - ; if (! boardfull) { - ; output << '\7'; return; } @@ -688,17 +632,14 @@ void paste() { putimage(500 + xofs, 150 + yofs, clip[2], 0); for (x = 0; x <= a.xl; x ++) for (y = 0; y <= a.yl; y ++) { - ; bigpixel(x, y); } } void cut() { - ; xofs = 0; yofs = 0; /* From the TL. */ { - ; getimage(500, 50, 500 + a.xl, 50 + a.yl, clip[1]); getimage(500, 150, 500 + a.xl, 150 + a.yl, clip[2]); clipx = a.xl; @@ -709,9 +650,7 @@ void cut() { } void cutsome() { - ; { - ; choosesquare(xofs, yofs, clipx, clipy); getimage(500 + xofs, 50 + yofs, 500 + xofs + clipx, 50 + yofs + clipy, clip[1]); getimage(500 + xofs, 150 + yofs, 500 + xofs + clipx, 150 + yofs + clipy, clip[2]); @@ -724,7 +663,6 @@ boolean confirm(char c, string x) { byte col; char groi; boolean confirm_result; - ; while (keypressed()) groi = readkey(); x = x + "? " + c + " to confirm."; col = 1; @@ -741,12 +679,10 @@ boolean confirm(char c, string x) { } void checkbutton(byte which) { - ; my = (my - 12) / 25; switch (my) { case 0: if (confirm('S', "Save")) { - ; implode(which); lmo = true; } @@ -767,22 +703,18 @@ void checkbutton(byte which) { } void animate() { - ; } void undo() { - ; } void fliplr(); static void flipline(integer x1, integer x2, integer y) { integer fv, ff; - ; for (fv = x1; fv <= x2; fv ++) putpixel(fv, 0, getpixel(fv, y)); ff = x2; for (fv = x1; fv <= x2; fv ++) { - ; putpixel(fv, y, getpixel(ff, 0)); ff -= 1; } @@ -790,9 +722,7 @@ static void flipline(integer x1, integer x2, integer y) { void fliplr() { /* Flips left-to-right. */ integer fv, ff; - ; for (fv = 0; fv <= a.yl; fv ++) { - ; flipline(500, 500 + a.xl, 50 + fv); flipline(500, 500 + a.xl, 150 + fv); } @@ -803,10 +733,8 @@ void fliplr() { /* Flips left-to-right. */ void change_colours() { /* Swaps one colour with another. */ byte fv, ff; - ; if ((leftc == 16) || (rightc == 16)) { /* See-through can't be one of the colours. */ - ; output << '\7'; /* Bleep! */ return; } @@ -823,19 +751,16 @@ void change_colours() { /* Swaps one colour with another. */ void redraw() { byte x, y; - ; setfillstyle(1, 0); bar(0, 0, 250, 200); for (x = 0; x <= a.xl; x ++) for (y = 0; y <= a.yl; y ++) { - ; bigpixel(x, y); } } void parse(char c) { /* Parses keystrokes */ - ; switch (upcase(c)) { case '\26': case 'P': @@ -863,7 +788,6 @@ void parse(char c) { /* Parses keystrokes */ break; case '<': if (bigpix_size > 1) { - ; bigpix_size -= 1; bigpix_gap -= 1; redraw(); @@ -871,7 +795,6 @@ void parse(char c) { /* Parses keystrokes */ break; case '>': if (bigpix_size < 8) { - ; bigpix_size += 1; bigpix_gap += 1; redraw(); @@ -885,18 +808,15 @@ void parse(char c) { /* Parses keystrokes */ void editone(byte which) { byte x, y; - ; cleardevice(); explode(which); plotat(500, 50); plotsil(500, 150); for (x = 0; x <= a.xl; x ++) for (y = 0; y <= a.yl; y ++) { - ; bigpixel(x, y); } for (y = 0; y <= 16; y ++) { - ; style(y); bar(251, y * 10 + 1, 349, y * 10 + 9); rectangle(250, y * 10, 350, y * 10 + 10); @@ -929,7 +849,6 @@ void editone(byte which) { off; if (! lmo) { - ; getbuttonstatus; switch (mx) { @@ -957,13 +876,11 @@ static shortint first; static void drawup(byte &which) { byte fv; - ; whichc = chr(which + 48); cleardevice(); outtextxy(320, 10, string("Edit stride ") + whichc); first = (which - 1) * a.seq - 1; for (fv = 1; fv <= a.seq; fv ++) { - ; explode(fv + first); plotat(fv * 73, 77); outtextxy(17 + fv * 73, 64, chr(fv + 48)); @@ -973,12 +890,10 @@ static void drawup(byte &which) { void editstride(byte which) { char r; - ; drawup(which); do { r = readkey(); if ((r > '0') && (r <= chr(a.seq + 48))) { - ; editone(ord(r) - 48 + first); drawup(which); } @@ -991,7 +906,6 @@ static byte nds; /* num div seq */ static void drawup1() { byte fv; - ; setgraphmode(0); directvideo = false; settextjustify(1, 1); @@ -1000,7 +914,6 @@ static void drawup1() { outtextxy(320, 10, "Edit pictures..."); outtextxy(320, 40, "(Usually, 1=away, 2=right, 3=towards, 4=left.)"); for (fv = 1; fv <= nds; fv ++) { - ; explode((fv - 1)*a.seq); plotat(fv * 73, 100); outtextxy(17 + fv * 73, 87, chr(fv + 48)); @@ -1013,12 +926,10 @@ void editpics() { char r; byte which; integer e; - ; drawup1(); do { r = readkey(); if ((r > '0') && (r <= chr(nds + 48))) { - ; editstride(ord(r) - 48); drawup1(); } @@ -1030,7 +941,6 @@ void titles() { integer gd, gm; char pak; word wait; - ; gd = 3; gm = 1; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -1040,23 +950,19 @@ void titles() { wait = 0; do { for (gm = 0; gm <= 15; gm ++) { - ; setcolor(15 - gm); for (gd = 0; gd <= (150 - gm * 10); gd ++) { - ; outtextxy(320, 124 - gd, "Spread 2"); outtextxy(320, 125 + gd, "Spread 2"); if ((gd == 5) && (gm == 0)) wait = 2345; if ((gd == 6) && (gm == 0)) wait = 0; do { if (keypressed()) { - ; while (keypressed()) pak = readkey(); restorecrtmode(); return; } if (wait > 0) { - ; wait -= 1; delay(1); } @@ -1068,7 +974,6 @@ void titles() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; titles(); setup(); do { diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp index fc49a5e7f1c5..a083af054caa 100644 --- a/engines/avalanche/squish.cpp +++ b/engines/avalanche/squish.cpp @@ -250,7 +250,6 @@ void initialize() blockread(input_file, method, 1); if (method == 177) { - ; output << "It's already compressed!" << NL; exit(177); } diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp index 04f0da9e6b1b..9be7982862c8 100644 --- a/engines/avalanche/ss_blank.cpp +++ b/engines/avalanche/ss_blank.cpp @@ -36,7 +36,6 @@ boolean test; boolean the_cows_come_home() { registers rmove, rclick; boolean the_cows_come_home_result; - ; rmove.ax = 11; intr(0x33, rmove); rclick.ax = 3; @@ -51,12 +50,10 @@ boolean the_cows_come_home() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; test = the_cows_come_home(); textattr = 0; clrscr; do { - ; } while (!the_cows_come_home()); textattr = 30; clrscr; diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp index aa74b806ed7c..1ac87632344c 100644 --- a/engines/avalanche/ss_clock.cpp +++ b/engines/avalanche/ss_clock.cpp @@ -46,7 +46,6 @@ boolean test; boolean the_cows_come_home() { registers rmove, rclick; boolean the_cows_come_home_result; - ; rmove.ax = 11; intr(0x33, rmove); rclick.ax = 3; @@ -64,12 +63,10 @@ string time1() { varying_string<2> hh, mm, ss; char ampm; string time1_result; - ; gettime(h, m, s, s1); if (h < 12) ampm = 'a'; else { - ; ampm = 'p'; if (h == 0) h = 12; else h -= 12; /* 24-hr adjustment */ @@ -83,7 +80,6 @@ string time1() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; test = the_cows_come_home(); gm = registerbgidriver(&egavgadriverproc); gd = 3; @@ -105,7 +101,6 @@ int main(int argc, const char *argv[]) { if (count > 0) count -= 1; { pointtype &with = pages[cp]; - ; if (count == 0) bar(with.x, with.y, with.x + width, with.y + height); with.x = xx; diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp index 83490de6d590..09bbe3f9318a 100644 --- a/engines/avalanche/stars.cpp +++ b/engines/avalanche/stars.cpp @@ -191,7 +191,6 @@ void do_stuff() { void setcol(byte which, byte what) /*var dummy:byte;*/ { - ; /* setpalette(which,what); asm (* mov dx,$3DA; diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp index b4dd206c2ad1..e81f09229429 100644 --- a/engines/avalanche/status.cpp +++ b/engines/avalanche/status.cpp @@ -32,7 +32,6 @@ namespace Avalanche { integer gd, gm; void data(integer y, string a, string b) { - ; setcolor(1); settextjustify(2, 0); outtextxy(315, y, a + ':'); @@ -43,7 +42,6 @@ void data(integer y, string a, string b) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\turbo"); diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp index 97b60f74f6b2..6b7965afc11b 100644 --- a/engines/avalanche/sticks.cpp +++ b/engines/avalanche/sticks.cpp @@ -48,7 +48,6 @@ byte joyway(); static lmc getlmc(word n, word max, word min) { lmc getlmc_result; - ; if (n < min) getlmc_result = l; else if (n > max) getlmc_result = r; else @@ -60,13 +59,11 @@ byte joyway() { word x, y; lmc xx, yy; byte joyway_result; - ; if (~ dna.user_moves_avvy) return joyway_result; if (use_joy_a) readjoya(x, y); else readjoyb(x, y); { - ; xx = getlmc(x, cxmax, cxmin); yy = getlmc(y, cymax, cymin); } @@ -119,7 +116,6 @@ void joykeys() /* The 2 joystick keys may be reprogrammed. This parses them. */ { byte v; - ; if (use_joy_a) { v = (byte)(buttona1); v += (byte)(buttona2) * 2; diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp index 7baa88fe8793..f5e1f35fefa6 100644 --- a/engines/avalanche/sunrise.cpp +++ b/engines/avalanche/sunrise.cpp @@ -34,16 +34,13 @@ integer gd, gm; longint tskellern /*absolute $0:244*/; /* Over int $61 */ void hold() { - ; do { - ; } while (!(tskellern >= 1)); tskellern = 0; } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 1; initgraph(gd, gm, "c:\\bp\\bgi"); @@ -78,14 +75,12 @@ int main(int argc, const char *argv[]) { port[0x3cf] = 1; for (gm = 227; gm >= 1; gm --) { /* <<< try running this loop the other way round! */ - ; move(mem[0xa000 * gm * 80 + 80], mem[0xa000 * gm * 80], 8042); hold(); if (keypressed()) return 0; } for (gm = 101; gm >= 1; gm --) { - ; move(mem[0xa000 * 80], mem[0xa000 * 0], gm * 80); hold(); if (keypressed()) return 0; diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp index 914ba60d3a94..737433070734 100644 --- a/engines/avalanche/tempo.cpp +++ b/engines/avalanche/tempo.cpp @@ -50,7 +50,6 @@ untyped_file f; string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; @@ -59,11 +58,9 @@ string strf(longint x) { void load() { byte a /*absolute $A000:1200*/; byte bit; - ; reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -76,7 +73,6 @@ void load() { void init() { integer gd, gm; - ; output << "*** Tempo file creater ***" << NL; output << "Enter place*.avd number:"; input >> screennum >> NL; @@ -93,13 +89,11 @@ void init() { void choose() { integer x1, y1, xl, yl; - ; } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; init(); choose(); return EXIT_SUCCESS; diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp index 220c92c2c287..016322fb677e 100644 --- a/engines/avalanche/test.cpp +++ b/engines/avalanche/test.cpp @@ -34,7 +34,6 @@ namespace Avalanche { pointer saveint1f; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1f, saveint1f); setintvec(0x1f, &signature); swapvectors; diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp index dfdaae5227cc..1452ff89fdcb 100644 --- a/engines/avalanche/test2.cpp +++ b/engines/avalanche/test2.cpp @@ -34,7 +34,6 @@ pointer getint1f; array<1, 22, char> x; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; getintvec(0x1f, getint1f); move(getint1f, x, 22); if (x == signature) diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp index b58ddc628d0a..ff2d38181538 100644 --- a/engines/avalanche/testblit.cpp +++ b/engines/avalanche/testblit.cpp @@ -41,10 +41,8 @@ word s; void mblit() { byte bit; longint st; - ; st = ttp; for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = mb1; portw[0x3ce] = copyput * 256 + 3; portw[0x3ce] = 0x205; @@ -57,13 +55,11 @@ void mblit() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, ""); settextstyle(1, 0, 7); for (gd = 0; gd <= 1; gd ++) { - ; setactivepage(gd); setcolor(6 * gd + 6); outtextxy(0, 0, chr(65 + gd)); diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp index aec0d92aed39..a0bcdc8fdd03 100644 --- a/engines/avalanche/testcard.cpp +++ b/engines/avalanche/testcard.cpp @@ -40,14 +40,12 @@ searchrec r; int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); for (gd = 0; gd <= 14; gd ++) for (gm = 0; gm <= 11; gm ++) { - ; setfillstyle(gm, gd + 1); bar(gd * 43, gm * 12 + 10, 42 + gd * 43, gm * 12 + 21); } @@ -64,7 +62,6 @@ int main(int argc, const char *argv[]) { findfirst(string("place") + filename + ".avd", anyfile, r); if (doserror == 0) { - ; output << "*** ALREADY EXISTS! CANCELLED! ***" << NL; input >> NL; exit(0); @@ -80,7 +77,6 @@ int main(int argc, const char *argv[]) { rewrite(f, 1); blockwrite(f, gd, 177); /* just anything */ for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp index d0a0ac31f66d..2ce1932d1e56 100644 --- a/engines/avalanche/testenh.cpp +++ b/engines/avalanche/testenh.cpp @@ -31,7 +31,6 @@ namespace Avalanche { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; do { readkeye; switch (inchar) { diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp index 84b6f04ed77d..88bbce9a48e1 100644 --- a/engines/avalanche/travel.cpp +++ b/engines/avalanche/travel.cpp @@ -35,13 +35,11 @@ integer gd, gm; void zoomout(integer x, integer y) { integer x1, y1, x2, y2; byte fv; - ; setcolor(white); setwritemode(xorput); setlinestyle(dottedln, 0, 1); for (fv = 1; fv <= 20; fv ++) { - ; x1 = x - (x / 20) * fv; y1 = y - ((y - 10) / 20) * fv; x2 = x + (((639 - x) / 20) * fv); @@ -56,13 +54,11 @@ void zoomout(integer x, integer y) { void zoomin(integer x, integer y) { integer x1, y1, x2, y2; byte fv; - ; setcolor(white); setwritemode(xorput); setlinestyle(dottedln, 0, 1); for (fv = 20; fv >= 1; fv --) { - ; x1 = x - (x / 20) * fv; y1 = y - ((y - 10) / 20) * fv; x2 = x + (((639 - x) / 20) * fv); @@ -76,7 +72,6 @@ void zoomin(integer x, integer y) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp index 8ef57c591a4a..753db0dc6529 100644 --- a/engines/avalanche/trip.cpp +++ b/engines/avalanche/trip.cpp @@ -64,7 +64,6 @@ void gpwtcol(void *buf, integer n) { /* Cedola */ void loadtrip() { untyped_file inf; - ; assign(inf, "t:avvy.trp"); reset(inf, 1); seek(inf, 0x27); @@ -75,7 +74,6 @@ void loadtrip() { void plot(word count, integer ox, integer oy) { /* orig x & y. Page is always 1. */ byte x, y, len; - ; do { len = blue3[count]; if (len == 177) return; @@ -83,13 +81,11 @@ void plot(word count, integer ox, integer oy) { /* orig x & y. Page is always 1. y = blue3[count + 2]; count += 3; { - ; gdcur_x = x + ox; gdcur_y = y + oy; /* fiddle xy coords to match page 1 */ gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ if (gdcur_x < 0) { - ; gdcur_x += 640; gdcur_y -= 1; } @@ -100,7 +96,6 @@ void plot(word count, integer ox, integer oy) { /* orig x & y. Page is always 1. } void boundscheck() { - ; if (dna.uy > 123) dna.uy = 123; if (dna.uy < 10) dna.uy = 10; if (dna.ux < 5) dna.ux = 5; @@ -108,7 +103,6 @@ void boundscheck() { } void budge() { - ; if (set::of(up, ul, ur, eos).has(dna.rw)) dna.uy -= 3; if (set::of(down, dl, dr, eos).has(dna.rw)) dna.uy += 3; if (set::of(left, ul, dl, eos).has(dna.rw)) dna.ux -= 5; @@ -117,78 +111,66 @@ void budge() { boundscheck(); if (dna.rw > 0) { - ; anim += 1; if (anim == 7) anim = 1; } } void tripkey(char dir) { - ; if (cw != 177) return; { dnatype &with = dna; - ; switch (dir) { case 'H': if (with.rw != up) { - ; with.rw = up; ww = up; } else with.rw = 0; break; case 'P': if (with.rw != down) { - ; with.rw = down; ww = down; } else with.rw = 0; break; case 'K': if (with.rw != left) { - ; with.rw = left; ww = left; } else with.rw = 0; break; case 'M': if (with.rw != right) { - ; with.rw = right; ww = right; } else with.rw = 0; break; case 'I': if (with.rw != ur) { - ; with.rw = ur; ww = right; } else with.rw = 0; break; case 'Q': if (with.rw != dr) { - ; with.rw = dr; ww = right; } else with.rw = 0; break; case 'O': if (with.rw != dl) { - ; with.rw = dl; ww = left; } else with.rw = 0; break; case 'G': if (with.rw != ul) { - ; with.rw = ul; ww = left; } else with.rw = 0; break; } if (with.rw == 0) { - ; ux = ppos[0][0]; uy = ppos[0][1]; anim -= 1; @@ -198,14 +180,12 @@ void tripkey(char dir) { } void trippancy() { - ; if ((dna.rw == 0) || (cw != 177) || (! dropsok)) return; r.ax = 11; intr(0x33, r); setactivepage(1); off(); if (ppos[0][1] != -177) { - ; putimage(ppos[0][0], ppos[0][1], replace[0], 0); } diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp index 4889b264a590..33f2859c7e31 100644 --- a/engines/avalanche/trip3.cpp +++ b/engines/avalanche/trip3.cpp @@ -74,7 +74,6 @@ const integer ul = 8; /* merge setting is used to control the combining of bits. */ /* */ void gpwtcol(void *buf, integer n) { /* Cedola */ - ; /* inline ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ @@ -86,7 +85,6 @@ void gpwtcol(void *buf, integer n) { /* Cedola */ void loadtrip() { untyped_file inf; - ; assign(inf, "t:avvy.trp"); reset(inf, 1); seek(inf, 0x27); @@ -96,11 +94,9 @@ void loadtrip() { } void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byte mmx, byte mmy, byte st) { - ; tramt += 1; { triprec &with = tr[tramt]; - ; with.handle = what_handle; with.ix = 0; with.iy = 0; @@ -119,7 +115,6 @@ void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byt void plot(byte stage, integer ox, integer oy) { /* orig x & y. Page is always 1/UNSEEN. */ byte x, y, len; word count; - ; count = pozzes[stage]; do { len = blue3[count]; @@ -128,13 +123,11 @@ void plot(byte stage, integer ox, integer oy) { /* orig x & y. Page is always 1/ y = blue3[count + 2]; count += 3; { - ; gdcur_x = x + ox; gdcur_y = y + oy; /* fiddle xy coords to match page 1 */ gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ if (gdcur_x < 0) { - ; gdcur_x += 640; gdcur_y -= 1; } @@ -150,7 +143,6 @@ void trippancy() { word s; array<1, 10, pointer> q; boolean allstill; - ; if ((cw != 177) || (! dropsok) || keypressed()) return; /* Do the Avvy Walk */ @@ -195,7 +187,6 @@ void trippancy() { if (allstill) return; if (dna.rw > 0) { - ; anim += 1; if (anim == 7) anim = 1; } @@ -206,7 +197,6 @@ void trippancy() { off(); for (fv = 1; fv <= tramt; fv ++) { triprec &with = tr[fv]; - ; s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); getmem(q[fv], s); getimage(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym, q[fv]); @@ -214,7 +204,6 @@ void trippancy() { /* Step 2 - Plot sprites on 1/UNSEEN */ for (fv = 1; fv <= tramt; fv ++) { triprec &with = tr[fv]; - ; plot(with.stage, with.x, with.y); } /* Step 3 - Copy all eligible from 1/UNSEEN to 0/SEEN */ @@ -222,7 +211,6 @@ void trippancy() { for (fv = 1; fv <= tramt; fv ++) { triprec &with = tr[fv]; if (((with.alive) && (!((with.ix == 0) && (with.iy == 0)))) || with.prime) { - ; s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); getmem(p, s); setactivepage(1); @@ -237,7 +225,6 @@ void trippancy() { setactivepage(1); for (fv = 1; fv <= tramt; fv ++) { triprec &with = tr[fv]; - ; putimage(with.x - with.xm, with.y - with.ym, q[fv], 0); if (with.ix != 0) with.x = with.x + with.ix; if (with.iy != 0) with.y = with.y + with.iy; @@ -253,7 +240,6 @@ void trippancy() { release(saved1); for (fv = 1; fv <= tramt; fv ++) { /* synch xy coords of mouths */ triprec &with = tr[fv]; - ; mouths[fv].x = with.x + 20; mouths[fv].y = with.y; } @@ -263,11 +249,9 @@ void trippancy() { void budge(byte who, shortint xx, shortint yy, byte frame) { /* Moving & animation controller */ byte fv; - ; for (fv = 1; fv <= tramt; fv ++) { triprec &with = tr[fv]; if (with.handle == who) { - ; with.ix = xx; with.iy = yy; with.stage = frame; @@ -276,71 +260,60 @@ void budge(byte who, shortint xx, shortint yy, byte frame) { /* Moving & animati } void tripkey(char dir) { - ; if (cw != 177) return; { dnatype &with = dna; - ; switch (dir) { case 'H': if (with.rw != up) { - ; with.rw = up; ww = up; } else with.rw = 0; break; case 'P': if (with.rw != down) { - ; with.rw = down; ww = down; } else with.rw = 0; break; case 'K': if (with.rw != left) { - ; with.rw = left; ww = left; } else with.rw = 0; break; case 'M': if (with.rw != right) { - ; with.rw = right; ww = right; } else with.rw = 0; break; case 'I': if (with.rw != ur) { - ; with.rw = ur; ww = right; } else with.rw = 0; break; case 'Q': if (with.rw != dr) { - ; with.rw = dr; ww = right; } else with.rw = 0; break; case 'O': if (with.rw != dl) { - ; with.rw = dl; ww = left; } else with.rw = 0; break; case 'G': if (with.rw != ul) { - ; with.rw = ul; ww = left; } else with.rw = 0; break; } if (with.rw == 0) { - ; ux = ppos[0][0]; uy = ppos[0][1]; anim -= 1; @@ -350,7 +323,6 @@ void tripkey(char dir) { } void boundscheck(integer &x, integer &y, byte xm, byte ym) { - ; if (y > 127 - ym) y = 127 - ym; if (y < ym + 10) y = ym + 10; if (x < xm) x = xm; diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp index 04acf36f74c8..29482dcd24dc 100644 --- a/engines/avalanche/trip42.cpp +++ b/engines/avalanche/trip42.cpp @@ -78,7 +78,6 @@ end; */ void loadtrip() { byte gm; - ; for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); tr[1].init(0); } @@ -87,7 +86,6 @@ byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { byte a, c; integer fv, ff; byte checkfeet_result; - ; a = 0; setactivepage(2); if (x1 < 0) x1 = 0; @@ -95,14 +93,12 @@ byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { if (oy < y) for (fv = x1; fv <= x2; fv ++) for (ff = oy + yl; ff <= y + yl; ff ++) { - ; c = getpixel(fv, ff); if (c > a) a = c; } else for (fv = x1; fv <= x2; fv ++) for (ff = y + yl; ff <= oy + yl; ff ++) { - ; c = getpixel(fv, ff); if (c > a) a = c; } @@ -115,13 +111,11 @@ void touchcol(byte tc); static boolean bug; static void fr(byte a, byte b) { - ; fliproom(a, b); bug = false; } void touchcol(byte tc) { - ; bug = true; /* j.i.c. */ switch (dna.room) { case 1: @@ -156,7 +150,6 @@ void touchcol(byte tc) { break; } if (bug) { - ; display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) + '.'); tr[1].bounce(); @@ -171,7 +164,6 @@ triptype *triptype::init(byte spritenum) { byte sort, n; word bigsize; pointer p, q; - ; str(spritenum, xx); assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); reset(f, 1); @@ -180,7 +172,6 @@ triptype *triptype::init(byte spritenum) { blockread(f, bigsize, 2); setactivepage(3); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); blockread(f, p, bigsize); @@ -192,7 +183,6 @@ triptype *triptype::init(byte spritenum) { adxtype &with = a; for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - ; getmem(pic[n][sort], a.size); /* grab the memory */ getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, @@ -219,13 +209,11 @@ triptype *triptype::init(byte spritenum) { } void triptype::original() { - ; quick = false; } void triptype::andexor() { byte picnum; /* Picnum, Picnic, what ye heck */ - ; picnum = face * a.seq + step + 1; off; putimage(x, y, pic[picnum][0], andput); @@ -233,13 +221,11 @@ void triptype::andexor() { } void triptype::turn(byte whichway) { - ; if (whichway == 8) face = 0; else face = whichway; } void triptype::appear(integer wx, integer wy, byte wf) { - ; x = (wx / 8) * 8; y = wy; ox[cp] = wx; @@ -253,9 +239,7 @@ void triptype::appear(integer wx, integer wy, byte wf) { void triptype::walk() { byte tc; fieldtype r; - ; { - ; x1 = x - 1; y1 = y - 2; x2 = x + a.xl + 1; @@ -268,13 +252,11 @@ void triptype::walk() { x = x + ix; y = y + iy; if (check_me) { - ; tc = checkfeet(x, x + a.xl, oy[cp], y, a.yl); if (tc != 0) { void &with = magics[tc]; switch (op) { case exclaim: { - ; bounce(); dixi('x', data); } @@ -286,7 +268,6 @@ void triptype::walk() { fliproom(hi(data), lo(data)); break; case unfinished: { - ; bounce(); display("\7Sorry.\3\rThis place is not avaliable yet!"); } @@ -296,7 +277,6 @@ void triptype::walk() { } count += 1; if (((ix != 0) || (iy != 0)) && (count > 1)) { - ; step += 1; if (step == a.seq) step = 0; count = 0; @@ -304,7 +284,6 @@ void triptype::walk() { } void triptype::bounce() { - ; x = ox[cp]; y = oy[cp]; stopwalk(); @@ -312,7 +291,6 @@ void triptype::bounce() { } void triptype::walkto(integer xx, integer yy) { - ; speed(xx - x, yy - y); hx = xx; hy = yy; @@ -320,13 +298,11 @@ void triptype::walkto(integer xx, integer yy) { } void triptype::stophoming() { - ; homing = false; } void triptype::homestep() { integer temp; - ; if ((hx == x) && (hy == y)) { ; /* touching the target */ homing = false; @@ -335,14 +311,12 @@ void triptype::homestep() { ix = 0; iy = 0; if (hy != y) { - ; temp = hy - y; if (temp > 4) iy = 4; else if (temp < -4) iy = -4; else iy = temp; } if (hx != x) { - ; temp = hx - x; if (temp > 4) ix = 4; else if (temp < -4) ix = -4; @@ -351,7 +325,6 @@ void triptype::homestep() { } void triptype::speed(shortint xx, shortint yy) { - ; ix = xx; iy = yy; if ((ix == 0) && (iy == 0)) return; /* no movement */ @@ -360,21 +333,18 @@ void triptype::speed(shortint xx, shortint yy) { if (iy < 0) turn(up); else turn(down); } else { - ; if (ix < 0) turn(left); else turn(right); } } void triptype::stopwalk() { - ; ix = 0; iy = 0; homing = false; } void triptype::chatter() { - ; talkx = x + a.xl / 2; talky = y; talkf = a.fgc; @@ -382,19 +352,16 @@ void triptype::chatter() { } getsettype *getsettype::init() { - ; numleft = 0; /* initialise array pointer */ return this; } void getsettype::remember(fieldtype r) { - ; numleft += 1; gs[numleft] = r; } void getsettype::recall(fieldtype &r) { - ; r = gs[numleft]; numleft -= 1; } @@ -402,7 +369,6 @@ void getsettype::recall(fieldtype &r) { void rwsp(byte t, byte r) { const integer xs = 3; const integer ys = 1; - ; { triptype &with = tr[t]; switch (r) { @@ -435,10 +401,8 @@ void rwsp(byte t, byte r) { } void apped(byte trn, byte np) { - ; { triptype &with = tr[trn]; - ; { void &with1 = peds[np]; appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); @@ -450,11 +414,9 @@ void apped(byte trn, byte np) { void getback() { byte fv; fieldtype r; - ; { getsettype &with = getset[1 - cp]; while (with.numleft > 0) { - ; recall(r); mblit(x1, y1, x2, y2, 3, 1 - cp); } @@ -463,7 +425,6 @@ void getback() { void trippancy_link() { byte fv; - ; if ((ddm_o.menunow) | ontoolbar | seescroll | (~ alive)) return; for (fv = 1; fv <= numtr; fv ++) { triptype &with = tr[fv]; @@ -480,72 +441,61 @@ void trippancy_link() { } void stopwalking() { - ; tr[1].stopwalk(); dna.rw = stopped; } void tripkey(char dir) { - ; if (ctrl == cjoy) return; { triptype &with = tr[1]; { - ; switch (dir) { case 'H': if (rw != up) { - ; rw = up; rwsp(1, rw); } else stopwalking(); break; case 'P': if (rw != down) { - ; rw = down; rwsp(1, rw); } else stopwalking(); break; case 'K': if (rw != left) { - ; rw = left; rwsp(1, rw); } else stopwalking(); break; case 'M': if (rw != right) { - ; rw = right; rwsp(1, rw); } else stopwalking(); break; case 'I': if (rw != ur) { - ; rw = ur; rwsp(1, rw); } else stopwalking(); break; case 'Q': if (rw != dr) { - ; rw = dr; rwsp(1, rw); } else stopwalking(); break; case 'O': if (rw != dl) { - ; rw = dl; rwsp(1, rw); } else stopwalking(); break; case 'G': if (rw != ul) { - ; rw = ul; rwsp(1, rw); } else stopwalking(); @@ -560,12 +510,10 @@ void tripkey(char dir) { void getsetclear() { byte fv; - ; for (fv = 0; fv <= 1; fv ++) getset[fv].init(); } void fliproom(byte room, byte ped) { - ; dusk; getsetclear(); enterroom(room); @@ -579,12 +527,10 @@ void fliproom(byte room, byte ped) { boolean infield(byte x) { /* returns True if you're within field "x" */ integer yy; boolean infield_result; - ; { void &with = fields[x]; { triptype &with = tr[1]; - ; yy = with.y + with.a.yl; infield_result = (with.x >= x1) && (with.x <= x2) && (yy >= y1) && (yy <= y2); } @@ -597,7 +543,6 @@ boolean neardoor() { /* returns True if you're near a door! */ byte fv; boolean nd; boolean neardoor_result; - ; if (numfields < 9) { ; /* there ARE no doors here! */ neardoor_result = false; @@ -605,14 +550,12 @@ boolean neardoor() { /* returns True if you're near a door! */ } { triptype &with = tr[1]; - ; ux = with.x; uy = with.y + with.a.yl; } nd = false; for (fv = 9; fv <= numfields; fv ++) { void &with = fields[fv]; - ; if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; } neardoor_result = nd; @@ -621,24 +564,20 @@ boolean neardoor() { /* returns True if you're near a door! */ void readstick() { byte jw; - ; if (ctrl == ckey) return; jw = joyway; { triptype &with = tr[1]; - ; if (jw == stopped) stopwalking(); else { - ; dna.rw = jw; rwsp(1, dna.rw); } } if (jw != oldjw) { - ; showrw; oldjw = jw; } @@ -652,7 +591,6 @@ class unit_trip42_initialize { static unit_trip42_initialize trip42_constructor; unit_trip42_initialize::unit_trip42_initialize() { - ; getsetclear(); } diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp index 9a6a82f6377a..8557f1873b6b 100644 --- a/engines/avalanche/trip5.cpp +++ b/engines/avalanche/trip5.cpp @@ -1036,7 +1036,6 @@ void triptype::andexor() { loop @nextbyte; { Keep going round until cx=0. } */ { - ; } #endif diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp index 191d8f3756b1..98f0afaa2511 100644 --- a/engines/avalanche/trip5tst.cpp +++ b/engines/avalanche/trip5tst.cpp @@ -54,13 +54,11 @@ void filesetup() { const integer idshould = -1317732048; longint id; word soa; - ; assign(inf, "v:sprite2.avd"); reset(inf, 1); seek(inf, 177); blockread(inf, id, 4); if (id != idshould) { - ; output << '\7'; close(inf); exit(0); @@ -72,9 +70,7 @@ void filesetup() { void loadpic() { byte fv, ff; - ; { - ; xw = a.xl / 8; if ((a.xl % 8) > 0) xw += 1; @@ -95,9 +91,7 @@ void plotone(integer xx, integer yy) { word s; word ofs, fv; byte x, y, z; - ; { - ; s = imagesize(x, y, xx + a.xl, yy + a.yl); getimage(xx, yy, xx + a.xl, yy + a.yl, aa); /* Now loaded into our local buffer. */ @@ -106,7 +100,6 @@ void plotone(integer xx, integer yy) { for (x = 0; x <= 3; x ++) for (y = 0; y <= 35; y ++) for (z = 0; z <= 4; z ++) { - ; ofs = 5 + y * xw * 4 + xw * x + z; aa[ofs] = aa[ofs] & sil[y][z]; } @@ -147,7 +140,6 @@ void plotone(integer xx, integer yy) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp index eecfa75de2cc..1f701db67867 100644 --- a/engines/avalanche/trip5xf.cpp +++ b/engines/avalanche/trip5xf.cpp @@ -72,9 +72,7 @@ untyped_file out; integer bigsize; void copyaoa() { - ; { - ; a.name = oa.name; a.comment = "Transferred"; a.num = oa.num; @@ -92,7 +90,6 @@ void load() { byte gd, gm, sort, n; pointer p, q; pointer xf; - ; assign(f, string("v:osprte") + sn + ".avd"); reset(f, 1); seek(f, 59); @@ -103,7 +100,6 @@ void load() { getmem(xf, a.size); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); blockread(f, p, bigsize); @@ -117,7 +113,6 @@ void load() { for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - ; getmem(pic[n][sort], a.size); /* grab the memory */ getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, @@ -137,7 +132,6 @@ void load() { void setup() { integer gd, gm; - ; output << "TRIP5XF (c) 1992, Thomas Thurman." << NL; output << NL; output << "Enter number of SPRITE*.AVD file to convert:"; @@ -151,7 +145,6 @@ void setup() { string strf(longint x) { string q; string strf_result; - ; str(x, q); strf_result = q; return strf_result; @@ -164,10 +157,8 @@ void save() { byte xw; byte nxl, nyl; word soa; - ; cleardevice(); { - ; a.size = imagesize(0, 0, a.xl, a.yl); soa = sizeof(a); @@ -184,7 +175,6 @@ void save() { if ((nxl % 8) > 0) xw += 1; for (n = 1; n <= a.num; n ++) { - ; putimage(0, 0, pic[n][0], 0); getimage(0, 0, a.xl, a.yl, aa); for (fv = 0; fv <= nyl; fv ++) @@ -204,7 +194,6 @@ void save() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup(); save(); diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp index 2fe8f5f4cbb4..6e98d800c0c9 100644 --- a/engines/avalanche/tripoop.cpp +++ b/engines/avalanche/tripoop.cpp @@ -86,7 +86,6 @@ static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2 /* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ { boolean dropin_result; - ; dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); return dropin_result; } @@ -96,7 +95,6 @@ static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2 static void transfer(integer x1, integer y1, integer x2, integer y2) { pointer p, q; word s; - ; s = imagesize(x1, y1, x2, y2); setfillstyle(1, 0); mark(q); @@ -113,7 +111,6 @@ static void transfer(integer x1, integer y1, integer x2, integer y2) { static integer lesser(integer a, integer b) { integer lesser_result; - ; if (a < b) lesser_result = a; else lesser_result = b; return lesser_result; @@ -123,7 +120,6 @@ static integer lesser(integer a, integer b) { static integer greater(integer a, integer b) { integer greater_result; - ; if (a > b) greater_result = a; else greater_result = b; return greater_result; @@ -132,7 +128,6 @@ static integer greater(integer a, integer b) { void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) { - ; if (dropin(x3, y3, x1, y1, x2, y2) || dropin(x3, y4, x1, y1, x2, y2) || dropin(x4, y3, x1, y1, x2, y2) @@ -148,12 +143,10 @@ void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer void setup() { integer gd, gm; - ; gd = 3; gm = 0; initgraph(gd, gm, ""); for (gd = 0; gd <= 1; gd ++) { - ; setactivepage(gd); setfillstyle(9, 1); bar(0, 0, 640, 200); @@ -169,7 +162,6 @@ triptype *triptype::init(byte spritenum) { pointer p, q; word bigsize; byte sort, n; - ; str(spritenum, xx); assign(f, string("v:sprite") + xx + ".avd"); reset(f, 1); @@ -179,7 +171,6 @@ triptype *triptype::init(byte spritenum) { setvisualpage(3); setactivepage(3); for (sort = 0; sort <= 1; sort ++) { - ; mark(q); getmem(p, bigsize); blockread(f, p, bigsize); @@ -190,7 +181,6 @@ triptype *triptype::init(byte spritenum) { adxtype &with = a; for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - ; getmem(pic[n][sort], a.size); /* grab the memory */ getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, @@ -216,12 +206,10 @@ triptype *triptype::init(byte spritenum) { } void triptype::original() { - ; quick = false; } void triptype::getback() { - ; tax = x; tay = y; getimage(x, y, x + a.xl, y + a.yl, behind); @@ -229,20 +217,17 @@ void triptype::getback() { void triptype::andexor() { byte picnum; /* Picnum, Picnic, what ye heck */ - ; picnum = face * a.seq + step + 1; putimage(x, y, pic[picnum][0], andput); putimage(x, y, pic[picnum][1], xorput); } void triptype::turn(byte whichway) { - ; face = whichway; step = 0; } void triptype::appear(integer wx, integer wy, byte wf) { - ; x = wx; y = wy; ox = wx; @@ -252,7 +237,6 @@ void triptype::appear(integer wx, integer wy, byte wf) { } void triptype::walk() { - ; ox = x; oy = y; if (homing) homestep(); @@ -264,17 +248,14 @@ void triptype::walk() { } void triptype::do_it() { - ; copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); } void triptype::putback() { - ; putimage(tax, tay, behind, 0); } void triptype::walkto(integer xx, integer yy) { - ; speed(xx - x, yy - y); hx = xx; hy = yy; @@ -282,13 +263,11 @@ void triptype::walkto(integer xx, integer yy) { } void triptype::stophoming() { - ; homing = false; } void triptype::homestep() { integer temp; - ; if ((hx == x) && (hy == y)) { ; /* touching the target */ homing = false; @@ -297,14 +276,12 @@ void triptype::homestep() { ix = 0; iy = 0; if (hy != y) { - ; temp = hy - y; if (temp > 4) iy = 4; else if (temp < -4) iy = -4; else iy = temp; } if (hx != x) { - ; temp = hx - x; if (temp > 4) ix = 4; else if (temp < -4) ix = -4; @@ -313,7 +290,6 @@ void triptype::homestep() { } void triptype::speed(shortint xx, shortint yy) { - ; ix = xx; iy = yy; if ((ix == 0) && (iy == 0)) return; /* no movement */ @@ -322,14 +298,12 @@ void triptype::speed(shortint xx, shortint yy) { if (iy < 0) turn(up); else turn(down); } else { - ; if (ix < 0) turn(left); else turn(right); } } void triptype::halt() { - ; ix = 0; iy = 0; homing = false; @@ -337,10 +311,8 @@ void triptype::halt() { void trip() { byte fv; - ; for (fv = 1; fv <= numtr; fv ++) { triptype &with = tr[fv]; - ; walk(); if (with.quick && with.visible) andexor(); do_it(); @@ -350,11 +322,9 @@ void trip() { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; setup(); { triptype &with = tr[1]; - ; init(1); appear(600, 100, left); do { diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp index 1a10794940d1..bc9fbafa238b 100644 --- a/engines/avalanche/ttmenuxf.cpp +++ b/engines/avalanche/ttmenuxf.cpp @@ -62,7 +62,6 @@ void load() { /* Load2, actually */ void finder() { char r; integer x, y; - ; setfillstyle(0, 0); setcolor(14); x = 320; @@ -74,7 +73,6 @@ void finder() { line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); do { - ; } while (!keypressed()); line(x - 20, y, x + 20, y); line(x, y - 20, x, y + 20); diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp index 63d2562f8bcd..78ac9997d626 100644 --- a/engines/avalanche/unsquish.cpp +++ b/engines/avalanche/unsquish.cpp @@ -43,9 +43,7 @@ buffertype *buffer; word bufsize; void putup(byte what) { - ; if (offset > 12080) { - ; bit += 1; port[0x3c4] = 2; port[0x3ce] = 4; @@ -64,7 +62,6 @@ void load_uncomp(string xx) /* Load2, actually */ byte this_; untyped_file f; word place; - ; assign(f, string("v:place") + xx + ".avd"); reset(f, 1); seek(f, 146); @@ -79,7 +76,6 @@ void load_uncomp(string xx) /* Load2, actually */ place = 1; while (place <= bufsize) { - ; this_ = (*buffer)[place]; place += 1; putup(this_); @@ -371,14 +367,12 @@ static void get_code(integer &hash_code) if (place > bufsize) return; else { - ; local_buf = (*buffer)[place]; place += 1; } if (place > bufsize) return; else { - ; input_code = (*buffer)[place]; place += 1; } @@ -393,7 +387,6 @@ static void get_code(integer &hash_code) if (place > bufsize) return; else { - ; local_buf = (*buffer)[place]; place += 1; } @@ -517,7 +510,6 @@ void load_comp(string xx) { byte this_; untyped_file f; - ; string_table = new sttype; inempty = true; initialize_string_table(); @@ -544,7 +536,6 @@ void load_comp(string xx) { int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp index b205474879d9..ff00aab57e65 100644 --- a/engines/avalanche/viewdocs.cpp +++ b/engines/avalanche/viewdocs.cpp @@ -97,7 +97,6 @@ void wipesb(word wheretop) { byte plane; for (plane = 2; plane <= 3; plane ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << plane; @@ -124,7 +123,6 @@ void displstat(byte wipepos) { /*displays the status bar*/ port[0x3cf] = 3; wrapcopy(stbar2, (lat + 336) * 80); for (plane = 2; plane <= 3; plane ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << plane; @@ -152,7 +150,6 @@ void udstat() { /*updates the status bar*/ str(round((real)((tlab - 21)) / (nol - 21) * 100), pt); for (fv = 1; fv <= 3; fv ++) for (fv2 = 0; fv2 <= 13; fv2 ++) { - ; stbar[fv2 * 80 + fv + 68] = ~ textvar[ord(pt[fv]) + 1][fv2]; stbar2[fv2 * 80 + fv + 68] = textvar[ord(pt[fv]) + 1][fv2]; } @@ -191,7 +188,6 @@ headers by searching for '"""'*/ varpos2 = posof13[varpos - 2] + 2; while (((*textmem)[varpos2] == 32) || ((*textmem)[varpos2] == 9)) varpos2 += 1; while (varpos2 != posof13[varpos - 1]) { - ; headerstring = headerstring + chr((*textmem)[varpos2]); varpos2 += 1; } @@ -244,7 +240,6 @@ void setupsb(byte sbtype) { /*sets up the status bar in several styles*/ break; } for (fv = 0; fv <= 1118; fv ++) { - ; stbar[fv + 1] = ~ textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; stbar2[fv + 1] = textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; } @@ -284,12 +279,10 @@ void setup() { /*sets up graphics, variables, etc.*/ close(f); finddocinfo(); if (paramstr(1) == "REGI") { - ; regimode = true; tlab = contlist[contsize].headeroffset + 24; lat = contlist[contsize].headeroffset * 14; } else { - ; lat = 0; tlab = 24; regimode = false; @@ -316,7 +309,6 @@ void drawscreenf(integer tl) /*draws a screen from a line forwards*/ if (tl < 0) tl = 0; lat = tl * 14; for (plane = 2; plane <= 3; plane ++) { /*wipe sb off*/ - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << plane; @@ -404,7 +396,6 @@ void displcont() { /*displays the contents*/ } showscreen(); do { - ; } while (!keypressed()); rkv = readkey(); switch (rkv) { @@ -517,7 +508,6 @@ void control() { /*User control*/ else drawscreenf(tlab - 24); first = true; do { - ; rkv = readkey(); switch (rkv) { case '\0': { @@ -530,7 +520,6 @@ void control() { /*User control*/ drawscreenf(nol - 24); break; case cpgdn: { - ; memw[bfseg * bfofs] = 0; if (fast == false) wipesb(lat); fv = 1; @@ -543,7 +532,6 @@ void control() { /*User control*/ } break; case cpgup: { - ; memw[bfseg * bfofs] = 0; if (fast == false) wipesb(lat); fv = 1; diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp index f8726c3a62fa..30d16a79d280 100644 --- a/engines/avalanche/xf_gover.cpp +++ b/engines/avalanche/xf_gover.cpp @@ -32,12 +32,10 @@ namespace Avalanche { void load() { byte a; /*absolute $A000:1200;*/ byte bit; untyped_file f; - ; assign(f, "avagame.avd"); reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -93,7 +91,6 @@ void dump_to_file(byte x1, byte y1, byte x2, byte y2, string fn) { for (y = y1; y <= y2; y ++) for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp index d2c552dae939..c216d317068e 100644 --- a/engines/avalanche/xfbutton.cpp +++ b/engines/avalanche/xfbutton.cpp @@ -46,7 +46,6 @@ void load() { /* Load2, actually */ reset(f, 1); seek(f, 177); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp index 28e7efddd62b..2ad6a43db5f1 100644 --- a/engines/avalanche/xfghost.cpp +++ b/engines/avalanche/xfghost.cpp @@ -66,14 +66,12 @@ pointer a_p; word a_s; void open_chunk() { - ; assign(chunkfile, "v:spooky.avd"); rewrite(chunkfile, 1); blockwrite(chunkfile, chunkheader, sizeof(chunkheader)); } void close_chunk() { - ; close(chunkfile); } @@ -83,10 +81,8 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ integer y; byte bit; - ; #ifndef DRYRUN { - ; cb.flavour = how; switch (newx) { case n: @@ -116,7 +112,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ } if (how != ch_natural) { - ; s = imagesize(x1, y1, x2, y2); getmem(p, s); getimage(x1, y1, x2, y2, p); @@ -137,7 +132,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ blockwrite(chunkfile, p, s); break; case ch_ega: { - ; setactivepage(1); cleardevice(); putimage(0, 0, p, 0); @@ -145,7 +139,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ for (bit = 0; bit <= 3; bit ++) for (y = 0; y <= cb.yl; y ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -165,7 +158,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ for (bit = 2; bit <= 3; bit ++) /* << Bit to grab? */ for (y = 0; y <= cb.yl; y ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -185,7 +177,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ for (bit = 3; bit <= 3; bit ++) for (y = 0; y <= cb.yl; y ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -206,7 +197,6 @@ void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integ int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; #ifndef DRYRUN open_chunk(); #endif @@ -217,7 +207,6 @@ int main(int argc, const char *argv[]) { assign(f, "c:\\sleep4\\colour.ptx"); reset(f, 1); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp index cae7b04cf6ed..6172f84837f1 100644 --- a/engines/avalanche/zapdraw.cpp +++ b/engines/avalanche/zapdraw.cpp @@ -38,21 +38,18 @@ integer gd, gm; void graphmode(integer mode) { registers regs; - ; regs.ax = (mode % 0x100); intr(0x10, regs); } int main(int argc, const char *argv[]) { pio_initialize(argc, argv); - ; gd = 3; gm = 0; initgraph(gd, gm, "c:\\bp\\bgi"); assign(f, "d:avltzap.raw"); reset(f, 1); for (bit = 0; bit <= 3; bit ++) { - ; port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; From 2c0e16d6e4a410164e5ce70d739006a479a3724e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Jun 2013 12:51:07 +0200 Subject: [PATCH 0009/1332] AVALANCHE: Hook the engine into ScummVM. --- engines/avalanche/module.mk | 182 ++++++++++++++++++++++++++++++++++++ engines/configure.engines | 1 + engines/engines.mk | 5 + engines/plugins_table.h | 3 + 4 files changed, 191 insertions(+) create mode 100644 engines/avalanche/module.mk diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk new file mode 100644 index 000000000000..12400516409c --- /dev/null +++ b/engines/avalanche/module.mk @@ -0,0 +1,182 @@ +MODULE := engines/avalanche + +MODULE_OBJS = \ + 1stoff.o \ + access.o \ + acci.o \ + also.o \ + andexor.o \ + andexor2.o \ + andextst.o \ + arch.o \ + avalot9.o \ + avbkgrnd.o \ + avmenu.o \ + avvyans.o \ + avvyans2.o \ + avvymonk.o \ + bakchunk.o \ + basher.o \ + bootstrp.o \ + cadburys.o \ + celer.o \ + ch_egats.o \ + charmap.o \ + chunker.o \ + chunkxf1.o \ + chunkxf2.o \ + chunkxf3.o \ + chunkxf4.o \ + chunkxf5.o \ + chunkxf6.o \ + chunkxf7.o \ + chunkxf8.o \ + chunkxf9.o \ + chunkxfa.o \ + chunkxfb.o \ + chunkxfc.o \ + chunkxfd.o \ + chunkxfe.o \ + chunkxff.o \ + chunkxfg.o \ + chunkxfh.o \ + chunkxfi.o \ + chunkxfj.o \ + chunkxfk.o \ + chunkxfl.o \ + clock.o \ + closing.o \ + convert.o \ + convmous.o \ + credits.o \ + displtxt.o \ + dropdown.o \ + dwidth.o \ + edhead.o \ + edna.o \ + enhanced.o \ + enid.o \ + filer.o \ + fileunit.o \ + filing.o \ + folktemp.o \ + fontslid.o \ + frere.o \ + golden.o \ + g-room.o \ + gyro.o \ + help.o \ + help2.o \ + helpbak.o \ + helper.o \ + hibits.o \ + highs.o \ + hiz.o \ + incline.o \ + initxf.o \ + inputtes.o \ + intro.o \ + ints.o \ + joysetup.o \ + joystick.o \ + loading.o \ + logger.o \ + lucerna.o \ + magic2.o \ + magidraw.o \ + magishuf.o \ + make!.o \ + makeregi.o \ + makesez.o \ + makevmou.o \ + menuxf.o \ + minstran.o \ + newsprit.o \ + nim.o \ + nimdraw.o \ + nimunit.o \ + oldfiler.o \ + oldhighs.o \ + oldincln.o \ + oldtrip.o \ + omtest.o \ + oopmenu.o \ + overlap.o \ + overscro.o \ + particle.o \ + pictemp.o \ + pictemp2.o \ + pingo.o \ + plottest.o \ + preview1.o \ + qintro.o \ + qstars.o \ + rawupd.o \ + readsez.o \ + reginam.o \ + sackb1.o \ + sackb3.o \ + sackblas.o \ + saving.o \ + scr_1.o \ + scr_2.o \ + scr_3.o \ + scr_4.o \ + scr_5.o \ + scr_9.o \ + scrolls.o \ + sequence.o \ + setup.o \ + seu.o \ + seu_avvy.o \ + sez.o \ + sezedit.o \ + sezunit.o \ + sezxfr.o \ + shell1.o \ + shell2.o \ + slope.o \ + spread.o \ + spread2.o \ + squish.o \ + ss_blank.o \ + ss_clock.o \ + stars.o \ + status.o \ + sticks.o \ + sunrise.o \ + tempo.o \ + test.o \ + test2.o \ + testblit.o \ + testcard.o \ + testenh.o \ + timeout.o \ + travel.o \ + trip.o \ + trip3.o \ + trip42.o \ + trip5.o \ + trip5tst.o \ + trip5xf.o \ + tripoop.o \ + ttmenuxf.o \ + unsquish.o \ + viewdocs.o \ + visa.o \ + visatest.o \ + waver.o \ + xf_gover.o \ + xf_help.o \ + xf_visa.o \ + xfbutton.o \ + xfghost.o \ + zapdraw.o + +# This module can be built as a plugin +ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/configure.engines b/engines/configure.engines index 15aa11d0eff2..0f059e6c6179 100644 --- a/engines/configure.engines +++ b/engines/configure.engines @@ -6,6 +6,7 @@ add_engine he "HE71+ games" yes add_engine agi "AGI" yes add_engine agos "AGOS" yes "agos2" "AGOS 1 games" add_engine agos2 "AGOS 2 games" yes +add_engine avalanche "Lord Avalot d'Argent" no add_engine cge "CGE" yes add_engine cine "Cinematique evo 1" yes add_engine composer "Magic Composer" yes diff --git a/engines/engines.mk b/engines/engines.mk index b905a288c905..4f38629dad6d 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -26,6 +26,11 @@ DEFINES += -DENABLE_AGOS2 endif endif +ifdef ENABLE_AVALANCHE +DEFINES += -DENABLE_AVALANCHE=$(ENABLE_AVALANCHE) +MODULES += engines/avalanche +endif + ifdef ENABLE_CGE DEFINES += -DENABLE_CGE=$(ENABLE_CGE) MODULES += engines/cge diff --git a/engines/plugins_table.h b/engines/plugins_table.h index 44979458caec..6d623e500365 100644 --- a/engines/plugins_table.h +++ b/engines/plugins_table.h @@ -8,6 +8,9 @@ LINK_PLUGIN(AGI) #if PLUGIN_ENABLED_STATIC(AGOS) LINK_PLUGIN(AGOS) #endif +#if PLUGIN_ENABLED_STATIC(AVALANCHE) +LINK_PLUGIN(AVALANCHE) +#endif #if PLUGIN_ENABLED_STATIC(CGE) LINK_PLUGIN(CGE) #endif From d53f5d9885b99e0b109489585e13acf95e832837 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Jun 2013 17:52:25 +0200 Subject: [PATCH 0010/1332] AVALANCHE: Add skeleton. --- engines/avalanche/avalanche.cpp | 101 ++++++++++++++++++++++++++++++++ engines/avalanche/avalanche.h | 83 ++++++++++++++++++++++++++ engines/avalanche/console.cpp | 39 ++++++++++++ engines/avalanche/console.h | 54 +++++++++++++++++ engines/avalanche/module.mk | 2 + 5 files changed, 279 insertions(+) create mode 100644 engines/avalanche/avalanche.cpp create mode 100644 engines/avalanche/avalanche.h create mode 100644 engines/avalanche/console.cpp create mode 100644 engines/avalanche/console.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp new file mode 100644 index 000000000000..d9599b7308bd --- /dev/null +++ b/engines/avalanche/avalanche.cpp @@ -0,0 +1,101 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "common/system.h" +#include "common/random.h" +#include "common/error.h" +#include "common/events.h" +#include "common/debug-channels.h" +#include "common/config-manager.h" +#include "common/textconsole.h" + +#include "avalanche/avalanche.h" + +#include "engines/util.h" + +namespace Avalanche { + + AvalancheEngine *AvalancheEngine::s_Engine = 0; + + AvalancheEngine::AvalancheEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst), _gameDescription(gd) { + _system = syst; + _console = new AvalancheConsole(this); + _rnd = 0; + } + + AvalancheEngine::~AvalancheEngine() { + delete _console; + delete _rnd; + } + + GUI::Debugger *AvalancheEngine::getDebugger() { + return _console; + } + + Common::Platform AvalancheEngine::getPlatform() const { + return _platform; + } + + bool AvalancheEngine::hasFeature(EngineFeature f) const { + return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); + } + + const char *AvalancheEngine::getCopyrightString() const { + return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; + } + + Common::String AvalancheEngine::getSavegameFilename(int slot) { + return _targetName + Common::String::format("-%02d.SAV", slot); + } + + void AvalancheEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + // _sound->syncVolume(); + } + + Common::Error AvalancheEngine::run() { + s_Engine = this; + initGraphics(320, 200, false); + _console = new AvalancheConsole(this); + + // _mouse = new MouseHandler(this); + + // Setup mixer + syncSoundSettings(); + + return Common::kNoError; + } + + void AvalancheEngine::initialize() { + //debugC(1, kDebugEngine, "initialize"); + + _rnd = new Common::RandomSource("avalanche"); + _rnd->setSeed(42); // Kick random number generator + } + +} // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h new file mode 100644 index 000000000000..13d20d00a47c --- /dev/null +++ b/engines/avalanche/avalanche.h @@ -0,0 +1,83 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef AVALANCHE_H +#define AVALANCHE_H + +#include "engines/engine.h" +#include "avalanche/console.h" +#include "engines/advancedDetector.h" + +namespace Common { +class RandomSource; +} + +namespace Avalanche { + +static const int kSavegameVersion = 1; + +class AvalancheEngine : public Engine { +public: + AvalancheEngine(OSystem *syst, const ADGameDescription *gd); + ~AvalancheEngine(); + + OSystem *_system; + + GUI::Debugger *getDebugger(); + + Common::RandomSource *_rnd; + + const ADGameDescription *_gameDescription; + uint32 getFeatures() const; + const char *getGameId() const; + + void initGame(const ADGameDescription *gd); + + Common::Platform getPlatform() const; + + bool hasFeature(EngineFeature f) const; + const char *getCopyrightString() const; + + Common::String getSavegameFilename(int slot); + void syncSoundSettings(); + +protected: + // Engine APIs + Common::Error run(); + +private: + static AvalancheEngine *s_Engine; + + AvalancheConsole *_console; + Common::Platform _platform; + + void initialize(); +}; + +} // End of namespace Avalanche + +#endif // AVALANCHE_H diff --git a/engines/avalanche/console.cpp b/engines/avalanche/console.cpp new file mode 100644 index 000000000000..03f198fbf557 --- /dev/null +++ b/engines/avalanche/console.cpp @@ -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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/console.h" +#include "avalanche/avalanche.h" + +namespace Avalanche { + + AvalancheConsole::AvalancheConsole(AvalancheEngine *vm) : GUI::Debugger(), _vm(vm) { + } + + AvalancheConsole::~AvalancheConsole() { + } + +} // End of namespace Avalanche diff --git a/engines/avalanche/console.h b/engines/avalanche/console.h new file mode 100644 index 000000000000..91b77d436503 --- /dev/null +++ b/engines/avalanche/console.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef AVALANCHE_CONSOLE_H +#define AVALANCHE_CONSOLE_H + +#include "gui/debugger.h" + +namespace Avalanche { + + class AvalancheEngine; + + class AvalancheConsole : public GUI::Debugger { + public: + AvalancheConsole(AvalancheEngine *vm); + virtual ~AvalancheConsole(void); + + private: + AvalancheEngine *_vm; + bool Cmd_listScreens(int argc, const char **argv); + bool Cmd_listObjects(int argc, const char **argv); + bool Cmd_getObject(int argc, const char **argv); + bool Cmd_getAllObjects(int argc, const char **argv); + bool Cmd_gotoScreen(int argc, const char **argv); + bool Cmd_boundaries(int argc, const char **argv); + }; + +} // End of namespace Avalanche + +#endif // AVALANCHE_CONSOLE_H diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 12400516409c..cd14820949f3 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -9,6 +9,7 @@ MODULE_OBJS = \ andexor2.o \ andextst.o \ arch.o \ + avalanche.o \ avalot9.o \ avbkgrnd.o \ avmenu.o \ @@ -46,6 +47,7 @@ MODULE_OBJS = \ chunkxfl.o \ clock.o \ closing.o \ + console.o \ convert.o \ convmous.o \ credits.o \ From d2009c014f17f11472432eb7a160aacfb7eaae80 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Jun 2013 20:32:43 +0200 Subject: [PATCH 0011/1332] AVALANCHE: Add detection. Some fix in console.h. --- engines/avalanche/console.h | 6 - engines/avalanche/detection.cpp | 223 ++++++++++++++++++++++++++++++++ engines/avalanche/module.mk | 1 + 3 files changed, 224 insertions(+), 6 deletions(-) create mode 100644 engines/avalanche/detection.cpp diff --git a/engines/avalanche/console.h b/engines/avalanche/console.h index 91b77d436503..138c3db05cc7 100644 --- a/engines/avalanche/console.h +++ b/engines/avalanche/console.h @@ -41,12 +41,6 @@ namespace Avalanche { private: AvalancheEngine *_vm; - bool Cmd_listScreens(int argc, const char **argv); - bool Cmd_listObjects(int argc, const char **argv); - bool Cmd_getObject(int argc, const char **argv); - bool Cmd_getAllObjects(int argc, const char **argv); - bool Cmd_gotoScreen(int argc, const char **argv); - bool Cmd_boundaries(int argc, const char **argv); }; } // End of namespace Avalanche diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp new file mode 100644 index 000000000000..7ab4101844e0 --- /dev/null +++ b/engines/avalanche/detection.cpp @@ -0,0 +1,223 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "engines/advancedDetector.h" +#include "common/system.h" +#include "common/savefile.h" +#include "graphics/thumbnail.h" + +#include "avalanche/avalanche.h" + +namespace Avalanche { + +uint32 AvalancheEngine::getFeatures() const { + return _gameDescription->flags; +} + +const char *AvalancheEngine::getGameId() const { + return _gameDescription->gameid; +} + +static const ADGameDescription gameDescriptions[] = { + // Avalanche English + { + "Avalanche", 0, + { + {"avalot.sez", 0, "de10eb353228013da3d3297784f81ff9", 48763}, + {"mainmenu.avd", 0, "89f31211af579a872045b175cc264298", 18880}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformPCEngine, + ADGF_NO_FLAGS, + GUIO0() + }, + + AD_TABLE_END_MARKER +}; + +class AvalancheMetaEngine : public AdvancedMetaEngine { +public: + AvalancheMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), 0) { + } + + const char *getName() const { + return "Avalanche"; + } + + const char *getOriginalCopyright() const { + return "Avalanche Engine Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; + } + + bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; + bool hasFeature(MetaEngineFeature f) const; + + int getMaximumSaveSlot() const; + SaveStateList listSaves(const char *target) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; + void removeSaveState(const char *target, int slot) const; +}; + +bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { + if (gd) { + *engine = new AvalancheEngine(syst, (const ADGameDescription *)gd); + ((AvalancheEngine *)*engine)->initGame((const ADGameDescription *)gd); + } + return gd != 0; +} + +bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate); +} + +int AvalancheMetaEngine::getMaximumSaveSlot() const { return 99; } + +SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String pattern = target; + pattern += "-??.SAV"; + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + char slot[3]; + int slotNum = 0; + for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { + slot[0] = filename->c_str()[filename->size() - 6]; + slot[1] = filename->c_str()[filename->size() - 5]; + slot[2] = '\0'; + // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot + slotNum = atoi(slot); + if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { + Common::InSaveFile *file = saveFileMan->openForLoading(*filename); + if (file) { + int saveVersion = file->readByte(); + + if (saveVersion != kSavegameVersion) { + warning("Savegame of incompatible version"); + delete file; + continue; + } + + // read name + uint16 nameSize = file->readUint16BE(); + if (nameSize >= 255) { + delete file; + continue; + } + char name[256]; + file->read(name, nameSize); + name[nameSize] = 0; + + saveList.push_back(SaveStateDescriptor(slotNum, name)); + delete file; + } + } + } + + return saveList; +} + +SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); + + if (file) { + int saveVersion = file->readByte(); + + if (saveVersion != kSavegameVersion) { + warning("Savegame of incompatible version"); + delete file; + return SaveStateDescriptor(); + } + + uint32 saveNameLength = file->readUint16BE(); + char saveName[256]; + file->read(saveName, saveNameLength); + saveName[saveNameLength] = 0; + + SaveStateDescriptor desc(slot, saveName); + + Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); + desc.setThumbnail(thumbnail); + + desc.setDeletableFlag(true); + desc.setWriteProtectedFlag(false); + + uint32 saveDate = file->readUint32BE(); + uint16 saveTime = file->readUint16BE(); + + int day = (saveDate >> 24) & 0xFF; + int month = (saveDate >> 16) & 0xFF; + int year = saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (saveTime >> 8) & 0xFF; + int minutes = saveTime & 0xFF; + + desc.setSaveTime(hour, minutes); + + // Slot 0 is used for the 'restart game' save in all Avalanche games, thus + // we prevent it from being deleted. + desc.setDeletableFlag(slot != 0); + desc.setWriteProtectedFlag(slot == 0); + + delete file; + return desc; + } + return SaveStateDescriptor(); +} + +void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + g_system->getSavefileManager()->removeSavefile(fileName); +} + +} // End of namespace Avalanche + +#if PLUGIN_ENABLED_DYNAMIC(AVALANCHE) +REGISTER_PLUGIN_DYNAMIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); +#else +REGISTER_PLUGIN_STATIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); +#endif + +namespace Avalanche { + +void AvalancheEngine::initGame(const ADGameDescription *gd) { + _platform = gd->platform; +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index cd14820949f3..9a919e64109f 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -51,6 +51,7 @@ MODULE_OBJS = \ convert.o \ convmous.o \ credits.o \ + detection.o \ displtxt.o \ dropdown.o \ dwidth.o \ From 17ee13f2c1d12f16d77a6f287c4fd1bf14010d9e Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 19 Jun 2013 16:59:12 +0200 Subject: [PATCH 0012/1332] AVALANCHE: Start stubbing with bootstrp.cpp. --- engines/avalanche/avalanche.cpp | 158 ++++++++++++++++++++++++++++++-- engines/avalanche/avalanche.h | 70 ++++++++++++++ engines/avalanche/module.mk | 1 - 3 files changed, 222 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d9599b7308bd..d1a19b89d2c8 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -78,11 +78,162 @@ namespace Avalanche { // _sound->syncVolume(); } + void AvalancheEngine::initialize() { + //debugC(1, kDebugEngine, "initialize"); + + _rnd = new Common::RandomSource("avalanche"); + _rnd->setSeed(42); // Kick random number generator + } + + + + // From Bootstrp: + + void AvalancheEngine::cursor_off() { + warning("STUB: cursor_off()"); + } + + void AvalancheEngine::cursor_on() { + warning("STUB: cursor_on()"); + } + + void AvalancheEngine::quit() { + cursor_on(); + } + + Common::String AvalancheEngine::strf(int32 x) { + Common::String q = Common::String::format("%d", x); + return q; + } + + Common::String AvalancheEngine::command_com() { + warning("STUB: command_com()"); + return ("STUB: command_com()"); + } + + void AvalancheEngine::explain(byte error) { + warning("STUB: explain()"); + } + + void AvalancheEngine::b_flight() { /*interrupt;*/ + _storage.skellern++; + } + + void AvalancheEngine::bflight_on() { + _storage.skellern = _reset_; + warning("STUB: bflight_on()"); + // setintvec(0x1c, &b_flight); + } + + void AvalancheEngine::bflight_off() { + warning("STUB: bflight_off()"); + // setintvec(0x1c, old_1c); + } + + Common::String AvalancheEngine::elm2str(elm how) { + Common::String elm2str_result; + switch (how) { + case Normal: + case Musical: + elm2str_result = "jsb"; + break; + case Regi: + elm2str_result = "REGI"; + break; + case Elmpoyten: + elm2str_result = "ELMPOYTEN"; + break; + } + return elm2str_result; + } + + void AvalancheEngine::run(Common::String what, bool with_jsb, bool with_bflight, elm how) { + warning("STUB: run()"); + // Probably there'll be no need of this function, as all *.AVX-es will become classes. + } + + void AvalancheEngine::run_avalot() { + warning("STUB: run_avalot()"); + } + + void AvalancheEngine::run_the_demo() { + warning("STUB: run_the_demo()"); + } + + void AvalancheEngine::get_arguments() { + warning("STUB: get_arguments()"); + } + + void AvalancheEngine::dos_shell() { + warning("STUB: dos_shell()"); + } + + bool AvalancheEngine::keypressed1() { + warning("STUB: keypressed1()"); + return false; + } + + void AvalancheEngine::flush_buffer() { + warning("STUB: flush_buffer()"); + } + + void AvalancheEngine::demo() { + warning("STUB: demo()"); + } + + void AvalancheEngine::call_menu() { + warning("STUB: call_menu()"); + } + + void AvalancheEngine::get_slope() { + warning("STUB: get_slope()"); + } + + + Common::Error AvalancheEngine::run() { s_Engine = this; initGraphics(320, 200, false); _console = new AvalancheConsole(this); + + + // From bootstrp: + + /*original_mode = mem[seg0040 * 0x49]; + getintvec(0x1c, old_1c);*/ + + first_time = true; + + get_arguments(); + get_slope(); + + if (! zoomy) call_menu(); /* Not run when zoomy. */ + + do { + run_avalot(); + + //if (dosexitcode != 77) quit(); /* Didn't stop for us. */ + + switch (_storage.operation) { + case _runShootemup: + run("seu.avx", _jsb, _bflight, Normal); + break; + case _runDosshell: + dos_shell(); + break; + case _runGhostroom: + run("g-room.avx", _jsb, _no_bflight, Normal); + break; + case _runGolden: + run("golden.avx", _jsb, _bflight, Musical); + break; + } + + } while (true); + + + // _mouse = new MouseHandler(this); // Setup mixer @@ -91,11 +242,6 @@ namespace Avalanche { return Common::kNoError; } - void AvalancheEngine::initialize() { - //debugC(1, kDebugEngine, "initialize"); - - _rnd = new Common::RandomSource("avalanche"); - _rnd->setSeed(42); // Kick random number generator - } + } // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 13d20d00a47c..b0b42ac4093b 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -76,6 +76,76 @@ class AvalancheEngine : public Engine { Common::Platform _platform; void initialize(); + + // From bootstrp: + + enum elm {Normal, Musical, Elmpoyten, Regi}; + + static const int16 _runShootemup = 1, _runDosshell = 2, _runGhostroom = 3, _runGolden = 4; + + static const int16 _reset_ = 0; + + static const bool _jsb = true, _no_jsb = false, _bflight = true, _no_bflight = false; + + struct { + byte operation; + uint16 skellern; + byte contents[1000]; + } _storage; + + Common::String arguments, demo_args, args_with_no_filename; + + bool first_time; + + byte original_mode; + void *old_1c; + + Common::String segofs; + + bool zoomy; + + int32 soundcard, speed, baseaddr, irq, dma; + + void cursor_off(); + + void cursor_on(); + + void quit(); + + Common::String strf(int32 x); + + Common::String command_com(); + + void explain(byte error); + + void b_flight(); + + void bflight_on(); + + void bflight_off(); + + Common::String elm2str(elm how); + + void run(Common::String what, bool with_jsb, bool with_bflight, elm how); + + void run_avalot(); + + void run_the_demo(); + + void get_arguments(); + + void dos_shell(); + + bool keypressed1(); + + void flush_buffer(); + + void demo(); + + void call_menu(); + + void get_slope(); + }; } // End of namespace Avalanche diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 9a919e64109f..bd79833e76cd 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -18,7 +18,6 @@ MODULE_OBJS = \ avvymonk.o \ bakchunk.o \ basher.o \ - bootstrp.o \ cadburys.o \ celer.o \ ch_egats.o \ From cf8057379942eaba99bd4b98f2986910e90b6e86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Jun 2013 21:37:06 +0200 Subject: [PATCH 0013/1332] AVALANCHE: Fix compilation --- engines/avalanche/module.mk | 172 +----------------------------------- 1 file changed, 1 insertion(+), 171 deletions(-) diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index bd79833e76cd..4db7160d6840 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -1,179 +1,9 @@ MODULE := engines/avalanche MODULE_OBJS = \ - 1stoff.o \ - access.o \ - acci.o \ - also.o \ - andexor.o \ - andexor2.o \ - andextst.o \ - arch.o \ avalanche.o \ - avalot9.o \ - avbkgrnd.o \ - avmenu.o \ - avvyans.o \ - avvyans2.o \ - avvymonk.o \ - bakchunk.o \ - basher.o \ - cadburys.o \ - celer.o \ - ch_egats.o \ - charmap.o \ - chunker.o \ - chunkxf1.o \ - chunkxf2.o \ - chunkxf3.o \ - chunkxf4.o \ - chunkxf5.o \ - chunkxf6.o \ - chunkxf7.o \ - chunkxf8.o \ - chunkxf9.o \ - chunkxfa.o \ - chunkxfb.o \ - chunkxfc.o \ - chunkxfd.o \ - chunkxfe.o \ - chunkxff.o \ - chunkxfg.o \ - chunkxfh.o \ - chunkxfi.o \ - chunkxfj.o \ - chunkxfk.o \ - chunkxfl.o \ - clock.o \ - closing.o \ console.o \ - convert.o \ - convmous.o \ - credits.o \ - detection.o \ - displtxt.o \ - dropdown.o \ - dwidth.o \ - edhead.o \ - edna.o \ - enhanced.o \ - enid.o \ - filer.o \ - fileunit.o \ - filing.o \ - folktemp.o \ - fontslid.o \ - frere.o \ - golden.o \ - g-room.o \ - gyro.o \ - help.o \ - help2.o \ - helpbak.o \ - helper.o \ - hibits.o \ - highs.o \ - hiz.o \ - incline.o \ - initxf.o \ - inputtes.o \ - intro.o \ - ints.o \ - joysetup.o \ - joystick.o \ - loading.o \ - logger.o \ - lucerna.o \ - magic2.o \ - magidraw.o \ - magishuf.o \ - make!.o \ - makeregi.o \ - makesez.o \ - makevmou.o \ - menuxf.o \ - minstran.o \ - newsprit.o \ - nim.o \ - nimdraw.o \ - nimunit.o \ - oldfiler.o \ - oldhighs.o \ - oldincln.o \ - oldtrip.o \ - omtest.o \ - oopmenu.o \ - overlap.o \ - overscro.o \ - particle.o \ - pictemp.o \ - pictemp2.o \ - pingo.o \ - plottest.o \ - preview1.o \ - qintro.o \ - qstars.o \ - rawupd.o \ - readsez.o \ - reginam.o \ - sackb1.o \ - sackb3.o \ - sackblas.o \ - saving.o \ - scr_1.o \ - scr_2.o \ - scr_3.o \ - scr_4.o \ - scr_5.o \ - scr_9.o \ - scrolls.o \ - sequence.o \ - setup.o \ - seu.o \ - seu_avvy.o \ - sez.o \ - sezedit.o \ - sezunit.o \ - sezxfr.o \ - shell1.o \ - shell2.o \ - slope.o \ - spread.o \ - spread2.o \ - squish.o \ - ss_blank.o \ - ss_clock.o \ - stars.o \ - status.o \ - sticks.o \ - sunrise.o \ - tempo.o \ - test.o \ - test2.o \ - testblit.o \ - testcard.o \ - testenh.o \ - timeout.o \ - travel.o \ - trip.o \ - trip3.o \ - trip42.o \ - trip5.o \ - trip5tst.o \ - trip5xf.o \ - tripoop.o \ - ttmenuxf.o \ - unsquish.o \ - viewdocs.o \ - visa.o \ - visatest.o \ - waver.o \ - xf_gover.o \ - xf_help.o \ - xf_visa.o \ - xfbutton.o \ - xfghost.o \ - zapdraw.o + detection.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) From b916ab6f0247a0e9da36442d8dd6fd6834cd0ee4 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 08:32:58 +0200 Subject: [PATCH 0014/1332] AVALANCHE: Messing around with GameDescription. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalanche.h | 8 +- engines/avalanche/detection.cpp | 268 ++++++++++++++++---------------- 3 files changed, 144 insertions(+), 134 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d1a19b89d2c8..f66e293aed0d 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -41,7 +41,7 @@ namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; - AvalancheEngine::AvalancheEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst), _gameDescription(gd) { + AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { _system = syst; _console = new AvalancheConsole(this); _rnd = 0; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index b0b42ac4093b..6837ea5aa7b2 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -38,11 +38,13 @@ class RandomSource; namespace Avalanche { +struct AvalancheGameDescription; + static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: - AvalancheEngine(OSystem *syst, const ADGameDescription *gd); + AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); OSystem *_system; @@ -51,11 +53,11 @@ class AvalancheEngine : public Engine { Common::RandomSource *_rnd; - const ADGameDescription *_gameDescription; + const AvalancheGameDescription *_gameDescription; uint32 getFeatures() const; const char *getGameId() const; - void initGame(const ADGameDescription *gd); + void initGame(const AvalancheGameDescription *gd); Common::Platform getPlatform() const; diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 7ab4101844e0..10d23bbb7e81 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -34,16 +34,24 @@ namespace Avalanche { +struct AvalancheGameDescription { + ADGameDescription desc; +}; + uint32 AvalancheEngine::getFeatures() const { - return _gameDescription->flags; + return _gameDescription->desc.flags; } const char *AvalancheEngine::getGameId() const { - return _gameDescription->gameid; + return _gameDescription->desc.gameid; } +static const PlainGameDescriptor avalancheGames[] = { + {"avalot", "Lord Avalot d'Argent"}, + {0, 0} +}; + static const ADGameDescription gameDescriptions[] = { - // Avalanche English { "Avalanche", 0, { @@ -52,7 +60,7 @@ static const ADGameDescription gameDescriptions[] = { AD_LISTEND }, Common::EN_ANY, - Common::kPlatformPCEngine, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() }, @@ -62,7 +70,7 @@ static const ADGameDescription gameDescriptions[] = { class AvalancheMetaEngine : public AdvancedMetaEngine { public: - AvalancheMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), 0) { + AvalancheMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(AvalancheGameDescription), avalancheGames) { } const char *getName() const { @@ -76,135 +84,135 @@ class AvalancheMetaEngine : public AdvancedMetaEngine { bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; bool hasFeature(MetaEngineFeature f) const; - int getMaximumSaveSlot() const; + /*int getMaximumSaveSlot() const; SaveStateList listSaves(const char *target) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; - void removeSaveState(const char *target, int slot) const; + void removeSaveState(const char *target, int slot) const;*/ }; bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { - if (gd) { - *engine = new AvalancheEngine(syst, (const ADGameDescription *)gd); - ((AvalancheEngine *)*engine)->initGame((const ADGameDescription *)gd); - } + if (gd) /*{*/ + *engine = new AvalancheEngine(syst, (const AvalancheGameDescription *)gd); + /* ((AvalancheEngine *)*engine)->initGame((const ADGameDescription *)gd); + }*/ return gd != 0; } bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { - return - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); -} - -int AvalancheMetaEngine::getMaximumSaveSlot() const { return 99; } - -SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - Common::StringArray filenames; - Common::String pattern = target; - pattern += "-??.SAV"; - - filenames = saveFileMan->listSavefiles(pattern); - sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) - - SaveStateList saveList; - char slot[3]; - int slotNum = 0; - for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { - slot[0] = filename->c_str()[filename->size() - 6]; - slot[1] = filename->c_str()[filename->size() - 5]; - slot[2] = '\0'; - // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot - slotNum = atoi(slot); - if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { - Common::InSaveFile *file = saveFileMan->openForLoading(*filename); - if (file) { - int saveVersion = file->readByte(); - - if (saveVersion != kSavegameVersion) { - warning("Savegame of incompatible version"); - delete file; - continue; - } - - // read name - uint16 nameSize = file->readUint16BE(); - if (nameSize >= 255) { - delete file; - continue; - } - char name[256]; - file->read(name, nameSize); - name[nameSize] = 0; - - saveList.push_back(SaveStateDescriptor(slotNum, name)); - delete file; - } - } - } - - return saveList; + return false; + /*(f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate);*/ } -SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); - Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); - - if (file) { - int saveVersion = file->readByte(); - - if (saveVersion != kSavegameVersion) { - warning("Savegame of incompatible version"); - delete file; - return SaveStateDescriptor(); - } - - uint32 saveNameLength = file->readUint16BE(); - char saveName[256]; - file->read(saveName, saveNameLength); - saveName[saveNameLength] = 0; - - SaveStateDescriptor desc(slot, saveName); - - Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); - desc.setThumbnail(thumbnail); - - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - - uint32 saveDate = file->readUint32BE(); - uint16 saveTime = file->readUint16BE(); - - int day = (saveDate >> 24) & 0xFF; - int month = (saveDate >> 16) & 0xFF; - int year = saveDate & 0xFFFF; - - desc.setSaveDate(year, month, day); - - int hour = (saveTime >> 8) & 0xFF; - int minutes = saveTime & 0xFF; - - desc.setSaveTime(hour, minutes); - - // Slot 0 is used for the 'restart game' save in all Avalanche games, thus - // we prevent it from being deleted. - desc.setDeletableFlag(slot != 0); - desc.setWriteProtectedFlag(slot == 0); - - delete file; - return desc; - } - return SaveStateDescriptor(); -} - -void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { - Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); - g_system->getSavefileManager()->removeSavefile(fileName); -} +//int AvalancheMetaEngine::getMaximumSaveSlot() const { return 99; } +// +//SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { +// Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); +// Common::StringArray filenames; +// Common::String pattern = target; +// pattern += "-??.SAV"; +// +// filenames = saveFileMan->listSavefiles(pattern); +// sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) +// +// SaveStateList saveList; +// char slot[3]; +// int slotNum = 0; +// for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { +// slot[0] = filename->c_str()[filename->size() - 6]; +// slot[1] = filename->c_str()[filename->size() - 5]; +// slot[2] = '\0'; +// // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot +// slotNum = atoi(slot); +// if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { +// Common::InSaveFile *file = saveFileMan->openForLoading(*filename); +// if (file) { +// int saveVersion = file->readByte(); +// +// if (saveVersion != kSavegameVersion) { +// warning("Savegame of incompatible version"); +// delete file; +// continue; +// } +// +// // read name +// uint16 nameSize = file->readUint16BE(); +// if (nameSize >= 255) { +// delete file; +// continue; +// } +// char name[256]; +// file->read(name, nameSize); +// name[nameSize] = 0; +// +// saveList.push_back(SaveStateDescriptor(slotNum, name)); +// delete file; +// } +// } +// } +// +// return saveList; +//} +// +//SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { +// Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); +// Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); +// +// if (file) { +// int saveVersion = file->readByte(); +// +// if (saveVersion != kSavegameVersion) { +// warning("Savegame of incompatible version"); +// delete file; +// return SaveStateDescriptor(); +// } +// +// uint32 saveNameLength = file->readUint16BE(); +// char saveName[256]; +// file->read(saveName, saveNameLength); +// saveName[saveNameLength] = 0; +// +// SaveStateDescriptor desc(slot, saveName); +// +// Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); +// desc.setThumbnail(thumbnail); +// +// desc.setDeletableFlag(true); +// desc.setWriteProtectedFlag(false); +// +// uint32 saveDate = file->readUint32BE(); +// uint16 saveTime = file->readUint16BE(); +// +// int day = (saveDate >> 24) & 0xFF; +// int month = (saveDate >> 16) & 0xFF; +// int year = saveDate & 0xFFFF; +// +// desc.setSaveDate(year, month, day); +// +// int hour = (saveTime >> 8) & 0xFF; +// int minutes = saveTime & 0xFF; +// +// desc.setSaveTime(hour, minutes); +// +// // Slot 0 is used for the 'restart game' save in all Avalanche games, thus +// // we prevent it from being deleted. +// desc.setDeletableFlag(slot != 0); +// desc.setWriteProtectedFlag(slot == 0); +// +// delete file; +// return desc; +// } +// return SaveStateDescriptor(); +//} +// +//void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { +// Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); +// g_system->getSavefileManager()->removeSavefile(fileName); +//} } // End of namespace Avalanche @@ -214,10 +222,10 @@ REGISTER_PLUGIN_DYNAMIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaE REGISTER_PLUGIN_STATIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); #endif -namespace Avalanche { - -void AvalancheEngine::initGame(const ADGameDescription *gd) { - _platform = gd->platform; -} - -} // End of namespace Avalanche +//namespace Avalanche { +// +//void AvalancheEngine::initGame(const ADGameDescription *gd) { +// _platform = gd->platform; +//} +// +//} // End of namespace Avalanche From b2f62278b6652b86d187942cfd8f5cccc36b225b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 08:34:48 +0200 Subject: [PATCH 0015/1332] AVALANCHE: Remove some functions from detection. --- engines/avalanche/detection.cpp | 129 +------------------------------- 1 file changed, 1 insertion(+), 128 deletions(-) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 10d23bbb7e81..1fc13bc57135 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -83,137 +83,18 @@ class AvalancheMetaEngine : public AdvancedMetaEngine { bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; bool hasFeature(MetaEngineFeature f) const; - - /*int getMaximumSaveSlot() const; - SaveStateList listSaves(const char *target) const; - SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; - void removeSaveState(const char *target, int slot) const;*/ }; bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { - if (gd) /*{*/ + if (gd) *engine = new AvalancheEngine(syst, (const AvalancheGameDescription *)gd); - /* ((AvalancheEngine *)*engine)->initGame((const ADGameDescription *)gd); - }*/ return gd != 0; } bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { return false; - /*(f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate);*/ } -//int AvalancheMetaEngine::getMaximumSaveSlot() const { return 99; } -// -//SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { -// Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); -// Common::StringArray filenames; -// Common::String pattern = target; -// pattern += "-??.SAV"; -// -// filenames = saveFileMan->listSavefiles(pattern); -// sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) -// -// SaveStateList saveList; -// char slot[3]; -// int slotNum = 0; -// for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { -// slot[0] = filename->c_str()[filename->size() - 6]; -// slot[1] = filename->c_str()[filename->size() - 5]; -// slot[2] = '\0'; -// // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot -// slotNum = atoi(slot); -// if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { -// Common::InSaveFile *file = saveFileMan->openForLoading(*filename); -// if (file) { -// int saveVersion = file->readByte(); -// -// if (saveVersion != kSavegameVersion) { -// warning("Savegame of incompatible version"); -// delete file; -// continue; -// } -// -// // read name -// uint16 nameSize = file->readUint16BE(); -// if (nameSize >= 255) { -// delete file; -// continue; -// } -// char name[256]; -// file->read(name, nameSize); -// name[nameSize] = 0; -// -// saveList.push_back(SaveStateDescriptor(slotNum, name)); -// delete file; -// } -// } -// } -// -// return saveList; -//} -// -//SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { -// Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); -// Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); -// -// if (file) { -// int saveVersion = file->readByte(); -// -// if (saveVersion != kSavegameVersion) { -// warning("Savegame of incompatible version"); -// delete file; -// return SaveStateDescriptor(); -// } -// -// uint32 saveNameLength = file->readUint16BE(); -// char saveName[256]; -// file->read(saveName, saveNameLength); -// saveName[saveNameLength] = 0; -// -// SaveStateDescriptor desc(slot, saveName); -// -// Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); -// desc.setThumbnail(thumbnail); -// -// desc.setDeletableFlag(true); -// desc.setWriteProtectedFlag(false); -// -// uint32 saveDate = file->readUint32BE(); -// uint16 saveTime = file->readUint16BE(); -// -// int day = (saveDate >> 24) & 0xFF; -// int month = (saveDate >> 16) & 0xFF; -// int year = saveDate & 0xFFFF; -// -// desc.setSaveDate(year, month, day); -// -// int hour = (saveTime >> 8) & 0xFF; -// int minutes = saveTime & 0xFF; -// -// desc.setSaveTime(hour, minutes); -// -// // Slot 0 is used for the 'restart game' save in all Avalanche games, thus -// // we prevent it from being deleted. -// desc.setDeletableFlag(slot != 0); -// desc.setWriteProtectedFlag(slot == 0); -// -// delete file; -// return desc; -// } -// return SaveStateDescriptor(); -//} -// -//void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { -// Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); -// g_system->getSavefileManager()->removeSavefile(fileName); -//} - } // End of namespace Avalanche #if PLUGIN_ENABLED_DYNAMIC(AVALANCHE) @@ -221,11 +102,3 @@ REGISTER_PLUGIN_DYNAMIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaE #else REGISTER_PLUGIN_STATIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); #endif - -//namespace Avalanche { -// -//void AvalancheEngine::initGame(const ADGameDescription *gd) { -// _platform = gd->platform; -//} -// -//} // End of namespace Avalanche From 1453413d24c344a6c55a5d5d324e200ccb68b6d2 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 09:40:25 +0200 Subject: [PATCH 0016/1332] AVALANCHE: Fix detection. --- engines/avalanche/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 1fc13bc57135..701f12be99e7 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -47,13 +47,13 @@ const char *AvalancheEngine::getGameId() const { } static const PlainGameDescriptor avalancheGames[] = { - {"avalot", "Lord Avalot d'Argent"}, + {"avalanche", "Lord Avalot d'Argent"}, {0, 0} }; static const ADGameDescription gameDescriptions[] = { { - "Avalanche", 0, + "avalanche", 0, { {"avalot.sez", 0, "de10eb353228013da3d3297784f81ff9", 48763}, {"mainmenu.avd", 0, "89f31211af579a872045b175cc264298", 18880}, From a33797b2728bed7a381bbecc55dd2f45710ea36d Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 10:58:39 +0200 Subject: [PATCH 0017/1332] AVALANCHE: Partially implement run_avalot(). --- engines/avalanche/avalanche.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f66e293aed0d..80c2ffc838a2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -39,6 +39,13 @@ namespace Avalanche { + void avalot(bool firstTime, Common::String arguments) { + warning("STUB: avalot()"); // That will be a class made from avalot9.cpp !!! - or something like that + } + + + + AvalancheEngine *AvalancheEngine::s_Engine = 0; AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { @@ -115,21 +122,25 @@ namespace Avalanche { warning("STUB: explain()"); } + + + //TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) + void AvalancheEngine::b_flight() { /*interrupt;*/ _storage.skellern++; } void AvalancheEngine::bflight_on() { _storage.skellern = _reset_; - warning("STUB: bflight_on()"); // setintvec(0x1c, &b_flight); } void AvalancheEngine::bflight_off() { - warning("STUB: bflight_off()"); // setintvec(0x1c, old_1c); } + + Common::String AvalancheEngine::elm2str(elm how) { Common::String elm2str_result; switch (how) { @@ -153,7 +164,11 @@ namespace Avalanche { } void AvalancheEngine::run_avalot() { - warning("STUB: run_avalot()"); + bflight_on(); + + avalot(first_time, arguments); // TODO: Check if parameteres are ever use and eventually remove them + // If there's an error initalizing avalot, i'll handle it in there, not here + first_time = false; } void AvalancheEngine::run_the_demo() { From fa10b10ec75b4916a96b0f82c6927befbc6c0f38 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 12:47:44 +0200 Subject: [PATCH 0018/1332] AVALANCHE: Keep the functions connected to command line arguments and the main menu for later. Minimal cosmetic modifications in the order of the functions. --- engines/avalanche/avalanche.cpp | 36 ++++++++++++++++++++++----------- engines/avalanche/avalanche.h | 15 +++++++------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 80c2ffc838a2..d8a43ba2adf1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -39,7 +39,7 @@ namespace Avalanche { - void avalot(bool firstTime, Common::String arguments) { + void avalot(Common::String arg) { warning("STUB: avalot()"); // That will be a class made from avalot9.cpp !!! - or something like that } @@ -96,6 +96,8 @@ namespace Avalanche { // From Bootstrp: + const char AvalancheEngine::runcodes[2][3] = {"et", "Go"}; + void AvalancheEngine::cursor_off() { warning("STUB: cursor_off()"); } @@ -163,10 +165,25 @@ namespace Avalanche { // Probably there'll be no need of this function, as all *.AVX-es will become classes. } + void AvalancheEngine::get_arguments() { + // This function should mess around with command line arguments, + // but I am not sure if there'll be use of these arguments at all... + warning("STUB: get_arguments()"); + } + + void AvalancheEngine::get_slope() { + // Same as get_arguments() + warning("STUB: get_slope()"); + } + + void AvalancheEngine::call_menu() { + warning("STUB: call_menu()"); + } + void AvalancheEngine::run_avalot() { bflight_on(); - avalot(first_time, arguments); // TODO: Check if parameteres are ever use and eventually remove them + avalot(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them // If there's an error initalizing avalot, i'll handle it in there, not here first_time = false; } @@ -175,10 +192,6 @@ namespace Avalanche { warning("STUB: run_the_demo()"); } - void AvalancheEngine::get_arguments() { - warning("STUB: get_arguments()"); - } - void AvalancheEngine::dos_shell() { warning("STUB: dos_shell()"); } @@ -196,13 +209,9 @@ namespace Avalanche { warning("STUB: demo()"); } - void AvalancheEngine::call_menu() { - warning("STUB: call_menu()"); - } + + - void AvalancheEngine::get_slope() { - warning("STUB: get_slope()"); - } @@ -223,6 +232,9 @@ namespace Avalanche { get_arguments(); get_slope(); + zoomy = false; + // Call the menu by default. Might be modified later, if get_slope() gets implemented, + // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. if (! zoomy) call_menu(); /* Not run when zoomy. */ do { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 6837ea5aa7b2..e6148be7805a 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -85,6 +85,8 @@ class AvalancheEngine : public Engine { static const int16 _runShootemup = 1, _runDosshell = 2, _runGhostroom = 3, _runGolden = 4; + static const char runcodes[2][3]; + static const int16 _reset_ = 0; static const bool _jsb = true, _no_jsb = false, _bflight = true, _no_bflight = false; @@ -130,12 +132,16 @@ class AvalancheEngine : public Engine { void run(Common::String what, bool with_jsb, bool with_bflight, elm how); + void get_arguments(); + + void get_slope(); + + void call_menu(); + void run_avalot(); void run_the_demo(); - void get_arguments(); - void dos_shell(); bool keypressed1(); @@ -143,11 +149,6 @@ class AvalancheEngine : public Engine { void flush_buffer(); void demo(); - - void call_menu(); - - void get_slope(); - }; } // End of namespace Avalanche From 3946d0ed929069de3740c03180274e2db0555422 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Jun 2013 14:08:58 +0200 Subject: [PATCH 0019/1332] AVALANCHE: Add class Avalot. Cosmetic modifications. --- engines/avalanche/avalanche.cpp | 50 +++++++++++++++------------------ engines/avalanche/avalanche.h | 3 +- engines/avalanche/avalot.cpp | 41 +++++++++++++++++++++++++++ engines/avalanche/avalot.h | 46 ++++++++++++++++++++++++++++++ engines/avalanche/module.mk | 1 + 5 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 engines/avalanche/avalot.cpp create mode 100644 engines/avalanche/avalot.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d8a43ba2adf1..6e57663d87e5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -25,6 +25,9 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +#include "avalanche/avalanche.h" +#include "avalanche/avalot.h" + #include "common/system.h" #include "common/random.h" #include "common/error.h" @@ -33,19 +36,10 @@ #include "common/config-manager.h" #include "common/textconsole.h" -#include "avalanche/avalanche.h" - #include "engines/util.h" namespace Avalanche { - void avalot(Common::String arg) { - warning("STUB: avalot()"); // That will be a class made from avalot9.cpp !!! - or something like that - } - - - - AvalancheEngine *AvalancheEngine::s_Engine = 0; AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { @@ -98,6 +92,10 @@ namespace Avalanche { const char AvalancheEngine::runcodes[2][3] = {"et", "Go"}; + + + // The original ones were all commented out, so porbably there's no need + // of these two cursor functions at all. TODO: Remove later. void AvalancheEngine::cursor_off() { warning("STUB: cursor_off()"); } @@ -106,6 +104,7 @@ namespace Avalanche { warning("STUB: cursor_on()"); } + // Needed later. void AvalancheEngine::quit() { cursor_on(); } @@ -115,11 +114,13 @@ namespace Avalanche { return q; } + // Needed in dos_shell(). TODO: Remove later. Common::String AvalancheEngine::command_com() { warning("STUB: command_com()"); return ("STUB: command_com()"); } + // Needed for run_avalot()'s errors. TODO: Remove later. void AvalancheEngine::explain(byte error) { warning("STUB: explain()"); } @@ -180,14 +181,6 @@ namespace Avalanche { warning("STUB: call_menu()"); } - void AvalancheEngine::run_avalot() { - bflight_on(); - - avalot(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them - // If there's an error initalizing avalot, i'll handle it in there, not here - first_time = false; - } - void AvalancheEngine::run_the_demo() { warning("STUB: run_the_demo()"); } @@ -196,22 +189,33 @@ namespace Avalanche { warning("STUB: dos_shell()"); } - bool AvalancheEngine::keypressed1() { + // Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. + bool AvalancheEngine::keypressed1() { warning("STUB: keypressed1()"); return false; } + // Same as keypressed1(). void AvalancheEngine::flush_buffer() { warning("STUB: flush_buffer()"); } + // Same as keypressed1(). void AvalancheEngine::demo() { warning("STUB: demo()"); } - + + void AvalancheEngine::run_avalot() { + bflight_on(); + + Avalot ava; + ava.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them + // If there's an error initalizing avalot, i'll handle it in there, not here + first_time = false; + } @@ -224,9 +228,6 @@ namespace Avalanche { // From bootstrp: - /*original_mode = mem[seg0040 * 0x49]; - getintvec(0x1c, old_1c);*/ - first_time = true; get_arguments(); @@ -261,11 +262,6 @@ namespace Avalanche { - // _mouse = new MouseHandler(this); - - // Setup mixer - syncSoundSettings(); - return Common::kNoError; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e6148be7805a..fa87d8b60a42 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -28,8 +28,9 @@ #ifndef AVALANCHE_H #define AVALANCHE_H -#include "engines/engine.h" #include "avalanche/console.h" + +#include "engines/engine.h" #include "engines/advancedDetector.h" namespace Common { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp new file mode 100644 index 000000000000..e89fbe1dbbe0 --- /dev/null +++ b/engines/avalanche/avalot.cpp @@ -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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "common/str.h" +#include "common/textconsole.h" + +#include "avalanche/avalot.h" + +namespace Avalanche { + + Avalot::Avalot() {} + + void Avalot::run(Common::String arg) { + warning("STUB: Avalot::run()"); + } + +} // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h new file mode 100644 index 000000000000..84c96b4f6e67 --- /dev/null +++ b/engines/avalanche/avalot.h @@ -0,0 +1,46 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef AVALOT_H +#define AVALOT_H + +#include "common/str.h" + +namespace Avalanche { + +class Avalot { +private: + +public: + Avalot(); + + void run(Common::String arg); +}; + +} // End of namespace Avalanche + +#endif // AVALOT_H diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 4db7160d6840..8a83129a7df9 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -2,6 +2,7 @@ MODULE := engines/avalanche MODULE_OBJS = \ avalanche.o \ + avalot.o \ console.o \ detection.o From 6d35a794cdb3466fb230ec5d0d87a86773978262 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 21 Jun 2013 11:23:11 +0200 Subject: [PATCH 0020/1332] AVALANCHE: Getting GYRO to compile. --- engines/avalanche/avalanche.cpp | 3 +- engines/avalanche/avalot.cpp | 3 + engines/avalanche/avalot.h | 2 +- engines/avalanche/gyro2.cpp | 38 ++ engines/avalanche/gyro2.h | 841 ++++++++++++++++++++++++++++++++ engines/avalanche/module.mk | 3 +- 6 files changed, 887 insertions(+), 3 deletions(-) create mode 100644 engines/avalanche/gyro2.cpp create mode 100644 engines/avalanche/gyro2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6e57663d87e5..c644b30028cd 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -236,7 +236,8 @@ namespace Avalanche { zoomy = false; // Call the menu by default. Might be modified later, if get_slope() gets implemented, // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. - if (! zoomy) call_menu(); /* Not run when zoomy. */ + if (! zoomy) + call_menu(); /* Not run when zoomy. */ do { run_avalot(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e89fbe1dbbe0..337f896db9e6 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -35,6 +35,9 @@ namespace Avalanche { Avalot::Avalot() {} void Avalot::run(Common::String arg) { + + + warning("STUB: Avalot::run()"); } diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 84c96b4f6e67..596fc023bccb 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -28,7 +28,7 @@ #ifndef AVALOT_H #define AVALOT_H -#include "common/str.h" +#include "common/system.h" namespace Avalanche { diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp new file mode 100644 index 000000000000..b44cbee68fc4 --- /dev/null +++ b/engines/avalanche/gyro2.cpp @@ -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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/gyro2.h" + +namespace Avalanche { + + namespace Gyro { + + + + } // End of namespace Gyro + +} // End of namespace Avalanche diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h new file mode 100644 index 000000000000..b9f46f54cb70 --- /dev/null +++ b/engines/avalanche/gyro2.h @@ -0,0 +1,841 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef GYRO2_H +#define GYRO2_H + +#include "common/system.h" +#include "common/str.h" +#include "common/scummsys.h" + +namespace Avalanche { + + namespace Gyro { + + ///////////////////////////// CONSTANTS ///////////////////////////// + + const char numobjs = 18; /* always preface with a # */ + const int16 maxobjs = 12; /* carry limit */ + const byte howlong = 1/*8*/; /* 18 ticks. */ + + const bool oncandopageswap = true; + /* Variable constant for overriding the ability of On to switch pages. + * You may know better than On which page to switch to. */ + + const int16 num = 32; /* Code for Num Lock */ + + const int16 mouse_size = 134; + + + + ///////////////////////////// TYPEDEFS ///////////////////////////// + + typedef void(*proc)(); + + struct postype { + uint16 x, y, datapos; + byte length; + }; + + struct mp { /* mouse-void **/ + uint16 mask[2][16]; + int16 horzhotspot, verthotspot; + }; + + struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ + byte rw; /* Realway- just for convenience! */ + byte carrying; /* how many objects you're carrying... */ + bool obj[numobjs]; /* ...and which ones they are. */ + int16 score; /* your score, of course */ + int32 pence; /* your current amount of dosh */ + byte room; /* your current room */ + char wearing; /* what you're wearing */ + byte swore; /* number of times you've sworn */ + byte saves; /* number of times this game has been saved */ + byte rooms[100]; /* Add one to each every time + you enter a room */ + byte alcohol; /* Your blood alcohol level. */ + byte playednim; /* How many times you've played Nim. */ + bool wonnim; /* Have you *won* Nim? (That's harder.) */ + byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ + bool cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ + + byte pass_num; /* Number of the passuint16 for this game. */ + bool ayles_is_awake; /* pretty obvious! */ + byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ + byte avaricius_talk; /* How much Avaricius has said to you. */ + bool bought_onion; /* Have you bought an onion yet? */ + bool rotten_onion; /* And has it rotted? */ + bool onion_in_vinegar; /* Is the onion in the vinegar? */ + + byte given2spludwick; /* 0 = nothing given, 1 = onion... */ + byte brummie_stairs; /* Progression through the stairs trick. */ + byte cardiff_things; /* Things you get asked in Cardiff. */ + + bool cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ + + bool avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ + bool avvy_in_bed; /* True if Avvy's in bed, but awake. */ + + bool user_moves_avvy; /* If this is false, the user has no + control over Avvy's movements. */ + + byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ + + bool givenbadgetoiby; /* Have you given the badge to Iby yet? */ + + bool friar_will_tie_you_up; /* If you're going to get tied up. */ + bool tied_up; /* You ARE tied up! */ + + char box_contents; /* 0 = money (sixpence), 254 = empty, any + other number implies the contents of the box. */ + + bool talked_to_crapulus; /* Pretty self-explanatory. */ + + byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ + + bool ringing_bells; /* Is Jacques ringing the bells? */ + + bool standing_on_dais; /* In room 71, inside Cardiff Castle. */ + bool taken_pen; /* Have you taken the pen (in Cardiff?) */ + bool arrow_triggered; /* And has the arrow been triggered? */ + bool arrow_in_the_door; /* Did the arrow hit the wall? */ + + Common::String like2drink, + favourite_song, + worst_place_on_earth, + spare_evening; /* Personalisation str's */ + + int32 total_time; /* Your total time playing this game, in ticks.*/ + + byte jumpstatus; /* Fixes how high you're jumping. */ + + bool mushroom_growing; /* Is the mushroom growing in 42? */ + + bool spludwicks_here; /* Is Spludwick at home? */ + + byte last_room; + byte last_room_not_map; + + bool crapulus_will_tell; /* Will Crapulus tell you about + Spludwick being away? */ + + bool enter_catacombs_from_lusties_room; + bool teetotal; /* Are we touching any more drinks? */ + byte malagauche; /* Position of Malagauche. See Celer for more info. */ + char drinking; /* What's he getting you? */ + + bool entered_lusties_room_as_monk; + + byte cat_x, cat_y; /* XY coords in the catacombs. */ + + bool avvys_in_the_cupboard; /* On screen 22. */ + + bool geida_follows; /* Is Geida following you? */ + + byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ + + byte nextbell; /* For the ringing. */ + + bool geida_given_potion; /* Does Geida have the potion? */ + bool lustie_is_asleep; /* Is BDL asleep? */ + + byte flip_to_where, flip_to_ped; /* For the sequencer. */ + + bool been_tied_up; /* In r__Robins. */ + + bool sitting_in_pub; /* Are you sitting down in the pub? */ + byte spurge_talk; /* Count for talking to Spurge. */ + + bool met_avaroid; + + bool taken_mushroom, + given_pen_to_ayles, + asked_dogfood_about_nim; + }; + + struct pedtype { + int16 x, y; + byte dir; + }; + + struct magictype { + byte op; /* one of the operations */ + uint16 data; /* data for them */ + }; + + class fieldtype { + public: + int16 x1, y1, x2, y2; + }; + + struct bytefield { + byte x1, y1, x2, y2; + }; + + class linetype : public fieldtype { + public: + byte col; + }; + + struct adxtype { + Common::String name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + uint16 size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + }; + + typedef byte raw[256][16]; /* raw_font_type */ + + enum controllers {cjoy, ckey}; + + typedef Common::String previoustype[20]; + + struct corridor_type { /* Decarations for the corridors. */ + uint16 doors; /* Door styles are calc'ed from this uint16. + Assign a different number to each one! */ + }; + + struct demo_type { + uint16 delay; + char key, extd; + }; + + struct quasiped_type { + byte whichped, fgc, room, bgc; + char who; + }; + /* A quasiped defines how people who aren't sprites talk. For example, + quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving + that to context. */ + + typedef byte tunetype[31]; + + struct vmctype { /* Virtual Mouse Cursor */ + void *andpic, *xorpic; + void *backpic[2]; + void* wherewas[2]; + byte picnumber; + int8 ofsx, ofsy; + }; + + struct sundry { + /* Things which must be saved over a backtobootstrap, + outside DNA. */ + Common::String qenid_filename; + bool qsoundfx; + char qthinks; + bool qthinkthing; + }; + + struct joysetup { + uint16 xmid, ymid, xmin, ymin, xmax, ymax; + byte centre; /* Size of centre in tenths */ + }; + + struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + char id[9]; /* signature */ + uint16 revision; /* EDNA revision, here 2 (1=dna256) */ + Common::String game; /* Long name, eg Lord Avalot D'Argent */ + Common::String shortname; /* Short name, eg Avalot */ + uint16 number; /* Game's code number, here 2 */ + uint16 ver; /* Version number as int16 (eg 1.00 = 100) */ + Common::String verstr; /* Vernum as Common::String (eg 1.00 = "1.00" */ + Common::String filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + Common::String os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + Common::String fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + uint16 y; /* ...saved on. */ + Common::String desc; /* Description of game (same as in Avaricius!) */ + uint16 len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + uint16 saves; /* no. of times this game has been saved */ + int16 cash; /* contents of your wallet in numerical form */ + Common::String money; /* ditto in Common::String form (eg 5/-, or 1 denarius)*/ + uint16 points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ + }; + + /* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST + 7 = Archimedes */ + + + + ///////////////////////////// CONSTANTS ///////////////////////////// + + const char vernum[] = "1.30"; + const char copyright[] = "1995"; + const int16 thisvercode = 130; + /* as "vernum", but numerically & without the ".". */ + const int16 thisgamecode = 2; /* Avalot's code number */ + + /* Objects you can hold: */ + const char wine = 1; + const char money = 2; + const char bodkin = 3; + const char potion = 4; + const char chastity = 5; + const char bolt = 6; + const char crossbow = 7; + const char lute = 10; + const char badge = 11; + const char mushroom = 12; + const char key = 13; + const char bell = 14; + const char prescription = 15; + const char pen = 16; + const char ink = 17; + const char clothes = 20; + const char habit = 21; + const char onion = 22; + + /* People who hang around this game. */ + + /* Boys: */ + const uint16 pavalot = 226; + const uint16 pspludwick = 227; + const uint16 pcrapulus = 230; + const uint16 pdrduck = 231; + const uint16 pmalagauche = 232; + const uint16 pfriartuck = 233; + const uint16 probinhood = 234; + const uint16 pcwytalot = 235; + const uint16 pdulustie = 236; + const uint16 pduke = 237; + const uint16 pdogfood = 240; + const uint16 ptrader = 241; + const uint16 pibythneth = 242; + const uint16 payles = 243; + const uint16 pport = 244; + const uint16 pspurge = 245; + const uint16 pjacques = 246; + + /* Girls: */ + const uint16 parkata = 257; + const uint16 pgeida = 260; + const uint16 pwisewoman = 262; + + const int16 xw = 30; + const int16 yw = 36; /* x width & y whatsit */ + + const int16 margin = 5; + + const mp mps[9] = { + { + /* 1 - up-arrow */ + { {65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}, + {0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0} + }, + 8, + 0 + }, + + { + /* 2 - screwdriver */ + { {8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}, + {0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0} + + }, + 0, + 0 + }, + + { + /* 3 - right-arrow */ + { {65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}, + {0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0} + }, + 15, + 6 + }, + + { + /* 4 - fletch */ + { {255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}, + {0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0} + }, + 0, + 0 + }, + + { + /* 5 - hourglass */ + { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, + {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} + }, + 8, + 7 + }, + + { + /* 6 - TTHand */ + { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, + {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} + }, + 4, + 0 + }, + + { + /* 7- Mark's crosshairs */ + { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, + {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} + }, + 8, + 5 + }, + + { + /* 8- I-beam. */ + { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, + {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} + }, + 8, + 7 + }, + + { + /* 9- Question mark. */ + { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, + {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} + }, + 0, + 0 + } + + }; + + const Common::String lads[17] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", + "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", + "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + }; + + const Common::String lasses[4] = + {"Arkata", "Geida", "", "the Wise Woman"}; + + const char ladchar[] = "ASCDMTRwLfgeIyPu"; + + const char lasschar[] = "kGo"; + + const int16 numtr = 2; /* current max no. of sprites */ + + const bool a_thing = true; + const bool a_person = false; /* for Thinkabout */ + + /* Magic/portal commands are */ + + /*N*/ const int16 nix = 0; /* ignore it if this line is touched */ + /*B*/ const int16 bounces = 1; /* bounce off this line. Not valid for portals. */ + /*E*/ const int16 exclaim = 2; /* put up a chain of scrolls */ + /*T*/ const int16 transport = 3; /* enter new room */ + /*U*/ const int16 unfinished = 4; /* unfinished connection */ + /*S*/ const int16 special = 5; /* special function. */ + /*O*/ const int16 mopendoor = 6; /* opening door. */ + + /* These following constants should be included in CFG when it's written. */ + + const bool slow_computer = false; /* stops walking when mouse touches toolbar */ + + /* --- */ + + const int16 border = 1; /* size of border on shadowboxes */ + + const int32 pagetop = 81920; + + const int16 up = 0; + const int16 right = 1; + const int16 down = 2; + const int16 left = 3; + const int16 ur = 4; + const int16 dr = 5; + const int16 dl = 6; + const int16 ul = 7; + const int16 stopped = 8; + + const int16 walk = 3; + const int16 run = 5; + + + // Deal with it later !!!!!!! + // + ///*$I ROOMNUMS.INC - Room number constants (r__xxx) */ + + //const byte whereis[29] = + // /* The Lads */ + //{ { + // r__yours, /* Avvy */ + // r__spludwicks, /* Spludwick */ + // r__outsideyours, /* Crapulus */ + // r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + // r__argentpub, /* Malagauche */ + // r__robins, /* Friar Tuck. */ + // 177, /* Robin Hood - can't meet him at the start. */ + // r__brummieroad, /* Cwytalot */ + // r__lustiesroom, /* Baron du Lustie. */ + // r__outsidecardiffcastle, /* The Duke of Cardiff. */ + // r__argentpub, /* Dogfood */ + // r__outsideducks, /* Trader */ + // r__argentpub, /* Ibythneth */ + // r__aylesoffice, /* Ayles */ + // r__nottspub, /* Port */ + // r__nottspub, /* Spurge */ + // r__musicroom, /* Jacques */ + // 0, 0, 0, 0, 0, 0, 0, 0, + // /* The Lasses */ + // r__yours, /* Arkata */ + // r__geidas, /* Geida */ + // 177, /* nobody allocated here! */ + // r__wisewomans + // } + //}; /* The Wise Woman. */ + + /* Art gallery at 2,1; notice about this at 2,2. */ + + const int32 catamap[8][8] = { + /* Geida's room */ + /* 1 2 3 | 4 5 6 7 8*/ + {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, + {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, + {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, /* >> Oubliette */ + {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, + {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, /* <<< In here */ + {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} + }; + /* vv Stairs trap. */ + + /* Explanation: $NSEW. + Nibble N: North. + 0 = no connection, + 2 = (left,) middle(, right) door with left-hand handle, + 5 = (left,) middle(, right) door with right-hand handle, + 7 = arch, + 8 = arch and 1 north of it, + 9 = arch and 2 north of it, + D = no connection + WINDOW, + E = no connection + TORCH, + F = recessed door (to Geida's room.) + + Nibble S: South. + 0 = no connection, + 1,2,3 = left, middle, right door. + + Nibble E: East. + 0 = no connection (wall), + 1 = no connection (wall + window), + 2 = wall with door, + 3 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. + + Nibble W: West. + 0 = no connection (wall), + 1 = no connection (wall + shield), + 2 = wall with door, + 3 = wall with door and shield, + 4 = no connection (window), + 5 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. */ + + const byte interrogation = 0; + /* If this is greater than zero, the next line you type is stored in + the DNA in a position dictated by the value. If a scroll comes up, + or you leave the room, it's automatically set to zero. */ + + const bool demo = false; /* If this is true, we're in a demo of the game. */ + + const char spludwick_order[3] = {onion, ink, mushroom}; + + + //I need color constants here, like in CRT unit. + // + //const quasiped_type quasipeds[16] = { + // { {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ + // {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ + // {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ + // {3, black, 23, red, '\261'}, /* D: Hawk (screen 23). */ + // {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ + // {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ + // {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ + // {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ + // {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ + // {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ + // {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ + // {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ + // {3, white, 27, red, '\261'}, /* M: Avaroid (screen 27). */ + // {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ + // {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ + // {2, lightgreen, 51, darkgray, pdrduck} + // } + //}; /*P: Duck (screen 51). */ + + const int16 lower = 0; + const int16 same = 1; + const int16 higher = 2; + + const char keys[] = "QWERTYUIOP[]"; + const uint16 notes[12] = + {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; + + const tunetype tune = { + higher, higher, lower, same, higher, higher, lower, higher, higher, higher, + lower, higher, higher, + same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, + lower, same, lower, higher, same, lower, higher + }; + + /* special run-time errors */ + + const int16 runerr_getset_overflow = 50; + + + ///////////////////////////// VARIABLES ///////////////////////////// + + Common::String current; + byte curpos; + bool cursoron; + /* previous:^previoustype;*/ + Common::String last; + dnatype dna; + linetype lines[50]; /* For Also. */ + int16 c; + //registers r; // http://www.freepascal.org/docs-html/rtl/dos/registers.html + enum { m_no , m_yes , m_virtual } visible; + bool dropsok, screturn, soundfx, cheat; + uint16 mx, my; /* mouse x & y now */ + uint16 mpx, mpy; /* mouse x & y when pressed */ + uint16 mrx, mry; /* mouse x & y when released */ + byte mpress, mrelease; /* times left mouse button has been pressed/released */ + byte keystatus; /* Mouse key status */ + Common::String un[10]; + byte unn; + Common::String mousetext; + /* which:array[0..5] of byte;*/ + void *p; + bool weirduint16; + byte to_do; + bool lmo, mousemade; + Common::String scroll[15]; + byte scrolln, score, whichwas; + char thinks; + bool thinkthing; + + /* pp:array[1..1000] of postype; + bb:array[1..9000] of byte;*/ + uint16 pptr, bptr; + int16 ppos[1][2]; + uint16 pozzes[24]; + byte anim; + void *copier; + int16 talkx, talky; + byte talkb, talkf; + byte scrollbells; /* no. of times to ring the bell */ + bool ontoolbar, seescroll; + + char objlist[10]; + void * digit[10]; + void *rwlite[9]; + byte oldrw; + Common::String lastscore; + byte cmp; /* current mouse-void **/ + Common::String verbstr; /* what you can do with your object. :-) */ + + Common::String * also[31][2]; + pedtype peds[15]; + magictype magics[15]; + magictype portals[7]; + fieldtype fields[30]; + byte numfields; + Common::String flags; + Common::String listen; + + uint16 oh, onh, om, h, m, s, s1; + + Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ + + byte cp, ledstatus, defaultled; + raw little; + bool quote; /* 66 or 99 next? */ + bool alive; + char buffer[2000]; + uint16 bufsize; + + byte oldjw; /* Old joystick-way */ + controllers ctrl; + + int16 underscroll; /* Y-coord of just under the scroll text. */ + + /* TSkellern is only temporary, and I'll replace it + with a local version when it's all fixed up. */ + + /* tskellern:int32 absolute $0:244; { Over int $61 }*/ + + bool ddmnow; /* Kludge so we don't have to keep referring to Dropdown */ + Common::String roomname; /* Name of this room */ + + //text logfile; // http://wiki.freepascal.org/Text + bool logging, log_epson; + + bool cl_override; + + byte locks; /*ABSOLUTE $40:$17;*/ + + Common::String subject; /* What you're talking to them about. */ + byte subjnumber; /* The same thing. */ + + bool keyboardclick; /* Is a keyboard click noise wanted? */ + + char him, her, it; + int32 roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ + + bool after_the_scroll; + + /* For the demo: */ + demo_type demo_rec; + //file demofile; // http://www.freepascal.org/docs-html/ref/refsu21.html#x45-520003.3.4 + + char last_person; /* Last person to have been selected using the People + menu. */ + + bool doing_sprite_run; /* Only set to True if we're doing a sprite_run + at this moment. This stops the trippancy system from moving any of the + sprites. */ + + vmctype vmc; + Common::String filetoload; + + bool holdthedawn; /* If this is true, calling Dawn will do nothing. + It's used, for example, at the start, to stop Load from dawning. */ + + uint16 storage_seg, storage_ofs; /* Seg and ofs of the Storage area. */ + uint16 skellern; /* Offset of the timer variable - 1 more than storage_OFS */ + bool reloaded; /* Is this NOT the primary loading? */ + + bool super_was_virtual, super_was_off; /* Used by Super_Off and Super_On */ + + Common::String enid_filename; + + joysetup js; + uint16 cxmin, cxmax, cymin, cymax; + bool use_joy_a; + + + void newpointer(byte m); + + void wait(); /* makes hourglass */ + + void on(); + + void off(); + + void on_virtual(); + + void off_virtual(); + + void xycheck(); + + void hopto(int16 x, int16 y); /* Moves mouse void *to x,y */ + + void check(); + + void note(uint16 hertz); + + void blip(); + + Common::String strf(int32 x); + + void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); + + void newgame(); + + void click(); + + void slowdown(); + + bool flagset(char x); + + void force_numlock(); + + bool pennycheck(uint16 howmuchby); + + Common::String getname(char whose); + + char getnamechar(char whose); + + Common::String get_thing(char which); + + char get_thingchar(char which); + + Common::String get_better(char which); + + Common::String f5_does(); + + void plot_vmc(int16 xx, int16 yy, byte page_); + + void wipe_vmc(byte page_); + + void setup_vmc(); + + void clear_vmc(); + + void load_a_mouse(byte which); + + void background(byte x); + + void hang_around_for_a_while(); + + void super_off(); + + void super_on(); + + bool mouse_near_text(); + + + + } // End of namespace Gyro + +} // End of namespace Avalanche + +#endif // GYRO2_H diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 8a83129a7df9..5f65d010ed50 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -4,7 +4,8 @@ MODULE_OBJS = \ avalanche.o \ avalot.o \ console.o \ - detection.o + detection.o \ + gyro2.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) From 6317297b39b0632370fdffbdd257c0fc3d7b3ea6 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 21 Jun 2013 11:53:10 +0200 Subject: [PATCH 0021/1332] AVALANCHE: Implement ROOMNUMS.INC. --- engines/avalanche/gyro2.h | 60 +++++++++++------------ engines/avalanche/roomnums.h | 92 ++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 33 deletions(-) create mode 100644 engines/avalanche/roomnums.h diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index b9f46f54cb70..93b788043db8 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -31,6 +31,7 @@ #include "common/system.h" #include "common/str.h" #include "common/scummsys.h" +#include "avalanche/roomnums.h" namespace Avalanche { @@ -493,39 +494,32 @@ namespace Avalanche { const int16 walk = 3; const int16 run = 5; - - // Deal with it later !!!!!!! - // - ///*$I ROOMNUMS.INC - Room number constants (r__xxx) */ - - //const byte whereis[29] = - // /* The Lads */ - //{ { - // r__yours, /* Avvy */ - // r__spludwicks, /* Spludwick */ - // r__outsideyours, /* Crapulus */ - // r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - // r__argentpub, /* Malagauche */ - // r__robins, /* Friar Tuck. */ - // 177, /* Robin Hood - can't meet him at the start. */ - // r__brummieroad, /* Cwytalot */ - // r__lustiesroom, /* Baron du Lustie. */ - // r__outsidecardiffcastle, /* The Duke of Cardiff. */ - // r__argentpub, /* Dogfood */ - // r__outsideducks, /* Trader */ - // r__argentpub, /* Ibythneth */ - // r__aylesoffice, /* Ayles */ - // r__nottspub, /* Port */ - // r__nottspub, /* Spurge */ - // r__musicroom, /* Jacques */ - // 0, 0, 0, 0, 0, 0, 0, 0, - // /* The Lasses */ - // r__yours, /* Arkata */ - // r__geidas, /* Geida */ - // 177, /* nobody allocated here! */ - // r__wisewomans - // } - //}; /* The Wise Woman. */ + const byte whereis[29] = { + /* The Lads */ + r__yours, /* Avvy */ + r__spludwicks, /* Spludwick */ + r__outsideyours, /* Crapulus */ + r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + r__argentpub, /* Malagauche */ + r__robins, /* Friar Tuck. */ + 177, /* Robin Hood - can't meet him at the start. */ + r__brummieroad, /* Cwytalot */ + r__lustiesroom, /* Baron du Lustie. */ + r__outsidecardiffcastle, /* The Duke of Cardiff. */ + r__argentpub, /* Dogfood */ + r__outsideducks, /* Trader */ + r__argentpub, /* Ibythneth */ + r__aylesoffice, /* Ayles */ + r__nottspub, /* Port */ + r__nottspub, /* Spurge */ + r__musicroom, /* Jacques */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* The Lasses */ + r__yours, /* Arkata */ + r__geidas, /* Geida */ + 177, /* nobody allocated here! */ + r__wisewomans + }; /* The Wise Woman. */ /* Art gallery at 2,1; notice about this at 2,2. */ diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h new file mode 100644 index 000000000000..c16fd05fb4ed --- /dev/null +++ b/engines/avalanche/roomnums.h @@ -0,0 +1,92 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef ROOMNUMS_H +#define ROOMNUMS_H + +#include "common/system.h" + +namespace Avalanche { + + namespace Gyro { + + const byte r__nowhere = 0; + const byte r__yours = 1; + const byte r__outsideyours = 2; + /*{ a corridor in your castle. = 3 } + { outside your castle = 5; }*/ + const byte r__musicroom = 7; + const byte r__outsideargentpub = 9; + const byte r__argentroad = 10; + const byte r__wisewomans = 11; + const byte r__spludwicks = 12; + const byte r__insideabbey = 13; + const byte r__outsideabbey = 14; /*{ assumed }*/ + const byte r__avvysgarden = 15; + const byte r__aylesoffice = 16; + const byte r__argentpub = 19; + const byte r__brummieroad = 20; + const byte r__lusties = 21; /*{ ? not sure }*/ + const byte r__entrancehall = 22; + const byte r__lustiesroom = 23; + const byte r__westhall = 25; + const byte r__easthall = 26; + const byte r__oubliette = 27; + const byte r__geidas = 28; + const byte r__catacombs = 29; + + //{ -------------- } + + const byte r__bridge = 40; + const byte r__robins = 42; + const byte r__outsidenottspub = 46; + const byte r__nottspub = 47; + + //{ -------------- } + + const byte r__outsideducks = 50; + const byte r__ducks = 51; + + //{ -------------- } + + const byte r__outsidecardiffcastle = 70; + const byte r__insidecardiffcastle = 71; + + //{ -------------- } + + /*{ place80 appears to be bogus }*/ + + //{ -------------- } + + const byte r__bosskey = 98; /*{ assumed }*/ + const byte r__map = 99; + + } // End of namespace Gyro + +} // End of namespace Avalanche + +#endif // ROOMNUMS_H From 1ce5e3bc3ff9082e057475bb5cfbc15a212f43eb Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 21 Jun 2013 13:12:22 +0200 Subject: [PATCH 0022/1332] AVALANCHE: Add color.h to replace the color constants from the CRT unit of Pascal. --- engines/avalanche/color.h | 56 +++++++++++++++++++ engines/avalanche/gyro2.h | 45 +++++++-------- engines/avalanche/roomnums.h | 104 +++++++++++++++++------------------ 3 files changed, 127 insertions(+), 78 deletions(-) create mode 100644 engines/avalanche/color.h diff --git a/engines/avalanche/color.h b/engines/avalanche/color.h new file mode 100644 index 000000000000..1a8e69da839e --- /dev/null +++ b/engines/avalanche/color.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +// Color constants replacing the colors from the CRT unit of Pascal + +#ifndef COLOR_H +#define COLOR_H + +#include "common/system.h" + +namespace Avalanche { + +const byte black = 0; +const byte blue = 1; +const byte green = 2; +const byte cyan = 3; +const byte red = 4; +const byte magenta = 5; +const byte brown = 6; +const byte lightgray = 7; +const byte darkgray = 8; +const byte lightblue = 9; +const byte lightgreen = 10; +const byte lightcyan = 11; +const byte lightred = 12; +const byte lightmagenta = 13; +const byte yellow = 14; +const byte white = 15; + +} // End of namespace Avalanche + +#endif // COLOR_H diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 93b788043db8..db02bc27a520 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -32,6 +32,7 @@ #include "common/str.h" #include "common/scummsys.h" #include "avalanche/roomnums.h" +#include "avalanche/color.h" namespace Avalanche { @@ -230,7 +231,7 @@ namespace Avalanche { struct quasiped_type { byte whichped, fgc, room, bgc; - char who; + uint16 who; }; /* A quasiped defines how people who aren't sprites talk. For example, quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving @@ -581,29 +582,25 @@ namespace Avalanche { const bool demo = false; /* If this is true, we're in a demo of the game. */ const char spludwick_order[3] = {onion, ink, mushroom}; - - - //I need color constants here, like in CRT unit. - // - //const quasiped_type quasipeds[16] = { - // { {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ - // {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ - // {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ - // {3, black, 23, red, '\261'}, /* D: Hawk (screen 23). */ - // {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ - // {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ - // {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ - // {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ - // {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ - // {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ - // {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ - // {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ - // {3, white, 27, red, '\261'}, /* M: Avaroid (screen 27). */ - // {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ - // {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ - // {2, lightgreen, 51, darkgray, pdrduck} - // } - //}; /*P: Duck (screen 51). */ + + const quasiped_type quasipeds[16] = { + {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ + {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ + {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ + {3, black, 23, red, 177}, /* D: Hawk (screen 23). */ + {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ + {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ + {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ + {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ + {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ + {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ + {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ + {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ + {3, white, 27, red, 177}, /* M: Avaroid (screen 27). */ + {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ + {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ + {2, lightgreen, 51, darkgray, pdrduck} + }; /*P: Duck (screen 51). */ const int16 lower = 0; const int16 same = 1; diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index c16fd05fb4ed..3c5ee49a51c6 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -32,60 +32,56 @@ namespace Avalanche { - namespace Gyro { - - const byte r__nowhere = 0; - const byte r__yours = 1; - const byte r__outsideyours = 2; - /*{ a corridor in your castle. = 3 } - { outside your castle = 5; }*/ - const byte r__musicroom = 7; - const byte r__outsideargentpub = 9; - const byte r__argentroad = 10; - const byte r__wisewomans = 11; - const byte r__spludwicks = 12; - const byte r__insideabbey = 13; - const byte r__outsideabbey = 14; /*{ assumed }*/ - const byte r__avvysgarden = 15; - const byte r__aylesoffice = 16; - const byte r__argentpub = 19; - const byte r__brummieroad = 20; - const byte r__lusties = 21; /*{ ? not sure }*/ - const byte r__entrancehall = 22; - const byte r__lustiesroom = 23; - const byte r__westhall = 25; - const byte r__easthall = 26; - const byte r__oubliette = 27; - const byte r__geidas = 28; - const byte r__catacombs = 29; - - //{ -------------- } - - const byte r__bridge = 40; - const byte r__robins = 42; - const byte r__outsidenottspub = 46; - const byte r__nottspub = 47; - - //{ -------------- } - - const byte r__outsideducks = 50; - const byte r__ducks = 51; - - //{ -------------- } - - const byte r__outsidecardiffcastle = 70; - const byte r__insidecardiffcastle = 71; - - //{ -------------- } - - /*{ place80 appears to be bogus }*/ - - //{ -------------- } - - const byte r__bosskey = 98; /*{ assumed }*/ - const byte r__map = 99; - - } // End of namespace Gyro +const byte r__nowhere = 0; +const byte r__yours = 1; +const byte r__outsideyours = 2; +/*{ a corridor in your castle. = 3 } +{ outside your castle = 5; }*/ +const byte r__musicroom = 7; +const byte r__outsideargentpub = 9; +const byte r__argentroad = 10; +const byte r__wisewomans = 11; +const byte r__spludwicks = 12; +const byte r__insideabbey = 13; +const byte r__outsideabbey = 14; /*{ assumed }*/ +const byte r__avvysgarden = 15; +const byte r__aylesoffice = 16; +const byte r__argentpub = 19; +const byte r__brummieroad = 20; +const byte r__lusties = 21; /*{ ? not sure }*/ +const byte r__entrancehall = 22; +const byte r__lustiesroom = 23; +const byte r__westhall = 25; +const byte r__easthall = 26; +const byte r__oubliette = 27; +const byte r__geidas = 28; +const byte r__catacombs = 29; + +//{ -------------- } + +const byte r__bridge = 40; +const byte r__robins = 42; +const byte r__outsidenottspub = 46; +const byte r__nottspub = 47; + +//{ -------------- } + +const byte r__outsideducks = 50; +const byte r__ducks = 51; + +//{ -------------- } + +const byte r__outsidecardiffcastle = 70; +const byte r__insidecardiffcastle = 71; + +//{ -------------- } + +/*{ place80 appears to be bogus }*/ + +//{ -------------- } + +const byte r__bosskey = 98; /*{ assumed }*/ +const byte r__map = 99; } // End of namespace Avalanche From aeff42074ade0ab29e8130a6b92ffe73f94070b7 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 21 Jun 2013 14:08:10 +0200 Subject: [PATCH 0023/1332] AVALANCHE: Reorganise source files. --- engines/avalanche/1stoff.cpp | 83 -- engines/avalanche/access.cpp | 193 --- engines/avalanche/access.h | 39 - engines/avalanche/acci.cpp | 1956 ------------------------------ engines/avalanche/acci.h | 296 ----- engines/avalanche/also.cpp | 1412 ---------------------- engines/avalanche/andexor.cpp | 152 --- engines/avalanche/andexor2.cpp | 165 --- engines/avalanche/andextst.cpp | 100 -- engines/avalanche/arch.cpp | 146 --- engines/avalanche/arch.h | 40 - engines/avalanche/avalot9.cpp | 174 --- engines/avalanche/avbkgrnd.cpp | 118 -- engines/avalanche/avmenu.cpp | 348 ------ engines/avalanche/avvyans.cpp | 130 -- engines/avalanche/avvyans2.cpp | 230 ---- engines/avalanche/avvymonk.cpp | 110 -- engines/avalanche/bakchunk.cpp | 59 - engines/avalanche/basher.cpp | 502 -------- engines/avalanche/basher.h | 70 -- engines/avalanche/bootstrp.cpp | 404 ------- engines/avalanche/cadburys.cpp | 135 --- engines/avalanche/cadburys.h | 71 -- engines/avalanche/celer.cpp | 578 --------- engines/avalanche/celer.h | 83 -- engines/avalanche/ch_egats.cpp | 183 --- engines/avalanche/charmap.cpp | 58 - engines/avalanche/chunker.cpp | 110 -- engines/avalanche/chunkxf1.cpp | 289 ----- engines/avalanche/chunkxf2.cpp | 219 ---- engines/avalanche/chunkxf3.cpp | 305 ----- engines/avalanche/chunkxf4.cpp | 344 ------ engines/avalanche/chunkxf5.cpp | 298 ----- engines/avalanche/chunkxf6.cpp | 309 ----- engines/avalanche/chunkxf7.cpp | 291 ----- engines/avalanche/chunkxf8.cpp | 298 ----- engines/avalanche/chunkxf9.cpp | 292 ----- engines/avalanche/chunkxfa.cpp | 295 ----- engines/avalanche/chunkxfb.cpp | 293 ----- engines/avalanche/chunkxfc.cpp | 291 ----- engines/avalanche/chunkxfd.cpp | 291 ----- engines/avalanche/chunkxfe.cpp | 291 ----- engines/avalanche/chunkxff.cpp | 291 ----- engines/avalanche/chunkxfg.cpp | 291 ----- engines/avalanche/chunkxfh.cpp | 292 ----- engines/avalanche/chunkxfi.cpp | 301 ----- engines/avalanche/chunkxfj.cpp | 297 ----- engines/avalanche/chunkxfk.cpp | 297 ----- engines/avalanche/chunkxfl.cpp | 184 --- engines/avalanche/clock.cpp | 94 -- engines/avalanche/closing.cpp | 156 --- engines/avalanche/closing.h | 45 - engines/avalanche/convert.cpp | 113 -- engines/avalanche/convmous.cpp | 125 -- engines/avalanche/credits.cpp | 121 -- engines/avalanche/displtxt.cpp | 71 -- engines/avalanche/dropdown.cpp | 916 -------------- engines/avalanche/dropdown.h | 124 -- engines/avalanche/dwidth.cpp | 51 - engines/avalanche/edhead.cpp | 112 -- engines/avalanche/edna.cpp | 381 ------ engines/avalanche/enhanced.cpp | 113 -- engines/avalanche/enhanced.h | 51 - engines/avalanche/enid.cpp | 631 ---------- engines/avalanche/enid.h | 52 - engines/avalanche/filer.cpp | 903 -------------- engines/avalanche/fileunit.cpp | 1303 -------------------- engines/avalanche/fileunit.h | 37 - engines/avalanche/filing.cpp | 196 --- engines/avalanche/folktemp.cpp | 114 -- engines/avalanche/fontslid.cpp | 57 - engines/avalanche/frere.cpp | 131 -- engines/avalanche/g-room.cpp | 453 ------- engines/avalanche/golden.cpp | 476 -------- engines/avalanche/gyro.cpp | 609 ---------- engines/avalanche/gyro.h | 839 ------------- engines/avalanche/help.cpp | 301 ----- engines/avalanche/help2.cpp | 287 ----- engines/avalanche/helpbak.cpp | 219 ---- engines/avalanche/helpbak.h | 41 - engines/avalanche/helper.cpp | 354 ------ engines/avalanche/helper.h | 41 - engines/avalanche/hibits.cpp | 55 - engines/avalanche/highs.cpp | 141 --- engines/avalanche/highs.h | 39 - engines/avalanche/hiz.cpp | 348 ------ engines/avalanche/incline.cpp | 205 ---- engines/avalanche/incline.h | 37 - engines/avalanche/initxf.cpp | 61 - engines/avalanche/inputtes.cpp | 74 -- engines/avalanche/intro.cpp | 641 ---------- engines/avalanche/ints.cpp | 57 - engines/avalanche/joysetup.cpp | 128 -- engines/avalanche/joystick.cpp | 210 ---- engines/avalanche/joystick.h | 52 - engines/avalanche/loading.cpp | 55 - engines/avalanche/logger.cpp | 222 ---- engines/avalanche/logger.h | 63 - engines/avalanche/lucerna.cpp | 1696 -------------------------- engines/avalanche/lucerna.h | 106 -- engines/avalanche/magic2.cpp | 66 - engines/avalanche/magidraw.cpp | 62 - engines/avalanche/magishuf.cpp | 92 -- engines/avalanche/make!.cpp | 98 -- engines/avalanche/makeregi.cpp | 176 --- engines/avalanche/makesez.cpp | 74 -- engines/avalanche/makevmou.cpp | 303 ----- engines/avalanche/menuxf.cpp | 81 -- engines/avalanche/minstran.cpp | 77 -- engines/avalanche/newsprit.cpp | 153 --- engines/avalanche/nim.cpp | 482 -------- engines/avalanche/nimdraw.cpp | 140 --- engines/avalanche/nimunit.cpp | 553 --------- engines/avalanche/nimunit.h | 46 - engines/avalanche/oldfiler.cpp | 307 ----- engines/avalanche/oldhighs.cpp | 286 ----- engines/avalanche/oldincln.cpp | 298 ----- engines/avalanche/oldincln.h | 37 - engines/avalanche/oldtrip.cpp | 589 --------- engines/avalanche/oldtrip.h | 127 -- engines/avalanche/omtest.cpp | 210 ---- engines/avalanche/oopmenu.cpp | 332 ----- engines/avalanche/oopmenu.h | 112 -- engines/avalanche/overlap.cpp | 87 -- engines/avalanche/overscro.cpp | 89 -- engines/avalanche/particle.cpp | 325 ----- engines/avalanche/pictemp.cpp | 99 -- engines/avalanche/pictemp2.cpp | 97 -- engines/avalanche/pingo.cpp | 302 ----- engines/avalanche/pingo.h | 49 - engines/avalanche/plottest.cpp | 70 -- engines/avalanche/preview1.cpp | 152 --- engines/avalanche/qintro.cpp | 320 ----- engines/avalanche/qstars.cpp | 302 ----- engines/avalanche/rawupd.cpp | 96 -- engines/avalanche/readsez.cpp | 108 -- engines/avalanche/reginam.cpp | 112 -- engines/avalanche/sackb1.cpp | 76 -- engines/avalanche/sackb1.h | 44 - engines/avalanche/sackb3.cpp | 50 - engines/avalanche/sackblas.cpp | 26 - engines/avalanche/saving.cpp | 78 -- engines/avalanche/scr_1.cpp | 133 -- engines/avalanche/scr_2.cpp | 147 --- engines/avalanche/scr_3.cpp | 132 -- engines/avalanche/scr_4.cpp | 121 -- engines/avalanche/scr_5.cpp | 143 --- engines/avalanche/scr_9.cpp | 50 - engines/avalanche/scrolls.cpp | 945 --------------- engines/avalanche/scrolls.h | 63 - engines/avalanche/sequence.cpp | 113 -- engines/avalanche/sequence.h | 62 - engines/avalanche/setup.cpp | 1440 ---------------------- engines/avalanche/seu.cpp | 985 --------------- engines/avalanche/seu_avvy.cpp | 122 -- engines/avalanche/sez.cpp | 27 - engines/avalanche/sezedit.cpp | 485 -------- engines/avalanche/sezunit.cpp | 104 -- engines/avalanche/sezunit.h | 71 -- engines/avalanche/sezxfr.cpp | 140 --- engines/avalanche/shell1.cpp | 64 - engines/avalanche/shell2.cpp | 57 - engines/avalanche/slope.cpp | 397 ------ engines/avalanche/spread.cpp | 389 ------ engines/avalanche/spread2.cpp | 1001 --------------- engines/avalanche/squish.cpp | 480 -------- engines/avalanche/ss_blank.cpp | 69 -- engines/avalanche/ss_clock.cpp | 129 -- engines/avalanche/stars.cpp | 626 ---------- engines/avalanche/status.cpp | 70 -- engines/avalanche/sticks.cpp | 144 --- engines/avalanche/sticks.h | 44 - engines/avalanche/sunrise.cpp | 91 -- engines/avalanche/tempo.cpp | 102 -- engines/avalanche/test.cpp | 46 - engines/avalanche/test2.cpp | 45 - engines/avalanche/testblit.cpp | 80 -- engines/avalanche/testcard.cpp | 90 -- engines/avalanche/testenh.cpp | 50 - engines/avalanche/timeout.cpp | 699 ----------- engines/avalanche/timeout.h | 259 ---- engines/avalanche/travel.cpp | 89 -- engines/avalanche/trip.cpp | 217 ---- engines/avalanche/trip.h | 47 - engines/avalanche/trip3.cpp | 343 ------ engines/avalanche/trip3.h | 50 - engines/avalanche/trip42.cpp | 597 --------- engines/avalanche/trip42.h | 119 -- engines/avalanche/trip5.cpp | 2081 -------------------------------- engines/avalanche/trip5.h | 213 ---- engines/avalanche/trip5tst.cpp | 159 --- engines/avalanche/trip5xf.cpp | 205 ---- engines/avalanche/tripoop.cpp | 352 ------ engines/avalanche/ttmenuxf.cpp | 169 --- engines/avalanche/unsquish.cpp | 552 --------- engines/avalanche/viewdocs.cpp | 580 --------- engines/avalanche/visa.cpp | 290 ----- engines/avalanche/visa.h | 39 - engines/avalanche/visatest.cpp | 110 -- engines/avalanche/waver.cpp | 27 - engines/avalanche/xf_gover.cpp | 124 -- engines/avalanche/xf_help.cpp | 112 -- engines/avalanche/xf_visa.cpp | 200 --- engines/avalanche/xfbutton.cpp | 92 -- engines/avalanche/xfghost.cpp | 299 ----- engines/avalanche/zapdraw.cpp | 67 - 206 files changed, 52242 deletions(-) delete mode 100644 engines/avalanche/1stoff.cpp delete mode 100644 engines/avalanche/access.cpp delete mode 100644 engines/avalanche/access.h delete mode 100644 engines/avalanche/acci.cpp delete mode 100644 engines/avalanche/acci.h delete mode 100644 engines/avalanche/also.cpp delete mode 100644 engines/avalanche/andexor.cpp delete mode 100644 engines/avalanche/andexor2.cpp delete mode 100644 engines/avalanche/andextst.cpp delete mode 100644 engines/avalanche/arch.cpp delete mode 100644 engines/avalanche/arch.h delete mode 100644 engines/avalanche/avalot9.cpp delete mode 100644 engines/avalanche/avbkgrnd.cpp delete mode 100644 engines/avalanche/avmenu.cpp delete mode 100644 engines/avalanche/avvyans.cpp delete mode 100644 engines/avalanche/avvyans2.cpp delete mode 100644 engines/avalanche/avvymonk.cpp delete mode 100644 engines/avalanche/bakchunk.cpp delete mode 100644 engines/avalanche/basher.cpp delete mode 100644 engines/avalanche/basher.h delete mode 100644 engines/avalanche/bootstrp.cpp delete mode 100644 engines/avalanche/cadburys.cpp delete mode 100644 engines/avalanche/cadburys.h delete mode 100644 engines/avalanche/celer.cpp delete mode 100644 engines/avalanche/celer.h delete mode 100644 engines/avalanche/ch_egats.cpp delete mode 100644 engines/avalanche/charmap.cpp delete mode 100644 engines/avalanche/chunker.cpp delete mode 100644 engines/avalanche/chunkxf1.cpp delete mode 100644 engines/avalanche/chunkxf2.cpp delete mode 100644 engines/avalanche/chunkxf3.cpp delete mode 100644 engines/avalanche/chunkxf4.cpp delete mode 100644 engines/avalanche/chunkxf5.cpp delete mode 100644 engines/avalanche/chunkxf6.cpp delete mode 100644 engines/avalanche/chunkxf7.cpp delete mode 100644 engines/avalanche/chunkxf8.cpp delete mode 100644 engines/avalanche/chunkxf9.cpp delete mode 100644 engines/avalanche/chunkxfa.cpp delete mode 100644 engines/avalanche/chunkxfb.cpp delete mode 100644 engines/avalanche/chunkxfc.cpp delete mode 100644 engines/avalanche/chunkxfd.cpp delete mode 100644 engines/avalanche/chunkxfe.cpp delete mode 100644 engines/avalanche/chunkxff.cpp delete mode 100644 engines/avalanche/chunkxfg.cpp delete mode 100644 engines/avalanche/chunkxfh.cpp delete mode 100644 engines/avalanche/chunkxfi.cpp delete mode 100644 engines/avalanche/chunkxfj.cpp delete mode 100644 engines/avalanche/chunkxfk.cpp delete mode 100644 engines/avalanche/chunkxfl.cpp delete mode 100644 engines/avalanche/clock.cpp delete mode 100644 engines/avalanche/closing.cpp delete mode 100644 engines/avalanche/closing.h delete mode 100644 engines/avalanche/convert.cpp delete mode 100644 engines/avalanche/convmous.cpp delete mode 100644 engines/avalanche/credits.cpp delete mode 100644 engines/avalanche/displtxt.cpp delete mode 100644 engines/avalanche/dropdown.cpp delete mode 100644 engines/avalanche/dropdown.h delete mode 100644 engines/avalanche/dwidth.cpp delete mode 100644 engines/avalanche/edhead.cpp delete mode 100644 engines/avalanche/edna.cpp delete mode 100644 engines/avalanche/enhanced.cpp delete mode 100644 engines/avalanche/enhanced.h delete mode 100644 engines/avalanche/enid.cpp delete mode 100644 engines/avalanche/enid.h delete mode 100644 engines/avalanche/filer.cpp delete mode 100644 engines/avalanche/fileunit.cpp delete mode 100644 engines/avalanche/fileunit.h delete mode 100644 engines/avalanche/filing.cpp delete mode 100644 engines/avalanche/folktemp.cpp delete mode 100644 engines/avalanche/fontslid.cpp delete mode 100644 engines/avalanche/frere.cpp delete mode 100644 engines/avalanche/g-room.cpp delete mode 100644 engines/avalanche/golden.cpp delete mode 100644 engines/avalanche/gyro.cpp delete mode 100644 engines/avalanche/gyro.h delete mode 100644 engines/avalanche/help.cpp delete mode 100644 engines/avalanche/help2.cpp delete mode 100644 engines/avalanche/helpbak.cpp delete mode 100644 engines/avalanche/helpbak.h delete mode 100644 engines/avalanche/helper.cpp delete mode 100644 engines/avalanche/helper.h delete mode 100644 engines/avalanche/hibits.cpp delete mode 100644 engines/avalanche/highs.cpp delete mode 100644 engines/avalanche/highs.h delete mode 100644 engines/avalanche/hiz.cpp delete mode 100644 engines/avalanche/incline.cpp delete mode 100644 engines/avalanche/incline.h delete mode 100644 engines/avalanche/initxf.cpp delete mode 100644 engines/avalanche/inputtes.cpp delete mode 100644 engines/avalanche/intro.cpp delete mode 100644 engines/avalanche/ints.cpp delete mode 100644 engines/avalanche/joysetup.cpp delete mode 100644 engines/avalanche/joystick.cpp delete mode 100644 engines/avalanche/joystick.h delete mode 100644 engines/avalanche/loading.cpp delete mode 100644 engines/avalanche/logger.cpp delete mode 100644 engines/avalanche/logger.h delete mode 100644 engines/avalanche/lucerna.cpp delete mode 100644 engines/avalanche/lucerna.h delete mode 100644 engines/avalanche/magic2.cpp delete mode 100644 engines/avalanche/magidraw.cpp delete mode 100644 engines/avalanche/magishuf.cpp delete mode 100644 engines/avalanche/make!.cpp delete mode 100644 engines/avalanche/makeregi.cpp delete mode 100644 engines/avalanche/makesez.cpp delete mode 100644 engines/avalanche/makevmou.cpp delete mode 100644 engines/avalanche/menuxf.cpp delete mode 100644 engines/avalanche/minstran.cpp delete mode 100644 engines/avalanche/newsprit.cpp delete mode 100644 engines/avalanche/nim.cpp delete mode 100644 engines/avalanche/nimdraw.cpp delete mode 100644 engines/avalanche/nimunit.cpp delete mode 100644 engines/avalanche/nimunit.h delete mode 100644 engines/avalanche/oldfiler.cpp delete mode 100644 engines/avalanche/oldhighs.cpp delete mode 100644 engines/avalanche/oldincln.cpp delete mode 100644 engines/avalanche/oldincln.h delete mode 100644 engines/avalanche/oldtrip.cpp delete mode 100644 engines/avalanche/oldtrip.h delete mode 100644 engines/avalanche/omtest.cpp delete mode 100644 engines/avalanche/oopmenu.cpp delete mode 100644 engines/avalanche/oopmenu.h delete mode 100644 engines/avalanche/overlap.cpp delete mode 100644 engines/avalanche/overscro.cpp delete mode 100644 engines/avalanche/particle.cpp delete mode 100644 engines/avalanche/pictemp.cpp delete mode 100644 engines/avalanche/pictemp2.cpp delete mode 100644 engines/avalanche/pingo.cpp delete mode 100644 engines/avalanche/pingo.h delete mode 100644 engines/avalanche/plottest.cpp delete mode 100644 engines/avalanche/preview1.cpp delete mode 100644 engines/avalanche/qintro.cpp delete mode 100644 engines/avalanche/qstars.cpp delete mode 100644 engines/avalanche/rawupd.cpp delete mode 100644 engines/avalanche/readsez.cpp delete mode 100644 engines/avalanche/reginam.cpp delete mode 100644 engines/avalanche/sackb1.cpp delete mode 100644 engines/avalanche/sackb1.h delete mode 100644 engines/avalanche/sackb3.cpp delete mode 100644 engines/avalanche/sackblas.cpp delete mode 100644 engines/avalanche/saving.cpp delete mode 100644 engines/avalanche/scr_1.cpp delete mode 100644 engines/avalanche/scr_2.cpp delete mode 100644 engines/avalanche/scr_3.cpp delete mode 100644 engines/avalanche/scr_4.cpp delete mode 100644 engines/avalanche/scr_5.cpp delete mode 100644 engines/avalanche/scr_9.cpp delete mode 100644 engines/avalanche/scrolls.cpp delete mode 100644 engines/avalanche/scrolls.h delete mode 100644 engines/avalanche/sequence.cpp delete mode 100644 engines/avalanche/sequence.h delete mode 100644 engines/avalanche/setup.cpp delete mode 100644 engines/avalanche/seu.cpp delete mode 100644 engines/avalanche/seu_avvy.cpp delete mode 100644 engines/avalanche/sez.cpp delete mode 100644 engines/avalanche/sezedit.cpp delete mode 100644 engines/avalanche/sezunit.cpp delete mode 100644 engines/avalanche/sezunit.h delete mode 100644 engines/avalanche/sezxfr.cpp delete mode 100644 engines/avalanche/shell1.cpp delete mode 100644 engines/avalanche/shell2.cpp delete mode 100644 engines/avalanche/slope.cpp delete mode 100644 engines/avalanche/spread.cpp delete mode 100644 engines/avalanche/spread2.cpp delete mode 100644 engines/avalanche/squish.cpp delete mode 100644 engines/avalanche/ss_blank.cpp delete mode 100644 engines/avalanche/ss_clock.cpp delete mode 100644 engines/avalanche/stars.cpp delete mode 100644 engines/avalanche/status.cpp delete mode 100644 engines/avalanche/sticks.cpp delete mode 100644 engines/avalanche/sticks.h delete mode 100644 engines/avalanche/sunrise.cpp delete mode 100644 engines/avalanche/tempo.cpp delete mode 100644 engines/avalanche/test.cpp delete mode 100644 engines/avalanche/test2.cpp delete mode 100644 engines/avalanche/testblit.cpp delete mode 100644 engines/avalanche/testcard.cpp delete mode 100644 engines/avalanche/testenh.cpp delete mode 100644 engines/avalanche/timeout.cpp delete mode 100644 engines/avalanche/timeout.h delete mode 100644 engines/avalanche/travel.cpp delete mode 100644 engines/avalanche/trip.cpp delete mode 100644 engines/avalanche/trip.h delete mode 100644 engines/avalanche/trip3.cpp delete mode 100644 engines/avalanche/trip3.h delete mode 100644 engines/avalanche/trip42.cpp delete mode 100644 engines/avalanche/trip42.h delete mode 100644 engines/avalanche/trip5.cpp delete mode 100644 engines/avalanche/trip5.h delete mode 100644 engines/avalanche/trip5tst.cpp delete mode 100644 engines/avalanche/trip5xf.cpp delete mode 100644 engines/avalanche/tripoop.cpp delete mode 100644 engines/avalanche/ttmenuxf.cpp delete mode 100644 engines/avalanche/unsquish.cpp delete mode 100644 engines/avalanche/viewdocs.cpp delete mode 100644 engines/avalanche/visa.cpp delete mode 100644 engines/avalanche/visa.h delete mode 100644 engines/avalanche/visatest.cpp delete mode 100644 engines/avalanche/waver.cpp delete mode 100644 engines/avalanche/xf_gover.cpp delete mode 100644 engines/avalanche/xf_help.cpp delete mode 100644 engines/avalanche/xf_visa.cpp delete mode 100644 engines/avalanche/xfbutton.cpp delete mode 100644 engines/avalanche/xfghost.cpp delete mode 100644 engines/avalanche/zapdraw.cpp diff --git a/engines/avalanche/1stoff.cpp b/engines/avalanche/1stoff.cpp deleted file mode 100644 index 31c87a894d2b..000000000000 --- a/engines/avalanche/1stoff.cpp +++ /dev/null @@ -1,83 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -matrix<1, 7, 1, 3, byte> cols; -byte fv; - -void adjust() { - registers r; - { - ax = 0x1012; - bx = 1; - cx = 2; - es = seg(cols); - dx = ofs(cols); - - } - - intr(0x10, r); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 0; - clrscr; - - fillchar(cols, sizeof(cols), '\0'); - adjust(); - - gotoxy(29, 10); - textattr = 1; - output << "Thorsoft of Letchworth"; - gotoxy(36, 12); - textattr = 2; - output << "presents"; - - for (fv = 1; fv <= 77; fv ++) { - delay(77); - if (fv < 64) fillchar(cols[1], 3, chr(fv)); - if (fv > 14) fillchar(cols[2], 3, chr(fv - 14)); - adjust(); - } - - delay(100); - - for (fv = 63; fv >= 1; fv --) { - fillchar(cols, sizeof(cols), chr(fv)); - delay(37); - adjust(); - } - - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.cpp b/engines/avalanche/access.cpp deleted file mode 100644 index ba87cd64a4c4..000000000000 --- a/engines/avalanche/access.cpp +++ /dev/null @@ -1,193 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - ACCESS The temporary Sez handler. */ - -#define __access_implementation__ - - -#include "access.h" - - -/*#include "Gyro.h"*/ -/*#include "Scrolls.h"*/ -/*#include "Acci.h"*/ -/*#include "Trip5.h"*/ -/*#include "Lucerna.h"*/ - -namespace Avalanche { - -boolean int_say_went_ok; - -void int_say(string filename, boolean bubble) -/* Internal use ONLY! */ -{ - untyped_file f; - /*$I-*/ - assign(f, filename); - reset(f, 1); - if (ioresult != 0) { - int_say_went_ok = false; - return; - } - bufsize = filesize(f); - blockread(f, buffer, bufsize); - if (bubble) { - bufsize += 1; - buffer[bufsize] = '\2'; - } - close(f); - /*$I+*/ - - calldrivers; - - int_say_went_ok = true; -} - -void dixi(char p, byte n) { - exit(153); - int_say(string('s') + p + strf(n) + ".raw", false); -} - -void talkto(byte whom) { - byte fv; - boolean no_matches; - exit(153); - if (person == pardon) { - person = chr(subjnumber); - subjnumber = 0; - } - - switch (chr(whom)) { - case pspludwick: - - if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) { - dixi('q', 68); - dna.obj[potion] = true; - objectlist; - points(3); - return; - } else { - if (dna.talked_to_crapulus) - switch (dna.given2spludwick) { /* Spludwick - what does he need? */ - /* 0 - let it through to use normal routine. */ - case RANGE_2(1, 2): { - display(string("Can you get me ") + - get_better(spludwick_order[dna.given2spludwick]) + ", please?" + - "\232\2"); - return; - } - break; - case 3: { - dixi('q', 30); /* need any help with the game? */ - return; - } - break; - } - else dixi('q', 42); /* Haven't talked to Crapulus. Go and talk to him. */ - } - break; - - case pibythneth: - if (dna.givenbadgetoiby) { - dixi('q', 33); /* Thanks a lot! */ - return; /* And leave the proc. */ - } - break; /* Or... just continue, 'cos he hasn't got it. */ - case pdogfood: - if (dna.wonnim) { - ; /* We've won the game. */ - dixi('q', 6); /* "I'm Not Playing!" */ - return; /* Zap back. */ - } - break; - case payles: - if (~ dna.ayles_is_awake) { - dixi('q', 43); /* He's fast asleep! */ - return; - } - break; - case pgeida: - if (dna.geida_given_potion) - dna.geida_follows = true; - else { - dixi('u', 17); - return; - } - break; - } - - if (whom > 149) whom -= 149; - - no_matches = true; - for (fv = 1; fv <= numtr; fv ++) - if (tr[fv].a.accinum == whom) { - display(string('\23') + chr(fv + 48) + '\4'); - no_matches = false; - flush(); - } - - if (no_matches) display("\23\23\4"); - - if (subjnumber == 0) /* For the moment... later we'll parse "say". */ - int_say(string("ss") + strf(whom) + ".raw", true); - else { - int_say(string("ss") + strf(whom) + '-' + strf(subjnumber) + ".raw", true); - if (! int_say_went_ok) /* File not found! */ - dixi('n', whom); - } - - switch (chr(whom + 149)) { - case pcrapulus: { - ; /* Crapulus: get the badge - first time only */ - dna.obj[badge] = true; - objectlist; - dixi('q', 1); /* Circular from Cardiff. */ - dna.talked_to_crapulus = true; - - whereis[pcrapulus] = 177; /* Crapulus walks off. */ - - tr[2].vanishifstill = true; - tr[2].walkto(4); /* Walks away. */ - - points(2); - } - break; - - case payles: - dixi('q', 44); - break; /* Can you get me a pen? */ - - } -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/access.h b/engines/avalanche/access.h deleted file mode 100644 index 2e4a08177365..000000000000 --- a/engines/avalanche/access.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __access_h__ -#define __access_h__ - -namespace Avalanche { - -void dixi(char p, byte n); - -void talkto(byte whom); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp deleted file mode 100644 index adaad697d41f..000000000000 --- a/engines/avalanche/acci.cpp +++ /dev/null @@ -1,1956 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* $D-*/ -/* - - - - - ACCIDENCE II The parser. */ -#define __acci_implementation__ - - -/*$V-*/ - -#include "acci.h" - -/*#include "Gyro.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Scrolls.h"*/ -/*#include "Pingo.h"*/ -/*#include "Trip5.h"*/ -/*#include "Visa.h"*/ -/*#include "Enid.h"*/ -/*#include "NimUnit.h"*/ -/*#include "Timeout.h"*/ -/*#include "Celer.h"*/ -/*#include "Highs.h"*/ -/*#include "Helper.h"*/ -/*#include "Sequence.h"*/ - -namespace Avalanche { - -byte fv; - -string wordnum(string x); -static char whatsit; -static word fv; -static boolean gotcha; - -static void checkword(string &x) { /* Checks word "fv". */ - { - vocab &with = words[fv]; - - if ((with.w == x) || ((copy(with.w, 1, length(x)) == x) && ! gotcha)) - whatsit = chr(with.n); - if (with.w == x) gotcha = true; - } -} - -string wordnum(string x) - -{ - string wordnum_result; - if (x == "") { - wordnum_result = ""; - return wordnum_result; - } - whatsit = pardon; - gotcha = false; - for (fv = nowords; fv >= 1; fv --) checkword(x); - wordnum_result = whatsit; - return wordnum_result; -} - -void replace(string old1, string new1) { - byte q; - - q = pos(old1, thats); - while (q != 0) { - thats = copy(thats, 1, q - 1) + new1 + copy(thats, q + length(old1), 255); - q = pos(old1, thats); - } -} - -/*procedure ninetydump; -var f:file; y:integer; bit:byte; a:byte absolute $A000:800; -begin - off; - assign(f,'avvydump.avd'); - rewrite(f,1); - blockwrite(f,dna,177); { just anything } - for bit:=0 to 3 do - begin - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - blockwrite(f,a,12080); - end; - close(f); on; - display('Dumped.'); -end;*/ - -string rank() { - byte fv; - - string rank_result; - for (fv = 1; fv <= 8; fv ++) - if ((dna.score >= ranks[fv].score) - && (dna.score < ranks[fv + 1].score)) { - rank_result = ranks[fv].title; - return rank_result; - } - return rank_result; -} - -string totaltime() { - const real ticks_in_1_sec = (real)(65535) / 3600; - word h, m, s; - varying_string<70> a; - - /* There are 65535 clock ticks in a second, - 1092.25 in a minute, and - 65535 in an hour. */ - string totaltime_result; - h = trunc(dna.total_time / ticks_in_1_sec); /* No. of seconds. */ - m = h % 3600; - h = h / 3600; - s = m % 60; - m = m / 60; - - a = "You've been playing for "; - - if (h > 0) a = a + strf(h) + " hours, "; - if ((m > 0) || (h != 0)) a = a + strf(m) + " minutes and "; - a = a + strf(s) + " seconds."; - - totaltime_result = a; - return totaltime_result; -} - -void cheatparse(string codes); -static word num; -static integer e; - -static void number(string &codes) { - val(codes, num, e); -} - -void cheatparse(string codes) { - char cmd; - integer se, sx, sy; - - if (~ cheat) { - /* put them off the scent! */ - display("Have you gone dotty\??!"); - return; - } - cmd = upcase(codes[2]); - Delete(codes, 1, 2); /* strip header */ - display("\6Ninety: \22\4"); - switch (cmd) { - case 'R': { - number(codes); - if (e != 0) return; - display(string("room swap to ") + codes + '.'); - fliproom(num, 1); - } - break; - case 'Z': { - zonk; - display("Zonk OK!"); - } - break; - case 'W': { - wobble; - display("Ow my head!"); - } - break; - case 'A': { - tr[1].done; - tr[1].init(1, true); - dna.user_moves_avvy = true; - alive = true; - display("Reincat."); - } - break; - case 'B': { - sx = tr[1].x; - sy = tr[1].y; - se = tr[1].face; - delavvy; - number(codes); - { - void &with = tr[1]; - - done; - init(num, true); - display(string("Become ") + codes + ':' + "\r\r" + a.name + '\15' + a.comment); - appear(sx, sy, se); - } - } - break; - /* 'D': ninetydump;*/ - case 'G': - play_nim; - break; - case '': - display("\232\25"); - break; - default: - display("unknown code!"); - } -} - -void punctustrip(string &x) { /* Strips punctuation from x. */ - const varying_string<32> punct = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - byte fv, p; - - for (fv = 1; fv <= 32; fv ++) - do { - p = pos(punct[fv - 1], x); - if (p == 0) flush(); /* <<< The first time I've ever used it! */ - Delete(x, p, 1); - } while (!false); -} - -boolean do_pronouns(); -static boolean ambiguous; - -static void displaywhat(char ch, boolean animate) { /* << it's an adjective! */ - byte ff; - string z; - - if (ch == pardon) { - ambiguous = true; - if (animate) display("Whom?"); - else display("What?"); - } else { - if (animate) display(string("{ ") + getname(ch) + " }"); - else { - z = get_better(ch); - if (z != "") display(string("{ ") + z + " }"); - } - } -} - -boolean do_pronouns() { - byte fv; - - boolean do_pronouns_result; - ambiguous = false; - for (fv = 1; fv <= length(thats); fv ++) - switch (thats[fv]) { - case '\310': { - displaywhat(him, true); - thats[fv] = him; - } - break; - case '\311': { - displaywhat(her, true); - thats[fv] = her; - } - break; - case '\312': { - displaywhat(it, false); - thats[fv] = it; - } - break; - } - do_pronouns_result = ambiguous; - return do_pronouns_result; -} - -void store_interrogation(byte interrogation); - - -static void lowercase() { - byte fv; - - for (fv = 1; fv <= length(current); fv ++) - if (set::of(range('A', 'Z'), eos).has(current[fv])) - current[fv] += 32; -} - - - -static void propernouns() { - byte fv; - - lowercase(); - for (fv = 2; fv <= length(current) - 1; fv ++) - if (current[fv] == ' ') - current[fv + 1] = upcase(current[fv + 1]); - current[1] = upcase(current[1]); -} - - - -static void sayit() { /* This makes Avalot say the response. */ - string x; - - x = current; - x[1] = upcase(x[1]); - display(string("\231") + x + '.' + '\2' + '\23' + '2'); -} - -void store_interrogation(byte interrogation) { - byte fv; - - - if (current == "") return; - - /* Strip current: */ - while ((current[1] == ' ') && (current != "")) Delete(current, 1, 1); - while ((current[length(current)] == ' ') && (current != "")) current[0] -= 1; - - lose_timer(reason_cardiffsurvey); /* if you want to use any other timer, - put this into the case statement. */ - switch (interrogation) { - case 1: { - lowercase(); - sayit(); - like2drink = current; - dna.cardiff_things = 2; - } - break; - case 2: { - propernouns(); - sayit(); - favourite_song = current; - dna.cardiff_things = 3; - } - break; - case 3: { - propernouns(); - sayit(); - worst_place_on_earth = current; - dna.cardiff_things = 4; - } - break; - case 4: { - lowercase(); - sayit(); - fillchar(spare_evening, sizeof(spare_evening), '\261'); - spare_evening = current; - dixi('z', 5); /* His closing statement... */ - tr[2].walkto(4); /* The end of the drawbridge */ - tr[2].vanishifstill = true; /* Then go away! */ - magics[2].op = nix; - dna.cardiff_things = 5; - } - break; - - case 99: - store_high(current); - break; - } - if (interrogation < 4) cardiff_survey; -} - -void clearwords() { - fillchar(realwords, sizeof(realwords), '\0'); -} - -void parse() { - byte n, fv, ff; - string c, cc, thisword; - varying_string<1> answer; - boolean notfound; - - /* first parsing - word identification */ - - thats = ""; - c = current + '\40'; - n = 1; - polite = false; - verb = pardon; - thing = pardon; - thing2 = pardon; - person = pardon; - clearwords(); - if (current[1] == '.') { - /* a cheat mode attempt */ - cheatparse(current); - thats = nowt; - return; - } /* not our department! Otherwise... */ - - /* Are we being interrogated right now? */ - - if (interrogation > 0) { - store_interrogation(interrogation); - weirdword = true; - return; - } - - cc = c; - for (fv = 1; fv <= length(c); fv ++) c[fv] = upcase(c[fv]); - while (c != "") { - while ((c[1] == '\40') && (c != "")) { - Delete(c, 1, 1); - Delete(cc, 1, 1); - } - thisword = copy(c, 1, pos("\40", c) - 1); - realwords[n] = copy(cc, 1, pos("\40", cc) - 1); - punctustrip(c); - - notfound = true; - - if (thisword != "") { - for (ff = 1; ff <= 30; ff ++) { - /* Check Also, FIRST! */ - if (pos(string(',') + thisword, also[ff][0]) > 0) { - thats = thats + chr(99 + ff); - notfound = false; - } - } - } - - if (notfound) { - answer = wordnum(thisword); - if (answer == pardon) { - notfound = true; - thats = thats + pardon; - } else - thats = thats + wordnum(thisword); - n += 1; - } - Delete(c, 1, pos("\40", c)); - Delete(cc, 1, pos("\40", cc)); - } - - if (pos("\376", thats) > 0) unknown = realwords[pos("\376", thats)]; - else unknown = ""; - replace("\377", ""); /* zap noise words */ - replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */ - replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */ - replace(string('\4') + '\343', "\21"); /* "get up" = "stand" */ - replace(string('\4') + '\347', "\21"); /* "get down" = "stand"... well, why not? */ - replace(string('\22') + '\344', "\2"); /* "go in" = "open [door]" */ - replace(string('\34') + '\345', "\375"); /* "P' off" is a swear word */ - replace(string('\4') + '\6', "\6"); /* "Take inventory" (remember Colossal Adventure?) */ - replace(string('\50') + '\350', "\25"); /* "put on" = "don" */ - replace(string('\4') + '\345', "\24"); /* "take off" = "doff" */ - - /* Words that could mean more than one person */ - { - if (room == r__nottspub) replace("\314", "\244"); /* Barman = Port */ - else replace("\314", "\232"); /* Barman = Malagauche */ - switch (room) { - case r__aylesoffice: - replace("\313", "\243"); - break; /* Monk = Ayles */ - case r__musicroom: - replace("\313", "\246"); - break; /* Monk = Jacques */ - default: - replace("\313", "\242"); /* Monk = Ibythneth */ - } - } - - if (do_pronouns()) { - weirdword = true; - thats = nowt; - return; - } - - /* second parsing - accidence */ - - subject = ""; - subjnumber = 0; /* Find subject of conversation. */ - for (fv = 1; fv <= 11; fv ++) - if (set::of('`', '\'', eos).has(realwords[fv][1])) { - subjnumber = ord(thats[fv]); - thats[fv] = moved; - flush(); /* Only the second time I've used that! */ - } - if (subjnumber == 0) /* Still not found. */ - for (fv = 1; fv <= 10; fv ++) - if (thats[fv] == '\374') { /* the word is "about", or something similar */ - subjnumber = ord(thats[fv + 1]); - thats[fv + 1] = '\0'; - flush(); /* ...Third! */ - } - if (subjnumber == 0) /* STILL not found! Must be the word after "say". */ - for (fv = 1; fv <= 10; fv ++) - if ((thats[fv] == '\7') && !(set::of('\0', range('\341', '\345'), eos).has(thats[fv + 1]))) { - /* SAY not followed by a preposition */ - subjnumber = ord(thats[fv + 1]); - thats[fv + 1] = '\0'; - flush(); /* ...Fourth! */ - } - - for (fv = length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ - switch (thats[fv]) { - case '\1' ... '\61': - case '\375': - case '\371': - verb = thats[fv]; - break; - case '\62' ... '\225': { - thing2 = thing; - thing = thats[fv]; - } - break; - case '\226' ... '\307': - person = thats[fv]; - break; - case '\373': - polite = true; - break; - } - - if ((unknown != "") && ! - (set::of(vb_exam, vb_talk, vb_save, vb_load, vb_dir, eos).has(verb))) { - display(string("Sorry, but I have no idea what `") + unknown + - "\" means. Can you rephrase it?"); - weirdword = true; - } else weirdword = false; - if (thats == "") thats = nowt; - - if (thing != pardon) it = thing; - if (person != pardon) { - if (person < '\257') him = person; - else her = person; - } -} - -void examobj() { /* Examine a standard object-thing */ - if (thing != thinks) thinkabout(thing, a_thing); - switch (thing) { - case wine : - switch (winestate) { - /* 4 is perfect wine. 0 is not holding the wine. */ - case 1: - dixi('t', 1); - break; /* Normal examine wine scroll */ - case 2: - dixi('d', 6); - break; /* Bad wine */ - case 3: - dixi('d', 7); - break; /* Vinegar */ - } - break; - case onion: - if (rotten_onion) - dixi('q', 21); /* Yucky onion. */ - else - dixi('t', 18); - break; /* Normal onion scroll */ - default: - dixi('t', ord(thing)); /* <<< Ordinarily */ - } -} - -boolean personshere() { /* Person equivalent of "holding" */ - boolean personshere_result; - if ((person == pardon) || (person == '\0') - || (whereis[person] == dna.room)) personshere_result = true; - else { - if (person < '\257') display("H\4"); - else display("Sh\4"); - display("e isn't around at the moment."); - personshere_result = false; - } - return personshere_result; -} - -void exampers() { - if (personshere()) { - if (thing != thinks) thinkabout(person, a_person); - person -= 149; - switch (person) { /* Special cases */ - case '\13': - if (wonnim) { - dixi('Q', 8); /* "I'm Not Playing!" */ - return; - } - break; - case '\11': - if (lustie_is_asleep) { - dixi('Q', 65); /* He's asleep. (65! Wow!) */ return; - } - break; - } - /* Otherwise... */ dixi('p', ord(person)); - } /* And afterwards... */ - switch (person) { - case '\16': - if (~ dna.ayles_is_awake) dixi('Q', 13); - break; /* u.f.s.? */ - } -} - -boolean holding() { - boolean holding_result; - if (set::of(range('\63', '\143'), eos).has(thing)) { - holding_result = true; /* Also */ - return holding_result; - } - holding_result = false; - if (thing > '\144') display("Be reasonable!"); - else if (~ dna.obj[thing]) /* verbs that need "thing" to be in the inventory */ - display("You're not holding it, Avvy."); - else - holding_result = true; - return holding_result; -} - -void examine(); - -static void special(boolean before) { - switch (dna.room) { - case r__yours: - switch (thing) { - case '\66': - if (before) show_one(5); - else show_one(6); - break; - } - break; - } -} - -void examine() { - /* Examine. EITHER it's an object OR it's an Also OR it's a person OR - it's something else. */ - if ((person == pardon) && (thing != pardon)) { - if (holding()) - switch (thing) { /* remember it's been Slipped- ie subtract 49 */ - case '\1' ... '\61' : - examobj(); - break; /* Standard object */ - case '\62' ... '\144' : { - special(true); - display(also[ord(thing) - 50][1]); /* Also thing */ - special(false); - } - break; - } - } else if (person != pardon) exampers(); - else display("It's just as it looks on the picture."); /* don't know- guess */ -} - -void inv() { /* the time-honoured command... */ - char fv; - byte q; - - q = 0; - display(string("You're carrying ") + '\4'); - { - for (fv = '\1'; fv <= numobjs; fv ++) - if (obj[fv]) { - q += 1; - if (q == carrying) display(string("and ") + '\4'); - display(get_better(fv) + '\4'); - if (fv == wearing) display(string(", which you're wearing") + '\4'); - if (q < carrying) display(string(", ") + '\4'); - } - if (wearing == nowt) display("...\r\r...and you're stark naked!"); - else - display('.'); - } -} - -void swallow() { /* Eat something. */ - switch (thing) { - case wine: - switch (dna.winestate) { - /* 4 is perfect */ - case 1: { - if (dna.teetotal) { - dixi('D', 6); - return; - } - dixi('U', 1); - wobble; - dixi('U', 2); - dna.obj[wine] = false; - objectlist; - have_a_drink(); - } - break; - case 2: - case 3: - dixi('d', 8); - break; /* You can't drink it! */ - } - break; - case potion: { - background(4); - dixi('U', 3); - gameover; - background(0); - } - break; - case ink: - dixi('U', 4); - break; - case chastity: - dixi('U', 5); - break; - case mushroom: { - dixi('U', 6); - gameover; - } - break; - case onion: - if (dna.rotten_onion) dixi('U', 11); - else { - dixi('U', 8); - dna.obj[onion] = false; - objectlist; - } - break; - default: - if (set::of(r__argentpub, r__nottspub, eos).has(dna.room)) - display("Try BUYing things before you drink them!"); - else - display("The taste of it makes you retch!"); - /* Constant- leave this one */ - } -} - -void others() -/* This lists the other people in the room. */ -{ - char fv; - byte num_people, this_person, here; - - - num_people = 0; - this_person = 0; - here = dna.room; - - for (fv = '\227'; fv <= '\262'; fv ++) /* Start at 151 so we don't list Avvy himself! */ - if (whereis[fv] == here) - num_people += 1; - - /* If nobody's here, we can cut out straight away. */ - - if (num_people == 0) return; /* Leave the procedure. */ - - for (fv = '\227'; fv <= '\262'; fv ++) - if (whereis[fv] == here) { - this_person += 1; - if (this_person == 1) /* First on the list. */ - display(getname(fv) + '\4'); - else if (this_person < num_people) /* The middle... */ - display(string(", ") + getname(fv) + '\4'); - else - display(string(" and ") + getname(fv) + '\4'); /* The end. */ - } - - if (num_people == 1) display(" is\4"); - else display(" are\4"); - - display(" here."); /* End and display it. */ -} - -void lookaround() -/* This is called when you say "look." */ -{ - display(also[0][1]); - switch (dna.room) { - case r__spludwicks: - if (dna.avaricius_talk > 0) dixi('q', 23); - else others(); - break; - case r__robins: { - if (dna.tied_up) dixi('q', 38); - if (dna.mushroom_growing) dixi('q', 55); - } - break; - case r__insidecardiffcastle: - if (~ dna.taken_pen) dixi('q', 49); - break; - case r__lustiesroom: - if (dna.lustie_is_asleep) dixi('q', 65); - break; - case r__catacombs: - switch (dna.cat_y * 256 + dna.cat_x) { - case 258 : - dixi('q', 80); - break; /* Inside art gallery */ - case 514 : - dixi('q', 81); - break; /* Outside ditto */ - case 260 : - dixi('q', 82); - break; /* Outside Geida's room. */ - } - break; - default: - others(); - } -} - -void opendoor() { /* so whaddya THINK this does?! */ - byte fv; - - switch (dna.room) { /* Special cases. */ - case r__yours: - if (infield(2)) { - /* Opening the box. */ - thing = '\66'; /* The box. */ person = pardon; - examine(); - return; - } - break; - case r__spludwicks: - if (thing == '\75') { - dixi('q', 85); - return; - } - break; - } - - - if ((~ dna.user_moves_avvy) & (dna.room != r__lusties)) - return; /* No doors can open if you can't move Avvy. */ - for (fv = 9; fv <= 15; fv ++) - if (infield(fv)) { - { - void &with = portals[fv]; - switch (op) { - case exclaim: { - tr[1].bounce; - dixi('x', data); - } - break; - case transport: - fliproom(hi(data), lo(data)); - break; - case unfinished: { - tr[1].bounce; - display("\7Sorry.\3\rThis place is not available yet!"); - } - break; - case special: - call_special(data); - break; - case mopendoor: - open_the_door(hi(data), lo(data), fv); - break; - } - } - return; - } - if (dna.room == r__map) - display(string("Avvy, you can complete the whole game without ever going ") + - "to anywhere other than Argent, Birmingham, Cardiff, " + - "Nottingham and Norwich."); - else display("Door? What door?"); -} - -void putproc(); - - -static void silly() { - display("Don't be silly!"); -} - -void putproc() { /* Called when you call vb_put. */ - char temp; - - - if (! holding()) return; - thing2 -= 49; /* Slip the second object */ - temp = thing; - thing = thing2; - if (! holding()) return; - thing = temp; - - /* Thing is the thing which you're putting in. Thing2 is where you're - putting it. */ - /* Convenience thing. */ - switch (thing2) { - case wine: - if (thing == onion) { - if (dna.rotten_onion) - display(string("That's a bit like shutting the stable door after the ") + - "horse has bolted!"); - else { /* Put onion into wine? */ - if (dna.winestate != 3) - display("\6Oignon au vin\22 is a bit too strong for your tastes!"); - else { /* Put onion into vinegar! Yes! */ - onion_in_vinegar = true; - points(7); - dixi('u', 9); - } - } - } else silly(); - break; - - case '\66': - if (room == 1) { /* Put something into the box. */ - if (box_contents != nowt) - display(string("There's something in the box already, Avvy. Try taking") + - " that out first."); - else - switch (thing) { - case money: - display("You'd better keep some ready cash on you!"); - break; - case bell: - display("That's a silly place to keep a bell."); - break; - case bodkin: - display("But you might need it!"); - break; - case onion: - display("Just give it to Spludwick, Avvy!"); - break; - default: { - /* Put the object into the box... */ - if (wearing == thing) - display(string("You'd better take ") + get_better(thing) + " off first!"); - else { - show_one(5); /* Open box. */ - box_contents = thing; - dna.obj[thing] = false; - objectlist; - display("OK, it's in the box."); - show_one(6); /* Shut box. */ - } - } - } - } else silly(); - break; - - default: - silly(); - } -} - -boolean give2spludwick(); - -/* The result of this fn is whether or not he says "Hey, thanks!" */ -static void not_in_order() { - display(string("Sorry, I need the ingredients in the right order for this potion.") + - " What I need next is " + - get_better(spludwick_order[dna.given2spludwick]) + ".\232\2"); -} - - - -static void go_to_cauldron() { - tr[2].call_eachstep = false; /* Stops Geida_Procs. */ - set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); - tr[2].walkto(2); -} - -boolean give2spludwick() - -{ - boolean give2spludwick_result; - { - - give2spludwick_result = false; - - if (spludwick_order[given2spludwick] != thing) { - not_in_order(); - return give2spludwick_result; - } - - switch (thing) { - case onion: { - obj[onion] = false; - if (rotten_onion) - dixi('q', 22); - else { - given2spludwick += 1; - dixi('q', 20); - go_to_cauldron(); - points(3); - } - objectlist; - } - break; - case ink: { - obj[ink] = false; - objectlist; - given2spludwick += 1; - dixi('q', 24); - go_to_cauldron(); - points(3); - } - break; - case mushroom: { - obj[mushroom] = false; - dixi('q', 25); - points(5); - given2spludwick += 1; - go_to_cauldron(); - obj[potion] = true; - objectlist; - } - break; - default: - give2spludwick_result = true; - } - } - return give2spludwick_result; -} - -void have_a_drink() { - { - alcohol += 1; - if (alcohol == 5) { - obj[key] = true; /* Get the key. */ - teetotal = true; - avvy_is_awake = false; - avvy_in_bed = true; - objectlist; - dusk; - hang_around_for_a_while; - fliproom(1, 1); - background(14); - new_game_for_trippancy; /* Not really */ - } - } -} - -void cardiff_climbing() { - if (dna.standing_on_dais) { - /* Clamber up. */ - display("You climb down, back onto the floor."); - dna.standing_on_dais = false; - apped(1, 3); - } else { - /* Clamber down. */ - if (infield(1)) { - display("You clamber up onto the dais."); - dna.standing_on_dais = true; - apped(1, 2); - } else - display("Get a bit closer, Avvy."); - } -} - -void stand_up(); - -/* Called when you ask Avvy to stand. */ -static void already() { - display("You're already standing!"); -} - -void stand_up() { - switch (dna.room) { - case r__yours: /* Avvy isn't asleep. */ - if (avvy_in_bed) { /* But he's in bed. */ - if (teetotal) { - dixi('d', 12); - background(0); - dixi('d', 14); - } - tr[1].visible = true; - user_moves_avvy = true; - apped(1, 2); - dna.rw = left; - show_one(4); /* Picture of empty pillow. */ - points(1); - avvy_in_bed = false; - lose_timer(reason_arkata_shouts); - } else already(); - break; - - case r__insidecardiffcastle: - cardiff_climbing(); - break; - - case r__nottspub: - if (sitting_in_pub) { - show_one(4); /* Not sitting down. */ - tr[1].visible = true; /* But standing up. */ - apped(1, 4); /* And walking away. */ - sitting_in_pub = false; /* Really not sitting down. */ - user_moves_avvy = true; /* And ambulant. */ - } else already(); - break; - default: - already(); - } -} - -void getproc(char thing) { - switch (room) { - case r__yours: - if (infield(2)) { - if (box_contents == thing) { - show_one(5); - display("OK, I've got it."); - obj[thing] = true; - objectlist; - box_contents = nowt; - show_one(6); - } else - display(string("I can't see ") + get_better(thing) + " in the box."); - } else dixi('q', 57); - break; - case r__insidecardiffcastle: - switch (thing) { - case pen: { - if (infield(2)) { - /* Standing on the dais. */ - - if (dna.taken_pen) - display("It's not there, Avvy."); - else { - /* OK: we're taking the pen, and it's there. */ - show_one(4); /* No pen there now. */ - call_special(3); /* Zap! */ - dna.taken_pen = true; - dna.obj[pen] = true; - objectlist; - display("Taken."); - } - } else if (dna.standing_on_dais) dixi('q', 53); - else dixi('q', 51); - } - break; - case bolt: - dixi('q', 52); - break; - default: - dixi('q', 57); - } - break; - case r__robins: - if ((thing == mushroom) & (infield(1)) & (dna.mushroom_growing)) { - show_one(3); - display("Got it!"); - dna.mushroom_growing = false; - dna.taken_mushroom = true; - dna.obj[mushroom] = true; - objectlist; - points(3); - } else dixi('q', 57); - break; - default: - dixi('q', 57); - } -} - -void give_geida_the_lute() { - { - if (room != r__lustiesroom) { - display("Not yet. Try later!\232\2"); - return; - } - dna.obj[lute] = false; - objectlist; - dixi('q', 64); /* She plays it. */ - - /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ - - set_up_timer(1, procgive_lute_to_geida, reason_geida_sings); - back_to_bootstrap(4); - } -} - -void play_harp() { - if (infield(7)) - musical_scroll; - else display("Get a bit closer to it, Avvy!"); -} - -void winsequence() { - dixi('q', 78); - first_show(7); - then_show(8); - then_show(9); - start_to_close; - set_up_timer(30, procwinning, reason_winning); -} - -void person_speaks() { - boolean found; - byte fv; - char cfv; - - - if ((person == pardon) || (person == '\0')) { - if ((him == pardon) || (whereis[him] != dna.room)) person = her; - else person = him; - } - - if (whereis[person] != dna.room) { - display("\231\4"); /* Avvy himself! */ - return; - } - - found = false; /* The person we're looking for's code is in Person. */ - - for (fv = 1; fv <= numtr; fv ++) - if (tr[fv].quick & (chr(tr[fv].a.accinum + 149) == person)) { - display(string('\23') + chr(fv + 48) + '\4'); - found = true; - } - - if (! found) - for (fv = 10; fv <= 25; fv ++) { - void &with = quasipeds[fv]; - if ((who == person) && (room == dna.room)) { - display(string('\23') + chr(fv + 55) + '\4'); - } - } -} - -void do_that(); - -static void heythanks() { - person_speaks(); - display("Hey, thanks!\2(But now, you've lost it!)"); - dna.obj[thing] = false; -} - -void do_that() { - const array < '\63', '\72', varying_string<6> > booze = {{"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}}; - byte fv, ff; - integer sx, sy; - boolean ok; - - - if (thats == nowt) { - thats = ""; - return; - } - if (weirdword) return; - if (thing < '\310') thing -= 49; /* "Slip" */ - - if ((~ alive) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, - vb_highscores, vb_smartalec, eos).has(verb))) { - display(string("You're dead, so don't talk. What are you, a ghost ") + - "or something? Try restarting, or restoring a saved game!"); - return; - } - - if ((~ dna.avvy_is_awake) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, - vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { - display("Talking in your sleep? Try waking up!"); - return; - } - - - switch (verb) { - case vb_exam: - examine(); - break; - case vb_open: - opendoor(); - break; - case vb_pause: - display(string("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + - "the mouse on the `O.K.\" box to continue."); - break; - case vb_get: { - if (thing != pardon) { - /* Legitimate try to pick something up. */ - if (dna.carrying >= maxobjs) display("You can't carry any more!"); - else getproc(thing); - - } else { - /* Not... ditto. */ - if (person != pardon) - display("You can't sweep folk off their feet!"); - else - display("I assure you, you don't need it."); - } - } - break; - case vb_drop: - display(string("Two years ago you dropped a florin in the street. Three days ") + - "later it was gone! So now you never leave ANYTHING lying around. OK?"); - break; - /* begin dna.obj[thing]:=false; objectlist; end;*/ - case vb_inv: - inv(); - break; - case vb_talk: - if (person == pardon) { - if (subjnumber == 99) /* They typed "say password". */ - display("Yes, but what \6is\22 the password?"); - else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { - Delete(thats, 1, 1); - move(realwords[2], realwords[1], sizeof(realwords) - sizeof(realwords[1])); - verb = chr(subjnumber); - do_that(); - return; - } else { - person = chr(subjnumber); - subjnumber = 0; - if (set::of(pardon, '\0', eos).has(person)) display("Talk to whom?"); - else if (personshere()) talkto(ord(person)); - } - } else if (person == pardon) display("Talk to whom?"); - else if (personshere()) talkto(ord(person)); - break; - - case vb_give: - if (holding()) { - if (person == pardon) display("Give to whom?"); - else if (personshere()) { - switch (thing) { - case money : - display("You can't bring yourself to give away your moneybag."); - break; - case bodkin: - case bell: - case clothes: - case habit : - display("Don't give it away, it might be useful!"); - break; - default: - switch (person) { - case pcrapulus: - switch (thing) { - case wine: { - display("Crapulus grabs the wine and gulps it down."); - dna.obj[wine] = false; - } - break; - default: - heythanks(); - } - break; - case pcwytalot: - if (set::of(crossbow, bolt, eos).has(thing)) - display(string("You might be able to influence ") + - "Cwytalot more if you used it!"); - else heythanks(); - break; - case pspludwick: - if (give2spludwick()) heythanks(); - break; - case pibythneth: - if (thing == badge) { - dixi('q', 32); /* Thanks! Wow! */ - points(3); - dna.obj[badge] = false; - dna.obj[habit] = true; - dna.givenbadgetoiby = true; - show_one(8); - show_one(9); - } else heythanks(); - break; - case payles: - if (dna.ayles_is_awake) { - if (thing == pen) { - dna.obj[pen] = false; - dixi('q', 54); - dna.obj[ink] = true; - dna.given_pen_to_ayles = true; - objectlist; - points(2); - } else heythanks(); - } else - display("But he's asleep!"); - break; - case pgeida: - switch (thing) { - case potion : { - dna.obj[potion] = false; - dixi('u', 16); /* She drinks it. */ - points(2); - dna.geida_given_potion = true; - objectlist; - } - break; - case lute: - give_geida_the_lute(); - break; - default: - heythanks(); - } - break; - case parkata: - switch (thing) { - case potion: - if (dna.geida_given_potion) - winsequence(); - else dixi('q', 77); - break; /* That Geida woman! */ - default: - heythanks(); - } - break; - default: - heythanks(); - } - } - } - objectlist; /* Just in case... */ - } - break; - - case vb_eat: - case vb_drink: - if (holding()) swallow(); - break; - case vb_load: - edna_load(realwords[2]); - break; - case vb_save: - if (alive) edna_save(realwords[2]); - else display("It's a bit late now to save your game!"); - break; - case vb_pay: - display("No money need change hands."); - break; - case vb_look: - lookaround(); - break; - case vb_break: - display("Vandalism is prohibited within this game!"); - break; - case vb_quit: { /* quit */ - if (demo) { - dixi('q', 31); - close(demofile); - exit(0); /* Change this later!!! */ - } - if (! polite) display("How about a `please\", Avvy?"); - else if (ask("\23C\26Do you really want to quit?")) lmo = true; - } - break; - case vb_go: - display("Just use the arrow keys to walk there."); - break; - case vb_info: { - aboutscroll = true; - /* display('Thorsoft of Letchworth presents:'+^c+^m+^m+ - 'The medival descendant of'+^m+ - 'Denarius Avaricius Sextus'+^m+'in:'+ - ^m+^m+'LORD AVALOT D''ARGENT'+ - ^m+'version '+vernum+^m+^m+'Copyright ' - +copyright+', Mark, Mike and Thomas Thurman.');*/ - display(string("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + - "The medival descendant of" + '\15' + - "Denarius Avaricius Sextus" + - '\15' + '\15' + "version " + vernum + '\15' + '\15' + "Copyright " - + copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); - aboutscroll = false; - } - break; - case vb_undress: - if (dna.wearing == nowt) display("You're already stark naked!"); - else if (dna.avvys_in_the_cupboard) { - display(string("You take off ") + get_better(dna.wearing) + '.'); - dna.wearing = nowt; - objectlist; - } else - display("Hadn't you better find somewhere more private, Avvy?"); - break; - case vb_wear: - if (holding()) { - /* wear something */ - switch (thing) { - case chastity: - display("Hey, what kind of a weirdo are you\??!"); - break; - case clothes: - case habit: { /* Change this! */ - if (dna.wearing != nowt) { - if (dna.wearing == thing) - display("You're already wearing that."); - else - display(string("You'll be rather warm wearing two ") + - "sets of clothes!"); - return; - } else - dna.wearing = thing; - objectlist; - if (thing == habit) fv = 3; - else fv = 0; - { - void &with = tr[1]; - if (whichsprite != fv) { - sx = tr[1].x; - sy = tr[1].y; - done; - init(fv, true); - appear(sx, sy, left); - tr[1].visible = false; - } - } - } - break; - default: - display(what); - } - } - break; - case vb_play: - if (thing == pardon) - switch (dna.room) { /* They just typed "play"... */ - case r__argentpub: - play_nim; - break; /* ...in the pub, => play Nim. */ - case r__musicroom: - play_harp(); - break; - } - else if (holding()) { - switch (thing) { - case lute : { - dixi('U', 7); - if (whereis[pcwytalot] == dna.room) dixi('U', 10); - if (whereis[pdulustie] == dna.room) dixi('U', 15); - } - break; - case '\64' : - if (dna.room == r__musicroom) play_harp(); - else display(what); - break; - case '\67' : - if (dna.room == r__argentpub) play_nim; - else display(what); - break; - default: - display(what); - } - } - break; - case vb_ring: - if (holding()) { - if (thing == bell) { - display("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((dna.ringing_bells) & (flagset('B'))) - display("(Are you trying to join in, Avvy\?\?!)"); - } else display(what); - } - break; - case vb_help: - boot_help; - break; - case vb_larrypass: - display("Wrong game!"); - break; - case vb_phaon: - display("Hello, Phaon!"); - break; - case vb_boss: - bosskey; - break; - case vb_pee: - if (flagset('P')) { - display("Hmm, I don't think anyone will notice..."); - set_up_timer(4, procurinate, reason_gototoilet); - } else display("It would be \6VERY\22 unwise to do that here, Avvy!"); - break; - case vb_cheat: { - display(string('\6') + "Cheat mode now enabled."); - cheat = true; - } - break; - case vb_magic: - if (dna.avaricius_talk > 0) - dixi('q', 19); - else { - if ((dna.room == 12) & (infield(2))) { - /* Avaricius appears! */ - dixi('q', 17); - if (whereis['\227'] == 12) - dixi('q', 18); - else { - tr[2].init(1, false); /* Avaricius */ - apped(2, 4); - tr[2].walkto(5); - tr[2].call_eachstep = true; - tr[2].eachstep = procback_and_forth; - dna.avaricius_talk = 14; - set_up_timer(177, procavaricius_talks, reason_avariciustalks); - } - } else display("Nothing appears to happen..."); - } - break; - case vb_smartalec: - display("Listen, smart alec, that was just rhetoric."); - break; - case vb_expletive: { - switch (swore) { - case 0: - display(string("Avvy! Do you mind? There might be kids playing!\r\r") + - "(I shouldn't say it again, if I were you!)"); - break; - case 1: - display(string("You hear a distant rumble of thunder. Must you always ") + - "do things I tell you not to?\r\rDon't do it again!"); - break; - default: { - zonk; - display(string("A crack of lightning shoots from the sky, ") + - "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); - gameover; - } - } - swore += 1; - } - break; - case vb_listen: - if ((dna.ringing_bells) & (flagset('B'))) - display(string("All other noise is drowned out by the ringing of ") + - "the bells."); - else if (listen == "") - display("You can't hear anything much at the moment, Avvy."); - else display(listen); - break; - case vb_buy: { - /* What are they trying to buy? */ - switch (dna.room) { - case r__argentpub: - if (infield(6)) { - /* We're in a pub, and near the bar. */ - switch (thing) { - case '\63': - case '\65': - case '\66': - case '\72': { /* Beer, whisky, cider or mead */ - if (dna.malagauche == 177) { /* Already getting us one. */ - dixi('D', 15); - return; - } - if (dna.teetotal) { - dixi('D', 6); - return; - } - if (dna.alcohol == 0) points(3); - show_one(12); - display(booze[thing] + ", please.\231\2"); - dna.drinking = thing; - - show_one(10); - dna.malagauche = 177; - set_up_timer(27, procbuydrinks, reason_drinks); - } - break; - case '\64': - examine(); - break; /* We have a right one here- buy Pepsi??! */ - case wine: - if (dna.obj[wine]) /* We've already got the wine! */ - dixi('D', 2); /* 1 bottle's shufishent! */ - else { - if (dna.malagauche == 177) { /* Already getting us one. */ - dixi('D', 15); - return; - } - if (dna.carrying >= maxobjs) { - display("Your hands are full."); - return; - } - show_one(12); - display("Wine, please.\231\2"); - if (dna.alcohol == 0) points(3); - show_one(10); - dna.malagauche = 177; - - set_up_timer(27, procbuywine, reason_drinks); - } - break; - } - } else dixi('D', 5); - break; /* Go to the bar! */ - - case r__outsideducks: - if (infield(6)) { - if (thing == onion) { - if (dna.obj[onion]) - dixi('D', 10); /* not planning to juggle with the things! */ - else if (dna.carrying >= maxobjs) - display("Before you ask, you remember that your hands are full."); - else { - if (dna.bought_onion) - dixi('D', 11); - else { - dixi('D', 9); - points(3); - } - pennycheck(3); /* It costs thruppence. */ - dna.obj[onion] = true; - objectlist; - dna.bought_onion = true; - dna.rotten_onion = false; /* It's OK when it leaves the stall! */ - dna.onion_in_vinegar = false; - } - } else dixi('D', 0); - } else dixi('D', 0); - break; - - case r__nottspub: - dixi('n', 15); - break; /* Can't sell to southerners. */ - default: - dixi('D', 0); /* Can't buy that. */ - } - } - break; - case vb_attack: { - if ((dna.room == r__brummieroad) && - ((person == '\235') || (thing == crossbow) || (thing == bolt)) - && (whereis['\235'] == dna.room)) { - switch (ord(dna.obj[bolt]) + ord(dna.obj[crossbow]) * 2) { - /* 0 = neither, 1 = only bolt, 2 = only crossbow, - 3 = both. */ - case 0: { - dixi('Q', 10); - display("(At the very least, don't use your bare hands!)"); - } - break; - case 1: - display(string("Attack him with only a crossbow bolt? Are you ") + - "planning on playing darts?!"); - break; - case 2: - display(string("Come on, Avvy! You're not going to get very far ") + - "with only a crossbow!"); - break; - case 3: { - dixi('Q', 11); - dna.cwytalot_gone = true; - dna.obj[bolt] = false; - dna.obj[crossbow] = false; - objectlist; - magics[12].op = nix; - points(7); - tr[2].walkto(2); - tr[2].vanishifstill = true; - tr[2].call_eachstep = false; - whereis['\235'] = 177; - } - break; - default: - dixi('Q', 10); /* Please try not to be so violent! */ - } - } else dixi('Q', 10); - } - break; - case vb_password: - if (dna.room != r__bridge) - dixi('Q', 12); - else { - ok = true; - for (ff = 1; ff <= length(thats); ff ++) - for (fv = 1; fv <= length(words[dna.pass_num + first_password].w); fv ++) - if (words[dna.pass_num + first_password].w[fv] != - upcase(realwords[ff][fv])) - ok = false; - if (ok) { - if (dna.drawbridge_open != 0) - display("Contrary to your expectations, the drawbridge fails to close again."); - else { - points(4); - display("The drawbridge opens!"); - set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); - dna.drawbridge_open = 1; - } - } else dixi('Q', 12); - } - break; - case vb_dir: - dir(realwords[2]); - break; - case vb_die: - gameover; - break; - case vb_score: - display(string("Your score is ") + strf(dna.score) + ",\3\rout of a " + - "possible 128.\r\rThis gives you a rank of " + rank() + - ".\r\r" + totaltime()); - break; - case vb_put: - putproc(); - break; - case vb_stand: - stand_up(); - break; - - case vb_kiss: - if (person == pardon) - display("Kiss whom?"); - else if (personshere()) - switch (person) { - case '\226' ... '\256': - display("Hey, what kind of a weirdo are you??"); - break; - case parkata: - dixi('U', 12); - break; - case pgeida: - dixi('U', 13); - break; - case pwisewoman: - dixi('U', 14); - break; - default: - dixi('U', 5); /* You WHAT? */ - } - break; - - case vb_climb: - if (dna.room == r__insidecardiffcastle) cardiff_climbing(); - else /* In the wrong room! */ - display("Not with your head for heights, Avvy!"); - break; - - case vb_jump: { - set_up_timer(1, procjump, reason_jumping); - dna.user_moves_avvy = false; - } - break; - - case vb_highscores: - show_highs; - break; - - case vb_wake: - if (personshere()) - switch (person) { - case pardon: - case pavalot: - case '\0': - if (~ avvy_is_awake) { - avvy_is_awake = true; - points(1); - avvy_in_bed = true; - show_one(3); /* Picture of Avvy, awake in bed. */ - if (teetotal) dixi('d', 13); - } else display("You're already awake, Avvy!"); - break; - case payles: - if (~ ayles_is_awake) display("You can't seem to wake him by yourself."); - break; - case pjacques: - display(string("Brother Jacques, Brother Jacques, are you asleep?\231\2") + - "Hmmm... that doesn't seem to do any good..."); - break; - default: - display("It's difficult to awaken people who aren't asleep...!"); - } - break; - - case vb_sit: - if (dna.room == r__nottspub) { - if (dna.sitting_in_pub) - display("You're already sitting!"); - else { - tr[1].walkto(4); /* Move Avvy to the place, and sit him down. */ - set_up_timer(1, procavvy_sit_down, reason_sitting_down); - } - } else { - /* Default doodah. */ - dusk; - hang_around_for_a_while; - dawn; - display("A few hours later...\20nothing much has happened..."); - } - break; - - case vb_restart: - if (ask("Restart game and lose changes?")) { - dusk; - newgame; - dawn; - } - break; - - case pardon: - display("Hey, a verb would be helpful!"); - break; - - case vb_hello: { - person_speaks(); - display("Hello.\2"); - } - break; - case vb_thanks: { - person_speaks(); - display("That's OK.\2"); - } - break; - default: - display(string('\7') + "Parser bug!"); - } -} - -void verbopt(char n, string &answer, char &anskey) { - switch (n) { - case vb_exam: { - answer = "Examine"; - anskey = 'x'; - } - break; /* the ubiqutous one */ - /* vb_give isn't dealt with by this procedure, but by ddm__with */ - case vb_drink: { - answer = "Drink"; - anskey = 'D'; - } - break; - case vb_wear: { - answer = "Wear"; - anskey = 'W'; - } - break; - case vb_ring: { - answer = "Ring"; - anskey = 'R'; - } - break; /* only the bell! */ - case vb_play: { - answer = "Play"; - anskey = 'P'; - } - break; - case vb_eat: { - answer = "Eat"; - anskey = 'E'; - } - break; - default: { - answer = "? Unknown!"; /* Bug! */ - anskey = '?'; - } - } -} - -class unit_acci_initialize { -public: - unit_acci_initialize(); -}; -static unit_acci_initialize acci_constructor; - -unit_acci_initialize::unit_acci_initialize() { - weirdword = false; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h deleted file mode 100644 index c80f09d9b98c..000000000000 --- a/engines/avalanche/acci.h +++ /dev/null @@ -1,296 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __acci_h__ -#define __acci_h__ - -namespace Avalanche { - -/* verb codes */ -const char vb_exam = '\1'; -const char vb_open = '\2'; -const char vb_pause = '\3'; -const char vb_get = '\4'; -const char vb_drop = '\5'; -const char vb_inv = '\6'; -const char vb_talk = '\7'; -const char vb_give = '\10'; -const char vb_drink = '\11'; -const char vb_load = '\12'; -const char vb_save = '\13'; -const char vb_pay = '\14'; -const char vb_look = '\15'; -const char vb_break = '\16'; -const char vb_quit = '\17'; -const char vb_sit = '\20'; -const char vb_stand = '\21'; -const char vb_go = '\22'; -const char vb_info = '\23'; -const char vb_undress = '\24'; -const char vb_wear = '\25'; -const char vb_play = '\26'; -const char vb_ring = '\27'; -const char vb_help = '\30'; -const char vb_larrypass = '\31'; -const char vb_phaon = '\32'; -const char vb_boss = '\33'; -const char vb_pee = '\34'; -const char vb_cheat = '\35'; -const char vb_magic = '\36'; -const char vb_restart = '\37'; -const char vb_eat = '\40'; -const char vb_listen = '\41'; -const char vb_buy = '\42'; -const char vb_attack = '\43'; -const char vb_password = '\44'; -const char vb_dir = '\45'; -const char vb_die = '\46'; -const char vb_score = '\47'; -const char vb_put = '\50'; -const char vb_kiss = '\51'; -const char vb_climb = '\52'; -const char vb_jump = '\53'; -const char vb_highscores = '\54'; -const char vb_wake = '\55'; -const char vb_hello = '\56'; -const char vb_thanks = '\57'; - -const char vb_smartalec = '\371'; -const char vb_expletive = '\375'; - -const char pardon = '\376'; /* =didn't understand / wasn't given. */ - -struct vocab { - byte n; - varying_string<11> w; -}; - -struct ranktype { - word score; - varying_string<12> title; -}; - - -const integer nowords = 277; /* how many words does the parser know? */ -const char nowt = '\372'; -const char moved = '\0'; /* This word was moved. (Usually because it was the subject of - conversation.) */ - -const integer first_password = 89; /* Words[first_password] should equal "TIROS". */ - -const array<1, nowords, vocab> words = - - /* Verbs, 1-49 */ -{ { {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ - {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, - {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ - {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, - {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, - {7, "SAY"}, {7, "ASK"}, - {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, - {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, - {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, - {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, - {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, - {17, "STAND"}, - - {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, - {20, "DOFF"}, - {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, - {22, "PLAY"}, - {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, - {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, - {255, "NINET"}, /* block for NINETY */ - {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, - {30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"}, - {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, - {30, "WIZZY"}, {30, "PLOVER"}, - {30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"}, - {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, - {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, - {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, - {30, "BONESCROLLS"}, {30, "RADOF"}, - - {31, "RESTART"}, - {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, - {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, - {34, "ORDER"}, {34, "DEMAND"}, - {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, - {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, - {35, "FIRE"}, - - /* Passwords, 36: */ - - {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, - {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, - {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, - {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, - {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, - {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, - {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, - {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, - {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, - {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, - - {37, "DIR"}, {37, "LS"}, {38, "DIE"}, - {39, "SCORE"}, - {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, - {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, - {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, - {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, - {46, "HELLO"}, {46, "HI"}, {46, "YO"}, - {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ - - - /* Nouns - Objects: 50-100. */ - - {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, - {50, "VINEGAR"}, {51, "MONEYBAG"}, - {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, - {51, "WALLET"}, - {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, - {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, - {55, "ARROW"}, {55, "DART"}, - {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, - {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, - {59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"}, - {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, - {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, - {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, - {66, "DISGUISE"}, {67, "ONION"}, - - {99, "PASSWORD"}, - - /* Objects from Also are placed between 101 and 131. */ - - /* Nouns - People - Male, 150-174 */ - {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, - {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, - {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, - {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, - {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ - {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, - {154, "MALAGAUCHE"}, - {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, - {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, - {157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"}, - {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, - {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, - {161, "STALLHOLDER"}, - {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, - {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, - {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, - - /* Nouns- People - Female: 175-199 */ - {175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"}, - {176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"}, - {178, "WITCH"}, - - /* Pronouns, 200-224 */ - {200, "HIM"}, {200, "MAN"}, {200, "GUY"}, - {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, - {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, - {202, "IT"}, {202, "THING"}, - - {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, - - /* Prepositions, 225-249 */ - {225, "TO"}, {226, "AT"}, {227, "UP"}, - {228, "INTO"}, {228, "INSIDE"}, {229, "OFF"}, - {230, "UP"}, {231, "DOWN"}, {232, "ON"}, - - - /* Please, 251 */ - {251, "PLEASE"}, - - /* About, 252 */ - {252, "ABOUT"}, {252, "CONCERNING"}, - - /* Swear words, 253 */ - /* I M P O R T A N T M E S S A G E - - DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE - DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. - GOODNESS KNOWS WHO WROTE THEM. - READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. - WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ - - {253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"}, - {253, "FART"}, {253, "FUCK"}, {253, "BALLS"}, - {253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"}, - {253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"}, - {253, "SMEG"}, - /* and other even ruder words. You didn't read them, did you? Good. */ - - /* Answer-back smart-alec words, 249 */ - {249, "YES"}, {249, "NO"}, {249, "BECAUSE"}, - - /* Noise words, 255 */ - {255, "THE"}, {255, 'A'}, {255, "NOW"}, - {255, "SOME"}, {255, "AND"}, {255, "THAT"}, - {255, "POCUS"}, {255, "HIS"}, - {255, "THIS"}, {255, "SENTINEL"} - } -}; /* for "Ken SENT Me" */ - -const char what[] = "That's not possible!"; - -const array<1, 9, ranktype> ranks = { - { {0, "Beginner"}, {10, "Novice"}, - {20, "Improving"}, {35, "Not bad"}, - {50, "Passable"}, {65, "Good"}, - {80, "Experienced"}, {108, "The BEST!"}, - {maxint, "copyright'93"} - } -}; - - -#ifdef __acci_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN varying_string<11> thats; -EXTERN varying_string<20> unknown; -EXTERN array<1, 11, varying_string<20> > realwords; -EXTERN char verb, person, thing, thing2; -EXTERN boolean polite; -#undef EXTERN -#define EXTERN extern - - -void clearwords(); -void parse(); -void lookaround(); -void opendoor(); -void do_that(); -void verbopt(char n, string &answer, char &anskey); -void have_a_drink(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/also.cpp b/engines/avalanche/also.cpp deleted file mode 100644 index af3b6c325e78..000000000000 --- a/engines/avalanche/also.cpp +++ /dev/null @@ -1,1412 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Rodent.h"*/ -/*#include "Crt.h"*/ - -/*$R+,V-*/ - -namespace Avalanche { - -typedef matrix<0, 255, 0, 15, byte> fonttype; - -class fieldtype { -public: - integer x1, y1, x2, y2; -}; - -class linetype : public fieldtype { -public: - byte col; -}; - -struct pedtype { - integer x, y; - byte dir; -}; - -struct magictype { - byte op; /* one of the operations */ - word data; /* data for them */ -}; - -const integer numlines = 50; -const integer up = 0; -const integer right = 1; -const integer down = 2; -const integer left = 3; -const integer ur = 4; -const integer dr = 5; -const integer dl = 6; -const integer ul = 7; -const integer still = 8; - -const integer nay = maxint; - -/* Magic commands are */ - -/*N*/ const integer nix = 0; /* ignore it if this line is touched */ -/*B*/ const integer bounce = 1; /* bounce off this line */ -/*E*/ const integer exclaim = 2; /* put up a chain of scrolls */ -/*T*/ const integer transport = 3; /* enter new room */ -/*U*/ const integer unfinished = 4; /* unfinished connection */ -/*S*/ const integer special = 5; /* special call */ -/*O*/ const integer opendoor = 6; /* slowly opening door. */ - -integer gd, gm; -array<1, numlines, linetype> lines; -array<1, numlines, fieldtype> fields; -boolean do1; -byte current; -string n; -matrix<0, 29, 1, 2, string> names; -file f; -fonttype skinny; -byte tx, ty; -matrix<0, 79, 0, 22, char> chars; -byte cursorflash; -array<1, 15, pedtype> peds; -array<1, 15, magictype> magics; -array<9, 15, magictype> portals; -varying_string<26> flags; -string listen; - -const graphcursmasktype crosshairs = { - ((63551, 63807, 63807, 63807, 61727, 257, 897, 32765, 897, 257, 61727, 63807, 63807, 63807, 63551, 65535), - (4368, 21140, 8840, 53910, 640, 640, 31868, 33026, 31868, 640, 640, 53910, 8840, 21140, 4368, 0)), - 7, - 7 -}; - -const graphcursmasktype hook = { - ((32831, 32831, 49279, 49279, 57599, 61695, 61471, 61447, 63491, 57089, 36801, 32771, 49159, 57375, 63743, 65535), - (0, 16256, 7936, 7936, 3584, 1536, 1792, 2016, 248, 28, 8220, 12344, 8160, 1792, 0, 0)), - 2, - 9 -}; - -const graphcursmasktype tthand = { - ((62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443), - (3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092)), - 4, - 0 -}; - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void glimpse(byte ret) { /* glimpse of screen 3 */ - char sink; - hidemousecursor; - setvisualpage(3); - setcrtpagenumber(3); - showmousecursor; - do { - } while (!(~ anymousekeypressed)); - do { - } while (!anymousekeypressed); - hidemousecursor; - setvisualpage(ret); - setcrtpagenumber(ret); - showmousecursor; - while (keypressed()) sink = readkey(); -} - -void newline(byte t, integer p, integer q, integer r, integer s, byte c) { - { - linetype &with = lines[t]; - x1 = p; - y1 = q; - x2 = r; - y2 = s; - with.col = c; - } -} - -void newfield(byte t, integer p, integer q, integer r, integer s) { - { - fieldtype &with = fields[t]; ; - with.x1 = p; - with.y1 = q; - with.x2 = r; - with.y2 = s; - } -} - -void drawped(byte p) { - { - pedtype &with = peds[p]; - if (with.dir < 177) { - setcolor(p); - circle(with.x, with.y, 5); - moveto(with.x, with.y); - switch (with.dir) { - case up: - linerel(0, -5); - break; - case down: - linerel(0, 5); - break; - case left: - linerel(-7, 0); - break; - case right: - linerel(7, 0); - break; - case ul: - linerel(-7, -5); - break; - case dl: - linerel(-7, 5); - break; - case ur: - linerel(7, -5); - break; - case dr: - linerel(7, 5); - break; - } - } - } -} - -void drawup() { - byte fv; - cleardevice(); - for (fv = 1; fv <= numlines; fv ++) { - linetype &with = lines[fv]; - if (x1 != nay) { - setcolor(with.col); - line(x1, y1, x2, y2); - } - } - for (fv = 1; fv <= numlines; fv ++) { - fieldtype &with = fields[fv]; - if (with.x1 != nay) { - setcolor(fv); - rectangle(with.x1, with.y1, with.x2, with.y2); - } - } - for (fv = 1; fv <= 15; fv ++) drawped(fv); -} - -void addped() { - byte n, fv; - n = 0; - do { - n += 1; - } while (!((n == 16) || (peds[n].dir == 177))); - setcrtpagenumber(0); - setactivepage(0); - setvisualpage(0); - drawup(); - setgraphicscursor(tthand); - showmousecursor; - do { - if (rightmousekeypressed) return; - if (keypressed()) glimpse(0); - } while (!leftmousekeypressed); - hidemousecursor; - { - pedtype &with = peds[n]; - with.x = mousex; - with.y = mousey; - } - cleardevice(); - setfillstyle(6, 9); - for (fv = 1; fv <= 3; fv ++) bar(200 * fv, 0, 200 * fv, 200); - for (fv = 1; fv <= 2; fv ++) bar(0, 60 * fv, 640, 60 * fv); - showmousecursor; - do { - if (rightmousekeypressed) return; - } while (!leftmousekeypressed); - hidemousecursor; - { - pedtype &with = peds[n]; - switch (((mousex / 200) * 10) + (mousey / 60)) { - case 0: - with.dir = ul; - break; - case 10: - with.dir = up; - break; - case 20: - with.dir = ur; - break; - case 1: - with.dir = left; - break; - case 11: - with.dir = still; - break; - case 21: - with.dir = right; - break; - case 2: - with.dir = dl; - break; - case 12: - with.dir = down; - break; - case 22: - with.dir = dr; - break; - } - } -} - -void addline(byte ccc) { - byte fv; - do { - for (fv = 1; fv <= numlines; fv ++) { - linetype &with = lines[fv]; - if (x1 == nay) { - x1 = fv * 17; - x2 = x1; - y1 = 200; - y2 = 190; - with.col = ccc; - return; /* bad style! */ - } - } - } while (!false); -} - -byte colour() { - byte fv; - byte colour_result; - setactivepage(0); - setvisualpage(0); - setcrtpagenumber(0); - outtextxy(0, 0, "Select a colour, please..."); - for (fv = 1; fv <= 15; fv ++) { - setfillstyle(1, fv); - bar(fv * 40, 27, 39 + fv * 40, 200); - } - showmousecursor; - do { - if (rightmousekeypressed) { - hidemousecursor; - return colour_result; - } - if (keypressed()) glimpse(2); - } while (!leftmousekeypressed); - hidemousecursor; - colour_result = getpixel(mousex, mousey); - cleardevice(); - return colour_result; -} - -void addfield() { - byte fv; - boolean ok; - do { - fv = colour(); - ok = fields[fv].x1 == nay; - if (! ok) output << '\7'; - } while (!ok); - { - fieldtype &with = fields[fv]; - with.x1 = 300 + fv * 17; - with.x2 = with.x1 + 1; - with.y1 = 200; - with.y2 = 177; - } -} - -byte checkline() { - byte fv, ans; - byte checkline_result; - setgraphicscursor(crosshairs); - setcrtpagenumber(0); - setactivepage(0); - setvisualpage(0); - drawup(); - do { - showmousecursor; - do { - if (rightmousekeypressed) { - checkline_result = 255; - return checkline_result; - } - if (keypressed()) glimpse(0); - } while (!leftmousekeypressed); - hidemousecursor; - setactivepage(1); - ans = 177; - for (fv = 1; fv <= numlines; fv ++) { /* */ - { - linetype &with = lines[fv]; - if (x1 != nay) { - setcolor(9); - line(x1, y1, x2, y2); - if (getpixel(mousex, mousey) == 9) ans = fv; - setcolor(0); - line(x1, y1, x2, y2); - } - } - { - fieldtype &with = fields[fv]; - if (with.x1 != nay) { - setcolor(9); - rectangle(with.x1, with.y1, with.x2, with.y2); - if (getpixel(mousex, mousey) == 9) ans = fv + 100; - setcolor(0); - rectangle(with.x1, with.y1, with.x2, with.y2); - } - } - } - setactivepage(0); - } while (!(ans != 177)); - checkline_result = ans; - return checkline_result; -} - -void chooseside(); -static boolean itsaline; - -static void plotline() { - if (itsaline) { - linetype &with = lines[gd]; - if (do1) line(mousex, mousey, x2, y2); - else - line(x1, y1, mousex, mousey); - } else { - fieldtype &with = fields[gd]; - if (do1) rectangle(mousex, mousey, with.x2, with.y2); - else - rectangle(with.x1, with.y1, mousex, mousey); - } -} - -void chooseside() { - byte clicol, savelcol; - fieldtype current; - integer temp; - do { - gd = checkline(); - itsaline = gd < 100; - if (gd == 255) { - hidemousecursor; - return; - } - if (! itsaline) gd -= 100; - setactivepage(2); - setvisualpage(2); - cleardevice(); - setgraphicscursor(tthand); - setcrtpagenumber(2); - if (itsaline) { - current = lines[gd]; - savelcol = lines[gd].col; - } else current = fields[gd]; - { - setcolor(9); - if (itsaline) line(current.x1, current.y1, current.x2, current.y2); - else rectangle(current.x1, current.y1, current.x2, current.y2); - setcolor(9); - setfillstyle(1, red); - bar(current.x1 - 3, current.y1 - 3, current.x1 + 3, current.y1 + 3); - setfillstyle(1, green); - bar(current.x2 - 3, current.y2 - 3, current.x2 + 3, current.y2 + 3); - do { - } while (!(~ anymousekeypressed)); - clicol = 177; - showmousecursor; - do { - if (anymousekeypressed) { - hidemousecursor; - clicol = getpixel(mousex, mousey); - showmousecursor; - } - if (rightmousekeypressed) { - hidemousecursor; - return; - } - if (keypressed()) glimpse(2); - } while (!(set::of(red, green, eos).has(clicol))); - do1 = clicol == red; - hidemousecursor; - setgraphicscursor(hook); - setcrtpagenumber(0); - setactivepage(0); - setvisualpage(0); - setcolor(0); - if (itsaline) { - linetype &with1 = lines[gd]; ; - line(current.x1, current.y1, current.x2, current.y2); - setcolor(with1.col); - } else { - fieldtype &with1 = fields[gd]; ; - rectangle(with1.x1, with1.y1, with1.x2, with1.y2); - setcolor(gd); - } - setwritemode(xorput); - while (~ anymousekeypressed) { - plotline(); - showmousecursor; - delay(1); - hidemousecursor; - plotline(); - if (rightmousekeypressed) { - hidemousecursor; - return; - } - if (keypressed()) glimpse(0); - } - /* update "current" rec */ - if (do1) { - current.x1 = mousex; - current.y1 = mousey; - } else { - current.x2 = mousex; - current.y2 = mousey; - } - if (! itsaline) { - if (current.x1 > current.x2) { - temp = current.x2; - current.x2 = current.x1; - current.x1 = temp; - } - if (current.y1 > current.y2) { - temp = current.y2; - current.y2 = current.y1; - current.y1 = temp; - } - } - /* copy "current" to line/field */ - if (itsaline) { - linetype &with1 = lines[gd]; - current.x1 = current.x1; - current.x2 = current.x2; - current.y1 = current.y1; - current.y2 = current.y2; - with1.col = savelcol; - } else fields[gd] = current; - } - setwritemode(0); - } while (!false); -} - -void delped() { - setcrtpagenumber(0); - setactivepage(0); - setvisualpage(0); - drawup(); - setgraphicscursor(tthand); - showmousecursor; - do { - } while (!leftmousekeypressed); - peds[colour()].dir = 177; -} - -byte menu(); - -static void say(byte y, string x) { - setfillstyle(1, y); - bar(0, y * 17, 100, y * 17 + 15); - outtextxy(123, y * 17, x); -} - -byte menu() { - byte clicol; - byte menu_result; - setcolor(15); - settextstyle(0, 0, 2); - clicol = 0; - setgraphicscursor(tthand); - setvisualpage(2); - setactivepage(2); - setcrtpagenumber(2); - cleardevice(); - say(3, "Move lines around"); - say(4, "Add a new line"); - say(5, "Delete a line"); - say(6, "Add a ped"); - say(7, "Delete a ped"); - say(8, "Add a field"); - say(10, "Return to Also."); - showmousecursor; - do { - if (leftmousekeypressed) { - hidemousecursor; - clicol = getpixel(mousex, mousey); - showmousecursor; - } - if (rightmousekeypressed) { - hidemousecursor; - return menu_result; - } - if (keypressed()) glimpse(2); - } while (!(clicol > 0)); - do { - } while (!(~ anymousekeypressed)); - hidemousecursor; - menu_result = clicol; - return menu_result; -} - -void removeline() { - gd = checkline(); - if (gd == 255) { - hidemousecursor; - return; - } - if (gd > 100) - fields[gd - 100].x1 = nay; - else lines[gd].x1 = nay; /* cancels it out */ - cleardevice(); - drawup(); -} - -void lino() { - resetmouse; - do { - switch (menu()) { - case 3: - chooseside(); - break; - case 4: - addline(colour()); - break; - case 5: - removeline(); - break; - case 6: - addped(); - break; - case 7: - delped(); - break; - case 8: - addfield(); - break; - case 10: - return; - break; - } - } while (!false); -} - -void loadscreen() { /* load2 */ - byte a /*absolute $A000:246560*/; - byte bit; - untyped_file f; - setactivepage(3); - setvisualpage(3); - assign(f, string("c:\\avalot\\place") + n + ".avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 12080); - } - close(f); - setvisualpage(0); - outtextxy(0, 190, "Look carefully, and then press any key..."); - setactivepage(0); -} - -void ctrlsout(string &x) { /* Replace real ctrls with caret codes */ - byte fv; - string xx; - xx = ""; - for (fv = 1; fv <= length(x); fv ++) - if (x[fv] > '\37') xx = xx + x[fv]; - else xx = xx + '^' + chr(ord(x[fv]) + 64); - x = xx; -} - -void ctrlsin(string &x) { /* Opposite of ctrlsout */ - byte fv; - string xx; - boolean ctrlwas; - xx = ""; - ctrlwas = false; - for (fv = 1; fv <= length(x); fv ++) - if (ctrlwas) { /* last char was a caret */ - xx = xx + chr(ord(upcase(x[fv])) - 64); - ctrlwas = false; - } else { - ; /* last char wasn't a caret... */ - if (x[fv] == '^') ctrlwas = true; - else /* ...but this one is */ - xx = xx + x[fv]; /* ...but this one isn't */ - } - x = xx; -} - -void flipover() { /* temp view other screen */ - char r; - setvisualpage(3); - r = readkey(); - setvisualpage(0); -} - -void plotchar(byte x, byte y, char n) { - byte fv; - if (chars[x][y] == n) return; - for (fv = 0; fv <= 15; fv ++) - mem[0xa000 * y * 1200 + (fv + 3) * 80 + x] = skinny[ord(n)][fv]; - chars[x][y] = n; -} - -void cursor() { - byte fv; - cursorflash += 1; - switch (cursorflash) { - case 1: - case 127: - for (fv = 12; fv <= 14; fv ++) - mem[0xa000 * ty * 1200 + (3 + fv) * 80 + tx] = ~(mem[0xa000 * ty * 1200 + (3 + fv) * 80 + tx]); - break; - case 255: - cursorflash = 0; - break; - } -} - -void losecursor() { - if (cursorflash < 127) { - cursorflash = 126; - cursor(); - } - cursorflash = 0; -} - -void gwrite(string x) { - byte fv; - for (fv = 1; fv <= length(x); fv ++) { - plotchar(tx, ty, x[fv]); - tx += 1; - if (tx == 80) { - ty += 1; - tx = 0; - } - } -} - -string typein(string x) { - const char marker = '\2'; - byte p; - char r; - string typein_result; - setvisualpage(0); - setactivepage(0); - cleardevice(); - settextstyle(0, 0, 1); - setcolor(15); - outtextxy(0, 0, "Press TAB to see the room..."); - outtextxy(0, 20, "You may use any of these Control Codes:"); - outtextxy(30, 30, "Anywhere: ^M = new line, ^P = new scroll, |1 fix to speaker 1."); - outtextxy(90, 40, "^B = new bubble"); - outtextxy(30, 50, "At end of line: ^C = centre line, ^L = left justify."); - outtextxy(30, 60, "At end of scroll: ^D = Don't add automatic ^P here."); - outtextxy(0, 80, "(Use by typing in (eg for ^P) ^ then P, not Ctrl-P.)"); - p = 0; - ctrlsout(x); - fillchar(chars, sizeof(chars), '\40'); - do { - tx = 0; - ty = 6; - gwrite(x + '\4' + '\40'); - tx = (p % 80); - ty = (p / 80) + 6; - while (! keypressed()) { - delay(1); - cursor(); - } - losecursor(); - r = readkey(); - switch (r) { - case '\10': - if (p > 0) { - x = copy(x, 1, p - 1) + copy(x, p + 1, 255); - p -= 1; - } - break; /* backspace */ - case '\11': - flipover(); - break; - case '\40' ... '\377': { - x = copy(x, 1, p) + r + copy(x, p + 1, 255); - p += 1; - } - break; - case '\0': - switch (readkey()) { /* extd. keystroke */ - case 'G': - p = 0; - break; /* Home */ - case 'K': - if (p > 0) p -= 1; - break; /* left */ - case 'M': - if (p < length(x)) p += 1; - break; /* right */ - case 'H': - if (p > 80) p -= 80; - break; /* up */ - case 'P': - if (p < length(x) - 80) p += 80; - break; /* down */ - case 'O': - p = length(x); - break; /* End */ - case 'S': - x = copy(x, 1, p) + copy(x, p + 2, 255); - break; /* Del */ - } - break; - } - } while (!(r == '\15')); - ctrlsin(x); - typein_result = x; - return typein_result; -} - -byte typeno(string title) { - varying_string<2> x; - char r; - integer e; - word p; - byte typeno_result; - cleardevice(); - x = "000"; - settextstyle(0, 0, 3); - setcolor(9); - outtextxy(0, 0, title); - setfillstyle(1, 0); - setcolor(10); - fillchar(chars, sizeof(chars), '\40'); - do { - bar(100, 100, 150, 125); - outtextxy(100, 100, x); - do { - r = readkey(); - } while (!(set::of(range('0', '9'), '\33', '\15', eos).has(r))); - if (r == '\33') { - typeno_result = 255; - return typeno_result; - } - if (r != '\15') x = string(x[2]) + r; - } while (!(r == '\15')); - val(x, p, e); - typeno_result = p; - return typeno_result; -} - -void showallnames() { - byte fv; - varying_string<2> s; - char r; - settextstyle(0, 0, 2); - cleardevice(); - setcolor(13); - outtextxy(0, 0, "Descriptions start..."); - settextstyle(0, 0, 1); - setcolor(7); - for (fv = 1; fv <= 29; fv ++) { - str(fv, 2, s); - outtextxy((fv / 15) * 320, ((fv % 15) * 10) + 30, s + '=' + copy(names[fv][1], 0, 33)); - } - setcolor(15); - outtextxy(500, 190, "Press any key..."); - r = readkey(); -} - -void showallassoc(); - - -static void saascreen() { - settextstyle(0, 0, 2); - cleardevice(); - setcolor(10); - outtextxy(0, 0, "Everything..."); - settextstyle(0, 0, 1); - setcolor(2); - outtextxy(17, 20, "(Format: : : )"); -} - -void showallassoc() { - byte fv; - varying_string<2> s; - char r; - - saascreen(); - for (fv = 1; fv <= 30; fv ++) { - str(fv - 1, 2, s); - outtextxy(0, (((fv - 1) % 10) * 10) + 30, - s + ':' + copy(names[fv - 1][1], 1, 7) + ':' + copy(names[fv - 1][2], 1, 70)); - if ((fv % 10) == 0) { - r = readkey(); - saascreen(); - } - } - setcolor(15); - outtextxy(500, 190, "Press any key..."); - r = readkey(); -} - -void clear() { - byte fv; - fillchar(names , sizeof(names), '\0'); - for (fv = 1; fv <= numlines; fv ++) { - lines[fv].x1 = nay; - fields[fv].x1 = nay; - } - fillchar(peds , sizeof(peds), '\261'); -} - -void scramble(); - -static void scram1(string &x) { - byte fz; - for (fz = 1; fz <= length(x); fz ++) - x[fz] = chr(ord(x[fz]) ^ 177); -} - -void scramble() { /* Works both ways. */ - byte fv, ff; - for (fv = 0; fv <= 29; fv ++) - for (ff = 1; ff <= 2; ff ++) - scram1(names[fv][ff]); - scram1(listen); - scram1(flags); -} - -void save() { - string x; - untyped_file f; - byte minnames, minlines, minpeds, minfields, fv, ff; - minnames = 0; - for (fv = 0; fv <= 29; fv ++) if (names[fv][1] != "") minnames = fv; - minlines = 0; - for (fv = 1; fv <= numlines; fv ++) - if (lines[fv].x1 != nay) minlines = fv; - minpeds = 0; - for (fv = 1; fv <= 15; fv ++) if (peds[fv].dir < 177) minpeds = fv; - minfields = 0; - for (fv = 1; fv <= 30; fv ++) if (fields[fv].x1 != nay) minfields = fv; - assign(f, string("c:\\avalot\\also") + n + ".avd"); - rewrite(f, 1); - x = string("This is an Also .AVD file, which belongs to AVALOT.EXE. Its contents") + - '\15' + '\12' + "are subject to copyright, so there. Have fun!" + '\32' + " *Minstrel* "; - blockwrite(f, x[1], 128); - scramble(); - blockwrite(f, minnames, 1); - for (fv = 0; fv <= minnames; fv ++) - for (ff = 1; ff <= 2; ff ++) - blockwrite(f, names[fv][ff], length(names[fv][ff]) + 1); - blockwrite(f, minlines, 1); - blockwrite(f, lines, sizeof(lines[1])*minlines); - blockwrite(f, minpeds, 1); - blockwrite(f, peds, sizeof(peds[1])*minpeds); - blockwrite(f, minfields, 1); - blockwrite(f, fields, sizeof(fields[1])*minfields); - blockwrite(f, magics, sizeof(magics)); - blockwrite(f, portals, sizeof(portals)); - blockwrite(f, flags, sizeof(flags)); - blockwrite(f, listen[0], 1); - blockwrite(f, listen[1], length(listen)); - close(f); - scramble(); -} - -void load(); -static untyped_file f; - - -static string nextstring() { - byte l; - string x; - string nextstring_result; - x = ""; - blockread(f, l, 1); - blockread(f, x[1], l); - x[0] = chr(l); - nextstring_result = x; - return nextstring_result; -} - -void load() { - byte minnames, minlines, minpeds, minfields; - byte ff, fv; - - clear(); - assign(f, string("c:\\avalot\\also") + n + ".avd"); - /*$I-*/ reset(f, 1); /*$I+*/ if (ioresult != 0) return; /* no Also file */ - seek(f, 128); - blockread(f, minnames, 1); - for (fv = 0; fv <= minnames; fv ++) - for (ff = 1; ff <= 2; ff ++) - names[fv][ff] = nextstring(); - blockread(f, minlines, 1); - blockread(f, lines, sizeof(lines[1])*minlines); - blockread(f, minpeds, 1); - blockread(f, peds, sizeof(peds[1])*minpeds); - blockread(f, minfields, 1); - blockread(f, fields, sizeof(fields[1])*minfields); - blockread(f, magics, sizeof(magics)); - blockread(f, portals, sizeof(portals)); - blockread(f, flags, sizeof(flags)); - blockread(f, listen[0], 1); - blockread(f, listen[1], length(listen)); - close(f); - scramble(); -} - -void editmagics(); -const array<1, 15, char> codes = "123456789ABCDEF"; - -static integer y; - - -static void display() { - byte fv; - cleardevice(); - settextstyle(0, 0, 2); - setcolor(15); - outtextxy(0, 0, "Magics."); - settextstyle(0, 0, 1); - for (fv = 1; fv <= 15; fv ++) { - y = 23 + fv * 10; - setcolor(fv); - outtextxy(100, y, string('$') + codes[fv - 1]); - { - magictype &with = magics[fv]; - switch (with.op) { - case nix: { - setcolor(8); - outtextxy(140, y, "Nix"); - } - break; - case bounce: { - setcolor(10); - outtextxy(143, y, "Bounce!"); - } - break; - case exclaim: { - setcolor(14); - outtextxy(143, y, string("Exclaim: ") + strf(with.data)); - } - break; - case transport: { - setcolor(12); - outtextxy(143, y, string("Transport to ") + strf(hi(with.data)) + - ", ped " + strf(lo(with.data))); - } - break; - case unfinished: { - setcolor(15); - outtextxy(143, y, "*** UNFINISHED! ***"); - } - break; - case special: { - setcolor(6); - outtextxy(143, y, string("Special call no. ") + strf(with.data)); - } - break; - case opendoor: { - setcolor(11); - outtextxy(143, y, string("Opening door to ") + strf(hi(with.data)) + - ", ped " + strf(lo(with.data))); - } - break; - } - } - } - outtextxy(177, 190, "Which do you want to change\? (Esc=Exit) $"); -} - - - -static word ask(string x) { - string q; - word thomaswashere; - integer e; - word ask_result; - cleardevice(); - setcolor(10); - settextstyle(0, 0, 3); - outtextxy(0, 100, x); - do { - input >> q >> NL; - val(q, thomaswashere, e); - } while (!(e == 0)); - ask_result = thomaswashere; - return ask_result; -} - -void editmagics() { - char r, rr; - byte p; - - do { - display(); - do { - r = upcase(readkey()); - if (r == '\33') return; - p = pos(r, codes); /* which are we editing? */ - } while (!(p > 0)); /* it must BE there... */ - setcolor(p); - cleardevice(); - outtextxy(177, 17, string("Editing magic $") + r + '.'); - outtextxy(0, 30, "New operation ( (N)ix, (B)ounce, (E)xclaim, (T)ransport, (U)nfinished),"); - outtextxy(30, 40, "(S)pecial, (O)pening Door?"); - do { - rr = upcase(readkey()); - } while (!(set::of('N', 'B', 'E', 'T', 'U', 'S', 'O', '\33', eos).has(rr))); - { - magictype &with = magics[p]; - switch (rr) { - case '\33': - return; - break; /* cancelling code */ - case 'N': - with.op = nix; - break; - case 'B': - with.op = bounce; - break; - case 'E': { - with.op = exclaim; - with.data = ask("Which scroll?"); - } - break; - case 'T': { - with.op = transport; - with.data = ask("Ped no.?") + ask("Whither?") * 256; - } - break; - case 'U': - with.op = unfinished; - break; - case 'S': { - with.op = special; - with.data = ask("Which call?"); - } - break; - case 'O': { - with.op = opendoor; - with.data = ask("Ped no.?") + ask("Whither?") * 256; - } - break; - } - } - } while (!false); -} - -void editportals(); -const array<9, 15, char> codes1 = "9ABCDEF"; - -static integer y2; - - -static void display1() { - byte fv; - cleardevice(); - settextstyle(0, 0, 2); - setcolor(15); - outtextxy(0, 0, "Portals."); - settextstyle(0, 0, 1); - for (fv = 9; fv <= 15; fv ++) { - y2 = fv * 10 - 53; - setcolor(fv); - outtextxy(100, y2, string('$') + codes1[fv - 1]); - { - magictype &with = portals[fv]; - switch (with.op) { - case nix: { - setcolor(8); - outtextxy(140, y2, "Nix"); - } - break; - case exclaim: { - setcolor(14); - outtextxy(143, y2, string("Exclaim: ") + strf(with.data)); - } - break; - case transport: { - setcolor(12); - outtextxy(143, y2, string("Transport to ") + strf(hi(with.data)) + - ", ped " + strf(lo(with.data))); - } - break; - case unfinished: { - setcolor(15); - outtextxy(143, y2, "*** UNFINISHED! ***"); - } - break; - case special: { - setcolor(6); - outtextxy(143, y2, string("Special call no. ") + strf(with.data)); - } - break; - case opendoor: { - setcolor(11); - outtextxy(143, y2, string("Opening door to ") + strf(hi(with.data)) + - ", ped " + strf(lo(with.data))); - } - break; - } - } - } - outtextxy(177, 190, "Which do you want to change\? (Esc=Exit) $"); -} - - - -static word ask1(string x) { - string q; - word thomaswashere; - integer e; - word ask1_result; - cleardevice(); - setcolor(10); - settextstyle(0, 0, 3); - outtextxy(0, 100, x); - do { - input >> q >> NL; - val(q, thomaswashere, e); - } while (!(e == 0)); - ask1_result = thomaswashere; - return ask1_result; -} - -void editportals() { /* much t'same as editmagics */ - char r, rr; - byte p; - - do { - display1(); - do { - r = upcase(readkey()); - if (r == '\33') return; - p = pos(r, codes1); /* which are we editing? */ - } while (!(p > 0)); /* it must BE there... */ - p += 8; - setcolor(p); - cleardevice(); - outtextxy(177, 17, string("Editing portal $") + r + '.'); - outtextxy(0, 30, "New operation ( (N)ix, (E)xclaim, (T)ransport, (U)nfinished),"); - outtextxy(30, 40, "(S)pecial, (O)pening Door?"); - do { - rr = upcase(readkey()); - } while (!(set::of('N', 'E', 'T', 'U', 'S', 'O', '\33', eos).has(rr))); - { - magictype &with = portals[p]; - switch (rr) { - case '\33': - return; - break; /* cancelling code */ - case 'N': - with.op = nix; - break; - case 'E': { - with.op = exclaim; - with.data = ask1("Which scroll?"); - } - break; - case 'T': { - with.op = transport; - with.data = ask1("Ped no.?") + ask1("Whither?") * 256; - } - break; - case 'U': - with.op = unfinished; - break; - case 'S': { - with.op = special; - with.data = ask1("Which call?"); - } - break; - case 'O': { - with.op = opendoor; - with.data = ask1("Ped no.?") + ask1("Whither?") * 256; - } - break; - } - } - } while (!false); -} - -void editflags() { - char r; - cleardevice(); - settextstyle(0, 0, 2); - setcolor(15); - outtextxy(0, 0, "Flags."); - settextstyle(0, 0, 1); - setcolor(10); - outtextxy(100, 30, "Press the letter of the flag you want to toggle."); - outtextxy(100, 40, "Tab = flip screens, Esc/Enter = return to menu."); - setcolor(14); - setfillstyle(1, 0); - for (r = 'A'; r <= 'Z'; r ++) - if (pos(r, flags) > 0) outtextxy(ord(r) * 20 - 1223, 77, r); - do { - do { - r = upcase(readkey()); - } while (!(set::of(range('A', 'Z'), '\33', '\15', '\11', eos).has(r))); - switch (r) { - case RANGE_26('A', 'Z'): { - if (pos(r, flags) > 0) { - ; /* flag is on- switch it off */ - Delete(flags, pos(r, flags), 1); - bar(ord(r) * 20 - 1223, 77, ord(r) * 20 - 1213, 87); - sound(1777); - delay(7); - nosound; - } else { - ; /* flag is off- switch it on */ - flags = flags + r; - outtextxy(ord(r) * 20 - 1223, 77, r); - sound(177); - delay(7); - nosound; - } - } - break; - case '\33': - case '\15': - return; - break; - case '\11': - flipover(); - break; - } - } while (!false); -} - -void alsomenu() { - char r; - byte t; - do { - setactivepage(0); - setvisualpage(0); - cleardevice(); - setcolor(15); - settextstyle(0, 0, 2); - outtextxy(0, 0, "Also... Main Menu"); - settextstyle(0, 0, 1); - setcolor(10); - outtextxy(100, 40, "1) Edit the names of an object"); - outtextxy(100, 50, "2) View all names"); - outtextxy(100, 60, "3) Edit the description of this object"); - outtextxy(100, 70, "4) View all associations."); - outtextxy(100, 80, "5) Enter Lino mode."); - outtextxy(100, 90, "6) Edit magics."); - outtextxy(100, 100, "7) Edit portals."); - outtextxy(100, 110, "8) Edit flags."); - outtextxy(100, 120, "9) Edit listen field."); - outtextxy(100, 160, "S) Save"); - outtextxy(100, 170, "L) Load"); - outtextxy(80, 180, "Tab) View other screen"); - if (current == 0) outtextxy(0, 140, "< Main description of room >"); - else - outtextxy(0, 140, string('<') + names[current][1] + '>'); - do { - r = upcase(readkey()); - if (r == '\11') flipover(); - } while (!(set::of(range('1', '9'), 'S', 'L', '\0', eos).has(r))); - switch (r) { - case '1': { - do { - t = typeno("Which object\? (0-30)"); - } while (!((t < 30) || (t == 255))); - if ((t != 255) && (t != 0)) names[t][1] = typein(names[t][1]); - current = t; - } - break; - case '2': - showallnames(); - break; - case '3': - names[current][2] = typein(names[current][2]); - break; - case '4': - showallassoc(); - break; - case '5': - lino(); - break; - case '6': - editmagics(); - break; - case '7': - editportals(); - break; - case '8': - editflags(); - break; - case '9': - listen = typein(listen); - break; - case 'S': - save(); - break; - case 'L': - load(); - break; - case '\0': - if (readkey() == '\55') return; - break; - } - } while (!false); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "*** ALSO ***" << NL; - output << NL; - output << "No. of screen to edit?"; - input >> n >> NL; - load(); - assign(f, "v:avalot.fnt"); - reset(f); - f >> skinny; - close(f); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - current = 0; - loadscreen(); - alsomenu(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor.cpp b/engines/avalanche/andexor.cpp deleted file mode 100644 index 74b5967f1b45..000000000000 --- a/engines/avalanche/andexor.cpp +++ /dev/null @@ -1,152 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Trippancy IV - original file */ -#include "graph.h" - -namespace Avalanche { - -const integer taboo = cyan; - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of all the pictures */ -}; - - -integer gd, gm; -adxtype adx; -matrix<1, 24, 0, 1, pointer> adxpic; /* the pictures themselves */ -untyped_file f; -string x; -byte n; - -void load(string nam) { - byte z; - array<1, 4, pointer> a; - untyped_file f; - word s; - varying_string<40> xxx; - string check; - - assign(f, nam); - reset(f, 1); - blockread(f, xxx, 41); - blockread(f, check, 13); - blockread(f, check, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(a[z], s); - blockread(f, a[z], s); - putimage(0, 15 + (z - 1) * 75, a[z], 0); - freemem(a[z], s); - } - close(f); -} - -void silhouette() { - byte x, y, c; - setvisualpage(1); - setactivepage(1); - setfillstyle(1, 15); - for (gm = 0; gm <= 3; gm ++) - for (gd = 1; gd <= 6; gd ++) { - ; /* 26,15 */ - /* bar((gm div 2)*320+gd*40,20+(gm mod 2)*40,(gm div 2)*320+gd*40+35,(gm mod 2)*40+60); */ - for (y = 1; y <= adx.yl; y ++) - for (x = 1; x <= adx.xl; x ++) { - setactivepage(0); - c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); - setactivepage(1); - /* if c<>taboo then putpixel((gm div 2)*320+gd*40+x,20+(gm mod 2)*40+y,0); */ - if (c == taboo) putpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y, 15); - } - getmem(adxpic[gm * 6 + gd][0], adx.size); - getimage((gm / 2) * 320 + gd * 40 + 1, 20 + (gm % 2) * 40 + 1, - (gm / 2) * 320 + gd * 40 + adx.xl, 20 + (gm % 2) * 40 + adx.yl, - adxpic[gm * 6 + gd][0]); - } -} - -void standard() { - byte x, y, c; - setvisualpage(2); - setactivepage(2); - for (gm = 0; gm <= 3; gm ++) - for (gd = 1; gd <= 6; gd ++) { - ; /* 26,15 */ - for (y = 1; y <= adx.yl; y ++) - for (x = 1; x <= adx.xl; x ++) { - setactivepage(0); - c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); - setactivepage(2); - if (c != taboo) putpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y, c); - } - getmem(adxpic[gm * 6 + gd][1], adx.size); - getimage((gm / 2) * 320 + gd * 40 + 1, 20 + (gm % 2) * 40 + 1, - (gm / 2) * 320 + gd * 40 + adx.xl, 20 + (gm % 2) * 40 + adx.yl, - adxpic[gm * 6 + gd][1]); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - fillchar(adxpic, sizeof(adxpic), '\261'); - load("v:avalots.avd"); - /* getmem(adxpic[1,1,1],adx.size); getimage(40,20,75,60,adxpic[1,1,1]^); - putimage(100,100,adxpic[1,1,1]^,0); */ - { - adx.name = "Avalot"; - adx.num = 24; - adx.seq = 6; - adx.xl = 32; - adx.yl = 35; /* 35,40 */ - - adx.size = imagesize(40, 20, 40 + adx.xl, 60 + adx.yl); - } - silhouette(); - standard(); - x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; - assign(f, "v:sprite1.avd"); - rewrite(f, 1); - blockwrite(f, x[1], 59); - blockwrite(f, adx, sizeof(adx)); - for (gd = 1; gd <= adx.num; gd ++) - for (gm = 0; gm <= 1; gm ++) - blockwrite(f, adxpic[gd][gm], adx.size); /* next image */ - close(f); - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andexor2.cpp b/engines/avalanche/andexor2.cpp deleted file mode 100644 index 27c62cf0363f..000000000000 --- a/engines/avalanche/andexor2.cpp +++ /dev/null @@ -1,165 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Trippancy IV - original file */ -#include "graph.h" - -namespace Avalanche { - -const integer taboo = cyan; - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of all the pictures */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - - -integer gd, gm; -adxtype adx; -array<0, 1, pointer> adxpic; /* the pictures themselves */ -untyped_file f; -string x; -byte n; -integer side2; -word bigsize; - -void load(string n) { - byte z; - array<1, 4, pointer> a; - untyped_file f; - word s; - varying_string<40> xxx; - string check; - - assign(f, n); - reset(f, 1); - blockread(f, xxx, 41); - blockread(f, check, 13); - blockread(f, check, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(a[z], s); - blockread(f, a[z], s); - putimage(0, 15 + (z - 1) * 75, a[z], 0); - freemem(a[z], s); - } - close(f); -} - -void silhouette() { - byte x, y, c; - setvisualpage(1); - setactivepage(1); - setfillstyle(1, 15); - { - for (gm = 0; gm <= 3; gm ++) - for (gd = 1; gd <= 6; gd ++) { - ; /* 26,15 */ - side2 = adx.xl * 6; - for (y = 1; y <= adx.yl; y ++) - for (x = 1; x <= adx.xl; x ++) { - setactivepage(0); - c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); - setactivepage(1); - if (c == taboo) - putpixel((gm / 2)*side2 + gd * adx.xl + x, 20 + (gm % 2)*adx.yl + y, 15); - } - } - bigsize = imagesize(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2); - getmem(adxpic[0], bigsize); - getimage(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2, adxpic[0]); - putimage(adx.xl + 1, 21, adxpic[0], notput); - } -} - -void standard() { - byte x, y, c; - setvisualpage(2); - setactivepage(2); - { - for (gm = 0; gm <= 3; gm ++) - for (gd = 1; gd <= 6; gd ++) { - ; /* 26,15 */ - for (y = 1; y <= adx.yl; y ++) - for (x = 1; x <= adx.xl; x ++) { - setactivepage(0); - c = getpixel((gm / 2) * 320 + gd * 40 + x, 20 + (gm % 2) * 40 + y); - setactivepage(2); - if (c != taboo) - putpixel((gm / 2)*side2 + gd * adx.xl + x, 20 + (gm % 2)*adx.yl + y, c); - } - /* getmem(adxpic[gm*6+gd,1],adx.size); - getimage((gm div 2)*side2+gd*xl+x,20+(gm mod 2)*yl+y, - (gm div 2)*side2+gd*xl*2+x,20+(gm mod 2)*yl*2+y, - adxpic[gm*6+gd,1]^); */ - } - getmem(adxpic[1], bigsize); - getimage(adx.xl + 1, 21, adx.xl * 13, 20 + adx.yl * 2, adxpic[1]); - putimage(adx.xl + 1, 21, adxpic[1], notput); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - fillchar(adxpic, sizeof(adxpic), '\261'); - load("v:avalots.avd"); - { - adx.name = "Avalot"; - adx.num = 24; - adx.seq = 6; - adx.xl = 33; - adx.yl = 35; /* 35,40 */ - adx.fgc = yellow; - adx.bgc = red; - - adx.size = imagesize(40, 20, 40 + adx.xl, 60 + adx.yl); - } - silhouette(); - standard(); - x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; - assign(f, "v:sprite1.avd"); - rewrite(f, 1); - blockwrite(f, x[1], 59); - blockwrite(f, adx, sizeof(adx)); - blockwrite(f, bigsize, 2); - for (gm = 0; gm <= 1; gm ++) { - putimage(0, 0, adxpic[gm], 0); - blockwrite(f, adxpic[gm], bigsize); /* next image */ - } - close(f); - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/andextst.cpp b/engines/avalanche/andextst.cpp deleted file mode 100644 index 39ba3df4056e..000000000000 --- a/engines/avalanche/andextst.cpp +++ /dev/null @@ -1,100 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -typedef matrix<1, 24, 0, 1, pointer> adxtype; - -integer gd, gm; -word s; -untyped_file f; -byte n, anim, cp, t; -array<0, 0, adxtype> adx; -array<0, 1, pointer> back; -integer x; -array<0, 1, integer> ox; - -void andex(integer x, integer y, byte n, byte num) { - putimage(x, y, adx[num][n][0], andput); - putimage(x, y, adx[num][n][1], xorput); -} - -void loadadx(byte num, string x) { - byte n; - assign(f, x); - reset(f, 1); - seek(f, 59); - blockread(f, n, 1); /* No. of images... */ - for (gd = 1; gd <= n; gd ++) - for (gm = 0; gm <= 1; gm ++) { - blockread(f, s, 2); /* size of next image... */ - getmem(adx[num][gd][gm], s); - blockread(f, adx[num][gd][gm], s); /* next image */ - } - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - loadadx(0, "d:sprite0.avd"); - loadadx(1, "d:sprite0.avd"); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - for (gd = 0; gd <= 1; gd ++) { - setactivepage(gd); - setfillstyle(6, 1); - bar(0, 0, 640, 200); - getmem(back[gd], s); - } - x = 0; - anim = 1; - cp = 0; - t = 2; - setactivepage(0); - do { - setactivepage(cp); - setvisualpage(1 - cp); - for (gm = 0; gm <= 1; gm ++) { - if (t > 0) t -= 1; - else - putimage(ox[cp], 77, back[cp], copyput); - getimage(x, 77, x + 31, 77 + 35, back[cp]); - andex(x, 177, anim + 6, gm); - ox[gm][cp] = x; - x += 5; - } - anim += 1; - if (anim == 7) anim = 1; - cp = 1 - cp; - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.cpp b/engines/avalanche/arch.cpp deleted file mode 100644 index 1f0e1a4bde4e..000000000000 --- a/engines/avalanche/arch.cpp +++ /dev/null @@ -1,146 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - ENID Edna's manager. */ - -#define __arch_implementation__ -/* Loads/ saves files. */ - -#include "arch.h" - - -/*#include "Dos.h"*/ -#include "scrolls.h" - -namespace Avalanche { - -struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS. See below for others.) */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ -const string crlf = string('\15') + '\12'; - -const array<1, 177, char> ednafirst = - string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + crlf + - '\32' + /* 67 bytes... */ - crlf + crlf + /* 71 bytes... */ - "12345678901234567890123456789012345678901234567890" + - "12345678901234567890123456789012345678901234567890" + - "123456"; - -const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; -const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; - -const integer ttage = 18; -const char ttwashere[] = "Thomas was here "; - -void save(string name) { - untyped_file f; - edhead eh; - word groi; - string groi2; - fillchar(eh, sizeof(eh), '\261'); /* Fill up the edhead */ - - dna.saves += 1; /* It's been saved one more time... */ - - { - - /* Info about this program */ - - id = ednaid; /* Edna's signature */ - revision = 2; /* Second revision of .ASG format */ - game = "Lord Avalot d'Argent"; /* Title of game */ - shortname = "Avalot"; - number = 2; /* Second Avvy game */ - ver = 100; /* Version 1.00 */ - verstr = "1.00"; /* ditto */ - filename = "AVALOT.EXE"; /* program's filename */ - os = 1; /* Saved under DOS */ - - /* Info on this particular game */ - - fsplit(name, groi2, fn, groi2); /* fn = filename of this game */ - getdate(d, m, y, groi); /* Day, month & year when the game was saved */ - desc = roomname; /* Description of game (same as in Avaricius!) */ - len = sizeof(dna); /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - saves = dna.saves; /* no. of times this game has been saved */ - cash = dna.pence; /* contents of your wallet in numerical form */ - money = lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ - points = dna.score; /* your score */ - } - - assign(f, name); - rewrite(f, 1); - - blockwrite(f, ednafirst, 177); - blockwrite(f, eh, sizeof(eh)); - blockwrite(f, dna, sizeof(dna)); - - for (groi = 1; groi <= ttage; groi ++) - blockwrite(f, ttwashere, sizeof(ttwashere)); - - close(f); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/arch.h b/engines/avalanche/arch.h deleted file mode 100644 index 3bff07ad2cd7..000000000000 --- a/engines/avalanche/arch.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __arch_h__ -#define __arch_h__ - - -#include "gyro.h" - -namespace Avalanche { - -void save(string name); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/avalot9.cpp b/engines/avalanche/avalot9.cpp deleted file mode 100644 index 7351d0806079..000000000000 --- a/engines/avalanche/avalot9.cpp +++ /dev/null @@ -1,174 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - AVALOT The kernel of the program. */ - - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Trip5.h"*/ -/*#include "Gyro.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Scrolls.h"*/ -/*#include "Basher.h"*/ -/*#include "Dropdown.h"*/ -/*#include "Pingo.h"*/ -/*#include "Logger.h"*/ -/*#include "Timeout.h"*/ -/*#include "Celer.h"*/ -/*#include "Enid.h"*/ -/*#include "Incline.h"*/ -/*#include "Closing.h"*/ -/*#include "Visa.h"*/ - - -namespace Avalanche { - -void setup() { - integer gd, gm; - - checkbreak = false; - visible = m_no; - to_do = 0; - lmo = false; - resetscroll; - Randomize(); - setup_vmc; - on_virtual; - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - holdthedawn = true; - dusk; - cmp = 177; - mouse_init; /*on;*/ dropsok = true; - ctrl = ckey; - oldjw = 177; - mousetext = ""; - c = 999; - settextjustify(0, 0); - ddmnow = false; - load_digits; - cheat = false; - cp = 0; - curpos = 1; - quote = true; - ledstatus = 177; - defaultled = 2; - /* TSkellern:=0; { Replace with a more local variable sometime }*/ - dna.rw = stopped; - enid_filename = ""; /* undefined. */ - toolbar; - state(2); - copy03; - lastscore = "TJA"; - - /* for gd:=0 to 1 do - begin - setactivepage(gd); outtextxy(7,177,chr(48+gd)); - end;*/ - - loadtrip; - - if ((filetoload == "") & (~ reloaded)) - newgame; /* no game was requested- load the default */ - else { - if (~ reloaded) avvy_background; - standard_bar; - sprite_run; - if (reloaded) edna_reload; - else { - /* Filename given on the command line (or loadfirst) */ - edna_load(filetoload); - if (there_was_a_problem) { - display("So let's start from the beginning instead..."); - holdthedawn = true; - dusk; - newgame; - } - } - } - - if (~ reloaded) { - soundfx = ~ soundfx; - fxtoggle; - thinkabout(money, a_thing); - } - - get_back_loretta; - gm = getpixel(0, 0); - setcolor(7); - holdthedawn = false; - dawn; - cursoron = false; - cursor_on; - newspeed; - - if (~ reloaded) - dixi('q', 83); /* Info on the game, etc. */ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - - do { - - clock; - keyboard_link; - menu_link; - readstick; - force_numlock; - get_back_loretta; - trippancy_link; - pics_link; - checkclick; - - if (visible == m_virtual) plot_vmc(mx, my, cp); - flip_page; /* << fonttype; - -fonttype font; -word storage_seg, storage_ofs; -byte result; -string registrant; - -void icons() { - untyped_file f; - word gd, gm; - byte bit; - byte v; - - assign(f, "menu.avd"); - reset(f, 1); - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (gd = 70; gd <= 266; gd ++) - blockread(f, mem[0xa000 * gd * 80 + 6], 9); - - for (gd = 0; gd <= 32; gd ++) { - blockread(f, v, 1); - for (gm = 0; gm <= 5; gm ++) - mem[0xa000 * 73 + ((70 + gd + gm * 33) * 80)] = v; /* 79 */ - } - - } - close(f); - - bit = getpixel(0, 0); - - setfillstyle(1, 7); - for (gd = 0; gd <= 5; gd ++) bar(114, 73 + gd * 33, 583, 99 + gd * 33); - setfillstyle(1, 15); - for (gd = 0; gd <= 5; gd ++) bar(114, 70 + gd * 33, 583, 72 + gd * 33); - setfillstyle(1, 8); - for (gd = 0; gd <= 5; gd ++) bar(114, 100 + gd * 33, 583, 102 + gd * 33); - -} - -void load_regi_info(); - - -static char decode1(char c) { - byte b; - - char decode1_result; - b = ord(c) - 32; - decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; -} - - - -static char decode2(char c) { - char decode2_result; - decode2_result = chr(((ord(c) & 0xf) << 2) + 0x43); - return decode2_result; -} - - - -static boolean checker(string proper, string check) { - byte fv; - boolean ok; - - boolean checker_result; - ok = true; - for (fv = 1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) - ok = false; - - checker_result = ok; - return checker_result; -} - -void load_regi_info() { - text t; - byte fv; - string x; - byte namelen, numlen; - string namechk, numchk; - string reginum; - - - /*$I-*/ - assign(t, "register.dat"); - reset(t); - /*$I+*/ - - if (ioresult != 0) { - registrant = "(Unregistered evaluation copy.)"; - return; - } - - for (fv = 1; fv <= 53; fv ++) t >> NL; - t >> x >> NL; - close(t); - - namelen = 107 - ord(x[1]); - numlen = 107 - ord(x[2]); - - registrant = copy(x, 3, namelen); - reginum = copy(x, 4 + namelen, numlen); - namechk = copy(x, 4 + namelen + numlen, namelen); - numchk = copy(x, 4 + namelen + numlen + namelen, numlen); - - for (fv = 1; fv <= namelen; fv ++) registrant[fv] = decode1(registrant[fv]); - for (fv = 1; fv <= numlen; fv ++) reginum[fv] = decode1(reginum[fv]); - - if ((! checker(registrant, namechk)) || (! checker(reginum, numchk))) - registrant = "\?\"!\? ((.)"; - else - registrant = registrant + " (" + reginum + ")."; - -} - -void flesh_colours() { - ; /* assembler; -asm - mov ax,$1012; - mov bx,21; { 21 = light pink (why?) */ - /* mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; - - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. */ - /*int $10; - - jmp @TheEnd; - - @flesh: - db 56,35,35; - - @darkflesh: - db 43,22,22; - - @TheEnd: */ -} - -void setup() { - integer gd, gm; - file ff; - - if (paramstr(1) != "jsb") exit(255); - checkbreak = false; - val(paramstr(2), storage_seg, gd); - val(paramstr(3), storage_ofs, gd); - - assign(ff, "avalot.fnt"); - reset(ff); - ff >> font; - close(ff); - - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - setvisualpage(1); - - icons(); -} - -void big(word x, word y, string z, boolean notted); -static word start, image; - - -static void generate(byte from, boolean ¬ted) { - byte fv; - - image = 0; - for (fv = 0; fv <= 7; fv ++) - image += (from & (1 << fv)) << fv; - - image += image << 1; - image = hi(image) + lo(image) * 256; - if (notted) image = ~ image; -} - -void big(word x, word y, string z, boolean notted) { - byte fv, ff; - byte bit; - - start = x + y * 80; - - for (fv = 1; fv <= length(z); fv ++) { - for (ff = 1; ff <= 12; ff ++) { - generate(font[z[fv]][ff + 1], notted); - for (bit = 0; bit <= 2; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - memw[0xa000 * start + ff * 160] = image; - memw[0xa000 * start + 80 + ff * 160] = image; - } - } - start += 2; - } - bit = getpixel(0, 0); -} - -void centre(integer y, string z) { - big(40 - (length(z)), y, z, false); -} - -void option(byte which, string what) { - big(16, 41 + which * 33, string((char)(which + 48)) + ')', true); - big(24, 41 + which * 33, what, true); -} - -void invert(integer x1, integer y1, integer x2, integer y2) { - word s; - pointer p; - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - putimage(x1, y1, p, 4); - sound(y1); - delay(30); - sound(600 - y2); - delay(20); - nosound; - delay(200); - putimage(x1, y1, p, 0); - delay(250); -} - -void wait() { - word x; - char r; - boolean pressed; - - x = 0; - pressed = false; - do { - setfillstyle(6, 15); - bar(x , 330, x - 1, 337); - setfillstyle(1, 0); - bar(x - 2, 330, x - 3, 337); - delay(40); - x += 1; - - if (keypressed()) { - r = readkey(); - if (r == '\0') { - r = readkey(); /* and...? */ - } else { - /* Not an extended keystroke. */ - if (set::of(range('1', '6'), cspace, cescape, creturn, eos).has(r)) pressed = true; - } - } - - } while (!((x == 640) || pressed)); - - if ((r == cspace) || (r == creturn)) r = '1'; - if (r == cescape) r = '6'; - if (pressed) { - result = ord(r) - 48; - invert(48, 37 + result * 33, 114, 69 + result * 33); - } else result = 177; -} - -void show_up() { - setvisualpage(0); -} - -void loadmenu() { - untyped_file f; - byte bit; - - assign(f, "mainmenu.avd"); - reset(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * 0], 59 * 80); - } - close(f); - bit = getpixel(0, 0); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - loadmenu(); - load_regi_info(); - option(1, "Play the game."); - option(2, "Read the background."); - option(3, "Preview... perhaps..."); - option(4, "View the documentation."); - option(5, "Registration info."); - option(6, "Exit back to DOS."); - centre(275, registrant); - centre(303, "Make your choice, or wait for the demo."); - - show_up(); - wait(); - mem[storage_seg * storage_ofs] = result; - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans.cpp b/engines/avalanche/avvyans.cpp deleted file mode 100644 index 8e0876061e14..000000000000 --- a/engines/avalanche/avvyans.cpp +++ /dev/null @@ -1,130 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -integer gd, gm; -untyped_file f; -array<1, 16000, byte> aa; -matrix<0, 27, 0, 35, byte> cols; -text t; -string x; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - fillchar(cols, sizeof(cols), '\0'); - assign(f, "v:avvypic.ptx"); - reset(f, 1); - blockread(f, aa, filesize(f)); - close(f); - putimage(0, 0, aa, 0); - for (gd = 0; gd <= 27; gd ++) - for (gm = 0; gm <= 34; gm ++) - cols[gd][gm + 1] = getpixel(gd, gm); - - restorecrtmode(); - /* - asm - mov ax,$1003 - mov bl,0 - int $10 - end; - */ - for (gm = 0; gm <= 17; gm ++) - for (gd = 0; gd <= 27; gd ++) { - gotoxy(gd + 1, gm + 1); - if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { - textattr = cols[gd][2 * gm]; - output << ''; - } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { - textattr = cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16; - output << ''; - } else { - textattr = cols[gd][2 * gm] * 16 + cols[gd][2 * gm + 1]; - if (textattr > blink) textattr -= blink; - output << ''; - } - } - gotoxy(23, 5); - textattr = red; - output << ''; - - assign(t, "v:avalot.txt"); - reset(t); - textattr = 9; - gm = 2; - do { - gm += 1; - t >> x >> NL; - gotoxy(30, gm); - output << x << NL; - } while (!(eof(t))); - - textattr = 7; - gotoxy(35, 2); - output << "Back in good old A.D. "; - textattr = 15; - output << "1176"; - textattr = 7; - output << "..."; - textattr = 9; - gotoxy(40, 4); - output << "Lord"; - gotoxy(67, 9); - output << "d'Argent"; - textattr = yellow; - gotoxy(37, 12); - output << "He's back..."; - gotoxy(47, 14); - output << "And this time,"; - gotoxy(52, 15); - output << "he's wearing tights..."; - textattr = 4; - gotoxy(36, 17); - output << "A Thorsoft of Letchworth game. * Requires EGA"; - gotoxy(38, 18); - output << "and HD. * By Mike, Mark and Thomas Thurman."; - gotoxy(40, 19); - output << "Sfx archive- "; - textattr = 9; - output << "Download "; - textattr = 14; - output << "AVLT10.EXE"; - textattr = 9; - output << " now!"; - gotoxy(1, 1); - input >> NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvyans2.cpp b/engines/avalanche/avvyans2.cpp deleted file mode 100644 index fe238b309eaa..000000000000 --- a/engines/avalanche/avvyans2.cpp +++ /dev/null @@ -1,230 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Ansi.h"*/ - -namespace Avalanche { - -integer gd, gm; -untyped_file f; -array<1, 16000, byte> aa; -matrix<0, 27, 0, 35, byte> cols; -text t; -string x; -byte n; -byte spaces; -byte cfg, cbg; /* Current foreground & background. */ -byte ofg, obg; /* Old fg & bg. */ - -void do_spaces() { - if (spaces == 0) return; - along(spaces); - spaces = 0; -} - -void finishline(); -static byte wx, wy; - -static void jumpto(byte xx) { - along(xx - wx); -} - -void finishline() { - wx = 29 - spaces; - wy = gm + 1; - switch (wy) { - case 1: { - sgr(7); - jumpto(35); - output << "Back in good old A.D. "; - sgr(15); - output << "1189"; - sgr(7); - output << "..." << NL; - cfg = 7; - } - break; - case RANGE_5(3, 7): { - t >> x >> NL; - while (x[length(x)] == '\40') x[0] -= 1; - if (x != "") { - jumpto(30); - sgr(9); - spaces = 0; - while (x != "") { - if (x[1] == ' ') - spaces += 1; - else { - do_spaces(); - output << x[1]; - } - Delete(x, 1, 1); - } - if (wy == 7) close(t); - output << NL; - } - } - break; - case 8: { - jumpto(67); - sgr(9); - output << "d'Argent" << NL; - cfg = 9; - } - break; - case 11: { - jumpto(37); - sgr(14); - output << "He's back..." << NL; - } - break; - case 13: { - jumpto(47); - sgr(14); - output << "And this time," << NL; - } - break; - case 14: { - jumpto(52); - sgr(14); - output << "he's wearing tights..." << NL; - } - break; - case 16: { - jumpto(35); - sgr(4); - output << "A Thorsoft of Letchworth game. * Requires EGA" << NL; - } - break; - case 17: { - jumpto(37); - sgr(4); - output << "and HD. * By Mike, Mark and Thomas Thurman." << NL; - } - break; - case 18: { - jumpto(39); - sgr(4); - output << "Sfx archive- "; - sgr(9); - output << "Download "; - sgr(14); - output << "AVLT10.EXE"; - sgr(9); - output << " now!"; - } - break; - default: - output << NL; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - fillchar(cols, sizeof(cols), '\0'); - assign(f, "v:avvypic.ptx"); - reset(f, 1); - blockread(f, aa, filesize(f)); - close(f); - putimage(0, 0, aa, 0); - for (gd = 0; gd <= 27; gd ++) - for (gm = 0; gm <= 34; gm ++) - cols[gd][gm + 1] = getpixel(gd, gm); - - restorecrtmode(); - - assign(output, "v:avalot.ans"); - rewrite(output); - normal; - ed; - /* assign(output,''); rewrite(output); normal; ed;*/ - assign(t, "v:avalot.txt"); - reset(t); - - for (gm = 0; gm <= 17; gm ++) { - spaces = 0; - for (gd = 0; gd <= 27; gd ++) { - if ((gd == 22) && (gm == 4)) { - do_spaces(); - sgr(red); - output << ''; - } else { - if (cols[gd][2 * gm] == cols[gd][2 * gm + 1]) { - if (cols[gd][2 * gm] == 0) - spaces += 1; /* a blank space */ - else { - do_spaces(); - - if (cfg == cols[gd][2 * gm]) output << ''; - else if (cbg == cols[gd][2 * gm]) output << ' '; - else { - sgr((cols[gd][2 * gm]) + (cbg * 16)); - cfg = cols[gd][2 * gm]; - output << ''; - } - } - } else if ((cols[gd][2 * gm] > 7) && (cols[gd][2 * gm + 1] < 8)) { - do_spaces(); - sgr(cols[gd][2 * gm] + cols[gd][2 * gm + 1] * 16); - cfg = cols[gd][2 * gm]; - cbg = cols[gd][2 * gm + 1] * 16; - output << ''; - } else { - do_spaces(); - - ofg = cfg; - obg = cbg; - cbg = cols[gd][2 * gm]; - cfg = cols[gd][2 * gm + 1]; - - if ((cbg == ofg) && (cfg == obg)) { - n = cfg * 16 + cbg; - if (n > 128) n -= 128; - output << ''; - } else { - n = cbg * 16 + cfg; - if (n > 128) n -= 128; - if ((cfg != ofg) || (cbg != obg)) sgr(n); - output << ''; - } - - } - } - } - finishline(); - } - output << NL; - normal; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/avvymonk.cpp b/engines/avalanche/avvymonk.cpp deleted file mode 100644 index b29072f359ce..000000000000 --- a/engines/avalanche/avvymonk.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -byte z; -array<1, 4, pointer> a; -untyped_file f; -word s; -string check; -integer x, y; -void savesc() { - varying_string<40> adf; - untyped_file f; - byte z; - array<1, 2, pointer> c; - word s; - varying_string<14> nam; - varying_string<30> screenname; - nam = "v:avvymonk.avd"; - adf = string("aved as a stuff file, so there! TJAT.") + '\15' + '\12' + '\32'; - adf[0] = 'S'; - screenname = "Avalot in a monk's costume"; - assign(f, nam); /* not scrambled */ - rewrite(f, 1); - blockwrite(f, adf, 41); - blockwrite(f, nam, 13); - blockwrite(f, screenname, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(c[z], s); - getimage(0, 15 + (z - 1) * 75, getmaxx(), 15 + (z) * 75, c[z]); - blockwrite(f, c[z], s); - freemem(c[z], s); - } -} -void loadscreen(string nam) { - assign(f, nam); - reset(f, 1); - blockread(f, check, 41); - blockread(f, check, 13); - blockread(f, check, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(a[z], s); - blockread(f, a[z], s); - setactivepage(0); - putimage(0, 15 + (z - 1) * 75, a[z], 0); - freemem(a[z], s); - } - close(f); -} -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - x = 0; - y = 0; - initgraph(gd, gm, "o:"); - loadscreen("v:legion.avd"); - while (y < 100) { - switch (getpixel(x, y)) { - case 7: - putpixel(x, y, 0); - break; - case 8: - putpixel(x, y, 0); - break; - case 9: - putpixel(x, y, 15); - break; - } - x += 1; - if (x > 640) { - y += 1; - x = 0; - } - } - savesc(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/bakchunk.cpp b/engines/avalanche/bakchunk.cpp deleted file mode 100644 index 94e00da55701..000000000000 --- a/engines/avalanche/bakchunk.cpp +++ /dev/null @@ -1,59 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Celer.h"*/ -/*#include "Lucerna.h"*/ - -namespace Avalanche { - -integer gd, gm; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - setvisualpage(3); - load_chunks('1'); - - for (gd = 0; gd <= num_chunks; gd ++) - show_one_at(gd, 0, gd * 40); - - mblit(0, 0, 79, 200, 3, 0); - - gd = getpixel(0, 0); - setvisualpage(0); - setactivepage(0); - - settextstyle(0, 0, 4); - setcolor(15); - outtextxy(100, 50, "Chunk1"); - input >> NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp deleted file mode 100644 index dcab52540e16..000000000000 --- a/engines/avalanche/basher.cpp +++ /dev/null @@ -1,502 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - BASHER Handles the keyboard. */ - -#define __basher_implementation__ - - -/* Note: this unit can record keystrokes, for the demo. If you want it - to do this, define the o.c.c. RECORD. Setting gyro.demo to True will - cause them to be played back. */ - -#include "basher.h" - - -#include "enhanced.h" -#include "lucerna.h" -#include "Graph.h" -#include "scrolls.h" -#include "acci.h" -#include "trip5.h" -#include "pingo.h" -#include "dropdown.h" -#include "logger.h" -#include "Sticks.h" -#include "enid.h" - -namespace Avalanche { - -boolean entering_filename; -byte left_margin; - -void plottext() { - const array<0, 2, byte> p = {{0, 1, 3}}; - byte x, y, n; - - x = 0; - if (mouse_near_text()) super_off(); - cursor_off(); - for (n = 0; n <= 2; n ++) - for (y = 0; y <= 7; y ++) { - for (x = 1; x <= length(current); x ++) - mem[0xa000 * p[n]*pagetop + 12882 + y * 80 + x] = little[current[x]][y]; - fillchar(mem[0xa000 * p[n]*pagetop + 12883 + y * 80 + x], 77 - x, '\0'); - } - cursor_on(); - super_on(); -} - -void wipetext() { - const array<0, 2, byte> n = {{0, 1, 3}}; - byte y, p; - - if (mouse_near_text()) super_off(); - cursor_off(); - for (y = 0; y <= 7; y ++) - for (p = 0; p <= 2; p ++) - fillchar(mem[0xa000 * n[p]*pagetop + 12883 + y * 80], 77, '\0'); - quote = true; - curpos = 1; - cursor_on(); - super_on(); -} - -/*procedure cursor; -begin - if curflash=0 then - begin - if mouse_near_text then Super_Off; - cursoron:=not cursoron; - mem[$A000*13442+curpos]:=not mem[$A000*13442+curpos]; - mem[$A000*pagetop+13442+curpos]:=not mem[$A000*pagetop+13442+curpos]; - curflash:=17; - Super_On; - end else dec(curflash); -end;*/ - -void do_cursor() { - bytefield bf; - byte fv; - - mem[0xac00 * 13442 + curpos] = ~ mem[0xac00 * 13442 + curpos]; - { - bf.x1 = curpos + 1; - bf.x2 = curpos + 2; - bf.y1 = 168; - bf.y2 = 168; - } - for (fv = 0; fv <= 1; fv ++) getset[fv].remember(bf); -} - -void cursor_on() { - if (cursoron) return; - do_cursor(); - cursoron = true; -} - -void cursor_off() { - if (! cursoron) return; - do_cursor(); - cursoron = false; -} - - -void get_demorec() { - demofile >> demo_rec; - inchar = demo_rec.key; - extd = demo_rec.extd; - demo_rec.delay -= 1; -} - -#ifdef RECORD -void record_one() { - demo_rec.delay = count; - demo_rec.key = inchar; - demo_rec.extd = extd; - - demofile << demo_rec; - count = 0; -} -#endif -/* -procedure storeline(whatwhat:string); -var - fv:byte; - what:string[77]; - ok:boolean; - - function upline(x:string):string; - var fv:byte; n:string[77]; - begin - for fv:=1 to length(x) do n[fv]:=upcase(x[fv]); - n[0]:=x[0]; upline:=n; - end; -begin - - what:=upline(whatwhat); ok:=false; - for fv:=1 to 20 do - if what=upline(previous^[fv]) then - begin { it already exists, in string "fv" } - move(previous^[fv+1],previous^[fv],(20-fv)*78); - previous^[20]:=whatwhat; ok:=true; - end; - if ok then exit; - { it's not on the list, so add it } - move(previous^[2],previous^[1],1482); { shove up } - previous^[20]:=whatwhat; -end; -*/ -void typein(); - -static char firstchar(string x) { - char firstchar_result; - firstchar_result = x[1]; - return firstchar_result; -} - - -static void try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */ - parsekey(inchar, extd); -} - -void typein() { - byte w; - - inkey(); -#ifdef RECORD record_one(); #endif - - switch (inchar) { - case RANGE_15('\40', '\56'): - case '\60' ... '\337': - case '\341' ... '\377': - if (ddm_o.menunow) { - parsekey(inchar, extd); - } else { - if (length(current) < 76) { - if ((inchar == '"') || (inchar == '`')) { - if (quote) inchar = '`'; - else inchar = '"'; - quote = ! quote; /* Quote- Unquote... */ - } - insert(inchar, current, curpos); - curpos += 1; - plottext(); - } else blip(); - } - break; - case '\10': - if (! ddm_o.menunow) { - if (curpos > left_margin) { - curpos -= 1; - if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote; - Delete(current, curpos, 1); - plottext(); - } else blip(); - } - break; - case '\0': - case '\340': { - switch (extd) { - /* Function keys: */ - case cf1: - callverb(vb_help); - break; /* f1 - help (obviously) */ - case cf2: - fxtoggle(); - break; /* f2 - sound */ - case ccf2: - case cf11: { - clearwords(); - callverb(vb_save); - } - break; /* ^f2 - save */ - case cf3: - if (length(current) < length(/*previous^[20]*/last)) { /* f3 - rec last */ - current = current + copy(/*previous^[20]*/last, length(current) + 1, 255); - curpos = length(current) + 1; - plottext(); - } - break; - case ccf3: - case cf12: { - clearwords(); - callverb(vb_load); - } - break; /* ^f3 - load */ - case cf4: - callverb(vb_restart); - break; /* f4 - restart game */ - case cf5: { - person = pardon; - thing = pardon; - callverb(firstchar(f5_does())); /* f5 - get up/ whatever */ - } - break; - case cf6: - callverb(vb_pause); - break; /* f6 - pause */ - case cf7: - callverb(vb_open); - break; /* f7 - open door */ - case cf8: - callverb(vb_look); - break; /* f8 - look */ - case cf9: - callverb(vb_score); - break; /* f9 - score */ - case ccf7: - major_redraw(); - break; /* ^f7 - open door */ - case cf10: - case c_ax: - case caf4: { -#ifdef RECORD - display("Hi. You have just finished recording. GIED."); - close(demofile); - exit(0); -#endif - callverb(vb_quit); /* f10, alt-X, alt-f4 - quit */ - } - break; - case ccf5: - back_to_bootstrap(2); - break; /* ^f5 - Dos shell. */ - case csf10: - callverb(vb_info); - break; /* sf10 - version */ - - case c_ab: - callverb(vb_boss); - break; /* alt-B */ - case c_ad: - display("Wrong game!"); - break; /* alt-D */ - case ccleft: - if (curpos > left_margin) { - cursor_off(); - curpos -= 1; - cursor_on(); - } - break; /* ^left */ - case ccright: - if (curpos <= length(current)) { /* ^right */ - cursor_off(); - curpos += 1; - cursor_on(); - } - break; - case cchome: { - cursor_off(); - curpos = 1; - cursor_on(); - } - break; /* ^home */ - case ccend: { - cursor_off(); - curpos = length(current) + 1; - cursor_on(); - } - break; /* ^end */ - case c_ar: - oh = 177; - break; /* alt-R = repeater (re-chime) */ - case cup: - case cdown: - case cleft: - case cright: - case cpgup: - case cpgdn: - case chome: - case cend: - if (ddm_o.menunow) try_dd(); - else tripkey(extd); - break; /* Up/Down/Left/Right/PgUp/PgDn */ - case cnum5: - tripkey(extd); - break; /* Numeric 5 */ - case cdel: - if (! ddm_o.menunow) { - if (curpos <= length(current)) { - if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote; - Delete(current, curpos, 1); - plottext(); - } else blip(); - } - break; - default: - try_dd(); - } - } - break; - case cescape: - case '/': - if (ddm_o.menunow) { /* Escape */ - ddm_o.wipe(); - } else if (entering_filename) { - normal_edit(); - wipetext(); - } else - ddm_m.getcertain(ddm_o.menunum); - break; - case creturn: - if (ddm_o.menunow) try_dd(); /* Return */ - else { - log_command(current); - if (entering_filename) { - edna_save(copy(current, 24, 255)); - normal_edit(); - wipetext(); - } else { - if (current != "") last = current; - parse(); - do_that(); - if (! entering_filename) { - current = ""; - wipetext(); - } - } - } - break; - case '\11': - callverb(vb_inv); - break; /* Ctrl-I= inventory */ - case '\7': - errorled(); - break; - case '\25': { - current = ""; - wipetext(); - } - break; - - case '\27': { - tr[1].xs = walk; - newspeed(); - } - break; - case '\22': { - tr[1].xs = run; - newspeed(); - } - break; - - case '\2': - bosskey(); - break; - case '\12': - ctrl = cjoy; - break; /* Joystick */ - case '\13': - ctrl = ckey; - break; /* Keyboard */ - case '\3': - callverb(vb_quit); - break; /* Ctrl-C= request to quit */ - - } - showrw(); - - if (demo) get_demorec(); -} - -/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; - '': begin setvisualpage(0); write(#7); inkey; end;*/ - -void keyboard_link() { - state(defaultled); /* if defaultled=1 then on; { For the menus }*/ - joykeys(); /* Test joystick buttons- I know that's not keyboard. */ - - if (demo) { - if (keypressede()) exit(0); - if (demo_rec.delay > 0) - demo_rec.delay -= 1; - else typein(); - return; - } - -#ifdef RECORD count += 1; #endif - - if (! keypressede()) return; - if (keyboardclick) click(); - typein(); -} - -boolean demo_ready() { - boolean demo_ready_result; - if (demo_rec.delay > 0) { - slowdown(); - demo_rec.delay -= 1; - } - demo_ready_result = demo_rec.delay == 0; - return demo_ready_result; -} - -void filename_edit() { - entering_filename = true; - current = "Filename\? (Esc=cancel):"; - left_margin = 24; - curpos = 24; - plottext(); -} - -void normal_edit() { - entering_filename = false; - current = ""; - left_margin = 1; - curpos = 1; -} - -class unit_basher_initialize { -public: - unit_basher_initialize(); -}; -static unit_basher_initialize basher_constructor; - -unit_basher_initialize::unit_basher_initialize() { - /* new(previous);*/ last = ""; - normal_edit(); - - if (demo) { - assign(demofile, "demo.avd"); - reset(demofile); - } - -#ifdef RECORD - count = 0; - assign(demofile, "demo.avd"); - rewrite(demofile); -#endif - -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/basher.h b/engines/avalanche/basher.h deleted file mode 100644 index 1cc42b5b6cbf..000000000000 --- a/engines/avalanche/basher.h +++ /dev/null @@ -1,70 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __basher_h__ -#define __basher_h__ - - -#include "gyro.h" -/*#include "Tommys.h"*/ - -namespace Avalanche { - -#ifdef RECORD - -#ifdef __basher_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN word count; -#undef EXTERN -#define EXTERN extern - -#endif - -void plottext(); - -void keyboard_link(); - -void cursor_on(); - -void get_demorec(); - -boolean demo_ready(); - -void cursor_off(); - -void filename_edit(); -void normal_edit(); -#ifdef RECORD -void record_one(); -#endif - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/bootstrp.cpp b/engines/avalanche/bootstrp.cpp deleted file mode 100644 index add361327a0f..000000000000 --- a/engines/avalanche/bootstrp.cpp +++ /dev/null @@ -1,404 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ - - -/*$M 8192,0,$6000, S-*/ - -namespace Avalanche { - -enum elm {normal, musical, elmpoyten, regi, last_elm}; - -const integer run_shootemup = 1; -const integer run_dosshell = 2; -const integer run_ghostroom = 3; -const integer run_golden = 4; - -const array > runcodes = {{"et", "Go"}}; - -const integer reset_ = 0; - -const boolean jsb = true; -const boolean no_jsb = false; -const boolean bflight = true; -const boolean no_bflight = false; - - -struct { - byte operation; - word skellern; - array<1, 10000, byte> contents; -} storage; - -string arguments, demo_args, args_with_no_filename; - -boolean first_time; - -byte original_mode; -pointer old_1c; - -string segofs; - -boolean zoomy; - -longint soundcard, speed, baseaddr, irq, dma; - -void cursor_off() { /*assembler; */ - ; - /* asm - mov ah,01; { Change cursor size. */ - /* mov cx,8224; { CH & CL are now 32. */ - /* int $10; { Call the Bios */ - -} /* That's all. */ - -void cursor_on() { /*assembler; */ - ; - /* - asm - mov ah,01; { Change cursor size. */ - /* mov ch,5; { Top line is 5. */ - /* mov cl,7; { Bottom line is 7. */ - /* int $10; { Call the Bios. */ - -} - -void quit() { - cursor_on(); - exit(0); -} - -string strf(longint x) { - string q; - string strf_result; - ; - str(x, q); - strf_result = q; - return strf_result; -} - -string command_com() { - string temp; - - string command_com_result; - temp = getenv("comspec"); - if (temp == "") - output << "avvy_bootstrap: COMSPEC not defined, => cannot run Dos shell." << NL; - command_com_result = temp; - return command_com_result; -} - -void explain(byte error) { - output << " ("; - switch (error) { - case 2: - output << "it's not there"; - break; - case 8: - output << "out of memory"; - break; - default: - output << "error " << error; - } - output << ")." << NL; -} - -/*$F+*/ - -void b_flight() { /*interrupt;*/ - storage.skellern += 1; -} - -/*$F-*/ - -void bflight_on() { - storage.skellern = reset_; - setintvec(0x1c, &b_flight); -} - -void bflight_off() { - setintvec(0x1c, old_1c); -} - -void run(string what, boolean with_jsb, boolean with_bflight, elm how); - - -static string elm2str(elm how) { - string elm2str_result; - switch (how) { - case normal: - case musical: - elm2str_result = "jsb"; - break; - case regi: - elm2str_result = "REGI"; - break; - case elmpoyten: - elm2str_result = "ELMPOYTEN"; - break; - } - return elm2str_result; -} - -void run(string what, boolean with_jsb, boolean with_bflight, elm how) { - string which_dir, args; - integer error; - - - if (what == "") return; - - getdir(0, which_dir); - - if (with_jsb) { - if (how == musical) - args = elm2str(how) + ' ' + args_with_no_filename; /* FN is NOT given if musical*/ - else - args = elm2str(how) + ' ' + arguments; - } else args = ""; - - if (how == musical) args = args + strf(soundcard) + ' ' + strf(speed) + ' ' + - strf(baseaddr) + ' ' + strf(dma) + ' ' + strf(irq); - if (with_bflight) bflight_on(); - - swapvectors; - exec(what, args); - swapvectors; - cursor_off(); - - error = doserror; - - if (with_bflight) bflight_off(); - - chdir(which_dir); - - if (error != 0) { - output << "avvy_bootstrap: cannot execute " << what << '!'; - explain(error); - output << "Press Enter:"; - input >> NL; - quit(); - } -} - -void run_avalot() { - integer error; - - - bflight_on(); - - swapvectors; - exec("avalot.avx", runcodes[first_time] + arguments); - swapvectors; - - error = doserror; - - bflight_off(); - - if (error != 0) { - output << "avvy_bootstrap: error in loading AVALOT.AVX!"; - explain(error); - quit(); - } - - first_time = false; -} - -void run_the_demo() { - string args; - - args = arguments; - arguments = demo_args; /* Force the demo. */ - - run_avalot(); - - arguments = args; /* Put all back to normal again. */ - first_time = true; -} - -void get_arguments() { - byte fv; - - arguments = ""; - - for (fv = 1; fv <= paramcount; fv ++) - arguments = arguments + paramstr(fv) + ' '; - - arguments[0] -= 1; /* Get rid of the trailing space. */ - - segofs = string(' ') + strf(seg(storage)) + ' ' + strf(ofs(storage)); - - arguments = segofs + ' ' + arguments; -} - -void dos_shell() { - registers r; - - r.ax = original_mode; - intr(0x10, r); - output << NL; - output << "The Avalot Dos Shell." << NL; - output << "---------------------" << NL; - output << NL; - output << "Type EXIT to return to Avalot." << NL; - output << NL; - - cursor_on(); - run(command_com(), no_jsb, no_bflight, normal); - cursor_off(); - - output << "Please wait, restoring your game..." << NL; -} - -boolean keypressed1() { - registers r; - - boolean keypressed1_result; - r.ah = 0xb; - msdos(r); - keypressed1_result = r.al == 0xff; - return keypressed1_result; -} - -void flush_buffer() { - registers r; - r.ah = 7; - while (keypressed1()) msdos(r); -} - -void demo() { - run_the_demo(); - if (keypressed1()) return; - run("intro.avx", jsb, bflight, musical); - if (keypressed1()) return; - run("stars.avx", jsb, no_bflight, musical); - if (keypressed1()) return; - - flush_buffer(); -} - -void call_menu() { - run("stars.avx", jsb, no_bflight, musical); - flush_buffer(); - do { - run("avmenu.avx", jsb, no_bflight, normal); - - switch (storage.operation) { - case 1: - return; - break; /* Play the game. */ - case 2: - run("intro.avx", jsb, bflight, musical); - break; - case 3: - run("preview1.avd", jsb, no_bflight, normal); - break; - case 4: - run("viewdocs.avx", jsb, bflight, elmpoyten); - break; - case 5: - run("viewdocs.avx", jsb, bflight, regi); - break; - case 6: - quit(); - break; - case 177: - demo(); - break; - } - - flush_buffer(); - } while (!false); -} - -void get_slope() { - run("slope.avx", jsb, no_bflight, normal); - if (dosexitcode != 0) { - cursor_on(); - exit(0); - } - - move(storage.contents, arguments, sizeof(arguments)); - move(storage.contents[4998], soundcard, 4); - move(storage.contents[5002], baseaddr, 4); - move(storage.contents[5006], irq, 4); - move(storage.contents[5010], dma, 4); - move(storage.contents[5014], speed, 4); - - zoomy = (arguments[8] == 'y') || (arguments[2] == 'y'); - demo_args = arguments; - demo_args[7] = 'y'; - arguments = segofs + ' ' + arguments; - demo_args = segofs + ' ' + demo_args; - - args_with_no_filename = arguments; - if (arguments[length(arguments)] != ' ') { - /* Filename was given */ - args_with_no_filename = arguments; - while ((args_with_no_filename != "") - && (args_with_no_filename[length(args_with_no_filename)] != ' ')) - args_with_no_filename[0] -= 1; /* Strip off the filename. */ - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - original_mode = mem[seg0040 * 0x49]; - getintvec(0x1c, old_1c); - first_time = true; - cursor_off(); - - get_arguments(); - get_slope(); - - if (! zoomy) call_menu(); /* Not run when zoomy. */ - - do { - run_avalot(); - - if (dosexitcode != 77) quit(); /* Didn't stop for us. */ - - switch (storage.operation) { - case run_shootemup: - run("seu.avx", jsb, bflight, normal); - break; - case run_dosshell: - dos_shell(); - break; - case run_ghostroom: - run("g-room.avx", jsb, no_bflight, normal); - break; - case run_golden: - run("golden.avx", jsb, bflight, musical); - break; - } - - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.cpp b/engines/avalanche/cadburys.cpp deleted file mode 100644 index 9b12b39555b1..000000000000 --- a/engines/avalanche/cadburys.cpp +++ /dev/null @@ -1,135 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __cadburys_implementation__ - - -#include "cadburys.h" - - -#include "graph.h" - -namespace Avalanche { - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/cadburys.h b/engines/avalanche/cadburys.h deleted file mode 100644 index 6afb4532f226..000000000000 --- a/engines/avalanche/cadburys.h +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __cadburys_h__ -#define __cadburys_h__ - -namespace Avalanche { - -const integer arraysize = 12000; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - - -#ifdef __cadburys_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<0, arraysize, byte> aa; -EXTERN byte num_chunks, this_chunk; -EXTERN integer gd, gm; -EXTERN array<1, 30, longint> offsets; -EXTERN untyped_file f; -#undef EXTERN -#define EXTERN extern - - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp deleted file mode 100644 index 62ae94d36e05..000000000000 --- a/engines/avalanche/celer.cpp +++ /dev/null @@ -1,578 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - CELER The unit for updating the screen pics. */ - -#define __celer_implementation__ - -#include "celer.h" - - -#include "Graph.h" -#include "trip5.h" -#include "lucerna.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -untyped_file f; /* Private variable- not accessible from elsewhere. */ - -const integer on_disk = -1; /* Value of memos[fv].x when it's not in memory. */ - -void pics_link() { - byte xx; - - if (ddmnow) return; /* No animation when the menus are up. */ - - { - dnatype &with = dna; - switch (with.room) { - - case r__outsideargentpub: { - if ((roomtime % longint(12)) == 0) - show_one(longint(1) + (roomtime / longint(12)) % longint(4)); - } - break; - - case r__brummieroad: - if ((roomtime % longint(2)) == 0) - show_one(longint(1) + (roomtime / longint(2)) % longint(4)); - break; - - case r__bridge: - if ((roomtime % longint(2)) == 0) - show_one(longint(4) + (roomtime / longint(2)) % longint(4)); - break; - - case r__yours: - if ((! with.avvy_is_awake) && ((roomtime % longint(4)) == 0)) - show_one(longint(1) + (roomtime / longint(12)) % longint(2)); - break; - - case r__argentpub: { - if (((roomtime % longint(7)) == 1) && (dna.malagauche != 177)) { - /* Malagauche cycle */ - dna.malagauche += 1; - switch (dna.malagauche) { - case 1: - case 11: - case 21: - show_one(12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(11); - break; /* Looks at you. */ - case 30: - show_one(13); - break; /* Winks. */ - case 33: - dna.malagauche = 0; - break; - } - } - - switch (roomtime % longint(200)) { - case 179: - case 197: - show_one(5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(6); - break; - case 185: - show_one(7); - break; - case 199: - dna.dogfoodpos = 177; - break; /* Impossible value for this. */ - case 0 ... 178: { /* Normally. */ - switch (bearing(2)) {/* Bearing of Avvy from Dogfood. */ - case 1 ... 90: - case RANGE_3(358, 360): - xx = 3; - break; - case 293 ... 357: - xx = 2; - break; - case 271 ... 292: - xx = 4; - break; - } - if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - dna.dogfoodpos = xx; - } - } - break; - } - } - break; - - case r__westhall: - if ((roomtime % longint(3)) == 0) - switch ((roomtime / longint(3)) % longint(6)) { - case 4: - show_one(1); - break; - case 1: - case 3: - case 5: - show_one(2); - break; - case 0: - case 2: - show_one(3); - break; - } - break; - case r__lustiesroom: - if (!(dna.lustie_is_asleep)) { - if ((roomtime % longint(45)) > 42) xx = 4; /* du Lustie blinks */ - else - switch (bearing(2)) {/* Bearing of Avvy from du Lustie. */ - case 0 ... 45: - case 315 ... 360: - xx = 1; - break; /* Middle. */ - case 45 ... 180: - xx = 2; - break; /* Left. */ - case 181 ... 314: - xx = 3; - break; /* Right. */ - } - if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - } - break; - - case r__aylesoffice: - if ((! dna.ayles_is_awake) && (roomtime % longint(14) == 0)) { - switch ((roomtime / longint(14)) % longint(2)) { - case 0: - show_one(1); - break; /* Frame 2: EGA. */ - case 1: - show_one(3); - break; /* Frame 1: Natural. */ - } - } - break; - - case r__robins: - if (dna.tied_up) - switch (roomtime % longint(54)) { - case 20: - show_one(4); - break; /* Frame 4: Avalot blinks. */ - case 23: - show_one(2); - break; /* Frame 1: Back to normal. */ - } - break; - - case r__nottspub: { - switch (bearing(5)) { /* Bearing of Avvy from Port. */ - case 0 ... 45: - case 315 ... 360: - xx = 2; - break; /* Middle. */ - case 45 ... 180: - xx = 6; - break; /* Left. */ - case 181 ... 314: - xx = 8; - break; /* Right. */ - } - - if ((roomtime % longint(60)) > 57) xx -= 1; /* Blinks */ - - if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - - switch (roomtime % longint(50)) { - case 45 : - show_one(9); - break; /* Spurge blinks */ - case 49 : - show_one(10); - break; - } - } - break; - - case r__ducks: { - if ((roomtime % longint(3)) == 0) /* The fire flickers */ - show_one(longint(1) + (roomtime / longint(3)) % longint(3)); - - switch (bearing(2)) {/* Bearing of Avvy from Duck. */ - case 0 ... 45: - case 315 ... 360: - xx = 4; - break; /* Middle. */ - case 45 ... 180: - xx = 6; - break; /* Left. */ - case 181 ... 314: - xx = 8; - break; /* Right. */ - } - - if ((roomtime % longint(45)) > 42) xx += 1; /* Duck blinks */ - - if (xx != dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - } - break; - - } - } - - if ((dna.ringing_bells) && (flagset('B'))) - /* They're ringing the bells. */ - switch (roomtime % longint(4)) { - case 1: { - dnatype &with = dna; - - if (with.nextbell < 5) with.nextbell = 12; - with.nextbell -= 1; - note(notes[with.nextbell]); - } - break; - case 2: - nosound; - break; - } - -} - -void load_chunks(string xx) { - chunkblocktype ch; - byte fv; - - /*$I-*/ - assign(f, string("chunk") + xx + ".avd"); /* strf is done for us by Lucerna. */ - reset(f, 1); - if (ioresult != 0) return; /* no Chunk file. */ - seek(f, 44); - blockread(f, num_chunks, 1); - blockread(f, offsets, num_chunks * 4); - - for (fv = 1; fv <= num_chunks; fv ++) { - seek(f, offsets[fv]); - blockread(f, ch, sizeof(ch)); - { - if (ch.memorise) { - - { - memotype &with1 = memos[fv]; - - with1.x = ch.x; - with1.xl = ch.xl; - with1.y = ch.y; - with1.yl = ch.yl; - with1.flavour = ch.flavour; - with1.size = ch.size; - } - - getmem(memory[fv], ch.size); - - if (ch.natural) { - getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); - } else - blockread(f, memory[fv], ch.size); - } else memos[fv].x = on_disk; - } - } - - close(f); - /*$I+*/ -} - -void forget_chunks() { - byte fv; - - for (fv = 1; fv <= num_chunks; fv ++) - if (memos[fv].x > on_disk) - freemem(memory[fv], memos[fv].size); - fillchar(memos, sizeof(memos), '\377'); /* x=-1, => on disk. */ -} - -void mdrop(integer x, integer y, integer xl, integer yl, pointer p) /* assembler; -asm - push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} - push bp; { Nor BP! } - - - { DI holds the offset on this page. It starts at the top left-hand corner. } - { (It should equal ch.y*80+ch.x. } - - mov ax,y; - mov dl,80; - mul dl; { Line offset now calculated. } - mov di,ax; { Move it into DI. } - mov ax,x; - add di,ax; { Full offset now calculated. } - - mov bx,yl; { No. of times to repeat lineloop. } - inc bx; { "loop" doesn't execute the zeroth time. } - mov bh,bl; { Put it into BH. } - - { BP holds the length of the string to copy. It's equal to ch.xl.} - - mov ax,word(p); { Data is held at DS:SI. } - mov si,ax; - mov ax,word(p+2); { This will be moved over into ds in just a tick... } - - mov bp,xl; - - mov ds,ax; - - - cld; { We're allowed to hack around with the flags! } - - mov ax,$AC00; { Top of the first EGA page. } - mov es,ax; { Offset on this page is calculated below... } - - -{ port[$3c4]:=2; port[$3ce]:=4; } - - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; - - mov cx,4; { This loop executes for 3, 2, 1, and 0. } - mov bl,0; - - - @mainloop: - - push di; - push cx; - -{ port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; -{ port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - - xor ch,ch; - mov cl,bh; { BH = ch.yl. } - - @lineloop: - - push cx; - - mov cx,bp; - - repz movsb; { Copy the data. } - - sub di,bp; - add di,80; - - pop cx; - - loop @lineloop; - - inc bl; { One more on BL. } - - pop cx; - pop di; - - loop @mainloop; - - pop bp; - pop ds; { Get DS back again. } -*/ -{ -} - -void show_one(byte which); - -static bytefield r; - -static void display_it(integer x, integer y, integer xl, integer yl, flavourtype flavour, pointer p) { - { - switch (flavour) { - case ch_bgi : { - putimage(x * 8, y, p, 0); - r.x1 = x; - r.y1 = y; - r.x2 = x + xl + 1; - r.y2 = y + yl; - } - break; - case ch_ega : { - mdrop(x, y, xl, yl, p); - blitfix(); - r.x1 = x; - r.y1 = y; - r.x2 = x + xl; - r.y2 = y + yl; - } - break; - } - } -} - -void show_one(byte which) { - chunkblocktype ch; - pointer p; - byte fv; - - - setactivepage(3); - - { - memotype &with = memos[which]; - - if (with.x > on_disk) { - display_it(with.x, with.y, with.xl, with.yl, with.flavour, memory[which]); - } else { - reset(f, 1); - seek(f, offsets[which]); - blockread(f, ch, sizeof(ch)); - - { - getmem(p, ch.size); - blockread(f, p, ch.size); - - display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, p); - freemem(p, ch.size); - - close(f); - } - - } - - setactivepage(1 - cp); - - for (fv = 0; fv <= 1; fv ++) - getset[fv].remember(r); - } - -} - -void show_one_at(byte which, integer xxx, integer yyy); - -static bytefield r1; - -static void display_it1(integer xl, integer yl, flavourtype flavour, pointer p, integer &xxx, integer &yyy) { - { - switch (flavour) { - case ch_bgi : { - putimage(xxx, yyy, p, 0); - r1.x1 = xxx; - r1.y1 = yyy; - r1.x2 = xxx + xl + 1; - r1.y2 = yyy + yl; - } - break; - case ch_ega : { - mdrop(xxx / 8, yyy, xl, yl, p); - blitfix(); - r1.x1 = xxx / 8; - r1.y1 = yyy; - r1.x2 = (xxx / 8) + xl; - r1.y2 = yyy + yl; - } - break; - } - } -} - -void show_one_at(byte which, integer xxx, integer yyy) { - chunkblocktype ch; - pointer p; - byte fv; - - - setactivepage(3); - - { - memotype &with = memos[which]; - - if (with.x > on_disk) { - display_it1(with.xl, with.yl, with.flavour, memory[which], xxx, yyy); - } else { - reset(f, 1); - seek(f, offsets[which]); - blockread(f, ch, sizeof(ch)); - - { - getmem(p, ch.size); - blockread(f, p, ch.size); - - display_it1(ch.xl, ch.yl, ch.flavour, p, xxx, yyy); - freemem(p, ch.size); - - close(f); - } - - } - - setactivepage(1 - cp); - - for (fv = 0; fv <= 1; fv ++) - getset[fv].remember(r1); - } -} - -class unit_celer_initialize { -public: - unit_celer_initialize(); -}; -static unit_celer_initialize celer_constructor; - -unit_celer_initialize::unit_celer_initialize() { - num_chunks = 0; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h deleted file mode 100644 index 9db53b57eb42..000000000000 --- a/engines/avalanche/celer.h +++ /dev/null @@ -1,83 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __celer_h__ -#define __celer_h__ - - -#include "closing.h" -#include "incline.h" -#include "gyro.h" - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -struct memotype { - integer x, y; - integer xl, yl; - flavourtype flavour; - word size; -}; - - -#ifdef __celer_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, 40, longint> offsets; -EXTERN byte num_chunks; -EXTERN array<1, 40, memotype> memos; -EXTERN array<1, 40, pointer> memory; -#undef EXTERN -#define EXTERN extern - - -void pics_link(); - -void load_chunks(string xx); - -void forget_chunks(); - -void show_one(byte which); - -void show_one_at(byte which, integer xxx, integer yyy); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/ch_egats.cpp b/engines/avalanche/ch_egats.cpp deleted file mode 100644 index d96eb89b36d3..000000000000 --- a/engines/avalanche/ch_egats.cpp +++ /dev/null @@ -1,183 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -untyped_file f; -longint offset; -chunkblocktype ch; -integer gd, gm; -byte bit; -pointer p; - -void mdrop(integer x, integer y, integer xl, integer yl, pointer p) /* assembler; -asm - push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} - push bp; { Nor BP! } - - - { DI holds the offset on this page. It starts at the top left-hand corner. } - { (It should equal ch.y*80+ch.x. } - - mov ax,y; - mov dl,80; - mul dl; { Line offset now calculated. } - mov di,ax; { Move it into DI. } - mov ax,x; - add di,ax; { Full offset now calculated. } - - mov bx,yl; { No. of times to repeat lineloop. } - inc bx; { "loop" doesn't execute the zeroth time. } - mov bh,bl; { Put it into BH. } - - { BP holds the length of the string to copy. It's equal to ch.xl.} - - mov ax,word(p); { Data is held at DS:SI. } - mov si,ax; - mov ax,word(p+2); { This will be moved over into ds in just a tick... } - - mov bp,xl; - - mov ds,ax; - - - cld; { We're allowed to hack around with the flags! } - - mov ax,$A000; { Top of the first EGA page. } - mov es,ax; { Offset on this page is calculated below... } - - -{ port[$3c4]:=2; port[$3ce]:=4; } - - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; - - mov cx,4; { This loop executes for 3, 2, 1, and 0. } - mov bl,0; - - - @mainloop: - - push di; - push cx; - -{ port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; -{ port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - - xor ch,ch; - mov cl,bh; { BH = ch.yl. } - - @lineloop: - - push cx; - - mov cx,bp; - - repz movsb; { Copy the data. } - - sub di,bp; - add di,80; - - pop cx; - - loop @lineloop; - - inc bl; { One more on BL. } - - pop cx; - pop di; - - loop @mainloop; - - pop bp; - pop ds; { Get DS back again. } -*/ -{ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(f, "chunk21.avd"); - reset(f, 1); - - seek(f, 49); - blockread(f, offset, 4); - - seek(f, offset); - - blockread(f, ch, sizeof(ch)); - - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - getmem(p, ch.size); - blockread(f, p, ch.size); - /* putimage(0,0,p^,0);*/ - - - /* with ch do - for bit:=0 to 3 do - begin; - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - for gm:=0 to yl do - blockread(f,mem[$A000*gm*80],(ch.xl+7) div 8); - end;*/ - - mdrop(ch.x, ch.y, ch.xl, ch.yl, p); - - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/charmap.cpp b/engines/avalanche/charmap.cpp deleted file mode 100644 index c970e1a4c1d7..000000000000 --- a/engines/avalanche/charmap.cpp +++ /dev/null @@ -1,58 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ - -namespace Avalanche { - -struct infotype { - matrix<128, 255, 1, 8, byte> chars; - string data; -}; -infotype table; -pointer where; -byte w, fv, ff, num; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1f, where); - move(where, table, 1024); - for (w = 128; w <= 255; w ++) { - output << w << NL; - for (fv = 1; fv <= 8; fv ++) { - num = table.chars[w][fv]; - for (ff = 1; ff <= 8; ff ++) { - if ((num & 128) == 0) output << " "; - else output << ""; - num = num << 1; - } - output << NL; - } - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunker.cpp b/engines/avalanche/chunker.cpp deleted file mode 100644 index 68d269def970..000000000000 --- a/engines/avalanche/chunker.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -untyped_file f; -string fn; -byte num_chunks, fv; -longint offset; -chunkblocktype ch; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << NL; - output << "CHUNKER 12/3/1995 TT" << NL; - output << NL; - - if (paramcount != 1) { - output << "which chunk file?" << NL; - exit(0); - } - - fn = paramstr(1); - assign(f, fn); - reset(f, 1); - output << "----- In chunk file " << fn << ", there are: -----" << NL; - - seek(f, 44); - blockread(f, num_chunks, 1); - output << format(num_chunks, 4) << " chunks:" << NL; - - output << " No Hdr Offset Flvr Mem Nat X Y Width Height Size of image" << NL; - - for (fv = 1; fv <= num_chunks; fv ++) { - - output << "Ch" << format(fv, 2) << ':'; - - seek(f, 41 + fv * 4); - - output << format(41 + fv * 4, 4); - blockread(f, offset, 4); - output << format(offset, 10); - - seek(f, offset); - blockread(f, ch, sizeof(ch)); - { - if (ch.flavour == ch_bgi) - output << " ch_BGI"; - else - output << " ch_EGA"; - - if (ch.memorise) - output << " yes"; - else - output << " no "; - - if (ch.natural) - output << " yes"; - else - output << " no "; - - output << format(ch.x, 7) << format(ch.y, 7) << format(ch.xl, 7) << format(ch.yl, 7) << format(ch.size, 10); - } - - output << NL; - } - - output << "---ENDS---" << NL; - - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf1.cpp b/engines/avalanche/chunkxf1.cpp deleted file mode 100644 index ed2999148db1..000000000000 --- a/engines/avalanche/chunkxf1.cpp +++ /dev/null @@ -1,289 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -#include "cadburys.h" - -namespace Avalanche { - -/*type - flavourtype = (ch_EGA,ch_BGI); - - chunkblocktype = record - flavour:flavourtype; - x,y:integer; - xl,yl:integer; - size:longint; - natural:boolean; - - memorise:boolean; { Hold it in memory? } - end;*/ - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -/* arraysize = 12000;*/ - -/* offsets:array[1..30] of longint;*/ -byte num_chunks/*,this_chunk*/; -integer gd, gm; -/* f:file;*/ -/* aa:array[0..arraysize] of byte;*/ - -void load() { - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - assign(f, "chunkbit.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - assign(f, "place21.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); -} - -void open_chunk() { - assign(f, "chunk21.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} -/* -procedure mgrab(x1,y1,x2,y2:integer; size:word); -var yy:integer; aapos:word; length,bit:byte; -begin; - if size>arraysize then - begin; - writeln('*** SORRY! *** Increase the arraysize constant to be greater'); - writeln(' than ',size,'.'); - halt; - end; - - aapos:=0; - - length:=x2-x1; - - for bit:=0 to 3 do - begin; - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - for yy:=y1 to y2 do - begin; - move(mem[$A400*yy*80+x1],aa[aapos],length); - move(aa[aapos],mem[$A400*yy*80],length); -(* fillchar(mem[$A400:yy*80+x1],length,#177);*) - inc(aapos,length); - end; - end; - bit:=getpixel(0,0); - -end; -*/ -/*procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; - mem,nat:boolean); - { yes, I *do* know how to spell "really"! } -var - s:word; - p:pointer; - ch:chunkblocktype; -begin; - inc(this_chunk); - offsets[this_chunk]:=filepos(f); - - - s:=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p^); - - with ch do - begin; - flavour:=flav; - x:=realx; y:=realy; - - xl:=x2-x1; - yl:=y2-y1; - size:=s; - memorise:=mem; - natural:=nat; - end; - - setvisualpage(1); - setactivepage(1); - readln; - putimage(ch.x,ch.y,p^,0); - - if flav=ch_EGA then - begin; - freemem(p,s); - s:=4*((x2-x1+7) div 8)*(y2-y1+1); - with ch do - begin; - size:=s; - x:=x div 8; - xl:=(xl+7) div 8; - mgrab(x,y,x+xl,y+yl,s); - end; - end; - - readln; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - case flav of - ch_EGA : if not nat then blockwrite(f,aa,s); - ch_BGI : begin; - if not nat then blockwrite(f,p^,s); - freemem(p,s); - end; - end; -{ rectangle(x1,y1,x2,y2);} -end;*/ - -/*procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; - mem,nat:boolean);*/ -/* yes, I *do* know how to spell "really"! */ -/*var - s:word; - p:pointer; - ch:chunkblocktype; -begin; -(* rectangle(x1,y1,x2,y2); exit;*) - inc(this_chunk); - offsets[this_chunk]:=filepos(f); - - - s:=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p^); - - with ch do - begin; - flavour:=flav; - x:=realx; y:=realy; - - xl:=x2-x1; - yl:=y2-y1; - size:=s; - memorise:=mem; - natural:=nat; - end; - - setvisualpage(1); - setactivepage(1); - readln; - putimage(ch.x,ch.y,p^,0); - - if flav=ch_EGA then - begin; - freemem(p,s); - s:=4*(((x2 div 8)-(x1 div 8))+2)*(y2-y1+1); - with ch do - begin; - size:=s; - x:=x div 8; - xl:=(xl div 8)+2; - mgrab(x,y,x+xl,y+yl,s); - end; - end else - with ch do { For BGI pictures. *//* - begin; - x:=x div 8; - xl:=(xl+7) div 8; - size:=imagesize(x*8,y,(x+xl)*8,y+yl); - end; - - readln; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - case flav of - ch_EGA : if not nat then blockwrite(f,aa,s); - ch_BGI : begin; - if not nat then blockwrite(f,p^,s); - freemem(p,s); - end; - end; -(* rectangle(x1,y1,x2,y2);*) -end;*/ - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - setwritemode(xorput); - - num_chunks = 7; - - open_chunk(); - - grab(98, 10, 181, 41, 247, 82, ch_ega, false, false); /* Drawbridge... */ - grab(223, 10, 320, 41, 233, 82, ch_ega, false, false); - grab(361, 10, 458, 64, 233, 82, ch_ega, false, false); - - grab(11, 10, 39, 22, 172, 17, ch_bgi, true, true); - grab(11, 38, 39, 50, 172, 17, ch_ega, true, false); /* Flag. */ - grab(11, 24, 39, 36, 172, 17, ch_ega, true, false); - grab(11, 10, 39, 22, 172, 17, ch_ega, true, false); - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf2.cpp b/engines/avalanche/chunkxf2.cpp deleted file mode 100644 index d7ae8e4ef320..000000000000 --- a/engines/avalanche/chunkxf2.cpp +++ /dev/null @@ -1,219 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 32000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void load() { - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place9.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); -} - -void load_temp(string which) { - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - assign(f, which); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void open_chunk() { - assign(f, "chunk9.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - if (nat) - ch.flavour = ch_bgi; - else ch.flavour = ch_ega; /* At the moment, Celer can't handle natural ch_EGAs. */ - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - freemem(p, s); - { - if (ch.flavour == ch_bgi) s = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - else s = 4 * ((x2 - x1 + 7) / 8) * (y2 - y1 + 1); - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - if (! nat) blockwrite(f, aa, s); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - load_temp("d:chunkbit.avd"); - setwritemode(xorput); - - num_chunks = 7; - - open_chunk(); - - grab(78, 78, 232, 102, 212, 10, true, false); /* 154 across */ - grab(235, 78, 389, 102, 212, 10, true, false); - grab(392, 78, 546, 102, 212, 10, true, false); - grab(392, 78, 546, 102, 212, 10, true, true); - - load_temp("d:chunkbi3.avd"); - - grab(437, 51, 475, 78, 147, 120, false, false); /* 5 = door half-open. */ - grab(397, 51, 435, 78, 147, 120, false, false); /* 6 = door open. */ - grab(397, 51, 435, 78, 147, 120, true, true); /* 7 = door shut. */ - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf3.cpp b/engines/avalanche/chunkxf3.cpp deleted file mode 100644 index c693fdc1be88..000000000000 --- a/engines/avalanche/chunkxf3.cpp +++ /dev/null @@ -1,305 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ -#include "cadburys.h" - -namespace Avalanche { - -/*type - flavourtype = (ch_EGA,ch_BGI); - - chunkblocktype = record - flavour:flavourtype; - x,y:integer; - xl,yl:integer; - size:longint; - natural:boolean; - - memorise:boolean; { Hold it in memory? } - end; - -const - chunkheader : array[1..44] of char = - 'Chunk-type AVD file, for an Avvy game.'+#26+#177+#$30+#$01+#$75+#177; - - arraysize = 12000; - -var - offsets:array[1..30] of longint; - num_chunks,this_chunk:byte; - gd,gm:integer; - f:file; - aa:array[0..arraysize] of byte;*/ - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void loadtemp(string n) { - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - assign(f, n); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); - finder(); -} - -void load() { - byte a0 /*absolute $A000:800*/; - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - assign(f, "place22.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setactivepage(1); - setvisualpage(1); - finder(); - setactivepage(0); - setvisualpage(0); -} - -void open_chunk() { - assign(f, "chunk22.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -/*procedure mgrab(x1,y1,x2,y2:integer; size:word); -var yy:integer; aapos:word; length,bit:byte; -begin; - if size>arraysize then - begin; - writeln('*** SORRY! *** Increase the arraysize constant to be greater'); - writeln(' than ',size,'.'); - halt; - end; - - aapos:=0; - - length:=x2-x1; - - for bit:=0 to 3 do - begin; - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - for yy:=y1 to y2 do - begin; - move(mem[$A400*yy*80+x1],aa[aapos],length); - inc(aapos,length); - end; - end; - bit:=getpixel(0,0); - -end; - -procedure grab(x1,y1,x2,y2,realx,realy:integer; flav:flavourtype; - mem,nat:boolean); - { yes, I *do* know how to spell "really"! } -var - s:word; - p:pointer; - ch:chunkblocktype; -begin; - inc(this_chunk); - offsets[this_chunk]:=filepos(f); - - - s:=imagesize(x1,y1,x2,y2); - getmem(p,s); - getimage(x1,y1,x2,y2,p^); - - with ch do - begin; - flavour:=flav; - x:=realx; y:=realy; - - xl:=x2-x1; - yl:=y2-y1; - size:=s; - memorise:=mem; - natural:=nat; - end; - - setvisualpage(1); - setactivepage(1); - readln; - putimage(ch.x,ch.y,p^,0); - - if flav=ch_EGA then - begin; - freemem(p,s); - s:=4*((x2-x1+7) div 8)*(y2-y1+1); - with ch do - begin; - size:=s; - x:=x div 8; - xl:=(xl+7) div 8; - mgrab(x,y,x+xl,y+yl,s); - end; - end; - - readln; - setvisualpage(0); - setactivepage(0); - - blockwrite(f,ch,sizeof(ch)); - - case flav of - ch_EGA : if not nat then blockwrite(f,aa,s); - ch_BGI : begin; - if not nat then blockwrite(f,p^,s); - freemem(p,s); - end; - end; -{ rectangle(x1,y1,x2,y2);} -end;*/ - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - loadtemp("chunkbit.avd"); - load(); - setwritemode(xorput); - - num_chunks = 9; - - open_chunk(); - - grab(0, 103, 169, 159, 72, 86, ch_ega, false, false); /* Stairs... */ - grab(172, 103, 341, 159, 72, 86, ch_ega, false, false); - - loadtemp("chunkbi3.avd"); - - grab(0, 130, 79, 157, 341, 94, ch_bgi, true , true); - grab(0, 130, 79, 157, 341, 94, ch_ega, false, false); - grab(0, 102, 79, 129, 341, 94, ch_ega, false, false); - grab(0, 74, 79, 101, 341, 94, ch_ega, false, false); /* Far door. */ - - loadtemp("chunkbi2.avd"); - - grab(393, 92, 451, 137, 512, 98, ch_bgi, true , true); /* Right-hand door. */ - grab(393, 92, 451, 137, 512, 98, ch_ega, false, false); - grab(453, 92, 511, 137, 512, 98, ch_ega, false, false); - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf4.cpp b/engines/avalanche/chunkxf4.cpp deleted file mode 100644 index 6659aa91aafb..000000000000 --- a/engines/avalanche/chunkxf4.cpp +++ /dev/null @@ -1,344 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -enum kind {walled, unwalled, last_kind}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -const kind w = walled; -const kind uw = unwalled; - -array<1, 50, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void rdln() { - char r; - return; - do { - r = readkey(); - } while (!(! keypressed())); -} - -void load(kind k) { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - if (k == unwalled) assign(f, "place29.avd"); - else assign(f, "walled.avd"); - - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); -} - -void finder() { - char r; - integer x, y; - return; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void loadtemp(string which) { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f, string("corr") + which + "tmp.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk29.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat, kind k) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - load(k); - - setvisualpage(1); - setactivepage(1); - rdln(); - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - rdln(); - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - setwritemode(xorput); - - loadtemp("2"); - - num_chunks = 32; - - open_chunk(); - - grab(0, 11, 100, 104, 260, 41, ch_ega, false, false, uw); /*1 Geida's door. */ - grab(103, 12, 203, 55, 207, 61, ch_ega, false, false, uw); /*2 "Ite mingite" sign. */ - grab(123, 59, 185, 103, 254, 90, ch_ega, false, false, uw); /*3 Normal N door (rt handle)*/ - grab(227, 10, 289, 56, 254, 88, ch_ega, false, false, uw); /*4 Normal N door (lt handle)*/ - grab(207, 63, 294, 105, 9, 47, ch_ega, false, false, w); /*5 Window in left wall. */ - grab(312, 10, 416, 56, 233, 88, ch_ega, false, false, uw); /*6 North archway */ - grab(331, 78, 384, 101, 32, 64, ch_ega, false, false, w); /*7 2 torches, L wall. */ - grab(607, 142, 621, 157, 233, 88, ch_ega, false, false, uw); /*8 1 torch, N wall. */ - grab(417, 11, 577, 59, 311, 61, ch_ega, false, false, uw); /*9 "The Wrong Way!" sign. */ - - loadtemp("3"); - - grab(0, 11, 62, 63, 557, 108, ch_ega, false, false, w); /*10 Near right candle */ - grab(64, 11, 120, 63, 18, 108, ch_ega, false, false, w); /*11 Near left candle */ - grab(122, 11, 169, 55, 93, 100, ch_ega, false, false, w); /*12 Far left candle */ - grab(171, 11, 222, 52, 500, 100, ch_ega, false, false, w); /*13 Far right candle */ - grab(32, 68, 84, 104, 285, 70, ch_ega, false, false, uw); /*14 Far window */ - grab(138, 65, 190, 92, 233, 88, ch_ega, false, false, uw); /*15 Baron du Lustie pic 1 */ - grab(244, 65, 296, 92, 103, 51, ch_ega, false, false, uw); /*16 Baron du Lustie pic 2 */ - grab(172, 54, 280, 63, 233, 88, ch_ega, false, false, uw); /*17 "Art Gallery" sign */ - grab(341, 18, 402, 47, 563, 48, ch_ega, false, false, w); /*18 Right wall torches */ - grab(528, 10, 639, 160, 528, 10, ch_ega, false, false, uw); /*19 Right wall */ - grab(430, 50, 526, 88, 543, 50, ch_ega, false, false, w); /*20 Window in right wall */ - grab(451, 91, 494, 152, 566, 91, ch_ega, false, false, w); /*21 Door in right wall */ - grab(238, 10, 307, 14, 484, 156, ch_ega, false, false, w); /*22 Near wall door: right */ - grab(239, 16, 300, 20, 300, 156, ch_ega, false, false, w); /*23 Near wall door: middle */ - grab(234, 22, 306, 26, 100, 156, ch_ega, false, false, w); /*24 Near wall door: left */ - grab(25, 113, 87, 156, 254, 90, ch_ega, false, false, w); /*25 Far door opening stage 1 */ - grab(131, 113, 193, 156, 254, 90, ch_ega, false, false, w); /*26 Far door opening stage 2 */ - grab(237, 113, 299, 156, 254, 90, ch_ega, false, false, w); /*27 Far door opening stage 3 */ - - loadtemp("4"); - - grab(0, 11, 112, 160, 0, 11, ch_ega, false, false, uw); /*28 Left wall */ - grab(144, 44, 197, 76, 30, 44, ch_ega, false, false, w); /*29 Shield on L wall. */ - grab(149, 90, 192, 152, 35, 90, ch_ega, false, false, w); /*30 Door in L wall. */ - grab(463, 28, 527, 43, 252, 100, ch_ega, false, false, w); /*31 Archway x 2 */ - grab(463, 79, 527, 94, 252, 100, ch_ega, false, false, w); /*32 Archway x 3 */ - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf5.cpp b/engines/avalanche/chunkxf5.cpp deleted file mode 100644 index c4b49e791182..000000000000 --- a/engines/avalanche/chunkxf5.cpp +++ /dev/null @@ -1,298 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "v:place1.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - - setvisualpage(1); - setactivepage(1); - finder(); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi9.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - setvisualpage(0); - setactivepage(0); - finder(); -} - -void open_chunk() { - assign(f, "chunk1.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - if (! nat) putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 + 7) / 8) - (x1 / 8)) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 9; - - open_chunk(); - - grab(48, 42, 94, 66, 400, 105, ch_ega, true, false); /*1 Avvy asleep. */ - grab(100, 42, 146, 66, 400, 105, ch_ega, true, false); /*2 Avvy asleep again. */ - grab(152, 42, 198, 66, 400, 105, ch_ega, false, false); /*3 Avvy awake in bed. */ - grab(106, 113, 152, 137, 400, 105, ch_bgi, true , true); /*4 No Avvy in bed. */ - - grab(206, 42, 279, 75, 150, 91, ch_ega, false, false); /*5 Open trunk. */ - grab(206, 42, 287, 75, 150, 91, ch_bgi, true, true); /*6 Shut trunk. */ - - grab(69, 70, 102, 88, 431, 100, ch_ega, false, false); /*7 Arkata 1. */ - grab(118, 70, 151, 88, 431, 100, ch_ega, false, false); /*8 Arkata 2. */ - grab(167, 70, 200, 88, 431, 100, ch_ega, false, false); /*9 Arkata 3. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf6.cpp b/engines/avalanche/chunkxf6.cpp deleted file mode 100644 index a1ce3ee680d4..000000000000 --- a/engines/avalanche/chunkxf6.cpp +++ /dev/null @@ -1,309 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -const integer x_ofs = 165; -const integer y_ofs = 58; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "v:place19.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "d:temp1.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - /* finder;*/ -} - -void open_chunk() { - assign(f, "chunk19.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - x1 -= x_ofs; - x2 -= x_ofs; - y1 -= y_ofs; - y2 -= y_ofs; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - /* readln;*/ - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - /* readln;*/ - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 13; - - open_chunk(); - - grab(165, 68, 207, 87, 127, 105, ch_ega, false, false); /*1 The settle with no lute*/ - grab(209, 68, 255, 96, 159, 84, ch_bgi, true, true); /*2 Dogfood looks right. */ - grab(209, 68, 255, 96, 159, 84, ch_ega, true, false); /*3 Dogfood- straight ahead. */ - grab(257, 68, 303, 96, 159, 84, ch_ega, true, false); /*4 Dogfood- left. */ - grab(305, 68, 351, 96, 159, 84, ch_ega, true, false); /*5 DF drinks: stage 1. */ - grab(353, 68, 399, 96, 159, 84, ch_ega, true, false); /*6 DF drinks: stage 2. */ - grab(401, 68, 447, 96, 159, 84, ch_ega, true, false); /*7 DF drinks: stage 3. */ - grab(449, 84, 465, 94, 392, 87, ch_ega, true, false); /*8 Ibythneth smiles. */ - grab(449, 75, 488, 82, 341, 123, ch_ega, true, false); /*9 No habit under the settle. */ - grab(508, 68, 580, 106, 485, 105, ch_ega, true, false); /*10 M gets your drink. */ - grab(508, 68, 580, 106, 485, 105, ch_bgi, true, true); /*11 M gets up again. */ - grab(470, 84, 486, 91, 510, 108, ch_ega, true, false); /*12 M looks right. */ - grab(488, 84, 504, 91, 510, 108, ch_ega, true, false); /*13 M winks. */ - close_chunk(); - return EXIT_SUCCESS; -} - - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf7.cpp b/engines/avalanche/chunkxf7.cpp deleted file mode 100644 index 4b03e3a2f2d9..000000000000 --- a/engines/avalanche/chunkxf7.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place25.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk25.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(16, 24, 101, 45, 448, 116, ch_ega, true, false); /*2 The fire again. */ - grab(118, 20, 203, 45, 448, 112, ch_bgi, true, true); /*1 The natural fire. */ - grab(118, 20, 203, 45, 448, 112, ch_ega, true, false); /*3 Third stage of the fire. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf8.cpp b/engines/avalanche/chunkxf8.cpp deleted file mode 100644 index 7e94b29d5116..000000000000 --- a/engines/avalanche/chunkxf8.cpp +++ /dev/null @@ -1,298 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place23.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp(string x) { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, x); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk23.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp("chunkbi3.avd"); - setwritemode(xorput); - - num_chunks = 6; - - open_chunk(); - - grab(226, 21, 242, 29, 348, 96, ch_bgi, true, true); /*1 Looking forwards. */ - grab(226, 21, 242, 29, 348, 96, ch_ega, true, false); /*2 Looking left. */ - grab(253, 21, 269, 29, 348, 96, ch_ega, true, false); /*3 Looking right. */ - grab(240, 11, 256, 19, 348, 96, ch_ega, true, false); /*4 Blinking. */ - - loadtemp("chunkbi4.avd"); - - grab(48, 83, 110, 126, 324, 96, ch_ega, false, false); /*5 Eyes shut... */ - grab(112, 83, 173, 126, 325, 96, ch_ega, false, false); /*6 Asleep. */ - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxf9.cpp b/engines/avalanche/chunkxf9.cpp deleted file mode 100644 index f03674477ffc..000000000000 --- a/engines/avalanche/chunkxf9.cpp +++ /dev/null @@ -1,292 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place42.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "a:chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk42.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 4; - - open_chunk(); - - grab(276, 36, 329, 73, 94, 97, ch_bgi, true, true); /*1 Not tied to the tree.*/ - grab(276, 36, 329, 73, 94, 97, ch_ega, false, false); /*2 Tied to the tree. */ - grab(182, 80, 226, 88, 311, 132, ch_ega, false, false); /*3 Mushrooms have gone! */ - grab(253, 75, 267, 82, 114, 98, ch_ega, false, false); /*4 Avalot blinks. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfa.cpp b/engines/avalanche/chunkxfa.cpp deleted file mode 100644 index 31c68a0a8b31..000000000000 --- a/engines/avalanche/chunkxfa.cpp +++ /dev/null @@ -1,295 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place7.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - /* finder;*/ - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - /* finder;*/ -} - -void open_chunk() { - assign(f, "chunk7.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 7; - - open_chunk(); - - grab(220, 32, 269, 62, 370, 115, ch_ega, false, false); /*1 Jacques awake... */ - grab(400, 12, 450, 48, 369, 112, ch_ega, false, false); /*2 Jacques gone! */ - grab(116, 47, 176, 98, 393, 87, ch_ega, false, false); /*3 Jacques going... */ - grab(333, 31, 393, 82, 393, 87, ch_ega, false, false); /*4 The open door. */ - grab(396, 80, 452, 135, 39, 91, ch_ega, false, false); /*5 The left door opening. */ - grab(455, 80, 510, 135, 39, 91, ch_ega, false, false); /*6 The left door open. */ - grab(455, 80, 510, 135, 39, 91, ch_bgi, true , true); /*7 The left door shut. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfb.cpp b/engines/avalanche/chunkxfb.cpp deleted file mode 100644 index 0b5beb7a9dfe..000000000000 --- a/engines/avalanche/chunkxfb.cpp +++ /dev/null @@ -1,293 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place71.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "d:chunkbi2.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk71.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 5; - - open_chunk(); - - grab(54, 57, 124, 116, 188, 94, ch_ega, false, false); /*1 Door half-shut. */ - grab(144, 57, 203, 116, 188, 94, ch_ega, false, false); /*2 Door shut. */ - grab(513, 92, 572, 151, 188, 94, ch_ega, false, false); /*3 Door with arrow. */ - grab(610, 94, 627, 106, 367, 122, ch_ega, false, false); /*4 Holder with no pen. */ - grab(54, 57, 124, 116, 188, 94, ch_bgi, true , true); /*5 Door wide open. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfc.cpp b/engines/avalanche/chunkxfc.cpp deleted file mode 100644 index 5dfc0afabe83..000000000000 --- a/engines/avalanche/chunkxfc.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place2.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "d:chunkbi2.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk2.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(59, 15, 166, 55, 226, 86, ch_ega, false, false); /*1 Door half-shut. */ - grab(171, 15, 278, 55, 226, 86, ch_ega, false, false); /*2 Door half-open. */ - grab(283, 15, 390, 55, 226, 86, ch_ega, false, false); /*3 Door open. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfd.cpp b/engines/avalanche/chunkxfd.cpp deleted file mode 100644 index 97c4084a9f60..000000000000 --- a/engines/avalanche/chunkxfd.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place15.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "d:chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk15.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(535, 11, 633, 74, 46, 97, ch_ega, false, false); /*1 Door half-open. */ - grab(539, 76, 637, 139, 46, 97, ch_ega, false, false); /*2 Door open. */ - grab(539, 76, 637, 139, 46, 97, ch_bgi, true , true); /*3 Door shut. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfe.cpp b/engines/avalanche/chunkxfe.cpp deleted file mode 100644 index 81e14772683d..000000000000 --- a/engines/avalanche/chunkxfe.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place5.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi2.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk5.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(252, 57, 375, 132, 501, 85, ch_ega, false, false); /*1 Door half-open. */ - grab(418, 15, 553, 90, 504, 85, ch_ega, false, false); /*2 Door open. */ - grab(252, 57, 375, 132, 504, 85, ch_bgi, true , true); /*3 Door shut. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxff.cpp b/engines/avalanche/chunkxff.cpp deleted file mode 100644 index 777e224cbd16..000000000000 --- a/engines/avalanche/chunkxff.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place13.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk13.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(323, 84, 393, 123, 266, 72, ch_ega, false, false); /*1 Door half-open. */ - grab(251, 84, 321, 123, 266, 72, ch_ega, false, false); /*2 Door open. */ - grab(251, 84, 321, 123, 266, 72, ch_bgi, true , true); /*3 Door shut. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfg.cpp b/engines/avalanche/chunkxfg.cpp deleted file mode 100644 index e1357ef83eeb..000000000000 --- a/engines/avalanche/chunkxfg.cpp +++ /dev/null @@ -1,291 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place16.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi3.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk16.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 3; - - open_chunk(); - - grab(336, 12, 365, 28, 187, 89, ch_ega, false, false); /*1 Ayles asleep frame 2. */ - grab(368, 12, 397, 28, 187, 89, ch_ega, false, false); /*2 Ayles awake. */ - grab(336, 12, 365, 28, 187, 89, ch_bgi, true , true); /*3 Ayles asleep frame 1. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfh.cpp b/engines/avalanche/chunkxfh.cpp deleted file mode 100644 index bf2da8f4529b..000000000000 --- a/engines/avalanche/chunkxfh.cpp +++ /dev/null @@ -1,292 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place46.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "d:chunkbi4.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk46.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 4; - - open_chunk(); - - grab(136, 11, 216, 49, 288, 104, ch_ega, false, false); /*1 Door opening, frame 1.*/ - grab(45, 11, 124, 49, 289, 104, ch_ega, false, false); /*2 Door opening, frame 2.*/ - grab(227, 11, 306, 49, 289, 104, ch_ega, false, false); /*3 Door opening, frame 3.*/ - grab(227, 11, 306, 49, 289, 104, ch_bgi, true , true); /*4 Natural frame. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfi.cpp b/engines/avalanche/chunkxfi.cpp deleted file mode 100644 index 7a5df66941db..000000000000 --- a/engines/avalanche/chunkxfi.cpp +++ /dev/null @@ -1,301 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - assign(f, "place47.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "chunkbi9.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk47.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = (ch.xl / 8) + 2; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 10; - - open_chunk(); - - grab(323, 35, 340, 43, 337, 93, ch_ega, true , false); /*1 Port blinks */ - grab(323, 35, 340, 43, 337, 93, ch_bgi, true , true); /*2 Port normally */ - grab(421, 22, 511, 71, 474, 101, ch_ega, false, false); /*3 Avalot & Spurge */ - grab(421, 22, 511, 71, 474, 101, ch_bgi, true , true); /*4 Just Spurge. */ - - grab(524, 40, 540, 47, 337, 93, ch_ega, true , false); /*5 Port L blinks */ - grab(524, 22, 540, 29, 337, 93, ch_ega, true , false); /*6 Port L */ - grab(563, 40, 579, 47, 337, 93, ch_ega, true , false); /*7 Port R blinks */ - grab(563, 22, 579, 29, 337, 93, ch_ega, true , false); /*8 Port R */ - - grab(307, 38, 310, 38, 493, 104, ch_ega, true , false); /*9 Spurge blinks */ - grab(307, 38, 310, 38, 493, 104, ch_bgi, true , true); /*10 Spurge doesn't blink */ - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfj.cpp b/engines/avalanche/chunkxfj.cpp deleted file mode 100644 index 558be2ae73fc..000000000000 --- a/engines/avalanche/chunkxfj.cpp +++ /dev/null @@ -1,297 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f, "place20.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f, "chunkbit.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk20.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 4; - - open_chunk(); - - grab(57, 11, 72, 18, 399, 13, ch_ega, true , false); /* 1 - all numbers are */ - grab(57, 21, 72, 28, 399, 13, ch_ega, true , false); /* 2 flags. */ - grab(56, 31, 71, 38, 399, 13, ch_ega, true , false); /* 3 */ - grab(56, 31, 71, 38, 399, 13, ch_bgi, true , true); /* 4, the natural one. */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfk.cpp b/engines/avalanche/chunkxfk.cpp deleted file mode 100644 index cafd2e3695fa..000000000000 --- a/engines/avalanche/chunkxfk.cpp +++ /dev/null @@ -1,297 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - boolean natural; - - boolean memorise; /* Hold it in memory? */ -}; - -const array<1, 44, char> chunkheader = - string("Chunk-type AVD file, for an Avvy game.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer arraysize = 12000; - -array<1, 30, longint> offsets; -byte num_chunks, this_chunk; -integer gd, gm; -untyped_file f; -array<0, arraysize, byte> aa; - -void finder() { - char r; - integer x, y; - - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f, "place50.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f, "chunkbi4.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk50.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -void mgrab(integer x1, integer y1, integer x2, integer y2, word size) { - integer yy; - word aapos; - byte length, bit; - - if (size > arraysize) { - restorecrtmode(); - output << "*** SORRY! *** Increase the arraysize constant to be greater" << NL; - output << " than " << size << '.' << NL; - exit(0); - } - - aapos = 0; - - length = x2 - x1; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (yy = y1; yy <= y2; yy ++) { - move(mem[0xa400 * yy * 80 + x1], aa[aapos], length); - aapos += length; - } - } - bit = getpixel(0, 0); - -} - -void grab(integer x1, integer y1, integer x2, integer y2, integer realx, integer realy, flavourtype flav, - boolean mem, boolean nat) -/* yes, I *do* know how to spell "really"! */ -{ - word s; - pointer p; - chunkblocktype ch; - - /* rectangle(x1,y1,x2,y2); exit;*/ - this_chunk += 1; - offsets[this_chunk] = filepos(f); - - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - - { - ch.flavour = flav; - ch.x = realx; - ch.y = realy; - - ch.xl = x2 - x1; - ch.yl = y2 - y1; - ch.size = s; - ch.memorise = mem; - ch.natural = nat; - } - - setvisualpage(1); - setactivepage(1); - input >> NL; - putimage(ch.x, ch.y, p, 0); - - if (flav == ch_ega) { - freemem(p, s); - s = 4 * (((x2 / 8) - (x1 / 8)) + 2) * (y2 - y1 + 1); - { - ch.size = s; - ch.x = ch.x / 8; - ch.xl = ((realx - ch.x * 8) + (x2 - x1) + 7) / 8; - mgrab(ch.x, ch.y, ch.x + ch.xl, ch.y + ch.yl, s); - } - } else - /* For BGI pictures. */ - { - ch.x = ch.x / 8; - ch.xl = (ch.xl + 7) / 8; - ch.size = imagesize(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl); - } - - input >> NL; - setvisualpage(0); - setactivepage(0); - - blockwrite(f, ch, sizeof(ch)); - - switch (flav) { - case ch_ega : - if (! nat) blockwrite(f, aa, s); - break; - case ch_bgi : { - if (! nat) blockwrite(f, p, s); - freemem(p, s); - } - break; - } - /* rectangle(x1,y1,x2,y2);*/ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 4; - - open_chunk(); - - grab(46, 53, 107, 81, 246, 88, ch_ega, false, false); /*1 - all numbers are */ - grab(115, 53, 175, 81, 248, 88, ch_ega, false, false); /*2 door stages. */ - grab(180, 53, 241, 81, 246, 88, ch_ega, false, false); /*3 */ - grab(180, 53, 246, 84, 246, 88, ch_bgi, true , true); /*4 */ - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/chunkxfl.cpp b/engines/avalanche/chunkxfl.cpp deleted file mode 100644 index 78ecd177934f..000000000000 --- a/engines/avalanche/chunkxfl.cpp +++ /dev/null @@ -1,184 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ -#include "cadburys.h" - -namespace Avalanche { - -void finder() { - char r; - integer x, y; - - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -void load() { - byte a1 /*absolute $A400:800*/; - byte bit; - untyped_file f; - - - assign(f, "place51.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a1, 12080); - } - - close(f); - bit = getpixel(0, 0); - setvisualpage(1); - setactivepage(1); - finder(); - setvisualpage(0); - setactivepage(0); -} - -void loadtemp() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f, "chunkbi4.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - - bit = getpixel(0, 0); - - finder(); -} - -void open_chunk() { - assign(f, "chunk51.avd"); - rewrite(f, 1); - blockwrite(f, chunkheader, sizeof(chunkheader)); - blockwrite(f, num_chunks, 1); - blockwrite(f, offsets, num_chunks * 4); - - this_chunk = 0; -} - -void close_chunk() { - seek(f, 45); - blockwrite(f, offsets, num_chunks * 4); /* make sure they're right! */ - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); - loadtemp(); - setwritemode(xorput); - - num_chunks = 9; - - open_chunk(); - - grab(346, 119, 404, 154, 539, 116, ch_ega, true , false); /*1 fire */ - grab(435, 119, 490, 154, 541, 116, ch_ega, true , false); /*2 fire */ - grab(435, 119, 490, 154, 541, 116, ch_bgi, true , true); /*3 natural fire */ - - grab(300, 58, 315, 68, 258, 95, ch_ega, true , false); /*6 Duck's head 2 */ - grab(246, 52, 259, 62, 258, 95, ch_ega, true , false); /*5 Duck blinks 1 */ - - grab(300, 58, 315, 68, 258, 95, ch_bgi, true , true); /*4 Duck's head 1 */ - grab(262, 52, 278, 62, 257, 95, ch_ega, true , false); /*7 Duck blinks 2 */ - - grab(333, 58, 347, 68, 258, 95, ch_ega, true , false); /*8 Duck's head 3 */ - grab(250, 63, 265, 73, 258, 95, ch_ega, true , false); /*9 Duck blinks 3 */ - - close_chunk(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp deleted file mode 100644 index 4f36cb7caa04..000000000000 --- a/engines/avalanche/clock.cpp +++ /dev/null @@ -1,94 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const integer xm = 511; -const integer ym = 184; -integer gd, gm; -word oh, om,/*os,*/h, m, s, s1; -char r; - -void hand(word ang, word length, byte colour) { - arccoordstype a; - if (ang > 900) return; - setcolor(colour); - arc(xm, ym, 449 - ang, 450 - ang, length); - getarccoords(a); - line(xm, ym, a.xend, a.yend); /* "With a do-line???!", Liz said */ -} - -void chime() { - integer gd, gm, fv; - if (oh > 177) return; /* too high- must be first time around */ - fv = h / 30; - if (fv == 0) fv = 12; - for (gd = 1; gd <= fv; gd ++) { - for (gm = 1; gm <= 3; gm ++) { - sound(140 - gm * 30); - delay(50 - gm * 3); - } - nosound; - if ((cardinal)gd != oh) delay(100); - } -} - -void plothands() { - hand(oh, 17, brown); - hand(h, 17, yellow); - hand(om * 6, 20, brown); - hand(m * 6, 20, yellow); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - setfillstyle(1, 6); - bar(0, 0, 640, 200); - oh = 17717; - om = 17717; - do { - gettime(h, m, s, s1); - h = (h % 12) * 30 + m / 2; - if (oh != h) { - plothands(); - chime(); - } - if (om != m) plothands(); - oh = h; - om = m; - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp deleted file mode 100644 index 52a09b1b4799..000000000000 --- a/engines/avalanche/closing.cpp +++ /dev/null @@ -1,156 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - CLOSING The closing screen and error handler. */ - -#define __closing_implementation__ - - -#include "closing.h" - - -#include "gyro.h" -#include "Graph.h" -/*#include "Crt.h"*/ -#include "lucerna.h" - -namespace Avalanche { - -typedef array<1, 3840, char> scrtype; - -scrtype q /*absolute $B8FA:0*/; /* Nobody's using the graphics memory now. */ -file f; -pointer exitsave; - -void get_screen(byte which) { - closegraph(); - textattr = 0; - clrscr; - assign(f, string("text") + strf(which) + ".scr"); - reset(f); - f >> q; - close(f); -} - -void show_screen() { - byte fv, ff, fq, tl, bl; - scrtype a /*absolute $B800:0*/; - for (fv = 1; fv <= 40; fv ++) { - if (fv > 36) { - tl = 1; - bl = 24; - } else { - tl = 12 - fv / 3; - bl = 12 + fv / 3; - } - for (fq = tl; fq <= bl; fq ++) - for (ff = 80 - fv * 2; ff <= 80 + fv * 2; ff ++) - a[fq * 160 - ff] = q[fq * 160 - ff]; - delay(5); - } - gotoxy(1, 25); - textattr = 31; - clreol; - gotoxy(1, 24); -} - -void quit_with(byte which, byte errorlev) { - dusk(); - get_screen(which); - show_screen(); /* No changes. */ - exit(errorlev); -} - -void put_in(string x, word where) { - word fv; - for (fv = 1; fv <= length(x); fv ++) - q[1 + (where + fv) * 2] = x[fv]; -} - -void end_of_program() - -{ - const array<0, 11, varying_string<11> > nouns = { - { - "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", - "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" - } - }; - - const array<0, 11, varying_string<9> > verbs = { - { - "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", - "ignore", "stare at", "shriek at", "frighten", "quieten" - } - }; - - string result; - nosound; - get_screen(scr_nagscreen); - result = nouns[Random(12)] + " will " + verbs[Random(12)] + " you"; - put_in(result, 1628); - show_screen(); /* No halt- it's already set up. */ -} - -/*$F+*/ - -void bug_handler() { - exitproc = exitsave; - - if (erroraddr != nil) { - ; /* An error occurred! */ - if (exitcode == 203) - get_screen(scr_ramcram); - else { - get_screen(scr_bugalert); - put_in(strf(exitcode), 678); /* 678 = [38,8]. */ - put_in(strf(seg(erroraddr)) + ':' + strf(ofs(erroraddr)), 758); /* 758 = [38,9]. */ - } - show_screen(); - erroraddr = nil; - } -} - -/*$F-*/ - -class unit_closing_initialize { -public: - unit_closing_initialize(); -}; -static unit_closing_initialize closing_constructor; - -unit_closing_initialize::unit_closing_initialize() { - exitsave = exitproc; - exitproc = &bug_handler; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h deleted file mode 100644 index 3e63e368150a..000000000000 --- a/engines/avalanche/closing.h +++ /dev/null @@ -1,45 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __closing_h__ -#define __closing_h__ - -namespace Avalanche { - -const integer scr_bugalert = 1; -const integer scr_ramcram = 2; -const integer scr_nagscreen = 3; -const integer scr_twocopies = 5; - - -void quit_with(byte which, byte errorlev); - -void end_of_program(); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/convert.cpp b/engines/avalanche/convert.cpp deleted file mode 100644 index 8ab4b2d979ab..000000000000 --- a/engines/avalanche/convert.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -string fn1, fn2; -varying_string<30> desc; - -void loadscreen(string nam) { - byte z; - array<1, 4, pointer> a; - untyped_file f; - word s; - string check; - assign(f, nam); - reset(f, 1); - blockread(f, check, 41); - blockread(f, check, 13); - blockread(f, check, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(a[z], s); - blockread(f, a[z], s); - setactivepage(0); - putimage(0, 15 + (z - 1) * 75, a[z], 0); - freemem(a[z], s); - } - close(f); -} - -void load2(string name) { - byte a /*absolute $A000:1200*/; - byte bit; - untyped_file f; - assign(f, name); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 12080); - } - close(f); -} - -void save2(string name) { - const string header = - string("This is a file from an Avvy game, and its contents are subject to ") + - "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; - byte a /*absolute $A000:1200*/; - byte bit; - untyped_file f; - assign(f, name); - rewrite(f, 1); - blockwrite(f, header[1], 146); /* really 90 */ - blockwrite(f, desc, 31); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, a, 12080); - } - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "Filename?"; - input >> fn1 >> NL; - output << "New name?"; - input >> fn2 >> NL; - output << "Describe?"; - input >> desc >> NL; - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - loadscreen(fn1); - save2(fn2); - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/convmous.cpp b/engines/avalanche/convmous.cpp deleted file mode 100644 index 0a0bbce97880..000000000000 --- a/engines/avalanche/convmous.cpp +++ /dev/null @@ -1,125 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Binu.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -/* ...gogogoch */struct cursor { - matrix<0, 1, 0, 15, word> mask; - integer horzhotspot, verthotspot; -}; -typedef /* ha ha */matrix<0, 1, 0, 15, varying_string<16> > precursor; - -const array<0, 3, byte> colours = {{darkgray, blue, white, green}}; - -cursor c_current; -boolean usepointer; -precursor cpc; -byte hhs, vhs; -string fn, desc; -integer gd, gm; - -void recalc() { - byte a, b; - { - for (a = 0; a <= 1; a ++) - for (b = 0; b <= 15; b ++) - c_current.mask[a][b] = bintoword(cpc[a][b]); - c_current.horzhotspot = hhs; - c_current.verthotspot = vhs; - } -} - -void load() { - text t; - string x; - byte a, b; - assign(t, fn); - reset(t); - do { - t >> x >> NL; - } while (!(x == '|')); /* bypass junk */ - t >> desc >> NL; - for (a = 0; a <= 1; a ++) - for (b = 0; b <= 15; b ++) - t >> cpc[a][b] >> NL; - t >> hhs >> NL; - t >> vhs >> NL; - close(t); - recalc(); -} - -void display() { - const integer o0 = ord('0'); - const integer o1 = ord('1'); - byte x, y, p1, p2; - for (y = 0; y <= 15; y ++) { - for (x = 1; x <= 16; x ++) { - switch (ord(cpc[0][y][x]) * 2 + ord(cpc[1][y][x])) { - case o0*2+o0: { - p1 = 0; - p2 = 0; - } - break; /* p1= silhouette, p2= real */ - case o0*2+o1: { - p1 = 0; - p2 = 15; - } - break; - case o1*2+o0: { - p1 = 15; - p2 = 0; - } - break; - case o1*2+o1: { - p1 = 9; - p2 = 9; - } - break; /* invalid- can't use this */ - } - putpixel(x - 1, y, p1); - putpixel(x + 99, y, p2); - } - output << NL; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - fn = "d:screwdri.inc"; - load(); - display(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/credits.cpp b/engines/avalanche/credits.cpp deleted file mode 100644 index adb2057ec93d..000000000000 --- a/engines/avalanche/credits.cpp +++ /dev/null @@ -1,121 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -/*$R+*/ - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -integer gd, gm; -text t; -array<1, 2, fonttype> f; -file ff; -array<1, 80, byte> l; -varying_string<80> x; - -void do_one(byte z) { - byte a /*absolute $A000:0*/; - byte aa /*absolute $A000:80*/; - byte az /*absolute $A000:27921*/; - a = getpixel(0, 0); - move(l, az, z); - - port[0x3c5] = 8; - port[0x3cf] = 0; - move(aa, a, 27920); -} - -void background() { - byte y; - for (y = 1; y <= 15; y ++) { - setcolor(y); - outtextxy(17, y * 12, "Jesus is Lord!"); - } -} - -void scroll(string z) { - byte x, y, lz; - char c; - fillchar(l, 80, '\0'); - if (z == "") - for (y = 1; y <= 12; y ++) do_one(0); - c = z[1]; - Delete(z, 1, 1); - lz = length(z); - switch (c) { - case '*': - for (y = 0; y <= 15; y ++) { - for (x = 1; x <= lz; x ++) - l[x] = f[2][z[x]][y]; - do_one(lz); - } - break; - case '>': { - lz += 7; - for (y = 0; y <= 13; y ++) { - for (x = 1; x <= lz; x ++) - l[x + 7] = f[1][z[x]][y]; - do_one(lz); - do_one(lz); /* double-height characters */ - } - } - break; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - port[0x3c4] = 2; - port[0x3cf] = 4; - assign(ff, "avalot.fnt"); - reset(ff); - ff >> f[1]; - close(ff); - assign(ff, "avitalic.fnt"); - reset(ff); - ff >> f[2]; - close(ff); - assign(t, "credits.txt"); - reset(t); - background(); - for (gd = 8; gd <= 15; gd ++) setpalette(gd, 62); - do { - t >> x >> NL; - scroll(x); - } while (!(eof(t) || keypressed())); - close(t); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/displtxt.cpp b/engines/avalanche/displtxt.cpp deleted file mode 100644 index a807743a1e03..000000000000 --- a/engines/avalanche/displtxt.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const char fn[] = "text3.scr"; - -typedef array<1, 3840, char> atype; - -file f; -word fv, ff, fq, st; -char r; -byte tl, bl; -atype q; -atype a /*absolute $B800:0*/; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 0; - clrscr; - assign(f, fn); - reset(f); - f >> q; - close(f); - for (fv = 1; fv <= 40; fv ++) { - if (fv > 36) { - tl = 1; - bl = 24; - } else { - tl = 12 - fv / 3; - bl = 12 + fv / 3; - } - for (fq = tl; fq <= bl; fq ++) - for (ff = 80 - fv * 2; ff <= 80 + fv * 2; ff ++) - a[fq * 160 - ff] = q[fq * 160 - ff]; - delay(5); - } - gotoxy(1, 25); - textattr = 31; - clreol; - gotoxy(1, 24); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp deleted file mode 100644 index c5b2c5004204..000000000000 --- a/engines/avalanche/dropdown.cpp +++ /dev/null @@ -1,916 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - DROPDOWN A customised version of Oopmenu (qv). */ - -#define __dropdown_implementation__ - - -#include "dropdown.h" - - -/*#include "Crt.h"*/ -#include "graph.h" -/*#include "Dos.h"*/ -#include "lucerna.h" -#include "Gyro.h" -#include "acci.h" -#include "trip5.h" -#include "enid.h" -#include "basher.h" - -namespace Avalanche { - -/*$V-*/ -const integer indent = 5; -const integer spacing = 10; - -/* menu_b = blue; { Morpheus } - menu_f = yellow; - menu_border = black; - highlight_b = lightblue; - highlight_f = yellow; - disabled = lightgray; */ - -const integer menu_b = lightgray; /* Windowsy */ -const integer menu_f = black; -const integer menu_border = black; -const integer highlight_b = black; -const integer highlight_f = white; -const integer disabled = darkgray; - -char r; -byte fv; - -void find_what_you_can_do_with_it() { - switch (thinks) { - case wine: - case ink: - verbstr = string(vb_exam) + vb_drink; - break; - case bell: - verbstr = string(vb_exam) + vb_ring; - break; - case potion: - case wine: - verbstr = string(vb_exam) + vb_drink; - break; - case chastity: - verbstr = string(vb_exam) + vb_wear; - break; - case lute: - verbstr = string(vb_exam) + vb_play; - break; - case mushroom: - case onion: - verbstr = string(vb_exam) + vb_eat; - break; - case clothes: - verbstr = string(vb_exam) + vb_wear; - break; - default: - verbstr = vb_exam; /* anything else */ - } -} - -void chalk(integer x, integer y, char t, string z, boolean valid) { - byte fv, ff, p, bit; - word pageseg; - byte ander; - - pageseg = 0xa000 + cp * 0x400; - - if (valid) ander = 255; - else ander = 170; - - for (fv = 1; fv <= length(z); fv ++) - for (ff = 0; ff <= 7; ff ++) - for (bit = 0; bit <= 2; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - mem[pageseg * x + fv - 1 + (y + ff) * 80] = ~(little[z[fv]][ff] & ander); - } - - for (ff = 0; ff <= 8; ff ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << 3; - port[0x3cf] = 3; - fillchar(mem[pageseg * x + (y + ff) * 80], length(z), '\0'); /* blank it out. */ - } - - p = pos(t, z); - if (p == 0) return; - p -= 1; - - for (bit = 0; bit <= 2; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - mem[pageseg * x + p + (y + 8) * 80] = ~ ander; - } - - blitfix(); -} - -void hlchalk(integer x, integer y, char t, string z, boolean valid) -/* Highlighted. */ -{ - byte fv, ff, p; - word pageseg; - byte ander; - - pageseg = 0xa000 + cp * 0x400; - - if (valid) ander = 255; - else ander = 170; - - for (fv = 1; fv <= length(z); fv ++) - for (ff = 0; ff <= 7; ff ++) - mem[pageseg * x + fv - 1 + (y + ff) * 80] = little[z[fv]][ff] & ander; - - p = pos(t, z); - if (p == 0) return; - p -= 1; - - mem[pageseg * x + p + (y + 8) * 80] = ander; - blitfix(); -} - -/*procedure say(x,y:integer; t:char; z:string; f,b:byte); -begin; - settextjustify(0,2); setfillstyle(1,b); setcolor(f); - bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)); - chalk(x,y,t,z); -end;*/ - -void bleep() { - sound(177); - delay(7); - nosound; -} - -void onemenu::start_afresh() { - number = 0; - width = 0; - firstlix = false; - oldy = 0; - highlightnum = 0; -} - -onemenu *onemenu::init() { - menunow = false; - ddmnow = false; - menunum = 1; - return this; -} - -void onemenu::opt(string n, char tr, string key, boolean val) { - integer l; - number += 1; - l = length(n + key) + 3; - if (width < l) width = l; - { - optiontype &with = oo[number]; - with.title = n; - with.trigger = tr; - with.shortcut = key; - with.valid = val; - } -} - -void onemenu::displayopt(byte y, boolean highlit) { - string data; - { - optiontype &with = oo[y]; - - if (highlit) - setfillstyle(1, 0); - else - setfillstyle(1, 7); - bar((flx1 + 1) * 8, 3 + y * 10, (flx2 + 1) * 8, 12 + y * 10); - - /* settextjustify(2,2); - if shortcut>'' then outtextxy(flx2,4+y*10,shortcut);*/ - - data = with.title; - - while (length(data + with.shortcut) < width) - data = data + ' '; /* Pad with spaces. */ - - data = data + with.shortcut; - - if (highlit) - hlchalk(left, 4 + y * 10, with.trigger, data, with.valid); - else - chalk(left, 4 + y * 10, with.trigger, data, with.valid); - - } -} - -void onemenu::display() { - byte y; - off(); - setactivepage(cp); - setvisualpage(cp); - setfillstyle(1, menu_b); - setcolor(menu_border); - firstlix = true; - flx1 = left - 2; - flx2 = left + width; - fly = 14 + number * 10; - menunow = true; - ddmnow = true; - - bar((flx1 + 1) * 8, 12, (flx2 + 1) * 8, fly); - rectangle((flx1 + 1) * 8 - 1, 11, (flx2 + 1) * 8 + 1, fly + 1); - - displayopt(1, true); - for (y = 2; y <= number; y ++) { - optiontype &with = oo[y]; - displayopt(y, false); - } - defaultled = 1; - cmp = 177; - mousepage(cp); - on(); /* 4= fletch */ -} - -void onemenu::wipe() { - bytefield r; - setactivepage(cp); - off(); - { - headtype &with = ddm_m.ddms[ddm_o.menunum]; - chalk(with.xpos, 1, with.trigger, with.title, true); - } - /* mblit((flx1-3) div 8,11,((flx2+1) div 8)+1,fly+1,3,cp);*/ - - /* with r do - begin; - x1:=flx1; - y1:=11; - x2:=flx2+1; - y2:=fly+1; - end; - getset[cp].remember(r);*/ - - mblit(flx1, 11, flx2 + 1, fly + 1, 3, cp); - blitfix(); - menunow = false; - ddmnow = false; - firstlix = false; - defaultled = 2; - on_virtual(); -} - -void onemenu::movehighlight(shortint add) { - shortint hn; - if (add != 0) { - hn = highlightnum + add; - if ((hn < 0) || (hn >= (unsigned char)number)) return; - highlightnum = hn; - } - setactivepage(cp); - off(); - displayopt(oldy + 1, false); - displayopt(highlightnum + 1, true); - setactivepage(1 - cp); - oldy = highlightnum; - on(); -} - -void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - if ((mx < (cardinal)flx1 * 8) || (mx > (cardinal)flx2 * 8) || (my <= 12) || (my > (cardinal)fly - 3)) return; - highlightnum = (my - 13) / 10; - if (highlightnum == oldy) return; - movehighlight(0); -} - -void onemenu::select(byte n) { /* Choose which one you want. */ - if (! oo[n + 1].valid) return; - choicenum = n; - wipe(); - - if (choicenum == number) choicenum -= 1; /* Off the bottom. */ - if (choicenum > number) choicenum = 0; /* Off the top, I suppose. */ - - ddm_m.ddms[menunum].do_choose(); -} - -void onemenu::keystroke(char c) { - byte fv; - boolean found; - c = upcase(c); - found = false; - for (fv = 1; fv <= number; fv ++) { - optiontype &with = oo[fv]; - if ((upcase(with.trigger) == c) && with.valid) { - select(fv - 1); - found = true; - } - } - if (! found) blip(); -} - -headtype *headtype::init -(char trig, char alttrig, string name, byte p, proc dw, proc dc) { - trigger = trig; - alttrigger = alttrig; - title = name; - position = p; - xpos = (position - 1) * spacing + indent; - xright = position * spacing + indent; - do_setup = dw; - do_choose = dc; - return this; -} - -void headtype::display() { - off(); /*MT*/ - chalk(xpos, 1, trigger, title, true); - on(); /*MT*/ -} - -void headtype::highlight() { - off(); - off_virtual(); - nosound; - setactivepage(cp); - hlchalk(xpos, 1, trigger, title, true); - { - ddm_o.left = xpos; - ddm_o.menunow = true; - ddmnow = true; - ddm_o.menunum = position; - } - cmp = 177; /* Force redraw of cursor. */ -} - -boolean headtype::extdparse(char c) { - boolean extdparse_result; - if (c != alttrigger) { - extdparse_result = true; - return extdparse_result; - } - extdparse_result = false; - return extdparse_result; -} - -menuset *menuset::init() { - howmany = 0; - return this; -} - -void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { - howmany += 1; - ddms[howmany].init(t, alttrig, n, howmany, dw, dc); -} - -void menuset::update() { - const bytefield menuspace = {0, 0, 80, 9}; - byte fv, page_, savecp; - setactivepage(3); - setfillstyle(1, menu_b); - bar(0, 0, 640, 9); - savecp = cp; - cp = 3; - - for (fv = 1; fv <= howmany; fv ++) - ddms[fv].display(); - - for (page_ = 0; page_ <= 1; page_ ++) - getset[page_].remember(menuspace); - - cp = savecp; -} - -void menuset::extd(char c) { - byte fv; - fv = 1; - while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; - if (fv > howmany) return; - getcertain(fv); -} - -void menuset::getcertain(byte fv) { - { - headtype &with = ddms[fv]; - { - if (ddm_o.menunow) { - wipe(); /* get rid of menu */ - if (ddm_o.menunum == with.position) return; /* clicked on own highlight */ - } - highlight(); - do_setup(); - } - } -} - -void menuset::getmenu(integer x) { - byte fv; - fv = 0; - do { - fv += 1; - if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { - getcertain(fv); - return; - } - } while (!(fv > howmany)); -} - -void parsekey(char r, char re) { - switch (r) { - case '\0': - case '\340': { - switch (re) { - case 'K': - if (ddm_o.menunum > 1) { - wipe(); - ddm_m.getcertain(ddm_o.menunum - 1); - } else { - ; /* Get menu on the left-hand side */ - wipe(); - ddm_m.getmenu((ddm_m.howmany - 1)*spacing + indent); - } - break; - case 'M': - if (ddm_o.menunum < ddm_m.howmany) { - wipe(); - ddm_m.getcertain(ddm_o.menunum + 1); - } else { - ; /* Get menu on the far right-hand side */ - wipe(); - ddm_m.getmenu(indent); - } - break; - case 'H': - movehighlight(-1); - break; - case 'P': - movehighlight(1); - break; - default: - ddm_m.extd(re); - } - } - break; - case '\15': - select(ddm_o.highlightnum); - break; - default: { - if (ddm_o.menunow) keystroke(r); - } - } -} - -/*$F+ *** Here follow all the ddm__ and do__ procedures for the DDM system. */ - -void ddm__game() { - { - start_afresh(); - opt("Help...", 'H', "f1", true); - opt("Boss Key", 'B', "alt-B", true); - opt("Untrash screen", 'U', "ctrl-f7", true); - opt("Score and rank", 'S', "f9", true); - opt("About Avvy...", 'A', "shift-f10", true); - display(); - } -} - -void ddm__file() { - { - start_afresh(); - opt("New game", 'N', "f4", true); - opt("Load...", 'L', "^f3", true); - opt("Save", 'S', "^f2", alive); - opt("Save As...", 'v', "", alive); - opt("DOS Shell", 'D', atkey + '1', true); - opt("Quit", 'Q', "alt-X", true); - display(); - } -} - -void ddm__action() { - string n; - n = copy(f5_does(), 2, 255); - - { - start_afresh(); - if (n == "") - opt("Do something", 'D', "f5", false); - else - opt(copy(n, 2, 255), n[1], "f5", true); - opt("Pause game", 'P', "f6", true); - if (dna.room == 99) - opt("Journey thither", 'J', "f7", neardoor()); - else - opt("Open the door", 'O', "f7", neardoor()); - opt("Look around", 'L', "f8", true); - opt("Inventory", 'I', "Tab", true); - if (tr[1].xs == walk) - opt("Run fast", 'R', "^R", true); - else - opt("Walk slowly", 'W', "^W", true); - display(); - } -} - -void ddm__people() { - byte here; - char fv; - - people = ""; - here = dna.room; - - { - start_afresh(); - for (fv = '\226'; fv <= '\262'; fv ++) - if (whereis[fv] == here) { - opt(getname(fv), getnamechar(fv), "", true); - people = people + fv; - } - display(); - } -} - -void ddm__objects() { - char fv; - { - start_afresh(); - for (fv = '\1'; fv <= numobjs; fv ++) - if (dna.obj[fv]) - opt(get_thing(fv), get_thingchar(fv), "", true); - display(); - } -} - -string himher(char x) { /* Returns "im" for boys, and "er" for girls.*/ - string himher_result; - if (x < '\257') himher_result = "im"; - else himher_result = "er"; - return himher_result; -} - -void ddm__with() { - byte fv; - varying_string<7> verb; - char vbchar; - boolean n; - { - start_afresh(); - - if (thinkthing) { - - find_what_you_can_do_with_it(); - - for (fv = 1; fv <= length(verbstr); fv ++) { - verbopt(verbstr[fv], verb, vbchar); - opt(verb, vbchar, "", true); - } - - /* We disable the "give" option if: (a), you haven't selected anybody, - (b), the person you've selected isn't in the room, - or (c), the person you've selected is YOU! */ - - if ((set::of(nowt, pavalot, eos).has(last_person)) || - (whereis[last_person] != dna.room)) - opt("Give to...", 'G', "", false); /* Not here. */ else { - opt(string("Give to ") + getname(last_person), 'G', "", true); - verbstr = verbstr + vb_give; - } - - } else { - opt("Examine", 'x', "", true); - opt(string("Talk to h") + himher(thinks), 'T', "", true); - verbstr = string(vb_exam) + vb_talk; - switch (thinks) { - - case pgeida: - case parkata: { - opt("Kiss her", 'K', "", true); - verbstr = verbstr + vb_kiss; - } - break; - - case pdogfood: { - opt("Play his game", 'P', "", ! dna.wonnim); /* True if you HAVEN'T won. */ - verbstr = verbstr + vb_play; - } - break; - - case pmalagauche: { - n = ! dna.teetotal; - opt("Buy some wine", 'w', "", ! dna.obj[wine]); - opt("Buy some beer", 'b', "", n); - opt("Buy some whisky", 'h', "", n); - opt("Buy some cider", 'c', "", n); - opt("Buy some mead", 'm', "", n); - verbstr = verbstr + '\145' + '\144' + '\146' + '\147' + '\150'; - } - break; - - case ptrader: { - opt("Buy an onion", 'o', "", ! dna.obj[onion]); - verbstr = verbstr + '\151'; - } - break; - - } - } - display(); - } -} - -/*procedure ddm__map; -begin; - with ddm_o do - begin; - start_afresh; - opt('Cancel map','G','f5',true); - opt('Pause game','P','f6',true); - opt('Journey thither','J','f7',neardoor); - opt('Explanation','L','f8',true); - display; - end; -end; - -procedure ddm__town; -begin; - with ddm_o do - begin; - start_afresh; - opt('Argent','A','',true); - opt('Birmingham','B','',true); - opt('Nottingham','N','',true); - opt('Cardiff','C','',true); - display; - end; -end;*/ - -void do__game() { - switch (ddm_o.choicenum) { - /* Help, boss, untrash screen. */ - case 0: - callverb(vb_help); - break; - case 1: - callverb(vb_boss); - break; - case 2: - major_redraw(); - break; - case 3: - callverb(vb_score); - break; - case 4: - callverb(vb_info); - break; - } -} - -void do__file() { - switch (ddm_o.choicenum) { - /* New game, load, save, save as, DOS shell, about, quit. */ - case 0: - callverb(vb_restart); - break; - case 1: { - realwords[2] = ""; - callverb(vb_load); - } - break; - case 2: { - realwords[2] = ""; - callverb(vb_save); - } - break; - case 3: - filename_edit(); - break; - case 4: - back_to_bootstrap(2); - break; - case 5: - callverb(vb_quit); - break; - } -} - -void do__action() { - string n; - switch (ddm_o.choicenum) { - /* Get up/pause game/open door/look/inv/walk-run */ - case 0: { - person = pardon; - thing = pardon; - n = f5_does(); - callverb(n[1]); - } - break; - case 1: - callverb(vb_pause); - break; - case 2: - callverb(vb_open); - break; - case 3: - callverb(vb_look); - break; - case 4: - callverb(vb_inv); - break; - case 5: { - if (tr[1].xs == walk) tr[1].xs = run; - else tr[1].xs = walk; - newspeed(); - } - break; - } -} - -void do__objects() { - thinkabout(objlist[ddm_o.choicenum + 1], a_thing); -} - -void do__people() { - thinkabout(people[ddm_o.choicenum + 1], a_person); - last_person = people[ddm_o.choicenum + 1]; -} - -void do__with() { - thing = thinks; - - if (thinkthing) { - - thing += 49; - - if (verbstr[ddm_o.choicenum + 1] == vb_give) - person = last_person; - else - person = '\376'; - - } else { - switch (verbstr[ddm_o.choicenum + 1]) { - case '\144': { - thing = '\144'; - callverb(vb_buy); - return; - } - break; /* Beer */ - case '\145': { - thing = '\62'; - callverb(vb_buy); - return; - } - break; /* Wine */ - case '\146': { - thing = '\146'; - callverb(vb_buy); - return; - } - break; /* Whisky */ - case '\147': { - thing = '\147'; - callverb(vb_buy); - return; - } - break; /* Cider */ - case '\150': { - thing = '\153'; - callverb(vb_buy); - return; - } - break; /* Mead */ - case '\151': { - thing = '\103'; - callverb(vb_buy); - return; - } - break; /* Onion (trader) */ - default: { - person = thing; - thing = '\376'; - } - } - } - callverb(verbstr[ddm_o.choicenum + 1]); -} - -/*$F- That's all. Now for the ...bar procs. */ - -void standard_bar() { /* Standard menu bar */ - ddm_m.init(); - ddm_o.init(); - { - ; /* Set up menus */ - create('F', "File", '!', ddm__file, do__file); /* same ones in map_bar, below, */ - create('G', "Game", '\42', ddm__game, do__game); /* Don't forget to change the */ - create('A', "Action", '\36', ddm__action, do__action); /* if you change them */ - create('O', "Objects", '\30', ddm__objects, do__objects); /* here... */ - create('P', "People", '\31', ddm__people, do__people); - create('W', "With", '\21', ddm__with, do__with); - update(); - } -} - -/*procedure map_bar; { Special menu bar for the map (screen 99) } -begin; - ddm_m.init; ddm_o.init; - with ddm_m do - begin; { Set up menus } - create('G','Game','#',ddm__game,do__game); - create('F','File','!',ddm__file,do__test); - create('M','Map','2',ddm__map,do__test); - create('T','Town',#20,ddm__town,do__test); - update; - end; -end;*/ - -void checkclick() { /* only for when the menu's displayed */ - if (mpress > 0) { - if (mpy > 10) { - if (!((ddm_o.firstlix) && - ((mpx >= (cardinal)ddm_o.flx1 * 8) && (mpx <= (cardinal)ddm_o.flx2 * 8) && - (mpy >= 12) && (mpy <= (cardinal)ddm_o.fly)))) { - ; /* Clicked OUTSIDE the menu. */ - if (ddm_o.menunow) wipe(); - } /* No "else"- clicking on menu has no effect (only releasing) */ - } else { - ; /* Clicked on menu bar */ - ddm_m.getmenu(mpx); - } - } else { - ; /* NOT clicked button... */ - if (mrelease > 0) { - if ((ddm_o.firstlix) && - ((mrx >= (cardinal)ddm_o.flx1 * 8) && (mrx <= (cardinal)ddm_o.flx2 * 8) && - (mry >= 12) && (mry <= (cardinal)ddm_o.fly))) - select((mry - 13) / 10); - } - } -} - -void menu_link() { - { - if (! ddm_o.menunow) return; - - check(); /* find mouse coords & click information */ - checkclick(); /* work out click codes */ - - /* Change arrow... */ - - switch (my) { - case RANGE_11(0, 10): - newpointer(1); - break; /* up-arrow */ - case 11 ... 169: { - if ((mx >= (cardinal)ddm_o.flx1 * 8) && (mx <= (cardinal)ddm_o.flx2 * 8) && (my > 10) && (my <= (cardinal)ddm_o.fly)) - newpointer(3); /* right-arrow */ - else newpointer(4); /* fletch */ - } - break; - case RANGE_32(169, 200): - newpointer(2); - break; /* screwdriver */ - } - - if (! ddm_o.menunow) return; - - lightup(); - } -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h deleted file mode 100644 index e39e6f1d671e..000000000000 --- a/engines/avalanche/dropdown.h +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __dropdown_h__ -#define __dropdown_h__ - -namespace Avalanche { - -typedef void(*proc)(); - -class headtype { -public: - varying_string<8> title; - char trigger, alttrigger; - byte position; - integer xpos, xright; - proc do_setup, do_choose; - - headtype *init - (char trig, char alttrig, string name, byte p, proc dw, proc dc); - void display(); - void highlight(); - boolean extdparse(char c); -}; - -struct optiontype { - string title; - char trigger; - varying_string<9> shortcut; - boolean valid; -}; - -class onemenu { -public: - array<1, 12, optiontype> oo; - byte number; - integer width, left; - boolean firstlix; - integer flx1, flx2, fly; - byte oldy; /* used by Lightup */ - boolean menunow; /* Is there a menu now? */ - byte menunum; /* And if so, which is it? */ - byte choicenum; /* Your choice? */ - byte highlightnum; - - void start_afresh(); - void opt(string n, char tr, string key, boolean val); - void display(); - void wipe(); - void lightup(); - void displayopt(byte y, boolean highlit); - void movehighlight(shortint add); - void select(byte n); - void keystroke(char c); - onemenu *init(); -}; - -class menuset { -public: - array<1, 8, headtype> ddms; - byte howmany; - - menuset *init(); - void create(char t, string n, char alttrig, proc dw, proc dc); - void update(); - void extd(char c); - void getcertain(byte fv); - void getmenu(integer x); -}; - - - -#ifdef __dropdown_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN onemenu ddm_o; -EXTERN menuset ddm_m; - -EXTERN varying_string<5> people; -#undef EXTERN -#define EXTERN extern - - - -void find_what_you_can_do_with_it(); - -void parsekey(char r, char re); - -void menu_link(); - -/* DDM menu-bar procs */ - -void standard_bar(); -/*procedure map_bar;*/ - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/dwidth.cpp b/engines/avalanche/dwidth.cpp deleted file mode 100644 index 206ad216314d..000000000000 --- a/engines/avalanche/dwidth.cpp +++ /dev/null @@ -1,51 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -integer gd, gm; -fonttype f; -file ff; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(ff, "v:avalot.fnt"); - reset(ff); - ff >> f; - close(ff); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - for (gd = 0; gd <= 15; gd ++) mem[0xa000 * gd * 80] = f['A'][gd]; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edhead.cpp b/engines/avalanche/edhead.cpp deleted file mode 100644 index af0eea97fcac..000000000000 --- a/engines/avalanche/edhead.cpp +++ /dev/null @@ -1,112 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; -const string ednaid = string("TT") + '\261' + '\36' + '\1' + '\113' + '\261' + '\231' + '\261'; - -struct edhead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS. See below for others.) */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ - -untyped_file f; -byte fv; -array<1, 255, word> dna256; -boolean ok; -edhead e; - -void info(string x) { /* info on .ASG files */ - varying_string<40> describe; - assign(f, x); - /*$I-*/ reset(f, 1); - seek(f, 47); - blockread(f, describe, 40); - blockread(f, dna256, sizeof(dna256)); - close(f); /*$I+*/ - e.revision = 1; - game = "Denarius Avaricius Sextus"; - shortname = "Avaricius"; - number = 1; - verstr = "[?]"; - filename = "AVVY.EXE"; - os = 1; - fn = x; - d = dna256[7]; - m = dna256[8]; - y = dna256[9]; - desc = describe; - len = 512; - saves = dna256[6]; - /*money:string[20]; { ditto in string form (eg 5/-, or 1 denarius)*/ - /*points:word; { your score */ -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - info("tt.asg"); - - output << "Filename: " << x << NL; - output << "Description: " << desc << NL; - output << "Cash: " << dna256[30] << NL; - output << "Score: " << dna256[36] << NL; - output << "Date: " << dna256[7] << ' ' << copy(months, dna256[8] * 3 - 2, 3) << ' ' << dna256[9] << NL; - output << "Number of saves: " << dna256[6] << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/edna.cpp b/engines/avalanche/edna.cpp deleted file mode 100644 index 7299f7c7aa30..000000000000 --- a/engines/avalanche/edna.cpp +++ /dev/null @@ -1,381 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M 10000,0,1000*/ /*$V-*/ - -/*#include "Dos.h"*/ -/*#include "Tommys.h"*/ - -namespace Avalanche { - -struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; - -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ - -typedef array<1, 4, char> fourtype; - -struct avaricius_dna { - varying_string<39> desc; - array<1, 256, integer> dna; -}; - -const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; -const fourtype avaricius_file = "Avvy"; - -string filename; -boolean quiet, info; -ednahead eh; - -boolean avaricius; -fourtype id4; -avaricius_dna av_eh; -varying_string<4> av_ver; - -boolean ok; - -string first_dir; - -void explain() { - output << "EDNA Bucket v1.0 (c) 1993 Thomas Thurman." << NL; - output << " To load Avvy files." << NL; - output << NL; - output << "Associate .ASG files with EDNA.EXE to load them directly." << NL; - output << NL; - output << "Switches:" << NL; - output << " /q (quiet) will stop EDNA from printing text to the screen." << NL; - output << " /i (info) will print info about the file, but won't load it." << NL; - output << NL; - exit(1); -} - -void fix_filename() { - string p, n, groi; - - fsplit(filename, p, n, groi); - filename = p + n + ".ASG"; -} - -void error(string x) { - output << "EDNA : " << x << NL; - exit(255); -} - -void paramparse() { - byte fv; - string x; - - if (paramcount == 0) explain(); - - filename = ""; - quiet = false; - info = false; - - for (fv = 1; fv <= paramcount; fv ++) { - x = paramstr(fv); - - if ((x[1] == '/') || (x[1] == '-')) - switch (upcase(x[2])) { /* Parse switches */ - case 'Q': - quiet = ! quiet; - break; - case 'I': - info = ! info; - break; - default: - error(string("Unknown switch! (") + x[2] + ')'); - } - else if (filename == "") filename = x; - else error("Please, only one filename at a time!"); - } - - if (quiet && info) error("How can you give info quietly??"); - - if (filename == "") error("No filename given! Use EDNA alone for help."); - - fix_filename(); -} - -void getfile() { - untyped_file f; - - assign(f, filename); - /*$I-*/ - reset(f, 1); - /*$I+*/ - if (ioresult != 0) error(string("Can't read file \"") + filename + "\"."); - - seek(f, 11); - blockread(f, id4, 4); - avaricius = id4 == avaricius_file; - - if (avaricius) { - seek(f, 47); - blockread(f, av_eh, sizeof(av_eh)); - av_ver[0] = '\4'; - seek(f, 31); - blockread(f, av_ver[1], 4); - } else { - seek(f, 177); - blockread(f, eh, sizeof(eh)); - } - - close(f); -} - -string plural(byte x) { - string plural_result; - if (x == 1) plural_result = ""; - else plural_result = 's'; - return plural_result; -} - -void show_info() { - string _game, _shortname, _verstr, _filename, _os, _fn, _desc, _money; - integer _revision, _number, _d, _m, _y, _saves, _points; - boolean readable, understandable; - - output << "Info on file " << filename << ':' << NL; - output << NL; - if (avaricius) { - /* DNA-256 file. */ - _verstr = av_ver; - _game = "Denarius Avaricius Sextus"; - _shortname = "Avaricius"; - _filename = "AVVY.EXE"; - _os = "DOS"; - _desc = av_eh.desc; - _revision = 1; - _number = 1; - _fn = "(as above)"; - - _money = strf(av_eh.dna[30]) + " denari"; - if (av_eh.dna[30] == 1) _money = _money + "us"; - else _money = _money + 'i'; - _d = av_eh.dna[7]; - _m = av_eh.dna[8]; - _y = av_eh.dna[9]; - _saves = av_eh.dna[6]; - _points = av_eh.dna[36]; - - readable = true; - understandable = true; - } else { - if (eh.id == ednaid) { - /* EDNA file. */ - _game = eh.game; - _shortname = eh.shortname; - _verstr = eh.verstr; - _filename = eh.filename; - _os = eh.os; - _fn = eh.fn; - _desc = eh.desc; - _money = eh.money; - _revision = eh.revision; - _number = eh.number; - _d = eh.d; - _m = eh.m; - _y = eh.y; - _saves = eh.saves; - _points = eh.points; - - readable = true; - understandable = eh.revision == 2; - } else { - output << "Unknown format." << NL; - readable = false; - } - } - - if (_desc == "") _desc = ""; - - if (readable) { - output << "Signature is valid." << NL; - output << "Revision of .ASG format: " << _revision << NL; - output << NL; - if (understandable) { - output << "The file was saved by " << _game << '.' << NL; - output << "Game number " << _number << " (" << _shortname << "), version " << - _verstr << ", filename " << _filename << '.' << NL; - output << "Saved under " << _os << '.' << NL; - output << NL; - output << "This is " << _fn << ".ASG, saved on " << _d << '/' << _m << '/' << _y << " (d/m/y)." << NL; - output << "Description: " << _desc << NL; - output << "It has been saved " << _saves << " time" << plural(_saves) << - ". You have " << _points << " point" << plural(_points) << ',' << NL; - output << "and " << _money << " in cash." << NL; - } else output << "Nothing else can be discovered." << NL; - } - - exit(2); -} - -void load_file() { - string progname, gamename, shortname, listname, exname, prog_dir; - - string localdir, groi; - - string x, y; - - text t; - - integer i, ii; - - gamename = fexpand(filename); - fsplit(fexpand(paramstr(0)), localdir, groi, groi); - listname = localdir + "EDNA.DAT"; - - if (avaricius) { - shortname = "Avaricius"; - exname = "AVVY"; - } else { - shortname = eh.shortname; - fsplit(eh.filename, groi, exname, groi); - } - - assign(t, listname); - /*$I-*/ - reset(t); - /*$I+*/ - progname = ""; - if (ioresult == 0) { - do { - t >> x >> NL; - t >> y >> NL; - if (x == shortname) { - progname = y; - flush(); - } - } while (!(eof(t))); - } - - if (progname == "") { - /* No entry in EDNA.DAT */ - output << "This file was saved by " << shortname << '.' << NL; - output << "However, no entry was found in EDNA.DAT for that game." << NL; - output << NL; - output << "Please give the full path to that game, or press Enter to cancel." << NL; - output << string("(Example: C:\\") + exname + '\\' + exname + ".EXE)" << NL; - output << NL; - input >> progname >> NL; - if (progname == "") exit(254); /* Quick exit! */ - - /*$I-*/ - append(t); - if (ioresult != 0) rewrite(t); - - t << shortname << NL; - t << progname << NL; - - if (ioresult != 0) { - output << "Strange... could not write to EDNA.DAT. (Disk read-only or full?)" << NL; - output << "The path will be used this time only." << NL; - output << "Press Enter..."; - input >> NL; - } - close(t); - /*$I+*/ - } - - if (! quiet) output << "Running " << shortname << ": " << progname << "..." << NL; - - fsplit(fexpand(progname), prog_dir, groi, groi); - if (prog_dir[length(prog_dir)] == '\\') prog_dir[0] -= 1; - - /*$I-*/ - chdir(prog_dir); - i = ioresult; - swapvectors; - exec(progname, gamename); - ii = ioresult; - swapvectors; - chdir(first_dir); - /*$I+*/ - - if ((i != 0) || (ii != 0)) { - output << "WARNING: DOS reported an error. This probably means that the entry" << NL; - output << "for this game in " << listname << " is wrong." << NL; - output << NL; - output << "Please edit this file, using" << NL; - output << NL; - if (lo(dosversion) < 0x5) - output << " edlin " << listname << " (or similar)" << NL; - else - output << " edit " << listname << NL; - output << NL; - output << "and change the line after \"" << shortname << "\" to show the correct path." << NL; - output << NL; - output << "More info is in the Avvy documentation. Good luck!" << NL; - output << NL; - output << "Press Enter..."; - input >> NL; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getdir(0, first_dir); - paramparse(); - getfile(); - if (info) show_info(); - load_file(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.cpp b/engines/avalanche/enhanced.cpp deleted file mode 100644 index befc4dff35a2..000000000000 --- a/engines/avalanche/enhanced.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __enhanced_implementation__ - - -/* This is the unit set up by Thomas with help from all the people on - CIS:BPROGA to read the *enhanced* keyboard codes (as opposed to the - readkey-type ones.) */ - -#include "enhanced.h" - - -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -boolean isenh() { - byte statefrom16; - registers r; - - boolean isenh_result; - isenh_result = false; - { - ah = 0x12; - intr(0x16, r); - statefrom16 = al; - } - if (statefrom16 != shiftstate) return isenh_result; - shiftstate = shiftstate ^ 0x20; - { - ah = 0x12; - intr(0x16, r); - statefrom16 = al; - } - isenh_result = statefrom16 == shiftstate; - shiftstate = shiftstate ^ 0x20; - return isenh_result; -} - -void readkeye() -/* function fancystuff:word; - inline( $B4/ $10/ { MOV AH,10 } - $CD/ $16); { INT 16 } - function notfancystuff:word; - inline( $B4/ $00/ { MOV AH,0 } - $CD/ $16); { INT 16 } -*/ -{ - registers r; - word fs; - if (atbios) - fs = fancystuff; /* We're using an AT */ - else fs = notfancystuff; /* ditto, an XT */ - inchar = chr(lo(fs)); - extd = chr(hi(fs)); -} - -boolean keypressede() -/* - function fancystuff:boolean; - inline( $B4/ $11/ { MOV AH,11 } - $CD/ $16/ { INT 16 } - $B8/ $00/ $00/ { MOV AX, 0000 } - $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } - $40); { INC AX } -*/ -{ - registers r; - boolean keypressede_result; - if (atbios) - keypressede_result = fancystuff; /* ATs get the fancy stuff */ - else keypressede_result = keypressed(); /* XTs get the usual primitive... */ - return keypressede_result; -} - -class unit_enhanced_initialize { -public: - unit_enhanced_initialize(); -}; -static unit_enhanced_initialize enhanced_constructor; - -unit_enhanced_initialize::unit_enhanced_initialize() { - /* determine bios type */ - atbios = isenh(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enhanced.h b/engines/avalanche/enhanced.h deleted file mode 100644 index 13885f3c1a3c..000000000000 --- a/engines/avalanche/enhanced.h +++ /dev/null @@ -1,51 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __enhanced_h__ -#define __enhanced_h__ - -namespace Avalanche { - -#ifdef __enhanced_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN byte shiftstate;/*ABSOLUTE $40:$17;*/ -EXTERN boolean atbios; -EXTERN char inchar, extd; -#undef EXTERN -#define EXTERN extern - - -void readkeye(); - -boolean keypressede(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp deleted file mode 100644 index 08c37796ca84..000000000000 --- a/engines/avalanche/enid.cpp +++ /dev/null @@ -1,631 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - ENID Edna's manager. */ - -#define __enid_implementation__ -/* Loads/ saves files. */ - -/*$V-*/ - -#include "enid.h" - - -/*#include "Dos.h"*/ -#include "scrolls.h" -#include "lucerna.h" -#include "trip5.h" -#include "timeout.h" -#include "Celer.h" -#include "sequence.h" -#include "fileunit.h" -#include "basher.h" - -namespace Avalanche { - -const string crlf = string('\15') + '\12'; -const char tab = '\11'; -const char eof_ = '\32'; - -const array<1, 177, char> ednafirst = - string("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ - crlf + eof_ + crlf + crlf + /*7*/ - tab + "Glory to God in the highest," + crlf + /*31*/ - tab + "and on earth peace, goodwill toward men." + /*42*/ - crlf + tab + tab + tab + tab + /*6*/ - "Luke 2:14." + /*10*/ - crlf + crlf + crlf + /* 6 */ - "1234567890" +crlf; /*11*/ - -const string ednaid = string("TT") + '\261' + '\60' + '\1' + '\165' + '\261' + '\231' + '\261'; - -const integer ttage = 18; -const array<1, 16, char> ttwashere = "Thomas was here "; - -boolean bug; - -string expanddate(byte d, byte m, word y); - -const array<1, 12, varying_string<7> > months = { - { - "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", - "Septem*", "Octo*", "Novem*", "Decem*" - } -}; - - -static varying_string<10> month; - - -static void addon(string x) { - month[0] -= 1; - month = month + x; -} - -string expanddate(byte d, byte m, word y) { - varying_string<4> day; - - - string expanddate_result; - month = months[m]; - switch (month[length(month)]) { - case '#': - addon("uary"); - break; - case '*': - addon("ber"); - break; - } - - day = strf(d); - - if (set::of(range(1, 9), range(21, 31), eos).has(d)) - switch (d % 10) { - case 1: - day = day + "st"; - break; - case 2: - day = day + "nd"; - break; - case 3: - day = day + "rd"; - break; - default: - day = day + "th"; - } - - expanddate_result = day + ' ' + month + ' ' + strf(y); - return expanddate_result; -} - -void edna_save(string name); - - -static void show_bug(char icon, string strn) { - display(string("\7\6\23") + icon + "\26\r" + strn + '\15'); -} - - - -static boolean test_bug(byte what) { - boolean test_bug_result; - if (what == 0) { - test_bug_result = false; - return test_bug_result; - } - switch (what) { - case 2: - show_bug('7', "Error in filename!"); - break; - case 101: - show_bug('6', "Disk full!"); - break; - case 150: - show_bug('4', "Disk is write-protected!"); - break; - default: - show_bug('B', "Saving error!"); - } - test_bug_result = true; - return test_bug_result; -} - -void edna_save(string name) { - untyped_file f; - ednahead eh; - word groi; - string groi2, path; - word tempd, tempm; - - if (name == "") { - /* We were given no name. Do we have a default? */ - if (enid_filename == "") { - /* No */ - filename_edit(); /* Request one. */ - return; - } else /* Yes */ - name = enid_filename; - } - - wait(); /* Put up hourglass pointer */ - - fillchar(eh, sizeof(eh), '\261'); /* Fill up the edhead */ - - dna.saves += 1; /* It's been saved one more time... */ - - { - - /* Info about this program */ - - eh.id = ednaid; /* Edna's signature */ - eh.revision = thisgamecode; /* 2- second revision of .ASG format */ - eh.game = "Lord Avalot d'Argent"; /* Title of game */ - eh.shortname = "Avalot"; - eh.number = 2; /* Second Avvy game */ - eh.ver = thisvercode; /* Version 1.00 */ - eh.verstr = vernum; /* ditto */ - eh.filename = "AVALOT.EXE"; /* program's filename */ - eh.osbyte = 1; /* Saved under DOS */ - eh.os = "DOS"; - - /* Info on this particular game */ - - fsplit(name, path, eh.fn, groi2); /* fn = filename of this game */ - getdate(eh.y, tempm, tempd, groi); /* Day, month & year when the game was saved */ - eh.d = tempd; - eh.m = tempm; - eh.desc = roomname; /* Description of game (same as in Avaricius!) */ - eh.len = sizeof(dna); /* Length of DNA. */ - - /* Quick reference & miscellaneous */ - - eh.saves = dna.saves; /* no. of times this game has been saved */ - eh.cash = dna.pence; /* contents of your wallet in numerical form */ - eh.money = lsd(); /* ditto in string form (eg 5/-, or 1 denarius)*/ - eh.points = dna.score; /* your score */ - - name = path + eh.fn + ".ASG"; - } - - assign(f, name); - /*$I-*/ - rewrite(f, 1); - if (test_bug(ioresult)) return; - - blockwrite(f, ednafirst, 177); - if (test_bug(ioresult)) return; - blockwrite(f, eh, sizeof(eh)); - if (test_bug(ioresult)) return; - blockwrite(f, dna, sizeof(dna)); - if (test_bug(ioresult)) return; - - for (groi = 1; groi <= numtr; groi ++) { - triptype &with = tr[groi]; - if (with.quick) { - blockwrite(f, groi, 1); - if (test_bug(ioresult)) return; - savedata(f); - if (test_bug(ioresult)) return; - } - } - - groi = 177; - blockwrite(f, groi, 1); - - blockwrite(f, times, sizeof(times)); /* Timeout.times: Timers. */ - - if (test_bug(ioresult)) return; - - blockwrite(f, seq, sizeof(seq)); /* Sequencer information. */ - - if (test_bug(ioresult)) return; - - for (groi = 1; groi <= ttage; groi ++) - blockwrite(f, ttwashere[1 - 1], 16); - - if (test_bug(ioresult)) return; - - close(f); - if (test_bug(ioresult)) return; - /*$I+*/ - - display(string('\6') + "Saved: " + '\22' + name + '.'); - enid_filename = name; -} - -void loaderror(string x, char icon) { - if (holdthedawn) { - holdthedawn = false; - dawn(); - } - display(string('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); - bug = true; -} - - - -typedef array<1, 4, char> fourtype; - - - -const fourtype avaricius_file = "Avvy"; - -void edna_load(string name) - -{ - untyped_file f; - ednahead eh; - byte fv; - byte io; - string path, fn, groi; - fourtype id4; - - word len2load; - - - - if (name == "") { - /* No filename specified, so let's call the filer. */ - name = do_filer(); - if (name == "") return; /* STILL no filename, so they must have cancelled. */ - } - - bug = false; - - wait(); /* Put up hourglass pointer */ - - fsplit(name, path, fn, groi); - name = path + fn + ".ASG"; - - /* Load the file into memory */ - - /*$I-*/ - assign(f, name); - reset(f, 1); - - io = ioresult; - if (io != 0) - switch (io) { - case 2: - loaderror("File not found!", '8'); - break; - case 3: - loaderror("Directory not found!", '3'); - break; - default: - loaderror(string("Error no.") + strf(io), '1'); - } - - if (bug) return; - - seek(f, 11); - blockread(f, id4, 4); - if (id4 == avaricius_file) { - loaderror("That's an Avaricius file!", '1'); - close(f); - return; - } - - seek(f, 177); /* bypass ednafirst */ - - blockread(f, eh, sizeof(eh)); /* load ednahead */ - - /* Check ednahead for errors */ - - { - if ((eh.id != ednaid) || (eh.revision != 2)) loaderror("Not an EDNA file!", '7'); - else if (eh.number != 2) loaderror(string("That file was saved by ") + eh.shortname + '!', '1'); - } - - if (bug) { - close(f); - return; - } - - len2load = eh.len; - - if (eh.len != (cardinal)sizeof(dna)) { - if (holdthedawn) { - holdthedawn = false; - dawn(); - } - display("\233\26Warning: \3\rEDNA size doesn't match.\f"); - if (eh.len > (cardinal)sizeof(dna)) - len2load = sizeof(dna); /* BIGGER than ours */ - else fillchar(dna, sizeof(dna), '\0'); /* Otherwise, smaller. */ - } - - blockread(f, dna, len2load); - - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) done(); - } /* Deallocate sprite */ - - do { - blockread(f, fv, 1); - if (fv != 177) tr[fv].loaddata(f); - } while (!(fv == 177)); - - blockread(f, times, sizeof(times)); /* Timeout.times: Timers. */ - - blockread(f, seq, sizeof(seq)); /* Sequencer information. */ - - close(f); - - seescroll = true; /* This prevents display of the new sprites before the - new picture is loaded. */ - - if (holdthedawn) { - holdthedawn = false; - dawn(); - } - - display(string('\6') + "Loaded: " + '\22' + name + '\3' + "\r\r" + eh.desc + "\r\r" + "saved on " + - expanddate(eh.d, eh.m, eh.y) + '.'); - - forget_chunks(); - - minor_redraw(); - - whereis[pavalot] = dna.room; - /* showscore;*/ - alive = true; - - objectlist(); - /*$I+*/ - - enid_filename = name; -} - -void dir(string where); - -static string path, groi; - - -static void showheader() { - display(string("Dir: ") + path + "\r\r\4"); -} - -void dir(string where) -/* OK, it worked in Avaricius, let's do it in Avalot! */ -{ - searchrec s; - byte count; - - if ((where != "") && (!(set::of('\\', ':', eos).has(where[length(where)])))) - where = where + '\\'; - fsplit(where, path, groi, groi); - path = path + "*.asg"; - count = 0; - - findfirst(path, anyfile, s); - showheader(); - - while (doserror == 0) { - count += 1; - if (count == 11) { - display("\r\nPress Enter..."); - showheader(); - count = 1; - } - - display(s.name + "\r\4"); - - findnext(s); - } - - if (count == 0) - display("No files found!"); - else display("\nThat's all!"); - -} - -void avvy_background() /* Not really a filing procedure, - but it's only called just before edna_load, so I thought I'd put it - in Enid instead of, say, Lucerna. */ -{ - /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ - /* - asm - mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } - mov dx,$3ce; mov al,4; out dx,al; { register. } - mov dx,$3c5; mov al,1; out dx,al; - mov dx,$3cf; out dx,al; - - mov bx,$A000; call far ptr @drawup; - mov bx,$A400; call far ptr @drawup; - - jmp @the_end; - - @drawup: - - mov es,bx; { The segment to copy it to... } - mov di,$370; { The offset (10 pixels down, plus 1 offset.) } - - mov cx,10; - mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } - mov ax,$AEAA; call far ptr @sameline; - mov ax,$A4EA; call far ptr @sameline; - mov ax,$44A4; call far ptr @sameline; - - mov cx,9; - mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } - mov ax,$AAEA; call far ptr @sameline; - mov ax,$AA4E; call far ptr @sameline; - mov ax,$444A; call far ptr @sameline; - - mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } - mov ax,$AAAE; call far ptr @sameline; - mov ax,$EAA4; call far ptr @sameline; - mov ax,$A444; call far ptr @sameline; - - mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } - mov ax,$EAAA; call far ptr @sameline; - mov ax,$4EAA; call far ptr @sameline; - mov ax,$4A44; call far ptr @sameline; - - ret; - - - { Replicate the same line many times. } - - @sameline: - { Requires: - what to copy in AX, - how many lines in CX, and - original offset in DI. } - push cx; - push di; - - @samelineloop: - - push cx; - mov cx,40; { No. of times to repeat it on one line. } - - repz stosw; { Fast word-copying } - - pop cx; - - add di,1200; { The next one will be 16 lines down. } - - loop @samelineloop; - pop di; - add di,80; - pop cx; - - ret; - - @the_end: - end; - */ - blitfix(); -} - -void to_sundry(sundry &sund) { - { - sund.qenid_filename = enid_filename; - sund.qsoundfx = soundfx; - sund.qthinks = thinks; - sund.qthinkthing = thinkthing; - } -} - -void from_sundry(sundry sund) { - { - enid_filename = sund.qenid_filename; - soundfx = sund.qsoundfx; - thinks = sund.qthinks; - thinkthing = sund.qthinkthing; - } -} - -void restore_dna() { - word here, fv; - sundry sund; - - move(mem[storage_seg * storage_ofs + 3], dna, sizeof(dna)); - move(mem[storage_seg * storage_ofs + 3 + sizeof(dna)], times, sizeof(times)); - move(mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times)], - seq, sizeof(seq)); - move(mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq)], - sund, sizeof(sund)); - from_sundry(sund); - - here = storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq) + sizeof(sund); - do { - fv = mem[storage_seg * here]; - here += 1; - if (fv != 177) tr[fv].load_data_from_mem(here); - } while (!(fv == 177)); -} - -void edna_reload() { - - restore_dna(); - - seescroll = true; /* This prevents display of the new sprites before the - new picture is loaded. */ - - major_redraw(); - - whereis[pavalot] = dna.room; - - alive = true; - - objectlist(); - - if (holdthedawn) { - holdthedawn = false; - dawn(); - } -} - -void back_to_bootstrap(byte what) { - byte fv; - word here; - sundry sund; - - mem[storage_seg * storage_ofs] = what; /* Save the operation code. */ - to_sundry(sund); /* Save the sundry information. */ - - /* Save the DNA, times and sequencer info: */ - move(dna, mem[storage_seg * storage_ofs + 3], sizeof(dna)); - move(times, mem[storage_seg * storage_ofs + 3 + sizeof(dna)], sizeof(times)); - move(seq, mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times)], - sizeof(seq)); - move(sund, - mem[storage_seg * storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq)], - sizeof(sund)); - - here = storage_ofs + 3 + sizeof(dna) + sizeof(times) + sizeof(seq) + sizeof(sund); - - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) { - mem[storage_seg * here] = fv; - here += 1; - save_data_to_mem(here); - } - } - mem[storage_seg * here] = 177; - - exit(77); /* Code to return to the Bootstrap. */ -} - -boolean there_was_a_problem() { - boolean there_was_a_problem_result; - there_was_a_problem_result = bug; - return there_was_a_problem_result; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h deleted file mode 100644 index 95b03b77495c..000000000000 --- a/engines/avalanche/enid.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __enid_h__ -#define __enid_h__ - - -#include "gyro.h" - -namespace Avalanche { - -void edna_save(string name); - -void edna_load(string name); - -void edna_reload(); /* From Bootstrap's storage. */ - -void dir(string where); - -void avvy_background(); - -void back_to_bootstrap(byte what); - -boolean there_was_a_problem(); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/filer.cpp b/engines/avalanche/filer.cpp deleted file mode 100644 index a98161796b97..000000000000 --- a/engines/avalanche/filer.cpp +++ /dev/null @@ -1,903 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ -/*#include "Tommys.h"*/ -#include "lucerna.h" - -/*$V-*/ - -namespace Avalanche { - -struct windowtype { - integer x1, y1, x2, y2; - varying_string<20> title; -}; - -struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS (here 1=DOS. See below for others.*/ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; - -const integer border = 1; /* size of border on shadowboxes */ - -const array<1, 4, varying_string<7> > buttons = {{"Okay", "Wipe", "Cancel", "Info..."}}; - -const integer files = 3; -const integer dirs = 4; - -const integer drlen = 15; /* no. of drives on one line */ - -const array<1, 4, windowtype> threewins = { - { {155, 12, 630, 22, "Name"}, - {15, 25, 410, 70, "Drives"}, - {15, 83, 480, 179, "Files (*.ASG)"}, - {490, 83, 630, 179, "Subdirectories"} - } -}; - -const integer name_win = 1; -const integer drive_win = 2; -const integer file_win = 3; -const integer subdir_win = 4; - -matrix<3, 4, 1, 77, varying_string<12> > lists; -array<1, 77, varying_string<40> > descs; -array<3, 4, byte> nums, where, top; -searchrec s; -boolean loading; -varying_string<26> drives; -pathstr current; -byte nowwin; -varying_string<17> doing; - -pathstr filename; -boolean filefound; - -void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { - byte fv; - for (fv = 0; fv <= border; fv ++) { - setfillstyle(1, hc); - bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); - bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); - - setfillstyle(1, sc); - bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); - bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); - } -} - -void shbox(integer x1, integer y1, integer x2, integer y2, string t) { - const integer fc = 7; - shadow(x1, y1, x2, y2, 15, 8); - setfillstyle(1, fc); - bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); - setcolor(1); - x1 = (x2 - x1) / 2 + x1; - y1 = (y2 - y1) / 2 + y1; - outtextxy(x1, y1, t); - if (length(t) > 1) { - fillchar(t[2], length(t) - 1, '\40'); - t[1] = '_'; - outtextxy(x1 - 1, y1 + 1, t); - } -} - -void show_drives() { - byte fv; - settextjustify(1, 1); - for (fv = 0; fv <= length(drives) - 1; fv ++) - shbox((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, drives[fv + 1]); - setcolor(11); - settextjustify(0, 2); -} - -void box(integer x1, integer y1, integer x2, integer y2, string z) { - rectangle(x1, y1, x2, y2); - outtextxy(x1 + 1, y1 - 10, z + ':'); - outtextxy(x1, y1 - 9, "_"); -} - -string lowstr(string x) { - byte fv; - string lowstr_result; - for (fv = 1; fv <= length(x); fv ++) - if (set::of(range('A', 'Z'), eos).has(x[fv])) x[fv] += 32; - lowstr_result = x; - return lowstr_result; -} - -char lowchar(char x) { - char lowchar_result; - if (set::of(range('A', 'Z'), eos).has(x)) x -= 32; - lowchar_result = x; - return lowchar_result; -} - -void getcurrent() { - current = lowstr(fexpand("*.asg")); -} - -void setup() { - integer gd, gm; - registers r; - byte floppies; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - dusk(); - setfillstyle(1, 1); - bar(2, 2, 637, 197); - shadow(0, 0, 639, 199, 15, 7); - - if (loading) doing = "LOAD"; - else doing = "SAV"; - doing = doing + "ING a file..."; - - /* Now... find all drives that exist. */ - drives = ""; - intr(0x11, r); - floppies = (((cardinal)r.ax >> 6) & 0x3) + 1; /* useful bit of code! */ - for (gm = 1; gm <= floppies; gm ++) drives = drives + chr(64 + gm); - /* Winchesters, etc., can be found the easy way... */ - for (gd = 3; gd <= 26; gd ++) /* C: to Z: */ - if (disksize(gd) > -1) drives = drives + chr(64 + gd); - - fillchar(where, sizeof(where), '\1'); - fillchar(top, sizeof(top), '\1'); - - settextstyle(0, 0, 0); - settextjustify(1, 1); - for (gd = 1; gd <= 2; gd ++) - for (gm = 0; gm <= 1; gm ++) - shbox(420 + gm * 110, gd * 25, 520 + gm * 110, gd * 25 + 20, buttons[gm * 2 + gd]); - shbox(15, 182, 350, 196, "Help... (press f1)"); - settextjustify(0, 2); - setcolor(11); - setcolor(15); - outtextxy(15, 5, "The Avvy Filer..."); - setcolor(11); - outtextxy(317, 3, string('(') + doing + ')'); - outtextxy(357, 185, "Copyright (c) 1993, Thomas Thurman."); - - /* Draw the boxes and names */ - setcolor(3); - for (gm = 1; gm <= 4; gm ++) { - windowtype &with = threewins[gm]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - nowwin = 1; - getcurrent(); -} - -void quicksort(byte whichlist, integer lo, integer hi); - - -static void sort(integer l, integer r, byte &whichlist) { - integer i, j; - varying_string<12> x, y; - - i = l; - j = r; - x = lists[whichlist][(l + r) / 2]; - do { - while (lists[whichlist][i] < x) i = i + 1; - while (x < lists[whichlist][j]) j = j - 1; - if (i <= j) { - y = lists[whichlist][i]; - lists[whichlist][i] = lists[whichlist][j]; - lists[whichlist][j] = y; - i = i + 1; - j = j - 1; - } - } while (!(i > j)); - if (l < j) sort(l, j, whichlist); - if (i < r) sort(i, r, whichlist); -} - -void quicksort(byte whichlist, integer lo, integer hi) - -{ - /*QuickSort*/; - sort(lo, hi, whichlist); -} - -void scandir() { - pathstr nix; - namestr name; - untyped_file f; - ednahead eh; - array<1, 4, char> dna_type; - - nums[files] = 0; - findfirst("*.asg", archive + hidden + readonly, s); - - while (doserror == 0) { - fsplit(s.name, nix, name, nix); - nums[files] += 1; - lists[files][nums[files]] = lowstr(name); - - assign(f, s.name); - reset(f, 1); - seek(f, 11); - blockread(f, dna_type, 4); - - if (dna_type == "Avvy") { - ; /* A DNA256 file. */ - descs[nums[files]] = "* Saved by Avaricius!"; - } else { - ; /* EDNA-based files. */ - if (dna_type == "EDNA") { - seek(f, 177); - blockread(f, eh, sizeof(eh)); - - if (eh.revision != 2) - descs[nums[files]] = "* Unknown EDNA type!"; - else { - - if (eh.number != 2) - descs[nums[files]] = string("* Saved by ") + eh.shortname + '!'; - else { - ; /* Well... everything seems to have gone OK! */ - descs[nums[files]] = eh.desc; - } - } - } else - descs[nums[files]] = "* Not an Avvy saved game!"; - } - close(f); - findnext(s); - } - nums[dirs] = 0; - findfirst("*.*", directory, s); - while (doserror == 0) { - if (((s.attr & directory) > 0) && ((length(s.name)) > 1)) { - nums[dirs] += 1; - lists[dirs][nums[dirs]] = lowstr(s.name); - } - findnext(s); - } - - /* Now sort 'em! */ - - quicksort(dirs, 1, nums[ dirs]); - quicksort(files, 1, nums[files]); - - where[dirs] = 1; - where[files] = 1; - top[dirs] = 1; - top[files] = 1; -} - -void show_file(integer x, integer y, byte which) { - varying_string<58> z; - fillchar(z[1], 13, '\40'); - z = lists[files][which] + ".asg"; - z[0] = '\15'; - z = z + descs[which]; - - if (descs[which][1] == '*') /* Can't load these! */ - setcolor(red); - else - setcolor(lightcyan); - - outtextxy(x, y, z); -} - -void showfiles() { - byte fv; - if (loading) setcolor(11); - else setcolor(3); - if (nums[3] == 0) { - outtextxy(22, 86, "(None here!)"); - return; - } - for (fv = 0; fv <= 8; fv ++) - if (where[3] + fv <= nums[3]) - show_file(19, 87 + fv * 10, where[3] + fv); -} - -void showdirs() { - byte fv; - setcolor(11); - for (fv = 0; fv <= 8; fv ++) - if (where[4] + fv <= nums[4]) - outtextxy(497, 87 + fv * 10, string('[') + lists[dirs][fv + where[4]] + ']'); -} - -void show() { - byte fv; - dirstr d; - namestr n; - extstr e; - setfillstyle(1, 1); - for (fv = 1; fv <= 4; fv ++) - if (fv != 2) { - windowtype &with = threewins[fv]; - bar(with.x1 + 1, with.y1 + 1, with.x2 - 1, with.y2 - 1); - } - showfiles(); - showdirs(); - setcolor(7); - outtextxy(159, 14, current); -} - -void blip() { - sound(177); - delay(77); - nosound; -} - -void invert(integer x1, integer y1, integer x2, integer y2) { - pointer p, restore; - word s; - s = imagesize(x1, y1, x2, y2); - mark(restore); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - putimage(x1, y1, p, notput); - release(restore); -} - -void changedrive(char drive) { - byte fv; - fv = pos(drive, drives); - if (fv == 0) { - blip(); - return; - } - fv -= 1; - shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 8, 7); - chdir(string(drive) + ':'); - getcurrent(); - scandir(); - show(); - shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 15, 8); -} - -void highlight(byte win, byte line) { - switch (win) { - case 3: - invert(16, 75 + line * 10, 479, 85 + line * 10); - break; - case 4: - invert(491, 75 + line * 10, 619, 85 + line * 10); - break; - } -} - -void repaint(byte whichwindow) { - setfillstyle(1, 1); - { - windowtype &with = threewins[whichwindow]; - bar(with.x1 + 1, with.y1 + 1, with.x2 - 1, with.y2 - 1); - } - switch (whichwindow) { - case file_win: - showfiles(); - break; - case subdir_win: - showdirs(); - break; - } - highlight(whichwindow, 1); - top[whichwindow] = where[whichwindow]; -} - -void fileblit(word xpos, word xlen, word y1, word y2, shortint dir, word ylen) { - word fv; - byte bit; - for (bit = 0; bit <= 3; bit ++) { - fv = 0; - while (fv < ylen) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[0xa000 * (y1 + fv * dir) * 80 + xpos], mem[0xa000 * (y2 + fv * dir) * 80 + xpos], xlen); - fv += 1; - } - } - bit = getpixel(0, 0); -} - -void seekthrough(byte whichlist, byte &wherenow, char whatfor) { - byte startedat; - - startedat = wherenow; - do { - wherenow += 1; - if (wherenow > nums[whichlist]) wherenow = 1; - } while (!((startedat == wherenow) || (lists[whichlist][wherenow][1] == whatfor))); - repaint(whichlist); -} - -void gotohome(byte whichlist) { - where[whichlist] = 1; - repaint(whichlist); -} - -void gotoend(byte whichlist) { - where[whichlist] = nums[whichlist]; - repaint(whichlist); -} - -void pageup(byte whichlist) { - if (where[whichlist] > 9) { - where[whichlist] -= 9; - repaint(whichlist); - } -} - -void pagedown(byte whichlist) { - if (where[whichlist] < nums[whichlist] - 9) { - where[whichlist] += 9; - repaint(whichlist); - } -} - -void subdirparse(string r); - -static void movehl(byte which, shortint howmuch) { - highlight(4, where[4] - top[4] + 1); - if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[4])) - where[which] = where[which] + howmuch; - highlight(4, where[4] - top[4] + 1); -} - - - -static void change_dir() { - dusk(); - /*$I-*/ chdir(lists[4][where[4]]); - /*$I+*/ - if (ioresult != 0) { - dawn(); - blip(); - return; - } - where[4] = 1; - top[4] = 1; - getcurrent(); - scandir(); - show(); - highlight(4, 1); - dawn(); -} - -void subdirparse(string r) - -{ - switch (r[1]) { - case creturn: - change_dir(); - break; - - case '\0': - switch (r[2]) { - case cup: - if (where[4] - top[4] > 0) /* Up */ - movehl(4, -1); /* Within range */ - else if (top[4] > 1) { - ; /* Outside range- must scroll */ - highlight(4, 1); - top[4] -= 1; - where[4] -= 1; - fileblit(61, 18, 166, 176, -1, 80); - setfillstyle(1, 1); - bar(490, 85, 630, 95); - setcolor(11); - outtextxy(497, 87, string('[') + lists[dirs][where[4]] + ']'); - highlight(4, 1); - } - break; - case cdown: - if (where[4] - top[4] < 8) /* Down */ - movehl(4, 1); - else if (top[4] + 8 < nums[4]) { - highlight(4, 9); - top[4] += 1; - where[4] += 1; - fileblit(60, 18, 97, 87, 1, 80); - setfillstyle(1, 1); - bar(490, 165, 630, 175); - setcolor(11); - outtextxy(497, 167, string('[') + lists[dirs][where[4]] + ']'); - highlight(4, 9); - } - break; - case chome: - gotohome(4); - break; - case cend: - gotoend(4); - break; - case cpgup: - pageup(4); - break; - case cpgdn: - pagedown(4); - break; - case c_ao: - change_dir(); - break; - } - break; - default: - seekthrough(4, where[4], lowchar(r[1])); - } -} - -void fileinfo(byte which); - - -static void display(integer y, string left, string right) { - y = 17 + y * 12; - settextjustify(2, 1); - setcolor(11); - outtextxy(315, y, left); - settextjustify(0, 1); - setcolor(15); - outtextxy(325, y, right); -} - -void fileinfo(byte which) -/* This gives information on the file whose name is in lists[files,which]. */ -{ - ednahead eh; - untyped_file f; - varying_string<4> os; - char r; - - - /* Firstly, we must check whether or not it's an Avalot file. This is easily - done, since the descriptions of all others always begin with a star. */ - - if ((descs[which][1] == '*') || (descs[which][1] == '(')) { - ; /* it is. */ - blip(); /* Naaaarghh! */ - return; - } - - /* Anyway... it wasn't. */ - - assign(f, lists[files][which] + ".asg"); - reset(f, 1); - seek(f, 177); - blockread(f, eh, sizeof(eh)); - close(f); - - /* We now hold its EDNA record. */ - - setfillstyle(1, 1); - bar(2, 2, 637, 197); /* Interesting information coming up! */ - - { - display(2, "Saved by:", eh.game); - display(3, "version:", eh.verstr); - - /* display(4,'under', os);*/ - - display(6, "Saved on ", strf(eh.d) + '-' + strf(eh.m) + '-' + strf(eh.y)); - - display(9, "No. of times saved:", strf(eh.saves)); - - display(11, "Money:", eh.money); - display(12, "Score:", strf(eh.points)); - } - - shbox(500, 177, 650, 200, "Press any key..."); - r = readkey(); - - setfillstyle(1, 1); - bar(2, 2, 637, 197); -} - -void filer_help() -/* This gives general help. */ -{ - char r; - outtextxy(100, 100, "Just general help here."); - shbox(500, 177, 650, 200, "Press any key..."); - r = readkey(); - - setfillstyle(1, 1); - bar(2, 2, 637, 197); -} - -void wipe() -/* This allows you to delete files. */ -{ - char r; - outtextxy(100, 100, "Are you sure you want to delete \"foo.bar\"?"); - shbox(500, 177, 650, 200, "[Y/N]"); - r = readkey(); - - setfillstyle(1, 1); - bar(2, 2, 637, 197); -} - -void filesparse(string r); - -static void movehl1(byte which, shortint howmuch) { - highlight(3, where[3] - top[3] + 1); - if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[3])) - where[which] = where[which] + howmuch; - highlight(3, where[3] - top[3] + 1); -} - - - -static boolean selected_file() { - boolean selected_file_result; - if (descs[where[file_win]][1] == '*') { - blip(); - selected_file_result = false; - } else { - filename = lists[file_win][where[file_win]]; - filefound = true; - selected_file_result = true; - } - return selected_file_result; -} - -void filesparse(string r) - -{ - switch (r[1]) { - case creturn: - if (selected_file()) return; - break; - case '\0': - switch (r[2]) { - case cup: - if (where[3] - top[3] > 0) /* Up */ - movehl1(3, -1); /* Within range */ - else if (top[3] > 1) { - ; /* Outside range- must scroll */ - highlight(3, 1); - top[3] -= 1; - where[3] -= 1; - fileblit(1, 59, 166, 176, -1, 80); - setfillstyle(1, 1); - bar(15, 85, 480, 95); - show_file(19, 87, where[3]); - highlight(3, 1); - } - break; - case cdown: - if (where[3] - top[3] < 8) /* Down */ - movehl1(3, 1); - else if (top[3] + 8 < nums[3]) { - highlight(3, 9); - top[3] += 1; - where[3] += 1; - fileblit(1, 59, 97, 87, 1, 80); - setfillstyle(1, 1); - bar(15, 165, 480, 175); - show_file(19, 167, where[3]); - highlight(3, 9); - } - break; - case c_ai: - fileinfo(where[3]); - break; /* alt-I: information. */ - case c_ah: - case c_f1: - filer_help(); - break; /* alt-I: information. */ - case chome: - gotohome(3); - break; - case cend: - gotoend(3); - break; - case cpgup: - pageup(3); - break; - case cpgdn: - pagedown(3); - break; - case c_ao: - if (selected_file()) return; - break; - } - break; - default: - seekthrough(3, where[3], lowchar(r[1])); - } -} - -string playaround(); - -static void changewin(byte i) { - switch (nowwin) { - case 3: - case 4: - highlight(nowwin, where[nowwin] - top[nowwin] + 1); - break; - } - setcolor(3); - { - windowtype &with = threewins[nowwin]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - nowwin = i; - if (nowwin < 1) nowwin = 4; - if (nowwin > 4) nowwin = 1; - switch (nowwin) { - case 3: - case 4: - highlight(nowwin, where[nowwin] - top[nowwin] + 1); - break; - } -} - -string playaround() { - char r, r2; - string playaround_result; - filefound = false; - dawn(); - - do { - setcolor(14); - { - windowtype &with = threewins[nowwin]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - r = readkey(); - switch (r) { - case ctab: - changewin(nowwin + 1); - break; - case cescape: { - playaround_result = ""; - return playaround_result; - } - break; - case '\0': { - ; /* parse extd keystroke */ - r2 = readkey(); - switch (r2) { - case cs_tab: - changewin(nowwin - 1); - break; - case c_an: - changewin(1); - break; - case c_ad: - changewin(2); - break; - case c_af: - changewin(3); - break; - case c_as: - changewin(4); - break; - case c_ac: { - playaround_result = ""; - return playaround_result; - } - break; - default: - switch (nowwin) { - case 3: - filesparse(string('\0') + r2); - break; - case 4: - subdirparse(string('\0') + r2); - break; - } - } - } - break; - default: { - ; /* Pass keystroke to current window */ - switch (nowwin) { - case 2: - changedrive(upcase(r)); - break; - case 4: - subdirparse(r); - break; - case 3: - filesparse(r); - break; - default: - blip(); - } - } - - } - - if (filefound) { - dusk(); - playaround_result = filename; - return playaround_result; - } - } while (!false); - return playaround_result; -} - -void do_filer() { - pathstr p; - void do_filer_result; - loading = true; - setup(); - scandir(); - show(); - show_drives(); - p = playaround(); - if (p != "") p = fexpand(p + ".ASG"); - do_filer_result = p; - return do_filer_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - filename = do_filer(); - closegraph(); - if (filename == "") - output << "*** CANCELLED! ***" << NL; - else - output << "Selected: " << filename << NL; - input >> NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.cpp b/engines/avalanche/fileunit.cpp deleted file mode 100644 index 11c82fa64a06..000000000000 --- a/engines/avalanche/fileunit.cpp +++ /dev/null @@ -1,1303 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __fileunit_implementation__ -/* v:filer.pas - "avvyfiler" - in unit form. */ - -#include "fileunit.h" - - -#include "graph.h" -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ -/*#include "Tommys.h"*/ -#include "lucerna.h" -#include "pingo.h" -#include "Gyro.h" - -/*$V-*/ - -namespace Avalanche { - -struct windowtype { - integer x1, y1, x2, y2; - varying_string<20> title; -}; - -const integer border = 1; /* size of border on shadowboxes */ - -const array<1, 4, string> buttons = {{"Okay", "Wipe", "Cancel", "Info..."}}; - -const integer files = 3; -const integer dirs = 4; - -const integer drlen = 15; /* no. of drives on one line */ - -const array<1, 4, windowtype> threewins = { - { {155, 12, 630, 22, "Name"}, - {15, 25, 410, 70, "Drives"}, - {15, 83, 480, 179, "Files (*.ASG)"}, - {490, 83, 630, 179, "Subdirectories"} - } -}; - -const integer name_win = 1; -const integer drive_win = 2; -const integer file_win = 3; -const integer subdir_win = 4; - -const integer filer_page = 3; - -matrix<3, 4, 1, 77, varying_string<12> > lists; -array<1, 77, varying_string<40> > descs; -array<3, 4, byte> nums, where, top, thumb_pos, thumb_len; -searchrec s; -boolean loading; -varying_string<26> drives; -pathstr current; -byte nowwin; - -pathstr filename; -boolean filefound; - -boolean cancelled; - -void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { - byte fv; - - for (fv = 0; fv <= border; fv ++) { - setfillstyle(1, hc); - bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); - bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); - - setfillstyle(1, sc); - bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); - bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); - } -} - -void shbox(integer x1, integer y1, integer x2, integer y2, string t) { - const integer fc = 7; - - shadow(x1, y1, x2, y2, 15, 8); - setfillstyle(1, fc); - bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); - setcolor(1); - x1 = (x2 - x1) / 2 + x1; - y1 = (y2 - y1) / 2 + y1; - outtextxy(x1, y1, t); - if ((t[1] != '[') && (length(t) > 1)) { - fillchar(t[2], length(t) - 1, '\40'); - t[1] = '_'; - outtextxy(x1 - 1, y1 + 1, t); - } -} - -void show_drives() { - byte fv; - - settextjustify(1, 1); - for (fv = 0; fv <= length(drives) - 1; fv ++) - shbox((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, drives[fv + 1]); - setcolor(11); - settextjustify(0, 2); -} - -char which_drive(integer x, integer y) { - char which_drive_result; - x = (x - 25) / 25; - y = (y - 32) / 19; - - which_drive_result = drives[1 + x + y * drlen]; - return which_drive_result; -} - -void box(integer x1, integer y1, integer x2, integer y2, string z) { - rectangle(x1, y1, x2, y2); - outtextxy(x1 + 1, y1 - 10, z + ':'); - outtextxy(x1, y1 - 9, "_"); -} - -string lowstr(string x) { - byte fv; - - string lowstr_result; - for (fv = 1; fv <= length(x); fv ++) - if (set::of(range('A', 'Z'), eos).has(x[fv])) x[fv] += 32; - lowstr_result = x; - return lowstr_result; -} - -char lowchar(char x) { - char lowchar_result; - if (set::of(range('A', 'Z'), eos).has(x)) x -= 32; - lowchar_result = x; - return lowchar_result; -} - -void getcurrent() { - current = lowstr(fexpand("*.asg")); -} - -void firstsetup() { - integer gd, gm; - registers r; - byte floppies; - - /* Now... find all drives that exist. */ - drives = ""; - intr(0x11, r); - floppies = (((cardinal)r.ax >> 6) & 0x3) + 1; /* useful bit of code! */ - for (gm = 1; gm <= floppies; gm ++) drives = drives + chr(64 + gm); - /* Winchesters, etc., can be found the easy way... */ - for (gd = 3; gd <= 26; gd ++) /* C: to Z: */ - if (disksize(gd) > -1) drives = drives + chr(64 + gd); - - fillchar(where, sizeof(where), '\1'); - fillchar(top, sizeof(top), '\1'); - - /* Set up mouse. */ - off_virtual(); - oncandopageswap = false; - newpointer(2); -} - -void draw_scroll_bar(byte which) { - setcolor(1); - { - windowtype &with = threewins[which]; - - setfillstyle(1, 7); - bar(with.x2 - 7, with.y1 + 10, with.x2 - 1, with.y2 - 10); - setfillstyle(1, 3); - bar(with.x2 - 7, with.y1 + 1, with.x2 - 1, with.y1 + 9); - bar(with.x2 - 7, with.y2 - 9, with.x2 - 1, with.y2 - 1); - outtextxy(with.x2 - 7, with.y1 + 2, "\30"); - outtextxy(with.x2 - 7, with.y2 - 8, "\31"); - } -} - -void setup() { - integer gd, gm; - registers r; - byte floppies; - - setactivepage(filer_page); - setvisualpage(filer_page); - setfillstyle(1, 1); - bar(2, 2, 637, 197); - shadow(0, 0, 639, 199, 15, 7); - - settextstyle(0, 0, 0); - settextjustify(1, 1); - for (gd = 1; gd <= 2; gd ++) - for (gm = 0; gm <= 1; gm ++) - shbox(420 + gm * 110, gd * 25, 520 + gm * 110, gd * 25 + 20, buttons[gm * 2 + gd]); - shbox(15, 182, 350, 196, "Help... (press f1)"); - settextjustify(0, 2); - setcolor(11); - setcolor(15); - outtextxy(15, 5, "The Avvy Filer..."); - setcolor(11); - outtextxy(317, 3, "Select a file to load."); - outtextxy(357, 185, "Copyright (c) 1993, Thomas Thurman."); - - /* Draw the boxes and names */ - setcolor(3); - for (gm = 1; gm <= 4; gm ++) { - windowtype &with = threewins[gm]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - - /* Draw the scroll bars. */ - - for (gm = 3; gm <= 4; gm ++) draw_scroll_bar(gm); -} - -void thumb(byte whichwin) { - word length, the_top; - - if (nums[whichwin] < 9) { - length = 76; - the_top = 0; - } else { - length = trunc(76 * ((real)(8) / nums[whichwin])); - the_top = trunc(((real)(where[whichwin]) / nums[whichwin]) * (76 - length)); - } - - the_top += 93; /* Top of both the scrollbars. */ - - setfillstyle(1, 7); - { - windowtype &with = threewins[whichwin]; - bar(with.x2 - 6, thumb_pos[whichwin], with.x2 - 3, thumb_pos[whichwin] + length); - } - setfillstyle(1, 1); - { - windowtype &with = threewins[whichwin]; - bar(with.x2 - 6, the_top, with.x2 - 3, the_top + length); - } - - thumb_pos[whichwin] = the_top; - thumb_len[whichwin] = length; -} - -void quicksort(byte whichlist, integer lo, integer hi); - - -static void sort(integer l, integer r, byte &whichlist) { - integer i, j; - varying_string<12> x, y; - varying_string<40> d; - - i = l; - j = r; - x = lists[whichlist][(l + r) / 2]; - do { - while (lists[whichlist][i] < x) i = i + 1; - while (x < lists[whichlist][j]) j = j - 1; - if (i <= j) { - y = lists[whichlist][i]; - lists[whichlist][i] = lists[whichlist][j]; - lists[whichlist][j] = y; - - d = descs[i]; - descs[i] = descs[j]; - descs[j] = d; - - i = i + 1; - j = j - 1; - } - } while (!(i > j)); - - /* if j<1 then j:=1; - if r<1 then r:=1;*/ - - if (l < j) sort(l, j, whichlist); - if (i < r) sort(i, r, whichlist); -} - -void quicksort(byte whichlist, integer lo, integer hi) - -{ - /*QuickSort*/; - sort(lo, hi, whichlist); -} - -void scandir() { - pathstr nix; - namestr name; - untyped_file f; - ednahead eh; - array<1, 4, char> dna_type; - - - nums[files] = 0; - findfirst("*.asg", archive + hidden + readonly, s); - - while ((doserror == 0) && (nums[files] < 77)) { - fsplit(s.name, nix, name, nix); - nums[files] += 1; - lists[files][nums[files]] = lowstr(name); - - assign(f, s.name); - reset(f, 1); - seek(f, 11); - blockread(f, dna_type, 4); - - if (dna_type == "Avvy") { - /* A DNA256 file. */ - descs[nums[files]] = "* Saved by Avaricius!"; - } else { - /* EDNA-based files. */ - if (dna_type == "EDNA") { - seek(f, 177); - blockread(f, eh, sizeof(eh)); - - if (eh.revision != 2) - descs[nums[files]] = "* Unknown EDNA type!"; - else { - - if (eh.number != 2) - descs[nums[files]] = string("% Saved by ") + eh.shortname + '!'; - else { - /* Well... everything seems to have gone OK! */ - descs[nums[files]] = eh.desc; - } - } - } else - descs[nums[files]] = "* Not an Avvy saved game!"; - } - close(f); - findnext(s); - } - nums[dirs] = 0; - findfirst("*.*", directory, s); - while ((doserror == 0) && (nums[dirs] < 77)) { - if (((s.attr & directory) > 0) && ((length(s.name)) > 1)) { - nums[dirs] += 1; - lists[dirs][nums[dirs]] = lowstr(s.name); - } - findnext(s); - } - - /* Now sort 'em! */ - - if (nums[dirs ] != 0) quicksort(dirs, 1, nums[ dirs]); - if (nums[files] != 0) quicksort(files, 1, nums[files]); - - where[dirs] = 1; - where[files] = 1; - top[dirs] = 1; - top[files] = 1; - - thumb_pos[3] = 93; - thumb_pos[4] = 93; -} - -void show_file(integer x, integer y, byte which) { - varying_string<58> z; - - fillchar(z[1], 13, '\40'); - z = lists[files][which] + ".asg"; - z[0] = '\15'; - z = z + descs[which]; - - if (set::of('*', '%', eos).has(descs[which][1])) /* Can't load these! */ - setcolor(red); - else - setcolor(lightcyan); - - outtextxy(x, y, z); -} - -void showfiles() { - byte fv; - - if (loading) setcolor(11); - else setcolor(3); - if (nums[3] == 0) { - outtextxy(22, 86, "(None here!)"); - return; - } - for (fv = 0; fv <= 8; fv ++) - if (top[3] + fv <= nums[3]) - show_file(19, 87 + fv * 10, top[3] + fv); - - draw_scroll_bar(files); -} - -void showdirs() { - byte fv; - - setcolor(11); - for (fv = 0; fv <= 8; fv ++) - if (top[4] + fv <= nums[4]) - outtextxy(497, 87 + fv * 10, string('[') + lists[dirs][fv + top[4]] + ']'); - draw_scroll_bar(dirs); -} - -void show() { - byte fv; - dirstr d; - namestr n; - extstr e; - - setfillstyle(1, 1); - for (fv = 1; fv <= 4; fv ++) - if (fv != 2) { - windowtype &with = threewins[fv]; - bar(with.x1 + 1, with.y1 + 1, with.x2 - 8, with.y2 - 1); - } - showfiles(); - showdirs(); - setcolor(7); - outtextxy(159, 14, current); - for (fv = 3; fv <= 4; fv ++) thumb(fv); -} - -void blip() { - sound(177); - delay(77); - nosound; -} - -void invert(integer x1, integer y1, integer x2, integer y2) { - pointer p, restore; - word s; - - s = imagesize(x1, y1, x2, y2); - mark(restore); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - putimage(x1, y1, p, notput); - release(restore); -} - -void changedrive(char drive) { - byte fv; - - fv = pos(drive, drives); - if (fv == 0) { - blip(); - return; - } - off(); - fv -= 1; - shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 8, 7); - chdir(string(drive) + ':'); - getcurrent(); - scandir(); - show(); - shadow((fv % drlen) * 25 + 25, (fv / drlen) * 19 + 31, - (fv % drlen) * 25 + 40, 45 + (fv / drlen) * 19, 15, 8); - on(); -} - -void highlight(byte win, byte line) { - switch (win) { - case 3: - invert(16, 75 + line * 10, 470, 85 + line * 10); - break; - case 4: - invert(491, 75 + line * 10, 620, 85 + line * 10); - break; - } - thumb(win); -} - -void repaint(byte whichwindow) { - setfillstyle(1, 1); - { - windowtype &with = threewins[whichwindow]; - bar(with.x1 + 1, with.y1 + 1, with.x2 - 8, with.y2 - 1); - } - top[whichwindow] = where[whichwindow]; - switch (whichwindow) { - case file_win: - showfiles(); - break; - case subdir_win: - showdirs(); - break; - } - thumb(whichwindow); -} - -void fileblit(word xpos, word xlen, word y1, word y2, shortint dir, word ylen) { - word fv; - byte bit; - - for (bit = 0; bit <= 3; bit ++) { - fv = 0; - while (fv < ylen) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[0xac00 * (y1 + fv * dir) * 80 + xpos], mem[0xac00 * (y2 + fv * dir) * 80 + xpos], xlen); - fv += 1; - } - } - bit = getpixel(0, 0); -} - -void seekthrough(byte whichlist, byte &wherenow, char whatfor) { - byte startedat; - - startedat = wherenow; - do { - wherenow += 1; - if (wherenow > nums[whichlist]) wherenow = 1; - } while (!((startedat == wherenow) || (lists[whichlist][wherenow][1] == whatfor))); - off(); - repaint(whichlist); - on(); -} - -void gotohome(byte whichlist) { - off(); - where[whichlist] = 1; - repaint(whichlist); - highlight(whichlist, 1); - on(); -} - -void gotoend(byte whichlist) { - off(); - where[whichlist] = nums[whichlist]; - repaint(whichlist); - highlight(whichlist, 1); - on(); -} - -void pageup(byte whichlist) { - off(); - if (where[whichlist] > 9) { - where[whichlist] -= 9; - repaint(whichlist); - highlight(whichlist, 1); - } else gotohome(whichlist); - on(); -} - -void pagedown(byte whichlist) { - off(); - if (where[whichlist] < nums[whichlist] - 9) { - where[whichlist] += 9; - repaint(whichlist); - highlight(whichlist, 1); - } else gotoend(whichlist); - on(); -} - -void subdirparse(string r); - -static void movehl(byte which, shortint howmuch) { - off(); - highlight(4, where[4] - top[4] + 1); - if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[4])) - where[which] = where[which] + howmuch; - highlight(4, where[4] - top[4] + 1); - on(); -} - - - -static void change_dir() { - off(); - dusk(); - /*$I-*/ chdir(lists[4][where[4]]); - /*$I+*/ - if (ioresult != 0) { - dawn(); - blip(); - return; - } - where[4] = 1; - top[4] = 1; - getcurrent(); - scandir(); - show(); - highlight(4, 1); - dawn(); - on(); -} - -void subdirparse(string r) - -{ - switch (r[1]) { - case creturn: - change_dir(); - break; - - case '\0': - switch (r[2]) { - case cup: - if (where[4] - top[4] > 0) /* Up */ - movehl(4, -1); /* Within range */ - else if (top[4] > 1) { - /* Outside range- must scroll */ - off(); - highlight(4, 1); - top[4] -= 1; - where[4] -= 1; - fileblit(61, 17, 166, 176, -1, 80); - setfillstyle(1, 1); - bar(490, 85, 622, 95); - setcolor(11); - outtextxy(497, 87, string('[') + lists[dirs][where[4]] + ']'); - highlight(4, 1); - on(); - } - break; - case cdown: - if (where[4] - top[4] < 8) /* Down */ - movehl(4, 1); - else if (top[4] + 8 < nums[4]) { - off(); - highlight(4, 9); - top[4] += 1; - where[4] += 1; - fileblit(60, 17, 97, 87, 1, 80); - setfillstyle(1, 1); - bar(490, 165, 622, 175); - setcolor(11); - outtextxy(497, 167, string('[') + lists[dirs][where[4]] + ']'); - highlight(4, 9); - on(); - } - break; - case chome: - gotohome(4); - break; - case cend: - gotoend(4); - break; - case cpgup: - pageup(4); - break; - case cpgdn: - pagedown(4); - break; - case c_ao: - change_dir(); - break; - } - break; - default: { - off(); - seekthrough(4, where[4], lowchar(r[1])); - highlight(4, 1); - on(); - } - } -} - -void fileinfo(byte which); -void filer_help(); -void wipe(byte which); - -void in_name_box(string x) { - off(); - setfillstyle(1, 1); - bar(156, 13, 629, 21); - setcolor(7); - outtextxy(159, 14, x); - on(); -} - -void filesparse(string r); - -static void movehl1(byte which, shortint howmuch) { - off(); - highlight(3, where[3] - top[3] + 1); - if (((where[which] + howmuch) > 0) && ((where[which] + howmuch) <= (unsigned char)nums[3])) - where[which] = where[which] + howmuch; - highlight(3, where[3] - top[3] + 1); - on(); -} - - - -static boolean selected_file() { - boolean selected_file_result; - if ((set::of('*', '%', eos).has(descs[where[file_win]][1])) || (nums[3] == 0)) { - blip(); - selected_file_result = false; - } else { - filename = lists[file_win][where[file_win]]; - filefound = true; - selected_file_result = true; - } - return selected_file_result; -} - -void filesparse(string r) - -{ - switch (r[1]) { - case creturn: - if (selected_file()) return; - break; - case '\0': - switch (r[2]) { - case cup: - if (where[3] - top[3] > 0) /* Up */ - movehl1(3, -1); /* Within range */ - else if (top[3] > 1) { - /* Outside range- must scroll */ - off(); - highlight(3, 1); - top[3] -= 1; - where[3] -= 1; - fileblit(1, 58, 166, 176, -1, 80); - setfillstyle(1, 1); - bar(15, 85, 472, 95); - show_file(19, 87, where[3]); - highlight(3, 1); - on(); - } - break; - case cdown: - if (where[3] - top[3] < 8) /* Down */ - movehl1(3, 1); - else if (top[3] + 8 < nums[3]) { - off(); - highlight(3, 9); - top[3] += 1; - where[3] += 1; - fileblit(1, 58, 97, 87, 1, 80); - setfillstyle(1, 1); - bar(15, 165, 472, 175); - show_file(19, 167, where[3]); - highlight(3, 9); - on(); - } - break; - case c_ai: - fileinfo(where[3]); - break; /* alt-I: information. */ - case c_aw: - wipe(where[3]); - break; /* alt-W: wipe. */ - case chome: - gotohome(3); - break; - case cend: - gotoend(3); - break; - case cpgup: - pageup(3); - break; - case cpgdn: - pagedown(3); - break; - case c_ao: - if (selected_file()) return; - break; - } - break; - default: { - off(); - seekthrough(3, where[3], lowchar(r[1])); - highlight(3, 1); - on(); - } - } - in_name_box(lists[files][where[3]] + ".asg"); -} - -void entername(char r) { - switch (r) { - case '\10': - if (filename[0] != '\0') filename[0] -= 1; - break; - case '\15': - filefound = true; - break; - case '\40': - break; /* ignore spaces. */ - default: { - if (length(filename) < 55) filename = filename + r; - - if (length(filename) == 1) { - where[3] = 1; - seekthrough(3, where[3], filename[1]); - } - } - } - - in_name_box(filename + ".asg"); - -} - -void changewin(byte i) { - off(); - switch (nowwin) { - case 3: - case 4: - highlight(nowwin, where[nowwin] - top[nowwin] + 1); - break; - } - setcolor(3); - { - windowtype &with = threewins[nowwin]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - nowwin = i; - if (nowwin < 1) nowwin = 4; - if (nowwin > 4) nowwin = 1; - switch (nowwin) { - case 3: - case 4: - highlight(nowwin, where[nowwin] - top[nowwin] + 1); - break; - } - on(); -} - -void checkmouse(); - -static void relevant(string x) { - setcolor(14); - off(); - { - windowtype &with = threewins[nowwin]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - on(); - if (nowwin == 3) filesparse(x); - else subdirparse(x); -} - -void checkmouse() { - byte fv, new, waswin; - - check(); - if (mrelease > 0) { - /* Where did they click? */ - for (fv = 1; fv <= 4; fv ++) { - windowtype &with = threewins[fv]; - if (((cardinal)with.x1 <= mx) && ((cardinal)with.x2 >= mx) && ((cardinal)with.y1 <= my) && ((cardinal)with.y2 >= my)) { - waswin = nowwin; - - if (nowwin != fv) { - changewin(fv); - off(); - setcolor(14); - { - windowtype &with1 = threewins[nowwin]; - box(with1.x1, with1.y1, with1.x2, with1.y2, with1.title); - } - on(); - } - /* Now... individual windows should do their own checkclicking. */ - - switch (fv) { - /* 1: no effect. */ - case 2: - changedrive(which_drive(mx, my)); - break; /* Change drive w/mouse. */ - case 3: - case 4: - if (my < 175) { /* Click on highlight users. */ - if (mx > (cardinal)threewins[nowwin].x2 - 9) { - /* Scroll bar. */ - if (my < (cardinal)threewins[nowwin].y1 + 10) - relevant(null + cup); /* scroll up */ - else if (my > (cardinal)threewins[nowwin].y2 - 10) - relevant(null + cdown); /* scroll down. */ - else if (my < (unsigned char)thumb_pos[nowwin]) - relevant(null + cpgup); /* above thumb-- page up. */ - else if (my > (unsigned char)thumb_pos[nowwin] + thumb_len[nowwin]) - relevant(null + cpgdn); /* above thumb-- page up. */ - else { /* On the thumb. */ - blip(); - } - } else { - new = top[fv] + (my - 75) / 10 - 1; - - if ((new == where[fv]) && (nowwin == waswin)) { - /* Double-clicked, --> "OK" */ - /* filefound:=true; - filename:=lists[fv,new];*/ - if (fv == 3) filesparse("\15"); - else subdirparse("\15"); - } else { - /* Single-clicked, --> move highlight */ - off(); - highlight(fv, where[fv] - top[fv] + 1); - if ((new > 0) && (new <= nums[fv])) - where[fv] = new; - highlight(fv, where[fv] - top[fv] + 1); - on(); - } - } - } - break; - } - - return; /* Since they've clicked in a window... */ - } - } - - /* Righto, they must have clicked on a button. Which? */ - - switch (my) { - case 25 ... 45: /* Top row: Okay, Cancel. */ - switch (mx) { - case 420 ... 520: - switch (nowwin) { - case 1: - entername('\15'); - break; - case 3: - filesparse("\15"); - break; - case 4: - subdirparse("\15"); - break; - default: - blip(); - } - break; - case 530 ... 630: - cancelled = true; - break; - } - break; - case 50 ... 95: /* Bottom row: Wipe, Info. */ - switch (mx) { - case 420 ... 520: - if (nowwin == 3) wipe(where[3]); - else blip(); - break; - case 530 ... 630: - if (nowwin == 3) fileinfo(where[3]); - else blip(); - break; - } - break; - case 180 ... 200: - filer_help(); - break; /* The "help" button. */ - } - } -} - -string playaround() { - char r, r2; - - string playaround_result; - filefound = false; - dawn(); - - do { - setcolor(14); - off(); - { - windowtype &with = threewins[nowwin]; - box(with.x1, with.y1, with.x2, with.y2, with.title); - } - on(); - do { - checkmouse(); - } while (!(keypressed() || filefound || cancelled)); - if (!(filefound || cancelled)) { - r = readkey(); - switch (r) { - case ctab: - changewin(nowwin + 1); - break; - case cescape: { - playaround_result = ""; - return playaround_result; - } - break; - case '\0': { /* parse extd keystroke */ - r2 = readkey(); - switch (r2) { - case cs_tab: - changewin(nowwin - 1); - break; - case c_an: - changewin(1); - break; - case c_ad: - changewin(2); - break; - case c_af: - changewin(3); - break; - case c_as: - changewin(4); - break; - case c_ac: - cancelled = false; - break; - case c_ah: - case cf1: - filer_help(); - break; /* alt-H: help. */ - default: - switch (nowwin) { - case 3: - filesparse(string('\0') + r2); - break; - case 4: - subdirparse(string('\0') + r2); - break; - } - } - } - break; - default: { - /* Pass keystroke to current window */ - switch (nowwin) { - case 1: - entername(r); - break; - case 2: - changedrive(upcase(r)); - break; - case 4: - subdirparse(r); - break; - case 3: - filesparse(r); - break; - default: - blip(); - } - } - } - - } - - if (filefound) { - dusk(); - playaround_result = filename; - return playaround_result; - } - - if (cancelled) { - dusk(); - playaround_result = ""; - return playaround_result; - } - } while (!false); - return playaround_result; -} - -void drawup() { - off(); - loading = true; - setup(); - show(); - show_drives(); - on(); -} - -void little_cls() { - setfillstyle(1, 1); - bar(2, 2, 637, 197); /* Interesting information coming up! */ -} - -void wait_for_keypress_or_mouse_click() { - char r; - - do { - check(); - } while (!((mrelease > 0) || keypressed())); - while (keypressed()) r = readkey(); -} - -void fileinfo(byte which); - - -static void display(integer y, string left, string right) { - y = 17 + y * 12; - settextjustify(2, 1); - setcolor(11); - outtextxy(315, y, left); - settextjustify(0, 1); - setcolor(15); - outtextxy(325, y, right); -} - -void fileinfo(byte which) -/* This gives information on the file whose name is in lists[files,which]. */ -{ - ednahead eh; - untyped_file f; - varying_string<4> os; - - - - /* Firstly, we must check whether or not it's an Avalot file. This is easily - done, since the descriptions of all others always begin with a star. */ - - if ((descs[which][1] == '*') || (nums[3] == 0)) { - /* it is. */ - blip(); /* Naaaarghh! */ - return; - } - - /* Anyway... it wasn't. */ - - assign(f, lists[files][which] + ".asg"); - reset(f, 1); - seek(f, 177); - blockread(f, eh, sizeof(eh)); - close(f); - - /* We now hold its EDNA record. */ - - off(); - little_cls(); /* Interesting information coming up! */ - - { - display(0, "File:", eh.fn); - display(1, "Description:", eh.desc); - display(2, "Saved by:", eh.game); - display(3, "version:", eh.verstr); - - display(4, "under", eh.os); - - display(6, "Saved on:", strf(eh.d) + '-' + strf(eh.m) + '-' + strf(eh.y)); - - display(9, "No. of times saved:", strf(eh.saves)); - - display(11, "Money:", eh.money); - display(12, "Score:", strf(eh.points)); - } - - settextjustify(1, 1); - shbox(400, 177, 600, 195, "[Press any key...]"); - settextjustify(0, 2); - on(); - wait_for_keypress_or_mouse_click(); - - off(); - setfillstyle(1, 1); - bar(2, 2, 637, 197); - drawup(); - off(); - highlight(3, where[3] - top[3] + 1); - on(); -} - -void filer_help() -/* Just some general help... */ - -{ - off(); - little_cls(); - - setcolor(15); - outtextxy(10, 10, "To change to a particular pane:"); - outtextxy(10, 50, "To choose a file:"); - outtextxy(10, 100, "To change drives:"); - outtextxy(10, 140, "Finally..."); - - setcolor(14); - outtextxy(20, 20, "Press Alt and the initial letter simultaneously."); - outtextxy(20, 30, "(e.g. to change to the Name pane, press Alt-N.)"); - outtextxy(20, 60, "Either type its name in the Name pane or choose it"); - outtextxy(20, 70, "from the list in the Files pane. You may either use"); - outtextxy(20, 80, "a mouse or the keyboard to do this."); - outtextxy(20, 110, "Move into the Drives pane and press the letter of the"); - outtextxy(20, 120, "drive you want."); - outtextxy(20, 150, "Either select OK to load the file, or Cancel to back out."); - - settextjustify(1, 1); - shbox(400, 177, 600, 195, "[Press any key...]"); - settextjustify(0, 2); - on(); - wait_for_keypress_or_mouse_click(); - - off(); - setfillstyle(1, 1); - bar(2, 2, 637, 197); - drawup(); - off(); - if (set::of(3, 4, eos).has(nowwin)) highlight(nowwin, where[nowwin] - top[nowwin] + 1); - on(); -} - -void wipe(byte which) -/* This wipes the file whose name is in lists[files,which]. */ -{ - char r; - untyped_file f; - - - off(); - little_cls(); - - settextjustify(1, 1); - outtextxy(320, 100, string("Are you sure you want to delete \"") + - lists[files][which] + ".asg\"?"); - shbox(400, 177, 600, 195, "[Y/N]"); - - do { - r = upcase(readkey()); - if (r == 'Y') { - assign(f, lists[files][which] + ".asg"); /*$I-*/ erase(f); /*$I+*/ - - setcolor(14); - if (ioresult == 0) { - scandir(); - outtextxy(100, 140, "Deleted."); - } else - outtextxy(100, 140, "Not deleted (some problem...)"); - - shbox(400, 177, 600, 195, "[Press any key...]"); - on(); - wait_for_keypress_or_mouse_click(); - off(); - } - } while (!(set::of('Y', 'N', eos).has(r))); - - settextjustify(0, 2); - setcolor(14); - setfillstyle(1, 1); - bar(2, 2, 637, 197); - drawup(); - off(); - highlight(3, where[3] - top[3] + 1); - on(); -} - -string do_filer() { - pathstr p; - byte groi; - dirstr original_directory; - - string do_filer_result; - getdir(0, original_directory); - dusk(); - oncandopageswap = false; - cancelled = false; - copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); - off(); - - firstsetup(); - scandir(); - nowwin = 1; - getcurrent(); - firstsetup(); - drawup(); - on(); - mousepage(filer_page); - - p = playaround(); - if (p != "") p = fexpand(p + ".ASG"); - do_filer_result = p; - filename = ""; - - mousepage(cp); - dusk(); - off(); - oncandopageswap = true; - copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); - on_virtual(); - dawn(); - fix_flashers(); - - setvisualpage(cp); - setactivepage(1 - cp); - chdir(original_directory); - - return do_filer_result; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fileunit.h b/engines/avalanche/fileunit.h deleted file mode 100644 index e891ff90e202..000000000000 --- a/engines/avalanche/fileunit.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __fileunit_h__ -#define __fileunit_h__ - -namespace Avalanche { - -string do_filer(); /* Result is filename, or "" if cancelled. */ - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/filing.cpp b/engines/avalanche/filing.cpp deleted file mode 100644 index dce34e9b5730..000000000000 --- a/engines/avalanche/filing.cpp +++ /dev/null @@ -1,196 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - FILING The saving and loading handler. */ - - -/*$R+*/ - -/*interface*/ - -/*#include "Gyro.h"*/ - -namespace Avalanche { - -const array<1, 12, varying_string<6> > months = { - { - "Jan*", "Feb*", "March", "April", "May", "June", "July", "August", - "Sept&", "Oct&", "Nov&", "Dec&" - } -}; -const string ednaid = string("TT") + '\261' + '\36' + '\1' + '\113' + '\261' + '\231' + '\261'; -const array<1, 6, varying_string<7> > systems = -{{"DOS", "Windows", "OS/2", "Mac", "Amiga", "ST"}}; - -struct edhead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte os; /* Saving OS (here 1=DOS). See below for others.*/ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST */ - -/*implementation*/ - -untyped_file f; -byte fv; -array<1, 255, word> dna256; -boolean ok; -edhead e; - -void info256(string x) { /* info on dna256 *.ASG files */ - varying_string<40> describe; - assign(f, x); - /*$I-*/ reset(f, 1); - seek(f, 47); - blockread(f, describe, 40); - blockread(f, dna256, sizeof(dna256)); - close(f); /*$I+*/ - { - e.revision = 1; - e.game = "Denarius Avaricius Sextus"; - e.shortname = "Avaricius"; - e.number = 1; - e.verstr = "[?]"; - e.filename = "AVVY.EXE"; - e.os = 1; /* Dos */ - e.fn = x; - e.d = dna256[7]; - e.m = dna256[8]; - e.y = dna256[9]; - e.desc = describe; - e.len = 512; - e.saves = dna256[6]; - e.cash = dna256[30]; - e.money = strf(e.cash) + " denari"; - if (e.cash == 1) e.money = e.money + "us"; - else e.money = e.money + 'i'; - e.points = dna256[36]; - } -} - -string enlarge(string x) { - string enlarge_result; - switch (x[length(x)]) { - case '*': { - x[0] -= 1; - x = x + "uary"; - } - break; - case '&': { - x[0] -= 1; - x = x + "ember"; - } - break; - } - enlarge_result = x; - return enlarge_result; -} - -string th(byte x) { - varying_string<4> n; - string th_result; - n = strf(x); - switch (x) { - case 1: - case 21: - case 31: - n = n + "st"; - break; - case 2: - case 22: - n = n + "nd"; - break; - case 3: - case 23: - n = n + "rd"; - break; - default: - n = n + "th"; - } - th_result = n; - return th_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - info256("t:justb4.asg"); - - { - output << "DNA coding: "; - switch (e.revision) { - case 1: - output << "dna256" << NL; - break; - case 2: - output << "E.D.N.A." << NL; - break; - default: - output << "Unknown!" << NL; - } - output << "Filename: " << e.game << " (version " << e.verstr << ')' << NL; - output << "Description: " << e.desc << NL; - output << "Cash: " << e.money << NL; - output << "Score: " << e.points << NL; - output << "Date: " << th(e.d) << ' ' << enlarge(months[e.m]) << ' ' << e.y << NL; - output << "Number of saves: " << e.saves << NL; - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/folktemp.cpp b/engines/avalanche/folktemp.cpp deleted file mode 100644 index c32618209c5e..000000000000 --- a/engines/avalanche/folktemp.cpp +++ /dev/null @@ -1,114 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Get 'em back! */ -#include "graph.h" - -namespace Avalanche { - -const integer picsize = 966; -const integer number_of_objects = 19; - -const array<1, 65, char> thinks_header = - string("This is an Avalot file, which is subject to copyright. Have fun.") + '\32'; - -const array<0, 19, byte> order = { - { - 4, 19, 1, 18, 15, 9, 12, 13, 17, 10, 2, 6, 3, 5, 7, 14, - 16, - - 0, 11, 8 - } -}; - -/* - pAvalot=#150; pSpludwick=#151; pCrapulus=#152; pDrDuck=#153; - pMalagauche=#154; pFriarTuck=#155; pRobinHood=#156; pCwytalot=#157; - pduLustie=#158; pDuke=#159; pDogfood=#160; pTrader=#161; - pIbythneth=#162; pAyles=#163; pPort=#164; pSpurge=#165; - pJacques=#166; - - pArkata=#175; pGeida=#176; pWiseWoman=#178; -*/ - -integer gd, gm; -untyped_file f; -pointer p; -byte noo; - -void load() { - byte a0 /*absolute $A000:1200*/; - byte bit; - untyped_file f; - assign(f, "d:folk.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void get_one() { - - gd = ((order[noo] % 9) * 70 + 10); - gm = ((order[noo] / 9) * 40 + 20); - - getimage(gd, gm, gd + 59, gm + 29, p); - putimage(gd, gm, p, notput); - blockwrite(f, p, picsize); - -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - load(); - noo = 0; - - assign(f, "folk.avd"); - getmem(p, picsize); - rewrite(f, 1); - blockwrite(f, thinks_header, 65); - - for (noo = 0; noo <= number_of_objects; noo ++) - get_one(); - - close(f); - freemem(p, picsize); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/fontslid.cpp b/engines/avalanche/fontslid.cpp deleted file mode 100644 index 43dbd785572f..000000000000 --- a/engines/avalanche/fontslid.cpp +++ /dev/null @@ -1,57 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -fonttype font1; -byte fv; -char r; -file f; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(f, "v:avalot.fnt"); - reset(f); - f >> font1; - close(f); - for (r = '\0'; r <= '\377'; r ++) { - for (fv = 0; fv <= 3; fv ++) font1[r][fv] = (cardinal)font1[r][fv] >> 1; - for (fv = 7; fv <= 8; fv ++) font1[r][fv] = font1[r][fv] << 1; - for (fv = 9; fv <= 14; fv ++) font1[r][fv] = font1[r][fv] << 2; - } - assign(f, "v:avitalic.fnt"); - rewrite(f); - f << font1; - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/frere.cpp b/engines/avalanche/frere.cpp deleted file mode 100644 index fd4ffd4d0257..000000000000 --- a/engines/avalanche/frere.cpp +++ /dev/null @@ -1,131 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -typedef array<1, 31, byte> tunetype; - -const integer lower = 0; -const integer same = 1; -const integer higher = 2; - -const array<1, 12, char> keys = "QWERTYUIOP[]"; -const array<1, 12, word> notes = -{{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}}; - -const tunetype tune = { - { - higher, higher, lower, same, higher, higher, lower, higher, higher, higher, - lower, higher, higher, - same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, - lower, same, lower, higher, same, lower, higher - } -}; - -byte this_one, last_one; - -char pressed; - -byte value; - -tunetype played; - -void store_(byte what) { - - move(played[2], played[1], sizeof(played) - 1); - - played[31] = what; - -} - -boolean they_match() { - byte fv; - boolean they_match_result; - - for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != tune[fv]) { - they_match_result = false; - return they_match_result; - } - - they_match_result = true; - - return they_match_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - - textattr = 30; - clrscr; - output << NL; - - do { - - pressed = upcase(readkey()); - - value = pos(pressed, keys); - - if (value > 0) { - - last_one = this_one; - this_one = value; - - sound(notes[this_one]); - delay(100); - nosound; - - if (this_one < last_one) - store_(lower); - else - - if (this_one == last_one) - store_(same); - else - - store_(higher); - - if (they_match()) { - textattr = 94; - clrscr; - output << NL; - output << string('\7') + "It matches!" << NL; - input >> NL; - exit(0); - } - - } - - } while (!(pressed == '\33')); - - output << "*** PROGRAM STOPPED! ***" << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/g-room.cpp b/engines/avalanche/g-room.cpp deleted file mode 100644 index 2db249ba60c3..000000000000 --- a/engines/avalanche/g-room.cpp +++ /dev/null @@ -1,453 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -/*$R+*/ - -namespace Avalanche { - -const array<1, 5, shortint> adjustment = {{7, 0, 7, 7, 7}}; - -const array<0, 3, byte> plane_to_use = {{2, 2, 2, 3}}; - -const array<1, 5, byte> waveorder = {{5, 1, 2, 3, 4}}; - -const array<1, 26, byte> glerkfade = -{{1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1}}; - -const array<1, 18, byte> greldetfade = {{1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1}}; - -enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; -}; - -typedef array<1, 6, 0, 3, 0, 34, 1, 9, byte> glerktype; - - -untyped_file f; -chunkblocktype cb; -array<1, 5, 2, 3, 0, 65, 0, 25, byte> ghost; -byte fv; -pointer memlevel; -byte y, yy, bit, xofs; - -array<0, 1, pointer> eyes; -pointer exclamation; -array<1, 6, pointer> aargh; -array<1, 3, pointer> bat; -glerktype *glerk; -array<1, 5, pointer> green_eyes; -matrix<1, 6, false, true, pointer> greldet; - -array<1, 6, pointtype> aargh_where; - -integer gd, gm; -boolean gb; - -byte glerkstage; - -integer bat_x, bat_y; -word bat_count; -shortint aargh_count; - -integer greldet_x, greldet_y; -byte greldet_count; -boolean red_greldet; - -void plain_grab() -/* Just grabs the next one and puts it where it's told to. */ -{ - integer xx, yy, xofs; - blockread(f, cb, sizeof(cb)); - - switch (cb.flavour) { - case ch_one: { - xofs = cb.x / 8; - bit = 3; - for (yy = 0; yy <= cb.yl; yy ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - blockread(f, mem[0xa000 * (yy + cb.y) * 80 + xofs], cb.xl / 8); - } - } - break; - case ch_ega: { - xofs = cb.x / 8; - bit = 3; - for (bit = 0; bit <= 3; bit ++) - for (yy = 0; yy <= cb.yl; yy ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - blockread(f, mem[0xa000 * (yy + cb.y) * 80 + xofs], cb.xl / 8); - } - } - break; - } -} - -void get_me(pointer &p) { - blockread(f, cb, sizeof(cb)); - /* Take it for granted that cb.flavour = ch_BGI! */ - - { - getmem(p, cb.size); - blockread(f, p, cb.size); - } -} - -void get_me_aargh(byte which) { - blockread(f, cb, sizeof(cb)); - /* Take it for granted that cb.flavour = ch_BGI! */ - - { - getmem(aargh[which], cb.size); - blockread(f, aargh[which], cb.size); - } - - { - pointtype &with = aargh_where[which]; - - with.x = cb.x; - with.y = cb.y; - } -} - -void wait(word how_long) { - word i; - char r; - - for (i = 1; i <= how_long; i ++) - if (keypressed()) { - sound(6177); - while (keypressed()) r = readkey(); - delay(1); - nosound; - } else - delay(1); -} - -void do_bat(); -static byte batimage; -static pointtype batsize; - -static void super_blank() { - pointtype oldsize; - - move(bat[batimage - 1], oldsize, 4); - bar(bat_x + batsize.x, bat_y, bat_x + oldsize.x, bat_y + oldsize.y); -} - -void do_bat() { - shortint dx, iy; - - bat_count += 1; - - if (odd(bat_count)) { - switch (bat_count) { - case 1 ... 90: { - dx = 2; - iy = 1; - batimage = 1; - } - break; - case 91 ... 240: { - dx = 1; - iy = 1; - batimage = 2; - } - break; - case 241 ... 260: { - dx = 1; - iy = 4; - batimage = 3; - } - break; - } - - move(bat[batimage], batsize, 4); - - if ((bat_count == 91) || (bat_count == 241)) - super_blank(); /* When the bat changes, blank out the old one. */ - - bar(bat_x, bat_y, bat_x + batsize.x, bat_y + iy); - bar(bat_x + batsize.x, bat_y, bat_x + batsize.x - dx, bat_y + batsize.y); - - bat_x -= dx; - bat_y += 1; - putimage(bat_x, bat_y, bat[batimage], 0); - } -} - -void big_green_eyes(byte how) { - putimage(330, 103, green_eyes[how], 0); - putimage(376, 103, green_eyes[how], 0); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - if (paramstr(1) != "jsb") exit(255); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - fillchar(ghost, sizeof(ghost), '\0'); - - assign(f, "spooky.avd"); - reset(f, 1); - seek(f, 44); - - mark(memlevel); - - for (fv = 1; fv <= 5; fv ++) { - blockread(f, cb, sizeof(cb)); - for (bit = 2; bit <= 3; bit ++) - for (y = 0; y <= cb.yl; y ++) - blockread(f, ghost[fv][bit][y], cb.xl / 8); - } - - get_me(eyes[0]); /* Get BGI-based ones */ - get_me(eyes[1]); - get_me(exclamation); - - plain_grab(); /* Grabs to screen (cobweb) */ - plain_grab(); /* Grabs to screen (Mark's signature) */ - plain_grab(); /* Grabs to screen (open door) */ - - for (fv = 1; fv <= 3; fv ++) - get_me(bat[fv]); - - /* new(glerk); - for fv:=1 to 5 do { Grab the Glerk. } - begin; - blockread(f,cb,sizeof(cb)); - for bit:=0 to 3 do - for y:=0 to 34 do - blockread(f,glerk^[fv,bit,y],cb.xl div 8); - inc(gd,gm); - end; - */ - - glerk = new glerktype; - - for (fv = 1; fv <= 6; fv ++) { - blockread(f, cb, sizeof(cb)); - bit = 3; - for (bit = 0; bit <= 3; bit ++) - for (yy = 0; yy <= cb.yl; yy ++) - /* begin; - port[$3c4]:=2; port[$3ce]:=4; - port[$3C5]:=1 shl bit; port[$3CF]:=bit;*/ - - blockread(f, (*glerk)[fv][bit][yy], cb.xl / 8); - /* move(glerk^[fv,bit,yy],mem[$A000:yy*80+177],xl div 8);*/ - /* blockread(f,mem[$A000:yy*80+177],xl div 8);*/ - - /* end;*/ - } - - for (fv = 1; fv <= 6; fv ++) get_me_aargh(fv); - for (fv = 1; fv <= 5; fv ++) get_me(green_eyes[fv]); - for (gb = false; gb <= true; gb ++) - for (fv = 1; fv <= 6; fv ++) get_me(greldet[fv][gb]); - - close(f); - - /* Avvy walks over... */ - - setfillstyle(1, 0); - glerkstage = 0; - bat_x = 277; - bat_y = 40; - bat_count = 0; - - for (gd = 500; gd >= 217; gd --) { - if (set::of(range(22, 27), eos).has((gd % 30))) { - if ((gd % 30) == 27) bar(gd, 135, gd + 16, 136); - putimage(gd, 136, eyes[0], 0); - putpixel(gd + 16, 137, 0); - } else { - if (gd % 30 == 21) bar(gd, 137, gd + 17, 138); - - putimage(gd, 135, eyes[0], 0); - putpixel(gd + 16, 136, 0); /* eyes would leave a trail 1 pixel high behind them */ - } - - /* Plot the Glerk: */ - if (gd % 10 == 0) { - glerkstage += 1; - if (glerkstage > 26) flush(); - - for (gm = 0; gm <= 34; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - move((*glerk)[glerkfade[glerkstage]][bit][gm], - mem[0xa000 * 1177 + gm * 80], 9); - } - bit = getpixel(0, 0); - } - - do_bat(); - - wait(15); - } - - setfillstyle(1, 0); - bar(456, 14, 530, 50); - - /* It descends... */ - - for (gm = -64; gm <= 103; gm ++) { - bit = getpixel(0, 0); - - if (gm > 0) - fillchar(mem[0xa000 * (gm - 1) * 80], 26, '\0'); - - for (y = 0; y <= 65; y ++) - if ((y + gm) >= 0) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - move(ghost[2 + (abs(gm / 7) % 2) * 3][plane_to_use[bit]][y], - mem[0xa000 * (y + gm) * 80], 26); - } - - wait(27); - } - - /* And waves... */ - - aargh_count = -14; - - for (gd = 1; gd <= 4; gd ++) - for (fv = 1; fv <= 5; fv ++) { - - y = getpixel(0, 0); - - for (y = 0; y <= 7; y ++) - fillchar(mem[0xa000 * 7760 + y * 80], 26, '\0'); - - for (y = 0; y <= 65; y ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(ghost[waveorder[fv]][plane_to_use[bit]][y], - mem[0xa000 * 7760 + (y + adjustment[fv]) * 80], 26); - } - - aargh_count += 1; - - if (aargh_count > 0) { - pointtype &with = aargh_where[aargh_count]; - putimage(with.x, with.y, aargh[aargh_count], 0); - } - - wait(177); - } - - /* ! appears */ - - gd = getpixel(0, 0); - putimage(246, 127, exclamation, 0); - wait(777); - bar(172, 78, 347, 111); /* erase "aargh" */ - - for (gm = 5; gm >= 1; gm --) { - wait(377); - big_green_eyes(gm); - } - bar(246, 127, 251, 133); /* erase the "!" */ - - /* He hurries back. */ - - glerkstage = 1; - greldet_count = 18; - red_greldet = false; - - for (gd = 217; gd <= 479; gd ++) { - if (set::of(range(22, 27), eos).has((gd % 30))) { - if ((gd % 30) == 22) - bar(gd + 22, 134, gd + 38, 137); - putimage(gd + 23, 136, eyes[1], 0); - putpixel(gd + 22, 137, 0); - } else { - if (gd % 30 == 28) - bar(gd + 22, 135, gd + 38, 138); - - putimage(gd + 23, 135, eyes[1], 0); - putpixel(gd + 22, 136, 0); /* eyes would leave a trail 1 pixel high behind them */ - } - - /* Plot the Green Eyes: */ - if (gd % 53 == 5) { - big_green_eyes(glerkstage); - glerkstage += 1; - } - - /* Plot the Greldet: */ - - if (greldet_count == 18) { - /* A new greldet. */ - greldet_x = Random(600); - greldet_y = Random(80); - greldet_count = 0; - red_greldet = ! red_greldet; - } - - greldet_count += 1; - putimage - (greldet_x, greldet_y, greldet[greldetfade[greldet_count]][red_greldet], 0); - - wait(10); - } - - release(memlevel); - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/golden.cpp b/engines/avalanche/golden.cpp deleted file mode 100644 index b5a6388b69af..000000000000 --- a/engines/avalanche/golden.cpp +++ /dev/null @@ -1,476 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$I c:\sleep5\DSMI.INC*/ #include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<255> song = - string("Golden slumbers kiss your eyes/Smiles awake you when you rise/") + - "Sleep, pretty Baron, do not cry/And I will sing a lullaby.%Care you " + - "know not, therefore sleep/While I o'er you watch do keep;/Sleep now, " + - "du Lustie, do not cry/And I will leave the castle.*Bye!"; - -const integer scardcount = 13; - -const array < 0, scardcount - 1, integer > soundcards = -{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; - -const array<1, 5, byte> holding = { - { - 24, /* 0 : 24 */ - 64, /* 1 : 00 */ - 128, /* 2 : 00 */ - 152, /* 2 : 24 */ - 170 - } -}; /* 2 : 42 */ - -integer gd, gm; -byte fv; -word *skellern; -word s, o; -boolean firstverse; -word nexthangon; - -boolean nomusic; - -integer getsoundhardware(psoundcard scard) { - integer sc, i, autosel, select; - char ch; - integer e; - - - - integer getsoundhardware_result; -Lagain: - sc = detectgus(scard); - if (sc != 0) sc = detectpas(scard); - if (sc != 0) sc = detectaria(scard); - if (sc != 0) sc = detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); - - autosel = -1; - /* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13), select, e); - - /* Default entry? */ - if (select == 0) select = autosel; - if (select != autosel) { - /* clear all assumptions */ - sc = -1; - fillchar(scard, sizeof(tsoundcard), 0); - scard->id = soundcards[select - 1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id == id_dac) scard->ioport = 0x378; - - /* Read user input */ - val(paramstr(15), i, e); - - if (i != 0) scard->ioport = i; - if (sc != 1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : - scard->samplesize = 2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: - scard->stereo = true; - break; /* enable stereo */ - default: { - scard->samplesize = 1; - scard->stereo = false; - } - } - - if (scard->id != id_dac) { - val(paramstr(17), i, e); - - if (i != 0) scard->dmairq = i; - - val(paramstr(16), i, e); - - if (i != 0) scard->dmachannel = i; - } else { - /* Select correct DAC */ - scard->maxrate = 44100; - if (select == 11) { - scard->stereo = true; - scard->dmachannel = 1; /* Special 'mark' */ - scard->maxrate = 60000; - } else if (select == 12) { - scard->stereo = true; - scard->dmachannel = 2; - scard->maxrate = 60000; - if (scard->ioport == 0) scard->ioport = 0x378; - } else if (select == 13) { - scard->dmachannel = 0; - scard->ioport = 0x42; /* Special 'mark' */ - scard->maxrate = 44100; - } - } - - /* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result = 0; - return getsoundhardware_result; -} - -byte here() { - byte here_result; - here_result = (ampgetpattern % 3) * 64 + ampgetrow; - return here_result; -} - -void hold(word amount) { - *skellern = 0; - do { - } while (!(*skellern >= amount)); -} - -void hangon(word forwhat) { - if (nomusic) - hold(40); - else - do { - if (keypressed()) exit(0); - } while (!(here() >= holding[forwhat])); -} - -tsoundcard scard; -tmcpstruct mcpstrc; -tdds dds; -pmodule module; -tsdi_init sdi; -integer e, - bufsize; -char ch; -boolean v86, - vdsok; -longint a, rate, - tempseg; -string answer; -pointer temp; -word flags; -word curch; -byte modulevolume; -array<0, 4, tsampleinfo> sample; -array<0, 31, word> voltable; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - for (e = 1; e <= paramcount; e ++) answer = paramstr(e); - - nomusic = paramstr(13) == '0'; - - if (! nomusic) { - /* Read sound card information */ - if (getsoundhardware(&scard) == -1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id == id_gus) { - /* Initialize GUS player */ -#ifndef DPMI - scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ -#endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus, 0, 31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt, gus_timer); - } else { - /* Initialize Virtual DMA Specification */ -#ifndef DPMI - vdsok = vdsinit == 0; -#else - vdsok = false; -#endif - - fillchar(mcpstrc, sizeof(tmcpstruct), 0); - - /* Query for sampling rate */ - val(paramstr(14), a, e); - if (a > 4000) rate = a; - else rate = 21000; - - /* Query for quality */ - mcpstrc.options = mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi = sdi_sb; - scard.maxrate = 22000; - } - break; - case id_sbpro : { - sdi = sdi_sbpro; - scard.maxrate = 22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi = sdi_pas; - scard.maxrate = 44100; - } - break; - case id_sb16 : { - sdi = sdi_sb16; - scard.maxrate = 44100; - } - break; - case id_aria : { - sdi = sdi_aria; - scard.maxrate = 44100; - } - break; - case id_wss : { - sdi = sdi_wss; - scard.maxrate = 48000; - } - break; -#ifndef DPMI - case id_dac : - sdi = sdi_dac; - break; /* Only available in real mode */ -#endif - } - - mcpinitsounddevice(sdi, &scard); - a = mcp_tablesize; - mcpstrc.reqsize = 0; - - /* Calculate mixing buffer size */ - bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize = 0; - if ((mcpstrc.options & mcp_quality) > 0) - if (scard.samplesize == 1) a += mcp_qualitysize; - else - a = mcp_tablesize16 + mcp_qualitysize16; - if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; - -#ifdef DPMI - dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); - v86 = (flags & 2) == 0; -#endif - - /* Allocate volume table + mixing buffer */ -#ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg = 0; - dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); - } else { -#endif - getmem(temp, a + longint(bufsize)); - if (temp == nil) exit(2); -#ifdef DPMI - tempseg = seg(temp); - } -#else - tempseg = seg(temp) + ofs(temp) / 16 + 1; -#endif - mcpstrc.bufferseg = tempseg; - mcpstrc.bufferphysical = -1; - - if (vdsok && (scard.id != id_dac)) { - dds.size = bufsize; - dds.segment = tempseg; - dds.offset = 0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; - } - if (mcpstrc.bufferphysical == -1) -#ifdef DPMI - mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); -#else - mcpstrc.bufferphysical = (longint)(tempseg) << 4; -#endif - - mcpstrc.buffersize = bufsize; - mcpstrc.samplingrate = rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc) != 0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp, 0, 31); - } - - /* Try to initialize AMP */ - if (ampinit(0) != 0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt, amp_timer); - -#ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id == id_dac) setdactimer(tsgettimerrate); -#endif - - if (scard.id != id_gus) mcpstartvoice; - else gusstartvoice; - - /* Load an example AMF */ - module = amploadmod("golden.mod", 0); - if (module == nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) - && (scard.samplesize == 2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); - cdisetupchannels(0, module->channelcount + 2, &voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0, module->channelcount + 2, nil); - } - - curch = module->channelcount; - modulevolume = 64; - - /***/ ampplaymodule(module, 0); - } - - val(paramstr(2), s, e); - if (e != 0) exit(0); - val(paramstr(3), o, e); - if (e != 0) exit(0); - skellern = ptr(s, o + 1); - - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - - if (! nomusic) do { - } while (!(ampgetrow >= 10)); - - setcolor(9); - for (gd = 0; gd <= 320; gd ++) { - rectangle(320 - gd, 100 - gd / 2, 320 + gd, 100 + gd / 2); - } - - - gd = 50; - gm = 20; - firstverse = true; - - hangon(1); - nexthangon = 2; - for (fv = 1; fv <= 255; fv ++) { - switch (song[fv]) { - case '/': { - gd = 50; - gm += 15; - hangon(nexthangon); - nexthangon += 1; - } - break; - - case '%': { - gd = 50; - gm += 35; - if (nomusic) - hold(15); - else - do { - } while (!(ampgetpattern > 2)); - nexthangon = 2; - hangon(1); - } - break; - - case '*': { - gd += 24; - hangon(5); - } - break; - - default: { - setcolor(1); - outtextxy(gd + 1, gm + 1, song[fv]); - setcolor(0); - outtextxy(gd , gm , song[fv]); - gd += 12; - } - } - if (song[fv] == ' ') hold(1); - if (keypressed()) exit(0); - } - - if (nomusic) - hold(25); - else - do { - } while (!(ampgetmodulestatus != md_playing)); - - setcolor(0); - for (gd = 320; gd >= 0; gd --) rectangle(320 - gd, 100 - gd / 2, 320 + gd, 100 + gd / 2); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp deleted file mode 100644 index bcdd4c14d699..000000000000 --- a/engines/avalanche/gyro.cpp +++ /dev/null @@ -1,609 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - GYRO It all revolves around this bit! */ - -#define __gyro_implementation__ - - -#include "gyro.h" - - -#include "pingo.h" -#include "scrolls.h" -#include "lucerna.h" -#include "visa.h" -#include "acci.h" -#include "trip5.h" -#include "dropdown.h" -#include "basher.h" - -namespace Avalanche { - -const array < '\1', numobjs, varying_string<15> > things = { - { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" - } -}; - -const array < '\1', numobjs, char > thingchar = "WMBParCLguKeSnIohn"; /* V=Vinegar */ - -const array < '\1', numobjs, varying_string<17> > better = { - { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" - } -}; - -const array < '\1', numobjs, char > betterchar = "WMBParCLguKeSnIohn"; - -void newpointer(byte m) { - if (m == cmp) return; - cmp = m; - { - ax = 9; - bx = (word)(mps[m].horzhotspot); - cx = (word)(mps[m].verthotspot); - es = seg(mps[m].mask); - dx = ofs(mps[m].mask); - } - intr(0x33, r); - load_a_mouse(m); -} - -void wait() { /* makes hourglass */ - newpointer(5); -} - -void on() { - if (set_of_enum()::of(m_yes, m_virtual, eos).has(visible)) return; - - r.ax = 1; - intr(0x33, r); - visible = m_yes; - if (oncandopageswap) { - r.ax = 29; - r.bx = cp; - intr(0x33, r); /* show mouse on current page */ - } -} - -void on_virtual() { - switch (visible) { - case m_virtual: - return; - break; - case m_yes: - off(); - break; - } - - visible = m_virtual; -} - -void off() { - switch (visible) { - case m_no: - case m_virtual : - return; - break; - case m_yes : { - r.ax = 2; - intr(0x33, r); - } - break; - } - visible = m_no; -} - -void off_virtual() { - byte fv; - - if (visible != m_virtual) return; - - for (fv = 0; fv <= 1; fv ++) { - setactivepage(fv); - wipe_vmc(1 - fv); - } - setactivepage(1 - cp); - visible = m_no; -} - -void xycheck() { /* only updates mx & my, not all other mouse vars */ - r.ax = 3; - intr(0x33, r); /* getbuttonstatus */ - { - keystatus = bx; - mx = cx; - my = dx; - } -} - -void hopto(integer x, integer y) { /* Moves mouse pointer to x,y */ - { - ax = 4; - cx = x; - dx = y; - } - intr(0x33, r); -} - -void check() { - { - ax = 6; - bx = 0; - } - intr(0x33, r); /* getbuttonreleaseinfo */ - { - mrelease = bx; - mrx = cx; - mry = dx; - } - { - ax = 5; - bx = 0; - } - intr(0x33, r); /* getbuttonpressinfo */ - { - mpress = bx; - mpx = cx; - mpy = dx; - } - xycheck(); /* just to complete the job. */ -} - -void note(word hertz) { - if (soundfx) sound(hertz); -} - -void blip() { - byte fv; - - for (fv = 1; fv <= 7; fv ++) { - sound(177 + (fv * 200) % 177); - delay(1); - } - nosound; -} - -string strf(longint x) { - string q; - - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void shadow(integer x1, integer y1, integer x2, integer y2, byte hc, byte sc) { - byte fv; - - for (fv = 0; fv <= border; fv ++) { - setfillstyle(1, hc); - bar(x1 + fv, y1 + fv, x1 + fv, y2 - fv); - bar(x1 + fv, y1 + fv, x2 - fv, y1 + fv); - - setfillstyle(1, sc); - bar(x2 - fv, y1 + fv, x2 - fv, y2 - fv); - bar(x1 + fv, y2 - fv, x2 - fv, y2 - fv); - } -} - -void shbox(integer x1, integer y1, integer x2, integer y2, string t) { - const integer fc = 7; - - off(); - shadow(x1, y1, x2, y2, 15, 8); - setfillstyle(1, fc); - bar(x1 + border + 1, y1 + border + 1, x2 - border - 1, y2 - border - 1); - setcolor(1); - x1 = (x2 - x1) / 2 + x1; - y1 = (y2 - y1) / 2 + y1; - outtextxy(x1, y1, t); - if (length(t) > 1) { - fillchar(t[2], length(t) - 1, '\40'); - t[1] = '_'; - outtextxy(x1 - 1, y1 + 1, t); - } - on(); -} - -void newgame() { /* This sets up the DNA for a completely new game. */ - byte gd, gm; - - for (gm = 1; gm <= numtr; gm ++) { - triptype &with = tr[gm]; - if (with.quick) done(); - } /* Deallocate sprite. Sorry, beta testers! */ - - tr[1].init(0, true); - alive = true; - - score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ - fillchar(dna, sizeof(dna), '\0'); - natural(); - normal_edit(); - mousepage(0); - dna.spare_evening = "answer a questionnaire"; - dna.like2drink = "beer"; - - { - dna.pence = 30; /* 2/6 */ dna.rw = stopped; - dna.wearing = clothes; - dna.obj[money] = true; - dna.obj[bodkin] = true; - dna.obj[bell] = true; - dna.obj[clothes] = true; - } - - thinks = '\2'; - objectlist(); - ontoolbar = false; - seescroll = false; - - ppos[0][1] = -177; /*tr[1].appear(300,117,right);*/ gd = 0; - for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; - /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ - him = '\376'; - her = '\376'; - it = '\376'; - last_person = '\376'; /* = Pardon? */ - dna.pass_num = Random(30) + 1; - after_the_scroll = false; - dna.user_moves_avvy = false; - doing_sprite_run = false; - dna.avvy_in_bed = true; - enid_filename = ""; - - for (gd = 0; gd <= 1; gd ++) { - cp = 1 - cp; - getback(); - } - - enterroom(1, 1); - new_game_for_trippancy(); - showscore(); - - standard_bar(); - clock(); - sprite_run(); -} - -void click() { /* "Audio keyboard feedback" */ - sound(7177); - delay(1); - nosound; -} - -void slowdown() { - /* repeat until TSkellern>=howlong; TSkellern:=0;*/ - do { - } while (!(memw[storage_seg * skellern] >= howlong)); - memw[storage_seg * skellern] = 0; -} - -boolean flagset(char x) { - boolean flagset_result; - flagset_result = pos(x, flags) > 0; - return flagset_result; -} - -void force_numlock() { - if ((locks & num) > 0) locks -= num; -} - -boolean pennycheck(word howmuchby) { - boolean pennycheck_result; - dna.pence -= howmuchby; - if (dna.pence < 0) { - dixi('Q', 2); /* "you are now denariusless!" */ - pennycheck_result = false; - gameover(); - } else - pennycheck_result = true; - return pennycheck_result; -} - -string getname(char whose) { - string getname_result; - if (whose < '\257') getname_result = lads[whose]; - else getname_result = lasses[whose]; - return getname_result; -} - -char getnamechar(char whose) { - char getnamechar_result; - if (whose < '\257') getnamechar_result = ladchar[whose - 1]; - else getnamechar_result = lasschar[whose - 1]; - return getnamechar_result; -} - -string get_thing(char which) { - string get_thing_result; - switch (which) { - case wine: - switch (dna.winestate) { - case 1: - case 4: - get_thing_result = things[which]; - break; - case 3: - get_thing_result = "Vinegar"; - break; - } - break; - case onion: - if (dna.rotten_onion) - get_thing_result = "rotten onion"; - else get_thing_result = things[which]; - break; - default: - get_thing_result = things[which]; - } - return get_thing_result; -} - -char get_thingchar(char which) { - char get_thingchar_result; - switch (which) { - case wine: - if (dna.winestate == 3) get_thingchar_result = 'V'; /* Vinegar */ - else get_thingchar_result = thingchar[which - 1]; - break; - default: - get_thingchar_result = thingchar[which - 1]; - } - return get_thingchar_result; -} - -string get_better(char which) { - string get_better_result; - if (which > '\226') which -= 149; - switch (which) { - case wine: - switch (dna.winestate) { - case 0: - case 1: - case 4: - get_better_result = better[which]; - break; - case 3: - get_better_result = "some vinegar"; - break; - } - break; - case onion: - if (dna.rotten_onion) - get_better_result = "a rotten onion"; - else if (dna.onion_in_vinegar) - get_better_result = "a pickled onion (in the vinegar)"; - else get_better_result = better[which]; - break; - default: - if ((which < numobjs) && (which > '\0')) - get_better_result = better[which]; - else - get_better_result = ""; - } - return get_better_result; -} - -string f5_does() -/* This procedure determines what f5 does. */ -{ - string f5_does_result; - switch (dna.room) { - case r__yours: { - if (! dna.avvy_is_awake) { - /* He's asleep, =>= wake up. */ - f5_does_result = string(vb_wake) + "WWake up"; - return f5_does_result; - } - - if (dna.avvy_in_bed) { - /* In bed. => = get up. */ - f5_does_result = string(vb_stand) + "GGet up"; - return f5_does_result; - } - - } - break; - - case r__insidecardiffcastle: { - if (dna.standing_on_dais) - f5_does_result = string(vb_climb) + "CClimb down"; - else - f5_does_result = string(vb_climb) + "CClimb up"; - return f5_does_result; - } - break; - - case r__nottspub: { - if (dna.sitting_in_pub) - f5_does_result = string(vb_stand) + "SStand up"; - else - f5_does_result = string(vb_sit) + "SSit down"; - return f5_does_result; - } - break; - - case r__musicroom: - if (infield(7)) { - f5_does_result = string(vb_play) + "PPlay the harp"; - return f5_does_result; - } - break; - } - - f5_does_result = pardon; /* If all else fails... */ - return f5_does_result; -} - -void plot_vmc(integer xx, integer yy, byte page_) { - if (visible != m_virtual) return; - { - xx = xx + vmc.ofsx; - if (xx < 0) xx = 0; - yy = yy + vmc.ofsy; - if (yy < 0) yy = 0; - - setactivepage(1 - cp); - getimage(xx, yy, xx + 15, yy + 15, vmc.backpic[page_]); - putimage(xx, yy, vmc.andpic, andput); - putimage(xx, yy, vmc.xorpic, xorput); - - /* setcolor( 0); outtextxy(xx+8,yy+16,''); outtextxy(xx,yy+16,''); - setcolor(11+page); - outtextxy(xx+8,yy+16,chr(48+roomtime mod 10)); - outtextxy(xx ,yy+16,chr(48+(roomtime div 10) mod 10));*/ - - { - pointtype &with1 = vmc.wherewas[page_]; - - with1.x = xx; - with1.y = yy; - } - } -} - -void wipe_vmc(byte page_) { - if (visible != m_virtual) return; - { - pointtype &with1 = vmc.wherewas[page_]; - if (with1.x != maxint) - putimage(with1.x, with1.y, vmc.backpic[page_], 0); - } -} - -void setup_vmc() { - byte fv; - - { - getmem(vmc.andpic, mouse_size); - getmem(vmc.xorpic, mouse_size); - - for (fv = 0; fv <= 1; fv ++) { - getmem(vmc.backpic[fv], mouse_size); - vmc.wherewas[fv].x = maxint; - } - } -} - -void clear_vmc() { - byte fv; - - for (fv = 0; fv <= 1; fv ++) vmc.wherewas[fv].x = maxint; -} - -void setminmaxhorzcurspos(word min, word max) { /* phew */ - { - ax = 7; - cx = min; - dx = max; - } - intr(0x33, r); -} - -void setminmaxvertcurspos(word min, word max) { - { - ax = 8; /* A guess. In the book, 7 */ - cx = min; - dx = max; - } - intr(0x33, r); -} - -void load_a_mouse(byte which) { - untyped_file f; - - assign(f, "mice.avd"); - reset(f, 1); - seek(f, mouse_size * 2 * (which - 1) + 134); - - { - blockread(f, vmc.andpic, mouse_size); - blockread(f, vmc.xorpic, mouse_size); - close(f); - { - mp &with1 = mps[which]; - - vmc.ofsx = -with1.horzhotspot; - vmc.ofsy = -with1.verthotspot; - - setminmaxhorzcurspos(with1.horzhotspot + 3, 624 + with1.horzhotspot); - setminmaxvertcurspos(with1.verthotspot, 199); - } - } -} - -void background(byte x) { - setbkcolor(x); -} - -void hang_around_for_a_while() { - byte fv; - - for (fv = 1; fv <= 28; fv ++) slowdown(); -} - -boolean mouse_near_text() { - boolean mouse_near_text_result; - mouse_near_text_result = (my > 144) && (my < 188); - return mouse_near_text_result; -} - -/* Super_Off and Super_On are two very useful procedures. Super_Off switches - the mouse cursor off, WHATEVER it's like. Super_On restores it again - afterwards. */ - -void super_off() { - super_was_off = visible == m_no; - if (super_was_off) return; - - super_was_virtual = visible == m_virtual; - - if (visible == m_virtual) off_virtual(); - else off(); -} - -void super_on() { - if ((visible != m_no) || (super_was_off)) return; - - if (super_was_virtual) on_virtual(); - else on(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h deleted file mode 100644 index 7a7e2aa3aef3..000000000000 --- a/engines/avalanche/gyro.h +++ /dev/null @@ -1,839 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __gyro_h__ -#define __gyro_h__ - - -#include "graph.h" -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -const char numobjs = '\22'; /* always preface with a # */ -const integer maxobjs = 12; /* carry limit */ -const byte howlong = 1/*8*/; /* 18 ticks. */ - -const boolean oncandopageswap = true; /* Variable constant for overriding the - ability of On to switch pages. You may know better than On which page - to switch to. */ - -const integer num = 32; /* Code for Num Lock */ - -const integer mouse_size = 134; - -typedef void(*proc)(); - -struct postype { - word x, y, datapos; - byte length; -}; - -struct mp { /* mouse-pointer */ - matrix<0, 1, 0, 15, word> mask; - integer horzhotspot, verthotspot; -}; - -struct dnatype { - /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ - byte rw; /* Realway- just for convenience! */ - byte carrying; /* how many objects you're carrying... */ - array < '\1', numobjs, boolean > obj; /* ...and which ones they are. */ - integer score; /* your score, of course */ - longint pence; /* your current amount of dosh */ - byte room; /* your current room */ - char wearing; /* what you're wearing */ - byte swore; /* number of times you've sworn */ - byte saves; /* number of times this game has been saved */ - array<1, 100, byte> rooms; /* Add one to each every time - you enter a room */ - byte alcohol; /* Your blood alcohol level. */ - byte playednim; /* How many times you've played Nim. */ - boolean wonnim; /* Have you *won* Nim? (That's harder.) */ - byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ - boolean cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ - - byte pass_num; /* Number of the password for this game. */ - boolean ayles_is_awake; /* pretty obvious! */ - byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ - byte avaricius_talk; /* How much Avaricius has said to you. */ - boolean bought_onion; /* Have you bought an onion yet? */ - boolean rotten_onion; /* And has it rotted? */ - boolean onion_in_vinegar; /* Is the onion in the vinegar? */ - - byte given2spludwick; /* 0 = nothing given, 1 = onion... */ - byte brummie_stairs; /* Progression through the stairs trick. */ - byte cardiff_things; /* Things you get asked in Cardiff. */ - - boolean cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ - - boolean avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ - boolean avvy_in_bed; /* True if Avvy's in bed, but awake. */ - - boolean user_moves_avvy; /* If this is false, the user has no - control over Avvy's movements. */ - - byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ - - boolean givenbadgetoiby; /* Have you given the badge to Iby yet? */ - - boolean friar_will_tie_you_up; /* If you're going to get tied up. */ - boolean tied_up; /* You ARE tied up! */ - - char box_contents; /* 0 = money (sixpence), 254 = empty, any - other number implies the contents of the box. */ - - boolean talked_to_crapulus; /* Pretty self-explanatory. */ - - byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ - - boolean ringing_bells; /* Is Jacques ringing the bells? */ - - boolean standing_on_dais; /* In room 71, inside Cardiff Castle. */ - boolean taken_pen; /* Have you taken the pen (in Cardiff?) */ - boolean arrow_triggered; /* And has the arrow been triggered? */ - boolean arrow_in_the_door; /* Did the arrow hit the wall? */ - - varying_string<77> like2drink, - favourite_song, - worst_place_on_earth, - spare_evening; /* Personalisation str's */ - - longint total_time; /* Your total time playing this game, in ticks.*/ - - byte jumpstatus; /* Fixes how high you're jumping. */ - - boolean mushroom_growing; /* Is the mushroom growing in 42? */ - - boolean spludwicks_here; /* Is Spludwick at home? */ - - byte last_room; - byte last_room_not_map; - - boolean crapulus_will_tell; /* Will Crapulus tell you about - Spludwick being away? */ - - boolean enter_catacombs_from_lusties_room; - boolean teetotal; /* Are we touching any more drinks? */ - byte malagauche; /* Position of Malagauche. See Celer for more info. */ - char drinking; /* What's he getting you? */ - - boolean entered_lusties_room_as_monk; - - byte cat_x, cat_y; /* XY coords in the catacombs. */ - - boolean avvys_in_the_cupboard; /* On screen 22. */ - - boolean geida_follows; /* Is Geida following you? */ - - byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ - - byte nextbell; /* For the ringing. */ - - boolean geida_given_potion; /* Does Geida have the potion? */ - boolean lustie_is_asleep; /* Is BDL asleep? */ - - byte flip_to_where, flip_to_ped; /* For the sequencer. */ - - boolean been_tied_up; /* In r__Robins. */ - - boolean sitting_in_pub; /* Are you sitting down in the pub? */ - byte spurge_talk; /* Count for talking to Spurge. */ - - boolean met_avaroid; - - boolean taken_mushroom, - given_pen_to_ayles, - asked_dogfood_about_nim; -}; - -struct pedtype { - integer x, y; - byte dir; -}; - -struct magictype { - byte op; /* one of the operations */ - word data; /* data for them */ -}; - -class fieldtype { -public: - integer x1, y1, x2, y2; -}; - -struct bytefield { - byte x1, y1, x2, y2; -}; - -class linetype : public fieldtype { -public: - byte col; -}; - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -typedef matrix < '\0', '\377', 0, 15, byte > raw; /* raw_font_type */ - -enum controllers {cjoy, ckey, last_controllers}; - -typedef array<1, 20, varying_string<77> > previoustype; - -struct corridor_type { /* Decarations for the corridors. */ - word doors; /* Door styles are calc'ed from this word. - Assign a different number to each one! */ -}; - -struct demo_type { - word delay; - char key, extd; -}; - -struct quasiped_type { - byte whichped, fgc, room, bgc; - char who; -}; -/* A quasiped defines how people who aren't sprites talk. For example, - quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving - that to context. */ - -typedef array<1, 31, byte> tunetype; - -struct vmctype { /* Virtual Mouse Cursor */ - pointer andpic, xorpic; - array<0, 1, pointer> backpic; - array<0, 1, pointtype> wherewas; - byte picnumber; - shortint ofsx, ofsy; -}; - -struct sundry { - /* Things which must be saved over a backtobootstrap, - outside DNA. */ - pathstr qenid_filename; - boolean qsoundfx; - char qthinks; - boolean qthinkthing; -}; - -struct joysetup { - word xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; /* Size of centre in tenths */ -}; - -struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - array<1, 9, char> id; /* signature */ - word revision; /* EDNA revision, here 2 (1=dna256) */ - varying_string<50> game; /* Long name, eg Lord Avalot D'Argent */ - varying_string<15> shortname; /* Short name, eg Avalot */ - word number; /* Game's code number, here 2 */ - word ver; /* Version number as integer (eg 1.00 = 100) */ - varying_string<5> verstr; /* Vernum as string (eg 1.00 = "1.00" */ - varying_string<12> filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - varying_string<5> os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - varying_string<8> fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - word y; /* ...saved on. */ - varying_string<40> desc; /* Description of game (same as in Avaricius!) */ - word len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - word saves; /* no. of times this game has been saved */ - integer cash; /* contents of your wallet in numerical form */ - varying_string<20> money; /* ditto in string form (eg 5/-, or 1 denarius)*/ - word points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ -}; - -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ - -const char vernum[] = "1.30"; -const char copyright[] = "1995"; -const integer thisvercode = 130; -/* as "vernum", but numerically & without the ".". */ -const integer thisgamecode = 2; /* Avalot's code number */ - -/* Objects you can hold: */ -const char wine = '\1'; -const char money = '\2'; -const char bodkin = '\3'; -const char potion = '\4'; -const char chastity = '\5'; -const char bolt = '\6'; -const char crossbow = '\7'; -const char lute = '\10'; -const char badge = '\11'; -const char mushroom = '\12'; -const char key = '\13'; -const char bell = '\14'; -const char prescription = '\15'; -const char pen = '\16'; -const char ink = '\17'; -const char clothes = '\20'; -const char habit = '\21'; -const char onion = '\22'; - -/* People who hang around this game. */ - -/* Boys: */ -const char pavalot = '\226'; -const char pspludwick = '\227'; -const char pcrapulus = '\230'; -const char pdrduck = '\231'; -const char pmalagauche = '\232'; -const char pfriartuck = '\233'; -const char probinhood = '\234'; -const char pcwytalot = '\235'; -const char pdulustie = '\236'; -const char pduke = '\237'; -const char pdogfood = '\240'; -const char ptrader = '\241'; -const char pibythneth = '\242'; -const char payles = '\243'; -const char pport = '\244'; -const char pspurge = '\245'; -const char pjacques = '\246'; - -/* Girls: */ -const char parkata = '\257'; -const char pgeida = '\260'; -const char pwisewoman = '\262'; - -const integer xw = 30; -const integer yw = 36; /* x width & y whatsit */ - -const integer margin = 5; - -const array<1, 9, mp> mps = { - { { - /* 1 - up-arrow */ - { { {{65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}}, - {{0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0}} - } - }, - 8, - 0 - }, - - { - /* 2 - screwdriver */ - { { {{8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}}, - {{0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0}} - } - }, - 0, - 0 - }, - - { - /* 3 - right-arrow */ - { { {{65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}}, - {{0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0}} - } - }, - 15, - 6 - }, - - { - /* 4 - fletch */ - { { {{255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}}, - {{0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0}} - } - }, - 0, - 0 - }, - - { - /* 5 - hourglass */ - { { {{0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}}, - {{0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0}} - } - }, - 8, - 7 - }, - - { - /* 6 - TTHand */ - { { {{62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}}, - {{3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092}} - } - }, - 4, - 0 - }, - - { - /* 7- Mark's crosshairs */ - { { {{65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}}, - {{0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0}} - } - }, - 8, - 5 - }, - - { - /* 8- I-beam. */ - { { {{65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}}, - {{0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0}} - } - }, - 8, - 7 - }, - - { - /* 9- Question mark. */ - { { {{511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}}, - {{65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840}} - } - }, - 0, - 0 - } - } -}; - -const array < '\226', '\246', varying_string<19> > lads = { - { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" - } -}; - -const array < '\257', '\262', varying_string<14> > lasses = -{{"Arkata", "Geida", '', "the Wise Woman"}}; - -const array < '\226', '\245', char > ladchar = "ASCDMTRwLfgeIyPu"; - -const array < '\257', '\262', char > lasschar = "kGo"; - -const integer numtr = 2; /* current max no. of sprites */ - -const boolean a_thing = true; -const boolean a_person = false; /* for Thinkabout */ - -/* Magic/portal commands are */ - -/*N*/ const integer nix = 0; /* ignore it if this line is touched */ -/*B*/ const integer bounces = 1; /* bounce off this line. Not valid for portals. */ -/*E*/ const integer exclaim = 2; /* put up a chain of scrolls */ -/*T*/ const integer transport = 3; /* enter new room */ -/*U*/ const integer unfinished = 4; /* unfinished connection */ -/*S*/ const integer special = 5; /* special function. */ -/*O*/ const integer mopendoor = 6; /* opening door. */ - -/* These following constants should be included in CFG when it's written. */ - -const boolean slow_computer = false; /* stops walking when mouse touches toolbar */ - -/* --- */ - -const integer border = 1; /* size of border on shadowboxes */ - -const integer pagetop = 81920; - -const integer up = 0; -const integer right = 1; -const integer down = 2; -const integer left = 3; -const integer ur = 4; -const integer dr = 5; -const integer dl = 6; -const integer ul = 7; -const integer stopped = 8; - -const integer walk = 3; -const integer run = 5; - -/*$I ROOMNUMS.INC - Room number constants (r__xxx) */ - -const array < '\226', '\262', byte > whereis = - /* The Lads */ -{ { - r__yours, /* Avvy */ - r__spludwicks, /* Spludwick */ - r__outsideyours, /* Crapulus */ - r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - r__argentpub, /* Malagauche */ - r__robins, /* Friar Tuck. */ - 177, /* Robin Hood - can't meet him at the start. */ - r__brummieroad, /* Cwytalot */ - r__lustiesroom, /* Baron du Lustie. */ - r__outsidecardiffcastle, /* The Duke of Cardiff. */ - r__argentpub, /* Dogfood */ - r__outsideducks, /* Trader */ - r__argentpub, /* Ibythneth */ - r__aylesoffice, /* Ayles */ - r__nottspub, /* Port */ - r__nottspub, /* Spurge */ - r__musicroom, /* Jacques */ - 0, 0, 0, 0, 0, 0, 0, 0, - /* The Lasses */ - r__yours, /* Arkata */ - r__geidas, /* Geida */ - 177, /* nobody allocated here! */ - r__wisewomans - } -}; /* The Wise Woman. */ - -/* Art gallery at 2,1; notice about this at 2,2. */ - -const matrix<1, 8, 1, 8, longint> catamap = - /* Geida's room */ - /* 1 2 3 | 4 5 6 7 8*/ -{ { {{0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}}, - {{0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}}, - {{0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}}, - {{0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}}, /* >> Oubliette */ - {{0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}}, - {{0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}}, - {{0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}}, /* <<< In here */ - {{0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062}} - } -}; -/* vv Stairs trap. */ - -/* Explanation: $NSEW. - Nibble N: North. - 0 = no connection, - 2 = (left,) middle(, right) door with left-hand handle, - 5 = (left,) middle(, right) door with right-hand handle, - 7 = arch, - 8 = arch and 1 north of it, - 9 = arch and 2 north of it, - D = no connection + WINDOW, - E = no connection + TORCH, - F = recessed door (to Geida's room.) - - Nibble S: South. - 0 = no connection, - 1,2,3 = left, middle, right door. - - Nibble E: East. - 0 = no connection (wall), - 1 = no connection (wall + window), - 2 = wall with door, - 3 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. - - Nibble W: West. - 0 = no connection (wall), - 1 = no connection (wall + shield), - 2 = wall with door, - 3 = wall with door and shield, - 4 = no connection (window), - 5 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. */ - -const byte interrogation = 0; -/* If this is greater than zero, the next line you type is stored in - the DNA in a position dictated by the value. If a scroll comes up, - or you leave the room, it's automatically set to zero. */ - -const boolean demo = false; /* If this is true, we're in a demo of the game. */ - -const array<0, 2, char> spludwick_order = {{onion, ink, mushroom}}; - -const array<10, 25, quasiped_type> quasipeds = { - { {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ - {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ - {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ - {3, black, 23, red, '\261'}, /* D: Hawk (screen 23). */ - {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ - {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ - {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ - {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ - {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ - {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ - {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ - {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ - {3, white, 27, red, '\261'}, /* M: Avaroid (screen 27). */ - {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ - {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ - {2, lightgreen, 51, darkgray, pdrduck} - } -}; /*P: Duck (screen 51). */ - -const integer lower = 0; -const integer same = 1; -const integer higher = 2; - -const array<1, 12, char> keys = "QWERTYUIOP[]"; -const array<1, 12, word> notes = -{{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}}; - -const tunetype tune = { - { - higher, higher, lower, same, higher, higher, lower, higher, higher, higher, - lower, higher, higher, - same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, - lower, same, lower, higher, same, lower, higher - } -}; - -/* special run-time errors */ - -const integer runerr_getset_overflow = 50; - - -#ifdef __gyro_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN varying_string<77> current; -EXTERN byte curpos; -EXTERN boolean cursoron; -/* previous:^previoustype;*/ -EXTERN varying_string<77> last; -EXTERN dnatype dna; -EXTERN array<1, 50, linetype> lines; /* For Also. */ -EXTERN integer c; -EXTERN registers r; -EXTERN enum { m_no , m_yes , m_virtual } visible; -EXTERN boolean dropsok, screturn, soundfx, cheat; -EXTERN word mx, my; /* mouse x & y now */ -EXTERN word mpx, mpy; /* mouse x & y when pressed */ -EXTERN word mrx, mry; /* mouse x & y when released */ -EXTERN byte mpress, mrelease; /* times left mouse button has been pressed/released */ -EXTERN byte keystatus; /* Mouse key status */ -EXTERN array<1, 10, varying_string<20> > un; -EXTERN byte unn; -EXTERN string mousetext; -/* which:array[0..5] of byte;*/ -EXTERN pointer p; -EXTERN boolean weirdword; -EXTERN byte to_do; -EXTERN boolean lmo, mousemade; -EXTERN array<1, 15, varying_string<50> > scroll; -EXTERN byte scrolln, score, whichwas; -EXTERN char thinks; -EXTERN boolean thinkthing; - -/* pp:array[1..1000] of postype; - bb:array[1..9000] of byte;*/ -EXTERN word pptr, bptr; -EXTERN matrix<0, 0, 0, 1, integer> ppos; -EXTERN array<1, 24, word> pozzes; -EXTERN byte anim; -EXTERN pointer copier; -EXTERN integer talkx, talky; -EXTERN byte talkb, talkf; -EXTERN byte scrollbells; /* no. of times to ring the bell */ -EXTERN boolean ontoolbar, seescroll; - -EXTERN array<1, 10, char> objlist; -EXTERN array < '0', '9', pointer > digit; -EXTERN array<0, 8, pointer> rwlite; -EXTERN byte oldrw; -EXTERN varying_string<3> lastscore; -EXTERN byte cmp; /* current mouse-pointer */ -EXTERN varying_string<10> verbstr; /* what you can do with your object. :-) */ - -EXTERN matrix<0, 30, 0, 1, string *> also; -EXTERN array<1, 15, pedtype> peds; -EXTERN array<1, 15, magictype> magics; -EXTERN array<9, 15, magictype> portals; -EXTERN array<1, 30, fieldtype> fields; -EXTERN byte numfields; -EXTERN varying_string<26> flags; -EXTERN string listen; - -EXTERN word oh, onh, om, h, m, s, s1; - -EXTERN varying_string<4> atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ - -EXTERN byte cp, ledstatus, defaultled; -EXTERN raw little; -EXTERN boolean quote; /* 66 or 99 next? */ -EXTERN boolean alive; -EXTERN array<1, 2000, char> buffer; -EXTERN word bufsize; - -EXTERN byte oldjw; /* Old joystick-way */ -EXTERN controllers ctrl; - -EXTERN integer underscroll; /* Y-coord of just under the scroll text. */ - -/* TSkellern is only temporary, and I'll replace it - with a local version when it's all fixed up. */ - -/* tskellern:longint absolute $0:244; { Over int $61 }*/ - -EXTERN boolean ddmnow; /* Kludge so we don't have to keep referring to Dropdown */ -EXTERN varying_string<40> roomname; /* Name of this room */ - -EXTERN text logfile; -EXTERN boolean logging, log_epson; - -EXTERN boolean cl_override; - -EXTERN byte locks; /*ABSOLUTE $40:$17;*/ - -EXTERN varying_string<20> subject; /* What you're talking to them about. */ -EXTERN byte subjnumber; /* The same thing. */ - -EXTERN boolean keyboardclick; /* Is a keyboard click noise wanted? */ - -EXTERN char him, her, it; -EXTERN longint roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ - -EXTERN boolean after_the_scroll; - -/* For the demo: */ -EXTERN demo_type demo_rec; -EXTERN file demofile; - -EXTERN char last_person; /* Last person to have been selected using the People - menu. */ - -EXTERN boolean doing_sprite_run; /* Only set to True if we're doing a sprite_run - at this moment. This stops the trippancy system from moving any of the - sprites. */ - -EXTERN vmctype vmc; -EXTERN string filetoload; - -EXTERN boolean holdthedawn; /* If this is true, calling Dawn will do nothing. - It's used, for example, at the start, to stop Load from dawning. */ - -EXTERN word storage_seg, storage_ofs; /* Seg and ofs of the Storage area. */ -EXTERN word skellern; /* Offset of the timer variable - 1 more than storage_OFS */ -EXTERN boolean reloaded; /* Is this NOT the primary loading? */ - -EXTERN boolean super_was_virtual, super_was_off; /* Used by Super_Off and Super_On */ - -EXTERN pathstr enid_filename; - -EXTERN joysetup js; -EXTERN word cxmin, cxmax, cymin, cymax; -EXTERN boolean use_joy_a; -#undef EXTERN -#define EXTERN extern - - -void newpointer(byte m); - -void wait(); /* makes hourglass */ - -void on(); - -void off(); - -void on_virtual(); - -void off_virtual(); - -void xycheck(); - -void hopto(integer x, integer y); /* Moves mouse pointer to x,y */ - -void check(); - -void note(word hertz); - -void blip(); - -string strf(longint x); - -void shbox(integer x1, integer y1, integer x2, integer y2, string t); - -void newgame(); - -void click(); - -void slowdown(); - -boolean flagset(char x); - -void force_numlock(); - -boolean pennycheck(word howmuchby); - -string getname(char whose); - -char getnamechar(char whose); - -string get_thing(char which); - -char get_thingchar(char which); - -string get_better(char which); - -string f5_does(); - -void plot_vmc(integer xx, integer yy, byte page_); - -void wipe_vmc(byte page_); - -void setup_vmc(); - -void clear_vmc(); - -void load_a_mouse(byte which); - -void background(byte x); - -void hang_around_for_a_while(); - -void super_off(); - -void super_on(); - -boolean mouse_near_text(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp deleted file mode 100644 index 23ee06819a7e..000000000000 --- a/engines/avalanche/help.cpp +++ /dev/null @@ -1,301 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Rodent.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -typedef graphcursmasktype cursor; -const char vernum[] = "v100"; -const char copyright[] = "1992"; -const cursor questionmark = { - ((511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695), - (65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840)), - 0, - 0 -}; - -const array<1, 7, varying_string<12> > topics = { - { - "Front page", "Background", "Toolbar", "Menus", - "Keyboard", "Shareware", "Exit Help" - } -}; - -const array<1, 6, char> keys = "FBTMKS"; - -byte page_; -palettetype dp, dark; -char r; -boolean lmo; - -void hilight(integer x, integer y, byte c1, byte c2, string z) { - string w; - w = z; - w[1] = '\40'; - setcolor(c1); - outtextxy(x, y, w); - w = z; - fillchar(w[2], length(z) - 1, '\40'); - setcolor(c2); - outtextxy(x, y, w); - outtextxy(x - 1, y, w); -} - -void showpage(byte x) { - if (x == page_) return; /* twit */ - if (x == 7) { - lmo = true; - return; - } - setallpalette(dark); - hidemousecursor; - settextjustify(1, 1); - if (page_ != 177) { - setfillstyle(1, 1); - bar(507, page_ * 25 + 2, 607, page_ * 25 + 22); - setfillstyle(1, 9); - bar(500, page_ * 25, 600, page_ * 25 + 20); - /* setcolor(11); outtextxy(550,page*25+10,topics[page]);*/ - hilight(550, page_ * 25 + 10, 11, 14, topics[page_]); - } - page_ = x; - setfillstyle(1, 4); - bar(507, page_ * 25 + 2, 607, page_ * 25 + 22); - setfillstyle(1, 12); - bar(500, page_ * 25, 600, page_ * 25 + 20); - /* setcolor(14); outtextxy(550,page*25+10,topics[page]); */ - hilight(550, page_ * 25 + 10, 14, 15, topics[page_]); - setfillstyle(1, 7); - bar(0, 27, 470, 189); - settextjustify(0, 2); - setcolor(1); - switch (page_) { - case 1: { - ; /* Front page */ - setcolor(black); - outtextxy(10, 40, "Thorsoft of Letchworth presents"); - outtextxy(300, 80, vernum); - outtextxy(10, 90, string("(c) ") + copyright + ", Mike, Mark and Thomas Thurman."); - setcolor(red); - outtextxy(100, 129, "Finding your way around it..."); - setcolor(blue); - outtextxy(10, 120, "You are now using the Help System."); - outtextxy(10, 138, "Press the first letter of the topic that you want to"); - outtextxy(10, 147, "read (eg T for (T)oolbar), or click on its button (on"); - outtextxy(10, 156, "the right) using the mouse. Use \"Exit Help\" to quit."); - outtextxy(10, 174, "(Fastest exit- just hit Esc!)"); - } - break; - case 2: { - ; /* Background */ - setcolor(red); - outtextxy(300, 30, "Remember this chap?"); - setcolor(blue); - outtextxy(10, 55, "Back in good old A.D. 79, there lived a Roman"); - outtextxy(10, 64, "whose name was Denarius Avaricius Sextus, known"); - outtextxy(10, 73, "to his friends as Avvy. His wife was called Arkata,"); - outtextxy(10, 82, "and he had a slave named Crapulus. His grandson"); - outtextxy(10, 91, "joined the army, was posted to Gaul, and liked it"); - outtextxy(10, 100, "so much that he stayed there, telling everyone the"); - outtextxy(10, 109, "one about the centurion and the Turkish bath. His"); - outtextxy(10, 118, "thirty-sixth male-line descendant accidentally"); - outtextxy(10, 127, "poisoned an old enemy of William of Normandy, and"); - outtextxy(10, 136, "to his great surprise came so much into Bill's favour"); - outtextxy(10, 145, "that, after the Battle of Hastings a few years"); - outtextxy(10, 154, "later, he was made the lord of a small town in"); - outtextxy(10, 163, "Hertfordshire called Argent. It is his great-grandson"); - outtextxy(10, 172, "who stars in this game, back in good old A.D. 1189."); - } - break; - case 3: { - ; /* ? */ - outtextxy(15, 30, "The Toolbar is there so that (along with the menus)"); - outtextxy(15, 39, "you can perform a lot of the functions contained in"); - outtextxy(15, 48, "the game, using the mouse."); - setcolor(red); - outtextxy(15, 66, "COMPASS:"); - setcolor(blue); - outtextxy(90, 66, "Used to point Avvy in the right direction."); - setcolor(red); - outtextxy(15, 75, "THINKS:"); - setcolor(blue); - outtextxy(90, 75, "Shows the person/object you're thinking of."); - setcolor(red); - outtextxy(15, 84, "SCORE:"); - setcolor(blue); - outtextxy(90, 84, "Shows how many points you've got."); - setcolor(red); - outtextxy(15, 93, "SPEED:"); - setcolor(blue); - outtextxy(90, 93, "Adjusts the speed of the game."); - setcolor(red); - outtextxy(15, 102, "L.E.D.s:"); - setcolor(blue); - outtextxy(90, 102, "Shows whether sound is on (toggle with ),"); - outtextxy(90, 111, "the computer is ready, or there is an error."); - setcolor(red); - outtextxy(15, 120, "CLOCK:"); - setcolor(blue); - outtextxy(90, 120, "Shows the time."); - setcolor(red); - outtextxy(15, 129, "'OK' box:"); - setcolor(blue); - outtextxy(90, 129, "Works the same as pressing ."); - setcolor(0); - outtextxy(15, 147, "N.B. The game action is suspended while you are"); - outtextxy(15, 156, "using the toolbar."); - } - break; - case 4: { - ; /* menus */ - outtextxy(15, 60, "To use the drop-down menus, either click on the bar"); - outtextxy(15, 69, "at the top with the mouse, or press Alt and the first"); - outtextxy(15, 78, string("letter of the menu's name (eg alt-A = (A)ction.) The ") + '\3'); - outtextxy(15, 87, "menu is alt-H, for (H)eart."); - outtextxy(15, 105, "When you have a menu, either click on the option you"); - outtextxy(15, 114, "want, or press its initial letter (eg O for \"OS Shell\")."); - outtextxy(15, 132, "To do something to, or with, an object or person, first"); - outtextxy(15, 141, "select them (or it) from the People or Things menu. Then"); - outtextxy(15, 150, "select whatever you wanted to do from the Use menu."); - setcolor(red); - outtextxy(15, 177, "(OK, so it sounds complicated, but then it's intuitive!)"); - } - break; - case 5: { - ; /* Keyboard */ - outtextxy(15, 60, "The keyboard interface is even simpler than the mouse"); - outtextxy(15, 70, "interface! Just type what you want Avvy to do."); - outtextxy(15, 80, "For example, to open a door, type in:"); - setcolor(red); - outtextxy(100, 95, "open door"); - setcolor(blue); - outtextxy(15, 110, "And to look at Crapulus, type:"); - setcolor(red); - outtextxy(100, 125, "look at Crapulus"); - setcolor(blue); - outtextxy(15, 140, "(Don't forget to press Enter after each command!)"); - outtextxy(15, 160, "This is a traditional command-line parser interface,"); - outtextxy(15, 170, "similar to the one in \"Avaricius\", only more advanced."); - } - break; - case 6: { - ; /* ? */ - outtextxy(15, 30, "This game is Shareware. Most programs are sold through"); - outtextxy(15, 40, "shops, and the authors prevent you from copying them."); - outtextxy(15, 50, "Shareware is different. You may copy it and give it to"); - outtextxy(15, 60, "ANYBODY at all. You may post it on any BBS, give it to"); - outtextxy(15, 70, "friends, etc. If you like it, we ask you to pay us for"); - outtextxy(15, 80, "the software directly through the post. We're relying"); - outtextxy(15, 90, "on you to register!"); - outtextxy(99, 177, "{ ETC }"); - } - break; - } - setallpalette(dp); - showmousecursor; -} - -void helpsetup() { - integer gd, gm; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - settextstyle(1, 0, 0); - setcolor(11); - getpalette(dp); - dark.size = dp.size; - fillchar(dark.colors, dark.size, '\0'); - setallpalette(dark); - setusercharsize(3, 1, 8, 10); - for (gm = 1; gm <= 3; gm ++) outtextxy(gm, 0, "Avalot- HELP!"); - resetmouse; - setgraphicscursor(questionmark); - showmousecursor; - settextstyle(0, 0, 1); - settextjustify(1, 1); - for (gd = 2; gd <= 7; gd ++) { - setfillstyle(1, 1); - bar(507, gd * 25 + 2, 607, gd * 25 + 22); - setfillstyle(1, 9); - bar(500, gd * 25, 600, gd * 25 + 20); - /* setcolor(11); outtextxy(550,gd*25+10,topics[gd]); */ - hilight(550, gd * 25 + 10, 11, 14, topics[gd]); - } - showmousecursor; - page_ = 177; - showpage(1); - lmo = false; - setfillstyle(1, 7); - for (gd = 1; gd <= 3; gd ++) { - bar(10 - gd * 3, 200 - gd * 3, 490 - gd * 6, 200 - gd * 3); - bar(490 - gd * 6, 37 - gd * 3, 491 - gd * 6, 200 - gd * 3); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - helpsetup(); - do { - do { - getbuttonstatus; - } while (!((mkey == left) || keypressed())); - if (keypressed()) { - ; /* keyboard choice */ - r = upcase(readkey()); - if (pos(r, keys) > 0) showpage(pos(r, keys)); - else if (r == '\0') - switch (readkey()) { /* grab extd keystroke */ - case 'H': - if (page_ > 1) showpage(page_ - 1); - break; - case 'P': - if (page_ < 6) showpage(page_ + 1); - break; - case 'G': - case 'I': - showpage(1); - break; - case 'O': - case 'Q': - showpage(6); - break; - } - else if (set::of('\33', 'Q', 'X', 'E', 'H', eos).has(r)) lmo = true; /* quit */ - } else { - ; /* mouse choice */ - if ((mousex > 400) && (mousey > 25)) { - showpage(mousey / 25); - } - } - } while (!lmo); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/help2.cpp b/engines/avalanche/help2.cpp deleted file mode 100644 index 37e23ac335eb..000000000000 --- a/engines/avalanche/help2.cpp +++ /dev/null @@ -1,287 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -struct hypertype { - char trigger; - byte line; - byte start, finish; - word ref; -}; - -integer gd, gm; -array<1, 2, fonttype> font; -matrix<0, 7, 1, 80, byte> current; -array<1, 250, varying_string<79> > data; -integer fv, position, size; -varying_string<79> title; -array<1, 20, hypertype> link; -byte numlinks; -char r; -array<0, 9, byte> reverse; -array<0, 9, byte> revpos; - -void loadfont() { - file fontfile; - assign(fontfile, "c:\\thomas\\ttsmall.fnt"); - reset(fontfile); - fontfile >> font[1]; - close(fontfile); - /* assign(fontfile,'c:\avalot\avalot.fnt'); reset(fontfile); - read(fontfile,font[2]); close(fontfile);*/ - /* NB: We'll put BOTH of these fonts one after the other, in the same - file, in the final compilation. */ -} - -void scribe(byte which, byte what); - -static void underline(byte &x) { - x = x | 177; -} - -void scribe(byte which, byte what) { - byte fv, ff; - string x; - x = data[what]; - fillchar(current, sizeof(current), '\0'); - for (ff = 1; ff <= length(x); ff ++) - for (fv = 0; fv <= 7; fv ++) { - current[fv][ff] = font[which][x[ff]][fv]; - } - - for (fv = 1; fv <= numlinks; fv ++) { - hypertype &with = link[fv]; - if (with.line == what) - for (ff = with.start; ff <= with.finish; ff ++) - underline(current[7][ff]); - } - -} - -void display(word y) { - for (fv = 0; fv <= 7; fv ++) - move(current[fv], mem[0xa000 * (y + fv) * 80], 79); -} - -void update_link(char which, byte whence, byte whither) { - byte fv; - for (fv = 1; fv <= numlinks; fv ++) { - hypertype &with = link[fv]; - if (with.trigger == which) { - with.line = size; - with.start = whence; - with.finish = whither; - } - } -} - -void getlinks(string &x) { - byte p, q; - do { - p = pos("[", x); - if (p == 0) return; /* lousy, huh? */ - q = pos("]", x); - update_link(x[p + 1], p, q - 3); - Delete(x, q, 1); - Delete(x, p, 2); - } while (!false); -} - -void loaddata(byte which) { - text t; - string x; - integer e; - revpos[9] = position; - fillchar(data, sizeof(data), '\0'); - move(reverse[1], reverse[0], 9); - move(revpos[1], revpos[0], 9); - reverse[9] = which; - revpos[9] = 1; - - str(which, x); - assign(t, string('h') + x + ".raw"); - reset(t); - t >> title >> NL; - size = 0; - numlinks = 0; - while (! eof(t)) { - t >> x >> NL; - if (x[1] == ':') { - numlinks += 1; - { - hypertype &with = link[numlinks]; - with.trigger = x[2]; - Delete(x, 1, 3); - Delete(x, pos(" ", x), 255); - val(x, with.ref, e); - } - } else { - size += 1; - getlinks(x); - data[size] = x; - } - } - position = 1; - size -= 15; - close(t); -} - -void screen() { - setbkcolor(1); - setfillstyle(1, 1); - bar(0, 0, 640, 38); - setfillstyle(1, 14); - bar(0, 39, 640, 39); -} - -void showscreen() { - byte fv; - if (position < 1) position = 1; - for (fv = 0; fv <= 15; fv ++) { - scribe(1, fv + position); - display(41 + fv * 10); - } -} - -void up() { - byte fv; - position -= 1; - scribe(1, position); - for (fv = 0; fv <= 9; fv ++) { - move(mem[0xa000 * 3200], mem[0xa000 * 3280], 12720); - if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 3200], 79, '\0'); - else - move(current[8 - fv], mem[0xa000 * 3200], 80); - } -} - -void down() { - byte fv; - position += 1; - scribe(1, position + 15); - for (fv = 0; fv <= 9; fv ++) { - move(mem[0xa000 * 3280], mem[0xa000 * 3200], 12720); - if (set::of(0, 9, eos).has(fv)) fillchar(mem[0xa000 * 15920], 79, '\0'); - else - move(current[fv - 1], mem[0xa000 * 15920], 80); - } -} - -void newpage(char c) { - byte fv; - for (fv = 1; fv <= numlinks; fv ++) { - hypertype &with = link[fv]; - if (with.trigger == c) { - loaddata(with.ref); - showscreen(); - } - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - loadfont(); - screen(); - loaddata(0); - showscreen(); - fillchar(reverse, sizeof(reverse), '\0'); - fillchar(revpos, sizeof(revpos), '\1'); - do { - r = upcase(readkey()); - switch (r) { - case '\0': - switch (readkey()) { - case 'H': - if (position > 1) up(); - break; - case 'P': - if (position < size) down(); - break; - case 'I': { - position -= 16; - showscreen(); - } - break; - case 'Q': { - position += 16; - showscreen(); - } - break; - case 'G': { - position = 1; - showscreen(); - } - break; - case 'O': { - position = size; - showscreen(); - } - break; - } - break; - case 'B': { - ; /* go Back */ - gd = reverse[8]; - gm = revpos[8]; - move(reverse[0], reverse[2], 8); - move(revpos[0], revpos[2], 8); - loaddata(gd); - position = gm; - showscreen(); - } - break; - case 'C': { - ; /* Contents */ - loaddata(0); - showscreen(); - } - break; - case 'H': { - loaddata(7); /* help on help */ - showscreen(); - } - break; - case '\33': - exit(0); - break; - default: - newpage(r); - } - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.cpp b/engines/avalanche/helpbak.cpp deleted file mode 100644 index 3e60289a3308..000000000000 --- a/engines/avalanche/helpbak.cpp +++ /dev/null @@ -1,219 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - HELPER The help system unit. */ - -#define __helper_implementation__ - - -#include "helpbak.h" - - -/*#include "Crt.h"*/ -/*#include "Lucerna.h"*/ - -namespace Avalanche { - -struct buttontype { - char trigger; - byte whither; -}; - -const integer buttonsize = 930; - -const integer toolbar = 0; -const integer nim = 1; -const integer kbd = 2; -const integer credits = 3; -const integer joystick = 4; -const integer troubleshooting = 5; -const integer story = 6; -const integer mainscreen = 7; -const integer registering = 8; -const integer sound = 9; -const integer mouse = 10; -const integer filer = 11; -const integer back2game = 12; -const integer helponhelp = 13; -const integer pgdn = 14; -const integer pgup = 15; - -array<1, 10, buttontype> buttons; - -void plot_button(integer y, byte which) { - untyped_file f; - pointer p; - - getmem(p, buttonsize); - assign(f, "buttons.avd"); - reset(f, 1); - seek(f, which * buttonsize); - blockread(f, p, buttonsize); - putimage(470, y, p, 0); - close(f); - freemem(p, buttonsize); -} - -void getme(byte which); - - -static void chalk(byte y, string z) { - outtextxy(16, 41 + y * 10, z); -} - -void getme(byte which) { /* Help icons are 80x20 */ - string x; - text t; - byte y, fv; - - - str(which, x); - assign(t, string('h') + x + ".raw"); - y = 0; - reset(t); - - t >> x >> NL; - setfillstyle(1, 1); - bar(0, 0, 640, 200); - setfillstyle(1, 15); - bar(8, 40, 450, 200); - settextjustify(1, 1); - setcolor(14); - outtextxy(320, 15, x); - settextjustify(0, 2); - setcolor(3); - settextstyle(0, 0, 2); - outtextxy(550, 0, "help!"); - /***/ setcolor(0); - settextstyle(0, 0, 1); - - do { - t >> x >> NL; - if (x == '!') flush(); /* End of the help text is signalled with a !. */ - chalk(y, x); - y += 1; - } while (!false); - - /* We are now at the end of the text. Next we must read the icons. */ - - y = 0; - settextjustify(1, 1); - setcolor(3); - while (! eof(t)) { - y += 1; - t >> x >> NL; /* Get the name of this button, and... */ - if (x != '-') { /* (hyphen signals an empty button.) */ - t >> buttons[y].trigger >> NL; - t >> fv >> NL; - plot_button(13 + y * 27, fv); - t >> buttons[y].whither >> NL; /* this is the position to jump to */ - - switch (buttons[y].trigger) { - case '' : - outtextxy(580, 25 + y * 27, "Esc"); - break; - case '' : - outtextxy(580, 25 + y * 27, "\30"); - break; - case '' : - outtextxy(580, 25 + y * 27, "\31"); - break; - default: - outtextxy(580, 25 + y * 27, buttons[y].trigger); - } - - } else buttons[y].trigger = '\0'; - } - - settextjustify(0, 2); - close(t); -} - -void continue_help() { - char r; - byte fv; - - do { - r = upcase(readkey()); - switch (r) { - case '\33' : - return; - break; - case '\0' : - switch (readkey()) { - case '\110': - case '\111': - r = ''; - break; - case '\120': - case '\121': - r = ''; - break; - case '\73': - r = 'H'; - break; /* Help on help */ - } - break; - } - - for (fv = 1; fv <= 10; fv ++) { - buttontype &with = buttons[fv]; - if (with.trigger == r) { - dusk; - getme(with.whither); - dawn; - flush(); - } - } - - } while (!false); -} - -void boot_help() { - setactivepage(2); - - getme(0); - - dusk; - setvisualpage(2); - dawn; - - continue_help(); - - dusk; - setvisualpage(cp); - draw_also_lines; - setactivepage(1 - cp); - dawn; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helpbak.h b/engines/avalanche/helpbak.h deleted file mode 100644 index e2efd967e133..000000000000 --- a/engines/avalanche/helpbak.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __helpbak_h__ -#define __helpbak_h__ - - -#include "graph.h" -/*#include "Gyro.h"*/ - -namespace Avalanche { - -void boot_help(); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/helper.cpp b/engines/avalanche/helper.cpp deleted file mode 100644 index 622244e13377..000000000000 --- a/engines/avalanche/helper.cpp +++ /dev/null @@ -1,354 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - HELPER The help system unit. */ - -#define __helper_implementation__ - - -#include "helper.h" - - -/*#include "Crt.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Pingo.h"*/ - -namespace Avalanche { - -struct buttontype { - char trigger; - byte whither; -}; - -const integer buttonsize = 930; - -const integer toolbar = 0; -const integer nim = 1; -const integer kbd = 2; -const integer credits = 3; -const integer joystick = 4; -const integer troubleshooting = 5; -const integer story = 6; -const integer mainscreen = 7; -const integer registering = 8; -const integer sound = 9; -const integer mouse = 10; -const integer filer = 11; -const integer back2game = 12; -const integer helponhelp = 13; -const integer pgdn = 14; -const integer pgup = 15; - -array<1, 10, buttontype> buttons; -byte highlight_was; - -void plot_button(integer y, byte which) { - untyped_file f; - pointer p; - - if (y > 200) { - background(2); /* Silly buttons. */ - delay(10); - background(0); - return; - } - getmem(p, buttonsize); - assign(f, "buttons.avd"); - reset(f, 1); - seek(f, which * buttonsize); - blockread(f, p, buttonsize); - - if (y == -177) - putimage(229, 5, p, 0); - else - putimage(470, y, p, 0); - close(f); - freemem(p, buttonsize); -} - -void getme(byte which); - -static untyped_file f; - - -static void chalk(byte y, string z) { - outtextxy(16, 41 + y * 10, z); -} - - - -static void getline(string &x) { - byte fz; - - blockread(f, x[0], 1); - blockread(f, x[1], (byte)(x[0])); - for (fz = 1; fz <= length(x); fz ++) - x[fz] = chr(ord(x[fz]) ^ 177); -} - -void getme(byte which) { /* Help icons are 80x20 */ - string x; - byte y, fv; - word offset; - - - off; - assign(f, "help.avd"); - y = 0; - highlight_was = 177; /* Forget where the highlight was. */ - reset(f, 1); - seek(f, which * 2); - blockread(f, offset, 2); - seek(f, offset); - - getline(x); - setfillstyle(1, 1); - bar(0, 0, 640, 200); - setfillstyle(1, 15); - bar(8, 40, 450, 200); - settextjustify(2, 2); - blockread(f, fv, 1); - plot_button(-177, fv); - - setcolor(0); - outtextxy(629, 26, x); /* Plot the title. */ - setcolor(3); - outtextxy(630, 25, x); - - settextjustify(0, 2); - settextstyle(0, 0, 2); - setcolor(0); - outtextxy(549, 1, "help!"); - setcolor(3); - outtextxy(550, 0, "help!"); - /***/ settextstyle(0, 0, 1); - - do { - getline(x); - if (x == '!') flush(); /* End of the help text is signalled with a !. */ - if (x[1] == '\\') { - setcolor(4); - chalk(y, copy(x, 2, 255)); - } else { - setcolor(0); - chalk(y, x); - } - y += 1; - } while (!false); - - /* We are now at the end of the text. Next we must read the icons. */ - - y = 0; - settextjustify(1, 1); - settextstyle(0, 0, 2); - while (! eof(f)) { - y += 1; - blockread(f, buttons[y].trigger, 1); - if (buttons[y].trigger == '\261') flush(); - blockread(f, fv, 1); - if (buttons[y].trigger != '\0') plot_button(13 + y * 27, fv); - blockread(f, buttons[y].whither, 1); /* this is the position to jump to */ - - - switch (buttons[y].trigger) { - case '' : - x = "Esc"; - break; - case '' : - x = '\30'; - break; - case '' : - x = '\31'; - break; - default: - x = buttons[y].trigger; - } - setcolor(0); - outtextxy(589, 26 + y * 27, x); - setcolor(3); - outtextxy(590, 25 + y * 27, x); - - } - - settextjustify(0, 2); - settextstyle(0, 0, 1); - close(f); - on; -} - - -byte check_mouse(); -/* Returns clicked-on button, or 0 if none. */ -static void light(byte which, byte colour) { - if (which == 177) return; /* Dummy value for "no button at all". */ - setcolor(colour); - which = which & 31; - rectangle(466, 11 + which * 27, 555, 35 + which * 27); -} - -byte check_mouse() { - byte h_is; - - byte check_mouse_result; - check; - - if (mrelease != 0) { - /* Clicked *somewhere*... */ - if ((mx < 470) || (mx > 550) || (((my - 13) % 27) > 20)) - check_mouse_result = 0; - else - /* Clicked on a button. */ - check_mouse_result = ((my - 13) / 27); - } else { - if ((mx > 470) && (mx <= 550) && (((my - 13) % 27) <= 20)) { - /* No click, so highlight. */ - h_is = (my - 13) / 27; - if ((h_is < 1) || (h_is > 6)) h_is = 177; /* In case of silly values. */ - } else h_is = 177; - - if ((h_is != 177) && ((keystatus & 1) > 0)) h_is += 32; - - if (h_is != highlight_was) { - off; - light(highlight_was, 1); - highlight_was = h_is; - if (buttons[h_is & 31].trigger != '\0') { - if (h_is > 31) light(h_is, 11); - else light(h_is, 9); - } - on; - } - - check_mouse_result = 0; - } - return check_mouse_result; -} - -void continue_help() { - char r; - byte fv; - - do { - while (! keypressed()) { - fv = check_mouse(); - - if (fv > 0) - switch (buttons[fv].trigger) { - case '\0':/*null*/ - break; - case '\376': - return; - break; - default: { - dusk; - getme(buttons[fv].whither); - dawn; - continue_; - } - } - - } - r = upcase(readkey()); - switch (r) { - case '\33' : - return; - break; - case '\0' : - switch (readkey()) { - case '\110': - case '\111': - r = ''; - break; - case '\120': - case '\121': - r = ''; - break; - case '\73': - r = 'H'; - break; /* Help on help */ - default: - continue_; - } - break; - } - - for (fv = 1; fv <= 10; fv ++) { - buttontype &with = buttons[fv]; - if (with.trigger == r) { - dusk; - getme(with.whither); - dawn; - flush(); - } - } - - } while (!false); -} - -void boot_help() { - byte groi; - - dusk; - off; - oncandopageswap = false; - highlight_was = 177; - copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); - - /* Set up mouse. */ - off_virtual; - newpointer(2); - setactivepage(3); - setvisualpage(3); - - getme(0); - dawn; - - newpointer(9); - on; - mousepage(3); - - continue_help(); - - mousepage(cp); - dusk; - off; - oncandopageswap = true; - copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); - on_virtual; - dawn; - fix_flashers; - - setvisualpage(cp); - setactivepage(1 - cp); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/helper.h b/engines/avalanche/helper.h deleted file mode 100644 index 0c4d2c786016..000000000000 --- a/engines/avalanche/helper.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __helper_h__ -#define __helper_h__ - -namespace Avalanche { - -#include "graph.h" -/*#include "Gyro.h"*/ - - -void boot_help(); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/hibits.cpp b/engines/avalanche/hibits.cpp deleted file mode 100644 index 638f25d757ef..000000000000 --- a/engines/avalanche/hibits.cpp +++ /dev/null @@ -1,55 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -file inf, outf; -char x; -string q; -byte fv; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(inf, "v:thank.you"); - assign(outf, "d:hibits.out"); - reset(inf); - rewrite(outf); - - q = string('\40') + "(Seven is a bit of a lucky number.)" + '\40' + '\215' + '\212' + '\212'; - - for (fv = 1; fv <= length(q); fv ++) outf << q[fv]; - - while (! eof(inf)) { - inf >> x; - if (x < '\200') x += 128; - outf << x; - } - close(inf); - close(outf); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.cpp b/engines/avalanche/highs.cpp deleted file mode 100644 index bd8a5c3ce43d..000000000000 --- a/engines/avalanche/highs.cpp +++ /dev/null @@ -1,141 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - HIGHS This handles the high-scores. */ - -#define __highs_implementation__ - - -#include "highs.h" - - -/*#include "Gyro.h"*/ -/*#include "Scrolls.h"*/ - -namespace Avalanche { - -typedef array < 1, 12, struct A1 { - varying_string<30> name; - word score; - varying_string<12> rank; -} > highscoretype; - -highscoretype h; - -void get_new_highs() { - byte fv; - for (fv = 1; fv <= 12; fv ++) { - A1 &with = h[fv]; - with.score = 32 - fv * 2; - with.rank = "..."; - } - h[1].name = "Mike"; - h[2].name = "Liz"; - h[3].name = "Thomas"; - h[4].name = "Mark"; - h[5].name = "Mandy"; - h[6].name = "Andrew"; - h[7].name = "Lucy Tryphena"; - h[8].name = "Tammy the dog"; - h[9].name = "Avaricius"; - h[10].name = "Spellchick"; - h[11].name = "Caddelli"; - h[12].name = "Spludwick"; -} - -void show_highs() -/* This procedure shows the high-scores. */ -{ - byte fv; - varying_string<40> x; - varying_string<5> y; - display("HIGH SCORERS\3\r Name\n\nScore Rank\r \"\"\"\"\n\n\"\"\"\"\" \"\"\"\"\f\4"); - for (fv = 1; fv <= 12; fv ++) { - A1 &with = h[fv]; - display(string('\15') + with.name + '\4'); - fillchar(x, sizeof(x), '\40'); - y = strf(with.score); - x[0] = chr(29 - (length(with.name + y))); - display(x + y + ' ' + with.rank + '\4'); - } - - display(""); -} - -void store_high(string who) -/* This procedure shows the high-scores. */ -{ - byte fv, ff; - - for (fv = 1; fv <= 12; fv ++) - if (h[fv].score < dna.score) flush(); - - /* Shift all the lower scores down a space. */ - for (ff = fv; ff <= 11; ff ++) - h[ff + 1] = h[ff]; - - { - A1 &with = h[fv]; - with.name = who; - with.score = dna.score; - } - -} - -void get_highs() { - file f; - /*$I-*/ - assign(f, "scores.avd"); - reset(f); - /* Did we get it? */ - - if (ioresult != 0) { - ; /* No. */ - get_new_highs(); /* Invent one. */ - } else { - ; /* Yes. */ - f >> h; - close(f); - } -} - -class unit_highs_initialize { -public: - unit_highs_initialize(); -}; -static unit_highs_initialize highs_constructor; - -unit_highs_initialize::unit_highs_initialize() { - get_highs(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/highs.h b/engines/avalanche/highs.h deleted file mode 100644 index 2d9061cd9969..000000000000 --- a/engines/avalanche/highs.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __highs_h__ -#define __highs_h__ - -namespace Avalanche { - -void show_highs(); - -void store_high(string who); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/hiz.cpp b/engines/avalanche/hiz.cpp deleted file mode 100644 index af924a0600c0..000000000000 --- a/engines/avalanche/hiz.cpp +++ /dev/null @@ -1,348 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M 6000,600,600*/ -/*$V-,I-,R-,F+*/ /* Do not change these directives. */ -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Dos.h"*/ -/*#include "Tsru.h"*/ - -namespace Avalanche { - -/* program's signature */ -const varying_string<20> tsr_tmark = "FISH FISH FISH!!!"; - -integer gd, gm; -byte a /*absolute $A000:0*/; -matrix<1, 800, 0, 3, byte> sv; -byte bit; -string nam; -byte tsr_int; -word tsr_ax; - -void grab() { - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(a, sv[1][bit], 800); - } -} - -void drop() { - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(sv[1][bit], a, 800); - } -} - -void say(string x) { - grab(); - output << string('\15') + x; -} - -void pak(string x) { - char r; - say(x + " (press any key...)"); - r = readkey(); - drop(); -} - -string typein() { - char r; - string x; - string typein_result; - x = ""; - do { - r = readkey(); - switch (r) { - case '\10': - if (x[0] > '\0') { - output << string('\10') + '\40' + '\10'; - x[0] -= 1; - } - break; - case '\15': { - typein_result = x; - return typein_result; - } - break; - case '\33': { - typein_result = ""; - return typein_result; - } - break; - default: - if (x[0] < '\62') { - x = x + r; - output << r; - } - } - } while (!false); - return typein_result; -} - -void load() { - byte a /*absolute $A000:1200*/; - untyped_file f; - say("LOAD: filename?"); - nam = typein(); - drop(); - if (nam == "") return; - assign(f, nam); - reset(f, 1); - if (ioresult != 0) { - pak("LOAD: file not found."); - return; - } - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 12080); - if (ioresult != 0) { - pak("LOAD: error whilst loading."); - close(f); - return; - } - } - close(f); -} - -void save() { - const string header = - string("This is a file from an Avvy game, and its contents are subject to ") + - "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; - untyped_file f; - varying_string<30> screenname; - searchrec s; - char r; - byte a /*absolute $A000:1200*/; - say("SAVE: filename?"); - nam = typein(); - drop(); - if (nam == "") return; - findfirst(nam, anyfile, s); - if (doserror == 0) { - say("SAVE: That exists, are you sure\? (Y/N)"); - do { - r = upcase(readkey()); - } while (!(set::of('Y', 'N', eos).has(r))); - drop(); - if (r == 'N') return; - } - screenname = "Saved with HIZ."; - assign(f, nam); - rewrite(f, 1); - blockwrite(f, header[1], 146); - blockwrite(f, screenname, 31); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, a, 12080); - if (ioresult != 0) { - pak("SAVE: error whilst saving."); - close(f); - return; - } - } -} - -void hedges() { - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - fillchar(mem[0xa000 * 14 * 80], 80, '\377'); - fillchar(mem[0xa000 * 166 * 80], 80, '\377'); - } -} - -void reset_() { - registers regs; - regs.ax = 14; - intr(0x10, regs); - directvideo = false; -} - -void do_pop() { - char r; - do { - say("HIZ: Load Save Hedges Reset eXit?"); - r = upcase(readkey()); - drop(); - switch (r) { - case 'L': - load(); - break; - case 'S': - save(); - break; - case 'H': - hedges(); - break; - case 'R': - reset_(); - break; - case 'X': - return; - break; - } - } while (!false); -} - -/* Now for the TSR stuff */ - -void mypoprtn() { - registers r; - beginpop; - do_pop(); - endpop; -} -/**********************/ -void stop_tsr() { - if (tsrexit) - output << "HIZ stopped" << NL; - else - output << "Unable to stop HIZ - other TSR has been installed." << NL; -} -/**********************/ -/* This interrupt is called at program start-up. Its purpose is to provide - a way to communicate with an installed copy of the TSR through cmdline - params. The installation of the intrpt serves to prevent any attempt to - install a 2nd copy of the TSR */ -void tsr_intrtn(word flags, word cs, word ip, word ax, word bx, word cx, word dx, word si, word di, word ds, word es, word bp) -/*interrupt;*/ -{ - tsr_ax = ax; - cli; - beginint; - sti; - - switch (tsr_ax) { - case 1: { - stop_tsr(); /* Terminate TSR, if poss.*/ - } - break; - case 2: { - tsroff = true; /* Suspend TSR */ - output << "HIZ suspended." << NL; - } - break; - case 3: { - tsroff = false; - output << "HIZ restarted" << NL; - } - break; - } - cli; - endint; - sti; -} -/*******************/ -byte i; -registers r; -string st; -boolean b; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - - /********************************************/ - /* Check to see if TSR is already installed */ - /********************************************/ - - tsr_int = dupcheck(tsr_tmark, &tsr_intrtn); - - /*****************************************/ - /* If it IS already installed, check for */ - /* parameter. */ - /*****************************************/ - - if (tsr_int > 0) { - if (paramcount > 0) { - st = paramstr(1); - for (i = 1; i <= length(st); i ++) - st[i] = upcase(st[i]); - if (st == "STOP") - r.ax = 1; - else if (st == "HOLD") r.ax = 2; - else if (st == "RSTR") r.ax = 3; - else r.ax = 4; - - if (r.ax < 4) { - intr(tsr_int, r); - return 0; - } else { - output << "HIZ: invalid parameter " << paramstr(1) << NL; - output << "Syntax: HIZ stop/hold/rstr" << NL; - return 0; - } - } else { - output << "HIZ already installed." << NL; - output << "(If you're sure it isn't, try running BLANKINT /I." << NL; - output << "It's in the TURBO directory.)" << NL; - } - return 0; - } - - output << string("Wait...") + '\15'; /* tell 'em to wait...! */ - - /* Call PopSetUp to point to PopUp routine. Include the - scancode and the keymask to activate the program. In - this example, the scancode is $23 (H) and the - keymask is 08h (Alt.) */ - - popsetup(&mypoprtn, 0x23, 0x8); - - directvideo = false; - output << " v1.0, (c) 1992, Thomas Thurman." << NL; - output << " " << NL; - output << " The AVD saving/loading/hedging program." << NL; - output << " Use with Dr. Genius. The Hot Key is Ctrl-Alt-H." << NL; - - output << NL; - output << " Enter \"HIZ stop\" to remove Hiz from memory" << NL; - output << " \"HIZ hold\" to temporarily halt Hiz" << NL; - output << " \"HIZ rstr\" to restart Hiz" << NL; - stacksw = -1; - install_int; - keep(0); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/incline.cpp b/engines/avalanche/incline.cpp deleted file mode 100644 index 2c47cee29991..000000000000 --- a/engines/avalanche/incline.cpp +++ /dev/null @@ -1,205 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - INCLINE The command-line parser. */ - -#define __incline_implementation__ - - -#include "incline.h" - -#include "gyro.h" -#include "logger.h" - -namespace Avalanche { - -byte fv; -char t; -string bugline; -boolean zoomy, numlockhold; - -boolean filename_specified; - -void syntax() { - assign(output, ""); - rewrite(output); - output << NL; - output << string("Lord Avalot d'Argent\n\n(c) ") + copyright + " Mark, Mike and Thomas Thurman." << NL; - output << string("~~~~~~~~~~~~~~~~~~~~~\n\n") + vernum << NL; - output << NL; - output << "Syntax:" << NL; - output << "\n/?\ndisplays this screen," << NL; - output << "\n/O\noverrides EGA check," << NL; - output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; - output << "\n/P\nlogs with Epson codes to , default PRN," << NL; - output << "\n/Q\ncancels sound effects," << NL; - output << "\n/Z\ngoes straight into the game." << NL; - output << NL; - output << "\n\n\n\n\n\n\n... Have fun!" << NL; - exit(177); -} - -void not_through_bootstrap() { - output << "Avalot must be loaded through the bootstrap." << NL; - exit(0); -} - -void get_storage_addr() { - integer e; - - val(paramstr(2), storage_seg, e); - if (e != 0) not_through_bootstrap(); - val(paramstr(3), storage_ofs, e); - if (e != 0) not_through_bootstrap(); - skellern = storage_ofs + 1; -} - -longint value(string x) { - longint q; - integer e; - - longint value_result; - val(x, q, e); - value_result = q; - return value_result; -} - -void undo_js() { - { - joysetup &with = js; - - cxmin = with.xmid - (((with.xmid - with.xmin) / 10) * with.centre); - cxmax = with.xmid + (((with.xmax - with.xmid) / 10) * with.centre); - cymin = with.ymid - (((with.ymid - with.ymin) / 10) * with.centre); - cymax = with.ymid + (((with.ymax - with.ymid) / 10) * with.centre); - - /* writeln(lst,'MID ',xmid,'x',ymid); - writeln(lst,'MAX ',xmax,'x',ymax); - writeln(lst,'MIN ',xmin,'x',ymin); - writeln(lst,'CENTRE ',xmid); - writeln(lst,cxmin); - writeln(lst,cxmax); - writeln(lst,cymin); - writeln(lst,cymax);*/ - } -} - -void check_slope_line(); -static string slope; - -static boolean yn1(byte where) { - boolean yn1_result; - yn1_result = slope[where] == 'y'; - return yn1_result; -} - -void check_slope_line() { - slope = paramstr(4); - - /* if slope='' then fillchar(slope,sizeof(slope),'n');*/ - - if (slope[1] != '1') not_through_bootstrap(); - - if (yn1(2)) syntax(); - - soundfx = yn1(3); - cl_override = yn1(4); - keyboardclick = yn1(5); /* 6 - see below */ - demo = yn1(7); - zoomy = yn1(8); - numlockhold = yn1(9); - use_joy_a = yn1(10); - - { - joysetup &with = js; - - with.xmid = value(paramstr(5)); - with.ymid = value(paramstr(6)); - with.xmin = value(paramstr(7)); - with.ymin = value(paramstr(8)); - with.xmax = value(paramstr(9)); - with.ymax = value(paramstr(10)); - with.centre = value(paramstr(11)); - - undo_js(); - } - - switch (slope[6]) { - case 'l': - log_setup(paramstr(12), false); - break; - case 'p': - log_setup(paramstr(12), true); - break; - } -} - -void get_extra_data() { - if (! reloaded) return; - - move(mem[storage_seg * storage_ofs + 300], js, sizeof(js)); - - undo_js(); -} - -class unit_incline_initialize { -public: - unit_incline_initialize(); -}; -static unit_incline_initialize incline_constructor; - -unit_incline_initialize::unit_incline_initialize() { - /* writeln('Load code: ',paramstr(1)); - writeln('Seg & ofs: ',paramstr(2),':',paramstr(3)); - writeln('Slope line: ',paramstr(4)); - writeln('Log file: ',paramstr(5)); - writeln('File to load: ',paramstr(6)); - readln;*/ - - filetoload = paramstr(13); - filename_specified = filetoload != ""; - - logging = false; - - if ((paramcount < 3) || - ((paramstr(1) != "Go") && (paramstr(1) != "et"))) not_through_bootstrap(); - - reloaded = paramstr(1) == "et"; - - get_storage_addr(); - - get_extra_data(); - - check_slope_line(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/incline.h b/engines/avalanche/incline.h deleted file mode 100644 index 736dd199d84e..000000000000 --- a/engines/avalanche/incline.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __incline_h__ -#define __incline_h__ - - - -/* This unit has NO externally-callable procedures. Also note that - it MUST be called *first* (so if you load AVALOT.PAS and press f7 - twice you get to the "begin" statement.) */ - -#endif diff --git a/engines/avalanche/initxf.cpp b/engines/avalanche/initxf.cpp deleted file mode 100644 index ba91e79874f6..000000000000 --- a/engines/avalanche/initxf.cpp +++ /dev/null @@ -1,61 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -struct inirex { - varying_string<12> a; - word num; -}; - -text i; -file o; -inirex x; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(i, "v:init0.dat"); - reset(i); - assign(o, "v:init.avd"); - rewrite(o); - - while (! eof(i)) { - i >> x.a >> NL; - i >> x.num >> NL; - o << x; - output << '.'; - } - - close(i); - close(o); - output << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/inputtes.cpp b/engines/avalanche/inputtes.cpp deleted file mode 100644 index c1fbc214a6e2..000000000000 --- a/engines/avalanche/inputtes.cpp +++ /dev/null @@ -1,74 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -integer gd, gm; -fonttype font; -varying_string<79> current; -char r; - -void plottext() { - byte x, y; - for (y = 0; y <= 7; y ++) { - for (x = 1; x <= length(current); x ++) - mem[0xa000 * 12880 + y * 80 + x] = font[current[x]][y]; - fillchar(mem[0xa000 * 12881 + y * 80 + x], 79 - x, '\0'); - } -} - -void loadfont() { - file f; - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\turbo"); - loadfont(); - setfillstyle(1, 6); - bar(0, 0, 640, 200); - current = ""; - do { - r = readkey(); - current = current + r; - plottext(); - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/intro.cpp b/engines/avalanche/intro.cpp deleted file mode 100644 index b2583acde947..000000000000 --- a/engines/avalanche/intro.cpp +++ /dev/null @@ -1,641 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$I c:\sleep5\DSMI.INC*/ -/*#include "Dos.h"*/ -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -/* This is a stand-alone program. */ - -/* 0, black, remains 0. - Other numbers: the bits take precedence from the left. - e.g. for 9 = 1001, => fourth bit. - - First 1 is in: - - Fourth bit: 63 (egaWhite) - Third bit: 57 (egaLightBlue) - Second bit: 7 (light grey) - First bit: 1 (blue). */ - -const palettetype our_palette = { - 16, - /* sic */ - {{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}} -}; - -const integer scardcount = 13; - -const array < 0, scardcount - 1, integer > soundcards = -{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; - -typedef matrix < '\0', '\377', 1, 16, byte > fonttype; - -fonttype f; -matrix<0, 39, 1, 16, byte> next_line; - -byte next_bitline; - -byte displaycounter; - -boolean cut_out; - -word cut_out_time; - -array<1, 117, varying_string<40> > x; - -byte this_line; - -word *skellern; -boolean nomusic; - -/*$L intro.obj*/ -extern void introduction(); - -void graphmode(integer mode) { - registers regs; - - regs.ax = mode; - intr(0x10, regs); -} - -/* Firstly, port[$3C4]:=2; port[$3CF]:=4;, - Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ - -void loadfont() { - file ff; - - assign(ff, "avalot.fnt"); - reset(ff); - ff >> f; - close(ff); -} - -void calc_next_line() -/* This proc sets up next_line. */ -{ - string l; - byte fv, ff; - boolean oddlen; - byte start; - byte this_; - - fillchar(next_line, sizeof(next_line), '\0'); /* All blanks. */ - - if (this_line == 117) { - cut_out = true; - return; - } - - l = x[this_line]; - this_line += 1; - - start = (20 - length(l) / 2) - 1; - oddlen = odd(length(l)); - - for (fv = 1; fv <= length(l); fv ++) - for (ff = 1; ff <= 16; ff ++) { - this_ = f[l[fv]][ff]; - if (oddlen) { - /* Odd, => 4 bits shift to the right. */ - next_line[start + fv][ff] += this_ << 4; - next_line[start + fv - 1][ff] += (cardinal)this_ >> 4; - } else { - /* Even, => no bit shift. */ - next_line[start + fv][ff] = this_; - } - } - next_bitline = 1; -} - -void display() { - byte fv, ff; - - - if (next_bitline == 17) calc_next_line(); - - if (cut_out) { - if (nomusic) - cut_out_time -= 1; - else if (ampgetmodulestatus != md_playing) cut_out_time = 0; - return; - } - - move(mem[0xa000 * 40], mem[0xa000 * 0], 7960); - for (fv = 0; fv <= 39; fv ++) - mem[0xa1f1 * 8 + fv] = next_line[fv][next_bitline]; - next_bitline += 1; - -} - -void plot_a_star(integer x, integer y) { - byte ofs; - - ofs = x % 8; - x = x / 8; - mem[0xa000 * x + y * 40] += (cardinal)128 >> ofs; -} - -void plot_some_stars(integer y) { - byte fv, times; - - switch (Random(7)) { - case 1: - times = 1; - break; - case 2: - times = 2; - break; - case 3: - times = 3; - break; - default: - return; - } - - for (fv = 1; fv <= times; fv ++) - plot_a_star(Random(320), y); -} - -void starry_starry_night() { - integer y; - byte bit; - - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - for (bit = 0; bit <= 2; bit ++) { - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (y = 1; y <= 200; y ++) - plot_some_stars(y); - } -} - -void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the - Graph unit. */ -{ - integer gd, gm; - - gd = 3; - gm = 1; - initgraph(gd, gm, ""); -} - -void shovestars() { - move(mem[0xa000 * 0], mem[0xa000 * 40], 7960); - fillchar(mem[0xa000 * 0], 40, '\0'); - plot_some_stars(0); -} - -void do_next_line() { - byte bit; - - port[0x3c4] = 2; - port[0x3ce] = 4; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - switch (bit) { - case 0: - if ((displaycounter % 10) == 0) shovestars(); - break; - case 1: - if ((displaycounter % 2) == 0) shovestars(); - break; - case 2: - shovestars(); - break; - case 3: - display(); - break; /* The text. */ - } - } - - if (displaycounter == 40) displaycounter = 0; - -} - -void load_text() { - word fv; - char *c; - byte thisline; - - - c = addr(introduction()); - thisline = 0; - fillchar(x, sizeof(x), '\0'); - - for (fv = 1; fv <= 2456; fv ++) { - switch (*c) { - case '\15': - thisline += 1; - break; - case '\12':/*nop*/ - break; - default: - x[thisline] = x[thisline] + *c; - } - - c += 1; - } -} - -void check_params() { - word s, o; - integer e; - - if (paramstr(1) != "jsb") exit(0); - val(paramstr(2), s, e); - if (e != 0) exit(0); - val(paramstr(3), o, e); - if (e != 0) exit(0); - skellern = ptr(s, o + 1); -} - -integer getsoundhardware(psoundcard scard) { - integer sc, i, autosel, select; - char ch; - integer e; - - - - integer getsoundhardware_result; -Lagain: - sc = detectgus(scard); - if (sc != 0) sc = detectpas(scard); - if (sc != 0) sc = detectaria(scard); - if (sc != 0) sc = detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); - - autosel = -1; - /* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13), select, e); - - /* Default entry? */ - if (select == 0) select = autosel; - if (select != autosel) { - /* clear all assumptions */ - sc = -1; - fillchar(scard, sizeof(tsoundcard), 0); - scard->id = soundcards[select - 1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id == id_dac) scard->ioport = 0x378; - - /* Read user input */ - val(paramstr(15), i, e); - - if (i != 0) scard->ioport = i; - if (sc != 1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : - scard->samplesize = 2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: - scard->stereo = true; - break; /* enable stereo */ - default: { - scard->samplesize = 1; - scard->stereo = false; - } - } - - if (scard->id != id_dac) { - val(paramstr(17), i, e); - - if (i != 0) scard->dmairq = i; - - val(paramstr(16), i, e); - - if (i != 0) scard->dmachannel = i; - } else { - /* Select correct DAC */ - scard->maxrate = 44100; - if (select == 11) { - scard->stereo = true; - scard->dmachannel = 1; /* Special 'mark' */ - scard->maxrate = 60000; - } else if (select == 12) { - scard->stereo = true; - scard->dmachannel = 2; - scard->maxrate = 60000; - if (scard->ioport == 0) scard->ioport = 0x378; - } else if (select == 13) { - scard->dmachannel = 0; - scard->ioport = 0x42; /* Special 'mark' */ - scard->maxrate = 44100; - } - } - - /* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result = 0; - return getsoundhardware_result; -} - -tsoundcard scard; -tmcpstruct mcpstrc; -tdds dds; -pmodule module; -tsdi_init sdi; -integer e, - bufsize; -char ch; -boolean v86, - vdsok; -longint a, rate, - tempseg; -string answer; -pointer temp; -word flags; -word curch; -byte modulevolume; -array<0, 4, tsampleinfo> sample; -array<0, 31, word> voltable; - -int main(int argc, const char *argv[]) { - - pio_initialize(argc, argv); - check_params(); - - nomusic = paramstr(13) == '0'; - - if (! nomusic) { - /* Read sound card information */ - if (getsoundhardware(&scard) == -1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id == id_gus) { - /* Initialize GUS player */ -#ifndef DPMI - scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ -#endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus, 0, 31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt, gus_timer); - } else { - /* Initialize Virtual DMA Specification */ -#ifndef DPMI - vdsok = vdsinit == 0; -#else - vdsok = false; -#endif - - fillchar(mcpstrc, sizeof(tmcpstruct), 0); - - /* Query for sampling rate */ - val(paramstr(14), a, e); - if (a > 4000) rate = a; - else rate = 21000; - - /* Query for quality */ - mcpstrc.options = mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi = sdi_sb; - scard.maxrate = 22000; - } - break; - case id_sbpro : { - sdi = sdi_sbpro; - scard.maxrate = 22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi = sdi_pas; - scard.maxrate = 44100; - } - break; - case id_sb16 : { - sdi = sdi_sb16; - scard.maxrate = 44100; - } - break; - case id_aria : { - sdi = sdi_aria; - scard.maxrate = 44100; - } - break; - case id_wss : { - sdi = sdi_wss; - scard.maxrate = 48000; - } - break; -#ifndef DPMI - case id_dac : - sdi = sdi_dac; - break; /* Only available in real mode */ -#endif - } - - mcpinitsounddevice(sdi, &scard); - a = mcp_tablesize; - mcpstrc.reqsize = 0; - - /* Calculate mixing buffer size */ - bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize = 0; - if ((mcpstrc.options & mcp_quality) > 0) - if (scard.samplesize == 1) a += mcp_qualitysize; - else - a = mcp_tablesize16 + mcp_qualitysize16; - if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; - -#ifdef DPMI - dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); - v86 = (flags & 2) == 0; -#endif - - /* Allocate volume table + mixing buffer */ -#ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg = 0; - dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); - } else { -#endif - getmem(temp, a + longint(bufsize)); - if (temp == nil) exit(2); -#ifdef DPMI - tempseg = seg(temp); - } -#else - tempseg = seg(temp) + ofs(temp) / 16 + 1; -#endif - mcpstrc.bufferseg = tempseg; - mcpstrc.bufferphysical = -1; - - if (vdsok && (scard.id != id_dac)) { - dds.size = bufsize; - dds.segment = tempseg; - dds.offset = 0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; - } - if (mcpstrc.bufferphysical == -1) -#ifdef DPMI - mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); -#else - mcpstrc.bufferphysical = (longint)(tempseg) << 4; -#endif - - mcpstrc.buffersize = bufsize; - mcpstrc.samplingrate = rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc) != 0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp, 0, 31); - } - - /* Try to initialize AMP */ - if (ampinit(0) != 0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt, amp_timer); - -#ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id == id_dac) setdactimer(tsgettimerrate); -#endif - - if (scard.id != id_gus) mcpstartvoice; - else gusstartvoice; - - /* Load an example AMF */ - module = amploadmod("glover.mod", 0); - if (module == nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) - && (scard.samplesize == 2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); - cdisetupchannels(0, module->channelcount + 2, &voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0, module->channelcount + 2, nil); - } - - curch = module->channelcount; - modulevolume = 64; - - /***/ ampplaymodule(module, 0); - } - - setupgraphics(); - - randseed = 177; - checkbreak = false; - - load_text(); - - this_line = 1; - - graphmode(0xd); - loadfont(); - - next_bitline = 17; - displaycounter = 0; - - cut_out_time = 333; - - setallpalette(our_palette); - - starry_starry_night(); - - while ((cut_out_time > 0) && (! keypressed())) { - - *skellern = 0; - - do_next_line(); - - displaycounter += 1; - - do { - } while (!(*skellern > 0)); - } - - if (! nomusic) ampstopmodule; - graphmode(3); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ints.cpp b/engines/avalanche/ints.cpp deleted file mode 100644 index 3a9459ced937..000000000000 --- a/engines/avalanche/ints.cpp +++ /dev/null @@ -1,57 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Avalot interrupt handler */ -/*#include "Dos.h"*/ - -namespace Avalanche { - -/*$F+*/ -registers r; -void() old1b; - -boolean quicko; - -void new1b() { /* interrupt; */ - quicko = true; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1b, &old1b); - setintvec(0x1b, addr(new1b())); - quicko = false; - do { - } while (!quicko); - setintvec(0x1b, &old1b); - /* r.ah:=$02; intr($16,r); - writeln(r.al and 12); { Only checks Ctrl and Alt. Both on = 12. } - until false;*/ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joysetup.cpp b/engines/avalanche/joysetup.cpp deleted file mode 100644 index 1faef823ff77..000000000000 --- a/engines/avalanche/joysetup.cpp +++ /dev/null @@ -1,128 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Avalot joystick setup routines. To be incorporated - into Setup2 whenever I get a chance. */ -/*#include "Joystick.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -struct joysetup { - word xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; /* Size of centre in tenths */ -}; - -joysetup js; -file jf; - -boolean detect() { - word x, y, xo, yo; - byte count; - boolean detect_result; - count = 0; - if (joystickpresent) { - detect_result = true; - return detect_result; - } - readjoya(xo, yo); - do { - if (count < 7) count += 1; /* Take advantage of "flutter" */ - if (count == 6) { - output << "The Bios says you don't have a joystick. However, it's often wrong" << NL; - output << "about such matters. So, do you? If you do, move joystick A to" << NL; - output << "continue. If you don't, press any key to cancel." << NL; - } - readjoya(x, y); - } while (!((keypressed()) | (x != xo) || (y != yo))); - detect_result = ~ keypressed(); - return detect_result; -} - -void display() { - { - gotoxy(20, 10); - output << "X min: " << js.xmin << " "; - gotoxy(20, 11); - output << "X max: " << js.xmax << " "; - gotoxy(20, 12); - output << "Y min: " << js.ymin << " "; - gotoxy(20, 13); - output << "Y max: " << js.ymax << " "; - } -} - -void getmaxmin() { - word x, y; - output << "Rotate the joystick around in a circle, as far from the centre as it" << NL; - output << "can get. Then click a button." << NL; - { - js.xmax = 0; - js.xmin = maxint; - js.ymax = 0; - js.ymin = maxint; - } - do { - readjoya(x, y); - { - if (x < js.xmin) js.xmin = x; - if (y < js.ymin) js.ymin = y; - if (x > js.xmax) js.xmax = x; - if (y > js.ymax) js.ymax = y; - display(); - } - } while (!(buttona1 | buttona2)); - do { - } while (!(~(buttona1 | buttona2))); - output << NL; - output << "Thank you. Now please centre your joystick and hit a button." << NL; - do { - } while (!(buttona1 | buttona2)); - readjoya(js.xmid, js.ymid); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 2; - clrscr; - output << "Avalot joystick setup routine- by TT. Thanks go to David B. Howorth." << NL; - output << NL; - if (detect()) output << "You've got a joystick!" << NL; - else return 0; - getmaxmin(); - do { - output << "Centring factor\? (3-9)"; - input >> js.centre >> NL; - } while (!(set::of(range(1, 9), eos).has(js.centre))); - assign(jf, "v:joytmp.dat"); - rewrite(jf); - jf << js; - close(jf); /* write it all out to disk. */ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/joystick.cpp b/engines/avalanche/joystick.cpp deleted file mode 100644 index 57efc1854635..000000000000 --- a/engines/avalanche/joystick.cpp +++ /dev/null @@ -1,210 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __joystick_implementation__ - -/* -Copyright (c) 1989, 1990 David B. Howorth - -Requires Turbo Pascal 5.0 or later. - -Unit last revised May 9, 1989. -This comment last revised October 22, 1990. - -This file, when compiled to disk, creates JOYSTICK.TPU, a Turbo Pascal unit -containing all necessary routines for joystick control. The routines can -be demonstrated by running the accompanying program JOYDEMO (after first -compiling JOYSTICK.PAS to disk). - -For further information see the accompanying file, JOYSTICK.DOC. - -Permission is granted to distribute this file and the accompanying files -(JOYDEMO.PAS and JOYSTICK.DOC) provided (1) all three files are distributed -together and (2) no fee is charged. - -Permission is granted to include compiled versions of the routines in these -files in any program, commercial or noncommercial, provided only that if the -program is distributed, whether commercially or noncommercially, a copy -(including any documentation) be sent to me; and, if you distribute your -program as shareware, treat me as registered. My address is 01960 SW Palatine -Hill Road, Portland, Oregon 97219. -*/ - -#include "joystick.h" - - -/*#include "Dos.h"*/ - -namespace Avalanche { - -typedef void(*readjoyproc)(byte a, byte b, word &c, word &d); -typedef boolean(*buttonfunc)(byte a); - -readjoyproc readjoy; -buttonfunc button; -registers reg; - -/*----------------------------- private routines ----------------------------*/ - -boolean newbios() { - char decadechar /*absolute $F000:$FFFB*/; - char yearchar /*absolute $F000:$FFFC*/; - - boolean newbios_result; - newbios_result = (set::of('9', '0', eos).has(decadechar)) /*an optimistic view of software life*/ - || ((decadechar == '8') && (set::of(range('4', '9'), eos).has(yearchar))); - return newbios_result; -} - -/*$F+*/ - -void oldreadjoy(byte xbit, byte ybit, word &xaxis, word &yaxis) { - /* - inline( - $BA/$01/$02/ {mov dx, 201h ;load dx with joystick port address } - $C4/$BE/>XAxis/ {les di, XAxis[bp] ;load es with segment and di w/offset } - $8A/$66/YAxis/ {les di, YAxis[bp] } - $8A/$66/' + double_off + ' ' + italic + x + italic_off << NL; - else - output << logfile << string("> ") + x << NL; -} - -void log_addstuff(string x) { - if (~ logging) return; - scroll_line = scroll_line + x; -} - -void log_scrollchar(string x) { /* print one character */ - varying_string<2> z; - if (~ logging) return; - switch (x[1]) { - case '`': - z = quote; - break; /* Open quotes: "66" */ - case '"': - z = unquote; - break; /* Close quotes: "99" */ - case '\357': - z = copyright; - break; /* Copyright sign. */ - default: - z = x; - } - log_addstuff(z); - scroll_line_length += length(z); -} - -void log_italic() { - if (~ logging) return; - if (log_epson) - log_addstuff(italic); - else - log_addstuff("*"); -} - -void log_roman() { - if (~ logging) return; - if (log_epson) - log_addstuff(italic_off); - else - log_addstuff("*"); -} - -void log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (~ logging) return; - if (log_epson) log_addstuff(italic_off); -} - -void log_scrollline() { /* Set up a line for the scroll driver */ - scroll_line_length = 0; - scroll_line = ""; -} - -void log_scrollendline(boolean centred) { - byte x, fv; - if (~ logging) return; - x = 17; - if (centred) x += (50 - scroll_line_length) / 2; - for (fv = 1; fv <= x; fv ++) output << logfile << ' '; - output << logfile << scroll_line << NL; -} - -void log_bubbleline(byte linenum, byte whom, string x) { - byte fv; - if (~ logging) return; - if (linenum == 1) { - for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; - } else { - for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; - output << logfile << x << NL; - } -} - -void log_newline() { - if (logging) output << logfile << NL; -} - -void log_newroom(string where) { - byte fv; - if (~ logging) return; - for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; - if (log_epson) output << logfile << emph_on; - output << logfile << string('(') + where + ')'; - if (log_epson) output << logfile << emph_off; - output << logfile << NL; -} - -void log_aside(string what) -/* This writes "asides" to the printer. For example, moves in Nim. */ -{ - if (~ logging) return; - output << logfile << " (" << italic << what << italic_off << ')' << NL; - /* "What" is what to write. */ -} - -void log_score(word credit, word now) { - byte fv; - if (~ logging) return; - for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; - output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/logger.h b/engines/avalanche/logger.h deleted file mode 100644 index cff43365872a..000000000000 --- a/engines/avalanche/logger.h +++ /dev/null @@ -1,63 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __logger_h__ -#define __logger_h__ - -namespace Avalanche { - -void log_setup(string name, boolean printing); - -void log_divider(); /* Prints the divider sign. */ - -void log_command(string x); /* Prints a command */ - -void log_scrollchar(string x); /* print one character */ - -void log_italic(); - -void log_roman(); - -void log_epsonroman(); - -void log_scrollline(); /* Set up a line for the scroll driver */ - -void log_scrollendline(boolean centred); - -void log_bubbleline(byte linenum, byte whom, string x); - -void log_newline(); - -void log_newroom(string where); - -void log_aside(string what); - -void log_score(word credit, word now); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp deleted file mode 100644 index f7afeec9314a..000000000000 --- a/engines/avalanche/lucerna.cpp +++ /dev/null @@ -1,1696 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - LUCERNA The screen, [keyboard] and mouse handler. */ - -#define __lucerna_implementation__ - - -#include "lucerna.h" - - -#include "Graph.h" -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ -#include "trip5.h" -#include "Acci.h" -#include "pingo.h" -#include "scrolls.h" -#include "enhanced.h" -#include "dropdown.h" -#include "logger.h" -#include "visa.h" -#include "celer.h" -#include "timeout.h" -#include "basher.h" -#include "sequence.h" - -namespace Avalanche { - -/*$V-*/ /*$S-*/ -boolean fxhidden; -array<0, 3, palettetype> fxpal; - -void callverb(char n) { - if (n == pardon) { - display(string("The f5 key lets you do a particular action in certain ") + - "situations. However, at the moment there is nothing " + - "assigned to it. You may press alt-A to see what the " + - "current setting of this key is."); - } else { - weirdword = false; - polite = true; - verb = n; - do_that(); - } -} - -void draw_also_lines() { - byte ff; - byte squeaky_code; - - switch (visible) { - case m_virtual : { - squeaky_code = 1; - off_virtual(); - } - break; - case m_no : - squeaky_code = 2; - break; - case m_yes : { - squeaky_code = 3; - off(); - } - break; - } - - setactivepage(2); - cleardevice(); - setcolor(15); - rectangle(0, 45, 639, 160); - for (ff = 1; ff <= 50; ff ++) { - linetype &with = lines[ff]; - if (x1 != maxint) { - setcolor(with.col); - line(x1, y1, x2, y2); - } - } - - switch (squeaky_code) { - case 1 : - on_virtual(); - break; - case 2 : - break; /* zzzz, it was off anyway */ - case 3 : - on(); - break; - } -} - -void load_also(string n); - -static untyped_file f; - - -static string nextstring() { - byte l; - string x; - - string nextstring_result; - blockread(f, l, 1); - blockread(f, x[1], l); - x[0] = chr(l); - nextstring_result = x; - return nextstring_result; -} - -static void unscramble(); - -static void scram1(string &x) { - byte fz; - for (fz = 1; fz <= length(x); fz ++) - x[fz] = chr(ord(x[fz]) ^ 177); -} - - - -static void unscramble() { - byte fv, ff; - - for (fv = 0; fv <= 30; fv ++) - for (ff = 0; ff <= 1; ff ++) - if (also[fv][ff] != nil) - scram1(*also[fv][ff]); - scram1(listen); - scram1(flags); - /* for fz:=1 to length(also[fv,ff]^) do - also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ -} - -void load_also(string n) { - byte minnames; - byte ff, fv; - - - for (fv = 0; fv <= 30; fv ++) - for (ff = 0; ff <= 1; ff ++) - if (also[fv][ff] != nil) { - delete also[fv][ff]; - also[fv][ff] = nil; - } - assign(f, string("also") + n + ".avd"); - /*$I-*/ reset(f, 1); /*$I+*/ if (ioresult != 0) return; /* no Also file */ - seek(f, 128); - blockread(f, minnames, 1); - for (fv = 0; fv <= minnames; fv ++) { - for (ff = 0; ff <= 1; ff ++) { - also[fv][ff] = new string; - *also[fv][ff] = nextstring(); - } - *also[fv][0] = string('\235') + *also[fv][0] + '\235'; - } - fillchar(lines, sizeof(lines), 0xff); - - fv = getpixel(0, 0); - blockread(f, fv, 1); - blockread(f, lines, sizeof(lines[1])*fv); - blockread(f, fv, 1); - fillchar(peds, sizeof(peds), '\261'); - blockread(f, peds, sizeof(peds[1])*fv); - blockread(f, numfields, 1); - blockread(f, fields, sizeof(fields[1])*numfields); - blockread(f, magics, sizeof(magics)); - blockread(f, portals, sizeof(portals)); - blockread(f, flags, sizeof(flags)); - blockread(f, listen[0], 1); - blockread(f, listen[1], length(listen)); - draw_also_lines(); - - setactivepage(1); - close(f); - unscramble(); - for (fv = 0; fv <= minnames; fv ++) - *also[fv][0] = string(',') + *also[fv][0] + ','; -} - -void load(byte n) { /* Load2, actually */ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ - byte bit; - untyped_file f; - varying_string<2> xx; - boolean was_virtual; - - was_virtual = visible == m_virtual; - if (was_virtual) off_virtual(); - else off(); - clear_vmc(); - - xx = strf(n); - flesh_colours(); - assign(f, string("place") + xx + ".avd"); - reset(f, 1); - seek(f, 146); - blockread(f, roomname, 30); - /* Compression method byte follows this... */ - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - move(a0, a1, 12080); - } - close(f); - load_also(xx); - load_chunks(xx); - - copy03(); - bit = getpixel(0, 0); - log_newroom(roomname); - - if (was_virtual) on_virtual(); - else on(); -} - -void zoomout(integer x, integer y) { - integer x1, y1, x2, y2; - byte fv; - - setcolor(white); - setwritemode(xorput); - setlinestyle(dottedln, 0, 1); - - for (fv = 1; fv <= 20; fv ++) { - x1 = x - (x / 20) * fv; - y1 = y - ((y - 10) / 20) * fv; - x2 = x + (((639 - x) / 20) * fv); - y2 = y + (((161 - y) / 20) * fv); - - rectangle(x1, y1, x2, y2); - delay(17); - rectangle(x1, y1, x2, y2); - } - setwritemode(copyput); - setlinestyle(0, 0, 1); -} - -void find_people(byte room) { - char fv; - - for (fv = '\227'; fv <= '\262'; fv ++) - if (whereis[fv] == room) { - if (fv < '\257') him = fv; - else her = fv; - } -} - -void exitroom(byte x) { - nosound; - forget_chunks(); - seescroll = true; /* This stops the trippancy system working over the - length of this procedure. */ - - { - dnatype &with = dna; - switch (x) { - case r__spludwicks: { - lose_timer(reason_avariciustalks); - /* He doesn't HAVE to be talking for this to work. It just deletes it IF it - exists. */ with.avaricius_talk = 0; - } - break; - case r__bridge: - if (with.drawbridge_open > 0) { - with.drawbridge_open = 4; /* Fully open. */ - lose_timer(reason_drawbridgefalls); - } - break; - case r__outsidecardiffcastle: - lose_timer(reason_cardiffsurvey); - break; - - case r__robins: - lose_timer(reason_getting_tied_up); - break; - } - } - - interrogation = 0; /* Leaving the room cancels all the questions automatically. */ - - seescroll = false; /* Now it can work again! */ - - dna.last_room = dna.room; - if (dna.room != r__map) - dna.last_room_not_map = dna.room; -} - -void new_town() { /* You've just entered a town from the map. */ - standard_bar(); - - switch (dna.room) { - case r__outsidenottspub: /* Entry into Nottingham. */ - if ((dna.rooms[r__robins] > 0) && (dna.been_tied_up) && - (! dna.taken_mushroom)) - dna.mushroom_growing = true; - break; - case r__wisewomans: { /* Entry into Argent. */ - if (dna.talked_to_crapulus && (! dna.lustie_is_asleep)) { - dna.spludwicks_here = !((dna.rooms[r__wisewomans] % 3) == 1); - dna.crapulus_will_tell = ! dna.spludwicks_here; - } else { - dna.spludwicks_here = true; - dna.crapulus_will_tell = false; - } - if (dna.box_contents == wine) dna.winestate = 3; /* Vinegar */ - } - break; - } - - if (dna.room != r__outsideducks) { - if ((dna.obj[onion]) && !(dna.onion_in_vinegar)) - dna.rotten_onion = true; /* You're holding the onion */ - } -} - -void enterroom(byte x, byte ped); - -static void put_geida_at(byte whichped, byte &ped) { - if (ped == 0) return; - tr[2].init(5, false); /* load Geida */ - apped(2, whichped); - tr[2].call_eachstep = true; - tr[2].eachstep = procgeida_procs; -} - -void enterroom(byte x, byte ped) { - - seescroll = true; /* This stops the trippancy system working over the - length of this procedure. */ - - find_people(x); - dna.room = x; - if (ped != 0) dna.rooms[x] += 1; - - load(x); - - if ((dna.rooms[x] == 0) && (! flagset('S'))) points(1); - whereis[pavalot] = dna.room; - if (dna.geida_follows) whereis[pgeida] = x; - roomtime = 0; - - { - dnatype &with = dna; - if ((with.last_room == r__map) && (with.last_room_not_map != with.room)) - new_town(); - } - - switch (x) { - case r__yours: - if (dna.avvy_in_bed) { - show_one(3); - set_up_timer(100, procarkata_shouts, reason_arkata_shouts); - } - break; - - case r__outsideyours: - if (ped > 0) { - if (! dna.talked_to_crapulus) { - - whereis[pcrapulus] = r__outsideyours; - tr[2].init(8, false); /* load Crapulus */ - - if (dna.rooms[r__outsideyours] == 1) { - apped(2, 4); /* Start on the right-hand side of the screen. */ - tr[2].walkto(5); /* Walks up to greet you. */ - } else { - apped(2, 5); /* Starts where he was before. */ - tr[2].face = 3; - } - - tr[2].call_eachstep = true; - tr[2].eachstep = procface_avvy; /* He always faces Avvy. */ - - } else whereis[pcrapulus] = r__nowhere; - - if (dna.crapulus_will_tell) { - tr[2].init(8, false); - apped(2, 2); - tr[2].walkto(4); - set_up_timer(20, proccrapulus_splud_out, reason_crapulus_says_spludwick_out); - dna.crapulus_will_tell = false; - } - } - break; - - case r__outsidespludwicks: - if ((dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { - set_up_timer(20, procbang, reason_explosion); - dna.spludwicks_here = true; - } - break; - - case r__spludwicks: - if (dna.spludwicks_here) { - if (ped > 0) { - tr[2].init(2, false); /* load Spludwick */ - apped(2, 2); - whereis['\227'] = r__spludwicks; - } - - dna.dogfoodpos = 0; /* Also Spludwick pos. */ - - tr[2].call_eachstep = true; - tr[2].eachstep = procgeida_procs; - } else whereis['\227'] = r__nowhere; - break; - - case r__brummieroad: { - if (dna.geida_follows) put_geida_at(5, ped); - if (dna.cwytalot_gone) { - magics[lightred].op = nix; - whereis[pcwytalot] = r__nowhere; - } else { - if (ped > 0) { - tr[2].init(4, false); /* 4=Cwytalot*/ - tr[2].call_eachstep = true; - tr[2].eachstep = procfollow_avvy_y; - whereis[pcwytalot] = r__brummieroad; - - if (dna.rooms[r__brummieroad] == 1) { /* First time here... */ - apped(2, 2); /* He appears on the right of the screen... */ - tr[2].walkto(4); /* ...and he walks up... */ - } else { - /* You've been here before. */ - apped(2, 4); /* He's standing in your way straight away... */ - tr[2].face = left; - } - } - } - } - break; - - case r__argentroad: { - dnatype &with = dna; - if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && - (dna.rooms[r__argentroad] > 3)) { - tr[2].init(4, false); /* 4=Cwytalot again*/ - apped(2, 1); - tr[2].walkto(2); - tr[2].vanishifstill = true; - with.cwytalot_in_herts = true; - /*whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ - set_up_timer(20, proc_cwytalot_in_herts, reason_cwytalot_in_herts); - } - } - break; - - case r__bridge: { - if (dna.drawbridge_open == 4) { /*open*/ - show_one(3); /* Position of drawbridge */ - magics[green].op = nix; /* You may enter the drawbridge. */ - } - if (dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ - } - break; - - case r__robins: { - if (ped > 0) { - if (! dna.been_tied_up) { - /* A welcome party... or maybe not... */ - tr[2].init(6, false); - apped(2, 2); - tr[2].walkto(3); - set_up_timer(36, procget_tied_up, reason_getting_tied_up); - } - } - - if (dna.been_tied_up) { - whereis[probinhood] = 0; - whereis[pfriartuck] = 0; - } - - if (dna.tied_up) show_one(2); - - if (! dna.mushroom_growing) show_one(3); - } - break; - - case r__outsidecardiffcastle: { - if (ped > 0) - switch (dna.cardiff_things) { - case 0 : { /* You've answered NONE of his questions. */ - tr[2].init(9, false); - apped(2, 2); - tr[2].walkto(3); - set_up_timer(47, proccardiffsurvey, reason_cardiffsurvey); - } - break; - case 5 : - magics[2].op = nix; - break; /* You've answered ALL his questions. => nothing happens. */ - default: { /* You've answered SOME of his questions. */ - tr[2].init(9, false); - apped(2, 3); - tr[2].face = right; - set_up_timer(3, proccardiff_return, reason_cardiffsurvey); - } - } - if (dna.cardiff_things < 5) - interrogation = dna.cardiff_things; - else interrogation = 0; - } - break; - - case r__map: { - /* You're entering the map. */ - dawn(); - setactivepage(cp); - if (ped > 0) zoomout(peds[ped].x, peds[ped].y); - setactivepage(1 - cp); - - { - dnatype &with = dna; - if ((with.obj[wine]) && (with.winestate != 3)) { - dixi('q', 9); /* Don't want to waste the wine! */ - with.obj[wine] = false; - objectlist(); - } - } - - dixi('q', 69); - } - break; - - case r__catacombs: { - if (set::of(0, 3, 5, 6, eos).has(ped)) { - dnatype &with = dna; - - switch (ped) { - case 3 : { - with.cat_x = 8; - with.cat_y = 4; - } - break; /* Enter from oubliette */ - case 5 : { - with.cat_x = 8; - with.cat_y = 7; - } - break; /* Enter from du Lustie's */ - case 6 : { - with.cat_x = 4; - with.cat_y = 1; - } - break; /* Enter from Geida's */ - } - dna.enter_catacombs_from_lusties_room = true; - catamove(ped); - dna.enter_catacombs_from_lusties_room = false; - } - } - break; - - case r__argentpub: { - if (dna.wonnim) show_one(1); /* No lute by the settle. */ - dna.malagauche = 0; /* Ready to boot Malagauche */ - if (dna.givenbadgetoiby) { - show_one(8); - show_one(9); - } - } - break; - - case r__lustiesroom: { - dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ - if (tr[1].whichsprite == 0) /* Avvy in his normal clothes */ - set_up_timer(3, proccallsguards, reason_du_lustie_talks); - else if (! dna.entered_lusties_room_as_monk) /*already*/ - /* Presumably, Avvy dressed as a monk. */ - set_up_timer(3, procgreetsmonk, reason_du_lustie_talks); - - if (dna.geida_follows) { - put_geida_at(5, ped); - if (dna.lustie_is_asleep) show_one(5); - } - } - break; - - case r__musicroom: { - if (dna.jacques_awake > 0) { - dna.jacques_awake = 5; - show_one(2); - show_one(4); - magics[brown].op = nix; - whereis[pjacques] = 0; - } - if (ped != 0) { - show_one(6); - first_show(5); - then_show(7); - start_to_close(); - } - } - break; - - case r__outsidenottspub: - if (ped == 2) { - show_one(3); - first_show(2); - then_show(1); - then_show(4); - start_to_close(); - } - break; - - case r__outsideargentpub: - if (ped == 2) { - show_one(6); - first_show(5); - then_show(7); - start_to_close(); - } - break; - - case r__wisewomans: { - tr[2].init(11, false); - if ((dna.rooms[r__wisewomans] == 1) && (ped > 0)) { - apped(2, 2); /* Start on the right-hand side of the screen. */ - tr[2].walkto(4); /* Walks up to greet you. */ - } else { - apped(2, 4); /* Starts where she was before. */ - tr[2].face = 3; - } - - tr[2].call_eachstep = true; - tr[2].eachstep = procface_avvy; /* She always faces Avvy. */ - } - break; - - case r__insidecardiffcastle: - if (ped > 0) { - tr[2].init(10, false); /* Define the dart. */ - first_show(1); - if (dna.arrow_in_the_door) then_show(3); - else then_show(2); - if (dna.taken_pen) show_one(4); - start_to_close(); - } else { - show_one(1); - if (dna.arrow_in_the_door) show_one(3); - else show_one(2); - } - break; - - case r__avvysgarden: - if (ped == 1) { - show_one(2); - first_show(1); - then_show(3); - start_to_close(); - } - break; - - case r__entrancehall: - case r__insideabbey: - if (ped == 2) { - show_one(2); - first_show(1); - then_show(3); - start_to_close(); - } - break; - - case r__aylesoffice: - if (dna.ayles_is_awake) show_one(2); - break; /* Ayles awake. */ - - case r__geidas: - put_geida_at(2, ped); - break; /* load Geida */ - - case r__easthall: - case r__westhall: - if (dna.geida_follows) put_geida_at(ped + 2, ped); - break; - - case r__lusties: - if (dna.geida_follows) put_geida_at(ped + 6, ped); - break; - - case r__nottspub: { - if (dna.sitting_in_pub) show_one(3); - dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ - } - break; - - case r__outsideducks: - if (ped == 2) { - /* Shut the door */ - show_one(3); - first_show(2); - then_show(1); - then_show(4); - start_to_close(); - } - break; - case r__ducks: - dna.dogfoodpos = 1; - break; /* Actually, Duck pos. */ - - } - - seescroll = false; /* Now it can work again! */ - -} - -void thinkabout(char z, boolean th) { /* Hey!!! Get it and put it!!! */ - const integer x = 205; - const integer y = 170; - const integer picsize = 966; - const bytefield thinkspace = - {25, 170, 32, 200}; - untyped_file f; - pointer p; - byte fv; - - - thinks = z; - z -= 1; - - if (th) { - /* Things */ - assign(f, "thinks.avd"); - wait(); - getmem(p, picsize); - reset(f, 1); - seek(f, ord(z)*picsize + 65); - blockread(f, p, picsize); - off(); - close(f); - } else { - /* People */ - assign(f, "folk.avd"); - wait(); - getmem(p, picsize); - reset(f, 1); - - fv = ord(z) - 149; - if (fv >= 25) fv -= 8; - if (fv == 20) fv -= 1; /* Last time... */ - - seek(f, fv * picsize + 65); - blockread(f, p, picsize); - off(); - close(f); - } - - setactivepage(3); - putimage(x, y, p, 0); - setactivepage(1 - cp); - - for (fv = 0; fv <= 1; fv ++) - getset[fv].remember(thinkspace); - - freemem(p, picsize); - on(); - thinkthing = th; -} - -void load_digits() { /* Load the scoring digits & rwlites */ - const integer digitsize = 134; - const integer rwlitesize = 126; - untyped_file f; - char fv; - byte ff; - - assign(f, "digit.avd"); - reset(f, 1); - for (fv = '0'; fv <= '9'; fv ++) { - getmem(digit[fv], digitsize); - blockread(f, digit[fv], digitsize); - } - for (ff = 0; ff <= 8; ff ++) { - getmem(rwlite[ff], rwlitesize); - blockread(f, rwlite[ff], rwlitesize); - } - close(f); -} - -void toolbar() { - untyped_file f; - word s; - byte fv; - pointer p; - - assign(f, "useful.avd"); - reset(f, 1); - s = filesize(f) - 40; - getmem(p, s); - seek(f, 40); - blockread(f, p, s); - close(f); - /* off;*/ - - setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ - setfillstyle(1, 6); - for (fv = 0; fv <= 1; fv ++) { - setactivepage(fv); - putimage(5, 169, p, 0); - if (demo) { - bar(264, 177, 307, 190); - outtextxy(268, 188, "Demo!"); /* well... actually only white now. */ - } - } - - /* on;*/ - freemem(p, s); - oldrw = 177; - showrw(); -} - -void showscore() { - const bytefield scorespace = {33, 177, 39, 200}; - varying_string<3> q; - byte fv; - - if (demo) return; - - str(dna.score, q); - while (q[0] < '\3') q = string('0') + q; - off(); - setactivepage(3); - for (fv = 1; fv <= 3; fv ++) - if (lastscore[fv] != q[fv]) - putimage(250 + fv * 15, 177, digit[q[fv]], 0); - - for (fv = 0; fv <= 1; fv ++) - getset[fv].remember(scorespace); - - setactivepage(1 - cp); - on(); - lastscore = q; -} - -void points(byte num) { /* Add on no. of points */ - byte q, fv; - - for (q = 1; q <= num; q ++) { - dna.score += 1; - if (soundfx) for (fv = 1; fv <= 97; fv ++) sound(177 + dna.score * 3); - nosound; - } - log_score(num, dna.score); - showscore(); -} - -void topcheck() { - { - menuset &with = ddm_m; /* Menuset */ - getmenu(mpx); - } /* Do this one */ -} - -void mouseway() { - byte col; - - off(); - col = getpixel(mx, my); - on(); - { - triptype &with = tr[1]; - { - dnatype &with1 = dna; - switch (col) { - case green: { - dna.rw = up; - rwsp(1, up); - showrw(); - } - break; - case brown: { - dna.rw = down; - rwsp(1, down); - showrw(); - } - break; - case cyan: { - dna.rw = left; - rwsp(1, left); - showrw(); - } - break; - case lightmagenta: { - dna.rw = right; - rwsp(1, right); - showrw(); - } - break; - case red: - case white: - case lightcyan: - case yellow: { - stopwalking(); - showrw(); - } - break; - } - } - } -} - -void inkey() { - char r; - - - if (demo) return; /* Demo handles this itself. */ - - if (mousetext == "") { - /* read keyboard */ - readkeye(); - if ((inchar == ' ') && ((shiftstate & 8) > 0)) { - inchar = '\0'; - extd = '#'; /* alt-spacebar = alt-H */ - } - } else { - if (mousetext[1] == '`') mousetext[1] = '\15'; /* Backquote = return in a macro */ - inchar = mousetext[1]; - mousetext = copy(mousetext, 2, 255); - } -} - -void posxy() { - varying_string<3> xs, ys; - - setfillstyle(1, 0); - setcolor(10); - do { - check(); - if (mpress == 1) { - str(mx, xs); - str(my, ys); - off(); - bar(400, 160, 500, 168); - outtextxy(400, 168, xs); - outtextxy(440, 168, string(": ") + ys); - on(); - } - } while (!(my == 0)); - bar(400, 161, 640, 168); -} - -void fxtoggle() { - byte page_; - const bytefield soundled = - {52, 175, 55, 177}; - - soundfx = ! soundfx; - if (soundfx) { - if (! fxhidden) { - /* ...but *not* when the screen's dark. */ - sound(1770); - delay(77); - nosound; - } - setfillstyle(1, cyan); - } else - setfillstyle(1, black); - setactivepage(3); - bar(419, 175, 438, 177); - setactivepage(1 - cp); - for (page_ = 0; page_ <= 1; page_ ++) getset[page_].remember(soundled); -} - -void objectlist() { - char fv; - - dna.carrying = 0; - if (thinkthing && ! dna.obj[thinks]) - thinkabout(money, a_thing); /* you always have money */ - for (fv = '\1'; fv <= numobjs; fv ++) - if (dna.obj[fv]) { - dna.carrying += 1; - objlist[dna.carrying] = fv; - } -} - -void verte() { - byte what; - - if (! dna.user_moves_avvy) return; - { - triptype &with = tr[1]; /* that's the only one we're interested in here */ - - - if (mx < (cardinal)with.x) what = 1; - else if (mx > (unsigned char)(with.x + with.a.xl)) what = 2; - else - what = 0; /* On top */ - - if (my < (cardinal)with.y) what += 3; - else if (my > (unsigned char)(with.y + with.a.yl)) what += 6; - - switch (what) { - case 0: - stopwalking(); - break; /* Clicked on Avvy- no movement */ - case 1: - rwsp(1, left); - break; - case 2: - rwsp(1, right); - break; - case 3: - rwsp(1, up); - break; - case 4: - rwsp(1, ul); - break; - case 5: - rwsp(1, ur); - break; - case 6: - rwsp(1, down); - break; - case 7: - rwsp(1, dl); - break; - case 8: - rwsp(1, dr); - break; - } /* no other values are possible... */ - - showrw(); - - } -} - -void checkclick() { - bytefield b; - - check(); - ontoolbar = slow_computer && ((my >= 169) || (my <= 10)); - - if (mrelease > 0) after_the_scroll = false; - switch (my) { - case RANGE_11(0, 10): - newpointer(1); - break; /* up arrow */ - case RANGE_11(159, 169): - newpointer(8); - break; /* I-beam */ - case 170 ... 200: - newpointer(2); - break; /* screwdriver */ - default: { - if (! ddmnow) { /* Dropdown can handle its own pointers. */ - if (((keystatus & 1) == 1) && (my >= 11) && (my <= 158)) { - newpointer(7); /* Mark's crosshairs */ - verte(); - /* Normally, if you click on the picture, you're guiding Avvy around. */ - } else - newpointer(4); /* fletch */ - } - } - } - - if (mpress > 0) { - switch (mpy) { - case RANGE_11(0, 10): - if (dropsok) topcheck(); - break; - case 11 ... 158: - if (! dropsok) - mousetext = string('\15') + mousetext; - break; /* But otherwise, it's - equivalent to pressing Enter. */ - case RANGE_11(159, 169): { /* Click on command line */ - cursor_off(); - curpos = (mx - 16) / 8; - if (curpos > length(current) + 1) curpos = length(current) + 1; - if (curpos < 1) curpos = 1; - cursor_on(); - } - break; - case 170 ... 200: - switch (mpx) { /* bottom check */ - case 0 ... 207: - mouseway(); - break; - case 208 ... 260: { /* Examine the thing */ - do { - check(); - } while (!(mrelease > 0)); - if (thinkthing) { - thing = thinks; - thing += 49; - person = pardon; - } else { - person = thinks; - thing = pardon; - } - callverb(vb_exam); - } - break; - case 261 ... 319: { - do { - checkclick(); - } while (!(mrelease > 0)); - callverb(vb_score); - } - break; - case 320 ... 357: { - tr[1].xs = walk; - newspeed(); - } - break; - case 358 ... 395: { - tr[1].xs = run; - newspeed(); - } - break; - case 396 ... 483: - fxtoggle(); - break; /* "sound" */ - /* 484..534: begin { clock } - off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; - end;*/ - case 535 ... 640: - mousetext = string('\15') + mousetext; - break; - } - break; - } - } - - /* if mrelease>0 then - begin - if (cw<>177) and (mry>10) then - begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; - end;*/ -} - -void mouse_init() { - r.ax = 0; - intr(0x33, r); /* Returns- no. keys in bx and whether present in ax. */ - wait(); -} - -void mousepage(word page_) { - boolean onstate, wason; - - if (visible != m_virtual) { - onstate = oncandopageswap; - oncandopageswap = false; - wason = visible == m_yes; - if (wason) off(); - { - void &with = r; - ax = 29; - bx = page_; - } - intr(0x33, r); - if (wason) on(); - oncandopageswap = onstate; - } -} - -void errorled() { - byte fv; - - state(0); - for (fv = 0; fv <= 1; fv ++) { - setactivepage(fv); - off(); - setfillstyle(1, red); - bar(419, 184, 438, 186); - on(); - } - for (fv = 177; fv >= 1; fv --) { - sound(177 + (fv * 177177) / 999); - delay(1); - nosound; - } - for (fv = 0; fv <= 1; fv ++) { - setactivepage(fv); - off(); - setfillstyle(1, black); - bar(419, 184, 438, 186); - on(); - } - state(defaultled); - setactivepage(1 - cp); -} - -shortint fades(shortint x) { - byte r, g, b; - - shortint fades_result; - r = x / 16; - x = x % 16; - g = x / 4; - b = x % 4; - if (r > 0) r -= 1; - if (g > 0) g -= 1; - if (b > 0) b -= 1; - fades_result = (16 * r + 4 * g + b); - /* fades:=x-1;*/ - return fades_result; -} - -void dusk(); - -static void fadeout(byte n) { - byte fv; - - getpalette(fxpal[n]); - for (fv = 1; fv <= fxpal[n].size - 1; fv ++) - fxpal[n].colors[fv] = fades(fxpal[n].colors[fv]); - setallpalette(fxpal[n]); - /*delay(50);*/ slowdown(); -} - -void dusk() { - byte fv; - - setbkcolor(0); - if (fxhidden) return; - fxhidden = true; - getpalette(fxpal[0]); - for (fv = 1; fv <= 3; fv ++) fadeout(fv); -} - -void dawn(); - -static void fadein(byte n) { - setallpalette(fxpal[n]); - /*delay(50);*/ slowdown(); -} - -void dawn() { - byte fv; - - if ((holdthedawn) || (! fxhidden)) return; - fxhidden = false; - for (fv = 3; fv >= 0; fv --) fadein(fv); - { - dnatype &with = dna; - if ((with.room == r__yours) && (with.avvy_in_bed) && (with.teetotal)) background(14); - } -} - -void showrw() { - byte page_; - - { - dnatype &with = dna; - - if (oldrw == with.rw) return; - oldrw = with.rw; - off(); - for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - putimage(0, 161, rwlite[with.rw], 0); - } - on(); - setactivepage(1 - cp); - } -} - -void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t) /* assembler; */ -/* The Minstrel Blitter */ -/* asm -{ ofsfr:=f*$4000+x1+y1*80; - ofsto:=t*$4000+x1+y1*80;} - - mov bx,80; { We're multiplying by 80. } - mov al,y1; - mul bl; { AX now contains y1*80. } - xor cx,cx; { Zero CX. } - mov cl,x1; { CX now equals x1 } - add ax,cx; { AX now contains x1+y1*80. } - mov si,ax; - mov di,ax; - - mov ax,$4000; - mov bl,f; - mul bx; { Note that this is a *word*! } - add si,ax; - - mov ax,$4000; - mov bl,t; - mul bx; { Note that this is a *word*! } - add di,ax; - - push ds; { *** <<<< *** WE MUST PRESERVE THIS! } - cld; { Clear Direction flag - we're going forwards! } - - mov ax,$A000; { The screen memory. } - mov ds,ax; - mov es,ax; { The same. } - - { AH stores the number of bytes to copy. } - { len:=(x2-x1)+1; } - - mov ah,x2; - sub ah,x1; - inc ah; - - { Firstly, let's decide how many times we're going round. } - - mov cl,y2; { How many numbers between y1 and y2? } - sub cl,y1; - inc cl; { Inclusive reckoning (for example, from 3 to 5 is 5-3+1=3 turns. } - - { We'll use SI and DI to be Ofsfr and Ofsto. } - - @Y_axis_loop: - push cx; - - - { OK... We've changed this loop from a for-next loop. "Bit" is - represented by CX. } - -{ port[$3c4]:=2; port[$3ce]:=4; } - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; - - mov cx,4; { We have to copy planes 3, 2, 1 and Zero. We'll add 1 to the - number, because at zero it stops. } - - mov bx,3; { This has a similar function to that of CX. } - - @start_of_loop: - - push cx; - -{ port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; -{ port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - -{ move(mem[$A000:ofsfr],mem[$A000:ofsto],len); } - - xor ch,ch; { Clear CH. } - mov cl,ah; - - repz movsb; { That's all we need to say! } - - mov cl,ah; - sub si,cx; { This is MUCH, MUCH faster than pushing and popping them! } - sub di,cx; - - pop cx; { Get the loop count back again. } - dec bx; { One less... } - loop @start_of_loop; { Until cx=0. } - - add si,80; { Do the next line... } - add di,80; - - pop cx; - loop @Y_axis_loop; - - pop ds; { Get it back again (or we'll be in trouble with TP!) } -*/ -{ -} - -void blitfix() { - byte fv; - - fv = getpixel(0, 0); /* perform read & so cancel Xor effect! */ -} - -void clock(); -const integer xm = 510; -const integer ym = 183; -static arccoordstype ah, am; -static word nh; - -static void calchand(word ang, word length, arccoordstype &a, byte c) { - if (ang > 900) { - a.xend = 177; - return; - } - setcolor(c); - arc(xm, ym, 449 - ang, 450 - ang, length); - getarccoords(a); -} - - -static void hand(arccoordstype a, byte c) { - if (a.xend == 177) return; - setcolor(c); - line(xm, ym, a.xend, a.yend); /* "With a do-line???!", Liz said. */ -} - - -static void chime() { - word gd, gm, fv; - - if ((oh == 17717) || (! soundfx)) return; /* too high- must be first time around */ - fv = h % 12; - if (fv == 0) fv = 12; - wait(); - for (gd = 1; gd <= fv; gd ++) { - for (gm = 1; gm <= 3; gm ++) { - sound((gd % 3) * 64 + 140 - gm * 30); - delay(50 - gm * 12); - } - nosound; - if (gd != fv) delay(100); - } -} - - - -static void refresh_hands() { - const bytefield clockspace = {61, 166, 66, 200}; - byte page_; - - for (page_ = 0; page_ <= 1; page_ ++) - getset[page_].remember(clockspace); -} - - - -static void plothands() { - /* off;*/ - setactivepage(3); - calchand(onh, 14, ah, yellow); - calchand(om * 6, 17, am, yellow); - hand(ah, brown); - hand(am, brown); - calchand(nh, 14, ah, brown); - calchand(m * 6, 17, am, brown); - hand(ah, yellow); - hand(am, yellow); - setactivepage(1 - cp); - - refresh_hands(); - - /* on;*/ -} - -void clock() { - /* ...Clock. */ - gettime(h, m, s, s1); - nh = (h % 12) * 30 + m / 2; - if (oh != h) { - plothands(); - chime(); - } - if (om != m) plothands(); - if ((h == 0) && (oh != 0) && (oh != 17717)) - display(string("Good morning!\r\rYes, it's just past midnight. Are you having") + - " an all-night Avvy session? Glad you like the game that much!"); - oh = h; - onh = nh; - om = m; -} - -void flip_page() { - if (! ddm_o.menunow) { - cp = 1 - cp; - setvisualpage(cp); - setactivepage(1 - cp); - /*mousepage(cp);*/ - } - -} - -void delavvy() { - byte page_; - - off(); - { - triptype &with = tr[1]; - for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); - } - blitfix(); - on(); -} - -void gameover() { - byte fv; - integer sx, sy; - - dna.user_moves_avvy = false; - - sx = tr[1].x; - sy = tr[1].y; - { - triptype &with = tr[1]; - - done(); - init(12, true); /* 12 = Avalot falls */ - tr[1].step = 0; - appear(sx, sy, 0); - } - set_up_timer(3, procavalot_falls, reason_falling_over); - /* display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ - alive = false; -} - -/* OK. There are two kinds of redraw: Major and Minor. Minor is what happens - when you load a game, etc. Major redraws EVERYTHING. */ - -void minor_redraw() { - byte fv; - - dusk(); - enterroom(dna.room, 0); /* Ped unknown or non-existant. */ - - for (fv = 0; fv <= 1; fv ++) { - cp = 1 - cp; - getback(); - } - - { - dnatype &with = dna; - - lastscore = "TJA"; /* impossible digits */ - showscore(); - } - - dawn(); -} - -void major_redraw() { - byte fv; - - dusk(); - setactivepage(0); - cleardevice(); - - toolbar(); - copy03(); - - enterroom(dna.room, 0); /* 0 = ped unknown or non-existant. */ - for (fv = 0; fv <= 1; fv ++) { - cp = 1 - cp; - getback(); - } - - om = 177; - clock(); - - thinkabout(thinks, thinkthing); - standard_bar(); - soundfx = ! soundfx; - fxtoggle(); - for (fv = 0; fv <= 1; fv ++) { - cp = 1 - cp; - getback(); - } - plottext(); - ledstatus = 177; - state(2); - - { - dnatype &with = dna; - - lastscore = "TJA"; /* impossible digits */ - showscore(); - } - - dawn(); -} - -word bearing(byte whichped) -/* Returns the bearing from ped Whichped to Avvy, in degrees. */ -{ - const real rad2deg = 180 / pi; - - word bearing_result; - { - pedtype &with = peds[whichped]; - if (tr[1].x == with.x) - bearing_result = 0; /* This would cause a division by zero if we let it through. */ - else - /* - bearing:=trunc(((arctan((tr[1].y-y)/(tr[1].x-x)))*rad2deg)+90) mod 360*/ - { - if (tr[1].x < with.x) - bearing_result = trunc(atan((real)((tr[1].y - with.y)) / (tr[1].x - with.x)) * rad2deg) + 90; - else - bearing_result = trunc(atan((real)((tr[1].y - with.y)) / (tr[1].x - with.x)) * rad2deg) + 270; - } - } - return bearing_result; -} - -void flesh_colours() /* assembler; -asm - mov ax,$1012; - mov bx,21; { 21 = light pink (why?) } - mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; - - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. } - int $10; - - jmp @TheEnd; - - @flesh: - db 56,35,35; - - @darkflesh: - db 43,22,22; - - @TheEnd: */ -{ -} - -void sprite_run() -/* A sprite run is performed before displaying a scroll, if not all the - sprites are still. It performs two fast cycles, only using a few of - the links usually used, and without any extra animation. This should - make the sprites the same on both pages. */ -{ - byte fv; - - - doing_sprite_run = true; - - for (fv = 0; fv <= 1; fv ++) { - get_back_loretta(); - trippancy_link(); - - flip_page(); - } - - doing_sprite_run = false; - -} - -void fix_flashers() { - ledstatus = 177; - oldrw = 177; - state(2); - showrw(); -} - -class unit_lucerna_initialize { -public: - unit_lucerna_initialize(); -}; -static unit_lucerna_initialize lucerna_constructor; - -unit_lucerna_initialize::unit_lucerna_initialize() { - fxhidden = false; - oh = 17717; - om = 17717; - if (atbios) atkey = "f1"; - else atkey = "alt-"; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h deleted file mode 100644 index 80f57d468b81..000000000000 --- a/engines/avalanche/lucerna.h +++ /dev/null @@ -1,106 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __lucerna_h__ -#define __lucerna_h__ - -namespace Avalanche { - -#include "gyro.h" - - -void callverb(char n); - -void draw_also_lines(); - -void mouse_init(); - -void mousepage(word page_); - -void load(byte n); - -void exitroom(byte x); - -void enterroom(byte x, byte ped); - -void thinkabout(char z, boolean th); /* Hey!!! Get it and put it!!! */ - -void load_digits(); /* Load the scoring digits & rwlites */ - -void toolbar(); - -void showscore(); - -void points(byte num); /* Add on no. of points */ - -void mouseway(); - -void inkey(); - -void posxy(); - -void fxtoggle(); - -void objectlist(); - -void checkclick(); - -void errorled(); - -void dusk(); - -void dawn(); - -void showrw(); - -void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t); /* The Minstrel Blitter */ - -void blitfix(); - -void clock(); - -void flip_page(); - -void delavvy(); - -void gameover(); - -void minor_redraw(); - -void major_redraw(); - -word bearing(byte whichped); - -void flesh_colours(); - -void sprite_run(); - -void fix_flashers(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/magic2.cpp b/engines/avalanche/magic2.cpp deleted file mode 100644 index c3822a392a99..000000000000 --- a/engines/avalanche/magic2.cpp +++ /dev/null @@ -1,66 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -const longint pagetop = 81920; -const word nextcode = 17717; - -integer gd, gm; -file magic, out; -word next, gg; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(magic, "v:magicirc.avd"); - reset(magic); - assign(out, "v:magic2.avd"); - rewrite(out); - move(mem[0xa000 * 0], mem[0xa000 * pagetop], 16000); - while (! eof(magic)) { - magic >> next; - if (next != nextcode) - mem[0xa000 * next] = 255; - else { - for (gg = 0; gg <= 16000; gg ++) - if (mem[0xa000 * gg] != mem[0xa000 * gg + pagetop]) - out << gg; - out << nextcode; - move(mem[0xa000 * 0], mem[0xa000 * pagetop], 16000); - } - } - close(magic); - close(out); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magidraw.cpp b/engines/avalanche/magidraw.cpp deleted file mode 100644 index 32f85108f29c..000000000000 --- a/engines/avalanche/magidraw.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const word nextcode = 17717; - -integer gd, gm; -untyped_file magic; /* of word;*/ -word next; -array<1, 16401, word> buffer; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(magic, "v:magic2.avd"); - reset(magic, 1); - blockread(magic, buffer, sizeof(buffer)); - close(magic); - /* while not eof(magic) do*/ - for (gd = 1; gd <= 16401; gd ++) { - /* read(magic,next); - if next<>nextcode then*/ - if (buffer[gd] != nextcode) - mem[0xa000 * buffer[gd]] = 255; - else - delay(1); - } - /* close(magic);*/ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/magishuf.cpp b/engines/avalanche/magishuf.cpp deleted file mode 100644 index 9d7edd76a5c2..000000000000 --- a/engines/avalanche/magishuf.cpp +++ /dev/null @@ -1,92 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -const word nextcode = 17717; - -typedef array<1, 8000, word> big; -typedef array<1, 16401, word> circle; - -big b; -file f; -registers r; -word gd; -circle c; -file fc; - -void melt(byte c) { - for (gd = 1; gd <= 8000; gd ++) { - mem[0xa000 * b[gd]] = c; - if ((gd % 17) == 0) delay(1); - } -} - -void magicirc(byte cc) { - for (gd = 1; gd <= 16401; gd ++) { - if (c[gd] != nextcode) { - if (odd(c[gd])) mem[0xa000 * c[gd] / 2] = cc; - } else - delay(1); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - r.ax = 13; - intr(0x10, r); - assign(f, "d:shuffle.avd"); - reset(f); - f >> b; - close(f); - assign(fc, "v:magic2.avd"); - reset(fc); - fc >> c; - close(fc); - /* repeat - melt(170); magicirc(85); - magicirc(170); melt(85); - magicirc(170); magicirc(85); - melt(170); melt(85); - until keypressed;*/ - do { - melt(255); - magicirc(0); - magicirc(255); - melt(0); - magicirc(255); - magicirc(0); - melt(255); - melt(0); - } while (!keypressed()); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/make!.cpp b/engines/avalanche/make!.cpp deleted file mode 100644 index 4a4b2740098b..000000000000 --- a/engines/avalanche/make!.cpp +++ /dev/null @@ -1,98 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Phew! */ -#include "graph.h" - -namespace Avalanche { - -/*$S-*/ -integer gd, gm; -untyped_file f; -text t; -string x; - -boolean subpix(integer x, integer y) { - boolean subpix_result; - subpix_result = getpixel(x, y) == 15; - return subpix_result; -} - -byte pixel(integer x, integer y) { - byte pixel_result; - pixel_result = (byte)( - subpix(x * 4, y * 2) || - subpix(x * 4 + 1, y * 2) || - subpix(x * 4 + 2, y * 2) || - subpix(x * 4 + 3, y * 2) || - subpix(x * 4, y * 2 + 1) || - subpix(x * 4 + 1, y * 2 + 1) || - subpix(x * 4 + 2, y * 2 + 1) || - subpix(x * 4 + 3, y * 2 + 1) - ) * 15; - return pixel_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, "o:"); - assign(f, "v:logo.avd"); - reset(f, 1); - for (gd = 0; gd <= 180; gd ++) - blockread(f, mem[0xa000 * (gd * 80)], 53); - close(f); - for (gd = 1; gd <= 106; gd ++) - for (gm = 0; gm <= 145; gm ++) - putpixel(gd, gm + 181, pixel(gd, gm)); - assign(t, "d:avalot.txt"); - rewrite(t); - for (gm = 1; gm <= 36; gm ++) { - x = ""; - for (gd = 1; gd <= 106; gd ++) - switch (getpixel(gd, gm * 2 + 181) * 2 + getpixel(gd, gm * 2 + 182)) { - case 0: - x = x + ' '; - break; - case 15: - x = x + ''; - break; - case 30: - x = x + ''; - break; - case 45: - x = x + ''; - break; - } - t << x << NL; - } - close(t); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makeregi.cpp b/engines/avalanche/makeregi.cpp deleted file mode 100644 index f3b5c4cb0787..000000000000 --- a/engines/avalanche/makeregi.cpp +++ /dev/null @@ -1,176 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* regname's name starts at $7D1 (2001). */ - -namespace Avalanche { - -const array<1, 56, char> padding = - "For all the Etruscan armies were ranged beneath his eye"; - -text txi, txo; -string x, y; -word fv; -file f; -byte sum, n; -string name, number; - -string chkname, chknum, regname, regnum; - - -char decode1(char c) { - byte b; - - char decode1_result; - b = ord(c) - 32; - decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; -} - -char encode1(char c) { - byte b; - - char encode1_result; - b = ord(c); - b = ((cardinal)(b & 0x78) >> 3) + ((b & 0x7) << 4); - encode1_result = chr(b + 32); - return encode1_result; -} - -char encode2(char c) { - char encode2_result; - encode2_result = chr((((ord(c) & 0xf) << 2) + 0x43)); - return encode2_result; -} - -string enc1(string x) { - string y; - byte fv; - - string enc1_result; - y = x; - for (fv = 1; fv <= length(y); fv ++) y[fv] = encode1(y[fv]); - enc1_result = y; - return enc1_result; -} - -string enc2(string x) { - string y; - byte fv; - - string enc2_result; - y = x; - for (fv = 1; fv <= length(y); fv ++) y[fv] = encode2(y[fv]); - enc2_result = y; - return enc2_result; -} - -boolean checker(string proper, string check) { - byte fv; - boolean ok; - - boolean checker_result; - ok = true; - for (fv = 1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) - ok = false; - - checker_result = ok; - return checker_result; -} - -void unscramble() { - byte namelen, numlen; - - - namelen = 107 - ord(x[1]); - numlen = 107 - ord(x[2]); - - regname = copy(x, 3, namelen); - regnum = copy(x, 4 + namelen, numlen); - chkname = copy(x, 4 + namelen + numlen, namelen); - chknum = copy(x, 4 + namelen + numlen + namelen, numlen); - - for (fv = 1; fv <= namelen; fv ++) regname[fv] = decode1(regname[fv]); - for (fv = 1; fv <= numlen; fv ++) regnum[fv] = decode1(regnum[fv]); - - if ((! checker(regname, chkname)) || (! checker(regnum, chknum))) { - output << "CHECK ERROR: " << regname << '/' << chkname << ';' << regnum << '/' << chknum << '.' << NL; - exit(0); - } else output << "--- Passed both checks. ---" << NL; -} - -int main(int argc, const char *argv[]) { - - pio_initialize(argc, argv); - output << "Name? "; - input >> name >> NL; - output << "Number? "; - input >> number >> NL; - - x = string(chr(107 - ord(name[0]))) + chr(107 - ord(number[0])); - - - x = x + enc1(name) + 'J' + enc1(number) + enc2(name) + enc2(number); - - number = ""; - fv = 1; - while ((length(number) + length(x)) < 57) { - number = number + padding[fv - 1]; - fv = fv + 1; - } - x = x + enc1(number); - - - output << x << NL; - output << NL; - unscramble(); - - assign(txi, "v:register.raw"); - reset(txi); - assign(txo, "a:register.dat"); - rewrite(txo); - - for (fv = 1; fv <= 53; fv ++) { - txi >> y >> NL; - txo << y << NL; - } - - txi >> y >> NL; - txo << x << NL; - - while (! eof(txi)) { - txi >> y >> NL; - txo << y << NL; - } - - close(txi); - close(txo); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makesez.cpp b/engines/avalanche/makesez.cpp deleted file mode 100644 index cba5b61b5bd9..000000000000 --- a/engines/avalanche/makesez.cpp +++ /dev/null @@ -1,74 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -struct sezheader { - array<1, 2, char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all scroll chains */ -}; - -const string crlf = string('\15') + '\12'; -const string tabs = string('\11') + '\11' + '\11' + '\11' + '\11' + '\11' + '\11'; -const char eof_ = '\32'; - -untyped_file sez; -sezheader header; -string x; -char check; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - fillchar(x, sizeof(x), '\261'); - x = string("This is a Sez file for an Avvy game, and its contents are subject") + crlf + - "to copyright. Have fun with the game!" + crlf + crlf + tabs + "tt" + crlf + crlf + - "[Lord Avalot D'Argent]" + crlf + crlf + eof_ + - crlf + crlf + "Thomas was here!"; - { - header.initials = "TT"; - header.gamecode = 2; /* code for Avalot */ - header.revision = 100; /* version 1.00 */ - header.chains = 0; /* no chains */ - header.size = 0; /* empty! */ - } - check = '\261'; - assign(sez, "avalot.sez"); - rewrite(sez, 1); - blockwrite(sez, x[1], 255); - blockwrite(sez, header, sizeof(header)); - blockwrite(sez, check, 1); - x = string('\0') + '\0' + '\0' + "Thomas was here, too!" + crlf + crlf + "Good luck..."; - blockwrite(sez, x[1], 39); /* footer */ - close(sez); - return EXIT_SUCCESS; -} - - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/makevmou.cpp b/engines/avalanche/makevmou.cpp deleted file mode 100644 index 4d3b3ba22f4d..000000000000 --- a/engines/avalanche/makevmou.cpp +++ /dev/null @@ -1,303 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Squeak.h"*/ -/*#include "Crt.h"*/ - -/*$R+*/ -namespace Avalanche { - -struct mp { /* mouse-pointer */ - matrix<0, 1, 0, 15, word> mask; - integer horzhotspot, verthotspot; -}; - -struct vmctype { /* Virtual Mouse Cursor */ - pointer andpic, xorpic; - array<0, 1, pointer> backpic; - array<0, 1, pointtype> wherewas; - byte picnumber; - shortint ofsx, ofsy; -}; - -const array<1, 9, arrowtype> mps = { - { { - /* 1 - up-arrow */ - ((65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575), - (0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0)), - 8, - 0 - }, - - { - /* 2 - screwdriver */ - ((8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523), - (0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0)), - 0, - 0 - }, - - { - /* 3 - right-arrow */ - ((65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535), - (0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0)), - 15, - 6 - }, - - { - /* 4 - fletch */ - ((255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511), - (0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0)), - 0, - 0 - }, - - { - /* 5 - hourglass */ - ((0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0), - (0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0)), - 8, - 7 - }, - - { - /* 6 - TTHand */ - ((62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443), - (3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092)), - 4, - 0 - }, - - { - /* 7- Mark's crosshairs */ - ((65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535), - (0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0)), - 8, - 5 - }, - - { - /* 8- I-beam. */ - ((65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535), - (0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0)), - 8, - 7 - }, - - { - /* 9- Question mark. */ - ((511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695), - (65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840)), - 0, - 0 - } - } -}; - -const integer mouse_size = 134; - -const array<1, 134, char> mice_header = - string("Mouse file copyright (c) 1993. I saw a mouse! Where? SQUEEAAAKK!!! Cheese ") + /* 74 */ - "cheese cheese. Cheddar, Stilton, Double Gloucester. Squeak." +'\32'; /* 60 */ - -integer gd, gm; -matrix<0, 50, 1, 40, word> a /*absolute $A000:0i*/; -byte fv; -vmctype vmc; -byte plot; -integer plx, ply; - -word swapbits(word a) { - word swapbits_result; - swapbits_result = lo(a) * 256 + hi(a); - return swapbits_result; -} - -void plot_vmc(integer xx, integer yy, byte page_) { - { - xx = xx + vmc.ofsx; - yy = yy + vmc.ofsy; - - getimage(xx, yy, xx + 15, yy + 15, vmc.backpic[page_]); - putimage(xx, yy, vmc.andpic, andput); - putimage(xx, yy, vmc.xorpic, xorput); - { - pointtype &with1 = vmc.wherewas[page_]; - with1.x = xx; - with1.y = yy; - } - } -} - -void wipe_vmc(byte page_) { - { - pointtype &with1 = vmc.wherewas[page_]; - if (with1.x != maxint) - putimage(with1.x, with1.y, vmc.backpic[page_], 0); - } -} - -void setup_vmc() { - byte fv; - /* gd:=imagesize(0,0,15,15);*/ - - { - getmem(vmc.andpic, mouse_size); - getmem(vmc.xorpic, mouse_size); - - for (fv = 0; fv <= 1; fv ++) { - getmem(vmc.backpic[fv], mouse_size); - vmc.wherewas[fv].x = maxint; - } - } -} - -void show_off_mouse() { - - setcolor(14); - settextstyle(0, 0, 2); - - for (gm = 0; gm <= 1; gm ++) { - setactivepage(gm); - setfillstyle(1, blue); - bar(0, 0, getmaxx(), getmaxy()); - outtextxy(400, 20, chr(48 + gm)); - } - - gd = 0; - do { - setactivepage(gd); - setvisualpage(1 - gd); - gd = 1 - gd; - - delay(56); - - getbuttonstatus; - wipe_vmc(gd); - - if (plot > 0) { - putpixel(plx, ply, red); - plot -= 1; - } - - plot_vmc(mx, my, gd); - - if ((mkey == left) && (plot == 0)) { - plot = 2; - plx = mx; - ply = my; - } - - } while (!(mkey == right)); - - for (gm = 0; gm <= 1; gm ++) { - setactivepage(1 - gm); - wipe_vmc(gm); - } - - setvisualpage(0); - setactivepage(0); -} - -void grab_cursor(byte n) { - getimage(32 * n - 16, 0, 32 * n - 1, 15, vmc.andpic); - getimage(32 * n - 16, 20, 32 * n - 1, 35, vmc.xorpic); -} - -void save_mice() { - untyped_file f; - byte fv; - assign(f, "v:mice.avd"); - rewrite(f, 1); - - blockwrite(f, mice_header, mouse_size); - - for (fv = 1; fv <= 9; fv ++) { - grab_cursor(fv); - putimage(100, 100, vmc.xorpic, 0); - blockwrite(f, vmc.andpic, mouse_size); - blockwrite(f, vmc.xorpic, mouse_size); - } - - close(f); -} - -void load_a_mouse(byte which) { - untyped_file f; - assign(f, "v:mice.avd"); - reset(f, 1); - seek(f, mouse_size * 2 * (which - 1) + 134); - - { - blockread(f, vmc.andpic, mouse_size); - blockread(f, vmc.xorpic, mouse_size); - close(f); - { - void &with1 = mps[which]; - vmc.ofsx = -horzhotspot; - vmc.ofsy = -verthotspot; - - setminmaxhorzcurspos(horzhotspot, 624 + horzhotspot); - setminmaxvertcurspos(verthotspot, 199); - } - } - -} - -void draw_mouse_cursors() { - for (fv = 1; fv <= 9; fv ++) - for (gm = 0; gm <= 1; gm ++) - for (gd = 0; gd <= 15; gd ++) - a[gd + gm * 20][fv * 2] = swapbits(mps[fv].mask[gm][gd]); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - resetmouse; - setup_vmc(); - - draw_mouse_cursors(); - - - save_mice(); - - /* grab_cursor(3);*/ - /* load_a_mouse(4); - setgraphicscursor(mps[4]); - - show_off_mouse; - on; repeat getbuttonstatus until mkey=left; off; - show_off_mouse;*/ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/menuxf.cpp b/engines/avalanche/menuxf.cpp deleted file mode 100644 index 704d6eb26022..000000000000 --- a/engines/avalanche/menuxf.cpp +++ /dev/null @@ -1,81 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; - -void load() { /* Load2, actually */ - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - assign(f, "maintemp.avd"); - reset(f, 1); - /* Compression method byte follows this... */ - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void save() { - byte bit; - untyped_file f; - - assign(f, "v:mainmenu.avd"); - rewrite(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, mem[0xa000 * 48 * 80], 59 * 80); - } - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - load(); /* Between 48 and 107. */ - - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/minstran.cpp b/engines/avalanche/minstran.cpp deleted file mode 100644 index b60796461f4a..000000000000 --- a/engines/avalanche/minstran.cpp +++ /dev/null @@ -1,77 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -pointer p; -word s; - -void mblit(integer x1, integer y1, integer x2, integer y2) { /* Minstrel Blitter */ - integer yy, len, pp; - byte bit; - const integer offset = 16384; - x1 = x1 / 8; - len = ((x2 / 8) - x1) + 1; - for (yy = y1; yy <= y2; yy ++) { - pp = yy * 80 + x1; - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[0xa000 * offset + pp], mem[0xa000 * pp], len); - } - } -} - -const integer fx1 = 100; -const integer fy1 = 100; -const integer fx2 = 135; -const integer fy2 = 145; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - setactivepage(1); - setfillstyle(7, 9); - bar(0, 0, 640, 200); - mblit(fx1, fy1, fx2, fy2); - s = imagesize(fx1, fy1, fx2, fy2); - getmem(p, s); - getimage(fx1, fy1, fx2, fy2, p); - setactivepage(0); - putimage(fx1 + 100, fy1, p, 0); - freemem(p, s); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/newsprit.cpp b/engines/avalanche/newsprit.cpp deleted file mode 100644 index 579799a2bd0e..000000000000 --- a/engines/avalanche/newsprit.cpp +++ /dev/null @@ -1,153 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const string crlf = string('\15') + '\12'; -const char eof_ = '\32'; -const array<1, 177, char> trip5head = - string("Sprite*.AVD ... data file for Trippancy Five") + crlf + crlf + - "[Thorsoft relocatable fiveplane sprite image format]" + crlf + crlf + - "Thomas Thurman was here. ... Have fun!" + crlf + crlf + eof_ + - " * G. I. E. D. ! * "; - -const array<1, 4, char> tripid = string('\x30') + '\x1' + '\x75' + '\261'; - -const array<1, 50, char> trip5foot = crlf + crlf + - " and that's it! Enjoy the game. " + '\3' + crlf + crlf + - "\n\n\n\n\n\n\n" + "tt"; - -struct adxotype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ -}; - -varying_string<2> sn; -adxotype oa; -adxtype a; -matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ -array<1, 16000, byte> aa; -untyped_file out; -integer bigsize; - -void copyaoa() { - { - a.name = oa.name; - a.comment = "Transferred"; - a.num = oa.num; - a.xl = oa.xl; - a.yl = oa.yl; - a.seq = oa.seq; - a.size = oa.size; - a.fgc = oa.fgc; - a.bgc = oa.bgc; - } -} - -void setup() { - integer gd, gm; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); -} - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void save() { - byte sort, n; - word fv, ff; - char r; - byte xw; - byte nxl, nyl; - word soa; - cleardevice(); - { - a.xl = 45; - a.yl = 10; - a.num = 1; - a.seq = 1; - a.size = imagesize(0, 0, a.xl, a.yl); - soa = sizeof(a); - - assign(out, "v:sprite10.avd"); - rewrite(out, 1); - blockwrite(out, trip5head, 177); - blockwrite(out, tripid, 4); - blockwrite(out, soa, 2); - blockwrite(out, a, soa); - - nxl = a.xl; - nyl = a.yl; - xw = nxl / 8; - if ((nxl % 8) > 0) xw += 1; - - for (n = 1; n <= a.num; n ++) { - getimage(0, 0, a.xl, a.yl, aa); - for (fv = 0; fv <= nyl; fv ++) - blockwrite(out, aa[5 + fv * xw * 4], xw); - - getimage(100, 0, 100 + a.xl, a.yl, aa); - blockwrite(out, aa[5], a.size - 6); - } - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - save(); - - blockwrite(out, trip5foot, 50); - close(out); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp deleted file mode 100644 index 9c1f2c6a23f1..000000000000 --- a/engines/avalanche/nim.cpp +++ /dev/null @@ -1,482 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -const array > names = {{"Avalot", "Dogfood"}}; - -array<1, 3, byte> old, stones; -array<0, 3, 0, 22, 1, 7, byte> stonepic; /* picture of Nimstone */ -byte turns; -boolean dogfoodsturn; -byte fv; -byte stonesleft; - -boolean clicked; - -byte row, number; - -boolean squeak; -shortint mnum, mrow; - -registers r; - -void resetmouse() { - r.ax = 0; - intr(0x33, r); - squeak = r.ax > 0; -} - -void show() { - r.ax = 1; - intr(0x33, r); -} - -void hide() { - r.ax = 2; - intr(0x33, r); -} - -void chalk(integer x, integer y, string z) { - const array<0, 3, byte> greys = {{0, 8, 7, 15}}; - byte fv; - for (fv = 0; fv <= 3; fv ++) { - setcolor(greys[fv]); - outtextxy(x - fv, y, z); - sound(fv * 100 * length(z)); - delay(3); - nosound; - delay(30); - } -} - -void setup() { - untyped_file f; - integer gd, gm; - byte bit; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - assign(f, "c:\\avalot\\nim.avd"); - reset(f, 1); - seek(f, 41); - for (gm = 0; gm <= 22; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, stonepic[bit][gm], 7); - } - for (gd = 1; gd <= 3; gd ++) - for (gm = 0; gm <= 22; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * 3200 + gd * 2800 + gm * 80], 7); - } - for (gm = 0; gm <= 36; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * 400 + 49 + gm * 80], 30); - } - close(f); - - gd = getpixel(0, 0); /* clear codes */ - setcolor(4); - rectangle(394, 50, 634, 197); - setfillstyle(1, 6); - bar(395, 51, 633, 196); - rectangle(10, 5, 380, 70); - bar(11, 6, 379, 69); - setcolor(15); - outtextxy(475, 53, "SCOREBOARD:"); - setcolor(14); - outtextxy(420, 63, "Turn:"); - outtextxy(490, 63, "Player:"); - outtextxy(570, 63, "Move:"); - - for (gd = 1; gd <= 3; gd ++) stones[gd] = gd + 2; - - turns = 0; - dogfoodsturn = true; - - chalk(27, 15, "Take pieces away with:"); - chalk(77, 25, "1) the mouse (click leftmost)"); - chalk(53, 35, "or 2) the keyboard:"); - chalk(220, 35, string('\30') + '/' + '\31' + ": choose row,"); - chalk(164, 45, string("+/- or ") + '\33' + '/' + '\32' + ": more/fewer,"); - chalk(204, 55, "Enter: take stones."); - - row = 1; - number = 1; - fillchar(old, sizeof(old), '\0'); - stonesleft = 12; - resetmouse(); -} - -void plotstone(byte x, byte y) { - byte fv, bit; - word ofs; - ofs = 3200 + y * 2800 + x * 8; - for (fv = 0; fv <= 22; fv ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(stonepic[bit][fv], mem[0xa000 * ofs + fv * 80], 7); - } -} - -void board() { - byte fv, ff; - for (fv = 1; fv <= 3; fv ++) - for (ff = 1; ff <= stones[fv]; ff ++) - plotstone(ff, fv); -} - -void startmove() { - varying_string<2> tstr; - integer ypos; - turns += 1; - str(turns, 2, tstr); - ypos = 63 + turns * 10; - dogfoodsturn = ! dogfoodsturn; - chalk(433, ypos, tstr); - chalk(493, ypos, names[dogfoodsturn]); - old = stones; -} - -void show_changes() { - byte fv, ff, fq; - chalk(573, 63 + turns * 10, string(chr(64 + row)) + chr(48 + number)); - for (fv = 1; fv <= 3; fv ++) - if (old[fv] > stones[fv]) - for (ff = stones[fv] + 1; ff <= old[fv]; ff ++) - for (fq = 0; fq <= 22; fq ++) fillchar(mem[0xa000 * 3200 + fv * 2800 + ff * 8 + fq * 80], 7, '\0'); - stonesleft -= number; -} - -void checkmouse(); - -static void blip() { - sound(1771); - delay(3); - nosound; - clicked = false; -} - -void checkmouse() { - { - ax = 5; - bx = 0; - } - intr(0x33, r); - clicked = r.bx > 0; - if (clicked) { - ; /* The mouse was clicked. Where? */ - mrow = (dx - 38) / 35; - if ((mrow < 1) || (mrow > 3)) blip(); - mnum = stones[mrow] - (cx / 64) + 1; - if ((mnum < 1) || (mnum > (unsigned char)stones[mrow])) blip(); - } -} - -void takesome(); - -static void less() { - if (number > 1) number -= 1; -} - -void takesome() { - char r; - byte sr; - number = 1; - do { - do { - sr = stones[row]; - if (sr == 0) { - row = row % 3 + 1; - number = 1; - } - } while (!(sr != 0)); - if (number > sr) number = sr; - setcolor(1); - rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); - /* Wait for choice */ - show(); - do { - checkmouse(); - } while (!(keypressed() || clicked)); - if (keypressed()) r = upcase(readkey()); - hide(); - - setcolor(0); - rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); - - if (clicked) { - number = mnum; - row = mrow; - return; - } else { - switch (r) { - case '\0': - switch (readkey()) { - case 'H': - if (row > 1) row -= 1; - break; /* Up */ - case 'P': - if (row < 3) row += 1; - break; /* Down */ - case 'K': - number += 1; - break; - case 'M': - less(); - break; - case 'I': - row = 1; - break; /* PgUp */ - case 'Q': - row = 3; - break; /* PgDn */ - case 'G': - number = 5; - break; /* Home- check routine will knock this down to size */ - case 'O': - number = 1; - break; /* End */ - } - break; - case '+': - number += 1; - break; - case '-': - less(); - break; - case RANGE_3('A', 'C'): - row = ord(r) - 64; - break; - case RANGE_5('1', '5'): - number = ord(r) - 48; - break; - case '\15': - return; - break; /* Enter was pressed */ - } - } - } while (!false); -} - -void endofgame() { - char rr; - chalk(595, 63 + turns * 10, "Wins!"); - outtextxy(100, 190, "- - - Press any key... - - -"); - while (keypressed()) rr = readkey(); - do { - ax = 5; - bx = 0; - intr(0x33, r); - } while (!(keypressed() || (bx > 0))); - if (keypressed()) rr = readkey(); -} - -void dogfood(); -/* AI procedure to play the game */ -const matrix<1, 3, 1, 2, byte> other = {{{{2, 3}}, {{1, 3}}, {{1, 2}}}}; - - -static byte live, fv, ff, matches, thisone, where; - -static array<1, 3, byte> r, sr; -static array<1, 3, boolean> inap; - -static boolean lmo; /* Let Me Out! */ - -static byte ooo; /* Odd one out */ - - -static boolean find(byte x) -/* This gives True if there's a pile with x stones in. */ -{ - boolean q; - byte p; - boolean find_result; - q = false; - for (p = 1; p <= 3; p ++) if (stones[p] == x) { - q = true; - inap[p] = true; - } - find_result = q; - return find_result; -} - - - -static void find_ap(byte start, byte stepsize) { - byte ff; - matches = 0; - fillchar(inap, sizeof(inap), '\0'); /* blank 'em all */ - for (ff = 0; ff <= 2; ff ++) if (find(start + ff * stepsize)) matches += 1; - else thisone = ff; - - /* Now.. Matches must be 0, 1, 2, or 3. - 0/1 mean there are no A.P.s here, so we'll keep looking, - 2 means there is a potential A.P. that we can create (ideal!), and - 3 means that we're already in an A.P. (Trouble!). */ - - switch (matches) { - case 2: { - for (ff = 1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ - if (! inap[ff]) ooo = ff; - if (stones[ooo] > (start + thisone * stepsize)) { /* check it's possible! */ - ; /* create an A.P. */ - row = ooo; /* already calculated */ - /* Start+thisone*stepsize will give the amount we SHOULD have here. */ - number = stones[row] - (start + thisone * stepsize); - lmo = true; - return; - } - } - break; - case 3: { - ; /* we're actually IN an A.P! Trouble! Oooh dear. */ - row = r[3]; - number = 1; - lmo = true; - return; /* take 1 from the largest pile */ - } - break; - } -} - -void dogfood() { - boolean sorted; - byte temp; - - live = 0; - lmo = false; - for (fv = 1; fv <= 3; fv ++) { - if (stones[fv] > 0) { - live += 1; - r[live] = fv; - sr[live] = stones[fv]; - } - } - switch (live) { - case 1: { /* Only one is free- so take 'em all */ - row = r[1]; - number = stones[r[1]]; - return; - } - break; - case 2: { /* Two are free- make them equal */ - if (sr[1] > sr[2]) { - row = r[1]; - number = sr[1] - sr[2]; - return; - } else /* T > b */ - if (sr[1] < sr[2]) { - row = r[2]; - number = sr[2] - sr[1]; - return; - } else { /* B > t */ - ; /* B = t... oh no, we've lost! */ - row = r[1]; - number = 1; - return; - } - } - break; - case 3: { /* Ho hum... this'll be difficult! */ - /* There are three possible courses of action when we have 3 lines left: - 1) Look for 2 equal lines, then take the odd one out. - 2) Look for A.P.s, and capitalise on them. - 3) Go any old where. */ - - for (fv = 1; fv <= 3; fv ++) /* Look for 2 equal lines */ - if (stones[other[fv][1]] == stones[other[fv][2]]) { - row = fv; /* this row */ number = stones[fv]; /* all of 'em */ return; - } - - do { - sorted = true; - for (fv = 1; fv <= 2; fv ++) - if (sr[fv] > sr[fv + 1]) { - temp = sr[fv + 1]; - sr[fv + 1] = sr[fv]; - sr[fv] = temp; - temp = r[fv + 1]; - r[fv + 1] = r[fv]; - r[fv] = temp; - sorted = false; - } - } while (!sorted); - /* Now we look for A.P.s ... */ - for (fv = 1; fv <= 3; fv ++) { - find_ap(fv, 1); /* there are 3 "1"s */ - if (lmo) return; /* cut-out */ - } - find_ap(1, 2); /* only "2" possible */ - if (lmo) return; - - /* A.P. search must have failed- use the default move. */ - row = r[3]; - number = 1; - return; - } - break; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - board(); - do { - startmove(); - if (dogfoodsturn) dogfood(); - else takesome(); - stones[row] -= number; - show_changes(); - } while (!(stonesleft == 0)); - endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp deleted file mode 100644 index 7a40e93b2d24..000000000000 --- a/engines/avalanche/nimdraw.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -const string header = string("Datafile for Avalot, copyright (c) 1992.") + '\32'; - -integer gd, gm, x, y; -untyped_file f; -byte bit; - -void plot(char ch, byte x) { - setcolor(blue); - outtextxy(x * 80 + 4, 0, ch); - outtextxy(x * 80 + 10, 0, ch); - setcolor(lightblue); - outtextxy(x * 80 + 5, 0, ch); - outtextxy(x * 80 + 9, 0, ch); - setcolor(darkgray); - outtextxy(x * 80 + 6, 0, ch); - outtextxy(x * 80 + 8, 0, ch); - setcolor(yellow); - outtextxy(x * 80 + 7, 0, ch); -} - -void load() { - byte z; - array<1, 4, pointer> a; - varying_string<12> check; - untyped_file f; - word s; - assign(f, "c:\\avalot\\nimstone.avd"); - reset(f, 1); - seek(f, 85); - z = 3; - s = imagesize(0, 0, getmaxx(), 75); - getmem(a[z], s); - blockread(f, a[z], s); - putimage(0, 7, a[z], 0); - freemem(a[z], s); - close(f); -} - -void spludge(integer x, integer y, string z) { - shortint dx, dy; - setcolor(15); - for (dx = -1; dx <= 1; dx ++) - for (dy = -1; dy <= 1; dy ++) - outtextxy(x + dx, y + dy, z); - setcolor(0); - outtextxy(x, y, z); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - load(); - settextstyle(4, 0, 0); - setusercharsize(2, 1, 1, 1); - plot('A', 1); - plot('B', 2); - plot('C', 3); - /* rectangle(gd*80,7,56+gd*80,29); */ - - setfillstyle(1, 1); - setcolor(9); - fillellipse(97, 104, 6, 4); - fillellipse(321, 104, 6, 4); - fillellipse(97, 131, 6, 4); - fillellipse(321, 131, 6, 4); - bar(97, 100, 321, 134); - bar(92, 104, 326, 131); - setfillstyle(1, 9); - bar(91, 103, 91, 131); - bar(327, 104, 327, 131); - bar(98, 99, 321, 99); - bar(97, 135, 321, 135); - - settextstyle(2, 0, 0); - setusercharsize(20, 10, 11, 10); - spludge(99, 100, "The Ancient Game of"); - settextstyle(1, 0, 0); - setusercharsize(40, 10, 10, 10); - spludge(99, 105, "NIM"); - - /* now save it all! */ - - assign(f, "c:\\avalot\\nim.avd"); - rewrite(f, 1); - blockwrite(f, header[1], length(header)); - for (gd = 0; gd <= 3; gd ++) - for (gm = 7; gm <= 29; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, mem[0xa000 * gd * 10 + gm * 80], 7); - } - for (gm = 99; gm <= 135; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, mem[0xa000 * 11 + gm * 80], 30); - } - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.cpp b/engines/avalanche/nimunit.cpp deleted file mode 100644 index 785dbe6759ed..000000000000 --- a/engines/avalanche/nimunit.cpp +++ /dev/null @@ -1,553 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - NIM UNIT A unit version of the pub game (Nim). */ - -#define __nimunit_implementation__ - - -#include "nimunit.h" - -namespace Avalanche { - -const array > names = {{"Avalot", "Dogfood"}}; - -array<1, 3, byte> old, stones; -array<0, 3, 0, 22, 1, 7, byte> stonepic; /* picture of Nimstone */ -byte turns; -boolean dogfoodsturn; -byte fv; -byte stonesleft; - -boolean clicked; - -byte row, number; - -boolean squeak; -shortint mnum, mrow; - -void chalk(integer x, integer y, string z) { - const array<0, 3, byte> greys = {{0, 8, 7, 15}}; - byte fv; - - for (fv = 0; fv <= 3; fv ++) { - setcolor(greys[fv]); - outtextxy(x - fv, y, z); - sound(fv * 100 * length(z)); - delay(3); - nosound; - delay(30); - } -} - -void setup() { - const integer page3 = 0xac00; - byte gd, gm; - untyped_file f; - byte bit; - - setactivepage(3); - setvisualpage(3); - cleardevice(); - dawn(); - - assign(f, "nim.avd"); - reset(f, 1); - seek(f, 41); - for (gm = 0; gm <= 22; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, stonepic[bit][gm], 7); - } - for (gd = 1; gd <= 3; gd ++) - for (gm = 0; gm <= 22; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[page3 * 3200 + gd * 2800 + gm * 80], 7); - } - for (gm = 0; gm <= 36; gm ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[page3 * 400 + 49 + gm * 80], 30); - } - close(f); - - gd = getpixel(0, 0); /* clear codes */ - setcolor(4); - rectangle(394, 50, 634, 197); - setfillstyle(1, 6); - bar(395, 51, 633, 196); - rectangle(10, 5, 380, 70); - bar(11, 6, 379, 69); - setcolor(15); - outtextxy(475, 53, "SCOREBOARD:"); - setcolor(14); - outtextxy(420, 63, "Turn:"); - outtextxy(490, 63, "Player:"); - outtextxy(570, 63, "Move:"); - - for (gd = 1; gd <= 3; gd ++) stones[gd] = gd + 2; - - turns = 0; - dogfoodsturn = true; - - chalk(27, 15, "Take pieces away with:"); - chalk(77, 25, "1) the mouse (click leftmost)"); - chalk(53, 35, "or 2) the keyboard:"); - chalk(220, 35, string('\30') + '/' + '\31' + ": choose row,"); - chalk(164, 45, string("+/- or ") + '\33' + '/' + '\32' + ": more/fewer,"); - chalk(204, 55, "Enter: take stones."); - - row = 1; - number = 1; - fillchar(old, sizeof(old), '\0'); - stonesleft = 12; - - /* Set up mouse. */ - off_virtual(); - oncandopageswap = false; - - setactivepage(3); - setvisualpage(3); -} - -void plotstone(byte x, byte y) { - byte fv, bit; - word ofs; - - ofs = 3200 + y * 2800 + x * 8; - for (fv = 0; fv <= 22; fv ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(stonepic[bit][fv], mem[0xac00 * ofs + fv * 80], 7); - } -} - -void board() { - byte fv, ff; - - for (fv = 1; fv <= 3; fv ++) - for (ff = 1; ff <= stones[fv]; ff ++) - plotstone(ff, fv); -} - -void startmove() { - varying_string<2> tstr; - integer ypos; - - turns += 1; - str(turns, 2, tstr); - ypos = 63 + turns * 10; - dogfoodsturn = ! dogfoodsturn; - chalk(433, ypos, tstr); - chalk(493, ypos, names[dogfoodsturn]); - old = stones; -} - -void show_changes() { - byte fv, ff, fq; - varying_string<2> move; - - move = string(chr(64 + row)) + chr(48 + number); - chalk(573, 63 + turns * 10, move); - log_aside(names[dogfoodsturn] + " plays " + move + '.'); - - for (fv = 1; fv <= 3; fv ++) - if (old[fv] > stones[fv]) - for (ff = stones[fv] + 1; ff <= old[fv]; ff ++) - for (fq = 0; fq <= 22; fq ++) fillchar(mem[0xac00 * 3200 + fv * 2800 + ff * 8 + fq * 80], 7, '\0'); - stonesleft -= number; -} - -void checkmouse(); - -static void blip() { - note(1771); - delay(3); - nosound; - clicked = false; -} - -void checkmouse() { - xycheck(); /* Check the mouse */ - clicked = keystatus > 0; - if (clicked) { - void &with = r; - /* The mouse was clicked. Where? */ - mrow = (my - 38) / 35; - if ((mrow < 1) || (mrow > 3)) blip(); - mnum = stones[mrow] - (mx / 64) + 1; - if ((mnum < 1) || (mnum > (unsigned char)stones[mrow])) blip(); - } -} - -void takesome(); - -static void less() { - if (number > 1) number -= 1; -} - -void takesome() { - char r; - byte sr; - - number = 1; - do { - do { - sr = stones[row]; - if (sr == 0) { - row = row % 3 + 1; - number = 1; - } - } while (!(sr != 0)); - if (number > sr) number = sr; - setcolor(1); - rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); - /* Wait for choice */ - on(); - do { - checkmouse(); - } while (!(keypressed() || clicked)); - if (keypressed()) r = upcase(readkey()); - off(); - - setcolor(0); - rectangle(63 + (sr - number) * 64, 38 + 35 * row, 54 + sr * 64, 63 + 35 * row); - - if (clicked) { - number = mnum; - row = mrow; - return; - } else { - switch (r) { - case '\0': - switch (readkey()) { - case 'H': - if (row > 1) row -= 1; - break; /* Up */ - case 'P': - if (row < 3) row += 1; - break; /* Down */ - case 'K': - number += 1; - break; - case 'M': - less(); - break; - case 'I': - row = 1; - break; /* PgUp */ - case 'Q': - row = 3; - break; /* PgDn */ - case 'G': - number = 5; - break; /* Home- check routine will knock this down to size */ - case 'O': - number = 1; - break; /* End */ - } - break; - case '+': - number += 1; - break; - case '-': - less(); - break; - case RANGE_3('A', 'C'): - row = ord(r) - 64; - break; - case RANGE_5('1', '5'): - number = ord(r) - 48; - break; - case '\15': - return; - break; /* Enter was pressed */ - } - } - } while (!false); -} - -void endofgame() { - char rr; - - chalk(595, 63 + turns * 10, "Wins!"); - outtextxy(100, 190, "- - - Press any key... - - -"); - while (keypressed()) rr = readkey(); - do { - check(); - } while (!(mpress == 0)); - - { - void &with = r; - do { - check(); - } while (!(keypressed() || (mrelease > 0))); - } - if (keypressed()) rr = readkey(); - - mousepage(cp); - off(); - on_virtual(); -} - -void dogfood(); -/* AI procedure to play the game */ -const matrix<1, 3, 1, 2, byte> other = {{{{2, 3}}, {{1, 3}}, {{1, 2}}}}; - - -static byte live, fv, ff, matches, thisone, where; - -static array<1, 3, byte> r, sr; -static array<1, 3, boolean> inap; - -static boolean lmo; /* Let Me Out! */ - -static byte ooo; /* Odd one out */ - - -static boolean find(byte x) -/* This gives True if there's a pile with x stones in. */ -{ - boolean q; - byte p; - - boolean find_result; - q = false; - for (p = 1; p <= 3; p ++) if (stones[p] == x) { - q = true; - inap[p] = true; - } - find_result = q; - return find_result; -} - - - -static void find_ap(byte start, byte stepsize) { - byte ff; - - matches = 0; - fillchar(inap, sizeof(inap), '\0'); /* blank 'em all */ - for (ff = 0; ff <= 2; ff ++) if (find(start + ff * stepsize)) matches += 1; - else thisone = ff; - - /* Now.. Matches must be 0, 1, 2, or 3. - 0/1 mean there are no A.P.s here, so we'll keep looking, - 2 means there is a potential A.P. that we can create (ideal!), and - 3 means that we're already in an A.P. (Trouble!). */ - - switch (matches) { - case 2: { - for (ff = 1; ff <= 3; ff ++) /* find which one didn't fit the A.P. */ - if (! inap[ff]) ooo = ff; - if (stones[ooo] > (start + thisone * stepsize)) { /* check it's possible! */ - /* create an A.P. */ - row = ooo; /* already calculated */ - /* Start+thisone*stepsize will give the amount we SHOULD have here. */ - number = stones[row] - (start + thisone * stepsize); - lmo = true; - return; - } - } - break; - case 3: { /* we're actually IN an A.P! Trouble! Oooh dear. */ - row = r[3]; - number = 1; - lmo = true; - return; /* take 1 from the largest pile */ - } - break; - } -} - -void dogfood() { - boolean sorted; - byte temp; - - - live = 0; - lmo = false; - for (fv = 1; fv <= 3; fv ++) { - if (stones[fv] > 0) { - live += 1; - r[live] = fv; - sr[live] = stones[fv]; - } - } - switch (live) { - case 1: { /* Only one is free- so take 'em all */ - row = r[1]; - number = stones[r[1]]; - return; - } - break; - case 2: { /* Two are free- make them equal */ - if (sr[1] > sr[2]) { - row = r[1]; - number = sr[1] - sr[2]; - return; - } else /* T > b */ - if (sr[1] < sr[2]) { - row = r[2]; - number = sr[2] - sr[1]; - return; - } else { /* B > t */ - row = r[1]; /* B = t... oh no, we've lost! */ - number = 1; - return; - } - } - break; - case 3: { /* Ho hum... this'll be difficult! */ - /* There are three possible courses of action when we have 3 lines left: - 1) Look for 2 equal lines, then take the odd one out. - 2) Look for A.P.s, and capitalise on them. - 3) Go any old where. */ - - for (fv = 1; fv <= 3; fv ++) /* Look for 2 equal lines */ - if (stones[other[fv][1]] == stones[other[fv][2]]) { - row = fv; /* this row */ number = stones[fv]; /* all of 'em */ return; - } - - do { - sorted = true; - for (fv = 1; fv <= 2; fv ++) - if (sr[fv] > sr[fv + 1]) { - temp = sr[fv + 1]; - sr[fv + 1] = sr[fv]; - sr[fv] = temp; - temp = r[fv + 1]; - r[fv + 1] = r[fv]; - r[fv] = temp; - sorted = false; - } - } while (!sorted); - /* Now we look for A.P.s ... */ - for (fv = 1; fv <= 3; fv ++) { - find_ap(fv, 1); /* there are 3 "1"s */ - if (lmo) return; /* cut-out */ - } - find_ap(1, 2); /* only "2" possible */ - if (lmo) return; - - /* A.P. search must have failed- use the default move. */ - row = r[3]; - number = 1; - return; - } - break; - } -} - -void play_nim() /* Plays the game. Only procedure in this unit to - be declared in the interface section. */ -{ - byte groi; - - if (dna.wonnim) { - /* Already won the game. */ - dixi('Q', 6); - return; - } - - if (! dna.asked_dogfood_about_nim) { - dixi('q', 84); - return; - } - - dixi('Q', 3); - dna.playednim += 1; - dusk(); - oncandopageswap = false; - copypage(3, 1 - cp); /* Store old screen. */ groi = getpixel(0, 0); - off(); - - setup(); - board(); - on(); - mousepage(3); - - do { - startmove(); - if (dogfoodsturn) dogfood(); - else takesome(); - stones[row] -= number; - show_changes(); - } while (!(stonesleft == 0)); - endofgame(); /* Winning sequence is A1, B3, B1, C1, C1, btw. */ - - dusk(); - off(); - oncandopageswap = true; - copypage(1 - cp, 3); /* Restore old screen. */ groi = getpixel(0, 0); - on(); - dawn(); - - if (dogfoodsturn) { - /* Dogfood won - as usual */ - log_aside("He won."); - if (dna.playednim == 1) /* Your first game */ - dixi('Q', 4); /* Goody! Play me again? */ - else - dixi('Q', 5); /* Oh, look at that! I've won again! */ - pennycheck(4); /* And you've just lost 4d! */ - } else { - /* You won - strange! */ - log_aside("You won."); - dixi('Q', 7); /* You won! Give us a lute! */ - dna.obj[lute] = true; - objectlist(); - dna.wonnim = true; - show_one(1); /* Show the settle with no lute on it. */ - points(7); /* 7 points for winning! */ - } - - if (dna.playednim == 1) points(3); /* 3 points for playing your 1st game. */ - -} - -/* No init part. */ - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/nimunit.h b/engines/avalanche/nimunit.h deleted file mode 100644 index 1397367d16b9..000000000000 --- a/engines/avalanche/nimunit.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __nimunit_h__ -#define __nimunit_h__ - -#include "gyro.h" -#include "Graph.h" -/*#include "Crt.h"*/ -#include "pingo.h" -#include "visa.h" -#include "lucerna.h" -#include "logger.h" -#include "celer.h" - -namespace Avalanche { - -void play_nim(); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/oldfiler.cpp b/engines/avalanche/oldfiler.cpp deleted file mode 100644 index e38ec30fa3b0..000000000000 --- a/engines/avalanche/oldfiler.cpp +++ /dev/null @@ -1,307 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -#include "graph.h" -/*#include "Dos.h"*/ -/*#include "Rodent.h"*/ - -/*$V-*/ -namespace Avalanche { - -const char more[] = " (more) "; -const string up = string('-') + '\30' + more + '\30'; -const string down = string('+') + '\31' + more + '\31'; - -const graphcursmasktype fletch = /* Mask 4 in Avalot */ -{ - ( - (255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511), - (0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0)), - 0, - 0 -}; - -string cdir; -matrix<0, 2, 1, 18, varying_string<15> > info; -matrix<0, 2, 1, 100, varying_string<15> > possible; -byte fv; -array<0, 2, byte> light, page_; -array<0, 2, boolean> blank; -byte chtcode, where; -string answer; - -void split(string x) { - byte fv; - x = copy(x, 4, 255); - if (x == "") { - blank[0] = true; - return; - } - x = x + '\\'; - possible[0][1] = "b\\"; - fv = 2; - while (pos("\\", x) != 0) { - possible[0][fv] = string('b') + copy(x, 1, pos("\\", x) - 1); - fv += 1; - x = copy(x, pos("\\", x) + 1, 255); - } - possible[0][fv - 1] = ""; -} - -void block(integer x1, integer y1, integer x2, integer y2, string x) { - bar(x1, y1, x2, y2); - setcolor(9); - outtextxy(x1 + (x2 - x1) / 2 - 1, y1 + 5, x); - setcolor(15); - outtextxy(x1 + (x2 - x1) / 2 + 1, y1 + 6, x); -} - -void message(string x) { - block(5, 189, 640, 200, x); -} - -void bigbar(byte x) { - bar(15 + 210 * x, 36, 210 + 210 * x, 187); -} - -void getem(); - - -static void sub_getem(char prefix, string spec, byte attrib, byte infonum) { - searchrec s; - byte fv; - fv = 0; - findfirst(spec, attrib, s); - while ((doserror == 0) && (fv < 100)) { - if (((s.attr & attrib) > 0) && (s.name[1] != '.')) { - ; /* circumvent inclusive searching! */ - fv += 1; - possible[infonum][fv] = string(prefix) + s.name; - } - findnext(s); - } - if (fv == 0) blank[infonum] = true; -} - -void getem() - -{ - message("Please wait... scanning directory..."); - sub_getem('a', "*.asg", archive + hidden, 1); /* Scan for .ASG files */ - sub_getem('f', "*.*", directory, 2); /* Scan for sub-directories */ -} - -void minisc(string &x) { /* Converts to lower-case */ - byte fv; - for (fv = 1; fv <= length(x); fv ++) - if ((x[fv] >= 'A') && (x[fv] <= 'Z')) x[fv] += 32; -} - -void showall() { - byte fv, ff; - for (fv = 0; fv <= 2; fv ++) { - bigbar(fv); /* blank out anything else */ - if (blank[fv]) { - ; /* nothing here at all */ - /* setcolor(14); - outtextxy(113+210*fv,43,'(Nothing here!)'); */ - setcolor(14); - settextstyle(0, 0, 2); - outtextxy(113 + 210 * fv, 77, "Nothing"); - outtextxy(113 + 210 * fv, 100, "here!"); - settextstyle(0, 0, 1); - } else { - ; /* something here- what? */ - setcolor(11); - for (ff = 0; ff <= 15; ff ++) { - info[fv][ff + 2] = possible[fv][page_[fv] * 15 + ff + 1]; - minisc(info[fv][ff + 2]); - } - if (page_[fv] > 0) info[fv][1] = up; - else info[fv][1] = ""; - if (possible[fv][page_[fv] * 15 + 17] != "") - info[fv][18] = down; - else info[fv][18] = ""; - for (ff = 1; ff <= 18; ff ++) { - outtextxy(113 + 210 * fv, 35 + ff * 8, copy(info[fv][ff], 2, 255)); - } - } - } - block(5, 12, 640, 22, cdir); -} - -void changedir(string x) { - - chdir(x); - getdir(0, cdir); -} - -void drawup() { - integer gd; - block(15, 0, 630, 10, "Choose an .ASG file to load or save."); - block(15, 24, 210, 34, "Looking back:"); - block(225, 24, 420, 34, "Here:"); - block(435, 24, 630, 34, "Looking forwards:"); - for (gd = 0; gd <= 2; gd ++) bigbar(gd); /* just to tide us over the wait... */ - showall(); -} - -void setup() { - settextjustify(1, 1); - setfillstyle(1, 1); - fillchar(blank, sizeof(blank), '\0'); - fillchar(info, sizeof(info), '\0'); - fillchar(possible, sizeof(possible), '\0'); - fillchar(page_, sizeof(page_), '\0'); - split(cdir); - getem(); - drawup(); -} - -void setup1() { - integer gd, gm; - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - answer = ""; - getdir(0, cdir); - resetmouse; - setgraphicscursor(fletch); - fillchar(light, sizeof(light), '\0'); - setup(); -} - -void clickwait() { - const array<1, 4, varying_string<30> > msg = { - { - "change to another drive.", - "return to a lower directory.", - "use the file named.", - "enter a sub-directory." - } - }; - byte oldcht; /* Click Here To... code */ - showmousecursor; - oldcht = 177; - do { - if (mousey < 38) chtcode = 1; - else - switch (mousex) { - case 0 ... 210: - chtcode = 2; - break; - case 211 ... 421: - chtcode = 3; - break; - default: - chtcode = 4; - } - if (oldcht != chtcode) { - hidemousecursor; - message(string("Click here to ") + msg[chtcode]); - showmousecursor; - oldcht = chtcode; - } - } while (!leftmousekeypressed); - hidemousecursor; - where = ((mousey - 39) / 8) + 1; -} - -void blip() { - sound(32); - delay(3); - nosound; -} - -void do_cht() { - char r; - byte fv; - string x; - if (chtcode == 1) { - ; /* change drives */ - message("Enter the drive letter (e.g. A)..."); - r = readkey(); - changedir(string(r) + ':'); - setup(); - } else { - x = info[chtcode - 2][where]; - r = x[1]; - x = copy(x, 2, 255); - switch (r) { - case 'b': { - ; /* back some dirs */ - if (x == '\\') x = ""; - for (fv = where - 1; fv >= 3; fv --) - x = copy(info[0][fv], 2, 255) + '\\' + x; - changedir(string('\\') + x); - setup(); - } - break; - case 'f': { - ; /* sub-directory */ - changedir(x); - setup(); - } - break; - case '+': { - ; /* scroll one panel down */ - page_[chtcode - 2] += 1; - drawup(); - } - break; - case '-': { - ; /* scroll one panel up */ - page_[chtcode - 2] -= 1; - drawup(); - } - break; - case 'a': - answer = x; - break; - } - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup1(); - do { - clickwait(); - do_cht(); - } while (!(answer != "")); - if (length(cdir) > 3) cdir = cdir + '\\'; - answer = cdir + answer; - closegraph(); - output << "Routine completed." << NL; - output << "Answer: " << answer << NL; - output << "Hit Enter:"; - input >> NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldhighs.cpp b/engines/avalanche/oldhighs.cpp deleted file mode 100644 index c95b9a2d91c8..000000000000 --- a/engines/avalanche/oldhighs.cpp +++ /dev/null @@ -1,286 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -struct scoretype { - varying_string<39> name; - word score; -}; - -struct ratetype { - varying_string<10> rank; - word lowest; -}; - -struct tabletype { - array<1, 12, scoretype> a; - byte light; -}; - -const array<1, 9, ratetype> ratings = { - { {"Rubbish", 0}, - {"Beginner", 1}, - {"Poor", 10}, - {"Average", 30}, - {"Fair", 50}, - {"Not bad", 70}, - {"Good", 100}, - {"Great", 200}, - {"Fantastic!", 330} - } -}; - -integer gd, gm; -tabletype table; - -byte ratingname(word x) { - byte fv; - byte ratingname_result; - for (fv = 9; fv >= 1; fv --) - if (x >= ratings[fv].lowest) { - ratingname_result = fv; - return ratingname_result; - } /* bad style */ - return ratingname_result; -} - -void title(); - -const string message = "A v a l o t : H i g h - S c o r e s"; - - -static void sayfast(integer x, integer y) { - integer anchor; - byte fv; - anchor = -296; - for (fv = 1; fv <= length(message); fv ++) { - if (message[fv - 1] != '\40') outtextxy(x + anchor, y - 8, message[fv - 1]); - anchor += 16; - } -} - -void title() { - const array<0, 6, byte> shades = - {{blue, lightgray, darkgray, blue, lightblue, blue, darkgray}}; - byte x; - integer len; - - settextstyle(0, 0, 2); /*settextjustify(1,1);*/ - len = textheight(message); - for (x = 6; x >= 0; x --) { - setcolor(shades[x]); - sayfast(320 - x * 2, 20 - x); - if (x > 0) { - sayfast(320 + x * 2, 20 - x); - sayfast(320 + x * 2, 20 + x); - sayfast(320 - x * 2, 20 + x); - } - } -} - -void newtable() { - const array<1, 12, varying_string<15> > names = { - { - "Mike", "Liz", "Thomas", "Mark", "Mandy", "Andrew", "Lucy Tryphena", "", - "Thanks to all", "who helped...", "", "Have fun!" - } - }; - byte fv; - fillchar(table, sizeof(table), '\261'); - for (fv = 1; fv <= 12; fv ++) { - scoretype &with = table.a[fv]; - with.name = names[fv]; - with.score = 193 - fv * 16; - } - table.light = 1; -} - -string strf(longint x) { /* From Gyro. Delete when integrated. */ - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void sparkle(integer x, integer y, string z) { - setcolor(cyan); - outtextxy(x - 1, y - 1, z); - setcolor(blue); - outtextxy(x + 1, y + 1, z); - setcolor(white); - outtextxy(x , y , z); -} - -void drawtable() { - byte fv, last, now; - setfillstyle(1, 8); - bar(0, 40, 105, 58); - bar(110, 40, 400, 58); - bar(405, 40, 490, 58); - bar(495, 40, 640, 58); - bar(5, 60, 105, 181); - bar(110, 60, 400, 181); - bar(405, 60, 490, 181); - bar(495, 60, 635, 181); - bar(0, 185, 640, 190); - setcolor(lightred); - settextstyle(0, 0, 1); - settextjustify(0, 0); - outtextxy(45, 55, "Number:"); - outtextxy(120, 55, "Name:"); - outtextxy(420, 55, "Score:"); - outtextxy(500, 55, "Rating:"); - setcolor(white); - last = 177; - for (fv = 1; fv <= 12; fv ++) { - scoretype &with = table.a[fv]; - settextjustify(righttext, bottomtext); - sparkle(100, 60 + fv * 10, strf(fv) + '.'); - sparkle(455, 60 + fv * 10, strf(with.score)); - if (fv == table.light) sparkle(70, 60 + fv * 10, string("") + '\20'); - - settextjustify(lefttext, bottomtext); - sparkle(120, 60 + fv * 10, with.name); - now = ratingname(with.score); - if (now != last) - sparkle(510, 60 + fv * 10, ratings[ratingname(with.score)].rank); - else - sparkle(517, 57 + fv * 10, ",,"); - last = now; - } -} - -void message1(string x) { - setfillstyle(1, 8); - bar(0, 190, 640, 200); - settextjustify(1, 1); - sparkle(320, 195, x); -} - -void sorthst() { - byte fv; - boolean ok; - scoretype temp; - do { - ok = true; - for (fv = 1; fv <= 11; fv ++) - if (table.a[fv].score < table.a[fv + 1].score) { - temp = table.a[fv]; - table.a[fv] = table.a[fv + 1]; - table.a[fv + 1] = temp; /* swap 'em */ - table.light = fv; /* must be- that's the only unsorted one */ - ok = false; /* So, we try again. */ - } - } while (!ok); -} - -void entername(); -static integer x, y; - - -static void cursor(byte col) { - setcolor(col); - outtextxy(x, y, "?"); -} - -void entername() { - varying_string<34> i; - char r; - integer counter; - byte flash; - - y = 60 + table.light * 10; - i = ""; - settextjustify(2, 0); - counter = 999; - flash = 0; - do { - x = 128 + length(i) * 8; - do { - counter += 1; - if (counter == 1000) { - cursor(4 + flash * 10); - flash = 1 - flash; - counter = 0; - } - delay(1); - } while (!keypressed()); - cursor(8); - sound(17177); - r = readkey(); - nosound; - if (r == '\10') { - if (i[0] > '\0') { - bar(x - 17, y - 10, x - 8, y); - i[0] -= 1; - sparkle(x - 16, y, i[length(i)]); - } - } else { - if ((i[0] < '\42') && (r != '\15')) { - sparkle(x, y, r); - i = i + r; - } - } - counter = 999; - } while (!(r == '\15')); -} - -void newscore(word sc) { - { - scoretype &with = table.a[12]; - if (sc > with.score) { - with.name = ""; - with.score = sc; - table.light = 10; - sorthst(); - drawtable(); - message1("Well done! Please enter your name, then press Return..."); - entername(); - } else drawtable(); - } /* too low for score */ - message1("Press Space to continue..."); - do { - } while (!(keypressed() && (readkey() == '\40'))); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - title(); - newtable(); - newscore(/*177*/0); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldincln.cpp b/engines/avalanche/oldincln.cpp deleted file mode 100644 index b9b58265bfa6..000000000000 --- a/engines/avalanche/oldincln.cpp +++ /dev/null @@ -1,298 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - INCLINE The command-line parser. */ - -#define __incline_implementation__ - - -#include "oldincln.h" - -#include "gyro.h" -#include "logger.h" - -namespace Avalanche { - -const integer bug_twonames = 255; -const integer bug_pandl = 254; -const integer bug_weirdswitch = 253; -const integer bug_invalidini = 252; -const integer bug_notyesorno = 251; - -byte fv; -char t; -string bugline; -boolean usingp, usingl; -boolean zoomy, numlockhold; - -boolean filename_specified; - -string inihead, initail; /* For reading the .INI file. */ - - -void linebug(byte which) { - output << "AVALOT : "; - switch (which) { - case bug_twonames : - output << "You may only specify ONE filename." << NL; - break; - case bug_pandl : - output << "/p and /l cannot be used together." << NL; - break; - case bug_weirdswitch : - output << "Unknown switch (\"" << bugline << - "\"). Type AVALOT /? for a list of switches." << NL; - break; - case bug_invalidini: - output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; - break; - case bug_notyesorno: - output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; - break; - } - exit(which); -} - -void syntax() { - assign(output, ""); - rewrite(output); - output << NL; - output << string("Lord Avalot d'Argent\n\n(c) ") + copyright + " Mark, Mike and Thomas Thurman." << NL; - output << string("~~~~~~~~~~~~~~~~~~~~~\n\n") + vernum << NL; - output << NL; - output << "Syntax:" << NL; - output << "\n/?\ndisplays this screen," << NL; - output << "\n/O\noverrides EGA check," << NL; - output << "\n/L\nlogs progress to , default AVVY.LOG," << NL; - output << "\n/P\nlogs with Epson codes to , default PRN," << NL; - output << "\n/Q\ncancels sound effects," << NL; - output << "\n/S\ndisables Soundblaster," << NL; - output << "\n/Z\ngoes straight into the game." << NL; - output << NL; - output << "\n\n\n\n\n\n\n... Have fun!" << NL; - exit(177); -} - -void upstr(string &x) { - byte fv; - for (fv = 1; fv <= length(x); fv ++) x[fv] = upcase(x[fv]); -} - -boolean yesno() { - boolean yesno_result; - if (initail == "YES") yesno_result = true; - else if (initail == "NO") yesno_result = false; - else - linebug(bug_notyesorno); - return yesno_result; -} - -void ini_parse() { - upstr(inihead); - upstr(initail); - - if (inihead == "QUIET") soundfx = ! yesno(); - else if (inihead == "ZOOMYSTART") zoomy = yesno(); - else if (inihead == "NUMLOCKHOLD") numlockhold = yesno(); - else if (inihead == "LOADFIRST") filetoload = initail; - else if (inihead == "OVERRIDEEGACHECK") cl_override = yesno(); - else if (inihead == "KEYBOARDCLICK") keyboardclick = yesno(); -} - -void strip_ini() { - byte fv; - if (inihead == "") return; - - /* Firstly, delete any comments. */ - fv = pos(";", inihead); - if (fv > 0) Delete(inihead, fv, 255); - - /* Lose the whitespace... */ - - while (inihead[length(inihead)] == ' ') inihead[0] -= 1; - while ((inihead != "") && (inihead[1] == ' ')) Delete(inihead, 1, 1); - - /* It's possible that now we'll end up with a blank line. */ - - if ((inihead == "") || (inihead[1] == '[')) return; - - fv = pos("=", inihead); - - if (fv == 0) { - ; /* No "="! Weird! */ - bugline = inihead; - linebug(bug_invalidini); - } - - initail = copy(inihead, fv + 1, 255); - inihead[0] = chr(fv - 1); -} - -void load_ini() { - text ini; - assign(ini, "AVALOT.INI"); - reset(ini); - - while (! eof(ini)) { - ini >> inihead >> NL; - strip_ini(); - if (inihead != "") ini_parse(); - } - - close(ini); -} - -void parse(string x); -static string arg; - -static string getarg(string otherwis) { - string getarg_result; - if (arg == "") getarg_result = otherwis; - else getarg_result = ""; - return getarg_result; -} - -void parse(string x) - -{ - switch (x[1]) { - case '/': - case '-': { - arg = copy(x, 3, 255); - switch (upcase(x[2])) { - case '?': - syntax(); - break; - case 'O': - cl_override = true; - break; - case 'L': - if (! usingp) { - log_setup(getarg("avvy.log"), false); - usingl = true; - } else { - close(logfile); - linebug(bug_pandl); - } - break; - case 'P': - if (! usingl) { - log_setup(getarg("prn"), true); - usingp = true; - } else { - close(logfile); - linebug(bug_pandl); - } - break; - case 'Q': - soundfx = false; - break; - case 'Z': - zoomy = true; - break; - case 'K': - keyboardclick = true; - break; - case 'D': - demo = true; - break; - default: { - bugline = x; - linebug(bug_weirdswitch); - } - } - } - break; - case '*': { - inihead = copy(x, 2, 255); - strip_ini(); - if (inihead != "") ini_parse(); - } - break; - default: { - ; /* filename */ - if (filename_specified) - linebug(bug_twonames); - else - filetoload = x; - filename_specified = true; - } - } -} - -void not_through_bootstrap() { - output << "Avalot must be loaded through the bootstrap." << NL; - exit(0); -} - -void get_storage_addr() { - integer e; - - val(paramstr(2), storage_seg, e); - if (e != 0) not_through_bootstrap(); - val(paramstr(3), storage_ofs, e); - if (e != 0) not_through_bootstrap(); - skellern = storage_ofs + 1; -} - -class unit_incline_initialize { -public: - unit_incline_initialize(); -}; -static unit_incline_initialize incline_constructor; - -unit_incline_initialize::unit_incline_initialize() { - filetoload = ""; - usingl = false; - usingp = false; - logging = false; - cl_override = false; - soundfx = true; - zoomy = false; - numlockhold = false; - filename_specified = false; - keyboardclick = false; - - load_ini(); - - if ((paramcount < 3) || - ((paramstr(1) != "Go") && (paramstr(1) != "et"))) not_through_bootstrap(); - - reloaded = paramstr(1) == "et"; - - get_storage_addr(); - - for (fv = 4; fv <= paramcount; fv ++) - parse(paramstr(fv)); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldincln.h b/engines/avalanche/oldincln.h deleted file mode 100644 index 2e872e77bb85..000000000000 --- a/engines/avalanche/oldincln.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __oldincln_h__ -#define __oldincln_h__ - - - -/* This unit has NO externally-callable procedures. Also note that - it MUST be called *first* (so if you load AVALOT.PAS and press f7 - twice you get to the "begin" statement.) */ - -#endif diff --git a/engines/avalanche/oldtrip.cpp b/engines/avalanche/oldtrip.cpp deleted file mode 100644 index 721a3f5a250e..000000000000 --- a/engines/avalanche/oldtrip.cpp +++ /dev/null @@ -1,589 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - TRIP4 Trippancy IV- "Trip Oop". */ - -#define __trip4_implementation__ -/* Trippancy IV (Trip Oop) */ -#include "oldtrip.h" - - -/*#include "Scrolls.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Gyro.h"*/ -/*#include "Dropdown.h"*/ - -namespace Avalanche { - -void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4); - - -static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) -/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{ - boolean dropin_result; - dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); - return dropin_result; -} - - - -static integer lesser(integer a, integer b) { - integer lesser_result; - if (a < b) lesser_result = a; - else lesser_result = b; - return lesser_result; -} - - - -static integer greater(integer a, integer b) { - integer greater_result; - if (a > b) greater_result = a; - else greater_result = b; - return greater_result; -} - -void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) - -{ - if (dropin(x3, y3, x1, y1, x2, y2) - || dropin(x3, y4, x1, y1, x2, y2) - || dropin(x4, y3, x1, y1, x2, y2) - || dropin(x4, y4, x1, y1, x2, y2)) { - ; /* Overlaps */ - mblit(lesser(x1, x3), lesser(y1, y3), greater(x2, x4), greater(y2, y4), 1, 0); - } else { - ; /* Doesn't overlap- copy both of them seperately */ - mblit(x3, y3, x4, y4, 1, 0); /* backwards- why not...? */ - mblit(x1, y1, x2, y2, 1, 0); - } -} - -void loadtrip() { - byte gm; - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); - tr[1].init(0); -} - -byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { - byte a, c; - integer fv, ff; - byte checkfeet_result; - a = 0; - setactivepage(2); - if (x1 < 0) x1 = 0; - if (x2 > 639) x2 = 639; - if (oy < y) - for (fv = x1; fv <= x2; fv ++) - for (ff = oy + yl; ff <= y + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - else - for (fv = x1; fv <= x2; fv ++) - for (ff = y + yl; ff <= oy + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - checkfeet_result = a; - setactivepage(1); - return checkfeet_result; -} - -void touchcol(byte tc); -static boolean bug; - -static void fr(byte a, byte b) { - fliproom(a, b); - bug = false; -} - -void touchcol(byte tc) { - bug = true; /* j.i.c. */ - switch (dna.room) { - case 1: - fr(2, 3); - break; - case 2: { - ; /* main corridor */ - switch (tc) { - case 1: - fr(3, 1); - break; /* to the other corridor */ - case 2: - fr(2, 1); - break; /* to this corridor! Fix this later... */ - } - } - break; - case 3: { - ; /* turn corridor */ - switch (tc) { - case 1: - fr(2, 1); - break; /* to the other corridor */ - case 2: - fr(12, 1); - break; /* through Spludwick's door */ - } - } - break; - case 12: - fr(3, 2); - break; - } - if (bug) { - setactivepage(0); - display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) - + '.'); - setactivepage(1); - tr[1].bounce(); - } -} - -triptype *triptype::init(byte spritenum) { - integer gd, gm; - word s; - untyped_file f; - varying_string<2> xx; - byte sort, n; - word bigsize; - pointer p, q; - str(spritenum, xx); - assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); - reset(f, 1); - seek(f, 59); - blockread(f, a, sizeof(a)); - blockread(f, bigsize, 2); - setactivepage(3); - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - blockread(f, p, bigsize); - off; - putimage(0, 0, p, 0); - release(q); - n = 1; - { - adxtype &with = a; - for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - getmem(pic[n][sort], a.size); /* grab the memory */ - getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, - (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, - pic[n][sort]); /* grab the pic */ - n += 1; - } - } - on; - } - close(f); - setactivepage(0); - - x = 0; - y = 0; - quick = true; - visible = false; - getmem(behind, a.size); - homing = false; - ix = 0; - iy = 0; - step = 0; - check_me = a.name == "Avalot"; - return this; -} - -void triptype::original() { - quick = false; -} - -void triptype::getback() { - tax = x; - tay = y; - off; /*getimage(x,y,x+a.xl,y+a.yl,behind^);*/ - mblit(x, y, x + a.xl, y + a.yl, 1, 3); - on; -} - -void triptype::andexor() { - byte picnum; /* Picnum, Picnic, what ye heck */ - picnum = face * a.seq + step + 1; - off; - putimage(x, y, pic[picnum][0], andput); - putimage(x, y, pic[picnum][1], xorput); - on; -} - -void triptype::turn(byte whichway) { - face = whichway; -} - -void triptype::appear(integer wx, integer wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox = wx; - oy = wy; - turn(wf); - visible = true; - ix = 0; - iy = 0; -} - -void triptype::walk() { - byte tc; - ox = x; - oy = y; - if ((ix == 0) && (iy == 0)) return; - if (homing) homestep(); - x = x + ix; - y = y + iy; - if (check_me) { - tc = checkfeet(x, x + a.xl, oy, y, a.yl); - { - void &with = magics[tc]; - switch (op) { - case exclaim: - blip; - break; - case bounces: - bounce(); - break; - case transport: - fliproom(hi(data), lo(data)); - break; - } - } - } - /* if x<0 then x:=0; else if x+a.xl>640 then x:=640-a.xl;*/ - if (y < 0) y = 0; /* else if y+a.yl>161 then y:=161-a.yl; */ - step += 1; - if (step == a.seq) step = 0; - getback(); -} - -void triptype::bounce() { - setactivepage(1); - putback(); - x = ox; - y = oy; - stopwalk(); - return; -} - -void triptype::do_it() { - if (((ix != 0) || (iy != 0)) & (~ ddm_o.menunow)) { - off; - copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); - putback(); - on; - } -} - -void triptype::putback() { - /* putimage(tax,tay,behind^,0);*/ mblit(tax, tay, tax + a.xl, tay + a.yl, 3, 1); -} - -void triptype::walkto(integer xx, integer yy) { - speed(xx - x, yy - y); - hx = xx; - hy = yy; - homing = true; -} - -void triptype::stophoming() { - homing = false; -} - -void triptype::homestep() { - integer temp; - if ((hx == x) && (hy == y)) { - ; /* touching the target */ - homing = false; - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; - } -} - -void triptype::speed(shortint xx, shortint yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ - if (ix == 0) { - ; /* No horz movement */ - if (iy < 0) turn(up); - else turn(down); - } else { - if (ix < 0) turn(left); - else turn(right); - } -} - -void triptype::stopwalk() { - ix = 0; - iy = 0; - homing = false; -} - -void triptype::chatter() { - talkx = x + a.xl / 2; - talky = y; - talkf = a.fgc; - talkb = a.bgc; -} - - -getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ - return this; -} - -void remember(fieldtype r) { - numleft += 1; - gs[numleft] = r; -} - -void recall() { - void recall_result; - recall_result = gs[numleft]; - numleft -= 1; - return recall_result; -} - -void rwsp(byte t, byte r) { - const integer xs = 4; - const integer ys = 2; - { - triptype &with = tr[t]; - switch (r) { - case up: - speed(0, -ys); - break; - case down: - speed(0, ys); - break; - case left: - speed(-xs, 0); - break; - case right: - speed(xs, 0); - break; - case ul: - speed(-xs, -ys); - break; - case ur: - speed(xs, -ys); - break; - case dl: - speed(-xs, ys); - break; - case dr: - speed(xs, ys); - break; - } - } -} - -void apped(byte trn, byte np) { - { - triptype &with = tr[trn]; - { - void &with1 = peds[np]; - appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); - } - rwsp(trn, tr[trn].face); - } -} - -void trippancy(); - -static boolean allstill() { - boolean xxx; - byte fv; - boolean allstill_result; - xxx = true; - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick && ((with.ix != 0) || (with.iy != 0))) xxx = false; - } - allstill_result = xxx; - return allstill_result; -} - -void trippancy() { - byte fv; - if ((ddm_o.menunow) | ontoolbar | seescroll | allstill()) return; - setactivepage(1); - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) { - walk(); - if (with.visible && ((with.ix != 0) || (with.iy != 0))) andexor(); - do_it(); - } - } - setactivepage(0); -} - -void tripkey(char dir); - -static void stopwalking() { - tr[1].stopwalk(); - dna.rw = stopped; -} - -void tripkey(char dir) { - { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (rw != up) { - rw = up; - rwsp(1, rw); - } else stopwalking(); - break; - case 'P': - if (rw != down) { - rw = down; - rwsp(1, rw); - } else stopwalking(); - break; - case 'K': - if (rw != left) { - rw = left; - rwsp(1, rw); - } else stopwalking(); - break; - case 'M': - if (rw != right) { - rw = right; - rwsp(1, rw); - } else stopwalking(); - break; - case 'I': - if (rw != ur) { - rw = ur; - rwsp(1, rw); - } else stopwalking(); - break; - case 'Q': - if (rw != dr) { - rw = dr; - rwsp(1, rw); - } else stopwalking(); - break; - case 'O': - if (rw != dl) { - rw = dl; - rwsp(1, rw); - } else stopwalking(); - break; - case 'G': - if (rw != ul) { - rw = ul; - rwsp(1, rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } - } - } -} - -void fliproom(byte room, byte ped) { - dusk; - tr[1].putback(); - dna.room = room; - load(room); - apped(1, ped); - oldrw = dna.rw; - dna.rw = tr[1].face; - showrw; - dawn; -} - -boolean infield(byte x) { /* returns True if you're within field "x" */ - integer ux, uy; - boolean infield_result; - { - triptype &with = tr[1]; - ux = with.x; - uy = with.y + with.a.yl; - } - { - void &with = fields[x]; - infield_result = (ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2); - } - return infield_result; -} - -boolean neardoor() { /* returns True if you're near a door! */ - integer ux, uy; - byte fv; - boolean nd; - boolean neardoor_result; - if (numfields < 9) { - ; /* there ARE no doors here! */ - neardoor_result = false; - return neardoor_result; - } - { - triptype &with = tr[1]; - ux = with.x; - uy = with.y + with.a.yl; - } - nd = false; - for (fv = 9; fv <= numfields; fv ++) { - void &with = fields[fv]; - if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; - } - neardoor_result = nd; - return neardoor_result; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oldtrip.h b/engines/avalanche/oldtrip.h deleted file mode 100644 index eb5e7d28dc3d..000000000000 --- a/engines/avalanche/oldtrip.h +++ /dev/null @@ -1,127 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __oldtrip_h__ -#define __oldtrip_h__ - - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const integer maxgetset = 10; - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -class triptype { -public: - adxtype a; /* vital statistics */ - byte face, step; - integer x, y; /* current xy coords */ - integer ox, oy; /* last xy coords */ - integer tax, tay; /* "behind" taken at... */ - shortint ix, iy; /* amount to move sprite by, each step */ - matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ - boolean quick, visible, homing, check_me; - pointer behind; /* what's behind you */ - integer hx, hy; /* homing x & y coords */ - - triptype *init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen 1 */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx, integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for do_it, andexor, etc. */ - void do_it(); /* Actually copies the picture over */ - void getback(); /* gets background before sprite is drawn */ - void putback(); /* ...and wipes sprite from screen 1 */ - void walkto(integer xx, integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ -}; - -class getsettype { -public: - array<1, maxgetset, fieldtype> gs; - byte numleft; - - getsettype *init(); - void remember(fieldtype r); - void recall(); -}; - -const integer up = 0; -const integer right = 1; -const integer down = 2; -const integer left = 3; -const integer ur = 4; -const integer dr = 5; -const integer dl = 6; -const integer ul = 7; -const integer stopped = 8; - -const integer numtr = 5; /* current max no. of sprites */ - -void trippancy(); - -void loadtrip(); - -void tripkey(char dir); - -void apped(byte trn, byte np); - -void fliproom(byte room, byte ped); - -boolean infield(byte x); /* returns True if you're within field "x" */ - -boolean neardoor(); /* returns True if you're near a door! */ - - -#ifdef __trip4_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, numtr, triptype> tr; -#undef EXTERN -#define EXTERN extern - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/omtest.cpp b/engines/avalanche/omtest.cpp deleted file mode 100644 index f373c50affad..000000000000 --- a/engines/avalanche/omtest.cpp +++ /dev/null @@ -1,210 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Oopmenu.h"*/ -/*#include "Rodent.h"*/ -/*#include "Crt.h"*/ -/*#include "Enhanced.h"*/ - -namespace Avalanche { - -varying_string<5> st; -byte fv; - -void graphics() { - integer gd, gm; ; - gd = 3; - gm = 0; - initgraph(gd, gm, ""); -} - -/*$F+ ... All ddm__procs and do__procs must be compiled in Far-Call state. */ - -void ddm__file() { - { - start_afresh; - opt("Load...", 'L', "f3", true); - opt("Save...", 'S', "f2", false); - opt("Save As...", 'A', "ctrl-f2", false); - opt("OS Shell...", 'O', "f2", true); - opt("Untrash screen", 'U', "f11", true); - display; - } -} - -void ddm__heart() { - { - start_afresh; - opt("About...", 'A', "shift-f10", true); - opt("Boss Key", 'B', "alt-B", true); - opt("Help...", 'H', "f1", true); - opt("Status screen", 'S', "f12", true); - opt("Quit", 'Q', "f10", true); - display; - } -} - -void ddm__action() { - { - start_afresh; - opt("Get up", 'G', "", true); - opt("Open door", 'O', "", true); - opt("Pause game", 'P', "", true); - opt("Look around", 'L', "", true); - opt("Inventory", 'I', "Tab", true); - opt("Do the boogie", 'b', "", true); - display; - } -} - -void ddm__objects() { - { - start_afresh; - opt("Bell", 'B', "", true); - opt("Wine", 'W', "", true); - opt("Chastity Belt", 'C', "", true); - opt("Crossbow Bolt", 't', "", true); - opt("Crossbow", 'r', "", true); - opt("Potion", 'P', "", true); - display; - } -} - -void ddm__people() { - { - start_afresh; - opt("Avalot", 'A', "", true); - opt("Spludwick", 'S', "", true); - opt("Arkata", 'k', "", true); - opt("Dogfood", 'D', "", true); - opt("Geida", 'G', "", true); - display; - } -} - -void ddm__use() { - { - start_afresh; - opt("Drink", 'D', "", true); - opt("Wear", 'W', "", true); - opt("Give to [du Lustie]", 'G', "", true); - display; - } -} - -void do__stuff() { - varying_string<2> st; - str(o.choicenum + 1, st); - setfillstyle(1, 6); - setcolor(14); - bar(0, 177, 640, 200); - outtextxy(320, 177, string("You just chose: ") + st); -} - -void do__heart() { - switch (o.choicenum) { - case 0: - outtextxy(100, 100, "A really funny game!"); - break; - case 1: - outtextxy(100, 120, "You ought to be working!"); - break; - case 2: - outtextxy(100, 140, "No help available, so THERE!"); - break; - case 3: - outtextxy(100, 160, "Everything's COOL and FROODY!"); - break; - case 4: - exit(0); - break; - } -} - -/*$F- ... End of ddm__procs */ - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - graphics(); - setfillstyle(6, 6); - bar(0, 0, 639, 199); - resetmouse; - m.init; - o.init; - { - create('H', '\3', '#', ddm__heart(), do__heart()); - create('F', "File", '!', ddm__file(), do__stuff()); - create('A', "Action", '\36', ddm__action(), do__stuff()); - create('O', "Objects", '\30', ddm__objects(), do__stuff()); - create('P', "People", '\31', ddm__people(), do__stuff()); - create('W', "With", '\21', ddm__use(), do__stuff()); - update; - } - do { - showmousecursor; - do { - getbuttonpressinfo(1); - getbuttonreleaseinfo(1); - getbuttonstatus; - if (menunow) o.lightup; - } while (!((buttonpresscount > 0) || (buttonreleasecount > 0) | keypressede)); - hidemousecursor; - if (buttonpresscount > 0) { - if (mousey > 10) { - if (!((o.firstlix) & - ((mousex >= flx1) && (mousex <= flx2) && - (mousey >= 12) && (mousey <= fly)))) { - ; /* Clicked OUTSIDE the menu. */ - if (o.menunow) wipe; - setcolor(2); - for (fv = 1; fv <= 17; fv ++) circle(mousex, mousey, fv * 3); - setcolor(0); - for (fv = 1; fv <= 17; fv ++) circle(mousex, mousey, fv * 3); - } - } else { - ; /* Clicked on menu bar */ - m.getmenu(mousex); - } - } else { - ; /* NOT clicked button... */ - if (buttonreleasecount > 0) { - if ((firstlix) & - ((mousex >= flx1) && (mousex <= flx2) && - (mousey >= 12) && (mousey <= fly))) - select((mousey - 14) / 10); - } else { - ; /* NOT clicked or released button, so must be keypress */ - readkeye; - parsekey(inchar, extd); - } - } - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.cpp b/engines/avalanche/oopmenu.cpp deleted file mode 100644 index 9c47d18b6dfd..000000000000 --- a/engines/avalanche/oopmenu.cpp +++ /dev/null @@ -1,332 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __oopmenu_implementation__ - - -#include "oopmenu.h" - - -/*#include "Crt.h"*/ -#include "graph.h" -/*#include "Rodent.h"*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -const integer indent = 40; -const integer spacing = 83; - -const integer menu_b = blue; -const integer menu_f = yellow; -const integer menu_border = black; -const integer highlight_b = lightblue; -const integer highlight_f = yellow; -const integer disabled = lightgray; - -/* menu_b = lightgray; - menu_f = black; - menu_border = black; - highlight_b = black; - highlight_f = white; - disabled = darkgray;*/ - -/* Built-in mouse routine */ - -char r; -byte fv; - -void chalk(integer x, integer y, char t, string z) { - byte p; - outtextxy(x, y, z); - p = pos(t, z); - if (p == 0) return; - p -= 1; - outtextxy(x + p * 8, y + 1, "_"); -} - -void say(integer x, integer y, char t, string z, byte f, byte b) { - settextjustify(0, 2); - setfillstyle(1, b); - setcolor(f); - bar(x - 3, y - 1, x + textwidth(z) + 3, y + textheight(z) + 1); - chalk(x, y, t, z); -} - -void mblit(integer x1, integer y1, integer x2, integer y2, byte f, byte t) { /* NOT The Minstrel Blitter */ - pointer p, q; - word s; - mark(q); - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - setactivepage(f); - getimage(x1, y1, x2, y2, p); - setactivepage(t); - putimage(x1, y1, p, 0); - setactivepage(0); - release(q); -} - -void onemenu::start_afresh() { - number = 0; - width = 0; - firstlix = false; - oldy = 0; - highlightnum = 0; -} - -onemenu *onemenu::init() { - menunow = false; - return this; -} - -void onemenu::opt(string n, char tr, string key, boolean val) { - integer l; - number += 1; - l = textwidth(n + key) + 30; - if (width < l) width = l; - { - optiontype &with = oo[number]; - with.title = n; - with.trigger = tr; - with.shortcut = key; - with.valid = val; - } -} - -void onemenu::displayopt(byte y, byte b, byte f, byte d) { - { - optiontype &with = oo[y]; - if (with.valid) setcolor(f); - else setcolor(d); - if (b != 177) { - setfillstyle(1, b); - bar(flx1, 3 + y * 10, flx2, 12 + y * 10); - } - settextjustify(2, 2); - if (with.shortcut > "") outtextxy(flx2, 4 + y * 10, with.shortcut); - settextjustify(0, 2); - chalk(left + 3, 4 + y * 10, with.trigger, with.title); - } -} - -void onemenu::display() { - byte y; - setfillstyle(1, menu_b); - setcolor(menu_border); - firstlix = true; - flx1 = left - 2; - flx2 = left + width; - fly = 14 + number * 10; - mblit(flx1 - 3, 11, flx2 + 1, fly + 1, 0, 1); - menunow = true; - - bar(flx1, 12, flx2, fly); - rectangle(flx1 - 1, 11, flx2 + 1, fly + 1); - - setcolor(menu_f); - settextjustify(0, 2); - displayopt(1, highlight_b, highlight_f, 177); - for (y = 2; y <= number; y ++) { - optiontype &with = oo[y]; - displayopt(y, 177, menu_f, disabled); - } -} - -void onemenu::wipe() { - { - headtype &with = m.ddms[o.menunum]; - say(flx1 + 2, 1, with.trigger, with.title, menu_f, menu_b); - } - mblit(flx1 - 3, 11, flx2 + 1, fly + 1, 1, 0); - menunow = false; - firstlix = false; -} - -void onemenu::movehighlight(shortint add) { - shortint hn; - if (add != 0) { - hn = highlightnum + add; - if ((hn < 0) || (hn >= (unsigned char)number)) return; - highlightnum = hn; - } - hidemousecursor; - displayopt(oldy + 1, menu_b, menu_f, disabled); - displayopt(highlightnum + 1, highlight_b, highlight_f, disabled); - showmousecursor; - oldy = highlightnum; -} - -void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - if ((mousex < flx1) || (mousex > flx2) - || (mousey <= 12) || (mousey > fly - 3)) return; - highlightnum = (mousey - 12) / 10; - if (highlightnum == oldy) return; - movehighlight(0); -} - -void onemenu::select(byte n) { /* Choose which one you want. */ - if (! oo[n + 1].valid) return; - choicenum = n; - m.ddms[menunum].do_choose(); - wipe(); -} - -void onemenu::keystroke(char c) { - byte fv; - c = upcase(c); - for (fv = 1; fv <= number; fv ++) - if (upcase(oo[fv].trigger) == c) select(fv - 1); -} - -void bleep() { - sound(177); - delay(7); - nosound; -} - -headtype *headtype::init -(char trig, char alttrig, string name, byte p, proc dw, proc dc) { - trigger = trig; - alttrigger = alttrig; - title = name; - position = p; - xpos = (position - 1) * spacing + indent; - xright = xpos + textwidth(name) + 3; - do_setup = dw; - do_choose = dc; - return this; -} - -void headtype::display() { - say(xpos, 1, trigger, title, menu_f, menu_b); -} - -void headtype::highlight() { - say(xpos, 1, trigger, title, highlight_f, highlight_b); - { - o.left = xpos; - o.menunow = true; - o.menunum = position; - } -} - -boolean headtype::extdparse(char c) { - boolean extdparse_result; - if (c != alttrigger) { - extdparse_result = true; - return extdparse_result; - } - extdparse_result = false; - return extdparse_result; -} - -menuset *menuset::init() { - howmany = 0; - return this; -} - -void menuset::create(char t, string n, char alttrig, proc dw, proc dc) { - howmany += 1; - ddms[howmany].init(t, alttrig, n, howmany, dw, dc); -} - -void menuset::update() { - byte fv; - setfillstyle(1, menu_b); - bar(0, 0, 640, 10); - for (fv = 1; fv <= howmany; fv ++) ddms[fv].display(); -} - -void menuset::extd(char c) { - byte fv; - fv = 1; - while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; - if (fv > howmany) return; - getmenu(fv * spacing - indent); -} - -void menuset::getmenu(integer x) { - byte fv; - fv = 0; - do { - fv += 1; - if ((x > ddms[fv].xpos - 3) && (x < ddms[fv].xright)) { - headtype &with = ddms[fv]; - { - if (o.menunow) { - wipe(); /* get rid of menu */ - if (o.menunum == with.position) return; /* click on own highlight */ - } - highlight(); - do_setup(); - return; - } - } - } while (!(fv > howmany)); -} - -void parsekey(char r, char re) { - switch (r) { - case '\0': { - switch (re) { - case 'K': { - wipe(); - m.getmenu((o.menunum - 2)*spacing + indent); - } - break; - case 'M': { - wipe(); - m.getmenu((o.menunum * spacing + indent)); - } - break; - case 'H': - movehighlight(-1); - break; - case 'P': - movehighlight(1); - break; - default: - m.extd(re); - } - } - break; - case '\33': - if (o.menunow) wipe(); - break; - case '\15': - select(o.highlightnum); - break; - default: { - if (o.menunow) keystroke(r); - else - kbuffer = kbuffer + r + re; - } - } -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/oopmenu.h b/engines/avalanche/oopmenu.h deleted file mode 100644 index b80b5ad31d76..000000000000 --- a/engines/avalanche/oopmenu.h +++ /dev/null @@ -1,112 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __oopmenu_h__ -#define __oopmenu_h__ - -namespace Avalanche { - -typedef void(*proc)(); - -class headtype { -public: - varying_string<8> title; - char trigger, alttrigger; - byte position; - integer xpos, xright; - proc do_setup, do_choose; - - headtype *init - (char trig, char alttrig, string name, byte p, proc dw, proc dc); - void display(); - void highlight(); - boolean extdparse(char c); -}; - -struct optiontype { - string title; - char trigger; - varying_string<9> shortcut; - boolean valid; -}; - -class onemenu { -public: - array<1, 12, optiontype> oo; - byte number; - integer width, left; - boolean firstlix; - integer flx1, flx2, fly; - byte oldy; /* used by Lightup */ - boolean menunow; /* Is there a menu now? */ - byte menunum; /* And if so, which is it? */ - byte choicenum; /* Your choice? */ - byte highlightnum; - - void start_afresh(); - void opt(string n, char tr, string key, boolean val); - void display(); - void wipe(); - void lightup(); - void displayopt(byte y, byte b, byte f, byte d); - void movehighlight(shortint add); - void select(byte n); - void keystroke(char c); - onemenu *init(); -}; - -class menuset { -public: - array<1, 8, headtype> ddms; - byte howmany; - - menuset *init(); - void create(char t, string n, char alttrig, proc dw, proc dc); - void update(); - void extd(char c); - void getmenu(integer x); -}; - - - -#ifdef __oopmenu_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN onemenu o; -EXTERN menuset m; -EXTERN string kbuffer; -#undef EXTERN -#define EXTERN extern - - -void parsekey(char r, char re); - -} // End of namespace Avalanche. - -#endif diff --git a/engines/avalanche/overlap.cpp b/engines/avalanche/overlap.cpp deleted file mode 100644 index 4b498fd500ad..000000000000 --- a/engines/avalanche/overlap.cpp +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -integer gd, gm; - -void flash(integer x1, integer y1, integer x2, integer y2) { - setcolor(14); - rectangle(x1, y1, x2, y2); - sound(x1 + x2); - delay(100); - nosound; - delay(500); - setcolor(9); - rectangle(x1, y1, x2, y2); - delay(500); -} - -boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) -/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{ - boolean dropin_result; - dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); - return dropin_result; -} - -void test(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) { - cleardevice(); - rectangle(x1, y1, x2, y2); - rectangle(x3, y3, x4, y4); - flash(x1, y1, x2, y2); - flash(x3, y3, x4, y4); - - if (dropin(x3, y3, x1, y1, x2, y2) - || dropin(x3, y4, x1, y1, x2, y2) - || dropin(x4, y3, x1, y1, x2, y2) - || dropin(x4, y4, x1, y1, x2, y2)) { - ; /* Overlaps */ - flash(x1, y1, x4, y4); - } else { - ; /* Doesn't overlap- flash 'em both again */ - flash(x3, y3, x4, y4); /* backwards- why not...? */ - flash(x1, y1, x2, y2); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - setcolor(9); - test(100, 50, 200, 100, 400, 200, 600, 250); - test(100, 50, 200, 100, 120, 70, 220, 120); - test(100, 50, 200, 100, 150, 50, 250, 100); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/overscro.cpp b/engines/avalanche/overscro.cpp deleted file mode 100644 index bf0825c1a23d..000000000000 --- a/engines/avalanche/overscro.cpp +++ /dev/null @@ -1,89 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - setactivepage(1); - setcolor(9); - settextstyle(0, 0, 2); - outtextxy(0, 0, "This is a test to see whether you can"); - outtextxy(0, 20, "scroll text over the top of a picture."); - outtextxy(0, 40, "I was wondering whether it would work."); - outtextxy(0, 60, "Well, does it, or not?"); - outtextxy(0, 80, "If so, it could be useful for the"); - outtextxy(0, 100, "Avalot title sequence."); - outtextxy(0, 120, "Good, isn't it?"); - outtextxy(0, 140, "The quick brown fox jumps over the"); - outtextxy(0, 160, "lazy dog..."); - outtextxy(0, 180, "This is the last line..."); - setactivepage(0); - gm = 0; - for (gd = 0; gd <= 640; gd ++) { - gm += 1; - if (gm == 8) gm = 1; - setcolor(gm); - line(gd, 0, gm, 350); - line(640 - gd, 0, 640 - gm, 350); - } - /* for gd:=1 to 15 do - begin; - setfillstyle(1,gd); bar(gd*20,10,gd*20+19,100); - end;*/ - /* setfillstyle(1,6); bar(100,100,500,100);*/ gd = getpixel(0, 0); - for (gm = 8; gm <= 15; gm ++) setpalette(gm, egayellow); - for (gd = 0; gd <= 199; gd ++) { - port[0x3c4] = 2; - port[0x3cf] = 4; - port[0x3c5] = 8; - port[0x3cf] = 0; - move(mem[0xa000 * 80], mem[0xa000 * 0], 16000); - port[0x3c4] = 2; - port[0x3cf] = 4; - port[0x3c5] = 8; - port[0x3cf] = 0; - move(mem[0xa000 * gd * 80 + 16384], mem[0xa000 * 15920], 80); - } - /* for gd:=0 to 199 do - begin; - port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; - move(mem[$A000*160],mem[$A000*0],15920); - port[$3C4]:=2; port[$3CF]:=4; port[$3C5]:=8; port[$3CF]:=0; - move(mem[$A000*gd*80+16384],mem[$A000*15920],80); - move(mem[$A000*15920],mem[$A000*15840],80); - end;*/ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/particle.cpp b/engines/avalanche/particle.cpp deleted file mode 100644 index 74f9dbb65e21..000000000000 --- a/engines/avalanche/particle.cpp +++ /dev/null @@ -1,325 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -/*$R+*/ - -namespace Avalanche { - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -struct markertype { - word length; - longint offset; - byte checksum; -}; - -string rawname; -array<0, 1999, char> buffer, was; -word bufpos, bufsize; -fonttype font; -integer cpos; -char r; -boolean ok; - -const char marker = '\33'; - -void cursor() { - byte fv; - for (fv = 12; fv <= 15; fv ++) - mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); -} - -void xy() { - cpos = (bufpos / 80) * 1280 + (bufpos % 80); -} - -void show() { - word fv, orig, y; - for (fv = 0; fv <= 1999; fv ++) - if (buffer[fv] != was[fv]) { - orig = (fv / 80) * 1280 + (fv % 80); - for (y = 0; y <= 15; y ++) - mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); - } - xy(); - move(buffer, was, sizeof(buffer)); -} - -void sizeup() { - do { - switch (buffer[bufsize]) { - case marker: - return; - break; /* we've found it OK! */ - case '\0': - bufsize -= 1; - break; - default: - bufsize += 1; - } - } while (!false); -} - -void graphics() { - integer gd, gm; - file fontfile; - gd = 3; - gm = 1; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(fontfile, "c:\\thomas\\lanche.fnt"); - reset(fontfile); - fontfile >> font; - close(fontfile); -} - -void helpscreen(); - -static byte l, fv; - -static void addon(char b, string st) { - buffer[3 + 80 * l] = b; - b -= 64; - buffer[5 + 80 * l] = b; - move(st[1], buffer[7 + 80 * l], length(st)); - l += 1; -} - -void helpscreen() { - array<0, 1999, char> temp; - char r; - l = 0; - move(buffer, temp, 2000); - fillchar(buffer, sizeof(buffer), '\0'); - addon('B', "Bubble"); - addon('C', "Centre text"); - addon('D', "Don't add \20 (at end)"); - addon('F', "Italic Font"); - addon('G', "Bell"); - addon('H', "Not allocated (=backspace)"); - addon('I', "Not allocated (=tab)"); - addon('L', "Left-justify text"); - addon('K', "Keyboard input"); - addon('M', "Carriage return (same as \r key)"); - addon('P', "Scroll (Paragraph break)"); - addon('Q', "Yes/no scroll (question)"); - addon('R', "Roman font"); - addon('S', "Fix to sprite"); - addon('U', "Money (in sd format)"); - addon('V', "View icon (number from ^S)"); - show(); - do { - r = readkey(); - } while (!(! keypressed())); - cleardevice(); - fillchar(was, sizeof(was), '\0'); - move(temp, buffer, 2000); - show(); -} - -void edit_it(); - -static void legit(char r) { - ; /* it's a legit keystroke */ - move(buffer[bufpos], buffer[bufpos + 1], 1999 - bufpos); - buffer[bufpos] = r; - bufpos += 1; - show(); -} - -void edit_it() { - byte fv; - bufpos = 0; - fillchar(was, sizeof(was), '\0'); - show(); - do { - cursor(); - r = readkey(); - cursor(); - switch (r) { - case '\0': - switch (readkey()) { /* extd keystrokes */ - case 'K': - if (bufpos > 0) { - bufpos -= 1; - xy(); - } - break; /* Left */ - case 'M': - if (bufpos < bufsize) { - bufpos += 1; - xy(); - } - break; /* Right */ - case 'H': - if (bufpos > 80) { - bufpos -= 80; - xy(); - } - break; /* Up */ - case 'P': - if (bufpos < (cardinal)bufsize - 79) { - bufpos += 80; - xy(); - } - break; /* Down */ - case 's': - if (bufpos > 10) { - bufpos -= 10; - xy(); - } - break; - case 't': - if (bufpos < (cardinal)bufsize - 10) { - bufpos += 10; - xy(); - } - break; - case 'G': { - bufpos = 0; - xy(); - } - break; /* Home */ - case 'O': { - bufpos = bufsize; - xy(); - } - break; /* End */ - case 'S': - if (bufpos < bufsize) { - ; /* Del */ - move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); - show(); - } - break; - case ';': - helpscreen(); - break; - case 'A': - legit('\357'); - break; /* copyright symbol */ - case 'B': - legit('\221'); - break; /* uppercase AE */ - case 'C': - legit('\222'); - break; /* lowercase AE */ - } - break; - case '\10': - if (bufpos > 0) { - ; /* backspace */ - bufpos -= 1; - move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); - show(); - } - break; - case '\33': { - restorecrtmode(); - return; - } - break; /* end of editing */ - default: - legit(r); - } - sizeup(); - } while (!false); -} - -void loadit() { - untyped_file f; - if (pos(".", rawname) == 0) rawname = rawname + ".raw"; - fillchar(buffer, sizeof(buffer), '\0'); - /*$I-*/ - assign(f, rawname); - reset(f, 1); - if (ioresult != 0) { - output << string('\7') + "New file!" + '\7' << NL; - buffer[0] = marker; - return; - } - bufsize = filesize(f); - blockread(f, buffer, bufsize); - close(f); - while (buffer[bufsize] == '\0') bufsize -= 1; - if (buffer[bufsize] != marker) { - ; /* add on a marker */ - bufsize += 1; - buffer[bufsize] = marker; - } -} - -void saveit() { - untyped_file f; - output << "Saving " << rawname << ", " << bufsize << " bytes..." << NL; - assign(f, rawname); - rewrite(f, 1); - blockwrite(f, buffer, bufsize); - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "Filename of .RAW file?"; - input >> rawname >> NL; - loadit(); - ok = false; - do { - graphics(); - edit_it(); - output << "Now what?" << NL; - output << NL; - output << " Filename: " << rawname << NL; - output << " Size of text: " << bufsize << NL; - output << " Cursor position: " << bufpos << NL; - output << NL; - output << " C) Cancel this & continue edit" << NL; - output << " S) Save under current name" << NL; - output << " A) Save under a different name" << NL; - output << " X) Exit & lose all changes." << NL; - output << NL; - output << "Pick one!" << NL; - do { - r = upcase(readkey()); - } while (!(set::of('C', 'S', 'A', 'X', eos).has(r))); - switch (r) { - case 'X': - ok = true; - break; - case 'S': { - saveit(); - exit(0); - } - break; - } - } while (!ok); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp.cpp b/engines/avalanche/pictemp.cpp deleted file mode 100644 index e41c395d7148..000000000000 --- a/engines/avalanche/pictemp.cpp +++ /dev/null @@ -1,99 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -const integer picsize = 966; - -integer gd, gm; -untyped_file f; -pointer p; - -void save() { - varying_string<40> adf; - untyped_file f; - byte z; - array<1, 2, pointer> c; - string nam, screenname; - const string header = - string("This is a file from an Avvy game, and its contents are subject to ") + - "copyright." + '\15' + '\12' + '\15' + '\12' + "Have fun!" + '\32'; - byte a /*absolute $A000:1200i*/; - byte bit; - nam = "d:thingtmp.avd"; - screenname = "Temp."; - assign(f, nam); - - assign(f, nam); - rewrite(f, 1); - blockwrite(f, header[1], 146); - blockwrite(f, screenname, 31); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, a, 12080); - } - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - assign(f, "thinks.avd"); - getmem(p, picsize); - reset(f, 1); - seek(f, 65); - gd = 10; - gm = 20; - - while (gm < 120) { - if (! eof(f)) - blockread(f, p, picsize); - putimage(gd, gm, p, 0); - gd += 70; - - if (gd == 640) { - gd = 10; - gm += 40; - } - - } - - close(f); - freemem(p, picsize); - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pictemp2.cpp b/engines/avalanche/pictemp2.cpp deleted file mode 100644 index 656987fe3c10..000000000000 --- a/engines/avalanche/pictemp2.cpp +++ /dev/null @@ -1,97 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Get 'em back! */ -#include "graph.h" - -namespace Avalanche { - -const integer picsize = 966; -const integer number_of_objects = 17; - -const array<1, 65, char> thinks_header = - string("This is an Avalot file, which is subject to copyright. Have fun.") + '\32'; - -integer gd, gm; -untyped_file f; -pointer p; -byte noo; - -void load() { - byte a0 /*absolute $A000:1200*/; - byte bit; - untyped_file f; - assign(f, "d:thingtmp.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - load(); - noo = 0; - - assign(f, "thinks.avd"); - getmem(p, picsize); - rewrite(f, 1); - blockwrite(f, thinks_header, 65); - gd = 10; - gm = 20; - - while (noo <= number_of_objects) { - getimage(gd, gm, gd + 59, gm + 29, p); - putimage(gd, gm, p, notput); - blockwrite(f, p, picsize); - gd += 70; - - if (gd == 640) { - gd = 10; - gm += 40; - } - - noo += 1; - } - - close(f); - freemem(p, picsize); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp deleted file mode 100644 index f9d3571ce832..000000000000 --- a/engines/avalanche/pingo.cpp +++ /dev/null @@ -1,302 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - PINGO Full-screen sub-parts of the game. */ - -#define __pingo_implementation__ - - -#include "pingo.h" - - -#include "graph.h" -#include "gyro.h" -#include "lucerna.h" -/*#include "Crt.h"*/ -#include "trip5.h" -#include "scrolls.h" - -namespace Avalanche { - -void dplot(integer x, integer y, string z) { - setcolor(9); - outtextxy(x, y , z); - setcolor(11); - outtextxy(x, y - 1, z); -} - -void bosskey() -/*const - months : array[0..11] of char = 'JFMAMJJASOND'; - title = 'Net Profits'; - fish = #224; { } -var fv:byte; gd,gm:integer; r:char; -begin; - dusk; delavvy; - setactivepage(3); mousepage(3); setvisualpage(3); off; - cleardevice; setfillstyle(xhatchfill,11); - settextstyle(1,0,4); settextjustify(1,1); - dplot(320,10,title); - settextstyle(1,0,0); setusercharsize(4,3,7,12); - for fv:=0 to 11 do - begin; - dplot(26+fv*52,187,months[fv]); - bar(fv*52,177-fv*14,51+fv*52,180); - rectangle(fv*52,177-fv*14,51+fv*52,180); - end; - settextstyle(0,0,1); - for fv:=1 to 177 do - begin; - gd:=random(630); gm:=random(160)+30; - setcolor(lightred); outtextxy(gd ,gm ,fish); - setcolor(yellow); outtextxy(gd+1,gm-1,fish); - end; - newpointer(6); { TTHand } - dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; - while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); - dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; - copy02;*/ -{ - byte fv; - dusk(); - off_virtual(); - for (fv = 0; fv <= 1; fv ++) { - setactivepage(fv); - cleardevice(); - } - load(98); - off(); - setactivepage(1); - setvisualpage(1); - settextjustify(1, 0); - setcolor(8); - outtextxy(320, 177, "Graph/Histo/Draw/Sample: \"JANJUN93.GRA\": (W3-AB3)"); - outtextxy(320, 190, "Press any key or click the mouse to return."); - settextjustify(2, 0); - on(); - mousepage(1); - newpointer(1); - dawn(); - do { - check(); - } while (!((mpress > 0) || keypressed())); - off(); - on_virtual(); - major_redraw(); - - mousepage(cp); -} - -void copy02() { /* taken from Wobble (below) */ - byte a0 /*absolute $A000:0*/; - byte a2/*absolute $A800:0*/; - byte bit; - off(); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(a0, a2, 16000); - } - on(); -} - -void copy03() { /* taken from Wobble (below) */ - byte a0 /*absolute $A000:0*/; - byte a2/*absolute $AC00:0*/; - byte bit; - byte squeaky_code; - - switch (visible) { - case m_virtual : { - squeaky_code = 1; - off_virtual(); - } - break; - case m_no : - squeaky_code = 2; - break; - case m_yes : { - squeaky_code = 3; - off(); - } - break; - } - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(a0, a2, 16000); - } - - switch (squeaky_code) { - case 1 : - on_virtual(); - break; - case 2 : - break; /* zzzz, it was off anyway */ - case 3 : - on(); - break; - } - -} - -void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ - byte bit; - off(); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[0xa000 * frp * pagetop], mem[0xa000 * top * pagetop], 16000); - } - on(); -} - -void wobble() { - byte bit; - byte a2 /*absolute $A800:80i*/; - off(); - setactivepage(2); - bit = getpixel(0, 0); - cleardevice(); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[0xa000 * cp * pagetop], a2, 16000); - } - for (bit = 0; bit <= 25; bit ++) { - setvisualpage(2); - delay(bit * 7); - setvisualpage(cp); - delay(bit * 7); - } - bit = getpixel(0, 0); - draw_also_lines(); - setactivepage(1 - cp); - on(); -} - -void zonk(); - -static void zl(integer x1, integer y1, integer x2, integer y2) { - setlinestyle(0, 0, 3); - setcolor(1); - line(x1, y1, x2, y2); - setlinestyle(0, 0, 1); - setcolor(11); - line(x1, y1, x2, y2); -} - -void zonk() { - integer xx, yy; - /* a0:byte absolute $A000:0; a3:byte absolute $A000:245760;*/ byte bit, fv; - off(); - copypage(3, 1 - cp); - { - triptype &with = tr[1]; - xx = with.x + with.a.xl / 2; - yy = with.y; - } - - setactivepage(3); - cleardevice(); - /* for bit:=0 to 3 do begin; - port[$3C4]:=2; port[$3CE]:=4; - port[$3C5]:=1 shl bit; - port[$3CF]:=bit; - move(a0,a3,16000); - end;*/ - copypage(cp, 3); - off(); - zl(640, 0, 0, yy / 4); - zl(0, yy / 4, 640, yy / 2); - zl(640, yy / 2, xx, yy); - setbkcolor(yellow); - - for (bit = 0; bit <= 255; bit ++) { - note(270 - bit); - setvisualpage(3); - note(2700 - 10 * bit); - delay(5); - nosound; - note(270 - bit); - setvisualpage(cp); - note(2700 - 10 * bit); - delay(5); - nosound; - } - setactivepage(0); - setbkcolor(black); - on(); - state(2); - copypage(1 - cp, 3); -} - -void winning_pic() { - byte bit; - untyped_file f; - char r; - - dusk(); - - assign(f, "finale.avd"); - reset(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * 0], 16000); - } - close(f); - blitfix(); - - setvisualpage(0); - - dawn(); - - do { - check(); - } while (!(keypressed() || (mrelease > 0))); - while (keypressed()) r = readkey(); - major_redraw(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h deleted file mode 100644 index 9d76db63b673..000000000000 --- a/engines/avalanche/pingo.h +++ /dev/null @@ -1,49 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __pingo_h__ -#define __pingo_h__ - -namespace Avalanche { - -void bosskey(); - -void copy02(); - -void copy03(); - -void copypage(byte frp, byte top); - -void wobble(); - -void zonk(); - -void winning_pic(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/plottest.cpp b/engines/avalanche/plottest.cpp deleted file mode 100644 index 8ff0c364756d..000000000000 --- a/engines/avalanche/plottest.cpp +++ /dev/null @@ -1,70 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -byte fv; -matrix<1, 35, 0, 39, byte> a; -array<0, 3, 0, 4, 1, 35, byte> b; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - for (gd = 0; gd <= 39; gd ++) - for (gm = 1; gm <= 35; gm ++) - a[gm][gd] = (gd + gm) % 16; - for (gd = 0; gd <= 39; gd ++) - for (gm = 1; gm <= 35; gm ++) - putpixel(gd + 100, gm + 100, a[gm][gd]); - - fillchar(b, sizeof(b), '\0'); - for (gm = 1; gm <= 35; gm ++) - for (gd = 0; gd <= 39; gd ++) { - for (fv = 0; fv <= 3; fv ++) { - b[fv][gd / 8][gm] = (b[fv][gd / 8][gm] << 1); - b[fv][gd / 8][gm] += ((cardinal)(a[gm][gd] & (1 << fv)) >> fv); - } - } - - for (gd = 1; gd <= 35; gd ++) - for (gm = 0; gm <= 4; gm ++) { - for (fv = 0; fv <= 3; fv ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << fv; - port[0x3cf] = fv; - mem[0xa000 * gd * 80 + gm] = b[fv][gm][gd]; - } - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/preview1.cpp b/engines/avalanche/preview1.cpp deleted file mode 100644 index bdb5f4089690..000000000000 --- a/engines/avalanche/preview1.cpp +++ /dev/null @@ -1,152 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -array<0, 3, palettetype> fxpal; - -void load() { - byte a0 /*absolute $A000:800*/; - byte bit; - untyped_file f; - - - assign(f, "preview2.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - - close(f); - bit = getpixel(0, 0); - - settextjustify(1, 1); - setcolor(3); - outtextxy(320, 166, "...This is a preview of things to come..."); - setcolor(14); - outtextxy(320, 176, "AVAROID"); - outtextxy(320, 183, "(a space so dizzy)"); - setcolor(9); - outtextxy(320, 194, "the next Avvy adventure-- in 256 colours."); - setcolor(7); - outtextxy(590, 195, "Any key..."); -} - -void setup() { - integer gd, gm; - palettetype p; - - if (paramstr(1) != "jsb") exit(255); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - getpalette(fxpal[0]); - - fillchar(p.colors, sizeof(p.colors), '\0'); /* Blank out the screen. */ - p.size = 16; - setallpalette(p); -} - -void wait() { - word w; - char r; - - w = 0; - do { - delay(1); - w += 1; - } while (!(keypressed() || (w == 15000))); - - while (keypressed()) r = readkey(); /* Keyboard sink. */ -} - -void show(byte n) { - setallpalette(fxpal[n]); - delay(55); -} - -shortint fades(shortint x) { - byte r, g, b; - - shortint fades_result; - r = x / 16; - x = x % 16; - g = x / 4; - b = x % 4; - if (r > 0) r -= 1; - if (g > 0) g -= 1; - if (b > 0) b -= 1; - fades_result = (16 * r + 4 * g + b); - /* fades:=x-1;*/ - return fades_result; -} - -void dawn(); - -static void calc(byte n) { - byte fv; - - fxpal[n] = fxpal[n - 1]; - - for (fv = 1; fv <= fxpal[n].size - 1; fv ++) - fxpal[n].colors[fv] = fades(fxpal[n].colors[fv]); -} - -void dawn() { - byte fv; - - for (fv = 1; fv <= 3; fv ++) calc(fv); - - for (fv = 3; fv >= 0; fv --) show(fv); -} - -void dusk() { - byte fv; - - for (fv = 1; fv <= 3; fv ++) show(fv); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - load(); - dawn(); - wait(); - dusk(); - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qintro.cpp b/engines/avalanche/qintro.cpp deleted file mode 100644 index 695dda45ae7e..000000000000 --- a/engines/avalanche/qintro.cpp +++ /dev/null @@ -1,320 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -/* This is a stand-alone program. */ - -/* 0, black, remains 0. - Other numbers: the bits take precedence from the left. - e.g. for 9 = 1001, => fourth bit. - - First 1 is in: - - Fourth bit: 63 (egaWhite) - Third bit: 57 (egaLightBlue) - Second bit: 7 (light grey) - First bit: 1 (blue). */ - -const palettetype our_palette = { - 16, - /* sic */ - {{ 0, 1, 57, 57, 7, 7, 7, 7, 63, 63, 63, 63, 63, 63, 63, 63}} -}; - -typedef matrix < '\0', '\377', 1, 16, byte > fonttype; - -fonttype f; -matrix<0, 39, 1, 16, byte> next_line; - -byte next_bitline; - -byte displaycounter; - -boolean cut_out; - -word cut_out_time; - -array<1, 117, varying_string<40> > x; - -byte this_line; - -word *skellern; - -/*$L intro.obj*/ -extern void introduction(); - -void graphmode(integer mode) { - registers regs; - - regs.ax = mode; - intr(0x10, regs); -} - -/* Firstly, port[$3C4]:=2; port[$3CF]:=4;, - Then port[$3C5]:=1 shl bit; port[$3CF]:=bit;. */ - -void loadfont() { - file ff; - - assign(ff, "avalot.fnt"); - reset(ff); - ff >> f; - close(ff); -} - -void calc_next_line() -/* This proc sets up next_line. */ -{ - string l; - byte fv, ff; - boolean oddlen; - byte start; - byte this_; - - fillchar(next_line, sizeof(next_line), '\0'); /* All blanks. */ - - if (this_line == 117) { - cut_out = true; - return; - } - - l = x[this_line]; - this_line += 1; - - start = (20 - length(l) / 2) - 1; - oddlen = odd(length(l)); - - for (fv = 1; fv <= length(l); fv ++) - for (ff = 1; ff <= 16; ff ++) { - this_ = f[l[fv]][ff]; - if (oddlen) { - /* Odd, => 4 bits shift to the right. */ - next_line[start + fv][ff] += this_ << 4; - next_line[start + fv - 1][ff] += (cardinal)this_ >> 4; - } else { - /* Even, => no bit shift. */ - next_line[start + fv][ff] = this_; - } - } - next_bitline = 1; -} - -void display() { - byte fv, ff; - - - if (next_bitline == 17) calc_next_line(); - - if (cut_out) { - cut_out_time -= 1; - return; - } - - move(mem[0xa000 * 40], mem[0xa000 * 0], 7960); - for (fv = 0; fv <= 39; fv ++) - mem[0xa1f1 * 8 + fv] = next_line[fv][next_bitline]; - next_bitline += 1; - -} - -void plot_a_star(integer x, integer y) { - byte ofs; - - ofs = x % 8; - x = x / 8; - mem[0xa000 * x + y * 40] += (cardinal)128 >> ofs; -} - -void plot_some_stars(integer y) { - byte fv, times; - - switch (Random(7)) { - case 1: - times = 1; - break; - case 2: - times = 2; - break; - case 3: - times = 3; - break; - default: - return; - } - - for (fv = 1; fv <= times; fv ++) - plot_a_star(Random(320), y); -} - -void starry_starry_night() { - integer y; - byte bit; - - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - for (bit = 0; bit <= 2; bit ++) { - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (y = 1; y <= 200; y ++) - plot_some_stars(y); - } -} - -void setupgraphics() /* Fix this proc. This prog SHOULDN'T use the - Graph unit. */ -{ - integer gd, gm; - - gd = 3; - gm = 1; - initgraph(gd, gm, ""); -} - -void shovestars() { - move(mem[0xa000 * 0], mem[0xa000 * 40], 7960); - fillchar(mem[0xa000 * 0], 40, '\0'); - plot_some_stars(0); -} - -void do_next_line() { - byte bit; - - port[0x3c4] = 2; - port[0x3ce] = 4; - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - - switch (bit) { - case 0: - if ((displaycounter % 10) == 0) shovestars(); - break; - case 1: - if ((displaycounter % 2) == 0) shovestars(); - break; - case 2: - shovestars(); - break; - case 3: - display(); - break; /* The text. */ - } - } - - if (displaycounter == 40) displaycounter = 0; - -} - -void load_text() { - word fv; - char *c; - byte thisline; - - - c = addr(introduction()); - thisline = 0; - fillchar(x, sizeof(x), '\0'); - - for (fv = 1; fv <= 2456; fv ++) { - switch (*c) { - case '\15': - thisline += 1; - break; - case '\12':/*nop*/ - break; - default: - x[thisline] = x[thisline] + *c; - } - - c += 1; - } -} - -void check_params() { - word s, o; - integer e; - - if (paramstr(1) != "jsb") exit(0); - val(paramstr(2), s, e); - if (e != 0) exit(0); - val(paramstr(3), o, e); - if (e != 0) exit(0); - skellern = ptr(s, o + 1); -} - -int main(int argc, const char *argv[]) { - - pio_initialize(argc, argv); - check_params(); - - setupgraphics(); - - randseed = 177; - checkbreak = false; - - load_text(); - - this_line = 1; - - graphmode(0xd); - loadfont(); - - next_bitline = 17; - displaycounter = 0; - - cut_out_time = 333; - - setallpalette(our_palette); - - starry_starry_night(); - - while ((cut_out_time > 0) && (! keypressed())) { - - *skellern = 0; - - do_next_line(); - - displaycounter += 1; - - do { - } while (!(*skellern > 0)); - } - - graphmode(3); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/qstars.cpp b/engines/avalanche/qstars.cpp deleted file mode 100644 index 553aee4c836e..000000000000 --- a/engines/avalanche/qstars.cpp +++ /dev/null @@ -1,302 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Demonstration of the Bigo II system. */ -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Rodent.h"*/ -/*#include "Tommys.h"*/ - -namespace Avalanche { - -integer gd, gm; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -boolean reverse; -word spinnum; -array<0, 1, fonttype> f; -file ff; -array<0, 7, 0, 15, 0, 79, byte> strip; -byte across; -word w; -byte y; -byte charnum; -byte cfont; /* current font. 0=roman, 1=italic. */ - -char *c; - -const integer colours = 12; /* Run Workout to see possible values of these two. */ -const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ -const integer gmtop = 360 / steps; - -/*$L credits.obj*/ extern void credits(); - -void bigo2(string date) { - integer gd, gm; - byte c; - palettetype p; - untyped_file f; - pointer pp; - word s; - - - getpalette(p); - setvisualpage(1); - setactivepage(0); - assign(f, "logo.avd"); - reset(f, 1); - for (gd = 7; gd <= 194; gd ++) - blockread(f, mem[0xa000 * (gd * 80)], 53); - close(f); - s = imagesize(0, 7, 415, 194); - getmem(pp, s); - getimage(0, 7, 415, 194, pp); - - cleardevice(); - for (gd = 1; gd <= 64; gd ++) { - for (gm = 0; gm <= gmtop; gm ++) { - c = (c % colours) + 1; - /* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, - trunc(cos(gm*steps*n)*gd*3)+175,c); */ - if (c > 5) continue_; - setcolor(c); - arc(320, 175, gm * steps, gm * steps + 1, gd * 6); - } - if (keypressed()) { - closegraph(); - exit(0); - } - } - settextstyle(0, 0, 1); - setcolor(13); - outtextxy(550, 343, "(press any key)"); - - putimage(112, 0, pp, orput); - freemem(pp, s); - resetmouse; - setvisualpage(0); -} - -void nextchar() { /* Sets up charnum & cline for the next character. */ - - c += 1; -} - -void getchar() { - do { - nextchar(); - - switch (*c) { - case '@': { - cfont = 1; - nextchar(); - } - break; - case '^': { - cfont = 0; - nextchar(); - } - break; - case '%': { - closegraph(); - exit(0); - } - break; - } - - } while (!((*c != '\15') && (*c != '\12'))); - - for (w = 0; w <= 7; w ++) - for (y = 0; y <= 15; y ++) - move(strip[w][y][1], strip[w][y][0], 79); - - for (w = 0; w <= 7; w ++) - for (y = 0; y <= 15; y ++) - strip[w][y][79] = (byte)((strip[7][y][78] << (w + 1))) + - ((cardinal)f[cfont][*c][y] >> (7 - w)); - - across = 0; -} - -void scrolltext() { - byte c, w, y; - - across += 1; - if (across == 8) getchar(); - - for (y = 0; y <= 15; y ++) - for (w = 0; w <= 1; w ++) - move(strip[across][y][0], mem[0xa000 * 24000 + (y * 2 + w) * 80], 80); -} - -void do_stuff() { - switch (spinnum) { - case 50 ... 110: { - setfillstyle(1, 14); - bar(0, 315 + (spinnum - 50) / 3, 640, 315 + (spinnum - 50) / 3); - bar(0, 316 - (spinnum - 50) / 3, 640, 316 - (spinnum - 50) / 3); - if (spinnum > 56) { - setfillstyle(1, 13); - bar(0, 315 + (spinnum - 56) / 3, 640, 315 + (spinnum - 56) / 3); - bar(0, 316 - (spinnum - 56) / 3, 640, 316 - (spinnum - 56) / 3); - } - } - break; - case 150 ... 198: { - setfillstyle(1, 0); - bar(0, 315 + (spinnum - 150) / 3, 640, 315 + (spinnum - 150) / 3); - bar(0, 316 - (spinnum - 150) / 3, 640, 316 - (spinnum - 150) / 3); - } - break; - case 200: - scrolltext(); - break; - } -} - -void setcol(byte which, byte what) -/*var dummy:byte;*/ -{ - /* setpalette(which,what); - asm - (* mov dx,$3DA; - in ax,dx; - - or ah,ah; - - mov dx,$3C0; - mov al,which; - out dx,al; - - mov dx,$3C0; - mov al,what; - out dx,al; - end; - (* dummy:=port[$3DA]; - port[$3C0]:=which; port[$3C0]:=what;*/ -} - -void bigo2go() { - palettetype p; - byte c; - boolean lmo; - boolean altnow, altbefore; - - for (gd = 0; gd <= 13; gd ++) p.colors[gd] = 0; - - setcol(13, 24); /* murk */ setcol(14, 38); /* gold */ - setcol(15, egawhite); /* white- of course */ - p.colors[13] = 24; - p.colors[14] = 38; - p.colors[15] = egawhite; - - /***/ - - p.colors[5] = egawhite; - p.colors[4] = egalightcyan; - p.colors[3] = egacyan; - p.colors[2] = egalightblue; - p.colors[1] = egablue; - - /***/ - - c = 1; - p.size = 16; - lmo = false; - setallpalette(p); - - do { - /* if reverse then - begin - dec(c); if c=0 then c:=colours; - end else - begin - inc(c); if c>colours then c:=1; - end; - for gm:=1 to colours do - case p.colors[gm] of - egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; - egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; - egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; - egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; - egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; - end; - p.colors[c]:=egaWhite; setcol(c,egaWhite); - - AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ - - if (anymousekeypressed) lmo = true; - if (keypressed()) lmo = true; - - /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ - - do_stuff(); - if (spinnum < 200) spinnum += 1; - } while (!lmo); -} - -void parse_cline() { - integer e; - - if (paramstr(1) != "jsb") { - output << "Not a standalone program." << NL; - exit(255); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - parse_cline(); - - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - assign(ff, "avalot.fnt"); - reset(ff); - ff >> f[0]; - close(ff); - assign(ff, "avitalic.fnt"); - reset(ff); - ff >> f[1]; - close(ff); - - c = addr(credits()); - c -= 1; - - fillchar(strip, sizeof(strip), '\0'); - reverse = false; - spinnum = 0; - across = 7; - charnum = 1; - cfont = 0; - bigo2("1189"); /* 1189? 79? 2345? 1967? */ - bigo2go(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/rawupd.cpp b/engines/avalanche/rawupd.cpp deleted file mode 100644 index e3ed388eeb3d..000000000000 --- a/engines/avalanche/rawupd.cpp +++ /dev/null @@ -1,96 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -searchrec s; -string x, y; -longint hash_time, s_time; -boolean s_exists; - -void find_out_about_s(string name) { - searchrec ss; - findfirst(name, anyfile, ss); - s_exists = doserror == 0; - - if (s_exists) - s_time = ss.time; -} - -void get_y() { - y = x; - if (set::of(range('0', '9'), eos).has(x[2])) - y[1] = 'h'; - else if (x[3] == 'K') - y[1] = 'a'; - else - y[1] = 's'; -} - -void rename_it() { - untyped_file f; - - output << x << " -> " << y; - assign(f, x); - reset(f); - rename(f, y); - close(f); - output << " ...done." << NL; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << NL; - findfirst("#*.*", anyfile, s); - while (doserror == 0) { - x = s.name; - get_y(); - hash_time = s.time; - output << format(x, 15); - clreol; - find_out_about_s(y); - if (s_exists) { - output << ": s exists and is "; - if (s_time < hash_time) - output << "NEWER!" << NL; - else if (s_time == hash_time) - output << string("equal.") + '\15'; - else output << "older." << NL; - } else { - output << " ... NO S FOUND! Renaming..."; - rename_it(); - } - - findnext(s); - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/readsez.cpp b/engines/avalanche/readsez.cpp deleted file mode 100644 index cd4cd62e8be5..000000000000 --- a/engines/avalanche/readsez.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -struct markertype { - word length; - longint offset; - byte checksum; -}; - -struct sezheader { - array<1, 2, char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ -}; - -untyped_file f; -longint number; -markertype marker; -sezheader sezhead; -array<0, 1999, char> x; -word fv; -byte sum; - -byte sumup() { - word fv; - byte total; - byte sumup_result; - total = 0; - for (fv = 0; fv <= marker.length; fv ++) { - total += ord(x[fv]); - } - sumup_result = total; - return sumup_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "READ-SEZ by TT." << NL; - output << NL; - assign(f, "avalot.sez"); - reset(f, 1); - seek(f, 255); - blockread(f, sezhead, sizeof(sezhead)); - { - if (sezhead.initials != "TT") { - output << "Not a valid Sez file!" << NL; - exit(0); - } - output << "Number of chains in file = " << sezhead.chains << NL; - output << "Total size of all chains = " << sezhead.size << " bytes." << NL; - } - output << NL; - output << "Number of scrollchain to display?"; - input >> number >> NL; - seek(f, longint(262) + number * longint(7)); - blockread(f, marker, 7); - { - output << "Scrollchain no. " << number << NL; - output << "Length: " << marker.length << NL; - output << "Offset: " << marker.offset << NL; - output << NL; - output << "Contents:" << NL; - seek(f, longint(270) + sezhead.chains * longint(7) + marker.offset); - blockread(f, x, marker.length + 1); - for (fv = 0; fv <= marker.length; fv ++) x[fv] -= 3 + 177 * fv * marker.length; /* unscramble */ - for (fv = 0; fv <= marker.length; fv ++) output << x[fv]; - output << NL; - sum = sumup(); - output << "Checksum in file: " << marker.checksum << ". Actual value: " << sum << '.' << NL; - output << NL; - if (sum != marker.checksum) { - output << "Bleargh! Checksum failed!" << NL; - exit(0); - } - } - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/reginam.cpp b/engines/avalanche/reginam.cpp deleted file mode 100644 index 2ed33bea742d..000000000000 --- a/engines/avalanche/reginam.cpp +++ /dev/null @@ -1,112 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -const array<1, 36, char> letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; -varying_string<30> name; -varying_string<5> number; - -void alphanum(); - -static string z; - -static byte p; - - -static void replace(char what, char whatwith) { - p = pos(what, z); - if (p > 0) z[p] = whatwith; -} - -void alphanum() { - byte fv; - - z = ""; - for (fv = 1; fv <= length(name); fv ++) - if (set::of(range('A', 'Z'), eos).has(name[fv])) - z = z + '7' + name[fv]; - else - z = z + upcase(name[fv]); - replace(' ', '1'); - replace('.', '2'); - replace('-', '3'); - replace('\'', '4'); - replace('"', '5'); - replace('!', '6'); - replace(',', '9'); - replace('?', '0'); - - for (fv = 1; fv <= length(number); fv ++) - number[fv] = upcase(number[fv]); - - name = z + '8' + number; -} - -void scramble() { - byte fv, what; - for (fv = 1; fv <= length(name); fv ++) { - what = pos(name[fv], letters); - what += 177; - what += (fv + 1) * 3; - name[fv] = letters[(what % 36) + 1 - 1]; - } -} - -void checks() { - byte fv, total; - total = 177; - for (fv = 1; fv <= length(name); fv ++) - total += ord(name[fv]); - name = string('T') + name + letters[total % 36 - 1]; -} - -void negate() { - byte fv; - name[1] = 'N'; - for (fv = 2; fv <= length(name); fv ++) - name[fv] = letters[37 - pos(name[fv], letters) - 1]; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - output << "Registrant's name?"; - input >> name >> NL; - output << "And number (eg, A1)?"; - input >> number >> NL; - alphanum(); - output << "Name = " << name << NL; - scramble(); - output << "Scrambled = " << name << NL; - checks(); - output << "With checks = " << name << NL; - negate(); - output << "Or, negated, = " << name << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.cpp b/engines/avalanche/sackb1.cpp deleted file mode 100644 index b197977c8e5b..000000000000 --- a/engines/avalanche/sackb1.cpp +++ /dev/null @@ -1,76 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - SACKBLASTER-1 The temporary mod player. */ - -/* This is SackBlaster version 1.0, using Mark J. Cox's MODOBJ routines. - When Cameron finishes his mod player I'll use his routines, DV. However, - this will do for the time being. */ - -#define __sackb1_implementation__ - - -#include "sackb1.h" - - -/*$L v:MOD-obj.OBJ*/ /* Link in Object file */ -/*$F+*/ /* force calls to be 'far'*/ - -namespace Avalanche { - -extern void modvolume(integer v1, integer v2, integer v3, integer v4); /*Can do while playing*/ -extern void moddevice(integer &device); -extern void modsetup(integer &status, integer device, integer mixspeed, integer pro, integer loop, string &stri); -extern void modstop(); -extern void modinit(); -/*$F-*/ - -void sb_start(string md) { - integer dev, mix, stat, pro, loop; - - modinit(); - dev = 7; /* Sound Blaster */ - mix = 10000; /*use 10000 normally */ - pro = 0; /*Leave at 0*/ - loop = 4; /*4 means mod will play forever*/ - modvolume(255, 255, 255, 255); /* Full volume */ - modsetup(stat, dev, mix, pro, loop, md); -} - -void sb_stop() { - modstop(); -} - -void sb_link() { /* At the moment, this does nothing. */ -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackb1.h b/engines/avalanche/sackb1.h deleted file mode 100644 index 7ac3cce0a388..000000000000 --- a/engines/avalanche/sackb1.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __sackb1_h__ -#define __sackb1_h__ - - -/*#include "Crt.h"*/ - -namespace Avalanche { - -void sb_start(string md); - -void sb_stop(); - -void sb_link(); /* At the moment, this does nothing. */ - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/sackb3.cpp b/engines/avalanche/sackb3.cpp deleted file mode 100644 index a77431077f2a..000000000000 --- a/engines/avalanche/sackb3.cpp +++ /dev/null @@ -1,50 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M 16384,0,0*/ - -/* to demonstrate the SBVoice Unit */ -/* Copyright 1991 Amit K. Mathur, Windsor, Ontario */ - -/*#include "SBVoice.h"*/ - -namespace Avalanche { - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - if (paramcount > 0) { - loadvoice(paramstr(1), 0, 0); - sb_output(seg(soundfile), ofs(soundfile) + 26); - do { - output << "Demo of the SBVoice Unit, Copyright 1991 by Amit K. Mathur --- "; - } while (!(statusword == 0)); - } else - output << "Usage: DEMO [d:\\path\\]filename.voc" << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sackblas.cpp b/engines/avalanche/sackblas.cpp deleted file mode 100644 index 0c35671e9b42..000000000000 --- a/engines/avalanche/sackblas.cpp +++ /dev/null @@ -1,26 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ \ No newline at end of file diff --git a/engines/avalanche/saving.cpp b/engines/avalanche/saving.cpp deleted file mode 100644 index 8d52e76a65ed..000000000000 --- a/engines/avalanche/saving.cpp +++ /dev/null @@ -1,78 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; -byte a /*absolute $A000:(15*80)*/; -byte bit; -untyped_file f; - -void load(string nam) { - byte z; - array<1, 4, pointer> a; - untyped_file f; - word s; - string check; - assign(f, nam); - reset(f, 1); - blockread(f, check, 41); - blockread(f, check, 13); - blockread(f, check, 31); - s = imagesize(0, 0, getmaxx(), 75); - for (z = 1; z <= 2; z ++) { - getmem(a[z], s); - blockread(f, a[z], s); - setactivepage(0); - putimage(0, 15 + (z - 1) * 75, a[z], 0); - freemem(a[z], s); - } - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - load("d:britain.avd"); - assign(f, "c:\\sleep\\test.ega"); - rewrite(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, a, 12000); - } - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_1.cpp b/engines/avalanche/scr_1.cpp deleted file mode 100644 index bb5fa1d84f11..000000000000 --- a/engines/avalanche/scr_1.cpp +++ /dev/null @@ -1,133 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<4> codes = " "; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -byte x, xx, y; -string title, fn; -file f; -fonttype font; -byte code; - - -typedef array<1, 3840, byte> atype; - -void save() { - file f; - word fv; - atype a /*absolute $B800:0*/; - assign(f, "TEXT1.SCR"); - rewrite(f); - f << a; - close(f); -} - -void centre(byte y, string z) { - gotoxy(40 - length(z) / 2, y); - output << z; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - /* write('Title?'); readln(title); - write('Font?'); readln(fn); */ - textattr = 0; - clrscr; - title = "Bug Alert!"; - fn = ""; - for (xx = 1; xx <= 77; xx ++) { - gotoxy(Random(80) + 1, Random(24) + 1); - switch (Random(2)) { - case 0: - textattr = red; - break; - case 1: - textattr = lightred; - break; - } - switch (Random(4)) { - case 0: - output << '*'; - break; - case 1: - output << '\17'; - break; - case 2: - output << ''; - break; - case 3: - output << ''; - break; - } - } - textattr = 12; - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); - for (y = 0; y <= 3; y ++) { - for (x = 1; x <= length(title); x ++) { - for (xx = 7; xx >= 0; xx --) { - code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + - (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; - gotoxy(1 + x * 8 - xx, y + 1); - if (code > 0) output << codes[code + 1 - 1]; - } - } - /*if wherex<>1 then writeln;*/ - } - textattr = red; - centre(7, "An internal error has just occurred within the program."); - - textattr = white; - gotoxy(26, 9); - output << "Error number: "; - textattr = lightred; - output << " "; - textattr = white; - gotoxy(27, 10); - output << "at location: "; - textattr = lightred; - output << " "; - centre(12, "This screen should never come up..."); - centre(13, "but it just has!"); - textattr = 15; - centre(15, "So, please tell Thorsoft about this as soon as"); - centre(16, "possible, so that we can fix it."); - textattr = red; - centre(20, "Thanks..."); - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_2.cpp b/engines/avalanche/scr_2.cpp deleted file mode 100644 index 039583a0212f..000000000000 --- a/engines/avalanche/scr_2.cpp +++ /dev/null @@ -1,147 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<4> codes = " "; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -byte x, xx, y; -string qq; -file f; -fonttype font; -byte code; - - -typedef array<1, 3840, byte> atype; - -void save() { - file f; - word fv; - atype a /*absolute $B800:0*/; - assign(f, "TEXT2.SCR"); - rewrite(f); - f << a; - close(f); -} - -void centre(byte y, string z) { - byte fv; - for (fv = 1; fv <= length(z); fv ++) { - gotoxy(39 - length(z) / 2 + fv, y); - if (odd(fv + y)) textattr = 2; - else textattr = cyan; - if (z[fv] != '\40') output << z[fv]; - } -} - -void line(byte yy, string title) { - const integer offset = 5; - for (y = 1; y <= 6; y ++) { - qq = ""; - for (x = 1; x <= length(title); x ++) { - for (xx = 7; xx >= 0; xx --) { - code = (byte)(((1 << xx) & font[title[x]][y * 2 - offset]) > 0) + - (byte)(((1 << xx) & font[title[x]][y * 2 + 1 - offset]) > 0) * 2; - qq = qq + codes[code + 1 - 1]; - } - } - centre(y + yy, qq); - } -} - -void chips() { - byte fv, x, y; - for (fv = 0; fv <= 1; fv ++) { - textattr = 120; - for (y = 2; y <= 6; y ++) { - gotoxy(fv * 67 + 3, y); - output << " "; - if (fv == 1) output << ' '; - } - gotoxy(fv * 67 + 4, 4); - if (fv == 0) output << "RAM"; - else output << "CRAM"; - textattr = 7; - for (x = 0; x <= 1; x ++) - for (y = 2; y <= 6; y ++) { - gotoxy(fv * 67 + 2 + x * (6 + fv), y); - output << ''; - } - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 0; - clrscr; - chips(); - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); - line(0, "Out of"); - line(4, "memory!"); - centre(11, "Yes, RAM cram strikes again- Avvy has just run out of RAM (not the"); - centre(12, "hydraulic, woolly or village kinds.) Fortunately, there are a few things"); - centre(13, "you can do about this:"); - textattr = 3; - for (xx = 15; xx <= 17; xx ++) { - gotoxy(23, xx); - output << '\20'; - } - textattr = 2; - gotoxy(25, 15); - output << "Don't run Avvy in a DOS shell."; - gotoxy(25, 16); - output << "If that fails, try un-installing your TSRs."; - gotoxy(25, 17); - output << "If you've got DOS 50 or above, try using"; - gotoxy(28, 18); - textattr = 3; - output << "dos=high"; - textattr = 2; - output << ','; - textattr = 3; - output << " loadhigh"; - textattr = 2; - output << " and"; - textattr = 3; - output << " devicehigh"; - textattr = 2; - output << '.'; - gotoxy(28, 19); - output << "See your DOS manual for details..."; - centre(23, "Sorry for any inconvenience..."); - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_3.cpp b/engines/avalanche/scr_3.cpp deleted file mode 100644 index 3dd3373cea0f..000000000000 --- a/engines/avalanche/scr_3.cpp +++ /dev/null @@ -1,132 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<4> codes = " "; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -byte x, xx, y; -string qq; -file f; -fonttype font; -byte code; - - -typedef array<1, 3840, byte> atype; - -void save() { - file f; - word fv; - atype a /*absolute $B800:0*/; - assign(f, "TEXT3.SCR"); - rewrite(f); - f << a; - close(f); -} - -void centre(byte y, string z) { - byte fv; - for (fv = 1; fv <= length(z); fv ++) { - gotoxy(39 - length(z) / 2 + fv, y); - if (z[fv] != '\40') output << z[fv]; - } -} - -void line(byte cx, byte cy, string title) { - for (y = 0; y <= 4; y ++) { - qq = ""; - for (x = 1; x <= length(title); x ++) { - for (xx = 7; xx >= 0; xx --) { - code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + - (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; - qq = qq + codes[code + 1 - 1]; - } - } - gotoxy(cx, cy + y); - output << qq; - } -} - -void big_t() { - text t; - string x; - byte y; - assign(t, "c:\\avalot\\t.txt"); - reset(t); - y = 1; - while (! eof(t)) { - t >> x >> NL; - gotoxy(1, y); - output << x; - y += 1; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 4; - clrscr; - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); - textattr = 4; - line(19, 4, "hanks"); - textattr = 6; - line(23, 8, "for"); - line(7, 12, "playing"); - textattr += 8; - line(12, 16, "Avalot."); - textattr = 12; - big_t(); - textattr = 8; - gotoxy(40, 2); - output << "(c) 1994, Mike, Mark and Thomas Thurman."; - textattr = 11; - gotoxy(50, 10); - output << "* Goodbyte! *"; - textattr = 10; - gotoxy(9, 20); - output << '\20'; - textattr = 12; - output << " If you'd like to see yet more of these games, then don't forget to"; - gotoxy(12, 21); - output << "register, or your"; - clreol; - gotoxy(12, 22); - output << "for the rest of your life!"; - gotoxy(60, 22); - output << "(Only joking!)"; - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_4.cpp b/engines/avalanche/scr_4.cpp deleted file mode 100644 index 05e5fdcc3fda..000000000000 --- a/engines/avalanche/scr_4.cpp +++ /dev/null @@ -1,121 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<4> codes = " "; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -byte x, xx, y; -string qq; -file f; -fonttype font; -byte code; - -void centre(byte y, string z) { - byte fv; - for (fv = 1; fv <= length(z); fv ++) { - gotoxy(39 - length(z) / 2 + fv, y); - if (z[fv] != '\40') output << z[fv]; - } -} - -void line(byte cy, string title) { - for (y = 0; y <= 6; y ++) { - qq = ""; - for (x = 1; x <= length(title); x ++) { - for (xx = 3; xx >= 0; xx --) { - code = (byte)(((1 << (xx * 2)) & font[title[x]][y]) > 0) + - (byte)(((1 << (xx * 2 + 1)) & font[title[x]][y]) > 0) * 2; - qq = qq + codes[code + 1 - 1]; - } - } - centre(cy + y, qq); - } -} - -void big_t() { - text t; - string x; - byte y; - assign(t, "c:\\avalot\\t.txt"); - reset(t); - y = 1; - while (! eof(t)) { - t >> x >> NL; - gotoxy(1, y); - output << x; - y += 1; - } -} - -void box(byte x1, byte y1, byte x2, byte y2, string z) { - byte fv; - gotoxy(x1, y1); - output << z[1]; /* tl */ - gotoxy(x2, y1); - output << z[2]; /* tr */ - gotoxy(x1, y2); - output << z[3]; /* bl */ - gotoxy(x2, y2); - output << z[4]; /* br */ - for (fv = y1 + 1; fv <= y2 - 1; fv ++) { - gotoxy(x1, fv); - output << z[5]; /* verticals */ - gotoxy(x2, fv); - output << z[6]; - } - gotoxy(x1 + 1, y1); - for (fv = x1 + 1; fv <= x2 - 1; fv ++) output << z[7]; - gotoxy(x1 + 1, y2); - for (fv = x1 + 1; fv <= x2 - 1; fv ++) output << z[8]; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 26; - clrscr; - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); - line(3, "CONGRATULATIONS!"); - textattr = 30; - box(4, 1, 74, 11, "ɻȼ"); - textattr = 33; - box(6, 2, 72, 10, "/\\\\/"); - textattr = 30; - centre(12, "Well done!"); - textattr = 27; - centre(14, "You completed the game!"); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_5.cpp b/engines/avalanche/scr_5.cpp deleted file mode 100644 index a61bf86e9f23..000000000000 --- a/engines/avalanche/scr_5.cpp +++ /dev/null @@ -1,143 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -const varying_string<4> codes = " "; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -byte x, xx, y; -string qq; -file f; -fonttype font; -byte code; - - -typedef array<1, 3840, byte> atype; - -void save() { - file f; - word fv; - atype a /*absolute $B800:0*/; - assign(f, "TEXT5.SCR"); - rewrite(f); - f << a; - close(f); -} - -void line(byte cx, byte cy, string title) { - for (y = 0; y <= 4; y ++) { - qq = ""; - for (x = 1; x <= length(title); x ++) { - for (xx = 7; xx >= 0; xx --) { - code = (byte)(((1 << xx) & font[title[x]][y * 2]) > 0) + - (byte)(((1 << xx) & font[title[x]][y * 2 + 1]) > 0) * 2; - qq = qq + codes[code + 1 - 1]; - } - } - gotoxy(cx, cy + y); - output << qq; - } -} - -void uline() { - byte fv, ff; - for (fv = 1; fv <= 10; fv ++) { - gotoxy(16 - fv, 21 - fv); - textattr = fv; - for (ff = 1; ff <= fv; ff ++) output << "-"; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - textattr = 0; - clrscr; - assign(f, "c:\\thomas\\ttsmall.fnt"); - reset(f); - f >> font; - close(f); - textattr = 11; - line(1, 3, "Two at"); - line(3, 7, "once?!"); - textattr = 9; - gotoxy(55, 4); - output << string('\4') + '\377'; - textattr = 3; - output << "You're trying to run"; - gotoxy(54, 5); - output << "two copies of Avalot"; - gotoxy(54, 6); - output << "at once."; - gotoxy(57, 8); - output << "Although this "; - textattr = 9; - output << "is"; - textattr = 3; - gotoxy(54, 9); - output << "usually possible, it's"; - gotoxy(54, 10); - output << "probably more sensible"; - gotoxy(54, 11); - output << "to type "; - textattr = 7; - output << "EXIT "; - textattr = 3; - output << "now, which"; - gotoxy(54, 12); - output << "should return you to the"; - gotoxy(54, 13); - output << "first copy in memory."; - - textattr = 11; - gotoxy(55, 15); - output << "BUT:"; - textattr = 9; - gotoxy(40, 16); - output << "If you want to run two copies anyway,"; - gotoxy(40, 17); - output << "or you think that I've got it wrong,"; - gotoxy(40, 18); - output << "(even computers can make mistakes!) then"; - gotoxy(40, 19); - output << "try running the game again, but this time"; - gotoxy(40, 20); - output << "use "; - textattr = 7; - output << "/i "; - textattr = 9; - output << "on the command line."; - uline(); - - save(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scr_9.cpp b/engines/avalanche/scr_9.cpp deleted file mode 100644 index 6b0f3cd79454..000000000000 --- a/engines/avalanche/scr_9.cpp +++ /dev/null @@ -1,50 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -text t; -string x; -byte fv; -untyped_file f; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(f, "v:paralogo.scr"); - clrscr; - reset(f, 1); - blockread(f, mem[0xb800 * 0], 4000); - close(f); - gotoxy(1, 1); - insline; - gotoxy(1, 23); - clreol; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp deleted file mode 100644 index 71bb0360eab4..000000000000 --- a/engines/avalanche/scrolls.cpp +++ /dev/null @@ -1,945 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - SCROLLS The scroll driver. */ -/* $D-*/ -#define __scrolls_implementation__ - -/*$V-*/ - -#include "scrolls.h" - -#include "lucerna.h" -#include "Graph.h" -/*#include "Crt.h"*/ -#include "trip5.h" -#include "enhanced.h" -/*#include "Dos.h"*/ -#include "logger.h" -#include "Acci.h" -#include "basher.h" -#include "visa.h" -#include "timeout.h" - -namespace Avalanche { - -const integer roman = 0; -const integer italic = 1; - -const integer halficonwidth = 19; /* Half the width of an icon. */ - -integer dix, diy; -array ch; -byte cfont; /* Current font */ - -integer dodgex, dodgey; -byte param; /* For using arguments code */ - -byte use_icon; - -void state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - - if (ledstatus == x) return; /* Already like that! */ - switch (x) { - case 0: - setfillstyle(1, black); - break; /* Off */ - case 1: - setfillstyle(9, green); - break; /* Half-on (menus) */ - case 2: - setfillstyle(1, green); - break; /* On (kbd) */ - case 3: - setfillstyle(6, green); - break; /* Hit a key */ - } - super_off(); - for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - bar(419, 195, 438, 197); - } - super_on(); - ledstatus = x; -} - -void easteregg() { - word fv, ff; - - background(15); - for (fv = 4; fv <= 100; fv ++) - for (ff = 0; ff <= 70; ff ++) { - sound(fv * 100 + ff * 10); - delay(1); - } - nosound; - setcolor(10); - settextstyle(0, 0, 3); - settextjustify(1, 1); - outtextxy(320, 100, "GIED"); - settextstyle(0, 0, 1); - settextjustify(0, 2); - background(0); -} - -void say(integer x, integer y, string z) { /* Fancy FAST screenwriting */ - const integer locol = 2; - byte xx, yy, ox, bit, lz, t; - integer yp; - boolean offset; - matrix<1, 12, 1, 80, byte> itw; - - offset = x % 8 == 4; - x = x / 8; - lz = length(z); - ox = 0; - log_scrollline(); - - for (xx = 1; xx <= lz; xx ++) { - switch (z[xx]) { - case '\22': { - cfont = roman; - log_roman(); - } - break; - case '\6': { - cfont = italic; - log_italic(); - } - break; - default: { - ox += 1; - for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; - log_scrollchar(z[xx]); - } - } - } - - lz = ox; - if (offset) { - /* offsetting routine */ - lz += 1; - for (yy = 1; yy <= 12; yy ++) { - bit = 240; - itw[yy][lz] = 255; - for (xx = 1; xx <= lz; xx ++) { - t = itw[yy][xx]; - itw[yy][xx] = bit + t / 16; - bit = t << 4; - } - } - } - yp = x + y * 80 + (1 - cp) * pagetop; - for (yy = 1; yy <= 12; yy ++) { - yp += 80; - for (bit = 0; bit <= locol; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(itw[yy], mem[0xa000 * yp], lz); - } - } -} - -/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ - -void normscroll() { - const array<1, 8, char> egg = string("\20\f\25\7\b") + "***"; - const array<1, 8, char> e = "(c) 1994"; - char r; - boolean oktoexit; - - state(3); - seescroll = true; - off_virtual(); - on(); - newpointer(4); - mousepage(1 - cp); - - if (demo) get_demorec(); - - do { - do { - check(); /* was "checkclick;" */ - -#ifdef RECORD slowdown(); basher::count += 1; #endif - - if (demo) { - if (demo_ready()) flush(); - if (keypressede()) exit(0); - } else if (keypressede()) flush(); - } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); - - - if (mrelease == 0) { - inkey(); - if (aboutscroll) { - move(e[2 - 1], e[1 - 1], 7); - e[8 - 1] = inchar; - if (egg == e) easteregg(); - } - oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); - if (! oktoexit) errorled(); - } - - } while (!((oktoexit) || (mrelease > 0))); -#ifdef RECORD record_one(); #endif - screturn = r == '#'; /* "back door" */ - state(0); - seescroll = false; - mousepage(cp); - off(); -} - -void dialogue() { - char r; - - state(3); - seescroll = true; - r = '\0'; - newpointer(6); - on(); - mousepage(1 - cp); - do { - do { - check(); - if (mrelease > 0) { - if ((mx >= (cardinal)dix - 65) && (my >= (cardinal)diy - 24) && (mx <= (cardinal)dix - 5) && (my <= (cardinal)diy - 10)) - r = 'Y'; - if ((mx >= (cardinal)dix + 5) && (my >= (cardinal)diy - 24) && (mx <= (cardinal)dix + 65) && (my <= (cardinal)diy - 10)) - r = 'N'; - } else if (keypressede()) { - inkey(); - r = upcase(inchar); - } - } while (!(r != '\0')); - } while (!(set::of('Y', 'N', 'O', 'J', eos).has(r))); /* Yes, Ja, Oui, or No, Non, Nein */ - screturn = r != 'N'; - state(0); - seescroll = false; - mousepage(cp); - off(); -} - -void music_scroll(); - - -static void store_(byte what, tunetype &played) { - move(played[2], played[1], sizeof(played) - 1); - played[31] = what; -} - - - -static boolean they_match(tunetype &played) { - byte fv, mistakes; - - boolean they_match_result; - mistakes = 0; - - for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != tune[fv]) { - mistakes += 1; - } - - they_match_result = mistakes < 5; - return they_match_result; -} - -void music_scroll() { - char r; - byte value; - - byte last_one, this_one; - - tunetype played; - - - state(3); - seescroll = true; - on(); - newpointer(4); - do { - do { - check(); /* was "checkclick;" */ - if (keypressede()) flush(); - } while (!((mpress > 0) || (buttona1()) || (buttonb1()))); - - if (mpress == 0) { - inkey(); - r = upcase(inchar); - if (r == 'Z') r = 'Y'; /* Euro keyboards */ - - value = pos(r, keys); - - if (value > 0) { - - last_one = this_one; - this_one = value; - - sound(notes[this_one]); - delay(100); - nosound; - - if (! dna.ringing_bells) { - /* These handle playing the right tune. */ - - if (this_one < last_one) - store_(lower, played); - else - - if (this_one == last_one) - store_(same, played); - else - - store_(higher, played); - - if (they_match(played)) { - screturn = true; - off(); - state(0); - seescroll = false; - - set_up_timer(8, procjacques_wakes_up, reason_jacques_waking_up); - return; - } - - } - - } - - } - - } while (!((set::of('\15', '\33', '+', '#', eos).has(r)) || (mpress > 0))); - screturn = false; - off(); - state(0); - seescroll = false; -} - -/* ThatsAll, so put us back to */ /*$F-*/ - -void resetscrolldriver() { /* phew */ - scrollbells = 0; - cfont = roman; - log_epsonroman(); - use_icon = 0; - interrogation = 0; /* always reset after a scroll comes up. */ -} - -void dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ - byte fv; - - for (fv = 1; fv <= scrollbells; fv ++) errorled(); /* ring the bell "x" times */ -} - -void dodgem() /* This moves the mouse pointer off the scroll so that - you can read it. */ -{ - xycheck(); /* Mx & my now contain xy pos of mouse */ - dodgex = mx; - dodgey = my; /* Store 'em */ - hopto(dodgex, underscroll); /* Move the pointer off the scroll. */ -} - -void undodgem() /* This is the opposite of Dodgem. It moves the - mouse pointer back, IF you haven't moved it in the meantime. */ -{ - xycheck(); - if ((mx == (cardinal)dodgex) && (my == (cardinal)underscroll)) - /* No change, so restore the pointer's original position. */ - hopto(dodgex, dodgey); -} - -void geticon(integer x, integer y, byte which) { - untyped_file f; - pointer p; - - assign(f, "icons.avd"); - reset(f, 1); - which -= 1; - seek(f, which * 426); - getmem(p, 426); - blockread(f, p, 426); - putimage(x, y, p, 0); - freemem(p, 426); - close(f); -} - -void block_drop(string fn, integer xl, integer yl, integer y) { - untyped_file f; - byte bit; - integer fv; - word st; - - st = (y - 1) * 80 + (40 - xl / 2) + ((1 - cp) * pagetop); - - assign(f, fn + ".avd"); - reset(f, 1); - - for (fv = 1; fv <= yl; fv ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (fv * 80)], xl); - } - - close(f); - bit = getpixel(0, 0); -} - -void drawscroll(proc gotoit) { /* This is one of the oldest procs in the game. */ - byte b, groi; - integer lx, ly, mx, my, ex, ey; - boolean centre; - byte icon_indent; - - off_virtual(); - setvisualpage(cp); - setactivepage(1 - cp); - oncandopageswap = false; /* On can now no longer swap pages. So we can - do what we want without its interference! */ - log_epsonroman(); /* Scrolls always START with Roman. */ - lx = 0; - ly = scrolln * 6; - for (b = 1; b <= scrolln; b ++) { - ex = length(scroll[b]) * 8; - if (lx < ex) lx = ex; - } - mx = 320; - my = 100; /* Getmaxx & getmaxy div 2, both. */ - lx = lx / 2; - ly -= 2; - - if (set::of(range(1, 34), eos).has(use_icon)) lx += halficonwidth; - - off(); - /* mblit(mx-lx-46,my-ly-6,mx+lx+15,my+ly+6,0,3);*/ - setfillstyle(1, 7); - setcolor(7); - pieslice(mx + lx, my - ly, 360, 90, 15); - pieslice(mx + lx, my + ly, 270, 360, 15); - setcolor(4); - arc(mx + lx, my - ly, 360, 90, 15); - arc(mx + lx, my + ly, 270, 360, 15); - bar(mx - lx - 30, my + ly + 6, mx + lx, my + ly); - bar(mx - lx - 30, my - ly - 6, mx + lx, my - ly); - bar(mx - lx - 15, my - ly, mx + lx + 15, my + ly); - setfillstyle(1, 8); - pieslice(mx - lx - 31, my - ly, 360, 180, 15); - pieslice(mx - lx - 31, my + ly, 180, 360, 15); - setfillstyle(1, 4); - bar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 6); - bar(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 6); - bar(mx - lx - 15, my - ly, mx - lx - 15, my + ly); - bar(mx + lx + 15, my - ly, mx + lx + 15, my + ly); - ex = mx - lx; - ey = my - ly; - mx -= lx; - my -= ly + 2; - setcolor(0); - centre = false; - - switch (use_icon) { - case 0: - icon_indent = 0; - break; /* No icon. */ - case 1 ... 33: { /* Standard icon */ - geticon(mx, my + ly / 2, use_icon); - icon_indent = 53; - } - break; - case 34: { - block_drop("about", 28, 76, 15); - icon_indent = 0; - } - break; - case 35: { - block_drop("gameover", 52, 59, 71); - icon_indent = 0; - } - break; - } - - for (b = 1; b <= scrolln; b ++) { - switch (scroll[b][length(scroll[b])]) { - case '\3' : { - centre = true; - scroll[b][0] -= 1; - } - break; - case '\14' : { - centre = false; - scroll[b][0] -= 1; - } - break; - case '\21' : { - settextjustify(1, 1); - dix = mx + lx; - diy = my + ly; - scroll[b][1] = '\40'; - groi = getpixel(0, 0); - /* inc(diy,14);*/ - shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); - shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); - } - break; - } - - if (centre) - say(320 - length(scroll[b]) * 4 + icon_indent, my, scroll[b]); - else - say(mx + icon_indent, my, scroll[b]); - log_scrollendline(centre); - my += 12; - } - - underscroll = my + 3; - setvisualpage(1 - cp); - dingdongbell(); - my = getpixel(0, 0); - dropsok = false; - dodgem(); - - gotoit(); - - undodgem(); - dropsok = true; - log_divider(); - setvisualpage(cp); - mousepage(cp); - off(); - /* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/ - mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); - blitfix(); - oncandopageswap = true; /* Normality again */ - on(); - settextjustify(0, 0); /*sink*/ - resetscrolldriver(); - if (mpress > 0) after_the_scroll = true; -} - -void bubble(proc gotoit) { - integer xl, yl, my, xw, yw; - byte fv; - array<1, 3, pointtype> p; - pointer rp1, rp2; /* replace: 1=bubble, 2=pointer */ - integer xc; /* x correction */ - - setvisualpage(cp); - setactivepage(1 - cp); - oncandopageswap = false; /* On can now no longer swap pages. So we can - do what we want without its interference! */ - mousepage(1 - cp); /* Mousepage */ - - setfillstyle(1, talkb); - setcolor(talkb); - off(); - - xl = 0; - yl = scrolln * 5; - for (fv = 1; fv <= scrolln; fv ++) - if (textwidth(scroll[fv]) > xl) xl = textwidth(scroll[fv]); - xl = xl / 2; - - xw = xl + 18; - yw = yl + 7; - my = yw * 2 - 2; - xc = 0; - - if ((talkx - xw) < 0) xc = -(talkx - xw); - if ((talkx + xw) > 639) xc = 639 - (talkx + xw); - - p[1].x = talkx - 10; - p[1].y = yw; - p[2].x = talkx + 10; - p[2].y = yw; - p[3].x = talkx; - p[3].y = talky; - - /* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); - mblit(talkx-10,my,talkx+10,talky,0,3);*/ - bar(xc + talkx - xw + 10, 7, talkx + xw - 10 + xc, my); - bar(xc + talkx - xw, 12, talkx + xw + xc, my - 5); - pieslice(xc + talkx + xw - 10, 12, 360, 90, 9); /* TR */ - pieslice(xc + talkx + xw - 10, my - 5, 270, 360, 9); /* BR */ - pieslice(xc + talkx - xw + 10, 12, 90, 180, 9); /* TL */ - pieslice(xc + talkx - xw + 10, my - 5, 180, 270, 9); /* BL */ - fillpoly(3, p.body()); - - setcolor(talkf); - yl -= 3; - settextjustify(1, 2); - for (fv = 0; fv <= scrolln - 1; fv ++) - outtextxy(talkx + xc, (fv * 10) + 12, scroll[fv + 1]); - for (fv = 1; fv <= scrolln; fv ++) /* These should be separate loops. */ - log_bubbleline(fv, param, scroll[fv]); - log_divider(); - - setvisualpage(1 - cp); - dingdongbell(); - oncandopageswap = false; - on(); - dropsok = false; - gotoit(); - off(); - dropsok = true; - mblit((talkx - xw + xc) / 8, 7, 1 + (talkx + xw + xc) / 8, my, 3, 1 - cp); - mblit((talkx - 10) / 8, my, 1 + (talkx + 10) / 8, talky, 3, 1 - cp); - blitfix(); - - setvisualpage(cp); - settextjustify(0, 0); - on(); /*sink;*/ - oncandopageswap = true; - resetscrolldriver(); - if (mpress > 0) after_the_scroll = true; -} - -boolean ask(string question) { - boolean ask_result; - display(question + '\15' + '\21'); - if (screturn && (Random(2) == 0)) { /* half-and-half chance */ - display("...Positive about that?\23I\26\r\21"); /* be annoying! */ - if (screturn && (Random(4) == 3)) /* another 25% chance */ - display("\n100% certain\??!\n\26\r\21"); /* be very annoying! */ - } - ask_result = screturn; - return ask_result; -} - -void resetscroll() { - scrolln = 1; - fillchar(scroll, sizeof(scroll), '\0'); -} - -void natural() { /* Natural state of bubbles */ - talkx = 320; - talky = 200; - talkb = 8; - talkf = 15; -} - -string lsd() { - string x; - - string lsd_result; - if (dna.pence < 12) { - /* just pence */ - x = strf(dna.pence) + 'd'; - } else if (dna.pence < 240) { - /* shillings & pence */ - x = strf(dna.pence / longint(12)) + '/'; - if ((dna.pence % longint(12)) == 0) x = x + '-'; - else x = x + strf(dna.pence % longint(12)); - } else /* L, s & d */ - x = string('') + strf(dna.pence / longint(240)) + '.' + strf((dna.pence / longint(12)) % longint(20)) + '.' + - strf(dna.pence % longint(12)); - if (dna.pence > 12) x = x + " (that's " + strf(dna.pence) + "d)"; - lsd_result = x; - return lsd_result; -} - -void calldrivers(); -/* Was the mouse cursor virtual on entry to this proc? */ - -static void strip(string &q) { - while (pos("\40", q[length(q)]) > 0) q[0] -= 1; /* strip trailing spaces */ -} - - - -static void solidify(byte n) { - if (pos("\40", scroll[n]) == 0) return; /* no spaces */ - /* so there MUST be a space there, somewhere... */ - do { - scroll[n + 1] = string(scroll[n][length(scroll[n])]) + scroll[n + 1]; - scroll[n][0] -= 1; - } while (!(scroll[n][length(scroll[n])] == '\40')); - strip(scroll[n]); -} - -void calldrivers() { - word fv; - byte nn; - char nnn; - boolean mouthnext; - boolean call_spriterun; /* Only call sprite_run the FIRST time. */ - - boolean was_virtual; - - - nosound; - state(0); - screturn = false; - mouthnext = false; - call_spriterun = true; - - switch (buffer[bufsize]) { - case '\4': - bufsize -= 1; - break; /* ^D = (D)on't include pagebreak */ - case '\2': - case '\21': - break; /* ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box */ - default: { - bufsize += 1; - buffer[bufsize] = '\20'; - } - } - for (fv = 1; fv <= bufsize; fv ++) - if (mouthnext) { - if (buffer[fv] == '\23') param = 0; - else - switch (buffer[fv]) { - case RANGE_10('0', '9'): - param = ord(buffer[fv]) - 48; - break; - case RANGE_26('A', 'Z'): - param = ord(buffer[fv]) - 55; - break; - } - mouthnext = false; - } else - switch (buffer[fv]) { - case '\20': { - if ((scrolln == 1) && (scroll[1] == "")) flush(); - - if (call_spriterun) sprite_run(); - call_spriterun = false; - - was_virtual = visible == m_virtual; - if (was_virtual) off_virtual(); - drawscroll(normscroll); - if (was_virtual) on_virtual(); - resetscroll(); - if (screturn) return; - } - break; - case '\7': - scrollbells += 1; - break; /* #7 = "Bel" */ - case '\2': { - if ((scrolln == 1) && (scroll[1] == "")) flush(); - - if (call_spriterun) sprite_run(); - call_spriterun = false; - switch (param) { - case 0: - natural(); - break; /* Not attached: generic bubble with no speaker. */ - case RANGE_9(1, 9): - if ((param > numtr) || (! tr[param].quick)) { - /* not valid */ - errorled(); - natural(); - } else tr[param].chatter(); - break; /* Normal sprite talking routine. */ - case 10 ... 36: { - quasiped_type &with = quasipeds[param]; - /* Quasi-peds. (This routine performs the same - thing with QPs as triptype.chatter does with the - sprites.) */ - { - pedtype &with1 = peds[with.whichped]; - - talkx = with1.x; - talky = with1.y; /* Position. */ - } - talkf = with.fgc; - talkb = with.bgc; /* Colours. */ - } - break; - default: { - errorled(); /* not valid */ - natural(); - } - } - - was_virtual = visible == m_virtual; - if (was_virtual) off_virtual(); - bubble(normscroll); - if (was_virtual) on_virtual(); - resetscroll(); - if (screturn) return; - } - break; - case '\25': { - { - dnatype &with = dna; - switch (param) { - case 1: - display(lsd() + '\4'); - break; /* insert cash balance (recursion) */ - case 2: - display(words[first_password + with.pass_num].w + '\4'); - break; - case 3: - display(with.like2drink + '\4'); - break; - case 4: - display(with.favourite_song + '\4'); - break; - case 5: - display(with.worst_place_on_earth + '\4'); - break; - case 6: - display(with.spare_evening + '\4'); - break; - /* ... */ - case 9: - display(strf(with.cat_x) + ',' + strf(with.cat_y) + '\4'); - break; - case 10: - switch (with.box_contents) { - case '\0': { /* Sixpence. */ - dixi('q', 37); /* You find the sixpence. */ - with.pence += 6; - with.box_contents = nowt; - points(2); - return; - } - break; - case nowt: - display("nothing at all. It's completely empty."); - break; - default: - display(get_better(with.box_contents) + '.'); - } - break; - case 11: { - nn = 1; - for (nnn = '\1'; nnn <= numobjs; nnn ++) - if (with.obj[nnn]) { - nn += 1; - display(get_better(nnn) + ", " + '\4'); - } - } - break; - } - } - } - break; - case '\26': - use_icon = param; - break; - case '\15': - scrolln += 1; - break; - case '\21': { - if (call_spriterun) sprite_run(); - call_spriterun = false; - - scrolln += 1; - scroll[scrolln] = '\21'; - was_virtual = visible == m_virtual; - if (was_virtual) off_virtual(); - drawscroll(dialogue); - if (was_virtual) on_virtual(); - resetscroll(); - } - break; - case '\23' : - mouthnext = true; - break; - case '\11' : - for (nn = 1; nn <= 9; nn ++) scroll[scrolln] = scroll[scrolln] + ' '; - break; - default: { - /* add new char */ - if (length(scroll[scrolln]) == 50) { - solidify(scrolln); - scrolln += 1; - } - scroll[scrolln] = scroll[scrolln] + buffer[fv]; - } - } -} - -void display(string z) { - bufsize = length(z); - move(z[1], buffer, bufsize); - calldrivers(); -} - -void loadfont() { - file f; - - assign(f, "avalot.fnt"); - reset(f); - f >> ch[0]; - close(f); - assign(f, "avitalic.fnt"); - reset(f); - f >> ch[1]; - close(f); - assign(f, "ttsmall.fnt"); - reset(f); - f >> little; - close(f); -} - -void okay() { - display("Okay!"); -} - -void musical_scroll() { - boolean was_virtual; - - display(string("To play the harp...\r\rUse these keys:\r\n") + - "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); - - sprite_run(); - - was_virtual = visible == m_virtual; - if (was_virtual) off_virtual(); - drawscroll(music_scroll); - if (was_virtual) on_virtual(); - resetscroll(); -} - -class unit_scrolls_initialize { -public: - unit_scrolls_initialize(); -}; -static unit_scrolls_initialize scrolls_constructor; - -unit_scrolls_initialize::unit_scrolls_initialize() { - loadfont(); - resetscrolldriver(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/scrolls.h deleted file mode 100644 index 13928ef4ff0a..000000000000 --- a/engines/avalanche/scrolls.h +++ /dev/null @@ -1,63 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __scrolls_h__ -#define __scrolls_h__ - - -#include "gyro.h" -#include "joystick.h" - -namespace Avalanche { - -const boolean aboutscroll = false; /* Is this the about box? */ - -void state(byte x); /* Sets "Ready" light to whatever */ - -void drawscroll(proc gotoit); /* This is one of the oldest procs in the game. */ - -void bubble(proc gotoit); - -void resetscroll(); - -void calldrivers(); - -void display(string z); - -boolean ask(string question); - -void natural(); - -string lsd(); - -void okay(); /* Says "Okay!" */ - -void musical_scroll(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp deleted file mode 100644 index 57d39a91db09..000000000000 --- a/engines/avalanche/sequence.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - SEQUENCE The sequencer. */ - -#define __sequence_implementation__ - - -#include "sequence.h" - - -/*#include "Gyro.h"*/ -/*#include "Timeout.h"*/ -/*#include "Celer.h"*/ -/*#include "Trip5.h"*/ - -namespace Avalanche { - -void then_show(byte what) { - byte fv; - for (fv = 1; fv <= seq_length; fv ++) - if (seq[fv] == 0) { - seq[fv] = what; - return; - } -} - -void first_show(byte what) { - /* First, we need to blank out the entire array. */ - fillchar(seq, sizeof(seq), '\0'); - - /* Then it's just the same as then_show. */ - then_show(what); - -} - -void then_flip(byte where, byte ped) { - then_show(now_flip); - - dna.flip_to_where = where; - dna.flip_to_ped = ped; -} - -void start_to_close() { - lose_timer(reason_sequencer); - set_up_timer(7, procsequence, reason_sequencer); -} - -void start_to_open() { - dna.user_moves_avvy = false; /* They can't move. */ - stopwalking; /* And they're not moving now. */ - start_to_close(); /* Apart from that, it's the same thing. */ -} - -void call_sequencer(); - -/* This proc is called by Timeout when it's time to do another frame. */ -static void shove_left() { - move(seq[2], seq[1], seq_length - 1); /* Shift everything to the left. */ -} - -void call_sequencer() { - switch (seq[1]) { - case 0: - return; - break; /* No more routines. */ - case 1 ... 176: { - ; /* Show a frame. */ - show_one(seq[1]); - shove_left(); - } - break; - case 177: { - user_moves_avvy = true; - fliproom(flip_to_where, flip_to_ped); /* 177 = Flip room. */ - if (seq[1] == 177) shove_left(); - } - break; - } - - start_to_close(); /* Make sure this proc gets called again. */ -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h deleted file mode 100644 index 54bb1e72f2bb..000000000000 --- a/engines/avalanche/sequence.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __sequence_h__ -#define __sequence_h__ - -namespace Avalanche { - -const integer now_flip = 177; - -const integer seq_length = 10; - - -#ifdef __sequence_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, seq_length, byte> seq; -#undef EXTERN -#define EXTERN extern - - -void first_show(byte what); - -void then_show(byte what); - -void then_flip(byte where, byte ped); - -void start_to_close(); - -void start_to_open(); - -void call_sequencer(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/setup.cpp b/engines/avalanche/setup.cpp deleted file mode 100644 index 184e42f9a922..000000000000 --- a/engines/avalanche/setup.cpp +++ /dev/null @@ -1,1440 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -/*#include "Tommys.h"*/ -#include "joystick.h" - -namespace Avalanche { - -const integer selected = 0x60; /* Background for selected lines of text. */ - -typedef array<1, 400, varying_string<80> > mobytype; - -typedef set byteset; /* Define its typemark. */ - -enum option {_overrideegacheck, _zoomystart, _loadfirst, _numlockhold, _usemouse, - _controller, _logging, _logfile, - - _joystickinstalled, _joytop, _joybottom, _joyleft, _joyright, _joymidx, - _joymidy, _joycentringfactor, _whichjoy, _quiet, _soundcard, - _baseaddress, _irq, _dma, - _samplerate, _keyboardclick, - - _printer, - - option_error, last_option - }; - - -mobytype *moby; -word mobylength; -byte background; /* The current background colour, times 16. */ -byte line; /* Which line you're on in the menus. */ - -string registrant, reginum; - -byte num_printers; -array<1, 10, string> printers; -string this_printer; - -/* THE STATUS VARIABLES: */ - -/* general */ - -boolean override_ega; -boolean skip_loading_screens; -string load_particular; -boolean force_numlock; -boolean ignore_mouse; -boolean use_keyboard; -boolean log_to_printer; -boolean log_to_file; -string log_filename; -string autotype; - -/* joystick */ - -boolean has_a_joystick; -word jtop, jbottom, jleft, jright, jmidx, jmidy; -byte jcentre; -word whichjoy; - -/* sound */ - -boolean suppress_sfx; -byte your_card; -longint samplerate; -longint sound_addr, sound_irq, sound_dma; -boolean wants_keyclick; - -/* registration */ - -string regname, regnum, chkname, chknum; - - -string trim_and_caps(string this_) { - byte fv; - - string trim_and_caps_result; - while ((this_[1] == ' ') && (this_ != "")) - Delete(this_, 1, 1); /* Strip leading blanks. */ - while ((this_[length(this_)] == ' ') && (this_ != "")) - this_[0] -= 1; /* Strip trailing blanks. */ - for (fv = 1; fv <= length(this_); fv ++) this_[fv] = upcase(this_[fv]); /* And capitalise. */ - trim_and_caps_result = this_; - return trim_and_caps_result; -} - -option string_2_option(string field) { - - option string_2_option_result; - field = trim_and_caps(field); - - if (field == "OVERRIDEEGACHECK") string_2_option_result = _overrideegacheck; - else if (field == "ZOOMYSTART") string_2_option_result = _zoomystart; - else if (field == "LOADFIRST") string_2_option_result = _loadfirst; - else if (field == "NUMLOCKHOLD") string_2_option_result = _numlockhold; - else if (field == "USEMOUSE") string_2_option_result = _usemouse; - else if (field == "CONTROLLER") string_2_option_result = _controller; - else if (field == "LOGGING") string_2_option_result = _logging; - else if (field == "LOGFILE") string_2_option_result = _logfile; - else - - /* joystick */ - - if (field == "JOYSTICKINSTALLED") string_2_option_result = _joystickinstalled; - else if (field == "JOYTOP") string_2_option_result = _joytop; - else if (field == "JOYBOTTOM") string_2_option_result = _joybottom; - else if (field == "JOYLEFT") string_2_option_result = _joyleft; - else if (field == "JOYRIGHT") string_2_option_result = _joyright; - else if (field == "JOYMIDX") string_2_option_result = _joymidx; - else if (field == "JOYMIDY") string_2_option_result = _joymidy; - else if (field == "JOYCENTRINGFACTOR") string_2_option_result = _joycentringfactor; - else if (field == "WHICHJOY") string_2_option_result = _whichjoy; - else - - /* sound */ - - if (field == "QUIET") string_2_option_result = _quiet; - else if (field == "SOUNDCARD") string_2_option_result = _soundcard; - else if (field == "SAMPLERATE") string_2_option_result = _samplerate; - else if (field == "KEYBOARDCLICK") string_2_option_result = _keyboardclick; - else if (field == "BASEADDRESS") string_2_option_result = _baseaddress; - else if (field == "IRQ") string_2_option_result = _irq; - else if (field == "DMA") string_2_option_result = _dma; - else - - /* printer */ - - if (field == "PRINTER") string_2_option_result = _printer; - else - - - string_2_option_result = option_error; - - return string_2_option_result; -} - -void clear_to(byte colour) { - window(1, 1, 80, 24); - background = colour * 16; - textattr = background; - clrscr; -} - -void centre(byte where, byte colour, string what) { - textattr = background + colour; - gotoxy(40 - length(what) / 2, where); - output << what; -} - -void load_file() { - text t; - - mobylength = 0; - /*$I-*/ - assign(t, "avalot.ini"); - reset(t); - /*$I+*/ - - if (ioresult != 0) { /* No file. */ - output << "SETUP: Avalot.ini not found!" << NL; - exit(255); - } - - while (! eof(t)) { - mobylength += 1; /* Preincrement mode. */ - t >> (*moby)[mobylength] >> NL; - } - - close(t); - -} - -string strhf(longint x) { /* assume x is +ve */ - const array<0, 16, char> hexdigits = "0123456789ABCDEF"; - string y; - longint v; - - string strhf_result; - v = x; - y = ""; - - while (v != 0) { - y = string(hexdigits[v % longint(16) - 1]) + y; - v = v / longint(16); - } - - strhf_result = string('$') + y; - return strhf_result; -} - -void update_moby(); - -static byte fv; - -static string field; - - -static void get_field(string x) { - if (pos(";", x) != 0) x = copy(x, 1, pos(";", x) - 1); - - if (pos("=", x) == 0) - field = ""; - else { - field = copy(x, 0, pos("=", x) - 1); - while (field[1] == ' ') field = copy(field, 2, 255); - } -} - - - -static string yn1(boolean x) { - string yn1_result; - if (x) yn1_result = "Yes"; - else yn1_result = "No"; - return yn1_result; -} - - - -static string kj(boolean x) { - string kj_result; - if (x) kj_result = "Keyboard"; - else kj_result = "Joystick"; - return kj_result; -} - - - -static string put_logcodes() { - byte q; - - string put_logcodes_result; - q = (byte)(log_to_file) + (byte)(log_to_printer) * 2; - - switch (q) { - case 0: - put_logcodes_result = "No"; - break; - case 1: - put_logcodes_result = "Disk"; - break; - case 2: - put_logcodes_result = "Printer"; - break; - } - return put_logcodes_result; -} - - - -static string card() { - string card_result; - switch (your_card) { - case 0: - card_result = "None"; - break; - case 1: - card_result = "SB"; - break; - case 2: - card_result = "SBPro"; - break; - case 3: - card_result = "SB16"; - break; - case 4: - card_result = "Pas"; - break; - case 5: - card_result = "PasPlus"; - break; - case 6: - card_result = "Pas16"; - break; - case 7: - card_result = "Aria"; - break; - case 8: - card_result = "WinSound"; - break; - case 9: - card_result = "Gravis"; - break; - case 10: - card_result = "DacLPT"; - break; - case 11: - card_result = "StereoDacs"; - break; - case 12: - card_result = "StereoOn1"; - break; - case 13: - card_result = "Speaker"; - break; - } - return card_result; -} - - - - -static void entail(string x) { - string before, after; - - before = copy((*moby)[fv], 1, pos("=", (*moby)[fv]) - 1); - - if (pos(";", (*moby)[fv]) == 0) { - (*moby)[fv] = before + '=' + x; - } else { - after = copy((*moby)[fv], pos(";", (*moby)[fv]), 255); - - (*moby)[fv] = before + '=' + x + ' '; - while (length((*moby)[fv]) < 25)(*moby)[fv] = (*moby)[fv] + ' '; - - (*moby)[fv] = (*moby)[fv] + after; - } -} - -void update_moby() { - option o; - - - - - - for (fv = 1; fv <= mobylength; fv ++) { - get_field((*moby)[fv]); - - if (field != "") { - o = string_2_option(field); - - if (o == _overrideegacheck) entail(yn1(override_ega)); - else if (o == _zoomystart) entail(yn1(skip_loading_screens)); - else if (o == _loadfirst) entail(load_particular); - else if (o == _numlockhold) entail(yn1(force_numlock)); - else if (o == _usemouse) entail(yn1(ignore_mouse)); - else if (o == _controller) entail(kj(use_keyboard)); - else if (o == _logging) entail(put_logcodes()); - else if (o == _logfile) entail(log_filename); - else - - /* joystick */ - - if (o == _joystickinstalled) entail(yn1(has_a_joystick)); - else if (o == _joytop) entail(strf(jtop)); - else if (o == _joybottom) entail(strf(jbottom)); - else if (o == _joyleft) entail(strf(jleft)); - else if (o == _joyright) entail(strf(jright)); - else if (o == _joymidx) entail(strf(jmidx)); - else if (o == _joymidy) entail(strf(jmidy)); - else if (o == _joycentringfactor) entail(strf(jcentre)); - else if (o == _whichjoy) entail(strf(whichjoy)); - else - - /* sound */ - - if (o == _quiet) entail(yn1(suppress_sfx)); - else if (o == _soundcard) entail(card()); - else if (o == _samplerate) entail(strf(samplerate)); - else if (o == _baseaddress) entail(strhf(sound_addr)); - else if (o == _irq) entail(strf(sound_irq)); - else if (o == _dma) entail(strf(sound_dma)); - else if (o == _keyboardclick) entail(yn1(wants_keyclick)); - else - - /* printer */ - - if (o == _printer) entail(this_printer); - - } - } -} - -void save_file() { - text t; - word fv; - - textattr = 10; - update_moby(); - - clear_to(black); - centre(14, 14, "Saving..."); - - assign(t, "avalot.ini"); - rewrite(t); - - for (fv = 1; fv <= mobylength; fv ++) { - t << (*moby)[fv] << NL; - } - - close(t); -} - -boolean detect() { - word x, y, xo, yo; - byte count; - - boolean detect_result; - count = 0; - if (joystickpresent()) { - detect_result = true; - return detect_result; - } - readjoya(xo, yo); - do { - if (count < 7) count += 1; /* Take advantage of "flutter" */ - if (count == 6) { - centre(7, 1, "The Bios says you don't have a joystick. However, it's often wrong"); - centre(8, 1, "about such matters. So, do you? If you do, move joystick A to"); - centre(9, 1, "continue. If you don't, press any key to cancel."); - } - readjoya(x, y); - } while (!((keypressed()) | (x != xo) || (y != yo))); - detect_result = ~ keypressed(); - return detect_result; -} - -void display() { - gotoxy(28, 10); - output << jleft << " "; - gotoxy(28, 11); - output << jright; - gotoxy(28, 12); - output << jtop << " "; - gotoxy(28, 13); - output << jbottom; -} - -void readjoy(word &x, word &y) { - if (whichjoy == 1) readjoya(x, y); - else readjoyb(x, y); -} - -void getmaxmin() { - word x, y; - char r; - - clear_to(green); - centre(5, 1, "Rotate the joystick around in a circle, as far from the centre as it"); - centre(6, 1, "can get. Then press any key."); - centre(7, 1, "Press Esc to cancel this part."); - centre(16, 1, "(To reset these figures, set \"Do you have a joystick?\" to No, then Yes.)"); - - gotoxy(20, 10); - output << "Left :"; - gotoxy(20, 11); - output << "Right :"; - gotoxy(20, 12); - output << "Top :"; - gotoxy(20, 13); - output << "Bottom:"; - - - if (jleft == 0) jleft = maxint; - if (jtop == 0) jtop = maxint; - do { - readjoy(x, y); - if (x < jleft) jleft = x; - if (y < jtop) jtop = y; - if (x > jright) jright = x; - if (y > jbottom) jbottom = y; - display(); - } while (!keypressed()); - - do { - r = readkey(); - } while (!(~ keypressed())); - if (r == '\33') return; - - centre(19, 1, "Thank you. Now please centre your joystick and hit a button."); - do { - } while (!(buttona1() || buttona2())); - - readjoya(jmidx, jmidy); - - has_a_joystick = true; -} - -void joysetup() { - clear_to(green); - if (! detect()) return; - getmaxmin(); -} - -byte choose_one_of(byteset which); - -static shortint direction; - - -static void move(shortint d) { - direction = d; - line = line + d; -} - - - -static void highlight(word where, word how) { - byte fv; - - where = where * 160 - 159; - for (fv = 0; fv <= 79; fv ++) - mem[0xb800 * where + fv * 2] = (mem[0xb800 * where + fv * 2] & 0xf) + how; -} - -byte choose_one_of(byteset which) - -{ - const integer upwards = -1; - const integer downwards = 1; - - boolean done; - char r; - - - byte choose_one_of_result; - done = false; - direction = 1; - do { - while (!(which.has(line))) { - line = line + direction; - if (line > 26) line = 1; - if (line == 0) line = 26; - } - - highlight(line, selected); - r = readkey(); - highlight(line, background); - switch (r) { - case '\0': - switch (readkey()) { - case cup: - move(upwards); - break; - case cdown: - move(downwards); - break; - } - break; - case creturn: - done = true; - break; - case cescape: { - choose_one_of_result = 15; /* bottom line is always 15. */ - return choose_one_of_result; - } - break; - } - - } while (!done); - - choose_one_of_result = line; - return choose_one_of_result; -} - -void bottom_bar(); -static void load_regi_info(); - - -static char decode1(char c) { - byte b; - - char decode1_result; - b = ord(c) - 32; - decode1_result = chr(((b & 0xf) << 3) + ((cardinal)(b & 0x70) >> 4)); - return decode1_result; -} - - - -static char decode2(char c) { - char decode2_result; - decode2_result = chr(((ord(c) & 0xf) << 2) + 0x43); - return decode2_result; -} - - - -static boolean checker(string proper, string check) { - byte fv; - boolean ok; - - boolean checker_result; - ok = true; - for (fv = 1; fv <= length(proper); fv ++) - if ((ord(proper[fv]) & 0xf) != ((cardinal)(ord(check[fv]) - 0x43) >> 2)) - ok = false; - - checker_result = ok; - return checker_result; -} - - -static void load_regi_info() { - text t; - byte fv; - string x; - byte namelen, numlen; - string namechk, numchk; - - - /*$I-*/ - assign(t, "register.dat"); - reset(t); - /*$I+*/ - - if (ioresult != 0) { - registrant = ""; - return; - } - - for (fv = 1; fv <= 53; fv ++) t >> NL; - t >> x >> NL; - close(t); - - namelen = 107 - ord(x[1]); - numlen = 107 - ord(x[2]); - - registrant = copy(x, 3, namelen); - reginum = copy(x, 4 + namelen, numlen); - namechk = copy(x, 4 + namelen + numlen, namelen); - numchk = copy(x, 4 + namelen + numlen + namelen, numlen); - - for (fv = 1; fv <= namelen; fv ++) registrant[fv] = decode1(registrant[fv]); - for (fv = 1; fv <= numlen; fv ++) reginum[fv] = decode1(reginum[fv]); - - if ((! checker(registrant, namechk)) || (! checker(reginum, numchk))) { - registrant = "\?\"!?"; - reginum = "(."; - } -} - -void bottom_bar() { - load_regi_info(); - textattr = 96; - background = 96; - window(1, 1, 80, 25); - gotoxy(1, 25); - clreol; - if (registrant == "") - centre(25, 15, "Unregistered copy."); - else - centre(25, 15, string("Registered to ") + registrant + " (" + reginum + ")."); -} - -void new_menu() { - line = 1; /* now that we've got a new menu. */ -} - -string two_answers(string ans_true, string ans_false, boolean which) { - string two_answers_result; - if (which) - two_answers_result = string(" (") + ans_true + ')'; - else - two_answers_result = string(" (") + ans_false + ')'; - return two_answers_result; -} - -string yes_or_no(boolean which) { - string yes_or_no_result; - yes_or_no_result = two_answers("yes", "no", which); - return yes_or_no_result; -} - -string give_name(string what) { - string give_name_result; - if (what == "") - give_name_result = " (none)"; - else - give_name_result = string(" (\"") + what + "\")"; - return give_name_result; -} - -string sound_card(byte which) { - string sound_card_result; - switch (which) { - case 0: - sound_card_result = "none"; - break; - case 1: - sound_card_result = "SoundBlaster"; - break; - case 2: - sound_card_result = "SoundBlaster Pro"; - break; - case 3: - sound_card_result = "SoundBlaster 16"; - break; - case 4: - sound_card_result = "Pro Audio Spectrum"; - break; - case 5: - sound_card_result = "Pro Audio Spectrum+"; - break; - case 6: - sound_card_result = "Pro Audio Spectrum 16"; - break; - case 7: - sound_card_result = "Aria"; - break; - case 8: - sound_card_result = "Windows Sound System or compatible"; - break; - case 9: - sound_card_result = "Gravis Ultrasound"; - break; - case 10: - sound_card_result = "DAC on LPT1"; - break; - case 11: - sound_card_result = "Stereo DACs on LPT1 and LPT2"; - break; - case 12: - sound_card_result = "Stereo-on-1 DAC on LPT"; - break; - case 13: - sound_card_result = "PC speaker"; - break; - } - return sound_card_result; -} - -void get_str(string &n) { - string x; - char r; - - clear_to(black); - centre(3, 3, "Enter the new value. Press Enter to accept, or Esc to cancel."); - x = ""; - - do { - - r = readkey(); - - switch (r) { - case cbackspace: - if (x[0] > '\0') x[0] -= 1; - break; - case creturn: { - n = x; - return; - } - break; - case cescape: - return; - break; - - default: - if (x[0] < '\106') x = x + r; - } - - - centre(7, 2, string(' ') + x + ' '); - - } while (!false); - -} - -void get_num(longint &n) { - string x; - char r; - integer e; - - clear_to(black); - centre(3, 3, "Enter the new value. Press Enter to accept, or Esc to cancel."); - centre(4, 3, "Precede with $ for a hex value."); - x = ""; - - do { - - r = upcase(readkey()); - - switch (r) { - case cbackspace: - if (x[0] > '\0') x[0] -= 1; - break; - case creturn: { - val(x, n, e); - return; - } - break; - case cescape: - return; - break; - - default: - if ((x[0] < '\106') && - ((set::of(range('0', '9'), eos).has(r)) || ((x[1] == '$') && (set::of(range('A', 'F'), eos).has(r))) || - ((x == "") && (r == '$')))) - x = x + r; - } - - - centre(7, 2, string(' ') + x + ' '); - - } while (!false); - -} - -void general_menu() { - new_menu(); - do { - clear_to(blue); - - centre(3, 15, "General Menu"); - - centre(5, 7, string("Override EGA check?") + yes_or_no(override_ega)); - centre(6, 7, string("Skip loading screens?") + yes_or_no(skip_loading_screens)); - centre(7, 7, string("Load a particular file by default?") + give_name(load_particular)); - centre(8, 7, string("Force NumLock off?") + yes_or_no(force_numlock)); - /* centre( 9, 7,'Ignore the mouse?'+yes_or_no(ignore_mouse));*/ - centre(10, 7, string("Default controller?") + two_answers("keyboard", "joystick", use_keyboard)); - centre(12, 7, string("Log to printer?") + yes_or_no(log_to_printer)); - centre(13, 7, string("Log to file?") + yes_or_no(log_to_file)); - centre(14, 7, string("Filename to log to?") + give_name(log_filename)); - - centre(15, 15, "Return to main menu."); - - switch (choose_one_of(set::of(5, 6, 7, 8,/*9,*/10, 12, 13, 14, 15, eos))) { - case 5: - override_ega = ! override_ega; - break; - case 6: - skip_loading_screens = ! skip_loading_screens; - break; - case 7: - get_str(load_particular); - break; - case 8: - force_numlock = ! force_numlock; - break; - /* 9: ignore_mouse:=not ignore_mouse;*/ - case 10: - use_keyboard = ! use_keyboard; - break; - case 12: { - log_to_printer = ! log_to_printer; - if (log_to_file && log_to_printer) log_to_file = false; - } - break; - case 13: { - log_to_file = ! log_to_file; - if (log_to_file && log_to_printer) log_to_printer = false; - } - break; - case 14: - get_str(log_filename); - break; - case 15: { - new_menu(); - return; - } - break; - } - - } while (!false); -} - -void joystick_menu() { - new_menu(); - do { - clear_to(green); - - centre(3, 15, "Joystick Menu"); - - centre(5, 14, string("Do you have a joystick?") + yes_or_no(has_a_joystick)); - centre(6, 14, string("Which joystick to use? ") + chr(whichjoy + 48)); - centre(7, 14, "Select this one to set it up."); - - centre(15, 15, "Return to main menu"); - - switch (choose_one_of(set::of(5, 6, 7, 15, eos))) { - case 5: { - has_a_joystick = ! has_a_joystick; - if (! has_a_joystick) { - jleft = 0; - jright = 0; - jtop = 0; - jbottom = 0; - } - } - break; - case 6: - whichjoy = 3 - whichjoy; - break; /* Flips between 2 and 1. */ - case 7: - joysetup(); - break; - case 15: { - new_menu(); - return; - } - break; - } - - } while (!false); -} - -void cycle(byte &what, byte upper_limit) { - if (what == upper_limit) - what = 0; - else - what += 1; -} - -void sound_menu() { - new_menu(); - do { - clear_to(cyan); - - centre(3, 0, "Sound menu"); - - centre(5, 0, string("Do you want to suppress sound effects?") + yes_or_no(suppress_sfx)); - centre(6, 0, string("Sound output device\? (") + sound_card(your_card) + ')'); - centre(7, 0, string("Sampling rate\? (") + strf(samplerate) + "Hz)"); - centre(8, 0, string("Base address\? (") + strhf(sound_addr) + " *hex*)"); - centre(9, 0, string("IRQ\? (") + strf(sound_irq) + ')'); - centre(10, 0, string("DMA\? (") + strf(sound_dma) + ')'); - centre(11, 0, string("Do you want keyclick?") + yes_or_no(wants_keyclick)); - - centre(15, 15, "Return to main menu"); - - centre(17, 1, "WARNING: Incorrect values of IRQ and DMA may damage your computer!"); - centre(18, 1, "Read AVALOT.INI for the correct values."); - - switch (choose_one_of(set::of(5, 6, 7, 8, 9, 10, 11, 15, eos))) { - case 5: - suppress_sfx = ! suppress_sfx; - break; - case 6: - cycle(your_card, 13); - break; - case 7: - get_num(samplerate); - break; - case 8: - get_num(sound_addr); - break; - case 9: - get_num(sound_irq); - break; - case 10: - get_num(sound_dma); - break; - case 11: - wants_keyclick = ! wants_keyclick; - break; - case 15: { - new_menu(); - return; - } - break; - } - - } while (!false); -} - -void printer_menu() { - byte fv; - byteset chooseable_lines; - - new_menu(); - - chooseable_lines = set::of(15, eos); - for (fv = 1; fv <= num_printers; fv ++) - chooseable_lines = chooseable_lines + set::of(fv + 8, eos); - - do { - clear_to(red); - - centre(3, 15, "Printer menu"); - - centre(5, 15, "Select one of the following printers:"); - centre(6, 15, string("The current choice is ") + this_printer + '.'); - - for (fv = 1; fv <= num_printers; fv ++) - centre(8 + fv, 14, printers[fv]); - - centre(15, 15, "Return to main menu"); - - fv = choose_one_of(chooseable_lines); - - if (fv == 15) { - new_menu(); - return; - } - - this_printer = printers[fv - 8]; - - } while (!false); -} - -void regi_split(string x) { - byte fv; - - regname[0] = chr(107 - ord(x[1])); - chkname[0] = regname[0]; - regnum[0] = chr(107 - ord(x[2])); - chknum[0] = chknum[0]; - - move(x[3], regname[1], ord(regname[0])); - for (fv = 1; fv <= length(regname); fv ++) - regname[fv] = chr(abs(((ord(regname[fv]) - 33) - 177 * fv) % 94) + 33); -} - - -void registration_menu() { - char r; - text t, o; - string x; - byte fv; - - clear_to(black); - - centre(3, 15, "REGISTRATION"); - centre(5, 14, "Please insert the disk you were sent when you registered"); - centre(6, 14, "into any drive, and press its letter. For example, if the"); - centre(7, 14, "disk is in drive A:, press A."); - centre(9, 14, "Press Esc to cancel this menu."); - - do { - r = upcase(readkey()); - } while (!(set::of('\33', range('A', 'Z'), eos).has(r))); - if (r == '\33') return; - - /*$I-*/ - assign(t, string(r) + ":\\REGISTER.DAT"); - reset(t); - /*$I+*/ - if (ioresult != 0) { - centre(17, 15, "But it isn't in that drive..."); - centre(19, 15, "Press any key."); - r = readkey(); - return; - } - for (fv = 1; fv <= 54; fv ++) t >> x >> NL; - regi_split(x); - - /* Copy the file... */ - - assign(o, "register.dat"); - rewrite(o); - reset(t); - - while (! eof(t)) { - t >> x >> NL; - o << x << NL; - } - close(t); - close(o); - - centre(17, 15, "Done! Press any key..."); - bottom_bar(); - r = readkey(); - -} - -void menu() { - bottom_bar(); - new_menu(); - do { - clear_to(black); - - centre(3, 15, "Avalot Setup - Main Menu"); - - centre(5, 9, "General setup"); - centre(6, 10, "Joystick setup"); - centre(7, 11, "Sound setup"); - centre(8, 12, "Printer setup"); - centre(9, 14, "REGISTRATION setup"); - - centre(15, 15, "--- EXIT SETUP ---"); - - switch (choose_one_of(set::of(5, 6, 7, 8, 9, 15, eos))) { - case 5: - general_menu(); - break; - case 6: - joystick_menu(); - break; - case 7: - sound_menu(); - break; - case 8: - printer_menu(); - break; - case 9: - registration_menu(); - break; - case 15: { - new_menu(); - clear_to(lightgray); - centre(3, 0, "Quit: would you like to save changes?"); - centre(5, 1, "Quit and SAVE changes."); - centre(6, 1, "Quit and DON'T save changes."); - centre(15, 0, "Cancel and return to the main menu."); - switch (choose_one_of(set::of(5, 6, 15, eos))) { - case 5: { - save_file(); - return; - } - break; - case 6: - return; - break; - } - new_menu(); - } - break; - } - - } while (!false); -} - -void defaults() { /* Sets everything to its default value. */ - /* general */ - - override_ega = false; - skip_loading_screens = false; - load_particular = ""; - force_numlock = true; - ignore_mouse = false; - use_keyboard = true; - log_to_printer = false; - log_to_file = false; - log_filename = "avalot.log"; - - /* joystick */ - - has_a_joystick = false; - /* jtop,jbottom,jleft,jright,jmidx,jmidy need no initialisation. */ - - /* sound */ - - suppress_sfx = false; - your_card = 0; /* none */ - wants_keyclick = false; - - /* other stuff */ - - registrant = ""; - - num_printers = 0; - this_printer = "??"; -} - -void parse_file(); - -const integer parse_weird_field = 1; - -const integer parse_not_yes_or_no = 2; - -const integer parse_not_numeric = 3; - -const integer parse_not_kbd_or_joy = 4; - -const integer parse_weird_logcode = 5; - -const integer parse_weird_card = 6; - - -static varying_string<80> this_, thiswas; - -static boolean error_found, ignoring; - - -static void error(byte what) { - textattr = 15; - if (! error_found) { - clrscr; - textattr = 12; - output << "SETUP: *** ERROR FOUND IN AVALOT.INI! ***" << NL; - textattr = 15; - } - output << ' '; - switch (what) { - case parse_weird_field: - output << "Unknown identifier on the left"; - break; - case parse_not_yes_or_no: - output << "Value on the right should be Yes or No"; - break; - case parse_not_numeric: - output << "Value on the right is not numeric"; - break; - case parse_not_kbd_or_joy: - output << "Value on the right should be Keyboard or Joystick"; - break; - case parse_weird_logcode: - output << "Value on the right should be No, Printer or Disk"; - break; - case parse_weird_card: - output << "Never heard of the card"; - break; - } - output << " in:" << NL; - textattr = 10; - output << thiswas << NL; - error_found = true; -} - - - -static boolean yesno(string x) { - boolean yesno_result; - if (x == "YES") - yesno_result = true; - else if (x == "NO") - yesno_result = false; - else { - error(parse_not_yes_or_no); - yesno_result = false; - } - return yesno_result; -} - - - -static boolean kbdjoy(string x) { - boolean kbdjoy_result; - if (x == "KEYBOARD") - kbdjoy_result = true; - else if (x == "JOYSTICK") - kbdjoy_result = false; - else { - error(parse_not_kbd_or_joy); - kbdjoy_result = false; - } - return kbdjoy_result; -} - - - -static word numeric(string x) { - const varying_string<15> hexdigits = "0123456789ABCDEF"; - word answer; - integer e; - - word numeric_result; - if (x[1] == '$') { - answer = 0; - for (e = 2; e <= length(x); e ++) { - answer = answer << 4; - answer += pos(upcase(x[e]), hexdigits) - 1; - } - } else { - val(x, answer, e); - if (e != 0) error(parse_not_numeric); - } - numeric_result = answer; - return numeric_result; -} - - - -static void get_logcodes(string x) { - if (x == "NO") { - log_to_file = false; - log_to_printer = false; - } else if (x == "DISK") { - log_to_file = true; - log_to_printer = false; - } else if (x == "PRINTER") { - log_to_file = false; - log_to_printer = true; - } else - error(parse_weird_logcode); -} - - - -static void get_card(string x) { - if (x == "NONE") your_card = 0; - else if (x == "SB") your_card = 1; - else if (x == "SBPRO") your_card = 2; - else if (x == "SB16") your_card = 3; - else if (x == "PAS") your_card = 4; - else if (x == "PASPLUS") your_card = 5; - else if (x == "PAS16") your_card = 6; - else if (x == "ARIA") your_card = 7; - else if (x == "WINSOUND") your_card = 8; - else if (x == "GRAVIS") your_card = 9; - else if (x == "DACLPT") your_card = 10; - else if (x == "STEREODACS") your_card = 11; - else if (x == "STEREOON1") your_card = 12; - else if (x == "SPEAKER") your_card = 13; - else - error(parse_weird_card); -} - -void parse_file() { - - - word where; - byte position; - varying_string<80> field, data, pure_data; - option o; - - - error_found = false; - ignoring = false; - - for (where = 1; where <= mobylength; where ++) { - this_ = (*moby)[where]; - thiswas = this_; - - position = pos(";", this_); - if (position > 0) this_ = copy(this_, 1, position - 1); - - if (this_ == "") continue_; /* Don't carry on if by now it's empty. */ - - if (this_[1] == '[') { - ignoring = !(trim_and_caps(this_) == "[END]"); - - if (copy(this_, 1, 8) == "[printer") { - num_printers += 1; - printers[num_printers] = copy(this_, 10, length(this_) - 10); - } - } - - if (ignoring) continue_; - - position = pos("=", this_); - field = trim_and_caps(copy(this_, 1, position - 1)); - if (field == "") continue_; - pure_data = copy(this_, position + 1, 255); - data = trim_and_caps(pure_data); - o = string_2_option(field); - - /* general */ - - if (o == _overrideegacheck) override_ega = yesno(data); - else if (o == _zoomystart) skip_loading_screens = yesno(data); - else if (o == _loadfirst) load_particular = data; - else if (o == _numlockhold) force_numlock = yesno(data); - else if (o == _usemouse) ignore_mouse = yesno(data); - else if (o == _controller) use_keyboard = kbdjoy(data); - else if (o == _logging) get_logcodes(data); - else if (o == _logfile) log_filename = data; - else - - /* joystick */ - - if (o == _joystickinstalled) has_a_joystick = yesno(data); - else if (o == _joytop) jtop = numeric(data); - else if (o == _joybottom) jbottom = numeric(data); - else if (o == _joyleft) jleft = numeric(data); - else if (o == _joyright) jright = numeric(data); - else if (o == _joymidx) jmidx = numeric(data); - else if (o == _joymidy) jmidy = numeric(data); - else if (o == _joycentringfactor) jcentre = numeric(data); - else if (o == _whichjoy) whichjoy = numeric(data); - else - - /* sound */ - - if (o == _quiet) suppress_sfx = yesno(data); - else if (o == _soundcard) get_card(data); - else if (o == _samplerate) samplerate = numeric(data); - else if (o == _baseaddress) sound_addr = numeric(data); - else if (o == _irq) sound_irq = numeric(data); - else if (o == _dma) sound_dma = numeric(data); - else if (o == _keyboardclick) wants_keyclick = yesno(data); - else - - /* printer */ - - if (o == _printer) this_printer = pure_data; - else - - /* others */ - - error(parse_weird_field); - } - - if (error_found) { - textattr = 15; - output << " Try and fix the above errors. As a last resort, try deleting or" << NL; - output << " renaming AVALOT.INI, and the default values will be used. Good luck." << NL; - exit(177); - } -} - -void clear_up() { - window(1, 1, 80, 25); - textattr = 31; - clrscr; - output << NL; - output << "Enjoy the game..." << NL; - output << NL; - cga_cursor_on; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - cursor_off; - - moby = new mobytype; /* Allocate memory space */ - - defaults(); - - load_file(); - - parse_file(); - - menu(); - - delete moby; /* Deallocate memory space again */ - - clear_up(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu.cpp b/engines/avalanche/seu.cpp deleted file mode 100644 index 4374de9c13bc..000000000000 --- a/engines/avalanche/seu.cpp +++ /dev/null @@ -1,985 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ -/*#include "Tommys.h"*/ - -namespace Avalanche { - -const integer msize = 100; -const integer flag = -20047; -const integer perm = -1; - -const integer avvy_shoot = 87; -const integer facing_right = 88; -const integer facing_left = 94; - -const integer avvy_y = 150; - -const integer left_margin = 10; -const integer right_margin = 605; - -const array<0, 6, byte> shooting = {{87, 80, 81, 82, 81, 80, 87}}; - -const integer stocks = 28; - -const integer framedelaymax = 2; - -const integer maxrunners = 4; - -const integer times_a_second = /*31*/18; - -const integer flash_time = 20; /* If flash_time is <= this, the word "time" will flash. */ -/* Should be about 20. */ - -/* --- Scores for various things --- */ - -const integer score_for_hitting_face = 3; -const integer bonus_for_hitting_escaper = 5; - -struct mtype { - shortint ix, iy; - integer x, y; - byte p; - integer timeout; - boolean cameo; - byte cameo_frame; - boolean missile; - boolean wipe; -}; - -struct xtype { - word s; - pointer p; -}; - -class rectype { -public: - integer x1, y1, x2, y2; -}; - -class plottype : public rectype { -public: - byte which; -}; - -class plotmasktype : public plottype { -public: - byte whichmask; -}; - -array<1, 100, xtype> x; -array<1, 100, mtype> m; -matrix<0, 1, 1, 100, rectype> r; -array<0, 1, byte> rsize; -byte cp; -word score; -byte time1; - -byte shiftstate; /*ABSOLUTE $40:$17; */ - -word avvypos; -word avvywas; -byte avvyanim; -byte avvyfacing; - -byte was_facing; - -boolean alt_was_pressed_before; - -byte throw_next; - -boolean firing; - -array<0, 6, byte> stockstatus; - -array < 1, maxrunners, struct A1 { - integer x, y; - byte frame; - byte toohigh, lowest; - shortint ix, iy; - byte framedelay; -} > running; - -varying_string<5> score_is; -varying_string<3> time_is; - -byte time_this_second; - -word escape_count; -byte escape_stock; -boolean escaping, got_out; - -array<0, 6, boolean> has_escaped; - -byte count321; - -word storage_seg, storage_ofs; - -byte how_many_have_escaped; - -void flippage() { - setactivepage(cp); - cp = 1 - cp; - setvisualpage(cp); -} - -void flesh_colours() { - ; /*assembler; -asm - mov ax,$1012; - mov bx,21; { 21 = light pink (why?) */ - /*mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; - - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. */ - /*int $10; - - jmp @TheEnd; - - @flesh: - db 56,35,35; - - @darkflesh: - db 43,22,22; - - @TheEnd: */ -} - -boolean overlap(word a1x, word a1y, word a2x, word a2y, word b1x, word b1y, word b2x, word b2y) { - /* By De Morgan's law: */ - boolean overlap_result; - overlap_result = (a2x >= b1x) && (b2x >= a1x) && (a2y >= b1y) && (b2y >= a1y); - return overlap_result; -} - -void getsize(byte w, integer &xx, integer &yy) { - array<0, 1, integer> n; - - move(x[w].p, n, 4); - xx = n[0]; - yy = n[1]; -} - -void display(integer xx, integer yy, byte w) { - putimage(xx, yy, x[w].p, 0); -} - -byte get_stock_number(byte x) { - byte get_stock_number_result; - while (has_escaped[x]) { - x += 1; - if (x == 7) x = 0; - } - get_stock_number_result = x; - return get_stock_number_result; -} - -void cameo_display(integer xx, integer yy, byte w1, byte w2) { - putimage(xx, yy, x[w2].p, andput); - putimage(xx, yy, x[w1].p, xorput); -} - -void blankit() { - byte fv; - - for (fv = 1; fv <= rsize[cp]; fv ++) { - rectype &with = r[cp][fv]; - bar(with.x1, with.y1, with.x2, with.y2); - } - rsize[cp] = 0; -} - -void blank(integer xx1, integer yy1, integer xx2, integer yy2) { - rsize[cp] += 1; - { - rectype &with = r[cp][rsize[cp]]; - - with.x1 = xx1; - with.y1 = yy1; - with.x2 = xx2; - with.y2 = yy2; - } -} - -void movethem() { - byte fv; - - for (fv = 1; fv <= msize; fv ++) { - mtype &with = m[fv]; - if (with.x != flag) { - with.x = with.x + with.ix; - with.y = with.y + with.iy; - } - } -} - -void plotthem() { - byte fv; - integer xx, yy; - - for (fv = 1; fv <= msize; fv ++) { - mtype &with = m[fv]; - if (with.x != flag) { - if (with.cameo) { - cameo_display(with.x, with.y, with.p, with.cameo_frame); - if (cp == 0) { - with.cameo_frame += 2; - with.p += 2; - } - } else display(with.x, with.y, with.p); - getsize(with.p, xx, yy); - if (with.wipe) blank(with.x, with.y, with.x + xx, with.y + yy); - if (with.timeout > 0) { - with.timeout -= 1; - if (with.timeout == 0) with.x = flag; - } - } - } -} - -void define(integer xx, integer yy, byte pp, shortint ixx, shortint iyy, integer timetime, - boolean is_a_missile, boolean do_we_wipe) { - byte which; - - for (which = 1; which <= msize; which ++) { - mtype &with = m[which]; - - if (with.x == flag) { - with.x = xx; - with.y = yy; - with.p = pp; - with.ix = ixx; - with.iy = iyy; - with.timeout = timetime; - with.cameo = false; - with.missile = is_a_missile; - with.wipe = do_we_wipe; - - return; - } - } -} - -void define_cameo(integer xx, integer yy, byte pp, integer timetime) { - byte which; - - for (which = 1; which <= msize; which ++) { - mtype &with = m[which]; - - if (with.x == flag) { - with.x = xx; - with.y = yy; - with.p = pp; - with.ix = 0; - with.iy = 0; - with.timeout = timetime; - with.cameo = true; - with.cameo_frame = pp + 1; - with.missile = false; - with.wipe = false; - - return; - } - } -} - -void get_score() { - byte fv; - - str(score, 5, score_is); - for (fv = 1; fv <= 5; fv ++) - if (score_is[fv] == ' ') - score_is[fv] = '0'; -} - -void get_time1() { - byte fv; - - str(time1, 5, time_is); - for (fv = 1; fv <= 3; fv ++) - if (time_is[fv] == ' ') - time_is[fv] = '0'; -} - -void display_const(integer x, integer y, byte what) { - byte page_; - - for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - display(x, y, what); - } - setactivepage(1 - cp); -} - -void show_stock(byte x) { - if (escaping && (x == escape_stock)) { - display_const(x * 90 + 20, 30, stocks + 2); - return; - } - if (stockstatus[x] > 5) return; - display_const(x * 90 + 20, 30, stocks + stockstatus[x]); - stockstatus[x] = 1 - stockstatus[x]; -} - -void show_score() { - byte fv; - varying_string<5> score_was; - - score_was = score_is; - get_score(); - for (fv = 1; fv <= 5; fv ++) - if (score_was[fv] != score_is[fv]) - display_const(30 + fv * 10, 0, ord(score_is[fv]) - 47); -} - -void show_time() { - byte fv; - varying_string<3> time_was; - - time_was = time_is; - get_time1(); - for (fv = 1; fv <= 3; fv ++) - if (time_was[fv] != time_is[fv]) - display_const(130 + fv * 10, 0, ord(time_is[fv]) - 47); -} - -void gain(shortint howmuch) { - if (-howmuch > score) score = 0; - else - score = score + howmuch; - show_score(); -} - -void new_escape() { - escape_count = Random(18) * 20; - escaping = false; -} - -void instructions(); - -static void nextpage() { - char c; - - outtextxy(400, 190, "Press a key for next page >"); - c = readkey(); - cleardevice(); -} - -void instructions() { - display(25, 25, facing_right); - outtextxy(60, 35, "< Avvy, our hero, needs your help - you must move him around."); - outtextxy(80, 45, "(He's too terrified to move himself!)"); - - outtextxy(0, 75, "Your task is to prevent the people in the stocks from escaping"); - outtextxy(0, 85, "by pelting them with rotten fruit, eggs and bread. The keys are:"); - outtextxy(80, 115, "LEFT SHIFT"); - outtextxy(200, 115, "Move left."); - outtextxy(72, 135, "RIGHT SHIFT"); - outtextxy(200, 135, "Move right."); - outtextxy(136, 155, "ALT"); - outtextxy(200, 155, "Throw something."); - nextpage(); - - display(25, 35, stocks); - outtextxy(80, 35, "This man is in the stocks. Your job is to stop him getting out."); - outtextxy(88, 45, "UNFORTUNATELY... the locks on the stocks are loose, and every"); - outtextxy(88, 55, "so often, someone will discover this and try to get out."); - display(25, 85, stocks + 2); - outtextxy(80, 85, "< Someone who has found a way out!"); - outtextxy(88, 95, "You MUST IMMEDIATELY hit people smiling like this, or they"); - outtextxy(88, 105, "will disappear and lose you points."); - display(25, 125, stocks + 5); - display(25, 155, stocks + 4); - outtextxy(80, 125, "< Oh dear!"); - nextpage(); - - outtextxy(0, 35, "Your task is made harder by:"); - display(25, 55, 48); - outtextxy(60, 55, "< Yokels. These people will run in front of you. If you hit"); - outtextxy(68, 65, "them, you will lose MORE points than you get hitting people"); - outtextxy(68, 75, "in the stocks. So BEWARE!"); - outtextxy(80, 125, "Good luck with the game!"); - nextpage(); -} - -void setup() { - integer gd, gm; - untyped_file f; - char rkv; - - rkv = upcase(readkey()); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - flesh_colours(); - - assign(f, "notts.avd"); - reset(f, 1); - gd = 1; - score = 0; - time1 = 120; - score_is = "(c)94"; - time_this_second = 0; - - while (! eof(f)) { - xtype &with = x[gd]; - - blockread(f, with.s, 2); - getmem(with.p, with.s); - blockread(f, with.p, with.s); - gd += 1; - } - close(f); - - if ((rkv == 'I') || ((rkv == '\0') && (readkey() == cf1))) instructions(); - - for (gd = 0; gd <= 6; gd ++) { - stockstatus[gd] = Random(2); - show_stock(gd); - } - - fillchar(m, sizeof(m), '\261'); - setfillstyle(1, 0); - cp = 0; - flippage(); - fillchar(rsize, sizeof(rsize), '\0'); - avvywas = 320; - avvypos = 320; - avvyanim = 1; - avvyfacing = facing_left; - - alt_was_pressed_before = false; - throw_next = 74; - firing = false; - - for (gd = 1; gd <= maxrunners; gd ++) { - A1 &with = running[gd]; - - with.x = flag; - } - - new_escape(); - fillchar(has_escaped, sizeof(has_escaped), '\0'); /* All false. */ - count321 = 255; /* Counting down. */ - - /* Set up status line. */ - - display_const(0, 0, 17); /* Score: */ - show_score(); /* value of score (00000 here) */ - display_const(110, 0, 20); /* Time: */ - show_time(); /* value of time */ - - Randomize(); - - how_many_have_escaped = 0; -} - -void init_runner(integer xx, integer yy, byte f1, byte f2, shortint ixx, shortint iyy) { - byte fv; - - for (fv = 1; fv <= maxrunners; fv ++) { - A1 &with = running[fv]; - if (with.x == flag) { - with.x = xx; - with.y = yy; - with.frame = f1; - with.toohigh = f2; - with.lowest = f1; - with.ix = ixx; - with.iy = iyy; - if ((with.ix == 0) && (with.iy == 0)) with.ix = 2; /* To stop them running on the spot! */ - with.framedelay = framedelaymax; - return; - } - } -} - -void titles() { - registers r; - byte a; /*absolute $A000:0; */ - untyped_file f; - byte bit; - - r.ax = 0xd; - intr(0x10, r); - - assign(f, "shoot1.avd"); - reset(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 8000); - } - close(f); -} -/* -procedure animate3; -begin - define(100,100,10,1,0,perm,false,true); - define( 50,20 ,30,3,3,30,false,true); - repeat; - blankit; - plotthem; - movethem; - flippage; - delay(100); - until keypressed; -end; - -procedure animate2; -var - x,n:byte; - helpx:integer; - helpdir:shortint; - helpani:byte; -begin - x:=0; n:=0; helpani:=0; - helpx:=10; helpdir:=1; - setfillstyle(1,0); - - repeat - display(x*52,0,n+28); - inc(x); inc(n); - - if x=13 then - begin - bar(helpx-2,50,helpx+5,80); - if helpdir>0 then - display(helpx,50,80-helpani) - else - display(helpx,50,86-helpani); - helpx:=helpx+helpdir*5; - if (helpx>600) or (helpx<3) then helpdir:=-helpdir; - if helpani=0 then helpani:=5 else dec(helpani); - - x:=0; -(* delay(100);*) - end; - if n=6 then n:=0; - until keypressed; -end; -*/ - -void move_avvy() { - if (avvywas < avvypos) { - /* bar(avvyWas,avvy_Y,avvyPos,Avvy_Y+85);*/ - avvyfacing = facing_right; - } else if (avvywas > avvypos) { - /* bar(avvyWas+32,Avvy_Y,avvyPos+33,Avvy_Y+85);*/ - avvyfacing = facing_left; - } - - if (! firing) { - if (avvywas == avvypos) - avvyanim = 1; - else { - avvyanim += 1; - if (avvyanim == 6) avvyanim = 0; - } - } - - if (avvyfacing == avvy_shoot) - define(avvypos, avvy_y, shooting[avvyanim], 0, 0, 1, false, true); - else - define(avvypos, avvy_y, avvyanim + avvyfacing, 0, 0, 1, false, true); - - avvywas = avvypos; - - if (avvyfacing == avvy_shoot) { - if (avvyanim == 6) { - avvyfacing = was_facing; - avvyanim = 0; - firing = false; - } else avvyanim += 1; - } -} - -void read_kbd() { - - if (firing) return; - - if ((shiftstate & 8) > 0) { - /* Alt - shoot */ - if ((alt_was_pressed_before) || (count321 != 0)) return; - alt_was_pressed_before = true; - firing = true; - define(avvypos + 27, avvy_y + 5, throw_next, 0, -2, 53, true, true); - throw_next += 1; - if (throw_next == 80) throw_next = 74; - avvyanim = 0; - was_facing = avvyfacing; - avvyfacing = avvy_shoot; - return; - } - - alt_was_pressed_before = false; - - if ((shiftstate & 1) > 0) { - /* Move right. */ - avvypos += 5; - if (avvypos > right_margin) avvypos = right_margin; - return; - } - - if ((shiftstate & 2) > 0) { - /* Move left. */ - avvypos -= 5; - if (avvypos < left_margin) avvypos = left_margin; - } - -} - -void animate() { - byte fv; - - if (Random(10) == 1) show_stock(get_stock_number(Random(6))); - for (fv = 0; fv <= 6; fv ++) - if (stockstatus[fv] > 5) { - stockstatus[fv] -= 1; - if (stockstatus[fv] == 8) { - stockstatus[fv] = 0; - show_stock(fv); - } - } -} - -void collision_check() { - byte fv; - integer dist_from_side; - byte this_stock; - - for (fv = 1; fv <= 100; fv ++) { - mtype &with = m[fv]; - if (with.x != flag) { - if ((with.missile) && (with.y < 60) && (with.timeout == 1)) { - /* sound(177); delay(1); nosound;*/ - dist_from_side = (with.x - 20) % 90; - this_stock = ((with.x - 20) / 90); - if ((! has_escaped[this_stock]) && - (dist_from_side > 17) && (dist_from_side < 34)) { - sound(999); - delay(3); - nosound; - define(with.x + 20, with.y, 26 + Random(2), 3, 1, 12, false, true); /* Well done! */ - define(this_stock * 90 + 20, 30, 31, 0, 0, 7, false, false); /* Face of man */ - define_cameo(this_stock * 90 + 20 + 10, 35, 40, 7); /* Splat! */ - define(this_stock * 90 + 20 + 20, 50, 34 + Random(5), 0, 2, 9, false, true); /* Oof! */ - stockstatus[this_stock] = 17; - gain(score_for_hitting_face); - - if ((escaping) && (escape_stock == this_stock)) { - /* Hit the escaper. */ - sound(1777); - delay(1); - nosound; - gain(bonus_for_hitting_escaper); - escaping = false; - new_escape(); - } - } else { - define(with.x, with.y, 83 + Random(3), 2, 2, 17, false, true); /* Missed! */ - if ((! has_escaped[this_stock]) && - ((dist_from_side > 3) && (dist_from_side < 43))) { - define(this_stock * 90 + 20, 30, 30, 0, 0, 7, false, false); /* Face of man */ - if (dist_from_side > 35) - define_cameo(with.x - 27, 35, 40, 7); /* Splat! */ - else - define_cameo(with.x - 7, 35, 40, 7); - stockstatus[this_stock] = 17; - } - } - } - } - } -} - -shortint sgn(integer a) { - shortint sgn_result; - if (a == 0) { - sgn_result = 0; - return sgn_result; - } - if (a > 0) { - sgn_result = 1; - return sgn_result; - } - sgn_result = -1; - return sgn_result; -} - -void turn_around(byte who, boolean randomx) { - { - A1 &with = running[who]; - - if (randomx) { - if (with.ix > 0) with.ix = -(Random(5) + 1); - else with.ix = (Random(5) + 1); - } else - with.ix = -with.ix; - with.iy = -with.iy; - } -} - -void bump_folk() { - byte fv, ff; - - for (fv = 1; fv <= maxrunners; fv ++) - if (running[fv].x != flag) - for (ff = fv + 1; ff <= maxrunners; ff ++) - if ((running[ff].x != flag) && - overlap(running[fv].x, running[fv].y, - running[fv].x + 17, running[fv].y + 24, - running[ff].x, running[ff].y, - running[ff].x + 17, running[ff].y + 24)) { - turn_around(fv, false); /* Opp. directions. */ - turn_around(ff, false); - } -} - -void people_running() { - byte fv; - - if (count321 != 0) return; - for (fv = 1; fv <= maxrunners; fv ++) { - A1 &with = running[fv]; - if (with.x != flag) { - if (((with.y + with.iy) <= 53) || ((with.y + with.iy) >= 120)) { - with.iy = -with.iy; - } - - if (with.ix < 0) - define(with.x, with.y, with.frame, 0, 0, 1, false, true); - else - define(with.x, with.y, with.frame + 7, 0, 0, 1, false, true); - if (with.framedelay == 0) { - with.frame += 1; - if (with.frame == with.toohigh) with.frame = with.lowest; - with.framedelay = framedelaymax; - with.y = with.y + with.iy; - } else with.framedelay -= 1; - - if (((with.x + with.ix) <= 0) || ((with.x + with.ix) >= 620)) turn_around(fv, true); - - with.x = with.x + with.ix; - } - } -} - -void update_time() { - if (count321 != 0) return; - time_this_second += 1; - if (time_this_second < times_a_second) return; - time1 -= 1; - show_time(); - time_this_second = 0; - if (time1 <= flash_time) - if (odd(time1)) display_const(110, 0, 20); /* Normal time */ - else display_const(110, 0, 86); /* Flash time */ -} - -void hit_people() { - byte fv, ff; - - if (count321 != 0) return; - for (fv = 1; fv <= 100; fv ++) { - mtype &with = m[fv]; - if (with.missile && (with.x != flag)) - for (ff = 1; ff <= maxrunners; ff ++) - if ((running[ff].x != flag) && - overlap(with.x, with.y, with.x + 7, with.y + 10, - running[ff].x, running[ff].y, - running[ff].x + 17, - running[ff].y + 24)) { - sound(7177); - /* setcolor(4); - rectangle(x,y,x+7,y+10); - rectangle(running[ff].x,running[ff].y, - running[ff].x+17, - running[ff].y+24);*/ - nosound; - with.x = flag; - gain(-5); - define(running[ff].x + 20, running[ff].y + 3, - 34 + Random(6), 1, 3, 9, false, true); /* Oof! */ - define(with.x, with.y, 83, 1, 0, 17, false, true); /* Oops! */ - } - } -} - -void escape_check() { - if (count321 != 0) return; - if (escape_count > 0) { - escape_count -= 1; - return; - } - - /* Escape_count = 0; now what? */ - - if (escaping) { - if (got_out) { - new_escape(); - escaping = false; - display_const(escape_stock * 90 + 20, 30, stocks + 4); - } else { - display_const(escape_stock * 90 + 20, 30, stocks + 5); - escape_count = 20; - got_out = true; - define(escape_stock * 90 + 20, 50, 25, 0, 2, 17, false, true); /* Escaped! */ - gain(-10); - has_escaped[escape_stock] = true; - - how_many_have_escaped += 1; - - if (how_many_have_escaped == 7) { - for (time1 = 0; time1 <= 1; time1 ++) { - setactivepage(time1); - cleardevice(); - } - setactivepage(1 - cp); - - memw[storage_seg * storage_ofs + 1] = 0; - do { - } while (!(memw[storage_seg * storage_ofs + 1] > 9)); - - setvisualpage(1 - cp); - display(266, 90, 23); - - memw[storage_seg * storage_ofs + 1] = 0; - do { - } while (!(memw[storage_seg * storage_ofs + 1] > 72)); - - setvisualpage(cp); - - memw[storage_seg * storage_ofs + 1] = 0; - do { - } while (!(memw[storage_seg * storage_ofs + 1] > 9)); - - time1 = 0; - } - } - } else { - escape_stock = get_stock_number(Random(7)); - escaping = true; - got_out = false; - display_const(escape_stock * 90 + 20, 30, stocks + 2); /* Smiling! */ - escape_count = 200; - } -} - -void check321() { - if (count321 == 0) return; - count321 -= 1; - switch (count321) { - case 84: - define(320, 60, 16, 2, 1, 94, false, true); - break; - case 169: - define(320, 60, 15, 0, 1, 94, false, true); - break; - case 254: { - define(320, 60, 14, -2, 1, 94, false, true); - define(0, 100, 18, 2, 0, 254, false, true); - } - break; - } -} - -void check_params(); - -static void not_bootstrap() { - output << "This is not a standalone program!" << NL; - exit(255); -} - -void check_params() { - integer e; - - if (paramstr(1) != "jsb") not_bootstrap(); - - val(paramstr(2), storage_seg, e); - if (e != 0) not_bootstrap(); - val(paramstr(3), storage_ofs, e); - if (e != 0) not_bootstrap(); - -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - check_params(); - - titles(); - setup(); - init_runner(20, 70, 48, 54, Random(5) + 1, Random(4) - 2); - init_runner(600, 70, 48, 54, Random(5) + 1, Random(4) - 2); - init_runner(600, 100, 61, 67, -Random(5) + 1, Random(4) - 2); - init_runner(20, 100, 61, 67, -Random(5) + 1, Random(4) - 2); - do { - memw[storage_seg * storage_ofs + 1] = 0; - - blankit(); - hit_people(); - plotthem(); - movethem(); - move_avvy(); - bump_folk(); - people_running(); - animate(); - escape_check(); - - collision_check(); - - update_time(); - - check321(); - - read_kbd(); - flippage(); - do { - } while (!(memw[storage_seg * storage_ofs + 1] > 0)); - - } while (!(time1 == 0)); - - /* textmode(259); - textattr:=1; - writeln('Your final score was: ',score,'.'); - readln;*/ - mem[storage_seg * storage_ofs] = score; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/seu_avvy.cpp b/engines/avalanche/seu_avvy.cpp deleted file mode 100644 index e0c29309cff6..000000000000 --- a/engines/avalanche/seu_avvy.cpp +++ /dev/null @@ -1,122 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ -}; - -integer gd, gm; -untyped_file sf; -longint id; -word soa; -adxtype a; -byte xw; -array<5, 2053, byte> mani; -matrix<0, 35, 0, 4, byte> sil; -array<1, 16000, byte> aa; -untyped_file outfile; - -void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ - word soaa; - move(mani, aa[5], sizeof(mani)); - { - aa[1] = a.xl; - aa[2] = 0; - aa[3] = a.yl; - aa[4] = 0; /* set up x&y codes */ - } - putimage(xx, yy, aa, 0); - soaa = sizeof(mani); - blockwrite(outfile, soaa, 2); - blockwrite(outfile, aa, sizeof(mani)); -} - -const integer shouldid = -1317732048; - -void explode(byte which) /* 0 is the first one! */ -/* Each character takes five-quarters of (a.size-6) on disk. */ -{ - byte fv, ff; - word so1; /* size of one */ - { - so1 = a.size - 6; - so1 += so1 / 4; - seek(sf, 183 + soa + so1 * which); /* First is at 221 */ - /* where:=filepos(sf);*/ - xw = a.xl / 8; - if ((a.xl % 8) > 0) xw += 1; - - for (fv = 0; fv <= a.yl; fv ++) - blockread(sf, sil[fv], xw); - blockread(sf, mani, a.size - 6); - aa[a.size - 1] = 0; - aa[a.size] = 0; /* footer */ - } - plotat(100, 100); - delay(100); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - assign(outfile, "notts.avd"); - reset(outfile, 1); - seek(outfile, filesize(outfile)); - - assign(sf, "sprite0.avd"); - reset(sf, 1); - - seek(sf, 177); - blockread(sf, id, 4); - blockread(sf, soa, 2); - blockread(sf, a, soa); - - explode(1); - for (gd = 6; gd <= 11; gd ++) explode(gd); - for (gd = 18; gd <= 23; gd ++) explode(gd); - - close(sf); - close(outfile); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sez.cpp b/engines/avalanche/sez.cpp deleted file mode 100644 index d0f88a1e85c2..000000000000 --- a/engines/avalanche/sez.cpp +++ /dev/null @@ -1,27 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/sezedit.cpp b/engines/avalanche/sezedit.cpp deleted file mode 100644 index 1b90ed94bfb5..000000000000 --- a/engines/avalanche/sezedit.cpp +++ /dev/null @@ -1,485 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M 65520,0,655360*/ -/*#include "Crt.h"*/ -#include "graph.h" - -namespace Avalanche { - -const char marker = '\33'; -const char game[] = "Avalot"; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -struct markertype { - word length; - longint offset; - byte checksum; -}; - -struct sezheader { - array<1, 2, char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ -}; - -array<0, 1999, char> buffer, was; -word bufpos, bufsize; -longint chainnum; -varying_string<40> nickname; -array<1, 255, char> junk; -string temp; -char r; -fonttype font; -integer cpos; -sezheader sezhead; -untyped_file f, tempf; -text nicknames; - -byte sumup() { - word fv; - byte total; - byte sumup_result; - total = 0; - for (fv = 0; fv <= bufsize - 1; fv ++) { - total += ord(was[fv]); - } - sumup_result = total; - return sumup_result; -} - -string findname(longint which) { - string x; - varying_string<10> q; - string findname_result; - str(which, q); - reset(nicknames); - do { - nicknames >> x >> NL; - } while (!(x == "{go}")); - do { - nicknames >> x >> NL; - } while (!(pos(q, x) > 0)); - if (eof(nicknames)) { - findname_result = "noname"; - } else { - Delete(x, 1, 3); /* lose "{__" */ - Delete(x, pos(" ", x), 255); /* lose all chars after first space */ - findname_result = x; - } - close(nicknames); - return findname_result; -} - -void cursor() { - byte fv; - for (fv = 12; fv <= 15; fv ++) - mem[0xa000 * cpos + fv * 80] = ~(mem[0xa000 * cpos + fv * 80]); -} - -void xy() { - cpos = (bufpos / 80) * 1280 + (bufpos % 80); -} - -void show() { - word fv, orig, y; - for (fv = 0; fv <= 1999; fv ++) - if (buffer[fv] != was[fv]) { - orig = (fv / 80) * 1280 + (fv % 80); - for (y = 0; y <= 15; y ++) - mem[0xa000 * orig + y * 80] = (byte)(font[buffer[fv]][y]); - } - xy(); - move(buffer, was, sizeof(buffer)); -} - -void sizeup() { - do { - switch (buffer[bufsize]) { - case marker: - return; - break; /* we've found it OK! */ - case '\0': - bufsize -= 1; - break; - default: - bufsize += 1; - } - } while (!false); -} - -void graphics() { - integer gd, gm; - file fontfile; - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - assign(fontfile, "c:\\thomas\\lanche.fnt"); - reset(fontfile); - fontfile >> font; - close(fontfile); -} - -void edit_it(); - -static void legit(char r) { - ; /* it's a legit keystroke */ - move(buffer[bufpos], buffer[bufpos + 1], 1999 - bufpos); - buffer[bufpos] = r; - bufpos += 1; - show(); -} - -void edit_it() { - byte fv; - for (fv = 1; fv <= bufsize; fv ++) buffer[fv] -= (byte)(177 * bufsize); - fillchar(was, sizeof(was), '\0'); - show(); - do { - cursor(); - r = readkey(); - cursor(); - switch (r) { - case '\0': - switch (readkey()) { /* extd keystrokes */ - case 'K': - if (bufpos > 0) { - bufpos -= 1; - xy(); - } - break; /* Left */ - case 'M': - if (bufpos < bufsize) { - bufpos += 1; - xy(); - } - break; /* Right */ - case 'H': - if (bufpos > 80) { - bufpos -= 80; - xy(); - } - break; /* Up */ - case 'P': - if (bufpos < (cardinal)bufsize - 79) { - bufpos += 80; - xy(); - } - break; /* Down */ - case 'G': { - bufpos = 0; - xy(); - } - break; /* Home */ - case 'O': { - bufpos = bufsize; - xy(); - } - break; /* End */ - case 'S': { - ; /* Del */ - move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); - show(); - } - break; - case 'A': - legit('\357'); - break; /* copyright symbol */ - } - break; - case '\10': - if (bufpos > 0) { - ; /* backspace */ - bufpos -= 1; - move(buffer[bufpos + 1], buffer[bufpos], 1999 - bufpos); - show(); - } - break; - case '\33': { - for (fv = 1; fv <= bufsize; fv ++) buffer[fv] += (byte)(177 * bufsize); - restorecrtmode(); - return; - } - break; /* end of editing */ - default: - legit(r); - } - sizeup(); - } while (!false); -} - -void saveit(longint ourchain, word oldsize, word newsize) { - array<1, 17777, byte> buffer; - word numread, numwritten, total; - char check; - word fv; - markertype m; - integer sizechange; /* so's it can be +ve or -ve */ - longint wheresit; /* "offset" value for "ourchain" */ - assign(tempf, "sez.tmp"); - /* OK, here goes... */ - sezhead.size = sezhead.size - longint(oldsize) + longint(newsize); /* adjust our size */ - sizechange = newsize - oldsize; /* +ve if bigger, -ve if smaller, 0 if same */ - textattr = 27; - - rewrite(tempf, 1); - reset(f, 1); - seek(f, 255 + sizeof(sezhead)); /* bypass the junk & sezhead (they're in RAM) */ - - blockwrite(tempf, junk, 255); /* move the junk... */ - blockwrite(tempf, sezhead, sizeof(sezhead)); /* and the header to new files */ - - /* Now to move the markers */ - output << "Moving markers..." << NL; - for (fv = 1; fv <= sezhead.chains; fv ++) { - output << fv << '\15'; - blockread(f, m, sizeof(m)); - if (fv == ourchain) { /* Right, this one's ours! */ - wheresit = m.offset; /* recorded for later */ - m.length = newsize - 1; - m.checksum = sumup(); - } else if (fv > ourchain) { - ; /* After ours- its offset will have to be changed... */ - m.offset = m.offset + longint(sizechange); - } /* Otherwise, before ours- leave it well alone */ - blockwrite(tempf, m, sizeof(m)); - } - output << "Done OK." << NL; - - /* Right, that's the markers done... thank goodness... now it's just the - chains themselves! */ - - total = 0; - - output << "Updating the chains..." << NL; - while (total <= wheresit) { - blockread(f, buffer, 1, numread); - blockwrite(tempf, buffer, numread, numwritten); - output << '.'; - total += numwritten; - } - output << NL; - output << "Updating our chain..." << NL; - /* We're now in the right place (at last...) */ - for (fv = 0; fv <= (bufsize - 1); fv ++) was[fv] += 3 + 177 * fv * (bufsize - 1); /* scramble "was" */ - blockwrite(tempf, was, newsize); /* "was" contains what the values *were* */ - seek(f, filepos(f) + oldsize); - output << NL; - output << "Copying everything else..." << NL; - while (! eof(f)) { /* high-speed copy */ - blockread(f, buffer, 17777, numread); - blockwrite(tempf, buffer, numread); - output << '.'; - } - output << NL; - - /* Closedown */ - close(f); - close(tempf); - erase(f); - rename(tempf, string(game) + ".SEZ"); -} - -void particular() { - word origsize; - bufsize = 0; - output << "Which one\? (? for a list)"; - input >> chainnum >> NL; - if ((chainnum < 0) || (chainnum > sezhead.chains)) { - output << "Don't be silly!" << NL; - return; - } - - origsize = 0 /*bufsize*/; - bufpos = 0; - cpos = 0; - nickname = findname(chainnum); - fillchar(buffer, sizeof(buffer), '\0'); - buffer[0] = marker; - do { - textattr = 30; - output << NL; - output << "SEZ EDITOR (c) 1992, Thomas Thurman." << NL; - output << NL; - output << "Editing scrollchain no." << chainnum << NL; - output << "Your text is " << bufsize << " bytes long." << NL; - output << NL; - output << "Its nickname is \"" << nickname << "\"." << NL; - output << NL; - output << "Enter a command:" << NL; - output << " S) Save the text to disk," << NL; - output << " E) Edit this particular chain," << NL; - output << " N) change the Nickname," << NL; - output << " R) Revert text to the original," << NL; - output << "Esc) Exit and do something else!" << NL; - output << NL; - output << "Your choice? "; - r = upcase(readkey()); - output << r << NL; - switch (r) { - case 'N': { - output << NL; - output << "New nickname (max 40 chars, Enter to cancel)?"; - input >> temp >> NL; - if (temp != "") nickname = temp; - } - break; - case 'E': { - setgraphmode(1); - edit_it(); - } - break; - case 'S': - saveit(chainnum, origsize, bufsize); - break; - case '\33': - return; - break; - } - } while (!false); -} - -void titles() { - const varying_string<7> title = "SEZedit"; - byte fv; - char r; - settextstyle(1, 0, 0); - for (fv = 7; fv >= 1; fv --) { - setcolor(fv * 2); - setusercharsize(8 - fv, 1, 8 - fv, 1); - outtextxy(fv * 65, fv * 40 - 30, title[fv - 1]); - } - setusercharsize(17, 7, 1, 1); - setcolor(green); - outtextxy(300, 10, "Thorsoft"); - outtextxy(10, 310, "Press any key..."); - do { - r = readkey(); - } while (!(! keypressed())); - restorecrtmode(); - textattr = 30; - clrscr; -} - -void addone() { /* Adds a new, empty chain to the end of the list. */ - longint fv; - markertype m; - array<1, 17777, byte> buffer; - word numread; - assign(tempf, "sez.tmp"); - textattr = 27; - rewrite(tempf, 1); - reset(f, 1); /* f = AVALOT.SEZ (original file) */ - seek(f, 255 + sizeof(sezhead)); - sezhead.chains += 1; /* we're adding a new chain */ - - blockwrite(tempf, junk, 255); /* move the junk */ - blockwrite(tempf, sezhead, sizeof(sezhead)); /* move the header */ - - /* Now to move the markers */ - output << "Moving markers..." << NL; - for (fv = 1; fv <= sezhead.chains - longint(1); fv ++) { /* -1 because we've added 1 to it */ - output << fv << '\12'; - blockread(f, m, sizeof(m)); - blockwrite(tempf, m, sizeof(m)); - } - output << "Done OK." << NL; - /* Now we add a new marker onto the end! */ - { - m.offset = sezhead.size; /* right onto the end */ - m.length = 0; /* it's empty */ - } - blockwrite(tempf, m, sizeof(m)); /* write it out to disk */ - - /* Copy everything else... including the #177 check char */ - output << "Copying everything else over..." << NL; - while (! eof(f)) { - blockread(f, buffer, 17777, numread); - blockwrite(tempf, buffer, numread); - output << '.'; - } - output << NL; - close(f); - close(tempf); - erase(f); - rename(tempf, string(game) + ".SEZ"); -} - -void general() { - char r; - do { - textattr = 31; - output << NL; - output << string(game) + ".SEZ" << NL; - output << NL; - output << "No. of chains: " << sezhead.chains << NL; - output << NL; - output << "Choose one of these:" << NL; - output << " A) Add a new scrollchain" << NL; - output << " E) Edit one" << NL; - output << "Esc) Exit" << NL; - output << NL; - output << "Your choice? "; - r = upcase(readkey()); - output << r << NL; - switch (r) { - case 'A': - addone(); - break; - case 'E': - particular(); - break; - case '\33': - exit(0); - break; - } - } while (!false); -} - -void loadit() { - reset(f, 1); - blockread(f, junk, 255); - blockread(f, sezhead, sizeof(sezhead)); - close(f); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(f, string(game) + ".SEZ"); - assign(tempf, "sez.tmp"); - assign(nicknames, string(game) + ".NIK"); - loadit(); - graphics(); - titles(); - general(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.cpp b/engines/avalanche/sezunit.cpp deleted file mode 100644 index 2841a960ff0d..000000000000 --- a/engines/avalanche/sezunit.cpp +++ /dev/null @@ -1,104 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __sezunit_implementation__ - - -#include "sezunit.h" - -namespace Avalanche { - -struct markertype { - word length; - longint offset; - byte checksum; -}; - -untyped_file f; -longint number; -markertype marker; -word fv; -byte sum; - -void sez_setup() { /* This procedure sets up the Sez system (obviously!) */ - - /* Set up variables */ - - fillchar(chain, sizeof(chain), '\261'); /* blank out gunk in "chain" */ - chainsize = 0; /* it's empty (for now...) */ - sezerror = sezok; /* everything's fine! */ - - /* Set up AVALOT.SEZ */ - - assign(f, "avalot.sez"); - reset(f, 1); - seek(f, 255); - blockread(f, sezhead, sizeof(sezhead)); - if (ioresult != 0) { - ; /* too short */ - sezerror = sezgunkyfile; - return; - } - { - if ((sezhead.initials != "TT") || (sezhead.gamecode != thisgamecode) - || (sezhead.revision != thisvercode)) { - sezerror = sezgunkyfile; /* not a valid file */ - return; - } - } -} - -byte sumup() { - word fv; - byte total; - byte sumup_result; - total = 0; - for (fv = 0; fv <= chainsize; fv ++) { - total += ord(chain[fv]); - } - sumup_result = total; - return sumup_result; -} - -void getchain(longint number) { - seek(f, longint(262) + number * longint(7)); - blockread(f, marker, 7); - { - seek(f, longint(270) + sezhead.chains * longint(7) + marker.offset); - blockread(f, chain, marker.length + 1); - for (fv = 0; fv <= marker.length; fv ++) chain[fv] -= 3 + 177 * fv * marker.length; /* unscramble */ - chainsize = marker.length; - if (sumup() != marker.checksum) { - sezerror = sezhacked; - return; - } - } - close(f); - sezerror = sezok; /* nowt went wrong */ -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sezunit.h b/engines/avalanche/sezunit.h deleted file mode 100644 index 5f067e537ef6..000000000000 --- a/engines/avalanche/sezunit.h +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __sezunit_h__ -#define __sezunit_h__ - - -/*#include "Gyro.h"*/ - -namespace Avalanche { - -struct sezheader { - array<1, 2, char> initials; /* should be "TT" */ - word gamecode; - word revision; /* as 3- or 4-digit code (eg v1.00 = 100) */ - longint chains; /* number of scroll chains */ - longint size; /* total size of all chains */ -}; - - - -#ifdef __sezunit_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<0, 1999, char> chain; /* This chain */ -EXTERN word chainsize; /* Length of "chain" */ -EXTERN byte sezerror; /* Error code */ -EXTERN sezheader sezhead; -#undef EXTERN -#define EXTERN extern - - -/* Error codes for "sezerror" */ -const integer sezok = 0; -const integer sezgunkyfile = 1; -const integer sezhacked = 2; - - -void sez_setup(); - -void getchain(longint number); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/sezxfr.cpp b/engines/avalanche/sezxfr.cpp deleted file mode 100644 index 79876930d498..000000000000 --- a/engines/avalanche/sezxfr.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -/*$V-*/ - -namespace Avalanche { - -text t; -string x; -matrix<1, 100, 1, 2, string> data; -word dp, ip, fv; -array<1, 20, word> index1; -array<1, 20, varying_string<10> > names; -array<1, 1777, longint> thumb; -longint total; -untyped_file f; - -void strip() { - x = copy(x, 2, 255); -} - -void squish(string &q) { - string n; - boolean ctrl; - byte fv; - ctrl = false; - n = ""; - for (fv = 1; fv <= length(q); fv ++) - if (q[fv] == '^') ctrl = true; - else { - ; /* not a caret */ - if (ctrl) q[fv] = chr(ord(upcase(q[fv])) - 64); - n = n + q[fv]; - ctrl = false; - } - while (n[length(n)] == '\40') n[0] -= 1; /* strip trailing spaces */ - for (fv = 1; fv <= length(n); fv ++) n[fv] += 177; /* scramble */ - q = n; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - dp = 0; - ip = 0; - fillchar(data, sizeof(data), '\0'); - fillchar(thumb, sizeof(thumb), '\261'); - fillchar(index1, sizeof(index1), '\3'); - assign(t, "v:sez.dat"); - reset(t); - while (! eof(t)) { - t >> x >> NL; - switch (x[1]) { - case ';': { - textattr = lightred; - strip(); - } - break; - case ':': { - textattr = lightblue; - strip(); - if (dp > 0) squish(data[dp][2]); - dp += 1; - data[dp][1] = x; - if (pos("*", x) > 0) { - ; /* index */ - ip += 1; - index1[ip] = dp; - names[ip] = copy(x, 1, pos("*", x) - 1); - } - } - break; - default: { - textattr = white; - data[dp][2] = data[dp][2] + x + '\40'; - } - } - output << x << NL; - } - squish(data[dp][2]); - - total = 1; - for (fv = 1; fv <= dp; fv ++) { - thumb[fv] = total; - total += length(data[fv][2]) + 1; - } - - thumb[dp + 1] = total; - - /* save it all! Firstly, the Sez file... */ - - assign(f, "v:avalot.sez"); - rewrite(f, 1); - x = string("This is a Sez file for an Avvy game, and it's copyright!") + '\32'; - blockwrite(f, x[1], 57); - blockwrite(f, dp, 2); - blockwrite(f, ip, 2); - blockwrite(f, index1, 40); - blockwrite(f, thumb, dp * 4 + 4); - for (fv = 1; fv <= dp; fv ++) - blockwrite(f, data[fv][2], length(data[fv][2]) + 1); - close(f); - - /* ...then the Sed file. */ - - assign(t, "v:avalot.sed"); - rewrite(t); - for (fv = 1; fv <= ip; fv ++) t << names[fv] << NL; - for (fv = 1; fv <= dp; fv ++) t << data[fv][1] << NL; - close(t); - - /* Done! */ - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell1.cpp b/engines/avalanche/shell1.cpp deleted file mode 100644 index fa9513960a40..000000000000 --- a/engines/avalanche/shell1.cpp +++ /dev/null @@ -1,64 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M $800,0,0*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -struct infotype { - matrix<128, 255, 1, 8, byte> chars; - string data; -}; -infotype table; -pointer where; -string comspec; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1f, where); - move(where, table, 1280); - comspec = getenv("comspec"); - table.data = table.data + "Avalot;"; - setintvec(0x1f, &table); - output << NL; - output << "The Astounding Avvy DOS Shell... don't forget to register!" << NL; - output << NL; - output << "Use the command EXIT to return to your game." << NL; - output << NL; - output << "Remember: You *mustn't* load any TSRs while in this DOS shell." << NL; - output << NL; - output << "This includes: GRAPHICS, PRINT, DOSKEY, and pop-up programs (like Sidekick.)" << NL; - output << NL; - output << "About to execute \"" << comspec << "\"..." << NL; - swapvectors; - exec("c:\\command.com", ""); - swapvectors; - setintvec(0x1f, where); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/shell2.cpp b/engines/avalanche/shell2.cpp deleted file mode 100644 index 1c7e52217bb4..000000000000 --- a/engines/avalanche/shell2.cpp +++ /dev/null @@ -1,57 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -#include "graph.h" - -namespace Avalanche { - -struct infotype { - matrix<128, 255, 1, 8, byte> chars; - string data; -}; -infotype table; -pointer where; -integer gd, gm; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1f, where); - move(where, table, 1280); - gd = 1; - gm = 0; - initgraph(gd, gm, "c:\\turbo"); - output << "Now in CGA low-res 320x200." << NL; - output << "High ASCII codes work- " << NL; - output << "And the code is..." << NL; - output << table.data << NL; - output << "Press Enter..." << NL; - input >> NL; - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/slope.cpp b/engines/avalanche/slope.cpp deleted file mode 100644 index f54439178bc9..000000000000 --- a/engines/avalanche/slope.cpp +++ /dev/null @@ -1,397 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -namespace Avalanche { - -struct joysetup { - word xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; /* Size of centre in tenths */ -}; - -const integer bug_twonames = 255; -const integer bug_pandl = 254; -const integer bug_weirdswitch = 253; -const integer bug_invalidini = 252; -const integer bug_notyesorno = 251; -const integer bug_weirdcard = 250; - -byte fv; -char t; -string bugline; -boolean usingp, usingl; -boolean zoomy, numlockhold; -boolean doing_syntax; -joysetup js; -boolean use_joy_a; - -boolean filename_specified; -boolean soundfx; - -string inihead, initail; /* For reading the .INI file. */ - -string filetoload; - -boolean cl_override, keyboardclick, demo; - -string slopeline; - -word storage_seg, storage_ofs; - -string argon; - -longint soundcard, baseaddr, speed, irq, dma; - -string strf(longint x) { - string q; - - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void linebug(byte which) { - output << "AVALOT : "; - switch (which) { - case bug_twonames : - output << "You may only specify ONE filename." << NL; - break; - case bug_pandl : - output << "/p and /l cannot be used together." << NL; - break; - case bug_weirdswitch : - output << "Unknown switch (\"" << bugline << - "\"). Type AVALOT /? for a list of switches." << NL; - break; - case bug_invalidini: - output << "Invalid line in AVALOT.INI (\"" << bugline << "\")" << NL; - break; - case bug_notyesorno: - output << "Error in AVALOT.INI: \"" << inihead << "\" must be \"yes\" or \"no.\"" << NL; - break; - case bug_weirdcard: - output << "Unknown card: " << bugline << '.' << NL; - break; - } - - exit(which); -} - -longint card(string x) { - longint card_result; - if (x == "NONE") card_result = 0; - else if (x == "SB") card_result = 1; - else if (x == "SBPRO") card_result = 2; - else if (x == "SB16") card_result = 3; - else if (x == "PAS") card_result = 4; - else if (x == "PASPLUS") card_result = 5; - else if (x == "PAS16") card_result = 6; - else if (x == "ARIA") card_result = 7; - else if (x == "WINSOUND") card_result = 8; - else if (x == "GRAVIS") card_result = 9; - else if (x == "DACLPT") card_result = 10; - else if (x == "STEREODACS") card_result = 11; - else if (x == "STEREOON1") card_result = 12; - else if (x == "SPEAKER") card_result = 13; - else - linebug(bug_weirdcard); - return card_result; -} - -void upstr(string &x) { - byte fv; - - for (fv = 1; fv <= length(x); fv ++) x[fv] = upcase(x[fv]); -} - -boolean yesno() { - boolean yesno_result; - if (initail == "YES") yesno_result = true; - else if (initail == "NO") yesno_result = false; - else - linebug(bug_notyesorno); - return yesno_result; -} - -word value(string x) { - const varying_string<15> hexdigits = "0123456789ABCDEF"; - word w; - integer e; - - word value_result; - if (x[1] == '$') { - w = 0; - for (e = 2; e <= length(x); e ++) { - w = w << 4; - w += pos(upcase(x[e]), hexdigits) - 1; - } - value_result = w; - } else { - val(x, w, e); - if (e == 0) value_result = w; - else value_result = 0; - } - return value_result; -} - -void ini_parse() { - upstr(inihead); - upstr(initail); - - if (inihead == "QUIET") soundfx = ! yesno(); - else if (inihead == "ZOOMYSTART") zoomy = yesno(); - else if (inihead == "NUMLOCKHOLD") numlockhold = yesno(); - else if (inihead == "LOADFIRST") filetoload = initail; - else if (inihead == "OVERRIDEEGACHECK") cl_override = yesno(); - else if (inihead == "KEYBOARDCLICK") keyboardclick = yesno(); - else if (inihead == "JOYTOP") js.ymin = value(initail); - else if (inihead == "JOYBOTTOM") js.ymax = value(initail); - else if (inihead == "JOYLEFT") js.xmin = value(initail); - else if (inihead == "JOYRIGHT") js.xmax = value(initail); - else if (inihead == "JOYMIDX") js.xmid = value(initail); - else if (inihead == "JOYMIDY") js.ymid = value(initail); - else if (inihead == "JOYCENTRINGFACTOR") js.centre = value(initail); - else if (inihead == "WHICHJOY") use_joy_a = value(initail) == 1; - else if (inihead == "SOUNDCARD") soundcard = card(initail); - else if (inihead == "BASEADDRESS") baseaddr = value(initail); - else if (inihead == "IRQ") irq = value(initail); - else if (inihead == "DMA") dma = value(initail); - else if (inihead == "SAMPLERATE") speed = value(initail); -} - -void strip_ini() { - byte fv; - - if (inihead == "") return; - - /* Firstly, delete any comments. */ - fv = pos(";", inihead); - if (fv > 0) Delete(inihead, fv, 255); - - /* Lose the whitespace... */ - - while (inihead[length(inihead)] == ' ') inihead[0] -= 1; - while ((inihead != "") && (inihead[1] == ' ')) Delete(inihead, 1, 1); - - /* It's possible that now we'll end up with a blank line. */ - - if ((inihead == "") || (inihead[1] == '[')) return; - - fv = pos("=", inihead); - - if (fv == 0) { - /* No "="! Weird! */ - bugline = inihead; - linebug(bug_invalidini); - } - - initail = copy(inihead, fv + 1, 255); - inihead[0] = chr(fv - 1); -} - -void load_ini() { - text ini; - - assign(ini, "AVALOT.INI"); - reset(ini); - - while (! eof(ini)) { - ini >> inihead >> NL; - strip_ini(); - if (inihead != "") ini_parse(); - } - - close(ini); -} - -void parse(string x); -static string arg; - -static string getarg(string otherwis) { - string getarg_result; - if (arg == "") getarg_result = otherwis; - else getarg_result = arg; - return getarg_result; -} - -void parse(string x) - -{ - switch (x[1]) { - case '/': - case '-': { - arg = copy(x, 3, 255); - switch (upcase(x[2])) { - case '?': - doing_syntax = true; - break; - case 'O': - cl_override = true; - break; - case 'L': - if (! usingp) { - usingl = true; - argon = getarg("avvy.log"); - } else linebug(bug_pandl); - break; - case 'P': - if (! usingl) { - usingp = true; - argon = getarg("prn"); - } else linebug(bug_pandl); - break; - case 'Q': - soundfx = false; - break; - case 'Z': - zoomy = true; - break; - case 'K': - keyboardclick = true; - break; - case 'D': - demo = true; - break; - default: { - bugline = x; - linebug(bug_weirdswitch); - } - } - } - break; - case '*': { - inihead = copy(x, 2, 255); - strip_ini(); - if (inihead != "") ini_parse(); - } - break; - default: { /* filename */ - if (filename_specified) - linebug(bug_twonames); - else - filetoload = x; - filename_specified = true; - } - } -} - -void make_slopeline(); - -static char yn1(boolean b) { - char yn1_result; - if (b) yn1_result = 'y'; - else yn1_result = 'n'; - return yn1_result; -} - - - -static char pln() { - char pln_result; - if ((! usingp) && (! usingl)) pln_result = 'n'; - else if (usingp) pln_result = 'p'; - else if (usingl) pln_result = 'l'; - return pln_result; -} - -void make_slopeline() - -{ - if (argon == "") argon = "nul"; - - slopeline = string('1') + yn1(doing_syntax) + yn1(soundfx) + yn1(cl_override) + - yn1(keyboardclick) + pln() + yn1(demo) + yn1(zoomy) + yn1(numlockhold) + - yn1(use_joy_a) + - ' ' + strf(js.xmid) + - ' ' + strf(js.ymid) + - ' ' + strf(js.xmin) + - ' ' + strf(js.ymin) + - ' ' + strf(js.xmax) + - ' ' + strf(js.ymax) + - ' ' + strf(js.centre) + - ' ' + argon + ' ' + filetoload; -} - -void store_slopeline() { - move(slopeline, mem[storage_seg * storage_ofs + 3], sizeof(slopeline)); - move(js, mem[storage_seg * storage_ofs + 300], sizeof(js)); - move(soundcard, mem[storage_seg * storage_ofs + 5000], 4); - move(baseaddr, mem[storage_seg * storage_ofs + 5004], 4); - move(irq, mem[storage_seg * storage_ofs + 5008], 4); - move(dma, mem[storage_seg * storage_ofs + 5012], 4); - move(speed, mem[storage_seg * storage_ofs + 5016], 4); -} - -void get_storage_addr(); - -static void not_through_bootstrap() { - output << "Not standalone!" << NL; - exit(255); -} - -void get_storage_addr() { - integer e; - - if (paramstr(1) != "jsb") not_through_bootstrap(); - val(paramstr(2), storage_seg, e); - if (e != 0) not_through_bootstrap(); - val(paramstr(3), storage_ofs, e); - if (e != 0) not_through_bootstrap(); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - get_storage_addr(); - - filetoload = ""; - argon = ""; - usingl = false; - usingp = false; - cl_override = false; - soundfx = true; - zoomy = false; - numlockhold = false; - filename_specified = false; - keyboardclick = false; - doing_syntax = false; - soundcard = 0; - baseaddr = 0; - irq = 0; - dma = 0; - - load_ini(); - - for (fv = 4; fv <= paramcount; fv ++) - parse(paramstr(fv)); - - make_slopeline(); - - store_slopeline(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread.cpp b/engines/avalanche/spread.cpp deleted file mode 100644 index 17a494cf4155..000000000000 --- a/engines/avalanche/spread.cpp +++ /dev/null @@ -1,389 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -varying_string<3> sn; -adxtype a; -matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ -word bigsize; - -const array<0, 15, varying_string<6> > col = { - { - "Black", "Blue", "Green", "Cyan", "Red", "Pink", "Brown", "Grey+", - "Grey-", "Blue+", "Green+", "Cyan+", "Red+", "Pink+", "Yellow", "White" - } -}; -const string prompt = string('\32') + '\257'; - -void load() { - untyped_file f; - byte gd, gm, sort, n; - pointer p, q; - assign(f, string("v:sprite") + sn + ".avd"); - reset(f, 1); - seek(f, 59); - blockread(f, a, sizeof(a)); - blockread(f, bigsize, 2); - setactivepage(3); - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - blockread(f, p, bigsize); - putimage(0, 0, p, 0); - release(q); - n = 1; - for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - getmem(pic[n][sort], a.size); /* grab the memory */ - getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, - (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, - pic[n][sort]); /* grab the pic */ - n += 1; - } - } - close(f); - setactivepage(0); -} - -void save() { - untyped_file f; - byte gd, gm, sort, n; - pointer p, q; - string x; - integer txl, tyl; - { - txl = a.seq * a.xl * 2; - tyl = a.yl * 2; - } - - assign(f, string("v:sprite") + sn + ".avd"); - x = string("Sprite file for Avvy - Trippancy IV. Subject to copyright.") + '\32'; - rewrite(f, 1); - blockwrite(f, x[1], 59); - - blockwrite(f, a, sizeof(a)); - blockwrite(f, bigsize, 2); - setactivepage(3); - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - n = 1; - for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - putimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, - pic[n][sort], 0); /* drop the pic */ - n += 1; - } - getimage(0, 0, txl, tyl, p); - blockwrite(f, p, bigsize); - release(q); - } - close(f); - setactivepage(0); -} - -void setup() { - integer gd, gm; - output << "SPREAD (c) 1992, Thomas Thurman." << NL; - output << NL; - output << "Enter number of SPRITE*.AVD file to edit:"; - input >> sn >> NL; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); -} - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void likethis() { - { - setfillstyle(1, a.bgc); - setcolor(a.fgc); - settextstyle(0, 0, 1); - bar(0, 190, 100, 200); - outtextxy(12, 191, "Like this!"); - } -} - -void values() { - byte fv; - settextstyle(2, 0, 9); - setcolor(14); - outtextxy(277, 0, string("Spread: editing ") + sn); - setcolor(15); - for (fv = 0; fv <= 3; fv ++) putimage(77 + (a.xl + 10)*fv, 17, pic[a.seq * fv + 1][1], 0); - settextstyle(2, 0, 7); - outtextxy(0, 30, "Views:"); - { - outtextxy(0, 50, string("N: Name: ") + a.name); - outtextxy(0, 70, string("No. of pictures: ") + strf(a.num) + " (" + strf(a.num / a.seq) + " ways)"); - outtextxy(0, 90, string("XY: Size: ") + strf(a.xl) + 'x' + strf(a.yl)); - outtextxy(0, 110, string("S: Stride size: ") + strf(a.seq)); - outtextxy(0, 130, string("Imagesize (bytes): ") + strf(a.size)); - outtextxy(0, 150, string("B: Bubble background: ") + col[a.bgc]); - outtextxy(0, 170, string("F: Bubble foreground: ") + col[a.fgc]); - likethis(); - } - setcolor(lightgreen); - settextstyle(0, 0, 1); - outtextxy(400, 50, "A) Animate"); - outtextxy(400, 60, "E) Edit pictures"); - outtextxy(400, 70, "alt-f2) Save"); - outtextxy(400, 80, "ctrl-f3) Load"); - outtextxy(400, 90, "or any key to the left..."); -} - -byte ccol() { - byte fv; - byte ccol_result; - restorecrtmode(); - output << "Choose a colour- one of these..." << NL; - for (fv = 0; fv <= 15; fv ++) { - textattr = 14; - output << fv << ") "; - textattr = fv; - output << string('\376') + '\40'; - textattr = 14; - output << col[fv] << NL; - } - textattr = 14; - do { - output << prompt; - input >> fv >> NL; - } while (!(fv < 16)); - ccol_result = fv; - setgraphmode(0); - return ccol_result; -} - -string cstr(string oc) { - string x; - string cstr_result; - restorecrtmode(); - output << string("Old choice is: <") + oc + '>' << NL; - output << NL; - output << "(Anything after a semi-colon will not be displayed by the game, e.g. Avvy;Monk" << NL; - output << " will be displayed as Avvy.)" << NL; - output << NL; - output << string("New choice, Enter for no change, Space+Enter for a blank?") + prompt; - input >> x >> NL; - if (x == "") cstr_result = oc; - else if (x == ' ') cstr_result = ""; - else cstr_result = x; - setgraphmode(0); - return cstr_result; -} - -longint cnum(longint on) { - string x; - longint q; - integer e; - longint cnum_result; - restorecrtmode(); - do { - output << "Old value is: " << on << '.' << NL; - output << string("New choice, or Enter for no change?") + prompt; - input >> x >> NL; - if (x == "") { - e = 0; /* must be OK here */ q = on; - } else val(x, q, e); - if (e != 0) output << x << " isn't a number, silly!" << NL; - } while (!(e == 0)); - setgraphmode(0); - cnum_result = q; - return cnum_result; -} - -void animate() { - byte facing, step, slow, fv; - cleardevice(); - settextstyle(0, 0, 2); - setcolor(12); - outtextxy(0, 0, "Animate"); - settextstyle(0, 0, 1); - setcolor(15); - outtextxy(0, 20, "Enter = Turn, + = Faster, - = Slower, Esc = stop this."); - facing = 0; - step = 1; - slow = 100; - do { - for (fv = 0; fv <= 1; fv ++) - putimage(200 * fv + 177, 77, pic[facing * a.seq + step][fv], 4 - fv * 4); - if (keypressed()) - switch (upcase(readkey())) { - case '\15': { - facing += 1; - if (facing * a.seq >= a.num) facing = 0; - } - break; - case '\33': { - cleardevice(); - return; - } - break; - case '+': - if (slow > 0) slow -= 5; - break; - case '-': - if (slow < 255) slow += 5; - break; - default: - output << '\7'; - } - step += 1; - if (step > a.seq) step = 1; - delay(slow); - } while (!false); -} - -byte tabpel(integer x, integer y) { - byte tabpel_result; - if (getpixel(400 + x, 17 + y) == 15) tabpel_result = 17; - else tabpel_result = getpixel(500 + x, 17 + y); - return tabpel_result; -} - -void bigpixel(integer x, integer y, byte size, byte col) { - if (col == 17) setfillstyle(9, 8); - else setfillstyle(1, col); - bar(x * size, y * size, x * size + size - 2, y * size + size - 2); -} - -void blowup(byte n) { - byte fv, x, y, xyl; - { - for (fv = 0; fv <= 1; fv ++) putimage(400 + fv * 100, 17, pic[n][fv], 0); - xyl = 200 / a.yl; - for (x = 0; x <= a.xl; x ++) - for (y = 0; y <= a.yl; y ++) - bigpixel(x, y, xyl, tabpel(x, y)); - } -} - -void edit(); - -static void putnum(byte x, byte p) { - varying_string<2> z; - str(x, z); - outtextxy(x * 53 + 17, 87, z); - putimage(x * 53, 100, pic[p][1], 0); -} - - -static void title() { - cleardevice(); - setcolor(11); - settextstyle(0, 0, 2); - outtextxy(0, 0, "Edit- which one?"); - settextstyle(0, 0, 1); - setcolor(15); -} - -void edit() { - byte fv, ra, rb; - { - title(); - for (fv = 1; fv <= (a.num / a.seq); fv ++) putnum(fv, fv * a.seq); - do { - ra = ord(readkey()) - 48; - } while (!(ra < (a.num / a.seq))); - ra -= 1; - title(); - for (fv = 1; fv <= a.seq; fv ++) putnum(fv, ra * a.seq + fv); - do { - rb = ord(readkey()) - 48; - } while (!(rb < a.seq)); - cleardevice(); - blowup(ra * a.seq + rb); - input >> NL; - cleardevice(); - } -} - -void pickone() { - char r; - r = upcase(readkey()); - switch (r) { - case 'N': - a.name = cstr(a.name); - break; - case 'S': - a.seq = cnum(a.seq); - break; - case 'F': - a.fgc = ccol(); - break; - case 'B': - a.bgc = ccol(); - break; - case 'A': - animate(); - break; - case 'E': - edit(); - break; - case '\0': - switch (readkey()) { - case 'i': - save(); - break; /* alt-f2 */ - } - break; - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - do { - values(); - pickone(); - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/spread2.cpp b/engines/avalanche/spread2.cpp deleted file mode 100644 index b2faed350859..000000000000 --- a/engines/avalanche/spread2.cpp +++ /dev/null @@ -1,1001 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Squeak.h"*/ - -/*$V-,R+*/ - -namespace Avalanche { - -const integer pattern = 12; /* Pattern for transparencies. */ -const fillpatterntype grey50 = {{ - 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, 0x55 - } -}; - -struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ -}; - -untyped_file sf; -adxtype a; -char r; -boolean adxmodi, picmodi; -array<5, 2053, byte> mani; -matrix<0, 99, 0, 10, byte> sil; -array<1, 16000, byte> aa; -word soa; -byte xw; -byte leftc, rightc; -boolean lmo; -array<1, 2, pointer> clip; -integer clipx, clipy; -boolean boardfull; -integer xofs, yofs; /* Distance of TL corner of cut from TL corner of pic. */ - -byte bigpix_size, bigpix_gap; /* Size & gap betwixt big pixels. */ - -void setup() { - const integer shouldid = -1317732048; - boolean ok; - longint id; - varying_string<2> sn; - output << "Sprite Editor 2 (c) 1993, Thomas Thurman." << NL; - bigpix_size = 3; - bigpix_gap = 5; - do { - ok = true; - output << "Number of sprite?"; - input >> sn >> NL; - assign(sf, string("v:\\sprite") + sn + ".avd"); - reset(sf, 1); - seek(sf, 177); - blockread(sf, id, 4); - if (id != shouldid) { - output << "That isn't a valid Trip5 spritefile." << NL; - output << "Please choose another." << NL; - output << NL; - ok = false; - close(sf); - } else { - blockread(sf, soa, 2); - if (soa != (cardinal)sizeof(a)) { /* to change this, just change the "type adx=" bit.*/ - output << "That spritefile contains an unknown ADX field type." << NL; - output << "Please choose another." << NL; - output << NL; - ok = false; - close(sf); - } - } - } while (!ok); - blockread(sf, a, soa); - output << filepos(sf) << NL; - adxmodi = false; - picmodi = false; - getmem(clip[1], a.size); - getmem(clip[2], a.size); - boardfull = false; -} - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void centre(byte y, string z) { - gotoxy(40 - length(z) / 2, y); - output << z; -} - -void info(byte x, byte y, string p, string q) { - gotoxy(x, y); - textattr = 6; - output << p + ":"; - textattr = 11; - output << q; - textattr = 8; - output << ''; -} - -void colours(byte f, byte b) { - gotoxy(35, 11); - textattr = 6; - output << "Bubbles"; - textattr = b * 16 + f; - output << " like this! "; -} - -void adxinfo() { - { - info(5, 8, "Name", a.name); - info(35, 8, "Comment", a.comment); - info(5, 9, "Width", strf(a.xl)); - info(15, 9, "Height", strf(a.yl)); - info(35, 9, "Size of one pic", strf(a.size)); - info(5, 10, "Number in a stride", strf(a.seq)); - info(35, 10, "Number of strides", strf(a.num / a.seq)); - info(5, 11, "Total number", strf(a.num)); - info(5, 12, "Acci number", strf(a.accinum)); - colours(a.fgc, a.bgc); - } -} - -void status() { - textattr = 7; - clrscr; - textattr = 10; - centre(3, "Sprite Editor 2 (c) 1993, Thomas Thurman."); - textattr = 6; - gotoxy(3, 7); - output << "ADX information:"; - adxinfo(); - textattr = 6; - gotoxy(3, 14); - output << "Options:"; - gotoxy(5, 15); - output << "A) edit ADX information"; - gotoxy(5, 16); - output << "P) edit pictures"; - gotoxy(5, 17); - output << "S) save the ADX info (pics are saved automatically)"; -} - -void enterstring(string w, byte l, string &q) { - string t; - textattr = 13; - clrscr; - output << NL; - output << "Press Return for no change, Space+Return for a blank." << NL; - do { - output << "New value for " << w << " (max length " << l << ")?"; - input >> t >> NL; - } while (!(length(t) <= l)); - if (t == ' ') q = ""; - else if (t != "") q = t; - adxmodi = true; -} - -void entercolour(string w, byte &c); -static byte fv; - -static void loseold() { - output << string('\10') + '\377'; -} - - -static void drawnew() { - gotoxy(3 + fv * 5, 11); - output << '\30'; -} - -void entercolour(string w, byte &c) { - textattr = 13; - clrscr; - output << NL; - output << "New value for " << w << '?' << NL; - output << " Use \32\33 to move about, Enter=OK, Esc=Cancel." << NL; - for (fv = 1; fv <= 15; fv ++) { - gotoxy(3 + fv * 5, 10); - textattr = fv; - output << ''; - } - fv = c; - do { - drawnew(); - r = readkey(); - switch (r) { - case '\33': - return; - break; /* no change to c */ - case '\15': { - c = fv; - adxmodi = true; - return; - } - break; - case '\0': - switch (readkey()) { - case 'G': { - loseold(); - fv = 0; - drawnew(); - } - break; /* home */ - case 'O': { - loseold(); - fv = 15; - drawnew(); - } - break; /* end */ - case 'K': - if (fv > 0) { - loseold(); - fv -= 1; - drawnew(); - } - break; /* left */ - case 'M': - if (fv < 15) { - loseold(); - fv += 1; - drawnew(); - } - break; /* right */ - } - break; - } - } while (!false); -} - -void enternum(string w, byte &q) { - string t; - integer e; - byte r; - textattr = 13; - clrscr; - output << NL; - output << "Press Return for no change." << NL; - do { - output << "New value for " << w << '?'; - input >> t >> NL; - if (t == "") return; /* No change... */ - val(t, r, e); - } while (!(e == 0)); - q = r; /* Update variable. */ - adxmodi = true; -} - -void editadx() { - char r; - do { - clrscr; - textattr = 10; - centre(3, "ADX Editor:"); - textattr = 9; - centre(5, "N: Name, C: Comment, F: Foreground, B: Background, A: Accinum, X: eXit."); - adxinfo(); - r = upcase(readkey()); - switch (r) { - case 'N': - enterstring("Name", 12, a.name); - break; - case 'C': - enterstring("Comment", 16, a.comment); - break; - case 'F': - entercolour("Foreground", a.fgc); - break; - case 'B': - entercolour("Background", a.bgc); - break; - case 'A': - enternum("Accinum", a.accinum); - break; - case 'X': - case '\33': - return; - break; - default: - output << '\7'; - } - } while (!false); -} - -void saveit() { - char pak; - integer oldsoa; - textattr = 10; - clrscr; - centre(7, "Saving!"); - if (adxmodi) { - centre(10, "ADX information being saved..."); - seek(sf, 181); /* start of ADX info */ - soa = sizeof(a); - blockread(sf, oldsoa, 2); - /* if soa=oldsoa then - begin;*/ - seek(sf, 181); - blockwrite(sf, soa, 2); - blockwrite(sf, a, soa); - adxmodi = false; - /* end else write(#7);*/ - } else centre(10, "No changes were made to ADX..."); - centre(25, "Press any key..."); - pak = readkey(); -} - -void quit() { - close(sf); - exit(0); -} - -void getsilmani() { /* Reclaims original sil & mani arrays */ - byte x, y, z; - word offs; - - /* Sil... */ - - getimage(500, 150, 500 + a.xl, 150 + a.yl, aa); - - for (x = 0; x <= 3; x ++) - for (y = 0; y <= a.yl; y ++) - for (z = 0; z <= (a.xl / 8); z ++) { - offs = 5 + y * xw * 4 + xw * x + z; - sil[y][z] = aa[offs]; - } - - /* ...Mani. */ - - getimage(500, 50, 500 + a.xl, 50 + a.yl, aa); - - move(aa[5], mani, sizeof(mani)); - -} - -void explode(byte which) /* 0 is the first one! */ -/* Each character takes five-quarters of (a.size-6) on disk. */ -{ - byte fv, ff; - word so1; /* size of one */ - { - so1 = a.size - 6; - so1 += so1 / 4; - seek(sf, 183 + soa + so1 * which); /* First is at 221 */ - /* where:=filepos(sf);*/ - xw = a.xl / 8; - if ((a.xl % 8) > 0) xw += 1; - - for (fv = 0; fv <= a.yl; fv ++) - blockread(sf, sil[fv], xw); - blockread(sf, mani, a.size - 6); - aa[a.size - 1] = 0; - aa[a.size] = 0; /* footer */ - } -} - -void implode(byte which) { /* Writes a pic back onto the disk */ - byte fv, ff; - word so1; /* size of one */ - { - - getsilmani(); /* Restore original arrays */ - - so1 = a.size - 6; - so1 += so1 / 4; - seek(sf, 183 + soa + so1 * which); /* First is at 221 */ - - xw = a.xl / 8; - if ((a.xl % 8) > 0) xw += 1; - - for (fv = 0; fv <= a.yl; fv ++) - blockwrite(sf, sil[fv], xw); - blockwrite(sf, mani, a.size - 6); - aa[a.size - 1] = 0; - aa[a.size] = 0; /* footer */ - } -} - -void plotat(integer xx, integer yy) { /* Does NOT cameo the picture!*/ - move(mani, aa[5], sizeof(mani)); - { - aa[1] = a.xl; - aa[2] = 0; - aa[3] = a.yl; - aa[4] = 0; /* set up x&y codes */ - } - putimage(xx, yy, aa, 0); -} - -void plotsil(integer xx, integer yy) { /* Plots silhouette- rarely used */ - byte x, y, z; - word offs; - for (x = 0; x <= 3; x ++) - for (y = 0; y <= a.yl; y ++) - for (z = 0; z <= (a.xl / 8); z ++) { - offs = 5 + y * xw * 4 + xw * x + z; - aa[offs] = sil[y][z]; - } - - { - aa[1] = a.xl; - aa[2] = 0; - aa[3] = a.yl; - aa[4] = 0; /* set up x&y codes */ - } - - putimage(xx, yy, aa, 0); - -} - -void style(byte x) { - if (x == 16) - /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); - else - setfillstyle(1, x); -} - -void bigpixel(integer x, integer y) { - if (getpixel(500 + x, 150 + y) == 15) - /*setfillstyle(pattern,8)*/setfillpattern(grey50, 8); - else - setfillstyle(1, getpixel(500 + x, 50 + y)); - - bar(x * bigpix_gap, y * bigpix_gap, - x * bigpix_gap + bigpix_size, y * bigpix_gap + bigpix_size); -} - -void subplot(byte y, integer x, char c) { - setfillstyle(1, 0); - bar(x, 0, x + 9, 170); - outtextxy(x + 5, y * 10 + 5, c); -} - -void plotleft() { - ; /* palette arrows */ - subplot(leftc, 239, '\32'); -} -void plotright() { - subplot(rightc, 351, '\33'); -} - -void plotbig(byte x, byte y, byte c) { - style(c); - bar(x * bigpix_gap, y * bigpix_gap, - x * bigpix_gap + bigpix_size, y * bigpix_gap + bigpix_size); - if (c == 16) { - putpixel(500 + x, 150 + y, 15); - putpixel(500 + x, 50 + y, 0); - } else { - putpixel(500 + x, 150 + y, 0); - putpixel(500 + x, 50 + y, c); - } -} - -void changepic() { - mx = mx / bigpix_gap; - my = my / bigpix_gap; - if ((mx > a.xl) || (my > a.yl)) return; - if (mkey == left) - plotbig(mx, my, leftc); - else - plotbig(mx, my, rightc); -} - -void changecol() { - my = my / 10; - if (my > 16) return; - if (mkey == left) { - leftc = my; - plotleft(); - } else { - rightc = my; - plotright(); - } -} - -void showcutpic() { - setfillstyle(5, 1); - bar(20, 160, 40 + clipx, 180 + clipy); - putimage(30, 170, clip[2], andput); - putimage(30, 170, clip[1], xorput); -} - -void movesquare(integer &xc, integer &yc, integer xl, integer yl) { - integer x2, y2; - do { - x2 = xl + xc; - y2 = yl + yc; - setcolor(15); - do { - rectangle(xc * bigpix_gap - 1, yc * bigpix_gap - 1, - x2 * (bigpix_gap + 1) - 1, y2 * (bigpix_gap + 1) - 1); - } while (!keypressed()); - setcolor(0); - rectangle(xc * bigpix_gap - 1, yc * bigpix_gap - 1, - x2 * (bigpix_gap + 1) - 1, y2 * (bigpix_gap + 1) - 1); - switch (readkey()) { - case '\0': - switch (readkey()) { - case '\110': - yc -= 1; - break; - case '\113': - xc -= 1; - break; - case '\115': - xc += 1; - break; - case '\120': - yc += 1; - break; - } - break; - case '\15': - return; - break; - } - while ((xl + xc) > a.xl) xc -= 1; - while ((yl + yc) > a.yl) yc -= 1; - if (xc < 0) xc = 0; - if (yc < 0) yc = 0; - } while (!false); -} - -void switch_(integer &v1, integer &v2) -/* Swaps over the values of v1 and v2. */ -{ - integer temp; - temp = v1; - v1 = v2; - v2 = temp; -} - -void choosesquare(integer &x1, integer &y1, integer &x2, integer &y2) { - boolean tl; - do { - setcolor(15); - do { - rectangle(x1 * bigpix_gap - 1, y1 * bigpix_gap - 1, - (x2 + 1)*bigpix_gap - 1, (y2 + 1)*bigpix_gap - 1); - } while (!keypressed()); - setcolor(0); - rectangle(x1 * bigpix_gap - 1, y1 * bigpix_gap - 1, - (x2 + 1)*bigpix_gap - 1, (y2 + 1)*bigpix_gap - 1); - switch (readkey()) { - case '\0': - switch (readkey()) { - case '\110': - if (tl) y1 -= 1; - else y2 -= 1; - break; - case '\113': - if (tl) x1 -= 1; - else x2 -= 1; - break; - case '\115': - if (tl) x1 += 1; - else x2 += 1; - break; - case '\120': - if (tl) y1 += 1; - else y2 += 1; - break; - } - break; - case '\11': - tl = ! tl; - break; - case '\15': { - if (x1 > x2) switch_(x1, x2); /* Get the square the right way up. */ - if (y1 > y2) switch_(y1, y2); - y2 -= y1; - x2 -= x1; /* y1 & y2 have to be the OFFSETS! */ - return; - } - break; - } - if (x1 < 0) x1 = 0; - if (y1 < 0) y1 = 0; - { - if (y2 > a.yl) y2 = a.yl; - if (x2 > a.xl) x2 = a.xl; - } - } while (!false); -} - -void paste() { - byte x, y; - if (! boardfull) { - output << '\7'; - return; - } - if (!((clipx == a.xl) && (clipy == a.yl))) - movesquare(xofs, yofs, clipx, clipy); - putimage(500 + xofs, 50 + yofs, clip[1], 0); - putimage(500 + xofs, 150 + yofs, clip[2], 0); - for (x = 0; x <= a.xl; x ++) - for (y = 0; y <= a.yl; y ++) { - bigpixel(x, y); - } -} - -void cut() { - xofs = 0; - yofs = 0; /* From the TL. */ - { - getimage(500, 50, 500 + a.xl, 50 + a.yl, clip[1]); - getimage(500, 150, 500 + a.xl, 150 + a.yl, clip[2]); - clipx = a.xl; - clipy = a.yl; - } - showcutpic(); - boardfull = true; -} - -void cutsome() { - { - choosesquare(xofs, yofs, clipx, clipy); - getimage(500 + xofs, 50 + yofs, 500 + xofs + clipx, 50 + yofs + clipy, clip[1]); - getimage(500 + xofs, 150 + yofs, 500 + xofs + clipx, 150 + yofs + clipy, clip[2]); - } - showcutpic(); - boardfull = true; -} - -boolean confirm(char c, string x) { - byte col; - char groi; - boolean confirm_result; - while (keypressed()) groi = readkey(); - x = x + "? " + c + " to confirm."; - col = 1; - do { - setcolor(col); - outtextxy(555, 5, x); - col += 1; - if (col == 16) col = 1; - } while (!keypressed()); - confirm_result = upcase(readkey()) == c; - setfillstyle(1, 0); - bar(470, 0, 640, 10); - return confirm_result; -} - -void checkbutton(byte which) { - my = (my - 12) / 25; - switch (my) { - case 0: - if (confirm('S', "Save")) { - implode(which); - lmo = true; - } - break; - case 1: - if (confirm('C', "Cancel")) lmo = true; - break; - case 4: - cut(); - break; - case 5: - if (confirm('P', "Paste")) paste(); - break; - case 6: - cutsome(); - break; - } -} - -void animate() { -} - -void undo() { -} - -void fliplr(); - -static void flipline(integer x1, integer x2, integer y) { - integer fv, ff; - for (fv = x1; fv <= x2; fv ++) putpixel(fv, 0, getpixel(fv, y)); - ff = x2; - for (fv = x1; fv <= x2; fv ++) { - putpixel(fv, y, getpixel(ff, 0)); - ff -= 1; - } -} - -void fliplr() { /* Flips left-to-right. */ - integer fv, ff; - for (fv = 0; fv <= a.yl; fv ++) { - flipline(500, 500 + a.xl, 50 + fv); - flipline(500, 500 + a.xl, 150 + fv); - } - for (fv = 0; fv <= a.xl; fv ++) - for (ff = 0; ff <= a.yl; ff ++) - bigpixel(fv, ff); -} - -void change_colours() { /* Swaps one colour with another. */ - byte fv, ff; - - if ((leftc == 16) || (rightc == 16)) { /* See-through can't be one of the colours. */ - output << '\7'; /* Bleep! */ - return; - } - - for (fv = 0; fv <= a.yl; fv ++) - for (ff = 0; ff <= a.xl; ff ++) - if (getpixel(500 + ff, 50 + fv) == leftc) - putpixel(500 + ff, 50 + fv, rightc); - - for (fv = 0; fv <= a.xl; fv ++) - for (ff = 0; ff <= a.yl; ff ++) - bigpixel(fv, ff); -} - -void redraw() { - byte x, y; - setfillstyle(1, 0); - bar(0, 0, 250, 200); - - for (x = 0; x <= a.xl; x ++) - for (y = 0; y <= a.yl; y ++) { - bigpixel(x, y); - } -} - -void parse(char c) { /* Parses keystrokes */ - switch (upcase(c)) { - case '\26': - case 'P': - paste(); - break; - case '\3': - case 'C': - cut(); - break; - case '\30': - case 'X': - cutsome(); - break; - case 'A': - animate(); - break; - case 'U': - undo(); - break; - case '@': - fliplr(); - break; - case '!': - change_colours(); - break; - case '<': - if (bigpix_size > 1) { - bigpix_size -= 1; - bigpix_gap -= 1; - redraw(); - } - break; - case '>': - if (bigpix_size < 8) { - bigpix_size += 1; - bigpix_gap += 1; - redraw(); - } - break; - case '\33': - if (confirm('X', "Exit")) lmo = true; - break; - } -} - -void editone(byte which) { - byte x, y; - cleardevice(); - explode(which); - plotat(500, 50); - plotsil(500, 150); - for (x = 0; x <= a.xl; x ++) - for (y = 0; y <= a.yl; y ++) { - bigpixel(x, y); - } - for (y = 0; y <= 16; y ++) { - style(y); - bar(251, y * 10 + 1, 349, y * 10 + 9); - rectangle(250, y * 10, 350, y * 10 + 10); - } - - settextstyle(0, 0, 1); - leftc = 15; - rightc = 16; - plotleft(); - plotright(); - lmo = false; - - outtextxy(410, 25, "Save"); - outtextxy(410, 50, "Cancel"); - outtextxy(410, 75, "Animate"); - outtextxy(410, 100, "Undo"); - outtextxy(410, 125, "Cut"); - outtextxy(410, 150, "Paste"); - outtextxy(410, 175, "X: Cut Some"); - if (boardfull) showcutpic(); - setfillstyle(6, 15); - for (y = 0; y <= 7; y ++) - bar(370, y * 25 + 12, 450, y * 25 + 12); - - do { - on; - do { - if (keypressed()) parse(readkey()); - } while (!(anyo | lmo)); - off; - - if (! lmo) { - getbuttonstatus; - - switch (mx) { - case 1 ... 249: - changepic(); - break; - case 250 ... 350: - changecol(); - break; - case 370 ... 450: - checkbutton(which); - break; - } - } - } while (!lmo); - settextstyle(2, 0, 7); - setcolor(15); -} - -void editstride(byte which); - -static char whichc; - -static shortint first; - -static void drawup(byte &which) { - byte fv; - whichc = chr(which + 48); - cleardevice(); - outtextxy(320, 10, string("Edit stride ") + whichc); - first = (which - 1) * a.seq - 1; - for (fv = 1; fv <= a.seq; fv ++) { - explode(fv + first); - plotat(fv * 73, 77); - outtextxy(17 + fv * 73, 64, chr(fv + 48)); - } - outtextxy(320, 177, "Which?"); -} - -void editstride(byte which) { - char r; - drawup(which); - do { - r = readkey(); - if ((r > '0') && (r <= chr(a.seq + 48))) { - editone(ord(r) - 48 + first); - drawup(which); - } - } while (!(r == '\33')); -} - -void editpics(); - -static byte nds; /* num div seq */ - -static void drawup1() { - byte fv; - setgraphmode(0); - directvideo = false; - settextjustify(1, 1); - nds = a.num / a.seq; - settextstyle(2, 0, 7); - outtextxy(320, 10, "Edit pictures..."); - outtextxy(320, 40, "(Usually, 1=away, 2=right, 3=towards, 4=left.)"); - for (fv = 1; fv <= nds; fv ++) { - explode((fv - 1)*a.seq); - plotat(fv * 73, 100); - outtextxy(17 + fv * 73, 87, chr(fv + 48)); - } - outtextxy(320, 60, string("There are ") + strf(nds) + " strides available."); - outtextxy(320, 177, "Which do you want?"); -} - -void editpics() { - char r; - byte which; - integer e; - drawup1(); - do { - r = readkey(); - if ((r > '0') && (r <= chr(nds + 48))) { - editstride(ord(r) - 48); - drawup1(); - } - } while (!(r == '\33')); - restorecrtmode(); -} - -void titles() { - integer gd, gm; - char pak; - word wait; - gd = 3; - gm = 1; - initgraph(gd, gm, "c:\\bp\\bgi"); - settextstyle(5, 0, 10); - settextjustify(1, 1); - gm = getmaxy() / 2; - wait = 0; - do { - for (gm = 0; gm <= 15; gm ++) { - setcolor(15 - gm); - for (gd = 0; gd <= (150 - gm * 10); gd ++) { - outtextxy(320, 124 - gd, "Spread 2"); - outtextxy(320, 125 + gd, "Spread 2"); - if ((gd == 5) && (gm == 0)) wait = 2345; - if ((gd == 6) && (gm == 0)) wait = 0; - do { - if (keypressed()) { - while (keypressed()) pak = readkey(); - restorecrtmode(); - return; - } - if (wait > 0) { - wait -= 1; - delay(1); - } - } while (!(wait == 0)); - } - } - } while (!false); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - titles(); - setup(); - do { - status(); - r = upcase(readkey()); - switch (r) { - case 'A': - editadx(); - break; - case 'P': - editpics(); - break; - case 'S': - saveit(); - break; - case 'X': - case '\33': - quit(); - break; - } - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/squish.cpp b/engines/avalanche/squish.cpp deleted file mode 100644 index a083af054caa..000000000000 --- a/engines/avalanche/squish.cpp +++ /dev/null @@ -1,480 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* This is the first version. Thanks to Pib. */ - -/*--------------------------------------------------------------------------*/ -/* */ -/* Global declarations for PIBLZW */ -/* */ -/*--------------------------------------------------------------------------*/ - -namespace Avalanche { - -const integer maxbuff = 8192 /* Buffer size for input and output files */; -const integer maxtab = 4095 /* Table size - 1 ==> 2**10-1 ==> 12 bits */; -const integer no_prev = 0x7fff /* Special code for no previous character */; -const integer eof_char = -2 /* Marks end of file */; -const integer end_list = -1 /* Marks end of a list */; -const integer empty = -3 /* Indicates empty */; - -typedef varying_string<255> anystr/* General string type */; - -/* One node in parsing table. */ -struct string_table_entry { - boolean used /* Is this node used yet? */; - integer prevchar /* Code for preceding string */; - integer follchar /* Code for current character */; - integer next /* Next dupl in collision list */; -}; - -untyped_file input_file /* Input file */; -untyped_file output_file /* Output file */; - -integer inbufsize /* Count of chars in input buffer */; - -array<1, maxbuff, byte> input_buffer /* Input buffer area */; -array<1, maxbuff, byte> output_buffer /* Output buffer area */; - -integer input_pos /* Cur. pos. in input buffer */; -integer output_pos /* Cur. pos. in output buffer */; - -/* String table */ - -array<0, maxtab, string_table_entry> string_table; - -integer table_used /* # string table entries used */; -integer output_code /* Output compressed code */; -integer input_code /* Input compressed code */; -boolean if_compressing /* TRUE if compressing file */; -integer ierr /* Input/output error */; - -string header; -varying_string<30> describe; -byte method; - -void terminate() - -{ - /* Terminate */ - /* Write any remaining characters */ - /* to output file. */ - if (output_pos > 0) - blockwrite(output_file, output_buffer, output_pos); - - ierr = ioresult; - /* Close input and output files */ - close(input_file); - ierr = ioresult; - - close(output_file); - ierr = ioresult; - - output << "done." << NL; - -} /* Terminate */ - -/*--------------------------------------------------------------------------*/ -/* Get_Hash_Code --- Gets hash code for given C string */ -/*--------------------------------------------------------------------------*/ - -integer get_hash_code(integer prevc, integer follc) - -{ - integer index; - integer index2; - - /* Get_Hash_Code */ - /* Get initial index using hashing */ - - integer get_hash_code_result; - index = ((prevc << 5) ^ follc) & maxtab; - - /* If entry not already used, return */ - /* its index as hash code for C. */ - - if (! string_table[index].used) - get_hash_code_result = index; - else - /* If entry already used, search to */ - /* end of list of hash collision */ - /* entries for this hash code. */ - /* Do linear probe to find an */ - /* available slot. */ - { - - /* Skip to end of collision list ... */ - - while (string_table[index].next != end_list) - index = string_table[index].next; - - /* Begin linear probe down a bit from */ - /* last entry in collision list ... */ - - index2 = (index + 101) & maxtab; - - /* Look for unused entry using linear */ - /* probing ... */ - - while (string_table[index2].used) - index2 = succ(integer, index2) & maxtab; - - /* Point prior end of collision list */ - /* to this new node. */ - - string_table[index].next = index2; - - /* Return hash code for C */ - - get_hash_code_result = index2; - - } - - return get_hash_code_result; -} /* Get_Hash_Code */ - -/*--------------------------------------------------------------------------*/ -/* Make_Table_Entry --- Enter C string in string table */ -/*--------------------------------------------------------------------------*/ - -void make_table_entry(integer prevc, integer follc) - -{ - /* Make_Table_Entry */ - /* Only enter string if there is room left */ - - if (table_used <= maxtab) { - { - string_table_entry &with = string_table[ get_hash_code(prevc , follc) ]; - - with.used = true; - with.next = end_list; - with.prevchar = prevc; - with.follchar = follc; - } - /* Increment count of items used */ - - table_used += 1; - /* - IF ( Table_Used > ( MaxTab + 1 ) ) THEN - BEGIN - WRITELN('Hash table full.'); - END; - */ - } - -} /* Make_Table_Entry */ - -/*--------------------------------------------------------------------------*/ -/* Initialize_String_Table --- Initialize string table */ -/*--------------------------------------------------------------------------*/ - -void initialize_string_table() - -{ - integer i; - - /* Initialize_String_Table */ - - /* No entries used in table yet */ - table_used = 0; - /* Clear all table entries */ - for (i = 0; i <= maxtab; i ++) { - string_table_entry &with = string_table[i]; - - with.prevchar = no_prev; - with.follchar = no_prev; - with.next = -1; - with.used = false; - } - /* Enter all single characters into */ - /* table */ - for (i = 0; i <= 255; i ++) - make_table_entry(no_prev , i); - -} /* Initialize_String_Table */ - -/*--------------------------------------------------------------------------*/ -/* Initialize --- Initialize compression/decompression */ -/*--------------------------------------------------------------------------*/ - -void initialize() - -{ - anystr input_name /* Input file name */; - anystr output_name /* Output file name */; - - /* Initialize */ - - output << "Number of file to compress:"; - input >> input_name >> NL; - output << "For the moment, I'm writing the compressed version to v:compr" << - input_name << ".avd." << NL; - output_name = string("d:compr") + input_name + ".avd"; - input_name = string("d:place") + input_name + ".avd"; - - output << "Wait... "; - - /* Open input file */ - - assign(input_file , input_name); - reset(input_file , 1); - ierr = ioresult; - - blockread(input_file, header, 146); - blockread(input_file, describe, 30); - blockread(input_file, method, 1); - - if (method == 177) { - output << "It's already compressed!" << NL; - exit(177); - } - - /* Open output file */ - - assign(output_file , output_name); - rewrite(output_file , 1); - ierr = ioresult; - - method = 177; - - blockwrite(output_file, header, 146); - blockwrite(output_file, describe, 30); - blockwrite(output_file, method, 1); - - /* Point input point past end of */ - /* buffer to force initial read */ - input_pos = maxbuff + 1; - /* Nothing written out yet */ - output_pos = 0; - /* Nothing read in yet */ - inbufsize = 0; - /* No input or output codes yet */ - /* constructed */ - output_code = empty; - input_code = empty; - /* Initialize string hash table */ - initialize_string_table(); - -} /* Initialize */ - -/*--------------------------------------------------------------------------*/ -/* Lookup_String --- Look for string C in string table */ -/*--------------------------------------------------------------------------*/ - -integer lookup_string(integer prevc, integer follc) - -{ - integer index; - integer index2; - boolean found; - - /* Lookup_String */ - /* Initialize index to check from hash */ - - integer lookup_string_result; - index = ((prevc << 5) ^ follc) & maxtab; - - /* Assume we won't find string */ - lookup_string_result = end_list; - /* Search through list of hash collision */ - /* entries for one that matches C */ - do { - - found = (string_table[index].prevchar == prevc) && - (string_table[index].follchar == follc); - - if (! found) - index = string_table[index].next; - - } while (!(found || (index == end_list))); - - /* Return index if C found in table. */ - if (found) - lookup_string_result = index; - - return lookup_string_result; -} /* Lookup_String */ - -/*--------------------------------------------------------------------------*/ -/* Get_Char --- Read character from input file */ -/*--------------------------------------------------------------------------*/ - -void get_char(integer &c) - -{ - /* Get_Char */ - /* Point to next character in buffer */ - input_pos += 1; - /* If past end of block read in, then */ - /* reset input pointer and read in */ - /* next block. */ - - if (input_pos > inbufsize) { - blockread(input_file, input_buffer, maxbuff, inbufsize); - input_pos = 1; - ierr = ioresult; - } - /* If end of file hit, return EOF_Char */ - /* otherwise return next character in */ - /* input buffer. */ - if (inbufsize == 0) - c = eof_char; - else - c = input_buffer[input_pos]; - -} /* Get_Char */ - -/*--------------------------------------------------------------------------*/ -/* Write_Char --- Write character to output file */ -/*--------------------------------------------------------------------------*/ - -void put_char(integer c) - -{ - /* Put_Char */ - /* If buffer full, write it out and */ - /* reset output buffer pointer. */ - - if (output_pos >= maxbuff) { - blockwrite(output_file, output_buffer, maxbuff); - output_pos = 0; - ierr = ioresult; - } - /* Place character in next slot in */ - /* output buffer. */ - - output_pos += 1; - output_buffer[output_pos] = c; - -} /* Put_Char */ - -/*--------------------------------------------------------------------------*/ -/* Put_Code --- Write hash code to output file. */ -/*--------------------------------------------------------------------------*/ - -void put_code(integer hash_code) - -{ - /* Put_Code */ - /* Output code word is empty. */ - /* Put out 1st 8 bits of compression */ - /* code and save last 4 bit for next */ - /* time through. */ - - if (output_code == empty) { - put_char(((cardinal)hash_code >> 4) & 0xff); - output_code = hash_code & 0xf; - } else - /* Output code word not empty. */ - /* Put out last 4 bits of previous */ - /* code appended to 1st 4 bits of this */ - /* code. Then put out last 8 bits of */ - /* this code. */ - { - put_char(((output_code << 4) & 0xff0) + - (((cardinal)hash_code >> 8) & 0xf)); - put_char(hash_code & 0xff); - output_code = empty; - } - -} /* Put_Code */ - -/*--------------------------------------------------------------------------*/ -/* Do_Compression --- Perform Lempel-Ziv-Welch compression */ -/*--------------------------------------------------------------------------*/ - -void do_compression() - -{ - integer c /* Current input character = C */; - integer wc /* Hash code value for C */; - integer w /* Hash code value for */; - - /* Do_Compression */ - /* Read first character ==> Step 2 */ - get_char(c); - /* Initial hash code -- first character */ - /* has no previous string ( is null) */ - - w = lookup_string(no_prev , c); - - /* Get next character ==> Step 3 */ - get_char(c); - /* Loop over input characters until */ - /* end of file reached ==> Step 4. */ - while (c != eof_char) { - /* See if C is in table. */ - - wc = lookup_string(w , c); - - /* If C is not in the table, */ - /* enter it into the table and */ - /* output . Reset to */ - /* be the code for C ==> Step 6 */ - - if (wc == end_list) { - - make_table_entry(w , c); - put_code(w); - w = lookup_string(no_prev , c); - - } else /* If C is in table, keep looking */ - /* for longer strings == Step 5 */ - - w = wc; - - /* Get next input character ==> Step 3 */ - get_char(c); - - } - /* Make sure last code is */ - /* written out ==> Step 4. */ - put_code(w); - -} /* Do_Compression */ - -/*--------------------------------------------------------------------------*/ -/* PibCompr --- Main program */ -/*--------------------------------------------------------------------------*/ - -int main(int argc, const char *argv[]) { - /* PibCompr */ - /* We are doing compression */ - pio_initialize(argc, argv); - if_compressing = true; - /* Initialize compression */ - initialize(); - /* Perform compression */ - do_compression(); - /* Clean up and exit */ - terminate(); - - return EXIT_SUCCESS; -} /* PibCompr */ - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_blank.cpp b/engines/avalanche/ss_blank.cpp deleted file mode 100644 index 9be7982862c8..000000000000 --- a/engines/avalanche/ss_blank.cpp +++ /dev/null @@ -1,69 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -byte fv; -boolean test; - -boolean the_cows_come_home() { - registers rmove, rclick; - boolean the_cows_come_home_result; - rmove.ax = 11; - intr(0x33, rmove); - rclick.ax = 3; - intr(0x33, rclick); - the_cows_come_home_result = - (keypressed()) | /* key pressed */ - (rmove.cx > 0) || /* mouse moved */ - (rmove.dx > 0) || - (rclick.bx > 0); /* button clicked */ - return the_cows_come_home_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - test = the_cows_come_home(); - textattr = 0; - clrscr; - do { - } while (!the_cows_come_home()); - textattr = 30; - clrscr; - output << "*** Blank Screen *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; - for (fv = 1; fv <= 46; fv ++) output << '~'; - output << NL; - output << "This program may be freely copied." << NL; - output << NL; - output << "Have fun!" << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ss_clock.cpp b/engines/avalanche/ss_clock.cpp deleted file mode 100644 index 1ac87632344c..000000000000 --- a/engines/avalanche/ss_clock.cpp +++ /dev/null @@ -1,129 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ -/*#include "Crt.h"*/ -#include "graph.h" -/*#include "Drivers.h"*/ - -namespace Avalanche { - -const integer width = 88; -const integer height = 8; /* width & height of string returned by "time" */ - -integer gd, gm; -integer xx, yy; -shortint ix, iy; -byte cp; -byte count; -array<0, 1, pointtype> pages; -boolean test; - -boolean the_cows_come_home() { - registers rmove, rclick; - boolean the_cows_come_home_result; - rmove.ax = 11; - intr(0x33, rmove); - rclick.ax = 3; - intr(0x33, rclick); - the_cows_come_home_result = - (keypressed()) || /* key pressed */ - (rmove.cx > 0) || /* mouse moved */ - (rmove.dx > 0) || - (rclick.bx > 0); /* button clicked */ - return the_cows_come_home_result; -} - -string time1() { - word h, m, s, s1; - varying_string<2> hh, mm, ss; - char ampm; - string time1_result; - gettime(h, m, s, s1); - if (h < 12) - ampm = 'a'; - else { - ampm = 'p'; - if (h == 0) h = 12; - else h -= 12; /* 24-hr adjustment */ - } - str(h, 2, hh); - str(m, 2, mm); - str(s, 2, ss); /* stringify them */ - time1_result = hh + '.' + mm + '.' + ss + ' ' + ampm + 'm'; - return time1_result; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - test = the_cows_come_home(); - gm = registerbgidriver(&egavgadriverproc); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - ix = 3; - iy = 1; - xx = 177; - yy = 177; - setcolor(11); - cp = 0; - setfillstyle(1, 0); - count = 2; - do { - setactivepage(cp); - setvisualpage(1 - cp); - cp = 1 - cp; - delay(20); - if (count > 0) count -= 1; - { - pointtype &with = pages[cp]; - if (count == 0) - bar(with.x, with.y, with.x + width, with.y + height); - with.x = xx; - with.y = yy; /* update record for next time */ - } - outtextxy(xx, yy, time1()); - xx = xx + ix; - yy = yy + iy; - if (xx <= 10) ix = Random(9) + 1; - if (xx >= 629 - width) ix = -Random(9) + 1; - if (yy <= 10) iy = Random(9) + 1; - if (yy >= 339 - height) iy = -Random(9) + 1; - } while (!the_cows_come_home()); - closegraph(); - textattr = 30; - clrscr; - output << "*** Bouncing Clock *** (c) 1992, Thomas Thurman. (An Avvy Screen Saver.)" << NL; - for (gd = 1; gd <= 48; gd ++) output << '~'; - output << NL; - output << "This program may be freely copied." << NL; - output << NL; - output << "Have fun!" << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/stars.cpp b/engines/avalanche/stars.cpp deleted file mode 100644 index 09bbe3f9318a..000000000000 --- a/engines/avalanche/stars.cpp +++ /dev/null @@ -1,626 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Demonstration of the Bigo II system. */ -/* $I c:\sleep5\DSMI.INC*/ -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Rodent.h"*/ -/*#include "Tommys.h"*/ - -namespace Avalanche { - -integer gd, gm; - -typedef matrix < '\0', '\377', 0, 15, byte > fonttype; - -boolean reverse; -word spinnum; -array<0, 1, fonttype> f; -file ff; -array<0, 7, 0, 15, 0, 79, byte> strip; -byte across; -word w; -byte y; -byte charnum; -byte cfont; /* current font. 0=roman, 1=italic. */ - -char *c; - -boolean nomusic; - -const integer colours = 12; /* Run Workout to see possible values of these two. */ -const integer steps = 6; /* 60,30,20,15,12,10,6,5,4,3,2,1 */ -const integer gmtop = 360 / steps; - -const integer scardcount = 13; - -const array < 0, scardcount - 1, integer > soundcards = -{{1, 2, 6, 3, 4, 5, 8, 9, 10, 7, 7, 7, 7}}; - -/*$L credits.obj*/ extern void credits(); - -void bigo2(string date) { - integer gd, gm; - byte c; - palettetype p; - untyped_file f; - pointer pp; - word s; - - - getpalette(p); - setvisualpage(1); - setactivepage(0); - assign(f, "logo.avd"); - reset(f, 1); - for (gd = 7; gd <= 194; gd ++) - blockread(f, mem[0xa000 * (gd * 80)], 53); - close(f); - s = imagesize(0, 7, 415, 194); - getmem(pp, s); - getimage(0, 7, 415, 194, pp); - - cleardevice(); - for (gd = 1; gd <= 64; gd ++) { - for (gm = 0; gm <= gmtop; gm ++) { - c = (c % colours) + 1; - /* putpixel(trunc(sin(gm*steps*n)*gd*6)+320, - trunc(cos(gm*steps*n)*gd*3)+175,c); */ - if (c > 5) continue_; - setcolor(c); - arc(320, 175, gm * steps, gm * steps + 1, gd * 6); - } - if (keypressed()) { - closegraph(); - exit(0); - } - } - settextstyle(0, 0, 1); - setcolor(13); - outtextxy(550, 343, "(press any key)"); - - putimage(112, 0, pp, orput); - freemem(pp, s); - resetmouse; - setvisualpage(0); -} - -void nextchar() { /* Sets up charnum & cline for the next character. */ - - c += 1; -} - -void getchar() { - do { - nextchar(); - - switch (*c) { - case '@': { - cfont = 1; - nextchar(); - } - break; - case '^': { - cfont = 0; - nextchar(); - } - break; - case '%': - if (nomusic) { - closegraph(); - exit(0); /* End of text and no music => stop. */ - } else c = addr(credits()); - break; /* End of test, but still playing => again. */ - } - - } while (!((*c != '\15') && (*c != '\12'))); - - for (w = 0; w <= 7; w ++) - for (y = 0; y <= 15; y ++) - move(strip[w][y][1], strip[w][y][0], 79); - - for (w = 0; w <= 7; w ++) - for (y = 0; y <= 15; y ++) - strip[w][y][79] = (byte)((strip[7][y][78] << (w + 1))) + - ((cardinal)f[cfont][*c][y] >> (7 - w)); - - across = 0; -} - -void scrolltext() { - byte c, w, y; - - across += 1; - if (across == 8) getchar(); - - for (y = 0; y <= 15; y ++) - for (w = 0; w <= 1; w ++) - move(strip[across][y][0], mem[0xa000 * 24000 + (y * 2 + w) * 80], 80); -} - -void do_stuff() { - switch (spinnum) { - case 50 ... 110: { - setfillstyle(1, 14); - bar(0, 315 + (spinnum - 50) / 3, 640, 315 + (spinnum - 50) / 3); - bar(0, 316 - (spinnum - 50) / 3, 640, 316 - (spinnum - 50) / 3); - if (spinnum > 56) { - setfillstyle(1, 13); - bar(0, 315 + (spinnum - 56) / 3, 640, 315 + (spinnum - 56) / 3); - bar(0, 316 - (spinnum - 56) / 3, 640, 316 - (spinnum - 56) / 3); - } - } - break; - case 150 ... 198: { - setfillstyle(1, 0); - bar(0, 315 + (spinnum - 150) / 3, 640, 315 + (spinnum - 150) / 3); - bar(0, 316 - (spinnum - 150) / 3, 640, 316 - (spinnum - 150) / 3); - } - break; - case 200: - scrolltext(); - break; - } -} - -void setcol(byte which, byte what) -/*var dummy:byte;*/ -{ - /* setpalette(which,what); - asm - (* mov dx,$3DA; - in ax,dx; - - or ah,ah; - - mov dx,$3C0; - mov al,which; - out dx,al; - - mov dx,$3C0; - mov al,what; - out dx,al; - end; - (* dummy:=port[$3DA]; - port[$3C0]:=which; port[$3C0]:=what;*/ -} - -void bigo2go() { - palettetype p; - byte c; - boolean lmo; - boolean altnow, altbefore; - - for (gd = 0; gd <= 13; gd ++) p.colors[gd] = 0; - - setcol(13, 24); /* murk */ setcol(14, 38); /* gold */ - setcol(15, egawhite); /* white- of course */ - p.colors[13] = 24; - p.colors[14] = 38; - p.colors[15] = egawhite; - - /***/ - - p.colors[5] = egawhite; - p.colors[4] = egalightcyan; - p.colors[3] = egacyan; - p.colors[2] = egalightblue; - p.colors[1] = egablue; - - /***/ - - c = 1; - p.size = 16; - lmo = false; - setallpalette(p); - - do { - /* if reverse then - begin - dec(c); if c=0 then c:=colours; - end else - begin - inc(c); if c>colours then c:=1; - end; - for gm:=1 to colours do - case p.colors[gm] of - egaWhite: begin p.colors[gm]:=egaLightcyan; setcol(gm,egaLightCyan); end; - egaLightcyan: begin p.colors[gm]:=egaCyan; setcol(gm,egaCyan); end; - egaCyan: begin p.colors[gm]:=egaLightblue; setcol(gm,egaLightblue); end; - egaLightblue: begin p.colors[gm]:=egaBlue; setcol(gm,egaBlue); end; - egaBlue: begin p.colors[gm]:=0; setcol(gm,0); end; - end; - p.colors[c]:=egaWhite; setcol(c,egaWhite); - - AltBefore:=AltNow; AltNow:=testkey(sAlt);*/ - - if (anymousekeypressed) lmo = true; - if (keypressed()) lmo = true; - if ((! nomusic) && (ampgetmodulestatus != md_playing)) lmo = true; - - /* if (AltNow=True) and (AltBefore=False) then reverse:=not reverse;*/ - - do_stuff(); - if (spinnum < 200) spinnum += 1; - } while (!lmo); -} - -void parse_cline() { - integer e; - - if (paramstr(1) != "jsb") { - output << "Not a standalone program." << NL; - exit(255); - } -} - -integer getsoundhardware(psoundcard scard) { - integer sc, i, autosel, select; - char ch; - integer e; - - - - integer getsoundhardware_result; -Lagain: - sc = detectgus(scard); - if (sc != 0) sc = detectpas(scard); - if (sc != 0) sc = detectaria(scard); - if (sc != 0) sc = detectsb(scard); - - /* if no sound card found, zero scard */ - if (sc != 0) fillchar(scard, sizeof(tsoundcard), 0); - - autosel = -1; - /* if sc=0 then - for i:=0 to scardcount-1 do - if scard^.ID=soundcards[i].ID then begin - { Set auto selection mark } - autosel:=i+1; - break; - end;*/ - - /* Print the list of sound cards */ - - val(paramstr(13), select, e); - - /* Default entry? */ - if (select == 0) select = autosel; - if (select != autosel) { - /* clear all assumptions */ - sc = -1; - fillchar(scard, sizeof(tsoundcard), 0); - scard->id = soundcards[select - 1]; /* set correct ID */ - } - - /* Query I/O address */ - if (scard->id == id_dac) scard->ioport = 0x378; - - /* Read user input */ - val(paramstr(15), i, e); - - if (i != 0) scard->ioport = i; - if (sc != 1) /* Not autodetected */ - switch (scard->id) { - case id_sb16: - case id_pas16: - case id_wss: - case id_aria: - case id_gus : - scard->samplesize = 2; - break; /* 16-bit card */ - case id_sbpro: - case id_pas: - case id_pasplus: - scard->stereo = true; - break; /* enable stereo */ - default: { - scard->samplesize = 1; - scard->stereo = false; - } - } - - if (scard->id != id_dac) { - val(paramstr(17), i, e); - - if (i != 0) scard->dmairq = i; - - val(paramstr(16), i, e); - - if (i != 0) scard->dmachannel = i; - } else { - /* Select correct DAC */ - scard->maxrate = 44100; - if (select == 11) { - scard->stereo = true; - scard->dmachannel = 1; /* Special 'mark' */ - scard->maxrate = 60000; - } else if (select == 12) { - scard->stereo = true; - scard->dmachannel = 2; - scard->maxrate = 60000; - if (scard->ioport == 0) scard->ioport = 0x378; - } else if (select == 13) { - scard->dmachannel = 0; - scard->ioport = 0x42; /* Special 'mark' */ - scard->maxrate = 44100; - } - } - - /* writeln('Your selection: ',select,' at ',scard^.ioPort, - ' using IRQ ',scard^.dmaIRQ,' and DMA channel ',scard^.dmaChannel); - readln;*/ - - getsoundhardware_result = 0; - return getsoundhardware_result; -} - -tsoundcard scard; -tmcpstruct mcpstrc; -tdds dds; -pmodule module; -tsdi_init sdi; -integer e, - bufsize; -char ch; -boolean v86, - vdsok; -longint a, rate, - tempseg; -string answer; -pointer temp; -word flags; -word curch; -byte modulevolume; -array<0, 4, tsampleinfo> sample; -array<0, 31, word> voltable; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - parse_cline(); - - nomusic = paramstr(13) == '0'; - - if (! nomusic) { - /* Read sound card information */ - if (getsoundhardware(&scard) == -1) exit(1); - - - /* Initialize Timer Service */ - tsinit; - atexit(&tsclose); - if (scard.id == id_gus) { - /* Initialize GUS player */ -#ifndef DPMI - scard.extrafield[2] = 1; /* GUS DMA transfer does not work in V86 */ -#endif - gusinit(&scard); - atexit(&gusclose); - - /* Initialize GUS heap manager */ - gushminit; - - /* Init CDI */ - cdiinit; - - /* Register GUS into CDI */ - cdiregister(&cdi_gus, 0, 31); - - /* Add GUS event player engine into Timer Service */ - tsaddroutine(&gusinterrupt, gus_timer); - } else { - /* Initialize Virtual DMA Specification */ -#ifndef DPMI - vdsok = vdsinit == 0; -#else - vdsok = false; -#endif - - fillchar(mcpstrc, sizeof(tmcpstruct), 0); - - /* Query for sampling rate */ - val(paramstr(14), a, e); - if (a > 4000) rate = a; - else rate = 21000; - - /* Query for quality */ - mcpstrc.options = mcp_quality; - - switch (scard.id) { - case id_sb : { - sdi = sdi_sb; - scard.maxrate = 22000; - } - break; - case id_sbpro : { - sdi = sdi_sbpro; - scard.maxrate = 22000; - } - break; - case id_pas: - case id_pasplus: - case id_pas16 : { - sdi = sdi_pas; - scard.maxrate = 44100; - } - break; - case id_sb16 : { - sdi = sdi_sb16; - scard.maxrate = 44100; - } - break; - case id_aria : { - sdi = sdi_aria; - scard.maxrate = 44100; - } - break; - case id_wss : { - sdi = sdi_wss; - scard.maxrate = 48000; - } - break; -#ifndef DPMI - case id_dac : - sdi = sdi_dac; - break; /* Only available in real mode */ -#endif - } - - mcpinitsounddevice(sdi, &scard); - a = mcp_tablesize; - mcpstrc.reqsize = 0; - - /* Calculate mixing buffer size */ - bufsize = (longint)(2800 * (integer)(scard.samplesize) << (byte)(scard.stereo)) * - (longint)(rate) / (longint)(22000); - mcpstrc.reqsize = 0; - if ((mcpstrc.options & mcp_quality) > 0) - if (scard.samplesize == 1) a += mcp_qualitysize; - else - a = mcp_tablesize16 + mcp_qualitysize16; - if ((longint)(bufsize) + (longint)(a) > 65500) bufsize = longint(65500) - a; - -#ifdef DPMI - dpmiversion((byte)(e), (byte)(e), (byte)(e), flags); - v86 = (flags & 2) == 0; -#endif - - /* Allocate volume table + mixing buffer */ -#ifdef DPMI - - /* In the V86 mode, the buffer must be allocated below 1M */ - if (v86) { - tempseg = 0; - dpmiallocdos((a + longint(bufsize)) / longint(16) + longint(1), flags, (word)(tempseg)); - } else { -#endif - getmem(temp, a + longint(bufsize)); - if (temp == nil) exit(2); -#ifdef DPMI - tempseg = seg(temp); - } -#else - tempseg = seg(temp) + ofs(temp) / 16 + 1; -#endif - mcpstrc.bufferseg = tempseg; - mcpstrc.bufferphysical = -1; - - if (vdsok && (scard.id != id_dac)) { - dds.size = bufsize; - dds.segment = tempseg; - dds.offset = 0; - - /* Lock DMA buffer if VDS present */ - if (vdslockdma(&dds) == 0) mcpstrc.bufferphysical = dds.address; - } - if (mcpstrc.bufferphysical == -1) -#ifdef DPMI - mcpstrc.bufferphysical = dpmigetlinearaddr(tempseg); -#else - mcpstrc.bufferphysical = (longint)(tempseg) << 4; -#endif - - mcpstrc.buffersize = bufsize; - mcpstrc.samplingrate = rate; - /* Initialize Multi Channel Player */ - if (mcpinit(&mcpstrc) != 0) exit(3); - atexit(&mcpclose); - - /* Initialize Channel Distributor */ - cdiinit; - - /* Register MCP into CDI*/ - cdiregister(&cdi_mcp, 0, 31); - } - - /* Try to initialize AMP */ - if (ampinit(0) != 0) exit(3); - atexit(&close); - - /* Hook AMP player routine into Timer Service */ - tsaddroutine(&interrupt, amp_timer); - -#ifndef DPMI - /* If using DAC, then adjust DAC timer */ - if (scard.id == id_dac) setdactimer(tsgettimerrate); -#endif - - if (scard.id != id_gus) mcpstartvoice; - else gusstartvoice; - - /* Load an example AMF */ - module = amploadmod("avalot2.mod", 0); - if (module == nil) exit(4); - - /* Is it MCP, Quality mode and 16-bit card? */ - if ((scard.id != id_gus) && ((mcpstrc.options & mcp_quality) > 0) - && (scard.samplesize == 2)) { - /* Open module+2 channels with amplified volumetable (4.7 gain) */ - for (a = 1; a <= 32; a ++) voltable[a - longint(1)] = a * longint(150) / longint(32); - cdisetupchannels(0, module->channelcount + 2, &voltable); - } else { - /* Open module+2 channels with regular volumetable */ - cdisetupchannels(0, module->channelcount + 2, nil); - } - - curch = module->channelcount; - modulevolume = 64; - - /***/ ampplaymodule(module, 0); - } - - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - assign(ff, "avalot.fnt"); - reset(ff); - ff >> f[0]; - close(ff); - assign(ff, "avitalic.fnt"); - reset(ff); - ff >> f[1]; - close(ff); - - c = addr(credits()); - c -= 1; - - fillchar(strip, sizeof(strip), '\0'); - reverse = false; - spinnum = 0; - across = 7; - charnum = 1; - cfont = 0; - bigo2("1189"); /* 1189? 79? 2345? 1967? */ - bigo2go(); - - if (! nomusic) ampstopmodule; - closegraph(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/status.cpp b/engines/avalanche/status.cpp deleted file mode 100644 index e81f09229429..000000000000 --- a/engines/avalanche/status.cpp +++ /dev/null @@ -1,70 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer gd, gm; - -void data(integer y, string a, string b) { - setcolor(1); - settextjustify(2, 0); - outtextxy(315, y, a + ':'); - setcolor(0); - settextjustify(0, 0); - outtextxy(325, y, b); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\turbo"); - setcolor(1); - setfillstyle(1, 7); - bar(0, 0, 640, 200); - settextstyle(1, 0, 0); - setusercharsize(10, 4, 8, 6); - settextjustify(1, 1); - outtextxy(317, 20, "Status Screen"); - settextstyle(0, 0, 1); - data(60, "Current game", "NoName.ASG"); - data(70, "Saved?", "Yes"); - data(90, "Current town", "Thurringham"); - data(100, "Score", "177"); - data(110, "Cash", "1/-"); - data(130, "Game", "Lord Avalot D'Argent"); - data(140, "Version", "1.00 (beta)"); - data(150, "Registered to", "Unregistered!"); - data(160, "Number", "nix"); - data(177, "Bios/keyboard", "AT (enhanced)"); /* or XT (bog standard) */ - data(187, "Display", "VGA"); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.cpp b/engines/avalanche/sticks.cpp deleted file mode 100644 index 6b7965afc11b..000000000000 --- a/engines/avalanche/sticks.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - STICKS The joystick handler. */ - -#define __sticks_implementation__ - - -#include "sticks.h" - -namespace Avalanche { - -enum lmc {l, m, r, last_lmc}; /* Left, middle & right */ - -file jf; - -byte joyway(); - - -static lmc getlmc(word n, word max, word min) { - lmc getlmc_result; - if (n < min) getlmc_result = l; - else if (n > max) getlmc_result = r; - else - getlmc_result = m; - return getlmc_result; -} - -byte joyway() { - word x, y; - lmc xx, yy; - byte joyway_result; - if (~ dna.user_moves_avvy) return joyway_result; - if (use_joy_a) readjoya(x, y); - else readjoyb(x, y); - - { - xx = getlmc(x, cxmax, cxmin); - yy = getlmc(y, cymax, cymin); - } - - switch (xx) { - case l: - switch (yy) { - case l: - joyway_result = ul; - break; - case m: - joyway_result = left; - break; - case r: - joyway_result = dl; - break; - } - break; - case m: - switch (yy) { - case l: - joyway_result = up; - break; - case m: - joyway_result = stopped; - break; - case r: - joyway_result = down; - break; - } - break; - case r: - switch (yy) { - case l: - joyway_result = ur; - break; - case m: - joyway_result = right; - break; - case r: - joyway_result = dr; - break; - } - break; - } - return joyway_result; -} - -void joykeys() -/* The 2 joystick keys may be reprogrammed. This parses them. */ -{ - byte v; - if (use_joy_a) { - v = (byte)(buttona1); - v += (byte)(buttona2) * 2; - } else { - v = (byte)(buttonb1); - v += (byte)(buttonb2) * 2; - } - - switch (v) { - case 0: - return; - break; /* No buttons pressed. */ - case 1: - opendoor; - break; /* Button 1 pressed: open door. */ - /* 2: blip; { Button 2 pressed: nothing (joylock?). }*/ - case 2: - case 3: - lookaround; - break; /* Both buttons pressed: look around. */ - } -} - -/* No init code. */ - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sticks.h b/engines/avalanche/sticks.h deleted file mode 100644 index fef3464d22da..000000000000 --- a/engines/avalanche/sticks.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __sticks_h__ -#define __sticks_h__ - - -/*#include "Joystick.h"*/ -/*#include "Acci.h"*/ -/*#include "Gyro.h"*/ -/* for solidarity */ - -namespace Avalanche { - -byte joyway(); -void joykeys(); - -#endif - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/sunrise.cpp b/engines/avalanche/sunrise.cpp deleted file mode 100644 index f5e1f35fefa6..000000000000 --- a/engines/avalanche/sunrise.cpp +++ /dev/null @@ -1,91 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -integer gd, gm; -longint tskellern /*absolute $0:244*/; /* Over int $61 */ - -void hold() { - do { - } while (!(tskellern >= 1)); - tskellern = 0; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, "c:\\bp\\bgi"); - - setvisualpage(1); - setfillstyle(1, 1); - for (gd = 1; gd <= 640; gd ++) - bar(gd, 177 + trunc(20 * sin((real)(gd) / 39)), gd, 350); - setfillstyle(1, 3); - setcolor(3); - fillellipse(320, 277, 60, 50); - settextjustify(1, 1); - settextstyle(0, 0, 2); - setcolor(9); - outtextxy(320, 50, "The sun rises over Hertfordshire..."); - settextjustify(2, 0); - settextstyle(0, 0, 1); - setcolor(0); - outtextxy(635, 350, "Press any key..."); - - setpalette(0, egablue); - setpalette(1, egagreen); - setpalette(2, egayellow); - setpalette(3, egagreen); - setpalette(9, egalightblue); - setpalette(11, egalightblue); - setvisualpage(0); - - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << 1; - port[0x3cf] = 1; - - for (gm = 227; gm >= 1; gm --) { /* <<< try running this loop the other way round! */ - move(mem[0xa000 * gm * 80 + 80], mem[0xa000 * gm * 80], 8042); - hold(); - if (keypressed()) return 0; - } - - for (gm = 101; gm >= 1; gm --) { - move(mem[0xa000 * 80], mem[0xa000 * 0], gm * 80); - hold(); - if (keypressed()) return 0; - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tempo.cpp b/engines/avalanche/tempo.cpp deleted file mode 100644 index 737433070734..000000000000 --- a/engines/avalanche/tempo.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; - -struct chunkblocktype { - union { - struct { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; - } s_true; - array<1, 14, byte> all; - }; -}; - - -byte screennum; -untyped_file f; - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void load() { - byte a /*absolute $A000:1200*/; - byte bit; - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void init() { - integer gd, gm; - output << "*** Tempo file creater ***" << NL; - output << "Enter place*.avd number:"; - input >> screennum >> NL; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(f, string("place") + strf(screennum) + ".avd"); - load(); - setactivepage(1); - setcolor(10); - outtextxy(0, 150, "CHUNK FILE: please don't change these codes! ->"); - setactivepage(0); -} - -void choose() { - integer x1, y1, xl, yl; - -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - init(); - choose(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test.cpp b/engines/avalanche/test.cpp deleted file mode 100644 index 016322fb677e..000000000000 --- a/engines/avalanche/test.cpp +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$M 2048,0,0*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -const array<1, 22, char> signature = string("*AVALOT* v1.00 tt ") + '\3' + '\0'; -pointer saveint1f; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1f, saveint1f); - setintvec(0x1f, &signature); - swapvectors; - exec("c:\\command.com", ""); - swapvectors; - setintvec(0x1f, saveint1f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/test2.cpp b/engines/avalanche/test2.cpp deleted file mode 100644 index 1452ff89fdcb..000000000000 --- a/engines/avalanche/test2.cpp +++ /dev/null @@ -1,45 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Dos.h"*/ - -namespace Avalanche { - -const array<1, 22, char> signature = string("*AVALOT* v1.00 tt ") + '\3' + '\0'; -pointer getint1f; -array<1, 22, char> x; -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - getintvec(0x1f, getint1f); - move(getint1f, x, 22); - if (x == signature) - output << "Signature found." << NL; - else output << "Signature NOT found!" << NL; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testblit.cpp b/engines/avalanche/testblit.cpp deleted file mode 100644 index ff2d38181538..000000000000 --- a/engines/avalanche/testblit.cpp +++ /dev/null @@ -1,80 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -const integer ttp = 81920; -const integer borland = xorput; -const integer mb1 = 2; /* 2 */ -const integer mb2 = 4; /* 4 */ - -integer gd, gm; -pointer p; -word s; - -void mblit() { - byte bit; - longint st; - st = ttp; - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = mb1; - portw[0x3ce] = copyput * 256 + 3; - portw[0x3ce] = 0x205; - port[0x3ce] = 0x8; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(mem[longint(0xa000)*st], mem[0xa000 * 0], 7200); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - settextstyle(1, 0, 7); - for (gd = 0; gd <= 1; gd ++) { - setactivepage(gd); - setcolor(6 * gd + 6); - outtextxy(0, 0, chr(65 + gd)); - } - s = imagesize(0, 0, 90, 90); - setactivepage(0); - getmem(p, s); - getimage(0, 0, 90, 90, p); - putimage(100, 100, p, 0); - setactivepage(1); - getimage(0, 0, 90, 90, p); - setactivepage(0); - putimage(100, 100, p, borland); - mblit(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testcard.cpp b/engines/avalanche/testcard.cpp deleted file mode 100644 index a0bcdc8fdd03..000000000000 --- a/engines/avalanche/testcard.cpp +++ /dev/null @@ -1,90 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Dos.h"*/ - -namespace Avalanche { - -integer gd, gm; -string filename; - -untyped_file f; -byte bit; -byte a /*absolute $A000:800*/; -searchrec r; - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - for (gd = 0; gd <= 14; gd ++) - for (gm = 0; gm <= 11; gm ++) { - setfillstyle(gm, gd + 1); - bar(gd * 43, gm * 12 + 10, 42 + gd * 43, gm * 12 + 21); - } - - output << NL; - output << NL; - output << NL; - output << NL; - - output << "Thorsoft testcard." << NL; - output << NL; - output << "Room number? "; - input >> filename >> NL; - - findfirst(string("place") + filename + ".avd", anyfile, r); - if (doserror == 0) { - output << "*** ALREADY EXISTS! CANCELLED! ***" << NL; - input >> NL; - exit(0); - } - - output << NL; - output << "*** Until this room is drawn, this screen is standing in for it. ***" << NL; - output << NL; - output << "Any other comments? "; - input >> NL; - - assign(f, string("place") + filename + ".avd"); - rewrite(f, 1); - blockwrite(f, gd, 177); /* just anything */ - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, a, 12080); - } - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/testenh.cpp b/engines/avalanche/testenh.cpp deleted file mode 100644 index 2ce1932d1e56..000000000000 --- a/engines/avalanche/testenh.cpp +++ /dev/null @@ -1,50 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Enhanced.h"*/ - -namespace Avalanche { - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - do { - readkeye; - switch (inchar) { - case '\0': - output << string('[') + extd + ']'; - break; - case '\340': - output << string('<') + extd + '>'; - break; - default: - output << inchar; - } - } while (!(inchar == '\33')); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.cpp b/engines/avalanche/timeout.cpp deleted file mode 100644 index 553d503d0d2a..000000000000 --- a/engines/avalanche/timeout.cpp +++ /dev/null @@ -1,699 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - TIMEOUT The scheduling unit. */ - -#define __timeout_implementation__ - - -#include "timeout.h" - - -#include "visa.h" -#include "lucerna.h" -#include "trip5.h" -#include "scrolls.h" -#include "sequence.h" -#include "pingo.h" -#include "Acci.h" -#include "enid.h" - -namespace Avalanche { - -byte fv; - -void set_up_timer(longint howlong, byte whither, byte why) { - fv = 1; - while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; - if (fv == 8) return; /* Oh dear... */ - - { - timetype &with = times[fv]; /* Everything's OK here! */ - - with.time_left = howlong; - with.then_where = whither; - with.what_for = why; - } -} - -void one_tick() { - - if (ddmnow) return; - - for (fv = 1; fv <= 7; fv ++) { - timetype &with = times[fv]; - if (with.time_left > 0) { - with.time_left -= 1; - - if (with.time_left == 0) - switch (with.then_where) { - case procopen_drawbridge : - open_drawbridge(); - break; - case procavaricius_talks : - avaricius_talks(); - break; - case procurinate : - urinate(); - break; - case proctoilet2 : - toilet2(); - break; - case procbang: - bang(); - break; - case procbang2: - bang2(); - break; - case procstairs: - stairs(); - break; - case proccardiffsurvey: - cardiff_survey(); - break; - case proccardiff_return: - cardiff_return(); - break; - case proc_cwytalot_in_herts: - cwytalot_in_herts(); - break; - case procget_tied_up: - get_tied_up(); - break; - case procget_tied_up2: - get_tied_up2(); - break; - case prochang_around: - hang_around(); - break; - case prochang_around2: - hang_around2(); - break; - case procafter_the_shootemup: - after_the_shootemup(); - break; - case procjacques_wakes_up: - jacques_wakes_up(); - break; - case procnaughty_duke: - naughty_duke(); - break; - case procnaughty_duke2: - naughty_duke2(); - break; - case procnaughty_duke3: - naughty_duke3(); - break; - case procjump: - jump(); - break; - case procsequence: - call_sequencer(); - break; - case proccrapulus_splud_out: - crapulus_says_splud_out(); - break; - case procdawn_delay: - dawn(); - break; - case procbuydrinks: - buydrinks(); - break; - case procbuywine: - buywine(); - break; - case proccallsguards: - callsguards(); - break; - case procgreetsmonk: - greetsmonk(); - break; - case procfall_down_oubliette: - fall_down_oubliette(); - break; - case procmeet_avaroid: - meet_avaroid(); - break; - case procrise_up_oubliette: - rise_up_oubliette(); - break; - case procrobin_hood_and_geida: - robin_hood_and_geida(); - break; - case procrobin_hood_and_geida_talk: - robin_hood_and_geida_talk(); - break; - case procavalot_returns: - avalot_returns(); - break; - case procavvy_sit_down: - avvy_sit_down(); - break; - case procghost_room_phew: - ghost_room_phew(); - break; - case procarkata_shouts: - arkata_shouts(); - break; - case procwinning: - winning(); - break; - case procavalot_falls: - avalot_falls(); - break; - case procspludwick_goes_to_cauldron: - spludwick_goes_to_cauldron(); - break; - case procspludwick_leaves_cauldron: - spludwick_leaves_cauldron(); - break; - case procgive_lute_to_geida: - give_lute_to_geida(); - break; - } - } - } - roomtime += 1; /* Cycles since you've been in this room. */ - dna.total_time += 1; /* Total amount of time for this game. */ -} - -void lose_timer(byte which) { - byte fv; - - for (fv = 1; fv <= 7; fv ++) { - timetype &with = times[fv]; - if (with.what_for == which) - with.time_left = 0; - } /* Cancel this one! */ -} - -/*function timer_is_on(which:byte):boolean; -var fv:byte; -begin - for fv:=1 to 7 do - with times[fv] do - if (what_for=which) and (time_left>0) then - begin - timer_is_on:=true; - exit; - end; - timer_is_on:=false; -end;*/ - -/* Timeout procedures: */ - -void open_drawbridge() { - { - dnatype &with = dna; - - with.drawbridge_open += 1; - show_one(with.drawbridge_open - 1); - - if (with.drawbridge_open == 4) - magics[2].op = nix; /* You may enter the drawbridge. */ - else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); - } -} - -/* --- */ - -void avaricius_talks() { - { - dnatype &with = dna; - - dixi('q', with.avaricius_talk); - with.avaricius_talk += 1; - - if (with.avaricius_talk < 17) - set_up_timer(177, procavaricius_talks, reason_avariciustalks); - else points(3); - - } -} - -void urinate() { - tr[1].turn(up); - stopwalking(); - showrw(); - set_up_timer(14, proctoilet2, reason_gototoilet); -} - -void toilet2() { - display("That's better!"); -} - -void bang() { - display("\6< BANG! >"); - set_up_timer(30, procbang2, reason_explosion); -} - -void bang2() { - display("Hmm... sounds like Spludwick's up to something..."); -} - -void stairs() { - blip(); - tr[1].walkto(4); - show_one(2); - dna.brummie_stairs = 2; - magics[11].op = special; - magics[11].data = 2; /* Reached the bottom of the stairs. */ - magics[4].op = nix; /* Stop them hitting the sides (or the game will hang.) */ -} - -void cardiff_survey() { - { - dnatype &with = dna; - - switch (with.cardiff_things) { - case 0: { - with.cardiff_things += 1; - dixi('q', 27); - } - break; - } - dixi('z', with.cardiff_things); - } - interrogation = dna.cardiff_things; - set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); -} - -void cardiff_return() { - dixi('q', 28); - cardiff_survey(); /* add end of question. */ -} - -void cwytalot_in_herts() { - dixi('q', 29); -} - -void get_tied_up() { - dixi('q', 34); /* ...Trouble! */ - dna.user_moves_avvy = false; - dna.been_tied_up = true; - stopwalking(); - tr[2].stopwalk(); - tr[2].stophoming(); - tr[2].call_eachstep = true; - tr[2].eachstep = procgrab_avvy; - set_up_timer(70, procget_tied_up2, reason_getting_tied_up); -} - -void get_tied_up2() { - tr[1].walkto(4); - tr[2].walkto(5); - magics[4].op = nix; /* No effect when you touch the boundaries. */ - dna.friar_will_tie_you_up = true; -} - -void hang_around() { - tr[2].check_me = false; - tr[1].init(7, true); /* Robin Hood */ - whereis[probinhood] = r__robins; - apped(1, 2); - dixi('q', 39); - tr[1].walkto(7); - set_up_timer(55, prochang_around2, reason_hanging_around); -} - -void hang_around2() { - dixi('q', 40); - tr[2].vanishifstill = false; - tr[2].walkto(4); - whereis[pfriartuck] = r__robins; - dixi('q', 41); - tr[1].done(); - tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ - - set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately - call the following proc (when you have a chance). */ - - dna.tied_up = false; - - back_to_bootstrap(1); /* Call the shoot-'em-up. */ -} - -void after_the_shootemup() { - byte shootscore, gain; - - tr[1].init(0, true); /* Avalot. */ - apped(1, 2); - dna.user_moves_avvy = true; - dna.obj[crossbow] = true; - objectlist(); - - shootscore = mem[storage_seg * storage_ofs]; - gain = (shootscore + 5) / 10; /* Rounding up. */ - - display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + - strf(shootscore) + " 10) = " + strf(gain) + " points."); - - if (gain > 20) { - display("But we won't let you have more than 20 points!"); - points(20); - } else - points(gain); - - dixi('q', 70); -} - -void jacques_wakes_up() { - dna.jacques_awake += 1; - - switch (dna.jacques_awake) { /* Additional pictures. */ - case 1 : { - show_one(1); /* Eyes open. */ - dixi('Q', 45); - } - break; - case 2 : { /* Going through the door. */ - show_one(2); /* Not on the floor. */ - show_one(3); /* But going through the door. */ - magics[6].op = nix; /* You can't wake him up now. */ - } - break; - case 3 : { /* Gone through the door. */ - show_one(2); /* Not on the floor, either. */ - show_one(4); /* He's gone... so the door's open. */ - whereis[pjacques] = 0; /* Gone! */ - } - break; - } - - - if (dna.jacques_awake == 5) { - dna.ringing_bells = true; - dna.ayles_is_awake = true; - points(2); - } - - switch (dna.jacques_awake) { - case RANGE_3(1, 3): - set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); - break; - case 4: - set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); - break; - } - -} - -void naughty_duke() -/* This is when the Duke comes in and takes your money. */ -{ - tr[2].init(9, false); /* Here comes the Duke. */ - apped(2, 1); /* He starts at the door... */ - tr[2].walkto(3); /* He walks over to you. */ - - /* Let's get the door opening. */ - - show_one(1); - first_show(2); - start_to_close(); - - set_up_timer(50, procnaughty_duke2, reason_naughty_duke); -} - -void naughty_duke2() { - dixi('q', 48); /* Ha ha, it worked again! */ - tr[2].walkto(1); /* Walk to the door. */ - tr[2].vanishifstill = true; /* Then go away! */ - set_up_timer(32, procnaughty_duke3, reason_naughty_duke); -} - -void naughty_duke3() { - show_one(1); - first_show(2); - start_to_close(); -} - -void jump() { - { - dnatype &with = dna; - - with.jumpstatus += 1; - - { - triptype &with1 = tr[1]; - switch (with.jumpstatus) { - case 1: - case 2: - case 3: - case 5: - case 7: - case 9: - with1.y -= 1; - break; - case 12: - case 13: - case 14: - case 16: - case 18: - case 19: - with1.y += 1; - break; - } - } - - if (with.jumpstatus == 20) { - /* End of jump. */ - dna.user_moves_avvy = true; - dna.jumpstatus = 0; - } else { - /* Still jumping. */ - set_up_timer(1, procjump, reason_jumping); - } - - if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ - && (dna.room == r__insidecardiffcastle) - && (dna.arrow_in_the_door == true) - && (infield(3))) { /* beside the wall*/ - /* Grab the arrow! */ - if (dna.carrying >= maxobjs) - display("You fail to grab it, because your hands are full."); - else { - show_one(2); - dna.arrow_in_the_door = false; /* You've got it. */ - dna.obj[bolt] = true; - objectlist(); - dixi('q', 50); - points(3); - } - } - } -} - -void crapulus_says_splud_out() { - dixi('q', 56); - dna.crapulus_will_tell = false; -} - -void buydrinks() { - show_one(11); /* Malagauche gets up again. */ - dna.malagauche = 0; - - dixi('D', ord(dna.drinking)); /* Display message about it. */ - wobble(); /* Do the special effects. */ - dixi('D', 1); /* That'll be thruppence. */ - if (pennycheck(3)) /* Pay 3d. */ - dixi('D', 3); /* Tell 'em you paid up. */ - have_a_drink(); -} - -void buywine() { - show_one(11); /* Malagauche gets up again. */ - dna.malagauche = 0; - - dixi('D', 50); /* You buy the wine. */ - dixi('D', 1); /* It'll be thruppence. */ - if (pennycheck(3)) { - dixi('D', 4); /* You paid up. */ - dna.obj[wine] = true; - objectlist(); - dna.winestate = 1; /* OK Wine */ - } -} - -void callsguards() { - dixi('Q', 58); /* GUARDS!!! */ - gameover(); -} - -void greetsmonk() { - dixi('Q', 59); - dna.entered_lusties_room_as_monk = true; -} - -void fall_down_oubliette() { - magics[9].op = nix; - tr[1].iy += 1; /* increments dx/dy! */ - tr[1].y += tr[1].iy; /* Dowwwn we go... */ - set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); -} - -void meet_avaroid() { - if (dna.met_avaroid) { - display("You can't expect to be \6that\22 lucky twice in a row!"); - gameover(); - } else { - dixi('Q', 60); - dna.met_avaroid = true; - set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - { - triptype &with = tr[1]; - with.face = left; - with.x = 151; - with.ix = -3; - with.iy = -5; - } - background(2); - } -} - -void rise_up_oubliette() { - { - triptype &with = tr[1]; - - with.visible = true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy > 0) - set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); - else - dna.user_moves_avvy = true; - } -} - -void robin_hood_and_geida() { - tr[1].init(7, true); - apped(1, 7); - tr[1].walkto(6); - tr[2].stopwalk(); - tr[2].face = left; - set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); - dna.geida_follows = false; -} - -void robin_hood_and_geida_talk() { - dixi('q', 66); - tr[1].walkto(2); - tr[2].walkto(2); - tr[1].vanishifstill = true; - tr[2].vanishifstill = true; - set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); -} - -void avalot_returns() { - tr[1].done(); - tr[2].done(); - tr[1].init(0, true); - apped(1, 1); - dixi('q', 67); - dna.user_moves_avvy = true; -} - -void avvy_sit_down() -/* This is used when you sit down in the pub in Notts. It loops around so - that it will happen when Avvy stops walking. */ -{ - if (tr[1].homing) /* Still walking */ - set_up_timer(1, procavvy_sit_down, reason_sitting_down); - else { - show_one(3); - dna.sitting_in_pub = true; - dna.user_moves_avvy = false; - tr[1].visible = false; - } -} - -void ghost_room_phew() { - display("\6PHEW!\22 You're glad to get out of \6there!"); -} - -void arkata_shouts() { - if (dna.teetotal) return; - dixi('q', 76); - set_up_timer(160, procarkata_shouts, reason_arkata_shouts); -} - -void winning() { - dixi('q', 79); - winning_pic(); - do { - checkclick(); - } while (!(mrelease == 0)); - callverb(vb_score); - display(" T H E E N D "); - lmo = true; -} - -void avalot_falls() { - if (tr[1].step < 5) { - tr[1].step += 1; - set_up_timer(3, procavalot_falls, reason_falling_over); - } else - display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); -} - -void spludwick_goes_to_cauldron() { - if (tr[2].homing) - set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); - else - set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); -} - -void spludwick_leaves_cauldron() { - tr[2].call_eachstep = true; /* So that normal procs will continue. */ -} - -void give_lute_to_geida() { /* Moved here from Acci. */ - dixi('Q', 86); - points(4); - dna.lustie_is_asleep = true; - first_show(5); - then_show(6); /* He falls asleep... */ - start_to_close(); /* Not really closing, but we're using the same procedure. */ -} - -/* "This is all!" */ - -class unit_timeout_initialize { -public: - unit_timeout_initialize(); -}; -static unit_timeout_initialize timeout_constructor; - -unit_timeout_initialize::unit_timeout_initialize() { - fillchar(times, sizeof(times), '\0'); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/timeout.h b/engines/avalanche/timeout.h deleted file mode 100644 index 8bb2f8798c8c..000000000000 --- a/engines/avalanche/timeout.h +++ /dev/null @@ -1,259 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __timeout_h__ -#define __timeout_h__ - - -#include "gyro.h" -#include "celer.h" - -namespace Avalanche { - -/* reason_ now runs between 1 and 28. */ - -const integer reason_drawbridgefalls = 2; -const integer reason_avariciustalks = 3; -const integer reason_gototoilet = 4; -const integer reason_explosion = 5; -const integer reason_brummiestairs = 6; -const integer reason_cardiffsurvey = 7; -const integer reason_cwytalot_in_herts = 8; -const integer reason_getting_tied_up = 9; -const integer reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ -const integer reason_jacques_waking_up = 11; -const integer reason_naughty_duke = 12; -const integer reason_jumping = 13; -const integer reason_sequencer = 14; -const integer reason_crapulus_says_spludwick_out = 15; -const integer reason_dawndelay = 16; -const integer reason_drinks = 17; -const integer reason_du_lustie_talks = 18; -const integer reason_falling_down_oubliette = 19; -const integer reason_meeting_avaroid = 20; -const integer reason_rising_up_oubliette = 21; -const integer reason_robin_hood_and_geida = 22; -const integer reason_sitting_down = 23; -const integer reason_ghost_room_phew = 1; -const integer reason_arkata_shouts = 24; -const integer reason_winning = 25; -const integer reason_falling_over = 26; -const integer reason_spludwalk = 27; -const integer reason_geida_sings = 28; - -/* PROCx now runs between 1 and 41. */ - -const integer procopen_drawbridge = 3; - -const integer procavaricius_talks = 4; - -const integer procurinate = 5; - -const integer proctoilet2 = 6; - -const integer procbang = 7; - -const integer procbang2 = 8; - -const integer procstairs = 9; - -const integer proccardiffsurvey = 10; - -const integer proccardiff_return = 11; - -const integer proc_cwytalot_in_herts = 12; - -const integer procget_tied_up = 13; - -const integer procget_tied_up2 = 1; - -const integer prochang_around = 14; - -const integer prochang_around2 = 15; - -const integer procafter_the_shootemup = 32; - -const integer procjacques_wakes_up = 16; - -const integer procnaughty_duke = 17; - -const integer procnaughty_duke2 = 18; - -const integer procnaughty_duke3 = 38; - -const integer procjump = 19; - -const integer procsequence = 20; - -const integer proccrapulus_splud_out = 21; - -const integer procdawn_delay = 22; - -const integer procbuydrinks = 23; - -const integer procbuywine = 24; - -const integer proccallsguards = 25; - -const integer procgreetsmonk = 26; - -const integer procfall_down_oubliette = 27; - -const integer procmeet_avaroid = 28; - -const integer procrise_up_oubliette = 29; - -const integer procrobin_hood_and_geida = 2; - -const integer procrobin_hood_and_geida_talk = 30; - -const integer procavalot_returns = 31; - -const integer procavvy_sit_down = 33; /* In Nottingham. */ - -const integer procghost_room_phew = 34; - -const integer procarkata_shouts = 35; - -const integer procwinning = 36; - -const integer procavalot_falls = 37; - -const integer procspludwick_goes_to_cauldron = 39; - -const integer procspludwick_leaves_cauldron = 40; - -const integer procgive_lute_to_geida = 41; - -struct timetype { - longint time_left; - byte then_where; - byte what_for; -}; - - -#ifdef __timeout_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, 7, timetype> times; -#undef EXTERN -#define EXTERN extern - - -void set_up_timer(longint howlong, byte whither, byte why); - -void one_tick(); - -void lose_timer(byte which); - -/*function timer_is_on(which:byte):boolean;*/ - -/* Procedures to do things at the end of amounts of time: */ - -void open_drawbridge(); - -void avaricius_talks(); - -void urinate(); - -void toilet2(); - -void bang(); - -void bang2(); - -void stairs(); - -void cardiff_survey(); - -void cardiff_return(); - -void cwytalot_in_herts(); - -void get_tied_up(); - -void get_tied_up2(); - -void hang_around(); - -void hang_around2(); - -void after_the_shootemup(); - -void jacques_wakes_up(); - -void naughty_duke(); - -void naughty_duke2(); - -void naughty_duke3(); - -void jump(); - -void crapulus_says_splud_out(); - -void buydrinks(); - -void buywine(); - -void callsguards(); - -void greetsmonk(); - -void fall_down_oubliette(); - -void meet_avaroid(); - -void rise_up_oubliette(); - -void robin_hood_and_geida(); - -void robin_hood_and_geida_talk(); - -void avalot_returns(); - -void avvy_sit_down(); - -void ghost_room_phew(); - -void arkata_shouts(); - -void winning(); - -void avalot_falls(); - -void spludwick_goes_to_cauldron(); - -void spludwick_leaves_cauldron(); - -void give_lute_to_geida(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/travel.cpp b/engines/avalanche/travel.cpp deleted file mode 100644 index 88bbce9a48e1..000000000000 --- a/engines/avalanche/travel.cpp +++ /dev/null @@ -1,89 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -integer gd, gm; - -void zoomout(integer x, integer y) { - integer x1, y1, x2, y2; - byte fv; - setcolor(white); - setwritemode(xorput); - setlinestyle(dottedln, 0, 1); - - for (fv = 1; fv <= 20; fv ++) { - x1 = x - (x / 20) * fv; - y1 = y - ((y - 10) / 20) * fv; - x2 = x + (((639 - x) / 20) * fv); - y2 = y + (((161 - y) / 20) * fv); - - rectangle(x1, y1, x2, y2); - delay(17); - rectangle(x1, y1, x2, y2); - } -} - -void zoomin(integer x, integer y) { - integer x1, y1, x2, y2; - byte fv; - setcolor(white); - setwritemode(xorput); - setlinestyle(dottedln, 0, 1); - - for (fv = 20; fv >= 1; fv --) { - x1 = x - (x / 20) * fv; - y1 = y - ((y - 10) / 20) * fv; - x2 = x + (((639 - x) / 20) * fv); - y2 = y + (((161 - y) / 20) * fv); - - rectangle(x1, y1, x2, y2); - delay(17); - rectangle(x1, y1, x2, y2); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - zoomout(177, 77); - zoomout(7, 31); - zoomout(577, 124); - zoomout(320, 85); - zoomin(177, 77); - zoomin(7, 31); - zoomin(577, 124); - zoomin(320, 85); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.cpp b/engines/avalanche/trip.cpp deleted file mode 100644 index 753db0dc6529..000000000000 --- a/engines/avalanche/trip.cpp +++ /dev/null @@ -1,217 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - TRIP The trippancy handler. (Trippancy 2) */ - -#define __trip_implementation__ - - -#include "trip.h" - - -#include "graph.h" -#include "gyro.h" -/*#include "Dos.h"*/ - -namespace Avalanche { - -/* */ -/* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ -/* (C) 1986 by Kent Cedola, 2015 Meadow Lake Ct., Norfolk, VA, 23518 */ -/* */ -/* Description: Write a array of colors in a vertical line. The current */ -/* merge setting is used to control the combining of bits. */ -/* */ -void gpwtcol(void *buf, integer n) { /* Cedola */ - ; /* - inline - ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ - GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ - $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ - $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ - $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ -} - - -void loadtrip() { - untyped_file inf; - assign(inf, "t:avvy.trp"); - reset(inf, 1); - seek(inf, 0x27); - blockread(inf, pozzes, sizeof(pozzes)); - blockread(inf, blue3, sizeof(blue3)); - close(inf); -} - -void plot(word count, integer ox, integer oy) { /* orig x & y. Page is always 1. */ - byte x, y, len; - do { - len = blue3[count]; - if (len == 177) return; - x = blue3[count + 1]; - y = blue3[count + 2]; - count += 3; - { - gdcur_x = x + ox; - gdcur_y = y + oy; - /* fiddle xy coords to match page 1 */ - gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ - if (gdcur_x < 0) { - gdcur_x += 640; - gdcur_y -= 1; - } - gpwtcol(&blue3[count], len); - count += len; - } - } while (!false); -} - -void boundscheck() { - if (dna.uy > 123) dna.uy = 123; - if (dna.uy < 10) dna.uy = 10; - if (dna.ux < 5) dna.ux = 5; - if (dna.ux > 600) dna.ux = 600; -} - -void budge() { - if (set::of(up, ul, ur, eos).has(dna.rw)) dna.uy -= 3; - if (set::of(down, dl, dr, eos).has(dna.rw)) dna.uy += 3; - if (set::of(left, ul, dl, eos).has(dna.rw)) dna.ux -= 5; - if (set::of(right, ur, dr, eos).has(dna.rw)) dna.ux += 5; - - boundscheck(); - - if (dna.rw > 0) { - anim += 1; - if (anim == 7) anim = 1; - } -} - -void tripkey(char dir) { - if (cw != 177) return; - { - dnatype &with = dna; - switch (dir) { - case 'H': - if (with.rw != up) { - with.rw = up; - ww = up; - } else with.rw = 0; - break; - case 'P': - if (with.rw != down) { - with.rw = down; - ww = down; - } else with.rw = 0; - break; - case 'K': - if (with.rw != left) { - with.rw = left; - ww = left; - } else with.rw = 0; - break; - case 'M': - if (with.rw != right) { - with.rw = right; - ww = right; - } else with.rw = 0; - break; - case 'I': - if (with.rw != ur) { - with.rw = ur; - ww = right; - } else with.rw = 0; - break; - case 'Q': - if (with.rw != dr) { - with.rw = dr; - ww = right; - } else with.rw = 0; - break; - case 'O': - if (with.rw != dl) { - with.rw = dl; - ww = left; - } else with.rw = 0; - break; - case 'G': - if (with.rw != ul) { - with.rw = ul; - ww = left; - } else with.rw = 0; - break; - } - if (with.rw == 0) { - ux = ppos[0][0]; - uy = ppos[0][1]; - anim -= 1; - if (anim == 0) anim = 6; - } - } -} - -void trippancy() { - if ((dna.rw == 0) || (cw != 177) || (! dropsok)) return; - r.ax = 11; - intr(0x33, r); - setactivepage(1); - off(); - if (ppos[0][1] != -177) { - putimage(ppos[0][0], ppos[0][1], replace[0], 0); - } - - getimage(dna.ux, dna.uy, dna.ux + xw, dna.uy + yw, replace[0]); - ppos[0][0] = dna.ux; - ppos[0][1] = dna.uy; - - plot(pozzes[anim * 4 + dna.ww - 4], dna.ux, dna.uy); - - { - void &with = r; - if ((cx == 0) && (dx == 0)) on(); - } - getimage(dna.ux - margin, dna.uy - margin, dna.ux + xw + margin, dna.uy + yw + margin, copier); - setactivepage(0); - off(); - putimage(dna.ux - margin, dna.uy - margin, copier, 0); - on(); - - { - void &with = mouths[0]; ; - x = dna.ux + 20; - y = dna.uy; - } - - budge(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip.h b/engines/avalanche/trip.h deleted file mode 100644 index 0e5571715847..000000000000 --- a/engines/avalanche/trip.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __trip_h__ -#define __trip_h__ - -namespace Avalanche { - -void loadtrip(); - -void plot(word count, integer ox, integer oy); - -void boundscheck(); - -void budge(); - -void tripkey(char dir); - -void trippancy(); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/trip3.cpp b/engines/avalanche/trip3.cpp deleted file mode 100644 index 33f2859c7e31..000000000000 --- a/engines/avalanche/trip3.cpp +++ /dev/null @@ -1,343 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#define __trip3_implementation__ -/* Project Minstrel- Trippancy routines */ - -#include "trip3.h" - - -#include "Graph.h" -/*#include "Crt.h"*/ - -/*$S+*/ - -namespace Avalanche { - -const integer avvy = 1; -const integer test = 177; - -struct triprec { - byte handle; /* who is it? */ - integer x, y; /* current x&y */ - byte xm, ym; /* x&y margins */ - shortint ix, iy; /* inc x&y */ - byte stage; /* animation */ - integer xl, yl; /* x&y length */ - boolean prime; /* true on first move */ - boolean alive; /* true if it moves */ -}; - -array<1, 10, triprec> tr; -byte tramt; -array<1, 20000, byte> blue3; -array<1, 24, word> pozzes; - -const integer up = 1; -const integer right = 2; -const integer down = 3; -const integer left = 4; -const integer ur = 5; -const integer dr = 6; -const integer dl = 7; -const integer ul = 8; - -/* */ -/* EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. */ -/* (C) 1986 by Kent Cedola, 2015 Meadow Lake Ct., Norfolk, VA, 23518 */ -/* */ -/* Description: Write a array of colors in a vertical line. The current */ -/* merge setting is used to control the combining of bits. */ -/* */ -void gpwtcol(void *buf, integer n) { /* Cedola */ - /* inline - ($1E/$A1/GDCUR_Y/$D1/$E0/$D1/$E0/$03/$06/GDCUR_Y/$05/$A000/$8E/$C0/$8B/$3E/ - GDCUR_X/$8B/$CF/$D1/$EF/$D1/$EF/$D1/$EF/$BA/$03CE/$8A/$26/GDMERGE/$B0/$03/ - $EF/$B8/$0205/$EF/$B0/$08/$EE/$42/$B0/$80/$80/$E1/$07/$D2/$C8/$EE/$8B/$4E/ - $04/$C5/$76/$06/$8A/$24/$46/$26/$8A/$1D/$26/$88/$25/$83/$C7/$50/$E2/$F2/ - $B0/$FF/$EE/$4A/$B8/>$05/$EF/$B8/>$03/$EF/$1F); */ -} - - -void loadtrip() { - untyped_file inf; - assign(inf, "t:avvy.trp"); - reset(inf, 1); - seek(inf, 0x27); - blockread(inf, pozzes, sizeof(pozzes)); - blockread(inf, blue3, sizeof(blue3)); - close(inf); -} - -void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byte mmx, byte mmy, byte st) { - tramt += 1; - { - triprec &with = tr[tramt]; - with.handle = what_handle; - with.ix = 0; - with.iy = 0; - with.x = xx; - with.y = yy; - with.xl = lx; - with.yl = ly; - with.xm = mmx; - with.ym = mmy; - with.stage = st; - with.prime = true; - with.alive = true; - } -} - -void plot(byte stage, integer ox, integer oy) { /* orig x & y. Page is always 1/UNSEEN. */ - byte x, y, len; - word count; - count = pozzes[stage]; - do { - len = blue3[count]; - if (len == 177) return; - x = blue3[count + 1]; - y = blue3[count + 2]; - count += 3; - { - gdcur_x = x + ox; - gdcur_y = y + oy; - /* fiddle xy coords to match page 1 */ - gdcur_y += 205; /* 203 */ gdcur_x -= 128; /* 114 */ - if (gdcur_x < 0) { - gdcur_x += 640; - gdcur_y -= 1; - } - gpwtcol(&blue3[count], len); - count += len; - } - } while (!false); -} - -void trippancy() { - byte fv; - pointer p, saved1, saved2; - word s; - array<1, 10, pointer> q; - boolean allstill; - if ((cw != 177) || (! dropsok) || keypressed()) return; - - /* Do the Avvy Walk */ - - switch (dna.rw) { - case up: - budge(avvy, 0, -3, anim * 4 - 3); - break; - case down: - budge(avvy, 0, 3, anim * 4 - 1); - break; - case right: - budge(avvy, 5, 0, anim * 4 - 2); - break; - case left: - budge(avvy, -5, 0, anim * 4); - break; - case ul: - budge(avvy, -5, -3, anim * 4); - break; - case dl: - budge(avvy, -5, 3, anim * 4); - break; - case ur: - budge(avvy, 5, -3, anim * 4 - 2); - break; - case dr: - budge(avvy, 5, 3, anim * 4 - 2); - break; - } - - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - boundscheck(with.x, with.y, with.xm, with.ym); - } - - allstill = true; - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - if (((with.alive) && (!((with.ix == 0) && (with.iy == 0)))) || with.prime) allstill = false; - } - if (allstill) return; - - if (dna.rw > 0) { - anim += 1; - if (anim == 7) anim = 1; - } - - /* Trippancy Step 1 - Grab moon array of unmargined sprites (phew) */ - mark(saved1); - setactivepage(1); - off(); - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); - getmem(q[fv], s); - getimage(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym, q[fv]); - } - /* Step 2 - Plot sprites on 1/UNSEEN */ - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - plot(with.stage, with.x, with.y); - } - /* Step 3 - Copy all eligible from 1/UNSEEN to 0/SEEN */ - mark(saved2); - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - if (((with.alive) && (!((with.ix == 0) && (with.iy == 0)))) || with.prime) { - s = imagesize(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym); - getmem(p, s); - setactivepage(1); - getimage(with.x - with.xm, with.y - with.ym, with.x + with.xl + with.xm, with.y + with.yl + with.ym, p); - setactivepage(0); - putimage(with.x - with.xm, with.y - with.ym, p, 0); - release(saved2); - with.prime = false; - } - } - /* Step 4 - Unplot sprites from 1/UNSEEN */ - setactivepage(1); - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - putimage(with.x - with.xm, with.y - with.ym, q[fv], 0); - if (with.ix != 0) with.x = with.x + with.ix; - if (with.iy != 0) with.y = with.y + with.iy; - with.ix = 0; - with.iy = 0; - if (with.handle == avvy) { - dnatype &with1 = dna; ; - ux = with.x; - uy = with.y; - } - } - on(); - release(saved1); - for (fv = 1; fv <= tramt; fv ++) { /* synch xy coords of mouths */ - triprec &with = tr[fv]; - mouths[fv].x = with.x + 20; - mouths[fv].y = with.y; - } - - setactivepage(0); -} - -void budge(byte who, shortint xx, shortint yy, byte frame) { /* Moving & animation controller */ - byte fv; - for (fv = 1; fv <= tramt; fv ++) { - triprec &with = tr[fv]; - if (with.handle == who) { - with.ix = xx; - with.iy = yy; - with.stage = frame; - } - } -} - -void tripkey(char dir) { - if (cw != 177) return; - { - dnatype &with = dna; - switch (dir) { - case 'H': - if (with.rw != up) { - with.rw = up; - ww = up; - } else with.rw = 0; - break; - case 'P': - if (with.rw != down) { - with.rw = down; - ww = down; - } else with.rw = 0; - break; - case 'K': - if (with.rw != left) { - with.rw = left; - ww = left; - } else with.rw = 0; - break; - case 'M': - if (with.rw != right) { - with.rw = right; - ww = right; - } else with.rw = 0; - break; - case 'I': - if (with.rw != ur) { - with.rw = ur; - ww = right; - } else with.rw = 0; - break; - case 'Q': - if (with.rw != dr) { - with.rw = dr; - ww = right; - } else with.rw = 0; - break; - case 'O': - if (with.rw != dl) { - with.rw = dl; - ww = left; - } else with.rw = 0; - break; - case 'G': - if (with.rw != ul) { - with.rw = ul; - ww = left; - } else with.rw = 0; - break; - } - if (with.rw == 0) { - ux = ppos[0][0]; - uy = ppos[0][1]; - anim -= 1; - if (anim == 0) anim = 6; - } - } -} - -void boundscheck(integer &x, integer &y, byte xm, byte ym) { - if (y > 127 - ym) y = 127 - ym; - if (y < ym + 10) y = ym + 10; - if (x < xm) x = xm; - if (x > 640 - xm) x = 640 - xm; -} - -class unit_trip3_initialize { -public: - unit_trip3_initialize(); -}; -static unit_trip3_initialize trip3_constructor; - -unit_trip3_initialize::unit_trip3_initialize() { - ; /* init portion of Trip3 */ - tramt = 0; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip3.h b/engines/avalanche/trip3.h deleted file mode 100644 index 01428081d6dd..000000000000 --- a/engines/avalanche/trip3.h +++ /dev/null @@ -1,50 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __trip3_h__ -#define __trip3_h__ - - -#include "gyro.h" - -namespace Avalanche { - -void loadtrip(); - -void boundscheck(integer &x, integer &y, byte xm, byte ym); - -void budge(byte who, shortint xx, shortint yy, byte frame); /* Moving & animation controller */ - -void tripkey(char dir); - -void trippancy(); - -void enter(byte what_handle, integer xx, integer yy, integer lx, integer ly, byte mmx, byte mmy, byte st); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/trip42.cpp b/engines/avalanche/trip42.cpp deleted file mode 100644 index 29482dcd24dc..000000000000 --- a/engines/avalanche/trip42.cpp +++ /dev/null @@ -1,597 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - TRIP42 Trippancy IV point 2 - "Trip Oop 2" */ - -#define __trip42_implementation__ -/* Trippancy IV.2 (Trip Oop) */ -#include "trip42.h" - - -/*#include "Scrolls.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Dropdown.h"*/ -/*#include "Access.h"*/ - -namespace Avalanche { - -/*procedure copier(x1,y1,x2,y2,x3,y3,x4,y4:integer); - - function dropin(xc,yc,x1,y1,x2,y2:integer):boolean; - { Dropin returns True if the point xc,yc falls within the 1-2 rectangle. } - begin; - dropin:=((xc>=x1) and (xc<=x2) and (yc>=y1) and (yc<=y2)); - end; - - function lesser(a,b:integer):integer; - begin; - if ab then greater:=a else greater:=b; - end; - -begin; - if dropin(x3,y3,x1,y1,x2,y2) - or dropin(x3,y4,x1,y1,x2,y2) - or dropin(x4,y3,x1,y1,x2,y2) - or dropin(x4,y4,x1,y1,x2,y2) then - begin; { Overlaps } - mblit(lesser(x1,x3),lesser(y1,y3),greater(x2,x4),greater(y2,y4),1,0); - end else - begin; { Doesn't overlap- copy both of them seperately } - mblit(x3,y3,x4,y4,1,0); { backwards- why not...? } - mblit(x1,y1,x2,y2,1,0); - end; -end; */ - -void loadtrip() { - byte gm; - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); - tr[1].init(0); -} - -byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { - byte a, c; - integer fv, ff; - byte checkfeet_result; - a = 0; - setactivepage(2); - if (x1 < 0) x1 = 0; - if (x2 > 639) x2 = 639; - if (oy < y) - for (fv = x1; fv <= x2; fv ++) - for (ff = oy + yl; ff <= y + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - else - for (fv = x1; fv <= x2; fv ++) - for (ff = y + yl; ff <= oy + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - checkfeet_result = a; - setactivepage(1 - cp); - return checkfeet_result; -} - -void touchcol(byte tc); -static boolean bug; - -static void fr(byte a, byte b) { - fliproom(a, b); - bug = false; -} - -void touchcol(byte tc) { - bug = true; /* j.i.c. */ - switch (dna.room) { - case 1: - fr(2, 3); - break; - case 2: { - ; /* main corridor */ - switch (tc) { - case 1: - fr(3, 1); - break; /* to the other corridor */ - case 2: - fr(2, 1); - break; /* to this corridor! Fix this later... */ - } - } - break; - case 3: { - ; /* turn corridor */ - switch (tc) { - case 1: - fr(2, 1); - break; /* to the other corridor */ - case 2: - fr(12, 1); - break; /* through Spludwick's door */ - } - } - break; - case 12: - fr(3, 2); - break; - } - if (bug) { - display(string('\7') + "Unknown touchcolour (" + strf(tc) + ')' + " in " + strf(dna.room) - + '.'); - tr[1].bounce(); - } -} - -triptype *triptype::init(byte spritenum) { - integer gd, gm; - word s; - untyped_file f; - varying_string<2> xx; - byte sort, n; - word bigsize; - pointer p, q; - str(spritenum, xx); - assign(f, string("c:\\avalot\\sprite") + xx + ".avd"); - reset(f, 1); - seek(f, 59); - blockread(f, a, sizeof(a)); - blockread(f, bigsize, 2); - setactivepage(3); - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - blockread(f, p, bigsize); - off; - putimage(0, 0, p, 0); - release(q); - n = 1; - { - adxtype &with = a; - for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - getmem(pic[n][sort], a.size); /* grab the memory */ - getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, - (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, - pic[n][sort]); /* grab the pic */ - n += 1; - } - } /*on;*/ - } - close(f); - setactivepage(1 - cp); - - x = 0; - y = 0; - quick = true; - visible = false; - /* for x:=0 to 1 do getmem(behind[x],a.size);*/ - homing = false; - ix = 0; - iy = 0; - step = 0; - check_me = a.name == "Avalot"; - count = 0; - return this; -} - -void triptype::original() { - quick = false; -} - -void triptype::andexor() { - byte picnum; /* Picnum, Picnic, what ye heck */ - picnum = face * a.seq + step + 1; - off; - putimage(x, y, pic[picnum][0], andput); - putimage(x, y, pic[picnum][1], xorput); /*on;*/ -} - -void triptype::turn(byte whichway) { - if (whichway == 8) face = 0; - else face = whichway; -} - -void triptype::appear(integer wx, integer wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox[cp] = wx; - oy[cp] = wy; - turn(wf); - visible = true; - ix = 0; - iy = 0; -} - -void triptype::walk() { - byte tc; - fieldtype r; - { - x1 = x - 1; - y1 = y - 2; - x2 = x + a.xl + 1; - y2 = y + a.yl + 2; - } - getset[1 - cp].remember(r); - ox[cp] = x; - oy[cp] = y; - if (homing) homestep(); - x = x + ix; - y = y + iy; - if (check_me) { - tc = checkfeet(x, x + a.xl, oy[cp], y, a.yl); - if (tc != 0) { - void &with = magics[tc]; - switch (op) { - case exclaim: { - bounce(); - dixi('x', data); - } - break; - case bounces: - bounce(); - break; - case transport: - fliproom(hi(data), lo(data)); - break; - case unfinished: { - bounce(); - display("\7Sorry.\3\rThis place is not avaliable yet!"); - } - break; - } - } - } - count += 1; - if (((ix != 0) || (iy != 0)) && (count > 1)) { - step += 1; - if (step == a.seq) step = 0; - count = 0; - } -} - -void triptype::bounce() { - x = ox[cp]; - y = oy[cp]; - stopwalk(); - return; -} - -void triptype::walkto(integer xx, integer yy) { - speed(xx - x, yy - y); - hx = xx; - hy = yy; - homing = true; -} - -void triptype::stophoming() { - homing = false; -} - -void triptype::homestep() { - integer temp; - if ((hx == x) && (hy == y)) { - ; /* touching the target */ - homing = false; - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; - } -} - -void triptype::speed(shortint xx, shortint yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ - if (ix == 0) { - ; /* No horz movement */ - if (iy < 0) turn(up); - else turn(down); - } else { - if (ix < 0) turn(left); - else turn(right); - } -} - -void triptype::stopwalk() { - ix = 0; - iy = 0; - homing = false; -} - -void triptype::chatter() { - talkx = x + a.xl / 2; - talky = y; - talkf = a.fgc; - talkb = a.bgc; -} - -getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ - return this; -} - -void getsettype::remember(fieldtype r) { - numleft += 1; - gs[numleft] = r; -} - -void getsettype::recall(fieldtype &r) { - r = gs[numleft]; - numleft -= 1; -} - -void rwsp(byte t, byte r) { - const integer xs = 3; - const integer ys = 1; - { - triptype &with = tr[t]; - switch (r) { - case up: - speed(0, -ys); - break; - case down: - speed(0, ys); - break; - case left: - speed(-xs, 0); - break; - case right: - speed(xs, 0); - break; - case ul: - speed(-xs, -ys); - break; - case ur: - speed(xs, -ys); - break; - case dl: - speed(-xs, ys); - break; - case dr: - speed(xs, ys); - break; - } - } -} - -void apped(byte trn, byte np) { - { - triptype &with = tr[trn]; - { - void &with1 = peds[np]; - appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); - } - rwsp(trn, tr[trn].face); - } -} - -void getback() { - byte fv; - fieldtype r; - { - getsettype &with = getset[1 - cp]; - while (with.numleft > 0) { - recall(r); - mblit(x1, y1, x2, y2, 3, 1 - cp); - } - } -} - -void trippancy_link() { - byte fv; - if ((ddm_o.menunow) | ontoolbar | seescroll | (~ alive)) return; - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) getback(); - } - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) walk(); - } - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick && with.visible) andexor(); - } -} - -void stopwalking() { - tr[1].stopwalk(); - dna.rw = stopped; -} - -void tripkey(char dir) { - if (ctrl == cjoy) return; - - { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (rw != up) { - rw = up; - rwsp(1, rw); - } else stopwalking(); - break; - case 'P': - if (rw != down) { - rw = down; - rwsp(1, rw); - } else stopwalking(); - break; - case 'K': - if (rw != left) { - rw = left; - rwsp(1, rw); - } else stopwalking(); - break; - case 'M': - if (rw != right) { - rw = right; - rwsp(1, rw); - } else stopwalking(); - break; - case 'I': - if (rw != ur) { - rw = ur; - rwsp(1, rw); - } else stopwalking(); - break; - case 'Q': - if (rw != dr) { - rw = dr; - rwsp(1, rw); - } else stopwalking(); - break; - case 'O': - if (rw != dl) { - rw = dl; - rwsp(1, rw); - } else stopwalking(); - break; - case 'G': - if (rw != ul) { - rw = ul; - rwsp(1, rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } - } - } -} - -void getsetclear() { - byte fv; - for (fv = 0; fv <= 1; fv ++) getset[fv].init(); -} - -void fliproom(byte room, byte ped) { - dusk; - getsetclear(); - enterroom(room); - apped(1, ped); - oldrw = dna.rw; - dna.rw = tr[1].face; - showrw; - dawn; -} - -boolean infield(byte x) { /* returns True if you're within field "x" */ - integer yy; - boolean infield_result; - { - void &with = fields[x]; - { - triptype &with = tr[1]; - yy = with.y + with.a.yl; - infield_result = (with.x >= x1) && (with.x <= x2) && (yy >= y1) && (yy <= y2); - } - } - return infield_result; -} - -boolean neardoor() { /* returns True if you're near a door! */ - integer ux, uy; - byte fv; - boolean nd; - boolean neardoor_result; - if (numfields < 9) { - ; /* there ARE no doors here! */ - neardoor_result = false; - return neardoor_result; - } - { - triptype &with = tr[1]; - ux = with.x; - uy = with.y + with.a.yl; - } - nd = false; - for (fv = 9; fv <= numfields; fv ++) { - void &with = fields[fv]; - if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; - } - neardoor_result = nd; - return neardoor_result; -} - -void readstick() { - byte jw; - if (ctrl == ckey) return; - - jw = joyway; - - { - triptype &with = tr[1]; - if (jw == stopped) stopwalking(); - else { - dna.rw = jw; - rwsp(1, dna.rw); - } - } - - if (jw != oldjw) { - showrw; - oldjw = jw; - } - -} - -class unit_trip42_initialize { -public: - unit_trip42_initialize(); -}; -static unit_trip42_initialize trip42_constructor; - -unit_trip42_initialize::unit_trip42_initialize() { - getsetclear(); -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip42.h b/engines/avalanche/trip42.h deleted file mode 100644 index 69f01c34ac2c..000000000000 --- a/engines/avalanche/trip42.h +++ /dev/null @@ -1,119 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __trip42_h__ -#define __trip42_h__ - -/* {$R+ but switch it off soon...} */ - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Gyro.h"*/ -/*#include "Sticks.h"*/ - -namespace Avalanche { - -const integer maxgetset = 10; - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -class triptype { -public: - adxtype a; /* vital statistics */ - byte face, step; - integer x, y; /* current xy coords */ - array<0, 1, integer> ox, oy; /* last xy coords */ - shortint ix, iy; /* amount to move sprite by, each step */ - matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ - boolean quick, visible, homing, check_me; - integer hx, hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - - triptype *init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx, integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(integer xx, integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ -}; - -class getsettype { -public: - array<1, maxgetset, fieldtype> gs; - byte numleft; - - getsettype *init(); - void remember(fieldtype r); - void recall(fieldtype &r); -}; - -const integer numtr = 5; /* current max no. of sprites */ - -void trippancy_link(); - -void loadtrip(); - -void tripkey(char dir); - -void apped(byte trn, byte np); - -void fliproom(byte room, byte ped); - -boolean infield(byte x); /* returns True if you're within field "x" */ - -boolean neardoor(); /* returns True if you're near a door! */ - -void readstick(); - - -#ifdef __trip42_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, numtr, triptype> tr; -EXTERN array<0, 1, getsettype> getset; -#undef EXTERN -#define EXTERN extern - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/trip5.cpp b/engines/avalanche/trip5.cpp deleted file mode 100644 index 8557f1873b6b..000000000000 --- a/engines/avalanche/trip5.cpp +++ /dev/null @@ -1,2081 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - TRIP5 Trippancy V */ - -#define __trip5_implementation__ -/* Trippancy V */ /* Define NOASM to use Pascal instead of asm. */ -/*$S- Fast!*/ -#include "trip5.h" - - -/*#include "Scrolls.h"*/ -/*#include "Lucerna.h"*/ -/*#include "Dropdown.h"*/ -/*#include "Visa.h"*/ -/*#include "Celer.h"*/ -/*#include "Timeout.h"*/ -/*#include "Sequence.h"*/ -/*#include "Enid.h"*/ - -namespace Avalanche { - -void loadtrip() { - byte gm; - - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); - fillchar(aa, sizeof(aa), '\0'); -} - -byte checkfeet(integer x1, integer x2, integer oy, integer y, byte yl) { - byte a, c; - integer fv, ff; - - /* if not alive then begin checkfeet:=0; exit; end;*/ - byte checkfeet_result; - a = 0; - setactivepage(2); - if (x1 < 0) x1 = 0; - if (x2 > 639) x2 = 639; - if (oy < y) - for (fv = x1; fv <= x2; fv ++) - for (ff = oy + yl; ff <= y + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - else - for (fv = x1; fv <= x2; fv ++) - for (ff = y + yl; ff <= oy + yl; ff ++) { - c = getpixel(fv, ff); - if (c > a) a = c; - } - checkfeet_result = a; - setactivepage(1 - cp); - return checkfeet_result; -} - -byte geida_ped(byte which) { - byte geida_ped_result; - switch (which) { - case 1: - geida_ped_result = 7; - break; - case 2: - case 6: - geida_ped_result = 8; - break; - case 3: - case 5: - geida_ped_result = 9; - break; - case 4: - geida_ped_result = 10; - break; - } - return geida_ped_result; -} - -void catamove(byte ped) -/* When you enter a new position in the catacombs, this procedure should - be called. It changes the Also codes so that they may match the picture - on the screen. (Coming soon: It draws up the screen, too.) */ -{ - longint here; - word xy_word; - byte fv, ff; - - /* XY_word is cat_x+cat_y*256. Thus, every room in the - catacombs has a different number for it. */ - - - { - xy_word = cat_x + cat_y * 256; - geida_spin = 0; - } - switch (xy_word) { - case 1801: { /* Exit catacombs */ - fliproom(r__lustiesroom, 4); - display("Phew! Nice to be out of there!"); - return; - } - break; - case 1033: { /* Oubliette */ - fliproom(r__oubliette, 1); - display("Oh, NO!\231\2"); - return; - } - break; - case 4: { - fliproom(r__geidas, 1); - return; - } - break; - case 2307: { - fliproom(r__lusties, 5); - display("Oh no... here we go again..."); - dna.user_moves_avvy = false; - tr[1].iy = 1; - tr[1].ix = 0; - return; - } - break; - } - - if (~ dna.enter_catacombs_from_lusties_room) load(29); - here = catamap[cat_y][cat_x]; - - switch (here & 0xf) { /* West. */ - case 0: { /* no connection (wall) */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = nix; /* Door. */ - show_one(28); - } - break; - case 0x1: { /* no connection (wall + shield), */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = nix; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(29); /* ...shield. */ - } - break; - case 0x2: { /* wall with door */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door. */ - } - break; - case 0x3: { /* wall with door and shield */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(29); /* ...shield. */ - } - break; - case 0x4: { /* no connection (wall + window), */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = nix; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(5); /* ...window. */ - } - break; - case 0x5: { /* wall with door and window */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(5); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = nix; /* No door. */ - show_one(28); /* Wall, plus... */ - show_one(7); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - magics[2].op = bounces; /* Sloping wall. */ - magics[3].op = nix; /* Straight wall. */ - portals[13].op = special; /* Door. */ - show_one(28); /* Wall, plus... */ - show_one(30); /* ...door, and... */ - show_one(7); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - magics[2].op = nix; /* Sloping wall. */ - magics[3].op = special; /* Straight wall. */ - } - break; - } - - /* ---- */ - - switch ((cardinal)(here & 0xf0) >> 4) { /* East */ - case 0: { /* no connection (wall) */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = nix; /* Door. */ - show_one(19); - } - break; - case 0x1: { /* no connection (wall + window), */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = nix; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(20); /* ...window. */ - } - break; - case 0x2: { /* wall with door */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(21); /* ...door. */ - } - break; - case 0x3: { /* wall with door and window */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(20); /* ...door, and... */ - show_one(21); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = nix; /* No door. */ - show_one(19); /* Wall, plus... */ - show_one(18); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - magics[5].op = bounces; /* Sloping wall. */ - magics[6].op = nix; /* Straight wall. */ - portals[15].op = special; /* Door. */ - show_one(19); /* Wall, plus... */ - show_one(21); /* ...door, and... */ - show_one(18); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - magics[5].op = nix; /* Sloping wall. */ - magics[6].op = special; /* Straight wall. */ - portals[15].op = nix; /* Door. */ - } - break; - } - - /* ---- */ - - switch ((cardinal)(here & 0xf00) >> 8) { /* South */ - case 0: { /* No connection. */ - magics[7].op = bounces; - magics[12].op = bounces; - magics[13].op = bounces; - } - break; - case 0x1: { - show_one(22); - { - void &with = magics[13]; - if ((xy_word == 2051) & (dna.geida_follows)) - op = exclaim; - else op = special; - } /* Right exit south. */ - magics[7].op = bounces; - magics[12].op = bounces; - } - break; - case 0x2: { - show_one(23); - magics[7].op = special; /* Middle exit south. */ - magics[12].op = bounces; - magics[13].op = bounces; - } - break; - case 0x3: { - show_one(24); - magics[12].op = special; /* Left exit south. */ - magics[7].op = bounces; - magics[13].op = bounces; - } - break; - } - - switch ((cardinal)(here & 0xf000) >> 12) { /* North */ - case 0: { /* No connection */ - magics[1].op = bounces; - portals[12].op = nix; /* Door. */ - } - break; - /* LEFT handles: */ - /* $1: begin - show_one(4); - magics[1].op:=bounces; { Left exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end;*/ - case 0x2: { - show_one(4); - magics[1].op = bounces; /* Middle exit north. */ - portals[12].op = special; /* Door. */ - } - break; - /* $3: begin - show_one(4); - magics[1].op:=bounces; { Right exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end; - { RIGHT handles: } - $4: begin - show_one(3); - magics[1].op:=bounces; { Left exit north. } { Change magic number! } - portals[12].op:=special; { Door. } - end;*/ - case 0x5: { - show_one(3); - magics[1].op = bounces; /* Middle exit north. */ - portals[12].op = special; /* Door. */ - } - break; - /* $6: begin - show_one(3); - magics[1].op:=bounces; { Right exit north. } - portals[12].op:=special; { Door. } - end;*/ - /* ARCHWAYS: */ - case 0x7: - case 0x8: - case 0x9: { - show_one(6); - - if (((cardinal)(here & 0xf000) >> 12) > 0x7) show_one(31); - if (((cardinal)(here & 0xf000) >> 12) == 0x9) show_one(32); - - magics[1].op = special; /* Middle arch north. */ - portals[12].op = nix; /* Door. */ - } - break; - /* DECORATIONS: */ - case 0xd: { /* No connection + WINDOW */ - magics[1].op = bounces; - portals[12].op = nix; /* Door. */ - show_one(14); - } - break; - case 0xe: { /* No connection + TORCH */ - magics[1].op = bounces; - portals[12].op = nix; /* Door. */ - show_one(8); - } - break; - /* Recessed door: */ - case 0xf: { - magics[1].op = nix; /* Door to Geida's room. */ - show_one(1); - portals[12].op = special; /* Door. */ - } - break; - } - - switch (xy_word) { - case 514: - show_one(17); - break; /* [2,2] : "Art Gallery" sign over door. */ - case 264: - show_one(9); - break; /* [8,1] : "The Wrong Way!" sign. */ - case 1797: - show_one(2); - break; /* [5,7] : "Ite Mingite" sign. */ - case 258: - for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ - show_one_at(15, 130 + fv * 120, 70); - show_one_at(16, 184 + fv * 120, 78); - } - break; - case 1287: - for (fv = 10; fv <= 13; fv ++) show_one(fv); - break; /* [7,5] : 4 candles. */ - case 776: - show_one(10); - break; /* [8,3] : 1 candle. */ - case 2049: - show_one(11); - break; /* [1,8] : another candle. */ - case 257: { - show_one(12); - show_one(13); - } - break; /* [1,1] : the other two. */ - } - - if ((dna.geida_follows) & (ped > 0)) { - triptype &with = tr[2]; - - if (! with.quick) /* If we don't already have her... */ - tr[2].init(5, true); /* ...Load Geida. */ - apped(2, geida_ped(ped)); - tr[2].call_eachstep = true; - tr[2].eachstep = procgeida_procs; - } -} - -void call_special(word which); - -/* This proc gets called whenever you touch a line defined as Special. */ -static void dawndelay() { - set_up_timer(2, procdawn_delay, reason_dawndelay); -} - -void call_special(word which) { - switch (which) { - case 1: { /* Special 1: Room 22: top of stairs. */ - show_one(1); - dna.brummie_stairs = 1; - magics[10].op = nix; - set_up_timer(10, procstairs, reason_brummiestairs); - stopwalking(); - dna.user_moves_avvy = false; - } - break; - case 2: { /* Special 2: Room 22: bottom of stairs. */ - dna.brummie_stairs = 3; - magics[11].op = nix; - magics[12].op = exclaim; - magics[12].data = 5; - magics[4].op = bounces; /* Now works as planned! */ - stopwalking(); - dixi('q', 26); - dna.user_moves_avvy = true; - } - break; - case 3: { /* Special 3: Room 71: triggers dart. */ - tr[1].bounce(); /* Must include that. */ - - if (~ dna.arrow_triggered) { - dna.arrow_triggered = true; - apped(2, 4); /* The dart starts at ped 4, and... */ - tr[2].walkto(5); /* flies to ped 5. */ - tr[2].face = 0; /* Only face. */ - /* Should call some kind of Eachstep procedure which will deallocate - the sprite when it hits the wall, and replace it with the chunk - graphic of the arrow buried in the plaster. */ - /* OK! */ - tr[2].call_eachstep = true; - tr[2].eachstep = procarrow_procs; - } - } - break; - - case 4: { /* This is the ghost room link. */ - dusk; - tr[1].turn(right); /* you'll see this after we get back from bootstrap */ - set_up_timer(1, procghost_room_phew, reason_ghost_room_phew); - back_to_bootstrap(3); - } - break; - - case 5: - if (dna.friar_will_tie_you_up) { - /* Special 5: Room 42: touched tree, and get tied up. */ - magics[4].op = bounces; /* Boundary effect is now working again. */ - dixi('q', 35); - tr[1].done(); - /*tr[1].vanishifstill:=true;*/ - show_one(2); - dixi('q', 36); - dna.tied_up = true; - dna.friar_will_tie_you_up = false; - tr[2].walkto(3); - tr[2].vanishifstill = true; - tr[2].check_me = true; /* One of them must have Check_Me switched on. */ - whereis[pfriartuck] = 177; /* Not here, then. */ - set_up_timer(364, prochang_around, reason_hanging_around); - } - break; - - case 6: { /* Special 6: fall down oubliette. */ - dna.user_moves_avvy = false; - tr[1].ix = 3; - tr[1].iy = 0; - tr[1].face = right; - set_up_timer(1, procfall_down_oubliette, reason_falling_down_oubliette); - } - break; - - case 7: { /* Special 7: stop falling down oubliette. */ - tr[1].visible = false; - magics[10].op = nix; - stopwalking(); - lose_timer(reason_falling_down_oubliette); - mblit(12, 80, 38, 160, 3, 0); - mblit(12, 80, 38, 160, 3, 1); - display("Oh dear, you seem to be down the bottom of an oubliette."); - set_up_timer(200, procmeet_avaroid, reason_meeting_avaroid); - } - break; - - case 8: /* Special 8: leave du Lustie's room. */ - if ((geida_follows) & (~ lustie_is_asleep)) { - dixi('q', 63); - tr[2].turn(down); - tr[2].stopwalk(); - tr[2].call_eachstep = false; /* Geida */ - gameover; - } - break; - - case 9: { /* Special 9: lose Geida to Robin Hood... */ - if (~ dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ - tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ - tr[2].walkto(4); /* She walks to somewhere... */ - tr[1].done(); /* Lose Avvy. */ - dna.user_moves_avvy = false; - set_up_timer(40, procrobin_hood_and_geida, reason_robin_hood_and_geida); - } - break; - - case 10: { /* Special 10: transfer north in catacombs. */ - if ((dna.cat_x == 4) && (dna.cat_y == 1)) { - /* Into Geida's room. */ - if (dna.obj[key]) dixi('q', 62); - else { - dixi('q', 61); - return; - } - } - dusk; - dna.cat_y -= 1; - catamove(4); - if (dna.room != r__catacombs) return; - delavvy; - switch ((cardinal)(catamap[cat_y][cat_x] & 0xf00) >> 8) { - case 0x1: - apped(1, 12); - break; - case 0x3: - apped(1, 11); - break; - default: - apped(1, 4); - } - getback(); - dawndelay(); - } - break; - case 11: { /* Special 11: transfer east in catacombs. */ - dusk; - dna.cat_x += 1; - catamove(1); - if (dna.room != r__catacombs) return; - delavvy; - apped(1, 1); - getback(); - dawndelay(); - } - break; - case 12: { /* Special 12: transfer south in catacombs. */ - dusk; - dna.cat_y += 1; - catamove(2); - if (dna.room != r__catacombs) return; - delavvy; - apped(1, 2); - getback(); - dawndelay(); - } - break; - case 13: { /* Special 13: transfer west in catacombs. */ - dusk; - dna.cat_x -= 1; - catamove(3); - if (dna.room != r__catacombs) return; - delavvy; - apped(1, 3); - getback(); - dawndelay(); - } - break; - } -} - -void hide_in_the_cupboard(); - -void open_the_door(byte whither, byte ped, byte magicnum) -/* This slides the door open. (The data really ought to be saved in - the Also file, and will be next time. However, for now, they're - here.) */ -{ - switch (dna.room) { - case r__outsideyours: - case r__outsidenottspub: - case r__outsideducks: { - first_show(1); - then_show(2); - then_show(3); - } - break; - case r__insidecardiffcastle: { - first_show(1); - then_show(5); - } - break; - case r__avvysgarden: - case r__entrancehall: - case r__insideabbey: { - first_show(1); - then_show(2); - } - break; - case r__musicroom: - case r__outsideargentpub: { - first_show(5); - then_show(6); - } - break; - case r__lusties: - switch (magicnum) { - case 14: - if (dna.avvys_in_the_cupboard) { - hide_in_the_cupboard(); - first_show(8); - then_show(7); - start_to_close; - return; - } else { - apped(1, 6); - tr[1].face = right; /* added by TT 12/3/1995 */ - first_show(8); - then_show(9); - } - break; - case 12: { - first_show(4); - then_show(5); - then_show(6); - } - break; - } - break; - } - - then_flip(whither, ped); - start_to_open; -} - -void newspeed() -/* Given that you've just changed the speed in triptype.xs, this adjusts - ix. */ -{ - const bytefield lightspace = {40, 199, 47, 199}; - byte page_; - - { - triptype &with = tr[1]; - - with.ix = (with.ix / 3) * with.xs; - setactivepage(3); - - setfillstyle(1, 14); - if (with.xs == run) bar(371, 199, 373, 199); - else bar(336, 199, 338, 199); - setfillstyle(1, 9); - if (with.xs == run) bar(336, 199, 338, 199); - else bar(371, 199, 373, 199); - - setactivepage(1 - cp); - for (page_ = 0; page_ <= 1; page_ ++) getset[page_].remember(lightspace); - } -} - -triptype *triptype::init(byte spritenum, boolean do_check) { - const integer idshould = -1317732048; - integer gd, gm; - varying_string<2> xx; - byte fv/*,nds*/; - byte aa, bb; - longint id; - word soa; - untyped_file inf; - - if (spritenum == 177) return; /* Already running! */ - str(spritenum, xx); - assign(inf, string("sprite") + xx + ".avd"); - reset(inf, 1); - seek(inf, 177); - blockread(inf, id, 4); - if (id != idshould) { - output << '\7'; - close(inf); - exit(0); - } - - blockread(inf, soa, 2); - blockread(inf, a, soa); - - { - adxtype &with = a; - - /*nds:=num div seq;*/ totalnum = 1; - xw = with.xl / 8; - if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/with.num; aa ++) { - getmem(sil[totalnum], 11 * (with.yl + 1)); - getmem(mani[totalnum], with.size - 6); - for (fv = 0; fv <= with.yl; fv ++) { - blockread(inf, (*sil[totalnum])[fv], xw); - } - blockread(inf, *mani[totalnum], with.size - 6); - totalnum += 1; - } - } - - /* on; */ - x = 0; - y = 0; - quick = true; - visible = false; - xs = 3; - ys = 1; - /* if spritenum=1 then newspeed; { Just for the lights. }*/ - - homing = false; - ix = 0; - iy = 0; - step = 0; - check_me = do_check; - count = 0; - whichsprite = spritenum; - vanishifstill = false; - call_eachstep = false; - close(inf); - return this; -} - -void triptype::original() { - quick = false; - whichsprite = 177; -} - -void triptype::andexor() { - byte picnum; /* Picnum, Picnic, what ye heck */ - byte lay, laz; /* Limits for Qaz and Qay or equivs. (Laz always = 3). */ -#ifdef NOASM - word offs, fv; - byte qax, qay, qaz; -#else - word segmani, ofsmani; - word ofsaa, realofsaa; - word segsil, ofssil; - word z; - byte xwidth; - -#endif - - if ((vanishifstill) && (ix == 0) && (iy == 0)) return; - picnum = face * a.seq + step + 1; - - { - adxtype &with = a; - - getimage(x, y, x + with.xl, y + with.yl, aa); /* Now loaded into our local buffer. */ - - /* Now we've got to modify it! */ - - /* Qaz ranges over the width of the sprite/8. - Qay " " the height. - Qax " " 1 to 4 (the planes). */ - - { - adxtype &with1 = a; - -#ifdef NOASM - laz = xw - 1; - lay = with1.yl; /* -1's only for Pascal. */ -#else - laz = xw; - lay = with1.yl + 1; /* +1's only for ASM! */ -#endif - } - - /* ASSEMBLERISED: */ -#ifdef NOASM - for (qax = 0; qax <= 3; qax ++) /* 3 */ - for (qay = 0; qay <= lay; qay ++) /* 35 */ - for (qaz = 0; qaz <= laz; qaz ++) { /* 4 */ - offs = 5 + qay * xw * 4 + xw * qax + qaz; - aa[offs] = aa[offs] & (*sil[picnum])[qay][qaz]; - } - - for (fv = 5; fv <= with.size - 2; fv ++) - aa[fv] = aa[fv] ^ (*mani[picnum])[fv]; - -#else - /* OK, here's the same thing in assembler... - - AL is Qax, - BL is Qay, - CL is Qaz, - DX is Offs */ - - /* For the first part: */ - xwidth = xw; - segsil = seg(*sil[picnum]); - ofssil = ofs(*sil[picnum]); - - /* For the first and second parts: */ - segmani = seg(*mani[picnum]); /* It's easier to do this in Pascal, and */ - ofsmani = ofs(*mani[picnum]) + 1; /* besides it only goes round once here. */ - /* Segment of AA is always the current data segment. */ - ofsaa = ofs(aa) + 5; - realofsaa = ofs(aa) - 1; /* We may not need this. */ - z = with.size - 7; - /* - asm - - xor ax,ax; { Initialise ax, bx, and cx, using a rather } - @QAXloop: { AL } - - xor bx,bx; { nifty speed trick. } - @QAYloop: { BL } - - xor cx,cx; - @QAZloop: { CL } - - { Right, well, here we are. We have to do some rather nifty array - manipulation, stuff like that. We're trying to assemblerise: - DX:= 5 + BX * xw * 4 + xw * AX + CX; - aa[DX]:=aa[DX] and sil[picnum]^[BL,CL]; } - - push ax; {AXcdx} { OK, we're going to do some strange things } - { with ax, so we'd better save it. } - mov dx,5; { First of all... set dx to 5. } - add dx,cx; { DX now = 5+CX } - mul xwidth; { Multiply ax by xw (the Pascal variable.) } - add dx,ax; { DX now = 5+CX+xw*AX } - - { Right. Mul only works on ax. Don't ask me why. Ask Intel. Anyway, - since ax is saved on the stack, we can move bx over it. Note that - if xw was a word, using mul would have destroyed the contents of - dx. NOT a good idea! } - - push cx; {CXmul} { We must just borrow cx for a second. } - mov ax,bx; { Make ax = bx. } - mul xwidth; { Do the same to it as we did to ax before. } - mov cl,2; - shl ax,cl; { And multiply it by 4 (i.e., shl it by 2.) } - add dx,ax; { DX now = 5+CX+xw*AX+xw*BX*4. That's OK. } - - pop cx; {CXmul} - pop ax; {AXcdx} { Now we have to get ax and cx back again. } - - { Registers are now returned to original status. } - - { Righto. DX is now all worked out OK. We must now find out the - contents of: 1) aa[dx], and 2) (harder) sil[picnum]^[BL,CL]. Gulp. } - - { DS already points to the segment of AA. So... let's use CL to - put aa[dx] in, and use BX for the offset. Looks like we're going - to have to push a few registers! } - - push ax; { AXaa. Saving loop value of AX. } - { Let's use ax to do our dirty work with. } - push dx; { Saving Offs(DX.) } - - push bx; { BXaa. Saving loop value of BX. } - - mov bx,realofsaa; { aa is now pointed to by [ds:bx]. } - add bx,dx; { Offset is dx bytes. } - mov dl,[bx]; { cl now holds the contents of aa[dx]. } - - pop bx; { BXaa. Restoring loop value of BX. } - - { Stack now holds: Offs(DX). } - - { ^^^ That works. Now to find sil[picnum]^[BL,CL]. Our first task is - to find the address of sil[picnum]^. Since it's dynamic, we must - push and pop ds. } - - push ds; { DXaa. Saving value of Trip5's data segment. } - { Push ds. Now we can put the segment of sil[picnum]^... } - mov ds,segsil; { ...into ds, and... } - mov ax,ofssil; { ...its offset into ax. } - { Addr of sil[picnum]^ is now in [ds:ax]. BUT we want a particular - offset: to wit, [BL,CL]. Now, siltype is defined so that this offset - will be at an offset of (BL*11)+CL. } - - push bx; { Saving loop value of BX. } - push cx; { Saving loop value of CX. } - push ax; { Saving offset of sil[picnum]^. } - { Save them for a bit (!) } - mov al,bl; { Put bl into al. } - mov bl,11; { ... } - mul bl; { ...times it by 11. } - mov bx,ax; { Put it back into bx (now = bx*11) } - pop ax; { Restoring offset of sil[picnum]^. } - { Get ax back again. } - add ax,bx; { Add (original bl)*11 to al. } - add ax,cx; { Add cl to al. } - { AX now holds the offset of sil[picnum]^[bx,cl]. } - - { Stack now holds: loop value of AX, Trip5's DS, lv of BX, lv of CX. } - - { Right. Now the address of sil[picnum]^[bl,cl] is in [ds:ax]. Let's - get the elusive byte itself, and put it into ax. Firstly, we must - swap ax and bx. } - - xchg ax,bx; - mov al,[bx]; { AX now contains sil[picnum]^[bl,cl], AT LAST!! } - - { So now AL contains the sil stuff, and DL holds aa[offs]. } - - and al,dl; { aa[offs]:=aa[offs] and sil[picnum]^[Qay,Qaz]. } - - pop cx; { Restoring loop value of CX. } - pop bx; { Restoring loop value of BX. } - pop ds; { Restore value of Trip5's data segment. } - - { Right. AL contains the byte we need to replace aa[offs] with. - All that's left to do is to put it back. Remember that we already - have the segment of aa in the current DS, so... } - - pop dx; { Restore Offs(DX). } - - { Stack is now as when we entered the loop. Since this copy of DX - is now being used for the last time, we can muck around with it. } - - { Recap: DX now holds the offset from the start of AA. If we add - the offset of aa to it, we'll get the offset of the byte we want. - DS is already set up. } - - push bx; { I'm just borrowing bx for a sec. I'll put it back in 5 lines.} - mov bx,realofsaa; - add dx,bx; { Now aa[offs] is at aa[ds:dx]. } - mov bx,dx; { But we can't address memory with dx, so use bx. } - mov [bx],al; { Shove it into the memory! } - pop bx; { See! I said I would. } - - pop ax; { Restore loop value of AX. } - - { Right, the fancy stuff's all done now. Finish off the loop code. } - - inc cl; - cmp cl,laz; { CL must not reach 5. Does it? } - jnz @QAZloop; { no, keep going around the QAZloop. } - - inc bl; - cmp bl,lay; { BL must not reach 36. Does it? } - jnz @QAYloop; { no, keep going around the QAYloop. } - - inc al; - cmp al,4; { AL must not reach 4. Does it? } - jnz @QAXloop; { no, keep going around the QAXloop. } - - { al, bl and cl are now at their maxima, so we can stop the loops. } - - { *** SECOND ASSEMBLER BIT. *** } - - mov cx,z; { Find the size of the array, -7. } - mov bx,ofsmani; { Now find the offset and put that into bx. } - mov dx,ofsaa; { We'll use dx to be the same as fv, +5. } - - { DS should already hold the segment of aa. } - - @nextbyte: { Main loop... } - - { Firstly, we must get hold of aa[fv] (here called aa[dx].)} - push bx; { We need to "borrow" bx for a second... } - mov bx,dx; { Wrong register- shove it into bx. } - mov al,[bx]; { Get aa[fv] and put it into al. } - pop bx; { Right, you can have bx back again. } - - { Secondly, we must get hold of mani[picnum]^[fv]. } - push cx; { Let's borrow cx for this one. } - push ds; { we must use ds to point to segmani. } - mov ds,segmani; { Find the segment of mani[picnum]^, } - mov cl,[bx]; { now get the byte at [ds:bx] and put it into cl. } - pop ds; { Put ds back to being the current data segment. } - - { Right: now we can do what we came here for in the first place. - AL contains aa[fv], CL contains mani[picnum]^[fv]. } - - xor al,cl; { Xor al with bl. That's it! } - - pop cx; { We don't need cx any more for this now. } - - push bx; { Borrow bx... } - mov bx,dx; { Put dx into bx. } - mov [bx],al; { Put the changed al back into [ds:bx] (ie, [ds:dx].} - pop bx; { Get it back. } - - inc bx; { Add one to bx, for the next char. } - inc dx; { And dx, for the same reason. } - - loop @nextbyte; { Keep going round until cx=0. } - */ - { - } -#endif - - /* Now.. let's try pasting it back again! */ - - putimage(x, y, aa, 0); - } -} - -void triptype::turn(byte whichway) { - if (whichway == 8) face = 0; - else face = whichway; -} - -void triptype::appear(integer wx, integer wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox[cp] = wx; - oy[cp] = wy; - turn(wf); - visible = true; - ix = 0; - iy = 0; -} - - - - -static boolean collision_check() { - byte fv; - - boolean collision_check_result; - for (fv = 1; fv <= numtr; fv ++) - if (tr[fv].quick && (tr[fv].whichsprite != whichsprite) && - ((x + a.xl) > tr[fv].x) && - (x < (tr[fv].x + tr[fv].a.xl)) && - (tr[fv].y == y)) { - collision_check_result = true; - return collision_check_result; - } - collision_check_result = false; - return collision_check_result; -} - -void triptype::walk() { - byte tc; - bytefield r; - - - if (visible) { - { - x1 = (x / 8) - 1; - if (x1 == 255) x1 = 0; - y1 = y - 2; - x2 = ((x + a.xl) / 8) + 1; - y2 = y + a.yl + 2; - } - getset[1 - cp].remember(r); - } - - if (~ doing_sprite_run) { - ox[cp] = x; - oy[cp] = y; - if (homing) homestep(); - x = x + ix; - y = y + iy; - } - - if (check_me) { - if (collision_check()) { - bounce(); - return; - } - - tc = checkfeet(x, x + a.xl, oy[cp], y, a.yl); - - if ((tc != 0) & (~ doing_sprite_run)) { - void &with = magics[tc]; - switch (op) { - case exclaim: { - bounce(); - mustexclaim = true; - saywhat = data; - } - break; - case bounces: - bounce(); - break; - case transport: - fliproom(hi(data), lo(data)); - break; - case unfinished: { - bounce(); - display("\7Sorry.\3\rThis place is not available yet!"); - } - break; - case special: - call_special(data); - break; - case mopendoor: - open_the_door(hi(data), lo(data), tc); - break; - } - } - } - - if (~ doing_sprite_run) { - count += 1; - if (((ix != 0) || (iy != 0)) && (count > 1)) { - step += 1; - if (step == a.seq) step = 0; - count = 0; - } - } - -} - -void triptype::bounce() { - x = ox[cp]; - y = oy[cp]; - if (check_me) stopwalking(); - else stopwalk(); - oncandopageswap = false; - showrw; - oncandopageswap = true; -} - -shortint sgn(integer x) { - shortint sgn_result; - if (x > 0) sgn_result = 1; - else if (x < 0) sgn_result = -1; - else - sgn_result = 0; /* x=0 */ - return sgn_result; -} - -void triptype::walkto(byte pednum) { - speed(sgn(peds[pednum].x - x) * 4, sgn(peds[pednum].y - y)); - hx = peds[pednum].x - a.xl / 2; - hy = peds[pednum].y - a.yl; - homing = true; -} - -void triptype::stophoming() { - homing = false; -} - -void triptype::homestep() { - integer temp; - - if ((hx == x) && (hy == y)) { - /* touching the target */ - stopwalk(); - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; - } -} - -void triptype::speed(shortint xx, shortint yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ - if (ix == 0) { - /* No horz movement */ - if (iy < 0) turn(up); - else turn(down); - } else { - if (ix < 0) turn(left); - else turn(right); - } -} - -void triptype::stopwalk() { - ix = 0; - iy = 0; - homing = false; -} - -void triptype::chatter() { - talkx = x + a.xl / 2; - talky = y; - talkf = a.fgc; - talkb = a.bgc; -} - -void triptype::set_up_saver(trip_saver_type &v) { - v.whichsprite = whichsprite; - v.face = face; - v.step = step; - v.x = x; - v.y = y; - v.ix = ix; - v.iy = iy; - v.visible = visible; - v.homing = homing; - v.check_me = check_me; - v.count = count; - v.xw = xw; - v.xs = xs; - v.ys = ys; - v.totalnum = totalnum; - v.hx = hx; - v.hy = hy; - v.call_eachstep = call_eachstep; - v.eachstep = eachstep; - v.vanishifstill = vanishifstill; -} - -void triptype::unload_saver(trip_saver_type v) { - whichsprite = v.whichsprite; - face = v.face; - step = v.step; - x = v.x; - y = v.y; - ix = v.ix; - iy = v.iy; - visible = v.visible; - homing = v.homing; - check_me = v.check_me; - count = v.count; - xw = v.xw; - xs = v.xs; - ys = v.ys; - totalnum = v.totalnum; - hx = v.hx; - hy = v.hy; - call_eachstep = v.call_eachstep; - eachstep = v.eachstep; - vanishifstill = v.vanishifstill; -} - -void triptype::savedata(untyped_file &f) { - trip_saver_type tripsaver; - - set_up_saver(tripsaver); - - { - blockwrite(f, tripsaver.whichsprite, 1); - blockwrite(f, tripsaver.face, 1); - blockwrite(f, tripsaver.step, 1); - blockwrite(f, tripsaver.x, 2); - blockwrite(f, tripsaver.y, 2); - blockwrite(f, tripsaver.ix, 1); - blockwrite(f, tripsaver.iy, 1); - blockwrite(f, tripsaver.visible, 1); - blockwrite(f, tripsaver.homing, 1); - blockwrite(f, tripsaver.check_me, 1); - blockwrite(f, tripsaver.count, 1); - blockwrite(f, tripsaver.xw, 1); - blockwrite(f, tripsaver.xs, 1); - blockwrite(f, tripsaver.ys, 1); - blockwrite(f, tripsaver.totalnum, 1); - blockwrite(f, tripsaver.hx, 2); - blockwrite(f, tripsaver.hy, 2); - blockwrite(f, tripsaver.call_eachstep, 1); - blockwrite(f, tripsaver.eachstep, 1); - blockwrite(f, tripsaver.vanishifstill, 1); - } -} - -void triptype::loaddata(untyped_file &f) { - word spritewas, spriteis, saveface, savex, savey, savestep; - boolean wasquick; - trip_saver_type tripsaver; - - - wasquick = quick; - quick = true; - spritewas = whichsprite; - - { - blockread(f, tripsaver.whichsprite, 1); - blockread(f, tripsaver.face, 1); - blockread(f, tripsaver.step, 1); - blockread(f, tripsaver.x, 2); - blockread(f, tripsaver.y, 2); - blockread(f, tripsaver.ix, 1); - blockread(f, tripsaver.iy, 1); - - if ((! wasquick) || ((unsigned char)tripsaver.whichsprite != spritewas)) { - spriteis = tripsaver.whichsprite; - savex = tripsaver.x; - savey = tripsaver.y; - saveface = tripsaver.face; - savestep = tripsaver.step; - - if (wasquick) done(); - - init(spriteis, tripsaver.check_me); - - appear(savex, savey, saveface); - tripsaver.step = savestep; - } - - blockread(f, tripsaver.visible, 1); - blockread(f, tripsaver.homing, 1); - blockread(f, tripsaver.check_me, 1); - blockread(f, tripsaver.count, 1); - blockread(f, tripsaver.xw, 1); - blockread(f, tripsaver.xs, 1); - blockread(f, tripsaver.ys, 1); - blockread(f, tripsaver.totalnum, 1); - blockread(f, tripsaver.hx, 2); - blockread(f, tripsaver.hy, 2); - blockread(f, tripsaver.call_eachstep, 1); - blockread(f, tripsaver.eachstep, 1); - blockread(f, tripsaver.vanishifstill, 1); - } - - unload_saver(tripsaver); -} - -triptype *triptype::done() { - integer gd, gm; - varying_string<2> xx; - byte fv/*,nds*/; - byte aa, bb; - longint id; - word soa; - - { - adxtype &with = a; - - /* nds:=num div seq;*/ - xw = with.xl / 8; - if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { - totalnum -= 1; - freemem(mani[totalnum], with.size - 6); - freemem(sil[totalnum], 11 * (with.yl + 1)); /* <<- Width of a siltype. */ - } - } - - quick = false; - whichsprite = 177; - return this; -} - -getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ - return this; -} - -void getsettype::remember(bytefield r) { - numleft += 1; - if (numleft > maxgetset) runerror(runerr_getset_overflow); - gs[numleft] = r; -} - -void getsettype::recall(bytefield &r) { - r = gs[numleft]; - numleft -= 1; -} - -void rwsp(byte t, byte r) { - { - triptype &with = tr[t]; - switch (r) { - case up: - speed(0, -with.ys); - break; - case down: - speed(0, with.ys); - break; - case left: - speed(-with.xs, 0); - break; - case right: - speed(with.xs, 0); - break; - case ul: - speed(-with.xs, -with.ys); - break; - case ur: - speed(with.xs, -with.ys); - break; - case dl: - speed(-with.xs, with.ys); - break; - case dr: - speed(with.xs, with.ys); - break; - } - } -} - -void apped(byte trn, byte np) { - { - triptype &with = tr[trn]; - { - void &with1 = peds[np]; - - appear(with.x - with.a.xl / 2, with.y - with.a.yl, dir); - rwsp(trn, dir); - } - } -} - -void getback(); - -static bytefield r; - - -/* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:word):boolean; - begin { By De Morgan's law: } - overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); - end;*/ -/* x1,x2 - as bytefield, but *8. y1,y2 - as bytefield. - x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ -static boolean overlaps_with_mouse() { - boolean overlaps_with_mouse_result; - overlaps_with_mouse_result = - (x2 * 8 >= mx) && (mx + 16 >= x1 * 8) && (y2 >= my) && (my + 16 >= y1); - return overlaps_with_mouse_result; -} - -void getback() { - byte fv; - boolean endangered; - - - endangered = false; - /* Super_Off;*/ - - { - getsettype &with = getset[1 - cp]; - while (with.numleft > 0) { - recall(r); - - /* if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end;*/ - - mblit(x1, y1, x2, y2, 3, 1 - cp); - } - } - - blitfix; - /*if endangered then*/ /*Super_On;*/ -} - -/* Eachstep procedures: */ -void follow_avvy_y(byte tripnum) { - { - triptype &with = tr[tripnum]; - - if (tr[1].face == left) return; - if (with.homing) with.hy = tr[1].y; - else { - if (with.y < tr[1].y) - with.y += 1; - else if (with.y > tr[1].y) - with.y -= 1; - else - return; - if (with.ix == 0) { - with.step += 1; - if (with.step == with.a.seq) with.step = 0; - with.count = 0; - } - } - } -} - -void back_and_forth(byte tripnum) { - { - triptype &with = tr[tripnum]; - if (! with.homing) { - if (with.face == right) walkto(4); - else walkto(5); - } - } -} - -void face_avvy(byte tripnum) { - { - triptype &with = tr[tripnum]; - if (! with.homing) { - if (tr[1].x >= with.x) with.face = right; - else with.face = left; - } - } -} - -void arrow_procs(byte tripnum) { - byte fv; - - { - triptype &with = tr[tripnum]; - if (with.homing) { - /* Arrow is still in flight. */ - /* We must check whether or not the arrow has collided with Avvy's head. - This is so if: a) the bottom of the arrow is below Avvy's head, - b) the left of the arrow is left of the right of Avvy's head, and - c) the right of the arrow is right of the left of Avvy's head. */ - if (((with.y + with.a.yl) >= tr[1].y) /* A */ - && (with.x <= (tr[1].x + tr[1].a.xl)) /* B */ - && ((with.x + with.a.xl) >= tr[1].x)) { /* C */ - /* OK, it's hit him... what now? */ - - tr[2].call_eachstep = false; /* prevent recursion. */ - dixi('Q', 47); /* Complaint! */ - done(); /* Deallocate the arrow. */ - /* tr[1].done; { Deallocate normal pic of Avvy. } - - off; - for fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - on;*/ - - gameover; - - dna.user_moves_avvy = false; /* Stop the user from moving him. */ - set_up_timer(55, procnaughty_duke, reason_naughty_duke); - } - } else { /* Arrow has hit the wall! */ - done(); /* Deallocate the arrow. */ - show_one(3); /* Show pic of arrow stuck into the door. */ - dna.arrow_in_the_door = true; /* So that we can pick it up. */ - } - } -} - -/*procedure Spludwick_procs(tripnum:byte); -var fv:byte; -begin - with tr[tripnum] do - if not homing then { We only need to do anything if Spludwick *stops* - walking. } - with dna do - begin - inc(DogfoodPos); - if DogfoodPos=8 then DogfoodPos:=1; - walkto(DogfoodPos); - end; -end;*/ - -void grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ - byte fv; - integer tox, toy; - - { - triptype &with = tr[tripnum]; - { - tox = tr[1].x + 17; - toy = tr[1].y - 1; - if ((with.x == tox) && (with.y == toy)) { - with.call_eachstep = false; - with.face = left; - stopwalk(); - /* ... whatever ... */ - } else { - /* Still some way to go. */ - if (with.x < tox) { - with.x += 5; - if (with.x > tox) with.x = tox; - } - if (with.y < toy) with.y += 1; - with.step += 1; - if (with.step == with.a.seq) with.step = 0; - } - } - } -} - -void geida_procs(byte tripnum); - -static void take_a_step(byte &tripnum) { - { - triptype &with = tr[tripnum]; - if (with.ix == 0) { - with.step += 1; - if (with.step == with.a.seq) with.step = 0; - with.count = 0; - } - } -} - - - -static void spin(byte whichway, byte &tripnum) { - { - triptype &with = tr[tripnum]; - if (with.face != whichway) { - with.face = whichway; - if (with.whichsprite == 2) return; /* Not for Spludwick */ - - dna.geida_spin += 1; - dna.geida_time = 20; - if (dna.geida_spin == 5) { - display("Steady on, Avvy, you'll make the poor girl dizzy!"); - dna.geida_spin = 0; - dna.geida_time = 0; /* knock out records */ - } - } - } -} - -void geida_procs(byte tripnum) { - { - triptype &with = tr[tripnum]; - - if (dna.geida_time > 0) { - dna.geida_time -= 1; - if (dna.geida_time == 0) dna.geida_spin = 0; - } - - if (with.y < (tr[1].y - 2)) { - /* Geida is further from the screen than Avvy. */ - spin(down, tripnum); - with.iy = 1; - with.ix = 0; - take_a_step(tripnum); - return; - } else if (with.y > (tr[1].y + 2)) { - /* Avvy is further from the screen than Geida. */ - spin(up, tripnum); - with.iy = -1; - with.ix = 0; - take_a_step(tripnum); - return; - } - - with.iy = 0; - if (with.x < tr[1].x - tr[1].xs * 8) { - with.ix = tr[1].xs; - spin(right, tripnum); - take_a_step(tripnum); - } else if (with.x > tr[1].x + tr[1].xs * 8) { - with.ix = -tr[1].xs; - spin(left, tripnum); - take_a_step(tripnum); - } else with.ix = 0; - } -} - -/* That's all... */ - -void call_andexors() { - array<1, 5, byte> order; - byte fv, temp; - boolean ok; - - fillchar(order, 5, '\0'); - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick && with.visible) - order[fv] = fv; - } - - do { - ok = true; - for (fv = 1; fv <= 4; fv ++) - if (((order[fv] != 0) && (order[fv + 1] != 0)) - && (tr[order[fv]].y > tr[order[fv + 1]].y)) { - /* Swap them! */ - temp = order[fv]; - order[fv] = order[fv + 1]; - order[fv + 1] = temp; - ok = false; - } - } while (!ok); - - for (fv = 1; fv <= 5; fv ++) - if (order[fv] > 0) - tr[order[fv]].andexor(); -} - -void trippancy_link() { - byte fv; - - if (ddmnow | ontoolbar | seescroll) return; - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) walk(); - } - call_andexors(); - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick && with.call_eachstep) { - switch (tr[fv].eachstep) { - case procfollow_avvy_y : - follow_avvy_y(fv); - break; - case procback_and_forth : - back_and_forth(fv); - break; - case procface_avvy : - face_avvy(fv); - break; - case procarrow_procs : - arrow_procs(fv); - break; - /* PROCSpludwick_procs : spludwick_procs(fv);*/ - case procgrab_avvy : - grab_avvy(fv); - break; - case procgeida_procs : - geida_procs(fv); - break; - } - } - } - if (mustexclaim) { - mustexclaim = false; - dixi('x', saywhat); - } -} - -void get_back_loretta() { - byte fv; - - /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ - for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { - getback(); - return; - } - /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ -} - -void stopwalking() { - tr[1].stopwalk(); - dna.rw = stopped; - if (alive) tr[1].step = 1; -} - -void tripkey(char dir) { - if ((ctrl == cjoy) | (~ dna.user_moves_avvy)) return; - - { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (rw != up) { - rw = up; - rwsp(1, rw); - } else stopwalking(); - break; - case 'P': - if (rw != down) { - rw = down; - rwsp(1, rw); - } else stopwalking(); - break; - case 'K': - if (rw != left) { - rw = left; - rwsp(1, rw); - } else stopwalking(); - break; - case 'M': - if (rw != right) { - rw = right; - rwsp(1, rw); - } else stopwalking(); - break; - case 'I': - if (rw != ur) { - rw = ur; - rwsp(1, rw); - } else stopwalking(); - break; - case 'Q': - if (rw != dr) { - rw = dr; - rwsp(1, rw); - } else stopwalking(); - break; - case 'O': - if (rw != dl) { - rw = dl; - rwsp(1, rw); - } else stopwalking(); - break; - case 'G': - if (rw != ul) { - rw = ul; - rwsp(1, rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } - } - } -} - -void readstick() { - byte jw; - - if (ctrl == ckey) return; - - jw = joyway; - - { - triptype &with = tr[1]; - - if (jw == stopped) stopwalking(); - else { - dna.rw = jw; - rwsp(1, dna.rw); - } - } - - if (jw != oldjw) { - showrw; - oldjw = jw; - } - -} - -void getsetclear() { - byte fv; - - for (fv = 0; fv <= 1; fv ++) getset[fv].init(); -} - -void hide_in_the_cupboard() { - const char nowt = '\372'; /* As in Acci. */ - - { - if (avvys_in_the_cupboard) { - if (wearing == nowt) - display("\6AVVY!\22 Get dressed first!"); - else { - tr[1].visible = true; - user_moves_avvy = true; - apped(1, 3); /* Walk out of the cupboard. */ - display("You leave the cupboard. Nice to be out of there!"); - avvys_in_the_cupboard = false; - first_show(8); - then_show(7); - start_to_close; - } - } else { - /* Not hiding in the cupboard */ - tr[1].visible = false; - user_moves_avvy = false; - display(string("You walk into the room...\20It seems to be an empty, ") + - "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + - "avoid suffocation."); - avvys_in_the_cupboard = true; - show_one(8); - } - } -} - -void fliproom(byte room, byte ped); -static integer beforex, beforey; -static void tidy_after_mouse(); - - -static void tidy_up(integer a, integer b, integer c, integer d) { - bytefield bf; - - { - x1 = a / 8; - y1 = b; - x2 = (c + 7) / 8; - y2 = d; - setactivepage(0); - rectangle(x1 * 8, y1, x2 * 8 + 7, y2); - } - getset[0].remember(bf); - getset[1].remember(bf); -} - - - -static void tidy_after_mouse() { - tidy_up(beforex, beforey, beforex + 15, beforey + 15); - xycheck; - tidy_up(mx, my, mx + 15, my + 15); -} - -void fliproom(byte room, byte ped) { - byte fv; - - - if (~ alive) { - /* You can't leave the room if you're dead. */ - tr[1].ix = 0; - tr[1].iy = 0; /* Stop him from moving. */ - return; - } - - if ((ped == 177) && (dna.room == r__lusties)) { - hide_in_the_cupboard(); - return; - } - - if ((dna.jumpstatus > 0) && (dna.room == r__insidecardiffcastle)) { - /* You can't *jump* out of Cardiff Castle! */ - tr[1].ix = 0; - return; - } - - xycheck; - beforex = mx; - beforey = my; - - exitroom(dna.room); - dusk; - getsetclear(); - - - for (fv = 2; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick) done(); - } /* Deallocate sprite */ - - if (dna.room == r__lustiesroom) - dna.enter_catacombs_from_lusties_room = true; - - enterroom(room, ped); - apped(1, ped); - dna.enter_catacombs_from_lusties_room = false; - oldrw = dna.rw; - dna.rw = tr[1].face; - showrw; - - for (fv = 0; fv <= 1; fv ++) { - cp = 1 - cp; - getback(); - } - dawn; - - /* Tidy up after mouse. I know it's a kludge... */ - /* tidy_after_mouse;*/ -} - -boolean infield(byte which) -/* returns True if you're within field "which" */ -{ - integer yy; - - boolean infield_result; - { - void &with = fields[which]; - { - triptype &with = tr[1]; - - yy = with.y + with.a.yl; - infield_result = (with.x >= x1) && (with.x <= x2) && (yy >= y1) && (yy <= y2); - } - } - return infield_result; -} - -boolean neardoor() { /* returns True if you're near a door! */ - integer ux, uy; - byte fv; - boolean nd; - - boolean neardoor_result; - if (numfields < 9) { - /* there ARE no doors here! */ - neardoor_result = false; - return neardoor_result; - } - { - triptype &with = tr[1]; - - ux = with.x; - uy = with.y + with.a.yl; - } - nd = false; - for (fv = 9; fv <= numfields; fv ++) { - void &with = fields[fv]; - - if ((ux >= x1) && (ux <= x2) && (uy >= y1) && (uy <= y2)) nd = true; - } - neardoor_result = nd; - return neardoor_result; -} - -void new_game_for_trippancy() { /* Called by gyro.newgame */ - tr[1].visible = false; -} - -void triptype::save_data_to_mem(word &where) { - trip_saver_type tripsaver; - - set_up_saver(tripsaver); - move(tripsaver, mem[storage_seg * where], sizeof(tripsaver)); - where += sizeof(tripsaver); -} - -void triptype::load_data_from_mem(word &where) { - word spritewas, spriteis, saveface, savex, savey, savestep; - boolean wasquick; - trip_saver_type tripsaver; - - move(mem[storage_seg * where], tripsaver, sizeof(tripsaver)); - where += sizeof(tripsaver); - unload_saver(tripsaver); - - spriteis = whichsprite; - savex = x; - savey = y; - saveface = face; - savestep = step; - - init(spriteis, check_me); - - appear(savex, savey, saveface); - unload_saver(tripsaver); - step = savestep; -} - -class unit_trip5_initialize { -public: - unit_trip5_initialize(); -}; -static unit_trip5_initialize trip5_constructor; - -unit_trip5_initialize::unit_trip5_initialize() { - getsetclear(); - mustexclaim = false; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5.h b/engines/avalanche/trip5.h deleted file mode 100644 index 06642813e6ef..000000000000 --- a/engines/avalanche/trip5.h +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __trip5_h__ -#define __trip5_h__ - - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Gyro.h"*/ -/*#include "Sticks.h"*/ - -namespace Avalanche { - - -const integer maxgetset = 35; - -typedef array<5, 2053, byte> manitype; - -typedef matrix<0, 50, 0, 10, byte> siltype; /* 35, 4 */ - -struct adxtype { /* Second revision of ADX type */ - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ -}; - -struct trip_saver_type { - byte whichsprite; - byte face; - byte step; - integer x; - integer y; - shortint ix; - shortint iy; - boolean visible; - boolean homing; - boolean check_me; - byte count; - byte xw, xs, ys; - byte totalnum; - integer hx; - integer hy; - boolean call_eachstep; - byte eachstep; - boolean vanishifstill; -}; - -class triptype { -public: - adxtype a; /* vital statistics */ - byte face, step; - integer x, y; /* current xy coords */ - array<0, 1, integer> ox, oy; /* last xy coords */ - shortint ix, iy; /* amount to move sprite by, each step */ - array<1, 24, manitype *> mani; - array<1, 24, siltype *> sil; - byte whichsprite; - boolean quick, visible, homing, check_me; - integer hx, hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - byte xw; /* x-width in bytes */ - byte xs, ys; /* x & y speed */ - byte totalnum; /* total number of sprites */ - boolean vanishifstill; /* Do we show this sprite if it's still? */ - - boolean call_eachstep; /* Do we call the eachstep procedure? */ - byte eachstep; - - triptype *init(byte spritenum, boolean do_check); - /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx, integer wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(byte pednum); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ - void set_up_saver(trip_saver_type &v); - void unload_saver(trip_saver_type v); - void savedata(untyped_file &f); /* Self-explanatory, */ - void loaddata(untyped_file &f); /* really. */ - void save_data_to_mem(word &where); - void load_data_from_mem(word &where); - triptype *done(); -}; - -class getsettype { -public: - array<1, maxgetset, bytefield> gs; - byte numleft; - - getsettype *init(); - void remember(bytefield r); - void recall(bytefield &r); -}; - - -const integer up = 0; -const integer right = 1; -const integer down = 2; -const integer left = 3; -const integer ur = 4; -const integer dr = 5; -const integer dl = 6; -const integer ul = 7; -const integer stopped = 8; - -const integer numtr = 5; /* current max no. of sprites */ - - - -const integer procfollow_avvy_y = 1; - -const integer procback_and_forth = 2; - -const integer procface_avvy = 3; - -const integer procarrow_procs = 4; - -const integer procspludwick_procs = 5; - -const integer procgrab_avvy = 6; - -const integer procgeida_procs = 7; - - -void trippancy_link(); - -void get_back_loretta(); - -void loadtrip(); - -void call_special(word which); - -void open_the_door(byte whither, byte ped, byte magicnum); /* Handles slidey-open doors. */ - -void catamove(byte ped); - -void stopwalking(); - -void tripkey(char dir); - -void rwsp(byte t, byte r); - -void apped(byte trn, byte np); - -void getback(); - -void fliproom(byte room, byte ped); - -boolean infield(byte which); /* returns True if you're within field "which" */ - -boolean neardoor(); /* returns True if you're near a door! */ - -void readstick(); - -void newspeed(); - -void new_game_for_trippancy(); - - -#ifdef __trip5_implementation__ -#undef EXTERN -#define EXTERN -#endif - -EXTERN array<1, numtr, triptype> tr; -EXTERN array<0, 1, getsettype> getset; -EXTERN array<1, 16000, byte> aa; - -EXTERN boolean mustexclaim; -EXTERN word saywhat; -#undef EXTERN -#define EXTERN extern - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/trip5tst.cpp b/engines/avalanche/trip5tst.cpp deleted file mode 100644 index 98f0afaa2511..000000000000 --- a/engines/avalanche/trip5tst.cpp +++ /dev/null @@ -1,159 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -/*$R+*/ - -namespace Avalanche { - -struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -integer gd, gm; -untyped_file inf; -adxtype a; -array<1, 16000, byte> aa; -array<5, 2053, byte> mani; -matrix<0, 35, 0, 4, byte> sil; -byte xw; - -void filesetup() { - const integer idshould = -1317732048; - longint id; - word soa; - assign(inf, "v:sprite2.avd"); - reset(inf, 1); - seek(inf, 177); - blockread(inf, id, 4); - if (id != idshould) { - output << '\7'; - close(inf); - exit(0); - } - - blockread(inf, soa, 2); - blockread(inf, a, soa); -} - -void loadpic() { - byte fv, ff; - { - xw = a.xl / 8; - if ((a.xl % 8) > 0) xw += 1; - - /* aa[1]:=xl; aa[2]:=0; aa[3]:=yl; aa[4]:=0;*/ - /* The putimage x&y codes are words but xl & yl are bytes, hence the #0s. */ - /* seek(inf,filepos(inf)+xw*(yl+1));*/ - for (fv = 0; fv <= a.yl; fv ++) - blockread(inf, sil[fv], xw); - blockread(inf, mani, a.size - 6); - /* blockread(inf,aa[5+fv*xw*4+xw*ff],xw);*/ - aa[a.size - 1] = 0; - aa[a.size] = 0; /* footer */ - } - /* putimage(0,0,aa,0);*/ -} - -void plotone(integer xx, integer yy) { - word s; - word ofs, fv; - byte x, y, z; - { - s = imagesize(x, y, xx + a.xl, yy + a.yl); - getimage(xx, yy, xx + a.xl, yy + a.yl, aa); /* Now loaded into our local buffer. */ - - /* Now we've got to modify it! */ - - for (x = 0; x <= 3; x ++) - for (y = 0; y <= 35; y ++) - for (z = 0; z <= 4; z ++) { - ofs = 5 + y * xw * 4 + xw * x + z; - aa[ofs] = aa[ofs] & sil[y][z]; - } - - /* mov ax,5 ; AX = ofs - mov bx,xw ; wherever we get xw from - mov cx,x ; ditto - mov dx,y ; ditto - mul cx,bx ; x*xw - mul dx,bx ; y*yw - add ax,cx ; now add 'em all up - add ax,dx ; ... - mov bx,z ; get z (we don't need x any more) - mov cx,syz ; get silyz (where from??!) - add ax,bx ; add on the last part of the addition - and ax,cx ; AND ax with cx. That's it! */ - - /* - for x:=1 to 4 do - begin; - for y:=0 to 35 do - for z:=0 to 4 do - begin; - ofs:=5+y*xw*4+xw*x+z; - aa[ofs]:=aa[ofs] xor pic[x,y,z]; - end; - end; - */ - - for (fv = 5; fv <= a.size - 2; fv ++) - aa[fv] = aa[fv] ^ mani[fv]; - - /* Now.. let's try pasting it back again! */ - - putimage(xx, yy, aa, 0); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - initgraph(gd, gm, ""); - setfillstyle(6, 1); - bar(0, 0, 640, 200); - filesetup(); - for (gd = 1; gd <= 9; gd ++) loadpic(); - do { - plotone(Random(500), Random(150)); - } while (!keypressed()); - plotone(0, 0); - close(inf); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/trip5xf.cpp b/engines/avalanche/trip5xf.cpp deleted file mode 100644 index 1f701db67867..000000000000 --- a/engines/avalanche/trip5xf.cpp +++ /dev/null @@ -1,205 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const string crlf = string('\15') + '\12'; -const char eof_ = '\32'; -const array<1, 177, char> trip5head = - string("Sprite*.AVD ... data file for Trippancy Five") + crlf + crlf + - "[Thorsoft relocatable fiveplane sprite image format]" + crlf + crlf + - "Thomas Thurman was here. ... Have fun!" + crlf + crlf + eof_ + - " * G. I. E. D. ! * "; - -const array<1, 4, char> tripid = string('\x30') + '\x1' + '\x75' + '\261'; - -const array<1, 50, char> trip5foot = crlf + crlf + - " and that's it! Enjoy the game. " + '\3' + crlf + crlf + - "\n\n\n\n\n\n\n" + "tt"; - -struct adxotype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -struct adxtype { - varying_string<12> name; /* name of character */ - varying_string<16> comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -varying_string<2> sn; -adxotype oa; -adxtype a; -matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ -array<1, 16000, byte> aa; -untyped_file out; -integer bigsize; - -void copyaoa() { - { - a.name = oa.name; - a.comment = "Transferred"; - a.num = oa.num; - a.xl = oa.xl; - a.yl = oa.yl; - a.seq = oa.seq; - a.size = oa.size; - a.fgc = oa.fgc; - a.bgc = oa.bgc; - } -} - -void load() { - untyped_file f; - byte gd, gm, sort, n; - pointer p, q; - pointer xf; - assign(f, string("v:osprte") + sn + ".avd"); - reset(f, 1); - seek(f, 59); - blockread(f, oa, sizeof(oa)); - blockread(f, bigsize, 2); - copyaoa(); - - getmem(xf, a.size); - - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - blockread(f, p, bigsize); - putimage(0, 0, p, 0); - release(q); - n = 1; - - if (sort == 0) setfillstyle(1, 15); - else setfillstyle(1, 0); - bar(177, 125, 300, 200); - - for (gm = 0; gm <= (a.num / a.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= a.seq - 1; gd ++) { /* steps */ - getmem(pic[n][sort], a.size); /* grab the memory */ - getimage((gm / 2) * (a.xl * 6) + gd * a.xl, (gm % 2)*a.yl, - (gm / 2) * (a.xl * 6) + gd * a.xl + a.xl - 1, (gm % 2)*a.yl + a.yl - 1, - xf); - putimage(177, 125, xf, 0); - getimage(177, 125, 177 + a.xl, 125 + a.yl, pic[n][sort]); /* grab the pic */ - n += 1; - } - } - close(f); - freemem(xf, a.size); - cleardevice(); - for (gm = 0; gm <= 1; gm ++) - for (gd = 1; gd <= a.num; gd ++) - putimage(gd * 15, gm * 40, pic[gd][gm], 0); -} - -void setup() { - integer gd, gm; - output << "TRIP5XF (c) 1992, Thomas Thurman." << NL; - output << NL; - output << "Enter number of SPRITE*.AVD file to convert:"; - input >> sn >> NL; - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - load(); -} - -string strf(longint x) { - string q; - string strf_result; - str(x, q); - strf_result = q; - return strf_result; -} - -void save() { - byte sort, n; - word fv, ff; - char r; - byte xw; - byte nxl, nyl; - word soa; - cleardevice(); - { - a.size = imagesize(0, 0, a.xl, a.yl); - soa = sizeof(a); - - assign(out, string("v:sprite") + sn + ".avd"); - rewrite(out, 1); - blockwrite(out, trip5head, 177); - blockwrite(out, tripid, 4); - blockwrite(out, soa, 2); - blockwrite(out, a, soa); - - nxl = a.xl; - nyl = a.yl; - xw = nxl / 8; - if ((nxl % 8) > 0) xw += 1; - - for (n = 1; n <= a.num; n ++) { - putimage(0, 0, pic[n][0], 0); - getimage(0, 0, a.xl, a.yl, aa); - for (fv = 0; fv <= nyl; fv ++) - blockwrite(out, aa[5 + fv * xw * 4], xw); - - putimage(100, 0, pic[n][1], 0); - getimage(100, 0, 100 + a.xl, a.yl, aa); - putimage(100, 100, aa, 4); - /* for ff:=1 to 4 do { actually 2 to 5, but it doesn't matter here } - for fv:=0 to nyl do*/ - /* for ff:=5 to size-2 do - blockwrite(out,aa[ff],1);*/ - blockwrite(out, aa[5], a.size - 6); - } - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - save(); - - blockwrite(out, trip5foot, 50); - close(out); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/tripoop.cpp b/engines/avalanche/tripoop.cpp deleted file mode 100644 index 6e98d800c0c9..000000000000 --- a/engines/avalanche/tripoop.cpp +++ /dev/null @@ -1,352 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* Trip Oop (Trippancy 4 Andexor */ -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const integer up = 0; -const integer right = 1; -const integer down = 2; -const integer left = 3; - -const integer numtr = 1; /* current max no. of sprites */ - -struct adxtype { - varying_string<12> name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - word size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - -class triptype { -public: - adxtype a; /* vital statistics */ - byte face, step; - integer x, y; /* current xy coords */ - integer ox, oy; /* last xy coords */ - integer tax, tay; /* "behind" taken at... */ - shortint ix, iy; /* amount to move sprite by, each step */ - matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */ - boolean quick, visible, homing; - pointer behind; /* what's behind you */ - integer hx, hy; /* homing x & y coords */ - - triptype *init(byte spritenum); /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen 1 */ - void turn(byte whichway); /* turns him round */ - void appear(integer wx, integer wy, byte wf); /* switches him on */ - void walk(); /* prepares for do_it, andexor, etc. */ - void do_it(); /* Actually copies the picture over */ - void getback(); /* gets background before sprite is drawn */ - void putback(); /* ...and wipes sprite from screen 1 */ - void walkto(integer xx, integer yy); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(shortint xx, shortint yy); /* sets ix & iy, non-homing, etc */ - void halt(); /* Stops the sprite from moving */ -}; - -integer gd, gm; -array<1, 1, triptype> tr; - -void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4); - - -static boolean dropin(integer xc, integer yc, integer x1, integer y1, integer x2, integer y2) -/* Dropin returns True if the point xc,yc falls within the 1-2 rectangle. */ -{ - boolean dropin_result; - dropin_result = ((xc >= x1) && (xc <= x2) && (yc >= y1) && (yc <= y2)); - return dropin_result; -} - - - -static void transfer(integer x1, integer y1, integer x2, integer y2) { - pointer p, q; - word s; - s = imagesize(x1, y1, x2, y2); - setfillstyle(1, 0); - mark(q); - getmem(p, s); - setactivepage(1); - getimage(x1, y1, x2, y2, p); - setactivepage(0); - putimage(x1, y1, p, copyput); - setactivepage(1); - release(q); -} - - - -static integer lesser(integer a, integer b) { - integer lesser_result; - if (a < b) lesser_result = a; - else lesser_result = b; - return lesser_result; -} - - - -static integer greater(integer a, integer b) { - integer greater_result; - if (a > b) greater_result = a; - else greater_result = b; - return greater_result; -} - -void copier(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer x4, integer y4) - -{ - if (dropin(x3, y3, x1, y1, x2, y2) - || dropin(x3, y4, x1, y1, x2, y2) - || dropin(x4, y3, x1, y1, x2, y2) - || dropin(x4, y4, x1, y1, x2, y2)) { - ; /* Overlaps */ - transfer(lesser(x1, x3), lesser(y1, y3), greater(x2, x4), greater(y2, y4)); - } else { - ; /* Doesn't overlap- copy both of them seperately */ - transfer(x3, y3, x4, y4); /* backwards- why not...? */ - transfer(x1, y1, x2, y2); - } -} - -void setup() { - integer gd, gm; - gd = 3; - gm = 0; - initgraph(gd, gm, ""); - for (gd = 0; gd <= 1; gd ++) { - setactivepage(gd); - setfillstyle(9, 1); - bar(0, 0, 640, 200); - } - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); -} - -triptype *triptype::init(byte spritenum) { - integer gd, gm; - word s; - untyped_file f; - varying_string<2> xx; - pointer p, q; - word bigsize; - byte sort, n; - str(spritenum, xx); - assign(f, string("v:sprite") + xx + ".avd"); - reset(f, 1); - seek(f, 59); - blockread(f, a, sizeof(a)); - blockread(f, bigsize, 2); - setvisualpage(3); - setactivepage(3); - for (sort = 0; sort <= 1; sort ++) { - mark(q); - getmem(p, bigsize); - blockread(f, p, bigsize); - putimage(0, 0, p, 0); - release(q); - n = 1; - { - adxtype &with = a; - for (gm = 0; gm <= (with.num / with.seq) - 1; gm ++) /* directions */ - for (gd = 0; gd <= with.seq - 1; gd ++) { /* steps */ - getmem(pic[n][sort], a.size); /* grab the memory */ - getimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, - (gm / 2) * (with.xl * 6) + gd * with.xl + with.xl - 1, (gm % 2)*with.yl + with.yl - 1, - pic[n][sort]); /* grab the pic */ - putimage((gm / 2) * (with.xl * 6) + gd * with.xl, (gm % 2)*with.yl, - pic[n][sort], notput); /* test the pic */ - n += 1; - } - } - } - close(f); - setactivepage(0); - setvisualpage(0); - x = 0; - y = 0; - quick = true; - visible = false; - getmem(behind, a.size); - homing = false; - ix = 0; - iy = 0; - return this; -} - -void triptype::original() { - quick = false; -} - -void triptype::getback() { - tax = x; - tay = y; - getimage(x, y, x + a.xl, y + a.yl, behind); -} - -void triptype::andexor() { - byte picnum; /* Picnum, Picnic, what ye heck */ - picnum = face * a.seq + step + 1; - putimage(x, y, pic[picnum][0], andput); - putimage(x, y, pic[picnum][1], xorput); -} - -void triptype::turn(byte whichway) { - face = whichway; - step = 0; -} - -void triptype::appear(integer wx, integer wy, byte wf) { - x = wx; - y = wy; - ox = wx; - oy = wy; - turn(wf); - visible = true; -} - -void triptype::walk() { - ox = x; - oy = y; - if (homing) homestep(); - x = x + ix; - y = y + iy; - step += 1; - if (step == a.seq) step = 0; - getback(); -} - -void triptype::do_it() { - copier(ox, oy, ox + a.xl, oy + a.yl, x, y, x + a.xl, y + a.yl); -} - -void triptype::putback() { - putimage(tax, tay, behind, 0); -} - -void triptype::walkto(integer xx, integer yy) { - speed(xx - x, yy - y); - hx = xx; - hy = yy; - homing = true; -} - -void triptype::stophoming() { - homing = false; -} - -void triptype::homestep() { - integer temp; - if ((hx == x) && (hy == y)) { - ; /* touching the target */ - homing = false; - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; - } -} - -void triptype::speed(shortint xx, shortint yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ - if (ix == 0) { - ; /* No horz movement */ - if (iy < 0) turn(up); - else turn(down); - } else { - if (ix < 0) turn(left); - else turn(right); - } -} - -void triptype::halt() { - ix = 0; - iy = 0; - homing = false; -} - -void trip() { - byte fv; - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - walk(); - if (with.quick && with.visible) andexor(); - do_it(); - putback(); - } -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - { - triptype &with = tr[1]; - init(1); - appear(600, 100, left); - do { - /* - speed(-5,0); repeat trip until keypressed or (x= 0); - speed( 5,0); repeat trip until keypressed or (x=600); - */ - walkto(10, 10); - do { - trip(); - } while (!(keypressed() || ! with.homing)); - walkto(70, 150); - do { - trip(); - } while (!(keypressed() || ! with.homing)); - walkto(600, 77); - do { - trip(); - } while (!(keypressed() || ! with.homing)); - } while (!keypressed()); - } - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/ttmenuxf.cpp b/engines/avalanche/ttmenuxf.cpp deleted file mode 100644 index bc9fbafa238b..000000000000 --- a/engines/avalanche/ttmenuxf.cpp +++ /dev/null @@ -1,169 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Tommys.h"*/ -/*#include "Crt.h"*/ - -namespace Avalanche { - -integer gd, gm; -word s; -pointer p; -file f; -byte bit; - -void load() { /* Load2, actually */ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ - byte bit; - untyped_file f; - varying_string<2> xx; - boolean was_virtual; - - assign(f, "v:ttmenu.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void finder() { - char r; - integer x, y; - setfillstyle(0, 0); - setcolor(14); - x = 320; - y = 100; - setwritemode(xorput); - do { - bar(0, 0, 200, 10); - outtextxy(0, 0, strf(x) + ',' + strf(y)); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - do { - } while (!keypressed()); - line(x - 20, y, x + 20, y); - line(x, y - 20, x, y + 20); - switch (readkey()) { - case '\15': - return; - break; - case '8': - y -= 10; - break; - case '4': - x -= 10; - break; - case '6': - x += 10; - break; - case '2': - y += 10; - break; - case '\0': - switch (readkey()) { - case cup: - y -= 1; - break; - case cdown: - y += 1; - break; - case cleft: - x -= 1; - break; - case cright: - x += 1; - break; - } - break; - } - } while (!false); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 1; - initgraph(gd, gm, ""); - load(); - finder(); - s = imagesize(342, 21, 407, 119); - getmem(p, s); - getimage(342, 21, 407, 119, p); - putimage(342, 21, p, 4); - input >> NL; - putimage(264, 120, p, 0); - input >> NL; - freemem(p, s); - - s = imagesize(264, 12, 329, 217); - getmem(p, s); - getimage(264, 21, 329, 218, p); - putimage(264, 21, p, 4); - putimage(0, 0, p, 0); - freemem(p, s); - input >> NL; - - s = imagesize(180, 103, 188, 135); - getmem(p, s); - getimage(180, 103, 188, 135, p); - putimage(0, 200, p, 0); - input >> NL; - - assign(f, "v:menu.avd"); - rewrite(f); - - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (gd = 0; gd <= 196; gd ++) - for (gm = 0; gm <= 8; gm ++) { - f << mem[0xa000 * gd * 80 + gm]; - mem[0xa000 * gd * 80 + gm] = ~ mem[0xa000 * gd * 80 + gm]; - } - - for (gd = 200; gd <= 232; gd ++) { - f << mem[0xa000 * gd * 80]; - mem[0xa000 * gd * 80] = ~ mem[0xa000 * gd * 80]; - } - } - - close(f); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/unsquish.cpp b/engines/avalanche/unsquish.cpp deleted file mode 100644 index 78ac9997d626..000000000000 --- a/engines/avalanche/unsquish.cpp +++ /dev/null @@ -1,552 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$S-*/ -#include "graph.h" - -namespace Avalanche { - -typedef array<1, 50000, byte> buffertype; - -integer gd, gm; -varying_string<29> describe; -byte method; -shortint bit; -word offset; -byte a0; /*absolute $A000:800;*/ -array<1, 12080, byte> a7; /*absolute $A000:800;*/ -buffertype *buffer; -word bufsize; - -void putup(byte what) { - if (offset > 12080) { - bit += 1; - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - offset = 1; - } - - a7[offset] = what; - offset += 1; -} - -void load_uncomp(string xx) /* Load2, actually */ -/* a1:byte absolute $A000:17184;*/ -{ - byte this_; - untyped_file f; - word place; - assign(f, string("v:place") + xx + ".avd"); - reset(f, 1); - seek(f, 146); - blockread(f, describe, 30); - blockread(f, method, 1); - bufsize = filesize(f) - 177; - blockread(f, *buffer, bufsize); - close(f); - - bit = -1; - offset = 12081; - place = 1; - - while (place <= bufsize) { - this_ = (*buffer)[place]; - place += 1; - putup(this_); - } - - output << method << " : \"" << describe << '"' << NL; -} - -void load_comp(string xx); - -const integer maxtab = 4095 /* Table size - 1 ==> 2**10-1 ==> 12 bits */; - -const integer no_prev = -1 /* Special code for no previous character */; - -const integer end_list = -1 /* Marks end of a list */; - -const integer maxstack = 4096 /* Decompression stack size */; - - - - -/* One node in parsing table. */ -struct string_table_entry { - boolean unused /* Is this node *NOT* used yet?*/; - integer prevchar /* Code for preceding string */; - integer follchar /* Code for current character */; - integer next /* Next dupl in collision list */; -}; - - - -typedef array<0, maxtab, string_table_entry> sttype; - - -/* String table */ - -static sttype *string_table; - - -static integer table_used /* # string table entries used */; - -static byte input_code /* Input compressed code */; - -static boolean inempty, popempty; - -/* Decompression stack */ - -static array<1, maxstack, byte> stack; - - -static integer stack_pointer /* Decompression stack depth */; - -static word place; - - -static integer get_hash_code(integer &prevc, integer &follc) - -{ - integer index; - integer index2; - - /* Get_Hash_Code */ - /* Get initial index using hashing */ - - integer get_hash_code_result; - index = ((prevc << 5) ^ follc) & maxtab; - - /* If entry not already used, return */ - /* its index as hash code for C. */ - - if ((*string_table)[index].unused) - get_hash_code_result = index; - else - /* If entry already used, search to */ - /* end of list of hash collision */ - /* entries for this hash code. */ - /* Do linear probe to find an */ - /* available slot. */ - { - - /* Skip to end of collision list ... */ - - while ((*string_table)[index].next != end_list) - index = (*string_table)[index].next; - - /* Begin linear probe down a bit from */ - /* last entry in collision list ... */ - - index2 = (index + 101) & maxtab; - - /* Look for unused entry using linear */ - /* probing ... */ - - while (!(*string_table)[index2].unused) - index2 = succ(integer, index2) & maxtab; - - /* Point prior end of collision list */ - /* to this new node. */ - - (*string_table)[index].next = index2; - - /* Return hash code for C */ - - get_hash_code_result = index2; - - } - - return get_hash_code_result; -} /* Get_Hash_Code */ - - - -/*--------------------------------------------------------------------------*/ -/* Make_Table_Entry --- Enter C string in string table */ -/*--------------------------------------------------------------------------*/ - -static void make_table_entry(integer &prevc, integer &follc) - -{ - /* Make_Table_Entry */ - /* Only enter string if there is room left */ - - if (table_used <= maxtab) { - { - string_table_entry &with = (*string_table)[ get_hash_code(prevc , follc) ]; - - with.unused = false; - with.next = end_list; - with.prevchar = prevc; - with.follchar = follc; - } - /* Increment count of items used */ - - table_used += 1; - /* - IF ( Table_Used > ( MaxTab + 1 ) ) THEN - BEGIN - WRITELN('Hash table full.'); - END; - */ - } - -} /* Make_Table_Entry */ - - - -static void firstentries() -/* This is just a fast version of the above, when PrevC = No_Prev. TT. */ - -{ - integer i, j; - - - /* There MUST be room- we've only just started! */ - - j = no_prev; - - for (i = 0; i <= 255; i ++) { - string_table_entry &with = (*string_table)[((no_prev << 5) ^ i) & maxtab]; - - with.unused = false; - with.next = end_list; - with.prevchar = no_prev; - with.follchar = i; - } - - table_used += 256; /* Increment count of items used */ - -} - - - -/*--------------------------------------------------------------------------*/ -/* Initialize_String_Table --- Initialize string table */ -/*--------------------------------------------------------------------------*/ - -static void initialize_string_table() - -{ - integer i; - - /* Initialize_String_Table */ - - /* No entries used in table yet */ - table_used = 0; - - fillchar(*string_table, (maxtab + 1)*sizeof((*string_table)[1]), '\377'); - /* Enter all single characters into */ - /* table */ - firstentries(); - -} /* Initialize_String_Table */ - - - -/*--------------------------------------------------------------------------*/ -/* Lookup_String --- Look for string C in string table */ -/*--------------------------------------------------------------------------*/ - -static integer lookup_string(integer prevc, integer follc) - -{ - integer index; - integer index2; - boolean found; - - /* Lookup_String */ - /* Initialize index to check from hash */ - - integer lookup_string_result; - index = ((prevc << 5) ^ follc) & maxtab; - - /* Assume we won't find string */ - lookup_string_result = end_list; - /* Search through list of hash collision */ - /* entries for one that matches C */ - do { - - found = ((*string_table)[index].prevchar == prevc) && - ((*string_table)[index].follchar == follc); - - if (! found) - index = (*string_table)[index].next; - - } while (!(found || (index == end_list))); - - /* Return index if C found in table. */ - if (found) - lookup_string_result = index; - - return lookup_string_result; -} /* Lookup_String */ - - - -/*--------------------------------------------------------------------------*/ -/* Push --- Push character onto stack */ -/*--------------------------------------------------------------------------*/ - -static void push(byte c) - -{ - /* Push */ - - stack_pointer += 1; - stack[ stack_pointer ] = c; - - if (stack_pointer >= maxstack) { - output << "Stack overflow!" << NL; - exit(0); - } - -} /* Push */ - - - -/*--------------------------------------------------------------------------*/ -/* Pop --- Pop character from stack */ -/*--------------------------------------------------------------------------*/ - -static void pop(integer &c) - -{ - /* Pop */ - - popempty = stack_pointer == 0; - - if (! popempty) { - c = stack[stack_pointer]; - stack_pointer -= 1; - } - -} /* Pop */ - - - -/*--------------------------------------------------------------------------*/ -/* Get_Code --- Get compression code from input file */ -/*--------------------------------------------------------------------------*/ - -static void get_code(integer &hash_code) - -{ - byte local_buf; - - /* Get_Code */ - - if (inempty) { - - if (place > bufsize) return; - else { - local_buf = (*buffer)[place]; - place += 1; - } - - if (place > bufsize) return; - else { - input_code = (*buffer)[place]; - place += 1; - } - - hash_code = ((local_buf << 4) & 0xff0) + - (((cardinal)input_code >> 4) & 0xf); - - input_code = input_code & 0xf; - inempty = false; - - } else { - - if (place > bufsize) return; - else { - local_buf = (*buffer)[place]; - place += 1; - } - - hash_code = local_buf + ((input_code << 8) & 0xf00); - inempty = true; - - } - -} /* Get_Code */ - - - -/*--------------------------------------------------------------------------*/ -/* Do_Decompression --- Perform decompression */ -/*--------------------------------------------------------------------------*/ - -static void do_decompression() - -{ - integer c /* Current input character */; - integer code /* Current code string */; - integer old_code /* Previous code string */; - integer fin_char /* Final input character */; - integer in_code /* Current input code */; - integer last_char /* Previous character */; - boolean unknown /* TRUE if code not found */; - integer temp_c /* Char popped off stack */; - - /* Do_Decompression */ - - stack_pointer = 0; /* Decompression stack is empty */ - unknown = false; /* First string is always known */ - get_code(old_code); /* Get first string == Step 1 */ - code = old_code; - - c = (*string_table)[code].follchar; /* Output corresponding character */ - putup(c); - fin_char = c; /* Remember this character -- it */ - /* is final character of next string */ - - get_code(in_code); /* Get next code == Step 2 */ - - while (place <= bufsize) { - code = in_code; /* Set code to this input code */ - - /* If code not in table, do special */ - /* case ==> Step 3 */ - - if ((*string_table)[code].unused) { - last_char = fin_char; - code = old_code; - unknown = true; - } - /* Run through code extracting single */ - /* characters from code string until */ - /* no more characters can be removed. */ - /* Push these onto stack. They will */ - /* be entered in reverse order, and */ - /* will come out in forwards order */ - /* when popped off. */ - /* */ - /* ==> Step 4 */ - - while ((*string_table)[code].prevchar != no_prev) { - string_table_entry &with = (*string_table)[code]; - - push(with.follchar); - code = with.prevchar; - } - /* We now have the first character in */ - /* the string. */ - - fin_char = (*string_table)[code].follchar; - - /* Output first character ==> Step 5 */ - putup(fin_char); - /* While the stack is not empty, remove */ - /* and output all characters from stack */ - /* which are rest of characters in the */ - /* string. */ - /* */ - /* ==> Step 6 */ - pop(temp_c); - - while (! popempty) { - putup(temp_c); - pop(temp_c); - } - /* If code isn't known, output the */ - /* follower character of last character */ - /* of string. */ - if (unknown) { - fin_char = last_char; - putup(fin_char); - unknown = false; - } - /* Enter code into table ==> Step 7 */ - - make_table_entry(old_code , fin_char); - - /* Make current code the previous code */ - old_code = in_code; - - /* Get next code == Step 2 */ - get_code(in_code); - - } - -} /* Do_Decompression */ - -void load_comp(string xx) { - - /* This loads in the compressed file. */ - - const integer maxbuff = 8192 /* Buffer size for input and output files */; - - integer output_code /* Output compressed code */; - boolean if_compressing /* TRUE if compressing file */; - - byte this_; - untyped_file f; - - string_table = new sttype; - inempty = true; - initialize_string_table(); - - assign(f, string("v:compr") + xx + ".avd"); - reset(f, 1); - seek(f, 146); - blockread(f, describe, 30); - blockread(f, method, 1); - bufsize = filesize(f) - 177; - blockread(f, *buffer, bufsize); - close(f); - - bit = -1; - offset = 12081; - place = 1; - - do_decompression(); - - output << method << " : \"" << describe << '"' << NL; - - delete string_table; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - buffer = new buffertype; -#ifdef uncomp - load_uncomp("21"); -#else - load_comp("21"); -#endif - delete buffer; - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/viewdocs.cpp b/engines/avalanche/viewdocs.cpp deleted file mode 100644 index ff00aab57e65..000000000000 --- a/engines/avalanche/viewdocs.cpp +++ /dev/null @@ -1,580 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*$S-*/ -/*#include "dos.h"*/ -/*#include "crt.h"*/ -/*#include "tommys.h"*/ - -namespace Avalanche { - -typedef array<0, 49999, byte> bigtextarray; -struct chaptertype { - varying_string<60> headername; - word headeroffset; -}; -typedef array<1, 1120, byte> sbtype; - -const integer contsize = 29; /*number of headers in AVALOT.DOC*/ -const varying_string<80> contentsheader = " -=- The contents of the Lord AVALOT D'Argent (version 1.3) documentation -=-"; -const array<0, 15, byte> listpal = {{1, 0, 3, 0, 7, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0}}; -const array<0, 15, byte> blankpal = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; -const integer tabstop = 8; /*length of tab stops*/ - -/*NOTE: Tabs are not properly implemented. The program just interprets them*/ -/*as a number of spaces.*/ - -matrix<1, 256, 0, 15, byte> textvar, textvar8; -array<0, 1500, word> posof13; -array<1, 65535, byte> scvar; /*absolute $A000:$0000;*/ -sbtype stbar, stbar2; -pointer dpt; -word sot, nol, bat, bab, tlab, nosl, bfseg, bfofs, useless; -bigtextarray *textmem; -boolean atsof, fast, regimode; -byte hol; -varying_string<80> stline; -array<1, contsize, chaptertype> contlist; -integer lat; - -void wipeit(longint pos, word count) { /*Like fillchar, but wraps*/ - longint wpos; - - wpos = (word)(pos); - fillchar(mem[longint(0xa000) + wpos / longint(16)*wpos % longint(16)], count, 0); -} - -void wrapcopy(sbtype fromarr, longint pos) { /*Like fillchar, but wraps*/ - longint wpos; - - wpos = (word)(pos); - move(fromarr, mem[longint(0xa000) + wpos / longint(16)*wpos % longint(16)], 1120); -} - -void blankscreen() { /*blanks the screen (!)*/ - registers r; - - r.ax = 0x1002; - r.es = seg(blankpal); - r.dx = ofs(blankpal); - intr(0x10, r); -} - -void showscreen() { /*shows the screen (!)*/ - registers r; - - r.ax = 0x1002; - r.es = seg(listpal); - r.dx = ofs(listpal); - intr(0x10, r); -} - -void wipesb(word wheretop) { - byte plane; - - for (plane = 2; plane <= 3; plane ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << plane; - port[0x3cf] = plane; - fillchar(scvar[(wheretop + 336) * 80 + 1], 1120, 0); - } - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 2; - port[0x3cf] = 1; -} - -void displstat(byte wipepos) { /*displays the status bar*/ - byte plane; - - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 4; - port[0x3cf] = 2; - wrapcopy(stbar, (lat + 336) * 80); - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 8; - port[0x3cf] = 3; - wrapcopy(stbar2, (lat + 336) * 80); - for (plane = 2; plane <= 3; plane ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << plane; - port[0x3cf] = plane; - switch (wipepos) { - case 0: - wipeit((lat + 335) * 80 - 1, 80); - break; - case 1: - wipeit(lat * 80 - 1, 80); - break; - } - } - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 2; - port[0x3cf] = 1; -} - -void udstat() { /*updates the status bar*/ - varying_string<3> pt; - byte fv, fv2; - - fillchar(pt, 4, '\0'); - str(round((real)((tlab - 21)) / (nol - 21) * 100), pt); - for (fv = 1; fv <= 3; fv ++) - for (fv2 = 0; fv2 <= 13; fv2 ++) { - stbar[fv2 * 80 + fv + 68] = ~ textvar[ord(pt[fv]) + 1][fv2]; - stbar2[fv2 * 80 + fv + 68] = textvar[ord(pt[fv]) + 1][fv2]; - } -} - -void finddocinfo() /*finds the line breaks in AVALOT.DOC & finds the -headers by searching for '"""'*/ -{ - word wv, oldwv, varpos, varpos2, contlpos; - boolean thisaheader; - varying_string<60> headerstring; - - thisaheader = false; - posof13[0] = 65535; /*this +2 will wrap around to 1*/ - wv = 1; - oldwv = 1; - varpos = 1; - contlist[1].headername = "Start of documentation"; - contlist[1].headeroffset = 0; - contlpos = 2; - while (wv < sot) { - while (((*textmem)[wv] != 13) && ((*textmem)[wv] != 34) && (wv - oldwv < 80)) wv += 1; - switch ((*textmem)[wv]) { - case 13: { - posof13[varpos] = wv; - varpos += 1; - oldwv = wv + 1; - thisaheader = false; - } - break; - case 34: - if (((*textmem)[wv - 1] == 34) && ((*textmem)[wv - 2] == 34) && (varpos > 12) - && (thisaheader == false)) { - thisaheader = true; - headerstring[0] = '\0'; - varpos2 = posof13[varpos - 2] + 2; - while (((*textmem)[varpos2] == 32) || ((*textmem)[varpos2] == 9)) varpos2 += 1; - while (varpos2 != posof13[varpos - 1]) { - headerstring = headerstring + chr((*textmem)[varpos2]); - varpos2 += 1; - } - contlist[contlpos].headername = headerstring; - contlist[contlpos].headeroffset = varpos - 2; - contlpos += 1; - } - break; - } - wv += 1; - } - nol = varpos - 2; - nosl = nol * 14; -} - -void graphmode(byte gm) { /*puts the display adaptor into a specified mode*/ - registers regs; - - regs.ax = gm; - intr(0x10, regs); -} - -void setoffset(word where_on_screen) { - ; /*assembler; {for scrolling the screen*/ - /*asm - mov bx, where_on_screen - mov dx, $03D4 - mov ah, bh - mov al, $C - out dx, ax - - mov ah, bl - inc al - out dx, ax*/ -} - -void setupsb(byte sbtype) { /*sets up the status bar in several styles*/ - integer fv; - - switch (sbtype) { - case 1: - if (regimode == false) stline = string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits. C=") - + '\32' + "contents " + '\263' + " % through "; - else - stline = string("Doc lister: PgUp, PgDn, Home & End to move. Esc exits to main menu.") - + '\263' + " % through"; - break; - case 2: - stline = string("Esc=to doc lister ") + '\263' + " Press the key listed next to the section you wish to jump to"; - break; - } - for (fv = 0; fv <= 1118; fv ++) { - stbar[fv + 1] = ~ textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; - stbar2[fv + 1] = textvar[ord(stline[fv % 80 + 1]) + 1][fv / 80]; - } -} - -void setup() { /*sets up graphics, variables, etc.*/ - untyped_file f; - integer fv; - registers r; - - if ((paramstr(1) != "REGI") && (paramstr(1) != "ELMPOYTEN")) - - { - clrscr; - output << "This program cannot be run on its own. Run AVALOT.EXE." << NL; - exit(123); - } - val(paramstr(2), bfseg, useless); - val(paramstr(3), bfofs, useless); - bfofs += 1; - atsof = true; - fast = false; - assign(f, "avalot.fnt"); - reset(f, 1); - blockread(f, textvar, 4096); - close(f); - assign(f, "ttsmall.fnt"); - reset(f, 1); - blockread(f, textvar8, 4096); - close(f); - assign(f, "avalot.doc"); - reset(f, 1); - sot = filesize(f); - mark(dpt); - textmem = new bigtextarray; - blockread(f, *textmem, sot); - close(f); - finddocinfo(); - if (paramstr(1) == "REGI") { - regimode = true; - tlab = contlist[contsize].headeroffset + 24; - lat = contlist[contsize].headeroffset * 14; - } else { - lat = 0; - tlab = 24; - regimode = false; - } - setupsb(1); - graphmode(16); - directvideo = false; - showscreen(); - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 2; - port[0x3cf] = 1; -} - -void drawscreenf(integer tl) /*draws a screen from a line forwards*/ -/*N.B. tl>1*/ -{ - word fv, fv2, curbyte, plane; - byte xpos; - - blankscreen(); - wipesb(lat); - if (tl > nol - 24) tl = nol - 24; - if (tl < 0) tl = 0; - lat = tl * 14; - for (plane = 2; plane <= 3; plane ++) { /*wipe sb off*/ - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << plane; - port[0x3cf] = plane; - /*fillchar(mem [$A000:((lat-1)*80) mod 65536],26800,0);*/ - wipeit(lat * 80, 26800); - } - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 2; - port[0x3cf] = 1; /*back to normal*/ - if (tl > 0) curbyte = posof13[tl - 1] + 2; - else curbyte = 0; - bat = curbyte; - for (fv = lat; fv <= lat + 335; fv ++) { - fv2 = curbyte; - xpos = 1; - while (xpos <= 80) { - if (fv2 < posof13[tl]) { - if ((*textmem)[fv2] == 9) { - wipeit(fv * 80 + xpos, tabstop); - xpos += tabstop; - } else { - mem[0xa000 * (word)(fv * 80 + xpos - 1)] = - textvar[(*textmem)[fv2] + 1][fv % 14]; - xpos += 1; - } - } else { - wipeit(fv * 80 + xpos - 1, 82 - xpos); - xpos = 81; - } - fv2 += 1; - } - if (fv % 14 == 0) { - tl += 1; - curbyte = posof13[tl - 1] + 2; - } - } - bab = curbyte; - tlab = tl; - udstat(); - displstat(2); - setoffset((word)(lat * 80)); - if (tl - 23 > 1) atsof = false; - showscreen(); -} - -void displcont() { /*displays the contents*/ - byte fv, fv2, fv3, keyon, jumppos, plane; - word olat; - varying_string<62> curstr; - char rkv; - - blankscreen(); - olat = lat; - lat = 0; - keyon = 1; - jumppos = 0; - setoffset(0); - for (plane = 1; plane <= 3; plane ++) { /*wipe sb off*/ - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << plane; - port[0x3cf] = plane; - fillchar(scvar, 26800, 0); - } - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 2; - port[0x3cf] = 1; /*back to normal*/ - setupsb(2); - displstat(2); - for (fv = 1; fv <= 80; fv ++) - for (fv2 = 0; fv2 <= 27; fv2 ++) { - scvar[fv2 * 80 + fv] = textvar[ord(contentsheader[fv - 1]) + 1][fv2 / 2]; - } - for (fv = 1; fv <= contsize; fv ++) { - if (keyon < 10) curstr = strf(keyon) + ". " + contlist[fv].headername; - else - curstr = string(chr(keyon + 55)) + ". " + contlist[fv].headername; - for (fv2 = 1; fv2 <= length(curstr); fv2 ++) - for (fv3 = 0; fv3 <= 7; fv3 ++) - scvar[(fv + 3) * 640 + fv3 * 80 + fv2] = textvar8[ord(curstr[fv2]) + 1][fv3]; - keyon += 1; - } - showscreen(); - do { - } while (!keypressed()); - rkv = readkey(); - switch (rkv) { - case RANGE_9('\61', '\71'): - jumppos = ord(rkv) - 48; - break; - case RANGE_26('\101', '\132'): - jumppos = ord(rkv) - 55; - break; - case RANGE_26('\141', '\172'): - jumppos = ord(rkv) - 87; - break; - default: - lat = olat; - } - if (jumppos > 0) lat = contlist[jumppos].headeroffset; - setupsb(1); - if (fast == false) wipesb(0); - drawscreenf(lat); -} - -void down() { /*scrolls the screen down one line*/ - word fv, xpos, wpos, lab; - - lat += 1; - lab = lat + 335; - setoffset((word)(lat * 80)); - if (lab % 14 == 0) { - bat = posof13[tlab - 24] + 2; - bab = posof13[tlab] + 2; - tlab += 1; - udstat(); - } - fv = bab; - xpos = 1; - while (xpos <= 80) { - if (fv < posof13[tlab]) { - if ((*textmem)[fv] == 9) { - wipeit(lab * 80 + xpos - 1, tabstop); - xpos += tabstop; - } else { - wpos = (lab * 80 + xpos) % 65536; - /*fillchar(mem[$A000+wpos div 16*wpos mod 16],count,0)*/ - mem[0xa000 * wpos - 1] = textvar[(*textmem)[fv] + 1][lab % 14]; - xpos += 1; - } - } else { - wipeit(lab * 80 + xpos - 1, 81 - xpos); - xpos = 81; - } - fv += 1; - } - atsof = false; - if (fast == true) displstat(0); -} - -void up() { /*scrolls the screen up one line*/ - word fv, xpos, wpos; - - if (lat == 0) { - atsof = true; - return; - } - if (lat % 14 == 0) - if (tlab > 24) { - tlab -= 1; - bat = posof13[tlab - 24] + 2; - bab = posof13[tlab - 1] + 2; - udstat(); - } else { - atsof = true; - udstat(); - return; - } - lat -= 1; - setoffset((word)(lat * 80)); - fv = bat; - xpos = 1; - while (xpos <= 80) { - if (fv < posof13[tlab - 23]) { - if ((*textmem)[fv] == 9) { - wipeit(lat * 80 + xpos - 1, tabstop); - xpos += tabstop; - } else { - wpos = (word)((lat * 80 + xpos) % 65536); - mem[0xa000 * wpos - 1] = textvar[(*textmem)[fv] + 1][lat % 14]; - xpos += 1; - } - } else { - wipeit(lat * 80 + xpos - 1, 81 - xpos); - xpos = 81; - } - fv += 1; - } - if (fast == true) displstat(1); - /*ateof:=false;*/ -} - -void endit() { /*Ends the program*/ - release(dpt); - graphmode(2); -} - -void control() { /*User control*/ - char rkv, rkv2/*the sequel*/, rkv3; - integer fv; - boolean first; - - if (regimode == false) displcont(); - else drawscreenf(tlab - 24); - first = true; - do { - rkv = readkey(); - switch (rkv) { - case '\0': { - rkv2 = readkey(); - switch (rkv2) { - case chome: - drawscreenf(0); - break; - case cend: - drawscreenf(nol - 24); - break; - case cpgdn: { - memw[bfseg * bfofs] = 0; - if (fast == false) wipesb(lat); - fv = 1; - while (((cardinal)lat + 336 < nosl) && (fv < 337)) { - fv += 1; - down(); - } - if ((first == true) && (memw[bfseg * bfofs] <= 2)) fast = true; - if ((fast == false) || (first == true)) displstat(0); - } - break; - case cpgup: { - memw[bfseg * bfofs] = 0; - if (fast == false) wipesb(lat); - fv = 1; - while ((atsof == false) && (fv < 337)) { - fv += 1; - up(); - } - if ((first == true) && (memw[bfseg * bfofs] <= 2)) fast = true; - if ((fast == false) || (first == true)) displstat(0); - } - break; - /* cUp:repeat; - up; - readkey; - until (readkey<>cUp) or (atsof=true); - cDown: repeat; - down; - readkey; - until (readkey<>cDown) or (ateof=true);*/ - } - first = false; - } - break; - case '\33': - return; - break; - case '\103': - case '\143': - if (regimode == false) { - wipesb(lat); - displcont(); - } - break; - } - } while (!false); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - setup(); - control(); - endit(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.cpp b/engines/avalanche/visa.cpp deleted file mode 100644 index b705fac67528..000000000000 --- a/engines/avalanche/visa.cpp +++ /dev/null @@ -1,290 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* - - - - - VISA The new Sez handler. (Replaces Access.) */ - -#define __visa_implementation__ - - -#include "visa.h" - - -/*#include "Gyro.h"*/ -/*#include "Scrolls.h"*/ -/*#include "Acci.h"*/ -/*#include "Trip5.h"*/ -/*#include "Lucerna.h"*/ - -namespace Avalanche { - -const boolean bubbling = false; -const boolean report_dixi_errors = true; - -boolean went_ok; - -void unskrimble() { - word fv; - - for (fv = 1; fv <= bufsize; fv ++) buffer[fv] = (char)((~(ord(buffer[fv]) - fv)) % 256); -} - -void do_the_bubble() { - bufsize += 1; - buffer[bufsize] = '\2'; -} - -void dixi(char block, byte point) { - untyped_file indexfile, sezfile; - word idx_offset, sez_offset; - boolean error; - - error = false; - - assign(indexfile, "avalot.idx"); - assign(sezfile, "avalot.sez"); - - reset(indexfile, 1); - seek(indexfile, (ord(upcase(block)) - 65) * 2); - blockread(indexfile, idx_offset, 2); - if (idx_offset == 0) error = true; - seek(indexfile, idx_offset + point * 2); - blockread(indexfile, sez_offset, 2); - if (sez_offset == 0) error = true; - close(indexfile); - - went_ok = ! error; - - if (error) { - if (report_dixi_errors) - display(string('\7') + "Error accessing scroll " + block + strf(point)); - return; - } - - reset(sezfile, 1); - seek(sezfile, sez_offset); - blockread(sezfile, bufsize, 2); - blockread(sezfile, buffer, bufsize); - close(sezfile); - unskrimble(); - - if (bubbling) do_the_bubble(); - - calldrivers; -} - -void speech(byte who, byte subject) { - untyped_file indexfile, sezfile; - word idx_offset, sez_offset, next_idx_offset; - - if (subject == 0) { - /* No subject. */ - bubbling = true; - report_dixi_errors = false; - dixi('s', who); - bubbling = false; - report_dixi_errors = true; - } else { - /* Subject given. */ - assign(indexfile, "converse.avd"); - assign(sezfile, "avalot.sez"); - - went_ok = false; /* Assume that until we know otherwise. */ - reset(indexfile, 1); - seek(indexfile, who * 2 - 2); - blockread(indexfile, idx_offset, 2); - blockread(indexfile, next_idx_offset, 2); - - if ((idx_offset == 0) || - ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; - - seek(indexfile, idx_offset + subject * 2); - /*$I-*/ - blockread(indexfile, sez_offset, 2); - if ((sez_offset == 0) || (ioresult != 0)) return; - /*$I+*/ - close(indexfile); - - reset(sezfile, 1); - seek(sezfile, sez_offset); - blockread(sezfile, bufsize, 2); - blockread(sezfile, buffer, bufsize); - close(sezfile); - - unskrimble(); - do_the_bubble(); - - calldrivers; - went_ok = true; - } -} - -void talkto(byte whom) { - byte fv; - boolean no_matches; - - if (person == pardon) { - person = chr(subjnumber); - subjnumber = 0; - } - - if (subjnumber == 0) - switch (chr(whom)) { - case pspludwick: - - if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) { - dixi('q', 68); - dna.obj[potion] = true; - objectlist; - points(3); - return; - } else { - if (dna.talked_to_crapulus) - switch (dna.given2spludwick) { /* Spludwick - what does he need? */ - /* 0 - let it through to use normal routine. */ - case RANGE_2(1, 2): { - display(string("Can you get me ") + - get_better(spludwick_order[dna.given2spludwick]) + ", please?" + - "\232\2"); - return; - } - break; - case 3: { - dixi('q', 30); /* need any help with the game? */ - return; - } - break; - } - else { - dixi('q', 42); /* Haven't talked to Crapulus. Go and talk to him. */ - return; - } - } - break; - - case pibythneth: - if (dna.givenbadgetoiby) { - dixi('q', 33); /* Thanks a lot! */ - return; /* And leave the proc. */ - } - break; /* Or... just continue, 'cos he hasn't got it. */ - case pdogfood: - if (dna.wonnim) { - /* We've won the game. */ - dixi('q', 6); /* "I'm Not Playing!" */ - return; /* Zap back. */ - } else dna.asked_dogfood_about_nim = true; - break; - case payles: - if (~ dna.ayles_is_awake) { - dixi('q', 43); /* He's fast asleep! */ - return; - } else if (~ dna.given_pen_to_ayles) { - dixi('q', 44); /* Can you get me a pen, Avvy? */ - return; - } - break; - - case pjacques: { - dixi('q', 43); - return; - } - break; - case pgeida: - if (dna.geida_given_potion) - dna.geida_follows = true; - else { - dixi('u', 17); - return; - } - break; - case pspurge: - if (~ dna.sitting_in_pub) { - dixi('q', 71); /* Try going over and sitting down. */ - return; - } else { - if (spurge_talk < 5) spurge_talk += 1; - if (spurge_talk > 1) { - /* no. 1 falls through */ - dixi('q', 70 + spurge_talk); - return; - } - } - break; - } - else /* On a subject. Is there any reason to block it? */ - switch (chr(whom)) { - case payles: - if (~ dna.ayles_is_awake) { - dixi('q', 43); /* He's fast asleep! */ - return; - } - break; - } - - if (whom > 149) whom -= 149; - - no_matches = true; - for (fv = 1; fv <= numtr; fv ++) - if (tr[fv].a.accinum == whom) { - display(string('\23') + chr(fv + 48) + '\4'); - no_matches = false; - flush(); - } - - if (no_matches) display("\23\23\4"); - - speech(whom, subjnumber); - if (! went_ok) /* File not found! */ - dixi('n', whom); - - if (subjnumber == 0) - switch (chr(whom + 149)) { - case pcrapulus: { - /* Crapulus: get the badge - first time only */ - dna.obj[badge] = true; - objectlist; - dixi('q', 1); /* Circular from Cardiff. */ - dna.talked_to_crapulus = true; - - whereis[pcrapulus] = 177; /* Crapulus walks off. */ - - tr[2].vanishifstill = true; - tr[2].walkto(4); /* Walks away. */ - - points(2); - } - break; - - } -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/visa.h b/engines/avalanche/visa.h deleted file mode 100644 index 6a1ee6265ea5..000000000000 --- a/engines/avalanche/visa.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef __visa_h__ -#define __visa_h__ - -namespace Avalanche { - -void dixi(char block, byte point); - -void talkto(byte whom); - -} // End of namespace Avalanche. - -#endif \ No newline at end of file diff --git a/engines/avalanche/visatest.cpp b/engines/avalanche/visatest.cpp deleted file mode 100644 index 487cc142abc8..000000000000 --- a/engines/avalanche/visatest.cpp +++ /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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ - -namespace Avalanche { - -char block; -word point; - -array<1, 2000, char> result; -word result_len; - -void unskrimble() { - word fv; - - for (fv = 1; fv <= 2000; fv ++) result[fv] = (char)((~(ord(result[fv]) - fv)) % 256); -} - -void visa_get_scroll(char block, word point) { - untyped_file indexfile, sezfile; - word idx_offset, sez_offset; - - assign(indexfile, "avalot.idx"); - assign(sezfile, "avalot.sez"); - - reset(indexfile, 1); - seek(indexfile, (ord(upcase(block)) - 65) * 2); - blockread(indexfile, idx_offset, 2); - seek(indexfile, idx_offset + point * 2); - blockread(indexfile, sez_offset, 2); - close(indexfile); - - reset(sezfile, 1); - seek(sezfile, sez_offset); - blockread(sezfile, result_len, 2); - blockread(sezfile, result, result_len); - close(sezfile); - unskrimble(); -} - -void access_get_scroll(char block, word point) { - string x; - untyped_file f; - - str(point, x); - x = string('S') + block + x + ".RAW"; - assign(f, x); - reset(f, 1); - result_len = filesize(f); - blockread(f, result, result_len); - close(f); -} - -void display_it() { - word fv; - - for (fv = 1; fv <= result_len; fv ++) output << result[fv]; -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - do { - output << NL; - output << NL; - output << "Block?"; - input >> block >> NL; - output << "Point?"; - input >> point >> NL; - - output << "ACCESS reports (this one is always correct):" << NL; - output << NL; - access_get_scroll(block, point); - display_it(); - - output << NL; - output << NL; - output << "VISA reports:" << NL; - output << NL; - visa_get_scroll(block, point); - display_it(); - } while (!false); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/waver.cpp b/engines/avalanche/waver.cpp deleted file mode 100644 index d0f88a1e85c2..000000000000 --- a/engines/avalanche/waver.cpp +++ /dev/null @@ -1,27 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - diff --git a/engines/avalanche/xf_gover.cpp b/engines/avalanche/xf_gover.cpp deleted file mode 100644 index 30d16a79d280..000000000000 --- a/engines/avalanche/xf_gover.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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -void load() { - byte a; /*absolute $A000:1200;*/ byte bit; - untyped_file f; - assign(f, "avagame.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void gfx() { - integer gd, gm; - - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); -} - -void blit(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3) { - pointer p, q; - word s; - - mark(q); - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - putimage(x3, y3, p, 0); - - release(q); -} - -void copy_hammer() { - blit(274, 47, 311, 67, 92, 10); -} - -void do_text() { - settextjustify(1, 1); - setcolor(0); - settextstyle(2, 0, 4); - setusercharsize(120, 100, 100, 100); - outtextxy(112, 32, "Thorsoft of Letchworth presents"); - blit(3, 30, 218, 31, 4, 30); - blit(4, 35, 219, 38, 3, 35); -} - -void dump_to_file(byte x1, byte y1, byte x2, byte y2, string fn) { - byte y, bit; - untyped_file f; - - assign(f, fn); - rewrite(f, 1); - - for (y = y1; y <= y2; y ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(f, mem[0xa000 * y * 80 + x1], x2 - x1); - } - - close(f); - -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gfx(); - load(); - - setfillstyle(1, 7); - bar(2, 10, 219, 37); - bar(0, 0, 1, 200); - bar(220, 0, 250, 88); - bar(0, 88, 213, 147); - bar(622, 88, 640, 147); - copy_hammer(); - do_text(); - - dump_to_file(0, 10, 28, 86, "about.avd"); - dump_to_file(26, 88, 78, 147, "gameover.avd"); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_help.cpp b/engines/avalanche/xf_help.cpp deleted file mode 100644 index fc953a56282f..000000000000 --- a/engines/avalanche/xf_help.cpp +++ /dev/null @@ -1,112 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -/*#include "Tommys.h"*/ - -namespace Avalanche { - -const integer max_pages = 34; - -byte fv; -text i; -untyped_file o; -string x; -char t; -byte p, w; - -array<0, max_pages, word> where; - -void out(string x) { - byte fz; - - for (fz = 1; fz <= length(x); fz ++) - x[fz] = chr(ord(x[fz]) ^ 177); - blockwrite(o, x[0], 1); - blockwrite(o, x[1], length(x)); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(o, "help.avd"); - rewrite(o, 1); - - blockwrite(o, where, sizeof(where)); - - for (fv = 0; fv <= max_pages; fv ++) { - where[fv] = filepos(o); - - assign(i, string('h') + strf(fv) + ".raw"); - reset(i); - - i >> x >> NL; /* Title. */ - out(x); - - i >> p >> NL; /* Picture. */ - blockwrite(o, p, 1); - - do { - i >> x >> NL; - out(x); - } while (!(x == '!')); - - while (! eof(i)) { - i >> x >> NL; - if (x == '-') { - /* Null point */ - t = '\0'; - p = 0; - w = 177; - } else { - /* Has a point. */ - i >> t >> NL; - i >> p >> NL; - i >> w >> NL; - } - - blockwrite(o, t, 1); - blockwrite(o, p, 1); - blockwrite(o, w, 1); - } - - t = '\261'; - blockwrite(o, t, 1); - blockwrite(o, p, 1); - blockwrite(o, w, 1); - - close(i); - - } - - seek(o, 0); - blockwrite(o, where, sizeof(where)); - - close(o); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xf_visa.cpp b/engines/avalanche/xf_visa.cpp deleted file mode 100644 index 4dde0e3fc42b..000000000000 --- a/engines/avalanche/xf_visa.cpp +++ /dev/null @@ -1,200 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/*#include "Crt.h"*/ -/*#include "Dos.h"*/ - -/*$R+*/ - -namespace Avalanche { - -const varying_string<9> used = "DNPQSTUXZ"; - -const varying_string<12> header = string("Avalot Sez:") + '\32'; - -untyped_file sez, infile; -searchrec s; - -matrix < 'A', 'Z', 0, 99, word > positions; -array < 'A', 'Z', word > maxlen; - -matrix<1, 50, 0, 255, word> speak_positions; -array<1, 50, word> speak_maxlen; - -array<1, 2000, char> data; -word data_length; - -byte fv; - -byte numeric_bit() { - varying_string<5> x; - integer e; - byte result; - - byte numeric_bit_result; - x = copy(s.name, 3, pos(".", s.name) - 3); - val(x, result, e); - if (e != 0) { - output << "NUMERIC ERROR: " << s.name << '/' << x << NL; - exit(255); - } - numeric_bit_result = result; - return numeric_bit_result; -} - -byte speak_left() { - string x; - integer e; - byte result; - - byte speak_left_result; - x = copy(s.name, 3, pos(".", s.name) - 3); - x = copy(x, 1, pos("-", x) - 1); - val(x, result, e); - if (e != 0) { - output << "NUMERIC ERROR (left): " << s.name << '/' << x << NL; - exit(255); - } - speak_left_result = result; - return speak_left_result; -} - -byte speak_right() { - string x; - integer e; - byte result; - - byte speak_right_result; - x = copy(s.name, 3, pos(".", s.name) - 3); - x = copy(x, pos("-", x) + 1, 255); - val(x, result, e); - if (e != 0) { - output << "NUMERIC ERROR (right): " << s.name << '/' << x << NL; - exit(255); - } - speak_right_result = result; - return speak_right_result; -} - -void write_out() { - array < 'A', 'Z', word > points; - array<1, 50, word> speak_points; - untyped_file outf; - byte fv; - - fillchar(points, sizeof(points), '\0'); - fillchar(speak_points, sizeof(speak_points), '\0'); - - assign(outf, "v:avalot.idx"); - rewrite(outf, 1); - blockwrite(outf, points, sizeof(points)); - - for (fv = 1; fv <= length(used); fv ++) { - points[used[fv - 1]] = filepos(outf); - blockwrite(outf, positions[used[fv - 1]], maxlen[used[fv - 1]] * 2 + 2); - } - - seek(outf, 0); - blockwrite(outf, points, sizeof(points)); - - close(outf); - - /* --- now the speech records --- */ - - assign(outf, "v:converse.avd"); - rewrite(outf, 1); - blockwrite(outf, speak_points, sizeof(speak_points)); - - for (fv = 1; fv <= 15; fv ++) { - speak_points[fv] = filepos(outf); - - blockwrite(outf, speak_positions[fv], speak_maxlen[fv] * 2 + 2); - } - - seek(outf, 0); - blockwrite(outf, speak_points, sizeof(speak_points)); - - close(outf); -} - -void skrimble() { - word fv; - - for (fv = 1; fv <= 2000; fv ++) data[fv] = (char)((~(ord(data[fv])) + fv) % 256); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - fillchar(positions, sizeof(positions), '\0'); - fillchar(maxlen, sizeof(maxlen), '\0'); - - clrscr; - - assign(sez, "v:avalot.sez"); - rewrite(sez, 1); - blockwrite(sez, header[1], 12); - - findfirst("s*.raw", anyfile, s); - while (doserror == 0) { - assign(infile, s.name); - reset(infile, 1); - blockread(infile, data, 2000, data_length); - close(infile); - - clrscr; - if (pos("-", s.name) == 0) { - /* Not a speech record. */ - output << s.name << format(numeric_bit(), 10) << NL; - - positions[s.name[2]][numeric_bit()] = filepos(sez); - if (maxlen[s.name[2]] < (unsigned char)numeric_bit()) maxlen[s.name[2]] = numeric_bit(); - - } else { - /* A speech record. */ - output << s.name << format(speak_left(), 10) << format(speak_right(), 10) << " SR" << NL; - - speak_positions[speak_left()][speak_right()] = filepos(sez); - if (speak_maxlen[speak_left()] < (unsigned char)speak_right()) - speak_maxlen[speak_left()] = speak_right(); - } - - skrimble(); - - blockwrite(sez, data_length, 2); - blockwrite(sez, data, data_length); - - findnext(s); - clreol; - } - - close(sez); - - write_out(); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfbutton.cpp b/engines/avalanche/xfbutton.cpp deleted file mode 100644 index c216d317068e..000000000000 --- a/engines/avalanche/xfbutton.cpp +++ /dev/null @@ -1,92 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" - -namespace Avalanche { - -integer x, y; -untyped_file f, out; - -void load() { /* Load2, actually */ - byte a0; /*absolute $A000:800;*/ - byte bit; - untyped_file f; - integer gd, gm; - - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - - assign(f, "d:butnraw.avd"); - reset(f, 1); - seek(f, 177); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - } - close(f); - bit = getpixel(0, 0); -} - -void grab(integer x1, integer y1, integer x2, integer y2) { /* s=930 */ - word s; - pointer p; - - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - putimage(0, 0, p, 0); - blockwrite(out, p, s); - freemem(p, s); - rectangle(x1, y1, x2, y2); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - assign(f, "d:butnraw.avd"); - assign(out, "v:buttons.avd"); - rewrite(out, 1); - load(); - for (x = 0; x <= 5; x ++) - for (y = 0; y <= 3; y ++) { - if (! - (((x == 1) && (y == 0)) - || ((x == 4) && (y == 2)) - || ((y == 3) && (x > 2) && (x < 5)))) { - input >> NL; - grab(100 + x * 83, 51 + y * 22, 180 + x * 83, 71 + y * 22); - } - } - close(out); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/xfghost.cpp b/engines/avalanche/xfghost.cpp deleted file mode 100644 index 2ad6a43db5f1..000000000000 --- a/engines/avalanche/xfghost.cpp +++ /dev/null @@ -1,299 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ - -namespace Avalanche { - -const array<1, 44, char> chunkheader = - string("Spooky file! Nearly a Chunk... (c) MT.") + '\32' + '\261' + '\x30' + '\x1' + '\x75' + '\261'; - -const integer n = -1; /* "No change" in new-whatever */ - -const integer aa = -2; /* This is an aargh. */ - -const integer aargh_x_ofs = -177; -const integer aargh_y_ofs = 52; - -enum flavourtype {ch_ega, ch_bgi, ch_natural, ch_two, ch_one, last_flavourtype}; - -struct chunkblocktype { - flavourtype flavour; - integer x, y; - integer xl, yl; - longint size; -}; - -integer gd, gm, x, y; -untyped_file f; -byte bit; -byte a; /*absolute $A000:0;*/ -palettetype cc; -char r; -text t; -word s; -pointer p; - -untyped_file chunkfile; -chunkblocktype cb; - -pointer a_p; -word a_s; - -void open_chunk() { - assign(chunkfile, "v:spooky.avd"); - rewrite(chunkfile, 1); - blockwrite(chunkfile, chunkheader, sizeof(chunkheader)); -} - -void close_chunk() { - close(chunkfile); -} - -void grab(integer x1, integer y1, integer x2, integer y2, flavourtype how, integer newx, integer newy) { - pointer p; - word s; - integer y; - byte bit; - -#ifndef DRYRUN - { - cb.flavour = how; - switch (newx) { - case n: - cb.x = x1; - break; - case aa: - cb.x = x1 + aargh_x_ofs; - break; - default: - cb.x = newx; - } - - switch (newy) { - case n: - cb.y = y1; - break; - case aa: - cb.y = y1 + aargh_y_ofs; - break; - default: - cb.y = newy; - } - - cb.xl = x2 - x1; - if (set_of_enum(flavourtype)::of(ch_ega, ch_one, ch_two, eos).has(how)) cb.xl = ((cb.xl + 7) / 8) * 8; - cb.yl = y2 - y1; - } - - if (how != ch_natural) { - s = imagesize(x1, y1, x2, y2); - getmem(p, s); - getimage(x1, y1, x2, y2, p); - } - - rectangle(x1, y1, x2, y2); - - switch (how) { - case ch_bgi: - cb.size = s; - break; - } - - blockwrite(chunkfile, cb, sizeof(cb)); - - switch (how) { - case ch_bgi: - blockwrite(chunkfile, p, s); - break; - case ch_ega: { - setactivepage(1); - cleardevice(); - putimage(0, 0, p, 0); - setactivepage(0); - - for (bit = 0; bit <= 3; bit ++) - for (y = 0; y <= cb.yl; y ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); - } - - y = getpixel(0, 0); - } - break; - case ch_two: { - ; /* Same as EGA, but with only 2 planes. */ - setactivepage(1); - cleardevice(); - putimage(0, 0, p, 0); - setactivepage(0); - - for (bit = 2; bit <= 3; bit ++) /* << Bit to grab? */ - for (y = 0; y <= cb.yl; y ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); - } - - y = getpixel(0, 0); - } - break; - case ch_one: { - ; /* ...but with only one plane! */ - setactivepage(1); - cleardevice(); - putimage(0, 0, p, 0); - setactivepage(0); - - for (bit = 3; bit <= 3; bit ++) - for (y = 0; y <= cb.yl; y ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockwrite(chunkfile, mem[0xa400 * y * 80], cb.xl / 8); - } - - y = getpixel(0, 0); - } - break; - } - - freemem(p, s); -#endif - rectangle(x1, y1, x2, y2); - -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); -#ifndef DRYRUN - open_chunk(); -#endif - - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(f, "c:\\sleep4\\colour.ptx"); - reset(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a, 16000); /* 28000 */ - } - close(f); - - setwritemode(xorput); - - /* Grab the big ghost. */ - - grab(0, 0, 160, 65, ch_two, n, n); /* First column, */ - grab(0, 67, 172, 127, ch_two, n, n); - grab(0, 132, 158, 190, ch_two, n, n); - - a_s = imagesize(349, 36, 361, 43); - getmem(a_p, a_s); - getimage(349, 36, 361, 43, a_p); - setfillstyle(1, 0); - bar(349, 36, 361, 43); - - grab(173, 66, 347, 124, ch_two, n, n); /* Second column. */ - grab(173, 6, 352, 64, ch_two, n, n); - - putimage(349, 36, a_p, 0); - - /* Grab Avvy's eyes and the exclamation mark. */ - - grab(605, 10, 620, 12, ch_bgi, n, n); /* Eyes looking left */ - grab(622, 10, 638, 12, ch_bgi, n, n); /* Ditto looking right (eye eye, sir) */ - grab(611, 0, 616, 5, ch_bgi, n, n); /* ! */ - - /* Grab the cobweb. */ - - grab(535, 25, 639, 75, ch_one, n, 0); - /* ^^^ Interesting point here: the ch_EGA save routine pads with black - space to the RIGHT of the object. Since this cobweb needs to be right- - justified, we must decrease x1 until xl is a multiple of 8. */ - - /* Grab Mark's signature. */ - - grab(462, 61, 525, 65, ch_ega, 576, 195); - - /* Grab the open door. */ - - grab(180, 132, 294, 180, ch_ega, 520, 127); - - /* Grab the bat. */ - - grab(354, 0, 474, 28, ch_bgi, n, n); - grab(484, 0, 526, 23, ch_bgi, n, n); - grab(542, 2, 564, 22, ch_bgi, n, n); - - /* Grab the big fade-in face. */ - - grab(350, 71, 420, 105, ch_ega, n, n); /* Top line. */ - grab(421, 71, 491, 105, ch_ega, n, n); - - grab(350, 107, 419, 141, ch_ega, n, n); /* Second line. */ - grab(421, 107, 490, 141, ch_ega, n, n); - - grab(350, 143, 420, 177, ch_ega, n, n); /* Third line. */ - grab(422, 143, 489, 177, ch_ega, n, n); - - /* Grab the "AARGH!" */ - - grab(349, 36, 361, 43, ch_bgi, aa, aa); /* A */ - grab(366, 31, 385, 46, ch_bgi, aa, aa); /* Aa */ - grab(394, 34, 415, 52, ch_bgi, aa, aa); /* Aar */ - grab(428, 33, 457, 57, ch_bgi, aa, aa); /* Aarg */ - grab(471, 30, 508, 59, ch_bgi, aa, aa); /* Aargh */ - grab(524, 30, 524, 58, ch_bgi, aa, aa); /* Aargh! */ - - for (gd = 0; gd <= 4; gd ++) - grab(509, 76 + gd * 22, 551, 96 + gd * 22, ch_bgi, n, n); /* The big green eyes. */ - - for (gd = 5; gd >= 0; gd --) - grab(181 + gd * 34, 186, 214 + gd * 34, 199, ch_bgi, n, n); /* The red greldet. */ - - for (gd = 0; gd <= 5; gd ++) - grab(390 + gd * 34, 186, 423 + gd * 34, 199, ch_bgi, n, n); /* The blue greldet. */ - -#ifndef DRYRUN - close_chunk(); -#endif - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file diff --git a/engines/avalanche/zapdraw.cpp b/engines/avalanche/zapdraw.cpp deleted file mode 100644 index 6172f84837f1..000000000000 --- a/engines/avalanche/zapdraw.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. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "graph.h" -/*#include "Crt.h"*/ -/*#include "Dos.h"*/ - -namespace Avalanche { - -untyped_file f; -byte bit; -byte a; /*absolute $A000:0; */ -integer gd, gm; - -void graphmode(integer mode) { - registers regs; - regs.ax = (mode % 0x100); - intr(0x10, regs); -} - -int main(int argc, const char *argv[]) { - pio_initialize(argc, argv); - gd = 3; - gm = 0; - initgraph(gd, gm, "c:\\bp\\bgi"); - assign(f, "d:avltzap.raw"); - reset(f, 1); - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - for (gd = 0; gd <= 199; gd ++) - blockread(f, mem[0xa000 * gd * 80], 40); /* 28000 */ - } - close(f); - setwritemode(xorput); - rectangle(0, 0, 5, 8); - rectangle(0, 10, 27, 19); - return EXIT_SUCCESS; -} - -} // End of namespace Avalanche. \ No newline at end of file From 178386f1c48d04f07b2552a253a6b8151dc481b9 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 21 Jun 2013 15:22:50 +0200 Subject: [PATCH 0024/1332] AVALANCHE: Stub gyro2.cpp. Fix readmes. --- engines/avalanche/gyro2.cpp | 293 ++++++++++++++++++++++++++++++++++++ engines/avalanche/gyro2.h | 15 +- 2 files changed, 302 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index b44cbee68fc4..6c7727993354 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -26,11 +26,304 @@ */ #include "avalanche/gyro2.h" +#include "common/textconsole.h" + +//#include "pingo.h" +//#include "scrolls.h" +//#include "lucerna.h" +//#include "visa.h" +//#include "acci.h" +//#include "trip5.h" +//#include "dropdown.h" +//#include "basher.h" + + namespace Avalanche { namespace Gyro { + const Common::String things[numobjs] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + }; + + const char thingchar[] = "WMBParCLguKeSnIohn"; /* V=Vinegar */ + + const Common::String better[numobjs] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", + "an onion" + }; + + const char betterchar[] = "WMBParCLguKeSnIohn"; + + void newpointer(byte m) { + warning("STUB: Gyro::newpointer()"); + } + + void wait() { /* makes hourglass */ + newpointer(5); + } + + void on() { + warning("STUB: Gyro::on()"); + } + + void on_virtual() { + switch (visible) { + case m_virtual: + return; + break; + case m_yes: + off(); + break; + } + + visible = m_virtual; + } + + void off() { + warning("STUB: Gyro::off()"); + } + + void off_virtual() { + warning("STUB: Gyro::off_virtual()"); + } + + void xycheck() { /* only updates mx & my, not all other mouse vars */ + warning("STUB: Gyro::xycheck()"); + } + + void hopto(int16 x, int16 y) { /* Moves mouse void *to x,y */ + warning("STUB: Gyro::hopto()"); + } + + void check() { + warning("STUB: Gyro::check()"); + } + + void note(uint16 hertz) { + warning("STUB: Gyro::note()"); + } + + void blip() { + warning("STUB: Gyro::blip()"); + } + + Common::String strf(int32 x) { + Common::String q = Common::String::format("%d", x); + return q; + } + + void shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { + warning("STUB: Gyro::shadow()"); + } + + void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { + warning("STUB: Gyro::shbox()"); + } + + void newgame() { /* This sets up the DNA for a completely new game. */ + warning("STUB: Gyro::newgame()"); + } + + void click() { /* "Audio keyboard feedback" */ + warning("STUB: Gyro::click()"); + } + + void slowdown() { + warning("STUB: Gyro::slowdown()"); + } + + bool flagset(char x) { + for (uint16 i = 0; i < flags.size(); i++) + if (flags[i] == x) + return true; + return false; + } + + void force_numlock() { + if ((locks & num) > 0) locks -= num; + } + + bool pennycheck(uint16 howmuchby) { + warning("STUB: Gyro::pennycheck()"); + return true; + } + + // There'll may be problems with calling these functions becouse of the conversion of the arrays!!! + // Keep an eye open! + Common::String getname(byte whose) { + Common::String getname_result; + if (whose < 17) + getname_result = lads[whose]; + else + getname_result = lasses[whose-17]; + return getname_result; + } + + // Keep an eye open! ^ + char getnamechar(byte whose) { + char getnamechar_result; + if (whose < 16) + getnamechar_result = ladchar[whose]; + else + getnamechar_result = lasschar[whose-16]; + return getnamechar_result; + } + + // Keep an eye open! ^^ + Common::String get_thing(byte which) { + Common::String get_thing_result; + switch (which) { + case wine: + switch (dna.winestate) { + case 1: + case 4: + get_thing_result = things[which]; + break; + case 3: + get_thing_result = "Vinegar"; + break; + } + break; + case onion: + if (dna.rotten_onion) + get_thing_result = "rotten onion"; + else get_thing_result = things[which]; + break; + default: + get_thing_result = things[which]; + } + return get_thing_result; + } + + // Keep an eye open! ^^^ + char get_thingchar(byte which) { + char get_thingchar_result; + switch (which) { + case wine: + if (dna.winestate == 3) + get_thingchar_result = 'V'; /* Vinegar */ + else + get_thingchar_result = thingchar[which]; + break; + default: + get_thingchar_result = thingchar[which]; + } + return get_thingchar_result; + } + + // Keep an eye open! ^^^^ + Common::String get_better(byte which) { + Common::String get_better_result; + if (which > 150) which -= 149; + switch (which) { + case wine: + switch (dna.winestate) { + case 0: + case 1: + case 4: + get_better_result = better[which]; + break; + case 3: + get_better_result = "some vinegar"; + break; + } + break; + case onion: + if (dna.rotten_onion) + get_better_result = "a rotten onion"; + else if (dna.onion_in_vinegar) + get_better_result = "a pickled onion (in the vinegar)"; + else get_better_result = better[which]; + break; + default: + if ((which < numobjs) && (which > '\0')) + get_better_result = better[which]; + else + get_better_result = ""; + } + return get_better_result; + } + + // Get back here after finished with acci.pas, where vb_-s are resided. + Common::String f5_does() + /* This procedure determines what f5 does. */ + { + warning("STUB: Gyro::f5_does()"); + return "STUB: Gyro::f5_does()"; + } + + // Pobably vmc functions will deal with the mouse cursor. + void plot_vmc(int16 xx, int16 yy, byte page_) { + warning("STUB: Gyro::plot_vmc()"); + } + + void wipe_vmc(byte page_) { + warning("STUB: Gyro::wipe_vmc()"); + } + + void setup_vmc() { + warning("STUB: Gyro::setup_vmc()"); + } + + void clear_vmc() { + warning("STUB: Gyro::clear_vmc()"); + } + + void setminmaxhorzcurspos(uint16 min, uint16 max) { /* phew */ + warning("STUB: Gyro::setminmaxhorzcurspos()"); + } + + void setminmaxvertcurspos(uint16 min, uint16 max) { + warning("STUB: Gyro::setminmaxvertcurspos()"); + } + + void load_a_mouse(byte which) { + warning("STUB: Gyro::load_a_mouse()"); + } + + void background(byte x) { + warning("STUB: Gyro::background()"); + } + + void hang_around_for_a_while() { + byte fv; + + for (fv = 1; fv <= 28; fv ++) slowdown(); + } + + bool mouse_near_text() { + bool mouse_near_text_result; + mouse_near_text_result = (my > 144) && (my < 188); + return mouse_near_text_result; + } + + /* Super_Off and Super_On are two very useful procedures. Super_Off switches + the mouse cursor off, WHATEVER it's like. Super_On restores it again + afterwards. */ + + void super_off() { + super_was_off = visible == m_no; + if (super_was_off) return; + + super_was_virtual = visible == m_virtual; + + if (visible == m_virtual) off_virtual(); + else off(); + } + + void super_on() { + if ((visible != m_no) || (super_was_off)) return; + + if (super_was_virtual) on_virtual(); + else on(); + } + } // End of namespace Gyro diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index db02bc27a520..c9d8669f17b8 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -753,6 +753,9 @@ namespace Avalanche { bool use_joy_a; + + ///////////////////////////// FUNCTIONS ///////////////////////////// + void newpointer(byte m); void wait(); /* makes hourglass */ @@ -767,7 +770,7 @@ namespace Avalanche { void xycheck(); - void hopto(int16 x, int16 y); /* Moves mouse void *to x,y */ + void hopto(int16 x, int16 y); /* Moves mouse pointer to x,y */ void check(); @@ -791,15 +794,15 @@ namespace Avalanche { bool pennycheck(uint16 howmuchby); - Common::String getname(char whose); + Common::String getname(byte whose); - char getnamechar(char whose); + char getnamechar(byte whose); - Common::String get_thing(char which); + Common::String get_thing(byte which); - char get_thingchar(char which); + char get_thingchar(byte which); - Common::String get_better(char which); + Common::String get_better(byte which); Common::String f5_does(); From 57504102797b2c356a83a0b3d2af382e8c8eb58e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 21 Jun 2013 18:04:59 +0200 Subject: [PATCH 0025/1332] AVALANCHE: Add some detail in debug strings --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c644b30028cd..b9b1b0f5819a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -162,7 +162,7 @@ namespace Avalanche { } void AvalancheEngine::run(Common::String what, bool with_jsb, bool with_bflight, elm how) { - warning("STUB: run()"); + warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 337f896db9e6..de218811c1fe 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -35,10 +35,7 @@ namespace Avalanche { Avalot::Avalot() {} void Avalot::run(Common::String arg) { - - - - warning("STUB: Avalot::run()"); + warning("STUB: Avalot::run(%s)", arg.c_str()); } } // End of namespace Avalanche From 46849fcc42721129b4e23ab1c047c0515e44ec17 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 23 Jun 2013 21:11:15 +0200 Subject: [PATCH 0026/1332] AVALANCHE: Start continuously adding parts to Avalot as I proceed with the conversion of the necessary Pascal units. --- engines/avalanche/avalot.cpp | 14 +++++++++++++- engines/avalanche/avalot.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index de218811c1fe..09c3ddbc9543 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -29,10 +29,22 @@ #include "common/textconsole.h" #include "avalanche/avalot.h" +#include "avalanche/gyro2.h" namespace Avalanche { - Avalot::Avalot() {} + Avalot::Avalot() { + int16 gd, gm; + + checkbreak = false; + Gyro::visible = Gyro::m_no; + Gyro::to_do = 0; + Gyro::lmo = false; + // resetscroll(); Needs scrolls "unit" to make it work. + + + + } void Avalot::run(Common::String arg) { warning("STUB: Avalot::run(%s)", arg.c_str()); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 596fc023bccb..5f109339bd96 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -32,6 +32,8 @@ namespace Avalanche { +bool checkbreak; // Originally located in avalot9.map + class Avalot { private: From c79387608b27856338c3a2f3099eea28829574f6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 24 Jun 2013 10:15:42 +0200 Subject: [PATCH 0027/1332] AVALANCHE: Add Scrolls2. Logger is needed to proceed. --- engines/avalanche/avalot.cpp | 1 + engines/avalanche/gyro2.h | 2 +- engines/avalanche/scrolls2.cpp | 135 +++++++++++++++++++++++++++++++++ engines/avalanche/scrolls2.h | 72 ++++++++++++++++++ 4 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 engines/avalanche/scrolls2.cpp create mode 100644 engines/avalanche/scrolls2.h diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 09c3ddbc9543..341efcadfdbd 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -42,6 +42,7 @@ namespace Avalanche { Gyro::lmo = false; // resetscroll(); Needs scrolls "unit" to make it work. + warning("STUB: Avalot::Avalot()"); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index c9d8669f17b8..4c29b1f2d401 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -56,7 +56,7 @@ namespace Avalanche { ///////////////////////////// TYPEDEFS ///////////////////////////// - typedef void(*proc)(); + typedef void (*proc)(); struct postype { uint16 x, y, datapos; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp new file mode 100644 index 000000000000..f26527668676 --- /dev/null +++ b/engines/avalanche/scrolls2.cpp @@ -0,0 +1,135 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/scrolls2.h" +#include "avalanche/gyro2.h" +//#include "lucerna.h" +//#include "trip5.h" +//#include "enhanced.h" +//#include "logger.h" +//#include "Acci.h" +//#include "basher.h" +//#include "visa.h" +//#include "timeout.h" + +#include "common/textconsole.h" + +namespace Avalanche { + + namespace Scrolls { + + const int16 roman = 0; + const int16 italic = 1; + + const int16 halficonwidth = 19; /* Half the width of an icon. */ + + int16 dix, diy; + Gyro::raw ch[2]; + byte cfont; /* Current font */ + + int16 dodgex, dodgey; + byte param; /* For using arguments code */ + + byte use_icon; + + void state(byte x) { /* Sets "Ready" light to whatever */ + byte page_; + + if (Gyro::ledstatus == x) return; /* Already like that! */ + + warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); + //switch (x) { + //case 0: + // setfillstyle(1, black); + // break; /* Off */ + //case 1: + // setfillstyle(9, green); + // break; /* Half-on (menus) */ + //case 2: + // setfillstyle(1, green); + // break; /* On (kbd) */ + //case 3: + // setfillstyle(6, green); + // break; /* Hit a key */ + //} + + Gyro::super_off(); + + /* for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + bar(419, 195, 438, 197); + }*/ + + Gyro::super_on(); + Gyro::ledstatus = x; + } + + void easteregg() { + uint16 fv, ff; + + warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); + + /* background(15); + for (fv = 4; fv <= 100; fv ++) + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } + nosound; + setcolor(10); + settextstyle(0, 0, 3); + settextjustify(1, 1); + outtextxy(320, 100, "GIED"); + settextstyle(0, 0, 1); + settextjustify(0, 2);*/ + + Gyro::background(0); + } + + void say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ + const int16 locol = 2; + byte xx, yy, ox, bit, lz, t; + int16 yp; + bool offset; + byte itw[12][80]; + + offset = x % 8 == 4; + x = x / 8; + lz = z.size(); + ox = 0; + // log_scrollline(); Needs Logger to work. + + warning("STUB: Scrolls::say()."); + + } + + + + + } // End of namespace Scrolls + +} // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h new file mode 100644 index 000000000000..07038335bd2c --- /dev/null +++ b/engines/avalanche/scrolls2.h @@ -0,0 +1,72 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef SCROLLS2_H +#define SCROLLS2_H + +#include "common/system.h" + +#include "avalanche/gyro2.h" +// #include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... + +namespace Avalanche { + + namespace Scrolls { + + // Call it where Scrolls are first used. + // Procuded to replace the initizalization part of the original Pascal unit. + void initialize_scrolls(); + + const bool aboutscroll = false; /* Is this the about box? */ + + void state(byte x); /* Sets "Ready" light to whatever */ + + void drawscroll(Gyro::proc gotoit); /* This is one of the oldest procs in the game. */ + + void bubble(Gyro::proc gotoit); + + void resetscroll(); + + void calldrivers(); + + void display(Common::String z); + + bool ask(Common::String question); + + void natural(); + + Common::String lsd(); + + void okay(); /* Says "Okay!" */ + + void musical_scroll(); + + } // End of namespace Scrolls + +} // End of namespace Avalanche + +#endif // SCROLLS2_H From dc05ec1964e74a77ab3b1936b38794b5c158dd06 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 24 Jun 2013 11:52:16 +0200 Subject: [PATCH 0028/1332] AVALANCHE: Relocate used sources. (Should have happened sooner.) --- engines/avalanche/scrolls2.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f26527668676..a7c7a07d5e1e 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -56,6 +56,11 @@ namespace Avalanche { byte use_icon; + + void initialize_scrolls() { + warning("STUB: Scrolls::initialize_scrolls()"); + } + void state(byte x) { /* Sets "Ready" light to whatever */ byte page_; @@ -123,7 +128,7 @@ namespace Avalanche { ox = 0; // log_scrollline(); Needs Logger to work. - warning("STUB: Scrolls::say()."); + warning("STUB: Scrolls::say()"); } From a267dc30251ea51acee6f6f3e1d1c5ea53ca5668 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 24 Jun 2013 11:53:16 +0200 Subject: [PATCH 0029/1332] AVALANCHE: Add Logger. --- engines/avalanche/logger2.cpp | 259 ++++++++++++++++++++++++++++++++++ engines/avalanche/logger2.h | 69 +++++++++ 2 files changed, 328 insertions(+) create mode 100644 engines/avalanche/logger2.cpp create mode 100644 engines/avalanche/logger2.h diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp new file mode 100644 index 000000000000..24582a4e6c4e --- /dev/null +++ b/engines/avalanche/logger2.cpp @@ -0,0 +1,259 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/logger2.h" +#include "avalanche/gyro2.h" +//#include "avalanche/trip6.h" + +#include "common/system.h" +#include "common/textconsole.h" + +namespace Avalanche { + + namespace Logger { + + const char divide[] = "--- oOo ---"; + + /* Epson codes: + + startwith=''; + endwith=''; + double_width = #14; { shift out (SO) } + double_off = #20; { device control 4 (DC4) } + italic = #27+'4'; { switches italics on... } + italic_off = #27+'5'; { and off. } + emph_on = #27+#69; + emph_off = #27+#70; + divide_indent = 15; + + */ + + /* L'jet codes: */ + + //// Not sure if these will be needed at all... + // + //const Common::String startwith = Common::String('\33') + '\50' + "10J" + '\130'; + //const Common::String endwith = Common::String('\33') + '\105'; + //const Common::String italic = Common::String('\33') + '\50' + '\163' + '\61' + '\123'; /* switches italics on... */ + //const Common::String italic_off = Common::String('\33') + '\50' + '\163' + '\60' + '\123'; /* and off. */ + //const Common::String emph_on = Common::String('\33') + '\50' + '\163' + '\63' + '\102'; + //const Common::String emph_off = Common::String('\33') + '\50' + '\163' + '\60' + '\102'; + // + //const Common::String double_width = emph_on; /* There IS no double-width. */ + //const Common::String double_off = emph_off; /* So we'll have to use bold. */ + + + const Common::String quote = ""; + const Common::String unquote = ""; + const Common::String copyright = "(c)"; + const int16 divide_indent = 30; + + Common::String scroll_line; + byte scroll_line_length; + + void centre(byte size, byte x) { /* Prints req'd number of spaces. */ + byte fv; + if (! Gyro::logging) return; + + warning("STUB: Logger::centre()"); + /*for (fv = 1; fv <= size - (x / 2); fv ++) + output << logfile << ' ';*/ + } + + void log_setup(Common::String name, bool printing) { /* Sets up. */ + + warning("STUB: Logger::log_setup()"); + + /* assign(logfile, name); + rewrite(logfile); + output << logfile << startwith; + log_epson = printing; + logging = true; + + if (! printing) { + quote = '"'; + unquote = '"'; + copyright = "(c)"; + }*/ + } + + void log_divider() { /* Prints the divider sign. */ + byte fv; + if (! Gyro::logging) return; + + warning("STUB: Logger::log_divider()"); + + /*if (Gyro::log_epson) { + output << logfile << Common::String(' ') + double_width; + for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; + output << logfile << Common::String(' ') + double_off; + } else + for (fv = 1; fv <= 36; fv ++) output << logfile << ' '; + output << logfile << divide << NL;*/ + } + + void log_command(Common::String x) { /* Prints a command */ + if (! Gyro::logging) return; + + warning("STUB: Logger::log_command()"); + + /*if (Gyro::log_epson) + output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; + else + output << logfile << Common::String("> ") + x << NL;*/ + } + + void log_addstuff(Common::String x) { + if (! Gyro::logging) return; + scroll_line += x; + } + + void log_scrollchar(Common::String x) { /* print one character */ + Common::String z; + if (! Gyro::logging) return; + switch (x[1]) { + case '`': + z = quote; + break; /* Open quotes: "66" */ + case '"': + z = unquote; + break; /* Close quotes: "99" */ + case '\357': + z = copyright; + break; /* Copyright sign. */ + default: + z = x; + } + log_addstuff(z); + scroll_line_length += z.size(); + } + + void log_italic() { + if (! Gyro::logging) return; + + warning("STUB: Logger::log_italic()"); + + /*if (Gyro::log_epson) + log_addstuff(italic); + else + log_addstuff("*");*/ + } + + void log_roman() { + if (! Gyro::logging) return; + + warning("STUB: Logger::log_roman()"); + + /* if (Gyro::log_epson) + log_addstuff(italic_off); + else + log_addstuff("*");*/ + } + + void log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ + if (! Gyro::logging) return; + + warning("STUB: Logger::log_epsonroman()"); + + //if (Gyro::log_epson) log_addstuff(italic_off); + } + + void log_scrollline() { /* Set up a line for the scroll driver */ + scroll_line_length = 0; + scroll_line = ""; + } + + void log_scrollendline(bool centred) { + byte x, fv; + if (! Gyro::logging) return; + x = 17; + if (centred) x += (50 - scroll_line_length) / 2; + + warning("STUB: Logger::log_scrollendline()"); + + /*for (fv = 1; fv <= x; fv ++) output << logfile << ' '; + output << logfile << scroll_line << NL;*/ + } + + void log_bubbleline(byte linenum, byte whom, Common::String x) { + byte fv; + if (! Gyro::logging) return; + + warning("STUB: Logger::log_bubbleline()"); + + /*if (linenum == 1) { + for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; + output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; + } else { + for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; + output << logfile << x << NL; + }*/ + } + + void log_newline() { + warning("STUB: Logger::log_newline()"); + + //if (Gyro::logging) output << logfile << NL; + } + + void log_newroom(Common::String where) { + byte fv; + if (! Gyro::logging) return; + + warning("STUB: Logger::log_newroom()"); + + /*for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; + if (Gyro::log_epson) output << logfile << emph_on; + output << logfile << Common::String('(') + where + ')'; + if (Gyro::log_epson) output << logfile << emph_off; + output << logfile << NL;*/ + } + + void log_aside(Common::String what) + /* This writes "asides" to the printer. For example, moves in Nim. */ + { + if (! Gyro::logging) return; + + warning("STUB: Logger::log_aside()"); + + //output << logfile << " (" << italic << what << italic_off << ')' << NL; + /* "What" is what to write. */ + } + + void log_score(uint16 credit, uint16 now) { + byte fv; + if (! Gyro::logging) return; + + warning("STUB: Logger::log_score()"); + + /*for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; + output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ + } + + } // End of namespace Logger + +} // End of namespace Avalanche diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h new file mode 100644 index 000000000000..a1b7882abfdc --- /dev/null +++ b/engines/avalanche/logger2.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef LOGGER2_H +#define LOGGER2_H + +#include "common/system.h" + +namespace Avalanche { + + namespace Logger { + + void log_setup(Common::String name, bool printing); + + void log_divider(); /* Prints the divider sign. */ + + void log_command(Common::String x); /* Prints a command */ + + void log_scrollchar(Common::String x); /* print one character */ + + void log_italic(); + + void log_roman(); + + void log_epsonroman(); + + void log_scrollline(); /* Set up a line for the scroll driver */ + + void log_scrollendline(bool centred); + + void log_bubbleline(byte linenum, byte whom, Common::String x); + + void log_newline(); + + void log_newroom(Common::String where); + + void log_aside(Common::String what); + + void log_score(uint16 credit, uint16 now); + + } // End of namespace Logger + +} // End of namespace Avalanche + +#endif // LOGGER2_H From 11efe29da865deb8ccefcb289a557b618ebf7e29 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 25 Jun 2013 13:05:04 +0200 Subject: [PATCH 0030/1332] AVALANCHE: Add Enhanced. --- engines/avalanche/enhanced2.cpp | 59 +++++++++++++++ engines/avalanche/enhanced2.h | 53 ++++++++++++++ engines/avalanche/gyro2.cpp | 2 - engines/avalanche/scrolls2.cpp | 124 +++++++++++++++++++++++++++++++- 4 files changed, 233 insertions(+), 5 deletions(-) create mode 100644 engines/avalanche/enhanced2.cpp create mode 100644 engines/avalanche/enhanced2.h diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp new file mode 100644 index 000000000000..c5b038861d8f --- /dev/null +++ b/engines/avalanche/enhanced2.cpp @@ -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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/enhanced2.h" +#include "common/system.h" +#include "common/textconsole.h" + +namespace Avalanche { + + namespace Enhanced { + + bool isenh() { + warning("STUB: Enhanced::isenh()"); + } + + void readkeye() { + warning("STUB: Enhanced::readkeye()"); + } + + bool keypressede() { + /* + function fancystuff:boolean; + inline( $B4/ $11/ { MOV AH,11 } + $CD/ $16/ { INT 16 } + $B8/ $00/ $00/ { MOV AX, 0000 } + $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } + $40); { INC AX } + */ + + warning("STUB: Enhanced::keypressede()"); + } + + } // End of namespace Enhanced + +} // End of namespace Avalanche diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h new file mode 100644 index 000000000000..d696c32a79aa --- /dev/null +++ b/engines/avalanche/enhanced2.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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + + + +// Not sure if this unit will be used at all in the end... + +#ifndef ENHANCED2_H +#define ENHANCED2_H + +#include "common/system.h" + +namespace Avalanche { + + namespace Enhanced { + + byte shiftstate; /*ABSOLUTE $40:$17;*/ + bool atbios; + char inchar, extd; + + void readkeye(); + + bool keypressede(); + + } // End of namespace Enhanced + +} // End of namespace Avalanche + +#endif // ENHANCED2_H diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 6c7727993354..fba155af5918 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -324,8 +324,6 @@ namespace Avalanche { else on(); } - - } // End of namespace Gyro } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a7c7a07d5e1e..cbbd2e187b7f 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -27,10 +27,10 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" +#include "avalanche/logger2.h" //#include "lucerna.h" //#include "trip5.h" //#include "enhanced.h" -//#include "logger.h" //#include "Acci.h" //#include "basher.h" //#include "visa.h" @@ -126,12 +126,130 @@ namespace Avalanche { x = x / 8; lz = z.size(); ox = 0; - // log_scrollline(); Needs Logger to work. + Logger::log_scrollline(); + + for (xx = 1; xx <= lz; xx ++) { + switch (z[xx]) { + case '\22': { + cfont = roman; + Logger::log_roman(); + } + break; + case '\6': { + cfont = italic; + Logger::log_italic(); + } + break; + default: { + ox += 1; + for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; + Logger::log_scrollchar(z[xx]); + } + } + } + + lz = ox; + if (offset) { + /* offsetting routine */ + lz += 1; + for (yy = 1; yy <= 12; yy ++) { + bit = 240; + itw[yy][lz] = 255; + for (xx = 1; xx <= lz; xx ++) { + t = itw[yy][xx]; + itw[yy][xx] = bit + t / 16; + bit = t << 4; + } + } + } + yp = x + y * 80 + (1 - Gyro::cp) * Gyro::pagetop; + for (yy = 1; yy <= 12; yy ++) { + yp += 80; + for (bit = 0; bit <= locol; bit ++) { + /*port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(itw[yy], mem[0xa000 * yp], lz); + + Some old Pascal-ish. To be removed. */ + + warning("STUB: Scrolls::say()"); + } + } + + } + + /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ + + void normscroll() { + warning("STUB: Scrolls::normscroll()"); + } + + void dialogue() { + warning("STUB: Scrolls::dialogue()"); + } + + void music_scroll(); + + + static void store_(byte what, Gyro::tunetype &played) { + memcpy(played, played+1, sizeof(played) - 1); + played[30] = what; + } + + + + static bool they_match(Gyro::tunetype &played) { + byte fv, mistakes; + + bool they_match_result; + mistakes = 0; - warning("STUB: Scrolls::say()"); + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != Gyro::tune[fv]) { + mistakes++; + } + they_match_result = mistakes < 5; + return they_match_result; } + void music_scroll() { + char r; + byte value; + + byte last_one, this_one; + + Gyro::tunetype played; + + + state(3); + Gyro::seescroll = true; + Gyro::on(); + Gyro::newpointer(4); + //do { + // do { + // Gyro::check(); /* was "checkclick;" */ + // if (keypressede()) break; + // } while (!(mpress > 0) || buttona1() || buttonb1()); + // + // Needs Enhanced (conatins keypressede()) to proceed. + + + + } + + + + + + + + + + + From c39434f37ee24b44c354dc765ad18309471d394a Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 25 Jun 2013 18:03:46 +0200 Subject: [PATCH 0031/1332] AVALANCHE: Add Lucerna. --- engines/avalanche/lucerna2.cpp | 81 +++++++++++++++++++++++ engines/avalanche/lucerna2.h | 114 +++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 engines/avalanche/lucerna2.cpp create mode 100644 engines/avalanche/lucerna2.h diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp new file mode 100644 index 000000000000..88db23e54102 --- /dev/null +++ b/engines/avalanche/lucerna2.cpp @@ -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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "common/system.h" +#include "avalanche/lucerna2.h" +#include "avalanche/gyro2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/logger2.h" +#include "avalanche/enhanced2.h" + +//#include "Graph.h" +///*#include "Dos.h"*/ +///*#include "Crt.h"*/ +//#include "trip5.h" +//#include "Acci.h" +//#include "pingo.h" +//#include "dropdown.h" +//#include "visa.h" +//#include "celer.h" +//#include "timeout.h" +//#include "basher.h" +//#include "sequence.h" + +namespace Avalanche { + + namespace Lucerna { + + bool fxhidden; + + struct rgbrec { + int16 red; + int16 green; + int16 blue; + }; + + struct palettetype { + int32 size; + rgbrec colors[256]; + }; + + palettetype fxpal[4]; + + void callverb(char n) { + /*if (n == pardon) + Scrolls::display( + "The f5 key lets you do a particular action in certain " + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + "current setting of this key is.");*/ + + // Needs const char pardon located in Acci. + + } + + } // End of namespace Lucerna + +} // End of namespace Avalanche \ No newline at end of file diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h new file mode 100644 index 000000000000..bee9c107d2da --- /dev/null +++ b/engines/avalanche/lucerna2.h @@ -0,0 +1,114 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef LUCERNA2_H +#define LUCERNA2_H + +#include "common/scummsys.h" + +namespace Avalanche { + + namespace Lucerna { + + // Call it where Lucerna is first used. + // Procuded to replace the initizalization part of the original Pascal unit. + void initialize_lucerna(); + + void callverb(char n); + + void draw_also_lines(); + + void mouse_init(); + + void mousepage(uint16 page_); + + void load(byte n); + + void exitroom(byte x); + + void enterroom(byte x, byte ped); + + void thinkabout(char z, bool th); /* Hey!!! Get it and put it!!! */ + + void load_digits(); /* Load the scoring digits & rwlites */ + + void toolbar(); + + void showscore(); + + void points(byte num); /* Add on no. of points */ + + void mouseway(); + + void inkey(); + + void posxy(); + + void fxtoggle(); + + void objectlist(); + + void checkclick(); + + void errorled(); + + void dusk(); + + void dawn(); + + void showrw(); + + void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t); /* The Minstrel Blitter */ + + void blitfix(); + + void clock_lucerna(); + + void flip_page(); + + void delavvy(); + + void gameover(); + + void minor_redraw(); + + void major_redraw(); + + uint16 bearing(byte whichped); + + void flesh_colours(); + + void sprite_run(); + + void fix_flashers(); + + } // End of namespace Lucerna + +} // End of namespace Avalanche + + +#endif // LUCERNA2_H From 7f1a322de484a8958db46dc34ab134285fc9c886 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 25 Jun 2013 18:04:52 +0200 Subject: [PATCH 0032/1332] AVALANCHE: Repair compilation. --- engines/avalanche/avalot.h | 3 +-- engines/avalanche/enhanced2.cpp | 2 ++ engines/avalanche/enhanced2.h | 2 +- engines/avalanche/scrolls2.cpp | 28 ++++++++++++++++------------ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 5f109339bd96..073b07377ba4 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -32,10 +32,9 @@ namespace Avalanche { -bool checkbreak; // Originally located in avalot9.map - class Avalot { private: + bool checkbreak; // Originally located in avalot9.map public: Avalot(); diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp index c5b038861d8f..7a9a58f50dd9 100644 --- a/engines/avalanche/enhanced2.cpp +++ b/engines/avalanche/enhanced2.cpp @@ -35,6 +35,7 @@ namespace Avalanche { bool isenh() { warning("STUB: Enhanced::isenh()"); + return true; } void readkeye() { @@ -52,6 +53,7 @@ namespace Avalanche { */ warning("STUB: Enhanced::keypressede()"); + return true; } } // End of namespace Enhanced diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index d696c32a79aa..98ef781213d1 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -39,7 +39,7 @@ namespace Avalanche { namespace Enhanced { byte shiftstate; /*ABSOLUTE $40:$17;*/ - bool atbios; + bool atbios; // BIOS type char inchar, extd; void readkeye(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index cbbd2e187b7f..57c15a2b8f8c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -28,9 +28,10 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" #include "avalanche/logger2.h" +#include "avalanche/enhanced2.h" + //#include "lucerna.h" //#include "trip5.h" -//#include "enhanced.h" //#include "Acci.h" //#include "basher.h" //#include "visa.h" @@ -143,7 +144,7 @@ namespace Avalanche { default: { ox += 1; for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; - Logger::log_scrollchar(z[xx]); + Logger::log_scrollchar(Common::String(z[xx])); } } } @@ -229,15 +230,19 @@ namespace Avalanche { Gyro::on(); Gyro::newpointer(4); //do { - // do { - // Gyro::check(); /* was "checkclick;" */ - // if (keypressede()) break; - // } while (!(mpress > 0) || buttona1() || buttonb1()); - // - // Needs Enhanced (conatins keypressede()) to proceed. - - - + //do { + // Gyro::check(); /* was "checkclick;" */ + // if (Enhanced::keypressede()) break; + //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); + // + // Needs joystick - not sure it will be implemented. + + //if (Gyro::mpress == 0) { + // inkey(); Needs Lucerna to proceed. + // + //} + //} + } @@ -250,7 +255,6 @@ namespace Avalanche { - } // End of namespace Scrolls From ca807d74bf33d062516093aac27921853f658b77 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 26 Jun 2013 11:04:29 +0200 Subject: [PATCH 0033/1332] AVALANCHE: Add Visa. --- engines/avalanche/visa2.cpp | 76 +++++++++++++++++++++++++++++++++++++ engines/avalanche/visa2.h | 45 ++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 engines/avalanche/visa2.cpp create mode 100644 engines/avalanche/visa2.h diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp new file mode 100644 index 000000000000..ee1f761ff9de --- /dev/null +++ b/engines/avalanche/visa2.cpp @@ -0,0 +1,76 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/visa2.h" +#include "avalanche/gyro2.h" +#include "avalanche/scrolls2.h" +//#include "avalanche/acci2.h" +#include "avalanche/lucerna2.h" + +#include "common/textconsole.h" + +/*#include "Trip5.h"*/ + +namespace Avalanche { + + namespace Visa { + + const bool bubbling = false; + const bool report_dixi_errors = true; + + bool went_ok; + + void unskrimble() { + for (uint16 fv = 0; fv < Gyro::bufsize; fv++) + Gyro::buffer[fv] = (char)((!(Gyro::buffer[fv]) - fv) % 256); + } + + void do_the_bubble() { + Gyro::bufsize++; + Gyro::buffer[Gyro::bufsize] = 2; + } + + // File handling. + void dixi(char block, byte point) { + warning("STUB: Visa::dixi()"); + } + + // File handling. + void speech(byte who, byte subject) { + warning("STUB: Visa::speech()"); + } + + void talkto(byte whom) { + byte fv; + bool no_matches; + + warning("STUB: Visa::talkto()"); + } + + } // End of namespace Visa. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h new file mode 100644 index 000000000000..feda7b60fd5a --- /dev/null +++ b/engines/avalanche/visa2.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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef VISA2_H +#define VISA2_H + +#include "common/scummsys.h" + +namespace Avalanche { + + namespace Visa { + + void dixi(char block, byte point); + + void talkto(byte whom); + + } // End of namespace Visa. + +} // End of namespace Avalanche. + +#endif // VISA2_H From 3e48a4e18725f2b3b6b1f1a3476b848a93af2f42 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 26 Jun 2013 14:14:01 +0200 Subject: [PATCH 0034/1332] AVALANCHE: Add Celer. --- engines/avalanche/celer2.cpp | 397 +++++++++++++++++++++++++++++++++++ engines/avalanche/celer2.h | 80 +++++++ 2 files changed, 477 insertions(+) create mode 100644 engines/avalanche/celer2.cpp create mode 100644 engines/avalanche/celer2.h diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp new file mode 100644 index 000000000000..6efabea0410d --- /dev/null +++ b/engines/avalanche/celer2.cpp @@ -0,0 +1,397 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* CELER The unit for updating the screen pics. */ + +#include "avalanche/celer2.h" +#include "common/textconsole.h" +//#include "avalanche/trip6.h" +#include "avalanche/lucerna2.h" +#include "avalanche/gyro2.h" +#include "avalanche/roomnums.h" + +namespace Avalanche { + + namespace Celer { + + //untyped_file f; /* Private variable- not accessible from elsewhere. */ + + const int16 on_disk = -1; /* Value of memos[fv].x when it's not in memory. */ + + void pics_link() { + byte xx; + + if (Gyro::ddmnow) return; /* No animation when the menus are up. */ + + { + Gyro::dnatype &with = Gyro::dna; + switch (with.room) { + + case r__outsideargentpub: { + if ((Gyro::roomtime % int32(12)) == 0) + show_one(int32(1) + (Gyro::roomtime / int32(12)) % int32(4)); + } + break; + + case r__brummieroad: + if ((Gyro::roomtime % int32(2)) == 0) + show_one(int32(1) + (Gyro::roomtime / int32(2)) % int32(4)); + break; + + case r__bridge: + if ((Gyro::roomtime % int32(2)) == 0) + show_one(int32(4) + (Gyro::roomtime / int32(2)) % int32(4)); + break; + + case r__yours: + if ((! with.avvy_is_awake) && ((Gyro::roomtime % int32(4)) == 0)) + show_one(int32(1) + (Gyro::roomtime / int32(12)) % int32(2)); + break; + + case r__argentpub: { + if (((Gyro::roomtime % int32(7)) == 1) && (Gyro::dna.malagauche != 177)) { + /* Malagauche cycle */ + Gyro::dna.malagauche += 1; + switch (Gyro::dna.malagauche) { + case 1: + case 11: + case 21: + show_one(12); + break; /* Looks forwards. */ + case 8: + case 18: + case 28: + case 32: + show_one(11); + break; /* Looks at you. */ + case 30: + show_one(13); + break; /* Winks. */ + case 33: + Gyro::dna.malagauche = 0; + break; + } + } + + switch (Gyro::roomtime % 200) { + case 179: + case 197: + show_one(5); + break; /* Dogfood's drinking cycle */ + case 182: + case 194: + show_one(6); + break; + case 185: + show_one(7); + break; + case 199: + Gyro::dna.dogfoodpos = 177; + break; /* Impossible value for this. */ + } + + if ((Gyro::roomtime % 200 >= 0) && (Gyro::roomtime % 200 <= 178)) { /* Normally. */ + if (((Lucerna::bearing(2) >= 1) && (Lucerna::bearing(2) <= 90)) || ((Lucerna::bearing(2) >= 358) && (Lucerna::bearing(2) <= 360))) + xx = 3; + else if ((Lucerna::bearing(2) >= 293) && (Lucerna::bearing(2) <= 357)) + xx = 2; + else if ((Lucerna::bearing(2) >= 271) && (Lucerna::bearing(2) <= 292)) + xx = 4; + + if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + Gyro::dna.dogfoodpos = xx; + } + } + + } + break; + + case r__westhall: + if ((Gyro::roomtime % int32(3)) == 0) + switch ((Gyro::roomtime / int32(3)) % int32(6)) { + case 4: + show_one(1); + break; + case 1: + case 3: + case 5: + show_one(2); + break; + case 0: + case 2: + show_one(3); + break; + } + break; + + case r__lustiesroom: + if (!(Gyro::dna.lustie_is_asleep)) { + if ((Gyro::roomtime % int32(45)) > 42) + xx = 4; /* du Lustie blinks */ + + /* Bearing of Avvy from du Lustie. */ + else if (((Lucerna::bearing(2) >= 0) && (Lucerna::bearing(2) <= 45)) || ((Lucerna::bearing(2) >= 315) && (Lucerna::bearing(2) <= 360))) + xx = 1; /* Middle. */ + else if ((Lucerna::bearing(2) >= 45) && (Lucerna::bearing(2) <= 180)) + xx = 2; /* Left. */ + else if ((Lucerna::bearing(2) >= 181) && (Lucerna::bearing(2) <= 314)) + xx = 3; /* Right. */ + + if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + case r__aylesoffice: + if ((! Gyro::dna.ayles_is_awake) && (Gyro::roomtime % int32(14) == 0)) { + switch ((Gyro::roomtime / int32(14)) % int32(2)) { + case 0: + show_one(1); + break; /* Frame 2: EGA. */ + case 1: + show_one(3); + break; /* Frame 1: Natural. */ + } + } + break; + + case r__robins: + if (Gyro::dna.tied_up) + switch (Gyro::roomtime % int32(54)) { + case 20: + show_one(4); + break; /* Frame 4: Avalot blinks. */ + case 23: + show_one(2); + break; /* Frame 1: Back to normal. */ + } + break; + + case r__nottspub: { + /* Bearing of Avvy from Port. */ + if (((Lucerna::bearing(5) >= 0) && (Lucerna::bearing(5) <= 45)) || ((Lucerna::bearing(5) >= 315) && (Lucerna::bearing(5) <= 360))) + xx = 2; /* Middle. */ + else if ((Lucerna::bearing(5) >= 45) && (Lucerna::bearing(5) <= 180)) + xx = 6; /* Left. */ + else if ((Lucerna::bearing(5) >= 181) && (Lucerna::bearing(5) <= 314)) + xx = 8; /* Right. */ + + if ((Gyro::roomtime % int32(60)) > 57) xx--; /* Blinks */ + + if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + + switch (Gyro::roomtime % 50) { + case 45 : + show_one(9); + break; /* Spurge blinks */ + case 49 : + show_one(10); + break; + } + } + break; + + case r__ducks: { + if ((Gyro::roomtime % 3) == 0) /* The fire flickers */ + show_one(1 + (Gyro::roomtime / 3) % 3); + + {/* Lucerna::bearing of Avvy from Duck. */ + if (((Lucerna::bearing(2) >= 0) && (Lucerna::bearing(2) <= 45)) || ((Lucerna::bearing(2) >= 315) && (Lucerna::bearing(2) <= 360))) + xx = 4; /* Middle. */ + else if ((Lucerna::bearing(2) >= 45) && (Lucerna::bearing(2) <= 180)) + xx = 6; /* Left. */ + else if ((Lucerna::bearing(2) >= 181) && (Lucerna::bearing(2) <= 314)) + xx = 8; /* Right. */ + + if ((Gyro::roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ + + if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + } + break; + + } + } + + if ((Gyro::dna.ringing_bells) && (Gyro::flagset('B'))) + /* They're ringing the bells. */ + switch (Gyro::roomtime % int32(4)) { + case 1: { + Gyro::dnatype &with = Gyro::dna; + + if (with.nextbell < 5) with.nextbell = 12; + with.nextbell -= 1; + Gyro::note(Gyro::notes[with.nextbell]); + } + break; + case 2: + //nosound; + warning("STUB: Celer::pics_link()"); + break; + } + } + } + + void load_chunks(Common::String xx) { + warning("STUB: Celer::load_chunks()"); + } + + void forget_chunks() { + warning("STUB: Celer::forget_chunks()"); + } + + void mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) /* assembler; + asm + push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} + push bp; { Nor BP! } + + + { DI holds the offset on this page. It starts at the top left-hand corner. } + { (It should equal ch.y*80+ch.x. } + + mov ax,y; + mov dl,80; + mul dl; { Line offset now calculated. } + mov di,ax; { Move it into DI. } + mov ax,x; + add di,ax; { Full offset now calculated. } + + mov bx,yl; { No. of times to repeat lineloop. } + inc bx; { "loop" doesn't execute the zeroth time. } + mov bh,bl; { Put it into BH. } + + { BP holds the length of the Common::String to copy. It's equal to ch.xl.} + + mov ax,uint16(p); { Data is held at DS:SI. } + mov si,ax; + mov ax,uint16(p+2); { This will be moved over into ds in just a tick... } + + mov bp,xl; + + mov ds,ax; + + + cld; { We're allowed to hack around with the flags! } + + mov ax,$AC00; { Top of the first EGA page. } + mov es,ax; { Offset on this page is calculated below... } + + + { port[$3c4]:=2; port[$3ce]:=4; } + + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; + + mov cx,4; { This loop executes for 3, 2, 1, and 0. } + mov bl,0; + + + @mainloop: + + push di; + push cx; + + { port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; + { port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; + + xor ch,ch; + mov cl,bh; { BH = ch.yl. } + + @lineloop: + + push cx; + + mov cx,bp; + + repz movsb; { Copy the data. } + + sub di,bp; + add di,80; + + pop cx; + + loop @lineloop; + + inc bl; { One more on BL. } + + pop cx; + pop di; + + loop @mainloop; + + pop bp; + pop ds; { Get DS back again. } + */ + { + } + + void show_one(byte which); + + void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p) { + warning("STUB: Celer::display_it()"); + } + + void show_one(byte which) { + warning("STUB: Celer::show_one()"); + } + + + + void show_one_at(byte which, int16 xxx, int16 yyy); + + static void display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { + warning("STUB: Celer::display_it1()"); + } + + void show_one_at(byte which, int16 xxx, int16 yyy) { + warning("STUB: Celer::show_one_at()"); + } + + + } // End of namespace Celer. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h new file mode 100644 index 000000000000..466ed8d9d028 --- /dev/null +++ b/engines/avalanche/celer2.h @@ -0,0 +1,80 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* CELER The unit for updating the screen pics. */ + +#ifndef CELER2_H +#define CELER2_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Avalanche { + + namespace Celer { + + enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; + + struct chunkblocktype { + flavourtype flavour; + int16 x, y; + int16 xl, yl; + int32 size; + bool natural; + + bool memorise; /* Hold it in memory? */ + }; + + struct memotype { + int16 x, y; + int16 xl, yl; + flavourtype flavour; + uint16 size; + }; + + int32 offsets[40]; + byte num_chunks = 0; + memotype memos[40]; + void *memory[40]; + + + + void pics_link(); + + void load_chunks(Common::String xx); + + void forget_chunks(); + + void show_one(byte which); + + void show_one_at(byte which, int16 xxx, int16 yyy); + + } // End of namespace Celer. + +} // End of namespace Avalanche. + +#endif // CELER2_H From b8073372827401f1e3e271666490696a4bd9f9f4 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 26 Jun 2013 15:42:05 +0200 Subject: [PATCH 0035/1332] AVALANCHE: Add Sequence. --- engines/avalanche/sequence2.cpp | 109 ++++++++++++++++++++++++++++++++ engines/avalanche/sequence2.h | 65 +++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 engines/avalanche/sequence2.cpp create mode 100644 engines/avalanche/sequence2.h diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp new file mode 100644 index 000000000000..851dcb139a49 --- /dev/null +++ b/engines/avalanche/sequence2.cpp @@ -0,0 +1,109 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* SEQUENCE The sequencer. */ + +#include "avalanche/sequence2.h" +#include "common/scummsys.h" +#include "avalanche/gyro2.h" +#include "avalanche/timeout2.h" +#include "avalanche/celer2.h" +#include "avalanche/trip6.h" + +namespace Avalanche { + + namespace Sequence { + + void then_show(byte what) { + byte fv; + for (fv = 1; fv <= seq_length; fv ++) + if (seq[fv] == 0) { + seq[fv] = what; + return; + } + } + + void first_show(byte what) { + /* First, we need to blank out the entire array. */ + for (int i = 0; i < sizeof(seq); i++) + seq[i] = 0; + + /* Then it's just the same as then_show. */ + then_show(what); + + } + + void then_flip(byte where, byte ped) { + then_show(now_flip); + + Gyro::dna.flip_to_where = where; + Gyro::dna.flip_to_ped = ped; + } + + void start_to_close() { + Timeout::lose_timer(Timeout::reason_sequencer); + Timeout::set_up_timer(7, Timeout::PROCsequence, Timeout::reason_sequencer); + } + + void start_to_open() { + Gyro::dna.user_moves_avvy = false; /* They can't move. */ + Trip::stopwalking(); /* And they're not moving now. */ + start_to_close(); /* Apart from that, it's the same thing. */ + } + + void call_sequencer(); + + /* This PROC is called by Timeout when it's time to do another frame. */ + static void shove_left() { + memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */ + } + + void call_sequencer() { + switch (seq[0]) { + case 0: + return; + break; /* No more routines. */ + case 177: { + Gyro::dna.user_moves_avvy = true; + Trip::fliproom(Gyro::dna.flip_to_where, Gyro::dna.flip_to_ped); /* 177 = Flip room. */ + if (seq[0] == 177) shove_left(); + } + break; + } + + if ((seq[0] >= 1) && (seq[0] <= 176)) { + /* Show a frame. */ + Celer::show_one(seq[1]); + shove_left(); + } + + start_to_close(); /* Make sure this PROC gets called again. */ + } + + } // End of namespace Sequence . + +} // End of namespace Avalanche. diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h new file mode 100644 index 000000000000..0e53ccf2a1c0 --- /dev/null +++ b/engines/avalanche/sequence2.h @@ -0,0 +1,65 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* SEQUENCE The sequencer. */ + +#ifndef SEQUENCE2_H +#define SEQUENCE2_H + +#include "common/scummsys.h" + +namespace Avalanche { + + namespace Sequence { + + const int16 now_flip = 177; + + const int16 seq_length = 10; + + + + byte seq[seq_length]; + + + + void first_show(byte what); + + void then_show(byte what); + + void then_flip(byte where, byte ped); + + void start_to_close(); + + void start_to_open(); + + void call_sequencer(); + + } // End of namespace Sequence . + +} // End of namespace Avalanche. + +#endif // SEQUENCE2_H From f558eb2e5689ed343bfd64502e45787e61a17ce4 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 08:35:21 +0200 Subject: [PATCH 0036/1332] AVALANCHE: Add Enid. --- engines/avalanche/enid2.cpp | 327 ++++++++++++++++++++++++++++++++++++ engines/avalanche/enid2.h | 59 +++++++ 2 files changed, 386 insertions(+) create mode 100644 engines/avalanche/enid2.cpp create mode 100644 engines/avalanche/enid2.h diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp new file mode 100644 index 000000000000..9c7d64a1b113 --- /dev/null +++ b/engines/avalanche/enid2.cpp @@ -0,0 +1,327 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* ENID Edna's manager. */ + +#include "common/scummsys.h" +#include "common/textconsole.h" + +#include "avalanche/enid2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/trip6.h" +#include "avalanche/timeout2.h" +#include "avalanche/celer2.h" +#include "avalanche/sequence2.h" +//#include "fileunit.h" +//#include "basher.h" + + +namespace Avalanche { + + namespace Enid { + + const Common::String crlf = Common::String(char(15)) + Common::String(char(12)); + const char tab = '\t'; + const char eof_ = '\n'; + + const Common::String ednafirst = + Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ + crlf + eof_ + crlf + crlf + /*7*/ + tab + "Glory to God in the highest," + crlf + /*31*/ + tab + "and on earth peace, goodwill toward men." + /*42*/ + crlf + tab + tab + tab + tab + /*6*/ + "Luke 2:14." + /*10*/ + crlf + crlf + crlf + /* 6 */ + "1234567890" +crlf; /*11*/ + + const Common::String ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); + + const int16 ttage = 18; + const Common::String ttwashere = "Thomas was here "; + + bool bug; + + + + Common::String expanddate(byte d, byte m, uint16 y); + + static Common::String month; + + static Common::String day; + + static void addon(Common::String x) { + //month[0]--; + month = month + x; + } + + Common::String expanddate(byte d, byte m, uint16 y) { + const Common::String months[12] = { + "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", + "Septem*", "Octo*", "Novem*", "Decem*" + }; + + Common::String expanddate_result; + month = months[m]; + switch (month[month.size()]) { + case '#': + addon("uary"); + break; + case '*': + addon("ber"); + break; + } + + day = Gyro::strf(d); + + if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) + switch (d % 10) { + case 1: + day = day + "st"; + break; + case 2: + day = day + "nd"; + break; + case 3: + day = day + "rd"; + break; + default: + day = day + "th"; + } + + expanddate_result = day + ' ' + month + ' ' + Gyro::strf(y); + return expanddate_result; + } + + + + void edna_save(Common::String name); + + static void show_bug(char icon, Common::String strn) { + Scrolls::display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); + } + + static bool test_bug(byte what) { + bool test_bug_result; + if (what == 0) { + test_bug_result = false; + return test_bug_result; + } + switch (what) { + case 2: + show_bug('7', "Error in filename!"); + break; + case 101: + show_bug('6', "Disk full!"); + break; + case 150: + show_bug('4', "Disk is write-protected!"); + break; + default: + show_bug('B', "Saving error!"); + } + test_bug_result = true; + return test_bug_result; + } + + void edna_save(Common::String name) { + warning("STUB: Enid::edna_save()"); + } + + void loaderror(Common::String x, char icon) { + if (Gyro::holdthedawn) { + Gyro::holdthedawn = false; + Lucerna::dawn(); + } + Scrolls::display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); + bug = true; + } + + + + typedef char fourtype[5]; + + + + const fourtype avaricius_file = "Avvy"; + + void edna_load(Common::String name) { + warning("STUB: Enid::edna_load()"); + } + + + + void dir(Common::String where); + + static Common::String path, groi; + + static void showheader() { + Scrolls::display(Common::String("Dir: ") + path + "\r\r\4"); + } + + void dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */ + warning("STUB: Enid::dir()"); + } + + void avvy_background() { /* Not really a filing procedure, + but it's only called just before edna_load, so I thought I'd put it + in Enid instead of, say, Lucerna. */ + + /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ + /* + asm + mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } + mov dx,$3ce; mov al,4; out dx,al; { register. } + mov dx,$3c5; mov al,1; out dx,al; + mov dx,$3cf; out dx,al; + + mov bx,$A000; call far ptr @drawup; + mov bx,$A400; call far ptr @drawup; + + jmp @the_end; + + @drawup: + + mov es,bx; { The segment to copy it to... } + mov di,$370; { The offset (10 pixels down, plus 1 offset.) } + + mov cx,10; + mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } + mov ax,$AEAA; call far ptr @sameline; + mov ax,$A4EA; call far ptr @sameline; + mov ax,$44A4; call far ptr @sameline; + + mov cx,9; + mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } + mov ax,$AAEA; call far ptr @sameline; + mov ax,$AA4E; call far ptr @sameline; + mov ax,$444A; call far ptr @sameline; + + mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } + mov ax,$AAAE; call far ptr @sameline; + mov ax,$EAA4; call far ptr @sameline; + mov ax,$A444; call far ptr @sameline; + + mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } + mov ax,$EAAA; call far ptr @sameline; + mov ax,$4EAA; call far ptr @sameline; + mov ax,$4A44; call far ptr @sameline; + + ret; + + + { Replicate the same line many times. } + + @sameline: + { Requires: + what to copy in AX, + how many lines in CX, and + original offset in DI. } + push cx; + push di; + + @samelineloop: + + push cx; + mov cx,40; { No. of times to repeat it on one line. } + + repz stosw; { Fast uint16-copying } + + pop cx; + + add di,1200; { The next one will be 16 lines down. } + + loop @samelineloop; + pop di; + add di,80; + pop cx; + + ret; + + @the_end: + end; + */ + Lucerna::blitfix(); + } + + void to_sundry(Gyro::sundry &sund) { + { + sund.qenid_filename = Gyro::enid_filename; + sund.qsoundfx = Gyro::soundfx; + sund.qthinks = Gyro::thinks; + sund.qthinkthing = Gyro::thinkthing; + } + } + + void from_sundry(Gyro::sundry sund) { + { + Gyro::enid_filename = sund.qenid_filename; + Gyro::soundfx = sund.qsoundfx; + Gyro::thinks = sund.qthinks; + Gyro::thinkthing = sund.qthinkthing; + } + } + + void restore_dna() { + uint16 here, fv; + Gyro::sundry sund; + + warning("STUB: Enid::restore_dna()"); + } + + void edna_reload() { + + restore_dna(); + + Gyro::seescroll = true; /* This prevents display of the new sprites before the + new picture is loaded. */ + + Lucerna::major_redraw(); + + Gyro::whereis[Gyro::pavalot] = Gyro::dna.room; + + Gyro::alive = true; + + Lucerna::objectlist(); + + if (Gyro::holdthedawn) { + Gyro::holdthedawn = false; + Lucerna::dawn(); + } + } + + void back_to_bootstrap(byte what) { + warning("STUB: Enid::back_to_bootstrap()"); + } + + bool there_was_a_problem() { + return bug; + } + + } // End of namespace Enid. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h new file mode 100644 index 000000000000..0b4671ad30ef --- /dev/null +++ b/engines/avalanche/enid2.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* ENID Edna's manager. */ + +#ifndef ENID2_H +#define ENID2_H + +#include "common/scummsys.h" + +#include "avalanche/gyro2.h" + +namespace Avalanche { + + namespace Enid { + + void edna_save(Common::String name); + + void edna_load(Common::String name); + + void edna_reload(); /* From Bootstrap's storage. */ + + void dir(Common::String where); + + void avvy_background(); + + void back_to_bootstrap(byte what); + + bool there_was_a_problem(); + + } // End of namespace Enid. + +} // End of namespace Avalanche. + +#endif // ENID2_H From 1d950021b818cb1bc6348d0bdac615493b2c4260 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 09:06:46 +0200 Subject: [PATCH 0037/1332] AVALANCHE: Add Pingo. --- engines/avalanche/pingo2.cpp | 114 +++++++++++++++++++++++++++++++++++ engines/avalanche/pingo2.h | 58 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 engines/avalanche/pingo2.cpp create mode 100644 engines/avalanche/pingo2.h diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp new file mode 100644 index 000000000000..1311c65b5634 --- /dev/null +++ b/engines/avalanche/pingo2.cpp @@ -0,0 +1,114 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* PINGO Full-screen sub-parts of the game. */ + +#include "avalanche/pingo2.h" + +#include "avalanche/gyro2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/trip6.h" +#include "avalanche/scrolls2.h" + +#include "common/textconsole.h" + +namespace Avalanche { + + namespace Pingo { + + void dplot(int16 x, int16 y, Common::String z) { + warning("STUB: Pingo::dplot()"); + } + + void bosskey() { + /*const + months : array[0..11] of char = 'JFMAMJJASOND'; + title = 'Net Profits'; + fish = #224; { } + var fv:byte; gd,gm:int16; r:char; + begin; + dusk; delavvy; + setactivepage(3); mousepage(3); setvisualpage(3); off; + cleardevice; setfillstyle(xhatchfill,11); + settextstyle(1,0,4); settextjustify(1,1); + dplot(320,10,title); + settextstyle(1,0,0); setusercharsize(4,3,7,12); + for fv:=0 to 11 do + begin; + dplot(26+fv*52,187,months[fv]); + bar(fv*52,177-fv*14,51+fv*52,180); + rectangle(fv*52,177-fv*14,51+fv*52,180); + end; + settextstyle(0,0,1); + for fv:=1 to 177 do + begin; + gd:=random(630); gm:=random(160)+30; + setcolor(lightred); outtextxy(gd ,gm ,fish); + setcolor(yellow); outtextxy(gd+1,gm-1,fish); + end; + newpointer(6); { TTHand } + dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; + while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); + dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; + copy02;*/ + + warning("STUB: Pingo::bosskey()"); + } + + void copy02() { /* taken from Wobble (below) */ + warning("STUB: Pingo::copy02()"); + } + + void copy03() { /* taken from Wobble (below) */ + warning("STUB: Pingo::copy03()"); + } + + void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ + warning("STUB: Pingo::copypage()"); + } + + void wobble() { + warning("STUB: Pingo::wobble()"); + } + + void zonk(); + + static void zl(int16 x1, int16 y1, int16 x2, int16 y2) { + warning("STUB: Pingo::zl()"); + } + + void zonk() { + warning("STUB: Pingo::zonk()"); + } + + void winning_pic() { + warning("STUB: Pingo::winning_pic()"); + } + + } // End of namespace Pingo. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h new file mode 100644 index 000000000000..10b9511f5e11 --- /dev/null +++ b/engines/avalanche/pingo2.h @@ -0,0 +1,58 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* PINGO Full-screen sub-parts of the game. */ + +#ifndef PINGO2_H +#define PINGO2_H + +#include "common/scummsys.h" + + +namespace Avalanche { + + namespace Pingo { + + void bosskey(); + + void copy02(); + + void copy03(); + + void copypage(byte frp, byte top); + + void wobble(); + + void zonk(); + + void winning_pic(); + + } // End of namespace Pingo. + +} // End of namespace Avalanche. + +#endif // PINGO2_H From 49e411f557a42e353e60e155da47c6600554c057 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 09:21:41 +0200 Subject: [PATCH 0038/1332] AVALANCHE: Add Timeout. --- engines/avalanche/timeout2.cpp | 676 +++++++++++++++++++++++++++++++++ engines/avalanche/timeout2.h | 259 +++++++++++++ 2 files changed, 935 insertions(+) create mode 100644 engines/avalanche/timeout2.cpp create mode 100644 engines/avalanche/timeout2.h diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp new file mode 100644 index 000000000000..3ab2bcd63840 --- /dev/null +++ b/engines/avalanche/timeout2.cpp @@ -0,0 +1,676 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* TIMEOUT The scheduling unit. */ + +#include "common/textconsole.h" + +#include "avalanche/timeout2.h" + +#include "avalanche/visa2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/trip6.h" +#include "avalanche/scrolls2.h" +#include "avalanche/acci2.h" +#include "avalanche/sequence2.h" +#include "avalanche/enid2.h" +#include "avalanche/pingo2.h" + +namespace Avalanche { + + namespace Timeout { + + byte fv; + + void set_up_timer(int32 howlong, byte whither, byte why) { + fv = 1; + while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; + if (fv == 8) return; /* Oh dear... */ + + { + timetype &with = times[fv]; /* Everything's OK here! */ + + with.time_left = howlong; + with.then_where = whither; + with.what_for = why; + } + } + + void one_tick() { + + if (Gyro::ddmnow) return; + + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.time_left > 0) { + with.time_left -= 1; + + if (with.time_left == 0) + switch (with.then_where) { + case procopen_drawbridge : + open_drawbridge(); + break; + case procavaricius_talks : + avaricius_talks(); + break; + case procurinate : + urinate(); + break; + case proctoilet2 : + toilet2(); + break; + case procbang: + bang(); + break; + case procbang2: + bang2(); + break; + case procstairs: + stairs(); + break; + case proccardiffsurvey: + cardiff_survey(); + break; + case proccardiff_return: + cardiff_return(); + break; + case proc_cwytalot_in_herts: + cwytalot_in_herts(); + break; + case procget_tied_up: + get_tied_up(); + break; + case procget_tied_up2: + get_tied_up2(); + break; + case prochang_around: + hang_around(); + break; + case prochang_around2: + hang_around2(); + break; + case procafter_the_shootemup: + after_the_shootemup(); + break; + case procjacques_wakes_up: + jacques_wakes_up(); + break; + case procnaughty_duke: + naughty_duke(); + break; + case procnaughty_duke2: + naughty_duke2(); + break; + case procnaughty_duke3: + naughty_duke3(); + break; + case procjump: + jump(); + break; + case procsequence: + Sequence::call_sequencer(); + break; + case proccrapulus_splud_out: + crapulus_says_splud_out(); + break; + case procdawn_delay: + Lucerna::dawn(); + break; + case procbuydrinks: + buydrinks(); + break; + case procbuywine: + buywine(); + break; + case proccallsguards: + callsguards(); + break; + case procgreetsmonk: + greetsmonk(); + break; + case procfall_down_oubliette: + fall_down_oubliette(); + break; + case procmeet_avaroid: + meet_avaroid(); + break; + case procrise_up_oubliette: + rise_up_oubliette(); + break; + case procrobin_hood_and_geida: + robin_hood_and_geida(); + break; + case procrobin_hood_and_geida_talk: + robin_hood_and_geida_talk(); + break; + case procavalot_returns: + avalot_returns(); + break; + case procavvy_sit_down: + avvy_sit_down(); + break; + case procghost_room_phew: + ghost_room_phew(); + break; + case procarkata_shouts: + arkata_shouts(); + break; + case procwinning: + winning(); + break; + case procavalot_falls: + avalot_falls(); + break; + case procspludwick_goes_to_cauldron: + spludwick_goes_to_cauldron(); + break; + case procspludwick_leaves_cauldron: + spludwick_leaves_cauldron(); + break; + case procgive_lute_to_geida: + give_lute_to_geida(); + break; + } + } + } + Gyro::roomtime += 1; /* Cycles since you've been in this room. */ + Gyro::dna.total_time += 1; /* Total amount of time for this game. */ + } + + void lose_timer(byte which) { + byte fv; + + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.what_for == which) + with.time_left = 0; + } /* Cancel this one! */ + } + + /*function timer_is_on(which:byte):boolean; + var fv:byte; + begin + for fv:=1 to 7 do + with times[fv] do + if (what_for=which) and (time_left>0) then + begin + timer_is_on:=true; + exit; + end; + timer_is_on:=false; + end;*/ + + /* Timeout procedures: */ + + void open_drawbridge() { + { + Gyro::dna.drawbridge_open ++; + Celer::show_one(Gyro::dna.drawbridge_open - 1); + + if (Gyro::dna.drawbridge_open == 4) + Gyro::magics[2].op = Gyro::nix; /* You may enter the drawbridge. */ + else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); + } + } + + /* --- */ + + void avaricius_talks() { + { + Visa::dixi('q', Gyro::dna.avaricius_talk); + Gyro::dna.avaricius_talk ++; + + if (Gyro::dna.avaricius_talk < 17) + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + else Lucerna::points(3); + + } + } + + void urinate() { + Trip::tr[1].turn(Trip::up); + Trip::stopwalking(); + Lucerna::showrw(); + set_up_timer(14, proctoilet2, reason_gototoilet); + } + + void toilet2() { + Scrolls::display("That's better!"); + } + + void bang() { + Scrolls::display("\6< BANG! >"); + set_up_timer(30, procbang2, reason_explosion); + } + + void bang2() { + Scrolls::display("Hmm... sounds like Spludwick's up to something..."); + } + + void stairs() { + Gyro::blip(); + Trip::tr[0].walkto(4); + Celer::show_one(2); + Gyro::dna.brummie_stairs = 2; + Gyro::magics[11].op = Gyro::special; + Gyro::magics[11].data = 2; /* Reached the bottom of the stairs. */ + Gyro::magics[4].op = Gyro::nix; /* Stop them hitting the sides (or the game will hang.) */ + } + + void cardiff_survey() { + { + switch (Gyro::dna.cardiff_things) { + case 0: { + Gyro::dna.cardiff_things += 1; + Visa::dixi('q', 27); + } + break; + } + Visa::dixi('z', Gyro::dna.cardiff_things); + } + Gyro::interrogation = Gyro::dna.cardiff_things; + set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); + } + + void cardiff_return() { + Visa::dixi('q', 28); + cardiff_survey(); /* add end of question. */ + } + + void cwytalot_in_herts() { + Visa::dixi('q', 29); + } + + void get_tied_up() { + Visa::dixi('q', 34); /* ...Trouble! */ + Gyro::dna.user_moves_avvy = false; + Gyro::dna.been_tied_up = true; + Trip::stopwalking(); + Trip::tr[2].stopwalk(); + Trip::tr[2].stophoming(); + Trip::tr[2].call_eachstep = true; + Trip::tr[2].eachstep = Trip::procgrab_avvy; + set_up_timer(70, procget_tied_up2, reason_getting_tied_up); + } + + void get_tied_up2() { + Trip::tr[1].walkto(4); + Trip::tr[2].walkto(5); + Gyro::magics[4].op = Gyro::nix; /* No effect when you touch the boundaries. */ + Gyro::dna.friar_will_tie_you_up = true; + } + + void hang_around() { + Trip::tr[2].check_me = false; + Trip::tr[1].init(7, true); /* Robin Hood */ + Gyro::whereis[Gyro::probinhood] = r__robins; + Trip::apped(1, 2); + Visa::dixi('q', 39); + Trip::tr[1].walkto(7); + set_up_timer(55, prochang_around2, reason_hanging_around); + } + + void hang_around2() { + Visa::dixi('q', 40); + Trip::tr[2].vanishifstill = false; + Trip::tr[2].walkto(4); + Gyro::whereis[Gyro::pfriartuck] = r__robins; + Visa::dixi('q', 41); + Trip::tr[1].done(); + Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + + set_up_timer(1, procafter_the_shootemup, reason_hanging_around); + /* Immediately call the following proc (when you have a chance). */ + + Gyro::dna.tied_up = false; + + Enid::back_to_bootstrap(1); /* Call the shoot-'em-up. */ + } + + void after_the_shootemup() { + warning("STUB: Timeout::after_the_shootemup()"); + } + + void jacques_wakes_up() { + Gyro::dna.jacques_awake += 1; + + switch (Gyro::dna.jacques_awake) { /* Additional pictures. */ + case 1 : { + Celer::show_one(1); /* Eyes open. */ + Visa::dixi('Q', 45); + } + break; + case 2 : { /* Going through the door. */ + Celer::show_one(2); /* Not on the floor. */ + Celer::show_one(3); /* But going through the door. */ + Gyro::magics[6].op = Gyro::nix; /* You can't wake him up now. */ + } + break; + case 3 : { /* Gone through the door. */ + Celer::show_one(2); /* Not on the floor, either. */ + Celer::show_one(4); /* He's gone... so the door's open. */ + Gyro::whereis[Gyro::pjacques] = 0; /* Gone! */ + } + break; + } + + + if (Gyro::dna.jacques_awake == 5) { + Gyro::dna.ringing_bells = true; + Gyro::dna.ayles_is_awake = true; + Lucerna::points(2); + } + + switch (Gyro::dna.jacques_awake) { + case 1: + case 2: + case 3: + set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); + break; + case 4: + set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); + break; + } + + } + + void naughty_duke() + /* This is when the Duke comes in and takes your money. */ + { + Trip::tr[2].init(9, false); /* Here comes the Duke. */ + Trip::apped(2, 1); /* He starts at the door... */ + Trip::tr[2].walkto(3); /* He walks over to you. */ + + /* Let's get the door opening. */ + Celer::show_one(1); + Sequence::first_show(2); + Sequence::start_to_close(); + + set_up_timer(50, procnaughty_duke2, reason_naughty_duke); + } + + void naughty_duke2() { + Visa::dixi('q', 48); /* Ha ha, it worked again! */ + Trip::tr[2].walkto(1); /* Walk to the door. */ + Trip::tr[2].vanishifstill = true; /* Then go away! */ + set_up_timer(32, procnaughty_duke3, reason_naughty_duke); + } + + void naughty_duke3() { + Celer::show_one(1); + Sequence::first_show(2); + Sequence::start_to_close(); + } + + void jump() { + { + Gyro::dnatype &with = Gyro::dna; + + with.jumpstatus += 1; + + { + Trip::triptype &with1 = Trip::tr[1]; + switch (with.jumpstatus) { + case 1: + case 2: + case 3: + case 5: + case 7: + case 9: + with1.y -= 1; + break; + case 12: + case 13: + case 14: + case 16: + case 18: + case 19: + with1.y += 1; + break; + } + } + + if (with.jumpstatus == 20) { + /* End of jump. */ + Gyro::dna.user_moves_avvy = true; + Gyro::dna.jumpstatus = 0; + } else { + /* Still jumping. */ + set_up_timer(1, procjump, reason_jumping); + } + + if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + && (Gyro::dna.room == r__insidecardiffcastle) + && (Gyro::dna.arrow_in_the_door == true) + && (Trip::infield(3))) { /* beside the wall*/ + /* Grab the arrow! */ + if (Gyro::dna.carrying >= Gyro::maxobjs) + Scrolls::display("You fail to grab it, because your hands are full."); + else { + Celer::show_one(2); + Gyro::dna.arrow_in_the_door = false; /* You've got it. */ + Gyro::dna.obj[Gyro::bolt] = true; + Lucerna::objectlist(); + Visa::dixi('q', 50); + Lucerna::points(3); + } + } + } + } + + void crapulus_says_splud_out() { + Visa::dixi('q', 56); + Gyro::dna.crapulus_will_tell = false; + } + + void buydrinks() { + Celer::show_one(11); /* Malagauche gets up again. */ + Gyro::dna.malagauche = 0; + + Visa::dixi('D', Gyro::dna.drinking); /* Scrolls::display message about it. */ + Pingo::wobble(); /* Do the special effects. */ + Visa::dixi('D', 1); /* That'll be thruppence. */ + if (Gyro::pennycheck(3)) /* Pay 3d. */ + Visa::dixi('D', 3); /* Tell 'em you paid up. */ + Acci::have_a_drink(); + } + + void buywine() { + Celer::show_one(11); /* Malagauche gets up again. */ + Gyro::dna.malagauche = 0; + + Visa::dixi('D', 50); /* You buy the wine. */ + Visa::dixi('D', 1); /* It'll be thruppence. */ + if (Gyro::pennycheck(3)) { + Visa::dixi('D', 4); /* You paid up. */ + Gyro::dna.obj[Gyro::wine] = true; + Lucerna::objectlist(); + Gyro::dna.winestate = 1; /* OK Wine */ + } + } + + void callsguards() { + Visa::dixi('Q', 58); /* GUARDS!!! */ + Lucerna::gameover(); + } + + void greetsmonk() { + Visa::dixi('Q', 59); + Gyro::dna.entered_lusties_room_as_monk = true; + } + + void fall_down_oubliette() { + Gyro::magics[9].op = Gyro::nix; + Trip::tr[1].iy += 1; /* increments dx/dy! */ + Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */ + set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); + } + + void meet_avaroid() { + if (Gyro::dna.met_avaroid) { + Scrolls::display("You can't expect to be \6that\22 lucky twice in a row!"); + Lucerna::gameover(); + } else { + Visa::dixi('Q', 60); + Gyro::dna.met_avaroid = true; + set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); + { + Trip::triptype &with = Trip::tr[1]; + with.face = Trip::left; + with.x = 151; + with.ix = -3; + with.iy = -5; + } + Gyro::background(2); + } + } + + void rise_up_oubliette() { + { + Trip::triptype &with = Trip::tr[1]; + + with.visible = true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy > 0) + set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); + else + Gyro::dna.user_moves_avvy = true; + } + } + + void robin_hood_and_geida() { + Trip::tr[1].init(7, true); + Trip::apped(1, 7); + Trip::tr[1].walkto(6); + Trip::tr[2].stopwalk(); + Trip::tr[2].face = Trip::left; + set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); + Gyro::dna.geida_follows = false; + } + + void robin_hood_and_geida_talk() { + Visa::dixi('q', 66); + Trip::tr[1].walkto(2); + Trip::tr[2].walkto(2); + Trip::tr[1].vanishifstill = true; + Trip::tr[2].vanishifstill = true; + set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); + } + + void avalot_returns() { + Trip::tr[1].done(); + Trip::tr[2].done(); + Trip::tr[1].init(0, true); + Trip::apped(1, 1); + Visa::dixi('q', 67); + Gyro::dna.user_moves_avvy = true; + } + + void avvy_sit_down() + /* This is used when you sit down in the pub in Notts. It loops around so + that it will happen when Avvy stops walking. */ + { + if (Trip::tr[1].homing) /* Still walking */ + set_up_timer(1, procavvy_sit_down, reason_sitting_down); + else { + Celer::show_one(3); + Gyro::dna.sitting_in_pub = true; + Gyro::dna.user_moves_avvy = false; + Trip::tr[1].visible = false; + } + } + + void ghost_room_phew() { + Scrolls::display("\6PHEW!\22 You're glad to get out of \6there!"); + } + + void arkata_shouts() { + if (Gyro::dna.teetotal) return; + Visa::dixi('q', 76); + set_up_timer(160, procarkata_shouts, reason_arkata_shouts); + } + + void winning() { + Visa::dixi('q', 79); + Pingo::winning_pic(); + do { + Lucerna::checkclick(); + } while (!(Gyro::mrelease == 0)); + Lucerna::callverb(Acci::vb_score); + Scrolls::display(" T H E E N D "); + Gyro::lmo = true; + } + + void avalot_falls() { + if (Trip::tr[1].step < 5) { + Trip::tr[1].step += 1; + set_up_timer(3, procavalot_falls, reason_falling_over); + } else + Scrolls::display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); + } + + void spludwick_goes_to_cauldron() { + if (Trip::tr[2].homing) + set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + else + set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); + } + + void spludwick_leaves_cauldron() { + Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */ + } + + void give_lute_to_geida() { /* Moved here from Acci. */ + Visa::dixi('Q', 86); + Lucerna::points(4); + Gyro::dna.lustie_is_asleep = true; + Sequence::first_show(5); + Sequence::then_show(6); /* He falls asleep... */ + Sequence::start_to_close(); /* Not really closing, but we're using the same procedure. */ + } + + /* "This is all!" */ + + class unit_timeout_initialize { + public: + unit_timeout_initialize(); + }; + static unit_timeout_initialize timeout_constructor; + + unit_timeout_initialize::unit_timeout_initialize() { + for (int i = 0; i < sizeof(times); i++) { + times[i].time_left = 0; + times[i].then_where = 0; + times[i].what_for = 0; + } + } + + + } // End of namespace Timeout. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h new file mode 100644 index 000000000000..5130c92bbcd7 --- /dev/null +++ b/engines/avalanche/timeout2.h @@ -0,0 +1,259 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* TIMEOUT The scheduling unit. */ + +#ifndef TIMEOUT2_H +#define TIMEOUT2_H + +#include "common/scummsys.h" + +#include "avalanche/gyro2.h" +#include "avalanche/celer2.h" + +namespace Avalanche { + + namespace Timeout { + + /* reason_ now runs between 1 and 28. */ + + const int16 reason_drawbridgefalls = 2; + const int16 reason_avariciustalks = 3; + const int16 reason_gototoilet = 4; + const int16 reason_explosion = 5; + const int16 reason_brummiestairs = 6; + const int16 reason_cardiffsurvey = 7; + const int16 reason_cwytalot_in_herts = 8; + const int16 reason_getting_tied_up = 9; + const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ + const int16 reason_jacques_waking_up = 11; + const int16 reason_naughty_duke = 12; + const int16 reason_jumping = 13; + const int16 reason_sequencer = 14; + const int16 reason_crapulus_says_spludwick_out = 15; + const int16 reason_dawndelay = 16; + const int16 reason_drinks = 17; + const int16 reason_du_lustie_talks = 18; + const int16 reason_falling_down_oubliette = 19; + const int16 reason_meeting_avaroid = 20; + const int16 reason_rising_up_oubliette = 21; + const int16 reason_robin_hood_and_geida = 22; + const int16 reason_sitting_down = 23; + const int16 reason_ghost_room_phew = 1; + const int16 reason_arkata_shouts = 24; + const int16 reason_winning = 25; + const int16 reason_falling_over = 26; + const int16 reason_spludwalk = 27; + const int16 reason_geida_sings = 28; + + /* procx now runs between 1 and 41. */ + + const int16 procopen_drawbridge = 3; + + const int16 procavaricius_talks = 4; + + const int16 procurinate = 5; + + const int16 proctoilet2 = 6; + + const int16 procbang = 7; + + const int16 procbang2 = 8; + + const int16 procstairs = 9; + + const int16 proccardiffsurvey = 10; + + const int16 proccardiff_return = 11; + + const int16 proc_cwytalot_in_herts = 12; + + const int16 procget_tied_up = 13; + + const int16 procget_tied_up2 = 1; + + const int16 prochang_around = 14; + + const int16 prochang_around2 = 15; + + const int16 procafter_the_shootemup = 32; + + const int16 procjacques_wakes_up = 16; + + const int16 procnaughty_duke = 17; + + const int16 procnaughty_duke2 = 18; + + const int16 procnaughty_duke3 = 38; + + const int16 procjump = 19; + + const int16 procsequence = 20; + + const int16 proccrapulus_splud_out = 21; + + const int16 procdawn_delay = 22; + + const int16 procbuydrinks = 23; + + const int16 procbuywine = 24; + + const int16 proccallsguards = 25; + + const int16 procgreetsmonk = 26; + + const int16 procfall_down_oubliette = 27; + + const int16 procmeet_avaroid = 28; + + const int16 procrise_up_oubliette = 29; + + const int16 procrobin_hood_and_geida = 2; + + const int16 procrobin_hood_and_geida_talk = 30; + + const int16 procavalot_returns = 31; + + const int16 procavvy_sit_down = 33; /* In Nottingham. */ + + const int16 procghost_room_phew = 34; + + const int16 procarkata_shouts = 35; + + const int16 procwinning = 36; + + const int16 procavalot_falls = 37; + + const int16 procspludwick_goes_to_cauldron = 39; + + const int16 procspludwick_leaves_cauldron = 40; + + const int16 procgive_lute_to_geida = 41; + + struct timetype { + int32 time_left; + byte then_where; + byte what_for; + }; + + timetype times[7] = {{0,0,0}}; + + + + void set_up_timer(int32 howlong, byte whither, byte why); + + void one_tick(); + + void lose_timer(byte which); + + /*function timer_is_on(which:byte):boolean;*/ + + /* procedures to do things at the end of amounts of time: */ + + void open_drawbridge(); + + void avaricius_talks(); + + void urinate(); + + void toilet2(); + + void bang(); + + void bang2(); + + void stairs(); + + void cardiff_survey(); + + void cardiff_return(); + + void cwytalot_in_herts(); + + void get_tied_up(); + + void get_tied_up2(); + + void hang_around(); + + void hang_around2(); + + void after_the_shootemup(); + + void jacques_wakes_up(); + + void naughty_duke(); + + void naughty_duke2(); + + void naughty_duke3(); + + void jump(); + + void crapulus_says_splud_out(); + + void buydrinks(); + + void buywine(); + + void callsguards(); + + void greetsmonk(); + + void fall_down_oubliette(); + + void meet_avaroid(); + + void rise_up_oubliette(); + + void robin_hood_and_geida(); + + void robin_hood_and_geida_talk(); + + void avalot_returns(); + + void avvy_sit_down(); + + void ghost_room_phew(); + + void arkata_shouts(); + + void winning(); + + void avalot_falls(); + + void spludwick_goes_to_cauldron(); + + void spludwick_leaves_cauldron(); + + void give_lute_to_geida(); + + } // End of namespace Timeout. + +} // End of namespace Avalanche. + +#endif // TIMEOUT2_H From ee5fb07c91e79abc956024028aa617c72a65384e Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 09:23:10 +0200 Subject: [PATCH 0039/1332] AVALANCHE: Gyro: Change constants to variables with initial values to be equal to the Pascal code. --- engines/avalanche/gyro2.h | 66 ++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 4c29b1f2d401..cd5644ec4b8e 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -495,33 +495,6 @@ namespace Avalanche { const int16 walk = 3; const int16 run = 5; - const byte whereis[29] = { - /* The Lads */ - r__yours, /* Avvy */ - r__spludwicks, /* Spludwick */ - r__outsideyours, /* Crapulus */ - r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - r__argentpub, /* Malagauche */ - r__robins, /* Friar Tuck. */ - 177, /* Robin Hood - can't meet him at the start. */ - r__brummieroad, /* Cwytalot */ - r__lustiesroom, /* Baron du Lustie. */ - r__outsidecardiffcastle, /* The Duke of Cardiff. */ - r__argentpub, /* Dogfood */ - r__outsideducks, /* Trader */ - r__argentpub, /* Ibythneth */ - r__aylesoffice, /* Ayles */ - r__nottspub, /* Port */ - r__nottspub, /* Spurge */ - r__musicroom, /* Jacques */ - 0, 0, 0, 0, 0, 0, 0, 0, - /* The Lasses */ - r__yours, /* Arkata */ - r__geidas, /* Geida */ - 177, /* nobody allocated here! */ - r__wisewomans - }; /* The Wise Woman. */ - /* Art gallery at 2,1; notice about this at 2,2. */ const int32 catamap[8][8] = { @@ -574,11 +547,6 @@ namespace Avalanche { 7 = wall with door and candles, F = straight-through corridor. */ - const byte interrogation = 0; - /* If this is greater than zero, the next line you type is stored in - the DNA in a position dictated by the value. If a scroll comes up, - or you leave the room, it's automatically set to zero. */ - const bool demo = false; /* If this is true, we're in a demo of the game. */ const char spludwick_order[3] = {onion, ink, mushroom}; @@ -624,6 +592,40 @@ namespace Avalanche { ///////////////////////////// VARIABLES ///////////////////////////// + byte interrogation = 0; + /* If this is greater than zero, the next line you type is stored in + the DNA in a position dictated by the value. If a scroll comes up, + or you leave the room, it's automatically set to zero. */ + + byte whereis[29] = { + /* The Lads */ + r__yours, /* Avvy */ + r__spludwicks, /* Spludwick */ + r__outsideyours, /* Crapulus */ + r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + r__argentpub, /* Malagauche */ + r__robins, /* Friar Tuck. */ + 177, /* Robin Hood - can't meet him at the start. */ + r__brummieroad, /* Cwytalot */ + r__lustiesroom, /* Baron du Lustie. */ + r__outsidecardiffcastle, /* The Duke of Cardiff. */ + r__argentpub, /* Dogfood */ + r__outsideducks, /* Trader */ + r__argentpub, /* Ibythneth */ + r__aylesoffice, /* Ayles */ + r__nottspub, /* Port */ + r__nottspub, /* Spurge */ + r__musicroom, /* Jacques */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* The Lasses */ + r__yours, /* Arkata */ + r__geidas, /* Geida */ + 177, /* nobody allocated here! */ + r__wisewomans + }; /* The Wise Woman. */ + + + Common::String current; byte curpos; bool cursoron; From 1d88f5c2f9311dd446f57a3896c21cee408e45c5 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 11:48:48 +0200 Subject: [PATCH 0040/1332] AVALANCHE: Add a little self-warning. --- engines/avalanche/timeout2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 3ab2bcd63840..6c0099b91031 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -27,6 +27,8 @@ /* TIMEOUT The scheduling unit. */ +// DON'T FORGET ABOUT THE ARRAY INDEXES, THEY MAY'LL CAUSE TROUBLES!!! + #include "common/textconsole.h" #include "avalanche/timeout2.h" From 0a355ea3687b27d7330cfd0b3d32abba743dacbc Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 12:13:00 +0200 Subject: [PATCH 0041/1332] AVALANCHE: Add Trippancy. --- engines/avalanche/trip6.cpp | 1491 +++++++++++++++++++++++++++++++++++ engines/avalanche/trip6.h | 227 ++++++ 2 files changed, 1718 insertions(+) create mode 100644 engines/avalanche/trip6.cpp create mode 100644 engines/avalanche/trip6.h diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp new file mode 100644 index 000000000000..ac0e8d0609ba --- /dev/null +++ b/engines/avalanche/trip6.cpp @@ -0,0 +1,1491 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* TRIP5 Trippancy V */ + +#include "avalanche/trip6.h" +#include "common/scummsys.h" +#include "common/textconsole.h" + +#include "avalanche/scrolls2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/visa2.h" +#include "avalanche/gyro2.h" +#include "avalanche/celer2.h" +#include "avalanche/sequence2.h" +#include "avalanche/timeout2.h" +#include "avalanche/enid2.h" + +/*#include "Dropdown.h"*/ + + +namespace Avalanche { + + namespace Trip { + + void loadtrip() { + byte gm; + + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + for (int i = 0; i < sizeof(aa); aa[i] = 0); + } + + byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { + byte a, c; + int16 fv, ff; + + /* if not alive then begin checkfeet:=0; exit; end;*/ + byte checkfeet_result; + a = 0; + + warning("STUB: Trip::checkfeet()"); + + checkfeet_result = a; + return checkfeet_result; + } + + byte geida_ped(byte which) { + byte geida_ped_result; + switch (which) { + case 1: + geida_ped_result = 7; + break; + case 2: + case 6: + geida_ped_result = 8; + break; + case 3: + case 5: + geida_ped_result = 9; + break; + case 4: + geida_ped_result = 10; + break; + } + return geida_ped_result; + } + + void catamove(byte ped) + /* When you enter a new position in the catacombs, this procedure should + be called. It changes the Also codes so that they may match the picture + on the screen. (Coming soon: It draws up the screen, too.) */ + { + + warning("Repair array indexes in Trip::catamove()"); + + int32 here; + uint16 xy_uint16; + byte fv, ff; + + /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the + catacombs has a different number for it. */ + + + + xy_uint16 = Gyro::dna.cat_x + Gyro::dna.cat_y * 256; + Gyro::dna.geida_spin = 0; + + switch (xy_uint16) { + case 1801: { /* Exit catacombs */ + fliproom(r__lustiesroom, 4); + Scrolls::display("Phew! Nice to be out of there!"); + return; + } + break; + case 1033: { /* Oubliette */ + fliproom(r__oubliette, 1); + Scrolls::display("Oh, NO!\231\2"); + return; + } + break; + case 4: { + fliproom(r__geidas, 1); + return; + } + break; + case 2307: { + fliproom(r__lusties, 5); + Scrolls::display("Oh no... here we go again..."); + Gyro::dna.user_moves_avvy = false; + tr[1].iy = 1; + tr[1].ix = 0; + return; + } + break; + } + + if (! Gyro::dna.enter_catacombs_from_lusties_room) Lucerna::load(29); + here = Gyro::catamap[Gyro::dna.cat_y][Gyro::dna.cat_x]; + + switch (here & 0xf) { /* West. */ + case 0: { /* no connection (wall) */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::nix; /* Door. */ + Celer::show_one(28); + } + break; + case 0x1: { /* no connection (wall + shield), */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::nix; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(29); /* ...shield. */ + } + break; + case 0x2: { /* wall with door */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::special; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(30); /* ...door. */ + } + break; + case 0x3: { /* wall with door and shield */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::special; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(30); /* ...door, and... */ + Celer::show_one(29); /* ...shield. */ + } + break; + case 0x4: { /* no connection (wall + window), */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::nix; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(5); /* ...window. */ + } + break; + case 0x5: { /* wall with door and window */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::special; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(30); /* ...door, and... */ + Celer::show_one(5); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::nix; /* No door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(7); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[13].op = Gyro::special; /* Door. */ + Celer::show_one(28); /* Wall, plus... */ + Celer::show_one(30); /* ...door, and... */ + Celer::show_one(7); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + Gyro::magics[2].op = Gyro::nix; /* Sloping wall. */ + Gyro::magics[3].op = Gyro::special; /* Straight wall. */ + } + break; + } + + /* ---- */ + + switch ((here & 0xf0) >> 4) { /* East */ + case 0: { /* no connection (wall) */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::nix; /* Door. */ + Celer::show_one(19); + } + break; + case 0x1: { /* no connection (wall + window), */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::nix; /* Door. */ + Celer::show_one(19); /* Wall, plus... */ + Celer::show_one(20); /* ...window. */ + } + break; + case 0x2: { /* wall with door */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::special; /* Door. */ + Celer::show_one(19); /* Wall, plus... */ + Celer::show_one(21); /* ...door. */ + } + break; + case 0x3: { /* wall with door and window */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::special; /* Door. */ + Celer::show_one(19); /* Wall, plus... */ + Celer::show_one(20); /* ...door, and... */ + Celer::show_one(21); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::nix; /* No door. */ + Celer::show_one(19); /* Wall, plus... */ + Celer::show_one(18); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ + Gyro::portals[15].op = Gyro::special; /* Door. */ + Celer::show_one(19); /* Wall, plus... */ + Celer::show_one(21); /* ...door, and... */ + Celer::show_one(18); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + Gyro::magics[5].op = Gyro::nix; /* Sloping wall. */ + Gyro::magics[6].op = Gyro::special; /* Straight wall. */ + Gyro::portals[15].op = Gyro::nix; /* Door. */ + } + break; + } + + /* ---- */ + + switch ((here & 0xf00) >> 8) { /* South */ + case 0: { /* No connection. */ + Gyro::magics[7].op = Gyro::bounces; + Gyro::magics[12].op = Gyro::bounces; + Gyro::magics[13].op = Gyro::bounces; + } + break; + case 0x1: { + Celer::show_one(22); + + if ((xy_uint16 == 2051) & (Gyro::dna.geida_follows)) + Gyro::magics[13].op = Gyro::exclaim; + else Gyro::magics[13].op = Gyro::special; /* Right exit south. */ + + Gyro::magics[7].op = Gyro::bounces; + Gyro::magics[12].op = Gyro::bounces; + } + break; + case 0x2: { + Celer::show_one(23); + Gyro::magics[7].op = Gyro::special; /* Middle exit south. */ + Gyro::magics[12].op = Gyro::bounces; + Gyro::magics[13].op = Gyro::bounces; + } + break; + case 0x3: { + Celer::show_one(24); + Gyro::magics[12].op = Gyro::special; /* Left exit south. */ + Gyro::magics[7].op = Gyro::bounces; + Gyro::magics[13].op = Gyro::bounces; + } + break; + } + + switch ((here & 0xf000) >> 12) { /* North */ + case 0: { /* No connection */ + Gyro::magics[1].op = Gyro::bounces; + Gyro::portals[12].op = Gyro::nix; /* Door. */ + } + break; + /* LEFT handles: */ + /* $1: begin + Celer::show_one(4); + Gyro::magics[1].op:=Gyro::bounces; { Left exit north. } { Change magic number! } + Gyro::portals[12].op:=Gyro::special; { Door. } + end;*/ + case 0x2: { + Celer::show_one(4); + Gyro::magics[1].op = Gyro::bounces; /* Middle exit north. */ + Gyro::portals[12].op = Gyro::special; /* Door. */ + } + break; + /* $3: begin + Celer::show_one(4); + Gyro::magics[1].op:=Gyro::bounces; { Right exit north. } { Change magic number! } + Gyro::portals[12].op:=Gyro::special; { Door. } + end; + { RIGHT handles: } + $4: begin + Celer::show_one(3); + Gyro::magics[1].op:=Gyro::bounces; { Left exit north. } { Change magic number! } + Gyro::portals[12].op:=Gyro::special; { Door. } + end;*/ + case 0x5: { + Celer::show_one(3); + Gyro::magics[1].op = Gyro::bounces; /* Middle exit north. */ + Gyro::portals[12].op = Gyro::special; /* Door. */ + } + break; + /* $6: begin + Celer::show_one(3); + Gyro::magics[1].op:=Gyro::bounces; { Right exit north. } + Gyro::portals[12].op:=Gyro::special; { Door. } + end;*/ + /* ARCHWAYS: */ + case 0x7: + case 0x8: + case 0x9: { + Celer::show_one(6); + + if (((here & 0xf000) >> 12) > 0x7) Celer::show_one(31); + if (((here & 0xf000) >> 12) == 0x9) Celer::show_one(32); + + Gyro::magics[1].op = Gyro::special; /* Middle arch north. */ + Gyro::portals[12].op = Gyro::nix; /* Door. */ + } + break; + /* DECORATIONS: */ + case 0xd: { /* No connection + WINDOW */ + Gyro::magics[1].op = Gyro::bounces; + Gyro::portals[12].op = Gyro::nix; /* Door. */ + Celer::show_one(14); + } + break; + case 0xe: { /* No connection + TORCH */ + Gyro::magics[1].op = Gyro::bounces; + Gyro::portals[12].op = Gyro::nix; /* Door. */ + Celer::show_one(8); + } + break; + /* Recessed door: */ + case 0xf: { + Gyro::magics[1].op = Gyro::nix; /* Door to Geida's room. */ + Celer::show_one(1); + Gyro::portals[12].op = Gyro::special; /* Door. */ + } + break; + } + + switch (xy_uint16) { + case 514: + Celer::show_one(17); + break; /* [2,2] : "Art Gallery" sign over door. */ + case 264: + Celer::show_one(9); + break; /* [8,1] : "The Wrong Way!" sign. */ + case 1797: + Celer::show_one(2); + break; /* [5,7] : "Ite Mingite" sign. */ + case 258: + for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ + Celer::show_one_at(15, 130 + fv * 120, 70); + Celer::show_one_at(16, 184 + fv * 120, 78); + } + break; + case 1287: + for (fv = 10; fv <= 13; fv ++) Celer::show_one(fv); + break; /* [7,5] : 4 candles. */ + case 776: + Celer::show_one(10); + break; /* [8,3] : 1 candle. */ + case 2049: + Celer::show_one(11); + break; /* [1,8] : another candle. */ + case 257: { + Celer::show_one(12); + Celer::show_one(13); + } + break; /* [1,1] : the other two. */ + } + + if ((Gyro::dna.geida_follows) & (ped > 0)) { + triptype &with = tr[2]; + + if (! with.quick) /* If we don't already have her... */ + tr[2].init(5, true); /* ...Load Geida. */ + apped(2, geida_ped(ped)); + tr[2].call_eachstep = true; + tr[2].eachstep = procgeida_procs; + } + } + + void call_special(uint16 which); + + /* This proc gets called whenever you touch a line defined as Gyro::special. */ + static void dawndelay() { + Timeout::set_up_timer(2, Timeout::procdawn_delay, Timeout::reason_dawndelay); + } + + void call_special(uint16 which) { + switch (which) { + case 1: { /* Gyro::special 1: Room 22: top of stairs. */ + Celer::show_one(1); + Gyro::dna.brummie_stairs = 1; + Gyro::magics[10].op = Gyro::nix; + Timeout::set_up_timer(10, Timeout::procstairs, Timeout::reason_brummiestairs); + stopwalking(); + Gyro::dna.user_moves_avvy = false; + } + break; + case 2: { /* Gyro::special 2: Room 22: bottom of stairs. */ + Gyro::dna.brummie_stairs = 3; + Gyro::magics[11].op = Gyro::nix; + Gyro::magics[12].op = Gyro::exclaim; + Gyro::magics[12].data = 5; + Gyro::magics[4].op = Gyro::bounces; /* Now works as planned! */ + stopwalking(); + Visa::dixi('q', 26); + Gyro::dna.user_moves_avvy = true; + } + break; + case 3: { /* Gyro::special 3: Room 71: triggers dart. */ + tr[1].bounce(); /* Must include that. */ + + if (! Gyro::dna.arrow_triggered) { + Gyro::dna.arrow_triggered = true; + apped(2, 4); /* The dart starts at ped 4, and... */ + tr[2].walkto(5); /* flies to ped 5. */ + tr[2].face = 0; /* Only face. */ + /* Should call some kind of Eachstep procedure which will deallocate + the sprite when it hits the wall, and replace it with the chunk + graphic of the arrow buried in the plaster. */ + /* OK! */ + tr[2].call_eachstep = true; + tr[2].eachstep = procarrow_procs; + } + } + break; + + case 4: { /* This is the ghost room link. */ + Lucerna::dusk(); + tr[1].turn(right); /* you'll see this after we get back from bootstrap */ + Timeout::set_up_timer(1, Timeout::procghost_room_phew, Timeout::reason_ghost_room_phew); + Enid::back_to_bootstrap(3); + } + break; + + case 5: + if (Gyro::dna.friar_will_tie_you_up) { + /* Gyro::special 5: Room 42: touched tree, and get tied up. */ + Gyro::magics[4].op = Gyro::bounces; /* Boundary effect is now working again. */ + Visa::dixi('q', 35); + tr[1].done(); + /*tr[1].vanishifstill:=true;*/ + Celer::show_one(2); + Visa::dixi('q', 36); + Gyro::dna.tied_up = true; + Gyro::dna.friar_will_tie_you_up = false; + tr[2].walkto(3); + tr[2].vanishifstill = true; + tr[2].check_me = true; /* One of them must have Check_Me switched on. */ + Gyro::whereis[Gyro::pfriartuck] = 177; /* Not here, then. */ + Timeout::set_up_timer(364, Timeout::prochang_around, Timeout::reason_hanging_around); + } + break; + + case 6: { /* Gyro::special 6: fall down oubliette. */ + Gyro::dna.user_moves_avvy = false; + tr[1].ix = 3; + tr[1].iy = 0; + tr[1].face = right; + Timeout::set_up_timer(1, Timeout::procfall_down_oubliette, Timeout::reason_falling_down_oubliette); + } + break; + + case 7: { /* Gyro::special 7: stop falling down oubliette. */ + tr[1].visible = false; + Gyro::magics[10].op = Gyro::nix; + stopwalking(); + Timeout::lose_timer(Timeout::reason_falling_down_oubliette); + Lucerna::mblit(12, 80, 38, 160, 3, 0); + Lucerna::mblit(12, 80, 38, 160, 3, 1); + Scrolls::display("Oh dear, you seem to be down the bottom of an oubliette."); + Timeout::set_up_timer(200, Timeout::procmeet_avaroid, Timeout::reason_meeting_avaroid); + } + break; + + case 8: /* Gyro::special 8: leave du Lustie's room. */ + if ((Gyro::dna.geida_follows) && (! Gyro::dna.lustie_is_asleep)) { + Visa::dixi('q', 63); + tr[2].turn(down); + tr[2].stopwalk(); + tr[2].call_eachstep = false; /* Geida */ + Lucerna::gameover(); + } + break; + + case 9: { /* Gyro::special 9: lose Geida to Robin Hood... */ + if (! Gyro::dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ + tr[2].walkto(4); /* She walks to somewhere... */ + tr[1].done(); /* Lose Avvy. */ + Gyro::dna.user_moves_avvy = false; + Timeout::set_up_timer(40, Timeout::procrobin_hood_and_geida, Timeout::reason_robin_hood_and_geida); + } + break; + + case 10: { /* Gyro::special 10: transfer north in catacombs. */ + if ((Gyro::dna.cat_x == 4) && (Gyro::dna.cat_y == 1)) { + /* Into Geida's room. */ + if (Gyro::dna.obj[Gyro::key]) Visa::dixi('q', 62); + else { + Visa::dixi('q', 61); + return; + } + } + Lucerna::dusk(); + Gyro::dna.cat_y -= 1; + catamove(4); + if (Gyro::dna.room != r__catacombs) return; + Lucerna::delavvy(); + switch ((Gyro::catamap[Gyro::dna.cat_y][Gyro::dna.cat_x] & 0xf00) >> 8) { + case 0x1: + apped(1, 12); + break; + case 0x3: + apped(1, 11); + break; + default: + apped(1, 4); + } + getback(); + dawndelay(); + } + break; + case 11: { /* Gyro::special 11: transfer east in catacombs. */ + Lucerna::dusk(); + Gyro::dna.cat_x += 1; + catamove(1); + if (Gyro::dna.room != r__catacombs) return; + Lucerna::delavvy(); + apped(1, 1); + getback(); + dawndelay(); + } + break; + case 12: { /* Gyro::special 12: transfer south in catacombs. */ + Lucerna::dusk(); + Gyro::dna.cat_y += 1; + catamove(2); + if (Gyro::dna.room != r__catacombs) return; + Lucerna::delavvy(); + apped(1, 2); + getback(); + dawndelay(); + } + break; + case 13: { /* Gyro::special 13: transfer west in catacombs. */ + Lucerna::dusk(); + Gyro::dna.cat_x -= 1; + catamove(3); + if (Gyro::dna.room != r__catacombs) return; + Lucerna::delavvy(); + apped(1, 3); + getback(); + dawndelay(); + } + break; + } + } + + void hide_in_the_cupboard(); + + void open_the_door(byte whither, byte ped, byte magicnum) + /* This slides the door open. (The data really ought to be saved in + the Also file, and will be next time. However, for now, they're + here.) */ + { + switch (Gyro::dna.room) { + case r__outsideyours: + case r__outsidenottspub: + case r__outsideducks: { + Sequence::first_show(1); + Sequence::then_show(2); + Sequence::then_show(3); + } + break; + case r__insidecardiffcastle: { + Sequence::first_show(1); + Sequence::then_show(5); + } + break; + case r__avvysgarden: + case r__entrancehall: + case r__insideabbey: { + Sequence::first_show(1); + Sequence::then_show(2); + } + break; + case r__musicroom: + case r__outsideargentpub: { + Sequence::first_show(5); + Sequence::then_show(6); + } + break; + case r__lusties: + switch (magicnum) { + case 14: + if (Gyro::dna.avvys_in_the_cupboard) { + hide_in_the_cupboard(); + Sequence::first_show(8); + Sequence::then_show(7); + Sequence::start_to_close(); + return; + } else { + apped(1, 6); + tr[1].face = right; /* added by TT 12/3/1995 */ + Sequence::first_show(8); + Sequence::then_show(9); + } + break; + case 12: { + Sequence::first_show(4); + Sequence::then_show(5); + Sequence::then_show(6); + } + break; + } + break; + } + + Sequence::then_flip(whither, ped); + Sequence::start_to_open(); + } + + void newspeed() { + /* Given that you've just changed the speed in triptype.xs, this adjusts + ix. */ + warning("STUB: Trip::newspeed()"); + } + + triptype *triptype::init(byte spritenum, bool do_check) { + warning("STUB: Trip::init()"); + return this; + } + + void triptype::original() { + quick = false; + whichsprite = 177; + } + + void triptype::andexor() { + warning("STUB: Trip::andexor()"); + } + + void triptype::turn(byte whichway) { + if (whichway == 8) face = 0; + else face = whichway; + } + + void triptype::appear(int16 wx, int16 wy, byte wf) { + x = (wx / 8) * 8; + y = wy; + ox[Gyro::cp] = wx; + oy[Gyro::cp] = wy; + turn(wf); + visible = true; + ix = 0; + iy = 0; + } + + + + + bool triptype::collision_check() { + byte fv; + + bool collision_check_result; + for (fv = 1; fv <= numtr; fv ++) + if (tr[fv].quick && (tr[fv].whichsprite != whichsprite) && + ((x + a.xl) > tr[fv].x) && + (x < (tr[fv].x + tr[fv].a.xl)) && + (tr[fv].y == y)) { + collision_check_result = true; + return collision_check_result; + } + collision_check_result = false; + return collision_check_result; + } + + void triptype::walk() { + warning("STUB: Trip::walk()"); + } + + void triptype::bounce() { + x = ox[Gyro::cp]; + y = oy[Gyro::cp]; + if (check_me) stopwalking(); + else stopwalk(); + Gyro::oncandopageswap = false; + Lucerna::showrw(); + Gyro::oncandopageswap = true; + } + + int8 sgn(int16 x) { + int8 sgn_result; + if (x > 0) sgn_result = 1; + else if (x < 0) sgn_result = -1; + else + sgn_result = 0; /* x=0 */ + return sgn_result; + } + + void triptype::walkto(byte pednum) { + speed(sgn(Gyro::peds[pednum].x - x) * 4, sgn(Gyro::peds[pednum].y - y)); + hx = Gyro::peds[pednum].x - a.xl / 2; + hy = Gyro::peds[pednum].y - a.yl; + homing = true; + } + + void triptype::stophoming() { + homing = false; + } + + void triptype::homestep() { + int16 temp; + + if ((hx == x) && (hy == y)) { + /* touching the target */ + stopwalk(); + return; + } + ix = 0; + iy = 0; + if (hy != y) { + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; + } + if (hx != x) { + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } + } + + void triptype::speed(int8 xx, int8 yy) { + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + /* No horz movement */ + if (iy < 0) turn(up); + else turn(down); + } else { + if (ix < 0) turn(left); + else turn(right); + } + } + + void triptype::stopwalk() { + ix = 0; + iy = 0; + homing = false; + } + + void triptype::chatter() { + Gyro::talkx = x + a.xl / 2; + Gyro::talky = y; + Gyro::talkf = a.fgc; + Gyro::talkb = a.bgc; + } + + void triptype::set_up_saver(trip_saver_type &v) { + v.whichsprite = whichsprite; + v.face = face; + v.step = step; + v.x = x; + v.y = y; + v.ix = ix; + v.iy = iy; + v.visible = visible; + v.homing = homing; + v.check_me = check_me; + v.count = count; + v.xw = xw; + v.xs = xs; + v.ys = ys; + v.totalnum = totalnum; + v.hx = hx; + v.hy = hy; + v.call_eachstep = call_eachstep; + v.eachstep = eachstep; + v.vanishifstill = vanishifstill; + } + + void triptype::unload_saver(trip_saver_type v) { + whichsprite = v.whichsprite; + face = v.face; + step = v.step; + x = v.x; + y = v.y; + ix = v.ix; + iy = v.iy; + visible = v.visible; + homing = v.homing; + check_me = v.check_me; + count = v.count; + xw = v.xw; + xs = v.xs; + ys = v.ys; + totalnum = v.totalnum; + hx = v.hx; + hy = v.hy; + call_eachstep = v.call_eachstep; + eachstep = v.eachstep; + vanishifstill = v.vanishifstill; + } + + void triptype::savedata(/*untyped_file &f*/) { + warning("STUB: Timeout::savedata()"); + } + + void triptype::loaddata(/*untyped_file &f*/) { + warning("STUB: Timeout::loaddata()"); + } + + triptype *triptype::done() { + int16 gd, gm; + Common::String xx; + byte fv/*,nds*/; + byte aa, bb; + int32 id; + uint16 soa; + + { + adxtype &with = a; + + /* nds:=num div seq;*/ + xw = with.xl / 8; + if ((with.xl % 8) > 0) xw += 1; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { + totalnum --; + free(mani[totalnum]); + free(sil[totalnum]); /* <<- Width of a siltype. */ + } + } + + quick = false; + whichsprite = 177; + return this; + } + + getsettype *getsettype::init() { + numleft = 0; /* initialise array pointer */ + return this; + } + + void getsettype::remember(Gyro::bytefield r) { + numleft ++; + warning("STUB: Timeout::getsettype::remember()"); + gs[numleft] = r; + } + + void getsettype::recall(Gyro::bytefield &r) { + r = gs[numleft]; + numleft --; + } + + void rwsp(byte t, byte r) { + { + switch (r) { + case up: + tr[t].speed(0, -tr[t].ys); + break; + case down: + tr[t].speed(0, tr[t].ys); + break; + case left: + tr[t].speed(-tr[t].xs, 0); + break; + case right: + tr[t].speed(tr[t].xs, 0); + break; + case ul: + tr[t].speed(-tr[t].xs, -tr[t].ys); + break; + case ur: + tr[t].speed(tr[t].xs, -tr[t].ys); + break; + case dl: + tr[t].speed(-tr[t].xs, tr[t].ys); + break; + case dr: + tr[t].speed(tr[t].xs, tr[t].ys); + break; + } + } + } + + void apped(byte trn, byte np) { + tr[trn].appear(tr[trn].x - tr[trn].a.xl / 2, tr[trn].y - tr[trn].a.yl, Gyro::peds[np].dir); + rwsp(trn, Gyro::peds[np].dir); + } + + + + void getback(); + + static Gyro::bytefield r; + + /* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; + begin { By De Morgan's law: } + overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); + end;*/ + /* x1,x2 - as Gyro::bytefield, but *8. y1,y2 - as Gyro::bytefield. + x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ + static bool overlaps_with_mouse() { + bool overlaps_with_mouse_result; + overlaps_with_mouse_result = + (r.x2 * 8 >= Gyro::mx) && (Gyro::mx + 16 >= r.x1 * 8) && (r.y2 >= Gyro::my) && (Gyro::my + 16 >= r.y1); + return overlaps_with_mouse_result; + } + + void getback() { + byte fv; + bool endangered; + + + endangered = false; + /* Super_Off;*/ + + { + while (getset[1 - Gyro::cp].numleft > 0) { + getset[1 - Gyro::cp].recall(r); + + /* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ + + Lucerna::mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - Gyro::cp); + } + } + + Lucerna::blitfix(); + /*if endangered then*/ /*Super_On;*/ + } + + /* Eachstep procedures: */ + void follow_avvy_y(byte tripnum) { + if (tr[1].face == left) + return; + if (tr[tripnum].homing) + tr[tripnum].hy = tr[1].y; + else { + if (tr[tripnum].y < tr[1].y) + tr[tripnum].y += 1; + else if (tr[tripnum].y > tr[1].y) + tr[tripnum].y -= 1; + else + return; + if (tr[tripnum].ix == 0) { + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + tr[tripnum].count = 0; + } + } + } + + void back_and_forth(byte tripnum) { + if (! tr[tripnum].homing) { + if (tr[tripnum].face == right) + tr[tripnum].walkto(4); + else + tr[tripnum].walkto(5); + } + } + + void face_avvy(byte tripnum) { + if (! tr[tripnum].homing) { + if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; + else tr[tripnum].face = left; + } + } + + void arrow_procs(byte tripnum) { + byte fv; + + if (tr[tripnum].homing) { + /* Arrow is still in flight. */ + /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. + This is so if: a) the bottom of the arrow is below Avvy's head, + b) the left of the arrow is left of the right of Avvy's head, and + c) the right of the arrow is right of the left of Avvy's head. */ + if (((tr[tripnum].y + tr[tripnum].a.yl) >= tr[1].y) /* A */ + && (tr[tripnum].x <= (tr[1].x + tr[1].a.xl)) /* B */ + && ((tr[tripnum].x + tr[tripnum].a.xl) >= tr[1].x)) { /* C */ + /* OK, it's hit him... what now? */ + + tr[2].call_eachstep = false; /* prevent recursion. */ + Visa::dixi('Q', 47); /* Complaint! */ + tr[tripnum].done(); /* Deallocate the arrow. */ + /* tr[1].done; { Deallocate normal pic of Avvy. } + + off; + for fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on;*/ + + Lucerna::gameover(); + + Gyro::dna.user_moves_avvy = false; /* Stop the user from moving him. */ + Timeout::set_up_timer(55, Timeout::procnaughty_duke, Timeout::reason_naughty_duke); + } + } else { /* Arrow has hit the wall! */ + tr[tripnum].done(); /* Deallocate the arrow. */ + Celer::show_one(3); /* Show pic of arrow stuck into the door. */ + Gyro::dna.arrow_in_the_door = true; /* So that we can pick it up. */ + } + + } + + /*procedure Spludwick_procs(tripnum:byte); + var fv:byte; + begin + with tr[tripnum] do + if not homing then { We only need to do anything if Spludwick *stops* + walking. } + with Gyro::dna do + begin + inc(DogfoodPos); + if DogfoodPos=8 then DogfoodPos:=1; + walkto(DogfoodPos); + end; + end;*/ + + void grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ + byte fv; + int16 tox, toy; + + tox = tr[1].x + 17; + toy = tr[1].y - 1; + if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { + tr[tripnum].call_eachstep = false; + tr[tripnum].face = left; + tr[tripnum].stopwalk(); + /* ... whatever ... */ + } else { + /* Still some way to go. */ + if (tr[tripnum].x < tox) { + tr[tripnum].x += 5; + if (tr[tripnum].x > tox) tr[tripnum].x = tox; + } + if (tr[tripnum].y < toy) tr[tripnum].y += 1; + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + } + } + + + + void geida_procs(byte tripnum); + + static void take_a_step(byte &tripnum) { + if (tr[tripnum].ix == 0) { + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + tr[tripnum].count = 0; + } + } + + static void spin(byte whichway, byte &tripnum) { + if (tr[tripnum].face != whichway) { + tr[tripnum].face = whichway; + if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ + + Gyro::dna.geida_spin += 1; + Gyro::dna.geida_time = 20; + if (Gyro::dna.geida_spin == 5) { + Scrolls::display("Steady on, Avvy, you'll make the poor girl dizzy!"); + Gyro::dna.geida_spin = 0; + Gyro::dna.geida_time = 0; /* knock out records */ + } + } + } + + void geida_procs(byte tripnum) { + if (Gyro::dna.geida_time > 0) { + Gyro::dna.geida_time -= 1; + if (Gyro::dna.geida_time == 0) Gyro::dna.geida_spin = 0; + } + + if (tr[tripnum].y < (tr[1].y - 2)) { + /* Geida is further from the screen than Avvy. */ + spin(down, tripnum); + tr[tripnum].iy = 1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; + } else if (tr[tripnum].y > (tr[1].y + 2)) { + /* Avvy is further from the screen than Geida. */ + spin(up, tripnum); + tr[tripnum].iy = -1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; + } + + tr[tripnum].iy = 0; + if (tr[tripnum].x < tr[1].x - tr[1].xs * 8) { + tr[tripnum].ix = tr[1].xs; + spin(right, tripnum); + take_a_step(tripnum); + } else if (tr[tripnum].x > tr[1].x + tr[1].xs * 8) { + tr[tripnum].ix = -tr[1].xs; + spin(left, tripnum); + take_a_step(tripnum); + } else tr[tripnum].ix = 0; + } + + /* That's all... */ + + void call_andexors() { + byte order[5]; + byte fv, temp; + bool ok; + + for (int i = 0; i < 5; i++) + order[i] = 0; + + for (fv = 1; fv <= numtr; fv ++) { + if (tr[fv].quick && tr[fv].visible) + order[fv] = fv; + } + + do { + ok = true; + for (fv = 1; fv <= 4; fv ++) + if (((order[fv] != 0) && (order[fv + 1] != 0)) + && (tr[order[fv]].y > tr[order[fv + 1]].y)) { + /* Swap them! */ + temp = order[fv]; + order[fv] = order[fv + 1]; + order[fv + 1] = temp; + ok = false; + } + } while (!ok); + + for (fv = 1; fv <= 5; fv ++) + if (order[fv] > 0) + tr[order[fv]].andexor(); + } + + void trippancy_link() { + byte fv; + + if (Gyro::ddmnow | Gyro::ontoolbar | Gyro::seescroll) return; + for (fv = 1; fv <= numtr; fv ++) { + if (tr[fv].quick) + tr[fv].walk(); + } + + call_andexors(); + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && with.call_eachstep) { + switch (tr[fv].eachstep) { + case procfollow_avvy_y : + follow_avvy_y(fv); + break; + case procback_and_forth : + back_and_forth(fv); + break; + case procface_avvy : + face_avvy(fv); + break; + case procarrow_procs : + arrow_procs(fv); + break; + /* PROCSpludwick_procs : spludwick_procs(fv);*/ + case procgrab_avvy : + grab_avvy(fv); + break; + case procgeida_procs : + geida_procs(fv); + break; + } + } + } + if (mustexclaim) { + mustexclaim = false; + Visa::dixi('x', saywhat); + } + } + + void get_back_loretta() { + byte fv; + + /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ + for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { + getback(); + return; + } + /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ + } + + void stopwalking() { + tr[1].stopwalk(); + Gyro::dna.rw = stopped; + if (Gyro::alive) + tr[1].step = 1; + } + + void tripkey(char dir) { + if ((Gyro::ctrl == Gyro::cjoy) | (! Gyro::dna.user_moves_avvy)) + return; + + { + triptype &with = tr[1]; + { + switch (dir) { + case 'H': + if (Gyro::dna.rw != up) { + Gyro::dna.rw = up; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'P': + if (Gyro::dna.rw != down) { + Gyro::dna.rw = down; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'K': + if (Gyro::dna.rw != left) { + Gyro::dna.rw = left; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'M': + if (Gyro::dna.rw != right) { + Gyro::dna.rw = right; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'I': + if (Gyro::dna.rw != ur) { + Gyro::dna.rw = ur; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'Q': + if (Gyro::dna.rw != dr) { + Gyro::dna.rw = dr; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'O': + if (Gyro::dna.rw != dl) { + Gyro::dna.rw = dl; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'G': + if (Gyro::dna.rw != ul) { + Gyro::dna.rw = ul; + rwsp(1, Gyro::dna.rw); + } else stopwalking(); + break; + case 'L': + stopwalking(); + break; + } + } + } + } + + void readstick() { + warning("STUB: Trip::readstick()"); + } + + void getsetclear() { + byte fv; + + for (fv = 0; fv <= 1; fv ++) + getset[fv].init(); + } + + void hide_in_the_cupboard() { + const char nowt = 250; /* As in Acci. */ + + if (Gyro::dna.avvys_in_the_cupboard) { + if (Gyro::dna.wearing == nowt) + Scrolls::display("\6AVVY!\22 Get dressed first!"); + else { + tr[1].visible = true; + Gyro::dna.user_moves_avvy = true; + apped(1, 3); /* Walk out of the cupboard. */ + Scrolls::display("You leave the cupboard. Nice to be out of there!"); + Gyro::dna.avvys_in_the_cupboard = false; + Sequence::first_show(8); + Sequence::then_show(7); + Sequence::start_to_close; + } + } else { + /* Not hiding in the cupboard */ + tr[1].visible = false; + Gyro::dna.user_moves_avvy = false; + Scrolls::display(Common::String("You walk into the room...\20It seems to be an empty, ") + + "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + + "avoid suffocation."); + Gyro::dna.avvys_in_the_cupboard = true; + Celer::show_one(8); + } + } + + + + void fliproom(byte room, byte ped); + + static int16 beforex, beforey; + + static void tidy_after_mouse(); + + static void tidy_up(int16 a, int16 b, int16 c, int16 d) { + warning("STUB: Trip::tidy_up()"); + } + + + + static void tidy_after_mouse() { + tidy_up(beforex, beforey, beforex + 15, beforey + 15); + Gyro::xycheck(); + tidy_up(Gyro::mx, Gyro::my, Gyro::mx + 15, Gyro::my + 15); + } + + void fliproom(byte room, byte ped) { + byte fv; + + + if (! Gyro::alive) { + /* You can't leave the room if you're dead. */ + tr[1].ix = 0; + tr[1].iy = 0; /* Stop him from moving. */ + return; + } + + if ((ped == 177) && (Gyro::dna.room == r__lusties)) { + hide_in_the_cupboard(); + return; + } + + if ((Gyro::dna.jumpstatus > 0) && (Gyro::dna.room == r__insidecardiffcastle)) { + /* You can't *jump* out of Cardiff Castle! */ + tr[1].ix = 0; + return; + } + + Gyro::xycheck(); + beforex = Gyro::mx; + beforey = Gyro::my; + + Lucerna::exitroom(Gyro::dna.room); + Lucerna::dusk(); + getsetclear(); + + + for (fv = 2; fv <= numtr; fv ++) { + if (tr[fv].quick) + tr[fv].done(); + } /* Deallocate sprite */ + + if (Gyro::dna.room == r__lustiesroom) + Gyro::dna.enter_catacombs_from_lusties_room = true; + + Lucerna::enterroom(room, ped); + apped(1, ped); + Gyro::dna.enter_catacombs_from_lusties_room = false; + Gyro::oldrw = Gyro::dna.rw; + Gyro::dna.rw = tr[1].face; + Lucerna::showrw; + + for (fv = 0; fv <= 1; fv ++) { + Gyro::cp = 1 - Gyro::cp; + getback(); + } + Lucerna::dawn; + + /* Tidy up after mouse. I know it's a kludge... */ + /* tidy_after_mouse;*/ + } + + bool infield(byte which) { + /* returns True if you're within field "which" */ + int16 yy; + + yy = tr[1].y + tr[1].a.yl; + + return (tr[1].x >= Gyro::fields[which].x1) && (tr[1].x <= Gyro::fields[which].x2) + && (yy >= Gyro::fields[which].y1) && (yy <= Gyro::fields[which].y2); + + } + + bool neardoor() { /* returns True if you're near a door! */ + int16 ux, uy; + byte fv; + bool nd; + + bool neardoor_result; + if (Gyro::numfields < 9) { + /* there ARE no doors here! */ + neardoor_result = false; + return neardoor_result; + } + + ux = tr[1].x; + uy = tr[1].y + tr[1].a.yl; + + nd = false; + for (fv = 9; fv <= Gyro::numfields; fv ++) { + Gyro::fields[fv]; + + if ((ux >= Gyro::fields[fv].x1) && (ux <= Gyro::fields[fv].x2) + && (uy >= Gyro::fields[fv].y1) && (uy <= Gyro::fields[fv].y2)) + nd = true; + } + return nd; + } + + void new_game_for_trippancy() { /* Called by gyro.newgame */ + tr[1].visible = false; + } + + void triptype::save_data_to_mem(uint16 &where) { + warning("STUB: Trip::save_data_to_mem()"); + } + + void triptype::load_data_from_mem(uint16 &where) { + warning("STUB: Trip::load_data_from_mem()"); + } + + } // End of namespace Trip. + +} // End of namespace Avalanche. diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h new file mode 100644 index 000000000000..0227bab7b672 --- /dev/null +++ b/engines/avalanche/trip6.h @@ -0,0 +1,227 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* TRIP5 Trippancy V */ + + +#ifndef TRIP6_H +#define TRIP6_H + + + +#include "common/scummsys.h" +#include "common/str.h" + +#include "avalanche/gyro2.h" + +namespace Avalanche { + + namespace Trip { + + // Call it where Trip is first used. + // Procuded to replace the initizalization part of the original Pascal unit. + void initialize_trip(); + + const int16 maxgetset = 35; + + typedef byte manitype[2049]; // manitype = array[5..2053] of byte; + // Be aware!!! + + typedef byte siltype[51][11]; /* 35, 4 */ + + struct adxtype { /* Second revision of ADX type */ + Common::String name; /* name of character */ + Common::String comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + uint16 size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ + }; + + struct trip_saver_type { + byte whichsprite; + byte face; + byte step; + int16 x; + int16 y; + int8 ix; + int8 iy; + bool visible; + bool homing; + bool check_me; + byte count; + byte xw, xs, ys; + byte totalnum; + int16 hx; + int16 hy; + bool call_eachstep; + byte eachstep; + bool vanishifstill; + }; + + class triptype { + public: + adxtype a; /* vital statistics */ + byte face, step; + int16 x, y; /* current xy coords */ + int16 ox[2], oy[2]; /* last xy coords */ + int8 ix, iy; /* amount to move sprite by, each step */ + manitype *mani[24]; + siltype *sil[24]; + byte whichsprite; + bool quick, visible, homing, check_me; + int16 hx, hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + byte xw; /* x-width in bytes */ + byte xs, ys; /* x & y speed */ + byte totalnum; /* total number of sprites */ + bool vanishifstill; /* Do we show this sprite if it's still? */ + + bool call_eachstep; /* Do we call the eachstep procedure? */ + byte eachstep; + + triptype *init(byte spritenum, bool do_check); + /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(int16 wx, int16 wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(byte pednum); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(int8 xx, int8 yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ + void set_up_saver(trip_saver_type &v); + void unload_saver(trip_saver_type v); + + void savedata(/*untyped_file &f*/); /* Self-explanatory, */ + void loaddata(/*untyped_file &f*/); /* really. */ + + + + + void save_data_to_mem(uint16 &where); + void load_data_from_mem(uint16 &where); + triptype *done(); + + private: + bool collision_check(); + }; + + class getsettype { + public: + Gyro::bytefield gs[maxgetset]; + byte numleft; + + getsettype *init(); + void remember(Gyro::bytefield r); + void recall(Gyro::bytefield &r); + }; + + + const int16 up = 0; + const int16 right = 1; + const int16 down = 2; + const int16 left = 3; + const int16 ur = 4; + const int16 dr = 5; + const int16 dl = 6; + const int16 ul = 7; + const int16 stopped = 8; + + const int16 numtr = 5; /* current max no. of sprites */ + + + + const int16 procfollow_avvy_y = 1; + + const int16 procback_and_forth = 2; + + const int16 procface_avvy = 3; + + const int16 procarrow_procs = 4; + + const int16 procspludwick_procs = 5; + + const int16 procgrab_avvy = 6; + + const int16 procgeida_procs = 7; + + + void trippancy_link(); + + void get_back_loretta(); + + void loadtrip(); + + void call_special(uint16 which); + + void open_the_door(byte whither, byte ped, byte magicnum); /* Handles slidey-open doors. */ + + void catamove(byte ped); + + void stopwalking(); + + void tripkey(char dir); + + void rwsp(byte t, byte r); + + void apped(byte trn, byte np); + + void getback(); + + void fliproom(byte room, byte ped); + + bool infield(byte which); /* returns True if you're within field "which" */ + + bool neardoor(); /* returns True if you're near a door! */ + + void readstick(); + + void newspeed(); + + void new_game_for_trippancy(); + + + + triptype tr[numtr]; + getsettype getset[2]; + byte aa[1600]; + + bool mustexclaim; + uint16 saywhat; + + } // End of namespace Trip. + +} // End of namespace Avalanche. + +#endif // TRIP6_H From 784a6aa821cebf39f44a60e419aa500dc946c943 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 27 Jun 2013 12:34:32 +0200 Subject: [PATCH 0042/1332] AVALANCHE: Change constant into initialized variable according to the Pascal sources. --- engines/avalanche/gyro2.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index cd5644ec4b8e..0836dfbb6c9b 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -44,10 +44,6 @@ namespace Avalanche { const int16 maxobjs = 12; /* carry limit */ const byte howlong = 1/*8*/; /* 18 ticks. */ - const bool oncandopageswap = true; - /* Variable constant for overriding the ability of On to switch pages. - * You may know better than On which page to switch to. */ - const int16 num = 32; /* Code for Num Lock */ const int16 mouse_size = 134; @@ -624,6 +620,12 @@ namespace Avalanche { r__wisewomans }; /* The Wise Woman. */ + bool oncandopageswap = true; + /* Variable constant for overriding the ability of On to switch pages. + * You may know better than On which page to switch to. */ + + + Common::String current; From a9cc1f78b4aad2f2cc22647d22bc478f5d545b75 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 11:35:19 +0200 Subject: [PATCH 0043/1332] AVALANCHE: Gyro: Replace namespace with class. --- engines/avalanche/gyro2.cpp | 689 +++++++++++++++++++----------- engines/avalanche/gyro2.h | 806 +++++++++++++++--------------------- 2 files changed, 779 insertions(+), 716 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fba155af5918..a96249d67bf3 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* GYRO It all revolves around this bit! */ + #include "avalanche/gyro2.h" #include "common/textconsole.h" @@ -41,289 +43,476 @@ namespace Avalanche { - namespace Gyro { - - const Common::String things[numobjs] = { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" - }; +const char *Gyro::vernum = "1.30"; - const char thingchar[] = "WMBParCLguKeSnIohn"; /* V=Vinegar */ +const char *Gyro::copyright = "1995"; - const Common::String better[numobjs] = { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" - }; - const char betterchar[] = "WMBParCLguKeSnIohn"; +const mp Gyro::mps[9] = { + { + /* 1 - up-arrow */ + { {65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}, + {0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0} + }, + 8, + 0 + }, - void newpointer(byte m) { - warning("STUB: Gyro::newpointer()"); - } + { + /* 2 - screwdriver */ + { {8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}, + {0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0} - void wait() { /* makes hourglass */ - newpointer(5); - } + }, + 0, + 0 + }, - void on() { - warning("STUB: Gyro::on()"); - } + { + /* 3 - right-arrow */ + { {65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}, + {0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0} + }, + 15, + 6 + }, - void on_virtual() { - switch (visible) { - case m_virtual: - return; - break; - case m_yes: - off(); - break; + { + /* 4 - fletch */ + { {255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}, + {0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0} + }, + 0, + 0 + }, + + { + /* 5 - hourglass */ + { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, + {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} + }, + 8, + 7 + }, + + { + /* 6 - TTHand */ + { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, + {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} + }, + 4, + 0 + }, + + { + /* 7- Mark's crosshairs */ + { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, + {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} + }, + 8, + 5 + }, + + { + /* 8- I-beam. */ + { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, + {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} + }, + 8, + 7 + }, + + { + /* 9- Question mark. */ + { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, + {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} + }, + 0, + 0 } - - visible = m_virtual; - } - - void off() { - warning("STUB: Gyro::off()"); - } - - void off_virtual() { - warning("STUB: Gyro::off_virtual()"); - } - - void xycheck() { /* only updates mx & my, not all other mouse vars */ - warning("STUB: Gyro::xycheck()"); - } - - void hopto(int16 x, int16 y) { /* Moves mouse void *to x,y */ - warning("STUB: Gyro::hopto()"); - } - - void check() { - warning("STUB: Gyro::check()"); - } - - void note(uint16 hertz) { - warning("STUB: Gyro::note()"); - } - - void blip() { - warning("STUB: Gyro::blip()"); - } - - Common::String strf(int32 x) { - Common::String q = Common::String::format("%d", x); - return q; - } - - void shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { - warning("STUB: Gyro::shadow()"); - } - - void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { - warning("STUB: Gyro::shbox()"); - } - - void newgame() { /* This sets up the DNA for a completely new game. */ - warning("STUB: Gyro::newgame()"); - } - - void click() { /* "Audio keyboard feedback" */ - warning("STUB: Gyro::click()"); - } - - void slowdown() { - warning("STUB: Gyro::slowdown()"); - } - - bool flagset(char x) { - for (uint16 i = 0; i < flags.size(); i++) - if (flags[i] == x) - return true; - return false; - } - - void force_numlock() { - if ((locks & num) > 0) locks -= num; - } - - bool pennycheck(uint16 howmuchby) { - warning("STUB: Gyro::pennycheck()"); - return true; - } - - // There'll may be problems with calling these functions becouse of the conversion of the arrays!!! - // Keep an eye open! - Common::String getname(byte whose) { - Common::String getname_result; - if (whose < 17) - getname_result = lads[whose]; - else - getname_result = lasses[whose-17]; - return getname_result; - } - - // Keep an eye open! ^ - char getnamechar(byte whose) { - char getnamechar_result; - if (whose < 16) - getnamechar_result = ladchar[whose]; - else - getnamechar_result = lasschar[whose-16]; - return getnamechar_result; - } - - // Keep an eye open! ^^ - Common::String get_thing(byte which) { - Common::String get_thing_result; - switch (which) { - case wine: - switch (dna.winestate) { - case 1: - case 4: - get_thing_result = things[which]; - break; - case 3: - get_thing_result = "Vinegar"; - break; - } +}; + +const Common::String Gyro::lads[17] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", + "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", + "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" +}; + +const Common::String Gyro::lasses[4] = +{"Arkata", "Geida", "", "the Wise Woman"}; + +const char Gyro::ladchar[] = "ASCDMTRwLfgeIyPu"; + +const char Gyro::lasschar[] = "kGo"; + +const int32 Gyro::catamap[8][8] = { + /* Geida's room */ + /* 1 2 3 | 4 5 6 7 8*/ + {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, + {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, + {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, /* >> Oubliette */ + {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, + {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, /* <<< In here */ + {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} +}; +/* vv Stairs trap. */ + +const char Gyro::spludwick_order[3] = {onion, ink, mushroom}; + +const quasiped_type Gyro::quasipeds[16] = { + {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ + {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ + {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ + {3, black, 23, red, 177}, /* D: Hawk (screen 23). */ + {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ + {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ + {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ + {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ + {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ + {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ + {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ + {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ + {3, white, 27, red, 177}, /* M: Avaroid (screen 27). */ + {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ + {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ + {2, lightgreen, 51, darkgray, pdrduck} +}; /*P: Duck (screen 51). */ + +const char Gyro::keys[] = "QWERTYUIOP[]"; + +const uint16 Gyro::notes[12] = +{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; + +const tunetype Gyro::tune = { + higher, higher, lower, same, higher, higher, lower, higher, higher, higher, + lower, higher, higher, + same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, + lower, same, lower, higher, same, lower, higher +}; + +const byte Gyro::static_const_whereis[29] = { + /* The Lads */ + r__yours, /* Avvy */ + r__spludwicks, /* Spludwick */ + r__outsideyours, /* Crapulus */ + r__ducks, /* Duck - r__DucksRoom's not defined yet. */ + r__argentpub, /* Malagauche */ + r__robins, /* Friar Tuck. */ + 177, /* Robin Hood - can't meet him at the start. */ + r__brummieroad, /* Cwytalot */ + r__lustiesroom, /* Baron du Lustie. */ + r__outsidecardiffcastle, /* The Duke of Cardiff. */ + r__argentpub, /* Dogfood */ + r__outsideducks, /* Trader */ + r__argentpub, /* Ibythneth */ + r__aylesoffice, /* Ayles */ + r__nottspub, /* Port */ + r__nottspub, /* Spurge */ + r__musicroom, /* Jacques */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* The Lasses */ + r__yours, /* Arkata */ + r__geidas, /* Geida */ + 177, /* nobody allocated here! */ + r__wisewomans /* The Wise Woman. */ +}; + + + + + +const Common::String Gyro::things[numobjs] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" +}; + +const char Gyro::thingchar[] = "WMBParCLguKeSnIohn"; /* V=Vinegar */ + +const Common::String Gyro::better[numobjs] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", + "an onion" +}; + +const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; + + + +Gyro::Gyro() : interrogation(0), oncandopageswap(true) { + for (int i = 0; i < 29; i++) + whereis[i] = static_const_whereis[i]; +} + +void Gyro::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Gyro::newpointer(byte m) { + warning("STUB: Gyro::newpointer()"); +} + +void Gyro::wait() { /* makes hourglass */ + newpointer(5); +} + +void Gyro::on() { + warning("STUB: Gyro::on()"); +} + +void Gyro::on_virtual() { + switch (visible) { + case m_virtual: + return; + break; + case m_yes: + off(); + break; + } + + visible = m_virtual; +} + +void Gyro::off() { + warning("STUB: Gyro::off()"); +} + +void Gyro::off_virtual() { + warning("STUB: Gyro::off_virtual()"); +} + +void Gyro::xycheck() { /* only updates mx & my, not all other mouse vars */ + warning("STUB: Gyro::xycheck()"); +} + +void Gyro::hopto(int16 x, int16 y) { /* Moves mouse void *to x,y */ + warning("STUB: Gyro::hopto()"); +} + +void Gyro::check() { + warning("STUB: Gyro::check()"); +} + +void Gyro::note(uint16 hertz) { + warning("STUB: Gyro::note()"); +} + +void Gyro::blip() { + warning("STUB: Gyro::blip()"); +} + +Common::String Gyro::strf(int32 x) { + Common::String q = Common::String::format("%d", x); + return q; +} + +void Gyro::shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { + warning("STUB: Gyro::shadow()"); +} + +void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { + warning("STUB: Gyro::shbox()"); +} + +void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ + warning("STUB: Gyro::newgame()"); +} + +void Gyro::click() { /* "Audio keyboard feedback" */ + warning("STUB: Gyro::click()"); +} + +void Gyro::slowdown() { + warning("STUB: Gyro::slowdown()"); +} + +bool Gyro::flagset(char x) { + for (uint16 i = 0; i < flags.size(); i++) + if (flags[i] == x) + return true; + return false; +} + +void Gyro::force_numlock() { + if ((locks & num) > 0) locks -= num; +} + +bool Gyro::pennycheck(uint16 howmuchby) { + warning("STUB: Gyro::pennycheck()"); + return true; +} + +// There'll may be problems with calling these functions becouse of the conversion of the arrays!!! +// Keep an eye open! +Common::String Gyro::getname(byte whose) { + Common::String getname_result; + if (whose < 17) + getname_result = lads[whose]; + else + getname_result = lasses[whose-17]; + return getname_result; +} + +// Keep an eye open! ^ +char Gyro::getnamechar(byte whose) { + char getnamechar_result; + if (whose < 16) + getnamechar_result = ladchar[whose]; + else + getnamechar_result = lasschar[whose-16]; + return getnamechar_result; +} + +// Keep an eye open! ^^ +Common::String Gyro::get_thing(byte which) { + Common::String get_thing_result; + switch (which) { + case wine: + switch (dna.winestate) { + case 1: + case 4: + get_thing_result = things[which]; break; - case onion: - if (dna.rotten_onion) - get_thing_result = "rotten onion"; - else get_thing_result = things[which]; + case 3: + get_thing_result = "Vinegar"; break; - default: - get_thing_result = things[which]; } - return get_thing_result; - } - - // Keep an eye open! ^^^ - char get_thingchar(byte which) { - char get_thingchar_result; - switch (which) { - case wine: - if (dna.winestate == 3) - get_thingchar_result = 'V'; /* Vinegar */ - else - get_thingchar_result = thingchar[which]; - break; - default: + break; + case onion: + if (dna.rotten_onion) + get_thing_result = "rotten onion"; + else get_thing_result = things[which]; + break; + default: + get_thing_result = things[which]; + } + return get_thing_result; +} + +// Keep an eye open! ^^^ +char Gyro::get_thingchar(byte which) { + char get_thingchar_result; + switch (which) { + case wine: + if (dna.winestate == 3) + get_thingchar_result = 'V'; /* Vinegar */ + else get_thingchar_result = thingchar[which]; - } - return get_thingchar_result; - } - - // Keep an eye open! ^^^^ - Common::String get_better(byte which) { - Common::String get_better_result; - if (which > 150) which -= 149; - switch (which) { - case wine: - switch (dna.winestate) { - case 0: - case 1: - case 4: - get_better_result = better[which]; - break; - case 3: - get_better_result = "some vinegar"; - break; - } + break; + default: + get_thingchar_result = thingchar[which]; + } + return get_thingchar_result; +} + +// Keep an eye open! ^^^^ +Common::String Gyro::get_better(byte which) { + Common::String get_better_result; + if (which > 150) which -= 149; + switch (which) { + case wine: + switch (dna.winestate) { + case 0: + case 1: + case 4: + get_better_result = better[which]; break; - case onion: - if (dna.rotten_onion) - get_better_result = "a rotten onion"; - else if (dna.onion_in_vinegar) - get_better_result = "a pickled onion (in the vinegar)"; - else get_better_result = better[which]; + case 3: + get_better_result = "some vinegar"; break; - default: - if ((which < numobjs) && (which > '\0')) - get_better_result = better[which]; - else - get_better_result = ""; } - return get_better_result; + break; + case onion: + if (dna.rotten_onion) + get_better_result = "a rotten onion"; + else if (dna.onion_in_vinegar) + get_better_result = "a pickled onion (in the vinegar)"; + else get_better_result = better[which]; + break; + default: + if ((which < numobjs) && (which > '\0')) + get_better_result = better[which]; + else + get_better_result = ""; } + return get_better_result; +} - // Get back here after finished with acci.pas, where vb_-s are resided. - Common::String f5_does() - /* This procedure determines what f5 does. */ - { - warning("STUB: Gyro::f5_does()"); - return "STUB: Gyro::f5_does()"; - } +// Get back here after finished with acci.pas, where vb_-s are resided. +Common::String Gyro::f5_does() +/* This procedure determines what f5 does. */ +{ + warning("STUB: Gyro::f5_does()"); + return "STUB: Gyro::f5_does()"; +} - // Pobably vmc functions will deal with the mouse cursor. - void plot_vmc(int16 xx, int16 yy, byte page_) { - warning("STUB: Gyro::plot_vmc()"); - } +// Pobably vmc functions will deal with the mouse cursor. +void Gyro::plot_vmc(int16 xx, int16 yy, byte page_) { + warning("STUB: Gyro::plot_vmc()"); +} - void wipe_vmc(byte page_) { - warning("STUB: Gyro::wipe_vmc()"); - } +void Gyro::wipe_vmc(byte page_) { + warning("STUB: Gyro::wipe_vmc()"); +} - void setup_vmc() { - warning("STUB: Gyro::setup_vmc()"); - } +void Gyro::setup_vmc() { + warning("STUB: Gyro::setup_vmc()"); +} - void clear_vmc() { - warning("STUB: Gyro::clear_vmc()"); - } +void Gyro::clear_vmc() { + warning("STUB: Gyro::clear_vmc()"); +} - void setminmaxhorzcurspos(uint16 min, uint16 max) { /* phew */ - warning("STUB: Gyro::setminmaxhorzcurspos()"); - } +void Gyro::setminmaxhorzcurspos(uint16 min, uint16 max) { /* phew */ + warning("STUB: Gyro::setminmaxhorzcurspos()"); +} - void setminmaxvertcurspos(uint16 min, uint16 max) { - warning("STUB: Gyro::setminmaxvertcurspos()"); - } +void Gyro::setminmaxvertcurspos(uint16 min, uint16 max) { + warning("STUB: Gyro::setminmaxvertcurspos()"); +} - void load_a_mouse(byte which) { - warning("STUB: Gyro::load_a_mouse()"); - } +void Gyro::load_a_mouse(byte which) { + warning("STUB: Gyro::load_a_mouse()"); +} - void background(byte x) { - warning("STUB: Gyro::background()"); - } +void Gyro::background(byte x) { + warning("STUB: Gyro::background()"); +} - void hang_around_for_a_while() { - byte fv; +void Gyro::hang_around_for_a_while() { + byte fv; - for (fv = 1; fv <= 28; fv ++) slowdown(); - } + for (fv = 1; fv <= 28; fv ++) slowdown(); +} - bool mouse_near_text() { - bool mouse_near_text_result; - mouse_near_text_result = (my > 144) && (my < 188); - return mouse_near_text_result; - } - - /* Super_Off and Super_On are two very useful procedures. Super_Off switches - the mouse cursor off, WHATEVER it's like. Super_On restores it again - afterwards. */ +/* Super_Off and Super_On are two very useful procedures. Super_Off switches + the mouse cursor off, WHATEVER it's like. Super_On restores it again + afterwards. */ - void super_off() { - super_was_off = visible == m_no; - if (super_was_off) return; +void Gyro::super_off() { + super_was_off = visible == m_no; + if (super_was_off) return; - super_was_virtual = visible == m_virtual; + super_was_virtual = visible == m_virtual; - if (visible == m_virtual) off_virtual(); - else off(); - } + if (visible == m_virtual) off_virtual(); + else off(); +} - void super_on() { - if ((visible != m_no) || (super_was_off)) return; +void Gyro::super_on() { + if ((visible != m_no) || (super_was_off)) return; - if (super_was_virtual) on_virtual(); - else on(); - } + if (super_was_virtual) on_virtual(); + else on(); +} - } // End of namespace Gyro +bool Gyro::mouse_near_text() { + bool mouse_near_text_result; + mouse_near_text_result = (my > 144) && (my < 188); + return mouse_near_text_result; +} } // End of namespace Avalanche diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 0836dfbb6c9b..ecea597c8e5a 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -25,490 +25,392 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* GYRO It all revolves around this bit! */ + #ifndef GYRO2_H #define GYRO2_H #include "common/system.h" #include "common/str.h" #include "common/scummsys.h" +#include "avalanche/avalanche.h" #include "avalanche/roomnums.h" #include "avalanche/color.h" namespace Avalanche { - namespace Gyro { - - ///////////////////////////// CONSTANTS ///////////////////////////// +static const char numobjs = 18; /* always preface with a # */ +static const int16 maxobjs = 12; /* carry limit */ +static const byte howlong = 1/*8*/; /* 18 ticks. */ - const char numobjs = 18; /* always preface with a # */ - const int16 maxobjs = 12; /* carry limit */ - const byte howlong = 1/*8*/; /* 18 ticks. */ +static const int16 num = 32; /* Code for Num Lock */ - const int16 num = 32; /* Code for Num Lock */ +static const int16 mouse_size = 134; - const int16 mouse_size = 134; +typedef void (*proc)(); - ///////////////////////////// TYPEDEFS ///////////////////////////// +struct postype { + uint16 x, y, datapos; + byte length; +}; - typedef void (*proc)(); +struct mp { /* mouse-void **/ + uint16 mask[2][16]; + int16 horzhotspot, verthotspot; +}; - struct postype { - uint16 x, y, datapos; - byte length; - }; +struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ + byte rw; /* Realway- just for convenience! */ + byte carrying; /* how many objects you're carrying... */ + bool obj[numobjs]; /* ...and which ones they are. */ + int16 score; /* your score, of course */ + int32 pence; /* your current amount of dosh */ + byte room; /* your current room */ + char wearing; /* what you're wearing */ + byte swore; /* number of times you've sworn */ + byte saves; /* number of times this game has been saved */ + byte rooms[100]; /* Add one to each every time + you enter a room */ + byte alcohol; /* Your blood alcohol level. */ + byte playednim; /* How many times you've played Nim. */ + bool wonnim; /* Have you *won* Nim? (That's harder.) */ + byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ + bool cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ - struct mp { /* mouse-void **/ - uint16 mask[2][16]; - int16 horzhotspot, verthotspot; - }; + byte pass_num; /* Number of the passuint16 for this game. */ + bool ayles_is_awake; /* pretty obvious! */ + byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ + byte avaricius_talk; /* How much Avaricius has said to you. */ + bool bought_onion; /* Have you bought an onion yet? */ + bool rotten_onion; /* And has it rotted? */ + bool onion_in_vinegar; /* Is the onion in the vinegar? */ - struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ - byte rw; /* Realway- just for convenience! */ - byte carrying; /* how many objects you're carrying... */ - bool obj[numobjs]; /* ...and which ones they are. */ - int16 score; /* your score, of course */ - int32 pence; /* your current amount of dosh */ - byte room; /* your current room */ - char wearing; /* what you're wearing */ - byte swore; /* number of times you've sworn */ - byte saves; /* number of times this game has been saved */ - byte rooms[100]; /* Add one to each every time - you enter a room */ - byte alcohol; /* Your blood alcohol level. */ - byte playednim; /* How many times you've played Nim. */ - bool wonnim; /* Have you *won* Nim? (That's harder.) */ - byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ - bool cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ + byte given2spludwick; /* 0 = nothing given, 1 = onion... */ + byte brummie_stairs; /* Progression through the stairs trick. */ + byte cardiff_things; /* Things you get asked in Cardiff. */ - byte pass_num; /* Number of the passuint16 for this game. */ - bool ayles_is_awake; /* pretty obvious! */ - byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ - byte avaricius_talk; /* How much Avaricius has said to you. */ - bool bought_onion; /* Have you bought an onion yet? */ - bool rotten_onion; /* And has it rotted? */ - bool onion_in_vinegar; /* Is the onion in the vinegar? */ + bool cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ - byte given2spludwick; /* 0 = nothing given, 1 = onion... */ - byte brummie_stairs; /* Progression through the stairs trick. */ - byte cardiff_things; /* Things you get asked in Cardiff. */ + bool avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ + bool avvy_in_bed; /* True if Avvy's in bed, but awake. */ - bool cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ + bool user_moves_avvy; /* If this is false, the user has no + control over Avvy's movements. */ - bool avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ - bool avvy_in_bed; /* True if Avvy's in bed, but awake. */ + byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ - bool user_moves_avvy; /* If this is false, the user has no - control over Avvy's movements. */ + bool givenbadgetoiby; /* Have you given the badge to Iby yet? */ - byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ + bool friar_will_tie_you_up; /* If you're going to get tied up. */ + bool tied_up; /* You ARE tied up! */ - bool givenbadgetoiby; /* Have you given the badge to Iby yet? */ + char box_contents; /* 0 = money (sixpence), 254 = empty, any + other number implies the contents of the box. */ - bool friar_will_tie_you_up; /* If you're going to get tied up. */ - bool tied_up; /* You ARE tied up! */ + bool talked_to_crapulus; /* Pretty self-explanatory. */ - char box_contents; /* 0 = money (sixpence), 254 = empty, any - other number implies the contents of the box. */ + byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ - bool talked_to_crapulus; /* Pretty self-explanatory. */ + bool ringing_bells; /* Is Jacques ringing the bells? */ - byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ + bool standing_on_dais; /* In room 71, inside Cardiff Castle. */ + bool taken_pen; /* Have you taken the pen (in Cardiff?) */ + bool arrow_triggered; /* And has the arrow been triggered? */ + bool arrow_in_the_door; /* Did the arrow hit the wall? */ - bool ringing_bells; /* Is Jacques ringing the bells? */ + Common::String like2drink, + favourite_song, + worst_place_on_earth, + spare_evening; /* Personalisation str's */ - bool standing_on_dais; /* In room 71, inside Cardiff Castle. */ - bool taken_pen; /* Have you taken the pen (in Cardiff?) */ - bool arrow_triggered; /* And has the arrow been triggered? */ - bool arrow_in_the_door; /* Did the arrow hit the wall? */ + int32 total_time; /* Your total time playing this game, in ticks.*/ - Common::String like2drink, - favourite_song, - worst_place_on_earth, - spare_evening; /* Personalisation str's */ + byte jumpstatus; /* Fixes how high you're jumping. */ - int32 total_time; /* Your total time playing this game, in ticks.*/ + bool mushroom_growing; /* Is the mushroom growing in 42? */ - byte jumpstatus; /* Fixes how high you're jumping. */ + bool spludwicks_here; /* Is Spludwick at home? */ - bool mushroom_growing; /* Is the mushroom growing in 42? */ + byte last_room; + byte last_room_not_map; - bool spludwicks_here; /* Is Spludwick at home? */ + bool crapulus_will_tell; /* Will Crapulus tell you about + Spludwick being away? */ - byte last_room; - byte last_room_not_map; + bool enter_catacombs_from_lusties_room; + bool teetotal; /* Are we touching any more drinks? */ + byte malagauche; /* Position of Malagauche. See Celer for more info. */ + char drinking; /* What's he getting you? */ - bool crapulus_will_tell; /* Will Crapulus tell you about - Spludwick being away? */ + bool entered_lusties_room_as_monk; - bool enter_catacombs_from_lusties_room; - bool teetotal; /* Are we touching any more drinks? */ - byte malagauche; /* Position of Malagauche. See Celer for more info. */ - char drinking; /* What's he getting you? */ + byte cat_x, cat_y; /* XY coords in the catacombs. */ - bool entered_lusties_room_as_monk; + bool avvys_in_the_cupboard; /* On screen 22. */ - byte cat_x, cat_y; /* XY coords in the catacombs. */ + bool geida_follows; /* Is Geida following you? */ - bool avvys_in_the_cupboard; /* On screen 22. */ + byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ - bool geida_follows; /* Is Geida following you? */ + byte nextbell; /* For the ringing. */ - byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ + bool geida_given_potion; /* Does Geida have the potion? */ + bool lustie_is_asleep; /* Is BDL asleep? */ - byte nextbell; /* For the ringing. */ + byte flip_to_where, flip_to_ped; /* For the sequencer. */ - bool geida_given_potion; /* Does Geida have the potion? */ - bool lustie_is_asleep; /* Is BDL asleep? */ + bool been_tied_up; /* In r__Robins. */ - byte flip_to_where, flip_to_ped; /* For the sequencer. */ + bool sitting_in_pub; /* Are you sitting down in the pub? */ + byte spurge_talk; /* Count for talking to Spurge. */ - bool been_tied_up; /* In r__Robins. */ + bool met_avaroid; - bool sitting_in_pub; /* Are you sitting down in the pub? */ - byte spurge_talk; /* Count for talking to Spurge. */ + bool taken_mushroom, + given_pen_to_ayles, + asked_dogfood_about_nim; +}; - bool met_avaroid; +struct pedtype { + int16 x, y; + byte dir; +}; - bool taken_mushroom, - given_pen_to_ayles, - asked_dogfood_about_nim; - }; +struct magictype { + byte op; /* one of the operations */ + uint16 data; /* data for them */ +}; - struct pedtype { - int16 x, y; - byte dir; - }; +class fieldtype { +public: + int16 x1, y1, x2, y2; +}; - struct magictype { - byte op; /* one of the operations */ - uint16 data; /* data for them */ - }; +struct bytefield { + byte x1, y1, x2, y2; +}; - class fieldtype { - public: - int16 x1, y1, x2, y2; - }; +class linetype : public fieldtype { +public: + byte col; +}; - struct bytefield { - byte x1, y1, x2, y2; - }; +struct adxtype { + Common::String name; /* name of character */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + uint16 size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ +}; - class linetype : public fieldtype { - public: - byte col; - }; +typedef byte raw[256][16]; /* raw_font_type */ - struct adxtype { - Common::String name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - uint16 size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - }; +enum controllers {cjoy, ckey}; - typedef byte raw[256][16]; /* raw_font_type */ +typedef Common::String previoustype[20]; - enum controllers {cjoy, ckey}; +struct corridor_type { /* Decarations for the corridors. */ + uint16 doors; /* Door styles are calc'ed from this uint16. + Assign a different number to each one! */ +}; - typedef Common::String previoustype[20]; +struct demo_type { + uint16 delay; + char key, extd; +}; - struct corridor_type { /* Decarations for the corridors. */ - uint16 doors; /* Door styles are calc'ed from this uint16. - Assign a different number to each one! */ - }; +struct quasiped_type { + byte whichped, fgc, room, bgc; + uint16 who; +}; +/* A quasiped defines how people who aren't sprites talk. For example, + quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving + that to context. */ - struct demo_type { - uint16 delay; - char key, extd; - }; +typedef byte tunetype[31]; - struct quasiped_type { - byte whichped, fgc, room, bgc; - uint16 who; - }; - /* A quasiped defines how people who aren't sprites talk. For example, - quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving - that to context. */ +struct vmctype { /* Virtual Mouse Cursor */ + void *andpic, *xorpic; + void *backpic[2]; + void* wherewas[2]; + byte picnumber; + int8 ofsx, ofsy; +}; - typedef byte tunetype[31]; +struct sundry { + /* Things which must be saved over a backtobootstrap, + outside DNA. */ + Common::String qenid_filename; + bool qsoundfx; + char qthinks; + bool qthinkthing; +}; - struct vmctype { /* Virtual Mouse Cursor */ - void *andpic, *xorpic; - void *backpic[2]; - void* wherewas[2]; - byte picnumber; - int8 ofsx, ofsy; - }; +struct joysetup { + uint16 xmid, ymid, xmin, ymin, xmax, ymax; + byte centre; /* Size of centre in tenths */ +}; - struct sundry { - /* Things which must be saved over a backtobootstrap, - outside DNA. */ - Common::String qenid_filename; - bool qsoundfx; - char qthinks; - bool qthinkthing; - }; - - struct joysetup { - uint16 xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; /* Size of centre in tenths */ - }; - - struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - char id[9]; /* signature */ - uint16 revision; /* EDNA revision, here 2 (1=dna256) */ - Common::String game; /* Long name, eg Lord Avalot D'Argent */ - Common::String shortname; /* Short name, eg Avalot */ - uint16 number; /* Game's code number, here 2 */ - uint16 ver; /* Version number as int16 (eg 1.00 = 100) */ - Common::String verstr; /* Vernum as Common::String (eg 1.00 = "1.00" */ - Common::String filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - Common::String os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - Common::String fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - uint16 y; /* ...saved on. */ - Common::String desc; /* Description of game (same as in Avaricius!) */ - uint16 len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - uint16 saves; /* no. of times this game has been saved */ - int16 cash; /* contents of your wallet in numerical form */ - Common::String money; /* ditto in Common::String form (eg 5/-, or 1 denarius)*/ - uint16 points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ - }; - - /* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ - - - - ///////////////////////////// CONSTANTS ///////////////////////////// - - const char vernum[] = "1.30"; - const char copyright[] = "1995"; - const int16 thisvercode = 130; +struct ednahead { /* Edna header */ + /* This header starts at byte offset 177 in the .ASG file. */ + char id[9]; /* signature */ + uint16 revision; /* EDNA revision, here 2 (1=dna256) */ + Common::String game; /* Long name, eg Lord Avalot D'Argent */ + Common::String shortname; /* Short name, eg Avalot */ + uint16 number; /* Game's code number, here 2 */ + uint16 ver; /* Version number as int16 (eg 1.00 = 100) */ + Common::String verstr; /* Vernum as Common::String (eg 1.00 = "1.00" */ + Common::String filename; /* Filename, eg AVALOT.EXE */ + byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ + Common::String os; /* Saving OS in text format. */ + + /* Info on this particular game */ + + Common::String fn; /* Filename (not extension ('cos that's .ASG)) */ + byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ + uint16 y; /* ...saved on. */ + Common::String desc; /* Description of game (same as in Avaricius!) */ + uint16 len; /* Length of DNA (it's not going to be above 65535!) */ + + /* Quick reference & miscellaneous */ + + uint16 saves; /* no. of times this game has been saved */ + int16 cash; /* contents of your wallet in numerical form */ + Common::String money; /* ditto in Common::String form (eg 5/-, or 1 denarius)*/ + uint16 points; /* your score */ + + /* DNA values follow, then footer (which is ignored) */ +}; + +/* Possible values of edhead.os: + 1 = DOS 4 = Mac + 2 = Windows 5 = Amiga + 3 = OS/2 6 = ST + 7 = Archimedes */ + + + + + + +class Gyro { + +public: + + static const char *vernum; + static const char *copyright; + static const int16 thisvercode = 130; /* as "vernum", but numerically & without the ".". */ - const int16 thisgamecode = 2; /* Avalot's code number */ + static const int16 thisgamecode = 2; /* Avalot's code number */ /* Objects you can hold: */ - const char wine = 1; - const char money = 2; - const char bodkin = 3; - const char potion = 4; - const char chastity = 5; - const char bolt = 6; - const char crossbow = 7; - const char lute = 10; - const char badge = 11; - const char mushroom = 12; - const char key = 13; - const char bell = 14; - const char prescription = 15; - const char pen = 16; - const char ink = 17; - const char clothes = 20; - const char habit = 21; - const char onion = 22; + static const char wine = 1; + static const char money = 2; + static const char bodkin = 3; + static const char potion = 4; + static const char chastity = 5; + static const char bolt = 6; + static const char crossbow = 7; + static const char lute = 10; + static const char badge = 11; + static const char mushroom = 12; + static const char key = 13; + static const char bell = 14; + static const char prescription = 15; + static const char pen = 16; + static const char ink = 17; + static const char clothes = 20; + static const char habit = 21; + static const char onion = 22; /* People who hang around this game. */ /* Boys: */ - const uint16 pavalot = 226; - const uint16 pspludwick = 227; - const uint16 pcrapulus = 230; - const uint16 pdrduck = 231; - const uint16 pmalagauche = 232; - const uint16 pfriartuck = 233; - const uint16 probinhood = 234; - const uint16 pcwytalot = 235; - const uint16 pdulustie = 236; - const uint16 pduke = 237; - const uint16 pdogfood = 240; - const uint16 ptrader = 241; - const uint16 pibythneth = 242; - const uint16 payles = 243; - const uint16 pport = 244; - const uint16 pspurge = 245; - const uint16 pjacques = 246; + static const uint16 pavalot = 226; + static const uint16 pspludwick = 227; + static const uint16 pcrapulus = 230; + static const uint16 pdrduck = 231; + static const uint16 pmalagauche = 232; + static const uint16 pfriartuck = 233; + static const uint16 probinhood = 234; + static const uint16 pcwytalot = 235; + static const uint16 pdulustie = 236; + static const uint16 pduke = 237; + static const uint16 pdogfood = 240; + static const uint16 ptrader = 241; + static const uint16 pibythneth = 242; + static const uint16 payles = 243; + static const uint16 pport = 244; + static const uint16 pspurge = 245; + static const uint16 pjacques = 246; /* Girls: */ - const uint16 parkata = 257; - const uint16 pgeida = 260; - const uint16 pwisewoman = 262; - - const int16 xw = 30; - const int16 yw = 36; /* x width & y whatsit */ - - const int16 margin = 5; - - const mp mps[9] = { - { - /* 1 - up-arrow */ - { {65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}, - {0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0} - }, - 8, - 0 - }, - - { - /* 2 - screwdriver */ - { {8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}, - {0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0} - - }, - 0, - 0 - }, - - { - /* 3 - right-arrow */ - { {65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}, - {0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0} - }, - 15, - 6 - }, - - { - /* 4 - fletch */ - { {255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}, - {0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0} - }, - 0, - 0 - }, - - { - /* 5 - hourglass */ - { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, - {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} - }, - 8, - 7 - }, - - { - /* 6 - TTHand */ - { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, - {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} - }, - 4, - 0 - }, - - { - /* 7- Mark's crosshairs */ - { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, - {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} - }, - 8, - 5 - }, - - { - /* 8- I-beam. */ - { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, - {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} - }, - 8, - 7 - }, - - { - /* 9- Question mark. */ - { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, - {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} - }, - 0, - 0 - } - - }; - - const Common::String lads[17] = { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" - }; - - const Common::String lasses[4] = - {"Arkata", "Geida", "", "the Wise Woman"}; - - const char ladchar[] = "ASCDMTRwLfgeIyPu"; - - const char lasschar[] = "kGo"; - - const int16 numtr = 2; /* current max no. of sprites */ - - const bool a_thing = true; - const bool a_person = false; /* for Thinkabout */ + static const uint16 parkata = 257; + static const uint16 pgeida = 260; + static const uint16 pwisewoman = 262; + + static const int16 xw = 30; + static const int16 yw = 36; /* x width & y whatsit */ + + static const int16 margin = 5; + + static const mp mps[9]; + + static const Common::String lads[17]; + + static const Common::String lasses[4]; + + static const char ladchar[]; + + static const char lasschar[]; + + static const int16 numtr = 2; /* current max no. of sprites */ + + static const bool a_thing = true; + static const bool a_person = false; /* for Thinkabout */ /* Magic/portal commands are */ - /*N*/ const int16 nix = 0; /* ignore it if this line is touched */ - /*B*/ const int16 bounces = 1; /* bounce off this line. Not valid for portals. */ - /*E*/ const int16 exclaim = 2; /* put up a chain of scrolls */ - /*T*/ const int16 transport = 3; /* enter new room */ - /*U*/ const int16 unfinished = 4; /* unfinished connection */ - /*S*/ const int16 special = 5; /* special function. */ - /*O*/ const int16 mopendoor = 6; /* opening door. */ + /*N*/ static const int16 nix = 0; /* ignore it if this line is touched */ + /*B*/ static const int16 bounces = 1; /* bounce off this line. Not valid for portals. */ + /*E*/ static const int16 exclaim = 2; /* put up a chain of scrolls */ + /*T*/ static const int16 transport = 3; /* enter new room */ + /*U*/ static const int16 unfinished = 4; /* unfinished connection */ + /*S*/ static const int16 special = 5; /* special function. */ + /*O*/ static const int16 mopendoor = 6; /* opening door. */ - /* These following constants should be included in CFG when it's written. */ + /* These following static constants should be included in CFG when it's written. */ - const bool slow_computer = false; /* stops walking when mouse touches toolbar */ + static const bool slow_computer = false; /* stops walking when mouse touches toolbar */ /* --- */ - const int16 border = 1; /* size of border on shadowboxes */ + static const int16 border = 1; /* size of border on shadowboxes */ - const int32 pagetop = 81920; + static const int32 pagetop = 81920; - const int16 up = 0; - const int16 right = 1; - const int16 down = 2; - const int16 left = 3; - const int16 ur = 4; - const int16 dr = 5; - const int16 dl = 6; - const int16 ul = 7; - const int16 stopped = 8; + static const int16 up = 0; + static const int16 right = 1; + static const int16 down = 2; + static const int16 left = 3; + static const int16 ur = 4; + static const int16 dr = 5; + static const int16 dl = 6; + static const int16 ul = 7; + static const int16 stopped = 8; - const int16 walk = 3; - const int16 run = 5; + static const int16 walk = 3; + static const int16 run = 5; /* Art gallery at 2,1; notice about this at 2,2. */ - const int32 catamap[8][8] = { - /* Geida's room */ - /* 1 2 3 | 4 5 6 7 8*/ - {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, - {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, - {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, - {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, /* >> Oubliette */ - {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, - {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, - {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, /* <<< In here */ - {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} - }; - /* vv Stairs trap. */ + static const int32 catamap[8][8]; /* Explanation: $NSEW. - Nibble N: North. + Nibble N: North. 0 = no connection, 2 = (left,) middle(, right) door with left-hand handle, 5 = (left,) middle(, right) door with right-hand handle, @@ -519,11 +421,11 @@ namespace Avalanche { E = no connection + TORCH, F = recessed door (to Geida's room.) - Nibble S: South. + Nibble S: South. 0 = no connection, 1,2,3 = left, middle, right door. - Nibble E: East. + Nibble E: East. 0 = no connection (wall), 1 = no connection (wall + window), 2 = wall with door, @@ -532,7 +434,7 @@ namespace Avalanche { 7 = wall with door and candles, F = straight-through corridor. - Nibble W: West. + Nibble W: West. 0 = no connection (wall), 1 = no connection (wall + shield), 2 = wall with door, @@ -543,86 +445,42 @@ namespace Avalanche { 7 = wall with door and candles, F = straight-through corridor. */ - const bool demo = false; /* If this is true, we're in a demo of the game. */ + static const bool demo = false; /* If this is true, we're in a demo of the game. */ - const char spludwick_order[3] = {onion, ink, mushroom}; + static const char spludwick_order[3]; - const quasiped_type quasipeds[16] = { - {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ - {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ - {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ - {3, black, 23, red, 177}, /* D: Hawk (screen 23). */ - {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ - {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ - {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ - {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ - {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ - {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ - {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ - {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ - {3, white, 27, red, 177}, /* M: Avaroid (screen 27). */ - {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ - {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ - {2, lightgreen, 51, darkgray, pdrduck} - }; /*P: Duck (screen 51). */ - - const int16 lower = 0; - const int16 same = 1; - const int16 higher = 2; - - const char keys[] = "QWERTYUIOP[]"; - const uint16 notes[12] = - {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; - - const tunetype tune = { - higher, higher, lower, same, higher, higher, lower, higher, higher, higher, - lower, higher, higher, - same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, - lower, same, lower, higher, same, lower, higher - }; + static const quasiped_type quasipeds[16]; + + static const int16 lower = 0; + static const int16 same = 1; + static const int16 higher = 2; + + static const char keys[]; + static const uint16 notes[12]; + + static const tunetype tune; /* special run-time errors */ - const int16 runerr_getset_overflow = 50; + static const int16 runerr_getset_overflow = 50; + + static const byte static_const_whereis[29]; + - ///////////////////////////// VARIABLES ///////////////////////////// - byte interrogation = 0; + + + byte interrogation; /* If this is greater than zero, the next line you type is stored in - the DNA in a position dictated by the value. If a scroll comes up, - or you leave the room, it's automatically set to zero. */ - - byte whereis[29] = { - /* The Lads */ - r__yours, /* Avvy */ - r__spludwicks, /* Spludwick */ - r__outsideyours, /* Crapulus */ - r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - r__argentpub, /* Malagauche */ - r__robins, /* Friar Tuck. */ - 177, /* Robin Hood - can't meet him at the start. */ - r__brummieroad, /* Cwytalot */ - r__lustiesroom, /* Baron du Lustie. */ - r__outsidecardiffcastle, /* The Duke of Cardiff. */ - r__argentpub, /* Dogfood */ - r__outsideducks, /* Trader */ - r__argentpub, /* Ibythneth */ - r__aylesoffice, /* Ayles */ - r__nottspub, /* Port */ - r__nottspub, /* Spurge */ - r__musicroom, /* Jacques */ - 0, 0, 0, 0, 0, 0, 0, 0, - /* The Lasses */ - r__yours, /* Arkata */ - r__geidas, /* Geida */ - 177, /* nobody allocated here! */ - r__wisewomans - }; /* The Wise Woman. */ - - bool oncandopageswap = true; - /* Variable constant for overriding the ability of On to switch pages. - * You may know better than On which page to switch to. */ + the DNA in a position dictated by the value. If a scroll comes up, + or you leave the room, it's automatically set to zero. */ + + byte whereis[29]; + + bool oncandopageswap; + /* Variable static constant for overriding the ability of On to switch pages. + * You may know better than On which page to switch to. */ @@ -757,8 +615,9 @@ namespace Avalanche { bool use_joy_a; + Gyro(); - ///////////////////////////// FUNCTIONS ///////////////////////////// + void Gyro::setParent(AvalancheEngine *vm); void newpointer(byte m); @@ -830,9 +689,24 @@ namespace Avalanche { bool mouse_near_text(); +private: + AvalancheEngine *_vm; + + static const Common::String things[numobjs]; + + static const char thingchar[]; + + static const Common::String better[numobjs]; + + static const char betterchar[]; + + void shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); + + void setminmaxhorzcurspos(uint16 min, uint16 max); + void setminmaxvertcurspos(uint16 min, uint16 max); - } // End of namespace Gyro +}; } // End of namespace Avalanche From c2d3c5fcf80ea88693e7090ab7b5644bd3690a83 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 12:12:27 +0200 Subject: [PATCH 0044/1332] AVALANCHE: Enhanced: Replace namespace with class. --- engines/avalanche/enhanced2.cpp | 46 +++++++++++++++------------------ engines/avalanche/enhanced2.h | 8 +++--- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp index 7a9a58f50dd9..2ee3f3d0aa07 100644 --- a/engines/avalanche/enhanced2.cpp +++ b/engines/avalanche/enhanced2.cpp @@ -31,31 +31,27 @@ namespace Avalanche { - namespace Enhanced { - - bool isenh() { - warning("STUB: Enhanced::isenh()"); - return true; - } - - void readkeye() { - warning("STUB: Enhanced::readkeye()"); - } - - bool keypressede() { - /* - function fancystuff:boolean; - inline( $B4/ $11/ { MOV AH,11 } - $CD/ $16/ { INT 16 } - $B8/ $00/ $00/ { MOV AX, 0000 } - $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } - $40); { INC AX } - */ - - warning("STUB: Enhanced::keypressede()"); - return true; - } +bool Enhanced::isenh() { + warning("STUB: Enhanced::isenh()"); + return true; +} + +void Enhanced::readkeye() { + warning("STUB: Enhanced::readkeye()"); +} - } // End of namespace Enhanced +bool Enhanced::keypressede() { +/* + function fancystuff:boolean; + inline( $B4/ $11/ { MOV AH,11 } + $CD/ $16/ { INT 16 } + $B8/ $00/ $00/ { MOV AX, 0000 } + $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } + $40); { INC AX } +*/ + + warning("STUB: Enhanced::keypressede()"); + return true; +} } // End of namespace Avalanche diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index 98ef781213d1..2ba42e006f9e 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -36,8 +36,8 @@ namespace Avalanche { - namespace Enhanced { - +class Enhanced { +public: byte shiftstate; /*ABSOLUTE $40:$17;*/ bool atbios; // BIOS type char inchar, extd; @@ -45,8 +45,10 @@ namespace Avalanche { void readkeye(); bool keypressede(); +private: + bool isenh(); - } // End of namespace Enhanced +}; } // End of namespace Avalanche From 83982503871a042aa113102449f7a6cc8d77aa6c Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 12:26:01 +0200 Subject: [PATCH 0045/1332] AVALANCHE: Repair Enhanced and Gyro. --- engines/avalanche/enhanced2.cpp | 5 +++++ engines/avalanche/enhanced2.h | 5 +++++ engines/avalanche/gyro2.h | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp index 2ee3f3d0aa07..99ddfb43408a 100644 --- a/engines/avalanche/enhanced2.cpp +++ b/engines/avalanche/enhanced2.cpp @@ -31,6 +31,11 @@ namespace Avalanche { +void Enhanced::setParent(AvalancheEngine *vm) { + _vm = vm; +} + + bool Enhanced::isenh() { warning("STUB: Enhanced::isenh()"); return true; diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index 2ba42e006f9e..8dd88a6e9309 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -35,13 +35,18 @@ #include "common/system.h" namespace Avalanche { +class AvalancheEngine; class Enhanced { public: + AvalancheEngine *_vm; + byte shiftstate; /*ABSOLUTE $40:$17;*/ bool atbios; // BIOS type char inchar, extd; + void setParent(AvalancheEngine *vm); + void readkeye(); bool keypressede(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index ecea597c8e5a..c2f6fd7f9be6 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -33,11 +33,13 @@ #include "common/system.h" #include "common/str.h" #include "common/scummsys.h" -#include "avalanche/avalanche.h" + #include "avalanche/roomnums.h" #include "avalanche/color.h" namespace Avalanche { +class AvalancheEngine; + static const char numobjs = 18; /* always preface with a # */ static const int16 maxobjs = 12; /* carry limit */ @@ -617,7 +619,7 @@ class Gyro { Gyro(); - void Gyro::setParent(AvalancheEngine *vm); + void setParent(AvalancheEngine *vm); void newpointer(byte m); From dd40c1896b72e5ed337afbb143184028cc287dda Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 12:27:14 +0200 Subject: [PATCH 0046/1332] AVALANCHE: Instantiate finished classes in the engine. --- engines/avalanche/avalanche.cpp | 3 +++ engines/avalanche/avalanche.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b9b1b0f5819a..a230cf059fc6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -46,6 +46,9 @@ namespace Avalanche { _system = syst; _console = new AvalancheConsole(this); _rnd = 0; + + _gyro.setParent(this); + _enhanced.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index fa87d8b60a42..190849e50ca5 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -29,6 +29,8 @@ #define AVALANCHE_H #include "avalanche/console.h" +#include "avalanche/gyro2.h" +#include "avalanche/enhanced2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -45,6 +47,10 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: + Gyro _gyro; + Enhanced _enhanced; + + AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); From b7ef84983e2b645ee04aed3079c577295d339631 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:22:04 +0200 Subject: [PATCH 0047/1332] AVALANCHE: Pingo: replace namespace with class. --- engines/avalanche/pingo2.cpp | 142 +++++++++++++++++------------------ engines/avalanche/pingo2.h | 16 +++- 2 files changed, 84 insertions(+), 74 deletions(-) diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 1311c65b5634..fa2e96ff0214 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -27,88 +27,86 @@ /* PINGO Full-screen sub-parts of the game. */ +#include "avalanche/avalanche.h" + #include "avalanche/pingo2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" -#include "avalanche/scrolls2.h" +//#include "avalanche/scrolls2.h" -#include "common/textconsole.h" -namespace Avalanche { - namespace Pingo { +#include "common/textconsole.h" - void dplot(int16 x, int16 y, Common::String z) { - warning("STUB: Pingo::dplot()"); - } +namespace Avalanche { - void bosskey() { - /*const - months : array[0..11] of char = 'JFMAMJJASOND'; - title = 'Net Profits'; - fish = #224; { } - var fv:byte; gd,gm:int16; r:char; +void Pingo::dplot(int16 x, int16 y, Common::String z) { + warning("STUB: Pingo::dplot()"); +} + +void Pingo::bosskey() { +/*const + months : array[0..11] of char = 'JFMAMJJASOND'; + title = 'Net Profits'; + fish = #224; { } +var fv:byte; gd,gm:int16; r:char; +begin; + dusk; delavvy; + setactivepage(3); mousepage(3); setvisualpage(3); off; + cleardevice; setfillstyle(xhatchfill,11); + settextstyle(1,0,4); settextjustify(1,1); + dplot(320,10,title); + settextstyle(1,0,0); setusercharsize(4,3,7,12); + for fv:=0 to 11 do + begin; + dplot(26+fv*52,187,months[fv]); + bar(fv*52,177-fv*14,51+fv*52,180); + rectangle(fv*52,177-fv*14,51+fv*52,180); + end; + settextstyle(0,0,1); + for fv:=1 to 177 do begin; - dusk; delavvy; - setactivepage(3); mousepage(3); setvisualpage(3); off; - cleardevice; setfillstyle(xhatchfill,11); - settextstyle(1,0,4); settextjustify(1,1); - dplot(320,10,title); - settextstyle(1,0,0); setusercharsize(4,3,7,12); - for fv:=0 to 11 do - begin; - dplot(26+fv*52,187,months[fv]); - bar(fv*52,177-fv*14,51+fv*52,180); - rectangle(fv*52,177-fv*14,51+fv*52,180); - end; - settextstyle(0,0,1); - for fv:=1 to 177 do - begin; - gd:=random(630); gm:=random(160)+30; - setcolor(lightred); outtextxy(gd ,gm ,fish); - setcolor(yellow); outtextxy(gd+1,gm-1,fish); - end; - newpointer(6); { TTHand } - dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; - while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); - dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; - copy02;*/ - - warning("STUB: Pingo::bosskey()"); - } - - void copy02() { /* taken from Wobble (below) */ - warning("STUB: Pingo::copy02()"); - } - - void copy03() { /* taken from Wobble (below) */ - warning("STUB: Pingo::copy03()"); - } - - void copypage(byte frp, byte top) { /* taken from Copy02 (above) */ - warning("STUB: Pingo::copypage()"); - } - - void wobble() { - warning("STUB: Pingo::wobble()"); - } - - void zonk(); - - static void zl(int16 x1, int16 y1, int16 x2, int16 y2) { - warning("STUB: Pingo::zl()"); - } - - void zonk() { - warning("STUB: Pingo::zonk()"); - } - - void winning_pic() { - warning("STUB: Pingo::winning_pic()"); - } - - } // End of namespace Pingo. + gd:=random(630); gm:=random(160)+30; + setcolor(lightred); outtextxy(gd ,gm ,fish); + setcolor(yellow); outtextxy(gd+1,gm-1,fish); + end; + newpointer(6); { TTHand } + dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; + while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); + dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; + copy02;*/ + + warning("STUB: Pingo::bosskey()"); +} + +void Pingo::copy02() { /* taken from Wobble (below) */ + warning("STUB: Pingo::copy02()"); +} + +void Pingo::copy03() { /* taken from Wobble (below) */ + warning("STUB: Pingo::copy03()"); +} + +void Pingo::copypage(byte frp, byte top) { /* taken from Copy02 (above) */ + warning("STUB: Pingo::copypage()"); +} + +void Pingo::wobble() { + warning("STUB: Pingo::wobble()"); +} + +void Pingo::zl(int16 x1, int16 y1, int16 x2, int16 y2) { + warning("STUB: Pingo::zl()"); +} + +void Pingo::zonk() { + warning("STUB: Pingo::zonk()"); +} + +void Pingo::winning_pic() { + warning("STUB: Pingo::winning_pic()"); +} } // End of namespace Avalanche. diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index 10b9511f5e11..135bb10c209e 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -31,11 +31,17 @@ #define PINGO2_H #include "common/scummsys.h" +#include "common/str.h" + + namespace Avalanche { +class AvalancheEngine; - namespace Pingo { +class Pingo { +public: + void setParent(AvalancheEngine *vm); void bosskey(); @@ -51,7 +57,13 @@ namespace Avalanche { void winning_pic(); - } // End of namespace Pingo. +private: + AvalancheEngine *_vm; + + void dplot(int16 x, int16 y, Common::String z); + + void zl(int16 x1, int16 y1, int16 x2, int16 y2); +}; } // End of namespace Avalanche. From e4c8d82f9d13709f81fa865d62a2386c82760bbc Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:41:02 +0200 Subject: [PATCH 0048/1332] AVALANCHE: Scrolls: replace namespace with class. --- engines/avalanche/scrolls2.cpp | 336 ++++++++++++++++----------------- engines/avalanche/scrolls2.h | 51 ++++- 2 files changed, 207 insertions(+), 180 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 57c15a2b8f8c..a577483463f4 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +#include "avalanche/avalanche.h" + #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" #include "avalanche/logger2.h" @@ -41,211 +43,203 @@ namespace Avalanche { - namespace Scrolls { +const int16 Scrolls::roman = 0; +const int16 Scrolls::italic = 1; - const int16 roman = 0; - const int16 italic = 1; +const int16 Scrolls::halficonwidth = 19; /* Half the width of an icon. */ - const int16 halficonwidth = 19; /* Half the width of an icon. */ - int16 dix, diy; - Gyro::raw ch[2]; - byte cfont; /* Current font */ - int16 dodgex, dodgey; - byte param; /* For using arguments code */ +Scrolls::Scrolls() : aboutscroll(false) { +} - byte use_icon; +void Scrolls::setParent(AvalancheEngine *vm) { + _vm = vm; +} - void initialize_scrolls() { - warning("STUB: Scrolls::initialize_scrolls()"); - } +void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ + byte page_; - void state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - - if (Gyro::ledstatus == x) return; /* Already like that! */ - - warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); - //switch (x) { - //case 0: - // setfillstyle(1, black); - // break; /* Off */ - //case 1: - // setfillstyle(9, green); - // break; /* Half-on (menus) */ - //case 2: - // setfillstyle(1, green); - // break; /* On (kbd) */ - //case 3: - // setfillstyle(6, green); - // break; /* Hit a key */ - //} - - Gyro::super_off(); - - /* for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - bar(419, 195, 438, 197); - }*/ - - Gyro::super_on(); - Gyro::ledstatus = x; - } + if (_vm->_gyro.ledstatus == x) return; /* Already like that! */ - void easteregg() { - uint16 fv, ff; + warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); + //switch (x) { + //case 0: + // setfillstyle(1, black); + // break; /* Off */ + //case 1: + // setfillstyle(9, green); + // break; /* Half-on (menus) */ + //case 2: + // setfillstyle(1, green); + // break; /* On (kbd) */ + //case 3: + // setfillstyle(6, green); + // break; /* Hit a key */ + //} - warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); + _vm->_gyro.super_off(); - /* background(15); - for (fv = 4; fv <= 100; fv ++) - for (ff = 0; ff <= 70; ff ++) { - sound(fv * 100 + ff * 10); - delay(1); - } - nosound; - setcolor(10); - settextstyle(0, 0, 3); - settextjustify(1, 1); - outtextxy(320, 100, "GIED"); - settextstyle(0, 0, 1); - settextjustify(0, 2);*/ - - Gyro::background(0); - } + /* for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + bar(419, 195, 438, 197); + }*/ - void say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - const int16 locol = 2; - byte xx, yy, ox, bit, lz, t; - int16 yp; - bool offset; - byte itw[12][80]; - - offset = x % 8 == 4; - x = x / 8; - lz = z.size(); - ox = 0; - Logger::log_scrollline(); - - for (xx = 1; xx <= lz; xx ++) { - switch (z[xx]) { - case '\22': { - cfont = roman; - Logger::log_roman(); - } - break; - case '\6': { - cfont = italic; - Logger::log_italic(); - } - break; - default: { - ox += 1; - for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; - Logger::log_scrollchar(Common::String(z[xx])); - } - } + _vm->_gyro.super_on(); + _vm->_gyro.ledstatus = x; +} + +void Scrolls::easteregg() { + uint16 fv, ff; + + warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); + + /* background(15); + for (fv = 4; fv <= 100; fv ++) + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } + nosound; + setcolor(10); + settextstyle(0, 0, 3); + settextjustify(1, 1); + outtextxy(320, 100, "GIED"); + settextstyle(0, 0, 1); + settextjustify(0, 2);*/ + + _vm->_gyro.background(0); +} + +void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ + const int16 locol = 2; + byte xx, yy, ox, bit, lz, t; + int16 yp; + bool offset; + byte itw[12][80]; + + offset = x % 8 == 4; + x = x / 8; + lz = z.size(); + ox = 0; + _vm->_logger.log_scrollline(); + + for (xx = 1; xx <= lz; xx ++) { + switch (z[xx]) { + case '\22': { + cfont = roman; + _vm->_logger.log_roman(); + } + break; + case '\6': { + cfont = italic; + _vm->_logger.log_italic(); + } + break; + default: { + ox += 1; + for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; + _vm->_logger.log_scrollchar(Common::String(z[xx])); + } } + } - lz = ox; - if (offset) { - /* offsetting routine */ - lz += 1; - for (yy = 1; yy <= 12; yy ++) { - bit = 240; - itw[yy][lz] = 255; - for (xx = 1; xx <= lz; xx ++) { - t = itw[yy][xx]; - itw[yy][xx] = bit + t / 16; - bit = t << 4; - } + lz = ox; + if (offset) { + /* offsetting routine */ + lz += 1; + for (yy = 1; yy <= 12; yy ++) { + bit = 240; + itw[yy][lz] = 255; + for (xx = 1; xx <= lz; xx ++) { + t = itw[yy][xx]; + itw[yy][xx] = bit + t / 16; + bit = t << 4; } } - yp = x + y * 80 + (1 - Gyro::cp) * Gyro::pagetop; - for (yy = 1; yy <= 12; yy ++) { - yp += 80; - for (bit = 0; bit <= locol; bit ++) { - /*port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(itw[yy], mem[0xa000 * yp], lz); + } + yp = x + y * 80 + (1 - _vm->_gyro.cp) * _vm->_gyro.pagetop; + for (yy = 1; yy <= 12; yy ++) { + yp += 80; + for (bit = 0; bit <= locol; bit ++) { + /*port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(itw[yy], mem[0xa000 * yp], lz); - Some old Pascal-ish. To be removed. */ + Some old Pascal-ish. To be removed. */ - warning("STUB: Scrolls::say()"); - } + warning("STUB: Scrolls::say()"); } - } - /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ +} - void normscroll() { - warning("STUB: Scrolls::normscroll()"); - } +/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ - void dialogue() { - warning("STUB: Scrolls::dialogue()"); - } +void Scrolls::normscroll() { + warning("STUB: Scrolls::normscroll()"); +} - void music_scroll(); +void Scrolls::dialogue() { + warning("STUB: Scrolls::dialogue()"); +} - static void store_(byte what, Gyro::tunetype &played) { - memcpy(played, played+1, sizeof(played) - 1); - played[30] = what; - } +void Scrolls::store_(byte what, tunetype &played) { + memcpy(played, played+1, sizeof(played) - 1); + played[30] = what; +} - static bool they_match(Gyro::tunetype &played) { - byte fv, mistakes; - bool they_match_result; - mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != Gyro::tune[fv]) { - mistakes++; - } +bool Scrolls::they_match(tunetype &played) { + byte fv, mistakes; - they_match_result = mistakes < 5; - return they_match_result; - } + bool they_match_result; + mistakes = 0; - void music_scroll() { - char r; - byte value; - - byte last_one, this_one; - - Gyro::tunetype played; - - - state(3); - Gyro::seescroll = true; - Gyro::on(); - Gyro::newpointer(4); - //do { - //do { - // Gyro::check(); /* was "checkclick;" */ - // if (Enhanced::keypressede()) break; - //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); - // - // Needs joystick - not sure it will be implemented. - - //if (Gyro::mpress == 0) { - // inkey(); Needs Lucerna to proceed. - // - //} - //} - - } + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != Gyro::tune[fv]) { + mistakes++; + } + + they_match_result = mistakes < 5; + return they_match_result; +} + +void Scrolls::music_scroll() { + char r; + byte value; + + byte last_one, this_one; + + tunetype played; + + + state(3); + _vm->_gyro.seescroll = true; + _vm->_gyro.on(); + _vm->_gyro.newpointer(4); + //do { + //do { + // Gyro::check(); /* was "checkclick;" */ + // if (Enhanced::keypressede()) break; + //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); + // + // Needs joystick - not sure it will be implemented. + //if (Gyro::mpress == 0) { + // inkey(); Needs Lucerna to proceed. + // + //} + //} +} @@ -255,8 +249,6 @@ namespace Avalanche { - - } // End of namespace Scrolls } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 07038335bd2c..914e463f3f45 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -34,20 +34,23 @@ // #include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... namespace Avalanche { +class AvalancheEngine; - namespace Scrolls { +class Scrolls { +public: + bool aboutscroll; /* Is this the about box? */ - // Call it where Scrolls are first used. - // Procuded to replace the initizalization part of the original Pascal unit. - void initialize_scrolls(); - const bool aboutscroll = false; /* Is this the about box? */ + + Scrolls(); + + void setParent(AvalancheEngine *vm); void state(byte x); /* Sets "Ready" light to whatever */ - void drawscroll(Gyro::proc gotoit); /* This is one of the oldest procs in the game. */ + void drawscroll(proc gotoit); /* This is one of the oldest procs in the game. */ - void bubble(Gyro::proc gotoit); + void bubble(proc gotoit); void resetscroll(); @@ -65,7 +68,39 @@ namespace Avalanche { void musical_scroll(); - } // End of namespace Scrolls +private: + AvalancheEngine *_vm; + + static const int16 roman; + static const int16 italic; + + static const int16 halficonwidth; /* Half the width of an icon. */ + + int16 dix, diy; + raw ch[2]; + byte cfont; /* Current font */ + + int16 dodgex, dodgey; + byte param; /* For using arguments code */ + + byte use_icon; + + void easteregg(); + + void say(int16 x, int16 y, Common::String z); + + void normscroll(); + + void dialogue(); + + void store_(byte what, tunetype &played); + + bool they_match(tunetype &played); + + void music_scroll(); + + +}; } // End of namespace Avalanche From 140e20522711d414bf09898fe533c704c41c4442 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:42:30 +0200 Subject: [PATCH 0049/1332] AVALANCHE: Update the main class. --- engines/avalanche/avalanche.cpp | 3 +++ engines/avalanche/avalanche.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a230cf059fc6..6179ae4f1e66 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -49,6 +49,9 @@ namespace Avalanche { _gyro.setParent(this); _enhanced.setParent(this); + _logger.setParent(this); + _pingo.setParent(this); + _scrolls.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 190849e50ca5..59dd0090e438 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -31,6 +31,9 @@ #include "avalanche/console.h" #include "avalanche/gyro2.h" #include "avalanche/enhanced2.h" +#include "avalanche/logger2.h" +#include "avalanche/pingo2.h" +#include "avalanche/scrolls2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -49,6 +52,9 @@ class AvalancheEngine : public Engine { public: Gyro _gyro; Enhanced _enhanced; + Logger _logger; + Pingo _pingo; + Scrolls _scrolls; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); From 612582f016f84efb9835d4ff31e0d2d51ba581ca Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:43:31 +0200 Subject: [PATCH 0050/1332] AVALANCHE: Repair Pingo. --- engines/avalanche/pingo2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index fa2e96ff0214..b2f8e83886fa 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -36,12 +36,14 @@ #include "avalanche/trip6.h" //#include "avalanche/scrolls2.h" - - #include "common/textconsole.h" namespace Avalanche { +void Pingo::setParent(AvalancheEngine *vm) { + _vm = vm; +} + void Pingo::dplot(int16 x, int16 y, Common::String z) { warning("STUB: Pingo::dplot()"); } From 44a9dd20832b50ba8a9a3e2f2099977a5c8de325 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:53:15 +0200 Subject: [PATCH 0051/1332] AVALANCHE: Visa: replace namespace with class. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 ++ engines/avalanche/visa2.cpp | 34 +++++++++++++++++---------------- engines/avalanche/visa2.h | 22 +++++++++++++++++++-- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6179ae4f1e66..f72c12c4fea2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -52,6 +52,7 @@ namespace Avalanche { _logger.setParent(this); _pingo.setParent(this); _scrolls.setParent(this); + _visa.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 59dd0090e438..14d2f4e1476c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -34,6 +34,7 @@ #include "avalanche/logger2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" +#include "avalanche/visa2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -55,6 +56,7 @@ class AvalancheEngine : public Engine { Logger _logger; Pingo _pingo; Scrolls _scrolls; + Visa _visa; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index ee1f761ff9de..a14367a6a82d 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -25,6 +25,10 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* VISA The new Sez handler. (Replaces Access.) */ + +#include "avalanche/avalanche.h" + #include "avalanche/visa2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" @@ -37,40 +41,38 @@ namespace Avalanche { - namespace Visa { - - const bool bubbling = false; - const bool report_dixi_errors = true; + void Visa::setParent(AvalancheEngine *vm) { + _vm = vm; + } - bool went_ok; + const bool Visa::bubbling = false; + const bool Visa::report_dixi_errors = true; - void unskrimble() { - for (uint16 fv = 0; fv < Gyro::bufsize; fv++) - Gyro::buffer[fv] = (char)((!(Gyro::buffer[fv]) - fv) % 256); + void Visa::unskrimble() { + for (uint16 fv = 0; fv < _vm->_gyro.bufsize; fv++) + _vm->_gyro.buffer[fv] = (char)((!(_vm->_gyro.buffer[fv]) - fv) % 256); } - void do_the_bubble() { - Gyro::bufsize++; - Gyro::buffer[Gyro::bufsize] = 2; + void Visa::do_the_bubble() { + _vm->_gyro.bufsize++; + _vm->_gyro.buffer[_vm->_gyro.bufsize] = 2; } // File handling. - void dixi(char block, byte point) { + void Visa::dixi(char block, byte point) { warning("STUB: Visa::dixi()"); } // File handling. - void speech(byte who, byte subject) { + void Visa::speech(byte who, byte subject) { warning("STUB: Visa::speech()"); } - void talkto(byte whom) { + void Visa::talkto(byte whom) { byte fv; bool no_matches; warning("STUB: Visa::talkto()"); } - } // End of namespace Visa. - } // End of namespace Avalanche. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index feda7b60fd5a..6749a1dbbda8 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -25,20 +25,38 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* VISA The new Sez handler. (Replaces Access.) */ + #ifndef VISA2_H #define VISA2_H #include "common/scummsys.h" namespace Avalanche { +class AvalancheEngine; - namespace Visa { +class Visa { +public: + void Visa::setParent(AvalancheEngine *vm); void dixi(char block, byte point); void talkto(byte whom); - } // End of namespace Visa. +private: + AvalancheEngine *_vm; + + static const bool bubbling; + static const bool report_dixi_errors; + + bool went_ok; + + void unskrimble(); + + void do_the_bubble(); + + void speech(byte who, byte subject); +}; } // End of namespace Avalanche. From 7623ea79fe1db5c505e03459977e8ea38ffbc03c Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 17:58:22 +0200 Subject: [PATCH 0052/1332] AVALANCHE: Celer: replace namespace with class. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/celer2.cpp | 541 ++++++++++++++++---------------- engines/avalanche/celer2.h | 70 +++-- 4 files changed, 317 insertions(+), 297 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f72c12c4fea2..e17f1ee9bc1f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -53,6 +53,7 @@ namespace Avalanche { _pingo.setParent(this); _scrolls.setParent(this); _visa.setParent(this); + _lucerna.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 14d2f4e1476c..e0f544c73bad 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -35,6 +35,7 @@ #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" +#include "avalanche/lucerna2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -57,6 +58,7 @@ class AvalancheEngine : public Engine { Pingo _pingo; Scrolls _scrolls; Visa _visa; + Lucerna _lucerna; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 6efabea0410d..2e6ce5a9edbd 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -29,369 +29,368 @@ #include "avalanche/celer2.h" #include "common/textconsole.h" -//#include "avalanche/trip6.h" +#include "avalanche/trip6.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/roomnums.h" +#include "avalanche/avalanche.h" namespace Avalanche { - namespace Celer { +const int16 Celer::on_disk = -1; - //untyped_file f; /* Private variable- not accessible from elsewhere. */ - const int16 on_disk = -1; /* Value of memos[fv].x when it's not in memory. */ +Celer::Celer() { + num_chunks = 0; +} - void pics_link() { - byte xx; +void Celer::setParent(AvalancheEngine *vm) { + _vm = vm; +} - if (Gyro::ddmnow) return; /* No animation when the menus are up. */ +void Celer::pics_link() { + byte xx; - { - Gyro::dnatype &with = Gyro::dna; - switch (with.room) { + if (_vm->_gyro.ddmnow) return; /* No animation when the menus are up. */ - case r__outsideargentpub: { - if ((Gyro::roomtime % int32(12)) == 0) - show_one(int32(1) + (Gyro::roomtime / int32(12)) % int32(4)); - } - break; + { + switch (_vm->_gyro.dna.room) { - case r__brummieroad: - if ((Gyro::roomtime % int32(2)) == 0) - show_one(int32(1) + (Gyro::roomtime / int32(2)) % int32(4)); - break; + case r__outsideargentpub: { + if ((_vm->_gyro.roomtime % int32(12)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); + } + break; - case r__bridge: - if ((Gyro::roomtime % int32(2)) == 0) - show_one(int32(4) + (Gyro::roomtime / int32(2)) % int32(4)); - break; + case r__brummieroad: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + break; - case r__yours: - if ((! with.avvy_is_awake) && ((Gyro::roomtime % int32(4)) == 0)) - show_one(int32(1) + (Gyro::roomtime / int32(12)) % int32(2)); - break; + case r__bridge: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + break; - case r__argentpub: { - if (((Gyro::roomtime % int32(7)) == 1) && (Gyro::dna.malagauche != 177)) { - /* Malagauche cycle */ - Gyro::dna.malagauche += 1; - switch (Gyro::dna.malagauche) { - case 1: - case 11: - case 21: - show_one(12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(11); - break; /* Looks at you. */ - case 30: - show_one(13); - break; /* Winks. */ - case 33: - Gyro::dna.malagauche = 0; - break; - } - } + case r__yours: + if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); + break; - switch (Gyro::roomtime % 200) { - case 179: - case 197: - show_one(5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(6); - break; - case 185: - show_one(7); + case r__argentpub: { + if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { + /* Malagauche cycle */ + _vm->_gyro.dna.malagauche += 1; + switch (_vm->_gyro.dna.malagauche) { + case 1: + case 11: + case 21: + show_one(12); + break; /* Looks forwards. */ + case 8: + case 18: + case 28: + case 32: + show_one(11); + break; /* Looks at you. */ + case 30: + show_one(13); + break; /* Winks. */ + case 33: + _vm->_gyro.dna.malagauche = 0; break; - case 199: - Gyro::dna.dogfoodpos = 177; - break; /* Impossible value for this. */ } - - if ((Gyro::roomtime % 200 >= 0) && (Gyro::roomtime % 200 <= 178)) { /* Normally. */ - if (((Lucerna::bearing(2) >= 1) && (Lucerna::bearing(2) <= 90)) || ((Lucerna::bearing(2) >= 358) && (Lucerna::bearing(2) <= 360))) - xx = 3; - else if ((Lucerna::bearing(2) >= 293) && (Lucerna::bearing(2) <= 357)) - xx = 2; - else if ((Lucerna::bearing(2) >= 271) && (Lucerna::bearing(2) <= 292)) - xx = 4; - - if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - Gyro::dna.dogfoodpos = xx; - } - } - } - break; - case r__westhall: - if ((Gyro::roomtime % int32(3)) == 0) - switch ((Gyro::roomtime / int32(3)) % int32(6)) { - case 4: - show_one(1); - break; - case 1: - case 3: - case 5: - show_one(2); - break; - case 0: - case 2: - show_one(3); - break; - } + switch (_vm->_gyro.roomtime % 200) { + case 179: + case 197: + show_one(5); + break; /* Dogfood's drinking cycle */ + case 182: + case 194: + show_one(6); break; - - case r__lustiesroom: - if (!(Gyro::dna.lustie_is_asleep)) { - if ((Gyro::roomtime % int32(45)) > 42) - xx = 4; /* du Lustie blinks */ - - /* Bearing of Avvy from du Lustie. */ - else if (((Lucerna::bearing(2) >= 0) && (Lucerna::bearing(2) <= 45)) || ((Lucerna::bearing(2) >= 315) && (Lucerna::bearing(2) <= 360))) - xx = 1; /* Middle. */ - else if ((Lucerna::bearing(2) >= 45) && (Lucerna::bearing(2) <= 180)) - xx = 2; /* Left. */ - else if ((Lucerna::bearing(2) >= 181) && (Lucerna::bearing(2) <= 314)) - xx = 3; /* Right. */ - - if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - } + case 185: + show_one(7); break; + case 199: + _vm->_gyro.dna.dogfoodpos = 177; + break; /* Impossible value for this. */ + } + + if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ + if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 3; + else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) + xx = 2; + else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) + xx = 4; - case r__aylesoffice: - if ((! Gyro::dna.ayles_is_awake) && (Gyro::roomtime % int32(14) == 0)) { - switch ((Gyro::roomtime / int32(14)) % int32(2)) { - case 0: - show_one(1); - break; /* Frame 2: EGA. */ - case 1: - show_one(3); - break; /* Frame 1: Natural. */ - } + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; } - break; + } + + } + break; - case r__robins: - if (Gyro::dna.tied_up) - switch (Gyro::roomtime % int32(54)) { - case 20: - show_one(4); - break; /* Frame 4: Avalot blinks. */ - case 23: - show_one(2); - break; /* Frame 1: Back to normal. */ - } - break; + case r__westhall: + if ((_vm->_gyro.roomtime % int32(3)) == 0) + switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { + case 4: + show_one(1); + break; + case 1: + case 3: + case 5: + show_one(2); + break; + case 0: + case 2: + show_one(3); + break; + } + break; - case r__nottspub: { - /* Bearing of Avvy from Port. */ - if (((Lucerna::bearing(5) >= 0) && (Lucerna::bearing(5) <= 45)) || ((Lucerna::bearing(5) >= 315) && (Lucerna::bearing(5) <= 360))) - xx = 2; /* Middle. */ - else if ((Lucerna::bearing(5) >= 45) && (Lucerna::bearing(5) <= 180)) - xx = 6; /* Left. */ - else if ((Lucerna::bearing(5) >= 181) && (Lucerna::bearing(5) <= 314)) - xx = 8; /* Right. */ + case r__lustiesroom: + if (!(_vm->_gyro.dna.lustie_is_asleep)) { + if ((_vm->_gyro.roomtime % int32(45)) > 42) + xx = 4; /* du Lustie blinks */ - if ((Gyro::roomtime % int32(60)) > 57) xx--; /* Blinks */ + /* Bearing of Avvy from du Lustie. */ + else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 1; /* Middle. */ + else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + xx = 2; /* Left. */ + else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + xx = 3; /* Right. */ - if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } + } + break; - switch (Gyro::roomtime % 50) { - case 45 : - show_one(9); - break; /* Spurge blinks */ - case 49 : - show_one(10); - break; + case r__aylesoffice: + if ((! _vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { + switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { + case 0: + show_one(1); + break; /* Frame 2: EGA. */ + case 1: + show_one(3); + break; /* Frame 1: Natural. */ } } break; - case r__ducks: { - if ((Gyro::roomtime % 3) == 0) /* The fire flickers */ - show_one(1 + (Gyro::roomtime / 3) % 3); + case r__robins: + if (_vm->_gyro.dna.tied_up) + switch (_vm->_gyro.roomtime % int32(54)) { + case 20: + show_one(4); + break; /* Frame 4: Avalot blinks. */ + case 23: + show_one(2); + break; /* Frame 1: Back to normal. */ + } + break; - {/* Lucerna::bearing of Avvy from Duck. */ - if (((Lucerna::bearing(2) >= 0) && (Lucerna::bearing(2) <= 45)) || ((Lucerna::bearing(2) >= 315) && (Lucerna::bearing(2) <= 360))) - xx = 4; /* Middle. */ - else if ((Lucerna::bearing(2) >= 45) && (Lucerna::bearing(2) <= 180)) - xx = 6; /* Left. */ - else if ((Lucerna::bearing(2) >= 181) && (Lucerna::bearing(2) <= 314)) - xx = 8; /* Right. */ + case r__nottspub: { + /* Bearing of Avvy from Port. */ + if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) + xx = 2; /* Middle. */ + else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) + xx = 8; /* Right. */ - if ((Gyro::roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ + if ((_vm->_gyro.roomtime % int32(60)) > 57) xx--; /* Blinks */ - if (xx != Gyro::dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - Gyro::dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } - break; + switch (_vm->_gyro.roomtime % 50) { + case 45 : + show_one(9); + break; /* Spurge blinks */ + case 49 : + show_one(10); + break; } } + break; - if ((Gyro::dna.ringing_bells) && (Gyro::flagset('B'))) - /* They're ringing the bells. */ - switch (Gyro::roomtime % int32(4)) { - case 1: { - Gyro::dnatype &with = Gyro::dna; + case r__ducks: { + if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ + show_one(1 + (_vm->_gyro.roomtime / 3) % 3); - if (with.nextbell < 5) with.nextbell = 12; - with.nextbell -= 1; - Gyro::note(Gyro::notes[with.nextbell]); - } - break; - case 2: - //nosound; - warning("STUB: Celer::pics_link()"); - break; + {/* _vm->_lucerna.bearing of Avvy from Duck. */ + if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 4; /* Middle. */ + else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + xx = 8; /* Right. */ + + if ((_vm->_gyro.roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ + + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } } - } + break; - void load_chunks(Common::String xx) { - warning("STUB: Celer::load_chunks()"); + } } - void forget_chunks() { - warning("STUB: Celer::forget_chunks()"); + if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) + /* They're ringing the bells. */ + switch (_vm->_gyro.roomtime % int32(4)) { + case 1: { + if (_vm->_gyro.dna.nextbell < 5) _vm->_gyro.dna.nextbell = 12; + _vm->_gyro.dna.nextbell -= 1; + _vm->_gyro.note(_vm->_gyro.notes[_vm->_gyro.dna.nextbell]); + } + break; + case 2: + //nosound; + warning("STUB: Celer::pics_link()"); + break; + } } +} - void mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) /* assembler; - asm - push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} - push bp; { Nor BP! } - +void Celer::load_chunks(Common::String xx) { + warning("STUB: Celer::load_chunks()"); +} - { DI holds the offset on this page. It starts at the top left-hand corner. } - { (It should equal ch.y*80+ch.x. } +void Celer::forget_chunks() { + warning("STUB: Celer::forget_chunks()"); +} - mov ax,y; - mov dl,80; - mul dl; { Line offset now calculated. } - mov di,ax; { Move it into DI. } - mov ax,x; - add di,ax; { Full offset now calculated. } +void Celer::mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) { /* assembler; +asm + push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} + push bp; { Nor BP! } - mov bx,yl; { No. of times to repeat lineloop. } - inc bx; { "loop" doesn't execute the zeroth time. } - mov bh,bl; { Put it into BH. } - { BP holds the length of the Common::String to copy. It's equal to ch.xl.} + { DI holds the offset on this page. It starts at the top left-hand corner. } + { (It should equal ch.y*80+ch.x. } - mov ax,uint16(p); { Data is held at DS:SI. } - mov si,ax; - mov ax,uint16(p+2); { This will be moved over into ds in just a tick... } + mov ax,y; + mov dl,80; + mul dl; { Line offset now calculated. } + mov di,ax; { Move it into DI. } + mov ax,x; + add di,ax; { Full offset now calculated. } - mov bp,xl; + mov bx,yl; { No. of times to repeat lineloop. } + inc bx; { "loop" doesn't execute the zeroth time. } + mov bh,bl; { Put it into BH. } - mov ds,ax; + { BP holds the length of the Common::String to copy. It's equal to ch.xl.} + mov ax,uint16(p); { Data is held at DS:SI. } + mov si,ax; + mov ax,uint16(p+2); { This will be moved over into ds in just a tick... } - cld; { We're allowed to hack around with the flags! } + mov bp,xl; - mov ax,$AC00; { Top of the first EGA page. } - mov es,ax; { Offset on this page is calculated below... } + mov ds,ax; - { port[$3c4]:=2; port[$3ce]:=4; } + cld; { We're allowed to hack around with the flags! } - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; + mov ax,$AC00; { Top of the first EGA page. } + mov es,ax; { Offset on this page is calculated below... } - mov cx,4; { This loop executes for 3, 2, 1, and 0. } - mov bl,0; +{ port[$3c4]:=2; port[$3ce]:=4; } - @mainloop: + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; - push di; - push cx; + mov cx,4; { This loop executes for 3, 2, 1, and 0. } + mov bl,0; - { port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; - { port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - xor ch,ch; - mov cl,bh; { BH = ch.yl. } + @mainloop: - @lineloop: + push di; + push cx; - push cx; +{ port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; +{ port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; - mov cx,bp; + xor ch,ch; + mov cl,bh; { BH = ch.yl. } - repz movsb; { Copy the data. } + @lineloop: - sub di,bp; - add di,80; + push cx; - pop cx; + mov cx,bp; - loop @lineloop; + repz movsb; { Copy the data. } - inc bl; { One more on BL. } + sub di,bp; + add di,80; pop cx; - pop di; - loop @mainloop; + loop @lineloop; - pop bp; - pop ds; { Get DS back again. } - */ - { - } + inc bl; { One more on BL. } - void show_one(byte which); + pop cx; + pop di; - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p) { - warning("STUB: Celer::display_it()"); - } + loop @mainloop; - void show_one(byte which) { - warning("STUB: Celer::show_one()"); - } + pop bp; + pop ds; { Get DS back again. } +*/ +} - void show_one_at(byte which, int16 xxx, int16 yyy); +void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p) { + warning("STUB: Celer::display_it()"); +} - static void display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { - warning("STUB: Celer::display_it1()"); - } +void Celer::show_one(byte which) { + warning("STUB: Celer::show_one()"); +} - void show_one_at(byte which, int16 xxx, int16 yyy) { - warning("STUB: Celer::show_one_at()"); - } - } // End of namespace Celer. +void Celer::display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { + warning("STUB: Celer::display_it1()"); +} + +void Celer::show_one_at(byte which, int16 xxx, int16 yyy) { + warning("STUB: Celer::show_one_at()"); +} + + } // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 466ed8d9d028..263d717ab95d 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -30,50 +30,68 @@ #ifndef CELER2_H #define CELER2_H + + #include "common/scummsys.h" #include "common/str.h" namespace Avalanche { +class AvalancheEngine; + +class Celer { +public: + enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; + + struct chunkblocktype { + flavourtype flavour; + int16 x, y; + int16 xl, yl; + int32 size; + bool natural; + + bool memorise; /* Hold it in memory? */ + }; + + struct memotype { + int16 x, y; + int16 xl, yl; + flavourtype flavour; + uint16 size; + }; + + int32 offsets[40]; + byte num_chunks; + memotype memos[40]; + void *memory[40]; - namespace Celer { - enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; + Celer(); - struct chunkblocktype { - flavourtype flavour; - int16 x, y; - int16 xl, yl; - int32 size; - bool natural; + void setParent(AvalancheEngine *vm); - bool memorise; /* Hold it in memory? */ - }; + void pics_link(); - struct memotype { - int16 x, y; - int16 xl, yl; - flavourtype flavour; - uint16 size; - }; + void load_chunks(Common::String xx); - int32 offsets[40]; - byte num_chunks = 0; - memotype memos[40]; - void *memory[40]; + void forget_chunks(); + void show_one(byte which); + void show_one_at(byte which, int16 xxx, int16 yyy); - void pics_link(); +private: + AvalancheEngine *_vm; - void load_chunks(Common::String xx); + //untyped_file f; /* Private variable- not accessible from elsewhere. */ - void forget_chunks(); + static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ - void show_one(byte which); + void mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p); - void show_one_at(byte which, int16 xxx, int16 yyy); + void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p); - } // End of namespace Celer. + void display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); +}; } // End of namespace Avalanche. From 3c413c7ccb7925fce6d80f8b158747b0bb39d326 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 18:23:04 +0200 Subject: [PATCH 0053/1332] AVALANCHE: Enid: replace namespace with class. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/enid2.cpp | 422 ++++++++++++++++---------------- engines/avalanche/enid2.h | 51 +++- 4 files changed, 258 insertions(+), 218 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index e17f1ee9bc1f..c6821711df92 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -54,6 +54,7 @@ namespace Avalanche { _scrolls.setParent(this); _visa.setParent(this); _lucerna.setParent(this); + _enid.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e0f544c73bad..643b97c7f065 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -36,6 +36,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" +#include "avalanche/enid2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -59,6 +60,7 @@ class AvalancheEngine : public Engine { Scrolls _scrolls; Visa _visa; Lucerna _lucerna; + Enid _enid; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 9c7d64a1b113..3ca6daa2af8d 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -30,6 +30,8 @@ #include "common/scummsys.h" #include "common/textconsole.h" +#include "avalanche/avalanche.h" + #include "avalanche/enid2.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" @@ -43,285 +45,273 @@ namespace Avalanche { - namespace Enid { - - const Common::String crlf = Common::String(char(15)) + Common::String(char(12)); - const char tab = '\t'; - const char eof_ = '\n'; - - const Common::String ednafirst = - Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ - crlf + eof_ + crlf + crlf + /*7*/ - tab + "Glory to God in the highest," + crlf + /*31*/ - tab + "and on earth peace, goodwill toward men." + /*42*/ - crlf + tab + tab + tab + tab + /*6*/ - "Luke 2:14." + /*10*/ - crlf + crlf + crlf + /* 6 */ - "1234567890" +crlf; /*11*/ - - const Common::String ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); - - const int16 ttage = 18; - const Common::String ttwashere = "Thomas was here "; - - bool bug; - - - - Common::String expanddate(byte d, byte m, uint16 y); - - static Common::String month; - - static Common::String day; - - static void addon(Common::String x) { - //month[0]--; - month = month + x; +void Enid::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +const Common::String Enid::crlf = Common::String(char(15)) + Common::String(char(12)); +const char Enid::tab = '\t'; +const char Enid::eof_ = '\n'; + +const Common::String Enid::ednafirst = + Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ + crlf + eof_ + crlf + crlf + /*7*/ + tab + "Glory to God in the highest," + crlf + /*31*/ + tab + "and on earth peace, goodwill toward men." + /*42*/ + crlf + tab + tab + tab + tab + /*6*/ + "Luke 2:14." + /*10*/ + crlf + crlf + crlf + /* 6 */ + "1234567890" +crlf; /*11*/ + +const Common::String Enid::ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); + +const int16 Enid::ttage = 18; +const Common::String Enid::ttwashere = "Thomas was here "; + +const Enid::fourtype Enid::avaricius_file = "Avvy"; + + + +void Enid::addon(Common::String x) { + //month[0]--; + month = month + x; +} + +Common::String Enid::expanddate(byte d, byte m, uint16 y) { + const Common::String months[12] = { + "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", + "Septem*", "Octo*", "Novem*", "Decem*" + }; + + Common::String expanddate_result; + month = months[m]; + switch (month[month.size()]) { + case '#': + addon("uary"); + break; + case '*': + addon("ber"); + break; } - Common::String expanddate(byte d, byte m, uint16 y) { - const Common::String months[12] = { - "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", - "Septem*", "Octo*", "Novem*", "Decem*" - }; - - Common::String expanddate_result; - month = months[m]; - switch (month[month.size()]) { - case '#': - addon("uary"); + day = _vm->_gyro.strf(d); + + if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) + switch (d % 10) { + case 1: + day = day + "st"; + break; + case 2: + day = day + "nd"; break; - case '*': - addon("ber"); + case 3: + day = day + "rd"; break; + default: + day = day + "th"; } - day = Gyro::strf(d); - - if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) - switch (d % 10) { - case 1: - day = day + "st"; - break; - case 2: - day = day + "nd"; - break; - case 3: - day = day + "rd"; - break; - default: - day = day + "th"; - } - - expanddate_result = day + ' ' + month + ' ' + Gyro::strf(y); - return expanddate_result; - } + expanddate_result = day + ' ' + month + ' ' + _vm->_gyro.strf(y); + return expanddate_result; +} - void edna_save(Common::String name); - static void show_bug(char icon, Common::String strn) { - Scrolls::display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); - } - static bool test_bug(byte what) { - bool test_bug_result; - if (what == 0) { - test_bug_result = false; - return test_bug_result; - } - switch (what) { - case 2: - show_bug('7', "Error in filename!"); - break; - case 101: - show_bug('6', "Disk full!"); - break; - case 150: - show_bug('4', "Disk is write-protected!"); - break; - default: - show_bug('B', "Saving error!"); - } - test_bug_result = true; +void Enid::show_bug(char icon, Common::String strn) { + _vm->_scrolls.display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); +} + +bool Enid::test_bug(byte what) { + bool test_bug_result; + if (what == 0) { + test_bug_result = false; return test_bug_result; } - - void edna_save(Common::String name) { - warning("STUB: Enid::edna_save()"); + switch (what) { + case 2: + show_bug('7', "Error in filename!"); + break; + case 101: + show_bug('6', "Disk full!"); + break; + case 150: + show_bug('4', "Disk is write-protected!"); + break; + default: + show_bug('B', "Saving error!"); } - - void loaderror(Common::String x, char icon) { - if (Gyro::holdthedawn) { - Gyro::holdthedawn = false; - Lucerna::dawn(); - } - Scrolls::display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); - bug = true; + test_bug_result = true; + return test_bug_result; +} + +void Enid::edna_save(Common::String name) { + warning("STUB: Enid::edna_save()"); +} + +void Enid::loaderror(Common::String x, char icon) { + if (_vm->_gyro.holdthedawn) { + _vm->_gyro.holdthedawn = false; + _vm->_lucerna.dawn(); } + _vm->_scrolls.display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); + bug = true; +} - typedef char fourtype[5]; - +void Enid::edna_load(Common::String name) { + warning("STUB: Enid::edna_load()"); +} - const fourtype avaricius_file = "Avvy"; - void edna_load(Common::String name) { - warning("STUB: Enid::edna_load()"); - } - void dir(Common::String where); +void Enid::showheader() { + _vm->_scrolls.display(Common::String("Dir: ") + path + "\r\r\4"); +} - static Common::String path, groi; - - static void showheader() { - Scrolls::display(Common::String("Dir: ") + path + "\r\r\4"); - } +void Enid::dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */ + warning("STUB: Enid::dir()"); +} - void dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */ - warning("STUB: Enid::dir()"); - } - - void avvy_background() { /* Not really a filing procedure, - but it's only called just before edna_load, so I thought I'd put it - in Enid instead of, say, Lucerna. */ +void Enid::avvy_background() { /* Not really a filing procedure, + but it's only called just before edna_load, so I thought I'd put it + in Enid instead of, say, Lucerna. */ - /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ - /* - asm - mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } - mov dx,$3ce; mov al,4; out dx,al; { register. } - mov dx,$3c5; mov al,1; out dx,al; - mov dx,$3cf; out dx,al; + /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ + /* + asm + mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } + mov dx,$3ce; mov al,4; out dx,al; { register. } + mov dx,$3c5; mov al,1; out dx,al; + mov dx,$3cf; out dx,al; - mov bx,$A000; call far ptr @drawup; - mov bx,$A400; call far ptr @drawup; + mov bx,$A000; call far ptr @drawup; + mov bx,$A400; call far ptr @drawup; - jmp @the_end; + jmp @the_end; - @drawup: + @drawup: - mov es,bx; { The segment to copy it to... } - mov di,$370; { The offset (10 pixels down, plus 1 offset.) } + mov es,bx; { The segment to copy it to... } + mov di,$370; { The offset (10 pixels down, plus 1 offset.) } - mov cx,10; - mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } - mov ax,$AEAA; call far ptr @sameline; - mov ax,$A4EA; call far ptr @sameline; - mov ax,$44A4; call far ptr @sameline; + mov cx,10; + mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } + mov ax,$AEAA; call far ptr @sameline; + mov ax,$A4EA; call far ptr @sameline; + mov ax,$44A4; call far ptr @sameline; - mov cx,9; - mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } - mov ax,$AAEA; call far ptr @sameline; - mov ax,$AA4E; call far ptr @sameline; - mov ax,$444A; call far ptr @sameline; + mov cx,9; + mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } + mov ax,$AAEA; call far ptr @sameline; + mov ax,$AA4E; call far ptr @sameline; + mov ax,$444A; call far ptr @sameline; - mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } - mov ax,$AAAE; call far ptr @sameline; - mov ax,$EAA4; call far ptr @sameline; - mov ax,$A444; call far ptr @sameline; + mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } + mov ax,$AAAE; call far ptr @sameline; + mov ax,$EAA4; call far ptr @sameline; + mov ax,$A444; call far ptr @sameline; - mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } - mov ax,$EAAA; call far ptr @sameline; - mov ax,$4EAA; call far ptr @sameline; - mov ax,$4A44; call far ptr @sameline; + mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } + mov ax,$EAAA; call far ptr @sameline; + mov ax,$4EAA; call far ptr @sameline; + mov ax,$4A44; call far ptr @sameline; - ret; + ret; - { Replicate the same line many times. } + { Replicate the same line many times. } - @sameline: - { Requires: - what to copy in AX, - how many lines in CX, and - original offset in DI. } - push cx; - push di; + @sameline: + { Requires: + what to copy in AX, + how many lines in CX, and + original offset in DI. } + push cx; + push di; - @samelineloop: + @samelineloop: - push cx; - mov cx,40; { No. of times to repeat it on one line. } + push cx; + mov cx,40; { No. of times to repeat it on one line. } - repz stosw; { Fast uint16-copying } + repz stosw; { Fast uint16-copying } - pop cx; + pop cx; - add di,1200; { The next one will be 16 lines down. } + add di,1200; { The next one will be 16 lines down. } - loop @samelineloop; - pop di; - add di,80; - pop cx; + loop @samelineloop; + pop di; + add di,80; + pop cx; - ret; + ret; - @the_end: - end; - */ - Lucerna::blitfix(); - } + @the_end: + end; + */ + _vm->_lucerna.blitfix(); +} - void to_sundry(Gyro::sundry &sund) { - { - sund.qenid_filename = Gyro::enid_filename; - sund.qsoundfx = Gyro::soundfx; - sund.qthinks = Gyro::thinks; - sund.qthinkthing = Gyro::thinkthing; - } +void Enid::to_sundry(sundry &sund) { + { + sund.qenid_filename = _vm->_gyro.enid_filename; + sund.qsoundfx = _vm->_gyro.soundfx; + sund.qthinks = _vm->_gyro.thinks; + sund.qthinkthing = _vm->_gyro.thinkthing; } - - void from_sundry(Gyro::sundry sund) { - { - Gyro::enid_filename = sund.qenid_filename; - Gyro::soundfx = sund.qsoundfx; - Gyro::thinks = sund.qthinks; - Gyro::thinkthing = sund.qthinkthing; - } +} + +void Enid::from_sundry(sundry sund) { + { + _vm->_gyro.enid_filename = sund.qenid_filename; + _vm->_gyro.soundfx = sund.qsoundfx; + _vm->_gyro.thinks = sund.qthinks; + _vm->_gyro.thinkthing = sund.qthinkthing; } +} - void restore_dna() { - uint16 here, fv; - Gyro::sundry sund; +void Enid::restore_dna() { + uint16 here, fv; + sundry sund; - warning("STUB: Enid::restore_dna()"); - } + warning("STUB: Enid::restore_dna()"); +} - void edna_reload() { +void Enid::edna_reload() { - restore_dna(); + restore_dna(); - Gyro::seescroll = true; /* This prevents display of the new sprites before the - new picture is loaded. */ + _vm->_gyro.seescroll = true; /* This prevents display of the new sprites before the + new picture is loaded. */ - Lucerna::major_redraw(); + _vm->_lucerna.major_redraw(); - Gyro::whereis[Gyro::pavalot] = Gyro::dna.room; + _vm->_gyro.whereis[_vm->_gyro.pavalot] = _vm->_gyro.dna.room; - Gyro::alive = true; + _vm->_gyro.alive = true; - Lucerna::objectlist(); + _vm->_lucerna.objectlist(); - if (Gyro::holdthedawn) { - Gyro::holdthedawn = false; - Lucerna::dawn(); - } + if (_vm->_gyro.holdthedawn) { + _vm->_gyro.holdthedawn = false; + _vm->_lucerna.dawn(); } +} - void back_to_bootstrap(byte what) { - warning("STUB: Enid::back_to_bootstrap()"); - } +void Enid::back_to_bootstrap(byte what) { + warning("STUB: Enid::back_to_bootstrap()"); +} - bool there_was_a_problem() { - return bug; - } +bool Enid::there_was_a_problem() { + return bug; +} - } // End of namespace Enid. } // End of namespace Avalanche. diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 0b4671ad30ef..4351354270a7 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -35,8 +35,11 @@ #include "avalanche/gyro2.h" namespace Avalanche { +class AvalancheEngine; - namespace Enid { +class Enid { +public: + void setParent(AvalancheEngine *vm); void edna_save(Common::String name); @@ -52,7 +55,51 @@ namespace Avalanche { bool there_was_a_problem(); - } // End of namespace Enid. +private: + AvalancheEngine *_vm; + + static const Common::String crlf; + static const char tab; + static const char eof_; + + static const Common::String ednafirst; + + static const Common::String ednaid; + + static const int16 ttage; + static const Common::String ttwashere; + + typedef char fourtype[5]; + static const fourtype avaricius_file; + + + + bool bug; + + Common::String path, groi; + + Common::String month; + Common::String day; + + + + void addon(Common::String x); + Common::String expanddate(byte d, byte m, uint16 y); + + void show_bug(char icon, Common::String strn); + bool test_bug(byte what); + + void loaderror(Common::String x, char icon); + + void showheader(); + + void to_sundry(sundry &sund); + void from_sundry(sundry sund); + + void restore_dna(); + + +}; } // End of namespace Avalanche. From 5ce7e689b4986675a30c0336b4edb3cef69e0ce6 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 18:24:31 +0200 Subject: [PATCH 0054/1332] AVALANCHE: Repair Enhanced, cosmetics in Gyro. --- engines/avalanche/enhanced2.h | 4 ++-- engines/avalanche/gyro2.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index 8dd88a6e9309..d780f11c4cf7 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -39,8 +39,6 @@ class AvalancheEngine; class Enhanced { public: - AvalancheEngine *_vm; - byte shiftstate; /*ABSOLUTE $40:$17;*/ bool atbios; // BIOS type char inchar, extd; @@ -51,6 +49,8 @@ class Enhanced { bool keypressede(); private: + AvalancheEngine *_vm; + bool isenh(); }; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index c2f6fd7f9be6..6c596d2810dc 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -299,9 +299,7 @@ struct ednahead { /* Edna header */ class Gyro { - public: - static const char *vernum; static const char *copyright; static const int16 thisvercode = 130; From edaba46087a5d5adf8623ecd9b3cfa16b0ea0de5 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 18:25:28 +0200 Subject: [PATCH 0055/1332] AVALANCHE: Logger: replace namespace with class. --- engines/avalanche/logger2.cpp | 389 +++++++++++++++++----------------- engines/avalanche/logger2.h | 30 ++- 2 files changed, 223 insertions(+), 196 deletions(-) diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index 24582a4e6c4e..09643f766afc 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -25,235 +25,238 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* LOGGER Handles the logging. */ + #include "avalanche/logger2.h" #include "avalanche/gyro2.h" +#include "avalanche/avalanche.h" //#include "avalanche/trip6.h" #include "common/system.h" #include "common/textconsole.h" namespace Avalanche { +const char Logger::divide[] = "--- oOo ---"; - namespace Logger { - - const char divide[] = "--- oOo ---"; - - /* Epson codes: - - startwith=''; - endwith=''; - double_width = #14; { shift out (SO) } - double_off = #20; { device control 4 (DC4) } - italic = #27+'4'; { switches italics on... } - italic_off = #27+'5'; { and off. } - emph_on = #27+#69; - emph_off = #27+#70; - divide_indent = 15; - - */ - - /* L'jet codes: */ - - //// Not sure if these will be needed at all... - // - //const Common::String startwith = Common::String('\33') + '\50' + "10J" + '\130'; - //const Common::String endwith = Common::String('\33') + '\105'; - //const Common::String italic = Common::String('\33') + '\50' + '\163' + '\61' + '\123'; /* switches italics on... */ - //const Common::String italic_off = Common::String('\33') + '\50' + '\163' + '\60' + '\123'; /* and off. */ - //const Common::String emph_on = Common::String('\33') + '\50' + '\163' + '\63' + '\102'; - //const Common::String emph_off = Common::String('\33') + '\50' + '\163' + '\60' + '\102'; - // - //const Common::String double_width = emph_on; /* There IS no double-width. */ - //const Common::String double_off = emph_off; /* So we'll have to use bold. */ - - - const Common::String quote = ""; - const Common::String unquote = ""; - const Common::String copyright = "(c)"; - const int16 divide_indent = 30; - - Common::String scroll_line; - byte scroll_line_length; - - void centre(byte size, byte x) { /* Prints req'd number of spaces. */ - byte fv; - if (! Gyro::logging) return; - - warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); fv ++) - output << logfile << ' ';*/ - } - - void log_setup(Common::String name, bool printing) { /* Sets up. */ - - warning("STUB: Logger::log_setup()"); - - /* assign(logfile, name); - rewrite(logfile); - output << logfile << startwith; - log_epson = printing; - logging = true; - - if (! printing) { - quote = '"'; - unquote = '"'; - copyright = "(c)"; - }*/ - } - - void log_divider() { /* Prints the divider sign. */ - byte fv; - if (! Gyro::logging) return; - - warning("STUB: Logger::log_divider()"); - - /*if (Gyro::log_epson) { - output << logfile << Common::String(' ') + double_width; - for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; - output << logfile << Common::String(' ') + double_off; - } else - for (fv = 1; fv <= 36; fv ++) output << logfile << ' '; - output << logfile << divide << NL;*/ - } - - void log_command(Common::String x) { /* Prints a command */ - if (! Gyro::logging) return; - - warning("STUB: Logger::log_command()"); - - /*if (Gyro::log_epson) - output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; - else - output << logfile << Common::String("> ") + x << NL;*/ +/* Epson codes: + + startwith=''; + endwith=''; + double_width = #14; { shift out (SO) } + double_off = #20; { device control 4 (DC4) } + italic = #27+'4'; { switches italics on... } + italic_off = #27+'5'; { and off. } + emph_on = #27+#69; + emph_off = #27+#70; + divide_indent = 15; + +*/ + +/* L'jet codes: */ + +//// Not sure if these will be needed at all... +// +//const Common::String startwith = Common::String('\33') + '\50' + "10J" + '\130'; +//const Common::String endwith = Common::String('\33') + '\105'; +//const Common::String italic = Common::String('\33') + '\50' + '\163' + '\61' + '\123'; /* switches italics on... */ +//const Common::String italic_off = Common::String('\33') + '\50' + '\163' + '\60' + '\123'; /* and off. */ +//const Common::String emph_on = Common::String('\33') + '\50' + '\163' + '\63' + '\102'; +//const Common::String emph_off = Common::String('\33') + '\50' + '\163' + '\60' + '\102'; +// +//const Common::String double_width = emph_on; /* There IS no double-width. */ +//const Common::String double_off = emph_off; /* So we'll have to use bold. */ + + + +const Common::String Logger::quote = ""; +const Common::String Logger::unquote = ""; +const Common::String Logger::copyright = "(c)"; +const int16 Logger::divide_indent = 30; + + + +void Logger::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ + byte fv; + + if (! _vm->_gyro.logging) return; + + warning("STUB: Logger::centre()"); + /*for (fv = 1; fv <= size - (x / 2); fv ++) + output << logfile << ' ';*/ +} + +void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ + + warning("STUB: Logger::log_setup()"); + + /* assign(logfile, name); + rewrite(logfile); + output << logfile << startwith; + log_epson = printing; + logging = true; + + if (! printing) { + quote = '"'; + unquote = '"'; + copyright = "(c)"; + }*/ +} + +void Logger::log_divider() { /* Prints the divider sign. */ + byte fv; + if (! _vm->_gyro.logging) return; + + warning("STUB: Logger::log_divider()"); + + /*if (_vm->_gyro.log_epson) { + output << logfile << Common::String(' ') + double_width; + for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; + output << logfile << Common::String(' ') + double_off; + } else + for (fv = 1; fv <= 36; fv ++) output << logfile << ' '; + output << logfile << divide << NL;*/ +} + +void Logger::log_command(Common::String x) { /* Prints a command */ + if (! _vm->_gyro.logging) return; + + warning("STUB: Logger::log_command()"); + + /*if (_vm->_gyro.log_epson) + output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; + else + output << logfile << Common::String("> ") + x << NL;*/ +} + +void Logger::log_addstuff(Common::String x) { + if (! _vm->_gyro.logging) return; + scroll_line += x; +} + +void Logger::log_scrollchar(Common::String x) { /* print one character */ + Common::String z; + if (! _vm->_gyro.logging) return; + switch (x[1]) { + case '`': + z = quote; + break; /* Open quotes: "66" */ + case '"': + z = unquote; + break; /* Close quotes: "99" */ + case '\357': + z = copyright; + break; /* Copyright sign. */ + default: + z = x; } + log_addstuff(z); + scroll_line_length += z.size(); +} - void log_addstuff(Common::String x) { - if (! Gyro::logging) return; - scroll_line += x; - } - - void log_scrollchar(Common::String x) { /* print one character */ - Common::String z; - if (! Gyro::logging) return; - switch (x[1]) { - case '`': - z = quote; - break; /* Open quotes: "66" */ - case '"': - z = unquote; - break; /* Close quotes: "99" */ - case '\357': - z = copyright; - break; /* Copyright sign. */ - default: - z = x; - } - log_addstuff(z); - scroll_line_length += z.size(); - } - - void log_italic() { - if (! Gyro::logging) return; - - warning("STUB: Logger::log_italic()"); +void Logger::log_italic() { + if (! _vm->_gyro.logging) return; - /*if (Gyro::log_epson) - log_addstuff(italic); - else - log_addstuff("*");*/ - } + warning("STUB: Logger::log_italic()"); - void log_roman() { - if (! Gyro::logging) return; + /*if (_vm->_gyro.log_epson) + log_addstuff(italic); + else + log_addstuff("*");*/ +} - warning("STUB: Logger::log_roman()"); +void Logger::log_roman() { + if (! _vm->_gyro.logging) return; - /* if (Gyro::log_epson) - log_addstuff(italic_off); - else - log_addstuff("*");*/ - } + warning("STUB: Logger::log_roman()"); - void log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (! Gyro::logging) return; + /* if (_vm->_gyro.log_epson) + log_addstuff(italic_off); + else + log_addstuff("*");*/ +} - warning("STUB: Logger::log_epsonroman()"); +void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ + if (! _vm->_gyro.logging) return; - //if (Gyro::log_epson) log_addstuff(italic_off); - } + warning("STUB: Logger::log_epsonroman()"); - void log_scrollline() { /* Set up a line for the scroll driver */ - scroll_line_length = 0; - scroll_line = ""; - } + //if (_vm->_gyro.log_epson) log_addstuff(italic_off); +} - void log_scrollendline(bool centred) { - byte x, fv; - if (! Gyro::logging) return; - x = 17; - if (centred) x += (50 - scroll_line_length) / 2; +void Logger::log_scrollline() { /* Set up a line for the scroll driver */ + scroll_line_length = 0; + scroll_line = ""; +} - warning("STUB: Logger::log_scrollendline()"); +void Logger::log_scrollendline(bool centred) { + byte x, fv; + if (! _vm->_gyro.logging) return; + x = 17; + if (centred) x += (50 - scroll_line_length) / 2; - /*for (fv = 1; fv <= x; fv ++) output << logfile << ' '; - output << logfile << scroll_line << NL;*/ - } + warning("STUB: Logger::log_scrollendline()"); - void log_bubbleline(byte linenum, byte whom, Common::String x) { - byte fv; - if (! Gyro::logging) return; + /*for (fv = 1; fv <= x; fv ++) output << logfile << ' '; + output << logfile << scroll_line << NL;*/ +} - warning("STUB: Logger::log_bubbleline()"); +void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { + byte fv; + if (! _vm->_gyro.logging) return; - /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; - } else { - for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; - output << logfile << x << NL; - }*/ - } + warning("STUB: Logger::log_bubbleline()"); - void log_newline() { - warning("STUB: Logger::log_newline()"); + /*if (linenum == 1) { + for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; + output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; + } else { + for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; + output << logfile << x << NL; + }*/ +} - //if (Gyro::logging) output << logfile << NL; - } +void Logger::log_newline() { + warning("STUB: Logger::log_newline()"); - void log_newroom(Common::String where) { - byte fv; - if (! Gyro::logging) return; + //if (_vm->_gyro.logging) output << logfile << NL; +} - warning("STUB: Logger::log_newroom()"); +void Logger::log_newroom(Common::String where) { + byte fv; + if (! _vm->_gyro.logging) return; - /*for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; - if (Gyro::log_epson) output << logfile << emph_on; - output << logfile << Common::String('(') + where + ')'; - if (Gyro::log_epson) output << logfile << emph_off; - output << logfile << NL;*/ - } + warning("STUB: Logger::log_newroom()"); - void log_aside(Common::String what) - /* This writes "asides" to the printer. For example, moves in Nim. */ - { - if (! Gyro::logging) return; + /*for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; + if (_vm->_gyro.log_epson) output << logfile << emph_on; + output << logfile << Common::String('(') + where + ')'; + if (_vm->_gyro.log_epson) output << logfile << emph_off; + output << logfile << NL;*/ +} - warning("STUB: Logger::log_aside()"); +void Logger::log_aside(Common::String what) +/* This writes "asides" to the printer. For example, moves in Nim. */ +{ + if (! _vm->_gyro.logging) return; - //output << logfile << " (" << italic << what << italic_off << ')' << NL; - /* "What" is what to write. */ - } + warning("STUB: Logger::log_aside()"); - void log_score(uint16 credit, uint16 now) { - byte fv; - if (! Gyro::logging) return; + //output << logfile << " (" << italic << what << italic_off << ')' << NL; + /* "What" is what to write. */ +} - warning("STUB: Logger::log_score()"); +void Logger::log_score(uint16 credit, uint16 now) { + byte fv; + if (! _vm->_gyro.logging) return; - /*for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; - output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ - } + warning("STUB: Logger::log_score()"); - } // End of namespace Logger + /*for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; + output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ +} } // End of namespace Avalanche diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h index a1b7882abfdc..bd54823495c4 100644 --- a/engines/avalanche/logger2.h +++ b/engines/avalanche/logger2.h @@ -25,14 +25,21 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* LOGGER Handles the logging. */ + #ifndef LOGGER2_H #define LOGGER2_H -#include "common/system.h" +#include "common/scummsys.h" +#include "common/str.h" + namespace Avalanche { +class AvalancheEngine; - namespace Logger { +class Logger { +public: + void setParent(AvalancheEngine *vm); void log_setup(Common::String name, bool printing); @@ -62,7 +69,24 @@ namespace Avalanche { void log_score(uint16 credit, uint16 now); - } // End of namespace Logger +private: + AvalancheEngine *_vm; + + static const char divide[]; + + static const Common::String quote; + static const Common::String unquote; + static const Common::String copyright; + static const int16 divide_indent; + + Common::String scroll_line; + byte scroll_line_length; + + void centre(byte size, byte x); + + void log_addstuff(Common::String x); + +}; } // End of namespace Avalanche From 7c43ab471fb051ecd6c3e77d37419f2d9304fcfe Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 18:29:59 +0200 Subject: [PATCH 0056/1332] AVALANCHE: Lucerna: replace namespace with class. --- engines/avalanche/lucerna2.cpp | 69 ++++++++++++++++------------------ engines/avalanche/lucerna2.h | 30 +++++++++++++-- 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 88db23e54102..3c1d59c8b3fe 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -25,6 +25,10 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* LUCERNA The screen, [keyboard] and mouse handler.*/ + +#include "avalanche/avalanche.h" + #include "common/system.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" @@ -32,50 +36,43 @@ #include "avalanche/logger2.h" #include "avalanche/enhanced2.h" -//#include "Graph.h" -///*#include "Dos.h"*/ -///*#include "Crt.h"*/ -//#include "trip5.h" -//#include "Acci.h" -//#include "pingo.h" -//#include "dropdown.h" -//#include "visa.h" -//#include "celer.h" -//#include "timeout.h" -//#include "basher.h" -//#include "sequence.h" -namespace Avalanche { +#include "avalanche/visa2.h" +#include "avalanche/timeout2.h" +#include "avalanche/trip6.h" +#include "avalanche/enid2.h" +#include "avalanche/celer2.h" +#include "avalanche/pingo2.h" +#include "avalanche/sequence2.h" +#include "avalanche/acci2.h" - namespace Lucerna { - bool fxhidden; +//#include "dropdown.h" +//#include "basher.h" - struct rgbrec { - int16 red; - int16 green; - int16 blue; - }; - struct palettetype { - int32 size; - rgbrec colors[256]; - }; +namespace Avalanche { + +Lucerna::Lucerna() { + // Will be needed. +} - palettetype fxpal[4]; +void Lucerna::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Lucerna::callverb(char n) { + /*if (n == pardon) + Scrolls::display( + "The f5 key lets you do a particular action in certain " + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + "current setting of this key is.");*/ - void callverb(char n) { - /*if (n == pardon) - Scrolls::display( - "The f5 key lets you do a particular action in certain " - "situations. However, at the moment there is nothing " - "assigned to it. You may press alt-A to see what the " - "current setting of this key is.");*/ + // Needs const char pardon located in Acci. - // Needs const char pardon located in Acci. +} - } - } // End of namespace Lucerna -} // End of namespace Avalanche \ No newline at end of file +} // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index bee9c107d2da..259b639b6fe8 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -25,18 +25,23 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* LUCERNA The screen, [keyboard] and mouse handler.*/ + #ifndef LUCERNA2_H #define LUCERNA2_H #include "common/scummsys.h" namespace Avalanche { +class AvalancheEngine; - namespace Lucerna { - +class Lucerna { +public: // Call it where Lucerna is first used. // Procuded to replace the initizalization part of the original Pascal unit. - void initialize_lucerna(); + Lucerna(); + + void setParent(AvalancheEngine *vm); void callverb(char n); @@ -106,7 +111,24 @@ namespace Avalanche { void fix_flashers(); - } // End of namespace Lucerna +private: + AvalancheEngine *_vm; + + bool fxhidden; + + struct rgbrec { + int16 red; + int16 green; + int16 blue; + }; + + struct palettetype { + int32 size; + rgbrec colors[256]; + }; + + palettetype fxpal[4]; +}; } // End of namespace Avalanche From e28d3263dc39f54d2bbadc026f4bf7989b7a3701 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 18:41:04 +0200 Subject: [PATCH 0057/1332] AVALANCHE: Sequence: replace namespace with class. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/sequence2.cpp | 122 ++++++++++++++++---------------- engines/avalanche/sequence2.h | 28 +++++--- 4 files changed, 82 insertions(+), 71 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c6821711df92..7465ac6b7545 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -55,6 +55,7 @@ namespace Avalanche { _visa.setParent(this); _lucerna.setParent(this); _enid.setParent(this); + _celer.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 643b97c7f065..6a3187c07212 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -37,6 +37,7 @@ #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/enid2.h" +#include "avalanche/celer2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -61,6 +62,7 @@ class AvalancheEngine : public Engine { Visa _visa; Lucerna _lucerna; Enid _enid; + Celer _celer; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 851dcb139a49..79c3e04b2e32 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -27,6 +27,8 @@ /* SEQUENCE The sequencer. */ +#include "avalanche/avalanche.h" + #include "avalanche/sequence2.h" #include "common/scummsys.h" #include "avalanche/gyro2.h" @@ -36,74 +38,74 @@ namespace Avalanche { - namespace Sequence { - - void then_show(byte what) { - byte fv; - for (fv = 1; fv <= seq_length; fv ++) - if (seq[fv] == 0) { - seq[fv] = what; - return; - } - } - - void first_show(byte what) { - /* First, we need to blank out the entire array. */ - for (int i = 0; i < sizeof(seq); i++) - seq[i] = 0; - - /* Then it's just the same as then_show. */ - then_show(what); - - } - - void then_flip(byte where, byte ped) { - then_show(now_flip); - - Gyro::dna.flip_to_where = where; - Gyro::dna.flip_to_ped = ped; - } +void Sequence::setParent(AvalancheEngine *vm) { + _vm = vm; +} - void start_to_close() { - Timeout::lose_timer(Timeout::reason_sequencer); - Timeout::set_up_timer(7, Timeout::PROCsequence, Timeout::reason_sequencer); - } +void Sequence::first_show(byte what) { + /* First, we need to blank out the entire array. */ + for (int i = 0; i < sizeof(seq); i++) + seq[i] = 0; - void start_to_open() { - Gyro::dna.user_moves_avvy = false; /* They can't move. */ - Trip::stopwalking(); /* And they're not moving now. */ - start_to_close(); /* Apart from that, it's the same thing. */ - } + /* Then it's just the same as then_show. */ + then_show(what); - void call_sequencer(); - - /* This PROC is called by Timeout when it's time to do another frame. */ - static void shove_left() { - memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */ - } +} - void call_sequencer() { - switch (seq[0]) { - case 0: +void Sequence::then_show(byte what) { + byte fv; + for (fv = 1; fv <= seq_length; fv ++) + if (seq[fv] == 0) { + seq[fv] = what; return; - break; /* No more routines. */ - case 177: { - Gyro::dna.user_moves_avvy = true; - Trip::fliproom(Gyro::dna.flip_to_where, Gyro::dna.flip_to_ped); /* 177 = Flip room. */ - if (seq[0] == 177) shove_left(); - } - break; } - - if ((seq[0] >= 1) && (seq[0] <= 176)) { - /* Show a frame. */ - Celer::show_one(seq[1]); - shove_left(); +} + +void Sequence::then_flip(byte where, byte ped) { + then_show(now_flip); + + _vm->_gyro.dna.flip_to_where = where; + _vm->_gyro.dna.flip_to_ped = ped; +} + +void Sequence::start_to_close() { + Timeout::lose_timer(Timeout::reason_sequencer); + Timeout::set_up_timer(7, Timeout::procsequence, Timeout::reason_sequencer); +} + +void Sequence::start_to_open() { + _vm->_gyro.dna.user_moves_avvy = false; /* They can't move. */ + Trip::stopwalking(); /* And they're not moving now. */ + start_to_close(); /* Apart from that, it's the same thing. */ +} + + + +/* This PROC is called by Timeout when it's time to do another frame. */ +void Sequence::shove_left() { + memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */ +} + +void Sequence::call_sequencer() { + switch (seq[0]) { + case 0: + return; + break; /* No more routines. */ + case 177: { + _vm->_gyro.dna.user_moves_avvy = true; + Trip::fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ + if (seq[0] == 177) shove_left(); } - - start_to_close(); /* Make sure this PROC gets called again. */ + break; } - } // End of namespace Sequence . + if ((seq[0] >= 1) && (seq[0] <= 176)) { + /* Show a frame. */ + _vm->_celer.show_one(seq[1]); + shove_left(); + } + + start_to_close(); /* Make sure this PROC gets called again. */ +} } // End of namespace Avalanche. diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h index 0e53ccf2a1c0..7bd79bc61bf4 100644 --- a/engines/avalanche/sequence2.h +++ b/engines/avalanche/sequence2.h @@ -33,32 +33,38 @@ #include "common/scummsys.h" namespace Avalanche { +class AvalancheEngine; - namespace Sequence { +class Sequence { +public: + static const int16 now_flip = 177; - const int16 now_flip = 177; + static const int16 seq_length = 10; - const int16 seq_length = 10; + byte seq[seq_length]; - byte seq[seq_length]; + void setParent(AvalancheEngine *vm); + void first_show(byte what); - void first_show(byte what); + void then_show(byte what); - void then_show(byte what); + void then_flip(byte where, byte ped); - void then_flip(byte where, byte ped); + void start_to_close(); - void start_to_close(); + void start_to_open(); - void start_to_open(); + void call_sequencer(); - void call_sequencer(); +private: + AvalancheEngine *_vm; - } // End of namespace Sequence . + void shove_left(); +}; } // End of namespace Avalanche. From adf4a357ce604baee75d45a99752f0931b5ef46d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 28 Jun 2013 20:01:47 +0200 Subject: [PATCH 0058/1332] AVALANCHE: Timeout: replace namespace with class. --- engines/avalanche/avalanche.cpp | 2 + engines/avalanche/avalanche.h | 5 +- engines/avalanche/timeout2.cpp | 1151 +++++++++++++++---------------- engines/avalanche/timeout2.h | 157 +++-- 4 files changed, 662 insertions(+), 653 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7465ac6b7545..d9a37296cb69 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -56,6 +56,8 @@ namespace Avalanche { _lucerna.setParent(this); _enid.setParent(this); _celer.setParent(this); + _sequence.setParent(this); + _timeout.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 6a3187c07212..8200a50116cb 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -38,6 +38,8 @@ #include "avalanche/lucerna2.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" +#include "avalanche/sequence2.h" +#include "avalanche/timeout2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -63,7 +65,8 @@ class AvalancheEngine : public Engine { Lucerna _lucerna; Enid _enid; Celer _celer; - + Sequence _sequence; + Timeout _timeout; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 6c0099b91031..a202aaf9ac86 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -33,6 +33,8 @@ #include "avalanche/timeout2.h" +#include "avalanche/avalanche.h" + #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" @@ -44,635 +46,626 @@ namespace Avalanche { - namespace Timeout { - - byte fv; - - void set_up_timer(int32 howlong, byte whither, byte why) { - fv = 1; - while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; - if (fv == 8) return; /* Oh dear... */ - - { - timetype &with = times[fv]; /* Everything's OK here! */ - - with.time_left = howlong; - with.then_where = whither; - with.what_for = why; - } - } - - void one_tick() { - - if (Gyro::ddmnow) return; - - for (fv = 1; fv <= 7; fv ++) { - timetype &with = times[fv]; - if (with.time_left > 0) { - with.time_left -= 1; - - if (with.time_left == 0) - switch (with.then_where) { - case procopen_drawbridge : - open_drawbridge(); - break; - case procavaricius_talks : - avaricius_talks(); - break; - case procurinate : - urinate(); - break; - case proctoilet2 : - toilet2(); - break; - case procbang: - bang(); - break; - case procbang2: - bang2(); - break; - case procstairs: - stairs(); - break; - case proccardiffsurvey: - cardiff_survey(); - break; - case proccardiff_return: - cardiff_return(); - break; - case proc_cwytalot_in_herts: - cwytalot_in_herts(); - break; - case procget_tied_up: - get_tied_up(); - break; - case procget_tied_up2: - get_tied_up2(); - break; - case prochang_around: - hang_around(); - break; - case prochang_around2: - hang_around2(); - break; - case procafter_the_shootemup: - after_the_shootemup(); - break; - case procjacques_wakes_up: - jacques_wakes_up(); - break; - case procnaughty_duke: - naughty_duke(); - break; - case procnaughty_duke2: - naughty_duke2(); - break; - case procnaughty_duke3: - naughty_duke3(); - break; - case procjump: - jump(); - break; - case procsequence: - Sequence::call_sequencer(); - break; - case proccrapulus_splud_out: - crapulus_says_splud_out(); - break; - case procdawn_delay: - Lucerna::dawn(); - break; - case procbuydrinks: - buydrinks(); - break; - case procbuywine: - buywine(); - break; - case proccallsguards: - callsguards(); - break; - case procgreetsmonk: - greetsmonk(); - break; - case procfall_down_oubliette: - fall_down_oubliette(); - break; - case procmeet_avaroid: - meet_avaroid(); - break; - case procrise_up_oubliette: - rise_up_oubliette(); - break; - case procrobin_hood_and_geida: - robin_hood_and_geida(); - break; - case procrobin_hood_and_geida_talk: - robin_hood_and_geida_talk(); - break; - case procavalot_returns: - avalot_returns(); - break; - case procavvy_sit_down: - avvy_sit_down(); - break; - case procghost_room_phew: - ghost_room_phew(); - break; - case procarkata_shouts: - arkata_shouts(); - break; - case procwinning: - winning(); - break; - case procavalot_falls: - avalot_falls(); - break; - case procspludwick_goes_to_cauldron: - spludwick_goes_to_cauldron(); - break; - case procspludwick_leaves_cauldron: - spludwick_leaves_cauldron(); - break; - case procgive_lute_to_geida: - give_lute_to_geida(); - break; - } - } - } - Gyro::roomtime += 1; /* Cycles since you've been in this room. */ - Gyro::dna.total_time += 1; /* Total amount of time for this game. */ - } - - void lose_timer(byte which) { - byte fv; - - for (fv = 1; fv <= 7; fv ++) { - timetype &with = times[fv]; - if (with.what_for == which) - with.time_left = 0; - } /* Cancel this one! */ +Timeout::Timeout() { + for (int i = 0; i < sizeof(times); i++) { + times[i].time_left = 0; + times[i].then_where = 0; + times[i].what_for = 0; } +} - /*function timer_is_on(which:byte):boolean; - var fv:byte; - begin - for fv:=1 to 7 do - with times[fv] do - if (what_for=which) and (time_left>0) then - begin - timer_is_on:=true; - exit; - end; - timer_is_on:=false; - end;*/ - - /* Timeout procedures: */ - - void open_drawbridge() { - { - Gyro::dna.drawbridge_open ++; - Celer::show_one(Gyro::dna.drawbridge_open - 1); - - if (Gyro::dna.drawbridge_open == 4) - Gyro::magics[2].op = Gyro::nix; /* You may enter the drawbridge. */ - else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); - } - } +void Timeout::setParent(AvalancheEngine *vm) { + _vm = vm; +} - /* --- */ +void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { + fv = 1; + while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; + if (fv == 8) return; /* Oh dear... */ - void avaricius_talks() { - { - Visa::dixi('q', Gyro::dna.avaricius_talk); - Gyro::dna.avaricius_talk ++; - - if (Gyro::dna.avaricius_talk < 17) - set_up_timer(177, procavaricius_talks, reason_avariciustalks); - else Lucerna::points(3); - - } - } + { + timetype &with = times[fv]; /* Everything's OK here! */ - void urinate() { - Trip::tr[1].turn(Trip::up); - Trip::stopwalking(); - Lucerna::showrw(); - set_up_timer(14, proctoilet2, reason_gototoilet); + with.time_left = howlong; + with.then_where = whither; + with.what_for = why; } +} - void toilet2() { - Scrolls::display("That's better!"); - } +void Timeout::one_tick() { + if (_vm->_gyro.ddmnow) return; - void bang() { - Scrolls::display("\6< BANG! >"); - set_up_timer(30, procbang2, reason_explosion); - } - - void bang2() { - Scrolls::display("Hmm... sounds like Spludwick's up to something..."); - } + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.time_left > 0) { + with.time_left -= 1; - void stairs() { - Gyro::blip(); - Trip::tr[0].walkto(4); - Celer::show_one(2); - Gyro::dna.brummie_stairs = 2; - Gyro::magics[11].op = Gyro::special; - Gyro::magics[11].data = 2; /* Reached the bottom of the stairs. */ - Gyro::magics[4].op = Gyro::nix; /* Stop them hitting the sides (or the game will hang.) */ - } - - void cardiff_survey() { - { - switch (Gyro::dna.cardiff_things) { - case 0: { - Gyro::dna.cardiff_things += 1; - Visa::dixi('q', 27); - } - break; - } - Visa::dixi('z', Gyro::dna.cardiff_things); + if (with.time_left == 0) + switch (with.then_where) { + case procopen_drawbridge : + open_drawbridge(); + break; + case procavaricius_talks : + avaricius_talks(); + break; + case procurinate : + urinate(); + break; + case proctoilet2 : + toilet2(); + break; + case procbang: + bang(); + break; + case procbang2: + bang2(); + break; + case procstairs: + stairs(); + break; + case proccardiffsurvey: + cardiff_survey(); + break; + case proccardiff_return: + cardiff_return(); + break; + case proc_cwytalot_in_herts: + cwytalot_in_herts(); + break; + case procget_tied_up: + get_tied_up(); + break; + case procget_tied_up2: + get_tied_up2(); + break; + case prochang_around: + hang_around(); + break; + case prochang_around2: + hang_around2(); + break; + case procafter_the_shootemup: + after_the_shootemup(); + break; + case procjacques_wakes_up: + jacques_wakes_up(); + break; + case procnaughty_duke: + naughty_duke(); + break; + case procnaughty_duke2: + naughty_duke2(); + break; + case procnaughty_duke3: + naughty_duke3(); + break; + case procjump: + jump(); + break; + case procsequence: + _vm->_sequence.call_sequencer(); + break; + case proccrapulus_splud_out: + crapulus_says_splud_out(); + break; + case procdawn_delay: + _vm->_lucerna.dawn(); + break; + case procbuydrinks: + buydrinks(); + break; + case procbuywine: + buywine(); + break; + case proccallsguards: + callsguards(); + break; + case procgreetsmonk: + greetsmonk(); + break; + case procfall_down_oubliette: + fall_down_oubliette(); + break; + case procmeet_avaroid: + meet_avaroid(); + break; + case procrise_up_oubliette: + rise_up_oubliette(); + break; + case procrobin_hood_and_geida: + robin_hood_and_geida(); + break; + case procrobin_hood_and_geida_talk: + robin_hood_and_geida_talk(); + break; + case procavalot_returns: + avalot_returns(); + break; + case procavvy_sit_down: + avvy_sit_down(); + break; + case procghost_room_phew: + ghost_room_phew(); + break; + case procarkata_shouts: + arkata_shouts(); + break; + case procwinning: + winning(); + break; + case procavalot_falls: + avalot_falls(); + break; + case procspludwick_goes_to_cauldron: + spludwick_goes_to_cauldron(); + break; + case procspludwick_leaves_cauldron: + spludwick_leaves_cauldron(); + break; + case procgive_lute_to_geida: + give_lute_to_geida(); + break; + } } - Gyro::interrogation = Gyro::dna.cardiff_things; - set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); - } - - void cardiff_return() { - Visa::dixi('q', 28); - cardiff_survey(); /* add end of question. */ - } - - void cwytalot_in_herts() { - Visa::dixi('q', 29); - } - - void get_tied_up() { - Visa::dixi('q', 34); /* ...Trouble! */ - Gyro::dna.user_moves_avvy = false; - Gyro::dna.been_tied_up = true; - Trip::stopwalking(); - Trip::tr[2].stopwalk(); - Trip::tr[2].stophoming(); - Trip::tr[2].call_eachstep = true; - Trip::tr[2].eachstep = Trip::procgrab_avvy; - set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } + _vm->_gyro.roomtime += 1; /* Cycles since you've been in this room. */ + _vm->_gyro.dna.total_time += 1; /* Total amount of time for this game. */ +} - void get_tied_up2() { - Trip::tr[1].walkto(4); - Trip::tr[2].walkto(5); - Gyro::magics[4].op = Gyro::nix; /* No effect when you touch the boundaries. */ - Gyro::dna.friar_will_tie_you_up = true; - } - - void hang_around() { - Trip::tr[2].check_me = false; - Trip::tr[1].init(7, true); /* Robin Hood */ - Gyro::whereis[Gyro::probinhood] = r__robins; - Trip::apped(1, 2); - Visa::dixi('q', 39); - Trip::tr[1].walkto(7); - set_up_timer(55, prochang_around2, reason_hanging_around); - } - - void hang_around2() { - Visa::dixi('q', 40); - Trip::tr[2].vanishifstill = false; - Trip::tr[2].walkto(4); - Gyro::whereis[Gyro::pfriartuck] = r__robins; - Visa::dixi('q', 41); - Trip::tr[1].done(); - Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ +void Timeout::lose_timer(byte which) { + byte fv; - set_up_timer(1, procafter_the_shootemup, reason_hanging_around); - /* Immediately call the following proc (when you have a chance). */ + for (fv = 1; fv <= 7; fv ++) { + timetype &with = times[fv]; + if (with.what_for == which) + with.time_left = 0; + } /* Cancel this one! */ +} + +/*function timer_is_on(which:byte):boolean; +var fv:byte; +begin + for fv:=1 to 7 do + with times[fv] do + if (what_for=which) and (time_left>0) then + begin + timer_is_on:=true; + exit; + end; + timer_is_on:=false; +end;*/ - Gyro::dna.tied_up = false; +/* Timeout procedures: */ - Enid::back_to_bootstrap(1); /* Call the shoot-'em-up. */ - } +void Timeout::open_drawbridge() { + { + _vm->_gyro.dna.drawbridge_open ++; + _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); - void after_the_shootemup() { - warning("STUB: Timeout::after_the_shootemup()"); + if (_vm->_gyro.dna.drawbridge_open == 4) + _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } +} - void jacques_wakes_up() { - Gyro::dna.jacques_awake += 1; +/* --- */ - switch (Gyro::dna.jacques_awake) { /* Additional pictures. */ - case 1 : { - Celer::show_one(1); /* Eyes open. */ - Visa::dixi('Q', 45); +void Timeout::avaricius_talks() { + { + _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); + _vm->_gyro.dna.avaricius_talk ++; + + if (_vm->_gyro.dna.avaricius_talk < 17) + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + else _vm->_lucerna.points(3); + + } +} + +void Timeout::urinate() { + Trip::tr[1].turn(Trip::up); + Trip::stopwalking(); + _vm->_lucerna.showrw(); + set_up_timer(14, proctoilet2, reason_gototoilet); +} + +void Timeout::toilet2() { + _vm->_scrolls.display("That's better!"); +} + +void Timeout::bang() { + _vm->_scrolls.display("\6< BANG! >"); + set_up_timer(30, procbang2, reason_explosion); +} + +void Timeout::bang2() { + _vm->_scrolls.display("Hmm... sounds like Spludwick's up to something..."); +} + +void Timeout::stairs() { + _vm->_gyro.blip(); + Trip::tr[0].walkto(4); + _vm->_celer.show_one(2); + _vm->_gyro.dna.brummie_stairs = 2; + _vm->_gyro.magics[11].op = _vm->_gyro.special; + _vm->_gyro.magics[11].data = 2; /* Reached the bottom of the stairs. */ + _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* Stop them hitting the sides (or the game will hang.) */ +} + +void Timeout::cardiff_survey() { + { + switch (_vm->_gyro.dna.cardiff_things) { + case 0: { + _vm->_gyro.dna.cardiff_things += 1; + _vm->_visa.dixi('q', 27); } break; - case 2 : { /* Going through the door. */ - Celer::show_one(2); /* Not on the floor. */ - Celer::show_one(3); /* But going through the door. */ - Gyro::magics[6].op = Gyro::nix; /* You can't wake him up now. */ } + _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); + } + _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; + set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); +} + +void Timeout::cardiff_return() { + _vm->_visa.dixi('q', 28); + cardiff_survey(); /* add end of question. */ +} + +void Timeout::cwytalot_in_herts() { + _vm->_visa.dixi('q', 29); +} + +void Timeout::get_tied_up() { + _vm->_visa.dixi('q', 34); /* ...Trouble! */ + _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro.dna.been_tied_up = true; + Trip::stopwalking(); + Trip::tr[2].stopwalk(); + Trip::tr[2].stophoming(); + Trip::tr[2].call_eachstep = true; + Trip::tr[2].eachstep = Trip::procgrab_avvy; + set_up_timer(70, procget_tied_up2, reason_getting_tied_up); +} + +void Timeout::get_tied_up2() { + Trip::tr[1].walkto(4); + Trip::tr[2].walkto(5); + _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* No effect when you touch the boundaries. */ + _vm->_gyro.dna.friar_will_tie_you_up = true; +} + +void Timeout::hang_around() { + Trip::tr[2].check_me = false; + Trip::tr[1].init(7, true); /* Robin Hood */ + _vm->_gyro.whereis[_vm->_gyro.probinhood] = r__robins; + Trip::apped(1, 2); + _vm->_visa.dixi('q', 39); + Trip::tr[1].walkto(7); + set_up_timer(55, prochang_around2, reason_hanging_around); +} + +void Timeout::hang_around2() { + _vm->_visa.dixi('q', 40); + Trip::tr[2].vanishifstill = false; + Trip::tr[2].walkto(4); + _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = r__robins; + _vm->_visa.dixi('q', 41); + Trip::tr[1].done(); + Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + + set_up_timer(1, procafter_the_shootemup, reason_hanging_around); + /* Immediately call the following proc (when you have a chance). */ + + _vm->_gyro.dna.tied_up = false; + + _vm->_enid.back_to_bootstrap(1); /* Call the shoot-'em-up. */ +} + +void Timeout::after_the_shootemup() { + warning("STUB: Timeout::after_the_shootemup()"); +} + +void Timeout::jacques_wakes_up() { + _vm->_gyro.dna.jacques_awake += 1; + + switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */ + case 1 : { + _vm->_celer.show_one(1); /* Eyes open. */ + _vm->_visa.dixi('Q', 45); + } + break; + case 2 : { /* Going through the door. */ + _vm->_celer.show_one(2); /* Not on the floor. */ + _vm->_celer.show_one(3); /* But going through the door. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* You can't wake him up now. */ + } + break; + case 3 : { /* Gone through the door. */ + _vm->_celer.show_one(2); /* Not on the floor, either. */ + _vm->_celer.show_one(4); /* He's gone... so the door's open. */ + _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; /* Gone! */ + } + break; + } + + + if (_vm->_gyro.dna.jacques_awake == 5) { + _vm->_gyro.dna.ringing_bells = true; + _vm->_gyro.dna.ayles_is_awake = true; + _vm->_lucerna.points(2); + } + + switch (_vm->_gyro.dna.jacques_awake) { + case 1: + case 2: + case 3: + set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); break; - case 3 : { /* Gone through the door. */ - Celer::show_one(2); /* Not on the floor, either. */ - Celer::show_one(4); /* He's gone... so the door's open. */ - Gyro::whereis[Gyro::pjacques] = 0; /* Gone! */ - } + case 4: + set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); break; - } + } +} - if (Gyro::dna.jacques_awake == 5) { - Gyro::dna.ringing_bells = true; - Gyro::dna.ayles_is_awake = true; - Lucerna::points(2); - } +void Timeout::naughty_duke() +/* This is when the Duke comes in and takes your money. */ +{ + Trip::tr[2].init(9, false); /* Here comes the Duke. */ + Trip::apped(2, 1); /* He starts at the door... */ + Trip::tr[2].walkto(3); /* He walks over to you. */ - switch (Gyro::dna.jacques_awake) { - case 1: - case 2: - case 3: - set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); - break; - case 4: - set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); - break; - } + /* Let's get the door opening. */ + _vm->_celer.show_one(1); + _vm->_sequence.first_show(2); + _vm->_sequence.start_to_close(); - } + set_up_timer(50, procnaughty_duke2, reason_naughty_duke); +} - void naughty_duke() - /* This is when the Duke comes in and takes your money. */ - { - Trip::tr[2].init(9, false); /* Here comes the Duke. */ - Trip::apped(2, 1); /* He starts at the door... */ - Trip::tr[2].walkto(3); /* He walks over to you. */ +void Timeout::naughty_duke2() { + _vm->_visa.dixi('q', 48); /* Ha ha, it worked again! */ + Trip::tr[2].walkto(1); /* Walk to the door. */ + Trip::tr[2].vanishifstill = true; /* Then go away! */ + set_up_timer(32, procnaughty_duke3, reason_naughty_duke); +} - /* Let's get the door opening. */ - Celer::show_one(1); - Sequence::first_show(2); - Sequence::start_to_close(); +void Timeout::naughty_duke3() { + _vm->_celer.show_one(1); + _vm->_sequence.first_show(2); + _vm->_sequence.start_to_close(); +} - set_up_timer(50, procnaughty_duke2, reason_naughty_duke); - } - - void naughty_duke2() { - Visa::dixi('q', 48); /* Ha ha, it worked again! */ - Trip::tr[2].walkto(1); /* Walk to the door. */ - Trip::tr[2].vanishifstill = true; /* Then go away! */ - set_up_timer(32, procnaughty_duke3, reason_naughty_duke); - } +void Timeout::jump() { + { + dnatype &with = _vm->_gyro.dna; - void naughty_duke3() { - Celer::show_one(1); - Sequence::first_show(2); - Sequence::start_to_close(); - } + with.jumpstatus += 1; - void jump() { { - Gyro::dnatype &with = Gyro::dna; - - with.jumpstatus += 1; - - { - Trip::triptype &with1 = Trip::tr[1]; - switch (with.jumpstatus) { - case 1: - case 2: - case 3: - case 5: - case 7: - case 9: - with1.y -= 1; - break; - case 12: - case 13: - case 14: - case 16: - case 18: - case 19: - with1.y += 1; - break; - } - } - - if (with.jumpstatus == 20) { - /* End of jump. */ - Gyro::dna.user_moves_avvy = true; - Gyro::dna.jumpstatus = 0; - } else { - /* Still jumping. */ - set_up_timer(1, procjump, reason_jumping); - } - - if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ - && (Gyro::dna.room == r__insidecardiffcastle) - && (Gyro::dna.arrow_in_the_door == true) - && (Trip::infield(3))) { /* beside the wall*/ - /* Grab the arrow! */ - if (Gyro::dna.carrying >= Gyro::maxobjs) - Scrolls::display("You fail to grab it, because your hands are full."); - else { - Celer::show_one(2); - Gyro::dna.arrow_in_the_door = false; /* You've got it. */ - Gyro::dna.obj[Gyro::bolt] = true; - Lucerna::objectlist(); - Visa::dixi('q', 50); - Lucerna::points(3); - } + Trip::triptype &with1 = Trip::tr[1]; + switch (with.jumpstatus) { + case 1: + case 2: + case 3: + case 5: + case 7: + case 9: + with1.y -= 1; + break; + case 12: + case 13: + case 14: + case 16: + case 18: + case 19: + with1.y += 1; + break; } } - } - - void crapulus_says_splud_out() { - Visa::dixi('q', 56); - Gyro::dna.crapulus_will_tell = false; - } - - void buydrinks() { - Celer::show_one(11); /* Malagauche gets up again. */ - Gyro::dna.malagauche = 0; - - Visa::dixi('D', Gyro::dna.drinking); /* Scrolls::display message about it. */ - Pingo::wobble(); /* Do the special effects. */ - Visa::dixi('D', 1); /* That'll be thruppence. */ - if (Gyro::pennycheck(3)) /* Pay 3d. */ - Visa::dixi('D', 3); /* Tell 'em you paid up. */ - Acci::have_a_drink(); - } - void buywine() { - Celer::show_one(11); /* Malagauche gets up again. */ - Gyro::dna.malagauche = 0; - - Visa::dixi('D', 50); /* You buy the wine. */ - Visa::dixi('D', 1); /* It'll be thruppence. */ - if (Gyro::pennycheck(3)) { - Visa::dixi('D', 4); /* You paid up. */ - Gyro::dna.obj[Gyro::wine] = true; - Lucerna::objectlist(); - Gyro::dna.winestate = 1; /* OK Wine */ + if (with.jumpstatus == 20) { + /* End of jump. */ + _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro.dna.jumpstatus = 0; + } else { + /* Still jumping. */ + set_up_timer(1, procjump, reason_jumping); } - } - - void callsguards() { - Visa::dixi('Q', 58); /* GUARDS!!! */ - Lucerna::gameover(); - } - void greetsmonk() { - Visa::dixi('Q', 59); - Gyro::dna.entered_lusties_room_as_monk = true; - } - - void fall_down_oubliette() { - Gyro::magics[9].op = Gyro::nix; - Trip::tr[1].iy += 1; /* increments dx/dy! */ - Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */ - set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); - } - - void meet_avaroid() { - if (Gyro::dna.met_avaroid) { - Scrolls::display("You can't expect to be \6that\22 lucky twice in a row!"); - Lucerna::gameover(); - } else { - Visa::dixi('Q', 60); - Gyro::dna.met_avaroid = true; - set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - { - Trip::triptype &with = Trip::tr[1]; - with.face = Trip::left; - with.x = 151; - with.ix = -3; - with.iy = -5; + if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + && (_vm->_gyro.dna.room == r__insidecardiffcastle) + && (_vm->_gyro.dna.arrow_in_the_door == true) + && (Trip::infield(3))) { /* beside the wall*/ + /* Grab the arrow! */ + if (_vm->_gyro.dna.carrying >= maxobjs) + _vm->_scrolls.display("You fail to grab it, because your hands are full."); + else { + _vm->_celer.show_one(2); + _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ + _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; + _vm->_lucerna.objectlist(); + _vm->_visa.dixi('q', 50); + _vm->_lucerna.points(3); } - Gyro::background(2); } } - - void rise_up_oubliette() { +} + +void Timeout::crapulus_says_splud_out() { + _vm->_visa.dixi('q', 56); + _vm->_gyro.dna.crapulus_will_tell = false; +} + +void Timeout::buydrinks() { + _vm->_celer.show_one(11); /* Malagauche gets up again. */ + _vm->_gyro.dna.malagauche = 0; + + _vm->_visa.dixi('D', _vm->_gyro.dna.drinking); /* _vm->_scrolls.display message about it. */ + _vm->_pingo.wobble(); /* Do the special effects. */ + _vm->_visa.dixi('D', 1); /* That'll be thruppence. */ + if (_vm->_gyro.pennycheck(3)) /* Pay 3d. */ + _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */ + Acci::have_a_drink(); +} + +void Timeout::buywine() { + _vm->_celer.show_one(11); /* Malagauche gets up again. */ + _vm->_gyro.dna.malagauche = 0; + + _vm->_visa.dixi('D', 50); /* You buy the wine. */ + _vm->_visa.dixi('D', 1); /* It'll be thruppence. */ + if (_vm->_gyro.pennycheck(3)) { + _vm->_visa.dixi('D', 4); /* You paid up. */ + _vm->_gyro.dna.obj[_vm->_gyro.wine] = true; + _vm->_lucerna.objectlist(); + _vm->_gyro.dna.winestate = 1; /* OK Wine */ + } +} + +void Timeout::callsguards() { + _vm->_visa.dixi('Q', 58); /* GUARDS!!! */ + _vm->_lucerna.gameover(); +} + +void Timeout::greetsmonk() { + _vm->_visa.dixi('Q', 59); + _vm->_gyro.dna.entered_lusties_room_as_monk = true; +} + +void Timeout::fall_down_oubliette() { + _vm->_gyro.magics[9].op = _vm->_gyro.nix; + Trip::tr[1].iy += 1; /* increments dx/dy! */ + Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */ + set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); +} + +void Timeout::meet_avaroid() { + if (_vm->_gyro.dna.met_avaroid) { + _vm->_scrolls.display("You can't expect to be \6that\22 lucky twice in a row!"); + _vm->_lucerna.gameover(); + } else { + _vm->_visa.dixi('Q', 60); + _vm->_gyro.dna.met_avaroid = true; + set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); { Trip::triptype &with = Trip::tr[1]; - - with.visible = true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy > 0) - set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); - else - Gyro::dna.user_moves_avvy = true; + with.face = Trip::left; + with.x = 151; + with.ix = -3; + with.iy = -5; } + _vm->_gyro.background(2); } +} - void robin_hood_and_geida() { - Trip::tr[1].init(7, true); - Trip::apped(1, 7); - Trip::tr[1].walkto(6); - Trip::tr[2].stopwalk(); - Trip::tr[2].face = Trip::left; - set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); - Gyro::dna.geida_follows = false; - } - - void robin_hood_and_geida_talk() { - Visa::dixi('q', 66); - Trip::tr[1].walkto(2); - Trip::tr[2].walkto(2); - Trip::tr[1].vanishifstill = true; - Trip::tr[2].vanishifstill = true; - set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); - } - - void avalot_returns() { - Trip::tr[1].done(); - Trip::tr[2].done(); - Trip::tr[1].init(0, true); - Trip::apped(1, 1); - Visa::dixi('q', 67); - Gyro::dna.user_moves_avvy = true; - } - - void avvy_sit_down() - /* This is used when you sit down in the pub in Notts. It loops around so - that it will happen when Avvy stops walking. */ +void Timeout::rise_up_oubliette() { { - if (Trip::tr[1].homing) /* Still walking */ - set_up_timer(1, procavvy_sit_down, reason_sitting_down); - else { - Celer::show_one(3); - Gyro::dna.sitting_in_pub = true; - Gyro::dna.user_moves_avvy = false; - Trip::tr[1].visible = false; - } - } + Trip::triptype &with = Trip::tr[1]; - void ghost_room_phew() { - Scrolls::display("\6PHEW!\22 You're glad to get out of \6there!"); - } - - void arkata_shouts() { - if (Gyro::dna.teetotal) return; - Visa::dixi('q', 76); - set_up_timer(160, procarkata_shouts, reason_arkata_shouts); - } - - void winning() { - Visa::dixi('q', 79); - Pingo::winning_pic(); - do { - Lucerna::checkclick(); - } while (!(Gyro::mrelease == 0)); - Lucerna::callverb(Acci::vb_score); - Scrolls::display(" T H E E N D "); - Gyro::lmo = true; - } - - void avalot_falls() { - if (Trip::tr[1].step < 5) { - Trip::tr[1].step += 1; - set_up_timer(3, procavalot_falls, reason_falling_over); - } else - Scrolls::display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); - } - - void spludwick_goes_to_cauldron() { - if (Trip::tr[2].homing) - set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + with.visible = true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy > 0) + set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else - set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); - } - - void spludwick_leaves_cauldron() { - Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */ - } - - void give_lute_to_geida() { /* Moved here from Acci. */ - Visa::dixi('Q', 86); - Lucerna::points(4); - Gyro::dna.lustie_is_asleep = true; - Sequence::first_show(5); - Sequence::then_show(6); /* He falls asleep... */ - Sequence::start_to_close(); /* Not really closing, but we're using the same procedure. */ - } - - /* "This is all!" */ - - class unit_timeout_initialize { - public: - unit_timeout_initialize(); - }; - static unit_timeout_initialize timeout_constructor; - - unit_timeout_initialize::unit_timeout_initialize() { - for (int i = 0; i < sizeof(times); i++) { - times[i].time_left = 0; - times[i].then_where = 0; - times[i].what_for = 0; - } - } - + _vm->_gyro.dna.user_moves_avvy = true; + } +} + +void Timeout::robin_hood_and_geida() { + Trip::tr[1].init(7, true); + Trip::apped(1, 7); + Trip::tr[1].walkto(6); + Trip::tr[2].stopwalk(); + Trip::tr[2].face = Trip::left; + set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); + _vm->_gyro.dna.geida_follows = false; +} + +void Timeout::robin_hood_and_geida_talk() { + _vm->_visa.dixi('q', 66); + Trip::tr[1].walkto(2); + Trip::tr[2].walkto(2); + Trip::tr[1].vanishifstill = true; + Trip::tr[2].vanishifstill = true; + set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); +} + +void Timeout::avalot_returns() { + Trip::tr[1].done(); + Trip::tr[2].done(); + Trip::tr[1].init(0, true); + Trip::apped(1, 1); + _vm->_visa.dixi('q', 67); + _vm->_gyro.dna.user_moves_avvy = true; +} + +void Timeout::avvy_sit_down() +/* This is used when you sit down in the pub in Notts. It loops around so + that it will happen when Avvy stops walking. */ +{ + if (Trip::tr[1].homing) /* Still walking */ + set_up_timer(1, procavvy_sit_down, reason_sitting_down); + else { + _vm->_celer.show_one(3); + _vm->_gyro.dna.sitting_in_pub = true; + _vm->_gyro.dna.user_moves_avvy = false; + Trip::tr[1].visible = false; + } +} + +void Timeout::ghost_room_phew() { + _vm->_scrolls.display("\6PHEW!\22 You're glad to get out of \6there!"); +} + +void Timeout::arkata_shouts() { + if (_vm->_gyro.dna.teetotal) return; + _vm->_visa.dixi('q', 76); + set_up_timer(160, procarkata_shouts, reason_arkata_shouts); +} + +void Timeout::winning() { + _vm->_visa.dixi('q', 79); + _vm->_pingo.winning_pic(); + do { + _vm->_lucerna.checkclick(); + } while (!(_vm->_gyro.mrelease == 0)); + _vm->_lucerna.callverb(Acci::vb_score); + _vm->_scrolls.display(" T H E E N D "); + _vm->_gyro.lmo = true; +} + +void Timeout::avalot_falls() { + if (Trip::tr[1].step < 5) { + Trip::tr[1].step += 1; + set_up_timer(3, procavalot_falls, reason_falling_over); + } else + _vm->_scrolls.display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); +} + +void Timeout::spludwick_goes_to_cauldron() { + if (Trip::tr[2].homing) + set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + else + set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); +} + +void Timeout::spludwick_leaves_cauldron() { + Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */ +} + +void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ + _vm->_visa.dixi('Q', 86); + _vm->_lucerna.points(4); + _vm->_gyro.dna.lustie_is_asleep = true; + _vm->_sequence.first_show(5); + _vm->_sequence.then_show(6); /* He falls asleep... */ + _vm->_sequence.start_to_close(); /* Not really closing, but we're using the same procedure. */ +} + +/* "This is all!" */ - } // End of namespace Timeout. } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 5130c92bbcd7..f7e984e42f15 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -36,123 +36,124 @@ #include "avalanche/celer2.h" namespace Avalanche { +class AvalancheEngine; - namespace Timeout { - +class Timeout { +public: /* reason_ now runs between 1 and 28. */ - const int16 reason_drawbridgefalls = 2; - const int16 reason_avariciustalks = 3; - const int16 reason_gototoilet = 4; - const int16 reason_explosion = 5; - const int16 reason_brummiestairs = 6; - const int16 reason_cardiffsurvey = 7; - const int16 reason_cwytalot_in_herts = 8; - const int16 reason_getting_tied_up = 9; - const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ - const int16 reason_jacques_waking_up = 11; - const int16 reason_naughty_duke = 12; - const int16 reason_jumping = 13; - const int16 reason_sequencer = 14; - const int16 reason_crapulus_says_spludwick_out = 15; - const int16 reason_dawndelay = 16; - const int16 reason_drinks = 17; - const int16 reason_du_lustie_talks = 18; - const int16 reason_falling_down_oubliette = 19; - const int16 reason_meeting_avaroid = 20; - const int16 reason_rising_up_oubliette = 21; - const int16 reason_robin_hood_and_geida = 22; - const int16 reason_sitting_down = 23; - const int16 reason_ghost_room_phew = 1; - const int16 reason_arkata_shouts = 24; - const int16 reason_winning = 25; - const int16 reason_falling_over = 26; - const int16 reason_spludwalk = 27; - const int16 reason_geida_sings = 28; + static const int16 reason_drawbridgefalls = 2; + static const int16 reason_avariciustalks = 3; + static const int16 reason_gototoilet = 4; + static const int16 reason_explosion = 5; + static const int16 reason_brummiestairs = 6; + static const int16 reason_cardiffsurvey = 7; + static const int16 reason_cwytalot_in_herts = 8; + static const int16 reason_getting_tied_up = 9; + static const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ + static const int16 reason_jacques_waking_up = 11; + static const int16 reason_naughty_duke = 12; + static const int16 reason_jumping = 13; + static const int16 reason_sequencer = 14; + static const int16 reason_crapulus_says_spludwick_out = 15; + static const int16 reason_dawndelay = 16; + static const int16 reason_drinks = 17; + static const int16 reason_du_lustie_talks = 18; + static const int16 reason_falling_down_oubliette = 19; + static const int16 reason_meeting_avaroid = 20; + static const int16 reason_rising_up_oubliette = 21; + static const int16 reason_robin_hood_and_geida = 22; + static const int16 reason_sitting_down = 23; + static const int16 reason_ghost_room_phew = 1; + static const int16 reason_arkata_shouts = 24; + static const int16 reason_winning = 25; + static const int16 reason_falling_over = 26; + static const int16 reason_spludwalk = 27; + static const int16 reason_geida_sings = 28; /* procx now runs between 1 and 41. */ - const int16 procopen_drawbridge = 3; + static const int16 procopen_drawbridge = 3; - const int16 procavaricius_talks = 4; + static const int16 procavaricius_talks = 4; - const int16 procurinate = 5; + static const int16 procurinate = 5; - const int16 proctoilet2 = 6; + static const int16 proctoilet2 = 6; - const int16 procbang = 7; + static const int16 procbang = 7; - const int16 procbang2 = 8; + static const int16 procbang2 = 8; - const int16 procstairs = 9; + static const int16 procstairs = 9; - const int16 proccardiffsurvey = 10; + static const int16 proccardiffsurvey = 10; - const int16 proccardiff_return = 11; + static const int16 proccardiff_return = 11; - const int16 proc_cwytalot_in_herts = 12; + static const int16 proc_cwytalot_in_herts = 12; - const int16 procget_tied_up = 13; + static const int16 procget_tied_up = 13; - const int16 procget_tied_up2 = 1; + static const int16 procget_tied_up2 = 1; - const int16 prochang_around = 14; + static const int16 prochang_around = 14; - const int16 prochang_around2 = 15; + static const int16 prochang_around2 = 15; - const int16 procafter_the_shootemup = 32; + static const int16 procafter_the_shootemup = 32; - const int16 procjacques_wakes_up = 16; + static const int16 procjacques_wakes_up = 16; - const int16 procnaughty_duke = 17; + static const int16 procnaughty_duke = 17; - const int16 procnaughty_duke2 = 18; + static const int16 procnaughty_duke2 = 18; - const int16 procnaughty_duke3 = 38; + static const int16 procnaughty_duke3 = 38; - const int16 procjump = 19; + static const int16 procjump = 19; - const int16 procsequence = 20; + static const int16 procsequence = 20; - const int16 proccrapulus_splud_out = 21; + static const int16 proccrapulus_splud_out = 21; - const int16 procdawn_delay = 22; + static const int16 procdawn_delay = 22; - const int16 procbuydrinks = 23; + static const int16 procbuydrinks = 23; - const int16 procbuywine = 24; + static const int16 procbuywine = 24; - const int16 proccallsguards = 25; + static const int16 proccallsguards = 25; - const int16 procgreetsmonk = 26; + static const int16 procgreetsmonk = 26; - const int16 procfall_down_oubliette = 27; + static const int16 procfall_down_oubliette = 27; - const int16 procmeet_avaroid = 28; + static const int16 procmeet_avaroid = 28; - const int16 procrise_up_oubliette = 29; + static const int16 procrise_up_oubliette = 29; - const int16 procrobin_hood_and_geida = 2; + static const int16 procrobin_hood_and_geida = 2; - const int16 procrobin_hood_and_geida_talk = 30; + static const int16 procrobin_hood_and_geida_talk = 30; - const int16 procavalot_returns = 31; + static const int16 procavalot_returns = 31; - const int16 procavvy_sit_down = 33; /* In Nottingham. */ + static const int16 procavvy_sit_down = 33; /* In Nottingham. */ - const int16 procghost_room_phew = 34; + static const int16 procghost_room_phew = 34; - const int16 procarkata_shouts = 35; + static const int16 procarkata_shouts = 35; - const int16 procwinning = 36; + static const int16 procwinning = 36; - const int16 procavalot_falls = 37; + static const int16 procavalot_falls = 37; - const int16 procspludwick_goes_to_cauldron = 39; + static const int16 procspludwick_goes_to_cauldron = 39; - const int16 procspludwick_leaves_cauldron = 40; + static const int16 procspludwick_leaves_cauldron = 40; - const int16 procgive_lute_to_geida = 41; + static const int16 procgive_lute_to_geida = 41; struct timetype { int32 time_left; @@ -160,9 +161,15 @@ namespace Avalanche { byte what_for; }; - timetype times[7] = {{0,0,0}}; + timetype times[7]; + + + + Timeout(); + + void setParent(AvalancheEngine *vm); void set_up_timer(int32 howlong, byte whither, byte why); @@ -252,7 +259,11 @@ namespace Avalanche { void give_lute_to_geida(); - } // End of namespace Timeout. +private: + AvalancheEngine *_vm; + + byte fv; +}; } // End of namespace Avalanche. From c9baa8f456813222f386614d56d6bda95e7719e4 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 10:13:02 +0200 Subject: [PATCH 0059/1332] AVALANCHE: Trip: replace namespace with class. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/trip6.cpp | 2541 ++++++++++++++++--------------- engines/avalanche/trip6.h | 304 ++-- 4 files changed, 1465 insertions(+), 1383 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d9a37296cb69..f8dee8ea3fa2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -58,6 +58,7 @@ namespace Avalanche { _celer.setParent(this); _sequence.setParent(this); _timeout.setParent(this); + _trip.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 8200a50116cb..42523012fe86 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -40,6 +40,7 @@ #include "avalanche/celer2.h" #include "avalanche/sequence2.h" #include "avalanche/timeout2.h" +#include "avalanche/trip6.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -67,6 +68,7 @@ class AvalancheEngine : public Engine { Celer _celer; Sequence _sequence; Timeout _timeout; + Trip _trip; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index ac0e8d0609ba..f0d2abc3d417 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -31,6 +31,8 @@ #include "common/scummsys.h" #include "common/textconsole.h" +#include "avalanche/avalanche.h" + #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" #include "avalanche/visa2.h" @@ -45,1447 +47,1458 @@ namespace Avalanche { - namespace Trip { - - void loadtrip() { - byte gm; - - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); - for (int i = 0; i < sizeof(aa); aa[i] = 0); + +triptype *triptype::init(byte spritenum, bool do_check, Trip *tr) { + warning("STUB: Trip::init()"); + _tr = tr; + return this; +} + +void triptype::original() { + quick = false; + whichsprite = 177; +} + +void triptype::andexor() { + warning("STUB: Trip::andexor()"); +} + +void triptype::turn(byte whichway) { + if (whichway == 8) face = 0; + else face = whichway; +} + +void triptype::appear(int16 wx, int16 wy, byte wf) { + x = (wx / 8) * 8; + y = wy; + ox[_tr->_vm->_gyro.cp] = wx; + oy[_tr->_vm->_gyro.cp] = wy; + turn(wf); + visible = true; + ix = 0; + iy = 0; +} + +bool triptype::collision_check() { + byte fv; + + bool collision_check_result; + for (fv = 1; fv <= _tr->numtr; fv ++) + if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && + ((x + a.xl) > _tr->tr[fv].x) && + (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && + (_tr->tr[fv].y == y)) { + collision_check_result = true; + return collision_check_result; + } + collision_check_result = false; + return collision_check_result; +} + +void triptype::walk() { + warning("STUB: Trip::walk()"); +} + +void triptype::bounce() { + x = ox[_tr->_vm->_gyro.cp]; + y = oy[_tr->_vm->_gyro.cp]; + if (check_me) _tr->stopwalking(); + else stopwalk(); + _tr->_vm->_gyro.oncandopageswap = false; + _tr->_vm->_lucerna.showrw(); + _tr->_vm->_gyro.oncandopageswap = true; +} + +int8 triptype::sgn(int16 x) { + int8 sgn_result; + if (x > 0) sgn_result = 1; + else if (x < 0) sgn_result = -1; + else + sgn_result = 0; /* x=0 */ + return sgn_result; +} + +void triptype::walkto(byte pednum) { + speed(sgn(_tr->_vm->_gyro.peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro.peds[pednum].y - y)); + hx = _tr->_vm->_gyro.peds[pednum].x - a.xl / 2; + hy = _tr->_vm->_gyro.peds[pednum].y - a.yl; + homing = true; +} + +void triptype::stophoming() { + homing = false; +} + +void triptype::homestep() { + int16 temp; + + if ((hx == x) && (hy == y)) { + /* touching the target */ + stopwalk(); + return; } - - byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - byte a, c; - int16 fv, ff; - - /* if not alive then begin checkfeet:=0; exit; end;*/ - byte checkfeet_result; - a = 0; - - warning("STUB: Trip::checkfeet()"); - - checkfeet_result = a; - return checkfeet_result; + ix = 0; + iy = 0; + if (hy != y) { + temp = hy - y; + if (temp > 4) iy = 4; + else if (temp < -4) iy = -4; + else iy = temp; } + if (hx != x) { + temp = hx - x; + if (temp > 4) ix = 4; + else if (temp < -4) ix = -4; + else ix = temp; + } +} + +void triptype::speed(int8 xx, int8 yy) { + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) return; /* no movement */ + if (ix == 0) { + /* No horz movement */ + if (iy < 0) turn(_tr->up); + else turn(_tr->down); + } else { + if (ix < 0) turn(_tr->left); + else turn(_tr->right); + } +} + +void triptype::stopwalk() { + ix = 0; + iy = 0; + homing = false; +} + +void triptype::chatter() { + _tr->_vm->_gyro.talkx = x + a.xl / 2; + _tr->_vm->_gyro.talky = y; + _tr->_vm->_gyro.talkf = a.fgc; + _tr->_vm->_gyro.talkb = a.bgc; +} + +void triptype::set_up_saver(trip_saver_type &v) { + v.whichsprite = whichsprite; + v.face = face; + v.step = step; + v.x = x; + v.y = y; + v.ix = ix; + v.iy = iy; + v.visible = visible; + v.homing = homing; + v.check_me = check_me; + v.count = count; + v.xw = xw; + v.xs = xs; + v.ys = ys; + v.totalnum = totalnum; + v.hx = hx; + v.hy = hy; + v.call_eachstep = call_eachstep; + v.eachstep = eachstep; + v.vanishifstill = vanishifstill; +} + +void triptype::unload_saver(trip_saver_type v) { + whichsprite = v.whichsprite; + face = v.face; + step = v.step; + x = v.x; + y = v.y; + ix = v.ix; + iy = v.iy; + visible = v.visible; + homing = v.homing; + check_me = v.check_me; + count = v.count; + xw = v.xw; + xs = v.xs; + ys = v.ys; + totalnum = v.totalnum; + hx = v.hx; + hy = v.hy; + call_eachstep = v.call_eachstep; + eachstep = v.eachstep; + vanishifstill = v.vanishifstill; +} + +void triptype::savedata(/*untyped_file &f*/) { + warning("STUB: _vm->_timeout.savedata()"); +} + +void triptype::loaddata(/*untyped_file &f*/) { + warning("STUB: _vm->_timeout.loaddata()"); +} + +void triptype::save_data_to_mem(uint16 &where) { + warning("STUB: save_data_to_mem()"); +} + +void triptype::load_data_from_mem(uint16 &where) { + warning("STUB: load_data_from_mem()"); +} + +triptype *triptype::done() { + int16 gd, gm; + Common::String xx; + byte fv/*,nds*/; + byte aa, bb; + int32 id; + uint16 soa; - byte geida_ped(byte which) { - byte geida_ped_result; - switch (which) { - case 1: - geida_ped_result = 7; - break; - case 2: - case 6: - geida_ped_result = 8; - break; - case 3: - case 5: - geida_ped_result = 9; - break; - case 4: - geida_ped_result = 10; - break; + { + adxtype &with = a; + + /* nds:=num div seq;*/ + xw = with.xl / 8; + if ((with.xl % 8) > 0) xw += 1; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { + totalnum --; + free(mani[totalnum]); + free(sil[totalnum]); /* <<- Width of a siltype. */ } - return geida_ped_result; } - void catamove(byte ped) - /* When you enter a new position in the catacombs, this procedure should - be called. It changes the Also codes so that they may match the picture - on the screen. (Coming soon: It draws up the screen, too.) */ - { + quick = false; + whichsprite = 177; + return this; +} - warning("Repair array indexes in Trip::catamove()"); - int32 here; - uint16 xy_uint16; - byte fv, ff; - /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the - catacombs has a different number for it. */ - - xy_uint16 = Gyro::dna.cat_x + Gyro::dna.cat_y * 256; - Gyro::dna.geida_spin = 0; - - switch (xy_uint16) { - case 1801: { /* Exit catacombs */ - fliproom(r__lustiesroom, 4); - Scrolls::display("Phew! Nice to be out of there!"); - return; - } - break; - case 1033: { /* Oubliette */ - fliproom(r__oubliette, 1); - Scrolls::display("Oh, NO!\231\2"); - return; - } - break; - case 4: { - fliproom(r__geidas, 1); - return; - } - break; - case 2307: { - fliproom(r__lusties, 5); - Scrolls::display("Oh no... here we go again..."); - Gyro::dna.user_moves_avvy = false; - tr[1].iy = 1; - tr[1].ix = 0; - return; - } - break; - } - if (! Gyro::dna.enter_catacombs_from_lusties_room) Lucerna::load(29); - here = Gyro::catamap[Gyro::dna.cat_y][Gyro::dna.cat_x]; +getsettype *getsettype::init() { + numleft = 0; /* initialise array pointer */ + return this; +} - switch (here & 0xf) { /* West. */ - case 0: { /* no connection (wall) */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::nix; /* Door. */ - Celer::show_one(28); - } - break; - case 0x1: { /* no connection (wall + shield), */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::nix; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(29); /* ...shield. */ - } - break; - case 0x2: { /* wall with door */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::special; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(30); /* ...door. */ - } - break; - case 0x3: { /* wall with door and shield */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::special; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(30); /* ...door, and... */ - Celer::show_one(29); /* ...shield. */ - } - break; - case 0x4: { /* no connection (wall + window), */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::nix; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(5); /* ...window. */ - } - break; - case 0x5: { /* wall with door and window */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::special; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(30); /* ...door, and... */ - Celer::show_one(5); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::nix; /* No door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(7); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - Gyro::magics[2].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[13].op = Gyro::special; /* Door. */ - Celer::show_one(28); /* Wall, plus... */ - Celer::show_one(30); /* ...door, and... */ - Celer::show_one(7); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - Gyro::magics[2].op = Gyro::nix; /* Sloping wall. */ - Gyro::magics[3].op = Gyro::special; /* Straight wall. */ - } - break; - } +void getsettype::remember(bytefield r) { + numleft ++; + warning("STUB: _vm->_timeout.getsettype::remember()"); + gs[numleft] = r; +} - /* ---- */ +void getsettype::recall(bytefield &r) { + r = gs[numleft]; + numleft --; +} - switch ((here & 0xf0) >> 4) { /* East */ - case 0: { /* no connection (wall) */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::nix; /* Door. */ - Celer::show_one(19); - } - break; - case 0x1: { /* no connection (wall + window), */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::nix; /* Door. */ - Celer::show_one(19); /* Wall, plus... */ - Celer::show_one(20); /* ...window. */ - } - break; - case 0x2: { /* wall with door */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::special; /* Door. */ - Celer::show_one(19); /* Wall, plus... */ - Celer::show_one(21); /* ...door. */ - } - break; - case 0x3: { /* wall with door and window */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::special; /* Door. */ - Celer::show_one(19); /* Wall, plus... */ - Celer::show_one(20); /* ...door, and... */ - Celer::show_one(21); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::nix; /* No door. */ - Celer::show_one(19); /* Wall, plus... */ - Celer::show_one(18); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ - Gyro::magics[5].op = Gyro::bounces; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::nix; /* Straight wall. */ - Gyro::portals[15].op = Gyro::special; /* Door. */ - Celer::show_one(19); /* Wall, plus... */ - Celer::show_one(21); /* ...door, and... */ - Celer::show_one(18); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ - Gyro::magics[5].op = Gyro::nix; /* Sloping wall. */ - Gyro::magics[6].op = Gyro::special; /* Straight wall. */ - Gyro::portals[15].op = Gyro::nix; /* Door. */ - } - break; - } - /* ---- */ - switch ((here & 0xf00) >> 8) { /* South */ - case 0: { /* No connection. */ - Gyro::magics[7].op = Gyro::bounces; - Gyro::magics[12].op = Gyro::bounces; - Gyro::magics[13].op = Gyro::bounces; - } - break; - case 0x1: { - Celer::show_one(22); - - if ((xy_uint16 == 2051) & (Gyro::dna.geida_follows)) - Gyro::magics[13].op = Gyro::exclaim; - else Gyro::magics[13].op = Gyro::special; /* Right exit south. */ - Gyro::magics[7].op = Gyro::bounces; - Gyro::magics[12].op = Gyro::bounces; - } - break; - case 0x2: { - Celer::show_one(23); - Gyro::magics[7].op = Gyro::special; /* Middle exit south. */ - Gyro::magics[12].op = Gyro::bounces; - Gyro::magics[13].op = Gyro::bounces; - } - break; - case 0x3: { - Celer::show_one(24); - Gyro::magics[12].op = Gyro::special; /* Left exit south. */ - Gyro::magics[7].op = Gyro::bounces; - Gyro::magics[13].op = Gyro::bounces; - } - break; - } - switch ((here & 0xf000) >> 12) { /* North */ - case 0: { /* No connection */ - Gyro::magics[1].op = Gyro::bounces; - Gyro::portals[12].op = Gyro::nix; /* Door. */ - } - break; - /* LEFT handles: */ - /* $1: begin - Celer::show_one(4); - Gyro::magics[1].op:=Gyro::bounces; { Left exit north. } { Change magic number! } - Gyro::portals[12].op:=Gyro::special; { Door. } - end;*/ - case 0x2: { - Celer::show_one(4); - Gyro::magics[1].op = Gyro::bounces; /* Middle exit north. */ - Gyro::portals[12].op = Gyro::special; /* Door. */ - } - break; - /* $3: begin - Celer::show_one(4); - Gyro::magics[1].op:=Gyro::bounces; { Right exit north. } { Change magic number! } - Gyro::portals[12].op:=Gyro::special; { Door. } - end; - { RIGHT handles: } - $4: begin - Celer::show_one(3); - Gyro::magics[1].op:=Gyro::bounces; { Left exit north. } { Change magic number! } - Gyro::portals[12].op:=Gyro::special; { Door. } - end;*/ - case 0x5: { - Celer::show_one(3); - Gyro::magics[1].op = Gyro::bounces; /* Middle exit north. */ - Gyro::portals[12].op = Gyro::special; /* Door. */ - } - break; - /* $6: begin - Celer::show_one(3); - Gyro::magics[1].op:=Gyro::bounces; { Right exit north. } - Gyro::portals[12].op:=Gyro::special; { Door. } - end;*/ - /* ARCHWAYS: */ - case 0x7: - case 0x8: - case 0x9: { - Celer::show_one(6); - - if (((here & 0xf000) >> 12) > 0x7) Celer::show_one(31); - if (((here & 0xf000) >> 12) == 0x9) Celer::show_one(32); - - Gyro::magics[1].op = Gyro::special; /* Middle arch north. */ - Gyro::portals[12].op = Gyro::nix; /* Door. */ - } - break; - /* DECORATIONS: */ - case 0xd: { /* No connection + WINDOW */ - Gyro::magics[1].op = Gyro::bounces; - Gyro::portals[12].op = Gyro::nix; /* Door. */ - Celer::show_one(14); - } - break; - case 0xe: { /* No connection + TORCH */ - Gyro::magics[1].op = Gyro::bounces; - Gyro::portals[12].op = Gyro::nix; /* Door. */ - Celer::show_one(8); - } - break; - /* Recessed door: */ - case 0xf: { - Gyro::magics[1].op = Gyro::nix; /* Door to Geida's room. */ - Celer::show_one(1); - Gyro::portals[12].op = Gyro::special; /* Door. */ - } - break; - } - switch (xy_uint16) { - case 514: - Celer::show_one(17); - break; /* [2,2] : "Art Gallery" sign over door. */ - case 264: - Celer::show_one(9); - break; /* [8,1] : "The Wrong Way!" sign. */ - case 1797: - Celer::show_one(2); - break; /* [5,7] : "Ite Mingite" sign. */ - case 258: - for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ - Celer::show_one_at(15, 130 + fv * 120, 70); - Celer::show_one_at(16, 184 + fv * 120, 78); - } - break; - case 1287: - for (fv = 10; fv <= 13; fv ++) Celer::show_one(fv); - break; /* [7,5] : 4 candles. */ - case 776: - Celer::show_one(10); - break; /* [8,3] : 1 candle. */ - case 2049: - Celer::show_one(11); - break; /* [1,8] : another candle. */ - case 257: { - Celer::show_one(12); - Celer::show_one(13); - } - break; /* [1,1] : the other two. */ - } +Trip::Trip() { + getsetclear(); + mustexclaim = false; +} - if ((Gyro::dna.geida_follows) & (ped > 0)) { - triptype &with = tr[2]; +void Trip::setParent(AvalancheEngine *vm) { + _vm = vm; +} - if (! with.quick) /* If we don't already have her... */ - tr[2].init(5, true); /* ...Load Geida. */ - apped(2, geida_ped(ped)); - tr[2].call_eachstep = true; - tr[2].eachstep = procgeida_procs; - } - } - void call_special(uint16 which); +void Trip::loadtrip() { + byte gm; - /* This proc gets called whenever you touch a line defined as Gyro::special. */ - static void dawndelay() { - Timeout::set_up_timer(2, Timeout::procdawn_delay, Timeout::reason_dawndelay); - } + for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + for (int i = 0; i < sizeof(aa); aa[i] = 0); +} - void call_special(uint16 which) { - switch (which) { - case 1: { /* Gyro::special 1: Room 22: top of stairs. */ - Celer::show_one(1); - Gyro::dna.brummie_stairs = 1; - Gyro::magics[10].op = Gyro::nix; - Timeout::set_up_timer(10, Timeout::procstairs, Timeout::reason_brummiestairs); - stopwalking(); - Gyro::dna.user_moves_avvy = false; - } +byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { + byte a, c; + int16 fv, ff; + + /* if not alive then begin checkfeet:=0; exit; end;*/ + byte checkfeet_result; + a = 0; + + warning("STUB: Trip::checkfeet()"); + + checkfeet_result = a; + return checkfeet_result; +} + +byte Trip::geida_ped(byte which) { + byte geida_ped_result; + switch (which) { + case 1: + geida_ped_result = 7; break; - case 2: { /* Gyro::special 2: Room 22: bottom of stairs. */ - Gyro::dna.brummie_stairs = 3; - Gyro::magics[11].op = Gyro::nix; - Gyro::magics[12].op = Gyro::exclaim; - Gyro::magics[12].data = 5; - Gyro::magics[4].op = Gyro::bounces; /* Now works as planned! */ - stopwalking(); - Visa::dixi('q', 26); - Gyro::dna.user_moves_avvy = true; - } + case 2: + case 6: + geida_ped_result = 8; break; - case 3: { /* Gyro::special 3: Room 71: triggers dart. */ - tr[1].bounce(); /* Must include that. */ - - if (! Gyro::dna.arrow_triggered) { - Gyro::dna.arrow_triggered = true; - apped(2, 4); /* The dart starts at ped 4, and... */ - tr[2].walkto(5); /* flies to ped 5. */ - tr[2].face = 0; /* Only face. */ - /* Should call some kind of Eachstep procedure which will deallocate - the sprite when it hits the wall, and replace it with the chunk - graphic of the arrow buried in the plaster. */ - /* OK! */ - tr[2].call_eachstep = true; - tr[2].eachstep = procarrow_procs; - } - } + case 3: + case 5: + geida_ped_result = 9; break; - - case 4: { /* This is the ghost room link. */ - Lucerna::dusk(); - tr[1].turn(right); /* you'll see this after we get back from bootstrap */ - Timeout::set_up_timer(1, Timeout::procghost_room_phew, Timeout::reason_ghost_room_phew); - Enid::back_to_bootstrap(3); - } + case 4: + geida_ped_result = 10; break; + } + return geida_ped_result; +} - case 5: - if (Gyro::dna.friar_will_tie_you_up) { - /* Gyro::special 5: Room 42: touched tree, and get tied up. */ - Gyro::magics[4].op = Gyro::bounces; /* Boundary effect is now working again. */ - Visa::dixi('q', 35); - tr[1].done(); - /*tr[1].vanishifstill:=true;*/ - Celer::show_one(2); - Visa::dixi('q', 36); - Gyro::dna.tied_up = true; - Gyro::dna.friar_will_tie_you_up = false; - tr[2].walkto(3); - tr[2].vanishifstill = true; - tr[2].check_me = true; /* One of them must have Check_Me switched on. */ - Gyro::whereis[Gyro::pfriartuck] = 177; /* Not here, then. */ - Timeout::set_up_timer(364, Timeout::prochang_around, Timeout::reason_hanging_around); - } - break; +void Trip::catamove(byte ped) +/* When you enter a new position in the catacombs, this procedure should + be called. It changes the Also codes so that they may match the picture + on the screen. (Coming soon: It draws up the screen, too.) */ +{ - case 6: { /* Gyro::special 6: fall down oubliette. */ - Gyro::dna.user_moves_avvy = false; - tr[1].ix = 3; - tr[1].iy = 0; - tr[1].face = right; - Timeout::set_up_timer(1, Timeout::procfall_down_oubliette, Timeout::reason_falling_down_oubliette); - } - break; + warning("Repair array indexes in Trip::catamove()"); - case 7: { /* Gyro::special 7: stop falling down oubliette. */ - tr[1].visible = false; - Gyro::magics[10].op = Gyro::nix; - stopwalking(); - Timeout::lose_timer(Timeout::reason_falling_down_oubliette); - Lucerna::mblit(12, 80, 38, 160, 3, 0); - Lucerna::mblit(12, 80, 38, 160, 3, 1); - Scrolls::display("Oh dear, you seem to be down the bottom of an oubliette."); - Timeout::set_up_timer(200, Timeout::procmeet_avaroid, Timeout::reason_meeting_avaroid); - } - break; + int32 here; + uint16 xy_uint16; + byte fv, ff; - case 8: /* Gyro::special 8: leave du Lustie's room. */ - if ((Gyro::dna.geida_follows) && (! Gyro::dna.lustie_is_asleep)) { - Visa::dixi('q', 63); - tr[2].turn(down); - tr[2].stopwalk(); - tr[2].call_eachstep = false; /* Geida */ - Lucerna::gameover(); - } - break; + /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the + catacombs has a different number for it. */ - case 9: { /* Gyro::special 9: lose Geida to Robin Hood... */ - if (! Gyro::dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ - tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ - tr[2].walkto(4); /* She walks to somewhere... */ - tr[1].done(); /* Lose Avvy. */ - Gyro::dna.user_moves_avvy = false; - Timeout::set_up_timer(40, Timeout::procrobin_hood_and_geida, Timeout::reason_robin_hood_and_geida); - } - break; - case 10: { /* Gyro::special 10: transfer north in catacombs. */ - if ((Gyro::dna.cat_x == 4) && (Gyro::dna.cat_y == 1)) { - /* Into Geida's room. */ - if (Gyro::dna.obj[Gyro::key]) Visa::dixi('q', 62); - else { - Visa::dixi('q', 61); - return; - } - } - Lucerna::dusk(); - Gyro::dna.cat_y -= 1; - catamove(4); - if (Gyro::dna.room != r__catacombs) return; - Lucerna::delavvy(); - switch ((Gyro::catamap[Gyro::dna.cat_y][Gyro::dna.cat_x] & 0xf00) >> 8) { - case 0x1: - apped(1, 12); - break; - case 0x3: - apped(1, 11); - break; - default: - apped(1, 4); - } - getback(); - dawndelay(); - } - break; - case 11: { /* Gyro::special 11: transfer east in catacombs. */ - Lucerna::dusk(); - Gyro::dna.cat_x += 1; - catamove(1); - if (Gyro::dna.room != r__catacombs) return; - Lucerna::delavvy(); - apped(1, 1); - getback(); - dawndelay(); - } - break; - case 12: { /* Gyro::special 12: transfer south in catacombs. */ - Lucerna::dusk(); - Gyro::dna.cat_y += 1; - catamove(2); - if (Gyro::dna.room != r__catacombs) return; - Lucerna::delavvy(); - apped(1, 2); - getback(); - dawndelay(); - } - break; - case 13: { /* Gyro::special 13: transfer west in catacombs. */ - Lucerna::dusk(); - Gyro::dna.cat_x -= 1; - catamove(3); - if (Gyro::dna.room != r__catacombs) return; - Lucerna::delavvy(); - apped(1, 3); - getback(); - dawndelay(); - } - break; - } + + xy_uint16 = _vm->_gyro.dna.cat_x + _vm->_gyro.dna.cat_y * 256; + _vm->_gyro.dna.geida_spin = 0; + + switch (xy_uint16) { + case 1801: { /* Exit catacombs */ + fliproom(r__lustiesroom, 4); + _vm->_scrolls.display("Phew! Nice to be out of there!"); + return; + } + break; + case 1033: { /* Oubliette */ + fliproom(r__oubliette, 1); + _vm->_scrolls.display("Oh, NO!\231\2"); + return; + } + break; + case 4: { + fliproom(r__geidas, 1); + return; + } + break; + case 2307: { + fliproom(r__lusties, 5); + _vm->_scrolls.display("Oh no... here we go again..."); + _vm->_gyro.dna.user_moves_avvy = false; + tr[1].iy = 1; + tr[1].ix = 0; + return; + } + break; } - void hide_in_the_cupboard(); + if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) _vm->_lucerna.load(29); + here = _vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x]; - void open_the_door(byte whither, byte ped, byte magicnum) - /* This slides the door open. (The data really ought to be saved in - the Also file, and will be next time. However, for now, they're - here.) */ - { - switch (Gyro::dna.room) { - case r__outsideyours: - case r__outsidenottspub: - case r__outsideducks: { - Sequence::first_show(1); - Sequence::then_show(2); - Sequence::then_show(3); - } - break; - case r__insidecardiffcastle: { - Sequence::first_show(1); - Sequence::then_show(5); - } - break; - case r__avvysgarden: - case r__entrancehall: - case r__insideabbey: { - Sequence::first_show(1); - Sequence::then_show(2); - } - break; - case r__musicroom: - case r__outsideargentpub: { - Sequence::first_show(5); - Sequence::then_show(6); - } - break; - case r__lusties: - switch (magicnum) { - case 14: - if (Gyro::dna.avvys_in_the_cupboard) { - hide_in_the_cupboard(); - Sequence::first_show(8); - Sequence::then_show(7); - Sequence::start_to_close(); - return; - } else { - apped(1, 6); - tr[1].face = right; /* added by TT 12/3/1995 */ - Sequence::first_show(8); - Sequence::then_show(9); - } - break; - case 12: { - Sequence::first_show(4); - Sequence::then_show(5); - Sequence::then_show(6); - } - break; - } - break; - } - - Sequence::then_flip(whither, ped); - Sequence::start_to_open(); + switch (here & 0xf) { /* West. */ + case 0: { /* no connection (wall) */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(28); } - - void newspeed() { - /* Given that you've just changed the speed in triptype.xs, this adjusts - ix. */ - warning("STUB: Trip::newspeed()"); + break; + case 0x1: { /* no connection (wall + shield), */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(29); /* ...shield. */ } - - triptype *triptype::init(byte spritenum, bool do_check) { - warning("STUB: Trip::init()"); - return this; + break; + case 0x2: { /* wall with door */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(30); /* ...door. */ } - - void triptype::original() { - quick = false; - whichsprite = 177; + break; + case 0x3: { /* wall with door and shield */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(30); /* ...door, and... */ + _vm->_celer.show_one(29); /* ...shield. */ } - - void triptype::andexor() { - warning("STUB: Trip::andexor()"); + break; + case 0x4: { /* no connection (wall + window), */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(5); /* ...window. */ } - - void triptype::turn(byte whichway) { - if (whichway == 8) face = 0; - else face = whichway; + break; + case 0x5: { /* wall with door and window */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(30); /* ...door, and... */ + _vm->_celer.show_one(5); /* ...window. */ } - - void triptype::appear(int16 wx, int16 wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox[Gyro::cp] = wx; - oy[Gyro::cp] = wy; - turn(wf); - visible = true; - ix = 0; - iy = 0; + break; + case 0x6: { /* no connection (wall + torches), */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* No door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(7); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(28); /* Wall, plus... */ + _vm->_celer.show_one(30); /* ...door, and... */ + _vm->_celer.show_one(7); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* Sloping wall. */ + _vm->_gyro.magics[3].op = _vm->_gyro.special; /* Straight wall. */ + } + break; } + /* ---- */ + switch ((here & 0xf0) >> 4) { /* East */ + case 0: { /* no connection (wall) */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(19); + } + break; + case 0x1: { /* no connection (wall + window), */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(19); /* Wall, plus... */ + _vm->_celer.show_one(20); /* ...window. */ + } + break; + case 0x2: { /* wall with door */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(19); /* Wall, plus... */ + _vm->_celer.show_one(21); /* ...door. */ + } + break; + case 0x3: { /* wall with door and window */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(19); /* Wall, plus... */ + _vm->_celer.show_one(20); /* ...door, and... */ + _vm->_celer.show_one(21); /* ...window. */ + } + break; + case 0x6: { /* no connection (wall + torches), */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* No door. */ + _vm->_celer.show_one(19); /* Wall, plus... */ + _vm->_celer.show_one(18); /* ...torches. */ + } + break; + case 0x7: { /* wall with door and torches */ + _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_celer.show_one(19); /* Wall, plus... */ + _vm->_celer.show_one(21); /* ...door, and... */ + _vm->_celer.show_one(18); /* ...torches. */ + } + break; + case 0xf: { /* straight-through corridor. */ + _vm->_gyro.magics[5].op = _vm->_gyro.nix; /* Sloping wall. */ + _vm->_gyro.magics[6].op = _vm->_gyro.special; /* Straight wall. */ + _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + } + break; + } + /* ---- */ - bool triptype::collision_check() { - byte fv; - - bool collision_check_result; - for (fv = 1; fv <= numtr; fv ++) - if (tr[fv].quick && (tr[fv].whichsprite != whichsprite) && - ((x + a.xl) > tr[fv].x) && - (x < (tr[fv].x + tr[fv].a.xl)) && - (tr[fv].y == y)) { - collision_check_result = true; - return collision_check_result; - } - collision_check_result = false; - return collision_check_result; + switch ((here & 0xf00) >> 8) { /* South */ + case 0: { /* No connection. */ + _vm->_gyro.magics[7].op = _vm->_gyro.bounces; + _vm->_gyro.magics[12].op = _vm->_gyro.bounces; + _vm->_gyro.magics[13].op = _vm->_gyro.bounces; } + break; + case 0x1: { + _vm->_celer.show_one(22); + + if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows)) + _vm->_gyro.magics[13].op = _vm->_gyro.exclaim; + else _vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */ - void triptype::walk() { - warning("STUB: Trip::walk()"); + _vm->_gyro.magics[7].op = _vm->_gyro.bounces; + _vm->_gyro.magics[12].op = _vm->_gyro.bounces; } - - void triptype::bounce() { - x = ox[Gyro::cp]; - y = oy[Gyro::cp]; - if (check_me) stopwalking(); - else stopwalk(); - Gyro::oncandopageswap = false; - Lucerna::showrw(); - Gyro::oncandopageswap = true; + break; + case 0x2: { + _vm->_celer.show_one(23); + _vm->_gyro.magics[7].op = _vm->_gyro.special; /* Middle exit south. */ + _vm->_gyro.magics[12].op = _vm->_gyro.bounces; + _vm->_gyro.magics[13].op = _vm->_gyro.bounces; } - - int8 sgn(int16 x) { - int8 sgn_result; - if (x > 0) sgn_result = 1; - else if (x < 0) sgn_result = -1; - else - sgn_result = 0; /* x=0 */ - return sgn_result; + break; + case 0x3: { + _vm->_celer.show_one(24); + _vm->_gyro.magics[12].op = _vm->_gyro.special; /* Left exit south. */ + _vm->_gyro.magics[7].op = _vm->_gyro.bounces; + _vm->_gyro.magics[13].op = _vm->_gyro.bounces; + } + break; } - void triptype::walkto(byte pednum) { - speed(sgn(Gyro::peds[pednum].x - x) * 4, sgn(Gyro::peds[pednum].y - y)); - hx = Gyro::peds[pednum].x - a.xl / 2; - hy = Gyro::peds[pednum].y - a.yl; - homing = true; + switch ((here & 0xf000) >> 12) { /* North */ + case 0: { /* No connection */ + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; + _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + } + break; + /* LEFT handles: */ + /* $1: begin + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } + end;*/ + case 0x2: { + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ + _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ + } + break; + /* $3: begin + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } { Change magic number! } + _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } + end; + { RIGHT handles: } + $4: begin + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } + end;*/ + case 0x5: { + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ + _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ + } + break; + /* $6: begin + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } + _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } + end;*/ + /* ARCHWAYS: */ + case 0x7: + case 0x8: + case 0x9: { + _vm->_celer.show_one(6); + + if (((here & 0xf000) >> 12) > 0x7) _vm->_celer.show_one(31); + if (((here & 0xf000) >> 12) == 0x9) _vm->_celer.show_one(32); + + _vm->_gyro.magics[1].op = _vm->_gyro.special; /* Middle arch north. */ + _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + } + break; + /* DECORATIONS: */ + case 0xd: { /* No connection + WINDOW */ + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; + _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(14); + } + break; + case 0xe: { /* No connection + TORCH */ + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; + _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_celer.show_one(8); + } + break; + /* Recessed door: */ + case 0xf: { + _vm->_gyro.magics[1].op = _vm->_gyro.nix; /* Door to Geida's room. */ + _vm->_celer.show_one(1); + _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ + } + break; } - void triptype::stophoming() { - homing = false; + switch (xy_uint16) { + case 514: + _vm->_celer.show_one(17); + break; /* [2,2] : "Art Gallery" sign over door. */ + case 264: + _vm->_celer.show_one(9); + break; /* [8,1] : "The Wrong Way!" sign. */ + case 1797: + _vm->_celer.show_one(2); + break; /* [5,7] : "Ite Mingite" sign. */ + case 258: + for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ + _vm->_celer.show_one_at(15, 130 + fv * 120, 70); + _vm->_celer.show_one_at(16, 184 + fv * 120, 78); + } + break; + case 1287: + for (fv = 10; fv <= 13; fv ++) _vm->_celer.show_one(fv); + break; /* [7,5] : 4 candles. */ + case 776: + _vm->_celer.show_one(10); + break; /* [8,3] : 1 candle. */ + case 2049: + _vm->_celer.show_one(11); + break; /* [1,8] : another candle. */ + case 257: { + _vm->_celer.show_one(12); + _vm->_celer.show_one(13); + } + break; /* [1,1] : the other two. */ } - void triptype::homestep() { - int16 temp; + if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) { + triptype &with = tr[2]; - if ((hx == x) && (hy == y)) { - /* touching the target */ - stopwalk(); - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; + if (! with.quick) /* If we don't already have her... */ + tr[2].init(5, true, this); /* ...Load Geida. */ + apped(2, geida_ped(ped)); + tr[2].call_eachstep = true; + tr[2].eachstep = procgeida_procs; + } +} + + + +/* This proc gets called whenever you touch a line defined as _vm->_gyro.special. */ +void Trip::dawndelay() { + _vm->_timeout.set_up_timer(2, _vm->_timeout.procdawn_delay, _vm->_timeout.reason_dawndelay); +} + +void Trip::call_special(uint16 which) { + switch (which) { + case 1: { /* _vm->_gyro.special 1: Room 22: top of stairs. */ + _vm->_celer.show_one(1); + _vm->_gyro.dna.brummie_stairs = 1; + _vm->_gyro.magics[10].op = _vm->_gyro.nix; + _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); + stopwalking(); + _vm->_gyro.dna.user_moves_avvy = false; + } + break; + case 2: { /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ + _vm->_gyro.dna.brummie_stairs = 3; + _vm->_gyro.magics[11].op = _vm->_gyro.nix; + _vm->_gyro.magics[12].op = _vm->_gyro.exclaim; + _vm->_gyro.magics[12].data = 5; + _vm->_gyro.magics[4].op = _vm->_gyro.bounces; /* Now works as planned! */ + stopwalking(); + _vm->_visa.dixi('q', 26); + _vm->_gyro.dna.user_moves_avvy = true; + } + break; + case 3: { /* _vm->_gyro.special 3: Room 71: triggers dart. */ + tr[1].bounce(); /* Must include that. */ + + if (! _vm->_gyro.dna.arrow_triggered) { + _vm->_gyro.dna.arrow_triggered = true; + apped(2, 4); /* The dart starts at ped 4, and... */ + tr[2].walkto(5); /* flies to ped 5. */ + tr[2].face = 0; /* Only face. */ + /* Should call some kind of Eachstep procedure which will deallocate + the sprite when it hits the wall, and replace it with the chunk + graphic of the arrow buried in the plaster. */ + /* OK! */ + tr[2].call_eachstep = true; + tr[2].eachstep = procarrow_procs; } } + break; - void triptype::speed(int8 xx, int8 yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ - if (ix == 0) { - /* No horz movement */ - if (iy < 0) turn(up); - else turn(down); - } else { - if (ix < 0) turn(left); - else turn(right); + case 4: { /* This is the ghost room link. */ + _vm->_lucerna.dusk(); + tr[1].turn(right); /* you'll see this after we get back from bootstrap */ + _vm->_timeout.set_up_timer(1, _vm->_timeout.procghost_room_phew, _vm->_timeout.reason_ghost_room_phew); + _vm->_enid.back_to_bootstrap(3); + } + break; + + case 5: + if (_vm->_gyro.dna.friar_will_tie_you_up) { + /* _vm->_gyro.special 5: Room 42: touched tree, and get tied up. */ + _vm->_gyro.magics[4].op = _vm->_gyro.bounces; /* Boundary effect is now working again. */ + _vm->_visa.dixi('q', 35); + tr[1].done(); + /*tr[1].vanishifstill:=true;*/ + _vm->_celer.show_one(2); + _vm->_visa.dixi('q', 36); + _vm->_gyro.dna.tied_up = true; + _vm->_gyro.dna.friar_will_tie_you_up = false; + tr[2].walkto(3); + tr[2].vanishifstill = true; + tr[2].check_me = true; /* One of them must have Check_Me switched on. */ + _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = 177; /* Not here, then. */ + _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); } + break; + + case 6: { /* _vm->_gyro.special 6: fall down oubliette. */ + _vm->_gyro.dna.user_moves_avvy = false; + tr[1].ix = 3; + tr[1].iy = 0; + tr[1].face = right; + _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); } + break; - void triptype::stopwalk() { - ix = 0; - iy = 0; - homing = false; - } - - void triptype::chatter() { - Gyro::talkx = x + a.xl / 2; - Gyro::talky = y; - Gyro::talkf = a.fgc; - Gyro::talkb = a.bgc; - } - - void triptype::set_up_saver(trip_saver_type &v) { - v.whichsprite = whichsprite; - v.face = face; - v.step = step; - v.x = x; - v.y = y; - v.ix = ix; - v.iy = iy; - v.visible = visible; - v.homing = homing; - v.check_me = check_me; - v.count = count; - v.xw = xw; - v.xs = xs; - v.ys = ys; - v.totalnum = totalnum; - v.hx = hx; - v.hy = hy; - v.call_eachstep = call_eachstep; - v.eachstep = eachstep; - v.vanishifstill = vanishifstill; - } - - void triptype::unload_saver(trip_saver_type v) { - whichsprite = v.whichsprite; - face = v.face; - step = v.step; - x = v.x; - y = v.y; - ix = v.ix; - iy = v.iy; - visible = v.visible; - homing = v.homing; - check_me = v.check_me; - count = v.count; - xw = v.xw; - xs = v.xs; - ys = v.ys; - totalnum = v.totalnum; - hx = v.hx; - hy = v.hy; - call_eachstep = v.call_eachstep; - eachstep = v.eachstep; - vanishifstill = v.vanishifstill; - } - - void triptype::savedata(/*untyped_file &f*/) { - warning("STUB: Timeout::savedata()"); - } - - void triptype::loaddata(/*untyped_file &f*/) { - warning("STUB: Timeout::loaddata()"); - } - - triptype *triptype::done() { - int16 gd, gm; - Common::String xx; - byte fv/*,nds*/; - byte aa, bb; - int32 id; - uint16 soa; + case 7: { /* _vm->_gyro.special 7: stop falling down oubliette. */ + tr[1].visible = false; + _vm->_gyro.magics[10].op = _vm->_gyro.nix; + stopwalking(); + _vm->_timeout.lose_timer(_vm->_timeout.reason_falling_down_oubliette); + _vm->_lucerna.mblit(12, 80, 38, 160, 3, 0); + _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); + _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); + } + break; - { - adxtype &with = a; - - /* nds:=num div seq;*/ - xw = with.xl / 8; - if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { - totalnum --; - free(mani[totalnum]); - free(sil[totalnum]); /* <<- Width of a siltype. */ - } + case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */ + if ((_vm->_gyro.dna.geida_follows) && (! _vm->_gyro.dna.lustie_is_asleep)) { + _vm->_visa.dixi('q', 63); + tr[2].turn(down); + tr[2].stopwalk(); + tr[2].call_eachstep = false; /* Geida */ + _vm->_lucerna.gameover(); } + break; - quick = false; - whichsprite = 177; - return this; + case 9: { /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ + if (! _vm->_gyro.dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ + tr[2].walkto(4); /* She walks to somewhere... */ + tr[1].done(); /* Lose Avvy. */ + _vm->_gyro.dna.user_moves_avvy = false; + _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); } + break; - getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ - return this; + case 10: { /* _vm->_gyro.special 10: transfer north in catacombs. */ + if ((_vm->_gyro.dna.cat_x == 4) && (_vm->_gyro.dna.cat_y == 1)) { + /* Into Geida's room. */ + if (_vm->_gyro.dna.obj[_vm->_gyro.key]) _vm->_visa.dixi('q', 62); + else { + _vm->_visa.dixi('q', 61); + return; + } + } + _vm->_lucerna.dusk(); + _vm->_gyro.dna.cat_y -= 1; + catamove(4); + if (_vm->_gyro.dna.room != r__catacombs) return; + _vm->_lucerna.delavvy(); + switch ((_vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x] & 0xf00) >> 8) { + case 0x1: + apped(1, 12); + break; + case 0x3: + apped(1, 11); + break; + default: + apped(1, 4); + } + getback(); + dawndelay(); } - - void getsettype::remember(Gyro::bytefield r) { - numleft ++; - warning("STUB: Timeout::getsettype::remember()"); - gs[numleft] = r; + break; + case 11: { /* _vm->_gyro.special 11: transfer east in catacombs. */ + _vm->_lucerna.dusk(); + _vm->_gyro.dna.cat_x += 1; + catamove(1); + if (_vm->_gyro.dna.room != r__catacombs) return; + _vm->_lucerna.delavvy(); + apped(1, 1); + getback(); + dawndelay(); } - - void getsettype::recall(Gyro::bytefield &r) { - r = gs[numleft]; - numleft --; + break; + case 12: { /* _vm->_gyro.special 12: transfer south in catacombs. */ + _vm->_lucerna.dusk(); + _vm->_gyro.dna.cat_y += 1; + catamove(2); + if (_vm->_gyro.dna.room != r__catacombs) return; + _vm->_lucerna.delavvy(); + apped(1, 2); + getback(); + dawndelay(); } - - void rwsp(byte t, byte r) { - { - switch (r) { - case up: - tr[t].speed(0, -tr[t].ys); - break; - case down: - tr[t].speed(0, tr[t].ys); - break; - case left: - tr[t].speed(-tr[t].xs, 0); - break; - case right: - tr[t].speed(tr[t].xs, 0); - break; - case ul: - tr[t].speed(-tr[t].xs, -tr[t].ys); - break; - case ur: - tr[t].speed(tr[t].xs, -tr[t].ys); - break; - case dl: - tr[t].speed(-tr[t].xs, tr[t].ys); - break; - case dr: - tr[t].speed(tr[t].xs, tr[t].ys); - break; + break; + case 13: { /* _vm->_gyro.special 13: transfer west in catacombs. */ + _vm->_lucerna.dusk(); + _vm->_gyro.dna.cat_x -= 1; + catamove(3); + if (_vm->_gyro.dna.room != r__catacombs) return; + _vm->_lucerna.delavvy(); + apped(1, 3); + getback(); + dawndelay(); + } + break; + } +} + + + +void Trip::open_the_door(byte whither, byte ped, byte magicnum) +/* This slides the door open. (The data really ought to be saved in + the Also file, and will be next time. However, for now, they're + here.) */ +{ + switch (_vm->_gyro.dna.room) { + case r__outsideyours: + case r__outsidenottspub: + case r__outsideducks: { + _vm->_sequence.first_show(1); + _vm->_sequence.then_show(2); + _vm->_sequence.then_show(3); + } + break; + case r__insidecardiffcastle: { + _vm->_sequence.first_show(1); + _vm->_sequence.then_show(5); + } + break; + case r__avvysgarden: + case r__entrancehall: + case r__insideabbey: { + _vm->_sequence.first_show(1); + _vm->_sequence.then_show(2); + } + break; + case r__musicroom: + case r__outsideargentpub: { + _vm->_sequence.first_show(5); + _vm->_sequence.then_show(6); + } + break; + case r__lusties: + switch (magicnum) { + case 14: + if (_vm->_gyro.dna.avvys_in_the_cupboard) { + hide_in_the_cupboard(); + _vm->_sequence.first_show(8); + _vm->_sequence.then_show(7); + _vm->_sequence.start_to_close(); + return; + } else { + apped(1, 6); + tr[1].face = right; /* added by TT 12/3/1995 */ + _vm->_sequence.first_show(8); + _vm->_sequence.then_show(9); } + break; + case 12: { + _vm->_sequence.first_show(4); + _vm->_sequence.then_show(5); + _vm->_sequence.then_show(6); + } + break; } + break; } - void apped(byte trn, byte np) { - tr[trn].appear(tr[trn].x - tr[trn].a.xl / 2, tr[trn].y - tr[trn].a.yl, Gyro::peds[np].dir); - rwsp(trn, Gyro::peds[np].dir); - } + _vm->_sequence.then_flip(whither, ped); + _vm->_sequence.start_to_open(); +} +void Trip::newspeed() { +/* Given that you've just changed the speed in triptype.xs, this adjusts + ix. */ + warning("STUB: Trip::newspeed()"); +} +void Trip::rwsp(byte t, byte r) { + { + switch (r) { + case up: + tr[t].speed(0, -tr[t].ys); + break; + case down: + tr[t].speed(0, tr[t].ys); + break; + case left: + tr[t].speed(-tr[t].xs, 0); + break; + case right: + tr[t].speed(tr[t].xs, 0); + break; + case ul: + tr[t].speed(-tr[t].xs, -tr[t].ys); + break; + case ur: + tr[t].speed(tr[t].xs, -tr[t].ys); + break; + case dl: + tr[t].speed(-tr[t].xs, tr[t].ys); + break; + case dr: + tr[t].speed(tr[t].xs, tr[t].ys); + break; + } + } +} - void getback(); +void Trip::apped(byte trn, byte np) { + tr[trn].appear(tr[trn].x - tr[trn].a.xl / 2, tr[trn].y - tr[trn].a.yl, _vm->_gyro.peds[np].dir); + rwsp(trn, _vm->_gyro.peds[np].dir); +} - static Gyro::bytefield r; - /* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; - begin { By De Morgan's law: } - overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); - end;*/ - /* x1,x2 - as Gyro::bytefield, but *8. y1,y2 - as Gyro::bytefield. - x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ - static bool overlaps_with_mouse() { - bool overlaps_with_mouse_result; - overlaps_with_mouse_result = - (r.x2 * 8 >= Gyro::mx) && (Gyro::mx + 16 >= r.x1 * 8) && (r.y2 >= Gyro::my) && (Gyro::my + 16 >= r.y1); - return overlaps_with_mouse_result; - } - void getback() { - byte fv; - bool endangered; +/* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; + begin { By De Morgan's law: } + overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); + end;*/ +/* x1,x2 - as _vm->_gyro.bytefield, but *8. y1,y2 - as _vm->_gyro.bytefield. + x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ +bool Trip::overlaps_with_mouse() { + bool overlaps_with_mouse_result; + overlaps_with_mouse_result = + (r.x2 * 8 >= _vm->_gyro.mx) && (_vm->_gyro.mx + 16 >= r.x1 * 8) && (r.y2 >= _vm->_gyro.my) && (_vm->_gyro.my + 16 >= r.y1); + return overlaps_with_mouse_result; +} +void Trip::getback() { + byte fv; + bool endangered; - endangered = false; - /* Super_Off;*/ - { - while (getset[1 - Gyro::cp].numleft > 0) { - getset[1 - Gyro::cp].recall(r); + endangered = false; + /* Super_Off;*/ - /* if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end;*/ + { + while (getset[1 - _vm->_gyro.cp].numleft > 0) { + getset[1 - _vm->_gyro.cp].recall(r); - Lucerna::mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - Gyro::cp); - } - } + /* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ - Lucerna::blitfix(); - /*if endangered then*/ /*Super_On;*/ + _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); + } } - /* Eachstep procedures: */ - void follow_avvy_y(byte tripnum) { - if (tr[1].face == left) + _vm->_lucerna.blitfix(); + /*if endangered then*/ /*Super_On;*/ +} + +/* Eachstep procedures: */ +void Trip::follow_avvy_y(byte tripnum) { + if (tr[1].face == left) + return; + if (tr[tripnum].homing) + tr[tripnum].hy = tr[1].y; + else { + if (tr[tripnum].y < tr[1].y) + tr[tripnum].y += 1; + else if (tr[tripnum].y > tr[1].y) + tr[tripnum].y -= 1; + else return; - if (tr[tripnum].homing) - tr[tripnum].hy = tr[1].y; - else { - if (tr[tripnum].y < tr[1].y) - tr[tripnum].y += 1; - else if (tr[tripnum].y > tr[1].y) - tr[tripnum].y -= 1; - else - return; - if (tr[tripnum].ix == 0) { - tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; - tr[tripnum].count = 0; - } + if (tr[tripnum].ix == 0) { + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + tr[tripnum].count = 0; } } +} - void back_and_forth(byte tripnum) { - if (! tr[tripnum].homing) { - if (tr[tripnum].face == right) - tr[tripnum].walkto(4); - else - tr[tripnum].walkto(5); - } +void Trip::back_and_forth(byte tripnum) { + if (! tr[tripnum].homing) { + if (tr[tripnum].face == right) + tr[tripnum].walkto(4); + else + tr[tripnum].walkto(5); } +} - void face_avvy(byte tripnum) { - if (! tr[tripnum].homing) { - if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; - else tr[tripnum].face = left; - } +void Trip::face_avvy(byte tripnum) { + if (! tr[tripnum].homing) { + if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; + else tr[tripnum].face = left; } +} - void arrow_procs(byte tripnum) { - byte fv; +void Trip::arrow_procs(byte tripnum) { + byte fv; - if (tr[tripnum].homing) { - /* Arrow is still in flight. */ - /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. - This is so if: a) the bottom of the arrow is below Avvy's head, - b) the left of the arrow is left of the right of Avvy's head, and - c) the right of the arrow is right of the left of Avvy's head. */ - if (((tr[tripnum].y + tr[tripnum].a.yl) >= tr[1].y) /* A */ - && (tr[tripnum].x <= (tr[1].x + tr[1].a.xl)) /* B */ - && ((tr[tripnum].x + tr[tripnum].a.xl) >= tr[1].x)) { /* C */ - /* OK, it's hit him... what now? */ - - tr[2].call_eachstep = false; /* prevent recursion. */ - Visa::dixi('Q', 47); /* Complaint! */ - tr[tripnum].done(); /* Deallocate the arrow. */ - /* tr[1].done; { Deallocate normal pic of Avvy. } - - off; - for fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - on;*/ - - Lucerna::gameover(); - - Gyro::dna.user_moves_avvy = false; /* Stop the user from moving him. */ - Timeout::set_up_timer(55, Timeout::procnaughty_duke, Timeout::reason_naughty_duke); - } - } else { /* Arrow has hit the wall! */ + if (tr[tripnum].homing) { + /* Arrow is still in flight. */ + /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. + This is so if: a) the bottom of the arrow is below Avvy's head, + b) the left of the arrow is left of the right of Avvy's head, and + c) the right of the arrow is right of the left of Avvy's head. */ + if (((tr[tripnum].y + tr[tripnum].a.yl) >= tr[1].y) /* A */ + && (tr[tripnum].x <= (tr[1].x + tr[1].a.xl)) /* B */ + && ((tr[tripnum].x + tr[tripnum].a.xl) >= tr[1].x)) { /* C */ + /* OK, it's hit him... what now? */ + + tr[2].call_eachstep = false; /* prevent recursion. */ + _vm->_visa.dixi('Q', 47); /* Complaint! */ tr[tripnum].done(); /* Deallocate the arrow. */ - Celer::show_one(3); /* Show pic of arrow stuck into the door. */ - Gyro::dna.arrow_in_the_door = true; /* So that we can pick it up. */ + /* tr[1].done; { Deallocate normal pic of Avvy. } + + off; + for fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on;*/ + + _vm->_lucerna.gameover(); + + _vm->_gyro.dna.user_moves_avvy = false; /* Stop the user from moving him. */ + _vm->_timeout.set_up_timer(55, _vm->_timeout.procnaughty_duke, _vm->_timeout.reason_naughty_duke); } - + } else { /* Arrow has hit the wall! */ + tr[tripnum].done(); /* Deallocate the arrow. */ + _vm->_celer.show_one(3); /* Show pic of arrow stuck into the door. */ + _vm->_gyro.dna.arrow_in_the_door = true; /* So that we can pick it up. */ } - - /*procedure Spludwick_procs(tripnum:byte); - var fv:byte; + +} + +/*procedure Spludwick_procs(tripnum:byte); +var fv:byte; +begin + with tr[tripnum] do + if not homing then { We only need to do anything if Spludwick *stops* + walking. } + with _vm->_gyro.dna do begin - with tr[tripnum] do - if not homing then { We only need to do anything if Spludwick *stops* - walking. } - with Gyro::dna do - begin - inc(DogfoodPos); - if DogfoodPos=8 then DogfoodPos:=1; - walkto(DogfoodPos); - end; - end;*/ - - void grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ - byte fv; - int16 tox, toy; + inc(DogfoodPos); + if DogfoodPos=8 then DogfoodPos:=1; + walkto(DogfoodPos); + end; +end;*/ + +void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ + byte fv; + int16 tox, toy; - tox = tr[1].x + 17; - toy = tr[1].y - 1; - if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { - tr[tripnum].call_eachstep = false; - tr[tripnum].face = left; - tr[tripnum].stopwalk(); - /* ... whatever ... */ - } else { - /* Still some way to go. */ - if (tr[tripnum].x < tox) { - tr[tripnum].x += 5; - if (tr[tripnum].x > tox) tr[tripnum].x = tox; - } - if (tr[tripnum].y < toy) tr[tripnum].y += 1; - tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; - } + tox = tr[1].x + 17; + toy = tr[1].y - 1; + if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { + tr[tripnum].call_eachstep = false; + tr[tripnum].face = left; + tr[tripnum].stopwalk(); + /* ... whatever ... */ + } else { + /* Still some way to go. */ + if (tr[tripnum].x < tox) { + tr[tripnum].x += 5; + if (tr[tripnum].x > tox) tr[tripnum].x = tox; + } + if (tr[tripnum].y < toy) tr[tripnum].y += 1; + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; } +} - void geida_procs(byte tripnum); - static void take_a_step(byte &tripnum) { - if (tr[tripnum].ix == 0) { - tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; - tr[tripnum].count = 0; - } + +void Trip::take_a_step(byte &tripnum) { + if (tr[tripnum].ix == 0) { + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + tr[tripnum].count = 0; } +} - static void spin(byte whichway, byte &tripnum) { - if (tr[tripnum].face != whichway) { - tr[tripnum].face = whichway; - if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ +void Trip::spin(byte whichway, byte &tripnum) { + if (tr[tripnum].face != whichway) { + tr[tripnum].face = whichway; + if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ - Gyro::dna.geida_spin += 1; - Gyro::dna.geida_time = 20; - if (Gyro::dna.geida_spin == 5) { - Scrolls::display("Steady on, Avvy, you'll make the poor girl dizzy!"); - Gyro::dna.geida_spin = 0; - Gyro::dna.geida_time = 0; /* knock out records */ - } + _vm->_gyro.dna.geida_spin += 1; + _vm->_gyro.dna.geida_time = 20; + if (_vm->_gyro.dna.geida_spin == 5) { + _vm->_scrolls.display("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_gyro.dna.geida_spin = 0; + _vm->_gyro.dna.geida_time = 0; /* knock out records */ } } +} - void geida_procs(byte tripnum) { - if (Gyro::dna.geida_time > 0) { - Gyro::dna.geida_time -= 1; - if (Gyro::dna.geida_time == 0) Gyro::dna.geida_spin = 0; - } - - if (tr[tripnum].y < (tr[1].y - 2)) { - /* Geida is further from the screen than Avvy. */ - spin(down, tripnum); - tr[tripnum].iy = 1; - tr[tripnum].ix = 0; - take_a_step(tripnum); - return; - } else if (tr[tripnum].y > (tr[1].y + 2)) { - /* Avvy is further from the screen than Geida. */ - spin(up, tripnum); - tr[tripnum].iy = -1; - tr[tripnum].ix = 0; - take_a_step(tripnum); - return; - } +void Trip::geida_procs(byte tripnum) { + if (_vm->_gyro.dna.geida_time > 0) { + _vm->_gyro.dna.geida_time -= 1; + if (_vm->_gyro.dna.geida_time == 0) _vm->_gyro.dna.geida_spin = 0; + } - tr[tripnum].iy = 0; - if (tr[tripnum].x < tr[1].x - tr[1].xs * 8) { - tr[tripnum].ix = tr[1].xs; - spin(right, tripnum); - take_a_step(tripnum); - } else if (tr[tripnum].x > tr[1].x + tr[1].xs * 8) { - tr[tripnum].ix = -tr[1].xs; - spin(left, tripnum); - take_a_step(tripnum); - } else tr[tripnum].ix = 0; + if (tr[tripnum].y < (tr[1].y - 2)) { + /* Geida is further from the screen than Avvy. */ + spin(down, tripnum); + tr[tripnum].iy = 1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; + } else if (tr[tripnum].y > (tr[1].y + 2)) { + /* Avvy is further from the screen than Geida. */ + spin(up, tripnum); + tr[tripnum].iy = -1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; } - /* That's all... */ + tr[tripnum].iy = 0; + if (tr[tripnum].x < tr[1].x - tr[1].xs * 8) { + tr[tripnum].ix = tr[1].xs; + spin(right, tripnum); + take_a_step(tripnum); + } else if (tr[tripnum].x > tr[1].x + tr[1].xs * 8) { + tr[tripnum].ix = -tr[1].xs; + spin(left, tripnum); + take_a_step(tripnum); + } else tr[tripnum].ix = 0; +} + +/* That's all... */ + +void Trip::call_andexors() { + byte order[5]; + byte fv, temp; + bool ok; + + for (int i = 0; i < 5; i++) + order[i] = 0; + + for (fv = 1; fv <= numtr; fv ++) { + if (tr[fv].quick && tr[fv].visible) + order[fv] = fv; + } - void call_andexors() { - byte order[5]; - byte fv, temp; - bool ok; + do { + ok = true; + for (fv = 1; fv <= 4; fv ++) + if (((order[fv] != 0) && (order[fv + 1] != 0)) + && (tr[order[fv]].y > tr[order[fv + 1]].y)) { + /* Swap them! */ + temp = order[fv]; + order[fv] = order[fv + 1]; + order[fv + 1] = temp; + ok = false; + } + } while (!ok); - for (int i = 0; i < 5; i++) - order[i] = 0; + for (fv = 1; fv <= 5; fv ++) + if (order[fv] > 0) + tr[order[fv]].andexor(); +} - for (fv = 1; fv <= numtr; fv ++) { - if (tr[fv].quick && tr[fv].visible) - order[fv] = fv; - } +void Trip::trippancy_link() { + byte fv; - do { - ok = true; - for (fv = 1; fv <= 4; fv ++) - if (((order[fv] != 0) && (order[fv + 1] != 0)) - && (tr[order[fv]].y > tr[order[fv + 1]].y)) { - /* Swap them! */ - temp = order[fv]; - order[fv] = order[fv + 1]; - order[fv + 1] = temp; - ok = false; - } - } while (!ok); - - for (fv = 1; fv <= 5; fv ++) - if (order[fv] > 0) - tr[order[fv]].andexor(); - } - - void trippancy_link() { - byte fv; - - if (Gyro::ddmnow | Gyro::ontoolbar | Gyro::seescroll) return; - for (fv = 1; fv <= numtr; fv ++) { - if (tr[fv].quick) - tr[fv].walk(); - } + if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) return; + for (fv = 1; fv <= numtr; fv ++) { + if (tr[fv].quick) + tr[fv].walk(); + } - call_andexors(); - for (fv = 1; fv <= numtr; fv ++) { - triptype &with = tr[fv]; - if (with.quick && with.call_eachstep) { - switch (tr[fv].eachstep) { - case procfollow_avvy_y : - follow_avvy_y(fv); - break; - case procback_and_forth : - back_and_forth(fv); - break; - case procface_avvy : - face_avvy(fv); - break; - case procarrow_procs : - arrow_procs(fv); - break; - /* PROCSpludwick_procs : spludwick_procs(fv);*/ - case procgrab_avvy : - grab_avvy(fv); - break; - case procgeida_procs : - geida_procs(fv); - break; - } + call_andexors(); + for (fv = 1; fv <= numtr; fv ++) { + triptype &with = tr[fv]; + if (with.quick && with.call_eachstep) { + switch (tr[fv].eachstep) { + case procfollow_avvy_y : + follow_avvy_y(fv); + break; + case procback_and_forth : + back_and_forth(fv); + break; + case procface_avvy : + face_avvy(fv); + break; + case procarrow_procs : + arrow_procs(fv); + break; + /* PROCSpludwick_procs : spludwick_procs(fv);*/ + case procgrab_avvy : + grab_avvy(fv); + break; + case procgeida_procs : + geida_procs(fv); + break; } } - if (mustexclaim) { - mustexclaim = false; - Visa::dixi('x', saywhat); - } } - - void get_back_loretta() { - byte fv; - - /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ - for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { - getback(); - return; - } - /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ + if (mustexclaim) { + mustexclaim = false; + _vm->_visa.dixi('x', saywhat); } +} - void stopwalking() { - tr[1].stopwalk(); - Gyro::dna.rw = stopped; - if (Gyro::alive) - tr[1].step = 1; - } +void Trip::get_back_loretta() { + byte fv; - void tripkey(char dir) { - if ((Gyro::ctrl == Gyro::cjoy) | (! Gyro::dna.user_moves_avvy)) + /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ + for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { + getback(); return; + } + /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ +} + +void Trip::stopwalking() { + tr[1].stopwalk(); + _vm->_gyro.dna.rw = stopped; + if (_vm->_gyro.alive) + tr[1].step = 1; +} + +void Trip::tripkey(char dir) { + if ((_vm->_gyro.ctrl == cjoy) | (! _vm->_gyro.dna.user_moves_avvy)) + return; + { + triptype &with = tr[1]; { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (Gyro::dna.rw != up) { - Gyro::dna.rw = up; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'P': - if (Gyro::dna.rw != down) { - Gyro::dna.rw = down; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'K': - if (Gyro::dna.rw != left) { - Gyro::dna.rw = left; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'M': - if (Gyro::dna.rw != right) { - Gyro::dna.rw = right; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'I': - if (Gyro::dna.rw != ur) { - Gyro::dna.rw = ur; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'Q': - if (Gyro::dna.rw != dr) { - Gyro::dna.rw = dr; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'O': - if (Gyro::dna.rw != dl) { - Gyro::dna.rw = dl; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'G': - if (Gyro::dna.rw != ul) { - Gyro::dna.rw = ul; - rwsp(1, Gyro::dna.rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } + switch (dir) { + case 'H': + if (_vm->_gyro.dna.rw != up) { + _vm->_gyro.dna.rw = up; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'P': + if (_vm->_gyro.dna.rw != down) { + _vm->_gyro.dna.rw = down; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'K': + if (_vm->_gyro.dna.rw != left) { + _vm->_gyro.dna.rw = left; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'M': + if (_vm->_gyro.dna.rw != right) { + _vm->_gyro.dna.rw = right; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'I': + if (_vm->_gyro.dna.rw != ur) { + _vm->_gyro.dna.rw = ur; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'Q': + if (_vm->_gyro.dna.rw != dr) { + _vm->_gyro.dna.rw = dr; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'O': + if (_vm->_gyro.dna.rw != dl) { + _vm->_gyro.dna.rw = dl; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'G': + if (_vm->_gyro.dna.rw != ul) { + _vm->_gyro.dna.rw = ul; + rwsp(1, _vm->_gyro.dna.rw); + } else stopwalking(); + break; + case 'L': + stopwalking(); + break; } } } +} - void readstick() { - warning("STUB: Trip::readstick()"); - } +void Trip::readstick() { + warning("STUB: Trip::readstick()"); +} - void getsetclear() { - byte fv; +void Trip::getsetclear() { + byte fv; - for (fv = 0; fv <= 1; fv ++) - getset[fv].init(); - } + for (fv = 0; fv <= 1; fv ++) + getset[fv].init(); +} - void hide_in_the_cupboard() { - const char nowt = 250; /* As in Acci. */ +void Trip::hide_in_the_cupboard() { + const char nowt = 250; /* As in Acci. */ - if (Gyro::dna.avvys_in_the_cupboard) { - if (Gyro::dna.wearing == nowt) - Scrolls::display("\6AVVY!\22 Get dressed first!"); - else { - tr[1].visible = true; - Gyro::dna.user_moves_avvy = true; - apped(1, 3); /* Walk out of the cupboard. */ - Scrolls::display("You leave the cupboard. Nice to be out of there!"); - Gyro::dna.avvys_in_the_cupboard = false; - Sequence::first_show(8); - Sequence::then_show(7); - Sequence::start_to_close; - } - } else { - /* Not hiding in the cupboard */ - tr[1].visible = false; - Gyro::dna.user_moves_avvy = false; - Scrolls::display(Common::String("You walk into the room...\20It seems to be an empty, ") + - "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + - "avoid suffocation."); - Gyro::dna.avvys_in_the_cupboard = true; - Celer::show_one(8); - } + if (_vm->_gyro.dna.avvys_in_the_cupboard) { + if (_vm->_gyro.dna.wearing == nowt) + _vm->_scrolls.display("\6AVVY!\22 Get dressed first!"); + else { + tr[1].visible = true; + _vm->_gyro.dna.user_moves_avvy = true; + apped(1, 3); /* Walk out of the cupboard. */ + _vm->_scrolls.display("You leave the cupboard. Nice to be out of there!"); + _vm->_gyro.dna.avvys_in_the_cupboard = false; + _vm->_sequence.first_show(8); + _vm->_sequence.then_show(7); + _vm->_sequence.start_to_close(); + } + } else { + /* Not hiding in the cupboard */ + tr[1].visible = false; + _vm->_gyro.dna.user_moves_avvy = false; + _vm->_scrolls.display(Common::String("You walk into the room...\20It seems to be an empty, ") + + "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + + "avoid suffocation."); + _vm->_gyro.dna.avvys_in_the_cupboard = true; + _vm->_celer.show_one(8); } +} - void fliproom(byte room, byte ped); - static int16 beforex, beforey; - static void tidy_after_mouse(); - static void tidy_up(int16 a, int16 b, int16 c, int16 d) { - warning("STUB: Trip::tidy_up()"); - } - static void tidy_after_mouse() { - tidy_up(beforex, beforey, beforex + 15, beforey + 15); - Gyro::xycheck(); - tidy_up(Gyro::mx, Gyro::my, Gyro::mx + 15, Gyro::my + 15); - } +void Trip::tidy_up(int16 a, int16 b, int16 c, int16 d) { + warning("STUB: Trip::tidy_up()"); +} - void fliproom(byte room, byte ped) { - byte fv; - if (! Gyro::alive) { - /* You can't leave the room if you're dead. */ - tr[1].ix = 0; - tr[1].iy = 0; /* Stop him from moving. */ - return; - } - - if ((ped == 177) && (Gyro::dna.room == r__lusties)) { - hide_in_the_cupboard(); - return; - } +void Trip::tidy_after_mouse() { + tidy_up(beforex, beforey, beforex + 15, beforey + 15); + _vm->_gyro.xycheck(); + tidy_up(_vm->_gyro.mx, _vm->_gyro.my, _vm->_gyro.mx + 15, _vm->_gyro.my + 15); +} - if ((Gyro::dna.jumpstatus > 0) && (Gyro::dna.room == r__insidecardiffcastle)) { - /* You can't *jump* out of Cardiff Castle! */ - tr[1].ix = 0; - return; - } +void Trip::fliproom(byte room, byte ped) { + byte fv; - Gyro::xycheck(); - beforex = Gyro::mx; - beforey = Gyro::my; - Lucerna::exitroom(Gyro::dna.room); - Lucerna::dusk(); - getsetclear(); + if (! _vm->_gyro.alive) { + /* You can't leave the room if you're dead. */ + tr[1].ix = 0; + tr[1].iy = 0; /* Stop him from moving. */ + return; + } + if ((ped == 177) && (_vm->_gyro.dna.room == r__lusties)) { + hide_in_the_cupboard(); + return; + } - for (fv = 2; fv <= numtr; fv ++) { - if (tr[fv].quick) - tr[fv].done(); - } /* Deallocate sprite */ + if ((_vm->_gyro.dna.jumpstatus > 0) && (_vm->_gyro.dna.room == r__insidecardiffcastle)) { + /* You can't *jump* out of Cardiff Castle! */ + tr[1].ix = 0; + return; + } - if (Gyro::dna.room == r__lustiesroom) - Gyro::dna.enter_catacombs_from_lusties_room = true; + _vm->_gyro.xycheck(); + beforex = _vm->_gyro.mx; + beforey = _vm->_gyro.my; - Lucerna::enterroom(room, ped); - apped(1, ped); - Gyro::dna.enter_catacombs_from_lusties_room = false; - Gyro::oldrw = Gyro::dna.rw; - Gyro::dna.rw = tr[1].face; - Lucerna::showrw; + _vm->_lucerna.exitroom(_vm->_gyro.dna.room); + _vm->_lucerna.dusk(); + getsetclear(); - for (fv = 0; fv <= 1; fv ++) { - Gyro::cp = 1 - Gyro::cp; - getback(); - } - Lucerna::dawn; - /* Tidy up after mouse. I know it's a kludge... */ - /* tidy_after_mouse;*/ - } + for (fv = 2; fv <= numtr; fv ++) { + if (tr[fv].quick) + tr[fv].done(); + } /* Deallocate sprite */ - bool infield(byte which) { - /* returns True if you're within field "which" */ - int16 yy; - - yy = tr[1].y + tr[1].a.yl; + if (_vm->_gyro.dna.room == r__lustiesroom) + _vm->_gyro.dna.enter_catacombs_from_lusties_room = true; - return (tr[1].x >= Gyro::fields[which].x1) && (tr[1].x <= Gyro::fields[which].x2) - && (yy >= Gyro::fields[which].y1) && (yy <= Gyro::fields[which].y2); + _vm->_lucerna.enterroom(room, ped); + apped(1, ped); + _vm->_gyro.dna.enter_catacombs_from_lusties_room = false; + _vm->_gyro.oldrw = _vm->_gyro.dna.rw; + _vm->_gyro.dna.rw = tr[1].face; + _vm->_lucerna.showrw(); + for (fv = 0; fv <= 1; fv ++) { + _vm->_gyro.cp = 1 - _vm->_gyro.cp; + getback(); } + _vm->_lucerna.dawn(); - bool neardoor() { /* returns True if you're near a door! */ - int16 ux, uy; - byte fv; - bool nd; + /* Tidy up after mouse. I know it's a kludge... */ + /* tidy_after_mouse;*/ +} - bool neardoor_result; - if (Gyro::numfields < 9) { - /* there ARE no doors here! */ - neardoor_result = false; - return neardoor_result; - } +bool Trip::infield(byte which) { +/* returns True if you're within field "which" */ + int16 yy; - ux = tr[1].x; - uy = tr[1].y + tr[1].a.yl; - - nd = false; - for (fv = 9; fv <= Gyro::numfields; fv ++) { - Gyro::fields[fv]; + yy = tr[1].y + tr[1].a.yl; - if ((ux >= Gyro::fields[fv].x1) && (ux <= Gyro::fields[fv].x2) - && (uy >= Gyro::fields[fv].y1) && (uy <= Gyro::fields[fv].y2)) - nd = true; - } - return nd; - } + return (tr[1].x >= _vm->_gyro.fields[which].x1) && (tr[1].x <= _vm->_gyro.fields[which].x2) + && (yy >= _vm->_gyro.fields[which].y1) && (yy <= _vm->_gyro.fields[which].y2); - void new_game_for_trippancy() { /* Called by gyro.newgame */ - tr[1].visible = false; - } +} + +bool Trip::neardoor() { /* returns True if you're near a door! */ + int16 ux, uy; + byte fv; + bool nd; - void triptype::save_data_to_mem(uint16 &where) { - warning("STUB: Trip::save_data_to_mem()"); + bool neardoor_result; + if (_vm->_gyro.numfields < 9) { + /* there ARE no doors here! */ + neardoor_result = false; + return neardoor_result; } + + ux = tr[1].x; + uy = tr[1].y + tr[1].a.yl; + + nd = false; + for (fv = 9; fv <= _vm->_gyro.numfields; fv ++) { + _vm->_gyro.fields[fv]; - void triptype::load_data_from_mem(uint16 &where) { - warning("STUB: Trip::load_data_from_mem()"); + if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2) + && (uy >= _vm->_gyro.fields[fv].y1) && (uy <= _vm->_gyro.fields[fv].y2)) + nd = true; } + return nd; +} - } // End of namespace Trip. +void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ + tr[1].visible = false; +} } // End of namespace Avalanche. diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 0227bab7b672..be805fbe03d6 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -39,142 +39,170 @@ #include "avalanche/gyro2.h" namespace Avalanche { +class AvalancheEngine; + + +typedef byte manitype[2049]; // manitype = array[5..2053] of byte; +// Be aware!!! + +typedef byte siltype[51][11]; /* 35, 4 */ + +struct adxtype { /* Second revision of ADX type */ + Common::String name; /* name of character */ + Common::String comment; /* comment */ + byte num; /* number of pictures */ + byte xl, yl; /* x & y lengths of pictures */ + byte seq; /* how many in one stride */ + uint16 size; /* the size of one picture */ + byte fgc, bgc; /* foreground & background bubble colours */ + byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +}; + +struct trip_saver_type { + byte whichsprite; + byte face; + byte step; + int16 x; + int16 y; + int8 ix; + int8 iy; + bool visible; + bool homing; + bool check_me; + byte count; + byte xw, xs, ys; + byte totalnum; + int16 hx; + int16 hy; + bool call_eachstep; + byte eachstep; + bool vanishifstill; +}; + + +class Trip; + +class triptype { +public: + adxtype a; /* vital statistics */ + byte face, step; + int16 x, y; /* current xy coords */ + int16 ox[2], oy[2]; /* last xy coords */ + int8 ix, iy; /* amount to move sprite by, each step */ + manitype *mani[24]; + siltype *sil[24]; + byte whichsprite; + bool quick, visible, homing, check_me; + int16 hx, hy; /* homing x & y coords */ + byte count; /* counts before changing step */ + byte xw; /* x-width in bytes */ + byte xs, ys; /* x & y speed */ + byte totalnum; /* total number of sprites */ + bool vanishifstill; /* Do we show this sprite if it's still? */ + + bool call_eachstep; /* Do we call the eachstep procedure? */ + byte eachstep; + + triptype *init(byte spritenum, bool do_check, Trip *tr); + /* loads & sets up the sprite */ + void original(); /* just sets Quick to false */ + void andexor(); /* drops sprite onto screen */ + void turn(byte whichway); /* turns him round */ + void appear(int16 wx, int16 wy, byte wf); /* switches him on */ + void bounce(); /* bounces off walls. */ + void walk(); /* prepares for andexor, etc. */ + void walkto(byte pednum); /* home in on a point */ + void stophoming(); /* self-explanatory */ + void homestep(); /* calculates ix & iy for one homing step */ + void speed(int8 xx, int8 yy); /* sets ix & iy, non-homing, etc */ + void stopwalk(); /* Stops the sprite from moving */ + void chatter(); /* Sets up talk vars */ + void set_up_saver(trip_saver_type &v); + void unload_saver(trip_saver_type v); + + void savedata(/*untyped_file &f*/); /* Self-explanatory, */ + void loaddata(/*untyped_file &f*/); /* really. */ + + void save_data_to_mem(uint16 &where); + void load_data_from_mem(uint16 &where); + triptype *done(); + +private: + Trip *_tr; + + bool collision_check(); + + int8 sgn(int16 x); +}; + + + +const int16 maxgetset = 35; + +class getsettype { +public: + bytefield gs[maxgetset]; + byte numleft; + + getsettype *init(); + void remember(bytefield r); + void recall(bytefield &r); +}; + + + + + + + + + + + + +class Trip { +public: + friend triptype; + friend getsettype; - namespace Trip { - - // Call it where Trip is first used. - // Procuded to replace the initizalization part of the original Pascal unit. - void initialize_trip(); - - const int16 maxgetset = 35; - - typedef byte manitype[2049]; // manitype = array[5..2053] of byte; - // Be aware!!! - - typedef byte siltype[51][11]; /* 35, 4 */ - - struct adxtype { /* Second revision of ADX type */ - Common::String name; /* name of character */ - Common::String comment; /* comment */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - uint16 size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ - }; - - struct trip_saver_type { - byte whichsprite; - byte face; - byte step; - int16 x; - int16 y; - int8 ix; - int8 iy; - bool visible; - bool homing; - bool check_me; - byte count; - byte xw, xs, ys; - byte totalnum; - int16 hx; - int16 hy; - bool call_eachstep; - byte eachstep; - bool vanishifstill; - }; - - class triptype { - public: - adxtype a; /* vital statistics */ - byte face, step; - int16 x, y; /* current xy coords */ - int16 ox[2], oy[2]; /* last xy coords */ - int8 ix, iy; /* amount to move sprite by, each step */ - manitype *mani[24]; - siltype *sil[24]; - byte whichsprite; - bool quick, visible, homing, check_me; - int16 hx, hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - byte xw; /* x-width in bytes */ - byte xs, ys; /* x & y speed */ - byte totalnum; /* total number of sprites */ - bool vanishifstill; /* Do we show this sprite if it's still? */ - - bool call_eachstep; /* Do we call the eachstep procedure? */ - byte eachstep; - - triptype *init(byte spritenum, bool do_check); - /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(int16 wx, int16 wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(byte pednum); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(int8 xx, int8 yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ - void set_up_saver(trip_saver_type &v); - void unload_saver(trip_saver_type v); - - void savedata(/*untyped_file &f*/); /* Self-explanatory, */ - void loaddata(/*untyped_file &f*/); /* really. */ - - void save_data_to_mem(uint16 &where); - void load_data_from_mem(uint16 &where); - triptype *done(); - private: - bool collision_check(); - }; - class getsettype { - public: - Gyro::bytefield gs[maxgetset]; - byte numleft; - getsettype *init(); - void remember(Gyro::bytefield r); - void recall(Gyro::bytefield &r); - }; + Trip(); + + void setParent(AvalancheEngine *vm); - const int16 up = 0; - const int16 right = 1; - const int16 down = 2; - const int16 left = 3; - const int16 ur = 4; - const int16 dr = 5; - const int16 dl = 6; - const int16 ul = 7; - const int16 stopped = 8; + static const int16 up = 0; + static const int16 right = 1; + static const int16 down = 2; + static const int16 left = 3; + static const int16 ur = 4; + static const int16 dr = 5; + static const int16 dl = 6; + static const int16 ul = 7; + static const int16 stopped = 8; - const int16 numtr = 5; /* current max no. of sprites */ + static const int16 numtr = 5; /* current max no. of sprites */ - const int16 procfollow_avvy_y = 1; + static const int16 procfollow_avvy_y = 1; - const int16 procback_and_forth = 2; + static const int16 procback_and_forth = 2; - const int16 procface_avvy = 3; + static const int16 procface_avvy = 3; - const int16 procarrow_procs = 4; + static const int16 procarrow_procs = 4; - const int16 procspludwick_procs = 5; + static const int16 procspludwick_procs = 5; - const int16 procgrab_avvy = 6; + static const int16 procgrab_avvy = 6; - const int16 procgeida_procs = 7; + static const int16 procgeida_procs = 7; void trippancy_link(); @@ -211,7 +239,7 @@ namespace Avalanche { void new_game_for_trippancy(); - + void take_a_step(byte &tripnum); triptype tr[numtr]; getsettype getset[2]; @@ -220,7 +248,45 @@ namespace Avalanche { bool mustexclaim; uint16 saywhat; - } // End of namespace Trip. +private: + AvalancheEngine *_vm; + + bytefield r; + + int16 beforex, beforey; + + byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); + + byte geida_ped(byte which); + + void dawndelay(); + + void hide_in_the_cupboard(); + + bool overlaps_with_mouse(); + + void follow_avvy_y(byte tripnum); + + void back_and_forth(byte tripnum); + + void face_avvy(byte tripnum); + + void arrow_procs(byte tripnum); + + void grab_avvy(byte tripnum); + + void spin(byte whichway, byte &tripnum); + + void geida_procs(byte tripnum); + + void call_andexors(); + + void getsetclear(); + + void tidy_up(int16 a, int16 b, int16 c, int16 d); + + void tidy_after_mouse(); +}; } // End of namespace Avalanche. From 17fe756073b922cbfae0bcbcbe3f1a54de4d62f6 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 10:20:22 +0200 Subject: [PATCH 0060/1332] AVALANCHE: Repair class Avalot. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 3 +++ engines/avalanche/avalot.cpp | 12 +++++++++--- engines/avalanche/avalot.h | 12 +++++++++--- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f8dee8ea3fa2..d090f8aa2c63 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -47,6 +47,7 @@ namespace Avalanche { _console = new AvalancheConsole(this); _rnd = 0; + _avalot.setParent(this); _gyro.setParent(this); _enhanced.setParent(this); _logger.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 42523012fe86..f7f5b5b6fda2 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -29,6 +29,8 @@ #define AVALANCHE_H #include "avalanche/console.h" + +#include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/enhanced2.h" #include "avalanche/logger2.h" @@ -57,6 +59,7 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: + Avalot _avalot; Gyro _gyro; Enhanced _enhanced; Logger _logger; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 341efcadfdbd..11186d03576f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,6 +28,7 @@ #include "common/str.h" #include "common/textconsole.h" +#include "avalanche/avalanche.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" @@ -37,9 +38,9 @@ namespace Avalanche { int16 gd, gm; checkbreak = false; - Gyro::visible = Gyro::m_no; - Gyro::to_do = 0; - Gyro::lmo = false; + _vm->_gyro.visible = _vm->_gyro.m_no; + _vm->_gyro.to_do = 0; + _vm->_gyro.lmo = false; // resetscroll(); Needs scrolls "unit" to make it work. warning("STUB: Avalot::Avalot()"); @@ -47,6 +48,11 @@ namespace Avalanche { } + void Avalot::setParent(AvalancheEngine *vm) { + _vm = vm; + } + + void Avalot::run(Common::String arg) { warning("STUB: Avalot::run(%s)", arg.c_str()); } diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 073b07377ba4..4c428b6172f5 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -31,15 +31,21 @@ #include "common/system.h" namespace Avalanche { +class AvalancheEngine; class Avalot { -private: - bool checkbreak; // Originally located in avalot9.map - public: Avalot(); + void setParent(AvalancheEngine *vm); + void run(Common::String arg); + +private: + AvalancheEngine *_vm; + + bool checkbreak; // Originally located in avalot9.map + }; } // End of namespace Avalanche From 90bc42f5c296ebfe6794772cc879c50944808821 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 10:23:21 +0200 Subject: [PATCH 0061/1332] AVALANCHE: Repair compilation. --- engines/avalanche/gyro2.h | 9 --- engines/avalanche/sequence2.cpp | 8 +-- engines/avalanche/timeout2.cpp | 98 ++++++++++++++++----------------- 3 files changed, 53 insertions(+), 62 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 6c596d2810dc..3d022fb586bf 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -199,15 +199,6 @@ class linetype : public fieldtype { byte col; }; -struct adxtype { - Common::String name; /* name of character */ - byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ - byte seq; /* how many in one stride */ - uint16 size; /* the size of one picture */ - byte fgc, bgc; /* foreground & background bubble colours */ -}; - typedef byte raw[256][16]; /* raw_font_type */ enum controllers {cjoy, ckey}; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 79c3e04b2e32..2d9bd255509d 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -69,13 +69,13 @@ void Sequence::then_flip(byte where, byte ped) { } void Sequence::start_to_close() { - Timeout::lose_timer(Timeout::reason_sequencer); - Timeout::set_up_timer(7, Timeout::procsequence, Timeout::reason_sequencer); + _vm->_timeout.lose_timer(_vm->_timeout.reason_sequencer); + _vm->_timeout.set_up_timer(7, _vm->_timeout.procsequence, _vm->_timeout.reason_sequencer); } void Sequence::start_to_open() { _vm->_gyro.dna.user_moves_avvy = false; /* They can't move. */ - Trip::stopwalking(); /* And they're not moving now. */ + _vm->_trip.stopwalking(); /* And they're not moving now. */ start_to_close(); /* Apart from that, it's the same thing. */ } @@ -93,7 +93,7 @@ void Sequence::call_sequencer() { break; /* No more routines. */ case 177: { _vm->_gyro.dna.user_moves_avvy = true; - Trip::fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ + _vm->_trip.fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ if (seq[0] == 177) shove_left(); } break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index a202aaf9ac86..fe5e5d966c4a 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -263,8 +263,8 @@ void Timeout::avaricius_talks() { } void Timeout::urinate() { - Trip::tr[1].turn(Trip::up); - Trip::stopwalking(); + _vm->_trip.tr[1].turn(_vm->_trip.up); + _vm->_trip.stopwalking(); _vm->_lucerna.showrw(); set_up_timer(14, proctoilet2, reason_gototoilet); } @@ -284,7 +284,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro.blip(); - Trip::tr[0].walkto(4); + _vm->_trip.tr[0].walkto(4); _vm->_celer.show_one(2); _vm->_gyro.dna.brummie_stairs = 2; _vm->_gyro.magics[11].op = _vm->_gyro.special; @@ -320,39 +320,39 @@ void Timeout::get_tied_up() { _vm->_visa.dixi('q', 34); /* ...Trouble! */ _vm->_gyro.dna.user_moves_avvy = false; _vm->_gyro.dna.been_tied_up = true; - Trip::stopwalking(); - Trip::tr[2].stopwalk(); - Trip::tr[2].stophoming(); - Trip::tr[2].call_eachstep = true; - Trip::tr[2].eachstep = Trip::procgrab_avvy; + _vm->_trip.stopwalking(); + _vm->_trip.tr[2].stopwalk(); + _vm->_trip.tr[2].stophoming(); + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procgrab_avvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } void Timeout::get_tied_up2() { - Trip::tr[1].walkto(4); - Trip::tr[2].walkto(5); + _vm->_trip.tr[1].walkto(4); + _vm->_trip.tr[2].walkto(5); _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* No effect when you touch the boundaries. */ _vm->_gyro.dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { - Trip::tr[2].check_me = false; - Trip::tr[1].init(7, true); /* Robin Hood */ + _vm->_trip.tr[2].check_me = false; + _vm->_trip.tr[1].init(7, true, &_vm->_trip); /* Robin Hood */ _vm->_gyro.whereis[_vm->_gyro.probinhood] = r__robins; - Trip::apped(1, 2); + _vm->_trip.apped(1, 2); _vm->_visa.dixi('q', 39); - Trip::tr[1].walkto(7); + _vm->_trip.tr[1].walkto(7); set_up_timer(55, prochang_around2, reason_hanging_around); } void Timeout::hang_around2() { _vm->_visa.dixi('q', 40); - Trip::tr[2].vanishifstill = false; - Trip::tr[2].walkto(4); + _vm->_trip.tr[2].vanishifstill = false; + _vm->_trip.tr[2].walkto(4); _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = r__robins; _vm->_visa.dixi('q', 41); - Trip::tr[1].done(); - Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + _vm->_trip.tr[1].done(); + _vm->_trip.tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately call the following proc (when you have a chance). */ @@ -412,9 +412,9 @@ void Timeout::jacques_wakes_up() { void Timeout::naughty_duke() /* This is when the Duke comes in and takes your money. */ { - Trip::tr[2].init(9, false); /* Here comes the Duke. */ - Trip::apped(2, 1); /* He starts at the door... */ - Trip::tr[2].walkto(3); /* He walks over to you. */ + _vm->_trip.tr[2].init(9, false, &_vm->_trip); /* Here comes the Duke. */ + _vm->_trip.apped(2, 1); /* He starts at the door... */ + _vm->_trip.tr[2].walkto(3); /* He walks over to you. */ /* Let's get the door opening. */ _vm->_celer.show_one(1); @@ -426,8 +426,8 @@ void Timeout::naughty_duke() void Timeout::naughty_duke2() { _vm->_visa.dixi('q', 48); /* Ha ha, it worked again! */ - Trip::tr[2].walkto(1); /* Walk to the door. */ - Trip::tr[2].vanishifstill = true; /* Then go away! */ + _vm->_trip.tr[2].walkto(1); /* Walk to the door. */ + _vm->_trip.tr[2].vanishifstill = true; /* Then go away! */ set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -444,7 +444,7 @@ void Timeout::jump() { with.jumpstatus += 1; { - Trip::triptype &with1 = Trip::tr[1]; + triptype &with1 = _vm->_trip.tr[1]; switch (with.jumpstatus) { case 1: case 2: @@ -477,7 +477,7 @@ void Timeout::jump() { if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ && (_vm->_gyro.dna.room == r__insidecardiffcastle) && (_vm->_gyro.dna.arrow_in_the_door == true) - && (Trip::infield(3))) { /* beside the wall*/ + && (_vm->_trip.infield(3))) { /* beside the wall*/ /* Grab the arrow! */ if (_vm->_gyro.dna.carrying >= maxobjs) _vm->_scrolls.display("You fail to grab it, because your hands are full."); @@ -536,8 +536,8 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro.magics[9].op = _vm->_gyro.nix; - Trip::tr[1].iy += 1; /* increments dx/dy! */ - Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */ + _vm->_trip.tr[1].iy += 1; /* increments dx/dy! */ + _vm->_trip.tr[1].y += _vm->_trip.tr[1].iy; /* Dowwwn we go... */ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -550,8 +550,8 @@ void Timeout::meet_avaroid() { _vm->_gyro.dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); { - Trip::triptype &with = Trip::tr[1]; - with.face = Trip::left; + triptype &with = _vm->_trip.tr[1]; + with.face = _vm->_trip.left; with.x = 151; with.ix = -3; with.iy = -5; @@ -562,7 +562,7 @@ void Timeout::meet_avaroid() { void Timeout::rise_up_oubliette() { { - Trip::triptype &with = Trip::tr[1]; + triptype &with = _vm->_trip.tr[1]; with.visible = true; with.iy += 1; /* decrements dx/dy! */ @@ -575,29 +575,29 @@ void Timeout::rise_up_oubliette() { } void Timeout::robin_hood_and_geida() { - Trip::tr[1].init(7, true); - Trip::apped(1, 7); - Trip::tr[1].walkto(6); - Trip::tr[2].stopwalk(); - Trip::tr[2].face = Trip::left; + _vm->_trip.tr[1].init(7, true, &_vm->_trip); + _vm->_trip.apped(1, 7); + _vm->_trip.tr[1].walkto(6); + _vm->_trip.tr[2].stopwalk(); + _vm->_trip.tr[2].face = _vm->_trip.left; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro.dna.geida_follows = false; } void Timeout::robin_hood_and_geida_talk() { _vm->_visa.dixi('q', 66); - Trip::tr[1].walkto(2); - Trip::tr[2].walkto(2); - Trip::tr[1].vanishifstill = true; - Trip::tr[2].vanishifstill = true; + _vm->_trip.tr[1].walkto(2); + _vm->_trip.tr[2].walkto(2); + _vm->_trip.tr[1].vanishifstill = true; + _vm->_trip.tr[2].vanishifstill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } void Timeout::avalot_returns() { - Trip::tr[1].done(); - Trip::tr[2].done(); - Trip::tr[1].init(0, true); - Trip::apped(1, 1); + _vm->_trip.tr[1].done(); + _vm->_trip.tr[2].done(); + _vm->_trip.tr[1].init(0, true, &_vm->_trip); + _vm->_trip.apped(1, 1); _vm->_visa.dixi('q', 67); _vm->_gyro.dna.user_moves_avvy = true; } @@ -606,13 +606,13 @@ void Timeout::avvy_sit_down() /* This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. */ { - if (Trip::tr[1].homing) /* Still walking */ + if (_vm->_trip.tr[1].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer.show_one(3); _vm->_gyro.dna.sitting_in_pub = true; _vm->_gyro.dna.user_moves_avvy = false; - Trip::tr[1].visible = false; + _vm->_trip.tr[1].visible = false; } } @@ -638,22 +638,22 @@ void Timeout::winning() { } void Timeout::avalot_falls() { - if (Trip::tr[1].step < 5) { - Trip::tr[1].step += 1; + if (_vm->_trip.tr[1].step < 5) { + _vm->_trip.tr[1].step += 1; set_up_timer(3, procavalot_falls, reason_falling_over); } else _vm->_scrolls.display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); } void Timeout::spludwick_goes_to_cauldron() { - if (Trip::tr[2].homing) + if (_vm->_trip.tr[2].homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } void Timeout::spludwick_leaves_cauldron() { - Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */ + _vm->_trip.tr[2].call_eachstep = true; /* So that normal procs will continue. */ } void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ From 8ba4050b1fd2c26486c23807bcc06fc68ba478ea Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 15:56:08 +0200 Subject: [PATCH 0062/1332] AVALANCHE: Add Acci. --- engines/avalanche/acci2.cpp | 1626 +++++++++++++++++++++++++++++++ engines/avalanche/acci2.h | 219 +++++ engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + 4 files changed, 1848 insertions(+) create mode 100644 engines/avalanche/acci2.cpp create mode 100644 engines/avalanche/acci2.h diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp new file mode 100644 index 000000000000..6ecb769c0ef9 --- /dev/null +++ b/engines/avalanche/acci2.cpp @@ -0,0 +1,1626 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* ACCIDENCE II The parser. */ + +#include "avalanche/avalanche.h" +#include "avalanche/acci2.h" + +#include "common/textconsole.h" +#include "common/scummsys.h" + +#include "avalanche/gyro2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/visa2.h" +#include "avalanche/timeout2.h" +#include "avalanche/trip6.h" +#include "avalanche/enid2.h" +#include "avalanche/celer2.h" +#include "avalanche/pingo2.h" +#include "avalanche/sequence2.h" + + +/*#include "NimUnit.h"*/ +/*#include "Highs.h"*/ +/*#include "Helper.h"*/ + +namespace Avalanche { + +const Acci::vocab Acci::words[nowords] = { + /* Verbs, 1-49 */ + {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ + {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, + {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ + {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, + {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, + {7, "SAY"}, {7, "ASK"}, + {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, + {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, + {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, + {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, + {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, + {17, "STAND"}, + + {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, + {20, "DOFF"}, + {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, + {22, "PLAY"}, + {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, + {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, + {255, "NINET"}, /* block for NINETY */ + {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, + {30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"}, + {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, + {30, "WIZZY"}, {30, "PLOVER"}, + {30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"}, + {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, + {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, + {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, + {30, "BONESCROLLS"}, {30, "RADOF"}, + + {31, "RESTART"}, + {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, + {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, + {34, "ORDER"}, {34, "DEMAND"}, + {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, + {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, + {35, "FIRE"}, + + /* Passwords, 36: */ + + {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, + {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, + {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, + {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, + {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, + {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, + {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, + {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, + {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, + {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, + + {37, "DIR"}, {37, "LS"}, {38, "DIE"}, + {39, "SCORE"}, + {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, + {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, + {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, + {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, + {46, "HELLO"}, {46, "HI"}, {46, "YO"}, + {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ + + + /* Nouns - Objects: 50-100. */ + + {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, + {50, "VINEGAR"}, {51, "MONEYBAG"}, + {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, + {51, "WALLET"}, + {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, + {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, + {55, "ARROW"}, {55, "DART"}, + {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, + {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, + {59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"}, + {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, + {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, + {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, + {66, "DISGUISE"}, {67, "ONION"}, + + {99, "PASSWORD"}, + + /* Objects from Also are placed between 101 and 131. */ + + /* Nouns - People - Male, 150-174 */ + {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, + {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, + {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, + {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, + {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ + {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, + {154, "MALAGAUCHE"}, + {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, + {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, + {157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"}, + {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, + {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, + {161, "STALLHOLDER"}, + {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, + {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, + {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, + + /* Nouns- People - Female: 175-199 */ + {175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"}, + {176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"}, + {178, "WITCH"}, + + /* Pronouns, 200-224 */ + {200, "_vm->_gyro.him"}, {200, "MAN"}, {200, "GUY"}, + {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, + {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, + {202, "IT"}, {202, "THING"}, + + {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, + + /* Prepositions, 225-249 */ + {225, "TO"}, {226, "AT"}, {227, "UP"}, + {228, "INTO"}, {228, "INSIDE"}, {229, "OFF"}, + {230, "UP"}, {231, "DOWN"}, {232, "ON"}, + + + /* Please, 251 */ + {251, "PLEASE"}, + + /* About, 252 */ + {252, "ABOUT"}, {252, "CONCERNING"}, + + /* Swear words, 253 */ + /* I M P O R T A N T M E S S A G E + + DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE + DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. + GOODNESS KNOWS WHO WROTE THEM. + READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. + WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ + + {253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"}, + {253, "FART"}, {253, "FUCK"}, {253, "BALLS"}, + {253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"}, + {253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"}, + {253, "SMEG"}, + /* and other even ruder words. You didn't read them, did you? Good. */ + + /* Answer-back smart-alec words, 249 */ + {249, "YES"}, {249, "NO"}, {249, "BECAUSE"}, + + /* Noise words, 255 */ + {255, "THE"}, {255, "A"}, {255, "NOW"}, + {255, "SOME"}, {255, "AND"}, {255, "THAT"}, + {255, "POCUS"}, {255, "HIS"}, + {255, "THIS"}, {255, "SENTINEL"} + +}; /* for "Ken SENT Me" */ + + +const char Acci::what[] = "That's not possible!"; + +const Acci::ranktype Acci::ranks[9] = { + {0, "Beginner"}, {10, "Novice"}, + {20, "Improving"}, {35, "Not bad"}, + {50, "Passable"}, {65, "Good"}, + {80, "Experienced"}, {108, "The BEST!"}, + {32767, "copyright'93"} +}; + + + + + + +void Acci::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Acci::init() { + _vm->_gyro.weirdword = false; +} + +void Acci::checkword(Common::String &x) { /* Checks uint16 "fv". */ + warning("STUB: Acci::checkuint16()"); +} + +Common::String Acci::wordnum(Common::String x) +{ + char whatsit; + uint16 fv; + bool gotcha; + + Common::String wordnum_result; + if (x == "") { + wordnum_result = ""; + return wordnum_result; + } + whatsit = pardon; + gotcha = false; + for (fv = nowords; fv >= 1; fv --) checkword(x); + wordnum_result = whatsit; + return wordnum_result; +} + +void Acci::replace(Common::String old1, Common::String new1) { + warning("STUB: Acci::replace()"); +} + +/*procedure ninetydump; +var f:file; y:int16; bit:byte; a:byte absolute $A000:800; +begin + off; + assign(f,'avvydump.avd'); + rewrite(f,1); + blockwrite(f,_vm->_gyro.dna,177); { just anything } + for bit:=0 to 3 do + begin + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; + blockwrite(f,a,12080); + end; + close(f); on; + _vm->_scrolls.display('Dumped.'); +end;*/ + +Common::String Acci::rank() { + byte fv; + + Common::String rank_result; + for (fv = 1; fv <= 8; fv ++) + if ((_vm->_gyro.dna.score >= ranks[fv].score) && (_vm->_gyro.dna.score < ranks[fv + 1].score)) { + rank_result = ranks[fv].title; + return rank_result; + } + + return rank_result; +} + +Common::String Acci::totaltime() { + const double ticks_in_1_sec = double(65535) / 3600; + uint16 h, m, s; + Common::String a; + + /* There are 65535 clock ticks in a second, + 1092.25 in a minute, and + 65535 in an hour. */ + Common::String totaltime_result; + + warning("STUB: Acci::totaltime()"); + + totaltime_result = a; + return totaltime_result; +} + + + +void Acci::number(Common::String &codes) { + warning("STUB: Acci::number()"); +} + +void Acci::cheatparse(Common::String codes) { + uint16 num; + int16 e; + + char cmd; + int16 se, sx, sy; + + warning("STUB: Acci::cheatparse()"); +} + +void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. */ + warning("STUB: Acci::punctustrip()"); +} + + + +void Acci::displaywhat(char ch, bool animate, bool &ambigous) { /* << it's an adjective! */ + byte ff; + Common::String z; + + warning("STUB: Acci::_vm->_scrolls.displaywhat()"); +} + +bool Acci::do_pronouns() { + bool ambiguous; + byte fv; + + bool do_pronouns_result; + ambiguous = false; + + warning("STUB: Acci::do_pronouns()"); + + do_pronouns_result = ambiguous; + return do_pronouns_result; +} + + + + + + +void Acci::lowercase() { + byte fv; + + warning("STUB: Acci::lowercase()"); +} + +void Acci::propernouns() { + byte fv; + + lowercase(); + warning("STUB: Acci::propernouns()"); +} + +void Acci::sayit() { /* This makes Avalot say the response. */ + Common::String x; + + warning("STUB: Acci::sayit()"); +} + +void Acci::store_interrogation(byte interrogation) { + byte fv; + + warning("STUB: Acci::store_interrogation()"); +} + + + +void Acci::clearuint16s() { + warning("STUB: Acci::clearuint16s()"); +} + +void Acci::parse() { + byte n, fv, ff; + Common::String c, cc, thisuint16; + Common::String answer; + bool notfound; + + /* first parsing - uint16 identification */ + warning("STUB: Acci::parse()"); +} + +void Acci::examobj() { /* Examine a standard object-thing */ + warning("STUB: Acci::examobj()"); +} + +bool Acci::personshere() { /* Person equivalent of "holding" */ + warning("STUB: Acci::personshere()"); + return true; +} + +void Acci::exampers() { + warning("STUB: Acci::exampers()"); +} + +bool Acci::holding() { + warning("STUB: Acci::holding()"); + return true; +} + + + +void Acci::special(bool before) { + warning("STUB: Acci::special()"); +} + +void Acci::examine() { + /* Examine. EITHER it's an object OR it's an Also OR it's a person OR + it's something else. */ + warning("STUB: Acci::examine()"); +} + + + +void Acci::inv() { /* the time-honoured command... */ + char fv; + byte q; + + q = 0; + + warning("STUB: Acci::inv()"); +} + +void Acci::swallow() { /* Eat something. */ + warning("STUB: Acci::swallow()"); +} + +void Acci::others() { +/* This lists the other people in the room. */ + warning("STUB: Acci::others()"); +} + +void Acci::lookaround() { +/* This is called when you say "look." */ + _vm->_scrolls.display(*_vm->_gyro.also[0][1]); + switch (_vm->_gyro.dna.room) { + case r__spludwicks: + if (_vm->_gyro.dna.avaricius_talk > 0) _vm->_visa.dixi('q', 23); + else others(); + break; + case r__robins: { + if (_vm->_gyro.dna.tied_up) _vm->_visa.dixi('q', 38); + if (_vm->_gyro.dna.mushroom_growing) _vm->_visa.dixi('q', 55); + } + break; + case r__insidecardiffcastle: + if (! _vm->_gyro.dna.taken_pen) _vm->_visa.dixi('q', 49); + break; + case r__lustiesroom: + if (_vm->_gyro.dna.lustie_is_asleep) _vm->_visa.dixi('q', 65); + break; + case r__catacombs: + switch (_vm->_gyro.dna.cat_y * 256 + _vm->_gyro.dna.cat_x) { + case 258 : + _vm->_visa.dixi('q', 80); + break; /* Inside art gallery */ + case 514 : + _vm->_visa.dixi('q', 81); + break; /* Outside ditto */ + case 260 : + _vm->_visa.dixi('q', 82); + break; /* Outside Geida's room. */ + } + break; + default: + others(); + } +} + +void Acci::opendoor() { /* so whaddya THINK this does?! */ + byte fv; + + switch (_vm->_gyro.dna.room) { /* Special cases. */ + case r__yours: + if (_vm->_trip.infield(2)) { + /* Opening the box. */ + thing = 54; /* The box. */ person = pardon; + examine(); + return; + } + break; + case r__spludwicks: + if (thing == 61) { + _vm->_visa.dixi('q', 85); + return; + } + break; + } + + + if ((! _vm->_gyro.dna.user_moves_avvy) && (_vm->_gyro.dna.room != r__lusties)) + return; /* No doors can open if you can't move Avvy. */ + for (fv = 9; fv <= 15; fv ++) + if (_vm->_trip.infield(fv)) { + { + _vm->_gyro.portals[fv]; + switch (_vm->_gyro.portals[fv].op) { + case _vm->_gyro.exclaim: { + _vm->_trip.tr[1].bounce(); + _vm->_visa.dixi('x', _vm->_gyro.portals[fv].data); + } + break; + case _vm->_gyro.transport: + _vm->_trip.fliproom((_vm->_gyro.portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro.portals[fv].data) & 0x0F /*Low byte*/); + break; + case _vm->_gyro.unfinished: { + _vm->_trip.tr[1].bounce(); + _vm->_scrolls.display("Sorry. This place is not available yet!"); + } + break; + case _vm->_gyro.special: + _vm->_trip.call_special(_vm->_gyro.portals[fv].data); + break; + case _vm->_gyro.mopendoor: + _vm->_trip.open_the_door((_vm->_gyro.portals[fv].data) >> 8, (_vm->_gyro.portals[fv].data) & 0x0F, fv); + break; + } + } + return; + } + if (_vm->_gyro.dna.room == r__map) + _vm->_scrolls.display(Common::String("Avvy, you can complete the whole game without ever going " + "to anywhere other than Argent, Birmingham, Cardiff, " + "Nottingham and Norwich.")); + else + _vm->_scrolls.display("Door? What door?"); +} + + + + +void Acci::silly() { + _vm->_scrolls.display("Don't be silly!"); +} + +void Acci::putproc() { /* Called when you call vb_put. */ + char temp; + + + if (! holding()) return; + thing2 -= 49; /* Slip the second object */ + temp = thing; + thing = thing2; + if (! holding()) return; + thing = temp; + + /* Thing is the thing which you're putting in. Thing2 is where you're + putting it. */ + /* Convenience thing. */ + switch (thing2) { + case _vm->_gyro.wine: + if (thing == _vm->_gyro.onion) { + if (_vm->_gyro.dna.rotten_onion) + _vm->_scrolls.display(Common::String("That's a bit like shutting the stable door after the " + "horse has bolted!")); + else { /* Put onion into wine? */ + if (_vm->_gyro.dna.winestate != 3) + _vm->_scrolls.display("\6Oignon au vin\22 is a bit too strong for your tastes!"); + else { /* Put onion into vinegar! Yes! */ + _vm->_gyro.dna.onion_in_vinegar = true; + _vm->_lucerna.points(7); + _vm->_visa.dixi('u', 9); + } + } + } else silly(); + break; + + case 54: + if (_vm->_gyro.dna.room == 1) { /* Put something into the box. */ + if (_vm->_gyro.dna.box_contents != nowt) + _vm->_scrolls.display(Common::String("There's something in the box already, Avvy. Try taking" + " that out first.")); + else + switch (thing) { + case _vm->_gyro.money: + _vm->_scrolls.display("You'd better keep some ready cash on you!"); + break; + case _vm->_gyro.bell: + _vm->_scrolls.display("That's a silly place to keep a bell."); + break; + case _vm->_gyro.bodkin: + _vm->_scrolls.display("But you might need it!"); + break; + case _vm->_gyro.onion: + _vm->_scrolls.display("Just give it to Spludwick, Avvy!"); + break; + default: { + /* Put the object into the box... */ + if (_vm->_gyro.dna.wearing == thing) + _vm->_scrolls.display(Common::String("You'd better take ") + _vm->_gyro.get_better(thing) + " off first!"); + else { + _vm->_celer.show_one(5); /* Open box. */ + _vm->_gyro.dna.box_contents = thing; + _vm->_gyro.dna.obj[thing] = false; + _vm->_lucerna.objectlist(); + _vm->_scrolls.display("OK, it's in the box."); + _vm->_celer.show_one(6); /* Shut box. */ + } + } + } + } else silly(); + break; + + default: + silly(); + } +} + + + + + +/* The result of this fn is whether or not he says "Hey, thanks!" */ +void Acci::not_in_order() { + _vm->_scrolls.display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + + " What I need next is " + + _vm->_gyro.get_better(_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick]) + ".\232\2"); +} + +void Acci::go_to_cauldron() { + _vm->_trip.tr[2].call_eachstep = false; /* Stops Geida_Procs. */ + _vm->_timeout.set_up_timer(1, _vm->_timeout.procspludwick_goes_to_cauldron, _vm->_timeout.reason_spludwalk); + _vm->_trip.tr[2].walkto(2); +} + +bool Acci::give2spludwick() { + bool give2spludwick_result; + { + give2spludwick_result = false; + + if (_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick] != thing) { + not_in_order(); + return give2spludwick_result; + } + + switch (thing) { + case _vm->_gyro.onion: { + _vm->_gyro.dna.obj[_vm->_gyro.onion] = false; + if (_vm->_gyro.dna.rotten_onion) + _vm->_visa.dixi('q', 22); + else { + _vm->_gyro.dna.given2spludwick += 1; + _vm->_visa.dixi('q', 20); + go_to_cauldron(); + _vm->_lucerna.points(3); + } + _vm->_lucerna.objectlist(); + } + break; + case _vm->_gyro.ink: { + _vm->_gyro.dna.obj[_vm->_gyro.ink] = false; + _vm->_lucerna.objectlist(); + _vm->_gyro.dna.given2spludwick += 1; + _vm->_visa.dixi('q', 24); + go_to_cauldron(); + _vm->_lucerna.points(3); + } + break; + case _vm->_gyro.mushroom: { + _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = false; + _vm->_visa.dixi('q', 25); + _vm->_lucerna.points(5); + _vm->_gyro.dna.given2spludwick += 1; + go_to_cauldron(); + _vm->_gyro.dna.obj[_vm->_gyro.potion] = true; + _vm->_lucerna.objectlist(); + } + break; + default: + give2spludwick_result = true; + } + } + return give2spludwick_result; +} + + + +void Acci::have_a_drink() { + { + _vm->_gyro.dna.alcohol += 1; + if (_vm->_gyro.dna.alcohol == 5) { + _vm->_gyro.dna.obj[_vm->_gyro.key] = true; /* Get the key. */ + _vm->_gyro.dna.teetotal = true; + _vm->_gyro.dna.avvy_is_awake = false; + _vm->_gyro.dna.avvy_in_bed = true; + _vm->_lucerna.objectlist(); + _vm->_lucerna.dusk(); + _vm->_gyro.hang_around_for_a_while(); + _vm->_trip.fliproom(1, 1); + _vm->_gyro.background(14); + _vm->_trip.new_game_for_trippancy(); /* Not really */ + } + } +} + +void Acci::cardiff_climbing() { + if (_vm->_gyro.dna.standing_on_dais) { + /* Clamber up. */ + _vm->_scrolls.display("You climb down, back onto the floor."); + _vm->_gyro.dna.standing_on_dais = false; + _vm->_trip.apped(1, 3); + } else { + /* Clamber down. */ + if (_vm->_trip.infield(1)) { + _vm->_scrolls.display("You clamber up onto the dais."); + _vm->_gyro.dna.standing_on_dais = true; + _vm->_trip.apped(1, 2); + } else + _vm->_scrolls.display("Get a bit closer, Avvy."); + } +} + + + + +/* Called when you ask Avvy to stand. */ +void Acci::already() { + _vm->_scrolls.display("You're already standing!"); +} + +void Acci::stand_up() { + switch (_vm->_gyro.dna.room) { + case r__yours: /* Avvy isn't asleep. */ + if (_vm->_gyro.dna.avvy_in_bed) { /* But he's in bed. */ + if (_vm->_gyro.dna.teetotal) { + _vm->_visa.dixi('d', 12); + _vm->_gyro.background(0); + _vm->_visa.dixi('d', 14); + } + _vm->_trip.tr[1].visible = true; + _vm->_gyro.dna.user_moves_avvy = true; + _vm->_trip.apped(1, 2); + _vm->_gyro.dna.rw = _vm->_gyro.left; + _vm->_celer.show_one(4); /* Picture of empty pillow. */ + _vm->_lucerna.points(1); + _vm->_gyro.dna.avvy_in_bed = false; + _vm->_timeout.lose_timer(_vm->_timeout.reason_arkata_shouts); + } else already(); + break; + + case r__insidecardiffcastle: + cardiff_climbing(); + break; + + case r__nottspub: + if (_vm->_gyro.dna.sitting_in_pub) { + _vm->_celer.show_one(4); /* Not sitting down. */ + _vm->_trip.tr[1].visible = true; /* But standing up. */ + _vm->_trip.apped(1, 4); /* And walking away. */ + _vm->_gyro.dna.sitting_in_pub = false; /* Really not sitting down. */ + _vm->_gyro.dna.user_moves_avvy = true; /* And ambulant. */ + } else already(); + break; + default: + already(); + } +} + + + + +void Acci::getproc(char thing) { + switch (_vm->_gyro.dna.room) { + case r__yours: + if (_vm->_trip.infield(2)) { + if (_vm->_gyro.dna.box_contents == thing) { + _vm->_celer.show_one(5); + _vm->_scrolls.display("OK, I've got it."); + _vm->_gyro.dna.obj[thing] = true; + _vm->_lucerna.objectlist(); + _vm->_gyro.dna.box_contents = nowt; + _vm->_celer.show_one(6); + } else + _vm->_scrolls.display(Common::String("I can't see ") + _vm->_gyro.get_better(thing) + " in the box."); + } else _vm->_visa.dixi('q', 57); + break; + case r__insidecardiffcastle: + switch (thing) { + case _vm->_gyro.pen: { + if (_vm->_trip.infield(2)) { + /* Standing on the dais. */ + + if (_vm->_gyro.dna.taken_pen) + _vm->_scrolls.display("It's not there, Avvy."); + else { + /* OK: we're taking the pen, and it's there. */ + _vm->_celer.show_one(4); /* No pen there now. */ + _vm->_trip.call_special(3); /* Zap! */ + _vm->_gyro.dna.taken_pen = true; + _vm->_gyro.dna.obj[_vm->_gyro.pen] = true; + _vm->_lucerna.objectlist(); + _vm->_scrolls.display("Taken."); + } + } else if (_vm->_gyro.dna.standing_on_dais) _vm->_visa.dixi('q', 53); + else _vm->_visa.dixi('q', 51); + } + break; + case _vm->_gyro.bolt: + _vm->_visa.dixi('q', 52); + break; + default: + _vm->_visa.dixi('q', 57); + } + break; + case r__robins: + if ((thing == _vm->_gyro.mushroom) & (_vm->_trip.infield(1)) & (_vm->_gyro.dna.mushroom_growing)) { + _vm->_celer.show_one(3); + _vm->_scrolls.display("Got it!"); + _vm->_gyro.dna.mushroom_growing = false; + _vm->_gyro.dna.taken_mushroom = true; + _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = true; + _vm->_lucerna.objectlist(); + _vm->_lucerna.points(3); + } else _vm->_visa.dixi('q', 57); + break; + default: + _vm->_visa.dixi('q', 57); + } +} + +void Acci::give_geida_the_lute() { + { + if (_vm->_gyro.dna.room != r__lustiesroom) { + _vm->_scrolls.display("Not yet. Try later!\232\2"); + return; + } + _vm->_gyro.dna.obj[_vm->_gyro.lute] = false; + _vm->_lucerna.objectlist(); + _vm->_visa.dixi('q', 64); /* She plays it. */ + + /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ + + _vm->_timeout.set_up_timer(1, _vm->_timeout.procgive_lute_to_geida, _vm->_timeout.reason_geida_sings); + _vm->_enid.back_to_bootstrap(4); + } +} + +void Acci::play_harp() { + if (_vm->_trip.infield(7)) + _vm->_scrolls.musical_scroll(); + else _vm->_scrolls.display("Get a bit closer to it, Avvy!"); +} + +void Acci::winsequence() { + _vm->_visa.dixi('q', 78); + _vm->_sequence.first_show(7); + _vm->_sequence.then_show(8); + _vm->_sequence.then_show(9); + _vm->_sequence.start_to_close(); + _vm->_timeout.set_up_timer(30, _vm->_timeout.procwinning, _vm->_timeout.reason_winning); +} + +void Acci::person_speaks() { + bool found; + byte fv; + char cfv; + + + if ((person == pardon) || (person == '\0')) { + if ((_vm->_gyro.him == pardon) || (_vm->_gyro.whereis[_vm->_gyro.him] != _vm->_gyro.dna.room)) person = _vm->_gyro.her; + else person = _vm->_gyro.him; + } + + if (_vm->_gyro.whereis[person] != _vm->_gyro.dna.room) { + _vm->_scrolls.display("\231\4"); /* Avvy _vm->_gyro.himself! */ + return; + } + + found = false; /* The person we're looking for's code is in Person. */ + + for (fv = 1; fv <= _vm->_trip.numtr; fv ++) + if (_vm->_trip.tr[fv].quick && ((_vm->_trip.tr[fv].a.accinum + 149) == person)) { + _vm->_scrolls.display(Common::String('\23') + char(fv + 48) + '\4'); + found = true; + } + + if (! found) + for (fv = 10; fv <= 25; fv ++) { + _vm->_gyro.quasipeds[fv]; + if ((_vm->_gyro.quasipeds[fv].who == person) && (_vm->_gyro.quasipeds[fv].room == _vm->_gyro.dna.room)) { + _vm->_scrolls.display(Common::String('\23') + char(fv + 55) + '\4'); + } + } +} + + + + +void Acci::heythanks() { + person_speaks(); + _vm->_scrolls.display("Hey, thanks!\2(But now, you've lost it!)"); + _vm->_gyro.dna.obj[thing] = false; +} + +void Acci::do_that() { + const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + byte fv, ff; + int16 sx, sy; + bool ok; + + + if (thats == Common::String(nowt)) { + thats = ""; + return; + } + if (_vm->_gyro.weirdword) return; + if (thing < '\310') thing -= 49; /* "Slip" */ + + /*if ((! _vm->_gyro.alive) & + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, + vb_highscores, vb_smartalec, eos).has(verb))) { + _vm->_scrolls.display(Common::String("You're dead, so don't talk. What are you, a ghost ") + + "or something? Try restarting, or restoring a saved game!"); + return; + } + + if ((~ _vm->_gyro.dna.avvy_is_awake) & + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, + vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { + _vm->_scrolls.display("Talking in your sleep? Try waking up!"); + return; + }*/ + + + switch (verb) { + case vb_exam: + examine(); + break; + case vb_open: + opendoor(); + break; + case vb_pause: + _vm->_scrolls.display(Common::String("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + + "the mouse on the `O.K.\" box to continue."); + break; + case vb_get: { + if (thing != pardon) { + /* Legitimate try to pick something up. */ + if (_vm->_gyro.dna.carrying >= maxobjs) _vm->_scrolls.display("You can't carry any more!"); + else getproc(thing); + + } else { + /* Not... ditto. */ + if (person != pardon) + _vm->_scrolls.display("You can't sweep folk off their feet!"); + else + _vm->_scrolls.display("I assure you, you don't need it."); + } + } + break; + case vb_drop: + _vm->_scrolls.display(Common::String("Two years ago you dropped a florin in the street. Three days ") + + "later it was gone! So now you never leave ANYTHING lying around. OK?"); + break; + /* begin _vm->_gyro.dna.obj[thing]:=false; _vm->_lucerna.objectlist(); end;*/ + case vb_inv: + inv(); + break; + case vb_talk: + if (person == pardon) { + if (_vm->_gyro.subjnumber == 99) /* They typed "say passuint16". */ + _vm->_scrolls.display("Yes, but what \6is\22 the passuint16?"); + /*else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { + Delete(thats, 1, 1); + move(realuint16s[2], realuint16s[1], sizeof(realuint16s) - sizeof(realuint16s[1])); + verb = chr(subjnumber); + do_that(); + return; + } else { + person = _vm->_gyro.subjnumber; + subjnumber = 0; + if (set::of(pardon, '\0', eos).has(person)) _vm->_scrolls.display("Talk to whom?"); + else if (personshere()) talkto(ord(person)); + } + }*/ else if (person == pardon) _vm->_scrolls.display("Talk to whom?"); + else if (personshere()) _vm->_visa.talkto(person); + break; + + case vb_give: + if (holding()) { + if (person == pardon) _vm->_scrolls.display("Give to whom?"); + else if (personshere()) { + switch (thing) { + case _vm->_gyro.money : + _vm->_scrolls.display("You can't bring yourself to give away your moneybag."); + break; + case _vm->_gyro.bodkin: + case _vm->_gyro.bell: + case _vm->_gyro.clothes: + case _vm->_gyro.habit : + _vm->_scrolls.display("Don't give it away, it might be useful!"); + break; + default: + switch (person) { + case _vm->_gyro.pcrapulus: + switch (thing) { + case _vm->_gyro.wine: { + _vm->_scrolls.display("Crapulus grabs the wine and gulps it down."); + _vm->_gyro.dna.obj[_vm->_gyro.wine] = false; + } + break; + default: + heythanks(); + } + break; + case _vm->_gyro.pcwytalot: + /*if (set::of(crossbow, bolt, eos).has(thing)) + _vm->_scrolls.display(Common::String("You might be able to influence ") + + "Cwytalot more if you used it!"); + else */heythanks(); + break; + case _vm->_gyro.pspludwick: + if (give2spludwick()) heythanks(); + break; + case _vm->_gyro.pibythneth: + if (thing == _vm->_gyro.badge) { + _vm->_visa.dixi('q', 32); /* Thanks! Wow! */ + _vm->_lucerna.points(3); + _vm->_gyro.dna.obj[_vm->_gyro.badge] = false; + _vm->_gyro.dna.obj[_vm->_gyro.habit] = true; + _vm->_gyro.dna.givenbadgetoiby = true; + _vm->_celer.show_one(8); + _vm->_celer.show_one(9); + } else heythanks(); + break; + case _vm->_gyro.payles: + if (_vm->_gyro.dna.ayles_is_awake) { + if (thing == _vm->_gyro.pen) { + _vm->_gyro.dna.obj[_vm->_gyro.pen] = false; + _vm->_visa.dixi('q', 54); + _vm->_gyro.dna.obj[_vm->_gyro.ink] = true; + _vm->_gyro.dna.given_pen_to_ayles = true; + _vm->_lucerna.objectlist(); + _vm->_lucerna.points(2); + } else heythanks(); + } else + _vm->_scrolls.display("But he's asleep!"); + break; + case _vm->_gyro.pgeida: + switch (thing) { + case _vm->_gyro.potion : { + _vm->_gyro.dna.obj[_vm->_gyro.potion] = false; + _vm->_visa.dixi('u', 16); /* She drinks it. */ + _vm->_lucerna.points(2); + _vm->_gyro.dna.geida_given_potion = true; + _vm->_lucerna.objectlist(); + } + break; + case _vm->_gyro.lute: + give_geida_the_lute(); + break; + default: + heythanks(); + } + break; + case _vm->_gyro.parkata: + switch (thing) { + case _vm->_gyro.potion: + if (_vm->_gyro.dna.geida_given_potion) + winsequence(); + else _vm->_visa.dixi('q', 77); + break; /* That Geida woman! */ + default: + heythanks(); + } + break; + default: + heythanks(); + } + } + } + _vm->_lucerna.objectlist(); /* Just in case... */ + } + break; + + case vb_eat: + case vb_drink: + if (holding()) swallow(); + break; + case vb_load: + _vm->_enid.edna_load(realwords[2]); + break; + case vb_save: + if (_vm->_gyro.alive) + _vm->_enid.edna_save(realwords[2]); + else + _vm->_scrolls.display("It's a bit late now to save your game!"); + break; + case vb_pay: + _vm->_scrolls.display("No money need change hands."); + break; + case vb_look: + lookaround(); + break; + case vb_break: + _vm->_scrolls.display("Vandalism is prohibited within this game!"); + break; + case vb_quit: { /* quit */ + //if (_vm->_gyro.demo) { + // _vm->_visa.dixi('q', 31); + // close(demofile); + // exit(0); /* Change this later!!! */ + //} + if (! polite) _vm->_scrolls.display("How about a `please\", Avvy?"); + else if (_vm->_scrolls.ask("\23C\26Do you really want to quit?")) _vm->_gyro.lmo = true; + } + break; + case vb_go: + _vm->_scrolls.display("Just use the arrow keys to walk there."); + break; + case vb_info: { + _vm->_scrolls.aboutscroll = true; + /* _vm->_scrolls.display('Thorsoft of Letchworth presents:'+^c+^m+^m+ + 'The medival descendant of'+^m+ + 'Denarius Avaricius Sextus'+^m+'in:'+ + ^m+^m+'LORD AVALOT D''ARGENT'+ + ^m+'version '+vernum+^m+^m+'Copyright ' + +copyright+', Mark, Mike and Thomas Thurman.');*/ + _vm->_scrolls.display(Common::String("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + + "The medival descendant of" + '\15' + + "Denarius Avaricius Sextus" + + '\15' + '\15' + "version " + _vm->_gyro.vernum + '\15' + '\15' + "Copyright " + + _vm->_gyro.copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); + _vm->_scrolls.aboutscroll = false; + } + break; + case vb_undress: + if (_vm->_gyro.dna.wearing == nowt) _vm->_scrolls.display("You're already stark naked!"); + else if (_vm->_gyro.dna.avvys_in_the_cupboard) { + _vm->_scrolls.display(Common::String("You take off ") + _vm->_gyro.get_better(_vm->_gyro.dna.wearing) + '.'); + _vm->_gyro.dna.wearing = nowt; + _vm->_lucerna.objectlist(); + } else + _vm->_scrolls.display("Hadn't you better find somewhere more private, Avvy?"); + break; + case vb_wear: + if (holding()) { + /* wear something */ + switch (thing) { + case _vm->_gyro.chastity: + _vm->_scrolls.display("Hey, what kind of a weirdo are you\??!"); + break; + case _vm->_gyro.clothes: + case _vm->_gyro.habit: { /* Change this! */ + if (_vm->_gyro.dna.wearing != nowt) { + if (_vm->_gyro.dna.wearing == thing) + _vm->_scrolls.display("You're already wearing that."); + else + _vm->_scrolls.display(Common::String("You'll be rather warm wearing two ") + + "sets of clothes!"); + return; + } else + _vm->_gyro.dna.wearing = thing; + _vm->_lucerna.objectlist(); + if (thing == _vm->_gyro.habit) fv = 3; + else fv = 0; + { + if (_vm->_trip.tr[1].whichsprite != fv) { + sx = _vm->_trip.tr[1].x; + sy = _vm->_trip.tr[1].y; + _vm->_trip.tr[1].done(); + _vm->_trip.tr[1].init(fv, true, &_vm->_trip); + _vm->_trip.tr[1].appear(sx, sy, _vm->_trip.left); + _vm->_trip.tr[1].visible = false; + } + } + } + break; + default: + _vm->_scrolls.display(what); + } + } + break; + case vb_play: + if (thing == pardon) + switch (_vm->_gyro.dna.room) { /* They just typed "play"... */ + case r__argentpub: + // play_nim(); + // I just don't plan to implement Nim yet. + break; /* ...in the pub, => play Nim. */ + case r__musicroom: + play_harp(); + break; + } + else if (holding()) { + switch (thing) { + case _vm->_gyro.lute : { + _vm->_visa.dixi('U', 7); + if (_vm->_gyro.whereis[_vm->_gyro.pcwytalot] == _vm->_gyro.dna.room) _vm->_visa.dixi('U', 10); + if (_vm->_gyro.whereis[_vm->_gyro.pdulustie] == _vm->_gyro.dna.room) _vm->_visa.dixi('U', 15); + } + break; + case 52 : + if (_vm->_gyro.dna.room == r__musicroom) play_harp(); + else _vm->_scrolls.display(what); + break; + case 55 : + if (_vm->_gyro.dna.room == r__argentpub) ; /*play_nim(); - Don't implement yet.*/ + else _vm->_scrolls.display(what); + break; + default: + _vm->_scrolls.display(what); + } + } + break; + case vb_ring: + if (holding()) { + if (thing == _vm->_gyro.bell) { + _vm->_scrolls.display("Ding, dong, ding, dong, ding, dong, ding, dong..."); + if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) + _vm->_scrolls.display("(Are you trying to join in, Avvy\?\?!)"); + } else _vm->_scrolls.display(what); + } + break; + case vb_help: + // boot_help(); + // I don't want to implement help yet. + break; + case vb_larrypass: + _vm->_scrolls.display("Wrong game!"); + break; + case vb_phaon: + _vm->_scrolls.display("Hello, Phaon!"); + break; + case vb_boss: + // bosskey(); + // I don't want to implement bosskey yet. + break; + case vb_pee: + if (_vm->_gyro.flagset('P')) { + _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); + _vm->_timeout.set_up_timer(4, _vm->_timeout.procurinate, _vm->_timeout.reason_gototoilet); + } else _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); + break; + case vb_cheat: { + _vm->_scrolls.display(Common::String('\6') + "Cheat mode now enabled."); + _vm->_gyro.cheat = true; + } + break; + case vb_magic: + if (_vm->_gyro.dna.avaricius_talk > 0) + _vm->_visa.dixi('q', 19); + else { + if ((_vm->_gyro.dna.room == 12) & (_vm->_trip.infield(2))) { + /* Avaricius appears! */ + _vm->_visa.dixi('q', 17); + if (_vm->_gyro.whereis['\227'] == 12) + _vm->_visa.dixi('q', 18); + else { + _vm->_trip.tr[2].init(1, false, &_vm->_trip); /* Avaricius */ + _vm->_trip.apped(2, 4); + _vm->_trip.tr[2].walkto(5); + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procback_and_forth; + _vm->_gyro.dna.avaricius_talk = 14; + _vm->_timeout.set_up_timer(177, _vm->_timeout.procavaricius_talks, _vm->_timeout.reason_avariciustalks); + } + } else _vm->_scrolls.display("Nothing appears to happen..."); + } + break; + case vb_smartalec: + _vm->_scrolls.display("Listen, smart alec, that was just rhetoric."); + break; + case vb_expletive: { + switch ( _vm->_gyro.dna.swore) { + case 0: + _vm->_scrolls.display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + + "(I shouldn't say it again, if I were you!)"); + break; + case 1: + _vm->_scrolls.display(Common::String("You hear a distant rumble of thunder. Must you always ") + + "do things I tell you not to?\r\rDon't do it again!"); + break; + default: { + _vm->_pingo.zonk(); + _vm->_scrolls.display(Common::String("A crack of lightning shoots from the sky, ") + + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); + _vm->_lucerna.gameover(); + } + } + _vm->_gyro.dna.swore ++; + } + break; + case vb_listen: + if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) + _vm->_scrolls.display(Common::String("All other noise is drowned out by the ringing of ") + + "the bells."); + else if (_vm->_gyro.listen == "") + _vm->_scrolls.display("You can't hear anything much at the moment, Avvy."); + else _vm->_scrolls.display(_vm->_gyro.listen); + break; + case vb_buy: { + /* What are they trying to buy? */ + switch (_vm->_gyro.dna.room) { + case r__argentpub: + if (_vm->_trip.infield(6)) { + /* We're in a pub, and near the bar. */ + switch (thing) { + case '\63': + case '\65': + case '\66': + case '\72': { /* Beer, whisky, cider or mead */ + if (_vm->_gyro.dna.malagauche == 177) { /* Already getting us one. */ + _vm->_visa.dixi('D', 15); + return; + } + if (_vm->_gyro.dna.teetotal) { + _vm->_visa.dixi('D', 6); + return; + } + if (_vm->_gyro.dna.alcohol == 0) _vm->_lucerna.points(3); + _vm->_celer.show_one(12); + _vm->_scrolls.display(booze[thing] + ", please.\231\2"); + _vm->_gyro.dna.drinking = thing; + + _vm->_celer.show_one(10); + _vm->_gyro.dna.malagauche = 177; + _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuydrinks, _vm->_timeout.reason_drinks); + } + break; + case '\64': + examine(); + break; /* We have a right one here- buy Pepsi??! */ + case _vm->_gyro.wine: + if (_vm->_gyro.dna.obj[_vm->_gyro.wine]) /* We've already got the wine! */ + _vm->_visa.dixi('D', 2); /* 1 bottle's shufishent! */ + else { + if (_vm->_gyro.dna.malagauche == 177) { /* Already getting us one. */ + _vm->_visa.dixi('D', 15); + return; + } + if (_vm->_gyro.dna.carrying >= maxobjs) { + _vm->_scrolls.display("Your hands are full."); + return; + } + _vm->_celer.show_one(12); + _vm->_scrolls.display("Wine, please.\231\2"); + if (_vm->_gyro.dna.alcohol == 0) _vm->_lucerna.points(3); + _vm->_celer.show_one(10); + _vm->_gyro.dna.malagauche = 177; + + _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuywine, _vm->_timeout.reason_drinks); + } + break; + } + } else _vm->_visa.dixi('D', 5); + break; /* Go to the bar! */ + + case r__outsideducks: + if (_vm->_trip.infield(6)) { + if (thing == _vm->_gyro.onion) { + if (_vm->_gyro.dna.obj[_vm->_gyro.onion]) + _vm->_visa.dixi('D', 10); /* not planning to juggle with the things! */ + else if (_vm->_gyro.dna.carrying >= maxobjs) + _vm->_scrolls.display("Before you ask, you remember that your hands are full."); + else { + if (_vm->_gyro.dna.bought_onion) + _vm->_visa.dixi('D', 11); + else { + _vm->_visa.dixi('D', 9); + _vm->_lucerna.points(3); + } + _vm->_gyro.pennycheck(3); /* It costs thruppence. */ + _vm->_gyro.dna.obj[_vm->_gyro.onion] = true; + _vm->_lucerna.objectlist(); + _vm->_gyro.dna.bought_onion = true; + _vm->_gyro.dna.rotten_onion = false; /* It's OK when it leaves the stall! */ + _vm->_gyro.dna.onion_in_vinegar = false; + } + } else _vm->_visa.dixi('D', 0); + } else _vm->_visa.dixi('D', 0); + break; + + case r__nottspub: + _vm->_visa.dixi('n', 15); + break; /* Can't sell to southerners. */ + default: + _vm->_visa.dixi('D', 0); /* Can't buy that. */ + } + } + break; + case vb_attack: { + if ((_vm->_gyro.dna.room == r__brummieroad) && + ((person == '\235') || (thing == _vm->_gyro.crossbow) || (thing == _vm->_gyro.bolt)) + && (_vm->_gyro.whereis['\235'] == _vm->_gyro.dna.room)) { + switch (_vm->_gyro.dna.obj[_vm->_gyro.bolt] + _vm->_gyro.dna.obj[_vm->_gyro.crossbow] * 2) { + /* 0 = neither, 1 = only bolt, 2 = only crossbow, + 3 = both. */ + case 0: { + _vm->_visa.dixi('Q', 10); + _vm->_scrolls.display("(At the very least, don't use your bare hands!)"); + } + break; + case 1: + _vm->_scrolls.display(Common::String("Attack _vm->_gyro.him with only a crossbow bolt? Are you ") + + "planning on playing darts?!"); + break; + case 2: + _vm->_scrolls.display(Common::String("Come on, Avvy! You're not going to get very far ") + + "with only a crossbow!"); + break; + case 3: { + _vm->_visa.dixi('Q', 11); + _vm->_gyro.dna.cwytalot_gone = true; + _vm->_gyro.dna.obj[_vm->_gyro.bolt] = false; + _vm->_gyro.dna.obj[_vm->_gyro.crossbow] = false; + _vm->_lucerna.objectlist(); + _vm->_gyro.magics[12].op = _vm->_gyro.nix; + _vm->_lucerna.points(7); + _vm->_trip.tr[2].walkto(2); + _vm->_trip.tr[2].vanishifstill = true; + _vm->_trip.tr[2].call_eachstep = false; + _vm->_gyro.whereis['\235'] = 177; + } + break; + default: + _vm->_visa.dixi('Q', 10); /* Please try not to be so violent! */ + } + } else _vm->_visa.dixi('Q', 10); + } + break; + case vb_password: + if (_vm->_gyro.dna.room != r__bridge) + _vm->_visa.dixi('Q', 12); + else { + ok = true; + for (ff = 1; ff <= thats.size(); ff ++) + for (fv = 1; fv <= words[_vm->_gyro.dna.pass_num + first_password].w.size(); fv ++) { + Common::String temp = realwords[ff]; + temp.toUppercase(); + if (words[_vm->_gyro.dna.pass_num + first_password].w[fv] != temp[fv]) + ok = false; + } + if (ok) { + if (_vm->_gyro.dna.drawbridge_open != 0) + _vm->_scrolls.display("Contrary to your expectations, the drawbridge fails to close again."); + else { + _vm->_lucerna.points(4); + _vm->_scrolls.display("The drawbridge opens!"); + _vm->_timeout.set_up_timer(7, _vm->_timeout.procopen_drawbridge, _vm->_timeout.reason_drawbridgefalls); + _vm->_gyro.dna.drawbridge_open = 1; + } + } else _vm->_visa.dixi('Q', 12); + } + break; + case vb_dir: + _vm->_enid.dir(realwords[2]); + break; + case vb_die: + _vm->_lucerna.gameover(); + break; + case vb_score: + _vm->_scrolls.display(Common::String("Your score is ") + _vm->_gyro.strf(_vm->_gyro.dna.score) + ",\3\rout of a " + + "possible 128.\r\rThis gives you a rank of " + rank() + + ".\r\r" + totaltime()); + break; + case vb_put: + putproc(); + break; + case vb_stand: + stand_up(); + break; + + case vb_kiss: + if (person == pardon) + _vm->_scrolls.display("Kiss whom?"); + else if (personshere()) + switch (person) { + case _vm->_gyro.parkata: + _vm->_visa.dixi('U', 12); + break; + case _vm->_gyro.pgeida: + _vm->_visa.dixi('U', 13); + break; + case _vm->_gyro.pwisewoman: + _vm->_visa.dixi('U', 14); + break; + default: + _vm->_visa.dixi('U', 5); /* You WHAT? */ + } + else if ((150 <= person) && (person <= 174)) + _vm->_scrolls.display("Hey, what kind of a weirdo are you??"); + + break; + + case vb_climb: + if (_vm->_gyro.dna.room == r__insidecardiffcastle) cardiff_climbing(); + else /* In the wrong room! */ + _vm->_scrolls.display("Not with your head for heights, Avvy!"); + break; + + case vb_jump: { + _vm->_timeout.set_up_timer(1, _vm->_timeout.procjump, _vm->_timeout.reason_jumping); + _vm->_gyro.dna.user_moves_avvy = false; + } + break; + + case vb_highscores: + // show_highs(); + // to be implemented later... + break; + + case vb_wake: + if (personshere()) + switch (person) { + case pardon: + case _vm->_gyro.pavalot: + case '\0': + if (! _vm->_gyro.dna.avvy_is_awake) { + _vm->_gyro.dna.avvy_is_awake = true; + _vm->_lucerna.points(1); + _vm->_gyro.dna.avvy_in_bed = true; + _vm->_celer.show_one(3); /* Picture of Avvy, awake in bed. */ + if (_vm->_gyro.dna.teetotal) _vm->_visa.dixi('d', 13); + } else _vm->_scrolls.display("You're already awake, Avvy!"); + break; + case _vm->_gyro.payles: + if (! _vm->_gyro.dna.ayles_is_awake) _vm->_scrolls.display("You can't seem to wake _vm->_gyro.him by yourself."); + break; + case _vm->_gyro.pjacques: + _vm->_scrolls.display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + + "Hmmm... that doesn't seem to do any good..."); + break; + default: + _vm->_scrolls.display("It's difficult to awaken people who aren't asleep...!"); + } + break; + + case vb_sit: + if (_vm->_gyro.dna.room == r__nottspub) { + if (_vm->_gyro.dna.sitting_in_pub) + _vm->_scrolls.display("You're already sitting!"); + else { + _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro.him down. */ + _vm->_timeout.set_up_timer(1, _vm->_timeout.procavvy_sit_down, _vm->_timeout.reason_sitting_down); + } + } else { + /* Default doodah. */ + _vm->_lucerna.dusk(); + _vm->_gyro.hang_around_for_a_while(); + _vm->_lucerna.dawn(); + _vm->_scrolls.display("A few hours later...\20nothing much has happened..."); + } + break; + + case vb_restart: + if (_vm->_scrolls.ask("Restart game and lose changes?")) { + _vm->_lucerna.dusk(); + _vm->_gyro.newgame(); + _vm->_lucerna.dawn(); + } + break; + + case pardon: + _vm->_scrolls.display("Hey, a verb would be helpful!"); + break; + + case vb_hello: { + person_speaks(); + _vm->_scrolls.display("Hello.\2"); + } + break; + case vb_thanks: { + person_speaks(); + _vm->_scrolls.display("That's OK.\2"); + } + break; + default: + _vm->_scrolls.display(Common::String('\7') + "Parser bug!"); + } + } +} + +void Acci::verbopt(char n, Common::String &answer, char &anskey) { + switch (n) { + case vb_exam: { + answer = "Examine"; + anskey = 'x'; + } + break; /* the ubiqutous one */ + /* vb_give isn't dealt with by this procedure, but by ddm__with */ + case vb_drink: { + answer = "Drink"; + anskey = 'D'; + } + break; + case vb_wear: { + answer = "Wear"; + anskey = 'W'; + } + break; + case vb_ring: { + answer = "Ring"; + anskey = 'R'; + } + break; /* only the bell! */ + case vb_play: { + answer = "Play"; + anskey = 'P'; + } + break; + case vb_eat: { + answer = "Eat"; + anskey = 'E'; + } + break; + default: { + answer = "? Unknown!"; /* Bug! */ + anskey = '?'; + } + } +} + + + +} // End of namespace Avalanche. diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h new file mode 100644 index 000000000000..5650146414b7 --- /dev/null +++ b/engines/avalanche/acci2.h @@ -0,0 +1,219 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* ACCIDENCE II The parser. */ + +#ifndef ACCI2_H +#define ACCI2_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Avalanche { +class AvalancheEngine; + +class Acci { +public: + /* verb codes */ + static const char vb_exam = 1; + static const char vb_open = 2; + static const char vb_pause = 3; + static const char vb_get = 4; + static const char vb_drop = 5; + static const char vb_inv = 6; + static const char vb_talk = 7; + static const char vb_give = 8; + static const char vb_drink = 9; + static const char vb_load = 10; + static const char vb_save = 11; + static const char vb_pay = 12; + static const char vb_look = 13; + static const char vb_break = 14; + static const char vb_quit = 15; + static const char vb_sit = 16; + static const char vb_stand = 17; + static const char vb_go = 18; + static const char vb_info = 19; + static const char vb_undress = 20; + static const char vb_wear = 21; + static const char vb_play = 22; + static const char vb_ring = 23; + static const char vb_help = 24; + static const char vb_larrypass = 25; + static const char vb_phaon = 26; + static const char vb_boss = 27; + static const char vb_pee = 28; + static const char vb_cheat = 29; + static const char vb_magic = 30; + static const char vb_restart = 31; + static const char vb_eat = 32; + static const char vb_listen = 33; + static const char vb_buy = 34; + static const char vb_attack = 35; + static const char vb_password = 36; + static const char vb_dir = 37; + static const char vb_die = 38; + static const char vb_score = 39; + static const char vb_put = 40; + static const char vb_kiss = 41; + static const char vb_climb = 42; + static const char vb_jump = 43; + static const char vb_highscores = 44; + static const char vb_wake = 45; + static const char vb_hello = 46; + static const char vb_thanks = 47; + + static const char vb_smartalec = 249; + static const char vb_expletive = 253; + + static const char pardon = 254; /* =didn't understand / wasn't given. */ + + static const int16 nowords = 277; /* how many words does the parser know? */ + static const char nowt = 372; + static const char moved = 0; /* This word was moved. (Usually because it was the subject of + conversation.) */ + + static const int16 first_password = 89; /* Words[first_password] should equal "TIROS". */ + + + + struct vocab { + byte n; + Common::String w; + }; + + static const vocab words[nowords]; + + static const char what[]; + + + + struct ranktype { + uint16 score; + Common::String title; + }; + + static const ranktype ranks[9]; + + + + Common::String thats; + Common::String unknown; + Common::String realwords[11]; + char verb, person, thing, thing2; + bool polite; + + + + + void setParent(AvalancheEngine *vm); + + void init(); + + void clearwords(); + void parse(); + void lookaround(); + void opendoor(); + void do_that(); + void verbopt(char n, Common::String &answer, char &anskey); + void have_a_drink(); + +private: + AvalancheEngine *_vm; + + byte fv; + + void checkword(Common::String &x); + Common::String wordnum(Common::String x); + + void replace(Common::String old1, Common::String new1); + + Common::String rank(); + + Common::String totaltime(); + + void number(Common::String &codes); + void cheatparse(Common::String codes); + + void punctustrip(Common::String &x); + + void displaywhat(char ch, bool animate, bool &ambigous); + bool do_pronouns(); + + void lowercase(); + void propernouns(); + void sayit(); + void store_interrogation(byte interrogation); + + void clearuint16s(); + + void examobj(); + + bool personshere(); + + void exampers(); + + bool holding(); + + void special(bool before); + void examine(); + + void inv(); + + void swallow(); + + void others(); + + void silly(); + void putproc(); + + void not_in_order(); + void go_to_cauldron(); + bool give2spludwick(); + + void cardiff_climbing(); + + void already(); + void stand_up(); + + void getproc(char thing); + + void give_geida_the_lute(); + + void play_harp(); + + void winsequence(); + + void person_speaks(); + + void heythanks(); + +}; + +} // End of namespace Avalanche. + +#endif // ACCI2_H diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d090f8aa2c63..240c7b68ae63 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ namespace Avalanche { _sequence.setParent(this); _timeout.setParent(this); _trip.setParent(this); + _acci.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index f7f5b5b6fda2..5fa0fa926894 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -43,6 +43,7 @@ #include "avalanche/sequence2.h" #include "avalanche/timeout2.h" #include "avalanche/trip6.h" +#include "avalanche/acci2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -72,6 +73,7 @@ class AvalancheEngine : public Engine { Sequence _sequence; Timeout _timeout; Trip _trip; + Acci _acci; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); From cb9ec866ac50f7959ed1336af5a62c8e309736cf Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 15:57:37 +0200 Subject: [PATCH 0063/1332] AVALANCHE: Repair compilation, minor modifications. --- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/lucerna2.h | 2 -- engines/avalanche/timeout2.cpp | 4 ++-- engines/avalanche/trip6.cpp | 6 +++--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 3d022fb586bf..23aa40b640ed 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -498,7 +498,7 @@ class Gyro { Common::String mousetext; /* which:array[0..5] of byte;*/ void *p; - bool weirduint16; + bool weirdword; byte to_do; bool lmo, mousemade; Common::String scroll[15]; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3c1d59c8b3fe..22ae5b536e3c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -44,7 +44,7 @@ #include "avalanche/celer2.h" #include "avalanche/pingo2.h" #include "avalanche/sequence2.h" -#include "avalanche/acci2.h" +//#include "avalanche/acci2.h" //#include "dropdown.h" diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 259b639b6fe8..d4e729aaf47d 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -37,8 +37,6 @@ class AvalancheEngine; class Lucerna { public: - // Call it where Lucerna is first used. - // Procuded to replace the initizalization part of the original Pascal unit. Lucerna(); void setParent(AvalancheEngine *vm); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index fe5e5d966c4a..b4955f6ed6e4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -507,7 +507,7 @@ void Timeout::buydrinks() { _vm->_visa.dixi('D', 1); /* That'll be thruppence. */ if (_vm->_gyro.pennycheck(3)) /* Pay 3d. */ _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */ - Acci::have_a_drink(); + _vm->_acci.have_a_drink(); } void Timeout::buywine() { @@ -632,7 +632,7 @@ void Timeout::winning() { do { _vm->_lucerna.checkclick(); } while (!(_vm->_gyro.mrelease == 0)); - _vm->_lucerna.callverb(Acci::vb_score); + _vm->_lucerna.callverb(_vm->_acci.vb_score); _vm->_scrolls.display(" T H E E N D "); _vm->_gyro.lmo = true; } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f0d2abc3d417..5baa73d32ee4 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -64,7 +64,8 @@ void triptype::andexor() { } void triptype::turn(byte whichway) { - if (whichway == 8) face = 0; + if (whichway == 8) + face = 0; else face = whichway; } @@ -346,11 +347,10 @@ byte Trip::geida_ped(byte which) { return geida_ped_result; } -void Trip::catamove(byte ped) +void Trip::catamove(byte ped) { /* When you enter a new position in the catacombs, this procedure should be called. It changes the Also codes so that they may match the picture on the screen. (Coming soon: It draws up the screen, too.) */ -{ warning("Repair array indexes in Trip::catamove()"); From 1d11268eb486a28bf471c277a407954ccfcda212 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 29 Jun 2013 16:36:40 +0200 Subject: [PATCH 0064/1332] AVALANCHE: Reorganise includes. --- engines/avalanche/acci2.cpp | 7 +++---- engines/avalanche/celer2.cpp | 6 ++++-- engines/avalanche/celer2.h | 2 -- engines/avalanche/enhanced2.cpp | 4 +++- engines/avalanche/enhanced2.h | 2 +- engines/avalanche/enid2.cpp | 6 +++--- engines/avalanche/enid2.h | 1 - engines/avalanche/gyro2.cpp | 17 +++++++++-------- engines/avalanche/gyro2.h | 1 - engines/avalanche/logger2.cpp | 6 +++--- engines/avalanche/logger2.h | 1 - engines/avalanche/lucerna2.cpp | 6 ++---- engines/avalanche/pingo2.cpp | 3 +-- engines/avalanche/pingo2.h | 3 --- engines/avalanche/scrolls2.cpp | 15 ++++++++------- engines/avalanche/scrolls2.h | 3 --- engines/avalanche/sequence2.cpp | 3 ++- engines/avalanche/timeout2.cpp | 6 +++--- engines/avalanche/timeout2.h | 3 --- engines/avalanche/trip6.cpp | 8 ++++---- engines/avalanche/trip6.h | 4 ---- engines/avalanche/visa2.cpp | 4 ++-- 22 files changed, 48 insertions(+), 63 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 6ecb769c0ef9..2a86732b0c2c 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -28,11 +28,8 @@ /* ACCIDENCE II The parser. */ #include "avalanche/avalanche.h" -#include "avalanche/acci2.h" - -#include "common/textconsole.h" -#include "common/scummsys.h" +#include "avalanche/acci2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" @@ -44,6 +41,8 @@ #include "avalanche/pingo2.h" #include "avalanche/sequence2.h" +#include "common/textconsole.h" + /*#include "NimUnit.h"*/ /*#include "Highs.h"*/ diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 2e6ce5a9edbd..cec2923c7e6a 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -27,13 +27,15 @@ /* CELER The unit for updating the screen pics. */ +#include "avalanche/avalanche.h" + #include "avalanche/celer2.h" -#include "common/textconsole.h" #include "avalanche/trip6.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/roomnums.h" -#include "avalanche/avalanche.h" + +#include "common/textconsole.h" namespace Avalanche { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 263d717ab95d..e71dec5f1961 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -30,8 +30,6 @@ #ifndef CELER2_H #define CELER2_H - - #include "common/scummsys.h" #include "common/str.h" diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp index 99ddfb43408a..f664d82c3c42 100644 --- a/engines/avalanche/enhanced2.cpp +++ b/engines/avalanche/enhanced2.cpp @@ -25,8 +25,10 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +#include "avalanche/avalanche.h" + #include "avalanche/enhanced2.h" -#include "common/system.h" + #include "common/textconsole.h" namespace Avalanche { diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index d780f11c4cf7..917ed3c56cb9 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -32,7 +32,7 @@ #ifndef ENHANCED2_H #define ENHANCED2_H -#include "common/system.h" +#include "common/scummsys.h" namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 3ca6daa2af8d..3abb3ba84dee 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -27,9 +27,6 @@ /* ENID Edna's manager. */ -#include "common/scummsys.h" -#include "common/textconsole.h" - #include "avalanche/avalanche.h" #include "avalanche/enid2.h" @@ -39,6 +36,9 @@ #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" + +#include "common/textconsole.h" + //#include "fileunit.h" //#include "basher.h" diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 4351354270a7..8c02ef194a0c 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -32,7 +32,6 @@ #include "common/scummsys.h" -#include "avalanche/gyro2.h" namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index a96249d67bf3..fd86390c04a4 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -27,20 +27,21 @@ /* GYRO It all revolves around this bit! */ +#include "avalanche/avalanche.h" + #include "avalanche/gyro2.h" +#include "avalanche/pingo2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/visa2.h" +#include "avalanche/acci2.h" +#include "avalanche/trip6.h" + #include "common/textconsole.h" -//#include "pingo.h" -//#include "scrolls.h" -//#include "lucerna.h" -//#include "visa.h" -//#include "acci.h" -//#include "trip5.h" //#include "dropdown.h" //#include "basher.h" - - namespace Avalanche { const char *Gyro::vernum = "1.30"; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 23aa40b640ed..42463504a307 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -30,7 +30,6 @@ #ifndef GYRO2_H #define GYRO2_H -#include "common/system.h" #include "common/str.h" #include "common/scummsys.h" diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index 09643f766afc..e4061dadeccc 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -27,12 +27,12 @@ /* LOGGER Handles the logging. */ +#include "avalanche/avalanche.h" + #include "avalanche/logger2.h" #include "avalanche/gyro2.h" -#include "avalanche/avalanche.h" -//#include "avalanche/trip6.h" +#include "avalanche/trip6.h" -#include "common/system.h" #include "common/textconsole.h" namespace Avalanche { diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h index bd54823495c4..05a96d08ca06 100644 --- a/engines/avalanche/logger2.h +++ b/engines/avalanche/logger2.h @@ -33,7 +33,6 @@ #include "common/scummsys.h" #include "common/str.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 22ae5b536e3c..344c273cdb7f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -29,14 +29,11 @@ #include "avalanche/avalanche.h" -#include "common/system.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" #include "avalanche/logger2.h" #include "avalanche/enhanced2.h" - - #include "avalanche/visa2.h" #include "avalanche/timeout2.h" #include "avalanche/trip6.h" @@ -44,8 +41,9 @@ #include "avalanche/celer2.h" #include "avalanche/pingo2.h" #include "avalanche/sequence2.h" -//#include "avalanche/acci2.h" +#include "avalanche/acci2.h" +#include "common/system.h" //#include "dropdown.h" //#include "basher.h" diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index b2f8e83886fa..92c22e65bfb4 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -30,11 +30,10 @@ #include "avalanche/avalanche.h" #include "avalanche/pingo2.h" - #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" -//#include "avalanche/scrolls2.h" +#include "avalanche/scrolls2.h" #include "common/textconsole.h" diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index 135bb10c209e..28f140f7d492 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -33,9 +33,6 @@ #include "common/scummsys.h" #include "common/str.h" - - - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a577483463f4..40084148b5c5 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -31,16 +31,17 @@ #include "avalanche/gyro2.h" #include "avalanche/logger2.h" #include "avalanche/enhanced2.h" - -//#include "lucerna.h" -//#include "trip5.h" -//#include "Acci.h" -//#include "basher.h" -//#include "visa.h" -//#include "timeout.h" +#include "avalanche/lucerna2.h" +#include "avalanche/trip6.h" +#include "avalanche/acci2.h" +#include "avalanche/visa2.h" +#include "avalanche/timeout2.h" #include "common/textconsole.h" +//#include "basher.h" +//#include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... + namespace Avalanche { const int16 Scrolls::roman = 0; diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 914e463f3f45..fa52a559057c 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -30,9 +30,6 @@ #include "common/system.h" -#include "avalanche/gyro2.h" -// #include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 2d9bd255509d..afa74d69b4bc 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -30,12 +30,13 @@ #include "avalanche/avalanche.h" #include "avalanche/sequence2.h" -#include "common/scummsys.h" #include "avalanche/gyro2.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/trip6.h" +#include "common/scummsys.h" + namespace Avalanche { void Sequence::setParent(AvalancheEngine *vm) { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index b4955f6ed6e4..343e896e30be 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -29,12 +29,10 @@ // DON'T FORGET ABOUT THE ARRAY INDEXES, THEY MAY'LL CAUSE TROUBLES!!! -#include "common/textconsole.h" - -#include "avalanche/timeout2.h" #include "avalanche/avalanche.h" +#include "avalanche/timeout2.h" #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" @@ -44,6 +42,8 @@ #include "avalanche/enid2.h" #include "avalanche/pingo2.h" +#include "common/textconsole.h" + namespace Avalanche { Timeout::Timeout() { diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index f7e984e42f15..07a48d6ad0b8 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -32,9 +32,6 @@ #include "common/scummsys.h" -#include "avalanche/gyro2.h" -#include "avalanche/celer2.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 5baa73d32ee4..039c7693a7fd 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -27,12 +27,9 @@ /* TRIP5 Trippancy V */ -#include "avalanche/trip6.h" -#include "common/scummsys.h" -#include "common/textconsole.h" - #include "avalanche/avalanche.h" +#include "avalanche/trip6.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" #include "avalanche/visa2.h" @@ -42,6 +39,9 @@ #include "avalanche/timeout2.h" #include "avalanche/enid2.h" +#include "common/scummsys.h" +#include "common/textconsole.h" + /*#include "Dropdown.h"*/ diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index be805fbe03d6..d7b5637542fa 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -31,13 +31,9 @@ #ifndef TRIP6_H #define TRIP6_H - - #include "common/scummsys.h" #include "common/str.h" -#include "avalanche/gyro2.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index a14367a6a82d..e53f55aef408 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -32,12 +32,12 @@ #include "avalanche/visa2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -//#include "avalanche/acci2.h" +#include "avalanche/acci2.h" #include "avalanche/lucerna2.h" +#include "avalanche/trip6.h" #include "common/textconsole.h" -/*#include "Trip5.h"*/ namespace Avalanche { From 7c147c920fb9e780a78a452cbe123ed0cd94a190 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Jun 2013 14:10:33 +0200 Subject: [PATCH 0065/1332] AVALANCHE: Fix code formatting --- engines/avalanche/celer2.cpp | 335 ++++++++-------- engines/avalanche/enid2.cpp | 34 +- engines/avalanche/gyro2.cpp | 38 +- engines/avalanche/logger2.cpp | 79 ++-- engines/avalanche/scrolls2.cpp | 34 +- engines/avalanche/sequence2.cpp | 6 +- engines/avalanche/timeout2.cpp | 216 +++++----- engines/avalanche/trip6.cpp | 683 +++++++++++++++----------------- 8 files changed, 698 insertions(+), 727 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 2e6ce5a9edbd..d9af28a13ef5 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -51,194 +51,119 @@ void Celer::setParent(AvalancheEngine *vm) { void Celer::pics_link() { byte xx; - if (_vm->_gyro.ddmnow) return; /* No animation when the menus are up. */ - - { - switch (_vm->_gyro.dna.room) { + if (_vm->_gyro.ddmnow) + return; /* No animation when the menus are up. */ + + + switch (_vm->_gyro.dna.room) { + case r__outsideargentpub: + if ((_vm->_gyro.roomtime % int32(12)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); + break; - case r__outsideargentpub: { - if ((_vm->_gyro.roomtime % int32(12)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); - } + case r__brummieroad: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); break; - case r__brummieroad: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); - break; - - case r__bridge: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); - break; - - case r__yours: - if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); - break; + case r__bridge: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + break; - case r__argentpub: { - if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { - /* Malagauche cycle */ - _vm->_gyro.dna.malagauche += 1; - switch (_vm->_gyro.dna.malagauche) { - case 1: - case 11: - case 21: - show_one(12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(11); - break; /* Looks at you. */ - case 30: - show_one(13); - break; /* Winks. */ - case 33: - _vm->_gyro.dna.malagauche = 0; - break; - } - } + case r__yours: + if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); + break; - switch (_vm->_gyro.roomtime % 200) { - case 179: - case 197: - show_one(5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(6); + case r__argentpub: + if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { + /* Malagauche cycle */ + _vm->_gyro.dna.malagauche += 1; + switch (_vm->_gyro.dna.malagauche) { + case 1: + case 11: + case 21: + show_one(12); + break; /* Looks forwards. */ + case 8: + case 18: + case 28: + case 32: + show_one(11); + break; /* Looks at you. */ + case 30: + show_one(13); + break; /* Winks. */ + case 33: + _vm->_gyro.dna.malagauche = 0; break; - case 185: - show_one(7); - break; - case 199: - _vm->_gyro.dna.dogfoodpos = 177; - break; /* Impossible value for this. */ - } - - if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ - if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 3; - else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) - xx = 2; - else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) - xx = 4; - - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; - } } - } - break; - case r__westhall: - if ((_vm->_gyro.roomtime % int32(3)) == 0) - switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { - case 4: - show_one(1); - break; - case 1: - case 3: - case 5: - show_one(2); - break; - case 0: - case 2: - show_one(3); - break; - } + switch (_vm->_gyro.roomtime % 200) { + case 179: + case 197: + show_one(5); + break; /* Dogfood's drinking cycle */ + case 182: + case 194: + show_one(6); break; - - case r__lustiesroom: - if (!(_vm->_gyro.dna.lustie_is_asleep)) { - if ((_vm->_gyro.roomtime % int32(45)) > 42) - xx = 4; /* du Lustie blinks */ - - /* Bearing of Avvy from du Lustie. */ - else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 1; /* Middle. */ - else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) - xx = 2; /* Left. */ - else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) - xx = 3; /* Right. */ - - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - } + case 185: + show_one(7); break; + case 199: + _vm->_gyro.dna.dogfoodpos = 177; + break; /* Impossible value for this. */ + } - case r__aylesoffice: - if ((! _vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { - switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { - case 0: - show_one(1); - break; /* Frame 2: EGA. */ - case 1: - show_one(3); - break; /* Frame 1: Natural. */ - } - } - break; - - case r__robins: - if (_vm->_gyro.dna.tied_up) - switch (_vm->_gyro.roomtime % int32(54)) { - case 20: - show_one(4); - break; /* Frame 4: Avalot blinks. */ - case 23: - show_one(2); - break; /* Frame 1: Back to normal. */ - } - break; - - case r__nottspub: { - /* Bearing of Avvy from Port. */ - if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) - xx = 2; /* Middle. */ - else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro.roomtime % int32(60)) > 57) xx--; /* Blinks */ + if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ + if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 3; + else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) + xx = 2; + else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) + xx = 4; if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro.dna.dogfoodpos = xx; } + } + break; - switch (_vm->_gyro.roomtime % 50) { - case 45 : - show_one(9); - break; /* Spurge blinks */ - case 49 : - show_one(10); + case r__westhall: + if ((_vm->_gyro.roomtime % int32(3)) == 0) { + switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { + case 4: + show_one(1); + break; + case 1: + case 3: + case 5: + show_one(2); + break; + case 0: + case 2: + show_one(3); break; } } break; - case r__ducks: { - if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ - show_one(1 + (_vm->_gyro.roomtime / 3) % 3); + case r__lustiesroom: + if (!(_vm->_gyro.dna.lustie_is_asleep)) { + if ((_vm->_gyro.roomtime % int32(45)) > 42) + xx = 4; /* du Lustie blinks */ - {/* _vm->_lucerna.bearing of Avvy from Duck. */ - if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 4; /* Middle. */ + /* Bearing of Avvy from du Lustie. */ + else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 1; /* Middle. */ else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) - xx = 6; /* Left. */ + xx = 2; /* Left. */ else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro.roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ + xx = 3; /* Right. */ if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); @@ -247,18 +172,92 @@ void Celer::pics_link() { } break; + case r__aylesoffice: + if ((!_vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { + switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { + case 0: + show_one(1); + break; /* Frame 2: EGA. */ + case 1: + show_one(3); + break; /* Frame 1: Natural. */ + } + } + break; + + case r__robins: + if (_vm->_gyro.dna.tied_up) { + switch (_vm->_gyro.roomtime % int32(54)) { + case 20: + show_one(4); + break; /* Frame 4: Avalot blinks. */ + case 23: + show_one(2); + break; /* Frame 1: Back to normal. */ + } + } + break; + + case r__nottspub: + /* Bearing of Avvy from Port. */ + if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) + xx = 2; /* Middle. */ + else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) + xx = 8; /* Right. */ + + if ((_vm->_gyro.roomtime % int32(60)) > 57) + xx--; /* Blinks */ + + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + + switch (_vm->_gyro.roomtime % 50) { + case 45 : + show_one(9); + break; /* Spurge blinks */ + case 49 : + show_one(10); + break; + } + break; + + case r__ducks: + if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ + show_one(1 + (_vm->_gyro.roomtime / 3) % 3); + + {/* _vm->_lucerna.bearing of Avvy from Duck. */ + if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 4; /* Middle. */ + else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + xx = 8; /* Right. */ + + if ((_vm->_gyro.roomtime % int32(45)) > 42) + xx += 1; /* Duck blinks */ + + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } + break; + } +} - if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) + if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) { /* They're ringing the bells. */ switch (_vm->_gyro.roomtime % int32(4)) { - case 1: { - if (_vm->_gyro.dna.nextbell < 5) _vm->_gyro.dna.nextbell = 12; + case 1: + if (_vm->_gyro.dna.nextbell < 5) + _vm->_gyro.dna.nextbell = 12; _vm->_gyro.dna.nextbell -= 1; _vm->_gyro.note(_vm->_gyro.notes[_vm->_gyro.dna.nextbell]); - } - break; + break; case 2: //nosound; warning("STUB: Celer::pics_link()"); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 3ca6daa2af8d..628c05db0f57 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -96,7 +96,7 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { day = _vm->_gyro.strf(d); - if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) + if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) { switch (d % 10) { case 1: day = day + "st"; @@ -110,15 +110,12 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { default: day = day + "th"; } + } expanddate_result = day + ' ' + month + ' ' + _vm->_gyro.strf(y); return expanddate_result; } - - - - void Enid::show_bug(char icon, Common::String strn) { _vm->_scrolls.display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); } @@ -159,17 +156,10 @@ void Enid::loaderror(Common::String x, char icon) { bug = true; } - - - void Enid::edna_load(Common::String name) { warning("STUB: Enid::edna_load()"); } - - - - void Enid::showheader() { _vm->_scrolls.display(Common::String("Dir: ") + path + "\r\r\4"); } @@ -260,21 +250,17 @@ void Enid::avvy_background() { /* Not really a filing procedure, } void Enid::to_sundry(sundry &sund) { - { - sund.qenid_filename = _vm->_gyro.enid_filename; - sund.qsoundfx = _vm->_gyro.soundfx; - sund.qthinks = _vm->_gyro.thinks; - sund.qthinkthing = _vm->_gyro.thinkthing; - } + sund.qenid_filename = _vm->_gyro.enid_filename; + sund.qsoundfx = _vm->_gyro.soundfx; + sund.qthinks = _vm->_gyro.thinks; + sund.qthinkthing = _vm->_gyro.thinkthing; } void Enid::from_sundry(sundry sund) { - { - _vm->_gyro.enid_filename = sund.qenid_filename; - _vm->_gyro.soundfx = sund.qsoundfx; - _vm->_gyro.thinks = sund.qthinks; - _vm->_gyro.thinkthing = sund.qthinkthing; - } + _vm->_gyro.enid_filename = sund.qenid_filename; + _vm->_gyro.soundfx = sund.qsoundfx; + _vm->_gyro.thinks = sund.qthinks; + _vm->_gyro.thinkthing = sund.qthinkthing; } void Enid::restore_dna() { diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index a96249d67bf3..a0676f47abfb 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -330,14 +330,17 @@ void Gyro::slowdown() { } bool Gyro::flagset(char x) { - for (uint16 i = 0; i < flags.size(); i++) + for (uint16 i = 0; i < flags.size(); i++) { if (flags[i] == x) return true; + } + return false; } void Gyro::force_numlock() { - if ((locks & num) > 0) locks -= num; + if ((locks & num) > 0) + locks -= num; } bool Gyro::pennycheck(uint16 howmuchby) { @@ -384,7 +387,8 @@ Common::String Gyro::get_thing(byte which) { case onion: if (dna.rotten_onion) get_thing_result = "rotten onion"; - else get_thing_result = things[which]; + else + get_thing_result = things[which]; break; default: get_thing_result = things[which]; @@ -411,7 +415,9 @@ char Gyro::get_thingchar(byte which) { // Keep an eye open! ^^^^ Common::String Gyro::get_better(byte which) { Common::String get_better_result; - if (which > 150) which -= 149; + if (which > 150) + which -= 149; + switch (which) { case wine: switch (dna.winestate) { @@ -430,7 +436,8 @@ Common::String Gyro::get_better(byte which) { get_better_result = "a rotten onion"; else if (dna.onion_in_vinegar) get_better_result = "a pickled onion (in the vinegar)"; - else get_better_result = better[which]; + else + get_better_result = better[which]; break; default: if ((which < numobjs) && (which > '\0')) @@ -485,7 +492,8 @@ void Gyro::background(byte x) { void Gyro::hang_around_for_a_while() { byte fv; - for (fv = 1; fv <= 28; fv ++) slowdown(); + for (fv = 1; fv <= 28; fv ++) + slowdown(); } /* Super_Off and Super_On are two very useful procedures. Super_Off switches @@ -494,19 +502,25 @@ void Gyro::hang_around_for_a_while() { void Gyro::super_off() { super_was_off = visible == m_no; - if (super_was_off) return; + if (super_was_off) + return; super_was_virtual = visible == m_virtual; - if (visible == m_virtual) off_virtual(); - else off(); + if (visible == m_virtual) + off_virtual(); + else + off(); } void Gyro::super_on() { - if ((visible != m_no) || (super_was_off)) return; + if ((visible != m_no) || (super_was_off)) + return; - if (super_was_virtual) on_virtual(); - else on(); + if (super_was_virtual) + on_virtual(); + else + on(); } bool Gyro::mouse_near_text() { diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index 09643f766afc..b9452e3e4ad4 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -82,10 +82,12 @@ void Logger::setParent(AvalancheEngine *vm) { void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); fv ++) + /*for (fv = 1; fv <= size - (x / 2); + fv ++) output << logfile << ' ';*/ } @@ -108,7 +110,8 @@ void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ void Logger::log_divider() { /* Prints the divider sign. */ byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_divider()"); @@ -122,7 +125,8 @@ void Logger::log_divider() { /* Prints the divider sign. */ } void Logger::log_command(Common::String x) { /* Prints a command */ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_command()"); @@ -133,13 +137,17 @@ void Logger::log_command(Common::String x) { /* Prints a command */ } void Logger::log_addstuff(Common::String x) { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; + scroll_line += x; } void Logger::log_scrollchar(Common::String x) { /* print one character */ Common::String z; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; + switch (x[1]) { case '`': z = quote; @@ -158,33 +166,37 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */ } void Logger::log_italic() { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_italic()"); /*if (_vm->_gyro.log_epson) - log_addstuff(italic); + log_addstuff(italic); else - log_addstuff("*");*/ + log_addstuff("*");*/ } void Logger::log_roman() { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_roman()"); - /* if (_vm->_gyro.log_epson) - log_addstuff(italic_off); + /* if (_vm->_gyro.log_epson) + log_addstuff(italic_off); else - log_addstuff("*");*/ + log_addstuff("*");*/ } void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_epsonroman()"); - //if (_vm->_gyro.log_epson) log_addstuff(italic_off); + //if (_vm->_gyro.log_epson) + // log_addstuff(italic_off); } void Logger::log_scrollline() { /* Set up a line for the scroll driver */ @@ -200,7 +212,8 @@ void Logger::log_scrollendline(bool centred) { warning("STUB: Logger::log_scrollendline()"); - /*for (fv = 1; fv <= x; fv ++) output << logfile << ' '; + /*for (fv = 1; fv <= x; fv ++) + output << logfile << ' '; output << logfile << scroll_line << NL;*/ } @@ -211,18 +224,21 @@ void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { warning("STUB: Logger::log_bubbleline()"); /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; + for (fv = 1; fv <= 15; fv ++) + output << logfile << ' '; + output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; } else { - for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; - output << logfile << x << NL; + for (fv = 1; fv <= 17; fv ++) + output << logfile << ' '; + output << logfile << x << NL; }*/ } void Logger::log_newline() { warning("STUB: Logger::log_newline()"); - //if (_vm->_gyro.logging) output << logfile << NL; + //if (_vm->_gyro.logging) + // output << logfile << NL; } void Logger::log_newroom(Common::String where) { @@ -231,17 +247,20 @@ void Logger::log_newroom(Common::String where) { warning("STUB: Logger::log_newroom()"); - /*for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; - if (_vm->_gyro.log_epson) output << logfile << emph_on; + /*for (fv = 1; fv <= 20; fv ++) + output << logfile << ' '; + if (_vm->_gyro.log_epson) + output << logfile << emph_on; output << logfile << Common::String('(') + where + ')'; - if (_vm->_gyro.log_epson) output << logfile << emph_off; + if (_vm->_gyro.log_epson) + output << logfile << emph_off; output << logfile << NL;*/ } -void Logger::log_aside(Common::String what) +void Logger::log_aside(Common::String what) { /* This writes "asides" to the printer. For example, moves in Nim. */ -{ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_aside()"); @@ -251,11 +270,13 @@ void Logger::log_aside(Common::String what) void Logger::log_score(uint16 credit, uint16 now) { byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_score()"); - /*for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; + /*for (fv = 1; fv <= 50; fv ++) + output << logfile << ' '; output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a577483463f4..a46f5842dcd7 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -61,7 +61,8 @@ void Scrolls::setParent(AvalancheEngine *vm) { void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ byte page_; - if (_vm->_gyro.ledstatus == x) return; /* Already like that! */ + if (_vm->_gyro.ledstatus == x) + return; /* Already like that! */ warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); //switch (x) { @@ -82,8 +83,8 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ _vm->_gyro.super_off(); /* for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - bar(419, 195, 438, 197); + setactivepage(page_); + bar(419, 195, 438, 197); }*/ _vm->_gyro.super_on(); @@ -96,10 +97,11 @@ void Scrolls::easteregg() { warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); /* background(15); - for (fv = 4; fv <= 100; fv ++) - for (ff = 0; ff <= 70; ff ++) { - sound(fv * 100 + ff * 10); - delay(1); + for (fv = 4; fv <= 100; fv ++) { + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } } nosound; setcolor(10); @@ -204,9 +206,8 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != Gyro::tune[fv]) { + if (played[fv] != Gyro::tune[fv]) mistakes++; - } they_match_result = mistakes < 5; return they_match_result; @@ -226,17 +227,16 @@ void Scrolls::music_scroll() { _vm->_gyro.on(); _vm->_gyro.newpointer(4); //do { - //do { - // Gyro::check(); /* was "checkclick;" */ - // if (Enhanced::keypressede()) break; - //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); + // do { + // Gyro::check(); /* was "checkclick;" */ + // if (Enhanced::keypressede()) + // break; + // } while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); // // Needs joystick - not sure it will be implemented. - //if (Gyro::mpress == 0) { - // inkey(); Needs Lucerna to proceed. - // - //} + // if (Gyro::mpress == 0) + // inkey(); Needs Lucerna to proceed. //} } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 2d9bd255509d..1eb97a85a8af 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -91,11 +91,11 @@ void Sequence::call_sequencer() { case 0: return; break; /* No more routines. */ - case 177: { + case 177: _vm->_gyro.dna.user_moves_avvy = true; _vm->_trip.fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ - if (seq[0] == 177) shove_left(); - } + if (seq[0] == 177) + shove_left(); break; } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index fe5e5d966c4a..864276fdd7b5 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -60,27 +60,28 @@ void Timeout::setParent(AvalancheEngine *vm) { void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { fv = 1; - while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; - if (fv == 8) return; /* Oh dear... */ + while ((fv < 8) && (times[fv].time_left != 0)) + fv += 1; - { - timetype &with = times[fv]; /* Everything's OK here! */ + if (fv == 8) + return; /* Oh dear... */ - with.time_left = howlong; - with.then_where = whither; - with.what_for = why; - } + timetype &with = times[fv]; /* Everything's OK here! */ + with.time_left = howlong; + with.then_where = whither; + with.what_for = why; } void Timeout::one_tick() { - if (_vm->_gyro.ddmnow) return; + if (_vm->_gyro.ddmnow) + return; for (fv = 1; fv <= 7; fv ++) { timetype &with = times[fv]; if (with.time_left > 0) { with.time_left -= 1; - if (with.time_left == 0) + if (with.time_left == 0) { switch (with.then_where) { case procopen_drawbridge : open_drawbridge(); @@ -206,6 +207,7 @@ void Timeout::one_tick() { give_lute_to_geida(); break; } + } } } _vm->_gyro.roomtime += 1; /* Cycles since you've been in this room. */ @@ -238,28 +240,25 @@ end;*/ /* Timeout procedures: */ void Timeout::open_drawbridge() { - { - _vm->_gyro.dna.drawbridge_open ++; - _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); + _vm->_gyro.dna.drawbridge_open ++; + _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); - if (_vm->_gyro.dna.drawbridge_open == 4) - _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ - else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); - } + if (_vm->_gyro.dna.drawbridge_open == 4) + _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + else + set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } /* --- */ void Timeout::avaricius_talks() { - { - _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); - _vm->_gyro.dna.avaricius_talk ++; - - if (_vm->_gyro.dna.avaricius_talk < 17) - set_up_timer(177, procavaricius_talks, reason_avariciustalks); - else _vm->_lucerna.points(3); + _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); + _vm->_gyro.dna.avaricius_talk ++; - } + if (_vm->_gyro.dna.avaricius_talk < 17) + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + else + _vm->_lucerna.points(3); } void Timeout::urinate() { @@ -293,16 +292,14 @@ void Timeout::stairs() { } void Timeout::cardiff_survey() { - { - switch (_vm->_gyro.dna.cardiff_things) { - case 0: { - _vm->_gyro.dna.cardiff_things += 1; - _vm->_visa.dixi('q', 27); - } + switch (_vm->_gyro.dna.cardiff_things) { + case 0: + _vm->_gyro.dna.cardiff_things += 1; + _vm->_visa.dixi('q', 27); break; - } - _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); } + _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); + _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } @@ -370,23 +367,20 @@ void Timeout::jacques_wakes_up() { _vm->_gyro.dna.jacques_awake += 1; switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */ - case 1 : { + case 1 : _vm->_celer.show_one(1); /* Eyes open. */ _vm->_visa.dixi('Q', 45); - } - break; - case 2 : { /* Going through the door. */ + break; + case 2 : /* Going through the door. */ _vm->_celer.show_one(2); /* Not on the floor. */ _vm->_celer.show_one(3); /* But going through the door. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* You can't wake him up now. */ - } - break; - case 3 : { /* Gone through the door. */ + break; + case 3 : /* Gone through the door. */ _vm->_celer.show_one(2); /* Not on the floor, either. */ _vm->_celer.show_one(4); /* He's gone... so the door's open. */ _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; /* Gone! */ - } - break; + break; } @@ -409,9 +403,8 @@ void Timeout::jacques_wakes_up() { } -void Timeout::naughty_duke() +void Timeout::naughty_duke() { /* This is when the Duke comes in and takes your money. */ -{ _vm->_trip.tr[2].init(9, false, &_vm->_trip); /* Here comes the Duke. */ _vm->_trip.apped(2, 1); /* He starts at the door... */ _vm->_trip.tr[2].walkto(3); /* He walks over to you. */ @@ -438,57 +431,53 @@ void Timeout::naughty_duke3() { } void Timeout::jump() { - { - dnatype &with = _vm->_gyro.dna; - - with.jumpstatus += 1; - - { - triptype &with1 = _vm->_trip.tr[1]; - switch (with.jumpstatus) { - case 1: - case 2: - case 3: - case 5: - case 7: - case 9: - with1.y -= 1; - break; - case 12: - case 13: - case 14: - case 16: - case 18: - case 19: - with1.y += 1; - break; - } - } + dnatype &with = _vm->_gyro.dna; - if (with.jumpstatus == 20) { - /* End of jump. */ - _vm->_gyro.dna.user_moves_avvy = true; - _vm->_gyro.dna.jumpstatus = 0; - } else { - /* Still jumping. */ - set_up_timer(1, procjump, reason_jumping); - } + with.jumpstatus += 1; - if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ - && (_vm->_gyro.dna.room == r__insidecardiffcastle) - && (_vm->_gyro.dna.arrow_in_the_door == true) - && (_vm->_trip.infield(3))) { /* beside the wall*/ - /* Grab the arrow! */ - if (_vm->_gyro.dna.carrying >= maxobjs) - _vm->_scrolls.display("You fail to grab it, because your hands are full."); - else { - _vm->_celer.show_one(2); - _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ - _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; - _vm->_lucerna.objectlist(); - _vm->_visa.dixi('q', 50); - _vm->_lucerna.points(3); - } + triptype &with1 = _vm->_trip.tr[1]; + switch (with.jumpstatus) { + case 1: + case 2: + case 3: + case 5: + case 7: + case 9: + with1.y -= 1; + break; + case 12: + case 13: + case 14: + case 16: + case 18: + case 19: + with1.y += 1; + break; + } + + if (with.jumpstatus == 20) { + /* End of jump. */ + _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro.dna.jumpstatus = 0; + } else { + /* Still jumping. */ + set_up_timer(1, procjump, reason_jumping); + } + + if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + && (_vm->_gyro.dna.room == r__insidecardiffcastle) + && (_vm->_gyro.dna.arrow_in_the_door == true) + && (_vm->_trip.infield(3))) { /* beside the wall*/ + /* Grab the arrow! */ + if (_vm->_gyro.dna.carrying >= maxobjs) + _vm->_scrolls.display("You fail to grab it, because your hands are full."); + else { + _vm->_celer.show_one(2); + _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ + _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; + _vm->_lucerna.objectlist(); + _vm->_visa.dixi('q', 50); + _vm->_lucerna.points(3); } } } @@ -549,29 +538,27 @@ void Timeout::meet_avaroid() { _vm->_visa.dixi('Q', 60); _vm->_gyro.dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - { - triptype &with = _vm->_trip.tr[1]; - with.face = _vm->_trip.left; - with.x = 151; - with.ix = -3; - with.iy = -5; - } + + triptype &with = _vm->_trip.tr[1]; + with.face = _vm->_trip.left; + with.x = 151; + with.ix = -3; + with.iy = -5; + _vm->_gyro.background(2); } } void Timeout::rise_up_oubliette() { - { - triptype &with = _vm->_trip.tr[1]; + triptype &with = _vm->_trip.tr[1]; - with.visible = true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy > 0) - set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); - else - _vm->_gyro.dna.user_moves_avvy = true; - } + with.visible = true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy > 0) + set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); + else + _vm->_gyro.dna.user_moves_avvy = true; } void Timeout::robin_hood_and_geida() { @@ -602,10 +589,9 @@ void Timeout::avalot_returns() { _vm->_gyro.dna.user_moves_avvy = true; } -void Timeout::avvy_sit_down() +void Timeout::avvy_sit_down() { /* This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. */ -{ if (_vm->_trip.tr[1].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { @@ -621,7 +607,9 @@ void Timeout::ghost_room_phew() { } void Timeout::arkata_shouts() { - if (_vm->_gyro.dna.teetotal) return; + if (_vm->_gyro.dna.teetotal) + return; + _vm->_visa.dixi('q', 76); set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } @@ -629,9 +617,11 @@ void Timeout::arkata_shouts() { void Timeout::winning() { _vm->_visa.dixi('q', 79); _vm->_pingo.winning_pic(); + do { _vm->_lucerna.checkclick(); } while (!(_vm->_gyro.mrelease == 0)); + _vm->_lucerna.callverb(Acci::vb_score); _vm->_scrolls.display(" T H E E N D "); _vm->_gyro.lmo = true; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f0d2abc3d417..ac37efe30df3 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -64,8 +64,10 @@ void triptype::andexor() { } void triptype::turn(byte whichway) { - if (whichway == 8) face = 0; - else face = whichway; + if (whichway == 8) + face = 0; + else + face = whichway; } void triptype::appear(int16 wx, int16 wy, byte wf) { @@ -82,17 +84,20 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { bool triptype::collision_check() { byte fv; - bool collision_check_result; - for (fv = 1; fv <= _tr->numtr; fv ++) + bool collision_check_result = false; + for (fv = 1; fv <= _tr->numtr; fv ++) { if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + a.xl) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && (_tr->tr[fv].y == y)) { - collision_check_result = true; - return collision_check_result; + collision_check_result = true; + break; } + // CHECKME: Only checks the first element of the for() statement collision_check_result = false; return collision_check_result; + } + return collision_check_result; } void triptype::walk() { @@ -102,8 +107,10 @@ void triptype::walk() { void triptype::bounce() { x = ox[_tr->_vm->_gyro.cp]; y = oy[_tr->_vm->_gyro.cp]; - if (check_me) _tr->stopwalking(); - else stopwalk(); + if (check_me) + _tr->stopwalking(); + else + stopwalk(); _tr->_vm->_gyro.oncandopageswap = false; _tr->_vm->_lucerna.showrw(); _tr->_vm->_gyro.oncandopageswap = true; @@ -111,8 +118,10 @@ void triptype::bounce() { int8 triptype::sgn(int16 x) { int8 sgn_result; - if (x > 0) sgn_result = 1; - else if (x < 0) sgn_result = -1; + if (x > 0) + sgn_result = 1; + else if (x < 0) + sgn_result = -1; else sgn_result = 0; /* x=0 */ return sgn_result; @@ -141,29 +150,40 @@ void triptype::homestep() { iy = 0; if (hy != y) { temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; + if (temp > 4) + iy = 4; + else if (temp < -4) + iy = -4; + else + iy = temp; } if (hx != x) { temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; + if (temp > 4) + ix = 4; + else if (temp < -4) + ix = -4; + else + ix = temp; } } void triptype::speed(int8 xx, int8 yy) { ix = xx; iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ + if ((ix == 0) && (iy == 0)) + return; /* no movement */ if (ix == 0) { /* No horz movement */ - if (iy < 0) turn(_tr->up); - else turn(_tr->down); + if (iy < 0) + turn(_tr->up); + else + turn(_tr->down); } else { - if (ix < 0) turn(_tr->left); - else turn(_tr->right); + if (ix < 0) + turn(_tr->left); + else + turn(_tr->right); } } @@ -250,17 +270,16 @@ triptype *triptype::done() { int32 id; uint16 soa; - { - adxtype &with = a; + adxtype &with = a; - /* nds:=num div seq;*/ - xw = with.xl / 8; - if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { - totalnum --; - free(mani[totalnum]); - free(sil[totalnum]); /* <<- Width of a siltype. */ - } + /* nds:=num div seq;*/ + xw = with.xl / 8; + if ((with.xl % 8) > 0) + xw += 1; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { + totalnum --; + free(mani[totalnum]); + free(sil[totalnum]); /* <<- Width of a siltype. */ } quick = false; @@ -268,11 +287,6 @@ triptype *triptype::done() { return this; } - - - - - getsettype *getsettype::init() { numleft = 0; /* initialise array pointer */ return this; @@ -289,11 +303,6 @@ void getsettype::recall(bytefield &r) { numleft --; } - - - - - Trip::Trip() { getsetclear(); mustexclaim = false; @@ -303,11 +312,12 @@ void Trip::setParent(AvalancheEngine *vm) { _vm = vm; } - void Trip::loadtrip() { byte gm; - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + for (gm = 1; gm <= numtr; gm++) + tr[gm].original(); + // CHECKME: A 'i++' is missing somewhere, obviously! for (int i = 0; i < sizeof(aa); aa[i] = 0); } @@ -367,24 +377,18 @@ void Trip::catamove(byte ped) _vm->_gyro.dna.geida_spin = 0; switch (xy_uint16) { - case 1801: { /* Exit catacombs */ + case 1801: /* Exit catacombs */ fliproom(r__lustiesroom, 4); _vm->_scrolls.display("Phew! Nice to be out of there!"); return; - } - break; - case 1033: { /* Oubliette */ + case 1033: /* Oubliette */ fliproom(r__oubliette, 1); _vm->_scrolls.display("Oh, NO!\231\2"); return; - } - break; - case 4: { + case 4: fliproom(r__geidas, 1); return; - } - break; - case 2307: { + case 2307: fliproom(r__lusties, 5); _vm->_scrolls.display("Oh no... here we go again..."); _vm->_gyro.dna.user_moves_avvy = false; @@ -392,156 +396,138 @@ void Trip::catamove(byte ped) tr[1].ix = 0; return; } - break; - } - if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) _vm->_lucerna.load(29); + if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) + _vm->_lucerna.load(29); here = _vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x]; switch (here & 0xf) { /* West. */ - case 0: { /* no connection (wall) */ + case 0: /* no connection (wall) */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); - } - break; - case 0x1: { /* no connection (wall + shield), */ + break; + case 0x1: /* no connection (wall + shield), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(29); /* ...shield. */ - } - break; - case 0x2: { /* wall with door */ + break; + case 0x2: /* wall with door */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door. */ - } - break; - case 0x3: { /* wall with door and shield */ + break; + case 0x3: /* wall with door and shield */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(29); /* ...shield. */ - } - break; - case 0x4: { /* no connection (wall + window), */ + break; + case 0x4: /* no connection (wall + window), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(5); /* ...window. */ - } - break; - case 0x5: { /* wall with door and window */ + break; + case 0x5: /* wall with door and window */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(5); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ + break; + case 0x6: /* no connection (wall + torches), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* No door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(7); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ + break; + case 0x7: /* wall with door and torches */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(7); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ + break; + case 0xf: /* straight-through corridor. */ _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.special; /* Straight wall. */ - } - break; + break; } /* ---- */ switch ((here & 0xf0) >> 4) { /* East */ - case 0: { /* no connection (wall) */ + case 0: /* no connection (wall) */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(19); - } - break; - case 0x1: { /* no connection (wall + window), */ + break; + case 0x1: /* no connection (wall + window), */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...window. */ - } - break; - case 0x2: { /* wall with door */ + break; + case 0x2: /* wall with door */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door. */ - } - break; - case 0x3: { /* wall with door and window */ + break; + case 0x3: /* wall with door and window */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...door, and... */ _vm->_celer.show_one(21); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ + break; + case 0x6: /* no connection (wall + torches), */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* No door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(18); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ + break; + case 0x7: /* wall with door and torches */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door, and... */ _vm->_celer.show_one(18); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ + break; + case 0xf: /* straight-through corridor. */ _vm->_gyro.magics[5].op = _vm->_gyro.nix; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.special; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ - } - break; + break; } /* ---- */ switch ((here & 0xf00) >> 8) { /* South */ - case 0: { /* No connection. */ + case 0: /* No connection. */ _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[12].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; - case 0x1: { + break; + case 0x1: _vm->_celer.show_one(22); if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows)) @@ -550,97 +536,95 @@ void Trip::catamove(byte ped) _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[12].op = _vm->_gyro.bounces; - } - break; - case 0x2: { + break; + case 0x2: _vm->_celer.show_one(23); _vm->_gyro.magics[7].op = _vm->_gyro.special; /* Middle exit south. */ _vm->_gyro.magics[12].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; - case 0x3: { + break; + case 0x3: _vm->_celer.show_one(24); _vm->_gyro.magics[12].op = _vm->_gyro.special; /* Left exit south. */ _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; + break; } switch ((here & 0xf000) >> 12) { /* North */ - case 0: { /* No connection */ + case 0: /* No connection */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ - } - break; - /* LEFT handles: */ - /* $1: begin - _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - case 0x2: { + break; + // LEFT handles: +/* + case 0x1: _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ - _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; - /* $3: begin - _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end; - { RIGHT handles: } - $4: begin - _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - case 0x5: { + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + case 0x2: + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // Middle exit north. + _vm->_gyro.portals[12].op = _vm->_gyro.special; // Door. + break; +/* case 0x3: + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; + // RIGHT handles: + case 0x4: + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + case 0x5: _vm->_celer.show_one(3); _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; - /* $6: begin - _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - /* ARCHWAYS: */ + break; +/* + case 0x6: + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + // ARCHWAYS: case 0x7: case 0x8: case 0x9: { _vm->_celer.show_one(6); - if (((here & 0xf000) >> 12) > 0x7) _vm->_celer.show_one(31); - if (((here & 0xf000) >> 12) == 0x9) _vm->_celer.show_one(32); + if (((here & 0xf000) >> 12) > 0x7) + _vm->_celer.show_one(31); + if (((here & 0xf000) >> 12) == 0x9) + _vm->_celer.show_one(32); _vm->_gyro.magics[1].op = _vm->_gyro.special; /* Middle arch north. */ _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ } break; /* DECORATIONS: */ - case 0xd: { /* No connection + WINDOW */ + case 0xd: /* No connection + WINDOW */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(14); - } - break; - case 0xe: { /* No connection + TORCH */ + break; + case 0xe: /* No connection + TORCH */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(8); - } - break; + break; /* Recessed door: */ - case 0xf: { + case 0xf: _vm->_gyro.magics[1].op = _vm->_gyro.nix; /* Door to Geida's room. */ _vm->_celer.show_one(1); _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; + break; } switch (xy_uint16) { @@ -660,7 +644,8 @@ void Trip::catamove(byte ped) } break; case 1287: - for (fv = 10; fv <= 13; fv ++) _vm->_celer.show_one(fv); + for (fv = 10; fv <= 13; fv ++) + _vm->_celer.show_one(fv); break; /* [7,5] : 4 candles. */ case 776: _vm->_celer.show_one(10); @@ -668,11 +653,10 @@ void Trip::catamove(byte ped) case 2049: _vm->_celer.show_one(11); break; /* [1,8] : another candle. */ - case 257: { + case 257: _vm->_celer.show_one(12); _vm->_celer.show_one(13); - } - break; /* [1,1] : the other two. */ + break; /* [1,1] : the other two. */ } if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) { @@ -695,16 +679,15 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { - case 1: { /* _vm->_gyro.special 1: Room 22: top of stairs. */ + case 1: /* _vm->_gyro.special 1: Room 22: top of stairs. */ _vm->_celer.show_one(1); _vm->_gyro.dna.brummie_stairs = 1; _vm->_gyro.magics[10].op = _vm->_gyro.nix; _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); stopwalking(); _vm->_gyro.dna.user_moves_avvy = false; - } - break; - case 2: { /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ + break; + case 2: /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ _vm->_gyro.dna.brummie_stairs = 3; _vm->_gyro.magics[11].op = _vm->_gyro.nix; _vm->_gyro.magics[12].op = _vm->_gyro.exclaim; @@ -713,9 +696,8 @@ void Trip::call_special(uint16 which) { stopwalking(); _vm->_visa.dixi('q', 26); _vm->_gyro.dna.user_moves_avvy = true; - } - break; - case 3: { /* _vm->_gyro.special 3: Room 71: triggers dart. */ + break; + case 3: /* _vm->_gyro.special 3: Room 71: triggers dart. */ tr[1].bounce(); /* Must include that. */ if (! _vm->_gyro.dna.arrow_triggered) { @@ -730,17 +712,13 @@ void Trip::call_special(uint16 which) { tr[2].call_eachstep = true; tr[2].eachstep = procarrow_procs; } - } - break; - - case 4: { /* This is the ghost room link. */ + break; + case 4: /* This is the ghost room link. */ _vm->_lucerna.dusk(); tr[1].turn(right); /* you'll see this after we get back from bootstrap */ _vm->_timeout.set_up_timer(1, _vm->_timeout.procghost_room_phew, _vm->_timeout.reason_ghost_room_phew); _vm->_enid.back_to_bootstrap(3); - } - break; - + break; case 5: if (_vm->_gyro.dna.friar_will_tie_you_up) { /* _vm->_gyro.special 5: Room 42: touched tree, and get tied up. */ @@ -759,17 +737,14 @@ void Trip::call_special(uint16 which) { _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); } break; - - case 6: { /* _vm->_gyro.special 6: fall down oubliette. */ + case 6: /* _vm->_gyro.special 6: fall down oubliette. */ _vm->_gyro.dna.user_moves_avvy = false; tr[1].ix = 3; tr[1].iy = 0; tr[1].face = right; _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); - } - break; - - case 7: { /* _vm->_gyro.special 7: stop falling down oubliette. */ + break; + case 7: /* _vm->_gyro.special 7: stop falling down oubliette. */ tr[1].visible = false; _vm->_gyro.magics[10].op = _vm->_gyro.nix; stopwalking(); @@ -778,9 +753,7 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); - } - break; - + break; case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */ if ((_vm->_gyro.dna.geida_follows) && (! _vm->_gyro.dna.lustie_is_asleep)) { _vm->_visa.dixi('q', 63); @@ -790,21 +763,20 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.gameover(); } break; - - case 9: { /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ - if (! _vm->_gyro.dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + case 9: /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ + if (! _vm->_gyro.dna.geida_follows) + return; /* DOESN'T COUNT: no Geida. */ tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ tr[2].walkto(4); /* She walks to somewhere... */ tr[1].done(); /* Lose Avvy. */ _vm->_gyro.dna.user_moves_avvy = false; _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); - } - break; - - case 10: { /* _vm->_gyro.special 10: transfer north in catacombs. */ + break; + case 10: /* _vm->_gyro.special 10: transfer north in catacombs. */ if ((_vm->_gyro.dna.cat_x == 4) && (_vm->_gyro.dna.cat_y == 1)) { /* Into Geida's room. */ - if (_vm->_gyro.dna.obj[_vm->_gyro.key]) _vm->_visa.dixi('q', 62); + if (_vm->_gyro.dna.obj[_vm->_gyro.key]) + _vm->_visa.dixi('q', 62); else { _vm->_visa.dixi('q', 61); return; @@ -813,7 +785,8 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_y -= 1; catamove(4); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); switch ((_vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x] & 0xf00) >> 8) { case 0x1: @@ -827,78 +800,72 @@ void Trip::call_special(uint16 which) { } getback(); dawndelay(); - } - break; - case 11: { /* _vm->_gyro.special 11: transfer east in catacombs. */ + break; + case 11: /* _vm->_gyro.special 11: transfer east in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_x += 1; catamove(1); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 1); getback(); dawndelay(); - } - break; - case 12: { /* _vm->_gyro.special 12: transfer south in catacombs. */ + break; + case 12: /* _vm->_gyro.special 12: transfer south in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_y += 1; catamove(2); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 2); getback(); dawndelay(); - } - break; - case 13: { /* _vm->_gyro.special 13: transfer west in catacombs. */ + break; + case 13: /* _vm->_gyro.special 13: transfer west in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_x -= 1; catamove(3); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 3); getback(); dawndelay(); - } - break; + break; } } -void Trip::open_the_door(byte whither, byte ped, byte magicnum) +void Trip::open_the_door(byte whither, byte ped, byte magicnum) { /* This slides the door open. (The data really ought to be saved in the Also file, and will be next time. However, for now, they're here.) */ -{ switch (_vm->_gyro.dna.room) { case r__outsideyours: case r__outsidenottspub: - case r__outsideducks: { + case r__outsideducks: _vm->_sequence.first_show(1); _vm->_sequence.then_show(2); _vm->_sequence.then_show(3); - } - break; - case r__insidecardiffcastle: { + break; + case r__insidecardiffcastle: _vm->_sequence.first_show(1); _vm->_sequence.then_show(5); - } - break; + break; case r__avvysgarden: case r__entrancehall: - case r__insideabbey: { + case r__insideabbey: _vm->_sequence.first_show(1); _vm->_sequence.then_show(2); - } - break; + break; case r__musicroom: - case r__outsideargentpub: { + case r__outsideargentpub: _vm->_sequence.first_show(5); _vm->_sequence.then_show(6); - } - break; + break; case r__lusties: switch (magicnum) { case 14: @@ -915,12 +882,11 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) _vm->_sequence.then_show(9); } break; - case 12: { + case 12: _vm->_sequence.first_show(4); _vm->_sequence.then_show(5); _vm->_sequence.then_show(6); - } - break; + break; } break; } @@ -936,33 +902,31 @@ void Trip::newspeed() { } void Trip::rwsp(byte t, byte r) { - { - switch (r) { - case up: - tr[t].speed(0, -tr[t].ys); - break; - case down: - tr[t].speed(0, tr[t].ys); - break; - case left: - tr[t].speed(-tr[t].xs, 0); - break; - case right: - tr[t].speed(tr[t].xs, 0); - break; - case ul: - tr[t].speed(-tr[t].xs, -tr[t].ys); - break; - case ur: - tr[t].speed(tr[t].xs, -tr[t].ys); - break; - case dl: - tr[t].speed(-tr[t].xs, tr[t].ys); - break; - case dr: - tr[t].speed(tr[t].xs, tr[t].ys); - break; - } + switch (r) { + case up: + tr[t].speed(0, -tr[t].ys); + break; + case down: + tr[t].speed(0, tr[t].ys); + break; + case left: + tr[t].speed(-tr[t].xs, 0); + break; + case right: + tr[t].speed(tr[t].xs, 0); + break; + case ul: + tr[t].speed(-tr[t].xs, -tr[t].ys); + break; + case ur: + tr[t].speed(tr[t].xs, -tr[t].ys); + break; + case dl: + tr[t].speed(-tr[t].xs, tr[t].ys); + break; + case dr: + tr[t].speed(tr[t].xs, tr[t].ys); + break; } } @@ -994,19 +958,17 @@ void Trip::getback() { endangered = false; /* Super_Off;*/ - { - while (getset[1 - _vm->_gyro.cp].numleft > 0) { - getset[1 - _vm->_gyro.cp].recall(r); + while (getset[1 - _vm->_gyro.cp].numleft > 0) { + getset[1 - _vm->_gyro.cp].recall(r); - /* if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end;*/ + /* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ - _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); - } + _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); } _vm->_lucerna.blitfix(); @@ -1028,7 +990,8 @@ void Trip::follow_avvy_y(byte tripnum) { return; if (tr[tripnum].ix == 0) { tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; tr[tripnum].count = 0; } } @@ -1045,8 +1008,10 @@ void Trip::back_and_forth(byte tripnum) { void Trip::face_avvy(byte tripnum) { if (! tr[tripnum].homing) { - if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; - else tr[tripnum].face = left; + if (tr[1].x >= tr[tripnum].x) + tr[tripnum].face = right; + else + tr[tripnum].face = left; } } @@ -1119,22 +1084,22 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ /* Still some way to go. */ if (tr[tripnum].x < tox) { tr[tripnum].x += 5; - if (tr[tripnum].x > tox) tr[tripnum].x = tox; + if (tr[tripnum].x > tox) + tr[tripnum].x = tox; } - if (tr[tripnum].y < toy) tr[tripnum].y += 1; + if (tr[tripnum].y < toy) + tr[tripnum].y += 1; tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; } } - - - - void Trip::take_a_step(byte &tripnum) { if (tr[tripnum].ix == 0) { tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; tr[tripnum].count = 0; } } @@ -1142,7 +1107,8 @@ void Trip::take_a_step(byte &tripnum) { void Trip::spin(byte whichway, byte &tripnum) { if (tr[tripnum].face != whichway) { tr[tripnum].face = whichway; - if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ + if (tr[tripnum].whichsprite == 2) + return; /* Not for Spludwick */ _vm->_gyro.dna.geida_spin += 1; _vm->_gyro.dna.geida_time = 20; @@ -1157,7 +1123,8 @@ void Trip::spin(byte whichway, byte &tripnum) { void Trip::geida_procs(byte tripnum) { if (_vm->_gyro.dna.geida_time > 0) { _vm->_gyro.dna.geida_time -= 1; - if (_vm->_gyro.dna.geida_time == 0) _vm->_gyro.dna.geida_spin = 0; + if (_vm->_gyro.dna.geida_time == 0) + _vm->_gyro.dna.geida_spin = 0; } if (tr[tripnum].y < (tr[1].y - 2)) { @@ -1185,7 +1152,8 @@ void Trip::geida_procs(byte tripnum) { tr[tripnum].ix = -tr[1].xs; spin(left, tripnum); take_a_step(tripnum); - } else tr[tripnum].ix = 0; + } else + tr[tripnum].ix = 0; } /* That's all... */ @@ -1205,7 +1173,7 @@ void Trip::call_andexors() { do { ok = true; - for (fv = 1; fv <= 4; fv ++) + for (fv = 1; fv <= 4; fv ++) { if (((order[fv] != 0) && (order[fv + 1] != 0)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { /* Swap them! */ @@ -1214,17 +1182,20 @@ void Trip::call_andexors() { order[fv + 1] = temp; ok = false; } + } } while (!ok); - for (fv = 1; fv <= 5; fv ++) + for (fv = 1; fv <= 5; fv ++) { if (order[fv] > 0) tr[order[fv]].andexor(); + } } void Trip::trippancy_link() { byte fv; - if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) return; + if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) + return; for (fv = 1; fv <= numtr; fv ++) { if (tr[fv].quick) tr[fv].walk(); @@ -1268,9 +1239,9 @@ void Trip::get_back_loretta() { /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { - getback(); - return; - } + getback(); + return; + } /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ } @@ -1285,63 +1256,68 @@ void Trip::tripkey(char dir) { if ((_vm->_gyro.ctrl == cjoy) | (! _vm->_gyro.dna.user_moves_avvy)) return; - { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (_vm->_gyro.dna.rw != up) { - _vm->_gyro.dna.rw = up; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'P': - if (_vm->_gyro.dna.rw != down) { - _vm->_gyro.dna.rw = down; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'K': - if (_vm->_gyro.dna.rw != left) { - _vm->_gyro.dna.rw = left; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'M': - if (_vm->_gyro.dna.rw != right) { - _vm->_gyro.dna.rw = right; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'I': - if (_vm->_gyro.dna.rw != ur) { - _vm->_gyro.dna.rw = ur; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'Q': - if (_vm->_gyro.dna.rw != dr) { - _vm->_gyro.dna.rw = dr; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'O': - if (_vm->_gyro.dna.rw != dl) { - _vm->_gyro.dna.rw = dl; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'G': - if (_vm->_gyro.dna.rw != ul) { - _vm->_gyro.dna.rw = ul; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } - } + triptype &with = tr[1]; + + switch (dir) { + case 'H': + if (_vm->_gyro.dna.rw != up) { + _vm->_gyro.dna.rw = up; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'P': + if (_vm->_gyro.dna.rw != down) { + _vm->_gyro.dna.rw = down; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'K': + if (_vm->_gyro.dna.rw != left) { + _vm->_gyro.dna.rw = left; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'M': + if (_vm->_gyro.dna.rw != right) { + _vm->_gyro.dna.rw = right; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'I': + if (_vm->_gyro.dna.rw != ur) { + _vm->_gyro.dna.rw = ur; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'Q': + if (_vm->_gyro.dna.rw != dr) { + _vm->_gyro.dna.rw = dr; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'O': + if (_vm->_gyro.dna.rw != dl) { + _vm->_gyro.dna.rw = dl; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'G': + if (_vm->_gyro.dna.rw != ul) { + _vm->_gyro.dna.rw = ul; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'L': + stopwalking(); + break; } } @@ -1350,9 +1326,7 @@ void Trip::readstick() { } void Trip::getsetclear() { - byte fv; - - for (fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv ++) getset[fv].init(); } @@ -1384,20 +1358,10 @@ void Trip::hide_in_the_cupboard() { } } - - - - - - - - void Trip::tidy_up(int16 a, int16 b, int16 c, int16 d) { warning("STUB: Trip::tidy_up()"); } - - void Trip::tidy_after_mouse() { tidy_up(beforex, beforey, beforex + 15, beforey + 15); _vm->_gyro.xycheck(); @@ -1407,7 +1371,6 @@ void Trip::tidy_after_mouse() { void Trip::fliproom(byte room, byte ped) { byte fv; - if (! _vm->_gyro.alive) { /* You can't leave the room if you're dead. */ tr[1].ix = 0; @@ -1462,9 +1425,7 @@ void Trip::fliproom(byte room, byte ped) { bool Trip::infield(byte which) { /* returns True if you're within field "which" */ - int16 yy; - - yy = tr[1].y + tr[1].a.yl; + int16 yy = tr[1].y + tr[1].a.yl; return (tr[1].x >= _vm->_gyro.fields[which].x1) && (tr[1].x <= _vm->_gyro.fields[which].x2) && (yy >= _vm->_gyro.fields[which].y1) && (yy <= _vm->_gyro.fields[which].y2); @@ -1492,7 +1453,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2) && (uy >= _vm->_gyro.fields[fv].y1) && (uy <= _vm->_gyro.fields[fv].y2)) - nd = true; + nd = true; } return nd; } From 539ce5612406edae9c3c226ed506602b8d197120 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Jun 2013 22:01:05 +0200 Subject: [PATCH 0066/1332] AVALANCHE: Fix some more code formatting --- engines/avalanche/acci2.cpp | 597 ++++++++++++++++---------------- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/celer2.cpp | 4 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/logger2.cpp | 78 +++-- engines/avalanche/scrolls2.cpp | 49 +-- engines/avalanche/sequence2.cpp | 3 +- engines/avalanche/timeout2.cpp | 8 +- engines/avalanche/trip6.cpp | 76 ++-- 9 files changed, 418 insertions(+), 401 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2a86732b0c2c..d16c8c674672 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1,4 +1,4 @@ -/* ScummVM - Graphic Adventure Engine + /* 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 @@ -216,10 +216,6 @@ const Acci::ranktype Acci::ranks[9] = { }; - - - - void Acci::setParent(AvalancheEngine *vm) { _vm = vm; } @@ -239,13 +235,14 @@ Common::String Acci::wordnum(Common::String x) bool gotcha; Common::String wordnum_result; - if (x == "") { + if (x == "") { wordnum_result = ""; return wordnum_result; } whatsit = pardon; gotcha = false; - for (fv = nowords; fv >= 1; fv --) checkword(x); + for (fv = nowords; fv >= 1; fv--) + checkword(x); wordnum_result = whatsit; return wordnum_result; } @@ -273,13 +270,14 @@ end;*/ Common::String Acci::rank() { byte fv; - Common::String rank_result; - for (fv = 1; fv <= 8; fv ++) + Common::String rank_result = ""; + for (fv = 1; fv <= 8; fv++) { if ((_vm->_gyro.dna.score >= ranks[fv].score) && (_vm->_gyro.dna.score < ranks[fv + 1].score)) { rank_result = ranks[fv].title; return rank_result; } - + } + return rank_result; } @@ -341,11 +339,6 @@ bool Acci::do_pronouns() { return do_pronouns_result; } - - - - - void Acci::lowercase() { byte fv; @@ -421,9 +414,7 @@ void Acci::examine() { void Acci::inv() { /* the time-honoured command... */ char fv; - byte q; - - q = 0; + byte q = 0; warning("STUB: Acci::inv()"); } @@ -442,19 +433,24 @@ void Acci::lookaround() { _vm->_scrolls.display(*_vm->_gyro.also[0][1]); switch (_vm->_gyro.dna.room) { case r__spludwicks: - if (_vm->_gyro.dna.avaricius_talk > 0) _vm->_visa.dixi('q', 23); - else others(); + if (_vm->_gyro.dna.avaricius_talk > 0) + _vm->_visa.dixi('q', 23); + else + others(); + break; + case r__robins: + if (_vm->_gyro.dna.tied_up) + _vm->_visa.dixi('q', 38); + if (_vm->_gyro.dna.mushroom_growing) + _vm->_visa.dixi('q', 55); break; - case r__robins: { - if (_vm->_gyro.dna.tied_up) _vm->_visa.dixi('q', 38); - if (_vm->_gyro.dna.mushroom_growing) _vm->_visa.dixi('q', 55); - } - break; case r__insidecardiffcastle: - if (! _vm->_gyro.dna.taken_pen) _vm->_visa.dixi('q', 49); + if (!_vm->_gyro.dna.taken_pen) + _vm->_visa.dixi('q', 49); break; case r__lustiesroom: - if (_vm->_gyro.dna.lustie_is_asleep) _vm->_visa.dixi('q', 65); + if (_vm->_gyro.dna.lustie_is_asleep) + _vm->_visa.dixi('q', 65); break; case r__catacombs: switch (_vm->_gyro.dna.cat_y * 256 + _vm->_gyro.dna.cat_x) { @@ -487,7 +483,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } break; case r__spludwicks: - if (thing == 61) { + if (thing == 61) { _vm->_visa.dixi('q', 85); return; } @@ -495,26 +491,25 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } - if ((! _vm->_gyro.dna.user_moves_avvy) && (_vm->_gyro.dna.room != r__lusties)) + if ((!_vm->_gyro.dna.user_moves_avvy) && (_vm->_gyro.dna.room != r__lusties)) return; /* No doors can open if you can't move Avvy. */ - for (fv = 9; fv <= 15; fv ++) + + for (fv = 9; fv <= 15; fv++) { if (_vm->_trip.infield(fv)) { { _vm->_gyro.portals[fv]; switch (_vm->_gyro.portals[fv].op) { - case _vm->_gyro.exclaim: { + case _vm->_gyro.exclaim: _vm->_trip.tr[1].bounce(); _vm->_visa.dixi('x', _vm->_gyro.portals[fv].data); - } - break; + break; case _vm->_gyro.transport: _vm->_trip.fliproom((_vm->_gyro.portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro.portals[fv].data) & 0x0F /*Low byte*/); break; - case _vm->_gyro.unfinished: { + case _vm->_gyro.unfinished: _vm->_trip.tr[1].bounce(); _vm->_scrolls.display("Sorry. This place is not available yet!"); - } - break; + break; case _vm->_gyro.special: _vm->_trip.call_special(_vm->_gyro.portals[fv].data); break; @@ -525,6 +520,8 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } return; } + } + if (_vm->_gyro.dna.room == r__map) _vm->_scrolls.display(Common::String("Avvy, you can complete the whole game without ever going " "to anywhere other than Argent, Birmingham, Cardiff, " @@ -541,14 +538,14 @@ void Acci::silly() { } void Acci::putproc() { /* Called when you call vb_put. */ - char temp; - + if (!holding()) + return; - if (! holding()) return; thing2 -= 49; /* Slip the second object */ - temp = thing; + char temp = thing; thing = thing2; - if (! holding()) return; + if (!holding()) + return; thing = temp; /* Thing is the thing which you're putting in. Thing2 is where you're @@ -569,7 +566,8 @@ void Acci::putproc() { /* Called when you call vb_put. */ _vm->_visa.dixi('u', 9); } } - } else silly(); + } else + silly(); break; case 54: @@ -577,7 +575,7 @@ void Acci::putproc() { /* Called when you call vb_put. */ if (_vm->_gyro.dna.box_contents != nowt) _vm->_scrolls.display(Common::String("There's something in the box already, Avvy. Try taking" " that out first.")); - else + else { switch (thing) { case _vm->_gyro.money: _vm->_scrolls.display("You'd better keep some ready cash on you!"); @@ -591,7 +589,7 @@ void Acci::putproc() { /* Called when you call vb_put. */ case _vm->_gyro.onion: _vm->_scrolls.display("Just give it to Spludwick, Avvy!"); break; - default: { + default: /* Put the object into the box... */ if (_vm->_gyro.dna.wearing == thing) _vm->_scrolls.display(Common::String("You'd better take ") + _vm->_gyro.get_better(thing) + " off first!"); @@ -604,8 +602,9 @@ void Acci::putproc() { /* Called when you call vb_put. */ _vm->_celer.show_one(6); /* Shut box. */ } } - } - } else silly(); + } + } else + silly(); break; default: @@ -614,9 +613,6 @@ void Acci::putproc() { /* Called when you call vb_put. */ } - - - /* The result of this fn is whether or not he says "Hey, thanks!" */ void Acci::not_in_order() { _vm->_scrolls.display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + @@ -631,72 +627,63 @@ void Acci::go_to_cauldron() { } bool Acci::give2spludwick() { - bool give2spludwick_result; - { - give2spludwick_result = false; + bool give2spludwick_result = false; - if (_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick] != thing) { - not_in_order(); - return give2spludwick_result; - } + if (_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick] != thing) { + not_in_order(); + return give2spludwick_result; + } - switch (thing) { - case _vm->_gyro.onion: { - _vm->_gyro.dna.obj[_vm->_gyro.onion] = false; - if (_vm->_gyro.dna.rotten_onion) - _vm->_visa.dixi('q', 22); - else { - _vm->_gyro.dna.given2spludwick += 1; - _vm->_visa.dixi('q', 20); - go_to_cauldron(); - _vm->_lucerna.points(3); - } - _vm->_lucerna.objectlist(); - } - break; - case _vm->_gyro.ink: { - _vm->_gyro.dna.obj[_vm->_gyro.ink] = false; - _vm->_lucerna.objectlist(); + switch (thing) { + case _vm->_gyro.onion: + _vm->_gyro.dna.obj[_vm->_gyro.onion] = false; + if (_vm->_gyro.dna.rotten_onion) + _vm->_visa.dixi('q', 22); + else { _vm->_gyro.dna.given2spludwick += 1; - _vm->_visa.dixi('q', 24); + _vm->_visa.dixi('q', 20); go_to_cauldron(); _vm->_lucerna.points(3); } + _vm->_lucerna.objectlist(); break; - case _vm->_gyro.mushroom: { - _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = false; - _vm->_visa.dixi('q', 25); - _vm->_lucerna.points(5); - _vm->_gyro.dna.given2spludwick += 1; - go_to_cauldron(); - _vm->_gyro.dna.obj[_vm->_gyro.potion] = true; - _vm->_lucerna.objectlist(); - } + case _vm->_gyro.ink: + _vm->_gyro.dna.obj[_vm->_gyro.ink] = false; + _vm->_lucerna.objectlist(); + _vm->_gyro.dna.given2spludwick += 1; + _vm->_visa.dixi('q', 24); + go_to_cauldron(); + _vm->_lucerna.points(3); break; - default: - give2spludwick_result = true; - } + case _vm->_gyro.mushroom: + _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = false; + _vm->_visa.dixi('q', 25); + _vm->_lucerna.points(5); + _vm->_gyro.dna.given2spludwick += 1; + go_to_cauldron(); + _vm->_gyro.dna.obj[_vm->_gyro.potion] = true; + _vm->_lucerna.objectlist(); + break; + default: + give2spludwick_result = true; } + return give2spludwick_result; } - - void Acci::have_a_drink() { - { - _vm->_gyro.dna.alcohol += 1; - if (_vm->_gyro.dna.alcohol == 5) { - _vm->_gyro.dna.obj[_vm->_gyro.key] = true; /* Get the key. */ - _vm->_gyro.dna.teetotal = true; - _vm->_gyro.dna.avvy_is_awake = false; - _vm->_gyro.dna.avvy_in_bed = true; - _vm->_lucerna.objectlist(); - _vm->_lucerna.dusk(); - _vm->_gyro.hang_around_for_a_while(); - _vm->_trip.fliproom(1, 1); - _vm->_gyro.background(14); - _vm->_trip.new_game_for_trippancy(); /* Not really */ - } + _vm->_gyro.dna.alcohol += 1; + if (_vm->_gyro.dna.alcohol == 5) { + _vm->_gyro.dna.obj[_vm->_gyro.key] = true; /* Get the key. */ + _vm->_gyro.dna.teetotal = true; + _vm->_gyro.dna.avvy_is_awake = false; + _vm->_gyro.dna.avvy_in_bed = true; + _vm->_lucerna.objectlist(); + _vm->_lucerna.dusk(); + _vm->_gyro.hang_around_for_a_while(); + _vm->_trip.fliproom(1, 1); + _vm->_gyro.background(14); + _vm->_trip.new_game_for_trippancy(); /* Not really */ } } @@ -718,8 +705,6 @@ void Acci::cardiff_climbing() { } - - /* Called when you ask Avvy to stand. */ void Acci::already() { _vm->_scrolls.display("You're already standing!"); @@ -742,7 +727,8 @@ void Acci::stand_up() { _vm->_lucerna.points(1); _vm->_gyro.dna.avvy_in_bed = false; _vm->_timeout.lose_timer(_vm->_timeout.reason_arkata_shouts); - } else already(); + } else + already(); break; case r__insidecardiffcastle: @@ -756,7 +742,8 @@ void Acci::stand_up() { _vm->_trip.apped(1, 4); /* And walking away. */ _vm->_gyro.dna.sitting_in_pub = false; /* Really not sitting down. */ _vm->_gyro.dna.user_moves_avvy = true; /* And ambulant. */ - } else already(); + } else + already(); break; default: already(); @@ -764,8 +751,6 @@ void Acci::stand_up() { } - - void Acci::getproc(char thing) { switch (_vm->_gyro.dna.room) { case r__yours: @@ -779,11 +764,12 @@ void Acci::getproc(char thing) { _vm->_celer.show_one(6); } else _vm->_scrolls.display(Common::String("I can't see ") + _vm->_gyro.get_better(thing) + " in the box."); - } else _vm->_visa.dixi('q', 57); + } else + _vm->_visa.dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { - case _vm->_gyro.pen: { + case _vm->_gyro.pen: if (_vm->_trip.infield(2)) { /* Standing on the dais. */ @@ -798,10 +784,11 @@ void Acci::getproc(char thing) { _vm->_lucerna.objectlist(); _vm->_scrolls.display("Taken."); } - } else if (_vm->_gyro.dna.standing_on_dais) _vm->_visa.dixi('q', 53); - else _vm->_visa.dixi('q', 51); - } - break; + } else if (_vm->_gyro.dna.standing_on_dais) + _vm->_visa.dixi('q', 53); + else + _vm->_visa.dixi('q', 51); + break; case _vm->_gyro.bolt: _vm->_visa.dixi('q', 52); break; @@ -818,7 +805,8 @@ void Acci::getproc(char thing) { _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = true; _vm->_lucerna.objectlist(); _vm->_lucerna.points(3); - } else _vm->_visa.dixi('q', 57); + } else + _vm->_visa.dixi('q', 57); break; default: _vm->_visa.dixi('q', 57); @@ -826,26 +814,25 @@ void Acci::getproc(char thing) { } void Acci::give_geida_the_lute() { - { - if (_vm->_gyro.dna.room != r__lustiesroom) { - _vm->_scrolls.display("Not yet. Try later!\232\2"); - return; - } - _vm->_gyro.dna.obj[_vm->_gyro.lute] = false; - _vm->_lucerna.objectlist(); - _vm->_visa.dixi('q', 64); /* She plays it. */ + if (_vm->_gyro.dna.room != r__lustiesroom) { + _vm->_scrolls.display("Not yet. Try later!\232\2"); + return; + } + _vm->_gyro.dna.obj[_vm->_gyro.lute] = false; + _vm->_lucerna.objectlist(); + _vm->_visa.dixi('q', 64); /* She plays it. */ - /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ + /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procgive_lute_to_geida, _vm->_timeout.reason_geida_sings); - _vm->_enid.back_to_bootstrap(4); - } + _vm->_timeout.set_up_timer(1, _vm->_timeout.procgive_lute_to_geida, _vm->_timeout.reason_geida_sings); + _vm->_enid.back_to_bootstrap(4); } void Acci::play_harp() { if (_vm->_trip.infield(7)) _vm->_scrolls.musical_scroll(); - else _vm->_scrolls.display("Get a bit closer to it, Avvy!"); + else + _vm->_scrolls.display("Get a bit closer to it, Avvy!"); } void Acci::winsequence() { @@ -864,8 +851,10 @@ void Acci::person_speaks() { if ((person == pardon) || (person == '\0')) { - if ((_vm->_gyro.him == pardon) || (_vm->_gyro.whereis[_vm->_gyro.him] != _vm->_gyro.dna.room)) person = _vm->_gyro.her; - else person = _vm->_gyro.him; + if ((_vm->_gyro.him == pardon) || (_vm->_gyro.whereis[_vm->_gyro.him] != _vm->_gyro.dna.room)) + person = _vm->_gyro.her; + else + person = _vm->_gyro.him; } if (_vm->_gyro.whereis[person] != _vm->_gyro.dna.room) { @@ -875,24 +864,23 @@ void Acci::person_speaks() { found = false; /* The person we're looking for's code is in Person. */ - for (fv = 1; fv <= _vm->_trip.numtr; fv ++) + for (fv = 1; fv <= _vm->_trip.numtr; fv++) { if (_vm->_trip.tr[fv].quick && ((_vm->_trip.tr[fv].a.accinum + 149) == person)) { _vm->_scrolls.display(Common::String('\23') + char(fv + 48) + '\4'); found = true; } + } - if (! found) - for (fv = 10; fv <= 25; fv ++) { + if (!found) { + for (fv = 10; fv <= 25; fv++) { _vm->_gyro.quasipeds[fv]; if ((_vm->_gyro.quasipeds[fv].who == person) && (_vm->_gyro.quasipeds[fv].room == _vm->_gyro.dna.room)) { _vm->_scrolls.display(Common::String('\23') + char(fv + 55) + '\4'); } } + } } - - - void Acci::heythanks() { person_speaks(); _vm->_scrolls.display("Hey, thanks!\2(But now, you've lost it!)"); @@ -910,25 +898,29 @@ void Acci::do_that() { thats = ""; return; } - if (_vm->_gyro.weirdword) return; - if (thing < '\310') thing -= 49; /* "Slip" */ - - /*if ((! _vm->_gyro.alive) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, - vb_highscores, vb_smartalec, eos).has(verb))) { - _vm->_scrolls.display(Common::String("You're dead, so don't talk. What are you, a ghost ") + - "or something? Try restarting, or restoring a saved game!"); - return; + if (_vm->_gyro.weirdword) + return; + if (thing < '\310') + thing -= 49; /* "Slip" */ + + /* + if ((!_vm->_gyro.alive) & + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, + vb_highscores, vb_smartalec, eos).has(verb))) { + _vm->_scrolls.display(Common::String("You're dead, so don't talk. What are you, a ghost ") + + "or something? Try restarting, or restoring a saved game!"); + return; } if ((~ _vm->_gyro.dna.avvy_is_awake) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, - vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { - _vm->_scrolls.display("Talking in your sleep? Try waking up!"); - return; - }*/ + !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, + vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, + vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { + _vm->_scrolls.display("Talking in your sleep? Try waking up!"); + return; + } + */ switch (verb) { @@ -942,11 +934,13 @@ void Acci::do_that() { _vm->_scrolls.display(Common::String("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + "the mouse on the `O.K.\" box to continue."); break; - case vb_get: { + case vb_get: if (thing != pardon) { /* Legitimate try to pick something up. */ - if (_vm->_gyro.dna.carrying >= maxobjs) _vm->_scrolls.display("You can't carry any more!"); - else getproc(thing); + if (_vm->_gyro.dna.carrying >= maxobjs) + _vm->_scrolls.display("You can't carry any more!"); + else + getproc(thing); } else { /* Not... ditto. */ @@ -955,8 +949,7 @@ void Acci::do_that() { else _vm->_scrolls.display("I assure you, you don't need it."); } - } - break; + break; case vb_drop: _vm->_scrolls.display(Common::String("Two years ago you dropped a florin in the street. Three days ") + "later it was gone! So now you never leave ANYTHING lying around. OK?"); @@ -969,25 +962,32 @@ void Acci::do_that() { if (person == pardon) { if (_vm->_gyro.subjnumber == 99) /* They typed "say passuint16". */ _vm->_scrolls.display("Yes, but what \6is\22 the passuint16?"); - /*else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { - Delete(thats, 1, 1); - move(realuint16s[2], realuint16s[1], sizeof(realuint16s) - sizeof(realuint16s[1])); - verb = chr(subjnumber); - do_that(); - return; + /* + else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { + Delete(thats, 1, 1); + move(realuint16s[2], realuint16s[1], sizeof(realuint16s) - sizeof(realuint16s[1])); + verb = chr(subjnumber); + do_that(); + return; } else { - person = _vm->_gyro.subjnumber; - subjnumber = 0; - if (set::of(pardon, '\0', eos).has(person)) _vm->_scrolls.display("Talk to whom?"); - else if (personshere()) talkto(ord(person)); + person = _vm->_gyro.subjnumber; + subjnumber = 0; + if (set::of(pardon, '\0', eos).has(person)) + _vm->_scrolls.display("Talk to whom?"); + else if (personshere()) + talkto(ord(person)); } - }*/ else if (person == pardon) _vm->_scrolls.display("Talk to whom?"); - else if (personshere()) _vm->_visa.talkto(person); + */ + else if (person == pardon) + _vm->_scrolls.display("Talk to whom?"); + } else if (personshere()) + _vm->_visa.talkto(person); break; case vb_give: if (holding()) { - if (person == pardon) _vm->_scrolls.display("Give to whom?"); + if (person == pardon) + _vm->_scrolls.display("Give to whom?"); else if (personshere()) { switch (thing) { case _vm->_gyro.money : @@ -1003,11 +1003,10 @@ void Acci::do_that() { switch (person) { case _vm->_gyro.pcrapulus: switch (thing) { - case _vm->_gyro.wine: { + case _vm->_gyro.wine: _vm->_scrolls.display("Crapulus grabs the wine and gulps it down."); _vm->_gyro.dna.obj[_vm->_gyro.wine] = false; - } - break; + break; default: heythanks(); } @@ -1019,7 +1018,8 @@ void Acci::do_that() { else */heythanks(); break; case _vm->_gyro.pspludwick: - if (give2spludwick()) heythanks(); + if (give2spludwick()) + heythanks(); break; case _vm->_gyro.pibythneth: if (thing == _vm->_gyro.badge) { @@ -1030,7 +1030,8 @@ void Acci::do_that() { _vm->_gyro.dna.givenbadgetoiby = true; _vm->_celer.show_one(8); _vm->_celer.show_one(9); - } else heythanks(); + } else + heythanks(); break; case _vm->_gyro.payles: if (_vm->_gyro.dna.ayles_is_awake) { @@ -1041,20 +1042,20 @@ void Acci::do_that() { _vm->_gyro.dna.given_pen_to_ayles = true; _vm->_lucerna.objectlist(); _vm->_lucerna.points(2); - } else heythanks(); + } else + heythanks(); } else _vm->_scrolls.display("But he's asleep!"); break; case _vm->_gyro.pgeida: switch (thing) { - case _vm->_gyro.potion : { + case _vm->_gyro.potion: _vm->_gyro.dna.obj[_vm->_gyro.potion] = false; _vm->_visa.dixi('u', 16); /* She drinks it. */ _vm->_lucerna.points(2); _vm->_gyro.dna.geida_given_potion = true; _vm->_lucerna.objectlist(); - } - break; + break; case _vm->_gyro.lute: give_geida_the_lute(); break; @@ -1067,7 +1068,8 @@ void Acci::do_that() { case _vm->_gyro.potion: if (_vm->_gyro.dna.geida_given_potion) winsequence(); - else _vm->_visa.dixi('q', 77); + else + _vm->_visa.dixi('q', 77); break; /* That Geida woman! */ default: heythanks(); @@ -1084,7 +1086,8 @@ void Acci::do_that() { case vb_eat: case vb_drink: - if (holding()) swallow(); + if (holding()) + swallow(); break; case vb_load: _vm->_enid.edna_load(realwords[2]); @@ -1104,20 +1107,21 @@ void Acci::do_that() { case vb_break: _vm->_scrolls.display("Vandalism is prohibited within this game!"); break; - case vb_quit: { /* quit */ + case vb_quit: /* quit */ //if (_vm->_gyro.demo) { // _vm->_visa.dixi('q', 31); // close(demofile); // exit(0); /* Change this later!!! */ //} - if (! polite) _vm->_scrolls.display("How about a `please\", Avvy?"); - else if (_vm->_scrolls.ask("\23C\26Do you really want to quit?")) _vm->_gyro.lmo = true; - } - break; + if (!polite) + _vm->_scrolls.display("How about a `please\", Avvy?"); + else if (_vm->_scrolls.ask("\23C\26Do you really want to quit?")) + _vm->_gyro.lmo = true; + break; case vb_go: _vm->_scrolls.display("Just use the arrow keys to walk there."); break; - case vb_info: { + case vb_info: _vm->_scrolls.aboutscroll = true; /* _vm->_scrolls.display('Thorsoft of Letchworth presents:'+^c+^m+^m+ 'The medival descendant of'+^m+ @@ -1131,10 +1135,10 @@ void Acci::do_that() { '\15' + '\15' + "version " + _vm->_gyro.vernum + '\15' + '\15' + "Copyright " + _vm->_gyro.copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); _vm->_scrolls.aboutscroll = false; - } - break; + break; case vb_undress: - if (_vm->_gyro.dna.wearing == nowt) _vm->_scrolls.display("You're already stark naked!"); + if (_vm->_gyro.dna.wearing == nowt) + _vm->_scrolls.display("You're already stark naked!"); else if (_vm->_gyro.dna.avvys_in_the_cupboard) { _vm->_scrolls.display(Common::String("You take off ") + _vm->_gyro.get_better(_vm->_gyro.dna.wearing) + '.'); _vm->_gyro.dna.wearing = nowt; @@ -1150,7 +1154,7 @@ void Acci::do_that() { _vm->_scrolls.display("Hey, what kind of a weirdo are you\??!"); break; case _vm->_gyro.clothes: - case _vm->_gyro.habit: { /* Change this! */ + case _vm->_gyro.habit: /* Change this! */ if (_vm->_gyro.dna.wearing != nowt) { if (_vm->_gyro.dna.wearing == thing) _vm->_scrolls.display("You're already wearing that."); @@ -1161,19 +1165,20 @@ void Acci::do_that() { } else _vm->_gyro.dna.wearing = thing; _vm->_lucerna.objectlist(); - if (thing == _vm->_gyro.habit) fv = 3; - else fv = 0; - { - if (_vm->_trip.tr[1].whichsprite != fv) { - sx = _vm->_trip.tr[1].x; - sy = _vm->_trip.tr[1].y; - _vm->_trip.tr[1].done(); - _vm->_trip.tr[1].init(fv, true, &_vm->_trip); - _vm->_trip.tr[1].appear(sx, sy, _vm->_trip.left); - _vm->_trip.tr[1].visible = false; - } + + if (thing == _vm->_gyro.habit) + fv = 3; + else + fv = 0; + + if (_vm->_trip.tr[1].whichsprite != fv) { + sx = _vm->_trip.tr[1].x; + sy = _vm->_trip.tr[1].y; + _vm->_trip.tr[1].done(); + _vm->_trip.tr[1].init(fv, true, &_vm->_trip); + _vm->_trip.tr[1].appear(sx, sy, _vm->_trip.left); + _vm->_trip.tr[1].visible = false; } - } break; default: _vm->_scrolls.display(what); @@ -1181,7 +1186,7 @@ void Acci::do_that() { } break; case vb_play: - if (thing == pardon) + if (thing == pardon) { switch (_vm->_gyro.dna.room) { /* They just typed "play"... */ case r__argentpub: // play_nim(); @@ -1191,21 +1196,27 @@ void Acci::do_that() { play_harp(); break; } - else if (holding()) { + } else if (holding()) { switch (thing) { - case _vm->_gyro.lute : { + case _vm->_gyro.lute : _vm->_visa.dixi('U', 7); - if (_vm->_gyro.whereis[_vm->_gyro.pcwytalot] == _vm->_gyro.dna.room) _vm->_visa.dixi('U', 10); - if (_vm->_gyro.whereis[_vm->_gyro.pdulustie] == _vm->_gyro.dna.room) _vm->_visa.dixi('U', 15); - } - break; - case 52 : - if (_vm->_gyro.dna.room == r__musicroom) play_harp(); - else _vm->_scrolls.display(what); + if (_vm->_gyro.whereis[_vm->_gyro.pcwytalot] == _vm->_gyro.dna.room) + _vm->_visa.dixi('U', 10); + + if (_vm->_gyro.whereis[_vm->_gyro.pdulustie] == _vm->_gyro.dna.room) + _vm->_visa.dixi('U', 15); break; - case 55 : - if (_vm->_gyro.dna.room == r__argentpub) ; /*play_nim(); - Don't implement yet.*/ - else _vm->_scrolls.display(what); + case 52: + if (_vm->_gyro.dna.room == r__musicroom) + play_harp(); + else + _vm->_scrolls.display(what); + break; + case 55: + if (_vm->_gyro.dna.room == r__argentpub) + ; /*play_nim(); - Don't implement yet.*/ + else + _vm->_scrolls.display(what); break; default: _vm->_scrolls.display(what); @@ -1218,7 +1229,8 @@ void Acci::do_that() { _vm->_scrolls.display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) _vm->_scrolls.display("(Are you trying to join in, Avvy\?\?!)"); - } else _vm->_scrolls.display(what); + } else + _vm->_scrolls.display(what); } break; case vb_help: @@ -1239,13 +1251,13 @@ void Acci::do_that() { if (_vm->_gyro.flagset('P')) { _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); _vm->_timeout.set_up_timer(4, _vm->_timeout.procurinate, _vm->_timeout.reason_gototoilet); - } else _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); + } else + _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); break; - case vb_cheat: { + case vb_cheat: _vm->_scrolls.display(Common::String('\6') + "Cheat mode now enabled."); _vm->_gyro.cheat = true; - } - break; + break; case vb_magic: if (_vm->_gyro.dna.avaricius_talk > 0) _vm->_visa.dixi('q', 19); @@ -1264,14 +1276,15 @@ void Acci::do_that() { _vm->_gyro.dna.avaricius_talk = 14; _vm->_timeout.set_up_timer(177, _vm->_timeout.procavaricius_talks, _vm->_timeout.reason_avariciustalks); } - } else _vm->_scrolls.display("Nothing appears to happen..."); + } else + _vm->_scrolls.display("Nothing appears to happen..."); } break; case vb_smartalec: _vm->_scrolls.display("Listen, smart alec, that was just rhetoric."); break; - case vb_expletive: { - switch ( _vm->_gyro.dna.swore) { + case vb_expletive: + switch (_vm->_gyro.dna.swore) { case 0: _vm->_scrolls.display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + "(I shouldn't say it again, if I were you!)"); @@ -1280,25 +1293,24 @@ void Acci::do_that() { _vm->_scrolls.display(Common::String("You hear a distant rumble of thunder. Must you always ") + "do things I tell you not to?\r\rDon't do it again!"); break; - default: { + default: _vm->_pingo.zonk(); _vm->_scrolls.display(Common::String("A crack of lightning shoots from the sky, ") + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna.gameover(); } - } - _vm->_gyro.dna.swore ++; - } - break; + _vm->_gyro.dna.swore++; + break; case vb_listen: if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) _vm->_scrolls.display(Common::String("All other noise is drowned out by the ringing of ") + "the bells."); else if (_vm->_gyro.listen == "") _vm->_scrolls.display("You can't hear anything much at the moment, Avvy."); - else _vm->_scrolls.display(_vm->_gyro.listen); + else + _vm->_scrolls.display(_vm->_gyro.listen); break; - case vb_buy: { + case vb_buy: /* What are they trying to buy? */ switch (_vm->_gyro.dna.room) { case r__argentpub: @@ -1308,16 +1320,19 @@ void Acci::do_that() { case '\63': case '\65': case '\66': - case '\72': { /* Beer, whisky, cider or mead */ + case '\72': /* Beer, whisky, cider or mead */ if (_vm->_gyro.dna.malagauche == 177) { /* Already getting us one. */ _vm->_visa.dixi('D', 15); return; } + if (_vm->_gyro.dna.teetotal) { _vm->_visa.dixi('D', 6); return; } - if (_vm->_gyro.dna.alcohol == 0) _vm->_lucerna.points(3); + + if (_vm->_gyro.dna.alcohol == 0) + _vm->_lucerna.points(3); _vm->_celer.show_one(12); _vm->_scrolls.display(booze[thing] + ", please.\231\2"); _vm->_gyro.dna.drinking = thing; @@ -1325,8 +1340,7 @@ void Acci::do_that() { _vm->_celer.show_one(10); _vm->_gyro.dna.malagauche = 177; _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuydrinks, _vm->_timeout.reason_drinks); - } - break; + break; case '\64': examine(); break; /* We have a right one here- buy Pepsi??! */ @@ -1338,13 +1352,16 @@ void Acci::do_that() { _vm->_visa.dixi('D', 15); return; } + if (_vm->_gyro.dna.carrying >= maxobjs) { _vm->_scrolls.display("Your hands are full."); return; } + _vm->_celer.show_one(12); _vm->_scrolls.display("Wine, please.\231\2"); - if (_vm->_gyro.dna.alcohol == 0) _vm->_lucerna.points(3); + if (_vm->_gyro.dna.alcohol == 0) + _vm->_lucerna.points(3); _vm->_celer.show_one(10); _vm->_gyro.dna.malagauche = 177; @@ -1352,7 +1369,8 @@ void Acci::do_that() { } break; } - } else _vm->_visa.dixi('D', 5); + } else + _vm->_visa.dixi('D', 5); break; /* Go to the bar! */ case r__outsideducks: @@ -1376,8 +1394,10 @@ void Acci::do_that() { _vm->_gyro.dna.rotten_onion = false; /* It's OK when it leaves the stall! */ _vm->_gyro.dna.onion_in_vinegar = false; } - } else _vm->_visa.dixi('D', 0); - } else _vm->_visa.dixi('D', 0); + } else + _vm->_visa.dixi('D', 0); + } else + _vm->_visa.dixi('D', 0); break; case r__nottspub: @@ -1386,20 +1406,18 @@ void Acci::do_that() { default: _vm->_visa.dixi('D', 0); /* Can't buy that. */ } - } - break; - case vb_attack: { + break; + case vb_attack: if ((_vm->_gyro.dna.room == r__brummieroad) && ((person == '\235') || (thing == _vm->_gyro.crossbow) || (thing == _vm->_gyro.bolt)) && (_vm->_gyro.whereis['\235'] == _vm->_gyro.dna.room)) { switch (_vm->_gyro.dna.obj[_vm->_gyro.bolt] + _vm->_gyro.dna.obj[_vm->_gyro.crossbow] * 2) { /* 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. */ - case 0: { + case 0: _vm->_visa.dixi('Q', 10); _vm->_scrolls.display("(At the very least, don't use your bare hands!)"); - } - break; + break; case 1: _vm->_scrolls.display(Common::String("Attack _vm->_gyro.him with only a crossbow bolt? Are you ") + "planning on playing darts?!"); @@ -1408,7 +1426,7 @@ void Acci::do_that() { _vm->_scrolls.display(Common::String("Come on, Avvy! You're not going to get very far ") + "with only a crossbow!"); break; - case 3: { + case 3: _vm->_visa.dixi('Q', 11); _vm->_gyro.dna.cwytalot_gone = true; _vm->_gyro.dna.obj[_vm->_gyro.bolt] = false; @@ -1420,26 +1438,27 @@ void Acci::do_that() { _vm->_trip.tr[2].vanishifstill = true; _vm->_trip.tr[2].call_eachstep = false; _vm->_gyro.whereis['\235'] = 177; - } - break; + break; default: _vm->_visa.dixi('Q', 10); /* Please try not to be so violent! */ } - } else _vm->_visa.dixi('Q', 10); - } - break; + } else + _vm->_visa.dixi('Q', 10); + break; case vb_password: if (_vm->_gyro.dna.room != r__bridge) _vm->_visa.dixi('Q', 12); else { ok = true; - for (ff = 1; ff <= thats.size(); ff ++) - for (fv = 1; fv <= words[_vm->_gyro.dna.pass_num + first_password].w.size(); fv ++) { + for (ff = 1; ff <= thats.size(); ff++) { + for (fv = 1; fv <= words[_vm->_gyro.dna.pass_num + first_password].w.size(); fv++) { Common::String temp = realwords[ff]; temp.toUppercase(); if (words[_vm->_gyro.dna.pass_num + first_password].w[fv] != temp[fv]) ok = false; } + } + if (ok) { if (_vm->_gyro.dna.drawbridge_open != 0) _vm->_scrolls.display("Contrary to your expectations, the drawbridge fails to close again."); @@ -1449,7 +1468,8 @@ void Acci::do_that() { _vm->_timeout.set_up_timer(7, _vm->_timeout.procopen_drawbridge, _vm->_timeout.reason_drawbridgefalls); _vm->_gyro.dna.drawbridge_open = 1; } - } else _vm->_visa.dixi('Q', 12); + } else + _vm->_visa.dixi('Q', 12); } break; case vb_dir: @@ -1473,7 +1493,7 @@ void Acci::do_that() { case vb_kiss: if (person == pardon) _vm->_scrolls.display("Kiss whom?"); - else if (personshere()) + else if (personshere()) { switch (person) { case _vm->_gyro.parkata: _vm->_visa.dixi('U', 12); @@ -1487,22 +1507,22 @@ void Acci::do_that() { default: _vm->_visa.dixi('U', 5); /* You WHAT? */ } - else if ((150 <= person) && (person <= 174)) + } else if ((150 <= person) && (person <= 174)) _vm->_scrolls.display("Hey, what kind of a weirdo are you??"); break; case vb_climb: - if (_vm->_gyro.dna.room == r__insidecardiffcastle) cardiff_climbing(); + if (_vm->_gyro.dna.room == r__insidecardiffcastle) + cardiff_climbing(); else /* In the wrong room! */ _vm->_scrolls.display("Not with your head for heights, Avvy!"); break; - case vb_jump: { + case vb_jump: _vm->_timeout.set_up_timer(1, _vm->_timeout.procjump, _vm->_timeout.reason_jumping); _vm->_gyro.dna.user_moves_avvy = false; - } - break; + break; case vb_highscores: // show_highs(); @@ -1515,16 +1535,19 @@ void Acci::do_that() { case pardon: case _vm->_gyro.pavalot: case '\0': - if (! _vm->_gyro.dna.avvy_is_awake) { + if (!_vm->_gyro.dna.avvy_is_awake) { _vm->_gyro.dna.avvy_is_awake = true; _vm->_lucerna.points(1); _vm->_gyro.dna.avvy_in_bed = true; _vm->_celer.show_one(3); /* Picture of Avvy, awake in bed. */ - if (_vm->_gyro.dna.teetotal) _vm->_visa.dixi('d', 13); - } else _vm->_scrolls.display("You're already awake, Avvy!"); + if (_vm->_gyro.dna.teetotal) + _vm->_visa.dixi('d', 13); + } else + _vm->_scrolls.display("You're already awake, Avvy!"); break; case _vm->_gyro.payles: - if (! _vm->_gyro.dna.ayles_is_awake) _vm->_scrolls.display("You can't seem to wake _vm->_gyro.him by yourself."); + if (!_vm->_gyro.dna.ayles_is_awake) + _vm->_scrolls.display("You can't seem to wake _vm->_gyro.him by yourself."); break; case _vm->_gyro.pjacques: _vm->_scrolls.display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + @@ -1564,59 +1587,49 @@ void Acci::do_that() { _vm->_scrolls.display("Hey, a verb would be helpful!"); break; - case vb_hello: { + case vb_hello: person_speaks(); _vm->_scrolls.display("Hello.\2"); - } - break; - case vb_thanks: { + break; + case vb_thanks: person_speaks(); _vm->_scrolls.display("That's OK.\2"); - } - break; + break; default: _vm->_scrolls.display(Common::String('\7') + "Parser bug!"); } - } } void Acci::verbopt(char n, Common::String &answer, char &anskey) { switch (n) { - case vb_exam: { + case vb_exam: answer = "Examine"; anskey = 'x'; - } - break; /* the ubiqutous one */ - /* vb_give isn't dealt with by this procedure, but by ddm__with */ - case vb_drink: { + break; /* the ubiqutous one */ + /* vb_give isn't dealt with by this procedure, but by ddm__with */ + case vb_drink: answer = "Drink"; anskey = 'D'; - } - break; - case vb_wear: { + break; + case vb_wear: answer = "Wear"; anskey = 'W'; - } - break; - case vb_ring: { + break; + case vb_ring: answer = "Ring"; anskey = 'R'; - } - break; /* only the bell! */ - case vb_play: { + break; /* only the bell! */ + case vb_play: answer = "Play"; anskey = 'P'; - } - break; - case vb_eat: { + break; + case vb_eat: answer = "Eat"; anskey = 'E'; - } - break; - default: { + break; + default: answer = "? Unknown!"; /* Bug! */ anskey = '?'; - } } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 240c7b68ae63..62cb5fbe99d9 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -251,7 +251,7 @@ namespace Avalanche { zoomy = false; // Call the menu by default. Might be modified later, if get_slope() gets implemented, // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. - if (! zoomy) + if (!zoomy) call_menu(); /* Not run when zoomy. */ do { diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 4296f36f7002..c02a82f6f022 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -61,7 +61,7 @@ void Celer::pics_link() { case r__outsideargentpub: if ((_vm->_gyro.roomtime % int32(12)) == 0) show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); - break; + break; case r__brummieroad: if ((_vm->_gyro.roomtime % int32(2)) == 0) @@ -74,7 +74,7 @@ void Celer::pics_link() { break; case r__yours: - if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) + if ((!_vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); break; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index c247012256f6..c86660e46ea0 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -493,7 +493,7 @@ void Gyro::background(byte x) { void Gyro::hang_around_for_a_while() { byte fv; - for (fv = 1; fv <= 28; fv ++) + for (fv = 1; fv <= 28; fv++) slowdown(); } diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index 08981f5d20a2..c709e686e9e9 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -82,13 +82,12 @@ void Logger::setParent(AvalancheEngine *vm) { void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ byte fv; - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); - fv ++) - output << logfile << ' ';*/ + /*for (fv = 1; fv <= size - (x / 2); fv++) + output << logfile << ' ';*/ } void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ @@ -101,43 +100,48 @@ void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ log_epson = printing; logging = true; - if (! printing) { - quote = '"'; - unquote = '"'; - copyright = "(c)"; + if (!printing) { + quote = '"'; + unquote = '"'; + copyright = "(c)"; }*/ } void Logger::log_divider() { /* Prints the divider sign. */ byte fv; - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_divider()"); - /*if (_vm->_gyro.log_epson) { - output << logfile << Common::String(' ') + double_width; - for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' '; - output << logfile << Common::String(' ') + double_off; - } else - for (fv = 1; fv <= 36; fv ++) output << logfile << ' '; - output << logfile << divide << NL;*/ + /* + if (_vm->_gyro.log_epson) { + output << logfile << Common::String(' ') + double_width; + for (fv = 1; fv <= divide_indent; fv++) + output << logfile << ' '; + output << logfile << Common::String(' ') + double_off; + } else { + for (fv = 1; fv <= 36; fv++) + output << logfile << ' '; + } + output << logfile << divide << NL; + */ } void Logger::log_command(Common::String x) { /* Prints a command */ - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_command()"); /*if (_vm->_gyro.log_epson) - output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; + output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; else - output << logfile << Common::String("> ") + x << NL;*/ + output << logfile << Common::String("> ") + x << NL;*/ } void Logger::log_addstuff(Common::String x) { - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; scroll_line += x; @@ -145,7 +149,7 @@ void Logger::log_addstuff(Common::String x) { void Logger::log_scrollchar(Common::String x) { /* print one character */ Common::String z; - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; switch (x[1]) { @@ -166,7 +170,7 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */ } void Logger::log_italic() { - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_italic()"); @@ -178,7 +182,7 @@ void Logger::log_italic() { } void Logger::log_roman() { - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_roman()"); @@ -190,7 +194,7 @@ void Logger::log_roman() { } void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_epsonroman()"); @@ -206,29 +210,32 @@ void Logger::log_scrollline() { /* Set up a line for the scroll driver */ void Logger::log_scrollendline(bool centred) { byte x, fv; - if (! _vm->_gyro.logging) return; + if (!_vm->_gyro.logging) + return; x = 17; - if (centred) x += (50 - scroll_line_length) / 2; + if (centred) + x += (50 - scroll_line_length) / 2; warning("STUB: Logger::log_scrollendline()"); - /*for (fv = 1; fv <= x; fv ++) + /*for (fv = 1; fv <= x; fv++) output << logfile << ' '; output << logfile << scroll_line << NL;*/ } void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { byte fv; - if (! _vm->_gyro.logging) return; + if (!_vm->_gyro.logging) + return; warning("STUB: Logger::log_bubbleline()"); /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv ++) + for (fv = 1; fv <= 15; fv++) output << logfile << ' '; output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; } else { - for (fv = 1; fv <= 17; fv ++) + for (fv = 1; fv <= 17; fv++) output << logfile << ' '; output << logfile << x << NL; }*/ @@ -243,11 +250,12 @@ void Logger::log_newline() { void Logger::log_newroom(Common::String where) { byte fv; - if (! _vm->_gyro.logging) return; + if (!_vm->_gyro.logging) + return; warning("STUB: Logger::log_newroom()"); - /*for (fv = 1; fv <= 20; fv ++) + /*for (fv = 1; fv <= 20; fv++) output << logfile << ' '; if (_vm->_gyro.log_epson) output << logfile << emph_on; @@ -259,7 +267,7 @@ void Logger::log_newroom(Common::String where) { void Logger::log_aside(Common::String what) { /* This writes "asides" to the printer. For example, moves in Nim. */ - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_aside()"); @@ -270,12 +278,12 @@ void Logger::log_aside(Common::String what) { void Logger::log_score(uint16 credit, uint16 now) { byte fv; - if (! _vm->_gyro.logging) + if (!_vm->_gyro.logging) return; warning("STUB: Logger::log_score()"); - /*for (fv = 1; fv <= 50; fv ++) + /*for (fv = 1; fv <= 50; fv++) output << logfile << ' '; output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index aeb952c4a523..74b7158afce8 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -83,7 +83,7 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ _vm->_gyro.super_off(); - /* for (page_ = 0; page_ <= 1; page_ ++) { + /* for (page_ = 0; page_ <= 1; page_++) { setactivepage(page_); bar(419, 195, 438, 197); }*/ @@ -98,8 +98,8 @@ void Scrolls::easteregg() { warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); /* background(15); - for (fv = 4; fv <= 100; fv ++) { - for (ff = 0; ff <= 70; ff ++) { + for (fv = 4; fv <= 100; fv++) { + for (ff = 0; ff <= 70; ff++) { sound(fv * 100 + ff * 10); delay(1); } @@ -128,23 +128,22 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit ox = 0; _vm->_logger.log_scrollline(); - for (xx = 1; xx <= lz; xx ++) { + for (xx = 1; xx <= lz; xx++) { switch (z[xx]) { - case '\22': { + case '\22': cfont = roman; _vm->_logger.log_roman(); - } - break; - case '\6': { + break; + case '\6': cfont = italic; _vm->_logger.log_italic(); - } - break; - default: { + break; + default: ox += 1; - for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; + for (yy = 1; yy <= 12; yy++) + itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; _vm->_logger.log_scrollchar(Common::String(z[xx])); - } + break; } } @@ -152,10 +151,10 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit if (offset) { /* offsetting routine */ lz += 1; - for (yy = 1; yy <= 12; yy ++) { + for (yy = 1; yy <= 12; yy++) { bit = 240; itw[yy][lz] = 255; - for (xx = 1; xx <= lz; xx ++) { + for (xx = 1; xx <= lz; xx++) { t = itw[yy][xx]; itw[yy][xx] = bit + t / 16; bit = t << 4; @@ -163,9 +162,9 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit } } yp = x + y * 80 + (1 - _vm->_gyro.cp) * _vm->_gyro.pagetop; - for (yy = 1; yy <= 12; yy ++) { + for (yy = 1; yy <= 12; yy++) { yp += 80; - for (bit = 0; bit <= locol; bit ++) { + for (bit = 0; bit <= locol; bit++) { /*port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -190,23 +189,18 @@ void Scrolls::dialogue() { warning("STUB: Scrolls::dialogue()"); } - - - void Scrolls::store_(byte what, tunetype &played) { memcpy(played, played+1, sizeof(played) - 1); played[30] = what; } - - bool Scrolls::they_match(tunetype &played) { byte fv, mistakes; bool they_match_result; mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv ++) + for (fv = 1; fv <= sizeof(played); fv++) if (played[fv] != Gyro::tune[fv]) mistakes++; @@ -243,13 +237,4 @@ void Scrolls::music_scroll() { } - - - - - - - - - } // End of namespace Avalanche diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 38d46d86c9d8..f3ba72ad62d6 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -55,11 +55,12 @@ void Sequence::first_show(byte what) { void Sequence::then_show(byte what) { byte fv; - for (fv = 1; fv <= seq_length; fv ++) + for (fv = 1; fv <= seq_length; fv++) { if (seq[fv] == 0) { seq[fv] = what; return; } + } } void Sequence::then_flip(byte where, byte ped) { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 6bdfcde1f816..623bb75e30c9 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -76,7 +76,7 @@ void Timeout::one_tick() { if (_vm->_gyro.ddmnow) return; - for (fv = 1; fv <= 7; fv ++) { + for (fv = 1; fv <= 7; fv++) { timetype &with = times[fv]; if (with.time_left > 0) { with.time_left -= 1; @@ -217,7 +217,7 @@ void Timeout::one_tick() { void Timeout::lose_timer(byte which) { byte fv; - for (fv = 1; fv <= 7; fv ++) { + for (fv = 1; fv <= 7; fv++) { timetype &with = times[fv]; if (with.what_for == which) with.time_left = 0; @@ -240,7 +240,7 @@ end;*/ /* Timeout procedures: */ void Timeout::open_drawbridge() { - _vm->_gyro.dna.drawbridge_open ++; + _vm->_gyro.dna.drawbridge_open++; _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); if (_vm->_gyro.dna.drawbridge_open == 4) @@ -253,7 +253,7 @@ void Timeout::open_drawbridge() { void Timeout::avaricius_talks() { _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); - _vm->_gyro.dna.avaricius_talk ++; + _vm->_gyro.dna.avaricius_talk++; if (_vm->_gyro.dna.avaricius_talk < 17) set_up_timer(177, procavaricius_talks, reason_avariciustalks); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 7591c5c032c3..151e93f44498 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -85,7 +85,7 @@ bool triptype::collision_check() { byte fv; bool collision_check_result = false; - for (fv = 1; fv <= _tr->numtr; fv ++) { + for (fv = 1; fv <= _tr->numtr; fv++) { if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + a.xl) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && @@ -93,7 +93,8 @@ bool triptype::collision_check() { collision_check_result = true; break; } - // CHECKME: Only checks the first element of the for() statement + // CHECKME: Only checks the first element of the for() statement. + // Both lines should certainly be removed collision_check_result = false; return collision_check_result; } @@ -276,8 +277,8 @@ triptype *triptype::done() { xw = with.xl / 8; if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { - totalnum --; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa++) { + totalnum--; free(mani[totalnum]); free(sil[totalnum]); /* <<- Width of a siltype. */ } @@ -293,14 +294,14 @@ getsettype *getsettype::init() { } void getsettype::remember(bytefield r) { - numleft ++; + numleft++; warning("STUB: _vm->_timeout.getsettype::remember()"); gs[numleft] = r; } void getsettype::recall(bytefield &r) { r = gs[numleft]; - numleft --; + numleft--; } Trip::Trip() { @@ -396,7 +397,7 @@ void Trip::catamove(byte ped) { return; } - if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) + if (!_vm->_gyro.dna.enter_catacombs_from_lusties_room) _vm->_lucerna.load(29); here = _vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x]; @@ -531,7 +532,8 @@ void Trip::catamove(byte ped) { if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows)) _vm->_gyro.magics[13].op = _vm->_gyro.exclaim; - else _vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */ + else + _vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */ _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[12].op = _vm->_gyro.bounces; @@ -637,13 +639,13 @@ void Trip::catamove(byte ped) { _vm->_celer.show_one(2); break; /* [5,7] : "Ite Mingite" sign. */ case 258: - for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */ + for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ _vm->_celer.show_one_at(15, 130 + fv * 120, 70); _vm->_celer.show_one_at(16, 184 + fv * 120, 78); } break; case 1287: - for (fv = 10; fv <= 13; fv ++) + for (fv = 10; fv <= 13; fv++) _vm->_celer.show_one(fv); break; /* [7,5] : 4 candles. */ case 776: @@ -661,7 +663,7 @@ void Trip::catamove(byte ped) { if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) { triptype &with = tr[2]; - if (! with.quick) /* If we don't already have her... */ + if (!with.quick) /* If we don't already have her... */ tr[2].init(5, true, this); /* ...Load Geida. */ apped(2, geida_ped(ped)); tr[2].call_eachstep = true; @@ -699,7 +701,7 @@ void Trip::call_special(uint16 which) { case 3: /* _vm->_gyro.special 3: Room 71: triggers dart. */ tr[1].bounce(); /* Must include that. */ - if (! _vm->_gyro.dna.arrow_triggered) { + if (!_vm->_gyro.dna.arrow_triggered) { _vm->_gyro.dna.arrow_triggered = true; apped(2, 4); /* The dart starts at ped 4, and... */ tr[2].walkto(5); /* flies to ped 5. */ @@ -754,7 +756,7 @@ void Trip::call_special(uint16 which) { _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); break; case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */ - if ((_vm->_gyro.dna.geida_follows) && (! _vm->_gyro.dna.lustie_is_asleep)) { + if ((_vm->_gyro.dna.geida_follows) && (!_vm->_gyro.dna.lustie_is_asleep)) { _vm->_visa.dixi('q', 63); tr[2].turn(down); tr[2].stopwalk(); @@ -763,7 +765,7 @@ void Trip::call_special(uint16 which) { } break; case 9: /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ - if (! _vm->_gyro.dna.geida_follows) + if (!_vm->_gyro.dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ tr[2].walkto(4); /* She walks to somewhere... */ @@ -960,18 +962,24 @@ void Trip::getback() { while (getset[1 - _vm->_gyro.cp].numleft > 0) { getset[1 - _vm->_gyro.cp].recall(r); - /* if overlaps_with_mouse and not endangered then + /* + if overlaps_with_mouse and not endangered then begin endangered:=true; blitfix; Super_Off; - end;*/ + end; + */ _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); } _vm->_lucerna.blitfix(); - /*if endangered then*/ /*Super_On;*/ + + /* + if endangered then + Super_On; + */ } /* Eachstep procedures: */ @@ -997,7 +1005,7 @@ void Trip::follow_avvy_y(byte tripnum) { } void Trip::back_and_forth(byte tripnum) { - if (! tr[tripnum].homing) { + if (!tr[tripnum].homing) { if (tr[tripnum].face == right) tr[tripnum].walkto(4); else @@ -1006,7 +1014,7 @@ void Trip::back_and_forth(byte tripnum) { } void Trip::face_avvy(byte tripnum) { - if (! tr[tripnum].homing) { + if (!tr[tripnum].homing) { if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; else @@ -1165,14 +1173,14 @@ void Trip::call_andexors() { for (int i = 0; i < 5; i++) order[i] = 0; - for (fv = 1; fv <= numtr; fv ++) { + for (fv = 1; fv <= numtr; fv++) { if (tr[fv].quick && tr[fv].visible) order[fv] = fv; } do { ok = true; - for (fv = 1; fv <= 4; fv ++) { + for (fv = 1; fv <= 4; fv++) { if (((order[fv] != 0) && (order[fv + 1] != 0)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { /* Swap them! */ @@ -1184,7 +1192,7 @@ void Trip::call_andexors() { } } while (!ok); - for (fv = 1; fv <= 5; fv ++) { + for (fv = 1; fv <= 5; fv++) { if (order[fv] > 0) tr[order[fv]].andexor(); } @@ -1195,13 +1203,13 @@ void Trip::trippancy_link() { if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) return; - for (fv = 1; fv <= numtr; fv ++) { + for (fv = 1; fv <= numtr; fv++) { if (tr[fv].quick) tr[fv].walk(); } call_andexors(); - for (fv = 1; fv <= numtr; fv ++) { + for (fv = 1; fv <= numtr; fv++) { triptype &with = tr[fv]; if (with.quick && with.call_eachstep) { switch (tr[fv].eachstep) { @@ -1237,9 +1245,11 @@ void Trip::get_back_loretta() { byte fv; /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ - for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { - getback(); - return; + for (fv = 1; fv <= numtr; fv++) { + if (tr[fv].quick) { + getback(); + return; + } } /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ } @@ -1252,7 +1262,7 @@ void Trip::stopwalking() { } void Trip::tripkey(char dir) { - if ((_vm->_gyro.ctrl == cjoy) | (! _vm->_gyro.dna.user_moves_avvy)) + if ((_vm->_gyro.ctrl == cjoy) | (!_vm->_gyro.dna.user_moves_avvy)) return; triptype &with = tr[1]; @@ -1325,7 +1335,7 @@ void Trip::readstick() { } void Trip::getsetclear() { - for (byte fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv++) getset[fv].init(); } @@ -1370,7 +1380,7 @@ void Trip::tidy_after_mouse() { void Trip::fliproom(byte room, byte ped) { byte fv; - if (! _vm->_gyro.alive) { + if (!_vm->_gyro.alive) { /* You can't leave the room if you're dead. */ tr[1].ix = 0; tr[1].iy = 0; /* Stop him from moving. */ @@ -1397,7 +1407,7 @@ void Trip::fliproom(byte room, byte ped) { getsetclear(); - for (fv = 2; fv <= numtr; fv ++) { + for (fv = 2; fv <= numtr; fv++) { if (tr[fv].quick) tr[fv].done(); } /* Deallocate sprite */ @@ -1412,7 +1422,7 @@ void Trip::fliproom(byte room, byte ped) { _vm->_gyro.dna.rw = tr[1].face; _vm->_lucerna.showrw(); - for (fv = 0; fv <= 1; fv ++) { + for (fv = 0; fv <= 1; fv++) { _vm->_gyro.cp = 1 - _vm->_gyro.cp; getback(); } @@ -1447,7 +1457,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ uy = tr[1].y + tr[1].a.yl; nd = false; - for (fv = 9; fv <= _vm->_gyro.numfields; fv ++) { + for (fv = 9; fv <= _vm->_gyro.numfields; fv++) { _vm->_gyro.fields[fv]; if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2) From 5e2ec5102524c87afdd7030e02db31b13be08acf Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 1 Jul 2013 15:21:51 +0200 Subject: [PATCH 0067/1332] AVALANCHE: Add Basher. --- engines/avalanche/avalanche.cpp | 5 +- engines/avalanche/avalanche.h | 2 + engines/avalanche/basher2.cpp | 167 ++++++++++++++++++++++++++++++++ engines/avalanche/basher2.h | 91 +++++++++++++++++ 4 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 engines/avalanche/basher2.cpp create mode 100644 engines/avalanche/basher2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 62cb5fbe99d9..fcf2f545fbb7 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -54,13 +54,14 @@ namespace Avalanche { _pingo.setParent(this); _scrolls.setParent(this); _visa.setParent(this); - _lucerna.setParent(this); + _lucerna.setParent(this); _lucerna.init(); _enid.setParent(this); _celer.setParent(this); _sequence.setParent(this); _timeout.setParent(this); _trip.setParent(this); - _acci.setParent(this); + _acci.setParent(this); _acci.init(); + _basher.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 5fa0fa926894..23648329fbd8 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -44,6 +44,7 @@ #include "avalanche/timeout2.h" #include "avalanche/trip6.h" #include "avalanche/acci2.h" +#include "avalanche/basher2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -74,6 +75,7 @@ class AvalancheEngine : public Engine { Timeout _timeout; Trip _trip; Acci _acci; + Basher _basher; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp new file mode 100644 index 000000000000..61ad226495ce --- /dev/null +++ b/engines/avalanche/basher2.cpp @@ -0,0 +1,167 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* BASHER Handles the keyboard. */ + +// Note: this unit can record keystrokes, for the demo. If you want it +// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will +// cause them to be played back. + +#include "avalanche/avalanche.h" + +#include "avalanche/basher2.h" +#include "avalanche/enhanced2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/acci2.h" +#include "avalanche/trip6.h" +#include "avalanche/pingo2.h" +#include "avalanche/dropdown2.h" +#include "avalanche/logger2.h" +#include "avalanche/enid2.h" +//#include "Sticks.h" - Responsible for the joystick + +#include "common/textconsole.h" + +namespace Avalanche { + +Basher::Basher() { + warning("STUB: Basher::Basher()"); +} + +void Basher::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Basher::plottext() { + warning("STUB: Basher::plottext()"); +} + +void Basher::wipetext() { + warning("STUB: Basher::wipetext()"); +} + +/*procedure cursor; +begin + if curflash=0 then + begin + if mouse_near_text then Super_Off; + cursoron:=not cursoron; + mem[$A000*13442+curpos]:=not mem[$A000*13442+curpos]; + mem[$A000*pagetop+13442+curpos]:=not mem[$A000*pagetop+13442+curpos]; + curflash:=17; + Super_On; + end else dec(curflash); +end;*/ + +void Basher::do_cursor() { + warning("STUB: Basher::do_cursor()"); +} + +void Basher::cursor_on() { + warning("STUB: Basher::cursor_on()"); +} + +void Basher::cursor_off() { + warning("STUB: Basher::cursor_off()"); +} + + +void Basher::get_demorec() { + warning("STUB: Basher::get_demorec()"); +} + +#ifdef RECORD +void Basher::record_one() { + warning("STUB: Basher::record_one()"); +} +#endif +/* +procedure storeline(whatwhat:string); +var + fv:byte; + what:string[77]; + ok:boolean; + + function upline(x:string):string; + var fv:byte; n:string[77]; + begin + for fv:=1 to length(x) do n[fv]:=upcase(x[fv]); + n[0]:=x[0]; upline:=n; + end; +begin + + what:=upline(whatwhat); ok:=false; + for fv:=1 to 20 do + if what=upline(previous^[fv]) then + begin { it already exists, in string "fv" } + move(previous^[fv+1],previous^[fv],(20-fv)*78); + previous^[20]:=whatwhat; ok:=true; + end; + if ok then exit; + { it's not on the list, so add it } + move(previous^[2],previous^[1],1482); { shove up } + previous^[20]:=whatwhat; +end; +*/ + + +char Basher::firstchar(Common::String x) { + warning("STUB: Basher::firstchar()"); + return 'S'; +} + + +void Basher::try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */ + warning("STUB: Basher::try_dd()"); +} + +void Basher::typein() { + warning("STUB: Basher::typein()"); +} + +/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; + '': begin setvisualpage(0); write(#7); inkey; end;*/ + +void Basher::keyboard_link() { + warning("STUB: Basher::keyboard_link()"); +} + +bool Basher::demo_ready() { + warning("STUB: Basher::demo_ready()"); + return true; +} + +void Basher::filename_edit() { + warning("STUB: Basher::filename_edit()"); +} + +void Basher::normal_edit() { + warning("STUB: Basher::normal_edit()"); +} + +} // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h new file mode 100644 index 000000000000..326ea93dc5a0 --- /dev/null +++ b/engines/avalanche/basher2.h @@ -0,0 +1,91 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* BASHER Handles the keyboard. */ + +// Note: this unit can record keystrokes, for the demo. If you want it +// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will +// cause them to be played back. + +#ifndef BASHER2_H +#define BASHER2_H + +#include "common/scummsys.h" + +namespace Avalanche { +class AvalancheEngine; + +class Basher { +public: + uint16 count; + + + + Basher(); + + void setParent(AvalancheEngine *vm); + + void plottext(); + + void keyboard_link(); + + void cursor_on(); + + void get_demorec(); + + bool demo_ready(); + + void cursor_off(); + + void filename_edit(); + + void normal_edit(); + +#ifdef RECORD + void record_one(); +#endif + +private: + AvalancheEngine *_vm; + + bool entering_filename; + byte left_margin; + + void wipetext(); + + void do_cursor(); + + char firstchar(Common::String x); + + void try_dd(); + + void typein(); +}; + +} // End of namespace Avalanche. + +#endif // BASHER2_H From 8aa251722f97dab34b3d5fd0133f63403d6baa1a Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 1 Jul 2013 18:14:48 +0200 Subject: [PATCH 0068/1332] AVALANCHE: Add Dropdown. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/dropdown2.cpp | 689 ++++++++++++++++++++++++++++++++ engines/avalanche/dropdown2.h | 205 ++++++++++ 4 files changed, 897 insertions(+) create mode 100644 engines/avalanche/dropdown2.cpp create mode 100644 engines/avalanche/dropdown2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index fcf2f545fbb7..eade42bbc6e2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -62,6 +62,7 @@ namespace Avalanche { _trip.setParent(this); _acci.setParent(this); _acci.init(); _basher.setParent(this); + _dropdown.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 23648329fbd8..46ceeba79f26 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -45,6 +45,7 @@ #include "avalanche/trip6.h" #include "avalanche/acci2.h" #include "avalanche/basher2.h" +#include "avalanche/dropdown2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -76,6 +77,7 @@ class AvalancheEngine : public Engine { Trip _trip; Acci _acci; Basher _basher; + Dropdown _dropdown; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp new file mode 100644 index 000000000000..d0d90056d02c --- /dev/null +++ b/engines/avalanche/dropdown2.cpp @@ -0,0 +1,689 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + + /* DROPDOWN A customised version of Oopmenu (qv). */ + +#include "avalanche/avalanche.h" + +#include "avalanche/dropdown2.h" + +#include "avalanche/lucerna2.h" +#include "avalanche/gyro2.h" +#include "avalanche/acci2.h" +#include "avalanche/trip6.h" +#include "avalanche/enid2.h" +#include "avalanche/basher2.h" + +#include "common/textconsole.h" + +namespace Avalanche { + +headtype *headtype::init(char trig, char alttrig, Common::String name, byte p, func dw, func dc, Dropdown *dr) { + _dr = dr; + + trigger = trig; + alttrigger = alttrig; + title = name; + position = p; + xpos = (position - 1) * _dr->spacing + _dr->indent; + xright = position * _dr->spacing + _dr->indent; + do_setup = dw; + do_choose = dc; + + return this; +} + +void headtype::display() { + _dr->_vm->_gyro.off(); /*MT*/ + _dr->chalk(xpos, 1, trigger, title, true); + _dr->_vm->_gyro.on(); /*MT*/ +} + +void headtype::highlight() { + _dr->_vm->_gyro.off(); + _dr->_vm->_gyro.off_virtual(); + + //nosound(); + //setactivepage(cp); + warning("STUB: Dropdown::headytpe::highlight()"); + + _dr->hlchalk(xpos, 1, trigger, title, true); + { + _dr->ddm_o.left = xpos; + _dr->ddm_o.menunow = true; + _dr->_vm->_gyro.ddmnow = true; + _dr->ddm_o.menunum = position; + } + _dr->_vm->_gyro.cmp = 177; /* Force redraw of cursor. */ +} + +bool headtype::extdparse(char c) { + if (c != alttrigger) + return true; + return false; +} + + + + + + +onemenu *onemenu::init(Dropdown *dr) { + _dr = dr; + menunow = false; + _dr->_vm->_gyro.ddmnow = false; + menunum = 1; + return this; +} + +void onemenu::start_afresh() { + number = 0; + width = 0; + firstlix = false; + oldy = 0; + highlightnum = 0; +} + +void onemenu::opt(Common::String n, char tr, Common::String key, bool val) { + int16 l; + number += 1; + l = (n + key).size() + 3; + if (width < l) width = l; + { + optiontype &with = oo[number]; + with.title = n; + with.trigger = tr; + with.shortcut = key; + with.valid = val; + } +} + +void onemenu::displayopt(byte y, bool highlit) { + warning("STUB: Dropdown::onemenu::displayopt()"); +} + +void onemenu::display() { + warning("STUB: Dropdown::onemenu::display()"); +} + +void onemenu::wipe() { + warning("STUB: Dropdown::onemenu::wipe()"); +} + +void onemenu::movehighlight(int8 add) { + warning("STUB: Dropdown::onemenu::movehighlight()"); +} + +void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ + if ((_dr->_vm->_gyro.mx < flx1 * 8) || (_dr->_vm->_gyro.mx > flx2 * 8) || + (_dr->_vm->_gyro.my <= 12) || (_dr->_vm->_gyro.my > fly - 3)) + return; + highlightnum = (_dr->_vm->_gyro.my - 13) / 10; + if (highlightnum == oldy) return; + movehighlight(0); + +} + +void onemenu::select(byte n) { /* Choose which one you want. */ + if (! oo[n + 1].valid) return; + choicenum = n; + wipe(); + + if (choicenum == number) choicenum -= 1; /* Off the bottom. */ + if (choicenum > number) choicenum = 0; /* Off the top, I suppose. */ + + _dr->ddm_m.ddms[menunum].do_choose; +} + +void onemenu::keystroke(char c) { + byte fv; + bool found; + c = toupper(c); + found = false; + for (fv = 1; fv <= number; fv ++) { + if ((toupper(oo[fv].trigger) == c) && oo[fv].valid) { + select(fv - 1); + found = true; + } + } + if (! found) + _dr->_vm->_gyro.blip(); +} + + + + + +menuset *menuset::init(Dropdown *dr) { + _dr = dr; + howmany = 0; + return this; +} + +void menuset::create(char t, Common::String n, char alttrig, func dw, func dc) { + howmany ++; + ddms[howmany].init(t, alttrig, n, howmany, dw, dc, _dr); +} + +void menuset::update() { + warning("STUB: Dropdown::menuset::update()"); +} + +void menuset::extd(char c) { + byte fv; + fv = 1; + while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; + if (fv > howmany) return; + getcertain(fv); +} + +void menuset::getcertain(byte fv) { + { + if (_dr->ddm_o.menunow) { + _dr->ddm_o.wipe(); /* get rid of menu */ + if (_dr->ddm_o.menunum == ddms[fv].position) return; /* clicked on own highlight */ + } + ddms[fv].highlight(); + ddms[fv].do_setup; + } +} + +void menuset::getmenu(int16 x) { + byte fv; + fv = 0; + do { + fv += 1; + if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { + getcertain(fv); + return; + } + } while (!(fv > howmany)); +} + + + + + +void Dropdown::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Dropdown::find_what_you_can_do_with_it() { + switch (_vm->_gyro.thinks) { + case _vm->_gyro.wine: + case _vm->_gyro.potion: + case _vm->_gyro.ink: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_drink; + break; + case _vm->_gyro.bell: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_ring; + break; + case _vm->_gyro.chastity: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + break; + case _vm->_gyro.lute: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_play; + break; + case _vm->_gyro.mushroom: + case _vm->_gyro.onion: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_eat; + break; + case _vm->_gyro.clothes: + _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + break; + default: + _vm->_gyro.verbstr = _vm->_acci.vb_exam; /* anything else */ + } +} + +void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { + byte fv, ff, p, bit; + uint16 pageseg; + byte ander; + + warning("STUB: Dropdown::chalk()"); +} + +void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { +/* Highlighted. */ + byte fv, ff, p; + uint16 pageseg; + byte ander; + + warning("STUB: Dropdown::hlchalk()"); +} + +/*funcedure say(x,y:int16; t:char; z:Common::String; f,b:byte); +begin; + settextjustify(0,2); setfillstyle(1,b); setcolor(f); + bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)); + chalk(x,y,t,z); +end;*/ + +void Dropdown::bleep() { + warning("STUB: Dropdown::bleep()"); +} + +void Dropdown::parsekey(char r, char re) { + switch (r) { + case 0: + case 224: { + switch (re) { + case 'K': + if (ddm_o.menunum > 1) { + ddm_o.wipe(); + ddm_m.getcertain(ddm_o.menunum - 1); + } else { + ; /* Get menu on the left-hand side */ + ddm_o.wipe(); + ddm_m.getmenu((ddm_m.howmany - 1)*spacing + indent); + } + break; + case 'M': + if (ddm_o.menunum < ddm_m.howmany) { + ddm_o.wipe(); + ddm_m.getcertain(ddm_o.menunum + 1); + } else { + ; /* Get menu on the far right-hand side */ + ddm_o.wipe(); + ddm_m.getmenu(indent); + } + break; + case 'H': + ddm_o.movehighlight(-1); + break; + case 'P': + ddm_o.movehighlight(1); + break; + default: + ddm_m.extd(re); + } + } + break; + case 13: + ddm_o.select(ddm_o.highlightnum); + break; + default: { + if (ddm_o.menunow) + ddm_o.keystroke(r); + } + } +} + +/*$F+ *** Here follow all the ddm__ and do__ funcedures for the DDM system. */ + +void Dropdown::ddm__game() { + { + ddm_o.start_afresh(); + ddm_o.opt("Help...", 'H', "f1", true); + ddm_o.opt("Boss Key", 'B', "alt-B", true); + ddm_o.opt("Untrash screen", 'U', "ctrl-f7", true); + ddm_o.opt("Score and rank", 'S', "f9", true); + ddm_o.opt("About Avvy...", 'A', "shift-f10", true); + ddm_o.display(); + } +} + +void Dropdown::ddm__file() { + { + ddm_o.start_afresh(); + ddm_o.opt("New game", 'N', "f4", true); + ddm_o.opt("Load...", 'L', "^f3", true); + ddm_o.opt("Save", 'S', "^f2", _vm->_gyro.alive); + ddm_o.opt("Save As...", 'v', "", _vm->_gyro.alive); + ddm_o.opt("DOS Shell", 'D', _vm->_gyro.atkey + '1', true); + ddm_o.opt("Quit", 'Q', "alt-X", true); + ddm_o.display(); + } +} + +void Dropdown::ddm__action() { + Common::String n; + n = Common::String(_vm->_gyro.f5_does().c_str() + 2, 253); + + { + ddm_o.start_afresh(); + if (n == "") + ddm_o.opt("Do something", 'D', "f5", false); + else + ddm_o.opt(Common::String(n.c_str() + 2, 253), n[1], "f5", true); + ddm_o.opt("Pause game", 'P', "f6", true); + if (_vm->_gyro.dna.room == 99) + ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip.neardoor()); + else + ddm_o.opt("Open the door", 'O', "f7", _vm->_trip.neardoor()); + ddm_o.opt("Look around", 'L', "f8", true); + ddm_o.opt("Inventory", 'I', "Tab", true); + if (_vm->_trip.tr[1].xs == _vm->_gyro.walk) + ddm_o.opt("Run fast", 'R', "^R", true); + else + ddm_o.opt("Walk slowly", 'W', "^W", true); + ddm_o.display(); + } +} + +void Dropdown::ddm__people() { + byte here; + char fv; + + people = ""; + here = _vm->_gyro.dna.room; + + { + ddm_o.start_afresh(); + for (fv = '\226'; fv <= '\262'; fv ++) + if (_vm->_gyro.whereis[fv] == here) { + ddm_o.opt(_vm->_gyro.getname(fv), _vm->_gyro.getnamechar(fv), "", true); + people = people + fv; + } + ddm_o.display(); + } +} + +void Dropdown::ddm__objects() { + char fv; + { + ddm_o.start_afresh(); + for (fv = '\1'; fv <= numobjs; fv ++) + if (_vm->_gyro.dna.obj[fv]) + ddm_o.opt(_vm->_gyro.get_thing(fv), _vm->_gyro.get_thingchar(fv), "", true); + ddm_o.display(); + } +} + +Common::String Dropdown::himher(char x) { /* Returns "im" for boys, and "er" for girls.*/ + if (x < 175) + return "im"; + else + return "er"; +} + +void Dropdown::ddm__with() { + warning("STUB: Dropdown::ddm__with()"); +} + +/*funcedure ddm__map; +begin; + with ddm_o do + begin; + ddm_o.start_afresh; + opt('Cancel map','G','f5',true); + opt('Pause game','P','f6',true); + opt('Journey thither','J','f7',neardoor); + opt('Explanation','L','f8',true); + display; + end; +end; + +funcedure ddm__town; +begin; + with ddm_o do + begin; + ddm_o.start_afresh; + opt('Argent','A','',true); + opt('Birmingham','B','',true); + opt('Nottingham','N','',true); + opt('Cardiff','C','',true); + display; + end; +end;*/ + +void Dropdown::do__game() { + switch (ddm_o.choicenum) { + /* Help, boss, untrash screen. */ + case 0: + _vm->_lucerna.callverb(_vm->_acci.vb_help); + break; + case 1: + _vm->_lucerna.callverb(_vm->_acci.vb_boss); + break; + case 2: + _vm->_lucerna.major_redraw(); + break; + case 3: + _vm->_lucerna.callverb(_vm->_acci.vb_score); + break; + case 4: + _vm->_lucerna.callverb(_vm->_acci.vb_info); + break; + } +} + +void Dropdown::do__file() { + switch (ddm_o.choicenum) { + /* New game, load, save, save as, DOS shell, about, quit. */ + case 0: + _vm->_lucerna.callverb(_vm->_acci.vb_restart); + break; + case 1: { + _vm->_acci.realwords[2] = ""; + _vm->_lucerna.callverb(_vm->_acci.vb_load); + } + break; + case 2: { + _vm->_acci.realwords[2] = ""; + _vm->_lucerna.callverb(_vm->_acci.vb_save); + } + break; + case 3: + _vm->_basher.filename_edit(); + break; + case 4: + _vm->_enid.back_to_bootstrap(2); + break; + case 5: + _vm->_lucerna.callverb(_vm->_acci.vb_quit); + break; + } +} + +void Dropdown::do__action() { + Common::String n; + switch (ddm_o.choicenum) { + /* Get up/pause game/open door/look/inv/walk-run */ + case 0: { + _vm->_acci.person = _vm->_acci.pardon; + _vm->_acci.thing = _vm->_acci.pardon; + n = _vm->_gyro.f5_does(); + _vm->_lucerna.callverb(n[1]); + } + break; + case 1: + _vm->_lucerna.callverb(_vm->_acci.vb_pause); + break; + case 2: + _vm->_lucerna.callverb(_vm->_acci.vb_open); + break; + case 3: + _vm->_lucerna.callverb(_vm->_acci.vb_look); + break; + case 4: + _vm->_lucerna.callverb(_vm->_acci.vb_inv); + break; + case 5: { + if (_vm->_trip.tr[1].xs == _vm->_gyro.walk) _vm->_trip.tr[1].xs = _vm->_gyro.run; + else _vm->_trip.tr[1].xs = _vm->_gyro.walk; + _vm->_trip.newspeed(); + } + break; + } +} + +void Dropdown::do__objects() { + _vm->_lucerna.thinkabout(_vm->_gyro.objlist[ddm_o.choicenum + 1], _vm->_gyro.a_thing); +} + +void Dropdown::do__people() { + _vm->_lucerna.thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro.a_person); + _vm->_gyro.last_person = people[ddm_o.choicenum + 1]; +} + +void Dropdown::do__with() { + _vm->_acci.thing = _vm->_gyro.thinks; + + if (_vm->_gyro.thinkthing) { + + _vm->_acci.thing += 49; + + if (_vm->_gyro.verbstr[ddm_o.choicenum + 1] == _vm->_acci.vb_give) + _vm->_acci.person = _vm->_gyro.last_person; + else + _vm->_acci.person = '\376'; + + } else { + switch (_vm->_gyro.verbstr[ddm_o.choicenum + 1]) { + case '\144': { + _vm->_acci.thing = '\144'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Beer */ + case '\145': { + _vm->_acci.thing = '\62'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Wine */ + case '\146': { + _vm->_acci.thing = '\146'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Whisky */ + case '\147': { + _vm->_acci.thing = '\147'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Cider */ + case '\150': { + _vm->_acci.thing = '\153'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Mead */ + case '\151': { + _vm->_acci.thing = '\103'; + _vm->_lucerna.callverb(_vm->_acci.vb_buy); + return; + } + break; /* Onion (trader) */ + default: { + _vm->_acci.person = _vm->_acci.thing; + _vm->_acci.thing = '\376'; + } + } + } + _vm->_lucerna.callverb(_vm->_gyro.verbstr[ddm_o.choicenum + 1]); +} + +/*$F- That's all. Now for the ...bar funcs. */ + + +void Dropdown::standard_bar() { /* Standard menu bar */ + ddm_m.init(this); + ddm_o.init(this); + /* Set up menus */ + + ddm_m.create('F', "File", '!', &Avalanche::Dropdown::ddm__file, &Avalanche::Dropdown::do__file); /* same ones in map_bar, below, */ + ddm_m.create('G', "Game", '\42', &Avalanche::Dropdown::ddm__game, &Avalanche::Dropdown::do__game); /* Don't forget to change the */ + ddm_m.create('A', "Action", '\36', &Avalanche::Dropdown::ddm__action, &Avalanche::Dropdown::do__action); /* if you change them */ + ddm_m.create('O', "Objects", '\30', &Avalanche::Dropdown::ddm__objects, &Avalanche::Dropdown::do__objects); /* here... */ + ddm_m.create('P', "People", '\31', &Avalanche::Dropdown::ddm__people, &Avalanche::Dropdown::do__people); + ddm_m.create('W', "With", '\21', &Avalanche::Dropdown::ddm__with, &Avalanche::Dropdown::do__with); + ddm_m.update(); + +} + + + +/*funcedure map_bar; { Special menu bar for the map (screen 99) } +begin; + ddm_m.init; ddm_o.init; + with ddm_m do + begin; { Set up menus } + create('G','Game','#',ddm__game,do__game); + create('F','File','!',ddm__file,do__test); + create('M','Map','2',ddm__map,do__test); + create('T','Town',#20,ddm__town,do__test); + update; + end; +end;*/ + +void Dropdown::checkclick() { /* only for when the menu's displayed */ + if (_vm->_gyro.mpress > 0) { + if (_vm->_gyro.mpy > 10) { + if (!((ddm_o.firstlix) && + ((_vm->_gyro.mpx >= ddm_o.flx1 * 8) && (_vm->_gyro.mpx <= ddm_o.flx2 * 8) && + (_vm->_gyro.mpy >= 12) && (_vm->_gyro.mpy <= ddm_o.fly)))) { + /* Clicked OUTSIDE the menu. */ + if (ddm_o.menunow) + ddm_o.wipe(); + } /* No "else"- clicking on menu has no effect (only releasing) */ + } else { + /* Clicked on menu bar */ + ddm_m.getmenu(_vm->_gyro.mpx); + } + } else { + ; /* NOT clicked button... */ + if (_vm->_gyro.mrelease > 0) { + if ((ddm_o.firstlix) && + ((_vm->_gyro.mrx >= ddm_o.flx1 * 8) && (_vm->_gyro.mrx <= ddm_o.flx2 * 8) && + (_vm->_gyro.mry >= 12) && (_vm->_gyro.mry <= ddm_o.fly))) + ddm_o.select((_vm->_gyro.mry - 13) / 10); + } + } +} + +void Dropdown::menu_link() { + if (! ddm_o.menunow) return; + + _vm->_gyro.check(); /* find mouse coords & click information */ + checkclick(); /* work out click codes */ + + /* Change arrow... */ + + + if ((_vm->_gyro.my >= 0) && (_vm->_gyro.my <= 10)) + _vm->_gyro.newpointer(1); /* up-arrow */ + else if ((_vm->_gyro.my >= 11) && (_vm->_gyro.my <= 169)) { + if ((_vm->_gyro.mx >= ddm_o.flx1 * 8) && (_vm->_gyro.mx <= ddm_o.flx2 * 8) + && (_vm->_gyro.my > 10) && (_vm->_gyro.my <= ddm_o.fly)) + _vm->_gyro.newpointer(3); /* right-arrow */ + else + _vm->_gyro.newpointer(4); /* fletch */ + } else if ((_vm->_gyro.my >= 169) && (_vm->_gyro.my <= 200)) + _vm->_gyro.newpointer(2); /* screwdriver */ + + if (! ddm_o.menunow) + return; + + ddm_o.lightup(); +} + + +} // End of namespace Avalanche. diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h new file mode 100644 index 000000000000..abcc81b155a2 --- /dev/null +++ b/engines/avalanche/dropdown2.h @@ -0,0 +1,205 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* DROPDOWN A customised version of Oopmenu (qv). */ + +#ifndef DROPDOWN2_H +#define DROPDOWN2_H + +#include "avalanche/color.h" + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Avalanche { +class AvalancheEngine; + +class Dropdown; + +typedef void (Dropdown::*func)(); + +class headtype { +public: + Common::String title; + char trigger, alttrigger; + byte position; + int16 xpos, xright; + func do_setup, do_choose; + + headtype *init(char trig, char alttrig, Common::String name, byte p, func dw, func dc, Dropdown *dr); + void display(); + void highlight(); + bool extdparse(char c); + +private: + Dropdown *_dr; +}; + + + +struct optiontype { + Common::String title; + char trigger; + Common::String shortcut; + bool valid; +}; + +class onemenu { +public: + optiontype oo[12]; + byte number; + int16 width, left; + bool firstlix; + int16 flx1, flx2, fly; + byte oldy; /* used by Lightup */ + bool menunow; /* Is there a menu now? */ + byte menunum; /* And if so, which is it? */ + byte choicenum; /* Your choice? */ + byte highlightnum; + + onemenu *init(Dropdown *dr); + void start_afresh(); + void opt(Common::String n, char tr, Common::String key, bool val); + void display(); + void wipe(); + void lightup(); + void displayopt(byte y, bool highlit); + void movehighlight(int8 add); + void select(byte n); + void keystroke(char c); + +private: + Dropdown *_dr; +}; + + + +class menuset { +public: + headtype ddms[8]; + byte howmany; + + menuset *menuset::init(Dropdown *dr); + void create(char t, Common::String n, char alttrig, func dw, func dc); + void update(); + void extd(char c); + void getcertain(byte fv); + void getmenu(int16 x); + +private: + Dropdown *_dr; +}; + + + +class Dropdown { +public: + friend headtype; + friend onemenu; + friend menuset; + + void setParent(AvalancheEngine *vm); + + onemenu ddm_o; + menuset ddm_m; + + Common::String people; + + + + void find_what_you_can_do_with_it(); + + void parsekey(char r, char re); + + void menu_link(); /* DDM menu-bar funcs */ + + void standard_bar(); + +private: + + + + + + + AvalancheEngine *_vm; + + static const int16 indent = 5; + static const int16 spacing = 10; + + /* menu_b = blue; { Morpheus } + menu_f = yellow; + menu_border = black; + highlight_b = lightblue; + highlight_f = yellow; + disabled = lightgray; */ + + static const int16 menu_b = lightgray; /* Windowsy */ + static const int16 menu_f = black; + static const int16 menu_border = black; + static const int16 highlight_b = black; + static const int16 highlight_f = white; + static const int16 disabled = darkgray; + + + + char r; + byte fv; + + + + void chalk(int16 x, int16 y, char t, Common::String z, bool valid); + + void hlchalk(int16 x, int16 y, char t, Common::String z, bool valid); + + void bleep(); + + + + + void ddm__game(); + void ddm__file(); + void ddm__action(); + void ddm__people(); + void ddm__objects(); + void ddm__with(); + + Common::String himher(char x); + + void do__game(); + void do__file(); + void do__action(); + void do__objects(); + void do__people(); + void do__with(); + + void checkclick(); +}; + +} // End of namespace Avalanche. + +#endif // DROPDOWN2_H From 3fd8a182461155fce18d6f7ab781959ec465a89c Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 1 Jul 2013 23:57:56 +0200 Subject: [PATCH 0069/1332] AVALANCHE: Finish stubbing of Lucerna. Cosmetic change in Trip. --- engines/avalanche/lucerna2.cpp | 1006 +++++++++++++++++++++++++++++++- engines/avalanche/lucerna2.h | 41 ++ engines/avalanche/trip6.h | 13 - 3 files changed, 1037 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 344c273cdb7f..d34392324952 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -42,6 +42,7 @@ #include "avalanche/pingo2.h" #include "avalanche/sequence2.h" #include "avalanche/acci2.h" +#include "avalanche/roomnums.h" #include "common/system.h" @@ -51,26 +52,1011 @@ namespace Avalanche { -Lucerna::Lucerna() { - // Will be needed. -} +Lucerna::Lucerna() : fxhidden(false) {} void Lucerna::setParent(AvalancheEngine *vm) { _vm = vm; } + +void Lucerna::init() { + _vm->_gyro.oh = 17717; + _vm->_gyro.om = 17717; + if (_vm->_enhanced.atbios) _vm->_gyro.atkey = "f1"; + else _vm->_gyro.atkey = "alt-"; +} void Lucerna::callverb(char n) { - /*if (n == pardon) - Scrolls::display( - "The f5 key lets you do a particular action in certain " - "situations. However, at the moment there is nothing " - "assigned to it. You may press alt-A to see what the " - "current setting of this key is.");*/ + if (n == _vm->_acci.pardon) { + _vm->_scrolls.display(Common::String("The f5 key lets you do a particular action in certain ") + + "situations. However, at the moment there is nothing " + + "assigned to it. You may press alt-A to see what the " + + "current setting of this key is."); + } else { + _vm->_gyro.weirdword = false; + _vm->_acci.polite = true; + _vm->_acci.verb = n; + _vm->_acci.do_that(); + } +} + +void Lucerna::draw_also_lines() { + byte ff; + byte squeaky_code; + + warning("STUB: Lucerna::draw_also_lines()"); +} + + + + +Common::String Lucerna::nextstring() { + byte l; + Common::String x; + + + warning("STUB: Lucerna::nextstring()"); + + return "STUB: Lucerna::nextstring()"; +} + +void Lucerna::scram1(Common::String &x) { + byte fz; + for (fz = 1; fz <= x.size(); fz ++) + x.setChar(x[fz] ^ 177, fz); +} + +void Lucerna::unscramble() { + byte fv, ff; + + for (fv = 0; fv <= 30; fv ++) + for (ff = 0; ff <= 1; ff ++) + if (_vm->_gyro.also[fv][ff] != 0) + scram1(*_vm->_gyro.also[fv][ff]); + scram1(_vm->_gyro.listen); + scram1(_vm->_gyro.flags); + /* for fz:=1 to length(_vm->_gyro.also[fv,ff]^) do + _vm->_gyro.also[fv,ff]^[fz]:=chr(ord(_vm->_gyro.also[fv,ff]^[fz]) xor 177);*/ +} + +void Lucerna::load_also(Common::String n) { + byte minnames; + byte ff, fv; + + + for (fv = 0; fv <= 30; fv ++) + for (ff = 0; ff <= 1; ff ++) + if (_vm->_gyro.also[fv][ff] != 0) { + delete _vm->_gyro.also[fv][ff]; + _vm->_gyro.also[fv][ff] = 0; + } + + warning("STUB: Lucerna::load_also()"); +} + +void Lucerna::load(byte n) { /* Load2, actually */ + byte a0; /*absolute $A000:800;*/ + byte a1; /*absolute $A000:17184;*/ + byte bit; + + warning("STUB: Lucerna::load()"); +} + + + +void Lucerna::zoomout(int16 x, int16 y) { + int16 x1, y1, x2, y2; + byte fv; + + warning("STUB: Lucerna::zoomout()"); +} + +void Lucerna::find_people(byte room) { + char fv; + + for (fv = 151; fv <= 178; fv ++) + if (_vm->_gyro.whereis[fv] == room) { + if (fv < 175) _vm->_gyro.him = fv; + else _vm->_gyro.her = fv; + } +} + +void Lucerna::exitroom(byte x) { + //nosound(); + _vm->_celer.forget_chunks(); + _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the + length of this procedure. */ + + { + dnatype &with = _vm->_gyro.dna; + switch (x) { + case r__spludwicks: { + _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); + /* He doesn't HAVE to be talking for this to work. It just deletes it IF it + exists. */ with.avaricius_talk = 0; + } + break; + case r__bridge: + if (with.drawbridge_open > 0) { + with.drawbridge_open = 4; /* Fully open. */ + _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); + } + break; + case r__outsidecardiffcastle: + _vm->_timeout.lose_timer(_vm->_timeout.reason_cardiffsurvey); + break; + + case r__robins: + _vm->_timeout.lose_timer(_vm->_timeout.reason_getting_tied_up); + break; + } + } + + _vm->_gyro.interrogation = 0; /* Leaving the room cancels all the questions automatically. */ + + _vm->_gyro.seescroll = false; /* Now it can work again! */ + + _vm->_gyro.dna.last_room = _vm->_gyro.dna.room; + if (_vm->_gyro.dna.room != r__map) + _vm->_gyro.dna.last_room_not_map = _vm->_gyro.dna.room; +} + +void Lucerna::new_town() { /* You've just entered a town from the map. */ + _vm->_dropdown.standard_bar(); + + switch (_vm->_gyro.dna.room) { + case r__outsidenottspub: /* Entry into Nottingham. */ + if ((_vm->_gyro.dna.rooms[r__robins] > 0) && (_vm->_gyro.dna.been_tied_up) && + (! _vm->_gyro.dna.taken_mushroom)) + _vm->_gyro.dna.mushroom_growing = true; + break; + case r__wisewomans: { /* Entry into Argent. */ + if (_vm->_gyro.dna.talked_to_crapulus && (! _vm->_gyro.dna.lustie_is_asleep)) { + _vm->_gyro.dna.spludwicks_here = !((_vm->_gyro.dna.rooms[r__wisewomans] % 3) == 1); + _vm->_gyro.dna.crapulus_will_tell = ! _vm->_gyro.dna.spludwicks_here; + } else { + _vm->_gyro.dna.spludwicks_here = true; + _vm->_gyro.dna.crapulus_will_tell = false; + } + if (_vm->_gyro.dna.box_contents == _vm->_gyro.wine) _vm->_gyro.dna.winestate = 3; /* Vinegar */ + } + break; + } + + if (_vm->_gyro.dna.room != r__outsideducks) { + if ((_vm->_gyro.dna.obj[_vm->_gyro.onion]) && !(_vm->_gyro.dna.onion_in_vinegar)) + _vm->_gyro.dna.rotten_onion = true; /* You're holding the onion */ + } +} + + + +void Lucerna::put_geida_at(byte whichped, byte &ped) { + if (ped == 0) return; + _vm->_trip.tr[2].init(5, false, &_vm->_trip); /* load Geida */ + _vm->_trip.apped(2, whichped); + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procgeida_procs; +} + +void Lucerna::enterroom(byte x, byte ped) { + _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ + + find_people(x); + _vm->_gyro.dna.room = x; + if (ped != 0) _vm->_gyro.dna.rooms[x] += 1; + + load(x); + + if ((_vm->_gyro.dna.rooms[x] == 0) && (! _vm->_gyro.flagset('S'))) + points(1); + + _vm->_gyro.whereis[_vm->_gyro.pavalot] = _vm->_gyro.dna.room; + + if (_vm->_gyro.dna.geida_follows) + _vm->_gyro.whereis[_vm->_gyro.pgeida] = x; + + _vm->_gyro.roomtime = 0; + + { + dnatype &with = _vm->_gyro.dna; + if ((with.last_room == r__map) && (with.last_room_not_map != with.room)) + new_town(); + } + + switch (x) { + case r__yours: + if (_vm->_gyro.dna.avvy_in_bed) { + _vm->_celer.show_one(3); + _vm->_timeout.set_up_timer(100, _vm->_timeout.procarkata_shouts, _vm->_timeout.reason_arkata_shouts); + } + break; + + case r__outsideyours: + if (ped > 0) { + if (! _vm->_gyro.dna.talked_to_crapulus) { + + _vm->_gyro.whereis[_vm->_gyro.pcrapulus] = r__outsideyours; + _vm->_trip.tr[2].init(8, false, &_vm->_trip); /* load Crapulus */ + + if (_vm->_gyro.dna.rooms[r__outsideyours] == 1) { + _vm->_trip.apped(2, 4); /* Start on the right-hand side of the screen. */ + _vm->_trip.tr[2].walkto(5); /* Walks up to greet you. */ + } else { + _vm->_trip.apped(2, 5); /* Starts where he was before. */ + _vm->_trip.tr[2].face = 3; + } + + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procface_avvy; /* He always faces Avvy. */ + + } else _vm->_gyro.whereis[_vm->_gyro.pcrapulus] = r__nowhere; + + if (_vm->_gyro.dna.crapulus_will_tell) { + _vm->_trip.tr[2].init(8, false, &_vm->_trip); + _vm->_trip.apped(2, 2); + _vm->_trip.tr[2].walkto(4); + _vm->_timeout.set_up_timer(20, _vm->_timeout.proccrapulus_splud_out, _vm->_timeout.reason_crapulus_says_spludwick_out); + _vm->_gyro.dna.crapulus_will_tell = false; + } + } + break; + + /* Need to find out which room is this! + + case r__outsidespludwicks: + if ((_vm->_gyro.dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { + _vm->_timeout.set_up_timer(20, _vm->_timeout.procbang, _vm->_timeout.reason_explosion); + _vm->_gyro.dna.spludwicks_here = true; + } + break;*/ + + case r__spludwicks: + if (_vm->_gyro.dna.spludwicks_here) { + if (ped > 0) { + _vm->_trip.tr[2].init(2, false, &_vm->_trip); /* load Spludwick */ + _vm->_trip.apped(2, 2); + _vm->_gyro.whereis['\227'] = r__spludwicks; + } + + _vm->_gyro.dna.dogfoodpos = 0; /* _vm->_gyro.also Spludwick pos. */ + + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procgeida_procs; + } else _vm->_gyro.whereis['\227'] = r__nowhere; + break; + + case r__brummieroad: { + if (_vm->_gyro.dna.geida_follows) put_geida_at(5, ped); + if (_vm->_gyro.dna.cwytalot_gone) { + _vm->_gyro.magics[lightred].op = _vm->_gyro.nix; + _vm->_gyro.whereis[_vm->_gyro.pcwytalot] = r__nowhere; + } else { + if (ped > 0) { + _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot*/ + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procfollow_avvy_y; + _vm->_gyro.whereis[_vm->_gyro.pcwytalot] = r__brummieroad; + + if (_vm->_gyro.dna.rooms[r__brummieroad] == 1) { /* First time here... */ + _vm->_trip.apped(2, 2); /* He appears on the right of the screen... */ + _vm->_trip.tr[2].walkto(4); /* ...and he walks up... */ + } else { + /* You've been here before. */ + _vm->_trip.apped(2, 4); /* He's standing in your way straight away... */ + _vm->_trip.tr[2].face = _vm->_trip.left; + } + } + } + } + break; + + case r__argentroad: { + dnatype &with = _vm->_gyro.dna; + if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && + (_vm->_gyro.dna.rooms[r__argentroad] > 3)) { + _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot again*/ + _vm->_trip.apped(2, 1); + _vm->_trip.tr[2].walkto(2); + _vm->_trip.tr[2].vanishifstill = true; + with.cwytalot_in_herts = true; + /*_vm->_gyro.whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ + _vm->_timeout.set_up_timer(20, _vm->_timeout.proc_cwytalot_in_herts, _vm->_timeout.reason_cwytalot_in_herts); + } + } + break; + + case r__bridge: { + if (_vm->_gyro.dna.drawbridge_open == 4) { /*open*/ + _vm->_celer.show_one(3); /* Position of drawbridge */ + _vm->_gyro.magics[green].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + } + if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ + } + break; + + case r__robins: { + if (ped > 0) { + if (! _vm->_gyro.dna.been_tied_up) { + /* A welcome party... or maybe not... */ + _vm->_trip.tr[2].init(6, false, &_vm->_trip); + _vm->_trip.apped(2, 2); + _vm->_trip.tr[2].walkto(3); + _vm->_timeout.set_up_timer(36, _vm->_timeout.procget_tied_up, _vm->_timeout.reason_getting_tied_up); + } + } + + if (_vm->_gyro.dna.been_tied_up) { + _vm->_gyro.whereis[_vm->_gyro.probinhood] = 0; + _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = 0; + } + + if (_vm->_gyro.dna.tied_up) + _vm->_celer.show_one(2); + + if (! _vm->_gyro.dna.mushroom_growing) + _vm->_celer.show_one(3); + } + break; + + case r__outsidecardiffcastle: { + if (ped > 0) + switch (_vm->_gyro.dna.cardiff_things) { + case 0 : { /* You've answered NONE of his questions. */ + _vm->_trip.tr[2].init(9, false, &_vm->_trip); + _vm->_trip.apped(2, 2); + _vm->_trip.tr[2].walkto(3); + _vm->_timeout.set_up_timer(47, _vm->_timeout.proccardiffsurvey, _vm->_timeout.reason_cardiffsurvey); + } + break; + case 5 : + _vm->_gyro.magics[2].op = _vm->_gyro.nix; + break; /* You've answered ALL his questions. => nothing happens. */ + default: { /* You've answered SOME of his questions. */ + _vm->_trip.tr[2].init(9, false, &_vm->_trip); + _vm->_trip.apped(2, 3); + _vm->_trip.tr[2].face = _vm->_trip.right; + _vm->_timeout.set_up_timer(3, _vm->_timeout.proccardiff_return, _vm->_timeout.reason_cardiffsurvey); + } + } + if (_vm->_gyro.dna.cardiff_things < 5) + _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; + else _vm->_gyro.interrogation = 0; + } + break; + + case r__map: { + warning("STUB: Lucerna::enterroom() - case: r__map"); + } + break; + + case r__catacombs: { + warning("STUB: Lucerna::enterroom() - case: r__catacombs"); + } + break; + + case r__argentpub: { + if (_vm->_gyro.dna.wonnim) _vm->_celer.show_one(1); /* No lute by the settle. */ + _vm->_gyro.dna.malagauche = 0; /* Ready to boot Malagauche */ + if (_vm->_gyro.dna.givenbadgetoiby) { + _vm->_celer.show_one(8); + _vm->_celer.show_one(9); + } + } + break; + + case r__lustiesroom: { + _vm->_gyro.dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + if (_vm->_trip.tr[1].whichsprite == 0) /* Avvy in his normal clothes */ + _vm->_timeout.set_up_timer(3, _vm->_timeout.proccallsguards, _vm->_timeout.reason_du_lustie_talks); + else if (! _vm->_gyro.dna.entered_lusties_room_as_monk) /*already*/ + /* Presumably, Avvy dressed as a monk. */ + _vm->_timeout.set_up_timer(3, _vm->_timeout.procgreetsmonk, _vm->_timeout.reason_du_lustie_talks); + + if (_vm->_gyro.dna.geida_follows) { + put_geida_at(5, ped); + if (_vm->_gyro.dna.lustie_is_asleep) _vm->_celer.show_one(5); + } + } + break; + + case r__musicroom: { + if (_vm->_gyro.dna.jacques_awake > 0) { + _vm->_gyro.dna.jacques_awake = 5; + _vm->_celer.show_one(2); + _vm->_celer.show_one(4); + _vm->_gyro.magics[brown].op = _vm->_gyro.nix; + _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; + } + if (ped != 0) { + _vm->_celer.show_one(6); + _vm->_sequence.first_show(5); + _vm->_sequence.then_show(7); + _vm->_sequence.start_to_close(); + } + } + break; + + case r__outsidenottspub: + if (ped == 2) { + _vm->_celer.show_one(3); + _vm->_sequence.first_show(2); + _vm->_sequence.then_show(1); + _vm->_sequence.then_show(4); + _vm->_sequence.start_to_close(); + } + break; + + case r__outsideargentpub: + if (ped == 2) { + _vm->_celer.show_one(6); + _vm->_sequence.first_show(5); + _vm->_sequence.then_show(7); + _vm->_sequence.start_to_close(); + } + break; + + case r__wisewomans: { + _vm->_trip.tr[2].init(11, false, &_vm->_trip); + if ((_vm->_gyro.dna.rooms[r__wisewomans] == 1) && (ped > 0)) { + _vm->_trip.apped(2, 2); /* Start on the right-hand side of the screen. */ + _vm->_trip.tr[2].walkto(4); /* Walks up to greet you. */ + } else { + _vm->_trip.apped(2, 4); /* Starts where she was before. */ + _vm->_trip.tr[2].face = 3; + } + + _vm->_trip.tr[2].call_eachstep = true; + _vm->_trip.tr[2].eachstep = _vm->_trip.procface_avvy; /* She always faces Avvy. */ + } + break; + + case r__insidecardiffcastle: + if (ped > 0) { + _vm->_trip.tr[2].init(10, false, &_vm->_trip); /* Define the dart. */ + _vm->_sequence.first_show(1); + if (_vm->_gyro.dna.arrow_in_the_door) + _vm->_sequence.then_show(3); + else + _vm->_sequence.then_show(2); + + if (_vm->_gyro.dna.taken_pen) + _vm->_celer.show_one(4); + + _vm->_sequence.start_to_close(); + } else { + _vm->_celer.show_one(1); + if (_vm->_gyro.dna.arrow_in_the_door) _vm->_celer.show_one(3); + else _vm->_celer.show_one(2); + } + break; + + case r__avvysgarden: + if (ped == 1) { + _vm->_celer.show_one(2); + _vm->_sequence.first_show(1); + _vm->_sequence.then_show(3); + _vm->_sequence.start_to_close(); + } + break; + + case r__entrancehall: + case r__insideabbey: + if (ped == 2) { + _vm->_celer.show_one(2); + _vm->_sequence.first_show(1); + _vm->_sequence.then_show(3); + _vm->_sequence.start_to_close(); + } + break; + + case r__aylesoffice: + if (_vm->_gyro.dna.ayles_is_awake) _vm->_celer.show_one(2); + break; /* Ayles awake. */ + + case r__geidas: + put_geida_at(2, ped); + break; /* load Geida */ + + case r__easthall: + case r__westhall: + if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 2, ped); + break; + + case r__lusties: + if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 6, ped); + break; + + case r__nottspub: { + if (_vm->_gyro.dna.sitting_in_pub) _vm->_celer.show_one(3); + _vm->_gyro.dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + } + break; + + case r__outsideducks: + if (ped == 2) { + /* Shut the door */ + _vm->_celer.show_one(3); + _vm->_sequence.first_show(2); + _vm->_sequence.then_show(1); + _vm->_sequence.then_show(4); + _vm->_sequence.start_to_close(); + } + break; + case r__ducks: + _vm->_gyro.dna.dogfoodpos = 1; + break; /* Actually, Duck pos. */ + + } + + _vm->_gyro.seescroll = false; /* Now it can work again! */ + +} + +void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! */ + warning("STUB: Lucerna::thinkabout()"); +} + +void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ + warning("STUB: Lucerna::load_digits()"); +} + +void Lucerna::toolbar() { + warning("STUB: Lucerna::toolbar()"); +} + +void Lucerna::showscore() { + warning("STUB: Lucerna::showscore()"); +} + +void Lucerna::points(byte num) { /* Add on no. of points */ + warning("STUB: Lucerna::points()"); +} + +void Lucerna::topcheck() { + /* Menuset */ + _vm->_dropdown.ddm_m.getmenu(_vm->_gyro.mpx); + /* Do this one */ +} + +void Lucerna::mouseway() { + warning("STUB: Lucerna::mouseway()"); +} + +void Lucerna::inkey() { + char r; + + + if (_vm->_gyro.demo) + return; /* Demo handles this itself. */ + + if (_vm->_gyro.mousetext == "") { + /* read keyboard */ + _vm->_enhanced.readkeye(); + if ((_vm->_enhanced.inchar == ' ') && ((_vm->_enhanced.shiftstate & 8) > 0)) { + _vm->_enhanced.inchar = '\0'; + _vm->_enhanced.extd = '#'; /* alt-spacebar = alt-H */ + } + } else { + if (_vm->_gyro.mousetext[1] == '`') + _vm->_gyro.mousetext.setChar(13,1); /* Backquote = return in a macro */ + _vm->_enhanced.inchar = _vm->_gyro.mousetext[1]; + _vm->_gyro.mousetext = Common::String(_vm->_gyro.mousetext.c_str() + 2, 253); + } +} + +void Lucerna::posxy() { + warning("STUB: Lucerna::posxy()"); +} + +void Lucerna::fxtoggle() { + warning("STUB: Lucerna::fxtoggle()"); +} - // Needs const char pardon located in Acci. +void Lucerna::objectlist() { + char fv; + _vm->_gyro.dna.carrying = 0; + if (_vm->_gyro.thinkthing && ! _vm->_gyro.dna.obj[_vm->_gyro.thinks]) + thinkabout(_vm->_gyro.money, _vm->_gyro.a_thing); /* you always have money */ + for (fv = '\1'; fv <= numobjs; fv ++) + if (_vm->_gyro.dna.obj[fv]) { + _vm->_gyro.dna.carrying += 1; + _vm->_gyro.objlist[_vm->_gyro.dna.carrying] = fv; + } } +void Lucerna::verte() { + byte what; + if (! _vm->_gyro.dna.user_moves_avvy) return; + { + triptype &with = _vm->_trip.tr[1]; /* that's the only one we're interested in here */ + + + if (_vm->_gyro.mx < with.x) what = 1; + else if (_vm->_gyro.mx > (unsigned char)(with.x + with.a.xl)) what = 2; + else + what = 0; /* On top */ + + if (_vm->_gyro.my < with.y) what += 3; + else if (_vm->_gyro.my > (unsigned char)(with.y + with.a.yl)) what += 6; + + switch (what) { + case 0: + _vm->_trip.stopwalking(); + break; /* Clicked on Avvy- no movement */ + case 1: + _vm->_trip.rwsp(1, _vm->_trip.left); + break; + case 2: + _vm->_trip.rwsp(1, _vm->_trip.right); + break; + case 3: + _vm->_trip.rwsp(1, _vm->_trip.up); + break; + case 4: + _vm->_trip.rwsp(1, _vm->_trip.ul); + break; + case 5: + _vm->_trip.rwsp(1, _vm->_trip.ur); + break; + case 6: + _vm->_trip.rwsp(1, _vm->_trip.down); + break; + case 7: + _vm->_trip.rwsp(1, _vm->_trip.dl); + break; + case 8: + _vm->_trip.rwsp(1, _vm->_trip.dr); + break; + } /* no other values are possible... */ + + showrw(); + + } +} + +void Lucerna::checkclick() { + warning("STUB: Lucerna::checkclick()"); +} + +void Lucerna::mouse_init() { + warning("STUB: Lucerna::mouse_init()"); +} + +void Lucerna::mousepage(uint16 page_) { + warning("STUB: Lucerna::mousepage()"); +} + +void Lucerna::errorled() { + warning("STUB: Lucerna::errorled()"); +} + +int8 Lucerna::fades(int8 x) { + byte r, g, b; + + int8 fades_result; + r = x / 16; + x = x % 16; + g = x / 4; + b = x % 4; + if (r > 0) r -= 1; + if (g > 0) g -= 1; + if (b > 0) b -= 1; + fades_result = (16 * r + 4 * g + b); + /* fades:=x-1;*/ + return fades_result; +} + + + + +void Lucerna::fadeout(byte n) { + warning("STUB: Lucerna::fadeout()"); +} + +void Lucerna::dusk() { + warning("STUB: Lucerna::dusk()"); +} + + + + +void Lucerna::fadein(byte n) { + warning("STUB: Lucerna::fadein()"); +} + +void Lucerna::dawn() { + warning("STUB: Lucerna::dawn()"); +} + + + +void Lucerna::showrw() { + warning("STUB: Lucerna::showrw()"); +} + +void Lucerna::mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t) /* assembler; */ +/* The Minstrel Blitter */ +/* asm +{ ofsfr:=f*$4000+x1+y1*80; + ofsto:=t*$4000+x1+y1*80;} + + mov bx,80; { We're multiplying by 80. } + mov al,y1; + mul bl; { AX now contains y1*80. } + xor cx,cx; { Zero CX. } + mov cl,x1; { CX now equals x1 } + add ax,cx; { AX now contains x1+y1*80. } + mov si,ax; + mov di,ax; + + mov ax,$4000; + mov bl,f; + mul bx; { Note that this is a *uint16*! } + add si,ax; + + mov ax,$4000; + mov bl,t; + mul bx; { Note that this is a *uint16*! } + add di,ax; + + push ds; { *** <<<< *** WE MUST PRESERVE THIS! } + cld; { Clear Direction flag - we're going forwards! } + + mov ax,$A000; { The screen memory. } + mov ds,ax; + mov es,ax; { The same. } + + { AH stores the number of bytes to copy. } + { len:=(x2-x1)+1; } + + mov ah,x2; + sub ah,x1; + inc ah; + + { Firstly, let's decide how many times we're going round. } + + mov cl,y2; { How many numbers between y1 and y2? } + sub cl,y1; + inc cl; { Inclusive reckoning (for example, from 3 to 5 is 5-3+1=3 turns. } + + { We'll use SI and DI to be Ofsfr and Ofsto. } + + @Y_axis_loop: + push cx; + + + { OK... We've changed this loop from a for-next loop. "Bit" is + represented by CX. } + +{ port[$3c4]:=2; port[$3ce]:=4; } + mov dx,$3c4; + mov al,2; + out dx,al; + mov dx,$3ce; + mov al,4; + out dx,al; + + mov cx,4; { We have to copy planes 3, 2, 1 and Zero. We'll add 1 to the + number, because at zero it stops. } + + mov bx,3; { This has a similar function to that of CX. } + + @start_of_loop: + + push cx; + +{ port[$3C5]:=1 shl bit; } + mov dx,$3C5; + mov al,1; + mov cl,bl; { BL = bit. } + shl al,cl; + out dx,al; +{ port[$3CF]:=bit; } + mov dx,$3CF; + mov al,bl; { BL = bit. } + out dx,al; + +{ move(mem[$A000:ofsfr],mem[$A000:ofsto],len); } + + xor ch,ch; { Clear CH. } + mov cl,ah; + + repz movsb; { That's all we need to say! } + + mov cl,ah; + sub si,cx; { This is MUCH, MUCH faster than pushing and popping them! } + sub di,cx; + + pop cx; { Get the loop count back again. } + dec bx; { One less... } + loop @start_of_loop; { Until cx=0. } + + add si,80; { Do the next line... } + add di,80; + + pop cx; + loop @Y_axis_loop; + + pop ds; { Get it back again (or we'll be in trouble with TP!) } +*/ +{ +} + +void Lucerna::blitfix() { + warning("STUB: Lucerna::blitfix()"); +} + + + + + + +void Lucerna::calchand(uint16 ang, uint16 length, /*arccoordstype &a,*/ byte c) { + warning("STUB: Lucerna::calchand()"); +} + +void Lucerna::hand(/*arccoordstype a,*/ byte c) { + warning("STUB: Lucerna::hand()"); +} + +void Lucerna::chime() { + warning("STUB: Lucerna::chime()"); +} + +void Lucerna::plothands() { + warning("STUB: Lucerna::plothands()"); +} + +void Lucerna::clock_lucerna() { + warning("STUB: Lucerna::clock_lucerna()"); +} + + + + +void Lucerna::flip_page() { + warning("STUB: Lucerna::flip_page()"); +} + +void Lucerna::delavvy() { + byte page_; + + _vm->_gyro.off(); + { + triptype &with = _vm->_trip.tr[1]; + for (page_ = 0; page_ <= 1; page_ ++) + mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); + } + blitfix(); + _vm->_gyro.on(); +} + +void Lucerna::gameover() { + byte fv; + int16 sx, sy; + + _vm->_gyro.dna.user_moves_avvy = false; + + sx = _vm->_trip.tr[1].x; + sy = _vm->_trip.tr[1].y; + + _vm->_trip.tr[1].done(); + _vm->_trip.tr[1].init(12, true, &_vm->_trip); /* 12 = Avalot falls */ + _vm->_trip.tr[1].step = 0; + _vm->_trip.tr[1].appear(sx, sy, 0); + + _vm->_timeout.set_up_timer(3, _vm->_timeout.procavalot_falls, _vm->_timeout.reason_falling_over); + /* _vm->_scrolls.display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ + _vm->_gyro.alive = false; +} + +/* OK. There are two kinds of redraw: Major and Minor. Minor is what happens + when you load a game, etc. Major redraws EVERYTHING. */ + +void Lucerna::minor_redraw() { + byte fv; + + dusk(); + enterroom(_vm->_gyro.dna.room, 0); /* Ped unknown or non-existant. */ + + for (fv = 0; fv <= 1; fv ++) { + _vm->_gyro.cp = 1 - _vm->_gyro.cp; + _vm->_trip.getback(); + } + + { + dnatype &with = _vm->_gyro.dna; + + _vm->_gyro.lastscore = "TJA"; /* impossible digits */ + showscore(); + } + + dawn(); +} + +void Lucerna::major_redraw() { + warning("STUB: Lucerna::major_redraw()"); +} + +uint16 Lucerna::bearing(byte whichped) { +/* Returns the bearing from ped Whichped to Avvy, in degrees. */ + const double rad2deg = 180 / 3.14/*Pi*/; + + uint16 bearing_result; + { + pedtype &with = _vm->_gyro.peds[whichped]; + if (_vm->_trip.tr[1].x == with.x) + bearing_result = 0; /* This would cause a division by zero if we let it through. */ + else + /* + bearing:=trunc(((arctan((_vm->_trip.tr[1].y-y)/(_vm->_trip.tr[1].x-x)))*rad2deg)+90) mod 360*/ + { + if (_vm->_trip.tr[1].x < with.x) + bearing_result = (atan(double((_vm->_trip.tr[1].y - with.y)) / (_vm->_trip.tr[1].x - with.x)) * rad2deg) + 90; + else + bearing_result = (atan(double((_vm->_trip.tr[1].y - with.y)) / (_vm->_trip.tr[1].x - with.x)) * rad2deg) + 270; + } + } + return bearing_result; +} + +void Lucerna::flesh_colours() /* assembler; +asm + mov ax,$1012; + mov bx,21; { 21 = light pink (why?) } + mov cx,1; + mov dx,seg @flesh; + mov es,dx; + mov dx,offset @flesh; + int $10; + + mov dx,seg @darkflesh; + mov es,dx; + mov dx,offset @darkflesh; + mov bx,5; { 5 = dark pink. } + int $10; + + jmp @TheEnd; + + @flesh: + db 56,35,35; + + @darkflesh: + db 43,22,22; + + @TheEnd: */ +{ +} + +void Lucerna::sprite_run() +/* A sprite run is performed before _vm->_scrolls.displaying a scroll, if not all the + sprites are still. It performs two fast cycles, only using a few of + the links usually used, and without any extra animation. This should + make the sprites the same on both pages. */ +{ + byte fv; + + + _vm->_gyro.doing_sprite_run = true; + + for (fv = 0; fv <= 1; fv ++) { + _vm->_trip.get_back_loretta(); + _vm->_trip.trippancy_link(); + + flip_page(); + } + + _vm->_gyro.doing_sprite_run = false; + +} + +void Lucerna::fix_flashers() { + _vm->_gyro.ledstatus = 177; + _vm->_gyro.oldrw = 177; + _vm->_scrolls.state(2); + showrw(); +} } // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index d4e729aaf47d..69888ac192d4 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -41,6 +41,8 @@ class Lucerna { void setParent(AvalancheEngine *vm); + void init(); + void callverb(char n); void draw_also_lines(); @@ -126,6 +128,45 @@ class Lucerna { }; palettetype fxpal[4]; + + //Clock + static const int16 xm = 510; + static const int16 ym = 183; + //arccoordstype ah, am; http://www.freepascal.org/docs-html/rtl/graph/arccoordstype.html + uint16 nh; + + + //untyped_file f; + Common::String nextstring(); + void scram1(Common::String &x); + void unscramble(); + void load_also(Common::String n); + + void zoomout(int16 x, int16 y); + + void find_people(byte room); + + void new_town(); + + void put_geida_at(byte whichped, byte &ped); + + void topcheck(); + + void verte(); + + int8 fades(int8 x); + + void fadeout(byte n); + + void fadein(byte n); + + // clock_lucerna + void calchand(uint16 ang, uint16 length,/* arccoordstype &a,*/ byte c); + void hand(/*arccoordstype a,*/ byte c); + void chime(); + void refresh_hands(); + void plothands(); + }; } // End of namespace Avalanche diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index d7b5637542fa..954b870f1bb8 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -150,24 +150,11 @@ class getsettype { - - - - - - class Trip { public: friend triptype; friend getsettype; - - - - - - - Trip(); void setParent(AvalancheEngine *vm); From 712ccac0b21c71aaec74b166006e8187d5692c6a Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 01:10:45 +0200 Subject: [PATCH 0070/1332] AVALANCHE: Finish stubbing of Scrolls. --- engines/avalanche/scrolls2.cpp | 296 ++++++++++++++++----------------- engines/avalanche/scrolls2.h | 24 ++- 2 files changed, 170 insertions(+), 150 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 74b7158afce8..a9c94b5d95ea 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -36,150 +36,37 @@ #include "avalanche/acci2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" +#include "avalanche/basher2.h" #include "common/textconsole.h" -//#include "basher.h" //#include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... namespace Avalanche { -const int16 Scrolls::roman = 0; -const int16 Scrolls::italic = 1; +Scrolls::Scrolls() { + loadfont(); + resetscrolldriver(); -const int16 Scrolls::halficonwidth = 19; /* Half the width of an icon. */ - - - -Scrolls::Scrolls() : aboutscroll(false) { } void Scrolls::setParent(AvalancheEngine *vm) { _vm = vm; } - void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - - if (_vm->_gyro.ledstatus == x) - return; /* Already like that! */ - - warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); - //switch (x) { - //case 0: - // setfillstyle(1, black); - // break; /* Off */ - //case 1: - // setfillstyle(9, green); - // break; /* Half-on (menus) */ - //case 2: - // setfillstyle(1, green); - // break; /* On (kbd) */ - //case 3: - // setfillstyle(6, green); - // break; /* Hit a key */ - //} - - _vm->_gyro.super_off(); - - /* for (page_ = 0; page_ <= 1; page_++) { - setactivepage(page_); - bar(419, 195, 438, 197); - }*/ - - _vm->_gyro.super_on(); - _vm->_gyro.ledstatus = x; + warning("STUB: Scrolls::state()"); } void Scrolls::easteregg() { - uint16 fv, ff; - - warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); - - /* background(15); - for (fv = 4; fv <= 100; fv++) { - for (ff = 0; ff <= 70; ff++) { - sound(fv * 100 + ff * 10); - delay(1); - } - } - nosound; - setcolor(10); - settextstyle(0, 0, 3); - settextjustify(1, 1); - outtextxy(320, 100, "GIED"); - settextstyle(0, 0, 1); - settextjustify(0, 2);*/ - - _vm->_gyro.background(0); + warning("STUB: Scrolls::easteregg()"); } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - const int16 locol = 2; - byte xx, yy, ox, bit, lz, t; - int16 yp; - bool offset; - byte itw[12][80]; - - offset = x % 8 == 4; - x = x / 8; - lz = z.size(); - ox = 0; - _vm->_logger.log_scrollline(); - - for (xx = 1; xx <= lz; xx++) { - switch (z[xx]) { - case '\22': - cfont = roman; - _vm->_logger.log_roman(); - break; - case '\6': - cfont = italic; - _vm->_logger.log_italic(); - break; - default: - ox += 1; - for (yy = 1; yy <= 12; yy++) - itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; - _vm->_logger.log_scrollchar(Common::String(z[xx])); - break; - } - } - - lz = ox; - if (offset) { - /* offsetting routine */ - lz += 1; - for (yy = 1; yy <= 12; yy++) { - bit = 240; - itw[yy][lz] = 255; - for (xx = 1; xx <= lz; xx++) { - t = itw[yy][xx]; - itw[yy][xx] = bit + t / 16; - bit = t << 4; - } - } - } - yp = x + y * 80 + (1 - _vm->_gyro.cp) * _vm->_gyro.pagetop; - for (yy = 1; yy <= 12; yy++) { - yp += 80; - for (bit = 0; bit <= locol; bit++) { - /*port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(itw[yy], mem[0xa000 * yp], lz); - - Some old Pascal-ish. To be removed. */ - - warning("STUB: Scrolls::say()"); - } - } - + warning("STUB: Scrolls::say()"); } -/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ +/* Here are the func2edures that Scroll calls */ /* So they must be... */ /*$F+*/ void Scrolls::normscroll() { warning("STUB: Scrolls::normscroll()"); @@ -189,51 +76,164 @@ void Scrolls::dialogue() { warning("STUB: Scrolls::dialogue()"); } + + + void Scrolls::store_(byte what, tunetype &played) { - memcpy(played, played+1, sizeof(played) - 1); - played[30] = what; + memcpy(played+1, played+2, sizeof(played) - 1); + played[31] = what; } bool Scrolls::they_match(tunetype &played) { byte fv, mistakes; - bool they_match_result; mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv++) - if (played[fv] != Gyro::tune[fv]) - mistakes++; + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != _vm->_gyro.tune[fv]) { + mistakes += 1; + } - they_match_result = mistakes < 5; - return they_match_result; + return mistakes < 5; } void Scrolls::music_scroll() { - char r; - byte value; + warning("STUB: Scrolls::music_scroll()"); +} + +/* ThatsAll, so put us back to */ /*$F-*/ + +void Scrolls::resetscrolldriver() { /* phew */ + _vm->_gyro.scrollbells = 0; + cfont = roman; + _vm->_logger.log_epsonroman(); + use_icon = 0; + _vm->_gyro.interrogation = 0; /* always reset after a scroll comes up. */ +} + +void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ + byte fv; + + for (fv = 1; fv <= _vm->_gyro.scrollbells; fv ++) _vm->_lucerna.errorled(); /* ring the bell "x" times */ +} + +void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */ + _vm->_gyro.xycheck(); /* Mx & my now contain xy pos of mouse */ + dodgex = _vm->_gyro.mx; + dodgey = _vm->_gyro.my; /* Store 'em */ + _vm->_gyro.hopto(dodgex, _vm->_gyro.underscroll); /* Move the pointer off the scroll. */ +} + +void Scrolls::undodgem() { /* This is the opposite of Dodgem. It moves the + mouse pointer back, IF you haven't moved it in the meantime. */ + _vm->_gyro.xycheck(); + if ((_vm->_gyro.mx == dodgex) && (_vm->_gyro.my == _vm->_gyro.underscroll)) + /* No change, so restore the pointer's original position. */ + _vm->_gyro.hopto(dodgex, dodgey); +} + +void Scrolls::geticon(int16 x, int16 y, byte which) { + warning("STUB: Scrolls::geticon()"); +} + +void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { + warning("STUB: Scrolls::block_drop()"); +} + +void Scrolls::drawscroll(func2 gotoit) { /* This is one of the oldest func2s in the game. */ + warning("STUB: Scrolls::drawscroll()"); +} + +void Scrolls::bubble(func2 gotoit) { + warning("STUB: Scrolls::bubble()"); +} + +bool Scrolls::ask(Common::String question) { + warning("STUB: Scrolls::ask()"); + return true; +} + +void Scrolls::resetscroll() { + _vm->_gyro.scrolln = 1; + for (int j = 0; j < 15; j ++) + for (int i = 0; i < sizeof(_vm->_gyro.scroll); i++) + _vm->_gyro.scroll[j].setChar(0, i); +} + +void Scrolls::natural() { /* Natural state of bubbles */ + _vm->_gyro.talkx = 320; + _vm->_gyro.talky = 200; + _vm->_gyro.talkb = 8; + _vm->_gyro.talkf = 15; +} + +Common::String Scrolls::lsd() { + Common::String x; + + Common::String lsd_result; + if (_vm->_gyro.dna.pence < 12) { + /* just pence */ + x = _vm->_gyro.strf(_vm->_gyro.dna.pence) + 'd'; + } else if (_vm->_gyro.dna.pence < 240) { + /* shillings & pence */ + x = _vm->_gyro.strf(_vm->_gyro.dna.pence / int32(12)) + '/'; + if ((_vm->_gyro.dna.pence % int32(12)) == 0) x = x + '-'; + else x = x + _vm->_gyro.strf(_vm->_gyro.dna.pence % int32(12)); + } else /* L, s & d */ + x = Common::String('') + _vm->_gyro.strf(_vm->_gyro.dna.pence / int32(240)) + '.' + _vm->_gyro.strf((_vm->_gyro.dna.pence / int32(12)) % int32(20)) + + '.' + _vm->_gyro.strf(_vm->_gyro.dna.pence % int32(12)); + if (_vm->_gyro.dna.pence > 12) x = x + " (that's " + _vm->_gyro.strf(_vm->_gyro.dna.pence) + "d)"; + lsd_result = x; + return lsd_result; +} + + + + +void Scrolls::strip(Common::String &q) { + warning("STUB: Scrolls::strip()"); +} + +void Scrolls::solidify(byte n) { + warning("STUB: Scrolls::solidify()"); +} + +void Scrolls::calldrivers() { + warning("STUB: Scrolls::calldrivers()"); +} + +void Scrolls::display(Common::String z) { + _vm->_gyro.bufsize = z.size(); + memcpy(_vm->_gyro.buffer, z.c_str() + 1, _vm->_gyro.bufsize); + calldrivers(); +} + +void Scrolls::loadfont() { + warning("STUB: Scrolls::loadfont()"); +} + +void Scrolls::okay() { + display("Okay!"); +} + +void Scrolls::musical_scroll() { + bool was_virtual; - byte last_one, this_one; + display(Common::String("To play the harp...\r\rUse these keys:\r\n") + + "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); - tunetype played; + _vm->_lucerna.sprite_run(); + was_virtual = _vm->_gyro.visible == _vm->_gyro.m_virtual; - state(3); - _vm->_gyro.seescroll = true; - _vm->_gyro.on(); - _vm->_gyro.newpointer(4); - //do { - // do { - // Gyro::check(); /* was "checkclick;" */ - // if (Enhanced::keypressede()) - // break; - // } while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); - // - // Needs joystick - not sure it will be implemented. + if (was_virtual) + _vm->_gyro.off_virtual(); - // if (Gyro::mpress == 0) - // inkey(); Needs Lucerna to proceed. - //} + drawscroll(&Avalanche::Scrolls::music_scroll); + if (was_virtual) + _vm->_gyro.on_virtual(); + resetscroll(); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index fa52a559057c..530c06fa9c04 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -33,6 +33,10 @@ namespace Avalanche { class AvalancheEngine; +class Scrolls; + +typedef void (Scrolls::*func2)(); + class Scrolls { public: bool aboutscroll; /* Is this the about box? */ @@ -45,9 +49,9 @@ class Scrolls { void state(byte x); /* Sets "Ready" light to whatever */ - void drawscroll(proc gotoit); /* This is one of the oldest procs in the game. */ + void drawscroll(func2 gotoit); /* This is one of the oldest funcs in the game. */ - void bubble(proc gotoit); + void bubble(func2 gotoit); void resetscroll(); @@ -96,7 +100,23 @@ class Scrolls { void music_scroll(); + void resetscrolldriver(); + + void dingdongbell(); + + void dodgem(); + + void undodgem(); + + void geticon(int16 x, int16 y, byte which); + + void block_drop(Common::String fn, int16 xl, int16 yl, int16 y); + + void strip(Common::String &q); + + void solidify(byte n); + void loadfont(); }; } // End of namespace Avalanche From 7526af940cbf338c05a40875571da75b762eb956 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 01:32:30 +0200 Subject: [PATCH 0071/1332] AVALANCHE: Scrolls: Repair compilation. --- engines/avalanche/scrolls2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 530c06fa9c04..f946b8f5780b 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -72,10 +72,10 @@ class Scrolls { private: AvalancheEngine *_vm; - static const int16 roman; - static const int16 italic; + static const int16 roman = 0; + static const int16 italic = 1; - static const int16 halficonwidth; /* Half the width of an icon. */ + static const int16 halficonwidth = 19; /* Half the width of an icon. */ int16 dix, diy; raw ch[2]; From 76423aa712006363ef02be0cddd592e9cba4f710 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 13:20:23 +0200 Subject: [PATCH 0072/1332] AVALANCHE: Add Closing. --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 2 + engines/avalanche/closing2.cpp | 91 +++++++++++++++++++++++++++++++++ engines/avalanche/closing2.h | 74 +++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 engines/avalanche/closing2.cpp create mode 100644 engines/avalanche/closing2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index eade42bbc6e2..a55ab3eefa9c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -63,6 +63,7 @@ namespace Avalanche { _acci.setParent(this); _acci.init(); _basher.setParent(this); _dropdown.setParent(this); + _closing.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 46ceeba79f26..51081a05bf63 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -46,6 +46,7 @@ #include "avalanche/acci2.h" #include "avalanche/basher2.h" #include "avalanche/dropdown2.h" +#include "avalanche/closing2.h" #include "engines/engine.h" #include "engines/advancedDetector.h" @@ -78,6 +79,7 @@ class AvalancheEngine : public Engine { Acci _acci; Basher _basher; Dropdown _dropdown; + Closing _closing; AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); diff --git a/engines/avalanche/closing2.cpp b/engines/avalanche/closing2.cpp new file mode 100644 index 000000000000..3336a5f954ed --- /dev/null +++ b/engines/avalanche/closing2.cpp @@ -0,0 +1,91 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* CLOSING The closing screen and error handler. */ + +#include "avalanche/avalanche.h" + +#include "avalanche/closing2.h" +#include "avalanche/gyro2.h" +#include "avalanche/lucerna2.h" + +#include "common/textconsole.h" +#include "common/random.h" + +namespace Avalanche { + +Closing::Closing() { + warning("STUB: Closing::Closing()"); +} + +void Closing::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Closing::get_screen(byte which) { + warning("STUB: Closing::get_screen()"); +} + +void Closing::show_screen() { + warning("STUB: Closing::show_screen()"); +} + +void Closing::quit_with(byte which, byte errorlev) { + warning("STUB: Closing::quit_with()"); +} + +void Closing::put_in(Common::String x, uint16 where) { + warning("STUB: Closing::put_in()"); +} + +void Closing::end_of_program() { + const Common::String nouns[12] = { + "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", + "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" + }; + + const Common::String verbs[12] = { + "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", + "ignore", "stare at", "shriek at", "frighten", "quieten" + }; + + Common::String result; + + //nosound; + warning("STUB: Closing::end_of_program()"); + + get_screen(scr_nagscreen); + result = nouns[_vm->_rnd->getRandomNumber(12)] + " will " + verbs[_vm->_rnd->getRandomNumber(12)] + " you"; + put_in(result, 1628); + show_screen(); /* No halt- it's already set up. */ +} + +void Closing::bug_handler() { + warning("STUB: Closing::bug_handler()"); +} + +} // End of namespace Avalanche. diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h new file mode 100644 index 000000000000..122a8e23a9ac --- /dev/null +++ b/engines/avalanche/closing2.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* CLOSING The closing screen and error handler. */ + +#ifndef CLOSING2_H +#define CLOSING2_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Avalanche { +class AvalancheEngine; + +class Closing { +public: + static const int16 scr_bugalert = 1; + static const int16 scr_ramcram = 2; + static const int16 scr_nagscreen = 3; + static const int16 scr_twocopies = 5; + + Closing(); + + void setParent(AvalancheEngine *vm); + + void quit_with(byte which, byte errorlev); + + void end_of_program(); + +private: + AvalancheEngine *_vm; + + typedef Common::String scrtype; + + scrtype q /*absolute $B8FA:0*/; /* Nobody's using the graphics memory now. */ + //file f; + void *exitsave; + + void get_screen(byte which); + + void show_screen(); + + void put_in(Common::String x, uint16 where); + + void bug_handler(); +}; + +} // End of namespace Avalanche. + +#endif // CLOSING2_H From e4e3574b9178aefaf05744810a401bcfc7e9f9e9 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 13:21:41 +0200 Subject: [PATCH 0073/1332] AVALANCHE: Finish stubbing of Avalot. --- engines/avalanche/avalot.cpp | 148 +++++++++++++++++++++++++++++++---- 1 file changed, 132 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 11186d03576f..34b69bf052e0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -25,36 +25,152 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#include "common/str.h" -#include "common/textconsole.h" - #include "avalanche/avalanche.h" + #include "avalanche/avalot.h" #include "avalanche/gyro2.h" +#include "avalanche/trip6.h" +#include "avalanche/gyro2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/scrolls2.h" +#include "avalanche/basher2.h" +#include "avalanche/dropdown2.h" +#include "avalanche/pingo2.h" +#include "avalanche/logger2.h" +#include "avalanche/timeout2.h" +#include "avalanche/celer2.h" +#include "avalanche/enid2.h" +#include "avalanche/visa2.h" + +/*#include "Incline.h"*/ +/*#include "Closing.h"*/ + +#include "common/str.h" +#include "common/textconsole.h" namespace Avalanche { - Avalot::Avalot() { - int16 gd, gm; +Avalot::Avalot() { + int16 gd, gm; - checkbreak = false; - _vm->_gyro.visible = _vm->_gyro.m_no; - _vm->_gyro.to_do = 0; - _vm->_gyro.lmo = false; - // resetscroll(); Needs scrolls "unit" to make it work. + checkbreak = false; + _vm->_gyro.visible = _vm->_gyro.m_no; + _vm->_gyro.to_do = 0; + _vm->_gyro.lmo = false; + _vm->_scrolls.resetscroll(); + _vm->_gyro.setup_vmc(); + _vm->_gyro.on_virtual(); + gd = 3; + gm = 0; + //initgraph(gd, gm, ""); + _vm->_gyro.holdthedawn = true; + _vm->_lucerna.dusk(); + _vm->_gyro.cmp = 177; + _vm->_lucerna.mouse_init(); /*on;*/ + _vm->_gyro.dropsok = true; + _vm->_gyro.ctrl = ckey; + _vm->_gyro.oldjw = 177; + _vm->_gyro.mousetext = ""; + _vm->_gyro.c = 999; + //settextjustify(0, 0); + _vm->_gyro.ddmnow = false; + _vm->_lucerna.load_digits(); + _vm->_gyro.cheat = false; + _vm->_gyro.cp = 0; + _vm->_gyro.curpos = 1; + _vm->_gyro.quote = true; + _vm->_gyro.ledstatus = 177; + _vm->_gyro.defaultled = 2; + /* TSkellern:=0; { Replace with a more local variable sometime }*/ + _vm->_gyro.dna.rw = _vm->_gyro.stopped; + _vm->_gyro.enid_filename = ""; /* undefined. */ + _vm->_lucerna.toolbar(); + _vm->_scrolls.state(2); + _vm->_pingo.copy03(); + _vm->_gyro.lastscore = "TJA"; - warning("STUB: Avalot::Avalot()"); + /* for gd:=0 to 1 do + begin + setactivepage(gd); outtextxy(7,177,chr(48+gd)); + end;*/ + _vm->_trip.loadtrip(); + if ((_vm->_gyro.filetoload == "") && (! _vm->_gyro.reloaded)) + _vm->_gyro.newgame(); /* no game was requested- load the default */ + else { + if (! _vm->_gyro.reloaded) + _vm->_enid.avvy_background(); + _vm->_dropdown.standard_bar(); + _vm->_lucerna.sprite_run(); + if (_vm->_gyro.reloaded) + _vm->_enid.edna_reload(); + else { + /* Filename given on the command line (or loadfirst) */ + _vm->_enid.edna_load(_vm->_gyro.filetoload); + if (_vm->_enid.there_was_a_problem()) { + _vm->_scrolls.display("So let's start from the beginning instead..."); + _vm->_gyro.holdthedawn = true; + _vm->_lucerna.dusk(); + _vm->_gyro.newgame(); + } + } } - void Avalot::setParent(AvalancheEngine *vm) { - _vm = vm; + if (! _vm->_gyro.reloaded) { + _vm->_gyro.soundfx = ! _vm->_gyro.soundfx; + _vm->_lucerna.fxtoggle(); + _vm->_lucerna.thinkabout(_vm->_gyro.money, _vm->_gyro.a_thing); } + _vm->_trip.get_back_loretta(); + //gm = getpixel(0, 0); + //setcolor(7); + _vm->_gyro.holdthedawn = false; + _vm->_lucerna.dawn(); + _vm->_gyro.cursoron = false; + _vm->_basher.cursor_on(); + _vm->_trip.newspeed(); - void Avalot::run(Common::String arg) { - warning("STUB: Avalot::run(%s)", arg.c_str()); - } + if (! _vm->_gyro.reloaded) + _vm->_visa.dixi('q', 83); /* Info on the game, etc. */ +} + +void Avalot::setParent(AvalancheEngine *vm) { + _vm = vm; +} + + +void Avalot::run(Common::String arg) { + warning("STUB: Avalot::run(%s)", arg.c_str()); + + do { + _vm->_lucerna.clock_lucerna(); + _vm->_basher.keyboard_link(); + _vm->_dropdown.menu_link(); + _vm->_trip.readstick(); + _vm->_gyro.force_numlock(); + _vm->_trip.get_back_loretta(); + _vm->_trip.trippancy_link(); + _vm->_celer.pics_link(); + _vm->_lucerna.checkclick(); + + if (_vm->_gyro.visible == _vm->_gyro.m_virtual) + _vm->_gyro.plot_vmc(_vm->_gyro.mx, _vm->_gyro.my, _vm->_gyro.cp); + _vm->_lucerna.flip_page(); /* <<_gyro.slowdown(); + if (_vm->_gyro.visible == _vm->_gyro.m_virtual) + _vm->_gyro.wipe_vmc(_vm->_gyro.cp); + + _vm->_timeout.one_tick(); + + } while (! _vm->_gyro.lmo); + + //restorecrtmode(); + //if (logging) + // close(logfile); + + _vm->_closing.end_of_program(); +} } // End of namespace Avalanche From ef1f254b030010a2ba5c70d3f6648189b9dad164 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 13:22:23 +0200 Subject: [PATCH 0074/1332] AVALANCHE: Finish stubbing Avalot vol. 2. --- engines/avalanche/avalot.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 34b69bf052e0..b4214c22bcad 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -142,8 +142,6 @@ void Avalot::setParent(AvalancheEngine *vm) { void Avalot::run(Common::String arg) { - warning("STUB: Avalot::run(%s)", arg.c_str()); - do { _vm->_lucerna.clock_lucerna(); _vm->_basher.keyboard_link(); From ae1f189370883a6fdda01876b7679f2758b84e63 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 15:10:16 +0200 Subject: [PATCH 0075/1332] AVALANCHE: Change constructor of Scrolls, repair string handling in Lucerna and Scrolls. --- engines/avalanche/avalanche.cpp | 7 +++---- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/avalot.h | 4 ++-- engines/avalanche/lucerna2.cpp | 9 ++++----- engines/avalanche/scrolls2.cpp | 13 ++++++------- engines/avalanche/scrolls2.h | 2 +- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a55ab3eefa9c..6c559d84f22f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -47,12 +47,11 @@ namespace Avalanche { _console = new AvalancheConsole(this); _rnd = 0; - _avalot.setParent(this); _gyro.setParent(this); _enhanced.setParent(this); _logger.setParent(this); _pingo.setParent(this); - _scrolls.setParent(this); + _scrolls.setParent(this); _scrolls.init(); _visa.setParent(this); _lucerna.setParent(this); _lucerna.init(); _enid.setParent(this); @@ -64,6 +63,7 @@ namespace Avalanche { _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); + _avalot.setParent(this); _avalot.init(); } AvalancheEngine::~AvalancheEngine() { @@ -229,8 +229,7 @@ namespace Avalanche { void AvalancheEngine::run_avalot() { bflight_on(); - Avalot ava; - ava.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them + _avalot.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them // If there's an error initalizing avalot, i'll handle it in there, not here first_time = false; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b4214c22bcad..5172e3074e20 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -50,7 +50,7 @@ namespace Avalanche { -Avalot::Avalot() { +void Avalot::init() { int16 gd, gm; checkbreak = false; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 4c428b6172f5..5881108cfc3b 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -35,10 +35,10 @@ class AvalancheEngine; class Avalot { public: - Avalot(); - void setParent(AvalancheEngine *vm); + void init(); + void run(Common::String arg); private: diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d34392324952..48ccd3a3174b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -100,8 +100,7 @@ Common::String Lucerna::nextstring() { } void Lucerna::scram1(Common::String &x) { - byte fz; - for (fz = 1; fz <= x.size(); fz ++) + for (int fz = 0; fz < x.size(); fz ++) x.setChar(x[fz] ^ 177, fz); } @@ -637,9 +636,9 @@ void Lucerna::inkey() { _vm->_enhanced.extd = '#'; /* alt-spacebar = alt-H */ } } else { - if (_vm->_gyro.mousetext[1] == '`') - _vm->_gyro.mousetext.setChar(13,1); /* Backquote = return in a macro */ - _vm->_enhanced.inchar = _vm->_gyro.mousetext[1]; + if (_vm->_gyro.mousetext[0] == '`') + _vm->_gyro.mousetext.setChar(13,0); /* Backquote = return in a macro */ + _vm->_enhanced.inchar = _vm->_gyro.mousetext[0]; _vm->_gyro.mousetext = Common::String(_vm->_gyro.mousetext.c_str() + 2, 253); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a9c94b5d95ea..cefb4a2882d5 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -44,16 +44,15 @@ namespace Avalanche { -Scrolls::Scrolls() { - loadfont(); - resetscrolldriver(); - -} - void Scrolls::setParent(AvalancheEngine *vm) { _vm = vm; } +void Scrolls::init() { + loadfont(); + resetscrolldriver(); +} + void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ warning("STUB: Scrolls::state()"); } @@ -156,7 +155,7 @@ bool Scrolls::ask(Common::String question) { void Scrolls::resetscroll() { _vm->_gyro.scrolln = 1; for (int j = 0; j < 15; j ++) - for (int i = 0; i < sizeof(_vm->_gyro.scroll); i++) + for (int i = 0; i < _vm->_gyro.scroll[j].size(); i++) _vm->_gyro.scroll[j].setChar(0, i); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index f946b8f5780b..e343309c51c3 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -43,7 +43,7 @@ class Scrolls { - Scrolls(); + void init(); void setParent(AvalancheEngine *vm); From e27948a1a5df08cf698917b0eb50b6b292d2b60a Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 15:59:27 +0200 Subject: [PATCH 0076/1332] AVALANCHE: Minor repair in Trip, move initialization of the engine into the constructor. --- engines/avalanche/avalanche.cpp | 13 +++++++------ engines/avalanche/avalanche.h | 3 ++- engines/avalanche/trip6.cpp | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6c559d84f22f..dec05355841a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -45,7 +45,9 @@ namespace Avalanche { AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { _system = syst; _console = new AvalancheConsole(this); - _rnd = 0; + + _rnd = new Common::RandomSource("avalanche"); + _rnd->setSeed(42); _gyro.setParent(this); _enhanced.setParent(this); @@ -97,12 +99,11 @@ namespace Avalanche { // _sound->syncVolume(); } - void AvalancheEngine::initialize() { - //debugC(1, kDebugEngine, "initialize"); + + + + - _rnd = new Common::RandomSource("avalanche"); - _rnd->setSeed(42); // Kick random number generator - } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 51081a05bf63..592df701eea1 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -114,7 +114,8 @@ class AvalancheEngine : public Engine { AvalancheConsole *_console; Common::Platform _platform; - void initialize(); + + // From bootstrp: diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 151e93f44498..d41fa1046119 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -319,7 +319,8 @@ void Trip::loadtrip() { for (gm = 1; gm <= numtr; gm++) tr[gm].original(); // CHECKME: A 'i++' is missing somewhere, obviously! - for (int i = 0; i < sizeof(aa); aa[i] = 0); + for (int i = 0; i < sizeof(aa); i++) + aa[i] = 0; } byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { From f47bc39f64166a21d9cf592a680403bb62030273 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 16:46:56 +0200 Subject: [PATCH 0077/1332] AVALANCHE: Update the description of classes. --- engines/avalanche/avalot.cpp | 2 ++ engines/avalanche/avalot.h | 2 ++ engines/avalanche/scrolls2.cpp | 2 ++ engines/avalanche/scrolls2.h | 2 ++ 4 files changed, 8 insertions(+) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5172e3074e20..e2ba3a4faa55 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* AVALOT The kernel of the program. */ + #include "avalanche/avalanche.h" #include "avalanche/avalot.h" diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 5881108cfc3b..23463d5646bb 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +/* AVALOT The kernel of the program. */ + #ifndef AVALOT_H #define AVALOT_H diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index cefb4a2882d5..4bb4f9d87c11 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ + /* SCROLLS The scroll driver. */ + #include "avalanche/avalanche.h" #include "avalanche/scrolls2.h" diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index e343309c51c3..2536e66396d9 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ + /* SCROLLS The scroll driver. */ + #ifndef SCROLLS2_H #define SCROLLS2_H From 8d03232cf85068f1ceb40940f92644fa6441310a Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 3 Jul 2013 14:05:06 +0200 Subject: [PATCH 0078/1332] AVALANCHE: Minor repair. --- engines/avalanche/gyro2.cpp | 4 +--- engines/avalanche/trip6.cpp | 19 ++++++------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index c86660e46ea0..5af1670af10f 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -525,9 +525,7 @@ void Gyro::super_on() { } bool Gyro::mouse_near_text() { - bool mouse_near_text_result; - mouse_near_text_result = (my > 144) && (my < 188); - return mouse_near_text_result; + return (my > 144) && (my < 188); } } // End of namespace Avalanche diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index d41fa1046119..7fe643c9da8d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -84,21 +84,14 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { bool triptype::collision_check() { byte fv; - bool collision_check_result = false; - for (fv = 1; fv <= _tr->numtr; fv++) { + for (fv = 1; fv <= _tr->numtr; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + a.xl) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && - (_tr->tr[fv].y == y)) { - collision_check_result = true; - break; - } - // CHECKME: Only checks the first element of the for() statement. - // Both lines should certainly be removed - collision_check_result = false; - return collision_check_result; - } - return collision_check_result; + (_tr->tr[fv].y == y)) + return true; + + return false; } void triptype::walk() { @@ -318,7 +311,7 @@ void Trip::loadtrip() { for (gm = 1; gm <= numtr; gm++) tr[gm].original(); - // CHECKME: A 'i++' is missing somewhere, obviously! + for (int i = 0; i < sizeof(aa); i++) aa[i] = 0; } From 590f89e90e547076f27c25dfb2c1058f7f95bbbf Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 3 Jul 2013 17:06:36 +0200 Subject: [PATCH 0079/1332] AVALANCHE: Celer: Implement file handling. --- engines/avalanche/celer2.cpp | 51 ++++++++++++++++++++++++++++++++++-- engines/avalanche/celer2.h | 8 ++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index c02a82f6f022..6bacde735d40 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -268,8 +268,55 @@ void Celer::pics_link() { } } -void Celer::load_chunks(Common::String xx) { - warning("STUB: Celer::load_chunks()"); +void Celer::load_chunks(char *xx) { + chunkblocktype ch; + byte fv; + + Common::String filename; + filename = filename.format("chunk%s.avd", xx); + if (!f.open(filename)) { + warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + return; + } + + f.seek(44); + num_chunks = f.readByte(); + for (int i = 0; i < num_chunks; i++) + offsets[i] = f.readSint32LE(); + + for (fv = 0; fv < num_chunks; fv++) { + f.seek(offsets[fv]); + + ch.flavour = flavourtype(f.readByte()); + ch.x = f.readSint16LE(); + ch.y = f.readSint16LE(); + ch.xl = f.readSint16LE(); + ch.yl = f.readSint16LE(); + ch.size = f.readSint32LE(); + ch.natural = f.readByte(); + ch.memorise = f.readByte(); + + if (ch.memorise) { + + memos[fv].x = ch.x; + memos[fv].xl = ch.xl; + memos[fv].y = ch.y; + memos[fv].yl = ch.yl; + memos[fv].flavour = ch.flavour; + memos[fv].size = ch.size; + + memory[fv] = malloc(ch.size); // Celer::forget_chunks() deallocates it. + + /*if (ch.natural) { + getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); + } else + blockread(f, memory[fv], ch.size);*/ + } else + memos[fv].x = on_disk; + + } + + f.close(); } void Celer::forget_chunks() { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index e71dec5f1961..aa32bf58a2be 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -31,6 +31,7 @@ #define CELER2_H #include "common/scummsys.h" +#include "common/file.h" #include "common/str.h" namespace Avalanche { @@ -38,7 +39,7 @@ class AvalancheEngine; class Celer { public: - enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; + enum flavourtype {ch_ega, ch_bgi}; struct chunkblocktype { flavourtype flavour; @@ -62,6 +63,9 @@ class Celer { memotype memos[40]; void *memory[40]; + Common::File f; + + Celer(); @@ -69,7 +73,7 @@ class Celer { void pics_link(); - void load_chunks(Common::String xx); + void load_chunks(char *xx); void forget_chunks(); From 490e66e239bc4128250ad089611bb213ad87ccf2 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 3 Jul 2013 17:09:19 +0200 Subject: [PATCH 0080/1332] AVALANCHE: Gyro: Implement file handling. --- engines/avalanche/gyro2.cpp | 44 +++++++++++++++++++++++++++++++++++-- engines/avalanche/gyro2.h | 9 +++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 5af1670af10f..04a1d1425f69 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -38,6 +38,7 @@ #include "avalanche/trip6.h" #include "common/textconsole.h" +#include "common/file.h" //#include "dropdown.h" //#include "basher.h" @@ -248,6 +249,18 @@ Gyro::Gyro() : interrogation(0), oncandopageswap(true) { whereis[i] = static_const_whereis[i]; } +Gyro::~Gyro() { + /* These are allocated in Gyro::setup_vmc */ + + free(vmc.andpic); + free(vmc.xorpic); + + for (int fv = 0; fv < 2; fv ++) { + free(vmc.backpic[fv]); + } + +} + void Gyro::setParent(AvalancheEngine *vm) { _vm = vm; } @@ -467,7 +480,13 @@ void Gyro::wipe_vmc(byte page_) { } void Gyro::setup_vmc() { - warning("STUB: Gyro::setup_vmc()"); + vmc.andpic = malloc(mouse_size); + vmc.xorpic = malloc(mouse_size); + + for (int fv = 0; fv < 2; fv ++) { + vmc.backpic[fv] = malloc(mouse_size); + vmc.wherewas[fv].x = 32767; + } } void Gyro::clear_vmc() { @@ -483,7 +502,28 @@ void Gyro::setminmaxvertcurspos(uint16 min, uint16 max) { } void Gyro::load_a_mouse(byte which) { - warning("STUB: Gyro::load_a_mouse()"); + Common::File f; + + if (!f.open("mice.avd")) { + warning("AVALANCHE: Gyro: File not found: mice.avd"); + return; + } + + f.seek(mouse_size * 2 * (which - 1) + 134); + + for (int i = 0; i < mouse_size; i++) + ((byte *) vmc.andpic)[i] = f.readByte(); + + for (int i = 0; i < mouse_size; i++) + ((byte *) vmc.xorpic)[i] = f.readByte(); + + f.close(); + + vmc.ofsx = -mps[which].horzhotspot; + vmc.ofsy = -mps[which].verthotspot; + + setminmaxhorzcurspos(mps[which].horzhotspot, 624 + mps[which].horzhotspot); + setminmaxvertcurspos(mps[which].verthotspot, 199); } void Gyro::background(byte x) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 42463504a307..719d04875f4e 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -224,10 +224,15 @@ struct quasiped_type { typedef byte tunetype[31]; + +struct PointType { + int16 x, y; +}; + struct vmctype { /* Virtual Mouse Cursor */ void *andpic, *xorpic; void *backpic[2]; - void* wherewas[2]; + PointType wherewas[2]; byte picnumber; int8 ofsx, ofsy; }; @@ -607,6 +612,8 @@ class Gyro { Gyro(); + ~Gyro(); + void setParent(AvalancheEngine *vm); void newpointer(byte m); From d66e89c888b53b8d4424480825db82e855bd93de Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 11:23:20 +0200 Subject: [PATCH 0081/1332] AVALANCHE: Update module.mk. --- engines/avalanche/module.mk | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 5f65d010ed50..ff5bc61e9688 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -5,7 +5,22 @@ MODULE_OBJS = \ avalot.o \ console.o \ detection.o \ - gyro2.o + gyro2.o \ + enhanced2.o \ + logger2.o \ + pingo2.o \ + scrolls2.o \ + visa2.o \ + lucerna2.o \ + enid2.o \ + celer2.o \ + sequence2.o \ + timeout2.o \ + trip6.o \ + acci2.o \ + basher2.o \ + dropdown2.o \ + closing2.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) From 218c7c3ffb939d9e23b9670dd57a4c71b2385308 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 11:41:42 +0200 Subject: [PATCH 0082/1332] AVALANCHE: Gyro: change void* to byte*, make memory handling more C++-like. --- engines/avalanche/gyro2.cpp | 16 ++++++++-------- engines/avalanche/gyro2.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 04a1d1425f69..078eb1c14d8b 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -252,11 +252,11 @@ Gyro::Gyro() : interrogation(0), oncandopageswap(true) { Gyro::~Gyro() { /* These are allocated in Gyro::setup_vmc */ - free(vmc.andpic); - free(vmc.xorpic); + delete[] vmc.andpic; + delete[] vmc.xorpic; for (int fv = 0; fv < 2; fv ++) { - free(vmc.backpic[fv]); + delete[] vmc.backpic[fv]; } } @@ -480,11 +480,11 @@ void Gyro::wipe_vmc(byte page_) { } void Gyro::setup_vmc() { - vmc.andpic = malloc(mouse_size); - vmc.xorpic = malloc(mouse_size); + vmc.andpic = new byte[mouse_size]; + vmc.xorpic = new byte[mouse_size]; for (int fv = 0; fv < 2; fv ++) { - vmc.backpic[fv] = malloc(mouse_size); + vmc.backpic[fv] = new byte[mouse_size]; vmc.wherewas[fv].x = 32767; } } @@ -512,10 +512,10 @@ void Gyro::load_a_mouse(byte which) { f.seek(mouse_size * 2 * (which - 1) + 134); for (int i = 0; i < mouse_size; i++) - ((byte *) vmc.andpic)[i] = f.readByte(); + vmc.andpic[i] = f.readByte(); for (int i = 0; i < mouse_size; i++) - ((byte *) vmc.xorpic)[i] = f.readByte(); + vmc.xorpic[i] = f.readByte(); f.close(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 719d04875f4e..4aab2236daaa 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -230,8 +230,8 @@ struct PointType { }; struct vmctype { /* Virtual Mouse Cursor */ - void *andpic, *xorpic; - void *backpic[2]; + byte *andpic, *xorpic; + byte *backpic[2]; PointType wherewas[2]; byte picnumber; int8 ofsx, ofsy; From 78befcb24aec615b9124b43178afd7e2fb0df5d6 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 18:26:18 +0200 Subject: [PATCH 0083/1332] AVALANCHE: Lucerna: implement load_also(). --- engines/avalanche/lucerna2.cpp | 104 +++++++++++++++++++++++++++------ engines/avalanche/lucerna2.h | 17 ++++-- 2 files changed, 98 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 48ccd3a3174b..dbbcde1a62ea 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -90,13 +90,11 @@ void Lucerna::draw_also_lines() { Common::String Lucerna::nextstring() { - byte l; - Common::String x; - - - warning("STUB: Lucerna::nextstring()"); - - return "STUB: Lucerna::nextstring()"; + Common::String str; + byte length = f.readByte(); + for (int i = 0; i < length; i++) + str += f.readByte(); + return str; } void Lucerna::scram1(Common::String &x) { @@ -105,10 +103,8 @@ void Lucerna::scram1(Common::String &x) { } void Lucerna::unscramble() { - byte fv, ff; - - for (fv = 0; fv <= 30; fv ++) - for (ff = 0; ff <= 1; ff ++) + for (byte fv = 0; fv <= 30; fv ++) + for (byte ff = 0; ff <= 1; ff ++) if (_vm->_gyro.also[fv][ff] != 0) scram1(*_vm->_gyro.also[fv][ff]); scram1(_vm->_gyro.listen); @@ -117,19 +113,93 @@ void Lucerna::unscramble() { _vm->_gyro.also[fv,ff]^[fz]:=chr(ord(_vm->_gyro.also[fv,ff]^[fz]) xor 177);*/ } -void Lucerna::load_also(Common::String n) { - byte minnames; +void Lucerna::load_also(char *n) { byte ff, fv; - - - for (fv = 0; fv <= 30; fv ++) - for (ff = 0; ff <= 1; ff ++) + + for (fv = 0; fv < 31; fv++) + for (ff = 0; ff < 2; ff++) if (_vm->_gyro.also[fv][ff] != 0) { delete _vm->_gyro.also[fv][ff]; _vm->_gyro.also[fv][ff] = 0; } + Common::String filename; + filename = filename.format("also%s.avd", n); + if (!f.open(filename)) { + warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + return; + } + + f.seek(128); + + byte minnames = f.readByte(); + for (fv = 0; fv <= minnames; fv++) { + for (ff = 0; ff < 2; ff++) { + _vm->_gyro.also[fv][ff] = new Common::String; + *_vm->_gyro.also[fv][ff] = nextstring(); + } + *_vm->_gyro.also[fv][0] = Common::String(157) + *_vm->_gyro.also[fv][0] + 157; + } + + memset(_vm->_gyro.lines, 0xFF, sizeof(_vm->_gyro.lines)); + + //fv = getpixel(0, 0); + warning("STUB: Lucerna::load_also()"); + + fv = f.readByte(); + for (byte i = 0; i < fv; i++) { + _vm->_gyro.lines[i].col = f.readByte(); + _vm->_gyro.lines[i].x1 = f.readSint16LE(); + _vm->_gyro.lines[i].x2 = f.readSint16LE(); + _vm->_gyro.lines[i].y1 = f.readSint16LE(); + _vm->_gyro.lines[i].y2 = f.readSint16LE(); + } + + memset(_vm->_gyro.peds, 177, sizeof(_vm->_gyro.peds)); + fv = f.readByte(); + for (byte i = 0; i < fv; i++) { + _vm->_gyro.peds[i].dir = f.readByte(); + _vm->_gyro.peds[i].x = f.readSint16LE(); + _vm->_gyro.peds[i].y = f.readSint16LE(); + } + + _vm->_gyro.numfields = f.readByte(); + for (byte i = 0; i < _vm->_gyro.numfields; i++) { + _vm->_gyro.fields[i].x1 = f.readSint16LE(); + _vm->_gyro.fields[i].x2 = f.readSint16LE(); + _vm->_gyro.fields[i].y1 = f.readSint16LE(); + _vm->_gyro.fields[i].y2 = f.readSint16LE(); + } + + for (byte i = 0; i < 15; i++) { + _vm->_gyro.magics[i].data = f.readUint16LE(); + _vm->_gyro.magics[i].op = f.readByte(); + } + + for (byte i = 0; i < 7; i++) { + _vm->_gyro.portals[i].data = f.readUint16LE(); + _vm->_gyro.portals[i].op = f.readByte(); + } + + for (byte i = 0; i < 26; i++) + _vm->_gyro.flags += f.readByte(); + + int16 listen_length; + listen_length = f.readByte(); + _vm->_gyro.listen.clear(); + for (byte i = 0; i < listen_length; i++) + _vm->_gyro.listen.setChar(f.readByte(), i); + + draw_also_lines(); + + //setactivepage(1); warning("STUB: Lucerna::load_also()"); + + f.close(); + unscramble(); + for (fv = 0; fv <= minnames; fv++) + *_vm->_gyro.also[fv][0] = Common::String(',') + *_vm->_gyro.also[fv][0] + ','; + } void Lucerna::load(byte n) { /* Load2, actually */ diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 69888ac192d4..c98687737b5a 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -31,6 +31,7 @@ #define LUCERNA2_H #include "common/scummsys.h" +#include "common/file.h" namespace Avalanche { class AvalancheEngine; @@ -111,11 +112,11 @@ class Lucerna { void fix_flashers(); + void load_also(char *n); + private: AvalancheEngine *_vm; - bool fxhidden; - struct rgbrec { int16 red; int16 green; @@ -127,8 +128,6 @@ class Lucerna { rgbrec colors[256]; }; - palettetype fxpal[4]; - //Clock static const int16 xm = 510; static const int16 ym = 183; @@ -136,11 +135,17 @@ class Lucerna { uint16 nh; - //untyped_file f; + palettetype fxpal[4]; + + bool fxhidden; + + Common::File f; + + Common::String nextstring(); void scram1(Common::String &x); void unscramble(); - void load_also(Common::String n); + //ldalsz void zoomout(int16 x, int16 y); From d27a3e07f7250ea7d8ca6304095b882adc4f22b7 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 18:27:59 +0200 Subject: [PATCH 0084/1332] AVALANCHE: Gyro: expand initialization. --- engines/avalanche/gyro2.cpp | 5 +++++ engines/avalanche/gyro2.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 078eb1c14d8b..2dd2a28e0b4a 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -247,6 +247,11 @@ const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro() : interrogation(0), oncandopageswap(true) { for (int i = 0; i < 29; i++) whereis[i] = static_const_whereis[i]; + + /* Needed becouse of Lucerna::load_also() */ + for (int fv = 0; fv < 31; fv++) + for (int ff = 0; ff < 2; ff++) + also[fv][ff] = 0; } Gyro::~Gyro() { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 4aab2236daaa..e83e0a96b98b 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -530,7 +530,7 @@ class Gyro { byte cmp; /* current mouse-void **/ Common::String verbstr; /* what you can do with your object. :-) */ - Common::String * also[31][2]; + Common::String *also[31][2]; pedtype peds[15]; magictype magics[15]; magictype portals[7]; From 7078b4de148dd895f50b1db66cb647ef43a51b85 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 18:29:04 +0200 Subject: [PATCH 0085/1332] AVALANCHE: Avalot: repair initialization. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 7 ++++++- engines/avalanche/avalot.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index dec05355841a..a510718d4a52 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -65,7 +65,7 @@ namespace Avalanche { _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); - _avalot.setParent(this); _avalot.init(); + _avalot.setParent(this); } AvalancheEngine::~AvalancheEngine() { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e2ba3a4faa55..e5b000f91907 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -52,7 +52,7 @@ namespace Avalanche { -void Avalot::init() { +void Avalot::setup() { int16 gd, gm; checkbreak = false; @@ -144,6 +144,11 @@ void Avalot::setParent(AvalancheEngine *vm) { void Avalot::run(Common::String arg) { + setup(); + + _vm->_lucerna.load_also("1"); + + do { _vm->_lucerna.clock_lucerna(); _vm->_basher.keyboard_link(); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 23463d5646bb..50bff720b379 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -39,7 +39,7 @@ class Avalot { public: void setParent(AvalancheEngine *vm); - void init(); + void setup(); void run(Common::String arg); From 430dcc037fa879f01e57526a814975914d252e8e Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 01:18:02 +0200 Subject: [PATCH 0086/1332] AVALANCHE: Lucerna: Repair load_also(). --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e5b000f91907..67b543b11165 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -146,7 +146,7 @@ void Avalot::setParent(AvalancheEngine *vm) { void Avalot::run(Common::String arg) { setup(); - _vm->_lucerna.load_also("1"); + _vm->_lucerna.load_also("9"); do { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index dbbcde1a62ea..68912c208fe2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -111,6 +111,7 @@ void Lucerna::unscramble() { scram1(_vm->_gyro.flags); /* for fz:=1 to length(_vm->_gyro.also[fv,ff]^) do _vm->_gyro.also[fv,ff]^[fz]:=chr(ord(_vm->_gyro.also[fv,ff]^[fz]) xor 177);*/ + warning("STUB: Lucerna::unscramble()"); } void Lucerna::load_also(char *n) { @@ -142,53 +143,50 @@ void Lucerna::load_also(char *n) { } memset(_vm->_gyro.lines, 0xFF, sizeof(_vm->_gyro.lines)); - - //fv = getpixel(0, 0); - warning("STUB: Lucerna::load_also()"); - + fv = f.readByte(); for (byte i = 0; i < fv; i++) { - _vm->_gyro.lines[i].col = f.readByte(); _vm->_gyro.lines[i].x1 = f.readSint16LE(); - _vm->_gyro.lines[i].x2 = f.readSint16LE(); _vm->_gyro.lines[i].y1 = f.readSint16LE(); + _vm->_gyro.lines[i].x2 = f.readSint16LE(); _vm->_gyro.lines[i].y2 = f.readSint16LE(); + _vm->_gyro.lines[i].col = f.readByte(); } memset(_vm->_gyro.peds, 177, sizeof(_vm->_gyro.peds)); fv = f.readByte(); for (byte i = 0; i < fv; i++) { - _vm->_gyro.peds[i].dir = f.readByte(); _vm->_gyro.peds[i].x = f.readSint16LE(); _vm->_gyro.peds[i].y = f.readSint16LE(); + _vm->_gyro.peds[i].dir = f.readByte(); } _vm->_gyro.numfields = f.readByte(); for (byte i = 0; i < _vm->_gyro.numfields; i++) { _vm->_gyro.fields[i].x1 = f.readSint16LE(); - _vm->_gyro.fields[i].x2 = f.readSint16LE(); _vm->_gyro.fields[i].y1 = f.readSint16LE(); + _vm->_gyro.fields[i].x2 = f.readSint16LE(); _vm->_gyro.fields[i].y2 = f.readSint16LE(); } for (byte i = 0; i < 15; i++) { - _vm->_gyro.magics[i].data = f.readUint16LE(); _vm->_gyro.magics[i].op = f.readByte(); + _vm->_gyro.magics[i].data = f.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro.portals[i].data = f.readUint16LE(); _vm->_gyro.portals[i].op = f.readByte(); + _vm->_gyro.portals[i].data = f.readUint16LE(); } + _vm->_gyro.flags.clear(); for (byte i = 0; i < 26; i++) _vm->_gyro.flags += f.readByte(); - int16 listen_length; - listen_length = f.readByte(); + int16 listen_length = f.readByte(); _vm->_gyro.listen.clear(); for (byte i = 0; i < listen_length; i++) - _vm->_gyro.listen.setChar(f.readByte(), i); + _vm->_gyro.listen += f.readByte(); draw_also_lines(); From 9a6684b37c5efe2e0c96be8bdcead9a51ca30ded Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 11:32:49 +0200 Subject: [PATCH 0087/1332] AVALANCHE: Celer: implement load_chunks() further. --- engines/avalanche/celer2.cpp | 17 ++++++++++++----- engines/avalanche/celer2.h | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 6bacde735d40..a106ce5e2a6d 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -281,7 +281,7 @@ void Celer::load_chunks(char *xx) { f.seek(44); num_chunks = f.readByte(); - for (int i = 0; i < num_chunks; i++) + for (byte i = 0; i < num_chunks; i++) offsets[i] = f.readSint32LE(); for (fv = 0; fv < num_chunks; fv++) { @@ -305,22 +305,29 @@ void Celer::load_chunks(char *xx) { memos[fv].flavour = ch.flavour; memos[fv].size = ch.size; - memory[fv] = malloc(ch.size); // Celer::forget_chunks() deallocates it. + memory[fv] = new byte[ch.size]; // Celer::forget_chunks() deallocates it. /*if (ch.natural) { getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); } else blockread(f, memory[fv], ch.size);*/ + warning("STUB: Celer::load_chunks()"); + + if (!ch.natural) + for (int32 i = 0; i < ch.size; i++) + memory[fv][i] = f.readByte(); } else memos[fv].x = on_disk; - } - f.close(); } void Celer::forget_chunks() { - warning("STUB: Celer::forget_chunks()"); + for (byte fv = 0; fv < num_chunks; fv ++) + if (memos[fv].x > on_disk) + delete[] memory[fv]; + + memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */ } void Celer::mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) { /* assembler; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index aa32bf58a2be..444a5aa94d30 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -61,7 +61,7 @@ class Celer { int32 offsets[40]; byte num_chunks; memotype memos[40]; - void *memory[40]; + byte *memory[40]; Common::File f; From 617898d42c996380d7f0253e9c7cf52cd50688ea Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 12:31:12 +0200 Subject: [PATCH 0088/1332] AVALANCHE: Celer: implement show_one(). --- engines/avalanche/celer2.cpp | 43 +++++++++++++++++++++++++++++++++++- engines/avalanche/celer2.h | 10 ++++----- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index a106ce5e2a6d..20413ff7d59c 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -272,7 +272,6 @@ void Celer::load_chunks(char *xx) { chunkblocktype ch; byte fv; - Common::String filename; filename = filename.format("chunk%s.avd", xx); if (!f.open(filename)) { warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); @@ -433,7 +432,49 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour } void Celer::show_one(byte which) { + chunkblocktype ch; + byte *p; + + //setactivepage(3); + warning("STUB: Celer::show_one()"); + + if (memos[which].x > on_disk) + display_it(memos[which].x, memos[which].y, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]); + else { + if (!f.open(filename)) { /* Filename was set in load_chunks() */ + warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + return; + } + + f.seek(offsets[which]); + + ch.flavour = flavourtype(f.readByte()); + ch.x = f.readSint16LE(); + ch.y = f.readSint16LE(); + ch.xl = f.readSint16LE(); + ch.yl = f.readSint16LE(); + ch.size = f.readSint32LE(); + ch.natural = f.readByte(); + ch.memorise = f.readByte(); + + + p = new byte[ch.size]; + + for (int32 i = 0; i < ch.size; i++) + p[i] = f.readByte(); + + display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, p); + + delete[] p; + + f.close(); + } + + //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); + + for (byte fv = 0; fv < 2; fv ++) + _vm->_trip.getset[fv].remember(r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 444a5aa94d30..a70c814d7a3a 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -62,11 +62,9 @@ class Celer { byte num_chunks; memotype memos[40]; byte *memory[40]; + bytefield r; - Common::File f; - - - + Celer(); void setParent(AvalancheEngine *vm); @@ -84,7 +82,9 @@ class Celer { private: AvalancheEngine *_vm; - //untyped_file f; /* Private variable- not accessible from elsewhere. */ + Common::String filename; + + Common::File f; static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ From 397ebad3851a989412dd052f5afd8554bc684091 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 12:33:15 +0200 Subject: [PATCH 0089/1332] AVALANCHE: Minor repairs regarding file handling. --- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 2dd2a28e0b4a..7485648eea5e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -527,7 +527,7 @@ void Gyro::load_a_mouse(byte which) { vmc.ofsx = -mps[which].horzhotspot; vmc.ofsy = -mps[which].verthotspot; - setminmaxhorzcurspos(mps[which].horzhotspot, 624 + mps[which].horzhotspot); + setminmaxhorzcurspos(mps[which].horzhotspot + 3, 624 + mps[which].horzhotspot); setminmaxvertcurspos(mps[which].verthotspot, 199); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 68912c208fe2..79dcd93dae8e 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -103,15 +103,12 @@ void Lucerna::scram1(Common::String &x) { } void Lucerna::unscramble() { - for (byte fv = 0; fv <= 30; fv ++) - for (byte ff = 0; ff <= 1; ff ++) + for (byte fv = 0; fv < 31; fv ++) + for (byte ff = 0; ff < 2; ff ++) if (_vm->_gyro.also[fv][ff] != 0) scram1(*_vm->_gyro.also[fv][ff]); scram1(_vm->_gyro.listen); scram1(_vm->_gyro.flags); - /* for fz:=1 to length(_vm->_gyro.also[fv,ff]^) do - _vm->_gyro.also[fv,ff]^[fz]:=chr(ord(_vm->_gyro.also[fv,ff]^[fz]) xor 177);*/ - warning("STUB: Lucerna::unscramble()"); } void Lucerna::load_also(char *n) { @@ -197,7 +194,6 @@ void Lucerna::load_also(char *n) { unscramble(); for (fv = 0; fv <= minnames; fv++) *_vm->_gyro.also[fv][0] = Common::String(',') + *_vm->_gyro.also[fv][0] + ','; - } void Lucerna::load(byte n) { /* Load2, actually */ From cc5e4bbad04459a075e9afbbe4d1fee25c02a29d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 15:30:26 +0200 Subject: [PATCH 0090/1332] AVALANCHE: Partly implement load() in Lucerna, change char * to Common::String in parameter lists. --- engines/avalanche/celer2.cpp | 4 +-- engines/avalanche/celer2.h | 2 +- engines/avalanche/lucerna2.cpp | 55 ++++++++++++++++++++++++++++++++-- engines/avalanche/lucerna2.h | 2 +- 4 files changed, 57 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 20413ff7d59c..eae8dcaab915 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -268,11 +268,11 @@ void Celer::pics_link() { } } -void Celer::load_chunks(char *xx) { +void Celer::load_chunks(Common::String xx) { chunkblocktype ch; byte fv; - filename = filename.format("chunk%s.avd", xx); + filename = filename.format("chunk%s.avd", xx.c_str()); if (!f.open(filename)) { warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); return; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index a70c814d7a3a..19f1871cf77a 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -71,7 +71,7 @@ class Celer { void pics_link(); - void load_chunks(char *xx); + void load_chunks(Common::String xx); void forget_chunks(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 79dcd93dae8e..d7e2814a74a4 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -111,7 +111,7 @@ void Lucerna::unscramble() { scram1(_vm->_gyro.flags); } -void Lucerna::load_also(char *n) { +void Lucerna::load_also(Common::String n) { byte ff, fv; for (fv = 0; fv < 31; fv++) @@ -122,7 +122,7 @@ void Lucerna::load_also(char *n) { } Common::String filename; - filename = filename.format("also%s.avd", n); + filename = filename.format("also%s.avd", n.c_str()); if (!f.open(filename)) { warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); return; @@ -200,8 +200,59 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte a0; /*absolute $A000:800;*/ byte a1; /*absolute $A000:17184;*/ byte bit; + Common::String xx; + bool was_virtual; + was_virtual = _vm->_gyro.visible == _vm->_gyro.m_virtual; + if (was_virtual) + _vm->_gyro.off_virtual(); + else + _vm->_gyro.off(); + + _vm->_gyro.clear_vmc(); + + xx = _vm->_gyro.strf(n); + flesh_colours(); + + Common::String filename; + filename = filename.format("place%s.avd", xx.c_str()); + if (!f.open(filename)) { + warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + return; + } + + f.seek(146); + for (byte i = 0; i < 30; i++) + _vm->_gyro.roomname += f.readByte(); + /* Compression method byte follows this... */ + + f.seek(177); warning("STUB: Lucerna::load()"); + for (bit = 0; bit <= 3; bit++) { + /*port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + move(a0, a1, 12080);*/ + } + + f.close(); + + load_also(xx); + _vm->_celer.load_chunks(xx); + + _vm->_pingo.copy03(); + + //bit = getpixel(0, 0); + warning("STUB: Lucerna::load()"); + + _vm->_logger.log_newroom(_vm->_gyro.roomname); + + if (was_virtual) + _vm->_gyro.on_virtual(); + else + _vm->_gyro.on(); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index c98687737b5a..f9d43f7c2abf 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -112,7 +112,7 @@ class Lucerna { void fix_flashers(); - void load_also(char *n); + void load_also(Common::String n); private: AvalancheEngine *_vm; From c6ff09a246dfa9049f917a36a3224f0d703b9c91 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 16:38:34 +0200 Subject: [PATCH 0091/1332] AVALANCHE: Lucerna: implement thinkabout(). Modify newpointer() in Gyro. --- engines/avalanche/gyro2.cpp | 13 +++++++ engines/avalanche/lucerna2.cpp | 68 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 7485648eea5e..2fe3b54920eb 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -271,7 +271,20 @@ void Gyro::setParent(AvalancheEngine *vm) { } void Gyro::newpointer(byte m) { + if (m == cmp) return; + cmp = m; + + /*r.ax = 9; + r.bx = (word)(mps[m].horzhotspot); + r.cx = (word)(mps[m].verthotspot); + r.es = seg(mps[m].mask); + r.dx = ofs(mps[m].mask); + intr(0x33, r); + + r is a 'registers' type variable of Gyro in the Pascal code.*/ + warning("STUB: Gyro::newpointer()"); + load_a_mouse(m); } void Gyro::wait() { /* makes hourglass */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d7e2814a74a4..29fac293e635 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -707,7 +707,75 @@ void Lucerna::enterroom(byte x, byte ped) { } void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! */ + const int16 x = 205; + const int16 y = 170; + const int16 picsize = 966; + const bytefield thinkspace = {25, 170, 32, 200}; + byte *p; + byte fv; + + + _vm->_gyro.thinks = z; + z--; + + if (th) { + /* Things */ + _vm->_gyro.wait(); + + p = new byte[picsize]; + + if (!f.open("thinks.avd")) { + warning("AVALANCHE: Lucerna: File not found: thinks.avd"); + return; + } + + f.seek(z * picsize + 65); + + for (int16 i = 0; i < picsize; i++) + p[i] = f.readByte(); + + _vm->_gyro.off(); + + f.close(); + } else { + /* People */ + _vm->_gyro.wait(); + + p = new byte[picsize]; + + if (!f.open("folk.avd")) { + warning("AVALANCHE: Lucerna: File not found: thinks.avd"); + return; + } + + fv = z - 149; + if (fv >= 25) + fv -= 8; + if (fv == 20) + fv--; /* Last time... */ + + f.seek(fv * picsize + 65); + + for (int16 i = 0; i < picsize; i++) + p[i] = f.readByte(); + + _vm->_gyro.off(); + + f.close(); + } + + /*setactivepage(3); + putimage(x, y, p, 0); + setactivepage(1 - cp);*/ warning("STUB: Lucerna::thinkabout()"); + + for (fv = 0; fv <= 1; fv ++) + _vm->_trip.getset[fv].remember(thinkspace); + + delete[] p; + + _vm->_gyro.on(); + _vm->_gyro.thinkthing = th; } void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ From fcaf659c7ab676fa9c6ccfe6a6b3b8a6e8f1eb9f Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 18:05:08 +0200 Subject: [PATCH 0092/1332] AVALANCHE: Lucerna: implement load_digits(). --- engines/avalanche/gyro2.h | 4 ++-- engines/avalanche/lucerna2.cpp | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index e83e0a96b98b..3852ef3bf208 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -523,8 +523,8 @@ class Gyro { bool ontoolbar, seescroll; char objlist[10]; - void * digit[10]; - void *rwlite[9]; + byte *digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + byte *rwlite[9]; // Maybe it will be needed to move them to the class itself instead. byte oldrw; Common::String lastscore; byte cmp; /* current mouse-void **/ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 29fac293e635..da2aaae0271c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -744,7 +744,7 @@ void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! * p = new byte[picsize]; if (!f.open("folk.avd")) { - warning("AVALANCHE: Lucerna: File not found: thinks.avd"); + warning("AVALANCHE: Lucerna: File not found: folk.avd"); return; } @@ -779,7 +779,26 @@ void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! * } void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ - warning("STUB: Lucerna::load_digits()"); + const byte digitsize = 134; + const byte rwlitesize = 126; + + if (!f.open("digit.avd")) { + warning("AVALANCHE: Lucerna: File not found: digit.avd"); + return; + } + + for (byte fv = 0; fv < 10; fv ++) { + _vm->_gyro.digit[fv] = new byte[digitsize]; + for (byte i = 0; i < digitsize; i++) + _vm->_gyro.digit[fv][i] = f.readByte(); + } + + for (byte ff = 0; ff < 9; ff ++) { + _vm->_gyro.digit[ff] = new byte[rwlitesize]; + for (byte i = 0; i < rwlitesize; i++) + _vm->_gyro.digit[ff][i] = f.readByte(); + } + f.close(); } void Lucerna::toolbar() { From 14dfc468ea8cf80048d23c531bdb6ce0c945cf46 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 18:28:43 +0200 Subject: [PATCH 0093/1332] AVALANCHE: Lucerna: implement toolbar(). --- engines/avalanche/lucerna2.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index da2aaae0271c..3dc69d59685b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -802,7 +802,38 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ } void Lucerna::toolbar() { + uint16 s; + byte *p; + + if (!f.open("useful.avd")) { + warning("AVALANCHE: Lucerna: File not found: useful.avd"); + return; + } + + s = f.size() - 40; + p = new byte[s]; + f.seek(40); + for (uint16 i = 0; i < s; i++) + p[i] = f.readByte(); + f.close(); + /* off;*/ + + //setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ + //setfillstyle(1, 6); + //for (byte fv = 0; fv <= 1; fv ++) { + // setactivepage(fv); + // putimage(5, 169, p, 0); + // if (demo) { + // bar(264, 177, 307, 190); + // outtextxy(268, 188, "Demo!"); /* well... actually only white now. */ + // } + //} warning("STUB: Lucerna::toolbar()"); + + /* on;*/ + delete[] p; + _vm->_gyro.oldrw = 177; + showrw(); } void Lucerna::showscore() { From 0f2a0cf2a48a35cf54d4a1bc2af0062b36861533 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 19:00:31 +0200 Subject: [PATCH 0094/1332] AVALANCHE: Pingo: partially implement winning_pic(). --- engines/avalanche/pingo2.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 92c22e65bfb4..7a468d4e4199 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -36,6 +36,7 @@ #include "avalanche/scrolls2.h" #include "common/textconsole.h" +#include "common/file.h" namespace Avalanche { @@ -107,6 +108,38 @@ void Pingo::zonk() { } void Pingo::winning_pic() { + Common::File f; + char r; + + _vm->_lucerna.dusk(); + + if (!f.open("finale.avd")) { + warning("AVALANCHE: Lucerna: File not found: finale.avd"); + return; + } + + /*for (byte bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * 0], 16000); + }*/ + warning("STUB: Pingo::winning_pic()"); + + f.close(); + _vm->_lucerna.blitfix(); + + //setvisualpage(0); + warning("STUB: Pingo::winning_pic()"); + + _vm->_lucerna.dawn(); + + /*do { + _vm->_gyro.check(); + } while (!(keypressed() || (mrelease > 0))); + while (keypressed()) r = readkey(); + major_redraw();*/ warning("STUB: Pingo::winning_pic()"); } From 755d07a8dea913cbbd0137aae089379c42a5af99 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 5 Jul 2013 23:13:33 +0200 Subject: [PATCH 0095/1332] AVALANCHE: Scrolls: implement file handling. --- engines/avalanche/scrolls2.cpp | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4bb4f9d87c11..8bf53cbed1aa 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -41,6 +41,7 @@ #include "avalanche/basher2.h" #include "common/textconsole.h" +#include "common/file.h" //#include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... @@ -134,11 +135,55 @@ void Scrolls::undodgem() { /* This is the opposite of Dodgem. It moves the } void Scrolls::geticon(int16 x, int16 y, byte which) { + Common::File f; + byte *p; + + if (!f.open("icons.avd")) { + warning("AVALANCHE: Scrolls: File not found: icons.avd"); + return; + } + + which--; + f.seek(which * 426); + + p = new byte[426]; + for (int16 i = 0; i < 426; i++) + p[i] = f.readByte(); + + //putimage(x, y, p, 0); warning("STUB: Scrolls::geticon()"); + + delete[] p; + f.close(); } void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { + Common::File f; + byte bit; + int16 fv; + uint16 st; + + st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro.cp) * _vm->_gyro.pagetop); + + Common::String filename; + filename = filename.format("%s.avd", fn.c_str()); + if (!f.open(filename)) { + warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); + return; + } + + /*for (fv = 1; fv <= yl; fv ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * st + (fv * 80)], xl); + } + bit = getpixel(0, 0);*/ warning("STUB: Scrolls::block_drop()"); + + f.close(); } void Scrolls::drawscroll(func2 gotoit) { /* This is one of the oldest func2s in the game. */ From 8a44a94bb66cf9fc6b0979245198526a4e7cf6cc Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 10:13:53 +0200 Subject: [PATCH 0096/1332] AVALANCHE: Celer: implement show_one_at(). --- engines/avalanche/celer2.cpp | 47 +++++++++++++++++++++++++++++++----- engines/avalanche/celer2.h | 2 +- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index eae8dcaab915..b6257d77e552 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -457,16 +457,12 @@ void Celer::show_one(byte which) { ch.natural = f.readByte(); ch.memorise = f.readByte(); - p = new byte[ch.size]; - - for (int32 i = 0; i < ch.size; i++) - p[i] = f.readByte(); + f.read(p, ch.size); display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, p); delete[] p; - f.close(); } @@ -479,12 +475,51 @@ void Celer::show_one(byte which) { -void Celer::display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { +void Celer::display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { warning("STUB: Celer::display_it1()"); } void Celer::show_one_at(byte which, int16 xxx, int16 yyy) { + chunkblocktype ch; + byte *p; + + //setactivepage(3); warning("STUB: Celer::show_one_at()"); + + if (memos[which].x > on_disk) { + display_it_at(memos[which].xl, memos[which].yl, memos[which].flavour, memory[which], xxx, yyy); + } else { + if (!f.open(filename)) { /* Filename was set in load_chunks() */ + warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + return; + } + + f.seek(offsets[which]); + ch.flavour = flavourtype(f.readByte()); + ch.x = f.readSint16LE(); + ch.y = f.readSint16LE(); + ch.xl = f.readSint16LE(); + ch.yl = f.readSint16LE(); + ch.size = f.readSint32LE(); + ch.natural = f.readByte(); + ch.memorise = f.readByte(); + + { + p = new byte[ch.size]; + f.read(p, ch.size); + + display_it_at(ch.xl, ch.yl, ch.flavour, p, xxx, yyy); + + delete[] p; + f.close(); + } + } + + //setactivepage(1 - cp); + warning("STUB: Celer::show_one_at()"); + + for (byte fv = 0; fv < 2; fv ++) + _vm->_trip.getset[fv].remember(r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 19f1871cf77a..88baa3df5e37 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -92,7 +92,7 @@ class Celer { void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p); - void display_it1(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); + void display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); }; } // End of namespace Avalanche. From f01cbaa4e1d9d8126d6ed16d61365841f6459708 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 10:14:28 +0200 Subject: [PATCH 0097/1332] AVALANCHE: Enid: update header. --- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/enid2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index f0488db78a29..107330a678e4 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* ENID Edna's manager. */ +/* ENID Edna's manager. Loads/saves files. */ #include "avalanche/avalanche.h" diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 8c02ef194a0c..87b81d39913e 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* ENID Edna's manager. */ +/* ENID Edna's manager. Loads/saves files. */ #ifndef ENID2_H #define ENID2_H From 2d4f710c9c14d93dabae061f54db22932e7140d9 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 17:20:42 +0200 Subject: [PATCH 0098/1332] AVALANCHE: Trip: implement triptype::init(). --- engines/avalanche/trip6.cpp | 94 +++++++++++++++++++++++++++++++++++-- engines/avalanche/trip6.h | 6 +-- 2 files changed, 94 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 7fe643c9da8d..f5faa5b77c31 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -41,6 +41,7 @@ #include "common/scummsys.h" #include "common/textconsole.h" +#include "common/file.h" /*#include "Dropdown.h"*/ @@ -48,10 +49,97 @@ namespace Avalanche { -triptype *triptype::init(byte spritenum, bool do_check, Trip *tr) { - warning("STUB: Trip::init()"); +void triptype::init(byte spritenum, bool do_check, Trip *tr) { + const int32 idshould = -1317732048; + int16 gd, gm; + byte fv/*,nds*/; + int32 id; + uint16 soa; + Common::File inf; + + if (spritenum == 177) + return; /* Already running! */ + + Common::String filename; + filename = filename.format("sprite%d.avd", spritenum); + if (!inf.open(filename)) { + warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); + return; + } + + inf.seek(177); + + id = inf.readSint32LE(); + if (id != idshould) { + //output << '\7'; + inf.close(); + return; + } + + soa = inf.readUint16LE(); // Only used in the original code. + // I use it just to jump forward in the file. Should be replaced with seek(). + + byte size = inf.readByte(); // Same purpose as soa. + for (byte i = 0; i < 12; i++) { + byte be = inf.readByte(); + a.name += be; + } + + size = inf.readByte(); // Same purpose as soa. + for (byte i = 0; i < 16; i++) { + byte be = inf.readByte(); + a.comment += be; + } + + a.num = inf.readByte(); + a.xl = inf.readByte(); + a.yl = inf.readByte(); + a.seq = inf.readByte(); + a.size = inf.readUint16LE(); + a.fgc = inf.readByte(); + a.bgc = inf.readByte(); + a.accinum = inf.readByte(); + + totalnum = 0; // = 1; + xw = a.xl / 8; + if ((a.xl % 8) > 0) + xw++; + for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { + + sil[totalnum] = new siltype[11 * (a.yl + 1)]; + //getmem(sil[totalnum-1], 11 * (a.yl + 1)); + mani[totalnum] = new manitype[a.size - 6]; + //getmem(mani[totalnum-1], a.size - 6); + for (fv = 0; fv <= a.yl; fv ++) + inf.read((*sil[totalnum])[fv], xw); + //blockread(inf, (*sil[totalnum-1])[fv], xw); + inf.read(*mani[totalnum], a.size - 6); + //blockread(inf, *mani[totalnum-1], a.size - 6); + + totalnum ++; + } + + /* on; */ + x = 0; + y = 0; + quick = true; + visible = false; + xs = 3; + ys = 1; + /* if spritenum=1 then newspeed; { Just for the lights. }*/ + + homing = false; + ix = 0; + iy = 0; + step = 0; + check_me = do_check; + count = 0; + whichsprite = spritenum; + vanishifstill = false; + call_eachstep = false; + inf.close(); + _tr = tr; - return this; } void triptype::original() { diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 954b870f1bb8..1c4503750849 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -44,8 +44,8 @@ typedef byte manitype[2049]; // manitype = array[5..2053] of byte; typedef byte siltype[51][11]; /* 35, 4 */ struct adxtype { /* Second revision of ADX type */ - Common::String name; /* name of character */ - Common::String comment; /* comment */ + Common::String name/*[13]*/; /* name of character */ // uruk: Note to self: TRAILING /0 !!! Real size: 12 + Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. byte num; /* number of pictures */ byte xl, yl; /* x & y lengths of pictures */ byte seq; /* how many in one stride */ @@ -99,7 +99,7 @@ class triptype { bool call_eachstep; /* Do we call the eachstep procedure? */ byte eachstep; - triptype *init(byte spritenum, bool do_check, Trip *tr); + void init(byte spritenum, bool do_check, Trip *tr); /* loads & sets up the sprite */ void original(); /* just sets Quick to false */ void andexor(); /* drops sprite onto screen */ From 848860a5fb556dad3d22e882cbfca73bda6da500 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 18:17:02 +0200 Subject: [PATCH 0099/1332] AVALANCHE: Trip: modify trptype::init(), minor modifications in other functions parameter lists. --- engines/avalanche/trip6.cpp | 45 ++++++++++++++++++------------------- engines/avalanche/trip6.h | 4 ++-- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f5faa5b77c31..3bc6d4c734d7 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -54,7 +54,6 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { int16 gd, gm; byte fv/*,nds*/; int32 id; - uint16 soa; Common::File inf; if (spritenum == 177) @@ -76,20 +75,15 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { return; } - soa = inf.readUint16LE(); // Only used in the original code. - // I use it just to jump forward in the file. Should be replaced with seek(). + inf.skip(2); // Replace variable named 'soa' in the original code. - byte size = inf.readByte(); // Same purpose as soa. - for (byte i = 0; i < 12; i++) { - byte be = inf.readByte(); - a.name += be; - } - - size = inf.readByte(); // Same purpose as soa. - for (byte i = 0; i < 16; i++) { - byte be = inf.readByte(); - a.comment += be; - } + inf.skip(1); // We don't need to read the size of the string as in the original code. + for (byte i = 0; i < 12; i++) + a.name += inf.readByte(); + + inf.skip(1); // Same as above. + for (byte i = 0; i < 16; i++) + a.comment += inf.readByte(); a.num = inf.readByte(); a.xl = inf.readByte(); @@ -148,7 +142,7 @@ void triptype::original() { } void triptype::andexor() { - warning("STUB: Trip::andexor()"); + warning("STUB: triptype::andexor()"); } void triptype::turn(byte whichway) { @@ -183,7 +177,7 @@ bool triptype::collision_check() { } void triptype::walk() { - warning("STUB: Trip::walk()"); + warning("STUB: triptype::walk()"); } void triptype::bounce() { @@ -328,20 +322,20 @@ void triptype::unload_saver(trip_saver_type v) { vanishifstill = v.vanishifstill; } -void triptype::savedata(/*untyped_file &f*/) { - warning("STUB: _vm->_timeout.savedata()"); +void triptype::savedata(Common::File &f) { + warning("STUB: triptype::savedata()"); } -void triptype::loaddata(/*untyped_file &f*/) { - warning("STUB: _vm->_timeout.loaddata()"); +void triptype::loaddata(Common::File &f) { + warning("STUB: triptype::loaddata()"); } void triptype::save_data_to_mem(uint16 &where) { - warning("STUB: save_data_to_mem()"); + warning("STUB: triptype::save_data_to_mem()"); } void triptype::load_data_from_mem(uint16 &where) { - warning("STUB: load_data_from_mem()"); + warning("STUB: triptype::load_data_from_mem()"); } triptype *triptype::done() { @@ -376,7 +370,7 @@ getsettype *getsettype::init() { void getsettype::remember(bytefield r) { numleft++; - warning("STUB: _vm->_timeout.getsettype::remember()"); + warning("STUB: getsettype::remember()"); gs[numleft] = r; } @@ -385,6 +379,11 @@ void getsettype::recall(bytefield &r) { numleft--; } + + + + + Trip::Trip() { getsetclear(); mustexclaim = false; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 1c4503750849..bbb47852bc04 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -116,8 +116,8 @@ class triptype { void set_up_saver(trip_saver_type &v); void unload_saver(trip_saver_type v); - void savedata(/*untyped_file &f*/); /* Self-explanatory, */ - void loaddata(/*untyped_file &f*/); /* really. */ + void savedata(Common::File &f); /* Self-explanatory, */ + void loaddata(Common::File &f); /* really. */ void save_data_to_mem(uint16 &where); void load_data_from_mem(uint16 &where); From a394fea15d4991128fdaa452698c2f926032527e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 18:40:29 +0200 Subject: [PATCH 0100/1332] AVALANCHE: Add a comment to Gyro, remove test line from Avalot. --- engines/avalanche/avalot.cpp | 3 --- engines/avalanche/gyro2.cpp | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 67b543b11165..ae437a66cc64 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -146,9 +146,6 @@ void Avalot::setParent(AvalancheEngine *vm) { void Avalot::run(Common::String arg) { setup(); - _vm->_lucerna.load_also("9"); - - do { _vm->_lucerna.clock_lucerna(); _vm->_basher.keyboard_link(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 2fe3b54920eb..6c5d960160f7 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -501,6 +501,7 @@ void Gyro::setup_vmc() { vmc.andpic = new byte[mouse_size]; vmc.xorpic = new byte[mouse_size]; + /* Released in Gyro's destructor. */ for (int fv = 0; fv < 2; fv ++) { vmc.backpic[fv] = new byte[mouse_size]; vmc.wherewas[fv].x = 32767; From 2c0b69437161d03cf08f8b8da5b45af4c3e5696d Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 18:54:53 +0200 Subject: [PATCH 0101/1332] AVALANCHE: update file handling in multiple files. --- engines/avalanche/celer2.cpp | 4 +--- engines/avalanche/gyro2.cpp | 6 ++---- engines/avalanche/lucerna2.cpp | 16 ++++++---------- engines/avalanche/scrolls2.cpp | 3 +-- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index b6257d77e552..cc440215319d 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -296,7 +296,6 @@ void Celer::load_chunks(Common::String xx) { ch.memorise = f.readByte(); if (ch.memorise) { - memos[fv].x = ch.x; memos[fv].xl = ch.xl; memos[fv].y = ch.y; @@ -313,8 +312,7 @@ void Celer::load_chunks(Common::String xx) { warning("STUB: Celer::load_chunks()"); if (!ch.natural) - for (int32 i = 0; i < ch.size; i++) - memory[fv][i] = f.readByte(); + f.read(memory[fv], ch.size); } else memos[fv].x = on_disk; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 6c5d960160f7..faafdcd7641c 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -530,11 +530,9 @@ void Gyro::load_a_mouse(byte which) { f.seek(mouse_size * 2 * (which - 1) + 134); - for (int i = 0; i < mouse_size; i++) - vmc.andpic[i] = f.readByte(); + f.read(vmc.andpic, mouse_size); - for (int i = 0; i < mouse_size; i++) - vmc.xorpic[i] = f.readByte(); + f.read(vmc.xorpic, mouse_size); f.close(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3dc69d59685b..9feca692579b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -731,8 +731,7 @@ void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! * f.seek(z * picsize + 65); - for (int16 i = 0; i < picsize; i++) - p[i] = f.readByte(); + f.read(p, picsize); _vm->_gyro.off(); @@ -756,8 +755,7 @@ void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! * f.seek(fv * picsize + 65); - for (int16 i = 0; i < picsize; i++) - p[i] = f.readByte(); + f.read(p, picsize); _vm->_gyro.off(); @@ -789,15 +787,14 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ for (byte fv = 0; fv < 10; fv ++) { _vm->_gyro.digit[fv] = new byte[digitsize]; - for (byte i = 0; i < digitsize; i++) - _vm->_gyro.digit[fv][i] = f.readByte(); + f.read(_vm->_gyro.digit[fv], digitsize); } for (byte ff = 0; ff < 9; ff ++) { _vm->_gyro.digit[ff] = new byte[rwlitesize]; - for (byte i = 0; i < rwlitesize; i++) - _vm->_gyro.digit[ff][i] = f.readByte(); + f.read(_vm->_gyro.digit[ff], rwlitesize); } + f.close(); } @@ -813,8 +810,7 @@ void Lucerna::toolbar() { s = f.size() - 40; p = new byte[s]; f.seek(40); - for (uint16 i = 0; i < s; i++) - p[i] = f.readByte(); + f.read(p, s); f.close(); /* off;*/ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8bf53cbed1aa..d4a7752e6efc 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -147,8 +147,7 @@ void Scrolls::geticon(int16 x, int16 y, byte which) { f.seek(which * 426); p = new byte[426]; - for (int16 i = 0; i < 426; i++) - p[i] = f.readByte(); + f.read(p, 426); //putimage(x, y, p, 0); warning("STUB: Scrolls::geticon()"); From 223c2d82e56c3fc20100090a3263627b3066d73c Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 9 Jul 2013 22:18:29 +0200 Subject: [PATCH 0102/1332] AVALANCHE: Implement file handling in Visa. --- engines/avalanche/visa2.cpp | 101 ++++++++++++++++++++++++++++++++++-- engines/avalanche/visa2.h | 4 +- 2 files changed, 98 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index e53f55aef408..ea5144f2a9e1 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -45,8 +45,8 @@ namespace Avalanche { _vm = vm; } - const bool Visa::bubbling = false; - const bool Visa::report_dixi_errors = true; + bool Visa::bubbling = false; + bool Visa::report_dixi_errors = true; void Visa::unskrimble() { for (uint16 fv = 0; fv < _vm->_gyro.bufsize; fv++) @@ -58,13 +58,104 @@ namespace Avalanche { _vm->_gyro.buffer[_vm->_gyro.bufsize] = 2; } - // File handling. void Visa::dixi(char block, byte point) { - warning("STUB: Visa::dixi()"); + Common::File indexfile, sezfile; + uint16 idx_offset, sez_offset; + bool error = false; + + if (!indexfile.open("avalot.idx")) { + warning("AVALANCHE: Visa: File not found: avalot.idx"); + return; + } + + indexfile.seek((toupper(block) - 65) * 2); + idx_offset = indexfile.readUint16LE(); + if (idx_offset == 0) + error = true; + + indexfile.seek(idx_offset + point * 2); + sez_offset = indexfile.readUint16LE(); + if (sez_offset == 0) + error = true; + + indexfile.close(); + + went_ok = !error; + + if (error) { + if (report_dixi_errors) { + Common::String todisplay; + todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro.strf(point).c_str()); + _vm->_scrolls.display(todisplay); + } + return; + } + + if (!sezfile.open("avalot.sez")) { + warning("AVALANCHE: Visa: File not found: avalot.sez"); + return; + } + sezfile.seek(sez_offset); + _vm->_gyro.bufsize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro.buffer, _vm->_gyro.bufsize); + sezfile.close(); + unskrimble(); + + if (bubbling) do_the_bubble(); + + _vm->_scrolls.calldrivers(); } - // File handling. void Visa::speech(byte who, byte subject) { + Common::File indexfile, sezfile; + uint16 idx_offset, sez_offset, next_idx_offset; + + if (subject == 0) { + /* No subject. */ + + bubbling = true; + report_dixi_errors = false; + dixi('s', who); + bubbling = false; + report_dixi_errors = true; + } else { + /* Subject given. */ + + went_ok = false; /* Assume that until we know otherwise. */ + + if (!indexfile.open("converse.avd")) { + warning("AVALANCHE: Visa: File not found: converse.avd"); + return; + } + + indexfile.seek(who * 2 - 2); + idx_offset = indexfile.readUint16LE(); + next_idx_offset = indexfile.readUint16LE(); + + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; + + indexfile.seek(idx_offset + subject * 2); + sez_offset = indexfile.readUint16LE(); + if ((sez_offset == 0) || (indexfile.err())) + return; + indexfile.close(); + + if (!sezfile.open("avalot.sez")) { + warning("AVALANCHE: Visa: File not found: avalot.sez"); + return; + } + sezfile.seek(sez_offset); + _vm->_gyro.bufsize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro.buffer, _vm->_gyro.bufsize); + sezfile.close(); + + unskrimble(); + do_the_bubble(); + + _vm->_scrolls.calldrivers(); + went_ok = true; + } + warning("STUB: Visa::speech()"); } diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 6749a1dbbda8..e33045c37436 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -46,8 +46,8 @@ class Visa { private: AvalancheEngine *_vm; - static const bool bubbling; - static const bool report_dixi_errors; + static bool bubbling; + static bool report_dixi_errors; bool went_ok; From c90357724fa6602b3b54bfcac401b520226a2740 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 10 Jul 2013 12:34:46 +0200 Subject: [PATCH 0103/1332] AVALANCHE: Implement Basher's initialization. --- engines/avalanche/basher2.cpp | 35 ++++++++++++++++++++++++++++++----- engines/avalanche/basher2.h | 4 ++-- engines/avalanche/gyro2.h | 4 +++- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 61ad226495ce..176cbfcc3148 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -48,15 +48,36 @@ #include "common/textconsole.h" namespace Avalanche { - -Basher::Basher() { - warning("STUB: Basher::Basher()"); -} + void Basher::setParent(AvalancheEngine *vm) { _vm = vm; } +void Basher::init() { + /* new(previous);*/ + if (!_vm->_gyro.last.empty()) + _vm->_gyro.last.clear(); + + normal_edit(); + + if (_vm->_gyro.demo) { + if (!_vm->_gyro.demofile.open("demo.avd")) { + warning("AVALANCHE: Basher: File not found: demo.avd"); + throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. + } + } + +// Not sure that the following part will be used ever... +#ifdef RECORD + count = 0; + if (!_vm->_gyro.demofile_save.open("demo.avd")) { + warning("AVALANCHE: Basher: File not found: demo.avd"); + throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. + } +#endif +} + void Basher::plottext() { warning("STUB: Basher::plottext()"); } @@ -161,7 +182,11 @@ void Basher::filename_edit() { } void Basher::normal_edit() { - warning("STUB: Basher::normal_edit()"); + entering_filename = false; + /*if (!_vm->_gyro.current.empty()) + _vm->_gyro.current.clear();*/ + left_margin = 1; + _vm->_gyro.curpos = 1; } } // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index 326ea93dc5a0..1a97a8568ee5 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -45,10 +45,10 @@ class Basher { - Basher(); - void setParent(AvalancheEngine *vm); + void init(); + void plottext(); void keyboard_link(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 3852ef3bf208..5c40b421cb87 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -32,6 +32,7 @@ #include "common/str.h" #include "common/scummsys.h" +#include "common/file.h" #include "avalanche/roomnums.h" #include "avalanche/color.h" @@ -582,7 +583,8 @@ class Gyro { /* For the demo: */ demo_type demo_rec; - //file demofile; // http://www.freepascal.org/docs-html/ref/refsu21.html#x45-520003.3.4 + Common::File demofile; // of demo_type + Common::DumpFile demofile_save; // uruk added it - first use located in constructor of Basher char last_person; /* Last person to have been selected using the People menu. */ From 11cbacfe9dffb8d555addb0464a7f0cebf914ef4 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 10 Jul 2013 13:26:49 +0200 Subject: [PATCH 0104/1332] AVALANCHE: Implement file loadfont() in Scrolls. Move initializations to run(), so loadfont() can access the data files of the game. --- engines/avalanche/avalanche.cpp | 17 ++++++++++++----- engines/avalanche/scrolls2.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a510718d4a52..98e8865e769b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -53,15 +53,15 @@ namespace Avalanche { _enhanced.setParent(this); _logger.setParent(this); _pingo.setParent(this); - _scrolls.setParent(this); _scrolls.init(); + _scrolls.setParent(this); _visa.setParent(this); - _lucerna.setParent(this); _lucerna.init(); + _lucerna.setParent(this); _enid.setParent(this); _celer.setParent(this); _sequence.setParent(this); _timeout.setParent(this); _trip.setParent(this); - _acci.setParent(this); _acci.init(); + _acci.setParent(this); _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); @@ -230,8 +230,10 @@ namespace Avalanche { void AvalancheEngine::run_avalot() { bflight_on(); - _avalot.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them + _avalot.run(Common::String(runcodes[first_time]) + arguments); + // TODO: Check if parameteres are ever used (probably not) and eventually remove them. // If there's an error initalizing avalot, i'll handle it in there, not here + first_time = false; } @@ -242,7 +244,10 @@ namespace Avalanche { initGraphics(320, 200, false); _console = new AvalancheConsole(this); - + _scrolls.init(); + _lucerna.init(); + _acci.init(); + _basher.init(); // From bootstrp: @@ -257,6 +262,8 @@ namespace Avalanche { if (!zoomy) call_menu(); /* Not run when zoomy. */ + + do { run_avalot(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index d4a7752e6efc..ca0ac3071eca 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -254,7 +254,31 @@ void Scrolls::display(Common::String z) { } void Scrolls::loadfont() { - warning("STUB: Scrolls::loadfont()"); + Common::File f; + + if (!f.open("avalot.fnt")) { + warning("AVALANCHE: Scrolls: File not found: avalot.fnt"); + return; + } + for (int16 i = 0; i < 256; i++) + f.read(ch[0][i],16); + f.close(); + + if (!f.open("avitalic.fnt")) { + warning("AVALANCHE: Scrolls: File not found: avitalic.fnt"); + return; + } + for (int16 i = 0; i < 256; i++) + f.read(ch[1][i],16); + f.close(); + + if (!f.open("ttsmall.fnt")) { + warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); + return; + } + for (int16 i = 0; i < 256; i++) + f.read(_vm->_gyro.little[i],16); + f.close(); } void Scrolls::okay() { From c99abdeb6115c54a0c7bec21f52114a4086e90cc Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 10 Jul 2013 14:48:10 +0200 Subject: [PATCH 0105/1332] AVALANCHE: Implement log_epsonroman() in Logger. --- engines/avalanche/logger2.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index c709e686e9e9..eeedb2301ef7 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -54,17 +54,17 @@ const char Logger::divide[] = "--- oOo ---"; /* L'jet codes: */ -//// Not sure if these will be needed at all... -// -//const Common::String startwith = Common::String('\33') + '\50' + "10J" + '\130'; -//const Common::String endwith = Common::String('\33') + '\105'; -//const Common::String italic = Common::String('\33') + '\50' + '\163' + '\61' + '\123'; /* switches italics on... */ -//const Common::String italic_off = Common::String('\33') + '\50' + '\163' + '\60' + '\123'; /* and off. */ -//const Common::String emph_on = Common::String('\33') + '\50' + '\163' + '\63' + '\102'; -//const Common::String emph_off = Common::String('\33') + '\50' + '\163' + '\60' + '\102'; -// -//const Common::String double_width = emph_on; /* There IS no double-width. */ -//const Common::String double_off = emph_off; /* So we'll have to use bold. */ +// Not sure if these will be needed at all... + +const Common::String startwith = Common::String(33) + 50 + "10J" + 130; +const Common::String endwith = Common::String(33) + 105; +const Common::String italic = Common::String(33) + 50 + 163 + 61 + 123; /* switches italics on... */ +const Common::String italic_off = Common::String(33) + 50 + 163 + 60 + 123; /* and off. */ +const Common::String emph_on = Common::String(33) + 50 + 163 + 63 + 102; +const Common::String emph_off = Common::String(33) + 50 + 163 + 60 + 102; + +const Common::String double_width = emph_on; /* There IS no double-width. */ +const Common::String double_off = emph_off; /* So we'll have to use bold. */ @@ -197,10 +197,8 @@ void Logger::log_epsonroman() { /* This only sends the Roman code if you're on if (!_vm->_gyro.logging) return; - warning("STUB: Logger::log_epsonroman()"); - - //if (_vm->_gyro.log_epson) - // log_addstuff(italic_off); + if (_vm->_gyro.log_epson) + log_addstuff(italic_off); } void Logger::log_scrollline() { /* Set up a line for the scroll driver */ From 4656a7a285c48427691cc9ee70d3afe6adbdc5d4 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 11 Jul 2013 10:07:53 +0200 Subject: [PATCH 0106/1332] AVALANCHE: Don't call the menu by default. --- engines/avalanche/avalanche.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 98e8865e769b..94b2b1611516 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -256,8 +256,8 @@ namespace Avalanche { get_arguments(); get_slope(); - zoomy = false; - // Call the menu by default. Might be modified later, if get_slope() gets implemented, + zoomy = true; + // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. if (!zoomy) call_menu(); /* Not run when zoomy. */ From 6b87fc4f45d99d8d6f69984afa9bd408ccacd887 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 11 Jul 2013 10:36:41 +0200 Subject: [PATCH 0107/1332] AVALANCHE: Little revision in Gyro. --- engines/avalanche/gyro2.cpp | 5 +---- engines/avalanche/gyro2.h | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index faafdcd7641c..8319c17ef7b2 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -194,7 +194,7 @@ const tunetype Gyro::tune = { lower, same, lower, higher, same, lower, higher }; -const byte Gyro::static_const_whereis[29] = { +byte Gyro::whereis[29] = { /* The Lads */ r__yours, /* Avvy */ r__spludwicks, /* Spludwick */ @@ -245,9 +245,6 @@ const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro() : interrogation(0), oncandopageswap(true) { - for (int i = 0; i < 29; i++) - whereis[i] = static_const_whereis[i]; - /* Needed becouse of Lucerna::load_also() */ for (int fv = 0; fv < 31; fv++) for (int ff = 0; ff < 2; ff++) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 5c40b421cb87..39fabf8cced6 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -460,8 +460,6 @@ class Gyro { static const int16 runerr_getset_overflow = 50; - static const byte static_const_whereis[29]; - @@ -472,7 +470,7 @@ class Gyro { the DNA in a position dictated by the value. If a scroll comes up, or you leave the room, it's automatically set to zero. */ - byte whereis[29]; + static byte whereis[29]; bool oncandopageswap; /* Variable static constant for overriding the ability of On to switch pages. From 0aaffcfb941c95141eaa400082ee943463360068 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 11 Jul 2013 17:36:59 +0200 Subject: [PATCH 0108/1332] AVALANCHE: Add Graph. --- engines/avalanche/graph.cpp | 88 +++++++++++++++++++++++++++++++++++++ engines/avalanche/graph.h | 69 +++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 engines/avalanche/graph.cpp create mode 100644 engines/avalanche/graph.h diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp new file mode 100644 index 000000000000..30dd20aa2ff8 --- /dev/null +++ b/engines/avalanche/graph.cpp @@ -0,0 +1,88 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Replacement class for the Graph unit from Pascal. */ + +#include "avalanche/avalanche.h" +#include "avalanche/graph.h" + +#include "common/system.h" + +#include "engines/util.h" + +#include "graphics/palette.h" + +namespace Avalanche { + +const byte Graph::ega_palette_index[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; + +const byte Graph::ega_palette[64][3] = +{ + {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, + {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, + {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, + {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, + {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, + {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, + {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, + {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f} +}; + + + + +void Graph::setParent(AvalancheEngine *vm) { + _vm = vm; +} + +void Graph::init() { + initGraphics(_screenWidth, _screenHeight, false); + + for (byte i = 0; i < 16; i++) + g_system->getPaletteManager()->setPalette(ega_palette[ega_palette_index[i]], i, 1); + + _surface.create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8()); +} + +Graph::~Graph() { + _surface.free(); +} + +byte *Graph::getPixel(int16 x, int16 y) { + return (byte *)_surface.getBasePtr(x, y); +} + +void Graph::setPixel(byte *pixel, byte color) { + memset(pixel, color, 1); +} + +void Graph::drawToScreen() { + g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, _screenWidth, _screenHeight); + g_system->updateScreen(); +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h new file mode 100644 index 000000000000..9ddd69f1adee --- /dev/null +++ b/engines/avalanche/graph.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Replacement class for the Graph unit from Pascal. */ + +#ifndef GRAPH_H +#define GRAPH_H + +#include "graphics/surface.h" + +namespace Avalanche { +class AvalancheEngine; + +class Graph { +public: + static const int16 _screenWidth = 320; + static const int16 _screenHeight = 200; + + + + void setParent(AvalancheEngine *vm); + + void init(); + + ~Graph(); + + byte *getPixel(int16 x, int16 y); + + void setPixel(byte *pixel, byte color); + + void drawToScreen(); + +private: + AvalancheEngine *_vm; + + Graphics::Surface _surface; + + static const byte ega_palette_index[16]; + + static const byte ega_palette[64][3]; +}; + +} // End of namespace Avalanche + +#endif // GRAPH_H From 096bd2df76b6132dad8ccefb2a212dbc53218870 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 11 Jul 2013 18:02:15 +0200 Subject: [PATCH 0109/1332] AVALANCHE: Major update in the Engine (include Graph), minor updates in Graph and Lucerna. --- engines/avalanche/avalanche.cpp | 12 ++++++++++-- engines/avalanche/avalanche.h | 8 ++++++-- engines/avalanche/graph.cpp | 2 +- engines/avalanche/lucerna2.h | 1 - 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 94b2b1611516..88e6e0edd1bc 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -38,6 +38,8 @@ #include "engines/util.h" + + namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; @@ -49,6 +51,8 @@ namespace Avalanche { _rnd = new Common::RandomSource("avalanche"); _rnd->setSeed(42); + _graph.setParent(this); + _gyro.setParent(this); _enhanced.setParent(this); _logger.setParent(this); @@ -241,13 +245,17 @@ namespace Avalanche { Common::Error AvalancheEngine::run() { s_Engine = this; - initGraphics(320, 200, false); - _console = new AvalancheConsole(this); + _console = new AvalancheConsole(this); + _scrolls.init(); _lucerna.init(); _acci.init(); _basher.init(); + _graph.init(); + + + // From bootstrp: diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 592df701eea1..bd8e53285b71 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -30,6 +30,8 @@ #include "avalanche/console.h" +#include "avalanche/graph.h" + #include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/enhanced2.h" @@ -63,6 +65,8 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: + Graph _graph; + Avalot _avalot; Gyro _gyro; Enhanced _enhanced; @@ -81,6 +85,8 @@ class AvalancheEngine : public Engine { Dropdown _dropdown; Closing _closing; + + AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); @@ -94,8 +100,6 @@ class AvalancheEngine : public Engine { uint32 getFeatures() const; const char *getGameId() const; - void initGame(const AvalancheGameDescription *gd); - Common::Platform getPlatform() const; bool hasFeature(EngineFeature f) const; diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 30dd20aa2ff8..73ea430c4ea9 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -77,7 +77,7 @@ byte *Graph::getPixel(int16 x, int16 y) { } void Graph::setPixel(byte *pixel, byte color) { - memset(pixel, color, 1); + *pixel = color; } void Graph::drawToScreen() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index f9d43f7c2abf..94da2dba26f8 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -176,5 +176,4 @@ class Lucerna { } // End of namespace Avalanche - #endif // LUCERNA2_H From d7b82409205ce924c0a8fc206ad13937e72f8bc2 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 08:41:14 +0200 Subject: [PATCH 0110/1332] AVALANCHE: Update Graph, leave a comment in Lucerna. --- engines/avalanche/graph.cpp | 25 +++++++++---------------- engines/avalanche/graph.h | 8 ++++---- engines/avalanche/lucerna2.cpp | 4 ++-- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 73ea430c4ea9..2c845c06c55e 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -38,20 +38,7 @@ namespace Avalanche { -const byte Graph::ega_palette_index[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; - -const byte Graph::ega_palette[64][3] = -{ - {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, - {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, - {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, - {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, - {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, - {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a}, - {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}, - {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f} -}; - +const byte Graph::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; @@ -60,10 +47,16 @@ void Graph::setParent(AvalancheEngine *vm) { } void Graph::init() { - initGraphics(_screenWidth, _screenHeight, false); + initGraphics(_screenWidth, _screenHeight, true); + + for (int i = 0; i < 64; ++i) { + _egaPalette[i][0] = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; + _egaPalette[i][1] = (i >> 1 & 1) * 0xaa + (i >> 4 & 1) * 0x55; + _egaPalette[i][2] = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; + } for (byte i = 0; i < 16; i++) - g_system->getPaletteManager()->setPalette(ega_palette[ega_palette_index[i]], i, 1); + g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1); _surface.create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8()); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 9ddd69f1adee..220f87f1f65b 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -37,8 +37,8 @@ class AvalancheEngine; class Graph { public: - static const int16 _screenWidth = 320; - static const int16 _screenHeight = 200; + static const int16 _screenWidth = 640; + static const int16 _screenHeight = 350; @@ -59,9 +59,9 @@ class Graph { Graphics::Surface _surface; - static const byte ega_palette_index[16]; + static const byte _egaPaletteIndex[16]; - static const byte ega_palette[64][3]; + byte _egaPalette[64][3]; }; } // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 9feca692579b..0fd7feea8b45 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -980,11 +980,11 @@ int8 Lucerna::fades(int8 x) { void Lucerna::fadeout(byte n) { - warning("STUB: Lucerna::fadeout()"); + warning("STUB: Lucerna::fadeout()"); // I'll bother with colors later. } void Lucerna::dusk() { - warning("STUB: Lucerna::dusk()"); + warning("STUB: Lucerna::dusk()"); // I'll bother with colors later. } From 0fc20c25dea704eafecd8786722f8e26ca552e2f Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 09:37:21 +0200 Subject: [PATCH 0111/1332] AVALANCHE: Repair Lucerna. --- engines/avalanche/lucerna2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 0fd7feea8b45..66036e052e2b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -46,6 +46,8 @@ #include "common/system.h" +#include "graphics/palette.h" + //#include "dropdown.h" //#include "basher.h" @@ -791,8 +793,8 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ } for (byte ff = 0; ff < 9; ff ++) { - _vm->_gyro.digit[ff] = new byte[rwlitesize]; - f.read(_vm->_gyro.digit[ff], rwlitesize); + _vm->_gyro.rwlite[ff] = new byte[rwlitesize]; + f.read(_vm->_gyro.rwlite[ff], rwlitesize); } f.close(); @@ -949,7 +951,7 @@ void Lucerna::checkclick() { } void Lucerna::mouse_init() { - warning("STUB: Lucerna::mouse_init()"); + _vm->_gyro.wait(); } void Lucerna::mousepage(uint16 page_) { From 1bb9d2b9965348e6526e9b9d5100ff443fdef3cd Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 10:25:16 +0200 Subject: [PATCH 0112/1332] AVALANCHE: Grap: rename drawToScreen to refreshScreen, add drawBar. --- engines/avalanche/graph.cpp | 7 ++++++- engines/avalanche/graph.h | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 2c845c06c55e..47836aaa8636 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -35,6 +35,7 @@ #include "engines/util.h" #include "graphics/palette.h" +#include "common/rect.h" namespace Avalanche { @@ -73,7 +74,11 @@ void Graph::setPixel(byte *pixel, byte color) { *pixel = color; } -void Graph::drawToScreen() { +void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { + _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); +} + +void Graph::refreshScreen() { g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 220f87f1f65b..beaa79691573 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Graph { public: static const int16 _screenWidth = 640; - static const int16 _screenHeight = 350; + static const int16 _screenHeight = 200; @@ -52,7 +52,9 @@ class Graph { void setPixel(byte *pixel, byte color); - void drawToScreen(); + void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); + + void refreshScreen(); private: AvalancheEngine *_vm; From a096ee19576ce9b518f28c3da27463244d51893e Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 10:43:13 +0200 Subject: [PATCH 0113/1332] AVALANCHE: Partially implement Scrolls::state. (Bother with the patterns later.) --- engines/avalanche/scrolls2.cpp | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index ca0ac3071eca..972091d01866 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -57,7 +57,46 @@ void Scrolls::init() { } void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ + byte page_; + + if (_vm->_gyro.ledstatus == x) + return; /* Already like that! */ + + byte color; + switch (x) { + case 0: + color = black; + break; /* Off */ + case 1: + case 2: + case 3: + color = green; + break; /* Hit a key */ + } + + //switch (x) { + //case 0: + // setfillstyle(1, black); + // break; /* Off */ + //case 1: + // setfillstyle(9, green); + // break; /* Half-on (menus) */ + //case 2: + // setfillstyle(1, green); + // break; /* On (kbd) */ + //case 3: + // setfillstyle(6, green); + // break; /* Hit a key */ + //} warning("STUB: Scrolls::state()"); + + _vm->_gyro.super_off(); + + _vm->_graph.drawBar(419, 195, 438, 197, color); + _vm->_graph.refreshScreen(); + + _vm->_gyro.super_on(); + _vm->_gyro.ledstatus = x; } void Scrolls::easteregg() { From fa881567db05ffb6c2f8aaf96a37a3321e9c417f Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 16:08:35 +0200 Subject: [PATCH 0114/1332] AVALANCHE: Update Graph. --- engines/avalanche/graph.cpp | 4 ++++ engines/avalanche/graph.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 47836aaa8636..d932d12be864 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,6 +78,10 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } +void Graph::copySurface(Graphics::Surface source) { + _surface.copyFrom(source); +} + void Graph::refreshScreen() { g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index beaa79691573..24fffcc149cd 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -54,6 +54,8 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); + void copySurface(Graphics::Surface source); + void refreshScreen(); private: From c18b41b21dd3674b44c07ef68f317822bcfb1d37 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 16:11:07 +0200 Subject: [PATCH 0115/1332] AVALANCHE: Lucerna: finish implementation of load(). --- engines/avalanche/lucerna2.cpp | 40 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 66036e052e2b..5cbd46c40835 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -230,14 +230,35 @@ void Lucerna::load(byte n) { /* Load2, actually */ f.seek(177); warning("STUB: Lucerna::load()"); - for (bit = 0; bit <= 3; bit++) { - /*port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - move(a0, a1, 12080);*/ - } + + Graphics::Surface background; + background.create(_vm->_graph._screenWidth, _vm->_graph._screenHeight, Graphics::PixelFormat::createFormatCLUT8()); + + for (byte plane = 0; plane < 4; plane++) + for (uint16 y = 0; y < 151; y++) + for (uint16 x = 0; x < 640/8; x++) { + byte pixel = f.readByte(); + for (byte i = 0; i < 8; i++) { + byte pixelBit = (pixel >> i) & 1; + *(byte *)background.getBasePtr(x * 8, y) += (pixelBit << plane); + } + } + + _vm->_graph.copySurface(background); + + background.free(); + + _vm->_graph.refreshScreen(); + + + /*for (bit = 0; bit <= 3; bit++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + move(a0, a1, 12080); + }*/ f.close(); @@ -246,8 +267,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_pingo.copy03(); - //bit = getpixel(0, 0); - warning("STUB: Lucerna::load()"); + bit = *_vm->_graph.getPixel(0,0); _vm->_logger.log_newroom(_vm->_gyro.roomname); From b4f564276578413c6bd152461069d199a78b3eac Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 16:20:01 +0200 Subject: [PATCH 0116/1332] AVALANCHE: Revise Lucerna::load(). --- engines/avalanche/lucerna2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5cbd46c40835..bb22530fb570 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -236,11 +236,11 @@ void Lucerna::load(byte n) { /* Load2, actually */ for (byte plane = 0; plane < 4; plane++) for (uint16 y = 0; y < 151; y++) - for (uint16 x = 0; x < 640/8; x++) { + for (uint16 x = 0; x < 640; x += 8) { byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - *(byte *)background.getBasePtr(x * 8, y) += (pixelBit << plane); + *(byte *)background.getBasePtr(x + i, y) += (pixelBit << plane); } } From a1673fe167077c206a80e67522ba7c7d0cac9cc0 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 12 Jul 2013 18:08:27 +0200 Subject: [PATCH 0117/1332] AVALANCHE: Lucerna: finish load(). --- engines/avalanche/lucerna2.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index bb22530fb570..6cd99b5bca8c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -229,18 +229,29 @@ void Lucerna::load(byte n) { /* Load2, actually */ /* Compression method byte follows this... */ f.seek(177); - warning("STUB: Lucerna::load()"); + + /*for (bit = 0; bit <= 3; bit++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, a0, 12080); + move(a0, a1, 12080); + }*/ Graphics::Surface background; background.create(_vm->_graph._screenWidth, _vm->_graph._screenHeight, Graphics::PixelFormat::createFormatCLUT8()); + byte backgroundHeight = 8 * 12080 / _vm->_graph._screenWidth; // With 640 width it's 151 + // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) + for (byte plane = 0; plane < 4; plane++) - for (uint16 y = 0; y < 151; y++) - for (uint16 x = 0; x < 640; x += 8) { + for (uint16 y = 0; y < backgroundHeight; y++) + for (uint16 x = 0; x < _vm->_graph._screenWidth; x += 8) { byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - *(byte *)background.getBasePtr(x + i, y) += (pixelBit << plane); + *(byte *)background.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } } @@ -251,14 +262,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_graph.refreshScreen(); - /*for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - move(a0, a1, 12080); - }*/ + f.close(); From 0f8a091597092f7efc308f4d20a3d09c648fcb2a Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 13 Jul 2013 13:02:12 +0200 Subject: [PATCH 0118/1332] AVALANCHE: Update Lucerna::load(), update makefile, increase screen height (in Graph). --- engines/avalanche/graph.h | 2 +- engines/avalanche/lucerna2.cpp | 3 ++- engines/avalanche/module.mk | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 24fffcc149cd..559e78cb6fd7 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Graph { public: static const int16 _screenWidth = 640; - static const int16 _screenHeight = 200; + static const int16 _screenHeight = 400; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 6cd99b5bca8c..493d114b3907 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -251,7 +251,8 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - *(byte *)background.getBasePtr(x + 7 - i, y) += (pixelBit << plane); + for (byte j = 0; j < 2; j++) // We draw every line twice to reach 400 picture height. + *(byte *)background.getBasePtr(x + 7 - i, y * 2 + j) += (pixelBit << plane); } } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index ff5bc61e9688..222482e40666 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -2,6 +2,7 @@ MODULE := engines/avalanche MODULE_OBJS = \ avalanche.o \ + graph.o \ avalot.o \ console.o \ detection.o \ From 58dc18a2da981273fd0fb10ba53274a14fec88e6 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 13 Jul 2013 18:21:18 +0200 Subject: [PATCH 0119/1332] AVALANCHE: Move the height-doubling part from Lucerna to Graph. --- engines/avalanche/graph.cpp | 6 +++++- engines/avalanche/lucerna2.cpp | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index d932d12be864..e101749027d3 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -79,7 +79,11 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graph::copySurface(Graphics::Surface source) { - _surface.copyFrom(source); + for (uint16 y = 0; y < _screenHeight / 2; y++) + for (uint16 x = 0; x < _screenWidth; x ++) { + for (byte j = 0; j < 2; j++) // We copy every line twice to reach 400 picture height. + *(byte *)_surface.getBasePtr(x, y * 2 + j) = *(byte *)source.getBasePtr(x, y); + } } void Graph::refreshScreen() { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 493d114b3907..e878e7760c05 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -251,8 +251,8 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - for (byte j = 0; j < 2; j++) // We draw every line twice to reach 400 picture height. - *(byte *)background.getBasePtr(x + 7 - i, y * 2 + j) += (pixelBit << plane); + //for (byte j = 0; j < 2; j++) // We draw every line twice to reach 400 picture height. + *(byte *)background.getBasePtr(x + 7 - i, y /** 2 + j*/) += (pixelBit << plane); } } @@ -260,8 +260,6 @@ void Lucerna::load(byte n) { /* Load2, actually */ background.free(); - _vm->_graph.refreshScreen(); - From bc15033c14f658a033460589ba5d1effb1538602 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 13 Jul 2013 20:11:44 +0200 Subject: [PATCH 0120/1332] AVALANCHE: Remove unnecessary comments from Lucerna::load(). --- engines/avalanche/lucerna2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e878e7760c05..16da58cf5407 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -251,8 +251,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - //for (byte j = 0; j < 2; j++) // We draw every line twice to reach 400 picture height. - *(byte *)background.getBasePtr(x + 7 - i, y /** 2 + j*/) += (pixelBit << plane); + *(byte *)background.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } } From 4a373a192556b573975a2d84b6c16213f122e78a Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 15 Jul 2013 11:24:38 +0200 Subject: [PATCH 0121/1332] AVALANCHE: update Avalot. --- engines/avalanche/avalot.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ae437a66cc64..af526355fe53 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -29,6 +29,7 @@ #include "avalanche/avalanche.h" +#include "avalanche/graph.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/trip6.h" @@ -43,13 +44,15 @@ #include "avalanche/celer2.h" #include "avalanche/enid2.h" #include "avalanche/visa2.h" +#include "avalanche/closing2.h" /*#include "Incline.h"*/ -/*#include "Closing.h"*/ #include "common/str.h" #include "common/textconsole.h" + + namespace Avalanche { void Avalot::setup() { @@ -98,7 +101,7 @@ void Avalot::setup() { _vm->_trip.loadtrip(); - if ((_vm->_gyro.filetoload == "") && (! _vm->_gyro.reloaded)) + if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)*) _vm->_gyro.newgame(); /* no game was requested- load the default */ else { if (! _vm->_gyro.reloaded) @@ -145,7 +148,7 @@ void Avalot::setParent(AvalancheEngine *vm) { void Avalot::run(Common::String arg) { setup(); - + do { _vm->_lucerna.clock_lucerna(); _vm->_basher.keyboard_link(); From 885a8113bc3e47a0c37a0b8612d9dac95f78e5bd Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 15 Jul 2013 12:15:49 +0200 Subject: [PATCH 0122/1332] AVALANCHE: repair Avalot. --- engines/avalanche/avalot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index af526355fe53..a17832817ae9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -101,7 +101,7 @@ void Avalot::setup() { _vm->_trip.loadtrip(); - if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)*) + if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)) _vm->_gyro.newgame(); /* no game was requested- load the default */ else { if (! _vm->_gyro.reloaded) From 9683ced39efe6bb0033d18498f6e553506bf39e6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 15 Jul 2013 16:57:03 +0200 Subject: [PATCH 0123/1332] AVALANCHE: implement Lucerna::toolbar(), revise Graph::copySurface() and Graph::setPixel(), update Lucerna::load() accordingly. --- engines/avalanche/graph.cpp | 14 ++++----- engines/avalanche/graph.h | 6 ++-- engines/avalanche/lucerna2.cpp | 52 ++++++++++++++++++++-------------- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index e101749027d3..1b0e56c5a4ed 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -70,20 +70,18 @@ byte *Graph::getPixel(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); } -void Graph::setPixel(byte *pixel, byte color) { - *pixel = color; +void Graph::setPixel(int16 x, int16 y, byte color) { + *(byte *)_surface.getBasePtr(x, y) = color; } void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } -void Graph::copySurface(Graphics::Surface source) { - for (uint16 y = 0; y < _screenHeight / 2; y++) - for (uint16 x = 0; x < _screenWidth; x ++) { - for (byte j = 0; j < 2; j++) // We copy every line twice to reach 400 picture height. - *(byte *)_surface.getBasePtr(x, y * 2 + j) = *(byte *)source.getBasePtr(x, y); - } +void Graph::copySurface(Graphics::Surface source, uint16 destX, uint16 destY) { + for (uint16 y = 0; y < source.h; y++) + for (uint16 x = 0; x < source.w; x++) + *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)source.getBasePtr(x, y); } void Graph::refreshScreen() { diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 559e78cb6fd7..3d819d1d3a91 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Graph { public: static const int16 _screenWidth = 640; - static const int16 _screenHeight = 400; + static const int16 _screenHeight = 200; @@ -50,11 +50,11 @@ class Graph { byte *getPixel(int16 x, int16 y); - void setPixel(byte *pixel, byte color); + void setPixel(int16 x, int16 y, byte color); void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - void copySurface(Graphics::Surface source); + void copySurface(Graphics::Surface source, uint16 destX, uint16 destY); void refreshScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 16da58cf5407..f665c5477154 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -240,14 +240,16 @@ void Lucerna::load(byte n) { /* Load2, actually */ }*/ Graphics::Surface background; - background.create(_vm->_graph._screenWidth, _vm->_graph._screenHeight, Graphics::PixelFormat::createFormatCLUT8()); - + + uint16 backgroundWidht = _vm->_graph._screenWidth; byte backgroundHeight = 8 * 12080 / _vm->_graph._screenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) + background.create(backgroundWidht, backgroundHeight, Graphics::PixelFormat::createFormatCLUT8()); + for (byte plane = 0; plane < 4; plane++) for (uint16 y = 0; y < backgroundHeight; y++) - for (uint16 x = 0; x < _vm->_graph._screenWidth; x += 8) { + for (uint16 x = 0; x < backgroundWidht; x += 8) { byte pixel = f.readByte(); for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; @@ -255,7 +257,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ } } - _vm->_graph.copySurface(background); + _vm->_graph.copySurface(background, 0 ,0); background.free(); @@ -823,35 +825,41 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ } void Lucerna::toolbar() { - uint16 s; - byte *p; - if (!f.open("useful.avd")) { warning("AVALANCHE: Lucerna: File not found: useful.avd"); return; } - s = f.size() - 40; - p = new byte[s]; f.seek(40); - f.read(p, s); - f.close(); + /* off;*/ - //setcolor(15); /* (And sent for chrysanthemums...) Yellow and white. */ - //setfillstyle(1, 6); - //for (byte fv = 0; fv <= 1; fv ++) { - // setactivepage(fv); - // putimage(5, 169, p, 0); - // if (demo) { - // bar(264, 177, 307, 190); - // outtextxy(268, 188, "Demo!"); /* well... actually only white now. */ - // } - //} + uint16 toolbarWidth = f.readUint16LE() + 1; + uint16 toolbarHeight = f.readUint16LE() + 1; + + Graphics::Surface toolbar; + toolbar.create(toolbarWidth, toolbarHeight, Graphics::PixelFormat::createFormatCLUT8()); + + for (byte y = 0; y < toolbarHeight; y++) + for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (uint16 x = 0; x < toolbarWidth; x += 8) { + byte pixel = f.readByte(); + for (byte i = 0; i < 8; i++) { + byte pixelBit = (pixel >> i) & 1; + *(byte *)toolbar.getBasePtr(x + 7 - i, y) += (pixelBit << plane); + } + } + + _vm->_graph.copySurface(toolbar, 5, 169); + + toolbar.free(); + + f.close(); + warning("STUB: Lucerna::toolbar()"); /* on;*/ - delete[] p; + _vm->_gyro.oldrw = 177; showrw(); } From fa1b5d3f3afb5d21fa4d8250e80699dc9fe00bfe Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 15 Jul 2013 18:27:26 +0200 Subject: [PATCH 0124/1332] AVALANCHE: Update Graph. --- engines/avalanche/graph.cpp | 2 +- engines/avalanche/graph.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 1b0e56c5a4ed..712e3a699081 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,7 +78,7 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } -void Graph::copySurface(Graphics::Surface source, uint16 destX, uint16 destY) { +void Graph::copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY) { for (uint16 y = 0; y < source.h; y++) for (uint16 x = 0; x < source.w; x++) *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)source.getBasePtr(x, y); diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 3d819d1d3a91..7c09071115df 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -54,7 +54,7 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - void copySurface(Graphics::Surface source, uint16 destX, uint16 destY); + void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY); void refreshScreen(); From 1c95316924a759ebae91ceaf4f0963c8a4a579cc Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 16 Jul 2013 11:11:31 +0200 Subject: [PATCH 0125/1332] AVALANCHE: Implement getsettype::remember(). --- engines/avalanche/trip6.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 3bc6d4c734d7..786dfa40a41e 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -370,7 +370,8 @@ getsettype *getsettype::init() { void getsettype::remember(bytefield r) { numleft++; - warning("STUB: getsettype::remember()"); + if (numleft > maxgetset) + error("Trip::remember() : runerr_Getset_Overflow"); gs[numleft] = r; } From c8bf87918a7dc5b99beed563e01d9f71654628df Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 16 Jul 2013 12:47:51 +0200 Subject: [PATCH 0126/1332] AVALANCHE: Repair Scrolls::state(). --- engines/avalanche/scrolls2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 972091d01866..e2288b2c0117 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -93,7 +93,6 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ _vm->_gyro.super_off(); _vm->_graph.drawBar(419, 195, 438, 197, color); - _vm->_graph.refreshScreen(); _vm->_gyro.super_on(); _vm->_gyro.ledstatus = x; From 964374024b64c58925541171a5ae506b6dceae4a Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 16 Jul 2013 13:03:22 +0200 Subject: [PATCH 0127/1332] AVALANCHE: Add new Graph::readImage(), implement Lucerna::thinkabout() using it and use it in Lucerna::toolbar() as well. --- engines/avalanche/graph.cpp | 21 +++++++++ engines/avalanche/graph.h | 5 +++ engines/avalanche/lucerna2.cpp | 81 +++++++++++----------------------- engines/avalanche/lucerna2.h | 2 +- 4 files changed, 53 insertions(+), 56 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 712e3a699081..2272fb61445e 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,6 +78,27 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } +Graphics::Surface *Graph::readImage(Common::File &f) { + Graphics::Surface *picture = new Graphics::Surface; + + uint16 pictureWidth = f.readUint16LE() + 1; + uint16 pictureHeight = f.readUint16LE() + 1; + + picture->create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); + + for (byte y = 0; y < pictureHeight; y++) + for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (uint16 x = 0; x < pictureWidth; x += 8) { + byte pixel = f.readByte(); + for (byte i = 0; i < 8; i++) { + byte pixelBit = (pixel >> i) & 1; + *(byte *)picture->getBasePtr(x + 7 - i, y) += (pixelBit << plane); + } + } + + return picture; +} + void Graph::copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY) { for (uint16 y = 0; y < source.h; y++) for (uint16 x = 0; x < source.w; x++) diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 7c09071115df..7d5f12f20f88 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -30,6 +30,8 @@ #ifndef GRAPH_H #define GRAPH_H +#include "common/file.h" + #include "graphics/surface.h" namespace Avalanche { @@ -54,6 +56,9 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); + // Must free the returened pointer!!! + Graphics::Surface *readImage(Common::File &f); + void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY); void refreshScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f665c5477154..fb5437606022 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -732,71 +732,56 @@ void Lucerna::enterroom(byte x, byte ped) { } -void Lucerna::thinkabout(char z, bool th) { /* Hey!!! Get it and put it!!! */ +void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! */ const int16 x = 205; const int16 y = 170; const int16 picsize = 966; const bytefield thinkspace = {25, 170, 32, 200}; - byte *p; - byte fv; - _vm->_gyro.thinks = z; z--; + _vm->_gyro.wait(); + if (th) { - /* Things */ - _vm->_gyro.wait(); - - p = new byte[picsize]; - if (!f.open("thinks.avd")) { warning("AVALANCHE: Lucerna: File not found: thinks.avd"); return; } - - f.seek(z * picsize + 65); - - f.read(p, picsize); - - _vm->_gyro.off(); - - f.close(); } else { - /* People */ - _vm->_gyro.wait(); - - p = new byte[picsize]; - if (!f.open("folk.avd")) { warning("AVALANCHE: Lucerna: File not found: folk.avd"); return; } - fv = z - 149; - if (fv >= 25) - fv -= 8; - if (fv == 20) - fv--; /* Last time... */ + z = z - 149; + if (z >= 25) + z -= 8; + if (z == 20) + z--; /* Last time... */ - f.seek(fv * picsize + 65); + } - f.read(p, picsize); + f.seek(z * picsize + 65); - _vm->_gyro.off(); + Graphics::Surface *picture = _vm->_graph.readImage(f); - f.close(); - } + _vm->_graph.copySurface(*picture, x, y); + + picture->free(); + + delete picture; + + f.close(); + + _vm->_gyro.off(); /*setactivepage(3); putimage(x, y, p, 0); setactivepage(1 - cp);*/ - warning("STUB: Lucerna::thinkabout()"); - for (fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv ++) _vm->_trip.getset[fv].remember(thinkspace); - - delete[] p; _vm->_gyro.on(); _vm->_gyro.thinkthing = th; @@ -834,29 +819,15 @@ void Lucerna::toolbar() { /* off;*/ - uint16 toolbarWidth = f.readUint16LE() + 1; - uint16 toolbarHeight = f.readUint16LE() + 1; + Graphics::Surface *toolbar = _vm->_graph.readImage(f); - Graphics::Surface toolbar; - toolbar.create(toolbarWidth, toolbarHeight, Graphics::PixelFormat::createFormatCLUT8()); - - for (byte y = 0; y < toolbarHeight; y++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. - for (uint16 x = 0; x < toolbarWidth; x += 8) { - byte pixel = f.readByte(); - for (byte i = 0; i < 8; i++) { - byte pixelBit = (pixel >> i) & 1; - *(byte *)toolbar.getBasePtr(x + 7 - i, y) += (pixelBit << plane); - } - } - - _vm->_graph.copySurface(toolbar, 5, 169); + _vm->_graph.copySurface(*toolbar, 5, 169); - toolbar.free(); + toolbar->free(); - f.close(); + delete toolbar; - warning("STUB: Lucerna::toolbar()"); + f.close(); /* on;*/ diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 94da2dba26f8..ca2384577d9f 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -58,7 +58,7 @@ class Lucerna { void enterroom(byte x, byte ped); - void thinkabout(char z, bool th); /* Hey!!! Get it and put it!!! */ + void thinkabout(byte z, bool th); /* Hey!!! Get it and put it!!! */ void load_digits(); /* Load the scoring digits & rwlites */ From 251c4b0acb702aac814e0fa442bc0d1d0a5bfde5 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 16 Jul 2013 22:47:07 +0200 Subject: [PATCH 0128/1332] AVALANCHE: Revise Lucerna, remove a blank line in Trip. --- engines/avalanche/lucerna2.cpp | 222 ++++++++++++++++----------------- engines/avalanche/lucerna2.h | 1 - engines/avalanche/trip6.cpp | 2 + 3 files changed, 107 insertions(+), 118 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index fb5437606022..6ec856f1d47a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -90,6 +90,7 @@ void Lucerna::draw_also_lines() { +// nextstring, scram1 and unscrable are only used in load_also Common::String Lucerna::nextstring() { Common::String str; @@ -111,6 +112,8 @@ void Lucerna::unscramble() { scram1(*_vm->_gyro.also[fv][ff]); scram1(_vm->_gyro.listen); scram1(_vm->_gyro.flags); + /* for fz:=1 to length(also[fv,ff]^) do + also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ } void Lucerna::load_also(Common::String n) { @@ -143,6 +146,7 @@ void Lucerna::load_also(Common::String n) { memset(_vm->_gyro.lines, 0xFF, sizeof(_vm->_gyro.lines)); + //fv = getpixel(0, 0); fv = f.readByte(); for (byte i = 0; i < fv; i++) { _vm->_gyro.lines[i].x1 = f.readSint16LE(); @@ -261,11 +265,10 @@ void Lucerna::load(byte n) { /* Load2, actually */ background.free(); + f.close(); - f.close(); - load_also(xx); _vm->_celer.load_chunks(xx); @@ -291,44 +294,38 @@ void Lucerna::zoomout(int16 x, int16 y) { } void Lucerna::find_people(byte room) { - char fv; - - for (fv = 151; fv <= 178; fv ++) + for (byte fv = 151; fv <= 178; fv++) if (_vm->_gyro.whereis[fv] == room) { - if (fv < 175) _vm->_gyro.him = fv; - else _vm->_gyro.her = fv; + if (fv < 175) + _vm->_gyro.him = fv; + else + _vm->_gyro.her = fv; } } void Lucerna::exitroom(byte x) { //nosound(); _vm->_celer.forget_chunks(); - _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the - length of this procedure. */ + _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ - { - dnatype &with = _vm->_gyro.dna; - switch (x) { - case r__spludwicks: { - _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); - /* He doesn't HAVE to be talking for this to work. It just deletes it IF it - exists. */ with.avaricius_talk = 0; - } + switch (x) { + case r__spludwicks: + _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); + _vm->_gyro.dna.avaricius_talk = 0; + /* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */ break; - case r__bridge: - if (with.drawbridge_open > 0) { - with.drawbridge_open = 4; /* Fully open. */ - _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); - } - break; - case r__outsidecardiffcastle: - _vm->_timeout.lose_timer(_vm->_timeout.reason_cardiffsurvey); - break; - - case r__robins: - _vm->_timeout.lose_timer(_vm->_timeout.reason_getting_tied_up); - break; + case r__bridge: + if (_vm->_gyro.dna.drawbridge_open > 0) { + _vm->_gyro.dna.drawbridge_open = 4; /* Fully open. */ + _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); } + break; + case r__outsidecardiffcastle: + _vm->_timeout.lose_timer(_vm->_timeout.reason_cardiffsurvey); + break; + case r__robins: + _vm->_timeout.lose_timer(_vm->_timeout.reason_getting_tied_up); + break; } _vm->_gyro.interrogation = 0; /* Leaving the room cancels all the questions automatically. */ @@ -345,8 +342,7 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ switch (_vm->_gyro.dna.room) { case r__outsidenottspub: /* Entry into Nottingham. */ - if ((_vm->_gyro.dna.rooms[r__robins] > 0) && (_vm->_gyro.dna.been_tied_up) && - (! _vm->_gyro.dna.taken_mushroom)) + if ((_vm->_gyro.dna.rooms[r__robins] > 0) && (_vm->_gyro.dna.been_tied_up) && (! _vm->_gyro.dna.taken_mushroom)) _vm->_gyro.dna.mushroom_growing = true; break; case r__wisewomans: { /* Entry into Argent. */ @@ -371,7 +367,8 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ void Lucerna::put_geida_at(byte whichped, byte &ped) { - if (ped == 0) return; + if (ped == 0) + return; _vm->_trip.tr[2].init(5, false, &_vm->_trip); /* load Geida */ _vm->_trip.apped(2, whichped); _vm->_trip.tr[2].call_eachstep = true; @@ -383,7 +380,8 @@ void Lucerna::enterroom(byte x, byte ped) { find_people(x); _vm->_gyro.dna.room = x; - if (ped != 0) _vm->_gyro.dna.rooms[x] += 1; + if (ped != 0) + _vm->_gyro.dna.rooms[x]++; load(x); @@ -397,11 +395,10 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro.roomtime = 0; - { - dnatype &with = _vm->_gyro.dna; - if ((with.last_room == r__map) && (with.last_room_not_map != with.room)) - new_town(); - } + + if ((_vm->_gyro.dna.last_room == r__map) && (_vm->_gyro.dna.last_room_not_map != _vm->_gyro.dna.room)) + new_town(); + switch (x) { case r__yours: @@ -690,7 +687,8 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__aylesoffice: - if (_vm->_gyro.dna.ayles_is_awake) _vm->_celer.show_one(2); + if (_vm->_gyro.dna.ayles_is_awake) + _vm->_celer.show_one(2); break; /* Ayles awake. */ case r__geidas: @@ -884,67 +882,67 @@ void Lucerna::fxtoggle() { } void Lucerna::objectlist() { - char fv; - _vm->_gyro.dna.carrying = 0; if (_vm->_gyro.thinkthing && ! _vm->_gyro.dna.obj[_vm->_gyro.thinks]) thinkabout(_vm->_gyro.money, _vm->_gyro.a_thing); /* you always have money */ - for (fv = '\1'; fv <= numobjs; fv ++) + for (byte fv = 0; fv < numobjs; fv ++) if (_vm->_gyro.dna.obj[fv]) { - _vm->_gyro.dna.carrying += 1; - _vm->_gyro.objlist[_vm->_gyro.dna.carrying] = fv; + _vm->_gyro.dna.carrying ++; + _vm->_gyro.objlist[_vm->_gyro.dna.carrying] = fv + 1; } } void Lucerna::verte() { byte what; - if (! _vm->_gyro.dna.user_moves_avvy) return; - { - triptype &with = _vm->_trip.tr[1]; /* that's the only one we're interested in here */ - - - if (_vm->_gyro.mx < with.x) what = 1; - else if (_vm->_gyro.mx > (unsigned char)(with.x + with.a.xl)) what = 2; - else - what = 0; /* On top */ - - if (_vm->_gyro.my < with.y) what += 3; - else if (_vm->_gyro.my > (unsigned char)(with.y + with.a.yl)) what += 6; + if (! _vm->_gyro.dna.user_moves_avvy) + return; - switch (what) { - case 0: - _vm->_trip.stopwalking(); - break; /* Clicked on Avvy- no movement */ - case 1: - _vm->_trip.rwsp(1, _vm->_trip.left); - break; - case 2: - _vm->_trip.rwsp(1, _vm->_trip.right); - break; - case 3: - _vm->_trip.rwsp(1, _vm->_trip.up); - break; - case 4: - _vm->_trip.rwsp(1, _vm->_trip.ul); - break; - case 5: - _vm->_trip.rwsp(1, _vm->_trip.ur); - break; - case 6: - _vm->_trip.rwsp(1, _vm->_trip.down); - break; - case 7: - _vm->_trip.rwsp(1, _vm->_trip.dl); - break; - case 8: - _vm->_trip.rwsp(1, _vm->_trip.dr); - break; - } /* no other values are possible... */ - showrw(); + /* _vm->_trip.tr[0] : that's the only one we're interested in here */ + if (_vm->_gyro.mx < _vm->_trip.tr[0].x) + what = 1; + else if (_vm->_gyro.mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0].a.xl)) + what = 2; + else + what = 0; /* On top */ + + if (_vm->_gyro.my < _vm->_trip.tr[0].y) + what += 3; + else if (_vm->_gyro.my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0].a.yl)) + what += 6; + + switch (what) { + case 0: + _vm->_trip.stopwalking(); + break; /* Clicked on Avvy- no movement */ + case 1: + _vm->_trip.rwsp(1, _vm->_trip.left); + break; + case 2: + _vm->_trip.rwsp(1, _vm->_trip.right); + break; + case 3: + _vm->_trip.rwsp(1, _vm->_trip.up); + break; + case 4: + _vm->_trip.rwsp(1, _vm->_trip.ul); + break; + case 5: + _vm->_trip.rwsp(1, _vm->_trip.ur); + break; + case 6: + _vm->_trip.rwsp(1, _vm->_trip.down); + break; + case 7: + _vm->_trip.rwsp(1, _vm->_trip.dl); + break; + case 8: + _vm->_trip.rwsp(1, _vm->_trip.dr); + break; + } /* no other values are possible... */ - } + showrw(); } void Lucerna::checkclick() { @@ -964,19 +962,15 @@ void Lucerna::errorled() { } int8 Lucerna::fades(int8 x) { - byte r, g, b; - - int8 fades_result; - r = x / 16; + byte r = x / 16; x = x % 16; - g = x / 4; - b = x % 4; - if (r > 0) r -= 1; - if (g > 0) g -= 1; - if (b > 0) b -= 1; - fades_result = (16 * r + 4 * g + b); + byte g = x / 4; + byte b = x % 4; + if (r > 0) r --; + if (g > 0) g --; + if (b > 0) b --; + return (16 * r + 4 * g + b); /* fades:=x-1;*/ - return fades_result; } @@ -1155,11 +1149,11 @@ void Lucerna::delavvy() { byte page_; _vm->_gyro.off(); - { - triptype &with = _vm->_trip.tr[1]; - for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); - } + + triptype &with = _vm->_trip.tr[0]; + for (page_ = 0; page_ <= 1; page_ ++) + mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); + blitfix(); _vm->_gyro.on(); } @@ -1197,13 +1191,9 @@ void Lucerna::minor_redraw() { _vm->_trip.getback(); } - { - dnatype &with = _vm->_gyro.dna; - - _vm->_gyro.lastscore = "TJA"; /* impossible digits */ - showscore(); - } - + _vm->_gyro.lastscore = "TJA"; /* impossible digits */ + showscore(); + dawn(); } @@ -1220,10 +1210,10 @@ uint16 Lucerna::bearing(byte whichped) { pedtype &with = _vm->_gyro.peds[whichped]; if (_vm->_trip.tr[1].x == with.x) bearing_result = 0; /* This would cause a division by zero if we let it through. */ - else + else { /* bearing:=trunc(((arctan((_vm->_trip.tr[1].y-y)/(_vm->_trip.tr[1].x-x)))*rad2deg)+90) mod 360*/ - { + if (_vm->_trip.tr[1].x < with.x) bearing_result = (atan(double((_vm->_trip.tr[1].y - with.y)) / (_vm->_trip.tr[1].x - with.x)) * rad2deg) + 90; else @@ -1261,15 +1251,13 @@ asm { } -void Lucerna::sprite_run() -/* A sprite run is performed before _vm->_scrolls.displaying a scroll, if not all the +void Lucerna::sprite_run() { +/* A sprite run is performed before displaying a scroll, if not all the sprites are still. It performs two fast cycles, only using a few of the links usually used, and without any extra animation. This should make the sprites the same on both pages. */ -{ byte fv; - _vm->_gyro.doing_sprite_run = true; for (fv = 0; fv <= 1; fv ++) { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index ca2384577d9f..6a62a7d39e74 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -145,7 +145,6 @@ class Lucerna { Common::String nextstring(); void scram1(Common::String &x); void unscramble(); - //ldalsz void zoomout(int16 x, int16 y); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 786dfa40a41e..a4365f4c5c41 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -363,6 +363,8 @@ triptype *triptype::done() { return this; } + + getsettype *getsettype::init() { numleft = 0; /* initialise array pointer */ return this; From 66cf00ab110b09e3f1d426a97cfeca7109a525b3 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 17 Jul 2013 11:35:40 +0200 Subject: [PATCH 0129/1332] AVALANCHE: Change the source of data in Graph::readImage() for further use. Change existing use of the function accordingly in Lucerna. --- engines/avalanche/graph.cpp | 12 ++++-- engines/avalanche/graph.h | 2 +- engines/avalanche/lucerna2.cpp | 72 +++++++++++++++++++++++++++++++--- 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 2272fb61445e..2143bcf53e9f 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,18 +78,22 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } -Graphics::Surface *Graph::readImage(Common::File &f) { +Graphics::Surface *Graph::readImage(const byte *source) { Graphics::Surface *picture = new Graphics::Surface; + + uint32 i = 0; - uint16 pictureWidth = f.readUint16LE() + 1; - uint16 pictureHeight = f.readUint16LE() + 1; + uint16 pictureWidth = (source[i++] + 1); + pictureWidth += (source[i++] << 8); + uint16 pictureHeight = (source[i++] + 1); + pictureHeight += (source[i++] << 8); picture->create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); for (byte y = 0; y < pictureHeight; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. for (uint16 x = 0; x < pictureWidth; x += 8) { - byte pixel = f.readByte(); + byte pixel = source[i++]; for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; *(byte *)picture->getBasePtr(x + 7 - i, y) += (pixelBit << plane); diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 7d5f12f20f88..f1a6678fadff 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -57,7 +57,7 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); // Must free the returened pointer!!! - Graphics::Surface *readImage(Common::File &f); + Graphics::Surface *readImage(const byte *source); void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 6ec856f1d47a..a72b5b1b41ec 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -731,8 +731,6 @@ void Lucerna::enterroom(byte x, byte ped) { } void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! */ - const int16 x = 205; - const int16 y = 170; const int16 picsize = 966; const bytefield thinkspace = {25, 170, 32, 200}; @@ -762,14 +760,20 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.seek(z * picsize + 65); - Graphics::Surface *picture = _vm->_graph.readImage(f); + byte *buffer = new byte[picsize]; - _vm->_graph.copySurface(*picture, x, y); + f.read(buffer, picsize); + + Graphics::Surface *picture = _vm->_graph.readImage(buffer); + + _vm->_graph.copySurface(*picture, 205, 170); picture->free(); delete picture; + delete[] buffer; + f.close(); _vm->_gyro.off(); @@ -817,7 +821,13 @@ void Lucerna::toolbar() { /* off;*/ - Graphics::Surface *toolbar = _vm->_graph.readImage(f); + uint32 bufferSize = f.size()-40; + + byte *buffer = new byte[bufferSize]; + + f.read(buffer, bufferSize); + + Graphics::Surface *toolbar = _vm->_graph.readImage(buffer); _vm->_graph.copySurface(*toolbar, 5, 169); @@ -825,6 +835,8 @@ void Lucerna::toolbar() { delete toolbar; + delete[] buffer; + f.close(); /* on;*/ @@ -834,6 +846,56 @@ void Lucerna::toolbar() { } void Lucerna::showscore() { + + const bytefield scorespace = {33, 177, 39, 200}; + Common::String q; + + if (_vm->_gyro.demo) + return; + + _vm->_gyro.dna.score = 156; + byte score = _vm->_gyro.dna.score; + byte numbers[3] = {0, 0, 0}; + for (byte i = 0; i < 2; i++) { + byte divisor = 1; + for (byte j = 0; j < (2 - i); j++) + divisor *= 10; + numbers[i] = score / divisor; + score -= numbers[i] * divisor; + } + numbers[2] = score; + + + + + //t kell rni a Graph::copySurface() -t hogy *byte tmbt kapjon s mindehol gy is hasznlni!!!! + + + + + + + + //str(_vm->_gyro.dna.score, q); + //while (q[0] < '\3') q = string('0') + q; + + //str(dna.score,q); + //while q[0]<#3 do q:='0'+q; + + //_vm->_gyro.off(); + + ////setactivepage(3); + //for (byte fv = 0; fv < 3; fv ++) + // if (_vm->_gyro.lastscore[fv] != q[fv]) + // putimage(250 + fv * 15, 177, _vm->_gyro.digit[q[fv]], 0); + + //for (byte fv = 0; fv <= 1; fv ++) + // _vm->_trip.getset[fv].remember(scorespace); + + //setactivepage(1 - cp); + _vm->_gyro.on(); + _vm->_gyro.lastscore = q; + warning("STUB: Lucerna::showscore()"); } From 90788cec113de7c9d26058cfa5e103c475105c21 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 17 Jul 2013 12:27:08 +0200 Subject: [PATCH 0130/1332] AVALANCHE: Implement Lucerna::showscore(). --- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 48 ++++++++++++++-------------------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 39fabf8cced6..1f9d9a15ab15 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -525,7 +525,7 @@ class Gyro { byte *digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! byte *rwlite[9]; // Maybe it will be needed to move them to the class itself instead. byte oldrw; - Common::String lastscore; + int8 lastscore[3]; byte cmp; /* current mouse-void **/ Common::String verbstr; /* what you can do with your object. :-) */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a72b5b1b41ec..b4febf26175d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -848,14 +848,12 @@ void Lucerna::toolbar() { void Lucerna::showscore() { const bytefield scorespace = {33, 177, 39, 200}; - Common::String q; if (_vm->_gyro.demo) return; - _vm->_gyro.dna.score = 156; - byte score = _vm->_gyro.dna.score; - byte numbers[3] = {0, 0, 0}; + uint16 score = _vm->_gyro.dna.score; + int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { byte divisor = 1; for (byte j = 0; j < (2 - i); j++) @@ -865,38 +863,29 @@ void Lucerna::showscore() { } numbers[2] = score; + _vm->_gyro.off(); + //setactivepage(3); + for (byte fv = 0; fv < 3; fv ++) + if (_vm->_gyro.lastscore[fv] != numbers[fv]) { + Graphics::Surface *digit = _vm->_graph.readImage(_vm->_gyro.digit[numbers[fv]]); - //t kell rni a Graph::copySurface() -t hogy *byte tmbt kapjon s mindehol gy is hasznlni!!!! - - - - - - - - //str(_vm->_gyro.dna.score, q); - //while (q[0] < '\3') q = string('0') + q; - - //str(dna.score,q); - //while q[0]<#3 do q:='0'+q; + _vm->_graph.copySurface(*digit, 250 + (fv + 1) * 15, 177); - //_vm->_gyro.off(); + digit->free(); - ////setactivepage(3); - //for (byte fv = 0; fv < 3; fv ++) - // if (_vm->_gyro.lastscore[fv] != q[fv]) - // putimage(250 + fv * 15, 177, _vm->_gyro.digit[q[fv]], 0); + delete digit; + } - //for (byte fv = 0; fv <= 1; fv ++) - // _vm->_trip.getset[fv].remember(scorespace); + for (byte fv = 0; fv < 2; fv ++) + _vm->_trip.getset[fv].remember(scorespace); //setactivepage(1 - cp); - _vm->_gyro.on(); - _vm->_gyro.lastscore = q; - warning("STUB: Lucerna::showscore()"); + _vm->_gyro.on(); + for (byte i = 0; i < 3; i++) + _vm->_gyro.lastscore[i] = numbers[i]; } void Lucerna::points(byte num) { /* Add on no. of points */ @@ -1252,8 +1241,9 @@ void Lucerna::minor_redraw() { _vm->_gyro.cp = 1 - _vm->_gyro.cp; _vm->_trip.getback(); } - - _vm->_gyro.lastscore = "TJA"; /* impossible digits */ + + for (byte i = 0; i < 3; i++) + _vm->_gyro.lastscore[i] = -1; /* impossible digits */ showscore(); dawn(); From b6f42c532ec07be6052d32d2fd86b49c3ca7331b Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 17 Jul 2013 13:00:15 +0200 Subject: [PATCH 0131/1332] AVALANCHE: Partially implement Lucerna::points(). (No sounds.) --- engines/avalanche/lucerna2.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index b4febf26175d..25a571b58928 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -889,7 +889,17 @@ void Lucerna::showscore() { } void Lucerna::points(byte num) { /* Add on no. of points */ + for (byte q = 1; q <= num; q ++) { + _vm->_gyro.dna.score++; + /*if (soundfx) + for (byte fv = 1; fv <= 97; fv ++) + sound(177 + dna.score * 3); + nosound;*/ + } warning("STUB: Lucerna::points()"); + + _vm->_logger.log_score(num, _vm->_gyro.dna.score); + showscore(); } void Lucerna::topcheck() { From d3ec729c8f7dff3689775ad32a42399e4f1ae015 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 17 Jul 2013 20:48:55 +0200 Subject: [PATCH 0132/1332] AVALANCHE: Add Graph::drawLine(). --- engines/avalanche/graph.cpp | 4 ++++ engines/avalanche/graph.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 2143bcf53e9f..9b5662e6be86 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,6 +78,10 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } +void Graph::drawLine(int x0, int y0, int x1, int y1, uint32 color) { + _surface.drawLine(x0, y0, x1, y1, color); +} + Graphics::Surface *Graph::readImage(const byte *source) { Graphics::Surface *picture = new Graphics::Surface; diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index f1a6678fadff..d602864e0f8e 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -56,7 +56,9 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - // Must free the returened pointer!!! + void drawLine(int x0, int y0, int x1, int y1, uint32 color); + + // Must free the returned pointer!!! Graphics::Surface *readImage(const byte *source); void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY); From 42928502977918deafb68987d7c1e54a3bc65490 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 12:04:04 +0200 Subject: [PATCH 0133/1332] AVALANCHE: Stub Dropdown::lightup(). --- engines/avalanche/dropdown2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index d0d90056d02c..bdb81484f4ac 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -139,12 +139,13 @@ void onemenu::movehighlight(int8 add) { } void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - if ((_dr->_vm->_gyro.mx < flx1 * 8) || (_dr->_vm->_gyro.mx > flx2 * 8) || + warning("STUB: Dropdown::onemenu::lightup()"); + /*if ((_dr->_vm->_gyro.mx < flx1 * 8) || (_dr->_vm->_gyro.mx > flx2 * 8) || (_dr->_vm->_gyro.my <= 12) || (_dr->_vm->_gyro.my > fly - 3)) return; highlightnum = (_dr->_vm->_gyro.my - 13) / 10; if (highlightnum == oldy) return; - movehighlight(0); + movehighlight(0);*/ } From dd511cfc0983cb29a22a8f60f26c8c065726844b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 12:06:45 +0200 Subject: [PATCH 0134/1332] AVALANCHE: Implement Gyro::newgame(), update Avalot::setup() and Avalot::run(), add some comment in gyro2.h. --- engines/avalanche/avalot.cpp | 9 ++++-- engines/avalanche/gyro2.cpp | 58 ++++++++++++++++++++++++++++++++++++ engines/avalanche/gyro2.h | 2 +- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a17832817ae9..ec5d9ad75918 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -92,7 +92,8 @@ void Avalot::setup() { _vm->_lucerna.toolbar(); _vm->_scrolls.state(2); _vm->_pingo.copy03(); - _vm->_gyro.lastscore = "TJA"; + for (byte i = 0; i < 3; i++) + _vm->_gyro.lastscore[i] = -1; /* impossible digits */ /* for gd:=0 to 1 do begin @@ -101,6 +102,8 @@ void Avalot::setup() { _vm->_trip.loadtrip(); + _vm->_gyro.reloaded = false; // TODO: Remove it later, when SAVE/LOAD system is implemented. Until then, we always start a new game. + if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)) _vm->_gyro.newgame(); /* no game was requested- load the default */ else { @@ -169,7 +172,9 @@ void Avalot::run(Common::String arg) { _vm->_timeout.one_tick(); - } while (! _vm->_gyro.lmo); + _vm->_graph.refreshScreen(); + + } while (false /*! _vm->_gyro.lmo*/); // So we run only one cycle during the testing. Of course it will be restored later. //restorecrtmode(); //if (logging) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 8319c17ef7b2..054019ecf2f1 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -40,6 +40,8 @@ #include "common/textconsole.h" #include "common/file.h" +#include "common/random.h" + //#include "dropdown.h" //#include "basher.h" @@ -347,6 +349,62 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { } void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ + byte gd, gm; + + for (gm = 0; gm < numtr; gm ++) + if (_vm->_trip.tr[gm].quick) + _vm->_trip.tr[gm].done(); + /* Deallocate sprite. Sorry, beta testers! */ + + _vm->_trip.tr[1].init(0, true, &_vm->_trip); + alive = true; + + score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ + memset(&_vm->_gyro.dna, 0, sizeof(dnatype)); + _vm->_scrolls.natural(); + _vm->_basher.normal_edit(); + _vm->_lucerna.mousepage(0); + dna.spare_evening = "answer a questionnaire"; + dna.like2drink = "beer"; + + dna.pence = 30; /* 2/6 */ dna.rw = stopped; + dna.wearing = clothes; + dna.obj[money] = true; + dna.obj[bodkin] = true; + dna.obj[bell] = true; + dna.obj[clothes] = true; + + thinks = '\2'; + _vm->_lucerna.objectlist(); + ontoolbar = false; + seescroll = false; + + ppos[0][1] = -177; /*tr[1].appear(300,117,right);*/ gd = 0; + //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; + /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ + him = 254; + her = 254; + it = 254; + last_person = 254; /* = Pardon? */ + dna.pass_num = _vm->_rnd->getRandomNumber(30) + 1;//Random(30) + 1; + after_the_scroll = false; + dna.user_moves_avvy = false; + doing_sprite_run = false; + dna.avvy_in_bed = true; + enid_filename = ""; + + for (gd = 0; gd <= 1; gd ++) { + cp = 1 - cp; + _vm->_trip.getback(); + } + + _vm->_lucerna.enterroom(1, 1); + _vm->_trip.new_game_for_trippancy(); + _vm->_lucerna.showscore(); + + _vm->_dropdown.standard_bar(); + _vm->_lucerna.clock_lucerna(); + _vm->_lucerna.sprite_run(); warning("STUB: Gyro::newgame()"); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 1f9d9a15ab15..29de10ca902e 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -519,7 +519,7 @@ class Gyro { int16 talkx, talky; byte talkb, talkf; byte scrollbells; /* no. of times to ring the bell */ - bool ontoolbar, seescroll; + bool ontoolbar, seescroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char objlist[10]; byte *digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! From c46bb2449fc680767d17363af5dd35eca5ae7596 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 12:16:32 +0200 Subject: [PATCH 0135/1332] AVALANCHE: Add comment in Avalot::run(). --- engines/avalanche/avalot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ec5d9ad75918..0b93201bacde 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -172,7 +172,7 @@ void Avalot::run(Common::String arg) { _vm->_timeout.one_tick(); - _vm->_graph.refreshScreen(); + _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. } while (false /*! _vm->_gyro.lmo*/); // So we run only one cycle during the testing. Of course it will be restored later. From 293c8f9b7e44d87d0a3479386a89d525b2e4a812 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 15:13:23 +0200 Subject: [PATCH 0136/1332] AVALANCHE: Add class SpriteInfo to graph.h, use it in Trip. --- engines/avalanche/graph.h | 17 +++++++++++++++++ engines/avalanche/trip6.h | 8 ++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index d602864e0f8e..c79179c70e3b 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -37,6 +37,23 @@ namespace Avalanche { class AvalancheEngine; +typedef byte manitype[2049]; // manitype = array[5..2053] of byte; +// Be aware!!! + +typedef byte siltype[51][11]; /* 35, 4 */ + +class SpriteInfo { +public: + byte xw; /* x-width in bytes */ + byte xl, yl; /* x & y lengths of pictures */ + + manitype *mani[24]; + siltype *sil[24]; + + uint16 size; /* the size of one picture */ +}; + + class Graph { public: static const int16 _screenWidth = 640; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index bbb47852bc04..2c3f963e0302 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -31,6 +31,8 @@ #ifndef TRIP6_H #define TRIP6_H +#include "avalanche/graph.h" + #include "common/scummsys.h" #include "common/str.h" @@ -47,9 +49,7 @@ struct adxtype { /* Second revision of ADX type */ Common::String name/*[13]*/; /* name of character */ // uruk: Note to self: TRAILING /0 !!! Real size: 12 Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. byte num; /* number of pictures */ - byte xl, yl; /* x & y lengths of pictures */ byte seq; /* how many in one stride */ - uint16 size; /* the size of one picture */ byte fgc, bgc; /* foreground & background bubble colours */ byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; @@ -80,13 +80,13 @@ class Trip; class triptype { public: + SpriteInfo _info; + adxtype a; /* vital statistics */ byte face, step; int16 x, y; /* current xy coords */ int16 ox[2], oy[2]; /* last xy coords */ int8 ix, iy; /* amount to move sprite by, each step */ - manitype *mani[24]; - siltype *sil[24]; byte whichsprite; bool quick, visible, homing, check_me; int16 hx, hy; /* homing x & y coords */ From c96ac1664a0038cfa7ef3f38d84b897ee0c4a9a9 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 15:20:50 +0200 Subject: [PATCH 0137/1332] AVALANCHE: Repair build errors due to the introduction of _info in Trip::triptype. --- engines/avalanche/lucerna2.cpp | 6 ++-- engines/avalanche/trip6.cpp | 54 ++++++++++++++++------------------ 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 25a571b58928..43018183780d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -963,14 +963,14 @@ void Lucerna::verte() { /* _vm->_trip.tr[0] : that's the only one we're interested in here */ if (_vm->_gyro.mx < _vm->_trip.tr[0].x) what = 1; - else if (_vm->_gyro.mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0].a.xl)) + else if (_vm->_gyro.mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0]._info.xl)) what = 2; else what = 0; /* On top */ if (_vm->_gyro.my < _vm->_trip.tr[0].y) what += 3; - else if (_vm->_gyro.my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0].a.yl)) + else if (_vm->_gyro.my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0]._info.yl)) what += 6; switch (what) { @@ -1213,7 +1213,7 @@ void Lucerna::delavvy() { triptype &with = _vm->_trip.tr[0]; for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with.a.xl) / 8 + 1, with.y + with.a.yl, 3, page_); + mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); blitfix(); _vm->_gyro.on(); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index a4365f4c5c41..5ca587f8855a 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -86,28 +86,28 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { a.comment += inf.readByte(); a.num = inf.readByte(); - a.xl = inf.readByte(); - a.yl = inf.readByte(); + _info.xl = inf.readByte(); + _info.yl = inf.readByte(); a.seq = inf.readByte(); - a.size = inf.readUint16LE(); + _info.size = inf.readUint16LE(); a.fgc = inf.readByte(); a.bgc = inf.readByte(); a.accinum = inf.readByte(); totalnum = 0; // = 1; - xw = a.xl / 8; - if ((a.xl % 8) > 0) + xw = _info.xl / 8; + if ((_info.xl % 8) > 0) xw++; for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { - sil[totalnum] = new siltype[11 * (a.yl + 1)]; + _info.sil[totalnum] = new siltype[11 * (_info.yl + 1)]; //getmem(sil[totalnum-1], 11 * (a.yl + 1)); - mani[totalnum] = new manitype[a.size - 6]; + _info.mani[totalnum] = new manitype[_info.size - 6]; //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= a.yl; fv ++) - inf.read((*sil[totalnum])[fv], xw); + for (fv = 0; fv <= _info.yl; fv ++) + inf.read((*_info.sil[totalnum])[fv], xw); //blockread(inf, (*sil[totalnum-1])[fv], xw); - inf.read(*mani[totalnum], a.size - 6); + inf.read(*_info.mani[totalnum], _info.size - 6); //blockread(inf, *mani[totalnum-1], a.size - 6); totalnum ++; @@ -168,8 +168,8 @@ bool triptype::collision_check() { for (fv = 1; fv <= _tr->numtr; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && - ((x + a.xl) > _tr->tr[fv].x) && - (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && + ((x + _info.xl) > _tr->tr[fv].x) && + (x < (_tr->tr[fv].x + _tr->tr[fv]._info.xl)) && (_tr->tr[fv].y == y)) return true; @@ -205,8 +205,8 @@ int8 triptype::sgn(int16 x) { void triptype::walkto(byte pednum) { speed(sgn(_tr->_vm->_gyro.peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro.peds[pednum].y - y)); - hx = _tr->_vm->_gyro.peds[pednum].x - a.xl / 2; - hy = _tr->_vm->_gyro.peds[pednum].y - a.yl; + hx = _tr->_vm->_gyro.peds[pednum].x - _info.xl / 2; + hy = _tr->_vm->_gyro.peds[pednum].y - _info.yl; homing = true; } @@ -270,7 +270,7 @@ void triptype::stopwalk() { } void triptype::chatter() { - _tr->_vm->_gyro.talkx = x + a.xl / 2; + _tr->_vm->_gyro.talkx = x + _info.xl / 2; _tr->_vm->_gyro.talky = y; _tr->_vm->_gyro.talkf = a.fgc; _tr->_vm->_gyro.talkb = a.bgc; @@ -346,16 +346,14 @@ triptype *triptype::done() { int32 id; uint16 soa; - adxtype &with = a; - /* nds:=num div seq;*/ - xw = with.xl / 8; - if ((with.xl % 8) > 0) + xw = _info.xl / 8; + if ((_info.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa++) { + for (aa = 1; aa <= /*nds*seq*/ a.num; aa++) { totalnum--; - free(mani[totalnum]); - free(sil[totalnum]); /* <<- Width of a siltype. */ + free(_info.mani[totalnum]); + free(_info.sil[totalnum]); /* <<- Width of a siltype. */ } quick = false; @@ -1016,7 +1014,7 @@ void Trip::rwsp(byte t, byte r) { } void Trip::apped(byte trn, byte np) { - tr[trn].appear(tr[trn].x - tr[trn].a.xl / 2, tr[trn].y - tr[trn].a.yl, _vm->_gyro.peds[np].dir); + tr[trn].appear(tr[trn].x - tr[trn]._info.xl / 2, tr[trn].y - tr[trn]._info.yl, _vm->_gyro.peds[np].dir); rwsp(trn, _vm->_gyro.peds[np].dir); } @@ -1115,9 +1113,9 @@ void Trip::arrow_procs(byte tripnum) { This is so if: a) the bottom of the arrow is below Avvy's head, b) the left of the arrow is left of the right of Avvy's head, and c) the right of the arrow is right of the left of Avvy's head. */ - if (((tr[tripnum].y + tr[tripnum].a.yl) >= tr[1].y) /* A */ - && (tr[tripnum].x <= (tr[1].x + tr[1].a.xl)) /* B */ - && ((tr[tripnum].x + tr[tripnum].a.xl) >= tr[1].x)) { /* C */ + if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[1].y) /* A */ + && (tr[tripnum].x <= (tr[1].x + tr[1]._info.xl)) /* B */ + && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[1].x)) { /* C */ /* OK, it's hit him... what now? */ tr[2].call_eachstep = false; /* prevent recursion. */ @@ -1518,7 +1516,7 @@ void Trip::fliproom(byte room, byte ped) { bool Trip::infield(byte which) { /* returns True if you're within field "which" */ - int16 yy = tr[1].y + tr[1].a.yl; + int16 yy = tr[1].y + tr[1]._info.yl; return (tr[1].x >= _vm->_gyro.fields[which].x1) && (tr[1].x <= _vm->_gyro.fields[which].x2) && (yy >= _vm->_gyro.fields[which].y1) && (yy <= _vm->_gyro.fields[which].y2); @@ -1538,7 +1536,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ } ux = tr[1].x; - uy = tr[1].y + tr[1].a.yl; + uy = tr[1].y + tr[1]._info.yl; nd = false; for (fv = 9; fv <= _vm->_gyro.numfields; fv++) { From a2dfb3635fbc94f78fb5a3409abf1bd0f6ec7d73 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 15:51:46 +0200 Subject: [PATCH 0138/1332] AVALANCHE: Implement/repair multiple functions in Trip. --- engines/avalanche/trip6.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 5ca587f8855a..9cf85f27594a 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -142,7 +142,14 @@ void triptype::original() { } void triptype::andexor() { - warning("STUB: triptype::andexor()"); + + + + if ((vanishifstill) && (ix == 0) && (iy == 0)) + return; + byte picnum = face * a.seq + step + 1; + + _tr->_vm->_graph.drawSprite(_info); } void triptype::turn(byte whichway) { @@ -1255,14 +1262,14 @@ void Trip::call_andexors() { for (int i = 0; i < 5; i++) order[i] = 0; - for (fv = 1; fv <= numtr; fv++) { + for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick && tr[fv].visible) order[fv] = fv; } do { ok = true; - for (fv = 1; fv <= 4; fv++) { + for (fv = 0; fv < 4; fv++) { if (((order[fv] != 0) && (order[fv + 1] != 0)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { /* Swap them! */ @@ -1274,7 +1281,7 @@ void Trip::call_andexors() { } } while (!ok); - for (fv = 1; fv <= 5; fv++) { + for (fv = 0; fv < 5; fv++) { if (order[fv] > 0) tr[order[fv]].andexor(); } From bcab639266c54fc0827f1f0fc483c39ae455b616 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 16:07:07 +0200 Subject: [PATCH 0139/1332] AVALANCHE: Add Graph::drawSprite(). --- engines/avalanche/graph.cpp | 4 ++++ engines/avalanche/graph.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 9b5662e6be86..17462da87448 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -82,6 +82,10 @@ void Graph::drawLine(int x0, int y0, int x1, int y1, uint32 color) { _surface.drawLine(x0, y0, x1, y1, color); } +void Graph::drawSprite(const SpriteInfo &sprite) { + warning("STUB: Graph::drawSprite()"); +} + Graphics::Surface *Graph::readImage(const byte *source) { Graphics::Surface *picture = new Graphics::Surface; diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index c79179c70e3b..01be7b18d49e 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -75,6 +75,8 @@ class Graph { void drawLine(int x0, int y0, int x1, int y1, uint32 color); + void drawSprite(const SpriteInfo &sprite); + // Must free the returned pointer!!! Graphics::Surface *readImage(const byte *source); From 4fc9de5d469625150ee1d78ccca5d9c2a237f3f6 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 20:00:14 +0200 Subject: [PATCH 0140/1332] AVALANCHE: Replace Pingo::copy03() with Graph::refreshScreen(). --- engines/avalanche/avalot.cpp | 4 +--- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/pingo2.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0b93201bacde..0415f95f73fc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -91,7 +91,7 @@ void Avalot::setup() { _vm->_gyro.enid_filename = ""; /* undefined. */ _vm->_lucerna.toolbar(); _vm->_scrolls.state(2); - _vm->_pingo.copy03(); + _vm->_graph.refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) _vm->_gyro.lastscore[i] = -1; /* impossible digits */ @@ -172,8 +172,6 @@ void Avalot::run(Common::String arg) { _vm->_timeout.one_tick(); - _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. - } while (false /*! _vm->_gyro.lmo*/); // So we run only one cycle during the testing. Of course it will be restored later. //restorecrtmode(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 43018183780d..1a55b55a50a4 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -272,7 +272,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); _vm->_celer.load_chunks(xx); - _vm->_pingo.copy03(); + _vm->_graph.refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup() bit = *_vm->_graph.getPixel(0,0); diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index 28f140f7d492..b6113f814120 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -44,7 +44,7 @@ class Pingo { void copy02(); - void copy03(); + void copy03(); // Should always be replaced with _vm->_graph.refreshScreen(); - See Avalot::setup(); void copypage(byte frp, byte top); From e5614ef0dcd185b9fd65a5641d785ff6e4edabda Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 22:31:51 +0200 Subject: [PATCH 0141/1332] AVALANCHE: Fix Gyro::newgame(). --- engines/avalanche/gyro2.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 054019ecf2f1..aba169c6b8f5 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -349,14 +349,13 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { } void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ - byte gd, gm; - - for (gm = 0; gm < numtr; gm ++) + for (byte gm = 0; gm < numtr; gm ++) { if (_vm->_trip.tr[gm].quick) _vm->_trip.tr[gm].done(); + } /* Deallocate sprite. Sorry, beta testers! */ - _vm->_trip.tr[1].init(0, true, &_vm->_trip); + _vm->_trip.tr[0].init(0, true, &_vm->_trip); alive = true; score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ @@ -374,12 +373,13 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ dna.obj[bell] = true; dna.obj[clothes] = true; - thinks = '\2'; + thinks = 2; _vm->_lucerna.objectlist(); ontoolbar = false; seescroll = false; - ppos[0][1] = -177; /*tr[1].appear(300,117,right);*/ gd = 0; + ppos[0][1] = -177; + _vm->_trip.tr[0].appear(300,117,right); //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; @@ -393,7 +393,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ dna.avvy_in_bed = true; enid_filename = ""; - for (gd = 0; gd <= 1; gd ++) { + for (byte gd = 0; gd <= 1; gd ++) { cp = 1 - cp; _vm->_trip.getback(); } @@ -405,7 +405,6 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ _vm->_dropdown.standard_bar(); _vm->_lucerna.clock_lucerna(); _vm->_lucerna.sprite_run(); - warning("STUB: Gyro::newgame()"); } void Gyro::click() { /* "Audio keyboard feedback" */ From 467246c00416d9ed9896d8bcd1eb72e3cd5d151a Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 22:33:08 +0200 Subject: [PATCH 0142/1332] AVALANCHE: Add refreshScreen() to every iteration of the main loop in Avalot::run(). --- engines/avalanche/avalot.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0415f95f73fc..ecd1095cfb81 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -172,6 +172,8 @@ void Avalot::run(Common::String arg) { _vm->_timeout.one_tick(); + _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. + } while (false /*! _vm->_gyro.lmo*/); // So we run only one cycle during the testing. Of course it will be restored later. //restorecrtmode(); From e2e979897ed1aab48db4c8229e8b740756abfd16 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 22:35:55 +0200 Subject: [PATCH 0143/1332] AVALANCHE: Update Graph::drawSprite(), update Trip::axendor() accordingly, fix Trip::call_axendors(). --- engines/avalanche/graph.cpp | 5 ++++- engines/avalanche/graph.h | 2 +- engines/avalanche/trip6.cpp | 13 +++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 17462da87448..af4f56d69852 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -82,7 +82,10 @@ void Graph::drawLine(int x0, int y0, int x1, int y1, uint32 color) { _surface.drawLine(x0, y0, x1, y1, color); } -void Graph::drawSprite(const SpriteInfo &sprite) { +void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { + /* These 2 lines are here SOLELY for testing purposes. */ + Common::Rect r(x, y, x + sprite.xl, y + sprite.yl); + _surface.frameRect(r, magenta); warning("STUB: Graph::drawSprite()"); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 01be7b18d49e..bd3418e005ce 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -75,7 +75,7 @@ class Graph { void drawLine(int x0, int y0, int x1, int y1, uint32 color); - void drawSprite(const SpriteInfo &sprite); + void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); // Must free the returned pointer!!! Graphics::Surface *readImage(const byte *source); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 9cf85f27594a..41abf8cd45bd 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -142,14 +142,11 @@ void triptype::original() { } void triptype::andexor() { - - - if ((vanishifstill) && (ix == 0) && (iy == 0)) return; byte picnum = face * a.seq + step + 1; - _tr->_vm->_graph.drawSprite(_info); + _tr->_vm->_graph.drawSprite(_info, picnum, x, y); } void triptype::turn(byte whichway) { @@ -404,7 +401,7 @@ void Trip::setParent(AvalancheEngine *vm) { void Trip::loadtrip() { byte gm; - for (gm = 1; gm <= numtr; gm++) + for (gm = 0; gm < numtr; gm++) tr[gm].original(); for (int i = 0; i < sizeof(aa); i++) @@ -1255,12 +1252,12 @@ void Trip::geida_procs(byte tripnum) { /* That's all... */ void Trip::call_andexors() { - byte order[5]; + int8 order[5]; byte fv, temp; bool ok; for (int i = 0; i < 5; i++) - order[i] = 0; + order[i] = -1; for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick && tr[fv].visible) @@ -1282,7 +1279,7 @@ void Trip::call_andexors() { } while (!ok); for (fv = 0; fv < 5; fv++) { - if (order[fv] > 0) + if (order[fv] > -1) tr[order[fv]].andexor(); } } From c71d4dcc646ad0ba4720b22d0c5c6f7043a060d1 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 23:10:23 +0200 Subject: [PATCH 0144/1332] AVALANCHE: Lucerna:load() - put the background lower, making space for the toolbar on the top. --- engines/avalanche/lucerna2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1a55b55a50a4..f5d833b800d6 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -261,7 +261,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ } } - _vm->_graph.copySurface(background, 0 ,0); + _vm->_graph.copySurface(background, 0, 10); background.free(); From c6d2b45df9bd068b6d73c9e78fb04e44cf823dae Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 18 Jul 2013 23:56:55 +0200 Subject: [PATCH 0145/1332] AVALANCHE: Implement Lucerna::showrw(). --- engines/avalanche/lucerna2.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f5d833b800d6..6f65927d36ca 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1058,7 +1058,28 @@ void Lucerna::dawn() { -void Lucerna::showrw() { +void Lucerna::showrw() { // It's data is loaded in load_digits(). + if (_vm->_gyro.oldrw == _vm->_gyro.dna.rw) + return; + _vm->_gyro.oldrw = _vm->_gyro.dna.rw; + _vm->_gyro.off(); + + /* for (byte page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + putimage(0, 161, rwlite[with.rw], 0); + }*/ + + Graphics::Surface *rwlite = _vm->_graph.readImage(_vm->_gyro.rwlite[_vm->_gyro.dna.rw]); + + _vm->_graph.copySurface(*rwlite, 0, 161); + + rwlite->free(); + + delete rwlite; + + _vm->_gyro.on(); + //setactivepage(1 - cp); + warning("STUB: Lucerna::showrw()"); } From b18ed9a5ffe67d0e2d76fc1b1cdf8cab5a395fb8 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 19 Jul 2013 10:55:12 +0200 Subject: [PATCH 0146/1332] AVALANCHE: Remove Graph::drawLine(). --- engines/avalanche/graph.cpp | 4 ---- engines/avalanche/graph.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index af4f56d69852..fac96fec01be 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -78,10 +78,6 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } -void Graph::drawLine(int x0, int y0, int x1, int y1, uint32 color) { - _surface.drawLine(x0, y0, x1, y1, color); -} - void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { /* These 2 lines are here SOLELY for testing purposes. */ Common::Rect r(x, y, x + sprite.xl, y + sprite.yl); diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index bd3418e005ce..b825f177b541 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -73,8 +73,6 @@ class Graph { void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - void drawLine(int x0, int y0, int x1, int y1, uint32 color); - void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); // Must free the returned pointer!!! From 4dc97824e602d83a952692e875aeecaed7348f2a Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 19 Jul 2013 11:14:39 +0200 Subject: [PATCH 0147/1332] AVALANCHE: Incorporate Graph::readImage() into Grap::copySurface(), update Lucerna's functions accordingly. Delete Graph::setPixel(). --- engines/avalanche/graph.cpp | 24 +++++++-------------- engines/avalanche/graph.h | 7 +----- engines/avalanche/lucerna2.cpp | 39 +++++++--------------------------- 3 files changed, 17 insertions(+), 53 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index fac96fec01be..84dde5ae951e 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -70,10 +70,6 @@ byte *Graph::getPixel(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); } -void Graph::setPixel(int16 x, int16 y, byte color) { - *(byte *)_surface.getBasePtr(x, y) = color; -} - void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } @@ -85,9 +81,9 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) warning("STUB: Graph::drawSprite()"); } -Graphics::Surface *Graph::readImage(const byte *source) { - Graphics::Surface *picture = new Graphics::Surface; - +void Graph::copySurface(const byte *source, uint16 destX, uint16 destY) { + Graphics::Surface picture; + uint32 i = 0; uint16 pictureWidth = (source[i++] + 1); @@ -95,7 +91,7 @@ Graphics::Surface *Graph::readImage(const byte *source) { uint16 pictureHeight = (source[i++] + 1); pictureHeight += (source[i++] << 8); - picture->create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); + picture.create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); for (byte y = 0; y < pictureHeight; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. @@ -103,17 +99,13 @@ Graphics::Surface *Graph::readImage(const byte *source) { byte pixel = source[i++]; for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; - *(byte *)picture->getBasePtr(x + 7 - i, y) += (pixelBit << plane); + *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } } - return picture; -} - -void Graph::copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY) { - for (uint16 y = 0; y < source.h; y++) - for (uint16 x = 0; x < source.w; x++) - *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)source.getBasePtr(x, y); + for (uint16 y = 0; y < picture.h; y++) + for (uint16 x = 0; x < picture.w; x++) + *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); } void Graph::refreshScreen() { diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index b825f177b541..80f79130bfc2 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -69,16 +69,11 @@ class Graph { byte *getPixel(int16 x, int16 y); - void setPixel(int16 x, int16 y, byte color); - void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - // Must free the returned pointer!!! - Graphics::Surface *readImage(const byte *source); - - void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY); + void copySurface(const byte *source, uint16 destX, uint16 destY); void refreshScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 6f65927d36ca..d58ddfc56671 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -261,7 +261,9 @@ void Lucerna::load(byte n) { /* Load2, actually */ } } - _vm->_graph.copySurface(background, 0, 10); + for (uint16 y = 0; y < backgroundHeight; y++) + for (uint16 x = 0; x < backgroundWidht; x++) + *_vm->_graph.getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y); background.free(); @@ -764,13 +766,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.read(buffer, picsize); - Graphics::Surface *picture = _vm->_graph.readImage(buffer); - - _vm->_graph.copySurface(*picture, 205, 170); - - picture->free(); - - delete picture; + _vm->_graph.copySurface(buffer, 205, 170); delete[] buffer; @@ -827,13 +823,7 @@ void Lucerna::toolbar() { f.read(buffer, bufferSize); - Graphics::Surface *toolbar = _vm->_graph.readImage(buffer); - - _vm->_graph.copySurface(*toolbar, 5, 169); - - toolbar->free(); - - delete toolbar; + _vm->_graph.copySurface(buffer, 5, 169); delete[] buffer; @@ -868,15 +858,8 @@ void Lucerna::showscore() { //setactivepage(3); for (byte fv = 0; fv < 3; fv ++) - if (_vm->_gyro.lastscore[fv] != numbers[fv]) { - Graphics::Surface *digit = _vm->_graph.readImage(_vm->_gyro.digit[numbers[fv]]); - - _vm->_graph.copySurface(*digit, 250 + (fv + 1) * 15, 177); - - digit->free(); - - delete digit; - } + if (_vm->_gyro.lastscore[fv] != numbers[fv]) + _vm->_graph.copySurface(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) _vm->_trip.getset[fv].remember(scorespace); @@ -1069,13 +1052,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). putimage(0, 161, rwlite[with.rw], 0); }*/ - Graphics::Surface *rwlite = _vm->_graph.readImage(_vm->_gyro.rwlite[_vm->_gyro.dna.rw]); - - _vm->_graph.copySurface(*rwlite, 0, 161); - - rwlite->free(); - - delete rwlite; + _vm->_graph.copySurface(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); _vm->_gyro.on(); //setactivepage(1 - cp); From f8ad6eb650957c985974262bcf41779020c09caf Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 19 Jul 2013 11:58:06 +0200 Subject: [PATCH 0148/1332] AVALANCHE: Rename copySurface() to drawPicture(), add some comment to it. --- engines/avalanche/graph.cpp | 9 ++++++--- engines/avalanche/graph.h | 2 +- engines/avalanche/lucerna2.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 84dde5ae951e..5c12884291ff 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -81,18 +81,20 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) warning("STUB: Graph::drawSprite()"); } -void Graph::copySurface(const byte *source, uint16 destX, uint16 destY) { - Graphics::Surface picture; - +void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { uint32 i = 0; + // The height and the width are stored in 2 bytes. uint16 pictureWidth = (source[i++] + 1); pictureWidth += (source[i++] << 8); uint16 pictureHeight = (source[i++] + 1); pictureHeight += (source[i++] << 8); + Graphics::Surface picture; // We make a Surface object for the picture itself. + picture.create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); + // Produce the picture. for (byte y = 0; y < pictureHeight; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. for (uint16 x = 0; x < pictureWidth; x += 8) { @@ -103,6 +105,7 @@ void Graph::copySurface(const byte *source, uint16 destX, uint16 destY) { } } + // Copy the picture to a given place on the screen. for (uint16 y = 0; y < picture.h; y++) for (uint16 x = 0; x < picture.w; x++) *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 80f79130bfc2..4682ca67f89d 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -73,7 +73,7 @@ class Graph { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void copySurface(const byte *source, uint16 destX, uint16 destY); + void drawPicture(const byte *source, uint16 destX, uint16 destY); void refreshScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d58ddfc56671..614a08157d12 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -766,7 +766,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.read(buffer, picsize); - _vm->_graph.copySurface(buffer, 205, 170); + _vm->_graph.drawPicture(buffer, 205, 170); delete[] buffer; @@ -823,7 +823,7 @@ void Lucerna::toolbar() { f.read(buffer, bufferSize); - _vm->_graph.copySurface(buffer, 5, 169); + _vm->_graph.drawPicture(buffer, 5, 169); delete[] buffer; @@ -859,7 +859,7 @@ void Lucerna::showscore() { for (byte fv = 0; fv < 3; fv ++) if (_vm->_gyro.lastscore[fv] != numbers[fv]) - _vm->_graph.copySurface(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); + _vm->_graph.drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) _vm->_trip.getset[fv].remember(scorespace); @@ -1052,7 +1052,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). putimage(0, 161, rwlite[with.rw], 0); }*/ - _vm->_graph.copySurface(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); + _vm->_graph.drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); _vm->_gyro.on(); //setactivepage(1 - cp); From ef77a84c83fb1baab98e91f3e90783d01539efec Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 19 Jul 2013 23:36:00 +0200 Subject: [PATCH 0149/1332] AVALANCHE: Trip: repair triptype:init(), remove unnecessary data field from definition. --- engines/avalanche/trip6.cpp | 37 ++++++++++++++++++++++--------------- engines/avalanche/trip6.h | 1 - 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 41abf8cd45bd..ed64847f3f28 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -50,6 +50,8 @@ namespace Avalanche { void triptype::init(byte spritenum, bool do_check, Trip *tr) { + _tr = tr; + const int32 idshould = -1317732048; int16 gd, gm; byte fv/*,nds*/; @@ -77,13 +79,17 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { inf.skip(2); // Replace variable named 'soa' in the original code. - inf.skip(1); // We don't need to read the size of the string as in the original code. - for (byte i = 0; i < 12; i++) + //inf.skip(1); // We don't need to read the size of the string as in the original code. + byte nameSize = inf.readByte(); + for (byte i = 0; i < nameSize; i++) a.name += inf.readByte(); + inf.skip(12 - nameSize); - inf.skip(1); // Same as above. - for (byte i = 0; i < 16; i++) + //inf.skip(1); // Same as above. + byte commentSize = inf.readByte(); + for (byte i = 0; i < commentSize; i++) a.comment += inf.readByte(); + inf.skip(16 - commentSize); a.num = inf.readByte(); _info.xl = inf.readByte(); @@ -95,9 +101,9 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { a.accinum = inf.readByte(); totalnum = 0; // = 1; - xw = _info.xl / 8; + _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) - xw++; + _info.xw++; for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { _info.sil[totalnum] = new siltype[11 * (_info.yl + 1)]; @@ -105,13 +111,14 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { _info.mani[totalnum] = new manitype[_info.size - 6]; //getmem(mani[totalnum-1], a.size - 6); for (fv = 0; fv <= _info.yl; fv ++) - inf.read((*_info.sil[totalnum])[fv], xw); + inf.read((*_info.sil[totalnum])[fv], _info.xw); //blockread(inf, (*sil[totalnum-1])[fv], xw); inf.read(*_info.mani[totalnum], _info.size - 6); //blockread(inf, *mani[totalnum-1], a.size - 6); - totalnum ++; + totalnum++; } + totalnum++; /* on; */ x = 0; @@ -120,7 +127,8 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { visible = false; xs = 3; ys = 1; - /* if spritenum=1 then newspeed; { Just for the lights. }*/ + if (spritenum == 1) + _tr->newspeed(); /* Just for the lights. */ homing = false; ix = 0; @@ -131,9 +139,8 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { whichsprite = spritenum; vanishifstill = false; call_eachstep = false; + inf.close(); - - _tr = tr; } void triptype::original() { @@ -292,7 +299,7 @@ void triptype::set_up_saver(trip_saver_type &v) { v.homing = homing; v.check_me = check_me; v.count = count; - v.xw = xw; + v.xw = _info.xw; v.xs = xs; v.ys = ys; v.totalnum = totalnum; @@ -315,7 +322,7 @@ void triptype::unload_saver(trip_saver_type v) { homing = v.homing; check_me = v.check_me; count = v.count; - xw = v.xw; + _info.xw = v.xw; xs = v.xs; ys = v.ys; totalnum = v.totalnum; @@ -351,9 +358,9 @@ triptype *triptype::done() { uint16 soa; /* nds:=num div seq;*/ - xw = _info.xl / 8; + _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) - xw += 1; + _info.xw += 1; for (aa = 1; aa <= /*nds*seq*/ a.num; aa++) { totalnum--; free(_info.mani[totalnum]); diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 2c3f963e0302..c202b765309c 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -91,7 +91,6 @@ class triptype { bool quick, visible, homing, check_me; int16 hx, hy; /* homing x & y coords */ byte count; /* counts before changing step */ - byte xw; /* x-width in bytes */ byte xs, ys; /* x & y speed */ byte totalnum; /* total number of sprites */ bool vanishifstill; /* Do we show this sprite if it's still? */ From 459a8ce2f5cbc88d1347249b6459dcc78a693495 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 19 Jul 2013 23:36:58 +0200 Subject: [PATCH 0150/1332] AVALANCHE: Partially implement Graph::drawSprite(). --- engines/avalanche/graph.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 5c12884291ff..bbe7e5e9929e 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -75,9 +75,25 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - /* These 2 lines are here SOLELY for testing purposes. */ - Common::Rect r(x, y, x + sprite.xl, y + sprite.yl); - _surface.frameRect(r, magenta); + + for (byte qay = 0; qay < sprite.yl; qay++) { + byte *mask = new byte[sprite.xl]; + + for (byte qax = 0; qax < sprite.xl; qax++) { + byte count = qax / 8; + mask[qax] = ((*sprite.sil[picnum])[qay][count] >> ((7 - qax % 8)) & 1); + if (mask[qax] == 0) + *getPixel(x + qax, y + qay) = 255; + } + + delete[] mask; + } + +/* + for (fv = 5; fv <= sprite.size - 2; fv ++) + aa[fv] = aa[fv] ^ (*sprite.mani[picnum])[fv]; +*/ + warning("STUB: Graph::drawSprite()"); } @@ -99,9 +115,9 @@ void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. for (uint16 x = 0; x < pictureWidth; x += 8) { byte pixel = source[i++]; - for (byte i = 0; i < 8; i++) { - byte pixelBit = (pixel >> i) & 1; - *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } From 09877044b3b9695368c5772842ce843f1e5026f9 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 10:06:43 +0200 Subject: [PATCH 0151/1332] AVALANCHE: Repair Graph::drawSprite(). --- engines/avalanche/graph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index bbe7e5e9929e..56a9be00cdc6 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -83,7 +83,7 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) byte count = qax / 8; mask[qax] = ((*sprite.sil[picnum])[qay][count] >> ((7 - qax % 8)) & 1); if (mask[qax] == 0) - *getPixel(x + qax, y + qay) = 255; + *getPixel(x + qax, y + qay) = 0; } delete[] mask; From 097572193fd29324a582b18d6b7d80ff643c6776 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 10:40:57 +0200 Subject: [PATCH 0152/1332] AVALANCHE: Update Graph::drawPicture(). --- engines/avalanche/graph.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 56a9be00cdc6..2f5b377cbb55 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -98,13 +98,11 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) } void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { - uint32 i = 0; + // The height and the width are stored in 2-2 bytes. We have to add 1 to each becouse Pascal stores the value of them -1. + uint16 pictureWidth = READ_LE_UINT16(source) + 1; + uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1; - // The height and the width are stored in 2 bytes. - uint16 pictureWidth = (source[i++] + 1); - pictureWidth += (source[i++] << 8); - uint16 pictureHeight = (source[i++] + 1); - pictureHeight += (source[i++] << 8); + uint32 i = 4; Graphics::Surface picture; // We make a Surface object for the picture itself. From 137d33414499584a61640159570768dade068883 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 10:55:19 +0200 Subject: [PATCH 0153/1332] AVALANCHE: Finish implementation of Graph::drawSprite(). --- engines/avalanche/graph.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 2f5b377cbb55..7c9d09edc571 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -89,12 +89,17 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) delete[] mask; } -/* - for (fv = 5; fv <= sprite.size - 2; fv ++) - aa[fv] = aa[fv] ^ (*sprite.mani[picnum])[fv]; -*/ + uint16 i = 0; // Becouse the original siltype starts at 5!!! See Graph.h for definition. - warning("STUB: Graph::drawSprite()"); + for (byte qay = 0; qay < sprite.yl; qay++) + for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (uint16 qax = 0; qax < sprite.xl; qax += 8) { + byte pixel = (*sprite.mani[picnum])[i++]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *getPixel(x + qax + 7 - bit, y + qay) += (pixelBit << plane); + } + } } void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { From 6f20b8f5a24499cd39c55001afcf99ccc987a113 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 11:05:21 +0200 Subject: [PATCH 0154/1332] AVALANCHE: Graph: change 'becouse' to 'because' in comments... --- engines/avalanche/graph.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 7c9d09edc571..7748dad083b7 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -89,7 +89,7 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) delete[] mask; } - uint16 i = 0; // Becouse the original siltype starts at 5!!! See Graph.h for definition. + uint16 i = 0; // Because the original siltype starts at 5!!! See Graph.h for definition. for (byte qay = 0; qay < sprite.yl; qay++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. @@ -103,7 +103,7 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) } void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { - // The height and the width are stored in 2-2 bytes. We have to add 1 to each becouse Pascal stores the value of them -1. + // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 pictureWidth = READ_LE_UINT16(source) + 1; uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1; From e70b5167c9ba9e1802482e0123f448b3c2d250c2 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 11:12:10 +0200 Subject: [PATCH 0155/1332] AVALANCHE: Change computing method of picnum in triptype::andexor(). --- engines/avalanche/trip6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index ed64847f3f28..1758f1b9ef17 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -151,7 +151,7 @@ void triptype::original() { void triptype::andexor() { if ((vanishifstill) && (ix == 0) && (iy == 0)) return; - byte picnum = face * a.seq + step + 1; + byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). _tr->_vm->_graph.drawSprite(_info, picnum, x, y); } From 79c6a48bd244ab4f150945bec0e0e663de987125 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 12:07:21 +0200 Subject: [PATCH 0156/1332] AVALANCHE: Add some blank lines in Trip. --- engines/avalanche/trip6.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 1758f1b9ef17..82139391df78 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -374,6 +374,9 @@ triptype *triptype::done() { + + + getsettype *getsettype::init() { numleft = 0; /* initialise array pointer */ return this; From d6f93d06eeb5e8e8b8d14fbce887db7830baa568 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 12:16:06 +0200 Subject: [PATCH 0157/1332] AVALANCHE: Move flesh_colours() from Lucerna to Graph. Implement it. --- engines/avalanche/graph.cpp | 7 +++++++ engines/avalanche/graph.h | 2 ++ engines/avalanche/lucerna2.cpp | 32 ++------------------------------ 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 7748dad083b7..078842a05f1b 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -66,6 +66,13 @@ Graph::~Graph() { _surface.free(); } + +void Graph::flesh_colours() +{ + g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); +} + + byte *Graph::getPixel(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 4682ca67f89d..7d6db70a1365 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -67,6 +67,8 @@ class Graph { ~Graph(); + void flesh_colours(); + byte *getPixel(int16 x, int16 y); void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 614a08157d12..5d60c75cd1f7 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -216,10 +216,10 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_gyro.off(); _vm->_gyro.clear_vmc(); + + _vm->_graph.flesh_colours(); xx = _vm->_gyro.strf(n); - flesh_colours(); - Common::String filename; filename = filename.format("place%s.avd", xx.c_str()); if (!f.open(filename)) { @@ -1283,34 +1283,6 @@ uint16 Lucerna::bearing(byte whichped) { return bearing_result; } -void Lucerna::flesh_colours() /* assembler; -asm - mov ax,$1012; - mov bx,21; { 21 = light pink (why?) } - mov cx,1; - mov dx,seg @flesh; - mov es,dx; - mov dx,offset @flesh; - int $10; - - mov dx,seg @darkflesh; - mov es,dx; - mov dx,offset @darkflesh; - mov bx,5; { 5 = dark pink. } - int $10; - - jmp @TheEnd; - - @flesh: - db 56,35,35; - - @darkflesh: - db 43,22,22; - - @TheEnd: */ -{ -} - void Lucerna::sprite_run() { /* A sprite run is performed before displaying a scroll, if not all the sprites are still. It performs two fast cycles, only using a few of From 44bf47f75e03f9b599c9aef32f9ecdc95c5b7736 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 12:27:52 +0200 Subject: [PATCH 0158/1332] AVALANCHE: Update Graph::flesh_colours(). --- engines/avalanche/graph.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 078842a05f1b..04b5f2e01572 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -70,6 +70,7 @@ Graph::~Graph() { void Graph::flesh_colours() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); + g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } From a16dc4c558510f8404f2af9d41f5512adba7be1b Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 20 Jul 2013 16:58:37 +0200 Subject: [PATCH 0159/1332] AVALANCHE: Add comments to Graph::drawSprite(). --- engines/avalanche/graph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 04b5f2e01572..3e22f451a58d 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -84,6 +84,7 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { + /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) { byte *mask = new byte[sprite.xl]; @@ -97,6 +98,7 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) delete[] mask; } + /* Then we draw the picture to the blank places. */ uint16 i = 0; // Because the original siltype starts at 5!!! See Graph.h for definition. for (byte qay = 0; qay < sprite.yl; qay++) From 050c60c1926d3bfc1955c642381e00bdf224e861 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 23 Jul 2013 12:34:58 +0200 Subject: [PATCH 0160/1332] AVALANCHE: Implement menuset::update(). --- engines/avalanche/dropdown2.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index bdb81484f4ac..6ee7499a1489 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -191,6 +191,26 @@ void menuset::create(char t, Common::String n, char alttrig, func dw, func dc) { } void menuset::update() { + const bytefield menuspace = {0, 0, 80, 9}; + byte fv, page_, savecp; + + /*setactivepage(3); + setfillstyle(1, _dr->menu_b); + bar(0, 0, 640, 9);*/ + _dr->_vm->_graph.drawBar(0, 0, 640, 9, _dr->menu_b); + + savecp = _dr->_vm->_gyro.cp; + _dr->_vm->_gyro.cp = 3; + + for (fv = 1; fv <= howmany; fv ++) + ddms[fv].display(); + + for (page_ = 0; page_ <= 1; page_ ++) + _dr->_vm->_trip.getset[page_].remember(menuspace); + + _dr->_vm->_gyro.cp = savecp; + + warning("STUB: Dropdown::menuset::update()"); } @@ -616,8 +636,8 @@ void Dropdown::standard_bar() { /* Standard menu bar */ ddm_m.create('O', "Objects", '\30', &Avalanche::Dropdown::ddm__objects, &Avalanche::Dropdown::do__objects); /* here... */ ddm_m.create('P', "People", '\31', &Avalanche::Dropdown::ddm__people, &Avalanche::Dropdown::do__people); ddm_m.create('W', "With", '\21', &Avalanche::Dropdown::ddm__with, &Avalanche::Dropdown::do__with); - ddm_m.update(); + ddm_m.update(); } From 9970ab90fbd73994451088e652d93099d3ef87b8 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 23 Jul 2013 17:21:53 +0200 Subject: [PATCH 0161/1332] AVALANCHE: Dropdown: Repair menuset::update(), implement Dropdown:chalk(). --- engines/avalanche/dropdown2.cpp | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 6ee7499a1489..7b996d63ff09 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -197,7 +197,7 @@ void menuset::update() { /*setactivepage(3); setfillstyle(1, _dr->menu_b); bar(0, 0, 640, 9);*/ - _dr->_vm->_graph.drawBar(0, 0, 640, 9, _dr->menu_b); + _dr->_vm->_graph.drawBar(0, 0, 640, 10, _dr->menu_b); savecp = _dr->_vm->_gyro.cp; _dr->_vm->_gyro.cp = 3; @@ -282,11 +282,37 @@ void Dropdown::find_what_you_can_do_with_it() { } void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { - byte fv, ff, p, bit; - uint16 pageseg; byte ander; + if (valid) + ander = 255; + else + ander = 170; + + for (byte fv = 0; fv < z.size(); fv++) + for (byte ff = 0; ff < 8; ff++) { + byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit | (pixelBit << 1) | (pixelBit << 2); + // We don't have to bother with the planes. See the original. Note that it's the bitwise OR operator! + } + } + + if (! z.contains(t)) + return; + else { + byte fv; + for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. + + // Similar to the cycle before. + byte pixel = ~ ander; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2); + } + } - warning("STUB: Dropdown::chalk()"); + _vm->_lucerna.blitfix(); } void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { From de066939d1d997c66d6c8695ba4f72ed3ccf5c03 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 23 Jul 2013 20:52:26 +0200 Subject: [PATCH 0162/1332] AVALANCHE: Remove warning from menuset::update(). --- engines/avalanche/dropdown2.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 7b996d63ff09..6c7c70e89b73 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -209,9 +209,6 @@ void menuset::update() { _dr->_vm->_trip.getset[page_].remember(menuspace); _dr->_vm->_gyro.cp = savecp; - - - warning("STUB: Dropdown::menuset::update()"); } void menuset::extd(char c) { From 2af413cccfc7f2bd09b097cffa369bb222b20484 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 23 Jul 2013 22:24:20 +0200 Subject: [PATCH 0163/1332] AVALANCHE: Cosmetic correction in Dropdown::chalk(). --- engines/avalanche/dropdown2.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 6c7c70e89b73..ce95fd2b27eb 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -287,13 +287,13 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { for (byte fv = 0; fv < z.size(); fv++) for (byte ff = 0; ff < 8; ff++) { - byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit | (pixelBit << 1) | (pixelBit << 2); - // We don't have to bother with the planes. See the original. Note that it's the bitwise OR operator! - } + byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit | (pixelBit << 1) | (pixelBit << 2); + // We don't have to bother with the planes. See the original. Note that it's the bitwise OR operator! } + } if (! z.contains(t)) return; From 984b478132d4d7bd65c17a7ff5728373e5b2fdd9 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 00:14:07 +0200 Subject: [PATCH 0164/1332] AVALANCHE: Modify comment in Dropdown::chalk(). --- engines/avalanche/dropdown2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index ce95fd2b27eb..8828cb6c9955 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -290,8 +290,9 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit | (pixelBit << 1) | (pixelBit << 2); - // We don't have to bother with the planes. See the original. Note that it's the bitwise OR operator! + *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); + // We don't have to bother with the planes, since they all have the same value. See the original. + // Note that it's the bitwise OR operator! } } From 9e15eee97059c5baf5db7ad197cbd1f577acad5f Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 11:03:52 +0200 Subject: [PATCH 0165/1332] AVALANCHE: Modify Avalot::run() to don't exit after a single loop, comment out the error in getsettype::remember() until I find out why it is invoked. --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/trip6.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ecd1095cfb81..d63790fdbd50 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -174,7 +174,7 @@ void Avalot::run(Common::String arg) { _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. - } while (false /*! _vm->_gyro.lmo*/); // So we run only one cycle during the testing. Of course it will be restored later. + } while (! _vm->_gyro.lmo); //restorecrtmode(); //if (logging) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 82139391df78..5f04ebca579f 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -384,8 +384,8 @@ getsettype *getsettype::init() { void getsettype::remember(bytefield r) { numleft++; - if (numleft > maxgetset) - error("Trip::remember() : runerr_Getset_Overflow"); + //if (numleft > maxgetset) + // error("Trip::remember() : runerr_Getset_Overflow"); gs[numleft] = r; } From 5dc6abe87b174673304826c00c05e54eab53625f Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 12:55:01 +0200 Subject: [PATCH 0166/1332] AVALANCHE: Add event handling. --- engines/avalanche/avalanche.cpp | 16 ++++++--- engines/avalanche/avalanche.h | 2 ++ engines/avalanche/avalot.cpp | 61 +++++++++++++++++++++++++-------- engines/avalanche/avalot.h | 9 +++++ 4 files changed, 70 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 88e6e0edd1bc..0c04e6b8e719 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -26,7 +26,6 @@ */ #include "avalanche/avalanche.h" -#include "avalanche/avalot.h" #include "common/system.h" #include "common/random.h" @@ -103,7 +102,16 @@ namespace Avalanche { // _sound->syncVolume(); } - + void AvalancheEngine::updateEvents() { + Common::Event event; + + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + _avalot.handleKeyDown(event); + } + } + } @@ -255,7 +263,7 @@ namespace Avalanche { _graph.init(); - + // From bootstrp: @@ -270,7 +278,7 @@ namespace Avalanche { if (!zoomy) call_menu(); /* Not run when zoomy. */ - + do { run_avalot(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index bd8e53285b71..fac36b42179c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -108,6 +108,8 @@ class AvalancheEngine : public Engine { Common::String getSavegameFilename(int slot); void syncSoundSettings(); + void updateEvents(); + protected: // Engine APIs Common::Error run(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index d63790fdbd50..21ce5ab49034 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1,28 +1,28 @@ /* ScummVM - Graphic Adventure Engine * - * ScummVM is the legal property of its developers, whose names + * 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. + * 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. * 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. + * 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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + * Copyright (c) 1994-1995 Mike: Mark and Thomas Thurman. */ /* AVALOT The kernel of the program. */ @@ -55,6 +55,14 @@ namespace Avalanche { + + +void Avalot::setParent(AvalancheEngine *vm) { + _vm = vm; +} + + + void Avalot::setup() { int16 gd, gm; @@ -67,7 +75,7 @@ void Avalot::setup() { _vm->_gyro.on_virtual(); gd = 3; gm = 0; - //initgraph(gd, gm, ""); + //initgraph(gd: gm: ""); _vm->_gyro.holdthedawn = true; _vm->_lucerna.dusk(); _vm->_gyro.cmp = 177; @@ -77,7 +85,7 @@ void Avalot::setup() { _vm->_gyro.oldjw = 177; _vm->_gyro.mousetext = ""; _vm->_gyro.c = 999; - //settextjustify(0, 0); + //settextjustify(0: 0); _vm->_gyro.ddmnow = false; _vm->_lucerna.load_digits(); _vm->_gyro.cheat = false; @@ -97,12 +105,12 @@ void Avalot::setup() { /* for gd:=0 to 1 do begin - setactivepage(gd); outtextxy(7,177,chr(48+gd)); + setactivepage(gd); outtextxy(7:177:chr(48+gd)); end;*/ _vm->_trip.loadtrip(); - _vm->_gyro.reloaded = false; // TODO: Remove it later, when SAVE/LOAD system is implemented. Until then, we always start a new game. + _vm->_gyro.reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game. if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)) _vm->_gyro.newgame(); /* no game was requested- load the default */ @@ -132,7 +140,7 @@ void Avalot::setup() { } _vm->_trip.get_back_loretta(); - //gm = getpixel(0, 0); + //gm = getpixel(0: 0); //setcolor(7); _vm->_gyro.holdthedawn = false; _vm->_lucerna.dawn(); @@ -141,14 +149,33 @@ void Avalot::setup() { _vm->_trip.newspeed(); if (! _vm->_gyro.reloaded) - _vm->_visa.dixi('q', 83); /* Info on the game, etc. */ + _vm->_visa.dixi('q', 83); /* Info on the game: etc. */ } -void Avalot::setParent(AvalancheEngine *vm) { - _vm = vm; + + +void Avalot::handleKeyDown(const Common::Event &event) { + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + case Common::KEYCODE_DOWN: + case Common::KEYCODE_RIGHT: + case Common::KEYCODE_LEFT: + case Common::KEYCODE_PAGEUP: + case Common::KEYCODE_PAGEDOWN: + case Common::KEYCODE_HOME: + case Common::KEYCODE_END: + handleMoveKey(event); // Fallthroughs are intended. + break; + } + +} + +void Avalot::handleMoveKey(const Common::Event &event) { + warning("STUB: Avalot::handleMoveKey()"); } + void Avalot::run(Common::String arg) { setup(); @@ -172,6 +199,12 @@ void Avalot::run(Common::String arg) { _vm->_timeout.one_tick(); + + + // Not in the original: + + _vm->updateEvents(); // The event handler. + _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. } while (! _vm->_gyro.lmo); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 50bff720b379..502358ede23a 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -30,6 +30,7 @@ #ifndef AVALOT_H #define AVALOT_H +#include "common/events.h" #include "common/system.h" namespace Avalanche { @@ -41,6 +42,14 @@ class Avalot { void setup(); + + + void handleKeyDown(const Common::Event &event); + + void handleMoveKey(const Common::Event &event); // To replace Trip::tripkey(). + + + void run(Common::String arg); private: From 3058a02ab9d3c8791768fb7b60556e61d2414f8c Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 12:56:55 +0200 Subject: [PATCH 0167/1332] AVALANCHE: Fix commas. --- engines/avalanche/avalot.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 21ce5ab49034..0dcfd8420de9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1,22 +1,22 @@ /* ScummVM - Graphic Adventure Engine * - * ScummVM is the legal property of its developers: whose names + * 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. + * 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. * 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. + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ From bddc0e5cbf1046aef3d6dfe543954477791d4b3b Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 13:11:24 +0200 Subject: [PATCH 0168/1332] AVALANCHE: Move handleMoveKey() from Avalot to Trip. --- engines/avalanche/avalot.cpp | 6 +----- engines/avalanche/avalot.h | 2 +- engines/avalanche/trip6.cpp | 7 +++++++ engines/avalanche/trip6.h | 5 +++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0dcfd8420de9..7b315b3c079e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -164,16 +164,12 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_HOME: case Common::KEYCODE_END: - handleMoveKey(event); // Fallthroughs are intended. + _vm->_trip.handleMoveKey(event); // Fallthroughs are intended. break; } } -void Avalot::handleMoveKey(const Common::Event &event) { - warning("STUB: Avalot::handleMoveKey()"); -} - void Avalot::run(Common::String arg) { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 502358ede23a..24ee4fe03eba 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -46,7 +46,7 @@ class Avalot { void handleKeyDown(const Common::Event &event); - void handleMoveKey(const Common::Event &event); // To replace Trip::tripkey(). + diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 5f04ebca579f..b90c50009bce 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1567,4 +1567,11 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ tr[1].visible = false; } + + +void Trip::handleMoveKey(const Common::Event &event) { + warning("STUB: Avalot::handleMoveKey()"); +} + + } // End of namespace Avalanche. diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index c202b765309c..bd9b00a6083e 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -223,6 +223,11 @@ class Trip { void take_a_step(byte &tripnum); + + + void handleMoveKey(const Common::Event &event); // To replace tripkey(). + + triptype tr[numtr]; getsettype getset[2]; byte aa[1600]; From e8841fbe5c39ff07aa099f8207cd8d571779585e Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 13:38:32 +0200 Subject: [PATCH 0169/1332] AVALANCHE: Implement Trip::handleMoveKey(), update Avalot::handleKeyDown(). --- engines/avalanche/avalot.cpp | 1 + engines/avalanche/trip6.cpp | 67 +++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7b315b3c079e..1d62e0b96c41 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -164,6 +164,7 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_HOME: case Common::KEYCODE_END: + case Common::KEYCODE_KP5: _vm->_trip.handleMoveKey(event); // Fallthroughs are intended. break; } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index b90c50009bce..3d8d540ef3ce 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1570,7 +1570,72 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ void Trip::handleMoveKey(const Common::Event &event) { - warning("STUB: Avalot::handleMoveKey()"); + //if ((_vm->_gyro.ctrl == cjoy) | (!_vm->_gyro.dna.user_moves_avvy)) + // return; + // + // We don't mess around with the joystick. + + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + if (_vm->_gyro.dna.rw != up) { + _vm->_gyro.dna.rw = up; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_DOWN: + if (_vm->_gyro.dna.rw != down) { + _vm->_gyro.dna.rw = down; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_LEFT: + if (_vm->_gyro.dna.rw != left) { + _vm->_gyro.dna.rw = left; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_RIGHT: + if (_vm->_gyro.dna.rw != right) { + _vm->_gyro.dna.rw = right; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEUP: + if (_vm->_gyro.dna.rw != ur) { + _vm->_gyro.dna.rw = ur; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEDOWN: + if (_vm->_gyro.dna.rw != dr) { + _vm->_gyro.dna.rw = dr; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_END: + if (_vm->_gyro.dna.rw != dl) { + _vm->_gyro.dna.rw = dl; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_HOME: + if (_vm->_gyro.dna.rw != ul) { + _vm->_gyro.dna.rw = ul; + rwsp(0, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_KP5: + stopwalking(); + break; + } } From aed0c42f152ab9a0bcbefabdc7935d3646433d79 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 13:54:39 +0200 Subject: [PATCH 0170/1332] AVALANCHE: Add comments to Avalot:handleKeyDown(). --- engines/avalanche/avalot.cpp | 6 +++++- engines/avalanche/avalot.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 1d62e0b96c41..f9b6a1fcf5d1 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -155,6 +155,11 @@ void Avalot::setup() { void Avalot::handleKeyDown(const Common::Event &event) { + //if (keyboardclick) + // click(); + // + // To be implemented later with the sounds, I assume. + switch (event.kbd.keycode) { case Common::KEYCODE_UP: case Common::KEYCODE_DOWN: @@ -168,7 +173,6 @@ void Avalot::handleKeyDown(const Common::Event &event) { _vm->_trip.handleMoveKey(event); // Fallthroughs are intended. break; } - } diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 24ee4fe03eba..d309138c5a9a 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -44,7 +44,7 @@ class Avalot { - void handleKeyDown(const Common::Event &event); + void handleKeyDown(const Common::Event &event); // To replace Basher::keyboard_link(). From aa0603cf427c2a703325abab061d9b16f09cf4cd Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 16:42:23 +0200 Subject: [PATCH 0171/1332] AVALANCHE: rename constants to follow our code formatting conventions. --- engines/avalanche/graph.cpp | 6 +++--- engines/avalanche/graph.h | 4 ++-- engines/avalanche/lucerna2.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp index 3e22f451a58d..b3d5012353df 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graph.cpp @@ -48,7 +48,7 @@ void Graph::setParent(AvalancheEngine *vm) { } void Graph::init() { - initGraphics(_screenWidth, _screenHeight, true); + initGraphics(kScreenWidth, kScreenHeight, true); for (int i = 0; i < 64; ++i) { _egaPalette[i][0] = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; @@ -59,7 +59,7 @@ void Graph::init() { for (byte i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1); - _surface.create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8()); + _surface.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); } Graph::~Graph() { @@ -141,7 +141,7 @@ void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { } void Graph::refreshScreen() { - g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, _screenWidth, _screenHeight); + g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, kScreenWidth, kScreenHeight); g_system->updateScreen(); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h index 7d6db70a1365..e24e042abd8d 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graph.h @@ -56,8 +56,8 @@ class SpriteInfo { class Graph { public: - static const int16 _screenWidth = 640; - static const int16 _screenHeight = 200; + static const int16 kScreenWidth = 640; + static const int16 kScreenHeight = 200; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5d60c75cd1f7..d75468d99c0f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -245,8 +245,8 @@ void Lucerna::load(byte n) { /* Load2, actually */ Graphics::Surface background; - uint16 backgroundWidht = _vm->_graph._screenWidth; - byte backgroundHeight = 8 * 12080 / _vm->_graph._screenWidth; // With 640 width it's 151 + uint16 backgroundWidht = _vm->_graph.kScreenWidth; + byte backgroundHeight = 8 * 12080 / _vm->_graph.kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) background.create(backgroundWidht, backgroundHeight, Graphics::PixelFormat::createFormatCLUT8()); From 0d6a327f98b1c4d02d78927f78f2865c000bf816 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 16:43:34 +0200 Subject: [PATCH 0172/1332] AVALANCHE: Remove unnecessary indents from avalanche.cpp. --- engines/avalanche/avalanche.cpp | 354 ++++++++++++++++---------------- 1 file changed, 177 insertions(+), 177 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 0c04e6b8e719..2007d6b2dfb4 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -65,53 +65,53 @@ namespace Avalanche { _timeout.setParent(this); _trip.setParent(this); _acci.setParent(this); - _basher.setParent(this); - _dropdown.setParent(this); - _closing.setParent(this); - _avalot.setParent(this); - } - - AvalancheEngine::~AvalancheEngine() { - delete _console; - delete _rnd; - } - - GUI::Debugger *AvalancheEngine::getDebugger() { - return _console; - } - - Common::Platform AvalancheEngine::getPlatform() const { - return _platform; - } - - bool AvalancheEngine::hasFeature(EngineFeature f) const { - return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); - } - - const char *AvalancheEngine::getCopyrightString() const { - return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; - } - - Common::String AvalancheEngine::getSavegameFilename(int slot) { - return _targetName + Common::String::format("-%02d.SAV", slot); - } - - void AvalancheEngine::syncSoundSettings() { - Engine::syncSoundSettings(); - - // _sound->syncVolume(); - } - - void AvalancheEngine::updateEvents() { - Common::Event event; - - while (_eventMan->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - _avalot.handleKeyDown(event); - } + _basher.setParent(this); + _dropdown.setParent(this); + _closing.setParent(this); + _avalot.setParent(this); +} + +AvalancheEngine::~AvalancheEngine() { + delete _console; + delete _rnd; +} + +GUI::Debugger *AvalancheEngine::getDebugger() { + return _console; +} + +Common::Platform AvalancheEngine::getPlatform() const { + return _platform; +} + +bool AvalancheEngine::hasFeature(EngineFeature f) const { + return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); +} + +const char *AvalancheEngine::getCopyrightString() const { + return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; +} + +Common::String AvalancheEngine::getSavegameFilename(int slot) { + return _targetName + Common::String::format("-%02d.SAV", slot); +} + +void AvalancheEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + // _sound->syncVolume(); +} + +void AvalancheEngine::updateEvents() { + Common::Event event; + + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + _avalot.handleKeyDown(event); } } +} @@ -119,193 +119,193 @@ namespace Avalanche { - // From Bootstrp: +// From Bootstrp: - const char AvalancheEngine::runcodes[2][3] = {"et", "Go"}; +const char AvalancheEngine::runcodes[2][3] = {"et", "Go"}; - // The original ones were all commented out, so porbably there's no need - // of these two cursor functions at all. TODO: Remove later. - void AvalancheEngine::cursor_off() { - warning("STUB: cursor_off()"); - } +// The original ones were all commented out, so porbably there's no need +// of these two cursor functions at all. TODO: Remove later. +void AvalancheEngine::cursor_off() { + warning("STUB: cursor_off()"); +} - void AvalancheEngine::cursor_on() { - warning("STUB: cursor_on()"); - } +void AvalancheEngine::cursor_on() { + warning("STUB: cursor_on()"); +} - // Needed later. - void AvalancheEngine::quit() { - cursor_on(); - } +// Needed later. +void AvalancheEngine::quit() { + cursor_on(); +} - Common::String AvalancheEngine::strf(int32 x) { - Common::String q = Common::String::format("%d", x); - return q; - } +Common::String AvalancheEngine::strf(int32 x) { + Common::String q = Common::String::format("%d", x); + return q; +} - // Needed in dos_shell(). TODO: Remove later. - Common::String AvalancheEngine::command_com() { - warning("STUB: command_com()"); - return ("STUB: command_com()"); - } +// Needed in dos_shell(). TODO: Remove later. +Common::String AvalancheEngine::command_com() { + warning("STUB: command_com()"); + return ("STUB: command_com()"); +} - // Needed for run_avalot()'s errors. TODO: Remove later. - void AvalancheEngine::explain(byte error) { - warning("STUB: explain()"); - } +// Needed for run_avalot()'s errors. TODO: Remove later. +void AvalancheEngine::explain(byte error) { + warning("STUB: explain()"); +} - //TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) +//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) - void AvalancheEngine::b_flight() { /*interrupt;*/ - _storage.skellern++; - } +void AvalancheEngine::b_flight() { /*interrupt;*/ + _storage.skellern++; +} - void AvalancheEngine::bflight_on() { - _storage.skellern = _reset_; - // setintvec(0x1c, &b_flight); - } +void AvalancheEngine::bflight_on() { + _storage.skellern = _reset_; + // setintvec(0x1c, &b_flight); +} - void AvalancheEngine::bflight_off() { - // setintvec(0x1c, old_1c); - } +void AvalancheEngine::bflight_off() { + // setintvec(0x1c, old_1c); +} - Common::String AvalancheEngine::elm2str(elm how) { - Common::String elm2str_result; - switch (how) { - case Normal: - case Musical: - elm2str_result = "jsb"; - break; - case Regi: - elm2str_result = "REGI"; - break; - case Elmpoyten: - elm2str_result = "ELMPOYTEN"; - break; - } - return elm2str_result; +Common::String AvalancheEngine::elm2str(elm how) { + Common::String elm2str_result; + switch (how) { + case Normal: + case Musical: + elm2str_result = "jsb"; + break; + case Regi: + elm2str_result = "REGI"; + break; + case Elmpoyten: + elm2str_result = "ELMPOYTEN"; + break; } + return elm2str_result; +} - void AvalancheEngine::run(Common::String what, bool with_jsb, bool with_bflight, elm how) { - warning("STUB: run(%s)", what.c_str()); - // Probably there'll be no need of this function, as all *.AVX-es will become classes. - } +void AvalancheEngine::run(Common::String what, bool with_jsb, bool with_bflight, elm how) { + warning("STUB: run(%s)", what.c_str()); + // Probably there'll be no need of this function, as all *.AVX-es will become classes. +} - void AvalancheEngine::get_arguments() { - // This function should mess around with command line arguments, - // but I am not sure if there'll be use of these arguments at all... - warning("STUB: get_arguments()"); - } +void AvalancheEngine::get_arguments() { + // This function should mess around with command line arguments, + // but I am not sure if there'll be use of these arguments at all... + warning("STUB: get_arguments()"); +} - void AvalancheEngine::get_slope() { - // Same as get_arguments() - warning("STUB: get_slope()"); - } +void AvalancheEngine::get_slope() { + // Same as get_arguments() + warning("STUB: get_slope()"); +} - void AvalancheEngine::call_menu() { - warning("STUB: call_menu()"); - } +void AvalancheEngine::call_menu() { + warning("STUB: call_menu()"); +} - void AvalancheEngine::run_the_demo() { - warning("STUB: run_the_demo()"); - } +void AvalancheEngine::run_the_demo() { + warning("STUB: run_the_demo()"); +} - void AvalancheEngine::dos_shell() { - warning("STUB: dos_shell()"); - } +void AvalancheEngine::dos_shell() { + warning("STUB: dos_shell()"); +} - // Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. - bool AvalancheEngine::keypressed1() { - warning("STUB: keypressed1()"); - return false; - } +// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. +bool AvalancheEngine::keypressed1() { + warning("STUB: keypressed1()"); + return false; +} - // Same as keypressed1(). - void AvalancheEngine::flush_buffer() { - warning("STUB: flush_buffer()"); - } +// Same as keypressed1(). +void AvalancheEngine::flush_buffer() { + warning("STUB: flush_buffer()"); +} - // Same as keypressed1(). - void AvalancheEngine::demo() { - warning("STUB: demo()"); - } +// Same as keypressed1(). +void AvalancheEngine::demo() { + warning("STUB: demo()"); +} - void AvalancheEngine::run_avalot() { - bflight_on(); +void AvalancheEngine::run_avalot() { + bflight_on(); - _avalot.run(Common::String(runcodes[first_time]) + arguments); - // TODO: Check if parameteres are ever used (probably not) and eventually remove them. - // If there's an error initalizing avalot, i'll handle it in there, not here + _avalot.run(Common::String(runcodes[first_time]) + arguments); + // TODO: Check if parameteres are ever used (probably not) and eventually remove them. + // If there's an error initalizing avalot, i'll handle it in there, not here - first_time = false; - } + first_time = false; +} - Common::Error AvalancheEngine::run() { - s_Engine = this; +Common::Error AvalancheEngine::run() { + s_Engine = this; - _console = new AvalancheConsole(this); + _console = new AvalancheConsole(this); - _scrolls.init(); - _lucerna.init(); - _acci.init(); - _basher.init(); - _graph.init(); + _scrolls.init(); + _lucerna.init(); + _acci.init(); + _basher.init(); + _graph.init(); - // From bootstrp: + // From bootstrp: - first_time = true; + first_time = true; - get_arguments(); - get_slope(); + get_arguments(); + get_slope(); - zoomy = true; - // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, - // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. - if (!zoomy) - call_menu(); /* Not run when zoomy. */ + zoomy = true; + // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, + // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. + if (!zoomy) + call_menu(); /* Not run when zoomy. */ - do { - run_avalot(); + do { + run_avalot(); - //if (dosexitcode != 77) quit(); /* Didn't stop for us. */ + //if (dosexitcode != 77) quit(); /* Didn't stop for us. */ - switch (_storage.operation) { - case _runShootemup: - run("seu.avx", _jsb, _bflight, Normal); - break; - case _runDosshell: - dos_shell(); - break; - case _runGhostroom: - run("g-room.avx", _jsb, _no_bflight, Normal); - break; - case _runGolden: - run("golden.avx", _jsb, _bflight, Musical); - break; - } + switch (_storage.operation) { + case _runShootemup: + run("seu.avx", _jsb, _bflight, Normal); + break; + case _runDosshell: + dos_shell(); + break; + case _runGhostroom: + run("g-room.avx", _jsb, _no_bflight, Normal); + break; + case _runGolden: + run("golden.avx", _jsb, _bflight, Musical); + break; + } - } while (true); + } while (true); - return Common::kNoError; - } + return Common::kNoError; +} From bc5b3fbb65cc902d9ac2b44f3038f9543342ee96 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 17:02:08 +0200 Subject: [PATCH 0173/1332] AVALANCHE: Rename Graph to Graphics. Update everything accordingly. --- engines/avalanche/avalanche.h | 4 +-- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/{graph.cpp => graphics.cpp} | 28 +++++++++---------- engines/avalanche/{graph.h => graphics.h} | 6 ++-- engines/avalanche/lucerna2.cpp | 4 +-- engines/avalanche/module.mk | 2 +- engines/avalanche/trip6.h | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) rename engines/avalanche/{graph.cpp => graphics.cpp} (82%) rename engines/avalanche/{graph.h => graphics.h} (97%) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index fac36b42179c..122959ee27b9 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -30,7 +30,7 @@ #include "avalanche/console.h" -#include "avalanche/graph.h" +#include "avalanche/graphics.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" @@ -65,7 +65,7 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: - Graph _graph; + Graphics _graph; Avalot _avalot; Gyro _gyro; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f9b6a1fcf5d1..2f62dc1712f5 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -29,7 +29,7 @@ #include "avalanche/avalanche.h" -#include "avalanche/graph.h" +#include "avalanche/graphics.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/trip6.h" diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graphics.cpp similarity index 82% rename from engines/avalanche/graph.cpp rename to engines/avalanche/graphics.cpp index b3d5012353df..aefaa4905414 100644 --- a/engines/avalanche/graph.cpp +++ b/engines/avalanche/graphics.cpp @@ -28,7 +28,7 @@ /* Replacement class for the Graph unit from Pascal. */ #include "avalanche/avalanche.h" -#include "avalanche/graph.h" +#include "avalanche/graphics.h" #include "common/system.h" @@ -39,15 +39,15 @@ namespace Avalanche { -const byte Graph::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; +const byte Graphics::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; -void Graph::setParent(AvalancheEngine *vm) { +void Graphics::setParent(AvalancheEngine *vm) { _vm = vm; } -void Graph::init() { +void Graphics::init() { initGraphics(kScreenWidth, kScreenHeight, true); for (int i = 0; i < 64; ++i) { @@ -59,30 +59,30 @@ void Graph::init() { for (byte i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1); - _surface.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); + _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } -Graph::~Graph() { +Graphics::~Graphics() { _surface.free(); } -void Graph::flesh_colours() +void Graphics::flesh_colours() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } -byte *Graph::getPixel(int16 x, int16 y) { +byte *Graphics::getPixel(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); } -void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { +void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } -void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { +void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) { @@ -112,16 +112,16 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) } } -void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { +void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) { // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 pictureWidth = READ_LE_UINT16(source) + 1; uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1; uint32 i = 4; - Graphics::Surface picture; // We make a Surface object for the picture itself. + ::Graphics::Surface picture; // We make a Surface object for the picture itself. - picture.create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8()); + picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. for (byte y = 0; y < pictureHeight; y++) @@ -140,7 +140,7 @@ void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) { *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); } -void Graph::refreshScreen() { +void Graphics::refreshScreen() { g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, kScreenWidth, kScreenHeight); g_system->updateScreen(); } diff --git a/engines/avalanche/graph.h b/engines/avalanche/graphics.h similarity index 97% rename from engines/avalanche/graph.h rename to engines/avalanche/graphics.h index e24e042abd8d..333cbddfca59 100644 --- a/engines/avalanche/graph.h +++ b/engines/avalanche/graphics.h @@ -54,7 +54,7 @@ class SpriteInfo { }; -class Graph { +class Graphics { public: static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; @@ -65,7 +65,7 @@ class Graph { void init(); - ~Graph(); + ~Graphics(); void flesh_colours(); @@ -82,7 +82,7 @@ class Graph { private: AvalancheEngine *_vm; - Graphics::Surface _surface; + ::Graphics::Surface _surface; static const byte _egaPaletteIndex[16]; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d75468d99c0f..3b30451bed5c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -243,13 +243,13 @@ void Lucerna::load(byte n) { /* Load2, actually */ move(a0, a1, 12080); }*/ - Graphics::Surface background; + ::Graphics::Surface background; uint16 backgroundWidht = _vm->_graph.kScreenWidth; byte backgroundHeight = 8 * 12080 / _vm->_graph.kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) - background.create(backgroundWidht, backgroundHeight, Graphics::PixelFormat::createFormatCLUT8()); + background.create(backgroundWidht, backgroundHeight, ::Graphics::PixelFormat::createFormatCLUT8()); for (byte plane = 0; plane < 4; plane++) for (uint16 y = 0; y < backgroundHeight; y++) diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 222482e40666..306df155132c 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -2,7 +2,7 @@ MODULE := engines/avalanche MODULE_OBJS = \ avalanche.o \ - graph.o \ + graphics.o \ avalot.o \ console.o \ detection.o \ diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index bd9b00a6083e..4b84221e11a1 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -31,7 +31,7 @@ #ifndef TRIP6_H #define TRIP6_H -#include "avalanche/graph.h" +#include "avalanche/graphics.h" #include "common/scummsys.h" #include "common/str.h" From 043ded818508a14a0ef909bd7c151b355d8bb597 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 17:02:38 +0200 Subject: [PATCH 0174/1332] AVALANCHE: Implement triptype::walk(). --- engines/avalanche/trip6.cpp | 74 +++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 3d8d540ef3ce..0f648cf400fa 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -175,9 +175,7 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { } bool triptype::collision_check() { - byte fv; - - for (fv = 1; fv <= _tr->numtr; fv++) + for (byte fv = 0; fv < _tr->numtr; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + _info.xl) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv]._info.xl)) && @@ -188,7 +186,75 @@ bool triptype::collision_check() { } void triptype::walk() { - warning("STUB: triptype::walk()"); + byte tc; + bytefield r; + + + if (visible) { + { + r.x1 = (x / 8) - 1; + if (r.x1 == 255) + r.x1 = 0; + r.y1 = y - 2; + r.x2 = ((x + _info.xl) / 8) + 1; + r.y2 = y + _info.yl + 2; + } + _tr->getset[1 - _tr->_vm->_gyro.cp].remember(r); + } + + if (!_tr->_vm->_gyro.doing_sprite_run) { + ox[_tr->_vm->_gyro.cp] = x; + oy[_tr->_vm->_gyro.cp] = y; + if (homing) homestep(); + x = x + ix; + y = y + iy; + } + + if (check_me) { + if (collision_check()) { + bounce(); + return; + } + + tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro.cp], y, _info.yl); + + if ((tc != 0) & (!_tr->_vm->_gyro.doing_sprite_run)) { + switch (_tr->_vm->_gyro.magics[tc].op) { + case _tr->_vm->_gyro.exclaim: { + bounce(); + _tr->mustexclaim = true; + _tr->saywhat = _tr->_vm->_gyro.magics[tc].data; + } + break; + case _tr->_vm->_gyro.bounces: + bounce(); + break; + case _tr->_vm->_gyro.transport: + _tr->fliproom(_tr->_vm->_gyro.magics[tc].data >> 8, _tr->_vm->_gyro.magics[tc].data & 0xff); + break; + case _tr->_vm->_gyro.unfinished: { + bounce(); + _tr->_vm->_scrolls.display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case _tr->_vm->_gyro.special: + _tr->call_special(_tr->_vm->_gyro.magics[tc].data); + break; + case _tr->_vm->_gyro.mopendoor: + _tr->open_the_door(_tr->_vm->_gyro.magics[tc].data >> 8, _tr->_vm->_gyro.magics[tc].data & 0xff, tc); + break; + } + } + } + + if (!_tr->_vm->_gyro.doing_sprite_run) { + count += 1; + if (((ix != 0) || (iy != 0)) && (count > 1)) { + step += 1; + if (step == a.seq) step = 0; + count = 0; + } + } } void triptype::bounce() { From ba581b0b325d14684dcb9a302fd06c098cacea05 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 17:12:46 +0200 Subject: [PATCH 0175/1332] AVALANCHE: Fix indents in avalanche.cpp. --- engines/avalanche/avalanche.cpp | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2007d6b2dfb4..aa9fe9f6279a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -41,30 +41,30 @@ namespace Avalanche { - AvalancheEngine *AvalancheEngine::s_Engine = 0; - - AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { - _system = syst; - _console = new AvalancheConsole(this); - - _rnd = new Common::RandomSource("avalanche"); - _rnd->setSeed(42); - - _graph.setParent(this); - - _gyro.setParent(this); - _enhanced.setParent(this); - _logger.setParent(this); - _pingo.setParent(this); - _scrolls.setParent(this); - _visa.setParent(this); - _lucerna.setParent(this); - _enid.setParent(this); - _celer.setParent(this); - _sequence.setParent(this); - _timeout.setParent(this); - _trip.setParent(this); - _acci.setParent(this); +AvalancheEngine *AvalancheEngine::s_Engine = 0; + +AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { + _system = syst; + _console = new AvalancheConsole(this); + + _rnd = new Common::RandomSource("avalanche"); + _rnd->setSeed(42); + + _graph.setParent(this); + + _gyro.setParent(this); + _enhanced.setParent(this); + _logger.setParent(this); + _pingo.setParent(this); + _scrolls.setParent(this); + _visa.setParent(this); + _lucerna.setParent(this); + _enid.setParent(this); + _celer.setParent(this); + _sequence.setParent(this); + _timeout.setParent(this); + _trip.setParent(this); + _acci.setParent(this); _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); From 8c5ce549e655a0f739cd161ed33efa6750a8fd95 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 17:52:57 +0200 Subject: [PATCH 0176/1332] AVALANCHE: Change _graphics into a pointer, modify the rest of the code accordingly. Introduce AvalanhceEngine::initialize(), use it in AvalancheEninge::run(), modify rest of the code accordingly. --- engines/avalanche/avalanche.cpp | 39 ++++++++++++++++++++------------- engines/avalanche/avalanche.h | 6 +++-- engines/avalanche/avalot.cpp | 4 ++-- engines/avalanche/dropdown2.cpp | 6 ++--- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/graphics.h | 2 +- engines/avalanche/lucerna2.cpp | 20 ++++++++--------- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/trip6.cpp | 2 +- 9 files changed, 47 insertions(+), 36 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index aa9fe9f6279a..4b51c8babd32 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -45,12 +45,22 @@ AvalancheEngine *AvalancheEngine::s_Engine = 0; AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { _system = syst; + s_Engine = this; _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); _rnd->setSeed(42); +} + +AvalancheEngine::~AvalancheEngine() { + delete _console; + delete _rnd; + + delete _graphics; +} - _graph.setParent(this); +Common::ErrorCode AvalancheEngine::initialize() { + _graphics = new Graphics(this); _gyro.setParent(this); _enhanced.setParent(this); @@ -69,13 +79,19 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _dropdown.setParent(this); _closing.setParent(this); _avalot.setParent(this); -} -AvalancheEngine::~AvalancheEngine() { - delete _console; - delete _rnd; + _graphics->init(); + + _scrolls.init(); + _lucerna.init(); + _acci.init(); + _basher.init(); + + + return Common::kNoError; } + GUI::Debugger *AvalancheEngine::getDebugger() { return _console; } @@ -252,17 +268,10 @@ void AvalancheEngine::run_avalot() { Common::Error AvalancheEngine::run() { - s_Engine = this; + Common::ErrorCode err = initialize(); + if (err != Common::kNoError) + return err; - _console = new AvalancheConsole(this); - - _scrolls.init(); - _lucerna.init(); - _acci.init(); - _basher.init(); - _graph.init(); - - // From bootstrp: diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 122959ee27b9..676f3f909a7c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -65,7 +65,7 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: - Graphics _graph; + Graphics *_graphics; Avalot _avalot; Gyro _gyro; @@ -86,11 +86,13 @@ class AvalancheEngine : public Engine { Closing _closing; + OSystem *_system; + AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); - OSystem *_system; + Common::ErrorCode initialize(); GUI::Debugger *getDebugger(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2f62dc1712f5..9e64ae4ab4dc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -99,7 +99,7 @@ void Avalot::setup() { _vm->_gyro.enid_filename = ""; /* undefined. */ _vm->_lucerna.toolbar(); _vm->_scrolls.state(2); - _vm->_graph.refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. + _vm->_graphics->refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) _vm->_gyro.lastscore[i] = -1; /* impossible digits */ @@ -206,7 +206,7 @@ void Avalot::run(Common::String arg) { _vm->updateEvents(); // The event handler. - _vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. + _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. } while (! _vm->_gyro.lmo); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 8828cb6c9955..219df15fc284 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -197,7 +197,7 @@ void menuset::update() { /*setactivepage(3); setfillstyle(1, _dr->menu_b); bar(0, 0, 640, 9);*/ - _dr->_vm->_graph.drawBar(0, 0, 640, 10, _dr->menu_b); + _dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->menu_b); savecp = _dr->_vm->_gyro.cp; _dr->_vm->_gyro.cp = 3; @@ -290,7 +290,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); + *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); // We don't have to bother with the planes, since they all have the same value. See the original. // Note that it's the bitwise OR operator! } @@ -306,7 +306,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { byte pixel = ~ ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2); + *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2); } } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index aefaa4905414..8035491bfbb0 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -43,7 +43,7 @@ const byte Graphics::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58 -void Graphics::setParent(AvalancheEngine *vm) { +Graphics::Graphics(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 333cbddfca59..1a580029d03c 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -61,7 +61,7 @@ class Graphics { - void setParent(AvalancheEngine *vm); + Graphics(AvalancheEngine *vm); void init(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3b30451bed5c..aefa6bff9765 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -217,7 +217,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_gyro.clear_vmc(); - _vm->_graph.flesh_colours(); + _vm->_graphics->flesh_colours(); xx = _vm->_gyro.strf(n); Common::String filename; @@ -245,8 +245,8 @@ void Lucerna::load(byte n) { /* Load2, actually */ ::Graphics::Surface background; - uint16 backgroundWidht = _vm->_graph.kScreenWidth; - byte backgroundHeight = 8 * 12080 / _vm->_graph.kScreenWidth; // With 640 width it's 151 + uint16 backgroundWidht = _vm->_graphics->kScreenWidth; + byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) background.create(backgroundWidht, backgroundHeight, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -263,7 +263,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ for (uint16 y = 0; y < backgroundHeight; y++) for (uint16 x = 0; x < backgroundWidht; x++) - *_vm->_graph.getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y); + *_vm->_graphics->getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y); background.free(); @@ -274,9 +274,9 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); _vm->_celer.load_chunks(xx); - _vm->_graph.refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup() + _vm->_graphics->refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup() - bit = *_vm->_graph.getPixel(0,0); + bit = *_vm->_graphics->getPixel(0,0); _vm->_logger.log_newroom(_vm->_gyro.roomname); @@ -766,7 +766,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.read(buffer, picsize); - _vm->_graph.drawPicture(buffer, 205, 170); + _vm->_graphics->drawPicture(buffer, 205, 170); delete[] buffer; @@ -823,7 +823,7 @@ void Lucerna::toolbar() { f.read(buffer, bufferSize); - _vm->_graph.drawPicture(buffer, 5, 169); + _vm->_graphics->drawPicture(buffer, 5, 169); delete[] buffer; @@ -859,7 +859,7 @@ void Lucerna::showscore() { for (byte fv = 0; fv < 3; fv ++) if (_vm->_gyro.lastscore[fv] != numbers[fv]) - _vm->_graph.drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); + _vm->_graphics->drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) _vm->_trip.getset[fv].remember(scorespace); @@ -1052,7 +1052,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). putimage(0, 161, rwlite[with.rw], 0); }*/ - _vm->_graph.drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); + _vm->_graphics->drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); _vm->_gyro.on(); //setactivepage(1 - cp); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index e2288b2c0117..35ae4fc4010b 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -92,7 +92,7 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ _vm->_gyro.super_off(); - _vm->_graph.drawBar(419, 195, 438, 197, color); + _vm->_graphics->drawBar(419, 195, 438, 197, color); _vm->_gyro.super_on(); _vm->_gyro.ledstatus = x; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 0f648cf400fa..f9e8faa1e2a3 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -153,7 +153,7 @@ void triptype::andexor() { return; byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). - _tr->_vm->_graph.drawSprite(_info, picnum, x, y); + _tr->_vm->_graphics->drawSprite(_info, picnum, x, y); } void triptype::turn(byte whichway) { From cc6197d77f9fc97243473f59cda144f95c0b25c3 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:12:16 +0200 Subject: [PATCH 0177/1332] AVALANCHE: Change _avalot into pointer, update everything accordingly. --- engines/avalanche/avalanche.cpp | 8 +++++--- engines/avalanche/avalanche.h | 2 +- engines/avalanche/avalot.cpp | 3 +-- engines/avalanche/avalot.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 4b51c8babd32..f5013cd33861 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -57,11 +57,14 @@ AvalancheEngine::~AvalancheEngine() { delete _rnd; delete _graphics; + + delete _avalot; } Common::ErrorCode AvalancheEngine::initialize() { _graphics = new Graphics(this); + _avalot = new Avalot(this); _gyro.setParent(this); _enhanced.setParent(this); _logger.setParent(this); @@ -78,7 +81,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); - _avalot.setParent(this); _graphics->init(); @@ -124,7 +126,7 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: - _avalot.handleKeyDown(event); + _avalot->handleKeyDown(event); } } } @@ -258,7 +260,7 @@ void AvalancheEngine::demo() { void AvalancheEngine::run_avalot() { bflight_on(); - _avalot.run(Common::String(runcodes[first_time]) + arguments); + _avalot->run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever used (probably not) and eventually remove them. // If there's an error initalizing avalot, i'll handle it in there, not here diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 676f3f909a7c..c6c4b2c618fe 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -67,7 +67,7 @@ class AvalancheEngine : public Engine { public: Graphics *_graphics; - Avalot _avalot; + Avalot *_avalot; Gyro _gyro; Enhanced _enhanced; Logger _logger; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 9e64ae4ab4dc..61d5ad34e451 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -57,12 +57,11 @@ namespace Avalanche { -void Avalot::setParent(AvalancheEngine *vm) { +Avalot::Avalot(AvalancheEngine *vm) { _vm = vm; } - void Avalot::setup() { int16 gd, gm; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index d309138c5a9a..138d4b3ff6c8 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Avalot { public: - void setParent(AvalancheEngine *vm); + Avalot(AvalancheEngine *vm); void setup(); From f035622b14966e3af0a1fe53b63619ee29591e3a Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:14:10 +0200 Subject: [PATCH 0178/1332] AVALANCHE: Get rid of parts of the engine I don't use yet. --- engines/avalanche/avalanche.cpp | 10 ++-------- engines/avalanche/avalanche.h | 3 --- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f5013cd33861..55bbf33498d7 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -102,6 +102,8 @@ Common::Platform AvalancheEngine::getPlatform() const { return _platform; } + + bool AvalancheEngine::hasFeature(EngineFeature f) const { return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); } @@ -110,15 +112,7 @@ const char *AvalancheEngine::getCopyrightString() const { return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; } -Common::String AvalancheEngine::getSavegameFilename(int slot) { - return _targetName + Common::String::format("-%02d.SAV", slot); -} -void AvalancheEngine::syncSoundSettings() { - Engine::syncSoundSettings(); - - // _sound->syncVolume(); -} void AvalancheEngine::updateEvents() { Common::Event event; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index c6c4b2c618fe..99540b4a1875 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -107,9 +107,6 @@ class AvalancheEngine : public Engine { bool hasFeature(EngineFeature f) const; const char *getCopyrightString() const; - Common::String getSavegameFilename(int slot); - void syncSoundSettings(); - void updateEvents(); protected: From 10ec7e0e0f2d4cc246db0c3792c5af05e413976b Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:25:07 +0200 Subject: [PATCH 0179/1332] AVALANCHE: Change _gyro into pointer, update everything accordingly. --- engines/avalanche/acci2.cpp | 454 +++++++++++++-------------- engines/avalanche/avalanche.cpp | 3 +- engines/avalanche/avalanche.h | 2 +- engines/avalanche/avalot.cpp | 86 ++--- engines/avalanche/basher2.cpp | 16 +- engines/avalanche/celer2.cpp | 88 +++--- engines/avalanche/dropdown2.cpp | 148 ++++----- engines/avalanche/enid2.cpp | 34 +- engines/avalanche/gyro2.cpp | 10 +- engines/avalanche/gyro2.h | 4 +- engines/avalanche/logger2.cpp | 42 +-- engines/avalanche/lucerna2.cpp | 390 +++++++++++------------ engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 76 ++--- engines/avalanche/sequence2.cpp | 10 +- engines/avalanche/timeout2.cpp | 128 ++++---- engines/avalanche/trip6.cpp | 536 ++++++++++++++++---------------- engines/avalanche/visa2.cpp | 18 +- 18 files changed, 1022 insertions(+), 1025 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d16c8c674672..5e2fb23f1d36 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -158,7 +158,7 @@ const Acci::vocab Acci::words[nowords] = { {178, "WITCH"}, /* Pronouns, 200-224 */ - {200, "_vm->_gyro.him"}, {200, "MAN"}, {200, "GUY"}, + {200, "_vm->_gyro->him"}, {200, "MAN"}, {200, "GUY"}, {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, {202, "IT"}, {202, "THING"}, @@ -221,7 +221,7 @@ void Acci::setParent(AvalancheEngine *vm) { } void Acci::init() { - _vm->_gyro.weirdword = false; + _vm->_gyro->weirdword = false; } void Acci::checkword(Common::String &x) { /* Checks uint16 "fv". */ @@ -257,7 +257,7 @@ begin off; assign(f,'avvydump.avd'); rewrite(f,1); - blockwrite(f,_vm->_gyro.dna,177); { just anything } + blockwrite(f,_vm->_gyro->dna,177); { just anything } for bit:=0 to 3 do begin port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; @@ -272,7 +272,7 @@ Common::String Acci::rank() { Common::String rank_result = ""; for (fv = 1; fv <= 8; fv++) { - if ((_vm->_gyro.dna.score >= ranks[fv].score) && (_vm->_gyro.dna.score < ranks[fv + 1].score)) { + if ((_vm->_gyro->dna.score >= ranks[fv].score) && (_vm->_gyro->dna.score < ranks[fv + 1].score)) { rank_result = ranks[fv].title; return rank_result; } @@ -430,30 +430,30 @@ void Acci::others() { void Acci::lookaround() { /* This is called when you say "look." */ - _vm->_scrolls.display(*_vm->_gyro.also[0][1]); - switch (_vm->_gyro.dna.room) { + _vm->_scrolls.display(*_vm->_gyro->also[0][1]); + switch (_vm->_gyro->dna.room) { case r__spludwicks: - if (_vm->_gyro.dna.avaricius_talk > 0) + if (_vm->_gyro->dna.avaricius_talk > 0) _vm->_visa.dixi('q', 23); else others(); break; case r__robins: - if (_vm->_gyro.dna.tied_up) + if (_vm->_gyro->dna.tied_up) _vm->_visa.dixi('q', 38); - if (_vm->_gyro.dna.mushroom_growing) + if (_vm->_gyro->dna.mushroom_growing) _vm->_visa.dixi('q', 55); break; case r__insidecardiffcastle: - if (!_vm->_gyro.dna.taken_pen) + if (!_vm->_gyro->dna.taken_pen) _vm->_visa.dixi('q', 49); break; case r__lustiesroom: - if (_vm->_gyro.dna.lustie_is_asleep) + if (_vm->_gyro->dna.lustie_is_asleep) _vm->_visa.dixi('q', 65); break; case r__catacombs: - switch (_vm->_gyro.dna.cat_y * 256 + _vm->_gyro.dna.cat_x) { + switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { case 258 : _vm->_visa.dixi('q', 80); break; /* Inside art gallery */ @@ -473,7 +473,7 @@ void Acci::lookaround() { void Acci::opendoor() { /* so whaddya THINK this does?! */ byte fv; - switch (_vm->_gyro.dna.room) { /* Special cases. */ + switch (_vm->_gyro->dna.room) { /* Special cases. */ case r__yours: if (_vm->_trip.infield(2)) { /* Opening the box. */ @@ -491,30 +491,30 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } - if ((!_vm->_gyro.dna.user_moves_avvy) && (_vm->_gyro.dna.room != r__lusties)) + if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) return; /* No doors can open if you can't move Avvy. */ for (fv = 9; fv <= 15; fv++) { if (_vm->_trip.infield(fv)) { { - _vm->_gyro.portals[fv]; - switch (_vm->_gyro.portals[fv].op) { - case _vm->_gyro.exclaim: + _vm->_gyro->portals[fv]; + switch (_vm->_gyro->portals[fv].op) { + case _vm->_gyro->exclaim: _vm->_trip.tr[1].bounce(); - _vm->_visa.dixi('x', _vm->_gyro.portals[fv].data); + _vm->_visa.dixi('x', _vm->_gyro->portals[fv].data); break; - case _vm->_gyro.transport: - _vm->_trip.fliproom((_vm->_gyro.portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro.portals[fv].data) & 0x0F /*Low byte*/); + case _vm->_gyro->transport: + _vm->_trip.fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); break; - case _vm->_gyro.unfinished: + case _vm->_gyro->unfinished: _vm->_trip.tr[1].bounce(); _vm->_scrolls.display("Sorry. This place is not available yet!"); break; - case _vm->_gyro.special: - _vm->_trip.call_special(_vm->_gyro.portals[fv].data); + case _vm->_gyro->special: + _vm->_trip.call_special(_vm->_gyro->portals[fv].data); break; - case _vm->_gyro.mopendoor: - _vm->_trip.open_the_door((_vm->_gyro.portals[fv].data) >> 8, (_vm->_gyro.portals[fv].data) & 0x0F, fv); + case _vm->_gyro->mopendoor: + _vm->_trip.open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); break; } } @@ -522,7 +522,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } } - if (_vm->_gyro.dna.room == r__map) + if (_vm->_gyro->dna.room == r__map) _vm->_scrolls.display(Common::String("Avvy, you can complete the whole game without ever going " "to anywhere other than Argent, Birmingham, Cardiff, " "Nottingham and Norwich.")); @@ -552,16 +552,16 @@ void Acci::putproc() { /* Called when you call vb_put. */ putting it. */ /* Convenience thing. */ switch (thing2) { - case _vm->_gyro.wine: - if (thing == _vm->_gyro.onion) { - if (_vm->_gyro.dna.rotten_onion) + case _vm->_gyro->wine: + if (thing == _vm->_gyro->onion) { + if (_vm->_gyro->dna.rotten_onion) _vm->_scrolls.display(Common::String("That's a bit like shutting the stable door after the " "horse has bolted!")); else { /* Put onion into wine? */ - if (_vm->_gyro.dna.winestate != 3) + if (_vm->_gyro->dna.winestate != 3) _vm->_scrolls.display("\6Oignon au vin\22 is a bit too strong for your tastes!"); else { /* Put onion into vinegar! Yes! */ - _vm->_gyro.dna.onion_in_vinegar = true; + _vm->_gyro->dna.onion_in_vinegar = true; _vm->_lucerna.points(7); _vm->_visa.dixi('u', 9); } @@ -571,32 +571,32 @@ void Acci::putproc() { /* Called when you call vb_put. */ break; case 54: - if (_vm->_gyro.dna.room == 1) { /* Put something into the box. */ - if (_vm->_gyro.dna.box_contents != nowt) + if (_vm->_gyro->dna.room == 1) { /* Put something into the box. */ + if (_vm->_gyro->dna.box_contents != nowt) _vm->_scrolls.display(Common::String("There's something in the box already, Avvy. Try taking" " that out first.")); else { switch (thing) { - case _vm->_gyro.money: + case _vm->_gyro->money: _vm->_scrolls.display("You'd better keep some ready cash on you!"); break; - case _vm->_gyro.bell: + case _vm->_gyro->bell: _vm->_scrolls.display("That's a silly place to keep a bell."); break; - case _vm->_gyro.bodkin: + case _vm->_gyro->bodkin: _vm->_scrolls.display("But you might need it!"); break; - case _vm->_gyro.onion: + case _vm->_gyro->onion: _vm->_scrolls.display("Just give it to Spludwick, Avvy!"); break; default: /* Put the object into the box... */ - if (_vm->_gyro.dna.wearing == thing) - _vm->_scrolls.display(Common::String("You'd better take ") + _vm->_gyro.get_better(thing) + " off first!"); + if (_vm->_gyro->dna.wearing == thing) + _vm->_scrolls.display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); else { _vm->_celer.show_one(5); /* Open box. */ - _vm->_gyro.dna.box_contents = thing; - _vm->_gyro.dna.obj[thing] = false; + _vm->_gyro->dna.box_contents = thing; + _vm->_gyro->dna.obj[thing] = false; _vm->_lucerna.objectlist(); _vm->_scrolls.display("OK, it's in the box."); _vm->_celer.show_one(6); /* Shut box. */ @@ -617,7 +617,7 @@ void Acci::putproc() { /* Called when you call vb_put. */ void Acci::not_in_order() { _vm->_scrolls.display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + " What I need next is " + - _vm->_gyro.get_better(_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick]) + ".\232\2"); + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + ".\232\2"); } void Acci::go_to_cauldron() { @@ -629,39 +629,39 @@ void Acci::go_to_cauldron() { bool Acci::give2spludwick() { bool give2spludwick_result = false; - if (_vm->_gyro.spludwick_order[_vm->_gyro.dna.given2spludwick] != thing) { + if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != thing) { not_in_order(); return give2spludwick_result; } switch (thing) { - case _vm->_gyro.onion: - _vm->_gyro.dna.obj[_vm->_gyro.onion] = false; - if (_vm->_gyro.dna.rotten_onion) + case _vm->_gyro->onion: + _vm->_gyro->dna.obj[_vm->_gyro->onion] = false; + if (_vm->_gyro->dna.rotten_onion) _vm->_visa.dixi('q', 22); else { - _vm->_gyro.dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick += 1; _vm->_visa.dixi('q', 20); go_to_cauldron(); _vm->_lucerna.points(3); } _vm->_lucerna.objectlist(); break; - case _vm->_gyro.ink: - _vm->_gyro.dna.obj[_vm->_gyro.ink] = false; + case _vm->_gyro->ink: + _vm->_gyro->dna.obj[_vm->_gyro->ink] = false; _vm->_lucerna.objectlist(); - _vm->_gyro.dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick += 1; _vm->_visa.dixi('q', 24); go_to_cauldron(); _vm->_lucerna.points(3); break; - case _vm->_gyro.mushroom: - _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = false; + case _vm->_gyro->mushroom: + _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = false; _vm->_visa.dixi('q', 25); _vm->_lucerna.points(5); - _vm->_gyro.dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick += 1; go_to_cauldron(); - _vm->_gyro.dna.obj[_vm->_gyro.potion] = true; + _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; _vm->_lucerna.objectlist(); break; default: @@ -672,32 +672,32 @@ bool Acci::give2spludwick() { } void Acci::have_a_drink() { - _vm->_gyro.dna.alcohol += 1; - if (_vm->_gyro.dna.alcohol == 5) { - _vm->_gyro.dna.obj[_vm->_gyro.key] = true; /* Get the key. */ - _vm->_gyro.dna.teetotal = true; - _vm->_gyro.dna.avvy_is_awake = false; - _vm->_gyro.dna.avvy_in_bed = true; + _vm->_gyro->dna.alcohol += 1; + if (_vm->_gyro->dna.alcohol == 5) { + _vm->_gyro->dna.obj[_vm->_gyro->key] = true; /* Get the key. */ + _vm->_gyro->dna.teetotal = true; + _vm->_gyro->dna.avvy_is_awake = false; + _vm->_gyro->dna.avvy_in_bed = true; _vm->_lucerna.objectlist(); _vm->_lucerna.dusk(); - _vm->_gyro.hang_around_for_a_while(); + _vm->_gyro->hang_around_for_a_while(); _vm->_trip.fliproom(1, 1); - _vm->_gyro.background(14); + _vm->_gyro->background(14); _vm->_trip.new_game_for_trippancy(); /* Not really */ } } void Acci::cardiff_climbing() { - if (_vm->_gyro.dna.standing_on_dais) { + if (_vm->_gyro->dna.standing_on_dais) { /* Clamber up. */ _vm->_scrolls.display("You climb down, back onto the floor."); - _vm->_gyro.dna.standing_on_dais = false; + _vm->_gyro->dna.standing_on_dais = false; _vm->_trip.apped(1, 3); } else { /* Clamber down. */ if (_vm->_trip.infield(1)) { _vm->_scrolls.display("You clamber up onto the dais."); - _vm->_gyro.dna.standing_on_dais = true; + _vm->_gyro->dna.standing_on_dais = true; _vm->_trip.apped(1, 2); } else _vm->_scrolls.display("Get a bit closer, Avvy."); @@ -711,21 +711,21 @@ void Acci::already() { } void Acci::stand_up() { - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__yours: /* Avvy isn't asleep. */ - if (_vm->_gyro.dna.avvy_in_bed) { /* But he's in bed. */ - if (_vm->_gyro.dna.teetotal) { + if (_vm->_gyro->dna.avvy_in_bed) { /* But he's in bed. */ + if (_vm->_gyro->dna.teetotal) { _vm->_visa.dixi('d', 12); - _vm->_gyro.background(0); + _vm->_gyro->background(0); _vm->_visa.dixi('d', 14); } _vm->_trip.tr[1].visible = true; - _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip.apped(1, 2); - _vm->_gyro.dna.rw = _vm->_gyro.left; + _vm->_gyro->dna.rw = _vm->_gyro->left; _vm->_celer.show_one(4); /* Picture of empty pillow. */ _vm->_lucerna.points(1); - _vm->_gyro.dna.avvy_in_bed = false; + _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout.lose_timer(_vm->_timeout.reason_arkata_shouts); } else already(); @@ -736,12 +736,12 @@ void Acci::stand_up() { break; case r__nottspub: - if (_vm->_gyro.dna.sitting_in_pub) { + if (_vm->_gyro->dna.sitting_in_pub) { _vm->_celer.show_one(4); /* Not sitting down. */ _vm->_trip.tr[1].visible = true; /* But standing up. */ _vm->_trip.apped(1, 4); /* And walking away. */ - _vm->_gyro.dna.sitting_in_pub = false; /* Really not sitting down. */ - _vm->_gyro.dna.user_moves_avvy = true; /* And ambulant. */ + _vm->_gyro->dna.sitting_in_pub = false; /* Really not sitting down. */ + _vm->_gyro->dna.user_moves_avvy = true; /* And ambulant. */ } else already(); break; @@ -752,44 +752,44 @@ void Acci::stand_up() { void Acci::getproc(char thing) { - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__yours: if (_vm->_trip.infield(2)) { - if (_vm->_gyro.dna.box_contents == thing) { + if (_vm->_gyro->dna.box_contents == thing) { _vm->_celer.show_one(5); _vm->_scrolls.display("OK, I've got it."); - _vm->_gyro.dna.obj[thing] = true; + _vm->_gyro->dna.obj[thing] = true; _vm->_lucerna.objectlist(); - _vm->_gyro.dna.box_contents = nowt; + _vm->_gyro->dna.box_contents = nowt; _vm->_celer.show_one(6); } else - _vm->_scrolls.display(Common::String("I can't see ") + _vm->_gyro.get_better(thing) + " in the box."); + _vm->_scrolls.display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else _vm->_visa.dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { - case _vm->_gyro.pen: + case _vm->_gyro->pen: if (_vm->_trip.infield(2)) { /* Standing on the dais. */ - if (_vm->_gyro.dna.taken_pen) + if (_vm->_gyro->dna.taken_pen) _vm->_scrolls.display("It's not there, Avvy."); else { /* OK: we're taking the pen, and it's there. */ _vm->_celer.show_one(4); /* No pen there now. */ _vm->_trip.call_special(3); /* Zap! */ - _vm->_gyro.dna.taken_pen = true; - _vm->_gyro.dna.obj[_vm->_gyro.pen] = true; + _vm->_gyro->dna.taken_pen = true; + _vm->_gyro->dna.obj[_vm->_gyro->pen] = true; _vm->_lucerna.objectlist(); _vm->_scrolls.display("Taken."); } - } else if (_vm->_gyro.dna.standing_on_dais) + } else if (_vm->_gyro->dna.standing_on_dais) _vm->_visa.dixi('q', 53); else _vm->_visa.dixi('q', 51); break; - case _vm->_gyro.bolt: + case _vm->_gyro->bolt: _vm->_visa.dixi('q', 52); break; default: @@ -797,12 +797,12 @@ void Acci::getproc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro.mushroom) & (_vm->_trip.infield(1)) & (_vm->_gyro.dna.mushroom_growing)) { + if ((thing == _vm->_gyro->mushroom) & (_vm->_trip.infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { _vm->_celer.show_one(3); _vm->_scrolls.display("Got it!"); - _vm->_gyro.dna.mushroom_growing = false; - _vm->_gyro.dna.taken_mushroom = true; - _vm->_gyro.dna.obj[_vm->_gyro.mushroom] = true; + _vm->_gyro->dna.mushroom_growing = false; + _vm->_gyro->dna.taken_mushroom = true; + _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = true; _vm->_lucerna.objectlist(); _vm->_lucerna.points(3); } else @@ -814,11 +814,11 @@ void Acci::getproc(char thing) { } void Acci::give_geida_the_lute() { - if (_vm->_gyro.dna.room != r__lustiesroom) { + if (_vm->_gyro->dna.room != r__lustiesroom) { _vm->_scrolls.display("Not yet. Try later!\232\2"); return; } - _vm->_gyro.dna.obj[_vm->_gyro.lute] = false; + _vm->_gyro->dna.obj[_vm->_gyro->lute] = false; _vm->_lucerna.objectlist(); _vm->_visa.dixi('q', 64); /* She plays it. */ @@ -851,14 +851,14 @@ void Acci::person_speaks() { if ((person == pardon) || (person == '\0')) { - if ((_vm->_gyro.him == pardon) || (_vm->_gyro.whereis[_vm->_gyro.him] != _vm->_gyro.dna.room)) - person = _vm->_gyro.her; + if ((_vm->_gyro->him == pardon) || (_vm->_gyro->whereis[_vm->_gyro->him] != _vm->_gyro->dna.room)) + person = _vm->_gyro->her; else - person = _vm->_gyro.him; + person = _vm->_gyro->him; } - if (_vm->_gyro.whereis[person] != _vm->_gyro.dna.room) { - _vm->_scrolls.display("\231\4"); /* Avvy _vm->_gyro.himself! */ + if (_vm->_gyro->whereis[person] != _vm->_gyro->dna.room) { + _vm->_scrolls.display("\231\4"); /* Avvy _vm->_gyro->himself! */ return; } @@ -873,8 +873,8 @@ void Acci::person_speaks() { if (!found) { for (fv = 10; fv <= 25; fv++) { - _vm->_gyro.quasipeds[fv]; - if ((_vm->_gyro.quasipeds[fv].who == person) && (_vm->_gyro.quasipeds[fv].room == _vm->_gyro.dna.room)) { + _vm->_gyro->quasipeds[fv]; + if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) { _vm->_scrolls.display(Common::String('\23') + char(fv + 55) + '\4'); } } @@ -884,7 +884,7 @@ void Acci::person_speaks() { void Acci::heythanks() { person_speaks(); _vm->_scrolls.display("Hey, thanks!\2(But now, you've lost it!)"); - _vm->_gyro.dna.obj[thing] = false; + _vm->_gyro->dna.obj[thing] = false; } void Acci::do_that() { @@ -898,13 +898,13 @@ void Acci::do_that() { thats = ""; return; } - if (_vm->_gyro.weirdword) + if (_vm->_gyro->weirdword) return; if (thing < '\310') thing -= 49; /* "Slip" */ /* - if ((!_vm->_gyro.alive) & + if ((!_vm->_gyro->alive) & !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, vb_highscores, vb_smartalec, eos).has(verb))) { @@ -913,7 +913,7 @@ void Acci::do_that() { return; } - if ((~ _vm->_gyro.dna.avvy_is_awake) & + if ((~ _vm->_gyro->dna.avvy_is_awake) & !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { @@ -937,7 +937,7 @@ void Acci::do_that() { case vb_get: if (thing != pardon) { /* Legitimate try to pick something up. */ - if (_vm->_gyro.dna.carrying >= maxobjs) + if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls.display("You can't carry any more!"); else getproc(thing); @@ -954,13 +954,13 @@ void Acci::do_that() { _vm->_scrolls.display(Common::String("Two years ago you dropped a florin in the street. Three days ") + "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; - /* begin _vm->_gyro.dna.obj[thing]:=false; _vm->_lucerna.objectlist(); end;*/ + /* begin _vm->_gyro->dna.obj[thing]:=false; _vm->_lucerna.objectlist(); end;*/ case vb_inv: inv(); break; case vb_talk: if (person == pardon) { - if (_vm->_gyro.subjnumber == 99) /* They typed "say passuint16". */ + if (_vm->_gyro->subjnumber == 99) /* They typed "say passuint16". */ _vm->_scrolls.display("Yes, but what \6is\22 the passuint16?"); /* else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { @@ -970,7 +970,7 @@ void Acci::do_that() { do_that(); return; } else { - person = _vm->_gyro.subjnumber; + person = _vm->_gyro->subjnumber; subjnumber = 0; if (set::of(pardon, '\0', eos).has(person)) _vm->_scrolls.display("Talk to whom?"); @@ -990,56 +990,56 @@ void Acci::do_that() { _vm->_scrolls.display("Give to whom?"); else if (personshere()) { switch (thing) { - case _vm->_gyro.money : + case _vm->_gyro->money : _vm->_scrolls.display("You can't bring yourself to give away your moneybag."); break; - case _vm->_gyro.bodkin: - case _vm->_gyro.bell: - case _vm->_gyro.clothes: - case _vm->_gyro.habit : + case _vm->_gyro->bodkin: + case _vm->_gyro->bell: + case _vm->_gyro->clothes: + case _vm->_gyro->habit : _vm->_scrolls.display("Don't give it away, it might be useful!"); break; default: switch (person) { - case _vm->_gyro.pcrapulus: + case _vm->_gyro->pcrapulus: switch (thing) { - case _vm->_gyro.wine: + case _vm->_gyro->wine: _vm->_scrolls.display("Crapulus grabs the wine and gulps it down."); - _vm->_gyro.dna.obj[_vm->_gyro.wine] = false; + _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; break; default: heythanks(); } break; - case _vm->_gyro.pcwytalot: + case _vm->_gyro->pcwytalot: /*if (set::of(crossbow, bolt, eos).has(thing)) _vm->_scrolls.display(Common::String("You might be able to influence ") + "Cwytalot more if you used it!"); else */heythanks(); break; - case _vm->_gyro.pspludwick: + case _vm->_gyro->pspludwick: if (give2spludwick()) heythanks(); break; - case _vm->_gyro.pibythneth: - if (thing == _vm->_gyro.badge) { + case _vm->_gyro->pibythneth: + if (thing == _vm->_gyro->badge) { _vm->_visa.dixi('q', 32); /* Thanks! Wow! */ _vm->_lucerna.points(3); - _vm->_gyro.dna.obj[_vm->_gyro.badge] = false; - _vm->_gyro.dna.obj[_vm->_gyro.habit] = true; - _vm->_gyro.dna.givenbadgetoiby = true; + _vm->_gyro->dna.obj[_vm->_gyro->badge] = false; + _vm->_gyro->dna.obj[_vm->_gyro->habit] = true; + _vm->_gyro->dna.givenbadgetoiby = true; _vm->_celer.show_one(8); _vm->_celer.show_one(9); } else heythanks(); break; - case _vm->_gyro.payles: - if (_vm->_gyro.dna.ayles_is_awake) { - if (thing == _vm->_gyro.pen) { - _vm->_gyro.dna.obj[_vm->_gyro.pen] = false; + case _vm->_gyro->payles: + if (_vm->_gyro->dna.ayles_is_awake) { + if (thing == _vm->_gyro->pen) { + _vm->_gyro->dna.obj[_vm->_gyro->pen] = false; _vm->_visa.dixi('q', 54); - _vm->_gyro.dna.obj[_vm->_gyro.ink] = true; - _vm->_gyro.dna.given_pen_to_ayles = true; + _vm->_gyro->dna.obj[_vm->_gyro->ink] = true; + _vm->_gyro->dna.given_pen_to_ayles = true; _vm->_lucerna.objectlist(); _vm->_lucerna.points(2); } else @@ -1047,26 +1047,26 @@ void Acci::do_that() { } else _vm->_scrolls.display("But he's asleep!"); break; - case _vm->_gyro.pgeida: + case _vm->_gyro->pgeida: switch (thing) { - case _vm->_gyro.potion: - _vm->_gyro.dna.obj[_vm->_gyro.potion] = false; + case _vm->_gyro->potion: + _vm->_gyro->dna.obj[_vm->_gyro->potion] = false; _vm->_visa.dixi('u', 16); /* She drinks it. */ _vm->_lucerna.points(2); - _vm->_gyro.dna.geida_given_potion = true; + _vm->_gyro->dna.geida_given_potion = true; _vm->_lucerna.objectlist(); break; - case _vm->_gyro.lute: + case _vm->_gyro->lute: give_geida_the_lute(); break; default: heythanks(); } break; - case _vm->_gyro.parkata: + case _vm->_gyro->parkata: switch (thing) { - case _vm->_gyro.potion: - if (_vm->_gyro.dna.geida_given_potion) + case _vm->_gyro->potion: + if (_vm->_gyro->dna.geida_given_potion) winsequence(); else _vm->_visa.dixi('q', 77); @@ -1093,7 +1093,7 @@ void Acci::do_that() { _vm->_enid.edna_load(realwords[2]); break; case vb_save: - if (_vm->_gyro.alive) + if (_vm->_gyro->alive) _vm->_enid.edna_save(realwords[2]); else _vm->_scrolls.display("It's a bit late now to save your game!"); @@ -1108,7 +1108,7 @@ void Acci::do_that() { _vm->_scrolls.display("Vandalism is prohibited within this game!"); break; case vb_quit: /* quit */ - //if (_vm->_gyro.demo) { + //if (_vm->_gyro->demo) { // _vm->_visa.dixi('q', 31); // close(demofile); // exit(0); /* Change this later!!! */ @@ -1116,7 +1116,7 @@ void Acci::do_that() { if (!polite) _vm->_scrolls.display("How about a `please\", Avvy?"); else if (_vm->_scrolls.ask("\23C\26Do you really want to quit?")) - _vm->_gyro.lmo = true; + _vm->_gyro->lmo = true; break; case vb_go: _vm->_scrolls.display("Just use the arrow keys to walk there."); @@ -1132,16 +1132,16 @@ void Acci::do_that() { _vm->_scrolls.display(Common::String("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + "The medival descendant of" + '\15' + "Denarius Avaricius Sextus" + - '\15' + '\15' + "version " + _vm->_gyro.vernum + '\15' + '\15' + "Copyright " - + _vm->_gyro.copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); + '\15' + '\15' + "version " + _vm->_gyro->vernum + '\15' + '\15' + "Copyright " + + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); _vm->_scrolls.aboutscroll = false; break; case vb_undress: - if (_vm->_gyro.dna.wearing == nowt) + if (_vm->_gyro->dna.wearing == nowt) _vm->_scrolls.display("You're already stark naked!"); - else if (_vm->_gyro.dna.avvys_in_the_cupboard) { - _vm->_scrolls.display(Common::String("You take off ") + _vm->_gyro.get_better(_vm->_gyro.dna.wearing) + '.'); - _vm->_gyro.dna.wearing = nowt; + else if (_vm->_gyro->dna.avvys_in_the_cupboard) { + _vm->_scrolls.display(Common::String("You take off ") + _vm->_gyro->get_better(_vm->_gyro->dna.wearing) + '.'); + _vm->_gyro->dna.wearing = nowt; _vm->_lucerna.objectlist(); } else _vm->_scrolls.display("Hadn't you better find somewhere more private, Avvy?"); @@ -1150,23 +1150,23 @@ void Acci::do_that() { if (holding()) { /* wear something */ switch (thing) { - case _vm->_gyro.chastity: + case _vm->_gyro->chastity: _vm->_scrolls.display("Hey, what kind of a weirdo are you\??!"); break; - case _vm->_gyro.clothes: - case _vm->_gyro.habit: /* Change this! */ - if (_vm->_gyro.dna.wearing != nowt) { - if (_vm->_gyro.dna.wearing == thing) + case _vm->_gyro->clothes: + case _vm->_gyro->habit: /* Change this! */ + if (_vm->_gyro->dna.wearing != nowt) { + if (_vm->_gyro->dna.wearing == thing) _vm->_scrolls.display("You're already wearing that."); else _vm->_scrolls.display(Common::String("You'll be rather warm wearing two ") + "sets of clothes!"); return; } else - _vm->_gyro.dna.wearing = thing; + _vm->_gyro->dna.wearing = thing; _vm->_lucerna.objectlist(); - if (thing == _vm->_gyro.habit) + if (thing == _vm->_gyro->habit) fv = 3; else fv = 0; @@ -1187,7 +1187,7 @@ void Acci::do_that() { break; case vb_play: if (thing == pardon) { - switch (_vm->_gyro.dna.room) { /* They just typed "play"... */ + switch (_vm->_gyro->dna.room) { /* They just typed "play"... */ case r__argentpub: // play_nim(); // I just don't plan to implement Nim yet. @@ -1198,22 +1198,22 @@ void Acci::do_that() { } } else if (holding()) { switch (thing) { - case _vm->_gyro.lute : + case _vm->_gyro->lute : _vm->_visa.dixi('U', 7); - if (_vm->_gyro.whereis[_vm->_gyro.pcwytalot] == _vm->_gyro.dna.room) + if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot] == _vm->_gyro->dna.room) _vm->_visa.dixi('U', 10); - if (_vm->_gyro.whereis[_vm->_gyro.pdulustie] == _vm->_gyro.dna.room) + if (_vm->_gyro->whereis[_vm->_gyro->pdulustie] == _vm->_gyro->dna.room) _vm->_visa.dixi('U', 15); break; case 52: - if (_vm->_gyro.dna.room == r__musicroom) + if (_vm->_gyro->dna.room == r__musicroom) play_harp(); else _vm->_scrolls.display(what); break; case 55: - if (_vm->_gyro.dna.room == r__argentpub) + if (_vm->_gyro->dna.room == r__argentpub) ; /*play_nim(); - Don't implement yet.*/ else _vm->_scrolls.display(what); @@ -1225,9 +1225,9 @@ void Acci::do_that() { break; case vb_ring: if (holding()) { - if (thing == _vm->_gyro.bell) { + if (thing == _vm->_gyro->bell) { _vm->_scrolls.display("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) + if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) _vm->_scrolls.display("(Are you trying to join in, Avvy\?\?!)"); } else _vm->_scrolls.display(what); @@ -1248,7 +1248,7 @@ void Acci::do_that() { // I don't want to implement bosskey yet. break; case vb_pee: - if (_vm->_gyro.flagset('P')) { + if (_vm->_gyro->flagset('P')) { _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); _vm->_timeout.set_up_timer(4, _vm->_timeout.procurinate, _vm->_timeout.reason_gototoilet); } else @@ -1256,16 +1256,16 @@ void Acci::do_that() { break; case vb_cheat: _vm->_scrolls.display(Common::String('\6') + "Cheat mode now enabled."); - _vm->_gyro.cheat = true; + _vm->_gyro->cheat = true; break; case vb_magic: - if (_vm->_gyro.dna.avaricius_talk > 0) + if (_vm->_gyro->dna.avaricius_talk > 0) _vm->_visa.dixi('q', 19); else { - if ((_vm->_gyro.dna.room == 12) & (_vm->_trip.infield(2))) { + if ((_vm->_gyro->dna.room == 12) & (_vm->_trip.infield(2))) { /* Avaricius appears! */ _vm->_visa.dixi('q', 17); - if (_vm->_gyro.whereis['\227'] == 12) + if (_vm->_gyro->whereis['\227'] == 12) _vm->_visa.dixi('q', 18); else { _vm->_trip.tr[2].init(1, false, &_vm->_trip); /* Avaricius */ @@ -1273,7 +1273,7 @@ void Acci::do_that() { _vm->_trip.tr[2].walkto(5); _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procback_and_forth; - _vm->_gyro.dna.avaricius_talk = 14; + _vm->_gyro->dna.avaricius_talk = 14; _vm->_timeout.set_up_timer(177, _vm->_timeout.procavaricius_talks, _vm->_timeout.reason_avariciustalks); } } else @@ -1284,7 +1284,7 @@ void Acci::do_that() { _vm->_scrolls.display("Listen, smart alec, that was just rhetoric."); break; case vb_expletive: - switch (_vm->_gyro.dna.swore) { + switch (_vm->_gyro->dna.swore) { case 0: _vm->_scrolls.display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + "(I shouldn't say it again, if I were you!)"); @@ -1299,20 +1299,20 @@ void Acci::do_that() { "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna.gameover(); } - _vm->_gyro.dna.swore++; + _vm->_gyro->dna.swore++; break; case vb_listen: - if ((_vm->_gyro.dna.ringing_bells) & (_vm->_gyro.flagset('B'))) + if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) _vm->_scrolls.display(Common::String("All other noise is drowned out by the ringing of ") + "the bells."); - else if (_vm->_gyro.listen == "") + else if (_vm->_gyro->listen == "") _vm->_scrolls.display("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls.display(_vm->_gyro.listen); + _vm->_scrolls.display(_vm->_gyro->listen); break; case vb_buy: /* What are they trying to buy? */ - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__argentpub: if (_vm->_trip.infield(6)) { /* We're in a pub, and near the bar. */ @@ -1321,49 +1321,49 @@ void Acci::do_that() { case '\65': case '\66': case '\72': /* Beer, whisky, cider or mead */ - if (_vm->_gyro.dna.malagauche == 177) { /* Already getting us one. */ + if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ _vm->_visa.dixi('D', 15); return; } - if (_vm->_gyro.dna.teetotal) { + if (_vm->_gyro->dna.teetotal) { _vm->_visa.dixi('D', 6); return; } - if (_vm->_gyro.dna.alcohol == 0) + if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna.points(3); _vm->_celer.show_one(12); _vm->_scrolls.display(booze[thing] + ", please.\231\2"); - _vm->_gyro.dna.drinking = thing; + _vm->_gyro->dna.drinking = thing; _vm->_celer.show_one(10); - _vm->_gyro.dna.malagauche = 177; + _vm->_gyro->dna.malagauche = 177; _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuydrinks, _vm->_timeout.reason_drinks); break; case '\64': examine(); break; /* We have a right one here- buy Pepsi??! */ - case _vm->_gyro.wine: - if (_vm->_gyro.dna.obj[_vm->_gyro.wine]) /* We've already got the wine! */ + case _vm->_gyro->wine: + if (_vm->_gyro->dna.obj[_vm->_gyro->wine]) /* We've already got the wine! */ _vm->_visa.dixi('D', 2); /* 1 bottle's shufishent! */ else { - if (_vm->_gyro.dna.malagauche == 177) { /* Already getting us one. */ + if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ _vm->_visa.dixi('D', 15); return; } - if (_vm->_gyro.dna.carrying >= maxobjs) { + if (_vm->_gyro->dna.carrying >= maxobjs) { _vm->_scrolls.display("Your hands are full."); return; } _vm->_celer.show_one(12); _vm->_scrolls.display("Wine, please.\231\2"); - if (_vm->_gyro.dna.alcohol == 0) + if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna.points(3); _vm->_celer.show_one(10); - _vm->_gyro.dna.malagauche = 177; + _vm->_gyro->dna.malagauche = 177; _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuywine, _vm->_timeout.reason_drinks); } @@ -1375,24 +1375,24 @@ void Acci::do_that() { case r__outsideducks: if (_vm->_trip.infield(6)) { - if (thing == _vm->_gyro.onion) { - if (_vm->_gyro.dna.obj[_vm->_gyro.onion]) + if (thing == _vm->_gyro->onion) { + if (_vm->_gyro->dna.obj[_vm->_gyro->onion]) _vm->_visa.dixi('D', 10); /* not planning to juggle with the things! */ - else if (_vm->_gyro.dna.carrying >= maxobjs) + else if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls.display("Before you ask, you remember that your hands are full."); else { - if (_vm->_gyro.dna.bought_onion) + if (_vm->_gyro->dna.bought_onion) _vm->_visa.dixi('D', 11); else { _vm->_visa.dixi('D', 9); _vm->_lucerna.points(3); } - _vm->_gyro.pennycheck(3); /* It costs thruppence. */ - _vm->_gyro.dna.obj[_vm->_gyro.onion] = true; + _vm->_gyro->pennycheck(3); /* It costs thruppence. */ + _vm->_gyro->dna.obj[_vm->_gyro->onion] = true; _vm->_lucerna.objectlist(); - _vm->_gyro.dna.bought_onion = true; - _vm->_gyro.dna.rotten_onion = false; /* It's OK when it leaves the stall! */ - _vm->_gyro.dna.onion_in_vinegar = false; + _vm->_gyro->dna.bought_onion = true; + _vm->_gyro->dna.rotten_onion = false; /* It's OK when it leaves the stall! */ + _vm->_gyro->dna.onion_in_vinegar = false; } } else _vm->_visa.dixi('D', 0); @@ -1408,10 +1408,10 @@ void Acci::do_that() { } break; case vb_attack: - if ((_vm->_gyro.dna.room == r__brummieroad) && - ((person == '\235') || (thing == _vm->_gyro.crossbow) || (thing == _vm->_gyro.bolt)) - && (_vm->_gyro.whereis['\235'] == _vm->_gyro.dna.room)) { - switch (_vm->_gyro.dna.obj[_vm->_gyro.bolt] + _vm->_gyro.dna.obj[_vm->_gyro.crossbow] * 2) { + if ((_vm->_gyro->dna.room == r__brummieroad) && + ((person == '\235') || (thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) + && (_vm->_gyro->whereis['\235'] == _vm->_gyro->dna.room)) { + switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow] * 2) { /* 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. */ case 0: @@ -1419,7 +1419,7 @@ void Acci::do_that() { _vm->_scrolls.display("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls.display(Common::String("Attack _vm->_gyro.him with only a crossbow bolt? Are you ") + + _vm->_scrolls.display(Common::String("Attack _vm->_gyro->him with only a crossbow bolt? Are you ") + "planning on playing darts?!"); break; case 2: @@ -1428,16 +1428,16 @@ void Acci::do_that() { break; case 3: _vm->_visa.dixi('Q', 11); - _vm->_gyro.dna.cwytalot_gone = true; - _vm->_gyro.dna.obj[_vm->_gyro.bolt] = false; - _vm->_gyro.dna.obj[_vm->_gyro.crossbow] = false; + _vm->_gyro->dna.cwytalot_gone = true; + _vm->_gyro->dna.obj[_vm->_gyro->bolt] = false; + _vm->_gyro->dna.obj[_vm->_gyro->crossbow] = false; _vm->_lucerna.objectlist(); - _vm->_gyro.magics[12].op = _vm->_gyro.nix; + _vm->_gyro->magics[12].op = _vm->_gyro->nix; _vm->_lucerna.points(7); _vm->_trip.tr[2].walkto(2); _vm->_trip.tr[2].vanishifstill = true; _vm->_trip.tr[2].call_eachstep = false; - _vm->_gyro.whereis['\235'] = 177; + _vm->_gyro->whereis['\235'] = 177; break; default: _vm->_visa.dixi('Q', 10); /* Please try not to be so violent! */ @@ -1446,27 +1446,27 @@ void Acci::do_that() { _vm->_visa.dixi('Q', 10); break; case vb_password: - if (_vm->_gyro.dna.room != r__bridge) + if (_vm->_gyro->dna.room != r__bridge) _vm->_visa.dixi('Q', 12); else { ok = true; for (ff = 1; ff <= thats.size(); ff++) { - for (fv = 1; fv <= words[_vm->_gyro.dna.pass_num + first_password].w.size(); fv++) { + for (fv = 1; fv <= words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) { Common::String temp = realwords[ff]; temp.toUppercase(); - if (words[_vm->_gyro.dna.pass_num + first_password].w[fv] != temp[fv]) + if (words[_vm->_gyro->dna.pass_num + first_password].w[fv] != temp[fv]) ok = false; } } if (ok) { - if (_vm->_gyro.dna.drawbridge_open != 0) + if (_vm->_gyro->dna.drawbridge_open != 0) _vm->_scrolls.display("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna.points(4); _vm->_scrolls.display("The drawbridge opens!"); _vm->_timeout.set_up_timer(7, _vm->_timeout.procopen_drawbridge, _vm->_timeout.reason_drawbridgefalls); - _vm->_gyro.dna.drawbridge_open = 1; + _vm->_gyro->dna.drawbridge_open = 1; } } else _vm->_visa.dixi('Q', 12); @@ -1479,7 +1479,7 @@ void Acci::do_that() { _vm->_lucerna.gameover(); break; case vb_score: - _vm->_scrolls.display(Common::String("Your score is ") + _vm->_gyro.strf(_vm->_gyro.dna.score) + ",\3\rout of a " + + _vm->_scrolls.display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ",\3\rout of a " + "possible 128.\r\rThis gives you a rank of " + rank() + ".\r\r" + totaltime()); break; @@ -1495,13 +1495,13 @@ void Acci::do_that() { _vm->_scrolls.display("Kiss whom?"); else if (personshere()) { switch (person) { - case _vm->_gyro.parkata: + case _vm->_gyro->parkata: _vm->_visa.dixi('U', 12); break; - case _vm->_gyro.pgeida: + case _vm->_gyro->pgeida: _vm->_visa.dixi('U', 13); break; - case _vm->_gyro.pwisewoman: + case _vm->_gyro->pwisewoman: _vm->_visa.dixi('U', 14); break; default: @@ -1513,7 +1513,7 @@ void Acci::do_that() { break; case vb_climb: - if (_vm->_gyro.dna.room == r__insidecardiffcastle) + if (_vm->_gyro->dna.room == r__insidecardiffcastle) cardiff_climbing(); else /* In the wrong room! */ _vm->_scrolls.display("Not with your head for heights, Avvy!"); @@ -1521,7 +1521,7 @@ void Acci::do_that() { case vb_jump: _vm->_timeout.set_up_timer(1, _vm->_timeout.procjump, _vm->_timeout.reason_jumping); - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.user_moves_avvy = false; break; case vb_highscores: @@ -1533,23 +1533,23 @@ void Acci::do_that() { if (personshere()) switch (person) { case pardon: - case _vm->_gyro.pavalot: + case _vm->_gyro->pavalot: case '\0': - if (!_vm->_gyro.dna.avvy_is_awake) { - _vm->_gyro.dna.avvy_is_awake = true; + if (!_vm->_gyro->dna.avvy_is_awake) { + _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna.points(1); - _vm->_gyro.dna.avvy_in_bed = true; + _vm->_gyro->dna.avvy_in_bed = true; _vm->_celer.show_one(3); /* Picture of Avvy, awake in bed. */ - if (_vm->_gyro.dna.teetotal) + if (_vm->_gyro->dna.teetotal) _vm->_visa.dixi('d', 13); } else _vm->_scrolls.display("You're already awake, Avvy!"); break; - case _vm->_gyro.payles: - if (!_vm->_gyro.dna.ayles_is_awake) - _vm->_scrolls.display("You can't seem to wake _vm->_gyro.him by yourself."); + case _vm->_gyro->payles: + if (!_vm->_gyro->dna.ayles_is_awake) + _vm->_scrolls.display("You can't seem to wake _vm->_gyro->him by yourself."); break; - case _vm->_gyro.pjacques: + case _vm->_gyro->pjacques: _vm->_scrolls.display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + "Hmmm... that doesn't seem to do any good..."); break; @@ -1559,17 +1559,17 @@ void Acci::do_that() { break; case vb_sit: - if (_vm->_gyro.dna.room == r__nottspub) { - if (_vm->_gyro.dna.sitting_in_pub) + if (_vm->_gyro->dna.room == r__nottspub) { + if (_vm->_gyro->dna.sitting_in_pub) _vm->_scrolls.display("You're already sitting!"); else { - _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro.him down. */ + _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ _vm->_timeout.set_up_timer(1, _vm->_timeout.procavvy_sit_down, _vm->_timeout.reason_sitting_down); } } else { /* Default doodah. */ _vm->_lucerna.dusk(); - _vm->_gyro.hang_around_for_a_while(); + _vm->_gyro->hang_around_for_a_while(); _vm->_lucerna.dawn(); _vm->_scrolls.display("A few hours later...\20nothing much has happened..."); } @@ -1578,7 +1578,7 @@ void Acci::do_that() { case vb_restart: if (_vm->_scrolls.ask("Restart game and lose changes?")) { _vm->_lucerna.dusk(); - _vm->_gyro.newgame(); + _vm->_gyro->newgame(); _vm->_lucerna.dawn(); } break; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 55bbf33498d7..d5187f1fa8c8 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -59,13 +59,14 @@ AvalancheEngine::~AvalancheEngine() { delete _graphics; delete _avalot; + delete _gyro; } Common::ErrorCode AvalancheEngine::initialize() { _graphics = new Graphics(this); _avalot = new Avalot(this); - _gyro.setParent(this); + _gyro = new Gyro(this); _enhanced.setParent(this); _logger.setParent(this); _pingo.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 99540b4a1875..49c02ff14128 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -68,7 +68,7 @@ class AvalancheEngine : public Engine { Graphics *_graphics; Avalot *_avalot; - Gyro _gyro; + Gyro *_gyro; Enhanced _enhanced; Logger _logger; Pingo _pingo; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 61d5ad34e451..6ce6348e5844 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -66,41 +66,41 @@ void Avalot::setup() { int16 gd, gm; checkbreak = false; - _vm->_gyro.visible = _vm->_gyro.m_no; - _vm->_gyro.to_do = 0; - _vm->_gyro.lmo = false; + _vm->_gyro->visible = _vm->_gyro->m_no; + _vm->_gyro->to_do = 0; + _vm->_gyro->lmo = false; _vm->_scrolls.resetscroll(); - _vm->_gyro.setup_vmc(); - _vm->_gyro.on_virtual(); + _vm->_gyro->setup_vmc(); + _vm->_gyro->on_virtual(); gd = 3; gm = 0; //initgraph(gd: gm: ""); - _vm->_gyro.holdthedawn = true; + _vm->_gyro->holdthedawn = true; _vm->_lucerna.dusk(); - _vm->_gyro.cmp = 177; + _vm->_gyro->cmp = 177; _vm->_lucerna.mouse_init(); /*on;*/ - _vm->_gyro.dropsok = true; - _vm->_gyro.ctrl = ckey; - _vm->_gyro.oldjw = 177; - _vm->_gyro.mousetext = ""; - _vm->_gyro.c = 999; + _vm->_gyro->dropsok = true; + _vm->_gyro->ctrl = ckey; + _vm->_gyro->oldjw = 177; + _vm->_gyro->mousetext = ""; + _vm->_gyro->c = 999; //settextjustify(0: 0); - _vm->_gyro.ddmnow = false; + _vm->_gyro->ddmnow = false; _vm->_lucerna.load_digits(); - _vm->_gyro.cheat = false; - _vm->_gyro.cp = 0; - _vm->_gyro.curpos = 1; - _vm->_gyro.quote = true; - _vm->_gyro.ledstatus = 177; - _vm->_gyro.defaultled = 2; + _vm->_gyro->cheat = false; + _vm->_gyro->cp = 0; + _vm->_gyro->curpos = 1; + _vm->_gyro->quote = true; + _vm->_gyro->ledstatus = 177; + _vm->_gyro->defaultled = 2; /* TSkellern:=0; { Replace with a more local variable sometime }*/ - _vm->_gyro.dna.rw = _vm->_gyro.stopped; - _vm->_gyro.enid_filename = ""; /* undefined. */ + _vm->_gyro->dna.rw = _vm->_gyro->stopped; + _vm->_gyro->enid_filename = ""; /* undefined. */ _vm->_lucerna.toolbar(); _vm->_scrolls.state(2); _vm->_graphics->refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) - _vm->_gyro.lastscore[i] = -1; /* impossible digits */ + _vm->_gyro->lastscore[i] = -1; /* impossible digits */ /* for gd:=0 to 1 do begin @@ -109,45 +109,45 @@ void Avalot::setup() { _vm->_trip.loadtrip(); - _vm->_gyro.reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game. + _vm->_gyro->reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game. - if ((_vm->_gyro.filetoload.empty()) && (! _vm->_gyro.reloaded)) - _vm->_gyro.newgame(); /* no game was requested- load the default */ + if ((_vm->_gyro->filetoload.empty()) && (! _vm->_gyro->reloaded)) + _vm->_gyro->newgame(); /* no game was requested- load the default */ else { - if (! _vm->_gyro.reloaded) + if (! _vm->_gyro->reloaded) _vm->_enid.avvy_background(); _vm->_dropdown.standard_bar(); _vm->_lucerna.sprite_run(); - if (_vm->_gyro.reloaded) + if (_vm->_gyro->reloaded) _vm->_enid.edna_reload(); else { /* Filename given on the command line (or loadfirst) */ - _vm->_enid.edna_load(_vm->_gyro.filetoload); + _vm->_enid.edna_load(_vm->_gyro->filetoload); if (_vm->_enid.there_was_a_problem()) { _vm->_scrolls.display("So let's start from the beginning instead..."); - _vm->_gyro.holdthedawn = true; + _vm->_gyro->holdthedawn = true; _vm->_lucerna.dusk(); - _vm->_gyro.newgame(); + _vm->_gyro->newgame(); } } } - if (! _vm->_gyro.reloaded) { - _vm->_gyro.soundfx = ! _vm->_gyro.soundfx; + if (! _vm->_gyro->reloaded) { + _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; _vm->_lucerna.fxtoggle(); - _vm->_lucerna.thinkabout(_vm->_gyro.money, _vm->_gyro.a_thing); + _vm->_lucerna.thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); } _vm->_trip.get_back_loretta(); //gm = getpixel(0: 0); //setcolor(7); - _vm->_gyro.holdthedawn = false; + _vm->_gyro->holdthedawn = false; _vm->_lucerna.dawn(); - _vm->_gyro.cursoron = false; + _vm->_gyro->cursoron = false; _vm->_basher.cursor_on(); _vm->_trip.newspeed(); - if (! _vm->_gyro.reloaded) + if (! _vm->_gyro->reloaded) _vm->_visa.dixi('q', 83); /* Info on the game: etc. */ } @@ -184,18 +184,18 @@ void Avalot::run(Common::String arg) { _vm->_basher.keyboard_link(); _vm->_dropdown.menu_link(); _vm->_trip.readstick(); - _vm->_gyro.force_numlock(); + _vm->_gyro->force_numlock(); _vm->_trip.get_back_loretta(); _vm->_trip.trippancy_link(); _vm->_celer.pics_link(); _vm->_lucerna.checkclick(); - if (_vm->_gyro.visible == _vm->_gyro.m_virtual) - _vm->_gyro.plot_vmc(_vm->_gyro.mx, _vm->_gyro.my, _vm->_gyro.cp); + if (_vm->_gyro->visible == _vm->_gyro->m_virtual) + _vm->_gyro->plot_vmc(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->cp); _vm->_lucerna.flip_page(); /* <<_gyro.slowdown(); - if (_vm->_gyro.visible == _vm->_gyro.m_virtual) - _vm->_gyro.wipe_vmc(_vm->_gyro.cp); + _vm->_gyro->slowdown(); + if (_vm->_gyro->visible == _vm->_gyro->m_virtual) + _vm->_gyro->wipe_vmc(_vm->_gyro->cp); _vm->_timeout.one_tick(); @@ -207,7 +207,7 @@ void Avalot::run(Common::String arg) { _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. - } while (! _vm->_gyro.lmo); + } while (! _vm->_gyro->lmo); //restorecrtmode(); //if (logging) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 176cbfcc3148..3f2b01bdb62c 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -56,13 +56,13 @@ void Basher::setParent(AvalancheEngine *vm) { void Basher::init() { /* new(previous);*/ - if (!_vm->_gyro.last.empty()) - _vm->_gyro.last.clear(); + if (!_vm->_gyro->last.empty()) + _vm->_gyro->last.clear(); normal_edit(); - if (_vm->_gyro.demo) { - if (!_vm->_gyro.demofile.open("demo.avd")) { + if (_vm->_gyro->demo) { + if (!_vm->_gyro->demofile.open("demo.avd")) { warning("AVALANCHE: Basher: File not found: demo.avd"); throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. } @@ -71,7 +71,7 @@ void Basher::init() { // Not sure that the following part will be used ever... #ifdef RECORD count = 0; - if (!_vm->_gyro.demofile_save.open("demo.avd")) { + if (!_vm->_gyro->demofile_save.open("demo.avd")) { warning("AVALANCHE: Basher: File not found: demo.avd"); throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. } @@ -183,10 +183,10 @@ void Basher::filename_edit() { void Basher::normal_edit() { entering_filename = false; - /*if (!_vm->_gyro.current.empty()) - _vm->_gyro.current.clear();*/ + /*if (!_vm->_gyro->current.empty()) + _vm->_gyro->current.clear();*/ left_margin = 1; - _vm->_gyro.curpos = 1; + _vm->_gyro->curpos = 1; } } // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index cc440215319d..e73f51c835c4 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -53,36 +53,36 @@ void Celer::setParent(AvalancheEngine *vm) { void Celer::pics_link() { byte xx; - if (_vm->_gyro.ddmnow) + if (_vm->_gyro->ddmnow) return; /* No animation when the menus are up. */ - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__outsideargentpub: - if ((_vm->_gyro.roomtime % int32(12)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); + if ((_vm->_gyro->roomtime % int32(12)) == 0) + show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(4)); break; case r__brummieroad: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % int32(2)) == 0) + show_one(int32(1) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); break; case r__bridge: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % int32(2)) == 0) + show_one(int32(4) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); break; case r__yours: - if ((!_vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); + if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % int32(4)) == 0)) + show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(2)); break; case r__argentpub: - if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { + if (((_vm->_gyro->roomtime % int32(7)) == 1) && (_vm->_gyro->dna.malagauche != 177)) { /* Malagauche cycle */ - _vm->_gyro.dna.malagauche += 1; - switch (_vm->_gyro.dna.malagauche) { + _vm->_gyro->dna.malagauche += 1; + switch (_vm->_gyro->dna.malagauche) { case 1: case 11: case 21: @@ -98,12 +98,12 @@ void Celer::pics_link() { show_one(13); break; /* Winks. */ case 33: - _vm->_gyro.dna.malagauche = 0; + _vm->_gyro->dna.malagauche = 0; break; } } - switch (_vm->_gyro.roomtime % 200) { + switch (_vm->_gyro->roomtime % 200) { case 179: case 197: show_one(5); @@ -116,11 +116,11 @@ void Celer::pics_link() { show_one(7); break; case 199: - _vm->_gyro.dna.dogfoodpos = 177; + _vm->_gyro->dna.dogfoodpos = 177; break; /* Impossible value for this. */ } - if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ + if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { /* Normally. */ if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) xx = 3; else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) @@ -128,16 +128,16 @@ void Celer::pics_link() { else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) xx = 4; - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; + _vm->_gyro->dna.dogfoodpos = xx; } } break; case r__westhall: - if ((_vm->_gyro.roomtime % int32(3)) == 0) { - switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { + if ((_vm->_gyro->roomtime % int32(3)) == 0) { + switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: show_one(1); break; @@ -155,8 +155,8 @@ void Celer::pics_link() { break; case r__lustiesroom: - if (!(_vm->_gyro.dna.lustie_is_asleep)) { - if ((_vm->_gyro.roomtime % int32(45)) > 42) + if (!(_vm->_gyro->dna.lustie_is_asleep)) { + if ((_vm->_gyro->roomtime % int32(45)) > 42) xx = 4; /* du Lustie blinks */ /* Bearing of Avvy from du Lustie. */ @@ -167,16 +167,16 @@ void Celer::pics_link() { else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) xx = 3; /* Right. */ - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } } break; case r__aylesoffice: - if ((!_vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { - switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { + if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % int32(14) == 0)) { + switch ((_vm->_gyro->roomtime / int32(14)) % int32(2)) { case 0: show_one(1); break; /* Frame 2: EGA. */ @@ -188,8 +188,8 @@ void Celer::pics_link() { break; case r__robins: - if (_vm->_gyro.dna.tied_up) { - switch (_vm->_gyro.roomtime % int32(54)) { + if (_vm->_gyro->dna.tied_up) { + switch (_vm->_gyro->roomtime % int32(54)) { case 20: show_one(4); break; /* Frame 4: Avalot blinks. */ @@ -209,15 +209,15 @@ void Celer::pics_link() { else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) xx = 8; /* Right. */ - if ((_vm->_gyro.roomtime % int32(60)) > 57) + if ((_vm->_gyro->roomtime % int32(60)) > 57) xx--; /* Blinks */ - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } - switch (_vm->_gyro.roomtime % 50) { + switch (_vm->_gyro->roomtime % 50) { case 45 : show_one(9); break; /* Spurge blinks */ @@ -228,8 +228,8 @@ void Celer::pics_link() { break; case r__ducks: - if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ - show_one(1 + (_vm->_gyro.roomtime / 3) % 3); + if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */ + show_one(1 + (_vm->_gyro->roomtime / 3) % 3); {/* _vm->_lucerna.bearing of Avvy from Duck. */ if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) @@ -239,26 +239,26 @@ void Celer::pics_link() { else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) xx = 8; /* Right. */ - if ((_vm->_gyro.roomtime % int32(45)) > 42) + if ((_vm->_gyro->roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } break; } } - if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) { + if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { /* They're ringing the bells. */ - switch (_vm->_gyro.roomtime % int32(4)) { + switch (_vm->_gyro->roomtime % int32(4)) { case 1: - if (_vm->_gyro.dna.nextbell < 5) - _vm->_gyro.dna.nextbell = 12; - _vm->_gyro.dna.nextbell -= 1; - _vm->_gyro.note(_vm->_gyro.notes[_vm->_gyro.dna.nextbell]); + if (_vm->_gyro->dna.nextbell < 5) + _vm->_gyro->dna.nextbell = 12; + _vm->_gyro->dna.nextbell -= 1; + _vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]); break; case 2: //nosound; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 219df15fc284..985eb7f08861 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -58,14 +58,14 @@ headtype *headtype::init(char trig, char alttrig, Common::String name, byte p, f } void headtype::display() { - _dr->_vm->_gyro.off(); /*MT*/ + _dr->_vm->_gyro->off(); /*MT*/ _dr->chalk(xpos, 1, trigger, title, true); - _dr->_vm->_gyro.on(); /*MT*/ + _dr->_vm->_gyro->on(); /*MT*/ } void headtype::highlight() { - _dr->_vm->_gyro.off(); - _dr->_vm->_gyro.off_virtual(); + _dr->_vm->_gyro->off(); + _dr->_vm->_gyro->off_virtual(); //nosound(); //setactivepage(cp); @@ -75,10 +75,10 @@ void headtype::highlight() { { _dr->ddm_o.left = xpos; _dr->ddm_o.menunow = true; - _dr->_vm->_gyro.ddmnow = true; + _dr->_vm->_gyro->ddmnow = true; _dr->ddm_o.menunum = position; } - _dr->_vm->_gyro.cmp = 177; /* Force redraw of cursor. */ + _dr->_vm->_gyro->cmp = 177; /* Force redraw of cursor. */ } bool headtype::extdparse(char c) { @@ -95,7 +95,7 @@ bool headtype::extdparse(char c) { onemenu *onemenu::init(Dropdown *dr) { _dr = dr; menunow = false; - _dr->_vm->_gyro.ddmnow = false; + _dr->_vm->_gyro->ddmnow = false; menunum = 1; return this; } @@ -140,10 +140,10 @@ void onemenu::movehighlight(int8 add) { void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ warning("STUB: Dropdown::onemenu::lightup()"); - /*if ((_dr->_vm->_gyro.mx < flx1 * 8) || (_dr->_vm->_gyro.mx > flx2 * 8) || - (_dr->_vm->_gyro.my <= 12) || (_dr->_vm->_gyro.my > fly - 3)) + /*if ((_dr->_vm->_gyro->mx < flx1 * 8) || (_dr->_vm->_gyro->mx > flx2 * 8) || + (_dr->_vm->_gyro->my <= 12) || (_dr->_vm->_gyro->my > fly - 3)) return; - highlightnum = (_dr->_vm->_gyro.my - 13) / 10; + highlightnum = (_dr->_vm->_gyro->my - 13) / 10; if (highlightnum == oldy) return; movehighlight(0);*/ @@ -172,7 +172,7 @@ void onemenu::keystroke(char c) { } } if (! found) - _dr->_vm->_gyro.blip(); + _dr->_vm->_gyro->blip(); } @@ -199,8 +199,8 @@ void menuset::update() { bar(0, 0, 640, 9);*/ _dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->menu_b); - savecp = _dr->_vm->_gyro.cp; - _dr->_vm->_gyro.cp = 3; + savecp = _dr->_vm->_gyro->cp; + _dr->_vm->_gyro->cp = 3; for (fv = 1; fv <= howmany; fv ++) ddms[fv].display(); @@ -208,7 +208,7 @@ void menuset::update() { for (page_ = 0; page_ <= 1; page_ ++) _dr->_vm->_trip.getset[page_].remember(menuspace); - _dr->_vm->_gyro.cp = savecp; + _dr->_vm->_gyro->cp = savecp; } void menuset::extd(char c) { @@ -251,30 +251,30 @@ void Dropdown::setParent(AvalancheEngine *vm) { } void Dropdown::find_what_you_can_do_with_it() { - switch (_vm->_gyro.thinks) { - case _vm->_gyro.wine: - case _vm->_gyro.potion: - case _vm->_gyro.ink: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_drink; + switch (_vm->_gyro->thinks) { + case _vm->_gyro->wine: + case _vm->_gyro->potion: + case _vm->_gyro->ink: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_drink; break; - case _vm->_gyro.bell: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_ring; + case _vm->_gyro->bell: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_ring; break; - case _vm->_gyro.chastity: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + case _vm->_gyro->chastity: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; break; - case _vm->_gyro.lute: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_play; + case _vm->_gyro->lute: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_play; break; - case _vm->_gyro.mushroom: - case _vm->_gyro.onion: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_eat; + case _vm->_gyro->mushroom: + case _vm->_gyro->onion: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_eat; break; - case _vm->_gyro.clothes: - _vm->_gyro.verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + case _vm->_gyro->clothes: + _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; break; default: - _vm->_gyro.verbstr = _vm->_acci.vb_exam; /* anything else */ + _vm->_gyro->verbstr = _vm->_acci.vb_exam; /* anything else */ } } @@ -287,7 +287,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { for (byte fv = 0; fv < z.size(); fv++) for (byte ff = 0; ff < 8; ff++) { - byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! + byte pixel = ~(_vm->_gyro->little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); @@ -398,9 +398,9 @@ void Dropdown::ddm__file() { ddm_o.start_afresh(); ddm_o.opt("New game", 'N', "f4", true); ddm_o.opt("Load...", 'L', "^f3", true); - ddm_o.opt("Save", 'S', "^f2", _vm->_gyro.alive); - ddm_o.opt("Save As...", 'v', "", _vm->_gyro.alive); - ddm_o.opt("DOS Shell", 'D', _vm->_gyro.atkey + '1', true); + ddm_o.opt("Save", 'S', "^f2", _vm->_gyro->alive); + ddm_o.opt("Save As...", 'v', "", _vm->_gyro->alive); + ddm_o.opt("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); ddm_o.opt("Quit", 'Q', "alt-X", true); ddm_o.display(); } @@ -408,7 +408,7 @@ void Dropdown::ddm__file() { void Dropdown::ddm__action() { Common::String n; - n = Common::String(_vm->_gyro.f5_does().c_str() + 2, 253); + n = Common::String(_vm->_gyro->f5_does().c_str() + 2, 253); { ddm_o.start_afresh(); @@ -417,13 +417,13 @@ void Dropdown::ddm__action() { else ddm_o.opt(Common::String(n.c_str() + 2, 253), n[1], "f5", true); ddm_o.opt("Pause game", 'P', "f6", true); - if (_vm->_gyro.dna.room == 99) + if (_vm->_gyro->dna.room == 99) ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip.neardoor()); else ddm_o.opt("Open the door", 'O', "f7", _vm->_trip.neardoor()); ddm_o.opt("Look around", 'L', "f8", true); ddm_o.opt("Inventory", 'I', "Tab", true); - if (_vm->_trip.tr[1].xs == _vm->_gyro.walk) + if (_vm->_trip.tr[1].xs == _vm->_gyro->walk) ddm_o.opt("Run fast", 'R', "^R", true); else ddm_o.opt("Walk slowly", 'W', "^W", true); @@ -436,13 +436,13 @@ void Dropdown::ddm__people() { char fv; people = ""; - here = _vm->_gyro.dna.room; + here = _vm->_gyro->dna.room; { ddm_o.start_afresh(); for (fv = '\226'; fv <= '\262'; fv ++) - if (_vm->_gyro.whereis[fv] == here) { - ddm_o.opt(_vm->_gyro.getname(fv), _vm->_gyro.getnamechar(fv), "", true); + if (_vm->_gyro->whereis[fv] == here) { + ddm_o.opt(_vm->_gyro->getname(fv), _vm->_gyro->getnamechar(fv), "", true); people = people + fv; } ddm_o.display(); @@ -454,8 +454,8 @@ void Dropdown::ddm__objects() { { ddm_o.start_afresh(); for (fv = '\1'; fv <= numobjs; fv ++) - if (_vm->_gyro.dna.obj[fv]) - ddm_o.opt(_vm->_gyro.get_thing(fv), _vm->_gyro.get_thingchar(fv), "", true); + if (_vm->_gyro->dna.obj[fv]) + ddm_o.opt(_vm->_gyro->get_thing(fv), _vm->_gyro->get_thingchar(fv), "", true); ddm_o.display(); } } @@ -553,7 +553,7 @@ void Dropdown::do__action() { case 0: { _vm->_acci.person = _vm->_acci.pardon; _vm->_acci.thing = _vm->_acci.pardon; - n = _vm->_gyro.f5_does(); + n = _vm->_gyro->f5_does(); _vm->_lucerna.callverb(n[1]); } break; @@ -570,8 +570,8 @@ void Dropdown::do__action() { _vm->_lucerna.callverb(_vm->_acci.vb_inv); break; case 5: { - if (_vm->_trip.tr[1].xs == _vm->_gyro.walk) _vm->_trip.tr[1].xs = _vm->_gyro.run; - else _vm->_trip.tr[1].xs = _vm->_gyro.walk; + if (_vm->_trip.tr[1].xs == _vm->_gyro->walk) _vm->_trip.tr[1].xs = _vm->_gyro->run; + else _vm->_trip.tr[1].xs = _vm->_gyro->walk; _vm->_trip.newspeed(); } break; @@ -579,28 +579,28 @@ void Dropdown::do__action() { } void Dropdown::do__objects() { - _vm->_lucerna.thinkabout(_vm->_gyro.objlist[ddm_o.choicenum + 1], _vm->_gyro.a_thing); + _vm->_lucerna.thinkabout(_vm->_gyro->objlist[ddm_o.choicenum + 1], _vm->_gyro->a_thing); } void Dropdown::do__people() { - _vm->_lucerna.thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro.a_person); - _vm->_gyro.last_person = people[ddm_o.choicenum + 1]; + _vm->_lucerna.thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro->a_person); + _vm->_gyro->last_person = people[ddm_o.choicenum + 1]; } void Dropdown::do__with() { - _vm->_acci.thing = _vm->_gyro.thinks; + _vm->_acci.thing = _vm->_gyro->thinks; - if (_vm->_gyro.thinkthing) { + if (_vm->_gyro->thinkthing) { _vm->_acci.thing += 49; - if (_vm->_gyro.verbstr[ddm_o.choicenum + 1] == _vm->_acci.vb_give) - _vm->_acci.person = _vm->_gyro.last_person; + if (_vm->_gyro->verbstr[ddm_o.choicenum + 1] == _vm->_acci.vb_give) + _vm->_acci.person = _vm->_gyro->last_person; else _vm->_acci.person = '\376'; } else { - switch (_vm->_gyro.verbstr[ddm_o.choicenum + 1]) { + switch (_vm->_gyro->verbstr[ddm_o.choicenum + 1]) { case '\144': { _vm->_acci.thing = '\144'; _vm->_lucerna.callverb(_vm->_acci.vb_buy); @@ -643,7 +643,7 @@ void Dropdown::do__with() { } } } - _vm->_lucerna.callverb(_vm->_gyro.verbstr[ddm_o.choicenum + 1]); + _vm->_lucerna.callverb(_vm->_gyro->verbstr[ddm_o.choicenum + 1]); } /*$F- That's all. Now for the ...bar funcs. */ @@ -680,26 +680,26 @@ begin; end;*/ void Dropdown::checkclick() { /* only for when the menu's displayed */ - if (_vm->_gyro.mpress > 0) { - if (_vm->_gyro.mpy > 10) { + if (_vm->_gyro->mpress > 0) { + if (_vm->_gyro->mpy > 10) { if (!((ddm_o.firstlix) && - ((_vm->_gyro.mpx >= ddm_o.flx1 * 8) && (_vm->_gyro.mpx <= ddm_o.flx2 * 8) && - (_vm->_gyro.mpy >= 12) && (_vm->_gyro.mpy <= ddm_o.fly)))) { + ((_vm->_gyro->mpx >= ddm_o.flx1 * 8) && (_vm->_gyro->mpx <= ddm_o.flx2 * 8) && + (_vm->_gyro->mpy >= 12) && (_vm->_gyro->mpy <= ddm_o.fly)))) { /* Clicked OUTSIDE the menu. */ if (ddm_o.menunow) ddm_o.wipe(); } /* No "else"- clicking on menu has no effect (only releasing) */ } else { /* Clicked on menu bar */ - ddm_m.getmenu(_vm->_gyro.mpx); + ddm_m.getmenu(_vm->_gyro->mpx); } } else { ; /* NOT clicked button... */ - if (_vm->_gyro.mrelease > 0) { + if (_vm->_gyro->mrelease > 0) { if ((ddm_o.firstlix) && - ((_vm->_gyro.mrx >= ddm_o.flx1 * 8) && (_vm->_gyro.mrx <= ddm_o.flx2 * 8) && - (_vm->_gyro.mry >= 12) && (_vm->_gyro.mry <= ddm_o.fly))) - ddm_o.select((_vm->_gyro.mry - 13) / 10); + ((_vm->_gyro->mrx >= ddm_o.flx1 * 8) && (_vm->_gyro->mrx <= ddm_o.flx2 * 8) && + (_vm->_gyro->mry >= 12) && (_vm->_gyro->mry <= ddm_o.fly))) + ddm_o.select((_vm->_gyro->mry - 13) / 10); } } } @@ -707,22 +707,22 @@ void Dropdown::checkclick() { /* only for when the menu's displayed */ void Dropdown::menu_link() { if (! ddm_o.menunow) return; - _vm->_gyro.check(); /* find mouse coords & click information */ + _vm->_gyro->check(); /* find mouse coords & click information */ checkclick(); /* work out click codes */ /* Change arrow... */ - if ((_vm->_gyro.my >= 0) && (_vm->_gyro.my <= 10)) - _vm->_gyro.newpointer(1); /* up-arrow */ - else if ((_vm->_gyro.my >= 11) && (_vm->_gyro.my <= 169)) { - if ((_vm->_gyro.mx >= ddm_o.flx1 * 8) && (_vm->_gyro.mx <= ddm_o.flx2 * 8) - && (_vm->_gyro.my > 10) && (_vm->_gyro.my <= ddm_o.fly)) - _vm->_gyro.newpointer(3); /* right-arrow */ + if ((_vm->_gyro->my >= 0) && (_vm->_gyro->my <= 10)) + _vm->_gyro->newpointer(1); /* up-arrow */ + else if ((_vm->_gyro->my >= 11) && (_vm->_gyro->my <= 169)) { + if ((_vm->_gyro->mx >= ddm_o.flx1 * 8) && (_vm->_gyro->mx <= ddm_o.flx2 * 8) + && (_vm->_gyro->my > 10) && (_vm->_gyro->my <= ddm_o.fly)) + _vm->_gyro->newpointer(3); /* right-arrow */ else - _vm->_gyro.newpointer(4); /* fletch */ - } else if ((_vm->_gyro.my >= 169) && (_vm->_gyro.my <= 200)) - _vm->_gyro.newpointer(2); /* screwdriver */ + _vm->_gyro->newpointer(4); /* fletch */ + } else if ((_vm->_gyro->my >= 169) && (_vm->_gyro->my <= 200)) + _vm->_gyro->newpointer(2); /* screwdriver */ if (! ddm_o.menunow) return; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 107330a678e4..7284b888b4e2 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -94,7 +94,7 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { break; } - day = _vm->_gyro.strf(d); + day = _vm->_gyro->strf(d); if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) { switch (d % 10) { @@ -112,7 +112,7 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { } } - expanddate_result = day + ' ' + month + ' ' + _vm->_gyro.strf(y); + expanddate_result = day + ' ' + month + ' ' + _vm->_gyro->strf(y); return expanddate_result; } @@ -148,8 +148,8 @@ void Enid::edna_save(Common::String name) { } void Enid::loaderror(Common::String x, char icon) { - if (_vm->_gyro.holdthedawn) { - _vm->_gyro.holdthedawn = false; + if (_vm->_gyro->holdthedawn) { + _vm->_gyro->holdthedawn = false; _vm->_lucerna.dawn(); } _vm->_scrolls.display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); @@ -250,17 +250,17 @@ void Enid::avvy_background() { /* Not really a filing procedure, } void Enid::to_sundry(sundry &sund) { - sund.qenid_filename = _vm->_gyro.enid_filename; - sund.qsoundfx = _vm->_gyro.soundfx; - sund.qthinks = _vm->_gyro.thinks; - sund.qthinkthing = _vm->_gyro.thinkthing; + sund.qenid_filename = _vm->_gyro->enid_filename; + sund.qsoundfx = _vm->_gyro->soundfx; + sund.qthinks = _vm->_gyro->thinks; + sund.qthinkthing = _vm->_gyro->thinkthing; } void Enid::from_sundry(sundry sund) { - _vm->_gyro.enid_filename = sund.qenid_filename; - _vm->_gyro.soundfx = sund.qsoundfx; - _vm->_gyro.thinks = sund.qthinks; - _vm->_gyro.thinkthing = sund.qthinkthing; + _vm->_gyro->enid_filename = sund.qenid_filename; + _vm->_gyro->soundfx = sund.qsoundfx; + _vm->_gyro->thinks = sund.qthinks; + _vm->_gyro->thinkthing = sund.qthinkthing; } void Enid::restore_dna() { @@ -274,19 +274,19 @@ void Enid::edna_reload() { restore_dna(); - _vm->_gyro.seescroll = true; /* This prevents display of the new sprites before the + _vm->_gyro->seescroll = true; /* This prevents display of the new sprites before the new picture is loaded. */ _vm->_lucerna.major_redraw(); - _vm->_gyro.whereis[_vm->_gyro.pavalot] = _vm->_gyro.dna.room; + _vm->_gyro->whereis[_vm->_gyro->pavalot] = _vm->_gyro->dna.room; - _vm->_gyro.alive = true; + _vm->_gyro->alive = true; _vm->_lucerna.objectlist(); - if (_vm->_gyro.holdthedawn) { - _vm->_gyro.holdthedawn = false; + if (_vm->_gyro->holdthedawn) { + _vm->_gyro->holdthedawn = false; _vm->_lucerna.dawn(); } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index aba169c6b8f5..dd1157b6285c 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -246,7 +246,9 @@ const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; -Gyro::Gyro() : interrogation(0), oncandopageswap(true) { +Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { + _vm = vm; + /* Needed becouse of Lucerna::load_also() */ for (int fv = 0; fv < 31; fv++) for (int ff = 0; ff < 2; ff++) @@ -265,10 +267,6 @@ Gyro::~Gyro() { } -void Gyro::setParent(AvalancheEngine *vm) { - _vm = vm; -} - void Gyro::newpointer(byte m) { if (m == cmp) return; cmp = m; @@ -359,7 +357,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ alive = true; score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ - memset(&_vm->_gyro.dna, 0, sizeof(dnatype)); + memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); _vm->_scrolls.natural(); _vm->_basher.normal_edit(); _vm->_lucerna.mousepage(0); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 29de10ca902e..58b5844906f1 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -610,12 +610,10 @@ class Gyro { bool use_joy_a; - Gyro(); + Gyro(AvalancheEngine *vm); ~Gyro(); - void setParent(AvalancheEngine *vm); - void newpointer(byte m); void wait(); /* makes hourglass */ diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index eeedb2301ef7..20ca558e41f0 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -82,7 +82,7 @@ void Logger::setParent(AvalancheEngine *vm) { void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ byte fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::centre()"); @@ -109,13 +109,13 @@ void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ void Logger::log_divider() { /* Prints the divider sign. */ byte fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_divider()"); /* - if (_vm->_gyro.log_epson) { + if (_vm->_gyro->log_epson) { output << logfile << Common::String(' ') + double_width; for (fv = 1; fv <= divide_indent; fv++) output << logfile << ' '; @@ -129,19 +129,19 @@ void Logger::log_divider() { /* Prints the divider sign. */ } void Logger::log_command(Common::String x) { /* Prints a command */ - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_command()"); - /*if (_vm->_gyro.log_epson) + /*if (_vm->_gyro->log_epson) output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; else output << logfile << Common::String("> ") + x << NL;*/ } void Logger::log_addstuff(Common::String x) { - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; scroll_line += x; @@ -149,7 +149,7 @@ void Logger::log_addstuff(Common::String x) { void Logger::log_scrollchar(Common::String x) { /* print one character */ Common::String z; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; switch (x[1]) { @@ -170,34 +170,34 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */ } void Logger::log_italic() { - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_italic()"); - /*if (_vm->_gyro.log_epson) + /*if (_vm->_gyro->log_epson) log_addstuff(italic); else log_addstuff("*");*/ } void Logger::log_roman() { - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_roman()"); - /* if (_vm->_gyro.log_epson) + /* if (_vm->_gyro->log_epson) log_addstuff(italic_off); else log_addstuff("*");*/ } void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; - if (_vm->_gyro.log_epson) + if (_vm->_gyro->log_epson) log_addstuff(italic_off); } @@ -208,7 +208,7 @@ void Logger::log_scrollline() { /* Set up a line for the scroll driver */ void Logger::log_scrollendline(bool centred) { byte x, fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; x = 17; if (centred) @@ -223,7 +223,7 @@ void Logger::log_scrollendline(bool centred) { void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { byte fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_bubbleline()"); @@ -242,30 +242,30 @@ void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { void Logger::log_newline() { warning("STUB: Logger::log_newline()"); - //if (_vm->_gyro.logging) + //if (_vm->_gyro->logging) // output << logfile << NL; } void Logger::log_newroom(Common::String where) { byte fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_newroom()"); /*for (fv = 1; fv <= 20; fv++) output << logfile << ' '; - if (_vm->_gyro.log_epson) + if (_vm->_gyro->log_epson) output << logfile << emph_on; output << logfile << Common::String('(') + where + ')'; - if (_vm->_gyro.log_epson) + if (_vm->_gyro->log_epson) output << logfile << emph_off; output << logfile << NL;*/ } void Logger::log_aside(Common::String what) { /* This writes "asides" to the printer. For example, moves in Nim. */ - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_aside()"); @@ -276,7 +276,7 @@ void Logger::log_aside(Common::String what) { void Logger::log_score(uint16 credit, uint16 now) { byte fv; - if (!_vm->_gyro.logging) + if (!_vm->_gyro->logging) return; warning("STUB: Logger::log_score()"); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index aefa6bff9765..f2690085e02a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -61,10 +61,10 @@ void Lucerna::setParent(AvalancheEngine *vm) { } void Lucerna::init() { - _vm->_gyro.oh = 17717; - _vm->_gyro.om = 17717; - if (_vm->_enhanced.atbios) _vm->_gyro.atkey = "f1"; - else _vm->_gyro.atkey = "alt-"; + _vm->_gyro->oh = 17717; + _vm->_gyro->om = 17717; + if (_vm->_enhanced.atbios) _vm->_gyro->atkey = "f1"; + else _vm->_gyro->atkey = "alt-"; } void Lucerna::callverb(char n) { @@ -74,7 +74,7 @@ void Lucerna::callverb(char n) { "assigned to it. You may press alt-A to see what the " + "current setting of this key is."); } else { - _vm->_gyro.weirdword = false; + _vm->_gyro->weirdword = false; _vm->_acci.polite = true; _vm->_acci.verb = n; _vm->_acci.do_that(); @@ -108,10 +108,10 @@ void Lucerna::scram1(Common::String &x) { void Lucerna::unscramble() { for (byte fv = 0; fv < 31; fv ++) for (byte ff = 0; ff < 2; ff ++) - if (_vm->_gyro.also[fv][ff] != 0) - scram1(*_vm->_gyro.also[fv][ff]); - scram1(_vm->_gyro.listen); - scram1(_vm->_gyro.flags); + if (_vm->_gyro->also[fv][ff] != 0) + scram1(*_vm->_gyro->also[fv][ff]); + scram1(_vm->_gyro->listen); + scram1(_vm->_gyro->flags); /* for fz:=1 to length(also[fv,ff]^) do also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ } @@ -121,9 +121,9 @@ void Lucerna::load_also(Common::String n) { for (fv = 0; fv < 31; fv++) for (ff = 0; ff < 2; ff++) - if (_vm->_gyro.also[fv][ff] != 0) { - delete _vm->_gyro.also[fv][ff]; - _vm->_gyro.also[fv][ff] = 0; + if (_vm->_gyro->also[fv][ff] != 0) { + delete _vm->_gyro->also[fv][ff]; + _vm->_gyro->also[fv][ff] = 0; } Common::String filename; @@ -138,58 +138,58 @@ void Lucerna::load_also(Common::String n) { byte minnames = f.readByte(); for (fv = 0; fv <= minnames; fv++) { for (ff = 0; ff < 2; ff++) { - _vm->_gyro.also[fv][ff] = new Common::String; - *_vm->_gyro.also[fv][ff] = nextstring(); + _vm->_gyro->also[fv][ff] = new Common::String; + *_vm->_gyro->also[fv][ff] = nextstring(); } - *_vm->_gyro.also[fv][0] = Common::String(157) + *_vm->_gyro.also[fv][0] + 157; + *_vm->_gyro->also[fv][0] = Common::String(157) + *_vm->_gyro->also[fv][0] + 157; } - memset(_vm->_gyro.lines, 0xFF, sizeof(_vm->_gyro.lines)); + memset(_vm->_gyro->lines, 0xFF, sizeof(_vm->_gyro->lines)); //fv = getpixel(0, 0); fv = f.readByte(); for (byte i = 0; i < fv; i++) { - _vm->_gyro.lines[i].x1 = f.readSint16LE(); - _vm->_gyro.lines[i].y1 = f.readSint16LE(); - _vm->_gyro.lines[i].x2 = f.readSint16LE(); - _vm->_gyro.lines[i].y2 = f.readSint16LE(); - _vm->_gyro.lines[i].col = f.readByte(); + _vm->_gyro->lines[i].x1 = f.readSint16LE(); + _vm->_gyro->lines[i].y1 = f.readSint16LE(); + _vm->_gyro->lines[i].x2 = f.readSint16LE(); + _vm->_gyro->lines[i].y2 = f.readSint16LE(); + _vm->_gyro->lines[i].col = f.readByte(); } - memset(_vm->_gyro.peds, 177, sizeof(_vm->_gyro.peds)); + memset(_vm->_gyro->peds, 177, sizeof(_vm->_gyro->peds)); fv = f.readByte(); for (byte i = 0; i < fv; i++) { - _vm->_gyro.peds[i].x = f.readSint16LE(); - _vm->_gyro.peds[i].y = f.readSint16LE(); - _vm->_gyro.peds[i].dir = f.readByte(); + _vm->_gyro->peds[i].x = f.readSint16LE(); + _vm->_gyro->peds[i].y = f.readSint16LE(); + _vm->_gyro->peds[i].dir = f.readByte(); } - _vm->_gyro.numfields = f.readByte(); - for (byte i = 0; i < _vm->_gyro.numfields; i++) { - _vm->_gyro.fields[i].x1 = f.readSint16LE(); - _vm->_gyro.fields[i].y1 = f.readSint16LE(); - _vm->_gyro.fields[i].x2 = f.readSint16LE(); - _vm->_gyro.fields[i].y2 = f.readSint16LE(); + _vm->_gyro->numfields = f.readByte(); + for (byte i = 0; i < _vm->_gyro->numfields; i++) { + _vm->_gyro->fields[i].x1 = f.readSint16LE(); + _vm->_gyro->fields[i].y1 = f.readSint16LE(); + _vm->_gyro->fields[i].x2 = f.readSint16LE(); + _vm->_gyro->fields[i].y2 = f.readSint16LE(); } for (byte i = 0; i < 15; i++) { - _vm->_gyro.magics[i].op = f.readByte(); - _vm->_gyro.magics[i].data = f.readUint16LE(); + _vm->_gyro->magics[i].op = f.readByte(); + _vm->_gyro->magics[i].data = f.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro.portals[i].op = f.readByte(); - _vm->_gyro.portals[i].data = f.readUint16LE(); + _vm->_gyro->portals[i].op = f.readByte(); + _vm->_gyro->portals[i].data = f.readUint16LE(); } - _vm->_gyro.flags.clear(); + _vm->_gyro->flags.clear(); for (byte i = 0; i < 26; i++) - _vm->_gyro.flags += f.readByte(); + _vm->_gyro->flags += f.readByte(); int16 listen_length = f.readByte(); - _vm->_gyro.listen.clear(); + _vm->_gyro->listen.clear(); for (byte i = 0; i < listen_length; i++) - _vm->_gyro.listen += f.readByte(); + _vm->_gyro->listen += f.readByte(); draw_also_lines(); @@ -199,7 +199,7 @@ void Lucerna::load_also(Common::String n) { f.close(); unscramble(); for (fv = 0; fv <= minnames; fv++) - *_vm->_gyro.also[fv][0] = Common::String(',') + *_vm->_gyro.also[fv][0] + ','; + *_vm->_gyro->also[fv][0] = Common::String(',') + *_vm->_gyro->also[fv][0] + ','; } void Lucerna::load(byte n) { /* Load2, actually */ @@ -209,17 +209,17 @@ void Lucerna::load(byte n) { /* Load2, actually */ Common::String xx; bool was_virtual; - was_virtual = _vm->_gyro.visible == _vm->_gyro.m_virtual; + was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; if (was_virtual) - _vm->_gyro.off_virtual(); + _vm->_gyro->off_virtual(); else - _vm->_gyro.off(); + _vm->_gyro->off(); - _vm->_gyro.clear_vmc(); + _vm->_gyro->clear_vmc(); _vm->_graphics->flesh_colours(); - xx = _vm->_gyro.strf(n); + xx = _vm->_gyro->strf(n); Common::String filename; filename = filename.format("place%s.avd", xx.c_str()); if (!f.open(filename)) { @@ -229,7 +229,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ f.seek(146); for (byte i = 0; i < 30; i++) - _vm->_gyro.roomname += f.readByte(); + _vm->_gyro->roomname += f.readByte(); /* Compression method byte follows this... */ f.seek(177); @@ -278,12 +278,12 @@ void Lucerna::load(byte n) { /* Load2, actually */ bit = *_vm->_graphics->getPixel(0,0); - _vm->_logger.log_newroom(_vm->_gyro.roomname); + _vm->_logger.log_newroom(_vm->_gyro->roomname); if (was_virtual) - _vm->_gyro.on_virtual(); + _vm->_gyro->on_virtual(); else - _vm->_gyro.on(); + _vm->_gyro->on(); } @@ -297,28 +297,28 @@ void Lucerna::zoomout(int16 x, int16 y) { void Lucerna::find_people(byte room) { for (byte fv = 151; fv <= 178; fv++) - if (_vm->_gyro.whereis[fv] == room) { + if (_vm->_gyro->whereis[fv] == room) { if (fv < 175) - _vm->_gyro.him = fv; + _vm->_gyro->him = fv; else - _vm->_gyro.her = fv; + _vm->_gyro->her = fv; } } void Lucerna::exitroom(byte x) { //nosound(); _vm->_celer.forget_chunks(); - _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ + _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ switch (x) { case r__spludwicks: _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); - _vm->_gyro.dna.avaricius_talk = 0; + _vm->_gyro->dna.avaricius_talk = 0; /* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */ break; case r__bridge: - if (_vm->_gyro.dna.drawbridge_open > 0) { - _vm->_gyro.dna.drawbridge_open = 4; /* Fully open. */ + if (_vm->_gyro->dna.drawbridge_open > 0) { + _vm->_gyro->dna.drawbridge_open = 4; /* Fully open. */ _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); } break; @@ -330,39 +330,39 @@ void Lucerna::exitroom(byte x) { break; } - _vm->_gyro.interrogation = 0; /* Leaving the room cancels all the questions automatically. */ + _vm->_gyro->interrogation = 0; /* Leaving the room cancels all the questions automatically. */ - _vm->_gyro.seescroll = false; /* Now it can work again! */ + _vm->_gyro->seescroll = false; /* Now it can work again! */ - _vm->_gyro.dna.last_room = _vm->_gyro.dna.room; - if (_vm->_gyro.dna.room != r__map) - _vm->_gyro.dna.last_room_not_map = _vm->_gyro.dna.room; + _vm->_gyro->dna.last_room = _vm->_gyro->dna.room; + if (_vm->_gyro->dna.room != r__map) + _vm->_gyro->dna.last_room_not_map = _vm->_gyro->dna.room; } void Lucerna::new_town() { /* You've just entered a town from the map. */ _vm->_dropdown.standard_bar(); - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__outsidenottspub: /* Entry into Nottingham. */ - if ((_vm->_gyro.dna.rooms[r__robins] > 0) && (_vm->_gyro.dna.been_tied_up) && (! _vm->_gyro.dna.taken_mushroom)) - _vm->_gyro.dna.mushroom_growing = true; + if ((_vm->_gyro->dna.rooms[r__robins] > 0) && (_vm->_gyro->dna.been_tied_up) && (! _vm->_gyro->dna.taken_mushroom)) + _vm->_gyro->dna.mushroom_growing = true; break; case r__wisewomans: { /* Entry into Argent. */ - if (_vm->_gyro.dna.talked_to_crapulus && (! _vm->_gyro.dna.lustie_is_asleep)) { - _vm->_gyro.dna.spludwicks_here = !((_vm->_gyro.dna.rooms[r__wisewomans] % 3) == 1); - _vm->_gyro.dna.crapulus_will_tell = ! _vm->_gyro.dna.spludwicks_here; + if (_vm->_gyro->dna.talked_to_crapulus && (! _vm->_gyro->dna.lustie_is_asleep)) { + _vm->_gyro->dna.spludwicks_here = !((_vm->_gyro->dna.rooms[r__wisewomans] % 3) == 1); + _vm->_gyro->dna.crapulus_will_tell = ! _vm->_gyro->dna.spludwicks_here; } else { - _vm->_gyro.dna.spludwicks_here = true; - _vm->_gyro.dna.crapulus_will_tell = false; + _vm->_gyro->dna.spludwicks_here = true; + _vm->_gyro->dna.crapulus_will_tell = false; } - if (_vm->_gyro.dna.box_contents == _vm->_gyro.wine) _vm->_gyro.dna.winestate = 3; /* Vinegar */ + if (_vm->_gyro->dna.box_contents == _vm->_gyro->wine) _vm->_gyro->dna.winestate = 3; /* Vinegar */ } break; } - if (_vm->_gyro.dna.room != r__outsideducks) { - if ((_vm->_gyro.dna.obj[_vm->_gyro.onion]) && !(_vm->_gyro.dna.onion_in_vinegar)) - _vm->_gyro.dna.rotten_onion = true; /* You're holding the onion */ + if (_vm->_gyro->dna.room != r__outsideducks) { + if ((_vm->_gyro->dna.obj[_vm->_gyro->onion]) && !(_vm->_gyro->dna.onion_in_vinegar)) + _vm->_gyro->dna.rotten_onion = true; /* You're holding the onion */ } } @@ -378,33 +378,33 @@ void Lucerna::put_geida_at(byte whichped, byte &ped) { } void Lucerna::enterroom(byte x, byte ped) { - _vm->_gyro.seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ + _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ find_people(x); - _vm->_gyro.dna.room = x; + _vm->_gyro->dna.room = x; if (ped != 0) - _vm->_gyro.dna.rooms[x]++; + _vm->_gyro->dna.rooms[x]++; load(x); - if ((_vm->_gyro.dna.rooms[x] == 0) && (! _vm->_gyro.flagset('S'))) + if ((_vm->_gyro->dna.rooms[x] == 0) && (! _vm->_gyro->flagset('S'))) points(1); - _vm->_gyro.whereis[_vm->_gyro.pavalot] = _vm->_gyro.dna.room; + _vm->_gyro->whereis[_vm->_gyro->pavalot] = _vm->_gyro->dna.room; - if (_vm->_gyro.dna.geida_follows) - _vm->_gyro.whereis[_vm->_gyro.pgeida] = x; + if (_vm->_gyro->dna.geida_follows) + _vm->_gyro->whereis[_vm->_gyro->pgeida] = x; - _vm->_gyro.roomtime = 0; + _vm->_gyro->roomtime = 0; - if ((_vm->_gyro.dna.last_room == r__map) && (_vm->_gyro.dna.last_room_not_map != _vm->_gyro.dna.room)) + if ((_vm->_gyro->dna.last_room == r__map) && (_vm->_gyro->dna.last_room_not_map != _vm->_gyro->dna.room)) new_town(); switch (x) { case r__yours: - if (_vm->_gyro.dna.avvy_in_bed) { + if (_vm->_gyro->dna.avvy_in_bed) { _vm->_celer.show_one(3); _vm->_timeout.set_up_timer(100, _vm->_timeout.procarkata_shouts, _vm->_timeout.reason_arkata_shouts); } @@ -412,12 +412,12 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideyours: if (ped > 0) { - if (! _vm->_gyro.dna.talked_to_crapulus) { + if (! _vm->_gyro->dna.talked_to_crapulus) { - _vm->_gyro.whereis[_vm->_gyro.pcrapulus] = r__outsideyours; + _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__outsideyours; _vm->_trip.tr[2].init(8, false, &_vm->_trip); /* load Crapulus */ - if (_vm->_gyro.dna.rooms[r__outsideyours] == 1) { + if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { _vm->_trip.apped(2, 4); /* Start on the right-hand side of the screen. */ _vm->_trip.tr[2].walkto(5); /* Walks up to greet you. */ } else { @@ -428,14 +428,14 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procface_avvy; /* He always faces Avvy. */ - } else _vm->_gyro.whereis[_vm->_gyro.pcrapulus] = r__nowhere; + } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__nowhere; - if (_vm->_gyro.dna.crapulus_will_tell) { + if (_vm->_gyro->dna.crapulus_will_tell) { _vm->_trip.tr[2].init(8, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(4); _vm->_timeout.set_up_timer(20, _vm->_timeout.proccrapulus_splud_out, _vm->_timeout.reason_crapulus_says_spludwick_out); - _vm->_gyro.dna.crapulus_will_tell = false; + _vm->_gyro->dna.crapulus_will_tell = false; } } break; @@ -443,40 +443,40 @@ void Lucerna::enterroom(byte x, byte ped) { /* Need to find out which room is this! case r__outsidespludwicks: - if ((_vm->_gyro.dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { + if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { _vm->_timeout.set_up_timer(20, _vm->_timeout.procbang, _vm->_timeout.reason_explosion); - _vm->_gyro.dna.spludwicks_here = true; + _vm->_gyro->dna.spludwicks_here = true; } break;*/ case r__spludwicks: - if (_vm->_gyro.dna.spludwicks_here) { + if (_vm->_gyro->dna.spludwicks_here) { if (ped > 0) { _vm->_trip.tr[2].init(2, false, &_vm->_trip); /* load Spludwick */ _vm->_trip.apped(2, 2); - _vm->_gyro.whereis['\227'] = r__spludwicks; + _vm->_gyro->whereis['\227'] = r__spludwicks; } - _vm->_gyro.dna.dogfoodpos = 0; /* _vm->_gyro.also Spludwick pos. */ + _vm->_gyro->dna.dogfoodpos = 0; /* _vm->_gyro->also Spludwick pos. */ _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procgeida_procs; - } else _vm->_gyro.whereis['\227'] = r__nowhere; + } else _vm->_gyro->whereis['\227'] = r__nowhere; break; case r__brummieroad: { - if (_vm->_gyro.dna.geida_follows) put_geida_at(5, ped); - if (_vm->_gyro.dna.cwytalot_gone) { - _vm->_gyro.magics[lightred].op = _vm->_gyro.nix; - _vm->_gyro.whereis[_vm->_gyro.pcwytalot] = r__nowhere; + if (_vm->_gyro->dna.geida_follows) put_geida_at(5, ped); + if (_vm->_gyro->dna.cwytalot_gone) { + _vm->_gyro->magics[lightred].op = _vm->_gyro->nix; + _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__nowhere; } else { if (ped > 0) { _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot*/ _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procfollow_avvy_y; - _vm->_gyro.whereis[_vm->_gyro.pcwytalot] = r__brummieroad; + _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__brummieroad; - if (_vm->_gyro.dna.rooms[r__brummieroad] == 1) { /* First time here... */ + if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ _vm->_trip.apped(2, 2); /* He appears on the right of the screen... */ _vm->_trip.tr[2].walkto(4); /* ...and he walks up... */ } else { @@ -490,32 +490,32 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentroad: { - dnatype &with = _vm->_gyro.dna; + dnatype &with = _vm->_gyro->dna; if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && - (_vm->_gyro.dna.rooms[r__argentroad] > 3)) { + (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot again*/ _vm->_trip.apped(2, 1); _vm->_trip.tr[2].walkto(2); _vm->_trip.tr[2].vanishifstill = true; with.cwytalot_in_herts = true; - /*_vm->_gyro.whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ + /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ _vm->_timeout.set_up_timer(20, _vm->_timeout.proc_cwytalot_in_herts, _vm->_timeout.reason_cwytalot_in_herts); } } break; case r__bridge: { - if (_vm->_gyro.dna.drawbridge_open == 4) { /*open*/ + if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ _vm->_celer.show_one(3); /* Position of drawbridge */ - _vm->_gyro.magics[green].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } - if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ + if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ } break; case r__robins: { if (ped > 0) { - if (! _vm->_gyro.dna.been_tied_up) { + if (! _vm->_gyro->dna.been_tied_up) { /* A welcome party... or maybe not... */ _vm->_trip.tr[2].init(6, false, &_vm->_trip); _vm->_trip.apped(2, 2); @@ -524,22 +524,22 @@ void Lucerna::enterroom(byte x, byte ped) { } } - if (_vm->_gyro.dna.been_tied_up) { - _vm->_gyro.whereis[_vm->_gyro.probinhood] = 0; - _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = 0; + if (_vm->_gyro->dna.been_tied_up) { + _vm->_gyro->whereis[_vm->_gyro->probinhood] = 0; + _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 0; } - if (_vm->_gyro.dna.tied_up) + if (_vm->_gyro->dna.tied_up) _vm->_celer.show_one(2); - if (! _vm->_gyro.dna.mushroom_growing) + if (! _vm->_gyro->dna.mushroom_growing) _vm->_celer.show_one(3); } break; case r__outsidecardiffcastle: { if (ped > 0) - switch (_vm->_gyro.dna.cardiff_things) { + switch (_vm->_gyro->dna.cardiff_things) { case 0 : { /* You've answered NONE of his questions. */ _vm->_trip.tr[2].init(9, false, &_vm->_trip); _vm->_trip.apped(2, 2); @@ -548,7 +548,7 @@ void Lucerna::enterroom(byte x, byte ped) { } break; case 5 : - _vm->_gyro.magics[2].op = _vm->_gyro.nix; + _vm->_gyro->magics[2].op = _vm->_gyro->nix; break; /* You've answered ALL his questions. => nothing happens. */ default: { /* You've answered SOME of his questions. */ _vm->_trip.tr[2].init(9, false, &_vm->_trip); @@ -557,9 +557,9 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_timeout.set_up_timer(3, _vm->_timeout.proccardiff_return, _vm->_timeout.reason_cardiffsurvey); } } - if (_vm->_gyro.dna.cardiff_things < 5) - _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; - else _vm->_gyro.interrogation = 0; + if (_vm->_gyro->dna.cardiff_things < 5) + _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; + else _vm->_gyro->interrogation = 0; } break; @@ -574,9 +574,9 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentpub: { - if (_vm->_gyro.dna.wonnim) _vm->_celer.show_one(1); /* No lute by the settle. */ - _vm->_gyro.dna.malagauche = 0; /* Ready to boot Malagauche */ - if (_vm->_gyro.dna.givenbadgetoiby) { + if (_vm->_gyro->dna.wonnim) _vm->_celer.show_one(1); /* No lute by the settle. */ + _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ + if (_vm->_gyro->dna.givenbadgetoiby) { _vm->_celer.show_one(8); _vm->_celer.show_one(9); } @@ -584,27 +584,27 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__lustiesroom: { - _vm->_gyro.dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ if (_vm->_trip.tr[1].whichsprite == 0) /* Avvy in his normal clothes */ _vm->_timeout.set_up_timer(3, _vm->_timeout.proccallsguards, _vm->_timeout.reason_du_lustie_talks); - else if (! _vm->_gyro.dna.entered_lusties_room_as_monk) /*already*/ + else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ /* Presumably, Avvy dressed as a monk. */ _vm->_timeout.set_up_timer(3, _vm->_timeout.procgreetsmonk, _vm->_timeout.reason_du_lustie_talks); - if (_vm->_gyro.dna.geida_follows) { + if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); - if (_vm->_gyro.dna.lustie_is_asleep) _vm->_celer.show_one(5); + if (_vm->_gyro->dna.lustie_is_asleep) _vm->_celer.show_one(5); } } break; case r__musicroom: { - if (_vm->_gyro.dna.jacques_awake > 0) { - _vm->_gyro.dna.jacques_awake = 5; + if (_vm->_gyro->dna.jacques_awake > 0) { + _vm->_gyro->dna.jacques_awake = 5; _vm->_celer.show_one(2); _vm->_celer.show_one(4); - _vm->_gyro.magics[brown].op = _vm->_gyro.nix; - _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; + _vm->_gyro->magics[brown].op = _vm->_gyro->nix; + _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; } if (ped != 0) { _vm->_celer.show_one(6); @@ -636,7 +636,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__wisewomans: { _vm->_trip.tr[2].init(11, false, &_vm->_trip); - if ((_vm->_gyro.dna.rooms[r__wisewomans] == 1) && (ped > 0)) { + if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { _vm->_trip.apped(2, 2); /* Start on the right-hand side of the screen. */ _vm->_trip.tr[2].walkto(4); /* Walks up to greet you. */ } else { @@ -653,18 +653,18 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { _vm->_trip.tr[2].init(10, false, &_vm->_trip); /* Define the dart. */ _vm->_sequence.first_show(1); - if (_vm->_gyro.dna.arrow_in_the_door) + if (_vm->_gyro->dna.arrow_in_the_door) _vm->_sequence.then_show(3); else _vm->_sequence.then_show(2); - if (_vm->_gyro.dna.taken_pen) + if (_vm->_gyro->dna.taken_pen) _vm->_celer.show_one(4); _vm->_sequence.start_to_close(); } else { _vm->_celer.show_one(1); - if (_vm->_gyro.dna.arrow_in_the_door) _vm->_celer.show_one(3); + if (_vm->_gyro->dna.arrow_in_the_door) _vm->_celer.show_one(3); else _vm->_celer.show_one(2); } break; @@ -689,7 +689,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__aylesoffice: - if (_vm->_gyro.dna.ayles_is_awake) + if (_vm->_gyro->dna.ayles_is_awake) _vm->_celer.show_one(2); break; /* Ayles awake. */ @@ -699,16 +699,16 @@ void Lucerna::enterroom(byte x, byte ped) { case r__easthall: case r__westhall: - if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 2, ped); + if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 2, ped); break; case r__lusties: - if (_vm->_gyro.dna.geida_follows) put_geida_at(ped + 6, ped); + if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 6, ped); break; case r__nottspub: { - if (_vm->_gyro.dna.sitting_in_pub) _vm->_celer.show_one(3); - _vm->_gyro.dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer.show_one(3); + _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ } break; @@ -723,12 +723,12 @@ void Lucerna::enterroom(byte x, byte ped) { } break; case r__ducks: - _vm->_gyro.dna.dogfoodpos = 1; + _vm->_gyro->dna.dogfoodpos = 1; break; /* Actually, Duck pos. */ } - _vm->_gyro.seescroll = false; /* Now it can work again! */ + _vm->_gyro->seescroll = false; /* Now it can work again! */ } @@ -736,10 +736,10 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * const int16 picsize = 966; const bytefield thinkspace = {25, 170, 32, 200}; - _vm->_gyro.thinks = z; + _vm->_gyro->thinks = z; z--; - _vm->_gyro.wait(); + _vm->_gyro->wait(); if (th) { if (!f.open("thinks.avd")) { @@ -772,7 +772,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.close(); - _vm->_gyro.off(); + _vm->_gyro->off(); /*setactivepage(3); putimage(x, y, p, 0); @@ -781,8 +781,8 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * for (byte fv = 0; fv <= 1; fv ++) _vm->_trip.getset[fv].remember(thinkspace); - _vm->_gyro.on(); - _vm->_gyro.thinkthing = th; + _vm->_gyro->on(); + _vm->_gyro->thinkthing = th; } void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ @@ -795,13 +795,13 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ } for (byte fv = 0; fv < 10; fv ++) { - _vm->_gyro.digit[fv] = new byte[digitsize]; - f.read(_vm->_gyro.digit[fv], digitsize); + _vm->_gyro->digit[fv] = new byte[digitsize]; + f.read(_vm->_gyro->digit[fv], digitsize); } for (byte ff = 0; ff < 9; ff ++) { - _vm->_gyro.rwlite[ff] = new byte[rwlitesize]; - f.read(_vm->_gyro.rwlite[ff], rwlitesize); + _vm->_gyro->rwlite[ff] = new byte[rwlitesize]; + f.read(_vm->_gyro->rwlite[ff], rwlitesize); } f.close(); @@ -831,7 +831,7 @@ void Lucerna::toolbar() { /* on;*/ - _vm->_gyro.oldrw = 177; + _vm->_gyro->oldrw = 177; showrw(); } @@ -839,10 +839,10 @@ void Lucerna::showscore() { const bytefield scorespace = {33, 177, 39, 200}; - if (_vm->_gyro.demo) + if (_vm->_gyro->demo) return; - uint16 score = _vm->_gyro.dna.score; + uint16 score = _vm->_gyro->dna.score; int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { byte divisor = 1; @@ -853,27 +853,27 @@ void Lucerna::showscore() { } numbers[2] = score; - _vm->_gyro.off(); + _vm->_gyro->off(); //setactivepage(3); for (byte fv = 0; fv < 3; fv ++) - if (_vm->_gyro.lastscore[fv] != numbers[fv]) - _vm->_graphics->drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177); + if (_vm->_gyro->lastscore[fv] != numbers[fv]) + _vm->_graphics->drawPicture(_vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) _vm->_trip.getset[fv].remember(scorespace); //setactivepage(1 - cp); - _vm->_gyro.on(); + _vm->_gyro->on(); for (byte i = 0; i < 3; i++) - _vm->_gyro.lastscore[i] = numbers[i]; + _vm->_gyro->lastscore[i] = numbers[i]; } void Lucerna::points(byte num) { /* Add on no. of points */ for (byte q = 1; q <= num; q ++) { - _vm->_gyro.dna.score++; + _vm->_gyro->dna.score++; /*if (soundfx) for (byte fv = 1; fv <= 97; fv ++) sound(177 + dna.score * 3); @@ -881,13 +881,13 @@ void Lucerna::points(byte num) { /* Add on no. of points */ } warning("STUB: Lucerna::points()"); - _vm->_logger.log_score(num, _vm->_gyro.dna.score); + _vm->_logger.log_score(num, _vm->_gyro->dna.score); showscore(); } void Lucerna::topcheck() { /* Menuset */ - _vm->_dropdown.ddm_m.getmenu(_vm->_gyro.mpx); + _vm->_dropdown.ddm_m.getmenu(_vm->_gyro->mpx); /* Do this one */ } @@ -899,10 +899,10 @@ void Lucerna::inkey() { char r; - if (_vm->_gyro.demo) + if (_vm->_gyro->demo) return; /* Demo handles this itself. */ - if (_vm->_gyro.mousetext == "") { + if (_vm->_gyro->mousetext == "") { /* read keyboard */ _vm->_enhanced.readkeye(); if ((_vm->_enhanced.inchar == ' ') && ((_vm->_enhanced.shiftstate & 8) > 0)) { @@ -910,10 +910,10 @@ void Lucerna::inkey() { _vm->_enhanced.extd = '#'; /* alt-spacebar = alt-H */ } } else { - if (_vm->_gyro.mousetext[0] == '`') - _vm->_gyro.mousetext.setChar(13,0); /* Backquote = return in a macro */ - _vm->_enhanced.inchar = _vm->_gyro.mousetext[0]; - _vm->_gyro.mousetext = Common::String(_vm->_gyro.mousetext.c_str() + 2, 253); + if (_vm->_gyro->mousetext[0] == '`') + _vm->_gyro->mousetext.setChar(13,0); /* Backquote = return in a macro */ + _vm->_enhanced.inchar = _vm->_gyro->mousetext[0]; + _vm->_gyro->mousetext = Common::String(_vm->_gyro->mousetext.c_str() + 2, 253); } } @@ -926,34 +926,34 @@ void Lucerna::fxtoggle() { } void Lucerna::objectlist() { - _vm->_gyro.dna.carrying = 0; - if (_vm->_gyro.thinkthing && ! _vm->_gyro.dna.obj[_vm->_gyro.thinks]) - thinkabout(_vm->_gyro.money, _vm->_gyro.a_thing); /* you always have money */ + _vm->_gyro->dna.carrying = 0; + if (_vm->_gyro->thinkthing && ! _vm->_gyro->dna.obj[_vm->_gyro->thinks]) + thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); /* you always have money */ for (byte fv = 0; fv < numobjs; fv ++) - if (_vm->_gyro.dna.obj[fv]) { - _vm->_gyro.dna.carrying ++; - _vm->_gyro.objlist[_vm->_gyro.dna.carrying] = fv + 1; + if (_vm->_gyro->dna.obj[fv]) { + _vm->_gyro->dna.carrying ++; + _vm->_gyro->objlist[_vm->_gyro->dna.carrying] = fv + 1; } } void Lucerna::verte() { byte what; - if (! _vm->_gyro.dna.user_moves_avvy) + if (! _vm->_gyro->dna.user_moves_avvy) return; /* _vm->_trip.tr[0] : that's the only one we're interested in here */ - if (_vm->_gyro.mx < _vm->_trip.tr[0].x) + if (_vm->_gyro->mx < _vm->_trip.tr[0].x) what = 1; - else if (_vm->_gyro.mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0]._info.xl)) + else if (_vm->_gyro->mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0]._info.xl)) what = 2; else what = 0; /* On top */ - if (_vm->_gyro.my < _vm->_trip.tr[0].y) + if (_vm->_gyro->my < _vm->_trip.tr[0].y) what += 3; - else if (_vm->_gyro.my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0]._info.yl)) + else if (_vm->_gyro->my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0]._info.yl)) what += 6; switch (what) { @@ -994,7 +994,7 @@ void Lucerna::checkclick() { } void Lucerna::mouse_init() { - _vm->_gyro.wait(); + _vm->_gyro->wait(); } void Lucerna::mousepage(uint16 page_) { @@ -1042,19 +1042,19 @@ void Lucerna::dawn() { void Lucerna::showrw() { // It's data is loaded in load_digits(). - if (_vm->_gyro.oldrw == _vm->_gyro.dna.rw) + if (_vm->_gyro->oldrw == _vm->_gyro->dna.rw) return; - _vm->_gyro.oldrw = _vm->_gyro.dna.rw; - _vm->_gyro.off(); + _vm->_gyro->oldrw = _vm->_gyro->dna.rw; + _vm->_gyro->off(); /* for (byte page_ = 0; page_ <= 1; page_ ++) { setactivepage(page_); putimage(0, 161, rwlite[with.rw], 0); }*/ - _vm->_graphics->drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161); + _vm->_graphics->drawPicture(_vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); - _vm->_gyro.on(); + _vm->_gyro->on(); //setactivepage(1 - cp); warning("STUB: Lucerna::showrw()"); @@ -1207,21 +1207,21 @@ void Lucerna::flip_page() { void Lucerna::delavvy() { byte page_; - _vm->_gyro.off(); + _vm->_gyro->off(); triptype &with = _vm->_trip.tr[0]; for (page_ = 0; page_ <= 1; page_ ++) mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); blitfix(); - _vm->_gyro.on(); + _vm->_gyro->on(); } void Lucerna::gameover() { byte fv; int16 sx, sy; - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.user_moves_avvy = false; sx = _vm->_trip.tr[1].x; sy = _vm->_trip.tr[1].y; @@ -1233,7 +1233,7 @@ void Lucerna::gameover() { _vm->_timeout.set_up_timer(3, _vm->_timeout.procavalot_falls, _vm->_timeout.reason_falling_over); /* _vm->_scrolls.display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ - _vm->_gyro.alive = false; + _vm->_gyro->alive = false; } /* OK. There are two kinds of redraw: Major and Minor. Minor is what happens @@ -1243,15 +1243,15 @@ void Lucerna::minor_redraw() { byte fv; dusk(); - enterroom(_vm->_gyro.dna.room, 0); /* Ped unknown or non-existant. */ + enterroom(_vm->_gyro->dna.room, 0); /* Ped unknown or non-existant. */ for (fv = 0; fv <= 1; fv ++) { - _vm->_gyro.cp = 1 - _vm->_gyro.cp; + _vm->_gyro->cp = 1 - _vm->_gyro->cp; _vm->_trip.getback(); } for (byte i = 0; i < 3; i++) - _vm->_gyro.lastscore[i] = -1; /* impossible digits */ + _vm->_gyro->lastscore[i] = -1; /* impossible digits */ showscore(); dawn(); @@ -1267,7 +1267,7 @@ uint16 Lucerna::bearing(byte whichped) { uint16 bearing_result; { - pedtype &with = _vm->_gyro.peds[whichped]; + pedtype &with = _vm->_gyro->peds[whichped]; if (_vm->_trip.tr[1].x == with.x) bearing_result = 0; /* This would cause a division by zero if we let it through. */ else { @@ -1290,7 +1290,7 @@ void Lucerna::sprite_run() { make the sprites the same on both pages. */ byte fv; - _vm->_gyro.doing_sprite_run = true; + _vm->_gyro->doing_sprite_run = true; for (fv = 0; fv <= 1; fv ++) { _vm->_trip.get_back_loretta(); @@ -1299,13 +1299,13 @@ void Lucerna::sprite_run() { flip_page(); } - _vm->_gyro.doing_sprite_run = false; + _vm->_gyro->doing_sprite_run = false; } void Lucerna::fix_flashers() { - _vm->_gyro.ledstatus = 177; - _vm->_gyro.oldrw = 177; + _vm->_gyro->ledstatus = 177; + _vm->_gyro->oldrw = 177; _vm->_scrolls.state(2); showrw(); } diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 7a468d4e4199..1f7c35eea660 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -136,7 +136,7 @@ void Pingo::winning_pic() { _vm->_lucerna.dawn(); /*do { - _vm->_gyro.check(); + _vm->_gyro->check(); } while (!(keypressed() || (mrelease > 0))); while (keypressed()) r = readkey(); major_redraw();*/ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 35ae4fc4010b..b0563c68a199 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -59,7 +59,7 @@ void Scrolls::init() { void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ byte page_; - if (_vm->_gyro.ledstatus == x) + if (_vm->_gyro->ledstatus == x) return; /* Already like that! */ byte color; @@ -90,12 +90,12 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ //} warning("STUB: Scrolls::state()"); - _vm->_gyro.super_off(); + _vm->_gyro->super_off(); _vm->_graphics->drawBar(419, 195, 438, 197, color); - _vm->_gyro.super_on(); - _vm->_gyro.ledstatus = x; + _vm->_gyro->super_on(); + _vm->_gyro->ledstatus = x; } void Scrolls::easteregg() { @@ -130,7 +130,7 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != _vm->_gyro.tune[fv]) { + if (played[fv] != _vm->_gyro->tune[fv]) { mistakes += 1; } @@ -144,32 +144,32 @@ void Scrolls::music_scroll() { /* ThatsAll, so put us back to */ /*$F-*/ void Scrolls::resetscrolldriver() { /* phew */ - _vm->_gyro.scrollbells = 0; + _vm->_gyro->scrollbells = 0; cfont = roman; _vm->_logger.log_epsonroman(); use_icon = 0; - _vm->_gyro.interrogation = 0; /* always reset after a scroll comes up. */ + _vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */ } void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ byte fv; - for (fv = 1; fv <= _vm->_gyro.scrollbells; fv ++) _vm->_lucerna.errorled(); /* ring the bell "x" times */ + for (fv = 1; fv <= _vm->_gyro->scrollbells; fv ++) _vm->_lucerna.errorled(); /* ring the bell "x" times */ } void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */ - _vm->_gyro.xycheck(); /* Mx & my now contain xy pos of mouse */ - dodgex = _vm->_gyro.mx; - dodgey = _vm->_gyro.my; /* Store 'em */ - _vm->_gyro.hopto(dodgex, _vm->_gyro.underscroll); /* Move the pointer off the scroll. */ + _vm->_gyro->xycheck(); /* Mx & my now contain xy pos of mouse */ + dodgex = _vm->_gyro->mx; + dodgey = _vm->_gyro->my; /* Store 'em */ + _vm->_gyro->hopto(dodgex, _vm->_gyro->underscroll); /* Move the pointer off the scroll. */ } void Scrolls::undodgem() { /* This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. */ - _vm->_gyro.xycheck(); - if ((_vm->_gyro.mx == dodgex) && (_vm->_gyro.my == _vm->_gyro.underscroll)) + _vm->_gyro->xycheck(); + if ((_vm->_gyro->mx == dodgex) && (_vm->_gyro->my == _vm->_gyro->underscroll)) /* No change, so restore the pointer's original position. */ - _vm->_gyro.hopto(dodgex, dodgey); + _vm->_gyro->hopto(dodgex, dodgey); } void Scrolls::geticon(int16 x, int16 y, byte which) { @@ -200,7 +200,7 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { int16 fv; uint16 st; - st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro.cp) * _vm->_gyro.pagetop); + st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); Common::String filename; filename = filename.format("%s.avd", fn.c_str()); @@ -237,35 +237,35 @@ bool Scrolls::ask(Common::String question) { } void Scrolls::resetscroll() { - _vm->_gyro.scrolln = 1; + _vm->_gyro->scrolln = 1; for (int j = 0; j < 15; j ++) - for (int i = 0; i < _vm->_gyro.scroll[j].size(); i++) - _vm->_gyro.scroll[j].setChar(0, i); + for (int i = 0; i < _vm->_gyro->scroll[j].size(); i++) + _vm->_gyro->scroll[j].setChar(0, i); } void Scrolls::natural() { /* Natural state of bubbles */ - _vm->_gyro.talkx = 320; - _vm->_gyro.talky = 200; - _vm->_gyro.talkb = 8; - _vm->_gyro.talkf = 15; + _vm->_gyro->talkx = 320; + _vm->_gyro->talky = 200; + _vm->_gyro->talkb = 8; + _vm->_gyro->talkf = 15; } Common::String Scrolls::lsd() { Common::String x; Common::String lsd_result; - if (_vm->_gyro.dna.pence < 12) { + if (_vm->_gyro->dna.pence < 12) { /* just pence */ - x = _vm->_gyro.strf(_vm->_gyro.dna.pence) + 'd'; - } else if (_vm->_gyro.dna.pence < 240) { + x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd'; + } else if (_vm->_gyro->dna.pence < 240) { /* shillings & pence */ - x = _vm->_gyro.strf(_vm->_gyro.dna.pence / int32(12)) + '/'; - if ((_vm->_gyro.dna.pence % int32(12)) == 0) x = x + '-'; - else x = x + _vm->_gyro.strf(_vm->_gyro.dna.pence % int32(12)); + x = _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(12)) + '/'; + if ((_vm->_gyro->dna.pence % int32(12)) == 0) x = x + '-'; + else x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12)); } else /* L, s & d */ - x = Common::String('') + _vm->_gyro.strf(_vm->_gyro.dna.pence / int32(240)) + '.' + _vm->_gyro.strf((_vm->_gyro.dna.pence / int32(12)) % int32(20)) - + '.' + _vm->_gyro.strf(_vm->_gyro.dna.pence % int32(12)); - if (_vm->_gyro.dna.pence > 12) x = x + " (that's " + _vm->_gyro.strf(_vm->_gyro.dna.pence) + "d)"; + x = Common::String('') + _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(240)) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / int32(12)) % int32(20)) + + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12)); + if (_vm->_gyro->dna.pence > 12) x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)"; lsd_result = x; return lsd_result; } @@ -286,8 +286,8 @@ void Scrolls::calldrivers() { } void Scrolls::display(Common::String z) { - _vm->_gyro.bufsize = z.size(); - memcpy(_vm->_gyro.buffer, z.c_str() + 1, _vm->_gyro.bufsize); + _vm->_gyro->bufsize = z.size(); + memcpy(_vm->_gyro->buffer, z.c_str() + 1, _vm->_gyro->bufsize); calldrivers(); } @@ -315,7 +315,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(_vm->_gyro.little[i],16); + f.read(_vm->_gyro->little[i],16); f.close(); } @@ -331,15 +331,15 @@ void Scrolls::musical_scroll() { _vm->_lucerna.sprite_run(); - was_virtual = _vm->_gyro.visible == _vm->_gyro.m_virtual; + was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; if (was_virtual) - _vm->_gyro.off_virtual(); + _vm->_gyro->off_virtual(); drawscroll(&Avalanche::Scrolls::music_scroll); if (was_virtual) - _vm->_gyro.on_virtual(); + _vm->_gyro->on_virtual(); resetscroll(); } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index f3ba72ad62d6..61198d297a18 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -66,8 +66,8 @@ void Sequence::then_show(byte what) { void Sequence::then_flip(byte where, byte ped) { then_show(now_flip); - _vm->_gyro.dna.flip_to_where = where; - _vm->_gyro.dna.flip_to_ped = ped; + _vm->_gyro->dna.flip_to_where = where; + _vm->_gyro->dna.flip_to_ped = ped; } void Sequence::start_to_close() { @@ -76,7 +76,7 @@ void Sequence::start_to_close() { } void Sequence::start_to_open() { - _vm->_gyro.dna.user_moves_avvy = false; /* They can't move. */ + _vm->_gyro->dna.user_moves_avvy = false; /* They can't move. */ _vm->_trip.stopwalking(); /* And they're not moving now. */ start_to_close(); /* Apart from that, it's the same thing. */ } @@ -94,8 +94,8 @@ void Sequence::call_sequencer() { return; break; /* No more routines. */ case 177: - _vm->_gyro.dna.user_moves_avvy = true; - _vm->_trip.fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ + _vm->_gyro->dna.user_moves_avvy = true; + _vm->_trip.fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); /* 177 = Flip room. */ if (seq[0] == 177) shove_left(); break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 623bb75e30c9..b10c1c18d612 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -73,7 +73,7 @@ void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { } void Timeout::one_tick() { - if (_vm->_gyro.ddmnow) + if (_vm->_gyro->ddmnow) return; for (fv = 1; fv <= 7; fv++) { @@ -210,8 +210,8 @@ void Timeout::one_tick() { } } } - _vm->_gyro.roomtime += 1; /* Cycles since you've been in this room. */ - _vm->_gyro.dna.total_time += 1; /* Total amount of time for this game. */ + _vm->_gyro->roomtime += 1; /* Cycles since you've been in this room. */ + _vm->_gyro->dna.total_time += 1; /* Total amount of time for this game. */ } void Timeout::lose_timer(byte which) { @@ -240,11 +240,11 @@ end;*/ /* Timeout procedures: */ void Timeout::open_drawbridge() { - _vm->_gyro.dna.drawbridge_open++; - _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); + _vm->_gyro->dna.drawbridge_open++; + _vm->_celer.show_one(_vm->_gyro->dna.drawbridge_open - 1); - if (_vm->_gyro.dna.drawbridge_open == 4) - _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + if (_vm->_gyro->dna.drawbridge_open == 4) + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } @@ -252,10 +252,10 @@ void Timeout::open_drawbridge() { /* --- */ void Timeout::avaricius_talks() { - _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); - _vm->_gyro.dna.avaricius_talk++; + _vm->_visa.dixi('q', _vm->_gyro->dna.avaricius_talk); + _vm->_gyro->dna.avaricius_talk++; - if (_vm->_gyro.dna.avaricius_talk < 17) + if (_vm->_gyro->dna.avaricius_talk < 17) set_up_timer(177, procavaricius_talks, reason_avariciustalks); else _vm->_lucerna.points(3); @@ -282,25 +282,25 @@ void Timeout::bang2() { } void Timeout::stairs() { - _vm->_gyro.blip(); + _vm->_gyro->blip(); _vm->_trip.tr[0].walkto(4); _vm->_celer.show_one(2); - _vm->_gyro.dna.brummie_stairs = 2; - _vm->_gyro.magics[11].op = _vm->_gyro.special; - _vm->_gyro.magics[11].data = 2; /* Reached the bottom of the stairs. */ - _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* Stop them hitting the sides (or the game will hang.) */ + _vm->_gyro->dna.brummie_stairs = 2; + _vm->_gyro->magics[11].op = _vm->_gyro->special; + _vm->_gyro->magics[11].data = 2; /* Reached the bottom of the stairs. */ + _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Stop them hitting the sides (or the game will hang.) */ } void Timeout::cardiff_survey() { - switch (_vm->_gyro.dna.cardiff_things) { + switch (_vm->_gyro->dna.cardiff_things) { case 0: - _vm->_gyro.dna.cardiff_things += 1; + _vm->_gyro->dna.cardiff_things += 1; _vm->_visa.dixi('q', 27); break; } - _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); + _vm->_visa.dixi('z', _vm->_gyro->dna.cardiff_things); - _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; + _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } @@ -315,8 +315,8 @@ void Timeout::cwytalot_in_herts() { void Timeout::get_tied_up() { _vm->_visa.dixi('q', 34); /* ...Trouble! */ - _vm->_gyro.dna.user_moves_avvy = false; - _vm->_gyro.dna.been_tied_up = true; + _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->dna.been_tied_up = true; _vm->_trip.stopwalking(); _vm->_trip.tr[2].stopwalk(); _vm->_trip.tr[2].stophoming(); @@ -328,14 +328,14 @@ void Timeout::get_tied_up() { void Timeout::get_tied_up2() { _vm->_trip.tr[1].walkto(4); _vm->_trip.tr[2].walkto(5); - _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* No effect when you touch the boundaries. */ - _vm->_gyro.dna.friar_will_tie_you_up = true; + _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* No effect when you touch the boundaries. */ + _vm->_gyro->dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { _vm->_trip.tr[2].check_me = false; _vm->_trip.tr[1].init(7, true, &_vm->_trip); /* Robin Hood */ - _vm->_gyro.whereis[_vm->_gyro.probinhood] = r__robins; + _vm->_gyro->whereis[_vm->_gyro->probinhood] = r__robins; _vm->_trip.apped(1, 2); _vm->_visa.dixi('q', 39); _vm->_trip.tr[1].walkto(7); @@ -346,7 +346,7 @@ void Timeout::hang_around2() { _vm->_visa.dixi('q', 40); _vm->_trip.tr[2].vanishifstill = false; _vm->_trip.tr[2].walkto(4); - _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = r__robins; + _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = r__robins; _vm->_visa.dixi('q', 41); _vm->_trip.tr[1].done(); _vm->_trip.tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ @@ -354,7 +354,7 @@ void Timeout::hang_around2() { set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately call the following proc (when you have a chance). */ - _vm->_gyro.dna.tied_up = false; + _vm->_gyro->dna.tied_up = false; _vm->_enid.back_to_bootstrap(1); /* Call the shoot-'em-up. */ } @@ -364,9 +364,9 @@ void Timeout::after_the_shootemup() { } void Timeout::jacques_wakes_up() { - _vm->_gyro.dna.jacques_awake += 1; + _vm->_gyro->dna.jacques_awake += 1; - switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */ + switch (_vm->_gyro->dna.jacques_awake) { /* Additional pictures. */ case 1 : _vm->_celer.show_one(1); /* Eyes open. */ _vm->_visa.dixi('Q', 45); @@ -374,23 +374,23 @@ void Timeout::jacques_wakes_up() { case 2 : /* Going through the door. */ _vm->_celer.show_one(2); /* Not on the floor. */ _vm->_celer.show_one(3); /* But going through the door. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* You can't wake him up now. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* You can't wake him up now. */ break; case 3 : /* Gone through the door. */ _vm->_celer.show_one(2); /* Not on the floor, either. */ _vm->_celer.show_one(4); /* He's gone... so the door's open. */ - _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; /* Gone! */ + _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; /* Gone! */ break; } - if (_vm->_gyro.dna.jacques_awake == 5) { - _vm->_gyro.dna.ringing_bells = true; - _vm->_gyro.dna.ayles_is_awake = true; + if (_vm->_gyro->dna.jacques_awake == 5) { + _vm->_gyro->dna.ringing_bells = true; + _vm->_gyro->dna.ayles_is_awake = true; _vm->_lucerna.points(2); } - switch (_vm->_gyro.dna.jacques_awake) { + switch (_vm->_gyro->dna.jacques_awake) { case 1: case 2: case 3: @@ -431,7 +431,7 @@ void Timeout::naughty_duke3() { } void Timeout::jump() { - dnatype &with = _vm->_gyro.dna; + dnatype &with = _vm->_gyro->dna; with.jumpstatus += 1; @@ -457,24 +457,24 @@ void Timeout::jump() { if (with.jumpstatus == 20) { /* End of jump. */ - _vm->_gyro.dna.user_moves_avvy = true; - _vm->_gyro.dna.jumpstatus = 0; + _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->dna.jumpstatus = 0; } else { /* Still jumping. */ set_up_timer(1, procjump, reason_jumping); } if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ - && (_vm->_gyro.dna.room == r__insidecardiffcastle) - && (_vm->_gyro.dna.arrow_in_the_door == true) + && (_vm->_gyro->dna.room == r__insidecardiffcastle) + && (_vm->_gyro->dna.arrow_in_the_door == true) && (_vm->_trip.infield(3))) { /* beside the wall*/ /* Grab the arrow! */ - if (_vm->_gyro.dna.carrying >= maxobjs) + if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls.display("You fail to grab it, because your hands are full."); else { _vm->_celer.show_one(2); - _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ - _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; + _vm->_gyro->dna.arrow_in_the_door = false; /* You've got it. */ + _vm->_gyro->dna.obj[_vm->_gyro->bolt] = true; _vm->_lucerna.objectlist(); _vm->_visa.dixi('q', 50); _vm->_lucerna.points(3); @@ -484,32 +484,32 @@ void Timeout::jump() { void Timeout::crapulus_says_splud_out() { _vm->_visa.dixi('q', 56); - _vm->_gyro.dna.crapulus_will_tell = false; + _vm->_gyro->dna.crapulus_will_tell = false; } void Timeout::buydrinks() { _vm->_celer.show_one(11); /* Malagauche gets up again. */ - _vm->_gyro.dna.malagauche = 0; + _vm->_gyro->dna.malagauche = 0; - _vm->_visa.dixi('D', _vm->_gyro.dna.drinking); /* _vm->_scrolls.display message about it. */ + _vm->_visa.dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls.display message about it. */ _vm->_pingo.wobble(); /* Do the special effects. */ _vm->_visa.dixi('D', 1); /* That'll be thruppence. */ - if (_vm->_gyro.pennycheck(3)) /* Pay 3d. */ + if (_vm->_gyro->pennycheck(3)) /* Pay 3d. */ _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */ _vm->_acci.have_a_drink(); } void Timeout::buywine() { _vm->_celer.show_one(11); /* Malagauche gets up again. */ - _vm->_gyro.dna.malagauche = 0; + _vm->_gyro->dna.malagauche = 0; _vm->_visa.dixi('D', 50); /* You buy the wine. */ _vm->_visa.dixi('D', 1); /* It'll be thruppence. */ - if (_vm->_gyro.pennycheck(3)) { + if (_vm->_gyro->pennycheck(3)) { _vm->_visa.dixi('D', 4); /* You paid up. */ - _vm->_gyro.dna.obj[_vm->_gyro.wine] = true; + _vm->_gyro->dna.obj[_vm->_gyro->wine] = true; _vm->_lucerna.objectlist(); - _vm->_gyro.dna.winestate = 1; /* OK Wine */ + _vm->_gyro->dna.winestate = 1; /* OK Wine */ } } @@ -520,23 +520,23 @@ void Timeout::callsguards() { void Timeout::greetsmonk() { _vm->_visa.dixi('Q', 59); - _vm->_gyro.dna.entered_lusties_room_as_monk = true; + _vm->_gyro->dna.entered_lusties_room_as_monk = true; } void Timeout::fall_down_oubliette() { - _vm->_gyro.magics[9].op = _vm->_gyro.nix; + _vm->_gyro->magics[9].op = _vm->_gyro->nix; _vm->_trip.tr[1].iy += 1; /* increments dx/dy! */ _vm->_trip.tr[1].y += _vm->_trip.tr[1].iy; /* Dowwwn we go... */ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } void Timeout::meet_avaroid() { - if (_vm->_gyro.dna.met_avaroid) { + if (_vm->_gyro->dna.met_avaroid) { _vm->_scrolls.display("You can't expect to be \6that\22 lucky twice in a row!"); _vm->_lucerna.gameover(); } else { _vm->_visa.dixi('Q', 60); - _vm->_gyro.dna.met_avaroid = true; + _vm->_gyro->dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); triptype &with = _vm->_trip.tr[1]; @@ -545,7 +545,7 @@ void Timeout::meet_avaroid() { with.ix = -3; with.iy = -5; - _vm->_gyro.background(2); + _vm->_gyro->background(2); } } @@ -558,7 +558,7 @@ void Timeout::rise_up_oubliette() { if (with.iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else - _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro->dna.user_moves_avvy = true; } void Timeout::robin_hood_and_geida() { @@ -568,7 +568,7 @@ void Timeout::robin_hood_and_geida() { _vm->_trip.tr[2].stopwalk(); _vm->_trip.tr[2].face = _vm->_trip.left; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); - _vm->_gyro.dna.geida_follows = false; + _vm->_gyro->dna.geida_follows = false; } void Timeout::robin_hood_and_geida_talk() { @@ -586,7 +586,7 @@ void Timeout::avalot_returns() { _vm->_trip.tr[1].init(0, true, &_vm->_trip); _vm->_trip.apped(1, 1); _vm->_visa.dixi('q', 67); - _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro->dna.user_moves_avvy = true; } void Timeout::avvy_sit_down() { @@ -596,8 +596,8 @@ void Timeout::avvy_sit_down() { set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer.show_one(3); - _vm->_gyro.dna.sitting_in_pub = true; - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.sitting_in_pub = true; + _vm->_gyro->dna.user_moves_avvy = false; _vm->_trip.tr[1].visible = false; } } @@ -607,7 +607,7 @@ void Timeout::ghost_room_phew() { } void Timeout::arkata_shouts() { - if (_vm->_gyro.dna.teetotal) + if (_vm->_gyro->dna.teetotal) return; _vm->_visa.dixi('q', 76); @@ -620,10 +620,10 @@ void Timeout::winning() { do { _vm->_lucerna.checkclick(); - } while (!(_vm->_gyro.mrelease == 0)); + } while (!(_vm->_gyro->mrelease == 0)); _vm->_lucerna.callverb(_vm->_acci.vb_score); _vm->_scrolls.display(" T H E E N D "); - _vm->_gyro.lmo = true; + _vm->_gyro->lmo = true; } void Timeout::avalot_falls() { @@ -648,7 +648,7 @@ void Timeout::spludwick_leaves_cauldron() { void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ _vm->_visa.dixi('Q', 86); _vm->_lucerna.points(4); - _vm->_gyro.dna.lustie_is_asleep = true; + _vm->_gyro->dna.lustie_is_asleep = true; _vm->_sequence.first_show(5); _vm->_sequence.then_show(6); /* He falls asleep... */ _vm->_sequence.start_to_close(); /* Not really closing, but we're using the same procedure. */ diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f9e8faa1e2a3..00fac658abbc 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -166,8 +166,8 @@ void triptype::turn(byte whichway) { void triptype::appear(int16 wx, int16 wy, byte wf) { x = (wx / 8) * 8; y = wy; - ox[_tr->_vm->_gyro.cp] = wx; - oy[_tr->_vm->_gyro.cp] = wy; + ox[_tr->_vm->_gyro->cp] = wx; + oy[_tr->_vm->_gyro->cp] = wy; turn(wf); visible = true; ix = 0; @@ -199,12 +199,12 @@ void triptype::walk() { r.x2 = ((x + _info.xl) / 8) + 1; r.y2 = y + _info.yl + 2; } - _tr->getset[1 - _tr->_vm->_gyro.cp].remember(r); + _tr->getset[1 - _tr->_vm->_gyro->cp].remember(r); } - if (!_tr->_vm->_gyro.doing_sprite_run) { - ox[_tr->_vm->_gyro.cp] = x; - oy[_tr->_vm->_gyro.cp] = y; + if (!_tr->_vm->_gyro->doing_sprite_run) { + ox[_tr->_vm->_gyro->cp] = x; + oy[_tr->_vm->_gyro->cp] = y; if (homing) homestep(); x = x + ix; y = y + iy; @@ -216,38 +216,38 @@ void triptype::walk() { return; } - tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro.cp], y, _info.yl); + tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl); - if ((tc != 0) & (!_tr->_vm->_gyro.doing_sprite_run)) { - switch (_tr->_vm->_gyro.magics[tc].op) { - case _tr->_vm->_gyro.exclaim: { + if ((tc != 0) & (!_tr->_vm->_gyro->doing_sprite_run)) { + switch (_tr->_vm->_gyro->magics[tc].op) { + case _tr->_vm->_gyro->exclaim: { bounce(); _tr->mustexclaim = true; - _tr->saywhat = _tr->_vm->_gyro.magics[tc].data; + _tr->saywhat = _tr->_vm->_gyro->magics[tc].data; } break; - case _tr->_vm->_gyro.bounces: + case _tr->_vm->_gyro->bounces: bounce(); break; - case _tr->_vm->_gyro.transport: - _tr->fliproom(_tr->_vm->_gyro.magics[tc].data >> 8, _tr->_vm->_gyro.magics[tc].data & 0xff); + case _tr->_vm->_gyro->transport: + _tr->fliproom(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff); break; - case _tr->_vm->_gyro.unfinished: { + case _tr->_vm->_gyro->unfinished: { bounce(); _tr->_vm->_scrolls.display("\7Sorry.\3\rThis place is not available yet!"); } break; - case _tr->_vm->_gyro.special: - _tr->call_special(_tr->_vm->_gyro.magics[tc].data); + case _tr->_vm->_gyro->special: + _tr->call_special(_tr->_vm->_gyro->magics[tc].data); break; - case _tr->_vm->_gyro.mopendoor: - _tr->open_the_door(_tr->_vm->_gyro.magics[tc].data >> 8, _tr->_vm->_gyro.magics[tc].data & 0xff, tc); + case _tr->_vm->_gyro->mopendoor: + _tr->open_the_door(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff, tc); break; } } } - if (!_tr->_vm->_gyro.doing_sprite_run) { + if (!_tr->_vm->_gyro->doing_sprite_run) { count += 1; if (((ix != 0) || (iy != 0)) && (count > 1)) { step += 1; @@ -258,15 +258,15 @@ void triptype::walk() { } void triptype::bounce() { - x = ox[_tr->_vm->_gyro.cp]; - y = oy[_tr->_vm->_gyro.cp]; + x = ox[_tr->_vm->_gyro->cp]; + y = oy[_tr->_vm->_gyro->cp]; if (check_me) _tr->stopwalking(); else stopwalk(); - _tr->_vm->_gyro.oncandopageswap = false; + _tr->_vm->_gyro->oncandopageswap = false; _tr->_vm->_lucerna.showrw(); - _tr->_vm->_gyro.oncandopageswap = true; + _tr->_vm->_gyro->oncandopageswap = true; } int8 triptype::sgn(int16 x) { @@ -281,9 +281,9 @@ int8 triptype::sgn(int16 x) { } void triptype::walkto(byte pednum) { - speed(sgn(_tr->_vm->_gyro.peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro.peds[pednum].y - y)); - hx = _tr->_vm->_gyro.peds[pednum].x - _info.xl / 2; - hy = _tr->_vm->_gyro.peds[pednum].y - _info.yl; + speed(sgn(_tr->_vm->_gyro->peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro->peds[pednum].y - y)); + hx = _tr->_vm->_gyro->peds[pednum].x - _info.xl / 2; + hy = _tr->_vm->_gyro->peds[pednum].y - _info.yl; homing = true; } @@ -347,10 +347,10 @@ void triptype::stopwalk() { } void triptype::chatter() { - _tr->_vm->_gyro.talkx = x + _info.xl / 2; - _tr->_vm->_gyro.talky = y; - _tr->_vm->_gyro.talkf = a.fgc; - _tr->_vm->_gyro.talkb = a.bgc; + _tr->_vm->_gyro->talkx = x + _info.xl / 2; + _tr->_vm->_gyro->talky = y; + _tr->_vm->_gyro->talkf = a.fgc; + _tr->_vm->_gyro->talkb = a.bgc; } void triptype::set_up_saver(trip_saver_type &v) { @@ -535,8 +535,8 @@ void Trip::catamove(byte ped) { - xy_uint16 = _vm->_gyro.dna.cat_x + _vm->_gyro.dna.cat_y * 256; - _vm->_gyro.dna.geida_spin = 0; + xy_uint16 = _vm->_gyro->dna.cat_x + _vm->_gyro->dna.cat_y * 256; + _vm->_gyro->dna.geida_spin = 0; switch (xy_uint16) { case 1801: /* Exit catacombs */ @@ -553,78 +553,78 @@ void Trip::catamove(byte ped) { case 2307: fliproom(r__lusties, 5); _vm->_scrolls.display("Oh no... here we go again..."); - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.user_moves_avvy = false; tr[1].iy = 1; tr[1].ix = 0; return; } - if (!_vm->_gyro.dna.enter_catacombs_from_lusties_room) + if (!_vm->_gyro->dna.enter_catacombs_from_lusties_room) _vm->_lucerna.load(29); - here = _vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x]; + here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x]; switch (here & 0xf) { /* West. */ case 0: /* no connection (wall) */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(28); break; case 0x1: /* no connection (wall + shield), */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(29); /* ...shield. */ break; case 0x2: /* wall with door */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door. */ break; case 0x3: /* wall with door and shield */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(5); /* ...window. */ break; case 0x5: /* wall with door and window */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* No door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* No door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ - _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ - _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* Sloping wall. */ - _vm->_gyro.magics[3].op = _vm->_gyro.special; /* Straight wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Sloping wall. */ + _vm->_gyro->magics[3].op = _vm->_gyro->special; /* Straight wall. */ break; } @@ -632,52 +632,52 @@ void Trip::catamove(byte ped) { switch ((here & 0xf0) >> 4) { /* East */ case 0: /* no connection (wall) */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(19); break; case 0x1: /* no connection (wall + window), */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...window. */ break; case 0x2: /* wall with door */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door. */ break; case 0x3: /* wall with door and window */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...door, and... */ _vm->_celer.show_one(21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* No door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* No door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ - _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door, and... */ _vm->_celer.show_one(18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ - _vm->_gyro.magics[5].op = _vm->_gyro.nix; /* Sloping wall. */ - _vm->_gyro.magics[6].op = _vm->_gyro.special; /* Straight wall. */ - _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Sloping wall. */ + _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Straight wall. */ + _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ break; } @@ -685,75 +685,75 @@ void Trip::catamove(byte ped) { switch ((here & 0xf00) >> 8) { /* South */ case 0: /* No connection. */ - _vm->_gyro.magics[7].op = _vm->_gyro.bounces; - _vm->_gyro.magics[12].op = _vm->_gyro.bounces; - _vm->_gyro.magics[13].op = _vm->_gyro.bounces; + _vm->_gyro->magics[7].op = _vm->_gyro->bounces; + _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x1: _vm->_celer.show_one(22); - if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows)) - _vm->_gyro.magics[13].op = _vm->_gyro.exclaim; + if ((xy_uint16 == 2051) & (_vm->_gyro->dna.geida_follows)) + _vm->_gyro->magics[13].op = _vm->_gyro->exclaim; else - _vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */ + _vm->_gyro->magics[13].op = _vm->_gyro->special; /* Right exit south. */ - _vm->_gyro.magics[7].op = _vm->_gyro.bounces; - _vm->_gyro.magics[12].op = _vm->_gyro.bounces; + _vm->_gyro->magics[7].op = _vm->_gyro->bounces; + _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x2: _vm->_celer.show_one(23); - _vm->_gyro.magics[7].op = _vm->_gyro.special; /* Middle exit south. */ - _vm->_gyro.magics[12].op = _vm->_gyro.bounces; - _vm->_gyro.magics[13].op = _vm->_gyro.bounces; + _vm->_gyro->magics[7].op = _vm->_gyro->special; /* Middle exit south. */ + _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x3: _vm->_celer.show_one(24); - _vm->_gyro.magics[12].op = _vm->_gyro.special; /* Left exit south. */ - _vm->_gyro.magics[7].op = _vm->_gyro.bounces; - _vm->_gyro.magics[13].op = _vm->_gyro.bounces; + _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Left exit south. */ + _vm->_gyro->magics[7].op = _vm->_gyro->bounces; + _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; } switch ((here & 0xf000) >> 12) { /* North */ case 0: /* No connection */ - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; - _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; + _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ break; // LEFT handles: /* case 0x1: _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x2: _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // Middle exit north. - _vm->_gyro.portals[12].op = _vm->_gyro.special; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Middle exit north. + _vm->_gyro->portals[12].op = _vm->_gyro->special; // Door. break; /* case 0x3: _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } { Change magic number! } - _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; // RIGHT handles: case 0x4: _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x5: _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ - _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Middle exit north. */ + _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ break; /* case 0x6: _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } - _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ // ARCHWAYS: @@ -767,26 +767,26 @@ void Trip::catamove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer.show_one(32); - _vm->_gyro.magics[1].op = _vm->_gyro.special; /* Middle arch north. */ - _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->special; /* Middle arch north. */ + _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ } break; /* DECORATIONS: */ case 0xd: /* No connection + WINDOW */ - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; - _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; + _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(14); break; case 0xe: /* No connection + TORCH */ - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; - _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; + _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ _vm->_celer.show_one(8); break; /* Recessed door: */ case 0xf: - _vm->_gyro.magics[1].op = _vm->_gyro.nix; /* Door to Geida's room. */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Door to Geida's room. */ _vm->_celer.show_one(1); - _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ + _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ break; } @@ -822,7 +822,7 @@ void Trip::catamove(byte ped) { break; /* [1,1] : the other two. */ } - if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) { + if ((_vm->_gyro->dna.geida_follows) & (ped > 0)) { triptype &with = tr[2]; if (!with.quick) /* If we don't already have her... */ @@ -835,36 +835,36 @@ void Trip::catamove(byte ped) { -/* This proc gets called whenever you touch a line defined as _vm->_gyro.special. */ +/* This proc gets called whenever you touch a line defined as _vm->_gyro->special. */ void Trip::dawndelay() { _vm->_timeout.set_up_timer(2, _vm->_timeout.procdawn_delay, _vm->_timeout.reason_dawndelay); } void Trip::call_special(uint16 which) { switch (which) { - case 1: /* _vm->_gyro.special 1: Room 22: top of stairs. */ + case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ _vm->_celer.show_one(1); - _vm->_gyro.dna.brummie_stairs = 1; - _vm->_gyro.magics[10].op = _vm->_gyro.nix; + _vm->_gyro->dna.brummie_stairs = 1; + _vm->_gyro->magics[10].op = _vm->_gyro->nix; _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); stopwalking(); - _vm->_gyro.dna.user_moves_avvy = false; - break; - case 2: /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ - _vm->_gyro.dna.brummie_stairs = 3; - _vm->_gyro.magics[11].op = _vm->_gyro.nix; - _vm->_gyro.magics[12].op = _vm->_gyro.exclaim; - _vm->_gyro.magics[12].data = 5; - _vm->_gyro.magics[4].op = _vm->_gyro.bounces; /* Now works as planned! */ + _vm->_gyro->dna.user_moves_avvy = false; + break; + case 2: /* _vm->_gyro->special 2: Room 22: bottom of stairs. */ + _vm->_gyro->dna.brummie_stairs = 3; + _vm->_gyro->magics[11].op = _vm->_gyro->nix; + _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; + _vm->_gyro->magics[12].data = 5; + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Now works as planned! */ stopwalking(); _vm->_visa.dixi('q', 26); - _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro->dna.user_moves_avvy = true; break; - case 3: /* _vm->_gyro.special 3: Room 71: triggers dart. */ + case 3: /* _vm->_gyro->special 3: Room 71: triggers dart. */ tr[1].bounce(); /* Must include that. */ - if (!_vm->_gyro.dna.arrow_triggered) { - _vm->_gyro.dna.arrow_triggered = true; + if (!_vm->_gyro->dna.arrow_triggered) { + _vm->_gyro->dna.arrow_triggered = true; apped(2, 4); /* The dart starts at ped 4, and... */ tr[2].walkto(5); /* flies to ped 5. */ tr[2].face = 0; /* Only face. */ @@ -883,33 +883,33 @@ void Trip::call_special(uint16 which) { _vm->_enid.back_to_bootstrap(3); break; case 5: - if (_vm->_gyro.dna.friar_will_tie_you_up) { - /* _vm->_gyro.special 5: Room 42: touched tree, and get tied up. */ - _vm->_gyro.magics[4].op = _vm->_gyro.bounces; /* Boundary effect is now working again. */ + if (_vm->_gyro->dna.friar_will_tie_you_up) { + /* _vm->_gyro->special 5: Room 42: touched tree, and get tied up. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Boundary effect is now working again. */ _vm->_visa.dixi('q', 35); tr[1].done(); /*tr[1].vanishifstill:=true;*/ _vm->_celer.show_one(2); _vm->_visa.dixi('q', 36); - _vm->_gyro.dna.tied_up = true; - _vm->_gyro.dna.friar_will_tie_you_up = false; + _vm->_gyro->dna.tied_up = true; + _vm->_gyro->dna.friar_will_tie_you_up = false; tr[2].walkto(3); tr[2].vanishifstill = true; tr[2].check_me = true; /* One of them must have Check_Me switched on. */ - _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = 177; /* Not here, then. */ + _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 177; /* Not here, then. */ _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); } break; - case 6: /* _vm->_gyro.special 6: fall down oubliette. */ - _vm->_gyro.dna.user_moves_avvy = false; + case 6: /* _vm->_gyro->special 6: fall down oubliette. */ + _vm->_gyro->dna.user_moves_avvy = false; tr[1].ix = 3; tr[1].iy = 0; tr[1].face = right; _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); break; - case 7: /* _vm->_gyro.special 7: stop falling down oubliette. */ + case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ tr[1].visible = false; - _vm->_gyro.magics[10].op = _vm->_gyro.nix; + _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout.lose_timer(_vm->_timeout.reason_falling_down_oubliette); _vm->_lucerna.mblit(12, 80, 38, 160, 3, 0); @@ -917,8 +917,8 @@ void Trip::call_special(uint16 which) { _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); break; - case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */ - if ((_vm->_gyro.dna.geida_follows) && (!_vm->_gyro.dna.lustie_is_asleep)) { + case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ + if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { _vm->_visa.dixi('q', 63); tr[2].turn(down); tr[2].stopwalk(); @@ -926,19 +926,19 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.gameover(); } break; - case 9: /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ - if (!_vm->_gyro.dna.geida_follows) + case 9: /* _vm->_gyro->special 9: lose Geida to Robin Hood... */ + if (!_vm->_gyro->dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ tr[2].walkto(4); /* She walks to somewhere... */ tr[1].done(); /* Lose Avvy. */ - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.user_moves_avvy = false; _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); break; - case 10: /* _vm->_gyro.special 10: transfer north in catacombs. */ - if ((_vm->_gyro.dna.cat_x == 4) && (_vm->_gyro.dna.cat_y == 1)) { + case 10: /* _vm->_gyro->special 10: transfer north in catacombs. */ + if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { /* Into Geida's room. */ - if (_vm->_gyro.dna.obj[_vm->_gyro.key]) + if (_vm->_gyro->dna.obj[_vm->_gyro->key]) _vm->_visa.dixi('q', 62); else { _vm->_visa.dixi('q', 61); @@ -946,12 +946,12 @@ void Trip::call_special(uint16 which) { } } _vm->_lucerna.dusk(); - _vm->_gyro.dna.cat_y -= 1; + _vm->_gyro->dna.cat_y -= 1; catamove(4); - if (_vm->_gyro.dna.room != r__catacombs) + if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna.delavvy(); - switch ((_vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x] & 0xf00) >> 8) { + switch ((_vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x] & 0xf00) >> 8) { case 0x1: apped(1, 12); break; @@ -964,33 +964,33 @@ void Trip::call_special(uint16 which) { getback(); dawndelay(); break; - case 11: /* _vm->_gyro.special 11: transfer east in catacombs. */ + case 11: /* _vm->_gyro->special 11: transfer east in catacombs. */ _vm->_lucerna.dusk(); - _vm->_gyro.dna.cat_x += 1; + _vm->_gyro->dna.cat_x += 1; catamove(1); - if (_vm->_gyro.dna.room != r__catacombs) + if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna.delavvy(); apped(1, 1); getback(); dawndelay(); break; - case 12: /* _vm->_gyro.special 12: transfer south in catacombs. */ + case 12: /* _vm->_gyro->special 12: transfer south in catacombs. */ _vm->_lucerna.dusk(); - _vm->_gyro.dna.cat_y += 1; + _vm->_gyro->dna.cat_y += 1; catamove(2); - if (_vm->_gyro.dna.room != r__catacombs) + if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna.delavvy(); apped(1, 2); getback(); dawndelay(); break; - case 13: /* _vm->_gyro.special 13: transfer west in catacombs. */ + case 13: /* _vm->_gyro->special 13: transfer west in catacombs. */ _vm->_lucerna.dusk(); - _vm->_gyro.dna.cat_x -= 1; + _vm->_gyro->dna.cat_x -= 1; catamove(3); - if (_vm->_gyro.dna.room != r__catacombs) + if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna.delavvy(); apped(1, 3); @@ -1006,7 +1006,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { /* This slides the door open. (The data really ought to be saved in the Also file, and will be next time. However, for now, they're here.) */ - switch (_vm->_gyro.dna.room) { + switch (_vm->_gyro->dna.room) { case r__outsideyours: case r__outsidenottspub: case r__outsideducks: @@ -1032,7 +1032,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { case r__lusties: switch (magicnum) { case 14: - if (_vm->_gyro.dna.avvys_in_the_cupboard) { + if (_vm->_gyro->dna.avvys_in_the_cupboard) { hide_in_the_cupboard(); _vm->_sequence.first_show(8); _vm->_sequence.then_show(7); @@ -1094,8 +1094,8 @@ void Trip::rwsp(byte t, byte r) { } void Trip::apped(byte trn, byte np) { - tr[trn].appear(tr[trn].x - tr[trn]._info.xl / 2, tr[trn].y - tr[trn]._info.yl, _vm->_gyro.peds[np].dir); - rwsp(trn, _vm->_gyro.peds[np].dir); + tr[trn].appear(tr[trn].x - tr[trn]._info.xl / 2, tr[trn].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir); + rwsp(trn, _vm->_gyro->peds[np].dir); } @@ -1104,12 +1104,12 @@ void Trip::apped(byte trn, byte np) { begin { By De Morgan's law: } overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); end;*/ -/* x1,x2 - as _vm->_gyro.bytefield, but *8. y1,y2 - as _vm->_gyro.bytefield. +/* x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ bool Trip::overlaps_with_mouse() { bool overlaps_with_mouse_result; overlaps_with_mouse_result = - (r.x2 * 8 >= _vm->_gyro.mx) && (_vm->_gyro.mx + 16 >= r.x1 * 8) && (r.y2 >= _vm->_gyro.my) && (_vm->_gyro.my + 16 >= r.y1); + (r.x2 * 8 >= _vm->_gyro->mx) && (_vm->_gyro->mx + 16 >= r.x1 * 8) && (r.y2 >= _vm->_gyro->my) && (_vm->_gyro->my + 16 >= r.y1); return overlaps_with_mouse_result; } @@ -1121,8 +1121,8 @@ void Trip::getback() { endangered = false; /* Super_Off;*/ - while (getset[1 - _vm->_gyro.cp].numleft > 0) { - getset[1 - _vm->_gyro.cp].recall(r); + while (getset[1 - _vm->_gyro->cp].numleft > 0) { + getset[1 - _vm->_gyro->cp].recall(r); /* if overlaps_with_mouse and not endangered then @@ -1133,7 +1133,7 @@ void Trip::getback() { end; */ - _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); + _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } _vm->_lucerna.blitfix(); @@ -1213,13 +1213,13 @@ void Trip::arrow_procs(byte tripnum) { _vm->_lucerna.gameover(); - _vm->_gyro.dna.user_moves_avvy = false; /* Stop the user from moving him. */ + _vm->_gyro->dna.user_moves_avvy = false; /* Stop the user from moving him. */ _vm->_timeout.set_up_timer(55, _vm->_timeout.procnaughty_duke, _vm->_timeout.reason_naughty_duke); } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ _vm->_celer.show_one(3); /* Show pic of arrow stuck into the door. */ - _vm->_gyro.dna.arrow_in_the_door = true; /* So that we can pick it up. */ + _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ } } @@ -1230,7 +1230,7 @@ begin with tr[tripnum] do if not homing then { We only need to do anything if Spludwick *stops* walking. } - with _vm->_gyro.dna do + with _vm->_gyro->dna do begin inc(DogfoodPos); if DogfoodPos=8 then DogfoodPos:=1; @@ -1279,21 +1279,21 @@ void Trip::spin(byte whichway, byte &tripnum) { if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ - _vm->_gyro.dna.geida_spin += 1; - _vm->_gyro.dna.geida_time = 20; - if (_vm->_gyro.dna.geida_spin == 5) { + _vm->_gyro->dna.geida_spin += 1; + _vm->_gyro->dna.geida_time = 20; + if (_vm->_gyro->dna.geida_spin == 5) { _vm->_scrolls.display("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_gyro.dna.geida_spin = 0; - _vm->_gyro.dna.geida_time = 0; /* knock out records */ + _vm->_gyro->dna.geida_spin = 0; + _vm->_gyro->dna.geida_time = 0; /* knock out records */ } } } void Trip::geida_procs(byte tripnum) { - if (_vm->_gyro.dna.geida_time > 0) { - _vm->_gyro.dna.geida_time -= 1; - if (_vm->_gyro.dna.geida_time == 0) - _vm->_gyro.dna.geida_spin = 0; + if (_vm->_gyro->dna.geida_time > 0) { + _vm->_gyro->dna.geida_time -= 1; + if (_vm->_gyro->dna.geida_time == 0) + _vm->_gyro->dna.geida_spin = 0; } if (tr[tripnum].y < (tr[1].y - 2)) { @@ -1363,7 +1363,7 @@ void Trip::call_andexors() { void Trip::trippancy_link() { byte fv; - if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) + if (_vm->_gyro->ddmnow | _vm->_gyro->ontoolbar | _vm->_gyro->seescroll) return; for (fv = 1; fv <= numtr; fv++) { if (tr[fv].quick) @@ -1418,71 +1418,71 @@ void Trip::get_back_loretta() { void Trip::stopwalking() { tr[1].stopwalk(); - _vm->_gyro.dna.rw = stopped; - if (_vm->_gyro.alive) + _vm->_gyro->dna.rw = stopped; + if (_vm->_gyro->alive) tr[1].step = 1; } void Trip::tripkey(char dir) { - if ((_vm->_gyro.ctrl == cjoy) | (!_vm->_gyro.dna.user_moves_avvy)) + if ((_vm->_gyro->ctrl == cjoy) | (!_vm->_gyro->dna.user_moves_avvy)) return; triptype &with = tr[1]; switch (dir) { case 'H': - if (_vm->_gyro.dna.rw != up) { - _vm->_gyro.dna.rw = up; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != up) { + _vm->_gyro->dna.rw = up; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'P': - if (_vm->_gyro.dna.rw != down) { - _vm->_gyro.dna.rw = down; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != down) { + _vm->_gyro->dna.rw = down; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'K': - if (_vm->_gyro.dna.rw != left) { - _vm->_gyro.dna.rw = left; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != left) { + _vm->_gyro->dna.rw = left; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'M': - if (_vm->_gyro.dna.rw != right) { - _vm->_gyro.dna.rw = right; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != right) { + _vm->_gyro->dna.rw = right; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'I': - if (_vm->_gyro.dna.rw != ur) { - _vm->_gyro.dna.rw = ur; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != ur) { + _vm->_gyro->dna.rw = ur; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'Q': - if (_vm->_gyro.dna.rw != dr) { - _vm->_gyro.dna.rw = dr; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != dr) { + _vm->_gyro->dna.rw = dr; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'O': - if (_vm->_gyro.dna.rw != dl) { - _vm->_gyro.dna.rw = dl; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != dl) { + _vm->_gyro->dna.rw = dl; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; case 'G': - if (_vm->_gyro.dna.rw != ul) { - _vm->_gyro.dna.rw = ul; - rwsp(1, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != ul) { + _vm->_gyro->dna.rw = ul; + rwsp(1, _vm->_gyro->dna.rw); } else stopwalking(); break; @@ -1504,15 +1504,15 @@ void Trip::getsetclear() { void Trip::hide_in_the_cupboard() { const char nowt = 250; /* As in Acci. */ - if (_vm->_gyro.dna.avvys_in_the_cupboard) { - if (_vm->_gyro.dna.wearing == nowt) + if (_vm->_gyro->dna.avvys_in_the_cupboard) { + if (_vm->_gyro->dna.wearing == nowt) _vm->_scrolls.display("\6AVVY!\22 Get dressed first!"); else { tr[1].visible = true; - _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro->dna.user_moves_avvy = true; apped(1, 3); /* Walk out of the cupboard. */ _vm->_scrolls.display("You leave the cupboard. Nice to be out of there!"); - _vm->_gyro.dna.avvys_in_the_cupboard = false; + _vm->_gyro->dna.avvys_in_the_cupboard = false; _vm->_sequence.first_show(8); _vm->_sequence.then_show(7); _vm->_sequence.start_to_close(); @@ -1520,11 +1520,11 @@ void Trip::hide_in_the_cupboard() { } else { /* Not hiding in the cupboard */ tr[1].visible = false; - _vm->_gyro.dna.user_moves_avvy = false; + _vm->_gyro->dna.user_moves_avvy = false; _vm->_scrolls.display(Common::String("You walk into the room...\20It seems to be an empty, ") + "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + "avoid suffocation."); - _vm->_gyro.dna.avvys_in_the_cupboard = true; + _vm->_gyro->dna.avvys_in_the_cupboard = true; _vm->_celer.show_one(8); } } @@ -1535,36 +1535,36 @@ void Trip::tidy_up(int16 a, int16 b, int16 c, int16 d) { void Trip::tidy_after_mouse() { tidy_up(beforex, beforey, beforex + 15, beforey + 15); - _vm->_gyro.xycheck(); - tidy_up(_vm->_gyro.mx, _vm->_gyro.my, _vm->_gyro.mx + 15, _vm->_gyro.my + 15); + _vm->_gyro->xycheck(); + tidy_up(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->mx + 15, _vm->_gyro->my + 15); } void Trip::fliproom(byte room, byte ped) { byte fv; - if (!_vm->_gyro.alive) { + if (!_vm->_gyro->alive) { /* You can't leave the room if you're dead. */ tr[1].ix = 0; tr[1].iy = 0; /* Stop him from moving. */ return; } - if ((ped == 177) && (_vm->_gyro.dna.room == r__lusties)) { + if ((ped == 177) && (_vm->_gyro->dna.room == r__lusties)) { hide_in_the_cupboard(); return; } - if ((_vm->_gyro.dna.jumpstatus > 0) && (_vm->_gyro.dna.room == r__insidecardiffcastle)) { + if ((_vm->_gyro->dna.jumpstatus > 0) && (_vm->_gyro->dna.room == r__insidecardiffcastle)) { /* You can't *jump* out of Cardiff Castle! */ tr[1].ix = 0; return; } - _vm->_gyro.xycheck(); - beforex = _vm->_gyro.mx; - beforey = _vm->_gyro.my; + _vm->_gyro->xycheck(); + beforex = _vm->_gyro->mx; + beforey = _vm->_gyro->my; - _vm->_lucerna.exitroom(_vm->_gyro.dna.room); + _vm->_lucerna.exitroom(_vm->_gyro->dna.room); _vm->_lucerna.dusk(); getsetclear(); @@ -1574,18 +1574,18 @@ void Trip::fliproom(byte room, byte ped) { tr[fv].done(); } /* Deallocate sprite */ - if (_vm->_gyro.dna.room == r__lustiesroom) - _vm->_gyro.dna.enter_catacombs_from_lusties_room = true; + if (_vm->_gyro->dna.room == r__lustiesroom) + _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; _vm->_lucerna.enterroom(room, ped); apped(1, ped); - _vm->_gyro.dna.enter_catacombs_from_lusties_room = false; - _vm->_gyro.oldrw = _vm->_gyro.dna.rw; - _vm->_gyro.dna.rw = tr[1].face; + _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; + _vm->_gyro->oldrw = _vm->_gyro->dna.rw; + _vm->_gyro->dna.rw = tr[1].face; _vm->_lucerna.showrw(); for (fv = 0; fv <= 1; fv++) { - _vm->_gyro.cp = 1 - _vm->_gyro.cp; + _vm->_gyro->cp = 1 - _vm->_gyro->cp; getback(); } _vm->_lucerna.dawn(); @@ -1598,8 +1598,8 @@ bool Trip::infield(byte which) { /* returns True if you're within field "which" */ int16 yy = tr[1].y + tr[1]._info.yl; - return (tr[1].x >= _vm->_gyro.fields[which].x1) && (tr[1].x <= _vm->_gyro.fields[which].x2) - && (yy >= _vm->_gyro.fields[which].y1) && (yy <= _vm->_gyro.fields[which].y2); + return (tr[1].x >= _vm->_gyro->fields[which].x1) && (tr[1].x <= _vm->_gyro->fields[which].x2) + && (yy >= _vm->_gyro->fields[which].y1) && (yy <= _vm->_gyro->fields[which].y2); } @@ -1609,7 +1609,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ bool nd; bool neardoor_result; - if (_vm->_gyro.numfields < 9) { + if (_vm->_gyro->numfields < 9) { /* there ARE no doors here! */ neardoor_result = false; return neardoor_result; @@ -1619,11 +1619,11 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ uy = tr[1].y + tr[1]._info.yl; nd = false; - for (fv = 9; fv <= _vm->_gyro.numfields; fv++) { - _vm->_gyro.fields[fv]; + for (fv = 9; fv <= _vm->_gyro->numfields; fv++) { + _vm->_gyro->fields[fv]; - if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2) - && (uy >= _vm->_gyro.fields[fv].y1) && (uy <= _vm->_gyro.fields[fv].y2)) + if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2) + && (uy >= _vm->_gyro->fields[fv].y1) && (uy <= _vm->_gyro->fields[fv].y2)) nd = true; } return nd; @@ -1636,65 +1636,65 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ void Trip::handleMoveKey(const Common::Event &event) { - //if ((_vm->_gyro.ctrl == cjoy) | (!_vm->_gyro.dna.user_moves_avvy)) + //if ((_vm->_gyro->ctrl == cjoy) | (!_vm->_gyro->dna.user_moves_avvy)) // return; // // We don't mess around with the joystick. switch (event.kbd.keycode) { case Common::KEYCODE_UP: - if (_vm->_gyro.dna.rw != up) { - _vm->_gyro.dna.rw = up; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != up) { + _vm->_gyro->dna.rw = up; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_DOWN: - if (_vm->_gyro.dna.rw != down) { - _vm->_gyro.dna.rw = down; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != down) { + _vm->_gyro->dna.rw = down; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_LEFT: - if (_vm->_gyro.dna.rw != left) { - _vm->_gyro.dna.rw = left; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != left) { + _vm->_gyro->dna.rw = left; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_RIGHT: - if (_vm->_gyro.dna.rw != right) { - _vm->_gyro.dna.rw = right; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != right) { + _vm->_gyro->dna.rw = right; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_PAGEUP: - if (_vm->_gyro.dna.rw != ur) { - _vm->_gyro.dna.rw = ur; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != ur) { + _vm->_gyro->dna.rw = ur; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro.dna.rw != dr) { - _vm->_gyro.dna.rw = dr; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != dr) { + _vm->_gyro->dna.rw = dr; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_END: - if (_vm->_gyro.dna.rw != dl) { - _vm->_gyro.dna.rw = dl; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != dl) { + _vm->_gyro->dna.rw = dl; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; case Common::KEYCODE_HOME: - if (_vm->_gyro.dna.rw != ul) { - _vm->_gyro.dna.rw = ul; - rwsp(0, _vm->_gyro.dna.rw); + if (_vm->_gyro->dna.rw != ul) { + _vm->_gyro->dna.rw = ul; + rwsp(0, _vm->_gyro->dna.rw); } else stopwalking(); break; diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index ea5144f2a9e1..935959533fc1 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -49,13 +49,13 @@ namespace Avalanche { bool Visa::report_dixi_errors = true; void Visa::unskrimble() { - for (uint16 fv = 0; fv < _vm->_gyro.bufsize; fv++) - _vm->_gyro.buffer[fv] = (char)((!(_vm->_gyro.buffer[fv]) - fv) % 256); + for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) + _vm->_gyro->buffer[fv] = (char)((!(_vm->_gyro->buffer[fv]) - fv) % 256); } void Visa::do_the_bubble() { - _vm->_gyro.bufsize++; - _vm->_gyro.buffer[_vm->_gyro.bufsize] = 2; + _vm->_gyro->bufsize++; + _vm->_gyro->buffer[_vm->_gyro->bufsize] = 2; } void Visa::dixi(char block, byte point) { @@ -85,7 +85,7 @@ namespace Avalanche { if (error) { if (report_dixi_errors) { Common::String todisplay; - todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro.strf(point).c_str()); + todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->strf(point).c_str()); _vm->_scrolls.display(todisplay); } return; @@ -96,8 +96,8 @@ namespace Avalanche { return; } sezfile.seek(sez_offset); - _vm->_gyro.bufsize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro.buffer, _vm->_gyro.bufsize); + _vm->_gyro->bufsize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); sezfile.close(); unskrimble(); @@ -145,8 +145,8 @@ namespace Avalanche { return; } sezfile.seek(sez_offset); - _vm->_gyro.bufsize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro.buffer, _vm->_gyro.bufsize); + _vm->_gyro->bufsize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); sezfile.close(); unskrimble(); From ca51bf19c9dae1474ffacfb1a40f955972c368a8 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:42:41 +0200 Subject: [PATCH 0180/1332] AVALANCHE: Change _timeout into pointer, update everything accordingly. --- engines/avalanche/acci2.cpp | 22 +++++++++++----------- engines/avalanche/avalanche.cpp | 3 ++- engines/avalanche/avalanche.h | 2 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 28 ++++++++++++++-------------- engines/avalanche/sequence2.cpp | 4 ++-- engines/avalanche/timeout2.cpp | 8 +++----- engines/avalanche/timeout2.h | 2 +- engines/avalanche/trip6.cpp | 18 +++++++++--------- 9 files changed, 44 insertions(+), 45 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 5e2fb23f1d36..d9180f49e769 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -622,7 +622,7 @@ void Acci::not_in_order() { void Acci::go_to_cauldron() { _vm->_trip.tr[2].call_eachstep = false; /* Stops Geida_Procs. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procspludwick_goes_to_cauldron, _vm->_timeout.reason_spludwalk); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); _vm->_trip.tr[2].walkto(2); } @@ -726,7 +726,7 @@ void Acci::stand_up() { _vm->_celer.show_one(4); /* Picture of empty pillow. */ _vm->_lucerna.points(1); _vm->_gyro->dna.avvy_in_bed = false; - _vm->_timeout.lose_timer(_vm->_timeout.reason_arkata_shouts); + _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); } else already(); break; @@ -824,7 +824,7 @@ void Acci::give_geida_the_lute() { /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procgive_lute_to_geida, _vm->_timeout.reason_geida_sings); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_enid.back_to_bootstrap(4); } @@ -841,7 +841,7 @@ void Acci::winsequence() { _vm->_sequence.then_show(8); _vm->_sequence.then_show(9); _vm->_sequence.start_to_close(); - _vm->_timeout.set_up_timer(30, _vm->_timeout.procwinning, _vm->_timeout.reason_winning); + _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); } void Acci::person_speaks() { @@ -1250,7 +1250,7 @@ void Acci::do_that() { case vb_pee: if (_vm->_gyro->flagset('P')) { _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); - _vm->_timeout.set_up_timer(4, _vm->_timeout.procurinate, _vm->_timeout.reason_gototoilet); + _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); break; @@ -1274,7 +1274,7 @@ void Acci::do_that() { _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procback_and_forth; _vm->_gyro->dna.avaricius_talk = 14; - _vm->_timeout.set_up_timer(177, _vm->_timeout.procavaricius_talks, _vm->_timeout.reason_avariciustalks); + _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } } else _vm->_scrolls.display("Nothing appears to happen..."); @@ -1339,7 +1339,7 @@ void Acci::do_that() { _vm->_celer.show_one(10); _vm->_gyro->dna.malagauche = 177; - _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuydrinks, _vm->_timeout.reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; case '\64': examine(); @@ -1365,7 +1365,7 @@ void Acci::do_that() { _vm->_celer.show_one(10); _vm->_gyro->dna.malagauche = 177; - _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuywine, _vm->_timeout.reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); } break; } @@ -1465,7 +1465,7 @@ void Acci::do_that() { else { _vm->_lucerna.points(4); _vm->_scrolls.display("The drawbridge opens!"); - _vm->_timeout.set_up_timer(7, _vm->_timeout.procopen_drawbridge, _vm->_timeout.reason_drawbridgefalls); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); _vm->_gyro->dna.drawbridge_open = 1; } } else @@ -1520,7 +1520,7 @@ void Acci::do_that() { break; case vb_jump: - _vm->_timeout.set_up_timer(1, _vm->_timeout.procjump, _vm->_timeout.reason_jumping); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; @@ -1564,7 +1564,7 @@ void Acci::do_that() { _vm->_scrolls.display("You're already sitting!"); else { _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procavvy_sit_down, _vm->_timeout.reason_sitting_down); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } } else { /* Default doodah. */ diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d5187f1fa8c8..27dd77937425 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; + delete _timeout; } Common::ErrorCode AvalancheEngine::initialize() { @@ -76,7 +77,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _enid.setParent(this); _celer.setParent(this); _sequence.setParent(this); - _timeout.setParent(this); + _timeout = new Timeout(this); _trip.setParent(this); _acci.setParent(this); _basher.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 49c02ff14128..e9de899c1cc6 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -78,7 +78,7 @@ class AvalancheEngine : public Engine { Enid _enid; Celer _celer; Sequence _sequence; - Timeout _timeout; + Timeout *_timeout; Trip _trip; Acci _acci; Basher _basher; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6ce6348e5844..856d8b819f15 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -197,7 +197,7 @@ void Avalot::run(Common::String arg) { if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->wipe_vmc(_vm->_gyro->cp); - _vm->_timeout.one_tick(); + //_vm->_timeout->one_tick(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f2690085e02a..5034e13f8b61 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -312,21 +312,21 @@ void Lucerna::exitroom(byte x) { switch (x) { case r__spludwicks: - _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); + _vm->_timeout->lose_timer(_vm->_timeout->reason_avariciustalks); _vm->_gyro->dna.avaricius_talk = 0; /* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */ break; case r__bridge: if (_vm->_gyro->dna.drawbridge_open > 0) { _vm->_gyro->dna.drawbridge_open = 4; /* Fully open. */ - _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); + _vm->_timeout->lose_timer(_vm->_timeout->reason_drawbridgefalls); } break; case r__outsidecardiffcastle: - _vm->_timeout.lose_timer(_vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); break; case r__robins: - _vm->_timeout.lose_timer(_vm->_timeout.reason_getting_tied_up); + _vm->_timeout->lose_timer(_vm->_timeout->reason_getting_tied_up); break; } @@ -406,7 +406,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { _vm->_celer.show_one(3); - _vm->_timeout.set_up_timer(100, _vm->_timeout.procarkata_shouts, _vm->_timeout.reason_arkata_shouts); + _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } break; @@ -434,7 +434,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(8, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(4); - _vm->_timeout.set_up_timer(20, _vm->_timeout.proccrapulus_splud_out, _vm->_timeout.reason_crapulus_says_spludwick_out); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->dna.crapulus_will_tell = false; } } @@ -444,7 +444,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timeout.set_up_timer(20, _vm->_timeout.procbang, _vm->_timeout.reason_explosion); + _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); _vm->_gyro->dna.spludwicks_here = true; } break;*/ @@ -499,7 +499,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].vanishifstill = true; with.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ - _vm->_timeout.set_up_timer(20, _vm->_timeout.proc_cwytalot_in_herts, _vm->_timeout.reason_cwytalot_in_herts); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } } break; @@ -520,7 +520,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(6, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(3); - _vm->_timeout.set_up_timer(36, _vm->_timeout.procget_tied_up, _vm->_timeout.reason_getting_tied_up); + _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -544,7 +544,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(9, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(3); - _vm->_timeout.set_up_timer(47, _vm->_timeout.proccardiffsurvey, _vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; case 5 : @@ -554,7 +554,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(9, false, &_vm->_trip); _vm->_trip.apped(2, 3); _vm->_trip.tr[2].face = _vm->_trip.right; - _vm->_timeout.set_up_timer(3, _vm->_timeout.proccardiff_return, _vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } if (_vm->_gyro->dna.cardiff_things < 5) @@ -586,10 +586,10 @@ void Lucerna::enterroom(byte x, byte ped) { case r__lustiesroom: { _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ if (_vm->_trip.tr[1].whichsprite == 0) /* Avvy in his normal clothes */ - _vm->_timeout.set_up_timer(3, _vm->_timeout.proccallsguards, _vm->_timeout.reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ /* Presumably, Avvy dressed as a monk. */ - _vm->_timeout.set_up_timer(3, _vm->_timeout.procgreetsmonk, _vm->_timeout.reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); @@ -1231,7 +1231,7 @@ void Lucerna::gameover() { _vm->_trip.tr[1].step = 0; _vm->_trip.tr[1].appear(sx, sy, 0); - _vm->_timeout.set_up_timer(3, _vm->_timeout.procavalot_falls, _vm->_timeout.reason_falling_over); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); /* _vm->_scrolls.display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ _vm->_gyro->alive = false; } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 61198d297a18..5edb00a2be75 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -71,8 +71,8 @@ void Sequence::then_flip(byte where, byte ped) { } void Sequence::start_to_close() { - _vm->_timeout.lose_timer(_vm->_timeout.reason_sequencer); - _vm->_timeout.set_up_timer(7, _vm->_timeout.procsequence, _vm->_timeout.reason_sequencer); + _vm->_timeout->lose_timer(_vm->_timeout->reason_sequencer); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->reason_sequencer); } void Sequence::start_to_open() { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index b10c1c18d612..420469f92037 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -46,7 +46,9 @@ namespace Avalanche { -Timeout::Timeout() { +Timeout::Timeout(AvalancheEngine *vm) { + _vm = vm; + for (int i = 0; i < sizeof(times); i++) { times[i].time_left = 0; times[i].then_where = 0; @@ -54,10 +56,6 @@ Timeout::Timeout() { } } -void Timeout::setParent(AvalancheEngine *vm) { - _vm = vm; -} - void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { fv = 1; while ((fv < 8) && (times[fv].time_left != 0)) diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 07a48d6ad0b8..d315d5964aec 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -164,7 +164,7 @@ class Timeout { - Timeout(); + Timeout(AvalancheEngine *vm); void setParent(AvalancheEngine *vm); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 00fac658abbc..492c6bf7dc5a 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -837,7 +837,7 @@ void Trip::catamove(byte ped) { /* This proc gets called whenever you touch a line defined as _vm->_gyro->special. */ void Trip::dawndelay() { - _vm->_timeout.set_up_timer(2, _vm->_timeout.procdawn_delay, _vm->_timeout.reason_dawndelay); + _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); } void Trip::call_special(uint16 which) { @@ -846,7 +846,7 @@ void Trip::call_special(uint16 which) { _vm->_celer.show_one(1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[10].op = _vm->_gyro->nix; - _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); + _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); stopwalking(); _vm->_gyro->dna.user_moves_avvy = false; break; @@ -879,7 +879,7 @@ void Trip::call_special(uint16 which) { case 4: /* This is the ghost room link. */ _vm->_lucerna.dusk(); tr[1].turn(right); /* you'll see this after we get back from bootstrap */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procghost_room_phew, _vm->_timeout.reason_ghost_room_phew); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_enid.back_to_bootstrap(3); break; case 5: @@ -897,7 +897,7 @@ void Trip::call_special(uint16 which) { tr[2].vanishifstill = true; tr[2].check_me = true; /* One of them must have Check_Me switched on. */ _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 177; /* Not here, then. */ - _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); + _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; case 6: /* _vm->_gyro->special 6: fall down oubliette. */ @@ -905,17 +905,17 @@ void Trip::call_special(uint16 which) { tr[1].ix = 3; tr[1].iy = 0; tr[1].face = right; - _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ tr[1].visible = false; _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); - _vm->_timeout.lose_timer(_vm->_timeout.reason_falling_down_oubliette); + _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); _vm->_lucerna.mblit(12, 80, 38, 160, 3, 0); _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); + _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { @@ -933,7 +933,7 @@ void Trip::call_special(uint16 which) { tr[2].walkto(4); /* She walks to somewhere... */ tr[1].done(); /* Lose Avvy. */ _vm->_gyro->dna.user_moves_avvy = false; - _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); + _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); break; case 10: /* _vm->_gyro->special 10: transfer north in catacombs. */ if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { @@ -1214,7 +1214,7 @@ void Trip::arrow_procs(byte tripnum) { _vm->_lucerna.gameover(); _vm->_gyro->dna.user_moves_avvy = false; /* Stop the user from moving him. */ - _vm->_timeout.set_up_timer(55, _vm->_timeout.procnaughty_duke, _vm->_timeout.reason_naughty_duke); + _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ From bc9823ad9b45b5314255f11f3732cfb8ac93c05b Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:45:10 +0200 Subject: [PATCH 0181/1332] AVALANCHE: Change _enhanced into pointer, update everything accordingly. --- engines/avalanche/avalanche.cpp | 3 ++- engines/avalanche/avalanche.h | 2 +- engines/avalanche/enhanced2.cpp | 2 +- engines/avalanche/enhanced2.h | 2 +- engines/avalanche/lucerna2.cpp | 12 ++++++------ 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 27dd77937425..0b522b151c12 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; + delete _enhanced; delete _timeout; } @@ -68,7 +69,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); - _enhanced.setParent(this); + _enhanced = new Enhanced(this); _logger.setParent(this); _pingo.setParent(this); _scrolls.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e9de899c1cc6..4af8a82edddb 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -69,7 +69,7 @@ class AvalancheEngine : public Engine { Avalot *_avalot; Gyro *_gyro; - Enhanced _enhanced; + Enhanced *_enhanced; Logger _logger; Pingo _pingo; Scrolls _scrolls; diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp index f664d82c3c42..d6187a0ece2b 100644 --- a/engines/avalanche/enhanced2.cpp +++ b/engines/avalanche/enhanced2.cpp @@ -33,7 +33,7 @@ namespace Avalanche { -void Enhanced::setParent(AvalancheEngine *vm) { +Enhanced::Enhanced(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h index 917ed3c56cb9..ed7f1e6fb475 100644 --- a/engines/avalanche/enhanced2.h +++ b/engines/avalanche/enhanced2.h @@ -43,7 +43,7 @@ class Enhanced { bool atbios; // BIOS type char inchar, extd; - void setParent(AvalancheEngine *vm); + Enhanced(AvalancheEngine *vm); void readkeye(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5034e13f8b61..59942ac95ef2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -63,7 +63,7 @@ void Lucerna::setParent(AvalancheEngine *vm) { void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; - if (_vm->_enhanced.atbios) _vm->_gyro->atkey = "f1"; + if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; else _vm->_gyro->atkey = "alt-"; } @@ -904,15 +904,15 @@ void Lucerna::inkey() { if (_vm->_gyro->mousetext == "") { /* read keyboard */ - _vm->_enhanced.readkeye(); - if ((_vm->_enhanced.inchar == ' ') && ((_vm->_enhanced.shiftstate & 8) > 0)) { - _vm->_enhanced.inchar = '\0'; - _vm->_enhanced.extd = '#'; /* alt-spacebar = alt-H */ + _vm->_enhanced->readkeye(); + if ((_vm->_enhanced->inchar == ' ') && ((_vm->_enhanced->shiftstate & 8) > 0)) { + _vm->_enhanced->inchar = '\0'; + _vm->_enhanced->extd = '#'; /* alt-spacebar = alt-H */ } } else { if (_vm->_gyro->mousetext[0] == '`') _vm->_gyro->mousetext.setChar(13,0); /* Backquote = return in a macro */ - _vm->_enhanced.inchar = _vm->_gyro->mousetext[0]; + _vm->_enhanced->inchar = _vm->_gyro->mousetext[0]; _vm->_gyro->mousetext = Common::String(_vm->_gyro->mousetext.c_str() + 2, 253); } } From 4d251171354a5a2cc0d8df32a54f716f4e23fe64 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:47:33 +0200 Subject: [PATCH 0182/1332] AVALANCHE: Change _logger into pointer, update everything accordingly. --- engines/avalanche/avalanche.cpp | 3 ++- engines/avalanche/avalanche.h | 2 +- engines/avalanche/logger2.cpp | 2 +- engines/avalanche/logger2.h | 2 +- engines/avalanche/lucerna2.cpp | 4 ++-- engines/avalanche/scrolls2.cpp | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 0b522b151c12..f130089102c8 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -62,6 +62,7 @@ AvalancheEngine::~AvalancheEngine() { delete _gyro; delete _enhanced; delete _timeout; + delete _logger; } Common::ErrorCode AvalancheEngine::initialize() { @@ -70,7 +71,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); _enhanced = new Enhanced(this); - _logger.setParent(this); + _logger = new Logger(this); _pingo.setParent(this); _scrolls.setParent(this); _visa.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 4af8a82edddb..76873a5af266 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -70,7 +70,7 @@ class AvalancheEngine : public Engine { Avalot *_avalot; Gyro *_gyro; Enhanced *_enhanced; - Logger _logger; + Logger *_logger; Pingo _pingo; Scrolls _scrolls; Visa _visa; diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index 20ca558e41f0..ef94eb3522e7 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -75,7 +75,7 @@ const int16 Logger::divide_indent = 30; -void Logger::setParent(AvalancheEngine *vm) { +Logger::Logger(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h index 05a96d08ca06..95e5ea849dd6 100644 --- a/engines/avalanche/logger2.h +++ b/engines/avalanche/logger2.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Logger { public: - void setParent(AvalancheEngine *vm); + Logger(AvalancheEngine *vm); void log_setup(Common::String name, bool printing); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 59942ac95ef2..dd6503caf829 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -278,7 +278,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ bit = *_vm->_graphics->getPixel(0,0); - _vm->_logger.log_newroom(_vm->_gyro->roomname); + _vm->_logger->log_newroom(_vm->_gyro->roomname); if (was_virtual) _vm->_gyro->on_virtual(); @@ -881,7 +881,7 @@ void Lucerna::points(byte num) { /* Add on no. of points */ } warning("STUB: Lucerna::points()"); - _vm->_logger.log_score(num, _vm->_gyro->dna.score); + _vm->_logger->log_score(num, _vm->_gyro->dna.score); showscore(); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index b0563c68a199..0a76168adad6 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -146,7 +146,7 @@ void Scrolls::music_scroll() { void Scrolls::resetscrolldriver() { /* phew */ _vm->_gyro->scrollbells = 0; cfont = roman; - _vm->_logger.log_epsonroman(); + _vm->_logger->log_epsonroman(); use_icon = 0; _vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */ } From c0823f3e79bb17369904f704a27fad8127faeb9e Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 18:50:13 +0200 Subject: [PATCH 0183/1332] AVALANCHE: Change _pingo into pointer, update everything accordingly. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/avalanche.cpp | 6 ++++-- engines/avalanche/avalanche.h | 2 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/pingo2.h | 2 +- engines/avalanche/timeout2.cpp | 4 ++-- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d9180f49e769..b9958f10b0ce 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1294,7 +1294,7 @@ void Acci::do_that() { "do things I tell you not to?\r\rDon't do it again!"); break; default: - _vm->_pingo.zonk(); + _vm->_pingo->zonk(); _vm->_scrolls.display(Common::String("A crack of lightning shoots from the sky, ") + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna.gameover(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f130089102c8..e490ace48a48 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -61,8 +61,10 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; delete _enhanced; - delete _timeout; delete _logger; + delete _pingo; + + delete _timeout; } Common::ErrorCode AvalancheEngine::initialize() { @@ -72,7 +74,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _gyro = new Gyro(this); _enhanced = new Enhanced(this); _logger = new Logger(this); - _pingo.setParent(this); + _pingo = new Pingo(this); _scrolls.setParent(this); _visa.setParent(this); _lucerna.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 76873a5af266..66bfd22ae582 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -71,7 +71,7 @@ class AvalancheEngine : public Engine { Gyro *_gyro; Enhanced *_enhanced; Logger *_logger; - Pingo _pingo; + Pingo *_pingo; Scrolls _scrolls; Visa _visa; Lucerna _lucerna; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 856d8b819f15..64f679fea0c2 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -98,7 +98,7 @@ void Avalot::setup() { _vm->_gyro->enid_filename = ""; /* undefined. */ _vm->_lucerna.toolbar(); _vm->_scrolls.state(2); - _vm->_graphics->refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. + _vm->_graphics->refreshScreen(); //_vm->_pingo->copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) _vm->_gyro->lastscore[i] = -1; /* impossible digits */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index dd6503caf829..c11a2454bb9d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -274,7 +274,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); _vm->_celer.load_chunks(xx); - _vm->_graphics->refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup() + _vm->_graphics->refreshScreen(); // _vm->_pingo->copy03(); - See Avalot::setup() bit = *_vm->_graphics->getPixel(0,0); diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 1f7c35eea660..7b341678be48 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -40,7 +40,7 @@ namespace Avalanche { -void Pingo::setParent(AvalancheEngine *vm) { +Pingo::Pingo(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index b6113f814120..962523666086 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Pingo { public: - void setParent(AvalancheEngine *vm); + Pingo(AvalancheEngine *vm); void bosskey(); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 420469f92037..9deae8458540 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -490,7 +490,7 @@ void Timeout::buydrinks() { _vm->_gyro->dna.malagauche = 0; _vm->_visa.dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls.display message about it. */ - _vm->_pingo.wobble(); /* Do the special effects. */ + _vm->_pingo->wobble(); /* Do the special effects. */ _vm->_visa.dixi('D', 1); /* That'll be thruppence. */ if (_vm->_gyro->pennycheck(3)) /* Pay 3d. */ _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */ @@ -614,7 +614,7 @@ void Timeout::arkata_shouts() { void Timeout::winning() { _vm->_visa.dixi('q', 79); - _vm->_pingo.winning_pic(); + _vm->_pingo->winning_pic(); do { _vm->_lucerna.checkclick(); From 39dfddff1f3d35c889e1a0ea7053a4e648e036fa Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 19:43:10 +0200 Subject: [PATCH 0184/1332] AVALANCHE: Change class variables to pointers, update everything accordingly. --- engines/avalanche/acci2.cpp | 554 ++++++++++++++++---------------- engines/avalanche/acci2.h | 2 +- engines/avalanche/avalanche.cpp | 42 ++- engines/avalanche/avalanche.h | 22 +- engines/avalanche/avalot.cpp | 66 ++-- engines/avalanche/basher2.cpp | 2 +- engines/avalanche/basher2.h | 2 +- engines/avalanche/celer2.cpp | 37 +-- engines/avalanche/celer2.h | 3 +- engines/avalanche/closing2.cpp | 7 +- engines/avalanche/closing2.h | 4 +- engines/avalanche/dropdown2.cpp | 116 +++---- engines/avalanche/dropdown2.h | 4 +- engines/avalanche/enid2.cpp | 18 +- engines/avalanche/enid2.h | 2 +- engines/avalanche/gyro2.cpp | 30 +- engines/avalanche/lucerna2.cpp | 274 ++++++++-------- engines/avalanche/lucerna2.h | 4 +- engines/avalanche/pingo2.cpp | 6 +- engines/avalanche/scrolls2.cpp | 6 +- engines/avalanche/scrolls2.h | 4 +- engines/avalanche/sequence2.cpp | 8 +- engines/avalanche/sequence2.h | 2 +- engines/avalanche/timeout2.cpp | 238 +++++++------- engines/avalanche/trip6.cpp | 252 +++++++-------- engines/avalanche/trip6.h | 5 +- engines/avalanche/visa2.cpp | 8 +- engines/avalanche/visa2.h | 2 +- 28 files changed, 858 insertions(+), 862 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index b9958f10b0ce..e87e120d0f86 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -216,7 +216,7 @@ const Acci::ranktype Acci::ranks[9] = { }; -void Acci::setParent(AvalancheEngine *vm) { +Acci::Acci(AvalancheEngine *vm) { _vm = vm; } @@ -264,7 +264,7 @@ begin blockwrite(f,a,12080); end; close(f); on; - _vm->_scrolls.display('Dumped.'); + _vm->_scrolls->display('Dumped.'); end;*/ Common::String Acci::rank() { @@ -323,7 +323,7 @@ void Acci::displaywhat(char ch, bool animate, bool &ambigous) { /* << it's an ad byte ff; Common::String z; - warning("STUB: Acci::_vm->_scrolls.displaywhat()"); + warning("STUB: Acci::_vm->_scrolls->displaywhat()"); } bool Acci::do_pronouns() { @@ -430,38 +430,38 @@ void Acci::others() { void Acci::lookaround() { /* This is called when you say "look." */ - _vm->_scrolls.display(*_vm->_gyro->also[0][1]); + _vm->_scrolls->display(*_vm->_gyro->also[0][1]); switch (_vm->_gyro->dna.room) { case r__spludwicks: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa.dixi('q', 23); + _vm->_visa->dixi('q', 23); else others(); break; case r__robins: if (_vm->_gyro->dna.tied_up) - _vm->_visa.dixi('q', 38); + _vm->_visa->dixi('q', 38); if (_vm->_gyro->dna.mushroom_growing) - _vm->_visa.dixi('q', 55); + _vm->_visa->dixi('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->dna.taken_pen) - _vm->_visa.dixi('q', 49); + _vm->_visa->dixi('q', 49); break; case r__lustiesroom: if (_vm->_gyro->dna.lustie_is_asleep) - _vm->_visa.dixi('q', 65); + _vm->_visa->dixi('q', 65); break; case r__catacombs: switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { case 258 : - _vm->_visa.dixi('q', 80); + _vm->_visa->dixi('q', 80); break; /* Inside art gallery */ case 514 : - _vm->_visa.dixi('q', 81); + _vm->_visa->dixi('q', 81); break; /* Outside ditto */ case 260 : - _vm->_visa.dixi('q', 82); + _vm->_visa->dixi('q', 82); break; /* Outside Geida's room. */ } break; @@ -475,7 +475,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ switch (_vm->_gyro->dna.room) { /* Special cases. */ case r__yours: - if (_vm->_trip.infield(2)) { + if (_vm->_trip->infield(2)) { /* Opening the box. */ thing = 54; /* The box. */ person = pardon; examine(); @@ -484,7 +484,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ break; case r__spludwicks: if (thing == 61) { - _vm->_visa.dixi('q', 85); + _vm->_visa->dixi('q', 85); return; } break; @@ -495,26 +495,26 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ return; /* No doors can open if you can't move Avvy. */ for (fv = 9; fv <= 15; fv++) { - if (_vm->_trip.infield(fv)) { + if (_vm->_trip->infield(fv)) { { _vm->_gyro->portals[fv]; switch (_vm->_gyro->portals[fv].op) { case _vm->_gyro->exclaim: - _vm->_trip.tr[1].bounce(); - _vm->_visa.dixi('x', _vm->_gyro->portals[fv].data); + _vm->_trip->tr[1].bounce(); + _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); break; case _vm->_gyro->transport: - _vm->_trip.fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); + _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); break; case _vm->_gyro->unfinished: - _vm->_trip.tr[1].bounce(); - _vm->_scrolls.display("Sorry. This place is not available yet!"); + _vm->_trip->tr[1].bounce(); + _vm->_scrolls->display("Sorry. This place is not available yet!"); break; case _vm->_gyro->special: - _vm->_trip.call_special(_vm->_gyro->portals[fv].data); + _vm->_trip->call_special(_vm->_gyro->portals[fv].data); break; case _vm->_gyro->mopendoor: - _vm->_trip.open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); + _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); break; } } @@ -523,18 +523,18 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ } if (_vm->_gyro->dna.room == r__map) - _vm->_scrolls.display(Common::String("Avvy, you can complete the whole game without ever going " + _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " "to anywhere other than Argent, Birmingham, Cardiff, " "Nottingham and Norwich.")); else - _vm->_scrolls.display("Door? What door?"); + _vm->_scrolls->display("Door? What door?"); } void Acci::silly() { - _vm->_scrolls.display("Don't be silly!"); + _vm->_scrolls->display("Don't be silly!"); } void Acci::putproc() { /* Called when you call vb_put. */ @@ -555,15 +555,15 @@ void Acci::putproc() { /* Called when you call vb_put. */ case _vm->_gyro->wine: if (thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.rotten_onion) - _vm->_scrolls.display(Common::String("That's a bit like shutting the stable door after the " + _vm->_scrolls->display(Common::String("That's a bit like shutting the stable door after the " "horse has bolted!")); else { /* Put onion into wine? */ if (_vm->_gyro->dna.winestate != 3) - _vm->_scrolls.display("\6Oignon au vin\22 is a bit too strong for your tastes!"); + _vm->_scrolls->display("\6Oignon au vin\22 is a bit too strong for your tastes!"); else { /* Put onion into vinegar! Yes! */ _vm->_gyro->dna.onion_in_vinegar = true; - _vm->_lucerna.points(7); - _vm->_visa.dixi('u', 9); + _vm->_lucerna->points(7); + _vm->_visa->dixi('u', 9); } } } else @@ -573,33 +573,33 @@ void Acci::putproc() { /* Called when you call vb_put. */ case 54: if (_vm->_gyro->dna.room == 1) { /* Put something into the box. */ if (_vm->_gyro->dna.box_contents != nowt) - _vm->_scrolls.display(Common::String("There's something in the box already, Avvy. Try taking" + _vm->_scrolls->display(Common::String("There's something in the box already, Avvy. Try taking" " that out first.")); else { switch (thing) { case _vm->_gyro->money: - _vm->_scrolls.display("You'd better keep some ready cash on you!"); + _vm->_scrolls->display("You'd better keep some ready cash on you!"); break; case _vm->_gyro->bell: - _vm->_scrolls.display("That's a silly place to keep a bell."); + _vm->_scrolls->display("That's a silly place to keep a bell."); break; case _vm->_gyro->bodkin: - _vm->_scrolls.display("But you might need it!"); + _vm->_scrolls->display("But you might need it!"); break; case _vm->_gyro->onion: - _vm->_scrolls.display("Just give it to Spludwick, Avvy!"); + _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); break; default: /* Put the object into the box... */ if (_vm->_gyro->dna.wearing == thing) - _vm->_scrolls.display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); + _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); else { - _vm->_celer.show_one(5); /* Open box. */ + _vm->_celer->show_one(5); /* Open box. */ _vm->_gyro->dna.box_contents = thing; _vm->_gyro->dna.obj[thing] = false; - _vm->_lucerna.objectlist(); - _vm->_scrolls.display("OK, it's in the box."); - _vm->_celer.show_one(6); /* Shut box. */ + _vm->_lucerna->objectlist(); + _vm->_scrolls->display("OK, it's in the box."); + _vm->_celer->show_one(6); /* Shut box. */ } } } @@ -615,15 +615,15 @@ void Acci::putproc() { /* Called when you call vb_put. */ /* The result of this fn is whether or not he says "Hey, thanks!" */ void Acci::not_in_order() { - _vm->_scrolls.display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + + _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + " What I need next is " + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + ".\232\2"); } void Acci::go_to_cauldron() { - _vm->_trip.tr[2].call_eachstep = false; /* Stops Geida_Procs. */ + _vm->_trip->tr[2].call_eachstep = false; /* Stops Geida_Procs. */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); - _vm->_trip.tr[2].walkto(2); + _vm->_trip->tr[2].walkto(2); } bool Acci::give2spludwick() { @@ -638,31 +638,31 @@ bool Acci::give2spludwick() { case _vm->_gyro->onion: _vm->_gyro->dna.obj[_vm->_gyro->onion] = false; if (_vm->_gyro->dna.rotten_onion) - _vm->_visa.dixi('q', 22); + _vm->_visa->dixi('q', 22); else { _vm->_gyro->dna.given2spludwick += 1; - _vm->_visa.dixi('q', 20); + _vm->_visa->dixi('q', 20); go_to_cauldron(); - _vm->_lucerna.points(3); + _vm->_lucerna->points(3); } - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); break; case _vm->_gyro->ink: _vm->_gyro->dna.obj[_vm->_gyro->ink] = false; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick += 1; - _vm->_visa.dixi('q', 24); + _vm->_visa->dixi('q', 24); go_to_cauldron(); - _vm->_lucerna.points(3); + _vm->_lucerna->points(3); break; case _vm->_gyro->mushroom: _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = false; - _vm->_visa.dixi('q', 25); - _vm->_lucerna.points(5); + _vm->_visa->dixi('q', 25); + _vm->_lucerna->points(5); _vm->_gyro->dna.given2spludwick += 1; go_to_cauldron(); _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); break; default: give2spludwick_result = true; @@ -678,36 +678,36 @@ void Acci::have_a_drink() { _vm->_gyro->dna.teetotal = true; _vm->_gyro->dna.avvy_is_awake = false; _vm->_gyro->dna.avvy_in_bed = true; - _vm->_lucerna.objectlist(); - _vm->_lucerna.dusk(); + _vm->_lucerna->objectlist(); + _vm->_lucerna->dusk(); _vm->_gyro->hang_around_for_a_while(); - _vm->_trip.fliproom(1, 1); + _vm->_trip->fliproom(1, 1); _vm->_gyro->background(14); - _vm->_trip.new_game_for_trippancy(); /* Not really */ + _vm->_trip->new_game_for_trippancy(); /* Not really */ } } void Acci::cardiff_climbing() { if (_vm->_gyro->dna.standing_on_dais) { /* Clamber up. */ - _vm->_scrolls.display("You climb down, back onto the floor."); + _vm->_scrolls->display("You climb down, back onto the floor."); _vm->_gyro->dna.standing_on_dais = false; - _vm->_trip.apped(1, 3); + _vm->_trip->apped(1, 3); } else { /* Clamber down. */ - if (_vm->_trip.infield(1)) { - _vm->_scrolls.display("You clamber up onto the dais."); + if (_vm->_trip->infield(1)) { + _vm->_scrolls->display("You clamber up onto the dais."); _vm->_gyro->dna.standing_on_dais = true; - _vm->_trip.apped(1, 2); + _vm->_trip->apped(1, 2); } else - _vm->_scrolls.display("Get a bit closer, Avvy."); + _vm->_scrolls->display("Get a bit closer, Avvy."); } } /* Called when you ask Avvy to stand. */ void Acci::already() { - _vm->_scrolls.display("You're already standing!"); + _vm->_scrolls->display("You're already standing!"); } void Acci::stand_up() { @@ -715,16 +715,16 @@ void Acci::stand_up() { case r__yours: /* Avvy isn't asleep. */ if (_vm->_gyro->dna.avvy_in_bed) { /* But he's in bed. */ if (_vm->_gyro->dna.teetotal) { - _vm->_visa.dixi('d', 12); + _vm->_visa->dixi('d', 12); _vm->_gyro->background(0); - _vm->_visa.dixi('d', 14); + _vm->_visa->dixi('d', 14); } - _vm->_trip.tr[1].visible = true; + _vm->_trip->tr[1].visible = true; _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip.apped(1, 2); + _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer.show_one(4); /* Picture of empty pillow. */ - _vm->_lucerna.points(1); + _vm->_celer->show_one(4); /* Picture of empty pillow. */ + _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); } else @@ -737,9 +737,9 @@ void Acci::stand_up() { case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { - _vm->_celer.show_one(4); /* Not sitting down. */ - _vm->_trip.tr[1].visible = true; /* But standing up. */ - _vm->_trip.apped(1, 4); /* And walking away. */ + _vm->_celer->show_one(4); /* Not sitting down. */ + _vm->_trip->tr[1].visible = true; /* But standing up. */ + _vm->_trip->apped(1, 4); /* And walking away. */ _vm->_gyro->dna.sitting_in_pub = false; /* Really not sitting down. */ _vm->_gyro->dna.user_moves_avvy = true; /* And ambulant. */ } else @@ -754,93 +754,93 @@ void Acci::stand_up() { void Acci::getproc(char thing) { switch (_vm->_gyro->dna.room) { case r__yours: - if (_vm->_trip.infield(2)) { + if (_vm->_trip->infield(2)) { if (_vm->_gyro->dna.box_contents == thing) { - _vm->_celer.show_one(5); - _vm->_scrolls.display("OK, I've got it."); + _vm->_celer->show_one(5); + _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->dna.obj[thing] = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); _vm->_gyro->dna.box_contents = nowt; - _vm->_celer.show_one(6); + _vm->_celer->show_one(6); } else - _vm->_scrolls.display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); + _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else - _vm->_visa.dixi('q', 57); + _vm->_visa->dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { case _vm->_gyro->pen: - if (_vm->_trip.infield(2)) { + if (_vm->_trip->infield(2)) { /* Standing on the dais. */ if (_vm->_gyro->dna.taken_pen) - _vm->_scrolls.display("It's not there, Avvy."); + _vm->_scrolls->display("It's not there, Avvy."); else { /* OK: we're taking the pen, and it's there. */ - _vm->_celer.show_one(4); /* No pen there now. */ - _vm->_trip.call_special(3); /* Zap! */ + _vm->_celer->show_one(4); /* No pen there now. */ + _vm->_trip->call_special(3); /* Zap! */ _vm->_gyro->dna.taken_pen = true; _vm->_gyro->dna.obj[_vm->_gyro->pen] = true; - _vm->_lucerna.objectlist(); - _vm->_scrolls.display("Taken."); + _vm->_lucerna->objectlist(); + _vm->_scrolls->display("Taken."); } } else if (_vm->_gyro->dna.standing_on_dais) - _vm->_visa.dixi('q', 53); + _vm->_visa->dixi('q', 53); else - _vm->_visa.dixi('q', 51); + _vm->_visa->dixi('q', 51); break; case _vm->_gyro->bolt: - _vm->_visa.dixi('q', 52); + _vm->_visa->dixi('q', 52); break; default: - _vm->_visa.dixi('q', 57); + _vm->_visa->dixi('q', 57); } break; case r__robins: - if ((thing == _vm->_gyro->mushroom) & (_vm->_trip.infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { - _vm->_celer.show_one(3); - _vm->_scrolls.display("Got it!"); + if ((thing == _vm->_gyro->mushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { + _vm->_celer->show_one(3); + _vm->_scrolls->display("Got it!"); _vm->_gyro->dna.mushroom_growing = false; _vm->_gyro->dna.taken_mushroom = true; _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = true; - _vm->_lucerna.objectlist(); - _vm->_lucerna.points(3); + _vm->_lucerna->objectlist(); + _vm->_lucerna->points(3); } else - _vm->_visa.dixi('q', 57); + _vm->_visa->dixi('q', 57); break; default: - _vm->_visa.dixi('q', 57); + _vm->_visa->dixi('q', 57); } } void Acci::give_geida_the_lute() { if (_vm->_gyro->dna.room != r__lustiesroom) { - _vm->_scrolls.display("Not yet. Try later!\232\2"); + _vm->_scrolls->display("Not yet. Try later!\232\2"); return; } _vm->_gyro->dna.obj[_vm->_gyro->lute] = false; - _vm->_lucerna.objectlist(); - _vm->_visa.dixi('q', 64); /* She plays it. */ + _vm->_lucerna->objectlist(); + _vm->_visa->dixi('q', 64); /* She plays it. */ /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); - _vm->_enid.back_to_bootstrap(4); + _vm->_enid->back_to_bootstrap(4); } void Acci::play_harp() { - if (_vm->_trip.infield(7)) - _vm->_scrolls.musical_scroll(); + if (_vm->_trip->infield(7)) + _vm->_scrolls->musical_scroll(); else - _vm->_scrolls.display("Get a bit closer to it, Avvy!"); + _vm->_scrolls->display("Get a bit closer to it, Avvy!"); } void Acci::winsequence() { - _vm->_visa.dixi('q', 78); - _vm->_sequence.first_show(7); - _vm->_sequence.then_show(8); - _vm->_sequence.then_show(9); - _vm->_sequence.start_to_close(); + _vm->_visa->dixi('q', 78); + _vm->_sequence->first_show(7); + _vm->_sequence->then_show(8); + _vm->_sequence->then_show(9); + _vm->_sequence->start_to_close(); _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); } @@ -858,15 +858,15 @@ void Acci::person_speaks() { } if (_vm->_gyro->whereis[person] != _vm->_gyro->dna.room) { - _vm->_scrolls.display("\231\4"); /* Avvy _vm->_gyro->himself! */ + _vm->_scrolls->display("\231\4"); /* Avvy _vm->_gyro->himself! */ return; } found = false; /* The person we're looking for's code is in Person. */ - for (fv = 1; fv <= _vm->_trip.numtr; fv++) { - if (_vm->_trip.tr[fv].quick && ((_vm->_trip.tr[fv].a.accinum + 149) == person)) { - _vm->_scrolls.display(Common::String('\23') + char(fv + 48) + '\4'); + for (fv = 1; fv <= _vm->_trip->numtr; fv++) { + if (_vm->_trip->tr[fv].quick && ((_vm->_trip->tr[fv].a.accinum + 149) == person)) { + _vm->_scrolls->display(Common::String('\23') + char(fv + 48) + '\4'); found = true; } } @@ -875,7 +875,7 @@ void Acci::person_speaks() { for (fv = 10; fv <= 25; fv++) { _vm->_gyro->quasipeds[fv]; if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) { - _vm->_scrolls.display(Common::String('\23') + char(fv + 55) + '\4'); + _vm->_scrolls->display(Common::String('\23') + char(fv + 55) + '\4'); } } } @@ -883,7 +883,7 @@ void Acci::person_speaks() { void Acci::heythanks() { person_speaks(); - _vm->_scrolls.display("Hey, thanks!\2(But now, you've lost it!)"); + _vm->_scrolls->display("Hey, thanks!\2(But now, you've lost it!)"); _vm->_gyro->dna.obj[thing] = false; } @@ -908,7 +908,7 @@ void Acci::do_that() { !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, vb_highscores, vb_smartalec, eos).has(verb))) { - _vm->_scrolls.display(Common::String("You're dead, so don't talk. What are you, a ghost ") + + _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost ") + "or something? Try restarting, or restoring a saved game!"); return; } @@ -917,7 +917,7 @@ void Acci::do_that() { !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { - _vm->_scrolls.display("Talking in your sleep? Try waking up!"); + _vm->_scrolls->display("Talking in your sleep? Try waking up!"); return; } */ @@ -931,37 +931,37 @@ void Acci::do_that() { opendoor(); break; case vb_pause: - _vm->_scrolls.display(Common::String("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + + _vm->_scrolls->display(Common::String("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + "the mouse on the `O.K.\" box to continue."); break; case vb_get: if (thing != pardon) { /* Legitimate try to pick something up. */ if (_vm->_gyro->dna.carrying >= maxobjs) - _vm->_scrolls.display("You can't carry any more!"); + _vm->_scrolls->display("You can't carry any more!"); else getproc(thing); } else { /* Not... ditto. */ if (person != pardon) - _vm->_scrolls.display("You can't sweep folk off their feet!"); + _vm->_scrolls->display("You can't sweep folk off their feet!"); else - _vm->_scrolls.display("I assure you, you don't need it."); + _vm->_scrolls->display("I assure you, you don't need it."); } break; case vb_drop: - _vm->_scrolls.display(Common::String("Two years ago you dropped a florin in the street. Three days ") + + _vm->_scrolls->display(Common::String("Two years ago you dropped a florin in the street. Three days ") + "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; - /* begin _vm->_gyro->dna.obj[thing]:=false; _vm->_lucerna.objectlist(); end;*/ + /* begin _vm->_gyro->dna.obj[thing]:=false; _vm->_lucerna->objectlist(); end;*/ case vb_inv: inv(); break; case vb_talk: if (person == pardon) { if (_vm->_gyro->subjnumber == 99) /* They typed "say passuint16". */ - _vm->_scrolls.display("Yes, but what \6is\22 the passuint16?"); + _vm->_scrolls->display("Yes, but what \6is\22 the passuint16?"); /* else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { Delete(thats, 1, 1); @@ -973,38 +973,38 @@ void Acci::do_that() { person = _vm->_gyro->subjnumber; subjnumber = 0; if (set::of(pardon, '\0', eos).has(person)) - _vm->_scrolls.display("Talk to whom?"); + _vm->_scrolls->display("Talk to whom?"); else if (personshere()) talkto(ord(person)); } */ else if (person == pardon) - _vm->_scrolls.display("Talk to whom?"); + _vm->_scrolls->display("Talk to whom?"); } else if (personshere()) - _vm->_visa.talkto(person); + _vm->_visa->talkto(person); break; case vb_give: if (holding()) { if (person == pardon) - _vm->_scrolls.display("Give to whom?"); + _vm->_scrolls->display("Give to whom?"); else if (personshere()) { switch (thing) { case _vm->_gyro->money : - _vm->_scrolls.display("You can't bring yourself to give away your moneybag."); + _vm->_scrolls->display("You can't bring yourself to give away your moneybag."); break; case _vm->_gyro->bodkin: case _vm->_gyro->bell: case _vm->_gyro->clothes: case _vm->_gyro->habit : - _vm->_scrolls.display("Don't give it away, it might be useful!"); + _vm->_scrolls->display("Don't give it away, it might be useful!"); break; default: switch (person) { case _vm->_gyro->pcrapulus: switch (thing) { case _vm->_gyro->wine: - _vm->_scrolls.display("Crapulus grabs the wine and gulps it down."); + _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; break; default: @@ -1013,7 +1013,7 @@ void Acci::do_that() { break; case _vm->_gyro->pcwytalot: /*if (set::of(crossbow, bolt, eos).has(thing)) - _vm->_scrolls.display(Common::String("You might be able to influence ") + + _vm->_scrolls->display(Common::String("You might be able to influence ") + "Cwytalot more if you used it!"); else */heythanks(); break; @@ -1023,13 +1023,13 @@ void Acci::do_that() { break; case _vm->_gyro->pibythneth: if (thing == _vm->_gyro->badge) { - _vm->_visa.dixi('q', 32); /* Thanks! Wow! */ - _vm->_lucerna.points(3); + _vm->_visa->dixi('q', 32); /* Thanks! Wow! */ + _vm->_lucerna->points(3); _vm->_gyro->dna.obj[_vm->_gyro->badge] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit] = true; _vm->_gyro->dna.givenbadgetoiby = true; - _vm->_celer.show_one(8); - _vm->_celer.show_one(9); + _vm->_celer->show_one(8); + _vm->_celer->show_one(9); } else heythanks(); break; @@ -1037,24 +1037,24 @@ void Acci::do_that() { if (_vm->_gyro->dna.ayles_is_awake) { if (thing == _vm->_gyro->pen) { _vm->_gyro->dna.obj[_vm->_gyro->pen] = false; - _vm->_visa.dixi('q', 54); + _vm->_visa->dixi('q', 54); _vm->_gyro->dna.obj[_vm->_gyro->ink] = true; _vm->_gyro->dna.given_pen_to_ayles = true; - _vm->_lucerna.objectlist(); - _vm->_lucerna.points(2); + _vm->_lucerna->objectlist(); + _vm->_lucerna->points(2); } else heythanks(); } else - _vm->_scrolls.display("But he's asleep!"); + _vm->_scrolls->display("But he's asleep!"); break; case _vm->_gyro->pgeida: switch (thing) { case _vm->_gyro->potion: _vm->_gyro->dna.obj[_vm->_gyro->potion] = false; - _vm->_visa.dixi('u', 16); /* She drinks it. */ - _vm->_lucerna.points(2); + _vm->_visa->dixi('u', 16); /* She drinks it. */ + _vm->_lucerna->points(2); _vm->_gyro->dna.geida_given_potion = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); break; case _vm->_gyro->lute: give_geida_the_lute(); @@ -1069,7 +1069,7 @@ void Acci::do_that() { if (_vm->_gyro->dna.geida_given_potion) winsequence(); else - _vm->_visa.dixi('q', 77); + _vm->_visa->dixi('q', 77); break; /* That Geida woman! */ default: heythanks(); @@ -1080,7 +1080,7 @@ void Acci::do_that() { } } } - _vm->_lucerna.objectlist(); /* Just in case... */ + _vm->_lucerna->objectlist(); /* Just in case... */ } break; @@ -1090,98 +1090,98 @@ void Acci::do_that() { swallow(); break; case vb_load: - _vm->_enid.edna_load(realwords[2]); + _vm->_enid->edna_load(realwords[2]); break; case vb_save: if (_vm->_gyro->alive) - _vm->_enid.edna_save(realwords[2]); + _vm->_enid->edna_save(realwords[2]); else - _vm->_scrolls.display("It's a bit late now to save your game!"); + _vm->_scrolls->display("It's a bit late now to save your game!"); break; case vb_pay: - _vm->_scrolls.display("No money need change hands."); + _vm->_scrolls->display("No money need change hands."); break; case vb_look: lookaround(); break; case vb_break: - _vm->_scrolls.display("Vandalism is prohibited within this game!"); + _vm->_scrolls->display("Vandalism is prohibited within this game!"); break; case vb_quit: /* quit */ //if (_vm->_gyro->demo) { - // _vm->_visa.dixi('q', 31); + // _vm->_visa->dixi('q', 31); // close(demofile); // exit(0); /* Change this later!!! */ //} if (!polite) - _vm->_scrolls.display("How about a `please\", Avvy?"); - else if (_vm->_scrolls.ask("\23C\26Do you really want to quit?")) + _vm->_scrolls->display("How about a `please\", Avvy?"); + else if (_vm->_scrolls->ask("\23C\26Do you really want to quit?")) _vm->_gyro->lmo = true; break; case vb_go: - _vm->_scrolls.display("Just use the arrow keys to walk there."); + _vm->_scrolls->display("Just use the arrow keys to walk there."); break; case vb_info: - _vm->_scrolls.aboutscroll = true; - /* _vm->_scrolls.display('Thorsoft of Letchworth presents:'+^c+^m+^m+ + _vm->_scrolls->aboutscroll = true; + /* _vm->_scrolls->display('Thorsoft of Letchworth presents:'+^c+^m+^m+ 'The medival descendant of'+^m+ 'Denarius Avaricius Sextus'+^m+'in:'+ ^m+^m+'LORD AVALOT D''ARGENT'+ ^m+'version '+vernum+^m+^m+'Copyright ' +copyright+', Mark, Mike and Thomas Thurman.');*/ - _vm->_scrolls.display(Common::String("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + + _vm->_scrolls->display(Common::String("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + "The medival descendant of" + '\15' + "Denarius Avaricius Sextus" + '\15' + '\15' + "version " + _vm->_gyro->vernum + '\15' + '\15' + "Copyright " + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); - _vm->_scrolls.aboutscroll = false; + _vm->_scrolls->aboutscroll = false; break; case vb_undress: if (_vm->_gyro->dna.wearing == nowt) - _vm->_scrolls.display("You're already stark naked!"); + _vm->_scrolls->display("You're already stark naked!"); else if (_vm->_gyro->dna.avvys_in_the_cupboard) { - _vm->_scrolls.display(Common::String("You take off ") + _vm->_gyro->get_better(_vm->_gyro->dna.wearing) + '.'); + _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->get_better(_vm->_gyro->dna.wearing) + '.'); _vm->_gyro->dna.wearing = nowt; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); } else - _vm->_scrolls.display("Hadn't you better find somewhere more private, Avvy?"); + _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); break; case vb_wear: if (holding()) { /* wear something */ switch (thing) { case _vm->_gyro->chastity: - _vm->_scrolls.display("Hey, what kind of a weirdo are you\??!"); + _vm->_scrolls->display("Hey, what kind of a weirdo are you\??!"); break; case _vm->_gyro->clothes: case _vm->_gyro->habit: /* Change this! */ if (_vm->_gyro->dna.wearing != nowt) { if (_vm->_gyro->dna.wearing == thing) - _vm->_scrolls.display("You're already wearing that."); + _vm->_scrolls->display("You're already wearing that."); else - _vm->_scrolls.display(Common::String("You'll be rather warm wearing two ") + + _vm->_scrolls->display(Common::String("You'll be rather warm wearing two ") + "sets of clothes!"); return; } else _vm->_gyro->dna.wearing = thing; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); if (thing == _vm->_gyro->habit) fv = 3; else fv = 0; - if (_vm->_trip.tr[1].whichsprite != fv) { - sx = _vm->_trip.tr[1].x; - sy = _vm->_trip.tr[1].y; - _vm->_trip.tr[1].done(); - _vm->_trip.tr[1].init(fv, true, &_vm->_trip); - _vm->_trip.tr[1].appear(sx, sy, _vm->_trip.left); - _vm->_trip.tr[1].visible = false; + if (_vm->_trip->tr[1].whichsprite != fv) { + sx = _vm->_trip->tr[1].x; + sy = _vm->_trip->tr[1].y; + _vm->_trip->tr[1].done(); + _vm->_trip->tr[1].init(fv, true, _vm->_trip); + _vm->_trip->tr[1].appear(sx, sy, _vm->_trip->left); + _vm->_trip->tr[1].visible = false; } break; default: - _vm->_scrolls.display(what); + _vm->_scrolls->display(what); } } break; @@ -1199,38 +1199,38 @@ void Acci::do_that() { } else if (holding()) { switch (thing) { case _vm->_gyro->lute : - _vm->_visa.dixi('U', 7); + _vm->_visa->dixi('U', 7); if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot] == _vm->_gyro->dna.room) - _vm->_visa.dixi('U', 10); + _vm->_visa->dixi('U', 10); if (_vm->_gyro->whereis[_vm->_gyro->pdulustie] == _vm->_gyro->dna.room) - _vm->_visa.dixi('U', 15); + _vm->_visa->dixi('U', 15); break; case 52: if (_vm->_gyro->dna.room == r__musicroom) play_harp(); else - _vm->_scrolls.display(what); + _vm->_scrolls->display(what); break; case 55: if (_vm->_gyro->dna.room == r__argentpub) ; /*play_nim(); - Don't implement yet.*/ else - _vm->_scrolls.display(what); + _vm->_scrolls->display(what); break; default: - _vm->_scrolls.display(what); + _vm->_scrolls->display(what); } } break; case vb_ring: if (holding()) { if (thing == _vm->_gyro->bell) { - _vm->_scrolls.display("Ding, dong, ding, dong, ding, dong, ding, dong..."); + _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls.display("(Are you trying to join in, Avvy\?\?!)"); + _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); } else - _vm->_scrolls.display(what); + _vm->_scrolls->display(what); } break; case vb_help: @@ -1238,10 +1238,10 @@ void Acci::do_that() { // I don't want to implement help yet. break; case vb_larrypass: - _vm->_scrolls.display("Wrong game!"); + _vm->_scrolls->display("Wrong game!"); break; case vb_phaon: - _vm->_scrolls.display("Hello, Phaon!"); + _vm->_scrolls->display("Hello, Phaon!"); break; case vb_boss: // bosskey(); @@ -1249,72 +1249,72 @@ void Acci::do_that() { break; case vb_pee: if (_vm->_gyro->flagset('P')) { - _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); + _vm->_scrolls->display("Hmm, I don't think anyone will notice..."); _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else - _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); + _vm->_scrolls->display("It would be \6VERY\22 unwise to do that here, Avvy!"); break; case vb_cheat: - _vm->_scrolls.display(Common::String('\6') + "Cheat mode now enabled."); + _vm->_scrolls->display(Common::String('\6') + "Cheat mode now enabled."); _vm->_gyro->cheat = true; break; case vb_magic: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa.dixi('q', 19); + _vm->_visa->dixi('q', 19); else { - if ((_vm->_gyro->dna.room == 12) & (_vm->_trip.infield(2))) { + if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { /* Avaricius appears! */ - _vm->_visa.dixi('q', 17); + _vm->_visa->dixi('q', 17); if (_vm->_gyro->whereis['\227'] == 12) - _vm->_visa.dixi('q', 18); + _vm->_visa->dixi('q', 18); else { - _vm->_trip.tr[2].init(1, false, &_vm->_trip); /* Avaricius */ - _vm->_trip.apped(2, 4); - _vm->_trip.tr[2].walkto(5); - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procback_and_forth; + _vm->_trip->tr[2].init(1, false, _vm->_trip); /* Avaricius */ + _vm->_trip->apped(2, 4); + _vm->_trip->tr[2].walkto(5); + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procback_and_forth; _vm->_gyro->dna.avaricius_talk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } } else - _vm->_scrolls.display("Nothing appears to happen..."); + _vm->_scrolls->display("Nothing appears to happen..."); } break; case vb_smartalec: - _vm->_scrolls.display("Listen, smart alec, that was just rhetoric."); + _vm->_scrolls->display("Listen, smart alec, that was just rhetoric."); break; case vb_expletive: switch (_vm->_gyro->dna.swore) { case 0: - _vm->_scrolls.display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + + _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + "(I shouldn't say it again, if I were you!)"); break; case 1: - _vm->_scrolls.display(Common::String("You hear a distant rumble of thunder. Must you always ") + + _vm->_scrolls->display(Common::String("You hear a distant rumble of thunder. Must you always ") + "do things I tell you not to?\r\rDon't do it again!"); break; default: _vm->_pingo->zonk(); - _vm->_scrolls.display(Common::String("A crack of lightning shoots from the sky, ") + + _vm->_scrolls->display(Common::String("A crack of lightning shoots from the sky, ") + "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); - _vm->_lucerna.gameover(); + _vm->_lucerna->gameover(); } _vm->_gyro->dna.swore++; break; case vb_listen: if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls.display(Common::String("All other noise is drowned out by the ringing of ") + + _vm->_scrolls->display(Common::String("All other noise is drowned out by the ringing of ") + "the bells."); else if (_vm->_gyro->listen == "") - _vm->_scrolls.display("You can't hear anything much at the moment, Avvy."); + _vm->_scrolls->display("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls.display(_vm->_gyro->listen); + _vm->_scrolls->display(_vm->_gyro->listen); break; case vb_buy: /* What are they trying to buy? */ switch (_vm->_gyro->dna.room) { case r__argentpub: - if (_vm->_trip.infield(6)) { + if (_vm->_trip->infield(6)) { /* We're in a pub, and near the bar. */ switch (thing) { case '\63': @@ -1322,22 +1322,22 @@ void Acci::do_that() { case '\66': case '\72': /* Beer, whisky, cider or mead */ if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ - _vm->_visa.dixi('D', 15); + _vm->_visa->dixi('D', 15); return; } if (_vm->_gyro->dna.teetotal) { - _vm->_visa.dixi('D', 6); + _vm->_visa->dixi('D', 6); return; } if (_vm->_gyro->dna.alcohol == 0) - _vm->_lucerna.points(3); - _vm->_celer.show_one(12); - _vm->_scrolls.display(booze[thing] + ", please.\231\2"); + _vm->_lucerna->points(3); + _vm->_celer->show_one(12); + _vm->_scrolls->display(booze[thing] + ", please.\231\2"); _vm->_gyro->dna.drinking = thing; - _vm->_celer.show_one(10); + _vm->_celer->show_one(10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; @@ -1346,23 +1346,23 @@ void Acci::do_that() { break; /* We have a right one here- buy Pepsi??! */ case _vm->_gyro->wine: if (_vm->_gyro->dna.obj[_vm->_gyro->wine]) /* We've already got the wine! */ - _vm->_visa.dixi('D', 2); /* 1 bottle's shufishent! */ + _vm->_visa->dixi('D', 2); /* 1 bottle's shufishent! */ else { if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ - _vm->_visa.dixi('D', 15); + _vm->_visa->dixi('D', 15); return; } if (_vm->_gyro->dna.carrying >= maxobjs) { - _vm->_scrolls.display("Your hands are full."); + _vm->_scrolls->display("Your hands are full."); return; } - _vm->_celer.show_one(12); - _vm->_scrolls.display("Wine, please.\231\2"); + _vm->_celer->show_one(12); + _vm->_scrolls->display("Wine, please.\231\2"); if (_vm->_gyro->dna.alcohol == 0) - _vm->_lucerna.points(3); - _vm->_celer.show_one(10); + _vm->_lucerna->points(3); + _vm->_celer->show_one(10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); @@ -1370,41 +1370,41 @@ void Acci::do_that() { break; } } else - _vm->_visa.dixi('D', 5); + _vm->_visa->dixi('D', 5); break; /* Go to the bar! */ case r__outsideducks: - if (_vm->_trip.infield(6)) { + if (_vm->_trip->infield(6)) { if (thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.obj[_vm->_gyro->onion]) - _vm->_visa.dixi('D', 10); /* not planning to juggle with the things! */ + _vm->_visa->dixi('D', 10); /* not planning to juggle with the things! */ else if (_vm->_gyro->dna.carrying >= maxobjs) - _vm->_scrolls.display("Before you ask, you remember that your hands are full."); + _vm->_scrolls->display("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->dna.bought_onion) - _vm->_visa.dixi('D', 11); + _vm->_visa->dixi('D', 11); else { - _vm->_visa.dixi('D', 9); - _vm->_lucerna.points(3); + _vm->_visa->dixi('D', 9); + _vm->_lucerna->points(3); } _vm->_gyro->pennycheck(3); /* It costs thruppence. */ _vm->_gyro->dna.obj[_vm->_gyro->onion] = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); _vm->_gyro->dna.bought_onion = true; _vm->_gyro->dna.rotten_onion = false; /* It's OK when it leaves the stall! */ _vm->_gyro->dna.onion_in_vinegar = false; } } else - _vm->_visa.dixi('D', 0); + _vm->_visa->dixi('D', 0); } else - _vm->_visa.dixi('D', 0); + _vm->_visa->dixi('D', 0); break; case r__nottspub: - _vm->_visa.dixi('n', 15); + _vm->_visa->dixi('n', 15); break; /* Can't sell to southerners. */ default: - _vm->_visa.dixi('D', 0); /* Can't buy that. */ + _vm->_visa->dixi('D', 0); /* Can't buy that. */ } break; case vb_attack: @@ -1415,39 +1415,39 @@ void Acci::do_that() { /* 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. */ case 0: - _vm->_visa.dixi('Q', 10); - _vm->_scrolls.display("(At the very least, don't use your bare hands!)"); + _vm->_visa->dixi('Q', 10); + _vm->_scrolls->display("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls.display(Common::String("Attack _vm->_gyro->him with only a crossbow bolt? Are you ") + + _vm->_scrolls->display(Common::String("Attack _vm->_gyro->him with only a crossbow bolt? Are you ") + "planning on playing darts?!"); break; case 2: - _vm->_scrolls.display(Common::String("Come on, Avvy! You're not going to get very far ") + + _vm->_scrolls->display(Common::String("Come on, Avvy! You're not going to get very far ") + "with only a crossbow!"); break; case 3: - _vm->_visa.dixi('Q', 11); + _vm->_visa->dixi('Q', 11); _vm->_gyro->dna.cwytalot_gone = true; _vm->_gyro->dna.obj[_vm->_gyro->bolt] = false; _vm->_gyro->dna.obj[_vm->_gyro->crossbow] = false; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); _vm->_gyro->magics[12].op = _vm->_gyro->nix; - _vm->_lucerna.points(7); - _vm->_trip.tr[2].walkto(2); - _vm->_trip.tr[2].vanishifstill = true; - _vm->_trip.tr[2].call_eachstep = false; + _vm->_lucerna->points(7); + _vm->_trip->tr[2].walkto(2); + _vm->_trip->tr[2].vanishifstill = true; + _vm->_trip->tr[2].call_eachstep = false; _vm->_gyro->whereis['\235'] = 177; break; default: - _vm->_visa.dixi('Q', 10); /* Please try not to be so violent! */ + _vm->_visa->dixi('Q', 10); /* Please try not to be so violent! */ } } else - _vm->_visa.dixi('Q', 10); + _vm->_visa->dixi('Q', 10); break; case vb_password: if (_vm->_gyro->dna.room != r__bridge) - _vm->_visa.dixi('Q', 12); + _vm->_visa->dixi('Q', 12); else { ok = true; for (ff = 1; ff <= thats.size(); ff++) { @@ -1461,25 +1461,25 @@ void Acci::do_that() { if (ok) { if (_vm->_gyro->dna.drawbridge_open != 0) - _vm->_scrolls.display("Contrary to your expectations, the drawbridge fails to close again."); + _vm->_scrolls->display("Contrary to your expectations, the drawbridge fails to close again."); else { - _vm->_lucerna.points(4); - _vm->_scrolls.display("The drawbridge opens!"); + _vm->_lucerna->points(4); + _vm->_scrolls->display("The drawbridge opens!"); _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); _vm->_gyro->dna.drawbridge_open = 1; } } else - _vm->_visa.dixi('Q', 12); + _vm->_visa->dixi('Q', 12); } break; case vb_dir: - _vm->_enid.dir(realwords[2]); + _vm->_enid->dir(realwords[2]); break; case vb_die: - _vm->_lucerna.gameover(); + _vm->_lucerna->gameover(); break; case vb_score: - _vm->_scrolls.display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ",\3\rout of a " + + _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ",\3\rout of a " + "possible 128.\r\rThis gives you a rank of " + rank() + ".\r\r" + totaltime()); break; @@ -1492,23 +1492,23 @@ void Acci::do_that() { case vb_kiss: if (person == pardon) - _vm->_scrolls.display("Kiss whom?"); + _vm->_scrolls->display("Kiss whom?"); else if (personshere()) { switch (person) { case _vm->_gyro->parkata: - _vm->_visa.dixi('U', 12); + _vm->_visa->dixi('U', 12); break; case _vm->_gyro->pgeida: - _vm->_visa.dixi('U', 13); + _vm->_visa->dixi('U', 13); break; case _vm->_gyro->pwisewoman: - _vm->_visa.dixi('U', 14); + _vm->_visa->dixi('U', 14); break; default: - _vm->_visa.dixi('U', 5); /* You WHAT? */ + _vm->_visa->dixi('U', 5); /* You WHAT? */ } } else if ((150 <= person) && (person <= 174)) - _vm->_scrolls.display("Hey, what kind of a weirdo are you??"); + _vm->_scrolls->display("Hey, what kind of a weirdo are you??"); break; @@ -1516,7 +1516,7 @@ void Acci::do_that() { if (_vm->_gyro->dna.room == r__insidecardiffcastle) cardiff_climbing(); else /* In the wrong room! */ - _vm->_scrolls.display("Not with your head for heights, Avvy!"); + _vm->_scrolls->display("Not with your head for heights, Avvy!"); break; case vb_jump: @@ -1537,66 +1537,66 @@ void Acci::do_that() { case '\0': if (!_vm->_gyro->dna.avvy_is_awake) { _vm->_gyro->dna.avvy_is_awake = true; - _vm->_lucerna.points(1); + _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer.show_one(3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->show_one(3); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) - _vm->_visa.dixi('d', 13); + _vm->_visa->dixi('d', 13); } else - _vm->_scrolls.display("You're already awake, Avvy!"); + _vm->_scrolls->display("You're already awake, Avvy!"); break; case _vm->_gyro->payles: if (!_vm->_gyro->dna.ayles_is_awake) - _vm->_scrolls.display("You can't seem to wake _vm->_gyro->him by yourself."); + _vm->_scrolls->display("You can't seem to wake _vm->_gyro->him by yourself."); break; case _vm->_gyro->pjacques: - _vm->_scrolls.display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + + _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + "Hmmm... that doesn't seem to do any good..."); break; default: - _vm->_scrolls.display("It's difficult to awaken people who aren't asleep...!"); + _vm->_scrolls->display("It's difficult to awaken people who aren't asleep...!"); } break; case vb_sit: if (_vm->_gyro->dna.room == r__nottspub) { if (_vm->_gyro->dna.sitting_in_pub) - _vm->_scrolls.display("You're already sitting!"); + _vm->_scrolls->display("You're already sitting!"); else { - _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ + _vm->_trip->tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } } else { /* Default doodah. */ - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->hang_around_for_a_while(); - _vm->_lucerna.dawn(); - _vm->_scrolls.display("A few hours later...\20nothing much has happened..."); + _vm->_lucerna->dawn(); + _vm->_scrolls->display("A few hours later...\20nothing much has happened..."); } break; case vb_restart: - if (_vm->_scrolls.ask("Restart game and lose changes?")) { - _vm->_lucerna.dusk(); + if (_vm->_scrolls->ask("Restart game and lose changes?")) { + _vm->_lucerna->dusk(); _vm->_gyro->newgame(); - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); } break; case pardon: - _vm->_scrolls.display("Hey, a verb would be helpful!"); + _vm->_scrolls->display("Hey, a verb would be helpful!"); break; case vb_hello: person_speaks(); - _vm->_scrolls.display("Hello.\2"); + _vm->_scrolls->display("Hello.\2"); break; case vb_thanks: person_speaks(); - _vm->_scrolls.display("That's OK.\2"); + _vm->_scrolls->display("That's OK.\2"); break; default: - _vm->_scrolls.display(Common::String('\7') + "Parser bug!"); + _vm->_scrolls->display(Common::String('\7') + "Parser bug!"); } } diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 5650146414b7..40cda48af160 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -130,7 +130,7 @@ class Acci { - void setParent(AvalancheEngine *vm); + Acci(AvalancheEngine *vm); void init(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index e490ace48a48..919481679c54 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -63,8 +63,18 @@ AvalancheEngine::~AvalancheEngine() { delete _enhanced; delete _logger; delete _pingo; - + delete _scrolls; + delete _visa; + delete _lucerna; + delete _enid; + delete _celer; + delete _sequence; delete _timeout; + delete _trip; + delete _acci; + delete _basher; + delete _dropdown; + delete _closing; } Common::ErrorCode AvalancheEngine::initialize() { @@ -75,25 +85,25 @@ Common::ErrorCode AvalancheEngine::initialize() { _enhanced = new Enhanced(this); _logger = new Logger(this); _pingo = new Pingo(this); - _scrolls.setParent(this); - _visa.setParent(this); - _lucerna.setParent(this); - _enid.setParent(this); - _celer.setParent(this); - _sequence.setParent(this); + _scrolls = new Scrolls(this); + _visa = new Visa(this); + _lucerna = new Lucerna(this); + _enid = new Enid(this); + _celer = new Celer(this); + _sequence = new Sequence(this); _timeout = new Timeout(this); - _trip.setParent(this); - _acci.setParent(this); - _basher.setParent(this); - _dropdown.setParent(this); - _closing.setParent(this); + _trip = new Trip(this); + _acci = new Acci(this); + _basher = new Basher(this); + _dropdown = new Dropdown(this); + _closing = new Closing(this); _graphics->init(); - _scrolls.init(); - _lucerna.init(); - _acci.init(); - _basher.init(); + _scrolls->init(); + _lucerna->init(); + _acci->init(); + _basher->init(); return Common::kNoError; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 66bfd22ae582..f43b6a7a0697 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -72,18 +72,18 @@ class AvalancheEngine : public Engine { Enhanced *_enhanced; Logger *_logger; Pingo *_pingo; - Scrolls _scrolls; - Visa _visa; - Lucerna _lucerna; - Enid _enid; - Celer _celer; - Sequence _sequence; + Scrolls *_scrolls; + Visa *_visa; + Lucerna *_lucerna; + Enid *_enid; + Celer *_celer; + Sequence *_sequence; Timeout *_timeout; - Trip _trip; - Acci _acci; - Basher _basher; - Dropdown _dropdown; - Closing _closing; + Trip *_trip; + Acci *_acci; + Basher *_basher; + Dropdown *_dropdown; + Closing *_closing; OSystem *_system; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 64f679fea0c2..4674ceacaa5a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -69,16 +69,16 @@ void Avalot::setup() { _vm->_gyro->visible = _vm->_gyro->m_no; _vm->_gyro->to_do = 0; _vm->_gyro->lmo = false; - _vm->_scrolls.resetscroll(); + _vm->_scrolls->resetscroll(); _vm->_gyro->setup_vmc(); _vm->_gyro->on_virtual(); gd = 3; gm = 0; //initgraph(gd: gm: ""); _vm->_gyro->holdthedawn = true; - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->cmp = 177; - _vm->_lucerna.mouse_init(); /*on;*/ + _vm->_lucerna->mouse_init(); /*on;*/ _vm->_gyro->dropsok = true; _vm->_gyro->ctrl = ckey; _vm->_gyro->oldjw = 177; @@ -86,7 +86,7 @@ void Avalot::setup() { _vm->_gyro->c = 999; //settextjustify(0: 0); _vm->_gyro->ddmnow = false; - _vm->_lucerna.load_digits(); + _vm->_lucerna->load_digits(); _vm->_gyro->cheat = false; _vm->_gyro->cp = 0; _vm->_gyro->curpos = 1; @@ -96,8 +96,8 @@ void Avalot::setup() { /* TSkellern:=0; { Replace with a more local variable sometime }*/ _vm->_gyro->dna.rw = _vm->_gyro->stopped; _vm->_gyro->enid_filename = ""; /* undefined. */ - _vm->_lucerna.toolbar(); - _vm->_scrolls.state(2); + _vm->_lucerna->toolbar(); + _vm->_scrolls->state(2); _vm->_graphics->refreshScreen(); //_vm->_pingo->copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) _vm->_gyro->lastscore[i] = -1; /* impossible digits */ @@ -107,7 +107,7 @@ void Avalot::setup() { setactivepage(gd); outtextxy(7:177:chr(48+gd)); end;*/ - _vm->_trip.loadtrip(); + _vm->_trip->loadtrip(); _vm->_gyro->reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game. @@ -115,18 +115,18 @@ void Avalot::setup() { _vm->_gyro->newgame(); /* no game was requested- load the default */ else { if (! _vm->_gyro->reloaded) - _vm->_enid.avvy_background(); - _vm->_dropdown.standard_bar(); - _vm->_lucerna.sprite_run(); + _vm->_enid->avvy_background(); + _vm->_dropdown->standard_bar(); + _vm->_lucerna->sprite_run(); if (_vm->_gyro->reloaded) - _vm->_enid.edna_reload(); + _vm->_enid->edna_reload(); else { /* Filename given on the command line (or loadfirst) */ - _vm->_enid.edna_load(_vm->_gyro->filetoload); - if (_vm->_enid.there_was_a_problem()) { - _vm->_scrolls.display("So let's start from the beginning instead..."); + _vm->_enid->edna_load(_vm->_gyro->filetoload); + if (_vm->_enid->there_was_a_problem()) { + _vm->_scrolls->display("So let's start from the beginning instead..."); _vm->_gyro->holdthedawn = true; - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->newgame(); } } @@ -134,21 +134,21 @@ void Avalot::setup() { if (! _vm->_gyro->reloaded) { _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; - _vm->_lucerna.fxtoggle(); - _vm->_lucerna.thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); + _vm->_lucerna->fxtoggle(); + _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); } - _vm->_trip.get_back_loretta(); + _vm->_trip->get_back_loretta(); //gm = getpixel(0: 0); //setcolor(7); _vm->_gyro->holdthedawn = false; - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); _vm->_gyro->cursoron = false; - _vm->_basher.cursor_on(); - _vm->_trip.newspeed(); + _vm->_basher->cursor_on(); + _vm->_trip->newspeed(); if (! _vm->_gyro->reloaded) - _vm->_visa.dixi('q', 83); /* Info on the game: etc. */ + _vm->_visa->dixi('q', 83); /* Info on the game: etc. */ } @@ -169,7 +169,7 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_HOME: case Common::KEYCODE_END: case Common::KEYCODE_KP5: - _vm->_trip.handleMoveKey(event); // Fallthroughs are intended. + _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. break; } } @@ -180,19 +180,19 @@ void Avalot::run(Common::String arg) { setup(); do { - _vm->_lucerna.clock_lucerna(); - _vm->_basher.keyboard_link(); - _vm->_dropdown.menu_link(); - _vm->_trip.readstick(); + _vm->_lucerna->clock_lucerna(); + _vm->_basher->keyboard_link(); + _vm->_dropdown->menu_link(); + _vm->_trip->readstick(); _vm->_gyro->force_numlock(); - _vm->_trip.get_back_loretta(); - _vm->_trip.trippancy_link(); - _vm->_celer.pics_link(); - _vm->_lucerna.checkclick(); + _vm->_trip->get_back_loretta(); + _vm->_trip->trippancy_link(); + _vm->_celer->pics_link(); + _vm->_lucerna->checkclick(); if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->plot_vmc(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->cp); - _vm->_lucerna.flip_page(); /* <<_lucerna->flip_page(); /* <<_gyro->slowdown(); if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->wipe_vmc(_vm->_gyro->cp); @@ -213,7 +213,7 @@ void Avalot::run(Common::String arg) { //if (logging) // close(logfile); - _vm->_closing.end_of_program(); + _vm->_closing->end_of_program(); } } // End of namespace Avalanche diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 3f2b01bdb62c..0ce98e71feda 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -50,7 +50,7 @@ namespace Avalanche { -void Basher::setParent(AvalancheEngine *vm) { +Basher::Basher(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index 1a97a8568ee5..eadf3dd3b107 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -45,7 +45,7 @@ class Basher { - void setParent(AvalancheEngine *vm); + Basher(AvalancheEngine *vm); void init(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index e73f51c835c4..3cedb67a7ad8 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -42,12 +42,9 @@ namespace Avalanche { const int16 Celer::on_disk = -1; -Celer::Celer() { - num_chunks = 0; -} - -void Celer::setParent(AvalancheEngine *vm) { +Celer::Celer(AvalancheEngine *vm) { _vm = vm; + num_chunks = 0; } void Celer::pics_link() { @@ -121,11 +118,11 @@ void Celer::pics_link() { } if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { /* Normally. */ - if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) + if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) xx = 3; - else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) + else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) xx = 2; - else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) + else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) xx = 4; if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ @@ -160,11 +157,11 @@ void Celer::pics_link() { xx = 4; /* du Lustie blinks */ /* Bearing of Avvy from du Lustie. */ - else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) xx = 1; /* Middle. */ - else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) xx = 2; /* Left. */ - else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) xx = 3; /* Right. */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ @@ -202,11 +199,11 @@ void Celer::pics_link() { case r__nottspub: /* Bearing of Avvy from Port. */ - if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) + if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) xx = 2; /* Middle. */ - else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) + else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) xx = 6; /* Left. */ - else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) + else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) xx = 8; /* Right. */ if ((_vm->_gyro->roomtime % int32(60)) > 57) @@ -231,12 +228,12 @@ void Celer::pics_link() { if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */ show_one(1 + (_vm->_gyro->roomtime / 3) % 3); - {/* _vm->_lucerna.bearing of Avvy from Duck. */ - if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + {/* _vm->_lucerna->bearing of Avvy from Duck. */ + if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) xx = 4; /* Middle. */ - else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) xx = 6; /* Left. */ - else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) xx = 8; /* Right. */ if ((_vm->_gyro->roomtime % int32(45)) > 42) @@ -468,7 +465,7 @@ void Celer::show_one(byte which) { warning("STUB: Celer::show_one()"); for (byte fv = 0; fv < 2; fv ++) - _vm->_trip.getset[fv].remember(r); + _vm->_trip->getset[fv].remember(r); } @@ -517,7 +514,7 @@ void Celer::show_one_at(byte which, int16 xxx, int16 yyy) { warning("STUB: Celer::show_one_at()"); for (byte fv = 0; fv < 2; fv ++) - _vm->_trip.getset[fv].remember(r); + _vm->_trip->getset[fv].remember(r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 88baa3df5e37..1d350054a2f2 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -65,9 +65,8 @@ class Celer { bytefield r; - Celer(); - void setParent(AvalancheEngine *vm); + Celer(AvalancheEngine *vm); void pics_link(); diff --git a/engines/avalanche/closing2.cpp b/engines/avalanche/closing2.cpp index 3336a5f954ed..431b1af82e1b 100644 --- a/engines/avalanche/closing2.cpp +++ b/engines/avalanche/closing2.cpp @@ -38,12 +38,9 @@ namespace Avalanche { -Closing::Closing() { - warning("STUB: Closing::Closing()"); -} - -void Closing::setParent(AvalancheEngine *vm) { +Closing::Closing(AvalancheEngine *vm) { _vm = vm; + warning("STUB: Closing::Closing()"); } void Closing::get_screen(byte which) { diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index 122a8e23a9ac..ed73f9f32190 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -43,9 +43,7 @@ class Closing { static const int16 scr_nagscreen = 3; static const int16 scr_twocopies = 5; - Closing(); - - void setParent(AvalancheEngine *vm); + Closing(AvalancheEngine *vm); void quit_with(byte which, byte errorlev); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 985eb7f08861..134a3b0905e1 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -206,7 +206,7 @@ void menuset::update() { ddms[fv].display(); for (page_ = 0; page_ <= 1; page_ ++) - _dr->_vm->_trip.getset[page_].remember(menuspace); + _dr->_vm->_trip->getset[page_].remember(menuspace); _dr->_vm->_gyro->cp = savecp; } @@ -246,7 +246,7 @@ void menuset::getmenu(int16 x) { -void Dropdown::setParent(AvalancheEngine *vm) { +Dropdown::Dropdown(AvalancheEngine *vm) { _vm = vm; } @@ -255,26 +255,26 @@ void Dropdown::find_what_you_can_do_with_it() { case _vm->_gyro->wine: case _vm->_gyro->potion: case _vm->_gyro->ink: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_drink; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_drink; break; case _vm->_gyro->bell: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_ring; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_ring; break; case _vm->_gyro->chastity: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_wear; break; case _vm->_gyro->lute: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_play; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_play; break; case _vm->_gyro->mushroom: case _vm->_gyro->onion: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_eat; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_eat; break; case _vm->_gyro->clothes: - _vm->_gyro->verbstr = Common::String(_vm->_acci.vb_exam) + _vm->_acci.vb_wear; + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_wear; break; default: - _vm->_gyro->verbstr = _vm->_acci.vb_exam; /* anything else */ + _vm->_gyro->verbstr = _vm->_acci->vb_exam; /* anything else */ } } @@ -310,7 +310,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { } } - _vm->_lucerna.blitfix(); + _vm->_lucerna->blitfix(); } void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { @@ -418,12 +418,12 @@ void Dropdown::ddm__action() { ddm_o.opt(Common::String(n.c_str() + 2, 253), n[1], "f5", true); ddm_o.opt("Pause game", 'P', "f6", true); if (_vm->_gyro->dna.room == 99) - ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip.neardoor()); + ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip->neardoor()); else - ddm_o.opt("Open the door", 'O', "f7", _vm->_trip.neardoor()); + ddm_o.opt("Open the door", 'O', "f7", _vm->_trip->neardoor()); ddm_o.opt("Look around", 'L', "f8", true); ddm_o.opt("Inventory", 'I', "Tab", true); - if (_vm->_trip.tr[1].xs == _vm->_gyro->walk) + if (_vm->_trip->tr[1].xs == _vm->_gyro->walk) ddm_o.opt("Run fast", 'R', "^R", true); else ddm_o.opt("Walk slowly", 'W', "^W", true); @@ -501,19 +501,19 @@ void Dropdown::do__game() { switch (ddm_o.choicenum) { /* Help, boss, untrash screen. */ case 0: - _vm->_lucerna.callverb(_vm->_acci.vb_help); + _vm->_lucerna->callverb(_vm->_acci->vb_help); break; case 1: - _vm->_lucerna.callverb(_vm->_acci.vb_boss); + _vm->_lucerna->callverb(_vm->_acci->vb_boss); break; case 2: - _vm->_lucerna.major_redraw(); + _vm->_lucerna->major_redraw(); break; case 3: - _vm->_lucerna.callverb(_vm->_acci.vb_score); + _vm->_lucerna->callverb(_vm->_acci->vb_score); break; case 4: - _vm->_lucerna.callverb(_vm->_acci.vb_info); + _vm->_lucerna->callverb(_vm->_acci->vb_info); break; } } @@ -522,26 +522,26 @@ void Dropdown::do__file() { switch (ddm_o.choicenum) { /* New game, load, save, save as, DOS shell, about, quit. */ case 0: - _vm->_lucerna.callverb(_vm->_acci.vb_restart); + _vm->_lucerna->callverb(_vm->_acci->vb_restart); break; case 1: { - _vm->_acci.realwords[2] = ""; - _vm->_lucerna.callverb(_vm->_acci.vb_load); + _vm->_acci->realwords[2] = ""; + _vm->_lucerna->callverb(_vm->_acci->vb_load); } break; case 2: { - _vm->_acci.realwords[2] = ""; - _vm->_lucerna.callverb(_vm->_acci.vb_save); + _vm->_acci->realwords[2] = ""; + _vm->_lucerna->callverb(_vm->_acci->vb_save); } break; case 3: - _vm->_basher.filename_edit(); + _vm->_basher->filename_edit(); break; case 4: - _vm->_enid.back_to_bootstrap(2); + _vm->_enid->back_to_bootstrap(2); break; case 5: - _vm->_lucerna.callverb(_vm->_acci.vb_quit); + _vm->_lucerna->callverb(_vm->_acci->vb_quit); break; } } @@ -551,99 +551,99 @@ void Dropdown::do__action() { switch (ddm_o.choicenum) { /* Get up/pause game/open door/look/inv/walk-run */ case 0: { - _vm->_acci.person = _vm->_acci.pardon; - _vm->_acci.thing = _vm->_acci.pardon; + _vm->_acci->person = _vm->_acci->pardon; + _vm->_acci->thing = _vm->_acci->pardon; n = _vm->_gyro->f5_does(); - _vm->_lucerna.callverb(n[1]); + _vm->_lucerna->callverb(n[1]); } break; case 1: - _vm->_lucerna.callverb(_vm->_acci.vb_pause); + _vm->_lucerna->callverb(_vm->_acci->vb_pause); break; case 2: - _vm->_lucerna.callverb(_vm->_acci.vb_open); + _vm->_lucerna->callverb(_vm->_acci->vb_open); break; case 3: - _vm->_lucerna.callverb(_vm->_acci.vb_look); + _vm->_lucerna->callverb(_vm->_acci->vb_look); break; case 4: - _vm->_lucerna.callverb(_vm->_acci.vb_inv); + _vm->_lucerna->callverb(_vm->_acci->vb_inv); break; case 5: { - if (_vm->_trip.tr[1].xs == _vm->_gyro->walk) _vm->_trip.tr[1].xs = _vm->_gyro->run; - else _vm->_trip.tr[1].xs = _vm->_gyro->walk; - _vm->_trip.newspeed(); + if (_vm->_trip->tr[1].xs == _vm->_gyro->walk) _vm->_trip->tr[1].xs = _vm->_gyro->run; + else _vm->_trip->tr[1].xs = _vm->_gyro->walk; + _vm->_trip->newspeed(); } break; } } void Dropdown::do__objects() { - _vm->_lucerna.thinkabout(_vm->_gyro->objlist[ddm_o.choicenum + 1], _vm->_gyro->a_thing); + _vm->_lucerna->thinkabout(_vm->_gyro->objlist[ddm_o.choicenum + 1], _vm->_gyro->a_thing); } void Dropdown::do__people() { - _vm->_lucerna.thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro->a_person); + _vm->_lucerna->thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro->a_person); _vm->_gyro->last_person = people[ddm_o.choicenum + 1]; } void Dropdown::do__with() { - _vm->_acci.thing = _vm->_gyro->thinks; + _vm->_acci->thing = _vm->_gyro->thinks; if (_vm->_gyro->thinkthing) { - _vm->_acci.thing += 49; + _vm->_acci->thing += 49; - if (_vm->_gyro->verbstr[ddm_o.choicenum + 1] == _vm->_acci.vb_give) - _vm->_acci.person = _vm->_gyro->last_person; + if (_vm->_gyro->verbstr[ddm_o.choicenum + 1] == _vm->_acci->vb_give) + _vm->_acci->person = _vm->_gyro->last_person; else - _vm->_acci.person = '\376'; + _vm->_acci->person = '\376'; } else { switch (_vm->_gyro->verbstr[ddm_o.choicenum + 1]) { case '\144': { - _vm->_acci.thing = '\144'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\144'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Beer */ case '\145': { - _vm->_acci.thing = '\62'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\62'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Wine */ case '\146': { - _vm->_acci.thing = '\146'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\146'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Whisky */ case '\147': { - _vm->_acci.thing = '\147'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\147'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Cider */ case '\150': { - _vm->_acci.thing = '\153'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\153'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Mead */ case '\151': { - _vm->_acci.thing = '\103'; - _vm->_lucerna.callverb(_vm->_acci.vb_buy); + _vm->_acci->thing = '\103'; + _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } break; /* Onion (trader) */ default: { - _vm->_acci.person = _vm->_acci.thing; - _vm->_acci.thing = '\376'; + _vm->_acci->person = _vm->_acci->thing; + _vm->_acci->thing = '\376'; } } } - _vm->_lucerna.callverb(_vm->_gyro->verbstr[ddm_o.choicenum + 1]); + _vm->_lucerna->callverb(_vm->_gyro->verbstr[ddm_o.choicenum + 1]); } /*$F- That's all. Now for the ...bar funcs. */ diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index abcc81b155a2..51be377bebc1 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -122,8 +122,6 @@ class Dropdown { friend onemenu; friend menuset; - void setParent(AvalancheEngine *vm); - onemenu ddm_o; menuset ddm_m; @@ -131,6 +129,8 @@ class Dropdown { + Dropdown(AvalancheEngine *vm); + void find_what_you_can_do_with_it(); void parsekey(char r, char re); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 7284b888b4e2..9b67359ff0fc 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -45,7 +45,7 @@ namespace Avalanche { -void Enid::setParent(AvalancheEngine *vm) { +Enid::Enid(AvalancheEngine *vm) { _vm = vm; } @@ -117,7 +117,7 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { } void Enid::show_bug(char icon, Common::String strn) { - _vm->_scrolls.display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); + _vm->_scrolls->display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); } bool Enid::test_bug(byte what) { @@ -150,9 +150,9 @@ void Enid::edna_save(Common::String name) { void Enid::loaderror(Common::String x, char icon) { if (_vm->_gyro->holdthedawn) { _vm->_gyro->holdthedawn = false; - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); } - _vm->_scrolls.display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); + _vm->_scrolls->display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); bug = true; } @@ -161,7 +161,7 @@ void Enid::edna_load(Common::String name) { } void Enid::showheader() { - _vm->_scrolls.display(Common::String("Dir: ") + path + "\r\r\4"); + _vm->_scrolls->display(Common::String("Dir: ") + path + "\r\r\4"); } void Enid::dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */ @@ -246,7 +246,7 @@ void Enid::avvy_background() { /* Not really a filing procedure, @the_end: end; */ - _vm->_lucerna.blitfix(); + _vm->_lucerna->blitfix(); } void Enid::to_sundry(sundry &sund) { @@ -277,17 +277,17 @@ void Enid::edna_reload() { _vm->_gyro->seescroll = true; /* This prevents display of the new sprites before the new picture is loaded. */ - _vm->_lucerna.major_redraw(); + _vm->_lucerna->major_redraw(); _vm->_gyro->whereis[_vm->_gyro->pavalot] = _vm->_gyro->dna.room; _vm->_gyro->alive = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); if (_vm->_gyro->holdthedawn) { _vm->_gyro->holdthedawn = false; - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); } } diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 87b81d39913e..6fac687ac0e6 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -38,7 +38,7 @@ class AvalancheEngine; class Enid { public: - void setParent(AvalancheEngine *vm); + Enid(AvalancheEngine *vm); void edna_save(Common::String name); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index dd1157b6285c..f759f8931314 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -348,19 +348,19 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ for (byte gm = 0; gm < numtr; gm ++) { - if (_vm->_trip.tr[gm].quick) - _vm->_trip.tr[gm].done(); + if (_vm->_trip->tr[gm].quick) + _vm->_trip->tr[gm].done(); } /* Deallocate sprite. Sorry, beta testers! */ - _vm->_trip.tr[0].init(0, true, &_vm->_trip); + _vm->_trip->tr[0].init(0, true, _vm->_trip); alive = true; score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); - _vm->_scrolls.natural(); - _vm->_basher.normal_edit(); - _vm->_lucerna.mousepage(0); + _vm->_scrolls->natural(); + _vm->_basher->normal_edit(); + _vm->_lucerna->mousepage(0); dna.spare_evening = "answer a questionnaire"; dna.like2drink = "beer"; @@ -372,12 +372,12 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ dna.obj[clothes] = true; thinks = 2; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); ontoolbar = false; seescroll = false; ppos[0][1] = -177; - _vm->_trip.tr[0].appear(300,117,right); + _vm->_trip->tr[0].appear(300,117,right); //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; @@ -393,16 +393,16 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ for (byte gd = 0; gd <= 1; gd ++) { cp = 1 - cp; - _vm->_trip.getback(); + _vm->_trip->getback(); } - _vm->_lucerna.enterroom(1, 1); - _vm->_trip.new_game_for_trippancy(); - _vm->_lucerna.showscore(); + _vm->_lucerna->enterroom(1, 1); + _vm->_trip->new_game_for_trippancy(); + _vm->_lucerna->showscore(); - _vm->_dropdown.standard_bar(); - _vm->_lucerna.clock_lucerna(); - _vm->_lucerna.sprite_run(); + _vm->_dropdown->standard_bar(); + _vm->_lucerna->clock_lucerna(); + _vm->_lucerna->sprite_run(); } void Gyro::click() { /* "Audio keyboard feedback" */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c11a2454bb9d..1d22deb9752b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -54,9 +54,7 @@ namespace Avalanche { -Lucerna::Lucerna() : fxhidden(false) {} - -void Lucerna::setParent(AvalancheEngine *vm) { +Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { _vm = vm; } @@ -68,16 +66,16 @@ void Lucerna::init() { } void Lucerna::callverb(char n) { - if (n == _vm->_acci.pardon) { - _vm->_scrolls.display(Common::String("The f5 key lets you do a particular action in certain ") + + if (n == _vm->_acci->pardon) { + _vm->_scrolls->display(Common::String("The f5 key lets you do a particular action in certain ") + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + "current setting of this key is."); } else { _vm->_gyro->weirdword = false; - _vm->_acci.polite = true; - _vm->_acci.verb = n; - _vm->_acci.do_that(); + _vm->_acci->polite = true; + _vm->_acci->verb = n; + _vm->_acci->do_that(); } } @@ -272,7 +270,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); - _vm->_celer.load_chunks(xx); + _vm->_celer->load_chunks(xx); _vm->_graphics->refreshScreen(); // _vm->_pingo->copy03(); - See Avalot::setup() @@ -307,7 +305,7 @@ void Lucerna::find_people(byte room) { void Lucerna::exitroom(byte x) { //nosound(); - _vm->_celer.forget_chunks(); + _vm->_celer->forget_chunks(); _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ switch (x) { @@ -340,7 +338,7 @@ void Lucerna::exitroom(byte x) { } void Lucerna::new_town() { /* You've just entered a town from the map. */ - _vm->_dropdown.standard_bar(); + _vm->_dropdown->standard_bar(); switch (_vm->_gyro->dna.room) { case r__outsidenottspub: /* Entry into Nottingham. */ @@ -371,10 +369,10 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ void Lucerna::put_geida_at(byte whichped, byte &ped) { if (ped == 0) return; - _vm->_trip.tr[2].init(5, false, &_vm->_trip); /* load Geida */ - _vm->_trip.apped(2, whichped); - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procgeida_procs; + _vm->_trip->tr[2].init(5, false, _vm->_trip); /* load Geida */ + _vm->_trip->apped(2, whichped); + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procgeida_procs; } void Lucerna::enterroom(byte x, byte ped) { @@ -405,7 +403,7 @@ void Lucerna::enterroom(byte x, byte ped) { switch (x) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } break; @@ -415,25 +413,25 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.talked_to_crapulus) { _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__outsideyours; - _vm->_trip.tr[2].init(8, false, &_vm->_trip); /* load Crapulus */ + _vm->_trip->tr[2].init(8, false, _vm->_trip); /* load Crapulus */ if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { - _vm->_trip.apped(2, 4); /* Start on the right-hand side of the screen. */ - _vm->_trip.tr[2].walkto(5); /* Walks up to greet you. */ + _vm->_trip->apped(2, 4); /* Start on the right-hand side of the screen. */ + _vm->_trip->tr[2].walkto(5); /* Walks up to greet you. */ } else { - _vm->_trip.apped(2, 5); /* Starts where he was before. */ - _vm->_trip.tr[2].face = 3; + _vm->_trip->apped(2, 5); /* Starts where he was before. */ + _vm->_trip->tr[2].face = 3; } - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procface_avvy; /* He always faces Avvy. */ + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procface_avvy; /* He always faces Avvy. */ } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__nowhere; if (_vm->_gyro->dna.crapulus_will_tell) { - _vm->_trip.tr[2].init(8, false, &_vm->_trip); - _vm->_trip.apped(2, 2); - _vm->_trip.tr[2].walkto(4); + _vm->_trip->tr[2].init(8, false, _vm->_trip); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[2].walkto(4); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->dna.crapulus_will_tell = false; } @@ -452,15 +450,15 @@ void Lucerna::enterroom(byte x, byte ped) { case r__spludwicks: if (_vm->_gyro->dna.spludwicks_here) { if (ped > 0) { - _vm->_trip.tr[2].init(2, false, &_vm->_trip); /* load Spludwick */ - _vm->_trip.apped(2, 2); + _vm->_trip->tr[2].init(2, false, _vm->_trip); /* load Spludwick */ + _vm->_trip->apped(2, 2); _vm->_gyro->whereis['\227'] = r__spludwicks; } _vm->_gyro->dna.dogfoodpos = 0; /* _vm->_gyro->also Spludwick pos. */ - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procgeida_procs; + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procgeida_procs; } else _vm->_gyro->whereis['\227'] = r__nowhere; break; @@ -471,18 +469,18 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__nowhere; } else { if (ped > 0) { - _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot*/ - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procfollow_avvy_y; + _vm->_trip->tr[2].init(4, false, _vm->_trip); /* 4=Cwytalot*/ + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procfollow_avvy_y; _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__brummieroad; if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ - _vm->_trip.apped(2, 2); /* He appears on the right of the screen... */ - _vm->_trip.tr[2].walkto(4); /* ...and he walks up... */ + _vm->_trip->apped(2, 2); /* He appears on the right of the screen... */ + _vm->_trip->tr[2].walkto(4); /* ...and he walks up... */ } else { /* You've been here before. */ - _vm->_trip.apped(2, 4); /* He's standing in your way straight away... */ - _vm->_trip.tr[2].face = _vm->_trip.left; + _vm->_trip->apped(2, 4); /* He's standing in your way straight away... */ + _vm->_trip->tr[2].face = _vm->_trip->left; } } } @@ -493,10 +491,10 @@ void Lucerna::enterroom(byte x, byte ped) { dnatype &with = _vm->_gyro->dna; if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { - _vm->_trip.tr[2].init(4, false, &_vm->_trip); /* 4=Cwytalot again*/ - _vm->_trip.apped(2, 1); - _vm->_trip.tr[2].walkto(2); - _vm->_trip.tr[2].vanishifstill = true; + _vm->_trip->tr[2].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ + _vm->_trip->apped(2, 1); + _vm->_trip->tr[2].walkto(2); + _vm->_trip->tr[2].vanishifstill = true; with.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); @@ -506,7 +504,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ - _vm->_celer.show_one(3); /* Position of drawbridge */ + _vm->_celer->show_one(3); /* Position of drawbridge */ _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ @@ -517,9 +515,9 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { if (! _vm->_gyro->dna.been_tied_up) { /* A welcome party... or maybe not... */ - _vm->_trip.tr[2].init(6, false, &_vm->_trip); - _vm->_trip.apped(2, 2); - _vm->_trip.tr[2].walkto(3); + _vm->_trip->tr[2].init(6, false, _vm->_trip); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[2].walkto(3); _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -530,10 +528,10 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.tied_up) - _vm->_celer.show_one(2); + _vm->_celer->show_one(2); if (! _vm->_gyro->dna.mushroom_growing) - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); } break; @@ -541,9 +539,9 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) switch (_vm->_gyro->dna.cardiff_things) { case 0 : { /* You've answered NONE of his questions. */ - _vm->_trip.tr[2].init(9, false, &_vm->_trip); - _vm->_trip.apped(2, 2); - _vm->_trip.tr[2].walkto(3); + _vm->_trip->tr[2].init(9, false, _vm->_trip); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[2].walkto(3); _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; @@ -551,9 +549,9 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->magics[2].op = _vm->_gyro->nix; break; /* You've answered ALL his questions. => nothing happens. */ default: { /* You've answered SOME of his questions. */ - _vm->_trip.tr[2].init(9, false, &_vm->_trip); - _vm->_trip.apped(2, 3); - _vm->_trip.tr[2].face = _vm->_trip.right; + _vm->_trip->tr[2].init(9, false, _vm->_trip); + _vm->_trip->apped(2, 3); + _vm->_trip->tr[2].face = _vm->_trip->right; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -574,18 +572,18 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentpub: { - if (_vm->_gyro->dna.wonnim) _vm->_celer.show_one(1); /* No lute by the settle. */ + if (_vm->_gyro->dna.wonnim) _vm->_celer->show_one(1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { - _vm->_celer.show_one(8); - _vm->_celer.show_one(9); + _vm->_celer->show_one(8); + _vm->_celer->show_one(9); } } break; case r__lustiesroom: { _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ - if (_vm->_trip.tr[1].whichsprite == 0) /* Avvy in his normal clothes */ + if (_vm->_trip->tr[1].whichsprite == 0) /* Avvy in his normal clothes */ _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ /* Presumably, Avvy dressed as a monk. */ @@ -593,7 +591,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); - if (_vm->_gyro->dna.lustie_is_asleep) _vm->_celer.show_one(5); + if (_vm->_gyro->dna.lustie_is_asleep) _vm->_celer->show_one(5); } } break; @@ -601,96 +599,96 @@ void Lucerna::enterroom(byte x, byte ped) { case r__musicroom: { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; - _vm->_celer.show_one(2); - _vm->_celer.show_one(4); + _vm->_celer->show_one(2); + _vm->_celer->show_one(4); _vm->_gyro->magics[brown].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; } if (ped != 0) { - _vm->_celer.show_one(6); - _vm->_sequence.first_show(5); - _vm->_sequence.then_show(7); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(6); + _vm->_sequence->first_show(5); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); } } break; case r__outsidenottspub: if (ped == 2) { - _vm->_celer.show_one(3); - _vm->_sequence.first_show(2); - _vm->_sequence.then_show(1); - _vm->_sequence.then_show(4); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(3); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); + _vm->_sequence->then_show(4); + _vm->_sequence->start_to_close(); } break; case r__outsideargentpub: if (ped == 2) { - _vm->_celer.show_one(6); - _vm->_sequence.first_show(5); - _vm->_sequence.then_show(7); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(6); + _vm->_sequence->first_show(5); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); } break; case r__wisewomans: { - _vm->_trip.tr[2].init(11, false, &_vm->_trip); + _vm->_trip->tr[2].init(11, false, _vm->_trip); if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip.apped(2, 2); /* Start on the right-hand side of the screen. */ - _vm->_trip.tr[2].walkto(4); /* Walks up to greet you. */ + _vm->_trip->apped(2, 2); /* Start on the right-hand side of the screen. */ + _vm->_trip->tr[2].walkto(4); /* Walks up to greet you. */ } else { - _vm->_trip.apped(2, 4); /* Starts where she was before. */ - _vm->_trip.tr[2].face = 3; + _vm->_trip->apped(2, 4); /* Starts where she was before. */ + _vm->_trip->tr[2].face = 3; } - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procface_avvy; /* She always faces Avvy. */ + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procface_avvy; /* She always faces Avvy. */ } break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_trip.tr[2].init(10, false, &_vm->_trip); /* Define the dart. */ - _vm->_sequence.first_show(1); + _vm->_trip->tr[2].init(10, false, _vm->_trip); /* Define the dart. */ + _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) - _vm->_sequence.then_show(3); + _vm->_sequence->then_show(3); else - _vm->_sequence.then_show(2); + _vm->_sequence->then_show(2); if (_vm->_gyro->dna.taken_pen) - _vm->_celer.show_one(4); + _vm->_celer->show_one(4); - _vm->_sequence.start_to_close(); + _vm->_sequence->start_to_close(); } else { - _vm->_celer.show_one(1); - if (_vm->_gyro->dna.arrow_in_the_door) _vm->_celer.show_one(3); - else _vm->_celer.show_one(2); + _vm->_celer->show_one(1); + if (_vm->_gyro->dna.arrow_in_the_door) _vm->_celer->show_one(3); + else _vm->_celer->show_one(2); } break; case r__avvysgarden: if (ped == 1) { - _vm->_celer.show_one(2); - _vm->_sequence.first_show(1); - _vm->_sequence.then_show(3); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(2); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(3); + _vm->_sequence->start_to_close(); } break; case r__entrancehall: case r__insideabbey: if (ped == 2) { - _vm->_celer.show_one(2); - _vm->_sequence.first_show(1); - _vm->_sequence.then_show(3); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(2); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(3); + _vm->_sequence->start_to_close(); } break; case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) - _vm->_celer.show_one(2); + _vm->_celer->show_one(2); break; /* Ayles awake. */ case r__geidas: @@ -707,7 +705,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__nottspub: { - if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer.show_one(3); + if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->show_one(3); _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ } break; @@ -715,11 +713,11 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideducks: if (ped == 2) { /* Shut the door */ - _vm->_celer.show_one(3); - _vm->_sequence.first_show(2); - _vm->_sequence.then_show(1); - _vm->_sequence.then_show(4); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(3); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); + _vm->_sequence->then_show(4); + _vm->_sequence->start_to_close(); } break; case r__ducks: @@ -779,7 +777,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * setactivepage(1 - cp);*/ for (byte fv = 0; fv <= 1; fv ++) - _vm->_trip.getset[fv].remember(thinkspace); + _vm->_trip->getset[fv].remember(thinkspace); _vm->_gyro->on(); _vm->_gyro->thinkthing = th; @@ -862,7 +860,7 @@ void Lucerna::showscore() { _vm->_graphics->drawPicture(_vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) - _vm->_trip.getset[fv].remember(scorespace); + _vm->_trip->getset[fv].remember(scorespace); //setactivepage(1 - cp); @@ -887,7 +885,7 @@ void Lucerna::points(byte num) { /* Add on no. of points */ void Lucerna::topcheck() { /* Menuset */ - _vm->_dropdown.ddm_m.getmenu(_vm->_gyro->mpx); + _vm->_dropdown->ddm_m.getmenu(_vm->_gyro->mpx); /* Do this one */ } @@ -943,46 +941,46 @@ void Lucerna::verte() { return; - /* _vm->_trip.tr[0] : that's the only one we're interested in here */ - if (_vm->_gyro->mx < _vm->_trip.tr[0].x) + /* _vm->_trip->tr[0] : that's the only one we're interested in here */ + if (_vm->_gyro->mx < _vm->_trip->tr[0].x) what = 1; - else if (_vm->_gyro->mx > (unsigned char)(_vm->_trip.tr[0].x + _vm->_trip.tr[0]._info.xl)) + else if (_vm->_gyro->mx > (unsigned char)(_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info.xl)) what = 2; else what = 0; /* On top */ - if (_vm->_gyro->my < _vm->_trip.tr[0].y) + if (_vm->_gyro->my < _vm->_trip->tr[0].y) what += 3; - else if (_vm->_gyro->my > (unsigned char)(_vm->_trip.tr[0].y + _vm->_trip.tr[0]._info.yl)) + else if (_vm->_gyro->my > (unsigned char)(_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info.yl)) what += 6; switch (what) { case 0: - _vm->_trip.stopwalking(); + _vm->_trip->stopwalking(); break; /* Clicked on Avvy- no movement */ case 1: - _vm->_trip.rwsp(1, _vm->_trip.left); + _vm->_trip->rwsp(1, _vm->_trip->left); break; case 2: - _vm->_trip.rwsp(1, _vm->_trip.right); + _vm->_trip->rwsp(1, _vm->_trip->right); break; case 3: - _vm->_trip.rwsp(1, _vm->_trip.up); + _vm->_trip->rwsp(1, _vm->_trip->up); break; case 4: - _vm->_trip.rwsp(1, _vm->_trip.ul); + _vm->_trip->rwsp(1, _vm->_trip->ul); break; case 5: - _vm->_trip.rwsp(1, _vm->_trip.ur); + _vm->_trip->rwsp(1, _vm->_trip->ur); break; case 6: - _vm->_trip.rwsp(1, _vm->_trip.down); + _vm->_trip->rwsp(1, _vm->_trip->down); break; case 7: - _vm->_trip.rwsp(1, _vm->_trip.dl); + _vm->_trip->rwsp(1, _vm->_trip->dl); break; case 8: - _vm->_trip.rwsp(1, _vm->_trip.dr); + _vm->_trip->rwsp(1, _vm->_trip->dr); break; } /* no other values are possible... */ @@ -1209,7 +1207,7 @@ void Lucerna::delavvy() { _vm->_gyro->off(); - triptype &with = _vm->_trip.tr[0]; + triptype &with = _vm->_trip->tr[0]; for (page_ = 0; page_ <= 1; page_ ++) mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); @@ -1223,16 +1221,16 @@ void Lucerna::gameover() { _vm->_gyro->dna.user_moves_avvy = false; - sx = _vm->_trip.tr[1].x; - sy = _vm->_trip.tr[1].y; + sx = _vm->_trip->tr[1].x; + sy = _vm->_trip->tr[1].y; - _vm->_trip.tr[1].done(); - _vm->_trip.tr[1].init(12, true, &_vm->_trip); /* 12 = Avalot falls */ - _vm->_trip.tr[1].step = 0; - _vm->_trip.tr[1].appear(sx, sy, 0); + _vm->_trip->tr[1].done(); + _vm->_trip->tr[1].init(12, true, _vm->_trip); /* 12 = Avalot falls */ + _vm->_trip->tr[1].step = 0; + _vm->_trip->tr[1].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); - /* _vm->_scrolls.display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ + /* _vm->_scrolls->display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ _vm->_gyro->alive = false; } @@ -1247,7 +1245,7 @@ void Lucerna::minor_redraw() { for (fv = 0; fv <= 1; fv ++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; - _vm->_trip.getback(); + _vm->_trip->getback(); } for (byte i = 0; i < 3; i++) @@ -1268,16 +1266,16 @@ uint16 Lucerna::bearing(byte whichped) { uint16 bearing_result; { pedtype &with = _vm->_gyro->peds[whichped]; - if (_vm->_trip.tr[1].x == with.x) + if (_vm->_trip->tr[1].x == with.x) bearing_result = 0; /* This would cause a division by zero if we let it through. */ else { /* - bearing:=trunc(((arctan((_vm->_trip.tr[1].y-y)/(_vm->_trip.tr[1].x-x)))*rad2deg)+90) mod 360*/ + bearing:=trunc(((arctan((_vm->_trip->tr[1].y-y)/(_vm->_trip->tr[1].x-x)))*rad2deg)+90) mod 360*/ - if (_vm->_trip.tr[1].x < with.x) - bearing_result = (atan(double((_vm->_trip.tr[1].y - with.y)) / (_vm->_trip.tr[1].x - with.x)) * rad2deg) + 90; + if (_vm->_trip->tr[1].x < with.x) + bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 90; else - bearing_result = (atan(double((_vm->_trip.tr[1].y - with.y)) / (_vm->_trip.tr[1].x - with.x)) * rad2deg) + 270; + bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 270; } } return bearing_result; @@ -1293,8 +1291,8 @@ void Lucerna::sprite_run() { _vm->_gyro->doing_sprite_run = true; for (fv = 0; fv <= 1; fv ++) { - _vm->_trip.get_back_loretta(); - _vm->_trip.trippancy_link(); + _vm->_trip->get_back_loretta(); + _vm->_trip->trippancy_link(); flip_page(); } @@ -1306,7 +1304,7 @@ void Lucerna::sprite_run() { void Lucerna::fix_flashers() { _vm->_gyro->ledstatus = 177; _vm->_gyro->oldrw = 177; - _vm->_scrolls.state(2); + _vm->_scrolls->state(2); showrw(); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 6a62a7d39e74..7486b0d3646a 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -38,9 +38,7 @@ class AvalancheEngine; class Lucerna { public: - Lucerna(); - - void setParent(AvalancheEngine *vm); + Lucerna(AvalancheEngine *vm); void init(); diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 7b341678be48..00c99788beb4 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -111,7 +111,7 @@ void Pingo::winning_pic() { Common::File f; char r; - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); if (!f.open("finale.avd")) { warning("AVALANCHE: Lucerna: File not found: finale.avd"); @@ -128,12 +128,12 @@ void Pingo::winning_pic() { warning("STUB: Pingo::winning_pic()"); f.close(); - _vm->_lucerna.blitfix(); + _vm->_lucerna->blitfix(); //setvisualpage(0); warning("STUB: Pingo::winning_pic()"); - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); /*do { _vm->_gyro->check(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 0a76168adad6..63358630c4cb 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -47,7 +47,7 @@ namespace Avalanche { -void Scrolls::setParent(AvalancheEngine *vm) { +Scrolls::Scrolls(AvalancheEngine *vm) { _vm = vm; } @@ -154,7 +154,7 @@ void Scrolls::resetscrolldriver() { /* phew */ void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ byte fv; - for (fv = 1; fv <= _vm->_gyro->scrollbells; fv ++) _vm->_lucerna.errorled(); /* ring the bell "x" times */ + for (fv = 1; fv <= _vm->_gyro->scrollbells; fv ++) _vm->_lucerna->errorled(); /* ring the bell "x" times */ } void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */ @@ -329,7 +329,7 @@ void Scrolls::musical_scroll() { display(Common::String("To play the harp...\r\rUse these keys:\r\n") + "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); - _vm->_lucerna.sprite_run(); + _vm->_lucerna->sprite_run(); was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 2536e66396d9..5fdbab7f8629 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -45,10 +45,10 @@ class Scrolls { + Scrolls(AvalancheEngine *vm); + void init(); - void setParent(AvalancheEngine *vm); - void state(byte x); /* Sets "Ready" light to whatever */ void drawscroll(func2 gotoit); /* This is one of the oldest funcs in the game. */ diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 5edb00a2be75..bdc809e5ca0e 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -39,7 +39,7 @@ namespace Avalanche { -void Sequence::setParent(AvalancheEngine *vm) { +Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; } @@ -77,7 +77,7 @@ void Sequence::start_to_close() { void Sequence::start_to_open() { _vm->_gyro->dna.user_moves_avvy = false; /* They can't move. */ - _vm->_trip.stopwalking(); /* And they're not moving now. */ + _vm->_trip->stopwalking(); /* And they're not moving now. */ start_to_close(); /* Apart from that, it's the same thing. */ } @@ -95,7 +95,7 @@ void Sequence::call_sequencer() { break; /* No more routines. */ case 177: _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip.fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); /* 177 = Flip room. */ + _vm->_trip->fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); /* 177 = Flip room. */ if (seq[0] == 177) shove_left(); break; @@ -103,7 +103,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer.show_one(seq[1]); + _vm->_celer->show_one(seq[1]); shove_left(); } diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h index 7bd79bc61bf4..d93cf426e017 100644 --- a/engines/avalanche/sequence2.h +++ b/engines/avalanche/sequence2.h @@ -46,7 +46,7 @@ class Sequence { byte seq[seq_length]; - void setParent(AvalancheEngine *vm); + Sequence(AvalancheEngine *vm); void first_show(byte what); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 9deae8458540..7a10d670cc37 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -142,13 +142,13 @@ void Timeout::one_tick() { jump(); break; case procsequence: - _vm->_sequence.call_sequencer(); + _vm->_sequence->call_sequencer(); break; case proccrapulus_splud_out: crapulus_says_splud_out(); break; case procdawn_delay: - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); break; case procbuydrinks: buydrinks(); @@ -239,7 +239,7 @@ end;*/ void Timeout::open_drawbridge() { _vm->_gyro->dna.drawbridge_open++; - _vm->_celer.show_one(_vm->_gyro->dna.drawbridge_open - 1); + _vm->_celer->show_one(_vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ @@ -250,39 +250,39 @@ void Timeout::open_drawbridge() { /* --- */ void Timeout::avaricius_talks() { - _vm->_visa.dixi('q', _vm->_gyro->dna.avaricius_talk); + _vm->_visa->dixi('q', _vm->_gyro->dna.avaricius_talk); _vm->_gyro->dna.avaricius_talk++; if (_vm->_gyro->dna.avaricius_talk < 17) set_up_timer(177, procavaricius_talks, reason_avariciustalks); else - _vm->_lucerna.points(3); + _vm->_lucerna->points(3); } void Timeout::urinate() { - _vm->_trip.tr[1].turn(_vm->_trip.up); - _vm->_trip.stopwalking(); - _vm->_lucerna.showrw(); + _vm->_trip->tr[1].turn(_vm->_trip->up); + _vm->_trip->stopwalking(); + _vm->_lucerna->showrw(); set_up_timer(14, proctoilet2, reason_gototoilet); } void Timeout::toilet2() { - _vm->_scrolls.display("That's better!"); + _vm->_scrolls->display("That's better!"); } void Timeout::bang() { - _vm->_scrolls.display("\6< BANG! >"); + _vm->_scrolls->display("\6< BANG! >"); set_up_timer(30, procbang2, reason_explosion); } void Timeout::bang2() { - _vm->_scrolls.display("Hmm... sounds like Spludwick's up to something..."); + _vm->_scrolls->display("Hmm... sounds like Spludwick's up to something..."); } void Timeout::stairs() { _vm->_gyro->blip(); - _vm->_trip.tr[0].walkto(4); - _vm->_celer.show_one(2); + _vm->_trip->tr[0].walkto(4); + _vm->_celer->show_one(2); _vm->_gyro->dna.brummie_stairs = 2; _vm->_gyro->magics[11].op = _vm->_gyro->special; _vm->_gyro->magics[11].data = 2; /* Reached the bottom of the stairs. */ @@ -293,68 +293,68 @@ void Timeout::cardiff_survey() { switch (_vm->_gyro->dna.cardiff_things) { case 0: _vm->_gyro->dna.cardiff_things += 1; - _vm->_visa.dixi('q', 27); + _vm->_visa->dixi('q', 27); break; } - _vm->_visa.dixi('z', _vm->_gyro->dna.cardiff_things); + _vm->_visa->dixi('z', _vm->_gyro->dna.cardiff_things); _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } void Timeout::cardiff_return() { - _vm->_visa.dixi('q', 28); + _vm->_visa->dixi('q', 28); cardiff_survey(); /* add end of question. */ } void Timeout::cwytalot_in_herts() { - _vm->_visa.dixi('q', 29); + _vm->_visa->dixi('q', 29); } void Timeout::get_tied_up() { - _vm->_visa.dixi('q', 34); /* ...Trouble! */ + _vm->_visa->dixi('q', 34); /* ...Trouble! */ _vm->_gyro->dna.user_moves_avvy = false; _vm->_gyro->dna.been_tied_up = true; - _vm->_trip.stopwalking(); - _vm->_trip.tr[2].stopwalk(); - _vm->_trip.tr[2].stophoming(); - _vm->_trip.tr[2].call_eachstep = true; - _vm->_trip.tr[2].eachstep = _vm->_trip.procgrab_avvy; + _vm->_trip->stopwalking(); + _vm->_trip->tr[2].stopwalk(); + _vm->_trip->tr[2].stophoming(); + _vm->_trip->tr[2].call_eachstep = true; + _vm->_trip->tr[2].eachstep = _vm->_trip->procgrab_avvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } void Timeout::get_tied_up2() { - _vm->_trip.tr[1].walkto(4); - _vm->_trip.tr[2].walkto(5); + _vm->_trip->tr[1].walkto(4); + _vm->_trip->tr[2].walkto(5); _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* No effect when you touch the boundaries. */ _vm->_gyro->dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { - _vm->_trip.tr[2].check_me = false; - _vm->_trip.tr[1].init(7, true, &_vm->_trip); /* Robin Hood */ + _vm->_trip->tr[2].check_me = false; + _vm->_trip->tr[1].init(7, true, _vm->_trip); /* Robin Hood */ _vm->_gyro->whereis[_vm->_gyro->probinhood] = r__robins; - _vm->_trip.apped(1, 2); - _vm->_visa.dixi('q', 39); - _vm->_trip.tr[1].walkto(7); + _vm->_trip->apped(1, 2); + _vm->_visa->dixi('q', 39); + _vm->_trip->tr[1].walkto(7); set_up_timer(55, prochang_around2, reason_hanging_around); } void Timeout::hang_around2() { - _vm->_visa.dixi('q', 40); - _vm->_trip.tr[2].vanishifstill = false; - _vm->_trip.tr[2].walkto(4); + _vm->_visa->dixi('q', 40); + _vm->_trip->tr[2].vanishifstill = false; + _vm->_trip->tr[2].walkto(4); _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = r__robins; - _vm->_visa.dixi('q', 41); - _vm->_trip.tr[1].done(); - _vm->_trip.tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + _vm->_visa->dixi('q', 41); + _vm->_trip->tr[1].done(); + _vm->_trip->tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately call the following proc (when you have a chance). */ _vm->_gyro->dna.tied_up = false; - _vm->_enid.back_to_bootstrap(1); /* Call the shoot-'em-up. */ + _vm->_enid->back_to_bootstrap(1); /* Call the shoot-'em-up. */ } void Timeout::after_the_shootemup() { @@ -366,17 +366,17 @@ void Timeout::jacques_wakes_up() { switch (_vm->_gyro->dna.jacques_awake) { /* Additional pictures. */ case 1 : - _vm->_celer.show_one(1); /* Eyes open. */ - _vm->_visa.dixi('Q', 45); + _vm->_celer->show_one(1); /* Eyes open. */ + _vm->_visa->dixi('Q', 45); break; case 2 : /* Going through the door. */ - _vm->_celer.show_one(2); /* Not on the floor. */ - _vm->_celer.show_one(3); /* But going through the door. */ + _vm->_celer->show_one(2); /* Not on the floor. */ + _vm->_celer->show_one(3); /* But going through the door. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* You can't wake him up now. */ break; case 3 : /* Gone through the door. */ - _vm->_celer.show_one(2); /* Not on the floor, either. */ - _vm->_celer.show_one(4); /* He's gone... so the door's open. */ + _vm->_celer->show_one(2); /* Not on the floor, either. */ + _vm->_celer->show_one(4); /* He's gone... so the door's open. */ _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; /* Gone! */ break; } @@ -385,7 +385,7 @@ void Timeout::jacques_wakes_up() { if (_vm->_gyro->dna.jacques_awake == 5) { _vm->_gyro->dna.ringing_bells = true; _vm->_gyro->dna.ayles_is_awake = true; - _vm->_lucerna.points(2); + _vm->_lucerna->points(2); } switch (_vm->_gyro->dna.jacques_awake) { @@ -403,29 +403,29 @@ void Timeout::jacques_wakes_up() { void Timeout::naughty_duke() { /* This is when the Duke comes in and takes your money. */ - _vm->_trip.tr[2].init(9, false, &_vm->_trip); /* Here comes the Duke. */ - _vm->_trip.apped(2, 1); /* He starts at the door... */ - _vm->_trip.tr[2].walkto(3); /* He walks over to you. */ + _vm->_trip->tr[2].init(9, false, _vm->_trip); /* Here comes the Duke. */ + _vm->_trip->apped(2, 1); /* He starts at the door... */ + _vm->_trip->tr[2].walkto(3); /* He walks over to you. */ /* Let's get the door opening. */ - _vm->_celer.show_one(1); - _vm->_sequence.first_show(2); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(1); + _vm->_sequence->first_show(2); + _vm->_sequence->start_to_close(); set_up_timer(50, procnaughty_duke2, reason_naughty_duke); } void Timeout::naughty_duke2() { - _vm->_visa.dixi('q', 48); /* Ha ha, it worked again! */ - _vm->_trip.tr[2].walkto(1); /* Walk to the door. */ - _vm->_trip.tr[2].vanishifstill = true; /* Then go away! */ + _vm->_visa->dixi('q', 48); /* Ha ha, it worked again! */ + _vm->_trip->tr[2].walkto(1); /* Walk to the door. */ + _vm->_trip->tr[2].vanishifstill = true; /* Then go away! */ set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } void Timeout::naughty_duke3() { - _vm->_celer.show_one(1); - _vm->_sequence.first_show(2); - _vm->_sequence.start_to_close(); + _vm->_celer->show_one(1); + _vm->_sequence->first_show(2); + _vm->_sequence->start_to_close(); } void Timeout::jump() { @@ -433,7 +433,7 @@ void Timeout::jump() { with.jumpstatus += 1; - triptype &with1 = _vm->_trip.tr[1]; + triptype &with1 = _vm->_trip->tr[1]; switch (with.jumpstatus) { case 1: case 2: @@ -465,80 +465,80 @@ void Timeout::jump() { if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ && (_vm->_gyro->dna.room == r__insidecardiffcastle) && (_vm->_gyro->dna.arrow_in_the_door == true) - && (_vm->_trip.infield(3))) { /* beside the wall*/ + && (_vm->_trip->infield(3))) { /* beside the wall*/ /* Grab the arrow! */ if (_vm->_gyro->dna.carrying >= maxobjs) - _vm->_scrolls.display("You fail to grab it, because your hands are full."); + _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { - _vm->_celer.show_one(2); + _vm->_celer->show_one(2); _vm->_gyro->dna.arrow_in_the_door = false; /* You've got it. */ _vm->_gyro->dna.obj[_vm->_gyro->bolt] = true; - _vm->_lucerna.objectlist(); - _vm->_visa.dixi('q', 50); - _vm->_lucerna.points(3); + _vm->_lucerna->objectlist(); + _vm->_visa->dixi('q', 50); + _vm->_lucerna->points(3); } } } void Timeout::crapulus_says_splud_out() { - _vm->_visa.dixi('q', 56); + _vm->_visa->dixi('q', 56); _vm->_gyro->dna.crapulus_will_tell = false; } void Timeout::buydrinks() { - _vm->_celer.show_one(11); /* Malagauche gets up again. */ + _vm->_celer->show_one(11); /* Malagauche gets up again. */ _vm->_gyro->dna.malagauche = 0; - _vm->_visa.dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls.display message about it. */ + _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls->display message about it. */ _vm->_pingo->wobble(); /* Do the special effects. */ - _vm->_visa.dixi('D', 1); /* That'll be thruppence. */ + _vm->_visa->dixi('D', 1); /* That'll be thruppence. */ if (_vm->_gyro->pennycheck(3)) /* Pay 3d. */ - _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */ - _vm->_acci.have_a_drink(); + _vm->_visa->dixi('D', 3); /* Tell 'em you paid up. */ + _vm->_acci->have_a_drink(); } void Timeout::buywine() { - _vm->_celer.show_one(11); /* Malagauche gets up again. */ + _vm->_celer->show_one(11); /* Malagauche gets up again. */ _vm->_gyro->dna.malagauche = 0; - _vm->_visa.dixi('D', 50); /* You buy the wine. */ - _vm->_visa.dixi('D', 1); /* It'll be thruppence. */ + _vm->_visa->dixi('D', 50); /* You buy the wine. */ + _vm->_visa->dixi('D', 1); /* It'll be thruppence. */ if (_vm->_gyro->pennycheck(3)) { - _vm->_visa.dixi('D', 4); /* You paid up. */ + _vm->_visa->dixi('D', 4); /* You paid up. */ _vm->_gyro->dna.obj[_vm->_gyro->wine] = true; - _vm->_lucerna.objectlist(); + _vm->_lucerna->objectlist(); _vm->_gyro->dna.winestate = 1; /* OK Wine */ } } void Timeout::callsguards() { - _vm->_visa.dixi('Q', 58); /* GUARDS!!! */ - _vm->_lucerna.gameover(); + _vm->_visa->dixi('Q', 58); /* GUARDS!!! */ + _vm->_lucerna->gameover(); } void Timeout::greetsmonk() { - _vm->_visa.dixi('Q', 59); + _vm->_visa->dixi('Q', 59); _vm->_gyro->dna.entered_lusties_room_as_monk = true; } void Timeout::fall_down_oubliette() { _vm->_gyro->magics[9].op = _vm->_gyro->nix; - _vm->_trip.tr[1].iy += 1; /* increments dx/dy! */ - _vm->_trip.tr[1].y += _vm->_trip.tr[1].iy; /* Dowwwn we go... */ + _vm->_trip->tr[1].iy += 1; /* increments dx/dy! */ + _vm->_trip->tr[1].y += _vm->_trip->tr[1].iy; /* Dowwwn we go... */ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } void Timeout::meet_avaroid() { if (_vm->_gyro->dna.met_avaroid) { - _vm->_scrolls.display("You can't expect to be \6that\22 lucky twice in a row!"); - _vm->_lucerna.gameover(); + _vm->_scrolls->display("You can't expect to be \6that\22 lucky twice in a row!"); + _vm->_lucerna->gameover(); } else { - _vm->_visa.dixi('Q', 60); + _vm->_visa->dixi('Q', 60); _vm->_gyro->dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - triptype &with = _vm->_trip.tr[1]; - with.face = _vm->_trip.left; + triptype &with = _vm->_trip->tr[1]; + with.face = _vm->_trip->left; with.x = 151; with.ix = -3; with.iy = -5; @@ -548,7 +548,7 @@ void Timeout::meet_avaroid() { } void Timeout::rise_up_oubliette() { - triptype &with = _vm->_trip.tr[1]; + triptype &with = _vm->_trip->tr[1]; with.visible = true; with.iy += 1; /* decrements dx/dy! */ @@ -560,96 +560,96 @@ void Timeout::rise_up_oubliette() { } void Timeout::robin_hood_and_geida() { - _vm->_trip.tr[1].init(7, true, &_vm->_trip); - _vm->_trip.apped(1, 7); - _vm->_trip.tr[1].walkto(6); - _vm->_trip.tr[2].stopwalk(); - _vm->_trip.tr[2].face = _vm->_trip.left; + _vm->_trip->tr[1].init(7, true, _vm->_trip); + _vm->_trip->apped(1, 7); + _vm->_trip->tr[1].walkto(6); + _vm->_trip->tr[2].stopwalk(); + _vm->_trip->tr[2].face = _vm->_trip->left; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->dna.geida_follows = false; } void Timeout::robin_hood_and_geida_talk() { - _vm->_visa.dixi('q', 66); - _vm->_trip.tr[1].walkto(2); - _vm->_trip.tr[2].walkto(2); - _vm->_trip.tr[1].vanishifstill = true; - _vm->_trip.tr[2].vanishifstill = true; + _vm->_visa->dixi('q', 66); + _vm->_trip->tr[1].walkto(2); + _vm->_trip->tr[2].walkto(2); + _vm->_trip->tr[1].vanishifstill = true; + _vm->_trip->tr[2].vanishifstill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } void Timeout::avalot_returns() { - _vm->_trip.tr[1].done(); - _vm->_trip.tr[2].done(); - _vm->_trip.tr[1].init(0, true, &_vm->_trip); - _vm->_trip.apped(1, 1); - _vm->_visa.dixi('q', 67); + _vm->_trip->tr[1].done(); + _vm->_trip->tr[2].done(); + _vm->_trip->tr[1].init(0, true, _vm->_trip); + _vm->_trip->apped(1, 1); + _vm->_visa->dixi('q', 67); _vm->_gyro->dna.user_moves_avvy = true; } void Timeout::avvy_sit_down() { /* This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. */ - if (_vm->_trip.tr[1].homing) /* Still walking */ + if (_vm->_trip->tr[1].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); _vm->_gyro->dna.sitting_in_pub = true; _vm->_gyro->dna.user_moves_avvy = false; - _vm->_trip.tr[1].visible = false; + _vm->_trip->tr[1].visible = false; } } void Timeout::ghost_room_phew() { - _vm->_scrolls.display("\6PHEW!\22 You're glad to get out of \6there!"); + _vm->_scrolls->display("\6PHEW!\22 You're glad to get out of \6there!"); } void Timeout::arkata_shouts() { if (_vm->_gyro->dna.teetotal) return; - _vm->_visa.dixi('q', 76); + _vm->_visa->dixi('q', 76); set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } void Timeout::winning() { - _vm->_visa.dixi('q', 79); + _vm->_visa->dixi('q', 79); _vm->_pingo->winning_pic(); do { - _vm->_lucerna.checkclick(); + _vm->_lucerna->checkclick(); } while (!(_vm->_gyro->mrelease == 0)); - _vm->_lucerna.callverb(_vm->_acci.vb_score); - _vm->_scrolls.display(" T H E E N D "); + _vm->_lucerna->callverb(_vm->_acci->vb_score); + _vm->_scrolls->display(" T H E E N D "); _vm->_gyro->lmo = true; } void Timeout::avalot_falls() { - if (_vm->_trip.tr[1].step < 5) { - _vm->_trip.tr[1].step += 1; + if (_vm->_trip->tr[1].step < 5) { + _vm->_trip->tr[1].step += 1; set_up_timer(3, procavalot_falls, reason_falling_over); } else - _vm->_scrolls.display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); + _vm->_scrolls->display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); } void Timeout::spludwick_goes_to_cauldron() { - if (_vm->_trip.tr[2].homing) + if (_vm->_trip->tr[2].homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } void Timeout::spludwick_leaves_cauldron() { - _vm->_trip.tr[2].call_eachstep = true; /* So that normal procs will continue. */ + _vm->_trip->tr[2].call_eachstep = true; /* So that normal procs will continue. */ } void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ - _vm->_visa.dixi('Q', 86); - _vm->_lucerna.points(4); + _vm->_visa->dixi('Q', 86); + _vm->_lucerna->points(4); _vm->_gyro->dna.lustie_is_asleep = true; - _vm->_sequence.first_show(5); - _vm->_sequence.then_show(6); /* He falls asleep... */ - _vm->_sequence.start_to_close(); /* Not really closing, but we're using the same procedure. */ + _vm->_sequence->first_show(5); + _vm->_sequence->then_show(6); /* He falls asleep... */ + _vm->_sequence->start_to_close(); /* Not really closing, but we're using the same procedure. */ } /* "This is all!" */ diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 492c6bf7dc5a..181cde8f810f 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -234,7 +234,7 @@ void triptype::walk() { break; case _tr->_vm->_gyro->unfinished: { bounce(); - _tr->_vm->_scrolls.display("\7Sorry.\3\rThis place is not available yet!"); + _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); } break; case _tr->_vm->_gyro->special: @@ -265,7 +265,7 @@ void triptype::bounce() { else stopwalk(); _tr->_vm->_gyro->oncandopageswap = false; - _tr->_vm->_lucerna.showrw(); + _tr->_vm->_lucerna->showrw(); _tr->_vm->_gyro->oncandopageswap = true; } @@ -465,15 +465,13 @@ void getsettype::recall(bytefield &r) { -Trip::Trip() { +Trip::Trip(AvalancheEngine *vm) { + _vm = vm; + getsetclear(); mustexclaim = false; } -void Trip::setParent(AvalancheEngine *vm) { - _vm = vm; -} - void Trip::loadtrip() { byte gm; @@ -541,18 +539,18 @@ void Trip::catamove(byte ped) { switch (xy_uint16) { case 1801: /* Exit catacombs */ fliproom(r__lustiesroom, 4); - _vm->_scrolls.display("Phew! Nice to be out of there!"); + _vm->_scrolls->display("Phew! Nice to be out of there!"); return; case 1033: /* Oubliette */ fliproom(r__oubliette, 1); - _vm->_scrolls.display("Oh, NO!\231\2"); + _vm->_scrolls->display("Oh, NO!\231\2"); return; case 4: fliproom(r__geidas, 1); return; case 2307: fliproom(r__lusties, 5); - _vm->_scrolls.display("Oh no... here we go again..."); + _vm->_scrolls->display("Oh no... here we go again..."); _vm->_gyro->dna.user_moves_avvy = false; tr[1].iy = 1; tr[1].ix = 0; @@ -560,7 +558,7 @@ void Trip::catamove(byte ped) { } if (!_vm->_gyro->dna.enter_catacombs_from_lusties_room) - _vm->_lucerna.load(29); + _vm->_lucerna->load(29); here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x]; switch (here & 0xf) { /* West. */ @@ -568,59 +566,59 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(28); + _vm->_celer->show_one(28); break; case 0x1: /* no connection (wall + shield), */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(29); /* ...shield. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(29); /* ...shield. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(30); /* ...door. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(30); /* ...door. */ break; case 0x3: /* wall with door and shield */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(30); /* ...door, and... */ - _vm->_celer.show_one(29); /* ...shield. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(30); /* ...door, and... */ + _vm->_celer->show_one(29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(5); /* ...window. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(5); /* ...window. */ break; case 0x5: /* wall with door and window */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(30); /* ...door, and... */ - _vm->_celer.show_one(5); /* ...window. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(30); /* ...door, and... */ + _vm->_celer->show_one(5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(7); /* ...torches. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(28); /* Wall, plus... */ - _vm->_celer.show_one(30); /* ...door, and... */ - _vm->_celer.show_one(7); /* ...torches. */ + _vm->_celer->show_one(28); /* Wall, plus... */ + _vm->_celer->show_one(30); /* ...door, and... */ + _vm->_celer->show_one(7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -635,44 +633,44 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(19); + _vm->_celer->show_one(19); break; case 0x1: /* no connection (wall + window), */ _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(19); /* Wall, plus... */ - _vm->_celer.show_one(20); /* ...window. */ + _vm->_celer->show_one(19); /* Wall, plus... */ + _vm->_celer->show_one(20); /* ...window. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(19); /* Wall, plus... */ - _vm->_celer.show_one(21); /* ...door. */ + _vm->_celer->show_one(19); /* Wall, plus... */ + _vm->_celer->show_one(21); /* ...door. */ break; case 0x3: /* wall with door and window */ _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(19); /* Wall, plus... */ - _vm->_celer.show_one(20); /* ...door, and... */ - _vm->_celer.show_one(21); /* ...window. */ + _vm->_celer->show_one(19); /* Wall, plus... */ + _vm->_celer->show_one(20); /* ...door, and... */ + _vm->_celer->show_one(21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer.show_one(19); /* Wall, plus... */ - _vm->_celer.show_one(18); /* ...torches. */ + _vm->_celer->show_one(19); /* Wall, plus... */ + _vm->_celer->show_one(18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ - _vm->_celer.show_one(19); /* Wall, plus... */ - _vm->_celer.show_one(21); /* ...door, and... */ - _vm->_celer.show_one(18); /* ...torches. */ + _vm->_celer->show_one(19); /* Wall, plus... */ + _vm->_celer->show_one(21); /* ...door, and... */ + _vm->_celer->show_one(18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -690,7 +688,7 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x1: - _vm->_celer.show_one(22); + _vm->_celer->show_one(22); if ((xy_uint16 == 2051) & (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[13].op = _vm->_gyro->exclaim; @@ -701,13 +699,13 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x2: - _vm->_celer.show_one(23); + _vm->_celer->show_one(23); _vm->_gyro->magics[7].op = _vm->_gyro->special; /* Middle exit south. */ _vm->_gyro->magics[12].op = _vm->_gyro->bounces; _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x3: - _vm->_celer.show_one(24); + _vm->_celer->show_one(24); _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Left exit south. */ _vm->_gyro->magics[7].op = _vm->_gyro->bounces; _vm->_gyro->magics[13].op = _vm->_gyro->bounces; @@ -722,36 +720,36 @@ void Trip::catamove(byte ped) { // LEFT handles: /* case 0x1: - _vm->_celer.show_one(4); + _vm->_celer->show_one(4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x2: - _vm->_celer.show_one(4); + _vm->_celer->show_one(4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Middle exit north. _vm->_gyro->portals[12].op = _vm->_gyro->special; // Door. break; /* case 0x3: - _vm->_celer.show_one(4); + _vm->_celer->show_one(4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; // RIGHT handles: case 0x4: - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x5: - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Middle exit north. */ _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ break; /* case 0x6: - _vm->_celer.show_one(3); + _vm->_celer->show_one(3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; @@ -760,12 +758,12 @@ void Trip::catamove(byte ped) { case 0x7: case 0x8: case 0x9: { - _vm->_celer.show_one(6); + _vm->_celer->show_one(6); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer.show_one(31); + _vm->_celer->show_one(31); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer.show_one(32); + _vm->_celer->show_one(32); _vm->_gyro->magics[1].op = _vm->_gyro->special; /* Middle arch north. */ _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ @@ -775,50 +773,50 @@ void Trip::catamove(byte ped) { case 0xd: /* No connection + WINDOW */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(14); + _vm->_celer->show_one(14); break; case 0xe: /* No connection + TORCH */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer.show_one(8); + _vm->_celer->show_one(8); break; /* Recessed door: */ case 0xf: _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Door to Geida's room. */ - _vm->_celer.show_one(1); + _vm->_celer->show_one(1); _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ break; } switch (xy_uint16) { case 514: - _vm->_celer.show_one(17); + _vm->_celer->show_one(17); break; /* [2,2] : "Art Gallery" sign over door. */ case 264: - _vm->_celer.show_one(9); + _vm->_celer->show_one(9); break; /* [8,1] : "The Wrong Way!" sign. */ case 1797: - _vm->_celer.show_one(2); + _vm->_celer->show_one(2); break; /* [5,7] : "Ite Mingite" sign. */ case 258: for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ - _vm->_celer.show_one_at(15, 130 + fv * 120, 70); - _vm->_celer.show_one_at(16, 184 + fv * 120, 78); + _vm->_celer->show_one_at(15, 130 + fv * 120, 70); + _vm->_celer->show_one_at(16, 184 + fv * 120, 78); } break; case 1287: for (fv = 10; fv <= 13; fv++) - _vm->_celer.show_one(fv); + _vm->_celer->show_one(fv); break; /* [7,5] : 4 candles. */ case 776: - _vm->_celer.show_one(10); + _vm->_celer->show_one(10); break; /* [8,3] : 1 candle. */ case 2049: - _vm->_celer.show_one(11); + _vm->_celer->show_one(11); break; /* [1,8] : another candle. */ case 257: - _vm->_celer.show_one(12); - _vm->_celer.show_one(13); + _vm->_celer->show_one(12); + _vm->_celer->show_one(13); break; /* [1,1] : the other two. */ } @@ -843,7 +841,7 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ - _vm->_celer.show_one(1); + _vm->_celer->show_one(1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[10].op = _vm->_gyro->nix; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); @@ -857,7 +855,7 @@ void Trip::call_special(uint16 which) { _vm->_gyro->magics[12].data = 5; _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Now works as planned! */ stopwalking(); - _vm->_visa.dixi('q', 26); + _vm->_visa->dixi('q', 26); _vm->_gyro->dna.user_moves_avvy = true; break; case 3: /* _vm->_gyro->special 3: Room 71: triggers dart. */ @@ -877,20 +875,20 @@ void Trip::call_special(uint16 which) { } break; case 4: /* This is the ghost room link. */ - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); tr[1].turn(right); /* you'll see this after we get back from bootstrap */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); - _vm->_enid.back_to_bootstrap(3); + _vm->_enid->back_to_bootstrap(3); break; case 5: if (_vm->_gyro->dna.friar_will_tie_you_up) { /* _vm->_gyro->special 5: Room 42: touched tree, and get tied up. */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Boundary effect is now working again. */ - _vm->_visa.dixi('q', 35); + _vm->_visa->dixi('q', 35); tr[1].done(); /*tr[1].vanishifstill:=true;*/ - _vm->_celer.show_one(2); - _vm->_visa.dixi('q', 36); + _vm->_celer->show_one(2); + _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; tr[2].walkto(3); @@ -912,18 +910,18 @@ void Trip::call_special(uint16 which) { _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); - _vm->_lucerna.mblit(12, 80, 38, 160, 3, 0); - _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); - _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); + _vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); + _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { - _vm->_visa.dixi('q', 63); + _vm->_visa->dixi('q', 63); tr[2].turn(down); tr[2].stopwalk(); tr[2].call_eachstep = false; /* Geida */ - _vm->_lucerna.gameover(); + _vm->_lucerna->gameover(); } break; case 9: /* _vm->_gyro->special 9: lose Geida to Robin Hood... */ @@ -939,18 +937,18 @@ void Trip::call_special(uint16 which) { if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { /* Into Geida's room. */ if (_vm->_gyro->dna.obj[_vm->_gyro->key]) - _vm->_visa.dixi('q', 62); + _vm->_visa->dixi('q', 62); else { - _vm->_visa.dixi('q', 61); + _vm->_visa->dixi('q', 61); return; } } - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_y -= 1; catamove(4); if (_vm->_gyro->dna.room != r__catacombs) return; - _vm->_lucerna.delavvy(); + _vm->_lucerna->delavvy(); switch ((_vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x] & 0xf00) >> 8) { case 0x1: apped(1, 12); @@ -965,34 +963,34 @@ void Trip::call_special(uint16 which) { dawndelay(); break; case 11: /* _vm->_gyro->special 11: transfer east in catacombs. */ - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_x += 1; catamove(1); if (_vm->_gyro->dna.room != r__catacombs) return; - _vm->_lucerna.delavvy(); + _vm->_lucerna->delavvy(); apped(1, 1); getback(); dawndelay(); break; case 12: /* _vm->_gyro->special 12: transfer south in catacombs. */ - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_y += 1; catamove(2); if (_vm->_gyro->dna.room != r__catacombs) return; - _vm->_lucerna.delavvy(); + _vm->_lucerna->delavvy(); apped(1, 2); getback(); dawndelay(); break; case 13: /* _vm->_gyro->special 13: transfer west in catacombs. */ - _vm->_lucerna.dusk(); + _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_x -= 1; catamove(3); if (_vm->_gyro->dna.room != r__catacombs) return; - _vm->_lucerna.delavvy(); + _vm->_lucerna->delavvy(); apped(1, 3); getback(); dawndelay(); @@ -1010,52 +1008,52 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { case r__outsideyours: case r__outsidenottspub: case r__outsideducks: - _vm->_sequence.first_show(1); - _vm->_sequence.then_show(2); - _vm->_sequence.then_show(3); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(2); + _vm->_sequence->then_show(3); break; case r__insidecardiffcastle: - _vm->_sequence.first_show(1); - _vm->_sequence.then_show(5); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(5); break; case r__avvysgarden: case r__entrancehall: case r__insideabbey: - _vm->_sequence.first_show(1); - _vm->_sequence.then_show(2); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(2); break; case r__musicroom: case r__outsideargentpub: - _vm->_sequence.first_show(5); - _vm->_sequence.then_show(6); + _vm->_sequence->first_show(5); + _vm->_sequence->then_show(6); break; case r__lusties: switch (magicnum) { case 14: if (_vm->_gyro->dna.avvys_in_the_cupboard) { hide_in_the_cupboard(); - _vm->_sequence.first_show(8); - _vm->_sequence.then_show(7); - _vm->_sequence.start_to_close(); + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); return; } else { apped(1, 6); tr[1].face = right; /* added by TT 12/3/1995 */ - _vm->_sequence.first_show(8); - _vm->_sequence.then_show(9); + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(9); } break; case 12: - _vm->_sequence.first_show(4); - _vm->_sequence.then_show(5); - _vm->_sequence.then_show(6); + _vm->_sequence->first_show(4); + _vm->_sequence->then_show(5); + _vm->_sequence->then_show(6); break; } break; } - _vm->_sequence.then_flip(whither, ped); - _vm->_sequence.start_to_open(); + _vm->_sequence->then_flip(whither, ped); + _vm->_sequence->start_to_open(); } void Trip::newspeed() { @@ -1133,10 +1131,10 @@ void Trip::getback() { end; */ - _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); + _vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } - _vm->_lucerna.blitfix(); + _vm->_lucerna->blitfix(); /* if endangered then @@ -1199,7 +1197,7 @@ void Trip::arrow_procs(byte tripnum) { /* OK, it's hit him... what now? */ tr[2].call_eachstep = false; /* prevent recursion. */ - _vm->_visa.dixi('Q', 47); /* Complaint! */ + _vm->_visa->dixi('Q', 47); /* Complaint! */ tr[tripnum].done(); /* Deallocate the arrow. */ /* tr[1].done; { Deallocate normal pic of Avvy. } @@ -1211,14 +1209,14 @@ void Trip::arrow_procs(byte tripnum) { end; on;*/ - _vm->_lucerna.gameover(); + _vm->_lucerna->gameover(); _vm->_gyro->dna.user_moves_avvy = false; /* Stop the user from moving him. */ _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ - _vm->_celer.show_one(3); /* Show pic of arrow stuck into the door. */ + _vm->_celer->show_one(3); /* Show pic of arrow stuck into the door. */ _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ } @@ -1282,7 +1280,7 @@ void Trip::spin(byte whichway, byte &tripnum) { _vm->_gyro->dna.geida_spin += 1; _vm->_gyro->dna.geida_time = 20; if (_vm->_gyro->dna.geida_spin == 5) { - _vm->_scrolls.display("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_gyro->dna.geida_spin = 0; _vm->_gyro->dna.geida_time = 0; /* knock out records */ } @@ -1399,7 +1397,7 @@ void Trip::trippancy_link() { } if (mustexclaim) { mustexclaim = false; - _vm->_visa.dixi('x', saywhat); + _vm->_visa->dixi('x', saywhat); } } @@ -1506,26 +1504,26 @@ void Trip::hide_in_the_cupboard() { if (_vm->_gyro->dna.avvys_in_the_cupboard) { if (_vm->_gyro->dna.wearing == nowt) - _vm->_scrolls.display("\6AVVY!\22 Get dressed first!"); + _vm->_scrolls->display("\6AVVY!\22 Get dressed first!"); else { tr[1].visible = true; _vm->_gyro->dna.user_moves_avvy = true; apped(1, 3); /* Walk out of the cupboard. */ - _vm->_scrolls.display("You leave the cupboard. Nice to be out of there!"); + _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->dna.avvys_in_the_cupboard = false; - _vm->_sequence.first_show(8); - _vm->_sequence.then_show(7); - _vm->_sequence.start_to_close(); + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); } } else { /* Not hiding in the cupboard */ tr[1].visible = false; _vm->_gyro->dna.user_moves_avvy = false; - _vm->_scrolls.display(Common::String("You walk into the room...\20It seems to be an empty, ") + + _vm->_scrolls->display(Common::String("You walk into the room...\20It seems to be an empty, ") + "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + "avoid suffocation."); _vm->_gyro->dna.avvys_in_the_cupboard = true; - _vm->_celer.show_one(8); + _vm->_celer->show_one(8); } } @@ -1564,8 +1562,8 @@ void Trip::fliproom(byte room, byte ped) { beforex = _vm->_gyro->mx; beforey = _vm->_gyro->my; - _vm->_lucerna.exitroom(_vm->_gyro->dna.room); - _vm->_lucerna.dusk(); + _vm->_lucerna->exitroom(_vm->_gyro->dna.room); + _vm->_lucerna->dusk(); getsetclear(); @@ -1577,18 +1575,18 @@ void Trip::fliproom(byte room, byte ped) { if (_vm->_gyro->dna.room == r__lustiesroom) _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; - _vm->_lucerna.enterroom(room, ped); + _vm->_lucerna->enterroom(room, ped); apped(1, ped); _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; _vm->_gyro->oldrw = _vm->_gyro->dna.rw; _vm->_gyro->dna.rw = tr[1].face; - _vm->_lucerna.showrw(); + _vm->_lucerna->showrw(); for (fv = 0; fv <= 1; fv++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; getback(); } - _vm->_lucerna.dawn(); + _vm->_lucerna->dawn(); /* Tidy up after mouse. I know it's a kludge... */ /* tidy_after_mouse;*/ diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 4b84221e11a1..30fcba2a1640 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -154,9 +154,7 @@ class Trip { friend triptype; friend getsettype; - Trip(); - void setParent(AvalancheEngine *vm); static const int16 up = 0; static const int16 right = 1; @@ -187,6 +185,9 @@ class Trip { static const int16 procgeida_procs = 7; + + Trip(AvalancheEngine *vm); + void trippancy_link(); void get_back_loretta(); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 935959533fc1..4ffedc236d98 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -41,7 +41,7 @@ namespace Avalanche { - void Visa::setParent(AvalancheEngine *vm) { + Visa::Visa(AvalancheEngine *vm) { _vm = vm; } @@ -86,7 +86,7 @@ namespace Avalanche { if (report_dixi_errors) { Common::String todisplay; todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->strf(point).c_str()); - _vm->_scrolls.display(todisplay); + _vm->_scrolls->display(todisplay); } return; } @@ -103,7 +103,7 @@ namespace Avalanche { if (bubbling) do_the_bubble(); - _vm->_scrolls.calldrivers(); + _vm->_scrolls->calldrivers(); } void Visa::speech(byte who, byte subject) { @@ -152,7 +152,7 @@ namespace Avalanche { unskrimble(); do_the_bubble(); - _vm->_scrolls.calldrivers(); + _vm->_scrolls->calldrivers(); went_ok = true; } diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index e33045c37436..c3aa3f62553e 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -37,7 +37,7 @@ class AvalancheEngine; class Visa { public: - void Visa::setParent(AvalancheEngine *vm); + Visa(AvalancheEngine *vm); void dixi(char block, byte point); From 03665fac214574ec58458676789347855c34c29a Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 19:47:41 +0200 Subject: [PATCH 0185/1332] AVALANCHE: Graphics: double screen height. --- engines/avalanche/graphics.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 8035491bfbb0..287f85c092ba 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -48,7 +48,7 @@ Graphics::Graphics(AvalancheEngine *vm) { } void Graphics::init() { - initGraphics(kScreenWidth, kScreenHeight, true); + initGraphics(kScreenWidth, kScreenHeight * 2, true); // Doubling the height. for (int i = 0; i < 64; ++i) { _egaPalette[i][0] = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; @@ -141,8 +141,18 @@ void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) { } void Graphics::refreshScreen() { - g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, kScreenWidth, kScreenHeight); + // These cycles are for doubling the screen height. + ::Graphics::Surface source; + source.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); + for (uint16 y = 0; y < source.h / 2; y++) + for (uint16 x = 0; x < source.w; x++) + for (byte j = 0; j < 2; j++) + *(byte *)source.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); + + // Now we copy the stretched picture to the screen. + g_system->copyRectToScreen(source.pixels, source.pitch , 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); } + } // End of namespace Avalanche From 0beae3b95cbdd719b5778c79ee944ab2f426e7fc Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 21:09:16 +0200 Subject: [PATCH 0186/1332] AVALANCHE: free() the surfaces in Graphics' functions. --- engines/avalanche/graphics.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 287f85c092ba..aa49a0c3dd37 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -138,20 +138,24 @@ void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) { for (uint16 y = 0; y < picture.h; y++) for (uint16 x = 0; x < picture.w; x++) *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + + picture.free(); } void Graphics::refreshScreen() { // These cycles are for doubling the screen height. - ::Graphics::Surface source; - source.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); - for (uint16 y = 0; y < source.h / 2; y++) - for (uint16 x = 0; x < source.w; x++) + ::Graphics::Surface picture; + picture.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); + for (uint16 y = 0; y < picture.h / 2; y++) + for (uint16 x = 0; x < picture.w; x++) for (byte j = 0; j < 2; j++) - *(byte *)source.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); + *(byte *)picture.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); // Now we copy the stretched picture to the screen. - g_system->copyRectToScreen(source.pixels, source.pitch , 0, 0, kScreenWidth, kScreenHeight * 2); + g_system->copyRectToScreen(picture.pixels, picture.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); + + picture.free(); } From e5fb4e3866e8a23b80e99e4cce4509a362e916c3 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 21:18:51 +0200 Subject: [PATCH 0187/1332] AVALANCHE: Cosmetic modifications in triptype::walk(). --- engines/avalanche/trip6.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 181cde8f810f..e16efed2dc19 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -191,14 +191,13 @@ void triptype::walk() { if (visible) { - { - r.x1 = (x / 8) - 1; - if (r.x1 == 255) - r.x1 = 0; - r.y1 = y - 2; - r.x2 = ((x + _info.xl) / 8) + 1; - r.y2 = y + _info.yl + 2; - } + r.x1 = (x / 8) - 1; + if (r.x1 == 255) + r.x1 = 0; + r.y1 = y - 2; + r.x2 = ((x + _info.xl) / 8) + 1; + r.y2 = y + _info.yl + 2; + _tr->getset[1 - _tr->_vm->_gyro->cp].remember(r); } @@ -248,9 +247,9 @@ void triptype::walk() { } if (!_tr->_vm->_gyro->doing_sprite_run) { - count += 1; + count++; if (((ix != 0) || (iy != 0)) && (count > 1)) { - step += 1; + step++; if (step == a.seq) step = 0; count = 0; } From 63fbb1d04f338d88d6a40a636af3fd4bbc97de1c Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 22:20:21 +0200 Subject: [PATCH 0188/1332] AVALANCHE: Implement Lucerna::find_people(). --- engines/avalanche/gyro2.cpp | 5 +++-- engines/avalanche/lucerna2.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index f759f8931314..fa1298a32223 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -356,7 +356,8 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ _vm->_trip->tr[0].init(0, true, _vm->_trip); alive = true; - score = 0; /*for gd:=0 to 5 do which[gd]:=1;*/ + score = 0; + /*for gd:=0 to 5 do which[gd]:=1;*/ memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); _vm->_scrolls->natural(); _vm->_basher->normal_edit(); @@ -377,7 +378,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ seescroll = false; ppos[0][1] = -177; - _vm->_trip->tr[0].appear(300,117,right); + //_vm->_trip->tr[0].appear(300,117,right); //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1d22deb9752b..6ca03b073eba 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -294,9 +294,9 @@ void Lucerna::zoomout(int16 x, int16 y) { } void Lucerna::find_people(byte room) { - for (byte fv = 151; fv <= 178; fv++) + for (byte fv = 1; fv < 29; fv++) // There'll may be problems with this. if (_vm->_gyro->whereis[fv] == room) { - if (fv < 175) + if (fv < 25) // And this. See definition of whereis[]. _vm->_gyro->him = fv; else _vm->_gyro->her = fv; From ab04dd7aa6b5279f472a0136ba9a9e162b7fbe6c Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 24 Jul 2013 22:23:40 +0200 Subject: [PATCH 0189/1332] AVALANCHE: Cosmetic modification in Gyro. --- engines/avalanche/gyro2.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 58b5844906f1..a99d4c660053 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -73,8 +73,7 @@ struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ char wearing; /* what you're wearing */ byte swore; /* number of times you've sworn */ byte saves; /* number of times this game has been saved */ - byte rooms[100]; /* Add one to each every time - you enter a room */ + byte rooms[100]; /* Add one to each every time you enter a room */ byte alcohol; /* Your blood alcohol level. */ byte playednim; /* How many times you've played Nim. */ bool wonnim; /* Have you *won* Nim? (That's harder.) */ From 28b0076e63a71bfa7e1d0b82f9153e13d26c4316 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 11:41:33 +0200 Subject: [PATCH 0190/1332] AVALANCHE: Celer: add new flavour: ch_natural_image. --- engines/avalanche/celer2.cpp | 9 +++------ engines/avalanche/celer2.h | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 3cedb67a7ad8..17d4ae105237 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -302,13 +302,10 @@ void Celer::load_chunks(Common::String xx) { memory[fv] = new byte[ch.size]; // Celer::forget_chunks() deallocates it. - /*if (ch.natural) { - getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); + if (ch.natural) { + memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. + //getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); } else - blockread(f, memory[fv], ch.size);*/ - warning("STUB: Celer::load_chunks()"); - - if (!ch.natural) f.read(memory[fv], ch.size); } else memos[fv].x = on_disk; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 1d350054a2f2..3084fdd867b6 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -39,7 +39,7 @@ class AvalancheEngine; class Celer { public: - enum flavourtype {ch_ega, ch_bgi}; + enum flavourtype {ch_ega, ch_bgi, ch_natural_image}; struct chunkblocktype { flavourtype flavour; From 502cd7a01791d1812f8b29e9cc36fd5cc2653003 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 12:15:15 +0200 Subject: [PATCH 0191/1332] AVALANCHE: Improve Celer::display_it(), update Celer::load_chunks() to work properly with it. --- engines/avalanche/celer2.cpp | 45 +++++++++++++++++++++++++++++------- engines/avalanche/celer2.h | 2 +- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 17d4ae105237..b73e16ad746e 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -298,15 +298,19 @@ void Celer::load_chunks(Common::String xx) { memos[fv].y = ch.y; memos[fv].yl = ch.yl; memos[fv].flavour = ch.flavour; - memos[fv].size = ch.size; - - memory[fv] = new byte[ch.size]; // Celer::forget_chunks() deallocates it. if (ch.natural) { memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. - //getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); - } else + memos[fv].size = ch.xl * ch.yl; + memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. + for (uint16 j = 0; j < memos[fv].yl; j++) + for (uint16 i = 0; i < memos[fv].xl; i++) + memory[fv][j * memos[fv].xl + i] = *_vm->_graphics->getPixel(memos[fv].x + i, memos[fv].y + j); + } else { + memos[fv].size = ch.size; + memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. f.read(memory[fv], ch.size); + } } else memos[fv].x = on_disk; } @@ -324,7 +328,7 @@ void Celer::forget_chunks() { void Celer::mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) { /* assembler; asm push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} - push bp; { Nor BP! } + push bp; { Nor BP! { DI holds the offset on this page. It starts at the top left-hand corner. } @@ -419,8 +423,33 @@ asm -void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p) { - warning("STUB: Celer::display_it()"); +void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) { + switch (flavour) { + case ch_natural_image: { + for (uint16 j = 0; j < yl; j++) + for (uint16 i = 0; i < xl; i++) + *_vm->_graphics->getPixel(x + i, y + j) = p[j * xl + i]; + } + break; + case ch_bgi : { + _vm->_graphics->drawPicture(p, x, y); + //putimage(x * 8, y, p, 0); + r.x1 = x; + r.y1 = y; + r.x2 = x + xl + 1; + r.y2 = y + yl; + } + break; + case ch_ega : { + mdrop(x, y, xl, yl, p); + _vm->_lucerna->blitfix(); + r.x1 = x; + r.y1 = y; + r.x2 = x + xl; + r.y2 = y + yl; + } + break; + } } void Celer::show_one(byte which) { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 3084fdd867b6..82f97a53d30f 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -89,7 +89,7 @@ class Celer { void mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p); - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, void *p); + void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p); void display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); }; From 6644905eaca4576c5429592b5e892a733ebefbdc Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 12:33:03 +0200 Subject: [PATCH 0192/1332] AVALANCHE: Fix cycle in Trip::trippancy_link(). --- engines/avalanche/trip6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index e16efed2dc19..0acad63c7633 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1362,7 +1362,7 @@ void Trip::trippancy_link() { if (_vm->_gyro->ddmnow | _vm->_gyro->ontoolbar | _vm->_gyro->seescroll) return; - for (fv = 1; fv <= numtr; fv++) { + for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick) tr[fv].walk(); } From 9b4c9e496fc81dc0f7a3194d0a65b82b111f7457 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 16:26:49 +0200 Subject: [PATCH 0193/1332] AVALANCHE: Add Graphics::drawFrame(). --- engines/avalanche/graphics.cpp | 4 ++++ engines/avalanche/graphics.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index aa49a0c3dd37..eb93423f98bb 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -78,6 +78,10 @@ byte *Graphics::getPixel(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); } +void Graphics::drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { + _surface.frameRect(Common::Rect(x1, y1, x2, y2), color); +} + void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 1a580029d03c..14eb3fa5c4cc 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -71,6 +71,8 @@ class Graphics { byte *getPixel(int16 x, int16 y); + void drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); // Solely for testing purposes! + void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); From 63e7c5b3d110eb24563535a92b1804e4d2f4859b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 16:28:52 +0200 Subject: [PATCH 0194/1332] AVALANCHE: Repair array indexes in Timeout and Trip. --- engines/avalanche/timeout2.cpp | 8 ++++---- engines/avalanche/trip6.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 7a10d670cc37..b36f143eeb75 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -57,11 +57,11 @@ Timeout::Timeout(AvalancheEngine *vm) { } void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { - fv = 1; - while ((fv < 8) && (times[fv].time_left != 0)) - fv += 1; + fv = 0; + while ((fv < 7) && (times[fv].time_left != 0)) + fv++; - if (fv == 8) + if (fv == 7) return; /* Oh dear... */ timetype &with = times[fv]; /* Everything's OK here! */ diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 0acad63c7633..1a525d765e6d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1404,7 +1404,7 @@ void Trip::get_back_loretta() { byte fv; /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ - for (fv = 1; fv <= numtr; fv++) { + for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick) { getback(); return; @@ -1627,7 +1627,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ } void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ - tr[1].visible = false; + tr[0].visible = false; } From 06bde8b277e0729c693243c2ba4d8566ff1e9012 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 21:38:46 +0200 Subject: [PATCH 0195/1332] AVALANCHE: Implement Celer::load_chunks(). --- engines/avalanche/celer2.cpp | 52 +++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index b73e16ad746e..b7ee5bbfb61a 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -301,11 +301,11 @@ void Celer::load_chunks(Common::String xx) { if (ch.natural) { memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. - memos[fv].size = ch.xl * ch.yl; + memos[fv].size = memos[fv].xl * 8 * memos[fv].yl; memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. for (uint16 j = 0; j < memos[fv].yl; j++) - for (uint16 i = 0; i < memos[fv].xl; i++) - memory[fv][j * memos[fv].xl + i] = *_vm->_graphics->getPixel(memos[fv].x + i, memos[fv].y + j); + for (uint16 i = 0; i < memos[fv].xl * 8; i++) + memory[fv][j * memos[fv].xl * 8 + i] = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); } else { memos[fv].size = ch.size; memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. @@ -426,13 +426,21 @@ asm void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) { switch (flavour) { case ch_natural_image: { + r.x1 = x; + r.y1 = y; + r.x2 = x + xl + 1; + r.y2 = y + yl; + + x *= 8; + xl *= 8; + for (uint16 j = 0; j < yl; j++) for (uint16 i = 0; i < xl; i++) *_vm->_graphics->getPixel(x + i, y + j) = p[j * xl + i]; } break; case ch_bgi : { - _vm->_graphics->drawPicture(p, x, y); + _vm->_graphics->drawPicture(p, x * 8, y); //putimage(x * 8, y, p, 0); r.x1 = x; r.y1 = y; @@ -441,12 +449,44 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour } break; case ch_ega : { - mdrop(x, y, xl, yl, p); - _vm->_lucerna->blitfix(); r.x1 = x; r.y1 = y; r.x2 = x + xl; r.y2 = y + yl; + + + x *= 8; + xl *= 8; + + + + ::Graphics::Surface picture; // We make a Surface object for the picture itself. + + picture.create(xl, yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); + + uint32 h = 0; + + // Produce the picture. + for (int8 plane = 0; plane < 4; plane++) // The planes are in the opposite way. + for (byte j = 0; j < yl + 1; j++) + for (uint16 i = 0; i < xl; i += 8) { + byte pixel = p[h++]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *(byte *)picture.getBasePtr(i + 7 - bit, j) += (pixelBit << plane); + } + } + + // Copy the picture to a given place on the screen. + for (uint16 j = 0; j < picture.h; j++) + for (uint16 i = 0; i < picture.w; i++) + *_vm->_graphics->getPixel(i + x, j + y) = *(byte *)picture.getBasePtr(i, j); + + picture.free(); + + + + _vm->_lucerna->blitfix(); } break; } From 395b917e94c4cc02035ec2e54cfe3e2b2074596c Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 22:42:41 +0200 Subject: [PATCH 0196/1332] AVALANCHE: Repair Timeout. --- engines/avalanche/timeout2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index b36f143eeb75..647cfe4b4604 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -49,7 +49,7 @@ namespace Avalanche { Timeout::Timeout(AvalancheEngine *vm) { _vm = vm; - for (int i = 0; i < sizeof(times); i++) { + for (byte i = 0; i < 7; i++) { times[i].time_left = 0; times[i].then_where = 0; times[i].what_for = 0; @@ -64,10 +64,10 @@ void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { if (fv == 7) return; /* Oh dear... */ - timetype &with = times[fv]; /* Everything's OK here! */ - with.time_left = howlong; - with.then_where = whither; - with.what_for = why; + /* Everything's OK here! */ + times[fv].time_left = howlong; + times[fv].then_where = whither; + times[fv].what_for = why; } void Timeout::one_tick() { From 5e257a500b982c77d617f2103e504d72d489697b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 22:54:28 +0200 Subject: [PATCH 0197/1332] AVALANCHE: Implement Timeout::one_tick(). --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/timeout2.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4674ceacaa5a..408da93bea82 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -197,7 +197,7 @@ void Avalot::run(Common::String arg) { if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->wipe_vmc(_vm->_gyro->cp); - //_vm->_timeout->one_tick(); + _vm->_timeout->one_tick(); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 647cfe4b4604..88277ef2f6e4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -74,13 +74,12 @@ void Timeout::one_tick() { if (_vm->_gyro->ddmnow) return; - for (fv = 1; fv <= 7; fv++) { - timetype &with = times[fv]; - if (with.time_left > 0) { - with.time_left -= 1; + for (fv = 0; fv < 7; fv++) { + if (times[fv].time_left > 0) { + times[fv].time_left --; - if (with.time_left == 0) { - switch (with.then_where) { + if (times[fv].time_left == 0) { + switch (times[fv].then_where) { case procopen_drawbridge : open_drawbridge(); break; @@ -208,8 +207,8 @@ void Timeout::one_tick() { } } } - _vm->_gyro->roomtime += 1; /* Cycles since you've been in this room. */ - _vm->_gyro->dna.total_time += 1; /* Total amount of time for this game. */ + _vm->_gyro->roomtime++; /* Cycles since you've been in this room. */ + _vm->_gyro->dna.total_time++; /* Total amount of time for this game. */ } void Timeout::lose_timer(byte which) { From a955f6acaba48e91cf1753dd4f85fee06fdeec52 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 23:10:18 +0200 Subject: [PATCH 0198/1332] AVALANCHE: Revise Celer::pics_link() a bit. --- engines/avalanche/celer2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index b7ee5bbfb61a..b8e89fd7e598 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -72,7 +72,7 @@ void Celer::pics_link() { case r__yours: if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % int32(4)) == 0)) - show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(2)); + show_one(0 + (_vm->_gyro->roomtime / 12) % 2); break; case r__argentpub: From 37ea01644ababf4ab432fc43bea36347a3b6180e Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 23:32:22 +0200 Subject: [PATCH 0199/1332] AVALANCHE: Replace Gyro::slowdown() with ScummVM's own utilities. --- engines/avalanche/avalot.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 408da93bea82..d4700ea8d4b7 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -180,6 +180,8 @@ void Avalot::run(Common::String arg) { setup(); do { + uint32 beginLoop = _vm->_system->getMillis(); + _vm->_lucerna->clock_lucerna(); _vm->_basher->keyboard_link(); _vm->_dropdown->menu_link(); @@ -193,7 +195,7 @@ void Avalot::run(Common::String arg) { if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->plot_vmc(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->cp); _vm->_lucerna->flip_page(); /* <<_gyro->slowdown(); + if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->wipe_vmc(_vm->_gyro->cp); @@ -207,6 +209,10 @@ void Avalot::run(Common::String arg) { _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. + uint32 delay = _vm->_system->getMillis() - beginLoop; + if ((delay) <= 55) + _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); + } while (! _vm->_gyro->lmo); //restorecrtmode(); From 9a26bb502f69b6e51b34c18e9784bcdf7379af06 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 25 Jul 2013 23:38:06 +0200 Subject: [PATCH 0200/1332] AVALANCHE: Remove parenthesis and add comment to Avalot::run(). --- engines/avalanche/avalot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index d4700ea8d4b7..6c49a669a191 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -210,8 +210,8 @@ void Avalot::run(Common::String arg) { _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. uint32 delay = _vm->_system->getMillis() - beginLoop; - if ((delay) <= 55) - _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); + if (delay <= 55) + _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). } while (! _vm->_gyro->lmo); From b0d4019ceabd1180f41447c2b232c5328f181c4e Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 10:42:50 +0200 Subject: [PATCH 0201/1332] AVALANCHE: Remove Celer:mdrop(). --- engines/avalanche/celer2.cpp | 98 ------------------------------------ engines/avalanche/celer2.h | 2 - 2 files changed, 100 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index b8e89fd7e598..5fc029e9aaba 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -325,104 +325,6 @@ void Celer::forget_chunks() { memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */ } -void Celer::mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) { /* assembler; -asm - push ds; { Strictly speaking, we shouldn't modify DS, so we'll save it.} - push bp; { Nor BP! - - - { DI holds the offset on this page. It starts at the top left-hand corner. } - { (It should equal ch.y*80+ch.x. } - - mov ax,y; - mov dl,80; - mul dl; { Line offset now calculated. } - mov di,ax; { Move it into DI. } - mov ax,x; - add di,ax; { Full offset now calculated. } - - mov bx,yl; { No. of times to repeat lineloop. } - inc bx; { "loop" doesn't execute the zeroth time. } - mov bh,bl; { Put it into BH. } - - { BP holds the length of the Common::String to copy. It's equal to ch.xl.} - - mov ax,uint16(p); { Data is held at DS:SI. } - mov si,ax; - mov ax,uint16(p+2); { This will be moved over into ds in just a tick... } - - mov bp,xl; - - mov ds,ax; - - - cld; { We're allowed to hack around with the flags! } - - mov ax,$AC00; { Top of the first EGA page. } - mov es,ax; { Offset on this page is calculated below... } - - -{ port[$3c4]:=2; port[$3ce]:=4; } - - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; - - mov cx,4; { This loop executes for 3, 2, 1, and 0. } - mov bl,0; - - - @mainloop: - - push di; - push cx; - -{ port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; -{ port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - - xor ch,ch; - mov cl,bh; { BH = ch.yl. } - - @lineloop: - - push cx; - - mov cx,bp; - - repz movsb; { Copy the data. } - - sub di,bp; - add di,80; - - pop cx; - - loop @lineloop; - - inc bl; { One more on BL. } - - pop cx; - pop di; - - loop @mainloop; - - pop bp; - pop ds; { Get DS back again. } -*/ -} - - - void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) { switch (flavour) { case ch_natural_image: { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 82f97a53d30f..2177ea2b92b1 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -87,8 +87,6 @@ class Celer { static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ - void mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p); - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p); void display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); From 6e8dec45dd946b365d095029072f09fa1ed4c675 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 13:32:08 +0200 Subject: [PATCH 0202/1332] AVALANCHE: Add loadPictureGraphic, loadPictureRow, revise drawPicture in Graphics, update almost everything accordingly. --- engines/avalanche/celer2.cpp | 19 ++++++------- engines/avalanche/graphics.cpp | 52 ++++++++++++++++++++++++++++++++-- engines/avalanche/graphics.h | 11 ++++++- engines/avalanche/gyro2.cpp | 8 +++++- engines/avalanche/gyro2.h | 9 ++++-- engines/avalanche/lucerna2.cpp | 52 +++++++++++++--------------------- 6 files changed, 101 insertions(+), 50 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 5fc029e9aaba..52b57b372504 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -326,12 +326,13 @@ void Celer::forget_chunks() { } void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) { + r.x1 = x; + r.y1 = y; + r.y2 = y + yl; + switch (flavour) { case ch_natural_image: { - r.x1 = x; - r.y1 = y; r.x2 = x + xl + 1; - r.y2 = y + yl; x *= 8; xl *= 8; @@ -342,19 +343,15 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour } break; case ch_bgi : { - _vm->_graphics->drawPicture(p, x * 8, y); - //putimage(x * 8, y, p, 0); - r.x1 = x; - r.y1 = y; r.x2 = x + xl + 1; - r.y2 = y + yl; + + _vm->_graphics->drawPicture_old(p, x * 8, y); + //putimage(x * 8, y, p, 0); } break; case ch_ega : { - r.x1 = x; - r.y1 = y; r.x2 = x + xl; - r.y2 = y + yl; + x *= 8; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index eb93423f98bb..0fcfdac023f7 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -116,7 +116,55 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) { +::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { + // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. + uint16 pictureWidth = file.readUint16LE() + 1; + uint16 pictureHeight = file.readUint16LE() + 1; + + ::Graphics::Surface picture; // We make a Surface object for the picture itself. + + picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); + + // Produce the picture. + for (byte y = 0; y < pictureHeight; y++) + for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (uint16 x = 0; x < pictureWidth; x += 8) { + byte pixel = file.readByte(); + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + } + } + + return picture; +} + +::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, uint16 height) { + ::Graphics::Surface picture; + + picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); + + for (byte plane = 0; plane < 4; plane++) + for (uint16 y = 0; y < height; y++) + for (uint16 x = 0; x < width; x += 8) { + byte pixel = file.readByte(); + for (byte i = 0; i < 8; i++) { + byte pixelBit = (pixel >> i) & 1; + *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); + } + } + + return picture; +} + +void Graphics::drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { + // Copy the picture to the given place on the screen. + for (uint16 y = 0; y < picture.h; y++) + for (uint16 x = 0; x < picture.w; x++) + *getPixel(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); +} + +void Graphics::drawPicture_old(const byte *source, uint16 destX, uint16 destY) { // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 pictureWidth = READ_LE_UINT16(source) + 1; uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1; @@ -141,7 +189,7 @@ void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) { // Copy the picture to a given place on the screen. for (uint16 y = 0; y < picture.h; y++) for (uint16 x = 0; x < picture.w; x++) - *(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + *getPixel(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); picture.free(); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 14eb3fa5c4cc..dfd06a4ad0ea 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -77,7 +77,16 @@ class Graphics { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(const byte *source, uint16 destX, uint16 destY); + + // The caller has to .free() the returned Surfaces!!! + ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. + + ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. + + + void drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + + void drawPicture_old(const byte *source, uint16 destX, uint16 destY); void refreshScreen(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fa1298a32223..76640739af6d 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -261,10 +261,16 @@ Gyro::~Gyro() { delete[] vmc.andpic; delete[] vmc.xorpic; - for (int fv = 0; fv < 2; fv ++) { + for (byte fv = 0; fv < 2; fv ++) { delete[] vmc.backpic[fv]; } + for (byte i = 0; i < 9; i++) { + digit[i].free(); + rwlite[i].free(); + } + digit[9].free(); + } void Gyro::newpointer(byte m) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index a99d4c660053..b2fc47fbf5e3 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -34,6 +34,8 @@ #include "common/scummsys.h" #include "common/file.h" +#include "graphics/surface.h" + #include "avalanche/roomnums.h" #include "avalanche/color.h" @@ -521,8 +523,11 @@ class Gyro { bool ontoolbar, seescroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char objlist[10]; - byte *digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - byte *rwlite[9]; // Maybe it will be needed to move them to the class itself instead. + + ::Graphics::Surface digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface rwlite[9]; // Maybe it will be needed to move them to the class itself instead. + // Called .free() for them in ~Gyro(). + byte oldrw; int8 lastscore[3]; byte cmp; /* current mouse-void **/ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 6ca03b073eba..c1136ed20c19 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -241,27 +241,15 @@ void Lucerna::load(byte n) { /* Load2, actually */ move(a0, a1, 12080); }*/ - ::Graphics::Surface background; + uint16 backgroundWidht = _vm->_graphics->kScreenWidth; byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) - background.create(backgroundWidht, backgroundHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - - for (byte plane = 0; plane < 4; plane++) - for (uint16 y = 0; y < backgroundHeight; y++) - for (uint16 x = 0; x < backgroundWidht; x += 8) { - byte pixel = f.readByte(); - for (byte i = 0; i < 8; i++) { - byte pixelBit = (pixel >> i) & 1; - *(byte *)background.getBasePtr(x + 7 - i, y) += (pixelBit << plane); - } - } + ::Graphics::Surface background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); - for (uint16 y = 0; y < backgroundHeight; y++) - for (uint16 x = 0; x < backgroundWidht; x++) - *_vm->_graphics->getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y); + _vm->_graphics->drawPicture(background, 0, 10); background.free(); @@ -759,15 +747,13 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * } f.seek(z * picsize + 65); + + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); - byte *buffer = new byte[picsize]; - - f.read(buffer, picsize); - - _vm->_graphics->drawPicture(buffer, 205, 170); - - delete[] buffer; + _vm->_graphics->drawPicture(picture, 205, 170); + picture.free(); + f.close(); _vm->_gyro->off(); @@ -793,13 +779,17 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ } for (byte fv = 0; fv < 10; fv ++) { - _vm->_gyro->digit[fv] = new byte[digitsize]; - f.read(_vm->_gyro->digit[fv], digitsize); + f.seek(fv * digitsize); + /*_vm->_gyro->digit[fv] = new byte[digitsize]; + f.read(_vm->_gyro->digit[fv], digitsize);*/ + _vm->_gyro->digit[fv] = _vm->_graphics->loadPictureGraphic(f); } for (byte ff = 0; ff < 9; ff ++) { - _vm->_gyro->rwlite[ff] = new byte[rwlitesize]; - f.read(_vm->_gyro->rwlite[ff], rwlitesize); + f.seek(10 * digitsize + ff * rwlitesize); + /*_vm->_gyro->rwlite[ff] = new byte[rwlitesize]; + f.read(_vm->_gyro->rwlite[ff], rwlitesize);*/ + _vm->_gyro->rwlite[ff] = _vm->_graphics->loadPictureGraphic(f); } f.close(); @@ -815,15 +805,11 @@ void Lucerna::toolbar() { /* off;*/ - uint32 bufferSize = f.size()-40; - - byte *buffer = new byte[bufferSize]; - - f.read(buffer, bufferSize); + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); - _vm->_graphics->drawPicture(buffer, 5, 169); + _vm->_graphics->drawPicture(picture, 5, 169); - delete[] buffer; + picture.free(); f.close(); From 0a4747d9159feae4b92d72dc5a724262315e1f7d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 14:19:54 +0200 Subject: [PATCH 0203/1332] AVALANCHE: Update rest of Celer accorded to the revision in Graphics. --- engines/avalanche/celer2.cpp | 118 ++++++----------------------------- engines/avalanche/celer2.h | 10 ++- 2 files changed, 26 insertions(+), 102 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 52b57b372504..be925ed767db 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -47,6 +47,11 @@ Celer::Celer(AvalancheEngine *vm) { num_chunks = 0; } +Celer::~Celer() { + for (byte i = 0; i < 40; i++) + memory[i].free(); +} + void Celer::pics_link() { byte xx; @@ -302,14 +307,14 @@ void Celer::load_chunks(Common::String xx) { if (ch.natural) { memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. memos[fv].size = memos[fv].xl * 8 * memos[fv].yl; - memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. + memory[fv].create(memos[fv].xl * 8, memos[fv].yl, ::Graphics::PixelFormat::createFormatCLUT8()); + for (uint16 j = 0; j < memos[fv].yl; j++) for (uint16 i = 0; i < memos[fv].xl * 8; i++) - memory[fv][j * memos[fv].xl * 8 + i] = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); + *(byte *)memory[fv].getBasePtr(i, j) = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); } else { memos[fv].size = ch.size; - memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it. - f.read(memory[fv], ch.size); + memory[fv] = _vm->_graphics->loadPictureRow(f, memos[fv].xl * 8, memos[fv].yl + 1); // Celer::forget_chunks() deallocates it. } } else memos[fv].x = on_disk; @@ -320,80 +325,35 @@ void Celer::load_chunks(Common::String xx) { void Celer::forget_chunks() { for (byte fv = 0; fv < num_chunks; fv ++) if (memos[fv].x > on_disk) - delete[] memory[fv]; + memory[fv].free(); memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */ } -void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) { +void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture) { r.x1 = x; r.y1 = y; r.y2 = y + yl; switch (flavour) { - case ch_natural_image: { - r.x2 = x + xl + 1; - - x *= 8; - xl *= 8; - - for (uint16 j = 0; j < yl; j++) - for (uint16 i = 0; i < xl; i++) - *_vm->_graphics->getPixel(x + i, y + j) = p[j * xl + i]; - } - break; + case ch_natural_image: // Allow fallthorugh on purpose. case ch_bgi : { r.x2 = x + xl + 1; - - _vm->_graphics->drawPicture_old(p, x * 8, y); - //putimage(x * 8, y, p, 0); } break; case ch_ega : { r.x2 = x + xl; - - - - x *= 8; - xl *= 8; - - - - ::Graphics::Surface picture; // We make a Surface object for the picture itself. - - picture.create(xl, yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - - uint32 h = 0; - - // Produce the picture. - for (int8 plane = 0; plane < 4; plane++) // The planes are in the opposite way. - for (byte j = 0; j < yl + 1; j++) - for (uint16 i = 0; i < xl; i += 8) { - byte pixel = p[h++]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *(byte *)picture.getBasePtr(i + 7 - bit, j) += (pixelBit << plane); - } - } - - // Copy the picture to a given place on the screen. - for (uint16 j = 0; j < picture.h; j++) - for (uint16 i = 0; i < picture.w; i++) - *_vm->_graphics->getPixel(i + x, j + y) = *(byte *)picture.getBasePtr(i, j); - - picture.free(); - - _vm->_lucerna->blitfix(); } break; } + + _vm->_graphics->drawPicture(picture, x * 8, y); } void Celer::show_one(byte which) { chunkblocktype ch; - byte *p; //setactivepage(3); warning("STUB: Celer::show_one()"); @@ -417,12 +377,11 @@ void Celer::show_one(byte which) { ch.natural = f.readByte(); ch.memorise = f.readByte(); - p = new byte[ch.size]; - f.read(p, ch.size); + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); // There'll may be problems with the width! - display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, p); + display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, picture); - delete[] p; + picture.free(); f.close(); } @@ -435,51 +394,12 @@ void Celer::show_one(byte which) { -void Celer::display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy) { - warning("STUB: Celer::display_it1()"); +void Celer::display_it_at(int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture, int16 &xxx, int16 &yyy) { + warning("STUB: Celer::display_it_at()"); } void Celer::show_one_at(byte which, int16 xxx, int16 yyy) { - chunkblocktype ch; - byte *p; - - //setactivepage(3); warning("STUB: Celer::show_one_at()"); - - if (memos[which].x > on_disk) { - display_it_at(memos[which].xl, memos[which].yl, memos[which].flavour, memory[which], xxx, yyy); - } else { - if (!f.open(filename)) { /* Filename was set in load_chunks() */ - warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); - return; - } - - f.seek(offsets[which]); - ch.flavour = flavourtype(f.readByte()); - ch.x = f.readSint16LE(); - ch.y = f.readSint16LE(); - ch.xl = f.readSint16LE(); - ch.yl = f.readSint16LE(); - ch.size = f.readSint32LE(); - ch.natural = f.readByte(); - ch.memorise = f.readByte(); - - { - p = new byte[ch.size]; - f.read(p, ch.size); - - display_it_at(ch.xl, ch.yl, ch.flavour, p, xxx, yyy); - - delete[] p; - f.close(); - } - } - - //setactivepage(1 - cp); - warning("STUB: Celer::show_one_at()"); - - for (byte fv = 0; fv < 2; fv ++) - _vm->_trip->getset[fv].remember(r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 2177ea2b92b1..46ba53f910a8 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -34,6 +34,8 @@ #include "common/file.h" #include "common/str.h" +#include "graphics/surface.h" + namespace Avalanche { class AvalancheEngine; @@ -61,13 +63,15 @@ class Celer { int32 offsets[40]; byte num_chunks; memotype memos[40]; - byte *memory[40]; + ::Graphics::Surface memory[40]; // .free() is called in ~Celer() bytefield r; Celer(AvalancheEngine *vm); + ~Celer(); + void pics_link(); void load_chunks(Common::String xx); @@ -87,9 +91,9 @@ class Celer { static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p); + void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture); - void display_it_at(int16 xl, int16 yl, flavourtype flavour, void *p, int16 &xxx, int16 &yyy); + void display_it_at(int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture, int16 &xxx, int16 &yyy); }; } // End of namespace Avalanche. From efe3a662bfec950f9be3477547627dd745a98d6d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 14:38:06 +0200 Subject: [PATCH 0204/1332] AVALANCHE: Add comments to Graphics. --- engines/avalanche/graphics.cpp | 7 ++++++- engines/avalanche/graphics.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0fcfdac023f7..1b5d686b0a2c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -117,6 +117,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { + // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 pictureWidth = file.readUint16LE() + 1; uint16 pictureHeight = file.readUint16LE() + 1; @@ -125,7 +126,7 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - // Produce the picture. + // Produce the picture. We read it in row-by-row, and every row has 4 planes. for (byte y = 0; y < pictureHeight; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. for (uint16 x = 0; x < pictureWidth; x += 8) { @@ -140,6 +141,10 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { } ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, uint16 height) { + // This function is our own creation, very much like the one above. The main differences are that + // we don't read the width and the height from the file, the planes are in a different order + // and we read the picture plane-by-plane. + ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index dfd06a4ad0ea..0cee2feb8fbd 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -82,7 +82,7 @@ class Graphics { ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. - + // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data void drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. From ff1bc9e5a54061b2eb9edd4975f05b5f88b0fca0 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 14:50:15 +0200 Subject: [PATCH 0205/1332] AVALANCHE: Get rid of Lucerna::mblit() and Lucerna::blitfix(). --- engines/avalanche/celer2.cpp | 2 - engines/avalanche/dropdown2.cpp | 2 - engines/avalanche/enid2.cpp | 1 - engines/avalanche/lucerna2.cpp | 117 +------------------------------- engines/avalanche/lucerna2.h | 4 -- engines/avalanche/pingo2.cpp | 1 - engines/avalanche/trip6.cpp | 9 +-- 7 files changed, 5 insertions(+), 131 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index be925ed767db..4d4a1fa8724f 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -343,8 +343,6 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour break; case ch_ega : { r.x2 = x + xl; - - _vm->_lucerna->blitfix(); } break; } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 134a3b0905e1..d2282c97bb06 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -309,8 +309,6 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2); } } - - _vm->_lucerna->blitfix(); } void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 9b67359ff0fc..ee37cc7dfcfa 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -246,7 +246,6 @@ void Enid::avvy_background() { /* Not really a filing procedure, @the_end: end; */ - _vm->_lucerna->blitfix(); } void Enid::to_sundry(sundry &sund) { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c1136ed20c19..7fe24cecc869 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1044,118 +1044,6 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). warning("STUB: Lucerna::showrw()"); } -void Lucerna::mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t) /* assembler; */ -/* The Minstrel Blitter */ -/* asm -{ ofsfr:=f*$4000+x1+y1*80; - ofsto:=t*$4000+x1+y1*80;} - - mov bx,80; { We're multiplying by 80. } - mov al,y1; - mul bl; { AX now contains y1*80. } - xor cx,cx; { Zero CX. } - mov cl,x1; { CX now equals x1 } - add ax,cx; { AX now contains x1+y1*80. } - mov si,ax; - mov di,ax; - - mov ax,$4000; - mov bl,f; - mul bx; { Note that this is a *uint16*! } - add si,ax; - - mov ax,$4000; - mov bl,t; - mul bx; { Note that this is a *uint16*! } - add di,ax; - - push ds; { *** <<<< *** WE MUST PRESERVE THIS! } - cld; { Clear Direction flag - we're going forwards! } - - mov ax,$A000; { The screen memory. } - mov ds,ax; - mov es,ax; { The same. } - - { AH stores the number of bytes to copy. } - { len:=(x2-x1)+1; } - - mov ah,x2; - sub ah,x1; - inc ah; - - { Firstly, let's decide how many times we're going round. } - - mov cl,y2; { How many numbers between y1 and y2? } - sub cl,y1; - inc cl; { Inclusive reckoning (for example, from 3 to 5 is 5-3+1=3 turns. } - - { We'll use SI and DI to be Ofsfr and Ofsto. } - - @Y_axis_loop: - push cx; - - - { OK... We've changed this loop from a for-next loop. "Bit" is - represented by CX. } - -{ port[$3c4]:=2; port[$3ce]:=4; } - mov dx,$3c4; - mov al,2; - out dx,al; - mov dx,$3ce; - mov al,4; - out dx,al; - - mov cx,4; { We have to copy planes 3, 2, 1 and Zero. We'll add 1 to the - number, because at zero it stops. } - - mov bx,3; { This has a similar function to that of CX. } - - @start_of_loop: - - push cx; - -{ port[$3C5]:=1 shl bit; } - mov dx,$3C5; - mov al,1; - mov cl,bl; { BL = bit. } - shl al,cl; - out dx,al; -{ port[$3CF]:=bit; } - mov dx,$3CF; - mov al,bl; { BL = bit. } - out dx,al; - -{ move(mem[$A000:ofsfr],mem[$A000:ofsto],len); } - - xor ch,ch; { Clear CH. } - mov cl,ah; - - repz movsb; { That's all we need to say! } - - mov cl,ah; - sub si,cx; { This is MUCH, MUCH faster than pushing and popping them! } - sub di,cx; - - pop cx; { Get the loop count back again. } - dec bx; { One less... } - loop @start_of_loop; { Until cx=0. } - - add si,80; { Do the next line... } - add di,80; - - pop cx; - loop @Y_axis_loop; - - pop ds; { Get it back again (or we'll be in trouble with TP!) } -*/ -{ -} - -void Lucerna::blitfix() { - warning("STUB: Lucerna::blitfix()"); -} - @@ -1194,10 +1082,9 @@ void Lucerna::delavvy() { _vm->_gyro->off(); triptype &with = _vm->_trip->tr[0]; - for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); + /*for (page_ = 0; page_ <= 1; page_ ++) + mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_);*/ - blitfix(); _vm->_gyro->on(); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 7486b0d3646a..efb45e2878e8 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -86,10 +86,6 @@ class Lucerna { void showrw(); - void mblit(byte x1, byte y1, byte x2, byte y2, byte f, byte t); /* The Minstrel Blitter */ - - void blitfix(); - void clock_lucerna(); void flip_page(); diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 00c99788beb4..4f3d17192bf0 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -128,7 +128,6 @@ void Pingo::winning_pic() { warning("STUB: Pingo::winning_pic()"); f.close(); - _vm->_lucerna->blitfix(); //setvisualpage(0); warning("STUB: Pingo::winning_pic()"); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 1a525d765e6d..8abf31308224 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -909,8 +909,8 @@ void Trip::call_special(uint16 which) { _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); - _vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); - _vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); + /*_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); + _vm->_lucerna->mblit(12, 80, 38, 160, 3, 1);*/ _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; @@ -1130,11 +1130,8 @@ void Trip::getback() { end; */ - _vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); + //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } - - _vm->_lucerna->blitfix(); - /* if endangered then Super_On; From 190e37d3f9f7b990722163df5aae247fdbe8688c Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 14:52:26 +0200 Subject: [PATCH 0206/1332] AVALANCHE: Remove Graphics::drawPicture_old(). --- engines/avalanche/graphics.cpp | 30 ------------------------------ engines/avalanche/graphics.h | 2 -- 2 files changed, 32 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 1b5d686b0a2c..12b94fe175f0 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -169,36 +169,6 @@ void Graphics::drawPicture(const ::Graphics::Surface &picture, uint16 destX, uin *getPixel(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); } -void Graphics::drawPicture_old(const byte *source, uint16 destX, uint16 destY) { - // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. - uint16 pictureWidth = READ_LE_UINT16(source) + 1; - uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1; - - uint32 i = 4; - - ::Graphics::Surface picture; // We make a Surface object for the picture itself. - - picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - - // Produce the picture. - for (byte y = 0; y < pictureHeight; y++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. - for (uint16 x = 0; x < pictureWidth; x += 8) { - byte pixel = source[i++]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); - } - } - - // Copy the picture to a given place on the screen. - for (uint16 y = 0; y < picture.h; y++) - for (uint16 x = 0; x < picture.w; x++) - *getPixel(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); - - picture.free(); -} - void Graphics::refreshScreen() { // These cycles are for doubling the screen height. ::Graphics::Surface picture; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 0cee2feb8fbd..67e9c5f0308a 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -86,8 +86,6 @@ class Graphics { void drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. - void drawPicture_old(const byte *source, uint16 destX, uint16 destY); - void refreshScreen(); private: From 5fe090a38c91845712635e897d7e1e3ea6983235 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 10:05:09 +0200 Subject: [PATCH 0207/1332] AVALANCHE: Add comments in Graphics and Trip, repair functions in Trip. --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/trip6.cpp | 15 +++++++++------ engines/avalanche/trip6.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 12b94fe175f0..e7fb6ea78b54 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -103,7 +103,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } /* Then we draw the picture to the blank places. */ - uint16 i = 0; // Because the original siltype starts at 5!!! See Graph.h for definition. + uint16 i = 0; // Because the original siltype starts at 5!!! See Graphics.h for definition. for (byte qay = 0; qay < sprite.yl; qay++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 8abf31308224..ff3a75726594 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* TRIP5 Trippancy V */ +/* TRIP5 Trippancy V - the sprite animation subsystem */ #include "avalanche/avalanche.h" @@ -204,7 +204,8 @@ void triptype::walk() { if (!_tr->_vm->_gyro->doing_sprite_run) { ox[_tr->_vm->_gyro->cp] = x; oy[_tr->_vm->_gyro->cp] = y; - if (homing) homestep(); + if (homing) + homestep(); x = x + ix; y = y + iy; } @@ -250,7 +251,8 @@ void triptype::walk() { count++; if (((ix != 0) || (iy != 0)) && (count > 1)) { step++; - if (step == a.seq) step = 0; + if (step == a.seq) + step = 0; count = 0; } } @@ -1365,9 +1367,9 @@ void Trip::trippancy_link() { } call_andexors(); - for (fv = 1; fv <= numtr; fv++) { - triptype &with = tr[fv]; - if (with.quick && with.call_eachstep) { + + for (fv = 0; fv < numtr; fv++) { + if (tr[fv].quick && tr[fv].call_eachstep) { switch (tr[fv].eachstep) { case procfollow_avvy_y : follow_avvy_y(fv); @@ -1391,6 +1393,7 @@ void Trip::trippancy_link() { } } } + if (mustexclaim) { mustexclaim = false; _vm->_visa->dixi('x', saywhat); diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 30fcba2a1640..b960edc3aed2 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* TRIP5 Trippancy V */ +/* TRIP5 Trippancy V - the sprite animation subsystem */ #ifndef TRIP6_H From d3ff894ff6a62a37543a8dbd25dace62b1ce69d9 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 10:17:32 +0200 Subject: [PATCH 0208/1332] AVALANCHE: Replace call of Basher::keyboard_link() with Avalanche::updateEvents() in Avalot::run(). --- engines/avalanche/avalot.cpp | 5 +++-- engines/avalanche/basher2.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6c49a669a191..3f967fb86823 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -182,8 +182,9 @@ void Avalot::run(Common::String arg) { do { uint32 beginLoop = _vm->_system->getMillis(); + _vm->updateEvents(); // The event handler. + _vm->_lucerna->clock_lucerna(); - _vm->_basher->keyboard_link(); _vm->_dropdown->menu_link(); _vm->_trip->readstick(); _vm->_gyro->force_numlock(); @@ -205,7 +206,7 @@ void Avalot::run(Common::String arg) { // Not in the original: - _vm->updateEvents(); // The event handler. + _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index eadf3dd3b107..476a6d35f7d0 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -31,6 +31,8 @@ // to do this, define the o.c.c. RECORD. Setting gyro.demo to True will // cause them to be played back. +// TODO: Replace these functions gradually with ScummVM's own methods. + #ifndef BASHER2_H #define BASHER2_H From c9fbfb6d32af41b3b55df553ecd7aa203dff5eed Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 10:30:16 +0200 Subject: [PATCH 0209/1332] AVALANCHE: Remove unnecessary indents from Visa. --- engines/avalanche/visa2.cpp | 186 ++++++++++++++++++------------------ 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 4ffedc236d98..5938f523d865 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -41,56 +41,105 @@ namespace Avalanche { - Visa::Visa(AvalancheEngine *vm) { - _vm = vm; +Visa::Visa(AvalancheEngine *vm) { + _vm = vm; +} + +bool Visa::bubbling = false; +bool Visa::report_dixi_errors = true; + +void Visa::unskrimble() { + for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) + _vm->_gyro->buffer[fv] = (char)((!(_vm->_gyro->buffer[fv]) - fv) % 256); +} + +void Visa::do_the_bubble() { + _vm->_gyro->bufsize++; + _vm->_gyro->buffer[_vm->_gyro->bufsize] = 2; +} + +void Visa::dixi(char block, byte point) { + Common::File indexfile, sezfile; + uint16 idx_offset, sez_offset; + bool error = false; + + if (!indexfile.open("avalot.idx")) { + warning("AVALANCHE: Visa: File not found: avalot.idx"); + return; } - bool Visa::bubbling = false; - bool Visa::report_dixi_errors = true; + indexfile.seek((toupper(block) - 65) * 2); + idx_offset = indexfile.readUint16LE(); + if (idx_offset == 0) + error = true; - void Visa::unskrimble() { - for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) - _vm->_gyro->buffer[fv] = (char)((!(_vm->_gyro->buffer[fv]) - fv) % 256); + indexfile.seek(idx_offset + point * 2); + sez_offset = indexfile.readUint16LE(); + if (sez_offset == 0) + error = true; + + indexfile.close(); + + went_ok = !error; + + if (error) { + if (report_dixi_errors) { + Common::String todisplay; + todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->strf(point).c_str()); + _vm->_scrolls->display(todisplay); + } + return; } - void Visa::do_the_bubble() { - _vm->_gyro->bufsize++; - _vm->_gyro->buffer[_vm->_gyro->bufsize] = 2; + if (!sezfile.open("avalot.sez")) { + warning("AVALANCHE: Visa: File not found: avalot.sez"); + return; } + sezfile.seek(sez_offset); + _vm->_gyro->bufsize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); + sezfile.close(); + unskrimble(); - void Visa::dixi(char block, byte point) { - Common::File indexfile, sezfile; - uint16 idx_offset, sez_offset; - bool error = false; + if (bubbling) do_the_bubble(); - if (!indexfile.open("avalot.idx")) { - warning("AVALANCHE: Visa: File not found: avalot.idx"); - return; - } + _vm->_scrolls->calldrivers(); +} - indexfile.seek((toupper(block) - 65) * 2); - idx_offset = indexfile.readUint16LE(); - if (idx_offset == 0) - error = true; +void Visa::speech(byte who, byte subject) { + Common::File indexfile, sezfile; + uint16 idx_offset, sez_offset, next_idx_offset; - indexfile.seek(idx_offset + point * 2); - sez_offset = indexfile.readUint16LE(); - if (sez_offset == 0) - error = true; + if (subject == 0) { + /* No subject. */ - indexfile.close(); + bubbling = true; + report_dixi_errors = false; + dixi('s', who); + bubbling = false; + report_dixi_errors = true; + } else { + /* Subject given. */ - went_ok = !error; + went_ok = false; /* Assume that until we know otherwise. */ - if (error) { - if (report_dixi_errors) { - Common::String todisplay; - todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->strf(point).c_str()); - _vm->_scrolls->display(todisplay); - } + if (!indexfile.open("converse.avd")) { + warning("AVALANCHE: Visa: File not found: converse.avd"); return; } + indexfile.seek(who * 2 - 2); + idx_offset = indexfile.readUint16LE(); + next_idx_offset = indexfile.readUint16LE(); + + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; + + indexfile.seek(idx_offset + subject * 2); + sez_offset = indexfile.readUint16LE(); + if ((sez_offset == 0) || (indexfile.err())) + return; + indexfile.close(); + if (!sezfile.open("avalot.sez")) { warning("AVALANCHE: Visa: File not found: avalot.sez"); return; @@ -99,71 +148,22 @@ namespace Avalanche { _vm->_gyro->bufsize = sezfile.readUint16LE(); sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); sezfile.close(); - unskrimble(); - if (bubbling) do_the_bubble(); + unskrimble(); + do_the_bubble(); _vm->_scrolls->calldrivers(); + went_ok = true; } - void Visa::speech(byte who, byte subject) { - Common::File indexfile, sezfile; - uint16 idx_offset, sez_offset, next_idx_offset; - - if (subject == 0) { - /* No subject. */ - - bubbling = true; - report_dixi_errors = false; - dixi('s', who); - bubbling = false; - report_dixi_errors = true; - } else { - /* Subject given. */ - - went_ok = false; /* Assume that until we know otherwise. */ - - if (!indexfile.open("converse.avd")) { - warning("AVALANCHE: Visa: File not found: converse.avd"); - return; - } - - indexfile.seek(who * 2 - 2); - idx_offset = indexfile.readUint16LE(); - next_idx_offset = indexfile.readUint16LE(); - - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; - - indexfile.seek(idx_offset + subject * 2); - sez_offset = indexfile.readUint16LE(); - if ((sez_offset == 0) || (indexfile.err())) - return; - indexfile.close(); - - if (!sezfile.open("avalot.sez")) { - warning("AVALANCHE: Visa: File not found: avalot.sez"); - return; - } - sezfile.seek(sez_offset); - _vm->_gyro->bufsize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); - sezfile.close(); - - unskrimble(); - do_the_bubble(); - - _vm->_scrolls->calldrivers(); - went_ok = true; - } + warning("STUB: Visa::speech()"); +} - warning("STUB: Visa::speech()"); - } +void Visa::talkto(byte whom) { + byte fv; + bool no_matches; - void Visa::talkto(byte whom) { - byte fv; - bool no_matches; - - warning("STUB: Visa::talkto()"); - } + warning("STUB: Visa::talkto()"); +} } // End of namespace Avalanche. From de97da2fe64fb713d547441a7510c71828376bb1 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 15:05:06 +0200 Subject: [PATCH 0210/1332] AVALANCHE: Implement Basher::plottext(). --- engines/avalanche/basher2.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 0ce98e71feda..5f873225f2ec 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -79,7 +79,25 @@ void Basher::init() { } void Basher::plottext() { - warning("STUB: Basher::plottext()"); + if (_vm->_gyro->mouse_near_text()) + _vm->_gyro->super_off(); + + cursor_off(); + + _vm->_graphics->drawBar(24, 161, 640, 169, black); + + for (byte i = 0; i < _vm->_gyro->current.size(); i++) + for (byte j = 0; j < 8; j++) { + byte pixel = _vm->_gyro->little[_vm->_gyro->current[i]][j]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit != 0) + *_vm->_graphics->getPixel(/*x * 8 + */ 24 + i * 8 + 7 - bit, 161 + j) = white; + } + } + + cursor_on(); + _vm->_gyro->super_on(); } void Basher::wipetext() { From 9c96417041ed16c1025fcf0fda7dc2b51a9dcf83 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 15:07:21 +0200 Subject: [PATCH 0211/1332] AVALANCHE: Add comments to Basher::plottext(). --- engines/avalanche/basher2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 5f873225f2ec..355bdaf71505 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -84,8 +84,9 @@ void Basher::plottext() { cursor_off(); - _vm->_graphics->drawBar(24, 161, 640, 169, black); + _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. + // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. for (byte i = 0; i < _vm->_gyro->current.size(); i++) for (byte j = 0; j < 8; j++) { byte pixel = _vm->_gyro->little[_vm->_gyro->current[i]][j]; From bda09042b584f1b5f0ad77cc35f53e953a3dd2ef Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 15:19:16 +0200 Subject: [PATCH 0212/1332] AVALANCHE: Rename little[] to characters[] and current to inputText in Gyro. --- engines/avalanche/basher2.cpp | 4 ++-- engines/avalanche/dropdown2.cpp | 2 +- engines/avalanche/gyro2.h | 4 ++-- engines/avalanche/scrolls2.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 355bdaf71505..16122fa66420 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -87,9 +87,9 @@ void Basher::plottext() { _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. - for (byte i = 0; i < _vm->_gyro->current.size(); i++) + for (byte i = 0; i < _vm->_gyro->inputText.size(); i++) for (byte j = 0; j < 8; j++) { - byte pixel = _vm->_gyro->little[_vm->_gyro->current[i]][j]; + byte pixel = _vm->_gyro->characters[_vm->_gyro->inputText[i]][j]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index d2282c97bb06..bc8414d1a6c3 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -287,7 +287,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { for (byte fv = 0; fv < z.size(); fv++) for (byte ff = 0; ff < 8; ff++) { - byte pixel = ~(_vm->_gyro->little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! + byte pixel = ~(_vm->_gyro->characters[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index b2fc47fbf5e3..3eee0772b764 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -481,7 +481,7 @@ class Gyro { - Common::String current; + Common::String inputText; byte curpos; bool cursoron; /* previous:^previoustype;*/ @@ -547,7 +547,7 @@ class Gyro { Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ byte cp, ledstatus, defaultled; - raw little; + raw characters; bool quote; /* 66 or 99 next? */ bool alive; char buffer[2000]; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 63358630c4cb..8250880f989c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -315,7 +315,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(_vm->_gyro->little[i],16); + f.read(_vm->_gyro->characters[i],16); f.close(); } From 7d3b69251fa0dc3cca7fa5e3f8f86198050e8177 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 16:55:03 +0200 Subject: [PATCH 0213/1332] AVALANCHE: Minor repairs in Basher. --- engines/avalanche/basher2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 16122fa66420..007c0b5e671f 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -93,7 +93,7 @@ void Basher::plottext() { for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) - *_vm->_graphics->getPixel(/*x * 8 + */ 24 + i * 8 + 7 - bit, 161 + j) = white; + *_vm->_graphics->getPixel(24 + i * 8 + 7 - bit, 161 + j) = white; } } @@ -205,7 +205,7 @@ void Basher::normal_edit() { /*if (!_vm->_gyro->current.empty()) _vm->_gyro->current.clear();*/ left_margin = 1; - _vm->_gyro->curpos = 1; + _vm->_gyro->curpos = 0; } } // End of namespace Avalanche. From 541f5f9c3b20311140d11f64f71678de2cc5c663 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 16:55:50 +0200 Subject: [PATCH 0214/1332] AVALANCHE: Implement Avalot::handleKeyDown() further. --- engines/avalanche/avalot.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3f967fb86823..ef0de6563561 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -89,7 +89,7 @@ void Avalot::setup() { _vm->_lucerna->load_digits(); _vm->_gyro->cheat = false; _vm->_gyro->cp = 0; - _vm->_gyro->curpos = 1; + _vm->_gyro->curpos = 0; _vm->_gyro->quote = true; _vm->_gyro->ledstatus = 177; _vm->_gyro->defaultled = 2; @@ -172,6 +172,29 @@ void Avalot::handleKeyDown(const Common::Event &event) { _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. break; } + + if (((32 <= event.kbd.ascii) && (event.kbd.ascii <= 46)) || ((48 <= event.kbd.ascii) && (event.kbd.ascii <= 223)) + || ((225 <= event.kbd.ascii) && (event.kbd.ascii <= 255))) { + byte inChar = event.kbd.ascii; + if (_vm->_dropdown->ddm_o.menunow) { + _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); + } else { + if (_vm->_gyro->inputText.size() < 76) { + if ((inChar == '"') || (inChar == '`')) { + if (_vm->_gyro->quote) + inChar = '`'; + else + inChar = '"'; + _vm->_gyro->quote = !_vm->_gyro->quote; // quote - unquote + } + + _vm->_gyro->inputText.insertChar(inChar, _vm->_gyro->curpos); + _vm->_gyro->curpos++; + _vm->_basher->plottext(); + } else + _vm->_gyro->blip(); + } + } } From 0703085d20330624a741c52583b4bbc9ed252498 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 17:00:02 +0200 Subject: [PATCH 0215/1332] AVALANCHE: Repair Avalot::handleKeyDown(). --- engines/avalanche/avalot.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ef0de6563561..d7dcff9677b4 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -173,8 +173,7 @@ void Avalot::handleKeyDown(const Common::Event &event) { break; } - if (((32 <= event.kbd.ascii) && (event.kbd.ascii <= 46)) || ((48 <= event.kbd.ascii) && (event.kbd.ascii <= 223)) - || ((225 <= event.kbd.ascii) && (event.kbd.ascii <= 255))) { + if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) { byte inChar = event.kbd.ascii; if (_vm->_dropdown->ddm_o.menunow) { _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); From 7c8d415a9422e5fb1e79d55682483d8f505c2230 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 17:19:35 +0200 Subject: [PATCH 0216/1332] AVALANCHE: Remove comment from Graphics. --- engines/avalanche/graphics.cpp | 2 -- engines/avalanche/graphics.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index e7fb6ea78b54..9fa4ffe62449 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -25,8 +25,6 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* Replacement class for the Graph unit from Pascal. */ - #include "avalanche/avalanche.h" #include "avalanche/graphics.h" diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 67e9c5f0308a..5cc5a2e1e307 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -25,8 +25,6 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* Replacement class for the Graph unit from Pascal. */ - #ifndef GRAPH_H #define GRAPH_H From 341bf679c00ae2de0f3350b1ec95d4b02b246093 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 17:22:56 +0200 Subject: [PATCH 0217/1332] AVALANCHE: Cosmetic repairs in Graphics. --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/graphics.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9fa4ffe62449..bed8136dd497 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -29,11 +29,11 @@ #include "avalanche/graphics.h" #include "common/system.h" +#include "common/rect.h" #include "engines/util.h" #include "graphics/palette.h" -#include "common/rect.h" namespace Avalanche { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 5cc5a2e1e307..3d32bdafcb66 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -25,8 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#ifndef GRAPH_H -#define GRAPH_H +#ifndef GRAPHICS_H +#define GRAPHICS_H #include "common/file.h" @@ -98,4 +98,4 @@ class Graphics { } // End of namespace Avalanche -#endif // GRAPH_H +#endif // GRAPHICS_H From eec48fa42e83f7bf364d61c8d2d687ad2a758830 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 21:36:07 +0200 Subject: [PATCH 0218/1332] AVALANCHE: Introduce new class: Parser. Update rest of the code accordingly. --- engines/avalanche/avalanche.cpp | 2 + engines/avalanche/avalanche.h | 2 + engines/avalanche/avalot.cpp | 27 ++--------- engines/avalanche/basher2.cpp | 29 ++---------- engines/avalanche/basher2.h | 2 - engines/avalanche/gyro2.h | 5 -- engines/avalanche/module.mk | 1 + engines/avalanche/parser.cpp | 82 +++++++++++++++++++++++++++++++++ engines/avalanche/parser.h | 57 +++++++++++++++++++++++ 9 files changed, 151 insertions(+), 56 deletions(-) create mode 100644 engines/avalanche/parser.cpp create mode 100644 engines/avalanche/parser.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 919481679c54..09695cd23608 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -57,6 +57,7 @@ AvalancheEngine::~AvalancheEngine() { delete _rnd; delete _graphics; + delete _parser; delete _avalot; delete _gyro; @@ -79,6 +80,7 @@ AvalancheEngine::~AvalancheEngine() { Common::ErrorCode AvalancheEngine::initialize() { _graphics = new Graphics(this); + _parser = new Parser(this); _avalot = new Avalot(this); _gyro = new Gyro(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index f43b6a7a0697..a2b7ab6ae8c3 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -31,6 +31,7 @@ #include "avalanche/console.h" #include "avalanche/graphics.h" +#include "avalanche/parser.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" @@ -66,6 +67,7 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: Graphics *_graphics; + Parser *_parser; Avalot *_avalot; Gyro *_gyro; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index d7dcff9677b4..ceaf7546012b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -89,8 +89,8 @@ void Avalot::setup() { _vm->_lucerna->load_digits(); _vm->_gyro->cheat = false; _vm->_gyro->cp = 0; - _vm->_gyro->curpos = 0; - _vm->_gyro->quote = true; + _vm->_parser->inputTextPos = 0; + _vm->_parser->quote = true; _vm->_gyro->ledstatus = 177; _vm->_gyro->defaultled = 2; /* TSkellern:=0; { Replace with a more local variable sometime }*/ @@ -173,27 +173,8 @@ void Avalot::handleKeyDown(const Common::Event &event) { break; } - if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) { - byte inChar = event.kbd.ascii; - if (_vm->_dropdown->ddm_o.menunow) { - _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); - } else { - if (_vm->_gyro->inputText.size() < 76) { - if ((inChar == '"') || (inChar == '`')) { - if (_vm->_gyro->quote) - inChar = '`'; - else - inChar = '"'; - _vm->_gyro->quote = !_vm->_gyro->quote; // quote - unquote - } - - _vm->_gyro->inputText.insertChar(inChar, _vm->_gyro->curpos); - _vm->_gyro->curpos++; - _vm->_basher->plottext(); - } else - _vm->_gyro->blip(); - } - } + if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) + _vm->_parser->handleInputText(event); } diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 007c0b5e671f..c91b3af751ef 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -78,29 +78,6 @@ void Basher::init() { #endif } -void Basher::plottext() { - if (_vm->_gyro->mouse_near_text()) - _vm->_gyro->super_off(); - - cursor_off(); - - _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. - - // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. - for (byte i = 0; i < _vm->_gyro->inputText.size(); i++) - for (byte j = 0; j < 8; j++) { - byte pixel = _vm->_gyro->characters[_vm->_gyro->inputText[i]][j]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - if (pixelBit != 0) - *_vm->_graphics->getPixel(24 + i * 8 + 7 - bit, 161 + j) = white; - } - } - - cursor_on(); - _vm->_gyro->super_on(); -} - void Basher::wipetext() { warning("STUB: Basher::wipetext()"); } @@ -202,10 +179,10 @@ void Basher::filename_edit() { void Basher::normal_edit() { entering_filename = false; - /*if (!_vm->_gyro->current.empty()) - _vm->_gyro->current.clear();*/ left_margin = 1; - _vm->_gyro->curpos = 0; + if (!_vm->_parser->inputText.empty()) + _vm->_parser->inputText.clear(); + _vm->_parser->inputTextPos = 0; } } // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index 476a6d35f7d0..3459144cd498 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -51,8 +51,6 @@ class Basher { void init(); - void plottext(); - void keyboard_link(); void cursor_on(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 3eee0772b764..27a184eb1e56 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -479,10 +479,6 @@ class Gyro { - - - Common::String inputText; - byte curpos; bool cursoron; /* previous:^previoustype;*/ Common::String last; @@ -548,7 +544,6 @@ class Gyro { byte cp, ledstatus, defaultled; raw characters; - bool quote; /* 66 or 99 next? */ bool alive; char buffer[2000]; uint16 bufsize; diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 306df155132c..e2dd67d6baa7 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -3,6 +3,7 @@ MODULE := engines/avalanche MODULE_OBJS = \ avalanche.o \ graphics.o \ + parser.o\ avalot.o \ console.o \ detection.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp new file mode 100644 index 000000000000..d8cd37a236dc --- /dev/null +++ b/engines/avalanche/parser.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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#include "avalanche/avalanche.h" +#include "avalanche/parser.h" + +namespace Avalanche { + +Parser::Parser(AvalancheEngine *vm) { + _vm = vm; +} + +void Parser::handleInputText(const Common::Event &event) { + byte inChar = event.kbd.ascii; + if (_vm->_dropdown->ddm_o.menunow) { + _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); + } else { + if (inputText.size() < 76) { + if ((inChar == '"') || (inChar == '`')) { + if (quote) + inChar = '`'; + else + inChar = '"'; + quote = !quote; // quote - unquote + } + + inputText.insertChar(inChar, inputTextPos); + inputTextPos++; + plotText(); + } else + _vm->_gyro->blip(); + } +} + +void Parser::plotText() { + if (_vm->_gyro->mouse_near_text()) + _vm->_gyro->super_off(); + + _vm->_basher->cursor_off(); + + _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. + + // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. + for (byte i = 0; i < _vm->_parser->inputText.size(); i++) + for (byte j = 0; j < 8; j++) { + byte pixel = _vm->_gyro->characters[_vm->_parser->inputText[i]][j]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit != 0) + *_vm->_graphics->getPixel(24 + i * 8 + 7 - bit, 161 + j) = white; + } + } + + _vm->_basher->cursor_on(); + _vm->_gyro->super_on(); +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h new file mode 100644 index 000000000000..da6ef6eabcd6 --- /dev/null +++ b/engines/avalanche/parser.h @@ -0,0 +1,57 @@ +/* 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 the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef PARSER_H +#define PARSER_H + +#include "common/events.h" + +namespace Avalanche { +class AvalancheEngine; + +class Parser { +public: + Common::String inputText; + byte inputTextPos; + bool quote; // 66 or 99 next? + + + + Parser(AvalancheEngine *vm); + + void handleInputText(const Common::Event &event); + + void plotText(); + +private: + AvalancheEngine *_vm; + +}; + +} // End of namespace Avalanche + +#endif // PARSER_H From 31f8e91444a17c9d48cbcb409c067d470cb7c36a Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 21:48:28 +0200 Subject: [PATCH 0219/1332] AVALANCHE: Rename variables in Parser. Add _leftMargin to Parser. Fix _leftMargins in Basher. --- engines/avalanche/avalot.cpp | 4 ++-- engines/avalanche/basher2.cpp | 8 ++++---- engines/avalanche/basher2.h | 1 - engines/avalanche/parser.cpp | 14 +++++++------- engines/avalanche/parser.h | 7 ++++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ceaf7546012b..772a6c75738a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -89,8 +89,8 @@ void Avalot::setup() { _vm->_lucerna->load_digits(); _vm->_gyro->cheat = false; _vm->_gyro->cp = 0; - _vm->_parser->inputTextPos = 0; - _vm->_parser->quote = true; + _vm->_parser->_inputTextPos = 0; + _vm->_parser->_quote = true; _vm->_gyro->ledstatus = 177; _vm->_gyro->defaultled = 2; /* TSkellern:=0; { Replace with a more local variable sometime }*/ diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index c91b3af751ef..dcd315839abb 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -179,10 +179,10 @@ void Basher::filename_edit() { void Basher::normal_edit() { entering_filename = false; - left_margin = 1; - if (!_vm->_parser->inputText.empty()) - _vm->_parser->inputText.clear(); - _vm->_parser->inputTextPos = 0; + _vm->_parser->_leftMargin = 0; + if (!_vm->_parser->_inputText.empty()) + _vm->_parser->_inputText.clear(); + _vm->_parser->_inputTextPos = 0; } } // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index 3459144cd498..0c865d43d33d 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -73,7 +73,6 @@ class Basher { AvalancheEngine *_vm; bool entering_filename; - byte left_margin; void wipetext(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d8cd37a236dc..7429fd9820c6 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -39,17 +39,17 @@ void Parser::handleInputText(const Common::Event &event) { if (_vm->_dropdown->ddm_o.menunow) { _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); } else { - if (inputText.size() < 76) { + if (_inputText.size() < 76) { if ((inChar == '"') || (inChar == '`')) { - if (quote) + if (_quote) inChar = '`'; else inChar = '"'; - quote = !quote; // quote - unquote + _quote = !_quote; // quote - unquote } - inputText.insertChar(inChar, inputTextPos); - inputTextPos++; + _inputText.insertChar(inChar, _inputTextPos); + _inputTextPos++; plotText(); } else _vm->_gyro->blip(); @@ -65,9 +65,9 @@ void Parser::plotText() { _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. - for (byte i = 0; i < _vm->_parser->inputText.size(); i++) + for (byte i = 0; i < _vm->_parser->_inputText.size(); i++) for (byte j = 0; j < 8; j++) { - byte pixel = _vm->_gyro->characters[_vm->_parser->inputText[i]][j]; + byte pixel = _vm->_gyro->characters[_vm->_parser->_inputText[i]][j]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index da6ef6eabcd6..e10ca15b8206 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -35,9 +35,10 @@ class AvalancheEngine; class Parser { public: - Common::String inputText; - byte inputTextPos; - bool quote; // 66 or 99 next? + Common::String _inputText; + byte _inputTextPos; + bool _quote; // 66 or 99 next? + byte _leftMargin; From df427ba7e833f98b295ceb7abe6f7fb86c1331b1 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 22:03:59 +0200 Subject: [PATCH 0220/1332] AVALANCHE: Broaden comment in avalot.h. --- engines/avalanche/avalot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 138d4b3ff6c8..a053267c9b5f 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -44,7 +44,7 @@ class Avalot { - void handleKeyDown(const Common::Event &event); // To replace Basher::keyboard_link(). + void handleKeyDown(const Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). From 825df596e66587963c59e51da831b938ae9d3886 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 27 Jul 2013 22:14:23 +0200 Subject: [PATCH 0221/1332] AVALANCHE: Add Parser::handleBackspace(). Update Avalot::handleKeyDown() accordingly. --- engines/avalanche/avalot.cpp | 2 ++ engines/avalanche/parser.cpp | 13 +++++++++++++ engines/avalanche/parser.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 772a6c75738a..f553c453a0f2 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -171,6 +171,8 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_KP5: _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. break; + case Common::KEYCODE_BACKSPACE : + _vm->_parser->handleBackspace(); } if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 7429fd9820c6..096aca3e602b 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -56,6 +56,19 @@ void Parser::handleInputText(const Common::Event &event) { } } +void Parser::handleBackspace() { + if (! _vm->_dropdown->ddm_o.menunow) { + if (_inputTextPos > _leftMargin) { + _inputTextPos--; + if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) + _quote = !_quote; + _inputText.deleteChar(_inputTextPos); + plotText(); + } else + _vm->_gyro->blip(); + } +} + void Parser::plotText() { if (_vm->_gyro->mouse_near_text()) _vm->_gyro->super_off(); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index e10ca15b8206..3dd5d37827fd 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -46,6 +46,8 @@ class Parser { void handleInputText(const Common::Event &event); + void handleBackspace(); + void plotText(); private: From a1a2fa2da8f54d5c573e45ff553c1440137b8b6a Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 10:00:14 +0200 Subject: [PATCH 0222/1332] AVALANCHE: Implement handling of the cursor in Parser. --- engines/avalanche/avalot.cpp | 10 +++++--- engines/avalanche/basher2.cpp | 13 ---------- engines/avalanche/basher2.h | 6 ----- engines/avalanche/gyro2.h | 1 - engines/avalanche/parser.cpp | 47 ++++++++++++++++++++++++++++++++--- engines/avalanche/parser.h | 9 +++++++ 6 files changed, 60 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f553c453a0f2..e1879e1b564f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -143,8 +143,8 @@ void Avalot::setup() { //setcolor(7); _vm->_gyro->holdthedawn = false; _vm->_lucerna->dawn(); - _vm->_gyro->cursoron = false; - _vm->_basher->cursor_on(); + _vm->_parser->_cursorState = false; + _vm->_parser->cursorOn(); _vm->_trip->newspeed(); if (! _vm->_gyro->reloaded) @@ -171,8 +171,12 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_KP5: _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. break; - case Common::KEYCODE_BACKSPACE : + case Common::KEYCODE_BACKSPACE: _vm->_parser->handleBackspace(); + break; + case Common::KEYCODE_RETURN: + _vm->_parser->handleReturn(); + break; } if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index dcd315839abb..8e51abeb9643 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -95,19 +95,6 @@ begin end else dec(curflash); end;*/ -void Basher::do_cursor() { - warning("STUB: Basher::do_cursor()"); -} - -void Basher::cursor_on() { - warning("STUB: Basher::cursor_on()"); -} - -void Basher::cursor_off() { - warning("STUB: Basher::cursor_off()"); -} - - void Basher::get_demorec() { warning("STUB: Basher::get_demorec()"); } diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index 0c865d43d33d..a6d70679458d 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -53,14 +53,10 @@ class Basher { void keyboard_link(); - void cursor_on(); - void get_demorec(); bool demo_ready(); - void cursor_off(); - void filename_edit(); void normal_edit(); @@ -76,8 +72,6 @@ class Basher { void wipetext(); - void do_cursor(); - char firstchar(Common::String x); void try_dd(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 27a184eb1e56..5038e51a08dd 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -479,7 +479,6 @@ class Gyro { - bool cursoron; /* previous:^previoustype;*/ Common::String last; dnatype dna; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 096aca3e602b..14eae449ed49 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -57,7 +57,7 @@ void Parser::handleInputText(const Common::Event &event) { } void Parser::handleBackspace() { - if (! _vm->_dropdown->ddm_o.menunow) { + if (!_vm->_dropdown->ddm_o.menunow) { if (_inputTextPos > _leftMargin) { _inputTextPos--; if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) @@ -69,11 +69,14 @@ void Parser::handleBackspace() { } } +void Parser::handleReturn() { +} + void Parser::plotText() { if (_vm->_gyro->mouse_near_text()) _vm->_gyro->super_off(); - _vm->_basher->cursor_off(); + cursorOff(); _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. @@ -88,8 +91,46 @@ void Parser::plotText() { } } - _vm->_basher->cursor_on(); + cursorOn(); _vm->_gyro->super_on(); } +void Parser::cursorOn() { + if (_cursorState == true) + return; + drawCursor(); + _cursorState = true; +} + +void Parser::cursorOff() { + if (_cursorState == false) + return; + drawCursor(); + _cursorState = false; +} + +void Parser::drawCursor() { + // Draw the '_' character. Similar to plotText(). + char cursor = '_'; + + for (byte j = 0; j < 8; j++) { + byte pixel = _vm->_gyro->characters[cursor][j]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit != 0) + *_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 161 + j) = white; + } + } + + + + bytefield bf; + bf.x1 = _inputTextPos + 1; + bf.x2 = _inputTextPos + 2; + bf.y1 = 168; + bf.y2 = 168; + for (byte fv = 0; fv <= 1; fv ++) + _vm->_trip->getset[fv].remember(bf); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 3dd5d37827fd..748498816fec 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -39,6 +39,7 @@ class Parser { byte _inputTextPos; bool _quote; // 66 or 99 next? byte _leftMargin; + bool _cursorState; @@ -48,11 +49,19 @@ class Parser { void handleBackspace(); + void handleReturn(); + void plotText(); + void cursorOn(); + + void cursorOff(); + private: AvalancheEngine *_vm; + void drawCursor(); + }; } // End of namespace Avalanche From ad7f8add4d8d9f888f5a2c5bcdae1b861d35ab06 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 10:46:46 +0200 Subject: [PATCH 0223/1332] AVALANCHE: Add tryDropdown() and _inputTextBackup to Parser, implement handleReturn(), stub tryDropdown() in Parser. --- engines/avalanche/basher2.cpp | 8 +-- engines/avalanche/basher2.h | 2 - engines/avalanche/gyro2.h | 1 - engines/avalanche/parser.cpp | 14 ++++ engines/avalanche/parser.h | 5 +- engines/avalanche/trip6.cpp | 128 +++++++++++++++++----------------- 6 files changed, 84 insertions(+), 74 deletions(-) diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 8e51abeb9643..0df3b39b0d67 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -56,8 +56,8 @@ Basher::Basher(AvalancheEngine *vm) { void Basher::init() { /* new(previous);*/ - if (!_vm->_gyro->last.empty()) - _vm->_gyro->last.clear(); + if (!_vm->_parser->_inputTextBackup.empty()) + _vm->_parser->_inputTextBackup.clear(); normal_edit(); @@ -140,9 +140,7 @@ char Basher::firstchar(Common::String x) { } -void Basher::try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */ - warning("STUB: Basher::try_dd()"); -} + void Basher::typein() { warning("STUB: Basher::typein()"); diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index a6d70679458d..bc62fe67cfd3 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -74,8 +74,6 @@ class Basher { char firstchar(Common::String x); - void try_dd(); - void typein(); }; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 5038e51a08dd..50ae339987f1 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -480,7 +480,6 @@ class Gyro { /* previous:^previoustype;*/ - Common::String last; dnatype dna; linetype lines[50]; /* For Also. */ int16 c; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 14eae449ed49..fca29adacec4 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -70,6 +70,16 @@ void Parser::handleBackspace() { } void Parser::handleReturn() { + if (_vm->_dropdown->ddm_o.menunow) + _vm->_parser->tryDropdown(); + else { + _vm->_logger->log_command(_inputText); + + if (!_inputText.empty()) + _inputTextBackup = _inputText; + _vm->_acci->parse(); + _vm->_acci->do_that(); + } } void Parser::plotText() { @@ -109,6 +119,10 @@ void Parser::cursorOff() { _cursorState = false; } +void Parser::tryDropdown() { + warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown. +} + void Parser::drawCursor() { // Draw the '_' character. Similar to plotText(). char cursor = '_'; diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 748498816fec..1cfb21bb52b4 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -36,11 +36,12 @@ class AvalancheEngine; class Parser { public: Common::String _inputText; + Common::String _inputTextBackup; byte _inputTextPos; bool _quote; // 66 or 99 next? byte _leftMargin; bool _cursorState; - + Parser(AvalancheEngine *vm); @@ -57,6 +58,8 @@ class Parser { void cursorOff(); + void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index ff3a75726594..d7823c363992 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1633,72 +1633,70 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ void Trip::handleMoveKey(const Common::Event &event) { - //if ((_vm->_gyro->ctrl == cjoy) | (!_vm->_gyro->dna.user_moves_avvy)) - // return; - // - // We don't mess around with the joystick. - - switch (event.kbd.keycode) { - case Common::KEYCODE_UP: - if (_vm->_gyro->dna.rw != up) { - _vm->_gyro->dna.rw = up; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_DOWN: - if (_vm->_gyro->dna.rw != down) { - _vm->_gyro->dna.rw = down; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_LEFT: - if (_vm->_gyro->dna.rw != left) { - _vm->_gyro->dna.rw = left; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_RIGHT: - if (_vm->_gyro->dna.rw != right) { - _vm->_gyro->dna.rw = right; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->dna.rw != ur) { - _vm->_gyro->dna.rw = ur; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->dna.rw != dr) { - _vm->_gyro->dna.rw = dr; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_END: - if (_vm->_gyro->dna.rw != dl) { - _vm->_gyro->dna.rw = dl; - rwsp(0, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case Common::KEYCODE_HOME: - if (_vm->_gyro->dna.rw != ul) { - _vm->_gyro->dna.rw = ul; - rwsp(0, _vm->_gyro->dna.rw); - } else + if (_vm->_dropdown->ddm_o.menunow) + _vm->_parser->tryDropdown(); + else + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + if (_vm->_gyro->dna.rw != up) { + _vm->_gyro->dna.rw = up; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_DOWN: + if (_vm->_gyro->dna.rw != down) { + _vm->_gyro->dna.rw = down; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_LEFT: + if (_vm->_gyro->dna.rw != left) { + _vm->_gyro->dna.rw = left; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_RIGHT: + if (_vm->_gyro->dna.rw != right) { + _vm->_gyro->dna.rw = right; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEUP: + if (_vm->_gyro->dna.rw != ur) { + _vm->_gyro->dna.rw = ur; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEDOWN: + if (_vm->_gyro->dna.rw != dr) { + _vm->_gyro->dna.rw = dr; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_END: + if (_vm->_gyro->dna.rw != dl) { + _vm->_gyro->dna.rw = dl; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_HOME: + if (_vm->_gyro->dna.rw != ul) { + _vm->_gyro->dna.rw = ul; + rwsp(0, _vm->_gyro->dna.rw); + } else + stopwalking(); + break; + case Common::KEYCODE_KP5: stopwalking(); - break; - case Common::KEYCODE_KP5: - stopwalking(); - break; - } + break; + } } From 17b2fb02c0cff674edeb4eeb0640e1739f71c457 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 16:46:15 +0200 Subject: [PATCH 0224/1332] AVALANCHE: Partially implement Acci::parse(), add Acci::pos(), Acci::clearwords(), reimplement Acci::wordnum(), implement Acci::punctustrip(). --- engines/avalanche/acci2.cpp | 224 ++++++++++++++++++++++++++++++++---- engines/avalanche/acci2.h | 5 +- 2 files changed, 205 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index e87e120d0f86..6f03d7f32c12 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -43,6 +43,8 @@ #include "common/textconsole.h" +#include + /*#include "NimUnit.h"*/ /*#include "Highs.h"*/ @@ -224,27 +226,25 @@ void Acci::init() { _vm->_gyro->weirdword = false; } -void Acci::checkword(Common::String &x) { /* Checks uint16 "fv". */ - warning("STUB: Acci::checkuint16()"); +void Acci::clearwords() { + for (byte i = 0; i < 11; i++) + if (!realwords[i].empty()) + realwords[i].clear(); } -Common::String Acci::wordnum(Common::String x) -{ - char whatsit; - uint16 fv; - bool gotcha; - - Common::String wordnum_result; - if (x == "") { - wordnum_result = ""; - return wordnum_result; +byte Acci::wordnum(Common::String x) { + if (x.empty()) + return 0; + + byte whatsit = pardon; + bool gotcha = false; + for (uint16 fv = 0; fv < nowords; fv++) { + if ((words[fv].w == x) || ((Common::String(words[fv].w.c_str(), x.size()) == x) && !gotcha)) + whatsit = words[fv].n; + if (words[fv].w == x) + gotcha = true; } - whatsit = pardon; - gotcha = false; - for (fv = nowords; fv >= 1; fv--) - checkword(x); - wordnum_result = whatsit; - return wordnum_result; + return whatsit; } void Acci::replace(Common::String old1, Common::String new1) { @@ -314,7 +314,15 @@ void Acci::cheatparse(Common::String codes) { } void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. */ - warning("STUB: Acci::punctustrip()"); + const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; + + for (byte fv = 0; fv < 32; fv++) + do { + int16 p = pos(Common::String(punct[fv]), x); + if (p == -1) + break; + x.deleteChar(p); + } while (true); } @@ -370,14 +378,186 @@ void Acci::clearuint16s() { warning("STUB: Acci::clearuint16s()"); } +int16 Acci::pos(const Common::String &crit, const Common::String &src) { + if (src.contains(crit)) + return strstr(src.c_str(),crit.c_str()) - src.c_str(); + else + return -1; +} + void Acci::parse() { byte n, fv, ff; - Common::String c, cc, thisuint16; + Common::String c, cc, thisword; Common::String answer; bool notfound; - /* first parsing - uint16 identification */ - warning("STUB: Acci::parse()"); + // First parsing - word identification + + thats = ""; + c = _vm->_parser->_inputText + ' '; + n = 0; + polite = false; + verb = pardon; + thing = pardon; + thing2 = pardon; + person = pardon; + clearwords(); + if (_vm->_parser->_inputText[0] == '.') { + // A cheat mode attempt. + cheatparse(_vm->_parser->_inputText); + thats = nowt; + return; + } // Not our department! Otherwise... + + // Are we being interrogated right now? + + if (_vm->_gyro->interrogation > 0) { + store_interrogation(_vm->_gyro->interrogation); + _vm->_gyro->weirdword = true; + return; + } + + cc = c; + c.toUppercase(); + while (!c.empty()) { + while ((c[0] == ' ') && (!c.empty())) { + c.deleteChar(0); + cc.deleteChar(0); + } + + // Get the first words of the strings. + byte size = pos(Common::String(' '), c) + 1; + char *subStr = new char[size]; + Common::strlcpy(subStr, c.c_str(), size); + thisword = subStr; + Common::strlcpy(subStr, cc.c_str(), size); + realwords[n] = subStr; + delete[] subStr; + + punctustrip(c); + + notfound = true; + if (!thisword.empty()) { + for (ff = 0; ff < 31; ff++) { // Check Also, FIRST! + if (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1) { + thats = thats + Common::String(99 + ff); + notfound = false; + } + } + } + + if (notfound) { + answer = wordnum(thisword); + if (answer[0] == pardon) { + notfound = true; + thats = thats + pardon; + } else + thats = thats + answer; + n++; + } + + c.deleteChar(pos(c, Common::String(' '))); + cc.deleteChar(pos(cc, Common::String(' '))); + } + + //if (pos("\376", thats) > 0) unknown = realwords[pos("\376", thats)]; + //else unknown = ""; + //replace("\377", ""); /* zap noise words */ + //replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */ + //replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */ + //replace(string('\4') + '\343', "\21"); /* "get up" = "stand" */ + //replace(string('\4') + '\347', "\21"); /* "get down" = "stand"... well, why not? */ + //replace(string('\22') + '\344', "\2"); /* "go in" = "open [door]" */ + //replace(string('\34') + '\345', "\375"); /* "P' off" is a swear word */ + //replace(string('\4') + '\6', "\6"); /* "Take inventory" (remember Colossal Adventure?) */ + //replace(string('\50') + '\350', "\25"); /* "put on" = "don" */ + //replace(string('\4') + '\345', "\24"); /* "take off" = "doff" */ + + //* Words that could mean more than one person */ + //{ + // if (room == r__nottspub) replace("\314", "\244"); /* Barman = Port */ + // else replace("\314", "\232"); /* Barman = Malagauche */ + // switch (room) { + // case r__aylesoffice: + // replace("\313", "\243"); + // break; /* Monk = Ayles */ + // case r__musicroom: + // replace("\313", "\246"); + // break; /* Monk = Jacques */ + // default: + // replace("\313", "\242"); /* Monk = Ibythneth */ + // } + //} + + //if (do_pronouns()) { + // weirdword = true; + // thats = nowt; + // return; + //} + + //* second parsing - accidence */ + + //subject = ""; + //subjnumber = 0; /* Find subject of conversation. */ + //for (fv = 1; fv <= 11; fv ++) + // if (set::of('`', '\'', eos).has(realwords[fv][1])) { + // subjnumber = ord(thats[fv]); + // thats[fv] = moved; + // flush(); /* Only the second time I've used that! */ + // } + + //if (subjnumber == 0) /* Still not found. */ + // for (fv = 1; fv <= 10; fv ++) + // if (thats[fv] == '\374') { /* the word is "about", or something similar */ + // subjnumber = ord(thats[fv + 1]); + // thats[fv + 1] = '\0'; + // flush(); /* ...Third! */ + // } + + //if (subjnumber == 0) /* STILL not found! Must be the word after "say". */ + // for (fv = 1; fv <= 10; fv ++) + // if ((thats[fv] == '\7') && !(set::of('\0', range('\341', '\345'), eos).has(thats[fv + 1]))) { + // /* SAY not followed by a preposition */ + // subjnumber = ord(thats[fv + 1]); + // thats[fv + 1] = '\0'; + // flush(); /* ...Fourth! */ + // } + + //for (fv = length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ + // switch (thats[fv]) { + // case '\1' ... '\61': + // case '\375': + // case '\371': + // verb = thats[fv]; + // break; + // case '\62' ... '\225': { + // thing2 = thing; + // thing = thats[fv]; + // } + // break; + // case '\226' ... '\307': + // person = thats[fv]; + // break; + // case '\373': + // polite = true; + // break; + //} + + //if ((unknown != "") && ! + // (set::of(vb_exam, vb_talk, vb_save, vb_load, vb_dir, eos).has(verb))) { + // display(string("Sorry, but I have no idea what `") + unknown + + // "\" means. Can you rephrase it?"); + // weirdword = true; + //} else weirdword = false; + + //if (thats == "") thats = nowt; + + //if (thing != pardon) it = thing; + + //if (person != pardon) { + // if (person < '\257') him = person; + // else her = person; + //} } void Acci::examobj() { /* Examine a standard object-thing */ diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 40cda48af160..dbc96f479b6f 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -147,8 +147,7 @@ class Acci { byte fv; - void checkword(Common::String &x); - Common::String wordnum(Common::String x); + byte wordnum(Common::String x); void replace(Common::String old1, Common::String new1); @@ -212,6 +211,8 @@ class Acci { void heythanks(); + int16 pos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + }; } // End of namespace Avalanche. From 9474e2dc61c25abab1b069de3d94b49ef25b655b Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 18:50:46 +0200 Subject: [PATCH 0225/1332] AVALANCHE: Revisions in acci2.h and lucerna2.cpp, partially implement Acci::parse() and functions connected to it. --- engines/avalanche/acci2.cpp | 36 +++++++---- engines/avalanche/acci2.h | 108 ++++++++++++++++----------------- engines/avalanche/lucerna2.cpp | 2 - 3 files changed, 78 insertions(+), 68 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 6f03d7f32c12..1716b60d51be 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -235,10 +235,10 @@ void Acci::clearwords() { byte Acci::wordnum(Common::String x) { if (x.empty()) return 0; - + byte whatsit = pardon; bool gotcha = false; - for (uint16 fv = 0; fv < nowords; fv++) { + for (int32 fv = nowords - 1; fv >= 0; fv--) { if ((words[fv].w == x) || ((Common::String(words[fv].w.c_str(), x.size()) == x) && !gotcha)) whatsit = words[fv].n; if (words[fv].w == x) @@ -388,12 +388,13 @@ int16 Acci::pos(const Common::String &crit, const Common::String &src) { void Acci::parse() { byte n, fv, ff; Common::String c, cc, thisword; - Common::String answer; + byte answer; bool notfound; // First parsing - word identification - thats = ""; + if (!thats.empty()) + thats.clear(); c = _vm->_parser->_inputText + ' '; n = 0; polite = false; @@ -410,7 +411,6 @@ void Acci::parse() { } // Not our department! Otherwise... // Are we being interrogated right now? - if (_vm->_gyro->interrogation > 0) { store_interrogation(_vm->_gyro->interrogation); _vm->_gyro->weirdword = true; @@ -437,9 +437,11 @@ void Acci::parse() { punctustrip(c); notfound = true; + + // Check also first, which conatins words about the actual room. if (!thisword.empty()) { - for (ff = 0; ff < 31; ff++) { // Check Also, FIRST! - if (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1) { + for (ff = 0; ff < 31; ff++) { + if ((_vm->_gyro->also[ff][0] != 0) && (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) { thats = thats + Common::String(99 + ff); notfound = false; } @@ -448,7 +450,7 @@ void Acci::parse() { if (notfound) { answer = wordnum(thisword); - if (answer[0] == pardon) { + if (answer == pardon) { notfound = true; thats = thats + pardon; } else @@ -456,12 +458,22 @@ void Acci::parse() { n++; } - c.deleteChar(pos(c, Common::String(' '))); - cc.deleteChar(pos(cc, Common::String(' '))); + int16 spacePos = pos(Common::String(' '), c); + if (spacePos > -1) + for (byte i = 0; i <= spacePos; i++) + c.deleteChar(0); + spacePos = pos(Common::String(' '), cc); + if (spacePos > -1) + for (byte i = 0; i <= spacePos; i++) + cc.deleteChar(0); } - //if (pos("\376", thats) > 0) unknown = realwords[pos("\376", thats)]; - //else unknown = ""; + if (pos(Common::String(254), thats) > -1) + unknown = realwords[pos("\376", thats)]; + else + if (!unknown.empty()) + unknown.clear(); + //replace("\377", ""); /* zap noise words */ //replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */ //replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */ diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index dbc96f479b6f..bb55dac570a0 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -39,62 +39,62 @@ class AvalancheEngine; class Acci { public: /* verb codes */ - static const char vb_exam = 1; - static const char vb_open = 2; - static const char vb_pause = 3; - static const char vb_get = 4; - static const char vb_drop = 5; - static const char vb_inv = 6; - static const char vb_talk = 7; - static const char vb_give = 8; - static const char vb_drink = 9; - static const char vb_load = 10; - static const char vb_save = 11; - static const char vb_pay = 12; - static const char vb_look = 13; - static const char vb_break = 14; - static const char vb_quit = 15; - static const char vb_sit = 16; - static const char vb_stand = 17; - static const char vb_go = 18; - static const char vb_info = 19; - static const char vb_undress = 20; - static const char vb_wear = 21; - static const char vb_play = 22; - static const char vb_ring = 23; - static const char vb_help = 24; - static const char vb_larrypass = 25; - static const char vb_phaon = 26; - static const char vb_boss = 27; - static const char vb_pee = 28; - static const char vb_cheat = 29; - static const char vb_magic = 30; - static const char vb_restart = 31; - static const char vb_eat = 32; - static const char vb_listen = 33; - static const char vb_buy = 34; - static const char vb_attack = 35; - static const char vb_password = 36; - static const char vb_dir = 37; - static const char vb_die = 38; - static const char vb_score = 39; - static const char vb_put = 40; - static const char vb_kiss = 41; - static const char vb_climb = 42; - static const char vb_jump = 43; - static const char vb_highscores = 44; - static const char vb_wake = 45; - static const char vb_hello = 46; - static const char vb_thanks = 47; - - static const char vb_smartalec = 249; - static const char vb_expletive = 253; - - static const char pardon = 254; /* =didn't understand / wasn't given. */ + static const byte vb_exam = 1; + static const byte vb_open = 2; + static const byte vb_pause = 3; + static const byte vb_get = 4; + static const byte vb_drop = 5; + static const byte vb_inv = 6; + static const byte vb_talk = 7; + static const byte vb_give = 8; + static const byte vb_drink = 9; + static const byte vb_load = 10; + static const byte vb_save = 11; + static const byte vb_pay = 12; + static const byte vb_look = 13; + static const byte vb_break = 14; + static const byte vb_quit = 15; + static const byte vb_sit = 16; + static const byte vb_stand = 17; + static const byte vb_go = 18; + static const byte vb_info = 19; + static const byte vb_undress = 20; + static const byte vb_wear = 21; + static const byte vb_play = 22; + static const byte vb_ring = 23; + static const byte vb_help = 24; + static const byte vb_larrypass = 25; + static const byte vb_phaon = 26; + static const byte vb_boss = 27; + static const byte vb_pee = 28; + static const byte vb_cheat = 29; + static const byte vb_magic = 30; + static const byte vb_restart = 31; + static const byte vb_eat = 32; + static const byte vb_listen = 33; + static const byte vb_buy = 34; + static const byte vb_attack = 35; + static const byte vb_password = 36; + static const byte vb_dir = 37; + static const byte vb_die = 38; + static const byte vb_score = 39; + static const byte vb_put = 40; + static const byte vb_kiss = 41; + static const byte vb_climb = 42; + static const byte vb_jump = 43; + static const byte vb_highscores = 44; + static const byte vb_wake = 45; + static const byte vb_hello = 46; + static const byte vb_thanks = 47; + + static const byte vb_smartalec = 249; + static const byte vb_expletive = 253; + + static const byte pardon = 254; /* =didn't understand / wasn't given. */ static const int16 nowords = 277; /* how many words does the parser know? */ - static const char nowt = 372; - static const char moved = 0; /* This word was moved. (Usually because it was the subject of + static const byte nowt = 372; + static const byte moved = 0; /* This word was moved. (Usually because it was the subject of conversation.) */ static const int16 first_password = 89; /* Words[first_password] should equal "TIROS". */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 7fe24cecc869..eb5f5094c965 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -110,8 +110,6 @@ void Lucerna::unscramble() { scram1(*_vm->_gyro->also[fv][ff]); scram1(_vm->_gyro->listen); scram1(_vm->_gyro->flags); - /* for fz:=1 to length(also[fv,ff]^) do - also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/ } void Lucerna::load_also(Common::String n) { From 591a4852c48a3566ace1e73ac28ad567e65eb34b Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 20:57:40 +0200 Subject: [PATCH 0226/1332] AVALANCHE: Repair parser, implement Acci::replace(), further implement Acci:parse(). --- engines/avalanche/acci2.cpp | 64 +++++++++++++++++++++--------------- engines/avalanche/acci2.h | 2 +- engines/avalanche/parser.cpp | 7 ++-- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1716b60d51be..66b7874e6edf 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -236,19 +236,25 @@ byte Acci::wordnum(Common::String x) { if (x.empty()) return 0; - byte whatsit = pardon; - bool gotcha = false; - for (int32 fv = nowords - 1; fv >= 0; fv--) { - if ((words[fv].w == x) || ((Common::String(words[fv].w.c_str(), x.size()) == x) && !gotcha)) - whatsit = words[fv].n; - if (words[fv].w == x) - gotcha = true; - } - return whatsit; + for (int32 fv = nowords - 1; fv >= 0; fv--) + if ((words[fv].w == x) || (Common::String(words[fv].w.c_str(), x.size()) == x)) + return words[fv].n; + + return pardon; } -void Acci::replace(Common::String old1, Common::String new1) { - warning("STUB: Acci::replace()"); +void Acci::replace(Common::String old1, byte new1) { + int16 q = pos(old1, thats); + while (q != -1) { + if (new1 == 0) + thats.deleteChar(q); + else { + for (byte i = q; i < q + old1.size(); i++) + thats.deleteChar(q); + thats.insertChar(new1, q); + } + q = pos(old1, thats); + } } /*procedure ninetydump; @@ -403,12 +409,14 @@ void Acci::parse() { thing2 = pardon; person = pardon; clearwords(); + + + // A cheat mode attempt. if (_vm->_parser->_inputText[0] == '.') { - // A cheat mode attempt. cheatparse(_vm->_parser->_inputText); thats = nowt; return; - } // Not our department! Otherwise... + } // Are we being interrogated right now? if (_vm->_gyro->interrogation > 0) { @@ -417,6 +425,7 @@ void Acci::parse() { return; } + // Actually process the command. cc = c; c.toUppercase(); while (!c.empty()) { @@ -425,7 +434,7 @@ void Acci::parse() { cc.deleteChar(0); } - // Get the first words of the strings. + // Get the following word of the strings. byte size = pos(Common::String(' '), c) + 1; char *subStr = new char[size]; Common::strlcpy(subStr, c.c_str(), size); @@ -438,7 +447,7 @@ void Acci::parse() { notfound = true; - // Check also first, which conatins words about the actual room. + // Check also[] first, which conatins words about the actual room. if (!thisword.empty()) { for (ff = 0; ff < 31; ff++) { if ((_vm->_gyro->also[ff][0] != 0) && (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) { @@ -448,6 +457,7 @@ void Acci::parse() { } } + // Check Accis's own tables for "global" commands. if (notfound) { answer = wordnum(thisword); if (answer == pardon) { @@ -458,6 +468,7 @@ void Acci::parse() { n++; } + // Delete words we already processed. int16 spacePos = pos(Common::String(' '), c); if (spacePos > -1) for (byte i = 0; i <= spacePos; i++) @@ -469,21 +480,22 @@ void Acci::parse() { } if (pos(Common::String(254), thats) > -1) - unknown = realwords[pos("\376", thats)]; + unknown = realwords[pos(Common::String(254), thats)]; else if (!unknown.empty()) unknown.clear(); - //replace("\377", ""); /* zap noise words */ - //replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */ - //replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */ - //replace(string('\4') + '\343', "\21"); /* "get up" = "stand" */ - //replace(string('\4') + '\347', "\21"); /* "get down" = "stand"... well, why not? */ - //replace(string('\22') + '\344', "\2"); /* "go in" = "open [door]" */ - //replace(string('\34') + '\345', "\375"); /* "P' off" is a swear word */ - //replace(string('\4') + '\6', "\6"); /* "Take inventory" (remember Colossal Adventure?) */ - //replace(string('\50') + '\350', "\25"); /* "put on" = "don" */ - //replace(string('\4') + '\345', "\24"); /* "take off" = "doff" */ + // Replace words' codes that mean the same. + replace(Common::String(255), 0); /* zap noise words */ + replace(Common::String(13) + 226, 1); // "look at" = "examine" + replace(Common::String(13) + 228, 1); // "look in" = "examine" + replace(Common::String(4) + 227, 17); // "get up" = "stand" + replace(Common::String(4) + 231, 17); // "get down" = "stand"... well, why not? + replace(Common::String(18) + 228, 2); // "go in" = "open [door]" + replace(Common::String(28) + 229, 253); // "P' off" is a swear word + replace(Common::String(4) + 6, 6); // "Take inventory" (remember Colossal Adventure?) + replace(Common::String(40) + 232, 21); // "put on" = "don" + replace(Common::String(4) + 229, 20); // "take off" = "doff" //* Words that could mean more than one person */ //{ diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index bb55dac570a0..d4efa028225b 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -149,7 +149,7 @@ class Acci { byte wordnum(Common::String x); - void replace(Common::String old1, Common::String new1); + void replace(Common::String old1, byte new1); Common::String rank(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fca29adacec4..5a23a24e69aa 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -75,10 +75,11 @@ void Parser::handleReturn() { else { _vm->_logger->log_command(_inputText); - if (!_inputText.empty()) + if (!_inputText.empty()) { _inputTextBackup = _inputText; - _vm->_acci->parse(); - _vm->_acci->do_that(); + _vm->_acci->parse(); + _vm->_acci->do_that(); + } } } From 9b9c9d0fa5f41d4cc029411449421f7264d7d8ca Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 28 Jul 2013 23:13:34 +0200 Subject: [PATCH 0227/1332] AVALANCHE: Implement Acci::do_pronouns() and Acci::displaywhat(). --- engines/avalanche/acci2.cpp | 88 +++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 66b7874e6edf..f85d9df2866f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -334,23 +334,46 @@ void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. void Acci::displaywhat(char ch, bool animate, bool &ambigous) { /* << it's an adjective! */ - byte ff; - Common::String z; - - warning("STUB: Acci::_vm->_scrolls->displaywhat()"); + if (ch == pardon) { + ambigous = true; + if (animate) + _vm->_scrolls->display("Whom?"); + else + _vm->_scrolls->display("What?"); + } else { + if (animate) + _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getname(ch) + " }"); + else { + Common::String z = _vm->_gyro->get_better(ch); + if (z != "") + _vm->_scrolls->display(Common::String("{ ") + z + " }"); + } + } } bool Acci::do_pronouns() { - bool ambiguous; - byte fv; + bool ambiguous = false; - bool do_pronouns_result; - ambiguous = false; - - warning("STUB: Acci::do_pronouns()"); + for (byte fv = 0; fv < thats.size(); fv++) + switch (thats[fv]) { + case 200: { + displaywhat(_vm->_gyro->him, true, ambiguous); + thats.setChar(_vm->_gyro->him, fv); + } + break; + case 201: { + displaywhat(_vm->_gyro->her, true, ambiguous); + thats.setChar(_vm->_gyro->her, fv); + } + break; + case 202: { + displaywhat(_vm->_gyro->it, false, ambiguous); + thats.setChar(_vm->_gyro->it, fv); + } + break; + } - do_pronouns_result = ambiguous; - return do_pronouns_result; + return ambiguous; } void Acci::lowercase() { @@ -497,27 +520,28 @@ void Acci::parse() { replace(Common::String(40) + 232, 21); // "put on" = "don" replace(Common::String(4) + 229, 20); // "take off" = "doff" - //* Words that could mean more than one person */ - //{ - // if (room == r__nottspub) replace("\314", "\244"); /* Barman = Port */ - // else replace("\314", "\232"); /* Barman = Malagauche */ - // switch (room) { - // case r__aylesoffice: - // replace("\313", "\243"); - // break; /* Monk = Ayles */ - // case r__musicroom: - // replace("\313", "\246"); - // break; /* Monk = Jacques */ - // default: - // replace("\313", "\242"); /* Monk = Ibythneth */ - // } - //} + // Words that could mean more than one person + if (_vm->_gyro->dna.room == r__nottspub) + replace(Common::String(204), 164); // Barman = Port + else + replace(Common::String(204), 154); // Barman = Malagauche - //if (do_pronouns()) { - // weirdword = true; - // thats = nowt; - // return; - //} + switch (_vm->_gyro->dna.room) { + case r__aylesoffice: + replace(Common::String(203), 163); // Monk = Ayles + break; + case r__musicroom: + replace(Common::String(203), 166); // Monk = Jacques + break; + default: + replace(Common::String(203), 162); // Monk = Ibythneth + } + + if (do_pronouns()) { + _vm->_gyro->weirdword = true; + thats = nowt; + return; + } //* second parsing - accidence */ From c2ac2fdc87e3882e8d75feab3a193991969ec442 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 10:06:13 +0200 Subject: [PATCH 0228/1332] AVALANCHE: Finish implementation of Acci::parse(), repair Acci::displaywhat() and Acci::words[]. --- engines/avalanche/acci2.cpp | 135 ++++++++++++++++++------------------ engines/avalanche/acci2.h | 13 ++-- 2 files changed, 73 insertions(+), 75 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index f85d9df2866f..2d0975f8de10 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -160,7 +160,7 @@ const Acci::vocab Acci::words[nowords] = { {178, "WITCH"}, /* Pronouns, 200-224 */ - {200, "_vm->_gyro->him"}, {200, "MAN"}, {200, "GUY"}, + {200, "HIM"}, {200, "MAN"}, {200, "GUY"}, {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, {202, "IT"}, {202, "THING"}, @@ -333,7 +333,7 @@ void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. -void Acci::displaywhat(char ch, bool animate, bool &ambigous) { /* << it's an adjective! */ +void Acci::displaywhat(byte ch, bool animate, bool &ambigous) { /* << it's an adjective! */ if (ch == pardon) { ambigous = true; if (animate) @@ -354,8 +354,9 @@ void Acci::displaywhat(char ch, bool animate, bool &ambigous) { /* << it's an ad bool Acci::do_pronouns() { bool ambiguous = false; - for (byte fv = 0; fv < thats.size(); fv++) - switch (thats[fv]) { + for (byte fv = 0; fv < thats.size(); fv++) { + byte word = thats[fv]; + switch (word) { case 200: { displaywhat(_vm->_gyro->him, true, ambiguous); thats.setChar(_vm->_gyro->him, fv); @@ -371,6 +372,7 @@ bool Acci::do_pronouns() { thats.setChar(_vm->_gyro->it, fv); } break; + } } return ambiguous; @@ -480,7 +482,7 @@ void Acci::parse() { } } - // Check Accis's own tables for "global" commands. + // Check Accis's own table (words[]) for "global" commands. if (notfound) { answer = wordnum(thisword); if (answer == pardon) { @@ -543,69 +545,66 @@ void Acci::parse() { return; } - //* second parsing - accidence */ - - //subject = ""; - //subjnumber = 0; /* Find subject of conversation. */ - //for (fv = 1; fv <= 11; fv ++) - // if (set::of('`', '\'', eos).has(realwords[fv][1])) { - // subjnumber = ord(thats[fv]); - // thats[fv] = moved; - // flush(); /* Only the second time I've used that! */ - // } - - //if (subjnumber == 0) /* Still not found. */ - // for (fv = 1; fv <= 10; fv ++) - // if (thats[fv] == '\374') { /* the word is "about", or something similar */ - // subjnumber = ord(thats[fv + 1]); - // thats[fv + 1] = '\0'; - // flush(); /* ...Third! */ - // } - - //if (subjnumber == 0) /* STILL not found! Must be the word after "say". */ - // for (fv = 1; fv <= 10; fv ++) - // if ((thats[fv] == '\7') && !(set::of('\0', range('\341', '\345'), eos).has(thats[fv + 1]))) { - // /* SAY not followed by a preposition */ - // subjnumber = ord(thats[fv + 1]); - // thats[fv + 1] = '\0'; - // flush(); /* ...Fourth! */ - // } - - //for (fv = length(thats); fv >= 1; fv --) /* Reverse order- so first'll be used */ - // switch (thats[fv]) { - // case '\1' ... '\61': - // case '\375': - // case '\371': - // verb = thats[fv]; - // break; - // case '\62' ... '\225': { - // thing2 = thing; - // thing = thats[fv]; - // } - // break; - // case '\226' ... '\307': - // person = thats[fv]; - // break; - // case '\373': - // polite = true; - // break; - //} - - //if ((unknown != "") && ! - // (set::of(vb_exam, vb_talk, vb_save, vb_load, vb_dir, eos).has(verb))) { - // display(string("Sorry, but I have no idea what `") + unknown + - // "\" means. Can you rephrase it?"); - // weirdword = true; - //} else weirdword = false; - - //if (thats == "") thats = nowt; - - //if (thing != pardon) it = thing; - - //if (person != pardon) { - // if (person < '\257') him = person; - // else her = person; - //} + // Second parsing. + if (!_vm->_gyro->subject.empty()) + _vm->_gyro->subject.clear(); + _vm->_gyro->subjnumber = 0; // Find subject of conversation. + + fv = 0; + while ((fv < 11) && !realwords[fv].empty()) { + if ((realwords[fv][0] == '\'') || (realwords[fv][0] == '\"')) { + _vm->_gyro->subjnumber = thats[fv]; + thats.setChar(moved, fv); + break; + } + fv++; + } + + if (_vm->_gyro->subjnumber == 0) // Still not found. + for (fv = 0; fv < thats.size(); fv++) + if (thats[fv] == 252) { // The word is "about", or something similar. + _vm->_gyro->subjnumber = thats[fv + 1]; + thats.setChar(0, fv + 1); + break; + } + + if (_vm->_gyro->subjnumber == 0) // STILL not found! Must be the word after "say". + for (fv = 0; fv < thats.size(); fv++) + if ((thats[fv] == 7) && (thats[fv + 1] != 0) && !((225 <= thats[fv + 1]) && (thats[fv + 1] <= 229))) { + // SAY not followed by a preposition + _vm->_gyro->subjnumber = thats[fv + 1]; + thats.setChar(0, fv + 1); + break; + } + + for (int8 fv = thats.size() - 1; fv >= 0; fv--) // Reverse order, so first will be used. + if ((thats[fv] == 253) || (thats[fv] == 249) || ((1 <= thats[fv]) && (thats[fv] <= 49))) + verb = thats[fv]; + else if ((50 <= thats[fv]) && (thats[fv] <= 149)) { + thing2 = thing; + thing = thats[fv]; + } else if ((150 <= thats[fv]) && (thats[fv] <= 199)) + person = thats[fv]; + else if (thats[fv] == 251) + polite = true; + + if ((!unknown.empty()) && (verb != vb_exam) && (verb != vb_talk) && (verb != vb_save) && (verb != vb_load) && (verb != vb_dir)) { + _vm->_scrolls->display(Common::String("Sorry, but I have no idea what \"") + unknown + "\" means. Can you rephrase it?"); + _vm->_gyro->weirdword = true; + } else + _vm->_gyro->weirdword = false; + + if (thats.empty()) + thats = nowt; + + if (thing != pardon) + _vm->_gyro->it = thing; + + if (person != pardon) + if (person < 175) + _vm->_gyro->him = person; + else + _vm->_gyro->her = person; } void Acci::examobj() { /* Examine a standard object-thing */ diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index d4efa028225b..6a42c083fd70 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -90,14 +90,13 @@ class Acci { static const byte vb_smartalec = 249; static const byte vb_expletive = 253; - static const byte pardon = 254; /* =didn't understand / wasn't given. */ + static const byte pardon = 254; // Didn't understand / wasn't given. - static const int16 nowords = 277; /* how many words does the parser know? */ - static const byte nowt = 372; - static const byte moved = 0; /* This word was moved. (Usually because it was the subject of - conversation.) */ + static const int16 nowords = 277; // How many words does the parser know? + static const byte nowt = 250; + static const byte moved = 0; // This word was moved. (Usually because it was the subject of conversation.) - static const int16 first_password = 89; /* Words[first_password] should equal "TIROS". */ + static const int16 first_password = 89; // Words[first_password] should equal "TIROS". @@ -160,7 +159,7 @@ class Acci { void punctustrip(Common::String &x); - void displaywhat(char ch, bool animate, bool &ambigous); + void displaywhat(byte ch, bool animate, bool &ambigous); bool do_pronouns(); void lowercase(); From e08980c7a4ac8b56f4503205dd8488e91d14fddf Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 10:30:57 +0200 Subject: [PATCH 0229/1332] AVALANCHE: Repair Acci::person_speaks(). --- engines/avalanche/acci2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2d0975f8de10..914ca545dca6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1077,21 +1077,20 @@ void Acci::person_speaks() { char cfv; - if ((person == pardon) || (person == '\0')) { + if ((person == pardon) || (person == 0)) if ((_vm->_gyro->him == pardon) || (_vm->_gyro->whereis[_vm->_gyro->him] != _vm->_gyro->dna.room)) person = _vm->_gyro->her; else person = _vm->_gyro->him; - } if (_vm->_gyro->whereis[person] != _vm->_gyro->dna.room) { - _vm->_scrolls->display("\231\4"); /* Avvy _vm->_gyro->himself! */ + _vm->_scrolls->display("\231\4"); // Avvy himself! return; } found = false; /* The person we're looking for's code is in Person. */ - for (fv = 1; fv <= _vm->_trip->numtr; fv++) { + for (fv = 0; fv < _vm->_trip->numtr; fv++) { if (_vm->_trip->tr[fv].quick && ((_vm->_trip->tr[fv].a.accinum + 149) == person)) { _vm->_scrolls->display(Common::String('\23') + char(fv + 48) + '\4'); found = true; @@ -1099,7 +1098,7 @@ void Acci::person_speaks() { } if (!found) { - for (fv = 10; fv <= 25; fv++) { + for (fv = 0; fv < 16; fv++) { _vm->_gyro->quasipeds[fv]; if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) { _vm->_scrolls->display(Common::String('\23') + char(fv + 55) + '\4'); From e32110339e710072b2f3bbf12b3248d26f2a6032 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 11:27:31 +0200 Subject: [PATCH 0230/1332] AVALANCHE: Move wipeText() from Basher to Parser, implement it. Fix parts of Acci::do_that(). --- engines/avalanche/acci2.cpp | 13 ++++++++----- engines/avalanche/acci2.h | 2 +- engines/avalanche/basher2.cpp | 4 ---- engines/avalanche/basher2.h | 2 -- engines/avalanche/parser.cpp | 16 ++++++++++++++++ engines/avalanche/parser.h | 2 ++ 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 914ca545dca6..1f237a8a8996 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1121,13 +1121,16 @@ void Acci::do_that() { if (thats == Common::String(nowt)) { - thats = ""; + if (!thats.empty()) + thats.clear(); return; } + if (_vm->_gyro->weirdword) return; - if (thing < '\310') - thing -= 49; /* "Slip" */ + + if (thing < 200) + thing -= 49; // "Slip" /* if ((!_vm->_gyro->alive) & @@ -1760,12 +1763,12 @@ void Acci::do_that() { switch (person) { case pardon: case _vm->_gyro->pavalot: - case '\0': + case 0: if (!_vm->_gyro->dna.avvy_is_awake) { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->show_one(3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->show_one(2); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 6a42c083fd70..0660f497b37c 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -123,7 +123,7 @@ class Acci { Common::String thats; Common::String unknown; Common::String realwords[11]; - char verb, person, thing, thing2; + byte verb, person, thing, thing2; bool polite; diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp index 0df3b39b0d67..6bbf8b290f23 100644 --- a/engines/avalanche/basher2.cpp +++ b/engines/avalanche/basher2.cpp @@ -78,10 +78,6 @@ void Basher::init() { #endif } -void Basher::wipetext() { - warning("STUB: Basher::wipetext()"); -} - /*procedure cursor; begin if curflash=0 then diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h index bc62fe67cfd3..f4a78f4d42fa 100644 --- a/engines/avalanche/basher2.h +++ b/engines/avalanche/basher2.h @@ -70,8 +70,6 @@ class Basher { bool entering_filename; - void wipetext(); - char firstchar(Common::String x); void typein(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 5a23a24e69aa..5fbc31e5940d 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -79,6 +79,8 @@ void Parser::handleReturn() { _inputTextBackup = _inputText; _vm->_acci->parse(); _vm->_acci->do_that(); + _inputText.clear(); + wipeText(); } } } @@ -148,4 +150,18 @@ void Parser::drawCursor() { _vm->_trip->getset[fv].remember(bf); } +void Parser::wipeText() { + if (_vm->_gyro->mouse_near_text()) + _vm->_gyro->super_off(); + + cursorOff(); + + _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. + + _quote = true; + _inputTextPos = 0; + cursorOn(); + _vm->_gyro->super_on(); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 1cfb21bb52b4..2a348399202e 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -65,6 +65,8 @@ class Parser { void drawCursor(); + void wipeText(); + }; } // End of namespace Avalanche From b182fd814ecd0d70ea4c34cbe2d188b363df94ed Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 12:05:16 +0200 Subject: [PATCH 0231/1332] AVALANCHE: Partially implement Acci::stand_up(), repair Acci::parse(). --- engines/avalanche/acci2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1f237a8a8996..9a86333d0e15 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -514,7 +514,7 @@ void Acci::parse() { replace(Common::String(255), 0); /* zap noise words */ replace(Common::String(13) + 226, 1); // "look at" = "examine" replace(Common::String(13) + 228, 1); // "look in" = "examine" - replace(Common::String(4) + 227, 17); // "get up" = "stand" + replace(Common::String(4) + 230, 17); // "get up" = "stand" replace(Common::String(4) + 231, 17); // "get down" = "stand"... well, why not? replace(Common::String(18) + 228, 2); // "go in" = "open [door]" replace(Common::String(28) + 229, 253); // "P' off" is a swear word @@ -946,11 +946,11 @@ void Acci::stand_up() { _vm->_gyro->background(0); _vm->_visa->dixi('d', 14); } - _vm->_trip->tr[1].visible = true; + _vm->_trip->tr[0].visible = true; _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip->apped(1, 2); + _vm->_trip->apped(0, 1); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(4); /* Picture of empty pillow. */ + _vm->_celer->show_one(3); /* Picture of empty pillow. */ _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); From a1f87fdaebc86be92b189086bba1dba0d3e049c6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 12:22:59 +0200 Subject: [PATCH 0232/1332] AVALANCHE: Modify Graphics and Lucerna, so the engine saves the background and redraws it every time before a sprite is drawn. --- engines/avalanche/graphics.cpp | 2 ++ engines/avalanche/graphics.h | 4 +++- engines/avalanche/lucerna2.cpp | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index bed8136dd497..6338893dbfff 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -62,6 +62,7 @@ void Graphics::init() { Graphics::~Graphics() { _surface.free(); + _background.free(); } @@ -85,6 +86,7 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { + drawPicture(_background, 0, 10); /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 3d32bdafcb66..d0adb17767b2 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -57,7 +57,9 @@ class Graphics { static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; - + ::Graphics::Surface _background; + + Graphics(AvalancheEngine *vm); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index eb5f5094c965..047301cf3e9e 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -245,11 +245,11 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) - ::Graphics::Surface background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); + _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); - _vm->_graphics->drawPicture(background, 0, 10); + _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); - background.free(); + _vm->_graphics->refreshScreen(); f.close(); From 3b11fc12240650bfdf693a31b09d6349c1bf3f61 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 19:17:43 +0200 Subject: [PATCH 0233/1332] AVALANCHE: Repair Celer::load_chunks(), remove background drawing from Graphics::drawSprite(). --- engines/avalanche/celer2.cpp | 6 +++--- engines/avalanche/graphics.cpp | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 4d4a1fa8724f..061eb6b21290 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -306,10 +306,10 @@ void Celer::load_chunks(Common::String xx) { if (ch.natural) { memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. - memos[fv].size = memos[fv].xl * 8 * memos[fv].yl; - memory[fv].create(memos[fv].xl * 8, memos[fv].yl, ::Graphics::PixelFormat::createFormatCLUT8()); + memos[fv].size = memos[fv].xl * 8 * memos[fv].yl + 1; + memory[fv].create(memos[fv].xl * 8, memos[fv].yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - for (uint16 j = 0; j < memos[fv].yl; j++) + for (uint16 j = 0; j < memos[fv].yl + 1; j++) for (uint16 i = 0; i < memos[fv].xl * 8; i++) *(byte *)memory[fv].getBasePtr(i, j) = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); } else { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 6338893dbfff..957468044c47 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -86,8 +86,6 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - drawPicture(_background, 0, 10); - /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) { byte *mask = new byte[sprite.xl]; From 9855cb8f1f6b8e6d6a61f5bf018e3e03b2c4280d Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 00:30:10 +0200 Subject: [PATCH 0234/1332] AVALANCHE: Add warning to Acci::do_that(), remove blank lines from Avalot::run(), remove unnecessary cycle from Lucerna::sprite_run(). --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/avalot.cpp | 2 -- engines/avalanche/lucerna2.cpp | 8 ++------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 9a86333d0e15..ce236d4f35ff 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1150,7 +1150,7 @@ void Acci::do_that() { return; } */ - + warning("STUB: Acci::do_that()"); switch (verb) { case vb_exam: diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e1879e1b564f..7b993a5e1cf1 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -215,8 +215,6 @@ void Avalot::run(Common::String arg) { // Not in the original: - - _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. uint32 delay = _vm->_system->getMillis() - beginLoop; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 047301cf3e9e..3c3ad35d3264 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1161,12 +1161,8 @@ void Lucerna::sprite_run() { _vm->_gyro->doing_sprite_run = true; - for (fv = 0; fv <= 1; fv ++) { - _vm->_trip->get_back_loretta(); - _vm->_trip->trippancy_link(); - - flip_page(); - } + _vm->_trip->get_back_loretta(); + _vm->_trip->trippancy_link(); _vm->_gyro->doing_sprite_run = false; From 2857f5aad2c4a024c97e43da67d056a2f7a22def Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 01:48:21 +0200 Subject: [PATCH 0235/1332] AVALANCHE: Revise Graphics::drawSprite(), repair Trip::apped(). --- engines/avalanche/graphics.cpp | 18 ++++++------------ engines/avalanche/trip6.cpp | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 957468044c47..0574705044c3 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -86,20 +86,14 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - /* First we make the pixels of the spirte blank. */ - for (byte qay = 0; qay < sprite.yl; qay++) { - byte *mask = new byte[sprite.xl]; + drawPicture(_background, 0, 10); // TODO: Remove it later, implement otherwise!!! Now it only works with one sprite on the screen. - for (byte qax = 0; qax < sprite.xl; qax++) { - byte count = qax / 8; - mask[qax] = ((*sprite.sil[picnum])[qay][count] >> ((7 - qax % 8)) & 1); - if (mask[qax] == 0) + /* First we make the pixels of the spirte blank. */ + for (byte qay = 0; qay < sprite.yl; qay++) + for (byte qax = 0; qax < sprite.xl; qax++) + if (((*sprite.sil[picnum])[qay][qax / 8] >> ((7 - qax % 8)) & 1) == 0) *getPixel(x + qax, y + qay) = 0; - } - - delete[] mask; - } - + /* Then we draw the picture to the blank places. */ uint16 i = 0; // Because the original siltype starts at 5!!! See Graphics.h for definition. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index d7823c363992..d9b33ac95be7 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1093,7 +1093,7 @@ void Trip::rwsp(byte t, byte r) { } void Trip::apped(byte trn, byte np) { - tr[trn].appear(tr[trn].x - tr[trn]._info.xl / 2, tr[trn].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir); + tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info.xl / 2, _vm->_gyro->peds[np].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir); rwsp(trn, _vm->_gyro->peds[np].dir); } From a13d37e5ca26a5a9c6c9435324c89e4eceb1d846 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 19:05:05 +0200 Subject: [PATCH 0236/1332] AVALANCHE: Implement Trip::checkfeet(), repair Trip::stopwalking(). Repair Acci::stand_up(). Repair Gyro::newgame(). --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/trip6.cpp | 32 +++++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ce236d4f35ff..86600d62dcd6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -940,7 +940,7 @@ void Acci::already() { void Acci::stand_up() { switch (_vm->_gyro->dna.room) { case r__yours: /* Avvy isn't asleep. */ - if (_vm->_gyro->dna.avvy_in_bed) { /* But he's in bed. */ + if (_vm->_gyro->dna.avvy_is_awake && _vm->_gyro->dna.avvy_in_bed) { /* But he's in bed. */ if (_vm->_gyro->dna.teetotal) { _vm->_visa->dixi('d', 12); _vm->_gyro->background(0); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 76640739af6d..9f006afec91e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -384,7 +384,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ seescroll = false; ppos[0][1] = -177; - //_vm->_trip->tr[0].appear(300,117,right); + _vm->_trip->tr[0].appear(300,117,right); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index d9b33ac95be7..47f60751a13d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -488,13 +488,31 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { int16 fv, ff; /* if not alive then begin checkfeet:=0; exit; end;*/ - byte checkfeet_result; a = 0; - warning("STUB: Trip::checkfeet()"); - - checkfeet_result = a; - return checkfeet_result; + //setactivepage(2); + + if (x1 < 0) + x1 = 0; + if (x2 > 639) + x2 = 639; + if (oy < y) + for (fv = x1; fv <= x2; fv ++) + for (ff = oy + yl; ff <= y + yl; ff ++) { + c = *_vm->_graphics->getPixel(fv, ff); + if (c > a) + a = c; + } + else + for (fv = x1; fv <= x2; fv ++) + for (ff = y + yl; ff <= oy + yl; ff ++) { + c = *_vm->_graphics->getPixel(fv, ff); + if (c > a) + a = c; + } + + //setactivepage(1 - cp); + return a; } byte Trip::geida_ped(byte which) { @@ -1414,10 +1432,10 @@ void Trip::get_back_loretta() { } void Trip::stopwalking() { - tr[1].stopwalk(); + tr[0].stopwalk(); _vm->_gyro->dna.rw = stopped; if (_vm->_gyro->alive) - tr[1].step = 1; + tr[0].step = 1; } void Trip::tripkey(char dir) { From 06f86bedb0f6e9a4d0c8858ff0c61a22ecb464c3 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 20:33:05 +0200 Subject: [PATCH 0237/1332] AVALANCHE: Add _magics to Graphics, implement Lucerna::draw_also_lines(), update Trip::checkfeet() accordingly. --- engines/avalanche/graphics.cpp | 3 +++ engines/avalanche/graphics.h | 5 +++++ engines/avalanche/lucerna2.cpp | 37 +++++++++++++++++++++++++++++++++- engines/avalanche/trip6.cpp | 11 +++++----- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0574705044c3..737147b7346a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -58,10 +58,13 @@ void Graphics::init() { g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1); _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); + + _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } Graphics::~Graphics() { _surface.free(); + _magics.free(); _background.free(); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index d0adb17767b2..074031f55d67 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -59,6 +59,11 @@ class Graphics { ::Graphics::Surface _background; + ::Graphics::Surface _magics; + // Lucerna::draw_also_lines() draws the "magical" lines here. + // Further information: https://github.com/urukgit/avalot/wiki/Also + + Graphics(AvalancheEngine *vm); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3c3ad35d3264..fa1e3db908eb 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -44,6 +44,7 @@ #include "avalanche/acci2.h" #include "avalanche/roomnums.h" +#include "common/rect.h" #include "common/system.h" #include "graphics/palette.h" @@ -83,7 +84,41 @@ void Lucerna::draw_also_lines() { byte ff; byte squeaky_code; - warning("STUB: Lucerna::draw_also_lines()"); + switch (_vm->_gyro->visible) { + case _vm->_gyro->m_virtual: { + squeaky_code = 1; + _vm->_gyro->off_virtual(); + } + break; + case _vm->_gyro->m_no: + squeaky_code = 2; + break; + case _vm->_gyro->m_yes: { + squeaky_code = 3; + _vm->_gyro->off(); + } + break; + } + + _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); + _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 160), 15); + + for (ff = 0; ff < 50; ff++) { + if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) { + _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + } + } + + switch (squeaky_code) { + case 1 : + _vm->_gyro->on_virtual(); + break; + case 2 : + break; // Zzz... it was off anyway. + case 3 : + _vm->_gyro->on(); + break; + } } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 47f60751a13d..2c73bf112d12 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -216,7 +216,8 @@ void triptype::walk() { return; } - tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl); + tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1; + // -1 is becouse the modified array indexes of magics[] compared to Pascal . if ((tc != 0) & (!_tr->_vm->_gyro->doing_sprite_run)) { switch (_tr->_vm->_gyro->magics[tc].op) { @@ -498,15 +499,15 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { x2 = 639; if (oy < y) for (fv = x1; fv <= x2; fv ++) - for (ff = oy + yl; ff <= y + yl; ff ++) { - c = *_vm->_graphics->getPixel(fv, ff); + for (ff = oy + yl; ff <= y + yl; ff++) { + c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) a = c; } else for (fv = x1; fv <= x2; fv ++) - for (ff = y + yl; ff <= oy + yl; ff ++) { - c = *_vm->_graphics->getPixel(fv, ff); + for (ff = y + yl; ff <= oy + yl; ff++) { + c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) a = c; } From 7800c4735f7d38efc2f54d8e19b8a5ed2cd9e1c6 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 21:32:14 +0200 Subject: [PATCH 0238/1332] AVALANCHE: Repair Acci::parse(). --- engines/avalanche/acci2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 86600d62dcd6..45518fb4850f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -454,10 +454,12 @@ void Acci::parse() { cc = c; c.toUppercase(); while (!c.empty()) { - while ((c[0] == ' ') && (!c.empty())) { + while ((!c.empty()) && (c[0] == ' ')) { c.deleteChar(0); cc.deleteChar(0); } + if (c.empty()) + break; // Get the following word of the strings. byte size = pos(Common::String(' '), c) + 1; From 2e741241c5b38725b1f2911e22312102155c0d72 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 21:52:49 +0200 Subject: [PATCH 0239/1332] AVALANCHE: Broaden Avalot::handleKeyDown(). --- engines/avalanche/avalot.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7b993a5e1cf1..3363b92569d1 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -181,6 +181,12 @@ void Avalot::handleKeyDown(const Common::Event &event) { if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) _vm->_parser->handleInputText(event); + + + + _vm->_lucerna->showrw(); + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); } From 6ffcb714af5f446826b0c029ebcaed222291e961 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 22:25:04 +0200 Subject: [PATCH 0240/1332] AVALANCHE: Broaden Avalot::handleKeyDown(). --- engines/avalanche/avalot.cpp | 36 ++++++++++++++++++++++++++++++++---- engines/avalanche/avalot.h | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3363b92569d1..bdf74728c114 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -153,11 +153,38 @@ void Avalot::setup() { -void Avalot::handleKeyDown(const Common::Event &event) { +void Avalot::handleKeyDown(Common::Event &event) { //if (keyboardclick) // click(); // // To be implemented later with the sounds, I assume. + + switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. + case Common::KEYCODE_KP8: + event.kbd.keycode = Common::KEYCODE_UP; + break; + case Common::KEYCODE_KP2: + event.kbd.keycode = Common::KEYCODE_DOWN; + break; + case Common::KEYCODE_KP6: + event.kbd.keycode = Common::KEYCODE_RIGHT; + break; + case Common::KEYCODE_KP4: + event.kbd.keycode = Common::KEYCODE_LEFT; + break; + case Common::KEYCODE_KP9: + event.kbd.keycode = Common::KEYCODE_PAGEUP; + break; + case Common::KEYCODE_KP3: + event.kbd.keycode = Common::KEYCODE_PAGEDOWN; + break; + case Common::KEYCODE_KP7: + event.kbd.keycode = Common::KEYCODE_HOME; + break; + case Common::KEYCODE_KP1: + event.kbd.keycode = Common::KEYCODE_END; + break; + } switch (event.kbd.keycode) { case Common::KEYCODE_UP: @@ -170,7 +197,10 @@ void Avalot::handleKeyDown(const Common::Event &event) { case Common::KEYCODE_END: case Common::KEYCODE_KP5: _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. - break; + _vm->_lucerna->showrw(); + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); + return; case Common::KEYCODE_BACKSPACE: _vm->_parser->handleBackspace(); break; @@ -182,8 +212,6 @@ void Avalot::handleKeyDown(const Common::Event &event) { if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) _vm->_parser->handleInputText(event); - - _vm->_lucerna->showrw(); if (_vm->_gyro->demo) _vm->_basher->get_demorec(); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index a053267c9b5f..c792a178a41b 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -44,7 +44,7 @@ class Avalot { - void handleKeyDown(const Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). + void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). From 5290eb98797c638276b47b3b53ec6a30e63473dd Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 30 Jul 2013 23:43:20 +0200 Subject: [PATCH 0241/1332] AVALANCHE: Repair Lucerna::draw_also_lines(). --- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/trip6.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index fa1e3db908eb..29f93c7d4237 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -101,7 +101,7 @@ void Lucerna::draw_also_lines() { } _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 160), 15); + _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 161), 15); for (ff = 0; ff < 50; ff++) { if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 2c73bf112d12..26530a5cb75d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -492,20 +492,19 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { a = 0; //setactivepage(2); - if (x1 < 0) x1 = 0; if (x2 > 639) x2 = 639; if (oy < y) - for (fv = x1; fv <= x2; fv ++) + for (fv = x1; fv <= x2; fv++) for (ff = oy + yl; ff <= y + yl; ff++) { c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) a = c; } else - for (fv = x1; fv <= x2; fv ++) + for (fv = x1; fv <= x2; fv++) for (ff = y + yl; ff <= oy + yl; ff++) { c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) From d66feb32a0ee26671e2439b52e35c8c8c4d45d4c Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 1 Aug 2013 11:15:59 +0200 Subject: [PATCH 0242/1332] AVALANCHE: Implement rest of Acci::do_that(). --- engines/avalanche/acci2.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 45518fb4850f..02fda21d66c1 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1134,25 +1134,19 @@ void Acci::do_that() { if (thing < 200) thing -= 49; // "Slip" - /* - if ((!_vm->_gyro->alive) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_score, - vb_highscores, vb_smartalec, eos).has(verb))) { - _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost ") + - "or something? Try restarting, or restoring a saved game!"); - return; - } - if ((~ _vm->_gyro->dna.avvy_is_awake) & - !(set::of(vb_load, vb_save, vb_quit, vb_info, vb_help, vb_larrypass, - vb_phaon, vb_boss, vb_cheat, vb_restart, vb_dir, vb_die, vb_score, - vb_highscores, vb_smartalec, vb_expletive, vb_wake, eos).has(verb))) { - _vm->_scrolls->display("Talking in your sleep? Try waking up!"); - return; + if ((verb != vb_load) && (verb != vb_save) && (verb != vb_quit) && (verb != vb_info) && (verb != vb_help) + && (verb != vb_larrypass) && (verb != vb_phaon) && (verb != vb_boss) && (verb != vb_cheat) && (verb != vb_restart) && (verb != vb_dir) + && (verb != vb_score) && (verb != vb_highscores) && (verb != vb_smartalec)) { + if (!_vm->_gyro->alive) { + _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); + return; + } + if (!_vm->_gyro->dna.avvy_is_awake && (verb != vb_die) && (verb != vb_expletive) && (verb != vb_wake)) { + _vm->_scrolls->display("Talking in your sleep? Try waking up!"); + return; + } } - */ - warning("STUB: Acci::do_that()"); switch (verb) { case vb_exam: From 599aa9a0637bce5e25f5f0cf178e953079c65794 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 1 Aug 2013 12:13:44 +0200 Subject: [PATCH 0243/1332] AVALANCHE: Move pos() from Acci to Parser, update other code accordingly. --- engines/avalanche/acci2.cpp | 25 +++++++++---------------- engines/avalanche/acci2.h | 2 -- engines/avalanche/parser.cpp | 7 +++++++ engines/avalanche/parser.h | 2 ++ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 02fda21d66c1..d1eeb71297b6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -244,7 +244,7 @@ byte Acci::wordnum(Common::String x) { } void Acci::replace(Common::String old1, byte new1) { - int16 q = pos(old1, thats); + int16 q = _vm->_parser->pos(old1, thats); while (q != -1) { if (new1 == 0) thats.deleteChar(q); @@ -253,7 +253,7 @@ void Acci::replace(Common::String old1, byte new1) { thats.deleteChar(q); thats.insertChar(new1, q); } - q = pos(old1, thats); + q = _vm->_parser->pos(old1, thats); } } @@ -324,7 +324,7 @@ void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. for (byte fv = 0; fv < 32; fv++) do { - int16 p = pos(Common::String(punct[fv]), x); + int16 p = _vm->_parser->pos(Common::String(punct[fv]), x); if (p == -1) break; x.deleteChar(p); @@ -409,13 +409,6 @@ void Acci::clearuint16s() { warning("STUB: Acci::clearuint16s()"); } -int16 Acci::pos(const Common::String &crit, const Common::String &src) { - if (src.contains(crit)) - return strstr(src.c_str(),crit.c_str()) - src.c_str(); - else - return -1; -} - void Acci::parse() { byte n, fv, ff; Common::String c, cc, thisword; @@ -462,7 +455,7 @@ void Acci::parse() { break; // Get the following word of the strings. - byte size = pos(Common::String(' '), c) + 1; + byte size = _vm->_parser->pos(Common::String(' '), c) + 1; char *subStr = new char[size]; Common::strlcpy(subStr, c.c_str(), size); thisword = subStr; @@ -477,7 +470,7 @@ void Acci::parse() { // Check also[] first, which conatins words about the actual room. if (!thisword.empty()) { for (ff = 0; ff < 31; ff++) { - if ((_vm->_gyro->also[ff][0] != 0) && (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) { + if ((_vm->_gyro->also[ff][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) { thats = thats + Common::String(99 + ff); notfound = false; } @@ -496,18 +489,18 @@ void Acci::parse() { } // Delete words we already processed. - int16 spacePos = pos(Common::String(' '), c); + int16 spacePos = _vm->_parser->pos(Common::String(' '), c); if (spacePos > -1) for (byte i = 0; i <= spacePos; i++) c.deleteChar(0); - spacePos = pos(Common::String(' '), cc); + spacePos = _vm->_parser->pos(Common::String(' '), cc); if (spacePos > -1) for (byte i = 0; i <= spacePos; i++) cc.deleteChar(0); } - if (pos(Common::String(254), thats) > -1) - unknown = realwords[pos(Common::String(254), thats)]; + if (_vm->_parser->pos(Common::String(254), thats) > -1) + unknown = realwords[_vm->_parser->pos(Common::String(254), thats)]; else if (!unknown.empty()) unknown.clear(); diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 0660f497b37c..2a97b9852998 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -210,8 +210,6 @@ class Acci { void heythanks(); - int16 pos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. - }; } // End of namespace Avalanche. diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 5fbc31e5940d..86f46c1f08e3 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -126,6 +126,13 @@ void Parser::tryDropdown() { warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown. } +int16 Parser::pos(const Common::String &crit, const Common::String &src) { + if (src.contains(crit)) + return strstr(src.c_str(),crit.c_str()) - src.c_str(); + else + return -1; +} + void Parser::drawCursor() { // Draw the '_' character. Similar to plotText(). char cursor = '_'; diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 2a348399202e..6b9240011cd0 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -60,6 +60,8 @@ class Parser { void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. + int16 pos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + private: AvalancheEngine *_vm; From 544cf3775714bd6f40b8572c29acf4b33baf1162 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 2 Aug 2013 12:18:01 +0200 Subject: [PATCH 0244/1332] AVALANCHE: Move strf() from Avalanche to Gyro. --- engines/avalanche/avalanche.cpp | 5 ----- engines/avalanche/avalanche.h | 2 -- engines/avalanche/gyro2.cpp | 10 +++++----- engines/avalanche/gyro2.h | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 09695cd23608..35693ed200f1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -170,11 +170,6 @@ void AvalancheEngine::quit() { cursor_on(); } -Common::String AvalancheEngine::strf(int32 x) { - Common::String q = Common::String::format("%d", x); - return q; -} - // Needed in dos_shell(). TODO: Remove later. Common::String AvalancheEngine::command_com() { warning("STUB: command_com()"); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index a2b7ab6ae8c3..94ac6afe420c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -161,8 +161,6 @@ class AvalancheEngine : public Engine { void quit(); - Common::String strf(int32 x); - Common::String command_com(); void explain(byte error); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 9f006afec91e..73a321af07c5 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -273,6 +273,11 @@ Gyro::~Gyro() { } +Common::String Gyro::strf(int32 x) { + Common::String q = Common::String::format("%d", x); + return q; +} + void Gyro::newpointer(byte m) { if (m == cmp) return; cmp = m; @@ -339,11 +344,6 @@ void Gyro::blip() { warning("STUB: Gyro::blip()"); } -Common::String Gyro::strf(int32 x) { - Common::String q = Common::String::format("%d", x); - return q; -} - void Gyro::shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { warning("STUB: Gyro::shadow()"); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 50ae339987f1..75735810473a 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -611,6 +611,8 @@ class Gyro { ~Gyro(); + Common::String strf(int32 x); + void newpointer(byte m); void wait(); /* makes hourglass */ @@ -633,8 +635,6 @@ class Gyro { void blip(); - Common::String strf(int32 x); - void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); void newgame(); From 9660c1a56651c424c6223fdad2c271e7cd8756b5 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 2 Aug 2013 13:17:50 +0200 Subject: [PATCH 0245/1332] AVALANCHE: Add some constatns to Scolls, implement Scrolls::calldrivers(), Scrolls::solidify() and Scrolls::strip(). --- engines/avalanche/scrolls2.cpp | 224 ++++++++++++++++++++++++++++++++- engines/avalanche/scrolls2.h | 26 +++- 2 files changed, 243 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8250880f989c..1f85ba0eb182 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -273,21 +273,237 @@ Common::String Scrolls::lsd() { -void Scrolls::strip(Common::String &q) { - warning("STUB: Scrolls::strip()"); +void Scrolls::strip(Common::String &q) { // Strip trailing spaces. + while (q[q.size() - 1] == ' ') { + q.deleteLastChar(); + } } void Scrolls::solidify(byte n) { - warning("STUB: Scrolls::solidify()"); + if (!_vm->_gyro->scroll[n].contains(' ')) + return; // No spaces. + + // So there MUST be a space there, somewhere... + do { + _vm->_gyro->scroll[n + 1] = _vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] + _vm->_gyro->scroll[n + 1]; + _vm->_gyro->scroll[n].deleteLastChar(); + } while (!_vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] != ' '); + + strip(_vm->_gyro->scroll[n]); } void Scrolls::calldrivers() { + uint16 fv; + byte nn; + char nnn; + bool mouthnext; + bool call_spriterun; // Only call sprite_run the FIRST time. + bool was_virtual; // Was the mouse cursor virtual on entry to this proc? + + + //nosound(); warning("STUB: Scrolls::calldrivers()"); + + state(0); + _vm->_gyro->screturn = false; + mouthnext = false; + call_spriterun = true; + + switch (_vm->_gyro->buffer[_vm->_gyro->bufsize - 1]) { + case kControlToBuffer: + _vm->_gyro->bufsize--; + break; // ^D = (D)on't include pagebreak + case kControlSpeechBubble: + case kControlQuestion: + break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box + default: { + _vm->_gyro->bufsize++; + _vm->_gyro->buffer[_vm->_gyro->bufsize - 1] = kControlParagraph; + } + } + + for (fv = 0; fv <= _vm->_gyro->bufsize; fv++) + if (mouthnext) { + if (_vm->_gyro->buffer[fv] == kControlRegister) + param = 0; + else + if (('0' < _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] < '9')) + param = _vm->_gyro->buffer[fv] - 48; + else if (('A' < _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] < 'Z')) + param = _vm->_gyro->buffer[fv] - 55; + + mouthnext = false; + } else + switch (_vm->_gyro->buffer[fv]) { + case kControlParagraph: { + if ((_vm->_gyro->scrolln == 0) && (_vm->_gyro->scroll[0].empty())) + break; + + if (call_spriterun) + _vm->_lucerna->sprite_run(); + call_spriterun = false; + + was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; + if (was_virtual) + _vm->_gyro->off_virtual(); + + drawscroll(&Avalanche::Scrolls::normscroll); + + if (was_virtual) + _vm->_gyro->on_virtual(); + + resetscroll(); + + if (_vm->_gyro->screturn) + return; + } + break; + case kControlBell: + _vm->_gyro->scrollbells++; + break; // #7 = "Bel" + case kControlSpeechBubble: { + if ((_vm->_gyro->scrolln == 0) && (_vm->_gyro->scroll[0].empty())) + break; + + if (call_spriterun) + _vm->_lucerna->sprite_run(); + call_spriterun = false; + + if (param == 0) + natural(); + else if ((1 <= param) && (param <= 9)) + if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param].quick)) { // Not valid. + _vm->_lucerna->errorled(); + natural(); + } else + _vm->_trip->tr[param].chatter(); // Normal sprite talking routine. + else if ((10 <= param) && (param <= 36)) { + /* Quasi-peds. (This routine performs the same + thing with QPs as triptype.chatter does with the + sprites.) */ + _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param].whichped].x; + _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param].whichped].y; // Position. + + _vm->_gyro->talkf = _vm->_gyro->quasipeds[param].fgc; + _vm->_gyro->talkb = _vm->_gyro->quasipeds[param].bgc; // Colours. + } else { + _vm->_lucerna->errorled(); // Not valid. + natural(); + } + + was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; + if (was_virtual) + _vm->_gyro->off_virtual(); + + bubble(&Avalanche::Scrolls::normscroll); + + if (was_virtual) + _vm->_gyro->on_virtual(); + + resetscroll(); + + if (_vm->_gyro->screturn) + return; + } + break; + case kControlNegative: { + switch (param) { + case 1: + display(lsd() + kControlToBuffer); + break; /* insert cash balance (recursion) */ + case 2: + display(_vm->_acci->words[_vm->_acci->first_password + _vm->_gyro->dna.pass_num].w + kControlToBuffer); + break; + case 3: + display(_vm->_gyro->dna.like2drink + kControlToBuffer); + break; + case 4: + display(_vm->_gyro->dna.favourite_song + kControlToBuffer); + break; + case 5: + display(_vm->_gyro->dna.worst_place_on_earth + kControlToBuffer); + break; + case 6: + display(_vm->_gyro->dna.spare_evening + kControlToBuffer); + break; + case 9: + display(_vm->_gyro->strf(_vm->_gyro->dna.cat_x) + ',' + _vm->_gyro->strf(_vm->_gyro->dna.cat_y) + kControlToBuffer); + break; + case 10: + switch (_vm->_gyro->dna.box_contents) { + case 0: { // Sixpence. + _vm->_visa->dixi('q', 37); // You find the sixpence. + _vm->_gyro->dna.pence += 6; + _vm->_gyro->dna.box_contents = _vm->_acci->nowt; + _vm->_lucerna->points(2); + return; + } + break; + case _vm->_acci->nowt: + display("nothing at all. It's completely empty."); + break; + default: + display(_vm->_gyro->get_better(_vm->_gyro->dna.box_contents) + '.'); + } + break; + case 11: { + nn = 1; + for (nnn = 0; nnn < numobjs; nnn++) + if (_vm->_gyro->dna.obj[nnn]) { + nn ++; + display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); + } + } + break; + } + + } + break; + case kControlIcon: + use_icon = param; + break; + case kControlNewLine: + _vm->_gyro->scrolln++; + break; + case kControlQuestion: { + if (call_spriterun) + _vm->_lucerna->sprite_run(); + call_spriterun = false; + + _vm->_gyro->scrolln++; + _vm->_gyro->scroll[_vm->_gyro->scrolln] = kControlQuestion; + + was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; + if (was_virtual) + _vm->_gyro->off_virtual(); + + drawscroll(&Avalanche::Scrolls::dialogue); + + if (was_virtual) + _vm->_gyro->on_virtual(); + + resetscroll(); + } + break; + case kControlRegister: + mouthnext = true; + break; + case kControlInsertSpaces: + for (nn = 0; nn < 9; nn++) _vm->_gyro->scroll[_vm->_gyro->scrolln] = _vm->_gyro->scroll[_vm->_gyro->scrolln] + ' '; + break; + default: { // Add new char. + if (_vm->_gyro->scroll[_vm->_gyro->scrolln].size() == 50) { + solidify(_vm->_gyro->scrolln); + _vm->_gyro->scrolln++; + } + _vm->_gyro->scroll[_vm->_gyro->scrolln] = _vm->_gyro->scroll[_vm->_gyro->scrolln] + _vm->_gyro->buffer[fv]; + } + } } void Scrolls::display(Common::String z) { _vm->_gyro->bufsize = z.size(); - memcpy(_vm->_gyro->buffer, z.c_str() + 1, _vm->_gyro->bufsize); + memcpy(_vm->_gyro->buffer, z.c_str(), _vm->_gyro->bufsize); calldrivers(); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 5fdbab7f8629..1caaf5e0376d 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -77,14 +77,34 @@ class Scrolls { static const int16 roman = 0; static const int16 italic = 1; - static const int16 halficonwidth = 19; /* Half the width of an icon. */ + static const int16 halficonwidth = 19; // Half the width of an icon. + + + + // Constants to replace the command characters from Pascal: + // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers + + static const char kControlSpeechBubble = 2; // ^B + static const char kControlCenter = 3; // ^C + static const char kControlToBuffer = 4; // ^D + static const char kControlBell = 7; // ^G + static const char kControlInsertSpaces = 9; // ^I + static const char kControlLeftJustified = 12; // ^L + static const char kControlNewLine = 13; // ^M + static const char kControlParagraph = 16; // ^P + static const char kControlQuestion = 17; // ^Q + static const char kControlRegister = 19; // ^S + static const char kControlNegative = 21; // ^U + static const char kControlIcon = 22; // ^V + + int16 dix, diy; raw ch[2]; - byte cfont; /* Current font */ + byte cfont; // Current font int16 dodgex, dodgey; - byte param; /* For using arguments code */ + byte param; // For using arguments code byte use_icon; From 832a11a2bad40b8330fe9bd0a9f6c7cdb871e670 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 2 Aug 2013 14:15:36 +0200 Subject: [PATCH 0246/1332] AVALANCHE: Repair Scrolls::resetscroll() and Scrolls::calldrivers(). --- engines/avalanche/avalot.cpp | 6 ++++-- engines/avalanche/scrolls2.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index bdf74728c114..c403f00a3d55 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -147,8 +147,10 @@ void Avalot::setup() { _vm->_parser->cursorOn(); _vm->_trip->newspeed(); - if (! _vm->_gyro->reloaded) - _vm->_visa->dixi('q', 83); /* Info on the game: etc. */ + //if (! _vm->_gyro->reloaded) + // _vm->_visa->dixi('q', 83); /* Info on the game: etc. */ + // + // TODO: UNCOMMENT THIS! ONLY COMMENTED OUT FOR TESTING!!! } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1f85ba0eb182..4c3ebc0d687a 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -237,10 +237,10 @@ bool Scrolls::ask(Common::String question) { } void Scrolls::resetscroll() { - _vm->_gyro->scrolln = 1; + _vm->_gyro->scrolln = 0; for (int j = 0; j < 15; j ++) - for (int i = 0; i < _vm->_gyro->scroll[j].size(); i++) - _vm->_gyro->scroll[j].setChar(0, i); + if (!_vm->_gyro->scroll[j].empty()) + _vm->_gyro->scroll[j].clear(); } void Scrolls::natural() { /* Natural state of bubbles */ @@ -496,12 +496,12 @@ void Scrolls::calldrivers() { solidify(_vm->_gyro->scrolln); _vm->_gyro->scrolln++; } - _vm->_gyro->scroll[_vm->_gyro->scrolln] = _vm->_gyro->scroll[_vm->_gyro->scrolln] + _vm->_gyro->buffer[fv]; + _vm->_gyro->scroll[_vm->_gyro->scrolln] += _vm->_gyro->buffer[fv]; } } } -void Scrolls::display(Common::String z) { +void Scrolls::display(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! _vm->_gyro->bufsize = z.size(); memcpy(_vm->_gyro->buffer, z.c_str(), _vm->_gyro->bufsize); calldrivers(); From 471933a3fd0719a938c635735c56652e01a3ee36 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 4 Aug 2013 12:54:11 +0200 Subject: [PATCH 0247/1332] AVALANCHE: Remove comment from Graphics, partially implement Scrolls::drawscroll(), repair Scrolls::solidify(), broaden scrolls2.h. --- engines/avalanche/graphics.h | 2 +- engines/avalanche/scrolls2.cpp | 142 ++++++++++++++++++++++++++++++++- engines/avalanche/scrolls2.h | 6 +- 3 files changed, 143 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 074031f55d67..f1dbe4a0e081 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -76,7 +76,7 @@ class Graphics { byte *getPixel(int16 x, int16 y); - void drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); // Solely for testing purposes! + void drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4c3ebc0d687a..bf039d6322d9 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -106,7 +106,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit warning("STUB: Scrolls::say()"); } -/* Here are the func2edures that Scroll calls */ /* So they must be... */ /*$F+*/ +/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ void Scrolls::normscroll() { warning("STUB: Scrolls::normscroll()"); @@ -223,7 +223,141 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { f.close(); } -void Scrolls::drawscroll(func2 gotoit) { /* This is one of the oldest func2s in the game. */ +void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in the game. + byte b, groi; + int16 lx, ly, mx, my, ex, ey; + bool centre; + byte icon_indent; + + _vm->_gyro->off_virtual(); + //setvisualpage(cp); + //setactivepage(1 - cp); + _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ + _vm->_logger->log_epsonroman(); /* Scrolls always START with Roman. */ + + lx = 0; + ly = (_vm->_gyro->scrolln + 1) * 6; + for (b = 0; b <= _vm->_gyro->scrolln; b++) { + ex = _vm->_gyro->scroll[b].size() * 8; + if (lx < ex) + lx = ex; + } + mx = 320; + my = 100; // Getmaxx & getmaxy div 2, both. + lx = lx / 2; + ly -= 2; + + if ((1 <= use_icon) && (use_icon <= 34)) + lx += halficonwidth; + + _vm->_gyro->off(); + /* mblit(mx-lx-46,my-ly-6,mx+lx+15,my+ly+6,0,3);*/ + /*setfillstyle(1, 7); + setcolor(7); + pieslice(mx + lx, my - ly, 360, 90, 15); + pieslice(mx + lx, my + ly, 270, 360, 15); + setcolor(4); + arc(mx + lx, my - ly, 360, 90, 15); + arc(mx + lx, my + ly, 270, 360, 15);*/ + _vm->_graphics->drawBar(mx - lx - 30, my + ly, mx + lx, my + ly + 6, lightgray); + _vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly, lightgray); + _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx + lx + 15, my + ly, lightgray); + /*setfillstyle(1, 8); + pieslice(mx - lx - 31, my - ly, 360, 180, 15); + pieslice(mx - lx - 31, my + ly, 180, 360, 15); + setfillstyle(1, 4);*/ + _vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5, red); + _vm->_graphics->drawBar(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7, red); + _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx - lx - 14, my + ly, red); + _vm->_graphics->drawBar(mx + lx + 15, my - ly, mx + lx + 16, my + ly, red); + ex = mx - lx; + ey = my - ly; + mx -= lx; + my -= ly + 2; + //setcolor(0); + centre = false; + + switch (use_icon) { + case 0: + icon_indent = 0; + break; /* No icon. */ + case 34: { + block_drop("about", 28, 76, 15); + icon_indent = 0; + } + break; + case 35: { + block_drop("gameover", 52, 59, 71); + icon_indent = 0; + } + break; + } + + if ((1 <= use_icon) && (use_icon <= 33)) { // Standard icon. + geticon(mx, my + ly / 2, use_icon); + icon_indent = 53; + } + + + for (b = 0; b <= _vm->_gyro->scrolln; b++) { + switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) { + case kControlCenter: { + centre = true; + _vm->_gyro->scroll[b].deleteLastChar(); + } + break; + case kControlLeftJustified: { + centre = false; + _vm->_gyro->scroll[b].deleteLastChar(); + } + break; + case kControlQuestion: { + //settextjustify(1, 1); + dix = mx + lx; + diy = my + ly; + _vm->_gyro->scroll[b].setChar(' ', 0); + groi = *_vm->_graphics->getPixel(0, 0); + // inc(diy,14); + _vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); + _vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + } + break; + } + + if (centre) + say(320 - _vm->_gyro->scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->scroll[b]); + else + say(mx + icon_indent, my, _vm->_gyro->scroll[b]); + + _vm->_logger->log_scrollendline(centre); + my += 12; + } + + _vm->_gyro->underscroll = my + 3; + //setvisualpage(1 - cp); + dingdongbell(); + //my = getpixel(0, 0); + _vm->_gyro->dropsok = false; + dodgem(); + + (this->*gotoit)(); + + undodgem(); + _vm->_gyro->dropsok = true; + _vm->_logger->log_divider(); + //setvisualpage(cp); + //mousepage(cp); + _vm->_gyro->off(); + /* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/ + //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); + //blitfix(); + _vm->_gyro->oncandopageswap = true; // Normality again. + _vm->_gyro->on(); + //settextjustify(0, 0); /*sink*/ + resetscrolldriver(); + if (_vm->_gyro->mpress > 0) + _vm->_gyro->after_the_scroll = true; + warning("STUB: Scrolls::drawscroll()"); } @@ -273,7 +407,7 @@ Common::String Scrolls::lsd() { -void Scrolls::strip(Common::String &q) { // Strip trailing spaces. +void Scrolls::strip(Common::String &q) { while (q[q.size() - 1] == ' ') { q.deleteLastChar(); } @@ -287,7 +421,7 @@ void Scrolls::solidify(byte n) { do { _vm->_gyro->scroll[n + 1] = _vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] + _vm->_gyro->scroll[n + 1]; _vm->_gyro->scroll[n].deleteLastChar(); - } while (!_vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] != ' '); + } while (_vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] != ' '); strip(_vm->_gyro->scroll[n]); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 1caaf5e0376d..a4f5c0991d89 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -87,12 +87,14 @@ class Scrolls { static const char kControlSpeechBubble = 2; // ^B static const char kControlCenter = 3; // ^C static const char kControlToBuffer = 4; // ^D + static const char kControlItalic = 6; // ^F static const char kControlBell = 7; // ^G static const char kControlInsertSpaces = 9; // ^I static const char kControlLeftJustified = 12; // ^L static const char kControlNewLine = 13; // ^M static const char kControlParagraph = 16; // ^P static const char kControlQuestion = 17; // ^Q + static const char kControlRoman = 18; // ^R static const char kControlRegister = 19; // ^S static const char kControlNegative = 21; // ^U static const char kControlIcon = 22; // ^V @@ -134,9 +136,9 @@ class Scrolls { void block_drop(Common::String fn, int16 xl, int16 yl, int16 y); - void strip(Common::String &q); + void strip(Common::String &q); // Strip trailing spaces. - void solidify(byte n); + void solidify(byte n); // Does the word wrapping. void loadfont(); }; From d0b341e6ca7010641c362bb36ebfc3d225955056 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 4 Jun 2013 14:17:19 -0500 Subject: [PATCH 0248/1332] ZVISION: Create zvision bare structure Add zvision base engine to engines/zvision as well as modify the necessary engine files (configure.engines, etc.) in order for it to be recognized. --- engines/configure.engines | 1 + engines/engines.mk | 5 + engines/plugins_table.h | 3 + engines/zvision/detection.cpp | 249 +++++++++++++++++++++++++++ engines/zvision/module.mk | 18 ++ engines/zvision/zork_avi_decoder.cpp | 136 +++++++++++++++ engines/zvision/zork_avi_decoder.h | 59 +++++++ engines/zvision/zork_raw.cpp | 186 ++++++++++++++++++++ engines/zvision/zork_raw.h | 67 +++++++ engines/zvision/zvision.cpp | 217 +++++++++++++++++++++++ engines/zvision/zvision.h | 70 ++++++++ 11 files changed, 1011 insertions(+) create mode 100644 engines/zvision/detection.cpp create mode 100644 engines/zvision/module.mk create mode 100644 engines/zvision/zork_avi_decoder.cpp create mode 100644 engines/zvision/zork_avi_decoder.h create mode 100644 engines/zvision/zork_raw.cpp create mode 100644 engines/zvision/zork_raw.h create mode 100644 engines/zvision/zvision.cpp create mode 100644 engines/zvision/zvision.h diff --git a/engines/configure.engines b/engines/configure.engines index 963b9f774f40..a3525576a2d1 100644 --- a/engines/configure.engines +++ b/engines/configure.engines @@ -52,3 +52,4 @@ add_engine tony "Tony Tough and the Night of Roasted Moths" yes "" "" "16bit" add_engine tsage "TsAGE" yes add_engine tucker "Bud Tucker in Double Trouble" yes add_engine wintermute "Wintermute" no "" "" "png zlib vorbis 16bit" +add_engine zvision "ZVision" no diff --git a/engines/engines.mk b/engines/engines.mk index f58dba0d6db7..e39971320221 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -246,3 +246,8 @@ ifdef ENABLE_WINTERMUTE DEFINES += -DENABLE_WINTERMUTE=$(ENABLE_WINTERMUTE) MODULES += engines/wintermute endif + +ifdef ENABLE_ZVISION +DEFINES += -DENABLE_ZVISION=$(ENABLE_ZVISION) +MODULES += engines/zvision +endif \ No newline at end of file diff --git a/engines/plugins_table.h b/engines/plugins_table.h index edc94eb0d327..793f15110c77 100644 --- a/engines/plugins_table.h +++ b/engines/plugins_table.h @@ -119,3 +119,6 @@ LINK_PLUGIN(TUCKER) #if PLUGIN_ENABLED_STATIC(WINTERMUTE) LINK_PLUGIN(WINTERMUTE) #endif +#if PLUGIN_ENABLED_STATIC(ZVISION) +LINK_PLUGIN(ZVISION) +#endif diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp new file mode 100644 index 000000000000..345138b724b1 --- /dev/null +++ b/engines/zvision/detection.cpp @@ -0,0 +1,249 @@ +/* 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 "common/translation.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/system.h" + +#include "zvision/zvision.h" + + +namespace ZVision { + +struct ZVisionGameDescription { + ADGameDescription desc; +}; + +uint32 ZVision::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language ZVision::getLanguage() const { + return _gameDescription->desc.language; +} + +} + +static const PlainGameDescriptor zVisionGames[] = { + {"zvision", "ZVision Game"}, + {"znemesis", "Zork Nemesis: The Forbidden Lands"}, + {"zgi", "Zork: Grand Inquisitor"}, + {0, 0} +}; + + +namespace ZVision { + +static const ZVisionGameDescription gameDescriptions[] = { + + { + // Zork Nemesis English version + { + "znemesis", + 0, + AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace ZVision + +static const ExtraGuiOption ZVisionExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + +class ZVisionMetaEngine : public AdvancedMetaEngine { +public: + ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + _singleid = "zvision"; + } + + virtual const char *getName() const { + return "ZVision"; + } + + virtual const char *getOriginalCopyright() const { + return "ZVision Activision (C) 1996"; + } + + 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; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; + /* + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); + */ +} + +/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +}*/ + +bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; + if (gd) { + *engine = new ZVision::ZVision(syst, gd); + } + return gd != 0; +} + +const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(ZVisionExtraGuiOption); + return options; +} + +SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { + //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + /*ZVision::ZVision::SaveHeader header; + Common::String pattern = target; + pattern += ".???"; + + Common::StringArray filenames; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + + SaveStateList saveList; +/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { + saveList.push_back(SaveStateDescriptor(slotNum, header.description)); + } + delete in; + } + } + }*/ + + return saveList; +} + +int ZVisionMetaEngine::getMaximumSaveSlot() const { + return 999; +} + +void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { + /* + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + + saveFileMan->removeSavefile(filename.c_str()); + + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = ZVision::ZVision::getSavegameFilename(target, ++slot); + } + } + */ +} + +SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + /* + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + ZVision::ZVision::SaveHeader header; + ZVision::ZVision::kReadSaveHeaderError error; + + error = ZVision::ZVision::readSaveHeader(in, true, header); + delete in; + + if (error == ZVision::ZVision::kRSHENoError) { + SaveStateDescriptor desc(slot, header.description); + + desc.setThumbnail(header.thumbnail); + + if (header.version > 0) { + int day = (header.saveDate >> 24) & 0xFF; + int month = (header.saveDate >> 16) & 0xFF; + int year = header.saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (header.saveTime >> 16) & 0xFF; + int minutes = (header.saveTime >> 8) & 0xFF; + + desc.setSaveTime(hour, minutes); + + desc.setPlayTime(header.playTime * 1000); + } + + return desc; + } + } + */ + + return SaveStateDescriptor(); +} + +#if PLUGIN_ENABLED_DYNAMIC(ZVISION) + REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#else + REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk new file mode 100644 index 000000000000..854ee0307c28 --- /dev/null +++ b/engines/zvision/module.mk @@ -0,0 +1,18 @@ +MODULE := engines/zvision + +MODULE_OBJS := \ + detection.o \ + zvision.o \ + zork_avi_decoder.o \ + zork_raw.o + +MODULE_DIRS += \ + engines/zvision + +# This module can be built as a plugin +ifeq ($(ENABLE_ZVISION), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk \ No newline at end of file diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp new file mode 100644 index 000000000000..9bcc1637211c --- /dev/null +++ b/engines/zvision/zork_avi_decoder.cpp @@ -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. + * + * + */ + +#include "common/stream.h" +#include "audio/audiostream.h" + +#include "engines/zvision/zork_avi_decoder.h" +#include "engines/zvision/zork_raw.h" + +namespace ZVision { + +// Redefinitions from avi_decoder.cpp +#define ID_VIDS MKTAG('v','i','d','s') +#define ID_TXTS MKTAG('t','x','t','s') +#define ID_STRF MKTAG('s','t','r','f') +#define ID_AUDS MKTAG('a','u','d','s') +#define ID_MIDS MKTAG('m','i','d','s') + +// Copied off AVIDecoder::handleStreamHeader() +void ZorkAVIDecoder::handleStreamHeader() { + AVIStreamHeader sHeader; + sHeader.size = _fileStream->readUint32LE(); + sHeader.streamType = _fileStream->readUint32BE(); + + if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) + error("Unhandled MIDI/Text stream"); + + sHeader.streamHandler = _fileStream->readUint32BE(); + sHeader.flags = _fileStream->readUint32LE(); + sHeader.priority = _fileStream->readUint16LE(); + sHeader.language = _fileStream->readUint16LE(); + sHeader.initialFrames = _fileStream->readUint32LE(); + sHeader.scale = _fileStream->readUint32LE(); + sHeader.rate = _fileStream->readUint32LE(); + sHeader.start = _fileStream->readUint32LE(); + sHeader.length = _fileStream->readUint32LE(); + sHeader.bufferSize = _fileStream->readUint32LE(); + sHeader.quality = _fileStream->readUint32LE(); + sHeader.sampleSize = _fileStream->readUint32LE(); + + _fileStream->skip(sHeader.size - 48); // Skip over the remainder of the chunk (frame) + + if (_fileStream->readUint32BE() != ID_STRF) + error("Could not find STRF tag"); + + uint32 strfSize = _fileStream->readUint32LE(); + uint32 startPos = _fileStream->pos(); + + if (sHeader.streamType == ID_VIDS) { + BitmapInfoHeader bmInfo; + bmInfo.size = _fileStream->readUint32LE(); + bmInfo.width = _fileStream->readUint32LE(); + bmInfo.height = _fileStream->readUint32LE(); + bmInfo.planes = _fileStream->readUint16LE(); + bmInfo.bitCount = _fileStream->readUint16LE(); + bmInfo.compression = _fileStream->readUint32BE(); + bmInfo.sizeImage = _fileStream->readUint32LE(); + bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.clrUsed = _fileStream->readUint32LE(); + bmInfo.clrImportant = _fileStream->readUint32LE(); + + if (bmInfo.clrUsed == 0) + bmInfo.clrUsed = 256; + + if (sHeader.streamHandler == 0) + sHeader.streamHandler = bmInfo.compression; + + AVIVideoTrack *track = new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo); + + if (bmInfo.bitCount == 8) { + byte *palette = const_cast(track->getPalette()); + for (uint32 i = 0; i < bmInfo.clrUsed; i++) { + palette[i * 3 + 2] = _fileStream->readByte(); + palette[i * 3 + 1] = _fileStream->readByte(); + palette[i * 3] = _fileStream->readByte(); + _fileStream->readByte(); + } + + track->markPaletteDirty(); + } + + addTrack(track); + } else if (sHeader.streamType == ID_AUDS) { + PCMWaveFormat wvInfo; + wvInfo.tag = _fileStream->readUint16LE(); + wvInfo.channels = _fileStream->readUint16LE(); + wvInfo.samplesPerSec = _fileStream->readUint32LE(); + wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); + wvInfo.blockAlign = _fileStream->readUint16LE(); + wvInfo.size = _fileStream->readUint16LE(); + + // AVI seems to treat the sampleSize as including the second + // channel as well, so divide for our sake. + if (wvInfo.channels == 2) + sHeader.sampleSize /= 2; + + addTrack(new ZorkAVIAudioTrack(sHeader, wvInfo, _soundType)); + } + + // Ensure that we're at the end of the chunk + _fileStream->seek(startPos + strfSize); +} + +void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { + if (_audStream) { + if (_wvInfo.tag == kWaveFormatZorkPCM) { + assert(_wvInfo.size == 8); + _audStream->queueAudioStream(makeRawZorkStream(stream, _wvInfo.samplesPerSec, DisposeAfterUse::YES), DisposeAfterUse::YES); + } + } else { + delete stream; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h new file mode 100644 index 000000000000..f6b2ca7977cc --- /dev/null +++ b/engines/zvision/zork_avi_decoder.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 ZORK_AVI_DECODER_H +#define ZORK_AVI_DECODER_H + +#include "video/avi_decoder.h" + +namespace ZVision { + +class ZorkAVIDecoder : public Video::AVIDecoder { +public: + ZorkAVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : + Video::AVIDecoder(soundType) {} + + virtual ~ZorkAVIDecoder() {} + +private: + class ZorkAVIAudioTrack : public Video::AVIDecoder::AVIAudioTrack { + public: + ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) : + Video::AVIDecoder::AVIAudioTrack(streamHeader, waveFormat, soundType) {} + virtual ~ZorkAVIAudioTrack() {} + + void queueSound(Common::SeekableReadStream *stream); + }; + + void handleStreamHeader(); + + private: + // Audio Codecs + enum { + kWaveFormatZorkPCM = 17 // special Zork PCM audio format (clashes with MS IMA ADPCM) + }; +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp new file mode 100644 index 000000000000..9332aeb52e25 --- /dev/null +++ b/engines/zvision/zork_raw.cpp @@ -0,0 +1,186 @@ +/* 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/endian.h" +#include "common/memstream.h" +#include "common/textconsole.h" +#include "common/util.h" + +#include "audio/audiostream.h" + +#include "engines/zvision/zork_raw.h" + +namespace ZVision { + +#pragma mark - +#pragma mark --- RawZorkStream --- +#pragma mark - + +/** + * This is a stream, which allows for playing raw PCM data from a stream. + */ +class RawZorkStream : public Audio::SeekableAudioStream { +public: + RawZorkStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) + : _rate(rate), _playtime(0, rate), _stream(stream, disposeStream), _endOfData(false), _buffer(0) { + // Setup our buffer for readBuffer + _buffer = new byte[kSampleBufferLength]; + assert(_buffer); + + // Calculate the total playtime of the stream + _playtime = Audio::Timestamp(0, _stream->size() / 2 / 1, rate); + } + + ~RawZorkStream() { + delete[] _buffer; + } + + int readBuffer(int16 *buffer, const int numSamples); + + bool isStereo() const { return true; } + bool endOfData() const { return _endOfData; } + + int getRate() const { return _rate; } + Audio::Timestamp getLength() const { return _playtime; } + + bool seek(const Audio::Timestamp &where); +private: + const int _rate; ///< Sample rate of stream + Audio::Timestamp _playtime; ///< Calculated total play time + Common::DisposablePtr _stream; ///< Stream to read data from + bool _endOfData; ///< Whether the stream end has been reached + + byte *_buffer; ///< Buffer used in readBuffer + enum { + /** + * How many samples we can buffer at once. + * + * TODO: Check whether this size suffices + * for systems with slow disk I/O. + */ + kSampleBufferLength = 2048 + }; + + /** + * Fill the temporary sample buffer used in readBuffer. + * + * @param maxSamples Maximum samples to read. + * @return actual count of samples read. + */ + int fillBuffer(int maxSamples); +}; + +int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { + int samplesLeft = numSamples; + + while (samplesLeft > 0) { + // Try to read up to "samplesLeft" samples. + int len = fillBuffer(samplesLeft); + + // In case we were not able to read any samples + // we will stop reading here. + if (!len) + break; + + // Adjust the samples left to read. + samplesLeft -= len; + + // Copy the data to the caller's buffer. + const byte *src = _buffer; + while (len-- > 0) { + if (*src < 128) + *buffer++ = ((128 - *src) << 8) ^ 0x8000; + else + *buffer++ = (*src << 8) ^ 0x8000; + src++; + } + } + + return numSamples - samplesLeft; +} + +int RawZorkStream::fillBuffer(int maxSamples) { + int bufferedSamples = 0; + byte *dst = _buffer; + + // We can only read up to "kSampleBufferLength" samples + // so we take this into consideration, when trying to + // read up to maxSamples. + maxSamples = MIN(kSampleBufferLength, maxSamples); + + // We will only read up to maxSamples + while (maxSamples > 0 && !endOfData()) { + // Try to read all the sample data and update the + // destination pointer. + const int bytesRead = _stream->read(dst, maxSamples); + dst += bytesRead; + + // Calculate how many samples we actually read. + const int samplesRead = bytesRead; + + // Update all status variables + bufferedSamples += samplesRead; + maxSamples -= samplesRead; + + // We stop stream playback, when we reached the end of the data stream. + // We also stop playback when an error occures. + if (_stream->pos() == _stream->size() || _stream->err() || _stream->eos()) + _endOfData = true; + } + + return bufferedSamples; +} + +bool RawZorkStream::seek(const Audio::Timestamp &where) { + _endOfData = true; + + if (where > _playtime) + return false; + + const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); + _stream->seek(seekSample, SEEK_SET); + + // In case of an error we will not continue stream playback. + if (!_stream->err() && !_stream->eos() && _stream->pos() != _stream->size()) + _endOfData = false; + + return true; +} + +#pragma mark - +#pragma mark --- Raw stream factories --- +#pragma mark - + +Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, + int rate, + DisposeAfterUse::Flag disposeAfterUse) { + assert(stream->size() % 2 == 0); + return new RawZorkStream(rate, disposeAfterUse, stream); +} + +Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, + int rate, + DisposeAfterUse::Flag disposeAfterUse) { + return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); +} + +} // End of namespace Audio diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h new file mode 100644 index 000000000000..a8f8ce037f85 --- /dev/null +++ b/engines/zvision/zork_raw.h @@ -0,0 +1,67 @@ +/* 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 ZVISION_ZORK_RAW_H +#define ZVISION_ZORK_RAW_H + +#include "common/scummsys.h" +#include "common/types.h" + +#include "common/list.h" + + +namespace Common { +class SeekableReadStream; +} + +namespace ZVision { + +class SeekableAudioStream; + +/** + * Creates an audio stream, which plays from the given buffer. + * + * @param buffer Buffer to play from. + * @param size Size of the buffer in bytes. + * @param rate Rate of the sound data. + * @param disposeAfterUse Whether to free the buffer after use (with free!). + * @return The new SeekableAudioStream (or 0 on failure). + */ +Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, + int rate, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + +/** + * Creates an audio stream, which plays from the given stream. + * + * @param stream Stream object to play from. + * @param rate Rate of the sound data. + * @param disposeAfterUse Whether to delete the stream after use. + * @return The new SeekableAudioStream (or 0 on failure). + */ +Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, + int rate, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + +} // End of namespace Audio + +#endif diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp new file mode 100644 index 000000000000..0e553e6287d5 --- /dev/null +++ b/engines/zvision/zvision.cpp @@ -0,0 +1,217 @@ +#include "common/scummsys.h" + +#include "common/config-manager.h" +#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 "audio/audiostream.h" +#include "audio/mixer.h" + +#include "graphics/palette.h" +#include "graphics/surface.h" +#include "graphics/decoders/tga.h" + +#include "video/video_decoder.h" +#include "video/avi_decoder.h" + +#include "engines/util.h" + +#include "zvision/zvision.h" +#include "zvision/zork_avi_decoder.h" +#include "zvision/zork_raw.h" + +namespace ZVision { + +ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { + // Put your engine in a sane state, but do nothing big yet; + // in particular, do not load data from files; rather, if you + // need to do such things, do them from run(). + + // Do not initialize graphics here + + // However this is the place to specify all default directories + const Common::FSNode gameDataDir(ConfMan.get("path")); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/asylum"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/castle"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/conserv"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/endgame"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global/venus"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global2"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global3"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/monast"); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/temple"); + + // Here is the right place to set up the engine specific debug channels + //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); + //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); + + // Don't forget to register your random source + _rnd = new Common::RandomSource("zvision"); + + debug("ZVision::ZVision"); +} + +ZVision::~ZVision() { + debug("ZVision::~ZVision"); + + // Dispose your resources here + delete _rnd; + + // Remove all of our debug levels here + DebugMan.clearAllDebugChannels(); +} + +void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { + if (!videoDecoder) + return; + + videoDecoder->start(); + + byte *scaleBuffer = 0; + byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; + uint16 width = videoDecoder->getWidth(); + uint16 height = videoDecoder->getHeight(); + uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; + uint16 screenWidth = 640;//g_sci->_gfxScreen->getDisplayWidth(); + uint16 screenHeight = 480;//g_sci->_gfxScreen->getDisplayHeight(); + + //videoState.fileName.toLowercase(); + + /*if (screenWidth == 640 && width <= 320 && height <= 240 && ((videoState.flags & kDoubled))) { + width *= 2; + height *= 2; + pitch *= 2; + scaleBuffer = new byte[width * height * bytesPerPixel]; + }*/ + + uint16 x, y; + + // Sanity check... + /*if (videoState.x > 0 && videoState.y > 0 && isVMD) { + x = videoState.x; + y = videoState.y; + + if (x + width > screenWidth || y + height > screenHeight) { + // Happens in the Lighthouse demo + warning("VMD video won't fit on screen, centering it instead"); + x = (screenWidth - width) / 2; + y = (screenHeight - height) / 2; + } + } else {*/ + x = (screenWidth - width) / 2; + y = (screenHeight - height) / 2; + //} + + bool skipVideo = false; + + while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + if (videoDecoder->needsUpdate()) { + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + + if (frame) { + if (scaleBuffer) { + // TODO: Perhaps reuse the relevant function from SCI? + //g_sci->_gfxScreen->scale2x((byte *)frame->pixels, 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->updateScreen(); + } + } + + Common::Event event; + while (g_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + g_system->delayMillis(10); + } + + delete[] scaleBuffer; + delete videoDecoder; +} + +Common::Error ZVision::run() { + //Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); // ARGB8888 + Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 + initGraphics(640, 480, true, &format); + + // Create debugger console. It requires GFX to be initialized + _console = new Console(this); + + // Additional setup. + debug("ZVision::init"); + + // Your main even loop should be (invoked from) here. + debug("ZVision::go: Hello, World!"); + + // This test will show up if -d1 and --debugflags=example are specified on the commandline + //debugC(1, kZVisionDebugExample, "Example debug call"); + + // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline + //debugC(3, kZVisionDebugExample | kZVisionDebugExample2, "Example debug call two"); + +#if 1 + // Video test + Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); + if (videoDecoder && videoDecoder->loadFile(/*"TD9EAZ1C.AVI"*/"T000A11C.AVI")) { + Common::List formats; + formats.push_back(videoDecoder->getPixelFormat()); + initGraphics(640, 480, true, formats); + + playVideo(videoDecoder); + } +#endif + + Common::File f; + +#if 1 + // Image test + f.open("CB8EB11C.TGA"); + + Graphics::TGADecoder tga; + if (!tga.loadStream(f)) + error("Error while reading TGA image"); + f.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + Graphics::Surface *screen = g_system->lockScreen(); + for (uint16 y = 0; y < tgaSurface->h; y++) + memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); + g_system->unlockScreen(); + + tga.destroy(); +#endif + +#if 1 + // Sound test + f.open("C000H9TC.RAW"); + Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); + Audio::SoundHandle handle; + g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); +#endif + + // Main loop + Common::EventManager *eventMan = g_system->getEventManager(); + Common::Event event; + + while (!shouldQuit()) { + eventMan->pollEvent(event); // eat events + g_system->updateScreen(); + g_system->delayMillis(10); + } + + return Common::kNoError; +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h new file mode 100644 index 000000000000..c2a42f1e21c2 --- /dev/null +++ b/engines/zvision/zvision.h @@ -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. + * + * + */ + +#ifndef ZVISION_H +#define ZVISION_H + +#include "common/random.h" +#include "engines/engine.h" +#include "gui/debugger.h" + +namespace ZVision { + +struct ZVisionGameDescription; +class Console; + +// our engine debug channels +enum { + kZDebugExample = 1 << 0, + kZDebugExample2 = 1 << 1 + // next new channel must be 1 << 2 (4) + // the current limitation is 32 debug channels (1 << 31 is the last one) +}; + +class ZVision : public Engine { +public: + ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); + ~ZVision(); + + uint32 getFeatures() const; + Common::Language getLanguage() const; + virtual Common::Error run(); + +private: + Console *_console; + const ZVisionGameDescription *_gameDescription; + + // We need random numbers + Common::RandomSource *_rnd; +}; + +// Example console class +class Console : public GUI::Debugger { +public: + Console(ZVision *vm) {} + virtual ~Console(void) {} +}; + +} // End of namespace ZVision + +#endif From 0303850bf7089637b34ae487855bca866d57b580 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 6 Jun 2013 13:03:09 -0500 Subject: [PATCH 0249/1332] ZVISION: Allow detection to go off inner directory Game detection needs to be off an actual resource, but all the resources are in subdirectories. This updates the code to search for the specific subdirectory. --- engines/zvision/detection.cpp | 9 +++++- engines/zvision/zvision.cpp | 60 +++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 345138b724b1..f8ed6a749b33 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -68,7 +68,7 @@ static const ZVisionGameDescription gameDescriptions[] = { 0, AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), Common::EN_ANY, - Common::kPlatformWindows, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, @@ -79,6 +79,11 @@ static const ZVisionGameDescription gameDescriptions[] = { } // End of namespace ZVision +static const char *directoryGlobs[] = { + "znemscr", + 0 +}; + static const ExtraGuiOption ZVisionExtraGuiOption = { _s("Use original save/load screens"), _s("Use the original save/load screens, instead of the ScummVM ones"), @@ -89,6 +94,8 @@ static const ExtraGuiOption ZVisionExtraGuiOption = { class ZVisionMetaEngine : public AdvancedMetaEngine { public: ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; _singleid = "zvision"; } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0e553e6287d5..d291cabc703d 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -35,17 +35,11 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine // However this is the place to specify all default directories const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/asylum"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/castle"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/conserv"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/endgame"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global/venus"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global2"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/global3"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/monast"); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets/temple"); + SearchMan.addSubDirectoryMatching(gameDataDir, "data1"); + SearchMan.addSubDirectoryMatching(gameDataDir, "data2"); + SearchMan.addSubDirectoryMatching(gameDataDir, "data3"); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx"); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemscr"); // Here is the right place to set up the engine specific debug channels //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); @@ -160,10 +154,18 @@ Common::Error ZVision::run() { // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline //debugC(3, kZVisionDebugExample | kZVisionDebugExample2, "Example debug call two"); + Common::File file; + + if (file.open("ADLIB.MDI")) { + file.close(); + } + + + #if 1 // Video test Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); - if (videoDecoder && videoDecoder->loadFile(/*"TD9EAZ1C.AVI"*/"T000A11C.AVI")) { + if (videoDecoder && videoDecoder->loadFile("ZASSETS/TEMPLE/T000A11C.AVI")) { Common::List formats; formats.push_back(videoDecoder->getPixelFormat()); initGraphics(640, 480, true, formats); @@ -176,29 +178,33 @@ Common::Error ZVision::run() { #if 1 // Image test - f.open("CB8EB11C.TGA"); + if (f.open("zassets/castle/CB8EB11C.TGA")) { + Graphics::TGADecoder tga; + if (!tga.loadStream(f)) + error("Error while reading TGA image"); + f.close(); - Graphics::TGADecoder tga; - if (!tga.loadStream(f)) - error("Error while reading TGA image"); - f.close(); + const Graphics::Surface *tgaSurface = tga.getSurface(); - const Graphics::Surface *tgaSurface = tga.getSurface(); + Graphics::Surface *screen = g_system->lockScreen(); + for (uint16 y = 0; y < tgaSurface->h; y++) + memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); + g_system->unlockScreen(); - Graphics::Surface *screen = g_system->lockScreen(); - for (uint16 y = 0; y < tgaSurface->h; y++) - memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); - g_system->unlockScreen(); + tga.destroy(); + } - tga.destroy(); + #endif #if 1 // Sound test - f.open("C000H9TC.RAW"); - Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); - Audio::SoundHandle handle; - g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + if (f.open("zassets/castle/C000H9TC.RAW")) { + Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); + Audio::SoundHandle handle; + g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + } + #endif // Main loop From 5d64107ff3c22324080e2a151a88c49e1ee6cb9d Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 6 Jun 2013 14:51:46 -0500 Subject: [PATCH 0250/1332] ZVISION: normalized file endings --- engines/zvision/detection.cpp | 506 +++++++++++++++++----------------- 1 file changed, 253 insertions(+), 253 deletions(-) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index f8ed6a749b33..5488ae5be4cb 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -1,256 +1,256 @@ -/* 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 "common/translation.h" -#include "common/savefile.h" -#include "common/str-array.h" -#include "common/system.h" - -#include "zvision/zvision.h" - - -namespace ZVision { - -struct ZVisionGameDescription { - ADGameDescription desc; -}; - -uint32 ZVision::getFeatures() const { - return _gameDescription->desc.flags; -} - -Common::Language ZVision::getLanguage() const { - return _gameDescription->desc.language; -} - -} - -static const PlainGameDescriptor zVisionGames[] = { - {"zvision", "ZVision Game"}, - {"znemesis", "Zork Nemesis: The Forbidden Lands"}, - {"zgi", "Zork: Grand Inquisitor"}, - {0, 0} -}; - - -namespace ZVision { - -static const ZVisionGameDescription gameDescriptions[] = { - - { - // Zork Nemesis English version - { - "znemesis", - 0, - AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), - Common::EN_ANY, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) - }, - }, - - { AD_TABLE_END_MARKER } -}; - -} // End of namespace ZVision - +/* 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 "common/translation.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/system.h" + +#include "zvision/zvision.h" + + +namespace ZVision { + +struct ZVisionGameDescription { + ADGameDescription desc; +}; + +uint32 ZVision::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language ZVision::getLanguage() const { + return _gameDescription->desc.language; +} + +} + +static const PlainGameDescriptor zVisionGames[] = { + {"zvision", "ZVision Game"}, + {"znemesis", "Zork Nemesis: The Forbidden Lands"}, + {"zgi", "Zork: Grand Inquisitor"}, + {0, 0} +}; + + +namespace ZVision { + +static const ZVisionGameDescription gameDescriptions[] = { + + { + // Zork Nemesis English version + { + "znemesis", + 0, + AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace ZVision + static const char *directoryGlobs[] = { "znemscr", 0 -}; - -static const ExtraGuiOption ZVisionExtraGuiOption = { - _s("Use original save/load screens"), - _s("Use the original save/load screens, instead of the ScummVM ones"), - "originalsaveload", - false -}; - -class ZVisionMetaEngine : public AdvancedMetaEngine { -public: - ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { - _maxScanDepth = 2; - _directoryGlobs = directoryGlobs; - _singleid = "zvision"; - } - - virtual const char *getName() const { - return "ZVision"; - } - - virtual const char *getOriginalCopyright() const { - return "ZVision Activision (C) 1996"; - } - - 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; - SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; -}; - -bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; - /* - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); - */ -} - -/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { - return - (f == kSupportsRTL) || - (f == kSupportsLoadingDuringRuntime) || - (f == kSupportsSavingDuringRuntime); -}*/ - -bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { - const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; - if (gd) { - *engine = new ZVision::ZVision(syst, gd); - } - return gd != 0; -} - -const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { - ExtraGuiOptions options; - options.push_back(ZVisionExtraGuiOption); - return options; -} - -SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { - //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - /*ZVision::ZVision::SaveHeader header; - Common::String pattern = target; - pattern += ".???"; - - Common::StringArray filenames; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ - - SaveStateList saveList; -/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { - if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { - saveList.push_back(SaveStateDescriptor(slotNum, header.description)); - } - delete in; - } - } - }*/ - - return saveList; -} - -int ZVisionMetaEngine::getMaximumSaveSlot() const { - return 999; -} - -void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { - /* - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - - saveFileMan->removeSavefile(filename.c_str()); - - Common::StringArray filenames; - Common::String pattern = target; - pattern += ".???"; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) - - for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - // Rename every slot greater than the deleted slot, - if (slotNum > slot) { - saveFileMan->renameSavefile(file->c_str(), filename.c_str()); - filename = ZVision::ZVision::getSavegameFilename(target, ++slot); - } - } - */ -} - -SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - /* - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); - - if (in) { - ZVision::ZVision::SaveHeader header; - ZVision::ZVision::kReadSaveHeaderError error; - - error = ZVision::ZVision::readSaveHeader(in, true, header); - delete in; - - if (error == ZVision::ZVision::kRSHENoError) { - SaveStateDescriptor desc(slot, header.description); - - desc.setThumbnail(header.thumbnail); - - if (header.version > 0) { - int day = (header.saveDate >> 24) & 0xFF; - int month = (header.saveDate >> 16) & 0xFF; - int year = header.saveDate & 0xFFFF; - - desc.setSaveDate(year, month, day); - - int hour = (header.saveTime >> 16) & 0xFF; - int minutes = (header.saveTime >> 8) & 0xFF; - - desc.setSaveTime(hour, minutes); - - desc.setPlayTime(header.playTime * 1000); - } - - return desc; - } - } - */ - - return SaveStateDescriptor(); -} - -#if PLUGIN_ENABLED_DYNAMIC(ZVISION) - REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#else - REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#endif +}; + +static const ExtraGuiOption ZVisionExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + +class ZVisionMetaEngine : public AdvancedMetaEngine { +public: + ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; + _singleid = "zvision"; + } + + virtual const char *getName() const { + return "ZVision"; + } + + virtual const char *getOriginalCopyright() const { + return "ZVision Activision (C) 1996"; + } + + 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; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; + /* + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); + */ +} + +/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +}*/ + +bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; + if (gd) { + *engine = new ZVision::ZVision(syst, gd); + } + return gd != 0; +} + +const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(ZVisionExtraGuiOption); + return options; +} + +SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { + //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + /*ZVision::ZVision::SaveHeader header; + Common::String pattern = target; + pattern += ".???"; + + Common::StringArray filenames; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + + SaveStateList saveList; +/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { + saveList.push_back(SaveStateDescriptor(slotNum, header.description)); + } + delete in; + } + } + }*/ + + return saveList; +} + +int ZVisionMetaEngine::getMaximumSaveSlot() const { + return 999; +} + +void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { + /* + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + + saveFileMan->removeSavefile(filename.c_str()); + + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = ZVision::ZVision::getSavegameFilename(target, ++slot); + } + } + */ +} + +SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + /* + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + ZVision::ZVision::SaveHeader header; + ZVision::ZVision::kReadSaveHeaderError error; + + error = ZVision::ZVision::readSaveHeader(in, true, header); + delete in; + + if (error == ZVision::ZVision::kRSHENoError) { + SaveStateDescriptor desc(slot, header.description); + + desc.setThumbnail(header.thumbnail); + + if (header.version > 0) { + int day = (header.saveDate >> 24) & 0xFF; + int month = (header.saveDate >> 16) & 0xFF; + int year = header.saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (header.saveTime >> 16) & 0xFF; + int minutes = (header.saveTime >> 8) & 0xFF; + + desc.setSaveTime(hour, minutes); + + desc.setPlayTime(header.playTime * 1000); + } + + return desc; + } + } + */ + + return SaveStateDescriptor(); +} + +#if PLUGIN_ENABLED_DYNAMIC(ZVISION) + REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#else + REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#endif From 8ae85892d60d502c582b43b5b6b77af2baccc739 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 8 Jun 2013 10:32:22 -0500 Subject: [PATCH 0251/1332] ZVISION: Alter video handling to follow the new video audio track wrapper. Commit 7a49802c01b0c39be4e86335689db8f3359fde68 created an audio track hook that allows video decoding to use a differnt audio track encoding method Also, re-normalize line endings --- engines/zvision/detection.cpp | 512 +++++++++++++-------------- engines/zvision/zork_avi_decoder.cpp | 94 +---- engines/zvision/zork_avi_decoder.h | 2 +- engines/zvision/zvision.cpp | 68 ++-- 4 files changed, 308 insertions(+), 368 deletions(-) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 5488ae5be4cb..62d834ac3ff4 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -1,256 +1,256 @@ -/* 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 "common/translation.h" -#include "common/savefile.h" -#include "common/str-array.h" -#include "common/system.h" - -#include "zvision/zvision.h" - - -namespace ZVision { - -struct ZVisionGameDescription { - ADGameDescription desc; -}; - -uint32 ZVision::getFeatures() const { - return _gameDescription->desc.flags; -} - -Common::Language ZVision::getLanguage() const { - return _gameDescription->desc.language; -} - -} - -static const PlainGameDescriptor zVisionGames[] = { - {"zvision", "ZVision Game"}, - {"znemesis", "Zork Nemesis: The Forbidden Lands"}, - {"zgi", "Zork: Grand Inquisitor"}, - {0, 0} -}; - - -namespace ZVision { - -static const ZVisionGameDescription gameDescriptions[] = { - - { - // Zork Nemesis English version - { - "znemesis", - 0, - AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), - Common::EN_ANY, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) - }, - }, - - { AD_TABLE_END_MARKER } -}; - -} // End of namespace ZVision - -static const char *directoryGlobs[] = { - "znemscr", - 0 -}; - -static const ExtraGuiOption ZVisionExtraGuiOption = { - _s("Use original save/load screens"), - _s("Use the original save/load screens, instead of the ScummVM ones"), - "originalsaveload", - false -}; - -class ZVisionMetaEngine : public AdvancedMetaEngine { -public: - ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { - _maxScanDepth = 2; - _directoryGlobs = directoryGlobs; - _singleid = "zvision"; - } - - virtual const char *getName() const { - return "ZVision"; - } - - virtual const char *getOriginalCopyright() const { - return "ZVision Activision (C) 1996"; - } - - 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; - SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; -}; - -bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; - /* - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); - */ -} - -/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { - return - (f == kSupportsRTL) || - (f == kSupportsLoadingDuringRuntime) || - (f == kSupportsSavingDuringRuntime); -}*/ - -bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { - const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; - if (gd) { - *engine = new ZVision::ZVision(syst, gd); - } - return gd != 0; -} - -const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { - ExtraGuiOptions options; - options.push_back(ZVisionExtraGuiOption); - return options; -} - -SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { - //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - /*ZVision::ZVision::SaveHeader header; - Common::String pattern = target; - pattern += ".???"; - - Common::StringArray filenames; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ - - SaveStateList saveList; -/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { - if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { - saveList.push_back(SaveStateDescriptor(slotNum, header.description)); - } - delete in; - } - } - }*/ - - return saveList; -} - -int ZVisionMetaEngine::getMaximumSaveSlot() const { - return 999; -} - -void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { - /* - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - - saveFileMan->removeSavefile(filename.c_str()); - - Common::StringArray filenames; - Common::String pattern = target; - pattern += ".???"; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) - - for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - // Rename every slot greater than the deleted slot, - if (slotNum > slot) { - saveFileMan->renameSavefile(file->c_str(), filename.c_str()); - filename = ZVision::ZVision::getSavegameFilename(target, ++slot); - } - } - */ -} - -SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - /* - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); - - if (in) { - ZVision::ZVision::SaveHeader header; - ZVision::ZVision::kReadSaveHeaderError error; - - error = ZVision::ZVision::readSaveHeader(in, true, header); - delete in; - - if (error == ZVision::ZVision::kRSHENoError) { - SaveStateDescriptor desc(slot, header.description); - - desc.setThumbnail(header.thumbnail); - - if (header.version > 0) { - int day = (header.saveDate >> 24) & 0xFF; - int month = (header.saveDate >> 16) & 0xFF; - int year = header.saveDate & 0xFFFF; - - desc.setSaveDate(year, month, day); - - int hour = (header.saveTime >> 16) & 0xFF; - int minutes = (header.saveTime >> 8) & 0xFF; - - desc.setSaveTime(hour, minutes); - - desc.setPlayTime(header.playTime * 1000); - } - - return desc; - } - } - */ - - return SaveStateDescriptor(); -} - -#if PLUGIN_ENABLED_DYNAMIC(ZVISION) - REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#else - REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#endif +/* 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 "common/translation.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/system.h" + +#include "zvision/zvision.h" + + +namespace ZVision { + +struct ZVisionGameDescription { + ADGameDescription desc; +}; + +uint32 ZVision::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language ZVision::getLanguage() const { + return _gameDescription->desc.language; +} + +} + +static const PlainGameDescriptor zVisionGames[] = { + {"zvision", "ZVision Game"}, + {"znemesis", "Zork Nemesis: The Forbidden Lands"}, + {"zgi", "Zork: Grand Inquisitor"}, + {0, 0} +}; + + +namespace ZVision { + +static const ZVisionGameDescription gameDescriptions[] = { + + { + // Zork Nemesis English version + { + "znemesis", + 0, + AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace ZVision + +static const char *directoryGlobs[] = { + "znemscr", + 0 +}; + +static const ExtraGuiOption ZVisionExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + +class ZVisionMetaEngine : public AdvancedMetaEngine { +public: + ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; + _singleid = "zvision"; + } + + virtual const char *getName() const { + return "ZVision"; + } + + virtual const char *getOriginalCopyright() const { + return "ZVision Activision (C) 1996"; + } + + 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; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; + /* + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); + */ +} + +/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +}*/ + +bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; + if (gd) { + *engine = new ZVision::ZVision(syst, gd); + } + return gd != 0; +} + +const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(ZVisionExtraGuiOption); + return options; +} + +SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { + //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + /*ZVision::ZVision::SaveHeader header; + Common::String pattern = target; + pattern += ".???"; + + Common::StringArray filenames; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + + SaveStateList saveList; +/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { + saveList.push_back(SaveStateDescriptor(slotNum, header.description)); + } + delete in; + } + } + }*/ + + return saveList; +} + +int ZVisionMetaEngine::getMaximumSaveSlot() const { + return 999; +} + +void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { + /* + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + + saveFileMan->removeSavefile(filename.c_str()); + + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = ZVision::ZVision::getSavegameFilename(target, ++slot); + } + } + */ +} + +SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + /* + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + ZVision::ZVision::SaveHeader header; + ZVision::ZVision::kReadSaveHeaderError error; + + error = ZVision::ZVision::readSaveHeader(in, true, header); + delete in; + + if (error == ZVision::ZVision::kRSHENoError) { + SaveStateDescriptor desc(slot, header.description); + + desc.setThumbnail(header.thumbnail); + + if (header.version > 0) { + int day = (header.saveDate >> 24) & 0xFF; + int month = (header.saveDate >> 16) & 0xFF; + int year = header.saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (header.saveTime >> 16) & 0xFF; + int minutes = (header.saveTime >> 8) & 0xFF; + + desc.setSaveTime(hour, minutes); + + desc.setPlayTime(header.playTime * 1000); + } + + return desc; + } + } + */ + + return SaveStateDescriptor(); +} + +#if PLUGIN_ENABLED_DYNAMIC(ZVISION) + REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#else + REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#endif diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp index 9bcc1637211c..b0524c7d2f3a 100644 --- a/engines/zvision/zork_avi_decoder.cpp +++ b/engines/zvision/zork_avi_decoder.cpp @@ -29,97 +29,9 @@ namespace ZVision { -// Redefinitions from avi_decoder.cpp -#define ID_VIDS MKTAG('v','i','d','s') -#define ID_TXTS MKTAG('t','x','t','s') -#define ID_STRF MKTAG('s','t','r','f') -#define ID_AUDS MKTAG('a','u','d','s') -#define ID_MIDS MKTAG('m','i','d','s') - -// Copied off AVIDecoder::handleStreamHeader() -void ZorkAVIDecoder::handleStreamHeader() { - AVIStreamHeader sHeader; - sHeader.size = _fileStream->readUint32LE(); - sHeader.streamType = _fileStream->readUint32BE(); - - if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) - error("Unhandled MIDI/Text stream"); - - sHeader.streamHandler = _fileStream->readUint32BE(); - sHeader.flags = _fileStream->readUint32LE(); - sHeader.priority = _fileStream->readUint16LE(); - sHeader.language = _fileStream->readUint16LE(); - sHeader.initialFrames = _fileStream->readUint32LE(); - sHeader.scale = _fileStream->readUint32LE(); - sHeader.rate = _fileStream->readUint32LE(); - sHeader.start = _fileStream->readUint32LE(); - sHeader.length = _fileStream->readUint32LE(); - sHeader.bufferSize = _fileStream->readUint32LE(); - sHeader.quality = _fileStream->readUint32LE(); - sHeader.sampleSize = _fileStream->readUint32LE(); - - _fileStream->skip(sHeader.size - 48); // Skip over the remainder of the chunk (frame) - - if (_fileStream->readUint32BE() != ID_STRF) - error("Could not find STRF tag"); - - uint32 strfSize = _fileStream->readUint32LE(); - uint32 startPos = _fileStream->pos(); - - if (sHeader.streamType == ID_VIDS) { - BitmapInfoHeader bmInfo; - bmInfo.size = _fileStream->readUint32LE(); - bmInfo.width = _fileStream->readUint32LE(); - bmInfo.height = _fileStream->readUint32LE(); - bmInfo.planes = _fileStream->readUint16LE(); - bmInfo.bitCount = _fileStream->readUint16LE(); - bmInfo.compression = _fileStream->readUint32BE(); - bmInfo.sizeImage = _fileStream->readUint32LE(); - bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); - bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); - bmInfo.clrUsed = _fileStream->readUint32LE(); - bmInfo.clrImportant = _fileStream->readUint32LE(); - - if (bmInfo.clrUsed == 0) - bmInfo.clrUsed = 256; - - if (sHeader.streamHandler == 0) - sHeader.streamHandler = bmInfo.compression; - - AVIVideoTrack *track = new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo); - - if (bmInfo.bitCount == 8) { - byte *palette = const_cast(track->getPalette()); - for (uint32 i = 0; i < bmInfo.clrUsed; i++) { - palette[i * 3 + 2] = _fileStream->readByte(); - palette[i * 3 + 1] = _fileStream->readByte(); - palette[i * 3] = _fileStream->readByte(); - _fileStream->readByte(); - } - - track->markPaletteDirty(); - } - - addTrack(track); - } else if (sHeader.streamType == ID_AUDS) { - PCMWaveFormat wvInfo; - wvInfo.tag = _fileStream->readUint16LE(); - wvInfo.channels = _fileStream->readUint16LE(); - wvInfo.samplesPerSec = _fileStream->readUint32LE(); - wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); - wvInfo.blockAlign = _fileStream->readUint16LE(); - wvInfo.size = _fileStream->readUint16LE(); - - // AVI seems to treat the sampleSize as including the second - // channel as well, so divide for our sake. - if (wvInfo.channels == 2) - sHeader.sampleSize /= 2; - - addTrack(new ZorkAVIAudioTrack(sHeader, wvInfo, _soundType)); - } - - // Ensure that we're at the end of the chunk - _fileStream->seek(startPos + strfSize); +Video::AVIDecoder::AVIAudioTrack *ZVision::ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { + ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack *audioTrack = new ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); + return (Video::AVIDecoder::AVIAudioTrack *)audioTrack; } void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h index f6b2ca7977cc..5530d92ce48b 100644 --- a/engines/zvision/zork_avi_decoder.h +++ b/engines/zvision/zork_avi_decoder.h @@ -45,7 +45,7 @@ class ZorkAVIDecoder : public Video::AVIDecoder { void queueSound(Common::SeekableReadStream *stream); }; - void handleStreamHeader(); + Video::AVIDecoder::AVIAudioTrack *createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo); private: // Audio Codecs diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index d291cabc703d..1a72ea0e8c93 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -61,6 +61,45 @@ ZVision::~ZVision() { DebugMan.clearAllDebugChannels(); } +// Taken from SCI +void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel) { + assert(bytesPerPixel == 1 || bytesPerPixel == 2); + const int newWidth = srcWidth * 2; + const int pitch = newWidth * bytesPerPixel; + const byte *srcPtr = src; + + if (bytesPerPixel == 1) { + for (int y = 0; y < srcHeight; y++) { + for (int x = 0; x < srcWidth; x++) { + const byte color = *srcPtr++; + dst[0] = color; + dst[1] = color; + dst[newWidth] = color; + dst[newWidth + 1] = color; + dst += 2; + } + dst += newWidth; + } + } else if (bytesPerPixel == 2) { + for (int y = 0; y < srcHeight; y++) { + for (int x = 0; x < srcWidth; x++) { + const byte color = *srcPtr++; + const byte color2 = *srcPtr++; + dst[0] = color; + dst[1] = color2; + dst[2] = color; + dst[3] = color2; + dst[pitch] = color; + dst[pitch + 1] = color2; + dst[pitch + 2] = color; + dst[pitch + 3] = color2; + dst += 4; + } + dst += pitch; + } + } +} + void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { if (!videoDecoder) return; @@ -75,32 +114,19 @@ void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { uint16 screenWidth = 640;//g_sci->_gfxScreen->getDisplayWidth(); uint16 screenHeight = 480;//g_sci->_gfxScreen->getDisplayHeight(); - //videoState.fileName.toLowercase(); + bool zoom2x = true; - /*if (screenWidth == 640 && width <= 320 && height <= 240 && ((videoState.flags & kDoubled))) { + if (zoom2x) { width *= 2; height *= 2; pitch *= 2; scaleBuffer = new byte[width * height * bytesPerPixel]; - }*/ + } uint16 x, y; - // Sanity check... - /*if (videoState.x > 0 && videoState.y > 0 && isVMD) { - x = videoState.x; - y = videoState.y; - - if (x + width > screenWidth || y + height > screenHeight) { - // Happens in the Lighthouse demo - warning("VMD video won't fit on screen, centering it instead"); - x = (screenWidth - width) / 2; - y = (screenHeight - height) / 2; - } - } else {*/ - x = (screenWidth - width) / 2; - y = (screenHeight - height) / 2; - //} + x = (screenWidth - width) / 2; + y = (screenHeight - height) / 2; bool skipVideo = false; @@ -110,8 +136,7 @@ void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { if (frame) { if (scaleBuffer) { - // TODO: Perhaps reuse the relevant function from SCI? - //g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); + scale2x((byte *)frame->pixels, 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); @@ -178,6 +203,9 @@ Common::Error ZVision::run() { #if 1 // Image test + + initGraphics(640, 480, true, &format); + if (f.open("zassets/castle/CB8EB11C.TGA")) { Graphics::TGADecoder tga; if (!tga.loadStream(f)) From 179f5de49897a723b2605a0fed18980ce144f68c Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 12 Jun 2013 15:11:21 -0500 Subject: [PATCH 0252/1332] ZVISION: Add support for ZFS archive files ZfsArchive implements Common::Archive. --- engines/zvision/zfsArchive.cpp | 144 +++++++++++++++++++++++++++++++++ engines/zvision/zfsArchive.h | 96 ++++++++++++++++++++++ engines/zvision/zvision.cpp | 12 +++ 3 files changed, 252 insertions(+) create mode 100644 engines/zvision/zfsArchive.cpp create mode 100644 engines/zvision/zfsArchive.h diff --git a/engines/zvision/zfsArchive.cpp b/engines/zvision/zfsArchive.cpp new file mode 100644 index 000000000000..a3111d77057c --- /dev/null +++ b/engines/zvision/zfsArchive.cpp @@ -0,0 +1,144 @@ +/* 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 "zfsArchive.h" +#include "common/hashmap.h" +#include "common/memstream.h" +#include "common/debug.h" + +namespace ZVision { + +ZfsArchive::ZfsArchive(const Common::String &fileName) : _fileName(fileName) { + Common::File zfsFile; + + if (!zfsFile.open(_fileName)) { + warning("ZFSArchive::ZFSArchive(): Could not find the archive file"); + return; + } + + readHeaders(&zfsFile); + + debug(0, "ArjArchive::ArjArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); +} + +ZfsArchive::ZfsArchive(const Common::String &fileName, Common::SeekableReadStream *stream) : _fileName(fileName) { + readHeaders(stream); + + debug(0, "ArjArchive::ArjArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); +} + +ZfsArchive::~ZfsArchive() { + debug(0, "ZfsArchive Destructor Called"); + ZfsEntryHeaderMap::iterator it = _entryHeaders.begin(); + for ( ; it != _entryHeaders.end(); ++it) { + delete it->_value; + } +} + +void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { + ZfsHeader header; + + // Don't do a straight struct cast since we can't guarantee endianness + header.magic = stream->readUint32LE(); + header.unknown1 = stream->readUint32LE(); + header.unknown2 = stream->readUint32LE(); + header.filesPerBlock = stream->readUint32LE(); + header.fileCount = stream->readUint32LE(); + header.xorKey = stream->readUint32LE(); + header.fileSectionOffset = stream->readUint32LE(); + + uint32 nextOffset; + + do { + // Read the offset to the next block + nextOffset = stream->readUint32LE(); + + // Read in each entry header + for (int i = 0; i < header.filesPerBlock; i++) { + ZfsEntryHeader entryHeader; + + entryHeader.name = readEntryName(stream); + entryHeader.offset = stream->readUint32LE(); + entryHeader.id = stream->readUint32LE(); + entryHeader.size = stream->readUint32LE(); + entryHeader.time = stream->readUint32LE(); + entryHeader.unknown = stream->readUint32LE(); + + if (entryHeader.size != 0) + _entryHeaders[entryHeader.name] = new ZfsEntryHeader(entryHeader); + } + + // Seek to the next block of headers + stream->seek(nextOffset); + } while (nextOffset != 0); +} + +Common::String ZfsArchive::readEntryName(Common::SeekableReadStream *stream) const { + // Entry Names are at most 16 bytes and are null padded + char buffer[16]; + stream->read(buffer, 16); + + return Common::String(buffer); +} + +bool ZfsArchive::hasFile(const Common::String &name) const { + return _entryHeaders.contains(name); +} + +int ZfsArchive::listMembers(Common::ArchiveMemberList &list) const { + int matches = 0; + + for (ZfsEntryHeaderMap::const_iterator it = _entryHeaders.begin(); it != _entryHeaders.end(); ++it) { + list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(it->_value->name, this))); + matches++; + } + + return matches; +} + +const Common::ArchiveMemberPtr ZfsArchive::getMember(const Common::String &name) const { + if (!_entryHeaders.contains(name)) + return Common::ArchiveMemberPtr(); + + return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); +} + +Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common::String &name) const { + if (!_entryHeaders.contains(name)) { + return 0; + } + + ZfsEntryHeader *entryHeader = _entryHeaders[name]; + + Common::File zfsArchive; + zfsArchive.open(_fileName); + zfsArchive.seek(entryHeader->offset); + + byte* buffer = new byte[entryHeader->size]; + zfsArchive.read(buffer, entryHeader->size); + + return new Common::MemoryReadStream(buffer, entryHeader->size, DisposeAfterUse::YES); +} + +} // End namespace ZVision + + diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfsArchive.h new file mode 100644 index 000000000000..96c002f815d3 --- /dev/null +++ b/engines/zvision/zfsArchive.h @@ -0,0 +1,96 @@ +/* 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 ZVISION_ZFS_ARCHIVE_H +#define ZVISION_ZFS_ARCHIVE_H + +#include "common/archive.h" +#include "common/file.h" +#include "common/fs.h" + +namespace ZVision { + +struct ZfsHeader { + uint32 magic; + uint32 unknown1; + uint32 unknown2; + uint32 filesPerBlock; + uint32 fileCount; + uint32 xorKey; + uint32 fileSectionOffset; +}; + +struct ZfsEntryHeader { + Common::String name; + uint32 offset; + uint32 id; + uint32 size; + uint32 time; + uint32 unknown; +}; + +typedef Common::HashMap ZfsEntryHeaderMap; + +class ZfsArchive : public Common::Archive { +public: + ZfsArchive(const Common::String &fileName); + ZfsArchive(const Common::String &fileName, Common::SeekableReadStream *stream); + ~ZfsArchive(); + + /** + * Check if a member with the given name is present in the Archive. + * Patterns are not allowed, as this is meant to be a quick File::exists() + * replacement. + */ + bool hasFile(const Common::String &fileName) const; + + /** + * Add all members of the Archive to list. + * Must only append to list, and not remove elements from it. + * + * @return the number of names added to list + */ + int listMembers(Common::ArchiveMemberList &list) const; + + /** + * Returns a ArchiveMember representation of the given file. + */ + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; + + /** + * Create a stream bound to a member with the specified name in the + * archive. If no member with this name exists, 0 is returned. + * @return the newly created input stream + */ + Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; + +private: + const Common::String _fileName; + ZfsEntryHeaderMap _entryHeaders; + + void readHeaders(Common::SeekableReadStream *stream); + Common::String readEntryName(Common::SeekableReadStream *stream) const; +}; + +} // End of namespace Common + +#endif diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 1a72ea0e8c93..b347782f59c7 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -21,6 +21,7 @@ #include "engines/util.h" #include "zvision/zvision.h" +#include "zvision/zfsArchive.h" #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" @@ -160,6 +161,17 @@ void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { } Common::Error ZVision::run() { + // Register the files within the zfs archive files with the SearchMan + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.zfs"); + + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + Common::String name = (*iter)->getName(); + ZfsArchive *archive = new ZfsArchive(name, (*iter)->createReadStream()); + + SearchMan.add(name, archive); + } + //Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); // ARGB8888 Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 initGraphics(640, 480, true, &format); From ef37f14d539d417a1a4506c5c09df1409700aa30 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 12 Jun 2013 22:06:05 -0500 Subject: [PATCH 0253/1332] ZVISION: Add xor encryption handling to ZfsArchive class --- engines/zvision/zfsArchive.cpp | 29 +++++++++++++++++++---------- engines/zvision/zfsArchive.h | 28 ++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/engines/zvision/zfsArchive.cpp b/engines/zvision/zfsArchive.cpp index a3111d77057c..59e65f171395 100644 --- a/engines/zvision/zfsArchive.cpp +++ b/engines/zvision/zfsArchive.cpp @@ -55,16 +55,17 @@ ZfsArchive::~ZfsArchive() { } void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { - ZfsHeader header; - // Don't do a straight struct cast since we can't guarantee endianness - header.magic = stream->readUint32LE(); - header.unknown1 = stream->readUint32LE(); - header.unknown2 = stream->readUint32LE(); - header.filesPerBlock = stream->readUint32LE(); - header.fileCount = stream->readUint32LE(); - header.xorKey = stream->readUint32LE(); - header.fileSectionOffset = stream->readUint32LE(); + _header.magic = stream->readUint32LE(); + _header.unknown1 = stream->readUint32LE(); + _header.maxNameLength = stream->readUint32LE(); + _header.filesPerBlock = stream->readUint32LE(); + _header.fileCount = stream->readUint32LE(); + _header.xorKey[0] = stream->readByte(); + _header.xorKey[1] = stream->readByte(); + _header.xorKey[2] = stream->readByte(); + _header.xorKey[3] = stream->readByte(); + _header.fileSectionOffset = stream->readUint32LE(); uint32 nextOffset; @@ -73,7 +74,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { nextOffset = stream->readUint32LE(); // Read in each entry header - for (int i = 0; i < header.filesPerBlock; i++) { + for (int i = 0; i < _header.filesPerBlock; i++) { ZfsEntryHeader entryHeader; entryHeader.name = readEntryName(stream); @@ -135,10 +136,18 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common:: byte* buffer = new byte[entryHeader->size]; zfsArchive.read(buffer, entryHeader->size); + // Decrypt the data in place + if (_header.xorKey != 0) + unXor(buffer, entryHeader->size, _header.xorKey); return new Common::MemoryReadStream(buffer, entryHeader->size, DisposeAfterUse::YES); } +void ZfsArchive::unXor(byte *buffer, int length, const byte *xorKey) const { + for (uint32 i = 0; i < length; i++) + buffer[i] ^= xorKey[i % 4]; +} + } // End namespace ZVision diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfsArchive.h index 96c002f815d3..718b26c836af 100644 --- a/engines/zvision/zfsArchive.h +++ b/engines/zvision/zfsArchive.h @@ -32,10 +32,10 @@ namespace ZVision { struct ZfsHeader { uint32 magic; uint32 unknown1; - uint32 unknown2; + uint32 maxNameLength; uint32 filesPerBlock; uint32 fileCount; - uint32 xorKey; + byte xorKey[4]; uint32 fileSectionOffset; }; @@ -85,10 +85,34 @@ class ZfsArchive : public Common::Archive { private: const Common::String _fileName; + ZfsHeader _header; ZfsEntryHeaderMap _entryHeaders; + /** + * Parses the zfs file into file entry headers that can be used later + * to get the entry data. + * + * @param stream The contents of the zfs file + */ void readHeaders(Common::SeekableReadStream *stream); + + /** + * Entry names are contained within a 16 byte block. This reads the block + * and converts it the name to a Common::String + * + * @param stream The zfs file stream + * @return The entry file name + */ Common::String readEntryName(Common::SeekableReadStream *stream) const; + + /** + * ZFS file entries can be encrypted using XOR encoding. This method + * decodes the buffer in place using the supplied xorKey. + * + * @param buffer The data to decode + * @param length Length of buffer + */ + void unXor(byte *buffer, int length, const byte *xorKey) const; }; } // End of namespace Common From b65fd98441cadecc44b6e8e06aa2558a282d33c7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 19 Jun 2013 13:59:25 -0500 Subject: [PATCH 0254/1332] ZVISION: Clean up includes --- engines/zvision/zfsArchive.cpp | 4 +++- engines/zvision/zork_avi_decoder.cpp | 2 ++ engines/zvision/zork_raw.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zfsArchive.cpp b/engines/zvision/zfsArchive.cpp index 59e65f171395..93a026e5b9a2 100644 --- a/engines/zvision/zfsArchive.cpp +++ b/engines/zvision/zfsArchive.cpp @@ -20,7 +20,9 @@ * */ -#include "zfsArchive.h" +#include "common/scummsys.h" + +#include "zvision/zfsArchive.h" #include "common/hashmap.h" #include "common/memstream.h" #include "common/debug.h" diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp index b0524c7d2f3a..2da524655be3 100644 --- a/engines/zvision/zork_avi_decoder.cpp +++ b/engines/zvision/zork_avi_decoder.cpp @@ -21,6 +21,8 @@ * */ +#include "common/scummsys.h" + #include "common/stream.h" #include "audio/audiostream.h" diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 9332aeb52e25..3c37f929b3e0 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -20,6 +20,8 @@ * */ +#include "common/scummsys.h" + #include "common/endian.h" #include "common/memstream.h" #include "common/textconsole.h" From 160d6256f2f391f37bd02c5c060f5db33db2a2f0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 19 Jun 2013 14:12:03 -0500 Subject: [PATCH 0255/1332] ZVISION: Create skeleton engine and move code away from Engine::Run The goal is to have Engine::Run as clean as possible. Aka mostly method calls. --- engines/zvision/events.cpp | 88 ++++++++++++ engines/zvision/graphics.cpp | 37 +++++ engines/zvision/scriptManager.h | 42 ++++++ engines/zvision/scripts.cpp | 31 ++++ engines/zvision/video.cpp | 185 ++++++++++++++++++++++++ engines/zvision/zvision.cpp | 245 +++++++------------------------- engines/zvision/zvision.h | 30 +++- 7 files changed, 461 insertions(+), 197 deletions(-) create mode 100644 engines/zvision/events.cpp create mode 100644 engines/zvision/graphics.cpp create mode 100644 engines/zvision/scriptManager.h create mode 100644 engines/zvision/scripts.cpp create mode 100644 engines/zvision/video.cpp diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp new file mode 100644 index 000000000000..8d10485ddf4e --- /dev/null +++ b/engines/zvision/events.cpp @@ -0,0 +1,88 @@ +/* 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/scummsys.h" + +#include "zvision.h" +#include "common/EventRecorder.h" + + +namespace ZVision { + +void ZVision::processEvents() { + while (_eventMan->pollEvent(_event)) { + switch (_event.type) { + case Common::EVENT_LBUTTONDOWN: + onMouseDown(_event.mouse); + break; + + case Common::EVENT_LBUTTONUP: + break; + + case Common::EVENT_RBUTTONDOWN: + break; + + case Common::EVENT_MOUSEMOVE: + onMouseMove(_event.mouse); + break; + + case Common::EVENT_KEYDOWN: + switch (_event.kbd.keycode) { + case Common::KEYCODE_d: + if (_event.kbd.hasFlags(Common::KBD_CTRL)) { + // Start the debugger + getDebugger()->attach(); + getDebugger()->onFrame(); + } + break; + + case Common::KEYCODE_q: + if (_event.kbd.hasFlags(Common::KBD_CTRL)) + quitGame(); + break; + + default: + break; + } + + onKeyDown(_event.kbd.keycode); + break; + + default: + break; + } + } +} + +void ZVision::onMouseDown(const Common::Point &pos) { + +} + +void ZVision::onMouseMove(const Common::Point &pos) { + +} + +void ZVision::onKeyDown(uint16 keyCode) { + +} + +} // End of namespace ZVision diff --git a/engines/zvision/graphics.cpp b/engines/zvision/graphics.cpp new file mode 100644 index 000000000000..17e7a4f06b13 --- /dev/null +++ b/engines/zvision/graphics.cpp @@ -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. + * + */ + +#include "common/scummsys.h" + +#include "zvision/zvision.h" + +namespace ZVision { + +void ZVision::updateScripts() { + +} + +void ZVision::updateAnimations(uint32 detaTimeMillis) { + +} + +} // End namespace ZVision diff --git a/engines/zvision/scriptManager.h b/engines/zvision/scriptManager.h new file mode 100644 index 000000000000..a6c9f2b57c4c --- /dev/null +++ b/engines/zvision/scriptManager.h @@ -0,0 +1,42 @@ +/* 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 ZVISION_SCRIPT_MANAGER_H +#define ZVISION_SCRIPT_MANAGER_H + +#include "common/hashmap.h" + +namespace ZVision { + +class ScriptManager { +public: + ScriptManager(); + ~ScriptManager(); + +private: + Common::HashMap _globalState; +}; + + +} // End namespace ZVision + +#endif diff --git a/engines/zvision/scripts.cpp b/engines/zvision/scripts.cpp new file mode 100644 index 000000000000..40bad8f3a184 --- /dev/null +++ b/engines/zvision/scripts.cpp @@ -0,0 +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. + * + */ + +#include "common/scummsys.h" + +#include "zvision/zvision.h" + +namespace ZVision { + + + +} // End namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp new file mode 100644 index 000000000000..ce686839e8db --- /dev/null +++ b/engines/zvision/video.cpp @@ -0,0 +1,185 @@ +/* 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/scummsys.h" +#include "common/system.h" + +#include "engines/engine.h" +#include "graphics/decoders/tga.h" + +#include "zvision/zork_avi_decoder.h" +#include "zvision/zork_raw.h" + +#include "common/EventRecorder.h" +#include "common/file.h" + +namespace ZVision { + +// Taken from SCI +void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel) { + assert(bytesPerPixel == 1 || bytesPerPixel == 2); + const int newWidth = srcWidth * 2; + const int pitch = newWidth * bytesPerPixel; + const byte *srcPtr = src; + + if (bytesPerPixel == 1) { + for (int y = 0; y < srcHeight; y++) { + for (int x = 0; x < srcWidth; x++) { + const byte color = *srcPtr++; + dst[0] = color; + dst[1] = color; + dst[newWidth] = color; + dst[newWidth + 1] = color; + dst += 2; + } + dst += newWidth; + } + } else if (bytesPerPixel == 2) { + for (int y = 0; y < srcHeight; y++) { + for (int x = 0; x < srcWidth; x++) { + const byte color = *srcPtr++; + const byte color2 = *srcPtr++; + dst[0] = color; + dst[1] = color2; + dst[2] = color; + dst[3] = color2; + dst[pitch] = color; + dst[pitch + 1] = color2; + dst[pitch + 2] = color; + dst[pitch + 3] = color2; + dst += 4; + } + dst += pitch; + } + } +} + +void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { + if (!videoDecoder) + return; + + videoDecoder->start(); + + byte *scaleBuffer = 0; + byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; + uint16 width = videoDecoder->getWidth(); + uint16 height = videoDecoder->getHeight(); + uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; + uint16 screenWidth = 640;//g_sci->_gfxScreen->getDisplayWidth(); + uint16 screenHeight = 480;//g_sci->_gfxScreen->getDisplayHeight(); + + bool zoom2x = true; + + if (zoom2x) { + width *= 2; + height *= 2; + pitch *= 2; + scaleBuffer = new byte[width * height * bytesPerPixel]; + } + + uint16 x, y; + + x = (screenWidth - width) / 2; + y = (screenHeight - height) / 2; + + bool skipVideo = false; + + while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + if (videoDecoder->needsUpdate()) { + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + + if (frame) { + if (scaleBuffer) { + scale2x((byte *)frame->pixels, 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->updateScreen(); + } + } + + Common::Event event; + while (g_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + g_system->delayMillis(10); + } + + delete[] scaleBuffer; + delete videoDecoder; +} + +void tests() { +#if 0 + // Video test + Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); + if (videoDecoder && videoDecoder->loadFile("zassets/temple/t000a11c.avi")) { + Common::List formats; + formats.push_back(videoDecoder->getPixelFormat()); + //initGraphics(640, 480, true, formats); + + playVideo(videoDecoder); + } +#endif + + Common::File f; + +#if 0 + // Image test + + //initGraphics(640, 480, true, &format); + + if (f.open("zassets/castle/cb8eb11c.tga")) { + Graphics::TGADecoder tga; + if (!tga.loadStream(f)) + error("Error while reading TGA image"); + f.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + Graphics::Surface *screen = g_system->lockScreen(); + for (uint16 y = 0; y < tgaSurface->h; y++) + memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); + g_system->unlockScreen(); + + tga.destroy(); + } + + +#endif + +#if 0 + // Sound test + if (f.open("zassets/castle/c000h9tc.raw")) { + Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); + Audio::SoundHandle handle; + g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + } + +#endif +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index b347782f59c7..2cc0b471136a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -1,29 +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. + * + */ + #include "common/scummsys.h" - + #include "common/config-manager.h" #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" +#include "common/system.h" #include "common/file.h" -#include "common/fs.h" - -#include "audio/audiostream.h" -#include "audio/mixer.h" - -#include "graphics/palette.h" -#include "graphics/surface.h" -#include "graphics/decoders/tga.h" - -#include "video/video_decoder.h" -#include "video/avi_decoder.h" #include "engines/util.h" #include "zvision/zvision.h" #include "zvision/zfsArchive.h" -#include "zvision/zork_avi_decoder.h" -#include "zvision/zork_raw.h" + +#include "graphics/decoders/tga.h" namespace ZVision { @@ -36,9 +47,9 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine // However this is the place to specify all default directories const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "data1"); - SearchMan.addSubDirectoryMatching(gameDataDir, "data2"); - SearchMan.addSubDirectoryMatching(gameDataDir, "data3"); + SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4); + SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4); + SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4); SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx"); SearchMan.addSubDirectoryMatching(gameDataDir, "znemscr"); @@ -62,109 +73,12 @@ ZVision::~ZVision() { DebugMan.clearAllDebugChannels(); } -// Taken from SCI -void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel) { - assert(bytesPerPixel == 1 || bytesPerPixel == 2); - const int newWidth = srcWidth * 2; - const int pitch = newWidth * bytesPerPixel; - const byte *srcPtr = src; - - if (bytesPerPixel == 1) { - for (int y = 0; y < srcHeight; y++) { - for (int x = 0; x < srcWidth; x++) { - const byte color = *srcPtr++; - dst[0] = color; - dst[1] = color; - dst[newWidth] = color; - dst[newWidth + 1] = color; - dst += 2; - } - dst += newWidth; - } - } else if (bytesPerPixel == 2) { - for (int y = 0; y < srcHeight; y++) { - for (int x = 0; x < srcWidth; x++) { - const byte color = *srcPtr++; - const byte color2 = *srcPtr++; - dst[0] = color; - dst[1] = color2; - dst[2] = color; - dst[3] = color2; - dst[pitch] = color; - dst[pitch + 1] = color2; - dst[pitch + 2] = color; - dst[pitch + 3] = color2; - dst += 4; - } - dst += pitch; - } - } -} - -void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { - if (!videoDecoder) - return; - - videoDecoder->start(); - - byte *scaleBuffer = 0; - byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; - uint16 width = videoDecoder->getWidth(); - uint16 height = videoDecoder->getHeight(); - uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; - uint16 screenWidth = 640;//g_sci->_gfxScreen->getDisplayWidth(); - uint16 screenHeight = 480;//g_sci->_gfxScreen->getDisplayHeight(); - - bool zoom2x = true; - - if (zoom2x) { - width *= 2; - height *= 2; - pitch *= 2; - scaleBuffer = new byte[width * height * bytesPerPixel]; - } - - uint16 x, y; - - x = (screenWidth - width) / 2; - y = (screenHeight - height) / 2; - - bool skipVideo = false; - - while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { - if (videoDecoder->needsUpdate()) { - const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); - - if (frame) { - if (scaleBuffer) { - scale2x((byte *)frame->pixels, 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->updateScreen(); - } - } - - Common::Event event; - while (g_system->getEventManager()->pollEvent(event)) { - if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) - skipVideo = true; - } - - g_system->delayMillis(10); - } - - delete[] scaleBuffer; - delete videoDecoder; -} - Common::Error ZVision::run() { - // Register the files within the zfs archive files with the SearchMan + // Find zfs archive files Common::ArchiveMemberList list; SearchMan.listMatchingMembers(list, "*.zfs"); + // Register the file entries within the zfs archives with the SearchMan for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { Common::String name = (*iter)->getName(); ZfsArchive *archive = new ZfsArchive(name, (*iter)->createReadStream()); @@ -178,86 +92,35 @@ Common::Error ZVision::run() { // Create debugger console. It requires GFX to be initialized _console = new Console(this); - - // Additional setup. - debug("ZVision::init"); - - // Your main even loop should be (invoked from) here. - debug("ZVision::go: Hello, World!"); - - // This test will show up if -d1 and --debugflags=example are specified on the commandline - //debugC(1, kZVisionDebugExample, "Example debug call"); - - // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline - //debugC(3, kZVisionDebugExample | kZVisionDebugExample2, "Example debug call two"); - - Common::File file; - - if (file.open("ADLIB.MDI")) { - file.close(); - } - - - -#if 1 - // Video test - Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); - if (videoDecoder && videoDecoder->loadFile("ZASSETS/TEMPLE/T000A11C.AVI")) { - Common::List formats; - formats.push_back(videoDecoder->getPixelFormat()); - initGraphics(640, 480, true, formats); - - playVideo(videoDecoder); - } -#endif - - Common::File f; - -#if 1 - // Image test - - initGraphics(640, 480, true, &format); - - if (f.open("zassets/castle/CB8EB11C.TGA")) { - Graphics::TGADecoder tga; - if (!tga.loadStream(f)) - error("Error while reading TGA image"); - f.close(); - - const Graphics::Surface *tgaSurface = tga.getSurface(); - - Graphics::Surface *screen = g_system->lockScreen(); - for (uint16 y = 0; y < tgaSurface->h; y++) - memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); - g_system->unlockScreen(); - - tga.destroy(); - } - - -#endif - -#if 1 - // Sound test - if (f.open("zassets/castle/C000H9TC.RAW")) { - Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); - Audio::SoundHandle handle; - g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); - } - -#endif // Main loop - Common::EventManager *eventMan = g_system->getEventManager(); - Common::Event event; + uint32 currentTime = _system->getMillis(); + uint32 lastTime = currentTime; + const uint32 desiredFrameTime = 33; // ~30 fps while (!shouldQuit()) { - eventMan->pollEvent(event); // eat events - g_system->updateScreen(); - g_system->delayMillis(10); + processEvents(); + + currentTime = _system->getMillis(); + uint32 deltaTime = currentTime - lastTime; + lastTime = currentTime; + + updateScripts(); + updateAnimations(deltaTime); + + if (_needsScreenUpdate) + { + _system->updateScreen(); + } + + // Calculate the frame delay based off a desired frame rate + int delay = desiredFrameTime - (currentTime - _system->getMillis()); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); } return Common::kNoError; } - + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index c2a42f1e21c2..b4664d0e2925 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -23,9 +23,12 @@ #ifndef ZVISION_H #define ZVISION_H - + #include "common/random.h" +#include "common/events.h" + #include "engines/engine.h" + #include "gui/debugger.h" namespace ZVision { @@ -45,17 +48,32 @@ class ZVision : public Engine { public: ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); ~ZVision(); - - uint32 getFeatures() const; - Common::Language getLanguage() const; - virtual Common::Error run(); - + private: Console *_console; const ZVisionGameDescription *_gameDescription; // We need random numbers Common::RandomSource *_rnd; + + // To prevent allocation every time we process events + Common::Event _event; + + bool _needsScreenUpdate; + +public: + uint32 getFeatures() const; + Common::Language getLanguage() const; + virtual Common::Error run(); + +private: + void processEvents(); + void onMouseDown(const Common::Point &pos); + void onMouseMove(const Common::Point &pos); + void onKeyDown(uint16 keyCode); + + void updateScripts(); + void updateAnimations(uint32 detaTimeMillis); }; // Example console class From a8980a4f771ae0ca926c9f38ee4d2e031c29318d Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 19 Jun 2013 15:45:48 -0500 Subject: [PATCH 0256/1332] ZVISION: Create utility function that writes File contents to another File scr files are stored and encrypted in archive files. This is an easy way to dump them for debugging purposes. --- engines/zvision/utility.h | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 engines/zvision/utility.h diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h new file mode 100644 index 000000000000..15f9490a4bda --- /dev/null +++ b/engines/zvision/utility.h @@ -0,0 +1,50 @@ +/* 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 ZVISION_UTILITY_H +#define ZVISION_UTILITY_H + +#include "common/str.h" +#include "common/file.h" + +namespace ZVision { + +void WriteFileContentsToFile(Common::String sourceFile, Common::String destFile) { + Common::File f; + f.open(sourceFile); + byte* buffer = new byte[f.size()]; + f.read(buffer, f.size()); + + Common::DumpFile dumpFile; + dumpFile.open(destFile); + + uint32 writtenBytes = dumpFile.write(buffer, f.size()); + dumpFile.flush(); + dumpFile.close(); + + delete[] buffer; +} + +} // End namespace ZVision + +#endif From f444a1fd38329e77624ecd10c753d6b5ce6edf94 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 00:31:14 -0500 Subject: [PATCH 0257/1332] ZVISION: Create Object class. --- engines/zvision/object.cpp | 371 +++++++++++++++++++++++++++++++++++++ engines/zvision/object.h | 121 ++++++++++++ 2 files changed, 492 insertions(+) create mode 100644 engines/zvision/object.cpp create mode 100644 engines/zvision/object.h diff --git a/engines/zvision/object.cpp b/engines/zvision/object.cpp new file mode 100644 index 000000000000..253eaf7ace2a --- /dev/null +++ b/engines/zvision/object.cpp @@ -0,0 +1,371 @@ +/* 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/scummsys.h" +#include "common/textconsole.h" + +#include "zvision/object.h" + +namespace ZVision { + +Object::Object(ObjectType type) { + _objectType = type; + + switch (type) { + case BOOL: + _value.boolVal = new bool; + break; + case BYTE: + _value.byteVal = new byte; + break; + case INT16: + _value.int16Val = new int16; + break; + case UINT16: + _value.uint16Val = new uint16; + break; + case INT32: + _value.int32Val = new int32; + break; + case UINT32: + _value.uint32Val = new uint32; + break; + case FLOAT: + _value.floatVal = new float; + break; + case DOUBLE: + _value.doubleVal = new double; + break; + case STRING: + _value.stringVal = new Common::String; + break; + } +} + +Object::Object(bool value) : _objectType(BOOL) { + _value.boolVal = new bool(value); +} + +Object::Object(byte value) : _objectType(BYTE) { + _value.byteVal = new byte(value); +} + +Object::Object(int16 value) : _objectType(INT16) { + _value.int16Val = new int16(value); +} + +Object::Object(uint16 value) : _objectType(UINT16) { + _value.uint16Val = new uint16(value); +} + +Object::Object(int32 value) : _objectType(INT32) { + _value.int32Val = new int32(value); +} + +Object::Object(uint32 value) : _objectType(UINT32) { + _value.uint32Val = new uint32(value); +} + +Object::Object(float value) : _objectType(FLOAT) { + _value.floatVal = new float(value); +} + +Object::Object(double value) : _objectType(DOUBLE) { + _value.doubleVal = new double(value); +} + +Object::Object(Common::String value) : _objectType(BYTE) { + _value.stringVal = new Common::String(value); +} + +Object::Object(const Object& other) { + _objectType = other._objectType; + + switch (_objectType) { + case BOOL: + _value.boolVal = new bool(*other._value.boolVal); + break; + case BYTE: + _value.byteVal = new byte(*other._value.byteVal); + break; + case INT16: + _value.int16Val = new int16(*other._value.int16Val); + break; + case UINT16: + _value.uint16Val = new uint16(*other._value.uint16Val); + break; + case INT32: + _value.int32Val = new int32(*other._value.int32Val); + break; + case UINT32: + _value.uint32Val = new uint32(*other._value.uint32Val); + break; + case FLOAT: + _value.floatVal = new float(*other._value.floatVal); + break; + case DOUBLE: + _value.doubleVal = new double(*other._value.doubleVal); + break; + case STRING: + _value.stringVal = new Common::String(*other._value.stringVal); + break; + } +} + +Object::~Object() { + deleteValue(); +} + +void Object::deleteValue() { + // Call delete on the correct part of the union. + // Even though they all point to the same memory and will all be cast + // to a void *, compiler optimizations could cause undefined behavior. + switch (_objectType) { + case BOOL: + delete _value.boolVal; + break; + case BYTE: + delete _value.byteVal; + break; + case INT16: + delete _value.int16Val; + break; + case UINT16: + delete _value.uint16Val; + break; + case INT32: + delete _value.int32Val; + break; + case UINT32: + delete _value.uint32Val; + break; + case FLOAT: + delete _value.floatVal; + break; + case DOUBLE: + delete _value.doubleVal; + break; + case STRING: + delete _value.stringVal; + break; + } +} + + +Object& Object::operator=(const bool& rhs) { + if (_objectType == BOOL) + *_value.boolVal = rhs; + else { + deleteValue(); + _objectType = BOOL; + _value.boolVal = new bool(rhs); + } + + return *this; +} + +Object& Object::operator=(const byte& rhs) { + if (_objectType == BYTE) + *_value.byteVal = rhs; + else { + deleteValue(); + _objectType = BYTE; + _value.byteVal = new byte(rhs); + } + + return *this; +} + +Object& Object::operator=(const int16& rhs) { + if (_objectType == INT16) + *_value.int16Val = rhs; + else { + deleteValue(); + _objectType = INT16; + _value.int16Val = new int16(rhs); + } + + return *this; +} + +Object& Object::operator=(const uint16& rhs) { + if (_objectType == UINT16) + *_value.uint16Val = rhs; + else { + deleteValue(); + _objectType = UINT16; + _value.uint16Val = new uint16(rhs); + } + + return *this; +} + +Object& Object::operator=(const int32& rhs) { + if (_objectType == INT32) + *_value.int32Val = rhs; + else { + deleteValue(); + _objectType = INT32; + _value.int32Val = new int32(rhs); + } + + return *this; +} + +Object& Object::operator=(const uint32& rhs) { + if (_objectType == UINT32) + *_value.uint32Val = rhs; + else { + deleteValue(); + _objectType = UINT32; + _value.uint32Val = new uint32(rhs); + } + + return *this; +} + +Object& Object::operator=(const float& rhs) { + if (_objectType == FLOAT) + *_value.floatVal = rhs; + else { + deleteValue(); + _objectType = FLOAT; + _value.floatVal = new float(rhs); + } + + return *this; +} + +Object& Object::operator=(const double& rhs) { + if (_objectType == DOUBLE) + *_value.doubleVal = rhs; + else { + deleteValue(); + _objectType = DOUBLE; + _value.doubleVal = new double(rhs); + } + + return *this; +} + +Object& Object::operator=(const Common::String& rhs) { + if (_objectType == STRING) + *_value.stringVal = rhs; + else { + deleteValue(); + _objectType = STRING; + _value.stringVal = new Common::String(rhs); + } + + return *this; +} + +Object& Object::operator=(const Object& rhs) { + switch (_objectType) { + case BOOL: + return operator=(*rhs._value.boolVal); + case BYTE: + return operator=(*rhs._value.byteVal); + case INT16: + return operator=(*rhs._value.int16Val); + case UINT16: + return operator=(*rhs._value.uint16Val); + case INT32: + return operator=(*rhs._value.int32Val); + case UINT32: + return operator=(*rhs._value.uint32Val); + case FLOAT: + return operator=(*rhs._value.floatVal); + case DOUBLE: + return operator=(*rhs._value.doubleVal); + case STRING: + return operator=(*rhs._value.stringVal); + } + + return *this; +} + + +Object::operator bool() { + if (_objectType != BOOL) + warning("'Object' not of type bool. Bad cast"); + + return *_value.boolVal; +} + +Object::operator byte() { + if (_objectType != BYTE) + warning("'Object' not of type byte. Bad cast"); + + return *_value.byteVal; +} + +Object::operator int16() { + if (_objectType != INT16) + warning("'Object' not of type int16. Bad cast"); + + return *_value.int16Val; +} + +Object::operator uint16() { + if (_objectType != UINT16) + warning("'Object' not of type uint16. Bad cast"); + + return *_value.uint16Val; +} + +Object::operator int32() { + if (_objectType != INT32) + warning("'Object' not of type int32. Bad cast"); + + return *_value.int32Val; +} + +Object::operator uint32() { + if (_objectType != UINT32) + warning("'Object' not of type uint32. Bad cast"); + + return *_value.uint32Val; +} + +Object::operator float() { + if (_objectType != FLOAT) + warning("'Object' not of type float. Bad cast"); + + return *_value.floatVal; +} + +Object::operator double() { + if (_objectType != DOUBLE) + warning("'Object' not of type double. Bad cast"); + + return *_value.doubleVal; +} + +Object::operator Common::String() { + if (_objectType != STRING) + warning("'Object' not of type Common::String. Bad cast"); + + return *_value.stringVal; +} + +} // End namespace ZVision diff --git a/engines/zvision/object.h b/engines/zvision/object.h new file mode 100644 index 000000000000..02ca96223944 --- /dev/null +++ b/engines/zvision/object.h @@ -0,0 +1,121 @@ +/* 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 ZVISION_OBJECT_H +#define ZVISION_OBJECT_H + +#include "common/str.h" + +namespace ZVision { + + +enum ObjectType { + BOOL, + BYTE, + INT16, + UINT16, + INT32, + UINT32, + FLOAT, + DOUBLE, + STRING, +}; + +/** + * A generic single value storage class. It is useful for storing different + * value types in a single List, Hashmap, etc. + * + * Mimics C#'s Object class + * + * Caution: The actual value is stored on the heap, so be careful creating + * many objects of this class. Also, when re-using 'Object', try to assign + * a value of the same type as before, as this will prevent an extra memory allocation. + */ +class Object { +public: + // Constructors + Object(ObjectType type); + Object(bool value); + Object(byte value); + Object(int16 value); + Object(uint16 value); + Object(int32 value); + Object(uint32 value); + Object(float value); + Object(double value); + Object(Common::String value); + + // Copy constructor + Object(const Object& other); + + // Destructor + ~Object(); + +private: + ObjectType _objectType; + + union { + bool *boolVal; + byte *byteVal; + int16 *int16Val; + uint16 *uint16Val; + int32 *int32Val; + uint32 *uint32Val; + float *floatVal; + double *doubleVal; + Common::String *stringVal; + } _value; + +public: + Object& operator=(const bool& rhs); + Object& operator=(const byte& rhs); + Object& operator=(const int16& rhs); + Object& operator=(const uint16& rhs); + Object& operator=(const int32& rhs); + Object& operator=(const uint32& rhs); + Object& operator=(const float& rhs); + Object& operator=(const double& rhs); + Object& operator=(const Common::String& rhs); + + Object& operator=(const Object& rhs); + + operator bool(); + operator byte(); + operator int16(); + operator uint16(); + operator int32(); + operator uint32(); + operator float(); + operator double(); + operator Common::String(); + +private: + /** + * Helper method for destruction and assignment. Calls delete on + * the currently used data pointer + */ + void deleteValue(); +}; + +} // End namespace ZVision + +#endif From 2ada5a8dd7d953d35ddb8ad56a6827cc95daa1cb Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 00:43:57 -0500 Subject: [PATCH 0258/1332] ZVISION: Split puzzleControl into two files. Add ResultAction enum After further investigation, puzzles and controls don't really share any structs. So it makes more sense to keep them seperate. --- engines/zvision/control.h | 37 ++++++++++++ engines/zvision/puzzle.h | 119 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 engines/zvision/control.h create mode 100644 engines/zvision/puzzle.h diff --git a/engines/zvision/control.h b/engines/zvision/control.h new file mode 100644 index 000000000000..46a72117022c --- /dev/null +++ b/engines/zvision/control.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. + * + */ + +#ifndef ZVISION_CONTROL_H +#define ZVISION_CONTROL_H + +#include "common/scummsys.h" + +namespace ZVision { + +struct Control { + uint16 id; + +}; + +} // End namespace ZVision + +#endif diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h new file mode 100644 index 000000000000..cb44a440e1a2 --- /dev/null +++ b/engines/zvision/puzzle.h @@ -0,0 +1,119 @@ +/* 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 ZVISION_PUZZLE_H +#define ZVISION_PUZZLE_H + +#include "common/list.h" + +#include "zvision/object.h" + +namespace ZVision { + +/** How criteria should be decided */ +enum CriteriaOperator { + EQUAL_TO, + NOT_EQUAL_TO, + GREATER_THAN, + LESS_THAN +}; + +/** Criteria for a Puzzle result to be fired */ +struct Criteria { + /** The id of a global state */ + uint32 id; + /** + * What we're comparing the value of the global state against + * This can either be a pure value or it can be the id of another global state + */ + uint32 argument; + /** How to do the comparison */ + CriteriaOperator criteriaOperator; + /** Is 'argument' the id of a global state or a pure value */ + bool argumentIsAnId; +}; + +/** What happens when Puzzle criteria are met */ +enum ResultAction { + ADD, + ANIM_PLAY, + ANIM_PRELOAD, + ANIM_UNLOAD, + ATTENUATE, + ASSIGN, + CHANGE_LOCATION, + CROSSFADE, + DEBUG, + DELAY_RENDER, + DISABLE_CONTROL, + DISABLE_VENUS, + DISPLAY_MESSAGE, + DISSOLVE, + DISTORT, + ENABLE_CONTROL, + FLUSH_MOUSE_EVENTS, + INVENTORY, + KILL, + MENU_BAR_ENABLE, + MUSIC, + PAN_TRACK, + PLAY_PRELOAD, + PREFERENCES, + QUIT, + RANDOM, + REGION, + RESTORE_GAME, + ROTATE_TO, + SAVE_GAME, + SET_PARTIAL_SCREEN, + SET_SCREEN, + SET_VENUS, + STOP, + STREAM_VIDEO, + SYNC_SOUND, + TIMER, + TTY_TEXT, + UNIVERSE_MUSIC, +}; + +/** What happens when Puzzle criteria are met */ +struct Result { + ResultAction action; + Common::List arguments; +}; + +enum StateFlags : byte { + ONCE_PER_INST = 0x01, + DO_ME_NOW = 0x02, + DISABLED = 0x04 +}; + +struct Puzzle { + uint32 id; + Common::List criteriaList; + Common::List resultList; + byte flags; +}; + +} + +#endif From 8243263b33fe7aaf4e1144104f1189cd03636ff0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 00:46:27 -0500 Subject: [PATCH 0259/1332] ZVISION: Add documentation to utility functions and add a glorified trim function --- engines/zvision/utility.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 15f9490a4bda..0777ba9ebc5b 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -29,7 +29,14 @@ namespace ZVision { -void WriteFileContentsToFile(Common::String sourceFile, Common::String destFile) { +/** + * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the + * contents to destFile. destFile is created in the working directory + * + * @param sourceFile The 'file' you want the contents of + * @param destFile The name of the file where the content will be written to + */ +void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) { Common::File f; f.open(sourceFile); byte* buffer = new byte[f.size()]; @@ -45,6 +52,23 @@ void WriteFileContentsToFile(Common::String sourceFile, Common::String destFile) delete[] buffer; } +/** + * Removes any line comments using '#' as a sequence start. + * Then removes any trailing and leading 'whitespace'. + * Uses isspace() to determine what is whitespace and what is not. + * + * @param string The string to modify. It is modified in place + */ +void trimCommentsAndWhiteSpace(Common::String &string) { + for (int i = string.size(); i >= 0; --i) { + if (string[i] == '#') { + string.erase(i); + } + } + + string.trim(); +} + } // End namespace ZVision #endif From 75e513c46ca086a7047e906af7d4e9bd5d52c5c7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 00:57:07 -0500 Subject: [PATCH 0260/1332] ZVISION: Create base puzzle parsing. --- engines/zvision/scrFileHandling.cpp | 325 ++++++++++++++++++++++++++++ engines/zvision/scriptManager.h | 62 ++++++ 2 files changed, 387 insertions(+) create mode 100644 engines/zvision/scrFileHandling.cpp diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scrFileHandling.cpp new file mode 100644 index 000000000000..f4b5bab6fb8d --- /dev/null +++ b/engines/zvision/scrFileHandling.cpp @@ -0,0 +1,325 @@ +/* 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/scummsys.h" + +#include + +#include "zvision/scriptManager.h" +#include "zvision/utility.h" + +#include "common/textconsole.h" +#include "common/file.h" +#include "common/tokenizer.h" + +namespace ZVision { + + +void ScriptManager::parseScrFile(Common::String fileName) { + Common::File file; + if (!file.open(fileName)) + return; // File.open already throws a warning if the file doesn't exist, so there is no need to throw another + + char buffer[1024]; + while(!file.eos()) { + Common::String line = file.readLine(); + if (file.err()) { + warning("Error parsing scr file: %s", fileName); + return; + } + + trimCommentsAndWhiteSpace(line); + if (line.empty()) + continue; + + if (line.matchString("puzzle:*", true)) { + Puzzle *puzzle = new Puzzle(); + sscanf(line.c_str(),"puzzle:%u",&(puzzle->id)); + + parsePuzzle(puzzle, file); + } else if (line.matchString("control:*", true)) { + Control *control = new Control(); + sscanf(line.c_str(),"control:%u",&(control->id)); + + parseControl(control, file); + } + } +} + +void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream) { + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + + while (!line.contains('}')) { + if (line.matchString("criteria {", true)) + puzzle->criteriaList.push_back(parseCriteria(stream)); + else if (line.matchString("results {", true)) + puzzle->resultList.push_back(parseResult(stream)); + else if (line.matchString("flags {", true)) + puzzle->flags = parseFlags(stream); + } + +} + +Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const { + Criteria criteria; + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + + while (!line.contains('}')) { + // Split the string into tokens using ' ' as a delimiter + Common::StringTokenizer tokenizer(line); + Common::String token; + + // Parse the id out of the first token + token = tokenizer.nextToken(); + sscanf(token.c_str(), "[%u]", &(criteria.id)); + + // Parse the operator out of the second token + token = tokenizer.nextToken(); + if (token.c_str()[0] == '=') + criteria.criteriaOperator = EQUAL_TO; + else if (token.c_str()[0] == '!') + criteria.criteriaOperator = NOT_EQUAL_TO; + else if (token.c_str()[0] == '>') + criteria.criteriaOperator = GREATER_THAN; + else if (token.c_str()[0] == '<') + criteria.criteriaOperator = LESS_THAN; + + // First determine if the last token is an id or a value + // Then parse it into 'argument' + token = tokenizer.nextToken(); + if (token.contains('[')) { + sscanf(token.c_str(), "[%u]", &(criteria.argument)); + criteria.argumentIsAnId = true; + } else { + sscanf(token.c_str(), "%u", &(criteria.argument)); + criteria.argumentIsAnId = false; + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + } + + return criteria; +} + +Result ScriptManager::parseResult(Common::SeekableReadStream &stream) const { + Result result; + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + + while (!line.contains('}')) { + Common::StringTokenizer tokenizer(line, " :(),"); + // We don't care about the first token + tokenizer.nextToken(); + Common::String token = tokenizer.nextToken(); + + // The second token defines the action + // Use it to set the action enum and then to parse the arguments + if (token.matchString("add", true)) { + result.action = ADD; + ObjectType argTypes[] = { UINT32, UINT32 }; + parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); + } else if (token.matchString("animplay", true)) { + result.action = ANIM_PLAY; + + } else if (token.matchString("animpreload", true)) { + result.action = ANIM_PRELOAD; + + } else if (token.matchString("animunload", true)) { + result.action = ANIM_UNLOAD; + + } else if (token.matchString("attenuate", true)) { + result.action = ATTENUATE; + + } else if (token.matchString("assign", true)) { + result.action = ASSIGN; + ObjectType argTypes[] = { UINT32, UINT32 }; + parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); + } else if (token.matchString("change_location", true)) { + result.action = CHANGE_LOCATION; + ObjectType argTypes[] = { STRING, STRING, STRING, UINT32 }; + parseResultArguments(result, argTypes, 4, tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken()); + } else if (token.matchString("crossfade", true)) { + result.action = CROSSFADE; + + } else if (token.matchString("debug", true)) { + result.action = DEBUG; + + } else if (token.matchString("delay_render", true)) { + result.action = DELAY_RENDER; + + } else if (token.matchString("disable_control", true)) { + result.action = DISABLE_CONTROL; + + } else if (token.matchString("disable_venus", true)) { + result.action = DISABLE_VENUS; + + } else if (token.matchString("display_message", true)) { + result.action = DISPLAY_MESSAGE; + + } else if (token.matchString("dissolve", true)) { + result.action = DISSOLVE; + } else if (token.matchString("distort", true)) { + result.action = DISTORT; + + } else if (token.matchString("enable_control", true)) { + result.action = ENABLE_CONTROL; + + } else if (token.matchString("flush_mouse_events", true)) { + result.action = FLUSH_MOUSE_EVENTS; + + } else if (token.matchString("inventory", true)) { + result.action = INVENTORY; + + } else if (token.matchString("kill", true)) { + result.action = KILL; + + } else if (token.matchString("menu_bar_enable", true)) { + result.action = MENU_BAR_ENABLE; + + } else if (token.matchString("music", true)) { + result.action = MUSIC; + ObjectType argTypes[] = { UINT32, UINT32, STRING, UINT32, UINT32 }; + parseResultArguments(result, argTypes, 5, + tokenizer.nextToken(), tokenizer.nextToken(), + tokenizer.nextToken(), tokenizer.nextToken(), + tokenizer.nextToken()); + } else if (token.matchString("pan_track", true)) { + result.action = PAN_TRACK; + + } else if (token.matchString("playpreload", true)) { + result.action = PLAY_PRELOAD; + + } else if (token.matchString("preferences", true)) { + result.action = PREFERENCES; + + } else if (token.matchString("quit", true)) { + result.action = QUIT; + + } else if (token.matchString("random", true)) { + result.action = RANDOM; + ObjectType argTypes[] = { UINT32, UINT32 }; + parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); + } else if (token.matchString("region", true)) { + result.action = REGION; + + } else if (token.matchString("restore_game", true)) { + result.action = RESTORE_GAME; + + } else if (token.matchString("rotate_to", true)) { + result.action = ROTATE_TO; + + } else if (token.matchString("save_game", true)) { + result.action = SAVE_GAME; + + } else if (token.matchString("set_partial_screen", true)) { + result.action = SET_PARTIAL_SCREEN; + + } else if (token.matchString("set_screen", true)) { + result.action = SET_SCREEN; + + } else if (token.matchString("set_venus", true)) { + result.action = SET_VENUS; + + } else if (token.matchString("stop", true)) { + result.action = STOP; + ObjectType argTypes[] = { UINT32 }; + parseResultArguments(result, argTypes, 1, tokenizer.nextToken()); + } else if (token.matchString("streamvideo", true)) { + result.action = STREAM_VIDEO; + + } else if (token.matchString("syncsound", true)) { + result.action = SYNC_SOUND; + + } else if (token.matchString("timer", true)) { + result.action = TIMER; + ObjectType argTypes[] = { UINT32, UINT32 }; + parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); + } else if (token.matchString("ttytext", true)) { + result.action = TTY_TEXT; + + } else if (token.matchString("universe_music", true)) { + result.action = UNIVERSE_MUSIC; + + } else { + warning("Unhandled result action type: ", token); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + } + + return result; +} + +void ScriptManager::parseResultArguments(Result &result, const ObjectType *types, int numberOfArgs, ...) const { + va_list argptr; + va_start(argptr, numberOfArgs); + + for (int i = 0; i < numberOfArgs; i++) { + if (types[i] == UINT32) { + Common::String arg = va_arg(argptr, Common::String); + Object argObject(UINT32); + sscanf(arg.c_str(), "%u", &argObject); + result.arguments.push_back(argObject); + break; + } else { + Common::String arg = va_arg(argptr, Common::String); + result.arguments.push_back(Object(arg)); + break; + } + } + + va_end(argptr); +} + +byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { + byte flags; + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(line); + + while (!line.contains('}')) { + if (line.matchString("ONCE_PER_INST", true)) { + flags |= ONCE_PER_INST; + } else if (line.matchString("DO_ME_NOW", true)) { + flags |= DO_ME_NOW; + } else if (line.matchString("DISABLED", true)) { + flags |= DISABLED; + } + } + + return flags; +} + +void ScriptManager::parseControl(Control *control, Common::SeekableReadStream &stream) { + +} + +} // End namespace ZVision diff --git a/engines/zvision/scriptManager.h b/engines/zvision/scriptManager.h index a6c9f2b57c4c..7f6cc2547a1d 100644 --- a/engines/zvision/scriptManager.h +++ b/engines/zvision/scriptManager.h @@ -23,8 +23,13 @@ #ifndef ZVISION_SCRIPT_MANAGER_H #define ZVISION_SCRIPT_MANAGER_H +#include "common/str.h" +#include "common/stream.h" #include "common/hashmap.h" +#include "zvision/puzzle.h" +#include "zvision/control.h" + namespace ZVision { class ScriptManager { @@ -34,6 +39,63 @@ class ScriptManager { private: Common::HashMap _globalState; + + /** + * Parses a script file into triggers and events + * + * @param fileName Name of the .scr file + */ + void parseScrFile(Common::String fileName); + + /** + * Helper method for parseScrFile. Parses the stream into a Puzzle object + * + * @param puzzle The object to store what is parsed + * @param stream Scr file stream + */ + void parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream); + + /** + * Helper method for parsePuzzle. Parses the stream into a Criteria object + * + * @param stream Scr file stream + * @return Created Criteria object + */ + Criteria parseCriteria(Common::SeekableReadStream &stream) const; + + /** + * Helper method for parsePuzzle. Parses the stream into a Results object + * + * @param stream Scr file stream + * @return Created Results object + */ + Result parseResult(Common::SeekableReadStream &stream) const; + + /** + * Helper method for parseResults. Parses a number of strings into Object types. + * + * @param result Results object to store the arguments in + * @param types The type of the each of the arguments. IE. BOOL, UINT32, etc. + * @param numberOfArgs The number of arguments. This has to equal the length of 'types' AND the number of optional arguments passed. + * @param String arguments wanting to be parsed + */ + void parseResultArguments(Result &result, const ObjectType *types, int numberOfArgs, ...) const; + + /** + * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum + * + * @param stream Scr file stream + * @return Bitwise or of all the flags set within the puzzle + */ + byte parseFlags(Common::SeekableReadStream &stream) const; + + /** + * Helper method for parseScrFile. Parses the stream into a Control object + * + * @param control The object to store what is parsed + * @param stream Scr file stream + */ + void parseControl(Control *control, Common::SeekableReadStream &stream); }; From cf7c04a001d99081d73e4340acb8065ad593030a Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 13:38:40 -0500 Subject: [PATCH 0261/1332] ZVISION: Fix code formatting to follow the convention --- engines/zvision/control.h | 2 +- engines/zvision/graphics.cpp | 2 +- engines/zvision/object.cpp | 26 +++++++-------- engines/zvision/object.h | 49 ++++++++++++++--------------- engines/zvision/puzzle.h | 2 +- engines/zvision/scrFileHandling.cpp | 2 +- engines/zvision/scriptManager.h | 2 +- engines/zvision/scripts.cpp | 2 +- engines/zvision/utility.h | 2 +- engines/zvision/zfsArchive.cpp | 2 +- engines/zvision/zfsArchive.h | 2 +- engines/zvision/zork_raw.cpp | 2 +- engines/zvision/zork_raw.h | 2 +- 13 files changed, 48 insertions(+), 49 deletions(-) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 46a72117022c..df01544bfca1 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -32,6 +32,6 @@ struct Control { }; -} // End namespace ZVision +} // End of namespace ZVision #endif diff --git a/engines/zvision/graphics.cpp b/engines/zvision/graphics.cpp index 17e7a4f06b13..7d1201c4f9f1 100644 --- a/engines/zvision/graphics.cpp +++ b/engines/zvision/graphics.cpp @@ -34,4 +34,4 @@ void ZVision::updateAnimations(uint32 detaTimeMillis) { } -} // End namespace ZVision +} // End of namespace ZVision diff --git a/engines/zvision/object.cpp b/engines/zvision/object.cpp index 253eaf7ace2a..6bc8c0f648be 100644 --- a/engines/zvision/object.cpp +++ b/engines/zvision/object.cpp @@ -97,7 +97,7 @@ Object::Object(Common::String value) : _objectType(BYTE) { _value.stringVal = new Common::String(value); } -Object::Object(const Object& other) { +Object::Object(const Object &other) { _objectType = other._objectType; switch (_objectType) { @@ -138,7 +138,7 @@ Object::~Object() { void Object::deleteValue() { // Call delete on the correct part of the union. // Even though they all point to the same memory and will all be cast - // to a void *, compiler optimizations could cause undefined behavior. + // to a void *, this can still cause undefined behavior. switch (_objectType) { case BOOL: delete _value.boolVal; @@ -171,7 +171,7 @@ void Object::deleteValue() { } -Object& Object::operator=(const bool& rhs) { +Object &Object::operator=(const bool &rhs) { if (_objectType == BOOL) *_value.boolVal = rhs; else { @@ -183,7 +183,7 @@ Object& Object::operator=(const bool& rhs) { return *this; } -Object& Object::operator=(const byte& rhs) { +Object &Object::operator=(const byte &rhs) { if (_objectType == BYTE) *_value.byteVal = rhs; else { @@ -195,7 +195,7 @@ Object& Object::operator=(const byte& rhs) { return *this; } -Object& Object::operator=(const int16& rhs) { +Object &Object::operator=(const int16 &rhs) { if (_objectType == INT16) *_value.int16Val = rhs; else { @@ -207,7 +207,7 @@ Object& Object::operator=(const int16& rhs) { return *this; } -Object& Object::operator=(const uint16& rhs) { +Object &Object::operator=(const uint16 &rhs) { if (_objectType == UINT16) *_value.uint16Val = rhs; else { @@ -219,7 +219,7 @@ Object& Object::operator=(const uint16& rhs) { return *this; } -Object& Object::operator=(const int32& rhs) { +Object &Object::operator=(const int32 &rhs) { if (_objectType == INT32) *_value.int32Val = rhs; else { @@ -231,7 +231,7 @@ Object& Object::operator=(const int32& rhs) { return *this; } -Object& Object::operator=(const uint32& rhs) { +Object &Object::operator=(const uint32 &rhs) { if (_objectType == UINT32) *_value.uint32Val = rhs; else { @@ -243,7 +243,7 @@ Object& Object::operator=(const uint32& rhs) { return *this; } -Object& Object::operator=(const float& rhs) { +Object &Object::operator=(const float &rhs) { if (_objectType == FLOAT) *_value.floatVal = rhs; else { @@ -255,7 +255,7 @@ Object& Object::operator=(const float& rhs) { return *this; } -Object& Object::operator=(const double& rhs) { +Object &Object::operator=(const double &rhs) { if (_objectType == DOUBLE) *_value.doubleVal = rhs; else { @@ -267,7 +267,7 @@ Object& Object::operator=(const double& rhs) { return *this; } -Object& Object::operator=(const Common::String& rhs) { +Object &Object::operator=(const Common::String &rhs) { if (_objectType == STRING) *_value.stringVal = rhs; else { @@ -279,7 +279,7 @@ Object& Object::operator=(const Common::String& rhs) { return *this; } -Object& Object::operator=(const Object& rhs) { +Object &Object::operator=(const Object &rhs) { switch (_objectType) { case BOOL: return operator=(*rhs._value.boolVal); @@ -368,4 +368,4 @@ Object::operator Common::String() { return *_value.stringVal; } -} // End namespace ZVision +} // End of namespace ZVision diff --git a/engines/zvision/object.h b/engines/zvision/object.h index 02ca96223944..b98b3812cdbc 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -27,19 +27,6 @@ namespace ZVision { - -enum ObjectType { - BOOL, - BYTE, - INT16, - UINT16, - INT32, - UINT32, - FLOAT, - DOUBLE, - STRING, -}; - /** * A generic single value storage class. It is useful for storing different * value types in a single List, Hashmap, etc. @@ -52,6 +39,18 @@ enum ObjectType { */ class Object { public: + enum ObjectType { + BOOL, + BYTE, + INT16, + UINT16, + INT32, + UINT32, + FLOAT, + DOUBLE, + STRING, + }; + // Constructors Object(ObjectType type); Object(bool value); @@ -86,17 +85,17 @@ class Object { } _value; public: - Object& operator=(const bool& rhs); - Object& operator=(const byte& rhs); - Object& operator=(const int16& rhs); - Object& operator=(const uint16& rhs); - Object& operator=(const int32& rhs); - Object& operator=(const uint32& rhs); - Object& operator=(const float& rhs); - Object& operator=(const double& rhs); - Object& operator=(const Common::String& rhs); - - Object& operator=(const Object& rhs); + Object &operator=(const bool &rhs); + Object &operator=(const byte &rhs); + Object &operator=(const int16 &rhs); + Object &operator=(const uint16 &rhs); + Object &operator=(const int32 &rhs); + Object &operator=(const uint32 &rhs); + Object &operator=(const float &rhs); + Object &operator=(const double &rhs); + Object &operator=(const Common::String &rhs); + + Object& operator=(const Object &rhs); operator bool(); operator byte(); @@ -116,6 +115,6 @@ class Object { void deleteValue(); }; -} // End namespace ZVision +} // End of namespace ZVision #endif diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index cb44a440e1a2..6961fde45abe 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -114,6 +114,6 @@ struct Puzzle { byte flags; }; -} +} // End of namespace ZVision #endif diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scrFileHandling.cpp index f4b5bab6fb8d..a0d4cebf9ab0 100644 --- a/engines/zvision/scrFileHandling.cpp +++ b/engines/zvision/scrFileHandling.cpp @@ -322,4 +322,4 @@ void ScriptManager::parseControl(Control *control, Common::SeekableReadStream &s } -} // End namespace ZVision +} // End of namespace ZVision diff --git a/engines/zvision/scriptManager.h b/engines/zvision/scriptManager.h index 7f6cc2547a1d..0bae91945d66 100644 --- a/engines/zvision/scriptManager.h +++ b/engines/zvision/scriptManager.h @@ -99,6 +99,6 @@ class ScriptManager { }; -} // End namespace ZVision +} // End of namespace ZVision #endif diff --git a/engines/zvision/scripts.cpp b/engines/zvision/scripts.cpp index 40bad8f3a184..b6deb1b51010 100644 --- a/engines/zvision/scripts.cpp +++ b/engines/zvision/scripts.cpp @@ -28,4 +28,4 @@ namespace ZVision { -} // End namespace ZVision +} // End of namespace ZVision diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 0777ba9ebc5b..f9f99166fc47 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -69,6 +69,6 @@ void trimCommentsAndWhiteSpace(Common::String &string) { string.trim(); } -} // End namespace ZVision +} // End of namespace ZVision #endif diff --git a/engines/zvision/zfsArchive.cpp b/engines/zvision/zfsArchive.cpp index 93a026e5b9a2..e65d0df14e45 100644 --- a/engines/zvision/zfsArchive.cpp +++ b/engines/zvision/zfsArchive.cpp @@ -150,6 +150,6 @@ void ZfsArchive::unXor(byte *buffer, int length, const byte *xorKey) const { buffer[i] ^= xorKey[i % 4]; } -} // End namespace ZVision +} // End of namespace ZVision diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfsArchive.h index 718b26c836af..60292f865ef5 100644 --- a/engines/zvision/zfsArchive.h +++ b/engines/zvision/zfsArchive.h @@ -115,6 +115,6 @@ class ZfsArchive : public Common::Archive { void unXor(byte *buffer, int length, const byte *xorKey) const; }; -} // End of namespace Common +} // End of namespace ZVision #endif diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 3c37f929b3e0..e008741e160b 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -185,4 +185,4 @@ Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); } -} // End of namespace Audio +} // End of namespace ZVision diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index a8f8ce037f85..3a938026d9cc 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -62,6 +62,6 @@ Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream int rate, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); -} // End of namespace Audio +} // End of namespace ZVision #endif From 8cc678e2eeda0df0b80fd19b03712a626b0b7bd2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 14:45:51 -0500 Subject: [PATCH 0262/1332] ZVISION: Convert 'Object' implicit conversion operators to accessors Implicit conversion, while simple can cause problems and doesn't show exactly how to get the value. --- engines/zvision/object.cpp | 67 ++++++++++++++++++++++---------------- engines/zvision/object.h | 18 +++++----- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/engines/zvision/object.cpp b/engines/zvision/object.cpp index 6bc8c0f648be..322d7f2ea69e 100644 --- a/engines/zvision/object.cpp +++ b/engines/zvision/object.cpp @@ -305,67 +305,78 @@ Object &Object::operator=(const Object &rhs) { } -Object::operator bool() { - if (_objectType != BOOL) - warning("'Object' not of type bool. Bad cast"); +bool Object::getBoolValue(bool *returnValue) const { + if (_objectType != BOOL) { + warning("'Object' not of type bool."); + return false; + } - return *_value.boolVal; + *returnValue = *_value.boolVal; + return true; } -Object::operator byte() { +bool Object::getByteValue(byte *returnValue) const { if (_objectType != BYTE) - warning("'Object' not of type byte. Bad cast"); + warning("'Object' not of type byte."); - return *_value.byteVal; + *returnValue = *_value.byteVal; + return true; } -Object::operator int16() { +bool Object::getInt16Value(int16 *returnValue) const { if (_objectType != INT16) - warning("'Object' not of type int16. Bad cast"); + warning("'Object' not of type int16."); - return *_value.int16Val; + *returnValue = *_value.int16Val; + return true; } -Object::operator uint16() { +bool Object::getUInt16Value(uint16 *returnValue) const { if (_objectType != UINT16) - warning("'Object' not of type uint16. Bad cast"); + warning("'Object' not of type uint16."); - return *_value.uint16Val; + *returnValue = *_value.uint16Val; + return true; } -Object::operator int32() { +bool Object::getInt32Value(int32 *returnValue) const { if (_objectType != INT32) - warning("'Object' not of type int32. Bad cast"); + warning("'Object' not of type int32."); - return *_value.int32Val; + *returnValue = *_value.int32Val; + return true; } -Object::operator uint32() { +bool Object::getUInt32Value(uint32 *returnValue) const { if (_objectType != UINT32) - warning("'Object' not of type uint32. Bad cast"); + warning("'Object' not of type uint32."); - return *_value.uint32Val; + *returnValue = *_value.uint32Val; + return true; } -Object::operator float() { +bool Object::getFloatValue(float *returnValue) const { if (_objectType != FLOAT) - warning("'Object' not of type float. Bad cast"); + warning("'Object' not of type float."); - return *_value.floatVal; + *returnValue = *_value.floatVal; + return true; } -Object::operator double() { +bool Object::getDoubleValue(double *returnValue) const { if (_objectType != DOUBLE) - warning("'Object' not of type double. Bad cast"); + warning("'Object' not of type double."); - return *_value.doubleVal; + *returnValue = *_value.doubleVal; + return true; } -Object::operator Common::String() { +bool Object::getStringValue(Common::String *returnValue) const { if (_objectType != STRING) - warning("'Object' not of type Common::String. Bad cast"); + warning("'Object' not of type Common::String."); - return *_value.stringVal; + *returnValue = *_value.stringVal; + return true; } } // End of namespace ZVision diff --git a/engines/zvision/object.h b/engines/zvision/object.h index b98b3812cdbc..4df572c2b1ad 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -97,15 +97,15 @@ class Object { Object& operator=(const Object &rhs); - operator bool(); - operator byte(); - operator int16(); - operator uint16(); - operator int32(); - operator uint32(); - operator float(); - operator double(); - operator Common::String(); + bool getBoolValue(bool *returnValue) const; + bool getByteValue(byte *returnValue) const; + bool getInt16Value(int16 *returnValue) const; + bool getUInt16Value(uint16 *returnValue) const; + bool getInt32Value(int32 *returnValue) const; + bool getUInt32Value(uint32 *returnValue) const; + bool getFloatValue(float *returnValue) const; + bool getDoubleValue(double *returnValue) const; + bool getStringValue(Common::String *returnValue) const; private: /** From 7803c9fddf5fecd7d9adb6741f08e37fb92c0224 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 14:46:58 -0500 Subject: [PATCH 0263/1332] ZVISION: Force 'Object' constructors to be explicit. --- engines/zvision/object.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/zvision/object.h b/engines/zvision/object.h index 4df572c2b1ad..6e4b98a8140e 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -52,19 +52,19 @@ class Object { }; // Constructors - Object(ObjectType type); - Object(bool value); - Object(byte value); - Object(int16 value); - Object(uint16 value); - Object(int32 value); - Object(uint32 value); - Object(float value); - Object(double value); - Object(Common::String value); + explicit Object(ObjectType type); + explicit Object(bool value); + explicit Object(byte value); + explicit Object(int16 value); + explicit Object(uint16 value); + explicit Object(int32 value); + explicit Object(uint32 value); + explicit Object(float value); + explicit Object(double value); + explicit Object(Common::String value); // Copy constructor - Object(const Object& other); + explicit Object(const Object& other); // Destructor ~Object(); From 3283176f6d000cbb66208a0b5d4b3337004461fd Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 13:40:24 -0500 Subject: [PATCH 0264/1332] ZVISION: Move initialization code from run() and into its own method --- engines/zvision/zvision.cpp | 8 +++++++- engines/zvision/zvision.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 2cc0b471136a..452ed00dafea 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -73,7 +73,7 @@ ZVision::~ZVision() { DebugMan.clearAllDebugChannels(); } -Common::Error ZVision::run() { +void ZVision::initialize() { // Find zfs archive files Common::ArchiveMemberList list; SearchMan.listMatchingMembers(list, "*.zfs"); @@ -92,6 +92,12 @@ Common::Error ZVision::run() { // Create debugger console. It requires GFX to be initialized _console = new Console(this); +} + +Common::Error ZVision::run() { + initialize(); + + tests(); // Main loop uint32 currentTime = _system->getMillis(); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index b4664d0e2925..c5ddb8ab4ae6 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -67,6 +67,8 @@ class ZVision : public Engine { virtual Common::Error run(); private: + void initialize(); + void processEvents(); void onMouseDown(const Common::Point &pos); void onMouseMove(const Common::Point &pos); From d5fa6612ed8f48ce33dd9f3576c450fe80a7526d Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 13:41:24 -0500 Subject: [PATCH 0265/1332] ZVISION: Modify utility and puzzle comments to make them more clear --- engines/zvision/puzzle.h | 4 ++-- engines/zvision/utility.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 6961fde45abe..1133adac474d 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -48,8 +48,8 @@ struct Criteria { uint32 argument; /** How to do the comparison */ CriteriaOperator criteriaOperator; - /** Is 'argument' the id of a global state or a pure value */ - bool argumentIsAnId; + /** Whether 'argument' is the id of a global state (true) or a pure value (false) */ + bool isArgumentAnId; }; /** What happens when Puzzle criteria are met */ diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index f9f99166fc47..9fade107f510 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -54,8 +54,8 @@ void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) /** * Removes any line comments using '#' as a sequence start. - * Then removes any trailing and leading 'whitespace'. - * Uses isspace() to determine what is whitespace and what is not. + * Then removes any trailing and leading 'whitespace' using String::trim() + * Note: String::trim uses isspace() to determine what is whitespace and what is not. * * @param string The string to modify. It is modified in place */ From 5fef80994101046801500f3350f85ca368d50aa6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 15:17:57 -0500 Subject: [PATCH 0266/1332] ZVISION: Convert union of pointers to union of values except for String. Instead of storing everything on the heap, only store Strings on the heap. For Strings, store a char array pointer instead of an actual String object since String objects are fairly large. --- engines/zvision/object.cpp | 293 ++++++++++++++++--------------------- engines/zvision/object.h | 18 +-- 2 files changed, 137 insertions(+), 174 deletions(-) diff --git a/engines/zvision/object.cpp b/engines/zvision/object.cpp index 322d7f2ea69e..b272320988aa 100644 --- a/engines/zvision/object.cpp +++ b/engines/zvision/object.cpp @@ -27,74 +27,43 @@ namespace ZVision { -Object::Object(ObjectType type) { - _objectType = type; - - switch (type) { - case BOOL: - _value.boolVal = new bool; - break; - case BYTE: - _value.byteVal = new byte; - break; - case INT16: - _value.int16Val = new int16; - break; - case UINT16: - _value.uint16Val = new uint16; - break; - case INT32: - _value.int32Val = new int32; - break; - case UINT32: - _value.uint32Val = new uint32; - break; - case FLOAT: - _value.floatVal = new float; - break; - case DOUBLE: - _value.doubleVal = new double; - break; - case STRING: - _value.stringVal = new Common::String; - break; - } -} +Object::Object(ObjectType type) : _objectType(type) { } Object::Object(bool value) : _objectType(BOOL) { - _value.boolVal = new bool(value); + _value.boolVal = value; } Object::Object(byte value) : _objectType(BYTE) { - _value.byteVal = new byte(value); + _value.byteVal = value; } Object::Object(int16 value) : _objectType(INT16) { - _value.int16Val = new int16(value); + _value.int16Val = value; } Object::Object(uint16 value) : _objectType(UINT16) { - _value.uint16Val = new uint16(value); + _value.uint16Val = value; } Object::Object(int32 value) : _objectType(INT32) { - _value.int32Val = new int32(value); + _value.int32Val = value; } Object::Object(uint32 value) : _objectType(UINT32) { - _value.uint32Val = new uint32(value); + _value.uint32Val = value; } Object::Object(float value) : _objectType(FLOAT) { - _value.floatVal = new float(value); + _value.floatVal = value; } Object::Object(double value) : _objectType(DOUBLE) { - _value.doubleVal = new double(value); + _value.doubleVal = value; } Object::Object(Common::String value) : _objectType(BYTE) { - _value.stringVal = new Common::String(value); + _value.stringVal = new char[value.size() + 1]; + memcpy(_value.stringVal, value.c_str(), value.size() + 1); } Object::Object(const Object &other) { @@ -102,178 +71,167 @@ Object::Object(const Object &other) { switch (_objectType) { case BOOL: - _value.boolVal = new bool(*other._value.boolVal); + _value.boolVal = other._value.boolVal; break; case BYTE: - _value.byteVal = new byte(*other._value.byteVal); + _value.byteVal = other._value.byteVal; break; case INT16: - _value.int16Val = new int16(*other._value.int16Val); + _value.int16Val = other._value.int16Val; break; case UINT16: - _value.uint16Val = new uint16(*other._value.uint16Val); + _value.uint16Val = other._value.uint16Val; break; case INT32: - _value.int32Val = new int32(*other._value.int32Val); + _value.int32Val = other._value.int32Val; break; case UINT32: - _value.uint32Val = new uint32(*other._value.uint32Val); + _value.uint32Val = other._value.uint32Val; break; case FLOAT: - _value.floatVal = new float(*other._value.floatVal); + _value.floatVal = other._value.floatVal; break; case DOUBLE: - _value.doubleVal = new double(*other._value.doubleVal); + _value.doubleVal = other._value.doubleVal; break; case STRING: - _value.stringVal = new Common::String(*other._value.stringVal); + uint32 length = strlen(other._value.stringVal); + _value.stringVal = new char[length + 1]; + memcpy(_value.stringVal, other._value.stringVal, length + 1); break; } } Object::~Object() { - deleteValue(); + deleteCharPointer(); } -void Object::deleteValue() { - // Call delete on the correct part of the union. - // Even though they all point to the same memory and will all be cast - // to a void *, this can still cause undefined behavior. - switch (_objectType) { - case BOOL: - delete _value.boolVal; - break; - case BYTE: - delete _value.byteVal; - break; - case INT16: - delete _value.int16Val; - break; - case UINT16: - delete _value.uint16Val; - break; - case INT32: - delete _value.int32Val; - break; - case UINT32: - delete _value.uint32Val; - break; - case FLOAT: - delete _value.floatVal; - break; - case DOUBLE: - delete _value.doubleVal; - break; - case STRING: - delete _value.stringVal; - break; - } +void Object::deleteCharPointer() { + if (_objectType == STRING) + delete[] _value.stringVal; } Object &Object::operator=(const bool &rhs) { - if (_objectType == BOOL) - *_value.boolVal = rhs; - else { - deleteValue(); - _objectType = BOOL; - _value.boolVal = new bool(rhs); + if (_objectType == BOOL) { + _value.boolVal = rhs; + return *this; } + deleteCharPointer(); + _objectType = BOOL; + _value.boolVal = rhs; + return *this; } Object &Object::operator=(const byte &rhs) { - if (_objectType == BYTE) - *_value.byteVal = rhs; - else { - deleteValue(); - _objectType = BYTE; - _value.byteVal = new byte(rhs); + if (_objectType == BYTE) { + _value.byteVal = rhs; + return *this; } + deleteCharPointer(); + _objectType = BYTE; + _value.byteVal = rhs; + return *this; } Object &Object::operator=(const int16 &rhs) { - if (_objectType == INT16) - *_value.int16Val = rhs; - else { - deleteValue(); - _objectType = INT16; - _value.int16Val = new int16(rhs); + if (_objectType == INT16) { + _value.int16Val = rhs; + return *this; } + deleteCharPointer(); + _objectType = INT16; + _value.int16Val = rhs; + return *this; } Object &Object::operator=(const uint16 &rhs) { - if (_objectType == UINT16) - *_value.uint16Val = rhs; - else { - deleteValue(); - _objectType = UINT16; - _value.uint16Val = new uint16(rhs); + if (_objectType == UINT16) { + _value.uint16Val = rhs; + return *this; } + deleteCharPointer(); + _objectType = UINT16; + _value.uint16Val = rhs; + return *this; } Object &Object::operator=(const int32 &rhs) { - if (_objectType == INT32) - *_value.int32Val = rhs; - else { - deleteValue(); - _objectType = INT32; - _value.int32Val = new int32(rhs); + if (_objectType == INT32) { + _value.int32Val = rhs; + return *this; } + deleteCharPointer(); + _objectType = INT32; + _value.int32Val = rhs; + return *this; } Object &Object::operator=(const uint32 &rhs) { - if (_objectType == UINT32) - *_value.uint32Val = rhs; - else { - deleteValue(); - _objectType = UINT32; - _value.uint32Val = new uint32(rhs); + if (_objectType == UINT32) { + _value.uint32Val = rhs; + return *this; } + deleteCharPointer(); + _objectType = UINT32; + _value.uint32Val = rhs; + return *this; } Object &Object::operator=(const float &rhs) { - if (_objectType == FLOAT) - *_value.floatVal = rhs; - else { - deleteValue(); - _objectType = FLOAT; - _value.floatVal = new float(rhs); + if (_objectType == FLOAT) { + _value.floatVal = rhs; + return *this; } + deleteCharPointer(); + _objectType = FLOAT; + _value.floatVal = rhs; + return *this; } Object &Object::operator=(const double &rhs) { - if (_objectType == DOUBLE) - *_value.doubleVal = rhs; - else { - deleteValue(); - _objectType = DOUBLE; - _value.doubleVal = new double(rhs); + if (_objectType == DOUBLE) { + _value.doubleVal = rhs; + return *this; } + deleteCharPointer(); + _objectType = DOUBLE; + _value.doubleVal = rhs; + return *this; } Object &Object::operator=(const Common::String &rhs) { - if (_objectType == STRING) - *_value.stringVal = rhs; - else { - deleteValue(); + if (_objectType != STRING) { _objectType = STRING; - _value.stringVal = new Common::String(rhs); + _value.stringVal = new char[rhs.size() + 1]; + memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1); + + return *this; + } + + uint32 length = strlen(_value.stringVal); + if (length <= rhs.size() + 1) { + memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1); + } else { + delete[] _value.stringVal; + _value.stringVal = new char[rhs.size() + 1]; + memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1); } return *this; @@ -282,23 +240,28 @@ Object &Object::operator=(const Common::String &rhs) { Object &Object::operator=(const Object &rhs) { switch (_objectType) { case BOOL: - return operator=(*rhs._value.boolVal); + return operator=(rhs._value.boolVal); case BYTE: - return operator=(*rhs._value.byteVal); + return operator=(rhs._value.byteVal); case INT16: - return operator=(*rhs._value.int16Val); + return operator=(rhs._value.int16Val); case UINT16: - return operator=(*rhs._value.uint16Val); + return operator=(rhs._value.uint16Val); case INT32: - return operator=(*rhs._value.int32Val); + return operator=(rhs._value.int32Val); case UINT32: - return operator=(*rhs._value.uint32Val); + return operator=(rhs._value.uint32Val); case FLOAT: - return operator=(*rhs._value.floatVal); + return operator=(rhs._value.floatVal); case DOUBLE: - return operator=(*rhs._value.doubleVal); + return operator=(rhs._value.doubleVal); case STRING: - return operator=(*rhs._value.stringVal); + uint32 length = strlen(rhs._value.stringVal); + + _value.stringVal = new char[length + 1]; + memcpy(_value.stringVal, rhs._value.stringVal, length + 1); + + return *this; } return *this; @@ -307,75 +270,75 @@ Object &Object::operator=(const Object &rhs) { bool Object::getBoolValue(bool *returnValue) const { if (_objectType != BOOL) { - warning("'Object' not of type bool."); + warning("'Object' is not storing a bool."); return false; } - *returnValue = *_value.boolVal; + *returnValue = _value.boolVal; return true; } bool Object::getByteValue(byte *returnValue) const { if (_objectType != BYTE) - warning("'Object' not of type byte."); + warning("'Object' is not storing a byte."); - *returnValue = *_value.byteVal; + *returnValue = _value.byteVal; return true; } bool Object::getInt16Value(int16 *returnValue) const { if (_objectType != INT16) - warning("'Object' not of type int16."); + warning("'Object' is not storing an int16."); - *returnValue = *_value.int16Val; + *returnValue = _value.int16Val; return true; } bool Object::getUInt16Value(uint16 *returnValue) const { if (_objectType != UINT16) - warning("'Object' not of type uint16."); + warning("'Object' is not storing a uint16."); - *returnValue = *_value.uint16Val; + *returnValue = _value.uint16Val; return true; } bool Object::getInt32Value(int32 *returnValue) const { if (_objectType != INT32) - warning("'Object' not of type int32."); + warning("'Object' is not storing an int32."); - *returnValue = *_value.int32Val; + *returnValue = _value.int32Val; return true; } bool Object::getUInt32Value(uint32 *returnValue) const { if (_objectType != UINT32) - warning("'Object' not of type uint32."); + warning("'Object' is not storing a uint32."); - *returnValue = *_value.uint32Val; + *returnValue = _value.uint32Val; return true; } bool Object::getFloatValue(float *returnValue) const { if (_objectType != FLOAT) - warning("'Object' not of type float."); + warning("'Object' is not storing a float."); - *returnValue = *_value.floatVal; + *returnValue = _value.floatVal; return true; } bool Object::getDoubleValue(double *returnValue) const { if (_objectType != DOUBLE) - warning("'Object' not of type double."); + warning("'Object' is not storing a double."); - *returnValue = *_value.doubleVal; + *returnValue = _value.doubleVal; return true; } bool Object::getStringValue(Common::String *returnValue) const { if (_objectType != STRING) - warning("'Object' not of type Common::String."); + warning("'Object' is not storing a Common::String."); - *returnValue = *_value.stringVal; + *returnValue = _value.stringVal; return true; } diff --git a/engines/zvision/object.h b/engines/zvision/object.h index 6e4b98a8140e..dc5905b05202 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -73,15 +73,15 @@ class Object { ObjectType _objectType; union { - bool *boolVal; - byte *byteVal; - int16 *int16Val; - uint16 *uint16Val; - int32 *int32Val; - uint32 *uint32Val; - float *floatVal; - double *doubleVal; - Common::String *stringVal; + bool boolVal; + byte byteVal; + int16 int16Val; + uint16 uint16Val; + int32 int32Val; + uint32 uint32Val; + float floatVal; + double doubleVal; + char *stringVal; } _value; public: From 30208f7f2b0e47b5684d7d1860541f4dd56f43ce Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 15:18:23 -0500 Subject: [PATCH 0267/1332] ZVISION: Add documentation to 'Object' accessors --- engines/zvision/object.h | 73 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/engines/zvision/object.h b/engines/zvision/object.h index dc5905b05202..f7e08c46d3bf 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -97,22 +97,89 @@ class Object { Object& operator=(const Object &rhs); + /** + * Retrieve a bool from the container. If the container is not storing a + * bool, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getBoolValue(bool *returnValue) const; + /** + * Retrieve a byte from the container. If the container is not storing a + * byte, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getByteValue(byte *returnValue) const; + /** + * Retrieve an int16 from the container. If the container is not storing an + * int16, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getInt16Value(int16 *returnValue) const; + /** + * Retrieve a uint16 from the container. If the container is not storing a + * uint16, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getUInt16Value(uint16 *returnValue) const; + /** + * Retrieve an int32 from the container. If the container is not storing an + * int32, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getInt32Value(int32 *returnValue) const; + /** + * Retrieve a uint32 from the container. If the container is not storing a + * uint32, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getUInt32Value(uint32 *returnValue) const; + /** + * Retrieve a float from the container. If the container is not storing a + * float, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getFloatValue(float *returnValue) const; + /** + * Retrieve a double from the container. If the container is not storing a + * double, this will return false and display a warning(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getDoubleValue(double *returnValue) const; + /** + * Retrieve a String from the container. If the container is not storing a + * string, this will return false and display a warning(). + * + * Caution: Strings are internally stored as char[]. getStringValue uses + * Common::String::operator=(char *) to do the assigment, which uses both + * strlen() AND memmove(). + * + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful + */ bool getStringValue(Common::String *returnValue) const; private: /** - * Helper method for destruction and assignment. Calls delete on - * the currently used data pointer + * Helper method for destruction and assignment. It checks to see + * if the char pointer is being used, and if so calls delete on it */ - void deleteValue(); + void deleteCharPointer(); }; } // End of namespace ZVision From c3c75669628e93c66d08a175142ad72b8f9b00a7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 15:22:35 -0500 Subject: [PATCH 0268/1332] ZVISION: Rename 'Object' class to 'SingleValueContainer' --- engines/zvision/object.cpp | 64 +++++++++++++++++++------------------- engines/zvision/object.h | 58 ++++++++++++++++------------------ 2 files changed, 58 insertions(+), 64 deletions(-) diff --git a/engines/zvision/object.cpp b/engines/zvision/object.cpp index b272320988aa..6a3d4e047ddc 100644 --- a/engines/zvision/object.cpp +++ b/engines/zvision/object.cpp @@ -27,46 +27,46 @@ namespace ZVision { -Object::Object(ObjectType type) : _objectType(type) { } +SingleValueContainer::SingleValueContainer(ValueType type) : _objectType(type) { } -Object::Object(bool value) : _objectType(BOOL) { +SingleValueContainer::SingleValueContainer(bool value) : _objectType(BOOL) { _value.boolVal = value; } -Object::Object(byte value) : _objectType(BYTE) { +SingleValueContainer::SingleValueContainer(byte value) : _objectType(BYTE) { _value.byteVal = value; } -Object::Object(int16 value) : _objectType(INT16) { +SingleValueContainer::SingleValueContainer(int16 value) : _objectType(INT16) { _value.int16Val = value; } -Object::Object(uint16 value) : _objectType(UINT16) { +SingleValueContainer::SingleValueContainer(uint16 value) : _objectType(UINT16) { _value.uint16Val = value; } -Object::Object(int32 value) : _objectType(INT32) { +SingleValueContainer::SingleValueContainer(int32 value) : _objectType(INT32) { _value.int32Val = value; } -Object::Object(uint32 value) : _objectType(UINT32) { +SingleValueContainer::SingleValueContainer(uint32 value) : _objectType(UINT32) { _value.uint32Val = value; } -Object::Object(float value) : _objectType(FLOAT) { +SingleValueContainer::SingleValueContainer(float value) : _objectType(FLOAT) { _value.floatVal = value; } -Object::Object(double value) : _objectType(DOUBLE) { +SingleValueContainer::SingleValueContainer(double value) : _objectType(DOUBLE) { _value.doubleVal = value; } -Object::Object(Common::String value) : _objectType(BYTE) { +SingleValueContainer::SingleValueContainer(Common::String value) : _objectType(BYTE) { _value.stringVal = new char[value.size() + 1]; memcpy(_value.stringVal, value.c_str(), value.size() + 1); } -Object::Object(const Object &other) { +SingleValueContainer::SingleValueContainer(const SingleValueContainer &other) { _objectType = other._objectType; switch (_objectType) { @@ -102,17 +102,17 @@ Object::Object(const Object &other) { } } -Object::~Object() { +SingleValueContainer::~SingleValueContainer() { deleteCharPointer(); } -void Object::deleteCharPointer() { +void SingleValueContainer::deleteCharPointer() { if (_objectType == STRING) delete[] _value.stringVal; } -Object &Object::operator=(const bool &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const bool &rhs) { if (_objectType == BOOL) { _value.boolVal = rhs; return *this; @@ -125,7 +125,7 @@ Object &Object::operator=(const bool &rhs) { return *this; } -Object &Object::operator=(const byte &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const byte &rhs) { if (_objectType == BYTE) { _value.byteVal = rhs; return *this; @@ -138,7 +138,7 @@ Object &Object::operator=(const byte &rhs) { return *this; } -Object &Object::operator=(const int16 &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const int16 &rhs) { if (_objectType == INT16) { _value.int16Val = rhs; return *this; @@ -151,7 +151,7 @@ Object &Object::operator=(const int16 &rhs) { return *this; } -Object &Object::operator=(const uint16 &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const uint16 &rhs) { if (_objectType == UINT16) { _value.uint16Val = rhs; return *this; @@ -164,7 +164,7 @@ Object &Object::operator=(const uint16 &rhs) { return *this; } -Object &Object::operator=(const int32 &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const int32 &rhs) { if (_objectType == INT32) { _value.int32Val = rhs; return *this; @@ -177,7 +177,7 @@ Object &Object::operator=(const int32 &rhs) { return *this; } -Object &Object::operator=(const uint32 &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const uint32 &rhs) { if (_objectType == UINT32) { _value.uint32Val = rhs; return *this; @@ -190,7 +190,7 @@ Object &Object::operator=(const uint32 &rhs) { return *this; } -Object &Object::operator=(const float &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const float &rhs) { if (_objectType == FLOAT) { _value.floatVal = rhs; return *this; @@ -203,7 +203,7 @@ Object &Object::operator=(const float &rhs) { return *this; } -Object &Object::operator=(const double &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const double &rhs) { if (_objectType == DOUBLE) { _value.doubleVal = rhs; return *this; @@ -216,7 +216,7 @@ Object &Object::operator=(const double &rhs) { return *this; } -Object &Object::operator=(const Common::String &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const Common::String &rhs) { if (_objectType != STRING) { _objectType = STRING; _value.stringVal = new char[rhs.size() + 1]; @@ -237,7 +237,7 @@ Object &Object::operator=(const Common::String &rhs) { return *this; } -Object &Object::operator=(const Object &rhs) { +SingleValueContainer &SingleValueContainer::operator=(const SingleValueContainer &rhs) { switch (_objectType) { case BOOL: return operator=(rhs._value.boolVal); @@ -268,7 +268,7 @@ Object &Object::operator=(const Object &rhs) { } -bool Object::getBoolValue(bool *returnValue) const { +bool SingleValueContainer::getBoolValue(bool *returnValue) const { if (_objectType != BOOL) { warning("'Object' is not storing a bool."); return false; @@ -278,7 +278,7 @@ bool Object::getBoolValue(bool *returnValue) const { return true; } -bool Object::getByteValue(byte *returnValue) const { +bool SingleValueContainer::getByteValue(byte *returnValue) const { if (_objectType != BYTE) warning("'Object' is not storing a byte."); @@ -286,7 +286,7 @@ bool Object::getByteValue(byte *returnValue) const { return true; } -bool Object::getInt16Value(int16 *returnValue) const { +bool SingleValueContainer::getInt16Value(int16 *returnValue) const { if (_objectType != INT16) warning("'Object' is not storing an int16."); @@ -294,7 +294,7 @@ bool Object::getInt16Value(int16 *returnValue) const { return true; } -bool Object::getUInt16Value(uint16 *returnValue) const { +bool SingleValueContainer::getUInt16Value(uint16 *returnValue) const { if (_objectType != UINT16) warning("'Object' is not storing a uint16."); @@ -302,7 +302,7 @@ bool Object::getUInt16Value(uint16 *returnValue) const { return true; } -bool Object::getInt32Value(int32 *returnValue) const { +bool SingleValueContainer::getInt32Value(int32 *returnValue) const { if (_objectType != INT32) warning("'Object' is not storing an int32."); @@ -310,7 +310,7 @@ bool Object::getInt32Value(int32 *returnValue) const { return true; } -bool Object::getUInt32Value(uint32 *returnValue) const { +bool SingleValueContainer::getUInt32Value(uint32 *returnValue) const { if (_objectType != UINT32) warning("'Object' is not storing a uint32."); @@ -318,7 +318,7 @@ bool Object::getUInt32Value(uint32 *returnValue) const { return true; } -bool Object::getFloatValue(float *returnValue) const { +bool SingleValueContainer::getFloatValue(float *returnValue) const { if (_objectType != FLOAT) warning("'Object' is not storing a float."); @@ -326,7 +326,7 @@ bool Object::getFloatValue(float *returnValue) const { return true; } -bool Object::getDoubleValue(double *returnValue) const { +bool SingleValueContainer::getDoubleValue(double *returnValue) const { if (_objectType != DOUBLE) warning("'Object' is not storing a double."); @@ -334,7 +334,7 @@ bool Object::getDoubleValue(double *returnValue) const { return true; } -bool Object::getStringValue(Common::String *returnValue) const { +bool SingleValueContainer::getStringValue(Common::String *returnValue) const { if (_objectType != STRING) warning("'Object' is not storing a Common::String."); diff --git a/engines/zvision/object.h b/engines/zvision/object.h index f7e08c46d3bf..3c24cc07f06f 100644 --- a/engines/zvision/object.h +++ b/engines/zvision/object.h @@ -30,16 +30,10 @@ namespace ZVision { /** * A generic single value storage class. It is useful for storing different * value types in a single List, Hashmap, etc. - * - * Mimics C#'s Object class - * - * Caution: The actual value is stored on the heap, so be careful creating - * many objects of this class. Also, when re-using 'Object', try to assign - * a value of the same type as before, as this will prevent an extra memory allocation. */ -class Object { +class SingleValueContainer { public: - enum ObjectType { + enum ValueType { BOOL, BYTE, INT16, @@ -52,25 +46,25 @@ class Object { }; // Constructors - explicit Object(ObjectType type); - explicit Object(bool value); - explicit Object(byte value); - explicit Object(int16 value); - explicit Object(uint16 value); - explicit Object(int32 value); - explicit Object(uint32 value); - explicit Object(float value); - explicit Object(double value); - explicit Object(Common::String value); + explicit SingleValueContainer(ValueType type); + explicit SingleValueContainer(bool value); + explicit SingleValueContainer(byte value); + explicit SingleValueContainer(int16 value); + explicit SingleValueContainer(uint16 value); + explicit SingleValueContainer(int32 value); + explicit SingleValueContainer(uint32 value); + explicit SingleValueContainer(float value); + explicit SingleValueContainer(double value); + explicit SingleValueContainer(Common::String value); // Copy constructor - explicit Object(const Object& other); + explicit SingleValueContainer(const SingleValueContainer& other); // Destructor - ~Object(); + ~SingleValueContainer(); private: - ObjectType _objectType; + ValueType _objectType; union { bool boolVal; @@ -85,17 +79,17 @@ class Object { } _value; public: - Object &operator=(const bool &rhs); - Object &operator=(const byte &rhs); - Object &operator=(const int16 &rhs); - Object &operator=(const uint16 &rhs); - Object &operator=(const int32 &rhs); - Object &operator=(const uint32 &rhs); - Object &operator=(const float &rhs); - Object &operator=(const double &rhs); - Object &operator=(const Common::String &rhs); - - Object& operator=(const Object &rhs); + SingleValueContainer &operator=(const bool &rhs); + SingleValueContainer &operator=(const byte &rhs); + SingleValueContainer &operator=(const int16 &rhs); + SingleValueContainer &operator=(const uint16 &rhs); + SingleValueContainer &operator=(const int32 &rhs); + SingleValueContainer &operator=(const uint32 &rhs); + SingleValueContainer &operator=(const float &rhs); + SingleValueContainer &operator=(const double &rhs); + SingleValueContainer &operator=(const Common::String &rhs); + + SingleValueContainer& operator=(const SingleValueContainer &rhs); /** * Retrieve a bool from the container. If the container is not storing a From 063d6c34008cf61a19ce8ae135b44091371ac728 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 15:25:10 -0500 Subject: [PATCH 0269/1332] ZVISION: Rename object.h and object.cpp to fit the new class name --- engines/zvision/{object.cpp => singleValueContainer.cpp} | 0 engines/zvision/{object.h => singleValueContainer.h} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename engines/zvision/{object.cpp => singleValueContainer.cpp} (100%) rename engines/zvision/{object.h => singleValueContainer.h} (100%) diff --git a/engines/zvision/object.cpp b/engines/zvision/singleValueContainer.cpp similarity index 100% rename from engines/zvision/object.cpp rename to engines/zvision/singleValueContainer.cpp diff --git a/engines/zvision/object.h b/engines/zvision/singleValueContainer.h similarity index 100% rename from engines/zvision/object.h rename to engines/zvision/singleValueContainer.h From 526c1dc4650948125334cedc32c9fdfb70219dce Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 17:26:26 -0500 Subject: [PATCH 0270/1332] ZVISION: Use spaces in doxygen comments for alignement instead of tabs --- engines/zvision/singleValueContainer.h | 36 +++++++++++++------------- engines/zvision/utility.h | 6 ++--- engines/zvision/zfsArchive.h | 15 ++++++----- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/engines/zvision/singleValueContainer.h b/engines/zvision/singleValueContainer.h index 3c24cc07f06f..49c7267f7706 100644 --- a/engines/zvision/singleValueContainer.h +++ b/engines/zvision/singleValueContainer.h @@ -95,64 +95,64 @@ class SingleValueContainer { * Retrieve a bool from the container. If the container is not storing a * bool, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getBoolValue(bool *returnValue) const; /** * Retrieve a byte from the container. If the container is not storing a * byte, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getByteValue(byte *returnValue) const; /** * Retrieve an int16 from the container. If the container is not storing an * int16, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getInt16Value(int16 *returnValue) const; /** * Retrieve a uint16 from the container. If the container is not storing a * uint16, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getUInt16Value(uint16 *returnValue) const; /** * Retrieve an int32 from the container. If the container is not storing an * int32, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getInt32Value(int32 *returnValue) const; /** * Retrieve a uint32 from the container. If the container is not storing a * uint32, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getUInt32Value(uint32 *returnValue) const; /** * Retrieve a float from the container. If the container is not storing a * float, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getFloatValue(float *returnValue) const; /** * Retrieve a double from the container. If the container is not storing a * double, this will return false and display a warning(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getDoubleValue(double *returnValue) const; /** @@ -163,8 +163,8 @@ class SingleValueContainer { * Common::String::operator=(char *) to do the assigment, which uses both * strlen() AND memmove(). * - * @param returnValue Pointer to where you want the value stored - * @return Value indicating whether the value assignment was successful + * @param returnValue Pointer to where you want the value stored + * @return Value indicating whether the value assignment was successful */ bool getStringValue(Common::String *returnValue) const; diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 9fade107f510..4d124509ba3f 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -33,8 +33,8 @@ namespace ZVision { * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the * contents to destFile. destFile is created in the working directory * - * @param sourceFile The 'file' you want the contents of - * @param destFile The name of the file where the content will be written to + * @param sourceFile The 'file' you want the contents of + * @param destFile The name of the file where the content will be written to */ void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) { Common::File f; @@ -57,7 +57,7 @@ void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) * Then removes any trailing and leading 'whitespace' using String::trim() * Note: String::trim uses isspace() to determine what is whitespace and what is not. * - * @param string The string to modify. It is modified in place + * @param string The string to modify. It is modified in place */ void trimCommentsAndWhiteSpace(Common::String &string) { for (int i = string.size(); i >= 0; --i) { diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfsArchive.h index 60292f865ef5..ccdf192571f6 100644 --- a/engines/zvision/zfsArchive.h +++ b/engines/zvision/zfsArchive.h @@ -67,7 +67,7 @@ class ZfsArchive : public Common::Archive { * Add all members of the Archive to list. * Must only append to list, and not remove elements from it. * - * @return the number of names added to list + * @return The number of names added to list */ int listMembers(Common::ArchiveMemberList &list) const; @@ -79,7 +79,8 @@ class ZfsArchive : public Common::Archive { /** * Create a stream bound to a member with the specified name in the * archive. If no member with this name exists, 0 is returned. - * @return the newly created input stream + * + * @return The newly created input stream */ Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; @@ -92,7 +93,7 @@ class ZfsArchive : public Common::Archive { * Parses the zfs file into file entry headers that can be used later * to get the entry data. * - * @param stream The contents of the zfs file + * @param stream The contents of the zfs file */ void readHeaders(Common::SeekableReadStream *stream); @@ -100,8 +101,8 @@ class ZfsArchive : public Common::Archive { * Entry names are contained within a 16 byte block. This reads the block * and converts it the name to a Common::String * - * @param stream The zfs file stream - * @return The entry file name + * @param stream The zfs file stream + * @return The entry file name */ Common::String readEntryName(Common::SeekableReadStream *stream) const; @@ -109,8 +110,8 @@ class ZfsArchive : public Common::Archive { * ZFS file entries can be encrypted using XOR encoding. This method * decodes the buffer in place using the supplied xorKey. * - * @param buffer The data to decode - * @param length Length of buffer + * @param buffer The data to decode + * @param length Length of buffer */ void unXor(byte *buffer, int length, const byte *xorKey) const; }; From ac96b943fa90270e1b5c1536f3b0d49bb6c3b161 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 12:19:11 -0500 Subject: [PATCH 0271/1332] ZVISION: Create an instance of ScriptManager inside ZVision --- engines/zvision/zvision.cpp | 7 ++++++- engines/zvision/zvision.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 452ed00dafea..2009ccde447a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -32,10 +32,13 @@ #include "engines/util.h" #include "zvision/zvision.h" +#include "zvision/scriptManager.h" #include "zvision/zfsArchive.h" #include "graphics/decoders/tga.h" +#include "zvision/tests.h" + namespace ZVision { ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { @@ -59,7 +62,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine // Don't forget to register your random source _rnd = new Common::RandomSource("zvision"); - + debug("ZVision::ZVision"); } @@ -90,6 +93,8 @@ void ZVision::initialize() { Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 initGraphics(640, 480, true, &format); + _scriptManager.initialize(); + // Create debugger console. It requires GFX to be initialized _console = new Console(this); } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index c5ddb8ab4ae6..b57ce20e255a 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -29,6 +29,8 @@ #include "engines/engine.h" +#include "zvision/scriptManager.h" + #include "gui/debugger.h" namespace ZVision { @@ -56,6 +58,8 @@ class ZVision : public Engine { // We need random numbers Common::RandomSource *_rnd; + ScriptManager _scriptManager; + // To prevent allocation every time we process events Common::Event _event; From b3b7bd29b1fe2dcb2e2c13bbd68c907dc4990552 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:13:02 -0500 Subject: [PATCH 0272/1332] ZVISION: Create ResultAction base class and ActionAdd child class --- engines/zvision/resultAction.cpp | 38 +++++++++++++ engines/zvision/resultAction.h | 92 ++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 engines/zvision/resultAction.cpp create mode 100644 engines/zvision/resultAction.h diff --git a/engines/zvision/resultAction.cpp b/engines/zvision/resultAction.cpp new file mode 100644 index 000000000000..d14438d19051 --- /dev/null +++ b/engines/zvision/resultAction.cpp @@ -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. + * + */ + +#include "common/scummsys.h" + +#include "zvision/resultAction.h" + +namespace ZVision { + +ActionAdd::ActionAdd(Common::String line) { + sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value); +} + +bool ActionAdd::execute(ZVision *zVision) { + zVision->getScriptManager()->addToStateValue(_key, _value); + return true; +} + +} // End of namespace ZVision diff --git a/engines/zvision/resultAction.h b/engines/zvision/resultAction.h new file mode 100644 index 000000000000..4fd589d7cc35 --- /dev/null +++ b/engines/zvision/resultAction.h @@ -0,0 +1,92 @@ +/* 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 ZVISION_RESULT_ACTION_H +#define ZVISION_RESULT_ACTION_H + +#include "common/scummsys.h" + +#include "zvision/zvision.h" + +namespace ZVision { + +class ResultAction { +public: + virtual ~ResultAction() {} + virtual bool execute(ZVision *zVision) = 0; +}; + + +// The different types of actions +// ADD, +// ANIM_PLAY, +// ANIM_PRELOAD, +// ANIM_UNLOAD, +// ATTENUATE, +// ASSIGN, +// CHANGE_LOCATION, +// CROSSFADE, +// DEBUG, +// DELAY_RENDER, +// DISABLE_CONTROL, +// DISABLE_VENUS, +// DISPLAY_MESSAGE, +// DISSOLVE, +// DISTORT, +// ENABLE_CONTROL, +// FLUSH_MOUSE_EVENTS, +// INVENTORY, +// KILL, +// MENU_BAR_ENABLE, +// MUSIC, +// PAN_TRACK, +// PLAY_PRELOAD, +// PREFERENCES, +// QUIT, +// RANDOM, +// REGION, +// RESTORE_GAME, +// ROTATE_TO, +// SAVE_GAME, +// SET_PARTIAL_SCREEN, +// SET_SCREEN, +// SET_VENUS, +// STOP, +// STREAM_VIDEO, +// SYNC_SOUND, +// TIMER, +// TTY_TEXT, +// UNIVERSE_MUSIC, + +class ActionAdd : public ResultAction { +public: + ActionAdd(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _key; + byte _value; +}; + +} // End of namespace ZVision + +#endif From 464cc44a8204134681aadbe68645fd4efe6d04d4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:16:32 -0500 Subject: [PATCH 0273/1332] ZVISION: Convert ScriptManager methods to use ResultAction classes logic --- engines/zvision/puzzle.h | 61 +----- engines/zvision/scrFileHandling.cpp | 284 ++++++++++++---------------- 2 files changed, 129 insertions(+), 216 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 1133adac474d..1a456ef6e21c 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/object.h" +#include "zvision/resultAction.h" namespace ZVision { @@ -39,11 +39,11 @@ enum CriteriaOperator { /** Criteria for a Puzzle result to be fired */ struct Criteria { - /** The id of a global state */ - uint32 id; + /** The key of a global state */ + uint32 key; /** * What we're comparing the value of the global state against - * This can either be a pure value or it can be the id of another global state + * This can either be a pure value or it can be the key of another global state */ uint32 argument; /** How to do the comparison */ @@ -52,55 +52,6 @@ struct Criteria { bool isArgumentAnId; }; -/** What happens when Puzzle criteria are met */ -enum ResultAction { - ADD, - ANIM_PLAY, - ANIM_PRELOAD, - ANIM_UNLOAD, - ATTENUATE, - ASSIGN, - CHANGE_LOCATION, - CROSSFADE, - DEBUG, - DELAY_RENDER, - DISABLE_CONTROL, - DISABLE_VENUS, - DISPLAY_MESSAGE, - DISSOLVE, - DISTORT, - ENABLE_CONTROL, - FLUSH_MOUSE_EVENTS, - INVENTORY, - KILL, - MENU_BAR_ENABLE, - MUSIC, - PAN_TRACK, - PLAY_PRELOAD, - PREFERENCES, - QUIT, - RANDOM, - REGION, - RESTORE_GAME, - ROTATE_TO, - SAVE_GAME, - SET_PARTIAL_SCREEN, - SET_SCREEN, - SET_VENUS, - STOP, - STREAM_VIDEO, - SYNC_SOUND, - TIMER, - TTY_TEXT, - UNIVERSE_MUSIC, -}; - -/** What happens when Puzzle criteria are met */ -struct Result { - ResultAction action; - Common::List arguments; -}; - enum StateFlags : byte { ONCE_PER_INST = 0x01, DO_ME_NOW = 0x02, @@ -108,9 +59,9 @@ enum StateFlags : byte { }; struct Puzzle { - uint32 id; + uint32 key; Common::List criteriaList; - Common::List resultList; + Common::List resultActions; byte flags; }; diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scrFileHandling.cpp index a0d4cebf9ab0..c511a2e64101 100644 --- a/engines/zvision/scrFileHandling.cpp +++ b/engines/zvision/scrFileHandling.cpp @@ -26,6 +26,7 @@ #include "zvision/scriptManager.h" #include "zvision/utility.h" +#include "zvision/puzzle.h" #include "common/textconsole.h" #include "common/file.h" @@ -33,13 +34,11 @@ namespace ZVision { - void ScriptManager::parseScrFile(Common::String fileName) { Common::File file; if (!file.open(fileName)) return; // File.open already throws a warning if the file doesn't exist, so there is no need to throw another - char buffer[1024]; while(!file.eos()) { Common::String line = file.readLine(); if (file.err()) { @@ -52,32 +51,34 @@ void ScriptManager::parseScrFile(Common::String fileName) { continue; if (line.matchString("puzzle:*", true)) { - Puzzle *puzzle = new Puzzle(); - sscanf(line.c_str(),"puzzle:%u",&(puzzle->id)); + Puzzle puzzle; + sscanf(line.c_str(),"puzzle:%u",&(puzzle.id)); parsePuzzle(puzzle, file); + _puzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { - Control *control = new Control(); - sscanf(line.c_str(),"control:%u",&(control->id)); + Control control; + char controlType[20]; + sscanf(line.c_str(),"control:%u %s",&(control.id), controlType); parseControl(control, file); + _controls.push_back(control); } } } -void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream) { +void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream) { Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(line); while (!line.contains('}')) { if (line.matchString("criteria {", true)) - puzzle->criteriaList.push_back(parseCriteria(stream)); + puzzle.criteriaList.push_back(parseCriteria(stream)); else if (line.matchString("results {", true)) - puzzle->resultList.push_back(parseResult(stream)); + parseResult(stream, puzzle.resultActions); else if (line.matchString("flags {", true)) - puzzle->flags = parseFlags(stream); + puzzle.flags = parseFlags(stream); } - } Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const { @@ -125,177 +126,138 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const return criteria; } -Result ScriptManager::parseResult(Common::SeekableReadStream &stream) const { - Result result; - +void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(line); while (!line.contains('}')) { - Common::StringTokenizer tokenizer(line, " :(),"); - // We don't care about the first token - tokenizer.nextToken(); - Common::String token = tokenizer.nextToken(); - - // The second token defines the action - // Use it to set the action enum and then to parse the arguments - if (token.matchString("add", true)) { - result.action = ADD; - ObjectType argTypes[] = { UINT32, UINT32 }; - parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); - } else if (token.matchString("animplay", true)) { - result.action = ANIM_PLAY; + // Parse for the action type + if (line.matchString("*:add*", true)) { + actionList.push_back(ActionAdd(line)); + } else if (line.matchString("*:animplay*", true)) { + - } else if (token.matchString("animpreload", true)) { - result.action = ANIM_PRELOAD; - - } else if (token.matchString("animunload", true)) { - result.action = ANIM_UNLOAD; - - } else if (token.matchString("attenuate", true)) { - result.action = ATTENUATE; + } else if (line.matchString("*:animpreload*", true)) { + - } else if (token.matchString("assign", true)) { - result.action = ASSIGN; - ObjectType argTypes[] = { UINT32, UINT32 }; - parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); - } else if (token.matchString("change_location", true)) { - result.action = CHANGE_LOCATION; - ObjectType argTypes[] = { STRING, STRING, STRING, UINT32 }; - parseResultArguments(result, argTypes, 4, tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken()); - } else if (token.matchString("crossfade", true)) { - result.action = CROSSFADE; - - } else if (token.matchString("debug", true)) { - result.action = DEBUG; - - } else if (token.matchString("delay_render", true)) { - result.action = DELAY_RENDER; - - } else if (token.matchString("disable_control", true)) { - result.action = DISABLE_CONTROL; - - } else if (token.matchString("disable_venus", true)) { - result.action = DISABLE_VENUS; - - } else if (token.matchString("display_message", true)) { - result.action = DISPLAY_MESSAGE; - - } else if (token.matchString("dissolve", true)) { - result.action = DISSOLVE; - } else if (token.matchString("distort", true)) { - result.action = DISTORT; - - } else if (token.matchString("enable_control", true)) { - result.action = ENABLE_CONTROL; - - } else if (token.matchString("flush_mouse_events", true)) { - result.action = FLUSH_MOUSE_EVENTS; - - } else if (token.matchString("inventory", true)) { - result.action = INVENTORY; - - } else if (token.matchString("kill", true)) { - result.action = KILL; - - } else if (token.matchString("menu_bar_enable", true)) { - result.action = MENU_BAR_ENABLE; - - } else if (token.matchString("music", true)) { - result.action = MUSIC; - ObjectType argTypes[] = { UINT32, UINT32, STRING, UINT32, UINT32 }; - parseResultArguments(result, argTypes, 5, - tokenizer.nextToken(), tokenizer.nextToken(), - tokenizer.nextToken(), tokenizer.nextToken(), - tokenizer.nextToken()); - } else if (token.matchString("pan_track", true)) { - result.action = PAN_TRACK; - - } else if (token.matchString("playpreload", true)) { - result.action = PLAY_PRELOAD; - - } else if (token.matchString("preferences", true)) { - result.action = PREFERENCES; - - } else if (token.matchString("quit", true)) { - result.action = QUIT; - - } else if (token.matchString("random", true)) { - result.action = RANDOM; - ObjectType argTypes[] = { UINT32, UINT32 }; - parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); - } else if (token.matchString("region", true)) { - result.action = REGION; - - } else if (token.matchString("restore_game", true)) { - result.action = RESTORE_GAME; - - } else if (token.matchString("rotate_to", true)) { - result.action = ROTATE_TO; - - } else if (token.matchString("save_game", true)) { - result.action = SAVE_GAME; + } else if (line.matchString("*:animunload*", true)) { + - } else if (token.matchString("set_partial_screen", true)) { - result.action = SET_PARTIAL_SCREEN; + } else if (line.matchString("*:attenuate*", true)) { + - } else if (token.matchString("set_screen", true)) { - result.action = SET_SCREEN; + } else if (line.matchString("*:assign*", true)) { + - } else if (token.matchString("set_venus", true)) { - result.action = SET_VENUS; + } else if (line.matchString("*:change_location*", true)) { + - } else if (token.matchString("stop", true)) { - result.action = STOP; - ObjectType argTypes[] = { UINT32 }; - parseResultArguments(result, argTypes, 1, tokenizer.nextToken()); - } else if (token.matchString("streamvideo", true)) { - result.action = STREAM_VIDEO; + } else if (line.matchString("*:crossfade*", true)) { + - } else if (token.matchString("syncsound", true)) { - result.action = SYNC_SOUND; + } else if (line.matchString("*:debug*", true)) { + - } else if (token.matchString("timer", true)) { - result.action = TIMER; - ObjectType argTypes[] = { UINT32, UINT32 }; - parseResultArguments(result, argTypes, 2, tokenizer.nextToken(), tokenizer.nextToken()); - } else if (token.matchString("ttytext", true)) { - result.action = TTY_TEXT; + } else if (line.matchString("*:delay_render*", true)) { + - } else if (token.matchString("universe_music", true)) { - result.action = UNIVERSE_MUSIC; + } else if (line.matchString("*:disable_control*", true)) { + - } else { - warning("Unhandled result action type: ", token); - } + } else if (line.matchString("*:disable_venus*", true)) { + - line = stream.readLine(); - trimCommentsAndWhiteSpace(line); - } + } else if (line.matchString("*:display_message*", true)) { + - return result; -} + } else if (line.matchString("*:dissolve*", true)) { + + + } else if (line.matchString("*:distort*", true)) { + + + } else if (line.matchString("*:enable_control*", true)) { + + + } else if (line.matchString("*:flush_mouse_events*", true)) { + + + } else if (line.matchString("*:inventory*", true)) { + + + } else if (line.matchString("*:kill*", true)) { + + + } else if (line.matchString("*:menu_bar_enable*", true)) { + + + } else if (line.matchString("*:music*", true)) { + + + } else if (line.matchString("*:pan_track*", true)) { + + + } else if (line.matchString("*:playpreload*", true)) { + + + } else if (line.matchString("*:preferences*", true)) { + + + } else if (line.matchString("*:quit*", true)) { + + + } else if (line.matchString("*:random*", true)) { + + + } else if (line.matchString("*:region*", true)) { + + + } else if (line.matchString("*:restore_game*", true)) { + + + } else if (line.matchString("*:rotate_to*", true)) { + + + } else if (line.matchString("*:save_game*", true)) { + + + } else if (line.matchString("*:set_partial_screen*", true)) { + + + } else if (line.matchString("*:set_screen*", true)) { + + + } else if (line.matchString("*:set_venus*", true)) { + + + } else if (line.matchString("*:stop*", true)) { + + + } else if (line.matchString("*:streamvideo*", true)) { + + + } else if (line.matchString("*:syncsound*", true)) { + + + } else if (line.matchString("*:timer*", true)) { + + + } else if (line.matchString("*:ttytext*", true)) { + + + } else if (line.matchString("*:universe_music*", true)) { + -void ScriptManager::parseResultArguments(Result &result, const ObjectType *types, int numberOfArgs, ...) const { - va_list argptr; - va_start(argptr, numberOfArgs); - - for (int i = 0; i < numberOfArgs; i++) { - if (types[i] == UINT32) { - Common::String arg = va_arg(argptr, Common::String); - Object argObject(UINT32); - sscanf(arg.c_str(), "%u", &argObject); - result.arguments.push_back(argObject); - break; } else { - Common::String arg = va_arg(argptr, Common::String); - result.arguments.push_back(Object(arg)); - break; + warning("Unhandled result action type: ", line); } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(line); } - va_end(argptr); + return; } byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { @@ -318,7 +280,7 @@ byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { return flags; } -void ScriptManager::parseControl(Control *control, Common::SeekableReadStream &stream) { +void ScriptManager::parseControl(Control &control, Common::SeekableReadStream &stream) { } From b70f85b9a0775212f47c25f5218e63b117d0c696 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:18:21 -0500 Subject: [PATCH 0274/1332] ZVISION: Comment clarification for ScriptManager methods and helper structs --- engines/zvision/scrFileHandling.cpp | 4 +- engines/zvision/scriptManager.h | 63 +++++++++++++++-------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scrFileHandling.cpp index c511a2e64101..61feb12b7e08 100644 --- a/engines/zvision/scrFileHandling.cpp +++ b/engines/zvision/scrFileHandling.cpp @@ -113,10 +113,10 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const token = tokenizer.nextToken(); if (token.contains('[')) { sscanf(token.c_str(), "[%u]", &(criteria.argument)); - criteria.argumentIsAnId = true; + criteria.isArgumentAnId = true; } else { sscanf(token.c_str(), "%u", &(criteria.argument)); - criteria.argumentIsAnId = false; + criteria.isArgumentAnId = false; } line = stream.readLine(); diff --git a/engines/zvision/scriptManager.h b/engines/zvision/scriptManager.h index 0bae91945d66..563a010de502 100644 --- a/engines/zvision/scriptManager.h +++ b/engines/zvision/scriptManager.h @@ -29,17 +29,27 @@ #include "zvision/puzzle.h" #include "zvision/control.h" +#include "zvision/singleValueContainer.h" namespace ZVision { class ScriptManager { -public: - ScriptManager(); - ~ScriptManager(); - private: + /** Holds the global state variables. Optimize for fast random access */ Common::HashMap _globalState; + /** Holds the currently active puzzles. Optimize for fast iteration */ + Common::List _puzzles; + /** Holds the currently active controls. Optimize for fast iteration */ + Common::List _controls; +public: + + void initialize(); + byte getStateValue(uint32 key); + void setStateValue(uint32 key, byte value); + void addToStateValue(uint32 key, byte valueToAdd); + +private: /** * Parses a script file into triggers and events * @@ -48,54 +58,47 @@ class ScriptManager { void parseScrFile(Common::String fileName); /** - * Helper method for parseScrFile. Parses the stream into a Puzzle object + * Parses the stream into a Puzzle object + * Helper method for parseScrFile. * - * @param puzzle The object to store what is parsed - * @param stream Scr file stream + * @param puzzle The object to store what is parsed + * @param stream Scr file stream */ - void parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream); + void parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream); /** - * Helper method for parsePuzzle. Parses the stream into a Criteria object + * Parses the stream into a Criteria object + * Helper method for parsePuzzle. * - * @param stream Scr file stream - * @return Created Criteria object + * @param stream Scr file stream + * @return Created Criteria object */ Criteria parseCriteria(Common::SeekableReadStream &stream) const; /** - * Helper method for parsePuzzle. Parses the stream into a Results object - * - * @param stream Scr file stream - * @return Created Results object - */ - Result parseResult(Common::SeekableReadStream &stream) const; - - /** - * Helper method for parseResults. Parses a number of strings into Object types. + * Parses the stream into a Results object + * Helper method for parsePuzzle. * - * @param result Results object to store the arguments in - * @param types The type of the each of the arguments. IE. BOOL, UINT32, etc. - * @param numberOfArgs The number of arguments. This has to equal the length of 'types' AND the number of optional arguments passed. - * @param String arguments wanting to be parsed + * @param stream Scr file stream + * @return Created Results object */ - void parseResultArguments(Result &result, const ObjectType *types, int numberOfArgs, ...) const; + void parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum * - * @param stream Scr file stream - * @return Bitwise or of all the flags set within the puzzle + * @param stream Scr file stream + * @return Bitwise or of all the flags set within the puzzle */ byte parseFlags(Common::SeekableReadStream &stream) const; /** * Helper method for parseScrFile. Parses the stream into a Control object * - * @param control The object to store what is parsed - * @param stream Scr file stream + * @param control The object to store what is parsed + * @param stream Scr file stream */ - void parseControl(Control *control, Common::SeekableReadStream &stream); + void parseControl(Control &control, Common::SeekableReadStream &stream); }; From dec34c174bd34f1fd1354985e7c70336270dd9e6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:19:09 -0500 Subject: [PATCH 0275/1332] ZVISION: Create global state accessor/mutator methods for ScriptManager --- engines/zvision/scriptManager.cpp | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 engines/zvision/scriptManager.cpp diff --git a/engines/zvision/scriptManager.cpp b/engines/zvision/scriptManager.cpp new file mode 100644 index 000000000000..5317bf60f163 --- /dev/null +++ b/engines/zvision/scriptManager.cpp @@ -0,0 +1,46 @@ +/* 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/scummsys.h" + +#include "zvision/scriptManager.h" + +namespace ZVision { + +// TODO: Actually do something in the initialize or remove it +void ScriptManager::initialize() { + +} + +byte ScriptManager::getStateValue(uint32 key) { + return _globalState[key]; +} + +void ScriptManager::setStateValue(uint32 key, byte value) { + _globalState[key] = value; +} + +void ScriptManager::addToStateValue(uint32 key, byte valueToAdd) { + _globalState[key] += valueToAdd; +} + +} // End of namespace ZVision From 8d9f90bf12c758ac4845f19ae8584c0c5ee264c8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:23:57 -0500 Subject: [PATCH 0276/1332] ZVISION: Create ScriptManager accessor for ZVision Having the ScriptManager as a member variable forced it to be const, which prevented any non cont methods to be used. Thus, ScriptManager is created on the heap and disposed after use. --- engines/zvision/zvision.cpp | 16 ++++++++++++---- engines/zvision/zvision.h | 5 +++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 2009ccde447a..33b2a80bd439 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -60,19 +60,23 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); - // Don't forget to register your random source + // Register random source _rnd = new Common::RandomSource("zvision"); + // Create managers + _scriptManager = new ScriptManager(); + debug("ZVision::ZVision"); } ZVision::~ZVision() { debug("ZVision::~ZVision"); - // Dispose your resources here + // Dispose of resources + delete _scriptManager; delete _rnd; - // Remove all of our debug levels here + // Remove all of our debug levels DebugMan.clearAllDebugChannels(); } @@ -93,7 +97,7 @@ void ZVision::initialize() { Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 initGraphics(640, 480, true, &format); - _scriptManager.initialize(); + _scriptManager->initialize(); // Create debugger console. It requires GFX to be initialized _console = new Console(this); @@ -134,4 +138,8 @@ Common::Error ZVision::run() { return Common::kNoError; } +ScriptManager *ZVision::getScriptManager() const { + return _scriptManager; +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index b57ce20e255a..b0cd1aec5a93 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -58,7 +58,7 @@ class ZVision : public Engine { // We need random numbers Common::RandomSource *_rnd; - ScriptManager _scriptManager; + ScriptManager *_scriptManager; // To prevent allocation every time we process events Common::Event _event; @@ -69,7 +69,8 @@ class ZVision : public Engine { uint32 getFeatures() const; Common::Language getLanguage() const; virtual Common::Error run(); - + ScriptManager *getScriptManager() const; + private: void initialize(); From 7bc0097ddef3bbbb38bf854a2ed8685c92fd3312 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:24:20 -0500 Subject: [PATCH 0277/1332] ZVISION: Fix include for singleValueContainer.cpp --- engines/zvision/singleValueContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/singleValueContainer.cpp b/engines/zvision/singleValueContainer.cpp index 6a3d4e047ddc..bd91c44daf4a 100644 --- a/engines/zvision/singleValueContainer.cpp +++ b/engines/zvision/singleValueContainer.cpp @@ -23,7 +23,7 @@ #include "common/scummsys.h" #include "common/textconsole.h" -#include "zvision/object.h" +#include "zvision/singleValueContainer.h" namespace ZVision { From daa2c4b67060ba8c86b11f60a59f1b59fec5037f Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:26:12 -0500 Subject: [PATCH 0278/1332] ZVISION: Move test functions out of video.cpp and into their own file The file only exist to hold the code. The actual tests will be moved to an appropriate location later. --- engines/zvision/tests.h | 54 +++++++++++++++++++++++++++++++++++++++ engines/zvision/video.cpp | 50 ------------------------------------ 2 files changed, 54 insertions(+), 50 deletions(-) create mode 100644 engines/zvision/tests.h diff --git a/engines/zvision/tests.h b/engines/zvision/tests.h new file mode 100644 index 000000000000..14f80ed83be7 --- /dev/null +++ b/engines/zvision/tests.h @@ -0,0 +1,54 @@ + +namespace ZVision { + +void tests() { +#if 0 + // Video test + Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); + if (videoDecoder && videoDecoder->loadFile("zassets/temple/t000a11c.avi")) { + Common::List formats; + formats.push_back(videoDecoder->getPixelFormat()); + //initGraphics(640, 480, true, formats); + + playVideo(videoDecoder); + } +#endif + + Common::File f; + +#if 1 + // Image test + + //initGraphics(640, 480, true, &format); + + if (f.open(" zassets/global/GJDEB11C.TGA")) { + Graphics::TGADecoder tga; + if (!tga.loadStream(f)) + error("Error while reading TGA image"); + f.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + Graphics::Surface *screen = g_system->lockScreen(); + for (uint16 y = 0; y < tgaSurface->h; y++) + memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); + g_system->unlockScreen(); + + tga.destroy(); + } + + +#endif + +#if 0 + // Sound test + if (f.open("zassets/castle/c000h9tc.raw")) { + Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); + Audio::SoundHandle handle; + g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + } + +#endif +} + +} // End of namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index ce686839e8db..4e5fe82f9790 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -132,54 +132,4 @@ void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { delete videoDecoder; } -void tests() { -#if 0 - // Video test - Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); - if (videoDecoder && videoDecoder->loadFile("zassets/temple/t000a11c.avi")) { - Common::List formats; - formats.push_back(videoDecoder->getPixelFormat()); - //initGraphics(640, 480, true, formats); - - playVideo(videoDecoder); - } -#endif - - Common::File f; - -#if 0 - // Image test - - //initGraphics(640, 480, true, &format); - - if (f.open("zassets/castle/cb8eb11c.tga")) { - Graphics::TGADecoder tga; - if (!tga.loadStream(f)) - error("Error while reading TGA image"); - f.close(); - - const Graphics::Surface *tgaSurface = tga.getSurface(); - - Graphics::Surface *screen = g_system->lockScreen(); - for (uint16 y = 0; y < tgaSurface->h; y++) - memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); - g_system->unlockScreen(); - - tga.destroy(); - } - - -#endif - -#if 0 - // Sound test - if (f.open("zassets/castle/c000h9tc.raw")) { - Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); - Audio::SoundHandle handle; - g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); - } - -#endif -} - } // End of namespace ZVision From f99d613dcb1022a6c30b0c299ffada11fb7eba6b Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 15:12:24 -0500 Subject: [PATCH 0279/1332] ZVISION: Rename files to use underscores instead of camelCase --- engines/zvision/{resultAction.cpp => result_action.cpp} | 0 engines/zvision/{resultAction.h => result_action.h} | 0 engines/zvision/{scrFileHandling.cpp => scr_file_handling.cpp} | 0 engines/zvision/{scriptManager.cpp => script_manager.cpp} | 0 engines/zvision/{scriptManager.h => script_manager.h} | 0 .../{singleValueContainer.cpp => single_value_container.cpp} | 0 .../zvision/{singleValueContainer.h => single_value_container.h} | 0 engines/zvision/{zfsArchive.cpp => zfs_archive.cpp} | 0 engines/zvision/{zfsArchive.h => zfs_archive.h} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename engines/zvision/{resultAction.cpp => result_action.cpp} (100%) rename engines/zvision/{resultAction.h => result_action.h} (100%) rename engines/zvision/{scrFileHandling.cpp => scr_file_handling.cpp} (100%) rename engines/zvision/{scriptManager.cpp => script_manager.cpp} (100%) rename engines/zvision/{scriptManager.h => script_manager.h} (100%) rename engines/zvision/{singleValueContainer.cpp => single_value_container.cpp} (100%) rename engines/zvision/{singleValueContainer.h => single_value_container.h} (100%) rename engines/zvision/{zfsArchive.cpp => zfs_archive.cpp} (100%) rename engines/zvision/{zfsArchive.h => zfs_archive.h} (100%) diff --git a/engines/zvision/resultAction.cpp b/engines/zvision/result_action.cpp similarity index 100% rename from engines/zvision/resultAction.cpp rename to engines/zvision/result_action.cpp diff --git a/engines/zvision/resultAction.h b/engines/zvision/result_action.h similarity index 100% rename from engines/zvision/resultAction.h rename to engines/zvision/result_action.h diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scr_file_handling.cpp similarity index 100% rename from engines/zvision/scrFileHandling.cpp rename to engines/zvision/scr_file_handling.cpp diff --git a/engines/zvision/scriptManager.cpp b/engines/zvision/script_manager.cpp similarity index 100% rename from engines/zvision/scriptManager.cpp rename to engines/zvision/script_manager.cpp diff --git a/engines/zvision/scriptManager.h b/engines/zvision/script_manager.h similarity index 100% rename from engines/zvision/scriptManager.h rename to engines/zvision/script_manager.h diff --git a/engines/zvision/singleValueContainer.cpp b/engines/zvision/single_value_container.cpp similarity index 100% rename from engines/zvision/singleValueContainer.cpp rename to engines/zvision/single_value_container.cpp diff --git a/engines/zvision/singleValueContainer.h b/engines/zvision/single_value_container.h similarity index 100% rename from engines/zvision/singleValueContainer.h rename to engines/zvision/single_value_container.h diff --git a/engines/zvision/zfsArchive.cpp b/engines/zvision/zfs_archive.cpp similarity index 100% rename from engines/zvision/zfsArchive.cpp rename to engines/zvision/zfs_archive.cpp diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfs_archive.h similarity index 100% rename from engines/zvision/zfsArchive.h rename to engines/zvision/zfs_archive.h From 1710468121648d494a393f7176c81027fec573c4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 15:45:46 -0500 Subject: [PATCH 0280/1332] ZVISION: Fix includes to use new underscore names --- engines/zvision/puzzle.h | 2 +- engines/zvision/result_action.cpp | 2 +- engines/zvision/scr_file_handling.cpp | 2 +- engines/zvision/script_manager.cpp | 2 +- engines/zvision/script_manager.h | 2 +- engines/zvision/zfs_archive.cpp | 2 +- engines/zvision/zvision.cpp | 4 ++-- engines/zvision/zvision.h | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 1a456ef6e21c..75d3dc0826df 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/resultAction.h" +#include "zvision/result_action.h" namespace ZVision { diff --git a/engines/zvision/result_action.cpp b/engines/zvision/result_action.cpp index d14438d19051..375dcd2f59d6 100644 --- a/engines/zvision/result_action.cpp +++ b/engines/zvision/result_action.cpp @@ -22,7 +22,7 @@ #include "common/scummsys.h" -#include "zvision/resultAction.h" +#include "zvision/result_action.h" namespace ZVision { diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 61feb12b7e08..d18e0428154d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -24,7 +24,7 @@ #include -#include "zvision/scriptManager.h" +#include "zvision/script_manager.h" #include "zvision/utility.h" #include "zvision/puzzle.h" diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 5317bf60f163..13438d4fa688 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -22,7 +22,7 @@ #include "common/scummsys.h" -#include "zvision/scriptManager.h" +#include "zvision/script_manager.h" namespace ZVision { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 563a010de502..7f46bd51feb9 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -29,7 +29,7 @@ #include "zvision/puzzle.h" #include "zvision/control.h" -#include "zvision/singleValueContainer.h" +#include "zvision/result_action.h" namespace ZVision { diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index e65d0df14e45..85933b32406d 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -22,7 +22,7 @@ #include "common/scummsys.h" -#include "zvision/zfsArchive.h" +#include "zvision/zfs_archive.h" #include "common/hashmap.h" #include "common/memstream.h" #include "common/debug.h" diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 33b2a80bd439..5af1cbb1a251 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -32,8 +32,8 @@ #include "engines/util.h" #include "zvision/zvision.h" -#include "zvision/scriptManager.h" -#include "zvision/zfsArchive.h" +#include "zvision/script_manager.h" +#include "zvision/zfs_archive.h" #include "graphics/decoders/tga.h" diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index b0cd1aec5a93..166d3c023f8d 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -29,7 +29,7 @@ #include "engines/engine.h" -#include "zvision/scriptManager.h" +#include "zvision/script_manager.h" #include "gui/debugger.h" From 0b9dce40a08020499aab20d8c9d967f53f7d84ea Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 15:46:36 -0500 Subject: [PATCH 0281/1332] ZVISION: Fix usage of Puzzle struct to use 'key' instead of 'id' --- engines/zvision/scr_file_handling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index d18e0428154d..073d0eaaa46d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -52,7 +52,7 @@ void ScriptManager::parseScrFile(Common::String fileName) { if (line.matchString("puzzle:*", true)) { Puzzle puzzle; - sscanf(line.c_str(),"puzzle:%u",&(puzzle.id)); + sscanf(line.c_str(),"puzzle:%u",&(puzzle.key)); parsePuzzle(puzzle, file); _puzzles.push_back(puzzle); @@ -95,7 +95,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const // Parse the id out of the first token token = tokenizer.nextToken(); - sscanf(token.c_str(), "[%u]", &(criteria.id)); + sscanf(token.c_str(), "[%u]", &(criteria.key)); // Parse the operator out of the second token token = tokenizer.nextToken(); From c0c4ee65339285652b7966afa66a48d012d6ea27 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 17:19:54 -0500 Subject: [PATCH 0282/1332] ZVISION: Fix single_value_container.h include to use the new file name --- engines/zvision/single_value_container.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/single_value_container.cpp b/engines/zvision/single_value_container.cpp index bd91c44daf4a..7e27098377e2 100644 --- a/engines/zvision/single_value_container.cpp +++ b/engines/zvision/single_value_container.cpp @@ -23,7 +23,7 @@ #include "common/scummsys.h" #include "common/textconsole.h" -#include "zvision/singleValueContainer.h" +#include "zvision/single_value_container.h" namespace ZVision { From 187c119e934fd5887fb26e2dada5e1a4c856e056 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 17:21:21 -0500 Subject: [PATCH 0283/1332] ZVISION: Create ResultAction 's for Add and Random. Create class templates for PlayAnimation, PreloadAnimation, and Attenuate --- engines/zvision/result_action.cpp | 30 +++++++++++++++++++++ engines/zvision/result_action.h | 38 +++++++++++++++++++++++++++ engines/zvision/scr_file_handling.cpp | 7 +++-- engines/zvision/zvision.cpp | 4 +++ engines/zvision/zvision.h | 3 ++- 5 files changed, 77 insertions(+), 5 deletions(-) diff --git a/engines/zvision/result_action.cpp b/engines/zvision/result_action.cpp index 375dcd2f59d6..de439db1b97e 100644 --- a/engines/zvision/result_action.cpp +++ b/engines/zvision/result_action.cpp @@ -26,6 +26,9 @@ namespace ZVision { +// ActionAdd +////////////////////////////////////////////////////////////////////////////// + ActionAdd::ActionAdd(Common::String line) { sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value); } @@ -35,4 +38,31 @@ bool ActionAdd::execute(ZVision *zVision) { return true; } + +// ActionAssign +////////////////////////////////////////////////////////////////////////////// + +ActionAssign::ActionAssign(Common::String line) { + sscanf(line.c_str(), ":assign(%u, %hhu)", &_key, &_value); +} + +bool ActionAssign::execute(ZVision *zVision) { + zVision->getScriptManager()->setStateValue(_key, _value); + return true; +} + + +// ActionRandom +////////////////////////////////////////////////////////////////////////////// + +ActionRandom::ActionRandom(Common::String line) { + sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); +} + +bool ActionRandom::execute(ZVision *zVision) { + uint32 randNumber = zVision->getRandomSource()->getRandomNumber(_max); + zVision->getScriptManager()->setStateValue(_key, randNumber); + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/result_action.h b/engines/zvision/result_action.h index 4fd589d7cc35..7ab896d5109f 100644 --- a/engines/zvision/result_action.h +++ b/engines/zvision/result_action.h @@ -87,6 +87,44 @@ class ActionAdd : public ResultAction { byte _value; }; +class ActionPlayAnimation : public ResultAction { +public: + ActionPlayAnimation(Common::String line); + bool execute(ZVision *zVision); +}; + +class ActionPreloadAnimation : public ResultAction { +public: + ActionPreloadAnimation(Common::String line); + bool execute(ZVision *zVision); +}; + +class ActionAttenuate : public ResultAction { +public: + ActionAttenuate(Common::String line); + bool execute(ZVision *zVision); +}; + +class ActionAssign : public ResultAction { +public: + ActionAssign(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _key; + byte _value; +}; + +class ActionRandom : public ResultAction { +public: + ActionRandom(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _key; + uint32 _max; +}; + } // End of namespace ZVision #endif diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 073d0eaaa46d..3171492717a5 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -131,16 +131,15 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(line); + // TODO: Re-order the if-then statements in order of highest occurrence while (!line.contains('}')) { // Parse for the action type if (line.matchString("*:add*", true)) { actionList.push_back(ActionAdd(line)); } else if (line.matchString("*:animplay*", true)) { - - + actionList.push_back(ActionPlayAnimation(line)); } else if (line.matchString("*:animpreload*", true)) { - - + actionList.push_back(ActionPreloadAnimation(line)); } else if (line.matchString("*:animunload*", true)) { diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 5af1cbb1a251..479bf2379a6a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -142,4 +142,8 @@ ScriptManager *ZVision::getScriptManager() const { return _scriptManager; } +Common::RandomSource *ZVision::getRandomSource() const { + return _rnd; +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 166d3c023f8d..ac5796ad91f4 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -70,6 +70,7 @@ class ZVision : public Engine { Common::Language getLanguage() const; virtual Common::Error run(); ScriptManager *getScriptManager() const; + Common::RandomSource *getRandomSource() const; private: void initialize(); @@ -89,7 +90,7 @@ class Console : public GUI::Debugger { Console(ZVision *vm) {} virtual ~Console(void) {} }; - + } // End of namespace ZVision #endif From 16cc970c9e1c7ccc06088de732abcd6ac51fa26a Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 17:50:40 -0500 Subject: [PATCH 0284/1332] ZVISION: Normalize remaining CRLF to LF for the remote --- engines/zvision/detection.cpp | 512 +++++++++++++-------------- engines/zvision/module.mk | 34 +- engines/zvision/zork_avi_decoder.cpp | 100 +++--- engines/zvision/zork_avi_decoder.h | 118 +++--- engines/zvision/zork_raw.cpp | 376 ++++++++++---------- engines/zvision/zork_raw.h | 134 +++---- engines/zvision/zvision.cpp | 298 ++++++++-------- engines/zvision/zvision.h | 188 +++++----- 8 files changed, 880 insertions(+), 880 deletions(-) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 62d834ac3ff4..5488ae5be4cb 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -1,256 +1,256 @@ -/* 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 "common/translation.h" -#include "common/savefile.h" -#include "common/str-array.h" -#include "common/system.h" - -#include "zvision/zvision.h" - - -namespace ZVision { - -struct ZVisionGameDescription { - ADGameDescription desc; -}; - -uint32 ZVision::getFeatures() const { - return _gameDescription->desc.flags; -} - -Common::Language ZVision::getLanguage() const { - return _gameDescription->desc.language; -} - -} - -static const PlainGameDescriptor zVisionGames[] = { - {"zvision", "ZVision Game"}, - {"znemesis", "Zork Nemesis: The Forbidden Lands"}, - {"zgi", "Zork: Grand Inquisitor"}, - {0, 0} -}; - - -namespace ZVision { - -static const ZVisionGameDescription gameDescriptions[] = { - - { - // Zork Nemesis English version - { - "znemesis", - 0, - AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), - Common::EN_ANY, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) - }, - }, - - { AD_TABLE_END_MARKER } -}; - -} // End of namespace ZVision - -static const char *directoryGlobs[] = { - "znemscr", - 0 -}; - -static const ExtraGuiOption ZVisionExtraGuiOption = { - _s("Use original save/load screens"), - _s("Use the original save/load screens, instead of the ScummVM ones"), - "originalsaveload", - false -}; - -class ZVisionMetaEngine : public AdvancedMetaEngine { -public: - ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { - _maxScanDepth = 2; - _directoryGlobs = directoryGlobs; - _singleid = "zvision"; - } - - virtual const char *getName() const { - return "ZVision"; - } - - virtual const char *getOriginalCopyright() const { - return "ZVision Activision (C) 1996"; - } - - 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; - SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; -}; - -bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; - /* - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); - */ -} - -/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { - return - (f == kSupportsRTL) || - (f == kSupportsLoadingDuringRuntime) || - (f == kSupportsSavingDuringRuntime); -}*/ - -bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { - const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; - if (gd) { - *engine = new ZVision::ZVision(syst, gd); - } - return gd != 0; -} - -const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { - ExtraGuiOptions options; - options.push_back(ZVisionExtraGuiOption); - return options; -} - -SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { - //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - /*ZVision::ZVision::SaveHeader header; - Common::String pattern = target; - pattern += ".???"; - - Common::StringArray filenames; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ - - SaveStateList saveList; -/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { - if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { - saveList.push_back(SaveStateDescriptor(slotNum, header.description)); - } - delete in; - } - } - }*/ - - return saveList; -} - -int ZVisionMetaEngine::getMaximumSaveSlot() const { - return 999; -} - -void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { - /* - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - - saveFileMan->removeSavefile(filename.c_str()); - - Common::StringArray filenames; - Common::String pattern = target; - pattern += ".???"; - filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) - - for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - // Rename every slot greater than the deleted slot, - if (slotNum > slot) { - saveFileMan->renameSavefile(file->c_str(), filename.c_str()); - filename = ZVision::ZVision::getSavegameFilename(target, ++slot); - } - } - */ -} - -SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - /* - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); - Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); - - if (in) { - ZVision::ZVision::SaveHeader header; - ZVision::ZVision::kReadSaveHeaderError error; - - error = ZVision::ZVision::readSaveHeader(in, true, header); - delete in; - - if (error == ZVision::ZVision::kRSHENoError) { - SaveStateDescriptor desc(slot, header.description); - - desc.setThumbnail(header.thumbnail); - - if (header.version > 0) { - int day = (header.saveDate >> 24) & 0xFF; - int month = (header.saveDate >> 16) & 0xFF; - int year = header.saveDate & 0xFFFF; - - desc.setSaveDate(year, month, day); - - int hour = (header.saveTime >> 16) & 0xFF; - int minutes = (header.saveTime >> 8) & 0xFF; - - desc.setSaveTime(hour, minutes); - - desc.setPlayTime(header.playTime * 1000); - } - - return desc; - } - } - */ - - return SaveStateDescriptor(); -} - -#if PLUGIN_ENABLED_DYNAMIC(ZVISION) - REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#else - REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); -#endif +/* 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 "common/translation.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/system.h" + +#include "zvision/zvision.h" + + +namespace ZVision { + +struct ZVisionGameDescription { + ADGameDescription desc; +}; + +uint32 ZVision::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language ZVision::getLanguage() const { + return _gameDescription->desc.language; +} + +} + +static const PlainGameDescriptor zVisionGames[] = { + {"zvision", "ZVision Game"}, + {"znemesis", "Zork Nemesis: The Forbidden Lands"}, + {"zgi", "Zork: Grand Inquisitor"}, + {0, 0} +}; + + +namespace ZVision { + +static const ZVisionGameDescription gameDescriptions[] = { + + { + // Zork Nemesis English version + { + "znemesis", + 0, + AD_ENTRY1s("CSCR.ZFS", "88226e51a205d2e50c67a5237f3bd5f2", 2397741), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace ZVision + +static const char *directoryGlobs[] = { + "znemscr", + 0 +}; + +static const ExtraGuiOption ZVisionExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + +class ZVisionMetaEngine : public AdvancedMetaEngine { +public: + ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; + _singleid = "zvision"; + } + + virtual const char *getName() const { + return "ZVision"; + } + + virtual const char *getOriginalCopyright() const { + return "ZVision Activision (C) 1996"; + } + + 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; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; + /* + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); + */ +} + +/*bool ZVision::ZVision::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +}*/ + +bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const ZVision::ZVisionGameDescription *gd = (const ZVision::ZVisionGameDescription *)desc; + if (gd) { + *engine = new ZVision::ZVision(syst, gd); + } + return gd != 0; +} + +const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(ZVisionExtraGuiOption); + return options; +} + +SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { + //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + /*ZVision::ZVision::SaveHeader header; + Common::String pattern = target; + pattern += ".???"; + + Common::StringArray filenames; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + + SaveStateList saveList; +/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { + saveList.push_back(SaveStateDescriptor(slotNum, header.description)); + } + delete in; + } + } + }*/ + + return saveList; +} + +int ZVisionMetaEngine::getMaximumSaveSlot() const { + return 999; +} + +void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { + /* + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + + saveFileMan->removeSavefile(filename.c_str()); + + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = ZVision::ZVision::getSavegameFilename(target, ++slot); + } + } + */ +} + +SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + /* + Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + ZVision::ZVision::SaveHeader header; + ZVision::ZVision::kReadSaveHeaderError error; + + error = ZVision::ZVision::readSaveHeader(in, true, header); + delete in; + + if (error == ZVision::ZVision::kRSHENoError) { + SaveStateDescriptor desc(slot, header.description); + + desc.setThumbnail(header.thumbnail); + + if (header.version > 0) { + int day = (header.saveDate >> 24) & 0xFF; + int month = (header.saveDate >> 16) & 0xFF; + int year = header.saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (header.saveTime >> 16) & 0xFF; + int minutes = (header.saveTime >> 8) & 0xFF; + + desc.setSaveTime(hour, minutes); + + desc.setPlayTime(header.playTime * 1000); + } + + return desc; + } + } + */ + + return SaveStateDescriptor(); +} + +#if PLUGIN_ENABLED_DYNAMIC(ZVISION) + REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#else + REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 854ee0307c28..3dd17a2f99df 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -1,18 +1,18 @@ -MODULE := engines/zvision - -MODULE_OBJS := \ - detection.o \ - zvision.o \ - zork_avi_decoder.o \ - zork_raw.o - -MODULE_DIRS += \ - engines/zvision - -# This module can be built as a plugin -ifeq ($(ENABLE_ZVISION), DYNAMIC_PLUGIN) -PLUGIN := 1 -endif - -# Include common rules +MODULE := engines/zvision + +MODULE_OBJS := \ + detection.o \ + zvision.o \ + zork_avi_decoder.o \ + zork_raw.o + +MODULE_DIRS += \ + engines/zvision + +# This module can be built as a plugin +ifeq ($(ENABLE_ZVISION), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules include $(srcdir)/rules.mk \ No newline at end of file diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp index 2da524655be3..4ceff48891dc 100644 --- a/engines/zvision/zork_avi_decoder.cpp +++ b/engines/zvision/zork_avi_decoder.cpp @@ -1,50 +1,50 @@ -/* 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/scummsys.h" - -#include "common/stream.h" -#include "audio/audiostream.h" - -#include "engines/zvision/zork_avi_decoder.h" -#include "engines/zvision/zork_raw.h" - -namespace ZVision { - -Video::AVIDecoder::AVIAudioTrack *ZVision::ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { - ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack *audioTrack = new ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); - return (Video::AVIDecoder::AVIAudioTrack *)audioTrack; -} - -void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { - if (_audStream) { - if (_wvInfo.tag == kWaveFormatZorkPCM) { - assert(_wvInfo.size == 8); - _audStream->queueAudioStream(makeRawZorkStream(stream, _wvInfo.samplesPerSec, DisposeAfterUse::YES), DisposeAfterUse::YES); - } - } else { - delete stream; - } -} - -} // End of namespace ZVision +/* 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/scummsys.h" + +#include "common/stream.h" +#include "audio/audiostream.h" + +#include "engines/zvision/zork_avi_decoder.h" +#include "engines/zvision/zork_raw.h" + +namespace ZVision { + +Video::AVIDecoder::AVIAudioTrack *ZVision::ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { + ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack *audioTrack = new ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); + return (Video::AVIDecoder::AVIAudioTrack *)audioTrack; +} + +void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { + if (_audStream) { + if (_wvInfo.tag == kWaveFormatZorkPCM) { + assert(_wvInfo.size == 8); + _audStream->queueAudioStream(makeRawZorkStream(stream, _wvInfo.samplesPerSec, DisposeAfterUse::YES), DisposeAfterUse::YES); + } + } else { + delete stream; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h index 5530d92ce48b..1dff30489441 100644 --- a/engines/zvision/zork_avi_decoder.h +++ b/engines/zvision/zork_avi_decoder.h @@ -1,59 +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 ZORK_AVI_DECODER_H -#define ZORK_AVI_DECODER_H - -#include "video/avi_decoder.h" - -namespace ZVision { - -class ZorkAVIDecoder : public Video::AVIDecoder { -public: - ZorkAVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : - Video::AVIDecoder(soundType) {} - - virtual ~ZorkAVIDecoder() {} - -private: - class ZorkAVIAudioTrack : public Video::AVIDecoder::AVIAudioTrack { - public: - ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) : - Video::AVIDecoder::AVIAudioTrack(streamHeader, waveFormat, soundType) {} - virtual ~ZorkAVIAudioTrack() {} - - void queueSound(Common::SeekableReadStream *stream); - }; - - Video::AVIDecoder::AVIAudioTrack *createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo); - - private: - // Audio Codecs - enum { - kWaveFormatZorkPCM = 17 // special Zork PCM audio format (clashes with MS IMA ADPCM) - }; -}; - -} // End of namespace ZVision - -#endif +/* 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 ZORK_AVI_DECODER_H +#define ZORK_AVI_DECODER_H + +#include "video/avi_decoder.h" + +namespace ZVision { + +class ZorkAVIDecoder : public Video::AVIDecoder { +public: + ZorkAVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : + Video::AVIDecoder(soundType) {} + + virtual ~ZorkAVIDecoder() {} + +private: + class ZorkAVIAudioTrack : public Video::AVIDecoder::AVIAudioTrack { + public: + ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) : + Video::AVIDecoder::AVIAudioTrack(streamHeader, waveFormat, soundType) {} + virtual ~ZorkAVIAudioTrack() {} + + void queueSound(Common::SeekableReadStream *stream); + }; + + Video::AVIDecoder::AVIAudioTrack *createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo); + + private: + // Audio Codecs + enum { + kWaveFormatZorkPCM = 17 // special Zork PCM audio format (clashes with MS IMA ADPCM) + }; +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index e008741e160b..d920550bc72d 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -1,188 +1,188 @@ -/* 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/scummsys.h" - -#include "common/endian.h" -#include "common/memstream.h" -#include "common/textconsole.h" -#include "common/util.h" - -#include "audio/audiostream.h" - -#include "engines/zvision/zork_raw.h" - -namespace ZVision { - -#pragma mark - -#pragma mark --- RawZorkStream --- -#pragma mark - - -/** - * This is a stream, which allows for playing raw PCM data from a stream. - */ -class RawZorkStream : public Audio::SeekableAudioStream { -public: - RawZorkStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) - : _rate(rate), _playtime(0, rate), _stream(stream, disposeStream), _endOfData(false), _buffer(0) { - // Setup our buffer for readBuffer - _buffer = new byte[kSampleBufferLength]; - assert(_buffer); - - // Calculate the total playtime of the stream - _playtime = Audio::Timestamp(0, _stream->size() / 2 / 1, rate); - } - - ~RawZorkStream() { - delete[] _buffer; - } - - int readBuffer(int16 *buffer, const int numSamples); - - bool isStereo() const { return true; } - bool endOfData() const { return _endOfData; } - - int getRate() const { return _rate; } - Audio::Timestamp getLength() const { return _playtime; } - - bool seek(const Audio::Timestamp &where); -private: - const int _rate; ///< Sample rate of stream - Audio::Timestamp _playtime; ///< Calculated total play time - Common::DisposablePtr _stream; ///< Stream to read data from - bool _endOfData; ///< Whether the stream end has been reached - - byte *_buffer; ///< Buffer used in readBuffer - enum { - /** - * How many samples we can buffer at once. - * - * TODO: Check whether this size suffices - * for systems with slow disk I/O. - */ - kSampleBufferLength = 2048 - }; - - /** - * Fill the temporary sample buffer used in readBuffer. - * - * @param maxSamples Maximum samples to read. - * @return actual count of samples read. - */ - int fillBuffer(int maxSamples); -}; - -int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { - int samplesLeft = numSamples; - - while (samplesLeft > 0) { - // Try to read up to "samplesLeft" samples. - int len = fillBuffer(samplesLeft); - - // In case we were not able to read any samples - // we will stop reading here. - if (!len) - break; - - // Adjust the samples left to read. - samplesLeft -= len; - - // Copy the data to the caller's buffer. - const byte *src = _buffer; - while (len-- > 0) { - if (*src < 128) - *buffer++ = ((128 - *src) << 8) ^ 0x8000; - else - *buffer++ = (*src << 8) ^ 0x8000; - src++; - } - } - - return numSamples - samplesLeft; -} - -int RawZorkStream::fillBuffer(int maxSamples) { - int bufferedSamples = 0; - byte *dst = _buffer; - - // We can only read up to "kSampleBufferLength" samples - // so we take this into consideration, when trying to - // read up to maxSamples. - maxSamples = MIN(kSampleBufferLength, maxSamples); - - // We will only read up to maxSamples - while (maxSamples > 0 && !endOfData()) { - // Try to read all the sample data and update the - // destination pointer. - const int bytesRead = _stream->read(dst, maxSamples); - dst += bytesRead; - - // Calculate how many samples we actually read. - const int samplesRead = bytesRead; - - // Update all status variables - bufferedSamples += samplesRead; - maxSamples -= samplesRead; - - // We stop stream playback, when we reached the end of the data stream. - // We also stop playback when an error occures. - if (_stream->pos() == _stream->size() || _stream->err() || _stream->eos()) - _endOfData = true; - } - - return bufferedSamples; -} - -bool RawZorkStream::seek(const Audio::Timestamp &where) { - _endOfData = true; - - if (where > _playtime) - return false; - - const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); - _stream->seek(seekSample, SEEK_SET); - - // In case of an error we will not continue stream playback. - if (!_stream->err() && !_stream->eos() && _stream->pos() != _stream->size()) - _endOfData = false; - - return true; -} - -#pragma mark - -#pragma mark --- Raw stream factories --- -#pragma mark - - -Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - DisposeAfterUse::Flag disposeAfterUse) { - assert(stream->size() % 2 == 0); - return new RawZorkStream(rate, disposeAfterUse, stream); -} - -Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - DisposeAfterUse::Flag disposeAfterUse) { - return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); -} - -} // End of namespace ZVision +/* 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/scummsys.h" + +#include "common/endian.h" +#include "common/memstream.h" +#include "common/textconsole.h" +#include "common/util.h" + +#include "audio/audiostream.h" + +#include "engines/zvision/zork_raw.h" + +namespace ZVision { + +#pragma mark - +#pragma mark --- RawZorkStream --- +#pragma mark - + +/** + * This is a stream, which allows for playing raw PCM data from a stream. + */ +class RawZorkStream : public Audio::SeekableAudioStream { +public: + RawZorkStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) + : _rate(rate), _playtime(0, rate), _stream(stream, disposeStream), _endOfData(false), _buffer(0) { + // Setup our buffer for readBuffer + _buffer = new byte[kSampleBufferLength]; + assert(_buffer); + + // Calculate the total playtime of the stream + _playtime = Audio::Timestamp(0, _stream->size() / 2 / 1, rate); + } + + ~RawZorkStream() { + delete[] _buffer; + } + + int readBuffer(int16 *buffer, const int numSamples); + + bool isStereo() const { return true; } + bool endOfData() const { return _endOfData; } + + int getRate() const { return _rate; } + Audio::Timestamp getLength() const { return _playtime; } + + bool seek(const Audio::Timestamp &where); +private: + const int _rate; ///< Sample rate of stream + Audio::Timestamp _playtime; ///< Calculated total play time + Common::DisposablePtr _stream; ///< Stream to read data from + bool _endOfData; ///< Whether the stream end has been reached + + byte *_buffer; ///< Buffer used in readBuffer + enum { + /** + * How many samples we can buffer at once. + * + * TODO: Check whether this size suffices + * for systems with slow disk I/O. + */ + kSampleBufferLength = 2048 + }; + + /** + * Fill the temporary sample buffer used in readBuffer. + * + * @param maxSamples Maximum samples to read. + * @return actual count of samples read. + */ + int fillBuffer(int maxSamples); +}; + +int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { + int samplesLeft = numSamples; + + while (samplesLeft > 0) { + // Try to read up to "samplesLeft" samples. + int len = fillBuffer(samplesLeft); + + // In case we were not able to read any samples + // we will stop reading here. + if (!len) + break; + + // Adjust the samples left to read. + samplesLeft -= len; + + // Copy the data to the caller's buffer. + const byte *src = _buffer; + while (len-- > 0) { + if (*src < 128) + *buffer++ = ((128 - *src) << 8) ^ 0x8000; + else + *buffer++ = (*src << 8) ^ 0x8000; + src++; + } + } + + return numSamples - samplesLeft; +} + +int RawZorkStream::fillBuffer(int maxSamples) { + int bufferedSamples = 0; + byte *dst = _buffer; + + // We can only read up to "kSampleBufferLength" samples + // so we take this into consideration, when trying to + // read up to maxSamples. + maxSamples = MIN(kSampleBufferLength, maxSamples); + + // We will only read up to maxSamples + while (maxSamples > 0 && !endOfData()) { + // Try to read all the sample data and update the + // destination pointer. + const int bytesRead = _stream->read(dst, maxSamples); + dst += bytesRead; + + // Calculate how many samples we actually read. + const int samplesRead = bytesRead; + + // Update all status variables + bufferedSamples += samplesRead; + maxSamples -= samplesRead; + + // We stop stream playback, when we reached the end of the data stream. + // We also stop playback when an error occures. + if (_stream->pos() == _stream->size() || _stream->err() || _stream->eos()) + _endOfData = true; + } + + return bufferedSamples; +} + +bool RawZorkStream::seek(const Audio::Timestamp &where) { + _endOfData = true; + + if (where > _playtime) + return false; + + const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); + _stream->seek(seekSample, SEEK_SET); + + // In case of an error we will not continue stream playback. + if (!_stream->err() && !_stream->eos() && _stream->pos() != _stream->size()) + _endOfData = false; + + return true; +} + +#pragma mark - +#pragma mark --- Raw stream factories --- +#pragma mark - + +Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, + int rate, + DisposeAfterUse::Flag disposeAfterUse) { + assert(stream->size() % 2 == 0); + return new RawZorkStream(rate, disposeAfterUse, stream); +} + +Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, + int rate, + DisposeAfterUse::Flag disposeAfterUse) { + return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); +} + +} // End of namespace ZVision diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 3a938026d9cc..1de3b575baef 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -1,67 +1,67 @@ -/* 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 ZVISION_ZORK_RAW_H -#define ZVISION_ZORK_RAW_H - -#include "common/scummsys.h" -#include "common/types.h" - -#include "common/list.h" - - -namespace Common { -class SeekableReadStream; -} - -namespace ZVision { - -class SeekableAudioStream; - -/** - * Creates an audio stream, which plays from the given buffer. - * - * @param buffer Buffer to play from. - * @param size Size of the buffer in bytes. - * @param rate Rate of the sound data. - * @param disposeAfterUse Whether to free the buffer after use (with free!). - * @return The new SeekableAudioStream (or 0 on failure). - */ -Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - -/** - * Creates an audio stream, which plays from the given stream. - * - * @param stream Stream object to play from. - * @param rate Rate of the sound data. - * @param disposeAfterUse Whether to delete the stream after use. - * @return The new SeekableAudioStream (or 0 on failure). - */ -Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - -} // End of namespace ZVision - -#endif +/* 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 ZVISION_ZORK_RAW_H +#define ZVISION_ZORK_RAW_H + +#include "common/scummsys.h" +#include "common/types.h" + +#include "common/list.h" + + +namespace Common { +class SeekableReadStream; +} + +namespace ZVision { + +class SeekableAudioStream; + +/** + * Creates an audio stream, which plays from the given buffer. + * + * @param buffer Buffer to play from. + * @param size Size of the buffer in bytes. + * @param rate Rate of the sound data. + * @param disposeAfterUse Whether to free the buffer after use (with free!). + * @return The new SeekableAudioStream (or 0 on failure). + */ +Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, + int rate, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + +/** + * Creates an audio stream, which plays from the given stream. + * + * @param stream Stream object to play from. + * @param rate Rate of the sound data. + * @param disposeAfterUse Whether to delete the stream after use. + * @return The new SeekableAudioStream (or 0 on failure). + */ +Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, + int rate, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 479bf2379a6a..5e83c47721dc 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -1,149 +1,149 @@ -/* 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/scummsys.h" - -#include "common/config-manager.h" -#include "common/debug.h" -#include "common/debug-channels.h" -#include "common/error.h" -#include "common/system.h" -#include "common/file.h" - -#include "engines/util.h" - -#include "zvision/zvision.h" -#include "zvision/script_manager.h" -#include "zvision/zfs_archive.h" - -#include "graphics/decoders/tga.h" - -#include "zvision/tests.h" - -namespace ZVision { - -ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { - // Put your engine in a sane state, but do nothing big yet; - // in particular, do not load data from files; rather, if you - // need to do such things, do them from run(). - - // Do not initialize graphics here - - // However this is the place to specify all default directories - const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx"); - SearchMan.addSubDirectoryMatching(gameDataDir, "znemscr"); - - // Here is the right place to set up the engine specific debug channels - //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); - //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); - - // Register random source - _rnd = new Common::RandomSource("zvision"); - - // Create managers - _scriptManager = new ScriptManager(); - - debug("ZVision::ZVision"); -} - -ZVision::~ZVision() { - debug("ZVision::~ZVision"); - - // Dispose of resources - delete _scriptManager; - delete _rnd; - - // Remove all of our debug levels - DebugMan.clearAllDebugChannels(); -} - -void ZVision::initialize() { - // Find zfs archive files - Common::ArchiveMemberList list; - SearchMan.listMatchingMembers(list, "*.zfs"); - - // Register the file entries within the zfs archives with the SearchMan - for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { - Common::String name = (*iter)->getName(); - ZfsArchive *archive = new ZfsArchive(name, (*iter)->createReadStream()); - - SearchMan.add(name, archive); - } - - //Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); // ARGB8888 - Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 - initGraphics(640, 480, true, &format); - - _scriptManager->initialize(); - - // Create debugger console. It requires GFX to be initialized - _console = new Console(this); -} - -Common::Error ZVision::run() { - initialize(); - - tests(); - - // Main loop - uint32 currentTime = _system->getMillis(); - uint32 lastTime = currentTime; - const uint32 desiredFrameTime = 33; // ~30 fps - - while (!shouldQuit()) { - processEvents(); - - currentTime = _system->getMillis(); - uint32 deltaTime = currentTime - lastTime; - lastTime = currentTime; - - updateScripts(); - updateAnimations(deltaTime); - - if (_needsScreenUpdate) - { - _system->updateScreen(); - } - - // Calculate the frame delay based off a desired frame rate - int delay = desiredFrameTime - (currentTime - _system->getMillis()); - // Ensure non-negative - delay = delay < 0 ? 0 : delay; - _system->delayMillis(delay); - } - - return Common::kNoError; -} - -ScriptManager *ZVision::getScriptManager() const { - return _scriptManager; -} - -Common::RandomSource *ZVision::getRandomSource() const { - return _rnd; -} - -} // End of namespace ZVision +/* 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/scummsys.h" + +#include "common/config-manager.h" +#include "common/debug.h" +#include "common/debug-channels.h" +#include "common/error.h" +#include "common/system.h" +#include "common/file.h" + +#include "engines/util.h" + +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/zfs_archive.h" + +#include "graphics/decoders/tga.h" + +#include "zvision/tests.h" + +namespace ZVision { + +ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { + // Put your engine in a sane state, but do nothing big yet; + // in particular, do not load data from files; rather, if you + // need to do such things, do them from run(). + + // Do not initialize graphics here + + // However this is the place to specify all default directories + const Common::FSNode gameDataDir(ConfMan.get("path")); + SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4); + SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4); + SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx"); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemscr"); + + // Here is the right place to set up the engine specific debug channels + //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); + //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); + + // Register random source + _rnd = new Common::RandomSource("zvision"); + + // Create managers + _scriptManager = new ScriptManager(); + + debug("ZVision::ZVision"); +} + +ZVision::~ZVision() { + debug("ZVision::~ZVision"); + + // Dispose of resources + delete _scriptManager; + delete _rnd; + + // Remove all of our debug levels + DebugMan.clearAllDebugChannels(); +} + +void ZVision::initialize() { + // Find zfs archive files + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.zfs"); + + // Register the file entries within the zfs archives with the SearchMan + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + Common::String name = (*iter)->getName(); + ZfsArchive *archive = new ZfsArchive(name, (*iter)->createReadStream()); + + SearchMan.add(name, archive); + } + + //Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); // ARGB8888 + Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 + initGraphics(640, 480, true, &format); + + _scriptManager->initialize(); + + // Create debugger console. It requires GFX to be initialized + _console = new Console(this); +} + +Common::Error ZVision::run() { + initialize(); + + tests(); + + // Main loop + uint32 currentTime = _system->getMillis(); + uint32 lastTime = currentTime; + const uint32 desiredFrameTime = 33; // ~30 fps + + while (!shouldQuit()) { + processEvents(); + + currentTime = _system->getMillis(); + uint32 deltaTime = currentTime - lastTime; + lastTime = currentTime; + + updateScripts(); + updateAnimations(deltaTime); + + if (_needsScreenUpdate) + { + _system->updateScreen(); + } + + // Calculate the frame delay based off a desired frame rate + int delay = desiredFrameTime - (currentTime - _system->getMillis()); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); + } + + return Common::kNoError; +} + +ScriptManager *ZVision::getScriptManager() const { + return _scriptManager; +} + +Common::RandomSource *ZVision::getRandomSource() const { + return _rnd; +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index ac5796ad91f4..0053fe5a9ee5 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -1,96 +1,96 @@ -/* 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 ZVISION_H -#define ZVISION_H - -#include "common/random.h" -#include "common/events.h" - -#include "engines/engine.h" - -#include "zvision/script_manager.h" - -#include "gui/debugger.h" - -namespace ZVision { - -struct ZVisionGameDescription; -class Console; - -// our engine debug channels -enum { - kZDebugExample = 1 << 0, - kZDebugExample2 = 1 << 1 - // next new channel must be 1 << 2 (4) - // the current limitation is 32 debug channels (1 << 31 is the last one) -}; - -class ZVision : public Engine { -public: - ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); - ~ZVision(); - -private: - Console *_console; - const ZVisionGameDescription *_gameDescription; - - // We need random numbers - Common::RandomSource *_rnd; - - ScriptManager *_scriptManager; - - // To prevent allocation every time we process events - Common::Event _event; - - bool _needsScreenUpdate; - -public: - uint32 getFeatures() const; - Common::Language getLanguage() const; - virtual Common::Error run(); - ScriptManager *getScriptManager() const; - Common::RandomSource *getRandomSource() const; - -private: - void initialize(); - - void processEvents(); +/* 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 ZVISION_H +#define ZVISION_H + +#include "common/random.h" +#include "common/events.h" + +#include "engines/engine.h" + +#include "zvision/script_manager.h" + +#include "gui/debugger.h" + +namespace ZVision { + +struct ZVisionGameDescription; +class Console; + +// our engine debug channels +enum { + kZDebugExample = 1 << 0, + kZDebugExample2 = 1 << 1 + // next new channel must be 1 << 2 (4) + // the current limitation is 32 debug channels (1 << 31 is the last one) +}; + +class ZVision : public Engine { +public: + ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); + ~ZVision(); + +private: + Console *_console; + const ZVisionGameDescription *_gameDescription; + + // We need random numbers + Common::RandomSource *_rnd; + + ScriptManager *_scriptManager; + + // To prevent allocation every time we process events + Common::Event _event; + + bool _needsScreenUpdate; + +public: + uint32 getFeatures() const; + Common::Language getLanguage() const; + virtual Common::Error run(); + ScriptManager *getScriptManager() const; + Common::RandomSource *getRandomSource() const; + +private: + void initialize(); + + void processEvents(); void onMouseDown(const Common::Point &pos); void onMouseMove(const Common::Point &pos); - void onKeyDown(uint16 keyCode); - - void updateScripts(); - void updateAnimations(uint32 detaTimeMillis); -}; - -// Example console class -class Console : public GUI::Debugger { -public: - Console(ZVision *vm) {} - virtual ~Console(void) {} -}; - -} // End of namespace ZVision - -#endif + void onKeyDown(uint16 keyCode); + + void updateScripts(); + void updateAnimations(uint32 detaTimeMillis); +}; + +// Example console class +class Console : public GUI::Debugger { +public: + Console(ZVision *vm) {} + virtual ~Console(void) {} +}; + +} // End of namespace ZVision + +#endif From 0ba9ca8fa0614287bf4b7e666a07126fa8e1faad Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 18:21:25 -0500 Subject: [PATCH 0285/1332] ZVISION: Forward declare ZVision in result_action.h result_action.h is #included before ZVision is declared, causing not declared compiler errors --- engines/zvision/result_action.cpp | 1 + engines/zvision/result_action.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/zvision/result_action.cpp b/engines/zvision/result_action.cpp index de439db1b97e..4721c5bd6173 100644 --- a/engines/zvision/result_action.cpp +++ b/engines/zvision/result_action.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "zvision/result_action.h" +#include "zvision/zvision.h" namespace ZVision { diff --git a/engines/zvision/result_action.h b/engines/zvision/result_action.h index 7ab896d5109f..fbf8e7f01936 100644 --- a/engines/zvision/result_action.h +++ b/engines/zvision/result_action.h @@ -25,10 +25,13 @@ #include "common/scummsys.h" -#include "zvision/zvision.h" +#include "common/str.h" namespace ZVision { +// Forward declaration of ZVision. This file is included before ZVision is declared +class ZVision; + class ResultAction { public: virtual ~ResultAction() {} From 3822de2aec0d41df7c2beeb5a1269577e9c3df84 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 18:24:06 -0500 Subject: [PATCH 0286/1332] ZVISION: Change Puzzle::resultActions to a List of pointers instead of ResultAction objects ResultAction is abstract, therefore, it can't be directly stored in the list --- engines/zvision/puzzle.h | 3 ++- engines/zvision/scr_file_handling.cpp | 8 ++++---- engines/zvision/script_manager.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 75d3dc0826df..fd9c61e8bce5 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -61,7 +61,8 @@ enum StateFlags : byte { struct Puzzle { uint32 key; Common::List criteriaList; - Common::List resultActions; + // This has to be list of pointers because ResultAction is abstract + Common::List resultActions; byte flags; }; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 3171492717a5..eb867fa0a2d0 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -126,7 +126,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const return criteria; } -void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { +void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(line); @@ -135,11 +135,11 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List while (!line.contains('}')) { // Parse for the action type if (line.matchString("*:add*", true)) { - actionList.push_back(ActionAdd(line)); + actionList.push_back(new ActionAdd(line)); } else if (line.matchString("*:animplay*", true)) { - actionList.push_back(ActionPlayAnimation(line)); + actionList.push_back(new ActionPlayAnimation(line)); } else if (line.matchString("*:animpreload*", true)) { - actionList.push_back(ActionPreloadAnimation(line)); + actionList.push_back(new ActionPreloadAnimation(line)); } else if (line.matchString("*:animunload*", true)) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 7f46bd51feb9..173705edf58b 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -82,7 +82,7 @@ class ScriptManager { * @param stream Scr file stream * @return Created Results object */ - void parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const; + void parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum From 3f93f7d27fe58690a4b94c22247bb00a9af2c92e Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 5 Jul 2013 20:14:50 -0500 Subject: [PATCH 0287/1332] ZVISION: Change trimCommentsAndWhiteSpace to use a pointer instead of a reference. --- engines/zvision/scr_file_handling.cpp | 14 +++++++------- engines/zvision/utility.h | 11 ++++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index eb867fa0a2d0..285e635c61bd 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -46,7 +46,7 @@ void ScriptManager::parseScrFile(Common::String fileName) { return; } - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); if (line.empty()) continue; @@ -69,7 +69,7 @@ void ScriptManager::parseScrFile(Common::String fileName) { void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream) { Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); while (!line.contains('}')) { if (line.matchString("criteria {", true)) @@ -86,7 +86,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const // Loop until we find the closing brace Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); while (!line.contains('}')) { // Split the string into tokens using ' ' as a delimiter @@ -120,7 +120,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const } line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); } return criteria; @@ -129,7 +129,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); // TODO: Re-order the if-then statements in order of highest occurrence while (!line.contains('}')) { @@ -253,7 +253,7 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List } line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); } return; @@ -264,7 +264,7 @@ byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { // Loop until we find the closing brace Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(line); + trimCommentsAndWhiteSpace(&line); while (!line.contains('}')) { if (line.matchString("ONCE_PER_INST", true)) { diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 4d124509ba3f..511b3c12f267 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -59,14 +59,15 @@ void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) * * @param string The string to modify. It is modified in place */ -void trimCommentsAndWhiteSpace(Common::String &string) { - for (int i = string.size(); i >= 0; --i) { - if (string[i] == '#') { - string.erase(i); +void trimCommentsAndWhiteSpace(Common::String *string) { + for (int i = string->size() - 1; i >= 0; i--) { + if ((*string)[i] == '#') { + string->erase(i); } } - string.trim(); + string->trim(); +} } } // End of namespace ZVision From ebb546c46850475485753346594376cf62465765 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 00:26:01 -0500 Subject: [PATCH 0288/1332] ZVISION: Create utility method to dump result action signatures from various .scr files --- engines/zvision/utility.h | 134 +++++++++++++++++++++++++++++++++++- engines/zvision/zvision.cpp | 5 +- 2 files changed, 136 insertions(+), 3 deletions(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 511b3c12f267..0b2ef2b8cd73 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -36,7 +36,7 @@ namespace ZVision { * @param sourceFile The 'file' you want the contents of * @param destFile The name of the file where the content will be written to */ -void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) { +void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) { Common::File f; f.open(sourceFile); byte* buffer = new byte[f.size()]; @@ -68,6 +68,138 @@ void trimCommentsAndWhiteSpace(Common::String *string) { string->trim(); } + +void tryToDumpLine(const Common::String &key, + Common::String &line, + Common::HashMap *count, + Common::HashMap *fileAlreadyUsed, + Common::DumpFile &output) { + const byte numberOfExamplesPerType = 8; + + if ((*count)[key] < numberOfExamplesPerType && !(*fileAlreadyUsed)[key]) { + output.writeString(line); + output.writeByte('\n'); + (*count)[key]++; + (*fileAlreadyUsed)[key] = true; + } +} + +/** + * Searches through all the .scr files and dumps 'numberOfExamplesPerType' examples of each type of ResultAction + * ZVision::initialize() must have been called before this function can be used. + * + * @param destFile Where to write the examples + */ +void dumpEveryResultAction(const Common::String &destFile) { + + + Common::HashMap count; + Common::HashMap fileAlreadyUsed; + + Common::DumpFile output; + output.open(destFile); + + // Find scr files + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.scr"); + + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + Common::SeekableReadStream *stream = (*iter)->createReadStream(); + + Common::String line = stream->readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream->eos()) { + if (line.matchString("*:add*", true)) { + tryToDumpLine("add", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animplay*", true)) { + tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animpreload*", true)) { + tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animunload*", true)) { + tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:attenuate*", true)) { + tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:assign*", true)) { + tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:change_location*", true)) { + tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) { + tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:debug*", true)) { + tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:delay_render*", true)) { + tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:disable_control*", true)) { + tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:disable_venus*", true)) { + tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:display_message*", true)) { + tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:dissolve*", true)) { + tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:distort*", true)) { + tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:enable_control*", true)) { + tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:flush_mouse_events*", true)) { + tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:inventory*", true)) { + tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:kill*", true)) { + tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:menu_bar_enable*", true)) { + tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:music*", true)) { + tryToDumpLine("music", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:pan_track*", true)) { + tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:playpreload*", true)) { + tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:preferences*", true)) { + tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:quit*", true)) { + tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:random*", true)) { + tryToDumpLine("random", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:region*", true)) { + tryToDumpLine("region", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:restore_game*", true)) { + tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:rotate_to*", true)) { + tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:save_game*", true)) { + tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_partial_screen*", true)) { + tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_screen*", true)) { + tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_venus*", true)) { + tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:stop*", true)) { + tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:streamvideo*", true)) { + tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:syncsound*", true)) { + tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:timer*", true)) { + tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:ttytext*", true)) { + tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:universe_music*", true)) { + tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output); + } + + line = stream->readLine(); + trimCommentsAndWhiteSpace(&line); + } + + for (Common::HashMap::iterator iter = fileAlreadyUsed.begin(); iter != fileAlreadyUsed.end(); ++iter) { + (*iter)._value = false; + } + } + + output.close(); } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 5e83c47721dc..6fb94f872535 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -37,7 +37,7 @@ #include "graphics/decoders/tga.h" -#include "zvision/tests.h" +#include "zvision/utility.h" namespace ZVision { @@ -106,7 +106,8 @@ void ZVision::initialize() { Common::Error ZVision::run() { initialize(); - tests(); + dumpEveryResultAction("resultActions.txt"); + debug("dump finished"); // Main loop uint32 currentTime = _system->getMillis(); From a77ae2163b460c081f969d764bcdb6ad001396a5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 00:29:15 -0500 Subject: [PATCH 0289/1332] ZVISION: Add definitions for more ResultActions --- engines/zvision/result_action.cpp | 93 +++++++++++++++++++++++++++++++ engines/zvision/result_action.h | 93 +++++++++++++++++++++++++------ 2 files changed, 169 insertions(+), 17 deletions(-) diff --git a/engines/zvision/result_action.cpp b/engines/zvision/result_action.cpp index 4721c5bd6173..c61fcca39872 100644 --- a/engines/zvision/result_action.cpp +++ b/engines/zvision/result_action.cpp @@ -27,6 +27,7 @@ namespace ZVision { +////////////////////////////////////////////////////////////////////////////// // ActionAdd ////////////////////////////////////////////////////////////////////////////// @@ -40,6 +41,7 @@ bool ActionAdd::execute(ZVision *zVision) { } +////////////////////////////////////////////////////////////////////////////// // ActionAssign ////////////////////////////////////////////////////////////////////////////// @@ -53,6 +55,83 @@ bool ActionAssign::execute(ZVision *zVision) { } +////////////////////////////////////////////////////////////////////////////// +// ActionAttenuate +////////////////////////////////////////////////////////////////////////////// + +ActionAttenuate::ActionAttenuate(Common::String line) { + sscanf(line.c_str(), ":assign(%u, %hd)", &_key, &_attenuation); +} + +bool ActionAttenuate::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionChangeLocation +////////////////////////////////////////////////////////////////////////////// + +ActionChangeLocation::ActionChangeLocation(Common::String line) { + sscanf(line.c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); +} + +bool ActionChangeLocation::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionCrossfade +////////////////////////////////////////////////////////////////////////////// + +ActionCrossfade::ActionCrossfade(Common::String line) { + sscanf(line.c_str(), + ":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)", + &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); +} + +bool ActionCrossfade::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionPreloadAnimation +////////////////////////////////////////////////////////////////////////////// + +ActionPreloadAnimation::ActionPreloadAnimation(Common::String line) { + // The two %*hhu are always 0 and dont seem to have a use + sscanf(line.c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); +} + +bool ActionPreloadAnimation::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionPlayAnimation +////////////////////////////////////////////////////////////////////////////// + +ActionPlayAnimation::ActionPlayAnimation(Common::String line) { + // The two %*hhu are always 0 and dont seem to have a use + sscanf(line.c_str(), + ":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)", + &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); +} + +bool ActionPlayAnimation::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + + +////////////////////////////////////////////////////////////////////////////// // ActionRandom ////////////////////////////////////////////////////////////////////////////// @@ -66,4 +145,18 @@ bool ActionRandom::execute(ZVision *zVision) { return true; } + +////////////////////////////////////////////////////////////////////////////// +// ActionTimer +////////////////////////////////////////////////////////////////////////////// + +ActionTimer::ActionTimer(Common::String line) { + sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time); +} + +bool ActionTimer::execute(ZVision *zVision) { + // TODO: Implement + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/result_action.h b/engines/zvision/result_action.h index fbf8e7f01936..a58ef68e3465 100644 --- a/engines/zvision/result_action.h +++ b/engines/zvision/result_action.h @@ -40,13 +40,6 @@ class ResultAction { // The different types of actions -// ADD, -// ANIM_PLAY, -// ANIM_PRELOAD, -// ANIM_UNLOAD, -// ATTENUATE, -// ASSIGN, -// CHANGE_LOCATION, // CROSSFADE, // DEBUG, // DELAY_RENDER, @@ -76,7 +69,6 @@ class ResultAction { // STOP, // STREAM_VIDEO, // SYNC_SOUND, -// TIMER, // TTY_TEXT, // UNIVERSE_MUSIC, @@ -90,34 +82,91 @@ class ActionAdd : public ResultAction { byte _value; }; -class ActionPlayAnimation : public ResultAction { +class ActionAssign : public ResultAction { public: - ActionPlayAnimation(Common::String line); + ActionAssign(Common::String line); bool execute(ZVision *zVision); + +private: + uint32 _key; + byte _value; }; -class ActionPreloadAnimation : public ResultAction { +class ActionAttenuate : public ResultAction { public: - ActionPreloadAnimation(Common::String line); + ActionAttenuate(Common::String line); bool execute(ZVision *zVision); + +private: + uint32 _key; + int16 _attenuation; }; -class ActionAttenuate : public ResultAction { +class ActionChangeLocation : public ResultAction { public: - ActionAttenuate(Common::String line); + ActionChangeLocation(Common::String line); bool execute(ZVision *zVision); + +private: + char _world; + char _room; + char _nodeview[2]; + int16 _x; }; -class ActionAssign : public ResultAction { +class ActionCrossfade : public ResultAction { public: - ActionAssign(Common::String line); + ActionCrossfade(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _keyOne; + uint32 _keyTwo; + byte _oneStartVolume; + byte _twoStartVolume; + byte _oneEndVolume; + byte _twoEndVolume; + uint16 _timeInMillis; +}; + +class ActionPlayAnimation : public ResultAction { +public: + ActionPlayAnimation(Common::String line); bool execute(ZVision *zVision); private: uint32 _key; - byte _value; + Common::String _fileName; + uint32 _x; + uint32 _y; + uint32 _width; + uint32 _height; + uint32 _start; + uint32 _end; + uint32 _mask; + byte _framerate; + bool _loop; }; +class ActionPreloadAnimation : public ResultAction { +public: + ActionPreloadAnimation(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _key; + Common::String _fileName; + uint32 _mask; + byte _framerate; +}; + +// TODO: See if this exists in ZGI. It doesn't in ZNem +//class ActionUnloadAnimation : public ResultAction { +//public: +// ActionUnloadAnimation(Common::String line); +// bool execute(ZVision *zVision); +//}; + class ActionRandom : public ResultAction { public: ActionRandom(Common::String line); @@ -128,6 +177,16 @@ class ActionRandom : public ResultAction { uint32 _max; }; +class ActionTimer : public ResultAction { +public: + ActionTimer(Common::String line); + bool execute(ZVision *zVision); + +private: + uint32 _key; + uint32 _time; +}; + } // End of namespace ZVision #endif From 42092369948af8499b980b320b09911b53c10b3d Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 01:52:45 -0500 Subject: [PATCH 0290/1332] ZVISION: Create debug console and apply console logic to main loop --- engines/zvision/console.cpp | 35 +++++++++++++++++++++++++++++++ engines/zvision/console.h | 42 +++++++++++++++++++++++++++++++++++++ engines/zvision/events.cpp | 7 ++++--- engines/zvision/zvision.cpp | 11 ++++++---- engines/zvision/zvision.h | 7 ------- 5 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 engines/zvision/console.cpp create mode 100644 engines/zvision/console.h diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp new file mode 100644 index 000000000000..a26dba9d6d5e --- /dev/null +++ b/engines/zvision/console.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 "common/scummsys.h" + +#include "gui/debugger.h" + +#include "zvision/console.h" +#include "zvision/zvision.h" + +namespace ZVision { + + Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { + } + +} // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h new file mode 100644 index 000000000000..c91b36245158 --- /dev/null +++ b/engines/zvision/console.h @@ -0,0 +1,42 @@ +/* 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 ZVISION_CONSOLE_H +#define ZVISION_CONSOLE_H + +#include "gui/debugger.h" + +namespace ZVision { + + class ZVision; + + class Console : public GUI::Debugger { + public: + Console(ZVision *engine); + virtual ~Console() {} + + private: + ZVision *_engine; + }; + +} // End of namespace ZVision +#endif diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 8d10485ddf4e..cb1ef53248d9 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -22,7 +22,8 @@ #include "common/scummsys.h" -#include "zvision.h" +#include "zvision/zvision.h" +#include "zvision/console.h" #include "common/EventRecorder.h" @@ -50,8 +51,8 @@ void ZVision::processEvents() { case Common::KEYCODE_d: if (_event.kbd.hasFlags(Common::KBD_CTRL)) { // Start the debugger - getDebugger()->attach(); - getDebugger()->onFrame(); + _console->attach(); + _console->onFrame(); } break; diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 6fb94f872535..7a07b59b7196 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -25,6 +25,7 @@ #include "common/config-manager.h" #include "common/debug.h" #include "common/debug-channels.h" +#include "common/textconsole.h" #include "common/error.h" #include "common/system.h" #include "common/file.h" @@ -32,11 +33,10 @@ #include "engines/util.h" #include "zvision/zvision.h" +#include "zvision/console.h" #include "zvision/script_manager.h" #include "zvision/zfs_archive.h" -#include "graphics/decoders/tga.h" - #include "zvision/utility.h" namespace ZVision { @@ -73,6 +73,7 @@ ZVision::~ZVision() { debug("ZVision::~ZVision"); // Dispose of resources + delete _console; delete _scriptManager; delete _rnd; @@ -124,9 +125,11 @@ Common::Error ZVision::run() { updateScripts(); updateAnimations(deltaTime); - if (_needsScreenUpdate) - { + + + if (_needsScreenUpdate || _console->isActive()) { _system->updateScreen(); + _needsScreenUpdate = false; } // Calculate the frame delay based off a desired frame rate diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 0053fe5a9ee5..9dd36662f73c 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -83,13 +83,6 @@ class ZVision : public Engine { void updateScripts(); void updateAnimations(uint32 detaTimeMillis); }; - -// Example console class -class Console : public GUI::Debugger { -public: - Console(ZVision *vm) {} - virtual ~Console(void) {} -}; } // End of namespace ZVision From 46865dc39414a6e8123c41faa287c03270d7a6da Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 01:54:05 -0500 Subject: [PATCH 0291/1332] ZVISION: Create renderImageToScreen method and add a console command for it --- engines/zvision/console.cpp | 11 ++++++++ engines/zvision/console.h | 2 ++ engines/zvision/image.cpp | 53 +++++++++++++++++++++++++++++++++++++ engines/zvision/zvision.h | 1 + 4 files changed, 67 insertions(+) create mode 100644 engines/zvision/image.cpp diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index a26dba9d6d5e..d9d4182646fe 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -30,6 +30,17 @@ namespace ZVision { Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { + DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); + } + + bool Console::cmdLoadImage(int argc, const char **argv) { + if (argc != 6) { + DebugPrintf("Use loadimage to load an image to the screen"); + return false; + } + _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5])); + + return true; } } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index c91b36245158..c341b8d226a2 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -36,6 +36,8 @@ namespace ZVision { private: ZVision *_engine; + + bool cmdLoadImage(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp new file mode 100644 index 000000000000..95fed0c73ca4 --- /dev/null +++ b/engines/zvision/image.cpp @@ -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. +* +*/ + +#include "common/scummsys.h" + +#include "common/file.h" +#include "common/system.h" + +#include "graphics/decoders/tga.h" + +#include "zvision/zvision.h" + +namespace ZVision { + +void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height) { + Common::File file; + + if (file.open(fileName)) { + Graphics::TGADecoder tga; + if (!tga.loadStream(file)) + error("Error while reading TGA image"); + file.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, width, height); + + tga.destroy(); + + _needsScreenUpdate = true; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 9dd36662f73c..7ff03ca719e7 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -71,6 +71,7 @@ class ZVision : public Engine { virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height); private: void initialize(); From 540dde67db3dcf00f336ea772c0c51701675ece8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 01:55:31 -0500 Subject: [PATCH 0292/1332] ZVISION: Cleanup dump method from run() --- engines/zvision/zvision.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 7a07b59b7196..4653b303467c 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -107,9 +107,6 @@ void ZVision::initialize() { Common::Error ZVision::run() { initialize(); - dumpEveryResultAction("resultActions.txt"); - debug("dump finished"); - // Main loop uint32 currentTime = _system->getMillis(); uint32 lastTime = currentTime; @@ -125,8 +122,6 @@ Common::Error ZVision::run() { updateScripts(); updateAnimations(deltaTime); - - if (_needsScreenUpdate || _console->isActive()) { _system->updateScreen(); _needsScreenUpdate = false; From c882f796950c4ada93b5ea85c69b62f2613b0aea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 16:29:47 +0300 Subject: [PATCH 0293/1332] ZVISION: Remove direct inclusion of stdio.h --- engines/zvision/scr_file_handling.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 285e635c61bd..a0ecf6bb4c81 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -22,8 +22,6 @@ #include "common/scummsys.h" -#include - #include "zvision/script_manager.h" #include "zvision/utility.h" #include "zvision/puzzle.h" From 258ecb0aebc21d84c2e81b9b82e9c49a24e6d41b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 16:32:38 +0300 Subject: [PATCH 0294/1332] ZVISION: Remove nonstandard C type declaration from the StateFlags enum --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index fd9c61e8bce5..d3b7536e8da3 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -52,7 +52,7 @@ struct Criteria { bool isArgumentAnId; }; -enum StateFlags : byte { +enum StateFlags { ONCE_PER_INST = 0x01, DO_ME_NOW = 0x02, DISABLED = 0x04 From a8e5e1e2dbd8a3fcf438966383172866a90b835e Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 12:30:54 -0500 Subject: [PATCH 0295/1332] ZVISION: Rename result_action.h/.cpp files to actions.h/.cpp --- engines/zvision/{result_action.cpp => actions.cpp} | 2 +- engines/zvision/{result_action.h => actions.h} | 0 engines/zvision/puzzle.h | 2 +- engines/zvision/script_manager.h | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename engines/zvision/{result_action.cpp => actions.cpp} (99%) rename engines/zvision/{result_action.h => actions.h} (100%) diff --git a/engines/zvision/result_action.cpp b/engines/zvision/actions.cpp similarity index 99% rename from engines/zvision/result_action.cpp rename to engines/zvision/actions.cpp index c61fcca39872..23f7f166c80d 100644 --- a/engines/zvision/result_action.cpp +++ b/engines/zvision/actions.cpp @@ -22,7 +22,7 @@ #include "common/scummsys.h" -#include "zvision/result_action.h" +#include "zvision/actions.h" #include "zvision/zvision.h" namespace ZVision { diff --git a/engines/zvision/result_action.h b/engines/zvision/actions.h similarity index 100% rename from engines/zvision/result_action.h rename to engines/zvision/actions.h diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index d3b7536e8da3..9dab606f5473 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/result_action.h" +#include "zvision/actions.h" namespace ZVision { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 173705edf58b..f02073b4c686 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -29,7 +29,7 @@ #include "zvision/puzzle.h" #include "zvision/control.h" -#include "zvision/result_action.h" +#include "zvision/actions.h" namespace ZVision { From fa365dffce5036a6f82e8a4df212a9a424f522bd Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 16:15:10 -0500 Subject: [PATCH 0296/1332] ZVISION: Change #include scummsys.h to types.h --- engines/zvision/control.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index df01544bfca1..1f59478b4cdb 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -23,7 +23,7 @@ #ifndef ZVISION_CONTROL_H #define ZVISION_CONTROL_H -#include "common/scummsys.h" +#include "common/types.h" namespace ZVision { From 89693d4074091bfb998fc6fbdbfe585f53a6ad13 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 10:35:00 -0500 Subject: [PATCH 0297/1332] ZVISION: Create class for decompressing and reading LZSS --- engines/zvision/lzss_read_stream.cpp | 134 +++++++++++++++++++++++++++ engines/zvision/lzss_read_stream.h | 75 +++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 engines/zvision/lzss_read_stream.cpp create mode 100644 engines/zvision/lzss_read_stream.h diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp new file mode 100644 index 000000000000..69b49c596c66 --- /dev/null +++ b/engines/zvision/lzss_read_stream.cpp @@ -0,0 +1,134 @@ +/* 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/scummsys.h" + +#include "zvision/lzss_read_stream.h" + +namespace ZVision { + +LzssReadStream::LzssReadStream(Common::SeekableReadStream *source, bool stream, uint32 decompressedSize) + : _source(source), + // It's convention to set the starting cursor position to blockSize - 16 + _windowCursor(0x0FEE), + _readCursor(0) { + // Clear the window to null + memset(_window, 0, blockSize); + + // Reserve space in the destination buffer + // TODO: Make a better guess + if (decompressedSize == npos) { + decompressedSize = source->size(); + } + _destination.reserve(decompressedSize); + + if (stream) + decompressBytes(blockSize); + else + decompressAll(); +} + +void LzssReadStream::decompressBytes(uint32 numberOfBytes) { + uint32 bytesRead = 0; + + while (!_source->eos() && bytesRead <= numberOfBytes) { + byte flagbyte = _source->readByte(); + byte mask = 1; + + for (uint32 i = 0; i < 8; i++) { + if (!_source->eos()) { + if ((flagbyte & mask) == mask) + { + byte data = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + _window[_windowCursor] = data; + _destination.push_back(data); + + // Increment and wrap the window cursor + _windowCursor = (_windowCursor + 1) & 0xFFF; + } + else + { + byte low = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + byte high = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + uint16 length = (high & 0xF) + 2; + uint16 offset = low | ((high & 0xF0)<<4); + + for(byte j = 0; j <= length; j++) + { + byte temp = _window[(offset + j) & 0xFFF]; + _window[_windowCursor] = temp; + _destination.push_back(temp); + _windowCursor = (_windowCursor + 1) & 0xFFF; + } + }; + + mask = mask << 1; + } + } + } +} + +void LzssReadStream::decompressAll() { + decompressBytes(_source->size()); +} + +bool LzssReadStream::eos() const { + // Make sure that we've read all of the source + return _readCursor >= _destination.size() && _source->eos(); +} + +uint32 LzssReadStream::read(void *dataPtr, uint32 dataSize) { + // Check if there are enough bytes available + // If not, keep decompressing until we have enough bytes or until we reach EOS + while (dataSize > _destination.size() - _readCursor) { + // Check if we can read any more data from source + if (_source->eos()) { + dataSize = _destination.size() - _readCursor; + break; + } + + decompressBytes(blockSize); + } + + memcpy(dataPtr, _destination.begin() + _readCursor, dataSize); + _readCursor += dataSize; + + return dataSize; +} + +uint32 LzssReadStream::currentSize() const { + return _destination.size(); +} + +} // End of namespace ZVision diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h new file mode 100644 index 000000000000..7e6511a5a9b9 --- /dev/null +++ b/engines/zvision/lzss_read_stream.h @@ -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. +* +*/ + +#ifndef ZVISION_LZSS_STREAM_H +#define ZVISION_LZSS_STREAM_H + +#include "common/types.h" +#include "common/stream.h" +#include "common/memstream.h" +#include "common/array.h" + +namespace ZVision { + +class LzssReadStream : public Common::ReadStream { +public: + /** + * A class that decompresses LZSS data and implements ReadStream for easy access + * to the decompiled data. It can either decompress all the data in the beginning + * or decompress as needed by read(). + * + * @param source The source data + * @param stream Decompress the data as needed (true) or all at once (false) + * @param decompressedSize The size of the decompressed data. If npos, the class will choose a size and grow as needed + */ + LzssReadStream(Common::SeekableReadStream *source, bool stream = true, uint32 decompressedSize = npos); + +public: + static const uint32 npos = 0xFFFFFFFFu; + static const uint16 blockSize = 0x1000u; + +private: + Common::SeekableReadStream *_source; + Common::Array _destination; + char _window[blockSize]; + uint16 _windowCursor; + uint32 _readCursor; + +public: + bool eos() const; + uint32 read(void *dataPtr, uint32 dataSize); + uint32 currentSize() const; + +private: + /** + * Decompress the next from the source stream. Or until EOS + * + * @param numberOfBytes How many bytes to decompress. This is a count of source bytes, not destination bytes + */ + void decompressBytes(uint32 numberOfBytes); + /** Decompress all of the source stream. */ + void decompressAll(); +}; + +} + +#endif From 399e512be232746f956b6be52b8387b52114d35b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 10:35:56 -0500 Subject: [PATCH 0298/1332] ZVISION: Update renderImageToScreen to handle TGZ image files --- engines/zvision/console.cpp | 6 ++--- engines/zvision/image.cpp | 46 ++++++++++++++++++++++++++++++------- engines/zvision/zvision.h | 2 +- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index d9d4182646fe..3af67408cb4b 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -34,11 +34,11 @@ namespace ZVision { } bool Console::cmdLoadImage(int argc, const char **argv) { - if (argc != 6) { - DebugPrintf("Use loadimage to load an image to the screen"); + if (argc != 4) { + DebugPrintf("Use loadimage to load an image to the screen"); return false; } - _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5])); + _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); return true; } diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index 95fed0c73ca4..1463401e0f06 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -28,25 +28,55 @@ #include "graphics/decoders/tga.h" #include "zvision/zvision.h" +#include "zvision/lzss_read_stream.h" namespace ZVision { -void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height) { +void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { Common::File file; if (file.open(fileName)) { - Graphics::TGADecoder tga; - if (!tga.loadStream(file)) - error("Error while reading TGA image"); - file.close(); + // Read the magic number + // Some files are true TGA, while others are TGZ + char fileType[4]; + file.read(fileType, 4); - const Graphics::Surface *tgaSurface = tga.getSurface(); + // Check for true TGA files + if (fileType[0] == 'T' && fileType[1] == 'G' && fileType[2] == 'A' && fileType[3] == '\0') { + // Reset the cursor + file.seek(0); - _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, width, height); + // Decode + Graphics::TGADecoder tga; + if (!tga.loadStream(file)) + error("Error while reading TGA image"); + file.close(); - tga.destroy(); + const Graphics::Surface *tgaSurface = tga.getSurface(); + + _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); + + tga.destroy(); + } else { + // TGZ files have a header and then Bitmap data that is compressed with LZSS + uint32 decompressedSize = file.readSint32LE(); + uint32 width = file.readSint32LE(); + uint32 height = file.readSint32LE(); + + LzssReadStream stream(&file, false, decompressedSize); + byte *buffer = new byte[stream.currentSize()]; + stream.read(buffer, stream.currentSize()); + + //Graphics::PixelFormat format(16, 5, 6, 5, 0, 11, 5, 0, 0); + // Graphics::PixelFormat format(16, 5, 5, 5, 1, 11, 6, 1, 0); + + _system->copyRectToScreen(buffer, width * 2, x, y, width, height); + } + _needsScreenUpdate = true; + } else { + error("Could not open file %s", fileName.c_str()); } } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 7ff03ca719e7..31c65a82af83 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -71,7 +71,7 @@ class ZVision : public Engine { virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; - void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height); + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); private: void initialize(); From ca89f7679881aeb2ce056592f5d38531db2465fd Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 11:31:05 -0500 Subject: [PATCH 0299/1332] ZVISION: Move early break out above the for loop. LzssReadStream::decompressBytes() The other code would go through each of the for loops and do nothing due to EOS. --- engines/zvision/lzss_read_stream.cpp | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 69b49c596c66..61b5b1639347 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -52,49 +52,49 @@ void LzssReadStream::decompressBytes(uint32 numberOfBytes) { while (!_source->eos() && bytesRead <= numberOfBytes) { byte flagbyte = _source->readByte(); + if (_source->eos()) + break; byte mask = 1; for (uint32 i = 0; i < 8; i++) { - if (!_source->eos()) { - if ((flagbyte & mask) == mask) + if ((flagbyte & mask) == mask) + { + byte data = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + _window[_windowCursor] = data; + _destination.push_back(data); + + // Increment and wrap the window cursor + _windowCursor = (_windowCursor + 1) & 0xFFF; + } + else + { + byte low = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + byte high = _source->readByte(); + bytesRead++; + if (_source->eos()) + break; + + uint16 length = (high & 0xF) + 2; + uint16 offset = low | ((high & 0xF0)<<4); + + for(byte j = 0; j <= length; j++) { - byte data = _source->readByte(); - bytesRead++; - if (_source->eos()) - break; - - _window[_windowCursor] = data; - _destination.push_back(data); - - // Increment and wrap the window cursor + byte temp = _window[(offset + j) & 0xFFF]; + _window[_windowCursor] = temp; + _destination.push_back(temp); _windowCursor = (_windowCursor + 1) & 0xFFF; } - else - { - byte low = _source->readByte(); - bytesRead++; - if (_source->eos()) - break; - - byte high = _source->readByte(); - bytesRead++; - if (_source->eos()) - break; - - uint16 length = (high & 0xF) + 2; - uint16 offset = low | ((high & 0xF0)<<4); - - for(byte j = 0; j <= length; j++) - { - byte temp = _window[(offset + j) & 0xFFF]; - _window[_windowCursor] = temp; - _destination.push_back(temp); - _windowCursor = (_windowCursor + 1) & 0xFFF; - } - }; - - mask = mask << 1; - } + }; + + mask = mask << 1; } } } From 00c028476513c5f41d5ac9941a7315163eeae307 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 11:45:10 -0500 Subject: [PATCH 0300/1332] ZVISION: Conform to new eventRecorder code --- engines/zvision/events.cpp | 2 +- engines/zvision/video.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index cb1ef53248d9..984d59e2ba43 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -24,7 +24,7 @@ #include "zvision/zvision.h" #include "zvision/console.h" -#include "common/EventRecorder.h" +#include "common/events.h" namespace ZVision { diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 4e5fe82f9790..8f77554619c5 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -29,7 +29,7 @@ #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" -#include "common/EventRecorder.h" +#include "common/events.h" #include "common/file.h" namespace ZVision { From ec7915bcb9d507979fa51d76de736f10b8060255 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 11:45:59 -0500 Subject: [PATCH 0301/1332] ZVISION: Fix eos checking in LzssReadStream --- engines/zvision/lzss_read_stream.cpp | 14 +++++++++----- engines/zvision/lzss_read_stream.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 61b5b1639347..a7cdcd9d88e9 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -30,7 +30,8 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source, bool stream, : _source(source), // It's convention to set the starting cursor position to blockSize - 16 _windowCursor(0x0FEE), - _readCursor(0) { + _readCursor(0), + _eosFlag(false) { // Clear the window to null memset(_window, 0, blockSize); @@ -104,8 +105,7 @@ void LzssReadStream::decompressAll() { } bool LzssReadStream::eos() const { - // Make sure that we've read all of the source - return _readCursor >= _destination.size() && _source->eos(); + return _eosFlag; } uint32 LzssReadStream::read(void *dataPtr, uint32 dataSize) { @@ -114,15 +114,19 @@ uint32 LzssReadStream::read(void *dataPtr, uint32 dataSize) { while (dataSize > _destination.size() - _readCursor) { // Check if we can read any more data from source if (_source->eos()) { + // Shorten the dataSize to what we have left and flag that we're at EOS dataSize = _destination.size() - _readCursor; + _eosFlag = true; break; } decompressBytes(blockSize); } - memcpy(dataPtr, _destination.begin() + _readCursor, dataSize); - _readCursor += dataSize; + if (dataSize > 0) { + memcpy(dataPtr, _destination.begin() + _readCursor, dataSize); + _readCursor += dataSize; + } return dataSize; } diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 7e6511a5a9b9..9ef1d6da371e 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -53,6 +53,7 @@ class LzssReadStream : public Common::ReadStream { char _window[blockSize]; uint16 _windowCursor; uint32 _readCursor; + bool _eosFlag; public: bool eos() const; From 811ea394862a35faacd2e87c68ef57a501f67f3c Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 7 Jul 2013 12:23:12 -0500 Subject: [PATCH 0302/1332] ZVISION: Update module.mk with current objs --- engines/zvision/module.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 3dd17a2f99df..3d672d96bcc2 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -1,8 +1,20 @@ MODULE := engines/zvision MODULE_OBJS := \ + actions.o \ + console.o \ detection.o \ + events.o \ + graphics.o \ + image.o \ + lzss_read_stream.o \ + scr_file_handling.o \ + script_manager.o \ + scripts.o \ + single_value_container.o \ + video.o \ zvision.o \ + zfs_archive.o \ zork_avi_decoder.o \ zork_raw.o From 4c7db7f5de574833b360653e423d8240d7af8fa9 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 8 Jul 2013 14:03:37 -0500 Subject: [PATCH 0303/1332] ZVISION: renderImageToScreen: Check for TGZ first instead of TGA TGA's aren't required to have a magic number in the header, but TGZ are. Therefore it's easier to identify TGZ files. --- engines/zvision/image.cpp | 82 +++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index 1463401e0f06..35ec9b3e2f66 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -35,49 +35,49 @@ namespace ZVision { void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { Common::File file; - if (file.open(fileName)) { - // Read the magic number - // Some files are true TGA, while others are TGZ - char fileType[4]; - file.read(fileType, 4); - - // Check for true TGA files - if (fileType[0] == 'T' && fileType[1] == 'G' && fileType[2] == 'A' && fileType[3] == '\0') { - // Reset the cursor - file.seek(0); - - // Decode - Graphics::TGADecoder tga; - if (!tga.loadStream(file)) - error("Error while reading TGA image"); - file.close(); - - const Graphics::Surface *tgaSurface = tga.getSurface(); - - _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); - - tga.destroy(); - } else { - // TGZ files have a header and then Bitmap data that is compressed with LZSS - uint32 decompressedSize = file.readSint32LE(); - uint32 width = file.readSint32LE(); - uint32 height = file.readSint32LE(); - - LzssReadStream stream(&file, false, decompressedSize); - byte *buffer = new byte[stream.currentSize()]; - stream.read(buffer, stream.currentSize()); - - //Graphics::PixelFormat format(16, 5, 6, 5, 0, 11, 5, 0, 0); - // Graphics::PixelFormat format(16, 5, 5, 5, 1, 11, 6, 1, 0); - - _system->copyRectToScreen(buffer, width * 2, x, y, width, height); - } - - - _needsScreenUpdate = true; - } else { + if (!file.open(fileName)) { error("Could not open file %s", fileName.c_str()); + return; } + + // Read the magic number + // Some files are true TGA, while others are TGZ + char fileType[4]; + file.read(fileType, 4); + + // Check for TGZ files + if (fileType[0] == 'T' && fileType[1] == 'G' && fileType[2] == 'Z' && fileType[3] == '\0') { + // TGZ files have a header and then Bitmap data that is compressed with LZSS + uint32 decompressedSize = file.readSint32LE(); + uint32 width = file.readSint32LE(); + uint32 height = file.readSint32LE(); + + LzssReadStream stream(&file, false, decompressedSize); + byte *buffer = new byte[stream.currentSize()]; + stream.read(buffer, stream.currentSize()); + + //Graphics::PixelFormat format(16, 5, 6, 5, 0, 11, 5, 0, 0); + // Graphics::PixelFormat format(16, 5, 5, 5, 1, 11, 6, 1, 0); + + _system->copyRectToScreen(buffer, width * 2, x, y, width, height); + } else { + // Reset the cursor + file.seek(0); + + // Decode + Graphics::TGADecoder tga; + if (!tga.loadStream(file)) + error("Error while reading TGA image"); + file.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); + + tga.destroy(); + } + + _needsScreenUpdate = true; } } // End of namespace ZVision From afbcca2187c7a07e6e0853bd0befdc1e9a67dce2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 8 Jul 2013 16:04:18 -0500 Subject: [PATCH 0304/1332] ZVISION: Move engine width, height, and pixelFormat to const member variables --- engines/zvision/image.cpp | 4 ---- engines/zvision/zvision.cpp | 12 ++++++++---- engines/zvision/zvision.h | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index 35ec9b3e2f66..981308fa3160 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -56,9 +56,6 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint byte *buffer = new byte[stream.currentSize()]; stream.read(buffer, stream.currentSize()); - //Graphics::PixelFormat format(16, 5, 6, 5, 0, 11, 5, 0, 0); - // Graphics::PixelFormat format(16, 5, 5, 5, 1, 11, 6, 1, 0); - _system->copyRectToScreen(buffer, width * 2, x, y, width, height); } else { // Reset the cursor @@ -71,7 +68,6 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint file.close(); const Graphics::Surface *tgaSurface = tga.getSurface(); - _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); tga.destroy(); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 4653b303467c..ac810d8d07f6 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -41,7 +41,13 @@ namespace ZVision { -ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { +ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) + : Engine(syst), + _gameDescription(gameDesc), + _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 + _currentVideo(0), + _width(640), + _height(480) { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). @@ -94,9 +100,7 @@ void ZVision::initialize() { SearchMan.add(name, archive); } - //Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); // ARGB8888 - Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555 - initGraphics(640, 480, true, &format); + initGraphics(_width, _height, true, &_pixelFormat); _scriptManager->initialize(); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 31c65a82af83..d18319a056b3 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -54,12 +54,14 @@ class ZVision : public Engine { private: Console *_console; const ZVisionGameDescription *_gameDescription; + const Graphics::PixelFormat _pixelFormat; + const int _width; + const int _height; // We need random numbers Common::RandomSource *_rnd; - + // Managers ScriptManager *_scriptManager; - // To prevent allocation every time we process events Common::Event _event; From 76b2aa33ca129b1c7a626f1a043e5d828e72af57 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 8 Jul 2013 16:08:16 -0500 Subject: [PATCH 0305/1332] ZVISION: Create/refactor methods for playing video. The pixel format for videos is not the same as for the rest of the game. (Game: RGB 555, Video: RGB 565) --- engines/zvision/video.cpp | 79 +++++++++++++++---------------------- engines/zvision/zvision.cpp | 10 +++-- engines/zvision/zvision.h | 5 +++ 3 files changed, 44 insertions(+), 50 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 8f77554619c5..5e27e3ada189 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -21,16 +21,14 @@ */ #include "common/scummsys.h" + #include "common/system.h" +#include "engines/util.h" -#include "engines/engine.h" -#include "graphics/decoders/tga.h" +#include "graphics/surface.h" -#include "zvision/zork_avi_decoder.h" -#include "zvision/zork_raw.h" +#include "zvision/zvision.h" -#include "common/events.h" -#include "common/file.h" namespace ZVision { @@ -73,63 +71,50 @@ void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte b } } -void playVideo(Video::VideoDecoder *videoDecoder /*, VideoState videoState*/) { +void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { if (!videoDecoder) return; - videoDecoder->start(); + _currentVideo = videoDecoder; - byte *scaleBuffer = 0; - byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; - uint16 width = videoDecoder->getWidth(); - uint16 height = videoDecoder->getHeight(); - uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; - uint16 screenWidth = 640;//g_sci->_gfxScreen->getDisplayWidth(); - uint16 screenHeight = 480;//g_sci->_gfxScreen->getDisplayHeight(); + Common::List formats; + formats.push_back(videoDecoder->getPixelFormat()); + initGraphics(640, 480, true, formats); + _currentVideo->start(); - bool zoom2x = true; + continueVideo(); +} - if (zoom2x) { - width *= 2; - height *= 2; - pitch *= 2; - scaleBuffer = new byte[width * height * bytesPerPixel]; +void ZVision::continueVideo() { + if (_currentVideo == 0) { + warning("No video loaded. Nothing to continue"); + return; } - uint16 x, y; - - x = (screenWidth - width) / 2; - y = (screenHeight - height) / 2; + byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; + uint16 width = _currentVideo->getWidth(); + uint16 height = _currentVideo->getHeight(); + uint16 pitch = _currentVideo->getWidth() * bytesPerPixel; - bool skipVideo = false; + uint16 x = (_system->getWidth() - width) / 2; + uint16 y = (_system->getWidth() - height) / 2; - while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { - if (videoDecoder->needsUpdate()) { - const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + if (!_currentVideo->endOfVideo()) { + if (_currentVideo->needsUpdate()) { + const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); if (frame) { - if (scaleBuffer) { - scale2x((byte *)frame->pixels, 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->updateScreen(); - } - } + _system->copyRectToScreen(frame->pixels, pitch, x, y, width, height); - Common::Event event; - while (g_system->getEventManager()->pollEvent(event)) { - if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) - skipVideo = true; + _needsScreenUpdate = true; + } } - - g_system->delayMillis(10); + } else { + initGraphics(_width, _height, true, &_pixelFormat); + delete _currentVideo; + _currentVideo = 0; } - delete[] scaleBuffer; - delete videoDecoder; } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index ac810d8d07f6..de1730f3544a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -122,9 +122,13 @@ Common::Error ZVision::run() { currentTime = _system->getMillis(); uint32 deltaTime = currentTime - lastTime; lastTime = currentTime; - - updateScripts(); - updateAnimations(deltaTime); + + if (_currentVideo != 0) + continueVideo(); + else { + updateScripts(); + updateAnimations(deltaTime); + } if (_needsScreenUpdate || _console->isActive()) { _system->updateScreen(); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index d18319a056b3..ffda12ac1af8 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -27,6 +27,8 @@ #include "common/random.h" #include "common/events.h" +#include "video/video_decoder.h" + #include "engines/engine.h" #include "zvision/script_manager.h" @@ -67,6 +69,7 @@ class ZVision : public Engine { bool _needsScreenUpdate; + Video::VideoDecoder *_currentVideo; public: uint32 getFeatures() const; Common::Language getLanguage() const; @@ -74,6 +77,8 @@ class ZVision : public Engine { ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); + void startVideo(Video::VideoDecoder *videoDecoder); + void continueVideo(); private: void initialize(); From 4398c04a7b20c5ccb5033d04430479c795f9dff8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 8 Jul 2013 16:14:02 -0500 Subject: [PATCH 0306/1332] ZVISION: Create console command for loading a video --- engines/zvision/console.cpp | 34 +++++++++++++++++++++++++--------- engines/zvision/console.h | 1 + engines/zvision/video.cpp | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 3af67408cb4b..3721c94f42d5 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -26,21 +26,37 @@ #include "zvision/console.h" #include "zvision/zvision.h" +#include "zvision/zork_avi_decoder.h" namespace ZVision { - Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { - DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); +Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { + DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); + DCmd_Register("loadvideo", WRAP_METHOD(Console, cmdLoadVideo)); +} + +bool Console::cmdLoadImage(int argc, const char **argv) { + if (argc != 4) { + DebugPrintf("Use loadimage to load an image to the screen"); + return false; } + _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); + + return true; +} - bool Console::cmdLoadImage(int argc, const char **argv) { - if (argc != 4) { - DebugPrintf("Use loadimage to load an image to the screen"); - return false; - } - _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); +bool Console::cmdLoadVideo(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use loadvideo to load a video to the screen"); + return false; + } - return true; + Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); + if (videoDecoder && videoDecoder->loadFile(argv[1])) { + _engine->startVideo(videoDecoder); } + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index c341b8d226a2..66037983aedb 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -38,6 +38,7 @@ namespace ZVision { ZVision *_engine; bool cmdLoadImage(int argc, const char **argv); + bool cmdLoadVideo(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 5e27e3ada189..b5e9fa098c91 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -82,6 +82,7 @@ void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { initGraphics(640, 480, true, formats); _currentVideo->start(); + // Load the first frame continueVideo(); } From 0451503ecc415a7f871652040fc23e221d3e4d63 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 10 Jul 2013 18:06:10 -0500 Subject: [PATCH 0307/1332] ZVISION: Remove implicit cast between integer types --- engines/zvision/zfs_archive.cpp | 4 ++-- engines/zvision/zfs_archive.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index 85933b32406d..fbfe3d3dc427 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -76,7 +76,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { nextOffset = stream->readUint32LE(); // Read in each entry header - for (int i = 0; i < _header.filesPerBlock; i++) { + for (uint32 i = 0; i < _header.filesPerBlock; i++) { ZfsEntryHeader entryHeader; entryHeader.name = readEntryName(stream); @@ -145,7 +145,7 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common:: return new Common::MemoryReadStream(buffer, entryHeader->size, DisposeAfterUse::YES); } -void ZfsArchive::unXor(byte *buffer, int length, const byte *xorKey) const { +void ZfsArchive::unXor(byte *buffer, uint32 length, const byte *xorKey) const { for (uint32 i = 0; i < length; i++) buffer[i] ^= xorKey[i % 4]; } diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/zfs_archive.h index ccdf192571f6..cb371f2c8785 100644 --- a/engines/zvision/zfs_archive.h +++ b/engines/zvision/zfs_archive.h @@ -113,7 +113,7 @@ class ZfsArchive : public Common::Archive { * @param buffer The data to decode * @param length Length of buffer */ - void unXor(byte *buffer, int length, const byte *xorKey) const; + void unXor(byte *buffer, uint32 length, const byte *xorKey) const; }; } // End of namespace ZVision From 61a2fffafd708828dd6cef4dff4dc971e8541654 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 10 Jul 2013 23:13:50 -0500 Subject: [PATCH 0308/1332] ZVISION: Standardize naming conventions to fit the rest of the code base --- engines/zvision/actions.cpp | 26 +++++++++++++------------- engines/zvision/actions.h | 22 +++++++++++----------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 23f7f166c80d..9bdc6aa98173 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -35,8 +35,8 @@ ActionAdd::ActionAdd(Common::String line) { sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value); } -bool ActionAdd::execute(ZVision *zVision) { - zVision->getScriptManager()->addToStateValue(_key, _value); +bool ActionAdd::execute(ZVision *engine) { + engine->getScriptManager()->addToStateValue(_key, _value); return true; } @@ -49,8 +49,8 @@ ActionAssign::ActionAssign(Common::String line) { sscanf(line.c_str(), ":assign(%u, %hhu)", &_key, &_value); } -bool ActionAssign::execute(ZVision *zVision) { - zVision->getScriptManager()->setStateValue(_key, _value); +bool ActionAssign::execute(ZVision *engine) { + engine->getScriptManager()->setStateValue(_key, _value); return true; } @@ -63,7 +63,7 @@ ActionAttenuate::ActionAttenuate(Common::String line) { sscanf(line.c_str(), ":assign(%u, %hd)", &_key, &_attenuation); } -bool ActionAttenuate::execute(ZVision *zVision) { +bool ActionAttenuate::execute(ZVision *engine) { // TODO: Implement return true; } @@ -77,7 +77,7 @@ ActionChangeLocation::ActionChangeLocation(Common::String line) { sscanf(line.c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); } -bool ActionChangeLocation::execute(ZVision *zVision) { +bool ActionChangeLocation::execute(ZVision *engine) { // TODO: Implement return true; } @@ -93,7 +93,7 @@ ActionCrossfade::ActionCrossfade(Common::String line) { &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } -bool ActionCrossfade::execute(ZVision *zVision) { +bool ActionCrossfade::execute(ZVision *engine) { // TODO: Implement return true; } @@ -108,7 +108,7 @@ ActionPreloadAnimation::ActionPreloadAnimation(Common::String line) { sscanf(line.c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); } -bool ActionPreloadAnimation::execute(ZVision *zVision) { +bool ActionPreloadAnimation::execute(ZVision *engine) { // TODO: Implement return true; } @@ -125,7 +125,7 @@ ActionPlayAnimation::ActionPlayAnimation(Common::String line) { &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } -bool ActionPlayAnimation::execute(ZVision *zVision) { +bool ActionPlayAnimation::execute(ZVision *engine) { // TODO: Implement return true; } @@ -139,9 +139,9 @@ ActionRandom::ActionRandom(Common::String line) { sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); } -bool ActionRandom::execute(ZVision *zVision) { - uint32 randNumber = zVision->getRandomSource()->getRandomNumber(_max); - zVision->getScriptManager()->setStateValue(_key, randNumber); +bool ActionRandom::execute(ZVision *engine) { + uint32 randNumber = engine->getRandomSource()->getRandomNumber(_max); + engine->getScriptManager()->setStateValue(_key, randNumber); return true; } @@ -154,8 +154,8 @@ ActionTimer::ActionTimer(Common::String line) { sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time); } -bool ActionTimer::execute(ZVision *zVision) { // TODO: Implement +bool ActionTimer::execute(ZVision *engine) { return true; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index a58ef68e3465..aed8483ee798 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -35,7 +35,7 @@ class ZVision; class ResultAction { public: virtual ~ResultAction() {} - virtual bool execute(ZVision *zVision) = 0; + virtual bool execute(ZVision *engine) = 0; }; @@ -75,7 +75,7 @@ class ResultAction { class ActionAdd : public ResultAction { public: ActionAdd(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -85,7 +85,7 @@ class ActionAdd : public ResultAction { class ActionAssign : public ResultAction { public: ActionAssign(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -95,7 +95,7 @@ class ActionAssign : public ResultAction { class ActionAttenuate : public ResultAction { public: ActionAttenuate(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -105,7 +105,7 @@ class ActionAttenuate : public ResultAction { class ActionChangeLocation : public ResultAction { public: ActionChangeLocation(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: char _world; @@ -117,7 +117,7 @@ class ActionChangeLocation : public ResultAction { class ActionCrossfade : public ResultAction { public: ActionCrossfade(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _keyOne; @@ -132,7 +132,7 @@ class ActionCrossfade : public ResultAction { class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -151,7 +151,7 @@ class ActionPlayAnimation : public ResultAction { class ActionPreloadAnimation : public ResultAction { public: ActionPreloadAnimation(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -164,13 +164,13 @@ class ActionPreloadAnimation : public ResultAction { //class ActionUnloadAnimation : public ResultAction { //public: // ActionUnloadAnimation(Common::String line); -// bool execute(ZVision *zVision); +// bool execute(ZVision *engine); //}; class ActionRandom : public ResultAction { public: ActionRandom(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; @@ -180,7 +180,7 @@ class ActionRandom : public ResultAction { class ActionTimer : public ResultAction { public: ActionTimer(Common::String line); - bool execute(ZVision *zVision); + bool execute(ZVision *engine); private: uint32 _key; From 4e55d7ba9476cd47a3118ecdeb0d0618e6d32211 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:08:00 -0500 Subject: [PATCH 0309/1332] ZVISION: Clean up includes --- engines/zvision/puzzle.h | 8 ++++---- engines/zvision/scr_file_handling.cpp | 4 ++-- engines/zvision/zvision.h | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 9dab606f5473..7a2755fd69d1 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,10 +25,10 @@ #include "common/list.h" -#include "zvision/actions.h" - namespace ZVision { +class ResultAction; + /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, @@ -48,8 +48,8 @@ struct Criteria { uint32 argument; /** How to do the comparison */ CriteriaOperator criteriaOperator; - /** Whether 'argument' is the id of a global state (true) or a pure value (false) */ - bool isArgumentAnId; + /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ + bool argumentIsAKey; }; enum StateFlags { diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index a0ecf6bb4c81..6bf73733e577 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -111,10 +111,10 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const token = tokenizer.nextToken(); if (token.contains('[')) { sscanf(token.c_str(), "[%u]", &(criteria.argument)); - criteria.isArgumentAnId = true; + criteria.argumentIsAKey = true; } else { sscanf(token.c_str(), "%u", &(criteria.argument)); - criteria.isArgumentAnId = false; + criteria.argumentIsAKey = false; } line = stream.readLine(); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index ffda12ac1af8..bec882758374 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -31,14 +31,13 @@ #include "engines/engine.h" -#include "zvision/script_manager.h" - #include "gui/debugger.h" namespace ZVision { struct ZVisionGameDescription; class Console; +class ScriptManager; // our engine debug channels enum { From 9d478206f85769e5cbe7f1eda0ec8b9ac390dbc0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:10:50 -0500 Subject: [PATCH 0310/1332] ZVISION: Move utility functions to a cpp file with declarations in a header file --- engines/zvision/utility.cpp | 180 ++++++++++++++++++++++++++++++++++++ engines/zvision/utility.h | 149 +---------------------------- 2 files changed, 184 insertions(+), 145 deletions(-) create mode 100644 engines/zvision/utility.cpp diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp new file mode 100644 index 000000000000..41b589d0c0c7 --- /dev/null +++ b/engines/zvision/utility.cpp @@ -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. + * + */ + +#include "common/scummsys.h" + +#include "zvision/utility.h" + +namespace ZVision { + +void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) { + Common::File f; + f.open(sourceFile); + byte* buffer = new byte[f.size()]; + f.read(buffer, f.size()); + + Common::DumpFile dumpFile; + dumpFile.open(destFile); + + dumpFile.write(buffer, f.size()); + dumpFile.flush(); + dumpFile.close(); + + delete[] buffer; +} + +void trimCommentsAndWhiteSpace(Common::String *string) { + for (int i = string->size() - 1; i >= 0; i--) { + if ((*string)[i] == '#') { + string->erase(i); + } + } + + string->trim(); +} + +void tryToDumpLine(const Common::String &key, + Common::String &line, + Common::HashMap *count, + Common::HashMap *fileAlreadyUsed, + Common::DumpFile &output) { + const byte numberOfExamplesPerType = 8; + + if ((*count)[key] < numberOfExamplesPerType && !(*fileAlreadyUsed)[key]) { + output.writeString(line); + output.writeByte('\n'); + (*count)[key]++; + (*fileAlreadyUsed)[key] = true; + } +} + +void dumpEveryResultAction(const Common::String &destFile) { + Common::HashMap count; + Common::HashMap fileAlreadyUsed; + + Common::DumpFile output; + output.open(destFile); + + // Find scr files + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.scr"); + + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + Common::SeekableReadStream *stream = (*iter)->createReadStream(); + + Common::String line = stream->readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream->eos()) { + if (line.matchString("*:add*", true)) { + tryToDumpLine("add", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animplay*", true)) { + tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animpreload*", true)) { + tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:animunload*", true)) { + tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:attenuate*", true)) { + tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:assign*", true)) { + tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:change_location*", true)) { + tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) { + tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:debug*", true)) { + tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:delay_render*", true)) { + tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:disable_control*", true)) { + tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:disable_venus*", true)) { + tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:display_message*", true)) { + tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:dissolve*", true)) { + tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:distort*", true)) { + tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:enable_control*", true)) { + tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:flush_mouse_events*", true)) { + tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:inventory*", true)) { + tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:kill*", true)) { + tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:menu_bar_enable*", true)) { + tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:music*", true)) { + tryToDumpLine("music", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:pan_track*", true)) { + tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:playpreload*", true)) { + tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:preferences*", true)) { + tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:quit*", true)) { + tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:random*", true)) { + tryToDumpLine("random", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:region*", true)) { + tryToDumpLine("region", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:restore_game*", true)) { + tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:rotate_to*", true)) { + tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:save_game*", true)) { + tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_partial_screen*", true)) { + tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_screen*", true)) { + tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:set_venus*", true)) { + tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:stop*", true)) { + tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:streamvideo*", true)) { + tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:syncsound*", true)) { + tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:timer*", true)) { + tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:ttytext*", true)) { + tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output); + } else if (line.matchString("*:universe_music*", true)) { + tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output); + } + + line = stream->readLine(); + trimCommentsAndWhiteSpace(&line); + } + + for (Common::HashMap::iterator iter = fileAlreadyUsed.begin(); iter != fileAlreadyUsed.end(); ++iter) { + iter->_value = false; + } + } + + output.close(); +} + +} // End of namespace ZVision diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 0b2ef2b8cd73..43d28df6c99d 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -26,6 +26,7 @@ #include "common/str.h" #include "common/file.h" +#include "common/array.h" namespace ZVision { @@ -36,21 +37,7 @@ namespace ZVision { * @param sourceFile The 'file' you want the contents of * @param destFile The name of the file where the content will be written to */ -void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) { - Common::File f; - f.open(sourceFile); - byte* buffer = new byte[f.size()]; - f.read(buffer, f.size()); - - Common::DumpFile dumpFile; - dumpFile.open(destFile); - - uint32 writtenBytes = dumpFile.write(buffer, f.size()); - dumpFile.flush(); - dumpFile.close(); - - delete[] buffer; -} +void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile); /** * Removes any line comments using '#' as a sequence start. @@ -59,30 +46,7 @@ void writeFileContentsToFile(const Common::String &sourceFile, const Common::Str * * @param string The string to modify. It is modified in place */ -void trimCommentsAndWhiteSpace(Common::String *string) { - for (int i = string->size() - 1; i >= 0; i--) { - if ((*string)[i] == '#') { - string->erase(i); - } - } - - string->trim(); -} - -void tryToDumpLine(const Common::String &key, - Common::String &line, - Common::HashMap *count, - Common::HashMap *fileAlreadyUsed, - Common::DumpFile &output) { - const byte numberOfExamplesPerType = 8; - - if ((*count)[key] < numberOfExamplesPerType && !(*fileAlreadyUsed)[key]) { - output.writeString(line); - output.writeByte('\n'); - (*count)[key]++; - (*fileAlreadyUsed)[key] = true; - } -} +void trimCommentsAndWhiteSpace(Common::String *string); /** * Searches through all the .scr files and dumps 'numberOfExamplesPerType' examples of each type of ResultAction @@ -90,116 +54,11 @@ void tryToDumpLine(const Common::String &key, * * @param destFile Where to write the examples */ -void dumpEveryResultAction(const Common::String &destFile) { - - - Common::HashMap count; - Common::HashMap fileAlreadyUsed; - - Common::DumpFile output; - output.open(destFile); - - // Find scr files - Common::ArchiveMemberList list; - SearchMan.listMatchingMembers(list, "*.scr"); +void dumpEveryResultAction(const Common::String &destFile); - for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { - Common::SeekableReadStream *stream = (*iter)->createReadStream(); - Common::String line = stream->readLine(); - trimCommentsAndWhiteSpace(&line); - - while (!stream->eos()) { - if (line.matchString("*:add*", true)) { - tryToDumpLine("add", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:animplay*", true)) { - tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:animpreload*", true)) { - tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:animunload*", true)) { - tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:attenuate*", true)) { - tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:assign*", true)) { - tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:change_location*", true)) { - tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) { - tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:debug*", true)) { - tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:delay_render*", true)) { - tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:disable_control*", true)) { - tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:disable_venus*", true)) { - tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:display_message*", true)) { - tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:dissolve*", true)) { - tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:distort*", true)) { - tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:enable_control*", true)) { - tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:flush_mouse_events*", true)) { - tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:inventory*", true)) { - tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:kill*", true)) { - tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:menu_bar_enable*", true)) { - tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:music*", true)) { - tryToDumpLine("music", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:pan_track*", true)) { - tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:playpreload*", true)) { - tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:preferences*", true)) { - tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:quit*", true)) { - tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:random*", true)) { - tryToDumpLine("random", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:region*", true)) { - tryToDumpLine("region", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:restore_game*", true)) { - tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:rotate_to*", true)) { - tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:save_game*", true)) { - tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:set_partial_screen*", true)) { - tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:set_screen*", true)) { - tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:set_venus*", true)) { - tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:stop*", true)) { - tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:streamvideo*", true)) { - tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:syncsound*", true)) { - tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:timer*", true)) { - tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:ttytext*", true)) { - tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output); - } else if (line.matchString("*:universe_music*", true)) { - tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output); - } - - line = stream->readLine(); - trimCommentsAndWhiteSpace(&line); - } - - for (Common::HashMap::iterator iter = fileAlreadyUsed.begin(); iter != fileAlreadyUsed.end(); ++iter) { - (*iter)._value = false; } } - - output.close(); } } // End of namespace ZVision From d672c2c44093269ce1c0bd8107346d05f4c1b225 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:11:21 -0500 Subject: [PATCH 0311/1332] ZVISION: Remove unused methods from ZVision class --- engines/zvision/graphics.cpp | 8 -------- engines/zvision/zvision.h | 3 --- 2 files changed, 11 deletions(-) diff --git a/engines/zvision/graphics.cpp b/engines/zvision/graphics.cpp index 7d1201c4f9f1..610960dd723c 100644 --- a/engines/zvision/graphics.cpp +++ b/engines/zvision/graphics.cpp @@ -26,12 +26,4 @@ namespace ZVision { -void ZVision::updateScripts() { - -} - -void ZVision::updateAnimations(uint32 detaTimeMillis) { - -} - } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index bec882758374..7f5b8e3a86ac 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -86,9 +86,6 @@ class ZVision : public Engine { void onMouseDown(const Common::Point &pos); void onMouseMove(const Common::Point &pos); void onKeyDown(uint16 keyCode); - - void updateScripts(); - void updateAnimations(uint32 detaTimeMillis); }; } // End of namespace ZVision From 3397edb4f55d2e3f0973f4ffea6668d8f5b4dbb4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:17:32 -0500 Subject: [PATCH 0312/1332] ZVISION: Add ActionNode class This class encases actions that happen over time (timer, animations, etc) Each frame, the engine calls process() on each active ActionNode --- engines/zvision/action_node.cpp | 45 +++++++++++++++++++++++++ engines/zvision/action_node.h | 58 +++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 engines/zvision/action_node.cpp create mode 100644 engines/zvision/action_node.h diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp new file mode 100644 index 000000000000..dec52d961598 --- /dev/null +++ b/engines/zvision/action_node.cpp @@ -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. + * + */ + +#include "common/scummsys.h" + +#include "zvision/action_node.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" + +namespace ZVision { + +NodeTimer::NodeTimer(uint32 key, uint32 timeInSeconds) + : _key(key), _timeLeft(timeInSeconds * 1000) {} + +bool NodeTimer::process(ZVision *engine, uint32 deltaTimeInMillis) { + _timeLeft -= deltaTimeInMillis; + + if (_timeLeft <= 0) { + engine->getScriptManager()->setStateValue(_key, 0); + return true; + } + + return false; +} + +} // End of namespace ZVision diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h new file mode 100644 index 000000000000..cd5c9f3b273a --- /dev/null +++ b/engines/zvision/action_node.h @@ -0,0 +1,58 @@ +/* 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 ZVISION_ACTION_NODE_H +#define ZVISION_ACTION_NODE_H + +#include "common/types.h" + +namespace ZVision { + +class ZVision; + +class ActionNode { +public: + virtual ~ActionNode() {} + virtual bool process(ZVision *engine, uint32 deltaTimeInMillis); +}; + +class NodeTimer : public ActionNode { +public: + NodeTimer(uint32 key, uint32 timeInSeconds); + /** + * Decrement the timer by the delta time. If the timer is finished, set the status + * in _globalState and let this node be deleted + * + * @param engine Pointer to the ZVision instance + * @param deltaTimeInMillis Amount of time that has passed since the last frame + * @return Node should be deleted after this (true) or kept (false) + */ + bool process(ZVision *engine, uint32 deltaTimeInMillis); + +private: + uint32 _key; + uint32 _timeLeft; +}; + +} // End of namespace ZVision + +#endif From ba22c838613912238196d8488a9f781f07416c77 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:18:23 -0500 Subject: [PATCH 0313/1332] ZVISION: Implement ActionTimer::execute() --- engines/zvision/actions.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 9bdc6aa98173..a5b1e951aaef 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -24,6 +24,8 @@ #include "zvision/actions.h" #include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/action_node.h" namespace ZVision { @@ -154,8 +156,8 @@ ActionTimer::ActionTimer(Common::String line) { sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time); } - // TODO: Implement bool ActionTimer::execute(ZVision *engine) { + engine->getScriptManager()->addActionNode(new NodeTimer(_key, _time)); return true; } From 78daaeb583a371edddd67b5399cbc14201fe7ee1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:23:36 -0500 Subject: [PATCH 0314/1332] ZVISION: Create main containers in ScriptManager --- engines/zvision/scr_file_handling.cpp | 6 ++++-- engines/zvision/script_manager.h | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 6bf73733e577..2371c350f77e 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -25,6 +25,7 @@ #include "zvision/script_manager.h" #include "zvision/utility.h" #include "zvision/puzzle.h" +#include "zvision/actions.h" #include "common/textconsole.h" #include "common/file.h" @@ -53,14 +54,15 @@ void ScriptManager::parseScrFile(Common::String fileName) { sscanf(line.c_str(),"puzzle:%u",&(puzzle.key)); parsePuzzle(puzzle, file); - _puzzles.push_back(puzzle); + _activePuzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { Control control; char controlType[20]; sscanf(line.c_str(),"control:%u %s",&(control.id), controlType); parseControl(control, file); - _controls.push_back(control); + /** Holds the currently active puzzles */ + _activeControls.push_back(control); } } } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index f02073b4c686..5be4c171e0e5 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -26,21 +26,33 @@ #include "common/str.h" #include "common/stream.h" #include "common/hashmap.h" +#include "common/stack.h" #include "zvision/puzzle.h" #include "zvision/control.h" -#include "zvision/actions.h" namespace ZVision { +class ActionNode; + class ScriptManager { private: - /** Holds the global state variables. Optimize for fast random access */ + /** + * Holds the global state variable. Do NOT directly modify this. Use the accessors and + * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a + * particular state key are checked after the key is modified. + */ Common::HashMap _globalState; - /** Holds the currently active puzzles. Optimize for fast iteration */ - Common::List _puzzles; - /** Holds the currently active controls. Optimize for fast iteration */ - Common::List _controls; + /** Holds the currently active ActionNodes */ + Common::List _activeNodes; + /** References _globalState keys to Puzzles */ + Common::HashMap> _referenceTable; + /** Holds the Puzzles that should be checked this frame */ + Common::Stack _puzzlesToCheck; + /** Holds the currently active puzzles */ + Common::List _activePuzzles; + /** Holds the currently active controls */ + Common::List _activeControls; public: From 9c7203c4b922845d63b00236a78e48e4f55bd633 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:25:09 -0500 Subject: [PATCH 0315/1332] ZVISION: Create utility method to remove duplicate entries from a Common::Array --- engines/zvision/utility.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 43d28df6c99d..e5713fc7f47e 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -56,7 +56,19 @@ void trimCommentsAndWhiteSpace(Common::String *string); */ void dumpEveryResultAction(const Common::String &destFile); +/** + * Removes all duplicate entries from container. + * + * @param container + * @return + */ +template +void removeDuplicateEntries(Common::Array *container) { + Common::sort(container->front(), container->back()); + for (int i = 0; i < container->size(); i++) { + while (container[i] == container[i +1]) { + container->remove_at(i + 1); } } } From 24dc3e1793749269daa30350a5923f51d7892efd Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:26:32 -0500 Subject: [PATCH 0316/1332] ZVISION: Create ScriptManager state handling logic --- engines/zvision/script_manager.cpp | 88 ++++++++++++++++++++++++++++++ engines/zvision/script_manager.h | 12 ++++ engines/zvision/zvision.cpp | 6 +- 3 files changed, 103 insertions(+), 3 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 13438d4fa688..b4ad1cc00358 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -22,19 +22,103 @@ #include "common/scummsys.h" +#include "common/algorithm.h" +#include "common/hashmap.h" + #include "zvision/script_manager.h" +#include "zvision/actions.h" +#include "zvision/action_node.h" +#include "zvision/utility.h" namespace ZVision { +ScriptManager::ScriptManager(ZVision *engine) : _engine(engine) {} + // TODO: Actually do something in the initialize or remove it void ScriptManager::initialize() { } +void ScriptManager::createReferenceTable() { + // Iterate through each Puzzle + for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { + Puzzle *puzzlePtr = &(*activePuzzleIter); + + // Iterate through each Criteria and add a reference from the criteria key to the Puzzle + for (Common::List::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { + _referenceTable[criteriaIter->key].push_back(puzzlePtr); + + // If the argument is a key, add a reference to it as well + if (criteriaIter->argument) + _referenceTable[criteriaIter->argument].push_back(puzzlePtr); + } + } + + // Remove duplicate entries + for (Common::HashMap>::iterator referenceTableIter; referenceTableIter != _referenceTable.end(); referenceTableIter++) { + removeDuplicateEntries(&(referenceTableIter->_value)); + } +} + +void ScriptManager::updateNodes(uint32 deltaTimeMillis) { + // If process() returns true, it means the node can be deleted + for (Common::List::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { + if ((*iter)->process(_engine, deltaTimeMillis)) { + // Remove the node from _activeNodes, then delete it + ActionNode *node = *iter; + iter = _activeNodes.erase(iter); + delete node; + } else { + iter++; + } + } +} + +void ScriptManager::checkPuzzleCriteria() { + while (!_puzzlesToCheck.empty()) { + Puzzle *puzzle = _puzzlesToCheck.pop(); + // Check each Criteria + for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { + bool criteriaMet = false; + + // Get the value to compare against + byte argumentValue; + if ((*iter).argument) + argumentValue = getStateValue(iter->argument); + else + argumentValue = iter->argument; + + // Do the comparison + switch ((*iter).criteriaOperator) { + case EQUAL_TO: + criteriaMet = getStateValue(iter->key) == argumentValue; + break; + case NOT_EQUAL_TO: + criteriaMet = getStateValue(iter->key) != argumentValue; + break; + case GREATER_THAN: + criteriaMet = getStateValue(iter->key) > argumentValue; + break; + case LESS_THAN: + criteriaMet = getStateValue(iter->key) < argumentValue; + break; + } + + // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) + if (criteriaMet) { + for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + (*resultIter)->execute(_engine); + } + } + } + } +} + byte ScriptManager::getStateValue(uint32 key) { return _globalState[key]; } +// TODO: Add logic to check _referenceTable and add to _puzzlesToCheck if necessary void ScriptManager::setStateValue(uint32 key, byte value) { _globalState[key] = value; } @@ -43,4 +127,8 @@ void ScriptManager::addToStateValue(uint32 key, byte valueToAdd) { _globalState[key] += valueToAdd; } +void ScriptManager::addActionNode(ActionNode *node) { + _activeNodes.push_back(node); +} + } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 5be4c171e0e5..42f4bba60240 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -33,10 +33,15 @@ namespace ZVision { +class ZVision; class ActionNode; class ScriptManager { +public: + ScriptManager(ZVision *engine); + private: + ZVision *_engine; /** * Holds the global state variable. Do NOT directly modify this. Use the accessors and * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a @@ -57,11 +62,18 @@ class ScriptManager { public: void initialize(); + void updateNodes(uint32 deltaTimeMillis); + void checkPuzzleCriteria(); + byte getStateValue(uint32 key); void setStateValue(uint32 key, byte value); void addToStateValue(uint32 key, byte valueToAdd); + void addActionNode(ActionNode *node); + private: + void createReferenceTable(); + /** * Parses a script file into triggers and events * diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index de1730f3544a..c126a9ad7c83 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -70,7 +70,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _rnd = new Common::RandomSource("zvision"); // Create managers - _scriptManager = new ScriptManager(); + _scriptManager = new ScriptManager(this); debug("ZVision::ZVision"); } @@ -126,8 +126,8 @@ Common::Error ZVision::run() { if (_currentVideo != 0) continueVideo(); else { - updateScripts(); - updateAnimations(deltaTime); + _scriptManager->updateNodes(deltaTime); + _scriptManager->checkPuzzleCriteria(); } if (_needsScreenUpdate || _console->isActive()) { From 29061acd4ebeef2686b2ee2ff9c97d6ee4f11e91 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:44:23 -0500 Subject: [PATCH 0317/1332] ZVISION: Add operator< to the Puzzle struct ScriptManager does a unique-fication of a container of Puzzles using a sort with some other logic. The sort uses operator< --- engines/zvision/puzzle.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 7a2755fd69d1..b3831d4665ff 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,6 +64,13 @@ struct Puzzle { // This has to be list of pointers because ResultAction is abstract Common::List resultActions; byte flags; + + // Used by the ScriptManager to allow unique-ification of _referenceTable + // The unique-ification is done by sorting, then iterating and removing duplicates + // The sort uses operator< + const bool operator<(const Puzzle &other) const { + return key < other.key; + } }; } // End of namespace ZVision From ae84e9508e846e7cfd39652f74c0816b399409e7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 17:02:14 -0500 Subject: [PATCH 0318/1332] ZVISION: Add 2x scaling to videos --- engines/zvision/video.cpp | 18 ++++++++++++------ engines/zvision/zvision.cpp | 1 + engines/zvision/zvision.h | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index b5e9fa098c91..0cca486af656 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -79,7 +79,10 @@ void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { Common::List formats; formats.push_back(videoDecoder->getPixelFormat()); - initGraphics(640, 480, true, formats); + initGraphics(_width, _height, true, formats); + + _scaledVideoFrameBuffer = new byte[_currentVideo->getWidth() * _currentVideo->getHeight() * _currentVideo->getPixelFormat().bytesPerPixel * 4]; + _currentVideo->start(); // Load the first frame @@ -95,17 +98,18 @@ void ZVision::continueVideo() { byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; uint16 width = _currentVideo->getWidth(); uint16 height = _currentVideo->getHeight(); - uint16 pitch = _currentVideo->getWidth() * bytesPerPixel; + uint16 pitch = width * bytesPerPixel; - uint16 x = (_system->getWidth() - width) / 2; - uint16 y = (_system->getWidth() - height) / 2; + uint16 x = (_system->getWidth() - (width * 2)) / 2; + uint16 y = (_system->getHeight() - (height * 2)) / 2; if (!_currentVideo->endOfVideo()) { if (_currentVideo->needsUpdate()) { const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); - if (frame) { - _system->copyRectToScreen(frame->pixels, pitch, x, y, width, height); + if (frame) { + scale2x(static_cast(frame->pixels), _scaledVideoFrameBuffer, width, height, bytesPerPixel); + _system->copyRectToScreen(_scaledVideoFrameBuffer, pitch * 2, x, y, width * 2, height * 2); _needsScreenUpdate = true; } @@ -114,6 +118,8 @@ void ZVision::continueVideo() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; + delete _scaledVideoFrameBuffer; + _scaledVideoFrameBuffer = 0; } } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index c126a9ad7c83..475a453c082d 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -46,6 +46,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _gameDescription(gameDesc), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 _currentVideo(0), + _scaledVideoFrameBuffer(0), _width(640), _height(480) { // Put your engine in a sane state, but do nothing big yet; diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 7f5b8e3a86ac..50394a607011 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -69,6 +69,7 @@ class ZVision : public Engine { bool _needsScreenUpdate; Video::VideoDecoder *_currentVideo; + byte *_scaledVideoFrameBuffer; public: uint32 getFeatures() const; Common::Language getLanguage() const; From 09358141de42a2ecb4ad487145dc52345814f8a1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 12 Jul 2013 00:44:05 -0500 Subject: [PATCH 0319/1332] ZVISION: Allow the console to stay open when errors occur --- engines/zvision/console.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 3721c94f42d5..f038af12321d 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -38,7 +38,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { bool Console::cmdLoadImage(int argc, const char **argv) { if (argc != 4) { DebugPrintf("Use loadimage to load an image to the screen"); - return false; + return true; } _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); @@ -48,7 +48,7 @@ bool Console::cmdLoadImage(int argc, const char **argv) { bool Console::cmdLoadVideo(int argc, const char **argv) { if (argc != 2) { DebugPrintf("Use loadvideo to load a video to the screen"); - return false; + return true; } Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); From 8d2bef2936f555cbc675248838079dfe06ff562a Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 13 Jul 2013 11:34:28 -0500 Subject: [PATCH 0320/1332] ZVISION: Create console command for loading sounds --- engines/zvision/console.cpp | 24 ++++++++++++++++++++++++ engines/zvision/console.h | 1 + engines/zvision/zvision.cpp | 4 ++++ engines/zvision/zvision.h | 2 ++ 4 files changed, 31 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index f038af12321d..c3be4ba0f5bc 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -23,16 +23,21 @@ #include "common/scummsys.h" #include "gui/debugger.h" +#include "common/file.h" +#include "common/bufferedstream.h" +#include "audio/mixer.h" #include "zvision/console.h" #include "zvision/zvision.h" #include "zvision/zork_avi_decoder.h" +#include "zvision/zork_raw.h" namespace ZVision { Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); DCmd_Register("loadvideo", WRAP_METHOD(Console, cmdLoadVideo)); + DCmd_Register("loadsound", WRAP_METHOD(Console, cmdLoadSound)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -59,4 +64,23 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { return true; } +bool Console::cmdLoadSound(int argc, const char **argv) { + if (argc != 3) { + DebugPrintf("Use loadsound to load a video to the screen"); + return true; + } + + Common::File *file = new Common::File(); + if (!file->open(argv[1])) { + DebugPrintf("File does not exist"); + return true; + } + + Audio::AudioStream *soundStream = makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), atoi(argv[2]), DisposeAfterUse::YES); + Audio::SoundHandle handle; + _engine->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 66037983aedb..354051d2b01e 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -39,6 +39,7 @@ namespace ZVision { bool cmdLoadImage(int argc, const char **argv); bool cmdLoadVideo(int argc, const char **argv); + bool cmdLoadSound(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 475a453c082d..ba08122ba5fc 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -154,4 +154,8 @@ Common::RandomSource *ZVision::getRandomSource() const { return _rnd; } +Audio::Mixer *ZVision::getMixer() const { + return _mixer; +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 50394a607011..11773a33adb9 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -76,6 +76,8 @@ class ZVision : public Engine { virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; + Audio::Mixer *getMixer() const; + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); void startVideo(Video::VideoDecoder *videoDecoder); void continueVideo(); From 535d6a2a405118ee1e94198f8231532ec2b08bad Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 13 Jul 2013 11:35:19 -0500 Subject: [PATCH 0321/1332] ZVISION: Modify RawZorkStream to use a modified ADPCM codec --- engines/zvision/zork_raw.cpp | 209 +++++++++++++---------------------- engines/zvision/zork_raw.h | 59 ++++++++-- 2 files changed, 131 insertions(+), 137 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index d920550bc72d..69d8edd8dfe8 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -22,164 +22,113 @@ #include "common/scummsys.h" -#include "common/endian.h" +#include "common/stream.h" #include "common/memstream.h" -#include "common/textconsole.h" #include "common/util.h" - #include "audio/audiostream.h" #include "engines/zvision/zork_raw.h" namespace ZVision { -#pragma mark - -#pragma mark --- RawZorkStream --- -#pragma mark - - -/** - * This is a stream, which allows for playing raw PCM data from a stream. - */ -class RawZorkStream : public Audio::SeekableAudioStream { -public: - RawZorkStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) - : _rate(rate), _playtime(0, rate), _stream(stream, disposeStream), _endOfData(false), _buffer(0) { - // Setup our buffer for readBuffer - _buffer = new byte[kSampleBufferLength]; - assert(_buffer); - - // Calculate the total playtime of the stream - _playtime = Audio::Timestamp(0, _stream->size() / 2 / 1, rate); - } - - ~RawZorkStream() { - delete[] _buffer; - } - - int readBuffer(int16 *buffer, const int numSamples); - - bool isStereo() const { return true; } - bool endOfData() const { return _endOfData; } - - int getRate() const { return _rate; } - Audio::Timestamp getLength() const { return _playtime; } - - bool seek(const Audio::Timestamp &where); -private: - const int _rate; ///< Sample rate of stream - Audio::Timestamp _playtime; ///< Calculated total play time - Common::DisposablePtr _stream; ///< Stream to read data from - bool _endOfData; ///< Whether the stream end has been reached - - byte *_buffer; ///< Buffer used in readBuffer - enum { - /** - * How many samples we can buffer at once. - * - * TODO: Check whether this size suffices - * for systems with slow disk I/O. - */ - kSampleBufferLength = 2048 - }; - - /** - * Fill the temporary sample buffer used in readBuffer. - * - * @param maxSamples Maximum samples to read. - * @return actual count of samples read. - */ - int fillBuffer(int maxSamples); -}; - -int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { - int samplesLeft = numSamples; - - while (samplesLeft > 0) { - // Try to read up to "samplesLeft" samples. - int len = fillBuffer(samplesLeft); - - // In case we were not able to read any samples - // we will stop reading here. - if (!len) - break; - - // Adjust the samples left to read. - samplesLeft -= len; - - // Copy the data to the caller's buffer. - const byte *src = _buffer; - while (len-- > 0) { - if (*src < 128) - *buffer++ = ((128 - *src) << 8) ^ 0x8000; - else - *buffer++ = (*src << 8) ^ 0x8000; - src++; - } - } - - return numSamples - samplesLeft; +const int16 RawZorkStream::stepAdjustmentTable[8] = {-1, -1, -1, 1, 4, 7, 10, 12}; + +const int32 RawZorkStream::amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, + 0x0010, 0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, + 0x0022, 0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042, + 0x0049, 0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F, + 0x009D, 0x00AD, 0x00BE, 0x00D1, 0x00E6, 0x00FD, 0x0117, 0x0133, + 0x0151, 0x0173, 0x0198, 0x01C1, 0x01EE, 0x0220, 0x0256, 0x0292, + 0x02D4, 0x031C, 0x036C, 0x03C3, 0x0424, 0x048E, 0x0502, 0x0583, + 0x0610, 0x06AB, 0x0756, 0x0812, 0x08E0, 0x09C3, 0x0ABD, 0x0BD0, + 0x0CFF, 0x0E4C, 0x0FBA, 0x114C, 0x1307, 0x14EE, 0x1706, 0x1954, + 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, + 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; + +RawZorkStream::RawZorkStream(uint32 rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) + : _rate(rate), + _stream(stream, disposeStream), + _endOfData(false) { + _lastSample[0] = {0, 0}; + _lastSample[1] = {0, 0}; + + // Calculate the total playtime of the stream + _playtime = Audio::Timestamp(0, _stream->size() / 2, rate); } -int RawZorkStream::fillBuffer(int maxSamples) { - int bufferedSamples = 0; - byte *dst = _buffer; - - // We can only read up to "kSampleBufferLength" samples - // so we take this into consideration, when trying to - // read up to maxSamples. - maxSamples = MIN(kSampleBufferLength, maxSamples); - - // We will only read up to maxSamples - while (maxSamples > 0 && !endOfData()) { - // Try to read all the sample data and update the - // destination pointer. - const int bytesRead = _stream->read(dst, maxSamples); - dst += bytesRead; +int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { + uint16 bytesRead = 0; - // Calculate how many samples we actually read. - const int samplesRead = bytesRead; + // 0: Left, 1: Right + byte channel = 0; - // Update all status variables - bufferedSamples += samplesRead; - maxSamples -= samplesRead; + while (bytesRead < numSamples) { + byte encodedSample = _stream->readByte(); + bytesRead++; - // We stop stream playback, when we reached the end of the data stream. - // We also stop playback when an error occures. - if (_stream->pos() == _stream->size() || _stream->err() || _stream->eos()) + if (_stream->eos()) { _endOfData = true; + return bytesRead; + } + + uint16 index = _lastSample[channel].index; + uint32 lookUpSample = amplitudeLookupTable[index]; + + int32 sample = 0; + + if (encodedSample & 0x40) + sample += lookUpSample; + if (encodedSample & 0x20) + sample += lookUpSample >> 1; + if (encodedSample & 0x10) + sample += lookUpSample >> 2; + if (encodedSample & 8) + sample += lookUpSample >> 3; + if (encodedSample & 4) + sample += lookUpSample >> 4; + if (encodedSample & 2) + sample += lookUpSample >> 5; + if (encodedSample & 1) + sample += lookUpSample >> 6; + if (encodedSample & 0x80) + sample = -sample; + + sample += _lastSample[channel].sample; + sample = CLIP(sample, -32768, 32767); + + buffer[bytesRead - 1] = (int16)sample; + + index += stepAdjustmentTable[(encodedSample >> 4) & 7]; + index = CLIP(index, 0, 88); + + _lastSample[channel].sample = sample; + _lastSample[channel].index = index; + + // Increment and wrap the channel + channel = (channel + 1) & 1; } - return bufferedSamples; + return bytesRead; } -bool RawZorkStream::seek(const Audio::Timestamp &where) { - _endOfData = true; - - if (where > _playtime) - return false; - - const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); - _stream->seek(seekSample, SEEK_SET); - - // In case of an error we will not continue stream playback. - if (!_stream->err() && !_stream->eos() && _stream->pos() != _stream->size()) - _endOfData = false; +bool RawZorkStream::rewind() { + _stream->seek(0, 0); + _stream->clearErr(); + _endOfData = false; + _lastSample[0] = {0, 0}; + _lastSample[1] = {0, 0}; return true; } -#pragma mark - -#pragma mark --- Raw stream factories --- -#pragma mark - - -Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, +Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, DisposeAfterUse::Flag disposeAfterUse) { assert(stream->size() % 2 == 0); return new RawZorkStream(rate, disposeAfterUse, stream); } -Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, +Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, DisposeAfterUse::Flag disposeAfterUse) { return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 1de3b575baef..43cf4d83d069 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -23,19 +23,64 @@ #ifndef ZVISION_ZORK_RAW_H #define ZVISION_ZORK_RAW_H -#include "common/scummsys.h" #include "common/types.h" - -#include "common/list.h" - +#include "audio/audiostream.h" namespace Common { class SeekableReadStream; } namespace ZVision { +/** + * This is a stream, which allows for playing raw ADPCM data from a stream. + */ +class RawZorkStream : public Audio::RewindableAudioStream { +public: + RawZorkStream(uint32 rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); + + ~RawZorkStream() { + } + +private: + const int _rate; // Sample rate of stream + Audio::Timestamp _playtime; // Calculated total play time + Common::DisposablePtr _stream; // Stream to read data from + bool _endOfData; // Whether the stream end has been reached + + /** + * Holds the frequency and index from the last sample + * 0 holds the left channel, 1 holds the right channel + */ + struct { + int32 sample; + int16 index; + } _lastSample[2]; + + static const int16 stepAdjustmentTable[8]; + + static const int32 amplitudeLookupTable[89]; + +public: + int readBuffer(int16 *buffer, const int numSamples); + + bool isStereo() const { return true; } + bool endOfData() const { return _endOfData; } + + int getRate() const { return _rate; } + Audio::Timestamp getLength() const { return _playtime; } + + bool rewind(); -class SeekableAudioStream; +private: + /** + * Fill the temporary sample buffer used in readBuffer. + * + * @param maxSamples Maximum samples to read. + * @return actual count of samples read. + */ + int fillBuffer(int maxSamples); + uint32 processBlock(); +}; /** * Creates an audio stream, which plays from the given buffer. @@ -46,7 +91,7 @@ class SeekableAudioStream; * @param disposeAfterUse Whether to free the buffer after use (with free!). * @return The new SeekableAudioStream (or 0 on failure). */ -Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, +Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); @@ -58,7 +103,7 @@ Audio::SeekableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, * @param disposeAfterUse Whether to delete the stream after use. * @return The new SeekableAudioStream (or 0 on failure). */ -Audio::SeekableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, +Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); From f88127104b6b59a336761966e9652412083402b7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 15 Jul 2013 10:32:56 -0500 Subject: [PATCH 0322/1332] ZVISION: Fix implicit conversion for scanf-type functions --- engines/zvision/scr_file_handling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 2371c350f77e..6a2e8cf70123 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -41,7 +41,7 @@ void ScriptManager::parseScrFile(Common::String fileName) { while(!file.eos()) { Common::String line = file.readLine(); if (file.err()) { - warning("Error parsing scr file: %s", fileName); + warning("Error parsing scr file: %s", fileName.c_str()); return; } @@ -249,7 +249,7 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List } else { - warning("Unhandled result action type: ", line); + warning("Unhandled result action type: %s", line.c_str()); } line = stream.readLine(); From c45a13cdd716da04c9b64ba50560d7d89facfccb Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 15 Jul 2013 10:33:49 -0500 Subject: [PATCH 0323/1332] ZVISION: Conform to GCC spacing for template inside template --- engines/zvision/script_manager.cpp | 2 +- engines/zvision/script_manager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index b4ad1cc00358..7fcf2f67a3f9 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -55,7 +55,7 @@ void ScriptManager::createReferenceTable() { } // Remove duplicate entries - for (Common::HashMap>::iterator referenceTableIter; referenceTableIter != _referenceTable.end(); referenceTableIter++) { + for (Common::HashMap >::iterator referenceTableIter; referenceTableIter != _referenceTable.end(); referenceTableIter++) { removeDuplicateEntries(&(referenceTableIter->_value)); } } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 42f4bba60240..7924eee4c08a 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -51,7 +51,7 @@ class ScriptManager { /** Holds the currently active ActionNodes */ Common::List _activeNodes; /** References _globalState keys to Puzzles */ - Common::HashMap> _referenceTable; + Common::HashMap > _referenceTable; /** Holds the Puzzles that should be checked this frame */ Common::Stack _puzzlesToCheck; /** Holds the currently active puzzles */ From 644313e8f20fa777325c748a450ca698141c0d97 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 15 Jul 2013 10:35:23 -0500 Subject: [PATCH 0324/1332] ZVISION: Add stereo/mono handling for Zork sound --- engines/zvision/console.cpp | 6 +++--- engines/zvision/zork_raw.cpp | 24 +++++++++++++----------- engines/zvision/zork_raw.h | 13 ++++++++----- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index c3be4ba0f5bc..e0ca37c1d2ca 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -65,8 +65,8 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { } bool Console::cmdLoadSound(int argc, const char **argv) { - if (argc != 3) { - DebugPrintf("Use loadsound to load a video to the screen"); + if (argc != 4) { + DebugPrintf("Use loadsound to load a video to the screen"); return true; } @@ -76,7 +76,7 @@ bool Console::cmdLoadSound(int argc, const char **argv) { return true; } - Audio::AudioStream *soundStream = makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), atoi(argv[2]), DisposeAfterUse::YES); + Audio::AudioStream *soundStream = makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), atoi(argv[2]), atoi(argv[3]), DisposeAfterUse::YES); Audio::SoundHandle handle; _engine->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 69d8edd8dfe8..c4b76d91feff 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -45,8 +45,9 @@ const int32 RawZorkStream::amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; -RawZorkStream::RawZorkStream(uint32 rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) +RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) : _rate(rate), + _stereo(stereo), _stream(stream, disposeStream), _endOfData(false) { _lastSample[0] = {0, 0}; @@ -64,14 +65,13 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { while (bytesRead < numSamples) { byte encodedSample = _stream->readByte(); - bytesRead++; - if (_stream->eos()) { _endOfData = true; return bytesRead; } + bytesRead++; - uint16 index = _lastSample[channel].index; + int16 index = _lastSample[channel].index; uint32 lookUpSample = amplitudeLookupTable[index]; int32 sample = 0; @@ -105,7 +105,7 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { _lastSample[channel].index = index; // Increment and wrap the channel - channel = (channel + 1) & 1; + channel = (channel + 1) & _stereo; } return bytesRead; @@ -122,16 +122,18 @@ bool RawZorkStream::rewind() { } Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - DisposeAfterUse::Flag disposeAfterUse) { + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse) { assert(stream->size() % 2 == 0); - return new RawZorkStream(rate, disposeAfterUse, stream); + return new RawZorkStream(rate, stereo, disposeAfterUse, stream); } Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - DisposeAfterUse::Flag disposeAfterUse) { - return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, DisposeAfterUse::YES); + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse) { + return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, DisposeAfterUse::YES); } } // End of namespace ZVision diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 43cf4d83d069..7386c87f86e6 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -36,7 +36,7 @@ namespace ZVision { */ class RawZorkStream : public Audio::RewindableAudioStream { public: - RawZorkStream(uint32 rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); + RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); ~RawZorkStream() { } @@ -46,6 +46,7 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::Timestamp _playtime; // Calculated total play time Common::DisposablePtr _stream; // Stream to read data from bool _endOfData; // Whether the stream end has been reached + bool _stereo; /** * Holds the frequency and index from the last sample @@ -92,8 +93,9 @@ class RawZorkStream : public Audio::RewindableAudioStream { * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** * Creates an audio stream, which plays from the given stream. @@ -104,8 +106,9 @@ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); } // End of namespace ZVision From 8de12fcbd2dbfddd45bd7916e1e90b5b3e4466bc Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 15 Jul 2013 10:36:24 -0500 Subject: [PATCH 0325/1332] ZVISION: Add underscore prefix to public static variable names --- engines/zvision/lzss_read_stream.cpp | 8 ++++---- engines/zvision/lzss_read_stream.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index a7cdcd9d88e9..2d7acdb8cef1 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -33,17 +33,17 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source, bool stream, _readCursor(0), _eosFlag(false) { // Clear the window to null - memset(_window, 0, blockSize); + memset(_window, 0, _blockSize); // Reserve space in the destination buffer // TODO: Make a better guess - if (decompressedSize == npos) { + if (decompressedSize == _npos) { decompressedSize = source->size(); } _destination.reserve(decompressedSize); if (stream) - decompressBytes(blockSize); + decompressBytes(_blockSize); else decompressAll(); } @@ -120,7 +120,7 @@ uint32 LzssReadStream::read(void *dataPtr, uint32 dataSize) { break; } - decompressBytes(blockSize); + decompressBytes(_blockSize); } if (dataSize > 0) { diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 9ef1d6da371e..142bf9e1a2cd 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -41,16 +41,16 @@ class LzssReadStream : public Common::ReadStream { * @param stream Decompress the data as needed (true) or all at once (false) * @param decompressedSize The size of the decompressed data. If npos, the class will choose a size and grow as needed */ - LzssReadStream(Common::SeekableReadStream *source, bool stream = true, uint32 decompressedSize = npos); + LzssReadStream(Common::SeekableReadStream *source, bool stream = true, uint32 decompressedSize = _npos); public: - static const uint32 npos = 0xFFFFFFFFu; - static const uint16 blockSize = 0x1000u; + static const uint32 _npos = 0xFFFFFFFFu; + static const uint16 _blockSize = 0x1000u; private: Common::SeekableReadStream *_source; Common::Array _destination; - char _window[blockSize]; + char _window[_blockSize]; uint16 _windowCursor; uint32 _readCursor; bool _eosFlag; From a30f49b556ef27644d752368c11590cc48c0fccf Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 16 Jul 2013 16:52:46 -0500 Subject: [PATCH 0326/1332] ZVISION: Add a game type enum to detection This is needed for sound file differentiation --- engines/zvision/detection.cpp | 11 ++++----- engines/zvision/detection.h | 42 +++++++++++++++++++++++++++++++++++ engines/zvision/zvision.cpp | 5 +++-- engines/zvision/zvision.h | 4 +++- 4 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 engines/zvision/detection.h diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 5488ae5be4cb..8c87c9020381 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -23,22 +23,17 @@ #include "base/plugins.h" -#include "engines/advancedDetector.h" - #include "common/translation.h" #include "common/savefile.h" #include "common/str-array.h" #include "common/system.h" #include "zvision/zvision.h" +#include "zvision/detection.h" namespace ZVision { -struct ZVisionGameDescription { - ADGameDescription desc; -}; - uint32 ZVision::getFeatures() const { return _gameDescription->desc.flags; } @@ -47,7 +42,8 @@ Common::Language ZVision::getLanguage() const { return _gameDescription->desc.language; } -} +} // End of namespace ZVision + static const PlainGameDescriptor zVisionGames[] = { {"zvision", "ZVision Game"}, @@ -72,6 +68,7 @@ static const ZVisionGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, + ZorkNemesis }, { AD_TABLE_END_MARKER } diff --git a/engines/zvision/detection.h b/engines/zvision/detection.h new file mode 100644 index 000000000000..b1e5dcbe0161 --- /dev/null +++ b/engines/zvision/detection.h @@ -0,0 +1,42 @@ +/* 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 ZVISION_DETECTION_H +#define ZVISION_DETECTION_H + +#include "engines/advancedDetector.h" + +namespace ZVision { + +enum ZVisionGameId { + ZorkNemesis, + ZorkGrandInquisitor +}; + +struct ZVisionGameDescription { + ADGameDescription desc; + ZVisionGameId gameId; +}; + +} + +#endif diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index ba08122ba5fc..4ce775db868b 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -36,6 +36,7 @@ #include "zvision/console.h" #include "zvision/script_manager.h" #include "zvision/zfs_archive.h" +#include "zvision/detection.h" #include "zvision/utility.h" @@ -154,8 +155,8 @@ Common::RandomSource *ZVision::getRandomSource() const { return _rnd; } -Audio::Mixer *ZVision::getMixer() const { - return _mixer; +ZVisionGameId ZVision::getGameId() const { + return _gameDescription->gameId; } } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 11773a33adb9..17a7c026f1f4 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -31,6 +31,8 @@ #include "engines/engine.h" +#include "zvision/detection.h" + #include "gui/debugger.h" namespace ZVision { @@ -76,7 +78,7 @@ class ZVision : public Engine { virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; - Audio::Mixer *getMixer() const; + ZVisionGameId getGameId() const; void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); void startVideo(Video::VideoDecoder *videoDecoder); From 9f7ff84fe4b9362a80ccf6b0f40602e01fb991d1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 16 Jul 2013 16:55:18 -0500 Subject: [PATCH 0327/1332] ZVISION: Create utility function to parse fileName from a full/partial path --- engines/zvision/utility.cpp | 19 +++++++++++++++++++ engines/zvision/utility.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 41b589d0c0c7..5f69fd743383 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -22,6 +22,8 @@ #include "common/scummsys.h" +#include "common/tokenizer.h" + #include "zvision/utility.h" namespace ZVision { @@ -177,4 +179,21 @@ void dumpEveryResultAction(const Common::String &destFile) { output.close(); } +/** + * Gets the name of the file (including extension). Forward or back slashes + * are interpreted as directory changes + * + * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt + * @return The name of the file without any preceding directories. Ex: file.txt + */ +Common::String getFileName(const Common::String &fullPath) { + Common::StringTokenizer tokenizer(fullPath, "/\\"); + Common::String token; + while (!tokenizer.empty()) { + token = tokenizer.nextToken(); + } + + return token; +} + } // End of namespace ZVision diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index e5713fc7f47e..dba765b65c09 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -73,6 +73,8 @@ void removeDuplicateEntries(Common::Array *container) { } } +Common::String getFileName(const Common::String &fullPath); + } // End of namespace ZVision #endif From 76f4d2b3d898710f5fefba47aafafc889037968b Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 16 Jul 2013 16:56:15 -0500 Subject: [PATCH 0328/1332] ZVISION: Create logic to decode sound rate and isStereo from fileName --- engines/zvision/zork_avi_decoder.cpp | 10 ++--- engines/zvision/zork_raw.cpp | 62 ++++++++++++++++++++++++---- engines/zvision/zork_raw.h | 49 ++++++++++++++++------ 3 files changed, 96 insertions(+), 25 deletions(-) diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp index 4ceff48891dc..d9b9511175ac 100644 --- a/engines/zvision/zork_avi_decoder.cpp +++ b/engines/zvision/zork_avi_decoder.cpp @@ -26,13 +26,13 @@ #include "common/stream.h" #include "audio/audiostream.h" -#include "engines/zvision/zork_avi_decoder.h" -#include "engines/zvision/zork_raw.h" +#include "zvision/zork_avi_decoder.h" +#include "zvision/zork_raw.h" namespace ZVision { -Video::AVIDecoder::AVIAudioTrack *ZVision::ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { - ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack *audioTrack = new ZVision::ZorkAVIDecoder::ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); +Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { + ZorkAVIDecoder::ZorkAVIAudioTrack *audioTrack = new ZorkAVIDecoder::ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); return (Video::AVIDecoder::AVIAudioTrack *)audioTrack; } @@ -40,7 +40,7 @@ void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *s if (_audStream) { if (_wvInfo.tag == kWaveFormatZorkPCM) { assert(_wvInfo.size == 8); - _audStream->queueAudioStream(makeRawZorkStream(stream, _wvInfo.samplesPerSec, DisposeAfterUse::YES), DisposeAfterUse::YES); + _audStream->queueAudioStream(makeRawZorkStream(stream, _wvInfo.samplesPerSec, _audStream->isStereo(), DisposeAfterUse::YES), DisposeAfterUse::YES); } } else { delete stream; diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index c4b76d91feff..9f71b7602c28 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -22,18 +22,24 @@ #include "common/scummsys.h" +#include "common/file.h" +#include "common/str.h" #include "common/stream.h" #include "common/memstream.h" +#include "common/bufferedstream.h" #include "common/util.h" #include "audio/audiostream.h" -#include "engines/zvision/zork_raw.h" +#include "zvision/zork_raw.h" +#include "zvision/zvision.h" +#include "zvision/detection.h" +#include "zvision/utility.h" namespace ZVision { -const int16 RawZorkStream::stepAdjustmentTable[8] = {-1, -1, -1, 1, 4, 7, 10, 12}; +const int16 RawZorkStream::_stepAdjustmentTable[8] = {-1, -1, -1, 1, 4, 7, 10, 12}; -const int32 RawZorkStream::amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, +const int32 RawZorkStream::_amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x0010, 0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, 0x0022, 0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042, 0x0049, 0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F, @@ -45,9 +51,10 @@ const int32 RawZorkStream::amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; -RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) +RawZorkStream::RawZorkStream(uint32 rate, bool stereo, bool packed, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) : _rate(rate), _stereo(stereo), + _packed(packed), _stream(stream, disposeStream), _endOfData(false) { _lastSample[0] = {0, 0}; @@ -58,6 +65,18 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag dis } int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { + if (_packed) + return decodeADPCM(buffer, numSamples); + else { + uint32 bytesRead = _stream->read(buffer, numSamples); + if (_stream->eos()) + _endOfData = true; + + return bytesRead; + } +} + +int RawZorkStream::decodeADPCM(int16 *buffer, const int numSamples) { uint16 bytesRead = 0; // 0: Left, 1: Right @@ -72,7 +91,7 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { bytesRead++; int16 index = _lastSample[channel].index; - uint32 lookUpSample = amplitudeLookupTable[index]; + uint32 lookUpSample = _amplitudeLookupTable[index]; int32 sample = 0; @@ -98,7 +117,7 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { buffer[bytesRead - 1] = (int16)sample; - index += stepAdjustmentTable[(encodedSample >> 4) & 7]; + index += _stepAdjustmentTable[(encodedSample >> 4) & 7]; index = CLIP(index, 0, 88); _lastSample[channel].sample = sample; @@ -124,16 +143,43 @@ bool RawZorkStream::rewind() { Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, bool stereo, + bool packed, DisposeAfterUse::Flag disposeAfterUse) { assert(stream->size() % 2 == 0); - return new RawZorkStream(rate, stereo, disposeAfterUse, stream); + return new RawZorkStream(rate, stereo, packed, disposeAfterUse, stream); } Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, bool stereo, + bool packed, DisposeAfterUse::Flag disposeAfterUse) { - return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, DisposeAfterUse::YES); + return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, packed, DisposeAfterUse::YES); +} + +Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) { + Common::File *file = new Common::File(); + assert(file->open(filePath)); + + Common::String fileName = getFileName(filePath); + fileName.toLowercase(); + + SoundParams soundParams; + + if (engine->getGameId() == ZorkNemesis) { + for (int i = 0; i < 6; i++) { + if (zNemSoundParamLookupTable[i].identifier == (fileName[6])) + soundParams = zNemSoundParamLookupTable[i]; + } + } + else if (engine->getGameId() == ZorkGrandInquisitor) { + for (int i = 0; i < 6; i++) { + if (zgiSoundParamLookupTable[i].identifier == (fileName[7])) + soundParams = zgiSoundParamLookupTable[i]; + } + } + + return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, soundParams.packed, DisposeAfterUse::YES); } } // End of namespace ZVision diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 7386c87f86e6..5efa27a1e319 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -31,22 +31,51 @@ class SeekableReadStream; } namespace ZVision { + +class ZVision; + +struct SoundParams { + char identifier; + uint16 rate; + bool stereo; + bool packed; +}; + +const SoundParams zNemSoundParamLookupTable[6] = {{'6', 0x2B11, false, false}, + {'a', 0x5622, false, true}, + {'b', 0x5622, true, true}, + {'n', 0x2B11, false, true}, + {'s', 0x5622, false, true}, + {'t', 0x5622, true, true} +}; + +const SoundParams zgiSoundParamLookupTable[5] = {{'a',0x5622, false, false}, + {'k',0x2B11, true, true}, + {'p',0x5622, false, true}, + {'q',0x5622, true, true}, + {'u',0xAC44, true, true} +}; + /** * This is a stream, which allows for playing raw ADPCM data from a stream. */ class RawZorkStream : public Audio::RewindableAudioStream { public: - RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); + RawZorkStream(uint32 rate, bool stereo, bool packed, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); + RawZorkStream(const Common::String &filePath, ZVision *engine); ~RawZorkStream() { } +public: + private: const int _rate; // Sample rate of stream Audio::Timestamp _playtime; // Calculated total play time Common::DisposablePtr _stream; // Stream to read data from bool _endOfData; // Whether the stream end has been reached bool _stereo; + bool _packed; /** * Holds the frequency and index from the last sample @@ -57,9 +86,8 @@ class RawZorkStream : public Audio::RewindableAudioStream { int16 index; } _lastSample[2]; - static const int16 stepAdjustmentTable[8]; - - static const int32 amplitudeLookupTable[89]; + static const int16 _stepAdjustmentTable[8]; + static const int32 _amplitudeLookupTable[89]; public: int readBuffer(int16 *buffer, const int numSamples); @@ -73,14 +101,7 @@ class RawZorkStream : public Audio::RewindableAudioStream { bool rewind(); private: - /** - * Fill the temporary sample buffer used in readBuffer. - * - * @param maxSamples Maximum samples to read. - * @return actual count of samples read. - */ - int fillBuffer(int maxSamples); - uint32 processBlock(); + int decodeADPCM(int16 *buffer, const int numSamples); }; /** @@ -95,6 +116,7 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, bool stereo, + bool packed, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** @@ -108,8 +130,11 @@ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, bool stereo, + bool packed, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); +Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); + } // End of namespace ZVision #endif From 92f3de72de273cc4ae3767e5991ff1f7cd85c8ed Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 16 Jul 2013 16:57:12 -0500 Subject: [PATCH 0329/1332] ZVISION: Convert console sound handling to use new fileName decoding --- engines/zvision/console.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index e0ca37c1d2ca..a18da8605aae 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -42,7 +42,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { bool Console::cmdLoadImage(int argc, const char **argv) { if (argc != 4) { - DebugPrintf("Use loadimage to load an image to the screen"); + DebugPrintf("Use loadimage to load an image to the screen\n"); return true; } _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); @@ -52,7 +52,7 @@ bool Console::cmdLoadImage(int argc, const char **argv) { bool Console::cmdLoadVideo(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Use loadvideo to load a video to the screen"); + DebugPrintf("Use loadvideo to load a video to the screen\n"); return true; } @@ -65,20 +65,19 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { } bool Console::cmdLoadSound(int argc, const char **argv) { - if (argc != 4) { - DebugPrintf("Use loadsound to load a video to the screen"); + if (argc != 2) { + DebugPrintf("Use loadsound to load a sound\n"); return true; } - Common::File *file = new Common::File(); - if (!file->open(argv[1])) { - DebugPrintf("File does not exist"); + if (!Common::File::exists(argv[1])) { + DebugPrintf("File does not exist\n"); return true; } - Audio::AudioStream *soundStream = makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), atoi(argv[2]), atoi(argv[3]), DisposeAfterUse::YES); + Audio::AudioStream *soundStream = makeRawZorkStream(argv[1], _engine); Audio::SoundHandle handle; - _engine->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); return true; } From 071d9f2241d608753372a027b489ae3027d73480 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 16 Jul 2013 16:59:11 -0500 Subject: [PATCH 0330/1332] ZVISION: Add logic to allow the user to break out of videos --- engines/zvision/events.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 984d59e2ba43..a3d6b6b6707a 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -25,6 +25,7 @@ #include "zvision/zvision.h" #include "zvision/console.h" #include "common/events.h" +#include "engines/util.h" namespace ZVision { @@ -55,12 +56,19 @@ void ZVision::processEvents() { _console->onFrame(); } break; - case Common::KEYCODE_q: if (_event.kbd.hasFlags(Common::KBD_CTRL)) quitGame(); break; - + case Common::KEYCODE_ESCAPE: + if (_currentVideo != 0) { + initGraphics(_width, _height, true, &_pixelFormat); + delete _currentVideo; + _currentVideo = 0; + delete _scaledVideoFrameBuffer; + _scaledVideoFrameBuffer = 0; + } + break; default: break; } From c7ce580bbde99c1634a1160a18350ccd51badb39 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 12:11:04 -0500 Subject: [PATCH 0331/1332] ZVISION: Removed 'packed' audio handling from RawZorkStream. Moved it to the factory method for creating Audio Streams --- engines/zvision/zork_raw.cpp | 57 ++++++++++++++++-------------------- engines/zvision/zork_raw.h | 11 ++----- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 9f71b7602c28..78913a7262b4 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -29,6 +29,7 @@ #include "common/bufferedstream.h" #include "common/util.h" #include "audio/audiostream.h" +#include "audio/decoders/raw.h" #include "zvision/zork_raw.h" #include "zvision/zvision.h" @@ -40,21 +41,20 @@ namespace ZVision { const int16 RawZorkStream::_stepAdjustmentTable[8] = {-1, -1, -1, 1, 4, 7, 10, 12}; const int32 RawZorkStream::_amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, - 0x0010, 0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, - 0x0022, 0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042, - 0x0049, 0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F, - 0x009D, 0x00AD, 0x00BE, 0x00D1, 0x00E6, 0x00FD, 0x0117, 0x0133, - 0x0151, 0x0173, 0x0198, 0x01C1, 0x01EE, 0x0220, 0x0256, 0x0292, - 0x02D4, 0x031C, 0x036C, 0x03C3, 0x0424, 0x048E, 0x0502, 0x0583, - 0x0610, 0x06AB, 0x0756, 0x0812, 0x08E0, 0x09C3, 0x0ABD, 0x0BD0, - 0x0CFF, 0x0E4C, 0x0FBA, 0x114C, 0x1307, 0x14EE, 0x1706, 0x1954, - 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, - 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; - -RawZorkStream::RawZorkStream(uint32 rate, bool stereo, bool packed, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) + 0x0010, 0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, + 0x0022, 0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042, + 0x0049, 0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F, + 0x009D, 0x00AD, 0x00BE, 0x00D1, 0x00E6, 0x00FD, 0x0117, 0x0133, + 0x0151, 0x0173, 0x0198, 0x01C1, 0x01EE, 0x0220, 0x0256, 0x0292, + 0x02D4, 0x031C, 0x036C, 0x03C3, 0x0424, 0x048E, 0x0502, 0x0583, + 0x0610, 0x06AB, 0x0756, 0x0812, 0x08E0, 0x09C3, 0x0ABD, 0x0BD0, + 0x0CFF, 0x0E4C, 0x0FBA, 0x114C, 0x1307, 0x14EE, 0x1706, 0x1954, + 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, + 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; + +RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) : _rate(rate), _stereo(stereo), - _packed(packed), _stream(stream, disposeStream), _endOfData(false) { _lastSample[0] = {0, 0}; @@ -65,18 +65,6 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, bool packed, DisposeAfter } int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { - if (_packed) - return decodeADPCM(buffer, numSamples); - else { - uint32 bytesRead = _stream->read(buffer, numSamples); - if (_stream->eos()) - _endOfData = true; - - return bytesRead; - } -} - -int RawZorkStream::decodeADPCM(int16 *buffer, const int numSamples) { uint16 bytesRead = 0; // 0: Left, 1: Right @@ -143,21 +131,19 @@ bool RawZorkStream::rewind() { Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, bool stereo, - bool packed, DisposeAfterUse::Flag disposeAfterUse) { assert(stream->size() % 2 == 0); - return new RawZorkStream(rate, stereo, packed, disposeAfterUse, stream); + return new RawZorkStream(rate, stereo, disposeAfterUse, stream); } Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, bool stereo, - bool packed, DisposeAfterUse::Flag disposeAfterUse) { - return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, packed, DisposeAfterUse::YES); + return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, DisposeAfterUse::YES); } -Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) { +Audio::AudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) { Common::File *file = new Common::File(); assert(file->open(filePath)); @@ -178,8 +164,15 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, soundParams = zgiSoundParamLookupTable[i]; } } - - return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, soundParams.packed, DisposeAfterUse::YES); + + if (soundParams.packed) { + byte flags = 0; + if (soundParams.stereo) + flags |= Audio::FLAG_STEREO; + return Audio::makeRawStream(file, soundParams.rate, flags, DisposeAfterUse::YES); + } + else + return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); } } // End of namespace ZVision diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 5efa27a1e319..8d4670e26ca6 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -61,8 +61,7 @@ const SoundParams zgiSoundParamLookupTable[5] = {{'a',0x5622, false, false}, */ class RawZorkStream : public Audio::RewindableAudioStream { public: - RawZorkStream(uint32 rate, bool stereo, bool packed, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); - RawZorkStream(const Common::String &filePath, ZVision *engine); + RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream); ~RawZorkStream() { } @@ -75,7 +74,6 @@ class RawZorkStream : public Audio::RewindableAudioStream { Common::DisposablePtr _stream; // Stream to read data from bool _endOfData; // Whether the stream end has been reached bool _stereo; - bool _packed; /** * Holds the frequency and index from the last sample @@ -99,9 +97,6 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::Timestamp getLength() const { return _playtime; } bool rewind(); - -private: - int decodeADPCM(int16 *buffer, const int numSamples); }; /** @@ -116,7 +111,6 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, bool stereo, - bool packed, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** @@ -130,10 +124,9 @@ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, bool stereo, - bool packed, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); -Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); +Audio::AudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); } // End of namespace ZVision From d771b615e050ecd13e9da73111230ec16158beb2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 12:11:36 -0500 Subject: [PATCH 0332/1332] ZVISION: Use individual initialization instead of inline. --- engines/zvision/zork_raw.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 78913a7262b4..140e6a532b19 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -57,8 +57,10 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag dis _stereo(stereo), _stream(stream, disposeStream), _endOfData(false) { - _lastSample[0] = {0, 0}; - _lastSample[1] = {0, 0}; + _lastSample[0].index = 0; + _lastSample[0].sample = 0; + _lastSample[1].index = 0; + _lastSample[1].sample = 0; // Calculate the total playtime of the stream _playtime = Audio::Timestamp(0, _stream->size() / 2, rate); @@ -122,8 +124,10 @@ bool RawZorkStream::rewind() { _stream->seek(0, 0); _stream->clearErr(); _endOfData = false; - _lastSample[0] = {0, 0}; - _lastSample[1] = {0, 0}; + _lastSample[0].index = 0; + _lastSample[0].sample = 0; + _lastSample[1].index = 0; + _lastSample[1].sample = 0; return true; } From 03c871ff3025457067bb504af0799c901498253e Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 17:16:19 -0500 Subject: [PATCH 0333/1332] ZVISION: Convert _stereo to a byte since it is used for a bitwise and --- engines/zvision/zork_raw.cpp | 5 ++++- engines/zvision/zork_raw.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 140e6a532b19..68bb25dd48ae 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -54,9 +54,12 @@ const int32 RawZorkStream::_amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) : _rate(rate), - _stereo(stereo), + _stereo(0), _stream(stream, disposeStream), _endOfData(false) { + if (stereo) + _stereo = 1; + _lastSample[0].index = 0; _lastSample[0].sample = 0; _lastSample[1].index = 0; diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 8d4670e26ca6..6d25d197ee8e 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -73,7 +73,7 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::Timestamp _playtime; // Calculated total play time Common::DisposablePtr _stream; // Stream to read data from bool _endOfData; // Whether the stream end has been reached - bool _stereo; + byte _stereo; /** * Holds the frequency and index from the last sample From 134f8fda173731d744bd814d68850ce14fa4fd94 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 17:16:52 -0500 Subject: [PATCH 0334/1332] ZVISION: Fix incorrect assumptions about a file being stereo --- engines/zvision/zork_raw.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 68bb25dd48ae..cb031d62141c 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -66,7 +66,10 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag dis _lastSample[1].sample = 0; // Calculate the total playtime of the stream - _playtime = Audio::Timestamp(0, _stream->size() / 2, rate); + if (stereo) + _playtime = Audio::Timestamp(0, _stream->size() / 2, rate); + else + _playtime = Audio::Timestamp(0, _stream->size(), rate); } int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { @@ -139,7 +142,9 @@ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stre int rate, bool stereo, DisposeAfterUse::Flag disposeAfterUse) { - assert(stream->size() % 2 == 0); + if (stereo) + assert(stream->size() % 2 == 0); + return new RawZorkStream(rate, stereo, disposeAfterUse, stream); } From e897a1bb2ae444cf812f2c11060585ccd2b48e4c Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 17:19:59 -0500 Subject: [PATCH 0335/1332] ZVISION: Fix logic concerning whether a stream is packed or not It was accidentally returning a raw stream for a ZorkStream and a ZorkStream for a raw --- engines/zvision/zork_raw.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index cb031d62141c..2ffe8eb3a68e 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -178,13 +178,14 @@ Audio::AudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *e } if (soundParams.packed) { + return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); + } else { byte flags = 0; if (soundParams.stereo) flags |= Audio::FLAG_STEREO; + return Audio::makeRawStream(file, soundParams.rate, flags, DisposeAfterUse::YES); } - else - return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); } } // End of namespace ZVision From 7644e00bf3e55c1b6b2ea0d74db89d8539cb9f31 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 19:24:39 -0500 Subject: [PATCH 0336/1332] ZVISION: Convert ResultActions to take a String pointer in their constructors There's no point in copying the String since it's just being parsed --- engines/zvision/actions.cpp | 36 +++++++++++++-------------- engines/zvision/actions.h | 20 +++++++-------- engines/zvision/scr_file_handling.cpp | 6 ++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index a5b1e951aaef..791eda11e00a 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,8 +33,8 @@ namespace ZVision { // ActionAdd ////////////////////////////////////////////////////////////////////////////// -ActionAdd::ActionAdd(Common::String line) { - sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value); +ActionAdd::ActionAdd(Common::String *line) { + sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value); } bool ActionAdd::execute(ZVision *engine) { @@ -47,8 +47,8 @@ bool ActionAdd::execute(ZVision *engine) { // ActionAssign ////////////////////////////////////////////////////////////////////////////// -ActionAssign::ActionAssign(Common::String line) { - sscanf(line.c_str(), ":assign(%u, %hhu)", &_key, &_value); +ActionAssign::ActionAssign(Common::String *line) { + sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value); } bool ActionAssign::execute(ZVision *engine) { @@ -61,8 +61,8 @@ bool ActionAssign::execute(ZVision *engine) { // ActionAttenuate ////////////////////////////////////////////////////////////////////////////// -ActionAttenuate::ActionAttenuate(Common::String line) { - sscanf(line.c_str(), ":assign(%u, %hd)", &_key, &_attenuation); +ActionAttenuate::ActionAttenuate(Common::String *line) { + sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation); } bool ActionAttenuate::execute(ZVision *engine) { @@ -75,8 +75,8 @@ bool ActionAttenuate::execute(ZVision *engine) { // ActionChangeLocation ////////////////////////////////////////////////////////////////////////////// -ActionChangeLocation::ActionChangeLocation(Common::String line) { - sscanf(line.c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); +ActionChangeLocation::ActionChangeLocation(Common::String *line) { + sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); } bool ActionChangeLocation::execute(ZVision *engine) { @@ -89,8 +89,8 @@ bool ActionChangeLocation::execute(ZVision *engine) { // ActionCrossfade ////////////////////////////////////////////////////////////////////////////// -ActionCrossfade::ActionCrossfade(Common::String line) { - sscanf(line.c_str(), +ActionCrossfade::ActionCrossfade(Common::String *line) { + sscanf(line->c_str(), ":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)", &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } @@ -105,9 +105,9 @@ bool ActionCrossfade::execute(ZVision *engine) { // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPreloadAnimation::ActionPreloadAnimation(Common::String line) { +ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) { // The two %*hhu are always 0 and dont seem to have a use - sscanf(line.c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); + sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); } bool ActionPreloadAnimation::execute(ZVision *engine) { @@ -120,9 +120,9 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { // ActionPlayAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPlayAnimation::ActionPlayAnimation(Common::String line) { +ActionPlayAnimation::ActionPlayAnimation(Common::String *line) { // The two %*hhu are always 0 and dont seem to have a use - sscanf(line.c_str(), + sscanf(line->c_str(), ":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)", &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } @@ -137,8 +137,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) { // ActionRandom ////////////////////////////////////////////////////////////////////////////// -ActionRandom::ActionRandom(Common::String line) { - sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); +ActionRandom::ActionRandom(Common::String *line) { + sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max); } bool ActionRandom::execute(ZVision *engine) { @@ -152,8 +152,8 @@ bool ActionRandom::execute(ZVision *engine) { // ActionTimer ////////////////////////////////////////////////////////////////////////////// -ActionTimer::ActionTimer(Common::String line) { - sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time); +ActionTimer::ActionTimer(Common::String *line) { + sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time); } bool ActionTimer::execute(ZVision *engine) { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index aed8483ee798..9b2267df8297 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -74,7 +74,7 @@ class ResultAction { class ActionAdd : public ResultAction { public: - ActionAdd(Common::String line); + ActionAdd(Common::String *line); bool execute(ZVision *engine); private: @@ -84,7 +84,7 @@ class ActionAdd : public ResultAction { class ActionAssign : public ResultAction { public: - ActionAssign(Common::String line); + ActionAssign(Common::String *line); bool execute(ZVision *engine); private: @@ -94,7 +94,7 @@ class ActionAssign : public ResultAction { class ActionAttenuate : public ResultAction { public: - ActionAttenuate(Common::String line); + ActionAttenuate(Common::String *line); bool execute(ZVision *engine); private: @@ -104,7 +104,7 @@ class ActionAttenuate : public ResultAction { class ActionChangeLocation : public ResultAction { public: - ActionChangeLocation(Common::String line); + ActionChangeLocation(Common::String *line); bool execute(ZVision *engine); private: @@ -116,7 +116,7 @@ class ActionChangeLocation : public ResultAction { class ActionCrossfade : public ResultAction { public: - ActionCrossfade(Common::String line); + ActionCrossfade(Common::String *line); bool execute(ZVision *engine); private: @@ -131,7 +131,7 @@ class ActionCrossfade : public ResultAction { class ActionPlayAnimation : public ResultAction { public: - ActionPlayAnimation(Common::String line); + ActionPlayAnimation(Common::String *line); bool execute(ZVision *engine); private: @@ -150,7 +150,7 @@ class ActionPlayAnimation : public ResultAction { class ActionPreloadAnimation : public ResultAction { public: - ActionPreloadAnimation(Common::String line); + ActionPreloadAnimation(Common::String *line); bool execute(ZVision *engine); private: @@ -163,13 +163,13 @@ class ActionPreloadAnimation : public ResultAction { // TODO: See if this exists in ZGI. It doesn't in ZNem //class ActionUnloadAnimation : public ResultAction { //public: -// ActionUnloadAnimation(Common::String line); +// ActionUnloadAnimation(Common::String *line); // bool execute(ZVision *engine); //}; class ActionRandom : public ResultAction { public: - ActionRandom(Common::String line); + ActionRandom(Common::String *line); bool execute(ZVision *engine); private: @@ -179,7 +179,7 @@ class ActionRandom : public ResultAction { class ActionTimer : public ResultAction { public: - ActionTimer(Common::String line); + ActionTimer(Common::String *line); bool execute(ZVision *engine); private: diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 6a2e8cf70123..168a6d830a56 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -135,11 +135,11 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List while (!line.contains('}')) { // Parse for the action type if (line.matchString("*:add*", true)) { - actionList.push_back(new ActionAdd(line)); + actionList.push_back(new ActionAdd(&line)); } else if (line.matchString("*:animplay*", true)) { - actionList.push_back(new ActionPlayAnimation(line)); + actionList.push_back(new ActionPlayAnimation(&line)); } else if (line.matchString("*:animpreload*", true)) { - actionList.push_back(new ActionPreloadAnimation(line)); + actionList.push_back(new ActionPreloadAnimation(&line)); } else if (line.matchString("*:animunload*", true)) { From 32f88486058c0553ae2c0cd1808ef06fcd09b143 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 18 Jul 2013 14:38:57 -0500 Subject: [PATCH 0337/1332] ZVISION: Create utility function to convert .RAW to .WAV --- engines/zvision/utility.cpp | 44 +++++++++++++++++++++++++++++++------ engines/zvision/utility.h | 18 +++++++++++++++ 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 5f69fd743383..42fadc78c4c6 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -25,6 +25,8 @@ #include "common/tokenizer.h" #include "zvision/utility.h" +#include "zvision/zvision.h" +#include "zvision/zork_raw.h" namespace ZVision { @@ -179,13 +181,6 @@ void dumpEveryResultAction(const Common::String &destFile) { output.close(); } -/** - * Gets the name of the file (including extension). Forward or back slashes - * are interpreted as directory changes - * - * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt - * @return The name of the file without any preceding directories. Ex: file.txt - */ Common::String getFileName(const Common::String &fullPath) { Common::StringTokenizer tokenizer(fullPath, "/\\"); Common::String token; @@ -196,4 +191,39 @@ Common::String getFileName(const Common::String &fullPath) { return token; } +void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile) { + Common::File file; + if (!file.open(inputFile)) + return; + + Audio::AudioStream *audioStream = makeRawZorkStream(inputFile, engine); + + Common::DumpFile output; + output.open(outputFile); + + output.writeUint32BE(MKTAG('R', 'I', 'F', 'F')); + output.writeUint32LE(file.size() * 2 + 36); + output.writeUint32BE(MKTAG('W', 'A', 'V', 'E')); + output.writeUint32BE(MKTAG('f', 'm', 't', ' ')); + output.writeUint32LE(16); + output.writeUint16LE(1); + uint16 numChannels; + if (audioStream->isStereo()) { + numChannels = 2; + output.writeUint16LE(2); + } else { + numChannels = 1; + output.writeUint16LE(1); + } + output.writeUint32LE(audioStream->getRate()); + output.writeUint32LE(audioStream->getRate() * numChannels * 2); + output.writeUint16LE(numChannels * 2); + output.writeUint16LE(16); + output.writeUint32BE(MKTAG('d', 'a', 't', 'a')); + output.writeUint32LE(file.size() * 2); + int16 *buffer = new int16[file.size()]; + int readBytes = audioStream->readBuffer(buffer, file.size()); + output.write(buffer, file.size() * 2); +} + } // End of namespace ZVision diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index dba765b65c09..46f81efb332d 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -30,6 +30,8 @@ namespace ZVision { +class ZVision; + /** * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the * contents to destFile. destFile is created in the working directory @@ -73,8 +75,24 @@ void removeDuplicateEntries(Common::Array *container) { } } +/** + * Gets the name of the file (including extension). Forward or back slashes + * are interpreted as directory changes + * + * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt + * @return The name of the file without any preceding directories. Ex: file.txt + */ Common::String getFileName(const Common::String &fullPath); +/** + * Converts a ZVision .RAW file to a .WAV + * The .WAV will be created in the working directory and will overwrite any existing file + * + * @param inputFile The path to the input .RAW file + * @param outputFile The name of the output .WAV file + */ +void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile); + } // End of namespace ZVision #endif From 8f32592ab9556c57d459be116863d3bb7ac88c72 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 18 Jul 2013 14:40:02 -0500 Subject: [PATCH 0338/1332] ZVISION: Create console command to use the raw2wav function --- engines/zvision/console.cpp | 11 +++++++++++ engines/zvision/console.h | 1 + 2 files changed, 12 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index a18da8605aae..ed244c1f58a0 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -31,6 +31,7 @@ #include "zvision/zvision.h" #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" +#include "zvision/utility.h" namespace ZVision { @@ -38,6 +39,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); DCmd_Register("loadvideo", WRAP_METHOD(Console, cmdLoadVideo)); DCmd_Register("loadsound", WRAP_METHOD(Console, cmdLoadSound)); + DCmd_Register("raw2wav", WRAP_METHOD(Console, cmdRawToWav)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -82,4 +84,13 @@ bool Console::cmdLoadSound(int argc, const char **argv) { return true; } +bool Console::cmdRawToWav(int argc, const char **argv) { + if (argc != 3) { + DebugPrintf("Use raw2wav to dump a .RAW file to .WAV\n"); + return true; + } + + convertRawToWav(argv[1], _engine, argv[2]); +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 354051d2b01e..cf22c42e3530 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -40,6 +40,7 @@ namespace ZVision { bool cmdLoadImage(int argc, const char **argv); bool cmdLoadVideo(int argc, const char **argv); bool cmdLoadSound(int argc, const char **argv); + bool cmdRawToWav(int argc, const char **argv); }; } // End of namespace ZVision From 1c44fe7afba706400dd8d3c2132f47da4e07ac1e Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 18 Jul 2013 14:40:45 -0500 Subject: [PATCH 0339/1332] ZVISION: Fix the error causing distortions in the sound --- engines/zvision/zork_raw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 2ffe8eb3a68e..03a35e09abc1 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -73,7 +73,7 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag dis } int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { - uint16 bytesRead = 0; + uint32 bytesRead = 0; // 0: Left, 1: Right byte channel = 0; @@ -114,7 +114,7 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { buffer[bytesRead - 1] = (int16)sample; index += _stepAdjustmentTable[(encodedSample >> 4) & 7]; - index = CLIP(index, 0, 88); + index = CLIP(index, 0, 88); _lastSample[channel].sample = sample; _lastSample[channel].index = index; From 125a061a9650297d81a76cc8e77033ca099191b0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 18 Jul 2013 14:43:16 -0500 Subject: [PATCH 0340/1332] ZVISION: Convert to using MKTAG() instead of checking each char individually --- engines/zvision/image.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index 981308fa3160..6e6b802739e6 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -42,11 +42,11 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint // Read the magic number // Some files are true TGA, while others are TGZ - char fileType[4]; - file.read(fileType, 4); + uint32 fileType; + fileType = file.readUint32BE(); // Check for TGZ files - if (fileType[0] == 'T' && fileType[1] == 'G' && fileType[2] == 'Z' && fileType[3] == '\0') { + if (fileType == MKTAG('T', 'G', 'Z', '\0')) { // TGZ files have a header and then Bitmap data that is compressed with LZSS uint32 decompressedSize = file.readSint32LE(); uint32 width = file.readSint32LE(); From 47161ef30d8d7350a92fe28a031437abb338732c Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 15:37:46 -0500 Subject: [PATCH 0341/1332] ZVISION: LZSSReadStream - Decompress directly to the destination buffer instead of an intermediate buffer --- engines/zvision/image.cpp | 6 +-- engines/zvision/lzss_read_stream.cpp | 62 +++++++--------------------- engines/zvision/lzss_read_stream.h | 13 ++---- 3 files changed, 20 insertions(+), 61 deletions(-) diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index 6e6b802739e6..cacfec302c42 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -52,9 +52,9 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint uint32 width = file.readSint32LE(); uint32 height = file.readSint32LE(); - LzssReadStream stream(&file, false, decompressedSize); - byte *buffer = new byte[stream.currentSize()]; - stream.read(buffer, stream.currentSize()); + LzssReadStream stream(&file); + byte *buffer = new byte[decompressedSize]; + stream.read(buffer, decompressedSize); _system->copyRectToScreen(buffer, width * 2, x, y, width, height); } else { diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 2d7acdb8cef1..35c708a6c71d 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -26,7 +26,7 @@ namespace ZVision { -LzssReadStream::LzssReadStream(Common::SeekableReadStream *source, bool stream, uint32 decompressedSize) +LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) : _source(source), // It's convention to set the starting cursor position to blockSize - 16 _windowCursor(0x0FEE), @@ -34,24 +34,12 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source, bool stream, _eosFlag(false) { // Clear the window to null memset(_window, 0, _blockSize); - - // Reserve space in the destination buffer - // TODO: Make a better guess - if (decompressedSize == _npos) { - decompressedSize = source->size(); - } - _destination.reserve(decompressedSize); - - if (stream) - decompressBytes(_blockSize); - else - decompressAll(); } -void LzssReadStream::decompressBytes(uint32 numberOfBytes) { - uint32 bytesRead = 0; +uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) { + uint32 destinationCursor = 0; - while (!_source->eos() && bytesRead <= numberOfBytes) { + while (destinationCursor < numberOfBytes) { byte flagbyte = _source->readByte(); if (_source->eos()) break; @@ -61,12 +49,11 @@ void LzssReadStream::decompressBytes(uint32 numberOfBytes) { if ((flagbyte & mask) == mask) { byte data = _source->readByte(); - bytesRead++; if (_source->eos()) - break; + return destinationCursor; _window[_windowCursor] = data; - _destination.push_back(data); + destination[destinationCursor++] = data; // Increment and wrap the window cursor _windowCursor = (_windowCursor + 1) & 0xFFF; @@ -74,14 +61,12 @@ void LzssReadStream::decompressBytes(uint32 numberOfBytes) { else { byte low = _source->readByte(); - bytesRead++; if (_source->eos()) - break; + return destinationCursor; byte high = _source->readByte(); - bytesRead++; if (_source->eos()) - break; + return destinationCursor; uint16 length = (high & 0xF) + 2; uint16 offset = low | ((high & 0xF0)<<4); @@ -90,7 +75,7 @@ void LzssReadStream::decompressBytes(uint32 numberOfBytes) { { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; - _destination.push_back(temp); + destination[destinationCursor++] = temp; _windowCursor = (_windowCursor + 1) & 0xFFF; } }; @@ -98,10 +83,8 @@ void LzssReadStream::decompressBytes(uint32 numberOfBytes) { mask = mask << 1; } } -} -void LzssReadStream::decompressAll() { - decompressBytes(_source->size()); + return destinationCursor; } bool LzssReadStream::eos() const { @@ -109,30 +92,13 @@ bool LzssReadStream::eos() const { } uint32 LzssReadStream::read(void *dataPtr, uint32 dataSize) { - // Check if there are enough bytes available - // If not, keep decompressing until we have enough bytes or until we reach EOS - while (dataSize > _destination.size() - _readCursor) { - // Check if we can read any more data from source - if (_source->eos()) { - // Shorten the dataSize to what we have left and flag that we're at EOS - dataSize = _destination.size() - _readCursor; - _eosFlag = true; - break; - } - - decompressBytes(_blockSize); - } - - if (dataSize > 0) { - memcpy(dataPtr, _destination.begin() + _readCursor, dataSize); - _readCursor += dataSize; + uint32 bytesRead = decompressBytes(static_cast(dataPtr), dataSize); + if (bytesRead < dataSize) { + // Flag that we're at EOS + _eosFlag = true; } return dataSize; } -uint32 LzssReadStream::currentSize() const { - return _destination.size(); -} - } // End of namespace ZVision diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 142bf9e1a2cd..0dea25b32558 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -34,14 +34,11 @@ class LzssReadStream : public Common::ReadStream { public: /** * A class that decompresses LZSS data and implements ReadStream for easy access - * to the decompiled data. It can either decompress all the data in the beginning - * or decompress as needed by read(). + * to the decompiled data. * * @param source The source data - * @param stream Decompress the data as needed (true) or all at once (false) - * @param decompressedSize The size of the decompressed data. If npos, the class will choose a size and grow as needed */ - LzssReadStream(Common::SeekableReadStream *source, bool stream = true, uint32 decompressedSize = _npos); + LzssReadStream(Common::SeekableReadStream *source); public: static const uint32 _npos = 0xFFFFFFFFu; @@ -49,7 +46,6 @@ class LzssReadStream : public Common::ReadStream { private: Common::SeekableReadStream *_source; - Common::Array _destination; char _window[_blockSize]; uint16 _windowCursor; uint32 _readCursor; @@ -58,7 +54,6 @@ class LzssReadStream : public Common::ReadStream { public: bool eos() const; uint32 read(void *dataPtr, uint32 dataSize); - uint32 currentSize() const; private: /** @@ -66,9 +61,7 @@ class LzssReadStream : public Common::ReadStream { * * @param numberOfBytes How many bytes to decompress. This is a count of source bytes, not destination bytes */ - void decompressBytes(uint32 numberOfBytes); - /** Decompress all of the source stream. */ - void decompressAll(); + uint32 decompressBytes(byte* destination, uint32 numberOfBytes); }; } From b316df9e821a7cb27290e8ebed49eb78c2ee5884 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 17 Jul 2013 15:45:09 -0500 Subject: [PATCH 0342/1332] ZVISION: Add a return statement for when image load fails --- engines/zvision/image.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp index cacfec302c42..c4823813dcf5 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/image.cpp @@ -63,9 +63,10 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint // Decode Graphics::TGADecoder tga; - if (!tga.loadStream(file)) + if (!tga.loadStream(file)) { error("Error while reading TGA image"); - file.close(); + return; + } const Graphics::Surface *tgaSurface = tga.getSurface(); _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); From d546e11cf12d90eb246513ccc0be867172f0af96 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 10:23:29 -0500 Subject: [PATCH 0343/1332] ZVISION: Fix namespace indentation --- engines/zvision/console.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/engines/zvision/console.h b/engines/zvision/console.h index cf22c42e3530..3110d8ad376a 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -27,21 +27,20 @@ namespace ZVision { - class ZVision; +class ZVision; - class Console : public GUI::Debugger { - public: - Console(ZVision *engine); - virtual ~Console() {} +class Console : public GUI::Debugger { +public: + Console(ZVision *engine); + virtual ~Console() {} - private: - ZVision *_engine; +private: + ZVision *_engine; - bool cmdLoadImage(int argc, const char **argv); - bool cmdLoadVideo(int argc, const char **argv); - bool cmdLoadSound(int argc, const char **argv); - bool cmdRawToWav(int argc, const char **argv); - }; + bool cmdLoadImage(int argc, const char **argv); + bool cmdLoadVideo(int argc, const char **argv); + bool cmdLoadSound(int argc, const char **argv); +}; } // End of namespace ZVision #endif From 471364077953509ae7528d3097ca746fe5588f7c Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 10:24:02 -0500 Subject: [PATCH 0344/1332] ZVISION: Remove extraneous member variable --- engines/zvision/lzss_read_stream.cpp | 1 - engines/zvision/lzss_read_stream.h | 1 - 2 files changed, 2 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 35c708a6c71d..d169620a25d5 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -30,7 +30,6 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) : _source(source), // It's convention to set the starting cursor position to blockSize - 16 _windowCursor(0x0FEE), - _readCursor(0), _eosFlag(false) { // Clear the window to null memset(_window, 0, _blockSize); diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 0dea25b32558..b2d6085a29e4 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -48,7 +48,6 @@ class LzssReadStream : public Common::ReadStream { Common::SeekableReadStream *_source; char _window[_blockSize]; uint16 _windowCursor; - uint32 _readCursor; bool _eosFlag; public: From 94000e07811831f1ffdb2575b0cc3513c34a1d36 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 10:25:02 -0500 Subject: [PATCH 0345/1332] ZVISION: Replace includes with forward declarations --- engines/zvision/lzss_read_stream.h | 5 ++++- engines/zvision/script_manager.h | 7 +++++-- engines/zvision/single_value_container.cpp | 2 ++ engines/zvision/single_value_container.h | 4 +++- engines/zvision/utility.cpp | 1 + engines/zvision/utility.h | 6 ++++-- engines/zvision/zfs_archive.cpp | 4 +++- engines/zvision/zfs_archive.h | 10 +++++++--- 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index b2d6085a29e4..081422072891 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -25,9 +25,12 @@ #include "common/types.h" #include "common/stream.h" -#include "common/memstream.h" #include "common/array.h" +namespace Common { +class SeekableReadStream; +} + namespace ZVision { class LzssReadStream : public Common::ReadStream { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 7924eee4c08a..2d9bcc3fd553 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -23,14 +23,17 @@ #ifndef ZVISION_SCRIPT_MANAGER_H #define ZVISION_SCRIPT_MANAGER_H -#include "common/str.h" -#include "common/stream.h" #include "common/hashmap.h" #include "common/stack.h" #include "zvision/puzzle.h" #include "zvision/control.h" +namespace Common { +class String; +class SeekableReadStream; +} + namespace ZVision { class ZVision; diff --git a/engines/zvision/single_value_container.cpp b/engines/zvision/single_value_container.cpp index 7e27098377e2..0fd758a85eb4 100644 --- a/engines/zvision/single_value_container.cpp +++ b/engines/zvision/single_value_container.cpp @@ -21,7 +21,9 @@ */ #include "common/scummsys.h" + #include "common/textconsole.h" +#include "common/str.h" #include "zvision/single_value_container.h" diff --git a/engines/zvision/single_value_container.h b/engines/zvision/single_value_container.h index 49c7267f7706..593f11c73788 100644 --- a/engines/zvision/single_value_container.h +++ b/engines/zvision/single_value_container.h @@ -23,7 +23,9 @@ #ifndef ZVISION_OBJECT_H #define ZVISION_OBJECT_H -#include "common/str.h" +namespace Common { +class String; +} namespace ZVision { diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 42fadc78c4c6..bf8e5c91d616 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "common/tokenizer.h" +#include "common/file.h" #include "zvision/utility.h" #include "zvision/zvision.h" diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 46f81efb332d..e68d0de4491f 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -24,10 +24,12 @@ #ifndef ZVISION_UTILITY_H #define ZVISION_UTILITY_H -#include "common/str.h" -#include "common/file.h" #include "common/array.h" +namespace Common { +class String; +} + namespace ZVision { class ZVision; diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index fbfe3d3dc427..f815d9ccd36d 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -22,10 +22,12 @@ #include "common/scummsys.h" -#include "zvision/zfs_archive.h" #include "common/hashmap.h" #include "common/memstream.h" #include "common/debug.h" +#include "common/file.h" + +#include "zvision/zfs_archive.h" namespace ZVision { diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/zfs_archive.h index cb371f2c8785..e683ac1b5356 100644 --- a/engines/zvision/zfs_archive.h +++ b/engines/zvision/zfs_archive.h @@ -24,8 +24,12 @@ #define ZVISION_ZFS_ARCHIVE_H #include "common/archive.h" -#include "common/file.h" -#include "common/fs.h" +#include "common/hashmap.h" + + +namespace Common { +class String; +} namespace ZVision { @@ -48,7 +52,7 @@ struct ZfsEntryHeader { uint32 unknown; }; -typedef Common::HashMap ZfsEntryHeaderMap; +typedef Common::HashMap ZfsEntryHeaderMap; class ZfsArchive : public Common::Archive { public: From 6d7541a43040ee6791bf0099ddff9645753ac24b Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 11:07:05 -0500 Subject: [PATCH 0346/1332] ZVISION: Create RenderManager class and move code from image.cpp --- .../zvision/{image.cpp => render_manager.cpp} | 11 +-- engines/zvision/render_manager.h | 70 +++++++++++++++++++ 2 files changed, 76 insertions(+), 5 deletions(-) rename engines/zvision/{image.cpp => render_manager.cpp} (90%) create mode 100644 engines/zvision/render_manager.h diff --git a/engines/zvision/image.cpp b/engines/zvision/render_manager.cpp similarity index 90% rename from engines/zvision/image.cpp rename to engines/zvision/render_manager.cpp index c4823813dcf5..671e7c013681 100644 --- a/engines/zvision/image.cpp +++ b/engines/zvision/render_manager.cpp @@ -27,12 +27,14 @@ #include "graphics/decoders/tga.h" -#include "zvision/zvision.h" +#include "zvision/render_manager.h" #include "zvision/lzss_read_stream.h" namespace ZVision { -void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { +RenderManager::RenderManager(OSystem *system) : _system(system) {} + +void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { Common::File file; if (!file.open(fileName)) { @@ -63,10 +65,9 @@ void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint // Decode Graphics::TGADecoder tga; - if (!tga.loadStream(file)) { + if (!tga.loadStream(file)) error("Error while reading TGA image"); - return; - } + file.close(); const Graphics::Surface *tgaSurface = tga.getSurface(); _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h new file mode 100644 index 000000000000..137ec51d5a59 --- /dev/null +++ b/engines/zvision/render_manager.h @@ -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. + * + */ + +#ifndef ZVISION_RENDER_MANAGER_H +#define ZVISION_RENDER_MANAGER_H + +#include "common/types.h" + +class OSystem; + +namespace Common { +class String; +} + +namespace ZVision { + +class RenderManager { +public: + RenderManager(OSystem *system); + +public: + enum RenderState { + PANORAMA, + TILT, + FLAT + }; + +private: + OSystem *_system; + RenderState _renderState; + + struct { + uint16 fieldOfView; + uint16 linearScale; + } _panoramaOptions; + + // TODO: See if tilt and panorama need to have separate options + struct { + uint16 fieldOfView; + uint16 linearScale; + } _tiltOptions; + + bool _needsScreenUpdate; + +public: + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); +}; + +} // End of namespace ZVision + +#endif From 4bd95987d2119027fa175e08f22d0171f53358c0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 11:07:58 -0500 Subject: [PATCH 0347/1332] ZVISION: Convert old code to use RenderManager --- engines/zvision/console.cpp | 3 ++- engines/zvision/console.h | 1 + engines/zvision/zvision.cpp | 6 ++++++ engines/zvision/zvision.h | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index ed244c1f58a0..2b45ed24b9b4 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -29,6 +29,7 @@ #include "zvision/console.h" #include "zvision/zvision.h" +#include "zvision/render_manager.h" #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" #include "zvision/utility.h" @@ -47,7 +48,7 @@ bool Console::cmdLoadImage(int argc, const char **argv) { DebugPrintf("Use loadimage to load an image to the screen\n"); return true; } - _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); + _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); return true; } diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 3110d8ad376a..05b8f1247f1a 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -40,6 +40,7 @@ class Console : public GUI::Debugger { bool cmdLoadImage(int argc, const char **argv); bool cmdLoadVideo(int argc, const char **argv); bool cmdLoadSound(int argc, const char **argv); + bool cmdRawToWav(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 4ce775db868b..0e2e02788fa2 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -35,6 +35,7 @@ #include "zvision/zvision.h" #include "zvision/console.h" #include "zvision/script_manager.h" +#include "zvision/render_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" @@ -73,6 +74,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); + _renderManager = new RenderManager(_system); debug("ZVision::ZVision"); } @@ -151,6 +153,10 @@ ScriptManager *ZVision::getScriptManager() const { return _scriptManager; } +RenderManager *ZVision::getRenderManager() const { + return _renderManager; +} + Common::RandomSource *ZVision::getRandomSource() const { return _rnd; } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 17a7c026f1f4..7740dba6dc79 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -40,6 +40,7 @@ namespace ZVision { struct ZVisionGameDescription; class Console; class ScriptManager; +class RenderManager; // our engine debug channels enum { @@ -65,6 +66,8 @@ class ZVision : public Engine { Common::RandomSource *_rnd; // Managers ScriptManager *_scriptManager; + RenderManager *_renderManager; + // To prevent allocation every time we process events Common::Event _event; @@ -77,10 +80,10 @@ class ZVision : public Engine { Common::Language getLanguage() const; virtual Common::Error run(); ScriptManager *getScriptManager() const; + RenderManager *getRenderManager() const; Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; - void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); void startVideo(Video::VideoDecoder *videoDecoder); void continueVideo(); From 2bfefd969128b0a33afc8beccf52a4e9f6e4840f Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 11:08:37 -0500 Subject: [PATCH 0348/1332] ZVISION: Remove extraneous file --- engines/zvision/graphics.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 engines/zvision/graphics.cpp diff --git a/engines/zvision/graphics.cpp b/engines/zvision/graphics.cpp deleted file mode 100644 index 610960dd723c..000000000000 --- a/engines/zvision/graphics.cpp +++ /dev/null @@ -1,29 +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/scummsys.h" - -#include "zvision/zvision.h" - -namespace ZVision { - -} // End of namespace ZVision From b3eb48996af2236baf89dd5afd6cfeef1b5e86bd Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 12:17:14 -0500 Subject: [PATCH 0349/1332] ZVISION: Fix memory leaks --- engines/zvision/events.cpp | 2 +- engines/zvision/render_manager.cpp | 2 ++ engines/zvision/utility.cpp | 2 ++ engines/zvision/video.cpp | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index a3d6b6b6707a..afa2d952071d 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -65,7 +65,7 @@ void ZVision::processEvents() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; - delete _scaledVideoFrameBuffer; + delete[] _scaledVideoFrameBuffer; _scaledVideoFrameBuffer = 0; } break; diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 671e7c013681..6d3f7c6fc182 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -59,6 +59,8 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x stream.read(buffer, decompressedSize); _system->copyRectToScreen(buffer, width * 2, x, y, width, height); + + delete[] buffer; } else { // Reset the cursor file.seek(0); diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index bf8e5c91d616..fa29fe660f05 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -225,6 +225,8 @@ void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Com int16 *buffer = new int16[file.size()]; int readBytes = audioStream->readBuffer(buffer, file.size()); output.write(buffer, file.size() * 2); + + delete[] buffer; } } // End of namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 0cca486af656..042809000320 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -118,7 +118,7 @@ void ZVision::continueVideo() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; - delete _scaledVideoFrameBuffer; + delete[] _scaledVideoFrameBuffer; _scaledVideoFrameBuffer = 0; } From 9e6b2dfc12706f4b367fedf951759c8be0ab5e90 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 20 Jul 2013 12:14:32 -0500 Subject: [PATCH 0350/1332] ZVISION: Create member function for creating a panorama look up table --- engines/zvision/render_manager.cpp | 44 +++++++++++++++++++++++++++++- engines/zvision/render_manager.h | 10 ++++++- engines/zvision/zvision.cpp | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 6d3f7c6fc182..2a8ed1274eb0 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -24,6 +24,7 @@ #include "common/file.h" #include "common/system.h" +#include "common/rect.h" #include "graphics/decoders/tga.h" @@ -32,7 +33,12 @@ namespace ZVision { -RenderManager::RenderManager(OSystem *system) : _system(system) {} +RenderManager::RenderManager(OSystem *system, const int width, const int height) + : _system(system), + _width(width), + _height(height), + _renderTable(width, height) { +} void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { Common::File file; @@ -80,4 +86,40 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x _needsScreenUpdate = true; } +void RenderManager::generatePanoramaLookupTable() { + float fieldOfView = _panoramaOptions.fieldOfView; + float scale = _panoramaOptions.linearScale; + _renderTable.clear(); + + double halfWidth = (double)_width / 2.0; + double halfHeight = (double)_height / 2.0; + + double fovRadians = (fieldOfView * 3.14159265 / 180.0); + double halfHeightOverTan = halfHeight / tan(fovRadians); + double tanOverHalfHeight = tan(fovRadians) / halfHeight; + + for (int32 x = 0; x < _width; x++) { + // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) + double xPos = (double)x - halfWidth + 0.01; + + double tempX = atan(xPos*tanOverHalfHeight); + double scaledX = scale * halfHeightOverTan * tempX; + double nn = cos(tempX); + double newHalfWidth = halfHeight * nn * halfHeightOverTan * tanOverHalfHeight*2.0; + + int32 newX = floor(scaledX);// + half_w); + + double yScale = newHalfWidth / (double)_height; + double et2 = ((double)_height - newHalfWidth) / 2.0; + + for (int32 y = 0; y < _height; y++) { + double et1 = (double)y*yScale; + + _renderTable(x, y).x = newX; //pixel index + + int32 newY = floor(et2 + et1); + _renderTable(x, y).y = newY; //pixel index + } + } +} } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 137ec51d5a59..e481c26666ce 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -25,17 +25,20 @@ #include "common/types.h" +#include "zvision/dense_2d_array.h" + class OSystem; namespace Common { class String; +class Point; } namespace ZVision { class RenderManager { public: - RenderManager(OSystem *system); + RenderManager(OSystem *system, const int width, const int height); public: enum RenderState { @@ -46,6 +49,8 @@ class RenderManager { private: OSystem *_system; + const int _width; + const int _height; RenderState _renderState; struct { @@ -59,10 +64,13 @@ class RenderManager { uint16 linearScale; } _tiltOptions; + Dense2DArray _renderTable; + bool _needsScreenUpdate; public: void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); + void generatePanoramaLookupTable(); }; } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0e2e02788fa2..57c9dea211f5 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -74,7 +74,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); - _renderManager = new RenderManager(_system); + _renderManager = new RenderManager(_system, _width, _height); debug("ZVision::ZVision"); } From cd51b646f39fb826f5d618c6d61c996844f628dd Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:13:57 -0500 Subject: [PATCH 0351/1332] ZVISION: Create a class for handling all render table logic Aka, creating the lookup tables, storing the current render state, and eventually doing the image mutations. --- engines/zvision/render_table.cpp | 95 ++++++++++++++++++++++++++++++++ engines/zvision/render_table.h | 69 +++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 engines/zvision/render_table.cpp create mode 100644 engines/zvision/render_table.h diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp new file mode 100644 index 000000000000..1baf9514a317 --- /dev/null +++ b/engines/zvision/render_table.cpp @@ -0,0 +1,95 @@ +/* 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/scummsys.h" + +#include "zvision/render_table.h" + + +namespace ZVision { + +RenderTable::RenderTable(uint32 numRows, uint32 numColumns) + : _numRows(numRows), + _numColumns(numColumns) { + assert(numRows != 0 && numColumns != 0); + + _internalBuffer = new Common::Point[numRows * numColumns]; +} + +RenderTable::~RenderTable() { + delete[] _internalBuffer; +} + +void RenderTable::setRenderState(RenderState newState) { + _renderState = newState; + + switch (newState) { + case PANORAMA: + _panoramaOptions.fieldOfView = 60; + _panoramaOptions.linearScale = 1; + generatePanoramaLookupTable(); + break; + case TILT: + generateTiltLookupTable(); + break; + case FLAT: + // Intentionally left empty + break; + } +} + +void RenderTable::generatePanoramaLookupTable() { + float fieldOfView = _panoramaOptions.fieldOfView; + float scale = _panoramaOptions.linearScale; + + memset(_internalBuffer, 0, _numRows * _numColumns * sizeof(uint16)); + + float halfWidth = (float)_numColumns / 2.0f; + float halfHeight = (float)_numRows / 2.0f; + + float fovRadians = (fieldOfView * M_PI / 180.0f); + float halfHeightOverTan = halfHeight / tan(fovRadians); + float tanOverHalfHeight = tan(fovRadians) / halfHeight; + + for (uint32 x = 0; x < _numRows; x++) { + // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) + float xPos = (float)x - halfWidth + 0.01; + float tempX = atan(xPos*tanOverHalfHeight); + + int32 newX = floor(scale * halfHeightOverTan * tempX);// + half_w); + float cosX = cos(tempX); + + for (uint32 y = 0; y < _numColumns; y++) { + int32 newY = floor(halfHeight + (y - halfHeight) * cosX); + + uint32 index = x * _numColumns + y; + _internalBuffer[index].x = newX; //pixel index + _internalBuffer[index].y = newY; //pixel index + } + } +} + +void RenderTable::generateTiltLookupTable() { + +} + +} // End of namespace ZVision diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h new file mode 100644 index 000000000000..9d54551c3be2 --- /dev/null +++ b/engines/zvision/render_table.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 ZVISION_RENDER_TABLE_H +#define ZVISION_RENDER_TABLE_H + +#include "common/types.h" +#include "common/rect.h" + +namespace ZVision { + +class RenderTable { +public: + RenderTable(uint32 numRows, uint32 numColumns); + ~RenderTable(); + +public: + enum RenderState { + PANORAMA, + TILT, + FLAT + }; + +private: + uint32 _numColumns, _numRows; + Common::Point *_internalBuffer; + RenderState _renderState; + + struct { + uint16 fieldOfView; + uint16 linearScale; + } _panoramaOptions; + + // TODO: See if tilt and panorama need to have separate options + struct { + uint16 fieldOfView; + uint16 linearScale; + } _tiltOptions; + +public: + void setRenderState(RenderState newState); + +private: + void generatePanoramaLookupTable(); + void generateTiltLookupTable(); +}; + +} // End of namesapce ZVision + +#endif From ed4490730902780923bf1e91ed3617d56efb7c24 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:33:58 -0500 Subject: [PATCH 0352/1332] ZVISION: Move rendering logic from ZVision class to RenderManager class --- engines/zvision/events.cpp | 11 ++--- engines/zvision/render_manager.cpp | 60 ++++++++++------------- engines/zvision/render_manager.h | 77 +++++++++++++++++++++--------- engines/zvision/video.cpp | 26 +++++----- engines/zvision/zvision.cpp | 23 +++------ engines/zvision/zvision.h | 10 ---- 6 files changed, 101 insertions(+), 106 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index afa2d952071d..a01ea74cd03c 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -27,6 +27,7 @@ #include "common/events.h" #include "engines/util.h" +#include "zvision/render_manager.h" namespace ZVision { @@ -61,13 +62,9 @@ void ZVision::processEvents() { quitGame(); break; case Common::KEYCODE_ESCAPE: - if (_currentVideo != 0) { - initGraphics(_width, _height, true, &_pixelFormat); - delete _currentVideo; - _currentVideo = 0; - delete[] _scaledVideoFrameBuffer; - _scaledVideoFrameBuffer = 0; - } + if (_renderManager->isVideoPlaying()) + _renderManager->cancelVideo(); + break; default: break; diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 2a8ed1274eb0..8c3d37a1609e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -24,8 +24,8 @@ #include "common/file.h" #include "common/system.h" -#include "common/rect.h" +#include "engines/util.h" #include "graphics/decoders/tga.h" #include "zvision/render_manager.h" @@ -37,9 +37,29 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) : _system(system), _width(width), _height(height), + _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 + _currentVideo(0), + _scaledVideoFrameBuffer(0), _renderTable(width, height) { } +/** + * Initialize graphics + */ +void RenderManager::initialize() { + initGraphics(_width, _height, true, &_pixelFormat); +} + +void RenderManager::updateScreen(bool isConsoleActive) { + if (_currentVideo != 0) + continueVideo(); + + if (_needsScreenUpdate || isConsoleActive) { + _system->updateScreen(); + _needsScreenUpdate = false; + } +} + void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { Common::File file; @@ -86,40 +106,8 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x _needsScreenUpdate = true; } -void RenderManager::generatePanoramaLookupTable() { - float fieldOfView = _panoramaOptions.fieldOfView; - float scale = _panoramaOptions.linearScale; - _renderTable.clear(); - - double halfWidth = (double)_width / 2.0; - double halfHeight = (double)_height / 2.0; - - double fovRadians = (fieldOfView * 3.14159265 / 180.0); - double halfHeightOverTan = halfHeight / tan(fovRadians); - double tanOverHalfHeight = tan(fovRadians) / halfHeight; - - for (int32 x = 0; x < _width; x++) { - // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) - double xPos = (double)x - halfWidth + 0.01; - - double tempX = atan(xPos*tanOverHalfHeight); - double scaledX = scale * halfHeightOverTan * tempX; - double nn = cos(tempX); - double newHalfWidth = halfHeight * nn * halfHeightOverTan * tanOverHalfHeight*2.0; - - int32 newX = floor(scaledX);// + half_w); - - double yScale = newHalfWidth / (double)_height; - double et2 = ((double)_height - newHalfWidth) / 2.0; - - for (int32 y = 0; y < _height; y++) { - double et1 = (double)y*yScale; - - _renderTable(x, y).x = newX; //pixel index - - int32 newY = floor(et2 + et1); - _renderTable(x, y).y = newY; //pixel index - } - } +void RenderManager::setRenderState(RenderTable::RenderState state) { + _renderTable.setRenderState(state); } + } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index e481c26666ce..f2f1dd72e438 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -24,14 +24,20 @@ #define ZVISION_RENDER_MANAGER_H #include "common/types.h" +#include "common/rect.h" -#include "zvision/dense_2d_array.h" +#include "graphics/pixelformat.h" + +#include "zvision/render_table.h" class OSystem; namespace Common { class String; -class Point; +} + +namespace Video { +class VideoDecoder; } namespace ZVision { @@ -40,37 +46,62 @@ class RenderManager { public: RenderManager(OSystem *system, const int width, const int height); -public: - enum RenderState { - PANORAMA, - TILT, - FLAT - }; - private: OSystem *_system; const int _width; const int _height; - RenderState _renderState; - - struct { - uint16 fieldOfView; - uint16 linearScale; - } _panoramaOptions; + const Graphics::PixelFormat _pixelFormat; + RenderTable _renderTable; - // TODO: See if tilt and panorama need to have separate options - struct { - uint16 fieldOfView; - uint16 linearScale; - } _tiltOptions; - - Dense2DArray _renderTable; + Video::VideoDecoder *_currentVideo; + byte *_scaledVideoFrameBuffer; bool _needsScreenUpdate; public: + void initialize(); + void updateScreen(bool isConsoleActive); + + /** + * Start a video playing. It will also load the first frame of the video. + * + * @param videoDecoder The video to play + */ + void startVideo(Video::VideoDecoder *videoDecoder); + /** + * @return Is a video currently being played + */ + bool isVideoPlaying() { return _currentVideo == 0; } + /** + * Cancels a video prematurely. Any sound remaining in the queue will continue to play. + * The last frame of the video will remain on the screen until something else overwrites it + */ + void cancelVideo(); + + /** + * Blits the image to the screen. Actual screen updates won't happen until the end of the frame. + * The image will be clipped to fit inside the window. + * + * @param fileName Name of the image file + * @param x X position where the image should be put + * @param y Y position where the image should be put + */ void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); - void generatePanoramaLookupTable(); + + /** + * Set how the frame should be rendered + * + * @param state One of the RenderStates + */ + void setRenderState(RenderTable::RenderState state); + + bool needsScreenUpdate() { return _needsScreenUpdate; }; + +private: + /** + * Checks the time since the last video frame, and blits the next frame to the screen + */ + void continueVideo(); }; } // End of namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 042809000320..c0b575b23b88 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -23,11 +23,11 @@ #include "common/scummsys.h" #include "common/system.h" +#include "video/video_decoder.h" #include "engines/util.h" - #include "graphics/surface.h" -#include "zvision/zvision.h" +#include "zvision/render_manager.h" namespace ZVision { @@ -71,7 +71,7 @@ void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte b } } -void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { +void RenderManager::startVideo(Video::VideoDecoder *videoDecoder) { if (!videoDecoder) return; @@ -89,12 +89,7 @@ void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { continueVideo(); } -void ZVision::continueVideo() { - if (_currentVideo == 0) { - warning("No video loaded. Nothing to continue"); - return; - } - +void RenderManager::continueVideo() { byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; uint16 width = _currentVideo->getWidth(); uint16 height = _currentVideo->getHeight(); @@ -115,13 +110,16 @@ void ZVision::continueVideo() { } } } else { - initGraphics(_width, _height, true, &_pixelFormat); - delete _currentVideo; - _currentVideo = 0; - delete[] _scaledVideoFrameBuffer; - _scaledVideoFrameBuffer = 0; + cancelVideo(); } +} +void RenderManager::cancelVideo() { + initGraphics(_width, _height, true, &_pixelFormat); + delete _currentVideo; + _currentVideo = 0; + delete[] _scaledVideoFrameBuffer; + _scaledVideoFrameBuffer = 0; } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 57c9dea211f5..8cd734336891 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -46,9 +46,6 @@ namespace ZVision { ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), - _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 - _currentVideo(0), - _scaledVideoFrameBuffer(0), _width(640), _height(480) { // Put your engine in a sane state, but do nothing big yet; @@ -104,7 +101,7 @@ void ZVision::initialize() { SearchMan.add(name, archive); } - initGraphics(_width, _height, true, &_pixelFormat); + _renderManager->initialize(); _scriptManager->initialize(); @@ -127,19 +124,13 @@ Common::Error ZVision::run() { uint32 deltaTime = currentTime - lastTime; lastTime = currentTime; - if (_currentVideo != 0) - continueVideo(); - else { - _scriptManager->updateNodes(deltaTime); - _scriptManager->checkPuzzleCriteria(); - } - - if (_needsScreenUpdate || _console->isActive()) { - _system->updateScreen(); - _needsScreenUpdate = false; - } + _scriptManager->updateNodes(deltaTime); + _scriptManager->checkPuzzleCriteria(); + + // Render a frame + _renderManager->updateScreen(_console->isActive()); - // Calculate the frame delay based off a desired frame rate + // Calculate the frame delay based off a desired frame time int delay = desiredFrameTime - (currentTime - _system->getMillis()); // Ensure non-negative delay = delay < 0 ? 0 : delay; diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 7740dba6dc79..2e6ec11a5360 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -27,8 +27,6 @@ #include "common/random.h" #include "common/events.h" -#include "video/video_decoder.h" - #include "engines/engine.h" #include "zvision/detection.h" @@ -58,7 +56,6 @@ class ZVision : public Engine { private: Console *_console; const ZVisionGameDescription *_gameDescription; - const Graphics::PixelFormat _pixelFormat; const int _width; const int _height; @@ -71,10 +68,6 @@ class ZVision : public Engine { // To prevent allocation every time we process events Common::Event _event; - bool _needsScreenUpdate; - - Video::VideoDecoder *_currentVideo; - byte *_scaledVideoFrameBuffer; public: uint32 getFeatures() const; Common::Language getLanguage() const; @@ -84,9 +77,6 @@ class ZVision : public Engine { Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; - void startVideo(Video::VideoDecoder *videoDecoder); - void continueVideo(); - private: void initialize(); From de2e7fd144622436429da2af79e155724af49d46 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:34:52 -0500 Subject: [PATCH 0353/1332] ZVISION: Convert error() to warning() I did not realize the intended behavior of error() is to close the application --- engines/zvision/render_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 8c3d37a1609e..b2c9e29b94d5 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -64,7 +64,7 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x Common::File file; if (!file.open(fileName)) { - error("Could not open file %s", fileName.c_str()); + warning("Could not open file %s", fileName.c_str()); return; } @@ -94,7 +94,7 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x // Decode Graphics::TGADecoder tga; if (!tga.loadStream(file)) - error("Error while reading TGA image"); + warning("Error while reading TGA image"); file.close(); const Graphics::Surface *tgaSurface = tga.getSurface(); From 88934cd5d01c20c4add55c81277923f481674176 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:36:11 -0500 Subject: [PATCH 0354/1332] ZVISION: Convert console code to use RenderManager and add method for setRenderState --- engines/zvision/console.cpp | 24 +++++++++++++++++++++++- engines/zvision/console.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 2b45ed24b9b4..687be8f08667 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -41,6 +41,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("loadvideo", WRAP_METHOD(Console, cmdLoadVideo)); DCmd_Register("loadsound", WRAP_METHOD(Console, cmdLoadSound)); DCmd_Register("raw2wav", WRAP_METHOD(Console, cmdRawToWav)); + DCmd_Register("setrenderstate", WRAP_METHOD(Console, cmdSetRenderState)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -61,7 +62,7 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); if (videoDecoder && videoDecoder->loadFile(argv[1])) { - _engine->startVideo(videoDecoder); + _engine->getRenderManager()->startVideo(videoDecoder); } return true; @@ -92,6 +93,27 @@ bool Console::cmdRawToWav(int argc, const char **argv) { } convertRawToWav(argv[1], _engine, argv[2]); + return true; +} + +bool Console::cmdSetRenderState(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use setrenderstate to change the current render state\n"); + return true; + } + + Common::String renderState(argv[1]); + + if (renderState.matchString("panorama", true)) + _engine->getRenderManager()->setRenderState(RenderTable::PANORAMA); + else if (renderState.matchString("tilt", true)) + _engine->getRenderManager()->setRenderState(RenderTable::TILT); + else if (renderState.matchString("flat", true)) + _engine->getRenderManager()->setRenderState(RenderTable::FLAT); + else + DebugPrintf("Use setrenderstate to change the current render state\n"); + + return true; } } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 05b8f1247f1a..e2937030eba2 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -41,6 +41,7 @@ class Console : public GUI::Debugger { bool cmdLoadVideo(int argc, const char **argv); bool cmdLoadSound(int argc, const char **argv); bool cmdRawToWav(int argc, const char **argv); + bool cmdSetRenderState(int argc, const char **argv); }; } // End of namespace ZVision From 73f02759f914327732bac2f1a750f3a95efe17ce Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:36:53 -0500 Subject: [PATCH 0355/1332] ZVISION: Remove supurflouous 'const' and add 'inline' --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index b3831d4665ff..06c228d36785 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -68,7 +68,7 @@ struct Puzzle { // Used by the ScriptManager to allow unique-ification of _referenceTable // The unique-ification is done by sorting, then iterating and removing duplicates // The sort uses operator< - const bool operator<(const Puzzle &other) const { + inline bool operator<(const Puzzle &other) const { return key < other.key; } }; From df2e78e6f85c4c519e61985febcc3d70085202f0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:37:45 -0500 Subject: [PATCH 0356/1332] ZVISION: Remove variable used for debugging purposes --- engines/zvision/utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index fa29fe660f05..2942a35c81cf 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -223,7 +223,7 @@ void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Com output.writeUint32BE(MKTAG('d', 'a', 't', 'a')); output.writeUint32LE(file.size() * 2); int16 *buffer = new int16[file.size()]; - int readBytes = audioStream->readBuffer(buffer, file.size()); + audioStream->readBuffer(buffer, file.size()); output.write(buffer, file.size() * 2); delete[] buffer; From 65a08c71c6912ec0bcf20987652f7bd5d50a7791 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:38:17 -0500 Subject: [PATCH 0357/1332] ZVISION: Fix unsigned/signed compiler warning --- engines/zvision/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index e68d0de4491f..58a7ec3ab7dd 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -70,7 +70,7 @@ template void removeDuplicateEntries(Common::Array *container) { Common::sort(container->front(), container->back()); - for (int i = 0; i < container->size(); i++) { + for (uint32 i = 0; i < container->size(); i++) { while (container[i] == container[i +1]) { container->remove_at(i + 1); } From 364e9d659cf62566611921c3b2abceb2d97e2632 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:39:54 -0500 Subject: [PATCH 0358/1332] ZVISION: Force all files to be registered with SearchMan as 'flat' There are 10 file name conflicts as a result, but the conflicts are byte identical. --- engines/zvision/zvision.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 8cd734336891..b79ecb499346 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -56,11 +56,11 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // However this is the place to specify all default directories const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4); - SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx"); - SearchMan.addSubDirectoryMatching(gameDataDir, "znemscr"); + // TODO: There are 10 file clashes when we flatten the directories. From a quick look, the files are exactly the same, so it shouldn't matter. But I'm noting it here just in-case it does become a problem. + SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); // Here is the right place to set up the engine specific debug channels //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); From 2349fcfd3170e84d9ec2dd95bd7180fcaa0752e7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 26 Jul 2013 12:25:07 -0500 Subject: [PATCH 0359/1332] ZVISION: Modify renderImageToScreen to take into account the current RenderState --- engines/zvision/render_manager.cpp | 54 ++++++++++++++++++++++++++---- engines/zvision/render_manager.h | 13 ++++--- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b2c9e29b94d5..183f823c56f9 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -60,7 +60,45 @@ void RenderManager::updateScreen(bool isConsoleActive) { } } -void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y) { +void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { + // Panoramas are transposed + // The actual data is transposed in the RenderTable lookup + if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { + uint32 temp = imageHeight; + imageHeight = imageWidth; + imageWidth = temp; + } + + // Check if we truly want a subRect of the image + if (subRectangle.isEmpty()) + subRectangle = Common::Rect(imageWidth, imageHeight); + + // Clip to image bounds + subRectangle.clip(imageWidth, imageHeight); + // Clip destRect to screen bounds + Common::Rect destRect(destinationX, destinationY, destinationX + subRectangle.width(), destinationY + subRectangle.height()); + destRect.clip(_width, _height); + // Clip subRect to screen bounds + subRectangle.translate(destRect.left - destinationX, destRect.top - destinationY); + subRectangle.setWidth(destRect.width()); + subRectangle.setHeight(destRect.height()); + + // Check for validity + if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) + return; + + if (_renderTable.getRenderState() == RenderTable::FLAT) { + _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height()); + } else { + uint16 *destBuffer = new uint16[destRect.width() * destRect.height()]; + _renderTable.mutateImage((uint16 *)buffer, destBuffer, horizontalPitch, subRectangle); + + _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left, destRect.top, destRect.width(), destRect.height()); + delete[] destBuffer; + } +} + +void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { Common::File file; if (!file.open(fileName)) { @@ -77,15 +115,16 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x if (fileType == MKTAG('T', 'G', 'Z', '\0')) { // TGZ files have a header and then Bitmap data that is compressed with LZSS uint32 decompressedSize = file.readSint32LE(); - uint32 width = file.readSint32LE(); - uint32 height = file.readSint32LE(); + uint32 imageWidth = file.readSint32LE(); + uint32 imageHeight = file.readSint32LE(); LzssReadStream stream(&file); byte *buffer = new byte[decompressedSize]; stream.read(buffer, decompressedSize); - _system->copyRectToScreen(buffer, width * 2, x, y, width, height); + uint32 horizontalPitch = imageWidth * sizeof(uint16); + renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle); delete[] buffer; } else { // Reset the cursor @@ -93,12 +132,13 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x // Decode Graphics::TGADecoder tga; - if (!tga.loadStream(file)) + if (!tga.loadStream(file)) { warning("Error while reading TGA image"); - file.close(); + return; + } const Graphics::Surface *tgaSurface = tga.getSurface(); - _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, tgaSurface->w, tgaSurface->h); + renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle); tga.destroy(); } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index f2f1dd72e438..db0088811f05 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -79,14 +79,15 @@ class RenderManager { void cancelVideo(); /** - * Blits the image to the screen. Actual screen updates won't happen until the end of the frame. + * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the window. * - * @param fileName Name of the image file - * @param x X position where the image should be put - * @param y Y position where the image should be put + * @param fileName Name of the image file + * @param destinationX X position where the image should be put + * @param destinationY Y position where the image should be put + * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. */ - void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); + void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); /** * Set how the frame should be rendered @@ -102,6 +103,8 @@ class RenderManager { * Checks the time since the last video frame, and blits the next frame to the screen */ void continueVideo(); + + void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle); }; } // End of namespace ZVision From 3d223e2123672e00ccc38c2fd3d33dbe814d7156 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 26 Jul 2013 12:26:30 -0500 Subject: [PATCH 0360/1332] ZVISION: Modify the RenderTable panorama math to account for panoramas being transposed --- engines/zvision/render_table.cpp | 39 ++++++++++++++++++++++++-------- engines/zvision/render_table.h | 4 +++- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 1baf9514a317..3743c42d2751 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -29,7 +29,8 @@ namespace ZVision { RenderTable::RenderTable(uint32 numRows, uint32 numColumns) : _numRows(numRows), - _numColumns(numColumns) { + _numColumns(numColumns), + _renderState(RenderState::FLAT) { assert(numRows != 0 && numColumns != 0); _internalBuffer = new Common::Point[numRows * numColumns]; @@ -57,6 +58,21 @@ void RenderTable::setRenderState(RenderState newState) { } } +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 horizontalPitch, Common::Rect subRectangle) { + uint32 imageWidth = horizontalPitch / 2; + + for (int y = subRectangle.top; y < subRectangle.bottom; y++) { + uint32 normalizedY = y - subRectangle.top; + for (int x = subRectangle.left; x < subRectangle.right; x++) { + uint32 normalizedX = x - subRectangle.left; + + uint32 index = y * _numColumns + x; + uint32 sourceIndex = _internalBuffer[index].y * imageWidth + _internalBuffer[index].x; + destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceIndex]; + } + } +} + void RenderTable::generatePanoramaLookupTable() { float fieldOfView = _panoramaOptions.fieldOfView; float scale = _panoramaOptions.linearScale; @@ -70,20 +86,23 @@ void RenderTable::generatePanoramaLookupTable() { float halfHeightOverTan = halfHeight / tan(fovRadians); float tanOverHalfHeight = tan(fovRadians) / halfHeight; - for (uint32 x = 0; x < _numRows; x++) { + // TODO: Change the algorithm to write a whole row at a time instead of a whole column at a time. AKA: for(y) { for(x) {}} instead of for(x) { for(y) {}} + for (uint32 x = 0; x < _numColumns; x++) { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) - float xPos = (float)x - halfWidth + 0.01; - float tempX = atan(xPos*tanOverHalfHeight); + float temp = atan(tanOverHalfHeight * ((float)x - halfWidth + 0.01f)); - int32 newX = floor(scale * halfHeightOverTan * tempX);// + half_w); - float cosX = cos(tempX); + int32 newX = floor((halfHeightOverTan * scale * temp) + halfWidth); + float cosX = cos(temp); - for (uint32 y = 0; y < _numColumns; y++) { + for (uint32 y = 0; y < _numRows; y++) { int32 newY = floor(halfHeight + (y - halfHeight) * cosX); - uint32 index = x * _numColumns + y; - _internalBuffer[index].x = newX; //pixel index - _internalBuffer[index].y = newY; //pixel index + // Panorama images are transposed. Rather than trying to transpose the source, we know + // they will be mutated by this table. Therefore we can swap the axes here + uint32 index = y * _numColumns + x; + + _internalBuffer[index].x = newY; //pixel index + _internalBuffer[index].y = newX; //pixel index } } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 9d54551c3be2..fca76818e53e 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -57,13 +57,15 @@ class RenderTable { } _tiltOptions; public: + RenderState getRenderState() { return _renderState; } void setRenderState(RenderState newState); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 horizontalPitch, Common::Rect subRectangle); private: void generatePanoramaLookupTable(); void generateTiltLookupTable(); }; -} // End of namesapce ZVision +} // End of namespace ZVision #endif From c8359ad56ca4bf84ac1110ef1ceccbc9d4dc97dd Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 26 Jul 2013 12:27:04 -0500 Subject: [PATCH 0361/1332] ZVISION: Modify loadImage console command to account for new render options --- engines/zvision/console.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 687be8f08667..bfe260977743 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -45,11 +45,14 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { } bool Console::cmdLoadImage(int argc, const char **argv) { - if (argc != 4) { - DebugPrintf("Use loadimage to load an image to the screen\n"); + if (argc == 4) + _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); + else if (argc == 8) + _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]), Common::Rect(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atoi(argv[7]))); + else { + DebugPrintf("Use loadimage [ ] to load an image to the screen\n"); return true; } - _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); return true; } From 34b3a788981a94830023946dcc45bc6a1e028805 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 26 Jul 2013 14:28:08 -0500 Subject: [PATCH 0362/1332] ZVISION: Fix error causing image discontinutities The width and height were swapped when passed to the class constructor. --- engines/zvision/render_table.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 3743c42d2751..388dc85bcbb0 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -27,7 +27,7 @@ namespace ZVision { -RenderTable::RenderTable(uint32 numRows, uint32 numColumns) +RenderTable::RenderTable(uint32 numColumns, uint32 numRows) : _numRows(numRows), _numColumns(numColumns), _renderState(RenderState::FLAT) { @@ -97,10 +97,10 @@ void RenderTable::generatePanoramaLookupTable() { for (uint32 y = 0; y < _numRows; y++) { int32 newY = floor(halfHeight + (y - halfHeight) * cosX); - // Panorama images are transposed. Rather than trying to transpose the source, we know - // they will be mutated by this table. Therefore we can swap the axes here uint32 index = y * _numColumns + x; + // Panorama images are transposed. Rather than trying to transpose the source, we know + // they will be mutated by this table. Therefore we can swap the axes here _internalBuffer[index].x = newY; //pixel index _internalBuffer[index].y = newX; //pixel index } From 611ff31a56055b1ec05445597087cb042de2c648 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 28 Jul 2013 21:09:20 -0500 Subject: [PATCH 0363/1332] ZVISION: Copy Point struct from rect.h and turn it into a templated class --- engines/zvision/point.h | 80 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 engines/zvision/point.h diff --git a/engines/zvision/point.h b/engines/zvision/point.h new file mode 100644 index 000000000000..da244e94497e --- /dev/null +++ b/engines/zvision/point.h @@ -0,0 +1,80 @@ +/* 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_ZVISION_POINT_H +#define COMMON_ZVISION_POINT_H + +#include "common/types.h" + +namespace ZVision { + +/** + * Simple class for handling both 2D position and size. + */ +template +class Point { +public: + T x; ///< The horizontal part of the point + T y; ///< The vertical part of the point + +public: + Point() : x(0), y(0) {} + Point(T x1, T y1) : x(x1), y(y1) {} + +public: + 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 operator+=(const Point &delta) { + x += delta.x; + y += delta.y; + } + + void operator-=(const Point &delta) { + x -= delta.x; + y -= delta.y; + } + + /** + * Return the square of the distance between this point and the point p. + * + * @param p the other point + * @return the distance between this and p + */ + uint sqrDist(const Point &p) const { + int diffx = ABS(p.x - x); + if (diffx >= 0x1000) + return 0xFFFFFF; + + int diffy = ABS(p.y - y); + if (diffy >= 0x1000) + return 0xFFFFFF; + + return uint(diffx * diffx + diffy * diffy); + } +}; + +} // End of namespace ZVision + +#endif From a23970bbc68865ccffa4c2e0849ffe244d48d5f1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 28 Jul 2013 21:37:32 -0500 Subject: [PATCH 0364/1332] ZVISION: Convert RenderTable to only storing (x,y) offsets instead of absolute postions. This allows the destRectangle to be offset within the RenderTable --- engines/zvision/render_manager.cpp | 2 +- engines/zvision/render_table.cpp | 40 +++++++++++++++++++++--------- engines/zvision/render_table.h | 6 +++-- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 183f823c56f9..cfd53fdc4b19 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -91,7 +91,7 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { uint16 *destBuffer = new uint16[destRect.width() * destRect.height()]; - _renderTable.mutateImage((uint16 *)buffer, destBuffer, horizontalPitch, subRectangle); + _renderTable.mutateImage((uint16 *)buffer, destBuffer, imageWidth, imageHeight, subRectangle, destRect); _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left, destRect.top, destRect.width(), destRect.height()); delete[] destBuffer; diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 388dc85bcbb0..085908fc68df 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -22,8 +22,9 @@ #include "common/scummsys.h" -#include "zvision/render_table.h" +#include "zvision/render_table.h" +#include "zvision/point.h" namespace ZVision { @@ -33,7 +34,7 @@ RenderTable::RenderTable(uint32 numColumns, uint32 numRows) _renderState(RenderState::FLAT) { assert(numRows != 0 && numColumns != 0); - _internalBuffer = new Common::Point[numRows * numColumns]; + _internalBuffer = new Point[numRows * numColumns]; } RenderTable::~RenderTable() { @@ -58,17 +59,33 @@ void RenderTable::setRenderState(RenderState newState) { } } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 horizontalPitch, Common::Rect subRectangle) { - uint32 imageWidth = horizontalPitch / 2; +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle) { + bool isTransposed = _renderState == RenderTable::PANORAMA || _renderState == RenderTable::TILT; for (int y = subRectangle.top; y < subRectangle.bottom; y++) { uint32 normalizedY = y - subRectangle.top; + for (int x = subRectangle.left; x < subRectangle.right; x++) { uint32 normalizedX = x - subRectangle.left; - uint32 index = y * _numColumns + x; - uint32 sourceIndex = _internalBuffer[index].y * imageWidth + _internalBuffer[index].x; - destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceIndex]; + uint32 index = (y + destRectangle.top) * _numColumns + (x + destRectangle.left); + + // RenderTable only stores offsets from the original coordinates + uint32 sourceYIndex = y + _internalBuffer[index].y; + uint32 sourceXIndex = x + _internalBuffer[index].x; + + // Clamp the yIndex to the size of the image + sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + + // Clamp the xIndex to the size of the image + sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + + // TODO: Figure out a way to not have branching every loop. The only way that comes to mind is to have a whole separate set of for loops for isTransposed, but that's ugly. The compiler might do this anyway in the end + if (isTransposed) { + destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceXIndex * imageHeight + sourceYIndex]; + } else { + destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; + } } } } @@ -91,7 +108,7 @@ void RenderTable::generatePanoramaLookupTable() { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) float temp = atan(tanOverHalfHeight * ((float)x - halfWidth + 0.01f)); - int32 newX = floor((halfHeightOverTan * scale * temp) + halfWidth); + int32 newX = floor((halfHeightOverTan * _panoramaOptions.linearScale * temp) + halfWidth); float cosX = cos(temp); for (uint32 y = 0; y < _numRows; y++) { @@ -99,10 +116,9 @@ void RenderTable::generatePanoramaLookupTable() { uint32 index = y * _numColumns + x; - // Panorama images are transposed. Rather than trying to transpose the source, we know - // they will be mutated by this table. Therefore we can swap the axes here - _internalBuffer[index].x = newY; //pixel index - _internalBuffer[index].y = newX; //pixel index + // Only store the x,y offsets instead of the absolute positions + _internalBuffer[index].x = newX - x; //pixel index + _internalBuffer[index].y = newY - y; //pixel index } } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index fca76818e53e..cb91f885b4b8 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -26,6 +26,8 @@ #include "common/types.h" #include "common/rect.h" +#include "zvision/point.h" + namespace ZVision { class RenderTable { @@ -42,7 +44,7 @@ class RenderTable { private: uint32 _numColumns, _numRows; - Common::Point *_internalBuffer; + Point *_internalBuffer; RenderState _renderState; struct { @@ -59,7 +61,7 @@ class RenderTable { public: RenderState getRenderState() { return _renderState; } void setRenderState(RenderState newState); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 horizontalPitch, Common::Rect subRectangle); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); private: void generatePanoramaLookupTable(); From 4acdf5b7d51869bfb697e345a9a90f487d8fafc0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 28 Jul 2013 21:38:53 -0500 Subject: [PATCH 0365/1332] ZVISION: Convert panoramaOptions and tiltOptions to floats --- engines/zvision/render_table.cpp | 7 ++----- engines/zvision/render_table.h | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 085908fc68df..d1f8258e0219 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -47,7 +47,7 @@ void RenderTable::setRenderState(RenderState newState) { switch (newState) { case PANORAMA: _panoramaOptions.fieldOfView = 60; - _panoramaOptions.linearScale = 1; + _panoramaOptions.linearScale = 0.55f; generatePanoramaLookupTable(); break; case TILT: @@ -91,15 +91,12 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 i } void RenderTable::generatePanoramaLookupTable() { - float fieldOfView = _panoramaOptions.fieldOfView; - float scale = _panoramaOptions.linearScale; - memset(_internalBuffer, 0, _numRows * _numColumns * sizeof(uint16)); float halfWidth = (float)_numColumns / 2.0f; float halfHeight = (float)_numRows / 2.0f; - float fovRadians = (fieldOfView * M_PI / 180.0f); + float fovRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f); float halfHeightOverTan = halfHeight / tan(fovRadians); float tanOverHalfHeight = tan(fovRadians) / halfHeight; diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index cb91f885b4b8..ec405e5dfee2 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -48,14 +48,14 @@ class RenderTable { RenderState _renderState; struct { - uint16 fieldOfView; - uint16 linearScale; + float fieldOfView; + float linearScale; } _panoramaOptions; // TODO: See if tilt and panorama need to have separate options struct { - uint16 fieldOfView; - uint16 linearScale; + float fieldOfView; + float linearScale; } _tiltOptions; public: From f8bc82080a82d7ed198c88d7a839c32e092ede52 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 10:59:09 -0500 Subject: [PATCH 0366/1332] ZVISION: Create function for mixing two RGB<555> colors --- engines/zvision/render_table.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index d1f8258e0219..ca7f9a80309a 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" +#include "graphics/colormasks.h" #include "zvision/render_table.h" #include "zvision/point.h" @@ -59,6 +60,27 @@ void RenderTable::setRenderState(RenderState newState) { } } +uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { + assert(percentColorOne < 1.0f); + + float rOne = float((colorOne & Graphics::ColorMasks<555>::kRedMask) >> Graphics::ColorMasks<555>::kRedShift); + float rTwo = float((colorTwo & Graphics::ColorMasks<555>::kRedMask) >> Graphics::ColorMasks<555>::kRedShift); + float gOne = float((colorOne & Graphics::ColorMasks<555>::kGreenMask) >> Graphics::ColorMasks<555>::kGreenShift); + float gTwo = float((colorTwo & Graphics::ColorMasks<555>::kGreenMask) >> Graphics::ColorMasks<555>::kGreenShift); + float bOne = float((colorOne & Graphics::ColorMasks<555>::kBlueMask) >> Graphics::ColorMasks<555>::kBlueShift); + float bTwo = float((colorTwo & Graphics::ColorMasks<555>::kBlueMask) >> Graphics::ColorMasks<555>::kBlueShift); + + float rFinal = rOne * percentColorOne + rTwo * (1.0f - percentColorOne); + float gFinal = gOne * percentColorOne + gTwo * (1.0f - percentColorOne); + float bFinal = bOne * percentColorOne + bTwo * (1.0f - percentColorOne); + + uint16 returnColor = (byte(rFinal + 0.5f) << Graphics::ColorMasks<555>::kRedShift) | + (byte(gFinal + 0.5f) << Graphics::ColorMasks<555>::kGreenShift) | + (byte(bFinal + 0.5f) << Graphics::ColorMasks<555>::kBlueShift); + + return returnColor; +} + void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle) { bool isTransposed = _renderState == RenderTable::PANORAMA || _renderState == RenderTable::TILT; From 48b9741f413fb32ed5efedfe248093be811678c6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:03:08 -0500 Subject: [PATCH 0367/1332] ZVISION: Rename Point template class to Vector2 Also remove templating --- engines/zvision/render_table.cpp | 4 ++-- engines/zvision/render_table.h | 4 ++-- engines/zvision/{point.h => vector2.h} | 27 +++++++++++++------------- 3 files changed, 17 insertions(+), 18 deletions(-) rename engines/zvision/{point.h => vector2.h} (70%) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index ca7f9a80309a..5754c91b24ab 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -25,7 +25,7 @@ #include "graphics/colormasks.h" #include "zvision/render_table.h" -#include "zvision/point.h" +#include "zvision/vector2.h" namespace ZVision { @@ -35,7 +35,7 @@ RenderTable::RenderTable(uint32 numColumns, uint32 numRows) _renderState(RenderState::FLAT) { assert(numRows != 0 && numColumns != 0); - _internalBuffer = new Point[numRows * numColumns]; + _internalBuffer = new Vector2[numRows * numColumns]; } RenderTable::~RenderTable() { diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index ec405e5dfee2..3f87c2e026cd 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -26,7 +26,7 @@ #include "common/types.h" #include "common/rect.h" -#include "zvision/point.h" +#include "zvision/vector2.h" namespace ZVision { @@ -44,7 +44,7 @@ class RenderTable { private: uint32 _numColumns, _numRows; - Point *_internalBuffer; + Vector2 *_internalBuffer; RenderState _renderState; struct { diff --git a/engines/zvision/point.h b/engines/zvision/vector2.h similarity index 70% rename from engines/zvision/point.h rename to engines/zvision/vector2.h index da244e94497e..d301aef4c639 100644 --- a/engines/zvision/point.h +++ b/engines/zvision/vector2.h @@ -23,35 +23,34 @@ #ifndef COMMON_ZVISION_POINT_H #define COMMON_ZVISION_POINT_H -#include "common/types.h" +#include "common/scummsys.h" namespace ZVision { /** * Simple class for handling both 2D position and size. */ -template -class Point { +class Vector2 { public: - T x; ///< The horizontal part of the point - T y; ///< The vertical part of the point + int16 x; ///< The horizontal part of the point + int16 y; ///< The vertical part of the point public: - Point() : x(0), y(0) {} - Point(T x1, T y1) : x(x1), y(y1) {} + Vector2() : x(0), y(0) {} + Vector2(int16 x1, int16 y1) : x(x1), y(y1) {} public: - 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); } + bool operator==(const Vector2 &p) const { return x == p.x && y == p.y; } + bool operator!=(const Vector2 &p) const { return x != p.x || y != p.y; } + Vector2 operator+(const Vector2 &delta) const { return Vector2(x + delta.x, y + delta.y); } + Vector2 operator-(const Vector2 &delta) const { return Vector2(x - delta.x, y - delta.y); } - void operator+=(const Point &delta) { + void operator+=(const Vector2 &delta) { x += delta.x; y += delta.y; } - void operator-=(const Point &delta) { + void operator-=(const Vector2 &delta) { x -= delta.x; y -= delta.y; } @@ -62,7 +61,7 @@ class Point { * @param p the other point * @return the distance between this and p */ - uint sqrDist(const Point &p) const { + uint sqrDist(const Vector2 &p) const { int diffx = ABS(p.x - x); if (diffx >= 0x1000) return 0xFFFFFF; From 564379d3eed127fd6c41a9a42bb149afbc7fb75e Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:05:37 -0500 Subject: [PATCH 0368/1332] ZVISION: Create method to get RenderTable object pointer from RenderManager Remove passthrough methods --- engines/zvision/console.cpp | 6 +++--- engines/zvision/render_manager.cpp | 4 ++-- engines/zvision/render_manager.h | 7 +------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index bfe260977743..12555fe3cc57 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -108,11 +108,11 @@ bool Console::cmdSetRenderState(int argc, const char **argv) { Common::String renderState(argv[1]); if (renderState.matchString("panorama", true)) - _engine->getRenderManager()->setRenderState(RenderTable::PANORAMA); + _engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::PANORAMA); else if (renderState.matchString("tilt", true)) - _engine->getRenderManager()->setRenderState(RenderTable::TILT); + _engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::TILT); else if (renderState.matchString("flat", true)) - _engine->getRenderManager()->setRenderState(RenderTable::FLAT); + _engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT); else DebugPrintf("Use setrenderstate to change the current render state\n"); diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index cfd53fdc4b19..10afe1f2013e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -146,8 +146,8 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d _needsScreenUpdate = true; } -void RenderManager::setRenderState(RenderTable::RenderState state) { - _renderTable.setRenderState(state); +RenderTable *RenderManager::getRenderTable() { + return &_renderTable; } } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index db0088811f05..8b4d7e840b81 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -89,12 +89,7 @@ class RenderManager { */ void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); - /** - * Set how the frame should be rendered - * - * @param state One of the RenderStates - */ - void setRenderState(RenderTable::RenderState state); + RenderTable *getRenderTable(); bool needsScreenUpdate() { return _needsScreenUpdate; }; From 5376aa7b3cb234134cec5923f65ab7c9273a9528 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:08:03 -0500 Subject: [PATCH 0369/1332] ZVISION: Move generating the RenderTable to outside setRenderState This allows the panorama/tilt options to mutated without having to generate the table multiple times. --- engines/zvision/console.cpp | 17 +++++++++++++++++ engines/zvision/console.h | 1 + engines/zvision/render_table.cpp | 17 +++++++++++++++-- engines/zvision/render_table.h | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 12555fe3cc57..e9bbdd74bb51 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -42,6 +42,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("loadsound", WRAP_METHOD(Console, cmdLoadSound)); DCmd_Register("raw2wav", WRAP_METHOD(Console, cmdRawToWav)); DCmd_Register("setrenderstate", WRAP_METHOD(Console, cmdSetRenderState)); + DCmd_Register("generaterendertable", WRAP_METHOD(Console, cmdGenerateRenderTable)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -119,4 +120,20 @@ bool Console::cmdSetRenderState(int argc, const char **argv) { return true; } +bool Console::cmdGenerateRenderTable(int argc, const char **argv) { + _engine->getRenderManager()->getRenderTable()->generateRenderTable(); + + return true; +} + +bool Console::cmdSetPanoramaFoV(int argc, const char **argv) { + + return true; +} + +bool Console::cmdSetPanoramaScale(int argc, const char **argv) { + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index e2937030eba2..7fa4acc194ec 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -42,6 +42,7 @@ class Console : public GUI::Debugger { bool cmdLoadSound(int argc, const char **argv); bool cmdRawToWav(int argc, const char **argv); bool cmdSetRenderState(int argc, const char **argv); + bool cmdGenerateRenderTable(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 5754c91b24ab..1ba1648d39b5 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -49,10 +49,9 @@ void RenderTable::setRenderState(RenderState newState) { case PANORAMA: _panoramaOptions.fieldOfView = 60; _panoramaOptions.linearScale = 0.55f; - generatePanoramaLookupTable(); break; case TILT: - generateTiltLookupTable(); + break; case FLAT: // Intentionally left empty @@ -112,6 +111,20 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 i } } +void RenderTable::generateRenderTable() { + switch (_renderState) { + case ZVision::RenderTable::PANORAMA: + generatePanoramaLookupTable(); + break; + case ZVision::RenderTable::TILT: + generateTiltLookupTable(); + break; + case ZVision::RenderTable::FLAT: + // Intentionally left empty + break; + } +} + void RenderTable::generatePanoramaLookupTable() { memset(_internalBuffer, 0, _numRows * _numColumns * sizeof(uint16)); diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 3f87c2e026cd..a48e608db804 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -62,6 +62,7 @@ class RenderTable { RenderState getRenderState() { return _renderState; } void setRenderState(RenderState newState); void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); + void generateRenderTable(); private: void generatePanoramaLookupTable(); From b9dd61437c88fae024fd2d344b1f75020a5f7eb5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:09:49 -0500 Subject: [PATCH 0370/1332] ZVISION: Create class for ActionDelayRender --- engines/zvision/actions.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 9b2267df8297..224f9011a1bc 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -40,9 +40,7 @@ class ResultAction { // The different types of actions -// CROSSFADE, // DEBUG, -// DELAY_RENDER, // DISABLE_CONTROL, // DISABLE_VENUS, // DISPLAY_MESSAGE, @@ -129,6 +127,16 @@ class ActionCrossfade : public ResultAction { uint16 _timeInMillis; }; +class ActionDelayRender : public ResultAction { +public: + ActionDelayRender(Common::String *line); + bool execute(ZVision *engine); + +private: + // TODO: Check if this should actually be frames or if it should be milliseconds/seconds + byte framesToDelay; +}; + class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(Common::String *line); From 0e4e6ee9bf1f3a640191df6b22e6965a7199d171 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:20:51 -0500 Subject: [PATCH 0371/1332] ZVISION: Create methods for altering panoramaOptions and create console commands for them --- engines/zvision/console.cpp | 14 ++++++++++++++ engines/zvision/console.h | 2 ++ engines/zvision/render_table.cpp | 9 +++++++++ engines/zvision/render_table.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index e9bbdd74bb51..3dad7af37605 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -43,6 +43,8 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("raw2wav", WRAP_METHOD(Console, cmdRawToWav)); DCmd_Register("setrenderstate", WRAP_METHOD(Console, cmdSetRenderState)); DCmd_Register("generaterendertable", WRAP_METHOD(Console, cmdGenerateRenderTable)); + DCmd_Register("setpanoramafov", WRAP_METHOD(Console, cmdSetPanoramaFoV)); + DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -127,11 +129,23 @@ bool Console::cmdGenerateRenderTable(int argc, const char **argv) { } bool Console::cmdSetPanoramaFoV(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use setpanoramafov to change the current panorama field of view\n"); + return true; + } + + _engine->getRenderManager()->getRenderTable()->setPanoramaFoV(atof(argv[1])); return true; } bool Console::cmdSetPanoramaScale(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use setpanoramascale to change the current panorama scale\n"); + return true; + } + + _engine->getRenderManager()->getRenderTable()->setPanoramaScale(atof(argv[1])); return true; } diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 7fa4acc194ec..7b1beeb304e9 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -43,6 +43,8 @@ class Console : public GUI::Debugger { bool cmdRawToWav(int argc, const char **argv); bool cmdSetRenderState(int argc, const char **argv); bool cmdGenerateRenderTable(int argc, const char **argv); + bool cmdSetPanoramaFoV(int argc, const char **argv); + bool cmdSetPanoramaScale(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 1ba1648d39b5..b5a2809444c5 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -156,7 +156,16 @@ void RenderTable::generatePanoramaLookupTable() { } void RenderTable::generateTiltLookupTable() { +void RenderTable::setPanoramaFoV(float fov) { + assert(fov > 0.0f); + _panoramaOptions.fieldOfView = fov; +} + +void RenderTable::setPanoramaScale(float scale) { + assert(scale > 0.0f); + + _panoramaOptions.linearScale = scale; } } // End of namespace ZVision diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index a48e608db804..5698feaa037a 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -64,6 +64,9 @@ class RenderTable { void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); void generateRenderTable(); + void setPanoramaFoV(float fov); + void setPanoramaScale(float scale); + private: void generatePanoramaLookupTable(); void generateTiltLookupTable(); From 8f3e27cbd03831569f37e2edc5beebe9fd93de12 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:22:14 -0500 Subject: [PATCH 0372/1332] ZVISION: Fix closing braces on generateTiltLookupTable --- engines/zvision/render_table.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index b5a2809444c5..90a5aafea515 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -156,6 +156,9 @@ void RenderTable::generatePanoramaLookupTable() { } void RenderTable::generateTiltLookupTable() { + +} + void RenderTable::setPanoramaFoV(float fov) { assert(fov > 0.0f); From e076d8e52ff2917fb68eb7ea302f96fcbe76f84d Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:23:25 -0500 Subject: [PATCH 0373/1332] ZVISION: Change default panorama FoV to 27 degrees This is to match Marisa Chan's implementation. Images at this FoV also look better. --- engines/zvision/render_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 90a5aafea515..0bd8f23e3d72 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -47,7 +47,7 @@ void RenderTable::setRenderState(RenderState newState) { switch (newState) { case PANORAMA: - _panoramaOptions.fieldOfView = 60; + _panoramaOptions.fieldOfView = 27.0f; _panoramaOptions.linearScale = 0.55f; break; case TILT: From 1c551d43595a6acfb7f00bb3f0713435576e0f0e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 30 Jul 2013 02:10:57 +0300 Subject: [PATCH 0374/1332] ZVISION: Only scale videos when needed This avoids crashes for videos that exceed the screen size when scaled --- engines/zvision/video.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index c0b575b23b88..caf43ae0b555 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -91,20 +91,27 @@ void RenderManager::startVideo(Video::VideoDecoder *videoDecoder) { void RenderManager::continueVideo() { byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; - uint16 width = _currentVideo->getWidth(); - uint16 height = _currentVideo->getHeight(); - uint16 pitch = width * bytesPerPixel; + uint16 origWidth = _currentVideo->getWidth(); + uint16 origHeight = _currentVideo->getHeight(); + uint16 pitch = origWidth * bytesPerPixel; + bool shouldBeScaled = (origWidth * 2 <= 640 && origHeight * 2 <= 480); + uint16 finalWidth = shouldBeScaled ? origWidth * 2 : origWidth; + uint16 finalHeight = shouldBeScaled ? origHeight * 2 : origHeight; - uint16 x = (_system->getWidth() - (width * 2)) / 2; - uint16 y = (_system->getHeight() - (height * 2)) / 2; + uint16 x = (_system->getWidth() - finalWidth) / 2; + uint16 y = (_system->getHeight() - finalHeight) / 2; if (!_currentVideo->endOfVideo()) { if (_currentVideo->needsUpdate()) { const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); - if (frame) { - scale2x(static_cast(frame->pixels), _scaledVideoFrameBuffer, width, height, bytesPerPixel); - _system->copyRectToScreen(_scaledVideoFrameBuffer, pitch * 2, x, y, width * 2, height * 2); + if (frame) { + if (shouldBeScaled) { + scale2x((byte *)frame->pixels, _scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel); + _system->copyRectToScreen(_scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); + } else { + _system->copyRectToScreen((byte *)frame->pixels, pitch, x, y, finalWidth, finalHeight); + } _needsScreenUpdate = true; } From 032afd3c1a6fe929cafde4f30f4c1e59b7ac6a89 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 30 Jul 2013 02:35:49 +0300 Subject: [PATCH 0375/1332] ZVISION: Fix compilation --- engines/zvision/render_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 0bd8f23e3d72..e3ce77952b52 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -32,7 +32,7 @@ namespace ZVision { RenderTable::RenderTable(uint32 numColumns, uint32 numRows) : _numRows(numRows), _numColumns(numColumns), - _renderState(RenderState::FLAT) { + _renderState(FLAT) { assert(numRows != 0 && numColumns != 0); _internalBuffer = new Vector2[numRows * numColumns]; From 93c6670f6f80b98dd05df09d710b3c683cfd1173 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:42:07 -0500 Subject: [PATCH 0376/1332] ZVISION: Create clone member function for ResultAction class --- engines/zvision/actions.cpp | 36 ++++++++++++++++++++++++++++++++++++ engines/zvision/actions.h | 11 +++++++++++ 2 files changed, 47 insertions(+) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 791eda11e00a..35e5d4886d41 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -37,6 +37,10 @@ ActionAdd::ActionAdd(Common::String *line) { sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value); } +ResultAction *ActionAdd::clone() const { + return new ActionAdd(*this); +} + bool ActionAdd::execute(ZVision *engine) { engine->getScriptManager()->addToStateValue(_key, _value); return true; @@ -51,6 +55,10 @@ ActionAssign::ActionAssign(Common::String *line) { sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value); } +ResultAction *ActionAssign::clone() const { + return new ActionAssign(*this); +} + bool ActionAssign::execute(ZVision *engine) { engine->getScriptManager()->setStateValue(_key, _value); return true; @@ -65,6 +73,10 @@ ActionAttenuate::ActionAttenuate(Common::String *line) { sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation); } +ResultAction *ActionAttenuate::clone() const { + return new ActionAttenuate(*this); +} + bool ActionAttenuate::execute(ZVision *engine) { // TODO: Implement return true; @@ -79,6 +91,10 @@ ActionChangeLocation::ActionChangeLocation(Common::String *line) { sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); } +ResultAction *ActionChangeLocation::clone() const { + return new ActionChangeLocation(*this); +} + bool ActionChangeLocation::execute(ZVision *engine) { // TODO: Implement return true; @@ -95,6 +111,10 @@ ActionCrossfade::ActionCrossfade(Common::String *line) { &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } +ResultAction *ActionCrossfade::clone() const { + return new ActionCrossfade(*this); +} + bool ActionCrossfade::execute(ZVision *engine) { // TODO: Implement return true; @@ -110,6 +130,10 @@ ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) { sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); } +ResultAction *ActionPreloadAnimation::clone() const { + return new ActionPreloadAnimation(*this); +} + bool ActionPreloadAnimation::execute(ZVision *engine) { // TODO: Implement return true; @@ -127,6 +151,10 @@ ActionPlayAnimation::ActionPlayAnimation(Common::String *line) { &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } +ResultAction *ActionPlayAnimation::clone() const { + return new ActionPlayAnimation(*this); +} + bool ActionPlayAnimation::execute(ZVision *engine) { // TODO: Implement return true; @@ -141,6 +169,10 @@ ActionRandom::ActionRandom(Common::String *line) { sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max); } +ResultAction *ActionRandom::clone() const { + return new ActionRandom(*this); +} + bool ActionRandom::execute(ZVision *engine) { uint32 randNumber = engine->getRandomSource()->getRandomNumber(_max); engine->getScriptManager()->setStateValue(_key, randNumber); @@ -156,6 +188,10 @@ ActionTimer::ActionTimer(Common::String *line) { sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time); } +ResultAction *ActionTimer::clone() const { + return new ActionTimer(*this); +} + bool ActionTimer::execute(ZVision *engine) { engine->getScriptManager()->addActionNode(new NodeTimer(_key, _time)); return true; diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 224f9011a1bc..75cffab59bf6 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -35,6 +35,7 @@ class ZVision; class ResultAction { public: virtual ~ResultAction() {} + virtual ResultAction *clone() const = 0; virtual bool execute(ZVision *engine) = 0; }; @@ -73,6 +74,7 @@ class ResultAction { class ActionAdd : public ResultAction { public: ActionAdd(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -83,6 +85,7 @@ class ActionAdd : public ResultAction { class ActionAssign : public ResultAction { public: ActionAssign(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -93,6 +96,7 @@ class ActionAssign : public ResultAction { class ActionAttenuate : public ResultAction { public: ActionAttenuate(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -103,6 +107,7 @@ class ActionAttenuate : public ResultAction { class ActionChangeLocation : public ResultAction { public: ActionChangeLocation(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -115,6 +120,7 @@ class ActionChangeLocation : public ResultAction { class ActionCrossfade : public ResultAction { public: ActionCrossfade(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -130,6 +136,7 @@ class ActionCrossfade : public ResultAction { class ActionDelayRender : public ResultAction { public: ActionDelayRender(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -140,6 +147,7 @@ class ActionDelayRender : public ResultAction { class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -159,6 +167,7 @@ class ActionPlayAnimation : public ResultAction { class ActionPreloadAnimation : public ResultAction { public: ActionPreloadAnimation(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -178,6 +187,7 @@ class ActionPreloadAnimation : public ResultAction { class ActionRandom : public ResultAction { public: ActionRandom(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -188,6 +198,7 @@ class ActionRandom : public ResultAction { class ActionTimer : public ResultAction { public: ActionTimer(Common::String *line); + ResultAction *clone() const; bool execute(ZVision *engine); private: From 7d58ebf2819562893df2f07b916c9712d5b7413f Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:43:49 -0500 Subject: [PATCH 0377/1332] ZVISION: Convert Puzzle to a class It needed a copy constructor and destructor to handle the heap memory ResultActions --- engines/zvision/puzzle.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 06c228d36785..08d8a5cfd7ef 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -58,7 +58,27 @@ enum StateFlags { DISABLED = 0x04 }; -struct Puzzle { +class Puzzle { +public: + ~Puzzle() { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + delete (*iter); + } + } + + Puzzle() {} + + // Copy constructor + Puzzle(const Puzzle &other) + : key(other.key), + criteriaList(other.criteriaList), + flags(flags) { + // We have to clone the ResultActions since they are on the heap + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + resultActions.push_back((*iter)->clone()); + } + } + uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract From cf9790a9d6407e3bfea46cea1c59abe9ab5de31c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:45:53 -0500 Subject: [PATCH 0378/1332] ZVISION: Create mutators for _tiltOptions --- engines/zvision/render_table.cpp | 12 ++++++++++++ engines/zvision/render_table.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index e3ce77952b52..49203df195dd 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -171,4 +171,16 @@ void RenderTable::setPanoramaScale(float scale) { _panoramaOptions.linearScale = scale; } +void RenderTable::setTiltFoV(float fov) { + assert(fov > 0.0f); + + _tiltOptions.fieldOfView = fov; +} + +void RenderTable::setTiltScale(float scale) { + assert(scale > 0.0f); + + _tiltOptions.linearScale = scale; +} + } // End of namespace ZVision diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 5698feaa037a..ccb5926a5160 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -67,6 +67,9 @@ class RenderTable { void setPanoramaFoV(float fov); void setPanoramaScale(float scale); + void setTiltFoV(float fov); + void setTiltScale(float scale); + private: void generatePanoramaLookupTable(); void generateTiltLookupTable(); From b20437a17d1a740e70dd1fa0bbf3bc6cfeb6c494 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:49:06 -0500 Subject: [PATCH 0379/1332] ZVISION: Modify Criteria parsing to handle empty Criteria --- engines/zvision/scr_file_handling.cpp | 46 ++++++++++++++++----------- engines/zvision/script_manager.h | 7 ++-- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 168a6d830a56..cebb57a7869d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -72,22 +72,32 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre trimCommentsAndWhiteSpace(&line); while (!line.contains('}')) { - if (line.matchString("criteria {", true)) - puzzle.criteriaList.push_back(parseCriteria(stream)); - else if (line.matchString("results {", true)) - parseResult(stream, puzzle.resultActions); - else if (line.matchString("flags {", true)) + if (line.matchString("criteria {", true)) { + Criteria criteria; + if (parseCriteria(&criteria, stream)) { + puzzle.criteriaList.push_back(criteria); + } + } else if (line.matchString("results {", true)) { + parseResults(stream, puzzle.resultActions); + } else if (line.matchString("flags {", true)) { puzzle.flags = parseFlags(stream); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); } } -Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const { - Criteria criteria; - +bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream &stream) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); + // Criteria can be empty + if (line.contains('}')) { + return false; + } + while (!line.contains('}')) { // Split the string into tokens using ' ' as a delimiter Common::StringTokenizer tokenizer(line); @@ -95,35 +105,35 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const // Parse the id out of the first token token = tokenizer.nextToken(); - sscanf(token.c_str(), "[%u]", &(criteria.key)); + sscanf(token.c_str(), "[%u]", &(criteria->key)); // Parse the operator out of the second token token = tokenizer.nextToken(); if (token.c_str()[0] == '=') - criteria.criteriaOperator = EQUAL_TO; + criteria->criteriaOperator = EQUAL_TO; else if (token.c_str()[0] == '!') - criteria.criteriaOperator = NOT_EQUAL_TO; + criteria->criteriaOperator = NOT_EQUAL_TO; else if (token.c_str()[0] == '>') - criteria.criteriaOperator = GREATER_THAN; + criteria->criteriaOperator = GREATER_THAN; else if (token.c_str()[0] == '<') - criteria.criteriaOperator = LESS_THAN; + criteria->criteriaOperator = LESS_THAN; // First determine if the last token is an id or a value // Then parse it into 'argument' token = tokenizer.nextToken(); if (token.contains('[')) { - sscanf(token.c_str(), "[%u]", &(criteria.argument)); - criteria.argumentIsAKey = true; + sscanf(token.c_str(), "[%u]", &(criteria->argument)); + criteria->argumentIsAKey = true; } else { - sscanf(token.c_str(), "%u", &(criteria.argument)); - criteria.argumentIsAKey = false; + sscanf(token.c_str(), "%u", &(criteria->argument)); + criteria->argumentIsAKey = false; } line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } - return criteria; + return true; } void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 2d9bcc3fd553..ec16477b92cc 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -97,10 +97,11 @@ class ScriptManager { * Parses the stream into a Criteria object * Helper method for parsePuzzle. * - * @param stream Scr file stream - * @return Created Criteria object + * @param criteria Pointer to the Criteria object to fill + * @param stream Scr file stream + * @return Whether any criteria were read */ - Criteria parseCriteria(Common::SeekableReadStream &stream) const; + bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream &stream) const; /** * Parses the stream into a Results object From c22c91b7d3056fdbb100b3b0fd6bda1aa8626b79 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:50:36 -0500 Subject: [PATCH 0380/1332] ZVISION: Create Control class --- engines/zvision/control.cpp | 101 ++++++++++++++++++++++++++++++++++++ engines/zvision/control.h | 20 ++++++- 2 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 engines/zvision/control.cpp diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp new file mode 100644 index 000000000000..59ef14eb0796 --- /dev/null +++ b/engines/zvision/control.cpp @@ -0,0 +1,101 @@ +/* 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/scummsys.h" + +#include "common/stream.h" + +#include "zvision/zvision.h" +#include "zvision/render_manager.h" +#include "zvision/render_table.h" +#include "zvision/control.h" +#include "zvision/utility.h" + +namespace ZVision { + +void Control::parseFlatControl(ZVision *engine) { + engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT); +} + +void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream) { + RenderTable *renderTable = engine->getRenderManager()->getRenderTable(); + renderTable->setRenderState(RenderTable::PANORAMA); + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!line.contains('}')) { + if (line.matchString("angle*", true)) { + float fov; + sscanf(line.c_str(), "angle(%f)", &fov); + renderTable->setPanoramaFoV(fov); + } else if (line.matchString("linscale*", true)) { + float scale; + sscanf(line.c_str(), "angle(%f)", &scale); + renderTable->setPanoramaScale(scale); + } else if (line.matchString("reversepana*", true)) { + byte reverse; + sscanf(line.c_str(), "reversepana(%hhu)", &reverse); + if (reverse == 1) { + renderTable->setPanoramaReverse(true); + } + } else if (line.matchString("zeropoint*", true)) { + // TODO: Implement + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } +} + +void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream) { + RenderTable *renderTable = engine->getRenderManager()->getRenderTable(); + renderTable->setRenderState(RenderTable::TILT); + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!line.contains('}')) { + if (line.matchString("angle*", true)) { + float fov; + sscanf(line.c_str(), "angle(%f)", &fov); + renderTable->setTiltFoV(fov); + } else if (line.matchString("linscale*", true)) { + float scale; + sscanf(line.c_str(), "angle(%f)", &scale); + renderTable->setTiltScale(scale); + } else if (line.matchString("reversepana*", true)) { + byte reverse; + sscanf(line.c_str(), "reversepana(%hhu)", &reverse); + if (reverse == 1) { + renderTable->setTiltReverse(true); + } + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 1f59478b4cdb..edc0fc29302d 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -25,11 +25,27 @@ #include "common/types.h" +namespace Common { +class SeekableReadStream; +} + namespace ZVision { -struct Control { - uint16 id; +class ZVision; + +class Control { +public: + virtual ~Control() {} + virtual bool execute(ZVision *engine) = 0; + +protected: + uint32 key; +// Static member functions +public: + static void parseFlatControl(ZVision *engine); + static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream); + static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); }; } // End of namespace ZVision From 48a3a1530db615baf2388eb16118facb79f0a28a Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:52:27 -0500 Subject: [PATCH 0381/1332] ZVISION: Move the criteriaMet bool outside of the loop Only fire off the Results of ALL of the criteria are met --- engines/zvision/script_manager.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 7fcf2f67a3f9..85c900bc0ee6 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -77,10 +77,10 @@ void ScriptManager::updateNodes(uint32 deltaTimeMillis) { void ScriptManager::checkPuzzleCriteria() { while (!_puzzlesToCheck.empty()) { Puzzle *puzzle = _puzzlesToCheck.pop(); + // Check each Criteria + bool criteriaMet = false; for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { - bool criteriaMet = false; - // Get the value to compare against byte argumentValue; if ((*iter).argument) @@ -104,11 +104,16 @@ void ScriptManager::checkPuzzleCriteria() { break; } - // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) - if (criteriaMet) { - for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { - (*resultIter)->execute(_engine); - } + if (!criteriaMet) { + break; + } + } + + // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) + // criteriaList can be empty. Aka, the puzzle should be executed immediately + if (puzzle->criteriaList.empty() || criteriaMet) { + for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + (*resultIter)->execute(_engine); } } } From 2063cb711dce1894125d1cc6bab5a2d27a163be3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:53:24 -0500 Subject: [PATCH 0382/1332] ZVISION: Add 'reverse' to _tiltOptions and _panoramaOptions to handle Control options --- engines/zvision/render_table.cpp | 9 +++++++++ engines/zvision/render_table.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 49203df195dd..adf1d647b7f4 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -49,6 +49,7 @@ void RenderTable::setRenderState(RenderState newState) { case PANORAMA: _panoramaOptions.fieldOfView = 27.0f; _panoramaOptions.linearScale = 0.55f; + _panoramaOptions.reverse = false; break; case TILT: @@ -171,6 +172,10 @@ void RenderTable::setPanoramaScale(float scale) { _panoramaOptions.linearScale = scale; } +void RenderTable::setPanoramaReverse(bool reverse) { + _panoramaOptions.reverse = reverse; +} + void RenderTable::setTiltFoV(float fov) { assert(fov > 0.0f); @@ -183,4 +188,8 @@ void RenderTable::setTiltScale(float scale) { _tiltOptions.linearScale = scale; } +void RenderTable::setTiltReverse(bool reverse) { + _tiltOptions.reverse = reverse; +} + } // End of namespace ZVision diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index ccb5926a5160..e5535a054435 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -50,12 +50,14 @@ class RenderTable { struct { float fieldOfView; float linearScale; + bool reverse; } _panoramaOptions; // TODO: See if tilt and panorama need to have separate options struct { float fieldOfView; float linearScale; + bool reverse; } _tiltOptions; public: @@ -66,9 +68,11 @@ class RenderTable { void setPanoramaFoV(float fov); void setPanoramaScale(float scale); + void setPanoramaReverse(bool reverse); void setTiltFoV(float fov); void setTiltScale(float scale); + void setTiltReverse(bool reverse); private: void generatePanoramaLookupTable(); From d4ae293f881ae07afd243173ddd11d5b0cfa12b3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:54:10 -0500 Subject: [PATCH 0383/1332] ZVISION: Rename parseResult() to parseResults() --- engines/zvision/scr_file_handling.cpp | 2 +- engines/zvision/script_manager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index cebb57a7869d..ca66e3bccd90 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -136,7 +136,7 @@ bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream return true; } -void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const { +void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index ec16477b92cc..1b12a0693d42 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -110,7 +110,7 @@ class ScriptManager { * @param stream Scr file stream * @return Created Results object */ - void parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const; + void parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum From 070042fcb4ea473cd2bfbebf9838957cdb9150b8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:56:50 -0500 Subject: [PATCH 0384/1332] ZVISION: Modify Control parsing to use new Control class structure --- engines/zvision/scr_file_handling.cpp | 39 +++++++++++++++++++++------ engines/zvision/script_manager.h | 8 +++--- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index ca66e3bccd90..ec73fa1fdf3a 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -56,13 +56,11 @@ void ScriptManager::parseScrFile(Common::String fileName) { parsePuzzle(puzzle, file); _activePuzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { - Control control; - char controlType[20]; - sscanf(line.c_str(),"control:%u %s",&(control.id), controlType); - - parseControl(control, file); - /** Holds the currently active puzzles */ - _activeControls.push_back(control); + Control *control = parseControl(line, file); + // Some controls don't require nodes. They just initialize the scene + if (control != 0) { + _activeControls.push_back(control); + } } } } @@ -284,13 +282,38 @@ byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { } else if (line.matchString("DISABLED", true)) { flags |= DISABLED; } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); } return flags; } -void ScriptManager::parseControl(Control &control, Common::SeekableReadStream &stream) { +Control *ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream) { + Control *control = 0; + uint32 key; + char controlTypeBuffer[20]; + + sscanf(line.c_str(), "control:%u %s {", &key, controlTypeBuffer); + + Common::String controlType(controlTypeBuffer); + + if (controlType.equalsIgnoreCase("push_toggle")) { + + } else if (controlType.equalsIgnoreCase("flat")) { + Control::parseFlatControl(_engine); + return 0; + } else if (controlType.equalsIgnoreCase("pana")) { + Control::parsePanoramaControl(_engine, stream); + return 0; + } + else if (controlType.equalsIgnoreCase("tilt")) { + Control::parseTiltControl(_engine, stream); + return 0; + } + return control; } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 1b12a0693d42..8ffd3a0ad213 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -60,7 +60,7 @@ class ScriptManager { /** Holds the currently active puzzles */ Common::List _activePuzzles; /** Holds the currently active controls */ - Common::List _activeControls; + Common::List _activeControls; public: @@ -123,10 +123,10 @@ class ScriptManager { /** * Helper method for parseScrFile. Parses the stream into a Control object * - * @param control The object to store what is parsed - * @param stream Scr file stream + * @param line The line initially read + * @param stream Scr file stream */ - void parseControl(Control &control, Common::SeekableReadStream &stream); + Control *parseControl(Common::String &line, Common::SeekableReadStream &stream); }; From 00eb2792438f118775546011d2f1abdc9b0bc0cd Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:57:45 -0500 Subject: [PATCH 0385/1332] ZVISION: Create ScriptManager member function to change location --- engines/zvision/actions.cpp | 2 +- engines/zvision/actions.h | 3 ++- engines/zvision/script_manager.cpp | 24 ++++++++++++++++++++++++ engines/zvision/script_manager.h | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 35e5d4886d41..0cec6af76e34 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -88,7 +88,7 @@ bool ActionAttenuate::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionChangeLocation::ActionChangeLocation(Common::String *line) { - sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x); + sscanf(line->c_str(), ":change_location(%c,%c,%c%c,%hu)", &_world, &_room, &_node, &_view, &_x); } ResultAction *ActionChangeLocation::clone() const { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 75cffab59bf6..83f871d4e7b8 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -113,7 +113,8 @@ class ActionChangeLocation : public ResultAction { private: char _world; char _room; - char _nodeview[2]; + char _node; + char _view; int16 _x; }; diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 85c900bc0ee6..97f2cadfcefa 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -136,4 +136,28 @@ void ScriptManager::addActionNode(ActionNode *node) { _activeNodes.push_back(node); } +void ScriptManager::changeLocation(char world, char room, char node, char view, uint16 x) { + // Clear all the containers + _referenceTable.clear(); + _puzzlesToCheck.clear(); + _activePuzzles.clear(); + // _activeControls is a list of pointers to the heap, so we have to delete the Controls before we call clear() + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + delete (*iter); + } + _activeControls.clear(); + + // Parse into puzzles and controls + Common::String fileName = Common::String::format("%c%c%c&c.scr", world, room, node, view); + parseScrFile(fileName); + + // Create the puzzle reference table + createReferenceTable(); + + // Add all the puzzles to the stack to be checked + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + _puzzlesToCheck.push(&(*iter)); + } +} + } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 8ffd3a0ad213..caec0dd5508d 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -74,6 +74,8 @@ class ScriptManager { void addActionNode(ActionNode *node); + void changeLocation(char world, char room, char node, char view, uint16 x); + private: void createReferenceTable(); From ea47c28ddf20e366d43317ca273e84db0acd32db Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 22:10:59 -0500 Subject: [PATCH 0386/1332] ZVISION: Make ActionNode::process() pure virtual --- engines/zvision/action_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index cd5c9f3b273a..324dba279dea 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -32,7 +32,7 @@ class ZVision; class ActionNode { public: virtual ~ActionNode() {} - virtual bool process(ZVision *engine, uint32 deltaTimeInMillis); + virtual bool process(ZVision *engine, uint32 deltaTimeInMillis) = 0; }; class NodeTimer : public ActionNode { From f975fbe52190ccc0ca1264d6aa63a897ad784f31 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 22:15:24 -0500 Subject: [PATCH 0387/1332] ZVISION: Move Puzzle logic into a .cpp file --- engines/zvision/puzzle.cpp | 46 ++++++++++++++++++++++++++++++++++++++ engines/zvision/puzzle.h | 19 ++-------------- 2 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 engines/zvision/puzzle.cpp diff --git a/engines/zvision/puzzle.cpp b/engines/zvision/puzzle.cpp new file mode 100644 index 000000000000..83999193992f --- /dev/null +++ b/engines/zvision/puzzle.cpp @@ -0,0 +1,46 @@ +/* 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/scummsys.h" + +#include "zvision/actions.h" +#include "zvision/puzzle.h" + +namespace ZVision { + +Puzzle::~Puzzle() { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + delete (*iter); + } +} + +Puzzle::Puzzle(const Puzzle &other) + : key(other.key), + criteriaList(other.criteriaList), + flags(flags) { + // We have to clone the ResultActions since they are on the heap + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + resultActions.push_back((*iter)->clone()); + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 08d8a5cfd7ef..a0c4e9d758bd 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -60,24 +60,9 @@ enum StateFlags { class Puzzle { public: - ~Puzzle() { - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - delete (*iter); - } - } - Puzzle() {} - - // Copy constructor - Puzzle(const Puzzle &other) - : key(other.key), - criteriaList(other.criteriaList), - flags(flags) { - // We have to clone the ResultActions since they are on the heap - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - resultActions.push_back((*iter)->clone()); - } - } + ~Puzzle(); + Puzzle(const Puzzle &other); uint32 key; Common::List criteriaList; From f39e1fdc43a97c0d06bfcda0e5c6dfdfb4e95ef7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 22:16:21 -0500 Subject: [PATCH 0388/1332] ZVISION: Move CriteriaOperator, Criteria, and StateFlag inside the Puzzle class --- engines/zvision/puzzle.h | 60 ++++++++++++++------------- engines/zvision/scr_file_handling.cpp | 18 ++++---- engines/zvision/script_manager.cpp | 12 +++--- engines/zvision/script_manager.h | 2 +- 4 files changed, 47 insertions(+), 45 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index a0c4e9d758bd..fba139c0a612 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -29,41 +29,43 @@ namespace ZVision { class ResultAction; -/** How criteria should be decided */ -enum CriteriaOperator { - EQUAL_TO, - NOT_EQUAL_TO, - GREATER_THAN, - LESS_THAN -}; - -/** Criteria for a Puzzle result to be fired */ -struct Criteria { - /** The key of a global state */ - uint32 key; - /** - * What we're comparing the value of the global state against - * This can either be a pure value or it can be the key of another global state - */ - uint32 argument; - /** How to do the comparison */ - CriteriaOperator criteriaOperator; - /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ - bool argumentIsAKey; -}; - -enum StateFlags { - ONCE_PER_INST = 0x01, - DO_ME_NOW = 0x02, - DISABLED = 0x04 -}; - class Puzzle { public: Puzzle() {} ~Puzzle(); Puzzle(const Puzzle &other); + +public: + /** How criteria should be decided */ + enum CriteriaOperator { + EQUAL_TO, + NOT_EQUAL_TO, + GREATER_THAN, + LESS_THAN + }; + + /** Criteria for a Puzzle result to be fired */ + struct Criteria { + /** The key of a global state */ + uint32 key; + /** + * What we're comparing the value of the global state against + * This can either be a pure value or it can be the key of another global state + */ + uint32 argument; + /** How to do the comparison */ + CriteriaOperator criteriaOperator; + /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ + bool argumentIsAKey; + }; + enum StateFlags { + ONCE_PER_INST = 0x01, + DO_ME_NOW = 0x02, + DISABLED = 0x04 + }; + +public: uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index ec73fa1fdf3a..5f2140d45a8c 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -71,7 +71,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre while (!line.contains('}')) { if (line.matchString("criteria {", true)) { - Criteria criteria; + Puzzle::Criteria criteria; if (parseCriteria(&criteria, stream)) { puzzle.criteriaList.push_back(criteria); } @@ -86,7 +86,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre } } -bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream &stream) const { +bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -108,13 +108,13 @@ bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream // Parse the operator out of the second token token = tokenizer.nextToken(); if (token.c_str()[0] == '=') - criteria->criteriaOperator = EQUAL_TO; + criteria->criteriaOperator = Puzzle::EQUAL_TO; else if (token.c_str()[0] == '!') - criteria->criteriaOperator = NOT_EQUAL_TO; + criteria->criteriaOperator = Puzzle::NOT_EQUAL_TO; else if (token.c_str()[0] == '>') - criteria->criteriaOperator = GREATER_THAN; + criteria->criteriaOperator = Puzzle::GREATER_THAN; else if (token.c_str()[0] == '<') - criteria->criteriaOperator = LESS_THAN; + criteria->criteriaOperator = Puzzle::LESS_THAN; // First determine if the last token is an id or a value // Then parse it into 'argument' @@ -276,11 +276,11 @@ byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { while (!line.contains('}')) { if (line.matchString("ONCE_PER_INST", true)) { - flags |= ONCE_PER_INST; + flags |= Puzzle::ONCE_PER_INST; } else if (line.matchString("DO_ME_NOW", true)) { - flags |= DO_ME_NOW; + flags |= Puzzle::DO_ME_NOW; } else if (line.matchString("DISABLED", true)) { - flags |= DISABLED; + flags |= Puzzle::DISABLED; } line = stream.readLine(); diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 97f2cadfcefa..0ff050973759 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -45,7 +45,7 @@ void ScriptManager::createReferenceTable() { Puzzle *puzzlePtr = &(*activePuzzleIter); // Iterate through each Criteria and add a reference from the criteria key to the Puzzle - for (Common::List::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { + for (Common::List::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { _referenceTable[criteriaIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well @@ -80,7 +80,7 @@ void ScriptManager::checkPuzzleCriteria() { // Check each Criteria bool criteriaMet = false; - for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { + for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { // Get the value to compare against byte argumentValue; if ((*iter).argument) @@ -90,16 +90,16 @@ void ScriptManager::checkPuzzleCriteria() { // Do the comparison switch ((*iter).criteriaOperator) { - case EQUAL_TO: + case Puzzle::EQUAL_TO: criteriaMet = getStateValue(iter->key) == argumentValue; break; - case NOT_EQUAL_TO: + case Puzzle::NOT_EQUAL_TO: criteriaMet = getStateValue(iter->key) != argumentValue; break; - case GREATER_THAN: + case Puzzle::GREATER_THAN: criteriaMet = getStateValue(iter->key) > argumentValue; break; - case LESS_THAN: + case Puzzle::LESS_THAN: criteriaMet = getStateValue(iter->key) < argumentValue; break; } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index caec0dd5508d..3e054ff68aa5 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -103,7 +103,7 @@ class ScriptManager { * @param stream Scr file stream * @return Whether any criteria were read */ - bool ScriptManager::parseCriteria(Criteria *criteria, Common::SeekableReadStream &stream) const; + bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const; /** * Parses the stream into a Results object From 89d8496dbac2fb1fc5fc77d5b26fa2a9405f9d77 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 30 Jul 2013 12:56:21 +0300 Subject: [PATCH 0389/1332] ZVISION: Add detection entry and directories for ZGI --- engines/zvision/detection.cpp | 14 ++++++++++++++ engines/zvision/zvision.cpp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 8c87c9020381..a799cc2aeb98 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -71,6 +71,20 @@ static const ZVisionGameDescription gameDescriptions[] = { ZorkNemesis }, + { + // Zork Grand Inquisitor English version + { + "zgi", + 0, + AD_ENTRY1s("SCRIPTS.ZFS", "81efd40ecc3d22531e211368b779f17f", 8336944), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + ZorkGrandInquisitor + }, + { AD_TABLE_END_MARKER } }; diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index b79ecb499346..fa91f8ca29f7 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -60,6 +60,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets1", 0, 2, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets2", 0, 2, true); SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); // Here is the right place to set up the engine specific debug channels From f1135292d0d714187b719988dba8d5a7d487fe94 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:25:31 -0500 Subject: [PATCH 0390/1332] ZVISION: Optimize integer type usages The general thought is int is faster than int16 or byte. So if you can afford the space, use it over int16 or byte. Also, only use int32 when you specifically need the 32 bits. --- engines/zvision/action_node.cpp | 2 +- engines/zvision/action_node.h | 2 +- engines/zvision/actions.cpp | 2 +- engines/zvision/actions.h | 32 +++++++++++++-------------- engines/zvision/control.cpp | 8 +++---- engines/zvision/events.cpp | 2 +- engines/zvision/lzss_read_stream.cpp | 6 ++--- engines/zvision/lzss_read_stream.h | 4 ++-- engines/zvision/puzzle.h | 2 +- engines/zvision/render_table.cpp | 14 ++++++------ engines/zvision/render_table.h | 4 ++-- engines/zvision/scr_file_handling.cpp | 4 ++-- engines/zvision/script_manager.cpp | 12 +++++----- engines/zvision/script_manager.h | 16 +++++++------- engines/zvision/utility.h | 2 +- engines/zvision/video.cpp | 14 ++++++------ engines/zvision/zork_raw.cpp | 4 ++-- engines/zvision/zork_raw.h | 4 ++-- engines/zvision/zvision.cpp | 2 +- engines/zvision/zvision.h | 2 +- 20 files changed, 69 insertions(+), 69 deletions(-) diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp index dec52d961598..1a51690b3f18 100644 --- a/engines/zvision/action_node.cpp +++ b/engines/zvision/action_node.cpp @@ -28,7 +28,7 @@ namespace ZVision { -NodeTimer::NodeTimer(uint32 key, uint32 timeInSeconds) +NodeTimer::NodeTimer(uint32 key, uint timeInSeconds) : _key(key), _timeLeft(timeInSeconds * 1000) {} bool NodeTimer::process(ZVision *engine, uint32 deltaTimeInMillis) { diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index 324dba279dea..5b4430c3a43c 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -37,7 +37,7 @@ class ActionNode { class NodeTimer : public ActionNode { public: - NodeTimer(uint32 key, uint32 timeInSeconds); + NodeTimer(uint32 key, uint timeInSeconds); /** * Decrement the timer by the delta time. If the timer is finished, set the status * in _globalState and let this node be deleted diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 0cec6af76e34..2e1334c38b8e 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -174,7 +174,7 @@ ResultAction *ActionRandom::clone() const { } bool ActionRandom::execute(ZVision *engine) { - uint32 randNumber = engine->getRandomSource()->getRandomNumber(_max); + uint randNumber = engine->getRandomSource()->getRandomNumber(_max); engine->getScriptManager()->setStateValue(_key, randNumber); return true; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 83f871d4e7b8..8380f1587a7d 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -79,7 +79,7 @@ class ActionAdd : public ResultAction { private: uint32 _key; - byte _value; + uint _value; }; class ActionAssign : public ResultAction { @@ -90,7 +90,7 @@ class ActionAssign : public ResultAction { private: uint32 _key; - byte _value; + uint _value; }; class ActionAttenuate : public ResultAction { @@ -101,7 +101,7 @@ class ActionAttenuate : public ResultAction { private: uint32 _key; - int16 _attenuation; + int _attenuation; }; class ActionChangeLocation : public ResultAction { @@ -115,7 +115,7 @@ class ActionChangeLocation : public ResultAction { char _room; char _node; char _view; - int16 _x; + uint32 _x; }; class ActionCrossfade : public ResultAction { @@ -127,11 +127,11 @@ class ActionCrossfade : public ResultAction { private: uint32 _keyOne; uint32 _keyTwo; - byte _oneStartVolume; - byte _twoStartVolume; - byte _oneEndVolume; - byte _twoEndVolume; - uint16 _timeInMillis; + uint _oneStartVolume; + uint _twoStartVolume; + uint _oneEndVolume; + uint _twoEndVolume; + uint _timeInMillis; }; class ActionDelayRender : public ResultAction { @@ -142,7 +142,7 @@ class ActionDelayRender : public ResultAction { private: // TODO: Check if this should actually be frames or if it should be milliseconds/seconds - byte framesToDelay; + uint32 framesToDelay; }; class ActionPlayAnimation : public ResultAction { @@ -160,8 +160,8 @@ class ActionPlayAnimation : public ResultAction { uint32 _height; uint32 _start; uint32 _end; - uint32 _mask; - byte _framerate; + uint _mask; + uint _framerate; bool _loop; }; @@ -174,8 +174,8 @@ class ActionPreloadAnimation : public ResultAction { private: uint32 _key; Common::String _fileName; - uint32 _mask; - byte _framerate; + uint _mask; + uint _framerate; }; // TODO: See if this exists in ZGI. It doesn't in ZNem @@ -193,7 +193,7 @@ class ActionRandom : public ResultAction { private: uint32 _key; - uint32 _max; + uint _max; }; class ActionTimer : public ResultAction { @@ -204,7 +204,7 @@ class ActionTimer : public ResultAction { private: uint32 _key; - uint32 _time; + uint _time; }; } // End of namespace ZVision diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 59ef14eb0796..af384cbf2f4b 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -54,8 +54,8 @@ void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream & sscanf(line.c_str(), "angle(%f)", &scale); renderTable->setPanoramaScale(scale); } else if (line.matchString("reversepana*", true)) { - byte reverse; - sscanf(line.c_str(), "reversepana(%hhu)", &reverse); + uint reverse; + sscanf(line.c_str(), "reversepana(%u)", &reverse); if (reverse == 1) { renderTable->setPanoramaReverse(true); } @@ -86,8 +86,8 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre sscanf(line.c_str(), "angle(%f)", &scale); renderTable->setTiltScale(scale); } else if (line.matchString("reversepana*", true)) { - byte reverse; - sscanf(line.c_str(), "reversepana(%hhu)", &reverse); + uint reverse; + sscanf(line.c_str(), "reversepana(%u)", &reverse); if (reverse == 1) { renderTable->setTiltReverse(true); } diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index a01ea74cd03c..e392d3c78ab3 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -87,7 +87,7 @@ void ZVision::onMouseMove(const Common::Point &pos) { } -void ZVision::onKeyDown(uint16 keyCode) { +void ZVision::onKeyDown(uint keyCode) { } diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index d169620a25d5..8518c8fff918 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -42,9 +42,9 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) byte flagbyte = _source->readByte(); if (_source->eos()) break; - byte mask = 1; + uint mask = 1; - for (uint32 i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { if ((flagbyte & mask) == mask) { byte data = _source->readByte(); @@ -70,7 +70,7 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) uint16 length = (high & 0xF) + 2; uint16 offset = low | ((high & 0xF0)<<4); - for(byte j = 0; j <= length; j++) + for(int j = 0; j <= length; j++) { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 081422072891..25bb66339e4b 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -49,8 +49,8 @@ class LzssReadStream : public Common::ReadStream { private: Common::SeekableReadStream *_source; - char _window[_blockSize]; - uint16 _windowCursor; + byte _window[BLOCK_SIZE]; + uint _windowCursor; bool _eosFlag; public: diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index fba139c0a612..c73a345c3ad4 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -70,7 +70,7 @@ class Puzzle { Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract Common::List resultActions; - byte flags; + uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable // The unique-ification is done by sorting, then iterating and removing duplicates diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index adf1d647b7f4..531114cdbe73 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -29,7 +29,7 @@ namespace ZVision { -RenderTable::RenderTable(uint32 numColumns, uint32 numRows) +RenderTable::RenderTable(uint numColumns, uint numRows) : _numRows(numRows), _numColumns(numColumns), _renderState(FLAT) { @@ -85,10 +85,10 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 i bool isTransposed = _renderState == RenderTable::PANORAMA || _renderState == RenderTable::TILT; for (int y = subRectangle.top; y < subRectangle.bottom; y++) { - uint32 normalizedY = y - subRectangle.top; + uint normalizedY = y - subRectangle.top; for (int x = subRectangle.left; x < subRectangle.right; x++) { - uint32 normalizedX = x - subRectangle.left; + uint normalizedX = x - subRectangle.left; uint32 index = (y + destRectangle.top) * _numColumns + (x + destRectangle.left); @@ -137,15 +137,15 @@ void RenderTable::generatePanoramaLookupTable() { float tanOverHalfHeight = tan(fovRadians) / halfHeight; // TODO: Change the algorithm to write a whole row at a time instead of a whole column at a time. AKA: for(y) { for(x) {}} instead of for(x) { for(y) {}} - for (uint32 x = 0; x < _numColumns; x++) { + for (uint x = 0; x < _numColumns; x++) { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) float temp = atan(tanOverHalfHeight * ((float)x - halfWidth + 0.01f)); - int32 newX = floor((halfHeightOverTan * _panoramaOptions.linearScale * temp) + halfWidth); + int32 newX = int32(floor((halfHeightOverTan * _panoramaOptions.linearScale * temp) + halfWidth)); float cosX = cos(temp); - for (uint32 y = 0; y < _numRows; y++) { - int32 newY = floor(halfHeight + (y - halfHeight) * cosX); + for (uint y = 0; y < _numRows; y++) { + int32 newY = int32(floor(halfHeight + ((float)y - halfHeight) * cosX)); uint32 index = y * _numColumns + x; diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index e5535a054435..82bea62769f8 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -32,7 +32,7 @@ namespace ZVision { class RenderTable { public: - RenderTable(uint32 numRows, uint32 numColumns); + RenderTable(uint numRows, uint numColumns); ~RenderTable(); public: @@ -43,7 +43,7 @@ class RenderTable { }; private: - uint32 _numColumns, _numRows; + uint _numColumns, _numRows; Vector2 *_internalBuffer; RenderState _renderState; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 5f2140d45a8c..fe78a82d8f96 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -267,8 +267,8 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis return; } -byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { - byte flags; +uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { + uint flags = 0; // Loop until we find the closing brace Common::String line = stream.readLine(); diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 0ff050973759..90bc202dacd6 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -60,7 +60,7 @@ void ScriptManager::createReferenceTable() { } } -void ScriptManager::updateNodes(uint32 deltaTimeMillis) { +void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted for (Common::List::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { if ((*iter)->process(_engine, deltaTimeMillis)) { @@ -82,7 +82,7 @@ void ScriptManager::checkPuzzleCriteria() { bool criteriaMet = false; for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { // Get the value to compare against - byte argumentValue; + uint argumentValue; if ((*iter).argument) argumentValue = getStateValue(iter->argument); else @@ -119,16 +119,16 @@ void ScriptManager::checkPuzzleCriteria() { } } -byte ScriptManager::getStateValue(uint32 key) { +uint ScriptManager::getStateValue(uint32 key) { return _globalState[key]; } // TODO: Add logic to check _referenceTable and add to _puzzlesToCheck if necessary -void ScriptManager::setStateValue(uint32 key, byte value) { +void ScriptManager::setStateValue(uint32 key, uint value) { _globalState[key] = value; } -void ScriptManager::addToStateValue(uint32 key, byte valueToAdd) { +void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) { _globalState[key] += valueToAdd; } @@ -136,7 +136,7 @@ void ScriptManager::addActionNode(ActionNode *node) { _activeNodes.push_back(node); } -void ScriptManager::changeLocation(char world, char room, char node, char view, uint16 x) { +void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 x) { // Clear all the containers _referenceTable.clear(); _puzzlesToCheck.clear(); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 3e054ff68aa5..e8a8324a5c69 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -50,7 +50,7 @@ class ScriptManager { * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a * particular state key are checked after the key is modified. */ - Common::HashMap _globalState; + Common::HashMap _globalState; /** Holds the currently active ActionNodes */ Common::List _activeNodes; /** References _globalState keys to Puzzles */ @@ -65,16 +65,16 @@ class ScriptManager { public: void initialize(); - void updateNodes(uint32 deltaTimeMillis); + void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); - byte getStateValue(uint32 key); - void setStateValue(uint32 key, byte value); - void addToStateValue(uint32 key, byte valueToAdd); + uint getStateValue(uint32 key); + void setStateValue(uint32 key, uint value); + void addToStateValue(uint32 key, uint valueToAdd); void addActionNode(ActionNode *node); - void changeLocation(char world, char room, char node, char view, uint16 x); + void changeLocation(char world, char room, char node, char view, uint32 x); private: void createReferenceTable(); @@ -118,9 +118,9 @@ class ScriptManager { * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum * * @param stream Scr file stream - * @return Bitwise or of all the flags set within the puzzle + * @return Bitwise OR of all the flags set within the puzzle */ - byte parseFlags(Common::SeekableReadStream &stream) const; + uint parseFlags(Common::SeekableReadStream &stream) const; /** * Helper method for parseScrFile. Parses the stream into a Control object diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 58a7ec3ab7dd..e68d0de4491f 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -70,7 +70,7 @@ template void removeDuplicateEntries(Common::Array *container) { Common::sort(container->front(), container->back()); - for (uint32 i = 0; i < container->size(); i++) { + for (int i = 0; i < container->size(); i++) { while (container[i] == container[i +1]) { container->remove_at(i + 1); } diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index caf43ae0b555..1ccf73697010 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -33,15 +33,15 @@ namespace ZVision { // Taken from SCI -void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel) { +void scale2x(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel) { assert(bytesPerPixel == 1 || bytesPerPixel == 2); - const int newWidth = srcWidth * 2; - const int pitch = newWidth * bytesPerPixel; + const uint32 newWidth = srcWidth * 2; + const uint32 pitch = newWidth * bytesPerPixel; const byte *srcPtr = src; if (bytesPerPixel == 1) { - for (int y = 0; y < srcHeight; y++) { - for (int x = 0; x < srcWidth; x++) { + for (uint32 y = 0; y < srcHeight; y++) { + for (uint32 x = 0; x < srcWidth; x++) { const byte color = *srcPtr++; dst[0] = color; dst[1] = color; @@ -52,8 +52,8 @@ void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte b dst += newWidth; } } else if (bytesPerPixel == 2) { - for (int y = 0; y < srcHeight; y++) { - for (int x = 0; x < srcWidth; x++) { + for (uint32 y = 0; y < srcHeight; y++) { + for (uint32 x = 0; x < srcWidth; x++) { const byte color = *srcPtr++; const byte color2 = *srcPtr++; dst[0] = color; diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 03a35e09abc1..742ba188ac89 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -73,10 +73,10 @@ RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag dis } int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { - uint32 bytesRead = 0; + int bytesRead = 0; // 0: Left, 1: Right - byte channel = 0; + uint channel = 0; while (bytesRead < numSamples) { byte encodedSample = _stream->readByte(); diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 6d25d197ee8e..4e40a5716af8 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -36,7 +36,7 @@ class ZVision; struct SoundParams { char identifier; - uint16 rate; + uint32 rate; bool stereo; bool packed; }; @@ -73,7 +73,7 @@ class RawZorkStream : public Audio::RewindableAudioStream { Audio::Timestamp _playtime; // Calculated total play time Common::DisposablePtr _stream; // Stream to read data from bool _endOfData; // Whether the stream end has been reached - byte _stereo; + uint _stereo; /** * Holds the frequency and index from the last sample diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index fa91f8ca29f7..ca43549f5027 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -117,7 +117,7 @@ Common::Error ZVision::run() { // Main loop uint32 currentTime = _system->getMillis(); uint32 lastTime = currentTime; - const uint32 desiredFrameTime = 33; // ~30 fps + const uint desiredFrameTime = 33; // ~30 fps while (!shouldQuit()) { processEvents(); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 2e6ec11a5360..9588623f5668 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -83,7 +83,7 @@ class ZVision : public Engine { void processEvents(); void onMouseDown(const Common::Point &pos); void onMouseMove(const Common::Point &pos); - void onKeyDown(uint16 keyCode); + void onKeyDown(uint keyCode); }; } // End of namespace ZVision From 5e442c363ee870b63b13c6325c07be04bfb28fab Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:28:47 -0500 Subject: [PATCH 0391/1332] ZVISION: Convert String pointers to const references --- engines/zvision/actions.cpp | 18 +++++++++--------- engines/zvision/actions.h | 22 +++++++++++----------- engines/zvision/scr_file_handling.cpp | 6 +++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 2e1334c38b8e..fda6e1b1126e 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,8 +33,8 @@ namespace ZVision { // ActionAdd ////////////////////////////////////////////////////////////////////////////// -ActionAdd::ActionAdd(Common::String *line) { sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value); +ActionAdd::ActionAdd(const Common::String &line) { } ResultAction *ActionAdd::clone() const { @@ -51,8 +51,8 @@ bool ActionAdd::execute(ZVision *engine) { // ActionAssign ////////////////////////////////////////////////////////////////////////////// -ActionAssign::ActionAssign(Common::String *line) { sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value); +ActionAssign::ActionAssign(const Common::String &line) { } ResultAction *ActionAssign::clone() const { @@ -69,8 +69,8 @@ bool ActionAssign::execute(ZVision *engine) { // ActionAttenuate ////////////////////////////////////////////////////////////////////////////// -ActionAttenuate::ActionAttenuate(Common::String *line) { sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation); +ActionAttenuate::ActionAttenuate(const Common::String &line) { } ResultAction *ActionAttenuate::clone() const { @@ -87,8 +87,8 @@ bool ActionAttenuate::execute(ZVision *engine) { // ActionChangeLocation ////////////////////////////////////////////////////////////////////////////// -ActionChangeLocation::ActionChangeLocation(Common::String *line) { sscanf(line->c_str(), ":change_location(%c,%c,%c%c,%hu)", &_world, &_room, &_node, &_view, &_x); +ActionChangeLocation::ActionChangeLocation(const Common::String &line) { } ResultAction *ActionChangeLocation::clone() const { @@ -105,9 +105,9 @@ bool ActionChangeLocation::execute(ZVision *engine) { // ActionCrossfade ////////////////////////////////////////////////////////////////////////////// -ActionCrossfade::ActionCrossfade(Common::String *line) { sscanf(line->c_str(), ":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)", +ActionCrossfade::ActionCrossfade(const Common::String &line) { &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } @@ -125,9 +125,9 @@ bool ActionCrossfade::execute(ZVision *engine) { // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) { // The two %*hhu are always 0 and dont seem to have a use sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); +ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) { } ResultAction *ActionPreloadAnimation::clone() const { @@ -144,10 +144,10 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { // ActionPlayAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPlayAnimation::ActionPlayAnimation(Common::String *line) { // The two %*hhu are always 0 and dont seem to have a use sscanf(line->c_str(), ":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)", +ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } @@ -165,8 +165,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) { // ActionRandom ////////////////////////////////////////////////////////////////////////////// -ActionRandom::ActionRandom(Common::String *line) { sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max); +ActionRandom::ActionRandom(const Common::String &line) { } ResultAction *ActionRandom::clone() const { @@ -184,8 +184,8 @@ bool ActionRandom::execute(ZVision *engine) { // ActionTimer ////////////////////////////////////////////////////////////////////////////// -ActionTimer::ActionTimer(Common::String *line) { sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time); +ActionTimer::ActionTimer(const Common::String &line) { } ResultAction *ActionTimer::clone() const { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 8380f1587a7d..e10a68869ad2 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -73,7 +73,7 @@ class ResultAction { class ActionAdd : public ResultAction { public: - ActionAdd(Common::String *line); + ActionAdd(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -84,7 +84,7 @@ class ActionAdd : public ResultAction { class ActionAssign : public ResultAction { public: - ActionAssign(Common::String *line); + ActionAssign(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -95,7 +95,7 @@ class ActionAssign : public ResultAction { class ActionAttenuate : public ResultAction { public: - ActionAttenuate(Common::String *line); + ActionAttenuate(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -106,7 +106,7 @@ class ActionAttenuate : public ResultAction { class ActionChangeLocation : public ResultAction { public: - ActionChangeLocation(Common::String *line); + ActionChangeLocation(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -120,7 +120,7 @@ class ActionChangeLocation : public ResultAction { class ActionCrossfade : public ResultAction { public: - ActionCrossfade(Common::String *line); + ActionCrossfade(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -136,7 +136,7 @@ class ActionCrossfade : public ResultAction { class ActionDelayRender : public ResultAction { public: - ActionDelayRender(Common::String *line); + ActionDelayRender(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -147,7 +147,7 @@ class ActionDelayRender : public ResultAction { class ActionPlayAnimation : public ResultAction { public: - ActionPlayAnimation(Common::String *line); + ActionPlayAnimation(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -167,7 +167,7 @@ class ActionPlayAnimation : public ResultAction { class ActionPreloadAnimation : public ResultAction { public: - ActionPreloadAnimation(Common::String *line); + ActionPreloadAnimation(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -181,13 +181,13 @@ class ActionPreloadAnimation : public ResultAction { // TODO: See if this exists in ZGI. It doesn't in ZNem //class ActionUnloadAnimation : public ResultAction { //public: -// ActionUnloadAnimation(Common::String *line); +// ActionUnloadAnimation(const Common::String &line); // bool execute(ZVision *engine); //}; class ActionRandom : public ResultAction { public: - ActionRandom(Common::String *line); + ActionRandom(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); @@ -198,7 +198,7 @@ class ActionRandom : public ResultAction { class ActionTimer : public ResultAction { public: - ActionTimer(Common::String *line); + ActionTimer(const Common::String &line); ResultAction *clone() const; bool execute(ZVision *engine); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index fe78a82d8f96..0bd28ec4a940 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -143,11 +143,11 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis while (!line.contains('}')) { // Parse for the action type if (line.matchString("*:add*", true)) { - actionList.push_back(new ActionAdd(&line)); + actionList.push_back(new ActionAdd(line)); } else if (line.matchString("*:animplay*", true)) { - actionList.push_back(new ActionPlayAnimation(&line)); + actionList.push_back(new ActionPlayAnimation(line)); } else if (line.matchString("*:animpreload*", true)) { - actionList.push_back(new ActionPreloadAnimation(&line)); + actionList.push_back(new ActionPreloadAnimation(line)); } else if (line.matchString("*:animunload*", true)) { From d06083aa9625c285454da562bb7397b7cbae8987 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:33:53 -0500 Subject: [PATCH 0392/1332] ZVISION: Convert sscanf formats to follow new int lengths --- engines/zvision/actions.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index fda6e1b1126e..689d5408bffa 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,8 +33,8 @@ namespace ZVision { // ActionAdd ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value); ActionAdd::ActionAdd(const Common::String &line) { + sscanf(line.c_str(), ":add(%u,%u)", &_key, &_value); } ResultAction *ActionAdd::clone() const { @@ -51,8 +51,8 @@ bool ActionAdd::execute(ZVision *engine) { // ActionAssign ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value); ActionAssign::ActionAssign(const Common::String &line) { + sscanf(line.c_str(), ":assign(%u, %u)", &_key, &_value); } ResultAction *ActionAssign::clone() const { @@ -69,8 +69,8 @@ bool ActionAssign::execute(ZVision *engine) { // ActionAttenuate ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation); ActionAttenuate::ActionAttenuate(const Common::String &line) { + sscanf(line.c_str(), ":assign(%u, %d)", &_key, &_attenuation); } ResultAction *ActionAttenuate::clone() const { @@ -87,8 +87,8 @@ bool ActionAttenuate::execute(ZVision *engine) { // ActionChangeLocation ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":change_location(%c,%c,%c%c,%hu)", &_world, &_room, &_node, &_view, &_x); ActionChangeLocation::ActionChangeLocation(const Common::String &line) { + sscanf(line.c_str(), ":change_location(%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_x); } ResultAction *ActionChangeLocation::clone() const { @@ -105,9 +105,9 @@ bool ActionChangeLocation::execute(ZVision *engine) { // ActionCrossfade ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), - ":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)", ActionCrossfade::ActionCrossfade(const Common::String &line) { + sscanf(line.c_str(), + ":crossfade(%u %u %u %u %u %u %u)", &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } @@ -125,9 +125,9 @@ bool ActionCrossfade::execute(ZVision *engine) { // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// - // The two %*hhu are always 0 and dont seem to have a use - sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate); ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) { + // The two %*u are always 0 and dont seem to have a use + sscanf(line.c_str(), ":animpreload:%u(%s %*u %*u %u %u)", &_key, &_fileName, &_mask, &_framerate); } ResultAction *ActionPreloadAnimation::clone() const { @@ -144,10 +144,10 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { // ActionPlayAnimation ////////////////////////////////////////////////////////////////////////////// - // The two %*hhu are always 0 and dont seem to have a use - sscanf(line->c_str(), - ":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)", ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { + // The two %*u are always 0 and dont seem to have a use + sscanf(line.c_str(), + ":animplay:%u(%s %u %u %u %u %u %u %u %*u %*u %u %u)", &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); } @@ -165,8 +165,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) { // ActionRandom ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max); ActionRandom::ActionRandom(const Common::String &line) { + sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); } ResultAction *ActionRandom::clone() const { @@ -184,8 +184,8 @@ bool ActionRandom::execute(ZVision *engine) { // ActionTimer ////////////////////////////////////////////////////////////////////////////// - sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time); ActionTimer::ActionTimer(const Common::String &line) { + sscanf(line.c_str(), ":timer:%u(%u)", &_key, &_time); } ResultAction *ActionTimer::clone() const { From 903e21b8aff563d50f591289eb454cd65bf09d5d Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:35:34 -0500 Subject: [PATCH 0393/1332] ZVISION: Initialize the iterator --- engines/zvision/script_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 90bc202dacd6..2f486c440ab5 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -55,7 +55,7 @@ void ScriptManager::createReferenceTable() { } // Remove duplicate entries - for (Common::HashMap >::iterator referenceTableIter; referenceTableIter != _referenceTable.end(); referenceTableIter++) { + for (Common::HashMap >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); referenceTableIter++) { removeDuplicateEntries(&(referenceTableIter->_value)); } } From 8ec0a90611560dcb29d0ceb8fc476408c0de4103 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:38:58 -0500 Subject: [PATCH 0394/1332] ZVISION: Convert _blockSize to an anonymous enum --- engines/zvision/lzss_read_stream.cpp | 2 +- engines/zvision/lzss_read_stream.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 8518c8fff918..03ab12d8be8d 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -32,7 +32,7 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) _windowCursor(0x0FEE), _eosFlag(false) { // Clear the window to null - memset(_window, 0, _blockSize); + memset(_window, 0, BLOCK_SIZE); } uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) { diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 25bb66339e4b..25a8b672222d 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -43,9 +43,10 @@ class LzssReadStream : public Common::ReadStream { */ LzssReadStream(Common::SeekableReadStream *source); -public: - static const uint32 _npos = 0xFFFFFFFFu; - static const uint16 _blockSize = 0x1000u; +private: + enum { + BLOCK_SIZE = 0x1000 + }; private: Common::SeekableReadStream *_source; From e170be4ea595459065b55c3e218418150c8a53e5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:39:17 -0500 Subject: [PATCH 0395/1332] ZVISION: Remove redundant class qualifier --- engines/zvision/script_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index e8a8324a5c69..07dd3d85864c 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -103,7 +103,7 @@ class ScriptManager { * @param stream Scr file stream * @return Whether any criteria were read */ - bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const; + bool parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const; /** * Parses the stream into a Results object From 87f2e9a894442bcd2e2e52aa775154045a9304dd Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 20:51:32 -0500 Subject: [PATCH 0396/1332] ZVISION: Update module.mk with current obj --- engines/zvision/module.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 3d672d96bcc2..f90bb156e69b 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -1,17 +1,21 @@ MODULE := engines/zvision MODULE_OBJS := \ + action_node.o \ actions.o \ console.o \ + control.o \ detection.o \ events.o \ - graphics.o \ - image.o \ lzss_read_stream.o \ + puzzle.o \ + render_manager.o \ + render_table.o \ scr_file_handling.o \ script_manager.o \ scripts.o \ single_value_container.o \ + utility.o \ video.o \ zvision.o \ zfs_archive.o \ From d43e1e97419fea23ec2952fd05052e09d71b8037 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 09:59:20 -0500 Subject: [PATCH 0397/1332] ZVISION: Add filename parsing for ActionPlayAnimation --- engines/zvision/actions.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 689d5408bffa..d1f5b93431c6 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -145,10 +145,14 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { + char fileName[25]; + // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), ":animplay:%u(%s %u %u %u %u %u %u %u %*u %*u %u %u)", - &_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); + &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); + + _fileName = Common::String(fileName); } ResultAction *ActionPlayAnimation::clone() const { From 8e3ffdece89d608620adfc182b487f683270cbbd Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 09:59:40 -0500 Subject: [PATCH 0398/1332] ZVISION: Initialize _needsScreenUpdate in RenderManager --- engines/zvision/render_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 10afe1f2013e..7edbf5203984 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -40,6 +40,7 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 _currentVideo(0), _scaledVideoFrameBuffer(0), + _needsScreenUpdate(false), _renderTable(width, height) { } From 4729641cf91eb1ac7528446fb922f5b18e2d46b3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 10:00:24 -0500 Subject: [PATCH 0399/1332] ZVISION: Fix typo in format string --- engines/zvision/script_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 2f486c440ab5..ad986d65689d 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -148,7 +148,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _activeControls.clear(); // Parse into puzzles and controls - Common::String fileName = Common::String::format("%c%c%c&c.scr", world, room, node, view); + Common::String fileName = Common::String::format("%c%c%c%c.scr", world, room, node, view); parseScrFile(fileName); // Create the puzzle reference table From 3df425004dda026f6989a0020f24bd380cfd34f2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 10:01:00 -0500 Subject: [PATCH 0400/1332] ZVISION: Remove superfluous comma --- engines/zvision/single_value_container.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/single_value_container.h b/engines/zvision/single_value_container.h index 593f11c73788..54677ff0a1e8 100644 --- a/engines/zvision/single_value_container.h +++ b/engines/zvision/single_value_container.h @@ -44,7 +44,7 @@ class SingleValueContainer { UINT32, FLOAT, DOUBLE, - STRING, + STRING }; // Constructors From 99ecc80e861c17ecb6f3bcc5e9e6c7b5dcb860a7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 10:01:21 -0500 Subject: [PATCH 0401/1332] ZVISION: Initialize iterator --- engines/zvision/utility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 2942a35c81cf..2e1ade663a08 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -174,8 +174,8 @@ void dumpEveryResultAction(const Common::String &destFile) { trimCommentsAndWhiteSpace(&line); } - for (Common::HashMap::iterator iter = fileAlreadyUsed.begin(); iter != fileAlreadyUsed.end(); ++iter) { - iter->_value = false; + for (Common::HashMap::iterator fileUsedIter = fileAlreadyUsed.begin(); fileUsedIter != fileAlreadyUsed.end(); ++fileUsedIter) { + fileUsedIter->_value = false; } } From cf453120168ebadacc49d29c8683658fe457963d Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 10:01:44 -0500 Subject: [PATCH 0402/1332] ZVISION: Fix unsigned/signed mismatch warning --- engines/zvision/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index e68d0de4491f..9cc0d1e4e162 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -70,7 +70,7 @@ template void removeDuplicateEntries(Common::Array *container) { Common::sort(container->front(), container->back()); - for (int i = 0; i < container->size(); i++) { + for (uint i = 0; i < container->size(); i++) { while (container[i] == container[i +1]) { container->remove_at(i + 1); } From 2faaf8488bb5bdace2c017b37f825bc38f41ef84 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 15:30:02 -0500 Subject: [PATCH 0403/1332] ZVISION: Convert ResultAction pointers to SharePtr This gets rid of the need for specific destruction as well as making the copy swap operations in the ScriptManger _referenceTable more efficient --- engines/zvision/module.mk | 1 - engines/zvision/puzzle.cpp | 46 --------------------------- engines/zvision/puzzle.h | 13 +++----- engines/zvision/scr_file_handling.cpp | 11 +++---- engines/zvision/script_manager.cpp | 2 +- engines/zvision/script_manager.h | 9 +++--- 6 files changed, 15 insertions(+), 67 deletions(-) delete mode 100644 engines/zvision/puzzle.cpp diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index f90bb156e69b..26cf4ee69619 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -8,7 +8,6 @@ MODULE_OBJS := \ detection.o \ events.o \ lzss_read_stream.o \ - puzzle.o \ render_manager.o \ render_table.o \ scr_file_handling.o \ diff --git a/engines/zvision/puzzle.cpp b/engines/zvision/puzzle.cpp deleted file mode 100644 index 83999193992f..000000000000 --- a/engines/zvision/puzzle.cpp +++ /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. -* -*/ - -#include "common/scummsys.h" - -#include "zvision/actions.h" -#include "zvision/puzzle.h" - -namespace ZVision { - -Puzzle::~Puzzle() { - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - delete (*iter); - } -} - -Puzzle::Puzzle(const Puzzle &other) - : key(other.key), - criteriaList(other.criteriaList), - flags(flags) { - // We have to clone the ResultActions since they are on the heap - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - resultActions.push_back((*iter)->clone()); - } -} - -} // End of namespace ZVision diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index c73a345c3ad4..5e060c009af0 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -23,19 +23,15 @@ #ifndef ZVISION_PUZZLE_H #define ZVISION_PUZZLE_H + #include "common/list.h" +#include "common/ptr.h" namespace ZVision { class ResultAction; -class Puzzle { -public: - Puzzle() {} - ~Puzzle(); - Puzzle(const Puzzle &other); - -public: +struct Puzzle { /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, @@ -65,11 +61,10 @@ class Puzzle { DISABLED = 0x04 }; -public: uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List resultActions; + Common::List> resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 0bd28ec4a940..860e77147d00 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -134,7 +134,7 @@ bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableRe return true; } -void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const { +void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::List > &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -143,14 +143,13 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis while (!line.contains('}')) { // Parse for the action type if (line.matchString("*:add*", true)) { - actionList.push_back(new ActionAdd(line)); + actionList.push_back(Common::SharedPtr(new ActionAdd(line))); } else if (line.matchString("*:animplay*", true)) { - actionList.push_back(new ActionPlayAnimation(line)); + actionList.push_back(Common::SharedPtr(new ActionPlayAnimation(line))); } else if (line.matchString("*:animpreload*", true)) { - actionList.push_back(new ActionPreloadAnimation(line)); + actionList.push_back(Common::SharedPtr(new ActionPreloadAnimation(line))); } else if (line.matchString("*:animunload*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionUnloadAnimation(line))); } else if (line.matchString("*:attenuate*", true)) { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index ad986d65689d..540971ad8beb 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -112,7 +112,7 @@ void ScriptManager::checkPuzzleCriteria() { // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) // criteriaList can be empty. Aka, the puzzle should be executed immediately if (puzzle->criteriaList.empty() || criteriaMet) { - for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + for (Common::List >::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { (*resultIter)->execute(_engine); } } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 07dd3d85864c..c43030d62bd5 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -106,13 +106,14 @@ class ScriptManager { bool parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const; /** - * Parses the stream into a Results object + * Parses the stream into a ResultAction objects * Helper method for parsePuzzle. * - * @param stream Scr file stream - * @return Created Results object + * @param stream Scr file stream + * @param actionList The list where the results will be added + * @return Created Results object */ - void parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const; + void parseResults(Common::SeekableReadStream &stream, Common::List > &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum From 93e4f4dbf7cb6868e790d877ba01678ba19a8fbb Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 15:31:35 -0500 Subject: [PATCH 0404/1332] ZVISION: Sort using iterators instead of the actual elements Also convert the argument to a reference instead of a pointer --- engines/zvision/script_manager.cpp | 2 +- engines/zvision/utility.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 540971ad8beb..cd4e174a7c18 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -56,7 +56,7 @@ void ScriptManager::createReferenceTable() { // Remove duplicate entries for (Common::HashMap >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); referenceTableIter++) { - removeDuplicateEntries(&(referenceTableIter->_value)); + removeDuplicateEntries(referenceTableIter->_value); } } diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 9cc0d1e4e162..8974809f9776 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -67,12 +67,12 @@ void dumpEveryResultAction(const Common::String &destFile); * @return */ template -void removeDuplicateEntries(Common::Array *container) { - Common::sort(container->front(), container->back()); +void removeDuplicateEntries(Common::Array &container) { + Common::sort(container.begin(), container.end()); - for (uint i = 0; i < container->size(); i++) { - while (container[i] == container[i +1]) { - container->remove_at(i + 1); + for (uint i = 0; i + 1 < container.size(); i++) { + while (container[i] == container[i + 1]) { + container.remove_at(i + 1); } } } From 44ee28c13f39328a4e5e0eca27ac0b5349fe1253 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:40:25 -0500 Subject: [PATCH 0405/1332] ZVISION: Remove ResultAction clone member function Puzzle now uses smart pointers so clone is no longer necessary --- engines/zvision/actions.cpp | 33 --------------------------------- engines/zvision/actions.h | 11 ----------- 2 files changed, 44 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index d1f5b93431c6..438cec7adc8d 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -37,10 +37,6 @@ ActionAdd::ActionAdd(const Common::String &line) { sscanf(line.c_str(), ":add(%u,%u)", &_key, &_value); } -ResultAction *ActionAdd::clone() const { - return new ActionAdd(*this); -} - bool ActionAdd::execute(ZVision *engine) { engine->getScriptManager()->addToStateValue(_key, _value); return true; @@ -55,10 +51,6 @@ ActionAssign::ActionAssign(const Common::String &line) { sscanf(line.c_str(), ":assign(%u, %u)", &_key, &_value); } -ResultAction *ActionAssign::clone() const { - return new ActionAssign(*this); -} - bool ActionAssign::execute(ZVision *engine) { engine->getScriptManager()->setStateValue(_key, _value); return true; @@ -73,10 +65,6 @@ ActionAttenuate::ActionAttenuate(const Common::String &line) { sscanf(line.c_str(), ":assign(%u, %d)", &_key, &_attenuation); } -ResultAction *ActionAttenuate::clone() const { - return new ActionAttenuate(*this); -} - bool ActionAttenuate::execute(ZVision *engine) { // TODO: Implement return true; @@ -91,10 +79,6 @@ ActionChangeLocation::ActionChangeLocation(const Common::String &line) { sscanf(line.c_str(), ":change_location(%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_x); } -ResultAction *ActionChangeLocation::clone() const { - return new ActionChangeLocation(*this); -} - bool ActionChangeLocation::execute(ZVision *engine) { // TODO: Implement return true; @@ -111,10 +95,6 @@ ActionCrossfade::ActionCrossfade(const Common::String &line) { &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } -ResultAction *ActionCrossfade::clone() const { - return new ActionCrossfade(*this); -} - bool ActionCrossfade::execute(ZVision *engine) { // TODO: Implement return true; @@ -128,10 +108,7 @@ bool ActionCrossfade::execute(ZVision *engine) { ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) { // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), ":animpreload:%u(%s %*u %*u %u %u)", &_key, &_fileName, &_mask, &_framerate); -} -ResultAction *ActionPreloadAnimation::clone() const { - return new ActionPreloadAnimation(*this); } bool ActionPreloadAnimation::execute(ZVision *engine) { @@ -155,10 +132,6 @@ ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { _fileName = Common::String(fileName); } -ResultAction *ActionPlayAnimation::clone() const { - return new ActionPlayAnimation(*this); -} - bool ActionPlayAnimation::execute(ZVision *engine) { // TODO: Implement return true; @@ -173,10 +146,6 @@ ActionRandom::ActionRandom(const Common::String &line) { sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); } -ResultAction *ActionRandom::clone() const { - return new ActionRandom(*this); -} - bool ActionRandom::execute(ZVision *engine) { uint randNumber = engine->getRandomSource()->getRandomNumber(_max); engine->getScriptManager()->setStateValue(_key, randNumber); @@ -192,8 +161,6 @@ ActionTimer::ActionTimer(const Common::String &line) { sscanf(line.c_str(), ":timer:%u(%u)", &_key, &_time); } -ResultAction *ActionTimer::clone() const { - return new ActionTimer(*this); } bool ActionTimer::execute(ZVision *engine) { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index e10a68869ad2..7ee51ad27985 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -35,7 +35,6 @@ class ZVision; class ResultAction { public: virtual ~ResultAction() {} - virtual ResultAction *clone() const = 0; virtual bool execute(ZVision *engine) = 0; }; @@ -74,7 +73,6 @@ class ResultAction { class ActionAdd : public ResultAction { public: ActionAdd(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -85,7 +83,6 @@ class ActionAdd : public ResultAction { class ActionAssign : public ResultAction { public: ActionAssign(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -96,7 +93,6 @@ class ActionAssign : public ResultAction { class ActionAttenuate : public ResultAction { public: ActionAttenuate(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -107,7 +103,6 @@ class ActionAttenuate : public ResultAction { class ActionChangeLocation : public ResultAction { public: ActionChangeLocation(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -121,7 +116,6 @@ class ActionChangeLocation : public ResultAction { class ActionCrossfade : public ResultAction { public: ActionCrossfade(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -137,7 +131,6 @@ class ActionCrossfade : public ResultAction { class ActionDelayRender : public ResultAction { public: ActionDelayRender(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -148,7 +141,6 @@ class ActionDelayRender : public ResultAction { class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -168,7 +160,6 @@ class ActionPlayAnimation : public ResultAction { class ActionPreloadAnimation : public ResultAction { public: ActionPreloadAnimation(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -188,7 +179,6 @@ class ActionPreloadAnimation : public ResultAction { class ActionRandom : public ResultAction { public: ActionRandom(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: @@ -199,7 +189,6 @@ class ActionRandom : public ResultAction { class ActionTimer : public ResultAction { public: ActionTimer(const Common::String &line); - ResultAction *clone() const; bool execute(ZVision *engine); private: From 87be3180c73c16af0609f9e734d499233d69784f Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:43:46 -0500 Subject: [PATCH 0406/1332] ZVISION: Fix sscanf formatting errors --- engines/zvision/actions.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 438cec7adc8d..a1ea96707bf6 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -34,7 +34,7 @@ namespace ZVision { ////////////////////////////////////////////////////////////////////////////// ActionAdd::ActionAdd(const Common::String &line) { - sscanf(line.c_str(), ":add(%u,%u)", &_key, &_value); + sscanf(line.c_str(), "%*[^(](%u,%u)", &_key, &_value); } bool ActionAdd::execute(ZVision *engine) { @@ -48,7 +48,7 @@ bool ActionAdd::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionAssign::ActionAssign(const Common::String &line) { - sscanf(line.c_str(), ":assign(%u, %u)", &_key, &_value); + sscanf(line.c_str(), "%*[^(](%u, %u)", &_key, &_value); } bool ActionAssign::execute(ZVision *engine) { @@ -62,7 +62,7 @@ bool ActionAssign::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionAttenuate::ActionAttenuate(const Common::String &line) { - sscanf(line.c_str(), ":assign(%u, %d)", &_key, &_attenuation); + sscanf(line.c_str(), "%*[^(](%u, %d)", &_key, &_attenuation); } bool ActionAttenuate::execute(ZVision *engine) { @@ -76,7 +76,7 @@ bool ActionAttenuate::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionChangeLocation::ActionChangeLocation(const Common::String &line) { - sscanf(line.c_str(), ":change_location(%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_x); + sscanf(line.c_str(), "%*[^(](%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_x); } bool ActionChangeLocation::execute(ZVision *engine) { @@ -91,7 +91,7 @@ bool ActionChangeLocation::execute(ZVision *engine) { ActionCrossfade::ActionCrossfade(const Common::String &line) { sscanf(line.c_str(), - ":crossfade(%u %u %u %u %u %u %u)", + "%*[^(](%u %u %u %u %u %u %u)", &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } @@ -106,9 +106,12 @@ bool ActionCrossfade::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) { + char fileName[25]; + // The two %*u are always 0 and dont seem to have a use - sscanf(line.c_str(), ":animpreload:%u(%s %*u %*u %u %u)", &_key, &_fileName, &_mask, &_framerate); + sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%25s %*u %*u %u %u)", &_key, fileName, &_mask, &_framerate); + _fileName = Common::String(fileName); } bool ActionPreloadAnimation::execute(ZVision *engine) { @@ -126,7 +129,7 @@ ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), - ":animplay:%u(%s %u %u %u %u %u %u %u %*u %*u %u %u)", + "%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)", &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); _fileName = Common::String(fileName); @@ -143,7 +146,7 @@ bool ActionPlayAnimation::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionRandom::ActionRandom(const Common::String &line) { - sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max); + sscanf(line.c_str(), "%*[^:]:%*[^:]:%u, %u)", &_key, &_max); } bool ActionRandom::execute(ZVision *engine) { @@ -158,9 +161,9 @@ bool ActionRandom::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionTimer::ActionTimer(const Common::String &line) { - sscanf(line.c_str(), ":timer:%u(%u)", &_key, &_time); } + sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%u)", &_key, &_time); } bool ActionTimer::execute(ZVision *engine) { From 8d5e92b935966fdae84182dd7e7845280fb38ad4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:44:29 -0500 Subject: [PATCH 0407/1332] ZVISION: Add console cmd for changing location --- engines/zvision/console.cpp | 13 +++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 14 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 3dad7af37605..aaf43c598f5a 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -29,6 +29,7 @@ #include "zvision/console.h" #include "zvision/zvision.h" +#include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" @@ -45,6 +46,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("generaterendertable", WRAP_METHOD(Console, cmdGenerateRenderTable)); DCmd_Register("setpanoramafov", WRAP_METHOD(Console, cmdSetPanoramaFoV)); DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); + DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -150,4 +152,15 @@ bool Console::cmdSetPanoramaScale(int argc, const char **argv) { return true; } +bool Console::cmdChangeLocation(int argc, const char **argv) { + if (argc != 6) { + DebugPrintf("Use changelocation to change your location"); + return true; + } + + _engine->getScriptManager()->changeLocation(*(argv[1]), *(argv[2]), *(argv[3]), *(argv[4]), atoi(argv[5])); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 7b1beeb304e9..d7d2ce904bc3 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -45,6 +45,7 @@ class Console : public GUI::Debugger { bool cmdGenerateRenderTable(int argc, const char **argv); bool cmdSetPanoramaFoV(int argc, const char **argv); bool cmdSetPanoramaScale(int argc, const char **argv); + bool cmdChangeLocation(int argc, const char **argv); }; } // End of namespace ZVision From 5ef19407b4b16943c33265df4dc388738e710522 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:48:42 -0500 Subject: [PATCH 0408/1332] ZVISION: Fix typo in panarama and tilt control parsing --- engines/zvision/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index af384cbf2f4b..986a7ae09369 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -51,7 +51,7 @@ void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream & renderTable->setPanoramaFoV(fov); } else if (line.matchString("linscale*", true)) { float scale; - sscanf(line.c_str(), "angle(%f)", &scale); + sscanf(line.c_str(), "linscale(%f)", &scale); renderTable->setPanoramaScale(scale); } else if (line.matchString("reversepana*", true)) { uint reverse; @@ -83,7 +83,7 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->setTiltFoV(fov); } else if (line.matchString("linscale*", true)) { float scale; - sscanf(line.c_str(), "angle(%f)", &scale); + sscanf(line.c_str(), "linscale(%f)", &scale); renderTable->setTiltScale(scale); } else if (line.matchString("reversepana*", true)) { uint reverse; From ebe83ed3909de75f401278afbf85a02c9a9ccf1a Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:49:21 -0500 Subject: [PATCH 0409/1332] ZVISION: Make panorama and tilt control generate the RenderTable after setting all the settings --- engines/zvision/control.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 986a7ae09369..fdb88c68e17a 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -66,6 +66,8 @@ void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream & line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } + + renderTable->generateRenderTable(); } void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream) { @@ -96,6 +98,8 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } + + renderTable->generateRenderTable(); } } // End of namespace ZVision From 47f10fe78426159f76abd585f4b40f3025e7473f Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 13:51:11 -0500 Subject: [PATCH 0410/1332] ZVISION: Overload renderImageToScreen to handle fileNames and ReadStreams --- engines/zvision/render_manager.cpp | 22 +++++++++++++--------- engines/zvision/render_manager.h | 12 ++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7edbf5203984..4fd1a8308800 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -63,14 +63,14 @@ void RenderManager::updateScreen(bool isConsoleActive) { void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { // Panoramas are transposed - // The actual data is transposed in the RenderTable lookup + // The actual data is transposed in mutateImage if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { uint32 temp = imageHeight; imageHeight = imageWidth; imageWidth = temp; } - // Check if we truly want a subRect of the image + // If subRect is empty, use the entire image if (subRectangle.isEmpty()) subRectangle = Common::Rect(imageWidth, imageHeight); @@ -107,19 +107,23 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d return; } + renderImageToScreen(file, destinationX, destinationY, subRectangle); +} + +void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; - fileType = file.readUint32BE(); + fileType = stream.readUint32BE(); // Check for TGZ files if (fileType == MKTAG('T', 'G', 'Z', '\0')) { // TGZ files have a header and then Bitmap data that is compressed with LZSS - uint32 decompressedSize = file.readSint32LE(); - uint32 imageWidth = file.readSint32LE(); - uint32 imageHeight = file.readSint32LE(); + uint32 decompressedSize = stream.readSint32LE(); + uint32 imageWidth = stream.readSint32LE(); + uint32 imageHeight = stream.readSint32LE(); - LzssReadStream stream(&file); + LzssReadStream stream(&stream); byte *buffer = new byte[decompressedSize]; stream.read(buffer, decompressedSize); @@ -129,11 +133,11 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d delete[] buffer; } else { // Reset the cursor - file.seek(0); + stream.seek(0); // Decode Graphics::TGADecoder tga; - if (!tga.loadStream(file)) { + if (!tga.loadStream(stream)) { warning("Error while reading TGA image"); return; } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 8b4d7e840b81..f9d1375ecf73 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -34,6 +34,7 @@ class OSystem; namespace Common { class String; +class SeekableReadStream; } namespace Video { @@ -89,6 +90,17 @@ class RenderManager { */ void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); + /** + * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. + * The image will be clipped to fit inside the window. + * + * @param stream Stream to read the image data from + * @param destinationX X position where the image should be put + * @param destinationY Y position where the image should be put + * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. + */ + void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); + RenderTable *getRenderTable(); bool needsScreenUpdate() { return _needsScreenUpdate; }; From 9e996c4fec6477395d98ddc670df8732db3d7f28 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 14:56:52 -0500 Subject: [PATCH 0411/1332] ZVISION: Convert _activeNodes and _activeControls to Lists of SharedPtr --- engines/zvision/scr_file_handling.cpp | 16 ++++++++-------- engines/zvision/script_manager.cpp | 13 ++++--------- engines/zvision/script_manager.h | 8 ++++---- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 860e77147d00..8c8c6c488a2a 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -56,9 +56,10 @@ void ScriptManager::parseScrFile(Common::String fileName) { parsePuzzle(puzzle, file); _activePuzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { - Control *control = parseControl(line, file); + Common::SharedPtr control; + // Some controls don't require nodes. They just initialize the scene - if (control != 0) { + if (parseControl(line, file, control)) { _activeControls.push_back(control); } } @@ -289,8 +290,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { return flags; } -Control *ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream) { - Control *control = 0; +bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr &control) { uint32 key; char controlTypeBuffer[20]; @@ -302,17 +302,17 @@ Control *ScriptManager::parseControl(Common::String &line, Common::SeekableReadS } else if (controlType.equalsIgnoreCase("flat")) { Control::parseFlatControl(_engine); - return 0; + return false; } else if (controlType.equalsIgnoreCase("pana")) { Control::parsePanoramaControl(_engine, stream); - return 0; + return false; } else if (controlType.equalsIgnoreCase("tilt")) { Control::parseTiltControl(_engine, stream); - return 0; + return false; } - return control; + return true; } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index cd4e174a7c18..55cd570467bb 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -62,12 +62,10 @@ void ScriptManager::createReferenceTable() { void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted - for (Common::List::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { + for (Common::List >::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { if ((*iter)->process(_engine, deltaTimeMillis)) { - // Remove the node from _activeNodes, then delete it - ActionNode *node = *iter; + // Remove the node from _activeNodes, the SharedPtr destructor will delete the actual ActionNode iter = _activeNodes.erase(iter); - delete node; } else { iter++; } @@ -132,7 +130,7 @@ void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) { _globalState[key] += valueToAdd; } -void ScriptManager::addActionNode(ActionNode *node) { +void ScriptManager::addActionNode(const Common::SharedPtr &node) { _activeNodes.push_back(node); } @@ -141,10 +139,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _referenceTable.clear(); _puzzlesToCheck.clear(); _activePuzzles.clear(); - // _activeControls is a list of pointers to the heap, so we have to delete the Controls before we call clear() - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { - delete (*iter); - } + // We can clear without deleting from the heap because we use SharedPtr _activeControls.clear(); // Parse into puzzles and controls diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index c43030d62bd5..88340313cc08 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -52,7 +52,7 @@ class ScriptManager { */ Common::HashMap _globalState; /** Holds the currently active ActionNodes */ - Common::List _activeNodes; + Common::List > _activeNodes; /** References _globalState keys to Puzzles */ Common::HashMap > _referenceTable; /** Holds the Puzzles that should be checked this frame */ @@ -60,7 +60,7 @@ class ScriptManager { /** Holds the currently active puzzles */ Common::List _activePuzzles; /** Holds the currently active controls */ - Common::List _activeControls; + Common::List > _activeControls; public: @@ -72,7 +72,7 @@ class ScriptManager { void setStateValue(uint32 key, uint value); void addToStateValue(uint32 key, uint valueToAdd); - void addActionNode(ActionNode *node); + void addActionNode(const Common::SharedPtr &node); void changeLocation(char world, char room, char node, char view, uint32 x); @@ -129,7 +129,7 @@ class ScriptManager { * @param line The line initially read * @param stream Scr file stream */ - Control *parseControl(Common::String &line, Common::SeekableReadStream &stream); + bool parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr &control); }; From 11118262e4d884a838ac8ce0f8d674948aac1d33 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 14:59:00 -0500 Subject: [PATCH 0412/1332] ZVISION: Add logic to check _referenceTable Puzzles every time a globalState is changed --- engines/zvision/script_manager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 55cd570467bb..2e57c18a3eb0 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -121,9 +121,14 @@ uint ScriptManager::getStateValue(uint32 key) { return _globalState[key]; } -// TODO: Add logic to check _referenceTable and add to _puzzlesToCheck if necessary void ScriptManager::setStateValue(uint32 key, uint value) { _globalState[key] = value; + + if (_referenceTable.contains(key)) { + for (Common::Array::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); iter++) { + _puzzlesToCheck.push((*iter)); + } + } } void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) { From 8bbc260b8642d08c049acb81546e82bc88100ee2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 15:00:15 -0500 Subject: [PATCH 0413/1332] ZVISION: Create RenderManager method to set the current background image --- engines/zvision/render_manager.cpp | 16 ++++++++++++++++ engines/zvision/render_manager.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 4fd1a8308800..b6163c83c12e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -24,6 +24,7 @@ #include "common/file.h" #include "common/system.h" +#include "common/stream.h" #include "engines/util.h" #include "graphics/decoders/tga.h" @@ -39,6 +40,7 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) _height(height), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 _currentVideo(0), + _currentBackground(0), _scaledVideoFrameBuffer(0), _needsScreenUpdate(false), _renderTable(width, height) { @@ -155,4 +157,18 @@ RenderTable *RenderManager::getRenderTable() { return &_renderTable; } +void RenderManager::setBackgroundImage(const Common::String &fileName) { + Common::File *file = new Common::File; + + if (!file->open(fileName)) { + warning("Could not open file %s", fileName.c_str()); + return; + } + + _currentBackground = file; + + // TODO: Check if all the panoramas are the same height. AKA: can we hardcode the vertical centering to 80px? + renderImageToScreen(*_currentBackground, 0, 80); +} + } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index f9d1375ecf73..fc2598ecf918 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -54,6 +54,8 @@ class RenderManager { const Graphics::PixelFormat _pixelFormat; RenderTable _renderTable; + Common::SeekableReadStream *_currentBackground; + Video::VideoDecoder *_currentVideo; byte *_scaledVideoFrameBuffer; @@ -101,6 +103,14 @@ class RenderManager { */ void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); + /** + * Sets the current background image to be used by the RenderManager and immediately + * blits it to the screen. (It won't show up until the end of the frame) + * + * @param fileName The name of the image file + */ + void setBackgroundImage(const Common::String &fileName); + RenderTable *getRenderTable(); bool needsScreenUpdate() { return _needsScreenUpdate; }; From 32b3363acddcc25fb2380fbb66df829832d5200d Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 15:00:58 -0500 Subject: [PATCH 0414/1332] ZVISION: Add ActionSetScreen --- engines/zvision/actions.cpp | 24 +++++++++++++++++++++--- engines/zvision/actions.h | 9 +++++++++ engines/zvision/scr_file_handling.cpp | 3 +-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index a1ea96707bf6..9a8dee0e32cb 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -25,6 +25,7 @@ #include "zvision/actions.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "zvision/render_manager.h" #include "zvision/action_node.h" namespace ZVision { @@ -157,17 +158,34 @@ bool ActionRandom::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// -// ActionTimer +// ActionSetScreen ////////////////////////////////////////////////////////////////////////////// -ActionTimer::ActionTimer(const Common::String &line) { +ActionSetScreen::ActionSetScreen(const Common::String &line) { + char fileName[25]; + sscanf(line.c_str(), "%*[^(](%25[^)])", fileName); + + _fileName = Common::String(fileName); } +bool ActionSetScreen::execute(ZVision *engine) { + RenderManager *renderManager = engine->getRenderManager(); + renderManager->setBackgroundImage(_fileName); + + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionTimer +////////////////////////////////////////////////////////////////////////////// + +ActionTimer::ActionTimer(const Common::String &line) { sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%u)", &_key, &_time); } bool ActionTimer::execute(ZVision *engine) { - engine->getScriptManager()->addActionNode(new NodeTimer(_key, _time)); + engine->getScriptManager()->addActionNode(Common::SharedPtr(new NodeTimer(_key, _time))); return true; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 7ee51ad27985..3922f92b4406 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -186,6 +186,15 @@ class ActionRandom : public ResultAction { uint _max; }; +class ActionSetScreen : public ResultAction { +public: + ActionSetScreen(const Common::String &line); + bool execute(ZVision *engine); + +private: + Common::String _fileName; +}; + class ActionTimer : public ResultAction { public: ActionTimer(const Common::String &line); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 8c8c6c488a2a..1dc8ee5d4ea2 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -233,8 +233,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:set_screen*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionSetScreen(line))); } else if (line.matchString("*:set_venus*", true)) { From d89a55d3deb703c23c6bb111c256a11ba17c5faf Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 15:01:25 -0500 Subject: [PATCH 0415/1332] ZVISION: Create class definitions for mutliple ResultAction children --- engines/zvision/actions.h | 66 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 3922f92b4406..46b31e9bed79 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -128,6 +128,14 @@ class ActionCrossfade : public ResultAction { uint _timeInMillis; }; +class ActionDebug : public ResultAction { +public: + ActionDebug(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + class ActionDelayRender : public ResultAction { public: ActionDelayRender(const Common::String &line); @@ -138,6 +146,54 @@ class ActionDelayRender : public ResultAction { uint32 framesToDelay; }; +class ActionDisableControl : public ResultAction { +public: + ActionDisableControl(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + +class ActionDisableVenus : public ResultAction { +public: + ActionDisableVenus(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + +class ActionDisplayMessage : public ResultAction { +public: + ActionDisplayMessage(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + +class ActionDissolve : public ResultAction { +public: + ActionDissolve(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + +class ActionDistort : public ResultAction { +public: + ActionDistort(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + +class ActionEnableControl : public ResultAction { +public: + ActionEnableControl(const Common::String &line); + bool execute(ZVision *engine); + +private: +}; + class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(const Common::String &line); @@ -170,11 +226,11 @@ class ActionPreloadAnimation : public ResultAction { }; // TODO: See if this exists in ZGI. It doesn't in ZNem -//class ActionUnloadAnimation : public ResultAction { -//public: -// ActionUnloadAnimation(const Common::String &line); -// bool execute(ZVision *engine); -//}; +class ActionUnloadAnimation : public ResultAction { +public: + ActionUnloadAnimation(const Common::String &line); + bool execute(ZVision *engine); +}; class ActionRandom : public ResultAction { public: From 3fd5a8ab5a626998a358282e3af7668f3bdd9403 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 17:24:44 -0500 Subject: [PATCH 0416/1332] ZVISION: Offset the RenderTable index by the normalized coords, not the subRect coords --- engines/zvision/render_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 531114cdbe73..55c11ec4ba8c 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -90,7 +90,7 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 i for (int x = subRectangle.left; x < subRectangle.right; x++) { uint normalizedX = x - subRectangle.left; - uint32 index = (y + destRectangle.top) * _numColumns + (x + destRectangle.left); + uint32 index = (normalizedY + destRectangle.top) * _numColumns + (normalizedX + destRectangle.left); // RenderTable only stores offsets from the original coordinates uint32 sourceYIndex = y + _internalBuffer[index].y; From c828074df9384b1e6eb3176d346ffc1b18dd2b11 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 3 Aug 2013 17:25:05 -0500 Subject: [PATCH 0417/1332] ZVISION: Remove extraneous comments --- engines/zvision/render_table.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 55c11ec4ba8c..b6598c12b2f4 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -150,8 +150,8 @@ void RenderTable::generatePanoramaLookupTable() { uint32 index = y * _numColumns + x; // Only store the x,y offsets instead of the absolute positions - _internalBuffer[index].x = newX - x; //pixel index - _internalBuffer[index].y = newY - y; //pixel index + _internalBuffer[index].x = newX - x; + _internalBuffer[index].y = newY - y; } } } From 1956ca280bdd6491fd595c1c8f8da9aee679984b Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 4 Aug 2013 21:48:11 +0200 Subject: [PATCH 0418/1332] AVALANCHE: Repair Logger::log_scrollchar(), cosmetic corrections in Scrolls and Timeout. --- engines/avalanche/logger2.cpp | 8 ++++---- engines/avalanche/scrolls2.h | 2 +- engines/avalanche/timeout2.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index ef94eb3522e7..24c6d55fe931 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -152,14 +152,14 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */ if (!_vm->_gyro->logging) return; - switch (x[1]) { - case '`': + switch (x[0]) { + case '\'': z = quote; break; /* Open quotes: "66" */ - case '"': + case '\"': z = unquote; break; /* Close quotes: "99" */ - case '\357': + case 239: z = copyright; break; /* Copyright sign. */ default: diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index a4f5c0991d89..6fa2be97d622 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -81,7 +81,7 @@ class Scrolls { - // Constants to replace the command characters from Pascal: + // Constants to replace the command characters from Pascal. // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers static const char kControlSpeechBubble = 2; // ^B diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 88277ef2f6e4..1574a95b3032 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -76,7 +76,7 @@ void Timeout::one_tick() { for (fv = 0; fv < 7; fv++) { if (times[fv].time_left > 0) { - times[fv].time_left --; + times[fv].time_left--; if (times[fv].time_left == 0) { switch (times[fv].then_where) { From 0a8f57721bdc2f907e2fb42083341f81fabd9dce Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 22:02:08 -0500 Subject: [PATCH 0419/1332] ZVISION: Create Clock class to handle deltaTime while pausing and unpausing the game --- engines/zvision/clock.cpp | 68 ++++++++++++++++++++++++++++++++++ engines/zvision/clock.h | 78 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 engines/zvision/clock.cpp create mode 100644 engines/zvision/clock.h diff --git a/engines/zvision/clock.cpp b/engines/zvision/clock.cpp new file mode 100644 index 000000000000..2324d395c3ce --- /dev/null +++ b/engines/zvision/clock.cpp @@ -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. + * + * + */ + +#include "common/scummsys.h" + +#include "common/system.h" + +#include "zvision/clock.h" + +namespace ZVision { + +Clock::Clock(OSystem *system) + : _system(system), + _lastTime(0), + _deltaTime(0), + _pausedTime(0), + _paused(false) { +} + +void Clock::update() { + uint32 currentTime = _system->getMillis(); + _deltaTime = currentTime - _lastTime - _pausedTime; + if (_deltaTime < 0) { + _deltaTime = 0; + } + + if (_paused) { + _pausedTime += _deltaTime; + } else if (_pausedTime > 0) { + _pausedTime = 0; + } + + _lastTime = currentTime; +} + +void Clock::start() { + if (_paused) { + _paused = false; + } +} + +void Clock::stop() { + if (!_paused) { + _paused = true; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/clock.h b/engines/zvision/clock.h new file mode 100644 index 000000000000..d17db6c25557 --- /dev/null +++ b/engines/zvision/clock.h @@ -0,0 +1,78 @@ +/* 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 ZVISION_CLOCK_H +#define ZVISION_CLOCK_H + +#include "common/types.h" + +class OSystem; + +namespace ZVision { + +/* Class for handling frame to frame deltaTime while keeping track of time pauses/un-pauses */ +class Clock { +public: + Clock(OSystem *system); + +private: + OSystem *_system; + uint32 _lastTime; + uint32 _deltaTime; + uint32 _pausedTime; + bool _paused; + +public: + /** + * Updates _deltaTime with the difference between the current time and + * when the last update() was called. + */ + void update(); + /** + * Get the delta time since the last frame. (The time between update() calls) + * + * @return Delta time since the last frame (in milliseconds) + */ + uint32 getDeltaTime() const { return _deltaTime; } + /** + * Get the time from the program starting to the last update() call + * + * @return Time from program start to last update() call (in milliseconds) + */ + uint32 getLastMeasuredTime() { return _lastTime; } + + /** + * Pause the clock. Any future delta times will take this pause into account. + * Has no effect if the clock is already paused. + */ + void start(); + /** + * Un-pause the clock. + * Has no effect if the clock is already un-paused. + */ + void stop(); +}; + +} // End of namespace ZVision + +#endif From a86a0832e08c777ef23f2ce97004963b301dd598 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 23:02:43 -0500 Subject: [PATCH 0420/1332] ZVISION: Create console method for dumping a file by name --- engines/zvision/console.cpp | 12 ++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index aaf43c598f5a..9c7d79a8f1aa 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -47,6 +47,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("setpanoramafov", WRAP_METHOD(Console, cmdSetPanoramaFoV)); DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); + DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -163,4 +164,15 @@ bool Console::cmdChangeLocation(int argc, const char **argv) { return true; } +bool Console::cmdDumpFile(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use dumpfile to dump a file"); + return true; + } + + writeFileContentsToFile(argv[1], argv[1]); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index d7d2ce904bc3..be3ebf10dcf5 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -46,6 +46,7 @@ class Console : public GUI::Debugger { bool cmdSetPanoramaFoV(int argc, const char **argv); bool cmdSetPanoramaScale(int argc, const char **argv); bool cmdChangeLocation(int argc, const char **argv); + bool cmdDumpFile(int argc, const char **argv); }; } // End of namespace ZVision From 7b9858d6b45ad4c02729445975518a48292c3658 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 23:10:27 -0500 Subject: [PATCH 0421/1332] ZVISION: Make video code blocking. The script system requires that all ResultAction::execute() block until they finish. The video system *was* 'asyncronous' in that you would just start a video and then run() would finish processing it. This code forces the video to complely finish before playVideo returns. The Clock object is used to keep track of deltaTime while the video is playing. --- engines/zvision/console.cpp | 6 +-- engines/zvision/events.cpp | 5 -- engines/zvision/render_manager.cpp | 13 ----- engines/zvision/render_manager.h | 24 --------- engines/zvision/video.cpp | 87 ++++++++++++++++++------------ engines/zvision/zvision.cpp | 31 ++++++----- engines/zvision/zvision.h | 22 +++++++- 7 files changed, 93 insertions(+), 95 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 9c7d79a8f1aa..6634e0bef468 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -69,9 +69,9 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { return true; } - Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); - if (videoDecoder && videoDecoder->loadFile(argv[1])) { - _engine->getRenderManager()->startVideo(videoDecoder); + ZorkAVIDecoder videoDecoder; + if (videoDecoder.loadFile(argv[1])) { + _engine->playVideo(videoDecoder); } return true; diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index e392d3c78ab3..508d2610aaea 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -61,11 +61,6 @@ void ZVision::processEvents() { if (_event.kbd.hasFlags(Common::KBD_CTRL)) quitGame(); break; - case Common::KEYCODE_ESCAPE: - if (_renderManager->isVideoPlaying()) - _renderManager->cancelVideo(); - - break; default: break; } diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b6163c83c12e..604c310689ea 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -38,25 +38,12 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) : _system(system), _width(width), _height(height), - _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 - _currentVideo(0), _currentBackground(0), - _scaledVideoFrameBuffer(0), _needsScreenUpdate(false), _renderTable(width, height) { } -/** - * Initialize graphics - */ -void RenderManager::initialize() { - initGraphics(_width, _height, true, &_pixelFormat); -} - void RenderManager::updateScreen(bool isConsoleActive) { - if (_currentVideo != 0) - continueVideo(); - if (_needsScreenUpdate || isConsoleActive) { _system->updateScreen(); _needsScreenUpdate = false; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index fc2598ecf918..9554e888d987 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -26,8 +26,6 @@ #include "common/types.h" #include "common/rect.h" -#include "graphics/pixelformat.h" - #include "zvision/render_table.h" class OSystem; @@ -51,7 +49,6 @@ class RenderManager { OSystem *_system; const int _width; const int _height; - const Graphics::PixelFormat _pixelFormat; RenderTable _renderTable; Common::SeekableReadStream *_currentBackground; @@ -65,22 +62,6 @@ class RenderManager { void initialize(); void updateScreen(bool isConsoleActive); - /** - * Start a video playing. It will also load the first frame of the video. - * - * @param videoDecoder The video to play - */ - void startVideo(Video::VideoDecoder *videoDecoder); - /** - * @return Is a video currently being played - */ - bool isVideoPlaying() { return _currentVideo == 0; } - /** - * Cancels a video prematurely. Any sound remaining in the queue will continue to play. - * The last frame of the video will remain on the screen until something else overwrites it - */ - void cancelVideo(); - /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the window. @@ -116,11 +97,6 @@ class RenderManager { bool needsScreenUpdate() { return _needsScreenUpdate; }; private: - /** - * Checks the time since the last video frame, and blits the next frame to the screen - */ - void continueVideo(); - void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle); }; diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 1ccf73697010..8550a6cfca65 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -27,7 +27,9 @@ #include "engines/util.h" #include "graphics/surface.h" +#include "zvision/clock.h" #include "zvision/render_manager.h" +#include "zvision/zvision.h" namespace ZVision { @@ -71,62 +73,77 @@ void scale2x(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, byte } } -void RenderManager::startVideo(Video::VideoDecoder *videoDecoder) { - if (!videoDecoder) - return; - - _currentVideo = videoDecoder; - +void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { + // Videos use a different pixel format Common::List formats; - formats.push_back(videoDecoder->getPixelFormat()); + formats.push_back(videoDecoder.getPixelFormat()); initGraphics(_width, _height, true, formats); - - _scaledVideoFrameBuffer = new byte[_currentVideo->getWidth() * _currentVideo->getHeight() * _currentVideo->getPixelFormat().bytesPerPixel * 4]; - - _currentVideo->start(); - // Load the first frame - continueVideo(); -} - -void RenderManager::continueVideo() { - byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; - uint16 origWidth = _currentVideo->getWidth(); - uint16 origHeight = _currentVideo->getHeight(); + byte bytesPerPixel = videoDecoder.getPixelFormat().bytesPerPixel; + uint16 origWidth = videoDecoder.getWidth(); + uint16 origHeight = videoDecoder.getHeight(); uint16 pitch = origWidth * bytesPerPixel; + + // Most videos are very small. Therefore we do a simple 2x scale bool shouldBeScaled = (origWidth * 2 <= 640 && origHeight * 2 <= 480); uint16 finalWidth = shouldBeScaled ? origWidth * 2 : origWidth; uint16 finalHeight = shouldBeScaled ? origHeight * 2 : origHeight; - uint16 x = (_system->getWidth() - finalWidth) / 2; - uint16 y = (_system->getHeight() - finalHeight) / 2; + byte *scaledVideoFrameBuffer = new byte[origHeight * pitch * 4]; + + uint16 x = (_width - finalWidth) / 2; + uint16 y = (_height - finalHeight) / 2; + + _clock->stop(); + videoDecoder.start(); + + // Only continue while the video is still playing + while (videoDecoder.isPlaying()) { + _clock->update(); + uint32 currentTime = _clock->getLastMeasuredTime(); + + // Check for engine quit and video stop key presses + while (_eventMan->pollEvent(_event)) { + switch (_event.type) { + case Common::EVENT_KEYDOWN: + switch (_event.kbd.keycode) { + case Common::KEYCODE_q: + if (_event.kbd.hasFlags(Common::KBD_CTRL)) + quitGame(); + break; + case Common::KEYCODE_SPACE: + videoDecoder.stop(); + break; + } + } + } - if (!_currentVideo->endOfVideo()) { - if (_currentVideo->needsUpdate()) { - const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); + if (videoDecoder.needsUpdate()) { + const Graphics::Surface *frame = videoDecoder.decodeNextFrame(); if (frame) { if (shouldBeScaled) { - scale2x((byte *)frame->pixels, _scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel); - _system->copyRectToScreen(_scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); + scale2x((byte *)frame->pixels, scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel); + _system->copyRectToScreen(scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); } else { _system->copyRectToScreen((byte *)frame->pixels, pitch, x, y, finalWidth, finalHeight); } - _needsScreenUpdate = true; + _system->updateScreen(); } } - } else { - cancelVideo(); + + // Calculate the frame delay based off a desired frame time + int delay = _desiredFrameTime - (currentTime - _system->getMillis()); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); } -} -void RenderManager::cancelVideo() { + _clock->stop(); + + // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); - delete _currentVideo; - _currentVideo = 0; - delete[] _scaledVideoFrameBuffer; - _scaledVideoFrameBuffer = 0; } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index ca43549f5027..0015c41499a4 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -31,11 +31,14 @@ #include "common/file.h" #include "engines/util.h" + +#include "audio/mixer.h" #include "zvision/zvision.h" #include "zvision/console.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" +#include "zvision/clock.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" @@ -47,7 +50,9 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _width(640), - _height(480) { + _height(480), + _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /*RGB 555*/ + _desiredFrameTime(33) /* ~30 fps */ { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). @@ -75,14 +80,19 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, _width, _height); + // Create clock + _clock = new Clock(_system); + debug("ZVision::ZVision"); } - + ZVision::~ZVision() { debug("ZVision::~ZVision"); // Dispose of resources delete _console; + delete _clock; + delete _renderManager; delete _scriptManager; delete _rnd; @@ -103,7 +113,7 @@ void ZVision::initialize() { SearchMan.add(name, archive); } - _renderManager->initialize(); + initGraphics(_width, _height, true, &_pixelFormat); _scriptManager->initialize(); @@ -115,25 +125,20 @@ Common::Error ZVision::run() { initialize(); // Main loop - uint32 currentTime = _system->getMillis(); - uint32 lastTime = currentTime; - const uint desiredFrameTime = 33; // ~30 fps - while (!shouldQuit()) { - processEvents(); + _clock->update(); + uint32 currentTime = _clock->getLastMeasuredTime(); - currentTime = _system->getMillis(); - uint32 deltaTime = currentTime - lastTime; - lastTime = currentTime; + processEvents(); - _scriptManager->updateNodes(deltaTime); + _scriptManager->updateNodes(_clock->getDeltaTime()); _scriptManager->checkPuzzleCriteria(); // Render a frame _renderManager->updateScreen(_console->isActive()); // Calculate the frame delay based off a desired frame time - int delay = desiredFrameTime - (currentTime - _system->getMillis()); + int delay = _desiredFrameTime - (currentTime - _system->getMillis()); // Ensure non-negative delay = delay < 0 ? 0 : delay; _system->delayMillis(delay); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 9588623f5668..459096a03b8b 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -29,16 +29,24 @@ #include "engines/engine.h" +#include "graphics/pixelformat.h" + #include "zvision/detection.h" #include "gui/debugger.h" - + + +namespace Video { +class VideoDecoder; +} + namespace ZVision { struct ZVisionGameDescription; class Console; class ScriptManager; class RenderManager; +class Clock; // our engine debug channels enum { @@ -58,25 +66,35 @@ class ZVision : public Engine { const ZVisionGameDescription *_gameDescription; const int _width; const int _height; + const Graphics::PixelFormat _pixelFormat; + + const uint _desiredFrameTime; // We need random numbers Common::RandomSource *_rnd; + // Managers ScriptManager *_scriptManager; RenderManager *_renderManager; + // Clock + Clock *_clock; + // To prevent allocation every time we process events Common::Event _event; public: uint32 getFeatures() const; Common::Language getLanguage() const; - virtual Common::Error run(); + Common::Error run(); + ScriptManager *getScriptManager() const; RenderManager *getRenderManager() const; Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; + void playVideo(Video::VideoDecoder &videoDecoder); + private: void initialize(); From c4dc3989a70939fd98f1d55dffb548e68f80adfb Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 23:53:40 -0500 Subject: [PATCH 0422/1332] ZVISION: Make the return from makeRawZorkStream more specific --- engines/zvision/zork_raw.cpp | 2 +- engines/zvision/zork_raw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 742ba188ac89..92f659203b30 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -155,7 +155,7 @@ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, DisposeAfterUse::YES); } -Audio::AudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) { +Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) { Common::File *file = new Common::File(); assert(file->open(filePath)); diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 4e40a5716af8..f19ffc16618d 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -126,7 +126,7 @@ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stre bool stereo, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); -Audio::AudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); +Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); } // End of namespace ZVision From ec7036469c57eecb7afb226cc3dd176fcc74c0cb Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 23:54:53 -0500 Subject: [PATCH 0423/1332] ZVISION: Make _clock a member variable instead of a pointer to the heap --- engines/zvision/video.cpp | 8 ++++---- engines/zvision/zvision.cpp | 13 +++++-------- engines/zvision/zvision.h | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 8550a6cfca65..51cccee63993 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -94,13 +94,13 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { uint16 x = (_width - finalWidth) / 2; uint16 y = (_height - finalHeight) / 2; - _clock->stop(); + _clock.stop(); videoDecoder.start(); // Only continue while the video is still playing while (videoDecoder.isPlaying()) { - _clock->update(); - uint32 currentTime = _clock->getLastMeasuredTime(); + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); // Check for engine quit and video stop key presses while (_eventMan->pollEvent(_event)) { @@ -140,7 +140,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { _system->delayMillis(delay); } - _clock->stop(); + _clock.stop(); // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0015c41499a4..f406b5e852ee 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -52,7 +52,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _width(640), _height(480), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /*RGB 555*/ - _desiredFrameTime(33) /* ~30 fps */ { + _desiredFrameTime(33), /* ~30 fps */ + _clock(_system) { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). @@ -80,9 +81,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, _width, _height); - // Create clock - _clock = new Clock(_system); - debug("ZVision::ZVision"); } @@ -91,7 +89,6 @@ ZVision::~ZVision() { // Dispose of resources delete _console; - delete _clock; delete _renderManager; delete _scriptManager; delete _rnd; @@ -126,12 +123,12 @@ Common::Error ZVision::run() { // Main loop while (!shouldQuit()) { - _clock->update(); - uint32 currentTime = _clock->getLastMeasuredTime(); + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); processEvents(); - _scriptManager->updateNodes(_clock->getDeltaTime()); + _scriptManager->updateNodes(_clock.getDeltaTime()); _scriptManager->checkPuzzleCriteria(); // Render a frame diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 459096a03b8b..3eff16e5f107 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -32,6 +32,7 @@ #include "graphics/pixelformat.h" #include "zvision/detection.h" +#include "zvision/clock.h" #include "gui/debugger.h" @@ -46,7 +47,6 @@ struct ZVisionGameDescription; class Console; class ScriptManager; class RenderManager; -class Clock; // our engine debug channels enum { @@ -78,7 +78,7 @@ class ZVision : public Engine { RenderManager *_renderManager; // Clock - Clock *_clock; + Clock _clock; // To prevent allocation every time we process events Common::Event _event; From 1d694dcb81604c20a8755f80d509eccb8904017e Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 4 Aug 2013 23:55:36 -0500 Subject: [PATCH 0424/1332] ZVISION: Add support for engine pausing from higher up (GMM, phone call, etc.) --- engines/zvision/zvision.cpp | 10 ++++++++++ engines/zvision/zvision.h | 1 + 2 files changed, 11 insertions(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index f406b5e852ee..aaf843fae290 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -144,6 +144,16 @@ Common::Error ZVision::run() { return Common::kNoError; } +void ZVision::pauseEngineIntern(bool pause) { + _mixer->pauseAll(pause); + + if (pause) { + _clock.stop(); + } else { + _clock.start(); + } +} + ScriptManager *ZVision::getScriptManager() const { return _scriptManager; } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 3eff16e5f107..990b6e8b93e6 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -87,6 +87,7 @@ class ZVision : public Engine { uint32 getFeatures() const; Common::Language getLanguage() const; Common::Error run(); + void pauseEngineIntern(bool pause); ScriptManager *getScriptManager() const; RenderManager *getRenderManager() const; From 4b0015b8e997e9ca95141216f2b24ee33df01055 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 00:00:21 -0500 Subject: [PATCH 0425/1332] ZVISION: Check if a key exists before returning _globalState value. operator[] creates a key value pair if it doesn't exist. So blindly returning a value without checking if the key exists could result in undefined behavior, depening on what the value is initialized to in its constructor --- engines/zvision/script_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 2e57c18a3eb0..7fcade22c173 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -118,7 +118,10 @@ void ScriptManager::checkPuzzleCriteria() { } uint ScriptManager::getStateValue(uint32 key) { - return _globalState[key]; + if (_globalState.contains(key)) + return _globalState[key]; + else + return 0; } void ScriptManager::setStateValue(uint32 key, uint value) { From 20c892092907e66c6c13d1598b973486ba2fc95c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 00:01:20 -0500 Subject: [PATCH 0426/1332] ZVISION: Pass the scr fileName as a const reference --- engines/zvision/scr_file_handling.cpp | 2 +- engines/zvision/script_manager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 1dc8ee5d4ea2..cd3cfe42696a 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -33,7 +33,7 @@ namespace ZVision { -void ScriptManager::parseScrFile(Common::String fileName) { +void ScriptManager::parseScrFile(const Common::String &fileName) { Common::File file; if (!file.open(fileName)) return; // File.open already throws a warning if the file doesn't exist, so there is no need to throw another diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 88340313cc08..484069b33520 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -84,7 +84,7 @@ class ScriptManager { * * @param fileName Name of the .scr file */ - void parseScrFile(Common::String fileName); + void parseScrFile(const Common::String &fileName); /** * Parses the stream into a Puzzle object From 6515e2d31bbbad55168b8b27142cdc50f366795d Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 00:14:20 -0500 Subject: [PATCH 0427/1332] ZVISION: Add ActionMusic --- engines/zvision/actions.cpp | 59 +++++++++++++++++++++++++++ engines/zvision/actions.h | 19 ++++++++- engines/zvision/scr_file_handling.cpp | 3 +- 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 9a8dee0e32cb..cd84a6b85ea5 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -22,11 +22,16 @@ #include "common/scummsys.h" +#include "common/file.h" + +#include "audio/decoders/wave.h" + #include "zvision/actions.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/action_node.h" +#include "zvision/zork_raw.h" namespace ZVision { @@ -102,6 +107,60 @@ bool ActionCrossfade::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionMusic +////////////////////////////////////////////////////////////////////////////// + +ActionMusic::ActionMusic(const Common::String &line) : _volume(255) { + uint type; + char fileNameBuffer[25]; + uint loop; + uint volume = 255; + + sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%u %25s %u %u)", &_key, &type, fileNameBuffer, &loop, &volume); + + // type 4 are midi sound effect files + if (type == 4) { + _soundType = Audio::Mixer::kSFXSoundType; + _fileName = Common::String::format("midi/%s/%u.wav", fileNameBuffer, loop); + _loop = false; + } else { + // TODO: See what the other types are so we can specify the correct Mixer::SoundType. In the meantime use kPlainSoundType + _soundType = Audio::Mixer::kPlainSoundType; + _fileName = Common::String(fileNameBuffer); + _loop = loop == 1 ? true : false; + } + + // Volume is optional. If it doesn't appear, assume full volume + if (volume != 255) { + // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] + _volume = volume * 255 / 100; + } +} + +bool ActionMusic::execute(ZVision *engine) { + Audio::RewindableAudioStream *audioStream; + + if (_fileName.contains(".wav")) { + Common::File file; + if (file.open(_fileName)) { + audioStream = Audio::makeWAVStream(&file, DisposeAfterUse::NO); + } + } else { + audioStream = makeRawZorkStream(_fileName, engine); + } + + if (_loop) { + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES); + engine->_mixer->playStream(_soundType, 0, loopingAudioStream, -1, _volume); + } else { + engine->_mixer->playStream(_soundType, 0, audioStream, -1, _volume); + } + + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 46b31e9bed79..76db25adf03f 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -25,7 +25,11 @@ #include "common/scummsys.h" -#include "common/str.h" +#include "audio/mixer.h" + +namespace Common { +class String; +} namespace ZVision { @@ -194,6 +198,19 @@ class ActionEnableControl : public ResultAction { private: }; +class ActionMusic : public ResultAction { +public: + ActionMusic(const Common::String &line); + bool execute(ZVision *engine); + +private: + uint32 _key; + Audio::Mixer::SoundType _soundType; + Common::String _fileName; + bool _loop; + byte _volume; +}; + class ActionPlayAnimation : public ResultAction { public: ActionPlayAnimation(const Common::String &line); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index cd3cfe42696a..9759fd89b139 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -200,8 +200,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:music*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionMusic(line))); } else if (line.matchString("*:pan_track*", true)) { From 65b5a2797b29dc4c0ca9a1bd2bd2e92083deb081 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 00:18:01 -0500 Subject: [PATCH 0428/1332] ZVISION: Fix index out of range error --- engines/zvision/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 8974809f9776..3348a43fe36e 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -71,7 +71,7 @@ void removeDuplicateEntries(Common::Array &container) { Common::sort(container.begin(), container.end()); for (uint i = 0; i + 1 < container.size(); i++) { - while (container[i] == container[i + 1]) { + while (i + 1 < container.size() && container[i] == container[i + 1]) { container.remove_at(i + 1); } } From 15f6ba8b2aa3883e47e07bdb131d9ed65a21ee5b Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 5 Aug 2013 12:19:10 +0200 Subject: [PATCH 0429/1332] AVALANCHE: Introduce _screen in Graphics. --- engines/avalanche/graphics.cpp | 15 +++++++-------- engines/avalanche/graphics.h | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 737147b7346a..677f5109d5bb 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -60,12 +60,15 @@ void Graphics::init() { _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); + + _screen.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); } Graphics::~Graphics() { _surface.free(); _magics.free(); _background.free(); + _screen.free(); } @@ -166,18 +169,14 @@ void Graphics::drawPicture(const ::Graphics::Surface &picture, uint16 destX, uin void Graphics::refreshScreen() { // These cycles are for doubling the screen height. - ::Graphics::Surface picture; - picture.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); - for (uint16 y = 0; y < picture.h / 2; y++) - for (uint16 x = 0; x < picture.w; x++) + for (uint16 y = 0; y < _screen.h / 2; y++) + for (uint16 x = 0; x < _screen.w; x++) for (byte j = 0; j < 2; j++) - *(byte *)picture.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); + *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); // Now we copy the stretched picture to the screen. - g_system->copyRectToScreen(picture.pixels, picture.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); + g_system->copyRectToScreen(_screen.pixels, _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); - - picture.free(); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index f1dbe4a0e081..d16b0c00464d 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -63,6 +63,8 @@ class Graphics { // Lucerna::draw_also_lines() draws the "magical" lines here. // Further information: https://github.com/urukgit/avalot/wiki/Also + ::Graphics::Surface _screen; + From ba00b2a7d9b08265023d3b478c24c44f43c2e33f Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 5 Aug 2013 15:25:44 +0200 Subject: [PATCH 0430/1332] AVALANCHE: Mostly cosmetic modifications in Visa, stub Timeout::arkata_shouts() until dixi() works, partially implement Scrolls::say(). --- engines/avalanche/scrolls2.cpp | 65 ++++++++++++++++++++++++++++++++-- engines/avalanche/timeout2.cpp | 3 +- engines/avalanche/visa2.cpp | 7 ++-- 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index bf039d6322d9..634ee1035d70 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -103,6 +103,67 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ + const byte locol = 2; + byte xx, yy, ox, bit, lz, t; + int16 yp; + bool offset; + byte itw[12][80]; + + offset = x % 8 == 4; + x = x / 8; + lz = z.size(); + ox = 0; + _vm->_logger->log_scrollline(); + + for (xx = 0; xx < lz; xx++) { + switch (z[xx]) { + case kControlRoman: { + cfont = roman; + _vm->_logger->log_roman(); + } + break; + case kControlItalic: { + cfont = italic; + _vm->_logger->log_italic(); + } + break; + default: { + for (yy = 0; yy < 12; yy ++) + itw[yy][ox] = ~ch[cfont][z[xx]][yy + 1]; + ox++; + _vm->_logger->log_scrollchar(Common::String(z[xx])); + } + } + } + + lz = ox; + if (offset) { + /* offsetting routine */ + for (yy = 0; yy < 12; yy++) { + bit = 240; + itw[yy][lz] = 255; + for (xx = 0; xx < lz; xx++) { + t = itw[yy][xx]; + itw[yy][xx] = bit + t / 16; + bit = t << 4; + } + } + lz++; + } + + /*yp = x + y * 80 + (1 - _vm->_gyro->cp) * _vm->_gyro->pagetop; + for (yy = 0; yy < 12; yy++) { + yp += 80; + for (bit = 0; bit <= locol; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(itw[yy], mem[0xa000 * yp], lz); + } + }*/ + + warning("STUB: Scrolls::say()"); } @@ -227,7 +288,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t byte b, groi; int16 lx, ly, mx, my, ex, ey; bool centre; - byte icon_indent; + byte icon_indent = 0; _vm->_gyro->off_virtual(); //setvisualpage(cp); @@ -456,7 +517,7 @@ void Scrolls::calldrivers() { } } - for (fv = 0; fv <= _vm->_gyro->bufsize; fv++) + for (fv = 0; fv < _vm->_gyro->bufsize; fv++) if (mouthnext) { if (_vm->_gyro->buffer[fv] == kControlRegister) param = 0; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 1574a95b3032..e23114dccb6d 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -607,7 +607,8 @@ void Timeout::arkata_shouts() { if (_vm->_gyro->dna.teetotal) return; - _vm->_visa->dixi('q', 76); + // _vm->_visa->dixi('q', 76); + warning("STUB: Timeout::arkata_shouts()"); set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 5938f523d865..e2f83d636dce 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -50,12 +50,12 @@ bool Visa::report_dixi_errors = true; void Visa::unskrimble() { for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) - _vm->_gyro->buffer[fv] = (char)((!(_vm->_gyro->buffer[fv]) - fv) % 256); + _vm->_gyro->buffer[fv] = (~(_vm->_gyro->buffer[fv]) - fv + 1) % 256; } void Visa::do_the_bubble() { _vm->_gyro->bufsize++; - _vm->_gyro->buffer[_vm->_gyro->bufsize] = 2; + _vm->_gyro->buffer[_vm->_gyro->bufsize - 1] = 2; } void Visa::dixi(char block, byte point) { @@ -101,7 +101,8 @@ void Visa::dixi(char block, byte point) { sezfile.close(); unskrimble(); - if (bubbling) do_the_bubble(); + if (bubbling) + do_the_bubble(); _vm->_scrolls->calldrivers(); } From cefb0253ae93dc97e73a83145e314caf7e5f2885 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 10:26:23 -0500 Subject: [PATCH 0431/1332] ZVISION: Change _pausedTime to be a reference to when time was paused, instead of accumulation of time --- engines/zvision/clock.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/zvision/clock.cpp b/engines/zvision/clock.cpp index 2324d395c3ce..fe322525f8b7 100644 --- a/engines/zvision/clock.cpp +++ b/engines/zvision/clock.cpp @@ -39,15 +39,14 @@ Clock::Clock(OSystem *system) void Clock::update() { uint32 currentTime = _system->getMillis(); - _deltaTime = currentTime - _lastTime - _pausedTime; - if (_deltaTime < 0) { - _deltaTime = 0; - } + _deltaTime = (currentTime - _lastTime); if (_paused) { - _pausedTime += _deltaTime; - } else if (_pausedTime > 0) { - _pausedTime = 0; + _deltaTime -= (currentTime - _pausedTime); + } + + if (_deltaTime < 0) { + _deltaTime = 0; } _lastTime = currentTime; @@ -55,12 +54,14 @@ void Clock::update() { void Clock::start() { if (_paused) { + _lastTime = _system->getMillis(); _paused = false; } } void Clock::stop() { if (!_paused) { + _pausedTime = _system->getMillis(); _paused = true; } } From 3f5cf500498970d2a8f71a9604db31ba00bb262e Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 10:27:00 -0500 Subject: [PATCH 0432/1332] ZVISION: Use videoDecoder.getTimeToNextFrame() to calculate the frame delay --- engines/zvision/video.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 51cccee63993..c476cf2d83d8 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -99,9 +99,6 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { // Only continue while the video is still playing while (videoDecoder.isPlaying()) { - _clock.update(); - uint32 currentTime = _clock.getLastMeasuredTime(); - // Check for engine quit and video stop key presses while (_eventMan->pollEvent(_event)) { switch (_event.type) { @@ -133,11 +130,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { } } - // Calculate the frame delay based off a desired frame time - int delay = _desiredFrameTime - (currentTime - _system->getMillis()); - // Ensure non-negative - delay = delay < 0 ? 0 : delay; - _system->delayMillis(delay); + _system->delayMillis(videoDecoder.getTimeToNextFrame()); } _clock.stop(); From a971cf3a3997dd71282c5566bb2f5ee062c190bf Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 5 Aug 2013 17:35:17 +0200 Subject: [PATCH 0433/1332] AVALANCHE: Implement Scrolls::say(). --- engines/avalanche/scrolls2.cpp | 69 ++++++++++++++++++++++++++++++++-- engines/avalanche/scrolls2.h | 1 + 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 634ee1035d70..4a62f2493676 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -129,7 +129,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit break; default: { for (yy = 0; yy < 12; yy ++) - itw[yy][ox] = ~ch[cfont][z[xx]][yy + 1]; + itw[yy][ox] = ~ch[cfont][z[xx]][yy + 2]; ox++; _vm->_logger->log_scrollchar(Common::String(z[xx])); } @@ -151,6 +151,18 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit lz++; } + y++; + for (byte fv = 0; fv < z.size(); fv++) + for (byte ff = 0; ff < 12; ff++) { + byte pixel = itw[ff][fv]; // Note that it's the bitwise NOT operator! + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); + // We don't have to bother with the planes, since they all have the same value. See the original. + // Note that it's the bitwise OR operator! + } + } + /*yp = x + y * 80 + (1 - _vm->_gyro->cp) * _vm->_gyro->pagetop; for (yy = 0; yy < 12; yy++) { yp += 80; @@ -162,14 +174,63 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit move(itw[yy], mem[0xa000 * yp], lz); } }*/ - - - warning("STUB: Scrolls::say()"); } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ void Scrolls::normscroll() { + Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; + Common::String e = "(c) 1994"; + char r; + bool oktoexit; + + state(3); + _vm->_gyro->seescroll = true; + _vm->_gyro->off_virtual(); + _vm->_gyro->on(); + _vm->_gyro->newpointer(4); + _vm->_lucerna->mousepage(1 - _vm->_gyro->cp); + + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); + +// do { +// do { +// _vm->_gyro->check(); /* was "checkclick;" */ +// +//#ifdef RECORD slowdown(); basher::count += 1; #endif +// +// if (_vm->_gyro->demo) { +// if (_vm->_basher->demo_ready()) +// break; +// if (_vm->_enhanced->keypressede()) +// return; +// } else if (_vm->_enhanced->keypressede()) +// break; +// } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); +// +// +// if (mrelease == 0) { +// inkey(); +// if (aboutscroll) { +// move(e[2 - 1], e[1 - 1], 7); +// e[8 - 1] = inchar; +// if (egg == e) easteregg(); +// } +// oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); +// if (! oktoexit) errorled(); +// } +// +// } while (!((oktoexit) || (mrelease > 0))); +// +//#ifdef RECORD record_one(); #endif +// + //_vm->_gyro->screturn = r == '#'; /* "back door" */ + state(0); + _vm->_gyro->seescroll = false; + _vm->_lucerna->mousepage(_vm->_gyro->cp); + _vm->_gyro->off(); + warning("STUB: Scrolls::normscroll()"); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 6fa2be97d622..b267ff68f675 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -89,6 +89,7 @@ class Scrolls { static const char kControlToBuffer = 4; // ^D static const char kControlItalic = 6; // ^F static const char kControlBell = 7; // ^G + static const char kControlBackspace = 8; // ^H static const char kControlInsertSpaces = 9; // ^I static const char kControlLeftJustified = 12; // ^L static const char kControlNewLine = 13; // ^M From 9dec0adcdc20e0a31594f9971a0c828255a36874 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:49:47 -0500 Subject: [PATCH 0434/1332] ZVISION: Conform to gcc template spacing requirements --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 5e060c009af0..18dfcb821c09 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,7 +64,7 @@ struct Puzzle { uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List> resultActions; + Common::List > resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable From 3723a0bad3a968e7df30ccb7a4df0fe1e4662e33 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:50:39 -0500 Subject: [PATCH 0435/1332] ZVISION: sscanf to a uint first instead of directly to a bool --- engines/zvision/actions.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index cd84a6b85ea5..bddec3845074 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -186,13 +186,15 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { char fileName[25]; + uint loop; // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)", - &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate); + &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &loop, &_mask, &_framerate); _fileName = Common::String(fileName); + _loop = loop == 1 ? true : false; } bool ActionPlayAnimation::execute(ZVision *engine) { From 914763600352385fdda127aa456419d5e4a9cd7e Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:51:16 -0500 Subject: [PATCH 0436/1332] ZVISION: Allow _deltaTime to go negative so it can be clamped to zero properly --- engines/zvision/clock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/clock.h b/engines/zvision/clock.h index d17db6c25557..3939ba161244 100644 --- a/engines/zvision/clock.h +++ b/engines/zvision/clock.h @@ -38,7 +38,7 @@ class Clock { private: OSystem *_system; uint32 _lastTime; - uint32 _deltaTime; + int32 _deltaTime; uint32 _pausedTime; bool _paused; From 9036b8d3d2c42b5b082986ce8c5fffc74c07f6db Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:53:14 -0500 Subject: [PATCH 0437/1332] ZVISION: Create ZVisionGameId entry None This is used to end the AD table --- engines/zvision/detection.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/zvision/detection.h b/engines/zvision/detection.h index b1e5dcbe0161..f08cfd2fe139 100644 --- a/engines/zvision/detection.h +++ b/engines/zvision/detection.h @@ -28,8 +28,9 @@ namespace ZVision { enum ZVisionGameId { - ZorkNemesis, - ZorkGrandInquisitor + None = 0, + ZorkNemesis = 1, + ZorkGrandInquisitor = 2 }; struct ZVisionGameDescription { From 623b2625ffb4ea77be826d645488d05ecf554538 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:52:19 -0500 Subject: [PATCH 0438/1332] ZVISION: Properly end the AD table --- engines/zvision/detection.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index a799cc2aeb98..d9bb692f0708 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -85,7 +85,10 @@ static const ZVisionGameDescription gameDescriptions[] = { ZorkGrandInquisitor }, - { AD_TABLE_END_MARKER } + { + AD_TABLE_END_MARKER, + None + } }; } // End of namespace ZVision From 1b05d2fd7d662e692fa22ef7b1ecb59a63a3765a Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:54:43 -0500 Subject: [PATCH 0439/1332] ZVISION: Add linking for clock.o --- engines/zvision/module.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 26cf4ee69619..14fc035aa168 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -3,6 +3,7 @@ MODULE := engines/zvision MODULE_OBJS := \ action_node.o \ actions.o \ + clock.o \ console.o \ control.o \ detection.o \ From 6564dc044407d1df9adee74de3376b75114844e1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:55:20 -0500 Subject: [PATCH 0440/1332] ZVISION: Rename inner variable to prevent variable shadowing --- engines/zvision/render_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 604c310689ea..b38db003d1f4 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -112,9 +112,9 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint uint32 imageWidth = stream.readSint32LE(); uint32 imageHeight = stream.readSint32LE(); - LzssReadStream stream(&stream); + LzssReadStream lzssStream(&stream); byte *buffer = new byte[decompressedSize]; - stream.read(buffer, decompressedSize); + lzssStream.read(buffer, decompressedSize); uint32 horizontalPitch = imageWidth * sizeof(uint16); From 76d4fb569d2d158ca05b3fb09095efc35ed27a12 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:55:52 -0500 Subject: [PATCH 0441/1332] ZVISION: Comment out usage of ActionUnloadAnimation until it is implemented --- engines/zvision/scr_file_handling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 9759fd89b139..06fb0fab89b1 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -150,7 +150,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:animpreload*", true)) { actionList.push_back(Common::SharedPtr(new ActionPreloadAnimation(line))); } else if (line.matchString("*:animunload*", true)) { - actionList.push_back(Common::SharedPtr(new ActionUnloadAnimation(line))); + //actionList.push_back(Common::SharedPtr(new ActionUnloadAnimation(line))); } else if (line.matchString("*:attenuate*", true)) { From 4806a3726b02d2e8d00db00f752d3b8818c49206 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:56:32 -0500 Subject: [PATCH 0442/1332] ZVISION: Add default case statements for event handling in videos --- engines/zvision/video.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index c476cf2d83d8..f27c3faab88f 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -111,7 +111,11 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { case Common::KEYCODE_SPACE: videoDecoder.stop(); break; + default: + break; } + default: + break; } } From f2823933b4017fcd51eaa96ffb5dd608fcaacf4f Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:56:51 -0500 Subject: [PATCH 0443/1332] ZVISION: Remove extraneous include --- engines/zvision/zvision.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index aaf843fae290..a27f4cbc68a4 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -38,7 +38,6 @@ #include "zvision/console.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" -#include "zvision/clock.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" From 9bea3cb1c274d2a003ed4e80004fe2a8dc04373f Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 12:50:40 -0500 Subject: [PATCH 0444/1332] ZVISION: Add memory cleanup for _currentBackground --- engines/zvision/render_manager.cpp | 6 ++++++ engines/zvision/render_manager.h | 1 + 2 files changed, 7 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b38db003d1f4..70f67deab724 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -43,6 +43,12 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) _renderTable(width, height) { } +RenderManager::~RenderManager() { + if (_currentBackground != 0) { + delete _currentBackground; + } +} + void RenderManager::updateScreen(bool isConsoleActive) { if (_needsScreenUpdate || isConsoleActive) { _system->updateScreen(); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 9554e888d987..c4318f7dd309 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -44,6 +44,7 @@ namespace ZVision { class RenderManager { public: RenderManager(OSystem *system, const int width, const int height); + ~RenderManager(); private: OSystem *_system; From 1cff0fb0d6e33f436a998b07037b7a2428de34a8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 12:52:10 -0500 Subject: [PATCH 0445/1332] ZVISION: Fix memory free mismatch caused by MemoryReadStream using free() --- engines/zvision/zfs_archive.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index f815d9ccd36d..3577ce3d147e 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -138,7 +138,8 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common:: zfsArchive.open(_fileName); zfsArchive.seek(entryHeader->offset); - byte* buffer = new byte[entryHeader->size]; + // This *HAS* to be malloc (not new[]) because MemoryReadStream uses free() to free the memory + byte* buffer = (byte *)malloc(entryHeader->size); zfsArchive.read(buffer, entryHeader->size); // Decrypt the data in place if (_header.xorKey != 0) From 532306f8cb86882b45cffc1002d0d2a81f28de34 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 6 Aug 2013 01:13:25 +0200 Subject: [PATCH 0446/1332] AVALANCHE: Introduce AvalancheEngine::getEvent(). --- engines/avalanche/avalanche.cpp | 4 ++++ engines/avalanche/avalanche.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 35693ed200f1..922f70198192 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -143,6 +143,10 @@ void AvalancheEngine::updateEvents() { } } +bool AvalancheEngine::getEvent(Common::Event &event) { + return _eventMan->pollEvent(event); +} + diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 94ac6afe420c..8ce73120dc36 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -111,6 +111,8 @@ class AvalancheEngine : public Engine { void updateEvents(); + bool getEvent(Common::Event &event); // A warpper around _eventMan->pollEvent(), se we can use it in Scrolls::normscroll() for example. + protected: // Engine APIs Common::Error run(); From bd516f4244bc4fdf4342dbd1abc0c479270b2ed3 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 6 Aug 2013 01:17:44 +0200 Subject: [PATCH 0447/1332] AVALANCHE: Implement Scrolls::say(). Introduce Graphics::_scrolls, implement Scrolls::normscroll() and update Scrolls::drawscroll() using it. --- engines/avalanche/graphics.cpp | 3 ++ engines/avalanche/graphics.h | 5 +- engines/avalanche/scrolls2.cpp | 97 ++++++++++++++++++---------------- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 677f5109d5bb..2c266e92c4c9 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -62,6 +62,8 @@ void Graphics::init() { _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); _screen.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); + + _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } Graphics::~Graphics() { @@ -69,6 +71,7 @@ Graphics::~Graphics() { _magics.free(); _background.free(); _screen.free(); + _scrolls.free(); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index d16b0c00464d..13c6001ef855 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -57,6 +57,8 @@ class Graphics { static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; + ::Graphics::Surface _surface; + ::Graphics::Surface _background; ::Graphics::Surface _magics; @@ -65,6 +67,7 @@ class Graphics { ::Graphics::Surface _screen; + ::Graphics::Surface _scrolls; @@ -98,8 +101,6 @@ class Graphics { private: AvalancheEngine *_vm; - ::Graphics::Surface _surface; - static const byte _egaPaletteIndex[16]; byte _egaPalette[64][3]; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4a62f2493676..8cf0ffff35ab 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -103,19 +103,13 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - const byte locol = 2; - byte xx, yy, ox, bit, lz, t; - int16 yp; - bool offset; byte itw[12][80]; - - offset = x % 8 == 4; - x = x / 8; - lz = z.size(); - ox = 0; + byte lz = z.size(); + byte ox = 0; + _vm->_logger->log_scrollline(); - for (xx = 0; xx < lz; xx++) { + for (byte xx = 0; xx < lz; xx++) { switch (z[xx]) { case kControlRoman: { cfont = roman; @@ -128,7 +122,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit } break; default: { - for (yy = 0; yy < 12; yy ++) + for (byte yy = 0; yy < 12; yy++) itw[yy][ox] = ~ch[cfont][z[xx]][yy + 2]; ox++; _vm->_logger->log_scrollchar(Common::String(z[xx])); @@ -136,44 +130,21 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit } } + bool offset = x % 8 == 4; lz = ox; - if (offset) { - /* offsetting routine */ - for (yy = 0; yy < 12; yy++) { - bit = 240; - itw[yy][lz] = 255; - for (xx = 0; xx < lz; xx++) { - t = itw[yy][xx]; - itw[yy][xx] = bit + t / 16; - bit = t << 4; - } - } - lz++; - } - + x = x / 8; y++; - for (byte fv = 0; fv < z.size(); fv++) + // Similar to Dropdown::chalk(). + for (byte fv = 0; fv < lz; fv++) for (byte ff = 0; ff < 12; ff++) { - byte pixel = itw[ff][fv]; // Note that it's the bitwise NOT operator! + byte pixel = itw[ff][fv]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); - // We don't have to bother with the planes, since they all have the same value. See the original. - // Note that it's the bitwise OR operator! + uint16 xa = x * 8 + fv * 8 + 7 - bit + offset * 4; + uint16 ya = y + ff; + *(byte *)_vm->_graphics->_scrolls.getBasePtr(xa, ya) = pixelBit + (pixelBit << 1) + (pixelBit << 2); } } - - /*yp = x + y * 80 + (1 - _vm->_gyro->cp) * _vm->_gyro->pagetop; - for (yy = 0; yy < 12; yy++) { - yp += 80; - for (bit = 0; bit <= locol; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(itw[yy], mem[0xa000 * yp], lz); - } - }*/ } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ @@ -194,6 +165,24 @@ void Scrolls::normscroll() { if (_vm->_gyro->demo) _vm->_basher->get_demorec(); + + + ::Graphics::Surface temp; + temp.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); + _vm->_graphics->refreshScreen(); + + Common::Event event; + while (true) { + _vm->getEvent(event); + if ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS))) + break; + } + + _vm->_graphics->_surface.copyFrom(temp); + + + // do { // do { // _vm->_gyro->check(); /* was "checkclick;" */ @@ -371,7 +360,10 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t if ((1 <= use_icon) && (use_icon <= 34)) lx += halficonwidth; - + + + _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); + _vm->_gyro->off(); /* mblit(mx-lx-46,my-ly-6,mx+lx+15,my+ly+6,0,3);*/ /*setfillstyle(1, 7); @@ -381,17 +373,28 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t setcolor(4); arc(mx + lx, my - ly, 360, 90, 15); arc(mx + lx, my + ly, 270, 360, 15);*/ - _vm->_graphics->drawBar(mx - lx - 30, my + ly, mx + lx, my + ly + 6, lightgray); + + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly), lightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly), lightgray); + /*_vm->_graphics->drawBar(mx - lx - 30, my + ly, mx + lx, my + ly + 6, lightgray); _vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly, lightgray); - _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx + lx + 15, my + ly, lightgray); + _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx + lx + 15, my + ly, lightgray);*/ + /*setfillstyle(1, 8); pieslice(mx - lx - 31, my - ly, 360, 180, 15); pieslice(mx - lx - 31, my + ly, 180, 360, 15); setfillstyle(1, 4);*/ - _vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5, red); + + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), red); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), red); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), red); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), red); + /*_vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5, red); _vm->_graphics->drawBar(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7, red); _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx - lx - 14, my + ly, red); - _vm->_graphics->drawBar(mx + lx + 15, my - ly, mx + lx + 16, my + ly, red); + _vm->_graphics->drawBar(mx + lx + 15, my - ly, mx + lx + 16, my + ly, red);*/ + ex = mx - lx; ey = my - ly; mx -= lx; From 6598bb20fda6aec37d5d7c96ceb6ecde47fda866 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:06:23 -0500 Subject: [PATCH 0448/1332] ZVISION: Create image auto screen centering during blitting --- engines/zvision/render_manager.cpp | 20 ++++++++++++-------- engines/zvision/render_manager.h | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 70f67deab724..1473dcccac89 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -56,7 +56,7 @@ void RenderManager::updateScreen(bool isConsoleActive) { } } -void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { +void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { // Panoramas are transposed // The actual data is transposed in mutateImage if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { @@ -83,6 +83,11 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) return; + // Center the image on the screen if asked + if (autoCenter) { + destRect.moveTo((_width - subRectangle.width()) / 2, (_height - subRectangle.height()) / 2); + } + if (_renderTable.getRenderState() == RenderTable::FLAT) { _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { @@ -94,7 +99,7 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin } } -void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { +void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { Common::File file; if (!file.open(fileName)) { @@ -102,10 +107,10 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d return; } - renderImageToScreen(file, destinationX, destinationY, subRectangle); + renderImageToScreen(file, destinationX, destinationY, subRectangle, autoCenter); } -void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle) { +void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; @@ -124,7 +129,7 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint uint32 horizontalPitch = imageWidth * sizeof(uint16); - renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle); + renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle, autoCenter); delete[] buffer; } else { // Reset the cursor @@ -138,7 +143,7 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint } const Graphics::Surface *tgaSurface = tga.getSurface(); - renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle); + renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle, autoCenter); tga.destroy(); } @@ -160,8 +165,7 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { _currentBackground = file; - // TODO: Check if all the panoramas are the same height. AKA: can we hardcode the vertical centering to 80px? - renderImageToScreen(*_currentBackground, 0, 80); + renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(), true); } } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index c4318f7dd309..3352f415a966 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -72,7 +72,7 @@ class RenderManager { * @param destinationY Y position where the image should be put * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. */ - void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); + void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. @@ -83,7 +83,7 @@ class RenderManager { * @param destinationY Y position where the image should be put * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. */ - void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0)); + void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); /** * Sets the current background image to be used by the RenderManager and immediately @@ -98,7 +98,7 @@ class RenderManager { bool needsScreenUpdate() { return _needsScreenUpdate; }; private: - void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle); + void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter); }; } // End of namespace ZVision From 946f98b34d01c06fdea5416f0f0bbd6457bb1b86 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:07:55 -0500 Subject: [PATCH 0449/1332] ZVISION: Fix frame delay calculation being reversed. Also convert to int to ensure proper 0 clamping --- engines/zvision/zvision.cpp | 2 +- engines/zvision/zvision.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index a27f4cbc68a4..7c9bdd8877d4 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -134,7 +134,7 @@ Common::Error ZVision::run() { _renderManager->updateScreen(_console->isActive()); // Calculate the frame delay based off a desired frame time - int delay = _desiredFrameTime - (currentTime - _system->getMillis()); + int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); // Ensure non-negative delay = delay < 0 ? 0 : delay; _system->delayMillis(delay); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 990b6e8b93e6..5bb3d7cb1d11 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -68,7 +68,7 @@ class ZVision : public Engine { const int _height; const Graphics::PixelFormat _pixelFormat; - const uint _desiredFrameTime; + const int _desiredFrameTime; // We need random numbers Common::RandomSource *_rnd; From 30afe1a81532f19c7ab872ff20e2b04c582ff221 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:08:44 -0500 Subject: [PATCH 0450/1332] ZVISION: Add some comments concerning StateFlag::DO_ME_NOW --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 18dfcb821c09..e7846f529639 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -57,7 +57,7 @@ struct Puzzle { enum StateFlags { ONCE_PER_INST = 0x01, - DO_ME_NOW = 0x02, + DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria DISABLED = 0x04 }; From a31a97c520bbe49bf351b5178302a529f313a35e Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:09:28 -0500 Subject: [PATCH 0451/1332] ZVISION: Add debug statements for Puzzle checking --- engines/zvision/script_manager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 7fcade22c173..395d45cff920 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -24,6 +24,7 @@ #include "common/algorithm.h" #include "common/hashmap.h" +#include "common/debug.h" #include "zvision/script_manager.h" #include "zvision/actions.h" @@ -76,6 +77,8 @@ void ScriptManager::checkPuzzleCriteria() { while (!_puzzlesToCheck.empty()) { Puzzle *puzzle = _puzzlesToCheck.pop(); + debug("Checking puzzle: %u", puzzle->key); + // Check each Criteria bool criteriaMet = false; for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { @@ -110,6 +113,8 @@ void ScriptManager::checkPuzzleCriteria() { // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) // criteriaList can be empty. Aka, the puzzle should be executed immediately if (puzzle->criteriaList.empty() || criteriaMet) { + debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); + for (Common::List >::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { (*resultIter)->execute(_engine); } From 435ed16e0360440367ceb36b09e2116b3325a01b Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:09:54 -0500 Subject: [PATCH 0452/1332] ZVISION: Set the puzzle global variable after a Puzzle is completed --- engines/zvision/script_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 395d45cff920..5b428951390b 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -118,6 +118,9 @@ void ScriptManager::checkPuzzleCriteria() { for (Common::List >::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { (*resultIter)->execute(_engine); } + + // Set the puzzle as completed + setStateValue(puzzle->key, 1); } } } From 387bfb2806856dcf76cb12a7a3b571aa62a59298 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:10:19 -0500 Subject: [PATCH 0453/1332] ZVISION: Fix typo in Puzzle checking --- engines/zvision/script_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 5b428951390b..38ca1075d1ff 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -84,7 +84,7 @@ void ScriptManager::checkPuzzleCriteria() { for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { // Get the value to compare against uint argumentValue; - if ((*iter).argument) + if ((*iter).argumentIsAKey) argumentValue = getStateValue(iter->argument); else argumentValue = iter->argument; From 931ad00a2d208335fc45885bfc7f53a53e6d9dce Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:18:04 -0500 Subject: [PATCH 0454/1332] ZVISION: Add StateFlag handling to Puzzle checking --- engines/zvision/script_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 38ca1075d1ff..fe6548cd807c 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -77,6 +77,15 @@ void ScriptManager::checkPuzzleCriteria() { while (!_puzzlesToCheck.empty()) { Puzzle *puzzle = _puzzlesToCheck.pop(); + // Check if the puzzle is already finished + // If it doesn't have the flag ONCE_PER_INST it can be done more than once + // Also check that the puzzle isn't disabled + if (getStateValue(puzzle->key) == 1 && + (puzzle->flags & Puzzle::StateFlags::ONCE_PER_INST) == Puzzle::StateFlags::ONCE_PER_INST && + (puzzle->flags & Puzzle::StateFlags::DISABLED) == 0) { + continue; + } + debug("Checking puzzle: %u", puzzle->key); // Check each Criteria From b98a8fbf12717457c087b4e169d72f461310c667 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:20:36 -0500 Subject: [PATCH 0455/1332] ZVISION: Fix loop logic so videos can end --- engines/zvision/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index f27c3faab88f..32f7b1fc8a5c 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -98,9 +98,9 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { videoDecoder.start(); // Only continue while the video is still playing - while (videoDecoder.isPlaying()) { + while (!shouldQuit() && !videoDecoder.endOfVideo() && videoDecoder.isPlaying()) { // Check for engine quit and video stop key presses - while (_eventMan->pollEvent(_event)) { + while (!videoDecoder.endOfVideo() && videoDecoder.isPlaying() && _eventMan->pollEvent(_event)) { switch (_event.type) { case Common::EVENT_KEYDOWN: switch (_event.kbd.keycode) { From 26b73331375488a0d5c0fa6b7e0f9c49de4e45a1 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 7 Aug 2013 10:30:44 +0200 Subject: [PATCH 0456/1332] AVALANCHE: Repair parts of the scrolls system, implement the death of Avalot and almost everything connected to it. --- engines/avalanche/avalot.cpp | 102 +++++++++++++++++---------------- engines/avalanche/lucerna2.cpp | 15 +++-- engines/avalanche/scrolls2.cpp | 61 +++++++++----------- engines/avalanche/timeout2.cpp | 8 ++- engines/avalanche/trip6.cpp | 7 ++- 5 files changed, 98 insertions(+), 95 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c403f00a3d55..3f4c545e9d6c 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -161,58 +161,60 @@ void Avalot::handleKeyDown(Common::Event &event) { // // To be implemented later with the sounds, I assume. - switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. - case Common::KEYCODE_KP8: - event.kbd.keycode = Common::KEYCODE_UP; - break; - case Common::KEYCODE_KP2: - event.kbd.keycode = Common::KEYCODE_DOWN; - break; - case Common::KEYCODE_KP6: - event.kbd.keycode = Common::KEYCODE_RIGHT; - break; - case Common::KEYCODE_KP4: - event.kbd.keycode = Common::KEYCODE_LEFT; - break; - case Common::KEYCODE_KP9: - event.kbd.keycode = Common::KEYCODE_PAGEUP; - break; - case Common::KEYCODE_KP3: - event.kbd.keycode = Common::KEYCODE_PAGEDOWN; - break; - case Common::KEYCODE_KP7: - event.kbd.keycode = Common::KEYCODE_HOME; - break; - case Common::KEYCODE_KP1: - event.kbd.keycode = Common::KEYCODE_END; - break; - } - - switch (event.kbd.keycode) { - case Common::KEYCODE_UP: - case Common::KEYCODE_DOWN: - case Common::KEYCODE_RIGHT: - case Common::KEYCODE_LEFT: - case Common::KEYCODE_PAGEUP: - case Common::KEYCODE_PAGEDOWN: - case Common::KEYCODE_HOME: - case Common::KEYCODE_END: - case Common::KEYCODE_KP5: - _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. - _vm->_lucerna->showrw(); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); - return; - case Common::KEYCODE_BACKSPACE: - _vm->_parser->handleBackspace(); - break; - case Common::KEYCODE_RETURN: - _vm->_parser->handleReturn(); - break; - } - if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) _vm->_parser->handleInputText(event); + else + switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. + case Common::KEYCODE_KP8: + event.kbd.keycode = Common::KEYCODE_UP; + break; + case Common::KEYCODE_KP2: + event.kbd.keycode = Common::KEYCODE_DOWN; + break; + case Common::KEYCODE_KP6: + event.kbd.keycode = Common::KEYCODE_RIGHT; + break; + case Common::KEYCODE_KP4: + event.kbd.keycode = Common::KEYCODE_LEFT; + break; + case Common::KEYCODE_KP9: + event.kbd.keycode = Common::KEYCODE_PAGEUP; + break; + case Common::KEYCODE_KP3: + event.kbd.keycode = Common::KEYCODE_PAGEDOWN; + break; + case Common::KEYCODE_KP7: + event.kbd.keycode = Common::KEYCODE_HOME; + break; + case Common::KEYCODE_KP1: + event.kbd.keycode = Common::KEYCODE_END; + break; + } + + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + case Common::KEYCODE_DOWN: + case Common::KEYCODE_RIGHT: + case Common::KEYCODE_LEFT: + case Common::KEYCODE_PAGEUP: + case Common::KEYCODE_PAGEDOWN: + case Common::KEYCODE_HOME: + case Common::KEYCODE_END: + case Common::KEYCODE_KP5: + if (_vm->_gyro->alive) { + _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. + _vm->_lucerna->showrw(); + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); + return; + } + case Common::KEYCODE_BACKSPACE: + _vm->_parser->handleBackspace(); + break; + case Common::KEYCODE_RETURN: + _vm->_parser->handleReturn(); + break; + } _vm->_lucerna->showrw(); if (_vm->_gyro->demo) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 29f93c7d4237..b78c8ce51d40 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1127,16 +1127,19 @@ void Lucerna::gameover() { _vm->_gyro->dna.user_moves_avvy = false; - sx = _vm->_trip->tr[1].x; - sy = _vm->_trip->tr[1].y; + sx = _vm->_trip->tr[0].x; + sy = _vm->_trip->tr[0].y; - _vm->_trip->tr[1].done(); - _vm->_trip->tr[1].init(12, true, _vm->_trip); /* 12 = Avalot falls */ - _vm->_trip->tr[1].step = 0; - _vm->_trip->tr[1].appear(sx, sy, 0); + _vm->_trip->tr[0].done(); + _vm->_trip->tr[0].init(12, true, _vm->_trip); /* 12 = Avalot falls */ + _vm->_trip->tr[0].step = 0; + _vm->_trip->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); + /* _vm->_scrolls->display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ + warning("STUB: Timeout::avalot_falls()"); + _vm->_gyro->alive = false; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8cf0ffff35ab..6b21a99f8aeb 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -329,6 +329,7 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { blockread(f, mem[0xa000 * st + (fv * 80)], xl); } bit = getpixel(0, 0);*/ + warning("STUB: Scrolls::block_drop()"); f.close(); @@ -360,7 +361,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t if ((1 <= use_icon) && (use_icon <= 34)) lx += halficonwidth; - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); @@ -377,9 +377,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly), lightgray); - /*_vm->_graphics->drawBar(mx - lx - 30, my + ly, mx + lx, my + ly + 6, lightgray); - _vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly, lightgray); - _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx + lx + 15, my + ly, lightgray);*/ /*setfillstyle(1, 8); pieslice(mx - lx - 31, my - ly, 360, 180, 15); @@ -390,10 +387,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), red); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), red); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), red); - /*_vm->_graphics->drawBar(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5, red); - _vm->_graphics->drawBar(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7, red); - _vm->_graphics->drawBar(mx - lx - 15, my - ly, mx - lx - 14, my + ly, red); - _vm->_graphics->drawBar(mx + lx + 15, my - ly, mx + lx + 16, my + ly, red);*/ ex = mx - lx; ey = my - ly; @@ -425,29 +418,30 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t for (b = 0; b <= _vm->_gyro->scrolln; b++) { - switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) { - case kControlCenter: { - centre = true; - _vm->_gyro->scroll[b].deleteLastChar(); - } - break; - case kControlLeftJustified: { - centre = false; - _vm->_gyro->scroll[b].deleteLastChar(); - } - break; - case kControlQuestion: { - //settextjustify(1, 1); - dix = mx + lx; - diy = my + ly; - _vm->_gyro->scroll[b].setChar(' ', 0); - groi = *_vm->_graphics->getPixel(0, 0); - // inc(diy,14); - _vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); - _vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + if (!_vm->_gyro->scroll[b].empty()) + switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) { + case kControlCenter: { + centre = true; + _vm->_gyro->scroll[b].deleteLastChar(); + } + break; + case kControlLeftJustified: { + centre = false; + _vm->_gyro->scroll[b].deleteLastChar(); + } + break; + case kControlQuestion: { + //settextjustify(1, 1); + dix = mx + lx; + diy = my + ly; + _vm->_gyro->scroll[b].setChar(' ', 0); + groi = *_vm->_graphics->getPixel(0, 0); + // inc(diy,14); + _vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); + _vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + } + break; } - break; - } if (centre) say(320 - _vm->_gyro->scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->scroll[b]); @@ -586,9 +580,9 @@ void Scrolls::calldrivers() { if (_vm->_gyro->buffer[fv] == kControlRegister) param = 0; else - if (('0' < _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] < '9')) + if (('0' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= '9')) param = _vm->_gyro->buffer[fv] - 48; - else if (('A' < _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] < 'Z')) + else if (('A' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= 'Z')) param = _vm->_gyro->buffer[fv] - 55; mouthnext = false; @@ -748,7 +742,8 @@ void Scrolls::calldrivers() { mouthnext = true; break; case kControlInsertSpaces: - for (nn = 0; nn < 9; nn++) _vm->_gyro->scroll[_vm->_gyro->scrolln] = _vm->_gyro->scroll[_vm->_gyro->scrolln] + ' '; + for (nn = 0; nn < 9; nn++) + _vm->_gyro->scroll[_vm->_gyro->scrolln] += ' '; break; default: { // Add new char. if (_vm->_gyro->scroll[_vm->_gyro->scrolln].size() == 50) { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index e23114dccb6d..692d7320f3cf 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -625,11 +625,13 @@ void Timeout::winning() { } void Timeout::avalot_falls() { - if (_vm->_trip->tr[1].step < 5) { - _vm->_trip->tr[1].step += 1; + if (_vm->_trip->tr[0].step < 5) { + _vm->_trip->tr[0].step += 1; set_up_timer(3, procavalot_falls, reason_falling_over); } else - _vm->_scrolls->display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); + //_vm->_scrolls->display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); + + warning("STUB: Timeout::avalot_falls()"); } void Timeout::spludwick_goes_to_cauldron() { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 26530a5cb75d..dcdd807b3b73 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -426,13 +426,14 @@ triptype *triptype::done() { uint16 soa; /* nds:=num div seq;*/ + totalnum--; _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) _info.xw += 1; - for (aa = 1; aa <= /*nds*seq*/ a.num; aa++) { + for (aa = 0; aa < /*nds*seq*/ a.num; aa++) { totalnum--; - free(_info.mani[totalnum]); - free(_info.sil[totalnum]); /* <<- Width of a siltype. */ + delete _info.mani[totalnum]; + delete _info.sil[totalnum]; } quick = false; From 84aac3e49beeeda18a9d08e485e97bf25a961708 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 7 Aug 2013 10:37:59 +0200 Subject: [PATCH 0457/1332] AVALANCHE: Rework Scrolls::normscroll(). --- engines/avalanche/scrolls2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 6b21a99f8aeb..5087232c98c9 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -169,11 +169,11 @@ void Scrolls::normscroll() { ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! _vm->_graphics->refreshScreen(); Common::Event event; - while (true) { + while (!_vm->shouldQuit()) { _vm->getEvent(event); if ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS))) break; From f67e0042b046c57526f72d8f33b7c36b5508a66a Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 7 Aug 2013 15:26:59 -0500 Subject: [PATCH 0458/1332] ZVISION: Create console method to dump all cursor file names --- engines/zvision/console.cpp | 17 +++++++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 18 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 6634e0bef468..f9b4e7008abd 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -48,6 +48,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); + DCmd_Register("dumpcursorfilenames", WRAP_METHOD(Console, cmdDumpAllCursorFileNames)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -175,4 +176,20 @@ bool Console::cmdDumpFile(int argc, const char **argv) { return true; } +bool Console::cmdDumpAllCursorFileNames(int argc, const char **argv) { + Common::DumpFile outputFile; + outputFile.open("cursorFileNames.txt"); + + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.zcr"); + + // Register the file entries within the zfs archives with the SearchMan + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + outputFile.writeString((*iter)->getName()); + outputFile.writeByte('\n'); + } + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index be3ebf10dcf5..3c08f207685c 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -47,6 +47,7 @@ class Console : public GUI::Debugger { bool cmdSetPanoramaScale(int argc, const char **argv); bool cmdChangeLocation(int argc, const char **argv); bool cmdDumpFile(int argc, const char **argv); + bool cmdDumpAllCursorFileNames(int argc, const char **argv); }; } // End of namespace ZVision From 84bf0984b0fc7f2bd18d5f233a001ba311369bd5 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 7 Aug 2013 23:51:12 +0200 Subject: [PATCH 0459/1332] AVALANCHE: Introduce Graphics::drawArc(), use it in Scrolls::drawscroll(). --- engines/avalanche/graphics.cpp | 84 ++++++++++++++++++++++++++++++++++ engines/avalanche/graphics.h | 3 ++ engines/avalanche/scrolls2.cpp | 4 +- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 2c266e92c4c9..158440b01714 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +#include "math.h" + #include "avalanche/avalanche.h" #include "avalanche/graphics.h" @@ -117,6 +119,88 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } +void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { + const double pi = 3.14; + const double convfac = pi / 180.0; + + int32 xRadius = radius; + int32 yRadius = radius * kScreenWidth / (8 * kScreenHeight); // Just don't ask why... + + if (xRadius == 0) + xRadius ++; + if (yRadius == 0) + yRadius ++; + + /* check for an ellipse with negligable x and y radius */ + if ((xRadius <= 1) && (yRadius <= 1)) + { + *(byte *)_scrolls.getBasePtr(x,y) = color; + return; + } + + /* check if valid angles */ + stAngle = stAngle % 361; + endAngle = endAngle % 361; + + /* if impossible angles then swap them! */ + if (endAngle < stAngle) + { + uint16 tmpAngle=endAngle; + endAngle=stAngle; + stAngle=tmpAngle; + } + + /* approximate the number of pixels required by using the circumference */ + /* equation of an ellipse. */ + uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(float(xRadius), 2)+pow(float(yRadius), 2)) + 0.5); + + /* Calculate the angle precision required */ + double delta = 90.0 / numOfPixels; + + /* Always just go over the first 90 degrees. Could be optimized a */ + /* bit if startAngle and endAngle lie in the same quadrant, left as an */ + /* exercise for the reader :) (JM) */ + double j = 0; + + /* calculate stop position, go 1 further than 90 because otherwise */ + /* 1 pixel is sometimes not drawn (JM) */ + uint16 deltaEnd = 91; + + /* Calculate points */ + int16 xNext = xRadius; + int16 yNext = 0; + do { + int16 xTemp = xNext; + int16 yTemp = yNext; + /* this is used by both sin and cos */ + double tempTerm = (j+delta)*convfac; + /* Calculate points */ + xNext = floor(xRadius*cos(tempTerm) + 0.5); + yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); + + int16 xp = x + xTemp; + int16 xm = x - xTemp; + int16 yp = y + yTemp; + int16 ym = y - yTemp; + if ((j >= stAngle) && (j <= endAngle)) + *(byte *)_scrolls.getBasePtr(xp,yp) = color; + + if (((180-j) >= stAngle) && ((180-j) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xm,yp) = color; + + if (((j+180) >= stAngle) && ((j+180) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xm,ym) = color; + + if (((360-j) >= stAngle) && ((360-j) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xp,ym) = color; + + j += delta; + } while (j <= deltaEnd); +} + + + + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 13c6001ef855..56300f480b3e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -87,6 +87,9 @@ class Graphics { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); + void drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. + // The caller has to .free() the returned Surfaces!!! ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 5087232c98c9..eeb9b4df4c48 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -373,7 +373,9 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t setcolor(4); arc(mx + lx, my - ly, 360, 90, 15); arc(mx + lx, my + ly, 270, 360, 15);*/ - + _vm->_graphics->drawArc(_vm->_graphics->_scrolls,mx + lx, my - ly, 0, 90, 15, red); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls,mx + lx, my + ly, 270, 360, 15, red); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly), lightgray); From c182d28b02c25ce69547ef12db56a9f72c82bcc5 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 8 Aug 2013 00:57:10 +0200 Subject: [PATCH 0460/1332] AVALANCHE: Introduce Graphics::drawPieSlice(), use it in Scrolls::drawscroll(). --- engines/avalanche/graphics.cpp | 5 +++++ engines/avalanche/graphics.h | 2 ++ engines/avalanche/scrolls2.cpp | 31 ++++++++++++++++--------------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 158440b01714..7870f1d20fe6 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -198,6 +198,11 @@ void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int } while (j <= deltaEnd); } +void Graphics::drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { + while (radius > 0) + drawArc(surface, x, y, stAngle, endAngle, radius--, color); + //*(byte *)surface.getBasePtr(x + 1, y) = color; +} diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 56300f480b3e..c3049327e82c 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -90,6 +90,8 @@ class Graphics { void drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. + void drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + // The caller has to .free() the returned Surfaces!!! ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index eeb9b4df4c48..36626caf8a04 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -365,26 +365,27 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); _vm->_gyro->off(); - /* mblit(mx-lx-46,my-ly-6,mx+lx+15,my+ly+6,0,3);*/ - /*setfillstyle(1, 7); - setcolor(7); - pieslice(mx + lx, my - ly, 360, 90, 15); - pieslice(mx + lx, my + ly, 270, 360, 15); - setcolor(4); - arc(mx + lx, my - ly, 360, 90, 15); - arc(mx + lx, my + ly, 270, 360, 15);*/ - _vm->_graphics->drawArc(_vm->_graphics->_scrolls,mx + lx, my - ly, 0, 90, 15, red); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls,mx + lx, my + ly, 270, 360, 15, red); + + // The right corners of the scroll. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx - 2, my - ly, 0, 90, 15, lightgray); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx - 2, my + ly, 270, 360, 15, lightgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, red); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, red); + // The body of the scroll. _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly), lightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly), lightgray); - /*setfillstyle(1, 8); - pieslice(mx - lx - 31, my - ly, 360, 180, 15); - pieslice(mx - lx - 31, my + ly, 180, 360, 15); - setfillstyle(1, 4);*/ + // The left corners of the scroll. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, darkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, red); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, red); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, darkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, red); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, red); + // The rear borders of the scroll. _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), red); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), red); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), red); @@ -394,7 +395,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t ey = my - ly; mx -= lx; my -= ly + 2; - //setcolor(0); + centre = false; switch (use_icon) { From 59ff20b32cdfb4d1ac2f112472ebb79048188c5b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 8 Aug 2013 03:59:29 +0200 Subject: [PATCH 0461/1332] AVALANCHE: Implement the clock in Lucerna, upgrade Graphics::drawArc() to work in synergy with that. --- engines/avalanche/graphics.cpp | 18 +++++++-- engines/avalanche/graphics.h | 4 +- engines/avalanche/lucerna2.cpp | 69 ++++++++++++++++++++++++++++++---- engines/avalanche/lucerna2.h | 8 ++-- 4 files changed, 82 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 7870f1d20fe6..9e772d393c64 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -119,7 +119,8 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { +Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { + Common::Point endPoint; const double pi = 3.14; const double convfac = pi / 180.0; @@ -134,8 +135,10 @@ void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int /* check for an ellipse with negligable x and y radius */ if ((xRadius <= 1) && (yRadius <= 1)) { - *(byte *)_scrolls.getBasePtr(x,y) = color; - return; + *(byte *)_scrolls.getBasePtr(x, y) = color; + endPoint.x = x; + endPoint.y = y; + return endPoint; } /* check if valid angles */ @@ -152,7 +155,7 @@ void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int /* approximate the number of pixels required by using the circumference */ /* equation of an ellipse. */ - uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(float(xRadius), 2)+pow(float(yRadius), 2)) + 0.5); + uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(double(xRadius), 2)+pow(double(yRadius), 2)) + 0.5); /* Calculate the angle precision required */ double delta = 90.0 / numOfPixels; @@ -166,6 +169,11 @@ void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int /* 1 pixel is sometimes not drawn (JM) */ uint16 deltaEnd = 91; + // Set the end point. + double tempTerm = endAngle * convfac; + endPoint.x = floor(xRadius * cos(tempTerm) + 0.5) + x; + endPoint.y = floor(yRadius * sin(tempTerm + pi) + 0.5) + y; + /* Calculate points */ int16 xNext = xRadius; int16 yNext = 0; @@ -196,6 +204,8 @@ void Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int j += delta; } while (j <= deltaEnd); + + return endPoint; } void Graphics::drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c3049327e82c..ce4218e19de3 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -31,6 +31,7 @@ #include "common/file.h" #include "graphics/surface.h" +#include "common/rect.h" namespace Avalanche { class AvalancheEngine; @@ -87,8 +88,9 @@ class Graphics { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + Common::Point drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. + // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) void drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index b78c8ce51d40..740fa8c8e079 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1082,24 +1082,77 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). -void Lucerna::calchand(uint16 ang, uint16 length, /*arccoordstype &a,*/ byte c) { - warning("STUB: Lucerna::calchand()"); +void Lucerna::calchand(uint16 ang, uint16 length, Common::Point &a, byte c) { + if (ang > 900) { + a.x = 177; + return; + } + + a = _vm->_graphics->drawArc(_vm->_graphics->_surface, xm, ym, 449 - ang, 450 - ang, length, c); } -void Lucerna::hand(/*arccoordstype a,*/ byte c) { - warning("STUB: Lucerna::hand()"); +void Lucerna::hand(const Common::Point &a, byte c) { + if (a.x == 177) + return; + + _vm->_graphics->_surface.drawLine(xm, ym, a.x, a.y, c); } -void Lucerna::chime() { - warning("STUB: Lucerna::chime()"); +void Lucerna::refresh_hands() { + const bytefield clockspace = {61, 166, 66, 200}; + + for (byte page_ = 0; page_ < 2; page_++) + _vm->_trip->getset[page_].remember(clockspace); } void Lucerna::plothands() { - warning("STUB: Lucerna::plothands()"); + /* off;*/ + //setactivepage(3); + calchand(_vm->_gyro->onh, 14, ah, yellow); + calchand(_vm->_gyro->om * 6, 17, am, yellow); + hand(ah, brown); + hand(am, brown); + + calchand(nh, 14, ah, brown); + calchand(_vm->_gyro->m * 6, 17, am, brown); + hand(ah, yellow); + hand(am, yellow); + + //setactivepage(1 - cp); + + refresh_hands(); + + /* on;*/ +} + +void Lucerna::chime() { + warning("STUB: Lucerna::chime()"); } void Lucerna::clock_lucerna() { - warning("STUB: Lucerna::clock_lucerna()"); + /* ...Clock. */ + TimeDate t; + _vm->_system->getTimeAndDate(t); + _vm->_gyro->h = t.tm_hour; + _vm->_gyro->m = t.tm_min; + _vm->_gyro->s = t.tm_sec; + + nh = (_vm->_gyro->h % 12) * 30 + _vm->_gyro->m / 2; + + if (_vm->_gyro->oh != _vm->_gyro->h) { + plothands(); + chime(); + } + + if (_vm->_gyro->om != _vm->_gyro->m) + plothands(); + + if ((_vm->_gyro->h == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) + _vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); + + _vm->_gyro->oh = _vm->_gyro->h; + _vm->_gyro->onh = nh; + _vm->_gyro->om = _vm->_gyro->m; } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index efb45e2878e8..f0ecf2bad77f 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -125,7 +125,7 @@ class Lucerna { //Clock static const int16 xm = 510; static const int16 ym = 183; - //arccoordstype ah, am; http://www.freepascal.org/docs-html/rtl/graph/arccoordstype.html + Common::Point ah, am; uint16 nh; @@ -159,11 +159,11 @@ class Lucerna { void fadein(byte n); // clock_lucerna - void calchand(uint16 ang, uint16 length,/* arccoordstype &a,*/ byte c); - void hand(/*arccoordstype a,*/ byte c); - void chime(); + void calchand(uint16 ang, uint16 length, Common::Point &a, byte c); + void hand(const Common::Point &a, byte c); void refresh_hands(); void plothands(); + void chime(); }; From 44ec5b68b5e1e2de4d8565654b6f2e870f7a8df3 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 8 Aug 2013 04:05:27 +0200 Subject: [PATCH 0462/1332] AVALANCHE: Repair Graphics::drawArc(), update Scrolls::drawscroll() accordingly. --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/scrolls2.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9e772d393c64..6a8b2ab2bebf 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -211,7 +211,7 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int void Graphics::drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { while (radius > 0) drawArc(surface, x, y, stAngle, endAngle, radius--, color); - //*(byte *)surface.getBasePtr(x + 1, y) = color; + *(byte *)surface.getBasePtr(x + 1, y) = color; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 36626caf8a04..e7c6eb0770ba 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -367,8 +367,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_gyro->off(); // The right corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx - 2, my - ly, 0, 90, 15, lightgray); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx - 2, my + ly, 270, 360, 15, lightgray); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, lightgray); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, lightgray); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, red); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, red); From ae2d657dc6119b7804a9e63032a1990248b70f56 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 8 Aug 2013 12:24:37 +0200 Subject: [PATCH 0463/1332] AVALANCHE: Update comments connected to Graphics::drawArc(). --- engines/avalanche/graphics.cpp | 36 +++++++++++++++------------------- engines/avalanche/graphics.h | 1 + 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 6a8b2ab2bebf..0042631b743e 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -132,7 +132,7 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int if (yRadius == 0) yRadius ++; - /* check for an ellipse with negligable x and y radius */ + // Check for an ellipse with negligable x and y radius. if ((xRadius <= 1) && (yRadius <= 1)) { *(byte *)_scrolls.getBasePtr(x, y) = color; @@ -141,11 +141,11 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int return endPoint; } - /* check if valid angles */ + // Check if valid angles. stAngle = stAngle % 361; endAngle = endAngle % 361; - /* if impossible angles then swap them! */ + // If impossible angles, then swap them! if (endAngle < stAngle) { uint16 tmpAngle=endAngle; @@ -153,20 +153,18 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int stAngle=tmpAngle; } - /* approximate the number of pixels required by using the circumference */ - /* equation of an ellipse. */ + // Approximate the number of pixels required by using the circumference equation of an ellipse. uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(double(xRadius), 2)+pow(double(yRadius), 2)) + 0.5); - /* Calculate the angle precision required */ + // Calculate the angle precision required. double delta = 90.0 / numOfPixels; - /* Always just go over the first 90 degrees. Could be optimized a */ - /* bit if startAngle and endAngle lie in the same quadrant, left as an */ - /* exercise for the reader :) (JM) */ + // Always just go over the first 90 degrees. Could be optimized a + // bit if startAngle and endAngle lie in the same quadrant, left as an + // exercise for the reader. :) double j = 0; - /* calculate stop position, go 1 further than 90 because otherwise */ - /* 1 pixel is sometimes not drawn (JM) */ + // Calculate stop position, go 1 further than 90 because otherwise 1 pixel is sometimes not drawn. uint16 deltaEnd = 91; // Set the end point. @@ -174,15 +172,15 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int endPoint.x = floor(xRadius * cos(tempTerm) + 0.5) + x; endPoint.y = floor(yRadius * sin(tempTerm + pi) + 0.5) + y; - /* Calculate points */ + // Calculate points. int16 xNext = xRadius; int16 yNext = 0; do { int16 xTemp = xNext; int16 yTemp = yNext; - /* this is used by both sin and cos */ + // This is used by both sin and cos. double tempTerm = (j+delta)*convfac; - /* Calculate points */ + xNext = floor(xRadius*cos(tempTerm) + 0.5); yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); @@ -190,16 +188,14 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int int16 xm = x - xTemp; int16 yp = y + yTemp; int16 ym = y - yTemp; + if ((j >= stAngle) && (j <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,yp) = color; - - if (((180-j) >= stAngle) && ((180-j) <= endAngle)) + else if (((180-j) >= stAngle) && ((180-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,yp) = color; - - if (((j+180) >= stAngle) && ((j+180) <= endAngle)) + else if (((j+180) >= stAngle) && ((j+180) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,ym) = color; - - if (((360-j) >= stAngle) && ((360-j) <= endAngle)) + else if (((360-j) >= stAngle) && ((360-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,ym) = color; j += delta; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ce4218e19de3..e371651dc17b 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -91,6 +91,7 @@ class Graphics { Common::Point drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) + // TODO: Make it more accurate later. void drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); From ad199c4929c9e0e3a3be9097b21338d3617c6f1b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 8 Aug 2013 21:40:41 +0200 Subject: [PATCH 0464/1332] AVALANCHE: Repair Graphics::drawArc(). --- engines/avalanche/graphics.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0042631b743e..c7774ed362d4 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -191,11 +191,14 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int if ((j >= stAngle) && (j <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,yp) = color; - else if (((180-j) >= stAngle) && ((180-j) <= endAngle)) + + if (((180-j) >= stAngle) && ((180-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,yp) = color; - else if (((j+180) >= stAngle) && ((j+180) <= endAngle)) + + if (((j+180) >= stAngle) && ((j+180) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,ym) = color; - else if (((360-j) >= stAngle) && ((360-j) <= endAngle)) + + if (((360-j) >= stAngle) && ((360-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,ym) = color; j += delta; From 626d8aa8c14f09fc735a50a368fe76130a0e1e87 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 9 Aug 2013 03:02:28 +0200 Subject: [PATCH 0465/1332] AVALANCHE: Implement switching between rooms (Trip::fliproom(), Lucerna::enterroom()), implement drawing multiple sprites to the screen (Trip::call_andexors()). --- engines/avalanche/graphics.cpp | 2 -- engines/avalanche/lucerna2.cpp | 22 ++++++++++------------ engines/avalanche/trip6.cpp | 27 +++++++++++++++++++-------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index c7774ed362d4..d6e1eac612a4 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -97,8 +97,6 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - drawPicture(_background, 0, 10); // TODO: Remove it later, implement otherwise!!! Now it only works with one sprite on the screen. - /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) for (byte qax = 0; qax < sprite.xl; qax++) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 740fa8c8e079..a35cc1246cce 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -103,11 +103,9 @@ void Lucerna::draw_also_lines() { _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 161), 15); - for (ff = 0; ff < 50; ff++) { - if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) { + for (ff = 0; ff < 50; ff++) + if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); - } - } switch (squeaky_code) { case 1 : @@ -434,14 +432,14 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.talked_to_crapulus) { _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__outsideyours; - _vm->_trip->tr[2].init(8, false, _vm->_trip); /* load Crapulus */ + _vm->_trip->tr[1].init(8, false, _vm->_trip); /* load Crapulus */ if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { - _vm->_trip->apped(2, 4); /* Start on the right-hand side of the screen. */ - _vm->_trip->tr[2].walkto(5); /* Walks up to greet you. */ + _vm->_trip->apped(1, 3); /* Start on the right-hand side of the screen. */ + _vm->_trip->tr[1].walkto(4); /* Walks up to greet you. */ } else { - _vm->_trip->apped(2, 5); /* Starts where he was before. */ - _vm->_trip->tr[2].face = 3; + _vm->_trip->apped(1, 4); /* Starts where he was before. */ + _vm->_trip->tr[1].face = 3; } _vm->_trip->tr[2].call_eachstep = true; @@ -450,9 +448,9 @@ void Lucerna::enterroom(byte x, byte ped) { } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__nowhere; if (_vm->_gyro->dna.crapulus_will_tell) { - _vm->_trip->tr[2].init(8, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[2].walkto(4); + _vm->_trip->tr[1].init(8, false, _vm->_trip); + _vm->_trip->apped(1, 1); + _vm->_trip->tr[1].walkto(3); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->dna.crapulus_will_tell = false; } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index dcdd807b3b73..510d6e5b1ffa 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -219,7 +219,7 @@ void triptype::walk() { tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1; // -1 is becouse the modified array indexes of magics[] compared to Pascal . - if ((tc != 0) & (!_tr->_vm->_gyro->doing_sprite_run)) { + if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { switch (_tr->_vm->_gyro->magics[tc].op) { case _tr->_vm->_gyro->exclaim: { bounce(); @@ -1358,7 +1358,7 @@ void Trip::call_andexors() { do { ok = true; for (fv = 0; fv < 4; fv++) { - if (((order[fv] != 0) && (order[fv + 1] != 0)) + if (((order[fv] != -1) && (order[fv + 1] != -1)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { /* Swap them! */ temp = order[fv]; @@ -1369,6 +1369,17 @@ void Trip::call_andexors() { } } while (!ok); + // We redraw the background only if we have at least one moving character. + bool drawBG = false; + for (fv = 0; fv < 5; fv++) { + if (order[fv] > -1) { + drawBG = true; + break; + } + } + if (drawBG) + _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); + for (fv = 0; fv < 5; fv++) { if (order[fv] > -1) tr[order[fv]].andexor(); @@ -1560,8 +1571,8 @@ void Trip::fliproom(byte room, byte ped) { if (!_vm->_gyro->alive) { /* You can't leave the room if you're dead. */ - tr[1].ix = 0; - tr[1].iy = 0; /* Stop him from moving. */ + tr[0].ix = 0; + tr[0].iy = 0; /* Stop him from moving. */ return; } @@ -1572,7 +1583,7 @@ void Trip::fliproom(byte room, byte ped) { if ((_vm->_gyro->dna.jumpstatus > 0) && (_vm->_gyro->dna.room == r__insidecardiffcastle)) { /* You can't *jump* out of Cardiff Castle! */ - tr[1].ix = 0; + tr[0].ix = 0; return; } @@ -1585,7 +1596,7 @@ void Trip::fliproom(byte room, byte ped) { getsetclear(); - for (fv = 2; fv <= numtr; fv++) { + for (fv = 1; fv < numtr; fv++) { if (tr[fv].quick) tr[fv].done(); } /* Deallocate sprite */ @@ -1594,10 +1605,10 @@ void Trip::fliproom(byte room, byte ped) { _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; _vm->_lucerna->enterroom(room, ped); - apped(1, ped); + apped(0, ped - 1); _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; _vm->_gyro->oldrw = _vm->_gyro->dna.rw; - _vm->_gyro->dna.rw = tr[1].face; + _vm->_gyro->dna.rw = tr[0].face; _vm->_lucerna->showrw(); for (fv = 0; fv <= 1; fv++) { From 2a6d70cfb81f2e6ba3277c9d18952a1602c3877c Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 9 Aug 2013 12:37:35 +0200 Subject: [PATCH 0466/1332] AVALANCHE: Repair Acci::parse(). --- engines/avalanche/acci2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d1eeb71297b6..3b9448aad561 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -556,7 +556,7 @@ void Acci::parse() { } if (_vm->_gyro->subjnumber == 0) // Still not found. - for (fv = 0; fv < thats.size(); fv++) + for (fv = 0; fv < thats.size() - 1; fv++) if (thats[fv] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = thats[fv + 1]; thats.setChar(0, fv + 1); @@ -564,7 +564,7 @@ void Acci::parse() { } if (_vm->_gyro->subjnumber == 0) // STILL not found! Must be the word after "say". - for (fv = 0; fv < thats.size(); fv++) + for (fv = 0; fv < thats.size() - 1; fv++) if ((thats[fv] == 7) && (thats[fv + 1] != 0) && !((225 <= thats[fv + 1]) && (thats[fv + 1] <= 229))) { // SAY not followed by a preposition _vm->_gyro->subjnumber = thats[fv + 1]; From 1443d8ce16fb870cddae900e15e0410f8ba085d5 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 9 Aug 2013 13:21:57 +0200 Subject: [PATCH 0467/1332] AVALANCHE: Repair Lucerna::enterroom(), Lucerna::put_geida_at(), broaden Roomnums. --- engines/avalanche/lucerna2.cpp | 106 +++++++++++++++++---------------- engines/avalanche/roomnums.h | 1 + 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a35cc1246cce..e996d5706d34 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -388,10 +388,10 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ void Lucerna::put_geida_at(byte whichped, byte &ped) { if (ped == 0) return; - _vm->_trip->tr[2].init(5, false, _vm->_trip); /* load Geida */ - _vm->_trip->apped(2, whichped); - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procgeida_procs; + _vm->_trip->tr[1].init(5, false, _vm->_trip); /* load Geida */ + _vm->_trip->apped(1, whichped); + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; } void Lucerna::enterroom(byte x, byte ped) { @@ -457,49 +457,49 @@ void Lucerna::enterroom(byte x, byte ped) { } break; - /* Need to find out which room is this! - - case r__outsidespludwicks: + + case r__outsidespludwicks: if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); _vm->_gyro->dna.spludwicks_here = true; } - break;*/ + break; case r__spludwicks: if (_vm->_gyro->dna.spludwicks_here) { if (ped > 0) { - _vm->_trip->tr[2].init(2, false, _vm->_trip); /* load Spludwick */ - _vm->_trip->apped(2, 2); - _vm->_gyro->whereis['\227'] = r__spludwicks; + _vm->_trip->tr[1].init(2, false, _vm->_trip); /* load Spludwick */ + _vm->_trip->apped(1, 1); + _vm->_gyro->whereis[1] = r__spludwicks; } _vm->_gyro->dna.dogfoodpos = 0; /* _vm->_gyro->also Spludwick pos. */ - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procgeida_procs; - } else _vm->_gyro->whereis['\227'] = r__nowhere; + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; + } else _vm->_gyro->whereis[1] = r__nowhere; break; case r__brummieroad: { - if (_vm->_gyro->dna.geida_follows) put_geida_at(5, ped); + if (_vm->_gyro->dna.geida_follows) + put_geida_at(4, ped); if (_vm->_gyro->dna.cwytalot_gone) { _vm->_gyro->magics[lightred].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__nowhere; } else { if (ped > 0) { - _vm->_trip->tr[2].init(4, false, _vm->_trip); /* 4=Cwytalot*/ - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procfollow_avvy_y; + _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot*/ + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__brummieroad; if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ - _vm->_trip->apped(2, 2); /* He appears on the right of the screen... */ - _vm->_trip->tr[2].walkto(4); /* ...and he walks up... */ + _vm->_trip->apped(1, 1); /* He appears on the right of the screen... */ + _vm->_trip->tr[1].walkto(4); /* ...and he walks up... */ } else { /* You've been here before. */ - _vm->_trip->apped(2, 4); /* He's standing in your way straight away... */ - _vm->_trip->tr[2].face = _vm->_trip->left; + _vm->_trip->apped(1, 3); /* He's standing in your way straight away... */ + _vm->_trip->tr[1].face = _vm->_trip->left; } } } @@ -510,10 +510,10 @@ void Lucerna::enterroom(byte x, byte ped) { dnatype &with = _vm->_gyro->dna; if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { - _vm->_trip->tr[2].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ - _vm->_trip->apped(2, 1); - _vm->_trip->tr[2].walkto(2); - _vm->_trip->tr[2].vanishifstill = true; + _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ + _vm->_trip->apped(1, 0); + _vm->_trip->tr[1].walkto(1); + _vm->_trip->tr[1].vanishifstill = true; with.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); @@ -526,7 +526,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->show_one(3); /* Position of drawbridge */ _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } - if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); /* load Geida */ + if (_vm->_gyro->dna.geida_follows) + put_geida_at(ped + 2, ped); /* load Geida */ } break; @@ -534,9 +535,9 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { if (! _vm->_gyro->dna.been_tied_up) { /* A welcome party... or maybe not... */ - _vm->_trip->tr[2].init(6, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[2].walkto(3); + _vm->_trip->tr[1].init(6, false, _vm->_trip); + _vm->_trip->apped(1, 1); + _vm->_trip->tr[1].walkto(2); _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -558,19 +559,19 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) switch (_vm->_gyro->dna.cardiff_things) { case 0 : { /* You've answered NONE of his questions. */ - _vm->_trip->tr[2].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[2].walkto(3); + _vm->_trip->tr[1].init(9, false, _vm->_trip); + _vm->_trip->apped(1, 1); + _vm->_trip->tr[1].walkto(2); _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; case 5 : - _vm->_gyro->magics[2].op = _vm->_gyro->nix; + _vm->_gyro->magics[1].op = _vm->_gyro->nix; break; /* You've answered ALL his questions. => nothing happens. */ default: { /* You've answered SOME of his questions. */ - _vm->_trip->tr[2].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 3); - _vm->_trip->tr[2].face = _vm->_trip->right; + _vm->_trip->tr[1].init(9, false, _vm->_trip); + _vm->_trip->apped(1, 2); + _vm->_trip->tr[1].face = _vm->_trip->right; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -602,15 +603,16 @@ void Lucerna::enterroom(byte x, byte ped) { case r__lustiesroom: { _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ - if (_vm->_trip->tr[1].whichsprite == 0) /* Avvy in his normal clothes */ + if (_vm->_trip->tr[0].whichsprite == 0) /* Avvy in his normal clothes */ _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ /* Presumably, Avvy dressed as a monk. */ _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->dna.geida_follows) { - put_geida_at(5, ped); - if (_vm->_gyro->dna.lustie_is_asleep) _vm->_celer->show_one(5); + put_geida_at(4, ped); + if (_vm->_gyro->dna.lustie_is_asleep) + _vm->_celer->show_one(5); } } break; @@ -652,23 +654,23 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__wisewomans: { - _vm->_trip->tr[2].init(11, false, _vm->_trip); + _vm->_trip->tr[1].init(11, false, _vm->_trip); if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip->apped(2, 2); /* Start on the right-hand side of the screen. */ - _vm->_trip->tr[2].walkto(4); /* Walks up to greet you. */ + _vm->_trip->apped(1, 1); /* Start on the right-hand side of the screen. */ + _vm->_trip->tr[1].walkto(4); /* Walks up to greet you. */ } else { - _vm->_trip->apped(2, 4); /* Starts where she was before. */ - _vm->_trip->tr[2].face = 3; + _vm->_trip->apped(1, 3); /* Starts where she was before. */ + _vm->_trip->tr[1].face = 3; } - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procface_avvy; /* She always faces Avvy. */ + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; /* She always faces Avvy. */ } break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_trip->tr[2].init(10, false, _vm->_trip); /* Define the dart. */ + _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) _vm->_sequence->then_show(3); @@ -711,16 +713,18 @@ void Lucerna::enterroom(byte x, byte ped) { break; /* Ayles awake. */ case r__geidas: - put_geida_at(2, ped); + put_geida_at(1, ped); break; /* load Geida */ case r__easthall: case r__westhall: - if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 2, ped); + if (_vm->_gyro->dna.geida_follows) + put_geida_at(ped + 1, ped); break; case r__lusties: - if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 6, ped); + if (_vm->_gyro->dna.geida_follows) + put_geida_at(ped + 5, ped); break; case r__nottspub: { diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index 3c5ee49a51c6..9d31777da04d 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -35,6 +35,7 @@ namespace Avalanche { const byte r__nowhere = 0; const byte r__yours = 1; const byte r__outsideyours = 2; +const byte r__outsidespludwicks = 3; /*{ a corridor in your castle. = 3 } { outside your castle = 5; }*/ const byte r__musicroom = 7; From 288abffafa889de25766f6c12c74a6d613c3b3bc Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 9 Aug 2013 15:42:10 +0200 Subject: [PATCH 0468/1332] AVALANCHE: Repair Visa::unskrimble() and Scrolls::calldrivers(). --- engines/avalanche/gyro2.h | 2 +- engines/avalanche/roomnums.h | 3 +-- engines/avalanche/scrolls2.cpp | 25 +++++++++++++------------ engines/avalanche/timeout2.cpp | 4 ++-- engines/avalanche/visa2.cpp | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 75735810473a..854b5dfcc813 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -543,7 +543,7 @@ class Gyro { byte cp, ledstatus, defaultled; raw characters; bool alive; - char buffer[2000]; + byte buffer[2000]; uint16 bufsize; byte oldjw; /* Old joystick-way */ diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index 9d31777da04d..a6cb93b3a8e3 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -36,8 +36,7 @@ const byte r__nowhere = 0; const byte r__yours = 1; const byte r__outsideyours = 2; const byte r__outsidespludwicks = 3; -/*{ a corridor in your castle. = 3 } -{ outside your castle = 5; }*/ +//{ outside your castle = 5; } const byte r__musicroom = 7; const byte r__outsideargentpub = 9; const byte r__argentroad = 10; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index e7c6eb0770ba..556658c5b664 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -265,7 +265,8 @@ void Scrolls::resetscrolldriver() { /* phew */ void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ byte fv; - for (fv = 1; fv <= _vm->_gyro->scrollbells; fv ++) _vm->_lucerna->errorled(); /* ring the bell "x" times */ + for (fv = 0; fv < _vm->_gyro->scrollbells; fv++) + _vm->_lucerna->errorled(); /* ring the bell "x" times */ } void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */ @@ -348,8 +349,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_logger->log_epsonroman(); /* Scrolls always START with Roman. */ lx = 0; - ly = (_vm->_gyro->scrolln + 1) * 6; - for (b = 0; b <= _vm->_gyro->scrolln; b++) { + ly = (_vm->_gyro->scrolln) * 6; + for (b = 0; b < _vm->_gyro->scrolln; b++) { ex = _vm->_gyro->scroll[b].size() * 8; if (lx < ex) lx = ex; @@ -420,7 +421,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t } - for (b = 0; b <= _vm->_gyro->scrolln; b++) { + for (b = 0; b < _vm->_gyro->scrolln; b++) { if (!_vm->_gyro->scroll[b].empty()) switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) { case kControlCenter: { @@ -493,7 +494,7 @@ bool Scrolls::ask(Common::String question) { } void Scrolls::resetscroll() { - _vm->_gyro->scrolln = 0; + _vm->_gyro->scrolln = 1; for (int j = 0; j < 15; j ++) if (!_vm->_gyro->scroll[j].empty()) _vm->_gyro->scroll[j].clear(); @@ -592,7 +593,7 @@ void Scrolls::calldrivers() { } else switch (_vm->_gyro->buffer[fv]) { case kControlParagraph: { - if ((_vm->_gyro->scrolln == 0) && (_vm->_gyro->scroll[0].empty())) + if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty())) break; if (call_spriterun) @@ -618,7 +619,7 @@ void Scrolls::calldrivers() { _vm->_gyro->scrollbells++; break; // #7 = "Bel" case kControlSpeechBubble: { - if ((_vm->_gyro->scrolln == 0) && (_vm->_gyro->scroll[0].empty())) + if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty())) break; if (call_spriterun) @@ -727,7 +728,7 @@ void Scrolls::calldrivers() { call_spriterun = false; _vm->_gyro->scrolln++; - _vm->_gyro->scroll[_vm->_gyro->scrolln] = kControlQuestion; + _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] = kControlQuestion; was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; if (was_virtual) @@ -746,14 +747,14 @@ void Scrolls::calldrivers() { break; case kControlInsertSpaces: for (nn = 0; nn < 9; nn++) - _vm->_gyro->scroll[_vm->_gyro->scrolln] += ' '; + _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += ' '; break; default: { // Add new char. - if (_vm->_gyro->scroll[_vm->_gyro->scrolln].size() == 50) { - solidify(_vm->_gyro->scrolln); + if (_vm->_gyro->scroll[_vm->_gyro->scrolln - 1].size() == 50) { + solidify(_vm->_gyro->scrolln - 1); _vm->_gyro->scrolln++; } - _vm->_gyro->scroll[_vm->_gyro->scrolln] += _vm->_gyro->buffer[fv]; + _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += _vm->_gyro->buffer[fv]; } } } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 692d7320f3cf..cd6e4dc74fb8 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -607,8 +607,8 @@ void Timeout::arkata_shouts() { if (_vm->_gyro->dna.teetotal) return; - // _vm->_visa->dixi('q', 76); - warning("STUB: Timeout::arkata_shouts()"); + _vm->_visa->dixi('q', 76); + set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index e2f83d636dce..135ab216c6ca 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -50,7 +50,7 @@ bool Visa::report_dixi_errors = true; void Visa::unskrimble() { for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) - _vm->_gyro->buffer[fv] = (~(_vm->_gyro->buffer[fv]) - fv + 1) % 256; + _vm->_gyro->buffer[fv] = (~(_vm->_gyro->buffer[fv] - (fv + 1))) % 256; } void Visa::do_the_bubble() { From b4b60e1f632f928bb3f28b99ff4689a9cd24c680 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 12:16:43 -0500 Subject: [PATCH 0469/1332] ZVISION: Call _system->updateScreen() every frame Otherwise the cursor will not be updated --- engines/zvision/render_manager.cpp | 7 ------- engines/zvision/render_manager.h | 1 - engines/zvision/zvision.cpp | 6 +++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 1473dcccac89..f759c1fb9690 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -49,13 +49,6 @@ RenderManager::~RenderManager() { } } -void RenderManager::updateScreen(bool isConsoleActive) { - if (_needsScreenUpdate || isConsoleActive) { - _system->updateScreen(); - _needsScreenUpdate = false; - } -} - void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { // Panoramas are transposed // The actual data is transposed in mutateImage diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 3352f415a966..4b4e178e91fb 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -61,7 +61,6 @@ class RenderManager { public: void initialize(); - void updateScreen(bool isConsoleActive); /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 7c9bdd8877d4..338bbc5fbce8 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -130,9 +130,9 @@ Common::Error ZVision::run() { _scriptManager->updateNodes(_clock.getDeltaTime()); _scriptManager->checkPuzzleCriteria(); - // Render a frame - _renderManager->updateScreen(_console->isActive()); - + // Update the screen + _system->updateScreen(); + // Calculate the frame delay based off a desired frame time int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); // Ensure non-negative From 268282ab22d18e92180aa7653ef52b47a6ed1b51 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 14:05:31 -0500 Subject: [PATCH 0470/1332] ZVISION: Create class for decoding .zcr cursor files --- engines/zvision/cursor.cpp | 100 +++++++++++++++++++++++++++++++++++++ engines/zvision/cursor.h | 66 ++++++++++++++++++++++++ engines/zvision/module.mk | 1 + 3 files changed, 167 insertions(+) create mode 100644 engines/zvision/cursor.cpp create mode 100644 engines/zvision/cursor.h diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp new file mode 100644 index 000000000000..601c58fa2c3d --- /dev/null +++ b/engines/zvision/cursor.cpp @@ -0,0 +1,100 @@ +/* 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/scummsys.h" + +#include "common/str.h" +#include "common/file.h" + +#include "zvision/cursor.h" + + +namespace ZVision { + +ZorkCursor::ZorkCursor() + : _width(0), + _height(0), + _hotspotX(0), + _hotspotY(0), + _surface(0) { +} + +ZorkCursor::ZorkCursor(const Common::String &fileName) + : _width(0), + _height(0), + _hotspotX(0), + _hotspotY(0), + _surface(0) { + Common::File file; + if (!file.open(fileName)) + return; + + uint32 magic = file.readUint32BE(); + if (magic != MKTAG('Z', 'C', 'R', '1')) { + warning("%s is not a Zork Cursor file", fileName.c_str()); + return; + } + + _hotspotX = file.readUint16LE(); + _hotspotY = file.readUint16LE(); + _width = file.readUint16LE(); + _height = file.readUint16LE(); + + uint dataSize = _width * _height * 2; + _surface = new byte[dataSize]; + uint32 bytesRead = file.read(_surface, dataSize); + assert(bytesRead == dataSize); +} + +ZorkCursor::ZorkCursor(const ZorkCursor &other) { + _width = other._width; + _height = other._height; + _hotspotX = other._hotspotX; + _hotspotY = other._hotspotY; + + uint dataSize = _width * _height * 2; + _surface = new byte[dataSize]; + + memcpy(_surface, other._surface, dataSize); +} + +ZorkCursor &ZorkCursor::operator=(const ZorkCursor &other) { + _width = other._width; + _height = other._height; + _hotspotX = other._hotspotX; + _hotspotY = other._hotspotY; + + uint dataSize = _width * _height * 2; + _surface = new byte[dataSize]; + + memcpy(_surface, other._surface, dataSize); + + return *this; +} + +ZorkCursor::~ZorkCursor() { + if (_surface != 0) { + delete[] _surface; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h new file mode 100644 index 000000000000..0d91a48f0f5c --- /dev/null +++ b/engines/zvision/cursor.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. + * + */ + +#ifndef ZVISION_CURSOR_H +#define ZVISION_CURSOR_H + +#include "common/types.h" + +#include "graphics/cursor.h" + +namespace Common { +class String; +} + +namespace ZVision { + +class ZorkCursor : public Graphics::Cursor { +public: + ZorkCursor(); + ZorkCursor(const Common::String &fileName); + ZorkCursor(const ZorkCursor &other); + ~ZorkCursor(); + +private: + uint16 _width; + uint16 _height; + uint16 _hotspotX; + uint16 _hotspotY; + byte *_surface; + +public: + ZorkCursor &operator=(const ZorkCursor &other); + + uint16 getWidth() const { return _width; } + uint16 getHeight() const { return _height; } + uint16 getHotspotX() const { return _hotspotX; } + uint16 getHotspotY() const { return _hotspotY; } + byte getKeyColor() const { return 0; } + const byte *getSurface() const { return _surface; } + const byte *getPalette() const { return 0; } + byte getPaletteStartIndex() const { return 0; } + uint16 getPaletteCount() const { return 0; } +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 14fc035aa168..feafad5e16e9 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ clock.o \ console.o \ control.o \ + cursor.o \ detection.o \ events.o \ lzss_read_stream.o \ From f31f35bf7bcd964b970eb4817135c966c9bad823 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 14:06:23 -0500 Subject: [PATCH 0471/1332] ZVISION: Create console command to render a cursor image to the screen --- engines/zvision/console.cpp | 12 ++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index f9b4e7008abd..f1b192fce14d 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" +#include "common/system.h" #include "gui/debugger.h" #include "common/file.h" #include "common/bufferedstream.h" @@ -34,6 +35,8 @@ #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" #include "zvision/utility.h" +#include "zvision/cursor.h" + namespace ZVision { @@ -49,6 +52,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); DCmd_Register("dumpcursorfilenames", WRAP_METHOD(Console, cmdDumpAllCursorFileNames)); + DCmd_Register("showcursor", WRAP_METHOD(Console, cmdShowCursor)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -192,4 +196,12 @@ bool Console::cmdDumpAllCursorFileNames(int argc, const char **argv) { return true; } +bool Console::cmdShowCursor(int argc, const char **argv) { + ZorkCursor cursor(argv[1]); + + _engine->_system->copyRectToScreen(cursor.getSurface(), cursor.getWidth() * 2, 0, 0, cursor.getWidth(), cursor.getHeight()); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 3c08f207685c..995c41881ed8 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -48,6 +48,7 @@ class Console : public GUI::Debugger { bool cmdChangeLocation(int argc, const char **argv); bool cmdDumpFile(int argc, const char **argv); bool cmdDumpAllCursorFileNames(int argc, const char **argv); + bool cmdShowCursor(int argc, const char **argv); }; } // End of namespace ZVision From 06e6cb5d1f9b6cc7d632e3a7e31267363dad3503 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 14:51:18 -0500 Subject: [PATCH 0472/1332] ZVISION: Create method for cycling through all the cursors so as to identify them more easily --- engines/zvision/events.cpp | 3 ++ engines/zvision/zvision.cpp | 56 +++++++++++++++++++++++++++++++++++++ engines/zvision/zvision.h | 2 ++ 3 files changed, 61 insertions(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 508d2610aaea..3163563ad391 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -61,6 +61,9 @@ void ZVision::processEvents() { if (_event.kbd.hasFlags(Common::KBD_CTRL)) quitGame(); break; + case Common::KEYCODE_F1: + cycleThroughCursors(); + break; default: break; } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 338bbc5fbce8..46b6c01781e2 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -40,6 +40,7 @@ #include "zvision/render_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" +#include "zvision/cursor.h" #include "zvision/utility.h" @@ -169,4 +170,59 @@ ZVisionGameId ZVision::getGameId() const { return _gameDescription->gameId; } +void ZVision::cycleThroughCursors() { + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.zcr"); + + Common::ArchiveMemberList::iterator iter = list.begin(); + ZorkCursor cursor; + bool cursorChanged = false; + + _system->showMouse(true); + + bool done = false; + while (!done && !shouldQuit()) { + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); + + while (_eventMan->pollEvent(_event)) { + if (_event.type == Common::EVENT_KEYDOWN) { + switch (_event.kbd.keycode) { + case Common::KEYCODE_LEFT: + --iter; + cursorChanged = true; + break; + case Common::KEYCODE_RIGHT: + ++iter; + cursorChanged = true; + break; + case Common::KEYCODE_RETURN: + debug("%s", (*iter)->getName().c_str()); + break; + case Common::KEYCODE_ESCAPE: + done = true; + break; + default: + break; + } + } + } + + if (cursorChanged) { + cursor = ZorkCursor((*iter)->getName()); + + _system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getHeight(), true, &_pixelFormat); + cursorChanged = false; + } + + _system->updateScreen(); + + // Calculate the frame delay based off a desired frame time + int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); + } +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 5bb3d7cb1d11..29c1ddd6512c 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -96,6 +96,8 @@ class ZVision : public Engine { void playVideo(Video::VideoDecoder &videoDecoder); + void cycleThroughCursors(); + private: void initialize(); From 0feac806b235867aae4078d2b5c58c38b3b23e21 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 14:51:45 -0500 Subject: [PATCH 0473/1332] ZVISION: Add a ZGI folder directory to the SearchMan --- engines/zvision/zvision.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 46b6c01781e2..7cfa42e125b4 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -69,6 +69,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) SearchMan.addSubDirectoryMatching(gameDataDir, "zassets1", 0, 2, true); SearchMan.addSubDirectoryMatching(gameDataDir, "zassets2", 0, 2, true); SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zgi", 0, 4, true); // Here is the right place to set up the engine specific debug channels //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); From f89120310cd08dc0640b51ed1e49dd02c3a028b9 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 14:52:21 -0500 Subject: [PATCH 0474/1332] ZVISION: Test for file.open before trying to read --- engines/zvision/utility.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 2e1ade663a08..fb4fe22ff88a 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -33,7 +33,10 @@ namespace ZVision { void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) { Common::File f; - f.open(sourceFile); + if (!f.open(sourceFile)) { + return; + } + byte* buffer = new byte[f.size()]; f.read(buffer, f.size()); From 1b277d34ac9d7b207e7e42964d00dd6f433daadc Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 18:33:15 -0500 Subject: [PATCH 0475/1332] ZVISION: Add class to manage cursors --- engines/zvision/cursor_manager.cpp | 119 +++++++++++++++++++++++++++++ engines/zvision/cursor_manager.h | 67 ++++++++++++++++ engines/zvision/events.cpp | 7 +- engines/zvision/module.mk | 1 + engines/zvision/zvision.cpp | 6 +- engines/zvision/zvision.h | 4 + 6 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 engines/zvision/cursor_manager.cpp create mode 100644 engines/zvision/cursor_manager.h diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp new file mode 100644 index 000000000000..43d288ea4e28 --- /dev/null +++ b/engines/zvision/cursor_manager.cpp @@ -0,0 +1,119 @@ +/* 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/scummsys.h" + +#include "common/system.h" +#include "graphics/pixelformat.h" + +#include "zvision/zvision.h" +#include "zvision/cursor_manager.h" + + +namespace ZVision { + +const char *CursorManager::_cursorNames[] = { "active", "arrow", "backward", "downarrow", "forward", "handpt", "handpu", "hdown", "hleft", + "hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" }; + +const char *CursorManager::_zgiCursorFileNames[] = { "g0gbc011.zcr", "g0gac001.zcr", "g0gac021.zcr", "g0gac031.zcr", "g0gac041.zcr", "g0gac051.zcr", "g0gac061.zcr", "g0gac071.zcr", "g0gac081.zcr", + "g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" }; + +const char *CursorManager::_zNemCursorFileNames[] = { "00act", "arrow", "back", "down", "forw", "handpt", "handpu", "hdown", "hleft", + "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" }; + + +CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat) + : _engine(engine), + _pixelFormat(pixelFormat), + _cursorIsPushed(false), + _currentCursor("idle") { + // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly + if (_engine->getGameId() == ZorkNemesis) { + Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[11])); + _idleCursor = ZorkCursor(name); + } else if (_engine->getGameId() == ZorkGrandInquisitor) { + _idleCursor = ZorkCursor(_zgiCursorFileNames[11]); + } +} + +void CursorManager::initialize() { + _engine->_system->setMouseCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); + _engine->_system->showMouse(true); +} + +void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { + _cursorIsPushed = pushed; + + if (cursorName == "idle" && !pushed) { + revertToIdle(); + return; + } + + // WARNING: The range of this loop is hardcoded to the length of _cursorNames + for (int i = 0; i < 18; i++) { + if (_engine->getGameId() == ZorkNemesis) { + if (_cursorNames[i] == cursorName) { + // ZNem uses a/b at the end of the file to signify not pushed/pushed respectively + Common::String pushedFlag = pushed ? "b" : "a"; + Common::String name = Common::String::format("%s%s.zcr", _zNemCursorFileNames[i], pushedFlag); + + changeCursor(ZorkCursor(name)); + return; + } + } else if (_engine->getGameId() == ZorkGrandInquisitor) { + if (_cursorNames[i] == cursorName) { + if (!pushed) { + changeCursor(ZorkCursor(_zgiCursorFileNames[i])); + } else { + // ZGI flips not pushed/pushed between a/c and b/d + // It flips the 4th character of the name + char buffer[25]; + strcpy(buffer, _zgiCursorFileNames[i]); + buffer[3] += 2; + } + return; + } + } + } + + // If we get here, something went wrong + warning("No cursor found for identifier %s", cursorName.c_str()); +} + +void CursorManager::changeCursor(const ZorkCursor &cursor) { + _engine->_system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor(), false, _pixelFormat); +} + +void CursorManager::cursorDown(bool pushed) { + if (_cursorIsPushed == pushed) + return; + + _cursorIsPushed = pushed; + changeCursor(_currentCursor, pushed); +} + +void CursorManager::revertToIdle() { + _currentCursor = "idle"; + _engine->_system->setMouseCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); +} + +} // End of namespace ZVision diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h new file mode 100644 index 000000000000..914538591d49 --- /dev/null +++ b/engines/zvision/cursor_manager.h @@ -0,0 +1,67 @@ +/* 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 ZVISION_CURSOR_MANAGER_H +#define ZVISION_CURSOR_MANAGER_H + +#include "common/types.h" + +#include "zvision/cursor.h" + + +namespace Graphics { +struct PixelFormat; +} + +namespace ZVision { + +class ZVision; + +class CursorManager { +public: + CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat); + +private: + ZVision *_engine; + const Graphics::PixelFormat *_pixelFormat; + ZorkCursor _idleCursor; + Common::String _currentCursor; + bool _cursorIsPushed; + + static const char *_cursorNames[]; + static const char *_zgiCursorFileNames[]; + static const char *_zNemCursorFileNames[]; + +public: + void initialize(); + + void changeCursor(Common::String &cursorName, bool pushed); + void cursorDown(bool pushed); + void revertToIdle(); + +private: + void changeCursor(const ZorkCursor &cursor); +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 3163563ad391..17f48db7fca5 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -27,7 +27,7 @@ #include "common/events.h" #include "engines/util.h" -#include "zvision/render_manager.h" +#include "zvision/cursor_manager.h" namespace ZVision { @@ -39,6 +39,7 @@ void ZVision::processEvents() { break; case Common::EVENT_LBUTTONUP: + onMouseUp(_event.mouse); break; case Common::EVENT_RBUTTONDOWN: @@ -78,7 +79,11 @@ void ZVision::processEvents() { } void ZVision::onMouseDown(const Common::Point &pos) { + _cursorManager->cursorDown(true); +} +void ZVision::onMouseUp(const Common::Point &pos) { + _cursorManager->cursorDown(false); } void ZVision::onMouseMove(const Common::Point &pos) { diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index feafad5e16e9..7e74b0bfdda4 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ console.o \ control.o \ cursor.o \ + cursor_manager.o \ detection.o \ events.o \ lzss_read_stream.o \ diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 7cfa42e125b4..e1f719df0aae 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -38,9 +38,9 @@ #include "zvision/console.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" +#include "zvision/cursor_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" -#include "zvision/cursor.h" #include "zvision/utility.h" @@ -81,6 +81,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, _width, _height); + _cursorManager = new CursorManager(this, &_pixelFormat); debug("ZVision::ZVision"); } @@ -90,6 +91,7 @@ ZVision::~ZVision() { // Dispose of resources delete _console; + delete _cursorManager; delete _renderManager; delete _scriptManager; delete _rnd; @@ -114,6 +116,8 @@ void ZVision::initialize() { initGraphics(_width, _height, true, &_pixelFormat); _scriptManager->initialize(); + // Has to be done after graphics has been initialized + _cursorManager->initialize(); // Create debugger console. It requires GFX to be initialized _console = new Console(this); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 29c1ddd6512c..0a4ed0897412 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -47,6 +47,7 @@ struct ZVisionGameDescription; class Console; class ScriptManager; class RenderManager; +class CursorManager; // our engine debug channels enum { @@ -76,6 +77,7 @@ class ZVision : public Engine { // Managers ScriptManager *_scriptManager; RenderManager *_renderManager; + CursorManager *_cursorManager; // Clock Clock _clock; @@ -91,6 +93,7 @@ class ZVision : public Engine { ScriptManager *getScriptManager() const; RenderManager *getRenderManager() const; + CursorManager *getCursorManager() const; Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; @@ -103,6 +106,7 @@ class ZVision : public Engine { void processEvents(); void onMouseDown(const Common::Point &pos); + void onMouseUp(const Common::Point &pos); void onMouseMove(const Common::Point &pos); void onKeyDown(uint keyCode); }; From ed4977848b1761ebfd09db9ea21d744236b813c6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 9 Aug 2013 18:42:27 -0500 Subject: [PATCH 0476/1332] ZVISION: Fix invalid argument for String::format() --- engines/zvision/cursor_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 43d288ea4e28..0115ec9d3c78 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -74,7 +74,7 @@ void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { if (_cursorNames[i] == cursorName) { // ZNem uses a/b at the end of the file to signify not pushed/pushed respectively Common::String pushedFlag = pushed ? "b" : "a"; - Common::String name = Common::String::format("%s%s.zcr", _zNemCursorFileNames[i], pushedFlag); + Common::String name = Common::String::format("%s%s.zcr", _zNemCursorFileNames[i], pushedFlag.c_str()); changeCursor(ZorkCursor(name)); return; From 9740087441fa2f5b0655c7065f891686c8579cb0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:07:27 -0500 Subject: [PATCH 0477/1332] ZVISION: Add documentation for the ResultAction base class --- engines/zvision/actions.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 76db25adf03f..b75ca8bdad66 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -36,9 +36,21 @@ namespace ZVision { // Forward declaration of ZVision. This file is included before ZVision is declared class ZVision; +/** + * The base class that represents any action that a Puzzle can take. + * This class is purely virtual. + */ class ResultAction { public: virtual ~ResultAction() {} + /** + * This is called by the script system whenever a Puzzle's criteria are found to be true. + * It should execute any necessary actions and return a value indicating whether the script + * system should continue to test puzzles. In 99% of cases this will be 'true'. + * + * @param engine A pointer to the base engine so the ResultAction can access all the necessary methods + * @return Should the script system continue to test any remaining puzzles (true) or immediately break and go on to the next frame (false) + */ virtual bool execute(ZVision *engine) = 0; }; From 86b3dfa22105a3edf8e99263637f60bc65f97739 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:07:56 -0500 Subject: [PATCH 0478/1332] ZVISION: Make ZFS Archive member name indexing case-insensitive --- engines/zvision/zfs_archive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/zfs_archive.h index e683ac1b5356..3bf492578c36 100644 --- a/engines/zvision/zfs_archive.h +++ b/engines/zvision/zfs_archive.h @@ -52,7 +52,7 @@ struct ZfsEntryHeader { uint32 unknown; }; -typedef Common::HashMap ZfsEntryHeaderMap; +typedef Common::HashMap ZfsEntryHeaderMap; class ZfsArchive : public Common::Archive { public: From 416cde1358ecdb18ae3f6c8bc2f794e9ac13755b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:10:06 -0500 Subject: [PATCH 0479/1332] ZVISION: Change video code to support arbitrary scaling and whether the video can be skipped --- engines/zvision/video.cpp | 77 ++++++++++++++++++++++++--------------- engines/zvision/zvision.h | 2 +- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 32f7b1fc8a5c..9f98b1474614 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -34,10 +34,11 @@ namespace ZVision { -// Taken from SCI -void scale2x(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel) { +// Taken/modified from SCI +void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel, uint scaleAmount) { assert(bytesPerPixel == 1 || bytesPerPixel == 2); - const uint32 newWidth = srcWidth * 2; + + const uint32 newWidth = srcWidth * scaleAmount; const uint32 pitch = newWidth * bytesPerPixel; const byte *srcPtr = src; @@ -45,54 +46,70 @@ void scale2x(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, byte for (uint32 y = 0; y < srcHeight; y++) { for (uint32 x = 0; x < srcWidth; x++) { const byte color = *srcPtr++; - dst[0] = color; - dst[1] = color; - dst[newWidth] = color; - dst[newWidth + 1] = color; - dst += 2; + + for (int i = 0; i < scaleAmount; i++) { + dst[i] = color; + dst[pitch + i] = color; + } + dst += scaleAmount; } - dst += newWidth; + dst += pitch; } } else if (bytesPerPixel == 2) { for (uint32 y = 0; y < srcHeight; y++) { for (uint32 x = 0; x < srcWidth; x++) { const byte color = *srcPtr++; const byte color2 = *srcPtr++; - dst[0] = color; - dst[1] = color2; - dst[2] = color; - dst[3] = color2; - dst[pitch] = color; - dst[pitch + 1] = color2; - dst[pitch + 2] = color; - dst[pitch + 3] = color2; - dst += 4; + + for (int i = 0; i < scaleAmount; i++) { + dst[i] = color; + dst[i + 1] = color2; + dst[pitch + i] = color; + dst[pitch + i + 1] = color2; + } + dst += 2 * scaleAmount; } dst += pitch; } } } -void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { +void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect, bool skippable) { // Videos use a different pixel format Common::List formats; formats.push_back(videoDecoder.getPixelFormat()); initGraphics(_width, _height, true, formats); byte bytesPerPixel = videoDecoder.getPixelFormat().bytesPerPixel; + uint16 origWidth = videoDecoder.getWidth(); uint16 origHeight = videoDecoder.getHeight(); + + uint scale = 1; + // If destRect is empty, no specific scaling was requested. However, we may choose to do scaling anyway + if (destRect.isEmpty()) { + // Most videos are very small. Therefore we do a simple 2x scale + if (origWidth * 2 <= 640 && origHeight * 2 <= 480) { + scale = 2; + } + } else { + // Assume bilinear scaling. AKA calculate the scale from just the width. + // Also assume that the scaling is in integral intervals. AKA no 1.5x scaling + // TODO: Test ^these^ assumptions + uint scale = destRect.width() / origWidth; + + // TODO: Test if we need to support downscale. + } + uint16 pitch = origWidth * bytesPerPixel; - // Most videos are very small. Therefore we do a simple 2x scale - bool shouldBeScaled = (origWidth * 2 <= 640 && origHeight * 2 <= 480); - uint16 finalWidth = shouldBeScaled ? origWidth * 2 : origWidth; - uint16 finalHeight = shouldBeScaled ? origHeight * 2 : origHeight; + uint16 finalWidth = origWidth * scale; + uint16 finalHeight = origHeight * scale; - byte *scaledVideoFrameBuffer = new byte[origHeight * pitch * 4]; + byte *scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; - uint16 x = (_width - finalWidth) / 2; - uint16 y = (_height - finalHeight) / 2; + uint16 x = ((_width - finalWidth) / 2) + destRect.left; + uint16 y = ((_height - finalHeight) / 2) + destRect.top; _clock.stop(); videoDecoder.start(); @@ -109,7 +126,9 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { quitGame(); break; case Common::KEYCODE_SPACE: - videoDecoder.stop(); + if (skippable) { + videoDecoder.stop(); + } break; default: break; @@ -123,8 +142,8 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { const Graphics::Surface *frame = videoDecoder.decodeNextFrame(); if (frame) { - if (shouldBeScaled) { - scale2x((byte *)frame->pixels, scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel); + if (scale != 1) { + scaleBuffer((byte *)frame->pixels, scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); _system->copyRectToScreen(scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); } else { _system->copyRectToScreen((byte *)frame->pixels, pitch, x, y, finalWidth, finalHeight); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 0a4ed0897412..8363fb1672b5 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -97,7 +97,7 @@ class ZVision : public Engine { Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; - void playVideo(Video::VideoDecoder &videoDecoder); + void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); void cycleThroughCursors(); From 694a6099a6f4da7807b1ac1efba75953522da206 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:12:23 -0500 Subject: [PATCH 0480/1332] ZVISION: Implement ActionQuit --- engines/zvision/actions.cpp | 11 +++++++++++ engines/zvision/actions.h | 6 ++++++ engines/zvision/scr_file_handling.cpp | 3 +-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index bddec3845074..81b696037893 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -203,6 +203,17 @@ bool ActionPlayAnimation::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionQuit +////////////////////////////////////////////////////////////////////////////// + +bool ActionQuit::execute(ZVision *engine) { + engine->quitGame(); + + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionRandom ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index b75ca8bdad66..48703b95e5b0 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -254,6 +254,12 @@ class ActionPreloadAnimation : public ResultAction { uint _framerate; }; +class ActionQuit : public ResultAction { +public: + ActionQuit() {} + bool execute(ZVision *engine); +}; + // TODO: See if this exists in ZGI. It doesn't in ZNem class ActionUnloadAnimation : public ResultAction { public: diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 06fb0fab89b1..0bb8d2690b8e 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -211,8 +211,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:quit*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionQuit())); } else if (line.matchString("*:random*", true)) { From 2176aa55fc71fb7ac8b44f81fcc070c927e3d505 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:18:29 -0500 Subject: [PATCH 0481/1332] ZVISION: Implement ActionStreamVideo --- engines/zvision/actions.cpp | 31 +++++++++++++++++++++++++++ engines/zvision/actions.h | 15 +++++++++++++ engines/zvision/scr_file_handling.cpp | 3 +-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 81b696037893..8c10837a1f2f 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -32,6 +32,7 @@ #include "zvision/render_manager.h" #include "zvision/action_node.h" #include "zvision/zork_raw.h" +#include "zvision/zork_avi_decoder.h" namespace ZVision { @@ -248,6 +249,36 @@ bool ActionSetScreen::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionStreamVideo +////////////////////////////////////////////////////////////////////////////// + +ActionStreamVideo::ActionStreamVideo(const Common::String &line) { + char fileName[25]; + uint skippable; + + sscanf(line.c_str(), "%*[^(](%25s %u %u %u %u %u %u)", fileName, &_x, &_y, &_width, &_height, &_flags, &skippable); + + _fileName = Common::String(fileName); + _skippable = (skippable == 0) ? false : true; +} + +bool ActionStreamVideo::execute(ZVision *engine) { + ZorkAVIDecoder decoder; + if (!decoder.loadFile(_fileName)) { + return true; + } + + Common::Rect destRect; + if ((_flags & 0x1) == 0x1) { + destRect = Common::Rect(_x, _y, _x + _width, _y + _height); + } + + engine->playVideo(decoder, destRect, _skippable); + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionTimer ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 48703b95e5b0..bb446171fe3a 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -286,6 +286,21 @@ class ActionSetScreen : public ResultAction { Common::String _fileName; }; +class ActionStreamVideo : public ResultAction { +public: + ActionStreamVideo(const Common::String &line); + bool execute(ZVision *engine); + +private: + Common::String _fileName; + uint _x; + uint _y; + uint _width; + uint _height; + uint _flags; + bool _skippable; +}; + class ActionTimer : public ResultAction { public: ActionTimer(const Common::String &line); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 0bb8d2690b8e..061079cd85ca 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -239,8 +239,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:streamvideo*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); } else if (line.matchString("*:syncsound*", true)) { From a41736e698f31364219c8d904342a8fcff8d16d0 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 00:21:15 +0200 Subject: [PATCH 0482/1332] AVALANCHE: Introduce Graphics::drawTriangle(), use it in Scrolls::bubble(). Modify Graphics::drawPieSlice(), update functions using it accordingly. --- engines/avalanche/graphics.cpp | 39 +++++++++++- engines/avalanche/graphics.h | 3 + engines/avalanche/scrolls2.cpp | 109 ++++++++++++++++++++++++++++++--- 3 files changed, 143 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index d6e1eac612a4..aa341f383e75 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -208,9 +208,46 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int void Graphics::drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { while (radius > 0) drawArc(surface, x, y, stAngle, endAngle, radius--, color); - *(byte *)surface.getBasePtr(x + 1, y) = color; } +void Graphics::drawTriangle(const ::Graphics::Surface &surface, Common::Point *p, byte color) { + // Draw the borders with a marking color. + _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255); + _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255); + _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, 255); + + // Get the top and the bottom of the triangle. + uint16 maxY = p[0].y, minY = p[0].y; + for (byte i = 1; i < 3; i++) { + if (p[i].y < minY) + minY = p[i].y; + if (p[i].y > maxY) + maxY = p[i].y; + } + + // Fill the triangle. + for (uint16 y = minY; y <= maxY; y++) { + uint16 x = 0; + while (*(byte *)_scrolls.getBasePtr(x, y) != 255) + x++; + uint16 minX = x; + uint16 maxX = x; + x++; + while ((*(byte *)_scrolls.getBasePtr(x, y) != 255) && (x != 639)) + x++; + if (x != 639) + maxX = x; + if (minX != maxX) + _scrolls.drawLine(minX, y, maxX, y, color); + } + + // Redraw the borders with the actual color. + _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, color); + _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, color); + _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color); +} + + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e371651dc17b..787eb6ded3ed 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -95,6 +95,9 @@ class Graphics { void drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + void drawTriangle(const ::Graphics::Surface &surface, Common::Point *p, byte color); + + // The caller has to .free() the returned Surfaces!!! ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 556658c5b664..8a95d4488711 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -375,8 +375,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t // The body of the scroll. _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly), lightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly), lightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), lightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), lightgray); // The left corners of the scroll. _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, darkgray); @@ -485,6 +485,101 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t } void Scrolls::bubble(func2 gotoit) { + int16 xl, yl, my, xw, yw; + byte fv; + Common::Point p[3]; + byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ + int16 xc; /* x correction */ + + /*setvisualpage(cp); + setactivepage(1 - cp);*/ + _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ + //mousepage(1 - cp); /* Mousepage */ + + //setfillstyle(1, talkb); + //setcolor(talkb); + _vm->_gyro->off(); + + xl = 0; + yl = _vm->_gyro->scrolln * 5; + for (int8 fv = 0; fv < _vm->_gyro->scrolln; fv++) { + uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8; + if (textWidth > xl) + xl = textWidth; + } + xl = xl / 2; + + xw = xl + 18; + yw = yl + 7; + my = yw * 2 - 2; + xc = 0; + + if ((_vm->_gyro->talkx - xw) < 0) + xc = -(_vm->_gyro->talkx - xw); + if ((_vm->_gyro->talkx + xw) > 639) + xc = 639 - (_vm->_gyro->talkx + xw); + + p[0].x = _vm->_gyro->talkx - 10; + p[0].y = yw; + p[1].x = _vm->_gyro->talkx + 10; + p[1].y = yw; + p[2].x = _vm->_gyro->talkx; + p[2].y = _vm->_gyro->talky; + + /* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); + mblit(talkx-10,my,talkx+10,talky,0,3);*/ + + _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); + + // The body of the bubble. + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw + 9, 7, _vm->_gyro->talkx + xw - 8 + xc, my + 1), _vm->_gyro->talkb); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw - 1, 12, _vm->_gyro->talkx + xw + xc + 2, my - 4), _vm->_gyro->talkb); + + // Top right corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, 11, 0, 90, 9, _vm->_gyro->talkb); + // Bottom right corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->talkb); + // Top left corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, 11, 90, 180, 9, _vm->_gyro->talkb); + // Bottom left corner of the bubble. + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->talkb); + + // "Tail" of the speech bubble. + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->talkb); + + //setcolor(talkf); + yl -= 3; + //settextjustify(1, 2); + /*for (fv = 0; fv < _vm->_gyro->scrolln; fv++) + outtextxy(_vm->_gyro->talkx + xc, (fv * 10) + 12, _vm->_gyro->scroll[fv + 1]);*/ + + for (fv = 0; fv < _vm->_gyro->scrolln; fv++) /* These should be separate loops. */ + _vm->_logger->log_bubbleline(fv, param, _vm->_gyro->scroll[fv]); + + _vm->_logger->log_divider(); + + //setvisualpage(1 - cp); + dingdongbell(); + _vm->_gyro->oncandopageswap = false; + _vm->_gyro->on(); + _vm->_gyro->dropsok = false; + + (this->*gotoit)(); + + _vm->_gyro->off(); + _vm->_gyro->dropsok = true; + /*mblit((talkx - xw + xc) / 8, 7, 1 + (talkx + xw + xc) / 8, my, 3, 1 - cp); + mblit((talkx - 10) / 8, my, 1 + (talkx + 10) / 8, talky, 3, 1 - cp); + blitfix();*/ + + /*setvisualpage(cp); + settextjustify(0, 0);*/ + _vm->_gyro->on(); /*sink;*/ + _vm->_gyro->oncandopageswap = true; + resetscrolldriver(); + if (_vm->_gyro->mpress > 0) + _vm->_gyro->after_the_scroll = true; + warning("STUB: Scrolls::bubble()"); } @@ -629,7 +724,7 @@ void Scrolls::calldrivers() { if (param == 0) natural(); else if ((1 <= param) && (param <= 9)) - if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param].quick)) { // Not valid. + if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. _vm->_lucerna->errorled(); natural(); } else @@ -638,11 +733,11 @@ void Scrolls::calldrivers() { /* Quasi-peds. (This routine performs the same thing with QPs as triptype.chatter does with the sprites.) */ - _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param].whichped].x; - _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param].whichped].y; // Position. + _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].x; + _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position. - _vm->_gyro->talkf = _vm->_gyro->quasipeds[param].fgc; - _vm->_gyro->talkb = _vm->_gyro->quasipeds[param].bgc; // Colours. + _vm->_gyro->talkf = _vm->_gyro->quasipeds[param - 10].fgc; + _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colours. } else { _vm->_lucerna->errorled(); // Not valid. natural(); From 5bba509db8a84a5d6c2ab4863990683977203e60 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:23:47 -0500 Subject: [PATCH 0483/1332] ZVISION: Create a global puzzle list and parse universe.scr into it during ScriptManager::initialize() --- engines/zvision/scr_file_handling.cpp | 8 ++++++-- engines/zvision/script_manager.cpp | 21 +++++++++++++++++---- engines/zvision/script_manager.h | 7 +++++-- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 061079cd85ca..efd122994d37 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -33,7 +33,7 @@ namespace ZVision { -void ScriptManager::parseScrFile(const Common::String &fileName) { +void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) { Common::File file; if (!file.open(fileName)) return; // File.open already throws a warning if the file doesn't exist, so there is no need to throw another @@ -54,7 +54,11 @@ void ScriptManager::parseScrFile(const Common::String &fileName) { sscanf(line.c_str(),"puzzle:%u",&(puzzle.key)); parsePuzzle(puzzle, file); - _activePuzzles.push_back(puzzle); + if (isGlobal) { + _globalPuzzles.push_back(puzzle); + } else { + _activePuzzles.push_back(puzzle); + } } else if (line.matchString("control:*", true)) { Common::SharedPtr control; diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index fe6548cd807c..027fec43a1c6 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -35,13 +35,12 @@ namespace ZVision { ScriptManager::ScriptManager(ZVision *engine) : _engine(engine) {} -// TODO: Actually do something in the initialize or remove it void ScriptManager::initialize() { - + parseScrFile("universe.scr", true); } void ScriptManager::createReferenceTable() { - // Iterate through each Puzzle + // Iterate through each local Puzzle for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { Puzzle *puzzlePtr = &(*activePuzzleIter); @@ -50,7 +49,21 @@ void ScriptManager::createReferenceTable() { _referenceTable[criteriaIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well - if (criteriaIter->argument) + if (criteriaIter->argumentIsAKey) + _referenceTable[criteriaIter->argument].push_back(puzzlePtr); + } + } + + // Iterate through each global Puzzle + for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) { + Puzzle *puzzlePtr = &(*globalPuzzleIter); + + // Iterate through each Criteria and add a reference from the criteria key to the Puzzle + for (Common::List::iterator criteriaIter = globalPuzzleIter->criteriaList.begin(); criteriaIter != (*globalPuzzleIter).criteriaList.end(); criteriaIter++) { + _referenceTable[criteriaIter->key].push_back(puzzlePtr); + + // If the argument is a key, add a reference to it as well + if (criteriaIter->argumentIsAKey) _referenceTable[criteriaIter->argument].push_back(puzzlePtr); } } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 484069b33520..63dc4f880431 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -59,6 +59,8 @@ class ScriptManager { Common::Stack _puzzlesToCheck; /** Holds the currently active puzzles */ Common::List _activePuzzles; + /** Holds the global puzzles */ + Common::List_globalPuzzles; /** Holds the currently active controls */ Common::List > _activeControls; @@ -82,9 +84,10 @@ class ScriptManager { /** * Parses a script file into triggers and events * - * @param fileName Name of the .scr file + * @param fileName Name of the .scr file + * @param isGlobal Are the puzzles included in the file global (true). AKA, the won't be purged during location changes */ - void parseScrFile(const Common::String &fileName); + void parseScrFile(const Common::String &fileName, bool isGlobal = false); /** * Parses the stream into a Puzzle object From dd11566ffdb46a867550e82b3605e3c76cf194a3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:28:41 -0500 Subject: [PATCH 0484/1332] ZVISION: Move the ScriptManager update functions to a single update() function. Then make the individual update functions private --- engines/zvision/script_manager.cpp | 5 +++++ engines/zvision/script_manager.h | 5 +++-- engines/zvision/zvision.cpp | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 027fec43a1c6..4ccbbef92d93 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -39,6 +39,11 @@ void ScriptManager::initialize() { parseScrFile("universe.scr", true); } +void ScriptManager::update(uint deltaTimeMillis) { + updateNodes(deltaTimeMillis); + checkPuzzleCriteria(); +} + void ScriptManager::createReferenceTable() { // Iterate through each local Puzzle for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 63dc4f880431..29994259c9e6 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -67,8 +67,7 @@ class ScriptManager { public: void initialize(); - void updateNodes(uint deltaTimeMillis); - void checkPuzzleCriteria(); + void update(uint deltaTimeMillis); uint getStateValue(uint32 key); void setStateValue(uint32 key, uint value); @@ -80,6 +79,8 @@ class ScriptManager { private: void createReferenceTable(); + void updateNodes(uint deltaTimeMillis); + void checkPuzzleCriteria(); /** * Parses a script file into triggers and events diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index e1f719df0aae..0dd62d7a298b 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -133,8 +133,7 @@ Common::Error ZVision::run() { processEvents(); - _scriptManager->updateNodes(_clock.getDeltaTime()); - _scriptManager->checkPuzzleCriteria(); + _scriptManager->update(_clock.getDeltaTime()); // Update the screen _system->updateScreen(); From c519ea0aa21e774e5a763cbfe98c78165cfcffbb Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 00:29:48 +0200 Subject: [PATCH 0485/1332] AVALANCHE: Remove unnecessary consts from Graphics. --- engines/avalanche/graphics.cpp | 6 +++--- engines/avalanche/graphics.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index aa341f383e75..42a36ff83c5b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -117,7 +117,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { +Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { Common::Point endPoint; const double pi = 3.14; const double convfac = pi / 180.0; @@ -205,12 +205,12 @@ Common::Point Graphics::drawArc(const ::Graphics::Surface &surface, int16 x, int return endPoint; } -void Graphics::drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { +void Graphics::drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { while (radius > 0) drawArc(surface, x, y, stAngle, endAngle, radius--, color); } -void Graphics::drawTriangle(const ::Graphics::Surface &surface, Common::Point *p, byte color) { +void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color) { // Draw the borders with a marking color. _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255); _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 787eb6ded3ed..c4c1e85b02f6 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -88,14 +88,14 @@ class Graphics { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - Common::Point drawArc(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) // TODO: Make it more accurate later. - void drawPieSlice(const ::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); - void drawTriangle(const ::Graphics::Surface &surface, Common::Point *p, byte color); + void drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color); From 2565f96c55b39f5155d10625def873f2c07207e8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:31:57 -0500 Subject: [PATCH 0486/1332] ZVISION: Make ScriptManager::changeLocation delay the actual change until the end of the frame This prevents memory corruption since changeLocation could be called in the middle of a Puzzle list iteration and changeLocation clears all the Puzzle lists. --- engines/zvision/script_manager.cpp | 29 ++++++++++++++++++++++++++--- engines/zvision/script_manager.h | 12 ++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 4ccbbef92d93..586cc2af3847 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -33,7 +33,7 @@ namespace ZVision { -ScriptManager::ScriptManager(ZVision *engine) : _engine(engine) {} +ScriptManager::ScriptManager(ZVision *engine) : _engine(engine), _changeLocation(false) {} void ScriptManager::initialize() { parseScrFile("universe.scr", true); @@ -42,6 +42,11 @@ void ScriptManager::initialize() { void ScriptManager::update(uint deltaTimeMillis) { updateNodes(deltaTimeMillis); checkPuzzleCriteria(); + + if (_changeLocation) { + changeLocationIntern(); + _changeLocation = false; + } } void ScriptManager::createReferenceTable() { @@ -178,6 +183,19 @@ void ScriptManager::addActionNode(const Common::SharedPtr &node) { } void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 x) { + _nextLocation.world = world; + _nextLocation.room = room; + _nextLocation.node = node; + _nextLocation.view = view; + _nextLocation.x = x; + + _changeLocation = true; +} + +void ScriptManager::changeLocationIntern() { + assert(_nextLocation.world != 0); + debug("Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.x); + // Clear all the containers _referenceTable.clear(); _puzzlesToCheck.clear(); @@ -186,16 +204,21 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _activeControls.clear(); // Parse into puzzles and controls - Common::String fileName = Common::String::format("%c%c%c%c.scr", world, room, node, view); + Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view); parseScrFile(fileName); // Create the puzzle reference table createReferenceTable(); - // Add all the puzzles to the stack to be checked + // Add all the local puzzles to the stack to be checked for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { _puzzlesToCheck.push(&(*iter)); } + + // Add all the global puzzles to the stack to be checked + for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + _puzzlesToCheck.push(&(*iter)); + } } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 29994259c9e6..8e79548f7798 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -39,6 +39,14 @@ namespace ZVision { class ZVision; class ActionNode; +struct Location { + char world; + char room; + char node; + char view; + uint32 x; +}; + class ScriptManager { public: ScriptManager(ZVision *engine); @@ -64,6 +72,9 @@ class ScriptManager { /** Holds the currently active controls */ Common::List > _activeControls; + Location _nextLocation; + bool _changeLocation; + public: void initialize(); @@ -79,6 +90,7 @@ class ScriptManager { private: void createReferenceTable(); + void changeLocationIntern(); void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); From 327d4a1ccff41af28b010679a29168b7e839de29 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:32:57 -0500 Subject: [PATCH 0487/1332] ZVISION: Implement ActionChangeLocation::execute() --- engines/zvision/actions.cpp | 6 ++++-- engines/zvision/scr_file_handling.cpp | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 8c10837a1f2f..4fe77c19cec9 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -87,8 +87,10 @@ ActionChangeLocation::ActionChangeLocation(const Common::String &line) { } bool ActionChangeLocation::execute(ZVision *engine) { - // TODO: Implement - return true; + // We can't directly call ScriptManager::ChangeLocationIntern() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking + engine->getScriptManager()->changeLocation(_world, _room, _node, _view, _x); + // Tell the puzzle system to stop checking any more puzzles + return false; } diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index efd122994d37..a47bf0fc0c91 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -162,8 +162,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:change_location*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionChangeLocation(line))); } else if (line.matchString("*:crossfade*", true)) { From 309034c153568372f49d3b5c5c13537e53e2cdeb Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:36:57 -0500 Subject: [PATCH 0488/1332] ZVISION: Stop checking puzzles if ResultAction::execute() returns false --- engines/zvision/script_manager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 586cc2af3847..3a574a366810 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -142,17 +142,21 @@ void ScriptManager::checkPuzzleCriteria() { } } - // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) // criteriaList can be empty. Aka, the puzzle should be executed immediately if (puzzle->criteriaList.empty() || criteriaMet) { debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); + bool shouldContinue = true; for (Common::List >::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { - (*resultIter)->execute(_engine); + shouldContinue = shouldContinue && (*resultIter)->execute(_engine); } // Set the puzzle as completed setStateValue(puzzle->key, 1); + + if (!shouldContinue) { + break; + } } } } From 17a806a01b6def7ef59cc2501cf53dacc902b4e2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:38:33 -0500 Subject: [PATCH 0489/1332] ZVISION: Add parsing skip for action::copy_file. It is not used. I don't really know what it is used for, but Marisa Chan completely ignores it. --- engines/zvision/scr_file_handling.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index a47bf0fc0c91..f116774546b5 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -255,6 +255,8 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:universe_music*", true)) { + } else if (line.matchString("*:copy_file*", true)) { + // Not used. Purposely left empty } else { warning("Unhandled result action type: %s", line.c_str()); } From ee6119d07feea83718f7a3ce9073d92de2747750 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 02:06:11 +0200 Subject: [PATCH 0490/1332] AVALANCHE: Repair Timeout::lose_timer(). --- engines/avalanche/timeout2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index cd6e4dc74fb8..4debd16653f3 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -214,11 +214,10 @@ void Timeout::one_tick() { void Timeout::lose_timer(byte which) { byte fv; - for (fv = 1; fv <= 7; fv++) { - timetype &with = times[fv]; - if (with.what_for == which) - with.time_left = 0; - } /* Cancel this one! */ + for (fv = 0; fv < 7; fv++) { + if (times[fv].what_for == which) + times[fv].time_left = 0; // Cancel this one! + } } /*function timer_is_on(which:byte):boolean; From 698dae201a38218de71888bc54326429be79013e Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 14:06:15 +0200 Subject: [PATCH 0491/1332] AVALANCHE: Introduce Graphics::drawText(). Rename raw to fontType, move it from Gyro to Graphics. Update the rest of the code using these two. Simplifying underlining of characters in Parser and Dropdown. --- engines/avalanche/dropdown2.cpp | 21 +++++++++------------ engines/avalanche/graphics.cpp | 13 +++++++++++++ engines/avalanche/graphics.h | 6 ++++++ engines/avalanche/gyro2.h | 4 +--- engines/avalanche/parser.cpp | 27 ++++----------------------- engines/avalanche/scrolls2.cpp | 25 +++++++++---------------- engines/avalanche/scrolls2.h | 2 +- engines/avalanche/timeout2.cpp | 4 +--- 8 files changed, 44 insertions(+), 58 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index bc8414d1a6c3..89eb231280a4 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -285,28 +285,25 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { else ander = 170; + fontType font; for (byte fv = 0; fv < z.size(); fv++) - for (byte ff = 0; ff < 8; ff++) { - byte pixel = ~(_vm->_gyro->characters[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator! - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2); - // We don't have to bother with the planes, since they all have the same value. See the original. - // Note that it's the bitwise OR operator! - } - } + for (byte ff = 0; ff < 8; ff++) + font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; + _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black); + + // Underline the selected character. if (! z.contains(t)) return; else { byte fv; for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. - // Similar to the cycle before. - byte pixel = ~ ander; + byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2); + if (pixelBit) + *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = black; } } } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 42a36ff83c5b..4b30f6fdb2d4 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -249,6 +249,19 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte +void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color) { + for (byte i = 0; i < text.size(); i++) + for (byte j = 0; j < fontHeight; j++) { + byte pixel = font[text[i]][j]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit) + *(byte *)surface.getBasePtr(x + i * 8 + 7 - bit, y + j) = color; + } + } +} + + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c4c1e85b02f6..7492141c4357 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -36,6 +36,8 @@ namespace Avalanche { class AvalancheEngine; +typedef byte fontType[256][16]; // raw font type + typedef byte manitype[2049]; // manitype = array[5..2053] of byte; // Be aware!!! @@ -99,6 +101,10 @@ class Graphics { + void drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color); + + + // The caller has to .free() the returned Surfaces!!! ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 854b5dfcc813..390011c41e16 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -200,8 +200,6 @@ class linetype : public fieldtype { byte col; }; -typedef byte raw[256][16]; /* raw_font_type */ - enum controllers {cjoy, ckey}; typedef Common::String previoustype[20]; @@ -541,7 +539,7 @@ class Gyro { Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ byte cp, ledstatus, defaultled; - raw characters; + fontType characters; bool alive; byte buffer[2000]; uint16 bufsize; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 86f46c1f08e3..4ce8249eb013 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -93,16 +93,7 @@ void Parser::plotText() { _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. - // Draw the text. Similar to chalk(), but here we don't have to bother with the color of the characters. - for (byte i = 0; i < _vm->_parser->_inputText.size(); i++) - for (byte j = 0; j < 8; j++) { - byte pixel = _vm->_gyro->characters[_vm->_parser->_inputText[i]][j]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - if (pixelBit != 0) - *_vm->_graphics->getPixel(24 + i * 8 + 7 - bit, 161 + j) = white; - } - } + _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, white); cursorOn(); _vm->_gyro->super_on(); @@ -134,19 +125,9 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) { } void Parser::drawCursor() { - // Draw the '_' character. Similar to plotText(). - char cursor = '_'; - - for (byte j = 0; j < 8; j++) { - byte pixel = _vm->_gyro->characters[cursor][j]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - if (pixelBit != 0) - *_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 161 + j) = white; - } - } - - + // Draw the '_' character. + for (byte bit = 0; bit < 8; bit++) + *_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 168) = white; bytefield bf; bf.x1 = _inputTextPos + 1; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8a95d4488711..5aa1cd50fe8e 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -103,9 +103,10 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - byte itw[12][80]; + //byte itw[12][80]; + Common::String text; + fontType itw; byte lz = z.size(); - byte ox = 0; _vm->_logger->log_scrollline(); @@ -123,28 +124,20 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit break; default: { for (byte yy = 0; yy < 12; yy++) - itw[yy][ox] = ~ch[cfont][z[xx]][yy + 2]; - ox++; + itw[z[xx]][yy] = ch[cfont][z[xx]][yy + 2]; + + text += z[xx]; + _vm->_logger->log_scrollchar(Common::String(z[xx])); } } } bool offset = x % 8 == 4; - lz = ox; x = x / 8; y++; - // Similar to Dropdown::chalk(). - for (byte fv = 0; fv < lz; fv++) - for (byte ff = 0; ff < 12; ff++) { - byte pixel = itw[ff][fv]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - uint16 xa = x * 8 + fv * 8 + 7 - bit + offset * 4; - uint16 ya = y + ff; - *(byte *)_vm->_graphics->_scrolls.getBasePtr(xa, ya) = pixelBit + (pixelBit << 1) + (pixelBit << 2); - } - } + + _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, itw, 12, x * 8 + offset *4, y, black); } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index b267ff68f675..8af3402d962a 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -103,7 +103,7 @@ class Scrolls { int16 dix, diy; - raw ch[2]; + fontType ch[2]; byte cfont; // Current font int16 dodgex, dodgey; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 4debd16653f3..459f12415df8 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -212,9 +212,7 @@ void Timeout::one_tick() { } void Timeout::lose_timer(byte which) { - byte fv; - - for (fv = 0; fv < 7; fv++) { + for (byte fv = 0; fv < 7; fv++) { if (times[fv].what_for == which) times[fv].time_left = 0; // Cancel this one! } From 6a187a04ee3d1db26109e4aadae4c7da2d52dc52 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 14:59:53 +0200 Subject: [PATCH 0492/1332] AVALANCHE: Finish implementation of Scrolls::bubble(). --- engines/avalanche/scrolls2.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 5aa1cd50fe8e..94266f37a634 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -103,7 +103,6 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - //byte itw[12][80]; Common::String text; fontType itw; byte lz = z.size(); @@ -137,7 +136,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit x = x / 8; y++; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, itw, 12, x * 8 + offset *4, y, black); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, itw, 12, x * 8 + offset * 4, y, black); } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ @@ -489,8 +488,6 @@ void Scrolls::bubble(func2 gotoit) { _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ //mousepage(1 - cp); /* Mousepage */ - //setfillstyle(1, talkb); - //setcolor(talkb); _vm->_gyro->off(); xl = 0; @@ -519,9 +516,6 @@ void Scrolls::bubble(func2 gotoit) { p[2].x = _vm->_gyro->talkx; p[2].y = _vm->_gyro->talky; - /* mblit(talkx-xw+xc,7,talkx+xw+xc,my,0,3); - mblit(talkx-10,my,talkx+10,talky,0,3);*/ - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. @@ -540,11 +534,15 @@ void Scrolls::bubble(func2 gotoit) { // "Tail" of the speech bubble. _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->talkb); - //setcolor(talkf); + yl -= 3; - //settextjustify(1, 2); - /*for (fv = 0; fv < _vm->_gyro->scrolln; fv++) - outtextxy(_vm->_gyro->talkx + xc, (fv * 10) + 12, _vm->_gyro->scroll[fv + 1]);*/ + + // Draw the text of the bubble. + for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { + int16 x = _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; + bool offset = _vm->_gyro->scroll[fv].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 12, (fv * 10) + 12, white); + } for (fv = 0; fv < _vm->_gyro->scrolln; fv++) /* These should be separate loops. */ _vm->_logger->log_bubbleline(fv, param, _vm->_gyro->scroll[fv]); @@ -561,19 +559,13 @@ void Scrolls::bubble(func2 gotoit) { _vm->_gyro->off(); _vm->_gyro->dropsok = true; - /*mblit((talkx - xw + xc) / 8, 7, 1 + (talkx + xw + xc) / 8, my, 3, 1 - cp); - mblit((talkx - 10) / 8, my, 1 + (talkx + 10) / 8, talky, 3, 1 - cp); - blitfix();*/ /*setvisualpage(cp); - settextjustify(0, 0);*/ _vm->_gyro->on(); /*sink;*/ _vm->_gyro->oncandopageswap = true; resetscrolldriver(); if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true; - - warning("STUB: Scrolls::bubble()"); } bool Scrolls::ask(Common::String question) { From 960c8b26302f4bd09ed5ac632077bfbddaff2a35 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 15:06:57 +0200 Subject: [PATCH 0493/1332] AVALANCHE: Improve comments in Scrolls::bubble(). --- engines/avalanche/scrolls2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 94266f37a634..93d942afdb99 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -516,6 +516,7 @@ void Scrolls::bubble(func2 gotoit) { p[2].x = _vm->_gyro->talkx; p[2].y = _vm->_gyro->talky; + // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. @@ -537,7 +538,9 @@ void Scrolls::bubble(func2 gotoit) { yl -= 3; - // Draw the text of the bubble. + // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). + // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. + // It's almost the same, only notable differences are '?', '!', etc. for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { int16 x = _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; bool offset = _vm->_gyro->scroll[fv].size() % 2; @@ -555,6 +558,7 @@ void Scrolls::bubble(func2 gotoit) { _vm->_gyro->on(); _vm->_gyro->dropsok = false; + // This does the actual drawing to the screen. (this->*gotoit)(); _vm->_gyro->off(); From c6b82e7753f24a3ea03596204f62975666aa2239 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 13:39:52 -0500 Subject: [PATCH 0494/1332] ZVISION: Fix parsed arguments in ActionStreamVideo --- engines/zvision/actions.cpp | 5 +++-- engines/zvision/actions.h | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 4fe77c19cec9..2316530c6726 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -259,7 +259,7 @@ ActionStreamVideo::ActionStreamVideo(const Common::String &line) { char fileName[25]; uint skippable; - sscanf(line.c_str(), "%*[^(](%25s %u %u %u %u %u %u)", fileName, &_x, &_y, &_width, &_height, &_flags, &skippable); + sscanf(line.c_str(), "%*[^(](%25s %u %u %u %u %u %u)", fileName, &_x1, &_y1, &_x2, &_y2, &_flags, &skippable); _fileName = Common::String(fileName); _skippable = (skippable == 0) ? false : true; @@ -272,8 +272,9 @@ bool ActionStreamVideo::execute(ZVision *engine) { } Common::Rect destRect; + // 0x1 flags that the destRect dimensions are different from the original video dimensions if ((_flags & 0x1) == 0x1) { - destRect = Common::Rect(_x, _y, _x + _width, _y + _height); + destRect = Common::Rect(_x1, _y1, _x2, _y2); } engine->playVideo(decoder, destRect, _skippable); diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index bb446171fe3a..8e00cb5e537f 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -293,10 +293,10 @@ class ActionStreamVideo : public ResultAction { private: Common::String _fileName; - uint _x; - uint _y; - uint _width; - uint _height; + uint _x1; + uint _y1; + uint _x2; + uint _y2; uint _flags; bool _skippable; }; From bd4e6e0c1873d6a1fe387114d06ec95a0756a2db Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 13:40:23 -0500 Subject: [PATCH 0495/1332] ZVISION: Remove Graphics::Cursor inheritance and remove extraneous methods --- engines/zvision/cursor.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index 0d91a48f0f5c..77093c4dafb9 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -33,7 +33,7 @@ class String; namespace ZVision { -class ZorkCursor : public Graphics::Cursor { +class ZorkCursor { public: ZorkCursor(); ZorkCursor(const Common::String &fileName); @@ -56,9 +56,6 @@ class ZorkCursor : public Graphics::Cursor { uint16 getHotspotY() const { return _hotspotY; } byte getKeyColor() const { return 0; } const byte *getSurface() const { return _surface; } - const byte *getPalette() const { return 0; } - byte getPaletteStartIndex() const { return 0; } - uint16 getPaletteCount() const { return 0; } }; } // End of namespace ZVision From f6033afa0252384e618adebd0f1aef5867a312f8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 13:42:00 -0500 Subject: [PATCH 0496/1332] ZVISION: Change CursorManager to go through CursorMan instead going directly to OSystem This had to be done so the cursor didn't disappear after the user went to GMM or debug console --- engines/zvision/cursor_manager.cpp | 29 +++++++++++++++++++---------- engines/zvision/cursor_manager.h | 9 ++++++++- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 0115ec9d3c78..6f60ddf018c3 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -24,6 +24,7 @@ #include "common/system.h" #include "graphics/pixelformat.h" +#include "graphics/cursorman.h" #include "zvision/zvision.h" #include "zvision/cursor_manager.h" @@ -44,8 +45,7 @@ const char *CursorManager::_zNemCursorFileNames[] = { "00act", "arrow", "back", CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat) : _engine(engine), _pixelFormat(pixelFormat), - _cursorIsPushed(false), - _currentCursor("idle") { + _cursorIsPushed(false) { // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly if (_engine->getGameId() == ZorkNemesis) { Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[11])); @@ -53,15 +53,20 @@ CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixel } else if (_engine->getGameId() == ZorkGrandInquisitor) { _idleCursor = ZorkCursor(_zgiCursorFileNames[11]); } + revertToIdle(); } void CursorManager::initialize() { - _engine->_system->setMouseCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); - _engine->_system->showMouse(true); + CursorMan.showMouse(true); } -void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { - _cursorIsPushed = pushed; +void CursorManager::changeCursor(const Common::String &cursorName) { + changeCursor(cursorName, _cursorIsPushed); +} + +void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) { + if (_cursorIsPushed != pushed) + _cursorIsPushed = pushed; if (cursorName == "idle" && !pushed) { revertToIdle(); @@ -71,7 +76,9 @@ void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { // WARNING: The range of this loop is hardcoded to the length of _cursorNames for (int i = 0; i < 18; i++) { if (_engine->getGameId() == ZorkNemesis) { - if (_cursorNames[i] == cursorName) { + if (cursorName.equals(_cursorNames[i])) { + _currentCursor = cursorName; + // ZNem uses a/b at the end of the file to signify not pushed/pushed respectively Common::String pushedFlag = pushed ? "b" : "a"; Common::String name = Common::String::format("%s%s.zcr", _zNemCursorFileNames[i], pushedFlag.c_str()); @@ -80,7 +87,9 @@ void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { return; } } else if (_engine->getGameId() == ZorkGrandInquisitor) { - if (_cursorNames[i] == cursorName) { + if (cursorName.equals(_cursorNames[i])) { + _currentCursor = cursorName; + if (!pushed) { changeCursor(ZorkCursor(_zgiCursorFileNames[i])); } else { @@ -100,7 +109,7 @@ void CursorManager::changeCursor(Common::String &cursorName, bool pushed) { } void CursorManager::changeCursor(const ZorkCursor &cursor) { - _engine->_system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor(), false, _pixelFormat); + CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor(), false, _pixelFormat); } void CursorManager::cursorDown(bool pushed) { @@ -113,7 +122,7 @@ void CursorManager::cursorDown(bool pushed) { void CursorManager::revertToIdle() { _currentCursor = "idle"; - _engine->_system->setMouseCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); + CursorMan.replaceCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); } } // End of namespace ZVision diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index 914538591d49..9f624c82ccba 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -36,6 +36,12 @@ namespace ZVision { class ZVision; +/** + * Class to manage cursor changes. The actual changes have to be done + * through CursorMan. Otherwise the cursor will disappear after GMM + * or debug console. + * TODO: Figure out a way to get rid of the extraneous data copying due to having to use CursorMan + */ class CursorManager { public: CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat); @@ -54,7 +60,8 @@ class CursorManager { public: void initialize(); - void changeCursor(Common::String &cursorName, bool pushed); + void changeCursor(const Common::String &cursorName); + void changeCursor(const Common::String &cursorName, bool pushed); void cursorDown(bool pushed); void revertToIdle(); From b76927ab4eb5e199f7be6d068a94dc3c531122b1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 13:43:29 -0500 Subject: [PATCH 0497/1332] ZVISION: Remove extraneous _needsScreenUpdate bool --- engines/zvision/render_manager.cpp | 2 -- engines/zvision/render_manager.h | 3 --- 2 files changed, 5 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index f759c1fb9690..132c5971409b 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -39,7 +39,6 @@ RenderManager::RenderManager(OSystem *system, const int width, const int height) _width(width), _height(height), _currentBackground(0), - _needsScreenUpdate(false), _renderTable(width, height) { } @@ -141,7 +140,6 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint tga.destroy(); } - _needsScreenUpdate = true; } RenderTable *RenderManager::getRenderTable() { diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 4b4e178e91fb..6e267eb39534 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -57,8 +57,6 @@ class RenderManager { Video::VideoDecoder *_currentVideo; byte *_scaledVideoFrameBuffer; - bool _needsScreenUpdate; - public: void initialize(); @@ -94,7 +92,6 @@ class RenderManager { RenderTable *getRenderTable(); - bool needsScreenUpdate() { return _needsScreenUpdate; }; private: void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter); From a3315037ffde458ff8356c5e7ef9913c4f7b245c Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 13:44:23 -0500 Subject: [PATCH 0498/1332] ZVISION: Create methods for converting screen coords to image coords --- engines/zvision/render_manager.cpp | 12 ++++++++++++ engines/zvision/render_manager.h | 4 +++- engines/zvision/render_table.cpp | 17 +++++++++++++++++ engines/zvision/render_table.h | 3 +++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 132c5971409b..2d45ad835d17 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -80,6 +80,8 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin destRect.moveTo((_width - subRectangle.width()) / 2, (_height - subRectangle.height()) / 2); } + _backgroundOffset = Common::Point(destRect.left, destRect.top); + if (_renderTable.getRenderState() == RenderTable::FLAT) { _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { @@ -139,7 +141,17 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint tga.destroy(); } +} + +const Common::Point RenderManager::convertToImageCoords(const Common::Point &point) { + Common::Point newPoint(point); + + if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { + newPoint = _renderTable.convertWarpedPointToFlatCoords(newPoint); + } + newPoint -= _backgroundOffset; + return newPoint; } RenderTable *RenderManager::getRenderTable() { diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 6e267eb39534..aea24505a9d1 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -53,6 +53,7 @@ class RenderManager { RenderTable _renderTable; Common::SeekableReadStream *_currentBackground; + Common::Point _backgroundOffset; Video::VideoDecoder *_currentVideo; byte *_scaledVideoFrameBuffer; @@ -90,8 +91,9 @@ class RenderManager { */ void setBackgroundImage(const Common::String &fileName); - RenderTable *getRenderTable(); + const Common::Point convertToImageCoords(const Common::Point &point); + RenderTable *getRenderTable(); private: void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter); diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index b6598c12b2f4..2a111ce65910 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -60,6 +60,16 @@ void RenderTable::setRenderState(RenderState newState) { } } +const Common::Point RenderTable::convertWarpedPointToFlatCoords(const Common::Point &point) { + uint32 index = point.y * _numColumns + point.x; + + Common::Point newPoint(point); + newPoint.x += _internalBuffer[index].x; + newPoint.y += _internalBuffer[index].y; + + return newPoint; +} + uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { assert(percentColorOne < 1.0f); @@ -157,7 +167,14 @@ void RenderTable::generatePanoramaLookupTable() { } void RenderTable::generateTiltLookupTable() { + for (uint x = 0; x < _numColumns; x++) { + for (uint y = 0; y < _numRows; y++) { + uint32 index = y * _numColumns + x; + _internalBuffer[index].x = 0; + _internalBuffer[index].y = 0; + } + } } void RenderTable::setPanoramaFoV(float fov) { diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 82bea62769f8..5cef0620452b 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -63,6 +63,9 @@ class RenderTable { public: RenderState getRenderState() { return _renderState; } void setRenderState(RenderState newState); + + const Common::Point convertWarpedPointToFlatCoords(const Common::Point &point); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); void generateRenderTable(); From 3eb6c0ebd8c523c0c66e639fc1ea1f02b8575231 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:02:38 -0500 Subject: [PATCH 0499/1332] ZVISION: Convert hardcoded constants to anonymous enum variables --- engines/zvision/cursor_manager.cpp | 23 +++++++++++------------ engines/zvision/cursor_manager.h | 6 ++++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 6f60ddf018c3..698168b72aa1 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -32,31 +32,31 @@ namespace ZVision { -const char *CursorManager::_cursorNames[] = { "active", "arrow", "backward", "downarrow", "forward", "handpt", "handpu", "hdown", "hleft", - "hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" }; +const char *CursorManager::_cursorNames[NUM_CURSORS] = { "active", "arrow", "backward", "downarrow", "forward", "handpt", "handpu", "hdown", "hleft", + "hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" }; -const char *CursorManager::_zgiCursorFileNames[] = { "g0gbc011.zcr", "g0gac001.zcr", "g0gac021.zcr", "g0gac031.zcr", "g0gac041.zcr", "g0gac051.zcr", "g0gac061.zcr", "g0gac071.zcr", "g0gac081.zcr", - "g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" }; +const char *CursorManager::_zgiCursorFileNames[NUM_CURSORS] = { "g0gbc011.zcr", "g0gac001.zcr", "g0gac021.zcr", "g0gac031.zcr", "g0gac041.zcr", "g0gac051.zcr", "g0gac061.zcr", "g0gac071.zcr", "g0gac081.zcr", + "g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" }; -const char *CursorManager::_zNemCursorFileNames[] = { "00act", "arrow", "back", "down", "forw", "handpt", "handpu", "hdown", "hleft", - "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" }; +const char *CursorManager::_zNemCursorFileNames[NUM_CURSORS] = { "00act", "arrow", "back", "down", "forw", "handpt", "handpu", "hdown", "hleft", + "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" }; CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat) : _engine(engine), _pixelFormat(pixelFormat), _cursorIsPushed(false) { - // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly + // WARNING: The index IDLE_CURSOR_INDEX is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly if (_engine->getGameId() == ZorkNemesis) { - Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[11])); + Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[IDLE_CURSOR_INDEX])); _idleCursor = ZorkCursor(name); } else if (_engine->getGameId() == ZorkGrandInquisitor) { - _idleCursor = ZorkCursor(_zgiCursorFileNames[11]); + _idleCursor = ZorkCursor(_zgiCursorFileNames[IDLE_CURSOR_INDEX]); } - revertToIdle(); } void CursorManager::initialize() { + revertToIdle(); CursorMan.showMouse(true); } @@ -73,8 +73,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) return; } - // WARNING: The range of this loop is hardcoded to the length of _cursorNames - for (int i = 0; i < 18; i++) { + for (int i = 0; i < NUM_CURSORS; i++) { if (_engine->getGameId() == ZorkNemesis) { if (cursorName.equals(_cursorNames[i])) { _currentCursor = cursorName; diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index 9f624c82ccba..496c652c8c3b 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -47,6 +47,12 @@ class CursorManager { CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat); private: + enum { + NUM_CURSORS = 18, + // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly + IDLE_CURSOR_INDEX = 11 + }; + ZVision *_engine; const Graphics::PixelFormat *_pixelFormat; ZorkCursor _idleCursor; From 668b0e6c892c67253fe5d763ab752bf7dfbd1c3f Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:03:30 -0500 Subject: [PATCH 0500/1332] ZVISION: Throw a warning when a .scr file isn't opened --- engines/zvision/scr_file_handling.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index f116774546b5..6a71fe474abc 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -35,8 +35,10 @@ namespace ZVision { void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) { Common::File file; - if (!file.open(fileName)) - return; // File.open already throws a warning if the file doesn't exist, so there is no need to throw another + if (!file.open(fileName)) { + warning("Script file not found: %s", fileName.c_str()); + return; + } while(!file.eos()) { Common::String line = file.readLine(); From 19e829ae95bc69f470d285bdf90d4b45b42248a4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:04:03 -0500 Subject: [PATCH 0501/1332] ZVISION: Ignore .scr file lines that are empty --- engines/zvision/scr_file_handling.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 6a71fe474abc..cd4baa34f07d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -148,6 +148,13 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis // TODO: Re-order the if-then statements in order of highest occurrence while (!line.contains('}')) { + if (line.empty()) { + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + continue; + } + // Parse for the action type if (line.matchString("*:add*", true)) { actionList.push_back(Common::SharedPtr(new ActionAdd(line))); From 9f0420e1cef30eaebdf28c32f70fe6467bb9a227 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:04:46 -0500 Subject: [PATCH 0502/1332] ZVISION: Change the initializer list formatting to conform to how everything else is formatted --- engines/zvision/script_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 3a574a366810..9faff18d3c22 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -33,7 +33,10 @@ namespace ZVision { -ScriptManager::ScriptManager(ZVision *engine) : _engine(engine), _changeLocation(false) {} +ScriptManager::ScriptManager(ZVision *engine) + : _engine(engine), + _changeLocation(false) { +} void ScriptManager::initialize() { parseScrFile("universe.scr", true); From 9681d7515e769b4db2566b4c17328bb836fe9d41 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:05:38 -0500 Subject: [PATCH 0503/1332] ZVISION: Fix enum qualifiers --- engines/zvision/script_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 9faff18d3c22..c8c6f6c621d9 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -107,8 +107,8 @@ void ScriptManager::checkPuzzleCriteria() { // If it doesn't have the flag ONCE_PER_INST it can be done more than once // Also check that the puzzle isn't disabled if (getStateValue(puzzle->key) == 1 && - (puzzle->flags & Puzzle::StateFlags::ONCE_PER_INST) == Puzzle::StateFlags::ONCE_PER_INST && - (puzzle->flags & Puzzle::StateFlags::DISABLED) == 0) { + (puzzle->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST && + (puzzle->flags & Puzzle::DISABLED) == 0) { continue; } From 553a3ced68914f965a5d86c262d338d2bcfc8095 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:06:11 -0500 Subject: [PATCH 0504/1332] ZVISION: Remove a verbose debug message --- engines/zvision/script_manager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index c8c6f6c621d9..da2a3814dc78 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -112,8 +112,6 @@ void ScriptManager::checkPuzzleCriteria() { continue; } - debug("Checking puzzle: %u", puzzle->key); - // Check each Criteria bool criteriaMet = false; for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { From ca7680599534aec4f89a65bb5a087e3372488896 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:06:45 -0500 Subject: [PATCH 0505/1332] ZVISION: Fix accidental redeclaration of the scale variable --- engines/zvision/video.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 9f98b1474614..b3e32b770385 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -96,7 +96,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d // Assume bilinear scaling. AKA calculate the scale from just the width. // Also assume that the scaling is in integral intervals. AKA no 1.5x scaling // TODO: Test ^these^ assumptions - uint scale = destRect.width() / origWidth; + scale = destRect.width() / origWidth; // TODO: Test if we need to support downscale. } From 14076ad0e9daeac9e29349920d3948d59b5340a9 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 11 Aug 2013 22:07:42 +0200 Subject: [PATCH 0506/1332] AVALANCHE: Remove unnecessary comments from Avalot::setup(). --- engines/avalanche/avalot.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3f4c545e9d6c..d3779cbc2444 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -147,10 +147,8 @@ void Avalot::setup() { _vm->_parser->cursorOn(); _vm->_trip->newspeed(); - //if (! _vm->_gyro->reloaded) - // _vm->_visa->dixi('q', 83); /* Info on the game: etc. */ - // - // TODO: UNCOMMENT THIS! ONLY COMMENTED OUT FOR TESTING!!! + if (! _vm->_gyro->reloaded) + _vm->_visa->dixi('q', 83); // Info on the game, etc. } From dd77956819091d4a8d3578375fc66a02f4e8283b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:08:22 -0500 Subject: [PATCH 0507/1332] ZVISION: Move SearchMan directory registration outside ZVision constructor The launcher can do some extra changes within SearchMan after engine constructor. This makes sure everything is set before registering more directories --- engines/zvision/zvision.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0dd62d7a298b..72441eb8ad21 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -60,17 +60,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Do not initialize graphics here - // However this is the place to specify all default directories - const Common::FSNode gameDataDir(ConfMan.get("path")); - // TODO: There are 10 file clashes when we flatten the directories. From a quick look, the files are exactly the same, so it shouldn't matter. But I'm noting it here just in-case it does become a problem. - SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets1", 0, 2, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "zassets2", 0, 2, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); - SearchMan.addSubDirectoryMatching(gameDataDir, "zgi", 0, 4, true); - // Here is the right place to set up the engine specific debug channels //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); @@ -101,6 +90,16 @@ ZVision::~ZVision() { } void ZVision::initialize() { + const Common::FSNode gameDataDir(ConfMan.get("path")); + // TODO: There are 10 file clashes when we flatten the directories. From a quick look, the files are exactly the same, so it shouldn't matter. But I'm noting it here just in-case it does become a problem. + SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets1", 0, 2, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zassets2", 0, 2, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "zgi", 0, 4, true); + // Find zfs archive files Common::ArchiveMemberList list; SearchMan.listMatchingMembers(list, "*.zfs"); From 3e8bc76127a66ad631095de94a57c31aabb7d6b4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:09:19 -0500 Subject: [PATCH 0508/1332] ZVISION: Create MousEvent class to handle mouse hovers/clicks --- engines/zvision/module.mk | 1 + engines/zvision/mouse_event.cpp | 45 +++++++++++++++++++++++++ engines/zvision/mouse_event.h | 58 +++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 engines/zvision/mouse_event.cpp create mode 100644 engines/zvision/mouse_event.h diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 7e74b0bfdda4..f072520d1616 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -11,6 +11,7 @@ MODULE_OBJS := \ detection.o \ events.o \ lzss_read_stream.o \ + mouse_event.o \ render_manager.o \ render_table.o \ scr_file_handling.o \ diff --git a/engines/zvision/mouse_event.cpp b/engines/zvision/mouse_event.cpp new file mode 100644 index 000000000000..a7c9fe557391 --- /dev/null +++ b/engines/zvision/mouse_event.cpp @@ -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. +* +*/ + +#include "common/scummsys.h" + +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/mouse_event.h" + +namespace ZVision { + +MouseEvent::MouseEvent(uint32 key, const Common::Rect &hotspot, const Common::String hoverCursor) + : _key(key), + _hotspot(hotspot), + _hoverCursor(hoverCursor) { +} + +bool MouseEvent::withinHotspot(const Common::Point &point) { + return _hotspot.contains(point); +} + +void MouseEvent::onClick(ZVision *engine) { + engine->getScriptManager()->setStateValue(_key, 1); +} + +} // End of namespace ZVision diff --git a/engines/zvision/mouse_event.h b/engines/zvision/mouse_event.h new file mode 100644 index 000000000000..1fbd1603a30f --- /dev/null +++ b/engines/zvision/mouse_event.h @@ -0,0 +1,58 @@ +/* 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 ZVISION_MOUSE_EVENT_H +#define ZVISION_MOUSE_EVENT_H + +#include "common/types.h" +#include "common/rect.h" +#include "common/str.h" + +namespace ZVision { + +class ZVision; + +class MouseEvent { +public: + MouseEvent(uint32 key, const Common::Rect &hotspot, const Common::String hoverCursor); + +private: + /** The Control key */ + uint32 _key; + /** + * The area that will trigger the event + * This is in image space coordinates, NOT screen space + */ + Common::Rect _hotspot; + /** The cursor to use when hovering over _hotspot */ + Common::String _hoverCursor; + +public: + bool withinHotspot(const Common::Point &point); + void onClick(ZVision *engine); + const Common::String getHoverCursor() { return _hoverCursor; } +}; + +} // End of namespace ZVision + +#endif From 269bed7c7d279e0785056a4e5ba1622317402449 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:10:52 -0500 Subject: [PATCH 0509/1332] ZVISION: Implement mouse event handling --- engines/zvision/events.cpp | 32 ++++++++++++++++++++++++++++++ engines/zvision/script_manager.cpp | 2 ++ engines/zvision/zvision.h | 7 +++++++ 3 files changed, 41 insertions(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 17f48db7fca5..79ef0bd6b010 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -28,9 +28,19 @@ #include "engines/util.h" #include "zvision/cursor_manager.h" +#include "zvision/render_manager.h" +#include "zvision/mouse_event.h" namespace ZVision { +void ZVision::registerMouseEvent(const MouseEvent &event) { + _mouseEvents.push_back(event); +} + +void ZVision::clearAllMouseEvents() { + _mouseEvents.clear(); +} + void ZVision::processEvents() { while (_eventMan->pollEvent(_event)) { switch (_event.type) { @@ -84,10 +94,32 @@ void ZVision::onMouseDown(const Common::Point &pos) { void ZVision::onMouseUp(const Common::Point &pos) { _cursorManager->cursorDown(false); + + Common::Point imageCoord(_renderManager->convertToImageCoords(pos)); + + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + if (iter->withinHotspot(imageCoord)) { + iter->onClick(this); + } + } } void ZVision::onMouseMove(const Common::Point &pos) { + Common::Point imageCoord(_renderManager->convertToImageCoords(pos)); + + bool isWithinAHotspot = false; + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + if (iter->withinHotspot(imageCoord)) { + _cursorManager->changeCursor(iter->getHoverCursor()); + isWithinAHotspot = true; + } + } + + + if (!isWithinAHotspot) { + _cursorManager->revertToIdle(); + } } void ZVision::onKeyDown(uint keyCode) { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index da2a3814dc78..03e791720cb2 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -26,6 +26,7 @@ #include "common/hashmap.h" #include "common/debug.h" +#include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/actions.h" #include "zvision/action_node.h" @@ -207,6 +208,7 @@ void ScriptManager::changeLocationIntern() { _activePuzzles.clear(); // We can clear without deleting from the heap because we use SharedPtr _activeControls.clear(); + _engine->clearAllMouseEvents(); // Parse into puzzles and controls Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 8363fb1672b5..bf42bf2621f3 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -33,6 +33,7 @@ #include "zvision/detection.h" #include "zvision/clock.h" +#include "zvision/mouse_event.h" #include "gui/debugger.h" @@ -82,6 +83,9 @@ class ZVision : public Engine { // Clock Clock _clock; + // To store the current mouse events + Common::List _mouseEvents; + // To prevent allocation every time we process events Common::Event _event; @@ -99,6 +103,9 @@ class ZVision : public Engine { void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); + void registerMouseEvent(const MouseEvent &event); + void clearAllMouseEvents(); + void cycleThroughCursors(); private: From 00a17a66d0e8317001829fe36639ef9201d15798 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 15:12:01 -0500 Subject: [PATCH 0510/1332] ZVISION: Implement push_toggle control handling --- engines/zvision/control.cpp | 35 +++++++++++++++++++++++++++ engines/zvision/control.h | 1 + engines/zvision/scr_file_handling.cpp | 3 ++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index fdb88c68e17a..02d15fe9d0cf 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -102,4 +102,39 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } +void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) { + Common::Rect hotspot; + Common::String cursorName; + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!line.contains('}')) { + if (line.matchString("*_hotspot*", true)) { + uint x; + uint y; + uint width; + uint height; + + sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height); + + hotspot = Common::Rect(x, y, x + width, y + height); + } else if (line.matchString("cursor*", true)) { + char nameBuffer[25]; + + sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer); + + cursorName = Common::String(nameBuffer); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } + + if (!hotspot.isEmpty() && !cursorName.empty()) { + engine->registerMouseEvent(MouseEvent(key, hotspot, cursorName)); + } +} + } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index edc0fc29302d..2d5426c0c420 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -46,6 +46,7 @@ class Control { static void parseFlatControl(ZVision *engine); static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream); static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); + static void parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream); }; } // End of namespace ZVision diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index cd4baa34f07d..5b8af4804717 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -309,7 +309,8 @@ bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea Common::String controlType(controlTypeBuffer); if (controlType.equalsIgnoreCase("push_toggle")) { - + Control::parsePushToggleControl(key, _engine, stream); + return false; } else if (controlType.equalsIgnoreCase("flat")) { Control::parseFlatControl(_engine); return false; From a49b77cd799a081d04a14f8eeaf8e61b678507bf Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:38:10 -0500 Subject: [PATCH 0511/1332] ZVISION: Fix memory leak --- engines/zvision/render_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 2d45ad835d17..e705a7f8b4f2 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -166,6 +166,9 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { return; } + if (_currentBackground != 0) { + delete _currentBackground; + } _currentBackground = file; renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(), true); From 19a2a59c3cf9c9baf8d0366ab59d8a0ec2d0d7e4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:39:21 -0500 Subject: [PATCH 0512/1332] ZVISION: Fix unsigned/signed mismatch --- engines/zvision/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index b3e32b770385..ca95a7e5f3c9 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -47,7 +47,7 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, for (uint32 x = 0; x < srcWidth; x++) { const byte color = *srcPtr++; - for (int i = 0; i < scaleAmount; i++) { + for (uint i = 0; i < scaleAmount; i++) { dst[i] = color; dst[pitch + i] = color; } @@ -61,11 +61,11 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, const byte color = *srcPtr++; const byte color2 = *srcPtr++; - for (int i = 0; i < scaleAmount; i++) { dst[i] = color; dst[i + 1] = color2; dst[pitch + i] = color; dst[pitch + i + 1] = color2; + for (uint i = 0; i < scaleAmount; i++) { } dst += 2 * scaleAmount; } From 5ef23e6f8daffd65dd605a28252398d1556760fe Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:39:56 -0500 Subject: [PATCH 0513/1332] ZVISION: Restart the Clock after the video finishes --- engines/zvision/video.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index ca95a7e5f3c9..0d707e7037fc 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -156,7 +156,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d _system->delayMillis(videoDecoder.getTimeToNextFrame()); } - _clock.stop(); + _clock.start(); // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); From e3f352cb0c3247f72dfc1f6fe65c57ada64f9755 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:40:32 -0500 Subject: [PATCH 0514/1332] ZVISION: Delete the scaledVideoFrameBuffer after we're done with it --- engines/zvision/video.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 0d707e7037fc..2a320cb79015 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -158,6 +158,8 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d _clock.start(); + delete[] scaledVideoFrameBuffer; + // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); } From d8e45fc438a546bd7e1f8c66e345aafb33bb2a56 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:42:40 -0500 Subject: [PATCH 0515/1332] ZVISION: Only allocate memory for the scaled buffer if we're actually going to scale the video --- engines/zvision/video.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 2a320cb79015..0836eef496b8 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -106,7 +106,10 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d uint16 finalWidth = origWidth * scale; uint16 finalHeight = origHeight * scale; - byte *scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; + byte *scaledVideoFrameBuffer; + if (scale != 1) { + scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; + } uint16 x = ((_width - finalWidth) / 2) + destRect.left; uint16 y = ((_height - finalHeight) / 2) + destRect.top; @@ -158,7 +161,9 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d _clock.start(); - delete[] scaledVideoFrameBuffer; + if (scale != 1) { + delete[] scaledVideoFrameBuffer; + } // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); From 372c55fd8be80182721566f09ab2d69c9f24abc5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:43:39 -0500 Subject: [PATCH 0516/1332] VIDEO: Disable SCI_32 plugin guard for DUCK Truemotion ZVision AVI videos use DUCK Truemotion --- video/codecs/truemotion1.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/codecs/truemotion1.h b/video/codecs/truemotion1.h index b2a35cf8730d..39950b3ea600 100644 --- a/video/codecs/truemotion1.h +++ b/video/codecs/truemotion1.h @@ -23,7 +23,7 @@ // Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg // Only compile if SCI32 is enabled or if we're building dynamic modules -#if defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES) +//#if defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES) #ifndef VIDEO_CODECS_TRUEMOTION1_H #define VIDEO_CODECS_TRUEMOTION1_H @@ -106,4 +106,4 @@ class TrueMotion1Decoder : public Codec { } // End of namespace Video #endif // VIDEO_CODECS_TRUEMOTION1_H -#endif // SCI32/Plugins guard +//#endif // SCI32/Plugins guard From 7e93b6407a14c3c3fe75f03667362fcf8555e69d Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:44:13 -0500 Subject: [PATCH 0517/1332] ZVISION: Fix frame scaling for 2bpp --- engines/zvision/video.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 0836eef496b8..f9637d36a4c3 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -61,11 +61,13 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, const byte color = *srcPtr++; const byte color2 = *srcPtr++; - dst[i] = color; - dst[i + 1] = color2; - dst[pitch + i] = color; - dst[pitch + i + 1] = color2; for (uint i = 0; i < scaleAmount; i++) { + uint index = i *2; + + dst[index] = color; + dst[index + 1] = color2; + dst[pitch + index] = color; + dst[pitch + index + 1] = color2; } dst += 2 * scaleAmount; } From b9b8207a140531079f3e200e6858a8dc9cc7b5d2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:44:52 -0500 Subject: [PATCH 0518/1332] ZVISION: Dispose of .zfs file streams after processing them --- engines/zvision/zvision.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 72441eb8ad21..7f925e982875 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -107,7 +107,10 @@ void ZVision::initialize() { // Register the file entries within the zfs archives with the SearchMan for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { Common::String name = (*iter)->getName(); - ZfsArchive *archive = new ZfsArchive(name, (*iter)->createReadStream()); + Common::SeekableReadStream *stream = (*iter)->createReadStream(); + ZfsArchive *archive = new ZfsArchive(name, stream); + + delete stream; SearchMan.add(name, archive); } From d8798e978a695a1b6ebd853bd05790d11c5fe4f9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 12:52:17 +0200 Subject: [PATCH 0519/1332] AVALANCHE: Repair Graphics::drawText() and Scrolls::say(). --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/scrolls2.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4b30f6fdb2d4..0b3a26495c72 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -252,7 +252,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color) { for (byte i = 0; i < text.size(); i++) for (byte j = 0; j < fontHeight; j++) { - byte pixel = font[text[i]][j]; + byte pixel = font[(byte)text[i]][j]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 93d942afdb99..99bef8e982f5 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -123,7 +123,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit break; default: { for (byte yy = 0; yy < 12; yy++) - itw[z[xx]][yy] = ch[cfont][z[xx]][yy + 2]; + itw[(byte)z[xx]][yy] = ch[cfont][(byte)z[xx]][yy + 2]; text += z[xx]; @@ -857,7 +857,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(ch[0][i],16); + f.read(ch[0][i], 16); f.close(); if (!f.open("avitalic.fnt")) { @@ -865,7 +865,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(ch[1][i],16); + f.read(ch[1][i], 16); f.close(); if (!f.open("ttsmall.fnt")) { From caed4470f12db61f0bc11c813186a9066527a94d Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 13:28:28 +0200 Subject: [PATCH 0520/1332] AVALANCHE: Implement Acci::personshere(), Visa::talkto(), make control-constants in Scrolls public. --- engines/avalanche/acci2.cpp | 45 ++++++++----- engines/avalanche/scrolls2.h | 48 +++++++------ engines/avalanche/visa2.cpp | 127 ++++++++++++++++++++++++++++++++++- 3 files changed, 179 insertions(+), 41 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 3b9448aad561..437752ba6b61 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -606,9 +606,17 @@ void Acci::examobj() { /* Examine a standard object-thing */ warning("STUB: Acci::examobj()"); } -bool Acci::personshere() { /* Person equivalent of "holding" */ - warning("STUB: Acci::personshere()"); - return true; +bool Acci::personshere() { // Person equivalent of "holding". + if ((person == pardon) || (person == 0) || (_vm->_gyro->whereis[person] == _vm->_gyro->dna.room)) + return true; + else { + if (person < 175) + _vm->_scrolls->display(Common::String('H') + _vm->_scrolls->kControlToBuffer); + else + _vm->_scrolls->display(Common::String("Sh") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display("e isn't around at the moment."); + return false; + } } void Acci::exampers() { @@ -1178,30 +1186,31 @@ void Acci::do_that() { break; case vb_talk: if (person == pardon) { - if (_vm->_gyro->subjnumber == 99) /* They typed "say passuint16". */ - _vm->_scrolls->display("Yes, but what \6is\22 the passuint16?"); - /* - else if (set::of(range(1, 49), 253, 249, eos).has(subjnumber)) { - Delete(thats, 1, 1); - move(realuint16s[2], realuint16s[1], sizeof(realuint16s) - sizeof(realuint16s[1])); - verb = chr(subjnumber); + if (_vm->_gyro->subjnumber == 99) /* They typed "say password". */ + _vm->_scrolls->display(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); + else if (((1 <= _vm->_gyro->subjnumber) && (_vm->_gyro->subjnumber <= 49)) || (_vm->_gyro->subjnumber == 253) || (_vm->_gyro->subjnumber == 449)) { + thats.deleteChar(0); + + for (byte i = 0; i < 10; i++) + realwords[i] = realwords[i + 1]; + //move(realwords[2], realwords[1], sizeof(realwords) - sizeof(realwords[1])); + + verb = _vm->_gyro->subjnumber; do_that(); return; } else { person = _vm->_gyro->subjnumber; - subjnumber = 0; - if (set::of(pardon, '\0', eos).has(person)) + _vm->_gyro->subjnumber = 0; + if ((person == 0) || (person == pardon)) _vm->_scrolls->display("Talk to whom?"); else if (personshere()) - talkto(ord(person)); + _vm->_visa->talkto(person); } - */ - else if (person == pardon) - _vm->_scrolls->display("Talk to whom?"); - } else if (personshere()) + } else if (person == pardon) + _vm->_scrolls->display("Talk to whom?"); + else if (personshere()) _vm->_visa->talkto(person); break; - case vb_give: if (holding()) { if (person == pardon) diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 8af3402d962a..b90f280ae7a5 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -41,6 +41,27 @@ typedef void (Scrolls::*func2)(); class Scrolls { public: + // Constants to replace the command characters from Pascal. + // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers + + static const char kControlSpeechBubble = 2; // ^B + static const char kControlCenter = 3; // ^C + static const char kControlToBuffer = 4; // ^D + static const char kControlItalic = 6; // ^F + static const char kControlBell = 7; // ^G + static const char kControlBackspace = 8; // ^H + static const char kControlInsertSpaces = 9; // ^I + static const char kControlLeftJustified = 12; // ^L + static const char kControlNewLine = 13; // ^M + static const char kControlParagraph = 16; // ^P + static const char kControlQuestion = 17; // ^Q + static const char kControlRoman = 18; // ^R + static const char kControlRegister = 19; // ^S + static const char kControlNegative = 21; // ^U + static const char kControlIcon = 22; // ^V + + + bool aboutscroll; /* Is this the about box? */ @@ -71,6 +92,8 @@ class Scrolls { void musical_scroll(); + fontType ch[2]; + private: AvalancheEngine *_vm; @@ -81,29 +104,8 @@ class Scrolls { - // Constants to replace the command characters from Pascal. - // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers - - static const char kControlSpeechBubble = 2; // ^B - static const char kControlCenter = 3; // ^C - static const char kControlToBuffer = 4; // ^D - static const char kControlItalic = 6; // ^F - static const char kControlBell = 7; // ^G - static const char kControlBackspace = 8; // ^H - static const char kControlInsertSpaces = 9; // ^I - static const char kControlLeftJustified = 12; // ^L - static const char kControlNewLine = 13; // ^M - static const char kControlParagraph = 16; // ^P - static const char kControlQuestion = 17; // ^Q - static const char kControlRoman = 18; // ^R - static const char kControlRegister = 19; // ^S - static const char kControlNegative = 21; // ^U - static const char kControlIcon = 22; // ^V - - - int16 dix, diy; - fontType ch[2]; + byte cfont; // Current font int16 dodgex, dodgey; @@ -111,6 +113,8 @@ class Scrolls { byte use_icon; + + void easteregg(); void say(int16 x, int16 y, Common::String z); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 135ab216c6ca..72e49344bce5 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -164,7 +164,132 @@ void Visa::talkto(byte whom) { byte fv; bool no_matches; - warning("STUB: Visa::talkto()"); + if (_vm->_acci->person == _vm->_acci->pardon) { + _vm->_acci->person = _vm->_gyro->subjnumber; + _vm->_gyro->subjnumber = 0; + } + + if (_vm->_gyro->subjnumber == 0) + switch (whom) { + case _vm->_gyro->pspludwick: + + if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion])) { + dixi('q', 68); + _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; + _vm->_lucerna->objectlist(); + _vm->_lucerna->points(3); + return; + } else { + if (_vm->_gyro->dna.talked_to_crapulus) + // Spludwick - what does he need? + // 0 - let it through to use normal routine. + switch (_vm->_gyro->dna.given2spludwick) { + case 1: // Falltrough is intended. + case 2:{ + _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + return; + } + break; + case 3: { + dixi('q', 30); // Need any help with the game? + return; + } + break; + } + else { + dixi('q', 42); // Haven't talked to Crapulus. Go and talk to him. + return; + } + } + break; + + case _vm->_gyro->pibythneth: + if (_vm->_gyro->dna.givenbadgetoiby) { + dixi('q', 33); // Thanks a lot! + return; // And leave the proc. + } + break; // Or... just continue, 'cos he hasn't got it. + case _vm->_gyro->pdogfood: + if (_vm->_gyro->dna.wonnim) { // We've won the game. + dixi('q', 6); // "I'm Not Playing!" + return; // Zap back. + } else + _vm->_gyro->dna.asked_dogfood_about_nim = true; + break; + case _vm->_gyro->payles: + if (!_vm->_gyro->dna.ayles_is_awake) { + dixi('q', 43); // He's fast asleep! + return; + } else if (!_vm->_gyro->dna.given_pen_to_ayles) { + dixi('q', 44); // Can you get me a pen, Avvy? + return; + } + break; + + case _vm->_gyro->pjacques: { + dixi('q', 43); + return; + } + case _vm->_gyro->pgeida: + if (_vm->_gyro->dna.geida_given_potion) + _vm->_gyro->dna.geida_follows = true; + else { + dixi('u', 17); + return; + } + break; + case _vm->_gyro->pspurge: + if (~ _vm->_gyro->dna.sitting_in_pub) { + dixi('q', 71); // Try going over and sitting down. + return; + } else { + if (_vm->_gyro->dna.spurge_talk < 5) + _vm->_gyro->dna.spurge_talk++; + if (_vm->_gyro->dna.spurge_talk > 1) { // no. 1 falls through + dixi('q', 70 + _vm->_gyro->dna.spurge_talk); + return; + } + } + break; + } + // On a subject. Is there any reason to block it? + else if ((whom == _vm->_gyro->payles) && (!_vm->_gyro->dna.ayles_is_awake)) { + dixi('q', 43); // He's fast asleep! + return; + } + + if (whom > 149) + whom -= 149; + + no_matches = true; + for (fv = 0; fv <= _vm->_trip->numtr; fv++) + if (_vm->_trip->tr[fv].a.accinum == whom) { + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); + no_matches = false; + break; + } + + if (no_matches) + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); + + speech(whom, _vm->_gyro->subjnumber); + + if (!went_ok) + dixi('n', whom); // File not found! + + if ((_vm->_gyro->subjnumber == 0) && ((whom + 149) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only + _vm->_gyro->dna.obj[_vm->_gyro->badge] = true; + _vm->_lucerna->objectlist(); + dixi('q', 1); // Circular from Cardiff. + _vm->_gyro->dna.talked_to_crapulus = true; + + _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = 177; // Crapulus walks off. + + _vm->_trip->tr[1].vanishifstill = true; + _vm->_trip->tr[1].walkto(3); // Walks away. + + _vm->_lucerna->points(2); + } } } // End of namespace Avalanche. From 20c2a756b28af4b231a00ff620dd7ad8d8496eb1 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 13:53:18 +0200 Subject: [PATCH 0521/1332] AVALANCHE: Add typecasts to Acci::parse(), repair Scrolls::calldrivers() and Acci::personshere(). --- engines/avalanche/acci2.cpp | 26 +++++++++++++------------- engines/avalanche/scrolls2.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 437752ba6b61..48c8118114fb 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -548,7 +548,7 @@ void Acci::parse() { fv = 0; while ((fv < 11) && !realwords[fv].empty()) { if ((realwords[fv][0] == '\'') || (realwords[fv][0] == '\"')) { - _vm->_gyro->subjnumber = thats[fv]; + _vm->_gyro->subjnumber = (byte)thats[fv]; thats.setChar(moved, fv); break; } @@ -557,30 +557,30 @@ void Acci::parse() { if (_vm->_gyro->subjnumber == 0) // Still not found. for (fv = 0; fv < thats.size() - 1; fv++) - if (thats[fv] == 252) { // The word is "about", or something similar. - _vm->_gyro->subjnumber = thats[fv + 1]; + if ((byte)thats[fv] == 252) { // The word is "about", or something similar. + _vm->_gyro->subjnumber = (byte)thats[fv + 1]; thats.setChar(0, fv + 1); break; } if (_vm->_gyro->subjnumber == 0) // STILL not found! Must be the word after "say". for (fv = 0; fv < thats.size() - 1; fv++) - if ((thats[fv] == 7) && (thats[fv + 1] != 0) && !((225 <= thats[fv + 1]) && (thats[fv + 1] <= 229))) { + if (((byte)thats[fv] == 7) && ((byte)thats[fv + 1] != 0) && !((225 <= (byte)thats[fv + 1]) && ((byte)thats[fv + 1] <= 229))) { // SAY not followed by a preposition - _vm->_gyro->subjnumber = thats[fv + 1]; + _vm->_gyro->subjnumber = (byte)thats[fv + 1]; thats.setChar(0, fv + 1); break; } for (int8 fv = thats.size() - 1; fv >= 0; fv--) // Reverse order, so first will be used. - if ((thats[fv] == 253) || (thats[fv] == 249) || ((1 <= thats[fv]) && (thats[fv] <= 49))) - verb = thats[fv]; - else if ((50 <= thats[fv]) && (thats[fv] <= 149)) { + if (((byte)thats[fv] == 253) || ((byte)thats[fv] == 249) || ((1 <= (byte)thats[fv]) && ((byte)thats[fv] <= 49))) + verb = (byte)thats[fv]; + else if ((50 <= (byte)thats[fv]) && ((byte)thats[fv] <= 149)) { thing2 = thing; - thing = thats[fv]; - } else if ((150 <= thats[fv]) && (thats[fv] <= 199)) - person = thats[fv]; - else if (thats[fv] == 251) + thing = (byte)thats[fv]; + } else if ((150 <= (byte)thats[fv]) && ((byte)thats[fv] <= 199)) + person = (byte)thats[fv]; + else if ((byte)thats[fv] == 251) polite = true; if ((!unknown.empty()) && (verb != vb_exam) && (verb != vb_talk) && (verb != vb_save) && (verb != vb_load) && (verb != vb_dir)) { @@ -607,7 +607,7 @@ void Acci::examobj() { /* Examine a standard object-thing */ } bool Acci::personshere() { // Person equivalent of "holding". - if ((person == pardon) || (person == 0) || (_vm->_gyro->whereis[person] == _vm->_gyro->dna.room)) + if ((person == pardon) || (person == 0) || (_vm->_gyro->whereis[person - 150] == _vm->_gyro->dna.room)) return true; else { if (person < 175) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 99bef8e982f5..d5ce2f0bb1b9 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -717,7 +717,7 @@ void Scrolls::calldrivers() { _vm->_lucerna->errorled(); natural(); } else - _vm->_trip->tr[param].chatter(); // Normal sprite talking routine. + _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. else if ((10 <= param) && (param <= 36)) { /* Quasi-peds. (This routine performs the same thing with QPs as triptype.chatter does with the From 670c7c4863e8f843f8b877005c50952065dfe246 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 14:17:42 +0200 Subject: [PATCH 0522/1332] AVALANCHE: Repair Scrolls::bubble() and Visa::talkto(). --- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/visa2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index d5ce2f0bb1b9..50254b51300e 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -544,7 +544,7 @@ void Scrolls::bubble(func2 gotoit) { for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { int16 x = _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; bool offset = _vm->_gyro->scroll[fv].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 12, (fv * 10) + 12, white); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); } for (fv = 0; fv < _vm->_gyro->scrolln; fv++) /* These should be separate loops. */ diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 72e49344bce5..082b07a7b607 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -277,7 +277,7 @@ void Visa::talkto(byte whom) { if (!went_ok) dixi('n', whom); // File not found! - if ((_vm->_gyro->subjnumber == 0) && ((whom + 149) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only + if ((_vm->_gyro->subjnumber == 0) && ((whom + 227) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only _vm->_gyro->dna.obj[_vm->_gyro->badge] = true; _vm->_lucerna->objectlist(); dixi('q', 1); // Circular from Cardiff. From 2bbf25e948122d8ef9264a50d5cdb9c6c87f61c9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 14:27:36 +0200 Subject: [PATCH 0523/1332] AVALANCHE: Repair Scrolls::bubble(). --- engines/avalanche/scrolls2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 50254b51300e..c8f20b5f6f71 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -542,7 +542,7 @@ void Scrolls::bubble(func2 gotoit) { // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { - int16 x = _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; + int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; bool offset = _vm->_gyro->scroll[fv].size() % 2; _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); } From 24312c45f88b8d948251f7958c73f589a1c34771 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 14:50:05 +0200 Subject: [PATCH 0524/1332] AVALANCHE: Repair Scrolls::say(). --- engines/avalanche/scrolls2.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index c8f20b5f6f71..8e42419bd1d4 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -103,12 +103,15 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - Common::String text; fontType itw; byte lz = z.size(); _vm->_logger->log_scrollline(); + bool offset = x % 8 == 4; + x = x / 8; + y++; + int16 i = 0; for (byte xx = 0; xx < lz; xx++) { switch (z[xx]) { case kControlRoman: { @@ -125,18 +128,15 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit for (byte yy = 0; yy < 12; yy++) itw[(byte)z[xx]][yy] = ch[cfont][(byte)z[xx]][yy + 2]; - text += z[xx]; - + // We have to draw the characters one-by-one because of the accidental font changes. + i++; + Common::String chr(z[xx]); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, x * 8 + offset * 4 + i * 8, y, black); + _vm->_logger->log_scrollchar(Common::String(z[xx])); } } } - - bool offset = x % 8 == 4; - x = x / 8; - y++; - - _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, itw, 12, x * 8 + offset * 4, y, black); } /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ From 31a165c7006a548c5fc79837ba1854dd72d23087 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 12 Aug 2013 17:23:39 +0200 Subject: [PATCH 0525/1332] AVALANCHE: Repair constants in Gyro, repair Lucerna::enterroom(), Trip::back_and_forth(), Trip::geida_procs(), Visa::talkto(). --- engines/avalanche/gyro2.h | 56 +++++++++++++++++----------------- engines/avalanche/lucerna2.cpp | 4 +-- engines/avalanche/trip6.cpp | 18 ++++++----- engines/avalanche/visa2.cpp | 4 +-- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 390011c41e16..03c2ef4fa39b 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -309,38 +309,38 @@ class Gyro { static const char chastity = 5; static const char bolt = 6; static const char crossbow = 7; - static const char lute = 10; - static const char badge = 11; - static const char mushroom = 12; - static const char key = 13; - static const char bell = 14; - static const char prescription = 15; - static const char pen = 16; - static const char ink = 17; - static const char clothes = 20; - static const char habit = 21; - static const char onion = 22; + static const char lute = 8; + static const char badge = 9; + static const char mushroom = 10; + static const char key = 11; + static const char bell = 12; + static const char prescription = 13; + static const char pen = 14; + static const char ink = 15; + static const char clothes = 16; + static const char habit = 17; + static const char onion = 18; /* People who hang around this game. */ /* Boys: */ - static const uint16 pavalot = 226; - static const uint16 pspludwick = 227; - static const uint16 pcrapulus = 230; - static const uint16 pdrduck = 231; - static const uint16 pmalagauche = 232; - static const uint16 pfriartuck = 233; - static const uint16 probinhood = 234; - static const uint16 pcwytalot = 235; - static const uint16 pdulustie = 236; - static const uint16 pduke = 237; - static const uint16 pdogfood = 240; - static const uint16 ptrader = 241; - static const uint16 pibythneth = 242; - static const uint16 payles = 243; - static const uint16 pport = 244; - static const uint16 pspurge = 245; - static const uint16 pjacques = 246; + static const uint16 pavalot = 150; + static const uint16 pspludwick = 151; + static const uint16 pcrapulus = 152; + static const uint16 pdrduck = 153; + static const uint16 pmalagauche = 154; + static const uint16 pfriartuck = 155; + static const uint16 probinhood = 156; + static const uint16 pcwytalot = 157; + static const uint16 pdulustie = 158; + static const uint16 pduke = 159; + static const uint16 pdogfood = 160; + static const uint16 ptrader = 161; + static const uint16 pibythneth = 162; + static const uint16 payles = 163; + static const uint16 pport = 164; + static const uint16 pspurge = 165; + static const uint16 pjacques = 166; /* Girls: */ static const uint16 parkata = 257; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e996d5706d34..c8863b343b15 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -442,8 +442,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].face = 3; } - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procface_avvy; /* He always faces Avvy. */ + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; /* He always faces Avvy. */ } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__nowhere; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 510d6e5b1ffa..dfcdd5ce20a3 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1192,7 +1192,7 @@ void Trip::back_and_forth(byte tripnum) { void Trip::face_avvy(byte tripnum) { if (!tr[tripnum].homing) { - if (tr[1].x >= tr[tripnum].x) + if (tr[0].x >= tr[tripnum].x) tr[tripnum].face = right; else tr[tripnum].face = left; @@ -1306,19 +1306,19 @@ void Trip::spin(byte whichway, byte &tripnum) { void Trip::geida_procs(byte tripnum) { if (_vm->_gyro->dna.geida_time > 0) { - _vm->_gyro->dna.geida_time -= 1; + _vm->_gyro->dna.geida_time --; if (_vm->_gyro->dna.geida_time == 0) _vm->_gyro->dna.geida_spin = 0; } - if (tr[tripnum].y < (tr[1].y - 2)) { + if (tr[tripnum].y < (tr[0].y - 2)) { /* Geida is further from the screen than Avvy. */ spin(down, tripnum); tr[tripnum].iy = 1; tr[tripnum].ix = 0; take_a_step(tripnum); return; - } else if (tr[tripnum].y > (tr[1].y + 2)) { + } else if (tr[tripnum].y > (tr[0].y + 2)) { /* Avvy is further from the screen than Geida. */ spin(up, tripnum); tr[tripnum].iy = -1; @@ -1328,12 +1328,14 @@ void Trip::geida_procs(byte tripnum) { } tr[tripnum].iy = 0; - if (tr[tripnum].x < tr[1].x - tr[1].xs * 8) { - tr[tripnum].ix = tr[1].xs; + // These 12-s are not in the original, I added them to make the following method more "smooth". + // Now the NPC which is following Avvy won't block his way and will walk next to him properly. + if (tr[tripnum].x < tr[0].x - tr[0].xs * 8 - 12) { + tr[tripnum].ix = tr[0].xs; spin(right, tripnum); take_a_step(tripnum); - } else if (tr[tripnum].x > tr[1].x + tr[1].xs * 8) { - tr[tripnum].ix = -tr[1].xs; + } else if (tr[tripnum].x > tr[0].x + tr[0].xs * 8 + 12) { + tr[tripnum].ix = -tr[0].xs; spin(left, tripnum); take_a_step(tripnum); } else diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 082b07a7b607..4a6fbc7159c6 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -172,7 +172,6 @@ void Visa::talkto(byte whom) { if (_vm->_gyro->subjnumber == 0) switch (whom) { case _vm->_gyro->pspludwick: - if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion])) { dixi('q', 68); _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; @@ -202,7 +201,6 @@ void Visa::talkto(byte whom) { } } break; - case _vm->_gyro->pibythneth: if (_vm->_gyro->dna.givenbadgetoiby) { dixi('q', 33); // Thanks a lot! @@ -277,7 +275,7 @@ void Visa::talkto(byte whom) { if (!went_ok) dixi('n', whom); // File not found! - if ((_vm->_gyro->subjnumber == 0) && ((whom + 227) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only + if ((_vm->_gyro->subjnumber == 0) && ((whom + 149) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only _vm->_gyro->dna.obj[_vm->_gyro->badge] = true; _vm->_lucerna->objectlist(); dixi('q', 1); // Circular from Cardiff. From 878fde365ea74e52ec1539f87fee53ed6c8c4279 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:16:42 -0500 Subject: [PATCH 0526/1332] ZVISION: Fix alignment formatting --- engines/zvision/zork_avi_decoder.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h index 1dff30489441..1ce250882845 100644 --- a/engines/zvision/zork_avi_decoder.h +++ b/engines/zvision/zork_avi_decoder.h @@ -47,11 +47,11 @@ class ZorkAVIDecoder : public Video::AVIDecoder { Video::AVIDecoder::AVIAudioTrack *createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo); - private: - // Audio Codecs - enum { - kWaveFormatZorkPCM = 17 // special Zork PCM audio format (clashes with MS IMA ADPCM) - }; +private: + // Audio Codecs + enum { + kWaveFormatZorkPCM = 17 // special Zork PCM audio format (clashes with MS IMA ADPCM) + }; }; } // End of namespace ZVision From c020c6bf539d2a9fc4f91a422e1f63d9d9f374b3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:17:24 -0500 Subject: [PATCH 0527/1332] ZVISION: Add check to CursorMan::changeCursor to prevent extraneous cursor changes --- engines/zvision/cursor_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 698168b72aa1..361fe117141e 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -65,6 +65,9 @@ void CursorManager::changeCursor(const Common::String &cursorName) { } void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) { + if (_currentCursor.equals(cursorName) && _cursorIsPushed == pushed) + return; + if (_cursorIsPushed != pushed) _cursorIsPushed = pushed; From 4c1e8b3f453fec9e18743a636bcf2d1c83135c2e Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:18:17 -0500 Subject: [PATCH 0528/1332] ZVISION: Allow CursorManager::revertToIdle to take _cursorIsPushed into account --- engines/zvision/cursor_manager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 361fe117141e..0e7c2bc6cd47 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -72,7 +72,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) _cursorIsPushed = pushed; if (cursorName == "idle" && !pushed) { - revertToIdle(); + CursorMan.replaceCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); return; } @@ -124,7 +124,10 @@ void CursorManager::cursorDown(bool pushed) { void CursorManager::revertToIdle() { _currentCursor = "idle"; - CursorMan.replaceCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); + if (!_cursorIsPushed) + CursorMan.replaceCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat); + else + changeCursor(_currentCursor, _cursorIsPushed); } } // End of namespace ZVision From 003b30c77b34c9447bab3927d206101d5f341b4f Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:18:41 -0500 Subject: [PATCH 0529/1332] ZVISION: Create methods for setting left, right, up, down cursors --- engines/zvision/cursor_manager.cpp | 16 ++++++++++++++++ engines/zvision/cursor_manager.h | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 0e7c2bc6cd47..50fa5031b270 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -122,6 +122,22 @@ void CursorManager::cursorDown(bool pushed) { changeCursor(_currentCursor, pushed); } +void CursorManager::setLeftCursor() { + changeCursor("leftarrow"); +} + +void CursorManager::setRightCursor() { + changeCursor("rightarrow"); +} + +void CursorManager::setUpCursor() { + changeCursor("zuparrow"); +} + +void CursorManager::setDownCursor() { + changeCursor("downarrow"); +} + void CursorManager::revertToIdle() { _currentCursor = "idle"; if (!_cursorIsPushed) diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index 496c652c8c3b..fd61ac25be56 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -69,6 +69,12 @@ class CursorManager { void changeCursor(const Common::String &cursorName); void changeCursor(const Common::String &cursorName, bool pushed); void cursorDown(bool pushed); + + void setLeftCursor(); + void setRightCursor(); + void setUpCursor(); + void setDownCursor(); + void revertToIdle(); private: From 54f16f2539d619b7cdb4e43d7de03e1f538a1c1f Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:25:50 -0500 Subject: [PATCH 0530/1332] ZVISION: Create the concept of a working window The working window is a Rect centered inside the actual window edges. All in-game coordinates are in the working window coordinate system. Also, all images in-game are clipped to the edges of the working window. --- engines/zvision/render_manager.cpp | 30 ++++++++++++++++++------------ engines/zvision/render_manager.h | 25 +++++++++++++------------ engines/zvision/video.cpp | 8 ++++---- engines/zvision/zvision.cpp | 7 +++---- engines/zvision/zvision.h | 13 +++++++++++-- 5 files changed, 49 insertions(+), 34 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index e705a7f8b4f2..7855dc3903b5 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -34,12 +34,13 @@ namespace ZVision { -RenderManager::RenderManager(OSystem *system, const int width, const int height) +RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow) : _system(system), - _width(width), - _height(height), + _workingWidth(workingWindow.width()), + _workingHeight(workingWindow.height()), + _workingWindow(workingWindow), _currentBackground(0), - _renderTable(width, height) { + _renderTable(workingWindow.width(), workingWindow.height()) { } RenderManager::~RenderManager() { @@ -75,20 +76,19 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) return; - // Center the image on the screen if asked - if (autoCenter) { - destRect.moveTo((_width - subRectangle.width()) / 2, (_height - subRectangle.height()) / 2); } _backgroundOffset = Common::Point(destRect.left, destRect.top); if (_renderTable.getRenderState() == RenderTable::FLAT) { - _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height()); + // Convert destRect to screen space by adding _workingWindowOffset + _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left + _workingWindow.left, destRect.top + _workingWindow.top, destRect.width(), destRect.height()); } else { uint16 *destBuffer = new uint16[destRect.width() * destRect.height()]; _renderTable.mutateImage((uint16 *)buffer, destBuffer, imageWidth, imageHeight, subRectangle, destRect); - _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left, destRect.top, destRect.width(), destRect.height()); + // Convert destRect to screen space by adding _workingWindow offest + _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left + _workingWindow.left, destRect.top + _workingWindow.top, destRect.width(), destRect.height()); delete[] destBuffer; } } @@ -143,14 +143,20 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint } } -const Common::Point RenderManager::convertToImageCoords(const Common::Point &point) { - Common::Point newPoint(point); +const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { + // Convert from screen space to working window space + Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { - newPoint = _renderTable.convertWarpedPointToFlatCoords(newPoint); + newPoint = _renderTable.convertWarpedCoordToFlatCoord(newPoint); } newPoint -= _backgroundOffset; + if (newPoint.x < 0) + newPoint.x += _backgroundWidth; + if (newPoint.y < 0) + newPoint.y += _backgroundHeight; + return newPoint; } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index aea24505a9d1..8731675ef636 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -43,13 +43,14 @@ namespace ZVision { class RenderManager { public: - RenderManager(OSystem *system, const int width, const int height); + RenderManager(OSystem *system, const Common::Rect workingWindow); ~RenderManager(); private: OSystem *_system; - const int _width; - const int _height; + const int _workingWidth; + const int _workingHeight; + const Common::Rect _workingWindow; RenderTable _renderTable; Common::SeekableReadStream *_currentBackground; @@ -63,23 +64,23 @@ class RenderManager { /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. - * The image will be clipped to fit inside the window. + * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! * * @param fileName Name of the image file - * @param destinationX X position where the image should be put - * @param destinationY Y position where the image should be put - * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. + * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! + * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! + * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. - * The image will be clipped to fit inside the window. + * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! * * @param stream Stream to read the image data from - * @param destinationX X position where the image should be put - * @param destinationY Y position where the image should be put - * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. + * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! + * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! + * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); @@ -91,7 +92,7 @@ class RenderManager { */ void setBackgroundImage(const Common::String &fileName); - const Common::Point convertToImageCoords(const Common::Point &point); + const Common::Point screenSpaceToImageSpace(const Common::Point &point); RenderTable *getRenderTable(); diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index f9637d36a4c3..5497d0af0cd9 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -80,7 +80,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d // Videos use a different pixel format Common::List formats; formats.push_back(videoDecoder.getPixelFormat()); - initGraphics(_width, _height, true, formats); + initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, formats); byte bytesPerPixel = videoDecoder.getPixelFormat().bytesPerPixel; @@ -113,8 +113,8 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; } - uint16 x = ((_width - finalWidth) / 2) + destRect.left; - uint16 y = ((_height - finalHeight) / 2) + destRect.top; + uint16 x = ((WINDOW_WIDTH - finalWidth) / 2) + destRect.left; + uint16 y = ((WINDOW_HEIGHT - finalHeight) / 2) + destRect.top; _clock.stop(); videoDecoder.start(); @@ -168,7 +168,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d } // Reset the pixel format to the original state - initGraphics(_width, _height, true, &_pixelFormat); + initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 7f925e982875..0f6ec1412083 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -49,8 +49,7 @@ namespace ZVision { ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), - _width(640), - _height(480), + _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /*RGB 555*/ _desiredFrameTime(33), /* ~30 fps */ _clock(_system) { @@ -69,7 +68,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); - _renderManager = new RenderManager(_system, _width, _height); + _renderManager = new RenderManager(_system, _workingWindow); _cursorManager = new CursorManager(this, &_pixelFormat); debug("ZVision::ZVision"); @@ -115,7 +114,7 @@ void ZVision::initialize() { SearchMan.add(name, archive); } - initGraphics(_width, _height, true, &_pixelFormat); + initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); _scriptManager->initialize(); // Has to be done after graphics has been initialized diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index bf42bf2621f3..ca710804b0ee 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -64,10 +64,19 @@ class ZVision : public Engine { ~ZVision(); private: + enum { + WINDOW_WIDTH = 640, + WINDOW_HEIGHT = 480, + WORKING_WINDOW_WIDTH = 512, + WORKING_WINDOW_HEIGHT = 320, + + ROTATION_SCREEN_EDGE_OFFSET = 60, + MAX_ROTATION_SPEED = 150 // Pixels per second + }; + Console *_console; const ZVisionGameDescription *_gameDescription; - const int _width; - const int _height; + const Common::Rect _workingWindow; const Graphics::PixelFormat _pixelFormat; const int _desiredFrameTime; From 85c67e5e2f87290bd6669e120c68a71b916c892d Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:26:58 -0500 Subject: [PATCH 0531/1332] ZVISION: Implement ZVISION::getCursorManager() --- engines/zvision/zvision.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0f6ec1412083..f7e0ab821d3c 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -167,6 +167,10 @@ RenderManager *ZVision::getRenderManager() const { return _renderManager; } +CursorManager *ZVision::getCursorManager() const { + return _cursorManager; +} + Common::RandomSource *ZVision::getRandomSource() const { return _rnd; } From 65853bfe2ba4c7e526cce5d232efb6f645a9c96d Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:28:01 -0500 Subject: [PATCH 0532/1332] ZVISION: Fix header #defines to match their file names --- engines/zvision/actions.h | 4 ++-- engines/zvision/single_value_container.h | 4 ++-- engines/zvision/vector2.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 8e00cb5e537f..511f3d9b8344 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -20,8 +20,8 @@ * */ -#ifndef ZVISION_RESULT_ACTION_H -#define ZVISION_RESULT_ACTION_H +#ifndef ZVISION_ACTIONS_H +#define ZVISION_ACTIONS_H #include "common/scummsys.h" diff --git a/engines/zvision/single_value_container.h b/engines/zvision/single_value_container.h index 54677ff0a1e8..45b5a89e95c1 100644 --- a/engines/zvision/single_value_container.h +++ b/engines/zvision/single_value_container.h @@ -20,8 +20,8 @@ * */ -#ifndef ZVISION_OBJECT_H -#define ZVISION_OBJECT_H +#ifndef ZVISION_SINGLE_VALUE_CONTAINER_H +#define ZVISION_SINGLE_VALUE_CONTAINER_H namespace Common { class String; diff --git a/engines/zvision/vector2.h b/engines/zvision/vector2.h index d301aef4c639..575915c87d1f 100644 --- a/engines/zvision/vector2.h +++ b/engines/zvision/vector2.h @@ -20,8 +20,8 @@ * */ -#ifndef COMMON_ZVISION_POINT_H -#define COMMON_ZVISION_POINT_H +#ifndef ZVISION_VECTOR2_H +#define ZVISION_VECTOR2_H #include "common/scummsys.h" From 39934b1da7c6a7c0cf0a8d1e01af981ad83d09f0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:29:16 -0500 Subject: [PATCH 0533/1332] ZVISION: Set the initial game location (The opening video and menu) --- engines/zvision/script_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 03e791720cb2..93564ee6ad39 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -41,6 +41,7 @@ ScriptManager::ScriptManager(ZVision *engine) void ScriptManager::initialize() { parseScrFile("universe.scr", true); + changeLocation('g', 'a', 'r', 'y', 0); } void ScriptManager::update(uint deltaTimeMillis) { From 1dcc56f7d27717f0ea0becd027639a41a37f6f2f Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:36:52 -0500 Subject: [PATCH 0534/1332] ZVISION: Slight function name change to increase clarity --- engines/zvision/render_table.cpp | 2 +- engines/zvision/render_table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 2a111ce65910..ba506b1206ac 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -60,7 +60,7 @@ void RenderTable::setRenderState(RenderState newState) { } } -const Common::Point RenderTable::convertWarpedPointToFlatCoords(const Common::Point &point) { +const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Point &point) { uint32 index = point.y * _numColumns + point.x; Common::Point newPoint(point); diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 5cef0620452b..c38b5a6f0b09 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -64,7 +64,7 @@ class RenderTable { RenderState getRenderState() { return _renderState; } void setRenderState(RenderState newState); - const Common::Point convertWarpedPointToFlatCoords(const Common::Point &point); + const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); void generateRenderTable(); From d8f9be74ff63d2ab21f23e6c1520a7bdebdf1286 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:41:20 -0500 Subject: [PATCH 0535/1332] ZVISION: Add panning support --- engines/zvision/events.cpp | 92 +++++++++++++++++++++++++++--- engines/zvision/render_manager.cpp | 62 ++++++++++++++++++++ engines/zvision/render_manager.h | 10 ++++ 3 files changed, 157 insertions(+), 7 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 79ef0bd6b010..68fa81ede30e 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -26,6 +26,8 @@ #include "zvision/console.h" #include "common/events.h" #include "engines/util.h" +#include "common/system.h" +#include "common/rational.h" #include "zvision/cursor_manager.h" #include "zvision/render_manager.h" @@ -95,7 +97,7 @@ void ZVision::onMouseDown(const Common::Point &pos) { void ZVision::onMouseUp(const Common::Point &pos) { _cursorManager->cursorDown(false); - Common::Point imageCoord(_renderManager->convertToImageCoords(pos)); + Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { if (iter->withinHotspot(imageCoord)) { @@ -105,17 +107,93 @@ void ZVision::onMouseUp(const Common::Point &pos) { } void ZVision::onMouseMove(const Common::Point &pos) { - Common::Point imageCoord(_renderManager->convertToImageCoords(pos)); + Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); bool isWithinAHotspot = false; - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - if (iter->withinHotspot(imageCoord)) { - _cursorManager->changeCursor(iter->getHoverCursor()); - isWithinAHotspot = true; + if (_workingWindow.contains(pos)) { + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + if (iter->withinHotspot(imageCoord)) { + _cursorManager->changeCursor(iter->getHoverCursor()); + isWithinAHotspot = true; + } } } - + // Graph of the function governing rotation velocity: + // + // |--------------- working window -----------------| + // ^ |--------| + // | | + // +Max velocity | rotation screen edge offset _____________________ + // | / + // | / + // | / + // | / + // | / + // | / + // | / + // | / + // | / + // Zero velocity |______________________________ ______________________________/____________________________________> + // | Position -> / + // | / + // | / + // | / + // | / + // | / + // | / + // | / + // | / + // -Max velocity |_____________________/ + // | + // | + // ^ + + // NOTE: RenderManger uses the inverse of velocity (ms/pixel instead of pixels/ms) because it allows you to accumulate whole + // pixels 'steps' instead of rounding pixels every frame + + if (_workingWindow.contains(pos)) { + RenderTable::RenderState renderState = _renderManager->getRenderTable()->getRenderState(); + if (renderState == RenderTable::PANORAMA) { + if (pos.x >= _workingWindow.left && pos.x < _workingWindow.left + ROTATION_SCREEN_EDGE_OFFSET) { + // Linear function of distance to the left edge (y = -mx + b) + // We use fixed point math to get better accuracy + Common::Rational velocity = (Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.x - _workingWindow.left)) - MAX_ROTATION_SPEED; + _renderManager->setBackgroundVelocity(velocity.toInt()); + _cursorManager->setLeftCursor(); + isWithinAHotspot = true; + } else if (pos.x <= _workingWindow.right && pos.x > _workingWindow.right - ROTATION_SCREEN_EDGE_OFFSET) { + // Linear function of distance to the right edge (y = mx) + // We use fixed point math to get better accuracy + Common::Rational velocity = Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.x - _workingWindow.right + ROTATION_SCREEN_EDGE_OFFSET); + _renderManager->setBackgroundVelocity(velocity.toInt()); + _cursorManager->setRightCursor(); + isWithinAHotspot = true; + } else { + _renderManager->setBackgroundVelocity(0); + } + } else if (renderState == RenderTable::TILT) { + if (pos.y >= _workingWindow.top && pos.y < _workingWindow.top + ROTATION_SCREEN_EDGE_OFFSET) { + // Linear function of distance to top edge + // We use fixed point math to get better accuracy + Common::Rational velocity = (Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.y - _workingWindow.top)) - MAX_ROTATION_SPEED; + _renderManager->setBackgroundVelocity(velocity.toInt()); + _cursorManager->setUpCursor(); + isWithinAHotspot = true; + } else if (pos.y <= _workingWindow.bottom && pos.y > _workingWindow.bottom - ROTATION_SCREEN_EDGE_OFFSET) { + // Linear function of distance to the bottom edge (y = mx) + // We use fixed point math to get better accuracy + Common::Rational velocity = Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.y - _workingWindow.bottom + ROTATION_SCREEN_EDGE_OFFSET); + _renderManager->setBackgroundVelocity(velocity.toInt()); + _cursorManager->setDownCursor(); + isWithinAHotspot = true; + } else { + _renderManager->setBackgroundVelocity(0); + } + } + } else { + _renderManager->setBackgroundVelocity(0); + } if (!isWithinAHotspot) { _cursorManager->revertToIdle(); diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7855dc3903b5..b8dcd0dd872b 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -40,6 +40,10 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow) _workingHeight(workingWindow.height()), _workingWindow(workingWindow), _currentBackground(0), + _backgroundWidth(0), + _backgroundHeight(0), + _backgroundInverseVelocity(0), + _accumulatedVelocityMilliseconds(0), _renderTable(workingWindow.width(), workingWindow.height()) { } @@ -56,6 +60,24 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin uint32 temp = imageHeight; imageHeight = imageWidth; imageWidth = temp; +void RenderManager::update(uint deltaTimeInMillis) { + // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. + if (_backgroundInverseVelocity == 0) + return; + + _accumulatedVelocityMilliseconds += deltaTimeInMillis; + + int absVelocity = abs(_backgroundInverseVelocity); + + uint numberOfSteps = 0; + while (_accumulatedVelocityMilliseconds >= absVelocity) { + _accumulatedVelocityMilliseconds -= absVelocity; + numberOfSteps++; + } + + // Choose the direction of movement using the sign of the velocity + moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); +} } // If subRect is empty, use the entire image @@ -178,6 +200,46 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { _currentBackground = file; renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(), true); +void RenderManager::setBackgroundPosition(int offset) { + if (_renderTable.getRenderState() == RenderTable::TILT) { + _backgroundOffset = Common::Point(0, offset); + } else { + _backgroundOffset = Common::Point(offset, 0); + } +} + +void RenderManager::setBackgroundVelocity(int velocity) { + // setBackgroundVelocity(0) will be called quite often, so make sure + // _backgroundInverseVelocity isn't already 0 to prevent an extraneous assignment + if (velocity == 0) { + if (_backgroundInverseVelocity != 0) { + _backgroundInverseVelocity = 0; + } + } else { + _backgroundInverseVelocity = 1000 / velocity; + } +} + +void RenderManager::moveBackground(int offset) { + if (_renderTable.getRenderState() == RenderTable::TILT) { + _backgroundOffset += Common::Point(0, offset); + } else { + _backgroundOffset += Common::Point(offset, 0); + } + + // Make sure the offset is within image bounds + if (_backgroundOffset.x < 0) + _backgroundOffset.x += _backgroundWidth; + if (_backgroundOffset.x > _backgroundWidth) + _backgroundOffset.x -= _backgroundWidth; + if (_backgroundOffset.y < 0) + _backgroundOffset.y += _backgroundHeight; + if (_backgroundOffset.y > _backgroundHeight) + _backgroundOffset.y -= _backgroundHeight; + + _currentBackground->seek(0); + // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. + renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); } } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 8731675ef636..7d44a37726b9 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -55,12 +55,18 @@ class RenderManager { Common::SeekableReadStream *_currentBackground; Common::Point _backgroundOffset; + uint16 _backgroundWidth; + uint16 _backgroundHeight; + + int _backgroundInverseVelocity; + uint _accumulatedVelocityMilliseconds; Video::VideoDecoder *_currentVideo; byte *_scaledVideoFrameBuffer; public: void initialize(); + void update(uint deltaTimeInMillis); /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. @@ -92,6 +98,10 @@ class RenderManager { */ void setBackgroundImage(const Common::String &fileName); + void setBackgroundPosition(int offset); + + void setBackgroundVelocity(int velocity); + const Common::Point screenSpaceToImageSpace(const Common::Point &point); RenderTable *getRenderTable(); From 8d57880c51f29374a745c2060260fd222a26afe4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:43:37 -0500 Subject: [PATCH 0536/1332] ZVISION: Clip coords outside the working window --- engines/zvision/render_table.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index ba506b1206ac..aab4735d81eb 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -61,6 +61,13 @@ void RenderTable::setRenderState(RenderState newState) { } const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Point &point) { + // If we're outside the range of the RenderTable, no warping is happening. Return the maximum image coords + if (point.x >= _numColumns || point.y >= _numRows) { + int16 x = CLIP(point.x, 0, _numColumns); + int16 y = CLIP(point.y, 0, _numRows); + return Common::Point(x, y); + } + uint32 index = point.y * _numColumns + point.x; Common::Point newPoint(point); From 6be19d850abd9123960c6f4bcf00ba73d5549953 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:45:04 -0500 Subject: [PATCH 0537/1332] ZVISION: Add background image wrapping There is still a discontinuity when wrapping, but I am committing so that others can look at the code --- engines/zvision/render_manager.cpp | 106 ++++++++++++++++++++++------- engines/zvision/render_manager.h | 11 +-- 2 files changed, 88 insertions(+), 29 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b8dcd0dd872b..78fcf59a56e5 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -53,13 +53,6 @@ RenderManager::~RenderManager() { } } -void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { - // Panoramas are transposed - // The actual data is transposed in mutateImage - if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { - uint32 temp = imageHeight; - imageHeight = imageWidth; - imageWidth = temp; void RenderManager::update(uint deltaTimeInMillis) { // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. if (_backgroundInverseVelocity == 0) @@ -78,29 +71,72 @@ void RenderManager::update(uint deltaTimeInMillis) { // Choose the direction of movement using the sign of the velocity moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); } + +void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { + if (wrap) { + _backgroundWidth = imageWidth; + _backgroundHeight = imageHeight; } // If subRect is empty, use the entire image if (subRectangle.isEmpty()) - subRectangle = Common::Rect(imageWidth, imageHeight); + subRectangle = Common::Rect(subRectangle.left, subRectangle.top, subRectangle.left + imageWidth, subRectangle.top + imageHeight); - // Clip to image bounds - subRectangle.clip(imageWidth, imageHeight); - // Clip destRect to screen bounds + // Clip destRect to working window bounds Common::Rect destRect(destinationX, destinationY, destinationX + subRectangle.width(), destinationY + subRectangle.height()); - destRect.clip(_width, _height); - // Clip subRect to screen bounds + destRect.clip(_workingWidth, _workingHeight); + // Clip subRect to working window bounds subRectangle.translate(destRect.left - destinationX, destRect.top - destinationY); subRectangle.setWidth(destRect.width()); subRectangle.setHeight(destRect.height()); + // Clip to image bounds + Common::Point subRectOrigOrigin(subRectangle.left, subRectangle.top); + subRectangle.clip(imageWidth, imageHeight); - // Check for validity - if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) - return; + // If the image is to be wrapped, check if it's smaller than destRect + // If it is, then call renderSubRectToScreen with a subRect representing wrapping + if (wrap && subRectangle.width() < destRect.width()) { + uint32 wrapDestX; + uint32 wrapDestY; + Common::Rect wrapSubRect; + + if (_backgroundWidth - subRectangle.left < destRect.width()) { + wrapDestX = destRect.left + subRectangle.width(); + wrapDestY = destRect.top; + wrapSubRect = Common::Rect(0, 0, destRect.width() - subRectangle.width(), subRectangle.bottom); + } else { + wrapDestX = destRect.left; + wrapDestY = destRect.top; + wrapSubRect = Common::Rect(_backgroundWidth - subRectangle.width(), 0, _backgroundWidth - 1, subRectangle.bottom); + } + renderSubRectToScreen(buffer, imageWidth, imageHeight, horizontalPitch, wrapDestX, wrapDestY, wrapSubRect, false); + } else if (wrap && subRectangle.height() < destRect.height()) { + uint32 wrapDestX; + uint32 wrapDestY; + Common::Rect wrapSubRect; + + if (_backgroundHeight - subRectangle.top < destRect.height()) { + wrapDestX = destRect.left; + wrapDestY = destRect.height() - subRectangle.height(); + wrapSubRect = Common::Rect(0, 0, subRectangle.right, destRect.height() - subRectangle.height()); + } else { + wrapDestX = destRect.left; + wrapDestY = destRect.top; + wrapSubRect = Common::Rect(0, _backgroundHeight - subRectangle.height(), subRectangle.right, _backgroundHeight - 1); + } + + renderSubRectToScreen(buffer, imageWidth, imageHeight, horizontalPitch, wrapDestX, wrapDestY, wrapSubRect, false); } - _backgroundOffset = Common::Point(destRect.left, destRect.top); + // Clip destRect to image bounds + destRect.translate(subRectangle.left - subRectOrigOrigin.x, subRectangle.top - subRectOrigOrigin.y); + destRect.setWidth(subRectangle.width()); + destRect.setHeight(subRectangle.height()); + + // Check all Rects for validity + if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) + return; if (_renderTable.getRenderState() == RenderTable::FLAT) { // Convert destRect to screen space by adding _workingWindowOffset @@ -109,13 +145,13 @@ void RenderManager::update(uint deltaTimeInMillis) { uint16 *destBuffer = new uint16[destRect.width() * destRect.height()]; _renderTable.mutateImage((uint16 *)buffer, destBuffer, imageWidth, imageHeight, subRectangle, destRect); - // Convert destRect to screen space by adding _workingWindow offest + // Convert destRect to screen space by adding _workingWindow offset _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left + _workingWindow.left, destRect.top + _workingWindow.top, destRect.width(), destRect.height()); delete[] destBuffer; } } -void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { +void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { Common::File file; if (!file.open(fileName)) { @@ -123,10 +159,10 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d return; } - renderImageToScreen(file, destinationX, destinationY, subRectangle, autoCenter); + renderImageToScreen(file, destinationX, destinationY, subRectangle); } -void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter) { +void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; @@ -145,7 +181,15 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint uint32 horizontalPitch = imageWidth * sizeof(uint16); - renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle, autoCenter); + // Panoramas are transposed + // The actual data is transposed in mutateImage + if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { + uint32 temp = imageHeight; + imageHeight = imageWidth; + imageWidth = temp; + } + + renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle, wrap); delete[] buffer; } else { // Reset the cursor @@ -159,8 +203,19 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint } const Graphics::Surface *tgaSurface = tga.getSurface(); - renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle, autoCenter); + uint32 imageWidth = tgaSurface->w; + uint32 imageHeight = tgaSurface->h; + + // Panoramas are transposed + // The actual data is transposed in mutateImage + if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { + uint32 temp = imageHeight; + imageHeight = imageWidth; + imageWidth = temp; + } + + renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle, wrap); tga.destroy(); } } @@ -199,7 +254,10 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { } _currentBackground = file; - renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(), true); + // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. + renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); +} + void RenderManager::setBackgroundPosition(int offset) { if (_renderTable.getRenderState() == RenderTable::TILT) { _backgroundOffset = Common::Point(0, offset); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 7d44a37726b9..a3945863807f 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -61,7 +61,6 @@ class RenderManager { int _backgroundInverseVelocity; uint _accumulatedVelocityMilliseconds; - Video::VideoDecoder *_currentVideo; byte *_scaledVideoFrameBuffer; public: @@ -77,7 +76,7 @@ class RenderManager { * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); + void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); /** * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. @@ -88,7 +87,7 @@ class RenderManager { * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool autoCenter = false); + void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); /** * Sets the current background image to be used by the RenderManager and immediately @@ -99,7 +98,7 @@ class RenderManager { void setBackgroundImage(const Common::String &fileName); void setBackgroundPosition(int offset); - + void setBackgroundVelocity(int velocity); const Common::Point screenSpaceToImageSpace(const Common::Point &point); @@ -107,7 +106,9 @@ class RenderManager { RenderTable *getRenderTable(); private: - void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter); + void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap); + + void moveBackground(int offset); }; } // End of namespace ZVision From 0fe3ae711a4a2fb20e6fb23664b18cdda8400c9b Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:45:39 -0500 Subject: [PATCH 0538/1332] ZVISION: Add cursor and background image resets during location change --- engines/zvision/script_manager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 93564ee6ad39..6aaf5773e01d 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -28,6 +28,8 @@ #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "zvision/render_manager.h" +#include "zvision/cursor_manager.h" #include "zvision/actions.h" #include "zvision/action_node.h" #include "zvision/utility.h" @@ -211,6 +213,15 @@ void ScriptManager::changeLocationIntern() { _activeControls.clear(); _engine->clearAllMouseEvents(); + // Revert to the idle cursor + _engine->getCursorManager()->revertToIdle(); + + // Change the background position + _engine->getRenderManager()->setBackgroundPosition(_nextLocation.x); + + // Reset the background velocity + _engine->getRenderManager()->setBackgroundVelocity(0); + // Parse into puzzles and controls Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view); parseScrFile(fileName); From 9b8bad3c834ebb4287305d86cdb991f565738814 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 10:46:12 -0500 Subject: [PATCH 0539/1332] ZVISION: Add _renderManager::update() to ZEngene::run() --- engines/zvision/zvision.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index f7e0ab821d3c..2090d8abfebf 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -116,9 +116,8 @@ void ZVision::initialize() { initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); - _scriptManager->initialize(); - // Has to be done after graphics has been initialized _cursorManager->initialize(); + _scriptManager->initialize(); // Create debugger console. It requires GFX to be initialized _console = new Console(this); @@ -131,10 +130,12 @@ Common::Error ZVision::run() { while (!shouldQuit()) { _clock.update(); uint32 currentTime = _clock.getLastMeasuredTime(); - + uint32 deltaTime = _clock.getDeltaTime(); + processEvents(); - _scriptManager->update(_clock.getDeltaTime()); + _scriptManager->update(deltaTime); + _renderManager->update(deltaTime); // Update the screen _system->updateScreen(); From 4e827b4dda458813dce650545b6f9fb923c514f4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 12:04:13 -0500 Subject: [PATCH 0540/1332] ZVISION: Add documentation --- engines/zvision/cursor.h | 4 +++ engines/zvision/cursor_manager.h | 28 ++++++++++++++++ engines/zvision/mouse_event.h | 16 +++++++++ engines/zvision/render_manager.h | 57 ++++++++++++++++++++++++++++++++ engines/zvision/zvision.h | 28 ++++++++++++++++ 5 files changed, 133 insertions(+) diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index 77093c4dafb9..9a561fcac303 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -33,6 +33,10 @@ class String; namespace ZVision { +/** + * Utility class to parse and hold cursor data + * Modeled off Graphics::Cursor + */ class ZorkCursor { public: ZorkCursor(); diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index fd61ac25be56..1c09620b7edd 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -64,20 +64,48 @@ class CursorManager { static const char *_zNemCursorFileNames[]; public: + /** Creates the idle cursor and shows it */ void initialize(); + /** + * Parses a cursor name into a cursor file then creates and shows that cursor. + * It will use the current _isCursorPushed state to choose the correct cursor + * + * @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[] + */ void changeCursor(const Common::String &cursorName); + /** + * Parses a cursor name into a cursor file then creates and shows that cursor. + * + * @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[] + * @param pushed Should the cursor be pushed (true) or not pushed (false) (Another way to say it: down or up) + */ void changeCursor(const Common::String &cursorName, bool pushed); + /** + * Change the cursor to a certain push state. If the cursor is already in the specified push state, nothing will happen. + * + * @param pushed Should the cursor be pushed (true) or not pushed (false) (Another way to say it: down or up) + */ void cursorDown(bool pushed); + /** Set the cursor to 'Left Arrow'. It will retain the current _isCursorPushed state */ void setLeftCursor(); + /** Set the cursor to 'Right Arrow'. It will retain the current _isCursorPushed state */ void setRightCursor(); + /** Set the cursor to 'Up Arrow'. It will retain the current _isCursorPushed state */ void setUpCursor(); + /** Set the cursor to 'Down Arrow'. It will retain the current _isCursorPushed state */ void setDownCursor(); + /** Set the cursor to 'Idle'. It will retain the current _isCursorPushed state */ void revertToIdle(); private: + /** + * Calls CursorMan.replaceCursor() using the data in cursor + * + * @param cursor The cursor to show + */ void changeCursor(const ZorkCursor &cursor); }; diff --git a/engines/zvision/mouse_event.h b/engines/zvision/mouse_event.h index 1fbd1603a30f..5537bcc4e5a1 100644 --- a/engines/zvision/mouse_event.h +++ b/engines/zvision/mouse_event.h @@ -48,8 +48,24 @@ class MouseEvent { Common::String _hoverCursor; public: + /** + * Does a simple Rect::contains() using _hotspot + * + * @param point The point to check against _hotspot + * @return The point is inside _hotspot (true) or not (false) + */ bool withinHotspot(const Common::Point &point); + /** + * Calls ScriptManager::setStateValue(_key, 1) + * + * @param engine The base engine + */ void onClick(ZVision *engine); + /** + * Gets the name of the cursor that should be displayed when withinHotspot returns true + * + * @return The name of the cursor. This should correspond to one of the names in CursorManager::_cursorNames[] + */ const Common::String getHoverCursor() { return _hoverCursor; } }; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index a3945863807f..073a2f61e079 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -48,23 +48,45 @@ class RenderManager { private: OSystem *_system; + + /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; + /** Height of the working window. Saved to prevent extraneous calls to _workingWindow.height() */ const int _workingHeight; + /** + * A Rectangle centered inside the actual window. All in-game coordinates + * are given in this coordinate space. Also, all images are clipped to the + * edges of this Rectangle + */ const Common::Rect _workingWindow; + /** Used to warp the background image */ RenderTable _renderTable; Common::SeekableReadStream *_currentBackground; + /** The (x1,y1) coordinates of the subRectangle of the background that is currently displayed on the screen */ Common::Point _backgroundOffset; + /** The width of the current background image */ uint16 _backgroundWidth; + /** The height of the current background image */ uint16 _backgroundHeight; + /** + * The "velocity" at which the background image is panning. We actually store the inverse of velocity (ms/pixel instead of pixels/ms) + * because it allows you to accumulate whole pixels 'steps' instead of rounding pixels every frame + */ int _backgroundInverseVelocity; + /** Holds any 'leftover' milliseconds between frames */ uint _accumulatedVelocityMilliseconds; byte *_scaledVideoFrameBuffer; public: void initialize(); + /** + * Rotates the background image in accordance to the current _backgroundInverseVelocity + * + * @param deltaTimeInMillis The amount of time that has passed since the last frame + */ void update(uint deltaTimeInMillis); /** @@ -97,15 +119,50 @@ class RenderManager { */ void setBackgroundImage(const Common::String &fileName); + /** + * Set the background position (_backgroundOffset). If the current RenderState is PANORAMA, the offset + * will be in the horizontal direction. If the current RenderState is TILT, the offset will be in the + * vertical direction. + * + * This method will not render anything on the screen. So if nothing else is called that renders the + * background, the change won't be seen until next frame. + * + * @param offset The amount to offset the background + */ void setBackgroundPosition(int offset); + /** + * Set the background scroll velocity. Negative velocities correspond to left / up scrolling and + * positive velocities correspond to right / down scrolling + * + * @param velocity Velocity + */ void setBackgroundVelocity(int velocity); + /** + * Converts a point in screen coordinate space to image coordinate space + * + * @param point Point in screen coordinate space + * @return Point in image coordinate space + */ const Common::Point screenSpaceToImageSpace(const Common::Point &point); RenderTable *getRenderTable(); private: + /** + * Renders a subRectangle of an image to the screen. The destinationRect and SubRect + * will be clipped to image bound and to working window bounds + * + * @param buffer Pointer to (0, 0) of the image data + * @param imageWidth The width of the original image (not of the subRectangle) + * @param imageHeight The width of the original image (not of the subRectangle) + * @param horizontalPitch The horizontal pitch of the original image + * @param destinationX The x coordinate (in working window space) of where to put the final image + * @param destinationY The y coordinate (in working window space) of where to put the final image + * @param subRectangle A rectangle representing the part of the image that should be rendered + * @param wrap Should the image wrap (tile) if it doesn't completely fill the screen? + */ void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap); void moveBackground(int offset); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index ca710804b0ee..58812d4d1103 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -76,6 +76,11 @@ class ZVision : public Engine { Console *_console; const ZVisionGameDescription *_gameDescription; + /** + * A Rectangle centered inside the actual window. All in-game coordinates + * are given in this coordinate space. Also, all images are clipped to the + * edges of this Rectangle + */ const Common::Rect _workingWindow; const Graphics::PixelFormat _pixelFormat; @@ -110,17 +115,40 @@ class ZVision : public Engine { Common::RandomSource *getRandomSource() const; ZVisionGameId getGameId() const; + /** + * Play a video until it is finished. This is a blocking call. It will call + * _clock.stop() when the video starts and _clock.start() when the video finishes. + * It will also consume all events during video playback. + * + * @param videoDecoder The video to play + * @param destRect Where to put the video. (In working window coords) + * @param skippable If true, the video can be skipped at any time using [Spacebar] + */ void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); + /** + * Register a MouseEvent with the event system. These will be checked at every + * MOUSE_UP, MOUSE_DOWN, MOUSE_MOVE, etc. + * + * @param event The event to register + */ void registerMouseEvent(const MouseEvent &event); + /** Remove all MouseEvents from the event system */ void clearAllMouseEvents(); + /** + * Utility method to cycle through all the cursors in the game. After + * calling, use Left and Right arrows to cycle. Esc to quit. This is a + * blocking function call. + */ void cycleThroughCursors(); private: void initialize(); + /** Called every frame from ZVision::run() to process any events from EventMan */ void processEvents(); + void onMouseDown(const Common::Point &pos); void onMouseUp(const Common::Point &pos); void onMouseMove(const Common::Point &pos); From 435419cfe91eefa3a709af91f2ab172c3cbde022 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 12:12:34 -0500 Subject: [PATCH 0541/1332] ZVISION: Modify ASCII velocity drawing to represent the actual code Velocity outside the working window is zero --- engines/zvision/events.cpp | 49 ++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 68fa81ede30e..ca96f52457b2 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -121,37 +121,34 @@ void ZVision::onMouseMove(const Common::Point &pos) { // Graph of the function governing rotation velocity: // - // |--------------- working window -----------------| - // ^ |--------| + // |---------------- working window ------------------| + // ^ |---------| // | | - // +Max velocity | rotation screen edge offset _____________________ - // | / - // | / - // | / - // | / - // | / - // | / - // | / - // | / - // | / - // Zero velocity |______________________________ ______________________________/____________________________________> - // | Position -> / - // | / - // | / - // | / - // | / - // | / - // | / - // | / - // | / - // -Max velocity |_____________________/ + // +Max velocity | rotation screen edge offset + // | /| + // | / | + // | / | + // | / | + // | / | + // | / | + // | / | + // | / | + // | / | + // Zero velocity |______________________________ ______________________________/_________|__________________________> + // | Position -> | / + // | | / + // | | / + // | | / + // | | / + // | | / + // | | / + // | | / + // | | / + // -Max velocity | |/ // | // | // ^ - // NOTE: RenderManger uses the inverse of velocity (ms/pixel instead of pixels/ms) because it allows you to accumulate whole - // pixels 'steps' instead of rounding pixels every frame - if (_workingWindow.contains(pos)) { RenderTable::RenderState renderState = _renderManager->getRenderTable()->getRenderState(); if (renderState == RenderTable::PANORAMA) { From c0305d9534763d69223cb6a5ea20d20101236401 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 18:05:13 -0500 Subject: [PATCH 0542/1332] ZVISION: Rename variables and add comments to clarify the math behind panorama warping --- engines/zvision/render_table.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index aab4735d81eb..3bd0103054c5 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -149,26 +149,32 @@ void RenderTable::generatePanoramaLookupTable() { float halfWidth = (float)_numColumns / 2.0f; float halfHeight = (float)_numRows / 2.0f; - float fovRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f); - float halfHeightOverTan = halfHeight / tan(fovRadians); - float tanOverHalfHeight = tan(fovRadians) / halfHeight; + float fovInRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f); + float cylinderRadius = halfHeight / tan(fovInRadians); // TODO: Change the algorithm to write a whole row at a time instead of a whole column at a time. AKA: for(y) { for(x) {}} instead of for(x) { for(y) {}} for (uint x = 0; x < _numColumns; x++) { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) - float temp = atan(tanOverHalfHeight * ((float)x - halfWidth + 0.01f)); + // Alpha represents the horizontal angle between the viewer at the center of a cylinder and x + float alpha = atan(((float)x - halfWidth + 0.01f) / cylinderRadius); - int32 newX = int32(floor((halfHeightOverTan * _panoramaOptions.linearScale * temp) + halfWidth)); - float cosX = cos(temp); + // To get x in cylinder coordinates, we just need to calculate the arc length + // We also scale it by _panoramaOptions.linearScale + int32 xInCylinderCoords = int32(floor((cylinderRadius * _panoramaOptions.linearScale * alpha) + halfWidth)); + + + float cosAlpha = cos(alpha); for (uint y = 0; y < _numRows; y++) { - int32 newY = int32(floor(halfHeight + ((float)y - halfHeight) * cosX)); + // To calculate y in cylinder coordinates, we can do similar triangles comparison, + // comparing the triangle from the center to the screen and from the center to the edge of the cylinder + int32 yInCylinderCoords = int32(floor(halfHeight + ((float)y - halfHeight) * cosAlpha)); uint32 index = y * _numColumns + x; - // Only store the x,y offsets instead of the absolute positions - _internalBuffer[index].x = newX - x; - _internalBuffer[index].y = newY - y; + // Only store the (x,y) offsets instead of the absolute positions + _internalBuffer[index].x = xInCylinderCoords - x; + _internalBuffer[index].y = yInCylinderCoords - y; } } } From 08a8ab885bf6a2eea1f0eb9d7526cdbe240561e6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 15 Aug 2013 13:35:39 -0500 Subject: [PATCH 0543/1332] ZVISION: Apply panorama/tilt warping after all images have been rendered to a backbuffer This makes wrapped warping much easier as well as allowing changeLocation offsets to work properly --- engines/zvision/console.cpp | 4 +- engines/zvision/render_manager.cpp | 125 ++++++++++++++++------------- engines/zvision/render_manager.h | 22 +++-- engines/zvision/render_table.cpp | 21 ++--- engines/zvision/render_table.h | 2 +- engines/zvision/zvision.cpp | 2 +- 6 files changed, 95 insertions(+), 81 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index f1b192fce14d..6c7ac9418168 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -57,9 +57,9 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { bool Console::cmdLoadImage(int argc, const char **argv) { if (argc == 4) - _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); + _engine->getRenderManager()->renderImageToBackbuffer(argv[1], atoi(argv[2]), atoi(argv[3])); else if (argc == 8) - _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]), Common::Rect(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atoi(argv[7]))); + _engine->getRenderManager()->renderImageToBackbuffer(argv[1], atoi(argv[2]), atoi(argv[3]), Common::Rect(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atoi(argv[7]))); else { DebugPrintf("Use loadimage [ ] to load an image to the screen\n"); return true; diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 78fcf59a56e5..05536f3fbeec 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -34,23 +34,28 @@ namespace ZVision { -RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow) - : _system(system), - _workingWidth(workingWindow.width()), - _workingHeight(workingWindow.height()), - _workingWindow(workingWindow), - _currentBackground(0), - _backgroundWidth(0), - _backgroundHeight(0), - _backgroundInverseVelocity(0), - _accumulatedVelocityMilliseconds(0), - _renderTable(workingWindow.width(), workingWindow.height()) { +RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat) + : _system(system), + _workingWidth(workingWindow.width()), + _workingHeight(workingWindow.height()), + _workingWindow(workingWindow), + _pixelFormat(pixelFormat), + _currentBackground(0), + _backgroundWidth(0), + _backgroundHeight(0), + _backgroundInverseVelocity(0), + _accumulatedVelocityMilliseconds(0), + _renderTable(workingWindow.width(), workingWindow.height()) { + _backbuffer.create(_workingWidth, _workingHeight, pixelFormat); + _warpedBackbuffer = new uint16[_workingWidth *_workingHeight]; } RenderManager::~RenderManager() { if (_currentBackground != 0) { delete _currentBackground; } + + _backbuffer.free(); } void RenderManager::update(uint deltaTimeInMillis) { @@ -62,7 +67,7 @@ void RenderManager::update(uint deltaTimeInMillis) { int absVelocity = abs(_backgroundInverseVelocity); - uint numberOfSteps = 0; + int numberOfSteps = 0; while (_accumulatedVelocityMilliseconds >= absVelocity) { _accumulatedVelocityMilliseconds -= absVelocity; numberOfSteps++; @@ -70,17 +75,23 @@ void RenderManager::update(uint deltaTimeInMillis) { // Choose the direction of movement using the sign of the velocity moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); + + // Warp the entire backbuffer + _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); + + // Blit the backbuffer to the screen + _system->copyRectToScreen(_backbuffer.getBasePtr(0, 0), _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); } -void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { +void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed) { if (wrap) { - _backgroundWidth = imageWidth; - _backgroundHeight = imageHeight; + _backgroundWidth = surface.w; + _backgroundHeight = surface.h; } // If subRect is empty, use the entire image if (subRectangle.isEmpty()) - subRectangle = Common::Rect(subRectangle.left, subRectangle.top, subRectangle.left + imageWidth, subRectangle.top + imageHeight); + subRectangle = Common::Rect(subRectangle.left, subRectangle.top, subRectangle.left + surface.w, subRectangle.top + surface.h); // Clip destRect to working window bounds Common::Rect destRect(destinationX, destinationY, destinationX + subRectangle.width(), destinationY + subRectangle.height()); @@ -91,7 +102,7 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin subRectangle.setHeight(destRect.height()); // Clip to image bounds Common::Point subRectOrigOrigin(subRectangle.left, subRectangle.top); - subRectangle.clip(imageWidth, imageHeight); + subRectangle.clip(surface.w, surface.h); // If the image is to be wrapped, check if it's smaller than destRect // If it is, then call renderSubRectToScreen with a subRect representing wrapping @@ -110,7 +121,7 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin wrapSubRect = Common::Rect(_backgroundWidth - subRectangle.width(), 0, _backgroundWidth - 1, subRectangle.bottom); } - renderSubRectToScreen(buffer, imageWidth, imageHeight, horizontalPitch, wrapDestX, wrapDestY, wrapSubRect, false); + renderSubRectToBackbuffer(surface, wrapDestX, wrapDestY, wrapSubRect, false, isTransposed); } else if (wrap && subRectangle.height() < destRect.height()) { uint32 wrapDestX; uint32 wrapDestY; @@ -126,32 +137,38 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin wrapSubRect = Common::Rect(0, _backgroundHeight - subRectangle.height(), subRectangle.right, _backgroundHeight - 1); } - renderSubRectToScreen(buffer, imageWidth, imageHeight, horizontalPitch, wrapDestX, wrapDestY, wrapSubRect, false); + renderSubRectToBackbuffer(surface, wrapDestX, wrapDestY, wrapSubRect, false, isTransposed); + } else { + // Clip destRect to image bounds + destRect.translate(subRectangle.left - subRectOrigOrigin.x, subRectangle.top - subRectOrigOrigin.y); + destRect.setWidth(subRectangle.width()); + destRect.setHeight(subRectangle.height()); } - // Clip destRect to image bounds - destRect.translate(subRectangle.left - subRectOrigOrigin.x, subRectangle.top - subRectOrigOrigin.y); - destRect.setWidth(subRectangle.width()); - destRect.setHeight(subRectangle.height()); - // Check all Rects for validity if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) return; - if (_renderTable.getRenderState() == RenderTable::FLAT) { - // Convert destRect to screen space by adding _workingWindowOffset - _system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left + _workingWindow.left, destRect.top + _workingWindow.top, destRect.width(), destRect.height()); + if (isTransposed) { + copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(subRectangle.left, subRectangle.right), surface.w, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { - uint16 *destBuffer = new uint16[destRect.width() * destRect.height()]; - _renderTable.mutateImage((uint16 *)buffer, destBuffer, imageWidth, imageHeight, subRectangle, destRect); + _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.right), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); + } +} - // Convert destRect to screen space by adding _workingWindow offset - _system->copyRectToScreen(destBuffer, subRectangle.width() * sizeof(uint16), destRect.left + _workingWindow.left, destRect.top + _workingWindow.top, destRect.width(), destRect.height()); - delete[] destBuffer; +void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageHeight, int x, int y, int width, int height) { + uint16 *dest = (uint16 *)_backbuffer.getBasePtr(x, y); + + for (int x = 0; x < width; x++) { + int columnOffset = x * imageHeight; + for (int y = 0; y < height; y++) { + *dest = buffer[columnOffset + y]; + dest++; + } } } -void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { +void RenderManager::renderImageToBackbuffer(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { Common::File file; if (!file.open(fileName)) { @@ -159,10 +176,10 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d return; } - renderImageToScreen(file, destinationX, destinationY, subRectangle); + renderImageToBackbuffer(file, destinationX, destinationY, subRectangle); } -void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { +void RenderManager::renderImageToBackbuffer(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; @@ -179,17 +196,21 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint byte *buffer = new byte[decompressedSize]; lzssStream.read(buffer, decompressedSize); - uint32 horizontalPitch = imageWidth * sizeof(uint16); + uint32 pitch = imageWidth * sizeof(uint16); + bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; - // Panoramas are transposed - // The actual data is transposed in mutateImage - if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { - uint32 temp = imageHeight; + if (isTransposed) { + uint16 temp = imageHeight; imageHeight = imageWidth; imageWidth = temp; } - renderSubRectToScreen((uint16 *)buffer, imageWidth, imageHeight, horizontalPitch, destinationX, destinationY, subRectangle, wrap); + Graphics::Surface surface; + surface.init(imageWidth, imageHeight, pitch, buffer, _pixelFormat); + + renderSubRectToBackbuffer(surface, destinationX, destinationY, subRectangle, wrap, isTransposed); + + // We have to use delete[] instead of calling surface.free() because we created the memory with new[] delete[] buffer; } else { // Reset the cursor @@ -202,20 +223,16 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint return; } - const Graphics::Surface *tgaSurface = tga.getSurface(); + Graphics::Surface tgaSurface = *(tga.getSurface()); + bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; - uint32 imageWidth = tgaSurface->w; - uint32 imageHeight = tgaSurface->h; - - // Panoramas are transposed - // The actual data is transposed in mutateImage - if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { - uint32 temp = imageHeight; - imageHeight = imageWidth; - imageWidth = temp; + if (isTransposed) { + uint16 temp = tgaSurface.h; + tgaSurface.h = tgaSurface.w; + tgaSurface.w = temp; } - renderSubRectToScreen((uint16 *)tgaSurface->pixels, tgaSurface->w, tgaSurface->h, tgaSurface->pitch, destinationX, destinationY, subRectangle, wrap); + renderSubRectToBackbuffer(tgaSurface, destinationX, destinationY, subRectangle, wrap, isTransposed); tga.destroy(); } } @@ -255,7 +272,7 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { _currentBackground = file; // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. - renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); + renderImageToBackbuffer(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); } void RenderManager::setBackgroundPosition(int offset) { @@ -297,7 +314,7 @@ void RenderManager::moveBackground(int offset) { _currentBackground->seek(0); // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. - renderImageToScreen(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); + renderImageToBackbuffer(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); } } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 073a2f61e079..d5bf61f6a043 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -26,6 +26,8 @@ #include "common/types.h" #include "common/rect.h" +#include "graphics/surface.h" + #include "zvision/render_table.h" class OSystem; @@ -43,11 +45,15 @@ namespace ZVision { class RenderManager { public: - RenderManager(OSystem *system, const Common::Rect workingWindow); + RenderManager(OSystem *system, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat); ~RenderManager(); private: OSystem *_system; + const Graphics::PixelFormat _pixelFormat; + + Graphics::Surface _backbuffer; + uint16 *_warpedBackbuffer; /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; @@ -90,7 +96,7 @@ class RenderManager { void update(uint deltaTimeInMillis); /** - * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. + * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! * * @param fileName Name of the image file @@ -98,10 +104,10 @@ class RenderManager { * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); + void renderImageToBackbuffer(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); /** - * Blits the image or a portion of the image to the screen. Actual screen updates won't happen until the end of the frame. + * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! * * @param stream Stream to read the image data from @@ -109,7 +115,7 @@ class RenderManager { * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); + void renderImageToBackbuffer(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); /** * Sets the current background image to be used by the RenderManager and immediately @@ -151,7 +157,7 @@ class RenderManager { private: /** - * Renders a subRectangle of an image to the screen. The destinationRect and SubRect + * Renders a subRectangle of an image to the backbuffer. The destinationRect and SubRect * will be clipped to image bound and to working window bounds * * @param buffer Pointer to (0, 0) of the image data @@ -163,7 +169,9 @@ class RenderManager { * @param subRectangle A rectangle representing the part of the image that should be rendered * @param wrap Should the image wrap (tile) if it doesn't completely fill the screen? */ - void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap); + void renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed); + + void copyTransposedRectToBackbuffer(const uint16 *buffer, int imageHeight, int x, int y, int width, int height); void moveBackground(int offset); }; diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 3bd0103054c5..a28f82baa6b6 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -98,16 +98,10 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle) { - bool isTransposed = _renderState == RenderTable::PANORAMA || _renderState == RenderTable::TILT; - - for (int y = subRectangle.top; y < subRectangle.bottom; y++) { - uint normalizedY = y - subRectangle.top; - - for (int x = subRectangle.left; x < subRectangle.right; x++) { - uint normalizedX = x - subRectangle.left; - - uint32 index = (normalizedY + destRectangle.top) * _numColumns + (normalizedX + destRectangle.left); +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight) { + for (uint32 y = 0; y < imageHeight; y++) { + for (uint32 x = 0; x < imageWidth; x++) { + uint32 index = y * _numColumns + x; // RenderTable only stores offsets from the original coordinates uint32 sourceYIndex = y + _internalBuffer[index].y; @@ -119,12 +113,7 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 i // Clamp the xIndex to the size of the image sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); - // TODO: Figure out a way to not have branching every loop. The only way that comes to mind is to have a whole separate set of for loops for isTransposed, but that's ugly. The compiler might do this anyway in the end - if (isTransposed) { - destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceXIndex * imageHeight + sourceYIndex]; - } else { - destBuffer[normalizedY * subRectangle.width() + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; - } + destBuffer[index] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; } } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index c38b5a6f0b09..7c04564cd045 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight); void generateRenderTable(); void setPanoramaFoV(float fov); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 2090d8abfebf..ff234bf3fed9 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -68,7 +68,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); - _renderManager = new RenderManager(_system, _workingWindow); + _renderManager = new RenderManager(_system, _workingWindow, _pixelFormat); _cursorManager = new CursorManager(this, &_pixelFormat); debug("ZVision::ZVision"); From 999de6d400be8374a6834a81bb8b8f4da4a1756c Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 15 Aug 2013 13:36:10 -0500 Subject: [PATCH 0544/1332] ZVISION: Convert Surface::pixels to Surface::getBasePtr(0, 0) --- engines/zvision/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 5497d0af0cd9..28c26f6f2adf 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -148,10 +148,10 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d if (frame) { if (scale != 1) { - scaleBuffer((byte *)frame->pixels, scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); + scaleBuffer((byte *)frame->getBasePtr(0, 0), scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); _system->copyRectToScreen(scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); } else { - _system->copyRectToScreen((byte *)frame->pixels, pitch, x, y, finalWidth, finalHeight); + _system->copyRectToScreen((byte *)frame->getBasePtr(0, 0), pitch, x, y, finalWidth, finalHeight); } _system->updateScreen(); From 7e8e9bf3d1e718758298b8fb5ccc6a0f296d5b9c Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 14 Aug 2013 19:42:56 -0500 Subject: [PATCH 0545/1332] GRAPHICS: Create copyRectToSurface member function --- graphics/surface.cpp | 18 ++++++++++++++++++ graphics/surface.h | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 929157203e1f..d808121c871e 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -133,6 +133,24 @@ const Surface Surface::getSubArea(const Common::Rect &area) const { return subSurface; } +void Surface::copyRectToSurface(const void *buffer, int pitch, int x, int y, int width, int height) { + assert(buffer); + + assert(x >= 0 && x < w); + assert(y >= 0 && y < h); + assert(height > 0 && y + height <= h); + assert(width > 0 && x + width <= w); + + // Copy buffer data to internal buffer + const byte *src = (const byte *)buffer; + byte *dst = (byte *)getBasePtr(x, y); + for (int i = 0; i < height; i++) { + memcpy(dst, src, width * format.bytesPerPixel); + src += pitch; + dst += this->pitch; + } +} + 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 b08d4a5cb717..ad52ed8238c5 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -208,6 +208,19 @@ struct Surface { */ const Surface getSubArea(const Common::Rect &area) const; + /** + * Copies a bitmap to the Surface internal buffer. The pixel format + * of buffer must match the pixel format of the Surface. + * + * @param buffer The buffer containing the graphics data source + * @param pitch The pitch of the buffer (number of bytes in a scanline) + * @param x The x coordinate of the destination rectangle + * @param y The y coordinate of the destination rectangle + * @param width The width of the destination rectangle + * @param height The height of the destination rectangle + */ + void copyRectToSurface(const void *buffer, int pitch, int x, int y, int width, int height); + /** * Convert the data to another pixel format. * From fde55085028b5837a95a394fe8beab394f843fb0 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 15 Aug 2013 21:55:47 +0200 Subject: [PATCH 0546/1332] AVALANCHE: Rename variables in Graphics::drawSprite(). --- engines/avalanche/graphics.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0b3a26495c72..9ae040818d52 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -98,21 +98,21 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { /* First we make the pixels of the spirte blank. */ - for (byte qay = 0; qay < sprite.yl; qay++) - for (byte qax = 0; qax < sprite.xl; qax++) - if (((*sprite.sil[picnum])[qay][qax / 8] >> ((7 - qax % 8)) & 1) == 0) - *getPixel(x + qax, y + qay) = 0; + for (byte j = 0; j < sprite.yl; j++) + for (byte i = 0; i < sprite.xl; i++) + if (((*sprite.sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) + *getPixel(x + i, y + j) = 0; /* Then we draw the picture to the blank places. */ - uint16 i = 0; // Because the original siltype starts at 5!!! See Graphics.h for definition. + uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (byte qay = 0; qay < sprite.yl; qay++) + for (byte j = 0; j < sprite.yl; j++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. - for (uint16 qax = 0; qax < sprite.xl; qax += 8) { - byte pixel = (*sprite.mani[picnum])[i++]; + for (uint16 i = 0; i < sprite.xl; i += 8) { + byte pixel = (*sprite.mani[picnum])[maniPos++]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *getPixel(x + qax + 7 - bit, y + qay) += (pixelBit << plane); + *getPixel(x + i + 7 - bit, y + j) += (pixelBit << plane); } } } From 62043e949d396e0d86515d963fa32b792ab9ec01 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 7 Jun 2013 22:11:28 +0300 Subject: [PATCH 0547/1332] VIDEO: Add an over-ridable wrapper for the AVI audio track handler Reimplementation of 7a49802c01b0c39be4e86335689db8f3359fde68 This is based on a suggestion made by clone2727, so the original idea belongs to him. Engines can now override the common AVI audio track handler with a custom one. This is needed for the Z-Engine AVI videos, since they use a custom audio decoder that is only used in the two Z-Engine games, and has its own fake AVI audio format (17). This clashes with the MS IMA ADPCM format, and therefore shouldn't pollute the common AVI video decoder code. The addition of this over-ridable method allows the Z-Engine to add its own custom AVI decoder while avoiding code duplication. --- video/avi_decoder.cpp | 6 +++++- video/avi_decoder.h | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 92a60fcccfe3..ff41099e698d 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -93,6 +93,10 @@ AVIDecoder::~AVIDecoder() { close(); } +AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) { + return new AVIAudioTrack(sHeader, wvInfo, _soundType); +} + void AVIDecoder::initCommon() { _decodedHeader = false; _foundMovieList = false; @@ -268,7 +272,7 @@ void AVIDecoder::handleStreamHeader(uint32 size) { if (wvInfo.channels == 2) sHeader.sampleSize /= 2; - addTrack(new AVIAudioTrack(sHeader, wvInfo, _soundType)); + addTrack(createAudioTrack(sHeader, wvInfo)); } // Ensure that we're at the end of the chunk diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 5d52c7c797f5..f7259bf0302f 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -69,7 +69,6 @@ class AVIDecoder : public VideoDecoder { protected: void readNextPacket(); -private: struct BitmapInfoHeader { uint32 size; uint32 width; @@ -192,13 +191,12 @@ class AVIDecoder : public VideoDecoder { AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType); ~AVIAudioTrack(); - void queueSound(Common::SeekableReadStream *stream); + virtual void queueSound(Common::SeekableReadStream *stream); Audio::Mixer::SoundType getSoundType() const { return _soundType; } protected: Audio::AudioStream *getAudioStream() const; - private: // Audio Codecs enum { kWaveFormatNone = 0, @@ -233,6 +231,9 @@ class AVIDecoder : public VideoDecoder { void handleStreamHeader(uint32 size); uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } byte getStreamIndex(uint32 tag) const; + +public: + virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo); }; } // End of namespace Video From c2366dc99e7028fdf94ec7d020016e674bf33100 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 15 Aug 2013 15:11:24 -0500 Subject: [PATCH 0548/1332] ZVISION: Fix error using subRectangle.right instead of .top --- engines/zvision/render_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 05536f3fbeec..a2ae7e8b28f1 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -152,7 +152,7 @@ void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 if (isTransposed) { copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(subRectangle.left, subRectangle.right), surface.w, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { - _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.right), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); + _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.top), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } } From ea65a8667872cd2128d786eda2e77c3786161f36 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 12:21:37 +0200 Subject: [PATCH 0549/1332] AVALANCHE: Implement Gyro::load_a_mouse(), some cosmetic correction in Gyro. --- engines/avalanche/gyro2.cpp | 129 +++++++++++++++++++++++------------- engines/avalanche/gyro2.h | 1 + 2 files changed, 83 insertions(+), 47 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 73a321af07c5..4bb2305568e2 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -54,7 +54,7 @@ const char *Gyro::copyright = "1995"; const mp Gyro::mps[9] = { { - /* 1 - up-arrow */ + // 1 - up-arrow { {65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}, {0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0} }, @@ -63,17 +63,16 @@ const mp Gyro::mps[9] = { }, { - /* 2 - screwdriver */ + // 2 - screwdriver { {8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}, {0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0} - }, 0, 0 }, { - /* 3 - right-arrow */ + // 3 - right-arrow { {65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}, {0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0} }, @@ -82,58 +81,58 @@ const mp Gyro::mps[9] = { }, { - /* 4 - fletch */ + // 4 - fletch { {255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}, {0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0} }, 0, 0 - }, + }, - { - /* 5 - hourglass */ - { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, - {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} - }, - 8, - 7 + { + // 5 - hourglass + { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, + {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} }, + 8, + 7 + }, - { - /* 6 - TTHand */ - { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, - {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} - }, - 4, - 0 + { + // 6 - TTHand + { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, + {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} }, + 4, + 0 + }, - { - /* 7- Mark's crosshairs */ - { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, - {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} - }, - 8, - 5 + { + // 7- Mark's crosshairs + { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, + {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} }, + 8, + 5 + }, - { - /* 8- I-beam. */ - { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, - {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} - }, - 8, - 7 + { + // 8- I-beam + { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, + {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} }, + 8, + 7 + }, - { - /* 9- Question mark. */ - { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, - {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} - }, - 0, - 0 - } + { + // 9 - question mark + { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, + {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} + }, + 0, + 0 + } }; const Common::String Gyro::lads[17] = { @@ -279,7 +278,8 @@ Common::String Gyro::strf(int32 x) { } void Gyro::newpointer(byte m) { - if (m == cmp) return; + if (m == cmp) + return; cmp = m; /*r.ax = 9; @@ -295,7 +295,7 @@ void Gyro::newpointer(byte m) { load_a_mouse(m); } -void Gyro::wait() { /* makes hourglass */ +void Gyro::wait() { // Makes hourglass. newpointer(5); } @@ -587,13 +587,48 @@ void Gyro::load_a_mouse(byte which) { return; } + ::Graphics::Surface cursor; + cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); + cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); + + + // The AND mask. f.seek(mouse_size * 2 * (which - 1) + 134); - f.read(vmc.andpic, mouse_size); - - f.read(vmc.xorpic, mouse_size); + ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); + + for (byte j = 0; j < mask.h; j++) + for (byte i = 0; i < mask.w; i++) + for (byte k = 0; k < 2; k++) + if (*(byte *)mask.getBasePtr(i, j) == 0) + *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; + mask.free(); + + // The OR mask. + f.seek(mouse_size * 2 * (which - 1) + 134 * 2); + + mask = _vm->_graphics->loadPictureGraphic(f); + + for (byte j = 0; j < mask.h; j++) + for (byte i = 0; i < mask.w; i++) + for (byte k = 0; k < 2; k++) { + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel != 0) + *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; + } + + mask.free(); + f.close(); + + + + CursorMan.replaceCursor(cursor.pixels, 16, 32, mps[which].horzhotspot, mps[which].verthotspot, 255, false); + + cursor.free(); + + vmc.ofsx = -mps[which].horzhotspot; vmc.ofsy = -mps[which].verthotspot; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 03c2ef4fa39b..a5271fa13395 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -35,6 +35,7 @@ #include "common/file.h" #include "graphics/surface.h" +#include "graphics/cursorman.h" #include "avalanche/roomnums.h" #include "avalanche/color.h" From 681fe7029aa33fd257c53987ab251fc0253123f4 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 12:52:34 +0200 Subject: [PATCH 0550/1332] AVALANCHE: Remove useless parts/comments from Gyro, replace some comments in it. --- engines/avalanche/gyro2.cpp | 61 +++++++------------------------------ engines/avalanche/gyro2.h | 12 ++++---- 2 files changed, 17 insertions(+), 56 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 4bb2305568e2..c948492187e0 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -255,21 +255,11 @@ Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { } Gyro::~Gyro() { - /* These are allocated in Gyro::setup_vmc */ - - delete[] vmc.andpic; - delete[] vmc.xorpic; - - for (byte fv = 0; fv < 2; fv ++) { - delete[] vmc.backpic[fv]; - } - for (byte i = 0; i < 9; i++) { digit[i].free(); rwlite[i].free(); } digit[9].free(); - } Common::String Gyro::strf(int32 x) { @@ -281,21 +271,11 @@ void Gyro::newpointer(byte m) { if (m == cmp) return; cmp = m; - - /*r.ax = 9; - r.bx = (word)(mps[m].horzhotspot); - r.cx = (word)(mps[m].verthotspot); - r.es = seg(mps[m].mask); - r.dx = ofs(mps[m].mask); - intr(0x33, r); - - r is a 'registers' type variable of Gyro in the Pascal code.*/ - warning("STUB: Gyro::newpointer()"); load_a_mouse(m); } -void Gyro::wait() { // Makes hourglass. +void Gyro::wait() { newpointer(5); } @@ -304,16 +284,7 @@ void Gyro::on() { } void Gyro::on_virtual() { - switch (visible) { - case m_virtual: - return; - break; - case m_yes: - off(); - break; - } - - visible = m_virtual; + warning("STUB: Gyro::on_virtual()"); } void Gyro::off() { @@ -324,11 +295,11 @@ void Gyro::off_virtual() { warning("STUB: Gyro::off_virtual()"); } -void Gyro::xycheck() { /* only updates mx & my, not all other mouse vars */ +void Gyro::xycheck() { warning("STUB: Gyro::xycheck()"); } -void Gyro::hopto(int16 x, int16 y) { /* Moves mouse void *to x,y */ +void Gyro::hopto(int16 x, int16 y) { warning("STUB: Gyro::hopto()"); } @@ -352,12 +323,12 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { warning("STUB: Gyro::shbox()"); } -void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ +void Gyro::newgame() { for (byte gm = 0; gm < numtr; gm ++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); } - /* Deallocate sprite. Sorry, beta testers! */ + // Deallocate sprite. Sorry, beta testers! _vm->_trip->tr[0].init(0, true, _vm->_trip); alive = true; @@ -391,7 +362,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ her = 254; it = 254; last_person = 254; /* = Pardon? */ - dna.pass_num = _vm->_rnd->getRandomNumber(30) + 1;//Random(30) + 1; + dna.pass_num = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; after_the_scroll = false; dna.user_moves_avvy = false; doing_sprite_run = false; @@ -412,7 +383,7 @@ void Gyro::newgame() { /* This sets up the DNA for a completely new game. */ _vm->_lucerna->sprite_run(); } -void Gyro::click() { /* "Audio keyboard feedback" */ +void Gyro::click() { warning("STUB: Gyro::click()"); } @@ -539,15 +510,12 @@ Common::String Gyro::get_better(byte which) { return get_better_result; } -// Get back here after finished with acci.pas, where vb_-s are resided. -Common::String Gyro::f5_does() -/* This procedure determines what f5 does. */ -{ + +Common::String Gyro::f5_does() { warning("STUB: Gyro::f5_does()"); return "STUB: Gyro::f5_does()"; } -// Pobably vmc functions will deal with the mouse cursor. void Gyro::plot_vmc(int16 xx, int16 yy, byte page_) { warning("STUB: Gyro::plot_vmc()"); } @@ -557,14 +525,7 @@ void Gyro::wipe_vmc(byte page_) { } void Gyro::setup_vmc() { - vmc.andpic = new byte[mouse_size]; - vmc.xorpic = new byte[mouse_size]; - - /* Released in Gyro's destructor. */ - for (int fv = 0; fv < 2; fv ++) { - vmc.backpic[fv] = new byte[mouse_size]; - vmc.wherewas[fv].x = 32767; - } + warning("STUB: Gyro::setup_vmc()"); } void Gyro::clear_vmc() { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index a5271fa13395..b247f90d39fc 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -614,7 +614,7 @@ class Gyro { void newpointer(byte m); - void wait(); /* makes hourglass */ + void wait(); // Makes hourglass. void on(); @@ -624,9 +624,9 @@ class Gyro { void off_virtual(); - void xycheck(); + void xycheck(); // Only updates mx & my, not all other mouse vars. - void hopto(int16 x, int16 y); /* Moves mouse pointer to x,y */ + void hopto(int16 x, int16 y); // Moves mouse pointer to x,y. void check(); @@ -636,9 +636,9 @@ class Gyro { void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); - void newgame(); + void newgame(); // This sets up the DNA for a completely new game. - void click(); + void click(); // "Audio keyboard feedback" void slowdown(); @@ -658,7 +658,7 @@ class Gyro { Common::String get_better(byte which); - Common::String f5_does(); + Common::String f5_does(); // This procedure determines what f5 does. void plot_vmc(int16 xx, int16 yy, byte page_); From 1f751ff157d96f91cd9a2854b0a2270bef95acb9 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 13:00:00 +0200 Subject: [PATCH 0551/1332] AVALANCHE: Stub Gyro::super_off() and Gyro::super_on(). --- engines/avalanche/avalanche.h | 2 ++ engines/avalanche/gyro2.cpp | 19 ++----------------- engines/avalanche/gyro2.h | 1 - 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 8ce73120dc36..1eea8131827d 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -54,6 +54,8 @@ #include "engines/engine.h" #include "engines/advancedDetector.h" +#include "graphics/cursorman.h" + namespace Common { class RandomSource; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index c948492187e0..cea59028899e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -614,26 +614,11 @@ void Gyro::hang_around_for_a_while() { afterwards. */ void Gyro::super_off() { - super_was_off = visible == m_no; - if (super_was_off) - return; - - super_was_virtual = visible == m_virtual; - - if (visible == m_virtual) - off_virtual(); - else - off(); + warning("STUB: Gyro::super_off()"); } void Gyro::super_on() { - if ((visible != m_no) || (super_was_off)) - return; - - if (super_was_virtual) - on_virtual(); - else - on(); + warning("STUB: Gyro::super_on()"); } bool Gyro::mouse_near_text() { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index b247f90d39fc..e54452f0d2ce 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -35,7 +35,6 @@ #include "common/file.h" #include "graphics/surface.h" -#include "graphics/cursorman.h" #include "avalanche/roomnums.h" #include "avalanche/color.h" From d860bc592545e6ebf387e95afb5068c8a5d8d123 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 13:40:58 +0200 Subject: [PATCH 0552/1332] AVALANCHE: Remove Gyro::on_virtual(), Gyro::off_virtual(), Gyro::super_off(), Gyro::super_on(). Replace their calls with CursorMan.showMouse(). --- engines/avalanche/avalot.cpp | 3 +- engines/avalanche/dropdown2.cpp | 7 ++-- engines/avalanche/gyro2.cpp | 20 ----------- engines/avalanche/gyro2.h | 8 ----- engines/avalanche/lucerna2.cpp | 59 +++++++++------------------------ engines/avalanche/parser.cpp | 8 ++--- engines/avalanche/scrolls2.cpp | 50 ++++++---------------------- 7 files changed, 34 insertions(+), 121 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index d3779cbc2444..ced715026500 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -70,8 +70,7 @@ void Avalot::setup() { _vm->_gyro->to_do = 0; _vm->_gyro->lmo = false; _vm->_scrolls->resetscroll(); - _vm->_gyro->setup_vmc(); - _vm->_gyro->on_virtual(); + CursorMan.showMouse(true); gd = 3; gm = 0; //initgraph(gd: gm: ""); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 89eb231280a4..b19b2534f21d 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -58,14 +58,13 @@ headtype *headtype::init(char trig, char alttrig, Common::String name, byte p, f } void headtype::display() { - _dr->_vm->_gyro->off(); /*MT*/ + CursorMan.showMouse(false); /*MT*/ _dr->chalk(xpos, 1, trigger, title, true); - _dr->_vm->_gyro->on(); /*MT*/ + CursorMan.showMouse(true); /*MT*/ } void headtype::highlight() { - _dr->_vm->_gyro->off(); - _dr->_vm->_gyro->off_virtual(); + CursorMan.showMouse(false); //nosound(); //setactivepage(cp); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index cea59028899e..8d42e1bd925e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -283,18 +283,10 @@ void Gyro::on() { warning("STUB: Gyro::on()"); } -void Gyro::on_virtual() { - warning("STUB: Gyro::on_virtual()"); -} - void Gyro::off() { warning("STUB: Gyro::off()"); } -void Gyro::off_virtual() { - warning("STUB: Gyro::off_virtual()"); -} - void Gyro::xycheck() { warning("STUB: Gyro::xycheck()"); } @@ -609,18 +601,6 @@ void Gyro::hang_around_for_a_while() { slowdown(); } -/* Super_Off and Super_On are two very useful procedures. Super_Off switches - the mouse cursor off, WHATEVER it's like. Super_On restores it again - afterwards. */ - -void Gyro::super_off() { - warning("STUB: Gyro::super_off()"); -} - -void Gyro::super_on() { - warning("STUB: Gyro::super_on()"); -} - bool Gyro::mouse_near_text() { return (my > 144) && (my < 188); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index e54452f0d2ce..5f268dc80cc3 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -619,10 +619,6 @@ class Gyro { void off(); - void on_virtual(); - - void off_virtual(); - void xycheck(); // Only updates mx & my, not all other mouse vars. void hopto(int16 x, int16 y); // Moves mouse pointer to x,y. @@ -673,10 +669,6 @@ class Gyro { void hang_around_for_a_while(); - void super_off(); - - void super_on(); - bool mouse_near_text(); private: diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c8863b343b15..afbbc1b05369 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -84,21 +84,8 @@ void Lucerna::draw_also_lines() { byte ff; byte squeaky_code; - switch (_vm->_gyro->visible) { - case _vm->_gyro->m_virtual: { - squeaky_code = 1; - _vm->_gyro->off_virtual(); - } - break; - case _vm->_gyro->m_no: - squeaky_code = 2; - break; - case _vm->_gyro->m_yes: { - squeaky_code = 3; - _vm->_gyro->off(); - } - break; - } + + CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 161), 15); @@ -107,16 +94,8 @@ void Lucerna::draw_also_lines() { if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); - switch (squeaky_code) { - case 1 : - _vm->_gyro->on_virtual(); - break; - case 2 : - break; // Zzz... it was off anyway. - case 3 : - _vm->_gyro->on(); - break; - } + + CursorMan.showMouse(true); } @@ -236,13 +215,8 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte a1; /*absolute $A000:17184;*/ byte bit; Common::String xx; - bool was_virtual; - - was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - if (was_virtual) - _vm->_gyro->off_virtual(); - else - _vm->_gyro->off(); + + CursorMan.showMouse(false); _vm->_gyro->clear_vmc(); @@ -297,10 +271,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_logger->log_newroom(_vm->_gyro->roomname); - if (was_virtual) - _vm->_gyro->on_virtual(); - else - _vm->_gyro->on(); + CursorMan.showMouse(true); } @@ -791,7 +762,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * f.close(); - _vm->_gyro->off(); + CursorMan.showMouse(false); /*setactivepage(3); putimage(x, y, p, 0); @@ -800,7 +771,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * for (byte fv = 0; fv <= 1; fv ++) _vm->_trip->getset[fv].remember(thinkspace); - _vm->_gyro->on(); + CursorMan.showMouse(true); _vm->_gyro->thinkthing = th; } @@ -872,7 +843,7 @@ void Lucerna::showscore() { } numbers[2] = score; - _vm->_gyro->off(); + CursorMan.showMouse(false); //setactivepage(3); @@ -885,7 +856,7 @@ void Lucerna::showscore() { //setactivepage(1 - cp); - _vm->_gyro->on(); + CursorMan.showMouse(true); for (byte i = 0; i < 3; i++) _vm->_gyro->lastscore[i] = numbers[i]; } @@ -1064,7 +1035,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). if (_vm->_gyro->oldrw == _vm->_gyro->dna.rw) return; _vm->_gyro->oldrw = _vm->_gyro->dna.rw; - _vm->_gyro->off(); + CursorMan.showMouse(false); /* for (byte page_ = 0; page_ <= 1; page_ ++) { setactivepage(page_); @@ -1073,7 +1044,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). _vm->_graphics->drawPicture(_vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); - _vm->_gyro->on(); + CursorMan.showMouse(true); //setactivepage(1 - cp); warning("STUB: Lucerna::showrw()"); @@ -1167,13 +1138,13 @@ void Lucerna::flip_page() { void Lucerna::delavvy() { byte page_; - _vm->_gyro->off(); + CursorMan.showMouse(false); triptype &with = _vm->_trip->tr[0]; /*for (page_ = 0; page_ <= 1; page_ ++) mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_);*/ - _vm->_gyro->on(); + CursorMan.showMouse(true); } void Lucerna::gameover() { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4ce8249eb013..c996a304ebaa 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -87,7 +87,7 @@ void Parser::handleReturn() { void Parser::plotText() { if (_vm->_gyro->mouse_near_text()) - _vm->_gyro->super_off(); + CursorMan.showMouse(false); cursorOff(); @@ -96,7 +96,7 @@ void Parser::plotText() { _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, white); cursorOn(); - _vm->_gyro->super_on(); + CursorMan.showMouse(true); } void Parser::cursorOn() { @@ -140,7 +140,7 @@ void Parser::drawCursor() { void Parser::wipeText() { if (_vm->_gyro->mouse_near_text()) - _vm->_gyro->super_off(); + CursorMan.showMouse(false); cursorOff(); @@ -149,7 +149,7 @@ void Parser::wipeText() { _quote = true; _inputTextPos = 0; cursorOn(); - _vm->_gyro->super_on(); + CursorMan.showMouse(true); } } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8e42419bd1d4..a5dd7d088f5e 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -90,11 +90,11 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ //} warning("STUB: Scrolls::state()"); - _vm->_gyro->super_off(); + CursorMan.showMouse(false); _vm->_graphics->drawBar(419, 195, 438, 197, color); - _vm->_gyro->super_on(); + CursorMan.showMouse(true); _vm->_gyro->ledstatus = x; } @@ -149,8 +149,7 @@ void Scrolls::normscroll() { state(3); _vm->_gyro->seescroll = true; - _vm->_gyro->off_virtual(); - _vm->_gyro->on(); + CursorMan.showMouse(true); _vm->_gyro->newpointer(4); _vm->_lucerna->mousepage(1 - _vm->_gyro->cp); @@ -210,7 +209,7 @@ void Scrolls::normscroll() { state(0); _vm->_gyro->seescroll = false; _vm->_lucerna->mousepage(_vm->_gyro->cp); - _vm->_gyro->off(); + CursorMan.showMouse(false); warning("STUB: Scrolls::normscroll()"); } @@ -334,7 +333,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t bool centre; byte icon_indent = 0; - _vm->_gyro->off_virtual(); //setvisualpage(cp); //setactivepage(1 - cp); _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ @@ -357,7 +355,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); - _vm->_gyro->off(); + CursorMan.showMouse(false); // The right corners of the scroll. _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, lightgray); @@ -462,12 +460,12 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_logger->log_divider(); //setvisualpage(cp); //mousepage(cp); - _vm->_gyro->off(); + CursorMan.showMouse(false); /* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/ //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); //blitfix(); _vm->_gyro->oncandopageswap = true; // Normality again. - _vm->_gyro->on(); + CursorMan.showMouse(true); //settextjustify(0, 0); /*sink*/ resetscrolldriver(); if (_vm->_gyro->mpress > 0) @@ -488,7 +486,7 @@ void Scrolls::bubble(func2 gotoit) { _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ //mousepage(1 - cp); /* Mousepage */ - _vm->_gyro->off(); + CursorMan.showMouse(false); xl = 0; yl = _vm->_gyro->scrolln * 5; @@ -555,17 +553,17 @@ void Scrolls::bubble(func2 gotoit) { //setvisualpage(1 - cp); dingdongbell(); _vm->_gyro->oncandopageswap = false; - _vm->_gyro->on(); + CursorMan.showMouse(true); _vm->_gyro->dropsok = false; // This does the actual drawing to the screen. (this->*gotoit)(); - _vm->_gyro->off(); + CursorMan.showMouse(false); _vm->_gyro->dropsok = true; /*setvisualpage(cp); - _vm->_gyro->on(); /*sink;*/ + CursorMan.showMouse(true); /*sink;*/ _vm->_gyro->oncandopageswap = true; resetscrolldriver(); if (_vm->_gyro->mpress > 0) @@ -684,15 +682,8 @@ void Scrolls::calldrivers() { _vm->_lucerna->sprite_run(); call_spriterun = false; - was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - if (was_virtual) - _vm->_gyro->off_virtual(); - drawscroll(&Avalanche::Scrolls::normscroll); - if (was_virtual) - _vm->_gyro->on_virtual(); - resetscroll(); if (_vm->_gyro->screturn) @@ -732,15 +723,8 @@ void Scrolls::calldrivers() { natural(); } - was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - if (was_virtual) - _vm->_gyro->off_virtual(); - bubble(&Avalanche::Scrolls::normscroll); - if (was_virtual) - _vm->_gyro->on_virtual(); - resetscroll(); if (_vm->_gyro->screturn) @@ -814,15 +798,8 @@ void Scrolls::calldrivers() { _vm->_gyro->scrolln++; _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] = kControlQuestion; - was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - if (was_virtual) - _vm->_gyro->off_virtual(); - drawscroll(&Avalanche::Scrolls::dialogue); - if (was_virtual) - _vm->_gyro->on_virtual(); - resetscroll(); } break; @@ -891,13 +868,8 @@ void Scrolls::musical_scroll() { was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - if (was_virtual) - _vm->_gyro->off_virtual(); - drawscroll(&Avalanche::Scrolls::music_scroll); - if (was_virtual) - _vm->_gyro->on_virtual(); resetscroll(); } From 5e2627542af823c4faad7350a56fab097d10b5b8 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 13:56:29 +0200 Subject: [PATCH 0553/1332] AVALANCHE: Remove functions connected to mouse handling from Gyro, remove Lucerna::flip_page(). --- engines/avalanche/avalot.cpp | 7 ------- engines/avalanche/gyro2.cpp | 32 -------------------------------- engines/avalanche/gyro2.h | 13 ------------- engines/avalanche/lucerna2.cpp | 7 ------- engines/avalanche/lucerna2.h | 2 -- 5 files changed, 61 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ced715026500..fff969bc34f8 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -236,14 +236,7 @@ void Avalot::run(Common::String arg) { _vm->_trip->trippancy_link(); _vm->_celer->pics_link(); _vm->_lucerna->checkclick(); - - if (_vm->_gyro->visible == _vm->_gyro->m_virtual) - _vm->_gyro->plot_vmc(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->cp); - _vm->_lucerna->flip_page(); /* <<_gyro->visible == _vm->_gyro->m_virtual) - _vm->_gyro->wipe_vmc(_vm->_gyro->cp); - _vm->_timeout->one_tick(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 8d42e1bd925e..96b45b44e5a0 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -508,30 +508,6 @@ Common::String Gyro::f5_does() { return "STUB: Gyro::f5_does()"; } -void Gyro::plot_vmc(int16 xx, int16 yy, byte page_) { - warning("STUB: Gyro::plot_vmc()"); -} - -void Gyro::wipe_vmc(byte page_) { - warning("STUB: Gyro::wipe_vmc()"); -} - -void Gyro::setup_vmc() { - warning("STUB: Gyro::setup_vmc()"); -} - -void Gyro::clear_vmc() { - warning("STUB: Gyro::clear_vmc()"); -} - -void Gyro::setminmaxhorzcurspos(uint16 min, uint16 max) { /* phew */ - warning("STUB: Gyro::setminmaxhorzcurspos()"); -} - -void Gyro::setminmaxvertcurspos(uint16 min, uint16 max) { - warning("STUB: Gyro::setminmaxvertcurspos()"); -} - void Gyro::load_a_mouse(byte which) { Common::File f; @@ -580,14 +556,6 @@ void Gyro::load_a_mouse(byte which) { CursorMan.replaceCursor(cursor.pixels, 16, 32, mps[which].horzhotspot, mps[which].verthotspot, 255, false); cursor.free(); - - - - vmc.ofsx = -mps[which].horzhotspot; - vmc.ofsy = -mps[which].verthotspot; - - setminmaxhorzcurspos(mps[which].horzhotspot + 3, 624 + mps[which].horzhotspot); - setminmaxvertcurspos(mps[which].verthotspot, 199); } void Gyro::background(byte x) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 5f268dc80cc3..f5dc209040e5 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -655,14 +655,6 @@ class Gyro { Common::String f5_does(); // This procedure determines what f5 does. - void plot_vmc(int16 xx, int16 yy, byte page_); - - void wipe_vmc(byte page_); - - void setup_vmc(); - - void clear_vmc(); - void load_a_mouse(byte which); void background(byte x); @@ -683,11 +675,6 @@ class Gyro { static const char betterchar[]; void shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); - - void setminmaxhorzcurspos(uint16 min, uint16 max); - - void setminmaxvertcurspos(uint16 min, uint16 max); - }; } // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index afbbc1b05369..340116b8b3a2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -217,8 +217,6 @@ void Lucerna::load(byte n) { /* Load2, actually */ Common::String xx; CursorMan.showMouse(false); - - _vm->_gyro->clear_vmc(); _vm->_graphics->flesh_colours(); @@ -1130,11 +1128,6 @@ void Lucerna::clock_lucerna() { - -void Lucerna::flip_page() { - warning("STUB: Lucerna::flip_page()"); -} - void Lucerna::delavvy() { byte page_; diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index f0ecf2bad77f..4cee781fd6db 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -88,8 +88,6 @@ class Lucerna { void clock_lucerna(); - void flip_page(); - void delavvy(); void gameover(); From dc1e9022b1c6276af8065e72260b8ae9084bcd57 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 17:29:22 +0200 Subject: [PATCH 0554/1332] AVALANCHE: Add AvalancheEngine::getMousePos(), remove Gyro::hopto(), implement Scrolls::dodgem() and Scrolls::undodgem(). --- engines/avalanche/avalanche.cpp | 4 +++- engines/avalanche/avalanche.h | 2 ++ engines/avalanche/gyro2.cpp | 4 ---- engines/avalanche/gyro2.h | 2 -- engines/avalanche/scrolls2.cpp | 20 ++++++++------------ engines/avalanche/scrolls2.h | 6 +++--- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 922f70198192..8196065bef00 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -147,7 +147,9 @@ bool AvalancheEngine::getEvent(Common::Event &event) { return _eventMan->pollEvent(event); } - +Common::Point AvalancheEngine::getMousePos() { + return _eventMan->getMousePos(); +} diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 1eea8131827d..2f20393faf61 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -115,6 +115,8 @@ class AvalancheEngine : public Engine { bool getEvent(Common::Event &event); // A warpper around _eventMan->pollEvent(), se we can use it in Scrolls::normscroll() for example. + Common::Point getMousePos(); + protected: // Engine APIs Common::Error run(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 96b45b44e5a0..fa95a538c7cc 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -291,10 +291,6 @@ void Gyro::xycheck() { warning("STUB: Gyro::xycheck()"); } -void Gyro::hopto(int16 x, int16 y) { - warning("STUB: Gyro::hopto()"); -} - void Gyro::check() { warning("STUB: Gyro::check()"); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index f5dc209040e5..7ddfe62de4c7 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -621,8 +621,6 @@ class Gyro { void xycheck(); // Only updates mx & my, not all other mouse vars. - void hopto(int16 x, int16 y); // Moves mouse pointer to x,y. - void check(); void note(uint16 hertz); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a5dd7d088f5e..4e7507a7d3ba 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -260,19 +260,15 @@ void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little. _vm->_lucerna->errorled(); /* ring the bell "x" times */ } -void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */ - _vm->_gyro->xycheck(); /* Mx & my now contain xy pos of mouse */ - dodgex = _vm->_gyro->mx; - dodgey = _vm->_gyro->my; /* Store 'em */ - _vm->_gyro->hopto(dodgex, _vm->_gyro->underscroll); /* Move the pointer off the scroll. */ +void Scrolls::dodgem() { + dodgeCoord = _vm->getMousePos(); + g_system->warpMouse(dodgeCoord.x, _vm->_gyro->underscroll); // Move the pointer off the scroll. } -void Scrolls::undodgem() { /* This is the opposite of Dodgem. It moves the - mouse pointer back, IF you haven't moved it in the meantime. */ - _vm->_gyro->xycheck(); - if ((_vm->_gyro->mx == dodgex) && (_vm->_gyro->my == _vm->_gyro->underscroll)) - /* No change, so restore the pointer's original position. */ - _vm->_gyro->hopto(dodgex, dodgey); +void Scrolls::undodgem() { + Common::Point actCoord = _vm->getMousePos(); + if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->underscroll)) + g_system->warpMouse(dodgeCoord.x, dodgeCoord.y); // No change, so restore the pointer's original position. } void Scrolls::geticon(int16 x, int16 y, byte which) { @@ -446,7 +442,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t my += 12; } - _vm->_gyro->underscroll = my + 3; + _vm->_gyro->underscroll = my * 2 + 12 + 1; // Multiplying because of the doubled screen height. //setvisualpage(1 - cp); dingdongbell(); //my = getpixel(0, 0); diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index b90f280ae7a5..c16d983a4f77 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -108,7 +108,7 @@ class Scrolls { byte cfont; // Current font - int16 dodgex, dodgey; + Common::Point dodgeCoord; byte param; // For using arguments code byte use_icon; @@ -133,9 +133,9 @@ class Scrolls { void dingdongbell(); - void dodgem(); + void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. - void undodgem(); + void undodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. void geticon(int16 x, int16 y, byte which); From bdd9b18292105b2cd8d894d2e042accecd001913 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 10:43:12 -0500 Subject: [PATCH 0555/1332] ZVISION: Disable videos until I can figure out how to fix the decoder --- engines/zvision/scr_file_handling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 5b8af4804717..ff7df20ac5db 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -251,7 +251,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:streamvideo*", true)) { - actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); + //actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); } else if (line.matchString("*:syncsound*", true)) { From e6aa2d15ca75788065012ea64e881277ef4e5565 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 10:44:35 -0500 Subject: [PATCH 0556/1332] ZVISION: Only skip the background moving if velocity is 0 instead of returning and skipping everything --- engines/zvision/render_manager.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index a2ae7e8b28f1..31b54b4a158a 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -60,22 +60,21 @@ RenderManager::~RenderManager() { void RenderManager::update(uint deltaTimeInMillis) { // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. - if (_backgroundInverseVelocity == 0) - return; + if (_backgroundInverseVelocity != 0) { + _accumulatedVelocityMilliseconds += deltaTimeInMillis; - _accumulatedVelocityMilliseconds += deltaTimeInMillis; + int absVelocity = abs(_backgroundInverseVelocity); - int absVelocity = abs(_backgroundInverseVelocity); + int numberOfSteps = 0; + while (_accumulatedVelocityMilliseconds >= absVelocity) { + _accumulatedVelocityMilliseconds -= absVelocity; + numberOfSteps++; + } - int numberOfSteps = 0; - while (_accumulatedVelocityMilliseconds >= absVelocity) { - _accumulatedVelocityMilliseconds -= absVelocity; - numberOfSteps++; + // Choose the direction of movement using the sign of the velocity + moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); } - // Choose the direction of movement using the sign of the velocity - moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); - // Warp the entire backbuffer _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); From 26159e6ea52cab35eeba425c066e2faaa0540c2f Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 10:44:56 -0500 Subject: [PATCH 0557/1332] ZVISION: Only warp the backbuffer if we're in PANORAMA or TILT --- engines/zvision/render_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 31b54b4a158a..5bc709553b28 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -76,7 +76,10 @@ void RenderManager::update(uint deltaTimeInMillis) { } // Warp the entire backbuffer - _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); + //RenderTable::RenderState state = _renderTable.getRenderState(); + //if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + // _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); + //} // Blit the backbuffer to the screen _system->copyRectToScreen(_backbuffer.getBasePtr(0, 0), _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); From af0a58ecda26f12c630db759667d7adc79e733d6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 10:45:31 -0500 Subject: [PATCH 0558/1332] ZVISION: Fix copyTransposedRectToBackBuffer --- engines/zvision/render_manager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 5bc709553b28..bfafd7fe19fd 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -152,21 +152,23 @@ void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 return; if (isTransposed) { - copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(subRectangle.left, subRectangle.right), surface.w, destRect.left, destRect.top, destRect.width(), destRect.height()); + copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(subRectangle.left, subRectangle.top), surface.h, destRect.left, destRect.top, destRect.width(), destRect.height()); } else { _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.top), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } } -void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageHeight, int x, int y, int width, int height) { +void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int x, int y, int width, int height) { uint16 *dest = (uint16 *)_backbuffer.getBasePtr(x, y); - for (int x = 0; x < width; x++) { - int columnOffset = x * imageHeight; - for (int y = 0; y < height; y++) { - *dest = buffer[columnOffset + y]; + for (int i = 0; i < width; i++) { + int columnOffset = i * imageWidth; + for (int j = 0; j < height; j++) { + *dest = buffer[columnOffset + j]; dest++; } + + dest += _backbuffer.w; } } From e0937a12cd47201a6dce6822e20657b2df5785af Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 12:17:29 -0500 Subject: [PATCH 0559/1332] ZVISION: Move _cursorManager construction after the folder directories have been registered with SearchMan --- engines/zvision/zvision.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index ff234bf3fed9..080c763342c5 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -69,7 +69,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, _workingWindow, _pixelFormat); - _cursorManager = new CursorManager(this, &_pixelFormat); debug("ZVision::ZVision"); } @@ -116,6 +115,8 @@ void ZVision::initialize() { initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); + // CursorManager must be created after all the directories have been added + _cursorManager = new CursorManager(this, &_pixelFormat); _cursorManager->initialize(); _scriptManager->initialize(); From 1c6ffd133acdddb8d08249d3a49caf523fd1d01e Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 12:18:19 -0500 Subject: [PATCH 0560/1332] ZVISION: Clean up backbuffer memory after we're finished with it --- engines/zvision/render_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index bfafd7fe19fd..d8b8ce167ddb 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -56,6 +56,7 @@ RenderManager::~RenderManager() { } _backbuffer.free(); + delete[] _warpedBackbuffer; } void RenderManager::update(uint deltaTimeInMillis) { From a3c39f48767b06a8015269e48ca929fbc5bfa637 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 12:19:00 -0500 Subject: [PATCH 0561/1332] ZVISION: Fix memory corruption in copyTransposedRectToBackBuffer --- engines/zvision/render_manager.cpp | 34 +++++++++++++++++------------- engines/zvision/render_manager.h | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index d8b8ce167ddb..1f2c3a20c75a 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -77,13 +77,16 @@ void RenderManager::update(uint deltaTimeInMillis) { } // Warp the entire backbuffer - //RenderTable::RenderState state = _renderTable.getRenderState(); - //if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { - // _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); - //} + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); + _system->copyRectToScreen(_warpedBackbuffer, _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); + } else { + _system->copyRectToScreen(_backbuffer.getBasePtr(0, 0), _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); + } // Blit the backbuffer to the screen - _system->copyRectToScreen(_backbuffer.getBasePtr(0, 0), _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); + } void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed) { @@ -153,23 +156,24 @@ void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 return; if (isTransposed) { - copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(subRectangle.left, subRectangle.top), surface.h, destRect.left, destRect.top, destRect.width(), destRect.height()); + copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(0, 0), surface.h, destRect.left, destRect.top, destRect.width(), destRect.height(), subRectangle); } else { _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.top), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); } } -void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int x, int y, int width, int height) { - uint16 *dest = (uint16 *)_backbuffer.getBasePtr(x, y); +void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int destinationX, int destinationY, int width, int height, const Common::Rect &subRect) { + uint16 *dest = (uint16 *)_backbuffer.getBasePtr(0, 0); + + for (int16 x = subRect.left; x < subRect.right; x++) { + int16 normalizedX = x - subRect.left + destinationX; + int columnOffset = x * imageWidth; - for (int i = 0; i < width; i++) { - int columnOffset = i * imageWidth; - for (int j = 0; j < height; j++) { - *dest = buffer[columnOffset + j]; - dest++; - } + for (int16 y = subRect.top; y < subRect.bottom; y++) { + int16 normalizeY = y - subRect.top + destinationY; - dest += _backbuffer.w; + dest[normalizeY * _backbuffer.w + normalizedX] = buffer[columnOffset + y]; + } } } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index d5bf61f6a043..f59f50d4d7b2 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -171,7 +171,7 @@ class RenderManager { */ void renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed); - void copyTransposedRectToBackbuffer(const uint16 *buffer, int imageHeight, int x, int y, int width, int height); + void copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int destinationX, int destinationY, int width, int height, const Common::Rect &subRect); void moveBackground(int offset); }; From 4430e435d8c437cf236f432684fa5dba76f990e7 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 19:24:40 +0200 Subject: [PATCH 0562/1332] AVALANCHE: Upgrade Scrolls::normscroll(). --- engines/avalanche/avalot.cpp | 140 ++++++++++++++++----------------- engines/avalanche/scrolls2.cpp | 13 +-- 2 files changed, 78 insertions(+), 75 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index fff969bc34f8..229159fafe6f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -61,6 +61,76 @@ Avalot::Avalot(AvalancheEngine *vm) { _vm = vm; } +void Avalot::handleKeyDown(Common::Event &event) { + //if (keyboardclick) + // click(); + // + // To be implemented later with the sounds, I assume. + + if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) + _vm->_parser->handleInputText(event); + else + switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. + case Common::KEYCODE_KP8: + event.kbd.keycode = Common::KEYCODE_UP; + break; + case Common::KEYCODE_KP2: + event.kbd.keycode = Common::KEYCODE_DOWN; + break; + case Common::KEYCODE_KP6: + event.kbd.keycode = Common::KEYCODE_RIGHT; + break; + case Common::KEYCODE_KP4: + event.kbd.keycode = Common::KEYCODE_LEFT; + break; + case Common::KEYCODE_KP9: + event.kbd.keycode = Common::KEYCODE_PAGEUP; + break; + case Common::KEYCODE_KP3: + event.kbd.keycode = Common::KEYCODE_PAGEDOWN; + break; + case Common::KEYCODE_KP7: + event.kbd.keycode = Common::KEYCODE_HOME; + break; + case Common::KEYCODE_KP1: + event.kbd.keycode = Common::KEYCODE_END; + break; + } + + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + case Common::KEYCODE_DOWN: + case Common::KEYCODE_RIGHT: + case Common::KEYCODE_LEFT: + case Common::KEYCODE_PAGEUP: + case Common::KEYCODE_PAGEDOWN: + case Common::KEYCODE_HOME: + case Common::KEYCODE_END: + case Common::KEYCODE_KP5: + if (_vm->_gyro->alive) { + _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. + _vm->_lucerna->showrw(); + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); + return; + } + case Common::KEYCODE_BACKSPACE: + _vm->_parser->handleBackspace(); + break; + case Common::KEYCODE_RETURN: + _vm->_parser->handleReturn(); + break; + } + + _vm->_lucerna->showrw(); + if (_vm->_gyro->demo) + _vm->_basher->get_demorec(); +} + + + + + void Avalot::setup() { int16 gd, gm; @@ -150,76 +220,6 @@ void Avalot::setup() { _vm->_visa->dixi('q', 83); // Info on the game, etc. } - - -void Avalot::handleKeyDown(Common::Event &event) { - //if (keyboardclick) - // click(); - // - // To be implemented later with the sounds, I assume. - - if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) - _vm->_parser->handleInputText(event); - else - switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. - case Common::KEYCODE_KP8: - event.kbd.keycode = Common::KEYCODE_UP; - break; - case Common::KEYCODE_KP2: - event.kbd.keycode = Common::KEYCODE_DOWN; - break; - case Common::KEYCODE_KP6: - event.kbd.keycode = Common::KEYCODE_RIGHT; - break; - case Common::KEYCODE_KP4: - event.kbd.keycode = Common::KEYCODE_LEFT; - break; - case Common::KEYCODE_KP9: - event.kbd.keycode = Common::KEYCODE_PAGEUP; - break; - case Common::KEYCODE_KP3: - event.kbd.keycode = Common::KEYCODE_PAGEDOWN; - break; - case Common::KEYCODE_KP7: - event.kbd.keycode = Common::KEYCODE_HOME; - break; - case Common::KEYCODE_KP1: - event.kbd.keycode = Common::KEYCODE_END; - break; - } - - switch (event.kbd.keycode) { - case Common::KEYCODE_UP: - case Common::KEYCODE_DOWN: - case Common::KEYCODE_RIGHT: - case Common::KEYCODE_LEFT: - case Common::KEYCODE_PAGEUP: - case Common::KEYCODE_PAGEDOWN: - case Common::KEYCODE_HOME: - case Common::KEYCODE_END: - case Common::KEYCODE_KP5: - if (_vm->_gyro->alive) { - _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. - _vm->_lucerna->showrw(); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); - return; - } - case Common::KEYCODE_BACKSPACE: - _vm->_parser->handleBackspace(); - break; - case Common::KEYCODE_RETURN: - _vm->_parser->handleReturn(); - break; - } - - _vm->_lucerna->showrw(); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); -} - - - void Avalot::run(Common::String arg) { setup(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4e7507a7d3ba..1457503a98c5 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -161,12 +161,14 @@ void Scrolls::normscroll() { ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! - _vm->_graphics->refreshScreen(); - + Common::Event event; while (!_vm->shouldQuit()) { + _vm->_graphics->refreshScreen(); + _vm->getEvent(event); - if ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS))) + if ((event.type == Common::EVENT_LBUTTONUP) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS)))) break; } @@ -205,7 +207,8 @@ void Scrolls::normscroll() { // //#ifdef RECORD record_one(); #endif // - //_vm->_gyro->screturn = r == '#'; /* "back door" */ +// _vm->_gyro->screturn = r == '#'; /* "back door" */ + state(0); _vm->_gyro->seescroll = false; _vm->_lucerna->mousepage(_vm->_gyro->cp); @@ -558,7 +561,7 @@ void Scrolls::bubble(func2 gotoit) { CursorMan.showMouse(false); _vm->_gyro->dropsok = true; - /*setvisualpage(cp); + //setvisualpage(cp); CursorMan.showMouse(true); /*sink;*/ _vm->_gyro->oncandopageswap = true; resetscrolldriver(); From 2bcca8a0dd17f4ae55ff4587a54c63d60a021b03 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 19:29:11 +0200 Subject: [PATCH 0563/1332] AVALANCHE: Remove multiple definition. (Already defined in Graphics.) --- engines/avalanche/trip6.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index b960edc3aed2..7c86b4012126 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -39,12 +39,6 @@ namespace Avalanche { class AvalancheEngine; - -typedef byte manitype[2049]; // manitype = array[5..2053] of byte; -// Be aware!!! - -typedef byte siltype[51][11]; /* 35, 4 */ - struct adxtype { /* Second revision of ADX type */ Common::String name/*[13]*/; /* name of character */ // uruk: Note to self: TRAILING /0 !!! Real size: 12 Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. From 05f3838b16a5e9533c2a0faeb18dfc50610eface Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 23:02:53 +0200 Subject: [PATCH 0564/1332] AVALANCHE: Partially implement Lucerna::checkclick(), upgrade other parts of the code during the process. Repair Gyro::load_a_mouse(). --- engines/avalanche/avalanche.cpp | 6 ++ engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 103 ++++++++++++++++++++++++++++++++ engines/avalanche/lucerna2.h | 6 ++ engines/avalanche/scrolls2.cpp | 1 + 5 files changed, 117 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 8196065bef00..c2d0e0bd5948 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -137,6 +137,12 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { + case Common::EVENT_LBUTTONDOWN: + _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick(). + break; + case Common::EVENT_LBUTTONUP: + _lucerna->holdLeftMouse = false; // Same as above. + break; case Common::EVENT_KEYDOWN: _avalot->handleKeyDown(event); } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fa95a538c7cc..5278a3dc760c 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -549,7 +549,7 @@ void Gyro::load_a_mouse(byte which) { - CursorMan.replaceCursor(cursor.pixels, 16, 32, mps[which].horzhotspot, mps[which].verthotspot, 255, false); + CursorMan.replaceCursor(cursor.pixels, 16, 32, mps[which - 1].horzhotspot, mps[which - 1].verthotspot * 2, 255, false); cursor.free(); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 340116b8b3a2..8dfb78ab8c2a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -978,6 +978,109 @@ void Lucerna::verte() { } void Lucerna::checkclick() { + bytefield b; + + Common::Point cursorPos = _vm->getMousePos(); + _vm->_gyro->ontoolbar = _vm->_gyro->slow_computer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); + + if (_vm->_gyro->mrelease > 0) + _vm->_gyro->after_the_scroll = false; + + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) + _vm->_gyro->newpointer(1); // up arrow + else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) + _vm->_gyro->newpointer(8); //I-beam + else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) + _vm->_gyro->newpointer(2); // screwdriver + else if (!_vm->_gyro->ddmnow) { // Dropdown can handle its own pointers. + if (holdLeftMouse) { + _vm->_gyro->newpointer(7); // Mark's crosshairs + verte(); // Normally, if you click on the picture, you're guiding Avvy around. + } else + _vm->_gyro->newpointer(4); // fletch + } + + + + //if (_vm->_gyro->mpress > 0) { + // switch (_vm->_gyro->mpy) { + // case RANGE_11(0, 10): + // if (_vm->_gyro->dropsok) topcheck(); + // break; + // case 11 ... 158: + // if (!_vm->_gyro->dropsok) + // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext; + // break; /* But otherwise, it's + // equivalent to pressing Enter. */ + // case RANGE_11(159, 169): { /* Click on command line */ + // cursor_off(); + // curpos = (_vm->_gyro->mx - 16) / 8; + // if (curpos > length(current) + 1) + // curpos = length(current) + 1; + // if (curpos < 1) + // curpos = 1; + // cursor_on(); + // } + // break; + // case 170 ... 200: + // switch (_vm->_gyro->mpx) { /* bottom check */ + // case 0 ... 207: + // mouseway(); + // break; + // case 208 ... 260: { /* Examine the thing */ + // do { + // _vm->_gyro->check(); + // } while (!(_vm->_gyro->mrelease > 0)); + // if (_vm->_gyro->thinkthing) { + // _vm->_acci->thing = _vm->_gyro->thinks; + // _vm->_acci->thing += 49; + // _vm->_acci->person = _vm->_acci->pardon; + // } else { + // _vm->_acci->person = _vm->_gyro->thinks; + // _vm->_acci->thing = _vm->_acci->pardon; + // } + // callverb(_vm->_acci->vb_exam); + // } + // break; + // case 261 ... 319: { + // do { + // checkclick(); + // } while (!(_vm->_gyro->mrelease > 0)); + // callverb(_vm->_acci->vb_score); + // } + // break; + // case 320 ... 357: { + // _vm->_trip->tr[0].xs = _vm->_gyro->walk; + // _vm->_trip->newspeed(); + // } + // break; + // case 358 ... 395: { + // _vm->_trip->tr[0].xs = _vm->_gyro->run; + // _vm->_trip->newspeed(); + // } + // break; + // case 396 ... 483: + // fxtoggle(); + // break; /* "sound" */ + // /* 484..534: begin { clock } + // off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; + // end;*/ + // case 535 ... 640: + // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext; + // break; + // } + // break; + // } + //} + + /* if mrelease>0 then + begin + if (cw<>177) and (mry>10) then + begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; + end;*/ + + + warning("STUB: Lucerna::checkclick()"); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 4cee781fd6db..b422f74c392d 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -38,6 +38,10 @@ class AvalancheEngine; class Lucerna { public: + bool holdLeftMouse; + + + Lucerna(AvalancheEngine *vm); void init(); @@ -134,6 +138,8 @@ class Lucerna { Common::File f; + + Common::String nextstring(); void scram1(Common::String &x); void unscramble(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1457503a98c5..d141edc1014a 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -213,6 +213,7 @@ void Scrolls::normscroll() { _vm->_gyro->seescroll = false; _vm->_lucerna->mousepage(_vm->_gyro->cp); CursorMan.showMouse(false); + _vm->_lucerna->holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::normscroll()"); } From 27d7ae56a629f308e605b97988f4ed4d8e0a22bc Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 16 Aug 2013 23:29:03 +0200 Subject: [PATCH 0565/1332] AVALANCHE: Repair Lucerna::verte(). --- engines/avalanche/lucerna2.cpp | 40 +++++++++++++++++----------------- engines/avalanche/lucerna2.h | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 8dfb78ab8c2a..5762b7644143 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -924,55 +924,55 @@ void Lucerna::objectlist() { } } -void Lucerna::verte() { - byte what; - +void Lucerna::verte(Common::Point cursorPos) { if (! _vm->_gyro->dna.user_moves_avvy) return; + cursorPos.y /= 2; + byte what; - /* _vm->_trip->tr[0] : that's the only one we're interested in here */ - if (_vm->_gyro->mx < _vm->_trip->tr[0].x) + // _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.) + if (cursorPos.x < _vm->_trip->tr[0].x) what = 1; - else if (_vm->_gyro->mx > (unsigned char)(_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info.xl)) + else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info.xl)) what = 2; else - what = 0; /* On top */ + what = 0; // On top - if (_vm->_gyro->my < _vm->_trip->tr[0].y) + if (cursorPos.y < _vm->_trip->tr[0].y) what += 3; - else if (_vm->_gyro->my > (unsigned char)(_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info.yl)) + else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info.yl)) what += 6; switch (what) { case 0: _vm->_trip->stopwalking(); - break; /* Clicked on Avvy- no movement */ + break; // Clicked on Avvy: no movement. case 1: - _vm->_trip->rwsp(1, _vm->_trip->left); + _vm->_trip->rwsp(0, _vm->_trip->left); break; case 2: - _vm->_trip->rwsp(1, _vm->_trip->right); + _vm->_trip->rwsp(0, _vm->_trip->right); break; case 3: - _vm->_trip->rwsp(1, _vm->_trip->up); + _vm->_trip->rwsp(0, _vm->_trip->up); break; case 4: - _vm->_trip->rwsp(1, _vm->_trip->ul); + _vm->_trip->rwsp(0, _vm->_trip->ul); break; case 5: - _vm->_trip->rwsp(1, _vm->_trip->ur); + _vm->_trip->rwsp(0, _vm->_trip->ur); break; case 6: - _vm->_trip->rwsp(1, _vm->_trip->down); + _vm->_trip->rwsp(0, _vm->_trip->down); break; case 7: - _vm->_trip->rwsp(1, _vm->_trip->dl); + _vm->_trip->rwsp(0, _vm->_trip->dl); break; case 8: - _vm->_trip->rwsp(1, _vm->_trip->dr); + _vm->_trip->rwsp(0, _vm->_trip->dr); break; - } /* no other values are possible... */ + } // No other values are possible. showrw(); } @@ -995,7 +995,7 @@ void Lucerna::checkclick() { else if (!_vm->_gyro->ddmnow) { // Dropdown can handle its own pointers. if (holdLeftMouse) { _vm->_gyro->newpointer(7); // Mark's crosshairs - verte(); // Normally, if you click on the picture, you're guiding Avvy around. + verte(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else _vm->_gyro->newpointer(4); // fletch } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index b422f74c392d..840c69042f0e 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -154,7 +154,7 @@ class Lucerna { void topcheck(); - void verte(); + void verte(Common::Point cursorPos); int8 fades(int8 x); From 0a840fa664c210dfb85d6c62d4a80a08ca650843 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 16 Aug 2013 17:27:51 -0500 Subject: [PATCH 0566/1332] ZVISION: Rename 'x' variable in changeLocation to 'offset' Since it can be in either the x or the y direction --- engines/zvision/actions.cpp | 4 ++-- engines/zvision/actions.h | 2 +- engines/zvision/script_manager.cpp | 8 ++++---- engines/zvision/script_manager.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 2316530c6726..504c250597f8 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -83,12 +83,12 @@ bool ActionAttenuate::execute(ZVision *engine) { ////////////////////////////////////////////////////////////////////////////// ActionChangeLocation::ActionChangeLocation(const Common::String &line) { - sscanf(line.c_str(), "%*[^(](%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_x); + sscanf(line.c_str(), "%*[^(](%c,%c,%c%c,%u)", &_world, &_room, &_node, &_view, &_offset); } bool ActionChangeLocation::execute(ZVision *engine) { // We can't directly call ScriptManager::ChangeLocationIntern() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking - engine->getScriptManager()->changeLocation(_world, _room, _node, _view, _x); + engine->getScriptManager()->changeLocation(_world, _room, _node, _view, _offset); // Tell the puzzle system to stop checking any more puzzles return false; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 511f3d9b8344..aa67be20c770 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -126,7 +126,7 @@ class ActionChangeLocation : public ResultAction { char _room; char _node; char _view; - uint32 _x; + uint32 _offset; }; class ActionCrossfade : public ResultAction { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 6aaf5773e01d..5c0e336a5db8 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -191,19 +191,19 @@ void ScriptManager::addActionNode(const Common::SharedPtr &node) { _activeNodes.push_back(node); } -void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 x) { +void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { _nextLocation.world = world; _nextLocation.room = room; _nextLocation.node = node; _nextLocation.view = view; - _nextLocation.x = x; + _nextLocation.offset = offset; _changeLocation = true; } void ScriptManager::changeLocationIntern() { assert(_nextLocation.world != 0); - debug("Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.x); + debug("Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset); // Clear all the containers _referenceTable.clear(); @@ -217,7 +217,7 @@ void ScriptManager::changeLocationIntern() { _engine->getCursorManager()->revertToIdle(); // Change the background position - _engine->getRenderManager()->setBackgroundPosition(_nextLocation.x); + _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); // Reset the background velocity _engine->getRenderManager()->setBackgroundVelocity(0); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 8e79548f7798..c0801edd5e8d 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -44,7 +44,7 @@ struct Location { char room; char node; char view; - uint32 x; + uint32 offset; }; class ScriptManager { @@ -86,7 +86,7 @@ class ScriptManager { void addActionNode(const Common::SharedPtr &node); - void changeLocation(char world, char room, char node, char view, uint32 x); + void changeLocation(char world, char room, char node, char view, uint32 offset); private: void createReferenceTable(); From 84bf98c9e5bd0d2b3a50f753714852e6d356d985 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 17 Aug 2013 13:45:15 +0200 Subject: [PATCH 0567/1332] AVALANCHE: Repair Avalot::handleKeyDown(), add comments to parser.h. --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/parser.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 229159fafe6f..3069c8aef936 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -107,7 +107,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_HOME: case Common::KEYCODE_END: case Common::KEYCODE_KP5: - if (_vm->_gyro->alive) { + if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) { _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->showrw(); if (_vm->_gyro->demo) diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 6b9240011cd0..cac8aa22b7e6 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -35,9 +35,9 @@ class AvalancheEngine; class Parser { public: - Common::String _inputText; + Common::String _inputText; // Original name: current Common::String _inputTextBackup; - byte _inputTextPos; + byte _inputTextPos; // Original name: curpos bool _quote; // 66 or 99 next? byte _leftMargin; bool _cursorState; From 87159b96399b579cc79ce7d78e7710e34cabe460 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 17 Aug 2013 15:07:02 +0200 Subject: [PATCH 0568/1332] AVALANCHE: Implement the rest of Lucerna::checkclick() and everything connected to it. (Except sounds.) --- engines/avalanche/acci2.cpp | 109 +++++++++++++++------ engines/avalanche/acci2.h | 2 +- engines/avalanche/lucerna2.cpp | 169 +++++++++++++++++---------------- engines/avalanche/lucerna2.h | 2 +- engines/avalanche/scrolls2.cpp | 38 ++++---- 5 files changed, 188 insertions(+), 132 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 48c8118114fb..0ba511e8e7e9 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -44,6 +44,7 @@ #include "common/textconsole.h" #include +#include /*#include "NimUnit.h"*/ @@ -274,33 +275,38 @@ begin end;*/ Common::String Acci::rank() { - byte fv; - - Common::String rank_result = ""; - for (fv = 1; fv <= 8; fv++) { + for (byte fv = 0; fv < 8; fv++) { if ((_vm->_gyro->dna.score >= ranks[fv].score) && (_vm->_gyro->dna.score < ranks[fv + 1].score)) { - rank_result = ranks[fv].title; - return rank_result; + return ranks[fv].title; } } - - return rank_result; + return ""; } Common::String Acci::totaltime() { - const double ticks_in_1_sec = double(65535) / 3600; + const double ticks_in_1_sec = (double)(65535) / 3600; uint16 h, m, s; Common::String a; - /* There are 65535 clock ticks in a second, - 1092.25 in a minute, and - 65535 in an hour. */ - Common::String totaltime_result; - - warning("STUB: Acci::totaltime()"); - - totaltime_result = a; - return totaltime_result; + // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. + h = _vm->_gyro->dna.total_time / ticks_in_1_sec; // No. of seconds. + if (h < 0) + h = ceil((float)h); + else + h = floor((float)h); + m = h % 3600; + h = h / 3600; + s = m % 60; + m = m / 60; + + a = "You've been playing for "; + if (h > 0) + a = a + _vm->_gyro->strf(h) + " hours, "; + if ((m > 0) || (h != 0)) + a = a + _vm->_gyro->strf(m) + " minutes and "; + a = a + _vm->_gyro->strf(s) + " seconds."; + + return a; } @@ -602,8 +608,32 @@ void Acci::parse() { _vm->_gyro->her = person; } -void Acci::examobj() { /* Examine a standard object-thing */ - warning("STUB: Acci::examobj()"); +void Acci::examobj() { + if (thing != _vm->_gyro->thinks) + _vm->_lucerna->thinkabout(thing, _vm->_gyro->a_thing); + switch (thing) { + case _vm->_gyro->wine : + switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine. + case 1: + _vm->_visa->dixi('t', 1); // Normal examine wine scroll + break; + case 2: + _vm->_visa->dixi('d', 6); // Bad wine + break; + case 3: + _vm->_visa->dixi('d', 7); // Vinegar + break; + } + break; + case _vm->_gyro->onion: + if (_vm->_gyro->dna.rotten_onion) + _vm->_visa->dixi('q', 21); // Yucky onion. + else + _vm->_visa->dixi('t', 18); // Normal onion scroll + break; + default: + _vm->_visa->dixi('t', thing); // <<< Ordinarily + } } bool Acci::personshere() { // Person equivalent of "holding". @@ -624,8 +654,19 @@ void Acci::exampers() { } bool Acci::holding() { - warning("STUB: Acci::holding()"); - return true; + if ((51 <= thing) && (thing <= 99)) // Also. + return true; + + bool holdingResult = false; + + if (thing > 100) + _vm->_scrolls->display("Be reasonable!"); + else if (!_vm->_gyro->dna.obj[thing]) // Verbs that need "thing" to be in the inventory. + _vm->_scrolls->display("You're not holding it, Avvy."); + else + holdingResult = true; + + return holdingResult; } @@ -635,9 +676,21 @@ void Acci::special(bool before) { } void Acci::examine() { - /* Examine. EITHER it's an object OR it's an Also OR it's a person OR - it's something else. */ - warning("STUB: Acci::examine()"); + // EITHER it's an object OR it's an Also OR it's a person OR it's something else. + if ((person == pardon) && (thing != pardon)) { + if (holding()) { + // Remember: it's been Slipped! Ie subtract 49. + if ((1 <= thing) && (thing <= 49)) // Standard object + examobj(); + else if ((50 <= thing) && (thing <= 100)) { // Also thing + special(true); + _vm->_scrolls->display(*_vm->_gyro->also[thing - 51][0]); + special(false); + } + } + } else if (person != pardon) + exampers(); + else _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. } @@ -1706,9 +1759,9 @@ void Acci::do_that() { _vm->_lucerna->gameover(); break; case vb_score: - _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ",\3\rout of a " + - "possible 128.\r\rThis gives you a rank of " + rank() + - ".\r\r" + totaltime()); + _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ',' + _vm->_scrolls->kControlCenter + + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totaltime()); break; case vb_put: putproc(); diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 2a97b9852998..2b174f0a13c3 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -169,7 +169,7 @@ class Acci { void clearuint16s(); - void examobj(); + void examobj(); // Examine a standard object-thing bool personshere(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5762b7644143..f632a66db0e7 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -879,8 +879,43 @@ void Lucerna::topcheck() { /* Do this one */ } -void Lucerna::mouseway() { - warning("STUB: Lucerna::mouseway()"); +void Lucerna::mouseway(const Common::Point &cursorPos) { + byte col = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); + + switch (col) { + case green: { + _vm->_gyro->dna.rw = _vm->_trip->up; + _vm->_trip->rwsp(0, _vm->_trip->up); + showrw(); + } + break; + case brown: { + _vm->_gyro->dna.rw = _vm->_trip->down; + _vm->_trip->rwsp(0, _vm->_trip->down); + showrw(); + } + break; + case cyan: { + _vm->_gyro->dna.rw = _vm->_trip->left; + _vm->_trip->rwsp(0, _vm->_trip->left); + showrw(); + } + break; + case lightmagenta: { + _vm->_gyro->dna.rw = _vm->_trip->right; + _vm->_trip->rwsp(0, _vm->_trip->right); + showrw(); + } + break; + case red: + case white: + case lightcyan: + case yellow: { // Fall-throughs are intended. + _vm->_trip->stopwalking(); + showrw(); + } + break; + } } void Lucerna::inkey() { @@ -1000,88 +1035,54 @@ void Lucerna::checkclick() { _vm->_gyro->newpointer(4); // fletch } - - - //if (_vm->_gyro->mpress > 0) { - // switch (_vm->_gyro->mpy) { - // case RANGE_11(0, 10): - // if (_vm->_gyro->dropsok) topcheck(); - // break; - // case 11 ... 158: - // if (!_vm->_gyro->dropsok) - // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext; - // break; /* But otherwise, it's - // equivalent to pressing Enter. */ - // case RANGE_11(159, 169): { /* Click on command line */ - // cursor_off(); - // curpos = (_vm->_gyro->mx - 16) / 8; - // if (curpos > length(current) + 1) - // curpos = length(current) + 1; - // if (curpos < 1) - // curpos = 1; - // cursor_on(); - // } - // break; - // case 170 ... 200: - // switch (_vm->_gyro->mpx) { /* bottom check */ - // case 0 ... 207: - // mouseway(); - // break; - // case 208 ... 260: { /* Examine the thing */ - // do { - // _vm->_gyro->check(); - // } while (!(_vm->_gyro->mrelease > 0)); - // if (_vm->_gyro->thinkthing) { - // _vm->_acci->thing = _vm->_gyro->thinks; - // _vm->_acci->thing += 49; - // _vm->_acci->person = _vm->_acci->pardon; - // } else { - // _vm->_acci->person = _vm->_gyro->thinks; - // _vm->_acci->thing = _vm->_acci->pardon; - // } - // callverb(_vm->_acci->vb_exam); - // } - // break; - // case 261 ... 319: { - // do { - // checkclick(); - // } while (!(_vm->_gyro->mrelease > 0)); - // callverb(_vm->_acci->vb_score); - // } - // break; - // case 320 ... 357: { - // _vm->_trip->tr[0].xs = _vm->_gyro->walk; - // _vm->_trip->newspeed(); - // } - // break; - // case 358 ... 395: { - // _vm->_trip->tr[0].xs = _vm->_gyro->run; - // _vm->_trip->newspeed(); - // } - // break; - // case 396 ... 483: - // fxtoggle(); - // break; /* "sound" */ - // /* 484..534: begin { clock } - // off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on; - // end;*/ - // case 535 ... 640: - // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext; - // break; - // } - // break; - // } - //} - - /* if mrelease>0 then - begin - if (cw<>177) and (mry>10) then - begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end; - end;*/ - - - - warning("STUB: Lucerna::checkclick()"); + if (holdLeftMouse) + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Clink on the dropdown menu. + if (_vm->_gyro->dropsok) + topcheck(); + } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. + _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; + if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) + _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; + if (_vm->_parser->_inputTextPos < 1) + _vm->_parser->_inputTextPos = 1; + _vm->_parser->_inputTextPos--; + _vm->_parser->plotText(); + } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. + if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. + if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) + mouseway(cursorPos); + } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the thing. + do { + _vm->updateEvents(); + } while (holdLeftMouse); + + if (_vm->_gyro->thinkthing) { + _vm->_acci->thing = _vm->_gyro->thinks; + _vm->_acci->thing += 49; + _vm->_acci->person = _vm->_acci->pardon; + } else { + _vm->_acci->person = _vm->_gyro->thinks; + _vm->_acci->thing = _vm->_acci->pardon; + } + callverb(_vm->_acci->vb_exam); + } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. + do { + _vm->updateEvents(); + } while (holdLeftMouse); + + callverb(_vm->_acci->vb_score); + } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. + _vm->_trip->tr[0].xs = _vm->_gyro->walk; + _vm->_trip->newspeed(); + } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. + _vm->_trip->tr[0].xs = _vm->_gyro->run; + _vm->_trip->newspeed(); + } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) + fxtoggle(); + else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) + _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; + } else if (!_vm->_gyro->dropsok) + _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; } void Lucerna::mouse_init() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 840c69042f0e..8ab7342c426e 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -70,7 +70,7 @@ class Lucerna { void points(byte num); /* Add on no. of points */ - void mouseway(); + void mouseway(const Common::Point &cursorPos); void inkey(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index d141edc1014a..104a6170bc2f 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -131,7 +131,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit // We have to draw the characters one-by-one because of the accidental font changes. i++; Common::String chr(z[xx]); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, x * 8 + offset * 4 + i * 8, y, black); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black); _vm->_logger->log_scrollchar(Common::String(z[xx])); } @@ -592,21 +592,21 @@ void Scrolls::natural() { /* Natural state of bubbles */ Common::String Scrolls::lsd() { Common::String x; - Common::String lsd_result; - if (_vm->_gyro->dna.pence < 12) { - /* just pence */ + if (_vm->_gyro->dna.pence < 12) { // just pence x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd'; - } else if (_vm->_gyro->dna.pence < 240) { - /* shillings & pence */ - x = _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(12)) + '/'; - if ((_vm->_gyro->dna.pence % int32(12)) == 0) x = x + '-'; - else x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12)); - } else /* L, s & d */ - x = Common::String('') + _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(240)) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / int32(12)) % int32(20)) - + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12)); - if (_vm->_gyro->dna.pence > 12) x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)"; - lsd_result = x; - return lsd_result; + } else if (_vm->_gyro->dna.pence < 240) { // shillings & pence + x = _vm->_gyro->strf(_vm->_gyro->dna.pence / 12) + '/'; + if ((_vm->_gyro->dna.pence % 12) == 0) + x = x + '-'; + else + x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12); + } else // L, s & d + x = Common::String('') + _vm->_gyro->strf(_vm->_gyro->dna.pence / 240) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / 12) % 20) + + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12); + if (_vm->_gyro->dna.pence > 12) + x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)"; + + return x; } @@ -661,7 +661,9 @@ void Scrolls::calldrivers() { } } - for (fv = 0; fv < _vm->_gyro->bufsize; fv++) + uint16 size = _vm->_gyro->bufsize; + + for (fv = 0; fv < size; fv++) if (mouthnext) { if (_vm->_gyro->buffer[fv] == kControlRegister) param = 0; @@ -734,8 +736,8 @@ void Scrolls::calldrivers() { case kControlNegative: { switch (param) { case 1: - display(lsd() + kControlToBuffer); - break; /* insert cash balance (recursion) */ + display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) + break; case 2: display(_vm->_acci->words[_vm->_acci->first_password + _vm->_gyro->dna.pass_num].w + kControlToBuffer); break; From 6555d7d5db7431f3c707da85c33925c415483898 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 17 Aug 2013 16:54:23 +0200 Subject: [PATCH 0569/1332] AVALANCHE: Repair Scrolls::drawscroll(). --- engines/avalanche/scrolls2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 104a6170bc2f..8019a353127d 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -446,7 +446,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t my += 12; } - _vm->_gyro->underscroll = my * 2 + 12 + 1; // Multiplying because of the doubled screen height. + _vm->_gyro->underscroll = my * 2 + 6; // Multiplying because of the doubled screen height. //setvisualpage(1 - cp); dingdongbell(); //my = getpixel(0, 0); From 50831c19018598bc4a9007e6d71cd3986e5fd196 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 17 Aug 2013 17:14:00 +0200 Subject: [PATCH 0570/1332] AVALANCHE: Implement Trip::newspeed(). --- engines/avalanche/trip6.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index dfcdd5ce20a3..1114bd52fb2d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1077,9 +1077,29 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { } void Trip::newspeed() { -/* Given that you've just changed the speed in triptype.xs, this adjusts - ix. */ - warning("STUB: Trip::newspeed()"); + // Given that you've just changed the speed in triptype.xs, this adjusts ix. + const bytefield lightspace = {40, 199, 47, 199}; + byte page_; + + tr[0].ix = (tr[0].ix / 3) * tr[0].xs; + //setactivepage(3); + + if (tr[0].xs == _vm->_gyro->run) + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, yellow); + else + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, yellow); + + if (tr[0].xs == _vm->_gyro->run) + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, lightblue); + else + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, lightblue); + + _vm->_graphics->refreshScreen(); + + //setactivepage(1 - cp); + for (page_ = 0; page_ <= 1; page_ ++) + getset[page_].remember(lightspace); + } void Trip::rwsp(byte t, byte r) { From 8e0301973147ea864e073e1b9f52c9f59f1520b2 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 18 Aug 2013 10:37:05 +0200 Subject: [PATCH 0571/1332] AVALANCHE: Minor repairs in Avalanche and Trip. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/trip6.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c2d0e0bd5948..b950bdb42775 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,7 +123,7 @@ Common::Platform AvalancheEngine::getPlatform() const { bool AvalancheEngine::hasFeature(EngineFeature f) const { - return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); + return false; } const char *AvalancheEngine::getCopyrightString() const { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 1114bd52fb2d..d4573a0851ca 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1082,6 +1082,7 @@ void Trip::newspeed() { byte page_; tr[0].ix = (tr[0].ix / 3) * tr[0].xs; + //setactivepage(3); if (tr[0].xs == _vm->_gyro->run) @@ -1094,9 +1095,8 @@ void Trip::newspeed() { else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, lightblue); - _vm->_graphics->refreshScreen(); - //setactivepage(1 - cp); + for (page_ = 0; page_ <= 1; page_ ++) getset[page_].remember(lightspace); From c4891ace820ab47c5136e100adacd31418ea615a Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 18 Aug 2013 11:35:36 +0200 Subject: [PATCH 0572/1332] AVALANCHE: Repair Acci::do_that(), remove comments from Lucerna::topcheck(). --- engines/avalanche/acci2.cpp | 6 +++--- engines/avalanche/lucerna2.cpp | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0ba511e8e7e9..087dd27cf87c 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1209,9 +1209,9 @@ void Acci::do_that() { case vb_open: opendoor(); break; - case vb_pause: - _vm->_scrolls->display(Common::String("Game paused.") + '\3' + '\15' + '\15' + "Press Enter, Esc, or click " + - "the mouse on the `O.K.\" box to continue."); + case vb_pause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. + _vm->_scrolls->display(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue."); break; case vb_get: if (thing != pardon) { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f632a66db0e7..f2ae72cfe58f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -874,9 +874,7 @@ void Lucerna::points(byte num) { /* Add on no. of points */ } void Lucerna::topcheck() { - /* Menuset */ _vm->_dropdown->ddm_m.getmenu(_vm->_gyro->mpx); - /* Do this one */ } void Lucerna::mouseway(const Common::Point &cursorPos) { From b5914349400b95ac646926e69e5e3acf2094eff2 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 18 Aug 2013 15:08:32 +0200 Subject: [PATCH 0573/1332] AVALANCHE: Add saving/loading during run time. --- engines/avalanche/avalanche.cpp | 20 +++++++++++++++++++- engines/avalanche/avalanche.h | 10 ++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b950bdb42775..f8e873b2ae5c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,7 +123,7 @@ Common::Platform AvalancheEngine::getPlatform() const { bool AvalancheEngine::hasFeature(EngineFeature f) const { - return false; + return (f == kSupportsSavingDuringRuntime) || (f == kSupportsLoadingDuringRuntime); } const char *AvalancheEngine::getCopyrightString() const { @@ -132,6 +132,24 @@ const char *AvalancheEngine::getCopyrightString() const { +bool AvalancheEngine::canSaveGameStateCurrently() { + return true; +} + +Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { + return Common::kNoError; +} + +bool AvalancheEngine::canLoadGameStateCurrently() { + return true; +} + +Common::Error AvalancheEngine::loadGameState(int slot, const Common::String &desc) { + return Common::kNoError; +} + + + void AvalancheEngine::updateEvents() { Common::Event event; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 2f20393faf61..a027dc598894 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -111,10 +111,16 @@ class AvalancheEngine : public Engine { bool hasFeature(EngineFeature f) const; const char *getCopyrightString() const; - void updateEvents(); - bool getEvent(Common::Event &event); // A warpper around _eventMan->pollEvent(), se we can use it in Scrolls::normscroll() for example. + virtual bool canSaveGameStateCurrently(); + Common::Error saveGameState(int slot, const Common::String &desc); + virtual bool canLoadGameStateCurrently(); + Common::Error loadGameState(int slot, const Common::String &desc); + + + void updateEvents(); + bool getEvent(Common::Event &event); // A warpper around _eventMan->pollEvent(), se we can use it in Scrolls::normscroll() for example. Common::Point getMousePos(); protected: From 7d24f46e7e2c7d6322b2842d349986dc484eb063 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:38:24 -0500 Subject: [PATCH 0574/1332] ZVISION: Modify cmdLoadSound to allow manual rate and isStereo Usually those variables are parsed from the file name --- engines/zvision/console.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 6c7ac9418168..e7c46b95a9ad 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -83,19 +83,29 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { } bool Console::cmdLoadSound(int argc, const char **argv) { - if (argc != 2) { - DebugPrintf("Use loadsound to load a sound\n"); - return true; - } - if (!Common::File::exists(argv[1])) { DebugPrintf("File does not exist\n"); return true; } - Audio::AudioStream *soundStream = makeRawZorkStream(argv[1], _engine); - Audio::SoundHandle handle; - _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + if (argc == 2) { + Audio::AudioStream *soundStream = makeRawZorkStream(argv[1], _engine); + Audio::SoundHandle handle; + _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + + } else if (argc == 4) { + int isStereo = atoi(argv[3]); + + Common::File *file = new Common::File(); + file->open(argv[1]); + + Audio::AudioStream *soundStream = makeRawZorkStream(file, atoi(argv[2]), isStereo == 0 ? false : true); + Audio::SoundHandle handle; + _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + } else { + DebugPrintf("Use loadsound [ ] to load a sound\n"); + return true; + } return true; } From e769164f791d19b69cbe7cb0be99fc474c562ed4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:46:18 -0500 Subject: [PATCH 0575/1332] ZVISION: Render images by specifying a destination and then clipping Instead of specifying a subRect. This also reverts the code that rendered to a backbuffer and then did a full backbuffer warp. Wrapping is done in the RenderTable --- engines/zvision/render_manager.cpp | 200 +++++++++++++---------------- engines/zvision/render_manager.h | 18 +-- engines/zvision/render_table.cpp | 50 ++++++-- engines/zvision/render_table.h | 2 +- 4 files changed, 134 insertions(+), 136 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 1f2c3a20c75a..e4106109baae 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -38,16 +38,19 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, : _system(system), _workingWidth(workingWindow.width()), _workingHeight(workingWindow.height()), + _screenCenterX((workingWindow.left + workingWindow.right) /2), + _screenCenterY((workingWindow.top + workingWindow.bottom) /2), _workingWindow(workingWindow), _pixelFormat(pixelFormat), _currentBackground(0), _backgroundWidth(0), _backgroundHeight(0), _backgroundInverseVelocity(0), + _backgroundOffset(0, 0), _accumulatedVelocityMilliseconds(0), - _renderTable(workingWindow.width(), workingWindow.height()) { - _backbuffer.create(_workingWidth, _workingHeight, pixelFormat); - _warpedBackbuffer = new uint16[_workingWidth *_workingHeight]; + _renderTable(_workingWidth, _workingHeight) { + + _warpedBuffer = new uint16[_workingWidth *_workingHeight]; } RenderManager::~RenderManager() { @@ -55,8 +58,7 @@ RenderManager::~RenderManager() { delete _currentBackground; } - _backbuffer.free(); - delete[] _warpedBackbuffer; + delete[] _warpedBuffer; } void RenderManager::update(uint deltaTimeInMillis) { @@ -73,111 +75,83 @@ void RenderManager::update(uint deltaTimeInMillis) { } // Choose the direction of movement using the sign of the velocity - moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); + moveBackground(_backgroundInverseVelocity < 0 ? numberOfSteps : -numberOfSteps); } +} - // Warp the entire backbuffer - RenderTable::RenderState state = _renderTable.getRenderState(); - if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { - _renderTable.mutateImage((uint16 *)_backbuffer.getBasePtr(0, 0), _warpedBackbuffer, _workingWidth, _workingHeight); - _system->copyRectToScreen(_warpedBackbuffer, _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); - } else { - _system->copyRectToScreen(_backbuffer.getBasePtr(0, 0), _backbuffer.pitch, _workingWindow.left, _workingWindow.top, _backbuffer.w, _backbuffer.h); +void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap, bool isTransposed) { + int16 subRectX = 0; + int16 subRectY = 0; + + // Take care of negative destinations + if (destinationX < 0) { + subRectX = destinationX + surface.w; + destinationX = 0; + if (wrap) { + _backgroundOffset.x += surface.w; + } + } else if (destinationX >= surface.w) { + // Take care of extreme positive destinations + destinationX -= surface.w; + if (wrap) { + _backgroundOffset.x -= surface.w; + } } - // Blit the backbuffer to the screen - -} + // Take care of negative destinations + if (destinationY < 0) { + subRectY = destinationY + surface.h; + destinationY = 0; + if (wrap) { + _backgroundOffset.y += surface.h; + } + } else if (destinationY >= surface.h) { + // Take care of extreme positive destinations + destinationY -= surface.h; + if (wrap) { + _backgroundOffset.y -= surface.h; + } + } -void RenderManager::renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed) { if (wrap) { _backgroundWidth = surface.w; _backgroundHeight = surface.h; - } - // If subRect is empty, use the entire image - if (subRectangle.isEmpty()) - subRectangle = Common::Rect(subRectangle.left, subRectangle.top, subRectangle.left + surface.w, subRectangle.top + surface.h); - - // Clip destRect to working window bounds - Common::Rect destRect(destinationX, destinationY, destinationX + subRectangle.width(), destinationY + subRectangle.height()); - destRect.clip(_workingWidth, _workingHeight); - // Clip subRect to working window bounds - subRectangle.translate(destRect.left - destinationX, destRect.top - destinationY); - subRectangle.setWidth(destRect.width()); - subRectangle.setHeight(destRect.height()); - // Clip to image bounds - Common::Point subRectOrigOrigin(subRectangle.left, subRectangle.top); - subRectangle.clip(surface.w, surface.h); - - // If the image is to be wrapped, check if it's smaller than destRect - // If it is, then call renderSubRectToScreen with a subRect representing wrapping - if (wrap && subRectangle.width() < destRect.width()) { - uint32 wrapDestX; - uint32 wrapDestY; - Common::Rect wrapSubRect; - - if (_backgroundWidth - subRectangle.left < destRect.width()) { - wrapDestX = destRect.left + subRectangle.width(); - wrapDestY = destRect.top; - wrapSubRect = Common::Rect(0, 0, destRect.width() - subRectangle.width(), subRectangle.bottom); - } else { - wrapDestX = destRect.left; - wrapDestY = destRect.top; - wrapSubRect = Common::Rect(_backgroundWidth - subRectangle.width(), 0, _backgroundWidth - 1, subRectangle.bottom); + if (destinationX > 0) { + // Move destinationX to 0 + subRectX = surface.w - destinationX; + destinationX = 0; } - renderSubRectToBackbuffer(surface, wrapDestX, wrapDestY, wrapSubRect, false, isTransposed); - } else if (wrap && subRectangle.height() < destRect.height()) { - uint32 wrapDestX; - uint32 wrapDestY; - Common::Rect wrapSubRect; - - if (_backgroundHeight - subRectangle.top < destRect.height()) { - wrapDestX = destRect.left; - wrapDestY = destRect.height() - subRectangle.height(); - wrapSubRect = Common::Rect(0, 0, subRectangle.right, destRect.height() - subRectangle.height()); - } else { - wrapDestX = destRect.left; - wrapDestY = destRect.top; - wrapSubRect = Common::Rect(0, _backgroundHeight - subRectangle.height(), subRectangle.right, _backgroundHeight - 1); + if (destinationY > 0) { + // Move destinationY to 0 + subRectX = surface.w - destinationX; + destinationY = 0; } - - renderSubRectToBackbuffer(surface, wrapDestX, wrapDestY, wrapSubRect, false, isTransposed); - } else { - // Clip destRect to image bounds - destRect.translate(subRectangle.left - subRectOrigOrigin.x, subRectangle.top - subRectOrigOrigin.y); - destRect.setWidth(subRectangle.width()); - destRect.setHeight(subRectangle.height()); } - // Check all Rects for validity - if (!subRectangle.isValidRect() || subRectangle.isEmpty() || !destRect.isValidRect() || destRect.isEmpty()) - return; + // Clip subRect to working window bounds + Common::Rect subRect(subRectX, subRectY, subRectX + _workingWidth, subRectY + _workingHeight); - if (isTransposed) { - copyTransposedRectToBackbuffer((uint16 *)surface.getBasePtr(0, 0), surface.h, destRect.left, destRect.top, destRect.width(), destRect.height(), subRectangle); - } else { - _backbuffer.copyRectToSurface(surface.getBasePtr(subRectangle.left, subRectangle.top), surface.pitch, destRect.left, destRect.top, destRect.width(), destRect.height()); + if (!wrap) { + // Clip to image bounds + subRect.clip(surface.w, surface.h); } -} -void RenderManager::copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int destinationX, int destinationY, int width, int height, const Common::Rect &subRect) { - uint16 *dest = (uint16 *)_backbuffer.getBasePtr(0, 0); - - for (int16 x = subRect.left; x < subRect.right; x++) { - int16 normalizedX = x - subRect.left + destinationX; - int columnOffset = x * imageWidth; + // Check destRect for validity + if (!subRect.isValidRect() || subRect.isEmpty()) + return; - for (int16 y = subRect.top; y < subRect.bottom; y++) { - int16 normalizeY = y - subRect.top + destinationY; + if (_renderTable.getRenderState() == RenderTable::FLAT) { + _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); + } else { + _renderTable.mutateImage((uint16 *)surface.getBasePtr(0, 0), _warpedBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap, isTransposed); - dest[normalizeY * _backbuffer.w + normalizedX] = buffer[columnOffset + y]; - } + _system->copyRectToScreen(_warpedBuffer, _workingWidth * sizeof(uint16), destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); } } -void RenderManager::renderImageToBackbuffer(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { +void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, bool wrap) { Common::File file; if (!file.open(fileName)) { @@ -185,10 +159,10 @@ void RenderManager::renderImageToBackbuffer(const Common::String &fileName, uint return; } - renderImageToBackbuffer(file, destinationX, destinationY, subRectangle); + renderImageToScreen(file, destinationX, destinationY); } -void RenderManager::renderImageToBackbuffer(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap) { +void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; @@ -217,7 +191,7 @@ void RenderManager::renderImageToBackbuffer(Common::SeekableReadStream &stream, Graphics::Surface surface; surface.init(imageWidth, imageHeight, pitch, buffer, _pixelFormat); - renderSubRectToBackbuffer(surface, destinationX, destinationY, subRectangle, wrap, isTransposed); + renderSubRectToScreen(surface, destinationX, destinationY, wrap, isTransposed); // We have to use delete[] instead of calling surface.free() because we created the memory with new[] delete[] buffer; @@ -241,7 +215,7 @@ void RenderManager::renderImageToBackbuffer(Common::SeekableReadStream &stream, tgaSurface.w = temp; } - renderSubRectToBackbuffer(tgaSurface, destinationX, destinationY, subRectangle, wrap, isTransposed); + renderSubRectToScreen(tgaSurface, destinationX, destinationY, wrap, isTransposed); tga.destroy(); } } @@ -280,15 +254,20 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { } _currentBackground = file; - // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. - renderImageToBackbuffer(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); + renderImageToScreen(*_currentBackground, _backgroundOffset.x, _backgroundOffset.y, true); } void RenderManager::setBackgroundPosition(int offset) { - if (_renderTable.getRenderState() == RenderTable::TILT) { - _backgroundOffset = Common::Point(0, offset); + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::TILT) { + _backgroundOffset.x = 0; + _backgroundOffset.y = _screenCenterY - offset; + } else if (state == RenderTable::PANORAMA) { + _backgroundOffset.x = _screenCenterX - offset; + _backgroundOffset.y = 0; } else { - _backgroundOffset = Common::Point(offset, 0); + _backgroundOffset.x = 0; + _backgroundOffset.y = 0; } } @@ -305,25 +284,20 @@ void RenderManager::setBackgroundVelocity(int velocity) { } void RenderManager::moveBackground(int offset) { - if (_renderTable.getRenderState() == RenderTable::TILT) { + _currentBackground->seek(0); + + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::TILT) { _backgroundOffset += Common::Point(0, offset); - } else { - _backgroundOffset += Common::Point(offset, 0); - } - // Make sure the offset is within image bounds - if (_backgroundOffset.x < 0) - _backgroundOffset.x += _backgroundWidth; - if (_backgroundOffset.x > _backgroundWidth) - _backgroundOffset.x -= _backgroundWidth; - if (_backgroundOffset.y < 0) - _backgroundOffset.y += _backgroundHeight; - if (_backgroundOffset.y > _backgroundHeight) - _backgroundOffset.y -= _backgroundHeight; + renderImageToScreen(*_currentBackground, 0, _backgroundOffset.y, true); + } else if (state == RenderTable::PANORAMA) { + _backgroundOffset += Common::Point(offset, 0); - _currentBackground->seek(0); - // Purposely make the subRectangle empty. renderImageToScreen will then set the width and height automatically. - renderImageToBackbuffer(*_currentBackground, 0, 0, Common::Rect(_backgroundOffset.x, _backgroundOffset.y, _backgroundOffset.x, _backgroundOffset.y), true); + renderImageToScreen(*_currentBackground, _backgroundOffset.x, 0, true); + } else { + renderImageToScreen(*_currentBackground, 0, 0); + } } } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index f59f50d4d7b2..cdcd52b67d26 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -52,13 +52,17 @@ class RenderManager { OSystem *_system; const Graphics::PixelFormat _pixelFormat; - Graphics::Surface _backbuffer; - uint16 *_warpedBackbuffer; + uint16 *_warpedBuffer; /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; /** Height of the working window. Saved to prevent extraneous calls to _workingWindow.height() */ const int _workingHeight; + /** Center of the screen in the x direction */ + const int _screenCenterX; + /** Center of the screen in the y direction */ + const int _screenCenterY; + /** * A Rectangle centered inside the actual window. All in-game coordinates * are given in this coordinate space. Also, all images are clipped to the @@ -102,9 +106,8 @@ class RenderManager { * @param fileName Name of the image file * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! - * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToBackbuffer(const Common::String &fileName, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); + void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, bool wrap = false); /** * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. @@ -113,9 +116,8 @@ class RenderManager { * @param stream Stream to read the image data from * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! - * @param subRectangle The subrectangle of the image that should be rendered. If this is an empty rectangle, it will blit the entire image. Coords are in working window space, not screen space! */ - void renderImageToBackbuffer(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle = Common::Rect(0, 0, 0, 0), bool wrap = false); + void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, bool wrap = false); /** * Sets the current background image to be used by the RenderManager and immediately @@ -169,9 +171,7 @@ class RenderManager { * @param subRectangle A rectangle representing the part of the image that should be rendered * @param wrap Should the image wrap (tile) if it doesn't completely fill the screen? */ - void renderSubRectToBackbuffer(Graphics::Surface &surface, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool wrap, bool isTransposed); - - void copyTransposedRectToBackbuffer(const uint16 *buffer, int imageWidth, int destinationX, int destinationY, int width, int height, const Common::Rect &subRect); + void renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap, bool isTransposed); void moveBackground(int offset); }; diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index a28f82baa6b6..23394b7bc236 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -98,22 +98,46 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight) { - for (uint32 y = 0; y < imageHeight; y++) { - for (uint32 x = 0; x < imageWidth; x++) { - uint32 index = y * _numColumns + x; - - // RenderTable only stores offsets from the original coordinates - uint32 sourceYIndex = y + _internalBuffer[index].y; - uint32 sourceXIndex = x + _internalBuffer[index].x; +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed) { + for (int16 y = subRect.top; y < subRect.bottom; y++) { + uint16 normalizedY = y - subRect.top; + uint32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; + uint32 destColumnIndex = normalizedY * _numColumns; - // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + for (int16 x = subRect.left; x < subRect.right; x++) { + uint16 normalizedX = x - subRect.left; - // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + uint32 index = internalColumnIndex + normalizedX + destinationX; - destBuffer[index] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; + // RenderTable only stores offsets from the original coordinates + uint16 sourceYIndex = y + _internalBuffer[index].y; + uint16 sourceXIndex = x + _internalBuffer[index].x; + + if (wrap) { + if (sourceXIndex >= imageWidth) { + sourceXIndex -= imageWidth; + } else if (sourceXIndex < 0) { + sourceXIndex += imageWidth; + } + + if (sourceYIndex >= imageHeight) { + sourceYIndex -= imageHeight; + } else if (sourceYIndex < 0) { + sourceYIndex += imageHeight; + } + } else { + // Clamp the yIndex to the size of the image + sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + + // Clamp the xIndex to the size of the image + sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + } + + if (isTransposed) { + destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceXIndex * imageHeight + sourceYIndex]; + } else { + destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; + } } } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 7c04564cd045..bbf5e1b22ac0 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed); void generateRenderTable(); void setPanoramaFoV(float fov); From b22ed391fe35bd999060f5d3b7c87dcbfbca8ab4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:47:05 -0500 Subject: [PATCH 0576/1332] ZVISION: Set the background position after the .scr file has been parsed so we know the RenderState --- engines/zvision/script_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 5c0e336a5db8..3ca9f01adc74 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -216,9 +216,6 @@ void ScriptManager::changeLocationIntern() { // Revert to the idle cursor _engine->getCursorManager()->revertToIdle(); - // Change the background position - _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); - // Reset the background velocity _engine->getRenderManager()->setBackgroundVelocity(0); @@ -226,6 +223,9 @@ void ScriptManager::changeLocationIntern() { Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view); parseScrFile(fileName); + // Change the background position + _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); + // Create the puzzle reference table createReferenceTable(); From bbb8598a3e62e80b1a5efc5de4598276770ca6f1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:48:29 -0500 Subject: [PATCH 0577/1332] ZVISION: Modify cmdLoadImage to match new render code --- engines/zvision/console.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index e7c46b95a9ad..dfafb26e2a9e 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -57,11 +57,9 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { bool Console::cmdLoadImage(int argc, const char **argv) { if (argc == 4) - _engine->getRenderManager()->renderImageToBackbuffer(argv[1], atoi(argv[2]), atoi(argv[3])); - else if (argc == 8) - _engine->getRenderManager()->renderImageToBackbuffer(argv[1], atoi(argv[2]), atoi(argv[3]), Common::Rect(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atoi(argv[7]))); + _engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3])); else { - DebugPrintf("Use loadimage [ ] to load an image to the screen\n"); + DebugPrintf("Use loadimage to load an image to the screen\n"); return true; } From f2477610cf1c776936e7c959e490120823845897 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:50:55 -0500 Subject: [PATCH 0578/1332] VIDEO: Add AVI LIST handling for ZVision custom types --- 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 ff41099e698d..beb68fc969f2 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',' ') @@ -174,15 +175,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 (ZEngine) + // Ignore metadata + _fileStream->skip(listSize); + return; + case ID_STRL: // Stream list + default: // (Just hope we can parse it!) + break; } while ((_fileStream->pos() - curPos) < listSize) From 8fafde8a33a84fd5819e2a3a9ff9ebf6a66889a5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 09:51:24 -0500 Subject: [PATCH 0579/1332] ZVISION: Re-enable video handling now that AVI code is fixed --- engines/zvision/scr_file_handling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index ff7df20ac5db..5b8af4804717 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -251,7 +251,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:streamvideo*", true)) { - //actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); + actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); } else if (line.matchString("*:syncsound*", true)) { From 7e6a04dc62161f1b013445ba20ee7465b57d6412 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 11:13:14 -0500 Subject: [PATCH 0580/1332] ZVISION: Store the background offset from the center instead of from the top left corner --- engines/zvision/render_manager.cpp | 66 +++++++++++++++++++----------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index e4106109baae..7d8ba75b8dda 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -38,8 +38,8 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, : _system(system), _workingWidth(workingWindow.width()), _workingHeight(workingWindow.height()), - _screenCenterX((workingWindow.left + workingWindow.right) /2), - _screenCenterY((workingWindow.top + workingWindow.bottom) /2), + _screenCenterX(_workingWidth / 2), + _screenCenterY(_workingHeight / 2), _workingWindow(workingWindow), _pixelFormat(pixelFormat), _currentBackground(0), @@ -75,7 +75,7 @@ void RenderManager::update(uint deltaTimeInMillis) { } // Choose the direction of movement using the sign of the velocity - moveBackground(_backgroundInverseVelocity < 0 ? numberOfSteps : -numberOfSteps); + moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); } } @@ -85,32 +85,20 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest // Take care of negative destinations if (destinationX < 0) { - subRectX = destinationX + surface.w; + subRectX = -destinationX; destinationX = 0; - if (wrap) { - _backgroundOffset.x += surface.w; - } } else if (destinationX >= surface.w) { // Take care of extreme positive destinations destinationX -= surface.w; - if (wrap) { - _backgroundOffset.x -= surface.w; - } } // Take care of negative destinations if (destinationY < 0) { - subRectY = destinationY + surface.h; + subRectY = -destinationY; destinationY = 0; - if (wrap) { - _backgroundOffset.y += surface.h; - } } else if (destinationY >= surface.h) { // Take care of extreme positive destinations destinationY -= surface.h; - if (wrap) { - _backgroundOffset.y -= surface.h; - } } if (wrap) { @@ -224,15 +212,25 @@ const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point & // Convert from screen space to working window space Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); - if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) { + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { newPoint = _renderTable.convertWarpedCoordToFlatCoord(newPoint); } - newPoint -= _backgroundOffset; + if (state == RenderTable::PANORAMA) { + newPoint -= (Common::Point(_screenCenterX, 0) - _backgroundOffset); + } else if (state == RenderTable::TILT) { + newPoint -= (Common::Point(0, _screenCenterY) - _backgroundOffset); + } + if (newPoint.x < 0) newPoint.x += _backgroundWidth; + else if (newPoint.x >= _backgroundWidth) + newPoint.x -= _backgroundWidth; if (newPoint.y < 0) newPoint.y += _backgroundHeight; + else if (newPoint.y >= _backgroundHeight) + newPoint.y -= _backgroundHeight; return newPoint; } @@ -254,16 +252,16 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { } _currentBackground = file; - renderImageToScreen(*_currentBackground, _backgroundOffset.x, _backgroundOffset.y, true); + moveBackground(0); } void RenderManager::setBackgroundPosition(int offset) { RenderTable::RenderState state = _renderTable.getRenderState(); if (state == RenderTable::TILT) { _backgroundOffset.x = 0; - _backgroundOffset.y = _screenCenterY - offset; + _backgroundOffset.y = offset; } else if (state == RenderTable::PANORAMA) { - _backgroundOffset.x = _screenCenterX - offset; + _backgroundOffset.x = offset; _backgroundOffset.y = 0; } else { _backgroundOffset.x = 0; @@ -290,11 +288,31 @@ void RenderManager::moveBackground(int offset) { if (state == RenderTable::TILT) { _backgroundOffset += Common::Point(0, offset); - renderImageToScreen(*_currentBackground, 0, _backgroundOffset.y, true); + if (_backgroundOffset.x <= -_backgroundWidth) + _backgroundOffset.x += _backgroundWidth; + else if (_backgroundOffset.x >= _backgroundWidth) + _backgroundOffset.x += _backgroundWidth; + + if (_backgroundOffset.y <= -_backgroundHeight) + _backgroundOffset.y += _backgroundHeight; + else if (_backgroundOffset.y >= _backgroundHeight) + _backgroundOffset.y += _backgroundHeight; + + renderImageToScreen(*_currentBackground, 0, _screenCenterY - _backgroundOffset.y, true); } else if (state == RenderTable::PANORAMA) { _backgroundOffset += Common::Point(offset, 0); - renderImageToScreen(*_currentBackground, _backgroundOffset.x, 0, true); + if (_backgroundOffset.x <= -_backgroundWidth) + _backgroundOffset.x += _backgroundWidth; + else if (_backgroundOffset.x >= _backgroundWidth) + _backgroundOffset.x += _backgroundWidth; + + if (_backgroundOffset.y <= -_backgroundHeight) + _backgroundOffset.y += _backgroundHeight; + else if (_backgroundOffset.y >= _backgroundHeight) + _backgroundOffset.y += _backgroundHeight; + + renderImageToScreen(*_currentBackground, _screenCenterX - _backgroundOffset.x, 0, true); } else { renderImageToScreen(*_currentBackground, 0, 0); } From acea03a9cd9ce14b210fe4b2fc650e34e8ae657b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 11:36:42 -0500 Subject: [PATCH 0581/1332] ZVISION: Allow RenderTable indicies to be negative --- engines/zvision/render_table.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 23394b7bc236..718853007527 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -100,18 +100,18 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed) { for (int16 y = subRect.top; y < subRect.bottom; y++) { - uint16 normalizedY = y - subRect.top; - uint32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; - uint32 destColumnIndex = normalizedY * _numColumns; + int16 normalizedY = y - subRect.top; + int32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; + int32 destColumnIndex = normalizedY * _numColumns; for (int16 x = subRect.left; x < subRect.right; x++) { - uint16 normalizedX = x - subRect.left; + int16 normalizedX = x - subRect.left; - uint32 index = internalColumnIndex + normalizedX + destinationX; + int32 index = internalColumnIndex + normalizedX + destinationX; // RenderTable only stores offsets from the original coordinates - uint16 sourceYIndex = y + _internalBuffer[index].y; - uint16 sourceXIndex = x + _internalBuffer[index].x; + int16 sourceYIndex = y + _internalBuffer[index].y; + int16 sourceXIndex = x + _internalBuffer[index].x; if (wrap) { if (sourceXIndex >= imageWidth) { @@ -127,10 +127,10 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im } } else { // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); } if (isTransposed) { From 80cba07b311a56a9e3dd6ce5ca5a291299b95a8d Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:32:34 -0500 Subject: [PATCH 0582/1332] ZVISION: Allow destinations to be negative --- engines/zvision/render_manager.cpp | 4 ++-- engines/zvision/render_manager.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7d8ba75b8dda..932c797c11fc 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -139,7 +139,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest } } -void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, bool wrap) { +void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { Common::File file; if (!file.open(fileName)) { @@ -150,7 +150,7 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 d renderImageToScreen(file, destinationX, destinationY); } -void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, bool wrap) { +void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, int16 destinationX, int16 destinationY, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ uint32 fileType; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index cdcd52b67d26..9683ee0bf274 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -107,7 +107,7 @@ class RenderManager { * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! */ - void renderImageToScreen(const Common::String &fileName, uint32 destinationX, uint32 destinationY, bool wrap = false); + void renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap = false); /** * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. @@ -117,7 +117,7 @@ class RenderManager { * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! */ - void renderImageToScreen(Common::SeekableReadStream &stream, uint32 destinationX, uint32 destinationY, bool wrap = false); + void renderImageToScreen(Common::SeekableReadStream &stream, int16 destinationX, int16 destinationY, bool wrap = false); /** * Sets the current background image to be used by the RenderManager and immediately From f1d44bdf8cbcf69805713f042b16480227e14d6c Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:34:44 -0500 Subject: [PATCH 0583/1332] ZVISION: Protect against indicies that are more than an imageWidth/Height from the actual image dimensions --- engines/zvision/render_table.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 718853007527..ec0cdba7c29d 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -114,15 +114,17 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im int16 sourceXIndex = x + _internalBuffer[index].x; if (wrap) { - if (sourceXIndex >= imageWidth) { + while (sourceXIndex >= imageWidth) { sourceXIndex -= imageWidth; - } else if (sourceXIndex < 0) { + } + while (sourceXIndex < 0) { sourceXIndex += imageWidth; } - if (sourceYIndex >= imageHeight) { + while (sourceYIndex >= imageHeight) { sourceYIndex -= imageHeight; - } else if (sourceYIndex < 0) { + } + while (sourceYIndex < 0) { sourceYIndex += imageHeight; } } else { From 77219705e6f225c4296b5d5346b2abd8fe2aaade Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:35:57 -0500 Subject: [PATCH 0584/1332] ZVISION: Prevent endless looping due to incorrect file structure Some of the .scr files don't properly close the last curly brace --- engines/zvision/control.cpp | 6 +++--- engines/zvision/scr_file_handling.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 02d15fe9d0cf..eeba9b3214a3 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -44,7 +44,7 @@ void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream & Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("angle*", true)) { float fov; sscanf(line.c_str(), "angle(%f)", &fov); @@ -78,7 +78,7 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("angle*", true)) { float fov; sscanf(line.c_str(), "angle(%f)", &fov); @@ -110,7 +110,7 @@ void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::Seekab Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("*_hotspot*", true)) { uint x; uint y; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 5b8af4804717..9c99ce184d7d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -76,7 +76,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("criteria {", true)) { Puzzle::Criteria criteria; if (parseCriteria(&criteria, stream)) { @@ -103,7 +103,7 @@ bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableRe return false; } - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { // Split the string into tokens using ' ' as a delimiter Common::StringTokenizer tokenizer(line); Common::String token; @@ -147,7 +147,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis trimCommentsAndWhiteSpace(&line); // TODO: Re-order the if-then statements in order of highest occurrence - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.empty()) { line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -284,7 +284,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("ONCE_PER_INST", true)) { flags |= Puzzle::ONCE_PER_INST; } else if (line.matchString("DO_ME_NOW", true)) { From eafd6608cf1e54bb3551671e6fd4a8c6626d44d9 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:36:46 -0500 Subject: [PATCH 0585/1332] ZVISION: Change the CLIP template argument to match the type of the indicies --- engines/zvision/render_table.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index ec0cdba7c29d..0a8175e54e21 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -129,10 +129,10 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im } } else { // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); + sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); + sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); } if (isTransposed) { From c840d082ceee068446176024b86031f24ed0a968 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:38:06 -0500 Subject: [PATCH 0586/1332] ZVISION: Allow ONCE_PER_INST puzzles to be repeated once per room instead of once per game --- engines/zvision/script_manager.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 3ca9f01adc74..8a1d1c98ed48 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -108,11 +108,9 @@ void ScriptManager::checkPuzzleCriteria() { Puzzle *puzzle = _puzzlesToCheck.pop(); // Check if the puzzle is already finished - // If it doesn't have the flag ONCE_PER_INST it can be done more than once // Also check that the puzzle isn't disabled if (getStateValue(puzzle->key) == 1 && - (puzzle->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST && - (puzzle->flags & Puzzle::DISABLED) == 0) { + (puzzle->flags & Puzzle::DISABLED) == 0) { continue; } @@ -226,18 +224,28 @@ void ScriptManager::changeLocationIntern() { // Change the background position _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); - // Create the puzzle reference table - createReferenceTable(); - // Add all the local puzzles to the stack to be checked for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + // Reset any Puzzles that have the flag ONCE_PER_INST + if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { + setStateValue((*iter).key, 0); + } + _puzzlesToCheck.push(&(*iter)); } // Add all the global puzzles to the stack to be checked for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + // Reset any Puzzles that have the flag ONCE_PER_INST + if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { + setStateValue((*iter).key, 0); + } + _puzzlesToCheck.push(&(*iter)); } + + // Create the puzzle reference table + createReferenceTable(); } } // End of namespace ZVision From 09ae4443d4d8ea9781ce7c98c26c4010b4a3427a Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 17 Aug 2013 20:39:29 -0500 Subject: [PATCH 0587/1332] ZVISION: Reset push_toggle controls global state value to 0 during initialization --- engines/zvision/control.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index eeba9b3214a3..b55452c87644 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -27,6 +27,7 @@ #include "zvision/zvision.h" #include "zvision/render_manager.h" #include "zvision/render_table.h" +#include "zvision/script_manager.h" #include "zvision/control.h" #include "zvision/utility.h" @@ -103,6 +104,8 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre } void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) { + engine->getScriptManager()->setStateValue(key, 0); + Common::Rect hotspot; Common::String cursorName; From 589c29e6e15e5d2957b92b1a03c6bf43a327f541 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:17:37 -0500 Subject: [PATCH 0588/1332] ZVISION: Add newlines to console debug statements --- engines/zvision/console.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index dfafb26e2a9e..69d19ab53a0e 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -168,7 +168,7 @@ bool Console::cmdSetPanoramaScale(int argc, const char **argv) { bool Console::cmdChangeLocation(int argc, const char **argv) { if (argc != 6) { - DebugPrintf("Use changelocation to change your location"); + DebugPrintf("Use changelocation to change your location\n"); return true; } @@ -179,7 +179,7 @@ bool Console::cmdChangeLocation(int argc, const char **argv) { bool Console::cmdDumpFile(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Use dumpfile to dump a file"); + DebugPrintf("Use dumpfile to dump a file\n"); return true; } From 1f653f9a34e3462c0ab13aeaf5f68b7070f45770 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:19:01 -0500 Subject: [PATCH 0589/1332] ZVISION: Allow MouseEvents to be unregistered --- engines/zvision/events.cpp | 11 +++++++++++ engines/zvision/zvision.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index ca96f52457b2..bea476fa41b7 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -39,6 +39,17 @@ void ZVision::registerMouseEvent(const MouseEvent &event) { _mouseEvents.push_back(event); } +bool ZVision::removeMouseEvent(const uint32 key) { + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + if ((*iter)._key == key) { + _mouseEvents.erase(iter); + return true; + } + } + + return false; +} + void ZVision::clearAllMouseEvents() { _mouseEvents.clear(); } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 58812d4d1103..9e9d5db9512b 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -133,6 +133,9 @@ class ZVision : public Engine { * @param event The event to register */ void registerMouseEvent(const MouseEvent &event); + + bool removeMouseEvent(const uint32 key); + /** Remove all MouseEvents from the event system */ void clearAllMouseEvents(); From 9051f6213671316c336242274490e17d356fef0e Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:19:22 -0500 Subject: [PATCH 0590/1332] ZVISION: Make MousEvent fully public --- engines/zvision/mouse_event.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/zvision/mouse_event.h b/engines/zvision/mouse_event.h index 5537bcc4e5a1..90a093f894b1 100644 --- a/engines/zvision/mouse_event.h +++ b/engines/zvision/mouse_event.h @@ -34,9 +34,9 @@ class ZVision; class MouseEvent { public: + MouseEvent() : _key(0) {} MouseEvent(uint32 key, const Common::Rect &hotspot, const Common::String hoverCursor); -private: /** The Control key */ uint32 _key; /** @@ -47,7 +47,6 @@ class MouseEvent { /** The cursor to use when hovering over _hotspot */ Common::String _hoverCursor; -public: /** * Does a simple Rect::contains() using _hotspot * From 25deaf3a35efac8e5103e193f5f68409a87047a0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:20:22 -0500 Subject: [PATCH 0591/1332] ZVISION: Reset MouseEvent globalStateValue's when clearing them --- engines/zvision/events.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index bea476fa41b7..f382bb63e0af 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -31,6 +31,7 @@ #include "zvision/cursor_manager.h" #include "zvision/render_manager.h" +#include "zvision/script_manager.h" #include "zvision/mouse_event.h" namespace ZVision { @@ -42,6 +43,7 @@ void ZVision::registerMouseEvent(const MouseEvent &event) { bool ZVision::removeMouseEvent(const uint32 key) { for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { if ((*iter)._key == key) { + _scriptManager->setStateValue((*iter)._key, 0); _mouseEvents.erase(iter); return true; } @@ -51,6 +53,11 @@ bool ZVision::removeMouseEvent(const uint32 key) { } void ZVision::clearAllMouseEvents() { + // Clear the state values of all the events + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + _scriptManager->setStateValue((*iter)._key, 0); + } + _mouseEvents.clear(); } From 3a23873c45f8b274836eacd8d1de471da6defb5b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:25:34 -0500 Subject: [PATCH 0592/1332] ZVISION: Convert _activeControls from a List to a HashMap --- engines/zvision/scr_file_handling.cpp | 21 +++++++-------------- engines/zvision/script_manager.h | 4 ++-- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 9c99ce184d7d..10e5c8f0eb9c 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -62,12 +62,7 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) _activePuzzles.push_back(puzzle); } } else if (line.matchString("control:*", true)) { - Common::SharedPtr control; - - // Some controls don't require nodes. They just initialize the scene - if (parseControl(line, file, control)) { - _activeControls.push_back(control); - } + parseControl(line, file); } } } @@ -300,7 +295,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { return flags; } -bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr &control) { +void ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream) { uint32 key; char controlTypeBuffer[20]; @@ -309,21 +304,19 @@ bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea Common::String controlType(controlTypeBuffer); if (controlType.equalsIgnoreCase("push_toggle")) { - Control::parsePushToggleControl(key, _engine, stream); - return false; + _activeControls[key] = new PushToggleControl(key, stream); + return; } else if (controlType.equalsIgnoreCase("flat")) { Control::parseFlatControl(_engine); - return false; + return; } else if (controlType.equalsIgnoreCase("pana")) { Control::parsePanoramaControl(_engine, stream); - return false; + return; } else if (controlType.equalsIgnoreCase("tilt")) { Control::parseTiltControl(_engine, stream); - return false; + return; } - - return true; } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index c0801edd5e8d..3d6472750616 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -70,7 +70,7 @@ class ScriptManager { /** Holds the global puzzles */ Common::List_globalPuzzles; /** Holds the currently active controls */ - Common::List > _activeControls; + Common::HashMap _activeControls; Location _nextLocation; bool _changeLocation; @@ -145,7 +145,7 @@ class ScriptManager { * @param line The line initially read * @param stream Scr file stream */ - bool parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr &control); + void parseControl(Common::String &line, Common::SeekableReadStream &stream); }; From 908e784957ec3cf01bc54a5c76c18f5ed6a8faa6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:28:16 -0500 Subject: [PATCH 0593/1332] ZVISION: Allow controls to be enabled or disabled --- engines/zvision/control.h | 9 +++++++-- engines/zvision/script_manager.cpp | 21 +++++++++++++++++++++ engines/zvision/script_manager.h | 3 +++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 2d5426c0c420..b374383a451d 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -35,11 +35,16 @@ class ZVision; class Control { public: + Control() : _key(0), _enabled(false) {} virtual ~Control() {} - virtual bool execute(ZVision *engine) = 0; + virtual bool enable(ZVision *engine) = 0; + virtual bool disable(ZVision *engine) { return true; } + +public: + uint32 _key; protected: - uint32 key; + bool _enabled; // Static member functions public: diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 8a1d1c98ed48..13f30ca0d233 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -185,6 +185,22 @@ void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) { _globalState[key] += valueToAdd; } +bool ScriptManager::enableControl(uint32 key) { + if (!_activeControls.contains(key)) { + return false; + } else { + return _activeControls[key]->enable(_engine); + } +} + +bool ScriptManager::disableControl(uint32 key) { + if (!_activeControls.contains(key)) { + return false; + } else { + return _activeControls[key]->disable(_engine); + } +} + void ScriptManager::addActionNode(const Common::SharedPtr &node) { _activeNodes.push_back(node); } @@ -225,6 +241,11 @@ void ScriptManager::changeLocationIntern() { _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); // Add all the local puzzles to the stack to be checked + // Enable all the controls + for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)._value->enable(_engine); + } + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 3d6472750616..7012ee0c5e9f 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -84,6 +84,9 @@ class ScriptManager { void setStateValue(uint32 key, uint value); void addToStateValue(uint32 key, uint valueToAdd); + bool enableControl(uint32 key); + bool disableControl(uint32 key); + void addActionNode(const Common::SharedPtr &node); void changeLocation(char world, char room, char node, char view, uint32 offset); From 5a86355e7dae3b00924ce95275f1fea9346a6211 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:29:23 -0500 Subject: [PATCH 0594/1332] ZVISION: Implement ActionEnableControl and ActionDisableControl --- engines/zvision/actions.cpp | 34 +++++++++++++++++++++++++++ engines/zvision/actions.h | 6 ++--- engines/zvision/scr_file_handling.cpp | 6 ++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 504c250597f8..affa8f5a9c61 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -110,6 +110,40 @@ bool ActionCrossfade::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionDisableControl +////////////////////////////////////////////////////////////////////////////// + +ActionDisableControl::ActionDisableControl(const Common::String &line) { + sscanf(line.c_str(), "%*[^(](%u)", &_key); +} + +bool ActionDisableControl::execute(ZVision *engine) { + debug("Disabling control %u", _key); + + engine->getScriptManager()->disableControl(_key); + + return true; +} + + +////////////////////////////////////////////////////////////////////////////// +// ActionEnableControl +////////////////////////////////////////////////////////////////////////////// + +ActionEnableControl::ActionEnableControl(const Common::String &line) { + sscanf(line.c_str(), "%*[^(](%u)", &_key); +} + +bool ActionEnableControl::execute(ZVision *engine) { + debug("Enabling control %u", _key); + + engine->getScriptManager()->enableControl(_key); + + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionMusic ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index aa67be20c770..1d87b8025c49 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -168,6 +168,7 @@ class ActionDisableControl : public ResultAction { bool execute(ZVision *engine); private: + uint32 _key; }; class ActionDisableVenus : public ResultAction { @@ -188,10 +189,8 @@ class ActionDisplayMessage : public ResultAction { class ActionDissolve : public ResultAction { public: - ActionDissolve(const Common::String &line); + ActionDissolve(); bool execute(ZVision *engine); - -private: }; class ActionDistort : public ResultAction { @@ -208,6 +207,7 @@ class ActionEnableControl : public ResultAction { bool execute(ZVision *engine); private: + uint32 _key; }; class ActionMusic : public ResultAction { diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 10e5c8f0eb9c..3fee76713588 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -177,8 +177,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:disable_control*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionDisableControl(line))); } else if (line.matchString("*:disable_venus*", true)) { @@ -192,8 +191,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:enable_control*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionEnableControl(line))); } else if (line.matchString("*:flush_mouse_events*", true)) { From 46ab3557660221b2896c0d5cd4a7d3fb0464d1d1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:38:56 -0500 Subject: [PATCH 0595/1332] ZVISION: Allow Puzzles to have mutiple 'sets' of CriteriaEntries --- engines/zvision/puzzle.h | 4 +- engines/zvision/scr_file_handling.cpp | 32 +++++----- engines/zvision/script_manager.cpp | 89 ++++++++++++++++----------- engines/zvision/script_manager.h | 2 +- 4 files changed, 74 insertions(+), 53 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index e7846f529639..36787e7ba1a8 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -41,7 +41,7 @@ struct Puzzle { }; /** Criteria for a Puzzle result to be fired */ - struct Criteria { + struct CriteriaEntry { /** The key of a global state */ uint32 key; /** @@ -62,7 +62,7 @@ struct Puzzle { }; uint32 key; - Common::List criteriaList; + Common::List > criteriaList; // This has to be list of pointers because ResultAction is abstract Common::List > resultActions; uint flags; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 3fee76713588..dd2754c12fd1 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -73,10 +73,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre while (!stream.eos() && !line.contains('}')) { if (line.matchString("criteria {", true)) { - Puzzle::Criteria criteria; - if (parseCriteria(&criteria, stream)) { - puzzle.criteriaList.push_back(criteria); - } + parseCriteria(stream, puzzle.criteriaList); } else if (line.matchString("results {", true)) { parseResults(stream, puzzle.resultActions); } else if (line.matchString("flags {", true)) { @@ -88,7 +85,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre } } -bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const { +bool ScriptManager::parseCriteria(Common::SeekableReadStream &stream, Common::List > &criteriaList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -98,37 +95,44 @@ bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableRe return false; } + // Create a new List to hold the CriteriaEntries + criteriaList.push_back(Common::List()); + while (!stream.eos() && !line.contains('}')) { + Puzzle::CriteriaEntry entry; + // Split the string into tokens using ' ' as a delimiter Common::StringTokenizer tokenizer(line); Common::String token; // Parse the id out of the first token token = tokenizer.nextToken(); - sscanf(token.c_str(), "[%u]", &(criteria->key)); + sscanf(token.c_str(), "[%u]", &(entry.key)); // Parse the operator out of the second token token = tokenizer.nextToken(); if (token.c_str()[0] == '=') - criteria->criteriaOperator = Puzzle::EQUAL_TO; + entry.criteriaOperator = Puzzle::EQUAL_TO; else if (token.c_str()[0] == '!') - criteria->criteriaOperator = Puzzle::NOT_EQUAL_TO; + entry.criteriaOperator = Puzzle::NOT_EQUAL_TO; else if (token.c_str()[0] == '>') - criteria->criteriaOperator = Puzzle::GREATER_THAN; + entry.criteriaOperator = Puzzle::GREATER_THAN; else if (token.c_str()[0] == '<') - criteria->criteriaOperator = Puzzle::LESS_THAN; + entry.criteriaOperator = Puzzle::LESS_THAN; // First determine if the last token is an id or a value // Then parse it into 'argument' token = tokenizer.nextToken(); if (token.contains('[')) { - sscanf(token.c_str(), "[%u]", &(criteria->argument)); - criteria->argumentIsAKey = true; + sscanf(token.c_str(), "[%u]", &(entry.argument)); + entry.argumentIsAKey = true; } else { - sscanf(token.c_str(), "%u", &(criteria->argument)); - criteria->argumentIsAKey = false; + sscanf(token.c_str(), "%u", &(entry.argument)); + entry.argumentIsAKey = false; } + criteriaList.back().push_back(entry); + line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 13f30ca0d233..9796a9535348 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -61,13 +61,16 @@ void ScriptManager::createReferenceTable() { for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { Puzzle *puzzlePtr = &(*activePuzzleIter); - // Iterate through each Criteria and add a reference from the criteria key to the Puzzle - for (Common::List::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { - _referenceTable[criteriaIter->key].push_back(puzzlePtr); - - // If the argument is a key, add a reference to it as well - if (criteriaIter->argumentIsAKey) - _referenceTable[criteriaIter->argument].push_back(puzzlePtr); + // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle + for (Common::List >::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { + for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + _referenceTable[entryIter->key].push_back(puzzlePtr); + + // If the argument is a key, add a reference to it as well + if (entryIter->argumentIsAKey) { + _referenceTable[entryIter->argument].push_back(puzzlePtr); + } + } } } @@ -75,13 +78,16 @@ void ScriptManager::createReferenceTable() { for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) { Puzzle *puzzlePtr = &(*globalPuzzleIter); - // Iterate through each Criteria and add a reference from the criteria key to the Puzzle - for (Common::List::iterator criteriaIter = globalPuzzleIter->criteriaList.begin(); criteriaIter != (*globalPuzzleIter).criteriaList.end(); criteriaIter++) { - _referenceTable[criteriaIter->key].push_back(puzzlePtr); + // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle + for (Common::List >::iterator criteriaIter = globalPuzzleIter->criteriaList.begin(); criteriaIter != (*globalPuzzleIter).criteriaList.end(); criteriaIter++) { + for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + _referenceTable[entryIter->key].push_back(puzzlePtr); - // If the argument is a key, add a reference to it as well - if (criteriaIter->argumentIsAKey) - _referenceTable[criteriaIter->argument].push_back(puzzlePtr); + // If the argument is a key, add a reference to it as well + if (entryIter->argumentIsAKey) { + _referenceTable[entryIter->argument].push_back(puzzlePtr); + } + } } } @@ -115,32 +121,43 @@ void ScriptManager::checkPuzzleCriteria() { } // Check each Criteria + bool criteriaMet = false; - for (Common::List::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { - // Get the value to compare against - uint argumentValue; - if ((*iter).argumentIsAKey) - argumentValue = getStateValue(iter->argument); - else - argumentValue = iter->argument; - - // Do the comparison - switch ((*iter).criteriaOperator) { - case Puzzle::EQUAL_TO: - criteriaMet = getStateValue(iter->key) == argumentValue; - break; - case Puzzle::NOT_EQUAL_TO: - criteriaMet = getStateValue(iter->key) != argumentValue; - break; - case Puzzle::GREATER_THAN: - criteriaMet = getStateValue(iter->key) > argumentValue; - break; - case Puzzle::LESS_THAN: - criteriaMet = getStateValue(iter->key) < argumentValue; - break; + for (Common::List >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); criteriaIter++) { + criteriaMet = false; + + for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + // Get the value to compare against + uint argumentValue; + if ((*entryIter).argumentIsAKey) + argumentValue = getStateValue(entryIter->argument); + else + argumentValue = entryIter->argument; + + // Do the comparison + switch ((*entryIter).criteriaOperator) { + case Puzzle::EQUAL_TO: + criteriaMet = getStateValue(entryIter->key) == argumentValue; + break; + case Puzzle::NOT_EQUAL_TO: + criteriaMet = getStateValue(entryIter->key) != argumentValue; + break; + case Puzzle::GREATER_THAN: + criteriaMet = getStateValue(entryIter->key) > argumentValue; + break; + case Puzzle::LESS_THAN: + criteriaMet = getStateValue(entryIter->key) < argumentValue; + break; + } + + // If one check returns false, don't keep checking + if (!criteriaMet) { + break; + } } - if (!criteriaMet) { + // If any of the Criteria are *fully* met, then execute the results + if (criteriaMet) { break; } } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 7012ee0c5e9f..d48453147040 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -122,7 +122,7 @@ class ScriptManager { * @param stream Scr file stream * @return Whether any criteria were read */ - bool parseCriteria(Puzzle::Criteria *criteria, Common::SeekableReadStream &stream) const; + bool parseCriteria(Common::SeekableReadStream &stream, Common::List > &criteriaList) const; /** * Parses the stream into a ResultAction objects From 6ee93ad5c2b2ea577a587af172a28b100a9956d8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:41:52 -0500 Subject: [PATCH 0596/1332] ZVISION: Convert _puzzlesToCheck to a Queue instead of a Stack --- engines/zvision/script_manager.cpp | 4 ++-- engines/zvision/script_manager.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 9796a9535348..8a1b60a0dcc3 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -257,12 +257,12 @@ void ScriptManager::changeLocationIntern() { // Change the background position _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); - // Add all the local puzzles to the stack to be checked // Enable all the controls for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { (*iter)._value->enable(_engine); } + // Add all the local puzzles to the queue to be checked for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { @@ -272,7 +272,7 @@ void ScriptManager::changeLocationIntern() { _puzzlesToCheck.push(&(*iter)); } - // Add all the global puzzles to the stack to be checked + // Add all the global puzzles to the queue to be checked for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index d48453147040..362c4efed9d6 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -24,7 +24,7 @@ #define ZVISION_SCRIPT_MANAGER_H #include "common/hashmap.h" -#include "common/stack.h" +#include "common/queue.h" #include "zvision/puzzle.h" #include "zvision/control.h" @@ -64,7 +64,7 @@ class ScriptManager { /** References _globalState keys to Puzzles */ Common::HashMap > _referenceTable; /** Holds the Puzzles that should be checked this frame */ - Common::Stack _puzzlesToCheck; + Common::Queue _puzzlesToCheck; /** Holds the currently active puzzles */ Common::List _activePuzzles; /** Holds the global puzzles */ From d26c814d1e0ed76b4b4440e5798ccd012bd4858d Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:42:24 -0500 Subject: [PATCH 0597/1332] ZVISION: Force & operator to have precedence over == operator --- engines/zvision/script_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 8a1b60a0dcc3..c80b5a2bc42a 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -265,7 +265,7 @@ void ScriptManager::changeLocationIntern() { // Add all the local puzzles to the queue to be checked for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST - if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { + if (((*iter).flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter).key, 0); } @@ -275,7 +275,7 @@ void ScriptManager::changeLocationIntern() { // Add all the global puzzles to the queue to be checked for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST - if ((*iter).flags & Puzzle::ONCE_PER_INST == Puzzle::ONCE_PER_INST) { + if (((*iter).flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter).key, 0); } From 5eab8a8d77a070b752d5f4e02bad73c5e85dd4a6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:42:45 -0500 Subject: [PATCH 0598/1332] ZVISION: Reimplement PushToggleControl --- engines/zvision/control.cpp | 49 +++++++++++++++++++++++++++++-------- engines/zvision/control.h | 12 +++++++++ 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index b55452c87644..acc970e167d0 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -103,12 +103,15 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } -void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) { - engine->getScriptManager()->setStateValue(key, 0); - Common::Rect hotspot; - Common::String cursorName; - +////////////////////////////////////////////////////////////////////////////// +// PushToggleControl +////////////////////////////////////////////////////////////////////////////// + +PushToggleControl::PushToggleControl(uint32 key, Common::SeekableReadStream &stream) + : Control() { + _event._key = _key = key; + // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -121,23 +124,49 @@ void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::Seekab uint height; sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height); - - hotspot = Common::Rect(x, y, x + width, y + height); + + _event._hotspot = Common::Rect(x, y, x + width, y + height); } else if (line.matchString("cursor*", true)) { char nameBuffer[25]; sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer); - cursorName = Common::String(nameBuffer); + _event._hoverCursor = Common::String(nameBuffer); } line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } - if (!hotspot.isEmpty() && !cursorName.empty()) { - engine->registerMouseEvent(MouseEvent(key, hotspot, cursorName)); + if (_event._hotspot.isEmpty() || _event._hoverCursor.empty()) { + warning("Push_toggle cursor %u was parsed incorrectly", &key); + } +} + +bool PushToggleControl::enable(ZVision *engine) { + if (!_enabled) { + engine->registerMouseEvent(_event); + _enabled = true; + return true; + } + + debug("Control %u is already enabled", _key); + return false; +} + +bool PushToggleControl::disable(ZVision *engine) { + if (_enabled) { + engine->removeMouseEvent(_key); + _enabled = false; + return true; } + + debug("Control %u is already disabled", _key); + return false; +} + +void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) { + } } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index b374383a451d..f17ee7750d1d 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -25,6 +25,8 @@ #include "common/types.h" +#include "zvision/mouse_event.h" + namespace Common { class SeekableReadStream; } @@ -54,6 +56,16 @@ class Control { static void parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream); }; +class PushToggleControl : public Control { +public: + PushToggleControl(uint32 key, Common::SeekableReadStream &stream); + bool enable(ZVision *engine); + bool disable(ZVision *engine); + +private: + MouseEvent _event; +}; + } // End of namespace ZVision #endif From 4d5914ac2157073339b0c348345dedbffd5ee030 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 16:08:37 -0500 Subject: [PATCH 0599/1332] ZVISION: Fix argument passing for warning() --- engines/zvision/control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index acc970e167d0..106d938889bd 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -139,7 +139,7 @@ PushToggleControl::PushToggleControl(uint32 key, Common::SeekableReadStream &str } if (_event._hotspot.isEmpty() || _event._hoverCursor.empty()) { - warning("Push_toggle cursor %u was parsed incorrectly", &key); + warning("Push_toggle cursor %u was parsed incorrectly", key); } } From 2fcba2743c1670ba8a7428945714e896238e082e Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 16:09:08 -0500 Subject: [PATCH 0600/1332] ZVISION: Don't cast away const qualifier --- engines/zvision/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 28c26f6f2adf..4066c5dcd539 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -148,10 +148,10 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d if (frame) { if (scale != 1) { - scaleBuffer((byte *)frame->getBasePtr(0, 0), scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); + scaleBuffer((const byte *)frame->getBasePtr(0, 0), scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); _system->copyRectToScreen(scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); } else { - _system->copyRectToScreen((byte *)frame->getBasePtr(0, 0), pitch, x, y, finalWidth, finalHeight); + _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), pitch, x, y, finalWidth, finalHeight); } _system->updateScreen(); From b0635edff8c0d5b05cef8a22c74c569921a8346b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 19:51:27 -0500 Subject: [PATCH 0601/1332] ZVISION: Revert to normal pointers instead of shared pointers --- engines/zvision/puzzle.h | 2 +- engines/zvision/scr_file_handling.cpp | 24 ++++++++++++------------ engines/zvision/script_manager.cpp | 2 +- engines/zvision/script_manager.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 36787e7ba1a8..227183ab0283 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,7 +64,7 @@ struct Puzzle { uint32 key; Common::List > criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List > resultActions; + Common::List resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index dd2754c12fd1..eb15d0407097 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -140,7 +140,7 @@ bool ScriptManager::parseCriteria(Common::SeekableReadStream &stream, Common::Li return true; } -void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::List > &actionList) const { +void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -156,13 +156,13 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis // Parse for the action type if (line.matchString("*:add*", true)) { - actionList.push_back(Common::SharedPtr(new ActionAdd(line))); + actionList.push_back(new ActionAdd(line)); } else if (line.matchString("*:animplay*", true)) { - actionList.push_back(Common::SharedPtr(new ActionPlayAnimation(line))); + actionList.push_back(new ActionPlayAnimation(line)); } else if (line.matchString("*:animpreload*", true)) { - actionList.push_back(Common::SharedPtr(new ActionPreloadAnimation(line))); + actionList.push_back(new ActionPreloadAnimation(line)); } else if (line.matchString("*:animunload*", true)) { - //actionList.push_back(Common::SharedPtr(new ActionUnloadAnimation(line))); + //actionList.push_back(new ActionUnloadAnimation(line)); } else if (line.matchString("*:attenuate*", true)) { @@ -170,7 +170,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:change_location*", true)) { - actionList.push_back(Common::SharedPtr(new ActionChangeLocation(line))); + actionList.push_back(new ActionChangeLocation(line)); } else if (line.matchString("*:crossfade*", true)) { @@ -181,7 +181,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:disable_control*", true)) { - actionList.push_back(Common::SharedPtr(new ActionDisableControl(line))); + actionList.push_back(new ActionDisableControl(line)); } else if (line.matchString("*:disable_venus*", true)) { @@ -195,7 +195,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:enable_control*", true)) { - actionList.push_back(Common::SharedPtr(new ActionEnableControl(line))); + actionList.push_back(new ActionEnableControl(line)); } else if (line.matchString("*:flush_mouse_events*", true)) { @@ -209,7 +209,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:music*", true)) { - actionList.push_back(Common::SharedPtr(new ActionMusic(line))); + actionList.push_back(new ActionMusic(line)); } else if (line.matchString("*:pan_track*", true)) { @@ -220,7 +220,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:quit*", true)) { - actionList.push_back(Common::SharedPtr(new ActionQuit())); + actionList.push_back(new ActionQuit()); } else if (line.matchString("*:random*", true)) { @@ -240,7 +240,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:set_screen*", true)) { - actionList.push_back(Common::SharedPtr(new ActionSetScreen(line))); + actionList.push_back(new ActionSetScreen(line)); } else if (line.matchString("*:set_venus*", true)) { @@ -248,7 +248,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:streamvideo*", true)) { - actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); + actionList.push_back(new ActionStreamVideo(line)); } else if (line.matchString("*:syncsound*", true)) { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index c80b5a2bc42a..6a1794dabf57 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -167,7 +167,7 @@ void ScriptManager::checkPuzzleCriteria() { debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); bool shouldContinue = true; - for (Common::List >::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { shouldContinue = shouldContinue && (*resultIter)->execute(_engine); } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 362c4efed9d6..884699a6b0a3 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -132,7 +132,7 @@ class ScriptManager { * @param actionList The list where the results will be added * @return Created Results object */ - void parseResults(Common::SeekableReadStream &stream, Common::List > &actionList) const; + void parseResults(Common::SeekableReadStream &stream, Common::List &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum From 99b4b12b1cd1db9ab2ba092722a528c3703d93e9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 19 Aug 2013 18:18:02 +0200 Subject: [PATCH 0602/1332] AVALANCHE: Add AvalancheEngine::synchronize(), AvalancheEngine::generateSaveFileName(), AvalancheEngine::saveGame(). --- engines/avalanche/avalanche.cpp | 246 +++++++++++++++++++++++++++++++- engines/avalanche/avalanche.h | 9 +- 2 files changed, 251 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f8e873b2ae5c..113b199fa8fa 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -34,6 +34,9 @@ #include "common/debug-channels.h" #include "common/config-manager.h" #include "common/textconsole.h" +#include "common/savefile.h" + + #include "engines/util.h" @@ -132,15 +135,252 @@ const char *AvalancheEngine::getCopyrightString() const { -bool AvalancheEngine::canSaveGameStateCurrently() { +void AvalancheEngine::synchronize(Common::Serializer &sz) { + Common::String signature; + if (sz.isSaving()) { + signature = "AVAL"; + for (uint16 i = 0; i < 4; i++) { + char actChr = signature[i]; + sz.syncAsByte(actChr); + } + } else { + if (!signature.empty()) + signature.clear(); + for (uint16 i = 0; i < 4; i++) { + char actChr; + sz.syncAsByte(actChr); + signature += actChr; + } + if (signature != "AVAL") + error("Corrupted save file!"); + } + + //blockwrite(f, dna, sizeof(dna)); + sz.syncAsByte(_gyro->dna.rw); + sz.syncAsByte(_gyro->dna.carrying); + for (byte i = 0; i < numobjs; i++) + sz.syncAsByte(_gyro->dna.obj[i]); + sz.syncAsSint16LE(_gyro->dna.score); + sz.syncAsSint32LE(_gyro->dna.pence); + sz.syncAsByte(_gyro->dna.room); + sz.syncAsByte(_gyro->dna.wearing); + sz.syncAsByte(_gyro->dna.swore); + sz.syncAsByte(_gyro->dna.saves); + sz.syncBytes(_gyro->dna.rooms, 100); + sz.syncAsByte(_gyro->dna.alcohol); + sz.syncAsByte(_gyro->dna.playednim); + sz.syncAsByte(_gyro->dna.wonnim); + sz.syncAsByte(_gyro->dna.winestate); + sz.syncAsByte(_gyro->dna.cwytalot_gone); + sz.syncAsByte(_gyro->dna.pass_num); + sz.syncAsByte(_gyro->dna.ayles_is_awake); + sz.syncAsByte(_gyro->dna.drawbridge_open); + sz.syncAsByte(_gyro->dna.avaricius_talk); + sz.syncAsByte(_gyro->dna.bought_onion); + sz.syncAsByte(_gyro->dna.rotten_onion); + sz.syncAsByte(_gyro->dna.onion_in_vinegar); + sz.syncAsByte(_gyro->dna.given2spludwick); + sz.syncAsByte(_gyro->dna.brummie_stairs); + sz.syncAsByte(_gyro->dna.cardiff_things); + sz.syncAsByte(_gyro->dna.cwytalot_in_herts); + sz.syncAsByte(_gyro->dna.avvy_is_awake); + sz.syncAsByte(_gyro->dna.avvy_in_bed); + sz.syncAsByte(_gyro->dna.user_moves_avvy); + sz.syncAsByte(_gyro->dna.dogfoodpos); + sz.syncAsByte(_gyro->dna.givenbadgetoiby); + sz.syncAsByte(_gyro->dna.friar_will_tie_you_up); + sz.syncAsByte(_gyro->dna.tied_up); + sz.syncAsByte(_gyro->dna.box_contents); + sz.syncAsByte(_gyro->dna.talked_to_crapulus); + sz.syncAsByte(_gyro->dna.jacques_awake); + sz.syncAsByte(_gyro->dna.ringing_bells); + sz.syncAsByte(_gyro->dna.standing_on_dais); + sz.syncAsByte(_gyro->dna.taken_pen); + sz.syncAsByte(_gyro->dna.arrow_triggered); + sz.syncAsByte(_gyro->dna.arrow_in_the_door); + + if (sz.isSaving()) { + uint16 like2drinkSize = _gyro->dna.like2drink.size(); + sz.syncAsUint16LE(like2drinkSize); + for (uint16 i = 0; i < like2drinkSize; i++) { + char actChr = _gyro->dna.like2drink[i]; + sz.syncAsByte(actChr); + } + + uint16 favourite_songSize = _gyro->dna.favourite_song.size(); + sz.syncAsUint16LE(favourite_songSize); + for (uint16 i = 0; i < favourite_songSize; i++) { + char actChr = _gyro->dna.favourite_song[i]; + sz.syncAsByte(actChr); + } + + uint16 worst_place_on_earthSize = _gyro->dna.worst_place_on_earth.size(); + sz.syncAsUint16LE(worst_place_on_earthSize); + for (uint16 i = 0; i < worst_place_on_earthSize; i++) { + char actChr = _gyro->dna.worst_place_on_earth[i]; + sz.syncAsByte(actChr); + } + + uint16 spare_eveningSize = _gyro->dna.spare_evening.size(); + sz.syncAsUint16LE(spare_eveningSize); + for (uint16 i = 0; i < spare_eveningSize; i++) { + char actChr = _gyro->dna.spare_evening[i]; + sz.syncAsByte(actChr); + } + } else { + if (!_gyro->dna.like2drink.empty()) + _gyro->dna.like2drink.clear(); + uint16 like2drinkSize; + sz.syncAsUint16LE(like2drinkSize); + for (uint16 i = 0; i < like2drinkSize; i++) { + char actChr; + sz.syncAsByte(actChr); + _gyro->dna.like2drink += actChr; + } + + if (!_gyro->dna.favourite_song.empty()) + _gyro->dna.favourite_song.clear(); + uint16 favourite_songSize; + sz.syncAsUint16LE(favourite_songSize); + for (uint16 i = 0; i < favourite_songSize; i++) { + char actChr; + sz.syncAsByte(actChr); + _gyro->dna.favourite_song += actChr; + } + + if (!_gyro->dna.worst_place_on_earth.empty()) + _gyro->dna.worst_place_on_earth.clear(); + uint16 worst_place_on_earthSize; + sz.syncAsUint16LE(worst_place_on_earthSize); + for (uint16 i = 0; i < worst_place_on_earthSize; i++) { + char actChr; + sz.syncAsByte(actChr); + _gyro->dna.worst_place_on_earth += actChr; + } + + if (!_gyro->dna.spare_evening.empty()) + _gyro->dna.spare_evening.clear(); + uint16 spare_eveningSize; + sz.syncAsUint16LE(spare_eveningSize); + for (uint16 i = 0; i < spare_eveningSize; i++) { + char actChr; + sz.syncAsByte(actChr); + _gyro->dna.spare_evening += actChr; + } + } + + sz.syncAsSint32LE(_gyro->dna.total_time); + sz.syncAsByte(_gyro->dna.jumpstatus); + sz.syncAsByte(_gyro->dna.mushroom_growing); + sz.syncAsByte(_gyro->dna.spludwicks_here); + sz.syncAsByte(_gyro->dna.last_room); + sz.syncAsByte(_gyro->dna.last_room_not_map); + sz.syncAsByte(_gyro->dna.crapulus_will_tell); + sz.syncAsByte(_gyro->dna.enter_catacombs_from_lusties_room); + sz.syncAsByte(_gyro->dna.teetotal); + sz.syncAsByte(_gyro->dna.malagauche); + sz.syncAsByte(_gyro->dna.drinking); + sz.syncAsByte(_gyro->dna.entered_lusties_room_as_monk); + sz.syncAsByte(_gyro->dna.cat_x); + sz.syncAsByte(_gyro->dna.cat_y); + sz.syncAsByte(_gyro->dna.avvys_in_the_cupboard); + sz.syncAsByte(_gyro->dna.geida_follows); + sz.syncAsByte(_gyro->dna.geida_spin); + sz.syncAsByte(_gyro->dna.geida_time); + sz.syncAsByte(_gyro->dna.nextbell); + sz.syncAsByte(_gyro->dna.geida_given_potion); + sz.syncAsByte(_gyro->dna.lustie_is_asleep); + sz.syncAsByte(_gyro->dna.flip_to_where); + sz.syncAsByte(_gyro->dna.flip_to_ped); + sz.syncAsByte(_gyro->dna.been_tied_up); + sz.syncAsByte(_gyro->dna.sitting_in_pub); + sz.syncAsByte(_gyro->dna.spurge_talk); + sz.syncAsByte(_gyro->dna.met_avaroid); + sz.syncAsByte(_gyro->dna.taken_mushroom); + sz.syncAsByte(_gyro->dna.given_pen_to_ayles); + sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim); + + + //for (byte groi = 0; groi < numtr; groi ++) { + // if (tr[groi].quick) { + // blockwrite(f, groi, 1); + // tr[groi].savedata(f); + // } + //} + for (byte i = 0; i < _trip->numtr; i++) + if (_trip->tr[i].quick) { + sz.syncAsByte(_trip->tr[i].whichsprite); + sz.syncAsByte(_trip->tr[i].face); + sz.syncAsByte(_trip->tr[i].step); + sz.syncAsSint16LE(_trip->tr[i].x); + sz.syncAsSint16LE(_trip->tr[i].y); + sz.syncAsByte(_trip->tr[i].ix); + sz.syncAsByte(_trip->tr[i].iy); + sz.syncAsByte(_trip->tr[i].visible); + sz.syncAsByte(_trip->tr[i].homing); + sz.syncAsByte(_trip->tr[i].check_me); + sz.syncAsByte(_trip->tr[i].count); + sz.syncAsByte(_trip->tr[i]._info.xw); + sz.syncAsByte(_trip->tr[i].xs); + sz.syncAsByte(_trip->tr[i].ys); + sz.syncAsByte(_trip->tr[i].totalnum); + sz.syncAsSint16LE(_trip->tr[i].hx); + sz.syncAsSint16LE(_trip->tr[i].hy); + sz.syncAsByte(_trip->tr[i].call_eachstep); + sz.syncAsByte(_trip->tr[i].eachstep); + sz.syncAsByte(_trip->tr[i].vanishifstill); + } + + //groi = 177; + //blockwrite(f, groi, 1); + + //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. + for (byte i = 0; i < 7; i++) { + sz.syncAsSint32LE(_timeout->times[i].time_left); + sz.syncAsByte(_timeout->times[i].then_where); + sz.syncAsByte(_timeout->times[i].what_for); + } + + //blockwrite(f, seq, sizeof(seq)); // Sequencer information. + sz.syncBytes(_sequence->seq, _sequence->seq_length); +} + +bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! return true; } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { - return Common::kNoError; + return (saveGame(slot, desc) ? Common::kNoError : Common::kWritingFailed); +} + +Common::String AvalancheEngine::generateSaveFileName(Common::String name, const int slot) { + name.toUppercase(); + return Common::String::format("%s-%d.ASG", name.c_str(), slot); +} + +bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { + Common::String fileName = generateSaveFileName(desc, slot); + Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName); + + if (!f) { + warning("Can't create file '%s', game not saved.", fileName.c_str()); + return false; + } + + Common::Serializer sz(NULL, f); + + synchronize(sz); + + f->finalize(); + + delete f; + + return true; } -bool AvalancheEngine::canLoadGameStateCurrently() { + + +bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! return true; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index a027dc598894..39457ef94f3d 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -51,11 +51,14 @@ #include "avalanche/dropdown2.h" #include "avalanche/closing2.h" +#include "common/serializer.h" + #include "engines/engine.h" #include "engines/advancedDetector.h" #include "graphics/cursorman.h" + namespace Common { class RandomSource; } @@ -113,14 +116,18 @@ class AvalancheEngine : public Engine { + void synchronize(Common::Serializer &sz); virtual bool canSaveGameStateCurrently(); Common::Error saveGameState(int slot, const Common::String &desc); + Common::String generateSaveFileName(Common::String name, const int slot); + bool saveGame(const int16 slot, const Common::String &desc); + virtual bool canLoadGameStateCurrently(); Common::Error loadGameState(int slot, const Common::String &desc); void updateEvents(); - bool getEvent(Common::Event &event); // A warpper around _eventMan->pollEvent(), se we can use it in Scrolls::normscroll() for example. + bool getEvent(Common::Event &event); // A wrapper around _eventMan->pollEvent(), so we can use it in Scrolls::normscroll() for example. Common::Point getMousePos(); protected: From 52c07d08c0602936f33ea569ea6515cc1ae9f976 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 19 Aug 2013 21:14:21 +0200 Subject: [PATCH 0603/1332] AVALANCHE: AvalancheEngine: Revise synchronize(), saveGame(), loadGameState(). Add loadGame(). Rename generateSaveFileName() to getSaveFileName(). AvalancheMetaEngine: Add listSaves() and removeSaveState(). --- engines/avalanche/avalanche.cpp | 76 ++++++++++++++++++++------------- engines/avalanche/avalanche.h | 7 ++- engines/avalanche/detection.cpp | 62 ++++++++++++++++++++++++++- 3 files changed, 113 insertions(+), 32 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 113b199fa8fa..44b736f55596 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -36,10 +36,9 @@ #include "common/textconsole.h" #include "common/savefile.h" - - #include "engines/util.h" +#include "gui/saveload.h" namespace Avalanche { @@ -136,25 +135,6 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { - Common::String signature; - if (sz.isSaving()) { - signature = "AVAL"; - for (uint16 i = 0; i < 4; i++) { - char actChr = signature[i]; - sz.syncAsByte(actChr); - } - } else { - if (!signature.empty()) - signature.clear(); - for (uint16 i = 0; i < 4; i++) { - char actChr; - sz.syncAsByte(actChr); - signature += actChr; - } - if (signature != "AVAL") - error("Corrupted save file!"); - } - //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_gyro->dna.rw); sz.syncAsByte(_gyro->dna.carrying); @@ -353,13 +333,8 @@ Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &des return (saveGame(slot, desc) ? Common::kNoError : Common::kWritingFailed); } -Common::String AvalancheEngine::generateSaveFileName(Common::String name, const int slot) { - name.toUppercase(); - return Common::String::format("%s-%d.ASG", name.c_str(), slot); -} - bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { - Common::String fileName = generateSaveFileName(desc, slot); + Common::String fileName = getSaveFileName(slot); Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName); if (!f) { @@ -367,6 +342,14 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { return false; } + char *signature = "AVAL"; + + f->write(signature, 4); + + f->writeUint32LE(desc.size()); + + f->write(desc.c_str(), desc.size()); + Common::Serializer sz(NULL, f); synchronize(sz); @@ -380,12 +363,47 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { +Common::String AvalancheEngine::getSaveFileName(const int slot) { + Common::String upperName = _targetName; + upperName.toUppercase(); + return upperName+ Common::String::format("-%02d.SAV", slot); +} + + + bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! return true; } -Common::Error AvalancheEngine::loadGameState(int slot, const Common::String &desc) { - return Common::kNoError; +Common::Error AvalancheEngine::loadGameState(int slot) { + return (loadGame(slot) ? Common::kNoError : Common::kReadingFailed); +} + +bool AvalancheEngine::loadGame(const int16 slot) { + Common::String fileName = getSaveFileName(slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); + + if (!f) + return false; + + // Check for our signature. + Common::String signature; + for (byte i = 0; i < 4; i++) + signature += f->readByte(); + if (signature != "AVAL") + return false; + + // We dont care about the description here. + uint32 descSize = f->readUint32LE(); + f->skip(descSize); + + Common::Serializer sz(f, NULL); + + synchronize(sz); + + delete f; + + return true; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 39457ef94f3d..52472b612877 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -117,13 +117,16 @@ class AvalancheEngine : public Engine { void synchronize(Common::Serializer &sz); + virtual bool canSaveGameStateCurrently(); Common::Error saveGameState(int slot, const Common::String &desc); - Common::String generateSaveFileName(Common::String name, const int slot); bool saveGame(const int16 slot, const Common::String &desc); + Common::String getSaveFileName(const int slot); + virtual bool canLoadGameStateCurrently(); - Common::Error loadGameState(int slot, const Common::String &desc); + Common::Error loadGameState(int slot); + bool loadGame(const int16 slot); void updateEvents(); diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 701f12be99e7..fb68e2ec670d 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -83,6 +83,10 @@ class AvalancheMetaEngine : public AdvancedMetaEngine { bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; bool hasFeature(MetaEngineFeature f) const; + + int getMaximumSaveSlot() const { return 99; } + SaveStateList listSaves(const char *target) const; + void removeSaveState(const char *target, int slot) const; }; bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { @@ -92,7 +96,63 @@ bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const A } bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + return (f == kSupportsListSaves) || (f == kSupportsDeleteSave); +} + +SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String pattern = target; + pattern.toUppercase(); + pattern += "-??.SAV"; + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + char slot[3]; + int slotNum = 0; + for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { + slot[0] = filename->c_str()[filename->size() - 6]; + slot[1] = filename->c_str()[filename->size() - 5]; + slot[2] = '\0'; + // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot + slotNum = atoi(slot); + if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { + Common::InSaveFile *file = saveFileMan->openForLoading(*filename); + if (file) { + /*int saveVersion = file->readByte(); + + if (saveVersion != kSavegameVersion) { + warning("Savegame of incompatible version"); + delete file; + continue; + }*/ + + // Read name + file->seek(4); // We skip the "AVAL" signature. + uint32 nameSize = file->readUint32LE(); + if (nameSize >= 255) { + delete file; + continue; + } + char *name = new char[nameSize + 1]; + file->read(name, nameSize); + name[nameSize] = 0; + + saveList.push_back(SaveStateDescriptor(slotNum, name)); + delete[] name; + delete file; + } + } + } + + return saveList; +} + +void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + g_system->getSavefileManager()->removeSavefile(fileName); } } // End of namespace Avalanche From f9047bb83d8b66a604ebb02dabe77974dd758a4e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 20 Aug 2013 13:37:14 +0200 Subject: [PATCH 0604/1332] AVALANCHE: Repair synchronize() and loadGame(), update canSaveGameStateCurrently() and canLoadGameStateCurrently() in AvalancheEngine. --- engines/avalanche/avalanche.cpp | 99 +++++++++++++++++++++++++-------- engines/avalanche/lucerna2.cpp | 5 +- 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 44b736f55596..8e4577a09317 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -287,30 +287,60 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { // tr[groi].savedata(f); // } //} - for (byte i = 0; i < _trip->numtr; i++) - if (_trip->tr[i].quick) { - sz.syncAsByte(_trip->tr[i].whichsprite); - sz.syncAsByte(_trip->tr[i].face); - sz.syncAsByte(_trip->tr[i].step); - sz.syncAsSint16LE(_trip->tr[i].x); - sz.syncAsSint16LE(_trip->tr[i].y); - sz.syncAsByte(_trip->tr[i].ix); - sz.syncAsByte(_trip->tr[i].iy); - sz.syncAsByte(_trip->tr[i].visible); - sz.syncAsByte(_trip->tr[i].homing); - sz.syncAsByte(_trip->tr[i].check_me); - sz.syncAsByte(_trip->tr[i].count); - sz.syncAsByte(_trip->tr[i]._info.xw); - sz.syncAsByte(_trip->tr[i].xs); - sz.syncAsByte(_trip->tr[i].ys); - sz.syncAsByte(_trip->tr[i].totalnum); - sz.syncAsSint16LE(_trip->tr[i].hx); - sz.syncAsSint16LE(_trip->tr[i].hy); - sz.syncAsByte(_trip->tr[i].call_eachstep); - sz.syncAsByte(_trip->tr[i].eachstep); - sz.syncAsByte(_trip->tr[i].vanishifstill); + + byte spriteNum; + if (sz.isSaving()) { + spriteNum = 0; + for (byte i = 0; i < _trip->numtr; i++) + if (_trip->tr[i].quick) + spriteNum++; + } + sz.syncAsByte(spriteNum); + + if (sz.isLoading()) + for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites. + if (_trip->tr[i].quick) + _trip->tr[i].done(); } + for (byte i = 0; i < spriteNum; i++) { + sz.syncAsByte(_trip->tr[i].whichsprite); + sz.syncAsByte(_trip->tr[i].check_me); + + + if (sz.isLoading()) { + _trip->tr[i].quick = true; + _trip->tr[i].init(_trip->tr[i].whichsprite, _trip->tr[i].check_me, _trip); + } + + sz.syncAsByte(_trip->tr[i].ix); + sz.syncAsByte(_trip->tr[i].iy); + sz.syncAsByte(_trip->tr[i].face); + sz.syncAsByte(_trip->tr[i].step); + sz.syncAsByte(_trip->tr[i].visible); + sz.syncAsByte(_trip->tr[i].homing); + sz.syncAsByte(_trip->tr[i].count); + sz.syncAsByte(_trip->tr[i]._info.xw); + sz.syncAsByte(_trip->tr[i].xs); + sz.syncAsByte(_trip->tr[i].ys); + sz.syncAsByte(_trip->tr[i].totalnum); + sz.syncAsSint16LE(_trip->tr[i].hx); + sz.syncAsSint16LE(_trip->tr[i].hy); + sz.syncAsByte(_trip->tr[i].call_eachstep); + sz.syncAsByte(_trip->tr[i].eachstep); + sz.syncAsByte(_trip->tr[i].vanishifstill); + + sz.syncAsSint16LE(_trip->tr[i].x); + sz.syncAsSint16LE(_trip->tr[i].y); + + if (sz.isLoading() && _trip->tr[i].visible) + _trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face); + } + + + + + //groi = 177; //blockwrite(f, groi, 1); @@ -326,7 +356,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return true; + return (!_gyro->seescroll); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { @@ -372,7 +402,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) { bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! - return true; + return (!_gyro->seescroll); } Common::Error AvalancheEngine::loadGameState(int slot) { @@ -403,6 +433,27 @@ bool AvalancheEngine::loadGame(const int16 slot) { delete f; + _gyro->seescroll = true; // This prevents display of the new sprites before the new picture is loaded. + + if (_gyro->holdthedawn) { + _gyro->holdthedawn = false; + _lucerna->dawn(); + } + + _celer->forget_chunks(); + + _lucerna->minor_redraw(); + + _gyro->whereis[0] = _gyro->dna.room; + + _gyro->alive = true; + + _lucerna->objectlist(); + + _trip->newspeed(); + + _lucerna->showrw(); + return true; } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f2ae72cfe58f..797dabd39820 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1268,12 +1268,11 @@ void Lucerna::gameover() { when you load a game, etc. Major redraws EVERYTHING. */ void Lucerna::minor_redraw() { - byte fv; - dusk(); + enterroom(_vm->_gyro->dna.room, 0); /* Ped unknown or non-existant. */ - for (fv = 0; fv <= 1; fv ++) { + for (byte fv = 0; fv <= 1; fv ++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; _vm->_trip->getback(); } From 695257cb79f8666a74d4bc67996234eab391c67c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:43:33 -0500 Subject: [PATCH 0605/1332] ZVISION: Create class to parse RLF animation files --- engines/zvision/rlf_animation.cpp | 230 ++++++++++++++++++++++++++++++ engines/zvision/rlf_animation.h | 60 ++++++++ 2 files changed, 290 insertions(+) create mode 100644 engines/zvision/rlf_animation.cpp create mode 100644 engines/zvision/rlf_animation.h diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp new file mode 100644 index 000000000000..abc31c1d1def --- /dev/null +++ b/engines/zvision/rlf_animation.cpp @@ -0,0 +1,230 @@ +/* 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/scummsys.h" + +#include "common/str.h" +#include "common/file.h" +#include "common/textconsole.h" +#include "common/debug.h" +#include "common/endian.h" + +#include "zvision/rlf_animation.h" + + +namespace ZVision { + +RlfAnimation::RlfAnimation(const Common::String &fileName) + : _frames(0) { + Common::File file; + if (!file.open(fileName)) { + warning("RLF animation file %s could not be opened", fileName.c_str()); + return; + } + + if (file.readUint32BE() != MKTAG('F', 'E', 'L', 'R')) { + warning("%s is not a RLF animation file. Wrong magic number", fileName.c_str()); + return; + } + + // Read the header + file.readUint32LE(); // Size1 + file.readUint32LE(); // Unknown1 + file.readUint32LE(); // Unknown2 + _frameCount = file.readUint32LE(); // Frame count + + // Since we don't need any of the data, we can just seek right to the + // entries we need rather than read in all the individual entries. + file.seek(136, file.pos()); + + //// Read CIN header + //file.readUint32BE(); // Magic number FNIC + //file.readUint32LE(); // Size2 + //file.readUint32LE(); // Unknown3 + //file.readUint32LE(); // Unknown4 + //file.readUint32LE(); // Unknown5 + //file.seek(0x18, file.pos()); // VRLE + //file.readUint32LE(); // LRVD + //file.readUint32LE(); // Unknown6 + //file.seek(0x18, file.pos()); // HRLE + //file.readUint32LE(); // ELHD + //file.readUint32LE(); // Unknown7 + //file.seek(0x18, file.pos()); // HKEY + //file.readUint32LE(); // ELRH + + //// Read MIN info header + //file.readUint32BE(); // Magic number FNIM + //file.readUint32LE(); // Size3 + //file.readUint32LE(); // OEDV + //file.readUint32LE(); // Unknown8 + //file.readUint32LE(); // Unknown9 + //file.readUint32LE(); // Unknown10 + _width = file.readUint32LE(); // Width + _height = file.readUint32LE(); // Height + + // Read time header + file.readUint32BE(); // Magic number EMIT + file.readUint32LE(); // Size4 + file.readUint32LE(); // Unknown11 + _frameTime = file.readUint32LE() / 10; // Frame time in microseconds + + // Read in each frame + _frames = new uint16 *[_frameCount]; + for (uint i = 0; i < _frameCount; i++) { + file.readUint32BE(); // Magic number MARF + uint32 size = file.readUint32LE(); // Size + file.readUint32LE(); // Unknown1 + file.readUint32LE(); // Unknown2 + uint32 type = file.readUint32BE(); // Either ELHD or ELRH + uint32 offset = file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 + file.readUint32LE(); // Unknown3 + + int8 *buffer = new int8[size - headerSize]; + file.read(buffer, size - headerSize); + + _frames[i] = new uint16[_width * _height]; + uint frameByteSize = _width * _height * sizeof(uint16); + memset(_frames[i], 0x7C00, frameByteSize); + // Decode the data + debug("Decoding frame %u", i); + if (type == MKTAG('E', 'L', 'H', 'D')) { + debug("Decoding with masked RLE"); + decodeMaskedRunLengthEncoding(buffer, (int8 *)_frames[i], size - headerSize, frameByteSize); + } else if (type == MKTAG('E', 'L', 'R', 'H')) { + debug("Decoding with simple RLE"); + decodeSimpleRunLengthEncoding(buffer, (int8 *)_frames[i], size - headerSize, frameByteSize); + } else { + warning("Frame %u of %s doesn't have type that can be decoded", i, fileName.c_str()); + return; + } + + // Cleanup + delete[] buffer; + } +}; + +RlfAnimation::~RlfAnimation() { + if (_frames != 0) { + delete[] _frames; + } +} + + + +void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const { + uint32 sourceOffset = 0; + uint32 destOffset = 0; + + while (sourceOffset < sourceSize) { + int8 numberOfSamples = source[sourceOffset]; + sourceOffset++; + + // If numberOfSamples is negative, the next abs(numberOfSamples) samples should + // be copied directly from source to dest + if (numberOfSamples < 0) { + numberOfSamples = abs(numberOfSamples); + + while (numberOfSamples > 0) { + if (sourceOffset + 1 >= sourceSize) { + return; + } else if (destOffset + 1 >= destSize) { + warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + return; + } + + WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset)); + + sourceOffset += 2; + destOffset += 2; + numberOfSamples--; + } + + // If numberOfSamples is >= 0, move destOffset forward ((numberOfSamples * 2) + 2) + // This function assumes the dest buffer has been memset with 0's. + } else { + if (sourceOffset + 1 >= sourceSize) { + return; + } else if (destOffset + 1 >= destSize) { + warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + return; + } + + destOffset += (numberOfSamples * 2) + 2; + } + } +} + +void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const { + uint32 sourceOffset = 0; + uint32 destOffset = 0; + + while (sourceOffset < sourceSize) { + int8 numberOfSamples = source[sourceOffset]; + sourceOffset++; + + // If numberOfSamples is negative, the next abs(numberOfSamples) samples should + // be copied directly from source to dest + if (numberOfSamples < 0) { + numberOfSamples = abs(numberOfSamples); + + while (numberOfSamples > 0) { + if (sourceOffset + 1 >= sourceSize) { + return; + } else if (destOffset + 1 >= destSize) { + warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + return; + } + + WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset)); + + sourceOffset += 2; + destOffset += 2; + numberOfSamples--; + } + + // If numberOfSamples is >= 0, copy one sample from source to the + // next (numberOfSamples + 2) dest spots + } else { + if (sourceOffset + 1 >= sourceSize) { + return; + } + + uint16 sampleColor = READ_LE_UINT16(source + sourceOffset); + sourceOffset += 2; + + numberOfSamples += 2; + while (numberOfSamples > 0) { + if (destOffset + 1 >= destSize) { + warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + return; + } + + WRITE_UINT16(dest + destOffset, sampleColor); + destOffset += 2; + numberOfSamples--; + } + } + } +} + + +} // End of namespace ZVision diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h new file mode 100644 index 000000000000..7ece4e506319 --- /dev/null +++ b/engines/zvision/rlf_animation.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. + * + */ + +#ifndef ZVISION_RLF_ANIMATION_H +#define ZVISION_RLF_ANIMATION_H + + +namespace Common { +class String; +} + +namespace ZVision { + +class RlfAnimation { +public: + RlfAnimation(const Common::String &fileName); + ~RlfAnimation(); + +private: +private: + uint _frameCount; + uint _width; + uint _height; + uint32 _frameTime; // In milliseconds + uint16 **_frames; + +public: + uint frameCount() { return _frameCount; } + uint width() { return _width; } + uint height() { return _height; } + uint32 frameTime() { return _frameTime; } + const uint16 *getFrameData(uint frameNumber) const { return _frames[frameNumber]; } + +private: + void decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; + void decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; +}; + +} // End of namespace ZVision + +#endif From 760dd3e63202ff92d206fb83015f8b05e4aa969c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:47:33 -0500 Subject: [PATCH 0606/1332] ZVISION: Rename _warpedBuffer to _workingWindowBuffer To better represent its function --- engines/zvision/render_manager.cpp | 8 ++++---- engines/zvision/render_manager.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 932c797c11fc..4e67cbbd7b7a 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -50,7 +50,7 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, _accumulatedVelocityMilliseconds(0), _renderTable(_workingWidth, _workingHeight) { - _warpedBuffer = new uint16[_workingWidth *_workingHeight]; + _workingWindowBuffer = new uint16[_workingWidth *_workingHeight]; } RenderManager::~RenderManager() { @@ -58,7 +58,7 @@ RenderManager::~RenderManager() { delete _currentBackground; } - delete[] _warpedBuffer; + delete[] _workingWindowBuffer; } void RenderManager::update(uint deltaTimeInMillis) { @@ -133,9 +133,9 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (_renderTable.getRenderState() == RenderTable::FLAT) { _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); } else { - _renderTable.mutateImage((uint16 *)surface.getBasePtr(0, 0), _warpedBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap, isTransposed); + _renderTable.mutateImage((uint16 *)surface.getBasePtr(0, 0), _workingWindowBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap, isTransposed); - _system->copyRectToScreen(_warpedBuffer, _workingWidth * sizeof(uint16), destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); + _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); } } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 9683ee0bf274..5b517031ae87 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -52,7 +52,9 @@ class RenderManager { OSystem *_system; const Graphics::PixelFormat _pixelFormat; - uint16 *_warpedBuffer; + // A buffer the exact same size as the workingWindow + // It's used for panorama/tilt warping and for clearing the workingWindow to a single color + uint16 *_workingWindowBuffer; /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; @@ -88,6 +90,7 @@ class RenderManager { /** Holds any 'leftover' milliseconds between frames */ uint _accumulatedVelocityMilliseconds; + // TODO: Potentially merge this buffer and _workingWindowBuffer byte *_scaledVideoFrameBuffer; public: From 7c02b66b2e556816c70b75e69e53ba1fb3d1b895 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:49:38 -0500 Subject: [PATCH 0607/1332] ZVISION: Create method to clear the working window area of the screen to a single color --- engines/zvision/render_manager.cpp | 10 ++++++++++ engines/zvision/render_manager.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 4e67cbbd7b7a..6c006d9320fc 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -79,6 +79,16 @@ void RenderManager::update(uint deltaTimeInMillis) { } } +void RenderManager::clearWorkingWindowToColor(uint16 color) { + uint32 workingWindowSize = _workingWidth * _workingHeight; + + for (uint32 i = 0; i < workingWindowSize; i++) { + _workingWindowBuffer[i] = color; + } + + _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), _workingWindow.left, _workingWindow.top, _workingWidth, _workingHeight); +} + void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap, bool isTransposed) { int16 subRectX = 0; int16 subRectY = 0; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 5b517031ae87..d82e40fa4c49 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -102,6 +102,13 @@ class RenderManager { */ void update(uint deltaTimeInMillis); + /** + * Fills the entire workingWindow with the specified color + * + * @param color The color to fill the working window with. (In RGB 555) + */ + void clearWorkingWindowToColor(uint16 color); + /** * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! From 683e24cd75e629061a7f5d0733b29daf10bba2ec Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:43:02 -0500 Subject: [PATCH 0608/1332] ZVISION: Implement ActionSetPartialScreen --- engines/zvision/actions.cpp | 33 +++++++++++++++++++++++++++++++-- engines/zvision/actions.h | 12 ++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index affa8f5a9c61..16499138c712 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -266,6 +266,36 @@ bool ActionRandom::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionSetPartialScreen +////////////////////////////////////////////////////////////////////////////// + +ActionSetPartialScreen::ActionSetPartialScreen(const Common::String &line) { + char fileName[25]; + uint color; + + sscanf(line.c_str(), "%*[^(](%u %u %25s %*u %u)", &_x, &_y, fileName, &color); + + _fileName = Common::String(fileName); + + if (color > 0xFFFF) { + warning("Background color for ActionSetPartialScreen is bigger than a uint16"); + } + _backgroundColor = color; +} + +bool ActionSetPartialScreen::execute(ZVision *engine) { + RenderManager *renderManager = engine->getRenderManager(); + + if (_backgroundColor > 0) { + renderManager->clearWorkingWindowToColor(_backgroundColor); + } + renderManager->renderImageToScreen(_fileName, _x, _y); + + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionSetScreen ////////////////////////////////////////////////////////////////////////////// @@ -278,8 +308,7 @@ ActionSetScreen::ActionSetScreen(const Common::String &line) { } bool ActionSetScreen::execute(ZVision *engine) { - RenderManager *renderManager = engine->getRenderManager(); - renderManager->setBackgroundImage(_fileName); + engine->getRenderManager()->setBackgroundImage(_fileName); return true; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 1d87b8025c49..5e7c2c63e33d 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -277,6 +277,18 @@ class ActionRandom : public ResultAction { uint _max; }; +class ActionSetPartialScreen : public ResultAction { +public: + ActionSetPartialScreen(const Common::String &line); + bool execute(ZVision *engine); + +private: + uint _x; + uint _y; + Common::String _fileName; + uint16 _backgroundColor; +}; + class ActionSetScreen : public ResultAction { public: ActionSetScreen(const Common::String &line); From 6e427ebef8b29e48b679c7c19ed4b715c7dfaef8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:51:50 -0500 Subject: [PATCH 0609/1332] ZVISION: Create method to play RlfAnimations --- engines/zvision/animation.cpp | 90 +++++++++++++++++++++++++++++++++++ engines/zvision/zvision.h | 3 ++ 2 files changed, 93 insertions(+) create mode 100644 engines/zvision/animation.cpp diff --git a/engines/zvision/animation.cpp b/engines/zvision/animation.cpp new file mode 100644 index 000000000000..7c41c23a06e9 --- /dev/null +++ b/engines/zvision/animation.cpp @@ -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. +* +*/ + +#include "common/scummsys.h" + +#include "common/system.h" + +#include "zvision/zvision.h" +#include "zvision/rlf_animation.h" + + +namespace ZVision { + +void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) { + uint currentFrame = 0; + uint lastFrame = animation->frameCount(); + bool skip = false; + uint32 frameTime = animation->frameTime(); + uint width = animation->width(); + uint height = animation->height(); + + uint16 newX = x + _workingWindow.left; + uint16 newY = y + _workingWindow.top; + + uint32 accumulatedTime = 0; + + // Only continue while the video is still playing + while (!shouldQuit() && !skip && currentFrame < lastFrame) { + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); + accumulatedTime += _clock.getDeltaTime(); + + // Check for engine quit and video stop key presses + while (_eventMan->pollEvent(_event)) { + switch (_event.type) { + case Common::EVENT_KEYDOWN: + switch (_event.kbd.keycode) { + case Common::KEYCODE_q: + if (_event.kbd.hasFlags(Common::KBD_CTRL)) + quitGame(); + break; + case Common::KEYCODE_SPACE: + skip = true; + break; + default: + break; + } + default: + break; + } + } + + if (accumulatedTime >= frameTime) { + accumulatedTime -= frameTime; + + _system->copyRectToScreen(animation->getFrameData(currentFrame), width * sizeof(uint16), newX, newY, width, height); + currentFrame++; + } + + // Always update the screen so the mouse continues to render + _system->updateScreen(); + + // Calculate the frame delay based off a desired frame time + int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 9e9d5db9512b..366e96f6a7f0 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -49,6 +49,7 @@ class Console; class ScriptManager; class RenderManager; class CursorManager; +class RlfAnimation; // our engine debug channels enum { @@ -126,6 +127,8 @@ class ZVision : public Engine { */ void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); + void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + /** * Register a MouseEvent with the event system. These will be checked at every * MOUSE_UP, MOUSE_DOWN, MOUSE_MOVE, etc. From 9294c5eac969967a294abd97982e5baed6507355 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:52:14 -0500 Subject: [PATCH 0610/1332] ZVISION: Initialize inline with construction --- engines/zvision/render_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 6c006d9320fc..ac02cc24d6f1 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -163,8 +163,7 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, int16 de void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, int16 destinationX, int16 destinationY, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ - uint32 fileType; - fileType = stream.readUint32BE(); + uint32 fileType = stream.readUint32BE(); // Check for TGZ files if (fileType == MKTAG('T', 'G', 'Z', '\0')) { From 6c7303995f6fb4eb488ef8a7bba6fc60bc765d04 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:54:17 -0500 Subject: [PATCH 0611/1332] ZVISION: Always update the screen to ensure the mouse continues to render --- engines/zvision/video.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 4066c5dcd539..377b24af2a7b 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -153,11 +153,12 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d } else { _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), pitch, x, y, finalWidth, finalHeight); } - - _system->updateScreen(); } } + // Always update the screen so the mouse continues to render + _system->updateScreen(); + _system->delayMillis(videoDecoder.getTimeToNextFrame()); } From 7dcfa9ef4c849251e32b60f5d3cd609fb0fd2921 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 19 Aug 2013 23:55:36 -0500 Subject: [PATCH 0612/1332] ZVISION: Call RenderManager::update() before ScriptManager::update() This ensures the background will be rendered before anything from Puzzles or Controls --- engines/zvision/zvision.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 080c763342c5..c32e78214faa 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -135,8 +135,10 @@ Common::Error ZVision::run() { processEvents(); - _scriptManager->update(deltaTime); + // Call _renderManager->update() first so the background renders + // before anything that puzzles/controls will render _renderManager->update(deltaTime); + _scriptManager->update(deltaTime); // Update the screen _system->updateScreen(); From 94a55024ac9384747130aa1cd94d4cb36f35e922 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 11:25:58 -0500 Subject: [PATCH 0613/1332] ZVISION: Fix seek() whence argument --- engines/zvision/rlf_animation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index abc31c1d1def..8a087c1cccba 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -54,7 +54,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) // Since we don't need any of the data, we can just seek right to the // entries we need rather than read in all the individual entries. - file.seek(136, file.pos()); + file.seek(136, SEEK_CUR); //// Read CIN header //file.readUint32BE(); // Magic number FNIC @@ -62,13 +62,13 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) //file.readUint32LE(); // Unknown3 //file.readUint32LE(); // Unknown4 //file.readUint32LE(); // Unknown5 - //file.seek(0x18, file.pos()); // VRLE + //file.seek(0x18, SEEK_CUR); // VRLE //file.readUint32LE(); // LRVD //file.readUint32LE(); // Unknown6 - //file.seek(0x18, file.pos()); // HRLE + //file.seek(0x18, SEEK_CUR); // HRLE //file.readUint32LE(); // ELHD //file.readUint32LE(); // Unknown7 - //file.seek(0x18, file.pos()); // HKEY + //file.seek(0x18, SEEK_CUR); // HKEY //file.readUint32LE(); // ELRH //// Read MIN info header From 4bd7951840b7e995b4857ee6ee1c6288668cd66f Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 11:30:52 -0500 Subject: [PATCH 0614/1332] ZVISION: Normalize comment alignment --- engines/zvision/rlf_animation.cpp | 72 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 8a087c1cccba..c072aaf053c3 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -47,56 +47,56 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) } // Read the header - file.readUint32LE(); // Size1 - file.readUint32LE(); // Unknown1 - file.readUint32LE(); // Unknown2 - _frameCount = file.readUint32LE(); // Frame count + file.readUint32LE(); // Size1 + file.readUint32LE(); // Unknown1 + file.readUint32LE(); // Unknown2 + _frameCount = file.readUint32LE(); // Frame count // Since we don't need any of the data, we can just seek right to the // entries we need rather than read in all the individual entries. file.seek(136, SEEK_CUR); //// Read CIN header - //file.readUint32BE(); // Magic number FNIC - //file.readUint32LE(); // Size2 - //file.readUint32LE(); // Unknown3 - //file.readUint32LE(); // Unknown4 - //file.readUint32LE(); // Unknown5 - //file.seek(0x18, SEEK_CUR); // VRLE - //file.readUint32LE(); // LRVD - //file.readUint32LE(); // Unknown6 - //file.seek(0x18, SEEK_CUR); // HRLE - //file.readUint32LE(); // ELHD - //file.readUint32LE(); // Unknown7 - //file.seek(0x18, SEEK_CUR); // HKEY - //file.readUint32LE(); // ELRH + //file.readUint32BE(); // Magic number FNIC + //file.readUint32LE(); // Size2 + //file.readUint32LE(); // Unknown3 + //file.readUint32LE(); // Unknown4 + //file.readUint32LE(); // Unknown5 + //file.seek(0x18, SEEK_CUR); // VRLE + //file.readUint32LE(); // LRVD + //file.readUint32LE(); // Unknown6 + //file.seek(0x18, SEEK_CUR); // HRLE + //file.readUint32LE(); // ELHD + //file.readUint32LE(); // Unknown7 + //file.seek(0x18, SEEK_CUR); // HKEY + //file.readUint32LE(); // ELRH //// Read MIN info header - //file.readUint32BE(); // Magic number FNIM - //file.readUint32LE(); // Size3 - //file.readUint32LE(); // OEDV - //file.readUint32LE(); // Unknown8 - //file.readUint32LE(); // Unknown9 - //file.readUint32LE(); // Unknown10 - _width = file.readUint32LE(); // Width - _height = file.readUint32LE(); // Height + //file.readUint32BE(); // Magic number FNIM + //file.readUint32LE(); // Size3 + //file.readUint32LE(); // OEDV + //file.readUint32LE(); // Unknown8 + //file.readUint32LE(); // Unknown9 + //file.readUint32LE(); // Unknown10 + _width = file.readUint32LE(); // Width + _height = file.readUint32LE(); // Height // Read time header - file.readUint32BE(); // Magic number EMIT - file.readUint32LE(); // Size4 - file.readUint32LE(); // Unknown11 - _frameTime = file.readUint32LE() / 10; // Frame time in microseconds + file.readUint32BE(); // Magic number EMIT + file.readUint32LE(); // Size4 + file.readUint32LE(); // Unknown11 + _frameTime = file.readUint32LE() / 10; // Frame time in microseconds // Read in each frame _frames = new uint16 *[_frameCount]; for (uint i = 0; i < _frameCount; i++) { - file.readUint32BE(); // Magic number MARF - uint32 size = file.readUint32LE(); // Size - file.readUint32LE(); // Unknown1 - file.readUint32LE(); // Unknown2 - uint32 type = file.readUint32BE(); // Either ELHD or ELRH - uint32 offset = file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 - file.readUint32LE(); // Unknown3 + file.readUint32BE(); // Magic number MARF + uint32 size = file.readUint32LE(); // Size + file.readUint32LE(); // Unknown1 + file.readUint32LE(); // Unknown2 + uint32 type = file.readUint32BE(); // Either ELHD or ELRH + uint32 headerSize = file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 + file.readUint32LE(); // Unknown3 int8 *buffer = new int8[size - headerSize]; file.read(buffer, size - headerSize); From 6f080b3631c8dc111bc6775877b58a9e5d783565 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 11:34:37 -0500 Subject: [PATCH 0615/1332] ZVISION: Create keypress event to test rlf animation --- engines/zvision/events.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index f382bb63e0af..798d75b37526 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -33,6 +33,7 @@ #include "zvision/render_manager.h" #include "zvision/script_manager.h" #include "zvision/mouse_event.h" +#include "zvision/rlf_animation.h" namespace ZVision { @@ -95,6 +96,12 @@ void ZVision::processEvents() { case Common::KEYCODE_F1: cycleThroughCursors(); break; + case Common::KEYCODE_F2: + { + RlfAnimation *animation = new RlfAnimation("te2ea21c.rlf"); + playAnimation(animation, 0, 0); + break; + } default: break; } From 610b563790ded5c43f757675a9acdc49ce555a1d Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 11:55:08 -0500 Subject: [PATCH 0616/1332] ZVISION: Convert abs() to ABS() to ensure portability --- engines/zvision/rlf_animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index c072aaf053c3..26ce2e217c83 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -141,7 +141,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 // If numberOfSamples is negative, the next abs(numberOfSamples) samples should // be copied directly from source to dest if (numberOfSamples < 0) { - numberOfSamples = abs(numberOfSamples); + numberOfSamples = ABS(numberOfSamples); while (numberOfSamples > 0) { if (sourceOffset + 1 >= sourceSize) { @@ -184,7 +184,7 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 // If numberOfSamples is negative, the next abs(numberOfSamples) samples should // be copied directly from source to dest if (numberOfSamples < 0) { - numberOfSamples = abs(numberOfSamples); + numberOfSamples = ABS(numberOfSamples); while (numberOfSamples > 0) { if (sourceOffset + 1 >= sourceSize) { From aab393077942224a5f376846582f7cd987366f75 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 20 Aug 2013 19:23:24 +0200 Subject: [PATCH 0617/1332] AVALANCHE: Implement loading from the Launcher. Upgrade saveGame(), loadGame() in, add expandDate() to AvalancheEngine. Revise Avalot::setup(). Repair Lucerna::load() and triptype::init(). --- engines/avalanche/avalanche.cpp | 69 +++++++++++++++++++++++++++++---- engines/avalanche/avalanche.h | 2 + engines/avalanche/avalot.cpp | 59 +++++++++++++--------------- engines/avalanche/detection.cpp | 2 +- engines/avalanche/lucerna2.cpp | 20 +++++----- engines/avalanche/trip6.cpp | 3 +- 6 files changed, 105 insertions(+), 50 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 8e4577a09317..e714f0b5f640 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -108,7 +108,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _lucerna->init(); _acci->init(); _basher->init(); - return Common::kNoError; } @@ -337,10 +336,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face); } - - - - //groi = 177; //blockwrite(f, groi, 1); @@ -380,6 +375,12 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { f->write(desc.c_str(), desc.size()); + TimeDate t; + _system->getTimeAndDate(t); + f->writeSint16LE(t.tm_mday); + f->writeSint16LE(t.tm_mon); + f->writeSint16LE(t.tm_year); + Common::Serializer sz(NULL, f); synchronize(sz); @@ -423,9 +424,19 @@ bool AvalancheEngine::loadGame(const int16 slot) { if (signature != "AVAL") return false; - // We dont care about the description here. + // Read the description. uint32 descSize = f->readUint32LE(); - f->skip(descSize); + Common::String description; + for (uint32 i = 0; i < descSize; i++) { + char actChar = f->readByte(); + description += actChar; + } + description.toUppercase(); + + TimeDate t; + t.tm_mday = f->readSint16LE(); + t.tm_mon = f->readSint16LE(); + t.tm_year = f->readSint16LE(); Common::Serializer sz(f, NULL); @@ -444,6 +455,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->minor_redraw(); + _dropdown->standard_bar(); + _gyro->whereis[0] = _gyro->dna.room; _gyro->alive = true; @@ -454,9 +467,49 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->showrw(); + _gyro->ontoolbar = false; + _trip->trippancy_link(); + + _celer->pics_link(); + + _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine + + _gyro->roomname + _scrolls->kControlNewLine + _scrolls->kControlNewLine + + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); + + if (_trip->tr[0].quick && _trip->tr[0].visible) + _trip->rwsp(0, _gyro->dna.rw); + return true; } +Common::String AvalancheEngine::expandDate(int d, int m, int y) { + const Common::String months[12] = { + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + }; + + Common::String month = months[m]; + + Common::String day = _gyro->strf(d); + + if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) + switch (d % 10) { + case 1: + day = day + "st"; + break; + case 2: + day = day + "nd"; + break; + case 3: + day = day + "rd"; + break; + default: + day = day + "th"; + } + + return day + ' ' + month + ' ' + _gyro->strf(y + 1900); +} + void AvalancheEngine::updateEvents() { @@ -620,7 +673,7 @@ Common::Error AvalancheEngine::run() { if (err != Common::kNoError) return err; - + // From bootstrp: diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 52472b612877..6b62ad7886c6 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -127,6 +127,8 @@ class AvalancheEngine : public Engine { virtual bool canLoadGameStateCurrently(); Common::Error loadGameState(int slot); bool loadGame(const int16 slot); + Common::String expandDate(int d, int m, int y); + void updateEvents(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3069c8aef936..9cf66606ab38 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -50,6 +50,7 @@ #include "common/str.h" #include "common/textconsole.h" +#include "common/config-manager.h" @@ -167,7 +168,6 @@ void Avalot::setup() { _vm->_gyro->enid_filename = ""; /* undefined. */ _vm->_lucerna->toolbar(); _vm->_scrolls->state(2); - _vm->_graphics->refreshScreen(); //_vm->_pingo->copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality. for (byte i = 0; i < 3; i++) _vm->_gyro->lastscore[i] = -1; /* impossible digits */ @@ -178,35 +178,6 @@ void Avalot::setup() { _vm->_trip->loadtrip(); - _vm->_gyro->reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game. - - if ((_vm->_gyro->filetoload.empty()) && (! _vm->_gyro->reloaded)) - _vm->_gyro->newgame(); /* no game was requested- load the default */ - else { - if (! _vm->_gyro->reloaded) - _vm->_enid->avvy_background(); - _vm->_dropdown->standard_bar(); - _vm->_lucerna->sprite_run(); - if (_vm->_gyro->reloaded) - _vm->_enid->edna_reload(); - else { - /* Filename given on the command line (or loadfirst) */ - _vm->_enid->edna_load(_vm->_gyro->filetoload); - if (_vm->_enid->there_was_a_problem()) { - _vm->_scrolls->display("So let's start from the beginning instead..."); - _vm->_gyro->holdthedawn = true; - _vm->_lucerna->dusk(); - _vm->_gyro->newgame(); - } - } - } - - if (! _vm->_gyro->reloaded) { - _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; - _vm->_lucerna->fxtoggle(); - _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); - } - _vm->_trip->get_back_loretta(); //gm = getpixel(0: 0); //setcolor(7); @@ -216,13 +187,34 @@ void Avalot::setup() { _vm->_parser->cursorOn(); _vm->_trip->newspeed(); - if (! _vm->_gyro->reloaded) + + + int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); + if (loadSlot >= 0) { + _vm->loadGame(loadSlot); + + _vm->_gyro->reloaded = true; + } else + _vm->_gyro->reloaded = false; + + + + if (!_vm->_gyro->reloaded) { + _vm->_gyro->newgame(); // No game was requested- load the default. + + _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; + _vm->_lucerna->fxtoggle(); + _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); + _vm->_visa->dixi('q', 83); // Info on the game, etc. + } } void Avalot::run(Common::String arg) { setup(); + + do { uint32 beginLoop = _vm->_system->getMillis(); @@ -249,6 +241,11 @@ void Avalot::run(Common::String arg) { if (delay <= 55) _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). + + + + + } while (! _vm->_gyro->lmo); //restorecrtmode(); diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index fb68e2ec670d..a81e9a3b5f5d 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -96,7 +96,7 @@ bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const A } bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { - return (f == kSupportsListSaves) || (f == kSupportsDeleteSave); + return (f == kSupportsListSaves) || (f == kSupportsDeleteSave) || (f == kSupportsLoadingDuringStartup); } SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 797dabd39820..3fcb1acf7794 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -229,8 +229,13 @@ void Lucerna::load(byte n) { /* Load2, actually */ } f.seek(146); - for (byte i = 0; i < 30; i++) - _vm->_gyro->roomname += f.readByte(); + if (!_vm->_gyro->roomname.empty()) + _vm->_gyro->roomname.clear(); + for (byte i = 0; i < 30; i++) { + char actChar = f.readByte(); + if ((32 <= actChar) && (actChar <= 126)) + _vm->_gyro->roomname += actChar; + } /* Compression method byte follows this... */ f.seek(177); @@ -254,16 +259,13 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); - _vm->_graphics->refreshScreen(); - f.close(); load_also(xx); - _vm->_celer->load_chunks(xx); - _vm->_graphics->refreshScreen(); // _vm->_pingo->copy03(); - See Avalot::setup() + _vm->_celer->load_chunks(xx); bit = *_vm->_graphics->getPixel(0,0); @@ -948,11 +950,11 @@ void Lucerna::fxtoggle() { void Lucerna::objectlist() { _vm->_gyro->dna.carrying = 0; - if (_vm->_gyro->thinkthing && ! _vm->_gyro->dna.obj[_vm->_gyro->thinks]) + if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks]) thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); /* you always have money */ - for (byte fv = 0; fv < numobjs; fv ++) + for (byte fv = 0; fv < numobjs; fv++) if (_vm->_gyro->dna.obj[fv]) { - _vm->_gyro->dna.carrying ++; + _vm->_gyro->dna.carrying++; _vm->_gyro->objlist[_vm->_gyro->dna.carrying] = fv + 1; } } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index d4573a0851ca..54312ce773b5 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -79,7 +79,8 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { inf.skip(2); // Replace variable named 'soa' in the original code. - //inf.skip(1); // We don't need to read the size of the string as in the original code. + if (!a.name.empty()) + a.name.clear(); byte nameSize = inf.readByte(); for (byte i = 0; i < nameSize; i++) a.name += inf.readByte(); From f8796e720eea8122bf7ecef7f1dcd75c39b75a97 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 20 Aug 2013 21:26:23 +0200 Subject: [PATCH 0618/1332] AVALANCHE: Add thumbnail support and version tracking to the saving/loading system. Repair Trip::trippancy_link(). --- engines/avalanche/avalanche.cpp | 24 ++++++++--- engines/avalanche/detection.cpp | 73 +++++++++++++++++++++++++++++---- engines/avalanche/trip6.cpp | 2 +- 3 files changed, 84 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index e714f0b5f640..8c893176e8b6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -39,6 +39,7 @@ #include "engines/util.h" #include "gui/saveload.h" +#include "graphics/thumbnail.h" namespace Avalanche { @@ -361,19 +362,20 @@ Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &des bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { Common::String fileName = getSaveFileName(slot); Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName); - if (!f) { warning("Can't create file '%s', game not saved.", fileName.c_str()); return false; } char *signature = "AVAL"; - f->write(signature, 4); - f->writeUint32LE(desc.size()); + // Write version. We can't restore from obsolete versions. + f->writeByte(kSavegameVersion); + f->writeUint32LE(desc.size()); f->write(desc.c_str(), desc.size()); + ::Graphics::saveThumbnail(*f); TimeDate t; _system->getTimeAndDate(t); @@ -413,10 +415,9 @@ Common::Error AvalancheEngine::loadGameState(int slot) { bool AvalancheEngine::loadGame(const int16 slot) { Common::String fileName = getSaveFileName(slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); - if (!f) return false; - + // Check for our signature. Common::String signature; for (byte i = 0; i < 4; i++) @@ -424,6 +425,14 @@ bool AvalancheEngine::loadGame(const int16 slot) { if (signature != "AVAL") return false; + // Check version. We can't restore from obsolete versions. + byte saveVersion = f->readByte(); + if (saveVersion != kSavegameVersion) { + warning("Savegame of incompatible version!"); + delete f; + return false; + } + // Read the description. uint32 descSize = f->readUint32LE(); Common::String description; @@ -433,6 +442,9 @@ bool AvalancheEngine::loadGame(const int16 slot) { } description.toUppercase(); + ::Graphics::skipThumbnail(*f); + + // Read the time the game was saved. TimeDate t; t.tm_mday = f->readSint16LE(); t.tm_mon = f->readSint16LE(); @@ -478,7 +490,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); if (_trip->tr[0].quick && _trip->tr[0].visible) - _trip->rwsp(0, _gyro->dna.rw); + _trip->rwsp(0, _gyro->dna.rw); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index a81e9a3b5f5d..39c6f0836f15 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -87,6 +87,7 @@ class AvalancheMetaEngine : public AdvancedMetaEngine { int getMaximumSaveSlot() const { return 99; } SaveStateList listSaves(const char *target) const; void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { @@ -96,7 +97,12 @@ bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const A } bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { - return (f == kSupportsListSaves) || (f == kSupportsDeleteSave) || (f == kSupportsLoadingDuringStartup); + return + (f == kSupportsListSaves) || + (f == kSupportsDeleteSave) || + (f == kSupportsLoadingDuringStartup) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); } SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { @@ -121,16 +127,25 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { Common::InSaveFile *file = saveFileMan->openForLoading(*filename); if (file) { - /*int saveVersion = file->readByte(); + // Check for our signature. + Common::String signature; + for (byte i = 0; i < 4; i++) + signature += file->readByte(); + if (signature != "AVAL") { + warning("Savegame of incompatible type!"); + delete file; + continue; + } + // Check version. + byte saveVersion = file->readByte(); if (saveVersion != kSavegameVersion) { - warning("Savegame of incompatible version"); - delete file; - continue; - }*/ + warning("Savegame of incompatible version!"); + delete file; + continue; + } - // Read name - file->seek(4); // We skip the "AVAL" signature. + // Read name. uint32 nameSize = file->readUint32LE(); if (nameSize >= 255) { delete file; @@ -155,6 +170,48 @@ void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(fileName); } +SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); + + if (f) { + // Check for our signature. + Common::String signature; + for (byte i = 0; i < 4; i++) + signature += f->readByte(); + if (signature != "AVAL") { + warning("Savegame of incompatible type!"); + delete f; + return SaveStateDescriptor(); + } + + // Check version. + byte saveVersion = f->readByte(); + if (saveVersion != kSavegameVersion) { + warning("Savegame of incompatible version!"); + delete f; + return SaveStateDescriptor(); + } + + // Read the description. + uint32 descSize = f->readUint32LE(); + Common::String description; + for (uint32 i = 0; i < descSize; i++) { + char actChar = f->readByte(); + description += actChar; + } + + SaveStateDescriptor desc(slot, description); + + ::Graphics::Surface *const thumbnail = ::Graphics::loadThumbnail(*f); + desc.setThumbnail(thumbnail); + + delete f; + return desc; + } + return SaveStateDescriptor(); +} + } // End of namespace Avalanche #if PLUGIN_ENABLED_DYNAMIC(AVALANCHE) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 54312ce773b5..000947773857 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1415,7 +1415,7 @@ void Trip::trippancy_link() { if (_vm->_gyro->ddmnow | _vm->_gyro->ontoolbar | _vm->_gyro->seescroll) return; for (fv = 0; fv < numtr; fv++) { - if (tr[fv].quick) + if (tr[fv].quick && tr[fv].visible) tr[fv].walk(); } From 9af92b8723bdba3b9e540d9e0ba3a9142bc2e480 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 15:55:42 -0500 Subject: [PATCH 0619/1332] ZVISION: Handle rlf frame transitions internally Animations use incremental frame changes. That is, only a few frames are complete (I-frames), the rest are just the pixels that change between the current frame and both the previous frame and the next frame (B-frames). See https://en.wikipedia.org/wiki/Video_compression_picture_types --- engines/zvision/animation.cpp | 9 ++-- engines/zvision/rlf_animation.cpp | 86 ++++++++++++++++++++++++------- engines/zvision/rlf_animation.h | 24 ++++++++- 3 files changed, 93 insertions(+), 26 deletions(-) diff --git a/engines/zvision/animation.cpp b/engines/zvision/animation.cpp index 7c41c23a06e9..8ca892dfdabd 100644 --- a/engines/zvision/animation.cpp +++ b/engines/zvision/animation.cpp @@ -31,8 +31,6 @@ namespace ZVision { void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) { - uint currentFrame = 0; - uint lastFrame = animation->frameCount(); bool skip = false; uint32 frameTime = animation->frameTime(); uint width = animation->width(); @@ -44,7 +42,7 @@ void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, Dispose uint32 accumulatedTime = 0; // Only continue while the video is still playing - while (!shouldQuit() && !skip && currentFrame < lastFrame) { + while (!shouldQuit() && !skip && !animation->endOfAnimation()) { _clock.update(); uint32 currentTime = _clock.getLastMeasuredTime(); accumulatedTime += _clock.getDeltaTime(); @@ -69,11 +67,10 @@ void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, Dispose } } - if (accumulatedTime >= frameTime) { + while (accumulatedTime >= frameTime && !animation->endOfAnimation()) { accumulatedTime -= frameTime; - _system->copyRectToScreen(animation->getFrameData(currentFrame), width * sizeof(uint16), newX, newY, width, height); - currentFrame++; + _system->copyRectToScreen(animation->getNextFrame(), width * sizeof(uint16), newX, newY, width, height); } // Always update the screen so the mouse continues to render diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 26ce2e217c83..90086e9bd00c 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -34,7 +34,14 @@ namespace ZVision { RlfAnimation::RlfAnimation(const Common::String &fileName) - : _frames(0) { + : _frameCount(0), + _width(0), + _height(0), + _frameTime(0), + _frames(0), + _currentFrameBuffer(0), + _currentFrame(-1), + _frameBufferByteSize(0) { Common::File file; if (!file.open(fileName)) { warning("RLF animation file %s could not be opened", fileName.c_str()); @@ -87,8 +94,11 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) file.readUint32LE(); // Unknown11 _frameTime = file.readUint32LE() / 10; // Frame time in microseconds + _frames = new Frame[_frameCount]; + _currentFrameBuffer = new uint16[_width * _height]; + _frameBufferByteSize = _width * _height * sizeof(uint16); + // Read in each frame - _frames = new uint16 *[_frameCount]; for (uint i = 0; i < _frameCount; i++) { file.readUint32BE(); // Magic number MARF uint32 size = file.readUint32LE(); // Size @@ -98,27 +108,19 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) uint32 headerSize = file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 file.readUint32LE(); // Unknown3 - int8 *buffer = new int8[size - headerSize]; - file.read(buffer, size - headerSize); - - _frames[i] = new uint16[_width * _height]; - uint frameByteSize = _width * _height * sizeof(uint16); - memset(_frames[i], 0x7C00, frameByteSize); - // Decode the data - debug("Decoding frame %u", i); + _frames[i].encodedSize = size - headerSize; + _frames[i].encodedData = new int8[_frames[i].encodedSize]; + file.read(_frames[i].encodedData, _frames[i].encodedSize); + if (type == MKTAG('E', 'L', 'H', 'D')) { - debug("Decoding with masked RLE"); - decodeMaskedRunLengthEncoding(buffer, (int8 *)_frames[i], size - headerSize, frameByteSize); + _frames[i].type = Masked; } else if (type == MKTAG('E', 'L', 'R', 'H')) { - debug("Decoding with simple RLE"); - decodeSimpleRunLengthEncoding(buffer, (int8 *)_frames[i], size - headerSize, frameByteSize); + _frames[i].type = Simple; + _completeFrames.push_back(i); } else { warning("Frame %u of %s doesn't have type that can be decoded", i, fileName.c_str()); return; } - - // Cleanup - delete[] buffer; } }; @@ -126,9 +128,58 @@ RlfAnimation::~RlfAnimation() { if (_frames != 0) { delete[] _frames; } + if (_currentFrameBuffer != 0) { + delete[] _currentFrameBuffer; + } +} + +const uint16 *RlfAnimation::getFrameData(uint frameNumber) { + assert(frameNumber < _frameCount && frameNumber >= 0); + + if (frameNumber == _currentFrame) { + return _currentFrameBuffer; + } + + uint closestFrame = _currentFrame; + uint distance = ABS(_currentFrame - frameNumber); + for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { + uint newDistance = ABS((*iter) - frameNumber); + if (closestFrame == -1 || newDistance < distance) { + closestFrame = (*iter); + distance = newDistance; + } + } + + bool forwards = frameNumber > closestFrame; + if (forwards) { + for (uint i = closestFrame; i <= frameNumber; i++) { + applyFrameToCurrent(i); + } + } else { + for (uint i = closestFrame; i >= frameNumber; i--) { + applyFrameToCurrent(i); + } + } + + return _currentFrameBuffer; } +const uint16 *RlfAnimation::getNextFrame() { + assert(_currentFrame + 1 < _frameCount); + applyFrameToCurrent(_currentFrame + 1); + return _currentFrameBuffer; +} + +void RlfAnimation::applyFrameToCurrent(uint frameNumber) { + if (_frames[frameNumber].type == Masked) { + decodeMaskedRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); + } else if (_frames[frameNumber].type == Simple) { + decodeSimpleRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); + } + + _currentFrame = frameNumber; +} void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const { uint32 sourceOffset = 0; @@ -226,5 +277,4 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 } } - } // End of namespace ZVision diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 7ece4e506319..e204a500908f 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -36,21 +36,41 @@ class RlfAnimation { ~RlfAnimation(); private: + enum EncodingType { + Masked, + Simple + }; + + struct Frame { + EncodingType type; + int8 *encodedData; + uint32 encodedSize; + }; + private: uint _frameCount; uint _width; uint _height; uint32 _frameTime; // In milliseconds - uint16 **_frames; + Frame *_frames; + Common::List _completeFrames; + + int _currentFrame; + uint16 *_currentFrameBuffer; + uint32 _frameBufferByteSize; public: uint frameCount() { return _frameCount; } uint width() { return _width; } uint height() { return _height; } uint32 frameTime() { return _frameTime; } - const uint16 *getFrameData(uint frameNumber) const { return _frames[frameNumber]; } + const uint16 *getFrameData(uint frameNumber); + const uint16 *getNextFrame(); + bool endOfAnimation() { return _currentFrame == _frameCount - 1; } private: + void applyFrameToCurrent(uint frameNumber); + void decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; void decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; }; From cf8a8df776a28d5c4474848448b231d55b0c0c71 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:28:00 -0500 Subject: [PATCH 0620/1332] ZVISION: Remove superfluous file --- engines/zvision/tests.h | 54 ----------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 engines/zvision/tests.h diff --git a/engines/zvision/tests.h b/engines/zvision/tests.h deleted file mode 100644 index 14f80ed83be7..000000000000 --- a/engines/zvision/tests.h +++ /dev/null @@ -1,54 +0,0 @@ - -namespace ZVision { - -void tests() { -#if 0 - // Video test - Video::VideoDecoder *videoDecoder = new ZorkAVIDecoder(); - if (videoDecoder && videoDecoder->loadFile("zassets/temple/t000a11c.avi")) { - Common::List formats; - formats.push_back(videoDecoder->getPixelFormat()); - //initGraphics(640, 480, true, formats); - - playVideo(videoDecoder); - } -#endif - - Common::File f; - -#if 1 - // Image test - - //initGraphics(640, 480, true, &format); - - if (f.open(" zassets/global/GJDEB11C.TGA")) { - Graphics::TGADecoder tga; - if (!tga.loadStream(f)) - error("Error while reading TGA image"); - f.close(); - - const Graphics::Surface *tgaSurface = tga.getSurface(); - - Graphics::Surface *screen = g_system->lockScreen(); - for (uint16 y = 0; y < tgaSurface->h; y++) - memcpy(screen->getBasePtr(0, y), tgaSurface->getBasePtr(0, y), tgaSurface->pitch); - g_system->unlockScreen(); - - tga.destroy(); - } - - -#endif - -#if 0 - // Sound test - if (f.open("zassets/castle/c000h9tc.raw")) { - Audio::SeekableAudioStream *audioStream = makeRawZorkStream(&f, 22050, DisposeAfterUse::YES); - Audio::SoundHandle handle; - g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); - } - -#endif -} - -} // End of namespace ZVision From 1251da96e22e56c13c81e4fa6f08efe99cbcbbb3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:28:36 -0500 Subject: [PATCH 0621/1332] ZVISION: Add animation.o and rlf_animation.o to module.mk --- engines/zvision/module.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index f072520d1616..317e4b11d454 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -3,6 +3,7 @@ MODULE := engines/zvision MODULE_OBJS := \ action_node.o \ actions.o \ + animation.o \ clock.o \ console.o \ control.o \ @@ -14,6 +15,7 @@ MODULE_OBJS := \ mouse_event.o \ render_manager.o \ render_table.o \ + rlf_animation.o \ scr_file_handling.o \ script_manager.o \ scripts.o \ From aba3ba634cbadd6f245580171322fa5debc6ffd3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:29:28 -0500 Subject: [PATCH 0622/1332] ZVISION: Add TODO's of what is left for the engine to be complete --- engines/zvision/control.h | 10 ++++ engines/zvision/inventory_manager.h | 28 +++++++++ engines/zvision/menu.h | 28 +++++++++ engines/zvision/save_manager.h | 28 +++++++++ engines/zvision/scr_file_handling.cpp | 84 +++++++++------------------ engines/zvision/subtitles.h | 29 +++++++++ 6 files changed, 151 insertions(+), 56 deletions(-) create mode 100644 engines/zvision/inventory_manager.h create mode 100644 engines/zvision/menu.h create mode 100644 engines/zvision/save_manager.h create mode 100644 engines/zvision/subtitles.h diff --git a/engines/zvision/control.h b/engines/zvision/control.h index f17ee7750d1d..e3cb0d4afa69 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -66,6 +66,16 @@ class PushToggleControl : public Control { MouseEvent _event; }; +// TODO: Implement InputControl +// TODO: Implement SaveControl +// TODO: Implement SlotControl +// TODO: Implement LeverControl +// TODO: Implement SafeControl +// TODO: Implement FistControl +// TODO: Implement HotMovieControl +// TODO: Implement PaintControl +// TODO: Implement TilterControl + } // End of namespace ZVision #endif diff --git a/engines/zvision/inventory_manager.h b/engines/zvision/inventory_manager.h new file mode 100644 index 000000000000..ae6d116b1888 --- /dev/null +++ b/engines/zvision/inventory_manager.h @@ -0,0 +1,28 @@ +/* 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 ZVISION_INVENTORY_MANAGER_H +#define ZVISION_INVENTORY_MANAGER_H + +// TODO: Implement InventoryManager + +#endif diff --git a/engines/zvision/menu.h b/engines/zvision/menu.h new file mode 100644 index 000000000000..affc69abd5c6 --- /dev/null +++ b/engines/zvision/menu.h @@ -0,0 +1,28 @@ +/* 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 ZVISION_MENU_H +#define ZVISION_MENU_H + +// TODO: Implement MenuHandler + +#endif diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h new file mode 100644 index 000000000000..487cf203fba1 --- /dev/null +++ b/engines/zvision/save_manager.h @@ -0,0 +1,28 @@ +/* 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 ZVISION_SAVE_MANAGER_H +#define ZVISION_SAVE_MANAGER_H + +// TODO: Implement SaveManager + +#endif diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index eb15d0407097..f4d4563c63df 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -164,103 +164,75 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:animunload*", true)) { //actionList.push_back(new ActionUnloadAnimation(line)); } else if (line.matchString("*:attenuate*", true)) { - - + // TODO: Implement ActionAttenuate } else if (line.matchString("*:assign*", true)) { - - + // TODO: Implement ActionAssign } else if (line.matchString("*:change_location*", true)) { actionList.push_back(new ActionChangeLocation(line)); } else if (line.matchString("*:crossfade*", true)) { - - + // TODO: Implement ActionCrossfade } else if (line.matchString("*:debug*", true)) { - - + // TODO: Implement ActionDebug } else if (line.matchString("*:delay_render*", true)) { - - + // TODO: Implement ActionDelayRender } else if (line.matchString("*:disable_control*", true)) { actionList.push_back(new ActionDisableControl(line)); } else if (line.matchString("*:disable_venus*", true)) { - - + // TODO: Implement ActionDisableVenus } else if (line.matchString("*:display_message*", true)) { - - + // TODO: Implement ActionDisplayMessage } else if (line.matchString("*:dissolve*", true)) { - - + // TODO: Implement ActionDissolve } else if (line.matchString("*:distort*", true)) { - - + // TODO: Implement ActionDistort } else if (line.matchString("*:enable_control*", true)) { actionList.push_back(new ActionEnableControl(line)); } else if (line.matchString("*:flush_mouse_events*", true)) { - - + // TODO: Implement ActionFlushMouseEvents } else if (line.matchString("*:inventory*", true)) { - - + // TODO: Implement ActionInventory } else if (line.matchString("*:kill*", true)) { - - + // TODO: Implement ActionKill } else if (line.matchString("*:menu_bar_enable*", true)) { - - + // TODO: Implement ActionMenuBarEnable } else if (line.matchString("*:music*", true)) { actionList.push_back(new ActionMusic(line)); } else if (line.matchString("*:pan_track*", true)) { - - + // TODO: Implement ActionPanTrack } else if (line.matchString("*:playpreload*", true)) { - - + // TODO: Implement ActionPlayPreload } else if (line.matchString("*:preferences*", true)) { - - + // TODO: Implement ActionPreferences } else if (line.matchString("*:quit*", true)) { actionList.push_back(new ActionQuit()); } else if (line.matchString("*:random*", true)) { - - + // TODO: Implement ActionRandom } else if (line.matchString("*:region*", true)) { - - + // TODO: Implement ActionRegion } else if (line.matchString("*:restore_game*", true)) { - - + // TODO: Implement ActionRestoreGame } else if (line.matchString("*:rotate_to*", true)) { - - + // TODO: Implement ActionRotateTo } else if (line.matchString("*:save_game*", true)) { - - + // TODO: Implement ActionSaveGame } else if (line.matchString("*:set_partial_screen*", true)) { - - + actionList.push_back(new ActionSetPartialScreen(line)); } else if (line.matchString("*:set_screen*", true)) { actionList.push_back(new ActionSetScreen(line)); } else if (line.matchString("*:set_venus*", true)) { - - + // TODO: Implement ActionSetVenus } else if (line.matchString("*:stop*", true)) { - - + // TODO: Implement ActionStop } else if (line.matchString("*:streamvideo*", true)) { actionList.push_back(new ActionStreamVideo(line)); } else if (line.matchString("*:syncsound*", true)) { - - + // TODO: Implement ActionSyncSound } else if (line.matchString("*:timer*", true)) { - - + // TODO: Implement ActionTimer } else if (line.matchString("*:ttytext*", true)) { - - + // TODO: Implement ActionTTYText } else if (line.matchString("*:universe_music*", true)) { - - + // TODO: Implement ActionUniverseMusic } else if (line.matchString("*:copy_file*", true)) { // Not used. Purposely left empty } else { diff --git a/engines/zvision/subtitles.h b/engines/zvision/subtitles.h new file mode 100644 index 000000000000..00eeef2a8afa --- /dev/null +++ b/engines/zvision/subtitles.h @@ -0,0 +1,29 @@ +/* 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 ZVISION_SUBTITLES_H +#define ZVISION_SUBTITLES_H + +// Implement Subtitles + +#endif \ No newline at end of file From ad5756fa31113b88fb486c679adfe2197daeca08 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:48:34 -0500 Subject: [PATCH 0623/1332] ZVISION: Add a destructor to Puzzle --- engines/zvision/puzzle.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 227183ab0283..371af83d91e4 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -27,11 +27,17 @@ #include "common/list.h" #include "common/ptr.h" -namespace ZVision { +#include "zvision/actions.h" -class ResultAction; +namespace ZVision { struct Puzzle { + ~Puzzle() { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + delete (*iter); + } + } + /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, From 35622827f8e8b507e6c2450773857975f2864a56 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:50:14 -0500 Subject: [PATCH 0624/1332] ZVISION: Store the Puzzles in _activePuzzles and _globalPuzzles on the heap This allows List::push_back() to not cause a data copy --- engines/zvision/scr_file_handling.cpp | 12 ++++----- engines/zvision/script_manager.cpp | 37 +++++++++++++++++---------- engines/zvision/script_manager.h | 7 ++--- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index f4d4563c63df..7ccd939e549d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -52,8 +52,8 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) continue; if (line.matchString("puzzle:*", true)) { - Puzzle puzzle; - sscanf(line.c_str(),"puzzle:%u",&(puzzle.key)); + Puzzle *puzzle = new Puzzle(); + sscanf(line.c_str(),"puzzle:%u",&(puzzle->key)); parsePuzzle(puzzle, file); if (isGlobal) { @@ -67,17 +67,17 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) } } -void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream) { +void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream) { Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); while (!stream.eos() && !line.contains('}')) { if (line.matchString("criteria {", true)) { - parseCriteria(stream, puzzle.criteriaList); + parseCriteria(stream, puzzle->criteriaList); } else if (line.matchString("results {", true)) { - parseResults(stream, puzzle.resultActions); + parseResults(stream, puzzle->resultActions); } else if (line.matchString("flags {", true)) { - puzzle.flags = parseFlags(stream); + puzzle->flags = parseFlags(stream); } line = stream.readLine(); diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 6a1794dabf57..390fe0d74273 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -41,6 +41,15 @@ ScriptManager::ScriptManager(ZVision *engine) _changeLocation(false) { } +ScriptManager::~ScriptManager() { + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + delete (*iter); + } + for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + delete (*iter); + } +} + void ScriptManager::initialize() { parseScrFile("universe.scr", true); changeLocation('g', 'a', 'r', 'y', 0); @@ -58,11 +67,11 @@ void ScriptManager::update(uint deltaTimeMillis) { void ScriptManager::createReferenceTable() { // Iterate through each local Puzzle - for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { - Puzzle *puzzlePtr = &(*activePuzzleIter); + for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { + Puzzle *puzzlePtr = (*activePuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle - for (Common::List >::iterator criteriaIter = activePuzzleIter->criteriaList.begin(); criteriaIter != (*activePuzzleIter).criteriaList.end(); criteriaIter++) { + for (Common::List >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); criteriaIter++) { for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { _referenceTable[entryIter->key].push_back(puzzlePtr); @@ -75,11 +84,11 @@ void ScriptManager::createReferenceTable() { } // Iterate through each global Puzzle - for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) { - Puzzle *puzzlePtr = &(*globalPuzzleIter); + for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) { + Puzzle *puzzlePtr = (*globalPuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle - for (Common::List >::iterator criteriaIter = globalPuzzleIter->criteriaList.begin(); criteriaIter != (*globalPuzzleIter).criteriaList.end(); criteriaIter++) { + for (Common::List >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); criteriaIter++) { for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { _referenceTable[entryIter->key].push_back(puzzlePtr); @@ -263,23 +272,23 @@ void ScriptManager::changeLocationIntern() { } // Add all the local puzzles to the queue to be checked - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST - if (((*iter).flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { - setStateValue((*iter).key, 0); + if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { + setStateValue((*iter)->key, 0); } - _puzzlesToCheck.push(&(*iter)); + _puzzlesToCheck.push((*iter)); } // Add all the global puzzles to the queue to be checked - for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { // Reset any Puzzles that have the flag ONCE_PER_INST - if (((*iter).flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { - setStateValue((*iter).key, 0); + if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { + setStateValue((*iter)->key, 0); } - _puzzlesToCheck.push(&(*iter)); + _puzzlesToCheck.push((*iter)); } // Create the puzzle reference table diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 884699a6b0a3..2372703cbeb7 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -50,6 +50,7 @@ struct Location { class ScriptManager { public: ScriptManager(ZVision *engine); + ~ScriptManager(); private: ZVision *_engine; @@ -66,9 +67,9 @@ class ScriptManager { /** Holds the Puzzles that should be checked this frame */ Common::Queue _puzzlesToCheck; /** Holds the currently active puzzles */ - Common::List _activePuzzles; + Common::List _activePuzzles; /** Holds the global puzzles */ - Common::List_globalPuzzles; + Common::List_globalPuzzles; /** Holds the currently active controls */ Common::HashMap _activeControls; @@ -112,7 +113,7 @@ class ScriptManager { * @param puzzle The object to store what is parsed * @param stream Scr file stream */ - void parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream); + void parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream); /** * Parses the stream into a Criteria object From 8e22af36b7e1500fa8ccca971225d87066cb9e26 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:51:00 -0500 Subject: [PATCH 0625/1332] ZVISION: Add TODO to subtitles --- engines/zvision/subtitles.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/subtitles.h b/engines/zvision/subtitles.h index 00eeef2a8afa..e88108327fc5 100644 --- a/engines/zvision/subtitles.h +++ b/engines/zvision/subtitles.h @@ -24,6 +24,6 @@ #ifndef ZVISION_SUBTITLES_H #define ZVISION_SUBTITLES_H -// Implement Subtitles +// TODO: Implement Subtitles #endif \ No newline at end of file From ac7b2251bb3cb41b10d2b69b3d3540895db057d8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:55:00 -0500 Subject: [PATCH 0626/1332] ZVISION: Delete Puzzles from heap before clearing _activePuzzles --- engines/zvision/script_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 390fe0d74273..c217cb8612a8 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -248,6 +248,9 @@ void ScriptManager::changeLocationIntern() { // Clear all the containers _referenceTable.clear(); _puzzlesToCheck.clear(); + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + delete (*iter); + } _activePuzzles.clear(); // We can clear without deleting from the heap because we use SharedPtr _activeControls.clear(); From fa7fb2e029adec318cf963292b4b9b375189b487 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 21:26:53 -0500 Subject: [PATCH 0627/1332] ZVISION: Initialize Puzzle::key and Puzzle::flags Some Puzzles don't have flags, which caused it to never be initialized --- engines/zvision/puzzle.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 371af83d91e4..512a9636b917 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -32,6 +32,8 @@ namespace ZVision { struct Puzzle { + Puzzle() : key(0), flags(0) {} + ~Puzzle() { for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { delete (*iter); From ca5066db526d3fc8cc9f45f494da29a34bd41537 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 23:04:16 -0500 Subject: [PATCH 0628/1332] ZVISION: Remove static Control::parsePushToggleControl The code was moved to the class PushToggleControl --- engines/zvision/control.cpp | 4 ---- engines/zvision/control.h | 1 - 2 files changed, 5 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 106d938889bd..94e0c477ab81 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -165,8 +165,4 @@ bool PushToggleControl::disable(ZVision *engine) { return false; } -void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) { - -} - } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index e3cb0d4afa69..32a2b863b009 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -53,7 +53,6 @@ class Control { static void parseFlatControl(ZVision *engine); static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream); static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); - static void parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream); }; class PushToggleControl : public Control { From 25f95ebdcd2c269cf4016748dc51584aaa9125c5 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 23:05:01 -0500 Subject: [PATCH 0629/1332] ZVISION: Implement streaming support for RlfAnimations --- engines/zvision/rlf_animation.cpp | 185 ++++++++++++++++++------------ engines/zvision/rlf_animation.h | 18 ++- 2 files changed, 131 insertions(+), 72 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 90086e9bd00c..2b37ff147e40 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -33,8 +33,10 @@ namespace ZVision { -RlfAnimation::RlfAnimation(const Common::String &fileName) - : _frameCount(0), +RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) + : _stream(stream), + _lastFrameRead(0), + _frameCount(0), _width(0), _height(0), _frameTime(0), @@ -42,84 +44,25 @@ RlfAnimation::RlfAnimation(const Common::String &fileName) _currentFrameBuffer(0), _currentFrame(-1), _frameBufferByteSize(0) { - Common::File file; - if (!file.open(fileName)) { + if (!_file.open(fileName)) { warning("RLF animation file %s could not be opened", fileName.c_str()); return; } - if (file.readUint32BE() != MKTAG('F', 'E', 'L', 'R')) { + if (!readHeader()) { warning("%s is not a RLF animation file. Wrong magic number", fileName.c_str()); return; } - // Read the header - file.readUint32LE(); // Size1 - file.readUint32LE(); // Unknown1 - file.readUint32LE(); // Unknown2 - _frameCount = file.readUint32LE(); // Frame count - - // Since we don't need any of the data, we can just seek right to the - // entries we need rather than read in all the individual entries. - file.seek(136, SEEK_CUR); - - //// Read CIN header - //file.readUint32BE(); // Magic number FNIC - //file.readUint32LE(); // Size2 - //file.readUint32LE(); // Unknown3 - //file.readUint32LE(); // Unknown4 - //file.readUint32LE(); // Unknown5 - //file.seek(0x18, SEEK_CUR); // VRLE - //file.readUint32LE(); // LRVD - //file.readUint32LE(); // Unknown6 - //file.seek(0x18, SEEK_CUR); // HRLE - //file.readUint32LE(); // ELHD - //file.readUint32LE(); // Unknown7 - //file.seek(0x18, SEEK_CUR); // HKEY - //file.readUint32LE(); // ELRH - - //// Read MIN info header - //file.readUint32BE(); // Magic number FNIM - //file.readUint32LE(); // Size3 - //file.readUint32LE(); // OEDV - //file.readUint32LE(); // Unknown8 - //file.readUint32LE(); // Unknown9 - //file.readUint32LE(); // Unknown10 - _width = file.readUint32LE(); // Width - _height = file.readUint32LE(); // Height - - // Read time header - file.readUint32BE(); // Magic number EMIT - file.readUint32LE(); // Size4 - file.readUint32LE(); // Unknown11 - _frameTime = file.readUint32LE() / 10; // Frame time in microseconds - - _frames = new Frame[_frameCount]; _currentFrameBuffer = new uint16[_width * _height]; _frameBufferByteSize = _width * _height * sizeof(uint16); - // Read in each frame - for (uint i = 0; i < _frameCount; i++) { - file.readUint32BE(); // Magic number MARF - uint32 size = file.readUint32LE(); // Size - file.readUint32LE(); // Unknown1 - file.readUint32LE(); // Unknown2 - uint32 type = file.readUint32BE(); // Either ELHD or ELRH - uint32 headerSize = file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 - file.readUint32LE(); // Unknown3 - - _frames[i].encodedSize = size - headerSize; - _frames[i].encodedData = new int8[_frames[i].encodedSize]; - file.read(_frames[i].encodedData, _frames[i].encodedSize); - - if (type == MKTAG('E', 'L', 'H', 'D')) { - _frames[i].type = Masked; - } else if (type == MKTAG('E', 'L', 'R', 'H')) { - _frames[i].type = Simple; - _completeFrames.push_back(i); - } else { - warning("Frame %u of %s doesn't have type that can be decoded", i, fileName.c_str()); - return; + if (!stream) { + _frames = new Frame[_frameCount]; + + // Read in each frame + for (uint i = 0; i < _frameCount; i++) { + _frames[i] = readNextFrame(); } } }; @@ -133,7 +76,85 @@ RlfAnimation::~RlfAnimation() { } } +bool RlfAnimation::readHeader() { + if (_file.readUint32BE() != MKTAG('F', 'E', 'L', 'R')) { + return false; + } + + // Read the header + _file.readUint32LE(); // Size1 + _file.readUint32LE(); // Unknown1 + _file.readUint32LE(); // Unknown2 + _frameCount = _file.readUint32LE(); // Frame count + + // Since we don't need any of the data, we can just seek right to the + // entries we need rather than read in all the individual entries. + _file.seek(136, SEEK_CUR); + + //// Read CIN header + //_file.readUint32BE(); // Magic number FNIC + //_file.readUint32LE(); // Size2 + //_file.readUint32LE(); // Unknown3 + //_file.readUint32LE(); // Unknown4 + //_file.readUint32LE(); // Unknown5 + //_file.seek(0x18, SEEK_CUR); // VRLE + //_file.readUint32LE(); // LRVD + //_file.readUint32LE(); // Unknown6 + //_file.seek(0x18, SEEK_CUR); // HRLE + //_file.readUint32LE(); // ELHD + //_file.readUint32LE(); // Unknown7 + //_file.seek(0x18, SEEK_CUR); // HKEY + //_file.readUint32LE(); // ELRH + + //// Read MIN info header + //_file.readUint32BE(); // Magic number FNIM + //_file.readUint32LE(); // Size3 + //_file.readUint32LE(); // OEDV + //_file.readUint32LE(); // Unknown8 + //_file.readUint32LE(); // Unknown9 + //_file.readUint32LE(); // Unknown10 + _width = _file.readUint32LE(); // Width + _height = _file.readUint32LE(); // Height + + // Read time header + _file.readUint32BE(); // Magic number EMIT + _file.readUint32LE(); // Size4 + _file.readUint32LE(); // Unknown11 + _frameTime = _file.readUint32LE() / 10; // Frame time in microseconds + + return true; +} + +RlfAnimation::Frame RlfAnimation::readNextFrame() { + RlfAnimation::Frame frame; + + _file.readUint32BE(); // Magic number MARF + uint32 size = _file.readUint32LE(); // Size + _file.readUint32LE(); // Unknown1 + _file.readUint32LE(); // Unknown2 + uint32 type = _file.readUint32BE(); // Either ELHD or ELRH + uint32 headerSize = _file.readUint32LE(); // Offset from the beginning of this frame to the frame data. Should always be 28 + _file.readUint32LE(); // Unknown3 + + frame.encodedSize = size - headerSize; + frame.encodedData = new int8[frame.encodedSize]; + _file.read(frame.encodedData, frame.encodedSize); + + if (type == MKTAG('E', 'L', 'H', 'D')) { + frame.type = Masked; + } else if (type == MKTAG('E', 'L', 'R', 'H')) { + frame.type = Simple; + _completeFrames.push_back(_lastFrameRead); + } else { + warning("Frame %u doesn't have type that can be decoded", _lastFrameRead); + } + + _lastFrameRead++; + return frame; +} + const uint16 *RlfAnimation::getFrameData(uint frameNumber) { + assert(!_stream); assert(frameNumber < _frameCount && frameNumber >= 0); if (frameNumber == _currentFrame) { @@ -161,13 +182,29 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } } + _currentFrame = frameNumber; return _currentFrameBuffer; } const uint16 *RlfAnimation::getNextFrame() { assert(_currentFrame + 1 < _frameCount); - applyFrameToCurrent(_currentFrame + 1); + if (_stream) { + applyFrameToCurrent(readNextFrame()); + } else { + applyFrameToCurrent(_currentFrame + 1); + } + + _currentFrame -= 1; + return _currentFrameBuffer; +} + +const uint16 *RlfAnimation::getPreviousFrame() { + assert(!_stream); + assert(_currentFrame - 1 >= 0); + + applyFrameToCurrent(_currentFrame - 1); + _currentFrame =- 1; return _currentFrameBuffer; } @@ -177,8 +214,14 @@ void RlfAnimation::applyFrameToCurrent(uint frameNumber) { } else if (_frames[frameNumber].type == Simple) { decodeSimpleRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); } +} - _currentFrame = frameNumber; +void RlfAnimation::applyFrameToCurrent(const RlfAnimation::Frame &frame) { + if (frame.type == Masked) { + decodeMaskedRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer, frame.encodedSize, _frameBufferByteSize); + } else if (frame.type == Simple) { + decodeSimpleRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer, frame.encodedSize, _frameBufferByteSize); + } } void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const { diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index e204a500908f..09d0bac71e8b 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -23,6 +23,10 @@ #ifndef ZVISION_RLF_ANIMATION_H #define ZVISION_RLF_ANIMATION_H +#include "common/types.h" + +#include "common/file.h" + namespace Common { class String; @@ -32,7 +36,7 @@ namespace ZVision { class RlfAnimation { public: - RlfAnimation(const Common::String &fileName); + RlfAnimation(const Common::String &fileName, bool stream = true); ~RlfAnimation(); private: @@ -48,6 +52,10 @@ class RlfAnimation { }; private: + Common::File _file; + bool _stream; + uint _lastFrameRead; + uint _frameCount; uint _width; uint _height; @@ -64,12 +72,20 @@ class RlfAnimation { uint width() { return _width; } uint height() { return _height; } uint32 frameTime() { return _frameTime; } + const uint16 *getFrameData(uint frameNumber); + const uint16 *getNextFrame(); + const uint16 *getPreviousFrame(); + bool endOfAnimation() { return _currentFrame == _frameCount - 1; } private: + bool readHeader(); + Frame readNextFrame(); + void applyFrameToCurrent(uint frameNumber); + void applyFrameToCurrent(const RlfAnimation::Frame &frame); void decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; void decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; From 44f7802777df8b3dce2eaa25b66bfe0d0f094bdf Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 21 Aug 2013 13:45:22 +0200 Subject: [PATCH 0630/1332] AVALANCHE: Rename Gyro::reloaded to Gyro::isLoaded. Repair a bug in the original engine regarding timing of animations/scrolls/etc. when loading a savegame using this variable. --- engines/avalanche/avalanche.cpp | 2 ++ engines/avalanche/avalot.cpp | 6 ++---- engines/avalanche/gyro2.h | 2 +- engines/avalanche/timeout2.cpp | 27 ++++++++++++++++----------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 8c893176e8b6..2c4ae6f9eabf 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -456,6 +456,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { delete f; + _gyro->isLoaded = true; + _gyro->seescroll = true; // This prevents display of the new sprites before the new picture is loaded. if (_gyro->holdthedawn) { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 9cf66606ab38..cb73123d2e6e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -192,14 +192,12 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _vm->loadGame(loadSlot); - - _vm->_gyro->reloaded = true; } else - _vm->_gyro->reloaded = false; + _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). - if (!_vm->_gyro->reloaded) { + if (!_vm->_gyro->isLoaded) { _vm->_gyro->newgame(); // No game was requested- load the default. _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 7ddfe62de4c7..547b324af0bc 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -594,7 +594,7 @@ class Gyro { uint16 storage_seg, storage_ofs; /* Seg and ofs of the Storage area. */ uint16 skellern; /* Offset of the timer variable - 1 more than storage_OFS */ - bool reloaded; /* Is this NOT the primary loading? */ + bool isLoaded; // Is it a loaded gamestate? bool super_was_virtual, super_was_off; /* Used by Super_Off and Super_On */ diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 459f12415df8..dba78870e9d0 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -57,17 +57,22 @@ Timeout::Timeout(AvalancheEngine *vm) { } void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { - fv = 0; - while ((fv < 7) && (times[fv].time_left != 0)) - fv++; - - if (fv == 7) - return; /* Oh dear... */ - - /* Everything's OK here! */ - times[fv].time_left = howlong; - times[fv].then_where = whither; - times[fv].what_for = why; + if (_vm->_gyro->isLoaded == false) { + byte i = 0; + while ((i < 7) && (times[i].time_left != 0)) + i++; + + if (i == 7) + return; // Oh dear... + + // Everything's OK here! + times[i].time_left = howlong; + times[i].then_where = whither; + times[i].what_for = why; + } else { + _vm->_gyro->isLoaded = false; + return; + } } void Timeout::one_tick() { From c43373f7ae714e5640452db026a0195b304c8ec1 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 21 Aug 2013 18:01:31 +0200 Subject: [PATCH 0631/1332] AVALANCHE: Implement opening of doors. Rethink a bit the graphics and the timer system to do so. --- engines/avalanche/acci2.cpp | 47 ++++++++++++++++----------------- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/celer2.cpp | 3 ++- engines/avalanche/graphics.cpp | 4 +-- engines/avalanche/graphics.h | 6 ++++- engines/avalanche/gyro2.h | 1 + engines/avalanche/lucerna2.cpp | 32 +++++++++------------- engines/avalanche/sequence2.cpp | 5 ++-- engines/avalanche/timeout2.cpp | 4 ++- engines/avalanche/timeout2.h | 2 ++ engines/avalanche/trip6.cpp | 16 +++-------- 11 files changed, 58 insertions(+), 64 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 087dd27cf87c..baecec9fa6d3 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -758,7 +758,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ switch (_vm->_gyro->dna.room) { /* Special cases. */ case r__yours: - if (_vm->_trip->infield(2)) { + if (_vm->_trip->infield(1)) { /* Opening the box. */ thing = 54; /* The box. */ person = pardon; examine(); @@ -777,33 +777,32 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) return; /* No doors can open if you can't move Avvy. */ - for (fv = 9; fv <= 15; fv++) { + for (fv = 8; fv < 15; fv++) if (_vm->_trip->infield(fv)) { - { - _vm->_gyro->portals[fv]; - switch (_vm->_gyro->portals[fv].op) { - case _vm->_gyro->exclaim: - _vm->_trip->tr[1].bounce(); - _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); - break; - case _vm->_gyro->transport: - _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); - break; - case _vm->_gyro->unfinished: - _vm->_trip->tr[1].bounce(); - _vm->_scrolls->display("Sorry. This place is not available yet!"); - break; - case _vm->_gyro->special: - _vm->_trip->call_special(_vm->_gyro->portals[fv].data); - break; - case _vm->_gyro->mopendoor: - _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); - break; - } + fv -= 8; + + switch (_vm->_gyro->portals[fv].op) { + case _vm->_gyro->exclaim: + _vm->_trip->tr[0].bounce(); + _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); + break; + case _vm->_gyro->transport: + _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); + break; + case _vm->_gyro->unfinished: + _vm->_trip->tr[0].bounce(); + _vm->_scrolls->display("Sorry. This place is not available yet!"); + break; + case _vm->_gyro->special: + _vm->_trip->call_special(_vm->_gyro->portals[fv].data); + break; + case _vm->_gyro->mopendoor: + _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); + break; } + return; } - } if (_vm->_gyro->dna.room == r__map) _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index cb73123d2e6e..6968932cfb34 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -223,8 +223,8 @@ void Avalot::run(Common::String arg) { _vm->_trip->readstick(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); - _vm->_trip->trippancy_link(); _vm->_celer->pics_link(); + _vm->_trip->trippancy_link(); _vm->_lucerna->checkclick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 061eb6b21290..3667ae1840bb 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -347,7 +347,8 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour break; } - _vm->_graphics->drawPicture(picture, x * 8, y); + // These pictures are practically parts of the background. -10 is for the drop-down menu. + _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x * 8, y - 10); } void Celer::show_one(byte which) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9ae040818d52..382153683593 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -309,11 +309,11 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } -void Graphics::drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void Graphics::drawPicture(const ::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) for (uint16 x = 0; x < picture.w; x++) - *getPixel(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); } void Graphics::refreshScreen() { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 7492141c4357..e8cf02a12d8a 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -60,6 +60,10 @@ class Graphics { static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; + static const uint16 kBackgroundWidth = kScreenWidth; + static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151 + // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). + ::Graphics::Surface _surface; ::Graphics::Surface _background; @@ -111,7 +115,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data - void drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(const ::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 547b324af0bc..09f5a92cafcc 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -479,6 +479,7 @@ class Gyro { /* previous:^previoustype;*/ dnatype dna; + byte lineNum; // Number of lines. linetype lines[50]; /* For Also. */ int16 c; //registers r; // http://www.freepascal.org/docs-html/rtl/dos/registers.html diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3fcb1acf7794..18e585872967 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -88,13 +88,11 @@ void Lucerna::draw_also_lines() { CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 161), 15); - - for (ff = 0; ff < 50; ff++) - if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) - _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); - + _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + for (ff = 0; ff < _vm->_gyro->lineNum; ff++) + _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + CursorMan.showMouse(true); } @@ -155,8 +153,8 @@ void Lucerna::load_also(Common::String n) { memset(_vm->_gyro->lines, 0xFF, sizeof(_vm->_gyro->lines)); //fv = getpixel(0, 0); - fv = f.readByte(); - for (byte i = 0; i < fv; i++) { + _vm->_gyro->lineNum = f.readByte(); + for (byte i = 0; i < _vm->_gyro->lineNum; i++) { _vm->_gyro->lines[i].x1 = f.readSint16LE(); _vm->_gyro->lines[i].y1 = f.readSint16LE(); _vm->_gyro->lines[i].x2 = f.readSint16LE(); @@ -171,7 +169,7 @@ void Lucerna::load_also(Common::String n) { _vm->_gyro->peds[i].y = f.readSint16LE(); _vm->_gyro->peds[i].dir = f.readByte(); } - + _vm->_gyro->numfields = f.readByte(); for (byte i = 0; i < _vm->_gyro->numfields; i++) { _vm->_gyro->fields[i].x1 = f.readSint16LE(); @@ -251,13 +249,9 @@ void Lucerna::load(byte n) { /* Load2, actually */ - uint16 backgroundWidht = _vm->_graphics->kScreenWidth; - byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151 - // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) - - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); + _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); f.close(); @@ -756,7 +750,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); - _vm->_graphics->drawPicture(picture, 205, 170); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); picture.free(); @@ -813,7 +807,7 @@ void Lucerna::toolbar() { ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); - _vm->_graphics->drawPicture(picture, 5, 169); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); picture.free(); @@ -849,7 +843,7 @@ void Lucerna::showscore() { for (byte fv = 0; fv < 3; fv ++) if (_vm->_gyro->lastscore[fv] != numbers[fv]) - _vm->_graphics->drawPicture(_vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv ++) _vm->_trip->getset[fv].remember(scorespace); @@ -1144,7 +1138,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). putimage(0, 161, rwlite[with.rw], 0); }*/ - _vm->_graphics->drawPicture(_vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); CursorMan.showMouse(true); //setactivepage(1 - cp); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index bdc809e5ca0e..fcca72432f1b 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -54,8 +54,7 @@ void Sequence::first_show(byte what) { } void Sequence::then_show(byte what) { - byte fv; - for (fv = 1; fv <= seq_length; fv++) { + for (byte fv = 0; fv < seq_length; fv++) { if (seq[fv] == 0) { seq[fv] = what; return; @@ -103,7 +102,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer->show_one(seq[1]); + _vm->_celer->show_one(seq[0] - 1); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index dba78870e9d0..ece531718de3 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -57,7 +57,7 @@ Timeout::Timeout(AvalancheEngine *vm) { } void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { - if (_vm->_gyro->isLoaded == false) { + if ((_vm->_gyro->isLoaded == false) || (timerLost == true)) { byte i = 0; while ((i < 7) && (times[i].time_left != 0)) i++; @@ -221,6 +221,8 @@ void Timeout::lose_timer(byte which) { if (times[fv].what_for == which) times[fv].time_left = 0; // Cancel this one! } + + timerLost = true; } /*function timer_is_on(which:byte):boolean; diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index d315d5964aec..80f0677786c3 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -162,6 +162,8 @@ class Timeout { timetype times[7]; + bool timerLost; // Is the timer "lost"? + Timeout(AvalancheEngine *vm); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 000947773857..637c5103993e 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1392,16 +1392,8 @@ void Trip::call_andexors() { } } while (!ok); - // We redraw the background only if we have at least one moving character. - bool drawBG = false; - for (fv = 0; fv < 5; fv++) { - if (order[fv] > -1) { - drawBG = true; - break; - } - } - if (drawBG) - _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); + + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); for (fv = 0; fv < 5; fv++) { if (order[fv] > -1) @@ -1646,9 +1638,9 @@ void Trip::fliproom(byte room, byte ped) { bool Trip::infield(byte which) { /* returns True if you're within field "which" */ - int16 yy = tr[1].y + tr[1]._info.yl; + int16 yy = tr[0].y + tr[0]._info.yl; - return (tr[1].x >= _vm->_gyro->fields[which].x1) && (tr[1].x <= _vm->_gyro->fields[which].x2) + return (tr[0].x >= _vm->_gyro->fields[which].x1) && (tr[0].x <= _vm->_gyro->fields[which].x2) && (yy >= _vm->_gyro->fields[which].y1) && (yy <= _vm->_gyro->fields[which].y2); } From dbd330bf2fdfdae94d4e50e9c4e3fff2162de478 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 21 Aug 2013 20:20:42 +0200 Subject: [PATCH 0632/1332] AVALANCHE: Rename special() to openBox() in Acci, implement it. --- engines/avalanche/acci2.cpp | 29 +++++++++++++++++++++-------- engines/avalanche/acci2.h | 2 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/gyro2.h | 2 +- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index baecec9fa6d3..39dfd88ead03 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -671,8 +671,23 @@ bool Acci::holding() { -void Acci::special(bool before) { - warning("STUB: Acci::special()"); +void Acci::openBox(bool before) { + if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { + _vm->_celer->show_one(4); + + _vm->_celer->pics_link(); + _vm->_trip->trippancy_link(); + _vm->_graphics->refreshScreen(); + + _vm->_system->delayMillis(55); + + if (!before) { + _vm->_celer->show_one(5); + _vm->_celer->pics_link(); + _vm->_trip->trippancy_link(); + _vm->_graphics->refreshScreen(); + } + } } void Acci::examine() { @@ -683,9 +698,9 @@ void Acci::examine() { if ((1 <= thing) && (thing <= 49)) // Standard object examobj(); else if ((50 <= thing) && (thing <= 100)) { // Also thing - special(true); - _vm->_scrolls->display(*_vm->_gyro->also[thing - 51][0]); - special(false); + openBox(true); + _vm->_scrolls->display(*_vm->_gyro->also[thing - 50][1]); + openBox(false); } } } else if (person != pardon) @@ -754,8 +769,6 @@ void Acci::lookaround() { } void Acci::opendoor() { /* so whaddya THINK this does?! */ - byte fv; - switch (_vm->_gyro->dna.room) { /* Special cases. */ case r__yours: if (_vm->_trip->infield(1)) { @@ -777,7 +790,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) return; /* No doors can open if you can't move Avvy. */ - for (fv = 8; fv < 15; fv++) + for (byte fv = 8; fv < 15; fv++) if (_vm->_trip->infield(fv)) { fv -= 8; diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 2b174f0a13c3..a6350721a623 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -177,7 +177,7 @@ class Acci { bool holding(); - void special(bool before); + void openBox(bool before); void examine(); void inv(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 5278a3dc760c..82daf2e17b3e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -490,7 +490,7 @@ Common::String Gyro::get_better(byte which) { get_better_result = better[which]; break; default: - if ((which < numobjs) && (which > '\0')) + if ((which < numobjs) && (which > 0)) get_better_result = better[which]; else get_better_result = ""; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 09f5a92cafcc..aa5a0fdc859a 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -109,7 +109,7 @@ struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ bool friar_will_tie_you_up; /* If you're going to get tied up. */ bool tied_up; /* You ARE tied up! */ - char box_contents; /* 0 = money (sixpence), 254 = empty, any + byte box_contents; /* 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. */ bool talked_to_crapulus; /* Pretty self-explanatory. */ From 457d898ff3a5fe5ee156a6d03be49b144cab551e Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 23 Aug 2013 11:33:37 +0200 Subject: [PATCH 0633/1332] AVALANCHE: Upgrade Lucerna::enterroom(). Add r__yourhall to roomnums.h, handle it's cases in Lucerna:enterroom() and Trip::open_the_door(). Remove unnecessary typecasts in Celer::pics_link(), upgrade Celer::show_one(). Introduce Graphics::refreshBackground(), use it where needed. --- engines/avalanche/acci2.cpp | 4 +-- engines/avalanche/celer2.cpp | 36 +++++++++---------- engines/avalanche/graphics.cpp | 3 ++ engines/avalanche/graphics.h | 2 ++ engines/avalanche/lucerna2.cpp | 61 +++++++++++++++++++++++++-------- engines/avalanche/roomnums.h | 2 +- engines/avalanche/sequence2.cpp | 2 +- engines/avalanche/timeout2.cpp | 2 +- engines/avalanche/trip6.cpp | 3 +- 9 files changed, 77 insertions(+), 38 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 39dfd88ead03..d586519cb123 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -673,7 +673,7 @@ bool Acci::holding() { void Acci::openBox(bool before) { if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { - _vm->_celer->show_one(4); + _vm->_celer->show_one(5); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); @@ -682,7 +682,7 @@ void Acci::openBox(bool before) { _vm->_system->delayMillis(55); if (!before) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 3667ae1840bb..7f1966223df8 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -61,27 +61,27 @@ void Celer::pics_link() { switch (_vm->_gyro->dna.room) { case r__outsideargentpub: - if ((_vm->_gyro->roomtime % int32(12)) == 0) - show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(4)); + if ((_vm->_gyro->roomtime % 12) == 0) + show_one(1 + (_vm->_gyro->roomtime / 12) % 4); break; case r__brummieroad: - if ((_vm->_gyro->roomtime % int32(2)) == 0) - show_one(int32(1) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % 2) == 0) + show_one(1 + (_vm->_gyro->roomtime / 2) % 4); break; case r__bridge: - if ((_vm->_gyro->roomtime % int32(2)) == 0) - show_one(int32(4) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % 2) == 0) + show_one(4 + (_vm->_gyro->roomtime / 2) % 4); break; case r__yours: - if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % int32(4)) == 0)) - show_one(0 + (_vm->_gyro->roomtime / 12) % 2); + if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) + show_one(1 + (_vm->_gyro->roomtime / 12) % 2); break; case r__argentpub: - if (((_vm->_gyro->roomtime % int32(7)) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { /* Malagauche cycle */ _vm->_gyro->dna.malagauche += 1; switch (_vm->_gyro->dna.malagauche) { @@ -138,7 +138,7 @@ void Celer::pics_link() { break; case r__westhall: - if ((_vm->_gyro->roomtime % int32(3)) == 0) { + if ((_vm->_gyro->roomtime % 3) == 0) { switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: show_one(1); @@ -158,7 +158,7 @@ void Celer::pics_link() { case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { - if ((_vm->_gyro->roomtime % int32(45)) > 42) + if ((_vm->_gyro->roomtime % 45) > 42) xx = 4; /* du Lustie blinks */ /* Bearing of Avvy from du Lustie. */ @@ -177,8 +177,8 @@ void Celer::pics_link() { break; case r__aylesoffice: - if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % int32(14) == 0)) { - switch ((_vm->_gyro->roomtime / int32(14)) % int32(2)) { + if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { + switch ((_vm->_gyro->roomtime / 14) % 2) { case 0: show_one(1); break; /* Frame 2: EGA. */ @@ -191,7 +191,7 @@ void Celer::pics_link() { case r__robins: if (_vm->_gyro->dna.tied_up) { - switch (_vm->_gyro->roomtime % int32(54)) { + switch (_vm->_gyro->roomtime % 54) { case 20: show_one(4); break; /* Frame 4: Avalot blinks. */ @@ -241,7 +241,7 @@ void Celer::pics_link() { else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) xx = 8; /* Right. */ - if ((_vm->_gyro->roomtime % int32(45)) > 42) + if ((_vm->_gyro->roomtime % 45) > 42) xx += 1; /* Duck blinks */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ @@ -255,7 +255,7 @@ void Celer::pics_link() { if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { /* They're ringing the bells. */ - switch (_vm->_gyro->roomtime % int32(4)) { + switch (_vm->_gyro->roomtime % 4) { case 1: if (_vm->_gyro->dna.nextbell < 5) _vm->_gyro->dna.nextbell = 12; @@ -353,7 +353,7 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour void Celer::show_one(byte which) { chunkblocktype ch; - + which--; // For the difference between the Pascal and C array indexes. //setactivepage(3); warning("STUB: Celer::show_one()"); @@ -376,7 +376,7 @@ void Celer::show_one(byte which) { ch.natural = f.readByte(); ch.memorise = f.readByte(); - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); // There'll may be problems with the width! + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, picture); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 382153683593..b6dbe16c612d 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -328,5 +328,8 @@ void Graphics::refreshScreen() { g_system->updateScreen(); } +void Graphics::refreshBackground() { + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); +} } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e8cf02a12d8a..ca287721560e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -119,6 +119,8 @@ class Graphics { void refreshScreen(); + void refreshBackground(); + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 18e585872967..3f86eb5ed8bd 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -251,7 +251,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); + _vm->_graphics->refreshBackground(); f.close(); @@ -388,6 +388,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } break; @@ -489,6 +490,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ _vm->_celer->show_one(3); /* Position of drawbridge */ + _vm->_graphics->refreshBackground(); _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } if (_vm->_gyro->dna.geida_follows) @@ -517,6 +519,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.mushroom_growing) _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); } break; @@ -557,12 +560,14 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentpub: { - if (_vm->_gyro->dna.wonnim) _vm->_celer->show_one(1); /* No lute by the settle. */ + if (_vm->_gyro->dna.wonnim) + _vm->_celer->show_one(1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { _vm->_celer->show_one(8); _vm->_celer->show_one(9); } + _vm->_graphics->refreshBackground(); } break; @@ -576,8 +581,10 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(4, ped); - if (_vm->_gyro->dna.lustie_is_asleep) + if (_vm->_gyro->dna.lustie_is_asleep) { _vm->_celer->show_one(5); + _vm->_graphics->refreshBackground(); + } } } break; @@ -586,13 +593,16 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); _vm->_celer->show_one(4); _vm->_gyro->magics[brown].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; } if (ped != 0) { _vm->_celer->show_one(6); - _vm->_sequence->first_show(5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(6); + _vm->_sequence->then_show(5); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); } @@ -602,7 +612,9 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidenottspub: if (ped == 2) { _vm->_celer->show_one(3); - _vm->_sequence->first_show(2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(3); + _vm->_sequence->then_show(2); _vm->_sequence->then_show(1); _vm->_sequence->then_show(4); _vm->_sequence->start_to_close(); @@ -612,7 +624,9 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideargentpub: if (ped == 2) { _vm->_celer->show_one(6); - _vm->_sequence->first_show(5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(6); + _vm->_sequence->then_show(5); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); } @@ -636,6 +650,8 @@ void Lucerna::enterroom(byte x, byte ped) { case r__insidecardiffcastle: if (ped > 0) { _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ + _vm->_celer->show_one(1); + _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) _vm->_sequence->then_show(3); @@ -648,26 +664,40 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->start_to_close(); } else { _vm->_celer->show_one(1); - if (_vm->_gyro->dna.arrow_in_the_door) _vm->_celer->show_one(3); - else _vm->_celer->show_one(2); + if (_vm->_gyro->dna.arrow_in_the_door) + _vm->_celer->show_one(3); + else + _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); } break; case r__avvysgarden: if (ped == 1) { _vm->_celer->show_one(2); - _vm->_sequence->first_show(1); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); _vm->_sequence->then_show(3); _vm->_sequence->start_to_close(); } break; - + case r__entrancehall: case r__insideabbey: + case r__yourhall: if (ped == 2) { + /* It was the original: _vm->_celer->show_one(2); _vm->_sequence->first_show(1); _vm->_sequence->then_show(3); + _vm->_sequence->start_to_close();*/ + + _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); + _vm->_sequence->then_show(3); _vm->_sequence->start_to_close(); } break; @@ -675,6 +705,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); break; /* Ayles awake. */ case r__geidas: @@ -702,6 +733,8 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped == 2) { /* Shut the door */ _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(3); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); _vm->_sequence->then_show(4); @@ -1291,16 +1324,16 @@ uint16 Lucerna::bearing(byte whichped) { uint16 bearing_result; { pedtype &with = _vm->_gyro->peds[whichped]; - if (_vm->_trip->tr[1].x == with.x) + if (_vm->_trip->tr[0].x == with.x) bearing_result = 0; /* This would cause a division by zero if we let it through. */ else { /* bearing:=trunc(((arctan((_vm->_trip->tr[1].y-y)/(_vm->_trip->tr[1].x-x)))*rad2deg)+90) mod 360*/ - if (_vm->_trip->tr[1].x < with.x) - bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 90; + if (_vm->_trip->tr[0].x < with.x) + bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 90; else - bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 270; + bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 270; } } return bearing_result; diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index a6cb93b3a8e3..fb99f5c780a5 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -36,7 +36,7 @@ const byte r__nowhere = 0; const byte r__yours = 1; const byte r__outsideyours = 2; const byte r__outsidespludwicks = 3; -//{ outside your castle = 5; } +const byte r__yourhall = 5; const byte r__musicroom = 7; const byte r__outsideargentpub = 9; const byte r__argentroad = 10; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index fcca72432f1b..6439df26fe9f 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -102,7 +102,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer->show_one(seq[0] - 1); + _vm->_celer->show_one(seq[0]); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index ece531718de3..bbb5e8cc3f18 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -79,7 +79,7 @@ void Timeout::one_tick() { if (_vm->_gyro->ddmnow) return; - for (fv = 0; fv < 7; fv++) { + for (byte fv = 0; fv < 7; fv++) { if (times[fv].time_left > 0) { times[fv].time_left--; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 637c5103993e..12294ba94696 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1040,6 +1040,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { case r__avvysgarden: case r__entrancehall: case r__insideabbey: + case r__yourhall: _vm->_sequence->first_show(1); _vm->_sequence->then_show(2); break; @@ -1393,7 +1394,7 @@ void Trip::call_andexors() { } while (!ok); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); + _vm->_graphics->refreshBackground(); for (fv = 0; fv < 5; fv++) { if (order[fv] > -1) From 90da6c5e6c6adc20ff238a292c505bd0cd32b91c Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 23 Aug 2013 14:56:56 +0200 Subject: [PATCH 0634/1332] AVALANCHE: Repair Acci::do_that(), Gyro::getname(), Lucerna::find_people(), triptype::walkto(). --- engines/avalanche/acci2.cpp | 6 +++--- engines/avalanche/gyro2.cpp | 8 +++----- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 4 ++-- engines/avalanche/trip6.cpp | 1 + 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d586519cb123..731d297b8408 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1839,11 +1839,11 @@ void Acci::do_that() { break; case _vm->_gyro->payles: if (!_vm->_gyro->dna.ayles_is_awake) - _vm->_scrolls->display("You can't seem to wake _vm->_gyro->him by yourself."); + _vm->_scrolls->display("You can't seem to wake him by yourself."); break; case _vm->_gyro->pjacques: - _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?\231\2") + - "Hmmm... that doesn't seem to do any good..."); + _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + + _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; default: _vm->_scrolls->display("It's difficult to awaken people who aren't asleep...!"); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 82daf2e17b3e..a7305c9aa3c5 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -401,12 +401,10 @@ bool Gyro::pennycheck(uint16 howmuchby) { // There'll may be problems with calling these functions becouse of the conversion of the arrays!!! // Keep an eye open! Common::String Gyro::getname(byte whose) { - Common::String getname_result; - if (whose < 17) - getname_result = lads[whose]; + if (whose < 175) + return lads[whose - 150]; else - getname_result = lasses[whose-17]; - return getname_result; + return lasses[whose - 175]; } // Keep an eye open! ^ diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index aa5a0fdc859a..cafaabb8b8f5 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -570,7 +570,7 @@ class Gyro { bool keyboardclick; /* Is a keyboard click noise wanted? */ - char him, her, it; + byte him, her, it; int32 roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ bool after_the_scroll; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3f86eb5ed8bd..1b4d83556b4a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -281,9 +281,9 @@ void Lucerna::find_people(byte room) { for (byte fv = 1; fv < 29; fv++) // There'll may be problems with this. if (_vm->_gyro->whereis[fv] == room) { if (fv < 25) // And this. See definition of whereis[]. - _vm->_gyro->him = fv; + _vm->_gyro->him = fv + 150; else - _vm->_gyro->her = fv; + _vm->_gyro->her = fv + 150; } } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 12294ba94696..afbe13be1a73 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -284,6 +284,7 @@ int8 triptype::sgn(int16 x) { } void triptype::walkto(byte pednum) { + pednum--; // Pascal -> C conversion: different array indexes. speed(sgn(_tr->_vm->_gyro->peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro->peds[pednum].y - y)); hx = _tr->_vm->_gyro->peds[pednum].x - _info.xl / 2; hy = _tr->_vm->_gyro->peds[pednum].y - _info.yl; From 38c51209a406ac3ed8c5c0fbfd250ca3c01e4c10 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 23 Aug 2013 16:03:06 +0200 Subject: [PATCH 0635/1332] AVALANCHE: Upgrade Trip::apped(). Update rest of the code to call it and the previously upgraded Celer::show_one() properly. --- engines/avalanche/acci2.cpp | 6 +++--- engines/avalanche/lucerna2.cpp | 38 +++++++++++++++++----------------- engines/avalanche/trip6.cpp | 4 +++- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 731d297b8408..a8fb0a6a85b4 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1016,9 +1016,9 @@ void Acci::stand_up() { } _vm->_trip->tr[0].visible = true; _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip->apped(0, 1); + _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(3); /* Picture of empty pillow. */ + _vm->_celer->show_one(4); /* Picture of empty pillow. */ _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); @@ -1831,7 +1831,7 @@ void Acci::do_that() { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->show_one(2); /* Picture of Avvy, awake in bed. */ + _vm->_celer->show_one(3); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1b4d83556b4a..277069d30e2e 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -354,7 +354,7 @@ void Lucerna::put_geida_at(byte whichped, byte &ped) { if (ped == 0) return; _vm->_trip->tr[1].init(5, false, _vm->_trip); /* load Geida */ - _vm->_trip->apped(1, whichped); + _vm->_trip->apped(2, whichped); _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; } @@ -401,10 +401,10 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].init(8, false, _vm->_trip); /* load Crapulus */ if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { - _vm->_trip->apped(1, 3); /* Start on the right-hand side of the screen. */ - _vm->_trip->tr[1].walkto(4); /* Walks up to greet you. */ + _vm->_trip->apped(2, 4); /* Start on the right-hand side of the screen. */ + _vm->_trip->tr[1].walkto(5); /* Walks up to greet you. */ } else { - _vm->_trip->apped(1, 4); /* Starts where he was before. */ + _vm->_trip->apped(2, 5); /* Starts where he was before. */ _vm->_trip->tr[1].face = 3; } @@ -415,15 +415,14 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.crapulus_will_tell) { _vm->_trip->tr[1].init(8, false, _vm->_trip); - _vm->_trip->apped(1, 1); - _vm->_trip->tr[1].walkto(3); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[1].walkto(4); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->dna.crapulus_will_tell = false; } } break; - case r__outsidespludwicks: if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); @@ -435,7 +434,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.spludwicks_here) { if (ped > 0) { _vm->_trip->tr[1].init(2, false, _vm->_trip); /* load Spludwick */ - _vm->_trip->apped(1, 1); + _vm->_trip->apped(2, 2); _vm->_gyro->whereis[1] = r__spludwicks; } @@ -460,11 +459,11 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__brummieroad; if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ - _vm->_trip->apped(1, 1); /* He appears on the right of the screen... */ + _vm->_trip->apped(2, 2); /* He appears on the right of the screen... */ _vm->_trip->tr[1].walkto(4); /* ...and he walks up... */ } else { /* You've been here before. */ - _vm->_trip->apped(1, 3); /* He's standing in your way straight away... */ + _vm->_trip->apped(2, 4); /* He's standing in your way straight away... */ _vm->_trip->tr[1].face = _vm->_trip->left; } } @@ -477,8 +476,8 @@ void Lucerna::enterroom(byte x, byte ped) { if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ - _vm->_trip->apped(1, 0); - _vm->_trip->tr[1].walkto(1); + _vm->_trip->apped(2, 1); + _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; with.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ @@ -503,8 +502,8 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.been_tied_up) { /* A welcome party... or maybe not... */ _vm->_trip->tr[1].init(6, false, _vm->_trip); - _vm->_trip->apped(1, 1); - _vm->_trip->tr[1].walkto(2); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[1].walkto(3); _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -528,8 +527,8 @@ void Lucerna::enterroom(byte x, byte ped) { switch (_vm->_gyro->dna.cardiff_things) { case 0 : { /* You've answered NONE of his questions. */ _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(1, 1); - _vm->_trip->tr[1].walkto(2); + _vm->_trip->apped(2, 2); + _vm->_trip->tr[1].walkto(3); _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; @@ -538,7 +537,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; /* You've answered ALL his questions. => nothing happens. */ default: { /* You've answered SOME of his questions. */ _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(1, 2); + _vm->_trip->apped(2, 3); _vm->_trip->tr[1].face = _vm->_trip->right; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } @@ -635,10 +634,10 @@ void Lucerna::enterroom(byte x, byte ped) { case r__wisewomans: { _vm->_trip->tr[1].init(11, false, _vm->_trip); if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip->apped(1, 1); /* Start on the right-hand side of the screen. */ + _vm->_trip->apped(2, 2); /* Start on the right-hand side of the screen. */ _vm->_trip->tr[1].walkto(4); /* Walks up to greet you. */ } else { - _vm->_trip->apped(1, 3); /* Starts where she was before. */ + _vm->_trip->apped(2, 4); /* Starts where she was before. */ _vm->_trip->tr[1].face = 3; } @@ -741,6 +740,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->start_to_close(); } break; + case r__ducks: _vm->_gyro->dna.dogfoodpos = 1; break; /* Actually, Duck pos. */ diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index afbe13be1a73..d55567c64c16 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1135,6 +1135,8 @@ void Trip::rwsp(byte t, byte r) { } void Trip::apped(byte trn, byte np) { + trn--; + np--; tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info.xl / 2, _vm->_gyro->peds[np].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir); rwsp(trn, _vm->_gyro->peds[np].dir); } @@ -1622,7 +1624,7 @@ void Trip::fliproom(byte room, byte ped) { _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; _vm->_lucerna->enterroom(room, ped); - apped(0, ped - 1); + apped(1, ped); _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; _vm->_gyro->oldrw = _vm->_gyro->dna.rw; _vm->_gyro->dna.rw = tr[0].face; From c19b50b3f4228cea0d672982bf3a7bc94e9050b2 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 23 Aug 2013 16:58:22 +0200 Subject: [PATCH 0636/1332] AVALANCHE: Upgrade Trip::infield(), update the rest of the code accordingly. Repair Trip::neardoor(). Introduce Parser::handleFunctionKey(), partially implement it. Implement Gyro::f5_does(). Implement missing part of Lucerna::enterroom(). --- engines/avalanche/acci2.cpp | 4 ++-- engines/avalanche/avalot.cpp | 28 +++++++++++++++++----------- engines/avalanche/gyro2.cpp | 30 ++++++++++++++++++++++++++++-- engines/avalanche/lucerna2.cpp | 18 +++++++++++++++++- engines/avalanche/parser.cpp | 14 ++++++++++++++ engines/avalanche/parser.h | 2 ++ engines/avalanche/trip6.cpp | 25 ++++++++----------------- engines/avalanche/trip6.h | 4 ++-- 8 files changed, 90 insertions(+), 35 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index a8fb0a6a85b4..77f7b44f5e44 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -771,7 +771,7 @@ void Acci::lookaround() { void Acci::opendoor() { /* so whaddya THINK this does?! */ switch (_vm->_gyro->dna.room) { /* Special cases. */ case r__yours: - if (_vm->_trip->infield(1)) { + if (_vm->_trip->infield(2)) { /* Opening the box. */ thing = 54; /* The box. */ person = pardon; examine(); @@ -791,7 +791,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ return; /* No doors can open if you can't move Avvy. */ for (byte fv = 8; fv < 15; fv++) - if (_vm->_trip->infield(fv)) { + if (_vm->_trip->infield(fv + 1)) { fv -= 8; switch (_vm->_gyro->portals[fv].op) { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6968932cfb34..95f564e011ef 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -67,8 +67,11 @@ void Avalot::handleKeyDown(Common::Event &event) { // click(); // // To be implemented later with the sounds, I assume. + - if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) + if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) + _vm->_parser->handleFunctionKey(event); + else if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) _vm->_parser->handleInputText(event); else switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. @@ -211,13 +214,13 @@ void Avalot::setup() { void Avalot::run(Common::String arg) { setup(); - - do { uint32 beginLoop = _vm->_system->getMillis(); _vm->updateEvents(); // The event handler. + + _vm->_lucerna->clock_lucerna(); _vm->_dropdown->menu_link(); _vm->_trip->readstick(); @@ -226,24 +229,27 @@ void Avalot::run(Common::String arg) { _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_lucerna->checkclick(); - _vm->_timeout->one_tick(); - // Not in the original: + // ONLY FOR TESTING!!! + for (byte i = 0; i < _vm->_gyro->lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + + for (byte i = 0; i < _vm->_gyro->numfields; i++) { + if (_vm->_gyro->fields[i].x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + } + // ONYL FOR TESTING!!! + + _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. uint32 delay = _vm->_system->getMillis() - beginLoop; if (delay <= 55) _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). - - - - - - } while (! _vm->_gyro->lmo); //restorecrtmode(); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index a7305c9aa3c5..4ae61c2bf5d4 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -498,8 +498,34 @@ Common::String Gyro::get_better(byte which) { Common::String Gyro::f5_does() { - warning("STUB: Gyro::f5_does()"); - return "STUB: Gyro::f5_does()"; + Common::String f5_does_result; + switch (dna.room) { + case r__yours: { + if (!dna.avvy_is_awake) + return Common::String(_vm->_acci->vb_wake) + "WWake up"; + else if (dna.avvy_in_bed) + return Common::String(_vm->_acci->vb_stand) + "GGet up"; + } + break; + case r__insidecardiffcastle: + if (dna.standing_on_dais) + return Common::String(_vm->_acci->vb_climb) + "CClimb down"; + else + return Common::String(_vm->_acci->vb_climb) + "CClimb up"; + break; + case r__nottspub: + if (dna.sitting_in_pub) + return Common::String(_vm->_acci->vb_stand) + "SStand up"; + else + return Common::String(_vm->_acci->vb_sit) + "SSit down"; + break; + case r__musicroom: + if (_vm->_trip->infield(7)) + return Common::String(_vm->_acci->vb_play) + "PPlay the harp"; + break; + } + + return Common::String(_vm->_acci->pardon); /* If all else fails... */ } void Gyro::load_a_mouse(byte which) { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 277069d30e2e..48b17c43ccd1 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -549,7 +549,23 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__map: { - warning("STUB: Lucerna::enterroom() - case: r__map"); + /* You're entering the map. */ + dawn(); + //setactivepage(cp); + if (ped > 0) + zoomout(_vm->_gyro->peds[ped - 1].x, _vm->_gyro->peds[ped - 1].y); + //setactivepage(1 - cp); + + { + dnatype &with = _vm->_gyro->dna; + if ((_vm->_gyro->dna.obj[_vm->_gyro->wine]) && (_vm->_gyro->dna.winestate != 3)) { + _vm->_visa->dixi('q', 9); /* Don't want to waste the wine! */ + _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; + objectlist(); + } + } + + _vm->_visa->dixi('q', 69); } break; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index c996a304ebaa..d52ab868c3be 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -85,6 +85,20 @@ void Parser::handleReturn() { } } +void Parser::handleFunctionKey(const Common::Event &event) { + switch (event.kbd.keycode) { + case Common::KEYCODE_F5: { + _vm->_acci->person = _vm->_acci->pardon; + _vm->_acci->thing = _vm->_acci->pardon; + _vm->_lucerna->callverb(_vm->_gyro->f5_does()[0]); + } + break; + case Common::KEYCODE_F7: + _vm->_lucerna->callverb(_vm->_acci->vb_open); + break; + } +} + void Parser::plotText() { if (_vm->_gyro->mouse_near_text()) CursorMan.showMouse(false); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index cac8aa22b7e6..da2b76141792 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -52,6 +52,8 @@ class Parser { void handleReturn(); + void handleFunctionKey(const Common::Event &event); + void plotText(); void cursorOn(); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index d55567c64c16..7dbda47eea5d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1641,7 +1641,8 @@ void Trip::fliproom(byte room, byte ped) { } bool Trip::infield(byte which) { -/* returns True if you're within field "which" */ + which--; // Pascal -> C: different array indexes. + int16 yy = tr[0].y + tr[0]._info.yl; return (tr[0].x >= _vm->_gyro->fields[which].x1) && (tr[0].x <= _vm->_gyro->fields[which].x2) @@ -1649,29 +1650,19 @@ bool Trip::infield(byte which) { } -bool Trip::neardoor() { /* returns True if you're near a door! */ - int16 ux, uy; - byte fv; - bool nd; - - bool neardoor_result; +bool Trip::neardoor() { if (_vm->_gyro->numfields < 9) { /* there ARE no doors here! */ - neardoor_result = false; - return neardoor_result; + return false; } - ux = tr[1].x; - uy = tr[1].y + tr[1]._info.yl; - - nd = false; - for (fv = 9; fv <= _vm->_gyro->numfields; fv++) { - _vm->_gyro->fields[fv]; - + int16 ux = tr[0].x; + int16 uy = tr[0].y + tr[0]._info.yl; + bool nd = false; + for (byte fv = 9; fv <= _vm->_gyro->numfields; fv++) if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2) && (uy >= _vm->_gyro->fields[fv].y1) && (uy <= _vm->_gyro->fields[fv].y2)) nd = true; - } return nd; } diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 7c86b4012126..cc13c9bf7597 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -206,9 +206,9 @@ class Trip { void fliproom(byte room, byte ped); - bool infield(byte which); /* returns True if you're within field "which" */ + bool infield(byte which); // Returns true if you're within field "which". - bool neardoor(); /* returns True if you're near a door! */ + bool neardoor(); // Returns True if you're near a door. void readstick(); From f759584d3b4bf802163fde9c721fda5c6f36ff4d Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 23 Aug 2013 23:50:33 -0500 Subject: [PATCH 0637/1332] ZVISION: Make ZVision::_workingWindow and ZVision::_pixelFormat public --- engines/zvision/zvision.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 366e96f6a7f0..844b8ad18f03 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -64,6 +64,15 @@ class ZVision : public Engine { ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); ~ZVision(); +public: + /** + * A Rectangle centered inside the actual window. All in-game coordinates + * are given in this coordinate space. Also, all images are clipped to the + * edges of this Rectangle + */ + const Common::Rect _workingWindow; + const Graphics::PixelFormat _pixelFormat; + private: enum { WINDOW_WIDTH = 640, @@ -72,18 +81,11 @@ class ZVision : public Engine { WORKING_WINDOW_HEIGHT = 320, ROTATION_SCREEN_EDGE_OFFSET = 60, - MAX_ROTATION_SPEED = 150 // Pixels per second + MAX_ROTATION_SPEED = 250 // Pixels per second }; Console *_console; const ZVisionGameDescription *_gameDescription; - /** - * A Rectangle centered inside the actual window. All in-game coordinates - * are given in this coordinate space. Also, all images are clipped to the - * edges of this Rectangle - */ - const Common::Rect _workingWindow; - const Graphics::PixelFormat _pixelFormat; const int _desiredFrameTime; From b28d502288fe96657fadbf9679f67601583036b3 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 23 Aug 2013 23:53:19 -0500 Subject: [PATCH 0638/1332] ZVISION: Convert ScriptManager::_activeNodes to normal pointers instead of SharedPtrs --- engines/zvision/actions.cpp | 2 +- engines/zvision/script_manager.cpp | 11 ++++++----- engines/zvision/script_manager.h | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 16499138c712..baa89aa16555 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -354,7 +354,7 @@ ActionTimer::ActionTimer(const Common::String &line) { } bool ActionTimer::execute(ZVision *engine) { - engine->getScriptManager()->addActionNode(Common::SharedPtr(new NodeTimer(_key, _time))); + engine->getScriptManager()->addActionNode(new TimerNode(engine, _key, _time)); return true; } diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index c217cb8612a8..9a4e9d13be9d 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -108,9 +108,10 @@ void ScriptManager::createReferenceTable() { void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted - for (Common::List >::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { - if ((*iter)->process(_engine, deltaTimeMillis)) { - // Remove the node from _activeNodes, the SharedPtr destructor will delete the actual ActionNode + for (Common::List::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { + if ((*iter)->process(deltaTimeMillis)) { + // Delete the node then remove the pointer + delete (*iter); iter = _activeNodes.erase(iter); } else { iter++; @@ -223,11 +224,11 @@ bool ScriptManager::disableControl(uint32 key) { if (!_activeControls.contains(key)) { return false; } else { - return _activeControls[key]->disable(_engine); + return _activeControls[key]->disable(); } } -void ScriptManager::addActionNode(const Common::SharedPtr &node) { +void ScriptManager::addActionNode(ActionNode *node) { _activeNodes.push_back(node); } diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 2372703cbeb7..28bce07dc88a 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -61,7 +61,7 @@ class ScriptManager { */ Common::HashMap _globalState; /** Holds the currently active ActionNodes */ - Common::List > _activeNodes; + Common::List _activeNodes; /** References _globalState keys to Puzzles */ Common::HashMap > _referenceTable; /** Holds the Puzzles that should be checked this frame */ @@ -88,7 +88,7 @@ class ScriptManager { bool enableControl(uint32 key); bool disableControl(uint32 key); - void addActionNode(const Common::SharedPtr &node); + void addActionNode(ActionNode *node); void changeLocation(char world, char room, char node, char view, uint32 offset); From adb3bd7b711ba9daf62e06bbe55d2ca55e5219b4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 23 Aug 2013 23:58:14 -0500 Subject: [PATCH 0639/1332] ZVISION: Make MouseEvent purely virtual --- engines/zvision/module.mk | 1 - engines/zvision/mouse_event.cpp | 45 --------------------------------- engines/zvision/mouse_event.h | 36 +++++++++++++------------- 3 files changed, 17 insertions(+), 65 deletions(-) delete mode 100644 engines/zvision/mouse_event.cpp diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 317e4b11d454..a4b7c68cdecc 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -12,7 +12,6 @@ MODULE_OBJS := \ detection.o \ events.o \ lzss_read_stream.o \ - mouse_event.o \ render_manager.o \ render_table.o \ rlf_animation.o \ diff --git a/engines/zvision/mouse_event.cpp b/engines/zvision/mouse_event.cpp deleted file mode 100644 index a7c9fe557391..000000000000 --- a/engines/zvision/mouse_event.cpp +++ /dev/null @@ -1,45 +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/scummsys.h" - -#include "zvision/zvision.h" -#include "zvision/script_manager.h" -#include "zvision/mouse_event.h" - -namespace ZVision { - -MouseEvent::MouseEvent(uint32 key, const Common::Rect &hotspot, const Common::String hoverCursor) - : _key(key), - _hotspot(hotspot), - _hoverCursor(hoverCursor) { -} - -bool MouseEvent::withinHotspot(const Common::Point &point) { - return _hotspot.contains(point); -} - -void MouseEvent::onClick(ZVision *engine) { - engine->getScriptManager()->setStateValue(_key, 1); -} - -} // End of namespace ZVision diff --git a/engines/zvision/mouse_event.h b/engines/zvision/mouse_event.h index 90a093f894b1..fe81adaf1959 100644 --- a/engines/zvision/mouse_event.h +++ b/engines/zvision/mouse_event.h @@ -35,37 +35,35 @@ class ZVision; class MouseEvent { public: MouseEvent() : _key(0) {} - MouseEvent(uint32 key, const Common::Rect &hotspot, const Common::String hoverCursor); + MouseEvent(uint32 key) : _key(key) {} + virtual ~MouseEvent() {} - /** The Control key */ +public: uint32 _key; - /** - * The area that will trigger the event - * This is in image space coordinates, NOT screen space - */ - Common::Rect _hotspot; - /** The cursor to use when hovering over _hotspot */ - Common::String _hoverCursor; +public: /** - * Does a simple Rect::contains() using _hotspot + * Called when LeftMouse is pushed. * - * @param point The point to check against _hotspot - * @return The point is inside _hotspot (true) or not (false) + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space */ - bool withinHotspot(const Common::Point &point); + virtual void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; /** - * Calls ScriptManager::setStateValue(_key, 1) + * Called when LeftMouse is lifted. * - * @param engine The base engine + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space */ - void onClick(ZVision *engine); + virtual void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; /** - * Gets the name of the cursor that should be displayed when withinHotspot returns true + * Called on every MouseMove. * - * @return The name of the cursor. This should correspond to one of the names in CursorManager::_cursorNames[] + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + * @return Was the cursor changed? */ - const Common::String getHoverCursor() { return _hoverCursor; } + virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; }; } // End of namespace ZVision From 2431f60c02197585bd252393a013f8e50a2ae30a Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 23 Aug 2013 23:59:28 -0500 Subject: [PATCH 0640/1332] ZVISION: Make Control purely virtual --- engines/zvision/control.h | 9 +++------ engines/zvision/script_manager.cpp | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 32a2b863b009..17408c79f11a 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -37,13 +37,10 @@ class ZVision; class Control { public: - Control() : _key(0), _enabled(false) {} + Control() : _enabled(false) {} virtual ~Control() {} - virtual bool enable(ZVision *engine) = 0; - virtual bool disable(ZVision *engine) { return true; } - -public: - uint32 _key; + virtual bool enable() = 0; + virtual bool disable() = 0; protected: bool _enabled; diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 9a4e9d13be9d..d671c6178c62 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -216,7 +216,7 @@ bool ScriptManager::enableControl(uint32 key) { if (!_activeControls.contains(key)) { return false; } else { - return _activeControls[key]->enable(_engine); + return _activeControls[key]->enable(); } } @@ -272,7 +272,7 @@ void ScriptManager::changeLocationIntern() { // Enable all the controls for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { - (*iter)._value->enable(_engine); + (*iter)._value->enable(); } // Add all the local puzzles to the queue to be checked From 7095e613d59630ec03dbf8a17e18ae9b4aabf289 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:00:30 -0500 Subject: [PATCH 0641/1332] ZVISION: Keep a member variable ZVision pointer instead of passing it in every process() --- engines/zvision/action_node.cpp | 9 +++++---- engines/zvision/action_node.h | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp index 1a51690b3f18..f51801a75d7a 100644 --- a/engines/zvision/action_node.cpp +++ b/engines/zvision/action_node.cpp @@ -28,14 +28,15 @@ namespace ZVision { -NodeTimer::NodeTimer(uint32 key, uint timeInSeconds) - : _key(key), _timeLeft(timeInSeconds * 1000) {} +TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) + : _engine(engine), _key(key), _timeLeft(timeInSeconds * 1000) { +} -bool NodeTimer::process(ZVision *engine, uint32 deltaTimeInMillis) { +bool TimerNode::process(uint32 deltaTimeInMillis) { _timeLeft -= deltaTimeInMillis; if (_timeLeft <= 0) { - engine->getScriptManager()->setStateValue(_key, 0); + _engine->getScriptManager()->setStateValue(_key, 0); return true; } diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index 5b4430c3a43c..9a5ca0be0bc6 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -32,23 +32,29 @@ class ZVision; class ActionNode { public: virtual ~ActionNode() {} - virtual bool process(ZVision *engine, uint32 deltaTimeInMillis) = 0; + /** + * Processes the node given the deltaTime since last frame + * + * @param deltaTimeInMillis The number of milliseconds that have passed since last frame + * @return If true, the node can be deleted after process() finishes + */ + virtual bool process(uint32 deltaTimeInMillis) = 0; }; -class NodeTimer : public ActionNode { +class TimerNode : public ActionNode { public: - NodeTimer(uint32 key, uint timeInSeconds); + TimerNode(ZVision *engine, uint32 key, uint timeInSeconds); /** * Decrement the timer by the delta time. If the timer is finished, set the status * in _globalState and let this node be deleted * - * @param engine Pointer to the ZVision instance - * @param deltaTimeInMillis Amount of time that has passed since the last frame - * @return Node should be deleted after this (true) or kept (false) + * @param deltaTimeInMillis The number of milliseconds that have passed since last frame + * @return If true, the node can be deleted after process() finishes */ - bool process(ZVision *engine, uint32 deltaTimeInMillis); + bool process(uint32 deltaTimeInMillis); private: + ZVision *_engine; uint32 _key; uint32 _timeLeft; }; From 3054489a8bcc9604028ac16a0b074e13bff258eb Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:06:20 -0500 Subject: [PATCH 0642/1332] ZVISION: Have PushToggleControl inherit from MouseEvent and handle the methods internally. Rather than creating an instance of MouseEvent and passing argument around. --- engines/zvision/control.cpp | 33 ++++++++++++------- engines/zvision/control.h | 47 ++++++++++++++++++++++++--- engines/zvision/scr_file_handling.cpp | 2 +- 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 94e0c477ab81..ff767863f400 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -108,10 +108,9 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre // PushToggleControl ////////////////////////////////////////////////////////////////////////////// -PushToggleControl::PushToggleControl(uint32 key, Common::SeekableReadStream &stream) - : Control() { - _event._key = _key = key; - +PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : MouseEvent(key), + _engine(engine) { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -125,27 +124,27 @@ PushToggleControl::PushToggleControl(uint32 key, Common::SeekableReadStream &str sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height); - _event._hotspot = Common::Rect(x, y, x + width, y + height); + _hotspot = Common::Rect(x, y, x + width, y + height); } else if (line.matchString("cursor*", true)) { char nameBuffer[25]; sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer); - _event._hoverCursor = Common::String(nameBuffer); + _hoverCursor = Common::String(nameBuffer); } line = stream.readLine(); trimCommentsAndWhiteSpace(&line); } - if (_event._hotspot.isEmpty() || _event._hoverCursor.empty()) { + if (_hotspot.isEmpty() || _hoverCursor.empty()) { warning("Push_toggle cursor %u was parsed incorrectly", key); } } -bool PushToggleControl::enable(ZVision *engine) { +bool PushToggleControl::enable() { if (!_enabled) { - engine->registerMouseEvent(_event); + _engine->registerMouseEvent(this); _enabled = true; return true; } @@ -154,9 +153,9 @@ bool PushToggleControl::enable(ZVision *engine) { return false; } -bool PushToggleControl::disable(ZVision *engine) { +bool PushToggleControl::disable() { if (_enabled) { - engine->removeMouseEvent(_key); + _engine->removeMouseEvent(_key); _enabled = false; return true; } @@ -165,4 +164,16 @@ bool PushToggleControl::disable(ZVision *engine) { return false; } +void PushToggleControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + _engine->getScriptManager()->setStateValue(_key, 1); +} + +bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + if (_hotspot.contains(backgroundImageSpacePos)) { + _engine->getCursorManager()->changeCursor(_hoverCursor); + return true; + } + + return false; +} } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 17408c79f11a..28079d52e7de 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -52,14 +52,51 @@ class Control { static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); }; -class PushToggleControl : public Control { + +class PushToggleControl : public Control, public MouseEvent { +public: + PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + bool enable(); + bool disable(); + + /** + * Called when LeftMouse is pushed. Calls ScriptManager::setStateValue(_key, 1); + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + /** + * Called when LeftMouse is lifted. Does nothing + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) {} + /** + * Called on every MouseMove. Tests if the mouse is inside _hotspot, and if so, sets the cursor. + * + * @param engine The base engine + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + * @return Was the cursor changed? + */ + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + +private: + ZVision * _engine; + /** + * The area that will trigger the event + * This is in image space coordinates, NOT screen space + */ + Common::Rect _hotspot; + /** The cursor to use when hovering over _hotspot */ + Common::String _hoverCursor; +}; + public: - PushToggleControl(uint32 key, Common::SeekableReadStream &stream); - bool enable(ZVision *engine); - bool disable(ZVision *engine); private: - MouseEvent _event; }; // TODO: Implement InputControl diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 7ccd939e549d..921c1d5b4427 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -278,7 +278,7 @@ void ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea Common::String controlType(controlTypeBuffer); if (controlType.equalsIgnoreCase("push_toggle")) { - _activeControls[key] = new PushToggleControl(key, stream); + _activeControls[key] = new PushToggleControl(_engine, key, stream); return; } else if (controlType.equalsIgnoreCase("flat")) { Control::parseFlatControl(_engine); From 0da3d3e5eb3c332f943a63fea4e3777fb24ba577 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:09:15 -0500 Subject: [PATCH 0643/1332] ZVISION: Convert _mouseEvents to pointers since MouseEvent is now abstract --- engines/zvision/events.cpp | 35 ++++++++++++++++++----------------- engines/zvision/zvision.h | 4 ++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 798d75b37526..f751d023860a 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -37,14 +37,14 @@ namespace ZVision { -void ZVision::registerMouseEvent(const MouseEvent &event) { +void ZVision::registerMouseEvent(MouseEvent *event) { _mouseEvents.push_back(event); } bool ZVision::removeMouseEvent(const uint32 key) { - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - if ((*iter)._key == key) { - _scriptManager->setStateValue((*iter)._key, 0); + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + if ((*iter)->_key == key) { + _scriptManager->setStateValue((*iter)->_key, 0); _mouseEvents.erase(iter); return true; } @@ -55,8 +55,10 @@ bool ZVision::removeMouseEvent(const uint32 key) { void ZVision::clearAllMouseEvents() { // Clear the state values of all the events - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - _scriptManager->setStateValue((*iter)._key, 0); + // Then delete the nodes + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + _scriptManager->setStateValue((*iter)->_key, 0); + delete (*iter); } _mouseEvents.clear(); @@ -117,6 +119,12 @@ void ZVision::processEvents() { void ZVision::onMouseDown(const Common::Point &pos) { _cursorManager->cursorDown(true); + + Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); + + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + (*iter)->onMouseDown(pos, imageCoord); + } } void ZVision::onMouseUp(const Common::Point &pos) { @@ -124,10 +132,8 @@ void ZVision::onMouseUp(const Common::Point &pos) { Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - if (iter->withinHotspot(imageCoord)) { - iter->onClick(this); - } + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + (*iter)->onMouseUp(pos, imageCoord); } } @@ -135,13 +141,8 @@ void ZVision::onMouseMove(const Common::Point &pos) { Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); bool isWithinAHotspot = false; - if (_workingWindow.contains(pos)) { - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - if (iter->withinHotspot(imageCoord)) { - _cursorManager->changeCursor(iter->getHoverCursor()); - isWithinAHotspot = true; - } - } + for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { + cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(pos, imageCoord); } // Graph of the function governing rotation velocity: diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 844b8ad18f03..84e4da9d201e 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -101,7 +101,7 @@ class ZVision : public Engine { Clock _clock; // To store the current mouse events - Common::List _mouseEvents; + Common::List _mouseEvents; // To prevent allocation every time we process events Common::Event _event; @@ -137,7 +137,7 @@ class ZVision : public Engine { * * @param event The event to register */ - void registerMouseEvent(const MouseEvent &event); + void registerMouseEvent(MouseEvent *event); bool removeMouseEvent(const uint32 key); From aed38867ceb4fc13f221322aae15054fece7cff2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:10:34 -0500 Subject: [PATCH 0644/1332] ZVISION: Change variable name to match its purpose --- engines/zvision/events.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index f751d023860a..94e8f088dd60 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -140,7 +140,7 @@ void ZVision::onMouseUp(const Common::Point &pos) { void ZVision::onMouseMove(const Common::Point &pos) { Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); - bool isWithinAHotspot = false; + bool cursorWasChanged = false; for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(pos, imageCoord); } @@ -184,14 +184,14 @@ void ZVision::onMouseMove(const Common::Point &pos) { Common::Rational velocity = (Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.x - _workingWindow.left)) - MAX_ROTATION_SPEED; _renderManager->setBackgroundVelocity(velocity.toInt()); _cursorManager->setLeftCursor(); - isWithinAHotspot = true; + cursorWasChanged = true; } else if (pos.x <= _workingWindow.right && pos.x > _workingWindow.right - ROTATION_SCREEN_EDGE_OFFSET) { // Linear function of distance to the right edge (y = mx) // We use fixed point math to get better accuracy Common::Rational velocity = Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.x - _workingWindow.right + ROTATION_SCREEN_EDGE_OFFSET); _renderManager->setBackgroundVelocity(velocity.toInt()); _cursorManager->setRightCursor(); - isWithinAHotspot = true; + cursorWasChanged = true; } else { _renderManager->setBackgroundVelocity(0); } @@ -202,14 +202,14 @@ void ZVision::onMouseMove(const Common::Point &pos) { Common::Rational velocity = (Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.y - _workingWindow.top)) - MAX_ROTATION_SPEED; _renderManager->setBackgroundVelocity(velocity.toInt()); _cursorManager->setUpCursor(); - isWithinAHotspot = true; + cursorWasChanged = true; } else if (pos.y <= _workingWindow.bottom && pos.y > _workingWindow.bottom - ROTATION_SCREEN_EDGE_OFFSET) { // Linear function of distance to the bottom edge (y = mx) // We use fixed point math to get better accuracy Common::Rational velocity = Common::Rational(MAX_ROTATION_SPEED, ROTATION_SCREEN_EDGE_OFFSET) * (pos.y - _workingWindow.bottom + ROTATION_SCREEN_EDGE_OFFSET); _renderManager->setBackgroundVelocity(velocity.toInt()); _cursorManager->setDownCursor(); - isWithinAHotspot = true; + cursorWasChanged = true; } else { _renderManager->setBackgroundVelocity(0); } @@ -218,7 +218,7 @@ void ZVision::onMouseMove(const Common::Point &pos) { _renderManager->setBackgroundVelocity(0); } - if (!isWithinAHotspot) { + if (!cursorWasChanged) { _cursorManager->revertToIdle(); } } From 6610ca1b82a1e335eecf139aaa4ba062574f48b7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:14:25 -0500 Subject: [PATCH 0645/1332] ZVISION: Fix error: decrementing instead of incrementing --- engines/zvision/rlf_animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 2b37ff147e40..52ca96f0e1c6 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -195,7 +195,7 @@ const uint16 *RlfAnimation::getNextFrame() { applyFrameToCurrent(_currentFrame + 1); } - _currentFrame -= 1; + _currentFrame++; return _currentFrameBuffer; } @@ -204,7 +204,7 @@ const uint16 *RlfAnimation::getPreviousFrame() { assert(_currentFrame - 1 >= 0); applyFrameToCurrent(_currentFrame - 1); - _currentFrame =- 1; + _currentFrame--; return _currentFrameBuffer; } From c6242e71344d260af49cf5b2368a16d8679aac45 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:14:53 -0500 Subject: [PATCH 0646/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 09d0bac71e8b..d49e6a939591 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -78,7 +78,7 @@ class RlfAnimation { const uint16 *getNextFrame(); const uint16 *getPreviousFrame(); - bool endOfAnimation() { return _currentFrame == _frameCount - 1; } + bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } private: bool readHeader(); From d2df3eb24ea68eec5538fac73829b168f747e7a6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:16:59 -0500 Subject: [PATCH 0647/1332] ZVISION: Check if we can use getNextFrame() or getPreviousFrame() before using getFrameData() --- engines/zvision/rlf_animation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 52ca96f0e1c6..5c0a88a18f9b 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -157,8 +157,14 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { assert(!_stream); assert(frameNumber < _frameCount && frameNumber >= 0); + // Since this method is so expensive, first check to see if we can use + // getNextFrame() or getPreviousFrame() since they are cheap. if (frameNumber == _currentFrame) { return _currentFrameBuffer; + } else if (_currentFrame + 1 == frameNumber) { + return getNextFrame(); + } else if (_currentFrame - 1 == frameNumber) { + return getPreviousFrame(); } uint closestFrame = _currentFrame; From 0ed7df9a3632207d65f3aef11d5f07e185484207 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:18:02 -0500 Subject: [PATCH 0648/1332] ZVISION: Add TODO's about the verbosity of the frame decoding overflow warning --- engines/zvision/rlf_animation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 5c0a88a18f9b..905a540924fc 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -247,6 +247,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { + // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -264,6 +265,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { + // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -290,6 +292,7 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { + // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -314,6 +317,7 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 numberOfSamples += 2; while (numberOfSamples > 0) { if (destOffset + 1 >= destSize) { + // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } From fc5727c522d4313ab1912a52898405d083c60363 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:24:43 -0500 Subject: [PATCH 0649/1332] ZVISION: Fix memory leak We no longer use SharedPtr --- engines/zvision/script_manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index d671c6178c62..bcede2060dac 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -253,7 +253,9 @@ void ScriptManager::changeLocationIntern() { delete (*iter); } _activePuzzles.clear(); - // We can clear without deleting from the heap because we use SharedPtr + for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + delete (*iter)._value; + } _activeControls.clear(); _engine->clearAllMouseEvents(); From a9db1e17124639dfbd856f59afbf396d3c60452b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:25:01 -0500 Subject: [PATCH 0650/1332] ZVISION: Add note about _activeNodes --- engines/zvision/script_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index bcede2060dac..50d7e58091fa 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -258,6 +258,7 @@ void ScriptManager::changeLocationIntern() { } _activeControls.clear(); _engine->clearAllMouseEvents(); + // TODO: See if we need to clear _activeNodes as well. And if so, remember to delete the nodes before clearing the list // Revert to the idle cursor _engine->getCursorManager()->revertToIdle(); From a596d1241cf0b443d3c2f8099546bc620116dcb2 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:25:21 -0500 Subject: [PATCH 0651/1332] ZVISION: Add console method to dump all .lev files --- engines/zvision/console.cpp | 13 +++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 14 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 69d19ab53a0e..fd8347e74fe9 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -53,6 +53,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); DCmd_Register("dumpcursorfilenames", WRAP_METHOD(Console, cmdDumpAllCursorFileNames)); DCmd_Register("showcursor", WRAP_METHOD(Console, cmdShowCursor)); + DCmd_Register("dumpalllevfiles", WRAP_METHOD(Console, cmdDumpAllLevFiles)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -212,4 +213,16 @@ bool Console::cmdShowCursor(int argc, const char **argv) { return true; } +bool Console::cmdDumpAllLevFiles(int argc, const char **argv) { + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.lev"); + + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + Common::String fileName = (*iter)->getName(); + writeFileContentsToFile(fileName, fileName); + } + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 995c41881ed8..e518467438de 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -49,6 +49,7 @@ class Console : public GUI::Debugger { bool cmdDumpFile(int argc, const char **argv); bool cmdDumpAllCursorFileNames(int argc, const char **argv); bool cmdShowCursor(int argc, const char **argv); + bool cmdDumpAllLevFiles(int argc, const char **argv); }; } // End of namespace ZVision From 7d48a3e4b129784c7870472cbbaf6fa9488fffe6 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:25:55 -0500 Subject: [PATCH 0652/1332] ZVISION: Partially implement LeverControl --- engines/zvision/control.cpp | 323 ++++++++++++++++++++++++++++++++++++ engines/zvision/control.h | 88 +++++++++- 2 files changed, 410 insertions(+), 1 deletion(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index ff767863f400..9a1d52bd4fb9 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -23,16 +23,25 @@ #include "common/scummsys.h" #include "common/stream.h" +#include "common/system.h" +#include "common/tokenizer.h" #include "zvision/zvision.h" #include "zvision/render_manager.h" #include "zvision/render_table.h" #include "zvision/script_manager.h" +#include "zvision/cursor_manager.h" #include "zvision/control.h" #include "zvision/utility.h" +#include "zvision/rlf_animation.h" +#include "zvision/zork_avi_decoder.h" namespace ZVision { +////////////////////////////////////////////////////////////////////////////// +// Static member functions +////////////////////////////////////////////////////////////////////////////// + void Control::parseFlatControl(ZVision *engine) { engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT); } @@ -176,4 +185,318 @@ bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const C return false; } + +////////////////////////////////////////////////////////////////////////////// +// LeverControl +////////////////////////////////////////////////////////////////////////////// + +LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : MouseEvent(key), + _engine(engine), + _frameInfo(0), + _frameCount(0), + _startFrame(0), + _currentFrame(0), + _mouseIsCaptured(false), + _isReturning(false) { + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream.eos() && !line.contains('}')) { + if (line.matchString("*descfile*", true)) { + char levFileName[25]; + sscanf(line.c_str(), "%*[^(](%25[^)])", levFileName); + + parseLevFile(levFileName); + } else if (line.matchString("*cursor*", true)) { + char cursorName[25]; + sscanf(line.c_str(), "%*[^(](%25[^)])", cursorName); + + _cursorName = Common::String(cursorName); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } + + renderFrame(_currentFrame); + + _engine->getScriptManager()->addActionNode(this); +} + +LeverControl::~LeverControl() { + if (_fileType == AVI) { + delete _animation.avi; + } else if (_fileType == RLF) { + delete _animation.rlf; + } + if (_frameInfo != 0) { + delete[] _frameInfo; + } +} + +void LeverControl::parseLevFile(const Common::String &fileName) { + Common::File file; + if (!file.open(fileName)) { + warning("LEV file %s could could be opened", fileName.c_str()); + return; + } + + Common::String line = file.readLine(); + + while (!file.eos()) { + if (line.matchString("*animation_id*", true)) { + // Not used + } else if (line.matchString("*filename*", true)) { + char fileNameBuffer[25]; + sscanf(line.c_str(), "%*[^:]:%25[^~]~", fileNameBuffer); + + Common::String fileName(fileNameBuffer); + + if (fileName.hasSuffix(".avi")) { + _animation.avi = new ZorkAVIDecoder(); + _animation.avi->loadFile(fileName); + } else if (fileName.hasSuffix(".rlf")) { + _animation.rlf = new RlfAnimation(fileNameBuffer, false); + } + } else if (line.matchString("*skipcolor*", true)) { + // Not used + } else if (line.matchString("*anim_coords*", true)) { + sscanf(line.c_str(), "%*[^:]:%u %u %u %u~", &_animationCoords.left, &_animationCoords.top, &_animationCoords.right, &_animationCoords.bottom); + } else if (line.matchString("*mirrored*", true)) { + uint mirrored; + sscanf(line.c_str(), "%*[^:]:%u~", &mirrored); + + _mirrored = mirrored == 0 ? false : true; + } else if (line.matchString("*frames*", true)) { + sscanf(line.c_str(), "%*[^:]:%u~", &_frameCount); + + _frameInfo = new FrameInfo[_frameCount]; + } else if (line.matchString("*elsewhere*", true)) { + // Not used + } else if (line.matchString("*out_of_control*", true)) { + // Not used + } else if (line.matchString("*start_pos*", true)) { + sscanf(line.c_str(), "%*[^:]:%u~", &_startFrame); + _currentFrame = _startFrame; + } else if (line.matchString("*hotspot_deltas*", true)) { + uint x; + uint y; + sscanf(line.c_str(), "%*[^:]:%u %u~", &x, &y); + + _hotspotDelta.x = x; + _hotspotDelta.y = y; + } else { + uint frameNumber; + uint x, y; + + if (sscanf(line.c_str(), "%u:%u %u", &frameNumber, &x, &y) == 3) { + _frameInfo[frameNumber].hotspot.left = x; + _frameInfo[frameNumber].hotspot.top = y; + _frameInfo[frameNumber].hotspot.right = x + _hotspotDelta.x; + _frameInfo[frameNumber].hotspot.bottom = y + _hotspotDelta.y; + } + + Common::StringTokenizer tokenizer(line, " ^="); + tokenizer.nextToken(); + tokenizer.nextToken(); + + Common::String token = tokenizer.nextToken(); + while (!tokenizer.empty()) { + if (token == "D") { + token = tokenizer.nextToken(); + + uint angle; + uint toFrame; + sscanf(token.c_str(), "%u,%u", &toFrame, &angle); + + _frameInfo[frameNumber].directions.push_back(Direction(angle, toFrame)); + } else if (token.hasPrefix("P")) { + uint to; + sscanf(token.c_str(), "P(%*u to %u)", &to); + + _frameInfo[frameNumber].returnRoute.push_back(to); + } + + token = tokenizer.nextToken(); + } + } + + line = file.readLine(); + } +} + +void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + _mouseIsCaptured = true; + _lastMousePos = backgroundImageSpacePos; + } +} + +void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + _mouseIsCaptured = false; + _engine->getScriptManager()->setStateValue(_key, _currentFrame); + + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + + } + + // TODO: Animation reversal back to origin +} + +bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + bool cursorWasChanged = false; + + if (_mouseIsCaptured) { + // Make sure the square distance between the last point and the current point is greater than 64 + // This is a heuristic. This determines how responsive the lever is to mouse movement. + // TODO: Fiddle with the heuristic to get a good lever responsiveness 'feel' + if (_lastMousePos.sqrDist(backgroundImageSpacePos) >= 64) { + int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos); + _lastMousePos = backgroundImageSpacePos; + + for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { + if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle) { + _currentFrame = (*iter).toFrame; + renderFrame(_currentFrame); + break; + } + } + } + } else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + _engine->getCursorManager()->changeCursor(_cursorName); + } + + return cursorWasChanged; +} + +bool LeverControl::process(uint32 deltaTimeInMillis) { + // TODO: Implement reversal over time + + return false; +} + +int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo) { + // Check for the easy angles first + if (pointOne.x == pointTwo.x && pointOne.y == pointTwo.y) + return -1; // This should never happen + else if (pointOne.x == pointTwo.x) { + if (pointTwo.y > pointOne.y) + return 90; + else + return 270; + } else if (pointOne.y == pointTwo.y) { + if (pointTwo.x > pointOne.x) + return 0; + else + return 180; + } else { + // Calculate the angle with trig + int16 xDist = pointTwo.x - pointOne.x; + int16 yDist = pointTwo.y - pointOne.y; + + int angle = int(atan((float)yDist / (float)xDist)); + + // Convert to degrees. (180 / 3.14159 = 57.2958) + angle *= 57; + + // Calculate what quadrant pointTwo is in + uint quadrant = ((yDist > 0 ? 1 : 0) << 1) | (xDist < 0 ? 1 : 0); + + // Explanation of quadrants: + // + // yDist > 0 | xDist < 0 | Quadrant number + // 0 | 0 | 0 + // 0 | 1 | 1 + // 1 | 0 | 2 + // 1 | 1 | 3 + // + // Note: I know this doesn't line up with traditional mathematical quadrants + // but doing it this way allows you can use a switch and is a bit cleaner IMO. + // + // The graph below shows the 4 quadrants pointTwo can end up in as well + // as what the angle as calculated above refers to. + // Note: The calculated angle in quadrants 0 and 3 is negative + // due to arctan(-x) = -theta + // + // Origin => (pointOne.x, pointOne.y) + // * => (pointTwo.x, pointTwo.y) + // + // 90 + // ^ + // * | * + // \ | / + // \ | / + // \ | / + // Quadrant 3 \ | / Quadrant 2 + // \ | / + // \ | / + // -angle ( \|/ ) angle + // 180 <----------------------------------------> 0 + // angle ( /|\ ) -angle + // / | \ + // / | \ + // Quadrant 1 / | \ Quadrant 0 + // / | \ + // / | \ + // / | \ + // * | * + // ^ + // 270 + + // Convert the local angles to unit circle angles + switch (quadrant) { + case 0: + angle = 360 + angle; + break; + case 1: + angle = 180 + angle; + break; + case 2: + angle = 180 + angle; + break; + case 3: + // Do nothing + break; + } + + return angle; + } +} + +void LeverControl::renderFrame(uint frameNumber) { + const uint16 *frameData; + int pitch; + int x; + int y; + int width; + int height; + + if (_fileType == RLF) { + // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can + frameData = _animation.rlf->getFrameData(_currentFrame); + pitch = _animation.rlf->width() * sizeof(uint16); + x = _animationCoords.left; + y = _animationCoords.right; + width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() + height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() + } else if (_fileType == AVI) { + // Cry because AVI seeking isn't implemented (yet) + } + + _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); +} + +bool LeverControl::enable() { + // TODO: Implement + return true; +} + +bool LeverControl::disable() { + // TODO: Implement + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 28079d52e7de..d764f914bb6f 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -26,6 +26,7 @@ #include "common/types.h" #include "zvision/mouse_event.h" +#include "zvision/action_node.h" namespace Common { class SeekableReadStream; @@ -34,6 +35,8 @@ class SeekableReadStream; namespace ZVision { class ZVision; +class RlfAnimation; +class ZorkAVIDecoder; class Control { public: @@ -94,15 +97,98 @@ class PushToggleControl : public Control, public MouseEvent { Common::String _hoverCursor; }; + +class LeverControl : public Control, public MouseEvent, public ActionNode { public: + LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + ~LeverControl(); + +private: + enum FileType { + RLF = 1, + AVI = 2 + }; + + struct Direction { + Direction(uint angle, uint toFrame) : angle(angle), toFrame(toFrame) {} + + uint angle; + uint toFrame; + }; + + struct FrameInfo { + Common::Rect hotspot; + Common::List directions; + Common::List returnRoute; + }; + + enum { + ANGLE_DELTA = 30 // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) + }; private: + ZVision *_engine; + + union { + RlfAnimation *rlf; + ZorkAVIDecoder *avi; + } _animation; + FileType _fileType; + + Common::String _cursorName; + Common::Rect _animationCoords; + bool _mirrored; + uint _frameCount; + uint _startFrame; + Common::Point _hotspotDelta; + FrameInfo *_frameInfo; + + uint _currentFrame; + bool _mouseIsCaptured; + bool _isReturning; + Common::Point _lastMousePos; + Common::List::iterator _returnRoutesCurrentProgress; + +public: + bool enable(); + bool disable(); + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + bool process(uint32 deltaTimeInMillis); + +private: + void parseLevFile(const Common::String &fileName); + /** + * Calculates the angle a vector makes with the negative y-axis + * + * 90 + * pointTwo * ^ + * \ | + * \ | + * \ | + * \ | + * angle ( \|pointOne + * 180 <-----------*-----------> 0 + * | + * | + * | + * | + * | + * ^ + * 270 + * + * @param pointOne The origin of the vector + * @param pointTwo The end of the vector + * @return The angle the vector makes with the negative y-axis + */ + static int calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo); + void renderFrame(uint frameNumber); }; // TODO: Implement InputControl // TODO: Implement SaveControl // TODO: Implement SlotControl -// TODO: Implement LeverControl // TODO: Implement SafeControl // TODO: Implement FistControl // TODO: Implement HotMovieControl From af762dc41799bd08138a1f8fbcb7b441c4a03480 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 00:32:33 -0500 Subject: [PATCH 0653/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 905a540924fc..c95a8640c1ae 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -159,11 +159,11 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { // Since this method is so expensive, first check to see if we can use // getNextFrame() or getPreviousFrame() since they are cheap. - if (frameNumber == _currentFrame) { + if ((int)frameNumber == _currentFrame) { return _currentFrameBuffer; - } else if (_currentFrame + 1 == frameNumber) { + } else if (_currentFrame + 1 == (int)frameNumber) { return getNextFrame(); - } else if (_currentFrame - 1 == frameNumber) { + } else if (_currentFrame - 1 == (int)frameNumber) { return getPreviousFrame(); } From 5ff032c27d5110ebd8b6f73e0c822eba2245246b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 01:11:10 -0500 Subject: [PATCH 0654/1332] ZVISION: Cast completeFrame and frameNumber to int so their difference can go negative --- engines/zvision/rlf_animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index c95a8640c1ae..ff855a1a3958 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -168,9 +168,9 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } uint closestFrame = _currentFrame; - uint distance = ABS(_currentFrame - frameNumber); + int distance = ABS(_currentFrame - (int)frameNumber); for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { - uint newDistance = ABS((*iter) - frameNumber); + int newDistance = ABS((int)(*iter) - (int)frameNumber); if (closestFrame == -1 || newDistance < distance) { closestFrame = (*iter); distance = newDistance; From 9d8243245c8b7f21333a54479a9c5354686faa03 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 01:11:25 -0500 Subject: [PATCH 0655/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index ff855a1a3958..6b6120fb63ad 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -193,7 +193,7 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } const uint16 *RlfAnimation::getNextFrame() { - assert(_currentFrame + 1 < _frameCount); + assert(_currentFrame + 1 < (int)_frameCount); if (_stream) { applyFrameToCurrent(readNextFrame()); From ff97bb2eadcd26abb9a085f266e33b76594d2a21 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 24 Aug 2013 01:47:12 -0500 Subject: [PATCH 0656/1332] ZVISION: Move PushToggleControl and LeverControl to their own files --- engines/zvision/control.cpp | 401 +----------------------- engines/zvision/control.h | 136 -------- engines/zvision/lever_control.cpp | 349 +++++++++++++++++++++ engines/zvision/lever_control.h | 130 ++++++++ engines/zvision/module.mk | 2 + engines/zvision/push_toggle_control.cpp | 104 ++++++ engines/zvision/push_toggle_control.h | 77 +++++ engines/zvision/scr_file_handling.cpp | 1 + 8 files changed, 665 insertions(+), 535 deletions(-) create mode 100644 engines/zvision/lever_control.cpp create mode 100644 engines/zvision/lever_control.h create mode 100644 engines/zvision/push_toggle_control.cpp create mode 100644 engines/zvision/push_toggle_control.h diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 9a1d52bd4fb9..1cef2a0ab82d 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -23,24 +23,14 @@ #include "common/scummsys.h" #include "common/stream.h" -#include "common/system.h" -#include "common/tokenizer.h" +#include "zvision/control.h" #include "zvision/zvision.h" #include "zvision/render_manager.h" -#include "zvision/render_table.h" -#include "zvision/script_manager.h" -#include "zvision/cursor_manager.h" -#include "zvision/control.h" #include "zvision/utility.h" -#include "zvision/rlf_animation.h" -#include "zvision/zork_avi_decoder.h" -namespace ZVision { -////////////////////////////////////////////////////////////////////////////// -// Static member functions -////////////////////////////////////////////////////////////////////////////// +namespace ZVision { void Control::parseFlatControl(ZVision *engine) { engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT); @@ -112,391 +102,4 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } - -////////////////////////////////////////////////////////////////////////////// -// PushToggleControl -////////////////////////////////////////////////////////////////////////////// - -PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : MouseEvent(key), - _engine(engine) { - // Loop until we find the closing brace - Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(&line); - - while (!stream.eos() && !line.contains('}')) { - if (line.matchString("*_hotspot*", true)) { - uint x; - uint y; - uint width; - uint height; - - sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height); - - _hotspot = Common::Rect(x, y, x + width, y + height); - } else if (line.matchString("cursor*", true)) { - char nameBuffer[25]; - - sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer); - - _hoverCursor = Common::String(nameBuffer); - } - - line = stream.readLine(); - trimCommentsAndWhiteSpace(&line); - } - - if (_hotspot.isEmpty() || _hoverCursor.empty()) { - warning("Push_toggle cursor %u was parsed incorrectly", key); - } -} - -bool PushToggleControl::enable() { - if (!_enabled) { - _engine->registerMouseEvent(this); - _enabled = true; - return true; - } - - debug("Control %u is already enabled", _key); - return false; -} - -bool PushToggleControl::disable() { - if (_enabled) { - _engine->removeMouseEvent(_key); - _enabled = false; - return true; - } - - debug("Control %u is already disabled", _key); - return false; -} - -void PushToggleControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - _engine->getScriptManager()->setStateValue(_key, 1); -} - -bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - if (_hotspot.contains(backgroundImageSpacePos)) { - _engine->getCursorManager()->changeCursor(_hoverCursor); - return true; - } - - return false; -} - -////////////////////////////////////////////////////////////////////////////// -// LeverControl -////////////////////////////////////////////////////////////////////////////// - -LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : MouseEvent(key), - _engine(engine), - _frameInfo(0), - _frameCount(0), - _startFrame(0), - _currentFrame(0), - _mouseIsCaptured(false), - _isReturning(false) { - - // Loop until we find the closing brace - Common::String line = stream.readLine(); - trimCommentsAndWhiteSpace(&line); - - while (!stream.eos() && !line.contains('}')) { - if (line.matchString("*descfile*", true)) { - char levFileName[25]; - sscanf(line.c_str(), "%*[^(](%25[^)])", levFileName); - - parseLevFile(levFileName); - } else if (line.matchString("*cursor*", true)) { - char cursorName[25]; - sscanf(line.c_str(), "%*[^(](%25[^)])", cursorName); - - _cursorName = Common::String(cursorName); - } - - line = stream.readLine(); - trimCommentsAndWhiteSpace(&line); - } - - renderFrame(_currentFrame); - - _engine->getScriptManager()->addActionNode(this); -} - -LeverControl::~LeverControl() { - if (_fileType == AVI) { - delete _animation.avi; - } else if (_fileType == RLF) { - delete _animation.rlf; - } - if (_frameInfo != 0) { - delete[] _frameInfo; - } -} - -void LeverControl::parseLevFile(const Common::String &fileName) { - Common::File file; - if (!file.open(fileName)) { - warning("LEV file %s could could be opened", fileName.c_str()); - return; - } - - Common::String line = file.readLine(); - - while (!file.eos()) { - if (line.matchString("*animation_id*", true)) { - // Not used - } else if (line.matchString("*filename*", true)) { - char fileNameBuffer[25]; - sscanf(line.c_str(), "%*[^:]:%25[^~]~", fileNameBuffer); - - Common::String fileName(fileNameBuffer); - - if (fileName.hasSuffix(".avi")) { - _animation.avi = new ZorkAVIDecoder(); - _animation.avi->loadFile(fileName); - } else if (fileName.hasSuffix(".rlf")) { - _animation.rlf = new RlfAnimation(fileNameBuffer, false); - } - } else if (line.matchString("*skipcolor*", true)) { - // Not used - } else if (line.matchString("*anim_coords*", true)) { - sscanf(line.c_str(), "%*[^:]:%u %u %u %u~", &_animationCoords.left, &_animationCoords.top, &_animationCoords.right, &_animationCoords.bottom); - } else if (line.matchString("*mirrored*", true)) { - uint mirrored; - sscanf(line.c_str(), "%*[^:]:%u~", &mirrored); - - _mirrored = mirrored == 0 ? false : true; - } else if (line.matchString("*frames*", true)) { - sscanf(line.c_str(), "%*[^:]:%u~", &_frameCount); - - _frameInfo = new FrameInfo[_frameCount]; - } else if (line.matchString("*elsewhere*", true)) { - // Not used - } else if (line.matchString("*out_of_control*", true)) { - // Not used - } else if (line.matchString("*start_pos*", true)) { - sscanf(line.c_str(), "%*[^:]:%u~", &_startFrame); - _currentFrame = _startFrame; - } else if (line.matchString("*hotspot_deltas*", true)) { - uint x; - uint y; - sscanf(line.c_str(), "%*[^:]:%u %u~", &x, &y); - - _hotspotDelta.x = x; - _hotspotDelta.y = y; - } else { - uint frameNumber; - uint x, y; - - if (sscanf(line.c_str(), "%u:%u %u", &frameNumber, &x, &y) == 3) { - _frameInfo[frameNumber].hotspot.left = x; - _frameInfo[frameNumber].hotspot.top = y; - _frameInfo[frameNumber].hotspot.right = x + _hotspotDelta.x; - _frameInfo[frameNumber].hotspot.bottom = y + _hotspotDelta.y; - } - - Common::StringTokenizer tokenizer(line, " ^="); - tokenizer.nextToken(); - tokenizer.nextToken(); - - Common::String token = tokenizer.nextToken(); - while (!tokenizer.empty()) { - if (token == "D") { - token = tokenizer.nextToken(); - - uint angle; - uint toFrame; - sscanf(token.c_str(), "%u,%u", &toFrame, &angle); - - _frameInfo[frameNumber].directions.push_back(Direction(angle, toFrame)); - } else if (token.hasPrefix("P")) { - uint to; - sscanf(token.c_str(), "P(%*u to %u)", &to); - - _frameInfo[frameNumber].returnRoute.push_back(to); - } - - token = tokenizer.nextToken(); - } - } - - line = file.readLine(); - } -} - -void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { - _mouseIsCaptured = true; - _lastMousePos = backgroundImageSpacePos; - } -} - -void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - _mouseIsCaptured = false; - _engine->getScriptManager()->setStateValue(_key, _currentFrame); - - if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { - - } - - // TODO: Animation reversal back to origin -} - -bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - bool cursorWasChanged = false; - - if (_mouseIsCaptured) { - // Make sure the square distance between the last point and the current point is greater than 64 - // This is a heuristic. This determines how responsive the lever is to mouse movement. - // TODO: Fiddle with the heuristic to get a good lever responsiveness 'feel' - if (_lastMousePos.sqrDist(backgroundImageSpacePos) >= 64) { - int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos); - _lastMousePos = backgroundImageSpacePos; - - for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { - if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle) { - _currentFrame = (*iter).toFrame; - renderFrame(_currentFrame); - break; - } - } - } - } else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { - _engine->getCursorManager()->changeCursor(_cursorName); - } - - return cursorWasChanged; -} - -bool LeverControl::process(uint32 deltaTimeInMillis) { - // TODO: Implement reversal over time - - return false; -} - -int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo) { - // Check for the easy angles first - if (pointOne.x == pointTwo.x && pointOne.y == pointTwo.y) - return -1; // This should never happen - else if (pointOne.x == pointTwo.x) { - if (pointTwo.y > pointOne.y) - return 90; - else - return 270; - } else if (pointOne.y == pointTwo.y) { - if (pointTwo.x > pointOne.x) - return 0; - else - return 180; - } else { - // Calculate the angle with trig - int16 xDist = pointTwo.x - pointOne.x; - int16 yDist = pointTwo.y - pointOne.y; - - int angle = int(atan((float)yDist / (float)xDist)); - - // Convert to degrees. (180 / 3.14159 = 57.2958) - angle *= 57; - - // Calculate what quadrant pointTwo is in - uint quadrant = ((yDist > 0 ? 1 : 0) << 1) | (xDist < 0 ? 1 : 0); - - // Explanation of quadrants: - // - // yDist > 0 | xDist < 0 | Quadrant number - // 0 | 0 | 0 - // 0 | 1 | 1 - // 1 | 0 | 2 - // 1 | 1 | 3 - // - // Note: I know this doesn't line up with traditional mathematical quadrants - // but doing it this way allows you can use a switch and is a bit cleaner IMO. - // - // The graph below shows the 4 quadrants pointTwo can end up in as well - // as what the angle as calculated above refers to. - // Note: The calculated angle in quadrants 0 and 3 is negative - // due to arctan(-x) = -theta - // - // Origin => (pointOne.x, pointOne.y) - // * => (pointTwo.x, pointTwo.y) - // - // 90 - // ^ - // * | * - // \ | / - // \ | / - // \ | / - // Quadrant 3 \ | / Quadrant 2 - // \ | / - // \ | / - // -angle ( \|/ ) angle - // 180 <----------------------------------------> 0 - // angle ( /|\ ) -angle - // / | \ - // / | \ - // Quadrant 1 / | \ Quadrant 0 - // / | \ - // / | \ - // / | \ - // * | * - // ^ - // 270 - - // Convert the local angles to unit circle angles - switch (quadrant) { - case 0: - angle = 360 + angle; - break; - case 1: - angle = 180 + angle; - break; - case 2: - angle = 180 + angle; - break; - case 3: - // Do nothing - break; - } - - return angle; - } -} - -void LeverControl::renderFrame(uint frameNumber) { - const uint16 *frameData; - int pitch; - int x; - int y; - int width; - int height; - - if (_fileType == RLF) { - // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can - frameData = _animation.rlf->getFrameData(_currentFrame); - pitch = _animation.rlf->width() * sizeof(uint16); - x = _animationCoords.left; - y = _animationCoords.right; - width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() - height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() - } else if (_fileType == AVI) { - // Cry because AVI seeking isn't implemented (yet) - } - - _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); -} - -bool LeverControl::enable() { - // TODO: Implement - return true; -} - -bool LeverControl::disable() { - // TODO: Implement - return true; -} - } // End of namespace ZVision diff --git a/engines/zvision/control.h b/engines/zvision/control.h index d764f914bb6f..616589f0551c 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -25,9 +25,6 @@ #include "common/types.h" -#include "zvision/mouse_event.h" -#include "zvision/action_node.h" - namespace Common { class SeekableReadStream; } @@ -35,8 +32,6 @@ class SeekableReadStream; namespace ZVision { class ZVision; -class RlfAnimation; -class ZorkAVIDecoder; class Control { public: @@ -55,137 +50,6 @@ class Control { static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); }; - -class PushToggleControl : public Control, public MouseEvent { -public: - PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); - bool enable(); - bool disable(); - - /** - * Called when LeftMouse is pushed. Calls ScriptManager::setStateValue(_key, 1); - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - */ - void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - /** - * Called when LeftMouse is lifted. Does nothing - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - */ - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) {} - /** - * Called on every MouseMove. Tests if the mouse is inside _hotspot, and if so, sets the cursor. - * - * @param engine The base engine - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - * @return Was the cursor changed? - */ - bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - -private: - ZVision * _engine; - /** - * The area that will trigger the event - * This is in image space coordinates, NOT screen space - */ - Common::Rect _hotspot; - /** The cursor to use when hovering over _hotspot */ - Common::String _hoverCursor; -}; - - -class LeverControl : public Control, public MouseEvent, public ActionNode { -public: - LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); - ~LeverControl(); - -private: - enum FileType { - RLF = 1, - AVI = 2 - }; - - struct Direction { - Direction(uint angle, uint toFrame) : angle(angle), toFrame(toFrame) {} - - uint angle; - uint toFrame; - }; - - struct FrameInfo { - Common::Rect hotspot; - Common::List directions; - Common::List returnRoute; - }; - - enum { - ANGLE_DELTA = 30 // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) - }; - -private: - ZVision *_engine; - - union { - RlfAnimation *rlf; - ZorkAVIDecoder *avi; - } _animation; - FileType _fileType; - - Common::String _cursorName; - Common::Rect _animationCoords; - bool _mirrored; - uint _frameCount; - uint _startFrame; - Common::Point _hotspotDelta; - FrameInfo *_frameInfo; - - uint _currentFrame; - bool _mouseIsCaptured; - bool _isReturning; - Common::Point _lastMousePos; - Common::List::iterator _returnRoutesCurrentProgress; - -public: - bool enable(); - bool disable(); - void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - bool process(uint32 deltaTimeInMillis); - -private: - void parseLevFile(const Common::String &fileName); - /** - * Calculates the angle a vector makes with the negative y-axis - * - * 90 - * pointTwo * ^ - * \ | - * \ | - * \ | - * \ | - * angle ( \|pointOne - * 180 <-----------*-----------> 0 - * | - * | - * | - * | - * | - * ^ - * 270 - * - * @param pointOne The origin of the vector - * @param pointTwo The end of the vector - * @return The angle the vector makes with the negative y-axis - */ - static int calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo); - void renderFrame(uint frameNumber); -}; - // TODO: Implement InputControl // TODO: Implement SaveControl // TODO: Implement SlotControl diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp new file mode 100644 index 000000000000..34877cd23f9f --- /dev/null +++ b/engines/zvision/lever_control.cpp @@ -0,0 +1,349 @@ +/* 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/scummsys.h" + +#include "common/stream.h" +#include "common/file.h" +#include "common/tokenizer.h" +#include "common/system.h" + +#include "zvision/lever_control.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/cursor_manager.h" +#include "zvision/rlf_animation.h" +#include "zvision/zork_avi_decoder.h" +#include "zvision/utility.h" + +namespace ZVision { + +LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : MouseEvent(key), + _engine(engine), + _frameInfo(0), + _frameCount(0), + _startFrame(0), + _currentFrame(0), + _mouseIsCaptured(false), + _isReturning(false) { + + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream.eos() && !line.contains('}')) { + if (line.matchString("*descfile*", true)) { + char levFileName[25]; + sscanf(line.c_str(), "%*[^(](%25[^)])", levFileName); + + parseLevFile(levFileName); + } else if (line.matchString("*cursor*", true)) { + char cursorName[25]; + sscanf(line.c_str(), "%*[^(](%25[^)])", cursorName); + + _cursorName = Common::String(cursorName); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } + + renderFrame(_currentFrame); + + _engine->getScriptManager()->addActionNode(this); +} + +LeverControl::~LeverControl() { + if (_fileType == AVI) { + delete _animation.avi; + } else if (_fileType == RLF) { + delete _animation.rlf; + } + if (_frameInfo != 0) { + delete[] _frameInfo; + } +} + +void LeverControl::parseLevFile(const Common::String &fileName) { + Common::File file; + if (!file.open(fileName)) { + warning("LEV file %s could could be opened", fileName.c_str()); + return; + } + + Common::String line = file.readLine(); + + while (!file.eos()) { + if (line.matchString("*animation_id*", true)) { + // Not used + } else if (line.matchString("*filename*", true)) { + char fileNameBuffer[25]; + sscanf(line.c_str(), "%*[^:]:%25[^~]~", fileNameBuffer); + + Common::String fileName(fileNameBuffer); + + if (fileName.hasSuffix(".avi")) { + _animation.avi = new ZorkAVIDecoder(); + _animation.avi->loadFile(fileName); + } else if (fileName.hasSuffix(".rlf")) { + _animation.rlf = new RlfAnimation(fileNameBuffer, false); + } + } else if (line.matchString("*skipcolor*", true)) { + // Not used + } else if (line.matchString("*anim_coords*", true)) { + sscanf(line.c_str(), "%*[^:]:%u %u %u %u~", &_animationCoords.left, &_animationCoords.top, &_animationCoords.right, &_animationCoords.bottom); + } else if (line.matchString("*mirrored*", true)) { + uint mirrored; + sscanf(line.c_str(), "%*[^:]:%u~", &mirrored); + + _mirrored = mirrored == 0 ? false : true; + } else if (line.matchString("*frames*", true)) { + sscanf(line.c_str(), "%*[^:]:%u~", &_frameCount); + + _frameInfo = new FrameInfo[_frameCount]; + } else if (line.matchString("*elsewhere*", true)) { + // Not used + } else if (line.matchString("*out_of_control*", true)) { + // Not used + } else if (line.matchString("*start_pos*", true)) { + sscanf(line.c_str(), "%*[^:]:%u~", &_startFrame); + _currentFrame = _startFrame; + } else if (line.matchString("*hotspot_deltas*", true)) { + uint x; + uint y; + sscanf(line.c_str(), "%*[^:]:%u %u~", &x, &y); + + _hotspotDelta.x = x; + _hotspotDelta.y = y; + } else { + uint frameNumber; + uint x, y; + + if (sscanf(line.c_str(), "%u:%u %u", &frameNumber, &x, &y) == 3) { + _frameInfo[frameNumber].hotspot.left = x; + _frameInfo[frameNumber].hotspot.top = y; + _frameInfo[frameNumber].hotspot.right = x + _hotspotDelta.x; + _frameInfo[frameNumber].hotspot.bottom = y + _hotspotDelta.y; + } + + Common::StringTokenizer tokenizer(line, " ^="); + tokenizer.nextToken(); + tokenizer.nextToken(); + + Common::String token = tokenizer.nextToken(); + while (!tokenizer.empty()) { + if (token == "D") { + token = tokenizer.nextToken(); + + uint angle; + uint toFrame; + sscanf(token.c_str(), "%u,%u", &toFrame, &angle); + + _frameInfo[frameNumber].directions.push_back(Direction(angle, toFrame)); + } else if (token.hasPrefix("P")) { + uint to; + sscanf(token.c_str(), "P(%*u to %u)", &to); + + _frameInfo[frameNumber].returnRoute.push_back(to); + } + + token = tokenizer.nextToken(); + } + } + + line = file.readLine(); + } +} + +void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + _mouseIsCaptured = true; + _lastMousePos = backgroundImageSpacePos; + } +} + +void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + _mouseIsCaptured = false; + _engine->getScriptManager()->setStateValue(_key, _currentFrame); + + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + + } + + // TODO: Animation reversal back to origin +} + +bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + bool cursorWasChanged = false; + + if (_mouseIsCaptured) { + // Make sure the square distance between the last point and the current point is greater than 64 + // This is a heuristic. This determines how responsive the lever is to mouse movement. + // TODO: Fiddle with the heuristic to get a good lever responsiveness 'feel' + if (_lastMousePos.sqrDist(backgroundImageSpacePos) >= 64) { + int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos); + _lastMousePos = backgroundImageSpacePos; + + for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { + if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle) { + _currentFrame = (*iter).toFrame; + renderFrame(_currentFrame); + break; + } + } + } + } else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { + _engine->getCursorManager()->changeCursor(_cursorName); + } + + return cursorWasChanged; +} + +bool LeverControl::process(uint32 deltaTimeInMillis) { + // TODO: Implement reversal over time + + return false; +} + +int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo) { + // Check for the easy angles first + if (pointOne.x == pointTwo.x && pointOne.y == pointTwo.y) + return -1; // This should never happen + else if (pointOne.x == pointTwo.x) { + if (pointTwo.y > pointOne.y) + return 90; + else + return 270; + } else if (pointOne.y == pointTwo.y) { + if (pointTwo.x > pointOne.x) + return 0; + else + return 180; + } else { + // Calculate the angle with trig + int16 xDist = pointTwo.x - pointOne.x; + int16 yDist = pointTwo.y - pointOne.y; + + int angle = int(atan((float)yDist / (float)xDist)); + + // Convert to degrees. (180 / 3.14159 = 57.2958) + angle *= 57; + + // Calculate what quadrant pointTwo is in + uint quadrant = ((yDist > 0 ? 1 : 0) << 1) | (xDist < 0 ? 1 : 0); + + // Explanation of quadrants: + // + // yDist > 0 | xDist < 0 | Quadrant number + // 0 | 0 | 0 + // 0 | 1 | 1 + // 1 | 0 | 2 + // 1 | 1 | 3 + // + // Note: I know this doesn't line up with traditional mathematical quadrants + // but doing it this way allows you can use a switch and is a bit cleaner IMO. + // + // The graph below shows the 4 quadrants pointTwo can end up in as well + // as what the angle as calculated above refers to. + // Note: The calculated angle in quadrants 0 and 3 is negative + // due to arctan(-x) = -theta + // + // Origin => (pointOne.x, pointOne.y) + // * => (pointTwo.x, pointTwo.y) + // + // 90 + // ^ + // * | * + // \ | / + // \ | / + // \ | / + // Quadrant 3 \ | / Quadrant 2 + // \ | / + // \ | / + // -angle ( \|/ ) angle + // 180 <----------------------------------------> 0 + // angle ( /|\ ) -angle + // / | \ + // / | \ + // Quadrant 1 / | \ Quadrant 0 + // / | \ + // / | \ + // / | \ + // * | * + // ^ + // 270 + + // Convert the local angles to unit circle angles + switch (quadrant) { + case 0: + angle = 360 + angle; + break; + case 1: + angle = 180 + angle; + break; + case 2: + angle = 180 + angle; + break; + case 3: + // Do nothing + break; + } + + return angle; + } +} + +void LeverControl::renderFrame(uint frameNumber) { + const uint16 *frameData; + int pitch; + int x; + int y; + int width; + int height; + + if (_fileType == RLF) { + // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can + frameData = _animation.rlf->getFrameData(_currentFrame); + pitch = _animation.rlf->width() * sizeof(uint16); + x = _animationCoords.left; + y = _animationCoords.right; + width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() + height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() + } else if (_fileType == AVI) { + // Cry because AVI seeking isn't implemented (yet) + } + + _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); +} + +bool LeverControl::enable() { + // TODO: Implement + return true; +} + +bool LeverControl::disable() { + // TODO: Implement + return true; +} + +} // End of namespace ZVision diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h new file mode 100644 index 000000000000..dbfd172c4509 --- /dev/null +++ b/engines/zvision/lever_control.h @@ -0,0 +1,130 @@ +/* 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 ZVISION_PUSH_TOGGLE_CONTROL_H +#define ZVISION_PUSH_TOGGLE_CONTROL_H + +#include "common/types.h" + +#include "common/list.h" + +#include "zvision/control.h" +#include "zvision/mouse_event.h" +#include "zvision/action_node.h" + + +namespace ZVision { + +class ZorkAVIDecoder; +class RlfAnimation; + +class LeverControl : public Control, public MouseEvent, public ActionNode { +public: + LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + ~LeverControl(); + +private: + enum FileType { + RLF = 1, + AVI = 2 + }; + + struct Direction { + Direction(uint angle, uint toFrame) : angle(angle), toFrame(toFrame) {} + + uint angle; + uint toFrame; + }; + + struct FrameInfo { + Common::Rect hotspot; + Common::List directions; + Common::List returnRoute; + }; + + enum { + ANGLE_DELTA = 30 // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) + }; + +private: + ZVision *_engine; + + union { + RlfAnimation *rlf; + ZorkAVIDecoder *avi; + } _animation; + FileType _fileType; + + Common::String _cursorName; + Common::Rect _animationCoords; + bool _mirrored; + uint _frameCount; + uint _startFrame; + Common::Point _hotspotDelta; + FrameInfo *_frameInfo; + + uint _currentFrame; + bool _mouseIsCaptured; + bool _isReturning; + Common::Point _lastMousePos; + Common::List::iterator _returnRoutesCurrentProgress; + +public: + bool enable(); + bool disable(); + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + bool process(uint32 deltaTimeInMillis); + +private: + void parseLevFile(const Common::String &fileName); + /** + * Calculates the angle a vector makes with the negative y-axis + * + * 90 + * pointTwo * ^ + * \ | + * \ | + * \ | + * \ | + * angle ( \|pointOne + * 180 <-----------*-----------> 0 + * | + * | + * | + * | + * | + * ^ + * 270 + * + * @param pointOne The origin of the vector + * @param pointTwo The end of the vector + * @return The angle the vector makes with the negative y-axis + */ + static int calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo); + void renderFrame(uint frameNumber); +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index a4b7c68cdecc..7412ad891690 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -11,7 +11,9 @@ MODULE_OBJS := \ cursor_manager.o \ detection.o \ events.o \ + lever_control.o \ lzss_read_stream.o \ + push_toggle_control.o \ render_manager.o \ render_table.o \ rlf_animation.o \ diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp new file mode 100644 index 000000000000..9e68bdb8be9a --- /dev/null +++ b/engines/zvision/push_toggle_control.cpp @@ -0,0 +1,104 @@ +/* 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/scummsys.h" + +#include "common/stream.h" + +#include "zvision/push_toggle_control.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/cursor_manager.h" +#include "zvision/utility.h" + +namespace ZVision { + +PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : MouseEvent(key), + _engine(engine) { + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream.eos() && !line.contains('}')) { + if (line.matchString("*_hotspot*", true)) { + uint x; + uint y; + uint width; + uint height; + + sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height); + + _hotspot = Common::Rect(x, y, x + width, y + height); + } else if (line.matchString("cursor*", true)) { + char nameBuffer[25]; + + sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer); + + _hoverCursor = Common::String(nameBuffer); + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } + + if (_hotspot.isEmpty() || _hoverCursor.empty()) { + warning("Push_toggle cursor %u was parsed incorrectly", key); + } +} + + bool PushToggleControl::enable() { + if (!_enabled) { + _engine->registerMouseEvent(this); + _enabled = true; + return true; + } + + debug("Control %u is already enabled", _key); + return false; + } + + bool PushToggleControl::disable() { + if (_enabled) { + _engine->removeMouseEvent(_key); + _enabled = false; + return true; + } + + debug("Control %u is already disabled", _key); + return false; + } + + void PushToggleControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + _engine->getScriptManager()->setStateValue(_key, 1); + } + + bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { + if (_hotspot.contains(backgroundImageSpacePos)) { + _engine->getCursorManager()->changeCursor(_hoverCursor); + return true; + } + + return false; + } + +} // End of namespace ZVision diff --git a/engines/zvision/push_toggle_control.h b/engines/zvision/push_toggle_control.h new file mode 100644 index 000000000000..9384a43d93e4 --- /dev/null +++ b/engines/zvision/push_toggle_control.h @@ -0,0 +1,77 @@ +/* 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 ZVISION_PUSH_TOGGLE_CONTROL_H +#define ZVISION_PUSH_TOGGLE_CONTROL_H + +#include "common/types.h" + +#include "zvision/control.h" +#include "zvision/mouse_event.h" + + +namespace ZVision { + +class PushToggleControl : public Control, public MouseEvent { +public: + PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + bool enable(); + bool disable(); + + /** + * Called when LeftMouse is pushed. Calls ScriptManager::setStateValue(_key, 1); + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + /** + * Called when LeftMouse is lifted. Does nothing + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) {} + /** + * Called on every MouseMove. Tests if the mouse is inside _hotspot, and if so, sets the cursor. + * + * @param engine The base engine + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + * @return Was the cursor changed? + */ + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + +private: + ZVision * _engine; + /** + * The area that will trigger the event + * This is in image space coordinates, NOT screen space + */ + Common::Rect _hotspot; + /** The cursor to use when hovering over _hotspot */ + Common::String _hoverCursor; +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 921c1d5b4427..c4aed70ac5fb 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -26,6 +26,7 @@ #include "zvision/utility.h" #include "zvision/puzzle.h" #include "zvision/actions.h" +#include "zvision/push_toggle_control.h" #include "common/textconsole.h" #include "common/file.h" From 29f159b3ac05499eebf8a76f9bb59034f74c338c Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 25 Aug 2013 13:25:50 +0200 Subject: [PATCH 0657/1332] AVALANCHE: Implement/repair Acci::do_that() and (almost) everything connected to it. --- engines/avalanche/acci2.cpp | 430 +++++++++++++++++--------------- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/gyro2.cpp | 19 +- engines/avalanche/gyro2.h | 6 +- engines/avalanche/lucerna2.cpp | 14 +- 5 files changed, 251 insertions(+), 220 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 77f7b44f5e44..5cfafd1ad445 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -672,21 +672,19 @@ bool Acci::holding() { void Acci::openBox(bool before) { - if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(5); + _vm->_celer->pics_link(); + _vm->_trip->trippancy_link(); + _vm->_graphics->refreshScreen(); + + _vm->_system->delayMillis(55); + + if (!before) { + _vm->_celer->show_one(6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); - - _vm->_system->delayMillis(55); - - if (!before) { - _vm->_celer->show_one(6); - _vm->_celer->pics_link(); - _vm->_trip->trippancy_link(); - _vm->_graphics->refreshScreen(); - } } } @@ -718,7 +716,61 @@ void Acci::inv() { /* the time-honoured command... */ } void Acci::swallow() { /* Eat something. */ - warning("STUB: Acci::swallow()"); + switch (thing) { + case _vm->_gyro->wine: + switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ + case 1: { + if (_vm->_gyro->dna.teetotal) { + _vm->_visa->dixi('D', 6); + return; + } + _vm->_visa->dixi('U', 1); + _vm->_pingo->wobble(); + _vm->_visa->dixi('U', 2); + _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; + _vm->_lucerna->objectlist(); + have_a_drink(); + } + break; + case 2: + case 3: + _vm->_visa->dixi('d', 8); + break; /* You can't drink it! */ + } + break; + case _vm->_gyro->potion: { + _vm->_gyro->background(4); + _vm->_visa->dixi('U', 3); + _vm->_lucerna->gameover(); + _vm->_gyro->background(0); + } + break; + case _vm->_gyro->ink: + _vm->_visa->dixi('U', 4); + break; + case _vm->_gyro->chastity: + _vm->_visa->dixi('U', 5); + break; + case _vm->_gyro->mushroom: { + _vm->_visa->dixi('U', 6); + _vm->_lucerna->gameover(); + } + break; + case _vm->_gyro->onion: + if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('U', 11); + else { + _vm->_visa->dixi('U', 8); + _vm->_gyro->dna.obj[_vm->_gyro->onion] = false; + _vm->_lucerna->objectlist(); + } + break; + default: + if ((_vm->_gyro->dna.room == r__argentpub) || (_vm->_gyro->dna.room == r__nottspub)) + _vm->_scrolls->display("Try BUYing things before you drink them!"); + else + _vm->_scrolls->display("The taste of it makes you retch!"); + /* Constant- leave this one */ + } } void Acci::others() { @@ -843,19 +895,17 @@ void Acci::putproc() { /* Called when you call vb_put. */ return; thing = temp; - /* Thing is the thing which you're putting in. Thing2 is where you're - putting it. */ - /* Convenience thing. */ + // Thing is the thing which you're putting in. Thing2 is where you're putting it. switch (thing2) { case _vm->_gyro->wine: if (thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.rotten_onion) - _vm->_scrolls->display(Common::String("That's a bit like shutting the stable door after the " - "horse has bolted!")); - else { /* Put onion into wine? */ + _vm->_scrolls->display("That's a bit like shutting the stable door after the horse has bolted!"); + else { // Put onion into wine? if (_vm->_gyro->dna.winestate != 3) - _vm->_scrolls->display("\6Oignon au vin\22 is a bit too strong for your tastes!"); - else { /* Put onion into vinegar! Yes! */ + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" + + _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); + else { // Put onion into vinegar! Yes! _vm->_gyro->dna.onion_in_vinegar = true; _vm->_lucerna->points(7); _vm->_visa->dixi('u', 9); @@ -866,10 +916,9 @@ void Acci::putproc() { /* Called when you call vb_put. */ break; case 54: - if (_vm->_gyro->dna.room == 1) { /* Put something into the box. */ + if (_vm->_gyro->dna.room == r__yours) { // Put something into the box. if (_vm->_gyro->dna.box_contents != nowt) - _vm->_scrolls->display(Common::String("There's something in the box already, Avvy. Try taking" - " that out first.")); + _vm->_scrolls->display("There's something in the box already, Avvy. Try taking that out first."); else { switch (thing) { case _vm->_gyro->money: @@ -884,17 +933,20 @@ void Acci::putproc() { /* Called when you call vb_put. */ case _vm->_gyro->onion: _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); break; - default: - /* Put the object into the box... */ + default: // Put the object into the box... if (_vm->_gyro->dna.wearing == thing) _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); else { - _vm->_celer->show_one(5); /* Open box. */ + //_vm->_celer->show_one(5); // Open box. + openBox(true); + _vm->_gyro->dna.box_contents = thing; - _vm->_gyro->dna.obj[thing] = false; + _vm->_gyro->dna.obj[thing - 1] = false; _vm->_lucerna->objectlist(); _vm->_scrolls->display("OK, it's in the box."); - _vm->_celer->show_one(6); /* Shut box. */ + + //_vm->_celer->show_one(6); // Shut box. + openBox(false); } } } @@ -910,15 +962,15 @@ void Acci::putproc() { /* Called when you call vb_put. */ /* The result of this fn is whether or not he says "Hey, thanks!" */ void Acci::not_in_order() { - _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion.") + - " What I need next is " + - _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + ".\232\2"); + _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") + + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } void Acci::go_to_cauldron() { - _vm->_trip->tr[2].call_eachstep = false; /* Stops Geida_Procs. */ + _vm->_trip->tr[1].call_eachstep = false; /* Stops Geida_Procs. */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); - _vm->_trip->tr[2].walkto(2); + _vm->_trip->tr[1].walkto(2); } bool Acci::give2spludwick() { @@ -935,7 +987,7 @@ bool Acci::give2spludwick() { if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('q', 22); else { - _vm->_gyro->dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick++; _vm->_visa->dixi('q', 20); go_to_cauldron(); _vm->_lucerna->points(3); @@ -945,7 +997,7 @@ bool Acci::give2spludwick() { case _vm->_gyro->ink: _vm->_gyro->dna.obj[_vm->_gyro->ink] = false; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick++; _vm->_visa->dixi('q', 24); go_to_cauldron(); _vm->_lucerna->points(3); @@ -954,7 +1006,7 @@ bool Acci::give2spludwick() { _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = false; _vm->_visa->dixi('q', 25); _vm->_lucerna->points(5); - _vm->_gyro->dna.given2spludwick += 1; + _vm->_gyro->dna.given2spludwick++; go_to_cauldron(); _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; _vm->_lucerna->objectlist(); @@ -983,13 +1035,11 @@ void Acci::have_a_drink() { } void Acci::cardiff_climbing() { - if (_vm->_gyro->dna.standing_on_dais) { - /* Clamber up. */ + if (_vm->_gyro->dna.standing_on_dais) { // Clamber up. _vm->_scrolls->display("You climb down, back onto the floor."); _vm->_gyro->dna.standing_on_dais = false; _vm->_trip->apped(1, 3); - } else { - /* Clamber down. */ + } else { // Clamber down. if (_vm->_trip->infield(1)) { _vm->_scrolls->display("You clamber up onto the dais."); _vm->_gyro->dna.standing_on_dais = true; @@ -999,7 +1049,6 @@ void Acci::cardiff_climbing() { } } - /* Called when you ask Avvy to stand. */ void Acci::already() { _vm->_scrolls->display("You're already standing!"); @@ -1033,7 +1082,7 @@ void Acci::stand_up() { case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { _vm->_celer->show_one(4); /* Not sitting down. */ - _vm->_trip->tr[1].visible = true; /* But standing up. */ + _vm->_trip->tr[0].visible = true; /* But standing up. */ _vm->_trip->apped(1, 4); /* And walking away. */ _vm->_gyro->dna.sitting_in_pub = false; /* Really not sitting down. */ _vm->_gyro->dna.user_moves_avvy = true; /* And ambulant. */ @@ -1146,13 +1195,13 @@ void Acci::person_speaks() { if ((person == pardon) || (person == 0)) - if ((_vm->_gyro->him == pardon) || (_vm->_gyro->whereis[_vm->_gyro->him] != _vm->_gyro->dna.room)) + if ((_vm->_gyro->him == pardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) person = _vm->_gyro->her; else person = _vm->_gyro->him; - if (_vm->_gyro->whereis[person] != _vm->_gyro->dna.room) { - _vm->_scrolls->display("\231\4"); // Avvy himself! + if (_vm->_gyro->whereis[person - 150] != _vm->_gyro->dna.room) { + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! return; } @@ -1160,24 +1209,20 @@ void Acci::person_speaks() { for (fv = 0; fv < _vm->_trip->numtr; fv++) { if (_vm->_trip->tr[fv].quick && ((_vm->_trip->tr[fv].a.accinum + 149) == person)) { - _vm->_scrolls->display(Common::String('\23') + char(fv + 48) + '\4'); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(fv + 49) + _vm->_scrolls->kControlToBuffer); found = true; } } - if (!found) { - for (fv = 0; fv < 16; fv++) { - _vm->_gyro->quasipeds[fv]; - if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) { - _vm->_scrolls->display(Common::String('\23') + char(fv + 55) + '\4'); - } - } - } + if (!found) + for (fv = 0; fv < 16; fv++) + if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(fv + 65) + _vm->_scrolls->kControlToBuffer); } void Acci::heythanks() { person_speaks(); - _vm->_scrolls->display("Hey, thanks!\2(But now, you've lost it!)"); + _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); _vm->_gyro->dna.obj[thing] = false; } @@ -1294,20 +1339,17 @@ void Acci::do_that() { default: switch (person) { case _vm->_gyro->pcrapulus: - switch (thing) { - case _vm->_gyro->wine: + if (thing == _vm->_gyro->wine) { _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; - break; - default: + } else heythanks(); - } break; case _vm->_gyro->pcwytalot: - /*if (set::of(crossbow, bolt, eos).has(thing)) - _vm->_scrolls->display(Common::String("You might be able to influence ") + - "Cwytalot more if you used it!"); - else */heythanks(); + if ((thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) + _vm->_scrolls->display(Common::String("You might be able to influence Cwytalot more if you used it!")); + else + heythanks(); break; case _vm->_gyro->pspludwick: if (give2spludwick()) @@ -1381,15 +1423,13 @@ void Acci::do_that() { if (holding()) swallow(); break; + case vb_load: - _vm->_enid->edna_load(realwords[2]); break; case vb_save: - if (_vm->_gyro->alive) - _vm->_enid->edna_save(realwords[2]); - else - _vm->_scrolls->display("It's a bit late now to save your game!"); break; + // We don't handle these two because we use ScummVM's save/load system. + case vb_pay: _vm->_scrolls->display("No money need change hands."); break; @@ -1400,33 +1440,35 @@ void Acci::do_that() { _vm->_scrolls->display("Vandalism is prohibited within this game!"); break; case vb_quit: /* quit */ - //if (_vm->_gyro->demo) { + if (_vm->_gyro->demo) { + warning("STUB: Acci::do_that() - case vb_quit"); // _vm->_visa->dixi('q', 31); // close(demofile); // exit(0); /* Change this later!!! */ - //} + } if (!polite) _vm->_scrolls->display("How about a `please\", Avvy?"); - else if (_vm->_scrolls->ask("\23C\26Do you really want to quit?")) + else if (_vm->_scrolls->ask(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) _vm->_gyro->lmo = true; break; case vb_go: _vm->_scrolls->display("Just use the arrow keys to walk there."); break; - case vb_info: - _vm->_scrolls->aboutscroll = true; - /* _vm->_scrolls->display('Thorsoft of Letchworth presents:'+^c+^m+^m+ - 'The medival descendant of'+^m+ - 'Denarius Avaricius Sextus'+^m+'in:'+ - ^m+^m+'LORD AVALOT D''ARGENT'+ - ^m+'version '+vernum+^m+^m+'Copyright ' - +copyright+', Mark, Mike and Thomas Thurman.');*/ - _vm->_scrolls->display(Common::String("\r\r\r\r\r\r\r") + "LORD AVALOT D'ARGENT" + "\3\r" + - "The medival descendant of" + '\15' + - "Denarius Avaricius Sextus" + - '\15' + '\15' + "version " + _vm->_gyro->vernum + '\15' + '\15' + "Copyright " - + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + '\23' + 'Y' + '\26'); - _vm->_scrolls->aboutscroll = false; + case vb_info: { + _vm->_scrolls->aboutscroll = true; + + Common::String toDisplay; + for (byte i = 0; i < 7; i++) + toDisplay += _vm->_scrolls->kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + + "The medival descendant of" + _vm->_scrolls->kControlNewLine + + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " + + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; + _vm->_scrolls->display(toDisplay); + + _vm->_scrolls->aboutscroll = false; + } break; case vb_undress: if (_vm->_gyro->dna.wearing == nowt) @@ -1439,39 +1481,39 @@ void Acci::do_that() { _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); break; case vb_wear: - if (holding()) { - /* wear something */ + if (holding()) { /* wear something */ switch (thing) { case _vm->_gyro->chastity: - _vm->_scrolls->display("Hey, what kind of a weirdo are you\??!"); + _vm->_scrolls->display("Hey, what kind of a weirdo are you??!"); break; case _vm->_gyro->clothes: - case _vm->_gyro->habit: /* Change this! */ - if (_vm->_gyro->dna.wearing != nowt) { - if (_vm->_gyro->dna.wearing == thing) - _vm->_scrolls->display("You're already wearing that."); - else - _vm->_scrolls->display(Common::String("You'll be rather warm wearing two ") + - "sets of clothes!"); - return; - } else - _vm->_gyro->dna.wearing = thing; - _vm->_lucerna->objectlist(); + case _vm->_gyro->habit: { /* Change this! */ + if (_vm->_gyro->dna.wearing != nowt) { + if (_vm->_gyro->dna.wearing == thing) + _vm->_scrolls->display("You're already wearing that."); + else + _vm->_scrolls->display("You'll be rather warm wearing two sets of clothes!"); + return; + } else + _vm->_gyro->dna.wearing = thing; - if (thing == _vm->_gyro->habit) - fv = 3; - else - fv = 0; - - if (_vm->_trip->tr[1].whichsprite != fv) { - sx = _vm->_trip->tr[1].x; - sy = _vm->_trip->tr[1].y; - _vm->_trip->tr[1].done(); - _vm->_trip->tr[1].init(fv, true, _vm->_trip); - _vm->_trip->tr[1].appear(sx, sy, _vm->_trip->left); - _vm->_trip->tr[1].visible = false; + _vm->_lucerna->objectlist(); + + if (thing == _vm->_gyro->habit) + fv = 3; + else + fv = 0; + + if (_vm->_trip->tr[0].whichsprite != fv) { + sx = _vm->_trip->tr[0].x; + sy = _vm->_trip->tr[0].y; + _vm->_trip->tr[0].done(); + _vm->_trip->tr[0].init(fv, true, _vm->_trip); + _vm->_trip->tr[0].appear(sx, sy, _vm->_trip->left); + _vm->_trip->tr[0].visible = false; + } } - break; + break; default: _vm->_scrolls->display(what); } @@ -1482,7 +1524,7 @@ void Acci::do_that() { switch (_vm->_gyro->dna.room) { /* They just typed "play"... */ case r__argentpub: // play_nim(); - // I just don't plan to implement Nim yet. + warning("STUB: Acci::do_that() - case vb_play"); break; /* ...in the pub, => play Nim. */ case r__musicroom: play_harp(); @@ -1490,13 +1532,15 @@ void Acci::do_that() { } } else if (holding()) { switch (thing) { - case _vm->_gyro->lute : - _vm->_visa->dixi('U', 7); - if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot] == _vm->_gyro->dna.room) - _vm->_visa->dixi('U', 10); + case _vm->_gyro->lute : { + _vm->_visa->dixi('U', 7); - if (_vm->_gyro->whereis[_vm->_gyro->pdulustie] == _vm->_gyro->dna.room) - _vm->_visa->dixi('U', 15); + if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) + _vm->_visa->dixi('U', 10); + + if (_vm->_gyro->whereis[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) + _vm->_visa->dixi('U', 15); + } break; case 52: if (_vm->_gyro->dna.room == r__musicroom) @@ -1506,7 +1550,8 @@ void Acci::do_that() { break; case 55: if (_vm->_gyro->dna.room == r__argentpub) - ; /*play_nim(); - Don't implement yet.*/ + // play_nim(); + warning("STUB: Acci::do_that() - case vb_play"); else _vm->_scrolls->display(what); break; @@ -1520,14 +1565,14 @@ void Acci::do_that() { if (thing == _vm->_gyro->bell) { _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); + _vm->_scrolls->display("(Are you trying to join in, Avvy??!)"); } else _vm->_scrolls->display(what); } break; case vb_help: // boot_help(); - // I don't want to implement help yet. + warning("STUB: Acci::do_that() - case vb_help"); break; case vb_larrypass: _vm->_scrolls->display("Wrong game!"); @@ -1537,34 +1582,34 @@ void Acci::do_that() { break; case vb_boss: // bosskey(); - // I don't want to implement bosskey yet. + warning("STUB: Acci::do_that() - case vb_boss"); break; case vb_pee: if (_vm->_gyro->flagset('P')) { _vm->_scrolls->display("Hmm, I don't think anyone will notice..."); _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else - _vm->_scrolls->display("It would be \6VERY\22 unwise to do that here, Avvy!"); + _vm->_scrolls->display(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); break; case vb_cheat: - _vm->_scrolls->display(Common::String('\6') + "Cheat mode now enabled."); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); _vm->_gyro->cheat = true; break; case vb_magic: if (_vm->_gyro->dna.avaricius_talk > 0) _vm->_visa->dixi('q', 19); else { - if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { - /* Avaricius appears! */ + if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! _vm->_visa->dixi('q', 17); - if (_vm->_gyro->whereis['\227'] == 12) + if (_vm->_gyro->whereis[1] == 12) _vm->_visa->dixi('q', 18); else { - _vm->_trip->tr[2].init(1, false, _vm->_trip); /* Avaricius */ + _vm->_trip->tr[1].init(1, false, _vm->_trip); /* Avaricius */ _vm->_trip->apped(2, 4); - _vm->_trip->tr[2].walkto(5); - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procback_and_forth; + _vm->_trip->tr[1].walkto(5); + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procback_and_forth; _vm->_gyro->dna.avaricius_talk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } @@ -1578,42 +1623,39 @@ void Acci::do_that() { case vb_expletive: switch (_vm->_gyro->dna.swore) { case 0: - _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!\r\r") + - "(I shouldn't say it again, if I were you!)"); + _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!") + + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(I shouldn't say it again, if I were you!)"); break; case 1: - _vm->_scrolls->display(Common::String("You hear a distant rumble of thunder. Must you always ") + - "do things I tell you not to?\r\rDon't do it again!"); + _vm->_scrolls->display(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?") + + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Don't do it again!"); break; default: _vm->_pingo->zonk(); - _vm->_scrolls->display(Common::String("A crack of lightning shoots from the sky, ") + - "and fries you.\r\r(`Such is the anger of the gods, Avvy!\")"); + _vm->_scrolls->display(Common::String("A crack of lightning shoots from the sky, and fries you.") + + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna->gameover(); } _vm->_gyro->dna.swore++; break; case vb_listen: if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls->display(Common::String("All other noise is drowned out by the ringing of ") + - "the bells."); - else if (_vm->_gyro->listen == "") + _vm->_scrolls->display("All other noise is drowned out by the ringing of the bells."); + else if (_vm->_gyro->listen.empty()) _vm->_scrolls->display("You can't hear anything much at the moment, Avvy."); else _vm->_scrolls->display(_vm->_gyro->listen); break; - case vb_buy: - /* What are they trying to buy? */ + case vb_buy: // What are they trying to buy? switch (_vm->_gyro->dna.room) { case r__argentpub: - if (_vm->_trip->infield(6)) { - /* We're in a pub, and near the bar. */ + if (_vm->_trip->infield(6)) { // We're in a pub, and near the bar. switch (thing) { - case '\63': - case '\65': - case '\66': - case '\72': /* Beer, whisky, cider or mead */ - if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ + case 51: + case 53: + case 54: + case 58: // Beer, whisky, cider or mead. + if (_vm->_gyro->dna.malagauche == 177) { // Already getting us one. _vm->_visa->dixi('D', 15); return; } @@ -1625,22 +1667,23 @@ void Acci::do_that() { if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); + _vm->_celer->show_one(12); - _vm->_scrolls->display(booze[thing] + ", please.\231\2"); + _vm->_scrolls->display(booze[thing] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->dna.drinking = thing; _vm->_celer->show_one(10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; - case '\64': + case 52: examine(); - break; /* We have a right one here- buy Pepsi??! */ + break; // We have a right one here - buy Pepsi??! case _vm->_gyro->wine: - if (_vm->_gyro->dna.obj[_vm->_gyro->wine]) /* We've already got the wine! */ - _vm->_visa->dixi('D', 2); /* 1 bottle's shufishent! */ + if (_vm->_gyro->dna.obj[_vm->_gyro->wine]) // We've already got the wine! + _vm->_visa->dixi('D', 2); // 1 bottle's shufishent! else { - if (_vm->_gyro->dna.malagauche == 177) { /* Already getting us one. */ + if (_vm->_gyro->dna.malagauche == 177) { // Already getting us one. _vm->_visa->dixi('D', 15); return; } @@ -1651,7 +1694,7 @@ void Acci::do_that() { } _vm->_celer->show_one(12); - _vm->_scrolls->display("Wine, please.\231\2"); + _vm->_scrolls->display("Wine, please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); _vm->_celer->show_one(10); @@ -1662,14 +1705,14 @@ void Acci::do_that() { break; } } else - _vm->_visa->dixi('D', 5); - break; /* Go to the bar! */ + _vm->_visa->dixi('D', 5); // Go to the bar! + break; case r__outsideducks: if (_vm->_trip->infield(6)) { if (thing == _vm->_gyro->onion) { - if (_vm->_gyro->dna.obj[_vm->_gyro->onion]) - _vm->_visa->dixi('D', 10); /* not planning to juggle with the things! */ + if (_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) + _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("Before you ask, you remember that your hands are full."); else { @@ -1679,11 +1722,11 @@ void Acci::do_that() { _vm->_visa->dixi('D', 9); _vm->_lucerna->points(3); } - _vm->_gyro->pennycheck(3); /* It costs thruppence. */ + _vm->_gyro->pennycheck(3); // It costs thruppence. _vm->_gyro->dna.obj[_vm->_gyro->onion] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.bought_onion = true; - _vm->_gyro->dna.rotten_onion = false; /* It's OK when it leaves the stall! */ + _vm->_gyro->dna.rotten_onion = false; // It's OK when it leaves the stall! _vm->_gyro->dna.onion_in_vinegar = false; } } else @@ -1693,30 +1736,27 @@ void Acci::do_that() { break; case r__nottspub: - _vm->_visa->dixi('n', 15); - break; /* Can't sell to southerners. */ + _vm->_visa->dixi('n', 15); // Can't sell to southerners. + break; default: - _vm->_visa->dixi('D', 0); /* Can't buy that. */ + _vm->_visa->dixi('D', 0); // Can't buy that. } break; case vb_attack: if ((_vm->_gyro->dna.room == r__brummieroad) && - ((person == '\235') || (thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) - && (_vm->_gyro->whereis['\235'] == _vm->_gyro->dna.room)) { + ((person == 157) || (thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) + && (_vm->_gyro->whereis[7] == _vm->_gyro->dna.room)) { switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow] * 2) { - /* 0 = neither, 1 = only bolt, 2 = only crossbow, - 3 = both. */ + // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->dixi('Q', 10); _vm->_scrolls->display("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls->display(Common::String("Attack _vm->_gyro->him with only a crossbow bolt? Are you ") + - "planning on playing darts?!"); + _vm->_scrolls->display("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: - _vm->_scrolls->display(Common::String("Come on, Avvy! You're not going to get very far ") + - "with only a crossbow!"); + _vm->_scrolls->display("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: _vm->_visa->dixi('Q', 11); @@ -1724,12 +1764,12 @@ void Acci::do_that() { _vm->_gyro->dna.obj[_vm->_gyro->bolt] = false; _vm->_gyro->dna.obj[_vm->_gyro->crossbow] = false; _vm->_lucerna->objectlist(); - _vm->_gyro->magics[12].op = _vm->_gyro->nix; + _vm->_gyro->magics[11].op = _vm->_gyro->nix; _vm->_lucerna->points(7); - _vm->_trip->tr[2].walkto(2); - _vm->_trip->tr[2].vanishifstill = true; - _vm->_trip->tr[2].call_eachstep = false; - _vm->_gyro->whereis['\235'] = 177; + _vm->_trip->tr[1].walkto(2); + _vm->_trip->tr[1].vanishifstill = true; + _vm->_trip->tr[1].call_eachstep = false; + _vm->_gyro->whereis[7] = 177; break; default: _vm->_visa->dixi('Q', 10); /* Please try not to be so violent! */ @@ -1742,8 +1782,8 @@ void Acci::do_that() { _vm->_visa->dixi('Q', 12); else { ok = true; - for (ff = 1; ff <= thats.size(); ff++) { - for (fv = 1; fv <= words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) { + for (ff = 0; ff < thats.size(); ff++) { + for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) { Common::String temp = realwords[ff]; temp.toUppercase(); if (words[_vm->_gyro->dna.pass_num + first_password].w[fv] != temp[fv]) @@ -1765,7 +1805,7 @@ void Acci::do_that() { } break; case vb_dir: - _vm->_enid->dir(realwords[2]); + _vm->_enid->dir(realwords[1]); break; case vb_die: _vm->_lucerna->gameover(); @@ -1781,7 +1821,6 @@ void Acci::do_that() { case vb_stand: stand_up(); break; - case vb_kiss: if (person == pardon) _vm->_scrolls->display("Kiss whom?"); @@ -1803,24 +1842,20 @@ void Acci::do_that() { _vm->_scrolls->display("Hey, what kind of a weirdo are you??"); break; - case vb_climb: if (_vm->_gyro->dna.room == r__insidecardiffcastle) cardiff_climbing(); else /* In the wrong room! */ _vm->_scrolls->display("Not with your head for heights, Avvy!"); break; - case vb_jump: _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; - case vb_highscores: // show_highs(); - // to be implemented later... + warning("STUB: Acci::do_that() - case vb_highscores"); break; - case vb_wake: if (personshere()) switch (person) { @@ -1849,24 +1884,21 @@ void Acci::do_that() { _vm->_scrolls->display("It's difficult to awaken people who aren't asleep...!"); } break; - case vb_sit: if (_vm->_gyro->dna.room == r__nottspub) { if (_vm->_gyro->dna.sitting_in_pub) _vm->_scrolls->display("You're already sitting!"); else { - _vm->_trip->tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ + _vm->_trip->tr[0].walkto(4); // Move Avvy to the place, and sit him down. _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } - } else { - /* Default doodah. */ + } else { // Default doodah. _vm->_lucerna->dusk(); _vm->_gyro->hang_around_for_a_while(); _vm->_lucerna->dawn(); - _vm->_scrolls->display("A few hours later...\20nothing much has happened..."); + _vm->_scrolls->display(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); } break; - case vb_restart: if (_vm->_scrolls->ask("Restart game and lose changes?")) { _vm->_lucerna->dusk(); @@ -1874,21 +1906,19 @@ void Acci::do_that() { _vm->_lucerna->dawn(); } break; - case pardon: _vm->_scrolls->display("Hey, a verb would be helpful!"); break; - case vb_hello: person_speaks(); - _vm->_scrolls->display("Hello.\2"); + _vm->_scrolls->display(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble); break; case vb_thanks: person_speaks(); - _vm->_scrolls->display("That's OK.\2"); + _vm->_scrolls->display(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble); break; default: - _vm->_scrolls->display(Common::String('\7') + "Parser bug!"); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlBell) + "Parser bug!"); } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2c4ae6f9eabf..2c7041d0626b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -352,7 +352,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return (!_gyro->seescroll); + return (!_gyro->seescroll && _gyro->alive); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 4ae61c2bf5d4..e7cf879ec00f 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -394,8 +394,13 @@ void Gyro::force_numlock() { } bool Gyro::pennycheck(uint16 howmuchby) { - warning("STUB: Gyro::pennycheck()"); - return true; + dna.pence -= howmuchby; + if (dna.pence < 0) { + _vm->_visa->dixi('Q', 2); // "You are now denariusless!" + _vm->_lucerna->gameover(); + return false; + } else + return true; } // There'll may be problems with calling these functions becouse of the conversion of the arrays!!! @@ -472,7 +477,7 @@ Common::String Gyro::get_better(byte which) { case 0: case 1: case 4: - get_better_result = better[which]; + get_better_result = better[which - 1]; break; case 3: get_better_result = "some vinegar"; @@ -485,11 +490,11 @@ Common::String Gyro::get_better(byte which) { else if (dna.onion_in_vinegar) get_better_result = "a pickled onion (in the vinegar)"; else - get_better_result = better[which]; + get_better_result = better[which - 1]; break; default: if ((which < numobjs) && (which > 0)) - get_better_result = better[which]; + get_better_result = better[which - 1]; else get_better_result = ""; } @@ -583,9 +588,7 @@ void Gyro::background(byte x) { } void Gyro::hang_around_for_a_while() { - byte fv; - - for (fv = 1; fv <= 28; fv++) + for (byte i = 0; i < 28; i++) slowdown(); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index cafaabb8b8f5..825d40f16119 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -343,9 +343,9 @@ class Gyro { static const uint16 pjacques = 166; /* Girls: */ - static const uint16 parkata = 257; - static const uint16 pgeida = 260; - static const uint16 pwisewoman = 262; + static const uint16 parkata = 175; + static const uint16 pgeida = 176; + static const uint16 pwisewoman = 178; static const int16 xw = 30; static const int16 yw = 36; /* x width & y whatsit */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 48b17c43ccd1..d6aab20c4fda 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -278,9 +278,9 @@ void Lucerna::zoomout(int16 x, int16 y) { } void Lucerna::find_people(byte room) { - for (byte fv = 1; fv < 29; fv++) // There'll may be problems with this. + for (byte fv = 1; fv < 29; fv++) if (_vm->_gyro->whereis[fv] == room) { - if (fv < 25) // And this. See definition of whereis[]. + if (fv < 25) _vm->_gyro->him = fv + 150; else _vm->_gyro->her = fv + 150; @@ -326,7 +326,7 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ switch (_vm->_gyro->dna.room) { case r__outsidenottspub: /* Entry into Nottingham. */ - if ((_vm->_gyro->dna.rooms[r__robins] > 0) && (_vm->_gyro->dna.been_tied_up) && (! _vm->_gyro->dna.taken_mushroom)) + if ((_vm->_gyro->dna.rooms[r__robins] > 0) && (_vm->_gyro->dna.been_tied_up) && (!_vm->_gyro->dna.taken_mushroom)) _vm->_gyro->dna.mushroom_growing = true; break; case r__wisewomans: { /* Entry into Argent. */ @@ -337,7 +337,8 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ _vm->_gyro->dna.spludwicks_here = true; _vm->_gyro->dna.crapulus_will_tell = false; } - if (_vm->_gyro->dna.box_contents == _vm->_gyro->wine) _vm->_gyro->dna.winestate = 3; /* Vinegar */ + if (_vm->_gyro->dna.box_contents == _vm->_gyro->wine) + _vm->_gyro->dna.winestate = 3; /* Vinegar */ } break; } @@ -1297,15 +1298,12 @@ void Lucerna::gameover() { sy = _vm->_trip->tr[0].y; _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(12, true, _vm->_trip); /* 12 = Avalot falls */ + _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls _vm->_trip->tr[0].step = 0; _vm->_trip->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); - /* _vm->_scrolls->display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ - warning("STUB: Timeout::avalot_falls()"); - _vm->_gyro->alive = false; } From f4824986ecbd45ceb720ecf54a085d02429acd98 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 25 Aug 2013 13:52:05 +0200 Subject: [PATCH 0658/1332] AVALANCHE: Repair Lucerna::bearing(). --- engines/avalanche/lucerna2.cpp | 30 ++++++++++++------------------ engines/avalanche/lucerna2.h | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d6aab20c4fda..d96bbbc5e011 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1332,25 +1332,19 @@ void Lucerna::major_redraw() { } uint16 Lucerna::bearing(byte whichped) { -/* Returns the bearing from ped Whichped to Avvy, in degrees. */ - const double rad2deg = 180 / 3.14/*Pi*/; - - uint16 bearing_result; - { - pedtype &with = _vm->_gyro->peds[whichped]; - if (_vm->_trip->tr[0].x == with.x) - bearing_result = 0; /* This would cause a division by zero if we let it through. */ - else { - /* - bearing:=trunc(((arctan((_vm->_trip->tr[1].y-y)/(_vm->_trip->tr[1].x-x)))*rad2deg)+90) mod 360*/ + whichped--; // Different array indexes in Pascal and C. + + const double rad2deg = 180 / 3.14 /*Pi*/; - if (_vm->_trip->tr[0].x < with.x) - bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 90; - else - bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 270; - } - } - return bearing_result; + if (_vm->_trip->tr[0].x == _vm->_gyro->peds[whichped].x) + return 0; + else + if (_vm->_trip->tr[0].x < _vm->_gyro->peds[whichped].x) + return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 90; + else + return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 270; } void Lucerna::sprite_run() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 8ab7342c426e..854c01cc2839 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -100,7 +100,7 @@ class Lucerna { void major_redraw(); - uint16 bearing(byte whichped); + uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees. void flesh_colours(); From f729e9e84893e2da9803a9b1ae2210d42db449f8 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 25 Aug 2013 17:10:29 +0200 Subject: [PATCH 0659/1332] AVALANCHE: Repair Acci::wordnum(). --- engines/avalanche/acci2.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 5cfafd1ad445..74a74b7171db 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -238,7 +238,12 @@ byte Acci::wordnum(Common::String x) { return 0; for (int32 fv = nowords - 1; fv >= 0; fv--) - if ((words[fv].w == x) || (Common::String(words[fv].w.c_str(), x.size()) == x)) + if (words[fv].w == x) + return words[fv].n; + + // If not found as a whole, we look for it as a substring. + for (int32 fv = nowords - 1; fv >= 0; fv--) + if (Common::String(words[fv].w.c_str(), x.size()) == x) return words[fv].n; return pardon; @@ -561,7 +566,7 @@ void Acci::parse() { fv++; } - if (_vm->_gyro->subjnumber == 0) // Still not found. + if ((_vm->_gyro->subjnumber == 0) && !thats.empty()) // Still not found. for (fv = 0; fv < thats.size() - 1; fv++) if ((byte)thats[fv] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = (byte)thats[fv + 1]; @@ -569,7 +574,7 @@ void Acci::parse() { break; } - if (_vm->_gyro->subjnumber == 0) // STILL not found! Must be the word after "say". + if ((_vm->_gyro->subjnumber == 0) && !thats.empty())// STILL not found! Must be the word after "say". for (fv = 0; fv < thats.size() - 1; fv++) if (((byte)thats[fv] == 7) && ((byte)thats[fv + 1] != 0) && !((225 <= (byte)thats[fv + 1]) && ((byte)thats[fv + 1] <= 229))) { // SAY not followed by a preposition From 26d2e1bd18b9e9654d3aaa2e900ca36d424244ca Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 25 Aug 2013 17:38:22 +0200 Subject: [PATCH 0660/1332] AVALANCHE: Fix array indexes in Acci::do_that(), upgrade Lucerna::enterroom(). --- engines/avalanche/acci2.cpp | 20 ++++++++++---------- engines/avalanche/lucerna2.cpp | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 74a74b7171db..2ee878d91f68 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1364,8 +1364,8 @@ void Acci::do_that() { if (thing == _vm->_gyro->badge) { _vm->_visa->dixi('q', 32); /* Thanks! Wow! */ _vm->_lucerna->points(3); - _vm->_gyro->dna.obj[_vm->_gyro->badge] = false; - _vm->_gyro->dna.obj[_vm->_gyro->habit] = true; + _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; + _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; _vm->_gyro->dna.givenbadgetoiby = true; _vm->_celer->show_one(8); _vm->_celer->show_one(9); @@ -1375,9 +1375,9 @@ void Acci::do_that() { case _vm->_gyro->payles: if (_vm->_gyro->dna.ayles_is_awake) { if (thing == _vm->_gyro->pen) { - _vm->_gyro->dna.obj[_vm->_gyro->pen] = false; + _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; _vm->_visa->dixi('q', 54); - _vm->_gyro->dna.obj[_vm->_gyro->ink] = true; + _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = true; _vm->_gyro->dna.given_pen_to_ayles = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(2); @@ -1389,7 +1389,7 @@ void Acci::do_that() { case _vm->_gyro->pgeida: switch (thing) { case _vm->_gyro->potion: - _vm->_gyro->dna.obj[_vm->_gyro->potion] = false; + _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = false; _vm->_visa->dixi('u', 16); /* She drinks it. */ _vm->_lucerna->points(2); _vm->_gyro->dna.geida_given_potion = true; @@ -1674,7 +1674,7 @@ void Acci::do_that() { _vm->_lucerna->points(3); _vm->_celer->show_one(12); - _vm->_scrolls->display(booze[thing] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->display(booze[thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->dna.drinking = thing; _vm->_celer->show_one(10); @@ -1685,7 +1685,7 @@ void Acci::do_that() { examine(); break; // We have a right one here - buy Pepsi??! case _vm->_gyro->wine: - if (_vm->_gyro->dna.obj[_vm->_gyro->wine]) // We've already got the wine! + if (_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) // We've already got the wine! _vm->_visa->dixi('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->dna.malagauche == 177) { // Already getting us one. @@ -1751,7 +1751,7 @@ void Acci::do_that() { if ((_vm->_gyro->dna.room == r__brummieroad) && ((person == 157) || (thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) && (_vm->_gyro->whereis[7] == _vm->_gyro->dna.room)) { - switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow] * 2) { + switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->dixi('Q', 10); @@ -1788,10 +1788,10 @@ void Acci::do_that() { else { ok = true; for (ff = 0; ff < thats.size(); ff++) { - for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) { + for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password - 1].w.size(); fv++) { Common::String temp = realwords[ff]; temp.toUppercase(); - if (words[_vm->_gyro->dna.pass_num + first_password].w[fv] != temp[fv]) + if (words[_vm->_gyro->dna.pass_num + first_password - 1].w[fv] != temp[fv]) ok = false; } } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d96bbbc5e011..3249f1b7b19f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -766,6 +766,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->seescroll = false; /* Now it can work again! */ + if (_vm->_gyro->isLoaded) + _vm->_gyro->isLoaded = false; } void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! */ From 6df55520b7ea32b0c74873b9586e3578cebd271c Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 25 Aug 2013 18:05:02 +0200 Subject: [PATCH 0661/1332] AVALANCHE: Implement Acci::exampers(). Repair Avalot::setup(). --- engines/avalanche/acci2.cpp | 22 +++++++++++++++++++++- engines/avalanche/avalot.cpp | 6 +----- engines/avalanche/gyro2.h | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2ee878d91f68..8a194ebd2d62 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -655,7 +655,27 @@ bool Acci::personshere() { // Person equivalent of "holding". } void Acci::exampers() { - warning("STUB: Acci::exampers()"); + if (personshere()) { + if (thing != _vm->_gyro->thinks) + _vm->_lucerna->thinkabout(person, _vm->_gyro->a_person); + person -= 149; + switch (person) { /* Special cases */ + case 11: + if (_vm->_gyro->dna.wonnim) + _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" + return; + case 99: + if (_vm->_gyro->dna.lustie_is_asleep) + _vm->_visa->dixi('Q', 65); // He's asleep. (65! Wow!) + return; + } + // Otherwise... + _vm->_visa->dixi('p', person); + } + + // And afterwards... + if ((person == 14) && (!_vm->_gyro->dna.ayles_is_awake)) + _vm->_visa->dixi('Q', 13); } bool Acci::holding() { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 95f564e011ef..de37f504fa9d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -195,12 +195,8 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _vm->loadGame(loadSlot); - } else + } else { _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). - - - - if (!_vm->_gyro->isLoaded) { _vm->_gyro->newgame(); // No game was requested- load the default. _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 825d40f16119..ec78028fcf06 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -500,7 +500,7 @@ class Gyro { bool lmo, mousemade; Common::String scroll[15]; byte scrolln, score, whichwas; - char thinks; + byte thinks; bool thinkthing; /* pp:array[1..1000] of postype; From 762e91218d0fe1febcc15d1310c9e7f4c9937073 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 09:14:27 +0200 Subject: [PATCH 0662/1332] AVALANCHE: Repair array indexes in Timeout. --- engines/avalanche/timeout2.cpp | 116 +++++++++++++++------------------ 1 file changed, 54 insertions(+), 62 deletions(-) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index bbb5e8cc3f18..a7f61beb8103 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -245,7 +245,7 @@ void Timeout::open_drawbridge() { _vm->_celer->show_one(_vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } @@ -263,7 +263,7 @@ void Timeout::avaricius_talks() { } void Timeout::urinate() { - _vm->_trip->tr[1].turn(_vm->_trip->up); + _vm->_trip->tr[0].turn(_vm->_trip->up); _vm->_trip->stopwalking(); _vm->_lucerna->showrw(); set_up_timer(14, proctoilet2, reason_gototoilet); @@ -287,9 +287,9 @@ void Timeout::stairs() { _vm->_trip->tr[0].walkto(4); _vm->_celer->show_one(2); _vm->_gyro->dna.brummie_stairs = 2; - _vm->_gyro->magics[11].op = _vm->_gyro->special; - _vm->_gyro->magics[11].data = 2; /* Reached the bottom of the stairs. */ - _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Stop them hitting the sides (or the game will hang.) */ + _vm->_gyro->magics[10].op = _vm->_gyro->special; + _vm->_gyro->magics[10].data = 2; /* Reached the bottom of the stairs. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Stop them hitting the sides (or the game will hang.) */ } void Timeout::cardiff_survey() { @@ -319,38 +319,38 @@ void Timeout::get_tied_up() { _vm->_gyro->dna.user_moves_avvy = false; _vm->_gyro->dna.been_tied_up = true; _vm->_trip->stopwalking(); - _vm->_trip->tr[2].stopwalk(); - _vm->_trip->tr[2].stophoming(); - _vm->_trip->tr[2].call_eachstep = true; - _vm->_trip->tr[2].eachstep = _vm->_trip->procgrab_avvy; + _vm->_trip->tr[1].stopwalk(); + _vm->_trip->tr[1].stophoming(); + _vm->_trip->tr[1].call_eachstep = true; + _vm->_trip->tr[1].eachstep = _vm->_trip->procgrab_avvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } void Timeout::get_tied_up2() { - _vm->_trip->tr[1].walkto(4); - _vm->_trip->tr[2].walkto(5); - _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* No effect when you touch the boundaries. */ + _vm->_trip->tr[0].walkto(4); + _vm->_trip->tr[1].walkto(5); + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* No effect when you touch the boundaries. */ _vm->_gyro->dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { - _vm->_trip->tr[2].check_me = false; - _vm->_trip->tr[1].init(7, true, _vm->_trip); /* Robin Hood */ + _vm->_trip->tr[1].check_me = false; + _vm->_trip->tr[0].init(7, true, _vm->_trip); /* Robin Hood */ _vm->_gyro->whereis[_vm->_gyro->probinhood] = r__robins; _vm->_trip->apped(1, 2); _vm->_visa->dixi('q', 39); - _vm->_trip->tr[1].walkto(7); + _vm->_trip->tr[0].walkto(7); set_up_timer(55, prochang_around2, reason_hanging_around); } void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); - _vm->_trip->tr[2].vanishifstill = false; - _vm->_trip->tr[2].walkto(4); + _vm->_trip->tr[1].vanishifstill = false; + _vm->_trip->tr[1].walkto(4); _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = r__robins; _vm->_visa->dixi('q', 41); - _vm->_trip->tr[1].done(); - _vm->_trip->tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */ + _vm->_trip->tr[0].done(); + _vm->_trip->tr[1].done(); /* Get rid of Robin Hood and Friar Tuck. */ set_up_timer(1, procafter_the_shootemup, reason_hanging_around); /* Immediately call the following proc (when you have a chance). */ @@ -380,7 +380,7 @@ void Timeout::jacques_wakes_up() { case 3 : /* Gone through the door. */ _vm->_celer->show_one(2); /* Not on the floor, either. */ _vm->_celer->show_one(4); /* He's gone... so the door's open. */ - _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; /* Gone! */ + _vm->_gyro->whereis[_vm->_gyro->pjacques - 1] = 0; /* Gone! */ break; } @@ -406,9 +406,9 @@ void Timeout::jacques_wakes_up() { void Timeout::naughty_duke() { /* This is when the Duke comes in and takes your money. */ - _vm->_trip->tr[2].init(9, false, _vm->_trip); /* Here comes the Duke. */ + _vm->_trip->tr[1].init(9, false, _vm->_trip); /* Here comes the Duke. */ _vm->_trip->apped(2, 1); /* He starts at the door... */ - _vm->_trip->tr[2].walkto(3); /* He walks over to you. */ + _vm->_trip->tr[1].walkto(3); /* He walks over to you. */ /* Let's get the door opening. */ _vm->_celer->show_one(1); @@ -420,8 +420,8 @@ void Timeout::naughty_duke() { void Timeout::naughty_duke2() { _vm->_visa->dixi('q', 48); /* Ha ha, it worked again! */ - _vm->_trip->tr[2].walkto(1); /* Walk to the door. */ - _vm->_trip->tr[2].vanishifstill = true; /* Then go away! */ + _vm->_trip->tr[1].walkto(1); /* Walk to the door. */ + _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -432,19 +432,16 @@ void Timeout::naughty_duke3() { } void Timeout::jump() { - dnatype &with = _vm->_gyro->dna; + _vm->_gyro->dna.jumpstatus++; - with.jumpstatus += 1; - - triptype &with1 = _vm->_trip->tr[1]; - switch (with.jumpstatus) { + switch (_vm->_gyro->dna.jumpstatus) { case 1: case 2: case 3: case 5: case 7: case 9: - with1.y -= 1; + _vm->_trip->tr[0].y--; break; case 12: case 13: @@ -452,20 +449,18 @@ void Timeout::jump() { case 16: case 18: case 19: - with1.y += 1; + _vm->_trip->tr[0].y++; break; } - if (with.jumpstatus == 20) { - /* End of jump. */ + if (_vm->_gyro->dna.jumpstatus == 20) { /* End of jump. */ _vm->_gyro->dna.user_moves_avvy = true; _vm->_gyro->dna.jumpstatus = 0; - } else { - /* Still jumping. */ + } else { /* Still jumping. */ set_up_timer(1, procjump, reason_jumping); } - if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + if ((_vm->_gyro->dna.jumpstatus == 10) /* You're at the highest point of your jump. */ && (_vm->_gyro->dna.room == r__insidecardiffcastle) && (_vm->_gyro->dna.arrow_in_the_door == true) && (_vm->_trip->infield(3))) { /* beside the wall*/ @@ -525,9 +520,9 @@ void Timeout::greetsmonk() { } void Timeout::fall_down_oubliette() { - _vm->_gyro->magics[9].op = _vm->_gyro->nix; - _vm->_trip->tr[1].iy += 1; /* increments dx/dy! */ - _vm->_trip->tr[1].y += _vm->_trip->tr[1].iy; /* Dowwwn we go... */ + _vm->_gyro->magics[8].op = _vm->_gyro->nix; + _vm->_trip->tr[0].iy += 1; /* increments dx/dy! */ + _vm->_trip->tr[0].y += _vm->_trip->tr[1].iy; /* Dowwwn we go... */ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -540,51 +535,48 @@ void Timeout::meet_avaroid() { _vm->_gyro->dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - triptype &with = _vm->_trip->tr[1]; - with.face = _vm->_trip->left; - with.x = 151; - with.ix = -3; - with.iy = -5; + _vm->_trip->tr[0].face = _vm->_trip->left; + _vm->_trip->tr[0].x = 151; + _vm->_trip->tr[0].ix = -3; + _vm->_trip->tr[0].iy = -5; _vm->_gyro->background(2); } } void Timeout::rise_up_oubliette() { - triptype &with = _vm->_trip->tr[1]; - - with.visible = true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy > 0) + _vm->_trip->tr[0].visible = true; + _vm->_trip->tr[0].iy++; /* decrements dx/dy! */ + _vm->_trip->tr[0].y -= _vm->_trip->tr[0].iy; /* Uuuupppp we go... */ + if (_vm->_trip->tr[0].iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else _vm->_gyro->dna.user_moves_avvy = true; } void Timeout::robin_hood_and_geida() { - _vm->_trip->tr[1].init(7, true, _vm->_trip); + _vm->_trip->tr[0].init(7, true, _vm->_trip); _vm->_trip->apped(1, 7); - _vm->_trip->tr[1].walkto(6); - _vm->_trip->tr[2].stopwalk(); - _vm->_trip->tr[2].face = _vm->_trip->left; + _vm->_trip->tr[0].walkto(6); + _vm->_trip->tr[1].stopwalk(); + _vm->_trip->tr[1].face = _vm->_trip->left; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->dna.geida_follows = false; } void Timeout::robin_hood_and_geida_talk() { _vm->_visa->dixi('q', 66); + _vm->_trip->tr[0].walkto(2); _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[2].walkto(2); + _vm->_trip->tr[0].vanishifstill = true; _vm->_trip->tr[1].vanishifstill = true; - _vm->_trip->tr[2].vanishifstill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } void Timeout::avalot_returns() { + _vm->_trip->tr[0].done(); _vm->_trip->tr[1].done(); - _vm->_trip->tr[2].done(); - _vm->_trip->tr[1].init(0, true, _vm->_trip); + _vm->_trip->tr[0].init(0, true, _vm->_trip); _vm->_trip->apped(1, 1); _vm->_visa->dixi('q', 67); _vm->_gyro->dna.user_moves_avvy = true; @@ -593,13 +585,13 @@ void Timeout::avalot_returns() { void Timeout::avvy_sit_down() { /* This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. */ - if (_vm->_trip->tr[1].homing) /* Still walking */ + if (_vm->_trip->tr[0].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->show_one(3); _vm->_gyro->dna.sitting_in_pub = true; _vm->_gyro->dna.user_moves_avvy = false; - _vm->_trip->tr[1].visible = false; + _vm->_trip->tr[0].visible = false; } } @@ -639,14 +631,14 @@ void Timeout::avalot_falls() { } void Timeout::spludwick_goes_to_cauldron() { - if (_vm->_trip->tr[2].homing) + if (_vm->_trip->tr[1].homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } void Timeout::spludwick_leaves_cauldron() { - _vm->_trip->tr[2].call_eachstep = true; /* So that normal procs will continue. */ + _vm->_trip->tr[1].call_eachstep = true; /* So that normal procs will continue. */ } void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ From f2049db1db474d52ed5a85f3a37fbdb5d892301e Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 09:47:39 +0200 Subject: [PATCH 0663/1332] AVALANCHE: Repair array indexes in Trip. --- engines/avalanche/trip6.cpp | 320 ++++++++++++++---------------------- 1 file changed, 124 insertions(+), 196 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 7dbda47eea5d..685c8d80e089 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -273,14 +273,12 @@ void triptype::bounce() { } int8 triptype::sgn(int16 x) { - int8 sgn_result; if (x > 0) - sgn_result = 1; + return 1; else if (x < 0) - sgn_result = -1; + return -1; else - sgn_result = 0; /* x=0 */ - return sgn_result; + return 0; } void triptype::walkto(byte pednum) { @@ -431,7 +429,7 @@ triptype *triptype::done() { totalnum--; _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) - _info.xw += 1; + _info.xw++; for (aa = 0; aa < /*nds*seq*/ a.num; aa++) { totalnum--; delete _info.mani[totalnum]; @@ -544,8 +542,6 @@ void Trip::catamove(byte ped) { be called. It changes the Also codes so that they may match the picture on the screen. (Coming soon: It draws up the screen, too.) */ - warning("Repair array indexes in Trip::catamove()"); - int32 here; uint16 xy_uint16; byte fv, ff; @@ -574,8 +570,8 @@ void Trip::catamove(byte ped) { fliproom(r__lusties, 5); _vm->_scrolls->display("Oh no... here we go again..."); _vm->_gyro->dna.user_moves_avvy = false; - tr[1].iy = 1; - tr[1].ix = 0; + tr[0].iy = 1; + tr[0].ix = 0; return; } @@ -585,66 +581,66 @@ void Trip::catamove(byte ped) { switch (here & 0xf) { /* West. */ case 0: /* no connection (wall) */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(28); break; case 0x1: /* no connection (wall + shield), */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(29); /* ...shield. */ break; case 0x2: /* wall with door */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(30); /* ...door. */ break; case 0x3: /* wall with door and shield */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(30); /* ...door, and... */ _vm->_celer->show_one(29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(5); /* ...window. */ break; case 0x5: /* wall with door and window */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(30); /* ...door, and... */ _vm->_celer->show_one(5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->nix; /* No door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* No door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ - _vm->_gyro->magics[2].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[13].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(28); /* Wall, plus... */ _vm->_celer->show_one(30); /* ...door, and... */ _vm->_celer->show_one(7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Sloping wall. */ - _vm->_gyro->magics[3].op = _vm->_gyro->special; /* Straight wall. */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Sloping wall. */ + _vm->_gyro->magics[2].op = _vm->_gyro->special; /* Straight wall. */ break; } @@ -652,52 +648,52 @@ void Trip::catamove(byte ped) { switch ((here & 0xf0) >> 4) { /* East */ case 0: /* no connection (wall) */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(19); break; case 0x1: /* no connection (wall + window), */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(19); /* Wall, plus... */ _vm->_celer->show_one(20); /* ...window. */ break; case 0x2: /* wall with door */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(19); /* Wall, plus... */ _vm->_celer->show_one(21); /* ...door. */ break; case 0x3: /* wall with door and window */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(19); /* Wall, plus... */ _vm->_celer->show_one(20); /* ...door, and... */ _vm->_celer->show_one(21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* No door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* No door. */ _vm->_celer->show_one(19); /* Wall, plus... */ _vm->_celer->show_one(18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ - _vm->_gyro->magics[5].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ _vm->_celer->show_one(19); /* Wall, plus... */ _vm->_celer->show_one(21); /* ...door, and... */ _vm->_celer->show_one(18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Sloping wall. */ - _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Straight wall. */ - _vm->_gyro->portals[15].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Sloping wall. */ + _vm->_gyro->magics[5].op = _vm->_gyro->special; /* Straight wall. */ + _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ break; } @@ -705,39 +701,39 @@ void Trip::catamove(byte ped) { switch ((here & 0xf00) >> 8) { /* South */ case 0: /* No connection. */ - _vm->_gyro->magics[7].op = _vm->_gyro->bounces; + _vm->_gyro->magics[6].op = _vm->_gyro->bounces; + _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; - _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x1: _vm->_celer->show_one(22); if ((xy_uint16 == 2051) & (_vm->_gyro->dna.geida_follows)) - _vm->_gyro->magics[13].op = _vm->_gyro->exclaim; + _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; else - _vm->_gyro->magics[13].op = _vm->_gyro->special; /* Right exit south. */ + _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Right exit south. */ - _vm->_gyro->magics[7].op = _vm->_gyro->bounces; - _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[6].op = _vm->_gyro->bounces; + _vm->_gyro->magics[11].op = _vm->_gyro->bounces; break; case 0x2: _vm->_celer->show_one(23); - _vm->_gyro->magics[7].op = _vm->_gyro->special; /* Middle exit south. */ + _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Middle exit south. */ + _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; - _vm->_gyro->magics[13].op = _vm->_gyro->bounces; break; case 0x3: _vm->_celer->show_one(24); - _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Left exit south. */ - _vm->_gyro->magics[7].op = _vm->_gyro->bounces; - _vm->_gyro->magics[13].op = _vm->_gyro->bounces; + _vm->_gyro->magics[11].op = _vm->_gyro->special; /* Left exit south. */ + _vm->_gyro->magics[6].op = _vm->_gyro->bounces; + _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; } switch ((here & 0xf000) >> 12) { /* North */ case 0: /* No connection */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; - _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; + _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ break; // LEFT handles: /* @@ -749,8 +745,8 @@ void Trip::catamove(byte ped) { */ case 0x2: _vm->_celer->show_one(4); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Middle exit north. - _vm->_gyro->portals[12].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. + _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; /* case 0x3: _vm->_celer->show_one(4); @@ -766,8 +762,8 @@ void Trip::catamove(byte ped) { */ case 0x5: _vm->_celer->show_one(3); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Middle exit north. */ - _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; /* Middle exit north. */ + _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; /* case 0x6: @@ -787,26 +783,26 @@ void Trip::catamove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer->show_one(32); - _vm->_gyro->magics[1].op = _vm->_gyro->special; /* Middle arch north. */ - _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->special; /* Middle arch north. */ + _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ } break; /* DECORATIONS: */ case 0xd: /* No connection + WINDOW */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; - _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; + _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(14); break; case 0xe: /* No connection + TORCH */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; - _vm->_gyro->portals[12].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; + _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ _vm->_celer->show_one(8); break; /* Recessed door: */ case 0xf: - _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Door to Geida's room. */ + _vm->_gyro->magics[0].op = _vm->_gyro->nix; /* Door to Geida's room. */ _vm->_celer->show_one(1); - _vm->_gyro->portals[12].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; } @@ -843,13 +839,11 @@ void Trip::catamove(byte ped) { } if ((_vm->_gyro->dna.geida_follows) & (ped > 0)) { - triptype &with = tr[2]; - - if (!with.quick) /* If we don't already have her... */ - tr[2].init(5, true, this); /* ...Load Geida. */ + if (!tr[1].quick) /* If we don't already have her... */ + tr[1].init(5, true, this); /* ...Load Geida. */ apped(2, geida_ped(ped)); - tr[2].call_eachstep = true; - tr[2].eachstep = procgeida_procs; + tr[1].call_eachstep = true; + tr[1].eachstep = procgeida_procs; } } @@ -865,40 +859,40 @@ void Trip::call_special(uint16 which) { case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ _vm->_celer->show_one(1); _vm->_gyro->dna.brummie_stairs = 1; - _vm->_gyro->magics[10].op = _vm->_gyro->nix; + _vm->_gyro->magics[9].op = _vm->_gyro->nix; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); stopwalking(); _vm->_gyro->dna.user_moves_avvy = false; break; case 2: /* _vm->_gyro->special 2: Room 22: bottom of stairs. */ _vm->_gyro->dna.brummie_stairs = 3; - _vm->_gyro->magics[11].op = _vm->_gyro->nix; - _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; - _vm->_gyro->magics[12].data = 5; - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Now works as planned! */ + _vm->_gyro->magics[10].op = _vm->_gyro->nix; + _vm->_gyro->magics[11].op = _vm->_gyro->exclaim; + _vm->_gyro->magics[11].data = 5; + _vm->_gyro->magics[3].op = _vm->_gyro->bounces; /* Now works as planned! */ stopwalking(); _vm->_visa->dixi('q', 26); _vm->_gyro->dna.user_moves_avvy = true; break; case 3: /* _vm->_gyro->special 3: Room 71: triggers dart. */ - tr[1].bounce(); /* Must include that. */ + tr[0].bounce(); /* Must include that. */ if (!_vm->_gyro->dna.arrow_triggered) { _vm->_gyro->dna.arrow_triggered = true; apped(2, 4); /* The dart starts at ped 4, and... */ - tr[2].walkto(5); /* flies to ped 5. */ - tr[2].face = 0; /* Only face. */ + tr[1].walkto(5); /* flies to ped 5. */ + tr[1].face = 0; /* Only face. */ /* Should call some kind of Eachstep procedure which will deallocate the sprite when it hits the wall, and replace it with the chunk graphic of the arrow buried in the plaster. */ /* OK! */ - tr[2].call_eachstep = true; - tr[2].eachstep = procarrow_procs; + tr[1].call_eachstep = true; + tr[1].eachstep = procarrow_procs; } break; case 4: /* This is the ghost room link. */ _vm->_lucerna->dusk(); - tr[1].turn(right); /* you'll see this after we get back from bootstrap */ + tr[0].turn(right); /* you'll see this after we get back from bootstrap */ _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_enid->back_to_bootstrap(3); break; @@ -907,28 +901,28 @@ void Trip::call_special(uint16 which) { /* _vm->_gyro->special 5: Room 42: touched tree, and get tied up. */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Boundary effect is now working again. */ _vm->_visa->dixi('q', 35); - tr[1].done(); + tr[0].done(); /*tr[1].vanishifstill:=true;*/ _vm->_celer->show_one(2); _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; - tr[2].walkto(3); - tr[2].vanishifstill = true; - tr[2].check_me = true; /* One of them must have Check_Me switched on. */ + tr[1].walkto(3); + tr[1].vanishifstill = true; + tr[1].check_me = true; /* One of them must have Check_Me switched on. */ _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 177; /* Not here, then. */ _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; case 6: /* _vm->_gyro->special 6: fall down oubliette. */ _vm->_gyro->dna.user_moves_avvy = false; - tr[1].ix = 3; - tr[1].iy = 0; - tr[1].face = right; + tr[0].ix = 3; + tr[0].iy = 0; + tr[0].face = right; _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ - tr[1].visible = false; + tr[0].visible = false; _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); @@ -940,18 +934,18 @@ void Trip::call_special(uint16 which) { case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { _vm->_visa->dixi('q', 63); - tr[2].turn(down); - tr[2].stopwalk(); - tr[2].call_eachstep = false; /* Geida */ + tr[1].turn(down); + tr[1].stopwalk(); + tr[1].call_eachstep = false; /* Geida */ _vm->_lucerna->gameover(); } break; case 9: /* _vm->_gyro->special 9: lose Geida to Robin Hood... */ if (!_vm->_gyro->dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ - tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ - tr[2].walkto(4); /* She walks to somewhere... */ - tr[1].done(); /* Lose Avvy. */ + tr[1].call_eachstep = false; /* She no longer follows Avvy around. */ + tr[1].walkto(4); /* She walks to somewhere... */ + tr[0].done(); /* Lose Avvy. */ _vm->_gyro->dna.user_moves_avvy = false; _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); break; @@ -1008,7 +1002,7 @@ void Trip::call_special(uint16 which) { break; case 13: /* _vm->_gyro->special 13: transfer west in catacombs. */ _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_x -= 1; + _vm->_gyro->dna.cat_x--; catamove(3); if (_vm->_gyro->dna.room != r__catacombs) return; @@ -1186,7 +1180,7 @@ void Trip::getback() { /* Eachstep procedures: */ void Trip::follow_avvy_y(byte tripnum) { - if (tr[1].face == left) + if (tr[0].face == left) return; if (tr[tripnum].homing) tr[tripnum].hy = tr[1].y; @@ -1233,12 +1227,12 @@ void Trip::arrow_procs(byte tripnum) { This is so if: a) the bottom of the arrow is below Avvy's head, b) the left of the arrow is left of the right of Avvy's head, and c) the right of the arrow is right of the left of Avvy's head. */ - if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[1].y) /* A */ - && (tr[tripnum].x <= (tr[1].x + tr[1]._info.xl)) /* B */ - && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[1].x)) { /* C */ + if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[0].y) /* A */ + && (tr[tripnum].x <= (tr[0].x + tr[0]._info.xl)) /* B */ + && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[0].x)) { /* C */ /* OK, it's hit him... what now? */ - tr[2].call_eachstep = false; /* prevent recursion. */ + tr[1].call_eachstep = false; /* prevent recursion. */ _vm->_visa->dixi('Q', 47); /* Complaint! */ tr[tripnum].done(); /* Deallocate the arrow. */ /* tr[1].done; { Deallocate normal pic of Avvy. } @@ -1282,8 +1276,8 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ byte fv; int16 tox, toy; - tox = tr[1].x + 17; - toy = tr[1].y - 1; + tox = tr[0].x + 17; + toy = tr[0].y--; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = left; @@ -1297,8 +1291,8 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ tr[tripnum].x = tox; } if (tr[tripnum].y < toy) - tr[tripnum].y += 1; - tr[tripnum].step += 1; + tr[tripnum].y++; + tr[tripnum].step++; if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; } @@ -1306,7 +1300,7 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ void Trip::take_a_step(byte &tripnum) { if (tr[tripnum].ix == 0) { - tr[tripnum].step += 1; + tr[tripnum].step++; if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; tr[tripnum].count = 0; @@ -1470,72 +1464,7 @@ void Trip::stopwalking() { } void Trip::tripkey(char dir) { - if ((_vm->_gyro->ctrl == cjoy) | (!_vm->_gyro->dna.user_moves_avvy)) - return; - - triptype &with = tr[1]; - - switch (dir) { - case 'H': - if (_vm->_gyro->dna.rw != up) { - _vm->_gyro->dna.rw = up; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'P': - if (_vm->_gyro->dna.rw != down) { - _vm->_gyro->dna.rw = down; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'K': - if (_vm->_gyro->dna.rw != left) { - _vm->_gyro->dna.rw = left; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'M': - if (_vm->_gyro->dna.rw != right) { - _vm->_gyro->dna.rw = right; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'I': - if (_vm->_gyro->dna.rw != ur) { - _vm->_gyro->dna.rw = ur; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'Q': - if (_vm->_gyro->dna.rw != dr) { - _vm->_gyro->dna.rw = dr; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'O': - if (_vm->_gyro->dna.rw != dl) { - _vm->_gyro->dna.rw = dl; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'G': - if (_vm->_gyro->dna.rw != ul) { - _vm->_gyro->dna.rw = ul; - rwsp(1, _vm->_gyro->dna.rw); - } else - stopwalking(); - break; - case 'L': - stopwalking(); - break; - } + warning("Replaced by Trip::handleMoveKey!"); } void Trip::readstick() { @@ -1552,9 +1481,9 @@ void Trip::hide_in_the_cupboard() { if (_vm->_gyro->dna.avvys_in_the_cupboard) { if (_vm->_gyro->dna.wearing == nowt) - _vm->_scrolls->display("\6AVVY!\22 Get dressed first!"); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { - tr[1].visible = true; + tr[0].visible = true; _vm->_gyro->dna.user_moves_avvy = true; apped(1, 3); /* Walk out of the cupboard. */ _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); @@ -1565,11 +1494,10 @@ void Trip::hide_in_the_cupboard() { } } else { /* Not hiding in the cupboard */ - tr[1].visible = false; + tr[0].visible = false; _vm->_gyro->dna.user_moves_avvy = false; - _vm->_scrolls->display(Common::String("You walk into the room...\20It seems to be an empty, ") + - "but dusty, cupboard. Hmmmm... you leave the door slightly open to " + - "avoid suffocation."); + _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); _vm->_gyro->dna.avvys_in_the_cupboard = true; _vm->_celer->show_one(8); } From e36d90f8b8a10f9820975088dea1992b940289a6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 09:54:40 +0200 Subject: [PATCH 0664/1332] AVALANCHE: Repair Lucerna::callverb(). --- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/lucerna2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3249f1b7b19f..2477db152061 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -66,7 +66,7 @@ void Lucerna::init() { else _vm->_gyro->atkey = "alt-"; } -void Lucerna::callverb(char n) { +void Lucerna::callverb(byte n) { if (n == _vm->_acci->pardon) { _vm->_scrolls->display(Common::String("The f5 key lets you do a particular action in certain ") + "situations. However, at the moment there is nothing " + diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 854c01cc2839..451bd7379333 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -46,7 +46,7 @@ class Lucerna { void init(); - void callverb(char n); + void callverb(byte n); void draw_also_lines(); From 934170b35398cb5957270685d8bb65af4df8191e Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 11:45:06 +0200 Subject: [PATCH 0665/1332] AVALANCHE: Implement Acci::inv(). --- engines/avalanche/acci2.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 8a194ebd2d62..cec1d4b88bf4 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -734,10 +734,25 @@ void Acci::examine() { void Acci::inv() { /* the time-honoured command... */ - char fv; byte q = 0; - - warning("STUB: Acci::inv()"); + _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); + { + for (byte fv = 0; fv < numobjs; fv++) + if (_vm->_gyro->dna.obj[fv]) { + q++; + if (q == _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(_vm->_gyro->get_better(fv) + _vm->_scrolls->kControlToBuffer); + if (fv == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); + if (q < _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); + } + if (_vm->_gyro->dna.wearing == nowt) + _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + else + _vm->_scrolls->display("."); + } } void Acci::swallow() { /* Eat something. */ From 06346339a9deb849e09f25049c42a1bcd0a45e0c Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 16:10:17 +0200 Subject: [PATCH 0666/1332] AVALANCHE: Implement Timeout::after_the_shootemup(), repair a lot of array indexes in various places. --- engines/avalanche/acci2.cpp | 36 +++++++++++++++++----------------- engines/avalanche/gyro2.cpp | 8 ++++---- engines/avalanche/lucerna2.cpp | 8 ++++---- engines/avalanche/timeout2.cpp | 34 ++++++++++++++++++++++++++++++-- engines/avalanche/trip6.cpp | 7 +++++-- engines/avalanche/visa2.cpp | 6 +++--- 6 files changed, 66 insertions(+), 33 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index cec1d4b88bf4..644db34349cc 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -742,8 +742,8 @@ void Acci::inv() { /* the time-honoured command... */ q++; if (q == _vm->_gyro->dna.carrying) _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->get_better(fv) + _vm->_scrolls->kControlToBuffer); - if (fv == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(_vm->_gyro->get_better(fv + 1) + _vm->_scrolls->kControlToBuffer); + if ((fv + 1) == _vm->_gyro->dna.wearing) _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); if (q < _vm->_gyro->dna.carrying) _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); @@ -767,7 +767,7 @@ void Acci::swallow() { /* Eat something. */ _vm->_visa->dixi('U', 1); _vm->_pingo->wobble(); _vm->_visa->dixi('U', 2); - _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; _vm->_lucerna->objectlist(); have_a_drink(); } @@ -800,7 +800,7 @@ void Acci::swallow() { /* Eat something. */ if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('U', 11); else { _vm->_visa->dixi('U', 8); - _vm->_gyro->dna.obj[_vm->_gyro->onion] = false; + _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; _vm->_lucerna->objectlist(); } break; @@ -1023,7 +1023,7 @@ bool Acci::give2spludwick() { switch (thing) { case _vm->_gyro->onion: - _vm->_gyro->dna.obj[_vm->_gyro->onion] = false; + _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('q', 22); else { @@ -1035,7 +1035,7 @@ bool Acci::give2spludwick() { _vm->_lucerna->objectlist(); break; case _vm->_gyro->ink: - _vm->_gyro->dna.obj[_vm->_gyro->ink] = false; + _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick++; _vm->_visa->dixi('q', 24); @@ -1043,12 +1043,12 @@ bool Acci::give2spludwick() { _vm->_lucerna->points(3); break; case _vm->_gyro->mushroom: - _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = false; + _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; _vm->_visa->dixi('q', 25); _vm->_lucerna->points(5); _vm->_gyro->dna.given2spludwick++; go_to_cauldron(); - _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; + _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; _vm->_lucerna->objectlist(); break; default: @@ -1061,7 +1061,7 @@ bool Acci::give2spludwick() { void Acci::have_a_drink() { _vm->_gyro->dna.alcohol += 1; if (_vm->_gyro->dna.alcohol == 5) { - _vm->_gyro->dna.obj[_vm->_gyro->key] = true; /* Get the key. */ + _vm->_gyro->dna.obj[_vm->_gyro->key - 1] = true; /* Get the key. */ _vm->_gyro->dna.teetotal = true; _vm->_gyro->dna.avvy_is_awake = false; _vm->_gyro->dna.avvy_in_bed = true; @@ -1142,7 +1142,7 @@ void Acci::getproc(char thing) { if (_vm->_gyro->dna.box_contents == thing) { _vm->_celer->show_one(5); _vm->_scrolls->display("OK, I've got it."); - _vm->_gyro->dna.obj[thing] = true; + _vm->_gyro->dna.obj[thing - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.box_contents = nowt; _vm->_celer->show_one(6); @@ -1164,7 +1164,7 @@ void Acci::getproc(char thing) { _vm->_celer->show_one(4); /* No pen there now. */ _vm->_trip->call_special(3); /* Zap! */ _vm->_gyro->dna.taken_pen = true; - _vm->_gyro->dna.obj[_vm->_gyro->pen] = true; + _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; _vm->_lucerna->objectlist(); _vm->_scrolls->display("Taken."); } @@ -1186,7 +1186,7 @@ void Acci::getproc(char thing) { _vm->_scrolls->display("Got it!"); _vm->_gyro->dna.mushroom_growing = false; _vm->_gyro->dna.taken_mushroom = true; - _vm->_gyro->dna.obj[_vm->_gyro->mushroom] = true; + _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); } else @@ -1202,7 +1202,7 @@ void Acci::give_geida_the_lute() { _vm->_scrolls->display("Not yet. Try later!\232\2"); return; } - _vm->_gyro->dna.obj[_vm->_gyro->lute] = false; + _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; _vm->_lucerna->objectlist(); _vm->_visa->dixi('q', 64); /* She plays it. */ @@ -1263,7 +1263,7 @@ void Acci::person_speaks() { void Acci::heythanks() { person_speaks(); _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); - _vm->_gyro->dna.obj[thing] = false; + _vm->_gyro->dna.obj[thing - 1] = false; } void Acci::do_that() { @@ -1381,7 +1381,7 @@ void Acci::do_that() { case _vm->_gyro->pcrapulus: if (thing == _vm->_gyro->wine) { _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; } else heythanks(); break; @@ -1763,7 +1763,7 @@ void Acci::do_that() { _vm->_lucerna->points(3); } _vm->_gyro->pennycheck(3); // It costs thruppence. - _vm->_gyro->dna.obj[_vm->_gyro->onion] = true; + _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.bought_onion = true; _vm->_gyro->dna.rotten_onion = false; // It's OK when it leaves the stall! @@ -1801,8 +1801,8 @@ void Acci::do_that() { case 3: _vm->_visa->dixi('Q', 11); _vm->_gyro->dna.cwytalot_gone = true; - _vm->_gyro->dna.obj[_vm->_gyro->bolt] = false; - _vm->_gyro->dna.obj[_vm->_gyro->crossbow] = false; + _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = false; + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->magics[11].op = _vm->_gyro->nix; _vm->_lucerna->points(7); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index e7cf879ec00f..f689142bf004 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -332,10 +332,10 @@ void Gyro::newgame() { dna.pence = 30; /* 2/6 */ dna.rw = stopped; dna.wearing = clothes; - dna.obj[money] = true; - dna.obj[bodkin] = true; - dna.obj[bell] = true; - dna.obj[clothes] = true; + dna.obj[money - 1] = true; + dna.obj[bodkin - 1] = true; + dna.obj[bell - 1] = true; + dna.obj[clothes - 1] = true; thinks = 2; _vm->_lucerna->objectlist(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 2477db152061..7ed521467db7 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -344,7 +344,7 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ } if (_vm->_gyro->dna.room != r__outsideducks) { - if ((_vm->_gyro->dna.obj[_vm->_gyro->onion]) && !(_vm->_gyro->dna.onion_in_vinegar)) + if ((_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) && !(_vm->_gyro->dna.onion_in_vinegar)) _vm->_gyro->dna.rotten_onion = true; /* You're holding the onion */ } } @@ -559,9 +559,9 @@ void Lucerna::enterroom(byte x, byte ped) { { dnatype &with = _vm->_gyro->dna; - if ((_vm->_gyro->dna.obj[_vm->_gyro->wine]) && (_vm->_gyro->dna.winestate != 3)) { + if ((_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) && (_vm->_gyro->dna.winestate != 3)) { _vm->_visa->dixi('q', 9); /* Don't want to waste the wine! */ - _vm->_gyro->dna.obj[_vm->_gyro->wine] = false; + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; objectlist(); } } @@ -996,7 +996,7 @@ void Lucerna::fxtoggle() { void Lucerna::objectlist() { _vm->_gyro->dna.carrying = 0; - if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks]) + if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks - 1]) thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); /* you always have money */ for (byte fv = 0; fv < numobjs; fv++) if (_vm->_gyro->dna.obj[fv]) { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index a7f61beb8103..e7508ec5aeab 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -361,7 +361,37 @@ void Timeout::hang_around2() { } void Timeout::after_the_shootemup() { + + _vm->_trip->fliproom(_vm->_gyro->dna.room, 0); + // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! + + _vm->_trip->tr[0].init(0, true, _vm->_trip); /* Avalot. */ + _vm->_trip->apped(1, 2); + _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = true; + _vm->_lucerna->objectlist(); + + // Same as the added line above: TODO: Remove it later!!! + _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); + + //byte shootscore, gain; + + //shootscore = mem[storage_seg * storage_ofs]; + //gain = (shootscore + 5) / 10; /* Rounding up. */ + + //display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + + // strf(shootscore) + " 10) = " + strf(gain) + " points."); + + //if (gain > 20) { + // display("But we won't let you have more than 20 points!"); + // points(20); + //} else + // points(gain); + warning("STUB: Timeout::after_the_shootemup()"); + + _vm->_visa->dixi('q', 70); } void Timeout::jacques_wakes_up() { @@ -470,7 +500,7 @@ void Timeout::jump() { else { _vm->_celer->show_one(2); _vm->_gyro->dna.arrow_in_the_door = false; /* You've got it. */ - _vm->_gyro->dna.obj[_vm->_gyro->bolt] = true; + _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; _vm->_lucerna->objectlist(); _vm->_visa->dixi('q', 50); _vm->_lucerna->points(3); @@ -503,7 +533,7 @@ void Timeout::buywine() { _vm->_visa->dixi('D', 1); /* It'll be thruppence. */ if (_vm->_gyro->pennycheck(3)) { _vm->_visa->dixi('D', 4); /* You paid up. */ - _vm->_gyro->dna.obj[_vm->_gyro->wine] = true; + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.winestate = 1; /* OK Wine */ } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 685c8d80e089..8762250b5761 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -952,7 +952,7 @@ void Trip::call_special(uint16 which) { case 10: /* _vm->_gyro->special 10: transfer north in catacombs. */ if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { /* Into Geida's room. */ - if (_vm->_gyro->dna.obj[_vm->_gyro->key]) + if (_vm->_gyro->dna.obj[_vm->_gyro->key - 1]) _vm->_visa->dixi('q', 62); else { _vm->_visa->dixi('q', 61); @@ -1277,7 +1277,7 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ int16 tox, toy; tox = tr[0].x + 17; - toy = tr[0].y--; + toy = tr[0].y - 1; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = left; @@ -1601,6 +1601,9 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ void Trip::handleMoveKey(const Common::Event &event) { + if (!_vm->_gyro->dna.user_moves_avvy) + return; + if (_vm->_dropdown->ddm_o.menunow) _vm->_parser->tryDropdown(); else diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 4a6fbc7159c6..182783ee54c1 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -172,9 +172,9 @@ void Visa::talkto(byte whom) { if (_vm->_gyro->subjnumber == 0) switch (whom) { case _vm->_gyro->pspludwick: - if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion])) { + if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion - 1])) { dixi('q', 68); - _vm->_gyro->dna.obj[_vm->_gyro->potion] = true; + _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); return; @@ -276,7 +276,7 @@ void Visa::talkto(byte whom) { dixi('n', whom); // File not found! if ((_vm->_gyro->subjnumber == 0) && ((whom + 149) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->dna.obj[_vm->_gyro->badge] = true; + _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = true; _vm->_lucerna->objectlist(); dixi('q', 1); // Circular from Cardiff. _vm->_gyro->dna.talked_to_crapulus = true; From 338dac4e10b4795096ee3cce9fd895e783a14efa Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 26 Aug 2013 20:13:43 +0200 Subject: [PATCH 0667/1332] AVALANCHE: Implement Acci::store_interrogation() and all the functions it uses. --- engines/avalanche/acci2.cpp | 80 +++++++++++++++++++++++++++++----- engines/avalanche/timeout2.cpp | 8 ++-- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 644db34349cc..c1a195014883 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -389,29 +389,85 @@ bool Acci::do_pronouns() { return ambiguous; } -void Acci::lowercase() { - byte fv; - warning("STUB: Acci::lowercase()"); + +void Acci::lowercase() { + _vm->_parser->_inputText.toLowercase(); } void Acci::propernouns() { - byte fv; - lowercase(); - warning("STUB: Acci::propernouns()"); + + // We set every word's first character to uppercase. + for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) + if (_vm->_parser->_inputText[i] == ' ') + _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); + // And the first character as well. + _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); } void Acci::sayit() { /* This makes Avalot say the response. */ - Common::String x; - - warning("STUB: Acci::sayit()"); + Common::String x = _vm->_parser->_inputText; + x.setChar(toupper(x[0]), 0); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + + '.' + _vm->_scrolls->kControlSpeechBubble + _vm->_scrolls->kControlRegister + '2'); } void Acci::store_interrogation(byte interrogation) { - byte fv; + if (_vm->_parser->_inputText.empty()) + return; + + /* Strip _vm->_parser->_inputText: */ + while ((_vm->_parser->_inputText[0] == ' ') && (!_vm->_parser->_inputText.empty())) + _vm->_parser->_inputText.deleteChar(0); + while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) + _vm->_parser->_inputText.deleteLastChar(); + + _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // if you want to use any other timer, put this into the case statement. */ + + switch (interrogation) { + case 1: { + lowercase(); + sayit(); + _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 2; + } + break; + case 2: { + propernouns(); + sayit(); + _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 3; + } + break; + case 3: { + propernouns(); + sayit(); + _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 4; + } + break; + case 4: { + lowercase(); + sayit(); + if (!_vm->_gyro->dna.spare_evening.empty()) + _vm->_gyro->dna.spare_evening.clear(); + _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; + _vm->_visa->dixi('z', 5); /* His closing statement... */ + _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ + _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; + _vm->_gyro->dna.cardiff_things = 5; + } + break; + case 99: + //store_high(_vm->_parser->_inputText); + warning("STUB: Acci::store_interrogation()"); + break; + } - warning("STUB: Acci::store_interrogation()"); + if (interrogation < 4) + _vm->_timeout->cardiff_survey(); } @@ -686,7 +742,7 @@ bool Acci::holding() { if (thing > 100) _vm->_scrolls->display("Be reasonable!"); - else if (!_vm->_gyro->dna.obj[thing]) // Verbs that need "thing" to be in the inventory. + else if (!_vm->_gyro->dna.obj[thing - 1]) // Verbs that need "thing" to be in the inventory. _vm->_scrolls->display("You're not holding it, Avvy."); else holdingResult = true; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index e7508ec5aeab..5c786ce3e8e8 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -293,15 +293,15 @@ void Timeout::stairs() { } void Timeout::cardiff_survey() { - switch (_vm->_gyro->dna.cardiff_things) { - case 0: - _vm->_gyro->dna.cardiff_things += 1; + if (_vm->_gyro->dna.cardiff_things == 0) { + _vm->_gyro->dna.cardiff_things++; _vm->_visa->dixi('q', 27); - break; } + _vm->_visa->dixi('z', _vm->_gyro->dna.cardiff_things); _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; + set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } From f0dbe10cb2c4b14b7a441bdde3ee0a9273309ef8 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 27 Aug 2013 11:10:24 +0200 Subject: [PATCH 0668/1332] AVALANCHE: Repair exampers(), openBox() and do_that() in Acci. Repair loading from the Launcher. --- engines/avalanche/acci2.cpp | 34 ++++++++++++++++++++-------------- engines/avalanche/avalot.cpp | 15 +++++++++------ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index c1a195014883..87f89fa8ec67 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -717,13 +717,17 @@ void Acci::exampers() { person -= 149; switch (person) { /* Special cases */ case 11: - if (_vm->_gyro->dna.wonnim) + if (_vm->_gyro->dna.wonnim) { _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" - return; + return; + } + break; case 99: - if (_vm->_gyro->dna.lustie_is_asleep) + if (_vm->_gyro->dna.lustie_is_asleep) { _vm->_visa->dixi('Q', 65); // He's asleep. (65! Wow!) - return; + return; + } + break; } // Otherwise... _vm->_visa->dixi('p', person); @@ -753,19 +757,21 @@ bool Acci::holding() { void Acci::openBox(bool before) { - _vm->_celer->show_one(5); - - _vm->_celer->pics_link(); - _vm->_trip->trippancy_link(); - _vm->_graphics->refreshScreen(); - - _vm->_system->delayMillis(55); + if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { + _vm->_celer->show_one(5); - if (!before) { - _vm->_celer->show_one(6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); + + _vm->_system->delayMillis(55); + + if (!before) { + _vm->_celer->show_one(6); + _vm->_celer->pics_link(); + _vm->_trip->trippancy_link(); + _vm->_graphics->refreshScreen(); + } } } @@ -1790,7 +1796,7 @@ void Acci::do_that() { } _vm->_celer->show_one(12); - _vm->_scrolls->display("Wine, please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); _vm->_celer->show_one(10); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index de37f504fa9d..4306bb2aed86 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -193,7 +193,10 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); - if (loadSlot >= 0) { + if (loadSlot >= 0) { + _vm->_gyro->thinks = 2; // You always have money. + _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); + _vm->loadGame(loadSlot); } else { _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). @@ -230,13 +233,13 @@ void Avalot::run(Common::String arg) { // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + /* for (byte i = 0; i < _vm->_gyro->lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); for (byte i = 0; i < _vm->_gyro->numfields; i++) { - if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); - } + if (_vm->_gyro->fields[i].x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + }*/ // ONYL FOR TESTING!!! From f7d17fd7b71a13ed585f13471b296d585c4e054c Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 27 Aug 2013 19:41:54 +0200 Subject: [PATCH 0669/1332] AVALANCHE: Partially implement the music room. (Without music.) --- engines/avalanche/scrolls2.cpp | 31 ++++++++++++++++++++++++------- engines/avalanche/timeout2.cpp | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8019a353127d..88c928cbeaa7 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -244,7 +244,28 @@ bool Scrolls::they_match(tunetype &played) { } void Scrolls::music_scroll() { + state(3); + _vm->_gyro->seescroll = true; + _vm->_gyro->on(); + _vm->_gyro->newpointer(4); + + // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. + // For now we act like the player just played the right tone. + //if (they_match(played)) { + _vm->_gyro->screturn = true; + _vm->_gyro->off(); + state(0); + _vm->_gyro->seescroll = false; + + _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up); + return; + //} warning("STUB: Scrolls::music_scroll()"); + + _vm->_gyro->screturn = false; + _vm->_gyro->off(); + state(0); + _vm->_gyro->seescroll = false; } /* ThatsAll, so put us back to */ /*$F-*/ @@ -861,19 +882,15 @@ void Scrolls::okay() { } void Scrolls::musical_scroll() { - bool was_virtual; - - display(Common::String("To play the harp...\r\rUse these keys:\r\n") + - "Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4"); + display(Common::String("To play the harp...") + kControlNewLine + kControlNewLine + "Use these keys:" + + kControlNewLine + + kControlInsertSpaces + "Q W E R T Y U I O P [ ]" + kControlNewLine + kControlNewLine + "Or press Enter to stop playing." + + kControlToBuffer); _vm->_lucerna->sprite_run(); - was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual; - drawscroll(&Avalanche::Scrolls::music_scroll); resetscroll(); } - } // End of namespace Avalanche diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 5c786ce3e8e8..5b0f285811b1 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -405,7 +405,7 @@ void Timeout::jacques_wakes_up() { case 2 : /* Going through the door. */ _vm->_celer->show_one(2); /* Not on the floor. */ _vm->_celer->show_one(3); /* But going through the door. */ - _vm->_gyro->magics[6].op = _vm->_gyro->nix; /* You can't wake him up now. */ + _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* You can't wake him up now. */ break; case 3 : /* Gone through the door. */ _vm->_celer->show_one(2); /* Not on the floor, either. */ From f53d998e53d1c5f12dcc58ff490c18fdb16765c1 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 27 Aug 2013 20:34:44 +0200 Subject: [PATCH 0670/1332] AVALANCHE: Repair Gyro::whereis indexes. --- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 22 +++++++++++----------- engines/avalanche/timeout2.cpp | 6 +++--- engines/avalanche/trip6.cpp | 2 +- engines/avalanche/visa2.cpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index ee37cc7dfcfa..9841fa02e7ad 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -278,7 +278,7 @@ void Enid::edna_reload() { _vm->_lucerna->major_redraw(); - _vm->_gyro->whereis[_vm->_gyro->pavalot] = _vm->_gyro->dna.room; + _vm->_gyro->whereis[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; _vm->_gyro->alive = true; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 7ed521467db7..8512e82e8aa0 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -373,10 +373,10 @@ void Lucerna::enterroom(byte x, byte ped) { if ((_vm->_gyro->dna.rooms[x] == 0) && (! _vm->_gyro->flagset('S'))) points(1); - _vm->_gyro->whereis[_vm->_gyro->pavalot] = _vm->_gyro->dna.room; + _vm->_gyro->whereis[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; if (_vm->_gyro->dna.geida_follows) - _vm->_gyro->whereis[_vm->_gyro->pgeida] = x; + _vm->_gyro->whereis[_vm->_gyro->pgeida - 150] = x; _vm->_gyro->roomtime = 0; @@ -398,7 +398,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { if (! _vm->_gyro->dna.talked_to_crapulus) { - _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__outsideyours; + _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__outsideyours; _vm->_trip->tr[1].init(8, false, _vm->_trip); /* load Crapulus */ if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { @@ -412,7 +412,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; /* He always faces Avvy. */ - } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = r__nowhere; + } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__nowhere; if (_vm->_gyro->dna.crapulus_will_tell) { _vm->_trip->tr[1].init(8, false, _vm->_trip); @@ -450,14 +450,14 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) put_geida_at(4, ped); if (_vm->_gyro->dna.cwytalot_gone) { - _vm->_gyro->magics[lightred].op = _vm->_gyro->nix; - _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__nowhere; + _vm->_gyro->magics[lightred - 11].op = _vm->_gyro->nix; + _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; } else { if (ped > 0) { _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot*/ _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; - _vm->_gyro->whereis[_vm->_gyro->pcwytalot] = r__brummieroad; + _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__brummieroad; if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ _vm->_trip->apped(2, 2); /* He appears on the right of the screen... */ @@ -510,14 +510,14 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.been_tied_up) { - _vm->_gyro->whereis[_vm->_gyro->probinhood] = 0; - _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 0; + _vm->_gyro->whereis[_vm->_gyro->probinhood - 150] = 0; + _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 0; } if (_vm->_gyro->dna.tied_up) _vm->_celer->show_one(2); - if (! _vm->_gyro->dna.mushroom_growing) + if (!_vm->_gyro->dna.mushroom_growing) _vm->_celer->show_one(3); _vm->_graphics->refreshBackground(); } @@ -612,7 +612,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_graphics->refreshBackground(); _vm->_celer->show_one(4); _vm->_gyro->magics[brown].op = _vm->_gyro->nix; - _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; + _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { _vm->_celer->show_one(6); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 5b0f285811b1..e17ef72552fe 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -336,7 +336,7 @@ void Timeout::get_tied_up2() { void Timeout::hang_around() { _vm->_trip->tr[1].check_me = false; _vm->_trip->tr[0].init(7, true, _vm->_trip); /* Robin Hood */ - _vm->_gyro->whereis[_vm->_gyro->probinhood] = r__robins; + _vm->_gyro->whereis[_vm->_gyro->probinhood - 150] = r__robins; _vm->_trip->apped(1, 2); _vm->_visa->dixi('q', 39); _vm->_trip->tr[0].walkto(7); @@ -347,7 +347,7 @@ void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); _vm->_trip->tr[1].vanishifstill = false; _vm->_trip->tr[1].walkto(4); - _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = r__robins; + _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = r__robins; _vm->_visa->dixi('q', 41); _vm->_trip->tr[0].done(); _vm->_trip->tr[1].done(); /* Get rid of Robin Hood and Friar Tuck. */ @@ -410,7 +410,7 @@ void Timeout::jacques_wakes_up() { case 3 : /* Gone through the door. */ _vm->_celer->show_one(2); /* Not on the floor, either. */ _vm->_celer->show_one(4); /* He's gone... so the door's open. */ - _vm->_gyro->whereis[_vm->_gyro->pjacques - 1] = 0; /* Gone! */ + _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; /* Gone! */ break; } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 8762250b5761..b478e9b104de 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -910,7 +910,7 @@ void Trip::call_special(uint16 which) { tr[1].walkto(3); tr[1].vanishifstill = true; tr[1].check_me = true; /* One of them must have Check_Me switched on. */ - _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 177; /* Not here, then. */ + _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 177; /* Not here, then. */ _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 182783ee54c1..b0cabd40e1f2 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -281,7 +281,7 @@ void Visa::talkto(byte whom) { dixi('q', 1); // Circular from Cardiff. _vm->_gyro->dna.talked_to_crapulus = true; - _vm->_gyro->whereis[_vm->_gyro->pcrapulus] = 177; // Crapulus walks off. + _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = 177; // Crapulus walks off. _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].walkto(3); // Walks away. From 6531ca39b955268d6a4274b4889252f5d382c6d6 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 27 Aug 2013 20:46:08 +0200 Subject: [PATCH 0671/1332] AVALANCHE: Various index fixes in Lucerna. --- engines/avalanche/lucerna2.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 8512e82e8aa0..e3de0da0e990 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -450,7 +450,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) put_geida_at(4, ped); if (_vm->_gyro->dna.cwytalot_gone) { - _vm->_gyro->magics[lightred - 11].op = _vm->_gyro->nix; + _vm->_gyro->magics[lightred - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; } else { if (ped > 0) { @@ -473,14 +473,13 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentroad: { - dnatype &with = _vm->_gyro->dna; - if ((with.cwytalot_gone) && (! with.cwytalot_in_herts) && (ped == 2) && + if ((_vm->_gyro->dna.cwytalot_gone) && (! _vm->_gyro->dna.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ _vm->_trip->apped(2, 1); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; - with.cwytalot_in_herts = true; + _vm->_gyro->dna.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } @@ -491,7 +490,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ _vm->_celer->show_one(3); /* Position of drawbridge */ _vm->_graphics->refreshBackground(); - _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ + _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 2, ped); /* load Geida */ @@ -611,7 +610,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->show_one(2); _vm->_graphics->refreshBackground(); _vm->_celer->show_one(4); - _vm->_gyro->magics[brown].op = _vm->_gyro->nix; + _vm->_gyro->magics[brown - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { From 5e1215837ae29899dbb759a55b3de10b3dc0bee8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 13:58:51 -0500 Subject: [PATCH 0672/1332] ZVISION: Fixed signed/unsigned mismatch --- engines/zvision/render_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index ac02cc24d6f1..fa45a6f5767a 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -66,7 +66,7 @@ void RenderManager::update(uint deltaTimeInMillis) { if (_backgroundInverseVelocity != 0) { _accumulatedVelocityMilliseconds += deltaTimeInMillis; - int absVelocity = abs(_backgroundInverseVelocity); + uint absVelocity = uint(abs(_backgroundInverseVelocity)); int numberOfSteps = 0; while (_accumulatedVelocityMilliseconds >= absVelocity) { From 52af1f7f1019ddb2f95d1cff034d58f3cffd224a Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:03:25 -0500 Subject: [PATCH 0673/1332] ZVISION: Bake ActionNode and MouseEvent into Control This makes memory management a lot easier as well as removes the need for multiple lists that point to the same objects. However, there will be quite a few Controls that don't need all the functionality of ActionNode and MouseEvent, so the default implementations are No Op. --- engines/zvision/action_node.h | 11 ------ engines/zvision/control.h | 39 ++++++++++++++++++- engines/zvision/mouse_event.h | 71 ----------------------------------- 3 files changed, 38 insertions(+), 83 deletions(-) delete mode 100644 engines/zvision/mouse_event.h diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index 9a5ca0be0bc6..9df06c750f96 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -29,17 +29,6 @@ namespace ZVision { class ZVision; -class ActionNode { -public: - virtual ~ActionNode() {} - /** - * Processes the node given the deltaTime since last frame - * - * @param deltaTimeInMillis The number of milliseconds that have passed since last frame - * @return If true, the node can be deleted after process() finishes - */ - virtual bool process(uint32 deltaTimeInMillis) = 0; -}; class TimerNode : public ActionNode { public: diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 616589f0551c..8d4ea9f65dc1 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -25,8 +25,10 @@ #include "common/types.h" + namespace Common { class SeekableReadStream; +struct Point; } namespace ZVision { @@ -35,12 +37,47 @@ class ZVision; class Control { public: - Control() : _enabled(false) {} + Control() : _engine(0), _key(0), _enabled(false) {} + Control(ZVision *engine, uint32 key) : _engine(engine), _key(key), _enabled(false) {} virtual ~Control() {} virtual bool enable() = 0; virtual bool disable() = 0; + uint32 getKey() { return _key; } + + /** + * Called when LeftMouse is pushed. Default is NOP. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + virtual void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {} + /** + * Called when LeftMouse is lifted. Default is NOP. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + virtual void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {} + /** + * Called on every MouseMove. Default is NOP. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + * @return Was the cursor changed? + */ + virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { return false; } + /** + * Processes the node given the deltaTime since last frame. Default is NOP. + * + * @param deltaTimeInMillis The number of milliseconds that have passed since last frame + * @return If true, the node can be deleted after process() finishes + */ + virtual bool process(uint32 deltaTimeInMillis) { return false; } + protected: + ZVision * _engine; + uint32 _key; bool _enabled; // Static member functions diff --git a/engines/zvision/mouse_event.h b/engines/zvision/mouse_event.h deleted file mode 100644 index fe81adaf1959..000000000000 --- a/engines/zvision/mouse_event.h +++ /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. - * - * - */ - -#ifndef ZVISION_MOUSE_EVENT_H -#define ZVISION_MOUSE_EVENT_H - -#include "common/types.h" -#include "common/rect.h" -#include "common/str.h" - -namespace ZVision { - -class ZVision; - -class MouseEvent { -public: - MouseEvent() : _key(0) {} - MouseEvent(uint32 key) : _key(key) {} - virtual ~MouseEvent() {} - -public: - uint32 _key; - -public: - /** - * Called when LeftMouse is pushed. - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - */ - virtual void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; - /** - * Called when LeftMouse is lifted. - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - */ - virtual void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; - /** - * Called on every MouseMove. - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - * @return Was the cursor changed? - */ - virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) = 0; -}; - -} // End of namespace ZVision - -#endif From 93bc3570ea33e3f5d21d5b14fe081800f9c7e700 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:04:21 -0500 Subject: [PATCH 0674/1332] ZVISION: Create the default implementation for Control::enable()/disable() --- engines/zvision/control.cpp | 18 ++++++++++++++++++ engines/zvision/control.h | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 1cef2a0ab82d..ad0a4c501335 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -32,6 +32,24 @@ namespace ZVision { +void Control::enable() { + if (!_enabled) { + _enabled = true; + return; + } + + debug("Control %u is already enabled", _key); +} + +void Control::disable() { + if (_enabled) { + _enabled = false; + return; + } + + debug("Control %u is already disabled", _key); +} + void Control::parseFlatControl(ZVision *engine) { engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT); } diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 8d4ea9f65dc1..b16ca7f73d8e 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -40,11 +40,11 @@ class Control { Control() : _engine(0), _key(0), _enabled(false) {} Control(ZVision *engine, uint32 key) : _engine(engine), _key(key), _enabled(false) {} virtual ~Control() {} - virtual bool enable() = 0; - virtual bool disable() = 0; uint32 getKey() { return _key; } + virtual void enable(); + virtual void disable(); /** * Called when LeftMouse is pushed. Default is NOP. * From 3263ab7390fe2197983f28012cfc7199cd3ec500 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:05:01 -0500 Subject: [PATCH 0675/1332] ZVISION: Modify TimerNode to use Control base class --- engines/zvision/action_node.cpp | 2 +- engines/zvision/action_node.h | 8 ++++---- engines/zvision/actions.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp index f51801a75d7a..8e354606f8e4 100644 --- a/engines/zvision/action_node.cpp +++ b/engines/zvision/action_node.cpp @@ -29,7 +29,7 @@ namespace ZVision { TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) - : _engine(engine), _key(key), _timeLeft(timeInSeconds * 1000) { + : Control(engine, key), _timeLeft(timeInSeconds * 1000) { } bool TimerNode::process(uint32 deltaTimeInMillis) { diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index 9df06c750f96..b0b8cae4b148 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -25,14 +25,16 @@ #include "common/types.h" +#include "zvision/control.h" + namespace ZVision { class ZVision; - -class TimerNode : public ActionNode { +class TimerNode : public Control { public: TimerNode(ZVision *engine, uint32 key, uint timeInSeconds); + /** * Decrement the timer by the delta time. If the timer is finished, set the status * in _globalState and let this node be deleted @@ -43,8 +45,6 @@ class TimerNode : public ActionNode { bool process(uint32 deltaTimeInMillis); private: - ZVision *_engine; - uint32 _key; uint32 _timeLeft; }; diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index baa89aa16555..d039f04d959f 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -354,7 +354,7 @@ ActionTimer::ActionTimer(const Common::String &line) { } bool ActionTimer::execute(ZVision *engine) { - engine->getScriptManager()->addActionNode(new TimerNode(engine, _key, _time)); + engine->getScriptManager()->addControl(new TimerNode(engine, _key, _time)); return true; } From 4d344cb5a8eb2f0b66262deb9b1ff6b9112e64d8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:06:46 -0500 Subject: [PATCH 0676/1332] ZVISION: Change LeverControl to comply with the new Control base class --- engines/zvision/lever_control.cpp | 21 ++++----------------- engines/zvision/lever_control.h | 15 +++++---------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 34877cd23f9f..5d9ea4db36b0 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -38,8 +38,7 @@ namespace ZVision { LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : MouseEvent(key), - _engine(engine), + : Control(engine, key), _frameInfo(0), _frameCount(0), _startFrame(0), @@ -69,8 +68,6 @@ LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStre } renderFrame(_currentFrame); - - _engine->getScriptManager()->addActionNode(this); } LeverControl::~LeverControl() { @@ -175,14 +172,14 @@ void LeverControl::parseLevFile(const Common::String &fileName) { } } -void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { +void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _mouseIsCaptured = true; _lastMousePos = backgroundImageSpacePos; } } -void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { +void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { _mouseIsCaptured = false; _engine->getScriptManager()->setStateValue(_key, _currentFrame); @@ -193,7 +190,7 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: // TODO: Animation reversal back to origin } -bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { +bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { bool cursorWasChanged = false; if (_mouseIsCaptured) { @@ -336,14 +333,4 @@ void LeverControl::renderFrame(uint frameNumber) { _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); } -bool LeverControl::enable() { - // TODO: Implement - return true; -} - -bool LeverControl::disable() { - // TODO: Implement - return true; -} - } // End of namespace ZVision diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index dbfd172c4509..42577a177676 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -26,10 +26,9 @@ #include "common/types.h" #include "common/list.h" +#include "common/rect.h" #include "zvision/control.h" -#include "zvision/mouse_event.h" -#include "zvision/action_node.h" namespace ZVision { @@ -37,7 +36,7 @@ namespace ZVision { class ZorkAVIDecoder; class RlfAnimation; -class LeverControl : public Control, public MouseEvent, public ActionNode { +class LeverControl : public Control { public: LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); ~LeverControl(); @@ -66,8 +65,6 @@ class LeverControl : public Control, public MouseEvent, public ActionNode { }; private: - ZVision *_engine; - union { RlfAnimation *rlf; ZorkAVIDecoder *avi; @@ -89,11 +86,9 @@ class LeverControl : public Control, public MouseEvent, public ActionNode { Common::List::iterator _returnRoutesCurrentProgress; public: - bool enable(); - bool disable(); - void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); bool process(uint32 deltaTimeInMillis); private: From 7fb024c7fccb58442440f06af1bbd32b95122d72 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:07:47 -0500 Subject: [PATCH 0677/1332] ZVISION: Change PushToggleControl to comply with new Control base class --- engines/zvision/push_toggle_control.cpp | 46 ++++++++----------------- engines/zvision/push_toggle_control.h | 22 ++++-------- engines/zvision/scr_file_handling.cpp | 2 +- 3 files changed, 23 insertions(+), 47 deletions(-) diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp index 9e68bdb8be9a..be038e767a53 100644 --- a/engines/zvision/push_toggle_control.cpp +++ b/engines/zvision/push_toggle_control.cpp @@ -33,8 +33,7 @@ namespace ZVision { PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : MouseEvent(key), - _engine(engine) { + : Control(engine, key) { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -66,39 +65,24 @@ PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::Seekab } } - bool PushToggleControl::enable() { - if (!_enabled) { - _engine->registerMouseEvent(this); - _enabled = true; - return true; - } - - debug("Control %u is already enabled", _key); - return false; - } - - bool PushToggleControl::disable() { - if (_enabled) { - _engine->removeMouseEvent(_key); - _enabled = false; - return true; - } - - debug("Control %u is already disabled", _key); - return false; - } +PushToggleControl::~PushToggleControl() { + // Clear the state value back to 0 + _engine->getScriptManager()->setStateValue(_key, 0); +} - void PushToggleControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { +void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getScriptManager()->setStateValue(_key, 1); } +} - bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) { - if (_hotspot.contains(backgroundImageSpacePos)) { - _engine->getCursorManager()->changeCursor(_hoverCursor); - return true; - } - - return false; +bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (_hotspot.contains(backgroundImageSpacePos)) { + _engine->getCursorManager()->changeCursor(_hoverCursor); + return true; } + return false; +} + } // End of namespace ZVision diff --git a/engines/zvision/push_toggle_control.h b/engines/zvision/push_toggle_control.h index 9384a43d93e4..8ab6f619bbb8 100644 --- a/engines/zvision/push_toggle_control.h +++ b/engines/zvision/push_toggle_control.h @@ -25,32 +25,25 @@ #include "common/types.h" +#include "common/rect.h" + #include "zvision/control.h" -#include "zvision/mouse_event.h" namespace ZVision { -class PushToggleControl : public Control, public MouseEvent { +class PushToggleControl : public Control { public: PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); - bool enable(); - bool disable(); + ~PushToggleControl(); /** - * Called when LeftMouse is pushed. Calls ScriptManager::setStateValue(_key, 1); - * - * @param screenSpacePos The position of the mouse in screen space - * @param backgroundImageSpacePos The position of the mouse in background image space - */ - void onMouseDown(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); - /** - * Called when LeftMouse is lifted. Does nothing + * Called when LeftMouse is lifted. Calls ScriptManager::setStateValue(_key, 1); * * @param screenSpacePos The position of the mouse in screen space * @param backgroundImageSpacePos The position of the mouse in background image space */ - void onMouseUp(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos) {} + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); /** * Called on every MouseMove. Tests if the mouse is inside _hotspot, and if so, sets the cursor. * @@ -59,10 +52,9 @@ class PushToggleControl : public Control, public MouseEvent { * @param backgroundImageSpacePos The position of the mouse in background image space * @return Was the cursor changed? */ - bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point backgroundImageSpacePos); + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); private: - ZVision * _engine; /** * The area that will trigger the event * This is in image space coordinates, NOT screen space diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index c4aed70ac5fb..212d7140b0d9 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -279,7 +279,7 @@ void ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea Common::String controlType(controlTypeBuffer); if (controlType.equalsIgnoreCase("push_toggle")) { - _activeControls[key] = new PushToggleControl(_engine, key, stream); + _activeControls.push_back(new PushToggleControl(_engine, key, stream)); return; } else if (controlType.equalsIgnoreCase("flat")) { Control::parseFlatControl(_engine); From e32f6f7e38a8fde2283dcefa2042056778cb4579 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:08:09 -0500 Subject: [PATCH 0678/1332] ZVISION: Remove extraneous semicolon --- engines/zvision/rlf_animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 6b6120fb63ad..f58aa0cdfe37 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -65,7 +65,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) _frames[i] = readNextFrame(); } } -}; +} RlfAnimation::~RlfAnimation() { if (_frames != 0) { From a1d11054b52822e3d85e0ad88e6d2ebbbeca8518 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:08:31 -0500 Subject: [PATCH 0679/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index f58aa0cdfe37..77c1a502660e 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -155,7 +155,7 @@ RlfAnimation::Frame RlfAnimation::readNextFrame() { const uint16 *RlfAnimation::getFrameData(uint frameNumber) { assert(!_stream); - assert(frameNumber < _frameCount && frameNumber >= 0); + assert(frameNumber < _frameCount); // Since this method is so expensive, first check to see if we can use // getNextFrame() or getPreviousFrame() since they are cheap. @@ -167,7 +167,7 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { return getPreviousFrame(); } - uint closestFrame = _currentFrame; + int closestFrame = _currentFrame; int distance = ABS(_currentFrame - (int)frameNumber); for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { int newDistance = ABS((int)(*iter) - (int)frameNumber); @@ -177,7 +177,7 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } } - bool forwards = frameNumber > closestFrame; + bool forwards = (int)frameNumber > closestFrame; if (forwards) { for (uint i = closestFrame; i <= frameNumber; i++) { applyFrameToCurrent(i); From b66700212479bb05ce1367a43fe6341cdfca1b00 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:10:37 -0500 Subject: [PATCH 0680/1332] ZVISION: Update ScriptManager::enableControl()/disableControl() to fit new Control syntax --- engines/zvision/script_manager.cpp | 28 ++++++++++++++++------------ engines/zvision/script_manager.h | 6 +++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 50d7e58091fa..dcfcf0204873 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -212,24 +212,28 @@ void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) { _globalState[key] += valueToAdd; } -bool ScriptManager::enableControl(uint32 key) { - if (!_activeControls.contains(key)) { - return false; - } else { - return _activeControls[key]->enable(); +void ScriptManager::addControl(Control *control) { + _activeControls.push_back(control); +} + +void ScriptManager::enableControl(uint32 key) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + if ((*iter)->getKey() == key) { + (*iter)->enable(); + break; + } } } -bool ScriptManager::disableControl(uint32 key) { - if (!_activeControls.contains(key)) { - return false; - } else { - return _activeControls[key]->disable(); +void ScriptManager::disableControl(uint32 key) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + if ((*iter)->getKey() == key) { + (*iter)->disable(); + break; + } } } -void ScriptManager::addActionNode(ActionNode *node) { - _activeNodes.push_back(node); } void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 28bce07dc88a..27e2e612386b 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -85,10 +85,10 @@ class ScriptManager { void setStateValue(uint32 key, uint value); void addToStateValue(uint32 key, uint valueToAdd); - bool enableControl(uint32 key); - bool disableControl(uint32 key); + void addControl(Control *control); - void addActionNode(ActionNode *node); + void enableControl(uint32 key); + void disableControl(uint32 key); void changeLocation(char world, char room, char node, char view, uint32 offset); From a6b2bb75819554a779b238045c21867943ce5f6c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:13:27 -0500 Subject: [PATCH 0681/1332] ZVISION: Remove ScriptManager::_activeNodes and change all iterators to iterate over _activeControls We also change _activeControls to a List instead of a HashMap because a List should have slightly better iteration time. --- engines/zvision/script_manager.cpp | 17 +++++++---------- engines/zvision/script_manager.h | 6 +----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index dcfcf0204873..3cc4c92f0b30 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -108,11 +108,10 @@ void ScriptManager::createReferenceTable() { void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted - for (Common::List::iterator iter = _activeNodes.begin(); iter != _activeNodes.end();) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { if ((*iter)->process(deltaTimeMillis)) { - // Delete the node then remove the pointer - delete (*iter); - iter = _activeNodes.erase(iter); + // Remove the node + iter = _activeControls.erase(iter); } else { iter++; } @@ -257,12 +256,10 @@ void ScriptManager::changeLocationIntern() { delete (*iter); } _activePuzzles.clear(); - for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { - delete (*iter)._value; + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + delete (*iter); } _activeControls.clear(); - _engine->clearAllMouseEvents(); - // TODO: See if we need to clear _activeNodes as well. And if so, remember to delete the nodes before clearing the list // Revert to the idle cursor _engine->getCursorManager()->revertToIdle(); @@ -278,8 +275,8 @@ void ScriptManager::changeLocationIntern() { _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); // Enable all the controls - for (Common::HashMap::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { - (*iter)._value->enable(); + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->enable(); } // Add all the local puzzles to the queue to be checked diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 27e2e612386b..0f3ea43dc3ec 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -37,7 +37,6 @@ class SeekableReadStream; namespace ZVision { class ZVision; -class ActionNode; struct Location { char world; @@ -60,8 +59,6 @@ class ScriptManager { * particular state key are checked after the key is modified. */ Common::HashMap _globalState; - /** Holds the currently active ActionNodes */ - Common::List _activeNodes; /** References _globalState keys to Puzzles */ Common::HashMap > _referenceTable; /** Holds the Puzzles that should be checked this frame */ @@ -71,13 +68,12 @@ class ScriptManager { /** Holds the global puzzles */ Common::List_globalPuzzles; /** Holds the currently active controls */ - Common::HashMap _activeControls; + Common::List _activeControls; Location _nextLocation; bool _changeLocation; public: - void initialize(); void update(uint deltaTimeMillis); From e3b08793dddbf8cf8214328b4b3780995496645c Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:15:10 -0500 Subject: [PATCH 0682/1332] ZVISION: Add ScriptManager mouse event handlers This allows the main engine to pass mouse events to Controls --- engines/zvision/script_manager.cpp | 19 +++++++++++++++++++ engines/zvision/script_manager.h | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 3cc4c92f0b30..98bc2e3a3a09 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -233,6 +233,25 @@ void ScriptManager::disableControl(uint32 key) { } } +void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); + } +} + +void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos); + } +} + +bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + bool cursorWasChanged = false; + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos); + } + + return cursorWasChanged; } void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 0f3ea43dc3ec..9b4763764f9a 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -86,6 +86,29 @@ class ScriptManager { void enableControl(uint32 key); void disableControl(uint32 key); + /** + * Called when LeftMouse is pushed. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + /** + * Called when LeftMouse is lifted. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + */ + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + /** + * Called on every MouseMove. + * + * @param screenSpacePos The position of the mouse in screen space + * @param backgroundImageSpacePos The position of the mouse in background image space + * @return Was the cursor changed? + */ + bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + void changeLocation(char world, char room, char node, char view, uint32 offset); private: From 84c645968c9e93ca343e7c80c6f4546a793c2d41 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:16:04 -0500 Subject: [PATCH 0683/1332] ZVISION: Remove ZVision::_mousEvents and all associated functions Instead, pass all mouse events to ScriptManager --- engines/zvision/events.cpp | 43 +++----------------------------------- engines/zvision/zvision.h | 17 --------------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 94e8f088dd60..9283328202b1 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -32,38 +32,10 @@ #include "zvision/cursor_manager.h" #include "zvision/render_manager.h" #include "zvision/script_manager.h" -#include "zvision/mouse_event.h" #include "zvision/rlf_animation.h" namespace ZVision { -void ZVision::registerMouseEvent(MouseEvent *event) { - _mouseEvents.push_back(event); -} - -bool ZVision::removeMouseEvent(const uint32 key) { - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - if ((*iter)->_key == key) { - _scriptManager->setStateValue((*iter)->_key, 0); - _mouseEvents.erase(iter); - return true; - } - } - - return false; -} - -void ZVision::clearAllMouseEvents() { - // Clear the state values of all the events - // Then delete the nodes - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - _scriptManager->setStateValue((*iter)->_key, 0); - delete (*iter); - } - - _mouseEvents.clear(); -} - void ZVision::processEvents() { while (_eventMan->pollEvent(_event)) { switch (_event.type) { @@ -121,29 +93,20 @@ void ZVision::onMouseDown(const Common::Point &pos) { _cursorManager->cursorDown(true); Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); - - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - (*iter)->onMouseDown(pos, imageCoord); - } + _scriptManager->onMouseDown(pos, imageCoord); } void ZVision::onMouseUp(const Common::Point &pos) { _cursorManager->cursorDown(false); Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); - - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - (*iter)->onMouseUp(pos, imageCoord); - } + _scriptManager->onMouseUp(pos, imageCoord); } void ZVision::onMouseMove(const Common::Point &pos) { Common::Point imageCoord(_renderManager->screenSpaceToImageSpace(pos)); - bool cursorWasChanged = false; - for (Common::List::iterator iter = _mouseEvents.begin(); iter != _mouseEvents.end(); iter++) { - cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(pos, imageCoord); - } + bool cursorWasChanged = _scriptManager->onMouseMove(pos, imageCoord); // Graph of the function governing rotation velocity: // diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 84e4da9d201e..6bf6d2acc093 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -33,7 +33,6 @@ #include "zvision/detection.h" #include "zvision/clock.h" -#include "zvision/mouse_event.h" #include "gui/debugger.h" @@ -100,9 +99,6 @@ class ZVision : public Engine { // Clock Clock _clock; - // To store the current mouse events - Common::List _mouseEvents; - // To prevent allocation every time we process events Common::Event _event; @@ -131,19 +127,6 @@ class ZVision : public Engine { void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - /** - * Register a MouseEvent with the event system. These will be checked at every - * MOUSE_UP, MOUSE_DOWN, MOUSE_MOVE, etc. - * - * @param event The event to register - */ - void registerMouseEvent(MouseEvent *event); - - bool removeMouseEvent(const uint32 key); - - /** Remove all MouseEvents from the event system */ - void clearAllMouseEvents(); - /** * Utility method to cycle through all the cursors in the game. After * calling, use Left and Right arrows to cycle. Esc to quit. This is a From 610eb118246531e38173d67d6790b4737b1a6744 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:17:04 -0500 Subject: [PATCH 0684/1332] ZVISION: Prevent variable shadowing --- engines/zvision/lever_control.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 5d9ea4db36b0..847defd9428a 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -97,13 +97,13 @@ void LeverControl::parseLevFile(const Common::String &fileName) { char fileNameBuffer[25]; sscanf(line.c_str(), "%*[^:]:%25[^~]~", fileNameBuffer); - Common::String fileName(fileNameBuffer); + Common::String animationFileName(fileNameBuffer); - if (fileName.hasSuffix(".avi")) { + if (animationFileName.hasSuffix(".avi")) { _animation.avi = new ZorkAVIDecoder(); - _animation.avi->loadFile(fileName); - } else if (fileName.hasSuffix(".rlf")) { - _animation.rlf = new RlfAnimation(fileNameBuffer, false); + _animation.avi->loadFile(animationFileName); + } else if (animationFileName.hasSuffix(".rlf")) { + _animation.rlf = new RlfAnimation(animationFileName, false); } } else if (line.matchString("*skipcolor*", true)) { // Not used From da3f137b6b4c4c1a06b206d47f8818868cc227ff Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:17:43 -0500 Subject: [PATCH 0685/1332] ZVISION: sscanf to ints before storing them in Rect coords --- engines/zvision/lever_control.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 847defd9428a..6555fe5ce141 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -108,7 +108,13 @@ void LeverControl::parseLevFile(const Common::String &fileName) { } else if (line.matchString("*skipcolor*", true)) { // Not used } else if (line.matchString("*anim_coords*", true)) { - sscanf(line.c_str(), "%*[^:]:%u %u %u %u~", &_animationCoords.left, &_animationCoords.top, &_animationCoords.right, &_animationCoords.bottom); + int left, top, right, bottom; + sscanf(line.c_str(), "%*[^:]:%d %d %d %d~", &left, &top, &right, &bottom); + + _animationCoords.left = left; + _animationCoords.top = top; + _animationCoords.right = right; + _animationCoords.bottom = bottom; } else if (line.matchString("*mirrored*", true)) { uint mirrored; sscanf(line.c_str(), "%*[^:]:%u~", &mirrored); From f60b054b490ca13f79f849b5981e15140a239434 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 26 Aug 2013 14:17:56 -0500 Subject: [PATCH 0686/1332] ZVISION: Fix comment spacing --- engines/zvision/lever_control.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 6555fe5ce141..15b0bf771d36 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -287,12 +287,12 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm // 180 <----------------------------------------> 0 // angle ( /|\ ) -angle // / | \ - // / | \ - // Quadrant 1 / | \ Quadrant 0 + // / | \ + // Quadrant 1 / | \ Quadrant 0 // / | \ - // / | \ - // / | \ - // * | * + // / | \ + // / | \ + // * | * // ^ // 270 From b317ea45fed9cdf444bba3b972ff1e12c12717ad Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:10:22 -0500 Subject: [PATCH 0687/1332] ZVISION: Allow a angle buffer zone on *both* sides of the actual angle --- engines/zvision/lever_control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 15b0bf771d36..08a620f646d0 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -208,7 +208,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common _lastMousePos = backgroundImageSpacePos; for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { - if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle) { + if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle + ANGLE_DELTA) { _currentFrame = (*iter).toFrame; renderFrame(_currentFrame); break; From 3a9b3841149d22d9a8221a8ae32d2b0feca0b14f Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:10:59 -0500 Subject: [PATCH 0688/1332] ZVISION: Round to int *after* converting to degrees --- engines/zvision/lever_control.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 08a620f646d0..71b284c459d6 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -247,10 +247,9 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm int16 xDist = pointTwo.x - pointOne.x; int16 yDist = pointTwo.y - pointOne.y; - int angle = int(atan((float)yDist / (float)xDist)); - - // Convert to degrees. (180 / 3.14159 = 57.2958) - angle *= 57; + // Calculate the angle using arctan + // Then convert to degrees. (180 / 3.14159 = 57.2958) + int angle = int(atan((float)yDist / (float)xDist) * 57); // Calculate what quadrant pointTwo is in uint quadrant = ((yDist > 0 ? 1 : 0) << 1) | (xDist < 0 ? 1 : 0); From ab18d20ead93b5e1f65f474fe73212724394c1fc Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:12:14 -0500 Subject: [PATCH 0689/1332] ZVISION: Fix the quadrant numbers in angle calculations Because y increases as you go down, not up --- engines/zvision/lever_control.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 71b284c459d6..3c5b6370bbaa 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -233,7 +233,7 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm if (pointOne.x == pointTwo.x && pointOne.y == pointTwo.y) return -1; // This should never happen else if (pointOne.x == pointTwo.x) { - if (pointTwo.y > pointOne.y) + if (pointTwo.y < pointOne.y) return 90; else return 270; @@ -279,15 +279,15 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm // \ | / // \ | / // \ | / - // Quadrant 3 \ | / Quadrant 2 + // Quadrant 1 \ | / Quadrant 0 // \ | / // \ | / - // -angle ( \|/ ) angle + // angle ( \|/ ) -angle // 180 <----------------------------------------> 0 - // angle ( /|\ ) -angle + // -angle ( /|\ ) angle // / | \ // / | \ - // Quadrant 1 / | \ Quadrant 0 + // Quadrant 3 / | \ Quadrant 2 // / | \ // / | \ // / | \ @@ -298,16 +298,16 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm // Convert the local angles to unit circle angles switch (quadrant) { case 0: - angle = 360 + angle; + angle = 180 + angle; break; case 1: - angle = 180 + angle; + // Do nothing break; case 2: angle = 180 + angle; break; case 3: - // Do nothing + angle = 360 + angle; break; } From 3e6144970e2674380a8adab3b17e5bd1ce24ffea Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:13:05 -0500 Subject: [PATCH 0690/1332] ZVISION: Implement avi frame seeking --- engines/zvision/lever_control.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 3c5b6370bbaa..759296841359 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -27,6 +27,8 @@ #include "common/tokenizer.h" #include "common/system.h" +#include "graphics/surface.h" + #include "zvision/lever_control.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" @@ -318,21 +320,24 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm void LeverControl::renderFrame(uint frameNumber) { const uint16 *frameData; int pitch; - int x; - int y; + int x = _animationCoords.left; + int y = _animationCoords.top; int width; int height; if (_fileType == RLF) { // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can - frameData = _animation.rlf->getFrameData(_currentFrame); + frameData = _animation.rlf->getFrameData(frameNumber); pitch = _animation.rlf->width() * sizeof(uint16); - x = _animationCoords.left; - y = _animationCoords.right; width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() } else if (_fileType == AVI) { - // Cry because AVI seeking isn't implemented (yet) + _animation.avi->seekToFrame(frameNumber); + const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); + frameData = (const uint16 *)surface->getBasePtr(0, 0); + pitch = surface->pitch; + width = surface->w; + height = surface->h; } _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); From 945982c8577b9c8a34333898841b5ffcfaa7138b Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:14:32 -0500 Subject: [PATCH 0691/1332] ZVISION: Add support for animation 'mirroring' If an animation is 'mirrored', it doesn't have B-frames, only I-frames. However the animations are built so the last half of the animation is the reverse of the first half --- engines/zvision/lever_control.cpp | 6 ++++++ engines/zvision/lever_control.h | 1 + 2 files changed, 7 insertions(+) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 759296841359..4ed3f108782d 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -45,6 +45,7 @@ LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStre _frameCount(0), _startFrame(0), _currentFrame(0), + _lastRenderedFrame(0), _mouseIsCaptured(false), _isReturning(false) { @@ -318,6 +319,10 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm } void LeverControl::renderFrame(uint frameNumber) { + if (frameNumber < _lastRenderedFrame && _mirrored) { + frameNumber = (_frameCount * 2) - 1 - frameNumber; + } + const uint16 *frameData; int pitch; int x = _animationCoords.left; @@ -341,6 +346,7 @@ void LeverControl::renderFrame(uint frameNumber) { } _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); + _lastRenderedFrame = frameNumber; } } // End of namespace ZVision diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index 42577a177676..cf41aac6b3c5 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -80,6 +80,7 @@ class LeverControl : public Control { FrameInfo *_frameInfo; uint _currentFrame; + uint _lastRenderedFrame; bool _mouseIsCaptured; bool _isReturning; Common::Point _lastMousePos; From a1a70170d4a28a426fe916225a2aa9adbdcf5f95 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:15:51 -0500 Subject: [PATCH 0692/1332] ZVISION: Remove RlfAnimation::getPreviousFrame() I realized that RlfAnimations don't use B-frames, therefore, can not easily go backwards. --- engines/zvision/rlf_animation.cpp | 30 ++++++------------------------ engines/zvision/rlf_animation.h | 2 -- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 77c1a502660e..90b39dc75736 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -158,34 +158,25 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { assert(frameNumber < _frameCount); // Since this method is so expensive, first check to see if we can use - // getNextFrame() or getPreviousFrame() since they are cheap. + // getNextFrame() it's cheap. if ((int)frameNumber == _currentFrame) { return _currentFrameBuffer; } else if (_currentFrame + 1 == (int)frameNumber) { return getNextFrame(); - } else if (_currentFrame - 1 == (int)frameNumber) { - return getPreviousFrame(); } int closestFrame = _currentFrame; - int distance = ABS(_currentFrame - (int)frameNumber); + int distance = (int)frameNumber - _currentFrame; for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { - int newDistance = ABS((int)(*iter) - (int)frameNumber); - if (closestFrame == -1 || newDistance < distance) { + int newDistance = (int)frameNumber - (int)(*iter); + if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) { closestFrame = (*iter); distance = newDistance; } } - bool forwards = (int)frameNumber > closestFrame; - if (forwards) { - for (uint i = closestFrame; i <= frameNumber; i++) { - applyFrameToCurrent(i); - } - } else { - for (uint i = closestFrame; i >= frameNumber; i--) { - applyFrameToCurrent(i); - } + for (uint i = closestFrame; i <= frameNumber; i++) { + applyFrameToCurrent(i); } _currentFrame = frameNumber; @@ -205,15 +196,6 @@ const uint16 *RlfAnimation::getNextFrame() { return _currentFrameBuffer; } -const uint16 *RlfAnimation::getPreviousFrame() { - assert(!_stream); - assert(_currentFrame - 1 >= 0); - - applyFrameToCurrent(_currentFrame - 1); - _currentFrame--; - return _currentFrameBuffer; -} - void RlfAnimation::applyFrameToCurrent(uint frameNumber) { if (_frames[frameNumber].type == Masked) { decodeMaskedRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index d49e6a939591..5091185a362e 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -74,9 +74,7 @@ class RlfAnimation { uint32 frameTime() { return _frameTime; } const uint16 *getFrameData(uint frameNumber); - const uint16 *getNextFrame(); - const uint16 *getPreviousFrame(); bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } From 7d255c3d8014987b76d8ef974af1c9c7f536d396 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:16:16 -0500 Subject: [PATCH 0693/1332] ZVISION: Fix: Signal a cursor change --- engines/zvision/lever_control.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 4ed3f108782d..97e1f66fb56f 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -220,6 +220,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common } } else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(_cursorName); + cursorWasChanged = true; } return cursorWasChanged; From ce9e9a55c6969ca1127f00f5d5a22e0c0c0bc046 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:16:38 -0500 Subject: [PATCH 0694/1332] ZVISION: Fix: Store what type of animation file is used --- engines/zvision/lever_control.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 97e1f66fb56f..d515f9e78419 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -105,8 +105,10 @@ void LeverControl::parseLevFile(const Common::String &fileName) { if (animationFileName.hasSuffix(".avi")) { _animation.avi = new ZorkAVIDecoder(); _animation.avi->loadFile(animationFileName); + _fileType = AVI; } else if (animationFileName.hasSuffix(".rlf")) { _animation.rlf = new RlfAnimation(animationFileName, false); + _fileType = RLF; } } else if (line.matchString("*skipcolor*", true)) { // Not used From 952fb83793fb99a3e8d7db849a4b66f830e4e3ad Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:17:23 -0500 Subject: [PATCH 0695/1332] ZVISION: Fix: Change infndef to correct constant --- engines/zvision/lever_control.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index cf41aac6b3c5..d359318d2fc1 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -20,8 +20,8 @@ * */ -#ifndef ZVISION_PUSH_TOGGLE_CONTROL_H -#define ZVISION_PUSH_TOGGLE_CONTROL_H +#ifndef ZVISION_LEVER_CONTROL_H +#define ZVISION_LEVER_CONTROL_H #include "common/types.h" From f1f36e7c9db0b78a5ae04ebdadebe431e2840bfc Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:18:18 -0500 Subject: [PATCH 0696/1332] ZVISION: Add LeverControl to scr file parsing --- engines/zvision/scr_file_handling.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 212d7140b0d9..06767c534000 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -27,6 +27,7 @@ #include "zvision/puzzle.h" #include "zvision/actions.h" #include "zvision/push_toggle_control.h" +#include "zvision/lever_control.h" #include "common/textconsole.h" #include "common/file.h" @@ -287,10 +288,12 @@ void ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea } else if (controlType.equalsIgnoreCase("pana")) { Control::parsePanoramaControl(_engine, stream); return; - } - else if (controlType.equalsIgnoreCase("tilt")) { + } else if (controlType.equalsIgnoreCase("tilt")) { Control::parseTiltControl(_engine, stream); return; + } else if (controlType.equalsIgnoreCase("lever")) { + _activeControls.push_back(new LeverControl(_engine, key, stream)); + return; } } From f3514534ce46bad5e3ffadfdf0b3af403045e5ef Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:19:39 -0500 Subject: [PATCH 0697/1332] ZVISION: Increase background rotation speed This could probably still go higher. The DOS version is *very* sensitive, too sensitive. But this is still a bit slow. --- engines/zvision/zvision.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 6bf6d2acc093..a02fecc43db1 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -80,7 +80,7 @@ class ZVision : public Engine { WORKING_WINDOW_HEIGHT = 320, ROTATION_SCREEN_EDGE_OFFSET = 60, - MAX_ROTATION_SPEED = 250 // Pixels per second + MAX_ROTATION_SPEED = 400 // Pixels per second }; Console *_console; From 499d176ab121803bc6956fcff664f46a72b77e16 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 29 Aug 2013 12:07:04 +0200 Subject: [PATCH 0698/1332] AVALANCHE: Repair Acci::do_that() and roomnums.h. Some cosmetic repairs here and there. --- engines/avalanche/acci2.cpp | 9 ++++----- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 3 ++- engines/avalanche/roomnums.h | 4 ++-- engines/avalanche/sequence2.cpp | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 87f89fa8ec67..f4b9686b3685 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1885,12 +1885,11 @@ void Acci::do_that() { else { ok = true; for (ff = 0; ff < thats.size(); ff++) { - for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password - 1].w.size(); fv++) { - Common::String temp = realwords[ff]; - temp.toUppercase(); - if (words[_vm->_gyro->dna.pass_num + first_password - 1].w[fv] != temp[fv]) + Common::String temp = realwords[ff]; + temp.toUppercase(); + for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) + if (words[_vm->_gyro->dna.pass_num + first_password].w[fv] != temp[fv]) ok = false; - } } if (ok) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index ec78028fcf06..c3711c57adc1 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -82,7 +82,7 @@ struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ bool cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ - byte pass_num; /* Number of the passuint16 for this game. */ + byte pass_num; /* Number of the passw for this game. */ bool ayles_is_awake; /* pretty obvious! */ byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ byte avaricius_talk; /* How much Avaricius has said to you. */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e3de0da0e990..76b8bcdc5402 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -443,7 +443,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; - } else _vm->_gyro->whereis[1] = r__nowhere; + } else + _vm->_gyro->whereis[1] = r__nowhere; break; case r__brummieroad: { diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index fb99f5c780a5..3032f71db6b2 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -48,7 +48,7 @@ const byte r__avvysgarden = 15; const byte r__aylesoffice = 16; const byte r__argentpub = 19; const byte r__brummieroad = 20; -const byte r__lusties = 21; /*{ ? not sure }*/ +const byte r__bridge = 21; /*{ ? not sure }*/ const byte r__entrancehall = 22; const byte r__lustiesroom = 23; const byte r__westhall = 25; @@ -59,7 +59,7 @@ const byte r__catacombs = 29; //{ -------------- } -const byte r__bridge = 40; +const byte r__lusties = 40; const byte r__robins = 42; const byte r__outsidenottspub = 46; const byte r__nottspub = 47; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 6439df26fe9f..f41ac128c639 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -90,11 +90,11 @@ void Sequence::shove_left() { void Sequence::call_sequencer() { switch (seq[0]) { case 0: - return; - break; /* No more routines. */ - case 177: + return; // No more routines. + break; + case 177: // Flip room. _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip->fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); /* 177 = Flip room. */ + _vm->_trip->fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); if (seq[0] == 177) shove_left(); break; From f95834ca05ae0f3a60e475fdef2fe42f6d2f18d5 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 29 Aug 2013 14:33:05 +0200 Subject: [PATCH 0699/1332] AVALANCHE: Repair "entrance hall" room and everything connected to it. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/gyro2.h | 2 +- engines/avalanche/roomnums.h | 4 ++-- engines/avalanche/trip6.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index f4b9686b3685..586f2280ab8a 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -964,7 +964,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ _vm->_trip->call_special(_vm->_gyro->portals[fv].data); break; case _vm->_gyro->mopendoor: - _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv); + _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv + 9); break; } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index c3711c57adc1..a7ad6b60473e 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -72,7 +72,7 @@ struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ int16 score; /* your score, of course */ int32 pence; /* your current amount of dosh */ byte room; /* your current room */ - char wearing; /* what you're wearing */ + byte wearing; /* what you're wearing */ byte swore; /* number of times you've sworn */ byte saves; /* number of times this game has been saved */ byte rooms[100]; /* Add one to each every time you enter a room */ diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index 3032f71db6b2..f38c25d0cf2b 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -49,7 +49,7 @@ const byte r__aylesoffice = 16; const byte r__argentpub = 19; const byte r__brummieroad = 20; const byte r__bridge = 21; /*{ ? not sure }*/ -const byte r__entrancehall = 22; +const byte r__entrancehall = 40; const byte r__lustiesroom = 23; const byte r__westhall = 25; const byte r__easthall = 26; @@ -59,7 +59,7 @@ const byte r__catacombs = 29; //{ -------------- } -const byte r__lusties = 40; +const byte r__lusties = 22; const byte r__robins = 42; const byte r__outsidenottspub = 46; const byte r__nottspub = 47; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index b478e9b104de..e5a110f6eb7e 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1055,7 +1055,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { return; } else { apped(1, 6); - tr[1].face = right; /* added by TT 12/3/1995 */ + tr[0].face = right; /* added by TT 12/3/1995 */ _vm->_sequence->first_show(8); _vm->_sequence->then_show(9); } @@ -1523,7 +1523,7 @@ void Trip::fliproom(byte room, byte ped) { return; } - if ((ped == 177) && (_vm->_gyro->dna.room == r__lusties)) { + if ((room == 177) && (_vm->_gyro->dna.room == r__lusties)) { hide_in_the_cupboard(); return; } From 3aa059848a0bc64f7395115db75bb39d0e1b6794 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 29 Aug 2013 23:38:47 +0200 Subject: [PATCH 0700/1332] AVALANCHE: Repair the catacombs. --- engines/avalanche/lucerna2.cpp | 26 ++++++++++++++++++++++++-- engines/avalanche/roomnums.h | 4 ++-- engines/avalanche/trip6.cpp | 30 ++++++++++++------------------ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 76b8bcdc5402..4190c7523d83 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -571,7 +571,30 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__catacombs: { - warning("STUB: Lucerna::enterroom() - case: r__catacombs"); + if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { + + switch (ped) { + case 3: { // Enter from oubliette + _vm->_gyro->dna.cat_x = 8; + _vm->_gyro->dna.cat_y = 4; + } + break; + case 5: { // Enter from du Lustie's + _vm->_gyro->dna.cat_x = 8; + _vm->_gyro->dna.cat_y = 7; + } + break; + case 6: { // Enter from Geida's + _vm->_gyro->dna.cat_x = 4; + _vm->_gyro->dna.cat_y = 1; + } + break; + } + + _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; + _vm->_trip->catamove(ped); + _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; + } } break; @@ -761,7 +784,6 @@ void Lucerna::enterroom(byte x, byte ped) { case r__ducks: _vm->_gyro->dna.dogfoodpos = 1; break; /* Actually, Duck pos. */ - } _vm->_gyro->seescroll = false; /* Now it can work again! */ diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index f38c25d0cf2b..a21da00a95f1 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -49,7 +49,7 @@ const byte r__aylesoffice = 16; const byte r__argentpub = 19; const byte r__brummieroad = 20; const byte r__bridge = 21; /*{ ? not sure }*/ -const byte r__entrancehall = 40; +const byte r__lusties = 22; const byte r__lustiesroom = 23; const byte r__westhall = 25; const byte r__easthall = 26; @@ -59,7 +59,7 @@ const byte r__catacombs = 29; //{ -------------- } -const byte r__lusties = 22; +const byte r__entrancehall = 40; const byte r__robins = 42; const byte r__outsidenottspub = 46; const byte r__nottspub = 47; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index e5a110f6eb7e..db7dbeaa45cc 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -517,24 +517,18 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { } byte Trip::geida_ped(byte which) { - byte geida_ped_result; switch (which) { case 1: - geida_ped_result = 7; - break; + return 7; case 2: case 6: - geida_ped_result = 8; - break; + return 8; case 3: case 5: - geida_ped_result = 9; - break; + return 9; case 4: - geida_ped_result = 10; - break; + return 10; } - return geida_ped_result; } void Trip::catamove(byte ped) { @@ -561,7 +555,7 @@ void Trip::catamove(byte ped) { return; case 1033: /* Oubliette */ fliproom(r__oubliette, 1); - _vm->_scrolls->display("Oh, NO!\231\2"); + _vm->_scrolls->display(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); return; case 4: fliproom(r__geidas, 1); @@ -577,7 +571,7 @@ void Trip::catamove(byte ped) { if (!_vm->_gyro->dna.enter_catacombs_from_lusties_room) _vm->_lucerna->load(29); - here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x]; + here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1]; switch (here & 0xf) { /* West. */ case 0: /* no connection (wall) */ @@ -691,7 +685,7 @@ void Trip::catamove(byte ped) { _vm->_celer->show_one(18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Sloping wall. */ + _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->special; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ break; @@ -708,7 +702,7 @@ void Trip::catamove(byte ped) { case 0x1: _vm->_celer->show_one(22); - if ((xy_uint16 == 2051) & (_vm->_gyro->dna.geida_follows)) + if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; else _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Right exit south. */ @@ -838,7 +832,7 @@ void Trip::catamove(byte ped) { break; /* [1,1] : the other two. */ } - if ((_vm->_gyro->dna.geida_follows) & (ped > 0)) { + if ((_vm->_gyro->dna.geida_follows) && (ped > 0)) { if (!tr[1].quick) /* If we don't already have her... */ tr[1].init(5, true, this); /* ...Load Geida. */ apped(2, geida_ped(ped)); @@ -960,12 +954,12 @@ void Trip::call_special(uint16 which) { } } _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_y -= 1; + _vm->_gyro->dna.cat_y --; catamove(4); if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna->delavvy(); - switch ((_vm->_gyro->catamap[_vm->_gyro->dna.cat_y][_vm->_gyro->dna.cat_x] & 0xf00) >> 8) { + switch ((_vm->_gyro->catamap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1] & 0xf00) >> 8) { case 0x1: apped(1, 12); break; @@ -980,7 +974,7 @@ void Trip::call_special(uint16 which) { break; case 11: /* _vm->_gyro->special 11: transfer east in catacombs. */ _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_x += 1; + _vm->_gyro->dna.cat_x++; catamove(1); if (_vm->_gyro->dna.room != r__catacombs) return; From bdde166c4991c5d7de552b7c3bfd59823fc600e8 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 30 Aug 2013 09:37:00 +0200 Subject: [PATCH 0701/1332] AVALANCHE: Repair the Oubliette in the catacombs and wrong parameters connected to Geida's follow-function. Repair the so-called "also" lines. --- engines/avalanche/lucerna2.cpp | 16 +++++++++------- engines/avalanche/timeout2.cpp | 10 ++++++---- engines/avalanche/trip6.cpp | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 4190c7523d83..95011bdde73c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -91,7 +91,9 @@ void Lucerna::draw_also_lines() { _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); for (ff = 0; ff < _vm->_gyro->lineNum; ff++) - _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + if ((_vm->_gyro->lines[ff].x1 >= 0) && (_vm->_gyro->lines[ff].x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y1 >= 0) && (_vm->_gyro->lines[ff].y1 < _vm->_graphics->kScreenHeight) + && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); CursorMan.showMouse(true); } @@ -449,7 +451,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__brummieroad: { if (_vm->_gyro->dna.geida_follows) - put_geida_at(4, ped); + put_geida_at(5, ped); if (_vm->_gyro->dna.cwytalot_gone) { _vm->_gyro->magics[lightred - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; @@ -494,7 +496,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } if (_vm->_gyro->dna.geida_follows) - put_geida_at(ped + 2, ped); /* load Geida */ + put_geida_at(ped + 3, ped); /* load Geida */ } break; @@ -619,7 +621,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->dna.geida_follows) { - put_geida_at(4, ped); + put_geida_at(5, ped); if (_vm->_gyro->dna.lustie_is_asleep) { _vm->_celer->show_one(5); _vm->_graphics->refreshBackground(); @@ -748,18 +750,18 @@ void Lucerna::enterroom(byte x, byte ped) { break; /* Ayles awake. */ case r__geidas: - put_geida_at(1, ped); + put_geida_at(2, ped); break; /* load Geida */ case r__easthall: case r__westhall: if (_vm->_gyro->dna.geida_follows) - put_geida_at(ped + 1, ped); + put_geida_at(ped + 2, ped); break; case r__lusties: if (_vm->_gyro->dna.geida_follows) - put_geida_at(ped + 5, ped); + put_geida_at(ped + 6, ped); break; case r__nottspub: { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index e17ef72552fe..f147ad7550f4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -551,14 +551,15 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro->magics[8].op = _vm->_gyro->nix; - _vm->_trip->tr[0].iy += 1; /* increments dx/dy! */ - _vm->_trip->tr[0].y += _vm->_trip->tr[1].iy; /* Dowwwn we go... */ + _vm->_trip->tr[0].iy++; /* increments dx/dy! */ + _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; /* Dowwwn we go... */ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } void Timeout::meet_avaroid() { if (_vm->_gyro->dna.met_avaroid) { - _vm->_scrolls->display("You can't expect to be \6that\22 lucky twice in a row!"); + _vm->_scrolls->display(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); _vm->_lucerna->gameover(); } else { _vm->_visa->dixi('Q', 60); @@ -626,7 +627,8 @@ void Timeout::avvy_sit_down() { } void Timeout::ghost_room_phew() { - _vm->_scrolls->display("\6PHEW!\22 You're glad to get out of \6there!"); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman + + " You're glad to get out of " + _vm->_scrolls->kControlItalic + "there!"); } void Timeout::arkata_shouts() { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index db7dbeaa45cc..2b3018b7b804 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -917,7 +917,7 @@ void Trip::call_special(uint16 which) { break; case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ tr[0].visible = false; - _vm->_gyro->magics[10].op = _vm->_gyro->nix; + _vm->_gyro->magics[9].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); /*_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); From 06d0ce1b0f4ed08260bdfc408fe31e9d9ebdefa7 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 30 Aug 2013 11:23:17 +0200 Subject: [PATCH 0702/1332] AVALANCHE: Minor cosmetic fixes. --- engines/avalanche/avalot.cpp | 10 +++++----- engines/avalanche/lucerna2.cpp | 1 + engines/avalanche/visa2.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4306bb2aed86..6c80ee9c75ec 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -233,13 +233,13 @@ void Avalot::run(Common::String arg) { // ONLY FOR TESTING!!! - /* for (byte i = 0; i < _vm->_gyro->lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + for (byte i = 0; i < _vm->_gyro->lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); for (byte i = 0; i < _vm->_gyro->numfields; i++) { - if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); - }*/ + if (_vm->_gyro->fields[i].x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + } // ONYL FOR TESTING!!! diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 95011bdde73c..c54d56763bed 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -91,6 +91,7 @@ void Lucerna::draw_also_lines() { _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); for (ff = 0; ff < _vm->_gyro->lineNum; ff++) + // We had to check if the lines are within the borders of the screen. if ((_vm->_gyro->lines[ff].x1 >= 0) && (_vm->_gyro->lines[ff].x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y1 >= 0) && (_vm->_gyro->lines[ff].y1 < _vm->_graphics->kScreenHeight) && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index b0cabd40e1f2..0a0c031effee 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -237,7 +237,7 @@ void Visa::talkto(byte whom) { } break; case _vm->_gyro->pspurge: - if (~ _vm->_gyro->dna.sitting_in_pub) { + if (!_vm->_gyro->dna.sitting_in_pub) { dixi('q', 71); // Try going over and sitting down. return; } else { From 73048872b2c2e9381fa0d11c207a11125d04ce2a Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 30 Aug 2013 11:56:16 +0200 Subject: [PATCH 0703/1332] AVALANCHE: Upgrade show_one() so it can replace show_one_at(), preventing code duplication. --- engines/avalanche/acci2.cpp | 34 ++++----- engines/avalanche/celer2.cpp | 78 ++++++++++----------- engines/avalanche/celer2.h | 9 ++- engines/avalanche/lucerna2.cpp | 48 ++++++------- engines/avalanche/sequence2.cpp | 2 +- engines/avalanche/timeout2.cpp | 26 +++---- engines/avalanche/trip6.cpp | 120 ++++++++++++++++---------------- 7 files changed, 157 insertions(+), 160 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 586f2280ab8a..0b982dbc3d3a 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -758,7 +758,7 @@ bool Acci::holding() { void Acci::openBox(bool before) { if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(-1, -1, 5); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); @@ -767,7 +767,7 @@ void Acci::openBox(bool before) { _vm->_system->delayMillis(55); if (!before) { - _vm->_celer->show_one(6); + _vm->_celer->show_one(-1, -1, 6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); @@ -1039,7 +1039,7 @@ void Acci::putproc() { /* Called when you call vb_put. */ if (_vm->_gyro->dna.wearing == thing) _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); else { - //_vm->_celer->show_one(5); // Open box. + //_vm->_celer->show_one(-1, -1, 5); // Open box. openBox(true); _vm->_gyro->dna.box_contents = thing; @@ -1047,7 +1047,7 @@ void Acci::putproc() { /* Called when you call vb_put. */ _vm->_lucerna->objectlist(); _vm->_scrolls->display("OK, it's in the box."); - //_vm->_celer->show_one(6); // Shut box. + //_vm->_celer->show_one(-1, -1, 6); // Shut box. openBox(false); } } @@ -1169,7 +1169,7 @@ void Acci::stand_up() { _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(4); /* Picture of empty pillow. */ + _vm->_celer->show_one(-1, -1, 4); /* Picture of empty pillow. */ _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); @@ -1183,7 +1183,7 @@ void Acci::stand_up() { case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { - _vm->_celer->show_one(4); /* Not sitting down. */ + _vm->_celer->show_one(-1, -1, 4); /* Not sitting down. */ _vm->_trip->tr[0].visible = true; /* But standing up. */ _vm->_trip->apped(1, 4); /* And walking away. */ _vm->_gyro->dna.sitting_in_pub = false; /* Really not sitting down. */ @@ -1202,12 +1202,12 @@ void Acci::getproc(char thing) { case r__yours: if (_vm->_trip->infield(2)) { if (_vm->_gyro->dna.box_contents == thing) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->dna.obj[thing - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.box_contents = nowt; - _vm->_celer->show_one(6); + _vm->_celer->show_one(-1, -1, 6); } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else @@ -1223,7 +1223,7 @@ void Acci::getproc(char thing) { _vm->_scrolls->display("It's not there, Avvy."); else { /* OK: we're taking the pen, and it's there. */ - _vm->_celer->show_one(4); /* No pen there now. */ + _vm->_celer->show_one(-1, -1, 4); /* No pen there now. */ _vm->_trip->call_special(3); /* Zap! */ _vm->_gyro->dna.taken_pen = true; _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; @@ -1244,7 +1244,7 @@ void Acci::getproc(char thing) { break; case r__robins: if ((thing == _vm->_gyro->mushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_scrolls->display("Got it!"); _vm->_gyro->dna.mushroom_growing = false; _vm->_gyro->dna.taken_mushroom = true; @@ -1464,8 +1464,8 @@ void Acci::do_that() { _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; _vm->_gyro->dna.givenbadgetoiby = true; - _vm->_celer->show_one(8); - _vm->_celer->show_one(9); + _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->show_one(-1, -1, 9); } else heythanks(); break; @@ -1770,11 +1770,11 @@ void Acci::do_that() { if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(12); + _vm->_celer->show_one(-1, -1, 12); _vm->_scrolls->display(booze[thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->dna.drinking = thing; - _vm->_celer->show_one(10); + _vm->_celer->show_one(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; @@ -1795,11 +1795,11 @@ void Acci::do_that() { return; } - _vm->_celer->show_one(12); + _vm->_celer->show_one(-1, -1, 12); _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(10); + _vm->_celer->show_one(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); @@ -1967,7 +1967,7 @@ void Acci::do_that() { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->show_one(3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->show_one(-1, -1, 3); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 7f1966223df8..25093a9348e9 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -62,22 +62,22 @@ void Celer::pics_link() { switch (_vm->_gyro->dna.room) { case r__outsideargentpub: if ((_vm->_gyro->roomtime % 12) == 0) - show_one(1 + (_vm->_gyro->roomtime / 12) % 4); + show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); break; case r__brummieroad: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(1 + (_vm->_gyro->roomtime / 2) % 4); + show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); break; case r__bridge: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(4 + (_vm->_gyro->roomtime / 2) % 4); + show_one(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); break; case r__yours: if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) - show_one(1 + (_vm->_gyro->roomtime / 12) % 2); + show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); break; case r__argentpub: @@ -88,16 +88,16 @@ void Celer::pics_link() { case 1: case 11: case 21: - show_one(12); + show_one(-1, -1, 12); break; /* Looks forwards. */ case 8: case 18: case 28: case 32: - show_one(11); + show_one(-1, -1, 11); break; /* Looks at you. */ case 30: - show_one(13); + show_one(-1, -1, 13); break; /* Winks. */ case 33: _vm->_gyro->dna.malagauche = 0; @@ -108,14 +108,14 @@ void Celer::pics_link() { switch (_vm->_gyro->roomtime % 200) { case 179: case 197: - show_one(5); + show_one(-1, -1, 5); break; /* Dogfood's drinking cycle */ case 182: case 194: - show_one(6); + show_one(-1, -1, 6); break; case 185: - show_one(7); + show_one(-1, -1, 7); break; case 199: _vm->_gyro->dna.dogfoodpos = 177; @@ -131,7 +131,7 @@ void Celer::pics_link() { xx = 4; if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); + show_one(-1, -1, xx); _vm->_gyro->dna.dogfoodpos = xx; } } @@ -141,16 +141,16 @@ void Celer::pics_link() { if ((_vm->_gyro->roomtime % 3) == 0) { switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: - show_one(1); + show_one(-1, -1, 1); break; case 1: case 3: case 5: - show_one(2); + show_one(-1, -1, 2); break; case 0: case 2: - show_one(3); + show_one(-1, -1, 3); break; } } @@ -170,7 +170,7 @@ void Celer::pics_link() { xx = 3; /* Right. */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); + show_one(-1, -1, xx); _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } } @@ -180,10 +180,10 @@ void Celer::pics_link() { if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { switch ((_vm->_gyro->roomtime / 14) % 2) { case 0: - show_one(1); + show_one(-1, -1, 1); break; /* Frame 2: EGA. */ case 1: - show_one(3); + show_one(-1, -1, 3); break; /* Frame 1: Natural. */ } } @@ -193,10 +193,10 @@ void Celer::pics_link() { if (_vm->_gyro->dna.tied_up) { switch (_vm->_gyro->roomtime % 54) { case 20: - show_one(4); + show_one(-1, -1, 4); break; /* Frame 4: Avalot blinks. */ case 23: - show_one(2); + show_one(-1, -1, 2); break; /* Frame 1: Back to normal. */ } } @@ -215,23 +215,23 @@ void Celer::pics_link() { xx--; /* Blinks */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); + show_one(-1, -1, xx); _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } switch (_vm->_gyro->roomtime % 50) { case 45 : - show_one(9); + show_one(-1, -1, 9); break; /* Spurge blinks */ case 49 : - show_one(10); + show_one(-1, -1, 10); break; } break; case r__ducks: if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */ - show_one(1 + (_vm->_gyro->roomtime / 3) % 3); + show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); {/* _vm->_lucerna->bearing of Avvy from Duck. */ if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) @@ -245,7 +245,7 @@ void Celer::pics_link() { xx += 1; /* Duck blinks */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); + show_one(-1, -1, xx); _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } break; @@ -348,18 +348,22 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour } // These pictures are practically parts of the background. -10 is for the drop-down menu. - _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x * 8, y - 10); + _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x, y - 10); } -void Celer::show_one(byte which) { +void Celer::show_one(int16 destX, int16 destY, byte which) { chunkblocktype ch; which--; // For the difference between the Pascal and C array indexes. //setactivepage(3); warning("STUB: Celer::show_one()"); - if (memos[which].x > on_disk) - display_it(memos[which].x, memos[which].y, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]); - else { + if (memos[which].x > on_disk) { + if (destX == -1) { + destX = memos[which].x * 8; + destY = memos[which].y; + } + display_it(destX, destY, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]); + } else { if (!f.open(filename)) { /* Filename was set in load_chunks() */ warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); return; @@ -378,7 +382,11 @@ void Celer::show_one(byte which) { ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); - display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, picture); + if (destX == -1) { + destX = ch.x * 8; + destY = ch.y; + } + display_it(destX, destY, ch.xl, ch.yl, ch.flavour, picture); picture.free(); f.close(); @@ -393,14 +401,4 @@ void Celer::show_one(byte which) { -void Celer::display_it_at(int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture, int16 &xxx, int16 &yyy) { - warning("STUB: Celer::display_it_at()"); -} - -void Celer::show_one_at(byte which, int16 xxx, int16 yyy) { - warning("STUB: Celer::show_one_at()"); -} - - - } // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 46ba53f910a8..3c7eda3cd996 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -78,9 +78,10 @@ class Celer { void forget_chunks(); - void show_one(byte which); - - void show_one_at(byte which, int16 xxx, int16 yyy); + // Settint the destination to -1,-1 means the picture should be drawn to it's original position. + // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. + // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. + void show_one(int16 destX, int16 destY, byte which); private: AvalancheEngine *_vm; @@ -92,8 +93,6 @@ class Celer { static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture); - - void display_it_at(int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture, int16 &xxx, int16 &yyy); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c54d56763bed..036ae4e2c376 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -391,7 +391,7 @@ void Lucerna::enterroom(byte x, byte ped) { switch (x) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } @@ -492,7 +492,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ - _vm->_celer->show_one(3); /* Position of drawbridge */ + _vm->_celer->show_one(-1, -1, 3); /* Position of drawbridge */ _vm->_graphics->refreshBackground(); _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } @@ -518,10 +518,10 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.tied_up) - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); if (!_vm->_gyro->dna.mushroom_growing) - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_graphics->refreshBackground(); } break; @@ -603,11 +603,11 @@ void Lucerna::enterroom(byte x, byte ped) { case r__argentpub: { if (_vm->_gyro->dna.wonnim) - _vm->_celer->show_one(1); /* No lute by the settle. */ + _vm->_celer->show_one(-1, -1, 1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { - _vm->_celer->show_one(8); - _vm->_celer->show_one(9); + _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->show_one(-1, -1, 9); } _vm->_graphics->refreshBackground(); } @@ -624,7 +624,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); if (_vm->_gyro->dna.lustie_is_asleep) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(-1, -1, 5); _vm->_graphics->refreshBackground(); } } @@ -634,14 +634,14 @@ void Lucerna::enterroom(byte x, byte ped) { case r__musicroom: { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_celer->show_one(4); + _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[brown - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { - _vm->_celer->show_one(6); + _vm->_celer->show_one(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -653,7 +653,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidenottspub: if (ped == 2) { - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->then_show(2); @@ -665,7 +665,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideargentpub: if (ped == 2) { - _vm->_celer->show_one(6); + _vm->_celer->show_one(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -692,7 +692,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__insidecardiffcastle: if (ped > 0) { _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) @@ -701,22 +701,22 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(2); if (_vm->_gyro->dna.taken_pen) - _vm->_celer->show_one(4); + _vm->_celer->show_one(-1, -1, 4); _vm->_sequence->start_to_close(); } else { - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); if (_vm->_gyro->dna.arrow_in_the_door) - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); else - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_graphics->refreshBackground(); } break; case r__avvysgarden: if (ped == 1) { - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -730,12 +730,12 @@ void Lucerna::enterroom(byte x, byte ped) { case r__yourhall: if (ped == 2) { /* It was the original: - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_sequence->first_show(1); _vm->_sequence->then_show(3); _vm->_sequence->start_to_close();*/ - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -746,7 +746,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_graphics->refreshBackground(); break; /* Ayles awake. */ @@ -766,7 +766,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__nottspub: { - if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->show_one(3); + if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ } break; @@ -774,7 +774,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideducks: if (ped == 2) { /* Shut the door */ - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->first_show(2); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index f41ac128c639..d9f52a3b179d 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -102,7 +102,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer->show_one(seq[0]); + _vm->_celer->show_one(-1, -1, seq[0]); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index f147ad7550f4..d68b94301331 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -242,7 +242,7 @@ end;*/ void Timeout::open_drawbridge() { _vm->_gyro->dna.drawbridge_open++; - _vm->_celer->show_one(_vm->_gyro->dna.drawbridge_open - 1); + _vm->_celer->show_one(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ @@ -285,7 +285,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); _vm->_trip->tr[0].walkto(4); - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_gyro->dna.brummie_stairs = 2; _vm->_gyro->magics[10].op = _vm->_gyro->special; _vm->_gyro->magics[10].data = 2; /* Reached the bottom of the stairs. */ @@ -399,17 +399,17 @@ void Timeout::jacques_wakes_up() { switch (_vm->_gyro->dna.jacques_awake) { /* Additional pictures. */ case 1 : - _vm->_celer->show_one(1); /* Eyes open. */ + _vm->_celer->show_one(-1, -1, 1); /* Eyes open. */ _vm->_visa->dixi('Q', 45); break; case 2 : /* Going through the door. */ - _vm->_celer->show_one(2); /* Not on the floor. */ - _vm->_celer->show_one(3); /* But going through the door. */ + _vm->_celer->show_one(-1, -1, 2); /* Not on the floor. */ + _vm->_celer->show_one(-1, -1, 3); /* But going through the door. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* You can't wake him up now. */ break; case 3 : /* Gone through the door. */ - _vm->_celer->show_one(2); /* Not on the floor, either. */ - _vm->_celer->show_one(4); /* He's gone... so the door's open. */ + _vm->_celer->show_one(-1, -1, 2); /* Not on the floor, either. */ + _vm->_celer->show_one(-1, -1, 4); /* He's gone... so the door's open. */ _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; /* Gone! */ break; } @@ -441,7 +441,7 @@ void Timeout::naughty_duke() { _vm->_trip->tr[1].walkto(3); /* He walks over to you. */ /* Let's get the door opening. */ - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); @@ -456,7 +456,7 @@ void Timeout::naughty_duke2() { } void Timeout::naughty_duke3() { - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); } @@ -498,7 +498,7 @@ void Timeout::jump() { if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_gyro->dna.arrow_in_the_door = false; /* You've got it. */ _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; _vm->_lucerna->objectlist(); @@ -514,7 +514,7 @@ void Timeout::crapulus_says_splud_out() { } void Timeout::buydrinks() { - _vm->_celer->show_one(11); /* Malagauche gets up again. */ + _vm->_celer->show_one(-1, -1, 11); /* Malagauche gets up again. */ _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls->display message about it. */ @@ -526,7 +526,7 @@ void Timeout::buydrinks() { } void Timeout::buywine() { - _vm->_celer->show_one(11); /* Malagauche gets up again. */ + _vm->_celer->show_one(-1, -1, 11); /* Malagauche gets up again. */ _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', 50); /* You buy the wine. */ @@ -619,7 +619,7 @@ void Timeout::avvy_sit_down() { if (_vm->_trip->tr[0].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->dna.sitting_in_pub = true; _vm->_gyro->dna.user_moves_avvy = false; _vm->_trip->tr[0].visible = false; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 2b3018b7b804..f83bfc07b998 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -578,59 +578,59 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(28); + _vm->_celer->show_one(-1, -1, 28); break; case 0x1: /* no connection (wall + shield), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(29); /* ...shield. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(30); /* ...door. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 30); /* ...door. */ break; case 0x3: /* wall with door and shield */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(30); /* ...door, and... */ - _vm->_celer->show_one(29); /* ...shield. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ + _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(5); /* ...window. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 5); /* ...window. */ break; case 0x5: /* wall with door and window */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(30); /* ...door, and... */ - _vm->_celer->show_one(5); /* ...window. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ + _vm->_celer->show_one(-1, -1, 5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(7); /* ...torches. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(28); /* Wall, plus... */ - _vm->_celer->show_one(30); /* ...door, and... */ - _vm->_celer->show_one(7); /* ...torches. */ + _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ + _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -645,44 +645,44 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(19); + _vm->_celer->show_one(-1, -1, 19); break; case 0x1: /* no connection (wall + window), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(19); /* Wall, plus... */ - _vm->_celer->show_one(20); /* ...window. */ + _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 20); /* ...window. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(19); /* Wall, plus... */ - _vm->_celer->show_one(21); /* ...door. */ + _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 21); /* ...door. */ break; case 0x3: /* wall with door and window */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(19); /* Wall, plus... */ - _vm->_celer->show_one(20); /* ...door, and... */ - _vm->_celer->show_one(21); /* ...window. */ + _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 20); /* ...door, and... */ + _vm->_celer->show_one(-1, -1, 21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(19); /* Wall, plus... */ - _vm->_celer->show_one(18); /* ...torches. */ + _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(19); /* Wall, plus... */ - _vm->_celer->show_one(21); /* ...door, and... */ - _vm->_celer->show_one(18); /* ...torches. */ + _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->show_one(-1, -1, 21); /* ...door, and... */ + _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -700,7 +700,7 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x1: - _vm->_celer->show_one(22); + _vm->_celer->show_one(-1, -1, 22); if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; @@ -711,13 +711,13 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[11].op = _vm->_gyro->bounces; break; case 0x2: - _vm->_celer->show_one(23); + _vm->_celer->show_one(-1, -1, 23); _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Middle exit south. */ _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x3: - _vm->_celer->show_one(24); + _vm->_celer->show_one(-1, -1, 24); _vm->_gyro->magics[11].op = _vm->_gyro->special; /* Left exit south. */ _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; @@ -732,36 +732,36 @@ void Trip::catamove(byte ped) { // LEFT handles: /* case 0x1: - _vm->_celer->show_one(4); + _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x2: - _vm->_celer->show_one(4); + _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; /* case 0x3: - _vm->_celer->show_one(4); + _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; // RIGHT handles: case 0x4: - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; */ case 0x5: - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; /* Middle exit north. */ _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; /* case 0x6: - _vm->_celer->show_one(3); + _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; @@ -770,12 +770,12 @@ void Trip::catamove(byte ped) { case 0x7: case 0x8: case 0x9: { - _vm->_celer->show_one(6); + _vm->_celer->show_one(-1, -1, 6); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->show_one(31); + _vm->_celer->show_one(-1, -1, 31); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->show_one(32); + _vm->_celer->show_one(-1, -1, 32); _vm->_gyro->magics[0].op = _vm->_gyro->special; /* Middle arch north. */ _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ @@ -785,50 +785,50 @@ void Trip::catamove(byte ped) { case 0xd: /* No connection + WINDOW */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(14); + _vm->_celer->show_one(-1, -1, 14); break; case 0xe: /* No connection + TORCH */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(8); + _vm->_celer->show_one(-1, -1, 8); break; /* Recessed door: */ case 0xf: _vm->_gyro->magics[0].op = _vm->_gyro->nix; /* Door to Geida's room. */ - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; } switch (xy_uint16) { case 514: - _vm->_celer->show_one(17); + _vm->_celer->show_one(-1, -1, 17); break; /* [2,2] : "Art Gallery" sign over door. */ case 264: - _vm->_celer->show_one(9); + _vm->_celer->show_one(-1, -1, 9); break; /* [8,1] : "The Wrong Way!" sign. */ case 1797: - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); break; /* [5,7] : "Ite Mingite" sign. */ case 258: for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ - _vm->_celer->show_one_at(15, 130 + fv * 120, 70); - _vm->_celer->show_one_at(16, 184 + fv * 120, 78); + _vm->_celer->show_one(130 + fv * 120, 70, 15); + _vm->_celer->show_one(184 + fv * 120, 78, 16); } break; case 1287: for (fv = 10; fv <= 13; fv++) - _vm->_celer->show_one(fv); + _vm->_celer->show_one(-1, -1, fv); break; /* [7,5] : 4 candles. */ case 776: - _vm->_celer->show_one(10); + _vm->_celer->show_one(-1, -1, 10); break; /* [8,3] : 1 candle. */ case 2049: - _vm->_celer->show_one(11); + _vm->_celer->show_one(-1, -1, 11); break; /* [1,8] : another candle. */ case 257: - _vm->_celer->show_one(12); - _vm->_celer->show_one(13); + _vm->_celer->show_one(-1, -1, 12); + _vm->_celer->show_one(-1, -1, 13); break; /* [1,1] : the other two. */ } @@ -851,7 +851,7 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ - _vm->_celer->show_one(1); + _vm->_celer->show_one(-1, -1, 1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[9].op = _vm->_gyro->nix; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); @@ -897,7 +897,7 @@ void Trip::call_special(uint16 which) { _vm->_visa->dixi('q', 35); tr[0].done(); /*tr[1].vanishifstill:=true;*/ - _vm->_celer->show_one(2); + _vm->_celer->show_one(-1, -1, 2); _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; @@ -1246,7 +1246,7 @@ void Trip::arrow_procs(byte tripnum) { } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ - _vm->_celer->show_one(3); /* Show pic of arrow stuck into the door. */ + _vm->_celer->show_one(-1, -1, 3); /* Show pic of arrow stuck into the door. */ _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ } @@ -1493,7 +1493,7 @@ void Trip::hide_in_the_cupboard() { _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); _vm->_gyro->dna.avvys_in_the_cupboard = true; - _vm->_celer->show_one(8); + _vm->_celer->show_one(-1, -1, 8); } } From 0abeaababb04956fb014775e716c0344ca7f7b14 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 30 Aug 2013 23:54:42 +0200 Subject: [PATCH 0704/1332] AVALANCHE: Replace the mini-game "Nim" until implementation. --- engines/avalanche/acci2.cpp | 41 +++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0b982dbc3d3a..9819d7ecfc3b 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1624,10 +1624,43 @@ void Acci::do_that() { case vb_play: if (thing == pardon) { switch (_vm->_gyro->dna.room) { /* They just typed "play"... */ - case r__argentpub: - // play_nim(); - warning("STUB: Acci::do_that() - case vb_play"); - break; /* ...in the pub, => play Nim. */ + case r__argentpub: { /* ...in the pub, => play Nim. */ + warning("STUB: Acci::do_that() - case vb_play"); + // play_nim(); + // The following parts are copied from play_nim(). + // The player automatically wins the game everytime he wins, until I implement the mini-game. + + if (_vm->_gyro->dna.wonnim) { + /* Already won the game. */ + _vm->_visa->dixi('Q', 6); + return; + } + + if (!_vm->_gyro->dna.asked_dogfood_about_nim) { + _vm->_visa->dixi('q', 84); + return; + } + + _vm->_visa->dixi('Q', 3); + _vm->_gyro->dna.playednim++; + + /* You won - strange! */ + _vm->_logger->log_aside("You won."); + _vm->_visa->dixi('Q', 7); /* You won! Give us a lute! */ + _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; + _vm->_lucerna->objectlist(); + _vm->_gyro->dna.wonnim = true; + _vm->_celer->show_one(-1, -1, 1); /* Show the settle with no lute on it. */ + _vm->_lucerna->points(7); /* 7 points for winning! */ + + if (_vm->_gyro->dna.playednim == 1) + _vm->_lucerna->points(3); /* 3 points for playing your 1st game. */ + + // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! + _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); + } + break; case r__musicroom: play_harp(); break; From c421426d8abe447ca2c4b75bc978bd0ae25e858a Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 31 Aug 2013 00:30:06 +0200 Subject: [PATCH 0705/1332] AVALANCHE: Make the game finally completable. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/timeout2.cpp | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 9819d7ecfc3b..fb024aebb87f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1261,7 +1261,7 @@ void Acci::getproc(char thing) { void Acci::give_geida_the_lute() { if (_vm->_gyro->dna.room != r__lustiesroom) { - _vm->_scrolls->display("Not yet. Try later!\232\2"); + _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2c7041d0626b..3c2fc49fa542 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -724,7 +724,7 @@ Common::Error AvalancheEngine::run() { break; } - } while (true); + } while (false); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index d68b94301331..d6dff889842b 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -642,11 +642,14 @@ void Timeout::arkata_shouts() { void Timeout::winning() { _vm->_visa->dixi('q', 79); + _vm->_pingo->winning_pic(); + warning("STUB: Timeout::winning()"); + /*do { + _vm->_lucerna->checkclick(); + } while (!(_vm->_gyro->mrelease == 0));*/ + // To be implemented with Pingo::winning_pic(). - do { - _vm->_lucerna->checkclick(); - } while (!(_vm->_gyro->mrelease == 0)); _vm->_lucerna->callverb(_vm->_acci->vb_score); _vm->_scrolls->display(" T H E E N D "); _vm->_gyro->lmo = true; From a9e9a8b9af29a0270f8feef19cac4da37743860d Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 31 Aug 2013 21:15:33 +0200 Subject: [PATCH 0706/1332] AVALANCHE: Cosmetic and other repairs in Timeout. --- engines/avalanche/timeout2.cpp | 162 ++++++++++++++------------------- engines/avalanche/timeout2.h | 48 +--------- 2 files changed, 72 insertions(+), 138 deletions(-) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index d6dff889842b..334b49f5ecdc 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -27,9 +27,6 @@ /* TIMEOUT The scheduling unit. */ -// DON'T FORGET ABOUT THE ARRAY INDEXES, THEY MAY'LL CAUSE TROUBLES!!! - - #include "avalanche/avalanche.h" #include "avalanche/timeout2.h" @@ -212,8 +209,8 @@ void Timeout::one_tick() { } } } - _vm->_gyro->roomtime++; /* Cycles since you've been in this room. */ - _vm->_gyro->dna.total_time++; /* Total amount of time for this game. */ + _vm->_gyro->roomtime++; // Cycles since you've been in this room. + _vm->_gyro->dna.total_time++; // Total amount of time for this game. } void Timeout::lose_timer(byte which) { @@ -225,33 +222,16 @@ void Timeout::lose_timer(byte which) { timerLost = true; } -/*function timer_is_on(which:byte):boolean; -var fv:byte; -begin - for fv:=1 to 7 do - with times[fv] do - if (what_for=which) and (time_left>0) then - begin - timer_is_on:=true; - exit; - end; - timer_is_on:=false; -end;*/ - -/* Timeout procedures: */ - void Timeout::open_drawbridge() { _vm->_gyro->dna.drawbridge_open++; _vm->_celer->show_one(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) - _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; // You may enter the drawbridge. else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } -/* --- */ - void Timeout::avaricius_talks() { _vm->_visa->dixi('q', _vm->_gyro->dna.avaricius_talk); _vm->_gyro->dna.avaricius_talk++; @@ -274,7 +254,7 @@ void Timeout::toilet2() { } void Timeout::bang() { - _vm->_scrolls->display("\6< BANG! >"); + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); set_up_timer(30, procbang2, reason_explosion); } @@ -288,8 +268,8 @@ void Timeout::stairs() { _vm->_celer->show_one(-1, -1, 2); _vm->_gyro->dna.brummie_stairs = 2; _vm->_gyro->magics[10].op = _vm->_gyro->special; - _vm->_gyro->magics[10].data = 2; /* Reached the bottom of the stairs. */ - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* Stop them hitting the sides (or the game will hang.) */ + _vm->_gyro->magics[10].data = 2; // Reached the bottom of the stairs. + _vm->_gyro->magics[3].op = _vm->_gyro->nix; // Stop them hitting the sides (or the game will hang.) } void Timeout::cardiff_survey() { @@ -307,7 +287,7 @@ void Timeout::cardiff_survey() { void Timeout::cardiff_return() { _vm->_visa->dixi('q', 28); - cardiff_survey(); /* add end of question. */ + cardiff_survey(); // Add end of question. } void Timeout::cwytalot_in_herts() { @@ -315,7 +295,7 @@ void Timeout::cwytalot_in_herts() { } void Timeout::get_tied_up() { - _vm->_visa->dixi('q', 34); /* ...Trouble! */ + _vm->_visa->dixi('q', 34); // ...Trouble! _vm->_gyro->dna.user_moves_avvy = false; _vm->_gyro->dna.been_tied_up = true; _vm->_trip->stopwalking(); @@ -329,13 +309,13 @@ void Timeout::get_tied_up() { void Timeout::get_tied_up2() { _vm->_trip->tr[0].walkto(4); _vm->_trip->tr[1].walkto(5); - _vm->_gyro->magics[3].op = _vm->_gyro->nix; /* No effect when you touch the boundaries. */ + _vm->_gyro->magics[3].op = _vm->_gyro->nix; // No effect when you touch the boundaries. _vm->_gyro->dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { _vm->_trip->tr[1].check_me = false; - _vm->_trip->tr[0].init(7, true, _vm->_trip); /* Robin Hood */ + _vm->_trip->tr[0].init(7, true, _vm->_trip); // Robin Hood _vm->_gyro->whereis[_vm->_gyro->probinhood - 150] = r__robins; _vm->_trip->apped(1, 2); _vm->_visa->dixi('q', 39); @@ -350,14 +330,14 @@ void Timeout::hang_around2() { _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = r__robins; _vm->_visa->dixi('q', 41); _vm->_trip->tr[0].done(); - _vm->_trip->tr[1].done(); /* Get rid of Robin Hood and Friar Tuck. */ + _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. set_up_timer(1, procafter_the_shootemup, reason_hanging_around); - /* Immediately call the following proc (when you have a chance). */ + // Immediately call the following proc (when you have a chance). _vm->_gyro->dna.tied_up = false; - _vm->_enid->back_to_bootstrap(1); /* Call the shoot-'em-up. */ + _vm->_enid->back_to_bootstrap(1); // Call the shoot-'em-up. } void Timeout::after_the_shootemup() { @@ -395,26 +375,25 @@ void Timeout::after_the_shootemup() { } void Timeout::jacques_wakes_up() { - _vm->_gyro->dna.jacques_awake += 1; + _vm->_gyro->dna.jacques_awake++; - switch (_vm->_gyro->dna.jacques_awake) { /* Additional pictures. */ + switch (_vm->_gyro->dna.jacques_awake) { // Additional pictures. case 1 : - _vm->_celer->show_one(-1, -1, 1); /* Eyes open. */ + _vm->_celer->show_one(-1, -1, 1); // Eyes open. _vm->_visa->dixi('Q', 45); break; - case 2 : /* Going through the door. */ - _vm->_celer->show_one(-1, -1, 2); /* Not on the floor. */ - _vm->_celer->show_one(-1, -1, 3); /* But going through the door. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* You can't wake him up now. */ + case 2 : // Going through the door. + _vm->_celer->show_one(-1, -1, 2); // Not on the floor. + _vm->_celer->show_one(-1, -1, 3); // But going through the door. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // You can't wake him up now. break; - case 3 : /* Gone through the door. */ - _vm->_celer->show_one(-1, -1, 2); /* Not on the floor, either. */ - _vm->_celer->show_one(-1, -1, 4); /* He's gone... so the door's open. */ - _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; /* Gone! */ + case 3 : // Gone through the door. + _vm->_celer->show_one(-1, -1, 2); // Not on the floor, either. + _vm->_celer->show_one(-1, -1, 4); // He's gone... so the door's open. + _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; // Gone! break; } - if (_vm->_gyro->dna.jacques_awake == 5) { _vm->_gyro->dna.ringing_bells = true; _vm->_gyro->dna.ayles_is_awake = true; @@ -431,16 +410,14 @@ void Timeout::jacques_wakes_up() { set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); break; } - } -void Timeout::naughty_duke() { -/* This is when the Duke comes in and takes your money. */ - _vm->_trip->tr[1].init(9, false, _vm->_trip); /* Here comes the Duke. */ - _vm->_trip->apped(2, 1); /* He starts at the door... */ - _vm->_trip->tr[1].walkto(3); /* He walks over to you. */ +void Timeout::naughty_duke() { // This is when the Duke comes in and takes your money. + _vm->_trip->tr[1].init(9, false, _vm->_trip); // Here comes the Duke. + _vm->_trip->apped(2, 1); // He starts at the door... + _vm->_trip->tr[1].walkto(3); // He walks over to you. - /* Let's get the door opening. */ + // Let's get the door opening. _vm->_celer->show_one(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); @@ -449,9 +426,9 @@ void Timeout::naughty_duke() { } void Timeout::naughty_duke2() { - _vm->_visa->dixi('q', 48); /* Ha ha, it worked again! */ - _vm->_trip->tr[1].walkto(1); /* Walk to the door. */ - _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ + _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" + _vm->_trip->tr[1].walkto(1); // Walk to the door. + _vm->_trip->tr[1].vanishifstill = true; // Then go away! set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -483,23 +460,23 @@ void Timeout::jump() { break; } - if (_vm->_gyro->dna.jumpstatus == 20) { /* End of jump. */ + if (_vm->_gyro->dna.jumpstatus == 20) { // End of jump. _vm->_gyro->dna.user_moves_avvy = true; _vm->_gyro->dna.jumpstatus = 0; - } else { /* Still jumping. */ + } else { // Still jumping. set_up_timer(1, procjump, reason_jumping); } - if ((_vm->_gyro->dna.jumpstatus == 10) /* You're at the highest point of your jump. */ + if ((_vm->_gyro->dna.jumpstatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->dna.room == r__insidecardiffcastle) && (_vm->_gyro->dna.arrow_in_the_door == true) - && (_vm->_trip->infield(3))) { /* beside the wall*/ - /* Grab the arrow! */ + && (_vm->_trip->infield(3))) { // Beside the wall + // Grab the arrow! if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { _vm->_celer->show_one(-1, -1, 2); - _vm->_gyro->dna.arrow_in_the_door = false; /* You've got it. */ + _vm->_gyro->dna.arrow_in_the_door = false; // You've got it. _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; _vm->_lucerna->objectlist(); _vm->_visa->dixi('q', 50); @@ -514,33 +491,33 @@ void Timeout::crapulus_says_splud_out() { } void Timeout::buydrinks() { - _vm->_celer->show_one(-1, -1, 11); /* Malagauche gets up again. */ + _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; - _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); /* _vm->_scrolls->display message about it. */ - _vm->_pingo->wobble(); /* Do the special effects. */ - _vm->_visa->dixi('D', 1); /* That'll be thruppence. */ - if (_vm->_gyro->pennycheck(3)) /* Pay 3d. */ - _vm->_visa->dixi('D', 3); /* Tell 'em you paid up. */ + _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); // Display message about it. + _vm->_pingo->wobble(); // Do the special effects. + _vm->_visa->dixi('D', 1); // That'll be thruppence. + if (_vm->_gyro->pennycheck(3)) // Pay 3d. + _vm->_visa->dixi('D', 3); // Tell 'em you paid up. _vm->_acci->have_a_drink(); } void Timeout::buywine() { - _vm->_celer->show_one(-1, -1, 11); /* Malagauche gets up again. */ + _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; - _vm->_visa->dixi('D', 50); /* You buy the wine. */ - _vm->_visa->dixi('D', 1); /* It'll be thruppence. */ + _vm->_visa->dixi('D', 50); // You buy the wine. + _vm->_visa->dixi('D', 1); // It'll be thruppence. if (_vm->_gyro->pennycheck(3)) { - _vm->_visa->dixi('D', 4); /* You paid up. */ + _vm->_visa->dixi('D', 4); // You paid up. _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.winestate = 1; /* OK Wine */ + _vm->_gyro->dna.winestate = 1; // OK Wine. } } void Timeout::callsguards() { - _vm->_visa->dixi('Q', 58); /* GUARDS!!! */ + _vm->_visa->dixi('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameover(); } @@ -551,8 +528,8 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro->magics[8].op = _vm->_gyro->nix; - _vm->_trip->tr[0].iy++; /* increments dx/dy! */ - _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; /* Dowwwn we go... */ + _vm->_trip->tr[0].iy++; // Increments dx/dy! + _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -577,8 +554,8 @@ void Timeout::meet_avaroid() { void Timeout::rise_up_oubliette() { _vm->_trip->tr[0].visible = true; - _vm->_trip->tr[0].iy++; /* decrements dx/dy! */ - _vm->_trip->tr[0].y -= _vm->_trip->tr[0].iy; /* Uuuupppp we go... */ + _vm->_trip->tr[0].iy++; // Decrements dx/dy! + _vm->_trip->tr[0].y -= _vm->_trip->tr[0].iy; // Uuuupppp we go... if (_vm->_trip->tr[0].iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else @@ -614,9 +591,8 @@ void Timeout::avalot_returns() { } void Timeout::avvy_sit_down() { -/* This is used when you sit down in the pub in Notts. It loops around so - that it will happen when Avvy stops walking. */ - if (_vm->_trip->tr[0].homing) /* Still walking */ +// This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. + if (_vm->_trip->tr[0].homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->show_one(-1, -1, 3); @@ -657,12 +633,17 @@ void Timeout::winning() { void Timeout::avalot_falls() { if (_vm->_trip->tr[0].step < 5) { - _vm->_trip->tr[0].step += 1; + _vm->_trip->tr[0].step++; set_up_timer(3, procavalot_falls, reason_falling_over); - } else - //_vm->_scrolls->display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26"); - - warning("STUB: Timeout::avalot_falls()"); + } else { + Common::String toDisplay; + for (byte i = 0; i < 6; i++) + toDisplay += _vm->_scrolls->kControlNewLine; + for (byte i = 0; i < 6; i++) + toDisplay += _vm->_scrolls->kControlInsertSpaces; + toDisplay = toDisplay + _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; + _vm->_scrolls->display(toDisplay); + } } void Timeout::spludwick_goes_to_cauldron() { @@ -673,19 +654,16 @@ void Timeout::spludwick_goes_to_cauldron() { } void Timeout::spludwick_leaves_cauldron() { - _vm->_trip->tr[1].call_eachstep = true; /* So that normal procs will continue. */ + _vm->_trip->tr[1].call_eachstep = true; // So that normal procs will continue. } -void Timeout::give_lute_to_geida() { /* Moved here from Acci. */ +void Timeout::give_lute_to_geida() { // Moved here from Acci. _vm->_visa->dixi('Q', 86); _vm->_lucerna->points(4); _vm->_gyro->dna.lustie_is_asleep = true; _vm->_sequence->first_show(5); - _vm->_sequence->then_show(6); /* He falls asleep... */ - _vm->_sequence->start_to_close(); /* Not really closing, but we're using the same procedure. */ + _vm->_sequence->then_show(6); // He falls asleep... + _vm->_sequence->start_to_close(); // Not really closing, but we're using the same procedure. } -/* "This is all!" */ - - } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 80f0677786c3..9ad2c30eb607 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -71,85 +71,45 @@ class Timeout { /* procx now runs between 1 and 41. */ static const int16 procopen_drawbridge = 3; - static const int16 procavaricius_talks = 4; - static const int16 procurinate = 5; - static const int16 proctoilet2 = 6; - static const int16 procbang = 7; - static const int16 procbang2 = 8; - static const int16 procstairs = 9; - static const int16 proccardiffsurvey = 10; - static const int16 proccardiff_return = 11; - static const int16 proc_cwytalot_in_herts = 12; - static const int16 procget_tied_up = 13; - static const int16 procget_tied_up2 = 1; - static const int16 prochang_around = 14; - static const int16 prochang_around2 = 15; - static const int16 procafter_the_shootemup = 32; - static const int16 procjacques_wakes_up = 16; - static const int16 procnaughty_duke = 17; - static const int16 procnaughty_duke2 = 18; - static const int16 procnaughty_duke3 = 38; - static const int16 procjump = 19; - static const int16 procsequence = 20; - static const int16 proccrapulus_splud_out = 21; - static const int16 procdawn_delay = 22; - static const int16 procbuydrinks = 23; - static const int16 procbuywine = 24; - static const int16 proccallsguards = 25; - static const int16 procgreetsmonk = 26; - static const int16 procfall_down_oubliette = 27; - static const int16 procmeet_avaroid = 28; - static const int16 procrise_up_oubliette = 29; - static const int16 procrobin_hood_and_geida = 2; - static const int16 procrobin_hood_and_geida_talk = 30; - static const int16 procavalot_returns = 31; - static const int16 procavvy_sit_down = 33; /* In Nottingham. */ - static const int16 procghost_room_phew = 34; - static const int16 procarkata_shouts = 35; - static const int16 procwinning = 36; - static const int16 procavalot_falls = 37; - static const int16 procspludwick_goes_to_cauldron = 39; - static const int16 procspludwick_leaves_cauldron = 40; - static const int16 procgive_lute_to_geida = 41; struct timetype { @@ -162,7 +122,7 @@ class Timeout { timetype times[7]; - bool timerLost; // Is the timer "lost"? + bool timerLost; // Is the timer "lost"? (Because of using lose_timer()) @@ -176,9 +136,7 @@ class Timeout { void lose_timer(byte which); - /*function timer_is_on(which:byte):boolean;*/ - - /* procedures to do things at the end of amounts of time: */ + // Procedures to do things at the end of amounts of time: void open_drawbridge(); @@ -260,8 +218,6 @@ class Timeout { private: AvalancheEngine *_vm; - - byte fv; }; } // End of namespace Avalanche. From 4d6573a80ebc2ca2aab356426ea50adf3ca77505 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 1 Sep 2013 17:15:55 +0200 Subject: [PATCH 0707/1332] AVALANCHE: Start implementation of the drop-down menu. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 11 +- engines/avalanche/dropdown2.cpp | 540 ++++++++++++++++++++------------ engines/avalanche/dropdown2.h | 44 +-- engines/avalanche/graphics.h | 2 + engines/avalanche/gyro2.cpp | 16 +- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 10 +- engines/avalanche/lucerna2.h | 2 +- 9 files changed, 367 insertions(+), 262 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3c2fc49fa542..0c5869efbe38 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -532,7 +532,7 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick(). + _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::checkclick(). break; case Common::EVENT_LBUTTONUP: _lucerna->holdLeftMouse = false; // Same as above. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6c80ee9c75ec..96cb30702f74 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -222,7 +222,6 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->clock_lucerna(); _vm->_dropdown->menu_link(); - _vm->_trip->readstick(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); _vm->_celer->pics_link(); @@ -233,13 +232,13 @@ void Avalot::run(Common::String arg) { // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + /*for (byte i = 0; i < _vm->_gyro->lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); for (byte i = 0; i < _vm->_gyro->numfields; i++) { - if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); - } + if (_vm->_gyro->fields[i].x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + }*/ // ONYL FOR TESTING!!! diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index b19b2534f21d..4565c2faeb5d 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -49,8 +49,8 @@ headtype *headtype::init(char trig, char alttrig, Common::String name, byte p, f alttrigger = alttrig; title = name; position = p; - xpos = (position - 1) * _dr->spacing + _dr->indent; - xright = position * _dr->spacing + _dr->indent; + xpos = position * _dr->spacing + _dr->indent; + xright = (position + 1) * _dr->spacing + _dr->indent; do_setup = dw; do_choose = dc; @@ -71,12 +71,12 @@ void headtype::highlight() { warning("STUB: Dropdown::headytpe::highlight()"); _dr->hlchalk(xpos, 1, trigger, title, true); - { - _dr->ddm_o.left = xpos; - _dr->ddm_o.menunow = true; - _dr->_vm->_gyro->ddmnow = true; - _dr->ddm_o.menunum = position; - } + + _dr->ddm_o.left = xpos; + _dr->ddm_o.menunow = true; + _dr->_vm->_gyro->ddmnow = true; + _dr->ddm_o.menunum = position; + _dr->_vm->_gyro->cmp = 177; /* Force redraw of cursor. */ } @@ -91,12 +91,11 @@ bool headtype::extdparse(char c) { -onemenu *onemenu::init(Dropdown *dr) { +void onemenu::init(Dropdown *dr) { _dr = dr; menunow = false; _dr->_vm->_gyro->ddmnow = false; menunum = 1; - return this; } void onemenu::start_afresh() { @@ -108,55 +107,121 @@ void onemenu::start_afresh() { } void onemenu::opt(Common::String n, char tr, Common::String key, bool val) { - int16 l; - number += 1; - l = (n + key).size() + 3; - if (width < l) width = l; - { - optiontype &with = oo[number]; - with.title = n; - with.trigger = tr; - with.shortcut = key; - with.valid = val; - } + int16 l = (n + key).size() + 3; + if (width < l) + width = l; + + oo[number].title = n; + oo[number].trigger = tr; + oo[number].shortcut = key; + oo[number].valid = val; + number++; } void onemenu::displayopt(byte y, bool highlit) { - warning("STUB: Dropdown::onemenu::displayopt()"); + byte backgroundColor; + if (highlit) + backgroundColor = 0; + else + backgroundColor = 7; + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((flx1 + 1) * 8, 3 + (y + 1) * 10, (flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); + //bar((flx1 + 1) * 8, 3 + y * 10, (flx2 + 1) * 8, 12 + y * 10); + + Common::String data = oo[y].title; + while ((data + oo[y].shortcut).size() < width) + data += ' '; /* Pad oo[y] spaces. */ + data = data + oo[y].shortcut; + + if (highlit) + _dr->hlchalk(left, 4 + (y + 1) * 10, oo[y].trigger, data, oo[y].valid); + else + _dr->chalk(left, 4 + (y + 1) * 10, oo[y].trigger, data, oo[y].valid); } void onemenu::display() { - warning("STUB: Dropdown::onemenu::display()"); + CursorMan.showMouse(false); + /*setactivepage(cp); + setvisualpage(cp); + setfillstyle(1, menu_b); + setcolor(menu_border);*/ + firstlix = true; + flx1 = left - 2; + flx2 = left + width; + fly = 15 + number * 10; + menunow = true; + _dr->_vm->_gyro->ddmnow = true; + + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((flx1 + 1) * 8, 12, (flx2 + 1) * 8, fly), _dr->menu_b); + _dr->_vm->_graphics->_surface.frameRect(Common::Rect((flx1 + 1) * 8 - 1, 11, (flx2 + 1) * 8 + 1, fly + 1), _dr->menu_border); + /*bar((flx1 + 1) * 8, 12, (flx2 + 1) * 8, fly); + rectangle((flx1 + 1) * 8 - 1, 11, (flx2 + 1) * 8 + 1, fly + 1);*/ + + displayopt(0, true); + for (byte y = 1; y < number; y++) + displayopt(y, false); + + _dr->_vm->_gyro->defaultled = 1; + _dr->_vm->_gyro->cmp = 177; + //mousepage(cp); + CursorMan.showMouse(true); // 4 = fletch } void onemenu::wipe() { - warning("STUB: Dropdown::onemenu::wipe()"); + //setactivepage(cp); + CursorMan.showMouse(false); + + _dr->chalk(_dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].xpos, 1, _dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].trigger, _dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].title, true); + + /*mblit(flx1, 11, flx2 + 1, fly + 1, 3, cp); + blitfix();*/ + + menunow = false; + _dr->_vm->_gyro->ddmnow = false; + firstlix = false; + _dr->_vm->_gyro->defaultled = 2; + + CursorMan.showMouse(true); } void onemenu::movehighlight(int8 add) { - warning("STUB: Dropdown::onemenu::movehighlight()"); + int8 hn; + if (add != 0) { + hn = highlightnum + add; + if ((hn < 0) || (hn >= number)) + return; + highlightnum = hn; + } + //setactivepage(cp); + CursorMan.showMouse(false); + displayopt(oldy, false); + displayopt(highlightnum, true); + //setactivepage(1 - cp); + oldy = highlightnum; + CursorMan.showMouse(true); } -void onemenu::lightup() { /* This makes the menu highlight follow the mouse.*/ - warning("STUB: Dropdown::onemenu::lightup()"); - /*if ((_dr->_vm->_gyro->mx < flx1 * 8) || (_dr->_vm->_gyro->mx > flx2 * 8) || - (_dr->_vm->_gyro->my <= 12) || (_dr->_vm->_gyro->my > fly - 3)) - return; - highlightnum = (_dr->_vm->_gyro->my - 13) / 10; - if (highlightnum == oldy) return; - movehighlight(0);*/ - +void onemenu::lightup(Common::Point cursorPos) { + if ((cursorPos.x < flx1 * 8) || (cursorPos.x > flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) + return; + highlightnum = (cursorPos.y - 26) / 20; + if (highlightnum == oldy) + return; + movehighlight(0); } void onemenu::select(byte n) { /* Choose which one you want. */ - if (! oo[n + 1].valid) return; + if (!oo[n].valid) + return; + choicenum = n; wipe(); - if (choicenum == number) choicenum -= 1; /* Off the bottom. */ - if (choicenum > number) choicenum = 0; /* Off the top, I suppose. */ + if (choicenum == number) + choicenum--; /* Off the bottom. */ + if (choicenum > number) + choicenum = 0; /* Off the top, I suppose. */ - _dr->ddm_m.ddms[menunum].do_choose; + (_dr->*_dr->ddm_m.ddms[menunum].do_choose)(); } void onemenu::keystroke(char c) { @@ -164,13 +229,13 @@ void onemenu::keystroke(char c) { bool found; c = toupper(c); found = false; - for (fv = 1; fv <= number; fv ++) { + for (fv = 0; fv < number; fv++) { if ((toupper(oo[fv].trigger) == c) && oo[fv].valid) { - select(fv - 1); + select(fv); found = true; } } - if (! found) + if (!found) _dr->_vm->_gyro->blip(); } @@ -178,15 +243,14 @@ void onemenu::keystroke(char c) { -menuset *menuset::init(Dropdown *dr) { +void menuset::init(Dropdown *dr) { _dr = dr; howmany = 0; - return this; } void menuset::create(char t, Common::String n, char alttrig, func dw, func dc) { - howmany ++; ddms[howmany].init(t, alttrig, n, howmany, dw, dc, _dr); + howmany++; } void menuset::update() { @@ -201,10 +265,10 @@ void menuset::update() { savecp = _dr->_vm->_gyro->cp; _dr->_vm->_gyro->cp = 3; - for (fv = 1; fv <= howmany; fv ++) + for (fv = 0; fv < howmany; fv++) ddms[fv].display(); - for (page_ = 0; page_ <= 1; page_ ++) + for (page_ = 0; page_ <= 1; page_++) _dr->_vm->_trip->getset[page_].remember(menuspace); _dr->_vm->_gyro->cp = savecp; @@ -212,33 +276,34 @@ void menuset::update() { void menuset::extd(char c) { byte fv; - fv = 1; - while ((fv <= howmany) && (ddms[fv].extdparse(c))) fv += 1; - if (fv > howmany) return; + fv = 0; + while ((fv < howmany) && (ddms[fv].extdparse(c))) + fv ++; + if (fv == howmany) + return; getcertain(fv); } void menuset::getcertain(byte fv) { - { - if (_dr->ddm_o.menunow) { - _dr->ddm_o.wipe(); /* get rid of menu */ - if (_dr->ddm_o.menunum == ddms[fv].position) return; /* clicked on own highlight */ - } - ddms[fv].highlight(); - ddms[fv].do_setup; + if (_dr->ddm_o.menunow) { + _dr->ddm_o.wipe(); // Get rid of menu. + if (_dr->ddm_o.menunum == ddms[fv].position) + return; // Clicked on own highlight. } + ddms[fv].highlight(); + (_dr->*ddms[fv].do_setup)(); } void menuset::getmenu(int16 x) { byte fv; fv = 0; do { - fv += 1; if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { getcertain(fv); return; } - } while (!(fv > howmany)); + fv++; + } while (fv < howmany); } @@ -247,6 +312,8 @@ void menuset::getmenu(int16 x) { Dropdown::Dropdown(AvalancheEngine *vm) { _vm = vm; + ddm_o.init(this); + ddm_m.init(this); } void Dropdown::find_what_you_can_do_with_it() { @@ -305,15 +372,42 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = black; } } + + _vm->_graphics->refreshScreen(); } void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { -/* Highlighted. */ - byte fv, ff, p; - uint16 pageseg; byte ander; + if (valid) + ander = 255; + else + ander = 170; + + fontType font; + for (byte fv = 0; fv < z.size(); fv++) + for (byte ff = 0; ff < 8; ff++) { + font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; // Set the font. + // And set the background of the text to black. + for (byte i = 0; i < 8; i++) + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = black; + } + + _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, white); + + // Underline the selected character. + if (z.contains(t)) { + byte fv; + for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. + + byte pixel = ander; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit) + *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = white; + } + } - warning("STUB: Dropdown::hlchalk()"); + _vm->_graphics->refreshScreen(); } /*funcedure say(x,y:int16; t:char; z:Common::String; f,b:byte); @@ -337,9 +431,9 @@ void Dropdown::parsekey(char r, char re) { ddm_o.wipe(); ddm_m.getcertain(ddm_o.menunum - 1); } else { - ; /* Get menu on the left-hand side */ + // Get menu on the left-hand side. ddm_o.wipe(); - ddm_m.getmenu((ddm_m.howmany - 1)*spacing + indent); + ddm_m.getmenu((ddm_m.howmany - 1) * spacing + indent); } break; case 'M': @@ -347,7 +441,7 @@ void Dropdown::parsekey(char r, char re) { ddm_o.wipe(); ddm_m.getcertain(ddm_o.menunum + 1); } else { - ; /* Get menu on the far right-hand side */ + // Get menu on the far right-hand side. ddm_o.wipe(); ddm_m.getmenu(indent); } @@ -369,92 +463,83 @@ void Dropdown::parsekey(char r, char re) { default: { if (ddm_o.menunow) ddm_o.keystroke(r); - } + } } } /*$F+ *** Here follow all the ddm__ and do__ funcedures for the DDM system. */ void Dropdown::ddm__game() { - { - ddm_o.start_afresh(); - ddm_o.opt("Help...", 'H', "f1", true); - ddm_o.opt("Boss Key", 'B', "alt-B", true); - ddm_o.opt("Untrash screen", 'U', "ctrl-f7", true); - ddm_o.opt("Score and rank", 'S', "f9", true); - ddm_o.opt("About Avvy...", 'A', "shift-f10", true); - ddm_o.display(); - } + ddm_o.start_afresh(); + ddm_o.opt("Help...", 'H', "f1", true); + ddm_o.opt("Boss Key", 'B', "alt-B", true); + ddm_o.opt("Untrash screen", 'U', "ctrl-f7", true); + ddm_o.opt("Score and rank", 'S', "f9", true); + ddm_o.opt("About Avvy...", 'A', "shift-f10", true); + ddm_o.display(); } void Dropdown::ddm__file() { - { - ddm_o.start_afresh(); - ddm_o.opt("New game", 'N', "f4", true); - ddm_o.opt("Load...", 'L', "^f3", true); - ddm_o.opt("Save", 'S', "^f2", _vm->_gyro->alive); - ddm_o.opt("Save As...", 'v', "", _vm->_gyro->alive); - ddm_o.opt("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); - ddm_o.opt("Quit", 'Q', "alt-X", true); - ddm_o.display(); - } + ddm_o.start_afresh(); + ddm_o.opt("New game", 'N', "f4", true); + ddm_o.opt("Load...", 'L', "^f3", true); + ddm_o.opt("Save", 'S', "^f2", _vm->_gyro->alive); + ddm_o.opt("Save As...", 'v', "", _vm->_gyro->alive); + ddm_o.opt("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); + ddm_o.opt("Quit", 'Q', "alt-X", true); + ddm_o.display(); } void Dropdown::ddm__action() { - Common::String n; - n = Common::String(_vm->_gyro->f5_does().c_str() + 2, 253); + ddm_o.start_afresh(); - { - ddm_o.start_afresh(); - if (n == "") - ddm_o.opt("Do something", 'D', "f5", false); - else - ddm_o.opt(Common::String(n.c_str() + 2, 253), n[1], "f5", true); - ddm_o.opt("Pause game", 'P', "f6", true); - if (_vm->_gyro->dna.room == 99) - ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip->neardoor()); - else - ddm_o.opt("Open the door", 'O', "f7", _vm->_trip->neardoor()); - ddm_o.opt("Look around", 'L', "f8", true); - ddm_o.opt("Inventory", 'I', "Tab", true); - if (_vm->_trip->tr[1].xs == _vm->_gyro->walk) - ddm_o.opt("Run fast", 'R', "^R", true); - else - ddm_o.opt("Walk slowly", 'W', "^W", true); - ddm_o.display(); - } + Common::String n = _vm->_gyro->f5_does(); + for (byte i = 0; i < 2; i++) + n.deleteChar(0); + if (n.empty()) + ddm_o.opt("Do something", 'D', "f5", false); + else + ddm_o.opt(n, n[0], "f5", true); + ddm_o.opt("Pause game", 'P', "f6", true); + if (_vm->_gyro->dna.room == 99) + ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip->neardoor()); + else + ddm_o.opt("Open the door", 'O', "f7", _vm->_trip->neardoor()); + ddm_o.opt("Look around", 'L', "f8", true); + ddm_o.opt("Inventory", 'I', "Tab", true); + if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) + ddm_o.opt("Run fast", 'R', "^R", true); + else + ddm_o.opt("Walk slowly", 'W', "^W", true); + + ddm_o.display(); } void Dropdown::ddm__people() { - byte here; - char fv; - - people = ""; - here = _vm->_gyro->dna.room; - - { - ddm_o.start_afresh(); - for (fv = '\226'; fv <= '\262'; fv ++) - if (_vm->_gyro->whereis[fv] == here) { - ddm_o.opt(_vm->_gyro->getname(fv), _vm->_gyro->getnamechar(fv), "", true); - people = people + fv; - } - ddm_o.display(); - } + if (!people.empty()) + people.clear(); + byte here = _vm->_gyro->dna.room; + + ddm_o.start_afresh(); + + for (byte fv = 150; fv <= 178; fv++) + if (_vm->_gyro->whereis[fv - 150] == here) { + ddm_o.opt(_vm->_gyro->getname(fv), _vm->_gyro->getnamechar(fv), "", true); + people = people + fv; + } + + ddm_o.display(); } void Dropdown::ddm__objects() { - char fv; - { - ddm_o.start_afresh(); - for (fv = '\1'; fv <= numobjs; fv ++) - if (_vm->_gyro->dna.obj[fv]) - ddm_o.opt(_vm->_gyro->get_thing(fv), _vm->_gyro->get_thingchar(fv), "", true); - ddm_o.display(); - } + ddm_o.start_afresh(); + for (byte fv = 0; fv < numobjs; fv++) + if (_vm->_gyro->dna.obj[fv]) + ddm_o.opt(_vm->_gyro->get_thing(fv + 1), _vm->_gyro->get_thingchar(fv + 1), "", true); + ddm_o.display(); } -Common::String Dropdown::himher(char x) { /* Returns "im" for boys, and "er" for girls.*/ +Common::String Dropdown::himher(byte x) { if (x < 175) return "im"; else @@ -462,7 +547,63 @@ Common::String Dropdown::himher(char x) { /* Returns "im" for boys, and } void Dropdown::ddm__with() { - warning("STUB: Dropdown::ddm__with()"); + byte fv; + Common::String verb; + char vbchar; + bool n; + + ddm_o.start_afresh(); + + if (_vm->_gyro->thinkthing) { + find_what_you_can_do_with_it(); + + for (fv = 0; fv < _vm->_gyro->verbstr.size(); fv++) { + _vm->_acci->verbopt(_vm->_gyro->verbstr[fv], verb, vbchar); + ddm_o.opt(verb, vbchar, "", true); + } + + // We disable the "give" option if: (a), you haven't selected anybody, (b), the person you've selected isn't in the room, or (c), the person you've selected is YOU! + + if ((_vm->_gyro->last_person != _vm->_gyro->pavalot) || (_vm->_gyro->last_person != _vm->_acci->nowt) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 1] != _vm->_gyro->dna.room)) + ddm_o.opt("Give to...", 'G', "", false); /* Not here. */ + else { + ddm_o.opt(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_give; + } + } else { + ddm_o.opt("Examine", 'x', "", true); + ddm_o.opt(Common::String("Talk to h") + himher(_vm->_gyro->thinks), 'T', "", true); + _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_talk; + switch (_vm->_gyro->thinks) { + case _vm->_gyro->pgeida: + case _vm->_gyro->parkata: { + ddm_o.opt("Kiss her", 'K', "", true); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_kiss; + } + break; + case _vm->_gyro->pdogfood: { + ddm_o.opt("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_play; + } + break; + case _vm->_gyro->pmalagauche: { + n = !_vm->_gyro->dna.teetotal; + ddm_o.opt("Buy some wine", 'w', "", !_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]); + ddm_o.opt("Buy some beer", 'b', "", n); + ddm_o.opt("Buy some whisky", 'h', "", n); + ddm_o.opt("Buy some cider", 'c', "", n); + ddm_o.opt("Buy some mead", 'm', "", n); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\145' + '\144' + '\146' + '\147' + '\150'; + } + break; + case _vm->_gyro->ptrader: { + ddm_o.opt("Buy an onion", 'o', "", !_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\151'; + } + break; + } + } + ddm_o.display(); } /*funcedure ddm__map; @@ -519,12 +660,14 @@ void Dropdown::do__file() { _vm->_lucerna->callverb(_vm->_acci->vb_restart); break; case 1: { - _vm->_acci->realwords[2] = ""; + if (!_vm->_acci->realwords[1].empty()) + _vm->_acci->realwords[1].clear(); _vm->_lucerna->callverb(_vm->_acci->vb_load); } break; case 2: { - _vm->_acci->realwords[2] = ""; + if (!_vm->_acci->realwords[1].empty()) + _vm->_acci->realwords[1].clear(); _vm->_lucerna->callverb(_vm->_acci->vb_save); } break; @@ -548,7 +691,7 @@ void Dropdown::do__action() { _vm->_acci->person = _vm->_acci->pardon; _vm->_acci->thing = _vm->_acci->pardon; n = _vm->_gyro->f5_does(); - _vm->_lucerna->callverb(n[1]); + _vm->_lucerna->callverb(n[0]); } break; case 1: @@ -564,8 +707,10 @@ void Dropdown::do__action() { _vm->_lucerna->callverb(_vm->_acci->vb_inv); break; case 5: { - if (_vm->_trip->tr[1].xs == _vm->_gyro->walk) _vm->_trip->tr[1].xs = _vm->_gyro->run; - else _vm->_trip->tr[1].xs = _vm->_gyro->walk; + if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) + _vm->_trip->tr[0].xs = _vm->_gyro->run; + else + _vm->_trip->tr[0].xs = _vm->_gyro->walk; _vm->_trip->newspeed(); } break; @@ -577,8 +722,8 @@ void Dropdown::do__objects() { } void Dropdown::do__people() { - _vm->_lucerna->thinkabout(people[ddm_o.choicenum + 1], _vm->_gyro->a_person); - _vm->_gyro->last_person = people[ddm_o.choicenum + 1]; + _vm->_lucerna->thinkabout(people[ddm_o.choicenum], _vm->_gyro->a_person); + _vm->_gyro->last_person = people[ddm_o.choicenum]; } void Dropdown::do__with() { @@ -588,72 +733,73 @@ void Dropdown::do__with() { _vm->_acci->thing += 49; - if (_vm->_gyro->verbstr[ddm_o.choicenum + 1] == _vm->_acci->vb_give) + if (_vm->_gyro->verbstr[ddm_o.choicenum] == _vm->_acci->vb_give) _vm->_acci->person = _vm->_gyro->last_person; else - _vm->_acci->person = '\376'; + _vm->_acci->person = 254; } else { - switch (_vm->_gyro->verbstr[ddm_o.choicenum + 1]) { - case '\144': { - _vm->_acci->thing = '\144'; + switch (_vm->_gyro->verbstr[ddm_o.choicenum]) { + case 100: { // Beer + _vm->_acci->thing = 100; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Beer */ - case '\145': { - _vm->_acci->thing = '\62'; + break; + case 101: { // Wine + _vm->_acci->thing = 50; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Wine */ - case '\146': { - _vm->_acci->thing = '\146'; + break; + case 102: { // Whisky + _vm->_acci->thing = 102; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Whisky */ - case '\147': { - _vm->_acci->thing = '\147'; + break; + case 103: { // Cider + _vm->_acci->thing = 103; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Cider */ - case '\150': { - _vm->_acci->thing = '\153'; + break; + case 104: { // Mead + _vm->_acci->thing = 107; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Mead */ - case '\151': { - _vm->_acci->thing = '\103'; + break; + case 105: { // Onion (trader) + _vm->_acci->thing = 67; _vm->_lucerna->callverb(_vm->_acci->vb_buy); return; } - break; /* Onion (trader) */ + break; default: { _vm->_acci->person = _vm->_acci->thing; - _vm->_acci->thing = '\376'; + _vm->_acci->thing = 254; } } } - _vm->_lucerna->callverb(_vm->_gyro->verbstr[ddm_o.choicenum + 1]); + _vm->_lucerna->callverb(_vm->_gyro->verbstr[ddm_o.choicenum]); } -/*$F- That's all. Now for the ...bar funcs. */ +// That's all. Now for the ...bar funcs. + void Dropdown::standard_bar() { /* Standard menu bar */ ddm_m.init(this); ddm_o.init(this); /* Set up menus */ - ddm_m.create('F', "File", '!', &Avalanche::Dropdown::ddm__file, &Avalanche::Dropdown::do__file); /* same ones in map_bar, below, */ - ddm_m.create('G', "Game", '\42', &Avalanche::Dropdown::ddm__game, &Avalanche::Dropdown::do__game); /* Don't forget to change the */ - ddm_m.create('A', "Action", '\36', &Avalanche::Dropdown::ddm__action, &Avalanche::Dropdown::do__action); /* if you change them */ - ddm_m.create('O', "Objects", '\30', &Avalanche::Dropdown::ddm__objects, &Avalanche::Dropdown::do__objects); /* here... */ - ddm_m.create('P', "People", '\31', &Avalanche::Dropdown::ddm__people, &Avalanche::Dropdown::do__people); - ddm_m.create('W', "With", '\21', &Avalanche::Dropdown::ddm__with, &Avalanche::Dropdown::do__with); + ddm_m.create('F', "File", '!', &Avalanche::Dropdown::ddm__file, &Avalanche::Dropdown::do__file); // same ones in map_bar, below, + ddm_m.create('G', "Game", 34, &Avalanche::Dropdown::ddm__game, &Avalanche::Dropdown::do__game); // Don't forget to change the + ddm_m.create('A', "Action", 30, &Avalanche::Dropdown::ddm__action, &Avalanche::Dropdown::do__action); // if you change them + ddm_m.create('O', "Objects", 24, &Avalanche::Dropdown::ddm__objects, &Avalanche::Dropdown::do__objects); // here... + ddm_m.create('P', "People", 25, &Avalanche::Dropdown::ddm__people, &Avalanche::Dropdown::do__people); + ddm_m.create('W', "With", 17, &Avalanche::Dropdown::ddm__with, &Avalanche::Dropdown::do__with); ddm_m.update(); } @@ -673,56 +819,32 @@ begin; end; end;*/ -void Dropdown::checkclick() { /* only for when the menu's displayed */ - if (_vm->_gyro->mpress > 0) { - if (_vm->_gyro->mpy > 10) { - if (!((ddm_o.firstlix) && - ((_vm->_gyro->mpx >= ddm_o.flx1 * 8) && (_vm->_gyro->mpx <= ddm_o.flx2 * 8) && - (_vm->_gyro->mpy >= 12) && (_vm->_gyro->mpy <= ddm_o.fly)))) { - /* Clicked OUTSIDE the menu. */ - if (ddm_o.menunow) - ddm_o.wipe(); - } /* No "else"- clicking on menu has no effect (only releasing) */ - } else { - /* Clicked on menu bar */ - ddm_m.getmenu(_vm->_gyro->mpx); - } - } else { - ; /* NOT clicked button... */ - if (_vm->_gyro->mrelease > 0) { - if ((ddm_o.firstlix) && - ((_vm->_gyro->mrx >= ddm_o.flx1 * 8) && (_vm->_gyro->mrx <= ddm_o.flx2 * 8) && - (_vm->_gyro->mry >= 12) && (_vm->_gyro->mry <= ddm_o.fly))) - ddm_o.select((_vm->_gyro->mry - 13) / 10); - } - } +void Dropdown::checkclick(Common::Point cursorPos) { + warning("STUB: Lucerna::checkclick()"); } void Dropdown::menu_link() { - if (! ddm_o.menunow) return; - - _vm->_gyro->check(); /* find mouse coords & click information */ - checkclick(); /* work out click codes */ + if (!ddm_o.menunow) + return; - /* Change arrow... */ + Common::Point cursorPos = _vm->getMousePos(); + checkclick(cursorPos); // Work out click codes. - - if ((_vm->_gyro->my >= 0) && (_vm->_gyro->my <= 10)) - _vm->_gyro->newpointer(1); /* up-arrow */ - else if ((_vm->_gyro->my >= 11) && (_vm->_gyro->my <= 169)) { - if ((_vm->_gyro->mx >= ddm_o.flx1 * 8) && (_vm->_gyro->mx <= ddm_o.flx2 * 8) - && (_vm->_gyro->my > 10) && (_vm->_gyro->my <= ddm_o.fly)) - _vm->_gyro->newpointer(3); /* right-arrow */ + // Change arrow... + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) + _vm->_gyro->newpointer(1); // Up arrow + else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { + if ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= ddm_o.fly * 2 + 1)) + _vm->_gyro->newpointer(3); // Right-arrow else - _vm->_gyro->newpointer(4); /* fletch */ - } else if ((_vm->_gyro->my >= 169) && (_vm->_gyro->my <= 200)) - _vm->_gyro->newpointer(2); /* screwdriver */ + _vm->_gyro->newpointer(4); // Fletch + } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) + _vm->_gyro->newpointer(2); // Screwdriver - if (! ddm_o.menunow) + if (!ddm_o.menunow) return; - ddm_o.lightup(); + ddm_o.lightup(cursorPos); } - } // End of namespace Avalanche. diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 51be377bebc1..73325a30bc91 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -63,7 +63,7 @@ class headtype { struct optiontype { Common::String title; - char trigger; + byte trigger; Common::String shortcut; bool valid; }; @@ -81,12 +81,12 @@ class onemenu { byte choicenum; /* Your choice? */ byte highlightnum; - onemenu *init(Dropdown *dr); + void init(Dropdown *dr); void start_afresh(); void opt(Common::String n, char tr, Common::String key, bool val); void display(); void wipe(); - void lightup(); + void lightup(Common::Point cursorPos); // This makes the menu highlight follow the mouse. void displayopt(byte y, bool highlit); void movehighlight(int8 add); void select(byte n); @@ -103,7 +103,7 @@ class menuset { headtype ddms[8]; byte howmany; - menuset *menuset::init(Dropdown *dr); + void init(Dropdown *dr); void create(char t, Common::String n, char alttrig, func dw, func dc); void update(); void extd(char c); @@ -140,30 +140,17 @@ class Dropdown { void standard_bar(); private: - - - - - - AvalancheEngine *_vm; - static const int16 indent = 5; - static const int16 spacing = 10; + static const byte indent = 5; + static const byte spacing = 10; - /* menu_b = blue; { Morpheus } - menu_f = yellow; - menu_border = black; - highlight_b = lightblue; - highlight_f = yellow; - disabled = lightgray; */ - - static const int16 menu_b = lightgray; /* Windowsy */ - static const int16 menu_f = black; - static const int16 menu_border = black; - static const int16 highlight_b = black; - static const int16 highlight_f = white; - static const int16 disabled = darkgray; + static const byte menu_b = lightgray; /* Windowsy */ + static const byte menu_f = black; + static const byte menu_border = black; + static const byte highlight_b = black; + static const byte highlight_f = white; + static const byte disabled = darkgray; @@ -174,13 +161,12 @@ class Dropdown { void chalk(int16 x, int16 y, char t, Common::String z, bool valid); - void hlchalk(int16 x, int16 y, char t, Common::String z, bool valid); + void hlchalk(int16 x, int16 y, char t, Common::String z, bool valid); // Highlighted. TODO: It's too similar to chalk! Unify these two!!! void bleep(); - void ddm__game(); void ddm__file(); void ddm__action(); @@ -188,7 +174,7 @@ class Dropdown { void ddm__objects(); void ddm__with(); - Common::String himher(char x); + Common::String himher(byte x); // Returns "im" for boys, and "er" for girls. void do__game(); void do__file(); @@ -197,7 +183,7 @@ class Dropdown { void do__people(); void do__with(); - void checkclick(); + void checkclick(Common::Point cursorPos); // Only for when the menu's displayed! }; } // End of namespace Avalanche. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ca287721560e..4c1af54096bc 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -76,6 +76,8 @@ class Graphics { ::Graphics::Surface _scrolls; + ::Graphics::Surface _dropdown; + Graphics(AvalancheEngine *vm); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index f689142bf004..cfbfd32650e0 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -413,13 +413,11 @@ Common::String Gyro::getname(byte whose) { } // Keep an eye open! ^ -char Gyro::getnamechar(byte whose) { - char getnamechar_result; - if (whose < 16) - getnamechar_result = ladchar[whose]; +byte Gyro::getnamechar(byte whose) { + if (whose < 175) + return ladchar[whose - 150]; else - getnamechar_result = lasschar[whose-16]; - return getnamechar_result; + return lasschar[whose - 175]; } // Keep an eye open! ^^ @@ -430,7 +428,7 @@ Common::String Gyro::get_thing(byte which) { switch (dna.winestate) { case 1: case 4: - get_thing_result = things[which]; + get_thing_result = things[which - 1]; break; case 3: get_thing_result = "Vinegar"; @@ -441,10 +439,10 @@ Common::String Gyro::get_thing(byte which) { if (dna.rotten_onion) get_thing_result = "rotten onion"; else - get_thing_result = things[which]; + get_thing_result = things[which - 1]; break; default: - get_thing_result = things[which]; + get_thing_result = things[which - 1]; } return get_thing_result; } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index a7ad6b60473e..d75ac15e193a 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -644,7 +644,7 @@ class Gyro { Common::String getname(byte whose); - char getnamechar(byte whose); + byte getnamechar(byte whose); Common::String get_thing(byte which); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 036ae4e2c376..e07e428acf5d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -946,8 +946,8 @@ void Lucerna::points(byte num) { /* Add on no. of points */ showscore(); } -void Lucerna::topcheck() { - _vm->_dropdown->ddm_m.getmenu(_vm->_gyro->mpx); +void Lucerna::topcheck(Common::Point cursorPos) { + _vm->_dropdown->ddm_m.getmenu(cursorPos.x); } void Lucerna::mouseway(const Common::Point &cursorPos) { @@ -1084,8 +1084,6 @@ void Lucerna::verte(Common::Point cursorPos) { } void Lucerna::checkclick() { - bytefield b; - Common::Point cursorPos = _vm->getMousePos(); _vm->_gyro->ontoolbar = _vm->_gyro->slow_computer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); @@ -1107,9 +1105,9 @@ void Lucerna::checkclick() { } if (holdLeftMouse) - if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Clink on the dropdown menu. + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->dropsok) - topcheck(); + topcheck(cursorPos); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 451bd7379333..8c497212b445 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -152,7 +152,7 @@ class Lucerna { void put_geida_at(byte whichped, byte &ped); - void topcheck(); + void topcheck(Common::Point cursorPos); void verte(Common::Point cursorPos); From 5720fa1dba82063409472fad41c0c269f9cb2b49 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 2 Sep 2013 01:11:16 +0200 Subject: [PATCH 0708/1332] AVALANCHE: Implement drop-down menu. (Only with mouse control yet.) --- engines/avalanche/dropdown2.cpp | 99 +++++++++++++++++++++++++-------- engines/avalanche/graphics.h | 2 - engines/avalanche/lucerna2.cpp | 4 +- 3 files changed, 77 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 4565c2faeb5d..e7db8750aa40 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -170,8 +170,7 @@ void onemenu::wipe() { //setactivepage(cp); CursorMan.showMouse(false); - _dr->chalk(_dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].xpos, 1, _dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].trigger, _dr->ddm_m.ddms[_dr->ddm_o.menunum - 1].title, true); - + _dr->chalk(_dr->ddm_m.ddms[_dr->ddm_o.menunum].xpos, 1, _dr->ddm_m.ddms[_dr->ddm_o.menunum].trigger, _dr->ddm_m.ddms[_dr->ddm_o.menunum].title, true); /*mblit(flx1, 11, flx2 + 1, fly + 1, 3, cp); blitfix();*/ @@ -353,8 +352,11 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { fontType font; for (byte fv = 0; fv < z.size(); fv++) - for (byte ff = 0; ff < 8; ff++) + for (byte ff = 0; ff < 8; ff++) { font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; + for (byte i = 0; i < 8; i++) + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = lightgray; + } _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black); @@ -495,7 +497,8 @@ void Dropdown::ddm__action() { Common::String n = _vm->_gyro->f5_does(); for (byte i = 0; i < 2; i++) - n.deleteChar(0); + if (!n.empty()) + n.deleteChar(0); if (n.empty()) ddm_o.opt("Do something", 'D', "f5", false); else @@ -820,31 +823,79 @@ begin; end;*/ void Dropdown::checkclick(Common::Point cursorPos) { - warning("STUB: Lucerna::checkclick()"); + warning("STUB: Dropdown::checkclick()"); } -void Dropdown::menu_link() { - if (!ddm_o.menunow) - return; - +void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... Common::Point cursorPos = _vm->getMousePos(); - checkclick(cursorPos); // Work out click codes. - - // Change arrow... - if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newpointer(1); // Up arrow - else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { - if ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= ddm_o.fly * 2 + 1)) - _vm->_gyro->newpointer(3); // Right-arrow - else - _vm->_gyro->newpointer(4); // Fletch - } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newpointer(2); // Screwdriver + ::Graphics::Surface backup; + backup.copyFrom(_vm->_graphics->_surface); + + while (!ddm_o.menunow && (cursorPos.y <= 21) && _vm->_lucerna->holdLeftMouse) { + ddm_m.getmenu(cursorPos.x); + do + _vm->updateEvents(); + while (_vm->_lucerna->holdLeftMouse); + - if (!ddm_o.menunow) - return; + while (!_vm->shouldQuit()) { + do { + _vm->updateEvents(); + + cursorPos = _vm->getMousePos(); + // Change arrow... + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) + _vm->_gyro->newpointer(1); // Up arrow + else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { + if ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= ddm_o.fly * 2 + 1)) + _vm->_gyro->newpointer(3); // Right-arrow + else + _vm->_gyro->newpointer(4); // Fletch + } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) + _vm->_gyro->newpointer(2); // Screwdriver + + ddm_o.lightup(cursorPos); + + _vm->_graphics->refreshScreen(); + } while (!_vm->_lucerna->holdLeftMouse); + + if (_vm->_lucerna->holdLeftMouse) { + if (cursorPos.y > 21) { + if (!((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) + && (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) { // Clicked OUTSIDE the menu. + if (ddm_o.menunow) { + ddm_o.wipe(); + _vm->_lucerna->holdLeftMouse = false; + return; + } // No "else"- clicking on menu has no effect (only releasing). + } + } else { + // Clicked on menu bar. + if (ddm_o.menunow) { + ddm_o.wipe(); + _vm->_lucerna->holdLeftMouse = true; + _vm->_graphics->_surface.copyFrom(backup); + _vm->_graphics->refreshScreen(); + break; + } + } + + // NOT clicked button... + if ((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) + && (cursorPos.y >= 12) && (cursorPos.y <= (ddm_o.fly * 2 + 1)))) { + do { + _vm->updateEvents(); + _vm->_graphics->refreshScreen(); + } while (_vm->_lucerna->holdLeftMouse); + uint16 which = (cursorPos.y - 26) / 20; + ddm_o.select(which); + if (ddm_o.oo[which].valid) + return; + } + } - ddm_o.lightup(cursorPos); + } + } } } // End of namespace Avalanche. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 4c1af54096bc..ca287721560e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -76,8 +76,6 @@ class Graphics { ::Graphics::Surface _scrolls; - ::Graphics::Surface _dropdown; - Graphics(AvalancheEngine *vm); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e07e428acf5d..eda1a8e1a517 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1103,11 +1103,11 @@ void Lucerna::checkclick() { } else _vm->_gyro->newpointer(4); // fletch } - + if (holdLeftMouse) if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->dropsok) - topcheck(cursorPos); + _vm->_dropdown->menu_link(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) From cf5f150d9b4d00ee16b0ee51861a4386b35f9626 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 2 Sep 2013 12:53:01 +0200 Subject: [PATCH 0709/1332] AVALANCHE: Upgrade the drop-down menu. --- engines/avalanche/dropdown2.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index e7db8750aa40..4647f5947ad8 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -842,6 +842,7 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... do { _vm->updateEvents(); + // We updadte the cursor's picture. cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) @@ -883,13 +884,22 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... // NOT clicked button... if ((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y >= 12) && (cursorPos.y <= (ddm_o.fly * 2 + 1)))) { - do { - _vm->updateEvents(); + + // We act only if the button is relased over a menu item. + Common::Event event; + while (!_vm->shouldQuit()) { + cursorPos = _vm->getMousePos(); + ddm_o.lightup(cursorPos); _vm->_graphics->refreshScreen(); - } while (_vm->_lucerna->holdLeftMouse); + + _vm->updateEvents(); + if (!_vm->_lucerna->holdLeftMouse) + break; + } + uint16 which = (cursorPos.y - 26) / 20; ddm_o.select(which); - if (ddm_o.oo[which].valid) + if (ddm_o.oo[which].valid) // If the menu item wasn't active, we do nothing. return; } } From 9e848e8e64103406a7e356081f18d9c597b0018d Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 2 Sep 2013 15:44:55 +0200 Subject: [PATCH 0710/1332] AVALANCHE: Upgrade drop-down menu. (Now it's complete.) Fix Trip::neardoor(). --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/dropdown2.cpp | 15 +++++++++++---- engines/avalanche/trip6.cpp | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 0c5869efbe38..73b39d64074f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -532,7 +532,7 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::checkclick(). + _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). break; case Common::EVENT_LBUTTONUP: _lucerna->holdLeftMouse = false; // Same as above. diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 4647f5947ad8..baf1e94edf6e 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -863,7 +863,8 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... if (_vm->_lucerna->holdLeftMouse) { if (cursorPos.y > 21) { if (!((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) - && (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) { // Clicked OUTSIDE the menu. + && (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) { + // Clicked OUTSIDE the menu. if (ddm_o.menunow) { ddm_o.wipe(); _vm->_lucerna->holdLeftMouse = false; @@ -874,9 +875,16 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... // Clicked on menu bar. if (ddm_o.menunow) { ddm_o.wipe(); - _vm->_lucerna->holdLeftMouse = true; _vm->_graphics->_surface.copyFrom(backup); _vm->_graphics->refreshScreen(); + _vm->_lucerna->holdLeftMouse = true; + + if (((ddm_o.left * 8) <= cursorPos.x) && (cursorPos.x <= (ddm_o.left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. + // If we clicked on the same menu item on the bar... + _vm->_lucerna->holdLeftMouse = false; + return; + } + break; } } @@ -885,8 +893,7 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... if ((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y >= 12) && (cursorPos.y <= (ddm_o.fly * 2 + 1)))) { - // We act only if the button is relased over a menu item. - Common::Event event; + // We act only if the button is released over a menu item. while (!_vm->shouldQuit()) { cursorPos = _vm->getMousePos(); ddm_o.lightup(cursorPos); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f83bfc07b998..5e42839e93fa 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1573,7 +1573,7 @@ bool Trip::infield(byte which) { } bool Trip::neardoor() { - if (_vm->_gyro->numfields < 9) { + if (_vm->_gyro->numfields < 8) { /* there ARE no doors here! */ return false; } @@ -1581,7 +1581,7 @@ bool Trip::neardoor() { int16 ux = tr[0].x; int16 uy = tr[0].y + tr[0]._info.yl; bool nd = false; - for (byte fv = 9; fv <= _vm->_gyro->numfields; fv++) + for (byte fv = 8; fv < _vm->_gyro->numfields; fv++) if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2) && (uy >= _vm->_gyro->fields[fv].y1) && (uy <= _vm->_gyro->fields[fv].y2)) nd = true; From 9b7f138659e5b9b3772c578bb70d9d4a01153098 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 2 Sep 2013 20:09:44 +0200 Subject: [PATCH 0711/1332] AVALANCHE: Repair drop-down menu, so the already implemented functions are working. --- engines/avalanche/dropdown2.cpp | 14 ++++++++------ engines/avalanche/gyro2.cpp | 4 ++-- engines/avalanche/gyro2.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index baf1e94edf6e..d0cd50515e1e 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -536,9 +536,10 @@ void Dropdown::ddm__people() { void Dropdown::ddm__objects() { ddm_o.start_afresh(); - for (byte fv = 0; fv < numobjs; fv++) + for (byte fv = 0; fv < numobjs; fv++) { if (_vm->_gyro->dna.obj[fv]) ddm_o.opt(_vm->_gyro->get_thing(fv + 1), _vm->_gyro->get_thingchar(fv + 1), "", true); + } ddm_o.display(); } @@ -567,7 +568,7 @@ void Dropdown::ddm__with() { // We disable the "give" option if: (a), you haven't selected anybody, (b), the person you've selected isn't in the room, or (c), the person you've selected is YOU! - if ((_vm->_gyro->last_person != _vm->_gyro->pavalot) || (_vm->_gyro->last_person != _vm->_acci->nowt) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 1] != _vm->_gyro->dna.room)) + if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->nowt) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) ddm_o.opt("Give to...", 'G', "", false); /* Not here. */ else { ddm_o.opt(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); @@ -782,6 +783,7 @@ void Dropdown::do__with() { default: { _vm->_acci->person = _vm->_acci->thing; _vm->_acci->thing = 254; + _vm->_gyro->subjnumber = 0; } } } @@ -877,15 +879,15 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... ddm_o.wipe(); _vm->_graphics->_surface.copyFrom(backup); _vm->_graphics->refreshScreen(); - _vm->_lucerna->holdLeftMouse = true; if (((ddm_o.left * 8) <= cursorPos.x) && (cursorPos.x <= (ddm_o.left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. - // If we clicked on the same menu item on the bar... + // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_lucerna->holdLeftMouse = false; return; + } else { + _vm->_lucerna->holdLeftMouse = true; + break; } - - break; } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index cfbfd32650e0..aab8c8294f01 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -455,10 +455,10 @@ char Gyro::get_thingchar(byte which) { if (dna.winestate == 3) get_thingchar_result = 'V'; /* Vinegar */ else - get_thingchar_result = thingchar[which]; + get_thingchar_result = thingchar[which - 1]; break; default: - get_thingchar_result = thingchar[which]; + get_thingchar_result = thingchar[which - 1]; } return get_thingchar_result; } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index d75ac15e193a..967034a7ed24 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -580,7 +580,7 @@ class Gyro { Common::File demofile; // of demo_type Common::DumpFile demofile_save; // uruk added it - first use located in constructor of Basher - char last_person; /* Last person to have been selected using the People + byte last_person; /* Last person to have been selected using the People menu. */ bool doing_sprite_run; /* Only set to True if we're doing a sprite_run From bb77333d4f4025b053ad311092ad0390368522ea Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 01:49:01 -0500 Subject: [PATCH 0712/1332] ZVISION: Create console method for parsing ALL .scr files Useful for putting a breakpoint at certain ResultActions/Controls to test out different instances of them. --- engines/zvision/console.cpp | 12 ++++++++++++ engines/zvision/console.h | 1 + engines/zvision/script_manager.h | 3 +++ 3 files changed, 16 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index fd8347e74fe9..8b4dffa98a08 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -54,6 +54,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("dumpcursorfilenames", WRAP_METHOD(Console, cmdDumpAllCursorFileNames)); DCmd_Register("showcursor", WRAP_METHOD(Console, cmdShowCursor)); DCmd_Register("dumpalllevfiles", WRAP_METHOD(Console, cmdDumpAllLevFiles)); + DCmd_Register("parseallscrfiles", WRAP_METHOD(Console, cmdParseAllScrFiles)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -225,4 +226,15 @@ bool Console::cmdDumpAllLevFiles(int argc, const char **argv) { return true; } +bool Console::cmdParseAllScrFiles(int argc, const char **argv) { + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.scr"); + + for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { + _engine->getScriptManager()->parseScrFile((*iter)->getName()); + } + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index e518467438de..612e5eec00a1 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -50,6 +50,7 @@ class Console : public GUI::Debugger { bool cmdDumpAllCursorFileNames(int argc, const char **argv); bool cmdShowCursor(int argc, const char **argv); bool cmdDumpAllLevFiles(int argc, const char **argv); + bool cmdParseAllScrFiles(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 9b4763764f9a..1a272f197083 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -117,6 +117,8 @@ class ScriptManager { void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); +// TODO: Make this private. It was only made public so Console::cmdParseAllScrFiles() could use it +public: /** * Parses a script file into triggers and events * @@ -125,6 +127,7 @@ class ScriptManager { */ void parseScrFile(const Common::String &fileName, bool isGlobal = false); +private: /** * Parses the stream into a Puzzle object * Helper method for parseScrFile. From a81c9a52a34cba1ecf358d612ddbcd6e517a2830 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 01:52:37 -0500 Subject: [PATCH 0713/1332] ZVISION: Fix LeverControl 'mirrored' support --- engines/zvision/lever_control.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index d515f9e78419..7d23b687688f 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -322,8 +322,13 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm } void LeverControl::renderFrame(uint frameNumber) { - if (frameNumber < _lastRenderedFrame && _mirrored) { - frameNumber = (_frameCount * 2) - 1 - frameNumber; + if (frameNumber == 0) { + _lastRenderedFrame = frameNumber; + } else if (frameNumber < _lastRenderedFrame && _mirrored) { + _lastRenderedFrame = frameNumber; + frameNumber = (_frameCount * 2) - frameNumber - 1; + } else { + _lastRenderedFrame = frameNumber; } const uint16 *frameData; @@ -342,14 +347,13 @@ void LeverControl::renderFrame(uint frameNumber) { } else if (_fileType == AVI) { _animation.avi->seekToFrame(frameNumber); const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); - frameData = (const uint16 *)surface->getBasePtr(0, 0); + frameData = (const uint16 *)surface->getPixels(); pitch = surface->pitch; width = surface->w; height = surface->h; } _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); - _lastRenderedFrame = frameNumber; } } // End of namespace ZVision From c15454d7d4a8b670f6e71f035f5b8439166e71e1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 01:56:23 -0500 Subject: [PATCH 0714/1332] ZVISION: Keep a Graphics::Surface of the current background instead of re-reading the file each time This is both more efficient and is part of the process of converting the entire game to RBG 565 --- engines/zvision/render_manager.cpp | 128 +++++++++++++++++------------ engines/zvision/render_manager.h | 10 ++- 2 files changed, 82 insertions(+), 56 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index fa45a6f5767a..99c987f7dd47 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -42,7 +42,6 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, _screenCenterY(_workingHeight / 2), _workingWindow(workingWindow), _pixelFormat(pixelFormat), - _currentBackground(0), _backgroundWidth(0), _backgroundHeight(0), _backgroundInverseVelocity(0), @@ -54,10 +53,6 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, } RenderManager::~RenderManager() { - if (_currentBackground != 0) { - delete _currentBackground; - } - delete[] _workingWindowBuffer; } @@ -89,7 +84,7 @@ void RenderManager::clearWorkingWindowToColor(uint16 color) { _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), _workingWindow.left, _workingWindow.top, _workingWidth, _workingHeight); } -void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap, bool isTransposed) { +void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap) { int16 subRectX = 0; int16 subRectY = 0; @@ -143,13 +138,24 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (_renderTable.getRenderState() == RenderTable::FLAT) { _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); } else { - _renderTable.mutateImage((uint16 *)surface.getBasePtr(0, 0), _workingWindowBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap, isTransposed); + _renderTable.mutateImage((uint16 *)surface.getPixels(), _workingWindowBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap); _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); } } void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { + Graphics::Surface surface; + readImageToSurface(fileName, surface); + + renderSubRectToScreen(surface, destinationX, destinationY, wrap); +} + +void RenderManager::renderImageToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap) { + renderSubRectToScreen(surface, destinationX, destinationY, wrap); +} + +void RenderManager::readImageToSurface(const Common::String &fileName, Graphics::Surface &destination) { Common::File file; if (!file.open(fileName)) { @@ -157,62 +163,85 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, int16 de return; } - renderImageToScreen(file, destinationX, destinationY); -} - -void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, int16 destinationX, int16 destinationY, bool wrap) { // Read the magic number // Some files are true TGA, while others are TGZ - uint32 fileType = stream.readUint32BE(); + uint32 fileType = file.readUint32BE(); + + uint32 imageWidth; + uint32 imageHeight; + Graphics::TGADecoder tga; + uint16 *buffer; + bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; + // All ZVision images are in RGB 555 + Graphics::PixelFormat pixelFormat555 = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + destination.format = pixelFormat555; + + bool isTGZ; // Check for TGZ files if (fileType == MKTAG('T', 'G', 'Z', '\0')) { + isTGZ = true; + // TGZ files have a header and then Bitmap data that is compressed with LZSS - uint32 decompressedSize = stream.readSint32LE(); - uint32 imageWidth = stream.readSint32LE(); - uint32 imageHeight = stream.readSint32LE(); + uint32 decompressedSize = file.readSint32LE(); + imageWidth = file.readSint32LE(); + imageHeight = file.readSint32LE(); - LzssReadStream lzssStream(&stream); - byte *buffer = new byte[decompressedSize]; + LzssReadStream lzssStream(&file); + buffer = (uint16 *)(new uint16[decompressedSize]); lzssStream.read(buffer, decompressedSize); - - uint32 pitch = imageWidth * sizeof(uint16); - bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; - - if (isTransposed) { - uint16 temp = imageHeight; - imageHeight = imageWidth; - imageWidth = temp; - } - - Graphics::Surface surface; - surface.init(imageWidth, imageHeight, pitch, buffer, _pixelFormat); - - renderSubRectToScreen(surface, destinationX, destinationY, wrap, isTransposed); - - // We have to use delete[] instead of calling surface.free() because we created the memory with new[] - delete[] buffer; } else { + isTGZ = false; + // Reset the cursor - stream.seek(0); + file.seek(0); // Decode - Graphics::TGADecoder tga; - if (!tga.loadStream(stream)) { + if (!tga.loadStream(file)) { warning("Error while reading TGA image"); return; } Graphics::Surface tgaSurface = *(tga.getSurface()); - bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; + imageWidth = tgaSurface.w; + imageHeight = tgaSurface.h; + + buffer = (uint16 *)tgaSurface.getPixels(); + } + + // Flip the width and height if transposed + if (isTransposed) { + uint16 temp = imageHeight; + imageHeight = imageWidth; + imageWidth = temp; + } + + // If the destination internal buffer is the same size as what we're copying into it, + // there is no need to free() and re-create + if (imageWidth != destination.w || imageHeight != destination.h) { + destination.create(imageWidth, imageHeight, pixelFormat555); + } - if (isTransposed) { - uint16 temp = tgaSurface.h; - tgaSurface.h = tgaSurface.w; - tgaSurface.w = temp; + // If transposed, 'un-transpose' the data while copying it to the destination + // Otherwise, just do a simple copy + if (isTransposed) { + uint16 *dest = (uint16 *)destination.getPixels(); + + for (uint32 y = 0; y < imageHeight; y++) { + uint32 columnIndex = y * imageWidth; + + for (uint32 x = 0; x < imageWidth; x++) { + dest[columnIndex + x] = buffer[x * imageHeight + y]; + } } + } else { + memcpy(destination.getPixels(), buffer, imageWidth * imageHeight * _pixelFormat.bytesPerPixel); + } - renderSubRectToScreen(tgaSurface, destinationX, destinationY, wrap, isTransposed); + // Cleanup + if (isTGZ) { + delete[] buffer; + } else { tga.destroy(); } } @@ -256,10 +285,7 @@ void RenderManager::setBackgroundImage(const Common::String &fileName) { return; } - if (_currentBackground != 0) { - delete _currentBackground; - } - _currentBackground = file; + readImageToSurface(fileName, _currentBackground); moveBackground(0); } @@ -291,8 +317,6 @@ void RenderManager::setBackgroundVelocity(int velocity) { } void RenderManager::moveBackground(int offset) { - _currentBackground->seek(0); - RenderTable::RenderState state = _renderTable.getRenderState(); if (state == RenderTable::TILT) { _backgroundOffset += Common::Point(0, offset); @@ -307,7 +331,7 @@ void RenderManager::moveBackground(int offset) { else if (_backgroundOffset.y >= _backgroundHeight) _backgroundOffset.y += _backgroundHeight; - renderImageToScreen(*_currentBackground, 0, _screenCenterY - _backgroundOffset.y, true); + renderImageToScreen(_currentBackground, 0, _screenCenterY - _backgroundOffset.y, true); } else if (state == RenderTable::PANORAMA) { _backgroundOffset += Common::Point(offset, 0); @@ -321,9 +345,9 @@ void RenderManager::moveBackground(int offset) { else if (_backgroundOffset.y >= _backgroundHeight) _backgroundOffset.y += _backgroundHeight; - renderImageToScreen(*_currentBackground, _screenCenterX - _backgroundOffset.x, 0, true); + renderImageToScreen(_currentBackground, _screenCenterX - _backgroundOffset.x, 0, true); } else { - renderImageToScreen(*_currentBackground, 0, 0); + renderImageToScreen(_currentBackground, 0, 0); } } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index d82e40fa4c49..41dedab792c9 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -74,7 +74,7 @@ class RenderManager { /** Used to warp the background image */ RenderTable _renderTable; - Common::SeekableReadStream *_currentBackground; + Graphics::Surface _currentBackground; /** The (x1,y1) coordinates of the subRectangle of the background that is currently displayed on the screen */ Common::Point _backgroundOffset; /** The width of the current background image */ @@ -123,11 +123,11 @@ class RenderManager { * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. * The image will be clipped to fit inside the working window. Coords are in working window space, not screen space! * - * @param stream Stream to read the image data from + * @param stream Surface to read the image data from * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! */ - void renderImageToScreen(Common::SeekableReadStream &stream, int16 destinationX, int16 destinationY, bool wrap = false); + void renderImageToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap = false); /** * Sets the current background image to be used by the RenderManager and immediately @@ -181,7 +181,9 @@ class RenderManager { * @param subRectangle A rectangle representing the part of the image that should be rendered * @param wrap Should the image wrap (tile) if it doesn't completely fill the screen? */ - void renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap, bool isTransposed); + void renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap); + + void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); void moveBackground(int offset); }; From 0271a2c59dd553b79cae95376b40654a70190089 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 01:58:12 -0500 Subject: [PATCH 0715/1332] ZVISION: Transpose is done in RenderManager::readImageToSurface(), so remove it from mutateImage --- engines/zvision/render_table.cpp | 8 ++------ engines/zvision/render_table.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 0a8175e54e21..ee3628299aff 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -98,7 +98,7 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed) { +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap) { for (int16 y = subRect.top; y < subRect.bottom; y++) { int16 normalizedY = y - subRect.top; int32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; @@ -135,11 +135,7 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); } - if (isTransposed) { - destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceXIndex * imageHeight + sourceYIndex]; - } else { - destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; - } + destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; } } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index bbf5e1b22ac0..e5820803cb94 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap, bool isTransposed); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap); void generateRenderTable(); void setPanoramaFoV(float fov); From 94378d064405992905a9ffcb24c72f0c86d51bd4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 01:59:13 -0500 Subject: [PATCH 0716/1332] ZVISION: Force comparison to be between signed ints and ensure CLIP happens on a signed int --- engines/zvision/render_table.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index ee3628299aff..55285b45e66c 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -62,9 +62,9 @@ void RenderTable::setRenderState(RenderState newState) { const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Point &point) { // If we're outside the range of the RenderTable, no warping is happening. Return the maximum image coords - if (point.x >= _numColumns || point.y >= _numRows) { - int16 x = CLIP(point.x, 0, _numColumns); - int16 y = CLIP(point.y, 0, _numRows); + if (point.x >= (int16)_numColumns || point.y >= (int16)_numRows || point.x < 0 || point.y , 0) { + int16 x = CLIP(point.x, 0, (int16)_numColumns); + int16 y = CLIP(point.y, 0, (int16)_numRows); return Common::Point(x, y); } From 07770eeafbf72fa4ffcee2f474b212d2a67ee234 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:01:04 -0500 Subject: [PATCH 0717/1332] ZVISION: Convert cursors to RBG 565 This is part of a series of commits converting all game assets to RBG 565 from RBG 555. The argument is that certain backends do not support RGB 555. --- engines/zvision/cursor.cpp | 31 ++++++++++--------------------- engines/zvision/cursor.h | 7 +++---- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp index 601c58fa2c3d..57859b9b4621 100644 --- a/engines/zvision/cursor.cpp +++ b/engines/zvision/cursor.cpp @@ -34,16 +34,14 @@ ZorkCursor::ZorkCursor() : _width(0), _height(0), _hotspotX(0), - _hotspotY(0), - _surface(0) { + _hotspotY(0) { } ZorkCursor::ZorkCursor(const Common::String &fileName) : _width(0), _height(0), _hotspotX(0), - _hotspotY(0), - _surface(0) { + _hotspotY(0) { Common::File file; if (!file.open(fileName)) return; @@ -59,10 +57,13 @@ ZorkCursor::ZorkCursor(const Common::String &fileName) _width = file.readUint16LE(); _height = file.readUint16LE(); - uint dataSize = _width * _height * 2; - _surface = new byte[dataSize]; - uint32 bytesRead = file.read(_surface, dataSize); + uint dataSize = _width * _height * sizeof(uint16); + _surface.create(_width, _height, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + uint32 bytesRead = file.read(_surface.getPixels(), dataSize); assert(bytesRead == dataSize); + + // Convert to RGB 565 + _surface.convertToInPlace(Graphics::PixelFormat(2, 5, 6, 6, 0, 11, 5, 0, 0)); } ZorkCursor::ZorkCursor(const ZorkCursor &other) { @@ -71,10 +72,7 @@ ZorkCursor::ZorkCursor(const ZorkCursor &other) { _hotspotX = other._hotspotX; _hotspotY = other._hotspotY; - uint dataSize = _width * _height * 2; - _surface = new byte[dataSize]; - - memcpy(_surface, other._surface, dataSize); + _surface.copyFrom(other._surface); } ZorkCursor &ZorkCursor::operator=(const ZorkCursor &other) { @@ -83,18 +81,9 @@ ZorkCursor &ZorkCursor::operator=(const ZorkCursor &other) { _hotspotX = other._hotspotX; _hotspotY = other._hotspotY; - uint dataSize = _width * _height * 2; - _surface = new byte[dataSize]; - - memcpy(_surface, other._surface, dataSize); + _surface.copyFrom(other._surface); return *this; } -ZorkCursor::~ZorkCursor() { - if (_surface != 0) { - delete[] _surface; - } -} - } // End of namespace ZVision diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index 9a561fcac303..ec9f5ed0d71f 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -25,7 +25,7 @@ #include "common/types.h" -#include "graphics/cursor.h" +#include "graphics/surface.h" namespace Common { class String; @@ -42,14 +42,13 @@ class ZorkCursor { ZorkCursor(); ZorkCursor(const Common::String &fileName); ZorkCursor(const ZorkCursor &other); - ~ZorkCursor(); private: uint16 _width; uint16 _height; uint16 _hotspotX; uint16 _hotspotY; - byte *_surface; + Graphics::Surface _surface; public: ZorkCursor &operator=(const ZorkCursor &other); @@ -59,7 +58,7 @@ class ZorkCursor { uint16 getHotspotX() const { return _hotspotX; } uint16 getHotspotY() const { return _hotspotY; } byte getKeyColor() const { return 0; } - const byte *getSurface() const { return _surface; } + const byte *getSurface() const { return (const byte *)_surface.getPixels(); } }; } // End of namespace ZVision From f146a0209fdc3bf0dd5e26dbca8b5257b6ee7c0e Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:01:34 -0500 Subject: [PATCH 0718/1332] ZVISION: Convert image rendering to RBG 565 This is part of a series of commits converting all game assets to RBG 565 from RBG 555. The argument is that certain backends do not support RGB 555. --- engines/zvision/render_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 99c987f7dd47..b1282dc007a5 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -244,6 +244,9 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: } else { tga.destroy(); } + + // Convert in place to RGB 565 from RGB 555 + destination.convertToInPlace(_pixelFormat); } const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { From cdc484218186daa9a4f60792a2070ad089b7853e Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:01:57 -0500 Subject: [PATCH 0719/1332] ZVISION: Convert RLF animations to RBG 565 This is part of a series of commits converting all game assets to RBG 565 from RBG 555. The argument is that certain backends do not support RGB 555. --- engines/zvision/rlf_animation.cpp | 35 ++++++++++++++++++------------- engines/zvision/rlf_animation.h | 4 ++++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 90b39dc75736..df1fe118da4e 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -33,6 +33,9 @@ namespace ZVision { +const Graphics::PixelFormat RlfAnimation::_pixelFormat555 = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); +const Graphics::PixelFormat RlfAnimation::_pixelFormat565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) : _stream(stream), _lastFrameRead(0), @@ -41,8 +44,8 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) _height(0), _frameTime(0), _frames(0), - _currentFrameBuffer(0), _currentFrame(-1), + _currentFrameBuffer(0), _frameBufferByteSize(0) { if (!_file.open(fileName)) { warning("RLF animation file %s could not be opened", fileName.c_str()); @@ -68,12 +71,8 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) } RlfAnimation::~RlfAnimation() { - if (_frames != 0) { - delete[] _frames; - } - if (_currentFrameBuffer != 0) { - delete[] _currentFrameBuffer; - } + delete[] _currentFrameBuffer; + delete[] _frames; } bool RlfAnimation::readHeader() { @@ -230,11 +229,14 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 return; } else if (destOffset + 1 >= destSize) { // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } - WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset)); + byte r, g, b; + _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = _pixelFormat565.RGBToColor(r, g, b); + WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; destOffset += 2; @@ -248,7 +250,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 return; } else if (destOffset + 1 >= destSize) { // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -275,11 +277,14 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 return; } else if (destOffset + 1 >= destSize) { // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } - WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset)); + byte r, g, b; + _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = _pixelFormat565.RGBToColor(r, g, b); + WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; destOffset += 2; @@ -293,14 +298,16 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 return; } - uint16 sampleColor = READ_LE_UINT16(source + sourceOffset); + byte r, g, b; + _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 sampleColor = _pixelFormat565.RGBToColor(r, g, b); sourceOffset += 2; numberOfSamples += 2; while (numberOfSamples > 0) { if (destOffset + 1 >= destSize) { // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 5091185a362e..6f93934f1f7a 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -26,6 +26,7 @@ #include "common/types.h" #include "common/file.h" +#include "graphics/surface.h" namespace Common { @@ -51,6 +52,9 @@ class RlfAnimation { uint32 encodedSize; }; + const static Graphics::PixelFormat _pixelFormat555; + const static Graphics::PixelFormat _pixelFormat565; + private: Common::File _file; bool _stream; From 4288c4fa0e36d2274257154c5365f71f6f6dd015 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:04:06 -0500 Subject: [PATCH 0720/1332] ZVISION: Remove unnecessary pixel format switching from video code This is part of a series of commits converting all game assets to RBG 565 from RBG 555. The argument is that certain backends do not support RGB 555. AVI videos are already in RGB 565, so we just need to remove the code that switched the pixelFormat during videos. --- engines/zvision/video.cpp | 8 -------- engines/zvision/zvision.cpp | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 377b24af2a7b..d0dbbc57552c 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -77,11 +77,6 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, } void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect, bool skippable) { - // Videos use a different pixel format - Common::List formats; - formats.push_back(videoDecoder.getPixelFormat()); - initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, formats); - byte bytesPerPixel = videoDecoder.getPixelFormat().bytesPerPixel; uint16 origWidth = videoDecoder.getWidth(); @@ -167,9 +162,6 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d if (scale != 1) { delete[] scaledVideoFrameBuffer; } - - // Reset the pixel format to the original state - initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); } } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index c32e78214faa..b5cae8acd345 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -50,9 +50,10 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), - _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /*RGB 555*/ + _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ _desiredFrameTime(33), /* ~30 fps */ _clock(_system) { + // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). From fa578497b3ceb745c31f789a40b95b4a15f1cbe0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:05:07 -0500 Subject: [PATCH 0721/1332] ZVISION: Use Surface::getPixels() rather than getBasePtr(0, 0) Prevents unnecessary algebra --- engines/zvision/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index d0dbbc57552c..5230653ca322 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -143,10 +143,10 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d if (frame) { if (scale != 1) { - scaleBuffer((const byte *)frame->getBasePtr(0, 0), scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); + scaleBuffer((const byte *)frame->getPixels(), scaledVideoFrameBuffer, origWidth, origHeight, bytesPerPixel, scale); _system->copyRectToScreen(scaledVideoFrameBuffer, pitch * 2, x, y, finalWidth, finalHeight); } else { - _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), pitch, x, y, finalWidth, finalHeight); + _system->copyRectToScreen((const byte *)frame->getPixels(), pitch, x, y, finalWidth, finalHeight); } } } From 03d3646f8463cddddb17f043b7b827be1ca1bb39 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 29 Aug 2013 02:06:24 -0500 Subject: [PATCH 0722/1332] ZVISION: Remove unnecessary check if a pointer was non-NULL before deleting. I found out that you can call delete/free/delete[] on NULL and the function's defined behavior is to do nothing. --- engines/zvision/lever_control.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 7d23b687688f..45c21efd49e2 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -79,9 +79,8 @@ LeverControl::~LeverControl() { } else if (_fileType == RLF) { delete _animation.rlf; } - if (_frameInfo != 0) { - delete[] _frameInfo; - } + + delete[] _frameInfo; } void LeverControl::parseLevFile(const Common::String &fileName) { From 7d1dca9ad10c3121fc44f991e6b21c68db939344 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 15:34:42 -0500 Subject: [PATCH 0723/1332] ZVISION: Implement enabled/disabled support in Controls --- engines/zvision/lever_control.cpp | 16 ++++++++++++++++ engines/zvision/push_toggle_control.cpp | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 45c21efd49e2..2a5fe4fcacd3 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -183,6 +183,10 @@ void LeverControl::parseLevFile(const Common::String &fileName) { } void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (!_enabled) { + return; + } + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _mouseIsCaptured = true; _lastMousePos = backgroundImageSpacePos; @@ -190,6 +194,10 @@ void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common } void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (!_enabled) { + return; + } + _mouseIsCaptured = false; _engine->getScriptManager()->setStateValue(_key, _currentFrame); @@ -201,6 +209,10 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: } bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (!_enabled) { + return false; + } + bool cursorWasChanged = false; if (_mouseIsCaptured) { @@ -228,6 +240,10 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common } bool LeverControl::process(uint32 deltaTimeInMillis) { + if (!_enabled) { + return false; + } + // TODO: Implement reversal over time return false; diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp index be038e767a53..f4c0bc987ebc 100644 --- a/engines/zvision/push_toggle_control.cpp +++ b/engines/zvision/push_toggle_control.cpp @@ -71,12 +71,20 @@ PushToggleControl::~PushToggleControl() { } void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (!_enabled) { + return; + } + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getScriptManager()->setStateValue(_key, 1); } } bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + if (!_enabled) { + return false; + } + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(_hoverCursor); return true; From ef3e26a0730b070d2026641f554b525ae9f4b138 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 17:07:53 -0500 Subject: [PATCH 0724/1332] ZVISION: Fix typo in PixelFormat --- engines/zvision/cursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp index 57859b9b4621..4731d29f00d4 100644 --- a/engines/zvision/cursor.cpp +++ b/engines/zvision/cursor.cpp @@ -63,7 +63,7 @@ ZorkCursor::ZorkCursor(const Common::String &fileName) assert(bytesRead == dataSize); // Convert to RGB 565 - _surface.convertToInPlace(Graphics::PixelFormat(2, 5, 6, 6, 0, 11, 5, 0, 0)); + _surface.convertToInPlace(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); } ZorkCursor::ZorkCursor(const ZorkCursor &other) { From 21474d32ab2d2de784c6cd12f85e0f9ad68bcea4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 17:08:38 -0500 Subject: [PATCH 0725/1332] ZVISION: Fix error is RenderManager backgroundOffset handling --- engines/zvision/render_manager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b1282dc007a5..96030ba2b980 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -118,7 +118,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (destinationY > 0) { // Move destinationY to 0 - subRectX = surface.w - destinationX; + subRectY = surface.h - destinationY; destinationY = 0; } } @@ -327,12 +327,12 @@ void RenderManager::moveBackground(int offset) { if (_backgroundOffset.x <= -_backgroundWidth) _backgroundOffset.x += _backgroundWidth; else if (_backgroundOffset.x >= _backgroundWidth) - _backgroundOffset.x += _backgroundWidth; + _backgroundOffset.x -= _backgroundWidth; if (_backgroundOffset.y <= -_backgroundHeight) _backgroundOffset.y += _backgroundHeight; else if (_backgroundOffset.y >= _backgroundHeight) - _backgroundOffset.y += _backgroundHeight; + _backgroundOffset.y -= _backgroundHeight; renderImageToScreen(_currentBackground, 0, _screenCenterY - _backgroundOffset.y, true); } else if (state == RenderTable::PANORAMA) { @@ -341,12 +341,12 @@ void RenderManager::moveBackground(int offset) { if (_backgroundOffset.x <= -_backgroundWidth) _backgroundOffset.x += _backgroundWidth; else if (_backgroundOffset.x >= _backgroundWidth) - _backgroundOffset.x += _backgroundWidth; + _backgroundOffset.x -= _backgroundWidth; if (_backgroundOffset.y <= -_backgroundHeight) _backgroundOffset.y += _backgroundHeight; else if (_backgroundOffset.y >= _backgroundHeight) - _backgroundOffset.y += _backgroundHeight; + _backgroundOffset.y -= _backgroundHeight; renderImageToScreen(_currentBackground, _screenCenterX - _backgroundOffset.x, 0, true); } else { From dfe143137aa89909c9bf0fd24a359be8af9c2834 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 17:09:46 -0500 Subject: [PATCH 0726/1332] ZVISION: Remove extraneous TODO After redoing the math, I now know that the algorithm requires for(x) { for(y) {}} --- engines/zvision/render_table.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 55285b45e66c..a4dfe67c5373 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -163,7 +163,6 @@ void RenderTable::generatePanoramaLookupTable() { float fovInRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f); float cylinderRadius = halfHeight / tan(fovInRadians); - // TODO: Change the algorithm to write a whole row at a time instead of a whole column at a time. AKA: for(y) { for(x) {}} instead of for(x) { for(y) {}} for (uint x = 0; x < _numColumns; x++) { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) // Alpha represents the horizontal angle between the viewer at the center of a cylinder and x @@ -173,7 +172,6 @@ void RenderTable::generatePanoramaLookupTable() { // We also scale it by _panoramaOptions.linearScale int32 xInCylinderCoords = int32(floor((cylinderRadius * _panoramaOptions.linearScale * alpha) + halfWidth)); - float cosAlpha = cos(alpha); for (uint y = 0; y < _numRows; y++) { From 3c3a6bd93542ad82bd7972050db141628b413b30 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 17:10:06 -0500 Subject: [PATCH 0727/1332] ZVISION: Fix typo in point range clipping --- engines/zvision/render_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index a4dfe67c5373..0a83d5e4aec6 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -62,7 +62,7 @@ void RenderTable::setRenderState(RenderState newState) { const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Point &point) { // If we're outside the range of the RenderTable, no warping is happening. Return the maximum image coords - if (point.x >= (int16)_numColumns || point.y >= (int16)_numRows || point.x < 0 || point.y , 0) { + if (point.x >= (int16)_numColumns || point.y >= (int16)_numRows || point.x < 0 || point.y < 0) { int16 x = CLIP(point.x, 0, (int16)_numColumns); int16 y = CLIP(point.y, 0, (int16)_numRows); return Common::Point(x, y); From 94f350b1542e3129ad6c9597fe3fefdface444ae Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 30 Aug 2013 17:10:31 -0500 Subject: [PATCH 0728/1332] ZVISION: Implement TILT RenderTable creation --- engines/zvision/render_table.cpp | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 0a83d5e4aec6..b457ae024048 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -189,12 +189,35 @@ void RenderTable::generatePanoramaLookupTable() { } void RenderTable::generateTiltLookupTable() { - for (uint x = 0; x < _numColumns; x++) { - for (uint y = 0; y < _numRows; y++) { - uint32 index = y * _numColumns + x; + float halfWidth = (float)_numColumns / 2.0f; + float halfHeight = (float)_numRows / 2.0f; + + float fovInRadians = (_tiltOptions.fieldOfView * M_PI / 180.0f); + float cylinderRadius = halfWidth / tan(fovInRadians); + + for (uint y = 0; y < _numRows; y++) { + + // Add an offset of 0.01 to overcome zero tan/atan issue (horizontal line on half of screen) + // Alpha represents the horizontal angle between the viewer at the center of a cylinder and y + float alpha = atan(((float)y - halfHeight + 0.01f) / cylinderRadius); + + // To get y in cylinder coordinates, we just need to calculate the arc length + // We also scale it by _tiltOptions.linearScale + int32 yInCylinderCoords = int32(floor((cylinderRadius * _tiltOptions.linearScale * alpha) + halfHeight)); - _internalBuffer[index].x = 0; - _internalBuffer[index].y = 0; + float cosAlpha = cos(alpha); + uint32 columnIndex = y * _numColumns; + + for (uint x = 0; x < _numColumns; x++) { + // To calculate x in cylinder coordinates, we can do similar triangles comparison, + // comparing the triangle from the center to the screen and from the center to the edge of the cylinder + int32 xInCylinderCoords = int32(floor(halfWidth + ((float)x - halfWidth) * cosAlpha)); + + uint32 index = columnIndex + x; + + // Only store the (x,y) offsets instead of the absolute positions + _internalBuffer[index].x = xInCylinderCoords - x; + _internalBuffer[index].y = yInCylinderCoords - y; } } } From 97b0d5988ade1a2453e268706343d6aaacceb5de Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 17:53:13 -0500 Subject: [PATCH 0729/1332] ZVISION: Fix how LeverControl return routes are parsed --- engines/zvision/lever_control.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 2a5fe4fcacd3..3c452c3dd8fc 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -153,7 +153,7 @@ void LeverControl::parseLevFile(const Common::String &fileName) { _frameInfo[frameNumber].hotspot.bottom = y + _hotspotDelta.y; } - Common::StringTokenizer tokenizer(line, " ^="); + Common::StringTokenizer tokenizer(line, " ^=()"); tokenizer.nextToken(); tokenizer.nextToken(); @@ -168,8 +168,11 @@ void LeverControl::parseLevFile(const Common::String &fileName) { _frameInfo[frameNumber].directions.push_back(Direction(angle, toFrame)); } else if (token.hasPrefix("P")) { - uint to; - sscanf(token.c_str(), "P(%*u to %u)", &to); + // Format: P( to ) + tokenizer.nextToken(); + tokenizer.nextToken(); + token = tokenizer.nextToken(); + uint to = atoi(token.c_str()); _frameInfo[frameNumber].returnRoute.push_back(to); } From 1ad594bd30e238f4da7f686d2680abbc1e1450bd Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 17:53:37 -0500 Subject: [PATCH 0730/1332] ZVISION: Add default values for tilt options --- engines/zvision/render_table.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index b457ae024048..1f3e5560908f 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -52,7 +52,9 @@ void RenderTable::setRenderState(RenderState newState) { _panoramaOptions.reverse = false; break; case TILT: - + _tiltOptions.fieldOfView = 27.0f; + _tiltOptions.linearScale = 0.55f; + _tiltOptions.reverse = false; break; case FLAT: // Intentionally left empty From d2d375500954100cbb32a052baa00349ce1d3ec1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 17:54:07 -0500 Subject: [PATCH 0731/1332] ZVISION: Fix tilt render table comment --- engines/zvision/render_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 1f3e5560908f..5fd7a16caced 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -200,7 +200,7 @@ void RenderTable::generateTiltLookupTable() { for (uint y = 0; y < _numRows; y++) { // Add an offset of 0.01 to overcome zero tan/atan issue (horizontal line on half of screen) - // Alpha represents the horizontal angle between the viewer at the center of a cylinder and y + // Alpha represents the vertical angle between the viewer at the center of a cylinder and y float alpha = atan(((float)y - halfHeight + 0.01f) / cylinderRadius); // To get y in cylinder coordinates, we just need to calculate the arc length From 04bf6f79e93d3a86e6ec2e8c391e59a5f1dd230c Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 17:54:34 -0500 Subject: [PATCH 0732/1332] ZVISION: Implement return pathing for LeverControls --- engines/zvision/lever_control.cpp | 37 +++++++++++++++++++++++++------ engines/zvision/lever_control.h | 5 ++++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 3c452c3dd8fc..91e54075b6df 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -47,7 +47,9 @@ LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStre _currentFrame(0), _lastRenderedFrame(0), _mouseIsCaptured(false), - _isReturning(false) { + _isReturning(false), + _accumulatedTime(0), + _returnRoutesCurrentFrame(0) { // Loop until we find the closing brace Common::String line = stream.readLine(); @@ -204,11 +206,9 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: _mouseIsCaptured = false; _engine->getScriptManager()->setStateValue(_key, _currentFrame); - if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { - - } - - // TODO: Animation reversal back to origin + _isReturning = true; + _returnRoutesCurrentProgress = _frameInfo[_currentFrame].returnRoute.begin(); + _returnRoutesCurrentFrame = _currentFrame; } bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { @@ -247,8 +247,31 @@ bool LeverControl::process(uint32 deltaTimeInMillis) { return false; } - // TODO: Implement reversal over time + if (_isReturning) { + _accumulatedTime += deltaTimeInMillis; + while (_accumulatedTime >= ANIMATION_FRAME_TIME) { + _accumulatedTime -= ANIMATION_FRAME_TIME; + if (_returnRoutesCurrentFrame == *_returnRoutesCurrentProgress) { + _returnRoutesCurrentProgress++; + } + if (_returnRoutesCurrentProgress == _frameInfo[_currentFrame].returnRoute.end()) { + _isReturning = false; + _currentFrame = _returnRoutesCurrentFrame; + _engine->getScriptManager()->setStateValue(_key, _currentFrame); + return false; + } + uint toFrame = *_returnRoutesCurrentProgress; + if (_returnRoutesCurrentFrame < toFrame) { + _returnRoutesCurrentFrame++; + } else if (_returnRoutesCurrentFrame > toFrame) { + _returnRoutesCurrentFrame--; + } + + renderFrame(_returnRoutesCurrentFrame); + } + } + return false; } diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index d359318d2fc1..b5677a269ec4 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -61,7 +61,8 @@ class LeverControl : public Control { }; enum { - ANGLE_DELTA = 30 // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) + ANGLE_DELTA = 30, // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) + ANIMATION_FRAME_TIME = 30 // In millis }; private: @@ -85,6 +86,8 @@ class LeverControl : public Control { bool _isReturning; Common::Point _lastMousePos; Common::List::iterator _returnRoutesCurrentProgress; + uint _returnRoutesCurrentFrame; + uint32 _accumulatedTime; public: void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); From 07fdcdf312e5498508affe825db37a6f1644f738 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 18:09:24 -0500 Subject: [PATCH 0733/1332] ZVISION: Only do return pathing after the mouse is captured --- engines/zvision/lever_control.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 91e54075b6df..744fde1e1c7c 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -203,12 +203,14 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: return; } - _mouseIsCaptured = false; - _engine->getScriptManager()->setStateValue(_key, _currentFrame); + if (_mouseIsCaptured) { + _mouseIsCaptured = false; + _engine->getScriptManager()->setStateValue(_key, _currentFrame); - _isReturning = true; - _returnRoutesCurrentProgress = _frameInfo[_currentFrame].returnRoute.begin(); - _returnRoutesCurrentFrame = _currentFrame; + _isReturning = true; + _returnRoutesCurrentProgress = _frameInfo[_currentFrame].returnRoute.begin(); + _returnRoutesCurrentFrame = _currentFrame; + } } bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { From 2ad40edd47098144cecb808cf308bca8329479ff Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 18:10:58 -0500 Subject: [PATCH 0734/1332] ZVISION: Limit tilt movement to the size of the image // TODO: Remove image wrapping logic for the vertical direction since this can never happen now --- engines/zvision/render_manager.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 96030ba2b980..ea34469baf50 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -324,15 +324,7 @@ void RenderManager::moveBackground(int offset) { if (state == RenderTable::TILT) { _backgroundOffset += Common::Point(0, offset); - if (_backgroundOffset.x <= -_backgroundWidth) - _backgroundOffset.x += _backgroundWidth; - else if (_backgroundOffset.x >= _backgroundWidth) - _backgroundOffset.x -= _backgroundWidth; - - if (_backgroundOffset.y <= -_backgroundHeight) - _backgroundOffset.y += _backgroundHeight; - else if (_backgroundOffset.y >= _backgroundHeight) - _backgroundOffset.y -= _backgroundHeight; + _backgroundOffset.y = CLIP(_backgroundOffset.y, _screenCenterY, (int16)_backgroundHeight - _screenCenterY); renderImageToScreen(_currentBackground, 0, _screenCenterY - _backgroundOffset.y, true); } else if (state == RenderTable::PANORAMA) { @@ -343,11 +335,6 @@ void RenderManager::moveBackground(int offset) { else if (_backgroundOffset.x >= _backgroundWidth) _backgroundOffset.x -= _backgroundWidth; - if (_backgroundOffset.y <= -_backgroundHeight) - _backgroundOffset.y += _backgroundHeight; - else if (_backgroundOffset.y >= _backgroundHeight) - _backgroundOffset.y -= _backgroundHeight; - renderImageToScreen(_currentBackground, _screenCenterX - _backgroundOffset.x, 0, true); } else { renderImageToScreen(_currentBackground, 0, 0); From f1bd8de21dd504fd9b8fa07c76ab75b5c40d29cd Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 23:42:00 -0500 Subject: [PATCH 0735/1332] ZVISION: Overload ZVision::playAnimation to support general video files --- engines/zvision/animation.cpp | 44 +++++++++++++++++++++++++++++++++++ engines/zvision/zvision.h | 1 + 2 files changed, 45 insertions(+) diff --git a/engines/zvision/animation.cpp b/engines/zvision/animation.cpp index 8ca892dfdabd..f43e854f734e 100644 --- a/engines/zvision/animation.cpp +++ b/engines/zvision/animation.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "common/system.h" +#include "video/video_decoder.h" #include "zvision/zvision.h" #include "zvision/rlf_animation.h" @@ -84,4 +85,47 @@ void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, Dispose } } +void ZVision::playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) { + _clock.stop(); + animation->start(); + + // Only continue while the video is still playing + while (!shouldQuit() && !animation->endOfVideo() && animation->isPlaying()) { + // Check for engine quit and video stop key presses + while (!animation->endOfVideo() && animation->isPlaying() && _eventMan->pollEvent(_event)) { + switch (_event.type) { + case Common::EVENT_KEYDOWN: + switch (_event.kbd.keycode) { + case Common::KEYCODE_q: + if (_event.kbd.hasFlags(Common::KBD_CTRL)) + quitGame(); + break; + case Common::KEYCODE_SPACE: + animation->stop(); + break; + default: + break; + } + default: + break; + } + } + + if (animation->needsUpdate()) { + const Graphics::Surface *frame = animation->decodeNextFrame(); + + if (frame) { + _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); + } + } + + // Always update the screen so the mouse continues to render + _system->updateScreen(); + + _system->delayMillis(animation->getTimeToNextFrame()); + } + + _clock.start(); +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index a02fecc43db1..f961f1fda97f 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -126,6 +126,7 @@ class ZVision : public Engine { void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + void playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** * Utility method to cycle through all the cursors in the game. After From c3fcff96124190e847e714fbed23c60c1785c169 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 23:42:56 -0500 Subject: [PATCH 0736/1332] ZVISION: Move TimerNode to it's own file --- engines/zvision/action_node.cpp | 13 -------- engines/zvision/action_node.h | 19 +----------- engines/zvision/actions.cpp | 1 + engines/zvision/module.mk | 1 + engines/zvision/timer_node.cpp | 46 ++++++++++++++++++++++++++++ engines/zvision/timer_node.h | 53 +++++++++++++++++++++++++++++++++ 6 files changed, 102 insertions(+), 31 deletions(-) create mode 100644 engines/zvision/timer_node.cpp create mode 100644 engines/zvision/timer_node.h diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp index 8e354606f8e4..eeb89309248c 100644 --- a/engines/zvision/action_node.cpp +++ b/engines/zvision/action_node.cpp @@ -28,19 +28,6 @@ namespace ZVision { -TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) - : Control(engine, key), _timeLeft(timeInSeconds * 1000) { -} -bool TimerNode::process(uint32 deltaTimeInMillis) { - _timeLeft -= deltaTimeInMillis; - - if (_timeLeft <= 0) { - _engine->getScriptManager()->setStateValue(_key, 0); - return true; - } - - return false; -} } // End of namespace ZVision diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index b0b8cae4b148..c9beb7b38e9c 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -29,24 +29,7 @@ namespace ZVision { -class ZVision; - -class TimerNode : public Control { -public: - TimerNode(ZVision *engine, uint32 key, uint timeInSeconds); - - /** - * Decrement the timer by the delta time. If the timer is finished, set the status - * in _globalState and let this node be deleted - * - * @param deltaTimeInMillis The number of milliseconds that have passed since last frame - * @return If true, the node can be deleted after process() finishes - */ - bool process(uint32 deltaTimeInMillis); - -private: - uint32 _timeLeft; -}; + } // End of namespace ZVision diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index d039f04d959f..0265ebd410e2 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,6 +33,7 @@ #include "zvision/action_node.h" #include "zvision/zork_raw.h" #include "zvision/zork_avi_decoder.h" +#include "zvision/timer_node.h" namespace ZVision { diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 7412ad891690..48b8a6607709 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -21,6 +21,7 @@ MODULE_OBJS := \ script_manager.o \ scripts.o \ single_value_container.o \ + timer_node.o \ utility.o \ video.o \ zvision.o \ diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp new file mode 100644 index 000000000000..c9ef9d29d16b --- /dev/null +++ b/engines/zvision/timer_node.cpp @@ -0,0 +1,46 @@ +/* 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/scummsys.h" + +#include "zvision/timer_node.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" + +namespace ZVision { + +TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) + : Control(engine, key), _timeLeft(timeInSeconds * 1000) { +} + +bool TimerNode::process(uint32 deltaTimeInMillis) { + _timeLeft -= deltaTimeInMillis; + + if (_timeLeft <= 0) { + _engine->getScriptManager()->setStateValue(_key, 0); + return true; + } + + return false; +} + +} // End of namespace ZVision diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h new file mode 100644 index 000000000000..d692f1f0caad --- /dev/null +++ b/engines/zvision/timer_node.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. + * + */ + +#ifndef ZVISION_TIMER_NODE_H +#define ZVISION_TIMER_NODE_H + +#include "common/types.h" + +#include "zvision/control.h" + +namespace ZVision { + +class ZVision; + +class TimerNode : public Control { +public: + TimerNode(ZVision *engine, uint32 key, uint timeInSeconds); + + /** + * Decrement the timer by the delta time. If the timer is finished, set the status + * in _globalState and let this node be deleted + * + * @param deltaTimeInMillis The number of milliseconds that have passed since last frame + * @return If true, the node can be deleted after process() finishes + */ + bool process(uint32 deltaTimeInMillis); + +private: + uint32 _timeLeft; +}; + +} // End of namespace ZVision + +#endif From 78d5a41cd0812353e0dbc675f010540dc630f343 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:26:13 -0500 Subject: [PATCH 0737/1332] ZVISION: Call Surface::free() in the cursor destructor --- engines/zvision/cursor.cpp | 5 +++++ engines/zvision/cursor.h | 1 + 2 files changed, 6 insertions(+) diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp index 4731d29f00d4..bb0700cebe5a 100644 --- a/engines/zvision/cursor.cpp +++ b/engines/zvision/cursor.cpp @@ -81,9 +81,14 @@ ZorkCursor &ZorkCursor::operator=(const ZorkCursor &other) { _hotspotX = other._hotspotX; _hotspotY = other._hotspotY; + _surface.free(); _surface.copyFrom(other._surface); return *this; } +ZorkCursor::~ZorkCursor() { + _surface.free(); +} + } // End of namespace ZVision diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index ec9f5ed0d71f..805a8e798243 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -42,6 +42,7 @@ class ZorkCursor { ZorkCursor(); ZorkCursor(const Common::String &fileName); ZorkCursor(const ZorkCursor &other); + ~ZorkCursor(); private: uint16 _width; From 34dcea106a2d1d7a7ba3412ef43ca547e67a66dd Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:27:03 -0500 Subject: [PATCH 0738/1332] ZVISION: Cleanup _activeControls in ScriptManager destructor --- engines/zvision/script_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 98bc2e3a3a09..b95f2636b092 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -48,6 +48,9 @@ ScriptManager::~ScriptManager() { for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { delete (*iter); } + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + delete (*iter); + } } void ScriptManager::initialize() { From 4d86061b5714ea7e27edffc343572eb85c57a674 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:31:44 -0500 Subject: [PATCH 0739/1332] ZVISION: Cleanup all used memory in RLF animations --- engines/zvision/rlf_animation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index df1fe118da4e..73fbe05bfc0d 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -72,6 +72,9 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) RlfAnimation::~RlfAnimation() { delete[] _currentFrameBuffer; + for (int i = 0; i < _frameCount; i++) { + delete[] _frames[i].encodedData; + } delete[] _frames; } From 98dc015dc1329ef233d4fe9606ab98c26b0f8438 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:32:12 -0500 Subject: [PATCH 0740/1332] ZVISION: Free the _currentBackground Surface in RenderManager destructor --- engines/zvision/render_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index ea34469baf50..463faefdebab 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -54,6 +54,7 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, RenderManager::~RenderManager() { delete[] _workingWindowBuffer; + _currentBackground.free(); } void RenderManager::update(uint deltaTimeInMillis) { From efb0495758b8f5ee5f59d148a15cf03265cd6c2d Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:34:01 -0500 Subject: [PATCH 0741/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 73fbe05bfc0d..ffc272c1c80e 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -72,7 +72,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) RlfAnimation::~RlfAnimation() { delete[] _currentFrameBuffer; - for (int i = 0; i < _frameCount; i++) { + for (uint i = 0; i < _frameCount; i++) { delete[] _frames[i].encodedData; } delete[] _frames; From b3a32746162399d065efc33b71770ddb6e3eeab0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 00:39:39 -0500 Subject: [PATCH 0742/1332] ZVISION: Remove unnecessary file.open() It's done inside readImageToSurface() and it no longer needs to be on the heap --- engines/zvision/render_manager.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 463faefdebab..837e3880c704 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -282,13 +282,6 @@ RenderTable *RenderManager::getRenderTable() { } void RenderManager::setBackgroundImage(const Common::String &fileName) { - Common::File *file = new Common::File; - - if (!file->open(fileName)) { - warning("Could not open file %s", fileName.c_str()); - return; - } - readImageToSurface(fileName, _currentBackground); moveBackground(0); From 5d86eb4a4af6416b8c40a6cb5aaf234bddabde95 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 01:23:17 -0500 Subject: [PATCH 0743/1332] ZVISION: Change ActionPlayAnimation::_loop refer to a count rather than a boolean _loopCount refers to the number of times an animation should be played, where 0 corresponds to infinite. --- engines/zvision/actions.cpp | 4 +--- engines/zvision/actions.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 0265ebd410e2..4c532ebf9db9 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -224,15 +224,13 @@ bool ActionPreloadAnimation::execute(ZVision *engine) { ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { char fileName[25]; - uint loop; // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), "%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)", - &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &loop, &_mask, &_framerate); + &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loopCount, &_mask, &_framerate); _fileName = Common::String(fileName); - _loop = loop == 1 ? true : false; } bool ActionPlayAnimation::execute(ZVision *engine) { diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 5e7c2c63e33d..b36e277d0ecc 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -239,7 +239,7 @@ class ActionPlayAnimation : public ResultAction { uint32 _end; uint _mask; uint _framerate; - bool _loop; + uint _loopCount; }; class ActionPreloadAnimation : public ResultAction { From 0afbcf1cf0530d8a71e5ec12ef3c4ec9cbe91686 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 12:09:29 +0200 Subject: [PATCH 0744/1332] AVALANCHE: Rename/refactor avalanche.h/.cpp. --- engines/avalanche/avalanche.cpp | 119 +++++++++++++++----------------- engines/avalanche/avalanche.h | 62 ++++++++--------- 2 files changed, 88 insertions(+), 93 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 73b39d64074f..5c140ca1e5f6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -557,29 +557,29 @@ Common::Point AvalancheEngine::getMousePos() { // From Bootstrp: -const char AvalancheEngine::runcodes[2][3] = {"et", "Go"}; +const char AvalancheEngine::kRuncodes[2][3] = {"et", "Go"}; // The original ones were all commented out, so porbably there's no need // of these two cursor functions at all. TODO: Remove later. -void AvalancheEngine::cursor_off() { - warning("STUB: cursor_off()"); +void AvalancheEngine::cursorOff() { + warning("STUB: cursorOff()"); } -void AvalancheEngine::cursor_on() { - warning("STUB: cursor_on()"); +void AvalancheEngine::cursorOn() { + warning("STUB: cursorOn()"); } // Needed later. void AvalancheEngine::quit() { - cursor_on(); + cursorOn(); } // Needed in dos_shell(). TODO: Remove later. -Common::String AvalancheEngine::command_com() { - warning("STUB: command_com()"); - return ("STUB: command_com()"); +Common::String AvalancheEngine::commandCom() { + warning("STUB: commandCom()"); + return ("STUB: commandCom()"); } // Needed for run_avalot()'s errors. TODO: Remove later. @@ -591,75 +591,70 @@ void AvalancheEngine::explain(byte error) { //TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) -void AvalancheEngine::b_flight() { /*interrupt;*/ - _storage.skellern++; +void AvalancheEngine::bFlight() { /*interrupt;*/ + _storage._skellern++; } -void AvalancheEngine::bflight_on() { - _storage.skellern = _reset_; +void AvalancheEngine::bFlightOn() { + _storage._skellern = kReset; // setintvec(0x1c, &b_flight); } -void AvalancheEngine::bflight_off() { +void AvalancheEngine::bFlightOff() { // setintvec(0x1c, old_1c); } -Common::String AvalancheEngine::elm2str(elm how) { - Common::String elm2str_result; +Common::String AvalancheEngine::elm2Str(Elm how) { switch (how) { - case Normal: - case Musical: - elm2str_result = "jsb"; - break; - case Regi: - elm2str_result = "REGI"; - break; - case Elmpoyten: - elm2str_result = "ELMPOYTEN"; - break; + case kNormal: + case kMusical: + return "jsb"; + case kRegi: + return "REGI"; + case kElmpoyten: + return "ELMPOYTEN"; } - return elm2str_result; } -void AvalancheEngine::run(Common::String what, bool with_jsb, bool with_bflight, elm how) { +void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. } -void AvalancheEngine::get_arguments() { +void AvalancheEngine::getArguments() { // This function should mess around with command line arguments, // but I am not sure if there'll be use of these arguments at all... - warning("STUB: get_arguments()"); + warning("STUB: getArguments()"); } -void AvalancheEngine::get_slope() { +void AvalancheEngine::getSlope() { // Same as get_arguments() - warning("STUB: get_slope()"); + warning("STUB: getSlope()"); } -void AvalancheEngine::call_menu() { - warning("STUB: call_menu()"); +void AvalancheEngine::callMenu() { + warning("STUB: callMenu()"); } -void AvalancheEngine::run_the_demo() { - warning("STUB: run_the_demo()"); +void AvalancheEngine::runDemo() { + warning("STUB: runDemo()"); } -void AvalancheEngine::dos_shell() { - warning("STUB: dos_shell()"); +void AvalancheEngine::dosShell() { + warning("STUB: dosShell()"); } // Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. -bool AvalancheEngine::keypressed1() { - warning("STUB: keypressed1()"); +bool AvalancheEngine::keyPressed() { + warning("STUB: keyPressed()"); return false; } // Same as keypressed1(). -void AvalancheEngine::flush_buffer() { - warning("STUB: flush_buffer()"); +void AvalancheEngine::flushBuffer() { + warning("STUB: flushBuffer()"); } // Same as keypressed1(). @@ -670,14 +665,14 @@ void AvalancheEngine::demo() { -void AvalancheEngine::run_avalot() { - bflight_on(); +void AvalancheEngine::runAvalot() { + bFlightOn(); - _avalot->run(Common::String(runcodes[first_time]) + arguments); + _avalot->run(Common::String(kRuncodes[_firstTime]) + _arguments); // TODO: Check if parameteres are ever used (probably not) and eventually remove them. // If there's an error initalizing avalot, i'll handle it in there, not here - first_time = false; + _firstTime = false; } @@ -691,36 +686,36 @@ Common::Error AvalancheEngine::run() { // From bootstrp: - first_time = true; + _firstTime = true; - get_arguments(); - get_slope(); + getArguments(); + getSlope(); - zoomy = true; + _zoomy = true; // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. - if (!zoomy) - call_menu(); /* Not run when zoomy. */ + if (!_zoomy) + callMenu(); /* Not run when zoomy. */ do { - run_avalot(); + runAvalot(); //if (dosexitcode != 77) quit(); /* Didn't stop for us. */ - switch (_storage.operation) { - case _runShootemup: - run("seu.avx", _jsb, _bflight, Normal); + switch (_storage._operation) { + case kRunShootemup: + run("seu.avx", kJsb, kBflight, kNormal); break; - case _runDosshell: - dos_shell(); + case kRunDosshell: + dosShell(); break; - case _runGhostroom: - run("g-room.avx", _jsb, _no_bflight, Normal); + case kRunGhostroom: + run("g-room.avx", kJsb, kNoBflight, kNormal); break; - case _runGolden: - run("golden.avx", _jsb, _bflight, Musical); + case kRunGolden: + run("golden.avx", kJsb, kBflight, kMusical); break; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 6b62ad7886c6..f8f2ce1ee2c0 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -150,70 +150,70 @@ class AvalancheEngine : public Engine { // From bootstrp: - enum elm {Normal, Musical, Elmpoyten, Regi}; + enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; - static const int16 _runShootemup = 1, _runDosshell = 2, _runGhostroom = 3, _runGolden = 4; + static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; - static const char runcodes[2][3]; + static const char kRuncodes[2][3]; - static const int16 _reset_ = 0; + static const int16 kReset = 0; - static const bool _jsb = true, _no_jsb = false, _bflight = true, _no_bflight = false; + static const bool kJsb = true, kNoJsb = false, kBflight = true, kNoBflight = false; struct { - byte operation; - uint16 skellern; - byte contents[1000]; + byte _operation; + uint16 _skellern; + byte _contents[1000]; } _storage; - Common::String arguments, demo_args, args_with_no_filename; + Common::String _arguments, _demoArgs, _argsWithNoFilename; - bool first_time; + bool _firstTime; - byte original_mode; - void *old_1c; + byte _originalMode; + byte *_old1c; - Common::String segofs; + Common::String _segofs; - bool zoomy; + bool _zoomy; - int32 soundcard, speed, baseaddr, irq, dma; + int32 _soundcard, _speed, _baseaddr, _irq, _dma; - void cursor_off(); + void cursorOff(); - void cursor_on(); + void cursorOn(); void quit(); - Common::String command_com(); + Common::String commandCom(); void explain(byte error); - void b_flight(); + void bFlight(); - void bflight_on(); + void bFlightOn(); - void bflight_off(); + void bFlightOff(); - Common::String elm2str(elm how); + Common::String elm2Str(Elm how); - void run(Common::String what, bool with_jsb, bool with_bflight, elm how); + void run(Common::String what, bool withJsb, bool withBflight, Elm how); - void get_arguments(); + void getArguments(); - void get_slope(); + void getSlope(); - void call_menu(); + void callMenu(); - void run_avalot(); + void runAvalot(); - void run_the_demo(); + void runDemo(); - void dos_shell(); + void dosShell(); - bool keypressed1(); + bool keyPressed(); - void flush_buffer(); + void flushBuffer(); void demo(); }; From 74979869ff22d0c22be2f0d774e3ce6974302d38 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 15:35:09 +0200 Subject: [PATCH 0745/1332] AVALANCHE: Rename/refactor Acci. Implement Acci::peopleInRoom(). --- engines/avalanche/acci2.cpp | 1292 +++++++++++++++---------------- engines/avalanche/acci2.h | 224 +++--- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalanche.h | 2 +- engines/avalanche/dropdown2.cpp | 102 +-- engines/avalanche/gyro2.cpp | 16 +- engines/avalanche/lucerna2.cpp | 24 +- engines/avalanche/parser.cpp | 8 +- engines/avalanche/scrolls2.cpp | 6 +- engines/avalanche/timeout2.cpp | 4 +- engines/avalanche/visa2.cpp | 4 +- 11 files changed, 817 insertions(+), 867 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index fb024aebb87f..1f455ec8cb5d 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -47,54 +47,48 @@ #include -/*#include "NimUnit.h"*/ -/*#include "Highs.h"*/ -/*#include "Helper.h"*/ namespace Avalanche { -const Acci::vocab Acci::words[nowords] = { - /* Verbs, 1-49 */ - {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, /* short */ - {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, - {3, "PAUSE"}, {47, "TA"}, /* Early to avoid Take and Talk. */ - {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, - {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, - {7, "SAY"}, {7, "ASK"}, - {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, - {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, - {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, - {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, - {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, +const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { + // Verbs: 1-49 + {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, // short + {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, + {3, "PAUSE"}, {47, "TA"}, // Early to avoid Take and Talk. + {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, + {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, + {7, "SAY"}, {7, "ASK"}, + {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, + {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, + {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, + {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, + {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, {17, "STAND"}, - - {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, + {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, {20, "DOFF"}, - {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, + {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, {22, "PLAY"}, - {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, - {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, - {255, "NINET"}, /* block for NINETY */ - {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, + {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, + {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, + {255, "NINET"}, // block for NINETY + {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, {30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"}, - {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, - {30, "WIZZY"}, {30, "PLOVER"}, + {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, + {30, "WIZZY"}, {30, "PLOVER"}, {30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"}, - {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, - {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, - {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, + {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, + {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, + {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, {30, "BONESCROLLS"}, {30, "RADOF"}, - {31, "RESTART"}, - {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, - {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, - {34, "ORDER"}, {34, "DEMAND"}, - {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, - {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, + {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, + {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, + {34, "ORDER"}, {34, "DEMAND"}, + {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, + {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, {35, "FIRE"}, - /* Passwords, 36: */ - + // Passwords: 36 {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, @@ -105,7 +99,6 @@ const Acci::vocab Acci::words[nowords] = { {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, - {37, "DIR"}, {37, "LS"}, {38, "DIE"}, {39, "SCORE"}, {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, @@ -113,105 +106,98 @@ const Acci::vocab Acci::words[nowords] = { {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, {46, "HELLO"}, {46, "HI"}, {46, "YO"}, - {47, "THANKS"}, /* = 47, "ta", which was defined earlier. */ + {47, "THANKS"}, // = 47, "ta", which was defined earlier. - - /* Nouns - Objects: 50-100. */ - - {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, - {50, "VINEGAR"}, {51, "MONEYBAG"}, - {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, + // Nouns - Objects: 50-100 + {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, + {50, "VINEGAR"}, {51, "MONEYBAG"}, + {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, {51, "WALLET"}, - {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, - {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, - {55, "ARROW"}, {55, "DART"}, - {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, - {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, + {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, + {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, + {55, "ARROW"}, {55, "DART"}, + {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, + {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, {59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"}, - {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, - {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, - {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, - {66, "DISGUISE"}, {67, "ONION"}, - + {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, + {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, + {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, + {66, "DISGUISE"}, {67, "ONION"}, {99, "PASSWORD"}, - /* Objects from Also are placed between 101 and 131. */ + // Objects from Also are placed between 101 and 131. - /* Nouns - People - Male, 150-174 */ - {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, - {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, - {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, - {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, - {158, "DU"}, /* <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.*/ - {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, + // Nouns - People - Male: 150-174 + {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, + {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, + {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, + {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, + {158, "DU"}, // <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke. + {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, {154, "MALAGAUCHE"}, - {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, - {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, + {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, + {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, {157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"}, - {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, - {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, + {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, + {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, {161, "STALLHOLDER"}, - {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, - {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, - {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, + {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, + {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, + {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, - /* Nouns- People - Female: 175-199 */ + // Nouns - People - Female: 175-199 {175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"}, {176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"}, {178, "WITCH"}, - /* Pronouns, 200-224 */ + // Pronouns: 200-224 {200, "HIM"}, {200, "MAN"}, {200, "GUY"}, {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, {202, "IT"}, {202, "THING"}, + {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, - {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, - - /* Prepositions, 225-249 */ + // Prepositions: 225-249 {225, "TO"}, {226, "AT"}, {227, "UP"}, {228, "INTO"}, {228, "INSIDE"}, {229, "OFF"}, {230, "UP"}, {231, "DOWN"}, {232, "ON"}, - - /* Please, 251 */ + // Please: 251 {251, "PLEASE"}, - /* About, 252 */ + // About: 252 {252, "ABOUT"}, {252, "CONCERNING"}, - /* Swear words, 253 */ - /* I M P O R T A N T M E S S A G E + // Swear words: 253 + /* I M P O R T A N T M E S S A G E - DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE - DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. - GOODNESS KNOWS WHO WROTE THEM. - READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. - WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ + DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE + DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. + GOODNESS KNOWS WHO WROTE THEM. + READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. + WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ {253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"}, {253, "FART"}, {253, "FUCK"}, {253, "BALLS"}, {253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"}, {253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"}, {253, "SMEG"}, - /* and other even ruder words. You didn't read them, did you? Good. */ + // ...and other even ruder words. You didn't read them, did you? Good. */ - /* Answer-back smart-alec words, 249 */ + // Answer-back smart-alec words: 249 {249, "YES"}, {249, "NO"}, {249, "BECAUSE"}, - /* Noise words, 255 */ + // Noise words: 255 {255, "THE"}, {255, "A"}, {255, "NOW"}, {255, "SOME"}, {255, "AND"}, {255, "THAT"}, {255, "POCUS"}, {255, "HIS"}, - {255, "THIS"}, {255, "SENTINEL"} - -}; /* for "Ken SENT Me" */ + {255, "THIS"}, {255, "SENTINEL"} // for "Ken SENT Me" +}; +const char Acci::kWhat[] = "That's not possible!"; -const char Acci::what[] = "That's not possible!"; - -const Acci::ranktype Acci::ranks[9] = { - {0, "Beginner"}, {10, "Novice"}, +const Acci::RankType Acci::kRanks[9] = { + {0, "Beginner"}, {10, "Novice"}, {20, "Improving"}, {35, "Not bad"}, {50, "Passable"}, {65, "Good"}, {80, "Experienced"}, {108, "The BEST!"}, @@ -227,74 +213,57 @@ void Acci::init() { _vm->_gyro->weirdword = false; } -void Acci::clearwords() { +void Acci::clearWords() { for (byte i = 0; i < 11; i++) - if (!realwords[i].empty()) - realwords[i].clear(); + if (!_realWords[i].empty()) + _realWords[i].clear(); } -byte Acci::wordnum(Common::String x) { - if (x.empty()) +byte Acci::wordNum(Common::String word) { + if (word.empty()) return 0; - for (int32 fv = nowords - 1; fv >= 0; fv--) - if (words[fv].w == x) - return words[fv].n; + for (int32 i = kParserWordsNum - 1; i >= 0; i--) + if (kVocabulary[i]._word == word) + return kVocabulary[i]._number; // If not found as a whole, we look for it as a substring. - for (int32 fv = nowords - 1; fv >= 0; fv--) - if (Common::String(words[fv].w.c_str(), x.size()) == x) - return words[fv].n; + for (int32 i = kParserWordsNum - 1; i >= 0; i--) + if (Common::String(kVocabulary[i]._word.c_str(), word.size()) == word) + return kVocabulary[i]._number; - return pardon; + return kPardon; } -void Acci::replace(Common::String old1, byte new1) { - int16 q = _vm->_parser->pos(old1, thats); - while (q != -1) { - if (new1 == 0) - thats.deleteChar(q); +void Acci::replace(Common::String oldChars, byte newChar) { + int16 pos = _vm->_parser->pos(oldChars, _thats); + while (pos != -1) { + if (newChar == 0) + _thats.deleteChar(pos); else { - for (byte i = q; i < q + old1.size(); i++) - thats.deleteChar(q); - thats.insertChar(new1, q); + for (byte i = pos; i < pos + oldChars.size(); i++) + _thats.deleteChar(pos); + _thats.insertChar(newChar, pos); } - q = _vm->_parser->pos(old1, thats); + pos = _vm->_parser->pos(oldChars, _thats); } } -/*procedure ninetydump; -var f:file; y:int16; bit:byte; a:byte absolute $A000:800; -begin - off; - assign(f,'avvydump.avd'); - rewrite(f,1); - blockwrite(f,_vm->_gyro->dna,177); { just anything } - for bit:=0 to 3 do - begin - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1 shl bit; port[$3CF]:=bit; - blockwrite(f,a,12080); - end; - close(f); on; - _vm->_scrolls->display('Dumped.'); -end;*/ - Common::String Acci::rank() { - for (byte fv = 0; fv < 8; fv++) { - if ((_vm->_gyro->dna.score >= ranks[fv].score) && (_vm->_gyro->dna.score < ranks[fv + 1].score)) { - return ranks[fv].title; + for (byte i = 0; i < 8; i++) { + if ((_vm->_gyro->dna.score >= kRanks[i]._score) && (_vm->_gyro->dna.score < kRanks[i + 1]._score)) { + return kRanks[i]._title; } } return ""; } -Common::String Acci::totaltime() { - const double ticks_in_1_sec = (double)(65535) / 3600; +Common::String Acci::totalTime() { + // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. + const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - Common::String a; - // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. - h = _vm->_gyro->dna.total_time / ticks_in_1_sec; // No. of seconds. + h = _vm->_gyro->dna.total_time / ticksInOneSec; // No. of seconds. if (h < 0) h = ceil((float)h); else @@ -304,14 +273,12 @@ Common::String Acci::totaltime() { s = m % 60; m = m / 60; - a = "You've been playing for "; + Common::String result = "You've been playing for "; if (h > 0) - a = a + _vm->_gyro->strf(h) + " hours, "; + result = result + _vm->_gyro->strf(h) + " hours, "; if ((m > 0) || (h != 0)) - a = a + _vm->_gyro->strf(m) + " minutes and "; - a = a + _vm->_gyro->strf(s) + " seconds."; - - return a; + result = result + _vm->_gyro->strf(m) + " minutes and "; + return result + _vm->_gyro->strf(s) + " seconds."; } @@ -320,67 +287,69 @@ void Acci::number(Common::String &codes) { warning("STUB: Acci::number()"); } -void Acci::cheatparse(Common::String codes) { +void Acci::cheatParse(Common::String codes) { uint16 num; int16 e; char cmd; int16 se, sx, sy; - warning("STUB: Acci::cheatparse()"); + warning("STUB: Acci::cheatParse()"); } -void Acci::punctustrip(Common::String &x) { /* Strips punctuation from x. */ + + +void Acci::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - for (byte fv = 0; fv < 32; fv++) + for (byte i = 0; i < 32; i++) do { - int16 p = _vm->_parser->pos(Common::String(punct[fv]), x); - if (p == -1) + int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); + if (pos == -1) break; - x.deleteChar(p); + word.deleteChar(pos); } while (true); } -void Acci::displaywhat(byte ch, bool animate, bool &ambigous) { /* << it's an adjective! */ - if (ch == pardon) { - ambigous = true; +void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { + if (target == kPardon) { + ambiguous = true; if (animate) _vm->_scrolls->display("Whom?"); else _vm->_scrolls->display("What?"); } else { if (animate) - _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getname(ch) + " }"); + _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getname(target) + " }"); else { - Common::String z = _vm->_gyro->get_better(ch); + Common::String z = _vm->_gyro->get_better(target); if (z != "") _vm->_scrolls->display(Common::String("{ ") + z + " }"); } } } -bool Acci::do_pronouns() { +bool Acci::doPronouns() { bool ambiguous = false; - for (byte fv = 0; fv < thats.size(); fv++) { - byte word = thats[fv]; - switch (word) { + for (byte i = 0; i < _thats.size(); i++) { + byte wordCode = _thats[i]; + switch (wordCode) { case 200: { - displaywhat(_vm->_gyro->him, true, ambiguous); - thats.setChar(_vm->_gyro->him, fv); + displayWhat(_vm->_gyro->him, true, ambiguous); + _thats.setChar(_vm->_gyro->him, i); } break; case 201: { - displaywhat(_vm->_gyro->her, true, ambiguous); - thats.setChar(_vm->_gyro->her, fv); + displayWhat(_vm->_gyro->her, true, ambiguous); + _thats.setChar(_vm->_gyro->her, i); } break; case 202: { - displaywhat(_vm->_gyro->it, false, ambiguous); - thats.setChar(_vm->_gyro->it, fv); + displayWhat(_vm->_gyro->it, false, ambiguous); + _thats.setChar(_vm->_gyro->it, i); } break; } @@ -391,12 +360,8 @@ bool Acci::do_pronouns() { -void Acci::lowercase() { +void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); -} - -void Acci::propernouns() { - lowercase(); // We set every word's first character to uppercase. for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) @@ -406,50 +371,50 @@ void Acci::propernouns() { _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); } -void Acci::sayit() { /* This makes Avalot say the response. */ +void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + '.' + _vm->_scrolls->kControlSpeechBubble + _vm->_scrolls->kControlRegister + '2'); } -void Acci::store_interrogation(byte interrogation) { +void Acci::storeInterrogation(byte interrogation) { if (_vm->_parser->_inputText.empty()) return; - /* Strip _vm->_parser->_inputText: */ + // Strip _vm->_parser->_inputText: while ((_vm->_parser->_inputText[0] == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteChar(0); while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // if you want to use any other timer, put this into the case statement. */ + _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { case 1: { - lowercase(); - sayit(); + _vm->_parser->_inputText.toLowercase(); + sayIt(); _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; _vm->_gyro->dna.cardiff_things = 2; } break; case 2: { - propernouns(); - sayit(); + properNouns(); + sayIt(); _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; _vm->_gyro->dna.cardiff_things = 3; } break; case 3: { - propernouns(); - sayit(); + properNouns(); + sayIt(); _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; _vm->_gyro->dna.cardiff_things = 4; } break; case 4: { - lowercase(); - sayit(); + _vm->_parser->_inputText.toLowercase(); + sayIt(); if (!_vm->_gyro->dna.spare_evening.empty()) _vm->_gyro->dna.spare_evening.clear(); _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; @@ -472,73 +437,64 @@ void Acci::store_interrogation(byte interrogation) { -void Acci::clearuint16s() { - warning("STUB: Acci::clearuint16s()"); -} - void Acci::parse() { - byte n, fv, ff; - Common::String c, cc, thisword; - byte answer; - bool notfound; - // First parsing - word identification - - if (!thats.empty()) - thats.clear(); - c = _vm->_parser->_inputText + ' '; - n = 0; - polite = false; - verb = pardon; - thing = pardon; - thing2 = pardon; - person = pardon; - clearwords(); + if (!_thats.empty()) + _thats.clear(); + + byte n = 0; + _polite = false; + _verb = kPardon; + _thing = kPardon; + _thing2 = kPardon; + _person = kPardon; + clearWords(); // A cheat mode attempt. if (_vm->_parser->_inputText[0] == '.') { - cheatparse(_vm->_parser->_inputText); - thats = nowt; + cheatParse(_vm->_parser->_inputText); + _thats = kNothing; return; } // Are we being interrogated right now? if (_vm->_gyro->interrogation > 0) { - store_interrogation(_vm->_gyro->interrogation); + storeInterrogation(_vm->_gyro->interrogation); _vm->_gyro->weirdword = true; return; } // Actually process the command. - cc = c; - c.toUppercase(); - while (!c.empty()) { - while ((!c.empty()) && (c[0] == ' ')) { - c.deleteChar(0); - cc.deleteChar(0); + Common::String inputText = _vm->_parser->_inputText + ' '; + Common::String inputTextUpper = inputText; + inputTextUpper.toUppercase(); + while (!inputTextUpper.empty()) { + while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) { + inputTextUpper.deleteChar(0); + inputText.deleteChar(0); } - if (c.empty()) + if (inputTextUpper.empty()) break; // Get the following word of the strings. - byte size = _vm->_parser->pos(Common::String(' '), c) + 1; + byte size = _vm->_parser->pos(Common::String(' '), inputTextUpper) + 1; char *subStr = new char[size]; - Common::strlcpy(subStr, c.c_str(), size); - thisword = subStr; - Common::strlcpy(subStr, cc.c_str(), size); - realwords[n] = subStr; + Common::strlcpy(subStr, inputTextUpper.c_str(), size); + Common::String thisword = subStr; + Common::strlcpy(subStr, inputText.c_str(), size); + _realWords[n] = subStr; delete[] subStr; - punctustrip(c); + stripPunctuation(inputTextUpper); - notfound = true; + bool notfound = true; // Check also[] first, which conatins words about the actual room. if (!thisword.empty()) { - for (ff = 0; ff < 31; ff++) { - if ((_vm->_gyro->also[ff][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) { - thats = thats + Common::String(99 + ff); + for (byte i = 0; i < 31; i++) { + if ((_vm->_gyro->also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->also[i][0]) > -1)) { + _thats = _thats + Common::String(99 + i); notfound = false; } } @@ -546,31 +502,31 @@ void Acci::parse() { // Check Accis's own table (words[]) for "global" commands. if (notfound) { - answer = wordnum(thisword); - if (answer == pardon) { + byte answer = wordNum(thisword); + if (answer == kPardon) { notfound = true; - thats = thats + pardon; + _thats = _thats + kPardon; } else - thats = thats + answer; + _thats = _thats + answer; n++; } // Delete words we already processed. - int16 spacePos = _vm->_parser->pos(Common::String(' '), c); + int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); if (spacePos > -1) for (byte i = 0; i <= spacePos; i++) - c.deleteChar(0); - spacePos = _vm->_parser->pos(Common::String(' '), cc); + inputTextUpper.deleteChar(0); + spacePos = _vm->_parser->pos(Common::String(' '), inputText); if (spacePos > -1) for (byte i = 0; i <= spacePos; i++) - cc.deleteChar(0); + inputText.deleteChar(0); } - if (_vm->_parser->pos(Common::String(254), thats) > -1) - unknown = realwords[_vm->_parser->pos(Common::String(254), thats)]; + if (_vm->_parser->pos(Common::String(254), _thats) > -1) + _unknown = _realWords[_vm->_parser->pos(Common::String(254), _thats)]; else - if (!unknown.empty()) - unknown.clear(); + if (!_unknown.empty()) + _unknown.clear(); // Replace words' codes that mean the same. replace(Common::String(255), 0); /* zap noise words */ @@ -584,7 +540,7 @@ void Acci::parse() { replace(Common::String(40) + 232, 21); // "put on" = "don" replace(Common::String(4) + 229, 20); // "take off" = "doff" - // Words that could mean more than one person + // Words that could mean more than one _person if (_vm->_gyro->dna.room == r__nottspub) replace(Common::String(204), 164); // Barman = Port else @@ -601,9 +557,9 @@ void Acci::parse() { replace(Common::String(203), 162); // Monk = Ibythneth } - if (do_pronouns()) { + if (doPronouns()) { _vm->_gyro->weirdword = true; - thats = nowt; + _thats = kNothing; return; } @@ -612,67 +568,67 @@ void Acci::parse() { _vm->_gyro->subject.clear(); _vm->_gyro->subjnumber = 0; // Find subject of conversation. - fv = 0; - while ((fv < 11) && !realwords[fv].empty()) { - if ((realwords[fv][0] == '\'') || (realwords[fv][0] == '\"')) { - _vm->_gyro->subjnumber = (byte)thats[fv]; - thats.setChar(moved, fv); + byte i = 0; + while ((i < 11) && !_realWords[i].empty()) { + if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { + _vm->_gyro->subjnumber = (byte)_thats[i]; + _thats.setChar(kMoved, i); break; } - fv++; + i++; } - if ((_vm->_gyro->subjnumber == 0) && !thats.empty()) // Still not found. - for (fv = 0; fv < thats.size() - 1; fv++) - if ((byte)thats[fv] == 252) { // The word is "about", or something similar. - _vm->_gyro->subjnumber = (byte)thats[fv + 1]; - thats.setChar(0, fv + 1); + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) // Still not found. + for (i = 0; i < _thats.size() - 1; i++) + if ((byte)_thats[i] == 252) { // The word is "about", or something similar. + _vm->_gyro->subjnumber = (byte)_thats[i + 1]; + _thats.setChar(0, i + 1); break; } - if ((_vm->_gyro->subjnumber == 0) && !thats.empty())// STILL not found! Must be the word after "say". - for (fv = 0; fv < thats.size() - 1; fv++) - if (((byte)thats[fv] == 7) && ((byte)thats[fv + 1] != 0) && !((225 <= (byte)thats[fv + 1]) && ((byte)thats[fv + 1] <= 229))) { + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty())// STILL not found! Must be the word after "say". + for (i = 0; i < _thats.size() - 1; i++) + if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition - _vm->_gyro->subjnumber = (byte)thats[fv + 1]; - thats.setChar(0, fv + 1); + _vm->_gyro->subjnumber = (byte)_thats[i + 1]; + _thats.setChar(0, i + 1); break; } - for (int8 fv = thats.size() - 1; fv >= 0; fv--) // Reverse order, so first will be used. - if (((byte)thats[fv] == 253) || ((byte)thats[fv] == 249) || ((1 <= (byte)thats[fv]) && ((byte)thats[fv] <= 49))) - verb = (byte)thats[fv]; - else if ((50 <= (byte)thats[fv]) && ((byte)thats[fv] <= 149)) { - thing2 = thing; - thing = (byte)thats[fv]; - } else if ((150 <= (byte)thats[fv]) && ((byte)thats[fv] <= 199)) - person = (byte)thats[fv]; - else if ((byte)thats[fv] == 251) - polite = true; - - if ((!unknown.empty()) && (verb != vb_exam) && (verb != vb_talk) && (verb != vb_save) && (verb != vb_load) && (verb != vb_dir)) { - _vm->_scrolls->display(Common::String("Sorry, but I have no idea what \"") + unknown + "\" means. Can you rephrase it?"); + for (int8 i = _thats.size() - 1; i >= 0; i--) // Reverse order, so first will be used. + if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) + _verb = (byte)_thats[i]; + else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { + _thing2 = _thing; + _thing = (byte)_thats[i]; + } else if ((150 <= (byte)_thats[i]) && ((byte)_thats[i] <= 199)) + _person = (byte)_thats[i]; + else if ((byte)_thats[i] == 251) + _polite = true; + + if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); _vm->_gyro->weirdword = true; } else _vm->_gyro->weirdword = false; - if (thats.empty()) - thats = nowt; + if (_thats.empty()) + _thats = kNothing; - if (thing != pardon) - _vm->_gyro->it = thing; + if (_thing != kPardon) + _vm->_gyro->it = _thing; - if (person != pardon) - if (person < 175) - _vm->_gyro->him = person; + if (_person != kPardon) + if (_person < 175) + _vm->_gyro->him = _person; else - _vm->_gyro->her = person; + _vm->_gyro->her = _person; } -void Acci::examobj() { - if (thing != _vm->_gyro->thinks) - _vm->_lucerna->thinkabout(thing, _vm->_gyro->a_thing); - switch (thing) { +void Acci::examineObject() { + if (_thing != _vm->_gyro->thinks) + _vm->_lucerna->thinkabout(_thing, _vm->_gyro->a_thing); + switch (_thing) { case _vm->_gyro->wine : switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine. case 1: @@ -693,15 +649,15 @@ void Acci::examobj() { _vm->_visa->dixi('t', 18); // Normal onion scroll break; default: - _vm->_visa->dixi('t', thing); // <<< Ordinarily + _vm->_visa->dixi('t', _thing); // <<< Ordinarily } } -bool Acci::personshere() { // Person equivalent of "holding". - if ((person == pardon) || (person == 0) || (_vm->_gyro->whereis[person - 150] == _vm->_gyro->dna.room)) +bool Acci::isPersonHere() { // Person equivalent of "holding". + if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->whereis[_person - 150] == _vm->_gyro->dna.room)) return true; else { - if (person < 175) + if (_person < 175) _vm->_scrolls->display(Common::String('H') + _vm->_scrolls->kControlToBuffer); else _vm->_scrolls->display(Common::String("Sh") + _vm->_scrolls->kControlToBuffer); @@ -711,11 +667,11 @@ bool Acci::personshere() { // Person equivalent of "holding". } void Acci::exampers() { - if (personshere()) { - if (thing != _vm->_gyro->thinks) - _vm->_lucerna->thinkabout(person, _vm->_gyro->a_person); - person -= 149; - switch (person) { /* Special cases */ + if (isPersonHere()) { + if (_thing != _vm->_gyro->thinks) + _vm->_lucerna->thinkabout(_person, _vm->_gyro->a_person); + _person -= 149; + switch (_person) { /* Special cases */ case 11: if (_vm->_gyro->dna.wonnim) { _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" @@ -730,23 +686,23 @@ void Acci::exampers() { break; } // Otherwise... - _vm->_visa->dixi('p', person); + _vm->_visa->dixi('p', _person); } // And afterwards... - if ((person == 14) && (!_vm->_gyro->dna.ayles_is_awake)) + if ((_person == 14) && (!_vm->_gyro->dna.ayles_is_awake)) _vm->_visa->dixi('Q', 13); } bool Acci::holding() { - if ((51 <= thing) && (thing <= 99)) // Also. + if ((51 <= _thing) && (_thing <= 99)) // Also. return true; bool holdingResult = false; - if (thing > 100) + if (_thing > 100) _vm->_scrolls->display("Be reasonable!"); - else if (!_vm->_gyro->dna.obj[thing - 1]) // Verbs that need "thing" to be in the inventory. + else if (!_vm->_gyro->dna.obj[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_scrolls->display("You're not holding it, Avvy."); else holdingResult = true; @@ -756,8 +712,8 @@ bool Acci::holding() { -void Acci::openBox(bool before) { - if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { +void Acci::openBox(bool isOpening) { + if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { _vm->_celer->show_one(-1, -1, 5); _vm->_celer->pics_link(); @@ -766,7 +722,7 @@ void Acci::openBox(bool before) { _vm->_system->delayMillis(55); - if (!before) { + if (!isOpening) { _vm->_celer->show_one(-1, -1, 6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); @@ -776,41 +732,41 @@ void Acci::openBox(bool before) { } void Acci::examine() { - // EITHER it's an object OR it's an Also OR it's a person OR it's something else. - if ((person == pardon) && (thing != pardon)) { + // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. + if ((_person == kPardon) && (_thing != kPardon)) { if (holding()) { // Remember: it's been Slipped! Ie subtract 49. - if ((1 <= thing) && (thing <= 49)) // Standard object - examobj(); - else if ((50 <= thing) && (thing <= 100)) { // Also thing + if ((1 <= _thing) && (_thing <= 49)) // Standard object + examineObject(); + else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_scrolls->display(*_vm->_gyro->also[thing - 50][1]); + _vm->_scrolls->display(*_vm->_gyro->also[_thing - 50][1]); openBox(false); } } - } else if (person != pardon) + } else if (_person != kPardon) exampers(); else _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. } -void Acci::inv() { /* the time-honoured command... */ - byte q = 0; +void Acci::inventory() { + byte itemNum = 0; _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); { - for (byte fv = 0; fv < numobjs; fv++) - if (_vm->_gyro->dna.obj[fv]) { - q++; - if (q == _vm->_gyro->dna.carrying) + for (byte i = 0; i < numobjs; i++) + if (_vm->_gyro->dna.obj[i]) { + itemNum++; + if (itemNum == _vm->_gyro->dna.carrying) _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->get_better(fv + 1) + _vm->_scrolls->kControlToBuffer); - if ((fv + 1) == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); + if ((i + 1) == _vm->_gyro->dna.wearing) _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); - if (q < _vm->_gyro->dna.carrying) + if (itemNum < _vm->_gyro->dna.carrying) _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); } - if (_vm->_gyro->dna.wearing == nowt) + if (_vm->_gyro->dna.wearing == kNothing) _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); else _vm->_scrolls->display("."); @@ -818,22 +774,22 @@ void Acci::inv() { /* the time-honoured command... */ } void Acci::swallow() { /* Eat something. */ - switch (thing) { + switch (_thing) { case _vm->_gyro->wine: switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ case 1: { - if (_vm->_gyro->dna.teetotal) { - _vm->_visa->dixi('D', 6); - return; - } - _vm->_visa->dixi('U', 1); - _vm->_pingo->wobble(); - _vm->_visa->dixi('U', 2); - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; - _vm->_lucerna->objectlist(); - have_a_drink(); + if (_vm->_gyro->dna.teetotal) { + _vm->_visa->dixi('D', 6); + return; } - break; + _vm->_visa->dixi('U', 1); + _vm->_pingo->wobble(); + _vm->_visa->dixi('U', 2); + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_lucerna->objectlist(); + drink(); + } + break; case 2: case 3: _vm->_visa->dixi('d', 8); @@ -859,7 +815,8 @@ void Acci::swallow() { /* Eat something. */ } break; case _vm->_gyro->onion: - if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('U', 11); + if (_vm->_gyro->dna.rotten_onion) + _vm->_visa->dixi('U', 11); else { _vm->_visa->dixi('U', 8); _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; @@ -871,70 +828,95 @@ void Acci::swallow() { /* Eat something. */ _vm->_scrolls->display("Try BUYing things before you drink them!"); else _vm->_scrolls->display("The taste of it makes you retch!"); - /* Constant- leave this one */ } } -void Acci::others() { -/* This lists the other people in the room. */ - warning("STUB: Acci::others()"); +void Acci::peopleInRoom() { + byte numPeople = 0; // Number of people in the room. + + for (byte i = 1; i < 29; i++) // Start at 1 so we don't list Avvy himself! + if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) + numPeople++; + + if (numPeople == 0) // If nobody's here, we can cut out straight away. + return; + + byte actPerson = 0; // Actually listed people. + for (byte i = 1; i < 29; i++) + if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) { + actPerson++; + if (actPerson == 1) // First on the list. + _vm->_scrolls->display(_vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + else if (actPerson < numPeople) // The middle... + _vm->_scrolls->display(Common::String(", ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + else // The end. + _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + } + + if (numPeople == 1) + _vm->_scrolls->display(Common::String(" is") + _vm->_scrolls->kControlToBuffer); + else + _vm->_scrolls->display(Common::String(" are") + _vm->_scrolls->kControlToBuffer); + + _vm->_scrolls->display(" here."); // End and display it. } -void Acci::lookaround() { -/* This is called when you say "look." */ +void Acci::lookAround() { _vm->_scrolls->display(*_vm->_gyro->also[0][1]); switch (_vm->_gyro->dna.room) { case r__spludwicks: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('q', 23); + _vm->_visa->dixi('pos', 23); else - others(); + peopleInRoom(); break; case r__robins: if (_vm->_gyro->dna.tied_up) - _vm->_visa->dixi('q', 38); + _vm->_visa->dixi('pos', 38); if (_vm->_gyro->dna.mushroom_growing) - _vm->_visa->dixi('q', 55); + _vm->_visa->dixi('pos', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->dna.taken_pen) - _vm->_visa->dixi('q', 49); + _vm->_visa->dixi('pos', 49); break; case r__lustiesroom: if (_vm->_gyro->dna.lustie_is_asleep) - _vm->_visa->dixi('q', 65); + _vm->_visa->dixi('pos', 65); break; case r__catacombs: switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { case 258 : - _vm->_visa->dixi('q', 80); - break; /* Inside art gallery */ + _vm->_visa->dixi('pos', 80); // Inside art gallery. + break; case 514 : - _vm->_visa->dixi('q', 81); - break; /* Outside ditto */ + _vm->_visa->dixi('pos', 81); // Outside ditto. + break; case 260 : - _vm->_visa->dixi('q', 82); - break; /* Outside Geida's room. */ + _vm->_visa->dixi('pos', 82); // Outside Geida's room. + break; } break; default: - others(); + peopleInRoom(); } } -void Acci::opendoor() { /* so whaddya THINK this does?! */ - switch (_vm->_gyro->dna.room) { /* Special cases. */ +void Acci::openDoor() { + // Special cases. + switch (_vm->_gyro->dna.room) { case r__yours: if (_vm->_trip->infield(2)) { - /* Opening the box. */ - thing = 54; /* The box. */ person = pardon; + // Opening the box. + _thing = 54; // The box. + _person = kPardon; examine(); return; } break; case r__spludwicks: - if (thing == 61) { - _vm->_visa->dixi('q', 85); + if (_thing == 61) { + _vm->_visa->dixi('pos', 85); return; } break; @@ -942,7 +924,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) - return; /* No doors can open if you can't move Avvy. */ + return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) if (_vm->_trip->infield(fv + 1)) { @@ -951,7 +933,7 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ switch (_vm->_gyro->portals[fv].op) { case _vm->_gyro->exclaim: _vm->_trip->tr[0].bounce(); - _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); + _vm->_visa->dixi('word', _vm->_gyro->portals[fv].data); break; case _vm->_gyro->transport: _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); @@ -981,26 +963,25 @@ void Acci::opendoor() { /* so whaddya THINK this does?! */ - void Acci::silly() { _vm->_scrolls->display("Don't be silly!"); } -void Acci::putproc() { /* Called when you call vb_put. */ +void Acci::putProc() { if (!holding()) return; - thing2 -= 49; /* Slip the second object */ - char temp = thing; - thing = thing2; + _thing2 -= 49; // Slip the second object. + char temp = _thing; + _thing = _thing2; if (!holding()) return; - thing = temp; + _thing = temp; - // Thing is the thing which you're putting in. Thing2 is where you're putting it. - switch (thing2) { + // Thing is the _thing which you're putting in. _thing2 is where you're putting it. + switch (_thing2) { case _vm->_gyro->wine: - if (thing == _vm->_gyro->onion) { + if (_thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.rotten_onion) _vm->_scrolls->display("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? @@ -1019,10 +1000,10 @@ void Acci::putproc() { /* Called when you call vb_put. */ case 54: if (_vm->_gyro->dna.room == r__yours) { // Put something into the box. - if (_vm->_gyro->dna.box_contents != nowt) + if (_vm->_gyro->dna.box_contents != kNothing) _vm->_scrolls->display("There's something in the box already, Avvy. Try taking that out first."); else { - switch (thing) { + switch (_thing) { case _vm->_gyro->money: _vm->_scrolls->display("You'd better keep some ready cash on you!"); break; @@ -1036,19 +1017,17 @@ void Acci::putproc() { /* Called when you call vb_put. */ _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_gyro->dna.wearing == thing) - _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(thing) + " off first!"); + if (_vm->_gyro->dna.wearing == _thing) + _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(_thing) + " off first!"); else { - //_vm->_celer->show_one(-1, -1, 5); // Open box. - openBox(true); + openBox(true); // Open box. - _vm->_gyro->dna.box_contents = thing; - _vm->_gyro->dna.obj[thing - 1] = false; + _vm->_gyro->dna.box_contents = _thing; + _vm->_gyro->dna.obj[_thing - 1] = false; _vm->_lucerna->objectlist(); _vm->_scrolls->display("OK, it's in the box."); - //_vm->_celer->show_one(-1, -1, 6); // Shut box. - openBox(false); + openBox(false); // Shut box. } } } @@ -1062,36 +1041,34 @@ void Acci::putproc() { /* Called when you call vb_put. */ } -/* The result of this fn is whether or not he says "Hey, thanks!" */ -void Acci::not_in_order() { + +void Acci::notInOrder() { _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } -void Acci::go_to_cauldron() { - _vm->_trip->tr[1].call_eachstep = false; /* Stops Geida_Procs. */ +void Acci::goToCauldron() { + _vm->_trip->tr[1].call_eachstep = false; // Stops Geida_Procs. _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); _vm->_trip->tr[1].walkto(2); } -bool Acci::give2spludwick() { - bool give2spludwick_result = false; - - if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != thing) { - not_in_order(); - return give2spludwick_result; +bool Acci::giveToSpludwick() { + if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != _thing) { + notInOrder(); + return false; } - switch (thing) { + switch (_thing) { case _vm->_gyro->onion: _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; if (_vm->_gyro->dna.rotten_onion) - _vm->_visa->dixi('q', 22); + _vm->_visa->dixi('pos', 22); else { _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('q', 20); - go_to_cauldron(); + _vm->_visa->dixi('pos', 20); + goToCauldron(); _vm->_lucerna->points(3); } _vm->_lucerna->objectlist(); @@ -1100,30 +1077,28 @@ bool Acci::give2spludwick() { _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('q', 24); - go_to_cauldron(); + _vm->_visa->dixi('pos', 24); + goToCauldron(); _vm->_lucerna->points(3); break; case _vm->_gyro->mushroom: _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; - _vm->_visa->dixi('q', 25); + _vm->_visa->dixi('pos', 25); _vm->_lucerna->points(5); _vm->_gyro->dna.given2spludwick++; - go_to_cauldron(); + goToCauldron(); _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; _vm->_lucerna->objectlist(); break; default: - give2spludwick_result = true; + return true; } - - return give2spludwick_result; } -void Acci::have_a_drink() { +void Acci::drink() { _vm->_gyro->dna.alcohol += 1; if (_vm->_gyro->dna.alcohol == 5) { - _vm->_gyro->dna.obj[_vm->_gyro->key - 1] = true; /* Get the key. */ + _vm->_gyro->dna.obj[_vm->_gyro->key - 1] = true; // Get the key. _vm->_gyro->dna.teetotal = true; _vm->_gyro->dna.avvy_is_awake = false; _vm->_gyro->dna.avvy_in_bed = true; @@ -1132,11 +1107,11 @@ void Acci::have_a_drink() { _vm->_gyro->hang_around_for_a_while(); _vm->_trip->fliproom(1, 1); _vm->_gyro->background(14); - _vm->_trip->new_game_for_trippancy(); /* Not really */ + _vm->_trip->new_game_for_trippancy(); // Not really. } } -void Acci::cardiff_climbing() { +void Acci::cardiffClimbing() { if (_vm->_gyro->dna.standing_on_dais) { // Clamber up. _vm->_scrolls->display("You climb down, back onto the floor."); _vm->_gyro->dna.standing_on_dais = false; @@ -1151,15 +1126,16 @@ void Acci::cardiff_climbing() { } } -/* Called when you ask Avvy to stand. */ + + void Acci::already() { _vm->_scrolls->display("You're already standing!"); } -void Acci::stand_up() { +void Acci::standUp() { switch (_vm->_gyro->dna.room) { - case r__yours: /* Avvy isn't asleep. */ - if (_vm->_gyro->dna.avvy_is_awake && _vm->_gyro->dna.avvy_in_bed) { /* But he's in bed. */ + case r__yours: // Avvy isn't asleep. + if (_vm->_gyro->dna.avvy_is_awake && _vm->_gyro->dna.avvy_in_bed) { // But he's in bed. if (_vm->_gyro->dna.teetotal) { _vm->_visa->dixi('d', 12); _vm->_gyro->background(0); @@ -1169,7 +1145,7 @@ void Acci::stand_up() { _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(-1, -1, 4); /* Picture of empty pillow. */ + _vm->_celer->show_one(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); @@ -1178,16 +1154,16 @@ void Acci::stand_up() { break; case r__insidecardiffcastle: - cardiff_climbing(); + cardiffClimbing(); break; case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { - _vm->_celer->show_one(-1, -1, 4); /* Not sitting down. */ - _vm->_trip->tr[0].visible = true; /* But standing up. */ - _vm->_trip->apped(1, 4); /* And walking away. */ - _vm->_gyro->dna.sitting_in_pub = false; /* Really not sitting down. */ - _vm->_gyro->dna.user_moves_avvy = true; /* And ambulant. */ + _vm->_celer->show_one(-1, -1, 4); // Not sitting down. + _vm->_trip->tr[0].visible = true; // But standing up. + _vm->_trip->apped(1, 4); // And walking away. + _vm->_gyro->dna.sitting_in_pub = false; // Really not sitting down. + _vm->_gyro->dna.user_moves_avvy = true; // And ambulant. } else already(); break; @@ -1197,7 +1173,8 @@ void Acci::stand_up() { } -void Acci::getproc(char thing) { + +void Acci::getProc(char thing) { switch (_vm->_gyro->dna.room) { case r__yours: if (_vm->_trip->infield(2)) { @@ -1206,40 +1183,38 @@ void Acci::getproc(char thing) { _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->dna.obj[thing - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.box_contents = nowt; + _vm->_gyro->dna.box_contents = kNothing; _vm->_celer->show_one(-1, -1, 6); } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else - _vm->_visa->dixi('q', 57); + _vm->_visa->dixi('pos', 57); break; case r__insidecardiffcastle: switch (thing) { case _vm->_gyro->pen: - if (_vm->_trip->infield(2)) { - /* Standing on the dais. */ - + if (_vm->_trip->infield(2)) { // Standing on the dais. if (_vm->_gyro->dna.taken_pen) _vm->_scrolls->display("It's not there, Avvy."); else { - /* OK: we're taking the pen, and it's there. */ - _vm->_celer->show_one(-1, -1, 4); /* No pen there now. */ - _vm->_trip->call_special(3); /* Zap! */ + // OK: we're taking the pen, and it's there. + _vm->_celer->show_one(-1, -1, 4); // No pen there now. + _vm->_trip->call_special(3); // Zap! _vm->_gyro->dna.taken_pen = true; _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; _vm->_lucerna->objectlist(); _vm->_scrolls->display("Taken."); } } else if (_vm->_gyro->dna.standing_on_dais) - _vm->_visa->dixi('q', 53); + _vm->_visa->dixi('pos', 53); else - _vm->_visa->dixi('q', 51); + _vm->_visa->dixi('pos', 51); break; case _vm->_gyro->bolt: - _vm->_visa->dixi('q', 52); + _vm->_visa->dixi('pos', 52); break; default: - _vm->_visa->dixi('q', 57); + _vm->_visa->dixi('pos', 57); } break; case r__robins: @@ -1252,37 +1227,35 @@ void Acci::getproc(char thing) { _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); } else - _vm->_visa->dixi('q', 57); + _vm->_visa->dixi('pos', 57); break; default: - _vm->_visa->dixi('q', 57); + _vm->_visa->dixi('pos', 57); } } -void Acci::give_geida_the_lute() { +void Acci::giveGeidaTheLute() { if (_vm->_gyro->dna.room != r__lustiesroom) { _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; _vm->_lucerna->objectlist(); - _vm->_visa->dixi('q', 64); /* She plays it. */ - - /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ + _vm->_visa->dixi('pos', 64); // She plays it. _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_enid->back_to_bootstrap(4); } -void Acci::play_harp() { +void Acci::playHarp() { if (_vm->_trip->infield(7)) _vm->_scrolls->musical_scroll(); else _vm->_scrolls->display("Get a bit closer to it, Avvy!"); } -void Acci::winsequence() { - _vm->_visa->dixi('q', 78); +void Acci::winSequence() { + _vm->_visa->dixi('pos', 78); _vm->_sequence->first_show(7); _vm->_sequence->then_show(8); _vm->_sequence->then_show(9); @@ -1290,145 +1263,131 @@ void Acci::winsequence() { _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); } -void Acci::person_speaks() { - bool found; - byte fv; - char cfv; - - - if ((person == pardon) || (person == 0)) - if ((_vm->_gyro->him == pardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) - person = _vm->_gyro->her; +void Acci::personSpeaks() { + if ((_person == kPardon) || (_person == 0)) + if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) + _person = _vm->_gyro->her; else - person = _vm->_gyro->him; + _person = _vm->_gyro->him; - if (_vm->_gyro->whereis[person - 150] != _vm->_gyro->dna.room) { + if (_vm->_gyro->whereis[_person - 150] != _vm->_gyro->dna.room) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! return; } - found = false; /* The person we're looking for's code is in Person. */ + bool found = false; // The _person we're looking for's code is in _person. - for (fv = 0; fv < _vm->_trip->numtr; fv++) { - if (_vm->_trip->tr[fv].quick && ((_vm->_trip->tr[fv].a.accinum + 149) == person)) { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(fv + 49) + _vm->_scrolls->kControlToBuffer); + for (byte i = 0; i < _vm->_trip->numtr; i++) { + if (_vm->_trip->tr[i].quick && ((_vm->_trip->tr[i].a.accinum + 149) == _person)) { + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } } if (!found) - for (fv = 0; fv < 16; fv++) - if ((_vm->_gyro->quasipeds[fv].who == person) && (_vm->_gyro->quasipeds[fv].room == _vm->_gyro->dna.room)) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(fv + 65) + _vm->_scrolls->kControlToBuffer); + for (byte i = 0; i < 16; i++) + if ((_vm->_gyro->quasipeds[i].who == _person) && (_vm->_gyro->quasipeds[i].room == _vm->_gyro->dna.room)) + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); } -void Acci::heythanks() { - person_speaks(); +void Acci::heyThanks() { + personSpeaks(); _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); - _vm->_gyro->dna.obj[thing - 1] = false; + _vm->_gyro->dna.obj[_thing - 1] = false; } -void Acci::do_that() { +void Acci::doThat() { const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; - byte fv, ff; - int16 sx, sy; - bool ok; - - if (thats == Common::String(nowt)) { - if (!thats.empty()) - thats.clear(); + if (_thats == Common::String(kNothing)) { + if (!_thats.empty()) + _thats.clear(); return; } if (_vm->_gyro->weirdword) return; - if (thing < 200) - thing -= 49; // "Slip" + if (_thing < 200) + _thing -= 49; // "Slip" - if ((verb != vb_load) && (verb != vb_save) && (verb != vb_quit) && (verb != vb_info) && (verb != vb_help) - && (verb != vb_larrypass) && (verb != vb_phaon) && (verb != vb_boss) && (verb != vb_cheat) && (verb != vb_restart) && (verb != vb_dir) - && (verb != vb_score) && (verb != vb_highscores) && (verb != vb_smartalec)) { + if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) + && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) + && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHighscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->alive) { _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); return; } - if (!_vm->_gyro->dna.avvy_is_awake && (verb != vb_die) && (verb != vb_expletive) && (verb != vb_wake)) { + if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_scrolls->display("Talking in your sleep? Try waking up!"); return; } } - switch (verb) { - case vb_exam: + switch (_verb) { + case kVerbCodeExam: examine(); break; - case vb_open: - opendoor(); + case kVerbCodeOpen: + openDoor(); break; - case vb_pause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. + case kVerbCodePause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. _vm->_scrolls->display(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue."); break; - case vb_get: - if (thing != pardon) { - /* Legitimate try to pick something up. */ + case kVerbCodeGet: + if (_thing != kPardon) { // Legitimate try to pick something up. if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("You can't carry any more!"); else - getproc(thing); - - } else { - /* Not... ditto. */ - if (person != pardon) + getProc(_thing); + } else { // Not... ditto. + if (_person != kPardon) _vm->_scrolls->display("You can't sweep folk off their feet!"); else _vm->_scrolls->display("I assure you, you don't need it."); } break; - case vb_drop: + case kVerbCodeDrop: _vm->_scrolls->display(Common::String("Two years ago you dropped a florin in the street. Three days ") + "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; - /* begin _vm->_gyro->dna.obj[thing]:=false; _vm->_lucerna->objectlist(); end;*/ - case vb_inv: - inv(); + case kVerbCodeInv: + inventory(); break; - case vb_talk: - if (person == pardon) { - if (_vm->_gyro->subjnumber == 99) /* They typed "say password". */ - _vm->_scrolls->display(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); + case kVerbCodeTalk: + if (_person == kPardon) { + if (_vm->_gyro->subjnumber == 99) // They typed "say password". + _vm->_scrolls->display(Common::String("Yes, but kWhat ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); else if (((1 <= _vm->_gyro->subjnumber) && (_vm->_gyro->subjnumber <= 49)) || (_vm->_gyro->subjnumber == 253) || (_vm->_gyro->subjnumber == 449)) { - thats.deleteChar(0); + _thats.deleteChar(0); for (byte i = 0; i < 10; i++) - realwords[i] = realwords[i + 1]; - //move(realwords[2], realwords[1], sizeof(realwords) - sizeof(realwords[1])); + _realWords[i] = _realWords[i + 1]; - verb = _vm->_gyro->subjnumber; - do_that(); + _verb = _vm->_gyro->subjnumber; + doThat(); return; } else { - person = _vm->_gyro->subjnumber; + _person = _vm->_gyro->subjnumber; _vm->_gyro->subjnumber = 0; - if ((person == 0) || (person == pardon)) + if ((_person == 0) || (_person == kPardon)) _vm->_scrolls->display("Talk to whom?"); - else if (personshere()) - _vm->_visa->talkto(person); + else if (isPersonHere()) + _vm->_visa->talkto(_person); } - } else if (person == pardon) + } else if (_person == kPardon) _vm->_scrolls->display("Talk to whom?"); - else if (personshere()) - _vm->_visa->talkto(person); + else if (isPersonHere()) + _vm->_visa->talkto(_person); break; - case vb_give: + case kVerbCodeGive: if (holding()) { - if (person == pardon) + if (_person == kPardon) _vm->_scrolls->display("Give to whom?"); - else if (personshere()) { - switch (thing) { + else if (isPersonHere()) { + switch (_thing) { case _vm->_gyro->money : _vm->_scrolls->display("You can't bring yourself to give away your moneybag."); break; @@ -1439,27 +1398,27 @@ void Acci::do_that() { _vm->_scrolls->display("Don't give it away, it might be useful!"); break; default: - switch (person) { + switch (_person) { case _vm->_gyro->pcrapulus: - if (thing == _vm->_gyro->wine) { + if (_thing == _vm->_gyro->wine) { _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; } else - heythanks(); + heyThanks(); break; case _vm->_gyro->pcwytalot: - if ((thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) + if ((_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) _vm->_scrolls->display(Common::String("You might be able to influence Cwytalot more if you used it!")); else - heythanks(); + heyThanks(); break; case _vm->_gyro->pspludwick: - if (give2spludwick()) - heythanks(); + if (giveToSpludwick()) + heyThanks(); break; case _vm->_gyro->pibythneth: - if (thing == _vm->_gyro->badge) { - _vm->_visa->dixi('q', 32); /* Thanks! Wow! */ + if (_thing == _vm->_gyro->badge) { + _vm->_visa->dixi('pos', 32); // Thanks! Wow! _vm->_lucerna->points(3); _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; @@ -1467,96 +1426,96 @@ void Acci::do_that() { _vm->_celer->show_one(-1, -1, 8); _vm->_celer->show_one(-1, -1, 9); } else - heythanks(); + heyThanks(); break; case _vm->_gyro->payles: if (_vm->_gyro->dna.ayles_is_awake) { - if (thing == _vm->_gyro->pen) { + if (_thing == _vm->_gyro->pen) { _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; - _vm->_visa->dixi('q', 54); + _vm->_visa->dixi('pos', 54); _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = true; _vm->_gyro->dna.given_pen_to_ayles = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(2); } else - heythanks(); + heyThanks(); } else _vm->_scrolls->display("But he's asleep!"); break; case _vm->_gyro->pgeida: - switch (thing) { + switch (_thing) { case _vm->_gyro->potion: _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = false; - _vm->_visa->dixi('u', 16); /* She drinks it. */ + _vm->_visa->dixi('u', 16); // She drinks it. _vm->_lucerna->points(2); _vm->_gyro->dna.geida_given_potion = true; _vm->_lucerna->objectlist(); break; case _vm->_gyro->lute: - give_geida_the_lute(); + giveGeidaTheLute(); break; default: - heythanks(); + heyThanks(); } break; case _vm->_gyro->parkata: - switch (thing) { + switch (_thing) { case _vm->_gyro->potion: if (_vm->_gyro->dna.geida_given_potion) - winsequence(); + winSequence(); else - _vm->_visa->dixi('q', 77); - break; /* That Geida woman! */ + _vm->_visa->dixi('pos', 77); // That Geida woman! + break; default: - heythanks(); + heyThanks(); } break; default: - heythanks(); + heyThanks(); } } } - _vm->_lucerna->objectlist(); /* Just in case... */ + _vm->_lucerna->objectlist(); // Just in case... } break; - case vb_eat: - case vb_drink: + case kVerbCodeEat: + case kVerbCodeDrink: if (holding()) swallow(); break; - case vb_load: + case kVerbCodeLoad: break; - case vb_save: + case kVerbCodeSave: break; // We don't handle these two because we use ScummVM's save/load system. - case vb_pay: + case kVerbCodePay: _vm->_scrolls->display("No money need change hands."); break; - case vb_look: - lookaround(); + case kVerbCodeLook: + lookAround(); break; - case vb_break: + case kVerbCodeBreak: _vm->_scrolls->display("Vandalism is prohibited within this game!"); break; - case vb_quit: /* quit */ + case kVerbCodeQuit: /* quit */ if (_vm->_gyro->demo) { - warning("STUB: Acci::do_that() - case vb_quit"); - // _vm->_visa->dixi('q', 31); + warning("STUB: Acci::doThat() - case kVerbCodequit"); + // _vm->_visa->dixi('pos', 31); // close(demofile); // exit(0); /* Change this later!!! */ } - if (!polite) + if (!_polite) _vm->_scrolls->display("How about a `please\", Avvy?"); else if (_vm->_scrolls->ask(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) _vm->_gyro->lmo = true; break; - case vb_go: + case kVerbCodeGo: _vm->_scrolls->display("Just use the arrow keys to walk there."); break; - case vb_info: { + case kVerbCodeInfo: { _vm->_scrolls->aboutscroll = true; Common::String toDisplay; @@ -1572,89 +1531,88 @@ void Acci::do_that() { _vm->_scrolls->aboutscroll = false; } break; - case vb_undress: - if (_vm->_gyro->dna.wearing == nowt) + case kVerbCodeUndress: + if (_vm->_gyro->dna.wearing == kNothing) _vm->_scrolls->display("You're already stark naked!"); else if (_vm->_gyro->dna.avvys_in_the_cupboard) { _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->get_better(_vm->_gyro->dna.wearing) + '.'); - _vm->_gyro->dna.wearing = nowt; + _vm->_gyro->dna.wearing = kNothing; _vm->_lucerna->objectlist(); } else _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); break; - case vb_wear: - if (holding()) { /* wear something */ - switch (thing) { + case kVerbCodeWear: + if (holding()) { // Wear something. + switch (_thing) { case _vm->_gyro->chastity: - _vm->_scrolls->display("Hey, what kind of a weirdo are you??!"); + _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??!"); break; case _vm->_gyro->clothes: case _vm->_gyro->habit: { /* Change this! */ - if (_vm->_gyro->dna.wearing != nowt) { - if (_vm->_gyro->dna.wearing == thing) + if (_vm->_gyro->dna.wearing != kNothing) { + if (_vm->_gyro->dna.wearing == _thing) _vm->_scrolls->display("You're already wearing that."); else _vm->_scrolls->display("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_gyro->dna.wearing = thing; + _vm->_gyro->dna.wearing = _thing; _vm->_lucerna->objectlist(); - if (thing == _vm->_gyro->habit) - fv = 3; + byte i; + if (_thing == _vm->_gyro->habit) + i = 3; else - fv = 0; - - if (_vm->_trip->tr[0].whichsprite != fv) { - sx = _vm->_trip->tr[0].x; - sy = _vm->_trip->tr[0].y; + i = 0; + if (_vm->_trip->tr[0].whichsprite != i) { + int16 x = _vm->_trip->tr[0].x; + int16 y = _vm->_trip->tr[0].y; _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(fv, true, _vm->_trip); - _vm->_trip->tr[0].appear(sx, sy, _vm->_trip->left); + _vm->_trip->tr[0].init(i, true, _vm->_trip); + _vm->_trip->tr[0].appear(x, y, _vm->_trip->left); _vm->_trip->tr[0].visible = false; } } break; default: - _vm->_scrolls->display(what); + _vm->_scrolls->display(kWhat); } } break; - case vb_play: - if (thing == pardon) { - switch (_vm->_gyro->dna.room) { /* They just typed "play"... */ - case r__argentpub: { /* ...in the pub, => play Nim. */ - warning("STUB: Acci::do_that() - case vb_play"); + case kVerbCodePlay: + if (_thing == kPardon) { + switch (_vm->_gyro->dna.room) { // They just typed "play"... + case r__argentpub: { // ...in the pub, => play Nim. + warning("STUB: Acci::doThat() - case kVerbCodeplay"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_gyro->dna.wonnim) { - /* Already won the game. */ + if (_vm->_gyro->dna.wonnim) { // Already won the game. _vm->_visa->dixi('Q', 6); return; } if (!_vm->_gyro->dna.asked_dogfood_about_nim) { - _vm->_visa->dixi('q', 84); + _vm->_visa->dixi('pos', 84); return; } _vm->_visa->dixi('Q', 3); _vm->_gyro->dna.playednim++; - /* You won - strange! */ + // You won - strange! _vm->_logger->log_aside("You won."); - _vm->_visa->dixi('Q', 7); /* You won! Give us a lute! */ + _vm->_visa->dixi('Q', 7); // You won! Give us a lute! _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.wonnim = true; - _vm->_celer->show_one(-1, -1, 1); /* Show the settle with no lute on it. */ - _vm->_lucerna->points(7); /* 7 points for winning! */ + _vm->_celer->show_one(-1, -1, 1); // Show the settle with no lute on it. + _vm->_lucerna->points(7); // 7 points for winning! if (_vm->_gyro->dna.playednim == 1) - _vm->_lucerna->points(3); /* 3 points for playing your 1st game. */ + _vm->_lucerna->points(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1662,11 +1620,11 @@ void Acci::do_that() { } break; case r__musicroom: - play_harp(); + playHarp(); break; } } else if (holding()) { - switch (thing) { + switch (_thing) { case _vm->_gyro->lute : { _vm->_visa->dixi('U', 7); @@ -1679,47 +1637,47 @@ void Acci::do_that() { break; case 52: if (_vm->_gyro->dna.room == r__musicroom) - play_harp(); + playHarp(); else - _vm->_scrolls->display(what); + _vm->_scrolls->display(kWhat); break; case 55: if (_vm->_gyro->dna.room == r__argentpub) // play_nim(); - warning("STUB: Acci::do_that() - case vb_play"); + warning("STUB: Acci::doThat() - case kVerbCodeplay"); else - _vm->_scrolls->display(what); + _vm->_scrolls->display(kWhat); break; default: - _vm->_scrolls->display(what); + _vm->_scrolls->display(kWhat); } } break; - case vb_ring: + case kVerbCodeRing: if (holding()) { - if (thing == _vm->_gyro->bell) { + if (_thing == _vm->_gyro->bell) { _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) _vm->_scrolls->display("(Are you trying to join in, Avvy??!)"); } else - _vm->_scrolls->display(what); + _vm->_scrolls->display(kWhat); } break; - case vb_help: + case kVerbCodeHelp: // boot_help(); - warning("STUB: Acci::do_that() - case vb_help"); + warning("STUB: Acci::doThat() - case kVerbCodehelp"); break; - case vb_larrypass: + case kVerbCodeLarrypass: _vm->_scrolls->display("Wrong game!"); break; - case vb_phaon: + case kVerbCodePhaon: _vm->_scrolls->display("Hello, Phaon!"); break; - case vb_boss: + case kVerbCodeBoss: // bosskey(); - warning("STUB: Acci::do_that() - case vb_boss"); + warning("STUB: Acci::doThat() - case kVerbCodeboss"); break; - case vb_pee: + case kVerbCodePee: if (_vm->_gyro->flagset('P')) { _vm->_scrolls->display("Hmm, I don't think anyone will notice..."); _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); @@ -1727,20 +1685,20 @@ void Acci::do_that() { _vm->_scrolls->display(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); break; - case vb_cheat: + case kVerbCodeCheat: _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); _vm->_gyro->cheat = true; break; - case vb_magic: + case kVerbCodeMagic: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('q', 19); + _vm->_visa->dixi('pos', 19); else { if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! - _vm->_visa->dixi('q', 17); + _vm->_visa->dixi('pos', 17); if (_vm->_gyro->whereis[1] == 12) - _vm->_visa->dixi('q', 18); + _vm->_visa->dixi('pos', 18); else { - _vm->_trip->tr[1].init(1, false, _vm->_trip); /* Avaricius */ + _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius _vm->_trip->apped(2, 4); _vm->_trip->tr[1].walkto(5); _vm->_trip->tr[1].call_eachstep = true; @@ -1752,10 +1710,10 @@ void Acci::do_that() { _vm->_scrolls->display("Nothing appears to happen..."); } break; - case vb_smartalec: + case kVerbCodeSmartAlec: _vm->_scrolls->display("Listen, smart alec, that was just rhetoric."); break; - case vb_expletive: + case kVerbCodeExpletive: switch (_vm->_gyro->dna.swore) { case 0: _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!") @@ -1773,7 +1731,7 @@ void Acci::do_that() { } _vm->_gyro->dna.swore++; break; - case vb_listen: + case kVerbCodeListen: if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) _vm->_scrolls->display("All other noise is drowned out by the ringing of the bells."); else if (_vm->_gyro->listen.empty()) @@ -1781,11 +1739,11 @@ void Acci::do_that() { else _vm->_scrolls->display(_vm->_gyro->listen); break; - case vb_buy: // What are they trying to buy? + case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->dna.room) { case r__argentpub: if (_vm->_trip->infield(6)) { // We're in a pub, and near the bar. - switch (thing) { + switch (_thing) { case 51: case 53: case 54: @@ -1804,8 +1762,8 @@ void Acci::do_that() { _vm->_lucerna->points(3); _vm->_celer->show_one(-1, -1, 12); - _vm->_scrolls->display(booze[thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); - _vm->_gyro->dna.drinking = thing; + _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_gyro->dna.drinking = _thing; _vm->_celer->show_one(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; @@ -1845,7 +1803,7 @@ void Acci::do_that() { case r__outsideducks: if (_vm->_trip->infield(6)) { - if (thing == _vm->_gyro->onion) { + if (_thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->dna.carrying >= maxobjs) @@ -1877,9 +1835,9 @@ void Acci::do_that() { _vm->_visa->dixi('D', 0); // Can't buy that. } break; - case vb_attack: + case kVerbCodeAttack: if ((_vm->_gyro->dna.room == r__brummieroad) && - ((person == 157) || (thing == _vm->_gyro->crossbow) || (thing == _vm->_gyro->bolt)) + ((_person == 157) || (_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) && (_vm->_gyro->whereis[7] == _vm->_gyro->dna.room)) { switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. @@ -1912,16 +1870,16 @@ void Acci::do_that() { } else _vm->_visa->dixi('Q', 10); break; - case vb_password: + case kVerbCodePassword: if (_vm->_gyro->dna.room != r__bridge) _vm->_visa->dixi('Q', 12); else { - ok = true; - for (ff = 0; ff < thats.size(); ff++) { - Common::String temp = realwords[ff]; + bool ok = true; + for (byte i = 0; i < _thats.size(); i++) { + Common::String temp = _realWords[i]; temp.toUppercase(); - for (fv = 0; fv < words[_vm->_gyro->dna.pass_num + first_password].w.size(); fv++) - if (words[_vm->_gyro->dna.pass_num + first_password].w[fv] != temp[fv]) + for (byte i = 0; i < kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word.size(); i++) + if (kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word[i] != temp[i]) ok = false; } @@ -1938,28 +1896,28 @@ void Acci::do_that() { _vm->_visa->dixi('Q', 12); } break; - case vb_dir: - _vm->_enid->dir(realwords[1]); + case kVerbCodeDir: + _vm->_enid->dir(_realWords[1]); break; - case vb_die: + case kVerbCodeDie: _vm->_lucerna->gameover(); break; - case vb_score: + case kVerbCodeScore: _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ',' + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totaltime()); + + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totalTime()); break; - case vb_put: - putproc(); + case kVerbCodePut: + putProc(); break; - case vb_stand: - stand_up(); + case kVerbCodeStand: + standUp(); break; - case vb_kiss: - if (person == pardon) + case kVerbCodeKiss: + if (_person == kPardon) _vm->_scrolls->display("Kiss whom?"); - else if (personshere()) { - switch (person) { + else if (isPersonHere()) { + switch (_person) { case _vm->_gyro->parkata: _vm->_visa->dixi('U', 12); break; @@ -1970,30 +1928,30 @@ void Acci::do_that() { _vm->_visa->dixi('U', 14); break; default: - _vm->_visa->dixi('U', 5); /* You WHAT? */ + _vm->_visa->dixi('U', 5); // You WHAT? } - } else if ((150 <= person) && (person <= 174)) - _vm->_scrolls->display("Hey, what kind of a weirdo are you??"); + } else if ((150 <= _person) && (_person <= 174)) + _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??"); break; - case vb_climb: + case kVerbCodeClimb: if (_vm->_gyro->dna.room == r__insidecardiffcastle) - cardiff_climbing(); - else /* In the wrong room! */ + cardiffClimbing(); + else // In the wrong room! _vm->_scrolls->display("Not with your head for heights, Avvy!"); break; - case vb_jump: + case kVerbCodeJump: _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; - case vb_highscores: + case kVerbCodeHighscores: // show_highs(); - warning("STUB: Acci::do_that() - case vb_highscores"); + warning("STUB: Acci::doThat() - case kVerbCodehighscores"); break; - case vb_wake: - if (personshere()) - switch (person) { - case pardon: + case kVerbCodeWake: + if (isPersonHere()) + switch (_person) { + case kPardon: case _vm->_gyro->pavalot: case 0: if (!_vm->_gyro->dna.avvy_is_awake) { @@ -2018,7 +1976,7 @@ void Acci::do_that() { _vm->_scrolls->display("It's difficult to awaken people who aren't asleep...!"); } break; - case vb_sit: + case kVerbCodeSit: if (_vm->_gyro->dna.room == r__nottspub) { if (_vm->_gyro->dna.sitting_in_pub) _vm->_scrolls->display("You're already sitting!"); @@ -2033,22 +1991,22 @@ void Acci::do_that() { _vm->_scrolls->display(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); } break; - case vb_restart: + case kVerbCodeRestart: if (_vm->_scrolls->ask("Restart game and lose changes?")) { _vm->_lucerna->dusk(); _vm->_gyro->newgame(); _vm->_lucerna->dawn(); } break; - case pardon: - _vm->_scrolls->display("Hey, a verb would be helpful!"); + case kPardon: + _vm->_scrolls->display("Hey, a _verb would be helpful!"); break; - case vb_hello: - person_speaks(); + case kVerbCodeHello: + personSpeaks(); _vm->_scrolls->display(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble); break; - case vb_thanks: - person_speaks(); + case kVerbCodeThanks: + personSpeaks(); _vm->_scrolls->display(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble); break; default: @@ -2056,39 +2014,37 @@ void Acci::do_that() { } } -void Acci::verbopt(char n, Common::String &answer, char &anskey) { - switch (n) { - case vb_exam: +void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) { + switch (verb) { + case kVerbCodeExam: answer = "Examine"; - anskey = 'x'; - break; /* the ubiqutous one */ - /* vb_give isn't dealt with by this procedure, but by ddm__with */ - case vb_drink: + ansKey = 'word'; + break; // The ubiqutous one. + // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. + case kVerbCodeDrink: answer = "Drink"; - anskey = 'D'; + ansKey = 'D'; break; - case vb_wear: + case kVerbCodeWear: answer = "Wear"; - anskey = 'W'; + ansKey = 'W'; break; - case vb_ring: + case kVerbCodeRing: answer = "Ring"; - anskey = 'R'; - break; /* only the bell! */ - case vb_play: + ansKey = 'R'; + break; // Only the bell! + case kVerbCodePlay: answer = "Play"; - anskey = 'P'; + ansKey = 'P'; break; - case vb_eat: + case kVerbCodeEat: answer = "Eat"; - anskey = 'E'; + ansKey = 'E'; break; default: - answer = "? Unknown!"; /* Bug! */ - anskey = '?'; + answer = "? Unknown!"; // Bug! + ansKey = '?'; } } - - } // End of namespace Avalanche. diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index a6350721a623..d34c3ffa6468 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -38,93 +38,93 @@ class AvalancheEngine; class Acci { public: - /* verb codes */ - static const byte vb_exam = 1; - static const byte vb_open = 2; - static const byte vb_pause = 3; - static const byte vb_get = 4; - static const byte vb_drop = 5; - static const byte vb_inv = 6; - static const byte vb_talk = 7; - static const byte vb_give = 8; - static const byte vb_drink = 9; - static const byte vb_load = 10; - static const byte vb_save = 11; - static const byte vb_pay = 12; - static const byte vb_look = 13; - static const byte vb_break = 14; - static const byte vb_quit = 15; - static const byte vb_sit = 16; - static const byte vb_stand = 17; - static const byte vb_go = 18; - static const byte vb_info = 19; - static const byte vb_undress = 20; - static const byte vb_wear = 21; - static const byte vb_play = 22; - static const byte vb_ring = 23; - static const byte vb_help = 24; - static const byte vb_larrypass = 25; - static const byte vb_phaon = 26; - static const byte vb_boss = 27; - static const byte vb_pee = 28; - static const byte vb_cheat = 29; - static const byte vb_magic = 30; - static const byte vb_restart = 31; - static const byte vb_eat = 32; - static const byte vb_listen = 33; - static const byte vb_buy = 34; - static const byte vb_attack = 35; - static const byte vb_password = 36; - static const byte vb_dir = 37; - static const byte vb_die = 38; - static const byte vb_score = 39; - static const byte vb_put = 40; - static const byte vb_kiss = 41; - static const byte vb_climb = 42; - static const byte vb_jump = 43; - static const byte vb_highscores = 44; - static const byte vb_wake = 45; - static const byte vb_hello = 46; - static const byte vb_thanks = 47; - - static const byte vb_smartalec = 249; - static const byte vb_expletive = 253; - - static const byte pardon = 254; // Didn't understand / wasn't given. - - static const int16 nowords = 277; // How many words does the parser know? - static const byte nowt = 250; - static const byte moved = 0; // This word was moved. (Usually because it was the subject of conversation.) - - static const int16 first_password = 89; // Words[first_password] should equal "TIROS". - - - - struct vocab { - byte n; - Common::String w; + enum VerbCode { + kVerbCodeExam = 1, + kVerbCodeOpen = 2, + kVerbCodePause = 3, + kVerbCodeGet = 4, + kVerbCodeDrop = 5, + kVerbCodeInv = 6, + kVerbCodeTalk = 7, + kVerbCodeGive = 8, + kVerbCodeDrink = 9, + kVerbCodeLoad = 10, + kVerbCodeSave = 11, + kVerbCodePay = 12, + kVerbCodeLook = 13, + kVerbCodeBreak = 14, + kVerbCodeQuit = 15, + kVerbCodeSit = 16, + kVerbCodeStand = 17, + kVerbCodeGo = 18, + kVerbCodeInfo = 19, + kVerbCodeUndress = 20, + kVerbCodeWear = 21, + kVerbCodePlay = 22, + kVerbCodeRing = 23, + kVerbCodeHelp = 24, + kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, + kVerbCodeBoss = 27, + kVerbCodePee = 28, + kVerbCodeCheat = 29, + kVerbCodeMagic = 30, + kVerbCodeRestart = 31, + kVerbCodeEat = 32, + kVerbCodeListen = 33, + kVerbCodeBuy = 34, + kVerbCodeAttack = 35, + kVerbCodePassword = 36, + kVerbCodeDir = 37, + kVerbCodeDie = 38, + kVerbCodeScore = 39, + kVerbCodePut = 40, + kVerbCodeKiss = 41, + kVerbCodeClimb = 42, + kVerbCodeJump = 43, + kVerbCodeHighscores = 44, + kVerbCodeWake = 45, + kVerbCodeHello = 46, + kVerbCodeThanks = 47, + kVerbCodeSmartAlec = 249, + kVerbCodeExpletive = 253, }; - static const vocab words[nowords]; + static const byte kPardon = 254; // Didn't understand / wasn't given. - static const char what[]; + static const int16 kParserWordsNum = 277; // How many words does the parser know? + static const byte kNothing = 250; + static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.) + static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS". - struct ranktype { - uint16 score; - Common::String title; + + struct VocabEntry { + byte _number; + Common::String _word; }; - static const ranktype ranks[9]; + static const VocabEntry kVocabulary[kParserWordsNum]; + + static const char kWhat[]; + + + + struct RankType { + uint16 _score; + Common::String _title; + }; + static const RankType kRanks[9]; - Common::String thats; - Common::String unknown; - Common::String realwords[11]; - byte verb, person, thing, thing2; - bool polite; + + Common::String _thats; + Common::String _unknown; + Common::String _realWords[11]; + byte _verb, _person, _thing, _thing2; + bool _polite; @@ -133,83 +133,77 @@ class Acci { void init(); - void clearwords(); + void clearWords(); void parse(); - void lookaround(); - void opendoor(); - void do_that(); - void verbopt(char n, Common::String &answer, char &anskey); - void have_a_drink(); + void lookAround(); // This is called when you say "look". + void openDoor(); + void doThat(); + void verbOpt(byte verb, Common::String &answer, char &ansKey); + void drink(); private: AvalancheEngine *_vm; byte fv; - byte wordnum(Common::String x); - - void replace(Common::String old1, byte new1); + byte wordNum(Common::String word); + void replace(Common::String oldChars, byte newChar); Common::String rank(); - - Common::String totaltime(); + Common::String totalTime(); void number(Common::String &codes); - void cheatparse(Common::String codes); + void cheatParse(Common::String codes); - void punctustrip(Common::String &x); + void stripPunctuation(Common::String &word); // Strips punctuation from word. - void displaywhat(byte ch, bool animate, bool &ambigous); - bool do_pronouns(); + void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective! + bool doPronouns(); - void lowercase(); - void propernouns(); - void sayit(); - void store_interrogation(byte interrogation); + void properNouns(); + void sayIt(); // This makes Avalot say the response. + void storeInterrogation(byte interrogation); - void clearuint16s(); + void examineObject(); // Examine a standard object-thing - void examobj(); // Examine a standard object-thing - - bool personshere(); + bool isPersonHere(); void exampers(); bool holding(); - void openBox(bool before); + void openBox(bool isOpening); void examine(); - void inv(); + void inventory(); void swallow(); - void others(); + void peopleInRoom(); // This lists the other people in the room. void silly(); - void putproc(); + void putProc(); // Called when you call kVerbCodeput. - void not_in_order(); - void go_to_cauldron(); - bool give2spludwick(); + void notInOrder(); + void goToCauldron(); + bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!". - void cardiff_climbing(); + void cardiffClimbing(); void already(); - void stand_up(); - - void getproc(char thing); + void standUp(); // Called when you ask Avvy to stand. - void give_geida_the_lute(); + void getProc(char thing); - void play_harp(); + void giveGeidaTheLute(); - void winsequence(); + void playHarp(); - void person_speaks(); + void winSequence(); - void heythanks(); + void personSpeaks(); + void heyThanks(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 5c140ca1e5f6..05c01ef95fdc 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -606,7 +606,7 @@ void AvalancheEngine::bFlightOff() { -Common::String AvalancheEngine::elm2Str(Elm how) { +Common::String AvalancheEngine::elmToStr(Elm how) { switch (how) { case kNormal: case kMusical: diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index f8f2ce1ee2c0..c243aeaa8a57 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -195,7 +195,7 @@ class AvalancheEngine : public Engine { void bFlightOff(); - Common::String elm2Str(Elm how); + Common::String elmToStr(Elm how); void run(Common::String what, bool withJsb, bool withBflight, Elm how); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index d0cd50515e1e..a29cbcc9df6e 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -320,26 +320,26 @@ void Dropdown::find_what_you_can_do_with_it() { case _vm->_gyro->wine: case _vm->_gyro->potion: case _vm->_gyro->ink: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_drink; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeDrink; break; case _vm->_gyro->bell: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_ring; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeRing; break; case _vm->_gyro->chastity: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_wear; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; case _vm->_gyro->lute: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_play; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodePlay; break; case _vm->_gyro->mushroom: case _vm->_gyro->onion: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_eat; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeEat; break; case _vm->_gyro->clothes: - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_wear; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; default: - _vm->_gyro->verbstr = _vm->_acci->vb_exam; /* anything else */ + _vm->_gyro->verbstr = _vm->_acci->kVerbCodeExam; /* anything else */ } } @@ -562,32 +562,32 @@ void Dropdown::ddm__with() { find_what_you_can_do_with_it(); for (fv = 0; fv < _vm->_gyro->verbstr.size(); fv++) { - _vm->_acci->verbopt(_vm->_gyro->verbstr[fv], verb, vbchar); + _vm->_acci->verbOpt(_vm->_gyro->verbstr[fv], verb, vbchar); ddm_o.opt(verb, vbchar, "", true); } - // We disable the "give" option if: (a), you haven't selected anybody, (b), the person you've selected isn't in the room, or (c), the person you've selected is YOU! + // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, or (c), the _person you've selected is YOU! - if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->nowt) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) + if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) ddm_o.opt("Give to...", 'G', "", false); /* Not here. */ else { ddm_o.opt(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_give; + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeGive; } } else { ddm_o.opt("Examine", 'x', "", true); ddm_o.opt(Common::String("Talk to h") + himher(_vm->_gyro->thinks), 'T', "", true); - _vm->_gyro->verbstr = Common::String(_vm->_acci->vb_exam) + _vm->_acci->vb_talk; + _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; switch (_vm->_gyro->thinks) { case _vm->_gyro->pgeida: case _vm->_gyro->parkata: { ddm_o.opt("Kiss her", 'K', "", true); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_kiss; + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeKiss; } break; case _vm->_gyro->pdogfood: { ddm_o.opt("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->vb_play; + _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodePlay; } break; case _vm->_gyro->pmalagauche: { @@ -640,19 +640,19 @@ void Dropdown::do__game() { switch (ddm_o.choicenum) { /* Help, boss, untrash screen. */ case 0: - _vm->_lucerna->callverb(_vm->_acci->vb_help); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeHelp); break; case 1: - _vm->_lucerna->callverb(_vm->_acci->vb_boss); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBoss); break; case 2: _vm->_lucerna->major_redraw(); break; case 3: - _vm->_lucerna->callverb(_vm->_acci->vb_score); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeScore); break; case 4: - _vm->_lucerna->callverb(_vm->_acci->vb_info); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeInfo); break; } } @@ -661,18 +661,18 @@ void Dropdown::do__file() { switch (ddm_o.choicenum) { /* New game, load, save, save as, DOS shell, about, quit. */ case 0: - _vm->_lucerna->callverb(_vm->_acci->vb_restart); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeRestart); break; case 1: { - if (!_vm->_acci->realwords[1].empty()) - _vm->_acci->realwords[1].clear(); - _vm->_lucerna->callverb(_vm->_acci->vb_load); + if (!_vm->_acci->_realWords[1].empty()) + _vm->_acci->_realWords[1].clear(); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeLoad); } break; case 2: { - if (!_vm->_acci->realwords[1].empty()) - _vm->_acci->realwords[1].clear(); - _vm->_lucerna->callverb(_vm->_acci->vb_save); + if (!_vm->_acci->_realWords[1].empty()) + _vm->_acci->_realWords[1].clear(); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeSave); } break; case 3: @@ -682,7 +682,7 @@ void Dropdown::do__file() { _vm->_enid->back_to_bootstrap(2); break; case 5: - _vm->_lucerna->callverb(_vm->_acci->vb_quit); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeQuit); break; } } @@ -692,23 +692,23 @@ void Dropdown::do__action() { switch (ddm_o.choicenum) { /* Get up/pause game/open door/look/inv/walk-run */ case 0: { - _vm->_acci->person = _vm->_acci->pardon; - _vm->_acci->thing = _vm->_acci->pardon; + _vm->_acci->_person = _vm->_acci->kPardon; + _vm->_acci->_thing = _vm->_acci->kPardon; n = _vm->_gyro->f5_does(); _vm->_lucerna->callverb(n[0]); } break; case 1: - _vm->_lucerna->callverb(_vm->_acci->vb_pause); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodePause); break; case 2: - _vm->_lucerna->callverb(_vm->_acci->vb_open); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); break; case 3: - _vm->_lucerna->callverb(_vm->_acci->vb_look); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeLook); break; case 4: - _vm->_lucerna->callverb(_vm->_acci->vb_inv); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeInv); break; case 5: { if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) @@ -731,58 +731,58 @@ void Dropdown::do__people() { } void Dropdown::do__with() { - _vm->_acci->thing = _vm->_gyro->thinks; + _vm->_acci->_thing = _vm->_gyro->thinks; if (_vm->_gyro->thinkthing) { - _vm->_acci->thing += 49; + _vm->_acci->_thing += 49; - if (_vm->_gyro->verbstr[ddm_o.choicenum] == _vm->_acci->vb_give) - _vm->_acci->person = _vm->_gyro->last_person; + if (_vm->_gyro->verbstr[ddm_o.choicenum] == _vm->_acci->kVerbCodeGive) + _vm->_acci->_person = _vm->_gyro->last_person; else - _vm->_acci->person = 254; + _vm->_acci->_person = 254; } else { switch (_vm->_gyro->verbstr[ddm_o.choicenum]) { case 100: { // Beer - _vm->_acci->thing = 100; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 100; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; case 101: { // Wine - _vm->_acci->thing = 50; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 50; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; case 102: { // Whisky - _vm->_acci->thing = 102; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 102; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; case 103: { // Cider - _vm->_acci->thing = 103; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 103; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; case 104: { // Mead - _vm->_acci->thing = 107; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 107; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; case 105: { // Onion (trader) - _vm->_acci->thing = 67; - _vm->_lucerna->callverb(_vm->_acci->vb_buy); + _vm->_acci->_thing = 67; + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); return; } break; default: { - _vm->_acci->person = _vm->_acci->thing; - _vm->_acci->thing = 254; + _vm->_acci->_person = _vm->_acci->_thing; + _vm->_acci->_thing = 254; _vm->_gyro->subjnumber = 0; } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index aab8c8294f01..229f387148ac 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -505,30 +505,30 @@ Common::String Gyro::f5_does() { switch (dna.room) { case r__yours: { if (!dna.avvy_is_awake) - return Common::String(_vm->_acci->vb_wake) + "WWake up"; + return Common::String(_vm->_acci->kVerbCodeWake) + "WWake up"; else if (dna.avvy_in_bed) - return Common::String(_vm->_acci->vb_stand) + "GGet up"; + return Common::String(_vm->_acci->kVerbCodeStand) + "GGet up"; } break; case r__insidecardiffcastle: if (dna.standing_on_dais) - return Common::String(_vm->_acci->vb_climb) + "CClimb down"; + return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb down"; else - return Common::String(_vm->_acci->vb_climb) + "CClimb up"; + return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb up"; break; case r__nottspub: if (dna.sitting_in_pub) - return Common::String(_vm->_acci->vb_stand) + "SStand up"; + return Common::String(_vm->_acci->kVerbCodeStand) + "SStand up"; else - return Common::String(_vm->_acci->vb_sit) + "SSit down"; + return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; break; case r__musicroom: if (_vm->_trip->infield(7)) - return Common::String(_vm->_acci->vb_play) + "PPlay the harp"; + return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; break; } - return Common::String(_vm->_acci->pardon); /* If all else fails... */ + return Common::String(_vm->_acci->kPardon); /* If all else fails... */ } void Gyro::load_a_mouse(byte which) { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index eda1a8e1a517..d2f0e8f2b9d5 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -67,16 +67,16 @@ void Lucerna::init() { } void Lucerna::callverb(byte n) { - if (n == _vm->_acci->pardon) { + if (n == _vm->_acci->kPardon) { _vm->_scrolls->display(Common::String("The f5 key lets you do a particular action in certain ") + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + "current setting of this key is."); } else { _vm->_gyro->weirdword = false; - _vm->_acci->polite = true; - _vm->_acci->verb = n; - _vm->_acci->do_that(); + _vm->_acci->_polite = true; + _vm->_acci->_verb = n; + _vm->_acci->doThat(); } } @@ -1120,26 +1120,26 @@ void Lucerna::checkclick() { if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) mouseway(cursorPos); - } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the thing. + } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { _vm->updateEvents(); } while (holdLeftMouse); if (_vm->_gyro->thinkthing) { - _vm->_acci->thing = _vm->_gyro->thinks; - _vm->_acci->thing += 49; - _vm->_acci->person = _vm->_acci->pardon; + _vm->_acci->_thing = _vm->_gyro->thinks; + _vm->_acci->_thing += 49; + _vm->_acci->_person = _vm->_acci->kPardon; } else { - _vm->_acci->person = _vm->_gyro->thinks; - _vm->_acci->thing = _vm->_acci->pardon; + _vm->_acci->_person = _vm->_gyro->thinks; + _vm->_acci->_thing = _vm->_acci->kPardon; } - callverb(_vm->_acci->vb_exam); + callverb(_vm->_acci->kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (holdLeftMouse); - callverb(_vm->_acci->vb_score); + callverb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_trip->tr[0].xs = _vm->_gyro->walk; _vm->_trip->newspeed(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d52ab868c3be..615f4a4d54a8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -78,7 +78,7 @@ void Parser::handleReturn() { if (!_inputText.empty()) { _inputTextBackup = _inputText; _vm->_acci->parse(); - _vm->_acci->do_that(); + _vm->_acci->doThat(); _inputText.clear(); wipeText(); } @@ -88,13 +88,13 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_F5: { - _vm->_acci->person = _vm->_acci->pardon; - _vm->_acci->thing = _vm->_acci->pardon; + _vm->_acci->_person = _vm->_acci->kPardon; + _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callverb(_vm->_gyro->f5_does()[0]); } break; case Common::KEYCODE_F7: - _vm->_lucerna->callverb(_vm->_acci->vb_open); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); break; } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 88c928cbeaa7..8f4c6dd4a0cc 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -760,7 +760,7 @@ void Scrolls::calldrivers() { display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: - display(_vm->_acci->words[_vm->_acci->first_password + _vm->_gyro->dna.pass_num].w + kControlToBuffer); + display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->dna.pass_num]._word + kControlToBuffer); break; case 3: display(_vm->_gyro->dna.like2drink + kControlToBuffer); @@ -782,12 +782,12 @@ void Scrolls::calldrivers() { case 0: { // Sixpence. _vm->_visa->dixi('q', 37); // You find the sixpence. _vm->_gyro->dna.pence += 6; - _vm->_gyro->dna.box_contents = _vm->_acci->nowt; + _vm->_gyro->dna.box_contents = _vm->_acci->kNothing; _vm->_lucerna->points(2); return; } break; - case _vm->_acci->nowt: + case _vm->_acci->kNothing: display("nothing at all. It's completely empty."); break; default: diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 334b49f5ecdc..ab1fcf072a79 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -499,7 +499,7 @@ void Timeout::buydrinks() { _vm->_visa->dixi('D', 1); // That'll be thruppence. if (_vm->_gyro->pennycheck(3)) // Pay 3d. _vm->_visa->dixi('D', 3); // Tell 'em you paid up. - _vm->_acci->have_a_drink(); + _vm->_acci->drink(); } void Timeout::buywine() { @@ -626,7 +626,7 @@ void Timeout::winning() { } while (!(_vm->_gyro->mrelease == 0));*/ // To be implemented with Pingo::winning_pic(). - _vm->_lucerna->callverb(_vm->_acci->vb_score); + _vm->_lucerna->callverb(_vm->_acci->kVerbCodeScore); _vm->_scrolls->display(" T H E E N D "); _vm->_gyro->lmo = true; } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 0a0c031effee..8a311d0ad93d 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -164,8 +164,8 @@ void Visa::talkto(byte whom) { byte fv; bool no_matches; - if (_vm->_acci->person == _vm->_acci->pardon) { - _vm->_acci->person = _vm->_gyro->subjnumber; + if (_vm->_acci->_person == _vm->_acci->kPardon) { + _vm->_acci->_person = _vm->_gyro->subjnumber; _vm->_gyro->subjnumber = 0; } From 59317d6ac71896ce2aff51ca7d9c57144d315583 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 16:03:16 +0200 Subject: [PATCH 0746/1332] AVALANCHE: Rename/refactor Avalot. --- engines/avalanche/avalot.cpp | 25 +++++-------------------- engines/avalanche/avalot.h | 9 --------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 96cb30702f74..54c46568864d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -133,21 +133,12 @@ void Avalot::handleKeyDown(Common::Event &event) { - - - void Avalot::setup() { - int16 gd, gm; - - checkbreak = false; _vm->_gyro->visible = _vm->_gyro->m_no; _vm->_gyro->to_do = 0; _vm->_gyro->lmo = false; _vm->_scrolls->resetscroll(); CursorMan.showMouse(true); - gd = 3; - gm = 0; - //initgraph(gd: gm: ""); _vm->_gyro->holdthedawn = true; _vm->_lucerna->dusk(); _vm->_gyro->cmp = 177; @@ -157,7 +148,6 @@ void Avalot::setup() { _vm->_gyro->oldjw = 177; _vm->_gyro->mousetext = ""; _vm->_gyro->c = 999; - //settextjustify(0: 0); _vm->_gyro->ddmnow = false; _vm->_lucerna->load_digits(); _vm->_gyro->cheat = false; @@ -168,22 +158,15 @@ void Avalot::setup() { _vm->_gyro->defaultled = 2; /* TSkellern:=0; { Replace with a more local variable sometime }*/ _vm->_gyro->dna.rw = _vm->_gyro->stopped; - _vm->_gyro->enid_filename = ""; /* undefined. */ + _vm->_gyro->enid_filename = ""; // Undefined. _vm->_lucerna->toolbar(); _vm->_scrolls->state(2); for (byte i = 0; i < 3; i++) - _vm->_gyro->lastscore[i] = -1; /* impossible digits */ - - /* for gd:=0 to 1 do - begin - setactivepage(gd); outtextxy(7:177:chr(48+gd)); - end;*/ + _vm->_gyro->lastscore[i] = -1; // Impossible digits. _vm->_trip->loadtrip(); _vm->_trip->get_back_loretta(); - //gm = getpixel(0: 0); - //setcolor(7); _vm->_gyro->holdthedawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; @@ -210,6 +193,8 @@ void Avalot::setup() { } } + + void Avalot::run(Common::String arg) { setup(); @@ -250,9 +235,9 @@ void Avalot::run(Common::String arg) { _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). } while (! _vm->_gyro->lmo); - //restorecrtmode(); //if (logging) // close(logfile); + warning("STUB: Avalot::run()"); _vm->_closing->end_of_program(); } diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index c792a178a41b..231d6c9f3732 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -42,21 +42,12 @@ class Avalot { void setup(); - - void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). - - - - void run(Common::String arg); private: AvalancheEngine *_vm; - - bool checkbreak; // Originally located in avalot9.map - }; } // End of namespace Avalanche From 84ae6db8938cde4d24a764917972eaef9936472e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 17:45:11 +0200 Subject: [PATCH 0747/1332] AVALANCHE: Get rid of Basher. Move everything needed from it to Parser::init(). --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/basher2.cpp | 169 -------------------------------- engines/avalanche/basher2.h | 80 --------------- engines/avalanche/parser.cpp | 7 ++ engines/avalanche/parser.h | 2 + 5 files changed, 10 insertions(+), 249 deletions(-) delete mode 100644 engines/avalanche/basher2.cpp delete mode 100644 engines/avalanche/basher2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 05c01ef95fdc..b977aeb3b063 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -109,6 +109,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _lucerna->init(); _acci->init(); _basher->init(); + _parser->init(); return Common::kNoError; } diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp deleted file mode 100644 index 6bbf8b290f23..000000000000 --- a/engines/avalanche/basher2.cpp +++ /dev/null @@ -1,169 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* BASHER Handles the keyboard. */ - -// Note: this unit can record keystrokes, for the demo. If you want it -// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will -// cause them to be played back. - -#include "avalanche/avalanche.h" - -#include "avalanche/basher2.h" -#include "avalanche/enhanced2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/acci2.h" -#include "avalanche/trip6.h" -#include "avalanche/pingo2.h" -#include "avalanche/dropdown2.h" -#include "avalanche/logger2.h" -#include "avalanche/enid2.h" -//#include "Sticks.h" - Responsible for the joystick - -#include "common/textconsole.h" - -namespace Avalanche { - - -Basher::Basher(AvalancheEngine *vm) { - _vm = vm; -} - -void Basher::init() { - /* new(previous);*/ - if (!_vm->_parser->_inputTextBackup.empty()) - _vm->_parser->_inputTextBackup.clear(); - - normal_edit(); - - if (_vm->_gyro->demo) { - if (!_vm->_gyro->demofile.open("demo.avd")) { - warning("AVALANCHE: Basher: File not found: demo.avd"); - throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. - } - } - -// Not sure that the following part will be used ever... -#ifdef RECORD - count = 0; - if (!_vm->_gyro->demofile_save.open("demo.avd")) { - warning("AVALANCHE: Basher: File not found: demo.avd"); - throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. - } -#endif -} - -/*procedure cursor; -begin - if curflash=0 then - begin - if mouse_near_text then Super_Off; - cursoron:=not cursoron; - mem[$A000*13442+curpos]:=not mem[$A000*13442+curpos]; - mem[$A000*pagetop+13442+curpos]:=not mem[$A000*pagetop+13442+curpos]; - curflash:=17; - Super_On; - end else dec(curflash); -end;*/ - -void Basher::get_demorec() { - warning("STUB: Basher::get_demorec()"); -} - -#ifdef RECORD -void Basher::record_one() { - warning("STUB: Basher::record_one()"); -} -#endif -/* -procedure storeline(whatwhat:string); -var - fv:byte; - what:string[77]; - ok:boolean; - - function upline(x:string):string; - var fv:byte; n:string[77]; - begin - for fv:=1 to length(x) do n[fv]:=upcase(x[fv]); - n[0]:=x[0]; upline:=n; - end; -begin - - what:=upline(whatwhat); ok:=false; - for fv:=1 to 20 do - if what=upline(previous^[fv]) then - begin { it already exists, in string "fv" } - move(previous^[fv+1],previous^[fv],(20-fv)*78); - previous^[20]:=whatwhat; ok:=true; - end; - if ok then exit; - { it's not on the list, so add it } - move(previous^[2],previous^[1],1482); { shove up } - previous^[20]:=whatwhat; -end; -*/ - - -char Basher::firstchar(Common::String x) { - warning("STUB: Basher::firstchar()"); - return 'S'; -} - - - - -void Basher::typein() { - warning("STUB: Basher::typein()"); -} - -/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; - '': begin setvisualpage(0); write(#7); inkey; end;*/ - -void Basher::keyboard_link() { - warning("STUB: Basher::keyboard_link()"); -} - -bool Basher::demo_ready() { - warning("STUB: Basher::demo_ready()"); - return true; -} - -void Basher::filename_edit() { - warning("STUB: Basher::filename_edit()"); -} - -void Basher::normal_edit() { - entering_filename = false; - _vm->_parser->_leftMargin = 0; - if (!_vm->_parser->_inputText.empty()) - _vm->_parser->_inputText.clear(); - _vm->_parser->_inputTextPos = 0; -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h deleted file mode 100644 index f4a78f4d42fa..000000000000 --- a/engines/avalanche/basher2.h +++ /dev/null @@ -1,80 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* BASHER Handles the keyboard. */ - -// Note: this unit can record keystrokes, for the demo. If you want it -// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will -// cause them to be played back. - -// TODO: Replace these functions gradually with ScummVM's own methods. - -#ifndef BASHER2_H -#define BASHER2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Basher { -public: - uint16 count; - - - - Basher(AvalancheEngine *vm); - - void init(); - - void keyboard_link(); - - void get_demorec(); - - bool demo_ready(); - - void filename_edit(); - - void normal_edit(); - -#ifdef RECORD - void record_one(); -#endif - -private: - AvalancheEngine *_vm; - - bool entering_filename; - - char firstchar(Common::String x); - - void typein(); -}; - -} // End of namespace Avalanche. - -#endif // BASHER2_H diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 615f4a4d54a8..2457354e170c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -34,6 +34,13 @@ Parser::Parser(AvalancheEngine *vm) { _vm = vm; } +void Parser::init() { + _leftMargin = 0; + if (!_inputText.empty()) + _inputText.clear(); + _inputTextPos = 0; +} + void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; if (_vm->_dropdown->ddm_o.menunow) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index da2b76141792..e16df6d3bc18 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -46,6 +46,8 @@ class Parser { Parser(AvalancheEngine *vm); + void init(); + void handleInputText(const Common::Event &event); void handleBackspace(); From 09ee31e4cea0b2eedaee993d54a947e6c6394bc2 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 17:51:30 +0200 Subject: [PATCH 0748/1332] AVALANCHE: Get rid of the rest of Basher. --- engines/avalanche/avalanche.cpp | 3 --- engines/avalanche/avalanche.h | 2 -- engines/avalanche/avalot.cpp | 5 ----- engines/avalanche/dropdown2.cpp | 3 +-- engines/avalanche/gyro2.cpp | 1 - engines/avalanche/module.mk | 1 - engines/avalanche/scrolls2.cpp | 4 ---- 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b977aeb3b063..70d79425db7c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -76,7 +76,6 @@ AvalancheEngine::~AvalancheEngine() { delete _timeout; delete _trip; delete _acci; - delete _basher; delete _dropdown; delete _closing; } @@ -99,7 +98,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _timeout = new Timeout(this); _trip = new Trip(this); _acci = new Acci(this); - _basher = new Basher(this); _dropdown = new Dropdown(this); _closing = new Closing(this); @@ -108,7 +106,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _scrolls->init(); _lucerna->init(); _acci->init(); - _basher->init(); _parser->init(); return Common::kNoError; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index c243aeaa8a57..393bb4d15747 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -47,7 +47,6 @@ #include "avalanche/timeout2.h" #include "avalanche/trip6.h" #include "avalanche/acci2.h" -#include "avalanche/basher2.h" #include "avalanche/dropdown2.h" #include "avalanche/closing2.h" @@ -88,7 +87,6 @@ class AvalancheEngine : public Engine { Timeout *_timeout; Trip *_trip; Acci *_acci; - Basher *_basher; Dropdown *_dropdown; Closing *_closing; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 54c46568864d..2678123d8e75 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -36,7 +36,6 @@ #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" -#include "avalanche/basher2.h" #include "avalanche/dropdown2.h" #include "avalanche/pingo2.h" #include "avalanche/logger2.h" @@ -114,8 +113,6 @@ void Avalot::handleKeyDown(Common::Event &event) { if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) { _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->showrw(); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); return; } case Common::KEYCODE_BACKSPACE: @@ -127,8 +124,6 @@ void Avalot::handleKeyDown(Common::Event &event) { } _vm->_lucerna->showrw(); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index a29cbcc9df6e..95a6724f7ea1 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -36,7 +36,6 @@ #include "avalanche/acci2.h" #include "avalanche/trip6.h" #include "avalanche/enid2.h" -#include "avalanche/basher2.h" #include "common/textconsole.h" @@ -676,7 +675,7 @@ void Dropdown::do__file() { } break; case 3: - _vm->_basher->filename_edit(); + //_vm->_basher->filename_edit(); break; case 4: _vm->_enid->back_to_bootstrap(2); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 229f387148ac..4166ecfe3222 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -325,7 +325,6 @@ void Gyro::newgame() { /*for gd:=0 to 5 do which[gd]:=1;*/ memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); _vm->_scrolls->natural(); - _vm->_basher->normal_edit(); _vm->_lucerna->mousepage(0); dna.spare_evening = "answer a questionnaire"; dna.like2drink = "beer"; diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index e2dd67d6baa7..7f2e40c94580 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -20,7 +20,6 @@ MODULE_OBJS = \ timeout2.o \ trip6.o \ acci2.o \ - basher2.o \ dropdown2.o \ closing2.o diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 8f4c6dd4a0cc..f21645d0e269 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -38,7 +38,6 @@ #include "avalanche/acci2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" -#include "avalanche/basher2.h" #include "common/textconsole.h" #include "common/file.h" @@ -153,9 +152,6 @@ void Scrolls::normscroll() { _vm->_gyro->newpointer(4); _vm->_lucerna->mousepage(1 - _vm->_gyro->cp); - if (_vm->_gyro->demo) - _vm->_basher->get_demorec(); - ::Graphics::Surface temp; From 38ceb705f29c6ddac318b9a62730fb597d647417 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 22:22:42 +0200 Subject: [PATCH 0749/1332] AVALANCHE: Do renaming in Celer. --- engines/avalanche/acci2.cpp | 36 +-- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/celer2.cpp | 412 ++++++++++++++++---------------- engines/avalanche/celer2.h | 56 ++--- engines/avalanche/lucerna2.cpp | 50 ++-- engines/avalanche/sequence2.cpp | 2 +- engines/avalanche/timeout2.cpp | 26 +- engines/avalanche/trip6.cpp | 112 ++++----- 9 files changed, 346 insertions(+), 354 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1f455ec8cb5d..c75bfa4fcc1a 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -714,17 +714,17 @@ bool Acci::holding() { void Acci::openBox(bool isOpening) { if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); - _vm->_celer->pics_link(); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); if (!isOpening) { - _vm->_celer->show_one(-1, -1, 6); - _vm->_celer->pics_link(); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); } @@ -1145,7 +1145,7 @@ void Acci::standUp() { _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(-1, -1, 4); // Picture of empty pillow. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); @@ -1159,7 +1159,7 @@ void Acci::standUp() { case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { - _vm->_celer->show_one(-1, -1, 4); // Not sitting down. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_trip->tr[0].visible = true; // But standing up. _vm->_trip->apped(1, 4); // And walking away. _vm->_gyro->dna.sitting_in_pub = false; // Really not sitting down. @@ -1179,12 +1179,12 @@ void Acci::getProc(char thing) { case r__yours: if (_vm->_trip->infield(2)) { if (_vm->_gyro->dna.box_contents == thing) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->dna.obj[thing - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.box_contents = kNothing; - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else @@ -1198,7 +1198,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->display("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_celer->show_one(-1, -1, 4); // No pen there now. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. _vm->_trip->call_special(3); // Zap! _vm->_gyro->dna.taken_pen = true; _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; @@ -1219,7 +1219,7 @@ void Acci::getProc(char thing) { break; case r__robins: if ((thing == _vm->_gyro->mushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->display("Got it!"); _vm->_gyro->dna.mushroom_growing = false; _vm->_gyro->dna.taken_mushroom = true; @@ -1423,8 +1423,8 @@ void Acci::doThat() { _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; _vm->_gyro->dna.givenbadgetoiby = true; - _vm->_celer->show_one(-1, -1, 8); - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); } else heyThanks(); break; @@ -1608,7 +1608,7 @@ void Acci::doThat() { _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.wonnim = true; - _vm->_celer->show_one(-1, -1, 1); // Show the settle with no lute on it. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. _vm->_lucerna->points(7); // 7 points for winning! if (_vm->_gyro->dna.playednim == 1) @@ -1761,11 +1761,11 @@ void Acci::doThat() { if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->dna.drinking = _thing; - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; @@ -1786,11 +1786,11 @@ void Acci::doThat() { return; } - _vm->_celer->show_one(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); @@ -1958,7 +1958,7 @@ void Acci::doThat() { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->show_one(-1, -1, 3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 70d79425db7c..d3dfbff15a70 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -463,7 +463,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->dawn(); } - _celer->forget_chunks(); + _celer->forgetBackgroundSprites(); _lucerna->minor_redraw(); @@ -482,7 +482,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _gyro->ontoolbar = false; _trip->trippancy_link(); - _celer->pics_link(); + _celer->refreshBackgroundSprites(); _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2678123d8e75..cade90ef3b91 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -204,7 +204,7 @@ void Avalot::run(Common::String arg) { _vm->_dropdown->menu_link(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); - _vm->_celer->pics_link(); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_lucerna->checkclick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 25093a9348e9..37329f1a6750 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -37,224 +37,216 @@ #include "common/textconsole.h" + + namespace Avalanche { -const int16 Celer::on_disk = -1; +const int16 Celer::kOnDisk = -1; Celer::Celer(AvalancheEngine *vm) { _vm = vm; - num_chunks = 0; + _chunkNum = 0; } Celer::~Celer() { for (byte i = 0; i < 40; i++) - memory[i].free(); + _memory[i].free(); } -void Celer::pics_link() { - byte xx; +void Celer::refreshBackgroundSprites() { + byte direction; if (_vm->_gyro->ddmnow) - return; /* No animation when the menus are up. */ + return; // No animation when the menus are up. - switch (_vm->_gyro->dna.room) { case r__outsideargentpub: if ((_vm->_gyro->roomtime % 12) == 0) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); break; - case r__brummieroad: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); break; - case r__bridge: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); + drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); break; - case r__yours: if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); break; + case r__argentpub: { + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + // Malagauche cycle. + _vm->_gyro->dna.malagauche += 1; + switch (_vm->_gyro->dna.malagauche) { + case 1: + case 11: + case 21: + drawBackgroundSprite(-1, -1, 12); // Looks forwards. + break; + case 8: + case 18: + case 28: + case 32: + drawBackgroundSprite(-1, -1, 11); // Looks at you. + break; + case 30: + drawBackgroundSprite(-1, -1, 13); // Winks. + break; + case 33: + _vm->_gyro->dna.malagauche = 0; + break; + } + } - case r__argentpub: - if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { - /* Malagauche cycle */ - _vm->_gyro->dna.malagauche += 1; - switch (_vm->_gyro->dna.malagauche) { - case 1: - case 11: - case 21: - show_one(-1, -1, 12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(-1, -1, 11); - break; /* Looks at you. */ - case 30: - show_one(-1, -1, 13); - break; /* Winks. */ - case 33: - _vm->_gyro->dna.malagauche = 0; + switch (_vm->_gyro->roomtime % 200) { + case 179: + case 197: + drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + break; + case 182: + case 194: + drawBackgroundSprite(-1, -1, 6); + break; + case 185: + drawBackgroundSprite(-1, -1, 7); break; + case 199: + _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + break; } - } - - switch (_vm->_gyro->roomtime % 200) { - case 179: - case 197: - show_one(-1, -1, 5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(-1, -1, 6); - break; - case 185: - show_one(-1, -1, 7); - break; - case 199: - _vm->_gyro->dna.dogfoodpos = 177; - break; /* Impossible value for this. */ - } - if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { /* Normally. */ - if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 3; - else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) - xx = 2; - else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) - xx = 4; - - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; + if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 3; + else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) + direction = 2; + else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) + direction = 4; + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; + } } } break; - case r__westhall: if ((_vm->_gyro->roomtime % 3) == 0) { switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: - show_one(-1, -1, 1); + drawBackgroundSprite(-1, -1, 1); break; case 1: case 3: case 5: - show_one(-1, -1, 2); + drawBackgroundSprite(-1, -1, 2); break; case 0: case 2: - show_one(-1, -1, 3); + drawBackgroundSprite(-1, -1, 3); break; } } break; - case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { if ((_vm->_gyro->roomtime % 45) > 42) - xx = 4; /* du Lustie blinks */ + direction = 4; // du Lustie blinks. - /* Bearing of Avvy from du Lustie. */ + // Bearing of Avvy from du Lustie. else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 1; /* Middle. */ + direction = 1; // Middle. else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - xx = 2; /* Left. */ + direction = 2; // Left. else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - xx = 3; /* Right. */ + direction = 3; // Right. - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? } } break; - case r__aylesoffice: if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { switch ((_vm->_gyro->roomtime / 14) % 2) { case 0: - show_one(-1, -1, 1); - break; /* Frame 2: EGA. */ + drawBackgroundSprite(-1, -1, 1); // Frame 2: EGA. + break; case 1: - show_one(-1, -1, 3); - break; /* Frame 1: Natural. */ + drawBackgroundSprite(-1, -1, 3); // Frame 1: Natural. + break; } } break; - case r__robins: if (_vm->_gyro->dna.tied_up) { switch (_vm->_gyro->roomtime % 54) { case 20: - show_one(-1, -1, 4); - break; /* Frame 4: Avalot blinks. */ + drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. + break; case 23: - show_one(-1, -1, 2); - break; /* Frame 1: Back to normal. */ + drawBackgroundSprite(-1, -1, 2); // Frame 1: Back to normal. + break; } } break; + case r__nottspub: { + // Bearing of Avvy from Port. + if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) + direction = 2; // Middle. + else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 60) > 57) + direction--; // Blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } - case r__nottspub: - /* Bearing of Avvy from Port. */ - if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) - xx = 2; /* Middle. */ - else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro->roomtime % int32(60)) > 57) - xx--; /* Blinks */ - - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - - switch (_vm->_gyro->roomtime % 50) { - case 45 : - show_one(-1, -1, 9); - break; /* Spurge blinks */ - case 49 : - show_one(-1, -1, 10); - break; + switch (_vm->_gyro->roomtime % 50) { + case 45 : + drawBackgroundSprite(-1, -1, 9); // Spurge blinks. + break; + case 49 : + drawBackgroundSprite(-1, -1, 10); + break; + } } break; + case r__ducks: { + if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - case r__ducks: - if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */ - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - - {/* _vm->_lucerna->bearing of Avvy from Duck. */ - if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 4; /* Middle. */ - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - xx = 8; /* Right. */ + // Bearing of Avvy from Duck. + if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 4; // Middle. + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + direction = 8; // Right. - if ((_vm->_gyro->roomtime % 45) > 42) - xx += 1; /* Duck blinks */ + if ((_vm->_gyro->roomtime % 45) > 42) + direction++; // Duck blinks. - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } } break; - } -} if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { - /* They're ringing the bells. */ + // They're ringing the bells. switch (_vm->_gyro->roomtime % 4) { case 1: if (_vm->_gyro->dna.nextbell < 5) @@ -263,86 +255,84 @@ void Celer::pics_link() { _vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]); break; case 2: - //nosound; + //nosound(); warning("STUB: Celer::pics_link()"); break; } } } -void Celer::load_chunks(Common::String xx) { - chunkblocktype ch; - byte fv; - - filename = filename.format("chunk%s.avd", xx.c_str()); - if (!f.open(filename)) { - warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); +void Celer::loadBackgroundSprites(Common::String xx) { + _filename = _filename.format("chunk%s.avd", xx.c_str()); + if (!_f.open(_filename)) { + warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - f.seek(44); - num_chunks = f.readByte(); - for (byte i = 0; i < num_chunks; i++) - offsets[i] = f.readSint32LE(); + _f.seek(44); + _chunkNum = _f.readByte(); + for (byte i = 0; i < _chunkNum; i++) + _offsets[i] = _f.readSint32LE(); - for (fv = 0; fv < num_chunks; fv++) { - f.seek(offsets[fv]); + for (byte i = 0; i < _chunkNum; i++) { + _f.seek(_offsets[i]); - ch.flavour = flavourtype(f.readByte()); - ch.x = f.readSint16LE(); - ch.y = f.readSint16LE(); - ch.xl = f.readSint16LE(); - ch.yl = f.readSint16LE(); - ch.size = f.readSint32LE(); - ch.natural = f.readByte(); - ch.memorise = f.readByte(); + SpriteType sprite; + sprite._type = PictureType(_f.readByte()); + sprite._x = _f.readSint16LE(); + sprite._y = _f.readSint16LE(); + sprite._xl = _f.readSint16LE(); + sprite._yl = _f.readSint16LE(); + sprite._size = _f.readSint32LE(); + sprite._natural = _f.readByte(); + sprite._memorise = _f.readByte(); - if (ch.memorise) { - memos[fv].x = ch.x; - memos[fv].xl = ch.xl; - memos[fv].y = ch.y; - memos[fv].yl = ch.yl; - memos[fv].flavour = ch.flavour; - - if (ch.natural) { - memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. - memos[fv].size = memos[fv].xl * 8 * memos[fv].yl + 1; - memory[fv].create(memos[fv].xl * 8, memos[fv].yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - - for (uint16 j = 0; j < memos[fv].yl + 1; j++) - for (uint16 i = 0; i < memos[fv].xl * 8; i++) - *(byte *)memory[fv].getBasePtr(i, j) = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); + if (sprite._memorise) { + _memos[i]._x = sprite._x; + _memos[i]._xl = sprite._xl; + _memos[i]._y = sprite._y; + _memos[i]._yl = sprite._yl; + _memos[i]._type = sprite._type; + + if (sprite._natural) { + _memos[i]._type = kBaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. + _memos[i]._size = _memos[i]._xl * 8 * _memos[i]._yl + 1; + _memory[i].create(_memos[i]._xl * 8, _memos[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); + + for (uint16 y = 0; y < _memos[i]._yl + 1; y++) + for (uint16 x = 0; x < _memos[i]._xl * 8; x++) + *(byte *)_memory[i].getBasePtr(x, y) = *_vm->_graphics->getPixel(_memos[i]._x * 8 + x, _memos[i]._y + y); } else { - memos[fv].size = ch.size; - memory[fv] = _vm->_graphics->loadPictureRow(f, memos[fv].xl * 8, memos[fv].yl + 1); // Celer::forget_chunks() deallocates it. + _memos[i]._size = sprite._size; + _memory[i] = _vm->_graphics->loadPictureRow(_f, _memos[i]._xl * 8, _memos[i]._yl + 1); // Celer::forget_chunks() deallocates it. } } else - memos[fv].x = on_disk; + _memos[i]._x = kOnDisk; } - f.close(); + _f.close(); } -void Celer::forget_chunks() { - for (byte fv = 0; fv < num_chunks; fv ++) - if (memos[fv].x > on_disk) - memory[fv].free(); +void Celer::forgetBackgroundSprites() { + for (byte i = 0; i < _chunkNum; i ++) + if (_memos[i]._x > kOnDisk) + _memory[i].free(); - memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */ + memset(_memos, 255, sizeof(_memos)); /* x=-1, => on disk. */ } -void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture) { - r.x1 = x; - r.y1 = y; - r.y2 = y + yl; +void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType flavour, const ::Graphics::Surface &picture) { + _r.x1 = x; + _r.y1 = y; + _r.y2 = y + yl; switch (flavour) { - case ch_natural_image: // Allow fallthorugh on purpose. - case ch_bgi : { - r.x2 = x + xl + 1; + case kBaturalImage: // Allow fallthorugh on purpose. + case kBgi : { + _r.x2 = x + xl + 1; } break; - case ch_ega : { - r.x2 = x + xl; + case kEga : { + _r.x2 = x + xl; } break; } @@ -351,52 +341,52 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x, y - 10); } -void Celer::show_one(int16 destX, int16 destY, byte which) { - chunkblocktype ch; +void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { which--; // For the difference between the Pascal and C array indexes. //setactivepage(3); warning("STUB: Celer::show_one()"); - if (memos[which].x > on_disk) { - if (destX == -1) { - destX = memos[which].x * 8; - destY = memos[which].y; + if (_memos[which]._x > kOnDisk) { + if (destX < 0) { + destX = _memos[which]._x * 8; + destY = _memos[which]._y; } - display_it(destX, destY, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]); + drawSprite(destX, destY, _memos[which]._xl, _memos[which]._yl, _memos[which]._type, _memory[which]); } else { - if (!f.open(filename)) { /* Filename was set in load_chunks() */ - warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + if (!_f.open(_filename)) { /* Filename was set in load_chunks() */ + warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - f.seek(offsets[which]); + _f.seek(_offsets[which]); - ch.flavour = flavourtype(f.readByte()); - ch.x = f.readSint16LE(); - ch.y = f.readSint16LE(); - ch.xl = f.readSint16LE(); - ch.yl = f.readSint16LE(); - ch.size = f.readSint32LE(); - ch.natural = f.readByte(); - ch.memorise = f.readByte(); + SpriteType sprite; + sprite._type = PictureType(_f.readByte()); + sprite._x = _f.readSint16LE(); + sprite._y = _f.readSint16LE(); + sprite._xl = _f.readSint16LE(); + sprite._yl = _f.readSint16LE(); + sprite._size = _f.readSint32LE(); + sprite._natural = _f.readByte(); + sprite._memorise = _f.readByte(); - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(_f, sprite._xl * 8, sprite._yl + 1); - if (destX == -1) { - destX = ch.x * 8; - destY = ch.y; + if (destX < 0) { + destX = sprite._x * 8; + destY = sprite._y; } - display_it(destX, destY, ch.xl, ch.yl, ch.flavour, picture); + drawSprite(destX, destY, sprite._xl, sprite._yl, sprite._type, picture); picture.free(); - f.close(); + _f.close(); } //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); - for (byte fv = 0; fv < 2; fv ++) - _vm->_trip->getset[fv].remember(r); + for (byte i = 0; i < 2; i ++) + _vm->_trip->getset[i].remember(_r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 3c7eda3cd996..f85ba34df20f 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -36,35 +36,37 @@ #include "graphics/surface.h" + + namespace Avalanche { class AvalancheEngine; class Celer { public: - enum flavourtype {ch_ega, ch_bgi, ch_natural_image}; + enum PictureType {kEga, kBgi, kBaturalImage}; - struct chunkblocktype { - flavourtype flavour; - int16 x, y; - int16 xl, yl; - int32 size; - bool natural; + struct SpriteType { + PictureType _type; + int16 _x, _y; + int16 _xl, _yl; + int32 _size; + bool _natural; - bool memorise; /* Hold it in memory? */ + bool _memorise; /* Hold it in memory? */ }; - struct memotype { - int16 x, y; - int16 xl, yl; - flavourtype flavour; - uint16 size; + struct MemoType { + int16 _x, _y; + int16 _xl, _yl; + PictureType _type; + uint16 _size; }; - int32 offsets[40]; - byte num_chunks; - memotype memos[40]; - ::Graphics::Surface memory[40]; // .free() is called in ~Celer() - bytefield r; + int32 _offsets[40]; + byte _chunkNum; + MemoType _memos[40]; + ::Graphics::Surface _memory[40]; // .free() is called in ~Celer() + bytefield _r; @@ -72,27 +74,27 @@ class Celer { ~Celer(); - void pics_link(); + void refreshBackgroundSprites(); - void load_chunks(Common::String xx); + void loadBackgroundSprites(Common::String xx); - void forget_chunks(); + void forgetBackgroundSprites(); - // Settint the destination to -1,-1 means the picture should be drawn to it's original position. + // Setting the destination to negative coordinates means the picture should be drawn to it's original position. // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. - void show_one(int16 destX, int16 destY, byte which); + void drawBackgroundSprite(int16 destX, int16 destY, byte which); private: AvalancheEngine *_vm; - Common::String filename; + Common::String _filename; - Common::File f; + Common::File _f; - static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ + static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture); + void drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d2f0e8f2b9d5..9e04ddbfbad6 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -262,7 +262,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); - _vm->_celer->load_chunks(xx); + _vm->_celer->loadBackgroundSprites(xx); bit = *_vm->_graphics->getPixel(0,0); @@ -292,7 +292,7 @@ void Lucerna::find_people(byte room) { void Lucerna::exitroom(byte x) { //nosound(); - _vm->_celer->forget_chunks(); + _vm->_celer->forgetBackgroundSprites(); _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ switch (x) { @@ -391,7 +391,7 @@ void Lucerna::enterroom(byte x, byte ped) { switch (x) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } @@ -492,7 +492,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ - _vm->_celer->show_one(-1, -1, 3); /* Position of drawbridge */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Position of drawbridge */ _vm->_graphics->refreshBackground(); _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } @@ -518,10 +518,10 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.tied_up) - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); if (!_vm->_gyro->dna.mushroom_growing) - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); } break; @@ -603,11 +603,11 @@ void Lucerna::enterroom(byte x, byte ped) { case r__argentpub: { if (_vm->_gyro->dna.wonnim) - _vm->_celer->show_one(-1, -1, 1); /* No lute by the settle. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { - _vm->_celer->show_one(-1, -1, 8); - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); } _vm->_graphics->refreshBackground(); } @@ -624,7 +624,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); if (_vm->_gyro->dna.lustie_is_asleep) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); } } @@ -634,14 +634,14 @@ void Lucerna::enterroom(byte x, byte ped) { case r__musicroom: { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_gyro->magics[brown - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -653,7 +653,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidenottspub: if (ped == 2) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->then_show(2); @@ -665,7 +665,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideargentpub: if (ped == 2) { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -692,7 +692,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__insidecardiffcastle: if (ped > 0) { _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) @@ -701,22 +701,22 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(2); if (_vm->_gyro->dna.taken_pen) - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_sequence->start_to_close(); } else { - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); if (_vm->_gyro->dna.arrow_in_the_door) - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); else - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); } break; case r__avvysgarden: if (ped == 1) { - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -735,7 +735,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(3); _vm->_sequence->start_to_close();*/ - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -746,7 +746,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; /* Ayles awake. */ @@ -766,7 +766,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__nottspub: { - if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->show_one(-1, -1, 3); + if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ } break; @@ -774,7 +774,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideducks: if (ped == 2) { /* Shut the door */ - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->first_show(2); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index d9f52a3b179d..68a8ea33e335 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -102,7 +102,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer->show_one(-1, -1, seq[0]); + _vm->_celer->drawBackgroundSprite(-1, -1, seq[0]); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index ab1fcf072a79..7979a8d09aef 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -224,7 +224,7 @@ void Timeout::lose_timer(byte which) { void Timeout::open_drawbridge() { _vm->_gyro->dna.drawbridge_open++; - _vm->_celer->show_one(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); + _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) _vm->_gyro->magics[1].op = _vm->_gyro->nix; // You may enter the drawbridge. @@ -265,7 +265,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); _vm->_trip->tr[0].walkto(4); - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->dna.brummie_stairs = 2; _vm->_gyro->magics[10].op = _vm->_gyro->special; _vm->_gyro->magics[10].data = 2; // Reached the bottom of the stairs. @@ -379,17 +379,17 @@ void Timeout::jacques_wakes_up() { switch (_vm->_gyro->dna.jacques_awake) { // Additional pictures. case 1 : - _vm->_celer->show_one(-1, -1, 1); // Eyes open. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. _vm->_visa->dixi('Q', 45); break; case 2 : // Going through the door. - _vm->_celer->show_one(-1, -1, 2); // Not on the floor. - _vm->_celer->show_one(-1, -1, 3); // But going through the door. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. _vm->_gyro->magics[5].op = _vm->_gyro->nix; // You can't wake him up now. break; case 3 : // Gone through the door. - _vm->_celer->show_one(-1, -1, 2); // Not on the floor, either. - _vm->_celer->show_one(-1, -1, 4); // He's gone... so the door's open. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; // Gone! break; } @@ -418,7 +418,7 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your _vm->_trip->tr[1].walkto(3); // He walks over to you. // Let's get the door opening. - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); @@ -433,7 +433,7 @@ void Timeout::naughty_duke2() { } void Timeout::naughty_duke3() { - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); } @@ -475,7 +475,7 @@ void Timeout::jump() { if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->dna.arrow_in_the_door = false; // You've got it. _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; _vm->_lucerna->objectlist(); @@ -491,7 +491,7 @@ void Timeout::crapulus_says_splud_out() { } void Timeout::buydrinks() { - _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); // Display message about it. @@ -503,7 +503,7 @@ void Timeout::buydrinks() { } void Timeout::buywine() { - _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', 50); // You buy the wine. @@ -595,7 +595,7 @@ void Timeout::avvy_sit_down() { if (_vm->_trip->tr[0].homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->dna.sitting_in_pub = true; _vm->_gyro->dna.user_moves_avvy = false; _vm->_trip->tr[0].visible = false; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 5e42839e93fa..e03444656d48 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -578,59 +578,59 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); + _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; case 0x1: /* no connection (wall + shield), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door. */ break; case 0x3: /* wall with door and shield */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 5); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ break; case 0x5: /* wall with door and window */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 5); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -645,44 +645,44 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); + _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; case 0x1: /* no connection (wall + window), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 20); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...window. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 21); /* ...door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door. */ break; case 0x3: /* wall with door and window */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 20); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 21); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 21); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -700,7 +700,7 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x1: - _vm->_celer->show_one(-1, -1, 22); + _vm->_celer->drawBackgroundSprite(-1, -1, 22); if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; @@ -711,13 +711,13 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[11].op = _vm->_gyro->bounces; break; case 0x2: - _vm->_celer->show_one(-1, -1, 23); + _vm->_celer->drawBackgroundSprite(-1, -1, 23); _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Middle exit south. */ _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x3: - _vm->_celer->show_one(-1, -1, 24); + _vm->_celer->drawBackgroundSprite(-1, -1, 24); _vm->_gyro->magics[11].op = _vm->_gyro->special; /* Left exit south. */ _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; @@ -738,7 +738,7 @@ void Trip::catamove(byte ped) { break; */ case 0x2: - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; @@ -755,7 +755,7 @@ void Trip::catamove(byte ped) { break; */ case 0x5: - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; /* Middle exit north. */ _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; @@ -770,12 +770,12 @@ void Trip::catamove(byte ped) { case 0x7: case 0x8: case 0x9: { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->show_one(-1, -1, 31); + _vm->_celer->drawBackgroundSprite(-1, -1, 31); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->show_one(-1, -1, 32); + _vm->_celer->drawBackgroundSprite(-1, -1, 32); _vm->_gyro->magics[0].op = _vm->_gyro->special; /* Middle arch north. */ _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ @@ -785,50 +785,50 @@ void Trip::catamove(byte ped) { case 0xd: /* No connection + WINDOW */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 14); + _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; case 0xe: /* No connection + TORCH */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; /* Recessed door: */ case 0xf: _vm->_gyro->magics[0].op = _vm->_gyro->nix; /* Door to Geida's room. */ - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; } switch (xy_uint16) { case 514: - _vm->_celer->show_one(-1, -1, 17); + _vm->_celer->drawBackgroundSprite(-1, -1, 17); break; /* [2,2] : "Art Gallery" sign over door. */ case 264: - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); break; /* [8,1] : "The Wrong Way!" sign. */ case 1797: - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); break; /* [5,7] : "Ite Mingite" sign. */ case 258: for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ - _vm->_celer->show_one(130 + fv * 120, 70, 15); - _vm->_celer->show_one(184 + fv * 120, 78, 16); + _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); + _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); } break; case 1287: for (fv = 10; fv <= 13; fv++) - _vm->_celer->show_one(-1, -1, fv); + _vm->_celer->drawBackgroundSprite(-1, -1, fv); break; /* [7,5] : 4 candles. */ case 776: - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); break; /* [8,3] : 1 candle. */ case 2049: - _vm->_celer->show_one(-1, -1, 11); + _vm->_celer->drawBackgroundSprite(-1, -1, 11); break; /* [1,8] : another candle. */ case 257: - _vm->_celer->show_one(-1, -1, 12); - _vm->_celer->show_one(-1, -1, 13); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 13); break; /* [1,1] : the other two. */ } @@ -851,7 +851,7 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[9].op = _vm->_gyro->nix; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); @@ -897,7 +897,7 @@ void Trip::call_special(uint16 which) { _vm->_visa->dixi('q', 35); tr[0].done(); /*tr[1].vanishifstill:=true;*/ - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; @@ -1246,7 +1246,7 @@ void Trip::arrow_procs(byte tripnum) { } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ - _vm->_celer->show_one(-1, -1, 3); /* Show pic of arrow stuck into the door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Show pic of arrow stuck into the door. */ _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ } @@ -1493,7 +1493,7 @@ void Trip::hide_in_the_cupboard() { _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); _vm->_gyro->dna.avvys_in_the_cupboard = true; - _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); } } From a6fb557a516fd5deaef5be43b888ecdd9149daca Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 22:36:28 +0200 Subject: [PATCH 0750/1332] AVALANCHE: Some more renaming and a little bit of refactoring in Celer. --- engines/avalanche/celer2.cpp | 21 +++++++++++---------- engines/avalanche/celer2.h | 4 ++-- engines/avalanche/lucerna2.cpp | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 37329f1a6750..ec736490cc94 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -55,8 +55,6 @@ Celer::~Celer() { } void Celer::refreshBackgroundSprites() { - byte direction; - if (_vm->_gyro->ddmnow) return; // No animation when the menus are up. @@ -119,6 +117,7 @@ void Celer::refreshBackgroundSprites() { break; } + byte direction; if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) direction = 3; @@ -154,9 +153,9 @@ void Celer::refreshBackgroundSprites() { break; case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { + byte direction; if ((_vm->_gyro->roomtime % 45) > 42) direction = 4; // du Lustie blinks. - // Bearing of Avvy from du Lustie. else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) direction = 1; // Middle. @@ -197,6 +196,7 @@ void Celer::refreshBackgroundSprites() { break; case r__nottspub: { // Bearing of Avvy from Port. + byte direction; if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) direction = 2; // Middle. else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) @@ -227,6 +227,7 @@ void Celer::refreshBackgroundSprites() { drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); // Bearing of Avvy from Duck. + byte direction; if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) direction = 4; // Middle. else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) @@ -251,7 +252,7 @@ void Celer::refreshBackgroundSprites() { case 1: if (_vm->_gyro->dna.nextbell < 5) _vm->_gyro->dna.nextbell = 12; - _vm->_gyro->dna.nextbell -= 1; + _vm->_gyro->dna.nextbell--; _vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]); break; case 2: @@ -262,8 +263,8 @@ void Celer::refreshBackgroundSprites() { } } -void Celer::loadBackgroundSprites(Common::String xx) { - _filename = _filename.format("chunk%s.avd", xx.c_str()); +void Celer::loadBackgroundSprites(byte number) { + _filename = _filename.format("chunk%d.avd", number); if (!_f.open(_filename)) { warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; @@ -295,7 +296,7 @@ void Celer::loadBackgroundSprites(Common::String xx) { _memos[i]._type = sprite._type; if (sprite._natural) { - _memos[i]._type = kBaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. + _memos[i]._type = kNaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. _memos[i]._size = _memos[i]._xl * 8 * _memos[i]._yl + 1; _memory[i].create(_memos[i]._xl * 8, _memos[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -320,13 +321,13 @@ void Celer::forgetBackgroundSprites() { memset(_memos, 255, sizeof(_memos)); /* x=-1, => on disk. */ } -void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType flavour, const ::Graphics::Surface &picture) { +void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture) { _r.x1 = x; _r.y1 = y; _r.y2 = y + yl; - switch (flavour) { - case kBaturalImage: // Allow fallthorugh on purpose. + switch (type) { + case kNaturalImage: // Allow fallthorugh on purpose. case kBgi : { _r.x2 = x + xl + 1; } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index f85ba34df20f..07fb065b59c5 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -43,7 +43,7 @@ class AvalancheEngine; class Celer { public: - enum PictureType {kEga, kBgi, kBaturalImage}; + enum PictureType {kEga, kBgi, kNaturalImage}; struct SpriteType { PictureType _type; @@ -76,7 +76,7 @@ class Celer { void refreshBackgroundSprites(); - void loadBackgroundSprites(Common::String xx); + void loadBackgroundSprites(byte number); void forgetBackgroundSprites(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 9e04ddbfbad6..2b4c5fe363b2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -262,7 +262,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); - _vm->_celer->loadBackgroundSprites(xx); + _vm->_celer->loadBackgroundSprites(n); bit = *_vm->_graphics->getPixel(0,0); From 3fe9c6d90b6e5b416e0fa2d6db78044d066aaedf Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 22:48:38 +0200 Subject: [PATCH 0751/1332] AVALANCHE: Removing the file variable from Celer's member variables. --- engines/avalanche/celer2.cpp | 56 +++++++++++++++++++----------------- engines/avalanche/celer2.h | 2 -- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index ec736490cc94..4eefe3c47e7a 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -264,29 +264,30 @@ void Celer::refreshBackgroundSprites() { } void Celer::loadBackgroundSprites(byte number) { + Common::File f; _filename = _filename.format("chunk%d.avd", number); - if (!_f.open(_filename)) { + if (!f.open(_filename)) { warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - _f.seek(44); - _chunkNum = _f.readByte(); + f.seek(44); + _chunkNum = f.readByte(); for (byte i = 0; i < _chunkNum; i++) - _offsets[i] = _f.readSint32LE(); + _offsets[i] = f.readSint32LE(); for (byte i = 0; i < _chunkNum; i++) { - _f.seek(_offsets[i]); + f.seek(_offsets[i]); SpriteType sprite; - sprite._type = PictureType(_f.readByte()); - sprite._x = _f.readSint16LE(); - sprite._y = _f.readSint16LE(); - sprite._xl = _f.readSint16LE(); - sprite._yl = _f.readSint16LE(); - sprite._size = _f.readSint32LE(); - sprite._natural = _f.readByte(); - sprite._memorise = _f.readByte(); + sprite._type = PictureType(f.readByte()); + sprite._x = f.readSint16LE(); + sprite._y = f.readSint16LE(); + sprite._xl = f.readSint16LE(); + sprite._yl = f.readSint16LE(); + sprite._size = f.readSint32LE(); + sprite._natural = f.readByte(); + sprite._memorise = f.readByte(); if (sprite._memorise) { _memos[i]._x = sprite._x; @@ -305,12 +306,12 @@ void Celer::loadBackgroundSprites(byte number) { *(byte *)_memory[i].getBasePtr(x, y) = *_vm->_graphics->getPixel(_memos[i]._x * 8 + x, _memos[i]._y + y); } else { _memos[i]._size = sprite._size; - _memory[i] = _vm->_graphics->loadPictureRow(_f, _memos[i]._xl * 8, _memos[i]._yl + 1); // Celer::forget_chunks() deallocates it. + _memory[i] = _vm->_graphics->loadPictureRow(f, _memos[i]._xl * 8, _memos[i]._yl + 1); // Celer::forget_chunks() deallocates it. } } else _memos[i]._x = kOnDisk; } - _f.close(); + f.close(); } void Celer::forgetBackgroundSprites() { @@ -354,24 +355,25 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { } drawSprite(destX, destY, _memos[which]._xl, _memos[which]._yl, _memos[which]._type, _memory[which]); } else { - if (!_f.open(_filename)) { /* Filename was set in load_chunks() */ + Common::File f; + if (!f.open(_filename)) { // Filename was set in loadBackgroundSprites(). warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - _f.seek(_offsets[which]); + f.seek(_offsets[which]); SpriteType sprite; - sprite._type = PictureType(_f.readByte()); - sprite._x = _f.readSint16LE(); - sprite._y = _f.readSint16LE(); - sprite._xl = _f.readSint16LE(); - sprite._yl = _f.readSint16LE(); - sprite._size = _f.readSint32LE(); - sprite._natural = _f.readByte(); - sprite._memorise = _f.readByte(); + sprite._type = PictureType(f.readByte()); + sprite._x = f.readSint16LE(); + sprite._y = f.readSint16LE(); + sprite._xl = f.readSint16LE(); + sprite._yl = f.readSint16LE(); + sprite._size = f.readSint32LE(); + sprite._natural = f.readByte(); + sprite._memorise = f.readByte(); - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(_f, sprite._xl * 8, sprite._yl + 1); + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { destX = sprite._x * 8; @@ -380,7 +382,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { drawSprite(destX, destY, sprite._xl, sprite._yl, sprite._type, picture); picture.free(); - _f.close(); + f.close(); } //setactivepage(1 - cp); diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 07fb065b59c5..8f0a489b50e1 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -90,8 +90,6 @@ class Celer { Common::String _filename; - Common::File _f; - static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ void drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture); From 212391f337a3beee1fa4d987b62fe8494ab1fc02 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 23:41:15 +0200 Subject: [PATCH 0752/1332] AVALANCHE: Refactor Celer. --- engines/avalanche/celer2.cpp | 119 +++++++++++++++++------------------ engines/avalanche/celer2.h | 51 +++++++-------- 2 files changed, 80 insertions(+), 90 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 4eefe3c47e7a..daec21c2945f 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -44,16 +44,18 @@ namespace Avalanche { const int16 Celer::kOnDisk = -1; + Celer::Celer(AvalancheEngine *vm) { _vm = vm; - _chunkNum = 0; + _spriteNum = 0; } Celer::~Celer() { - for (byte i = 0; i < 40; i++) - _memory[i].free(); + forgetBackgroundSprites(); } + + void Celer::refreshBackgroundSprites() { if (_vm->_gyro->ddmnow) return; // No animation when the menus are up. @@ -272,11 +274,11 @@ void Celer::loadBackgroundSprites(byte number) { } f.seek(44); - _chunkNum = f.readByte(); - for (byte i = 0; i < _chunkNum; i++) + _spriteNum = f.readByte(); + for (byte i = 0; i < _spriteNum; i++) _offsets[i] = f.readSint32LE(); - for (byte i = 0; i < _chunkNum; i++) { + for (byte i = 0; i < _spriteNum; i++) { f.seek(_offsets[i]); SpriteType sprite; @@ -286,61 +288,38 @@ void Celer::loadBackgroundSprites(byte number) { sprite._xl = f.readSint16LE(); sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); - sprite._natural = f.readByte(); - sprite._memorise = f.readByte(); + bool natural = f.readByte(); + bool memorise = f.readByte(); - if (sprite._memorise) { - _memos[i]._x = sprite._x; - _memos[i]._xl = sprite._xl; - _memos[i]._y = sprite._y; - _memos[i]._yl = sprite._yl; - _memos[i]._type = sprite._type; - - if (sprite._natural) { - _memos[i]._type = kNaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. - _memos[i]._size = _memos[i]._xl * 8 * _memos[i]._yl + 1; - _memory[i].create(_memos[i]._xl * 8, _memos[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - - for (uint16 y = 0; y < _memos[i]._yl + 1; y++) - for (uint16 x = 0; x < _memos[i]._xl * 8; x++) - *(byte *)_memory[i].getBasePtr(x, y) = *_vm->_graphics->getPixel(_memos[i]._x * 8 + x, _memos[i]._y + y); + if (memorise) { + _sprites[i]._x = sprite._x; + _sprites[i]._xl = sprite._xl; + _sprites[i]._y = sprite._y; + _sprites[i]._yl = sprite._yl; + _sprites[i]._type = sprite._type; + + if (natural) { + _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. + _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; + _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); + + for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) + for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) + *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y); } else { - _memos[i]._size = sprite._size; - _memory[i] = _vm->_graphics->loadPictureRow(f, _memos[i]._xl * 8, _memos[i]._yl + 1); // Celer::forget_chunks() deallocates it. + _sprites[i]._size = sprite._size; + _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); // Celer::forget_chunks() deallocates it. } } else - _memos[i]._x = kOnDisk; + _sprites[i]._x = kOnDisk; } f.close(); } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _chunkNum; i ++) - if (_memos[i]._x > kOnDisk) - _memory[i].free(); - - memset(_memos, 255, sizeof(_memos)); /* x=-1, => on disk. */ -} - -void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture) { - _r.x1 = x; - _r.y1 = y; - _r.y2 = y + yl; - - switch (type) { - case kNaturalImage: // Allow fallthorugh on purpose. - case kBgi : { - _r.x2 = x + xl + 1; - } - break; - case kEga : { - _r.x2 = x + xl; - } - break; - } - - // These pictures are practically parts of the background. -10 is for the drop-down menu. - _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x, y - 10); + for (byte i = 0; i < _spriteNum; i ++) + if (_sprites[i]._x > kOnDisk) + _sprites[i]._picture.free(); } void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { @@ -348,12 +327,12 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { //setactivepage(3); warning("STUB: Celer::show_one()"); - if (_memos[which]._x > kOnDisk) { + if (_sprites[which]._x > kOnDisk) { if (destX < 0) { - destX = _memos[which]._x * 8; - destY = _memos[which]._y; + destX = _sprites[which]._x * 8; + destY = _sprites[which]._y; } - drawSprite(destX, destY, _memos[which]._xl, _memos[which]._yl, _memos[which]._type, _memory[which]); + drawSprite(destX, destY, _sprites[which]); } else { Common::File f; if (!f.open(_filename)) { // Filename was set in loadBackgroundSprites(). @@ -370,18 +349,15 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { sprite._xl = f.readSint16LE(); sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); - sprite._natural = f.readByte(); - sprite._memorise = f.readByte(); - - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); + f.skip(2); // For the now not existing natural and memorise data members of the SpriteType (called chunkblocktype in the original). + sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { destX = sprite._x * 8; destY = sprite._y; } - drawSprite(destX, destY, sprite._xl, sprite._yl, sprite._type, picture); + drawSprite(destX, destY, sprite); - picture.free(); f.close(); } @@ -394,4 +370,23 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { +void Celer::drawSprite(int16 x, int16 y, const SpriteType &sprite) { + _r.x1 = x; + _r.y1 = y; + _r.y2 = y + sprite._yl; + + switch (sprite._type) { + case kNaturalImage: // Allow fallthorugh on purpose. + case kBgi: + _r.x2 = x + sprite._xl + 1; + break; + case kEga: + _r.x2 = x + sprite._xl; + break; + } + + // These pictures are practically parts of the background. -10 is for the drop-down menu. + _vm->_graphics->drawPicture(_vm->_graphics->_background, sprite._picture, x, y - 10); +} + } // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 8f0a489b50e1..aac4c8885012 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -43,37 +43,12 @@ class AvalancheEngine; class Celer { public: - enum PictureType {kEga, kBgi, kNaturalImage}; - - struct SpriteType { - PictureType _type; - int16 _x, _y; - int16 _xl, _yl; - int32 _size; - bool _natural; - - bool _memorise; /* Hold it in memory? */ - }; - - struct MemoType { - int16 _x, _y; - int16 _xl, _yl; - PictureType _type; - uint16 _size; - }; - - int32 _offsets[40]; - byte _chunkNum; - MemoType _memos[40]; - ::Graphics::Surface _memory[40]; // .free() is called in ~Celer() - bytefield _r; - - - Celer(AvalancheEngine *vm); ~Celer(); + + void refreshBackgroundSprites(); void loadBackgroundSprites(byte number); @@ -86,13 +61,33 @@ class Celer { void drawBackgroundSprite(int16 destX, int16 destY, byte which); private: + enum PictureType {kEga, kBgi, kNaturalImage}; + + struct SpriteType { + PictureType _type; + int16 _x, _y; + int16 _xl, _yl; + int32 _size; + ::Graphics::Surface _picture; + }; + + + AvalancheEngine *_vm; + int32 _offsets[40]; + byte _spriteNum; + SpriteType _sprites[40]; + bytefield _r; Common::String _filename; + + static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ - void drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture); + + + void drawSprite(int16 x, int16 y, const SpriteType &sprite); }; } // End of namespace Avalanche. From 4ae897e3a95f8899b3056627f882e6179b4ebba3 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 23:56:37 +0200 Subject: [PATCH 0753/1332] AVALANCHE: Repair comments in Celer. --- engines/avalanche/celer2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index daec21c2945f..acfde95374aa 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -299,7 +299,7 @@ void Celer::loadBackgroundSprites(byte number) { _sprites[i]._type = sprite._type; if (natural) { - _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. + _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back. _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -308,7 +308,7 @@ void Celer::loadBackgroundSprites(byte number) { *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y); } else { _sprites[i]._size = sprite._size; - _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); // Celer::forget_chunks() deallocates it. + _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); } } else _sprites[i]._x = kOnDisk; From 9ea91f5c9c311276339e93ef64eaa53fd4435692 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:44:26 -0500 Subject: [PATCH 0754/1332] ZVISION: Convert ZVision singleton accessors to be inline --- engines/zvision/zvision.cpp | 16 ---------------- engines/zvision/zvision.h | 10 +++++----- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index b5cae8acd345..eb474c75eddc 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -164,24 +164,8 @@ void ZVision::pauseEngineIntern(bool pause) { } } -ScriptManager *ZVision::getScriptManager() const { - return _scriptManager; } -RenderManager *ZVision::getRenderManager() const { - return _renderManager; -} - -CursorManager *ZVision::getCursorManager() const { - return _cursorManager; -} - -Common::RandomSource *ZVision::getRandomSource() const { - return _rnd; -} - -ZVisionGameId ZVision::getGameId() const { - return _gameDescription->gameId; } void ZVision::cycleThroughCursors() { diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index f961f1fda97f..331fa2a9f872 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -108,11 +108,11 @@ class ZVision : public Engine { Common::Error run(); void pauseEngineIntern(bool pause); - ScriptManager *getScriptManager() const; - RenderManager *getRenderManager() const; - CursorManager *getCursorManager() const; - Common::RandomSource *getRandomSource() const; - ZVisionGameId getGameId() const; + ScriptManager *getScriptManager() const { return _scriptManager; } + RenderManager *getRenderManager() const { return _renderManager; } + CursorManager *getCursorManager() const { return _cursorManager; } + Common::RandomSource *getRandomSource() const { return _rnd; } + ZVisionGameId getGameId() const { return _gameDescription->gameId; } /** * Play a video until it is finished. This is a blocking call. It will call From 117eea1be6231ad26fe43f9080fa572b4deb73cb Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:46:14 -0500 Subject: [PATCH 0755/1332] ZVISION: Allow changeLocation to be executed right away instead of next frame --- engines/zvision/script_manager.cpp | 22 +++++++++------------- engines/zvision/script_manager.h | 4 +--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index b95f2636b092..f3c945d658e6 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -181,6 +181,9 @@ void ScriptManager::checkPuzzleCriteria() { bool shouldContinue = true; for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { shouldContinue = shouldContinue && (*resultIter)->execute(_engine); + if (!shouldContinue) { + break; + } } // Set the puzzle as completed @@ -258,18 +261,11 @@ bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Commo } void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { - _nextLocation.world = world; - _nextLocation.room = room; - _nextLocation.node = node; - _nextLocation.view = view; - _nextLocation.offset = offset; - - _changeLocation = true; -} + assert(world != 0); + debug("Changing location to: %c %c %c %c %u", world, room, node, view, offset); -void ScriptManager::changeLocationIntern() { - assert(_nextLocation.world != 0); - debug("Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset); + // Auto save + _engine->getSaveManager()->autoSave(); // Clear all the containers _referenceTable.clear(); @@ -290,11 +286,11 @@ void ScriptManager::changeLocationIntern() { _engine->getRenderManager()->setBackgroundVelocity(0); // Parse into puzzles and controls - Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view); + Common::String fileName = Common::String::format("%c%c%c%c.scr", world, room, node, view); parseScrFile(fileName); // Change the background position - _engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset); + _engine->getRenderManager()->setBackgroundPosition(offset); // Enable all the controls for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 1a272f197083..75be66c3f0f9 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -70,8 +70,7 @@ class ScriptManager { /** Holds the currently active controls */ Common::List _activeControls; - Location _nextLocation; - bool _changeLocation; + Location _currentLocation; public: void initialize(); @@ -113,7 +112,6 @@ class ScriptManager { private: void createReferenceTable(); - void changeLocationIntern(); void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); From dd307c2484f7d251fa447bc6c05a3c4512928681 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:48:11 -0500 Subject: [PATCH 0756/1332] ZVISION: Create method to get the current background offset --- engines/zvision/render_manager.cpp | 12 ++++++++++++ engines/zvision/render_manager.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 837e3880c704..e394baf50422 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -335,4 +335,16 @@ void RenderManager::moveBackground(int offset) { } } +uint32 RenderManager::getCurrentBackgroundOffset() { + RenderTable::RenderState state = _renderTable.getRenderState(); + + if (state == RenderTable::PANORAMA) { + return _backgroundOffset.x; + } else if (state == RenderTable::TILT) { + return _backgroundOffset.y; + } else { + return 0; + } +} + } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 41dedab792c9..1dcbf76d8c84 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -166,6 +166,7 @@ class RenderManager { const Common::Point screenSpaceToImageSpace(const Common::Point &point); RenderTable *getRenderTable(); + uint32 getCurrentBackgroundOffset(); private: /** From 9dd54a16e00be09cf549e38b03387e28efe9195d Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:53:30 -0500 Subject: [PATCH 0757/1332] ZVISION: Remove zero valued entries in the global state table once a frame --- engines/zvision/script_manager.cpp | 14 ++++++++++++++ engines/zvision/script_manager.h | 1 + 2 files changed, 15 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index f3c945d658e6..45e145929334 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -196,6 +196,17 @@ void ScriptManager::checkPuzzleCriteria() { } } +void ScriptManager::cleanStateTable() { + for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { + // If the value is equal to zero, we can purge it since getStateValue() + // will return zero if _globalState doesn't contain a key + if ((*iter)._value == 0) { + // Remove the node + _globalState.erase(iter); + } + } +} + uint ScriptManager::getStateValue(uint32 key) { if (_globalState.contains(key)) return _globalState[key]; @@ -285,6 +296,9 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, // Reset the background velocity _engine->getRenderManager()->setBackgroundVelocity(0); + // Clean the global state table + cleanStateTable(); + // Parse into puzzles and controls Common::String fileName = Common::String::format("%c%c%c%c.scr", world, room, node, view); parseScrFile(fileName); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 75be66c3f0f9..723f4fe0322e 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -114,6 +114,7 @@ class ScriptManager { void createReferenceTable(); void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); + void cleanStateTable(); // TODO: Make this private. It was only made public so Console::cmdParseAllScrFiles() could use it public: From b45c9e7c2683ee73ca1f54718b630597e9bc42c9 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:56:06 -0500 Subject: [PATCH 0758/1332] ZVISION: Create method for getting the current location --- engines/zvision/script_manager.cpp | 22 +++++++++++++++------- engines/zvision/script_manager.h | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 45e145929334..6330e206bead 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -37,8 +37,7 @@ namespace ZVision { ScriptManager::ScriptManager(ZVision *engine) - : _engine(engine), - _changeLocation(false) { + : _engine(engine) { } ScriptManager::~ScriptManager() { @@ -61,11 +60,6 @@ void ScriptManager::initialize() { void ScriptManager::update(uint deltaTimeMillis) { updateNodes(deltaTimeMillis); checkPuzzleCriteria(); - - if (_changeLocation) { - changeLocationIntern(); - _changeLocation = false; - } } void ScriptManager::createReferenceTable() { @@ -333,6 +327,20 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, // Create the puzzle reference table createReferenceTable(); + + // Update _currentLocation + _currentLocation.world = world; + _currentLocation.room = room; + _currentLocation.node = node; + _currentLocation.view = view; + _currentLocation.offset = offset; +} + +Location ScriptManager::getCurrentLocation() const { + Location location = _currentLocation; + location.offset = _engine->getRenderManager()->getCurrentBackgroundOffset(); + + return location; } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 723f4fe0322e..96123a84688c 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -110,6 +110,8 @@ class ScriptManager { void changeLocation(char world, char room, char node, char view, uint32 offset); + Location getCurrentLocation() const; + private: void createReferenceTable(); void updateNodes(uint deltaTimeMillis); From 11bf2405f80378dd49d539d61384bad7b32daad0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:56:55 -0500 Subject: [PATCH 0759/1332] ZVISION: Create base methods for Control serialization --- engines/zvision/control.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index b16ca7f73d8e..9144c32dd421 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -29,6 +29,7 @@ namespace Common { class SeekableReadStream; struct Point; +class WriteStream; } namespace ZVision { @@ -74,6 +75,36 @@ class Control { * @return If true, the node can be deleted after process() finishes */ virtual bool process(uint32 deltaTimeInMillis) { return false; } + /** + * Serialize a Control for save game use. This should only be used if a Control needs + * to save values that would be different from initialization. AKA a TimerNode needs to + * store the amount of time left on the timer. Any Controls overriding this *MUST* write + * their key as the first data outputted. The default implementation is NOP. + * + * NOTE: If this method is overridden, you MUST also override deserialize() + * and needsSerialization() + * + * @param stream Stream to write any needed data to + */ + virtual void serialize(Common::WriteStream *stream) {} + /** + * De-serialize data from a save game stream. This should only be implemented if the + * Control also implements serialize(). The calling method assumes the size of the + * data read from the stream exactly equals that written in serialize(). The default + * implementation is NOP. + * + * NOTE: If this method is overridden, you MUST also override serialize() + * and needsSerialization() + * + * @param stream Save game file stream + */ + virtual void deserialize(Common::SeekableReadStream *stream) {} + /** + * If a Control overrides serialize() and deserialize(), this should return true + * + * @return Does the Control need save game serialization? + */ + virtual inline bool needsSerialization() { return false; } protected: ZVision * _engine; From ac578bf9b7b9c58dbaad58c874517b7af45dfa3f Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:57:19 -0500 Subject: [PATCH 0760/1332] ZVISION: Implement TimerNode serialization --- engines/zvision/timer_node.cpp | 11 +++++++++++ engines/zvision/timer_node.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp index c9ef9d29d16b..81468dbb0bfe 100644 --- a/engines/zvision/timer_node.cpp +++ b/engines/zvision/timer_node.cpp @@ -22,6 +22,8 @@ #include "common/scummsys.h" +#include "common/stream.h" + #include "zvision/timer_node.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" @@ -43,4 +45,13 @@ bool TimerNode::process(uint32 deltaTimeInMillis) { return false; } +void TimerNode::serialize(Common::WriteStream *stream) { + stream->writeUint32LE(_key); + stream->writeUint32LE(_timeLeft); +} + +void TimerNode::deserialize(Common::SeekableReadStream *stream) { + _timeLeft = stream->readUint32LE(); +} + } // End of namespace ZVision diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index d692f1f0caad..21c344bb15d2 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -43,6 +43,9 @@ class TimerNode : public Control { * @return If true, the node can be deleted after process() finishes */ bool process(uint32 deltaTimeInMillis); + void serialize(Common::WriteStream *stream); + void deserialize(Common::SeekableReadStream *stream); + inline bool needsSerialization() { return true; } private: uint32 _timeLeft; From 644af30df572f4965d63e1dba77c574a1d5ad69a Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:58:25 -0500 Subject: [PATCH 0761/1332] ZVISION: Create ScriptManager state table serialization methods --- engines/zvision/script_manager.cpp | 24 ++++++++++++++++++++++++ engines/zvision/script_manager.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 6330e206bead..25cbc6d2853b 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -25,11 +25,13 @@ #include "common/algorithm.h" #include "common/hashmap.h" #include "common/debug.h" +#include "common/stream.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/cursor_manager.h" +#include "zvision/save_manager.h" #include "zvision/actions.h" #include "zvision/action_node.h" #include "zvision/utility.h" @@ -336,6 +338,28 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _currentLocation.offset = offset; } +void ScriptManager::serializeStateTable(Common::WriteStream *stream) { + // Write the number of state value entries + stream->writeUint32LE(_globalState.size()); + + for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { + // Write out the key/value pair + stream->writeUint32LE((*iter)._key); + stream->writeUint32LE((*iter)._value); + } +} + +void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) { + // Read the number of key/value pairs + uint32 numberOfPairs = stream->readUint32LE(); + + for (uint32 i = 0; i < numberOfPairs; i++) { + uint32 key = stream->readUint32LE(); + uint32 value = stream->readUint32LE(); + setStateValue(key, value); + } +} + Location ScriptManager::getCurrentLocation() const { Location location = _currentLocation; location.offset = _engine->getRenderManager()->getCurrentBackgroundOffset(); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 96123a84688c..c5377504a820 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -110,6 +110,8 @@ class ScriptManager { void changeLocation(char world, char room, char node, char view, uint32 offset); + void serializeStateTable(Common::WriteStream *stream); + void deserializeStateTable(Common::SeekableReadStream *stream); Location getCurrentLocation() const; private: From 23ae67c7776f5f3a2207109e7d6cdaef16940979 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:59:00 -0500 Subject: [PATCH 0762/1332] ZVISION: Create ScriptManager _activeControls serialization methods --- engines/zvision/script_manager.cpp | 30 ++++++++++++++++++++++++++++++ engines/zvision/script_manager.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 25cbc6d2853b..d5fcf81ed504 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -360,6 +360,36 @@ void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) { } } +void ScriptManager::serializeControls(Common::WriteStream *stream) { + // Count how many controls need to save their data + // Because WriteStream isn't seekable + uint32 numberOfControlsNeedingSerialization = 0; + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + if ((*iter)->needsSerialization()) { + numberOfControlsNeedingSerialization++; + } + } + stream->writeUint32LE(numberOfControlsNeedingSerialization); + + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->serialize(stream); + } +} + +void ScriptManager::deserializeControls(Common::SeekableReadStream *stream) { + uint32 numberOfControls = stream->readUint32LE(); + + for (uint32 i = 0; i < numberOfControls; i++) { + uint32 key = stream->readUint32LE(); + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + if ((*iter)->getKey() == key) { + (*iter)->deserialize(stream); + break; + } + } + } +} + Location ScriptManager::getCurrentLocation() const { Location location = _currentLocation; location.offset = _engine->getRenderManager()->getCurrentBackgroundOffset(); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index c5377504a820..d2ad4acfff76 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -112,6 +112,9 @@ class ScriptManager { void serializeStateTable(Common::WriteStream *stream); void deserializeStateTable(Common::SeekableReadStream *stream); + void serializeControls(Common::WriteStream *stream); + void deserializeControls(Common::SeekableReadStream *stream); + Location getCurrentLocation() const; private: From 235620750a493afdb592f36521fb693533c6dec0 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 4 Sep 2013 00:12:41 -0500 Subject: [PATCH 0763/1332] ZVISION: Create methods for generating save file names --- engines/zvision/zvision.cpp | 4 ++++ engines/zvision/zvision.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index eb474c75eddc..85e357e80fd3 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -164,8 +164,12 @@ void ZVision::pauseEngineIntern(bool pause) { } } +Common::String ZVision::generateSaveFileName(uint slot) { + return Common::String::format("%s.%02u", _targetName.c_str(), slot); } +Common::String ZVision::generateAutoSaveFileName() { + return Common::String::format("%s.auto", _targetName.c_str()); } void ZVision::cycleThroughCursors() { diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 331fa2a9f872..a43855737d01 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -135,6 +135,9 @@ class ZVision : public Engine { */ void cycleThroughCursors(); + Common::String generateSaveFileName(uint slot); + Common::String generateAutoSaveFileName(); + private: void initialize(); From 488484d2dccc146421da452420a3966a40970c55 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 4 Sep 2013 00:17:37 -0500 Subject: [PATCH 0764/1332] ZVISION: Implement SaveManager --- engines/zvision/module.mk | 1 + engines/zvision/save_manager.cpp | 176 +++++++++++++++++++++++++++++++ engines/zvision/save_manager.h | 39 ++++++- 3 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 engines/zvision/save_manager.cpp diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 48b8a6607709..c8c60ca8cede 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -17,6 +17,7 @@ MODULE_OBJS := \ render_manager.o \ render_table.o \ rlf_animation.o \ + save_manager.o \ scr_file_handling.o \ script_manager.o \ scripts.o \ diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp new file mode 100644 index 000000000000..9611b9c9b78e --- /dev/null +++ b/engines/zvision/save_manager.cpp @@ -0,0 +1,176 @@ +/* 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/scummsys.h" + +#include "common/system.h" + +#include "graphics/surface.h" +#include "graphics/thumbnail.h" + +#include "zvision/save_manager.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" + + +namespace ZVision { + +const uint32 SaveManager::SAVEGAME_ID = MKTAG('Z', 'E', 'N', 'G'); + +void SaveManager::saveGame(uint slot, const Common::String &saveName) { + Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); + Common::OutSaveFile *file = saveFileManager->openForSaving(_engine->generateSaveFileName(slot)); + + // Write out the savegame header + file->writeUint32BE(SAVEGAME_ID); + + // Write savegame name + file->writeString(saveName); + file->writeByte(0); + + // We can't call writeGameSaveData because the save menu is actually + // a room, so writeGameSaveData would save us in the save menu. + // However, an auto save is performed before each room change, so we + // can copy the data from there. We can guarantee that an auto save file will + // exist before this is called because the save menu can only be accessed + // after the first room (the main menu) has loaded. + Common::InSaveFile *autoSaveFile = saveFileManager->openForLoading(_engine->generateAutoSaveFileName()); + + // Skip over the header info + autoSaveFile->readSint32BE(); // SAVEGAME_ID + autoSaveFile->seek(5, SEEK_CUR); // The string "auto" with terminating NULL + + // Read the rest to a buffer + uint32 size = autoSaveFile->size() - autoSaveFile->pos(); + byte *buffer = new byte[size]; + autoSaveFile->read(buffer, size); + + // Then write the buffer to the new file + file->write(buffer, size); + + // Cleanup + delete[] buffer; + file->finalize(); +} + +void SaveManager::autoSave() { + Common::OutSaveFile *file = g_system->getSavefileManager()->openForSaving(_engine->generateAutoSaveFileName()); + + // Write out the savegame header + file->writeUint32BE(SAVEGAME_ID); + + file->writeString("auto"); + file->writeByte(0); + + writeSaveGameData(file); + + file->finalize(); +} + +void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { + // Create a thumbnail and save it + Graphics::saveThumbnail(*file); + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + file->writeSint16LE(td.tm_year + 1900); + file->writeSint16LE(td.tm_mon + 1); + file->writeSint16LE(td.tm_mday); + file->writeSint16LE(td.tm_hour); + file->writeSint16LE(td.tm_min); + + ScriptManager *scriptManager = _engine->getScriptManager(); + // Write out the current location + Location currentLocation = scriptManager->getCurrentLocation(); + file->writeByte(currentLocation.world); + file->writeByte(currentLocation.room); + file->writeByte(currentLocation.node); + file->writeByte(currentLocation.view); + file->writeUint32LE(currentLocation.offset); + + // Write out the current state table values + scriptManager->serializeStateTable(file); + + // Write out any controls needing to save state + scriptManager->serializeControls(file); +} + +Common::Error SaveManager::loadGame(uint slot) { + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_engine->generateSaveFileName(slot)); + if (saveFile == 0) { + return Common::kPathDoesNotExist; + } + + // Read the header + SaveGameHeader header; + if (!readSaveGameHeader(saveFile, header)) { + return Common::kUnknownError; + } + + char world = (char)saveFile->readByte(); + char room = (char)saveFile->readByte(); + char node = (char)saveFile->readByte(); + char view = (char)saveFile->readByte(); + uint32 offset = (char)saveFile->readUint32LE(); + + ScriptManager *scriptManager = _engine->getScriptManager(); + // Load the room + scriptManager->changeLocation(world, room, node, view, offset); + + // Update the state table values + scriptManager->deserializeStateTable(saveFile); + + // Update the controls + scriptManager->deserializeControls(saveFile); + + return Common::kNoError; +} + +bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { + if (in->readSint32BE() != SAVEGAME_ID) { + warning("File is not a ZVision save file. Aborting load"); + return false; + } + + // 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; +} + +} // End of namespace ZVision diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index 487cf203fba1..ae65750b42dd 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -23,6 +23,43 @@ #ifndef ZVISION_SAVE_MANAGER_H #define ZVISION_SAVE_MANAGER_H -// TODO: Implement SaveManager +#include "common/types.h" + +#include "common/savefile.h" + +namespace Common { +class String; +} + +namespace ZVision { + +class ZVision; + +struct SaveGameHeader { + Common::String saveName; + Graphics::Surface *thumbnail; + int saveYear, saveMonth, saveDay; + int saveHour, saveMinutes; +}; + +class SaveManager { +public: + SaveManager(ZVision *engine); + +private: + ZVision *_engine; + static const uint32 SAVEGAME_ID; + +public: + void autoSave(); + void saveGame(uint slot, const Common::String &saveName); + Common::Error loadGame(uint slot); + +private: + void writeSaveGameData(Common::OutSaveFile *file); + bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); +}; + +} // End of namespace ZVision #endif From 7ff45447adca39bca5be78bac34e8f900644edae Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 4 Sep 2013 00:18:05 -0500 Subject: [PATCH 0765/1332] ZVISION: Create an instance of SaveManager --- engines/zvision/zvision.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index a43855737d01..1a259d0a22b3 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -48,6 +48,7 @@ class Console; class ScriptManager; class RenderManager; class CursorManager; +class SaveManager; class RlfAnimation; // our engine debug channels @@ -95,6 +96,7 @@ class ZVision : public Engine { ScriptManager *_scriptManager; RenderManager *_renderManager; CursorManager *_cursorManager; + SaveManager *_saveManager; // Clock Clock _clock; @@ -111,6 +113,7 @@ class ZVision : public Engine { ScriptManager *getScriptManager() const { return _scriptManager; } RenderManager *getRenderManager() const { return _renderManager; } CursorManager *getCursorManager() const { return _cursorManager; } + SaveManager *getSaveManager() const { return _saveManager; } Common::RandomSource *getRandomSource() const { return _rnd; } ZVisionGameId getGameId() const { return _gameDescription->gameId; } From 150a4793a670fb06b7997d7964f9626f3a238766 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 4 Sep 2013 00:19:03 -0500 Subject: [PATCH 0766/1332] ZVISION: Initialize Location to the main menu This ensures that the first auto save of the game will have a useful location --- engines/zvision/script_manager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index d2ad4acfff76..61ad4fa87a78 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -39,6 +39,8 @@ namespace ZVision { class ZVision; struct Location { + Location() : world('g'), room('a'), node('r'), view('y'), offset(0) {} + char world; char room; char node; From 4cf40bc87a0252c6533d0896143c511669b417af Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 09:25:11 +0200 Subject: [PATCH 0767/1332] AVALANCHE: Rename refreshBackgroundSprites() to updateBackgroundSprites() in Celer. --- engines/avalanche/acci2.cpp | 4 ++-- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/celer2.cpp | 2 +- engines/avalanche/celer2.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index c75bfa4fcc1a..57ecb8e4e3f2 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -716,7 +716,7 @@ void Acci::openBox(bool isOpening) { if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); - _vm->_celer->refreshBackgroundSprites(); + _vm->_celer->updateBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); @@ -724,7 +724,7 @@ void Acci::openBox(bool isOpening) { if (!isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); - _vm->_celer->refreshBackgroundSprites(); + _vm->_celer->updateBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d3dfbff15a70..2f098990a94c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -482,7 +482,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _gyro->ontoolbar = false; _trip->trippancy_link(); - _celer->refreshBackgroundSprites(); + _celer->updateBackgroundSprites(); _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index cade90ef3b91..7e0f84ed0fc6 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -204,7 +204,7 @@ void Avalot::run(Common::String arg) { _vm->_dropdown->menu_link(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); - _vm->_celer->refreshBackgroundSprites(); + _vm->_celer->updateBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_lucerna->checkclick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index acfde95374aa..ababd4a86db6 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -56,7 +56,7 @@ Celer::~Celer() { -void Celer::refreshBackgroundSprites() { +void Celer::updateBackgroundSprites() { if (_vm->_gyro->ddmnow) return; // No animation when the menus are up. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index aac4c8885012..56c5f22d09c6 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -49,7 +49,7 @@ class Celer { - void refreshBackgroundSprites(); + void updateBackgroundSprites(); void loadBackgroundSprites(byte number); From a2c42df2b21bb913fc44fae05456da9f069c1b64 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 4 Sep 2013 01:06:03 +0200 Subject: [PATCH 0768/1332] AVALANCHE: Fix compile errors Signed-off-by: uruk --- engines/avalanche/acci2.cpp | 98 ++++++++++++++++----------------- engines/avalanche/dropdown2.cpp | 28 +++++----- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/trip6.cpp | 12 ++-- engines/avalanche/visa2.cpp | 14 ++--- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 57ecb8e4e3f2..72653b276d44 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -629,7 +629,7 @@ void Acci::examineObject() { if (_thing != _vm->_gyro->thinks) _vm->_lucerna->thinkabout(_thing, _vm->_gyro->a_thing); switch (_thing) { - case _vm->_gyro->wine : + case Gyro::wine : switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_visa->dixi('t', 1); // Normal examine wine scroll @@ -642,7 +642,7 @@ void Acci::examineObject() { break; } break; - case _vm->_gyro->onion: + case Gyro::onion: if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('q', 21); // Yucky onion. else @@ -775,7 +775,7 @@ void Acci::inventory() { void Acci::swallow() { /* Eat something. */ switch (_thing) { - case _vm->_gyro->wine: + case Gyro::wine: switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ case 1: { if (_vm->_gyro->dna.teetotal) { @@ -796,25 +796,25 @@ void Acci::swallow() { /* Eat something. */ break; /* You can't drink it! */ } break; - case _vm->_gyro->potion: { + case Gyro::potion: { _vm->_gyro->background(4); _vm->_visa->dixi('U', 3); _vm->_lucerna->gameover(); _vm->_gyro->background(0); } break; - case _vm->_gyro->ink: + case Gyro::ink: _vm->_visa->dixi('U', 4); break; - case _vm->_gyro->chastity: + case Gyro::chastity: _vm->_visa->dixi('U', 5); break; - case _vm->_gyro->mushroom: { + case Gyro::mushroom: { _vm->_visa->dixi('U', 6); _vm->_lucerna->gameover(); } break; - case _vm->_gyro->onion: + case Gyro::onion: if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('U', 11); else { @@ -931,21 +931,21 @@ void Acci::openDoor() { fv -= 8; switch (_vm->_gyro->portals[fv].op) { - case _vm->_gyro->exclaim: + case Gyro::exclaim: _vm->_trip->tr[0].bounce(); _vm->_visa->dixi('word', _vm->_gyro->portals[fv].data); break; - case _vm->_gyro->transport: + case Gyro::transport: _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); break; - case _vm->_gyro->unfinished: + case Gyro::unfinished: _vm->_trip->tr[0].bounce(); _vm->_scrolls->display("Sorry. This place is not available yet!"); break; - case _vm->_gyro->special: + case Gyro::special: _vm->_trip->call_special(_vm->_gyro->portals[fv].data); break; - case _vm->_gyro->mopendoor: + case Gyro::mopendoor: _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv + 9); break; } @@ -980,7 +980,7 @@ void Acci::putProc() { // Thing is the _thing which you're putting in. _thing2 is where you're putting it. switch (_thing2) { - case _vm->_gyro->wine: + case Gyro::wine: if (_thing == _vm->_gyro->onion) { if (_vm->_gyro->dna.rotten_onion) _vm->_scrolls->display("That's a bit like shutting the stable door after the horse has bolted!"); @@ -1004,16 +1004,16 @@ void Acci::putProc() { _vm->_scrolls->display("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { - case _vm->_gyro->money: + case Gyro::money: _vm->_scrolls->display("You'd better keep some ready cash on you!"); break; - case _vm->_gyro->bell: + case Gyro::bell: _vm->_scrolls->display("That's a silly place to keep a bell."); break; - case _vm->_gyro->bodkin: + case Gyro::bodkin: _vm->_scrolls->display("But you might need it!"); break; - case _vm->_gyro->onion: + case Gyro::onion: _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... @@ -1061,7 +1061,7 @@ bool Acci::giveToSpludwick() { } switch (_thing) { - case _vm->_gyro->onion: + case Gyro::onion: _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; if (_vm->_gyro->dna.rotten_onion) _vm->_visa->dixi('pos', 22); @@ -1073,7 +1073,7 @@ bool Acci::giveToSpludwick() { } _vm->_lucerna->objectlist(); break; - case _vm->_gyro->ink: + case Gyro::ink: _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick++; @@ -1081,7 +1081,7 @@ bool Acci::giveToSpludwick() { goToCauldron(); _vm->_lucerna->points(3); break; - case _vm->_gyro->mushroom: + case Gyro::mushroom: _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; _vm->_visa->dixi('pos', 25); _vm->_lucerna->points(5); @@ -1192,7 +1192,7 @@ void Acci::getProc(char thing) { break; case r__insidecardiffcastle: switch (thing) { - case _vm->_gyro->pen: + case Gyro::pen: if (_vm->_trip->infield(2)) { // Standing on the dais. if (_vm->_gyro->dna.taken_pen) _vm->_scrolls->display("It's not there, Avvy."); @@ -1210,7 +1210,7 @@ void Acci::getProc(char thing) { else _vm->_visa->dixi('pos', 51); break; - case _vm->_gyro->bolt: + case Gyro::bolt: _vm->_visa->dixi('pos', 52); break; default: @@ -1388,35 +1388,35 @@ void Acci::doThat() { _vm->_scrolls->display("Give to whom?"); else if (isPersonHere()) { switch (_thing) { - case _vm->_gyro->money : + case Gyro::money : _vm->_scrolls->display("You can't bring yourself to give away your moneybag."); break; - case _vm->_gyro->bodkin: - case _vm->_gyro->bell: - case _vm->_gyro->clothes: - case _vm->_gyro->habit : + case Gyro::bodkin: + case Gyro::bell: + case Gyro::clothes: + case Gyro::habit : _vm->_scrolls->display("Don't give it away, it might be useful!"); break; default: switch (_person) { - case _vm->_gyro->pcrapulus: + case Gyro::pcrapulus: if (_thing == _vm->_gyro->wine) { _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; } else heyThanks(); break; - case _vm->_gyro->pcwytalot: + case Gyro::pcwytalot: if ((_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) _vm->_scrolls->display(Common::String("You might be able to influence Cwytalot more if you used it!")); else heyThanks(); break; - case _vm->_gyro->pspludwick: + case Gyro::pspludwick: if (giveToSpludwick()) heyThanks(); break; - case _vm->_gyro->pibythneth: + case Gyro::pibythneth: if (_thing == _vm->_gyro->badge) { _vm->_visa->dixi('pos', 32); // Thanks! Wow! _vm->_lucerna->points(3); @@ -1428,7 +1428,7 @@ void Acci::doThat() { } else heyThanks(); break; - case _vm->_gyro->payles: + case Gyro::payles: if (_vm->_gyro->dna.ayles_is_awake) { if (_thing == _vm->_gyro->pen) { _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; @@ -1442,25 +1442,25 @@ void Acci::doThat() { } else _vm->_scrolls->display("But he's asleep!"); break; - case _vm->_gyro->pgeida: + case Gyro::pgeida: switch (_thing) { - case _vm->_gyro->potion: + case Gyro::potion: _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = false; _vm->_visa->dixi('u', 16); // She drinks it. _vm->_lucerna->points(2); _vm->_gyro->dna.geida_given_potion = true; _vm->_lucerna->objectlist(); break; - case _vm->_gyro->lute: + case Gyro::lute: giveGeidaTheLute(); break; default: heyThanks(); } break; - case _vm->_gyro->parkata: + case Gyro::parkata: switch (_thing) { - case _vm->_gyro->potion: + case Gyro::potion: if (_vm->_gyro->dna.geida_given_potion) winSequence(); else @@ -1544,11 +1544,11 @@ void Acci::doThat() { case kVerbCodeWear: if (holding()) { // Wear something. switch (_thing) { - case _vm->_gyro->chastity: + case Gyro::chastity: _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??!"); break; - case _vm->_gyro->clothes: - case _vm->_gyro->habit: { /* Change this! */ + case Gyro::clothes: + case Gyro::habit: { /* Change this! */ if (_vm->_gyro->dna.wearing != kNothing) { if (_vm->_gyro->dna.wearing == _thing) _vm->_scrolls->display("You're already wearing that."); @@ -1625,7 +1625,7 @@ void Acci::doThat() { } } else if (holding()) { switch (_thing) { - case _vm->_gyro->lute : { + case Gyro::lute : { _vm->_visa->dixi('U', 7); if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) @@ -1772,7 +1772,7 @@ void Acci::doThat() { case 52: examine(); break; // We have a right one here - buy Pepsi??! - case _vm->_gyro->wine: + case Gyro::wine: if (_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) // We've already got the wine! _vm->_visa->dixi('D', 2); // 1 bottle's shufishent! else { @@ -1918,13 +1918,13 @@ void Acci::doThat() { _vm->_scrolls->display("Kiss whom?"); else if (isPersonHere()) { switch (_person) { - case _vm->_gyro->parkata: + case Gyro::parkata: _vm->_visa->dixi('U', 12); break; - case _vm->_gyro->pgeida: + case Gyro::pgeida: _vm->_visa->dixi('U', 13); break; - case _vm->_gyro->pwisewoman: + case Gyro::pwisewoman: _vm->_visa->dixi('U', 14); break; default: @@ -1952,7 +1952,7 @@ void Acci::doThat() { if (isPersonHere()) switch (_person) { case kPardon: - case _vm->_gyro->pavalot: + case Gyro::pavalot: case 0: if (!_vm->_gyro->dna.avvy_is_awake) { _vm->_gyro->dna.avvy_is_awake = true; @@ -1964,11 +1964,11 @@ void Acci::doThat() { } else _vm->_scrolls->display("You're already awake, Avvy!"); break; - case _vm->_gyro->payles: + case Gyro::payles: if (!_vm->_gyro->dna.ayles_is_awake) _vm->_scrolls->display("You can't seem to wake him by yourself."); break; - case _vm->_gyro->pjacques: + case Gyro::pjacques: _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 95a6724f7ea1..224fb0128cfa 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -316,25 +316,25 @@ Dropdown::Dropdown(AvalancheEngine *vm) { void Dropdown::find_what_you_can_do_with_it() { switch (_vm->_gyro->thinks) { - case _vm->_gyro->wine: - case _vm->_gyro->potion: - case _vm->_gyro->ink: + case Gyro::wine: + case Gyro::potion: + case Gyro::ink: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeDrink; break; - case _vm->_gyro->bell: + case Gyro::bell: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeRing; break; - case _vm->_gyro->chastity: + case Gyro::chastity: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; - case _vm->_gyro->lute: + case Gyro::lute: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodePlay; break; - case _vm->_gyro->mushroom: - case _vm->_gyro->onion: + case Gyro::mushroom: + case Gyro::onion: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeEat; break; - case _vm->_gyro->clothes: + case Gyro::clothes: _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; default: @@ -578,18 +578,18 @@ void Dropdown::ddm__with() { ddm_o.opt(Common::String("Talk to h") + himher(_vm->_gyro->thinks), 'T', "", true); _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; switch (_vm->_gyro->thinks) { - case _vm->_gyro->pgeida: - case _vm->_gyro->parkata: { + case Gyro::pgeida: + case Gyro::parkata: { ddm_o.opt("Kiss her", 'K', "", true); _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeKiss; } break; - case _vm->_gyro->pdogfood: { + case Gyro::pdogfood: { ddm_o.opt("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodePlay; } break; - case _vm->_gyro->pmalagauche: { + case Gyro::pmalagauche: { n = !_vm->_gyro->dna.teetotal; ddm_o.opt("Buy some wine", 'w', "", !_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]); ddm_o.opt("Buy some beer", 'b', "", n); @@ -599,7 +599,7 @@ void Dropdown::ddm__with() { _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\145' + '\144' + '\146' + '\147' + '\150'; } break; - case _vm->_gyro->ptrader: { + case Gyro::ptrader: { ddm_o.opt("Buy an onion", 'o', "", !_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]); _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\151'; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f21645d0e269..300d275346c0 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -783,7 +783,7 @@ void Scrolls::calldrivers() { return; } break; - case _vm->_acci->kNothing: + case Acci::kNothing: display("nothing at all. It's completely empty."); break; default: diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index e03444656d48..dc45c6c2d7c2 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -222,27 +222,27 @@ void triptype::walk() { if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { switch (_tr->_vm->_gyro->magics[tc].op) { - case _tr->_vm->_gyro->exclaim: { + case Gyro::exclaim: { bounce(); _tr->mustexclaim = true; _tr->saywhat = _tr->_vm->_gyro->magics[tc].data; } break; - case _tr->_vm->_gyro->bounces: + case Gyro::bounces: bounce(); break; - case _tr->_vm->_gyro->transport: + case Gyro::transport: _tr->fliproom(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff); break; - case _tr->_vm->_gyro->unfinished: { + case Gyro::unfinished: { bounce(); _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); } break; - case _tr->_vm->_gyro->special: + case Gyro::special: _tr->call_special(_tr->_vm->_gyro->magics[tc].data); break; - case _tr->_vm->_gyro->mopendoor: + case Gyro::mopendoor: _tr->open_the_door(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff, tc); break; } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 8a311d0ad93d..0c005fa23f0c 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -171,7 +171,7 @@ void Visa::talkto(byte whom) { if (_vm->_gyro->subjnumber == 0) switch (whom) { - case _vm->_gyro->pspludwick: + case Gyro::pspludwick: if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion - 1])) { dixi('q', 68); _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; @@ -201,20 +201,20 @@ void Visa::talkto(byte whom) { } } break; - case _vm->_gyro->pibythneth: + case Gyro::pibythneth: if (_vm->_gyro->dna.givenbadgetoiby) { dixi('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. - case _vm->_gyro->pdogfood: + case Gyro::pdogfood: if (_vm->_gyro->dna.wonnim) { // We've won the game. dixi('q', 6); // "I'm Not Playing!" return; // Zap back. } else _vm->_gyro->dna.asked_dogfood_about_nim = true; break; - case _vm->_gyro->payles: + case Gyro::payles: if (!_vm->_gyro->dna.ayles_is_awake) { dixi('q', 43); // He's fast asleep! return; @@ -224,11 +224,11 @@ void Visa::talkto(byte whom) { } break; - case _vm->_gyro->pjacques: { + case Gyro::pjacques: { dixi('q', 43); return; } - case _vm->_gyro->pgeida: + case Gyro::pgeida: if (_vm->_gyro->dna.geida_given_potion) _vm->_gyro->dna.geida_follows = true; else { @@ -236,7 +236,7 @@ void Visa::talkto(byte whom) { return; } break; - case _vm->_gyro->pspurge: + case Gyro::pspurge: if (!_vm->_gyro->dna.sitting_in_pub) { dixi('q', 71); // Try going over and sitting down. return; From 458dd5d0cc4dfad39cbd1a3ec161cc55991ef10e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 09:45:53 +0200 Subject: [PATCH 0769/1332] AVALANCHE: Fix link error using MSVC9 --- engines/avalanche/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 7f2e40c94580..dbaa5460c6af 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -3,7 +3,7 @@ MODULE := engines/avalanche MODULE_OBJS = \ avalanche.o \ graphics.o \ - parser.o\ + parser.o \ avalot.o \ console.o \ detection.o \ From ccba9863eb3494ad7be532bf4458e752620dca2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 10:02:53 +0200 Subject: [PATCH 0770/1332] AVALANCHE: Silent a warning --- engines/avalanche/avalanche.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2f098990a94c..f34603a0e8d1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -608,11 +608,14 @@ Common::String AvalancheEngine::elmToStr(Elm how) { switch (how) { case kNormal: case kMusical: - return "jsb"; + return Common::String("jsb"); case kRegi: - return "REGI"; + return Common::String("REGI"); case kElmpoyten: - return "ELMPOYTEN"; + return Common::String("ELMPOYTEN"); + // Useless, but silent a warning + default: + return Common::String(""); } } From a8d9978de8440bb402f55cdaf0338b947e346491 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 10:03:47 +0200 Subject: [PATCH 0771/1332] AVALANCHE: Silent a sign mismatch warning, improve loop condition --- engines/avalanche/dropdown2.cpp | 6 +++--- engines/avalanche/dropdown2.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 224fb0128cfa..4ef65046ccac 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -106,7 +106,7 @@ void onemenu::start_afresh() { } void onemenu::opt(Common::String n, char tr, Common::String key, bool val) { - int16 l = (n + key).size() + 3; + uint16 l = (n + key).size() + 3; if (width < l) width = l; @@ -127,9 +127,9 @@ void onemenu::displayopt(byte y, bool highlit) { //bar((flx1 + 1) * 8, 3 + y * 10, (flx2 + 1) * 8, 12 + y * 10); Common::String data = oo[y].title; - while ((data + oo[y].shortcut).size() < width) + while (data.size() + oo[y].shortcut.size() < width) data += ' '; /* Pad oo[y] spaces. */ - data = data + oo[y].shortcut; + data += oo[y].shortcut; if (highlit) _dr->hlchalk(left, 4 + (y + 1) * 10, oo[y].trigger, data, oo[y].valid); diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 73325a30bc91..f0f3917457af 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -72,7 +72,7 @@ class onemenu { public: optiontype oo[12]; byte number; - int16 width, left; + uint16 width, left; bool firstlix; int16 flx1, flx2, fly; byte oldy; /* used by Lightup */ From b38fd85d707ec78f2b3d693bf292669a4b54e749 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 10:09:07 +0200 Subject: [PATCH 0772/1332] AVALANCHE: Do renaming/refactoring in Closing. --- engines/avalanche/acci2.h | 2 ++ engines/avalanche/avalanche.cpp | 1 + engines/avalanche/avalanche.h | 1 + engines/avalanche/avalot.cpp | 2 +- engines/avalanche/closing2.cpp | 34 ++++++++++++++++----------------- engines/avalanche/closing2.h | 33 ++++++++++++++++---------------- 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index d34c3ffa6468..e09c72ec2212 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -33,6 +33,8 @@ #include "common/scummsys.h" #include "common/str.h" + + namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2f098990a94c..e96a2497ada3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -42,6 +42,7 @@ #include "graphics/thumbnail.h" + namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 393bb4d15747..3ef5bcf9355b 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -58,6 +58,7 @@ #include "graphics/cursorman.h" + namespace Common { class RandomSource; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7e0f84ed0fc6..e7a7a49fb11f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -234,7 +234,7 @@ void Avalot::run(Common::String arg) { // close(logfile); warning("STUB: Avalot::run()"); - _vm->_closing->end_of_program(); + _vm->_closing->exitGame(); } } // End of namespace Avalanche diff --git a/engines/avalanche/closing2.cpp b/engines/avalanche/closing2.cpp index 431b1af82e1b..c9bfcd0cd423 100644 --- a/engines/avalanche/closing2.cpp +++ b/engines/avalanche/closing2.cpp @@ -36,6 +36,8 @@ #include "common/textconsole.h" #include "common/random.h" + + namespace Avalanche { Closing::Closing(AvalancheEngine *vm) { @@ -43,23 +45,19 @@ Closing::Closing(AvalancheEngine *vm) { warning("STUB: Closing::Closing()"); } -void Closing::get_screen(byte which) { - warning("STUB: Closing::get_screen()"); -} - -void Closing::show_screen() { - warning("STUB: Closing::show_screen()"); +void Closing::getScreen(ScreenType which) { + warning("STUB: Closing::getScreen()"); } -void Closing::quit_with(byte which, byte errorlev) { - warning("STUB: Closing::quit_with()"); +void Closing::showScreen() { + warning("STUB: Closing::showScreen()"); } -void Closing::put_in(Common::String x, uint16 where) { - warning("STUB: Closing::put_in()"); +void Closing::putIn(Common::String str, uint16 where) { + warning("STUB: Closing::putIn()"); } -void Closing::end_of_program() { +void Closing::exitGame() { const Common::String nouns[12] = { "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" @@ -72,17 +70,17 @@ void Closing::end_of_program() { Common::String result; - //nosound; - warning("STUB: Closing::end_of_program()"); + //nosound(); + warning("STUB: Closing::exitGame()"); - get_screen(scr_nagscreen); + getScreen(kScreenNagScreen); result = nouns[_vm->_rnd->getRandomNumber(12)] + " will " + verbs[_vm->_rnd->getRandomNumber(12)] + " you"; - put_in(result, 1628); - show_screen(); /* No halt- it's already set up. */ + putIn(result, 1628); + showScreen(); // No halt- it's already set up. } -void Closing::bug_handler() { - warning("STUB: Closing::bug_handler()"); +void Closing::handleBug() { + warning("STUB: Closing::handleBug()"); } } // End of namespace Avalanche. diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index ed73f9f32190..14cf54bbf382 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -33,38 +33,37 @@ #include "common/scummsys.h" #include "common/str.h" + + namespace Avalanche { class AvalancheEngine; class Closing { public: - static const int16 scr_bugalert = 1; - static const int16 scr_ramcram = 2; - static const int16 scr_nagscreen = 3; - static const int16 scr_twocopies = 5; - Closing(AvalancheEngine *vm); - void quit_with(byte which, byte errorlev); - - void end_of_program(); + void exitGame(); private: - AvalancheEngine *_vm; + enum ScreenType { + kScreenBugAlert = 1, + kScreenRamCram = 2, + kScreenNagScreen = 3, + kScreenTwoCopies = 5, + }; - typedef Common::String scrtype; + AvalancheEngine *_vm; - scrtype q /*absolute $B8FA:0*/; /* Nobody's using the graphics memory now. */ - //file f; - void *exitsave; + Common::String q; //absolute $B8FA:0* ; Nobody's using the graphics memory now. + Common::File f; - void get_screen(byte which); + void getScreen(ScreenType which); - void show_screen(); + void showScreen(); - void put_in(Common::String x, uint16 where); + void putIn(Common::String str, uint16 where); - void bug_handler(); + void handleBug(); }; } // End of namespace Avalanche. From 666d3eecfcbb038d6b1b33f231c3a03bcbd726b4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 10:14:12 +0200 Subject: [PATCH 0773/1332] AVALANCHE: Replace some British terms by American ones --- engines/avalanche/celer2.cpp | 6 +++--- engines/avalanche/dropdown2.cpp | 2 +- engines/avalanche/dropdown2.h | 2 +- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/graphics.h | 2 +- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/lucerna2.h | 2 +- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/trip6.cpp | 2 +- engines/avalanche/trip6.h | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index ababd4a86db6..2d16dc6de95a 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -289,9 +289,9 @@ void Celer::loadBackgroundSprites(byte number) { sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); bool natural = f.readByte(); - bool memorise = f.readByte(); + bool memorize = f.readByte(); - if (memorise) { + if (memorize) { _sprites[i]._x = sprite._x; _sprites[i]._xl = sprite._xl; _sprites[i]._y = sprite._y; @@ -349,7 +349,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { sprite._xl = f.readSint16LE(); sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); - f.skip(2); // For the now not existing natural and memorise data members of the SpriteType (called chunkblocktype in the original). + f.skip(2); // For the now not existing natural and memorize data members of the SpriteType (called chunkblocktype in the original). sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 4ef65046ccac..064af299dc46 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ - /* DROPDOWN A customised version of Oopmenu (qv). */ + /* DROPDOWN A customized version of Oopmenu (qv). */ #include "avalanche/avalanche.h" diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index f0f3917457af..7b8f9723305a 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* DROPDOWN A customised version of Oopmenu (qv). */ +/* DROPDOWN A customized version of Oopmenu (qv). */ #ifndef DROPDOWN2_H #define DROPDOWN2_H diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b6dbe16c612d..eaf547c018ee 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -77,7 +77,7 @@ Graphics::~Graphics() { } -void Graphics::flesh_colours() +void Graphics::flesh_colors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ca287721560e..7f27186bac09 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -84,7 +84,7 @@ class Graphics { ~Graphics(); - void flesh_colours(); + void flesh_colors(); byte *getPixel(int16 x, int16 y); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 2b4c5fe363b2..8b278f05fcf1 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -219,7 +219,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ CursorMan.showMouse(false); - _vm->_graphics->flesh_colours(); + _vm->_graphics->flesh_colors(); xx = _vm->_gyro->strf(n); Common::String filename; diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 8c497212b445..db9e43191f30 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -102,7 +102,7 @@ class Lucerna { uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees. - void flesh_colours(); + void flesh_colors(); void sprite_run(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 300d275346c0..6c1ef73d939f 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -736,7 +736,7 @@ void Scrolls::calldrivers() { _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position. _vm->_gyro->talkf = _vm->_gyro->quasipeds[param - 10].fgc; - _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colours. + _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colors. } else { _vm->_lucerna->errorled(); // Not valid. natural(); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index dc45c6c2d7c2..7e444dc1ee5f 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -447,7 +447,7 @@ triptype *triptype::done() { getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ + numleft = 0; /* initialize array pointer */ return this; } diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index cc13c9bf7597..f91e72c2f330 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -44,7 +44,7 @@ struct adxtype { /* Second revision of ADX type */ Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. byte num; /* number of pictures */ byte seq; /* how many in one stride */ - byte fgc, bgc; /* foreground & background bubble colours */ + byte fgc, bgc; /* foreground & background bubble colors */ byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; From 543c4f59daabaf13a52f451d245adb44f391971c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 10:43:51 +0200 Subject: [PATCH 0774/1332] AVALANCHE: Remove logger --- engines/avalanche/acci2.cpp | 1 - engines/avalanche/avalanche.cpp | 2 - engines/avalanche/avalanche.h | 2 - engines/avalanche/avalot.cpp | 1 - engines/avalanche/gyro2.h | 2 +- engines/avalanche/logger2.cpp | 289 -------------------------------- engines/avalanche/logger2.h | 92 ---------- engines/avalanche/lucerna2.cpp | 4 - engines/avalanche/module.mk | 1 - engines/avalanche/parser.cpp | 2 - engines/avalanche/scrolls2.cpp | 16 -- 11 files changed, 1 insertion(+), 411 deletions(-) delete mode 100644 engines/avalanche/logger2.cpp delete mode 100644 engines/avalanche/logger2.h diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 72653b276d44..2d532bb5703d 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1603,7 +1603,6 @@ void Acci::doThat() { _vm->_gyro->dna.playednim++; // You won - strange! - _vm->_logger->log_aside("You won."); _vm->_visa->dixi('Q', 7); // You won! Give us a lute! _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; _vm->_lucerna->objectlist(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 68272c8c8839..3d8ba61a38d5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -66,7 +66,6 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; delete _enhanced; - delete _logger; delete _pingo; delete _scrolls; delete _visa; @@ -88,7 +87,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); _enhanced = new Enhanced(this); - _logger = new Logger(this); _pingo = new Pingo(this); _scrolls = new Scrolls(this); _visa = new Visa(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 3ef5bcf9355b..63f654f55091 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -36,7 +36,6 @@ #include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/enhanced2.h" -#include "avalanche/logger2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" @@ -77,7 +76,6 @@ class AvalancheEngine : public Engine { Avalot *_avalot; Gyro *_gyro; Enhanced *_enhanced; - Logger *_logger; Pingo *_pingo; Scrolls *_scrolls; Visa *_visa; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e7a7a49fb11f..c791a77ed661 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -38,7 +38,6 @@ #include "avalanche/scrolls2.h" #include "avalanche/dropdown2.h" #include "avalanche/pingo2.h" -#include "avalanche/logger2.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/enid2.h" diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 967034a7ed24..3caa946eb24f 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -559,7 +559,7 @@ class Gyro { Common::String roomname; /* Name of this room */ //text logfile; // http://wiki.freepascal.org/Text - bool logging, log_epson; + bool log_epson; bool cl_override; diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp deleted file mode 100644 index 24c6d55fe931..000000000000 --- a/engines/avalanche/logger2.cpp +++ /dev/null @@ -1,289 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LOGGER Handles the logging. */ - -#include "avalanche/avalanche.h" - -#include "avalanche/logger2.h" -#include "avalanche/gyro2.h" -#include "avalanche/trip6.h" - -#include "common/textconsole.h" - -namespace Avalanche { -const char Logger::divide[] = "--- oOo ---"; - -/* Epson codes: - - startwith=''; - endwith=''; - double_width = #14; { shift out (SO) } - double_off = #20; { device control 4 (DC4) } - italic = #27+'4'; { switches italics on... } - italic_off = #27+'5'; { and off. } - emph_on = #27+#69; - emph_off = #27+#70; - divide_indent = 15; - -*/ - -/* L'jet codes: */ - -// Not sure if these will be needed at all... - -const Common::String startwith = Common::String(33) + 50 + "10J" + 130; -const Common::String endwith = Common::String(33) + 105; -const Common::String italic = Common::String(33) + 50 + 163 + 61 + 123; /* switches italics on... */ -const Common::String italic_off = Common::String(33) + 50 + 163 + 60 + 123; /* and off. */ -const Common::String emph_on = Common::String(33) + 50 + 163 + 63 + 102; -const Common::String emph_off = Common::String(33) + 50 + 163 + 60 + 102; - -const Common::String double_width = emph_on; /* There IS no double-width. */ -const Common::String double_off = emph_off; /* So we'll have to use bold. */ - - - -const Common::String Logger::quote = ""; -const Common::String Logger::unquote = ""; -const Common::String Logger::copyright = "(c)"; -const int16 Logger::divide_indent = 30; - - - -Logger::Logger(AvalancheEngine *vm) { - _vm = vm; -} - -void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ - byte fv; - - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); fv++) - output << logfile << ' ';*/ -} - -void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ - - warning("STUB: Logger::log_setup()"); - - /* assign(logfile, name); - rewrite(logfile); - output << logfile << startwith; - log_epson = printing; - logging = true; - - if (!printing) { - quote = '"'; - unquote = '"'; - copyright = "(c)"; - }*/ -} - -void Logger::log_divider() { /* Prints the divider sign. */ - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_divider()"); - - /* - if (_vm->_gyro->log_epson) { - output << logfile << Common::String(' ') + double_width; - for (fv = 1; fv <= divide_indent; fv++) - output << logfile << ' '; - output << logfile << Common::String(' ') + double_off; - } else { - for (fv = 1; fv <= 36; fv++) - output << logfile << ' '; - } - output << logfile << divide << NL; - */ -} - -void Logger::log_command(Common::String x) { /* Prints a command */ - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_command()"); - - /*if (_vm->_gyro->log_epson) - output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; - else - output << logfile << Common::String("> ") + x << NL;*/ -} - -void Logger::log_addstuff(Common::String x) { - if (!_vm->_gyro->logging) - return; - - scroll_line += x; -} - -void Logger::log_scrollchar(Common::String x) { /* print one character */ - Common::String z; - if (!_vm->_gyro->logging) - return; - - switch (x[0]) { - case '\'': - z = quote; - break; /* Open quotes: "66" */ - case '\"': - z = unquote; - break; /* Close quotes: "99" */ - case 239: - z = copyright; - break; /* Copyright sign. */ - default: - z = x; - } - log_addstuff(z); - scroll_line_length += z.size(); -} - -void Logger::log_italic() { - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_italic()"); - - /*if (_vm->_gyro->log_epson) - log_addstuff(italic); - else - log_addstuff("*");*/ -} - -void Logger::log_roman() { - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_roman()"); - - /* if (_vm->_gyro->log_epson) - log_addstuff(italic_off); - else - log_addstuff("*");*/ -} - -void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (!_vm->_gyro->logging) - return; - - if (_vm->_gyro->log_epson) - log_addstuff(italic_off); -} - -void Logger::log_scrollline() { /* Set up a line for the scroll driver */ - scroll_line_length = 0; - scroll_line = ""; -} - -void Logger::log_scrollendline(bool centred) { - byte x, fv; - if (!_vm->_gyro->logging) - return; - x = 17; - if (centred) - x += (50 - scroll_line_length) / 2; - - warning("STUB: Logger::log_scrollendline()"); - - /*for (fv = 1; fv <= x; fv++) - output << logfile << ' '; - output << logfile << scroll_line << NL;*/ -} - -void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_bubbleline()"); - - /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv++) - output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; - } else { - for (fv = 1; fv <= 17; fv++) - output << logfile << ' '; - output << logfile << x << NL; - }*/ -} - -void Logger::log_newline() { - warning("STUB: Logger::log_newline()"); - - //if (_vm->_gyro->logging) - // output << logfile << NL; -} - -void Logger::log_newroom(Common::String where) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_newroom()"); - - /*for (fv = 1; fv <= 20; fv++) - output << logfile << ' '; - if (_vm->_gyro->log_epson) - output << logfile << emph_on; - output << logfile << Common::String('(') + where + ')'; - if (_vm->_gyro->log_epson) - output << logfile << emph_off; - output << logfile << NL;*/ -} - -void Logger::log_aside(Common::String what) { -/* This writes "asides" to the printer. For example, moves in Nim. */ - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_aside()"); - - //output << logfile << " (" << italic << what << italic_off << ')' << NL; - /* "What" is what to write. */ -} - -void Logger::log_score(uint16 credit, uint16 now) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_score()"); - - /*for (fv = 1; fv <= 50; fv++) - output << logfile << ' '; - output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h deleted file mode 100644 index 95e5ea849dd6..000000000000 --- a/engines/avalanche/logger2.h +++ /dev/null @@ -1,92 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LOGGER Handles the logging. */ - -#ifndef LOGGER2_H -#define LOGGER2_H - -#include "common/scummsys.h" -#include "common/str.h" - -namespace Avalanche { -class AvalancheEngine; - -class Logger { -public: - Logger(AvalancheEngine *vm); - - void log_setup(Common::String name, bool printing); - - void log_divider(); /* Prints the divider sign. */ - - void log_command(Common::String x); /* Prints a command */ - - void log_scrollchar(Common::String x); /* print one character */ - - void log_italic(); - - void log_roman(); - - void log_epsonroman(); - - void log_scrollline(); /* Set up a line for the scroll driver */ - - void log_scrollendline(bool centred); - - void log_bubbleline(byte linenum, byte whom, Common::String x); - - void log_newline(); - - void log_newroom(Common::String where); - - void log_aside(Common::String what); - - void log_score(uint16 credit, uint16 now); - -private: - AvalancheEngine *_vm; - - static const char divide[]; - - static const Common::String quote; - static const Common::String unquote; - static const Common::String copyright; - static const int16 divide_indent; - - Common::String scroll_line; - byte scroll_line_length; - - void centre(byte size, byte x); - - void log_addstuff(Common::String x); - -}; - -} // End of namespace Avalanche - -#endif // LOGGER2_H diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 8b278f05fcf1..f407c5cb5f44 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -#include "avalanche/logger2.h" #include "avalanche/enhanced2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" @@ -266,8 +265,6 @@ void Lucerna::load(byte n) { /* Load2, actually */ bit = *_vm->_graphics->getPixel(0,0); - _vm->_logger->log_newroom(_vm->_gyro->roomname); - CursorMan.showMouse(true); } @@ -942,7 +939,6 @@ void Lucerna::points(byte num) { /* Add on no. of points */ } warning("STUB: Lucerna::points()"); - _vm->_logger->log_score(num, _vm->_gyro->dna.score); showscore(); } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index dbaa5460c6af..96980252805a 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -9,7 +9,6 @@ MODULE_OBJS = \ detection.o \ gyro2.o \ enhanced2.o \ - logger2.o \ pingo2.o \ scrolls2.o \ visa2.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 2457354e170c..8bd6d52248c3 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -80,8 +80,6 @@ void Parser::handleReturn() { if (_vm->_dropdown->ddm_o.menunow) _vm->_parser->tryDropdown(); else { - _vm->_logger->log_command(_inputText); - if (!_inputText.empty()) { _inputTextBackup = _inputText; _vm->_acci->parse(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 6c1ef73d939f..523c37bd8d9c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -31,7 +31,6 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" -#include "avalanche/logger2.h" #include "avalanche/enhanced2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" @@ -105,8 +104,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit fontType itw; byte lz = z.size(); - _vm->_logger->log_scrollline(); - bool offset = x % 8 == 4; x = x / 8; y++; @@ -115,12 +112,10 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit switch (z[xx]) { case kControlRoman: { cfont = roman; - _vm->_logger->log_roman(); } break; case kControlItalic: { cfont = italic; - _vm->_logger->log_italic(); } break; default: { @@ -131,8 +126,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit i++; Common::String chr(z[xx]); _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black); - - _vm->_logger->log_scrollchar(Common::String(z[xx])); } } } @@ -269,7 +262,6 @@ void Scrolls::music_scroll() { void Scrolls::resetscrolldriver() { /* phew */ _vm->_gyro->scrollbells = 0; cfont = roman; - _vm->_logger->log_epsonroman(); use_icon = 0; _vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */ } @@ -353,7 +345,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t //setvisualpage(cp); //setactivepage(1 - cp); _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ - _vm->_logger->log_epsonroman(); /* Scrolls always START with Roman. */ lx = 0; ly = (_vm->_gyro->scrolln) * 6; @@ -459,7 +450,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t else say(mx + icon_indent, my, _vm->_gyro->scroll[b]); - _vm->_logger->log_scrollendline(centre); my += 12; } @@ -474,7 +464,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t undodgem(); _vm->_gyro->dropsok = true; - _vm->_logger->log_divider(); //setvisualpage(cp); //mousepage(cp); CursorMan.showMouse(false); @@ -562,11 +551,6 @@ void Scrolls::bubble(func2 gotoit) { _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); } - for (fv = 0; fv < _vm->_gyro->scrolln; fv++) /* These should be separate loops. */ - _vm->_logger->log_bubbleline(fv, param, _vm->_gyro->scroll[fv]); - - _vm->_logger->log_divider(); - //setvisualpage(1 - cp); dingdongbell(); _vm->_gyro->oncandopageswap = false; From d418b2c50c47cb363035885b2b28fcb372c94253 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 11:18:09 +0200 Subject: [PATCH 0775/1332] AVALANCHE: Fix MSVC warnings in lucerna2 --- engines/avalanche/lucerna2.cpp | 61 +++++++++------------------------- 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f407c5cb5f44..1406c444d3c9 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -81,20 +81,19 @@ void Lucerna::callverb(byte n) { void Lucerna::draw_also_lines() { byte ff; - byte squeaky_code; - CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (ff = 0; ff < _vm->_gyro->lineNum; ff++) + for (ff = 0; ff < _vm->_gyro->lineNum; ff++) { // We had to check if the lines are within the borders of the screen. if ((_vm->_gyro->lines[ff].x1 >= 0) && (_vm->_gyro->lines[ff].x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y1 >= 0) && (_vm->_gyro->lines[ff].y1 < _vm->_graphics->kScreenHeight) - && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); - + && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + } + CursorMan.showMouse(true); } @@ -111,13 +110,13 @@ Common::String Lucerna::nextstring() { } void Lucerna::scram1(Common::String &x) { - for (int fz = 0; fz < x.size(); fz ++) + for (uint fz = 0; fz < x.size(); fz++) x.setChar(x[fz] ^ 177, fz); } void Lucerna::unscramble() { for (byte fv = 0; fv < 31; fv ++) - for (byte ff = 0; ff < 2; ff ++) + for (byte ff = 0; ff < 2; ff++) if (_vm->_gyro->also[fv][ff] != 0) scram1(*_vm->_gyro->also[fv][ff]); scram1(_vm->_gyro->listen); @@ -149,7 +148,7 @@ void Lucerna::load_also(Common::String n) { _vm->_gyro->also[fv][ff] = new Common::String; *_vm->_gyro->also[fv][ff] = nextstring(); } - *_vm->_gyro->also[fv][0] = Common::String(157) + *_vm->_gyro->also[fv][0] + 157; + *_vm->_gyro->also[fv][0] = Common::String('\x9D') + *_vm->_gyro->also[fv][0] + Common::String('\x9D'); } memset(_vm->_gyro->lines, 0xFF, sizeof(_vm->_gyro->lines)); @@ -211,8 +210,6 @@ void Lucerna::load_also(Common::String n) { } void Lucerna::load(byte n) { /* Load2, actually */ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ byte bit; Common::String xx; @@ -240,39 +237,22 @@ void Lucerna::load(byte n) { /* Load2, actually */ f.seek(177); - /*for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - move(a0, a1, 12080); - }*/ - - - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->refreshBackground(); f.close(); - - load_also(xx); - _vm->_celer->loadBackgroundSprites(n); - bit = *_vm->_graphics->getPixel(0,0); - CursorMan.showMouse(true); } void Lucerna::zoomout(int16 x, int16 y) { - int16 x1, y1, x2, y2; - byte fv; +// int16 x1, y1, x2, y2; +// byte fv; warning("STUB: Lucerna::zoomout()"); } @@ -558,7 +538,6 @@ void Lucerna::enterroom(byte x, byte ped) { //setactivepage(1 - cp); { - dnatype &with = _vm->_gyro->dna; if ((_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) && (_vm->_gyro->dna.winestate != 3)) { _vm->_visa->dixi('q', 9); /* Don't want to waste the wine! */ _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; @@ -986,9 +965,6 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { } void Lucerna::inkey() { - char r; - - if (_vm->_gyro->demo) return; /* Demo handles this itself. */ @@ -1298,25 +1274,20 @@ void Lucerna::clock_lucerna() { void Lucerna::delavvy() { - byte page_; - CursorMan.showMouse(false); - triptype &with = _vm->_trip->tr[0]; - /*for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_);*/ +// triptype &with = _vm->_trip->tr[0]; +// for (byte page_ = 0; page_ <= 1; page_ ++) +// mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); CursorMan.showMouse(true); } void Lucerna::gameover() { - byte fv; - int16 sx, sy; - _vm->_gyro->dna.user_moves_avvy = false; - sx = _vm->_trip->tr[0].x; - sy = _vm->_trip->tr[0].y; + int16 sx = _vm->_trip->tr[0].x; + int16 sy = _vm->_trip->tr[0].y; _vm->_trip->tr[0].done(); _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls @@ -1373,8 +1344,6 @@ void Lucerna::sprite_run() { sprites are still. It performs two fast cycles, only using a few of the links usually used, and without any extra animation. This should make the sprites the same on both pages. */ - byte fv; - _vm->_gyro->doing_sprite_run = true; _vm->_trip->get_back_loretta(); From cd808484aff158ccc8ec78a3898c4d5aff2d8e03 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 11:43:02 +0200 Subject: [PATCH 0776/1332] AVALANCHE: Fix some more MSVC warnings --- engines/avalanche/enid2.cpp | 4 ++-- engines/avalanche/pingo2.cpp | 5 ++--- engines/avalanche/scrolls2.cpp | 29 +++++++++++++---------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 9841fa02e7ad..1e7c816947a6 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -263,8 +263,8 @@ void Enid::from_sundry(sundry sund) { } void Enid::restore_dna() { - uint16 here, fv; - sundry sund; +// uint16 here, fv; +// sundry sund; warning("STUB: Enid::restore_dna()"); } diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 4f3d17192bf0..096a8be08445 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -109,8 +109,6 @@ void Pingo::zonk() { void Pingo::winning_pic() { Common::File f; - char r; - _vm->_lucerna->dusk(); if (!f.open("finale.avd")) { @@ -137,7 +135,8 @@ void Pingo::winning_pic() { /*do { _vm->_gyro->check(); } while (!(keypressed() || (mrelease > 0))); - while (keypressed()) r = readkey(); + while (keypressed()) + char r = readkey(); major_redraw();*/ warning("STUB: Pingo::winning_pic()"); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 523c37bd8d9c..fe345d8575ef 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -55,8 +55,6 @@ void Scrolls::init() { } void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - if (_vm->_gyro->ledstatus == x) return; /* Already like that! */ @@ -136,8 +134,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit void Scrolls::normscroll() { Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; Common::String e = "(c) 1994"; - char r; - bool oktoexit; state(3); _vm->_gyro->seescroll = true; @@ -165,6 +161,8 @@ void Scrolls::normscroll() { +// char r; +// bool oktoexit; // do { // do { // _vm->_gyro->check(); /* was "checkclick;" */ @@ -308,8 +306,6 @@ void Scrolls::geticon(int16 x, int16 y, byte which) { void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File f; - byte bit; - int16 fv; uint16 st; st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); @@ -321,14 +317,15 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { return; } - /*for (fv = 1; fv <= yl; fv ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (fv * 80)], xl); - } + /*byte bit; + for (uint16 fv = 1; fv <= yl; fv ++) + for (bit = 0; bit <= 3; bit ++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * st + (fv * 80)], xl); + } bit = getpixel(0, 0);*/ warning("STUB: Scrolls::block_drop()"); @@ -484,7 +481,7 @@ void Scrolls::bubble(func2 gotoit) { int16 xl, yl, my, xw, yw; byte fv; Common::Point p[3]; - byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ +// byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ int16 xc; /* x correction */ /*setvisualpage(cp); @@ -638,7 +635,7 @@ void Scrolls::calldrivers() { char nnn; bool mouthnext; bool call_spriterun; // Only call sprite_run the FIRST time. - bool was_virtual; // Was the mouse cursor virtual on entry to this proc? +// bool was_virtual; // Was the mouse cursor virtual on entry to this proc? //nosound(); From c3ce7d48401705b51fb4cbcd790020392da11cd9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:02:01 +0200 Subject: [PATCH 0777/1332] AVALANCHE: Fix MSVC warnings in trip6 --- engines/avalanche/trip6.cpp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 7e444dc1ee5f..20c22e40e068 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -53,8 +53,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { _tr = tr; const int32 idshould = -1317732048; - int16 gd, gm; - byte fv/*,nds*/; + byte fv; int32 id; Common::File inf; @@ -418,22 +417,17 @@ void triptype::load_data_from_mem(uint16 &where) { } triptype *triptype::done() { - int16 gd, gm; Common::String xx; - byte fv/*,nds*/; - byte aa, bb; - int32 id; - uint16 soa; /* nds:=num div seq;*/ totalnum--; _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) _info.xw++; - for (aa = 0; aa < /*nds*seq*/ a.num; aa++) { + for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) { totalnum--; - delete _info.mani[totalnum]; - delete _info.sil[totalnum]; + delete[] _info.mani[totalnum]; + delete[] _info.sil[totalnum]; } quick = false; @@ -441,11 +435,6 @@ triptype *triptype::done() { return this; } - - - - - getsettype *getsettype::init() { numleft = 0; /* initialize array pointer */ return this; @@ -528,6 +517,8 @@ byte Trip::geida_ped(byte which) { return 9; case 4: return 10; + default: + return 0; } } @@ -538,7 +529,7 @@ void Trip::catamove(byte ped) { int32 here; uint16 xy_uint16; - byte fv, ff; + byte fv; /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the catacombs has a different number for it. */ @@ -1145,7 +1136,6 @@ bool Trip::overlaps_with_mouse() { } void Trip::getback() { - byte fv; bool endangered; @@ -1213,8 +1203,6 @@ void Trip::face_avvy(byte tripnum) { } void Trip::arrow_procs(byte tripnum) { - byte fv; - if (tr[tripnum].homing) { /* Arrow is still in flight. */ /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. @@ -1232,7 +1220,7 @@ void Trip::arrow_procs(byte tripnum) { /* tr[1].done; { Deallocate normal pic of Avvy. } off; - for fv:=0 to 1 do + for byte fv:=0 to 1 do begin cp:=1-cp; getback; @@ -1267,11 +1255,8 @@ begin end;*/ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ - byte fv; - int16 tox, toy; - - tox = tr[0].x + 17; - toy = tr[0].y - 1; + int16 tox = tr[0].x + 17; + int16 toy = tr[0].y - 1; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = left; @@ -1471,7 +1456,7 @@ void Trip::getsetclear() { } void Trip::hide_in_the_cupboard() { - const char nowt = 250; /* As in Acci. */ + const char nowt = '\xFA'; /* As in Acci. */ if (_vm->_gyro->dna.avvys_in_the_cupboard) { if (_vm->_gyro->dna.wearing == nowt) From fce3fe83819f05cc2a0598c367124ea8c0ea2dac Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:32:10 +0200 Subject: [PATCH 0778/1332] AVALANCHE: Fix MSVC warnings in acci2 --- engines/avalanche/acci2.cpp | 43 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2d532bb5703d..454291033944 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -288,11 +288,10 @@ void Acci::number(Common::String &codes) { } void Acci::cheatParse(Common::String codes) { - uint16 num; - int16 e; - - char cmd; - int16 se, sx, sy; +// uint16 num; +// int16 e; +// char cmd; +// int16 se, sx, sy; warning("STUB: Acci::cheatParse()"); } @@ -522,39 +521,39 @@ void Acci::parse() { inputText.deleteChar(0); } - if (_vm->_parser->pos(Common::String(254), _thats) > -1) - _unknown = _realWords[_vm->_parser->pos(Common::String(254), _thats)]; + if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) + _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; else if (!_unknown.empty()) _unknown.clear(); // Replace words' codes that mean the same. - replace(Common::String(255), 0); /* zap noise words */ - replace(Common::String(13) + 226, 1); // "look at" = "examine" - replace(Common::String(13) + 228, 1); // "look in" = "examine" - replace(Common::String(4) + 230, 17); // "get up" = "stand" - replace(Common::String(4) + 231, 17); // "get down" = "stand"... well, why not? - replace(Common::String(18) + 228, 2); // "go in" = "open [door]" - replace(Common::String(28) + 229, 253); // "P' off" is a swear word - replace(Common::String(4) + 6, 6); // "Take inventory" (remember Colossal Adventure?) - replace(Common::String(40) + 232, 21); // "put on" = "don" - replace(Common::String(4) + 229, 20); // "take off" = "doff" + replace(Common::String('\xFF'), 0); /* zap noise words */ + replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" + replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine" + replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" + replace(Common::String('\x4') + '\xE7', 17); // "get down" = "stand"... well, why not? + replace(Common::String('\x12') + '\xE4', 2); // "go in" = "open [door]" + replace(Common::String('\x1C') + '\xE5', 253); // "P' off" is a swear word + replace(Common::String('\x4') + '\x6' , 6); // "Take inventory" (remember Colossal Adventure?) + replace(Common::String('\x28') + '\xE8', 21); // "put on" = "don" + replace(Common::String('\x4') + '\xE5', 20); // "take off" = "doff" // Words that could mean more than one _person if (_vm->_gyro->dna.room == r__nottspub) - replace(Common::String(204), 164); // Barman = Port + replace(Common::String('\xCC'), 164); // Barman = Port else - replace(Common::String(204), 154); // Barman = Malagauche + replace(Common::String('\xCC'), 154); // Barman = Malagauche switch (_vm->_gyro->dna.room) { case r__aylesoffice: - replace(Common::String(203), 163); // Monk = Ayles + replace(Common::String('\xCB'), 163); // Monk = Ayles break; case r__musicroom: - replace(Common::String(203), 166); // Monk = Jacques + replace(Common::String('\xCB'), 166); // Monk = Jacques break; default: - replace(Common::String(203), 162); // Monk = Ibythneth + replace(Common::String('\xCB'), 162); // Monk = Ibythneth } if (doPronouns()) { From 8e148213067a664f384c5eea0082660210ea0d26 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:35:26 +0200 Subject: [PATCH 0779/1332] AVALANCHE: Fix bug in verbOpt() --- engines/avalanche/acci2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 454291033944..a7dd24aa5974 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -2016,7 +2016,7 @@ void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) { switch (verb) { case kVerbCodeExam: answer = "Examine"; - ansKey = 'word'; + ansKey = 'x'; break; // The ubiqutous one. // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. case kVerbCodeDrink: From 8c8990368e84d154888e9754b992ff7a8db6393f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:36:48 +0200 Subject: [PATCH 0780/1332] AVALANCHE: Fix bug in lookAround() --- engines/avalanche/acci2.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index a7dd24aa5974..cd244e6d95d1 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -865,34 +865,34 @@ void Acci::lookAround() { switch (_vm->_gyro->dna.room) { case r__spludwicks: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('pos', 23); + _vm->_visa->dixi('q', 23); else peopleInRoom(); break; case r__robins: if (_vm->_gyro->dna.tied_up) - _vm->_visa->dixi('pos', 38); + _vm->_visa->dixi('q', 38); if (_vm->_gyro->dna.mushroom_growing) - _vm->_visa->dixi('pos', 55); + _vm->_visa->dixi('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->dna.taken_pen) - _vm->_visa->dixi('pos', 49); + _vm->_visa->dixi('q', 49); break; case r__lustiesroom: if (_vm->_gyro->dna.lustie_is_asleep) - _vm->_visa->dixi('pos', 65); + _vm->_visa->dixi('q', 65); break; case r__catacombs: switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { case 258 : - _vm->_visa->dixi('pos', 80); // Inside art gallery. + _vm->_visa->dixi('q', 80); // Inside art gallery. break; case 514 : - _vm->_visa->dixi('pos', 81); // Outside ditto. + _vm->_visa->dixi('q', 81); // Outside ditto. break; case 260 : - _vm->_visa->dixi('pos', 82); // Outside Geida's room. + _vm->_visa->dixi('q', 82); // Outside Geida's room. break; } break; From 53d9848f6625b390b3898c18cabf610439e2bba6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:38:19 +0200 Subject: [PATCH 0781/1332] AVALANCHE: Fix bug in openDoor() --- engines/avalanche/acci2.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index cd244e6d95d1..d869fe46e389 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -915,7 +915,7 @@ void Acci::openDoor() { break; case r__spludwicks: if (_thing == 61) { - _vm->_visa->dixi('pos', 85); + _vm->_visa->dixi('q', 85); return; } break; @@ -932,7 +932,7 @@ void Acci::openDoor() { switch (_vm->_gyro->portals[fv].op) { case Gyro::exclaim: _vm->_trip->tr[0].bounce(); - _vm->_visa->dixi('word', _vm->_gyro->portals[fv].data); + _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); break; case Gyro::transport: _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); @@ -954,8 +954,7 @@ void Acci::openDoor() { if (_vm->_gyro->dna.room == r__map) _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " - "to anywhere other than Argent, Birmingham, Cardiff, " - "Nottingham and Norwich.")); + "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.")); else _vm->_scrolls->display("Door? What door?"); } From c781727a03c0a7db10cf61944b54066199dbe838 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:42:27 +0200 Subject: [PATCH 0782/1332] AVALANCHE: Fix bug in giveToSpludwick, add doxygen comment --- engines/avalanche/acci2.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d869fe46e389..9da26a80f475 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1052,6 +1052,10 @@ void Acci::goToCauldron() { _vm->_trip->tr[1].walkto(2); } +/** + * Check is it's possible to give something to Spludwick + * @remarks Originally called 'give2spludwick' + */ bool Acci::giveToSpludwick() { if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != _thing) { notInOrder(); @@ -1062,10 +1066,10 @@ bool Acci::giveToSpludwick() { case Gyro::onion: _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; if (_vm->_gyro->dna.rotten_onion) - _vm->_visa->dixi('pos', 22); + _vm->_visa->dixi('q', 22); else { _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('pos', 20); + _vm->_visa->dixi('q', 20); goToCauldron(); _vm->_lucerna->points(3); } @@ -1075,13 +1079,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('pos', 24); + _vm->_visa->dixi('q', 24); goToCauldron(); _vm->_lucerna->points(3); break; case Gyro::mushroom: _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; - _vm->_visa->dixi('pos', 25); + _vm->_visa->dixi('q', 25); _vm->_lucerna->points(5); _vm->_gyro->dna.given2spludwick++; goToCauldron(); From caeb46f3ce251e10f16cd86bd3d968e7c6c2a642 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 12:51:29 +0200 Subject: [PATCH 0783/1332] AVALANCHE: Fix bugs in getProc() and giveGeidaTheLute(), add doxygen comment --- engines/avalanche/acci2.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 9da26a80f475..1f7c86adf114 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1190,7 +1190,7 @@ void Acci::getProc(char thing) { } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { @@ -1208,15 +1208,15 @@ void Acci::getProc(char thing) { _vm->_scrolls->display("Taken."); } } else if (_vm->_gyro->dna.standing_on_dais) - _vm->_visa->dixi('pos', 53); + _vm->_visa->dixi('q', 53); else - _vm->_visa->dixi('pos', 51); + _vm->_visa->dixi('q', 51); break; case Gyro::bolt: - _vm->_visa->dixi('pos', 52); + _vm->_visa->dixi('q', 52); break; default: - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); } break; case r__robins: @@ -1229,13 +1229,17 @@ void Acci::getProc(char thing) { _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); } else - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); break; default: - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); } } +/** + * Give the lute to Geida + * @remarks Originally called 'give_Geida_the_lute' + */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->dna.room != r__lustiesroom) { _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); @@ -1243,7 +1247,7 @@ void Acci::giveGeidaTheLute() { } _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; _vm->_lucerna->objectlist(); - _vm->_visa->dixi('pos', 64); // She plays it. + _vm->_visa->dixi('q', 64); // She plays it. _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_enid->back_to_bootstrap(4); From 382046244868c6d08f556ad0ef714b956c9d0389 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:06:12 +0200 Subject: [PATCH 0784/1332] AVALANCHE: Fix bugs in winSequence() and doThat() --- engines/avalanche/acci2.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1f7c86adf114..0a1a0476792d 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1261,7 +1261,7 @@ void Acci::playHarp() { } void Acci::winSequence() { - _vm->_visa->dixi('pos', 78); + _vm->_visa->dixi('q', 78); _vm->_sequence->first_show(7); _vm->_sequence->then_show(8); _vm->_sequence->then_show(9); @@ -1302,6 +1302,9 @@ void Acci::heyThanks() { _vm->_gyro->dna.obj[_thing - 1] = false; } +/** + * @remarks Originally called 'do_that' + */ void Acci::doThat() { const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; @@ -1424,7 +1427,7 @@ void Acci::doThat() { break; case Gyro::pibythneth: if (_thing == _vm->_gyro->badge) { - _vm->_visa->dixi('pos', 32); // Thanks! Wow! + _vm->_visa->dixi('q', 32); // Thanks! Wow! _vm->_lucerna->points(3); _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; @@ -1438,7 +1441,7 @@ void Acci::doThat() { if (_vm->_gyro->dna.ayles_is_awake) { if (_thing == _vm->_gyro->pen) { _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; - _vm->_visa->dixi('pos', 54); + _vm->_visa->dixi('q', 54); _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = true; _vm->_gyro->dna.given_pen_to_ayles = true; _vm->_lucerna->objectlist(); @@ -1470,7 +1473,7 @@ void Acci::doThat() { if (_vm->_gyro->dna.geida_given_potion) winSequence(); else - _vm->_visa->dixi('pos', 77); // That Geida woman! + _vm->_visa->dixi('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1601,7 +1604,7 @@ void Acci::doThat() { } if (!_vm->_gyro->dna.asked_dogfood_about_nim) { - _vm->_visa->dixi('pos', 84); + _vm->_visa->dixi('q', 84); return; } @@ -1696,12 +1699,12 @@ void Acci::doThat() { break; case kVerbCodeMagic: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('pos', 19); + _vm->_visa->dixi('q', 19); else { if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! - _vm->_visa->dixi('pos', 17); + _vm->_visa->dixi('q', 17); if (_vm->_gyro->whereis[1] == 12) - _vm->_visa->dixi('pos', 18); + _vm->_visa->dixi('q', 18); else { _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius _vm->_trip->apped(2, 4); From 8e7921d19dbc1308505356b7eb45b7d7096257d1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:07:09 +0200 Subject: [PATCH 0785/1332] AVALANCHE: USe the default return value in giveToSpludwick() --- engines/avalanche/acci2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0a1a0476792d..b69e0514c496 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1095,6 +1095,8 @@ bool Acci::giveToSpludwick() { default: return true; } + + return false; } void Acci::drink() { From 9c5cc7bba4661114054f05bbce0250650e1138a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:16:27 +0200 Subject: [PATCH 0786/1332] AVALANCHE: Add a default value to color in state(), remove dead code --- engines/avalanche/scrolls2.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index fe345d8575ef..615bdd5a52f9 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -58,7 +58,7 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ if (_vm->_gyro->ledstatus == x) return; /* Already like that! */ - byte color; + byte color = black; switch (x) { case 0: color = black; @@ -69,21 +69,6 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ color = green; break; /* Hit a key */ } - - //switch (x) { - //case 0: - // setfillstyle(1, black); - // break; /* Off */ - //case 1: - // setfillstyle(9, green); - // break; /* Half-on (menus) */ - //case 2: - // setfillstyle(1, green); - // break; /* On (kbd) */ - //case 3: - // setfillstyle(6, green); - // break; /* Hit a key */ - //} warning("STUB: Scrolls::state()"); CursorMan.showMouse(false); From e4b3fc8064a5fac7655198e3994bac32223d8a30 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:28:15 +0200 Subject: [PATCH 0787/1332] AVALANCHE: Add default value to Direction in updateBackgroundSprites() --- engines/avalanche/celer2.cpp | 94 ++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 2d16dc6de95a..ce7120732b23 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -55,7 +55,9 @@ Celer::~Celer() { } - +/** + * @remarks Originally called 'pics_link' + */ void Celer::updateBackgroundSprites() { if (_vm->_gyro->ddmnow) return; // No animation when the menus are up. @@ -119,8 +121,8 @@ void Celer::updateBackgroundSprites() { break; } - byte direction; if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + byte direction = 0; if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) direction = 3; else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) @@ -155,7 +157,7 @@ void Celer::updateBackgroundSprites() { break; case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { - byte direction; + byte direction = 0; if ((_vm->_gyro->roomtime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. @@ -197,55 +199,55 @@ void Celer::updateBackgroundSprites() { } break; case r__nottspub: { - // Bearing of Avvy from Port. - byte direction; - if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) - direction = 2; // Middle. - else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) - direction = 6; // Left. - else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) - direction = 8; // Right. - - if ((_vm->_gyro->roomtime % 60) > 57) - direction--; // Blinks. - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? - } + // Bearing of Avvy from Port. + byte direction = 0; + if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) + direction = 2; // Middle. + else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 60) > 57) + direction--; // Blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } - switch (_vm->_gyro->roomtime % 50) { - case 45 : - drawBackgroundSprite(-1, -1, 9); // Spurge blinks. - break; - case 49 : - drawBackgroundSprite(-1, -1, 10); - break; - } + switch (_vm->_gyro->roomtime % 50) { + case 45 : + drawBackgroundSprite(-1, -1, 9); // Spurge blinks. + break; + case 49 : + drawBackgroundSprite(-1, -1, 10); + break; } break; + } case r__ducks: { - if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - - // Bearing of Avvy from Duck. - byte direction; - if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - direction = 4; // Middle. - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - direction = 6; // Left. - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - direction = 8; // Right. - - if ((_vm->_gyro->roomtime % 45) > 42) - direction++; // Duck blinks. - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? - } + if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); + + // Bearing of Avvy from Duck. + byte direction = 0; + if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 4; // Middle. + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 45) > 42) + direction++; // Duck blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? } break; + } } if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { From ff31d8e52152c7a988764d361fbcaeda049d2645 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:29:18 +0200 Subject: [PATCH 0788/1332] AVALANCHE: Replace a STUB by a call to updateBackgroundSprites() --- engines/avalanche/celer2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index ce7120732b23..6dece2f4762b 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -261,7 +261,7 @@ void Celer::updateBackgroundSprites() { break; case 2: //nosound(); - warning("STUB: Celer::pics_link()"); + updateBackgroundSprites(); break; } } From fe8e5c7325d3b88ac8bb2dd3db6ee2761e5f9764 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:34:58 +0200 Subject: [PATCH 0789/1332] AVALANCHE: Fix coding style: ++ and -- --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/celer2.cpp | 4 ++-- engines/avalanche/dropdown2.cpp | 2 +- engines/avalanche/graphics.cpp | 4 ++-- engines/avalanche/gyro2.cpp | 6 +++--- engines/avalanche/lucerna2.cpp | 32 ++++++++++++++++++-------------- engines/avalanche/parser.cpp | 2 +- engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 10 +++++----- engines/avalanche/trip6.cpp | 8 ++++---- 10 files changed, 38 insertions(+), 34 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3d8ba61a38d5..a00701456e88 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -278,7 +278,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim); - //for (byte groi = 0; groi < numtr; groi ++) { + //for (byte groi = 0; groi < numtr; groi++) { // if (tr[groi].quick) { // blockwrite(f, groi, 1); // tr[groi].savedata(f); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 6dece2f4762b..a84d15116f02 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -319,7 +319,7 @@ void Celer::loadBackgroundSprites(byte number) { } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _spriteNum; i ++) + for (byte i = 0; i < _spriteNum; i++) if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); } @@ -366,7 +366,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); - for (byte i = 0; i < 2; i ++) + for (byte i = 0; i < 2; i++) _vm->_trip->getset[i].remember(_r); } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 064af299dc46..82a5228ed31e 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -276,7 +276,7 @@ void menuset::extd(char c) { byte fv; fv = 0; while ((fv < howmany) && (ddms[fv].extdparse(c))) - fv ++; + fv++; if (fv == howmany) return; getcertain(fv); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index eaf547c018ee..b4ee2a7a3f51 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -126,9 +126,9 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int32 yRadius = radius * kScreenWidth / (8 * kScreenHeight); // Just don't ask why... if (xRadius == 0) - xRadius ++; + xRadius++; if (yRadius == 0) - yRadius ++; + yRadius++; // Check for an ellipse with negligable x and y radius. if ((xRadius <= 1) && (yRadius <= 1)) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 4166ecfe3222..1653159937ab 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -312,7 +312,7 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { } void Gyro::newgame() { - for (byte gm = 0; gm < numtr; gm ++) { + for (byte gm = 0; gm < numtr; gm++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); } @@ -343,7 +343,7 @@ void Gyro::newgame() { ppos[0][1] = -177; _vm->_trip->tr[0].appear(300,117,right); // Needed to initialize Avalot. - //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; + //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; her = 254; @@ -356,7 +356,7 @@ void Gyro::newgame() { dna.avvy_in_bed = true; enid_filename = ""; - for (byte gd = 0; gd <= 1; gd ++) { + for (byte gd = 0; gd <= 1; gd++) { cp = 1 - cp; _vm->_trip->getback(); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1406c444d3c9..389aa2e23d8b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -115,7 +115,7 @@ void Lucerna::scram1(Common::String &x) { } void Lucerna::unscramble() { - for (byte fv = 0; fv < 31; fv ++) + for (byte fv = 0; fv < 31; fv++) for (byte ff = 0; ff < 2; ff++) if (_vm->_gyro->also[fv][ff] != 0) scram1(*_vm->_gyro->also[fv][ff]); @@ -815,7 +815,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * putimage(x, y, p, 0); setactivepage(1 - cp);*/ - for (byte fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(thinkspace); CursorMan.showMouse(true); @@ -831,14 +831,14 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ return; } - for (byte fv = 0; fv < 10; fv ++) { + for (byte fv = 0; fv < 10; fv++) { f.seek(fv * digitsize); /*_vm->_gyro->digit[fv] = new byte[digitsize]; f.read(_vm->_gyro->digit[fv], digitsize);*/ _vm->_gyro->digit[fv] = _vm->_graphics->loadPictureGraphic(f); } - for (byte ff = 0; ff < 9; ff ++) { + for (byte ff = 0; ff < 9; ff++) { f.seek(10 * digitsize + ff * rwlitesize); /*_vm->_gyro->rwlite[ff] = new byte[rwlitesize]; f.read(_vm->_gyro->rwlite[ff], rwlitesize);*/ @@ -894,11 +894,11 @@ void Lucerna::showscore() { //setactivepage(3); - for (byte fv = 0; fv < 3; fv ++) + for (byte fv = 0; fv < 3; fv++) if (_vm->_gyro->lastscore[fv] != numbers[fv]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); - for (byte fv = 0; fv < 2; fv ++) + for (byte fv = 0; fv < 2; fv++) _vm->_trip->getset[fv].remember(scorespace); //setactivepage(1 - cp); @@ -909,10 +909,10 @@ void Lucerna::showscore() { } void Lucerna::points(byte num) { /* Add on no. of points */ - for (byte q = 1; q <= num; q ++) { + for (byte q = 1; q <= num; q++) { _vm->_gyro->dna.score++; /*if (soundfx) - for (byte fv = 1; fv <= 97; fv ++) + for (byte fv = 1; fv <= 97; fv++) sound(177 + dna.score * 3); nosound;*/ } @@ -1143,9 +1143,13 @@ int8 Lucerna::fades(int8 x) { x = x % 16; byte g = x / 4; byte b = x % 4; - if (r > 0) r --; - if (g > 0) g --; - if (b > 0) b --; + if (r > 0) + r--; + if (g > 0) + g--; + if (b > 0) + b--; + return (16 * r + 4 * g + b); /* fades:=x-1;*/ } @@ -1180,7 +1184,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). _vm->_gyro->oldrw = _vm->_gyro->dna.rw; CursorMan.showMouse(false); - /* for (byte page_ = 0; page_ <= 1; page_ ++) { + /* for (byte page_ = 0; page_ <= 1; page_++) { setactivepage(page_); putimage(0, 161, rwlite[with.rw], 0); }*/ @@ -1277,7 +1281,7 @@ void Lucerna::delavvy() { CursorMan.showMouse(false); // triptype &with = _vm->_trip->tr[0]; -// for (byte page_ = 0; page_ <= 1; page_ ++) +// for (byte page_ = 0; page_ <= 1; page_++) // mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); CursorMan.showMouse(true); @@ -1307,7 +1311,7 @@ void Lucerna::minor_redraw() { enterroom(_vm->_gyro->dna.room, 0); /* Ped unknown or non-existant. */ - for (byte fv = 0; fv <= 1; fv ++) { + for (byte fv = 0; fv <= 1; fv++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; _vm->_trip->getback(); } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 8bd6d52248c3..67b893f32f4f 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -153,7 +153,7 @@ void Parser::drawCursor() { bf.x2 = _inputTextPos + 2; bf.y1 = 168; bf.y2 = 168; - for (byte fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(bf); } diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 096a8be08445..777a1c7cb6b5 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -116,7 +116,7 @@ void Pingo::winning_pic() { return; } - /*for (byte bit = 0; bit <= 3; bit ++) { + /*for (byte bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 615bdd5a52f9..65c4faaae007 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -207,7 +207,7 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv ++) + for (fv = 1; fv <= sizeof(played); fv++) if (played[fv] != _vm->_gyro->tune[fv]) { mistakes += 1; } @@ -303,8 +303,8 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { } /*byte bit; - for (uint16 fv = 1; fv <= yl; fv ++) - for (bit = 0; bit <= 3; bit ++) { + for (uint16 fv = 1; fv <= yl; fv++) + for (bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -560,7 +560,7 @@ bool Scrolls::ask(Common::String question) { void Scrolls::resetscroll() { _vm->_gyro->scrolln = 1; - for (int j = 0; j < 15; j ++) + for (int j = 0; j < 15; j++) if (!_vm->_gyro->scroll[j].empty()) _vm->_gyro->scroll[j].clear(); } @@ -760,7 +760,7 @@ void Scrolls::calldrivers() { nn = 1; for (nnn = 0; nnn < numobjs; nnn++) if (_vm->_gyro->dna.obj[nnn]) { - nn ++; + nn++; display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); } } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 20c22e40e068..417a92056ea6 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -110,7 +110,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { //getmem(sil[totalnum-1], 11 * (a.yl + 1)); _info.mani[totalnum] = new manitype[_info.size - 6]; //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= _info.yl; fv ++) + for (fv = 0; fv <= _info.yl; fv++) inf.read((*_info.sil[totalnum])[fv], _info.xw); //blockread(inf, (*sil[totalnum-1])[fv], xw); inf.read(*_info.mani[totalnum], _info.size - 6); @@ -945,7 +945,7 @@ void Trip::call_special(uint16 which) { } } _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_y --; + _vm->_gyro->dna.cat_y--; catamove(4); if (_vm->_gyro->dna.room != r__catacombs) return; @@ -1079,7 +1079,7 @@ void Trip::newspeed() { //setactivepage(1 - cp); - for (page_ = 0; page_ <= 1; page_ ++) + for (page_ = 0; page_ <= 1; page_++) getset[page_].remember(lightspace); } @@ -1304,7 +1304,7 @@ void Trip::spin(byte whichway, byte &tripnum) { void Trip::geida_procs(byte tripnum) { if (_vm->_gyro->dna.geida_time > 0) { - _vm->_gyro->dna.geida_time --; + _vm->_gyro->dna.geida_time--; if (_vm->_gyro->dna.geida_time == 0) _vm->_gyro->dna.geida_spin = 0; } From d2312e626b9527a7afd2be087e4eb10c78f15351 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:55:31 +0200 Subject: [PATCH 0790/1332] AVALANCHE: Review use of brackets in acci2 --- engines/avalanche/acci2.cpp | 269 ++++++++++++++++++------------------ 1 file changed, 137 insertions(+), 132 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index b69e0514c496..ef6631184c80 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -214,23 +214,26 @@ void Acci::init() { } void Acci::clearWords() { - for (byte i = 0; i < 11; i++) + for (byte i = 0; i < 11; i++) { if (!_realWords[i].empty()) _realWords[i].clear(); + } } byte Acci::wordNum(Common::String word) { if (word.empty()) return 0; - for (int32 i = kParserWordsNum - 1; i >= 0; i--) + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { if (kVocabulary[i]._word == word) return kVocabulary[i]._number; + } // If not found as a whole, we look for it as a substring. - for (int32 i = kParserWordsNum - 1; i >= 0; i--) + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { if (Common::String(kVocabulary[i]._word.c_str(), word.size()) == word) return kVocabulary[i]._number; + } return kPardon; } @@ -301,13 +304,14 @@ void Acci::cheatParse(Common::String codes) { void Acci::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - for (byte i = 0; i < 32; i++) - do { + for (byte i = 0; i < 32; i++) { + for (;;) { int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); if (pos == -1) break; word.deleteChar(pos); - } while (true); + } + } } @@ -363,9 +367,11 @@ void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); // We set every word's first character to uppercase. - for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) + for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { if (_vm->_parser->_inputText[i] == ' ') _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); + } + // And the first character as well. _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); } @@ -390,39 +396,35 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { - case 1: { - _vm->_parser->_inputText.toLowercase(); - sayIt(); - _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 2; - } - break; - case 2: { - properNouns(); - sayIt(); - _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 3; - } - break; - case 3: { - properNouns(); - sayIt(); - _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 4; - } - break; - case 4: { - _vm->_parser->_inputText.toLowercase(); - sayIt(); - if (!_vm->_gyro->dna.spare_evening.empty()) - _vm->_gyro->dna.spare_evening.clear(); - _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; - _vm->_visa->dixi('z', 5); /* His closing statement... */ - _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ - _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ - _vm->_gyro->magics[1].op = _vm->_gyro->nix; - _vm->_gyro->dna.cardiff_things = 5; - } + case 1: + _vm->_parser->_inputText.toLowercase(); + sayIt(); + _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 2; + break; + case 2: + properNouns(); + sayIt(); + _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 3; + break; + case 3: + properNouns(); + sayIt(); + _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 4; + break; + case 4: + _vm->_parser->_inputText.toLowercase(); + sayIt(); + if (!_vm->_gyro->dna.spare_evening.empty()) + _vm->_gyro->dna.spare_evening.clear(); + _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; + _vm->_visa->dixi('z', 5); /* His closing statement... */ + _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ + _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; + _vm->_gyro->dna.cardiff_things = 5; break; case 99: //store_high(_vm->_parser->_inputText); @@ -512,21 +514,24 @@ void Acci::parse() { // Delete words we already processed. int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); - if (spacePos > -1) + if (spacePos > -1) { for (byte i = 0; i <= spacePos; i++) inputTextUpper.deleteChar(0); + } + spacePos = _vm->_parser->pos(Common::String(' '), inputText); - if (spacePos > -1) + if (spacePos > -1) { for (byte i = 0; i <= spacePos; i++) inputText.deleteChar(0); + } } if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; - else + else { if (!_unknown.empty()) _unknown.clear(); - + } // Replace words' codes that mean the same. replace(Common::String('\xFF'), 0); /* zap noise words */ replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" @@ -577,24 +582,28 @@ void Acci::parse() { i++; } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) // Still not found. - for (i = 0; i < _thats.size() - 1; i++) + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // Still not found. + for (i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } + } + } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty())// STILL not found! Must be the word after "say". - for (i = 0; i < _thats.size() - 1; i++) + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + for (i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition _vm->_gyro->subjnumber = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } + } + } - for (int8 i = _thats.size() - 1; i >= 0; i--) // Reverse order, so first will be used. + for (int8 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) _verb = (byte)_thats[i]; else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { @@ -604,12 +613,13 @@ void Acci::parse() { _person = (byte)_thats[i]; else if ((byte)_thats[i] == 251) _polite = true; + } - if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); - _vm->_gyro->weirdword = true; - } else - _vm->_gyro->weirdword = false; + if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); + _vm->_gyro->weirdword = true; + } else + _vm->_gyro->weirdword = false; if (_thats.empty()) _thats = kNothing; @@ -617,11 +627,12 @@ void Acci::parse() { if (_thing != kPardon) _vm->_gyro->it = _thing; - if (_person != kPardon) + if (_person != kPardon) { if (_person < 175) _vm->_gyro->him = _person; else _vm->_gyro->her = _person; + } } void Acci::examineObject() { @@ -709,8 +720,6 @@ bool Acci::holding() { return holdingResult; } - - void Acci::openBox(bool isOpening) { if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); @@ -745,30 +754,29 @@ void Acci::examine() { } } else if (_person != kPardon) exampers(); - else _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. + else + _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. } - - void Acci::inventory() { byte itemNum = 0; _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); - { - for (byte i = 0; i < numobjs; i++) - if (_vm->_gyro->dna.obj[i]) { - itemNum++; - if (itemNum == _vm->_gyro->dna.carrying) - _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); - if ((i + 1) == _vm->_gyro->dna.wearing) - _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); - if (itemNum < _vm->_gyro->dna.carrying) - _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); - } - if (_vm->_gyro->dna.wearing == kNothing) - _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); - else - _vm->_scrolls->display("."); + + for (byte i = 0; i < numobjs; i++) { + if (_vm->_gyro->dna.obj[i]) { + itemNum++; + if (itemNum == _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); + if ((i + 1) == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); + if (itemNum < _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); + } + if (_vm->_gyro->dna.wearing == kNothing) + _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + else + _vm->_scrolls->display("."); } } @@ -776,18 +784,17 @@ void Acci::swallow() { /* Eat something. */ switch (_thing) { case Gyro::wine: switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ - case 1: { - if (_vm->_gyro->dna.teetotal) { - _vm->_visa->dixi('D', 6); - return; - } - _vm->_visa->dixi('U', 1); - _vm->_pingo->wobble(); - _vm->_visa->dixi('U', 2); - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; - _vm->_lucerna->objectlist(); - drink(); + case 1: + if (_vm->_gyro->dna.teetotal) { + _vm->_visa->dixi('D', 6); + return; } + _vm->_visa->dixi('U', 1); + _vm->_pingo->wobble(); + _vm->_visa->dixi('U', 2); + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_lucerna->objectlist(); + drink(); break; case 2: case 3: @@ -795,12 +802,11 @@ void Acci::swallow() { /* Eat something. */ break; /* You can't drink it! */ } break; - case Gyro::potion: { - _vm->_gyro->background(4); - _vm->_visa->dixi('U', 3); - _vm->_lucerna->gameover(); - _vm->_gyro->background(0); - } + case Gyro::potion: + _vm->_gyro->background(4); + _vm->_visa->dixi('U', 3); + _vm->_lucerna->gameover(); + _vm->_gyro->background(0); break; case Gyro::ink: _vm->_visa->dixi('U', 4); @@ -808,10 +814,9 @@ void Acci::swallow() { /* Eat something. */ case Gyro::chastity: _vm->_visa->dixi('U', 5); break; - case Gyro::mushroom: { - _vm->_visa->dixi('U', 6); - _vm->_lucerna->gameover(); - } + case Gyro::mushroom: + _vm->_visa->dixi('U', 6); + _vm->_lucerna->gameover(); break; case Gyro::onion: if (_vm->_gyro->dna.rotten_onion) @@ -833,15 +838,16 @@ void Acci::swallow() { /* Eat something. */ void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - for (byte i = 1; i < 29; i++) // Start at 1 so we don't list Avvy himself! + for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) numPeople++; + } if (numPeople == 0) // If nobody's here, we can cut out straight away. return; byte actPerson = 0; // Actually listed people. - for (byte i = 1; i < 29; i++) + for (byte i = 1; i < 29; i++) { if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) { actPerson++; if (actPerson == 1) // First on the list. @@ -851,6 +857,7 @@ void Acci::peopleInRoom() { else // The end. _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); } + } if (numPeople == 1) _vm->_scrolls->display(Common::String(" is") + _vm->_scrolls->kControlToBuffer); @@ -921,11 +928,10 @@ void Acci::openDoor() { break; } - if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) return; // No doors can open if you can't move Avvy. - for (byte fv = 8; fv < 15; fv++) + for (byte fv = 8; fv < 15; fv++) { if (_vm->_trip->infield(fv + 1)) { fv -= 8; @@ -951,6 +957,7 @@ void Acci::openDoor() { return; } + } if (_vm->_gyro->dna.room == r__map) _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " @@ -1130,8 +1137,6 @@ void Acci::cardiffClimbing() { } } - - void Acci::already() { _vm->_scrolls->display("You're already standing!"); } @@ -1272,11 +1277,12 @@ void Acci::winSequence() { } void Acci::personSpeaks() { - if ((_person == kPardon) || (_person == 0)) + if ((_person == kPardon) || (_person == 0)) { if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) _person = _vm->_gyro->her; else _person = _vm->_gyro->him; + } if (_vm->_gyro->whereis[_person - 150] != _vm->_gyro->dna.room) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! @@ -1292,12 +1298,13 @@ void Acci::personSpeaks() { } } - if (!found) - for (byte i = 0; i < 16; i++) + if (!found) { + for (byte i = 0; i < 16; i++) { if ((_vm->_gyro->quasipeds[i].who == _person) && (_vm->_gyro->quasipeds[i].room == _vm->_gyro->dna.room)) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); + } + } } - void Acci::heyThanks() { personSpeaks(); _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); @@ -1324,16 +1331,16 @@ void Acci::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) - && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) - && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHighscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_gyro->alive) { - _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); - return; - } - if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_scrolls->display("Talking in your sleep? Try waking up!"); - return; - } + && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) + && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHighscores) && (_verb != kVerbCodeSmartAlec)) { + if (!_vm->_gyro->alive) { + _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); + return; + } + if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + _vm->_scrolls->display("Talking in your sleep? Try waking up!"); + return; + } } switch (_verb) { @@ -1527,19 +1534,18 @@ void Acci::doThat() { _vm->_scrolls->display("Just use the arrow keys to walk there."); break; case kVerbCodeInfo: { - _vm->_scrolls->aboutscroll = true; - - Common::String toDisplay; - for (byte i = 0; i < 7; i++) - toDisplay += _vm->_scrolls->kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine - + "The medival descendant of" + _vm->_scrolls->kControlNewLine - + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " - + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; - _vm->_scrolls->display(toDisplay); - - _vm->_scrolls->aboutscroll = false; + _vm->_scrolls->aboutscroll = true; + + Common::String toDisplay; + for (byte i = 0; i < 7; i++) + toDisplay += _vm->_scrolls->kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + + "The medival descendant of" + _vm->_scrolls->kControlNewLine + + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " + + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; + _vm->_scrolls->display(toDisplay); + _vm->_scrolls->aboutscroll = false; } break; case kVerbCodeUndress: @@ -1635,7 +1641,7 @@ void Acci::doThat() { } } else if (holding()) { switch (_thing) { - case Gyro::lute : { + case Gyro::lute : _vm->_visa->dixi('U', 7); if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) @@ -1643,7 +1649,6 @@ void Acci::doThat() { if (_vm->_gyro->whereis[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) _vm->_visa->dixi('U', 15); - } break; case 52: if (_vm->_gyro->dna.room == r__musicroom) From 93a5fadcb82e6f9dd97a24442a7f694babce04a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 13:58:12 +0200 Subject: [PATCH 0791/1332] AVALANCHE: Fix error reported by GCC: extra coma in enum declaraction --- engines/avalanche/closing2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index 14cf54bbf382..89e2d7358a05 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -49,7 +49,7 @@ class Closing { kScreenBugAlert = 1, kScreenRamCram = 2, kScreenNagScreen = 3, - kScreenTwoCopies = 5, + kScreenTwoCopies = 5 }; AvalancheEngine *_vm; From 3f3757e03f6e0eaa735235779146cb9f482827c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 14:08:00 +0200 Subject: [PATCH 0792/1332] AVALANCHE: Use a class-key when declaring a friend class --- engines/avalanche/dropdown2.h | 6 +++--- engines/avalanche/trip6.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 7b8f9723305a..105b2b8339dd 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -118,9 +118,9 @@ class menuset { class Dropdown { public: - friend headtype; - friend onemenu; - friend menuset; + friend class headtype; + friend class onemenu; + friend class menuset; onemenu ddm_o; menuset ddm_m; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index f91e72c2f330..a4316336cd2a 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -145,8 +145,8 @@ class getsettype { class Trip { public: - friend triptype; - friend getsettype; + friend class triptype; + friend class getsettype; From bbaa645b6cb9480505f21556e0460368cc7a753c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 14:10:15 +0200 Subject: [PATCH 0793/1332] AVALANCHE: Fix error reported by GCC: extra coma in enum declaraction in acci2 --- engines/avalanche/acci2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index e09c72ec2212..4937bb47d4f0 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -89,7 +89,7 @@ class Acci { kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, - kVerbCodeExpletive = 253, + kVerbCodeExpletive = 253 }; static const byte kPardon = 254; // Didn't understand / wasn't given. From 316e84a4d4db512c4f49bfbd7a7b01588e2ebe94 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 14:56:05 +0200 Subject: [PATCH 0794/1332] AVALANCHE: cleanup acci2.h --- engines/avalanche/acci2.cpp | 12 +--- engines/avalanche/acci2.h | 123 ++++++++---------------------------- 2 files changed, 28 insertions(+), 107 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ef6631184c80..167faf1188de 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -284,12 +284,6 @@ Common::String Acci::totalTime() { return result + _vm->_gyro->strf(s) + " seconds."; } - - -void Acci::number(Common::String &codes) { - warning("STUB: Acci::number()"); -} - void Acci::cheatParse(Common::String codes) { // uint16 num; // int16 e; @@ -1332,7 +1326,7 @@ void Acci::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) - && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHighscores) && (_verb != kVerbCodeSmartAlec)) { + && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->alive) { _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); return; @@ -1885,7 +1879,7 @@ void Acci::doThat() { } else _vm->_visa->dixi('Q', 10); break; - case kVerbCodePassword: + case kVerbCodePasswd: if (_vm->_gyro->dna.room != r__bridge) _vm->_visa->dixi('Q', 12); else { @@ -1959,7 +1953,7 @@ void Acci::doThat() { _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; - case kVerbCodeHighscores: + case kVerbCodeHiscores: // show_highs(); warning("STUB: Acci::doThat() - case kVerbCodehighscores"); break; diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 4937bb47d4f0..d881eab222d3 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -41,67 +41,24 @@ class AvalancheEngine; class Acci { public: enum VerbCode { - kVerbCodeExam = 1, - kVerbCodeOpen = 2, - kVerbCodePause = 3, - kVerbCodeGet = 4, - kVerbCodeDrop = 5, - kVerbCodeInv = 6, - kVerbCodeTalk = 7, - kVerbCodeGive = 8, - kVerbCodeDrink = 9, - kVerbCodeLoad = 10, - kVerbCodeSave = 11, - kVerbCodePay = 12, - kVerbCodeLook = 13, - kVerbCodeBreak = 14, - kVerbCodeQuit = 15, - kVerbCodeSit = 16, - kVerbCodeStand = 17, - kVerbCodeGo = 18, - kVerbCodeInfo = 19, - kVerbCodeUndress = 20, - kVerbCodeWear = 21, - kVerbCodePlay = 22, - kVerbCodeRing = 23, - kVerbCodeHelp = 24, - kVerbCodeLarrypass = 25, - kVerbCodePhaon = 26, - kVerbCodeBoss = 27, - kVerbCodePee = 28, - kVerbCodeCheat = 29, - kVerbCodeMagic = 30, - kVerbCodeRestart = 31, - kVerbCodeEat = 32, - kVerbCodeListen = 33, - kVerbCodeBuy = 34, - kVerbCodeAttack = 35, - kVerbCodePassword = 36, - kVerbCodeDir = 37, - kVerbCodeDie = 38, - kVerbCodeScore = 39, - kVerbCodePut = 40, - kVerbCodeKiss = 41, - kVerbCodeClimb = 42, - kVerbCodeJump = 43, - kVerbCodeHighscores = 44, - kVerbCodeWake = 45, - kVerbCodeHello = 46, - kVerbCodeThanks = 47, - kVerbCodeSmartAlec = 249, - kVerbCodeExpletive = 253 + kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, + kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, + kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, + kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, + kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, + kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, + kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, + kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, + kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 }; static const byte kPardon = 254; // Didn't understand / wasn't given. - static const int16 kParserWordsNum = 277; // How many words does the parser know? static const byte kNothing = 250; static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.) - static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS". - - struct VocabEntry { byte _number; Common::String _word; @@ -109,102 +66,72 @@ class Acci { static const VocabEntry kVocabulary[kParserWordsNum]; - static const char kWhat[]; + Common::String _realWords[11]; + byte _verb, _person, _thing; + bool _polite; + Acci(AvalancheEngine *vm); + void init(); + void parse(); + void doThat(); + void verbOpt(byte verb, Common::String &answer, char &ansKey); + void drink(); +private: struct RankType { uint16 _score; Common::String _title; }; static const RankType kRanks[9]; - - + static const char kWhat[]; Common::String _thats; Common::String _unknown; - Common::String _realWords[11]; - byte _verb, _person, _thing, _thing2; - bool _polite; + byte _thing2; - - - Acci(AvalancheEngine *vm); - - void init(); - - void clearWords(); - void parse(); - void lookAround(); // This is called when you say "look". - void openDoor(); - void doThat(); - void verbOpt(byte verb, Common::String &answer, char &ansKey); - void drink(); - -private: AvalancheEngine *_vm; - byte fv; - byte wordNum(Common::String word); void replace(Common::String oldChars, byte newChar); Common::String rank(); Common::String totalTime(); - void number(Common::String &codes); + void clearWords(); void cheatParse(Common::String codes); - void stripPunctuation(Common::String &word); // Strips punctuation from word. - void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective! bool doPronouns(); - void properNouns(); + void lookAround(); // This is called when you say "look". void sayIt(); // This makes Avalot say the response. + void openDoor(); void storeInterrogation(byte interrogation); - void examineObject(); // Examine a standard object-thing - bool isPersonHere(); - void exampers(); - bool holding(); - void openBox(bool isOpening); void examine(); - void inventory(); - void swallow(); - void peopleInRoom(); // This lists the other people in the room. - void silly(); void putProc(); // Called when you call kVerbCodeput. - void notInOrder(); void goToCauldron(); bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!". - void cardiffClimbing(); - void already(); void standUp(); // Called when you ask Avvy to stand. - void getProc(char thing); - void giveGeidaTheLute(); - void playHarp(); - void winSequence(); - void personSpeaks(); - void heyThanks(); }; From 41416f0c0529fe43040c640c83160aa076b7fc80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 16:10:48 +0200 Subject: [PATCH 0795/1332] AVALANCHE: Clean up celer2 --- engines/avalanche/celer2.cpp | 114 +++++++++++++++++------------------ engines/avalanche/celer2.h | 14 ----- 2 files changed, 55 insertions(+), 73 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index a84d15116f02..d7f318f863dd 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -37,14 +37,10 @@ #include "common/textconsole.h" - - namespace Avalanche { const int16 Celer::kOnDisk = -1; - - Celer::Celer(AvalancheEngine *vm) { _vm = vm; _spriteNum = 0; @@ -54,7 +50,6 @@ Celer::~Celer() { forgetBackgroundSprites(); } - /** * @remarks Originally called 'pics_link' */ @@ -79,61 +74,60 @@ void Celer::updateBackgroundSprites() { if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); break; - case r__argentpub: { - if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { - // Malagauche cycle. - _vm->_gyro->dna.malagauche += 1; - switch (_vm->_gyro->dna.malagauche) { - case 1: - case 11: - case 21: - drawBackgroundSprite(-1, -1, 12); // Looks forwards. - break; - case 8: - case 18: - case 28: - case 32: - drawBackgroundSprite(-1, -1, 11); // Looks at you. - break; - case 30: - drawBackgroundSprite(-1, -1, 13); // Winks. - break; - case 33: - _vm->_gyro->dna.malagauche = 0; - break; - } - } - - switch (_vm->_gyro->roomtime % 200) { - case 179: - case 197: - drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + case r__argentpub: + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + // Malagauche cycle. + _vm->_gyro->dna.malagauche += 1; + switch (_vm->_gyro->dna.malagauche) { + case 1: + case 11: + case 21: + drawBackgroundSprite(-1, -1, 12); // Looks forwards. break; - case 182: - case 194: - drawBackgroundSprite(-1, -1, 6); - break; - case 185: - drawBackgroundSprite(-1, -1, 7); - break; - case 199: - _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + case 8: + case 18: + case 28: + case 32: + drawBackgroundSprite(-1, -1, 11); // Looks at you. + break; + case 30: + drawBackgroundSprite(-1, -1, 13); // Winks. break; + case 33: + _vm->_gyro->dna.malagauche = 0; + break; } + } - if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. - byte direction = 0; - if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) - direction = 3; - else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) - direction = 2; - else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) - direction = 4; - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; - } + switch (_vm->_gyro->roomtime % 200) { + case 179: + case 197: + drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + break; + case 182: + case 194: + drawBackgroundSprite(-1, -1, 6); + break; + case 185: + drawBackgroundSprite(-1, -1, 7); + break; + case 199: + _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + break; + } + + if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + byte direction = 0; + if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 3; + else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) + direction = 2; + else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) + direction = 4; + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; } } break; @@ -305,9 +299,10 @@ void Celer::loadBackgroundSprites(byte number) { _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) + for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y); + } } else { _sprites[i]._size = sprite._size; _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); @@ -319,9 +314,10 @@ void Celer::loadBackgroundSprites(byte number) { } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _spriteNum; i++) + for (byte i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); + } } void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { @@ -378,7 +374,7 @@ void Celer::drawSprite(int16 x, int16 y, const SpriteType &sprite) { _r.y2 = y + sprite._yl; switch (sprite._type) { - case kNaturalImage: // Allow fallthorugh on purpose. + case kNaturalImage: // Allow fallthrough on purpose. case kBgi: _r.x2 = x + sprite._xl + 1; break; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 56c5f22d09c6..fe38ebe91708 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -36,23 +36,16 @@ #include "graphics/surface.h" - - namespace Avalanche { class AvalancheEngine; class Celer { public: Celer(AvalancheEngine *vm); - ~Celer(); - - void updateBackgroundSprites(); - void loadBackgroundSprites(byte number); - void forgetBackgroundSprites(); // Setting the destination to negative coordinates means the picture should be drawn to it's original position. @@ -71,8 +64,6 @@ class Celer { ::Graphics::Surface _picture; }; - - AvalancheEngine *_vm; int32 _offsets[40]; @@ -80,13 +71,8 @@ class Celer { SpriteType _sprites[40]; bytefield _r; Common::String _filename; - - - static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ - - void drawSprite(int16 x, int16 y, const SpriteType &sprite); }; From 70aa840f0ba482271b8379685a40e59fb115fd8c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 16:52:44 +0200 Subject: [PATCH 0796/1332] AVALANCHE: Fix GCC warnings reported by GCC --- engines/avalanche/avalanche.cpp | 27 ++++++++++++++------------- engines/avalanche/avalot.cpp | 4 ++++ engines/avalanche/graphics.cpp | 2 +- engines/avalanche/parser.cpp | 2 ++ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a00701456e88..564f9faee471 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -207,40 +207,37 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } else { if (!_gyro->dna.like2drink.empty()) _gyro->dna.like2drink.clear(); - uint16 like2drinkSize; + uint16 like2drinkSize = 0; + char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.like2drink += actChr; } if (!_gyro->dna.favourite_song.empty()) _gyro->dna.favourite_song.clear(); - uint16 favourite_songSize; + uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.favourite_song += actChr; } if (!_gyro->dna.worst_place_on_earth.empty()) _gyro->dna.worst_place_on_earth.clear(); - uint16 worst_place_on_earthSize; + uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.worst_place_on_earth += actChr; } if (!_gyro->dna.spare_evening.empty()) _gyro->dna.spare_evening.clear(); - uint16 spare_eveningSize; + uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.spare_evening += actChr; } @@ -285,20 +282,21 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { // } //} - byte spriteNum; + byte spriteNum = 0; if (sz.isSaving()) { - spriteNum = 0; - for (byte i = 0; i < _trip->numtr; i++) + for (byte i = 0; i < _trip->numtr; i++) { if (_trip->tr[i].quick) spriteNum++; + } } sz.syncAsByte(spriteNum); - if (sz.isLoading()) + if (sz.isLoading()) { for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites. if (_trip->tr[i].quick) _trip->tr[i].done(); } + } for (byte i = 0; i < spriteNum; i++) { sz.syncAsByte(_trip->tr[i].whichsprite); @@ -364,7 +362,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { return false; } - char *signature = "AVAL"; + const char *signature = "AVAL"; f->write(signature, 4); // Write version. We can't restore from obsolete versions. @@ -536,6 +534,9 @@ void AvalancheEngine::updateEvents() { break; case Common::EVENT_KEYDOWN: _avalot->handleKeyDown(event); + break; + default: + break; } } } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c791a77ed661..12bdbd037368 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -97,6 +97,8 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_KP1: event.kbd.keycode = Common::KEYCODE_END; break; + default: + break; } switch (event.kbd.keycode) { @@ -120,6 +122,8 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_RETURN: _vm->_parser->handleReturn(); break; + default: + break; } _vm->_lucerna->showrw(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b4ee2a7a3f51..35ccd5ff2ec1 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -177,7 +177,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 xTemp = xNext; int16 yTemp = yNext; // This is used by both sin and cos. - double tempTerm = (j+delta)*convfac; + tempTerm = (j + delta) * convfac; xNext = floor(xRadius*cos(tempTerm) + 0.5); yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 67b893f32f4f..c8a04ae3ae11 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -101,6 +101,8 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F7: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); break; + default: + break; } } From 6818dd2eb4749d4b96d8bf6f4b6b2d0b4d2d8753 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 17:15:33 +0200 Subject: [PATCH 0797/1332] AVALANCHE: Fix some more GCC warnings --- engines/avalanche/acci2.cpp | 6 ++++-- engines/avalanche/trip6.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 167faf1188de..9ce3180a4129 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1556,7 +1556,8 @@ void Acci::doThat() { if (holding()) { // Wear something. switch (_thing) { case Gyro::chastity: - _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??!"); + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you\?\?!"); break; case Gyro::clothes: case Gyro::habit: { /* Change this! */ @@ -1667,7 +1668,8 @@ void Acci::doThat() { if (_thing == _vm->_gyro->bell) { _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls->display("(Are you trying to join in, Avvy??!)"); + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); } else _vm->_scrolls->display(kWhat); } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 417a92056ea6..e07607a4d560 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1646,6 +1646,8 @@ void Trip::handleMoveKey(const Common::Event &event) { case Common::KEYCODE_KP5: stopwalking(); break; + default: + break; } } From ad5529b5d27748f34cbd978eb3c0040e3a2d266f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 17:54:08 +0200 Subject: [PATCH 0798/1332] AVALANCHE: Fix more GCC warnings --- engines/avalanche/dropdown2.cpp | 36 +++++++++++++++++---------------- engines/avalanche/dropdown2.h | 2 +- engines/avalanche/gyro2.cpp | 12 +++++------ engines/avalanche/gyro2.h | 23 +++------------------ engines/avalanche/lucerna2.cpp | 26 +++++++++++++----------- engines/avalanche/scrolls2.cpp | 5 ++--- engines/avalanche/sequence2.cpp | 4 ++-- engines/avalanche/trip6.cpp | 16 +++++++-------- engines/avalanche/trip6.h | 4 ++-- 9 files changed, 56 insertions(+), 72 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 82a5228ed31e..f0b1194c67d1 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -350,11 +350,11 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { ander = 170; fontType font; - for (byte fv = 0; fv < z.size(); fv++) + for (byte idx = 0; idx < z.size(); idx++) for (byte ff = 0; ff < 8; ff++) { - font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; + font[z[idx]][ff] = _vm->_gyro->characters[z[idx]][ff] & ander; for (byte i = 0; i < 8; i++) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = lightgray; + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + idx * 8 + i, y + ff) = lightgray; } _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black); @@ -363,14 +363,15 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { if (! z.contains(t)) return; else { - byte fv; - for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. + byte idx = 0; + for (; z[idx] != t; idx++) + ; // Search for the character in the string. byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = black; + *_vm->_graphics->getPixel(x * 8 + idx * 8 + 7 - bit, y + 8) = black; } } @@ -385,26 +386,27 @@ void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { ander = 170; fontType font; - for (byte fv = 0; fv < z.size(); fv++) + for (byte idx = 0; idx < z.size(); idx++) { for (byte ff = 0; ff < 8; ff++) { - font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; // Set the font. + font[z[idx]][ff] = _vm->_gyro->characters[z[idx]][ff] & ander; // Set the font. // And set the background of the text to black. for (byte i = 0; i < 8; i++) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = black; + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + idx * 8 + i, y + ff) = black; } + } _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, white); // Underline the selected character. if (z.contains(t)) { - byte fv; - for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. + byte idx; + for (idx = 0; z[idx] != t; idx++); // Search for the character in the string. byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = white; + *_vm->_graphics->getPixel(x * 8 + idx * 8 + 7 - bit, y + 8) = white; } } @@ -422,11 +424,11 @@ void Dropdown::bleep() { warning("STUB: Dropdown::bleep()"); } -void Dropdown::parsekey(char r, char re) { - switch (r) { +void Dropdown::parsekey(char key1, char key2) { + switch (key1) { case 0: case 224: { - switch (re) { + switch (key2) { case 'K': if (ddm_o.menunum > 1) { ddm_o.wipe(); @@ -454,7 +456,7 @@ void Dropdown::parsekey(char r, char re) { ddm_o.movehighlight(1); break; default: - ddm_m.extd(re); + ddm_m.extd(key2); } } break; @@ -463,7 +465,7 @@ void Dropdown::parsekey(char r, char re) { break; default: { if (ddm_o.menunow) - ddm_o.keystroke(r); + ddm_o.keystroke(key1); } } } diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 105b2b8339dd..396357935630 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -133,7 +133,7 @@ class Dropdown { void find_what_you_can_do_with_it(); - void parsekey(char r, char re); + void parsekey(char key1, char key2); void menu_link(); /* DDM menu-bar funcs */ diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 1653159937ab..47f8b72b0de0 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -267,12 +267,12 @@ Common::String Gyro::strf(int32 x) { return q; } -void Gyro::newpointer(byte m) { - if (m == cmp) +void Gyro::newpointer(byte id) { + if (id == cmp) return; - cmp = m; + cmp = id; - load_a_mouse(m); + load_a_mouse(id); } void Gyro::wait() { @@ -388,8 +388,8 @@ bool Gyro::flagset(char x) { } void Gyro::force_numlock() { - if ((locks & num) > 0) - locks -= num; + if ((locks & numlockCode) > 0) + locks -= numlockCode; } bool Gyro::pennycheck(uint16 howmuchby) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 3caa946eb24f..971fbbdfc0ad 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -45,16 +45,10 @@ class AvalancheEngine; static const char numobjs = 18; /* always preface with a # */ static const int16 maxobjs = 12; /* carry limit */ -static const byte howlong = 1/*8*/; /* 18 ticks. */ - -static const int16 num = 32; /* Code for Num Lock */ +static const int16 numlockCode = 32; /* Code for Num Lock */ static const int16 mouse_size = 134; - - -typedef void (*proc)(); - struct postype { uint16 x, y, datapos; byte length; @@ -282,17 +276,6 @@ struct ednahead { /* Edna header */ /* DNA values follow, then footer (which is ignored) */ }; -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ - - - - - - class Gyro { public: static const char *vernum; @@ -535,7 +518,7 @@ class Gyro { Common::String flags; Common::String listen; - uint16 oh, onh, om, h, m, s, s1; + uint16 oh, onh, om, hour, minutes, seconds; Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ @@ -612,7 +595,7 @@ class Gyro { Common::String strf(int32 x); - void newpointer(byte m); + void newpointer(byte id); void wait(); // Makes hourglass. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 389aa2e23d8b..7bd4ca57c784 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -61,8 +61,10 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; - if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; - else _vm->_gyro->atkey = "alt-"; + if (_vm->_enhanced->atbios) + _vm->_gyro->atkey = "f1"; + else + _vm->_gyro->atkey = "alt-"; } void Lucerna::callverb(byte n) { @@ -1234,7 +1236,7 @@ void Lucerna::plothands() { hand(am, brown); calchand(nh, 14, ah, brown); - calchand(_vm->_gyro->m * 6, 17, am, brown); + calchand(_vm->_gyro->minutes * 6, 17, am, brown); hand(ah, yellow); hand(am, yellow); @@ -1253,26 +1255,26 @@ void Lucerna::clock_lucerna() { /* ...Clock. */ TimeDate t; _vm->_system->getTimeAndDate(t); - _vm->_gyro->h = t.tm_hour; - _vm->_gyro->m = t.tm_min; - _vm->_gyro->s = t.tm_sec; + _vm->_gyro->hour = t.tm_hour; + _vm->_gyro->minutes = t.tm_min; + _vm->_gyro->seconds = t.tm_sec; - nh = (_vm->_gyro->h % 12) * 30 + _vm->_gyro->m / 2; + nh = (_vm->_gyro->hour % 12) * 30 + _vm->_gyro->minutes / 2; - if (_vm->_gyro->oh != _vm->_gyro->h) { + if (_vm->_gyro->oh != _vm->_gyro->hour) { plothands(); chime(); } - if (_vm->_gyro->om != _vm->_gyro->m) + if (_vm->_gyro->om != _vm->_gyro->minutes) plothands(); - if ((_vm->_gyro->h == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) + if ((_vm->_gyro->hour == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) _vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); - _vm->_gyro->oh = _vm->_gyro->h; + _vm->_gyro->oh = _vm->_gyro->hour; _vm->_gyro->onh = nh; - _vm->_gyro->om = _vm->_gyro->m; + _vm->_gyro->om = _vm->_gyro->minutes; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 65c4faaae007..51d47a9e4d36 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -464,7 +464,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t void Scrolls::bubble(func2 gotoit) { int16 xl, yl, my, xw, yw; - byte fv; Common::Point p[3]; // byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ int16 xc; /* x correction */ @@ -478,7 +477,7 @@ void Scrolls::bubble(func2 gotoit) { xl = 0; yl = _vm->_gyro->scrolln * 5; - for (int8 fv = 0; fv < _vm->_gyro->scrolln; fv++) { + for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8; if (textWidth > xl) xl = textWidth; @@ -527,7 +526,7 @@ void Scrolls::bubble(func2 gotoit) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { + for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; bool offset = _vm->_gyro->scroll[fv].size() % 2; _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 68a8ea33e335..d5983c8784a6 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -45,7 +45,7 @@ Sequence::Sequence(AvalancheEngine *vm) { void Sequence::first_show(byte what) { /* First, we need to blank out the entire array. */ - for (int i = 0; i < sizeof(seq); i++) + for (uint i = 0; i < sizeof(seq); i++) seq[i] = 0; /* Then it's just the same as then_show. */ @@ -54,7 +54,7 @@ void Sequence::first_show(byte what) { } void Sequence::then_show(byte what) { - for (byte fv = 0; fv < seq_length; fv++) { + for (int16 fv = 0; fv < seq_length; fv++) { if (seq[fv] == 0) { seq[fv] = what; return; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index e07607a4d560..31ff07b5b7c5 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -271,10 +271,10 @@ void triptype::bounce() { _tr->_vm->_gyro->oncandopageswap = true; } -int8 triptype::sgn(int16 x) { - if (x > 0) +int8 triptype::sgn(int16 val) { + if (val > 0) return 1; - else if (x < 0) + else if (val < 0) return -1; else return 0; @@ -465,12 +465,10 @@ Trip::Trip(AvalancheEngine *vm) { } void Trip::loadtrip() { - byte gm; - - for (gm = 0; gm < numtr; gm++) + for (int16 gm = 0; gm < numtr; gm++) tr[gm].original(); - for (int i = 0; i < sizeof(aa); i++) + for (uint16 i = 0; i < sizeof(aa); i++) aa[i] = 0; } @@ -1084,8 +1082,8 @@ void Trip::newspeed() { } -void Trip::rwsp(byte t, byte r) { - switch (r) { +void Trip::rwsp(byte t, byte dir) { + switch (dir) { case up: tr[t].speed(0, -tr[t].ys); break; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index a4316336cd2a..1f2b83d00912 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -121,7 +121,7 @@ class triptype { bool collision_check(); - int8 sgn(int16 x); + int8 sgn(int16 val); }; @@ -198,7 +198,7 @@ class Trip { void tripkey(char dir); - void rwsp(byte t, byte r); + void rwsp(byte t, byte dir); void apped(byte trn, byte np); From d77eafb0dbbb2c797d014fcf84c908cf6914b184 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 18:12:06 +0200 Subject: [PATCH 0799/1332] AVALANCHE: Partially do the renaming in Dropdown. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/dropdown2.cpp | 685 ++++++++++++++------------------ engines/avalanche/dropdown2.h | 169 ++++---- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 6 +- engines/avalanche/parser.cpp | 8 +- engines/avalanche/trip6.cpp | 2 +- 8 files changed, 402 insertions(+), 474 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 68272c8c8839..a36ea300ebcd 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -468,7 +468,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->minor_redraw(); - _dropdown->standard_bar(); + _dropdown->setupMenu(); _gyro->whereis[0] = _gyro->dna.room; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e7a7a49fb11f..14ff7e5641d9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,7 +201,7 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->clock_lucerna(); - _vm->_dropdown->menu_link(); + _vm->_dropdown->updateMenu(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 4ef65046ccac..e814ba846c18 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -39,125 +39,119 @@ #include "common/textconsole.h" -namespace Avalanche { -headtype *headtype::init(char trig, char alttrig, Common::String name, byte p, func dw, func dc, Dropdown *dr) { - _dr = dr; - trigger = trig; - alttrigger = alttrig; - title = name; - position = p; - xpos = position * _dr->spacing + _dr->indent; - xright = (position + 1) * _dr->spacing + _dr->indent; - do_setup = dw; - do_choose = dc; +namespace Avalanche { + +void HeadType::init(char trig, char altTrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr) { + _trigger = trig; + _altTrigger = altTrig; + _title = title; + _position = pos; + _xpos = _position * _dr->kSpacing + _dr->kIndent; + _xright = (_position + 1) * _dr->kSpacing + _dr->kIndent; + _setupFunc = setupFunc; + _chooseFunc = chooseFunc; - return this; + _dr = dr; } -void headtype::display() { - CursorMan.showMouse(false); /*MT*/ - _dr->chalk(xpos, 1, trigger, title, true); - CursorMan.showMouse(true); /*MT*/ +void HeadType::draw() { + CursorMan.showMouse(false); + _dr->drawMenuItem(_xpos, 1, _trigger, _title, true); + CursorMan.showMouse(true); } -void headtype::highlight() { +void HeadType::highlight() { CursorMan.showMouse(false); //nosound(); //setactivepage(cp); warning("STUB: Dropdown::headytpe::highlight()"); - _dr->hlchalk(xpos, 1, trigger, title, true); + _dr->drawHighlightedMenuItem(_xpos, 1, _trigger, _title, true); - _dr->ddm_o.left = xpos; - _dr->ddm_o.menunow = true; + _dr->_activeMenuItem._left = _xpos; + _dr->_activeMenuItem._activeNow = true; _dr->_vm->_gyro->ddmnow = true; - _dr->ddm_o.menunum = position; + _dr->_activeMenuItem._activeNum = _position; - _dr->_vm->_gyro->cmp = 177; /* Force redraw of cursor. */ + _dr->_vm->_gyro->cmp = 177; // Force redraw of cursor. } -bool headtype::extdparse(char c) { - if (c != alttrigger) +bool HeadType::parseAltTrigger(char key) { + if (key != _altTrigger) return true; return false; } - - - -void onemenu::init(Dropdown *dr) { +void MenuItem::init(Dropdown *dr) { _dr = dr; - menunow = false; + _activeNow = false; _dr->_vm->_gyro->ddmnow = false; - menunum = 1; + _activeNum = 1; } -void onemenu::start_afresh() { - number = 0; - width = 0; - firstlix = false; - oldy = 0; - highlightnum = 0; +void MenuItem::reset() { + _optionNum = 0; + _width = 0; + _firstlix = false; + _oldY = 0; + _highlightNum = 0; } -void onemenu::opt(Common::String n, char tr, Common::String key, bool val) { - uint16 l = (n + key).size() + 3; - if (width < l) - width = l; +void MenuItem::setupOption(Common::String title, char trigger, Common::String shortcut, bool valid) { + uint16 width = (title + shortcut).size() + 3; + if (_width < width) + _width = width; - oo[number].title = n; - oo[number].trigger = tr; - oo[number].shortcut = key; - oo[number].valid = val; - number++; + _options[_optionNum]._title = title; + _options[_optionNum]._trigger = trigger; + _options[_optionNum]._shortcut = shortcut; + _options[_optionNum]._valid = valid; + _optionNum++; } -void onemenu::displayopt(byte y, bool highlit) { +void MenuItem::displayOption(byte y, bool highlit) { byte backgroundColor; if (highlit) backgroundColor = 0; else backgroundColor = 7; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((flx1 + 1) * 8, 3 + (y + 1) * 10, (flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); - //bar((flx1 + 1) * 8, 3 + y * 10, (flx2 + 1) * 8, 12 + y * 10); - - Common::String data = oo[y].title; - while (data.size() + oo[y].shortcut.size() < width) - data += ' '; /* Pad oo[y] spaces. */ - data += oo[y].shortcut; + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); + + Common::String data = _options[y]._title; + while (data.size() + _options[y]._shortcut.size() < _width) + data += ' '; // Pad _options[y] with spaces. + data += _options[y]._shortcut; if (highlit) - _dr->hlchalk(left, 4 + (y + 1) * 10, oo[y].trigger, data, oo[y].valid); + _dr->drawHighlightedMenuItem(_left, 4 + (y + 1) * 10, _options[y]._trigger, data, _options[y]._valid); else - _dr->chalk(left, 4 + (y + 1) * 10, oo[y].trigger, data, oo[y].valid); + _dr->drawMenuItem(_left, 4 + (y + 1) * 10, _options[y]._trigger, data, _options[y]._valid); } -void onemenu::display() { +void MenuItem::display() { CursorMan.showMouse(false); /*setactivepage(cp); setvisualpage(cp); setfillstyle(1, menu_b); setcolor(menu_border);*/ - firstlix = true; - flx1 = left - 2; - flx2 = left + width; - fly = 15 + number * 10; - menunow = true; + _firstlix = true; + _flx1 = _left - 2; + _flx2 = _left + _width; + fly = 15 + _optionNum * 10; + _activeNow = true; _dr->_vm->_gyro->ddmnow = true; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((flx1 + 1) * 8, 12, (flx2 + 1) * 8, fly), _dr->menu_b); - _dr->_vm->_graphics->_surface.frameRect(Common::Rect((flx1 + 1) * 8 - 1, 11, (flx2 + 1) * 8 + 1, fly + 1), _dr->menu_border); - /*bar((flx1 + 1) * 8, 12, (flx2 + 1) * 8, fly); - rectangle((flx1 + 1) * 8 - 1, 11, (flx2 + 1) * 8 + 1, fly + 1);*/ + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, fly), _dr->kMenuBackgroundColor); + _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); - displayopt(0, true); - for (byte y = 1; y < number; y++) - displayopt(y, false); + displayOption(0, true); + for (byte y = 1; y < _optionNum; y++) + displayOption(y, false); _dr->_vm->_gyro->defaultled = 1; _dr->_vm->_gyro->cmp = 177; @@ -165,71 +159,67 @@ void onemenu::display() { CursorMan.showMouse(true); // 4 = fletch } -void onemenu::wipe() { +void MenuItem::wipe() { //setactivepage(cp); CursorMan.showMouse(false); - _dr->chalk(_dr->ddm_m.ddms[_dr->ddm_o.menunum].xpos, 1, _dr->ddm_m.ddms[_dr->ddm_o.menunum].trigger, _dr->ddm_m.ddms[_dr->ddm_o.menunum].title, true); - /*mblit(flx1, 11, flx2 + 1, fly + 1, 3, cp); - blitfix();*/ + _dr->drawMenuItem(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true); - menunow = false; + _activeNow = false; _dr->_vm->_gyro->ddmnow = false; - firstlix = false; + _firstlix = false; _dr->_vm->_gyro->defaultled = 2; CursorMan.showMouse(true); } -void onemenu::movehighlight(int8 add) { - int8 hn; - if (add != 0) { - hn = highlightnum + add; - if ((hn < 0) || (hn >= number)) +void MenuItem::moveHighlight(int8 inc) { + int8 highlightNum; + if (inc != 0) { + highlightNum = _highlightNum + inc; + if ((highlightNum < 0) || (highlightNum >= _optionNum)) return; - highlightnum = hn; + _highlightNum = highlightNum; } //setactivepage(cp); CursorMan.showMouse(false); - displayopt(oldy, false); - displayopt(highlightnum, true); + displayOption(_oldY, false); + displayOption(_highlightNum, true); //setactivepage(1 - cp); - oldy = highlightnum; + _oldY = _highlightNum; CursorMan.showMouse(true); } -void onemenu::lightup(Common::Point cursorPos) { - if ((cursorPos.x < flx1 * 8) || (cursorPos.x > flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) +void MenuItem::lightUp(Common::Point cursorPos) { + if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) return; - highlightnum = (cursorPos.y - 26) / 20; - if (highlightnum == oldy) + _highlightNum = (cursorPos.y - 26) / 20; + if (_highlightNum == _oldY) return; - movehighlight(0); + moveHighlight(0); } -void onemenu::select(byte n) { /* Choose which one you want. */ - if (!oo[n].valid) +void MenuItem::select(byte which) { + if (!_options[which]._valid) return; - choicenum = n; + _choiceNum = which; wipe(); - if (choicenum == number) - choicenum--; /* Off the bottom. */ - if (choicenum > number) - choicenum = 0; /* Off the top, I suppose. */ + if (_choiceNum == _optionNum) + _choiceNum--; /* Off the bottom. */ + if (_choiceNum > _optionNum) + _choiceNum = 0; /* Off the top, I suppose. */ - (_dr->*_dr->ddm_m.ddms[menunum].do_choose)(); + (_dr->*_dr->_menuBar._menuItems[_activeNum]._chooseFunc)(); } -void onemenu::keystroke(char c) { - byte fv; - bool found; +void MenuItem::parseKey(char c) { c = toupper(c); - found = false; - for (fv = 0; fv < number; fv++) { - if ((toupper(oo[fv].trigger) == c) && oo[fv].valid) { - select(fv); + bool found = false; + for (byte i = 0; i < _optionNum; i++) { + if ((toupper(_options[i]._trigger) == c) && _options[i]._valid) { + select(i); found = true; } } @@ -239,82 +229,74 @@ void onemenu::keystroke(char c) { - - -void menuset::init(Dropdown *dr) { +void MenuBar::init(Dropdown *dr) { _dr = dr; - howmany = 0; + _menuNum = 0; } -void menuset::create(char t, Common::String n, char alttrig, func dw, func dc) { - ddms[howmany].init(t, alttrig, n, howmany, dw, dc, _dr); - howmany++; +void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc) { + _menuItems[_menuNum].init(trig, altTrig, title, _menuNum, setupFunc, chooseFunc, _dr); + _menuNum++; } -void menuset::update() { +void MenuBar::draw() { const bytefield menuspace = {0, 0, 80, 9}; - byte fv, page_, savecp; - /*setactivepage(3); - setfillstyle(1, _dr->menu_b); - bar(0, 0, 640, 9);*/ - _dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->menu_b); + //setactivepage(3); + + _dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->kMenuBackgroundColor); - savecp = _dr->_vm->_gyro->cp; + byte savecp = _dr->_vm->_gyro->cp; _dr->_vm->_gyro->cp = 3; - for (fv = 0; fv < howmany; fv++) - ddms[fv].display(); + for (byte i = 0; i < _menuNum; i++) + _menuItems[i].draw(); - for (page_ = 0; page_ <= 1; page_++) - _dr->_vm->_trip->getset[page_].remember(menuspace); + for (byte page = 0; page <= 1; page++) + _dr->_vm->_trip->getset[page].remember(menuspace); _dr->_vm->_gyro->cp = savecp; } -void menuset::extd(char c) { - byte fv; - fv = 0; - while ((fv < howmany) && (ddms[fv].extdparse(c))) - fv ++; - if (fv == howmany) +void MenuBar::parseAltTrigger(char c) { + byte i = 0; + while ((i < _menuNum) && (_menuItems[i].parseAltTrigger(c))) + i++; + if (i == _menuNum) return; - getcertain(fv); + setupMenuItem(i); } -void menuset::getcertain(byte fv) { - if (_dr->ddm_o.menunow) { - _dr->ddm_o.wipe(); // Get rid of menu. - if (_dr->ddm_o.menunum == ddms[fv].position) +void MenuBar::setupMenuItem(byte which) { + if (_dr->_activeMenuItem._activeNow) { + _dr->_activeMenuItem.wipe(); // Get rid of menu. + if (_dr->_activeMenuItem._activeNum == _menuItems[which]._position) return; // Clicked on own highlight. } - ddms[fv].highlight(); - (_dr->*ddms[fv].do_setup)(); + _menuItems[which].highlight(); + (_dr->*_menuItems[which]._setupFunc)(); } -void menuset::getmenu(int16 x) { - byte fv; - fv = 0; +void MenuBar::chooseMenuItem(int16 x) { + byte i = 0; do { - if ((x > ddms[fv].xpos * 8) && (x < ddms[fv].xright * 8)) { - getcertain(fv); + if ((x > _menuItems[i]._xpos * 8) && (x < _menuItems[i]._xright * 8)) { + setupMenuItem(i); return; } - fv++; - } while (fv < howmany); + i++; + } while (i < _menuNum); } - - Dropdown::Dropdown(AvalancheEngine *vm) { _vm = vm; - ddm_o.init(this); - ddm_m.init(this); + _activeMenuItem.init(this); + _menuBar.init(this); } -void Dropdown::find_what_you_can_do_with_it() { +void Dropdown::findWhatYouCanDoWithIt() { switch (_vm->_gyro->thinks) { case Gyro::wine: case Gyro::potion: @@ -338,11 +320,11 @@ void Dropdown::find_what_you_can_do_with_it() { _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; default: - _vm->_gyro->verbstr = _vm->_acci->kVerbCodeExam; /* anything else */ + _vm->_gyro->verbstr = _vm->_acci->kVerbCodeExam; // Anything else. } } -void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { +void Dropdown::drawMenuItem(int16 x, int16 y, char t, Common::String z, bool valid) { byte ander; if (valid) ander = 255; @@ -377,7 +359,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) { _vm->_graphics->refreshScreen(); } -void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { +void Dropdown::drawHighlightedMenuItem(int16 x, int16 y, char t, Common::String z, bool valid) { byte ander; if (valid) ander = 255; @@ -411,233 +393,199 @@ void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) { _vm->_graphics->refreshScreen(); } -/*funcedure say(x,y:int16; t:char; z:Common::String; f,b:byte); -begin; - settextjustify(0,2); setfillstyle(1,b); setcolor(f); - bar(x-3,y-1,x+textwidth(z)+3,y+textheight(z)); - chalk(x,y,t,z); -end;*/ - void Dropdown::bleep() { warning("STUB: Dropdown::bleep()"); } -void Dropdown::parsekey(char r, char re) { - switch (r) { - case 0: - case 224: { - switch (re) { - case 'K': - if (ddm_o.menunum > 1) { - ddm_o.wipe(); - ddm_m.getcertain(ddm_o.menunum - 1); - } else { - // Get menu on the left-hand side. - ddm_o.wipe(); - ddm_m.getmenu((ddm_m.howmany - 1) * spacing + indent); - } - break; - case 'M': - if (ddm_o.menunum < ddm_m.howmany) { - ddm_o.wipe(); - ddm_m.getcertain(ddm_o.menunum + 1); - } else { - // Get menu on the far right-hand side. - ddm_o.wipe(); - ddm_m.getmenu(indent); - } - break; - case 'H': - ddm_o.movehighlight(-1); - break; - case 'P': - ddm_o.movehighlight(1); - break; - default: - ddm_m.extd(re); - } - } - break; - case 13: - ddm_o.select(ddm_o.highlightnum); - break; - default: { - if (ddm_o.menunow) - ddm_o.keystroke(r); - } - } +void Dropdown::parseKey(char r, char re) { + //switch (r) { + //case 0: + //case 224: { + // switch (re) { + // case 'K': + // if (_activeMenuItem._activeNum > 1) { + // _activeMenuItem.wipe(); + // _menuBar.setupMenuItem(_activeMenuItem._activeNum - 1); + // } else { + // // Get menu on the left-hand side. + // _activeMenuItem.wipe(); + // _menuBar.chooseMenuItem((_menuBar._menuNum - 1) * kSpacing + kIndent); + // } + // break; + // case 'M': + // if (_activeMenuItem._activeNum < _menuBar._menuNum) { + // _activeMenuItem.wipe(); + // _menuBar.setupMenuItem(_activeMenuItem._activeNum + 1); + // } else { + // // Get menu on the far right-hand side. + // _activeMenuItem.wipe(); + // _menuBar.chooseMenuItem(kIndent); + // } + // break; + // case 'H': + // _activeMenuItem.moveHighlight(-1); + // break; + // case 'P': + // _activeMenuItem.moveHighlight(1); + // break; + // default: + // _menuBar.parseAltTrigger(re); + // } + //} + //break; + //case 13: + // _activeMenuItem.select(_activeMenuItem._highlightNum); + // break; + //default: { + // if (_activeMenuItem._activeNow) + // _activeMenuItem.parseKey(r); + // } + //} + warning("STUB: Dropdown::parseKey()"); +} + +Common::String Dropdown::selectGender(byte x) { + if (x < 175) + return "im"; + else + return "er"; } -/*$F+ *** Here follow all the ddm__ and do__ funcedures for the DDM system. */ - -void Dropdown::ddm__game() { - ddm_o.start_afresh(); - ddm_o.opt("Help...", 'H', "f1", true); - ddm_o.opt("Boss Key", 'B', "alt-B", true); - ddm_o.opt("Untrash screen", 'U', "ctrl-f7", true); - ddm_o.opt("Score and rank", 'S', "f9", true); - ddm_o.opt("About Avvy...", 'A', "shift-f10", true); - ddm_o.display(); +void Dropdown::setupMenuGame() { + _activeMenuItem.reset(); + _activeMenuItem.setupOption("Help...", 'H', "f1", true); + _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", true); + _activeMenuItem.setupOption("Untrash screen", 'U', "ctrl-f7", true); + _activeMenuItem.setupOption("Score and rank", 'S', "f9", true); + _activeMenuItem.setupOption("About Avvy...", 'A', "shift-f10", true); + _activeMenuItem.display(); } -void Dropdown::ddm__file() { - ddm_o.start_afresh(); - ddm_o.opt("New game", 'N', "f4", true); - ddm_o.opt("Load...", 'L', "^f3", true); - ddm_o.opt("Save", 'S', "^f2", _vm->_gyro->alive); - ddm_o.opt("Save As...", 'v', "", _vm->_gyro->alive); - ddm_o.opt("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); - ddm_o.opt("Quit", 'Q', "alt-X", true); - ddm_o.display(); +void Dropdown::setupMenuFile() { + _activeMenuItem.reset(); + _activeMenuItem.setupOption("New game", 'N', "f4", true); + _activeMenuItem.setupOption("Load...", 'L', "^f3", true); + _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->alive); + _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->alive); + _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); + _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); + _activeMenuItem.display(); } -void Dropdown::ddm__action() { - ddm_o.start_afresh(); +void Dropdown::setupMenuAction() { + _activeMenuItem.reset(); - Common::String n = _vm->_gyro->f5_does(); + Common::String f5Does = _vm->_gyro->f5_does(); for (byte i = 0; i < 2; i++) - if (!n.empty()) - n.deleteChar(0); - if (n.empty()) - ddm_o.opt("Do something", 'D', "f5", false); + if (!f5Does.empty()) + f5Does.deleteChar(0); + if (f5Does.empty()) + _activeMenuItem.setupOption("Do something", 'D', "f5", false); else - ddm_o.opt(n, n[0], "f5", true); - ddm_o.opt("Pause game", 'P', "f6", true); + _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); + _activeMenuItem.setupOption("Pause game", 'P', "f6", true); if (_vm->_gyro->dna.room == 99) - ddm_o.opt("Journey thither", 'J', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_trip->neardoor()); else - ddm_o.opt("Open the door", 'O', "f7", _vm->_trip->neardoor()); - ddm_o.opt("Look around", 'L', "f8", true); - ddm_o.opt("Inventory", 'I', "Tab", true); + _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Look around", 'L', "f8", true); + _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) - ddm_o.opt("Run fast", 'R', "^R", true); + _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else - ddm_o.opt("Walk slowly", 'W', "^W", true); + _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); - ddm_o.display(); + _activeMenuItem.display(); } -void Dropdown::ddm__people() { +void Dropdown::setupMenuPeople() { if (!people.empty()) people.clear(); byte here = _vm->_gyro->dna.room; - ddm_o.start_afresh(); + _activeMenuItem.reset(); - for (byte fv = 150; fv <= 178; fv++) - if (_vm->_gyro->whereis[fv - 150] == here) { - ddm_o.opt(_vm->_gyro->getname(fv), _vm->_gyro->getnamechar(fv), "", true); - people = people + fv; + for (byte i = 150; i <= 178; i++) + if (_vm->_gyro->whereis[i - 150] == here) { + _activeMenuItem.setupOption(_vm->_gyro->getname(i), _vm->_gyro->getnamechar(i), "", true); + people = people + i; } - ddm_o.display(); + _activeMenuItem.display(); } -void Dropdown::ddm__objects() { - ddm_o.start_afresh(); - for (byte fv = 0; fv < numobjs; fv++) { - if (_vm->_gyro->dna.obj[fv]) - ddm_o.opt(_vm->_gyro->get_thing(fv + 1), _vm->_gyro->get_thingchar(fv + 1), "", true); +void Dropdown::setupMenuObjects() { + _activeMenuItem.reset(); + for (byte i = 0; i < numobjs; i++) { + if (_vm->_gyro->dna.obj[i]) + _activeMenuItem.setupOption(_vm->_gyro->get_thing(i + 1), _vm->_gyro->get_thingchar(i + 1), "", true); } - ddm_o.display(); -} - -Common::String Dropdown::himher(byte x) { - if (x < 175) - return "im"; - else - return "er"; + _activeMenuItem.display(); } -void Dropdown::ddm__with() { - byte fv; +void Dropdown::setupMenuWith() { Common::String verb; char vbchar; - bool n; - ddm_o.start_afresh(); + _activeMenuItem.reset(); if (_vm->_gyro->thinkthing) { - find_what_you_can_do_with_it(); + findWhatYouCanDoWithIt(); - for (fv = 0; fv < _vm->_gyro->verbstr.size(); fv++) { - _vm->_acci->verbOpt(_vm->_gyro->verbstr[fv], verb, vbchar); - ddm_o.opt(verb, vbchar, "", true); + for (byte i = 0; i < _vm->_gyro->verbstr.size(); i++) { + _vm->_acci->verbOpt(_vm->_gyro->verbstr[i], verb, vbchar); + _activeMenuItem.setupOption(verb, vbchar, "", true); } - // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, or (c), the _person you've selected is YOU! + // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, + // or (c), the _person you've selected is YOU! - if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) - ddm_o.opt("Give to...", 'G', "", false); /* Not here. */ + if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) + || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) + _activeMenuItem.setupOption("Give to...", 'G', "", false); /* Not here. */ else { - ddm_o.opt(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeGive; } } else { - ddm_o.opt("Examine", 'x', "", true); - ddm_o.opt(Common::String("Talk to h") + himher(_vm->_gyro->thinks), 'T', "", true); + _activeMenuItem.setupOption("Examine", 'x', "", true); + _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->thinks), 'T', "", true); _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; switch (_vm->_gyro->thinks) { case Gyro::pgeida: case Gyro::parkata: { - ddm_o.opt("Kiss her", 'K', "", true); + _activeMenuItem.setupOption("Kiss her", 'K', "", true); _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeKiss; } break; case Gyro::pdogfood: { - ddm_o.opt("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodePlay; } break; case Gyro::pmalagauche: { - n = !_vm->_gyro->dna.teetotal; - ddm_o.opt("Buy some wine", 'w', "", !_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]); - ddm_o.opt("Buy some beer", 'b', "", n); - ddm_o.opt("Buy some whisky", 'h', "", n); - ddm_o.opt("Buy some cider", 'c', "", n); - ddm_o.opt("Buy some mead", 'm', "", n); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\145' + '\144' + '\146' + '\147' + '\150'; + bool isSober = !_vm->_gyro->dna.teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]); + _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); + _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); + _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); + _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + 101 + 100 + 102 + 103 + 104; } break; case Gyro::ptrader: { - ddm_o.opt("Buy an onion", 'o', "", !_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + '\151'; + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]); + _vm->_gyro->verbstr = _vm->_gyro->verbstr + 105; } break; } } - ddm_o.display(); -} - -/*funcedure ddm__map; -begin; - with ddm_o do - begin; - ddm_o.start_afresh; - opt('Cancel map','G','f5',true); - opt('Pause game','P','f6',true); - opt('Journey thither','J','f7',neardoor); - opt('Explanation','L','f8',true); - display; - end; -end; - -funcedure ddm__town; -begin; - with ddm_o do - begin; - ddm_o.start_afresh; - opt('Argent','A','',true); - opt('Birmingham','B','',true); - opt('Nottingham','N','',true); - opt('Cardiff','C','',true); - display; - end; -end;*/ - -void Dropdown::do__game() { - switch (ddm_o.choicenum) { - /* Help, boss, untrash screen. */ + _activeMenuItem.display(); +} + +void Dropdown::runMenuGame() { + // Help, boss, untrash screen. + switch (_activeMenuItem._choiceNum) { case 0: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeHelp); break; @@ -656,9 +604,9 @@ void Dropdown::do__game() { } } -void Dropdown::do__file() { - switch (ddm_o.choicenum) { - /* New game, load, save, save as, DOS shell, about, quit. */ +void Dropdown::runMenuFile() { + // New game, load, save, save as, DOS shell, about, quit. + switch (_activeMenuItem._choiceNum) { case 0: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeRestart); break; @@ -676,6 +624,7 @@ void Dropdown::do__file() { break; case 3: //_vm->_basher->filename_edit(); + warning("STUB: Dropdown::runMenuFile()"); break; case 4: _vm->_enid->back_to_bootstrap(2); @@ -686,15 +635,15 @@ void Dropdown::do__file() { } } -void Dropdown::do__action() { - Common::String n; - switch (ddm_o.choicenum) { - /* Get up/pause game/open door/look/inv/walk-run */ +void Dropdown::runMenuAction() { + Common::String f5Does; + // Get up, pause game, open door, look, inventory, walk/run. + switch (_activeMenuItem._choiceNum) { case 0: { _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; - n = _vm->_gyro->f5_does(); - _vm->_lucerna->callverb(n[0]); + f5Does = _vm->_gyro->f5_does(); + _vm->_lucerna->callverb(f5Does[0]); } break; case 1: @@ -720,29 +669,29 @@ void Dropdown::do__action() { } } -void Dropdown::do__objects() { - _vm->_lucerna->thinkabout(_vm->_gyro->objlist[ddm_o.choicenum + 1], _vm->_gyro->a_thing); +void Dropdown::runMenuObjects() { + _vm->_lucerna->thinkabout(_vm->_gyro->objlist[_activeMenuItem._choiceNum + 1], _vm->_gyro->a_thing); } -void Dropdown::do__people() { - _vm->_lucerna->thinkabout(people[ddm_o.choicenum], _vm->_gyro->a_person); - _vm->_gyro->last_person = people[ddm_o.choicenum]; +void Dropdown::runMenuPeople() { + _vm->_lucerna->thinkabout(people[_activeMenuItem._choiceNum], _vm->_gyro->a_person); + _vm->_gyro->last_person = people[_activeMenuItem._choiceNum]; } -void Dropdown::do__with() { +void Dropdown::runMenuWith() { _vm->_acci->_thing = _vm->_gyro->thinks; if (_vm->_gyro->thinkthing) { _vm->_acci->_thing += 49; - if (_vm->_gyro->verbstr[ddm_o.choicenum] == _vm->_acci->kVerbCodeGive) + if (_vm->_gyro->verbstr[_activeMenuItem._choiceNum] == _vm->_acci->kVerbCodeGive) _vm->_acci->_person = _vm->_gyro->last_person; else _vm->_acci->_person = 254; } else { - switch (_vm->_gyro->verbstr[ddm_o.choicenum]) { + switch (_vm->_gyro->verbstr[_activeMenuItem._choiceNum]) { case 100: { // Beer _vm->_acci->_thing = 100; _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); @@ -786,54 +735,32 @@ void Dropdown::do__with() { } } } - _vm->_lucerna->callverb(_vm->_gyro->verbstr[ddm_o.choicenum]); + _vm->_lucerna->callverb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); } -// That's all. Now for the ...bar funcs. - -void Dropdown::standard_bar() { /* Standard menu bar */ - ddm_m.init(this); - ddm_o.init(this); - /* Set up menus */ - - ddm_m.create('F', "File", '!', &Avalanche::Dropdown::ddm__file, &Avalanche::Dropdown::do__file); // same ones in map_bar, below, - ddm_m.create('G', "Game", 34, &Avalanche::Dropdown::ddm__game, &Avalanche::Dropdown::do__game); // Don't forget to change the - ddm_m.create('A', "Action", 30, &Avalanche::Dropdown::ddm__action, &Avalanche::Dropdown::do__action); // if you change them - ddm_m.create('O', "Objects", 24, &Avalanche::Dropdown::ddm__objects, &Avalanche::Dropdown::do__objects); // here... - ddm_m.create('P', "People", 25, &Avalanche::Dropdown::ddm__people, &Avalanche::Dropdown::do__people); - ddm_m.create('W', "With", 17, &Avalanche::Dropdown::ddm__with, &Avalanche::Dropdown::do__with); - - ddm_m.update(); -} - - +void Dropdown::setupMenu() { + _menuBar.init(this); + _activeMenuItem.init(this); -/*funcedure map_bar; { Special menu bar for the map (screen 99) } -begin; - ddm_m.init; ddm_o.init; - with ddm_m do - begin; { Set up menus } - create('G','Game','#',ddm__game,do__game); - create('F','File','!',ddm__file,do__test); - create('M','Map','2',ddm__map,do__test); - create('T','Town',#20,ddm__town,do__test); - update; - end; -end;*/ + _menuBar.createMenuItem('F', "File", '!', &Avalanche::Dropdown::setupMenuFile, &Avalanche::Dropdown::runMenuFile); + _menuBar.createMenuItem('G', "Game", 34, &Avalanche::Dropdown::setupMenuGame, &Avalanche::Dropdown::runMenuGame); + _menuBar.createMenuItem('A', "Action", 30, &Avalanche::Dropdown::setupMenuAction, &Avalanche::Dropdown::runMenuAction); + _menuBar.createMenuItem('O', "Objects", 24, &Avalanche::Dropdown::setupMenuObjects, &Avalanche::Dropdown::runMenuObjects); + _menuBar.createMenuItem('P', "People", 25, &Avalanche::Dropdown::setupMenuPeople, &Avalanche::Dropdown::runMenuPeople); + _menuBar.createMenuItem('W', "With", 17, &Avalanche::Dropdown::setupMenuWith, &Avalanche::Dropdown::runMenuWith); -void Dropdown::checkclick(Common::Point cursorPos) { - warning("STUB: Dropdown::checkclick()"); + _menuBar.draw(); } -void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... +void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... Common::Point cursorPos = _vm->getMousePos(); ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); - while (!ddm_o.menunow && (cursorPos.y <= 21) && _vm->_lucerna->holdLeftMouse) { - ddm_m.getmenu(cursorPos.x); + while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->holdLeftMouse) { + _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); while (_vm->_lucerna->holdLeftMouse); @@ -849,37 +776,37 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) _vm->_gyro->newpointer(1); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { - if ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= ddm_o.fly * 2 + 1)) + if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem.fly * 2 + 1)) _vm->_gyro->newpointer(3); // Right-arrow else _vm->_gyro->newpointer(4); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) _vm->_gyro->newpointer(2); // Screwdriver - ddm_o.lightup(cursorPos); + _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); } while (!_vm->_lucerna->holdLeftMouse); if (_vm->_lucerna->holdLeftMouse) { if (cursorPos.y > 21) { - if (!((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) - && (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) { + if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) + && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1))))) { // Clicked OUTSIDE the menu. - if (ddm_o.menunow) { - ddm_o.wipe(); + if (_activeMenuItem._activeNow) { + _activeMenuItem.wipe(); _vm->_lucerna->holdLeftMouse = false; return; } // No "else"- clicking on menu has no effect (only releasing). } } else { // Clicked on menu bar. - if (ddm_o.menunow) { - ddm_o.wipe(); + if (_activeMenuItem._activeNow) { + _activeMenuItem.wipe(); _vm->_graphics->_surface.copyFrom(backup); _vm->_graphics->refreshScreen(); - if (((ddm_o.left * 8) <= cursorPos.x) && (cursorPos.x <= (ddm_o.left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. + if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_lucerna->holdLeftMouse = false; return; @@ -891,13 +818,13 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... } // NOT clicked button... - if ((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8) - && (cursorPos.y >= 12) && (cursorPos.y <= (ddm_o.fly * 2 + 1)))) { + if ((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) + && (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1)))) { // We act only if the button is released over a menu item. while (!_vm->shouldQuit()) { cursorPos = _vm->getMousePos(); - ddm_o.lightup(cursorPos); + _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); _vm->updateEvents(); @@ -906,8 +833,8 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it... } uint16 which = (cursorPos.y - 26) / 20; - ddm_o.select(which); - if (ddm_o.oo[which].valid) // If the menu item wasn't active, we do nothing. + _activeMenuItem.select(which); + if (_activeMenuItem._options[which]._valid) // If the menu item wasn't active, we do nothing. return; } } diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index f0f3917457af..58b3ca915898 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -35,25 +35,31 @@ #include "common/scummsys.h" #include "common/str.h" + + namespace Avalanche { class AvalancheEngine; class Dropdown; -typedef void (Dropdown::*func)(); -class headtype { -public: - Common::String title; - char trigger, alttrigger; - byte position; - int16 xpos, xright; - func do_setup, do_choose; - headtype *init(char trig, char alttrig, Common::String name, byte p, func dw, func dc, Dropdown *dr); - void display(); +typedef void (Dropdown::*DropdownFunc)(); + + + +class HeadType { +public: + Common::String _title; + char _trigger, _altTrigger; + byte _position; + int16 _xpos, _xright; + DropdownFunc _setupFunc, _chooseFunc; + + void init(char trig, char alTtrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr); + void draw(); void highlight(); - bool extdparse(char c); + bool parseAltTrigger(char key); private: Dropdown *_dr; @@ -61,36 +67,38 @@ class headtype { -struct optiontype { - Common::String title; - byte trigger; - Common::String shortcut; - bool valid; +struct OptionType { + Common::String _title; + byte _trigger; + Common::String _shortcut; + bool _valid; }; -class onemenu { + + +class MenuItem { public: - optiontype oo[12]; - byte number; - uint16 width, left; - bool firstlix; - int16 flx1, flx2, fly; - byte oldy; /* used by Lightup */ - bool menunow; /* Is there a menu now? */ - byte menunum; /* And if so, which is it? */ - byte choicenum; /* Your choice? */ - byte highlightnum; + OptionType _options[12]; + byte _optionNum; + uint16 _width, _left; + bool _firstlix; + int16 _flx1, _flx2, fly; + byte _oldY; // used by lightUp */ + bool _activeNow; // Is there an active option now? + byte _activeNum; // And if so, which is it? + byte _choiceNum; // Your choice? + byte _highlightNum; void init(Dropdown *dr); - void start_afresh(); - void opt(Common::String n, char tr, Common::String key, bool val); + void reset(); + void setupOption(Common::String title, char trigger, Common::String shortcut, bool valid); void display(); void wipe(); - void lightup(Common::Point cursorPos); // This makes the menu highlight follow the mouse. - void displayopt(byte y, bool highlit); - void movehighlight(int8 add); - void select(byte n); - void keystroke(char c); + void lightUp(Common::Point cursorPos); // This makes the menu highlight follow the mouse. + void displayOption(byte y, bool highlit); + void moveHighlight(int8 inc); + void select(byte which); // Choose which one you want. + void parseKey(char c); private: Dropdown *_dr; @@ -98,17 +106,17 @@ class onemenu { -class menuset { +class MenuBar { public: - headtype ddms[8]; - byte howmany; + HeadType _menuItems[8]; + byte _menuNum; void init(Dropdown *dr); - void create(char t, Common::String n, char alttrig, func dw, func dc); - void update(); - void extd(char c); - void getcertain(byte fv); - void getmenu(int16 x); + void createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc); + void draw(); + void parseAltTrigger(char c); + void setupMenuItem(byte which); + void chooseMenuItem(int16 x); private: Dropdown *_dr; @@ -118,12 +126,12 @@ class menuset { class Dropdown { public: - friend headtype; - friend onemenu; - friend menuset; + friend HeadType; + friend MenuItem; + friend MenuBar; - onemenu ddm_o; - menuset ddm_m; + MenuItem _activeMenuItem; + MenuBar _menuBar; Common::String people; @@ -131,59 +139,52 @@ class Dropdown { Dropdown(AvalancheEngine *vm); - void find_what_you_can_do_with_it(); - - void parsekey(char r, char re); + void parseKey(char r, char re); - void menu_link(); /* DDM menu-bar funcs */ + void updateMenu(); - void standard_bar(); + void setupMenu(); // Standard menu bar. private: - AvalancheEngine *_vm; - - static const byte indent = 5; - static const byte spacing = 10; - - static const byte menu_b = lightgray; /* Windowsy */ - static const byte menu_f = black; - static const byte menu_border = black; - static const byte highlight_b = black; - static const byte highlight_f = white; - static const byte disabled = darkgray; + static const byte kIndent = 5; + static const byte kSpacing = 10; + static const byte kMenuBackgroundColor = lightgray; + static const byte kMenuFontColor = black; + static const byte kMenuBorderColor = black; + static const byte kHighlightBackgroundColor = black; + static const byte kHighlightFontColor = white; + static const byte kDisabledColor = darkgray; - char r; - byte fv; - + AvalancheEngine *_vm; - void chalk(int16 x, int16 y, char t, Common::String z, bool valid); - void hlchalk(int16 x, int16 y, char t, Common::String z, bool valid); // Highlighted. TODO: It's too similar to chalk! Unify these two!!! - void bleep(); + Common::String selectGender(byte x); // Returns "im" for boys, and "er" for girls. + void findWhatYouCanDoWithIt(); - - void ddm__game(); - void ddm__file(); - void ddm__action(); - void ddm__people(); - void ddm__objects(); - void ddm__with(); + void drawMenuItem(int16 x, int16 y, char t, Common::String z, bool valid); - Common::String himher(byte x); // Returns "im" for boys, and "er" for girls. + void drawHighlightedMenuItem(int16 x, int16 y, char t, Common::String z, bool valid); // Highlighted. TODO: It's too similar to chalk! Unify these two!!! - void do__game(); - void do__file(); - void do__action(); - void do__objects(); - void do__people(); - void do__with(); + void bleep(); - void checkclick(Common::Point cursorPos); // Only for when the menu's displayed! + void setupMenuGame(); + void setupMenuFile(); + void setupMenuAction(); + void setupMenuPeople(); + void setupMenuObjects(); + void setupMenuWith(); + + void runMenuGame(); + void runMenuFile(); + void runMenuAction(); + void runMenuObjects(); + void runMenuPeople(); + void runMenuWith(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 4166ecfe3222..1d6ac7e0a37a 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -365,7 +365,7 @@ void Gyro::newgame() { _vm->_trip->new_game_for_trippancy(); _vm->_lucerna->showscore(); - _vm->_dropdown->standard_bar(); + _vm->_dropdown->setupMenu(); _vm->_lucerna->clock_lucerna(); _vm->_lucerna->sprite_run(); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 2b4c5fe363b2..8100c5a82918 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -325,7 +325,7 @@ void Lucerna::exitroom(byte x) { } void Lucerna::new_town() { /* You've just entered a town from the map. */ - _vm->_dropdown->standard_bar(); + _vm->_dropdown->setupMenu(); switch (_vm->_gyro->dna.room) { case r__outsidenottspub: /* Entry into Nottingham. */ @@ -947,7 +947,7 @@ void Lucerna::points(byte num) { /* Add on no. of points */ } void Lucerna::topcheck(Common::Point cursorPos) { - _vm->_dropdown->ddm_m.getmenu(cursorPos.x); + _vm->_dropdown->_menuBar.chooseMenuItem(cursorPos.x); } void Lucerna::mouseway(const Common::Point &cursorPos) { @@ -1107,7 +1107,7 @@ void Lucerna::checkclick() { if (holdLeftMouse) if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->dropsok) - _vm->_dropdown->menu_link(); + _vm->_dropdown->updateMenu(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 2457354e170c..bd7064877b4d 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -43,8 +43,8 @@ void Parser::init() { void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; - if (_vm->_dropdown->ddm_o.menunow) { - _vm->_dropdown->parsekey(inChar, _vm->_enhanced->extd); + if (_vm->_dropdown->_activeMenuItem._activeNow) { + _vm->_dropdown->parseKey(inChar, _vm->_enhanced->extd); } else { if (_inputText.size() < 76) { if ((inChar == '"') || (inChar == '`')) { @@ -64,7 +64,7 @@ void Parser::handleInputText(const Common::Event &event) { } void Parser::handleBackspace() { - if (!_vm->_dropdown->ddm_o.menunow) { + if (!_vm->_dropdown->_activeMenuItem._activeNow) { if (_inputTextPos > _leftMargin) { _inputTextPos--; if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) @@ -77,7 +77,7 @@ void Parser::handleBackspace() { } void Parser::handleReturn() { - if (_vm->_dropdown->ddm_o.menunow) + if (_vm->_dropdown->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); else { _vm->_logger->log_command(_inputText); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index dc45c6c2d7c2..f25a313095c3 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1598,7 +1598,7 @@ void Trip::handleMoveKey(const Common::Event &event) { if (!_vm->_gyro->dna.user_moves_avvy) return; - if (_vm->_dropdown->ddm_o.menunow) + if (_vm->_dropdown->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); else switch (event.kbd.keycode) { From 97843d9e943325a29c1dc50ab681a80fac96e6d8 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 18:26:57 +0200 Subject: [PATCH 0800/1332] AVALANCHE: Repair regression in Acci::inventory(). --- engines/avalanche/acci2.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 9ce3180a4129..673539745ff7 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -767,11 +767,12 @@ void Acci::inventory() { if (itemNum < _vm->_gyro->dna.carrying) _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); } - if (_vm->_gyro->dna.wearing == kNothing) - _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); - else - _vm->_scrolls->display("."); } + + if (_vm->_gyro->dna.wearing == kNothing) + _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + else + _vm->_scrolls->display("."); } void Acci::swallow() { /* Eat something. */ From 08e8e92e3a0206b963dacfeecc96b75008c88c02 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 18:34:58 +0200 Subject: [PATCH 0801/1332] AVALANCHE: Fix even more GCC warnings --- engines/avalanche/acci2.cpp | 9 +++++---- engines/avalanche/celer2.cpp | 21 ++++++++++++--------- engines/avalanche/enid2.cpp | 3 ++- engines/avalanche/trip6.cpp | 4 +--- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 673539745ff7..01c7d9a1a419 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1372,8 +1372,8 @@ void Acci::doThat() { case kVerbCodeTalk: if (_person == kPardon) { if (_vm->_gyro->subjnumber == 99) // They typed "say password". - _vm->_scrolls->display(Common::String("Yes, but kWhat ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); - else if (((1 <= _vm->_gyro->subjnumber) && (_vm->_gyro->subjnumber <= 49)) || (_vm->_gyro->subjnumber == 253) || (_vm->_gyro->subjnumber == 449)) { + _vm->_scrolls->display(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); + else if (((1 <= _vm->_gyro->subjnumber) && (_vm->_gyro->subjnumber <= 49)) || (_vm->_gyro->subjnumber == 253) || (_vm->_gyro->subjnumber == 249)) { _thats.deleteChar(0); for (byte i = 0; i < 10; i++) @@ -1890,9 +1890,10 @@ void Acci::doThat() { for (byte i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - for (byte i = 0; i < kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word.size(); i++) - if (kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word[i] != temp[i]) + for (byte j = 0; j < kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word.size(); j++) { + if (kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word[j] != temp[j]) ok = false; + } } if (ok) { diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index d7f318f863dd..5c95acabe5ac 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -152,14 +152,15 @@ void Celer::updateBackgroundSprites() { case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { byte direction = 0; + uint16 angle = _vm->_lucerna->bearing(2); if ((_vm->_gyro->roomtime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. - else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 1; // Middle. - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + else if ((angle >= 45) && (angle <= 180)) direction = 2; // Left. - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. @@ -195,11 +196,12 @@ void Celer::updateBackgroundSprites() { case r__nottspub: { // Bearing of Avvy from Port. byte direction = 0; - if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) + uint16 angle = _vm->_lucerna->bearing(5); + if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 2; // Middle. - else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) + else if ((angle >= 45) && (angle <= 180)) direction = 6; // Left. - else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) + else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. if ((_vm->_gyro->roomtime % 60) > 57) @@ -226,11 +228,12 @@ void Celer::updateBackgroundSprites() { // Bearing of Avvy from Duck. byte direction = 0; - if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + uint16 angle = _vm->_lucerna->bearing(2); + if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 4; // Middle. - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + else if ((angle >= 45) && (angle <= 180)) direction = 6; // Left. - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. if ((_vm->_gyro->roomtime % 45) > 42) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 1e7c816947a6..7a257d04f5cf 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -96,7 +96,8 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { day = _vm->_gyro->strf(d); - if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) { + // d is always positive + if ((d <= 9) || ((d >= 21) && (d <= 31))) { switch (d % 10) { case 1: day = day + "st"; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 9f494db175b3..cd7a2195bf2e 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1454,10 +1454,8 @@ void Trip::getsetclear() { } void Trip::hide_in_the_cupboard() { - const char nowt = '\xFA'; /* As in Acci. */ - if (_vm->_gyro->dna.avvys_in_the_cupboard) { - if (_vm->_gyro->dna.wearing == nowt) + if (_vm->_gyro->dna.wearing == Acci::kNothing) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { tr[0].visible = true; From a952ae3f8761a390de73a5e9031f9f233041f099 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 18:55:02 +0200 Subject: [PATCH 0802/1332] AVALANCHE: Fix some more GCC warnings --- engines/avalanche/gyro2.h | 2 +- engines/avalanche/scrolls2.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 971fbbdfc0ad..4e4cb0a75b87 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -43,7 +43,7 @@ namespace Avalanche { class AvalancheEngine; -static const char numobjs = 18; /* always preface with a # */ +static const byte numobjs = 18; /* always preface with a # */ static const int16 maxobjs = 12; /* carry limit */ static const int16 numlockCode = 32; /* Code for Num Lock */ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 51d47a9e4d36..32ad1c908579 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -198,8 +198,8 @@ void Scrolls::dialogue() { void Scrolls::store_(byte what, tunetype &played) { - memcpy(played+1, played+2, sizeof(played) - 1); - played[31] = what; + memcpy(played + 1, played + 2, sizeof(played) - 1); + played[30] = what; } bool Scrolls::they_match(tunetype &played) { @@ -207,10 +207,11 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv++) + for (fv = 1; fv <= sizeof(played); fv++) { if (played[fv] != _vm->_gyro->tune[fv]) { mistakes += 1; } + } return mistakes < 5; } @@ -715,7 +716,7 @@ void Scrolls::calldrivers() { return; } break; - case kControlNegative: { + case kControlNegative: switch (param) { case 1: display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) @@ -755,9 +756,9 @@ void Scrolls::calldrivers() { display(_vm->_gyro->get_better(_vm->_gyro->dna.box_contents) + '.'); } break; - case 11: { + case 11: nn = 1; - for (nnn = 0; nnn < numobjs; nnn++) + for (nnn = 0; nnn < numobjs; nnn++) { if (_vm->_gyro->dna.obj[nnn]) { nn++; display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); @@ -765,8 +766,6 @@ void Scrolls::calldrivers() { } break; } - - } break; case kControlIcon: use_icon = param; From 247bf3ca26a5e348f2a0c3cc584766a69a1472de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 19:17:32 +0200 Subject: [PATCH 0803/1332] AVALANCHE: Fix very verbose source of warning --- engines/avalanche/dropdown2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 58b3ca915898..35b4b562834c 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -126,9 +126,9 @@ class MenuBar { class Dropdown { public: - friend HeadType; - friend MenuItem; - friend MenuBar; + friend class HeadType; + friend class MenuItem; + friend class MenuBar; MenuItem _activeMenuItem; MenuBar _menuBar; From 90494e01fd89d9e5d7ea33e31664173590e0e250 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 20:57:25 +0200 Subject: [PATCH 0804/1332] AVALANCHE: Do renaming/refactoring in Acci, Avalanche and Dropdown. Unify drawing of menus' text in Dropdown in a single function: drawMenuText(). --- engines/avalanche/acci2.cpp | 2 - engines/avalanche/acci2.h | 2 - engines/avalanche/avalanche.cpp | 2 - engines/avalanche/avalanche.h | 2 - engines/avalanche/dropdown2.cpp | 94 +++++++++++---------------------- engines/avalanche/dropdown2.h | 15 +----- 6 files changed, 33 insertions(+), 84 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 01c7d9a1a419..2123471fa3d1 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -46,8 +46,6 @@ #include #include - - namespace Avalanche { const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index d881eab222d3..2f036630c417 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -33,8 +33,6 @@ #include "common/scummsys.h" #include "common/str.h" - - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c82c83948a94..b99090cbc54a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -41,8 +41,6 @@ #include "gui/saveload.h" #include "graphics/thumbnail.h" - - namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 63f654f55091..ddedb5a7877b 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -56,8 +56,6 @@ #include "graphics/cursorman.h" - - namespace Common { class RandomSource; } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index e814ba846c18..54727e7b8ce4 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -30,7 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/dropdown2.h" - #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/acci2.h" @@ -39,8 +38,6 @@ #include "common/textconsole.h" - - namespace Avalanche { void HeadType::init(char trig, char altTrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr) { @@ -58,7 +55,7 @@ void HeadType::init(char trig, char altTrig, Common::String title, byte pos, Dro void HeadType::draw() { CursorMan.showMouse(false); - _dr->drawMenuItem(_xpos, 1, _trigger, _title, true); + _dr->drawMenuText(_xpos, 1, _trigger, _title, true, false); CursorMan.showMouse(true); } @@ -69,7 +66,7 @@ void HeadType::highlight() { //setactivepage(cp); warning("STUB: Dropdown::headytpe::highlight()"); - _dr->drawHighlightedMenuItem(_xpos, 1, _trigger, _title, true); + _dr->drawMenuText(_xpos, 1, _trigger, _title, true, true); _dr->_activeMenuItem._left = _xpos; _dr->_activeMenuItem._activeNow = true; @@ -122,15 +119,12 @@ void MenuItem::displayOption(byte y, bool highlit) { backgroundColor = 7; _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); - Common::String data = _options[y]._title; - while (data.size() + _options[y]._shortcut.size() < _width) - data += ' '; // Pad _options[y] with spaces. - data += _options[y]._shortcut; + Common::String text = _options[y]._title; + while (text.size() + _options[y]._shortcut.size() < _width) + text += ' '; // Pad _options[y] with spaces. + text += _options[y]._shortcut; - if (highlit) - _dr->drawHighlightedMenuItem(_left, 4 + (y + 1) * 10, _options[y]._trigger, data, _options[y]._valid); - else - _dr->drawMenuItem(_left, 4 + (y + 1) * 10, _options[y]._trigger, data, _options[y]._valid); + _dr->drawMenuText(_left, 4 + (y + 1) * 10, _options[y]._trigger, text, _options[y]._valid, highlit); } void MenuItem::display() { @@ -163,7 +157,7 @@ void MenuItem::wipe() { //setactivepage(cp); CursorMan.showMouse(false); - _dr->drawMenuItem(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true); + _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); _activeNow = false; _dr->_vm->_gyro->ddmnow = false; @@ -324,7 +318,17 @@ void Dropdown::findWhatYouCanDoWithIt() { } } -void Dropdown::drawMenuItem(int16 x, int16 y, char t, Common::String z, bool valid) { +void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) { + byte fontColor; + byte backgroundColor; + if (highlighted) { + fontColor = white; + backgroundColor = black; + } else { + fontColor = black; + backgroundColor = lightgray; + } + byte ander; if (valid) ander = 255; @@ -332,61 +336,28 @@ void Dropdown::drawMenuItem(int16 x, int16 y, char t, Common::String z, bool val ander = 170; fontType font; - for (byte fv = 0; fv < z.size(); fv++) - for (byte ff = 0; ff < 8; ff++) { - font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; - for (byte i = 0; i < 8; i++) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = lightgray; + for (byte i = 0; i < text.size(); i++) + for (byte j = 0; j < 8; j++) { + font[text[i]][j] = _vm->_gyro->characters[text[i]][j] & ander; // Set the font. + // And set the background of the text to the desired color. + for (byte k = 0; k < 8; k++) + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; } - _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black); + _vm->_graphics->drawText(_vm->_graphics->_surface, text, font, 8, x * 8, y, fontColor); // Underline the selected character. - if (! z.contains(t)) + if (!text.contains(trigger)) return; else { - byte fv; - for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. + byte i; + for (i = 0; text[i] != trigger; i++); // Search for the character in the string. byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = black; - } - } - - _vm->_graphics->refreshScreen(); -} - -void Dropdown::drawHighlightedMenuItem(int16 x, int16 y, char t, Common::String z, bool valid) { - byte ander; - if (valid) - ander = 255; - else - ander = 170; - - fontType font; - for (byte fv = 0; fv < z.size(); fv++) - for (byte ff = 0; ff < 8; ff++) { - font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; // Set the font. - // And set the background of the text to black. - for (byte i = 0; i < 8; i++) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = black; - } - - _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, white); - - // Underline the selected character. - if (z.contains(t)) { - byte fv; - for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. - - byte pixel = ander; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - if (pixelBit) - *_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = white; + *_vm->_graphics->getPixel(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; } } @@ -441,7 +412,7 @@ void Dropdown::parseKey(char r, char re) { // _activeMenuItem.parseKey(r); // } //} - warning("STUB: Dropdown::parseKey()"); + warning("STUB: Dropdown::parseKey()"); // To be implemented properly later! Don't remove the comment above! } Common::String Dropdown::selectGender(byte x) { @@ -501,12 +472,11 @@ void Dropdown::setupMenuAction() { void Dropdown::setupMenuPeople() { if (!people.empty()) people.clear(); - byte here = _vm->_gyro->dna.room; _activeMenuItem.reset(); for (byte i = 150; i <= 178; i++) - if (_vm->_gyro->whereis[i - 150] == here) { + if (_vm->_gyro->whereis[i - 150] == _vm->_gyro->dna.room) { _activeMenuItem.setupOption(_vm->_gyro->getname(i), _vm->_gyro->getnamechar(i), "", true); people = people + i; } diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 35b4b562834c..8912e60a75bb 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -135,14 +135,10 @@ class Dropdown { Common::String people; - - Dropdown(AvalancheEngine *vm); void parseKey(char r, char re); - void updateMenu(); - void setupMenu(); // Standard menu bar. private: @@ -156,20 +152,11 @@ class Dropdown { static const byte kHighlightFontColor = white; static const byte kDisabledColor = darkgray; - - AvalancheEngine *_vm; - - Common::String selectGender(byte x); // Returns "im" for boys, and "er" for girls. - void findWhatYouCanDoWithIt(); - - void drawMenuItem(int16 x, int16 y, char t, Common::String z, bool valid); - - void drawHighlightedMenuItem(int16 x, int16 y, char t, Common::String z, bool valid); // Highlighted. TODO: It's too similar to chalk! Unify these two!!! - + void drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted); void bleep(); void setupMenuGame(); From 15947cec7ddfad7993b746c796f4f7dd9ff01a0a Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 4 Sep 2013 21:10:29 +0200 Subject: [PATCH 0805/1332] AVALANCHE: Get rid of Enhanced. Further renamings and refactoring in Avalanche and Avalot. --- engines/avalanche/avalanche.cpp | 2 -- engines/avalanche/avalanche.h | 43 ---------------------- engines/avalanche/avalot.h | 4 +-- engines/avalanche/enhanced2.cpp | 64 --------------------------------- engines/avalanche/enhanced2.h | 60 ------------------------------- engines/avalanche/lucerna2.cpp | 24 ++----------- engines/avalanche/lucerna2.h | 2 -- engines/avalanche/module.mk | 1 - engines/avalanche/parser.cpp | 7 ++-- engines/avalanche/scrolls2.cpp | 1 - 10 files changed, 7 insertions(+), 201 deletions(-) delete mode 100644 engines/avalanche/enhanced2.cpp delete mode 100644 engines/avalanche/enhanced2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b99090cbc54a..d6145819c381 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -63,7 +63,6 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; - delete _enhanced; delete _pingo; delete _scrolls; delete _visa; @@ -84,7 +83,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); - _enhanced = new Enhanced(this); _pingo = new Pingo(this); _scrolls = new Scrolls(this); _visa = new Visa(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index ddedb5a7877b..839618dbc69f 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -35,7 +35,6 @@ #include "avalanche/avalot.h" #include "avalanche/gyro2.h" -#include "avalanche/enhanced2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" @@ -73,7 +72,6 @@ class AvalancheEngine : public Engine { Avalot *_avalot; Gyro *_gyro; - Enhanced *_enhanced; Pingo *_pingo; Scrolls *_scrolls; Visa *_visa; @@ -87,15 +85,12 @@ class AvalancheEngine : public Engine { Dropdown *_dropdown; Closing *_closing; - OSystem *_system; - AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); Common::ErrorCode initialize(); - GUI::Debugger *getDebugger(); Common::RandomSource *_rnd; @@ -103,29 +98,20 @@ class AvalancheEngine : public Engine { const AvalancheGameDescription *_gameDescription; uint32 getFeatures() const; const char *getGameId() const; - Common::Platform getPlatform() const; - bool hasFeature(EngineFeature f) const; const char *getCopyrightString() const; - - void synchronize(Common::Serializer &sz); - virtual bool canSaveGameStateCurrently(); Common::Error saveGameState(int slot, const Common::String &desc); bool saveGame(const int16 slot, const Common::String &desc); - Common::String getSaveFileName(const int slot); - virtual bool canLoadGameStateCurrently(); Common::Error loadGameState(int slot); bool loadGame(const int16 slot); Common::String expandDate(int d, int m, int y); - - void updateEvents(); bool getEvent(Common::Event &event); // A wrapper around _eventMan->pollEvent(), so we can use it in Scrolls::normscroll() for example. Common::Point getMousePos(); @@ -140,19 +126,13 @@ class AvalancheEngine : public Engine { AvalancheConsole *_console; Common::Platform _platform; - - - // From bootstrp: enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; - static const char kRuncodes[2][3]; - static const int16 kReset = 0; - static const bool kJsb = true, kNoJsb = false, kBflight = true, kNoBflight = false; struct { @@ -162,54 +142,31 @@ class AvalancheEngine : public Engine { } _storage; Common::String _arguments, _demoArgs, _argsWithNoFilename; - bool _firstTime; - byte _originalMode; byte *_old1c; - Common::String _segofs; - bool _zoomy; - int32 _soundcard, _speed, _baseaddr, _irq, _dma; void cursorOff(); - void cursorOn(); - void quit(); - Common::String commandCom(); - void explain(byte error); - void bFlight(); - void bFlightOn(); - void bFlightOff(); - Common::String elmToStr(Elm how); - void run(Common::String what, bool withJsb, bool withBflight, Elm how); - void getArguments(); - void getSlope(); - void callMenu(); - void runAvalot(); - void runDemo(); - void dosShell(); - bool keyPressed(); - void flushBuffer(); - void demo(); }; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 231d6c9f3732..00f2edc758db 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -40,10 +40,8 @@ class Avalot { public: Avalot(AvalancheEngine *vm); - void setup(); - void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). - + void setup(); void run(Common::String arg); private: diff --git a/engines/avalanche/enhanced2.cpp b/engines/avalanche/enhanced2.cpp deleted file mode 100644 index d6187a0ece2b..000000000000 --- a/engines/avalanche/enhanced2.cpp +++ /dev/null @@ -1,64 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#include "avalanche/avalanche.h" - -#include "avalanche/enhanced2.h" - -#include "common/textconsole.h" - -namespace Avalanche { - -Enhanced::Enhanced(AvalancheEngine *vm) { - _vm = vm; -} - - -bool Enhanced::isenh() { - warning("STUB: Enhanced::isenh()"); - return true; -} - -void Enhanced::readkeye() { - warning("STUB: Enhanced::readkeye()"); -} - -bool Enhanced::keypressede() { -/* - function fancystuff:boolean; - inline( $B4/ $11/ { MOV AH,11 } - $CD/ $16/ { INT 16 } - $B8/ $00/ $00/ { MOV AX, 0000 } - $74/ $01/ { JZ 0112 (or wherever- the next byte after $40, anyway) } - $40); { INC AX } -*/ - - warning("STUB: Enhanced::keypressede()"); - return true; -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/enhanced2.h b/engines/avalanche/enhanced2.h deleted file mode 100644 index ed7f1e6fb475..000000000000 --- a/engines/avalanche/enhanced2.h +++ /dev/null @@ -1,60 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - - - -// Not sure if this unit will be used at all in the end... - -#ifndef ENHANCED2_H -#define ENHANCED2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Enhanced { -public: - byte shiftstate; /*ABSOLUTE $40:$17;*/ - bool atbios; // BIOS type - char inchar, extd; - - Enhanced(AvalancheEngine *vm); - - void readkeye(); - - bool keypressede(); -private: - AvalancheEngine *_vm; - - bool isenh(); - -}; - -} // End of namespace Avalanche - -#endif // ENHANCED2_H diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 883cf202335e..4517e6a2583f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -#include "avalanche/enhanced2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" #include "avalanche/trip6.h" @@ -61,10 +60,10 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; - if (_vm->_enhanced->atbios) + /*if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; else - _vm->_gyro->atkey = "alt-"; + _vm->_gyro->atkey = "alt-";*/ } void Lucerna::callverb(byte n) { @@ -966,25 +965,6 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { } } -void Lucerna::inkey() { - if (_vm->_gyro->demo) - return; /* Demo handles this itself. */ - - if (_vm->_gyro->mousetext == "") { - /* read keyboard */ - _vm->_enhanced->readkeye(); - if ((_vm->_enhanced->inchar == ' ') && ((_vm->_enhanced->shiftstate & 8) > 0)) { - _vm->_enhanced->inchar = '\0'; - _vm->_enhanced->extd = '#'; /* alt-spacebar = alt-H */ - } - } else { - if (_vm->_gyro->mousetext[0] == '`') - _vm->_gyro->mousetext.setChar(13,0); /* Backquote = return in a macro */ - _vm->_enhanced->inchar = _vm->_gyro->mousetext[0]; - _vm->_gyro->mousetext = Common::String(_vm->_gyro->mousetext.c_str() + 2, 253); - } -} - void Lucerna::posxy() { warning("STUB: Lucerna::posxy()"); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index db9e43191f30..f20b0d01d6de 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -72,8 +72,6 @@ class Lucerna { void mouseway(const Common::Point &cursorPos); - void inkey(); - void posxy(); void fxtoggle(); diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 96980252805a..993e1cae2f0a 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -8,7 +8,6 @@ MODULE_OBJS = \ console.o \ detection.o \ gyro2.o \ - enhanced2.o \ pingo2.o \ scrolls2.o \ visa2.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e6cbdabce84c..6ccacc005fd5 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -43,9 +43,10 @@ void Parser::init() { void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; - if (_vm->_dropdown->_activeMenuItem._activeNow) { + warning("STUB: Parser::handleInputText()"); + /*if (_vm->_dropdown->_activeMenuItem._activeNow) { _vm->_dropdown->parseKey(inChar, _vm->_enhanced->extd); - } else { + } else {*/ if (_inputText.size() < 76) { if ((inChar == '"') || (inChar == '`')) { if (_quote) @@ -60,7 +61,7 @@ void Parser::handleInputText(const Common::Event &event) { plotText(); } else _vm->_gyro->blip(); - } + //} } void Parser::handleBackspace() { diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 32ad1c908579..0df3c78f6117 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -31,7 +31,6 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" -#include "avalanche/enhanced2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" #include "avalanche/acci2.h" From c7e78ec6b75a4a5e976de60f5b92c74b0e48ea50 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 Sep 2013 21:11:15 +0200 Subject: [PATCH 0806/1332] AVALANCHE: Fix some more GCC warnings --- engines/avalanche/lucerna2.cpp | 3 +-- engines/avalanche/scrolls2.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 4517e6a2583f..f31333d9902e 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -211,7 +211,6 @@ void Lucerna::load_also(Common::String n) { } void Lucerna::load(byte n) { /* Load2, actually */ - byte bit; Common::String xx; CursorMan.showMouse(false); @@ -245,7 +244,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); _vm->_celer->loadBackgroundSprites(n); - bit = *_vm->_graphics->getPixel(0,0); + // byte bit = *_vm->_graphics->getPixel(0,0); CursorMan.showMouse(true); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 0df3c78f6117..4159a88ba6f7 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -291,9 +291,6 @@ void Scrolls::geticon(int16 x, int16 y, byte which) { void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File f; - uint16 st; - - st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); Common::String filename; filename = filename.format("%s.avd", fn.c_str()); @@ -302,7 +299,9 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { return; } - /*byte bit; +#if 0 + uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); + byte bit; for (uint16 fv = 1; fv <= yl; fv++) for (bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; @@ -311,7 +310,8 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { port[0x3cf] = bit; blockread(f, mem[0xa000 * st + (fv * 80)], xl); } - bit = getpixel(0, 0);*/ + bit = getpixel(0, 0); +#endif warning("STUB: Scrolls::block_drop()"); @@ -319,8 +319,8 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { } void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in the game. - byte b, groi; - int16 lx, ly, mx, my, ex, ey; + byte b; + int16 lx, ly, mx, my, ex; bool centre; byte icon_indent = 0; @@ -373,7 +373,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), red); ex = mx - lx; - ey = my - ly; +// int16 ey = my - ly; mx -= lx; my -= ly + 2; @@ -419,7 +419,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t dix = mx + lx; diy = my + ly; _vm->_gyro->scroll[b].setChar(' ', 0); - groi = *_vm->_graphics->getPixel(0, 0); + // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); _vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); _vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); From b52c873c5bb764b9385d46a3d77ac44a79ecee12 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 01:27:51 +0200 Subject: [PATCH 0807/1332] AVALANCHE: Fix GCC warnings --- engines/avalanche/acci2.cpp | 15 +++++---------- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 3 ++- engines/avalanche/trip6.cpp | 9 +++------ 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2123471fa3d1..6256aa9f4713 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -265,10 +265,7 @@ Common::String Acci::totalTime() { uint16 h, m, s; h = _vm->_gyro->dna.total_time / ticksInOneSec; // No. of seconds. - if (h < 0) - h = ceil((float)h); - else - h = floor((float)h); + h = floor((float)h); m = h % 3600; h = h / 3600; s = m % 60; @@ -564,18 +561,16 @@ void Acci::parse() { _vm->_gyro->subject.clear(); _vm->_gyro->subjnumber = 0; // Find subject of conversation. - byte i = 0; - while ((i < 11) && !_realWords[i].empty()) { + for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { _vm->_gyro->subjnumber = (byte)_thats[i]; _thats.setChar(kMoved, i); break; } - i++; } if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // Still not found. - for (i = 0; i < _thats.size() - 1; i++) { + for (uint16 i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); @@ -585,7 +580,7 @@ void Acci::parse() { } if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". - for (i = 0; i < _thats.size() - 1; i++) { + for (uint16 i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition _vm->_gyro->subjnumber = (byte)_thats[i + 1]; @@ -595,7 +590,7 @@ void Acci::parse() { } } - for (int8 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. + for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) _verb = (byte)_thats[i]; else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 4e4cb0a75b87..c8a27468b282 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -122,7 +122,7 @@ struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ worst_place_on_earth, spare_evening; /* Personalisation str's */ - int32 total_time; /* Your total time playing this game, in ticks.*/ + uint32 total_time; /* Your total time playing this game, in ticks.*/ byte jumpstatus; /* Fixes how high you're jumping. */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f31333d9902e..c5c8062e52a1 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1057,7 +1057,7 @@ void Lucerna::checkclick() { _vm->_gyro->newpointer(4); // fletch } - if (holdLeftMouse) + if (holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->dropsok) _vm->_dropdown->updateMenu(); @@ -1105,6 +1105,7 @@ void Lucerna::checkclick() { _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; } else if (!_vm->_gyro->dropsok) _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; + } } void Lucerna::mouse_init() { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index cd7a2195bf2e..2578ce9056fb 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1134,23 +1134,20 @@ bool Trip::overlaps_with_mouse() { } void Trip::getback() { - bool endangered; - - - endangered = false; /* Super_Off;*/ while (getset[1 - _vm->_gyro->cp].numleft > 0) { getset[1 - _vm->_gyro->cp].recall(r); - /* +#if 0 + bool endangered = false; if overlaps_with_mouse and not endangered then begin endangered:=true; blitfix; Super_Off; end; - */ +#endif //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } From 17033bdc2d1fb27e25342ad3afb69bb00750a4fc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 01:30:56 +0200 Subject: [PATCH 0808/1332] AVALANCHE: Fix uninitialized variable --- engines/avalanche/gyro2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index ae954d8e3c44..9202e826fa87 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -249,9 +249,11 @@ Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { _vm = vm; /* Needed becouse of Lucerna::load_also() */ - for (int fv = 0; fv < 31; fv++) + for (int fv = 0; fv < 31; fv++) { for (int ff = 0; ff < 2; ff++) also[fv][ff] = 0; + } + dna.total_time = 0; } Gyro::~Gyro() { From d52c41011846c363e7507c723ef81b1b0b55909a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 01:36:10 +0200 Subject: [PATCH 0809/1332] AVALANCHE: Fix systematic typo in comments --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/gyro2.cpp | 14 +++----------- engines/avalanche/trip6.cpp | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d6145819c381..c6ca485b9761 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -690,7 +690,7 @@ Common::Error AvalancheEngine::run() { _zoomy = true; // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, - // becouse zoomy's value is given there. Not sure yet what "zoomy" stands for. + // because zoomy's value is given there. Not sure yet what "zoomy" stands for. if (!_zoomy) callMenu(); /* Not run when zoomy. */ diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 9202e826fa87..e9740fce5f74 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -48,7 +48,6 @@ namespace Avalanche { const char *Gyro::vernum = "1.30"; - const char *Gyro::copyright = "1995"; @@ -185,8 +184,7 @@ const quasiped_type Gyro::quasipeds[16] = { const char Gyro::keys[] = "QWERTYUIOP[]"; -const uint16 Gyro::notes[12] = -{196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; +const uint16 Gyro::notes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; const tunetype Gyro::tune = { higher, higher, lower, same, higher, higher, lower, higher, higher, higher, @@ -222,10 +220,6 @@ byte Gyro::whereis[29] = { r__wisewomans /* The Wise Woman. */ }; - - - - const Common::String Gyro::things[numobjs] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", @@ -243,12 +237,10 @@ const Common::String Gyro::better[numobjs] = { const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; - - Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { _vm = vm; - /* Needed becouse of Lucerna::load_also() */ + /* Needed because of Lucerna::load_also() */ for (int fv = 0; fv < 31; fv++) { for (int ff = 0; ff < 2; ff++) also[fv][ff] = 0; @@ -404,7 +396,7 @@ bool Gyro::pennycheck(uint16 howmuchby) { return true; } -// There'll may be problems with calling these functions becouse of the conversion of the arrays!!! +// There'll may be problems with calling these functions because of the conversion of the arrays!!! // Keep an eye open! Common::String Gyro::getname(byte whose) { if (whose < 175) diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 2578ce9056fb..47656f2fd8d5 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -217,7 +217,7 @@ void triptype::walk() { } tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1; - // -1 is becouse the modified array indexes of magics[] compared to Pascal . + // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { switch (_tr->_vm->_gyro->magics[tc].op) { From 71af29e9794eb9bc4d597068a44e19e06d0bb28e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 01:48:16 +0200 Subject: [PATCH 0810/1332] AVALANCHE: Remove dead code reported by CppCheck --- engines/avalanche/acci2.cpp | 4 +--- engines/avalanche/avalanche.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 6256aa9f4713..28077f1d240c 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1383,9 +1383,7 @@ void Acci::doThat() { else if (isPersonHere()) _vm->_visa->talkto(_person); } - } else if (_person == kPardon) - _vm->_scrolls->display("Talk to whom?"); - else if (isPersonHere()) + } else if (isPersonHere()) _vm->_visa->talkto(_person); break; case kVerbCodeGive: diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c6ca485b9761..cd83d54424a0 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -271,13 +271,15 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim); - //for (byte groi = 0; groi < numtr; groi++) { - // if (tr[groi].quick) { - // blockwrite(f, groi, 1); - // tr[groi].savedata(f); - // } - //} - +#if 0 + for (byte groi = 0; groi < numtr; groi++) { + if (tr[groi].quick) { + blockwrite(f, groi, 1); + tr[groi].savedata(f); + } + } +#endif + byte spriteNum = 0; if (sz.isSaving()) { for (byte i = 0; i < _trip->numtr; i++) { From e5cc0fa49510880def04c30ce1f982c1c281b974 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 01:55:08 +0200 Subject: [PATCH 0811/1332] AVALANCHE: Fix more warnings reported by CppCheck --- engines/avalanche/dropdown2.cpp | 6 +++--- engines/avalanche/scrolls2.cpp | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 54727e7b8ce4..5fba99257a3c 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -494,15 +494,15 @@ void Dropdown::setupMenuObjects() { } void Dropdown::setupMenuWith() { - Common::String verb; - char vbchar; - _activeMenuItem.reset(); if (_vm->_gyro->thinkthing) { findWhatYouCanDoWithIt(); for (byte i = 0; i < _vm->_gyro->verbstr.size(); i++) { + char vbchar; + Common::String verb; + _vm->_acci->verbOpt(_vm->_gyro->verbstr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4159a88ba6f7..3ad8f50cfb58 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -223,21 +223,25 @@ void Scrolls::music_scroll() { // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. // For now we act like the player just played the right tone. - //if (they_match(played)) { +#if 0 + if (they_match(played)) { +#endif _vm->_gyro->screturn = true; _vm->_gyro->off(); state(0); _vm->_gyro->seescroll = false; _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up); + warning("STUB: Scrolls::music_scroll()"); return; - //} - warning("STUB: Scrolls::music_scroll()"); - +#if 0 + } + _vm->_gyro->screturn = false; _vm->_gyro->off(); state(0); _vm->_gyro->seescroll = false; +#endif } /* ThatsAll, so put us back to */ /*$F-*/ From dab29889477920b671f1f55085d802e72889bfe7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 02:29:09 +0200 Subject: [PATCH 0812/1332] AVALANCHE: Start replacing C-style comments by C++-style --- engines/avalanche/acci2.cpp | 30 +- engines/avalanche/avalanche.cpp | 6 +- engines/avalanche/dropdown2.cpp | 16 +- engines/avalanche/gyro2.cpp | 107 +++---- engines/avalanche/gyro2.h | 10 +- engines/avalanche/roomnums.h | 8 +- engines/avalanche/scrolls2.cpp | 60 ++-- engines/avalanche/trip6.cpp | 495 ++++++++++++++++---------------- 8 files changed, 368 insertions(+), 364 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 28077f1d240c..386ce221d790 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -409,9 +409,9 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->dna.spare_evening.empty()) _vm->_gyro->dna.spare_evening.clear(); _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; - _vm->_visa->dixi('z', 5); /* His closing statement... */ - _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ - _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ + _vm->_visa->dixi('z', 5); // His closing statement... + _vm->_trip->tr[1].walkto(4); // The end of the drawbridge + _vm->_trip->tr[1].vanishifstill = true; // Then go away! _vm->_gyro->magics[1].op = _vm->_gyro->nix; _vm->_gyro->dna.cardiff_things = 5; break; @@ -522,7 +522,7 @@ void Acci::parse() { _unknown.clear(); } // Replace words' codes that mean the same. - replace(Common::String('\xFF'), 0); /* zap noise words */ + replace(Common::String('\xFF'), 0); // zap noise words replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine" replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" @@ -668,7 +668,7 @@ void Acci::exampers() { if (_thing != _vm->_gyro->thinks) _vm->_lucerna->thinkabout(_person, _vm->_gyro->a_person); _person -= 149; - switch (_person) { /* Special cases */ + switch (_person) { // Special cases case 11: if (_vm->_gyro->dna.wonnim) { _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" @@ -768,10 +768,10 @@ void Acci::inventory() { _vm->_scrolls->display("."); } -void Acci::swallow() { /* Eat something. */ +void Acci::swallow() { // Eat something. switch (_thing) { case Gyro::wine: - switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ + switch (_vm->_gyro->dna.winestate) { // 4 is perfect case 1: if (_vm->_gyro->dna.teetotal) { _vm->_visa->dixi('D', 6); @@ -787,7 +787,7 @@ void Acci::swallow() { /* Eat something. */ case 2: case 3: _vm->_visa->dixi('d', 8); - break; /* You can't drink it! */ + break; // You can't drink it! } break; case Gyro::potion: @@ -929,7 +929,9 @@ void Acci::openDoor() { _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); break; case Gyro::transport: - _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); + _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8, // High byte + (_vm->_gyro->portals[fv].data) & 0x0F // Low byte + ); break; case Gyro::unfinished: _vm->_trip->tr[0].bounce(); @@ -1504,12 +1506,12 @@ void Acci::doThat() { case kVerbCodeBreak: _vm->_scrolls->display("Vandalism is prohibited within this game!"); break; - case kVerbCodeQuit: /* quit */ + case kVerbCodeQuit: // quit if (_vm->_gyro->demo) { warning("STUB: Acci::doThat() - case kVerbCodequit"); // _vm->_visa->dixi('pos', 31); // close(demofile); - // exit(0); /* Change this later!!! */ + // exit(0); // Change this later!!! } if (!_polite) _vm->_scrolls->display("How about a `please\", Avvy?"); @@ -1552,7 +1554,7 @@ void Acci::doThat() { _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you\?\?!"); break; case Gyro::clothes: - case Gyro::habit: { /* Change this! */ + case Gyro::habit: { // Change this! if (_vm->_gyro->dna.wearing != kNothing) { if (_vm->_gyro->dna.wearing == _thing) _vm->_scrolls->display("You're already wearing that."); @@ -1868,7 +1870,7 @@ void Acci::doThat() { _vm->_gyro->whereis[7] = 177; break; default: - _vm->_visa->dixi('Q', 10); /* Please try not to be so violent! */ + _vm->_visa->dixi('Q', 10); // Please try not to be so violent! } } else _vm->_visa->dixi('Q', 10); @@ -1962,7 +1964,7 @@ void Acci::doThat() { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index cd83d54424a0..bd5ea8b4d0e2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -587,7 +587,7 @@ void AvalancheEngine::explain(byte error) { //TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) -void AvalancheEngine::bFlight() { /*interrupt;*/ +void AvalancheEngine::bFlight() { //interrupt; _storage._skellern++; } @@ -694,14 +694,14 @@ Common::Error AvalancheEngine::run() { // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, // because zoomy's value is given there. Not sure yet what "zoomy" stands for. if (!_zoomy) - callMenu(); /* Not run when zoomy. */ + callMenu(); // Not run when zoomy. do { runAvalot(); - //if (dosexitcode != 77) quit(); /* Didn't stop for us. */ + //if (dosexitcode != 77) quit(); // Didn't stop for us. switch (_storage._operation) { case kRunShootemup: diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 5fba99257a3c..5f419d754266 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -129,10 +129,10 @@ void MenuItem::displayOption(byte y, bool highlit) { void MenuItem::display() { CursorMan.showMouse(false); - /*setactivepage(cp); - setvisualpage(cp); - setfillstyle(1, menu_b); - setcolor(menu_border);*/ + //setactivepage(cp); + //setvisualpage(cp); + //setfillstyle(1, menu_b); + //setcolor(menu_border); _firstlix = true; _flx1 = _left - 2; _flx2 = _left + _width; @@ -201,9 +201,9 @@ void MenuItem::select(byte which) { wipe(); if (_choiceNum == _optionNum) - _choiceNum--; /* Off the bottom. */ + _choiceNum--; // Off the bottom. if (_choiceNum > _optionNum) - _choiceNum = 0; /* Off the top, I suppose. */ + _choiceNum = 0; // Off the top, I suppose. (_dr->*_dr->_menuBar._menuItems[_activeNum]._chooseFunc)(); } @@ -512,7 +512,7 @@ void Dropdown::setupMenuWith() { if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) - _activeMenuItem.setupOption("Give to...", 'G', "", false); /* Not here. */ + _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeGive; @@ -529,7 +529,7 @@ void Dropdown::setupMenuWith() { } break; case Gyro::pdogfood: { - _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); /* True if you HAVEN'T won. */ + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); // True if you HAVEN'T won. _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodePlay; } break; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index e9740fce5f74..62ffca81d811 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -148,39 +148,39 @@ const char Gyro::ladchar[] = "ASCDMTRwLfgeIyPu"; const char Gyro::lasschar[] = "kGo"; const int32 Gyro::catamap[8][8] = { - /* Geida's room */ - /* 1 2 3 | 4 5 6 7 8*/ + // Geida's room + // 1 2 3 | 4 5 6 7 8 {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, - {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, /* >> Oubliette */ + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, - {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, /* <<< In here */ + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} }; -/* vv Stairs trap. */ +// vv Stairs trap. const char Gyro::spludwick_order[3] = {onion, ink, mushroom}; const quasiped_type Gyro::quasipeds[16] = { - {2, lightgray, 19, brown, pdogfood}, /* A: Dogfood (screen 19). */ - {3, green, 19, white, pibythneth}, /* B: Ibythneth (screen 19). */ - {3, white, 1, magenta, parkata}, /* C: Arkata (screen 1). */ - {3, black, 23, red, 177}, /* D: Hawk (screen 23). */ - {3, lightgreen, 50, brown, ptrader}, /* E: Trader (screen 50). */ - {6, yellow, 42, red, pavalot}, /* F: Avvy, tied up (scr.42) */ - {2, blue, 16, white, payles}, /* G: Ayles (screen 16). */ - {2, brown, 7, white, pjacques}, /* H: Jacques (screen 7). */ - {2, lightgreen, 47, green, pspurge}, /* I: Spurge (screen 47). */ - {3, yellow, 47, red, pavalot}, /* J: Avalot (screen 47). */ - {2, lightgray, 23, black, pdulustie}, /* K: du Lustie (screen 23). */ - {2, yellow, 27, red, pavalot}, /* L: Avalot (screen 27). */ - {3, white, 27, red, 177}, /* M: Avaroid (screen 27). */ - {4, lightgray, 19, darkgray, pmalagauche}, /*N: Malagauche (screen 19). */ - {5, lightmagenta, 47, red, pport}, /* O: Port (screen 47). */ - {2, lightgreen, 51, darkgray, pdrduck} -}; /*P: Duck (screen 51). */ + {2, lightgray, 19, brown, pdogfood}, // A: Dogfood (screen 19). + {3, green, 19, white, pibythneth}, // B: Ibythneth (screen 19). + {3, white, 1, magenta, parkata}, // C: Arkata (screen 1). + {3, black, 23, red, 177}, // D: Hawk (screen 23). + {3, lightgreen, 50, brown, ptrader}, // E: Trader (screen 50). + {6, yellow, 42, red, pavalot}, // F: Avvy, tied up (scr.42) + {2, blue, 16, white, payles}, // G: Ayles (screen 16). + {2, brown, 7, white, pjacques}, // H: Jacques (screen 7). + {2, lightgreen, 47, green, pspurge}, // I: Spurge (screen 47). + {3, yellow, 47, red, pavalot}, // J: Avalot (screen 47). + {2, lightgray, 23, black, pdulustie}, // K: du Lustie (screen 23). + {2, yellow, 27, red, pavalot}, // L: Avalot (screen 27). + {3, white, 27, red, 177}, // M: Avaroid (screen 27). + {4, lightgray, 19, darkgray, pmalagauche}, // N: Malagauche (screen 19). + {5, lightmagenta, 47, red, pport}, // O: Port (screen 47). + {2, lightgreen, 51, darkgray, pdrduck} // P: Duck (screen 51). +}; const char Gyro::keys[] = "QWERTYUIOP[]"; @@ -194,30 +194,30 @@ const tunetype Gyro::tune = { }; byte Gyro::whereis[29] = { - /* The Lads */ - r__yours, /* Avvy */ - r__spludwicks, /* Spludwick */ - r__outsideyours, /* Crapulus */ - r__ducks, /* Duck - r__DucksRoom's not defined yet. */ - r__argentpub, /* Malagauche */ - r__robins, /* Friar Tuck. */ - 177, /* Robin Hood - can't meet him at the start. */ - r__brummieroad, /* Cwytalot */ - r__lustiesroom, /* Baron du Lustie. */ - r__outsidecardiffcastle, /* The Duke of Cardiff. */ - r__argentpub, /* Dogfood */ - r__outsideducks, /* Trader */ - r__argentpub, /* Ibythneth */ - r__aylesoffice, /* Ayles */ - r__nottspub, /* Port */ - r__nottspub, /* Spurge */ - r__musicroom, /* Jacques */ + // The Lads + r__yours, // Avvy + r__spludwicks, // Spludwick + r__outsideyours, // Crapulus + r__ducks, // Duck - r__DucksRoom's not defined yet. + r__argentpub, // Malagauche + r__robins, // Friar Tuck. + 177, // Robin Hood - can't meet him at the start. + r__brummieroad, // Cwytalot + r__lustiesroom, // Baron du Lustie. + r__outsidecardiffcastle, // The Duke of Cardiff. + r__argentpub, // Dogfood + r__outsideducks, // Trader + r__argentpub, // Ibythneth + r__aylesoffice, // Ayles + r__nottspub, // Port + r__nottspub, // Spurge + r__musicroom, // Jacques 0, 0, 0, 0, 0, 0, 0, 0, - /* The Lasses */ - r__yours, /* Arkata */ - r__geidas, /* Geida */ - 177, /* nobody allocated here! */ - r__wisewomans /* The Wise Woman. */ + // The Lasses + r__yours, // Arkata + r__geidas, // Geida + 177, // nobody allocated here! + r__wisewomans // The Wise Woman. }; const Common::String Gyro::things[numobjs] = { @@ -226,7 +226,7 @@ const Common::String Gyro::things[numobjs] = { "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" }; -const char Gyro::thingchar[] = "WMBParCLguKeSnIohn"; /* V=Vinegar */ +const char Gyro::thingchar[] = "WMBParCLguKeSnIohn"; // V=Vinegar const Common::String Gyro::better[numobjs] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", @@ -240,7 +240,7 @@ const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { _vm = vm; - /* Needed because of Lucerna::load_also() */ + // Needed because of Lucerna::load_also() for (int fv = 0; fv < 31; fv++) { for (int ff = 0; ff < 2; ff++) also[fv][ff] = 0; @@ -316,14 +316,15 @@ void Gyro::newgame() { alive = true; score = 0; - /*for gd:=0 to 5 do which[gd]:=1;*/ + //for gd:=0 to 5 do which[gd]:=1; memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); _vm->_scrolls->natural(); _vm->_lucerna->mousepage(0); dna.spare_evening = "answer a questionnaire"; dna.like2drink = "beer"; - dna.pence = 30; /* 2/6 */ dna.rw = stopped; + dna.pence = 30; // 2/6 + dna.rw = stopped; dna.wearing = clothes; dna.obj[money - 1] = true; dna.obj[bodkin - 1] = true; @@ -338,11 +339,11 @@ void Gyro::newgame() { ppos[0][1] = -177; _vm->_trip->tr[0].appear(300,117,right); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; - /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ + // fillchar(previous^,sizeof(previous^),#0); { blank out array } him = 254; her = 254; it = 254; - last_person = 254; /* = Pardon? */ + last_person = 254; // = Pardon? dna.pass_num = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; after_the_scroll = false; dna.user_moves_avvy = false; @@ -446,7 +447,7 @@ char Gyro::get_thingchar(byte which) { switch (which) { case wine: if (dna.winestate == 3) - get_thingchar_result = 'V'; /* Vinegar */ + get_thingchar_result = 'V'; // Vinegar else get_thingchar_result = thingchar[which - 1]; break; @@ -521,7 +522,7 @@ Common::String Gyro::f5_does() { break; } - return Common::String(_vm->_acci->kPardon); /* If all else fails... */ + return Common::String(_vm->_acci->kPardon); // If all else fails... } void Gyro::load_a_mouse(byte which) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index c8a27468b282..d453c77d7f19 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -43,10 +43,10 @@ namespace Avalanche { class AvalancheEngine; -static const byte numobjs = 18; /* always preface with a # */ -static const int16 maxobjs = 12; /* carry limit */ +static const byte numobjs = 18; // always preface with a # +static const int16 maxobjs = 12; // carry limit -static const int16 numlockCode = 32; /* Code for Num Lock */ +static const int16 numlockCode = 32; // Code for Num Lock static const int16 mouse_size = 134; struct postype { @@ -54,12 +54,12 @@ struct postype { byte length; }; -struct mp { /* mouse-void **/ +struct mp { // mouse-void uint16 mask[2][16]; int16 horzhotspot, verthotspot; }; -struct dnatype { /* here goes... */ /* Ux, uy, & ww now all belong to Trip5 */ +struct dnatype { // here goes... Ux, uy, & ww now all belong to Trip5 byte rw; /* Realway- just for convenience! */ byte carrying; /* how many objects you're carrying... */ bool obj[numobjs]; /* ...and which ones they are. */ diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index a21da00a95f1..4007504f6e73 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -43,12 +43,12 @@ const byte r__argentroad = 10; const byte r__wisewomans = 11; const byte r__spludwicks = 12; const byte r__insideabbey = 13; -const byte r__outsideabbey = 14; /*{ assumed }*/ +const byte r__outsideabbey = 14; // assumed const byte r__avvysgarden = 15; const byte r__aylesoffice = 16; const byte r__argentpub = 19; const byte r__brummieroad = 20; -const byte r__bridge = 21; /*{ ? not sure }*/ +const byte r__bridge = 21; // ? not sure const byte r__lusties = 22; const byte r__lustiesroom = 23; const byte r__westhall = 25; @@ -76,11 +76,11 @@ const byte r__insidecardiffcastle = 71; //{ -------------- } -/*{ place80 appears to be bogus }*/ +// place80 appears to be bogus //{ -------------- } -const byte r__bosskey = 98; /*{ assumed }*/ +const byte r__bosskey = 98; // assumed const byte r__map = 99; } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 3ad8f50cfb58..5a893a6b3777 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -53,20 +53,20 @@ void Scrolls::init() { resetscrolldriver(); } -void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ +void Scrolls::state(byte x) { // Sets "Ready" light to whatever if (_vm->_gyro->ledstatus == x) - return; /* Already like that! */ + return; // Already like that! byte color = black; switch (x) { case 0: color = black; - break; /* Off */ + break; // Off case 1: case 2: case 3: color = green; - break; /* Hit a key */ + break; // Hit a key } warning("STUB: Scrolls::state()"); @@ -82,7 +82,7 @@ void Scrolls::easteregg() { warning("STUB: Scrolls::easteregg()"); } -void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ +void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwriting fontType itw; byte lz = z.size(); @@ -113,7 +113,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit } } -/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ +// Here are the procedures that Scroll calls. So they must be... $F+*/ void Scrolls::normscroll() { Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; @@ -149,7 +149,7 @@ void Scrolls::normscroll() { // bool oktoexit; // do { // do { -// _vm->_gyro->check(); /* was "checkclick;" */ +// _vm->_gyro->check(); // was "checkclick;" // //#ifdef RECORD slowdown(); basher::count += 1; #endif // @@ -178,7 +178,7 @@ void Scrolls::normscroll() { // //#ifdef RECORD record_one(); #endif // -// _vm->_gyro->screturn = r == '#'; /* "back door" */ +// _vm->_gyro->screturn = r == '#'; // "back door" state(0); _vm->_gyro->seescroll = false; @@ -244,20 +244,18 @@ void Scrolls::music_scroll() { #endif } -/* ThatsAll, so put us back to */ /*$F-*/ +// ThatsAll, so put us back to $F- -void Scrolls::resetscrolldriver() { /* phew */ +void Scrolls::resetscrolldriver() { // phew _vm->_gyro->scrollbells = 0; cfont = roman; use_icon = 0; - _vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */ + _vm->_gyro->interrogation = 0; // always reset after a scroll comes up. } -void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */ - byte fv; - - for (fv = 0; fv < _vm->_gyro->scrollbells; fv++) - _vm->_lucerna->errorled(); /* ring the bell "x" times */ +void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little... + for (byte fv = 0; fv < _vm->_gyro->scrollbells; fv++) + _vm->_lucerna->errorled(); // ring the bell "x" times } void Scrolls::dodgem() { @@ -330,7 +328,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t //setvisualpage(cp); //setactivepage(1 - cp); - _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ + _vm->_gyro->oncandopageswap = false; // On can now no longer swap pages. So we can do what we want without its interference! lx = 0; ly = (_vm->_gyro->scrolln) * 6; @@ -386,7 +384,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t switch (use_icon) { case 0: icon_indent = 0; - break; /* No icon. */ + break; // No icon. case 34: { block_drop("about", 28, 76, 15); icon_indent = 0; @@ -453,12 +451,12 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t //setvisualpage(cp); //mousepage(cp); CursorMan.showMouse(false); - /* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/ + // mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0); //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); //blitfix(); _vm->_gyro->oncandopageswap = true; // Normality again. CursorMan.showMouse(true); - //settextjustify(0, 0); /*sink*/ + //settextjustify(0, 0); // sink resetscrolldriver(); if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true; @@ -469,13 +467,13 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t void Scrolls::bubble(func2 gotoit) { int16 xl, yl, my, xw, yw; Common::Point p[3]; -// byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ - int16 xc; /* x correction */ +// byte *rp1, *rp2; // replace: 1=bubble, 2=pointer + int16 xc; // x correction - /*setvisualpage(cp); - setactivepage(1 - cp);*/ - _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ - //mousepage(1 - cp); /* Mousepage */ + //setvisualpage(cp); + //setactivepage(1 - cp); + _vm->_gyro->oncandopageswap = false; // On can now no longer swap pages. So we can do what we want without its interference! + //mousepage(1 - cp); // Mousepage CursorMan.showMouse(false); @@ -549,7 +547,7 @@ void Scrolls::bubble(func2 gotoit) { _vm->_gyro->dropsok = true; //setvisualpage(cp); - CursorMan.showMouse(true); /*sink;*/ + CursorMan.showMouse(true); // sink; _vm->_gyro->oncandopageswap = true; resetscrolldriver(); if (_vm->_gyro->mpress > 0) @@ -568,7 +566,7 @@ void Scrolls::resetscroll() { _vm->_gyro->scroll[j].clear(); } -void Scrolls::natural() { /* Natural state of bubbles */ +void Scrolls::natural() { // Natural state of bubbles _vm->_gyro->talkx = 320; _vm->_gyro->talky = 200; _vm->_gyro->talkb = 8; @@ -698,9 +696,9 @@ void Scrolls::calldrivers() { } else _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. else if ((10 <= param) && (param <= 36)) { - /* Quasi-peds. (This routine performs the same - thing with QPs as triptype.chatter does with the - sprites.) */ + // Quasi-peds. (This routine performs the same + // thing with QPs as triptype.chatter does with the + // sprites.) _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].x; _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 47656f2fd8d5..ed8cd1332447 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -43,11 +43,7 @@ #include "common/textconsole.h" #include "common/file.h" -/*#include "Dropdown.h"*/ - - namespace Avalanche { - void triptype::init(byte spritenum, bool do_check, Trip *tr) { _tr = tr; @@ -58,7 +54,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { Common::File inf; if (spritenum == 177) - return; /* Already running! */ + return; // Already running! Common::String filename; filename = filename.format("sprite%d.avd", spritenum); @@ -120,7 +116,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { } totalnum++; - /* on; */ + // on; x = 0; y = 0; quick = true; @@ -128,7 +124,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { xs = 3; ys = 1; if (spritenum == 1) - _tr->newspeed(); /* Just for the lights. */ + _tr->newspeed(); // Just for the lights. homing = false; ix = 0; @@ -296,7 +292,7 @@ void triptype::homestep() { int16 temp; if ((hx == x) && (hy == y)) { - /* touching the target */ + // touching the target stopwalk(); return; } @@ -326,9 +322,9 @@ void triptype::speed(int8 xx, int8 yy) { ix = xx; iy = yy; if ((ix == 0) && (iy == 0)) - return; /* no movement */ + return; // no movement if (ix == 0) { - /* No horz movement */ + // No horz movement if (iy < 0) turn(_tr->up); else @@ -419,7 +415,7 @@ void triptype::load_data_from_mem(uint16 &where) { triptype *triptype::done() { Common::String xx; - /* nds:=num div seq;*/ + // nds:=num div seq; totalnum--; _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) @@ -436,7 +432,7 @@ triptype *triptype::done() { } getsettype *getsettype::init() { - numleft = 0; /* initialize array pointer */ + numleft = 0; // initialize array pointer return this; } @@ -476,7 +472,7 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { byte a, c; int16 fv, ff; - /* if not alive then begin checkfeet:=0; exit; end;*/ + // if not alive then begin checkfeet:=0; exit; end; a = 0; //setactivepage(2); @@ -529,8 +525,8 @@ void Trip::catamove(byte ped) { uint16 xy_uint16; byte fv; - /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the - catacombs has a different number for it. */ + // XY_uint16 is cat_x+cat_y*256. Thus, every room in the + // catacombs has a different number for it. @@ -538,11 +534,11 @@ void Trip::catamove(byte ped) { _vm->_gyro->dna.geida_spin = 0; switch (xy_uint16) { - case 1801: /* Exit catacombs */ + case 1801: // Exit catacombs fliproom(r__lustiesroom, 4); _vm->_scrolls->display("Phew! Nice to be out of there!"); return; - case 1033: /* Oubliette */ + case 1033: // Oubliette fliproom(r__oubliette, 1); _vm->_scrolls->display(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); return; @@ -562,128 +558,128 @@ void Trip::catamove(byte ped) { _vm->_lucerna->load(29); here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1]; - switch (here & 0xf) { /* West. */ - case 0: /* no connection (wall) */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ + switch (here & 0xf) { // West. + case 0: // no connection (wall) + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; - case 0x1: /* no connection (wall + shield), */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ + case 0x1: // no connection (wall + shield), + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; - case 0x2: /* wall with door */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door. */ + case 0x2: // wall with door + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. break; - case 0x3: /* wall with door and shield */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ + case 0x3: // wall with door and shield + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; - case 0x4: /* no connection (wall + window), */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ + case 0x4: // no connection (wall + window), + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; - case 0x5: /* wall with door and window */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ + case 0x5: // wall with door and window + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; - case 0x6: /* no connection (wall + torches), */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ + case 0x6: // no connection (wall + torches), + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->nix; // No door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; - case 0x7: /* wall with door and torches */ - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ + case 0x7: // wall with door and torches + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; - case 0xf: /* straight-through corridor. */ - _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Sloping wall. */ - _vm->_gyro->magics[2].op = _vm->_gyro->special; /* Straight wall. */ + case 0xf: // straight-through corridor. + _vm->_gyro->magics[1].op = _vm->_gyro->nix; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->special; // Straight wall. break; } /* ---- */ - switch ((here & 0xf0) >> 4) { /* East */ - case 0: /* no connection (wall) */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ + switch ((here & 0xf0) >> 4) { // East + case 0: // no connection (wall) + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; - case 0x1: /* no connection (wall + window), */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...window. */ + case 0x1: // no connection (wall + window), + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. break; - case 0x2: /* wall with door */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door. */ + case 0x2: // wall with door + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. break; - case 0x3: /* wall with door and window */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...door, and... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...window. */ + case 0x3: // wall with door and window + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. break; - case 0x6: /* no connection (wall + torches), */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ + case 0x6: // no connection (wall + torches), + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->nix; // No door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; - case 0x7: /* wall with door and torches */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door, and... */ - _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ + case 0x7: // wall with door and torches + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; - case 0xf: /* straight-through corridor. */ - _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Sloping wall. */ - _vm->_gyro->magics[5].op = _vm->_gyro->special; /* Straight wall. */ - _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ + case 0xf: // straight-through corridor. + _vm->_gyro->magics[4].op = _vm->_gyro->nix; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->special; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. break; } /* ---- */ - switch ((here & 0xf00) >> 8) { /* South */ - case 0: /* No connection. */ + switch ((here & 0xf00) >> 8) { // South + case 0: // No connection. _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; @@ -694,44 +690,45 @@ void Trip::catamove(byte ped) { if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; else - _vm->_gyro->magics[12].op = _vm->_gyro->special; /* Right exit south. */ + _vm->_gyro->magics[12].op = _vm->_gyro->special; // Right exit south. _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[11].op = _vm->_gyro->bounces; break; case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Middle exit south. */ + _vm->_gyro->magics[6].op = _vm->_gyro->special; // Middle exit south. _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x3: _vm->_celer->drawBackgroundSprite(-1, -1, 24); - _vm->_gyro->magics[11].op = _vm->_gyro->special; /* Left exit south. */ + _vm->_gyro->magics[11].op = _vm->_gyro->special; // Left exit south. _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; } - switch ((here & 0xf000) >> 12) { /* North */ - case 0: /* No connection */ + switch ((here & 0xf000) >> 12) { // North + case 0: // No connection _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. break; // LEFT handles: -/* +#if 0 case 0x1: _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; -*/ +#endif case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; -/* case 0x3: +#if 0 + case 0x3: _vm->_celer->show_one(-1, -1, 4); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } @@ -742,19 +739,19 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; -*/ +#endif case 0x5: _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; /* Middle exit north. */ - _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. + _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; -/* +#if 0 case 0x6: _vm->_celer->show_one(-1, -1, 3); _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } break; -*/ +#endif // ARCHWAYS: case 0x7: case 0x8: @@ -766,41 +763,41 @@ void Trip::catamove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer->drawBackgroundSprite(-1, -1, 32); - _vm->_gyro->magics[0].op = _vm->_gyro->special; /* Middle arch north. */ - _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->magics[0].op = _vm->_gyro->special; // Middle arch north. + _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. } break; - /* DECORATIONS: */ - case 0xd: /* No connection + WINDOW */ + // DECORATIONS: + case 0xd: // No connection + WINDOW _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; - case 0xe: /* No connection + TORCH */ + case 0xe: // No connection + TORCH _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ + _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; - /* Recessed door: */ + // Recessed door: case 0xf: - _vm->_gyro->magics[0].op = _vm->_gyro->nix; /* Door to Geida's room. */ + _vm->_gyro->magics[0].op = _vm->_gyro->nix; // Door to Geida's room. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ + _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; } switch (xy_uint16) { case 514: _vm->_celer->drawBackgroundSprite(-1, -1, 17); - break; /* [2,2] : "Art Gallery" sign over door. */ + break; // [2,2] : "Art Gallery" sign over door. case 264: _vm->_celer->drawBackgroundSprite(-1, -1, 9); - break; /* [8,1] : "The Wrong Way!" sign. */ + break; // [8,1] : "The Wrong Way!" sign. case 1797: _vm->_celer->drawBackgroundSprite(-1, -1, 2); - break; /* [5,7] : "Ite Mingite" sign. */ + break; // [5,7] : "Ite Mingite" sign. case 258: - for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ + for (fv = 0; fv <= 2; fv++) { // [2,1] : Art gallery - pictures _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); } @@ -808,22 +805,22 @@ void Trip::catamove(byte ped) { case 1287: for (fv = 10; fv <= 13; fv++) _vm->_celer->drawBackgroundSprite(-1, -1, fv); - break; /* [7,5] : 4 candles. */ + break; // [7,5] : 4 candles. case 776: _vm->_celer->drawBackgroundSprite(-1, -1, 10); - break; /* [8,3] : 1 candle. */ + break; // [8,3] : 1 candle. case 2049: _vm->_celer->drawBackgroundSprite(-1, -1, 11); - break; /* [1,8] : another candle. */ + break; // [1,8] : another candle. case 257: _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_celer->drawBackgroundSprite(-1, -1, 13); - break; /* [1,1] : the other two. */ + break; // [1,1] : the other two. } if ((_vm->_gyro->dna.geida_follows) && (ped > 0)) { - if (!tr[1].quick) /* If we don't already have her... */ - tr[1].init(5, true, this); /* ...Load Geida. */ + if (!tr[1].quick) // If we don't already have her... + tr[1].init(5, true, this); // ...Load Geida. apped(2, geida_ped(ped)); tr[1].call_eachstep = true; tr[1].eachstep = procgeida_procs; @@ -832,14 +829,14 @@ void Trip::catamove(byte ped) { -/* This proc gets called whenever you touch a line defined as _vm->_gyro->special. */ +// This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Trip::dawndelay() { _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); } void Trip::call_special(uint16 which) { switch (which) { - case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ + case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[9].op = _vm->_gyro->nix; @@ -847,94 +844,95 @@ void Trip::call_special(uint16 which) { stopwalking(); _vm->_gyro->dna.user_moves_avvy = false; break; - case 2: /* _vm->_gyro->special 2: Room 22: bottom of stairs. */ + case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. _vm->_gyro->dna.brummie_stairs = 3; _vm->_gyro->magics[10].op = _vm->_gyro->nix; _vm->_gyro->magics[11].op = _vm->_gyro->exclaim; _vm->_gyro->magics[11].data = 5; - _vm->_gyro->magics[3].op = _vm->_gyro->bounces; /* Now works as planned! */ + _vm->_gyro->magics[3].op = _vm->_gyro->bounces; // Now works as planned! stopwalking(); _vm->_visa->dixi('q', 26); _vm->_gyro->dna.user_moves_avvy = true; break; - case 3: /* _vm->_gyro->special 3: Room 71: triggers dart. */ - tr[0].bounce(); /* Must include that. */ + case 3: // _vm->_gyro->special 3: Room 71: triggers dart. + tr[0].bounce(); // Must include that. if (!_vm->_gyro->dna.arrow_triggered) { _vm->_gyro->dna.arrow_triggered = true; - apped(2, 4); /* The dart starts at ped 4, and... */ - tr[1].walkto(5); /* flies to ped 5. */ - tr[1].face = 0; /* Only face. */ - /* Should call some kind of Eachstep procedure which will deallocate - the sprite when it hits the wall, and replace it with the chunk - graphic of the arrow buried in the plaster. */ - /* OK! */ + apped(2, 4); // The dart starts at ped 4, and... + tr[1].walkto(5); // flies to ped 5. + tr[1].face = 0; // Only face. + // Should call some kind of Eachstep procedure which will deallocate + // the sprite when it hits the wall, and replace it with the chunk + // graphic of the arrow buried in the plaster. */ + + // OK! tr[1].call_eachstep = true; tr[1].eachstep = procarrow_procs; } break; - case 4: /* This is the ghost room link. */ + case 4: // This is the ghost room link. _vm->_lucerna->dusk(); - tr[0].turn(right); /* you'll see this after we get back from bootstrap */ + tr[0].turn(right); // you'll see this after we get back from bootstrap _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_enid->back_to_bootstrap(3); break; case 5: if (_vm->_gyro->dna.friar_will_tie_you_up) { - /* _vm->_gyro->special 5: Room 42: touched tree, and get tied up. */ - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Boundary effect is now working again. */ + // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. + _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Boundary effect is now working again. _vm->_visa->dixi('q', 35); tr[0].done(); - /*tr[1].vanishifstill:=true;*/ + //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; tr[1].walkto(3); tr[1].vanishifstill = true; - tr[1].check_me = true; /* One of them must have Check_Me switched on. */ - _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 177; /* Not here, then. */ + tr[1].check_me = true; // One of them must have Check_Me switched on. + _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 177; // Not here, then. _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; - case 6: /* _vm->_gyro->special 6: fall down oubliette. */ + case 6: // _vm->_gyro->special 6: fall down oubliette. _vm->_gyro->dna.user_moves_avvy = false; tr[0].ix = 3; tr[0].iy = 0; tr[0].face = right; _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; - case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ + case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0].visible = false; _vm->_gyro->magics[9].op = _vm->_gyro->nix; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); - /*_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); - _vm->_lucerna->mblit(12, 80, 38, 160, 3, 1);*/ + //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); + //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; - case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ + case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { _vm->_visa->dixi('q', 63); tr[1].turn(down); tr[1].stopwalk(); - tr[1].call_eachstep = false; /* Geida */ + tr[1].call_eachstep = false; // Geida _vm->_lucerna->gameover(); } break; - case 9: /* _vm->_gyro->special 9: lose Geida to Robin Hood... */ + case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... if (!_vm->_gyro->dna.geida_follows) - return; /* DOESN'T COUNT: no Geida. */ - tr[1].call_eachstep = false; /* She no longer follows Avvy around. */ - tr[1].walkto(4); /* She walks to somewhere... */ - tr[0].done(); /* Lose Avvy. */ + return; // DOESN'T COUNT: no Geida. + tr[1].call_eachstep = false; // She no longer follows Avvy around. + tr[1].walkto(4); // She walks to somewhere... + tr[0].done(); // Lose Avvy. _vm->_gyro->dna.user_moves_avvy = false; _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); break; - case 10: /* _vm->_gyro->special 10: transfer north in catacombs. */ + case 10: // _vm->_gyro->special 10: transfer north in catacombs. if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { - /* Into Geida's room. */ + // Into Geida's room. if (_vm->_gyro->dna.obj[_vm->_gyro->key - 1]) _vm->_visa->dixi('q', 62); else { @@ -961,7 +959,7 @@ void Trip::call_special(uint16 which) { getback(); dawndelay(); break; - case 11: /* _vm->_gyro->special 11: transfer east in catacombs. */ + case 11: // _vm->_gyro->special 11: transfer east in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_x++; catamove(1); @@ -972,7 +970,7 @@ void Trip::call_special(uint16 which) { getback(); dawndelay(); break; - case 12: /* _vm->_gyro->special 12: transfer south in catacombs. */ + case 12: // _vm->_gyro->special 12: transfer south in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_y += 1; catamove(2); @@ -983,7 +981,7 @@ void Trip::call_special(uint16 which) { getback(); dawndelay(); break; - case 13: /* _vm->_gyro->special 13: transfer west in catacombs. */ + case 13: // _vm->_gyro->special 13: transfer west in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->dna.cat_x--; catamove(3); @@ -1000,9 +998,9 @@ void Trip::call_special(uint16 which) { void Trip::open_the_door(byte whither, byte ped, byte magicnum) { -/* This slides the door open. (The data really ought to be saved in - the Also file, and will be next time. However, for now, they're - here.) */ +// This slides the door open. (The data really ought to be saved in +// the Also file, and will be next time. However, for now, they're +// here.) switch (_vm->_gyro->dna.room) { case r__outsideyours: case r__outsidenottspub: @@ -1038,7 +1036,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { return; } else { apped(1, 6); - tr[0].face = right; /* added by TT 12/3/1995 */ + tr[0].face = right; // added by TT 12/3/1995 _vm->_sequence->first_show(8); _vm->_sequence->then_show(9); } @@ -1120,12 +1118,14 @@ void Trip::apped(byte trn, byte np) { -/* function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; +#if 0 + function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; begin { By De Morgan's law: } overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); - end;*/ -/* x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. - x3,y3 = mx,my. x4,y4 = mx+16,my+16. */ + end; +#endif + //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. + //x3,y3 = mx,my. x4,y4 = mx+16,my+16. bool Trip::overlaps_with_mouse() { bool overlaps_with_mouse_result; overlaps_with_mouse_result = @@ -1134,7 +1134,7 @@ bool Trip::overlaps_with_mouse() { } void Trip::getback() { - /* Super_Off;*/ + // Super_Off; while (getset[1 - _vm->_gyro->cp].numleft > 0) { getset[1 - _vm->_gyro->cp].recall(r); @@ -1151,13 +1151,14 @@ void Trip::getback() { //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } - /* + +#if 0 if endangered then Super_On; - */ +#endif } -/* Eachstep procedures: */ +// Eachstep procedures: void Trip::follow_avvy_y(byte tripnum) { if (tr[0].face == left) return; @@ -1199,43 +1200,45 @@ void Trip::face_avvy(byte tripnum) { void Trip::arrow_procs(byte tripnum) { if (tr[tripnum].homing) { - /* Arrow is still in flight. */ - /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. - This is so if: a) the bottom of the arrow is below Avvy's head, - b) the left of the arrow is left of the right of Avvy's head, and - c) the right of the arrow is right of the left of Avvy's head. */ - if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[0].y) /* A */ - && (tr[tripnum].x <= (tr[0].x + tr[0]._info.xl)) /* B */ - && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[0].x)) { /* C */ - /* OK, it's hit him... what now? */ - - tr[1].call_eachstep = false; /* prevent recursion. */ - _vm->_visa->dixi('Q', 47); /* Complaint! */ - tr[tripnum].done(); /* Deallocate the arrow. */ - /* tr[1].done; { Deallocate normal pic of Avvy. } - - off; - for byte fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - on;*/ + // Arrow is still in flight. + // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. + // This is so if: a) the bottom of the arrow is below Avvy's head, + // b) the left of the arrow is left of the right of Avvy's head, and + // c) the right of the arrow is right of the left of Avvy's head. + if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[0].y) // A + && (tr[tripnum].x <= (tr[0].x + tr[0]._info.xl)) // B + && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[0].x)) { // C + // OK, it's hit him... what now? + + tr[1].call_eachstep = false; // prevent recursion. + _vm->_visa->dixi('Q', 47); // Complaint! + tr[tripnum].done(); // Deallocate the arrow. +#if 0 + tr[1].done; { Deallocate normal pic of Avvy. } + off; + for byte fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on; +#endif _vm->_lucerna->gameover(); - _vm->_gyro->dna.user_moves_avvy = false; /* Stop the user from moving him. */ + _vm->_gyro->dna.user_moves_avvy = false; // Stop the user from moving him. _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); } - } else { /* Arrow has hit the wall! */ - tr[tripnum].done(); /* Deallocate the arrow. */ - _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Show pic of arrow stuck into the door. */ - _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ + } else { // Arrow has hit the wall! + tr[tripnum].done(); // Deallocate the arrow. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. + _vm->_gyro->dna.arrow_in_the_door = true; // So that we can pick it up. } } -/*procedure Spludwick_procs(tripnum:byte); +#if 0 +procedure Spludwick_procs(tripnum:byte); var fv:byte; begin with tr[tripnum] do @@ -1247,18 +1250,19 @@ begin if DogfoodPos=8 then DogfoodPos:=1; walkto(DogfoodPos); end; -end;*/ +end; +#endif -void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ +void Trip::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 tox = tr[0].x + 17; int16 toy = tr[0].y - 1; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = left; tr[tripnum].stopwalk(); - /* ... whatever ... */ + // ... whatever ... } else { - /* Still some way to go. */ + // Still some way to go. if (tr[tripnum].x < tox) { tr[tripnum].x += 5; if (tr[tripnum].x > tox) @@ -1285,14 +1289,14 @@ void Trip::spin(byte whichway, byte &tripnum) { if (tr[tripnum].face != whichway) { tr[tripnum].face = whichway; if (tr[tripnum].whichsprite == 2) - return; /* Not for Spludwick */ + return; // Not for Spludwick _vm->_gyro->dna.geida_spin += 1; _vm->_gyro->dna.geida_time = 20; if (_vm->_gyro->dna.geida_spin == 5) { _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_gyro->dna.geida_spin = 0; - _vm->_gyro->dna.geida_time = 0; /* knock out records */ + _vm->_gyro->dna.geida_time = 0; // knock out records } } } @@ -1305,14 +1309,14 @@ void Trip::geida_procs(byte tripnum) { } if (tr[tripnum].y < (tr[0].y - 2)) { - /* Geida is further from the screen than Avvy. */ + // Geida is further from the screen than Avvy. spin(down, tripnum); tr[tripnum].iy = 1; tr[tripnum].ix = 0; take_a_step(tripnum); return; } else if (tr[tripnum].y > (tr[0].y + 2)) { - /* Avvy is further from the screen than Geida. */ + // Avvy is further from the screen than Geida. spin(up, tripnum); tr[tripnum].iy = -1; tr[tripnum].ix = 0; @@ -1335,7 +1339,7 @@ void Trip::geida_procs(byte tripnum) { tr[tripnum].ix = 0; } -/* That's all... */ +// That's all... void Trip::call_andexors() { int8 order[5]; @@ -1355,7 +1359,7 @@ void Trip::call_andexors() { for (fv = 0; fv < 4; fv++) { if (((order[fv] != -1) && (order[fv + 1] != -1)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { - /* Swap them! */ + // Swap them! temp = order[fv]; order[fv] = order[fv + 1]; order[fv + 1] = temp; @@ -1400,7 +1404,7 @@ void Trip::trippancy_link() { case procarrow_procs : arrow_procs(fv); break; - /* PROCSpludwick_procs : spludwick_procs(fv);*/ + // PROCSpludwick_procs : spludwick_procs(fv); case procgrab_avvy : grab_avvy(fv); break; @@ -1420,14 +1424,13 @@ void Trip::trippancy_link() { void Trip::get_back_loretta() { byte fv; - /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick) { getback(); return; } } - /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ + // for fv:=0 to 1 do begin cp:=1-cp; getback; end; } void Trip::stopwalking() { @@ -1457,7 +1460,7 @@ void Trip::hide_in_the_cupboard() { else { tr[0].visible = true; _vm->_gyro->dna.user_moves_avvy = true; - apped(1, 3); /* Walk out of the cupboard. */ + apped(1, 3); // Walk out of the cupboard. _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->dna.avvys_in_the_cupboard = false; _vm->_sequence->first_show(8); @@ -1465,7 +1468,7 @@ void Trip::hide_in_the_cupboard() { _vm->_sequence->start_to_close(); } } else { - /* Not hiding in the cupboard */ + // Not hiding in the cupboard tr[0].visible = false; _vm->_gyro->dna.user_moves_avvy = false; _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph @@ -1489,9 +1492,9 @@ void Trip::fliproom(byte room, byte ped) { byte fv; if (!_vm->_gyro->alive) { - /* You can't leave the room if you're dead. */ + // You can't leave the room if you're dead. tr[0].ix = 0; - tr[0].iy = 0; /* Stop him from moving. */ + tr[0].iy = 0; // Stop him from moving. return; } @@ -1501,7 +1504,7 @@ void Trip::fliproom(byte room, byte ped) { } if ((_vm->_gyro->dna.jumpstatus > 0) && (_vm->_gyro->dna.room == r__insidecardiffcastle)) { - /* You can't *jump* out of Cardiff Castle! */ + // You can't *jump* out of Cardiff Castle! tr[0].ix = 0; return; } @@ -1518,7 +1521,7 @@ void Trip::fliproom(byte room, byte ped) { for (fv = 1; fv < numtr; fv++) { if (tr[fv].quick) tr[fv].done(); - } /* Deallocate sprite */ + } // Deallocate sprite if (_vm->_gyro->dna.room == r__lustiesroom) _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; @@ -1536,8 +1539,8 @@ void Trip::fliproom(byte room, byte ped) { } _vm->_lucerna->dawn(); - /* Tidy up after mouse. I know it's a kludge... */ - /* tidy_after_mouse;*/ + // Tidy up after mouse. I know it's a kludge... + // tidy_after_mouse; } bool Trip::infield(byte which) { @@ -1552,7 +1555,7 @@ bool Trip::infield(byte which) { bool Trip::neardoor() { if (_vm->_gyro->numfields < 8) { - /* there ARE no doors here! */ + // there ARE no doors here! return false; } @@ -1566,7 +1569,7 @@ bool Trip::neardoor() { return nd; } -void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */ +void Trip::new_game_for_trippancy() { // Called by gyro.newgame tr[0].visible = false; } From b690c9ad31730d63cc121e38d3496c2a5f0c34d4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 07:47:40 +0200 Subject: [PATCH 0813/1332] AVALANCHE: Finish replacing C-style comments by C++-style --- engines/avalanche/avalot.cpp | 21 +- engines/avalanche/celer2.h | 2 +- engines/avalanche/enid2.cpp | 38 ++-- engines/avalanche/enid2.h | 2 +- engines/avalanche/graphics.cpp | 4 +- engines/avalanche/graphics.h | 8 +- engines/avalanche/gyro2.h | 326 ++++++++++++++++---------------- engines/avalanche/lucerna2.cpp | 200 +++++++++++--------- engines/avalanche/lucerna2.h | 6 +- engines/avalanche/parser.cpp | 8 +- engines/avalanche/pingo2.cpp | 26 ++- engines/avalanche/scrolls2.h | 8 +- engines/avalanche/sequence2.cpp | 18 +- engines/avalanche/timeout2.cpp | 34 ++-- engines/avalanche/timeout2.h | 8 +- engines/avalanche/trip6.h | 68 +++---- engines/avalanche/visa2.cpp | 6 +- 17 files changed, 408 insertions(+), 375 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 32486292682c..b1b5fe880b35 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -44,8 +44,6 @@ #include "avalanche/visa2.h" #include "avalanche/closing2.h" -/*#include "Incline.h"*/ - #include "common/str.h" #include "common/textconsole.h" #include "common/config-manager.h" @@ -140,7 +138,7 @@ void Avalot::setup() { _vm->_gyro->holdthedawn = true; _vm->_lucerna->dusk(); _vm->_gyro->cmp = 177; - _vm->_lucerna->mouse_init(); /*on;*/ + _vm->_lucerna->mouse_init(); // on; _vm->_gyro->dropsok = true; _vm->_gyro->ctrl = ckey; _vm->_gyro->oldjw = 177; @@ -154,7 +152,7 @@ void Avalot::setup() { _vm->_parser->_quote = true; _vm->_gyro->ledstatus = 177; _vm->_gyro->defaultled = 2; - /* TSkellern:=0; { Replace with a more local variable sometime }*/ + // TSkellern = 0; Replace with a more local variable sometime _vm->_gyro->dna.rw = _vm->_gyro->stopped; _vm->_gyro->enid_filename = ""; // Undefined. _vm->_lucerna->toolbar(); @@ -214,16 +212,17 @@ void Avalot::run(Common::String arg) { +#ifdef DEBUG // ONLY FOR TESTING!!! - /*for (byte i = 0; i < _vm->_gyro->lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + for (byte i = 0; i < _vm->_gyro->lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); for (byte i = 0; i < _vm->_gyro->numfields; i++) { - if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); - }*/ - // ONYL FOR TESTING!!! - + if (_vm->_gyro->fields[i].x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + } + // ONLY FOR TESTING!!! +#endif _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index fe38ebe91708..a4cd0eb675db 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -71,7 +71,7 @@ class Celer { SpriteType _sprites[40]; bytefield _r; Common::String _filename; - static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ + static const int16 kOnDisk; // Value of memos[fv].x when it's not in memory. void drawSprite(int16 x, int16 y, const SpriteType &sprite); }; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 7a257d04f5cf..4477fe733208 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -54,14 +54,14 @@ const char Enid::tab = '\t'; const char Enid::eof_ = '\n'; const Common::String Enid::ednafirst = - Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + /*64*/ - crlf + eof_ + crlf + crlf + /*7*/ - tab + "Glory to God in the highest," + crlf + /*31*/ - tab + "and on earth peace, goodwill toward men." + /*42*/ - crlf + tab + tab + tab + tab + /*6*/ - "Luke 2:14." + /*10*/ - crlf + crlf + crlf + /* 6 */ - "1234567890" +crlf; /*11*/ + Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + // 64 + crlf + eof_ + crlf + crlf + // 7 + tab + "Glory to God in the highest," + crlf + // 31 + tab + "and on earth peace, goodwill toward men." + // 42 + crlf + tab + tab + tab + tab + // 6 + "Luke 2:14." + // 10 + crlf + crlf + crlf + // 6 + "1234567890" +crlf; // 11 const Common::String Enid::ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); @@ -165,17 +165,19 @@ void Enid::showheader() { _vm->_scrolls->display(Common::String("Dir: ") + path + "\r\r\4"); } -void Enid::dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */ +void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! warning("STUB: Enid::dir()"); } -void Enid::avvy_background() { /* Not really a filing procedure, - but it's only called just before edna_load, so I thought I'd put it - in Enid instead of, say, Lucerna. */ +void Enid::avvy_background() { + // Not really a filing procedure, + // but it's only called just before edna_load, so I thought I'd put it + // in Enid instead of, say, Lucerna. - /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/ - /* - asm +#if 0 + port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. } + + asm mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } mov dx,$3ce; mov al,4; out dx,al; { register. } mov dx,$3c5; mov al,1; out dx,al; @@ -246,7 +248,7 @@ void Enid::avvy_background() { /* Not really a filing procedure, @the_end: end; - */ +#endif } void Enid::to_sundry(sundry &sund) { @@ -274,8 +276,8 @@ void Enid::edna_reload() { restore_dna(); - _vm->_gyro->seescroll = true; /* This prevents display of the new sprites before the - new picture is loaded. */ + _vm->_gyro->seescroll = true; // This prevents display of the new sprites before the + // new picture is loaded. _vm->_lucerna->major_redraw(); diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 6fac687ac0e6..2237d352afa2 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -44,7 +44,7 @@ class Enid { void edna_load(Common::String name); - void edna_reload(); /* From Bootstrap's storage. */ + void edna_reload(); // From Bootstrap's storage. void dir(Common::String where); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 35ccd5ff2ec1..92bffc29764b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -97,13 +97,13 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - /* First we make the pixels of the spirte blank. */ + // First we make the pixels of the spirte blank. for (byte j = 0; j < sprite.yl; j++) for (byte i = 0; i < sprite.xl; i++) if (((*sprite.sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *getPixel(x + i, y + j) = 0; - /* Then we draw the picture to the blank places. */ + // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. for (byte j = 0; j < sprite.yl; j++) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 7f27186bac09..4c812fb7de57 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -41,17 +41,17 @@ typedef byte fontType[256][16]; // raw font type typedef byte manitype[2049]; // manitype = array[5..2053] of byte; // Be aware!!! -typedef byte siltype[51][11]; /* 35, 4 */ +typedef byte siltype[51][11]; // 35, 4 class SpriteInfo { public: - byte xw; /* x-width in bytes */ - byte xl, yl; /* x & y lengths of pictures */ + byte xw; // x-width in bytes + byte xl, yl; // x & y lengths of pictures manitype *mani[24]; siltype *sil[24]; - uint16 size; /* the size of one picture */ + uint16 size; // the size of one picture }; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index d453c77d7f19..d70072777e43 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -60,108 +60,108 @@ struct mp { // mouse-void }; struct dnatype { // here goes... Ux, uy, & ww now all belong to Trip5 - byte rw; /* Realway- just for convenience! */ - byte carrying; /* how many objects you're carrying... */ - bool obj[numobjs]; /* ...and which ones they are. */ - int16 score; /* your score, of course */ - int32 pence; /* your current amount of dosh */ - byte room; /* your current room */ - byte wearing; /* what you're wearing */ - byte swore; /* number of times you've sworn */ - byte saves; /* number of times this game has been saved */ - byte rooms[100]; /* Add one to each every time you enter a room */ - byte alcohol; /* Your blood alcohol level. */ - byte playednim; /* How many times you've played Nim. */ - bool wonnim; /* Have you *won* Nim? (That's harder.) */ - byte winestate; /* 0=good (Notts), 1=passable(Argent) ... 3=vinegar.*/ - bool cwytalot_gone; /* Has Cwytalot rushed off to Jerusalem yet?*/ + byte rw; // Realway- just for convenience! + byte carrying; // how many objects you're carrying... + bool obj[numobjs]; // ...and which ones they are. + int16 score; // your score, of course + int32 pence; // your current amount of dosh + byte room; // your current room + byte wearing; // what you're wearing + byte swore; // number of times you've sworn + byte saves; // number of times this game has been saved + byte rooms[100]; // Add one to each every time you enter a room + byte alcohol; // Your blood alcohol level. + byte playednim; // How many times you've played Nim. + bool wonnim; // Have you *won* Nim? (That's harder.) + byte winestate; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool cwytalot_gone; // Has Cwytalot rushed off to Jerusalem yet? - byte pass_num; /* Number of the passw for this game. */ - bool ayles_is_awake; /* pretty obvious! */ - byte drawbridge_open; /* Between 0 (shut) and 4 (open). */ - byte avaricius_talk; /* How much Avaricius has said to you. */ - bool bought_onion; /* Have you bought an onion yet? */ - bool rotten_onion; /* And has it rotted? */ - bool onion_in_vinegar; /* Is the onion in the vinegar? */ + byte pass_num; // Number of the passw for this game. + bool ayles_is_awake; // pretty obvious! + byte drawbridge_open; // Between 0 (shut) and 4 (open). + byte avaricius_talk; // How much Avaricius has said to you. + bool bought_onion; // Have you bought an onion yet? + bool rotten_onion; // And has it rotted? + bool onion_in_vinegar; // Is the onion in the vinegar? - byte given2spludwick; /* 0 = nothing given, 1 = onion... */ - byte brummie_stairs; /* Progression through the stairs trick. */ - byte cardiff_things; /* Things you get asked in Cardiff. */ + byte given2spludwick; // 0 = nothing given, 1 = onion... + byte brummie_stairs; // Progression through the stairs trick. + byte cardiff_things; // Things you get asked in Cardiff. - bool cwytalot_in_herts; /* Have you passed Cwytalot in Herts?*/ + bool cwytalot_in_herts; // Have you passed Cwytalot in Herts? - bool avvy_is_awake; /* Well? Is Avvy awake? (Screen 1 only.) */ - bool avvy_in_bed; /* True if Avvy's in bed, but awake. */ + bool avvy_is_awake; // Well? Is Avvy awake? (Screen 1 only.) + bool avvy_in_bed; // True if Avvy's in bed, but awake. - bool user_moves_avvy; /* If this is false, the user has no - control over Avvy's movements. */ + bool user_moves_avvy; // If this is false, the user has no + // control over Avvy's movements. - byte dogfoodpos; /* Which way Dogfood's looking in the pub. */ + byte dogfoodpos; // Which way Dogfood's looking in the pub. - bool givenbadgetoiby; /* Have you given the badge to Iby yet? */ + bool givenbadgetoiby; // Have you given the badge to Iby yet? - bool friar_will_tie_you_up; /* If you're going to get tied up. */ - bool tied_up; /* You ARE tied up! */ + bool friar_will_tie_you_up; // If you're going to get tied up. + bool tied_up; // You ARE tied up! - byte box_contents; /* 0 = money (sixpence), 254 = empty, any - other number implies the contents of the box. */ + byte box_contents; // 0 = money (sixpence), 254 = empty, any + // other number implies the contents of the box. - bool talked_to_crapulus; /* Pretty self-explanatory. */ + bool talked_to_crapulus; // Pretty self-explanatory. - byte jacques_awake; /* 0=asleep, 1=awake, 2=gets up, 3=gone. */ + byte jacques_awake; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool ringing_bells; /* Is Jacques ringing the bells? */ + bool ringing_bells; // Is Jacques ringing the bells? - bool standing_on_dais; /* In room 71, inside Cardiff Castle. */ - bool taken_pen; /* Have you taken the pen (in Cardiff?) */ - bool arrow_triggered; /* And has the arrow been triggered? */ - bool arrow_in_the_door; /* Did the arrow hit the wall? */ + bool standing_on_dais; // In room 71, inside Cardiff Castle. + bool taken_pen; // Have you taken the pen (in Cardiff?) + bool arrow_triggered; // And has the arrow been triggered? + bool arrow_in_the_door; // Did the arrow hit the wall? Common::String like2drink, favourite_song, worst_place_on_earth, - spare_evening; /* Personalisation str's */ + spare_evening; // Personalisation str's - uint32 total_time; /* Your total time playing this game, in ticks.*/ + uint32 total_time; // Your total time playing this game, in ticks. - byte jumpstatus; /* Fixes how high you're jumping. */ + byte jumpstatus; // Fixes how high you're jumping. - bool mushroom_growing; /* Is the mushroom growing in 42? */ + bool mushroom_growing; // Is the mushroom growing in 42? - bool spludwicks_here; /* Is Spludwick at home? */ + bool spludwicks_here; // Is Spludwick at home? byte last_room; byte last_room_not_map; - bool crapulus_will_tell; /* Will Crapulus tell you about - Spludwick being away? */ + bool crapulus_will_tell; // Will Crapulus tell you about + // Spludwick being away? bool enter_catacombs_from_lusties_room; - bool teetotal; /* Are we touching any more drinks? */ - byte malagauche; /* Position of Malagauche. See Celer for more info. */ - char drinking; /* What's he getting you? */ + bool teetotal; // Are we touching any more drinks? + byte malagauche; // Position of Malagauche. See Celer for more info. + char drinking; // What's he getting you? bool entered_lusties_room_as_monk; - byte cat_x, cat_y; /* XY coords in the catacombs. */ + byte cat_x, cat_y; // XY coords in the catacombs. - bool avvys_in_the_cupboard; /* On screen 22. */ + bool avvys_in_the_cupboard; // On screen 22. - bool geida_follows; /* Is Geida following you? */ + bool geida_follows; // Is Geida following you? - byte geida_spin, geida_time; /* For the making "Geida dizzy" joke. */ + byte geida_spin, geida_time; // For the making "Geida dizzy" joke. - byte nextbell; /* For the ringing. */ + byte nextbell; // For the ringing. - bool geida_given_potion; /* Does Geida have the potion? */ - bool lustie_is_asleep; /* Is BDL asleep? */ + bool geida_given_potion; // Does Geida have the potion? + bool lustie_is_asleep; // Is BDL asleep? - byte flip_to_where, flip_to_ped; /* For the sequencer. */ + byte flip_to_where, flip_to_ped; // For the sequencer. - bool been_tied_up; /* In r__Robins. */ + bool been_tied_up; // In r__Robins. - bool sitting_in_pub; /* Are you sitting down in the pub? */ - byte spurge_talk; /* Count for talking to Spurge. */ + bool sitting_in_pub; // Are you sitting down in the pub? + byte spurge_talk; // Count for talking to Spurge. bool met_avaroid; @@ -176,8 +176,8 @@ struct pedtype { }; struct magictype { - byte op; /* one of the operations */ - uint16 data; /* data for them */ + byte op; // one of the operations + uint16 data; // data for them }; class fieldtype { @@ -198,9 +198,9 @@ enum controllers {cjoy, ckey}; typedef Common::String previoustype[20]; -struct corridor_type { /* Decarations for the corridors. */ - uint16 doors; /* Door styles are calc'ed from this uint16. - Assign a different number to each one! */ +struct corridor_type { // Decarations for the corridors. + uint16 doors; // Door styles are calc'ed from this uint16. + // Assign a different number to each one! }; struct demo_type { @@ -223,7 +223,7 @@ struct PointType { int16 x, y; }; -struct vmctype { /* Virtual Mouse Cursor */ +struct vmctype { // Virtual Mouse Cursor byte *andpic, *xorpic; byte *backpic[2]; PointType wherewas[2]; @@ -232,8 +232,7 @@ struct vmctype { /* Virtual Mouse Cursor */ }; struct sundry { - /* Things which must be saved over a backtobootstrap, - outside DNA. */ + // Things which must be saved over a backtobootstrap, outside DNA. Common::String qenid_filename; bool qsoundfx; char qthinks; @@ -242,38 +241,38 @@ struct sundry { struct joysetup { uint16 xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; /* Size of centre in tenths */ + byte centre; // Size of centre in tenths }; -struct ednahead { /* Edna header */ - /* This header starts at byte offset 177 in the .ASG file. */ - char id[9]; /* signature */ - uint16 revision; /* EDNA revision, here 2 (1=dna256) */ - Common::String game; /* Long name, eg Lord Avalot D'Argent */ - Common::String shortname; /* Short name, eg Avalot */ - uint16 number; /* Game's code number, here 2 */ - uint16 ver; /* Version number as int16 (eg 1.00 = 100) */ - Common::String verstr; /* Vernum as Common::String (eg 1.00 = "1.00" */ - Common::String filename; /* Filename, eg AVALOT.EXE */ - byte osbyte; /* Saving OS (here 1=DOS. See below for others.*/ - Common::String os; /* Saving OS in text format. */ - - /* Info on this particular game */ - - Common::String fn; /* Filename (not extension ('cos that's .ASG)) */ - byte d, m; /* D, M, Y are the Day, Month & Year this game was... */ - uint16 y; /* ...saved on. */ - Common::String desc; /* Description of game (same as in Avaricius!) */ - uint16 len; /* Length of DNA (it's not going to be above 65535!) */ - - /* Quick reference & miscellaneous */ - - uint16 saves; /* no. of times this game has been saved */ - int16 cash; /* contents of your wallet in numerical form */ - Common::String money; /* ditto in Common::String form (eg 5/-, or 1 denarius)*/ - uint16 points; /* your score */ - - /* DNA values follow, then footer (which is ignored) */ +struct ednahead { // Edna header + // This header starts at byte offset 177 in the .ASG file. + char id[9]; // signature + uint16 revision; // EDNA revision, here 2 (1=dna256) + Common::String game; // Long name, eg Lord Avalot D'Argent + Common::String shortname; // Short name, eg Avalot + uint16 number; // Game's code number, here 2 + uint16 ver; // Version number as int16 (eg 1.00 = 100) + Common::String verstr; // Vernum as Common::String (eg 1.00 = "1.00") + Common::String filename; // Filename, eg AVALOT.EXE + byte osbyte; // Saving OS (here 1=DOS. See below for others. + Common::String os; // Saving OS in text format. + + // Info on this particular game + + Common::String fn; // Filename (not extension ('cos that's .ASG)) + byte d, m; // D, M, Y are the Day, Month & Year this game was... + uint16 y; // ...saved on. + Common::String desc; // Description of game (same as in Avaricius!) + uint16 len; // Length of DNA (it's not going to be above 65535!) + + // Quick reference & miscellaneous + + uint16 saves; // no. of times this game has been saved + int16 cash; // contents of your wallet in numerical form + Common::String money; // ditto in Common::String form (eg 5/-, or 1 denarius) + uint16 points; // your score + + // DNA values follow, then footer (which is ignored) }; class Gyro { @@ -281,10 +280,10 @@ class Gyro { static const char *vernum; static const char *copyright; static const int16 thisvercode = 130; - /* as "vernum", but numerically & without the ".". */ - static const int16 thisgamecode = 2; /* Avalot's code number */ + // as "vernum", but numerically & without the ".". + static const int16 thisgamecode = 2; // Avalot's code number - /* Objects you can hold: */ + // Objects you can hold: static const char wine = 1; static const char money = 2; static const char bodkin = 3; @@ -304,9 +303,9 @@ class Gyro { static const char habit = 17; static const char onion = 18; - /* People who hang around this game. */ + // People who hang around this game. - /* Boys: */ + // Boys: static const uint16 pavalot = 150; static const uint16 pspludwick = 151; static const uint16 pcrapulus = 152; @@ -325,13 +324,13 @@ class Gyro { static const uint16 pspurge = 165; static const uint16 pjacques = 166; - /* Girls: */ + // Girls: static const uint16 parkata = 175; static const uint16 pgeida = 176; static const uint16 pwisewoman = 178; static const int16 xw = 30; - static const int16 yw = 36; /* x width & y whatsit */ + static const int16 yw = 36; // x width & y whatsit static const int16 margin = 5; @@ -345,28 +344,28 @@ class Gyro { static const char lasschar[]; - static const int16 numtr = 2; /* current max no. of sprites */ + static const int16 numtr = 2; // current max no. of sprites static const bool a_thing = true; - static const bool a_person = false; /* for Thinkabout */ + static const bool a_person = false; // for Thinkabout - /* Magic/portal commands are */ + // Magic/portal commands are - /*N*/ static const int16 nix = 0; /* ignore it if this line is touched */ - /*B*/ static const int16 bounces = 1; /* bounce off this line. Not valid for portals. */ - /*E*/ static const int16 exclaim = 2; /* put up a chain of scrolls */ - /*T*/ static const int16 transport = 3; /* enter new room */ - /*U*/ static const int16 unfinished = 4; /* unfinished connection */ - /*S*/ static const int16 special = 5; /* special function. */ - /*O*/ static const int16 mopendoor = 6; /* opening door. */ + /*N*/ static const int16 nix = 0; // ignore it if this line is touched + /*B*/ static const int16 bounces = 1; // bounce off this line. Not valid for portals. + /*E*/ static const int16 exclaim = 2; // put up a chain of scrolls + /*T*/ static const int16 transport = 3; // enter new room + /*U*/ static const int16 unfinished = 4; // unfinished connection + /*S*/ static const int16 special = 5; // special function. + /*O*/ static const int16 mopendoor = 6; // opening door. - /* These following static constants should be included in CFG when it's written. */ + // These following static constants should be included in CFG when it's written. - static const bool slow_computer = false; /* stops walking when mouse touches toolbar */ + static const bool slow_computer = false; // stops walking when mouse touches toolbar /* --- */ - static const int16 border = 1; /* size of border on shadowboxes */ + static const int16 border = 1; // size of border on shadowboxes static const int32 pagetop = 81920; @@ -383,7 +382,7 @@ class Gyro { static const int16 walk = 3; static const int16 run = 5; - /* Art gallery at 2,1; notice about this at 2,2. */ + // Art gallery at 2,1; notice about this at 2,2. static const int32 catamap[8][8]; @@ -423,7 +422,7 @@ class Gyro { 7 = wall with door and candles, F = straight-through corridor. */ - static const bool demo = false; /* If this is true, we're in a demo of the game. */ + static const bool demo = false; // If this is true, we're in a demo of the game. static const char spludwick_order[3]; @@ -438,7 +437,7 @@ class Gyro { static const tunetype tune; - /* special run-time errors */ + // special run-time errors static const int16 runerr_getset_overflow = 50; @@ -455,28 +454,28 @@ class Gyro { static byte whereis[29]; bool oncandopageswap; - /* Variable static constant for overriding the ability of On to switch pages. - * You may know better than On which page to switch to. */ + // Variable static constant for overriding the ability of On to switch pages. + // You may know better than On which page to switch to. - /* previous:^previoustype;*/ + // previous:^previoustype; dnatype dna; byte lineNum; // Number of lines. - linetype lines[50]; /* For Also. */ + linetype lines[50]; // For Also. int16 c; //registers r; // http://www.freepascal.org/docs-html/rtl/dos/registers.html enum { m_no , m_yes , m_virtual } visible; bool dropsok, screturn, soundfx, cheat; - uint16 mx, my; /* mouse x & y now */ - uint16 mpx, mpy; /* mouse x & y when pressed */ - uint16 mrx, mry; /* mouse x & y when released */ - byte mpress, mrelease; /* times left mouse button has been pressed/released */ - byte keystatus; /* Mouse key status */ + uint16 mx, my; // mouse x & y now + uint16 mpx, mpy; // mouse x & y when pressed + uint16 mrx, mry; // mouse x & y when released + byte mpress, mrelease; // times left mouse button has been pressed/released + byte keystatus; // Mouse key status Common::String un[10]; byte unn; Common::String mousetext; - /* which:array[0..5] of byte;*/ + // which:array[0..5] of byte; void *p; bool weirdword; byte to_do; @@ -486,8 +485,8 @@ class Gyro { byte thinks; bool thinkthing; - /* pp:array[1..1000] of postype; - bb:array[1..9000] of byte;*/ + // pp:array[1..1000] of postype; + // bb:array[1..9000] of byte; uint16 pptr, bptr; int16 ppos[1][2]; uint16 pozzes[24]; @@ -495,7 +494,7 @@ class Gyro { void *copier; int16 talkx, talky; byte talkb, talkf; - byte scrollbells; /* no. of times to ring the bell */ + byte scrollbells; // no. of times to ring the bell bool ontoolbar, seescroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char objlist[10]; @@ -506,8 +505,8 @@ class Gyro { byte oldrw; int8 lastscore[3]; - byte cmp; /* current mouse-void **/ - Common::String verbstr; /* what you can do with your object. :-) */ + byte cmp; // current mouse-void + Common::String verbstr; // what you can do with your object. :-) Common::String *also[31][2]; pedtype peds[15]; @@ -520,7 +519,7 @@ class Gyro { uint16 oh, onh, om, hour, minutes, seconds; - Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ + Common::String atkey; // For XTs, set to "alt-". For ATs, set to "f1". byte cp, ledstatus, defaultled; fontType characters; @@ -528,59 +527,58 @@ class Gyro { byte buffer[2000]; uint16 bufsize; - byte oldjw; /* Old joystick-way */ + byte oldjw; // Old joystick-way controllers ctrl; - int16 underscroll; /* Y-coord of just under the scroll text. */ + int16 underscroll; // Y-coord of just under the scroll text. - /* TSkellern is only temporary, and I'll replace it - with a local version when it's all fixed up. */ + // TSkellern is only temporary, and I'll replace it + // with a local version when it's all fixed up. - /* tskellern:int32 absolute $0:244; { Over int $61 }*/ + // tskellern:int32 absolute $0:244; { Over int $61 } - bool ddmnow; /* Kludge so we don't have to keep referring to Dropdown */ - Common::String roomname; /* Name of this room */ + bool ddmnow; // Kludge so we don't have to keep referring to Dropdown + Common::String roomname; // Name of this room //text logfile; // http://wiki.freepascal.org/Text bool log_epson; bool cl_override; - byte locks; /*ABSOLUTE $40:$17;*/ + byte locks; // ABSOLUTE $40:$17; - Common::String subject; /* What you're talking to them about. */ - byte subjnumber; /* The same thing. */ + Common::String subject; // What you're talking to them about. + byte subjnumber; // The same thing. - bool keyboardclick; /* Is a keyboard click noise wanted? */ + bool keyboardclick; // Is a keyboard click noise wanted? byte him, her, it; - int32 roomtime; /* Set to 0 when you enter a room, added to in every loop.*/ + int32 roomtime; // Set to 0 when you enter a room, added to in every loop. bool after_the_scroll; - /* For the demo: */ + // For the demo: demo_type demo_rec; Common::File demofile; // of demo_type Common::DumpFile demofile_save; // uruk added it - first use located in constructor of Basher - byte last_person; /* Last person to have been selected using the People - menu. */ + byte last_person; // Last person to have been selected using the People menu. - bool doing_sprite_run; /* Only set to True if we're doing a sprite_run - at this moment. This stops the trippancy system from moving any of the - sprites. */ + bool doing_sprite_run; // Only set to True if we're doing a sprite_run + // at this moment. This stops the trippancy system + // from moving any of the sprites. vmctype vmc; Common::String filetoload; - bool holdthedawn; /* If this is true, calling Dawn will do nothing. - It's used, for example, at the start, to stop Load from dawning. */ + bool holdthedawn; // If this is true, calling Dawn will do nothing. + // It's used, for example, at the start, to stop Load from dawning. - uint16 storage_seg, storage_ofs; /* Seg and ofs of the Storage area. */ - uint16 skellern; /* Offset of the timer variable - 1 more than storage_OFS */ + uint16 storage_seg, storage_ofs; // Seg and ofs of the Storage area. + uint16 skellern; // Offset of the timer variable - 1 more than storage_OFS bool isLoaded; // Is it a loaded gamestate? - bool super_was_virtual, super_was_off; /* Used by Super_Off and Super_On */ + bool super_was_virtual, super_was_off; // Used by Super_Off and Super_On Common::String enid_filename; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c5c8062e52a1..20e83e5639af 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -60,10 +60,12 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; - /*if (_vm->_enhanced->atbios) +#if 0 + if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; else - _vm->_gyro->atkey = "alt-";*/ + _vm->_gyro->atkey = "alt-"; +#endif } void Lucerna::callverb(byte n) { @@ -210,7 +212,7 @@ void Lucerna::load_also(Common::String n) { *_vm->_gyro->also[fv][0] = Common::String(',') + *_vm->_gyro->also[fv][0] + ','; } -void Lucerna::load(byte n) { /* Load2, actually */ +void Lucerna::load(byte n) { // Load2, actually Common::String xx; CursorMan.showMouse(false); @@ -233,7 +235,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ if ((32 <= actChar) && (actChar <= 126)) _vm->_gyro->roomname += actChar; } - /* Compression method byte follows this... */ + // Compression method byte follows this... f.seek(177); @@ -270,17 +272,17 @@ void Lucerna::find_people(byte room) { void Lucerna::exitroom(byte x) { //nosound(); _vm->_celer->forgetBackgroundSprites(); - _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ + _vm->_gyro->seescroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { case r__spludwicks: _vm->_timeout->lose_timer(_vm->_timeout->reason_avariciustalks); _vm->_gyro->dna.avaricius_talk = 0; - /* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */ + // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: if (_vm->_gyro->dna.drawbridge_open > 0) { - _vm->_gyro->dna.drawbridge_open = 4; /* Fully open. */ + _vm->_gyro->dna.drawbridge_open = 4; // Fully open. _vm->_timeout->lose_timer(_vm->_timeout->reason_drawbridgefalls); } break; @@ -292,24 +294,24 @@ void Lucerna::exitroom(byte x) { break; } - _vm->_gyro->interrogation = 0; /* Leaving the room cancels all the questions automatically. */ + _vm->_gyro->interrogation = 0; // Leaving the room cancels all the questions automatically. - _vm->_gyro->seescroll = false; /* Now it can work again! */ + _vm->_gyro->seescroll = false; // Now it can work again! _vm->_gyro->dna.last_room = _vm->_gyro->dna.room; if (_vm->_gyro->dna.room != r__map) _vm->_gyro->dna.last_room_not_map = _vm->_gyro->dna.room; } -void Lucerna::new_town() { /* You've just entered a town from the map. */ +void Lucerna::new_town() { // You've just entered a town from the map. _vm->_dropdown->setupMenu(); switch (_vm->_gyro->dna.room) { - case r__outsidenottspub: /* Entry into Nottingham. */ + case r__outsidenottspub: // Entry into Nottingham. if ((_vm->_gyro->dna.rooms[r__robins] > 0) && (_vm->_gyro->dna.been_tied_up) && (!_vm->_gyro->dna.taken_mushroom)) _vm->_gyro->dna.mushroom_growing = true; break; - case r__wisewomans: { /* Entry into Argent. */ + case r__wisewomans: { // Entry into Argent. if (_vm->_gyro->dna.talked_to_crapulus && (! _vm->_gyro->dna.lustie_is_asleep)) { _vm->_gyro->dna.spludwicks_here = !((_vm->_gyro->dna.rooms[r__wisewomans] % 3) == 1); _vm->_gyro->dna.crapulus_will_tell = ! _vm->_gyro->dna.spludwicks_here; @@ -318,14 +320,14 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ _vm->_gyro->dna.crapulus_will_tell = false; } if (_vm->_gyro->dna.box_contents == _vm->_gyro->wine) - _vm->_gyro->dna.winestate = 3; /* Vinegar */ + _vm->_gyro->dna.winestate = 3; // Vinegar } break; } if (_vm->_gyro->dna.room != r__outsideducks) { if ((_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) && !(_vm->_gyro->dna.onion_in_vinegar)) - _vm->_gyro->dna.rotten_onion = true; /* You're holding the onion */ + _vm->_gyro->dna.rotten_onion = true; // You're holding the onion } } @@ -334,14 +336,14 @@ void Lucerna::new_town() { /* You've just entered a town from the map. */ void Lucerna::put_geida_at(byte whichped, byte &ped) { if (ped == 0) return; - _vm->_trip->tr[1].init(5, false, _vm->_trip); /* load Geida */ + _vm->_trip->tr[1].init(5, false, _vm->_trip); // load Geida _vm->_trip->apped(2, whichped); _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; } void Lucerna::enterroom(byte x, byte ped) { - _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ + _vm->_gyro->seescroll = true; // This stops the trippancy system working over the length of this procedure. find_people(x); _vm->_gyro->dna.room = x; @@ -379,18 +381,18 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.talked_to_crapulus) { _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__outsideyours; - _vm->_trip->tr[1].init(8, false, _vm->_trip); /* load Crapulus */ + _vm->_trip->tr[1].init(8, false, _vm->_trip); // load Crapulus if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { - _vm->_trip->apped(2, 4); /* Start on the right-hand side of the screen. */ - _vm->_trip->tr[1].walkto(5); /* Walks up to greet you. */ + _vm->_trip->apped(2, 4); // Start on the right-hand side of the screen. + _vm->_trip->tr[1].walkto(5); // Walks up to greet you. } else { - _vm->_trip->apped(2, 5); /* Starts where he was before. */ + _vm->_trip->apped(2, 5); // Starts where he was before. _vm->_trip->tr[1].face = 3; } _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; /* He always faces Avvy. */ + _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // He always faces Avvy. } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__nowhere; @@ -414,12 +416,12 @@ void Lucerna::enterroom(byte x, byte ped) { case r__spludwicks: if (_vm->_gyro->dna.spludwicks_here) { if (ped > 0) { - _vm->_trip->tr[1].init(2, false, _vm->_trip); /* load Spludwick */ + _vm->_trip->tr[1].init(2, false, _vm->_trip); // load Spludwick _vm->_trip->apped(2, 2); _vm->_gyro->whereis[1] = r__spludwicks; } - _vm->_gyro->dna.dogfoodpos = 0; /* _vm->_gyro->also Spludwick pos. */ + _vm->_gyro->dna.dogfoodpos = 0; // _vm->_gyro->also Spludwick pos. _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; @@ -435,17 +437,17 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; } else { if (ped > 0) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot*/ + _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__brummieroad; - if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { /* First time here... */ - _vm->_trip->apped(2, 2); /* He appears on the right of the screen... */ - _vm->_trip->tr[1].walkto(4); /* ...and he walks up... */ + if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { // First time here... + _vm->_trip->apped(2, 2); // He appears on the right of the screen... + _vm->_trip->tr[1].walkto(4); // ...and he walks up... } else { - /* You've been here before. */ - _vm->_trip->apped(2, 4); /* He's standing in your way straight away... */ + // You've been here before. + _vm->_trip->apped(2, 4); // He's standing in your way straight away... _vm->_trip->tr[1].face = _vm->_trip->left; } } @@ -456,32 +458,32 @@ void Lucerna::enterroom(byte x, byte ped) { case r__argentroad: { if ((_vm->_gyro->dna.cwytalot_gone) && (! _vm->_gyro->dna.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); /* 4=Cwytalot again*/ + _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot again _vm->_trip->apped(2, 1); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; _vm->_gyro->dna.cwytalot_in_herts = true; - /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ + // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } } break; case r__bridge: { - if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ - _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Position of drawbridge */ + if (_vm->_gyro->dna.drawbridge_open == 4) { // open + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); - _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ + _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; // You may enter the drawbridge. } if (_vm->_gyro->dna.geida_follows) - put_geida_at(ped + 3, ped); /* load Geida */ + put_geida_at(ped + 3, ped); // load Geida } break; case r__robins: { if (ped > 0) { if (! _vm->_gyro->dna.been_tied_up) { - /* A welcome party... or maybe not... */ + // A welcome party... or maybe not... _vm->_trip->tr[1].init(6, false, _vm->_trip); _vm->_trip->apped(2, 2); _vm->_trip->tr[1].walkto(3); @@ -506,7 +508,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidecardiffcastle: { if (ped > 0) switch (_vm->_gyro->dna.cardiff_things) { - case 0 : { /* You've answered NONE of his questions. */ + case 0 : { // You've answered NONE of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); _vm->_trip->apped(2, 2); _vm->_trip->tr[1].walkto(3); @@ -515,8 +517,8 @@ void Lucerna::enterroom(byte x, byte ped) { break; case 5 : _vm->_gyro->magics[1].op = _vm->_gyro->nix; - break; /* You've answered ALL his questions. => nothing happens. */ - default: { /* You've answered SOME of his questions. */ + break; // You've answered ALL his questions. => nothing happens. + default: { // You've answered SOME of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); _vm->_trip->apped(2, 3); _vm->_trip->tr[1].face = _vm->_trip->right; @@ -530,7 +532,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__map: { - /* You're entering the map. */ + // You're entering the map. dawn(); //setactivepage(cp); if (ped > 0) @@ -539,7 +541,7 @@ void Lucerna::enterroom(byte x, byte ped) { { if ((_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) && (_vm->_gyro->dna.winestate != 3)) { - _vm->_visa->dixi('q', 9); /* Don't want to waste the wine! */ + _vm->_visa->dixi('q', 9); // Don't want to waste the wine! _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; objectlist(); } @@ -579,8 +581,8 @@ void Lucerna::enterroom(byte x, byte ped) { case r__argentpub: { if (_vm->_gyro->dna.wonnim) - _vm->_celer->drawBackgroundSprite(-1, -1, 1); /* No lute by the settle. */ - _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. + _vm->_gyro->dna.malagauche = 0; // Ready to boot Malagauche if (_vm->_gyro->dna.givenbadgetoiby) { _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); @@ -590,11 +592,11 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__lustiesroom: { - _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ - if (_vm->_trip->tr[0].whichsprite == 0) /* Avvy in his normal clothes */ + _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. + if (_vm->_trip->tr[0].whichsprite == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); - else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ - /* Presumably, Avvy dressed as a monk. */ + else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) // already + // Presumably, Avvy dressed as a monk. _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->dna.geida_follows) { @@ -653,21 +655,21 @@ void Lucerna::enterroom(byte x, byte ped) { case r__wisewomans: { _vm->_trip->tr[1].init(11, false, _vm->_trip); if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip->apped(2, 2); /* Start on the right-hand side of the screen. */ - _vm->_trip->tr[1].walkto(4); /* Walks up to greet you. */ + _vm->_trip->apped(2, 2); // Start on the right-hand side of the screen. + _vm->_trip->tr[1].walkto(4); // Walks up to greet you. } else { - _vm->_trip->apped(2, 4); /* Starts where she was before. */ + _vm->_trip->apped(2, 4); // Starts where she was before. _vm->_trip->tr[1].face = 3; } _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; /* She always faces Avvy. */ + _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // She always faces Avvy. } break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ + _vm->_trip->tr[1].init(10, false, _vm->_trip); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); @@ -705,11 +707,13 @@ void Lucerna::enterroom(byte x, byte ped) { case r__insideabbey: case r__yourhall: if (ped == 2) { - /* It was the original: +#if 0 + // It was the original: _vm->_celer->show_one(-1, -1, 2); _vm->_sequence->first_show(1); _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close();*/ + _vm->_sequence->start_to_close(); +#endif _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); @@ -724,11 +728,11 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.ayles_is_awake) _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); - break; /* Ayles awake. */ + break; // Ayles awake. case r__geidas: put_geida_at(2, ped); - break; /* load Geida */ + break; // load Geida case r__easthall: case r__westhall: @@ -743,13 +747,13 @@ void Lucerna::enterroom(byte x, byte ped) { case r__nottspub: { if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ + _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. } break; case r__outsideducks: if (ped == 2) { - /* Shut the door */ + // Shut the door _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); @@ -762,16 +766,16 @@ void Lucerna::enterroom(byte x, byte ped) { case r__ducks: _vm->_gyro->dna.dogfoodpos = 1; - break; /* Actually, Duck pos. */ + break; // Actually, Duck pos. } - _vm->_gyro->seescroll = false; /* Now it can work again! */ + _vm->_gyro->seescroll = false; // Now it can work again! if (_vm->_gyro->isLoaded) _vm->_gyro->isLoaded = false; } -void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! */ +void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! const int16 picsize = 966; const bytefield thinkspace = {25, 170, 32, 200}; @@ -795,7 +799,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * if (z >= 25) z -= 8; if (z == 20) - z--; /* Last time... */ + z--; // Last time... } @@ -811,9 +815,11 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * CursorMan.showMouse(false); - /*setactivepage(3); +#if 0 + setactivepage(3); putimage(x, y, p, 0); - setactivepage(1 - cp);*/ + setactivepage(1 - cp); +#endif for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(thinkspace); @@ -822,7 +828,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * _vm->_gyro->thinkthing = th; } -void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ +void Lucerna::load_digits() { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; @@ -833,15 +839,23 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ for (byte fv = 0; fv < 10; fv++) { f.seek(fv * digitsize); - /*_vm->_gyro->digit[fv] = new byte[digitsize]; - f.read(_vm->_gyro->digit[fv], digitsize);*/ + +#if 0 + _vm->_gyro->digit[fv] = new byte[digitsize]; + f.read(_vm->_gyro->digit[fv], digitsize); +#endif + _vm->_gyro->digit[fv] = _vm->_graphics->loadPictureGraphic(f); } for (byte ff = 0; ff < 9; ff++) { f.seek(10 * digitsize + ff * rwlitesize); - /*_vm->_gyro->rwlite[ff] = new byte[rwlitesize]; - f.read(_vm->_gyro->rwlite[ff], rwlitesize);*/ + +#if 0 + _vm->_gyro->rwlite[ff] = new byte[rwlitesize]; + f.read(_vm->_gyro->rwlite[ff], rwlitesize); +#endif + _vm->_gyro->rwlite[ff] = _vm->_graphics->loadPictureGraphic(f); } @@ -856,7 +870,7 @@ void Lucerna::toolbar() { f.seek(40); - /* off;*/ + // off; ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); @@ -866,7 +880,7 @@ void Lucerna::toolbar() { f.close(); - /* on;*/ + // on; _vm->_gyro->oldrw = 177; showrw(); @@ -908,13 +922,17 @@ void Lucerna::showscore() { _vm->_gyro->lastscore[i] = numbers[i]; } -void Lucerna::points(byte num) { /* Add on no. of points */ +void Lucerna::points(byte num) { // Add on no. of points for (byte q = 1; q <= num; q++) { _vm->_gyro->dna.score++; - /*if (soundfx) + +#if 0 + if (soundfx) { for (byte fv = 1; fv <= 97; fv++) sound(177 + dna.score * 3); - nosound;*/ + } + nosound; +#endif } warning("STUB: Lucerna::points()"); @@ -975,7 +993,7 @@ void Lucerna::fxtoggle() { void Lucerna::objectlist() { _vm->_gyro->dna.carrying = 0; if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks - 1]) - thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); /* you always have money */ + thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); // you always have money for (byte fv = 0; fv < numobjs; fv++) if (_vm->_gyro->dna.obj[fv]) { _vm->_gyro->dna.carrying++; @@ -1133,7 +1151,7 @@ int8 Lucerna::fades(int8 x) { b--; return (16 * r + 4 * g + b); - /* fades:=x-1;*/ + // fades = x - 1; } @@ -1166,10 +1184,12 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). _vm->_gyro->oldrw = _vm->_gyro->dna.rw; CursorMan.showMouse(false); - /* for (byte page_ = 0; page_ <= 1; page_++) { - setactivepage(page_); - putimage(0, 161, rwlite[with.rw], 0); - }*/ +#if 0 + for (byte page_ = 0; page_ <= 1; page_++) { + setactivepage(page_); + putimage(0, 161, rwlite[with.rw], 0); + } +#endif _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); @@ -1208,7 +1228,7 @@ void Lucerna::refresh_hands() { } void Lucerna::plothands() { - /* off;*/ + // off; //setactivepage(3); calchand(_vm->_gyro->onh, 14, ah, yellow); calchand(_vm->_gyro->om * 6, 17, am, yellow); @@ -1224,7 +1244,7 @@ void Lucerna::plothands() { refresh_hands(); - /* on;*/ + // on; } void Lucerna::chime() { @@ -1232,7 +1252,7 @@ void Lucerna::chime() { } void Lucerna::clock_lucerna() { - /* ...Clock. */ + // ...Clock. TimeDate t; _vm->_system->getTimeAndDate(t); _vm->_gyro->hour = t.tm_hour; @@ -1291,7 +1311,7 @@ void Lucerna::gameover() { void Lucerna::minor_redraw() { dusk(); - enterroom(_vm->_gyro->dna.room, 0); /* Ped unknown or non-existant. */ + enterroom(_vm->_gyro->dna.room, 0); // Ped unknown or non-existant. for (byte fv = 0; fv <= 1; fv++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; @@ -1299,7 +1319,7 @@ void Lucerna::minor_redraw() { } for (byte i = 0; i < 3; i++) - _vm->_gyro->lastscore[i] = -1; /* impossible digits */ + _vm->_gyro->lastscore[i] = -1; // impossible digits showscore(); dawn(); @@ -1312,17 +1332,19 @@ void Lucerna::major_redraw() { uint16 Lucerna::bearing(byte whichped) { whichped--; // Different array indexes in Pascal and C. - const double rad2deg = 180 / 3.14 /*Pi*/; + const double rad2deg = 180 / 3.14; // Pi if (_vm->_trip->tr[0].x == _vm->_gyro->peds[whichped].x) return 0; - else - if (_vm->_trip->tr[0].x < _vm->_gyro->peds[whichped].x) + else { + if (_vm->_trip->tr[0].x < _vm->_gyro->peds[whichped].x) { return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 90; - else + } else { return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 270; + } + } } void Lucerna::sprite_run() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index f20b0d01d6de..d3e1becbdd84 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -60,15 +60,15 @@ class Lucerna { void enterroom(byte x, byte ped); - void thinkabout(byte z, bool th); /* Hey!!! Get it and put it!!! */ + void thinkabout(byte z, bool th); // Hey!!! Get it and put it!!! - void load_digits(); /* Load the scoring digits & rwlites */ + void load_digits(); // Load the scoring digits & rwlites void toolbar(); void showscore(); - void points(byte num); /* Add on no. of points */ + void points(byte num); // Add on no. of points void mouseway(const Common::Point &cursorPos); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 6ccacc005fd5..737bf87088d1 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -44,9 +44,9 @@ void Parser::init() { void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; warning("STUB: Parser::handleInputText()"); - /*if (_vm->_dropdown->_activeMenuItem._activeNow) { - _vm->_dropdown->parseKey(inChar, _vm->_enhanced->extd); - } else {*/ +// if (_vm->_dropdown->_activeMenuItem._activeNow) { +// _vm->_dropdown->parseKey(inChar, _vm->_enhanced->extd); +// } else { if (_inputText.size() < 76) { if ((inChar == '"') || (inChar == '`')) { if (_quote) @@ -61,7 +61,7 @@ void Parser::handleInputText(const Common::Event &event) { plotText(); } else _vm->_gyro->blip(); - //} +// } } void Parser::handleBackspace() { diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 777a1c7cb6b5..cc9592b62351 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -49,7 +49,8 @@ void Pingo::dplot(int16 x, int16 y, Common::String z) { } void Pingo::bosskey() { -/*const +#if 0 +const months : array[0..11] of char = 'JFMAMJJASOND'; title = 'Net Profits'; fish = #224; { } @@ -78,20 +79,21 @@ begin; dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; - copy02;*/ + copy02; +#endif warning("STUB: Pingo::bosskey()"); } -void Pingo::copy02() { /* taken from Wobble (below) */ +void Pingo::copy02() { // taken from Wobble (below) warning("STUB: Pingo::copy02()"); } -void Pingo::copy03() { /* taken from Wobble (below) */ +void Pingo::copy03() { // taken from Wobble (below) warning("STUB: Pingo::copy03()"); } -void Pingo::copypage(byte frp, byte top) { /* taken from Copy02 (above) */ +void Pingo::copypage(byte frp, byte top) { // taken from Copy02 (above) warning("STUB: Pingo::copypage()"); } @@ -116,13 +118,16 @@ void Pingo::winning_pic() { return; } - /*for (byte bit = 0; bit <= 3; bit++) { +#if 0 + for (byte bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; blockread(f, mem[0xa000 * 0], 16000); - }*/ + } +#endif + warning("STUB: Pingo::winning_pic()"); f.close(); @@ -132,12 +137,15 @@ void Pingo::winning_pic() { _vm->_lucerna->dawn(); - /*do { +#if 0 + do { _vm->_gyro->check(); } while (!(keypressed() || (mrelease > 0))); while (keypressed()) char r = readkey(); - major_redraw();*/ + major_redraw(); +#endif + warning("STUB: Pingo::winning_pic()"); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index c16d983a4f77..910285c65a6c 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -62,7 +62,7 @@ class Scrolls { - bool aboutscroll; /* Is this the about box? */ + bool aboutscroll; // Is this the about box? @@ -70,9 +70,9 @@ class Scrolls { void init(); - void state(byte x); /* Sets "Ready" light to whatever */ + void state(byte x); // Sets "Ready" light to whatever - void drawscroll(func2 gotoit); /* This is one of the oldest funcs in the game. */ + void drawscroll(func2 gotoit); // This is one of the oldest funcs in the game. void bubble(func2 gotoit); @@ -88,7 +88,7 @@ class Scrolls { Common::String lsd(); - void okay(); /* Says "Okay!" */ + void okay(); // Says "Okay!" void musical_scroll(); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index d5983c8784a6..315646685a8a 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -44,11 +44,11 @@ Sequence::Sequence(AvalancheEngine *vm) { } void Sequence::first_show(byte what) { - /* First, we need to blank out the entire array. */ + // First, we need to blank out the entire array. for (uint i = 0; i < sizeof(seq); i++) seq[i] = 0; - /* Then it's just the same as then_show. */ + // Then it's just the same as then_show. then_show(what); } @@ -75,16 +75,16 @@ void Sequence::start_to_close() { } void Sequence::start_to_open() { - _vm->_gyro->dna.user_moves_avvy = false; /* They can't move. */ - _vm->_trip->stopwalking(); /* And they're not moving now. */ - start_to_close(); /* Apart from that, it's the same thing. */ + _vm->_gyro->dna.user_moves_avvy = false; // They can't move. + _vm->_trip->stopwalking(); // And they're not moving now. + start_to_close(); // Apart from that, it's the same thing. } -/* This PROC is called by Timeout when it's time to do another frame. */ +// This PROC is called by Timeout when it's time to do another frame. void Sequence::shove_left() { - memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */ + memcpy(seq, seq+1, seq_length - 1); // Shift everything to the left. } void Sequence::call_sequencer() { @@ -101,12 +101,12 @@ void Sequence::call_sequencer() { } if ((seq[0] >= 1) && (seq[0] <= 176)) { - /* Show a frame. */ + // Show a frame. _vm->_celer->drawBackgroundSprite(-1, -1, seq[0]); shove_left(); } - start_to_close(); /* Make sure this PROC gets called again. */ + start_to_close(); // Make sure this PROC gets called again. } } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 7979a8d09aef..3a2271a3842d 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -345,7 +345,7 @@ void Timeout::after_the_shootemup() { _vm->_trip->fliproom(_vm->_gyro->dna.room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_trip->tr[0].init(0, true, _vm->_trip); /* Avalot. */ + _vm->_trip->tr[0].init(0, true, _vm->_trip); // Avalot. _vm->_trip->apped(1, 2); _vm->_gyro->dna.user_moves_avvy = true; _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = true; @@ -355,19 +355,21 @@ void Timeout::after_the_shootemup() { _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); - //byte shootscore, gain; +#if 0 + byte shootscore, gain; - //shootscore = mem[storage_seg * storage_ofs]; - //gain = (shootscore + 5) / 10; /* Rounding up. */ + shootscore = mem[storage_seg * storage_ofs]; + gain = (shootscore + 5) / 10; // Rounding up. - //display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + - // strf(shootscore) + " 10) = " + strf(gain) + " points."); + display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + + strf(shootscore) + " 10) = " + strf(gain) + " points."); - //if (gain > 20) { - // display("But we won't let you have more than 20 points!"); - // points(20); - //} else - // points(gain); + if (gain > 20) { + display("But we won't let you have more than 20 points!"); + points(20); + } else + points(gain); +#endif warning("STUB: Timeout::after_the_shootemup()"); @@ -621,10 +623,12 @@ void Timeout::winning() { _vm->_pingo->winning_pic(); warning("STUB: Timeout::winning()"); - /*do { - _vm->_lucerna->checkclick(); - } while (!(_vm->_gyro->mrelease == 0));*/ - // To be implemented with Pingo::winning_pic(). +#if 0 + do { + _vm->_lucerna->checkclick(); + } while (!(_vm->_gyro->mrelease == 0)); +#endif + // TODO: To be implemented with Pingo::winning_pic(). _vm->_lucerna->callverb(_vm->_acci->kVerbCodeScore); _vm->_scrolls->display(" T H E E N D "); diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 9ad2c30eb607..2bac5a0031d6 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -37,7 +37,7 @@ class AvalancheEngine; class Timeout { public: - /* reason_ now runs between 1 and 28. */ + // reason_ now runs between 1 and 28. static const int16 reason_drawbridgefalls = 2; static const int16 reason_avariciustalks = 3; @@ -47,7 +47,7 @@ class Timeout { static const int16 reason_cardiffsurvey = 7; static const int16 reason_cwytalot_in_herts = 8; static const int16 reason_getting_tied_up = 9; - static const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */ + static const int16 reason_hanging_around = 10; // Tied to the tree in Nottingham. static const int16 reason_jacques_waking_up = 11; static const int16 reason_naughty_duke = 12; static const int16 reason_jumping = 13; @@ -68,7 +68,7 @@ class Timeout { static const int16 reason_spludwalk = 27; static const int16 reason_geida_sings = 28; - /* procx now runs between 1 and 41. */ + // procx now runs between 1 and 41. static const int16 procopen_drawbridge = 3; static const int16 procavaricius_talks = 4; @@ -103,7 +103,7 @@ class Timeout { static const int16 procrobin_hood_and_geida = 2; static const int16 procrobin_hood_and_geida_talk = 30; static const int16 procavalot_returns = 31; - static const int16 procavvy_sit_down = 33; /* In Nottingham. */ + static const int16 procavvy_sit_down = 33; // In Nottingham. static const int16 procghost_room_phew = 34; static const int16 procarkata_shouts = 35; static const int16 procwinning = 36; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 1f2b83d00912..1c5c6db19a1f 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -39,13 +39,13 @@ namespace Avalanche { class AvalancheEngine; -struct adxtype { /* Second revision of ADX type */ - Common::String name/*[13]*/; /* name of character */ // uruk: Note to self: TRAILING /0 !!! Real size: 12 - Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. - byte num; /* number of pictures */ - byte seq; /* how many in one stride */ - byte fgc, bgc; /* foreground & background bubble colors */ - byte accinum; /* the number according to Acci (1=Avvy, etc.) */ +struct adxtype { // Second revision of ADX type + Common::String name; // [13] name of character // uruk: Note to self: TRAILING /0 !!! Real size: 12 + Common::String comment; // [17] comment // uruk: Same here, but 16. + byte num; // number of pictures + byte seq; // how many in one stride + byte fgc, bgc; // foreground & background bubble colors + byte accinum; // the number according to Acci (1=Avvy, etc.) }; struct trip_saver_type { @@ -76,41 +76,41 @@ class triptype { public: SpriteInfo _info; - adxtype a; /* vital statistics */ + adxtype a; // vital statistics byte face, step; - int16 x, y; /* current xy coords */ - int16 ox[2], oy[2]; /* last xy coords */ - int8 ix, iy; /* amount to move sprite by, each step */ + int16 x, y; // current xy coords + int16 ox[2], oy[2]; // last xy coords + int8 ix, iy; // amount to move sprite by, each step byte whichsprite; bool quick, visible, homing, check_me; - int16 hx, hy; /* homing x & y coords */ - byte count; /* counts before changing step */ - byte xs, ys; /* x & y speed */ - byte totalnum; /* total number of sprites */ - bool vanishifstill; /* Do we show this sprite if it's still? */ + int16 hx, hy; // homing x & y coords + byte count; // counts before changing step + byte xs, ys; // x & y speed + byte totalnum; // total number of sprites + bool vanishifstill; // Do we show this sprite if it's still? - bool call_eachstep; /* Do we call the eachstep procedure? */ + bool call_eachstep; // Do we call the eachstep procedure? byte eachstep; void init(byte spritenum, bool do_check, Trip *tr); - /* loads & sets up the sprite */ - void original(); /* just sets Quick to false */ - void andexor(); /* drops sprite onto screen */ - void turn(byte whichway); /* turns him round */ - void appear(int16 wx, int16 wy, byte wf); /* switches him on */ - void bounce(); /* bounces off walls. */ - void walk(); /* prepares for andexor, etc. */ - void walkto(byte pednum); /* home in on a point */ - void stophoming(); /* self-explanatory */ - void homestep(); /* calculates ix & iy for one homing step */ - void speed(int8 xx, int8 yy); /* sets ix & iy, non-homing, etc */ - void stopwalk(); /* Stops the sprite from moving */ - void chatter(); /* Sets up talk vars */ + // loads & sets up the sprite + void original(); // just sets Quick to false + void andexor(); // drops sprite onto screen + void turn(byte whichway); // turns him round + void appear(int16 wx, int16 wy, byte wf); // switches him on + void bounce(); // bounces off walls. + void walk(); // prepares for andexor, etc. + void walkto(byte pednum); // home in on a point + void stophoming(); // self-explanatory + void homestep(); // calculates ix & iy for one homing step + void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc + void stopwalk(); // Stops the sprite from moving + void chatter(); // Sets up talk vars void set_up_saver(trip_saver_type &v); void unload_saver(trip_saver_type v); - void savedata(Common::File &f); /* Self-explanatory, */ - void loaddata(Common::File &f); /* really. */ + void savedata(Common::File &f); // Self-explanatory, + void loaddata(Common::File &f); // really. void save_data_to_mem(uint16 &where); void load_data_from_mem(uint16 &where); @@ -160,7 +160,7 @@ class Trip { static const int16 ul = 7; static const int16 stopped = 8; - static const int16 numtr = 5; /* current max no. of sprites */ + static const int16 numtr = 5; // current max no. of sprites @@ -190,7 +190,7 @@ class Trip { void call_special(uint16 which); - void open_the_door(byte whither, byte ped, byte magicnum); /* Handles slidey-open doors. */ + void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. void catamove(byte ped); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 0c005fa23f0c..1de48fd388db 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -112,7 +112,7 @@ void Visa::speech(byte who, byte subject) { uint16 idx_offset, sez_offset, next_idx_offset; if (subject == 0) { - /* No subject. */ + // No subject. bubbling = true; report_dixi_errors = false; @@ -120,9 +120,9 @@ void Visa::speech(byte who, byte subject) { bubbling = false; report_dixi_errors = true; } else { - /* Subject given. */ + // Subject given. - went_ok = false; /* Assume that until we know otherwise. */ + went_ok = false; // Assume that until we know otherwise. if (!indexfile.open("converse.avd")) { warning("AVALANCHE: Visa: File not found: converse.avd"); From 31bd1369d977e626713baa095359e43b2f1518f7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 08:02:25 +0200 Subject: [PATCH 0814/1332] AVALANCHE: Add some brackets to improve readability --- engines/avalanche/acci2.cpp | 7 ++- engines/avalanche/scrolls2.cpp | 85 ++++++++++++++++++---------------- engines/avalanche/trip6.cpp | 14 ++++-- 3 files changed, 56 insertions(+), 50 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 386ce221d790..9bf400fe2ce7 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -517,10 +517,9 @@ void Acci::parse() { if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; - else { - if (!_unknown.empty()) - _unknown.clear(); - } + else if (!_unknown.empty()) + _unknown.clear(); + // Replace words' codes that mean the same. replace(Common::String('\xFF'), 0); // zap noise words replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 5a893a6b3777..0d578c727e3c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -145,40 +145,42 @@ void Scrolls::normscroll() { -// char r; -// bool oktoexit; -// do { -// do { -// _vm->_gyro->check(); // was "checkclick;" -// +#if 0 + char r; + bool oktoexit; + do { + do { + _vm->_gyro->check(); // was "checkclick;" + //#ifdef RECORD slowdown(); basher::count += 1; #endif -// -// if (_vm->_gyro->demo) { -// if (_vm->_basher->demo_ready()) -// break; -// if (_vm->_enhanced->keypressede()) -// return; -// } else if (_vm->_enhanced->keypressede()) -// break; -// } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); -// -// -// if (mrelease == 0) { -// inkey(); -// if (aboutscroll) { -// move(e[2 - 1], e[1 - 1], 7); -// e[8 - 1] = inchar; -// if (egg == e) easteregg(); -// } -// oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); -// if (! oktoexit) errorled(); -// } -// -// } while (!((oktoexit) || (mrelease > 0))); -// + + if (_vm->_gyro->demo) { + if (_vm->_basher->demo_ready()) + break; + if (_vm->_enhanced->keypressede()) + return; + } else if (_vm->_enhanced->keypressede()) + break; + } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); + + + if (mrelease == 0) { + inkey(); + if (aboutscroll) { + move(e[2 - 1], e[1 - 1], 7); + e[8 - 1] = inchar; + if (egg == e) easteregg(); + } + oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); + if (! oktoexit) errorled(); + } + + } while (!((oktoexit) || (mrelease > 0))); + //#ifdef RECORD record_one(); #endif -// -// _vm->_gyro->screturn = r == '#'; // "back door" + + _vm->_gyro->screturn = r == '#'; // "back door" +#endif state(0); _vm->_gyro->seescroll = false; @@ -647,18 +649,17 @@ void Scrolls::calldrivers() { uint16 size = _vm->_gyro->bufsize; - for (fv = 0; fv < size; fv++) + for (fv = 0; fv < size; fv++) { if (mouthnext) { if (_vm->_gyro->buffer[fv] == kControlRegister) param = 0; - else - if (('0' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= '9')) - param = _vm->_gyro->buffer[fv] - 48; - else if (('A' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= 'Z')) - param = _vm->_gyro->buffer[fv] - 55; + else if (('0' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= '9')) + param = _vm->_gyro->buffer[fv] - 48; + else if (('A' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= 'Z')) + param = _vm->_gyro->buffer[fv] - 55; mouthnext = false; - } else + } else { switch (_vm->_gyro->buffer[fv]) { case kControlParagraph: { if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty())) @@ -689,13 +690,13 @@ void Scrolls::calldrivers() { if (param == 0) natural(); - else if ((1 <= param) && (param <= 9)) + else if ((1 <= param) && (param <= 9)) { if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. _vm->_lucerna->errorled(); natural(); } else _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. - else if ((10 <= param) && (param <= 36)) { + } else if ((10 <= param) && (param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) @@ -802,6 +803,8 @@ void Scrolls::calldrivers() { _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += _vm->_gyro->buffer[fv]; } } + } + } } void Scrolls::display(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index ed8cd1332447..0c320dd186b4 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -480,20 +480,23 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { x1 = 0; if (x2 > 639) x2 = 639; - if (oy < y) - for (fv = x1; fv <= x2; fv++) + if (oy < y) { + for (fv = x1; fv <= x2; fv++) { for (ff = oy + yl; ff <= y + yl; ff++) { c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) a = c; } - else - for (fv = x1; fv <= x2; fv++) + } + } else { + for (fv = x1; fv <= x2; fv++) { for (ff = y + yl; ff <= oy + yl; ff++) { c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); if (c > a) a = c; } + } + } //setactivepage(1 - cp); return a; @@ -1581,7 +1584,7 @@ void Trip::handleMoveKey(const Common::Event &event) { if (_vm->_dropdown->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); - else + else { switch (event.kbd.keycode) { case Common::KEYCODE_UP: if (_vm->_gyro->dna.rw != up) { @@ -1645,6 +1648,7 @@ void Trip::handleMoveKey(const Common::Event &event) { default: break; } + } } From 8011d24ee20f6942a8b153849413002740f3ff78 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 08:07:59 +0200 Subject: [PATCH 0815/1332] AVALANCHE: Fix warnings reported by GCC --- engines/avalanche/scrolls2.cpp | 3 +-- engines/avalanche/trip6.cpp | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 0d578c727e3c..ba0a6c49721d 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -620,7 +620,6 @@ void Scrolls::solidify(byte n) { void Scrolls::calldrivers() { uint16 fv; byte nn; - char nnn; bool mouthnext; bool call_spriterun; // Only call sprite_run the FIRST time. // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? @@ -760,7 +759,7 @@ void Scrolls::calldrivers() { break; case 11: nn = 1; - for (nnn = 0; nnn < numobjs; nnn++) { + for (byte nnn = 0; nnn < numobjs; nnn++) { if (_vm->_gyro->dna.obj[nnn]) { nn++; display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 0c320dd186b4..790619e72a0d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1119,11 +1119,9 @@ void Trip::apped(byte trn, byte np) { rwsp(trn, _vm->_gyro->peds[np].dir); } - - #if 0 function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; - begin { By De Morgan's law: } + begin // By De Morgan's law: overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); end; #endif From c0d9677979c6fdc6272a49957f617f282363078a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 08:11:27 +0200 Subject: [PATCH 0816/1332] AVALANCHE: Fix one more GCC warning --- engines/avalanche/dropdown2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 5f419d754266..fefdaa13c954 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -336,13 +336,15 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, ander = 170; fontType font; - for (byte i = 0; i < text.size(); i++) + for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < 8; j++) { - font[text[i]][j] = _vm->_gyro->characters[text[i]][j] & ander; // Set the font. + byte idx = text[i]; + font[idx][j] = _vm->_gyro->characters[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. for (byte k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; } + } _vm->_graphics->drawText(_vm->_graphics->_surface, text, font, 8, x * 8, y, fontColor); From 0c47dc858af4fda4f01939f67f6bb4fc746db674 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 10:51:47 +0200 Subject: [PATCH 0817/1332] AVALANCHE: Fix GCC warning. --- engines/avalanche/celer2.cpp | 2 +- engines/avalanche/celer2.h | 2 +- engines/avalanche/graphics.cpp | 6 +++--- engines/avalanche/graphics.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 5c95acabe5ac..0094fa5616e0 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -371,7 +371,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { -void Celer::drawSprite(int16 x, int16 y, const SpriteType &sprite) { +void Celer::drawSprite(int16 x, int16 y, SpriteType &sprite) { _r.x1 = x; _r.y1 = y; _r.y2 = y + sprite._yl; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index a4cd0eb675db..090eda2d90d4 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -73,7 +73,7 @@ class Celer { Common::String _filename; static const int16 kOnDisk; // Value of memos[fv].x when it's not in memory. - void drawSprite(int16 x, int16 y, const SpriteType &sprite); + void drawSprite(int16 x, int16 y, SpriteType &sprite); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 92bffc29764b..0546ca59671c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -39,7 +39,7 @@ namespace Avalanche { -const byte Graphics::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; +const byte Graphics::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; @@ -57,7 +57,7 @@ void Graphics::init() { } for (byte i = 0; i < 16; i++) - g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1); + g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -309,7 +309,7 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } -void Graphics::drawPicture(const ::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) for (uint16 x = 0; x < picture.w; x++) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 4c812fb7de57..ac9e8bf91d98 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -115,7 +115,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data - void drawPicture(const ::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); @@ -124,7 +124,7 @@ class Graphics { private: AvalancheEngine *_vm; - static const byte _egaPaletteIndex[16]; + static const byte kEgaPaletteIndex[16]; byte _egaPalette[64][3]; }; From 9740287721420c0ac2951124f9bfc76b8807113e Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 11:05:03 +0200 Subject: [PATCH 0818/1332] AVALANCHE: Fix some memory leak problems. --- engines/avalanche/dropdown2.cpp | 2 ++ engines/avalanche/scrolls2.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index fefdaa13c954..a57828879105 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -813,6 +813,8 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... } } + + backup.free(); } } // End of namespace Avalanche. diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index ba0a6c49721d..3994f5656965 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -142,6 +142,7 @@ void Scrolls::normscroll() { } _vm->_graphics->_surface.copyFrom(temp); + temp.free(); From a698a2a2f93e420ded9a7714cd759360d689f486 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 12:31:29 +0200 Subject: [PATCH 0819/1332] AVALANCHE: Repair another bunch of memory leaks. --- engines/avalanche/celer2.cpp | 1 + engines/avalanche/lucerna2.cpp | 6 ++++++ engines/avalanche/lucerna2.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 0094fa5616e0..5d7dacf4e7f6 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -359,6 +359,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { } drawSprite(destX, destY, sprite); + sprite._picture.free(); f.close(); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 20e83e5639af..f225d0263edd 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -57,6 +57,12 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { _vm = vm; } +Lucerna::~Lucerna() { + for (byte i = 0; i < 31; i++) + for (byte j = 0; j < 2; j++) + delete _vm->_gyro->also[i][j]; +} + void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index d3e1becbdd84..8e5897f82cb4 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -44,6 +44,8 @@ class Lucerna { Lucerna(AvalancheEngine *vm); + ~Lucerna(); + void init(); void callverb(byte n); From ce95f738be9bc4cdc1a32f538e7cfdd893d24e47 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 12:59:01 +0200 Subject: [PATCH 0820/1332] AVALANCHE: Do renaming in Enid. (Keep the refactoring for the implementation of it.) --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/dropdown2.cpp | 8 +-- engines/avalanche/dropdown2.h | 12 ---- engines/avalanche/enid2.cpp | 100 +++++++++++++++----------------- engines/avalanche/enid2.h | 70 ++++++++-------------- engines/avalanche/timeout2.cpp | 2 +- engines/avalanche/trip6.cpp | 2 +- 7 files changed, 75 insertions(+), 121 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 9bf400fe2ce7..520b2a8e9910 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1246,7 +1246,7 @@ void Acci::giveGeidaTheLute() { _vm->_visa->dixi('q', 64); // She plays it. _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); - _vm->_enid->back_to_bootstrap(4); + _vm->_enid->backToBootstrap(4); } void Acci::playHarp() { diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index a57828879105..282f2f888f2d 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -221,8 +221,6 @@ void MenuItem::parseKey(char c) { _dr->_vm->_gyro->blip(); } - - void MenuBar::init(Dropdown *dr) { _dr = dr; _menuNum = 0; @@ -282,8 +280,6 @@ void MenuBar::chooseMenuItem(int16 x) { } while (i < _menuNum); } - - Dropdown::Dropdown(AvalancheEngine *vm) { _vm = vm; _activeMenuItem.init(this); @@ -599,7 +595,7 @@ void Dropdown::runMenuFile() { warning("STUB: Dropdown::runMenuFile()"); break; case 4: - _vm->_enid->back_to_bootstrap(2); + _vm->_enid->backToBootstrap(2); break; case 5: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeQuit); @@ -710,8 +706,6 @@ void Dropdown::runMenuWith() { _vm->_lucerna->callverb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); } - - void Dropdown::setupMenu() { _menuBar.init(this); _activeMenuItem.init(this); diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 8912e60a75bb..ad9dc77501e0 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -42,12 +42,8 @@ class AvalancheEngine; class Dropdown; - - typedef void (Dropdown::*DropdownFunc)(); - - class HeadType { public: Common::String _title; @@ -65,8 +61,6 @@ class HeadType { Dropdown *_dr; }; - - struct OptionType { Common::String _title; byte _trigger; @@ -74,8 +68,6 @@ struct OptionType { bool _valid; }; - - class MenuItem { public: OptionType _options[12]; @@ -104,8 +96,6 @@ class MenuItem { Dropdown *_dr; }; - - class MenuBar { public: HeadType _menuItems[8]; @@ -122,8 +112,6 @@ class MenuBar { Dropdown *_dr; }; - - class Dropdown { public: friend class HeadType; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 4477fe733208..e6b7bc3f3fc5 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -39,53 +39,49 @@ #include "common/textconsole.h" -//#include "fileunit.h" -//#include "basher.h" - - namespace Avalanche { Enid::Enid(AvalancheEngine *vm) { _vm = vm; } -const Common::String Enid::crlf = Common::String(char(15)) + Common::String(char(12)); -const char Enid::tab = '\t'; -const char Enid::eof_ = '\n'; +const Common::String Enid::kCrlf = Common::String(char(15)) + Common::String(char(12)); +const char Enid::kTab = '\t'; +const char Enid::kEof = '\n'; -const Common::String Enid::ednafirst = +const Common::String Enid::kEdnaFirst = Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + // 64 - crlf + eof_ + crlf + crlf + // 7 - tab + "Glory to God in the highest," + crlf + // 31 - tab + "and on earth peace, goodwill toward men." + // 42 - crlf + tab + tab + tab + tab + // 6 + kCrlf + kEof + kCrlf + kCrlf + // 7 + kTab + "Glory to God in the highest," + kCrlf + // 31 + kTab + "and on earth peace, goodwill toward men." + // 42 + kCrlf + kTab + kTab + kTab + kTab + // 6 "Luke 2:14." + // 10 - crlf + crlf + crlf + // 6 - "1234567890" +crlf; // 11 + kCrlf + kCrlf + kCrlf + // 6 + "1234567890" +kCrlf; // 11 -const Common::String Enid::ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); +const Common::String Enid::kEdnaId = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); -const int16 Enid::ttage = 18; -const Common::String Enid::ttwashere = "Thomas was here "; +const int16 Enid::kAge = 18; +const Common::String Enid::kWasHere = "Thomas was here "; -const Enid::fourtype Enid::avaricius_file = "Avvy"; +const Enid::FourType Enid::kAvariciusFile = "Avvy"; void Enid::addon(Common::String x) { //month[0]--; - month = month + x; + _month = _month + x; } -Common::String Enid::expanddate(byte d, byte m, uint16 y) { +Common::String Enid::expandDate(byte d, byte m, uint16 y) { const Common::String months[12] = { "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", "Septem*", "Octo*", "Novem*", "Decem*" }; Common::String expanddate_result; - month = months[m]; - switch (month[month.size()]) { + _month = months[m]; + switch (_month[_month.size()]) { case '#': addon("uary"); break; @@ -94,34 +90,34 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { break; } - day = _vm->_gyro->strf(d); + _day = _vm->_gyro->strf(d); // d is always positive if ((d <= 9) || ((d >= 21) && (d <= 31))) { switch (d % 10) { case 1: - day = day + "st"; + _day = _day + "st"; break; case 2: - day = day + "nd"; + _day = _day + "nd"; break; case 3: - day = day + "rd"; + _day = _day + "rd"; break; default: - day = day + "th"; + _day = _day + "th"; } } - expanddate_result = day + ' ' + month + ' ' + _vm->_gyro->strf(y); + expanddate_result = _day + ' ' + _month + ' ' + _vm->_gyro->strf(y); return expanddate_result; } -void Enid::show_bug(char icon, Common::String strn) { +void Enid::showBug(char icon, Common::String strn) { _vm->_scrolls->display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); } -bool Enid::test_bug(byte what) { +bool Enid::testBug(byte what) { bool test_bug_result; if (what == 0) { test_bug_result = false; @@ -129,47 +125,47 @@ bool Enid::test_bug(byte what) { } switch (what) { case 2: - show_bug('7', "Error in filename!"); + showBug('7', "Error in filename!"); break; case 101: - show_bug('6', "Disk full!"); + showBug('6', "Disk full!"); break; case 150: - show_bug('4', "Disk is write-protected!"); + showBug('4', "Disk is write-protected!"); break; default: - show_bug('B', "Saving error!"); + showBug('B', "Saving error!"); } test_bug_result = true; return test_bug_result; } -void Enid::edna_save(Common::String name) { - warning("STUB: Enid::edna_save()"); +void Enid::ednaSave(Common::String name) { + warning("STUB: Enid::ednaSave()"); } -void Enid::loaderror(Common::String x, char icon) { +void Enid::loadError(Common::String x, char icon) { if (_vm->_gyro->holdthedawn) { _vm->_gyro->holdthedawn = false; _vm->_lucerna->dawn(); } _vm->_scrolls->display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); - bug = true; + _bug = true; } -void Enid::edna_load(Common::String name) { - warning("STUB: Enid::edna_load()"); +void Enid::ednaLoad(Common::String name) { + warning("STUB: Enid::ednaLoad()"); } -void Enid::showheader() { - _vm->_scrolls->display(Common::String("Dir: ") + path + "\r\r\4"); +void Enid::showHeader() { + _vm->_scrolls->display(Common::String("Dir: ") + _path + "\r\r\4"); } void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! warning("STUB: Enid::dir()"); } -void Enid::avvy_background() { +void Enid::avvyBackground() { // Not really a filing procedure, // but it's only called just before edna_load, so I thought I'd put it // in Enid instead of, say, Lucerna. @@ -251,30 +247,30 @@ void Enid::avvy_background() { #endif } -void Enid::to_sundry(sundry &sund) { +void Enid::toSundry(sundry &sund) { sund.qenid_filename = _vm->_gyro->enid_filename; sund.qsoundfx = _vm->_gyro->soundfx; sund.qthinks = _vm->_gyro->thinks; sund.qthinkthing = _vm->_gyro->thinkthing; } -void Enid::from_sundry(sundry sund) { +void Enid::fromSundry(sundry sund) { _vm->_gyro->enid_filename = sund.qenid_filename; _vm->_gyro->soundfx = sund.qsoundfx; _vm->_gyro->thinks = sund.qthinks; _vm->_gyro->thinkthing = sund.qthinkthing; } -void Enid::restore_dna() { +void Enid::restoreDna() { // uint16 here, fv; // sundry sund; - warning("STUB: Enid::restore_dna()"); + warning("STUB: Enid::restoreDna()"); } -void Enid::edna_reload() { +void Enid::ednaReload() { - restore_dna(); + restoreDna(); _vm->_gyro->seescroll = true; // This prevents display of the new sprites before the // new picture is loaded. @@ -293,12 +289,12 @@ void Enid::edna_reload() { } } -void Enid::back_to_bootstrap(byte what) { +void Enid::backToBootstrap(byte what) { warning("STUB: Enid::back_to_bootstrap()"); } -bool Enid::there_was_a_problem() { - return bug; +bool Enid::thereWasAProblem() { + return _bug; } diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 2237d352afa2..6f76a7471887 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -32,72 +32,48 @@ #include "common/scummsys.h" - namespace Avalanche { class AvalancheEngine; class Enid { public: Enid(AvalancheEngine *vm); - - void edna_save(Common::String name); - - void edna_load(Common::String name); - - void edna_reload(); // From Bootstrap's storage. - + void ednaSave(Common::String name); + void ednaLoad(Common::String name); + void ednaReload(); // From Bootstrap's storage. void dir(Common::String where); - - void avvy_background(); - - void back_to_bootstrap(byte what); - - bool there_was_a_problem(); + void avvyBackground(); + void backToBootstrap(byte what); + bool thereWasAProblem(); private: AvalancheEngine *_vm; - static const Common::String crlf; - static const char tab; - static const char eof_; - - static const Common::String ednafirst; - - static const Common::String ednaid; - - static const int16 ttage; - static const Common::String ttwashere; - - typedef char fourtype[5]; - static const fourtype avaricius_file; - - - - bool bug; - - Common::String path, groi; - - Common::String month; - Common::String day; + static const Common::String kCrlf; + static const char kTab, kEof; + static const Common::String kEdnaFirst, kEdnaId, kWasHere; + static const int16 kAge; + typedef char FourType[5]; + static const FourType kAvariciusFile; + bool _bug; + Common::String _path, _groi; + Common::String _month, _day; void addon(Common::String x); - Common::String expanddate(byte d, byte m, uint16 y); - - void show_bug(char icon, Common::String strn); - bool test_bug(byte what); - - void loaderror(Common::String x, char icon); + Common::String expandDate(byte d, byte m, uint16 y); - void showheader(); + void showBug(char icon, Common::String strn); + bool testBug(byte what); - void to_sundry(sundry &sund); - void from_sundry(sundry sund); + void loadError(Common::String x, char icon); + void showHeader(); - void restore_dna(); + void toSundry(sundry &sund); + void fromSundry(sundry sund); - + void restoreDna(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 3a2271a3842d..078963aca6e4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -337,7 +337,7 @@ void Timeout::hang_around2() { _vm->_gyro->dna.tied_up = false; - _vm->_enid->back_to_bootstrap(1); // Call the shoot-'em-up. + _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. } void Timeout::after_the_shootemup() { diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 790619e72a0d..7b13f1383362 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -878,7 +878,7 @@ void Trip::call_special(uint16 which) { _vm->_lucerna->dusk(); tr[0].turn(right); // you'll see this after we get back from bootstrap _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); - _vm->_enid->back_to_bootstrap(3); + _vm->_enid->backToBootstrap(3); break; case 5: if (_vm->_gyro->dna.friar_will_tie_you_up) { From 390ecc6a6b1eb65a3c0e1ba68d907afaeb9778b7 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 13:20:03 +0200 Subject: [PATCH 0821/1332] AVALANCHE: Do renaming/refactoring in Graphics. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/celer2.cpp | 2 +- engines/avalanche/dropdown2.cpp | 6 +-- engines/avalanche/graphics.cpp | 85 ++++++++++++--------------------- engines/avalanche/graphics.h | 69 ++++++++------------------ engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 6 +-- engines/avalanche/parser.cpp | 6 +-- engines/avalanche/scrolls2.cpp | 4 +- engines/avalanche/scrolls2.h | 2 +- engines/avalanche/trip6.cpp | 64 ++++++++++++------------- 11 files changed, 97 insertions(+), 151 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index bd5ea8b4d0e2..9af099bd2b94 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -313,7 +313,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_trip->tr[i].visible); sz.syncAsByte(_trip->tr[i].homing); sz.syncAsByte(_trip->tr[i].count); - sz.syncAsByte(_trip->tr[i]._info.xw); + sz.syncAsByte(_trip->tr[i]._info._xWidth); sz.syncAsByte(_trip->tr[i].xs); sz.syncAsByte(_trip->tr[i].ys); sz.syncAsByte(_trip->tr[i].totalnum); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 5d7dacf4e7f6..05065d5c65c8 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -304,7 +304,7 @@ void Celer::loadBackgroundSprites(byte number) { for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) - *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y); + *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(_sprites[i]._x * 8 + x, _sprites[i]._y + y); } } else { _sprites[i]._size = sprite._size; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 282f2f888f2d..53357691b91d 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -236,7 +236,7 @@ void MenuBar::draw() { //setactivepage(3); - _dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->kMenuBackgroundColor); + _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); byte savecp = _dr->_vm->_gyro->cp; _dr->_vm->_gyro->cp = 3; @@ -331,7 +331,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, else ander = 170; - fontType font; + FontType font; for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < 8; j++) { byte idx = text[i]; @@ -355,7 +355,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) - *_vm->_graphics->getPixel(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; + *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; } } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0546ca59671c..f7067c6bc62a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -41,12 +41,18 @@ namespace Avalanche { const byte Graphics::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; - - Graphics::Graphics(AvalancheEngine *vm) { _vm = vm; } +Graphics::~Graphics() { + _surface.free(); + _magics.free(); + _background.free(); + _screen.free(); + _scrolls.free(); +} + void Graphics::init() { initGraphics(kScreenWidth, kScreenHeight * 2, true); // Doubling the height. @@ -60,63 +66,17 @@ void Graphics::init() { g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - _screen.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); - _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } -Graphics::~Graphics() { - _surface.free(); - _magics.free(); - _background.free(); - _screen.free(); - _scrolls.free(); -} - - -void Graphics::flesh_colors() +void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } - -byte *Graphics::getPixel(int16 x, int16 y) { - return (byte *)_surface.getBasePtr(x, y); -} - -void Graphics::drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { - _surface.frameRect(Common::Rect(x1, y1, x2, y2), color); -} - -void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { - _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); -} - -void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - // First we make the pixels of the spirte blank. - for (byte j = 0; j < sprite.yl; j++) - for (byte i = 0; i < sprite.xl; i++) - if (((*sprite.sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) - *getPixel(x + i, y + j) = 0; - - // Then we draw the picture to the blank places. - uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - - for (byte j = 0; j < sprite.yl; j++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. - for (uint16 i = 0; i < sprite.xl; i += 8) { - byte pixel = (*sprite.mani[picnum])[maniPos++]; - for (byte bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *getPixel(x + i + 7 - bit, y + j) += (pixelBit << plane); - } - } -} - Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { Common::Point endPoint; const double pi = 3.14; @@ -247,9 +207,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color); } - - -void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color) { +void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { for (byte i = 0; i < text.size(); i++) for (byte j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; @@ -261,8 +219,6 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text } } - - ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. @@ -309,6 +265,27 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } +void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { + // First we make the pixels of the spirte blank. + for (byte j = 0; j < sprite._yLength; j++) + for (byte i = 0; i < sprite._xLength; i++) + if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) + *(byte *)_surface.getBasePtr(x + i, y + j) = 0; + + // Then we draw the picture to the blank places. + uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. + + for (byte j = 0; j < sprite._yLength; j++) + for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (uint16 i = 0; i < sprite._xLength; i += 8) { + byte pixel = (*sprite._mani[picnum])[maniPos++]; + for (byte bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); + } + } +} + void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ac9e8bf91d98..ad6a68252b8f 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -36,89 +36,57 @@ namespace Avalanche { class AvalancheEngine; -typedef byte fontType[256][16]; // raw font type +typedef byte FontType[256][16]; // raw font type -typedef byte manitype[2049]; // manitype = array[5..2053] of byte; +typedef byte ManiType[2049]; // manitype = array[5..2053] of byte; // Be aware!!! -typedef byte siltype[51][11]; // 35, 4 +typedef byte SilType[51][11]; // 35, 4 class SpriteInfo { public: - byte xw; // x-width in bytes - byte xl, yl; // x & y lengths of pictures - - manitype *mani[24]; - siltype *sil[24]; - - uint16 size; // the size of one picture + byte _xWidth; + byte _xLength, _yLength; + ManiType *_mani[24]; + SilType *_sil[24]; + uint16 _size; // The size of one picture. }; - class Graphics { public: static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; - static const uint16 kBackgroundWidth = kScreenWidth; - static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151 + static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). ::Graphics::Surface _surface; - ::Graphics::Surface _background; - - ::Graphics::Surface _magics; - // Lucerna::draw_also_lines() draws the "magical" lines here. - // Further information: https://github.com/urukgit/avalot/wiki/Also - - ::Graphics::Surface _screen; - + ::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also ::Graphics::Surface _scrolls; - - Graphics(AvalancheEngine *vm); - - void init(); - ~Graphics(); - - void flesh_colors(); - - byte *getPixel(int16 x, int16 y); - - void drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - - void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color); - - void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - - Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + void init(); + void fleshColors(); + // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) // TODO: Make it more accurate later. - + Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); - void drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color); - - - - void drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color); - - + void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color); // The caller has to .free() the returned Surfaces!!! + // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. - ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. - // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data + void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. - void refreshScreen(); - void refreshBackground(); private: @@ -127,6 +95,7 @@ class Graphics { static const byte kEgaPaletteIndex[16]; byte _egaPalette[64][3]; + ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) }; } // End of namespace Avalanche diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index d70072777e43..c11eb389cb28 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -522,7 +522,7 @@ class Gyro { Common::String atkey; // For XTs, set to "alt-". For ATs, set to "f1". byte cp, ledstatus, defaultled; - fontType characters; + FontType characters; bool alive; byte buffer[2000]; uint16 bufsize; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f225d0263edd..4673a5f19562 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -223,7 +223,7 @@ void Lucerna::load(byte n) { // Load2, actually CursorMan.showMouse(false); - _vm->_graphics->flesh_colors(); + _vm->_graphics->fleshColors(); xx = _vm->_gyro->strf(n); Common::String filename; @@ -1017,14 +1017,14 @@ void Lucerna::verte(Common::Point cursorPos) { // _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.) if (cursorPos.x < _vm->_trip->tr[0].x) what = 1; - else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info.xl)) + else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) what = 2; else what = 0; // On top if (cursorPos.y < _vm->_trip->tr[0].y) what += 3; - else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info.yl)) + else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info._yLength)) what += 6; switch (what) { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 737bf87088d1..fc705abcd5db 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -113,7 +113,7 @@ void Parser::plotText() { cursorOff(); - _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. + _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text. _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, white); @@ -149,7 +149,7 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) { void Parser::drawCursor() { // Draw the '_' character. for (byte bit = 0; bit < 8; bit++) - *_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 168) = white; + *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = white; bytefield bf; bf.x1 = _inputTextPos + 1; @@ -166,7 +166,7 @@ void Parser::wipeText() { cursorOff(); - _vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text. + _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text. _quote = true; _inputTextPos = 0; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 3994f5656965..143dd19a4b04 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -72,7 +72,7 @@ void Scrolls::state(byte x) { // Sets "Ready" light to whatever CursorMan.showMouse(false); - _vm->_graphics->drawBar(419, 195, 438, 197, color); + _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); _vm->_gyro->ledstatus = x; @@ -83,7 +83,7 @@ void Scrolls::easteregg() { } void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwriting - fontType itw; + FontType itw; byte lz = z.size(); bool offset = x % 8 == 4; diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 910285c65a6c..0238d33b16db 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -92,7 +92,7 @@ class Scrolls { void musical_scroll(); - fontType ch[2]; + FontType ch[2]; private: AvalancheEngine *_vm; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 7b13f1383362..3f9c66c79a65 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -88,28 +88,28 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { inf.skip(16 - commentSize); a.num = inf.readByte(); - _info.xl = inf.readByte(); - _info.yl = inf.readByte(); + _info._xLength = inf.readByte(); + _info._yLength = inf.readByte(); a.seq = inf.readByte(); - _info.size = inf.readUint16LE(); + _info._size = inf.readUint16LE(); a.fgc = inf.readByte(); a.bgc = inf.readByte(); a.accinum = inf.readByte(); totalnum = 0; // = 1; - _info.xw = _info.xl / 8; - if ((_info.xl % 8) > 0) - _info.xw++; + _info._xWidth = _info._xLength / 8; + if ((_info._xLength % 8) > 0) + _info._xWidth++; for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { - _info.sil[totalnum] = new siltype[11 * (_info.yl + 1)]; + _info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)]; //getmem(sil[totalnum-1], 11 * (a.yl + 1)); - _info.mani[totalnum] = new manitype[_info.size - 6]; + _info._mani[totalnum] = new ManiType[_info._size - 6]; //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= _info.yl; fv++) - inf.read((*_info.sil[totalnum])[fv], _info.xw); + for (fv = 0; fv <= _info._yLength; fv++) + inf.read((*_info._sil[totalnum])[fv], _info._xWidth); //blockread(inf, (*sil[totalnum-1])[fv], xw); - inf.read(*_info.mani[totalnum], _info.size - 6); + inf.read(*_info._mani[totalnum], _info._size - 6); //blockread(inf, *mani[totalnum-1], a.size - 6); totalnum++; @@ -173,8 +173,8 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { bool triptype::collision_check() { for (byte fv = 0; fv < _tr->numtr; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && - ((x + _info.xl) > _tr->tr[fv].x) && - (x < (_tr->tr[fv].x + _tr->tr[fv]._info.xl)) && + ((x + _info._xLength) > _tr->tr[fv].x) && + (x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) && (_tr->tr[fv].y == y)) return true; @@ -191,8 +191,8 @@ void triptype::walk() { if (r.x1 == 255) r.x1 = 0; r.y1 = y - 2; - r.x2 = ((x + _info.xl) / 8) + 1; - r.y2 = y + _info.yl + 2; + r.x2 = ((x + _info._xLength) / 8) + 1; + r.y2 = y + _info._yLength + 2; _tr->getset[1 - _tr->_vm->_gyro->cp].remember(r); } @@ -212,7 +212,7 @@ void triptype::walk() { return; } - tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1; + tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->cp], y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { @@ -279,8 +279,8 @@ int8 triptype::sgn(int16 val) { void triptype::walkto(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. speed(sgn(_tr->_vm->_gyro->peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro->peds[pednum].y - y)); - hx = _tr->_vm->_gyro->peds[pednum].x - _info.xl / 2; - hy = _tr->_vm->_gyro->peds[pednum].y - _info.yl; + hx = _tr->_vm->_gyro->peds[pednum].x - _info._xLength / 2; + hy = _tr->_vm->_gyro->peds[pednum].y - _info._yLength; homing = true; } @@ -344,7 +344,7 @@ void triptype::stopwalk() { } void triptype::chatter() { - _tr->_vm->_gyro->talkx = x + _info.xl / 2; + _tr->_vm->_gyro->talkx = x + _info._xLength / 2; _tr->_vm->_gyro->talky = y; _tr->_vm->_gyro->talkf = a.fgc; _tr->_vm->_gyro->talkb = a.bgc; @@ -362,7 +362,7 @@ void triptype::set_up_saver(trip_saver_type &v) { v.homing = homing; v.check_me = check_me; v.count = count; - v.xw = _info.xw; + v.xw = _info._xWidth; v.xs = xs; v.ys = ys; v.totalnum = totalnum; @@ -385,7 +385,7 @@ void triptype::unload_saver(trip_saver_type v) { homing = v.homing; check_me = v.check_me; count = v.count; - _info.xw = v.xw; + _info._xWidth = v.xw; xs = v.xs; ys = v.ys; totalnum = v.totalnum; @@ -417,13 +417,13 @@ triptype *triptype::done() { // nds:=num div seq; totalnum--; - _info.xw = _info.xl / 8; - if ((_info.xl % 8) > 0) - _info.xw++; + _info._xWidth = _info._xLength / 8; + if ((_info._xLength % 8) > 0) + _info._xWidth++; for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) { totalnum--; - delete[] _info.mani[totalnum]; - delete[] _info.sil[totalnum]; + delete[] _info._mani[totalnum]; + delete[] _info._sil[totalnum]; } quick = false; @@ -1115,7 +1115,7 @@ void Trip::rwsp(byte t, byte dir) { void Trip::apped(byte trn, byte np) { trn--; np--; - tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info.xl / 2, _vm->_gyro->peds[np].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir); + tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info._xLength / 2, _vm->_gyro->peds[np].y - tr[trn]._info._yLength, _vm->_gyro->peds[np].dir); rwsp(trn, _vm->_gyro->peds[np].dir); } @@ -1206,9 +1206,9 @@ void Trip::arrow_procs(byte tripnum) { // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[0].y) // A - && (tr[tripnum].x <= (tr[0].x + tr[0]._info.xl)) // B - && ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[0].x)) { // C + if (((tr[tripnum].y + tr[tripnum]._info._yLength) >= tr[0].y) // A + && (tr[tripnum].x <= (tr[0].x + tr[0]._info._xLength)) // B + && ((tr[tripnum].x + tr[tripnum]._info._xLength) >= tr[0].x)) { // C // OK, it's hit him... what now? tr[1].call_eachstep = false; // prevent recursion. @@ -1547,7 +1547,7 @@ void Trip::fliproom(byte room, byte ped) { bool Trip::infield(byte which) { which--; // Pascal -> C: different array indexes. - int16 yy = tr[0].y + tr[0]._info.yl; + int16 yy = tr[0].y + tr[0]._info._yLength; return (tr[0].x >= _vm->_gyro->fields[which].x1) && (tr[0].x <= _vm->_gyro->fields[which].x2) && (yy >= _vm->_gyro->fields[which].y1) && (yy <= _vm->_gyro->fields[which].y2); @@ -1561,7 +1561,7 @@ bool Trip::neardoor() { } int16 ux = tr[0].x; - int16 uy = tr[0].y + tr[0]._info.yl; + int16 uy = tr[0].y + tr[0]._info._yLength; bool nd = false; for (byte fv = 8; fv < _vm->_gyro->numfields; fv++) if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2) From 3de1b45b62168b39824a6311344ded0edcf04cf3 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 13:29:16 +0200 Subject: [PATCH 0822/1332] AVALANCHE: Repair memory leaks in Dropdown. --- engines/avalanche/dropdown2.cpp | 6 +++++- engines/avalanche/lucerna2.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 53357691b91d..793fc91114cc 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -762,6 +762,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); _vm->_lucerna->holdLeftMouse = false; + backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). } @@ -775,6 +776,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_lucerna->holdLeftMouse = false; + backup.free(); return; } else { _vm->_lucerna->holdLeftMouse = true; @@ -800,8 +802,10 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... uint16 which = (cursorPos.y - 26) / 20; _activeMenuItem.select(which); - if (_activeMenuItem._options[which]._valid) // If the menu item wasn't active, we do nothing. + if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing. + backup.free(); return; + } } } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 4673a5f19562..4c9997e0919d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -58,8 +58,8 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { } Lucerna::~Lucerna() { - for (byte i = 0; i < 31; i++) - for (byte j = 0; j < 2; j++) + for (int i = 0; i < 31; i++) + for (int j = 0; j < 2; j++) delete _vm->_gyro->also[i][j]; } From 2d99f5bfc6cd0aab348147f6ddfc4fc47a88af2b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 14:44:55 +0200 Subject: [PATCH 0823/1332] AVALANCHE: Repair some initialization to silence Valgrind warnings. --- engines/avalanche/avalot.cpp | 1 + engines/avalanche/lucerna2.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b1b5fe880b35..a51d9e62e303 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -167,6 +167,7 @@ void Avalot::setup() { _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); + _vm->_trip->tr[0].xs = _vm->_gyro->walk; _vm->_trip->newspeed(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 4c9997e0919d..f026f040a192 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -64,8 +64,8 @@ Lucerna::~Lucerna() { } void Lucerna::init() { - _vm->_gyro->oh = 17717; - _vm->_gyro->om = 17717; + _vm->_gyro->oh = _vm->_gyro->onh = _vm->_gyro->om = 17717; + #if 0 if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; From 63d1d289a561c62e13747690096db6fbe8f828c8 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 15:09:13 +0200 Subject: [PATCH 0824/1332] AVALANCHE: Silence more Valgrind warnings. --- engines/avalanche/lucerna2.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f026f040a192..2fce07f9f769 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -58,14 +58,21 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { } Lucerna::~Lucerna() { - for (int i = 0; i < 31; i++) - for (int j = 0; j < 2; j++) - delete _vm->_gyro->also[i][j]; + for (byte i = 0; i < 31; i++) + for (byte j = 0; j < 2; j++) + if (_vm->_gyro->also[i][j] != 0) { + delete _vm->_gyro->also[i][j]; + _vm->_gyro->also[i][j] = 0; + } } void Lucerna::init() { _vm->_gyro->oh = _vm->_gyro->onh = _vm->_gyro->om = 17717; + for (byte i = 0; i < 31; i++) + for (byte j = 0; j < 2; j++) + _vm->_gyro->also[i][j] = 0; + #if 0 if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; From 3b10b079f7da6dab9a6d1f86aa46d33408ac5761 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 15:48:30 +0200 Subject: [PATCH 0825/1332] AVALANCHE: Silence Valgrind warnings. --- engines/avalanche/acci2.cpp | 4 ++-- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/dropdown2.cpp | 2 ++ engines/avalanche/gyro2.cpp | 4 ++-- engines/avalanche/lucerna2.cpp | 4 ++-- engines/avalanche/scrolls2.cpp | 4 ++-- engines/avalanche/trip6.cpp | 7 +++++++ engines/avalanche/trip6.h | 2 ++ 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 520b2a8e9910..8f852ddb6085 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1320,8 +1320,8 @@ void Acci::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) - && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) - && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { + && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) + && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->alive) { _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); return; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 9af099bd2b94..605932be57d0 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -62,7 +62,6 @@ AvalancheEngine::~AvalancheEngine() { delete _parser; delete _avalot; - delete _gyro; delete _pingo; delete _scrolls; delete _visa; @@ -75,6 +74,7 @@ AvalancheEngine::~AvalancheEngine() { delete _acci; delete _dropdown; delete _closing; + delete _gyro; } Common::ErrorCode AvalancheEngine::initialize() { diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 793fc91114cc..d15bebb0d08c 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -615,12 +615,14 @@ void Dropdown::runMenuAction() { } break; case 1: + _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callverb(_vm->_acci->kVerbCodePause); break; case 2: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); break; case 3: + _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callverb(_vm->_acci->kVerbCodeLook); break; case 4: diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 62ffca81d811..aa28f200317b 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -331,6 +331,7 @@ void Gyro::newgame() { dna.obj[bell - 1] = true; dna.obj[clothes - 1] = true; + thinkthing = true; thinks = 2; _vm->_lucerna->objectlist(); ontoolbar = false; @@ -383,8 +384,7 @@ bool Gyro::flagset(char x) { } void Gyro::force_numlock() { - if ((locks & numlockCode) > 0) - locks -= numlockCode; + warning("STUB: Gyro::force_numlock()"); } bool Gyro::pennycheck(uint16 howmuchby) { diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 2fce07f9f769..e7ef5a1df5de 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1071,8 +1071,8 @@ void Lucerna::checkclick() { Common::Point cursorPos = _vm->getMousePos(); _vm->_gyro->ontoolbar = _vm->_gyro->slow_computer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); - if (_vm->_gyro->mrelease > 0) - _vm->_gyro->after_the_scroll = false; + /*if (_vm->_gyro->mrelease > 0) + _vm->_gyro->after_the_scroll = false;*/ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) _vm->_gyro->newpointer(1); // up arrow diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 143dd19a4b04..62b8b5e21594 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -461,8 +461,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t CursorMan.showMouse(true); //settextjustify(0, 0); // sink resetscrolldriver(); - if (_vm->_gyro->mpress > 0) - _vm->_gyro->after_the_scroll = true; + /*if (_vm->_gyro->mpress > 0) + _vm->_gyro->after_the_scroll = true;*/ warning("STUB: Scrolls::drawscroll()"); } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 3f9c66c79a65..2444d432e542 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -460,6 +460,13 @@ Trip::Trip(AvalancheEngine *vm) { mustexclaim = false; } +Trip::~Trip() { + for (byte i = 0; i < numtr; i++) { + if (tr[i].quick) + tr[i].done(); + } +} + void Trip::loadtrip() { for (int16 gm = 0; gm < numtr; gm++) tr[gm].original(); diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 1c5c6db19a1f..e3ed44fe43d8 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -182,6 +182,8 @@ class Trip { Trip(AvalancheEngine *vm); + ~Trip(); + void trippancy_link(); void get_back_loretta(); From f3377c67e0b5548801bbf2fa93af25e7b57ae438 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Sep 2013 19:47:55 +0200 Subject: [PATCH 0826/1332] AVALANCHE: Fix initialization of kEdnaId --- engines/avalanche/enid2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index e6b7bc3f3fc5..ef5a90d46fdb 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -59,7 +59,7 @@ const Common::String Enid::kEdnaFirst = kCrlf + kCrlf + kCrlf + // 6 "1234567890" +kCrlf; // 11 -const Common::String Enid::kEdnaId = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); +const Common::String Enid::kEdnaId = Common::String("TT\xB1\x30\x01\x75\xB1\x99\xB1"); const int16 Enid::kAge = 18; const Common::String Enid::kWasHere = "Thomas was here "; From 3f822be0ab155883eebfe16839044bce46dbecb3 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 21:45:07 +0200 Subject: [PATCH 0827/1332] AVALANCHE: Silence Valgrind warnings. --- engines/avalanche/avalanche.cpp | 30 ++++++++++++++++-------------- engines/avalanche/graphics.cpp | 17 ++++++++--------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 605932be57d0..06ac30e449e5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -701,22 +701,24 @@ Common::Error AvalancheEngine::run() { do { runAvalot(); + // Needed for later implementation!!! Don't remove these comments!!! + //if (dosexitcode != 77) quit(); // Didn't stop for us. - switch (_storage._operation) { - case kRunShootemup: - run("seu.avx", kJsb, kBflight, kNormal); - break; - case kRunDosshell: - dosShell(); - break; - case kRunGhostroom: - run("g-room.avx", kJsb, kNoBflight, kNormal); - break; - case kRunGolden: - run("golden.avx", kJsb, kBflight, kMusical); - break; - } + //switch (_storage._operation) { + //case kRunShootemup: + // run("seu.avx", kJsb, kBflight, kNormal); + // break; + //case kRunDosshell: + // dosShell(); + // break; + //case kRunGhostroom: + // run("g-room.avx", kJsb, kNoBflight, kNormal); + // break; + //case kRunGolden: + // run("golden.avx", kJsb, kBflight, kMusical); + // break; + //} } while (false); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index f7067c6bc62a..eeb15ddb31f7 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -222,24 +222,24 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. - uint16 pictureWidth = file.readUint16LE() + 1; - uint16 pictureHeight = file.readUint16LE() + 1; + uint16 width = file.readUint16LE() + 1; + uint16 height = file.readUint16LE() + 1; ::Graphics::Surface picture; // We make a Surface object for the picture itself. - - picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); + picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (byte y = 0; y < pictureHeight; y++) + for (byte y = 0; y < height; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. - for (uint16 x = 0; x < pictureWidth; x += 8) { + for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + if (pixelBit != 0) + *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } - + return picture; } @@ -249,7 +249,6 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u // and we read the picture plane-by-plane. ::Graphics::Surface picture; - picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); for (byte plane = 0; plane < 4; plane++) From c1bc8eee64fa683aa47d675c68783ae26a20d25b Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 23:07:08 +0200 Subject: [PATCH 0828/1332] AVALANCHE: Rename/refactor Colors. --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/color.h | 34 +++++++++++++------------- engines/avalanche/dropdown2.cpp | 8 +++---- engines/avalanche/dropdown2.h | 12 +++++----- engines/avalanche/gyro2.cpp | 32 ++++++++++++------------- engines/avalanche/lucerna2.cpp | 40 +++++++++++++++---------------- engines/avalanche/parser.cpp | 8 +++---- engines/avalanche/scrolls2.cpp | 42 ++++++++++++++++----------------- engines/avalanche/trip6.cpp | 8 +++---- 9 files changed, 94 insertions(+), 92 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a51d9e62e303..2bc3ce346354 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -220,7 +220,7 @@ void Avalot::run(Common::String arg) { for (byte i = 0; i < _vm->_gyro->numfields; i++) { if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), lightmagenta); + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), kColorLightmagenta); } // ONLY FOR TESTING!!! #endif diff --git a/engines/avalanche/color.h b/engines/avalanche/color.h index 1a8e69da839e..c0c348f9ab0d 100644 --- a/engines/avalanche/color.h +++ b/engines/avalanche/color.h @@ -34,22 +34,24 @@ namespace Avalanche { -const byte black = 0; -const byte blue = 1; -const byte green = 2; -const byte cyan = 3; -const byte red = 4; -const byte magenta = 5; -const byte brown = 6; -const byte lightgray = 7; -const byte darkgray = 8; -const byte lightblue = 9; -const byte lightgreen = 10; -const byte lightcyan = 11; -const byte lightred = 12; -const byte lightmagenta = 13; -const byte yellow = 14; -const byte white = 15; +enum Color { + kColorBlack, + kColorBlue, + kColorGreen, + kColorCyan, + kColorRed, + kColorMagenta, + kColorBrown, + kColorLightgray, + kColorDarkgray, + kColorLightblue, + kColorLightgreen, + kColorLightcyan, + kColorLightred, + kColorLightmagenta, + kColorYellow, + kColorWhite +}; } // End of namespace Avalanche diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index d15bebb0d08c..d54e66732803 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -318,11 +318,11 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, byte fontColor; byte backgroundColor; if (highlighted) { - fontColor = white; - backgroundColor = black; + fontColor = kColorWhite; + backgroundColor = kColorBlack; } else { - fontColor = black; - backgroundColor = lightgray; + fontColor = kColorBlack; + backgroundColor = kColorLightgray; } byte ander; diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index ad9dc77501e0..4122d3fae4fb 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -133,12 +133,12 @@ class Dropdown { static const byte kIndent = 5; static const byte kSpacing = 10; - static const byte kMenuBackgroundColor = lightgray; - static const byte kMenuFontColor = black; - static const byte kMenuBorderColor = black; - static const byte kHighlightBackgroundColor = black; - static const byte kHighlightFontColor = white; - static const byte kDisabledColor = darkgray; + static const byte kMenuBackgroundColor = kColorLightgray; + static const byte kMenuFontColor = kColorBlack; + static const byte kMenuBorderColor = kColorBlack; + static const byte kHighlightBackgroundColor = kColorBlack; + static const byte kHighlightFontColor = kColorWhite; + static const byte kDisabledColor = kColorDarkgray; AvalancheEngine *_vm; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index aa28f200317b..58a38c73c09e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -164,22 +164,22 @@ const int32 Gyro::catamap[8][8] = { const char Gyro::spludwick_order[3] = {onion, ink, mushroom}; const quasiped_type Gyro::quasipeds[16] = { - {2, lightgray, 19, brown, pdogfood}, // A: Dogfood (screen 19). - {3, green, 19, white, pibythneth}, // B: Ibythneth (screen 19). - {3, white, 1, magenta, parkata}, // C: Arkata (screen 1). - {3, black, 23, red, 177}, // D: Hawk (screen 23). - {3, lightgreen, 50, brown, ptrader}, // E: Trader (screen 50). - {6, yellow, 42, red, pavalot}, // F: Avvy, tied up (scr.42) - {2, blue, 16, white, payles}, // G: Ayles (screen 16). - {2, brown, 7, white, pjacques}, // H: Jacques (screen 7). - {2, lightgreen, 47, green, pspurge}, // I: Spurge (screen 47). - {3, yellow, 47, red, pavalot}, // J: Avalot (screen 47). - {2, lightgray, 23, black, pdulustie}, // K: du Lustie (screen 23). - {2, yellow, 27, red, pavalot}, // L: Avalot (screen 27). - {3, white, 27, red, 177}, // M: Avaroid (screen 27). - {4, lightgray, 19, darkgray, pmalagauche}, // N: Malagauche (screen 19). - {5, lightmagenta, 47, red, pport}, // O: Port (screen 47). - {2, lightgreen, 51, darkgray, pdrduck} // P: Duck (screen 51). + {2, kColorLightgray, 19, kColorBrown, pdogfood}, // A: Dogfood (screen 19). + {3, kColorGreen, 19, kColorWhite, pibythneth}, // B: Ibythneth (screen 19). + {3, kColorWhite, 1, kColorMagenta, parkata}, // C: Arkata (screen 1). + {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). + {3, kColorLightgreen, 50, kColorBrown, ptrader}, // E: Trader (screen 50). + {6, kColorYellow, 42, kColorRed, pavalot}, // F: Avvy, tied up (scr.42) + {2, kColorBlue, 16, kColorWhite, payles}, // G: Ayles (screen 16). + {2, kColorBrown, 7, kColorWhite, pjacques}, // H: Jacques (screen 7). + {2, kColorLightgreen, 47, kColorGreen, pspurge}, // I: Spurge (screen 47). + {3, kColorYellow, 47, kColorRed, pavalot}, // J: Avalot (screen 47). + {2, kColorLightgray, 23, kColorBlack, pdulustie}, // K: du Lustie (screen 23). + {2, kColorYellow, 27, kColorRed, pavalot}, // L: Avalot (screen 27). + {3, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). + {4, kColorLightgray, 19, kColorDarkgray, pmalagauche}, // N: Malagauche (screen 19). + {5, kColorLightmagenta, 47, kColorRed, pport}, // O: Port (screen 47). + {2, kColorLightgreen, 51, kColorDarkgray, pdrduck} // P: Duck (screen 51). }; const char Gyro::keys[] = "QWERTYUIOP[]"; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e7ef5a1df5de..fe604cc70a29 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -446,7 +446,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) put_geida_at(5, ped); if (_vm->_gyro->dna.cwytalot_gone) { - _vm->_gyro->magics[lightred - 1].op = _vm->_gyro->nix; + _vm->_gyro->magics[kColorLightred - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; } else { if (ped > 0) { @@ -486,7 +486,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.drawbridge_open == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); - _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; // You may enter the drawbridge. + _vm->_gyro->magics[kColorGreen - 1].op = _vm->_gyro->nix; // You may enter the drawbridge. } if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); // load Geida @@ -628,7 +628,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->magics[brown - 1].op = _vm->_gyro->nix; + _vm->_gyro->magics[kColorBrown - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { @@ -960,34 +960,34 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { byte col = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); switch (col) { - case green: { + case kColorGreen: { _vm->_gyro->dna.rw = _vm->_trip->up; _vm->_trip->rwsp(0, _vm->_trip->up); showrw(); } break; - case brown: { + case kColorBrown: { _vm->_gyro->dna.rw = _vm->_trip->down; _vm->_trip->rwsp(0, _vm->_trip->down); showrw(); } break; - case cyan: { + case kColorCyan: { _vm->_gyro->dna.rw = _vm->_trip->left; _vm->_trip->rwsp(0, _vm->_trip->left); showrw(); } break; - case lightmagenta: { + case kColorLightmagenta: { _vm->_gyro->dna.rw = _vm->_trip->right; _vm->_trip->rwsp(0, _vm->_trip->right); showrw(); } break; - case red: - case white: - case lightcyan: - case yellow: { // Fall-throughs are intended. + case kColorRed: + case kColorWhite: + case kColorLightcyan: + case kColorYellow: { // Fall-throughs are intended. _vm->_trip->stopwalking(); showrw(); } @@ -1243,15 +1243,15 @@ void Lucerna::refresh_hands() { void Lucerna::plothands() { // off; //setactivepage(3); - calchand(_vm->_gyro->onh, 14, ah, yellow); - calchand(_vm->_gyro->om * 6, 17, am, yellow); - hand(ah, brown); - hand(am, brown); - - calchand(nh, 14, ah, brown); - calchand(_vm->_gyro->minutes * 6, 17, am, brown); - hand(ah, yellow); - hand(am, yellow); + calchand(_vm->_gyro->onh, 14, ah, kColorYellow); + calchand(_vm->_gyro->om * 6, 17, am, kColorYellow); + hand(ah, kColorBrown); + hand(am, kColorBrown); + + calchand(nh, 14, ah, kColorBrown); + calchand(_vm->_gyro->minutes * 6, 17, am, kColorBrown); + hand(ah, kColorYellow); + hand(am, kColorYellow); //setactivepage(1 - cp); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fc705abcd5db..c45ddf96994e 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -113,9 +113,9 @@ void Parser::plotText() { cursorOff(); - _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text. + _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, white); + _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -149,7 +149,7 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) { void Parser::drawCursor() { // Draw the '_' character. for (byte bit = 0; bit < 8; bit++) - *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = white; + *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; bytefield bf; bf.x1 = _inputTextPos + 1; @@ -166,7 +166,7 @@ void Parser::wipeText() { cursorOff(); - _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text. + _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. _quote = true; _inputTextPos = 0; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 62b8b5e21594..147bc21fe7b0 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -57,15 +57,15 @@ void Scrolls::state(byte x) { // Sets "Ready" light to whatever if (_vm->_gyro->ledstatus == x) return; // Already like that! - byte color = black; + byte color = kColorBlack; switch (x) { case 0: - color = black; + color = kColorBlack; break; // Off case 1: case 2: case 3: - color = green; + color = kColorGreen; break; // Hit a key } warning("STUB: Scrolls::state()"); @@ -107,7 +107,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwrit // We have to draw the characters one-by-one because of the accidental font changes. i++; Common::String chr(z[xx]); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, kColorBlack); } } } @@ -353,29 +353,29 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t CursorMan.showMouse(false); // The right corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, lightgray); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, lightgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, red); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, red); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorLightgray); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorLightgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); // The body of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), lightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), lightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); // The left corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, darkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, red); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, red); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, darkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, red); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, red); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); + _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); + _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); // The rear borders of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), red); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), red); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), red); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), red); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); + _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); ex = mx - lx; // int16 ey = my - ly; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 2444d432e542..6a1aeddf01aa 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1074,14 +1074,14 @@ void Trip::newspeed() { //setactivepage(3); if (tr[0].xs == _vm->_gyro->run) - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, yellow); + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, yellow); + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); if (tr[0].xs == _vm->_gyro->run) - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, lightblue); + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, lightblue); + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); //setactivepage(1 - cp); From b6306976cfcf5c1bab9b6f83f05249b8a45865d9 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 23:57:58 +0200 Subject: [PATCH 0829/1332] AVALANCHE: Start renaming in Gyro. --- engines/avalanche/acci2.cpp | 52 ++++----- engines/avalanche/avalot.cpp | 8 +- engines/avalanche/dropdown2.cpp | 16 +-- engines/avalanche/gyro2.cpp | 178 +++++++++++++----------------- engines/avalanche/gyro2.h | 162 ++++++++++------------------ engines/avalanche/lucerna2.cpp | 48 ++++----- engines/avalanche/timeout2.cpp | 20 ++-- engines/avalanche/trip6.cpp | 186 ++++++++++++++++---------------- 8 files changed, 292 insertions(+), 378 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 8f852ddb6085..05d4166407c3 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -412,7 +412,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_visa->dixi('z', 5); // His closing statement... _vm->_trip->tr[1].walkto(4); // The end of the drawbridge _vm->_trip->tr[1].vanishifstill = true; // Then go away! - _vm->_gyro->magics[1].op = _vm->_gyro->nix; + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; _vm->_gyro->dna.cardiff_things = 5; break; case 99: @@ -449,8 +449,8 @@ void Acci::parse() { } // Are we being interrogated right now? - if (_vm->_gyro->interrogation > 0) { - storeInterrogation(_vm->_gyro->interrogation); + if (_vm->_gyro->_interrogation > 0) { + storeInterrogation(_vm->_gyro->_interrogation); _vm->_gyro->weirdword = true; return; } @@ -623,7 +623,7 @@ void Acci::parse() { void Acci::examineObject() { if (_thing != _vm->_gyro->thinks) - _vm->_lucerna->thinkabout(_thing, _vm->_gyro->a_thing); + _vm->_lucerna->thinkabout(_thing, _vm->_gyro->kThing); switch (_thing) { case Gyro::wine : switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine. @@ -650,7 +650,7 @@ void Acci::examineObject() { } bool Acci::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->whereis[_person - 150] == _vm->_gyro->dna.room)) + if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->dna.room)) return true; else { if (_person < 175) @@ -665,7 +665,7 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". void Acci::exampers() { if (isPersonHere()) { if (_thing != _vm->_gyro->thinks) - _vm->_lucerna->thinkabout(_person, _vm->_gyro->a_person); + _vm->_lucerna->thinkabout(_person, _vm->_gyro->kPerson); _person -= 149; switch (_person) { // Special cases case 11: @@ -826,7 +826,7 @@ void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->dna.room) numPeople++; } @@ -835,7 +835,7 @@ void Acci::peopleInRoom() { byte actPerson = 0; // Actually listed people. for (byte i = 1; i < 29; i++) { - if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) { + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->dna.room) { actPerson++; if (actPerson == 1) // First on the list. _vm->_scrolls->display(_vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); @@ -923,23 +923,23 @@ void Acci::openDoor() { fv -= 8; switch (_vm->_gyro->portals[fv].op) { - case Gyro::exclaim: + case Gyro::kMagicExclaim: _vm->_trip->tr[0].bounce(); _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); break; - case Gyro::transport: + case Gyro::kMagicTransport: _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8, // High byte (_vm->_gyro->portals[fv].data) & 0x0F // Low byte ); break; - case Gyro::unfinished: + case Gyro::kMagicUnfinished: _vm->_trip->tr[0].bounce(); _vm->_scrolls->display("Sorry. This place is not available yet!"); break; - case Gyro::special: + case Gyro::kMagicSpecial: _vm->_trip->call_special(_vm->_gyro->portals[fv].data); break; - case Gyro::mopendoor: + case Gyro::kMagicOpenDoor: _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv + 9); break; } @@ -1038,7 +1038,7 @@ void Acci::putProc() { void Acci::notInOrder() { _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") - + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + + _vm->_gyro->get_better(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick]) + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } @@ -1053,7 +1053,7 @@ void Acci::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Acci::giveToSpludwick() { - if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != _thing) { + if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick] != _thing) { notInOrder(); return false; } @@ -1142,7 +1142,7 @@ void Acci::standUp() { _vm->_trip->tr[0].visible = true; _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip->apped(1, 2); - _vm->_gyro->dna.rw = _vm->_gyro->left; + _vm->_gyro->dna.rw = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = false; @@ -1267,13 +1267,13 @@ void Acci::winSequence() { void Acci::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) + if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) _person = _vm->_gyro->her; else _person = _vm->_gyro->him; } - if (_vm->_gyro->whereis[_person - 150] != _vm->_gyro->dna.room) { + if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->dna.room) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! return; } @@ -1289,7 +1289,7 @@ void Acci::personSpeaks() { if (!found) { for (byte i = 0; i < 16; i++) { - if ((_vm->_gyro->quasipeds[i].who == _person) && (_vm->_gyro->quasipeds[i].room == _vm->_gyro->dna.room)) + if ((_vm->_gyro->kQuasipeds[i].who == _person) && (_vm->_gyro->kQuasipeds[i].room == _vm->_gyro->dna.room)) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); } } @@ -1506,7 +1506,7 @@ void Acci::doThat() { _vm->_scrolls->display("Vandalism is prohibited within this game!"); break; case kVerbCodeQuit: // quit - if (_vm->_gyro->demo) { + if (_vm->_gyro->kDemo) { warning("STUB: Acci::doThat() - case kVerbCodequit"); // _vm->_visa->dixi('pos', 31); // close(demofile); @@ -1632,10 +1632,10 @@ void Acci::doThat() { case Gyro::lute : _vm->_visa->dixi('U', 7); - if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) _vm->_visa->dixi('U', 10); - if (_vm->_gyro->whereis[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) _vm->_visa->dixi('U', 15); break; case 52: @@ -1699,7 +1699,7 @@ void Acci::doThat() { else { if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! _vm->_visa->dixi('q', 17); - if (_vm->_gyro->whereis[1] == 12) + if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->dixi('q', 18); else { _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius @@ -1842,7 +1842,7 @@ void Acci::doThat() { case kVerbCodeAttack: if ((_vm->_gyro->dna.room == r__brummieroad) && ((_person == 157) || (_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) - && (_vm->_gyro->whereis[7] == _vm->_gyro->dna.room)) { + && (_vm->_gyro->_whereIs[7] == _vm->_gyro->dna.room)) { switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: @@ -1861,12 +1861,12 @@ void Acci::doThat() { _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = false; _vm->_lucerna->objectlist(); - _vm->_gyro->magics[11].op = _vm->_gyro->nix; + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicNothing; _vm->_lucerna->points(7); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].call_eachstep = false; - _vm->_gyro->whereis[7] = 177; + _vm->_gyro->_whereIs[7] = 177; break; default: _vm->_visa->dixi('Q', 10); // Please try not to be so violent! diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2bc3ce346354..3f948c322470 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -153,7 +153,7 @@ void Avalot::setup() { _vm->_gyro->ledstatus = 177; _vm->_gyro->defaultled = 2; // TSkellern = 0; Replace with a more local variable sometime - _vm->_gyro->dna.rw = _vm->_gyro->stopped; + _vm->_gyro->dna.rw = _vm->_gyro->kDirectionStopped; _vm->_gyro->enid_filename = ""; // Undefined. _vm->_lucerna->toolbar(); _vm->_scrolls->state(2); @@ -167,7 +167,7 @@ void Avalot::setup() { _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_trip->tr[0].xs = _vm->_gyro->walk; + _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; _vm->_trip->newspeed(); @@ -175,7 +175,7 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _vm->_gyro->thinks = 2; // You always have money. - _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); + _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); _vm->loadGame(loadSlot); } else { @@ -184,7 +184,7 @@ void Avalot::setup() { _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; _vm->_lucerna->fxtoggle(); - _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); + _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); _vm->_visa->dixi('q', 83); // Info on the game, etc. } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index d54e66732803..a97aa1b3329f 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -459,7 +459,7 @@ void Dropdown::setupMenuAction() { _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_trip->neardoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) + if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -474,7 +474,7 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); for (byte i = 150; i <= 178; i++) - if (_vm->_gyro->whereis[i - 150] == _vm->_gyro->dna.room) { + if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->dna.room) { _activeMenuItem.setupOption(_vm->_gyro->getname(i), _vm->_gyro->getnamechar(i), "", true); people = people + i; } @@ -509,7 +509,7 @@ void Dropdown::setupMenuWith() { // or (c), the _person you've selected is YOU! if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) - || (_vm->_gyro->whereis[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) + || (_vm->_gyro->_whereIs[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); @@ -629,10 +629,10 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callverb(_vm->_acci->kVerbCodeInv); break; case 5: { - if (_vm->_trip->tr[0].xs == _vm->_gyro->walk) - _vm->_trip->tr[0].xs = _vm->_gyro->run; + if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) + _vm->_trip->tr[0].xs = _vm->_gyro->kRun; else - _vm->_trip->tr[0].xs = _vm->_gyro->walk; + _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; _vm->_trip->newspeed(); } break; @@ -640,11 +640,11 @@ void Dropdown::runMenuAction() { } void Dropdown::runMenuObjects() { - _vm->_lucerna->thinkabout(_vm->_gyro->objlist[_activeMenuItem._choiceNum + 1], _vm->_gyro->a_thing); + _vm->_lucerna->thinkabout(_vm->_gyro->objlist[_activeMenuItem._choiceNum + 1], _vm->_gyro->kThing); } void Dropdown::runMenuPeople() { - _vm->_lucerna->thinkabout(people[_activeMenuItem._choiceNum], _vm->_gyro->a_person); + _vm->_lucerna->thinkabout(people[_activeMenuItem._choiceNum], _vm->_gyro->kPerson); _vm->_gyro->last_person = people[_activeMenuItem._choiceNum]; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 58a38c73c09e..d154bb07e46f 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -51,103 +51,33 @@ const char *Gyro::vernum = "1.30"; const char *Gyro::copyright = "1995"; -const mp Gyro::mps[9] = { - { - // 1 - up-arrow - { {65151, 64575, 64575, 63519, 63519, 61455, 61455, 57351, 57351, 49155, 49155, 64575, 64575, 64575, 64575, 64575}, - {0, 384, 384, 960, 960, 2016, 2016, 4080, 4080, 8184, 384, 384, 384, 384, 384, 0} - }, - 8, - 0 - }, - - { - // 2 - screwdriver - { {8191, 4095, 2047, 34815, 50175, 61951, 63743, 64543, 65039, 65031, 65027, 65281, 65408, 65472, 65505, 65523}, - {0, 24576, 28672, 12288, 2048, 1024, 512, 256, 224, 176, 216, 96, 38, 10, 12, 0} - }, - 0, - 0 - }, - - { - // 3 - right-arrow - { {65535, 65535, 64639, 64543, 7, 1, 0, 1, 7, 64543, 64639, 65535, 65535, 65535, 65535, 65535}, - {0, 0, 0, 384, 480, 32760, 32766, 32760, 480, 384, 0, 0, 0, 0, 0, 0} - }, - 15, - 6 - }, - - { - // 4 - fletch - { {255, 511, 1023, 2047, 1023, 4607, 14591, 31871, 65031, 65283, 65281, 65280, 65280, 65409, 65473, 65511}, - {0, 10240, 20480, 24576, 26624, 17408, 512, 256, 128, 88, 32, 86, 72, 20, 16, 0} - }, - 0, - 0 - }, - - { - // 5 - hourglass - { {0, 0, 0, 34785, 50115, 61455, 61455, 63519, 63519, 61839, 61455, 49155, 32769, 0, 0, 0}, - {0, 32766, 16386, 12300, 2064, 1440, 1440, 576, 576, 1056, 1440, 3024, 14316, 16386, 32766, 0} - }, - 8, - 7 - }, - - { - // 6 - TTHand - { {62463, 57855, 57855, 57855, 57471, 49167, 32769, 0, 0, 0, 0, 32768, 49152, 57344, 61441, 61443}, - {3072, 4608, 4608, 4608, 4992, 12912, 21070, 36937, 36873, 36865, 32769, 16385, 8193, 4097, 2050, 4092} - }, - 4, - 0 - }, - - { - // 7- Mark's crosshairs - { {65535, 65151, 65151, 65151, 65151, 0, 65151, 65151, 65151, 65151, 65535, 65535, 65535, 65535, 65535, 65535}, - {0, 384, 384, 384, 384, 65535, 384, 384, 384, 384, 0, 0, 0, 0, 0, 0} - }, - 8, - 5 - }, - - { - // 8- I-beam - { {65535, 65535, 63631, 63503, 63503, 65087, 65087, 65087, 65087, 65087, 63503, 63503, 63631, 65535, 65535, 65535}, - {0, 0, 0, 864, 128, 128, 128, 128, 128, 128, 128, 864, 0, 0, 0, 0} - }, - 8, - 7 - }, - - { - // 9 - question mark - { {511, 1023, 2047, 31, 15, 8199, 32647, 65415, 63503, 61471, 61503, 61695, 63999, 63999, 61695, 61695}, - {65024, 33792, 34816, 34784, 40976, 57224, 32840, 72, 1936, 2080, 2496, 2304, 1536, 1536, 2304, 3840} - }, - 0, - 0 - } +const MouseHotspotType Gyro::kMouseHotSpots[9] = { + {8,0}, // 1 - up-arrow + {0,0}, // 2 - screwdriver + {15,6}, // 3 - right-arrow + {0,0}, // 4 - fletch + {8,7}, // 5 - hourglass + {4,0}, // 6 - TTHand + {8,5}, // 7- Mark's crosshairs + {8,7}, // 8- I-beam + {0,0} // 9 - question mark }; -const Common::String Gyro::lads[17] = { +const Common::String Gyro::kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" }; -const Common::String Gyro::lasses[4] = +const Common::String Gyro::kLasses[4] = {"Arkata", "Geida", "", "the Wise Woman"}; -const char Gyro::ladchar[] = "ASCDMTRwLfgeIyPu"; +const char Gyro::kLadChar[] = "ASCDMTRwLfgeIyPu"; -const char Gyro::lasschar[] = "kGo"; +const char Gyro::kLassChar[] = "kGo"; -const int32 Gyro::catamap[8][8] = { +// Art gallery at 2,1; notice about this at 2,2. +const int32 Gyro::kCatacombMap[8][8] = { // Geida's room // 1 2 3 | 4 5 6 7 8 {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, @@ -161,9 +91,45 @@ const int32 Gyro::catamap[8][8] = { }; // vv Stairs trap. -const char Gyro::spludwick_order[3] = {onion, ink, mushroom}; - -const quasiped_type Gyro::quasipeds[16] = { +/* Explanation: $NSEW. + Nibble N: North. + 0 = no connection, + 2 = (left,) middle(, right) door with left-hand handle, + 5 = (left,) middle(, right) door with right-hand handle, + 7 = arch, + 8 = arch and 1 north of it, + 9 = arch and 2 north of it, + D = no connection + WINDOW, + E = no connection + TORCH, + F = recessed door (to Geida's room.) + + Nibble S: South. + 0 = no connection, + 1,2,3 = left, middle, right door. + + Nibble E: East. + 0 = no connection (wall), + 1 = no connection (wall + window), + 2 = wall with door, + 3 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. + + Nibble W: West. + 0 = no connection (wall), + 1 = no connection (wall + shield), + 2 = wall with door, + 3 = wall with door and shield, + 4 = no connection (window), + 5 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. */ + +const char Gyro::kSpludwicksOrder[3] = {onion, ink, mushroom}; + +const QuasipedType Gyro::kQuasipeds[16] = { {2, kColorLightgray, 19, kColorBrown, pdogfood}, // A: Dogfood (screen 19). {3, kColorGreen, 19, kColorWhite, pibythneth}, // B: Ibythneth (screen 19). {3, kColorWhite, 1, kColorMagenta, parkata}, // C: Arkata (screen 1). @@ -182,18 +148,18 @@ const quasiped_type Gyro::quasipeds[16] = { {2, kColorLightgreen, 51, kColorDarkgray, pdrduck} // P: Duck (screen 51). }; -const char Gyro::keys[] = "QWERTYUIOP[]"; +const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; -const uint16 Gyro::notes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; +const uint16 Gyro::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; -const tunetype Gyro::tune = { - higher, higher, lower, same, higher, higher, lower, higher, higher, higher, - lower, higher, higher, - same, higher, lower, lower, lower, lower, higher, higher, lower, lower, lower, - lower, same, lower, higher, same, lower, higher +const TuneType Gyro::kTune = { + kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, + kPitchLower, kPitchHigher, kPitchHigher, + kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, + kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher }; -byte Gyro::whereis[29] = { +byte Gyro::_whereIs[29] = { // The Lads r__yours, // Avvy r__spludwicks, // Spludwick @@ -237,7 +203,7 @@ const Common::String Gyro::better[numobjs] = { const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; -Gyro::Gyro(AvalancheEngine *vm) : interrogation(0), oncandopageswap(true) { +Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _vm = vm; // Needed because of Lucerna::load_also() @@ -306,7 +272,7 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { } void Gyro::newgame() { - for (byte gm = 0; gm < numtr; gm++) { + for (byte gm = 0; gm < kMaxSprites; gm++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); } @@ -324,7 +290,7 @@ void Gyro::newgame() { dna.like2drink = "beer"; dna.pence = 30; // 2/6 - dna.rw = stopped; + dna.rw = kDirectionStopped; dna.wearing = clothes; dna.obj[money - 1] = true; dna.obj[bodkin - 1] = true; @@ -338,7 +304,7 @@ void Gyro::newgame() { seescroll = false; ppos[0][1] = -177; - _vm->_trip->tr[0].appear(300,117,right); // Needed to initialize Avalot. + _vm->_trip->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } him = 254; @@ -401,17 +367,17 @@ bool Gyro::pennycheck(uint16 howmuchby) { // Keep an eye open! Common::String Gyro::getname(byte whose) { if (whose < 175) - return lads[whose - 150]; + return kLads[whose - 150]; else - return lasses[whose - 175]; + return kLasses[whose - 175]; } // Keep an eye open! ^ byte Gyro::getnamechar(byte whose) { if (whose < 175) - return ladchar[whose - 150]; + return kLadChar[whose - 150]; else - return lasschar[whose - 175]; + return kLassChar[whose - 175]; } // Keep an eye open! ^^ @@ -570,7 +536,7 @@ void Gyro::load_a_mouse(byte which) { - CursorMan.replaceCursor(cursor.pixels, 16, 32, mps[which - 1].horzhotspot, mps[which - 1].verthotspot * 2, 255, false); + CursorMan.replaceCursor(cursor.pixels, 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); cursor.free(); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index c11eb389cb28..5ae62d2228ca 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -49,14 +49,8 @@ static const int16 maxobjs = 12; // carry limit static const int16 numlockCode = 32; // Code for Num Lock static const int16 mouse_size = 134; -struct postype { - uint16 x, y, datapos; - byte length; -}; - -struct mp { // mouse-void - uint16 mask[2][16]; - int16 horzhotspot, verthotspot; +struct MouseHotspotType { // mouse-void + int16 _horizontal, _vertical; }; struct dnatype { // here goes... Ux, uy, & ww now all belong to Trip5 @@ -208,7 +202,7 @@ struct demo_type { char key, extd; }; -struct quasiped_type { +struct QuasipedType { byte whichped, fgc, room, bgc; uint16 who; }; @@ -216,7 +210,7 @@ struct quasiped_type { quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. */ -typedef byte tunetype[31]; +typedef byte TuneType[31]; struct PointType { @@ -334,126 +328,80 @@ class Gyro { static const int16 margin = 5; - static const mp mps[9]; + static const MouseHotspotType kMouseHotSpots[9]; - static const Common::String lads[17]; + static const Common::String kLads[17]; - static const Common::String lasses[4]; + static const Common::String kLasses[4]; - static const char ladchar[]; + static const char kLadChar[]; - static const char lasschar[]; + static const char kLassChar[]; - static const int16 numtr = 2; // current max no. of sprites + static const int16 kMaxSprites = 2; // Current max no. of sprites. - static const bool a_thing = true; - static const bool a_person = false; // for Thinkabout + // For Thinkabout: + static const bool kThing = true; + static const bool kPerson = false; - // Magic/portal commands are + // Magic/portal constants: + enum Magics { + kMagicNothing, // Ignore it if this line is touched. + kMagicBounce, // Bounce off this line. Not valid for portals. + kMagicExclaim, // Put up a chain of scrolls. + kMagicTransport, // Enter new room. + kMagicUnfinished, // Unfinished connection. + kMagicSpecial, // Special function. + kMagicOpenDoor // Opening door. + }; + + // These following static constants should be included in CFG when it's written. - /*N*/ static const int16 nix = 0; // ignore it if this line is touched - /*B*/ static const int16 bounces = 1; // bounce off this line. Not valid for portals. - /*E*/ static const int16 exclaim = 2; // put up a chain of scrolls - /*T*/ static const int16 transport = 3; // enter new room - /*U*/ static const int16 unfinished = 4; // unfinished connection - /*S*/ static const int16 special = 5; // special function. - /*O*/ static const int16 mopendoor = 6; // opening door. + static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. - // These following static constants should be included in CFG when it's written. + static const int16 kBorder = 1; // size of border on shadowboxes - static const bool slow_computer = false; // stops walking when mouse touches toolbar - - /* --- */ - - static const int16 border = 1; // size of border on shadowboxes - - static const int32 pagetop = 81920; - - static const int16 up = 0; - static const int16 right = 1; - static const int16 down = 2; - static const int16 left = 3; - static const int16 ur = 4; - static const int16 dr = 5; - static const int16 dl = 6; - static const int16 ul = 7; - static const int16 stopped = 8; - - static const int16 walk = 3; - static const int16 run = 5; - - // Art gallery at 2,1; notice about this at 2,2. - - static const int32 catamap[8][8]; - - /* Explanation: $NSEW. - Nibble N: North. - 0 = no connection, - 2 = (left,) middle(, right) door with left-hand handle, - 5 = (left,) middle(, right) door with right-hand handle, - 7 = arch, - 8 = arch and 1 north of it, - 9 = arch and 2 north of it, - D = no connection + WINDOW, - E = no connection + TORCH, - F = recessed door (to Geida's room.) - - Nibble S: South. - 0 = no connection, - 1,2,3 = left, middle, right door. - - Nibble E: East. - 0 = no connection (wall), - 1 = no connection (wall + window), - 2 = wall with door, - 3 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. - - Nibble W: West. - 0 = no connection (wall), - 1 = no connection (wall + shield), - 2 = wall with door, - 3 = wall with door and shield, - 4 = no connection (window), - 5 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. */ - - static const bool demo = false; // If this is true, we're in a demo of the game. - - static const char spludwick_order[3]; - - static const quasiped_type quasipeds[16]; + enum Direction { + kDirectionUp, kDirectionRight, kDirectionDown, kDirectionLeft, + kDirectionUpRight, kDirectionDownRight, kDirectionDownLeft, kDirectionUpLeft, + kDirectionStopped + }; + + static const int16 kWalk = 3; + static const int16 kRun = 5; + + static const int32 kCatacombMap[8][8]; - static const int16 lower = 0; - static const int16 same = 1; - static const int16 higher = 2; + static const bool kDemo = false; // If this is true, we're in a demo of the game. + + static const char kSpludwicksOrder[3]; + + static const QuasipedType kQuasipeds[16]; - static const char keys[]; - static const uint16 notes[12]; + enum Pitch { + kPitchLower, + kPitchSame, + kPitchHigher + }; - static const tunetype tune; + static const char kMusicKeys[]; + static const uint16 kNotes[12]; - // special run-time errors + static const TuneType kTune; - static const int16 runerr_getset_overflow = 50; - byte interrogation; - /* If this is greater than zero, the next line you type is stored in - the DNA in a position dictated by the value. If a scroll comes up, - or you leave the room, it's automatically set to zero. */ + byte _interrogation; + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. + // If a scroll comes up, or you leave the room, it's automatically set to zero. - static byte whereis[29]; + static byte _whereIs[29]; - bool oncandopageswap; + bool _onCanDoPageSwap; // Variable static constant for overriding the ability of On to switch pages. // You may know better than On which page to switch to. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index fe604cc70a29..f4c583089f55 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -274,7 +274,7 @@ void Lucerna::zoomout(int16 x, int16 y) { void Lucerna::find_people(byte room) { for (byte fv = 1; fv < 29; fv++) - if (_vm->_gyro->whereis[fv] == room) { + if (_vm->_gyro->_whereIs[fv] == room) { if (fv < 25) _vm->_gyro->him = fv + 150; else @@ -307,7 +307,7 @@ void Lucerna::exitroom(byte x) { break; } - _vm->_gyro->interrogation = 0; // Leaving the room cancels all the questions automatically. + _vm->_gyro->_interrogation = 0; // Leaving the room cancels all the questions automatically. _vm->_gyro->seescroll = false; // Now it can work again! @@ -368,10 +368,10 @@ void Lucerna::enterroom(byte x, byte ped) { if ((_vm->_gyro->dna.rooms[x] == 0) && (! _vm->_gyro->flagset('S'))) points(1); - _vm->_gyro->whereis[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; + _vm->_gyro->_whereIs[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; if (_vm->_gyro->dna.geida_follows) - _vm->_gyro->whereis[_vm->_gyro->pgeida - 150] = x; + _vm->_gyro->_whereIs[_vm->_gyro->pgeida - 150] = x; _vm->_gyro->roomtime = 0; @@ -393,7 +393,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { if (! _vm->_gyro->dna.talked_to_crapulus) { - _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__outsideyours; + _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = r__outsideyours; _vm->_trip->tr[1].init(8, false, _vm->_trip); // load Crapulus if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { @@ -407,7 +407,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // He always faces Avvy. - } else _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = r__nowhere; + } else _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = r__nowhere; if (_vm->_gyro->dna.crapulus_will_tell) { _vm->_trip->tr[1].init(8, false, _vm->_trip); @@ -431,7 +431,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped > 0) { _vm->_trip->tr[1].init(2, false, _vm->_trip); // load Spludwick _vm->_trip->apped(2, 2); - _vm->_gyro->whereis[1] = r__spludwicks; + _vm->_gyro->_whereIs[1] = r__spludwicks; } _vm->_gyro->dna.dogfoodpos = 0; // _vm->_gyro->also Spludwick pos. @@ -439,21 +439,21 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; } else - _vm->_gyro->whereis[1] = r__nowhere; + _vm->_gyro->_whereIs[1] = r__nowhere; break; case r__brummieroad: { if (_vm->_gyro->dna.geida_follows) put_geida_at(5, ped); if (_vm->_gyro->dna.cwytalot_gone) { - _vm->_gyro->magics[kColorLightred - 1].op = _vm->_gyro->nix; - _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__nowhere; + _vm->_gyro->magics[kColorLightred - 1].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] = r__nowhere; } else { if (ped > 0) { _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; - _vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] = r__brummieroad; + _vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] = r__brummieroad; if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { // First time here... _vm->_trip->apped(2, 2); // He appears on the right of the screen... @@ -486,7 +486,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.drawbridge_open == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); - _vm->_gyro->magics[kColorGreen - 1].op = _vm->_gyro->nix; // You may enter the drawbridge. + _vm->_gyro->magics[kColorGreen - 1].op = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. } if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); // load Geida @@ -505,8 +505,8 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.been_tied_up) { - _vm->_gyro->whereis[_vm->_gyro->probinhood - 150] = 0; - _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 0; + _vm->_gyro->_whereIs[_vm->_gyro->probinhood - 150] = 0; + _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = 0; } if (_vm->_gyro->dna.tied_up) @@ -529,7 +529,7 @@ void Lucerna::enterroom(byte x, byte ped) { } break; case 5 : - _vm->_gyro->magics[1].op = _vm->_gyro->nix; + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); @@ -539,8 +539,8 @@ void Lucerna::enterroom(byte x, byte ped) { } } if (_vm->_gyro->dna.cardiff_things < 5) - _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; - else _vm->_gyro->interrogation = 0; + _vm->_gyro->_interrogation = _vm->_gyro->dna.cardiff_things; + else _vm->_gyro->_interrogation = 0; } break; @@ -628,8 +628,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->magics[kColorBrown - 1].op = _vm->_gyro->nix; - _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; + _vm->_gyro->magics[kColorBrown - 1].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_whereIs[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); @@ -903,7 +903,7 @@ void Lucerna::showscore() { const bytefield scorespace = {33, 177, 39, 200}; - if (_vm->_gyro->demo) + if (_vm->_gyro->kDemo) return; uint16 score = _vm->_gyro->dna.score; @@ -1006,7 +1006,7 @@ void Lucerna::fxtoggle() { void Lucerna::objectlist() { _vm->_gyro->dna.carrying = 0; if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks - 1]) - thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); // you always have money + thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); // you always have money for (byte fv = 0; fv < numobjs; fv++) if (_vm->_gyro->dna.obj[fv]) { _vm->_gyro->dna.carrying++; @@ -1069,7 +1069,7 @@ void Lucerna::verte(Common::Point cursorPos) { void Lucerna::checkclick() { Common::Point cursorPos = _vm->getMousePos(); - _vm->_gyro->ontoolbar = _vm->_gyro->slow_computer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); + _vm->_gyro->ontoolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); /*if (_vm->_gyro->mrelease > 0) _vm->_gyro->after_the_scroll = false;*/ @@ -1125,10 +1125,10 @@ void Lucerna::checkclick() { callverb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->walk; + _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; _vm->_trip->newspeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->run; + _vm->_trip->tr[0].xs = _vm->_gyro->kRun; _vm->_trip->newspeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxtoggle(); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 078963aca6e4..4cab87a7a1d2 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -227,7 +227,7 @@ void Timeout::open_drawbridge() { _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) - _vm->_gyro->magics[1].op = _vm->_gyro->nix; // You may enter the drawbridge. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } @@ -267,9 +267,9 @@ void Timeout::stairs() { _vm->_trip->tr[0].walkto(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->dna.brummie_stairs = 2; - _vm->_gyro->magics[10].op = _vm->_gyro->special; + _vm->_gyro->magics[10].op = _vm->_gyro->kMagicSpecial; _vm->_gyro->magics[10].data = 2; // Reached the bottom of the stairs. - _vm->_gyro->magics[3].op = _vm->_gyro->nix; // Stop them hitting the sides (or the game will hang.) + _vm->_gyro->magics[3].op = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timeout::cardiff_survey() { @@ -280,7 +280,7 @@ void Timeout::cardiff_survey() { _vm->_visa->dixi('z', _vm->_gyro->dna.cardiff_things); - _vm->_gyro->interrogation = _vm->_gyro->dna.cardiff_things; + _vm->_gyro->_interrogation = _vm->_gyro->dna.cardiff_things; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } @@ -309,14 +309,14 @@ void Timeout::get_tied_up() { void Timeout::get_tied_up2() { _vm->_trip->tr[0].walkto(4); _vm->_trip->tr[1].walkto(5); - _vm->_gyro->magics[3].op = _vm->_gyro->nix; // No effect when you touch the boundaries. + _vm->_gyro->magics[3].op = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->dna.friar_will_tie_you_up = true; } void Timeout::hang_around() { _vm->_trip->tr[1].check_me = false; _vm->_trip->tr[0].init(7, true, _vm->_trip); // Robin Hood - _vm->_gyro->whereis[_vm->_gyro->probinhood - 150] = r__robins; + _vm->_gyro->_whereIs[_vm->_gyro->probinhood - 150] = r__robins; _vm->_trip->apped(1, 2); _vm->_visa->dixi('q', 39); _vm->_trip->tr[0].walkto(7); @@ -327,7 +327,7 @@ void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); _vm->_trip->tr[1].vanishifstill = false; _vm->_trip->tr[1].walkto(4); - _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = r__robins; + _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = r__robins; _vm->_visa->dixi('q', 41); _vm->_trip->tr[0].done(); _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. @@ -387,12 +387,12 @@ void Timeout::jacques_wakes_up() { case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // You can't wake him up now. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. - _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; // Gone! + _vm->_gyro->_whereIs[_vm->_gyro->pjacques - 150] = 0; // Gone! break; } @@ -529,7 +529,7 @@ void Timeout::greetsmonk() { } void Timeout::fall_down_oubliette() { - _vm->_gyro->magics[8].op = _vm->_gyro->nix; + _vm->_gyro->magics[8].op = _vm->_gyro->kMagicNothing; _vm->_trip->tr[0].iy++; // Increments dx/dy! _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 6a1aeddf01aa..0e16c776ce4d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -217,27 +217,27 @@ void triptype::walk() { if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { switch (_tr->_vm->_gyro->magics[tc].op) { - case Gyro::exclaim: { + case Gyro::kMagicExclaim: { bounce(); _tr->mustexclaim = true; _tr->saywhat = _tr->_vm->_gyro->magics[tc].data; } break; - case Gyro::bounces: + case Gyro::kMagicBounce: bounce(); break; - case Gyro::transport: + case Gyro::kMagicTransport: _tr->fliproom(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff); break; - case Gyro::unfinished: { + case Gyro::kMagicUnfinished: { bounce(); _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); } break; - case Gyro::special: + case Gyro::kMagicSpecial: _tr->call_special(_tr->_vm->_gyro->magics[tc].data); break; - case Gyro::mopendoor: + case Gyro::kMagicOpenDoor: _tr->open_the_door(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff, tc); break; } @@ -262,9 +262,9 @@ void triptype::bounce() { _tr->stopwalking(); else stopwalk(); - _tr->_vm->_gyro->oncandopageswap = false; + _tr->_vm->_gyro->_onCanDoPageSwap = false; _tr->_vm->_lucerna->showrw(); - _tr->_vm->_gyro->oncandopageswap = true; + _tr->_vm->_gyro->_onCanDoPageSwap = true; } int8 triptype::sgn(int16 val) { @@ -566,70 +566,70 @@ void Trip::catamove(byte ped) { if (!_vm->_gyro->dna.enter_catacombs_from_lusties_room) _vm->_lucerna->load(29); - here = _vm->_gyro->catamap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1]; + here = _vm->_gyro->kCatacombMap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; case 0x1: // no connection (wall + shield), - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x2: // wall with door - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. break; case 0x3: // wall with door and shield - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x5: // wall with door and window - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->nix; // No door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->magics[1].op = _vm->_gyro->nix; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->special; // Straight wall. + _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->magics[2].op = _vm->_gyro->kMagicSpecial; // Straight wall. break; } @@ -637,52 +637,52 @@ void Trip::catamove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; case 0x1: // no connection (wall + window), - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x2: // wall with door - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. break; case 0x3: // wall with door and window - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->nix; // No door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->nix; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->magics[4].op = _vm->_gyro->nix; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->special; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->magics[5].op = _vm->_gyro->kMagicSpecial; // Straight wall. + _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. break; } @@ -690,39 +690,39 @@ void Trip::catamove(byte ped) { switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_gyro->magics[6].op = _vm->_gyro->bounces; - _vm->_gyro->magics[11].op = _vm->_gyro->bounces; - _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; break; case 0x1: _vm->_celer->drawBackgroundSprite(-1, -1, 22); if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) - _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; + _vm->_gyro->magics[12].op = _vm->_gyro->kMagicExclaim; else - _vm->_gyro->magics[12].op = _vm->_gyro->special; // Right exit south. + _vm->_gyro->magics[12].op = _vm->_gyro->kMagicSpecial; // Right exit south. - _vm->_gyro->magics[6].op = _vm->_gyro->bounces; - _vm->_gyro->magics[11].op = _vm->_gyro->bounces; + _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; break; case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->magics[6].op = _vm->_gyro->special; // Middle exit south. - _vm->_gyro->magics[11].op = _vm->_gyro->bounces; - _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[6].op = _vm->_gyro->kMagicSpecial; // Middle exit south. + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; break; case 0x3: _vm->_celer->drawBackgroundSprite(-1, -1, 24); - _vm->_gyro->magics[11].op = _vm->_gyro->special; // Left exit south. - _vm->_gyro->magics[6].op = _vm->_gyro->bounces; - _vm->_gyro->magics[12].op = _vm->_gyro->bounces; + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicSpecial; // Left exit south. + _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. break; // LEFT handles: #if 0 @@ -734,8 +734,8 @@ void Trip::catamove(byte ped) { #endif case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. - _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. break; #if 0 case 0x3: @@ -752,8 +752,8 @@ void Trip::catamove(byte ped) { #endif case 0x5: _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. - _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. break; #if 0 case 0x6: @@ -773,26 +773,26 @@ void Trip::catamove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer->drawBackgroundSprite(-1, -1, 32); - _vm->_gyro->magics[0].op = _vm->_gyro->special; // Middle arch north. - _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicSpecial; // Middle arch north. + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. } break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; case 0xe: // No connection + TORCH - _vm->_gyro->magics[0].op = _vm->_gyro->bounces; - _vm->_gyro->portals[3].op = _vm->_gyro->nix; // Door. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; // Recessed door: case 0xf: - _vm->_gyro->magics[0].op = _vm->_gyro->nix; // Door to Geida's room. + _vm->_gyro->magics[0].op = _vm->_gyro->kMagicNothing; // Door to Geida's room. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. + _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. break; } @@ -849,17 +849,17 @@ void Trip::call_special(uint16 which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->dna.brummie_stairs = 1; - _vm->_gyro->magics[9].op = _vm->_gyro->nix; + _vm->_gyro->magics[9].op = _vm->_gyro->kMagicNothing; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); stopwalking(); _vm->_gyro->dna.user_moves_avvy = false; break; case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. _vm->_gyro->dna.brummie_stairs = 3; - _vm->_gyro->magics[10].op = _vm->_gyro->nix; - _vm->_gyro->magics[11].op = _vm->_gyro->exclaim; + _vm->_gyro->magics[10].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->magics[11].op = _vm->_gyro->kMagicExclaim; _vm->_gyro->magics[11].data = 5; - _vm->_gyro->magics[3].op = _vm->_gyro->bounces; // Now works as planned! + _vm->_gyro->magics[3].op = _vm->_gyro->kMagicBounce; // Now works as planned! stopwalking(); _vm->_visa->dixi('q', 26); _vm->_gyro->dna.user_moves_avvy = true; @@ -890,7 +890,7 @@ void Trip::call_special(uint16 which) { case 5: if (_vm->_gyro->dna.friar_will_tie_you_up) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. - _vm->_gyro->magics[4].op = _vm->_gyro->bounces; // Boundary effect is now working again. + _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. _vm->_visa->dixi('q', 35); tr[0].done(); //tr[1].vanishifstill:=true; @@ -901,7 +901,7 @@ void Trip::call_special(uint16 which) { tr[1].walkto(3); tr[1].vanishifstill = true; tr[1].check_me = true; // One of them must have Check_Me switched on. - _vm->_gyro->whereis[_vm->_gyro->pfriartuck - 150] = 177; // Not here, then. + _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = 177; // Not here, then. _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; @@ -914,7 +914,7 @@ void Trip::call_special(uint16 which) { break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0].visible = false; - _vm->_gyro->magics[9].op = _vm->_gyro->nix; + _vm->_gyro->magics[9].op = _vm->_gyro->kMagicNothing; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); @@ -956,7 +956,7 @@ void Trip::call_special(uint16 which) { if (_vm->_gyro->dna.room != r__catacombs) return; _vm->_lucerna->delavvy(); - switch ((_vm->_gyro->catamap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1] & 0xf00) >> 8) { + switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1] & 0xf00) >> 8) { case 0x1: apped(1, 12); break; @@ -1073,12 +1073,12 @@ void Trip::newspeed() { //setactivepage(3); - if (tr[0].xs == _vm->_gyro->run) + if (tr[0].xs == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - if (tr[0].xs == _vm->_gyro->run) + if (tr[0].xs == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); From 82484b139a6bf46d9e2293da0808ea989131579f Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 5 Sep 2013 23:58:32 +0200 Subject: [PATCH 0830/1332] AVALANCHE: More renaming in Gyro. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/celer2.cpp | 2 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 26 +++++++++++++------------- engines/avalanche/scrolls2.h | 4 ++-- engines/avalanche/visa2.cpp | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 06ac30e449e5..100f468de923 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -464,7 +464,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _dropdown->setupMenu(); - _gyro->whereis[0] = _gyro->dna.room; + _gyro->_whereIs[0] = _gyro->dna.room; _gyro->alive = true; diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 05065d5c65c8..c9ad3cf809af 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -254,7 +254,7 @@ void Celer::updateBackgroundSprites() { if (_vm->_gyro->dna.nextbell < 5) _vm->_gyro->dna.nextbell = 12; _vm->_gyro->dna.nextbell--; - _vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]); + _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->dna.nextbell]); break; case 2: //nosound(); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index ef5a90d46fdb..56420180aae1 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -277,7 +277,7 @@ void Enid::ednaReload() { _vm->_lucerna->major_redraw(); - _vm->_gyro->whereis[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; + _vm->_gyro->_whereIs[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; _vm->_gyro->alive = true; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 147bc21fe7b0..350e9f7bfe78 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -199,18 +199,18 @@ void Scrolls::dialogue() { -void Scrolls::store_(byte what, tunetype &played) { +void Scrolls::store_(byte what, TuneType &played) { memcpy(played + 1, played + 2, sizeof(played) - 1); played[30] = what; } -bool Scrolls::they_match(tunetype &played) { +bool Scrolls::they_match(TuneType &played) { byte fv, mistakes; mistakes = 0; for (fv = 1; fv <= sizeof(played); fv++) { - if (played[fv] != _vm->_gyro->tune[fv]) { + if (played[fv] != _vm->_gyro->kTune[fv]) { mistakes += 1; } } @@ -253,7 +253,7 @@ void Scrolls::resetscrolldriver() { // phew _vm->_gyro->scrollbells = 0; cfont = roman; use_icon = 0; - _vm->_gyro->interrogation = 0; // always reset after a scroll comes up. + _vm->_gyro->_interrogation = 0; // always reset after a scroll comes up. } void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little... @@ -331,7 +331,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t //setvisualpage(cp); //setactivepage(1 - cp); - _vm->_gyro->oncandopageswap = false; // On can now no longer swap pages. So we can do what we want without its interference! + _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! lx = 0; ly = (_vm->_gyro->scrolln) * 6; @@ -457,7 +457,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t // mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0); //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); //blitfix(); - _vm->_gyro->oncandopageswap = true; // Normality again. + _vm->_gyro->_onCanDoPageSwap = true; // Normality again. CursorMan.showMouse(true); //settextjustify(0, 0); // sink resetscrolldriver(); @@ -475,7 +475,7 @@ void Scrolls::bubble(func2 gotoit) { //setvisualpage(cp); //setactivepage(1 - cp); - _vm->_gyro->oncandopageswap = false; // On can now no longer swap pages. So we can do what we want without its interference! + _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! //mousepage(1 - cp); // Mousepage CursorMan.showMouse(false); @@ -539,7 +539,7 @@ void Scrolls::bubble(func2 gotoit) { //setvisualpage(1 - cp); dingdongbell(); - _vm->_gyro->oncandopageswap = false; + _vm->_gyro->_onCanDoPageSwap = false; CursorMan.showMouse(true); _vm->_gyro->dropsok = false; @@ -551,7 +551,7 @@ void Scrolls::bubble(func2 gotoit) { //setvisualpage(cp); CursorMan.showMouse(true); // sink; - _vm->_gyro->oncandopageswap = true; + _vm->_gyro->_onCanDoPageSwap = true; resetscrolldriver(); if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true; @@ -700,11 +700,11 @@ void Scrolls::calldrivers() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].x; - _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position. + _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->kQuasipeds[param - 10].whichped - 1].x; + _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->kQuasipeds[param - 10].whichped - 1].y; // Position. - _vm->_gyro->talkf = _vm->_gyro->quasipeds[param - 10].fgc; - _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colors. + _vm->_gyro->talkf = _vm->_gyro->kQuasipeds[param - 10].fgc; + _vm->_gyro->talkb = _vm->_gyro->kQuasipeds[param - 10].bgc; // Colors. } else { _vm->_lucerna->errorled(); // Not valid. natural(); diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 0238d33b16db..362000b153d4 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -123,9 +123,9 @@ class Scrolls { void dialogue(); - void store_(byte what, tunetype &played); + void store_(byte what, TuneType &played); - bool they_match(tunetype &played); + bool they_match(TuneType &played); void music_scroll(); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 1de48fd388db..fe31cc28dac1 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -185,7 +185,7 @@ void Visa::talkto(byte whom) { switch (_vm->_gyro->dna.given2spludwick) { case 1: // Falltrough is intended. case 2:{ - _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->get_better(_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->get_better(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } break; @@ -281,7 +281,7 @@ void Visa::talkto(byte whom) { dixi('q', 1); // Circular from Cardiff. _vm->_gyro->dna.talked_to_crapulus = true; - _vm->_gyro->whereis[_vm->_gyro->pcrapulus - 150] = 177; // Crapulus walks off. + _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = 177; // Crapulus walks off. _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].walkto(3); // Walks away. From dd897be038e795612f756914253b0be9f7cedd00 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 6 Sep 2013 00:17:13 +0200 Subject: [PATCH 0831/1332] AVALANCHE: Identify currently dead code in enid2 --- engines/avalanche/enid2.cpp | 35 +++++++++++------------ engines/avalanche/enid2.h | 55 ++++++++++++++++++------------------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 56420180aae1..be98b4e5796b 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -45,6 +45,8 @@ Enid::Enid(AvalancheEngine *vm) { _vm = vm; } +// CHECKME: useless? +#if 0 const Common::String Enid::kCrlf = Common::String(char(15)) + Common::String(char(12)); const char Enid::kTab = '\t'; const char Enid::kEof = '\n'; @@ -60,17 +62,16 @@ const Common::String Enid::kEdnaFirst = "1234567890" +kCrlf; // 11 const Common::String Enid::kEdnaId = Common::String("TT\xB1\x30\x01\x75\xB1\x99\xB1"); - const int16 Enid::kAge = 18; const Common::String Enid::kWasHere = "Thomas was here "; - const Enid::FourType Enid::kAvariciusFile = "Avvy"; - - -void Enid::addon(Common::String x) { - //month[0]--; - _month = _month + x; +/** + * Expand month name + * @remarks Originally called 'addon' + */ +void Enid::expandMonthName(Common::String x) { + _month += x; } Common::String Enid::expandDate(byte d, byte m, uint16 y) { @@ -83,10 +84,10 @@ Common::String Enid::expandDate(byte d, byte m, uint16 y) { _month = months[m]; switch (_month[_month.size()]) { case '#': - addon("uary"); + expandMonthName("uary"); break; case '*': - addon("ber"); + expandMonthName("ber"); break; } @@ -161,10 +162,6 @@ void Enid::showHeader() { _vm->_scrolls->display(Common::String("Dir: ") + _path + "\r\r\4"); } -void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! - warning("STUB: Enid::dir()"); -} - void Enid::avvyBackground() { // Not really a filing procedure, // but it's only called just before edna_load, so I thought I'd put it @@ -289,13 +286,17 @@ void Enid::ednaReload() { } } -void Enid::backToBootstrap(byte what) { - warning("STUB: Enid::back_to_bootstrap()"); -} - bool Enid::thereWasAProblem() { return _bug; } +#endif + +void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! + warning("STUB: Enid::dir()"); +} +void Enid::backToBootstrap(byte what) { + warning("STUB: Enid::back_to_bootstrap()"); +} } // End of namespace Avalanche. diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 6f76a7471887..1cf14d10def0 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -38,42 +38,39 @@ class AvalancheEngine; class Enid { public: Enid(AvalancheEngine *vm); - void ednaSave(Common::String name); - void ednaLoad(Common::String name); - void ednaReload(); // From Bootstrap's storage. void dir(Common::String where); - void avvyBackground(); void backToBootstrap(byte what); - bool thereWasAProblem(); private: AvalancheEngine *_vm; - static const Common::String kCrlf; - static const char kTab, kEof; - static const Common::String kEdnaFirst, kEdnaId, kWasHere; - static const int16 kAge; +// CHECKME: useless? +// static const Common::String kCrlf; +// static const char kTab, kEof; +// static const Common::String kEdnaFirst, kEdnaId, kWasHere; +// static const int16 kAge; +// void expandMonthName(Common::String x); +// Common::String expandDate(byte d, byte m, uint16 y); +// void ednaSave(Common::String name); +// void showBug(char icon, Common::String strn); +// bool testBug(byte what); +// void loadError(Common::String x, char icon); +// void ednaLoad(Common::String name); +// void showHeader(); +// void toSundry(sundry &sund); +// void fromSundry(sundry sund); +// void avvyBackground(); +// void ednaReload(); // From Bootstrap's storage. +// void restoreDna(); +// bool thereWasAProblem(); + +// typedef char FourType[5]; +// static const FourType kAvariciusFile; + +// bool _bug; +// Common::String _path, _groi; +// Common::String _month, _day; - typedef char FourType[5]; - static const FourType kAvariciusFile; - - bool _bug; - Common::String _path, _groi; - Common::String _month, _day; - - void addon(Common::String x); - Common::String expandDate(byte d, byte m, uint16 y); - - void showBug(char icon, Common::String strn); - bool testBug(byte what); - - void loadError(Common::String x, char icon); - void showHeader(); - - void toSundry(sundry &sund); - void fromSundry(sundry sund); - - void restoreDna(); }; } // End of namespace Avalanche. From 56ce2398d8d20bbafe7659078fa6836a47520b15 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 6 Sep 2013 00:22:05 +0200 Subject: [PATCH 0832/1332] AVALANCHE: Remove 2 high-ascii characters --- engines/avalanche/gyro2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index d154bb07e46f..a1efe5b72a5f 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -70,11 +70,11 @@ const Common::String Gyro::kLads[17] = { }; const Common::String Gyro::kLasses[4] = -{"Arkata", "Geida", "", "the Wise Woman"}; +{"Arkata", "Geida", "\0xB1", "the Wise Woman"}; const char Gyro::kLadChar[] = "ASCDMTRwLfgeIyPu"; -const char Gyro::kLassChar[] = "kGo"; +const char Gyro::kLassChar[] = "kG\0xB1o"; // Art gallery at 2,1; notice about this at 2,2. const int32 Gyro::kCatacombMap[8][8] = { From 95a4ccac510747409a42420992bd90884984f798 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 6 Sep 2013 07:52:02 +0200 Subject: [PATCH 0833/1332] AVALANCHE: Some renaming in lucerna2 --- engines/avalanche/dropdown2.cpp | 40 +++++++-------- engines/avalanche/gyro2.cpp | 6 ++- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 87 +++++++++++++++------------------ engines/avalanche/lucerna2.h | 40 ++------------- engines/avalanche/parser.cpp | 4 +- engines/avalanche/timeout2.cpp | 2 +- 7 files changed, 72 insertions(+), 109 deletions(-) diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index a97aa1b3329f..c207fdaf0016 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -555,19 +555,19 @@ void Dropdown::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeHelp); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeHelp); break; case 1: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBoss); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBoss); break; case 2: _vm->_lucerna->major_redraw(); break; case 3: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeScore); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); break; case 4: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeInfo); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInfo); break; } } @@ -576,18 +576,18 @@ void Dropdown::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeRestart); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeRestart); break; case 1: { if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeLoad); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeLoad); } break; case 2: { if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeSave); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeSave); } break; case 3: @@ -598,7 +598,7 @@ void Dropdown::runMenuFile() { _vm->_enid->backToBootstrap(2); break; case 5: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeQuit); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeQuit); break; } } @@ -611,22 +611,22 @@ void Dropdown::runMenuAction() { _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; f5Does = _vm->_gyro->f5_does(); - _vm->_lucerna->callverb(f5Does[0]); + _vm->_lucerna->callVerb(f5Does[0]); } break; case 1: _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodePause); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodePause); break; case 2: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeOpen); break; case 3: _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeLook); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeLook); break; case 4: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeInv); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); break; case 5: { if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) @@ -664,37 +664,37 @@ void Dropdown::runMenuWith() { switch (_vm->_gyro->verbstr[_activeMenuItem._choiceNum]) { case 100: { // Beer _vm->_acci->_thing = 100; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; case 101: { // Wine _vm->_acci->_thing = 50; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; case 102: { // Whisky _vm->_acci->_thing = 102; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; case 103: { // Cider _vm->_acci->_thing = 103; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; case 104: { // Mead _vm->_acci->_thing = 107; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; case 105: { // Onion (trader) _vm->_acci->_thing = 67; - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } break; @@ -705,7 +705,7 @@ void Dropdown::runMenuWith() { } } } - _vm->_lucerna->callverb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); + _vm->_lucerna->callVerb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); } void Dropdown::setupMenu() { diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index a1efe5b72a5f..3badc239de85 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -235,7 +235,11 @@ void Gyro::newpointer(byte id) { load_a_mouse(id); } -void Gyro::wait() { +/** + * Set the mouse pointer to 'HourGlass" + * @remarks Originally called 'wait' + */ +void Gyro::setMousePointerWait() { newpointer(5); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 5ae62d2228ca..bd2e9b15e46a 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -543,7 +543,7 @@ class Gyro { void newpointer(byte id); - void wait(); // Makes hourglass. + void setMousePointerWait(); // Makes hourglass. void on(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f4c583089f55..c4dc6fc97fcb 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -81,8 +81,12 @@ void Lucerna::init() { #endif } -void Lucerna::callverb(byte n) { - if (n == _vm->_acci->kPardon) { +/** + * Call a given Verb + * @remarks Originally called 'callverb' + */ +void Lucerna::callVerb(byte id) { + if (id == _vm->_acci->kPardon) { _vm->_scrolls->display(Common::String("The f5 key lets you do a particular action in certain ") + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + @@ -90,7 +94,7 @@ void Lucerna::callverb(byte n) { } else { _vm->_gyro->weirdword = false; _vm->_acci->_polite = true; - _vm->_acci->_verb = n; + _vm->_acci->_verb = id; _vm->_acci->doThat(); } } @@ -273,13 +277,14 @@ void Lucerna::zoomout(int16 x, int16 y) { } void Lucerna::find_people(byte room) { - for (byte fv = 1; fv < 29; fv++) + for (byte fv = 1; fv < 29; fv++) { if (_vm->_gyro->_whereIs[fv] == room) { if (fv < 25) _vm->_gyro->him = fv + 150; else _vm->_gyro->her = fv + 150; } + } } void Lucerna::exitroom(byte x) { @@ -442,7 +447,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->_whereIs[1] = r__nowhere; break; - case r__brummieroad: { + case r__brummieroad: if (_vm->_gyro->dna.geida_follows) put_geida_at(5, ped); if (_vm->_gyro->dna.cwytalot_gone) { @@ -465,10 +470,9 @@ void Lucerna::enterroom(byte x, byte ped) { } } } - } - break; + break; - case r__argentroad: { + case r__argentroad: if ((_vm->_gyro->dna.cwytalot_gone) && (! _vm->_gyro->dna.cwytalot_in_herts) && (ped == 2) && (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot again @@ -479,10 +483,9 @@ void Lucerna::enterroom(byte x, byte ped) { // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } - } - break; + break; - case r__bridge: { + case r__bridge: if (_vm->_gyro->dna.drawbridge_open == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); @@ -490,10 +493,9 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.geida_follows) put_geida_at(ped + 3, ped); // load Geida - } - break; + break; - case r__robins: { + case r__robins: if (ped > 0) { if (! _vm->_gyro->dna.been_tied_up) { // A welcome party... or maybe not... @@ -515,10 +517,9 @@ void Lucerna::enterroom(byte x, byte ped) { if (!_vm->_gyro->dna.mushroom_growing) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - } - break; + break; - case r__outsidecardiffcastle: { + case r__outsidecardiffcastle: if (ped > 0) switch (_vm->_gyro->dna.cardiff_things) { case 0 : { // You've answered NONE of his questions. @@ -541,10 +542,9 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.cardiff_things < 5) _vm->_gyro->_interrogation = _vm->_gyro->dna.cardiff_things; else _vm->_gyro->_interrogation = 0; - } - break; + break; - case r__map: { + case r__map: // You're entering the map. dawn(); //setactivepage(cp); @@ -561,10 +561,9 @@ void Lucerna::enterroom(byte x, byte ped) { } _vm->_visa->dixi('q', 69); - } - break; + break; - case r__catacombs: { + case r__catacombs: if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { switch (ped) { @@ -589,10 +588,9 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->catamove(ped); _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; } - } - break; + break; - case r__argentpub: { + case r__argentpub: if (_vm->_gyro->dna.wonnim) _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. _vm->_gyro->dna.malagauche = 0; // Ready to boot Malagauche @@ -601,10 +599,9 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 9); } _vm->_graphics->refreshBackground(); - } - break; + break; - case r__lustiesroom: { + case r__lustiesroom: _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. if (_vm->_trip->tr[0].whichsprite == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); @@ -619,10 +616,9 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_graphics->refreshBackground(); } } - } - break; + break; - case r__musicroom: { + case r__musicroom: if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; _vm->_celer->drawBackgroundSprite(-1, -1, 2); @@ -639,8 +635,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); } - } - break; + break; case r__outsidenottspub: if (ped == 2) { @@ -665,7 +660,7 @@ void Lucerna::enterroom(byte x, byte ped) { } break; - case r__wisewomans: { + case r__wisewomans: _vm->_trip->tr[1].init(11, false, _vm->_trip); if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { _vm->_trip->apped(2, 2); // Start on the right-hand side of the screen. @@ -677,8 +672,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // She always faces Avvy. - } - break; + break; case r__insidecardiffcastle: if (ped > 0) { @@ -758,11 +752,10 @@ void Lucerna::enterroom(byte x, byte ped) { put_geida_at(ped + 6, ped); break; - case r__nottspub: { + case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. - } - break; + break; case r__outsideducks: if (ped == 2) { @@ -795,7 +788,7 @@ void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! _vm->_gyro->thinks = z; z--; - _vm->_gyro->wait(); + _vm->_gyro->setMousePointerWait(); if (th) { if (!f.open("thinks.avd")) { @@ -1117,13 +1110,13 @@ void Lucerna::checkclick() { _vm->_acci->_person = _vm->_gyro->thinks; _vm->_acci->_thing = _vm->_acci->kPardon; } - callverb(_vm->_acci->kVerbCodeExam); + callVerb(_vm->_acci->kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (holdLeftMouse); - callverb(_vm->_acci->kVerbCodeScore); + callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; _vm->_trip->newspeed(); @@ -1140,7 +1133,7 @@ void Lucerna::checkclick() { } void Lucerna::mouse_init() { - _vm->_gyro->wait(); + _vm->_gyro->setMousePointerWait(); } void Lucerna::mousepage(uint16 page_) { @@ -1223,14 +1216,14 @@ void Lucerna::calchand(uint16 ang, uint16 length, Common::Point &a, byte c) { return; } - a = _vm->_graphics->drawArc(_vm->_graphics->_surface, xm, ym, 449 - ang, 450 - ang, length, c); + a = _vm->_graphics->drawArc(_vm->_graphics->_surface, _clockCenterX, _clockCenterY, 449 - ang, 450 - ang, length, c); } void Lucerna::hand(const Common::Point &a, byte c) { if (a.x == 177) return; - _vm->_graphics->_surface.drawLine(xm, ym, a.x, a.y, c); + _vm->_graphics->_surface.drawLine(_clockCenterX, _clockCenterY, a.x, a.y, c); } void Lucerna::refresh_hands() { @@ -1283,7 +1276,7 @@ void Lucerna::clock_lucerna() { plothands(); if ((_vm->_gyro->hour == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) - _vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); + _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); _vm->_gyro->oh = _vm->_gyro->hour; _vm->_gyro->onh = nh; diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 8e5897f82cb4..f337d97f7bfe 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -40,74 +40,40 @@ class Lucerna { public: bool holdLeftMouse; - - Lucerna(AvalancheEngine *vm); - ~Lucerna(); void init(); - - void callverb(byte n); - + void callVerb(byte id); void draw_also_lines(); - void mouse_init(); - void mousepage(uint16 page_); - void load(byte n); - void exitroom(byte x); - void enterroom(byte x, byte ped); - void thinkabout(byte z, bool th); // Hey!!! Get it and put it!!! - void load_digits(); // Load the scoring digits & rwlites - void toolbar(); - void showscore(); - void points(byte num); // Add on no. of points - void mouseway(const Common::Point &cursorPos); - void posxy(); - void fxtoggle(); - void objectlist(); - void checkclick(); - void errorled(); - void dusk(); - void dawn(); - void showrw(); - void clock_lucerna(); - void delavvy(); - void gameover(); - void minor_redraw(); - void major_redraw(); - uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees. - void flesh_colors(); - void sprite_run(); - void fix_flashers(); - void load_also(Common::String n); private: @@ -125,8 +91,8 @@ class Lucerna { }; //Clock - static const int16 xm = 510; - static const int16 ym = 183; + static const int16 _clockCenterX = 510; + static const int16 _clockCenterY = 183; Common::Point ah, am; uint16 nh; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index c45ddf96994e..cecafcfb4ed9 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -96,11 +96,11 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F5: { _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callverb(_vm->_gyro->f5_does()[0]); + _vm->_lucerna->callVerb(_vm->_gyro->f5_does()[0]); } break; case Common::KEYCODE_F7: - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeOpen); break; default: break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 4cab87a7a1d2..5c4b60b701cf 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -630,7 +630,7 @@ void Timeout::winning() { #endif // TODO: To be implemented with Pingo::winning_pic(). - _vm->_lucerna->callverb(_vm->_acci->kVerbCodeScore); + _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); _vm->_scrolls->display(" T H E E N D "); _vm->_gyro->lmo = true; } From 200670d32703179a0cd2746981bdc1992a86d17b Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 6 Sep 2013 16:23:57 +0200 Subject: [PATCH 0834/1332] AVALANCHE: More renaming in gyro2.h. --- engines/avalanche/acci2.cpp | 600 ++++++++++++++++---------------- engines/avalanche/avalanche.cpp | 208 +++++------ engines/avalanche/avalot.cpp | 60 ++-- engines/avalanche/celer2.cpp | 98 +++--- engines/avalanche/celer2.h | 2 +- engines/avalanche/dropdown2.cpp | 154 ++++---- engines/avalanche/enid2.cpp | 30 +- engines/avalanche/gyro2.cpp | 238 ++++++------- engines/avalanche/gyro2.h | 552 ++++++++++++----------------- engines/avalanche/lucerna2.cpp | 440 +++++++++++------------ engines/avalanche/parser.cpp | 22 +- engines/avalanche/scrolls2.cpp | 254 +++++++------- engines/avalanche/sequence2.cpp | 10 +- engines/avalanche/timeout2.cpp | 136 ++++---- engines/avalanche/trip6.cpp | 448 ++++++++++++------------ engines/avalanche/trip6.h | 14 +- engines/avalanche/visa2.cpp | 84 ++--- 17 files changed, 1600 insertions(+), 1750 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 05d4166407c3..7b3e84fd60f6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -208,7 +208,7 @@ Acci::Acci(AvalancheEngine *vm) { } void Acci::init() { - _vm->_gyro->weirdword = false; + _vm->_gyro->_weirdWord = false; } void Acci::clearWords() { @@ -252,7 +252,7 @@ void Acci::replace(Common::String oldChars, byte newChar) { Common::String Acci::rank() { for (byte i = 0; i < 8; i++) { - if ((_vm->_gyro->dna.score >= kRanks[i]._score) && (_vm->_gyro->dna.score < kRanks[i + 1]._score)) { + if ((_vm->_gyro->_dna._score >= kRanks[i]._score) && (_vm->_gyro->_dna._score < kRanks[i + 1]._score)) { return kRanks[i]._title; } } @@ -264,7 +264,7 @@ Common::String Acci::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = _vm->_gyro->dna.total_time / ticksInOneSec; // No. of seconds. + h = _vm->_gyro->_dna._totalTime / ticksInOneSec; // No. of seconds. h = floor((float)h); m = h % 3600; h = h / 3600; @@ -273,10 +273,10 @@ Common::String Acci::totalTime() { Common::String result = "You've been playing for "; if (h > 0) - result = result + _vm->_gyro->strf(h) + " hours, "; + result = result + _vm->_gyro->intToStr(h) + " hours, "; if ((m > 0) || (h != 0)) - result = result + _vm->_gyro->strf(m) + " minutes and "; - return result + _vm->_gyro->strf(s) + " seconds."; + result = result + _vm->_gyro->intToStr(m) + " minutes and "; + return result + _vm->_gyro->intToStr(s) + " seconds."; } void Acci::cheatParse(Common::String codes) { @@ -314,9 +314,9 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_scrolls->display("What?"); } else { if (animate) - _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getname(target) + " }"); + _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getName(target) + " }"); else { - Common::String z = _vm->_gyro->get_better(target); + Common::String z = _vm->_gyro->getItem(target); if (z != "") _vm->_scrolls->display(Common::String("{ ") + z + " }"); } @@ -330,18 +330,18 @@ bool Acci::doPronouns() { byte wordCode = _thats[i]; switch (wordCode) { case 200: { - displayWhat(_vm->_gyro->him, true, ambiguous); - _thats.setChar(_vm->_gyro->him, i); + displayWhat(_vm->_gyro->_him, true, ambiguous); + _thats.setChar(_vm->_gyro->_him, i); } break; case 201: { - displayWhat(_vm->_gyro->her, true, ambiguous); - _thats.setChar(_vm->_gyro->her, i); + displayWhat(_vm->_gyro->_her, true, ambiguous); + _thats.setChar(_vm->_gyro->_her, i); } break; case 202: { - displayWhat(_vm->_gyro->it, false, ambiguous); - _thats.setChar(_vm->_gyro->it, i); + displayWhat(_vm->_gyro->_it, false, ambiguous); + _thats.setChar(_vm->_gyro->_it, i); } break; } @@ -388,32 +388,32 @@ void Acci::storeInterrogation(byte interrogation) { case 1: _vm->_parser->_inputText.toLowercase(); sayIt(); - _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 2; + _vm->_gyro->_dna._favouriteDrink = _vm->_parser->_inputText; + _vm->_gyro->_dna._cardiffQuestionNum = 2; break; case 2: properNouns(); sayIt(); - _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 3; + _vm->_gyro->_dna._favouriteSong = _vm->_parser->_inputText; + _vm->_gyro->_dna._cardiffQuestionNum = 3; break; case 3: properNouns(); sayIt(); - _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 4; + _vm->_gyro->_dna._worstPlaceOnEarth = _vm->_parser->_inputText; + _vm->_gyro->_dna._cardiffQuestionNum = 4; break; case 4: _vm->_parser->_inputText.toLowercase(); sayIt(); - if (!_vm->_gyro->dna.spare_evening.empty()) - _vm->_gyro->dna.spare_evening.clear(); - _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; + if (!_vm->_gyro->_dna._spareEvening.empty()) + _vm->_gyro->_dna._spareEvening.clear(); + _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->dixi('z', 5); // His closing statement... _vm->_trip->tr[1].walkto(4); // The end of the drawbridge _vm->_trip->tr[1].vanishifstill = true; // Then go away! - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; - _vm->_gyro->dna.cardiff_things = 5; + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_dna._cardiffQuestionNum = 5; break; case 99: //store_high(_vm->_parser->_inputText); @@ -451,7 +451,7 @@ void Acci::parse() { // Are we being interrogated right now? if (_vm->_gyro->_interrogation > 0) { storeInterrogation(_vm->_gyro->_interrogation); - _vm->_gyro->weirdword = true; + _vm->_gyro->_weirdWord = true; return; } @@ -483,7 +483,7 @@ void Acci::parse() { // Check also[] first, which conatins words about the actual room. if (!thisword.empty()) { for (byte i = 0; i < 31; i++) { - if ((_vm->_gyro->also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->also[i][0]) > -1)) { + if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { _thats = _thats + Common::String(99 + i); notfound = false; } @@ -533,12 +533,12 @@ void Acci::parse() { replace(Common::String('\x4') + '\xE5', 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_gyro->dna.room == r__nottspub) + if (_vm->_gyro->_dna._room == r__nottspub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__aylesoffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; @@ -550,39 +550,39 @@ void Acci::parse() { } if (doPronouns()) { - _vm->_gyro->weirdword = true; + _vm->_gyro->_weirdWord = true; _thats = kNothing; return; } // Second parsing. - if (!_vm->_gyro->subject.empty()) - _vm->_gyro->subject.clear(); - _vm->_gyro->subjnumber = 0; // Find subject of conversation. + if (!_vm->_gyro->_subject.empty()) + _vm->_gyro->_subject.clear(); + _vm->_gyro->_subjectNum = 0; // Find subject of conversation. for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { - _vm->_gyro->subjnumber = (byte)_thats[i]; + _vm->_gyro->_subjectNum = (byte)_thats[i]; _thats.setChar(kMoved, i); break; } } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // Still not found. + if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found. for (uint16 i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. - _vm->_gyro->subjnumber = (byte)_thats[i + 1]; + _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } } } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". for (uint16 i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition - _vm->_gyro->subjnumber = (byte)_thats[i + 1]; + _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } @@ -603,30 +603,30 @@ void Acci::parse() { if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); - _vm->_gyro->weirdword = true; + _vm->_gyro->_weirdWord = true; } else - _vm->_gyro->weirdword = false; + _vm->_gyro->_weirdWord = false; if (_thats.empty()) _thats = kNothing; if (_thing != kPardon) - _vm->_gyro->it = _thing; + _vm->_gyro->_it = _thing; if (_person != kPardon) { if (_person < 175) - _vm->_gyro->him = _person; + _vm->_gyro->_him = _person; else - _vm->_gyro->her = _person; + _vm->_gyro->_her = _person; } } void Acci::examineObject() { - if (_thing != _vm->_gyro->thinks) + if (_thing != _vm->_gyro->_thinks) _vm->_lucerna->thinkabout(_thing, _vm->_gyro->kThing); switch (_thing) { - case Gyro::wine : - switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine. + case Gyro::kObjectWine : + switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_visa->dixi('t', 1); // Normal examine wine scroll break; @@ -638,8 +638,8 @@ void Acci::examineObject() { break; } break; - case Gyro::onion: - if (_vm->_gyro->dna.rotten_onion) + case Gyro::kObjectOnion: + if (_vm->_gyro->_dna._rottenOnion) _vm->_visa->dixi('q', 21); // Yucky onion. else _vm->_visa->dixi('t', 18); // Normal onion scroll @@ -650,7 +650,7 @@ void Acci::examineObject() { } bool Acci::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->dna.room)) + if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_dna._room)) return true; else { if (_person < 175) @@ -664,18 +664,18 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". void Acci::exampers() { if (isPersonHere()) { - if (_thing != _vm->_gyro->thinks) + if (_thing != _vm->_gyro->_thinks) _vm->_lucerna->thinkabout(_person, _vm->_gyro->kPerson); _person -= 149; switch (_person) { // Special cases case 11: - if (_vm->_gyro->dna.wonnim) { + if (_vm->_gyro->_dna._wonNim) { _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" return; } break; case 99: - if (_vm->_gyro->dna.lustie_is_asleep) { + if (_vm->_gyro->_dna._lustieIsAsleep) { _vm->_visa->dixi('Q', 65); // He's asleep. (65! Wow!) return; } @@ -686,7 +686,7 @@ void Acci::exampers() { } // And afterwards... - if ((_person == 14) && (!_vm->_gyro->dna.ayles_is_awake)) + if ((_person == 14) && (!_vm->_gyro->_dna._aylesIsAwake)) _vm->_visa->dixi('Q', 13); } @@ -698,7 +698,7 @@ bool Acci::holding() { if (_thing > 100) _vm->_scrolls->display("Be reasonable!"); - else if (!_vm->_gyro->dna.obj[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_gyro->_dna._objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_scrolls->display("You're not holding it, Avvy."); else holdingResult = true; @@ -707,7 +707,7 @@ bool Acci::holding() { } void Acci::openBox(bool isOpening) { - if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { + if ((_vm->_gyro->_dna._room == r__yours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); @@ -734,7 +734,7 @@ void Acci::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_scrolls->display(*_vm->_gyro->also[_thing - 50][1]); + _vm->_scrolls->display(*_vm->_gyro->_also[_thing - 50][1]); openBox(false); } } @@ -748,20 +748,20 @@ void Acci::inventory() { byte itemNum = 0; _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); - for (byte i = 0; i < numobjs; i++) { - if (_vm->_gyro->dna.obj[i]) { + for (byte i = 0; i < kObjectNum; i++) { + if (_vm->_gyro->_dna._objects[i]) { itemNum++; - if (itemNum == _vm->_gyro->dna.carrying) + if (itemNum == _vm->_gyro->_dna._carryNum) _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); - if ((i + 1) == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(_vm->_gyro->getItem(i + 1) + _vm->_scrolls->kControlToBuffer); + if ((i + 1) == _vm->_gyro->_dna._wearing) _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); - if (itemNum < _vm->_gyro->dna.carrying) + if (itemNum < _vm->_gyro->_dna._carryNum) _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); } } - if (_vm->_gyro->dna.wearing == kNothing) + if (_vm->_gyro->_dna._wearing == kNothing) _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); else _vm->_scrolls->display("."); @@ -769,17 +769,17 @@ void Acci::inventory() { void Acci::swallow() { // Eat something. switch (_thing) { - case Gyro::wine: - switch (_vm->_gyro->dna.winestate) { // 4 is perfect + case Gyro::kObjectWine: + switch (_vm->_gyro->_dna._wineState) { // 4 is perfect case 1: - if (_vm->_gyro->dna.teetotal) { + if (_vm->_gyro->_dna._teetotal) { _vm->_visa->dixi('D', 6); return; } _vm->_visa->dixi('U', 1); _vm->_pingo->wobble(); _vm->_visa->dixi('U', 2); - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; _vm->_lucerna->objectlist(); drink(); break; @@ -789,33 +789,33 @@ void Acci::swallow() { // Eat something. break; // You can't drink it! } break; - case Gyro::potion: - _vm->_gyro->background(4); + case Gyro::kObjectPotion: + _vm->_gyro->setBackgroundColor(4); _vm->_visa->dixi('U', 3); _vm->_lucerna->gameover(); - _vm->_gyro->background(0); + _vm->_gyro->setBackgroundColor(0); break; - case Gyro::ink: + case Gyro::kObjectInk: _vm->_visa->dixi('U', 4); break; - case Gyro::chastity: + case Gyro::kObjectChastity: _vm->_visa->dixi('U', 5); break; - case Gyro::mushroom: + case Gyro::kObjectMushroom: _vm->_visa->dixi('U', 6); _vm->_lucerna->gameover(); break; - case Gyro::onion: - if (_vm->_gyro->dna.rotten_onion) + case Gyro::kObjectOnion: + if (_vm->_gyro->_dna._rottenOnion) _vm->_visa->dixi('U', 11); else { _vm->_visa->dixi('U', 8); - _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; _vm->_lucerna->objectlist(); } break; default: - if ((_vm->_gyro->dna.room == r__argentpub) || (_vm->_gyro->dna.room == r__nottspub)) + if ((_vm->_gyro->_dna._room == r__argentpub) || (_vm->_gyro->_dna._room == r__nottspub)) _vm->_scrolls->display("Try BUYing things before you drink them!"); else _vm->_scrolls->display("The taste of it makes you retch!"); @@ -826,7 +826,7 @@ void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) numPeople++; } @@ -835,14 +835,14 @@ void Acci::peopleInRoom() { byte actPerson = 0; // Actually listed people. for (byte i = 1; i < 29; i++) { - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->dna.room) { + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { actPerson++; if (actPerson == 1) // First on the list. - _vm->_scrolls->display(_vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(_vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); else if (actPerson < numPeople) // The middle... - _vm->_scrolls->display(Common::String(", ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(Common::String(", ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); else // The end. - _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); } } @@ -855,30 +855,30 @@ void Acci::peopleInRoom() { } void Acci::lookAround() { - _vm->_scrolls->display(*_vm->_gyro->also[0][1]); - switch (_vm->_gyro->dna.room) { + _vm->_scrolls->display(*_vm->_gyro->_also[0][1]); + switch (_vm->_gyro->_dna._room) { case r__spludwicks: - if (_vm->_gyro->dna.avaricius_talk > 0) + if (_vm->_gyro->_dna._avariciusTalk > 0) _vm->_visa->dixi('q', 23); else peopleInRoom(); break; case r__robins: - if (_vm->_gyro->dna.tied_up) + if (_vm->_gyro->_dna._tiedUp) _vm->_visa->dixi('q', 38); - if (_vm->_gyro->dna.mushroom_growing) + if (_vm->_gyro->_dna._mushroomGrowing) _vm->_visa->dixi('q', 55); break; case r__insidecardiffcastle: - if (!_vm->_gyro->dna.taken_pen) + if (!_vm->_gyro->_dna._takenPen) _vm->_visa->dixi('q', 49); break; case r__lustiesroom: - if (_vm->_gyro->dna.lustie_is_asleep) + if (_vm->_gyro->_dna._lustieIsAsleep) _vm->_visa->dixi('q', 65); break; case r__catacombs: - switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { + switch (_vm->_gyro->_dna._catacombY * 256 + _vm->_gyro->_dna._catacombX) { case 258 : _vm->_visa->dixi('q', 80); // Inside art gallery. break; @@ -897,7 +897,7 @@ void Acci::lookAround() { void Acci::openDoor() { // Special cases. - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__yours: if (_vm->_trip->infield(2)) { // Opening the box. @@ -915,21 +915,21 @@ void Acci::openDoor() { break; } - if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) + if ((!_vm->_gyro->_dna._userMovesAvvy) && (_vm->_gyro->_dna._room != r__lusties)) return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) { if (_vm->_trip->infield(fv + 1)) { fv -= 8; - switch (_vm->_gyro->portals[fv].op) { + switch (_vm->_gyro->_portals[fv]._operation) { case Gyro::kMagicExclaim: _vm->_trip->tr[0].bounce(); - _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); + _vm->_visa->dixi('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: - _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8, // High byte - (_vm->_gyro->portals[fv].data) & 0x0F // Low byte + _vm->_trip->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte + (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte ); break; case Gyro::kMagicUnfinished: @@ -937,10 +937,10 @@ void Acci::openDoor() { _vm->_scrolls->display("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_trip->call_special(_vm->_gyro->portals[fv].data); + _vm->_trip->call_special(_vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicOpenDoor: - _vm->_trip->open_the_door((_vm->_gyro->portals[fv].data) >> 8, (_vm->_gyro->portals[fv].data) & 0x0F, fv + 9); + _vm->_trip->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); break; } @@ -948,7 +948,7 @@ void Acci::openDoor() { } } - if (_vm->_gyro->dna.room == r__map) + if (_vm->_gyro->_dna._room == r__map) _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.")); else @@ -974,16 +974,16 @@ void Acci::putProc() { // Thing is the _thing which you're putting in. _thing2 is where you're putting it. switch (_thing2) { - case Gyro::wine: - if (_thing == _vm->_gyro->onion) { - if (_vm->_gyro->dna.rotten_onion) + case Gyro::kObjectWine: + if (_thing == _vm->_gyro->kObjectOnion) { + if (_vm->_gyro->_dna._rottenOnion) _vm->_scrolls->display("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_gyro->dna.winestate != 3) + if (_vm->_gyro->_dna._wineState != 3) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" + _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); else { // Put onion into vinegar! Yes! - _vm->_gyro->dna.onion_in_vinegar = true; + _vm->_gyro->_dna._onionInVinegar = true; _vm->_lucerna->points(7); _vm->_visa->dixi('u', 9); } @@ -993,31 +993,31 @@ void Acci::putProc() { break; case 54: - if (_vm->_gyro->dna.room == r__yours) { // Put something into the box. - if (_vm->_gyro->dna.box_contents != kNothing) + if (_vm->_gyro->_dna._room == r__yours) { // Put something into the box. + if (_vm->_gyro->_dna._boxContent != kNothing) _vm->_scrolls->display("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { - case Gyro::money: + case Gyro::kObjectMoney: _vm->_scrolls->display("You'd better keep some ready cash on you!"); break; - case Gyro::bell: + case Gyro::kObjectBell: _vm->_scrolls->display("That's a silly place to keep a bell."); break; - case Gyro::bodkin: + case Gyro::kObjectBodkin: _vm->_scrolls->display("But you might need it!"); break; - case Gyro::onion: + case Gyro::kObjectOnion: _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_gyro->dna.wearing == _thing) - _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->get_better(_thing) + " off first!"); + if (_vm->_gyro->_dna._wearing == _thing) + _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->getItem(_thing) + " off first!"); else { openBox(true); // Open box. - _vm->_gyro->dna.box_contents = _thing; - _vm->_gyro->dna.obj[_thing - 1] = false; + _vm->_gyro->_dna._boxContent = _thing; + _vm->_gyro->_dna._objects[_thing - 1] = false; _vm->_lucerna->objectlist(); _vm->_scrolls->display("OK, it's in the box."); @@ -1038,7 +1038,7 @@ void Acci::putProc() { void Acci::notInOrder() { _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") - + _vm->_gyro->get_better(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick]) + + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } @@ -1053,39 +1053,39 @@ void Acci::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Acci::giveToSpludwick() { - if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick] != _thing) { + if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick] != _thing) { notInOrder(); return false; } switch (_thing) { - case Gyro::onion: - _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; - if (_vm->_gyro->dna.rotten_onion) + case Gyro::kObjectOnion: + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; + if (_vm->_gyro->_dna._rottenOnion) _vm->_visa->dixi('q', 22); else { - _vm->_gyro->dna.given2spludwick++; + _vm->_gyro->_dna._givenToSpludwick++; _vm->_visa->dixi('q', 20); goToCauldron(); _vm->_lucerna->points(3); } _vm->_lucerna->objectlist(); break; - case Gyro::ink: - _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; + case Gyro::kObjectInk: + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = false; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.given2spludwick++; + _vm->_gyro->_dna._givenToSpludwick++; _vm->_visa->dixi('q', 24); goToCauldron(); _vm->_lucerna->points(3); break; - case Gyro::mushroom: - _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; + case Gyro::kObjectMushroom: + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = false; _vm->_visa->dixi('q', 25); _vm->_lucerna->points(5); - _vm->_gyro->dna.given2spludwick++; + _vm->_gyro->_dna._givenToSpludwick++; goToCauldron(); - _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; _vm->_lucerna->objectlist(); break; default: @@ -1096,30 +1096,30 @@ bool Acci::giveToSpludwick() { } void Acci::drink() { - _vm->_gyro->dna.alcohol += 1; - if (_vm->_gyro->dna.alcohol == 5) { - _vm->_gyro->dna.obj[_vm->_gyro->key - 1] = true; // Get the key. - _vm->_gyro->dna.teetotal = true; - _vm->_gyro->dna.avvy_is_awake = false; - _vm->_gyro->dna.avvy_in_bed = true; + _vm->_gyro->_dna._alcoholLevel += 1; + if (_vm->_gyro->_dna._alcoholLevel == 5) { + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1] = true; // Get the key. + _vm->_gyro->_dna._teetotal = true; + _vm->_gyro->_dna._avvyIsAwake = false; + _vm->_gyro->_dna._avvyInBed = true; _vm->_lucerna->objectlist(); _vm->_lucerna->dusk(); - _vm->_gyro->hang_around_for_a_while(); + _vm->_gyro->hangAroundForAWhile(); _vm->_trip->fliproom(1, 1); - _vm->_gyro->background(14); + _vm->_gyro->setBackgroundColor(14); _vm->_trip->new_game_for_trippancy(); // Not really. } } void Acci::cardiffClimbing() { - if (_vm->_gyro->dna.standing_on_dais) { // Clamber up. + if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. _vm->_scrolls->display("You climb down, back onto the floor."); - _vm->_gyro->dna.standing_on_dais = false; + _vm->_gyro->_dna._standingOnDais = false; _vm->_trip->apped(1, 3); } else { // Clamber down. if (_vm->_trip->infield(1)) { _vm->_scrolls->display("You clamber up onto the dais."); - _vm->_gyro->dna.standing_on_dais = true; + _vm->_gyro->_dna._standingOnDais = true; _vm->_trip->apped(1, 2); } else _vm->_scrolls->display("Get a bit closer, Avvy."); @@ -1131,21 +1131,21 @@ void Acci::already() { } void Acci::standUp() { - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__yours: // Avvy isn't asleep. - if (_vm->_gyro->dna.avvy_is_awake && _vm->_gyro->dna.avvy_in_bed) { // But he's in bed. - if (_vm->_gyro->dna.teetotal) { + if (_vm->_gyro->_dna._avvyIsAwake && _vm->_gyro->_dna._avvyInBed) { // But he's in bed. + if (_vm->_gyro->_dna._teetotal) { _vm->_visa->dixi('d', 12); - _vm->_gyro->background(0); + _vm->_gyro->setBackgroundColor(0); _vm->_visa->dixi('d', 14); } _vm->_trip->tr[0].visible = true; - _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->_dna._userMovesAvvy = true; _vm->_trip->apped(1, 2); - _vm->_gyro->dna.rw = _vm->_gyro->kDirectionLeft; + _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->points(1); - _vm->_gyro->dna.avvy_in_bed = false; + _vm->_gyro->_dna._avvyInBed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); } else already(); @@ -1156,12 +1156,12 @@ void Acci::standUp() { break; case r__nottspub: - if (_vm->_gyro->dna.sitting_in_pub) { + if (_vm->_gyro->_dna._sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_trip->tr[0].visible = true; // But standing up. _vm->_trip->apped(1, 4); // And walking away. - _vm->_gyro->dna.sitting_in_pub = false; // Really not sitting down. - _vm->_gyro->dna.user_moves_avvy = true; // And ambulant. + _vm->_gyro->_dna._sittingInPub = false; // Really not sitting down. + _vm->_gyro->_dna._userMovesAvvy = true; // And ambulant. } else already(); break; @@ -1173,42 +1173,42 @@ void Acci::standUp() { void Acci::getProc(char thing) { - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__yours: if (_vm->_trip->infield(2)) { - if (_vm->_gyro->dna.box_contents == thing) { + if (_vm->_gyro->_dna._boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); - _vm->_gyro->dna.obj[thing - 1] = true; + _vm->_gyro->_dna._objects[thing - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.box_contents = kNothing; + _vm->_gyro->_dna._boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else - _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); + _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box."); } else _vm->_visa->dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { - case Gyro::pen: + case Gyro::kObjectPen: if (_vm->_trip->infield(2)) { // Standing on the dais. - if (_vm->_gyro->dna.taken_pen) + if (_vm->_gyro->_dna._takenPen) _vm->_scrolls->display("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. _vm->_trip->call_special(3); // Zap! - _vm->_gyro->dna.taken_pen = true; - _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; + _vm->_gyro->_dna._takenPen = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; _vm->_lucerna->objectlist(); _vm->_scrolls->display("Taken."); } - } else if (_vm->_gyro->dna.standing_on_dais) + } else if (_vm->_gyro->_dna._standingOnDais) _vm->_visa->dixi('q', 53); else _vm->_visa->dixi('q', 51); break; - case Gyro::bolt: + case Gyro::kObjectBolt: _vm->_visa->dixi('q', 52); break; default: @@ -1216,12 +1216,12 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro->mushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { + if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->display("Got it!"); - _vm->_gyro->dna.mushroom_growing = false; - _vm->_gyro->dna.taken_mushroom = true; - _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = true; + _vm->_gyro->_dna._mushroomGrowing = false; + _vm->_gyro->_dna._takenMushroom = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); } else @@ -1237,11 +1237,11 @@ void Acci::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Acci::giveGeidaTheLute() { - if (_vm->_gyro->dna.room != r__lustiesroom) { + if (_vm->_gyro->_dna._room != r__lustiesroom) { _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } - _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; _vm->_lucerna->objectlist(); _vm->_visa->dixi('q', 64); // She plays it. @@ -1267,13 +1267,13 @@ void Acci::winSequence() { void Acci::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) - _person = _vm->_gyro->her; + if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_dna._room)) + _person = _vm->_gyro->_her; else - _person = _vm->_gyro->him; + _person = _vm->_gyro->_him; } - if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->dna.room) { + if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! return; } @@ -1289,7 +1289,7 @@ void Acci::personSpeaks() { if (!found) { for (byte i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i].who == _person) && (_vm->_gyro->kQuasipeds[i].room == _vm->_gyro->dna.room)) + if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); } } @@ -1297,7 +1297,7 @@ void Acci::personSpeaks() { void Acci::heyThanks() { personSpeaks(); _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); - _vm->_gyro->dna.obj[_thing - 1] = false; + _vm->_gyro->_dna._objects[_thing - 1] = false; } /** @@ -1312,7 +1312,7 @@ void Acci::doThat() { return; } - if (_vm->_gyro->weirdword) + if (_vm->_gyro->_weirdWord) return; if (_thing < 200) @@ -1322,11 +1322,11 @@ void Acci::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_gyro->alive) { + if (!_vm->_gyro->_alive) { _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); return; } - if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + if (!_vm->_gyro->_dna._avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_scrolls->display("Talking in your sleep? Try waking up!"); return; } @@ -1345,7 +1345,7 @@ void Acci::doThat() { break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_gyro->dna.carrying >= maxobjs) + if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->display("You can't carry any more!"); else getProc(_thing); @@ -1365,20 +1365,20 @@ void Acci::doThat() { break; case kVerbCodeTalk: if (_person == kPardon) { - if (_vm->_gyro->subjnumber == 99) // They typed "say password". + if (_vm->_gyro->_subjectNum == 99) // They typed "say password". _vm->_scrolls->display(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); - else if (((1 <= _vm->_gyro->subjnumber) && (_vm->_gyro->subjnumber <= 49)) || (_vm->_gyro->subjnumber == 253) || (_vm->_gyro->subjnumber == 249)) { + else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); for (byte i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = _vm->_gyro->subjnumber; + _verb = _vm->_gyro->_subjectNum; doThat(); return; } else { - _person = _vm->_gyro->subjnumber; - _vm->_gyro->subjnumber = 0; + _person = _vm->_gyro->_subjectNum; + _vm->_gyro->_subjectNum = 0; if ((_person == 0) || (_person == kPardon)) _vm->_scrolls->display("Talk to whom?"); else if (isPersonHere()) @@ -1393,53 +1393,53 @@ void Acci::doThat() { _vm->_scrolls->display("Give to whom?"); else if (isPersonHere()) { switch (_thing) { - case Gyro::money : + case Gyro::kObjectMoney : _vm->_scrolls->display("You can't bring yourself to give away your moneybag."); break; - case Gyro::bodkin: - case Gyro::bell: - case Gyro::clothes: - case Gyro::habit : + case Gyro::kObjectBodkin: + case Gyro::kObjectBell: + case Gyro::kObjectClothes: + case Gyro::kObjectHabit : _vm->_scrolls->display("Don't give it away, it might be useful!"); break; default: switch (_person) { - case Gyro::pcrapulus: - if (_thing == _vm->_gyro->wine) { + case Gyro::kPeopleCrapulus: + if (_thing == _vm->_gyro->kObjectWine) { _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; } else heyThanks(); break; - case Gyro::pcwytalot: - if ((_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) + case Gyro::kPeopleCwytalot: + if ((_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt)) _vm->_scrolls->display(Common::String("You might be able to influence Cwytalot more if you used it!")); else heyThanks(); break; - case Gyro::pspludwick: + case Gyro::kPeopleSpludwick: if (giveToSpludwick()) heyThanks(); break; - case Gyro::pibythneth: - if (_thing == _vm->_gyro->badge) { + case Gyro::kPeopleIbythneth: + if (_thing == _vm->_gyro->kObjectBadge) { _vm->_visa->dixi('q', 32); // Thanks! Wow! _vm->_lucerna->points(3); - _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; - _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; - _vm->_gyro->dna.givenbadgetoiby = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectHabit - 1] = true; + _vm->_gyro->_dna._givenBadgeToIby = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); } else heyThanks(); break; - case Gyro::payles: - if (_vm->_gyro->dna.ayles_is_awake) { - if (_thing == _vm->_gyro->pen) { - _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; + case Gyro::kPeopleAyles: + if (_vm->_gyro->_dna._aylesIsAwake) { + if (_thing == _vm->_gyro->kObjectPen) { + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = false; _vm->_visa->dixi('q', 54); - _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = true; - _vm->_gyro->dna.given_pen_to_ayles = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = true; + _vm->_gyro->_dna._givenPenToAyles = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(2); } else @@ -1447,26 +1447,26 @@ void Acci::doThat() { } else _vm->_scrolls->display("But he's asleep!"); break; - case Gyro::pgeida: + case Gyro::kPeopleGeida: switch (_thing) { - case Gyro::potion: - _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = false; + case Gyro::kObjectPotion: + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = false; _vm->_visa->dixi('u', 16); // She drinks it. _vm->_lucerna->points(2); - _vm->_gyro->dna.geida_given_potion = true; + _vm->_gyro->_dna._givenPotionToGeida = true; _vm->_lucerna->objectlist(); break; - case Gyro::lute: + case Gyro::kObjectLute: giveGeidaTheLute(); break; default: heyThanks(); } break; - case Gyro::parkata: + case Gyro::kPeopleArkata: switch (_thing) { - case Gyro::potion: - if (_vm->_gyro->dna.geida_given_potion) + case Gyro::kObjectPotion: + if (_vm->_gyro->_dna._givenPotionToGeida) winSequence(); else _vm->_visa->dixi('q', 77); // That Geida woman! @@ -1515,7 +1515,7 @@ void Acci::doThat() { if (!_polite) _vm->_scrolls->display("How about a `please\", Avvy?"); else if (_vm->_scrolls->ask(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) - _vm->_gyro->lmo = true; + _vm->_gyro->_letMeOut = true; break; case kVerbCodeGo: _vm->_scrolls->display("Just use the arrow keys to walk there."); @@ -1529,18 +1529,18 @@ void Acci::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + "The medival descendant of" + _vm->_scrolls->kControlNewLine + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " - + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; + + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " + + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; _vm->_scrolls->display(toDisplay); _vm->_scrolls->aboutscroll = false; } break; case kVerbCodeUndress: - if (_vm->_gyro->dna.wearing == kNothing) + if (_vm->_gyro->_dna._wearing == kNothing) _vm->_scrolls->display("You're already stark naked!"); - else if (_vm->_gyro->dna.avvys_in_the_cupboard) { - _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->get_better(_vm->_gyro->dna.wearing) + '.'); - _vm->_gyro->dna.wearing = kNothing; + else if (_vm->_gyro->_dna._avvysInTheCupboard) { + _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.'); + _vm->_gyro->_dna._wearing = kNothing; _vm->_lucerna->objectlist(); } else _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); @@ -1548,25 +1548,25 @@ void Acci::doThat() { case kVerbCodeWear: if (holding()) { // Wear something. switch (_thing) { - case Gyro::chastity: + case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you\?\?!"); break; - case Gyro::clothes: - case Gyro::habit: { // Change this! - if (_vm->_gyro->dna.wearing != kNothing) { - if (_vm->_gyro->dna.wearing == _thing) + case Gyro::kObjectClothes: + case Gyro::kObjectHabit: { // Change this! + if (_vm->_gyro->_dna._wearing != kNothing) { + if (_vm->_gyro->_dna._wearing == _thing) _vm->_scrolls->display("You're already wearing that."); else _vm->_scrolls->display("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_gyro->dna.wearing = _thing; + _vm->_gyro->_dna._wearing = _thing; _vm->_lucerna->objectlist(); byte i; - if (_thing == _vm->_gyro->habit) + if (_thing == _vm->_gyro->kObjectHabit) i = 3; else i = 0; @@ -1587,35 +1587,35 @@ void Acci::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_gyro->dna.room) { // They just typed "play"... + switch (_vm->_gyro->_dna._room) { // They just typed "play"... case r__argentpub: { // ...in the pub, => play Nim. warning("STUB: Acci::doThat() - case kVerbCodeplay"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_gyro->dna.wonnim) { // Already won the game. + if (_vm->_gyro->_dna._wonNim) { // Already won the game. _vm->_visa->dixi('Q', 6); return; } - if (!_vm->_gyro->dna.asked_dogfood_about_nim) { + if (!_vm->_gyro->_dna._askedDogfoodAboutNim) { _vm->_visa->dixi('q', 84); return; } _vm->_visa->dixi('Q', 3); - _vm->_gyro->dna.playednim++; + _vm->_gyro->_dna._playedNim++; // You won - strange! _vm->_visa->dixi('Q', 7); // You won! Give us a lute! - _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.wonnim = true; + _vm->_gyro->_dna._wonNim = true; _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. _vm->_lucerna->points(7); // 7 points for winning! - if (_vm->_gyro->dna.playednim == 1) + if (_vm->_gyro->_dna._playedNim == 1) _vm->_lucerna->points(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! @@ -1629,23 +1629,23 @@ void Acci::doThat() { } } else if (holding()) { switch (_thing) { - case Gyro::lute : + case Gyro::kObjectLute : _vm->_visa->dixi('U', 7); - if (_vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] == _vm->_gyro->_dna._room) _vm->_visa->dixi('U', 10); - if (_vm->_gyro->_whereIs[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) + if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleDuLustie - 150] == _vm->_gyro->_dna._room) _vm->_visa->dixi('U', 15); break; case 52: - if (_vm->_gyro->dna.room == r__musicroom) + if (_vm->_gyro->_dna._room == r__musicroom) playHarp(); else _vm->_scrolls->display(kWhat); break; case 55: - if (_vm->_gyro->dna.room == r__argentpub) + if (_vm->_gyro->_dna._room == r__argentpub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay"); else @@ -1658,9 +1658,9 @@ void Acci::doThat() { break; case kVerbCodeRing: if (holding()) { - if (_thing == _vm->_gyro->bell) { + if (_thing == _vm->_gyro->kObjectBell) { _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) + if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1682,7 +1682,7 @@ void Acci::doThat() { warning("STUB: Acci::doThat() - case kVerbCodeboss"); break; case kVerbCodePee: - if (_vm->_gyro->flagset('P')) { + if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->display("Hmm, I don't think anyone will notice..."); _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else @@ -1691,13 +1691,13 @@ void Acci::doThat() { break; case kVerbCodeCheat: _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); - _vm->_gyro->cheat = true; + _vm->_gyro->_cheat = true; break; case kVerbCodeMagic: - if (_vm->_gyro->dna.avaricius_talk > 0) + if (_vm->_gyro->_dna._avariciusTalk > 0) _vm->_visa->dixi('q', 19); else { - if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! + if ((_vm->_gyro->_dna._room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! _vm->_visa->dixi('q', 17); if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->dixi('q', 18); @@ -1707,7 +1707,7 @@ void Acci::doThat() { _vm->_trip->tr[1].walkto(5); _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procback_and_forth; - _vm->_gyro->dna.avaricius_talk = 14; + _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } } else @@ -1718,7 +1718,7 @@ void Acci::doThat() { _vm->_scrolls->display("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: - switch (_vm->_gyro->dna.swore) { + switch (_vm->_gyro->_dna._sworeNum) { case 0: _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(I shouldn't say it again, if I were you!)"); @@ -1733,18 +1733,18 @@ void Acci::doThat() { + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna->gameover(); } - _vm->_gyro->dna.swore++; + _vm->_gyro->_dna._sworeNum++; break; case kVerbCodeListen: - if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) + if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) _vm->_scrolls->display("All other noise is drowned out by the ringing of the bells."); - else if (_vm->_gyro->listen.empty()) + else if (_vm->_gyro->_listen.empty()) _vm->_scrolls->display("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls->display(_vm->_gyro->listen); + _vm->_scrolls->display(_vm->_gyro->_listen); break; case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__argentpub: if (_vm->_trip->infield(6)) { // We're in a pub, and near the bar. switch (_thing) { @@ -1752,50 +1752,50 @@ void Acci::doThat() { case 53: case 54: case 58: // Beer, whisky, cider or mead. - if (_vm->_gyro->dna.malagauche == 177) { // Already getting us one. + if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. _vm->_visa->dixi('D', 15); return; } - if (_vm->_gyro->dna.teetotal) { + if (_vm->_gyro->_dna._teetotal) { _vm->_visa->dixi('D', 6); return; } - if (_vm->_gyro->dna.alcohol == 0) + if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->points(3); _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); - _vm->_gyro->dna.drinking = _thing; + _vm->_gyro->_dna._drinking = _thing; _vm->_celer->drawBackgroundSprite(-1, -1, 10); - _vm->_gyro->dna.malagauche = 177; + _vm->_gyro->_dna._malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! - case Gyro::wine: - if (_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) // We've already got the wine! + case Gyro::kObjectWine: + if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) // We've already got the wine! _vm->_visa->dixi('D', 2); // 1 bottle's shufishent! else { - if (_vm->_gyro->dna.malagauche == 177) { // Already getting us one. + if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. _vm->_visa->dixi('D', 15); return; } - if (_vm->_gyro->dna.carrying >= maxobjs) { + if (_vm->_gyro->_dna._carryNum >= kCarryLimit) { _vm->_scrolls->display("Your hands are full."); return; } _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); - if (_vm->_gyro->dna.alcohol == 0) + if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->points(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); - _vm->_gyro->dna.malagauche = 177; + _vm->_gyro->_dna._malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); } @@ -1807,24 +1807,24 @@ void Acci::doThat() { case r__outsideducks: if (_vm->_trip->infield(6)) { - if (_thing == _vm->_gyro->onion) { - if (_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) + if (_thing == _vm->_gyro->kObjectOnion) { + if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! - else if (_vm->_gyro->dna.carrying >= maxobjs) + else if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->display("Before you ask, you remember that your hands are full."); else { - if (_vm->_gyro->dna.bought_onion) + if (_vm->_gyro->_dna._boughtOnion) _vm->_visa->dixi('D', 11); else { _vm->_visa->dixi('D', 9); _vm->_lucerna->points(3); } - _vm->_gyro->pennycheck(3); // It costs thruppence. - _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = true; + _vm->_gyro->updateMoney(3); // It costs thruppence. + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.bought_onion = true; - _vm->_gyro->dna.rotten_onion = false; // It's OK when it leaves the stall! - _vm->_gyro->dna.onion_in_vinegar = false; + _vm->_gyro->_dna._boughtOnion = true; + _vm->_gyro->_dna._rottenOnion = false; // It's OK when it leaves the stall! + _vm->_gyro->_dna._onionInVinegar = false; } } else _vm->_visa->dixi('D', 0); @@ -1840,10 +1840,10 @@ void Acci::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_gyro->dna.room == r__brummieroad) && - ((_person == 157) || (_thing == _vm->_gyro->crossbow) || (_thing == _vm->_gyro->bolt)) - && (_vm->_gyro->_whereIs[7] == _vm->_gyro->dna.room)) { - switch (_vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] + _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] * 2) { + if ((_vm->_gyro->_dna._room == r__brummieroad) && + ((_person == 157) || (_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt)) + && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_dna._room)) { + switch (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->dixi('Q', 10); @@ -1857,11 +1857,11 @@ void Acci::doThat() { break; case 3: _vm->_visa->dixi('Q', 11); - _vm->_gyro->dna.cwytalot_gone = true; - _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = false; - _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = false; + _vm->_gyro->_dna._cwytalotGone = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = false; _vm->_lucerna->objectlist(); - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->points(7); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; @@ -1875,27 +1875,27 @@ void Acci::doThat() { _vm->_visa->dixi('Q', 10); break; case kVerbCodePasswd: - if (_vm->_gyro->dna.room != r__bridge) + if (_vm->_gyro->_dna._room != r__bridge) _vm->_visa->dixi('Q', 12); else { bool ok = true; for (byte i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - for (byte j = 0; j < kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word.size(); j++) { - if (kVocabulary[_vm->_gyro->dna.pass_num + kFirstPassword]._word[j] != temp[j]) + for (byte j = 0; j < kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word.size(); j++) { + if (kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word[j] != temp[j]) ok = false; } } if (ok) { - if (_vm->_gyro->dna.drawbridge_open != 0) + if (_vm->_gyro->_dna._drawbridgeOpen != 0) _vm->_scrolls->display("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna->points(4); _vm->_scrolls->display("The drawbridge opens!"); _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); - _vm->_gyro->dna.drawbridge_open = 1; + _vm->_gyro->_dna._drawbridgeOpen = 1; } } else _vm->_visa->dixi('Q', 12); @@ -1908,7 +1908,7 @@ void Acci::doThat() { _vm->_lucerna->gameover(); break; case kVerbCodeScore: - _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ',' + _vm->_scrolls->kControlCenter + _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->intToStr(_vm->_gyro->_dna._score) + ',' + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totalTime()); break; @@ -1923,13 +1923,13 @@ void Acci::doThat() { _vm->_scrolls->display("Kiss whom?"); else if (isPersonHere()) { switch (_person) { - case Gyro::parkata: + case Gyro::kPeopleArkata: _vm->_visa->dixi('U', 12); break; - case Gyro::pgeida: + case Gyro::kPeopleGeida: _vm->_visa->dixi('U', 13); break; - case Gyro::pwisewoman: + case Gyro::kPeopleWisewoman: _vm->_visa->dixi('U', 14); break; default: @@ -1940,14 +1940,14 @@ void Acci::doThat() { break; case kVerbCodeClimb: - if (_vm->_gyro->dna.room == r__insidecardiffcastle) + if (_vm->_gyro->_dna._room == r__insidecardiffcastle) cardiffClimbing(); else // In the wrong room! _vm->_scrolls->display("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; break; case kVerbCodeHiscores: // show_highs(); @@ -1957,23 +1957,23 @@ void Acci::doThat() { if (isPersonHere()) switch (_person) { case kPardon: - case Gyro::pavalot: + case Gyro::kPeopleAvalot: case 0: - if (!_vm->_gyro->dna.avvy_is_awake) { - _vm->_gyro->dna.avvy_is_awake = true; + if (!_vm->_gyro->_dna._avvyIsAwake) { + _vm->_gyro->_dna._avvyIsAwake = true; _vm->_lucerna->points(1); - _vm->_gyro->dna.avvy_in_bed = true; + _vm->_gyro->_dna._avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. - if (_vm->_gyro->dna.teetotal) + if (_vm->_gyro->_dna._teetotal) _vm->_visa->dixi('d', 13); } else _vm->_scrolls->display("You're already awake, Avvy!"); break; - case Gyro::payles: - if (!_vm->_gyro->dna.ayles_is_awake) + case Gyro::kPeopleAyles: + if (!_vm->_gyro->_dna._aylesIsAwake) _vm->_scrolls->display("You can't seem to wake him by yourself."); break; - case Gyro::pjacques: + case Gyro::kPeopleJacques: _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; @@ -1982,8 +1982,8 @@ void Acci::doThat() { } break; case kVerbCodeSit: - if (_vm->_gyro->dna.room == r__nottspub) { - if (_vm->_gyro->dna.sitting_in_pub) + if (_vm->_gyro->_dna._room == r__nottspub) { + if (_vm->_gyro->_dna._sittingInPub) _vm->_scrolls->display("You're already sitting!"); else { _vm->_trip->tr[0].walkto(4); // Move Avvy to the place, and sit him down. @@ -1991,7 +1991,7 @@ void Acci::doThat() { } } else { // Default doodah. _vm->_lucerna->dusk(); - _vm->_gyro->hang_around_for_a_while(); + _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); _vm->_scrolls->display(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); } @@ -1999,7 +1999,7 @@ void Acci::doThat() { case kVerbCodeRestart: if (_vm->_scrolls->ask("Restart game and lose changes?")) { _vm->_lucerna->dusk(); - _vm->_gyro->newgame(); + _vm->_gyro->newGame(); _vm->_lucerna->dawn(); } break; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 100f468de923..9347b7762b73 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -129,146 +129,146 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); - sz.syncAsByte(_gyro->dna.rw); - sz.syncAsByte(_gyro->dna.carrying); - for (byte i = 0; i < numobjs; i++) - sz.syncAsByte(_gyro->dna.obj[i]); - sz.syncAsSint16LE(_gyro->dna.score); - sz.syncAsSint32LE(_gyro->dna.pence); - sz.syncAsByte(_gyro->dna.room); - sz.syncAsByte(_gyro->dna.wearing); - sz.syncAsByte(_gyro->dna.swore); - sz.syncAsByte(_gyro->dna.saves); - sz.syncBytes(_gyro->dna.rooms, 100); - sz.syncAsByte(_gyro->dna.alcohol); - sz.syncAsByte(_gyro->dna.playednim); - sz.syncAsByte(_gyro->dna.wonnim); - sz.syncAsByte(_gyro->dna.winestate); - sz.syncAsByte(_gyro->dna.cwytalot_gone); - sz.syncAsByte(_gyro->dna.pass_num); - sz.syncAsByte(_gyro->dna.ayles_is_awake); - sz.syncAsByte(_gyro->dna.drawbridge_open); - sz.syncAsByte(_gyro->dna.avaricius_talk); - sz.syncAsByte(_gyro->dna.bought_onion); - sz.syncAsByte(_gyro->dna.rotten_onion); - sz.syncAsByte(_gyro->dna.onion_in_vinegar); - sz.syncAsByte(_gyro->dna.given2spludwick); - sz.syncAsByte(_gyro->dna.brummie_stairs); - sz.syncAsByte(_gyro->dna.cardiff_things); - sz.syncAsByte(_gyro->dna.cwytalot_in_herts); - sz.syncAsByte(_gyro->dna.avvy_is_awake); - sz.syncAsByte(_gyro->dna.avvy_in_bed); - sz.syncAsByte(_gyro->dna.user_moves_avvy); - sz.syncAsByte(_gyro->dna.dogfoodpos); - sz.syncAsByte(_gyro->dna.givenbadgetoiby); - sz.syncAsByte(_gyro->dna.friar_will_tie_you_up); - sz.syncAsByte(_gyro->dna.tied_up); - sz.syncAsByte(_gyro->dna.box_contents); - sz.syncAsByte(_gyro->dna.talked_to_crapulus); - sz.syncAsByte(_gyro->dna.jacques_awake); - sz.syncAsByte(_gyro->dna.ringing_bells); - sz.syncAsByte(_gyro->dna.standing_on_dais); - sz.syncAsByte(_gyro->dna.taken_pen); - sz.syncAsByte(_gyro->dna.arrow_triggered); - sz.syncAsByte(_gyro->dna.arrow_in_the_door); + sz.syncAsByte(_gyro->_dna._direction); + sz.syncAsByte(_gyro->_dna._carryNum); + for (byte i = 0; i < kObjectNum; i++) + sz.syncAsByte(_gyro->_dna._objects[i]); + sz.syncAsSint16LE(_gyro->_dna._score); + sz.syncAsSint32LE(_gyro->_dna._money); + sz.syncAsByte(_gyro->_dna._room); + sz.syncAsByte(_gyro->_dna._wearing); + sz.syncAsByte(_gyro->_dna._sworeNum); + sz.syncAsByte(_gyro->_dna._saveNum); + sz.syncBytes(_gyro->_dna._roomCount, 100); + sz.syncAsByte(_gyro->_dna._alcoholLevel); + sz.syncAsByte(_gyro->_dna._playedNim); + sz.syncAsByte(_gyro->_dna._wonNim); + sz.syncAsByte(_gyro->_dna._wineState); + sz.syncAsByte(_gyro->_dna._cwytalotGone); + sz.syncAsByte(_gyro->_dna._passwordNum); + sz.syncAsByte(_gyro->_dna._aylesIsAwake); + sz.syncAsByte(_gyro->_dna._drawbridgeOpen); + sz.syncAsByte(_gyro->_dna._avariciusTalk); + sz.syncAsByte(_gyro->_dna._boughtOnion); + sz.syncAsByte(_gyro->_dna._rottenOnion); + sz.syncAsByte(_gyro->_dna._onionInVinegar); + sz.syncAsByte(_gyro->_dna._givenToSpludwick); + sz.syncAsByte(_gyro->_dna._brummieStairs); + sz.syncAsByte(_gyro->_dna._cardiffQuestionNum); + sz.syncAsByte(_gyro->_dna._passedCwytalotInHerts); + sz.syncAsByte(_gyro->_dna._avvyIsAwake); + sz.syncAsByte(_gyro->_dna._avvyInBed); + sz.syncAsByte(_gyro->_dna._userMovesAvvy); + sz.syncAsByte(_gyro->_dna._dogFoodPos); + sz.syncAsByte(_gyro->_dna._givenBadgeToIby); + sz.syncAsByte(_gyro->_dna._friarWillTieYouUp); + sz.syncAsByte(_gyro->_dna._tiedUp); + sz.syncAsByte(_gyro->_dna._boxContent); + sz.syncAsByte(_gyro->_dna._talkedToCrapulus); + sz.syncAsByte(_gyro->_dna._jacquesState); + sz.syncAsByte(_gyro->_dna._bellsAreRinging); + sz.syncAsByte(_gyro->_dna._standingOnDais); + sz.syncAsByte(_gyro->_dna._takenPen); + sz.syncAsByte(_gyro->_dna._arrowTriggered); + sz.syncAsByte(_gyro->_dna._arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _gyro->dna.like2drink.size(); + uint16 like2drinkSize = _gyro->_dna._favouriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _gyro->dna.like2drink[i]; + char actChr = _gyro->_dna._favouriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _gyro->dna.favourite_song.size(); + uint16 favourite_songSize = _gyro->_dna._favouriteSong.size(); sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _gyro->dna.favourite_song[i]; + char actChr = _gyro->_dna._favouriteSong[i]; sz.syncAsByte(actChr); } - uint16 worst_place_on_earthSize = _gyro->dna.worst_place_on_earth.size(); + uint16 worst_place_on_earthSize = _gyro->_dna._worstPlaceOnEarth.size(); sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr = _gyro->dna.worst_place_on_earth[i]; + char actChr = _gyro->_dna._worstPlaceOnEarth[i]; sz.syncAsByte(actChr); } - uint16 spare_eveningSize = _gyro->dna.spare_evening.size(); + uint16 spare_eveningSize = _gyro->_dna._spareEvening.size(); sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr = _gyro->dna.spare_evening[i]; + char actChr = _gyro->_dna._spareEvening[i]; sz.syncAsByte(actChr); } } else { - if (!_gyro->dna.like2drink.empty()) - _gyro->dna.like2drink.clear(); + if (!_gyro->_dna._favouriteDrink.empty()) + _gyro->_dna._favouriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _gyro->dna.like2drink += actChr; + _gyro->_dna._favouriteDrink += actChr; } - if (!_gyro->dna.favourite_song.empty()) - _gyro->dna.favourite_song.clear(); + if (!_gyro->_dna._favouriteSong.empty()) + _gyro->_dna._favouriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _gyro->dna.favourite_song += actChr; + _gyro->_dna._favouriteSong += actChr; } - if (!_gyro->dna.worst_place_on_earth.empty()) - _gyro->dna.worst_place_on_earth.clear(); + if (!_gyro->_dna._worstPlaceOnEarth.empty()) + _gyro->_dna._worstPlaceOnEarth.clear(); uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { sz.syncAsByte(actChr); - _gyro->dna.worst_place_on_earth += actChr; + _gyro->_dna._worstPlaceOnEarth += actChr; } - if (!_gyro->dna.spare_evening.empty()) - _gyro->dna.spare_evening.clear(); + if (!_gyro->_dna._spareEvening.empty()) + _gyro->_dna._spareEvening.clear(); uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { sz.syncAsByte(actChr); - _gyro->dna.spare_evening += actChr; + _gyro->_dna._spareEvening += actChr; } } - sz.syncAsSint32LE(_gyro->dna.total_time); - sz.syncAsByte(_gyro->dna.jumpstatus); - sz.syncAsByte(_gyro->dna.mushroom_growing); - sz.syncAsByte(_gyro->dna.spludwicks_here); - sz.syncAsByte(_gyro->dna.last_room); - sz.syncAsByte(_gyro->dna.last_room_not_map); - sz.syncAsByte(_gyro->dna.crapulus_will_tell); - sz.syncAsByte(_gyro->dna.enter_catacombs_from_lusties_room); - sz.syncAsByte(_gyro->dna.teetotal); - sz.syncAsByte(_gyro->dna.malagauche); - sz.syncAsByte(_gyro->dna.drinking); - sz.syncAsByte(_gyro->dna.entered_lusties_room_as_monk); - sz.syncAsByte(_gyro->dna.cat_x); - sz.syncAsByte(_gyro->dna.cat_y); - sz.syncAsByte(_gyro->dna.avvys_in_the_cupboard); - sz.syncAsByte(_gyro->dna.geida_follows); - sz.syncAsByte(_gyro->dna.geida_spin); - sz.syncAsByte(_gyro->dna.geida_time); - sz.syncAsByte(_gyro->dna.nextbell); - sz.syncAsByte(_gyro->dna.geida_given_potion); - sz.syncAsByte(_gyro->dna.lustie_is_asleep); - sz.syncAsByte(_gyro->dna.flip_to_where); - sz.syncAsByte(_gyro->dna.flip_to_ped); - sz.syncAsByte(_gyro->dna.been_tied_up); - sz.syncAsByte(_gyro->dna.sitting_in_pub); - sz.syncAsByte(_gyro->dna.spurge_talk); - sz.syncAsByte(_gyro->dna.met_avaroid); - sz.syncAsByte(_gyro->dna.taken_mushroom); - sz.syncAsByte(_gyro->dna.given_pen_to_ayles); - sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim); + sz.syncAsSint32LE(_gyro->_dna._totalTime); + sz.syncAsByte(_gyro->_dna._jumpStatus); + sz.syncAsByte(_gyro->_dna._mushroomGrowing); + sz.syncAsByte(_gyro->_dna._spludwickAtHome); + sz.syncAsByte(_gyro->_dna._lastRoom); + sz.syncAsByte(_gyro->_dna._lastRoomNotMap); + sz.syncAsByte(_gyro->_dna._crapulusWillTell); + sz.syncAsByte(_gyro->_dna._enterCatacombsFromLustiesRoom); + sz.syncAsByte(_gyro->_dna._teetotal); + sz.syncAsByte(_gyro->_dna._malagauche); + sz.syncAsByte(_gyro->_dna._drinking); + sz.syncAsByte(_gyro->_dna._enteredLustiesRoomAsMonk); + sz.syncAsByte(_gyro->_dna._catacombX); + sz.syncAsByte(_gyro->_dna._catacombY); + sz.syncAsByte(_gyro->_dna._avvysInTheCupboard); + sz.syncAsByte(_gyro->_dna._geidaFollows); + sz.syncAsByte(_gyro->_dna._geidaSpin); + sz.syncAsByte(_gyro->_dna._geidaTime); + sz.syncAsByte(_gyro->_dna._nextBell); + sz.syncAsByte(_gyro->_dna._givenPotionToGeida); + sz.syncAsByte(_gyro->_dna._lustieIsAsleep); + sz.syncAsByte(_gyro->_dna._flipToWhere); + sz.syncAsByte(_gyro->_dna._flipToPed); + sz.syncAsByte(_gyro->_dna._beenTiedUp); + sz.syncAsByte(_gyro->_dna._sittingInPub); + sz.syncAsByte(_gyro->_dna._spurgeTalkCount); + sz.syncAsByte(_gyro->_dna._metAvaroid); + sz.syncAsByte(_gyro->_dna._takenMushroom); + sz.syncAsByte(_gyro->_dna._givenPenToAyles); + sz.syncAsByte(_gyro->_dna._askedDogfoodAboutNim); #if 0 @@ -345,7 +345,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return (!_gyro->seescroll && _gyro->alive); + return (!_gyro->_seeScroll && _gyro->_alive); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { @@ -398,7 +398,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) { bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! - return (!_gyro->seescroll); + return (!_gyro->_seeScroll); } Common::Error AvalancheEngine::loadGameState(int slot) { @@ -451,10 +451,10 @@ bool AvalancheEngine::loadGame(const int16 slot) { _gyro->isLoaded = true; - _gyro->seescroll = true; // This prevents display of the new sprites before the new picture is loaded. + _gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. - if (_gyro->holdthedawn) { - _gyro->holdthedawn = false; + if (_gyro->_holdTheDawn) { + _gyro->_holdTheDawn = false; _lucerna->dawn(); } @@ -464,9 +464,9 @@ bool AvalancheEngine::loadGame(const int16 slot) { _dropdown->setupMenu(); - _gyro->_whereIs[0] = _gyro->dna.room; + _gyro->_whereIs[0] = _gyro->_dna._room; - _gyro->alive = true; + _gyro->_alive = true; _lucerna->objectlist(); @@ -474,18 +474,18 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->showrw(); - _gyro->ontoolbar = false; + _gyro->_onToolbar = false; _trip->trippancy_link(); _celer->updateBackgroundSprites(); _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine - + _gyro->roomname + _scrolls->kControlNewLine + _scrolls->kControlNewLine + + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); if (_trip->tr[0].quick && _trip->tr[0].visible) - _trip->rwsp(0, _gyro->dna.rw); // We push Avvy in the right direction is he was moving. + _trip->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. return true; } @@ -497,7 +497,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { Common::String month = months[m]; - Common::String day = _gyro->strf(d); + Common::String day = _gyro->intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) switch (d % 10) { @@ -514,7 +514,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day = day + "th"; } - return day + ' ' + month + ' ' + _gyro->strf(y + 1900); + return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3f948c322470..3d3a7a01fed1 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -109,7 +109,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_HOME: case Common::KEYCODE_END: case Common::KEYCODE_KP5: - if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) { + if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) { _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->showrw(); return; @@ -130,40 +130,36 @@ void Avalot::handleKeyDown(Common::Event &event) { void Avalot::setup() { - _vm->_gyro->visible = _vm->_gyro->m_no; - _vm->_gyro->to_do = 0; - _vm->_gyro->lmo = false; + _vm->_gyro->_mouse = _vm->_gyro->kMouseStateNo; + _vm->_gyro->_letMeOut = false; _vm->_scrolls->resetscroll(); CursorMan.showMouse(true); - _vm->_gyro->holdthedawn = true; + _vm->_gyro->_holdTheDawn = true; _vm->_lucerna->dusk(); - _vm->_gyro->cmp = 177; + _vm->_gyro->_currentMouse = 177; _vm->_lucerna->mouse_init(); // on; - _vm->_gyro->dropsok = true; - _vm->_gyro->ctrl = ckey; - _vm->_gyro->oldjw = 177; - _vm->_gyro->mousetext = ""; - _vm->_gyro->c = 999; - _vm->_gyro->ddmnow = false; + _vm->_gyro->_dropsOk = true; + _vm->_gyro->_mouseText = ""; + _vm->_gyro->_dropdownActive = false; _vm->_lucerna->load_digits(); - _vm->_gyro->cheat = false; - _vm->_gyro->cp = 0; + _vm->_gyro->_cheat = false; + _vm->_gyro->_cp = 0; _vm->_parser->_inputTextPos = 0; _vm->_parser->_quote = true; - _vm->_gyro->ledstatus = 177; - _vm->_gyro->defaultled = 2; + _vm->_gyro->_ledStatus = 177; + _vm->_gyro->_defaultLed = 2; // TSkellern = 0; Replace with a more local variable sometime - _vm->_gyro->dna.rw = _vm->_gyro->kDirectionStopped; - _vm->_gyro->enid_filename = ""; // Undefined. + _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionStopped; + _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->toolbar(); _vm->_scrolls->state(2); for (byte i = 0; i < 3; i++) - _vm->_gyro->lastscore[i] = -1; // Impossible digits. + _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. _vm->_trip->loadtrip(); _vm->_trip->get_back_loretta(); - _vm->_gyro->holdthedawn = false; + _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); @@ -174,17 +170,17 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { - _vm->_gyro->thinks = 2; // You always have money. - _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); + _vm->_gyro->_thinks = 2; // You always have money. + _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); _vm->loadGame(loadSlot); } else { _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). - _vm->_gyro->newgame(); // No game was requested- load the default. + _vm->_gyro->newGame(); // No game was requested- load the default. - _vm->_gyro->soundfx = ! _vm->_gyro->soundfx; + _vm->_gyro->_soundFx = ! _vm->_gyro->_soundFx; _vm->_lucerna->fxtoggle(); - _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); + _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); _vm->_visa->dixi('q', 83); // Info on the game, etc. } @@ -204,7 +200,7 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->clock_lucerna(); _vm->_dropdown->updateMenu(); - _vm->_gyro->force_numlock(); + _vm->_gyro->forceNumlock(); _vm->_trip->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); _vm->_trip->trippancy_link(); @@ -215,12 +211,12 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->lines[i].x1, _vm->_gyro->lines[i].y1, _vm->_gyro->lines[i].x2, _vm->_gyro->lines[i].y2, _vm->_gyro->lines[i].col); + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) + _vm->_graphics->_surface.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i].col); - for (byte i = 0; i < _vm->_gyro->numfields; i++) { - if (_vm->_gyro->fields[i].x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->fields[i].x1, _vm->_gyro->fields[i].y1, _vm->_gyro->fields[i].x2, _vm->_gyro->fields[i].y2), kColorLightmagenta); + for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + if (_vm->_gyro->_fields[i]._x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->_fields[i]._x1, _vm->_gyro->_fields[i]._y1, _vm->_gyro->_fields[i]._x2, _vm->_gyro->_fields[i]._y2), kColorLightmagenta); } // ONLY FOR TESTING!!! #endif @@ -231,7 +227,7 @@ void Avalot::run(Common::String arg) { uint32 delay = _vm->_system->getMillis() - beginLoop; if (delay <= 55) _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (! _vm->_gyro->lmo); + } while (! _vm->_gyro->_letMeOut); //if (logging) // close(logfile); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index c9ad3cf809af..cd56ead2872c 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -54,31 +54,31 @@ Celer::~Celer() { * @remarks Originally called 'pics_link' */ void Celer::updateBackgroundSprites() { - if (_vm->_gyro->ddmnow) + if (_vm->_gyro->_dropdownActive) return; // No animation when the menus are up. - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__outsideargentpub: - if ((_vm->_gyro->roomtime % 12) == 0) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); + if ((_vm->_gyro->_roomTime % 12) == 0) + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 4); break; case r__brummieroad: - if ((_vm->_gyro->roomtime % 2) == 0) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); + if ((_vm->_gyro->_roomTime % 2) == 0) + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 2) % 4); break; case r__bridge: - if ((_vm->_gyro->roomtime % 2) == 0) - drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); + if ((_vm->_gyro->_roomTime % 2) == 0) + drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->_roomTime / 2) % 4); break; case r__yours: - if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); + if ((!_vm->_gyro->_dna._avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 2); break; case r__argentpub: - if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_dna._malagauche != 177)) { // Malagauche cycle. - _vm->_gyro->dna.malagauche += 1; - switch (_vm->_gyro->dna.malagauche) { + _vm->_gyro->_dna._malagauche += 1; + switch (_vm->_gyro->_dna._malagauche) { case 1: case 11: case 21: @@ -94,12 +94,12 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 13); // Winks. break; case 33: - _vm->_gyro->dna.malagauche = 0; + _vm->_gyro->_dna._malagauche = 0; break; } } - switch (_vm->_gyro->roomtime % 200) { + switch (_vm->_gyro->_roomTime % 200) { case 179: case 197: drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. @@ -112,11 +112,11 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 7); break; case 199: - _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + _vm->_gyro->_dna._dogFoodPos = 177; // Impossible value for this. break; } - if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + if ((_vm->_gyro->_roomTime % 200 >= 0) && (_vm->_gyro->_roomTime % 200 <= 178)) { // Normally. byte direction = 0; if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) direction = 3; @@ -125,15 +125,15 @@ void Celer::updateBackgroundSprites() { else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) direction = 4; - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; + _vm->_gyro->_dna._dogFoodPos = direction; } } break; case r__westhall: - if ((_vm->_gyro->roomtime % 3) == 0) { - switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { + if ((_vm->_gyro->_roomTime % 3) == 0) { + switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { case 4: drawBackgroundSprite(-1, -1, 1); break; @@ -150,10 +150,10 @@ void Celer::updateBackgroundSprites() { } break; case r__lustiesroom: - if (!(_vm->_gyro->dna.lustie_is_asleep)) { + if (!(_vm->_gyro->_dna._lustieIsAsleep)) { byte direction = 0; uint16 angle = _vm->_lucerna->bearing(2); - if ((_vm->_gyro->roomtime % 45) > 42) + if ((_vm->_gyro->_roomTime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) @@ -163,15 +163,15 @@ void Celer::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? } } break; case r__aylesoffice: - if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { - switch ((_vm->_gyro->roomtime / 14) % 2) { + if ((!_vm->_gyro->_dna._aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { + switch ((_vm->_gyro->_roomTime / 14) % 2) { case 0: drawBackgroundSprite(-1, -1, 1); // Frame 2: EGA. break; @@ -182,8 +182,8 @@ void Celer::updateBackgroundSprites() { } break; case r__robins: - if (_vm->_gyro->dna.tied_up) { - switch (_vm->_gyro->roomtime % 54) { + if (_vm->_gyro->_dna._tiedUp) { + switch (_vm->_gyro->_roomTime % 54) { case 20: drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. break; @@ -204,15 +204,15 @@ void Celer::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_gyro->roomtime % 60) > 57) + if ((_vm->_gyro->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? } - switch (_vm->_gyro->roomtime % 50) { + switch (_vm->_gyro->_roomTime % 50) { case 45 : drawBackgroundSprite(-1, -1, 9); // Spurge blinks. break; @@ -223,8 +223,8 @@ void Celer::updateBackgroundSprites() { break; } case r__ducks: { - if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); + if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; @@ -236,25 +236,25 @@ void Celer::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_gyro->roomtime % 45) > 42) + if ((_vm->_gyro->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? } break; } } - if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { + if ((_vm->_gyro->_dna._bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { // They're ringing the bells. - switch (_vm->_gyro->roomtime % 4) { + switch (_vm->_gyro->_roomTime % 4) { case 1: - if (_vm->_gyro->dna.nextbell < 5) - _vm->_gyro->dna.nextbell = 12; - _vm->_gyro->dna.nextbell--; - _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->dna.nextbell]); + if (_vm->_gyro->_dna._nextBell < 5) + _vm->_gyro->_dna._nextBell = 12; + _vm->_gyro->_dna._nextBell--; + _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->_dna._nextBell]); break; case 2: //nosound(); @@ -373,17 +373,17 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { void Celer::drawSprite(int16 x, int16 y, SpriteType &sprite) { - _r.x1 = x; - _r.y1 = y; - _r.y2 = y + sprite._yl; + _r._x1 = x; + _r._y1 = y; + _r._y2 = y + sprite._yl; switch (sprite._type) { case kNaturalImage: // Allow fallthrough on purpose. case kBgi: - _r.x2 = x + sprite._xl + 1; + _r._x2 = x + sprite._xl + 1; break; case kEga: - _r.x2 = x + sprite._xl; + _r._x2 = x + sprite._xl; break; } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 090eda2d90d4..674f6e162188 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -69,7 +69,7 @@ class Celer { int32 _offsets[40]; byte _spriteNum; SpriteType _sprites[40]; - bytefield _r; + ByteField _r; Common::String _filename; static const int16 kOnDisk; // Value of memos[fv].x when it's not in memory. diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index c207fdaf0016..7424d829745e 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -70,10 +70,10 @@ void HeadType::highlight() { _dr->_activeMenuItem._left = _xpos; _dr->_activeMenuItem._activeNow = true; - _dr->_vm->_gyro->ddmnow = true; + _dr->_vm->_gyro->_dropdownActive = true; _dr->_activeMenuItem._activeNum = _position; - _dr->_vm->_gyro->cmp = 177; // Force redraw of cursor. + _dr->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { @@ -87,7 +87,7 @@ bool HeadType::parseAltTrigger(char key) { void MenuItem::init(Dropdown *dr) { _dr = dr; _activeNow = false; - _dr->_vm->_gyro->ddmnow = false; + _dr->_vm->_gyro->_dropdownActive = false; _activeNum = 1; } @@ -138,7 +138,7 @@ void MenuItem::display() { _flx2 = _left + _width; fly = 15 + _optionNum * 10; _activeNow = true; - _dr->_vm->_gyro->ddmnow = true; + _dr->_vm->_gyro->_dropdownActive = true; _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, fly), _dr->kMenuBackgroundColor); _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); @@ -147,8 +147,8 @@ void MenuItem::display() { for (byte y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_gyro->defaultled = 1; - _dr->_vm->_gyro->cmp = 177; + _dr->_vm->_gyro->_defaultLed = 1; + _dr->_vm->_gyro->_currentMouse = 177; //mousepage(cp); CursorMan.showMouse(true); // 4 = fletch } @@ -160,9 +160,9 @@ void MenuItem::wipe() { _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); _activeNow = false; - _dr->_vm->_gyro->ddmnow = false; + _dr->_vm->_gyro->_dropdownActive = false; _firstlix = false; - _dr->_vm->_gyro->defaultled = 2; + _dr->_vm->_gyro->_defaultLed = 2; CursorMan.showMouse(true); } @@ -232,14 +232,14 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Drop } void MenuBar::draw() { - const bytefield menuspace = {0, 0, 80, 9}; + const ByteField menuspace = {0, 0, 80, 9}; //setactivepage(3); _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); - byte savecp = _dr->_vm->_gyro->cp; - _dr->_vm->_gyro->cp = 3; + byte savecp = _dr->_vm->_gyro->_cp; + _dr->_vm->_gyro->_cp = 3; for (byte i = 0; i < _menuNum; i++) _menuItems[i].draw(); @@ -247,7 +247,7 @@ void MenuBar::draw() { for (byte page = 0; page <= 1; page++) _dr->_vm->_trip->getset[page].remember(menuspace); - _dr->_vm->_gyro->cp = savecp; + _dr->_vm->_gyro->_cp = savecp; } void MenuBar::parseAltTrigger(char c) { @@ -287,30 +287,30 @@ Dropdown::Dropdown(AvalancheEngine *vm) { } void Dropdown::findWhatYouCanDoWithIt() { - switch (_vm->_gyro->thinks) { - case Gyro::wine: - case Gyro::potion: - case Gyro::ink: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeDrink; + switch (_vm->_gyro->_thinks) { + case Gyro::kObjectWine: + case Gyro::kObjectPotion: + case Gyro::kObjectInk: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeDrink; break; - case Gyro::bell: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeRing; + case Gyro::kObjectBell: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeRing; break; - case Gyro::chastity: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; + case Gyro::kObjectChastity: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; - case Gyro::lute: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodePlay; + case Gyro::kObjectLute: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodePlay; break; - case Gyro::mushroom: - case Gyro::onion: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeEat; + case Gyro::kObjectMushroom: + case Gyro::kObjectOnion: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeEat; break; - case Gyro::clothes: - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; + case Gyro::kObjectClothes: + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; break; default: - _vm->_gyro->verbstr = _vm->_acci->kVerbCodeExam; // Anything else. + _vm->_gyro->_verbStr = _vm->_acci->kVerbCodeExam; // Anything else. } } @@ -335,7 +335,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < 8; j++) { byte idx = text[i]; - font[idx][j] = _vm->_gyro->characters[idx][j] & ander; // Set the font. + font[idx][j] = _vm->_gyro->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. for (byte k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; @@ -434,9 +434,9 @@ void Dropdown::setupMenuFile() { _activeMenuItem.reset(); _activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true); - _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->alive); - _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->alive); - _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->atkey + '1', true); + _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->_alive); + _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->_alive); + _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->_atKey + '1', true); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.display(); } @@ -444,7 +444,7 @@ void Dropdown::setupMenuFile() { void Dropdown::setupMenuAction() { _activeMenuItem.reset(); - Common::String f5Does = _vm->_gyro->f5_does(); + Common::String f5Does = _vm->_gyro->f5Does(); for (byte i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); @@ -453,7 +453,7 @@ void Dropdown::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_gyro->dna.room == 99) + if (_vm->_gyro->_dna._room == 99) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_trip->neardoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_trip->neardoor()); @@ -474,8 +474,8 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); for (byte i = 150; i <= 178; i++) - if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->dna.room) { - _activeMenuItem.setupOption(_vm->_gyro->getname(i), _vm->_gyro->getnamechar(i), "", true); + if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_dna._room) { + _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people = people + i; } @@ -484,9 +484,9 @@ void Dropdown::setupMenuPeople() { void Dropdown::setupMenuObjects() { _activeMenuItem.reset(); - for (byte i = 0; i < numobjs; i++) { - if (_vm->_gyro->dna.obj[i]) - _activeMenuItem.setupOption(_vm->_gyro->get_thing(i + 1), _vm->_gyro->get_thingchar(i + 1), "", true); + for (byte i = 0; i < kObjectNum; i++) { + if (_vm->_gyro->_dna._objects[i]) + _activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -494,56 +494,56 @@ void Dropdown::setupMenuObjects() { void Dropdown::setupMenuWith() { _activeMenuItem.reset(); - if (_vm->_gyro->thinkthing) { + if (_vm->_gyro->_thinkThing) { findWhatYouCanDoWithIt(); - for (byte i = 0; i < _vm->_gyro->verbstr.size(); i++) { + for (byte i = 0; i < _vm->_gyro->_verbStr.size(); i++) { char vbchar; Common::String verb; - _vm->_acci->verbOpt(_vm->_gyro->verbstr[i], verb, vbchar); + _vm->_acci->verbOpt(_vm->_gyro->_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_gyro->last_person == _vm->_gyro->pavalot) || (_vm->_gyro->last_person == _vm->_acci->kNothing) - || (_vm->_gyro->_whereIs[_vm->_gyro->last_person - 150] != _vm->_gyro->dna.room)) + if ((_vm->_gyro->_lastPerson == _vm->_gyro->kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) + || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_dna._room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { - _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getname(_vm->_gyro->last_person), 'G', "", true); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeGive; + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); - _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->thinks), 'T', "", true); - _vm->_gyro->verbstr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; - switch (_vm->_gyro->thinks) { - case Gyro::pgeida: - case Gyro::parkata: { + _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); + _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; + switch (_vm->_gyro->_thinks) { + case Gyro::kPeopleGeida: + case Gyro::kPeopleArkata: { _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodeKiss; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodeKiss; } break; - case Gyro::pdogfood: { - _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->dna.wonnim); // True if you HAVEN'T won. - _vm->_gyro->verbstr = _vm->_gyro->verbstr + _vm->_acci->kVerbCodePlay; + case Gyro::kPeopleDogfood: { + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_dna._wonNim); // True if you HAVEN'T won. + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodePlay; } break; - case Gyro::pmalagauche: { - bool isSober = !_vm->_gyro->dna.teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]); + case Gyro::kPeopleMalagauche: { + bool isSober = !_vm->_gyro->_dna._teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + 101 + 100 + 102 + 103 + 104; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 101 + 100 + 102 + 103 + 104; } break; - case Gyro::ptrader: { - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]); - _vm->_gyro->verbstr = _vm->_gyro->verbstr + 105; + case Gyro::kPeopleTrader: { + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]); + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; } break; } @@ -610,7 +610,7 @@ void Dropdown::runMenuAction() { case 0: { _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; - f5Does = _vm->_gyro->f5_does(); + f5Does = _vm->_gyro->f5Does(); _vm->_lucerna->callVerb(f5Does[0]); } break; @@ -640,28 +640,28 @@ void Dropdown::runMenuAction() { } void Dropdown::runMenuObjects() { - _vm->_lucerna->thinkabout(_vm->_gyro->objlist[_activeMenuItem._choiceNum + 1], _vm->_gyro->kThing); + _vm->_lucerna->thinkabout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum + 1], _vm->_gyro->kThing); } void Dropdown::runMenuPeople() { _vm->_lucerna->thinkabout(people[_activeMenuItem._choiceNum], _vm->_gyro->kPerson); - _vm->_gyro->last_person = people[_activeMenuItem._choiceNum]; + _vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; } void Dropdown::runMenuWith() { - _vm->_acci->_thing = _vm->_gyro->thinks; + _vm->_acci->_thing = _vm->_gyro->_thinks; - if (_vm->_gyro->thinkthing) { + if (_vm->_gyro->_thinkThing) { _vm->_acci->_thing += 49; - if (_vm->_gyro->verbstr[_activeMenuItem._choiceNum] == _vm->_acci->kVerbCodeGive) - _vm->_acci->_person = _vm->_gyro->last_person; + if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == _vm->_acci->kVerbCodeGive) + _vm->_acci->_person = _vm->_gyro->_lastPerson; else _vm->_acci->_person = 254; } else { - switch (_vm->_gyro->verbstr[_activeMenuItem._choiceNum]) { + switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { case 100: { // Beer _vm->_acci->_thing = 100; _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); @@ -701,11 +701,11 @@ void Dropdown::runMenuWith() { default: { _vm->_acci->_person = _vm->_acci->_thing; _vm->_acci->_thing = 254; - _vm->_gyro->subjnumber = 0; + _vm->_gyro->_subjectNum = 0; } } } - _vm->_lucerna->callVerb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); + _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); } void Dropdown::setupMenu() { @@ -742,14 +742,14 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newpointer(1); // Up arrow + _vm->_gyro->newMouse(1); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem.fly * 2 + 1)) - _vm->_gyro->newpointer(3); // Right-arrow + _vm->_gyro->newMouse(3); // Right-arrow else - _vm->_gyro->newpointer(4); // Fletch + _vm->_gyro->newMouse(4); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newpointer(2); // Screwdriver + _vm->_gyro->newMouse(2); // Screwdriver _activeMenuItem.lightUp(cursorPos); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index be98b4e5796b..a22a205aaad2 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -244,18 +244,18 @@ void Enid::avvyBackground() { #endif } -void Enid::toSundry(sundry &sund) { - sund.qenid_filename = _vm->_gyro->enid_filename; - sund.qsoundfx = _vm->_gyro->soundfx; - sund.qthinks = _vm->_gyro->thinks; - sund.qthinkthing = _vm->_gyro->thinkthing; +void Enid::toSundry(Sundry &sund) { + sund._qEnidFilename = _vm->_gyro->_enidFilename; + sund._qSoundFx = _vm->_gyro->_soundFx; + sund._qThinks = _vm->_gyro->_thinks; + sund._qThinkThing = _vm->_gyro->_thinkThing; } -void Enid::fromSundry(sundry sund) { - _vm->_gyro->enid_filename = sund.qenid_filename; - _vm->_gyro->soundfx = sund.qsoundfx; - _vm->_gyro->thinks = sund.qthinks; - _vm->_gyro->thinkthing = sund.qthinkthing; +void Enid::fromSundry(Sundry sund) { + _vm->_gyro->_enidFilename = sund._qEnidFilename; + _vm->_gyro->_soundFx = sund._qSoundFx; + _vm->_gyro->_thinks = sund._qThinks; + _vm->_gyro->_thinkThing = sund._qThinkThing; } void Enid::restoreDna() { @@ -269,19 +269,19 @@ void Enid::ednaReload() { restoreDna(); - _vm->_gyro->seescroll = true; // This prevents display of the new sprites before the + _vm->_gyro->_seeScroll = true; // This prevents display of the new sprites before the // new picture is loaded. _vm->_lucerna->major_redraw(); - _vm->_gyro->_whereIs[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; - _vm->_gyro->alive = true; + _vm->_gyro->_alive = true; _vm->_lucerna->objectlist(); - if (_vm->_gyro->holdthedawn) { - _vm->_gyro->holdthedawn = false; + if (_vm->_gyro->_holdTheDawn) { + _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 3badc239de85..c0876f3dadb6 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -47,8 +47,8 @@ namespace Avalanche { -const char *Gyro::vernum = "1.30"; -const char *Gyro::copyright = "1995"; +const char *Gyro::kVersionNum = "1.30"; +const char *Gyro::kCopyright = "1995"; const MouseHotspotType Gyro::kMouseHotSpots[9] = { @@ -127,25 +127,27 @@ const int32 Gyro::kCatacombMap[8][8] = { 7 = wall with door and candles, F = straight-through corridor. */ -const char Gyro::kSpludwicksOrder[3] = {onion, ink, mushroom}; +const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; +// A quasiped defines how people who aren't sprites talk. For example, quasiped +// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Gyro::kQuasipeds[16] = { - {2, kColorLightgray, 19, kColorBrown, pdogfood}, // A: Dogfood (screen 19). - {3, kColorGreen, 19, kColorWhite, pibythneth}, // B: Ibythneth (screen 19). - {3, kColorWhite, 1, kColorMagenta, parkata}, // C: Arkata (screen 1). + {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {3, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {3, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). - {3, kColorLightgreen, 50, kColorBrown, ptrader}, // E: Trader (screen 50). - {6, kColorYellow, 42, kColorRed, pavalot}, // F: Avvy, tied up (scr.42) - {2, kColorBlue, 16, kColorWhite, payles}, // G: Ayles (screen 16). - {2, kColorBrown, 7, kColorWhite, pjacques}, // H: Jacques (screen 7). - {2, kColorLightgreen, 47, kColorGreen, pspurge}, // I: Spurge (screen 47). - {3, kColorYellow, 47, kColorRed, pavalot}, // J: Avalot (screen 47). - {2, kColorLightgray, 23, kColorBlack, pdulustie}, // K: du Lustie (screen 23). - {2, kColorYellow, 27, kColorRed, pavalot}, // L: Avalot (screen 27). + {3, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {6, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {2, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {2, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {2, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {3, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {2, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {2, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). {3, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). - {4, kColorLightgray, 19, kColorDarkgray, pmalagauche}, // N: Malagauche (screen 19). - {5, kColorLightmagenta, 47, kColorRed, pport}, // O: Port (screen 47). - {2, kColorLightgreen, 51, kColorDarkgray, pdrduck} // P: Duck (screen 51). + {4, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). + {5, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). + {2, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; @@ -186,22 +188,22 @@ byte Gyro::_whereIs[29] = { r__wisewomans // The Wise Woman. }; -const Common::String Gyro::things[numobjs] = { +const Common::String Gyro::kThings[kObjectNum] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" }; -const char Gyro::thingchar[] = "WMBParCLguKeSnIohn"; // V=Vinegar +const char Gyro::kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar -const Common::String Gyro::better[numobjs] = { +const Common::String Gyro::kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", "an onion" }; -const char Gyro::betterchar[] = "WMBParCLguKeSnIohn"; +const char Gyro::kItemsChar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _vm = vm; @@ -209,30 +211,30 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { // Needed because of Lucerna::load_also() for (int fv = 0; fv < 31; fv++) { for (int ff = 0; ff < 2; ff++) - also[fv][ff] = 0; + _also[fv][ff] = 0; } - dna.total_time = 0; + _dna._totalTime = 0; } Gyro::~Gyro() { for (byte i = 0; i < 9; i++) { - digit[i].free(); - rwlite[i].free(); + _digits[i].free(); + _directions[i].free(); } - digit[9].free(); + _digits[9].free(); } -Common::String Gyro::strf(int32 x) { +Common::String Gyro::intToStr(int32 x) { Common::String q = Common::String::format("%d", x); return q; } -void Gyro::newpointer(byte id) { - if (id == cmp) +void Gyro::newMouse(byte id) { + if (id == _currentMouse) return; - cmp = id; + _currentMouse = id; - load_a_mouse(id); + loadMouse(id); } /** @@ -240,23 +242,7 @@ void Gyro::newpointer(byte id) { * @remarks Originally called 'wait' */ void Gyro::setMousePointerWait() { - newpointer(5); -} - -void Gyro::on() { - warning("STUB: Gyro::on()"); -} - -void Gyro::off() { - warning("STUB: Gyro::off()"); -} - -void Gyro::xycheck() { - warning("STUB: Gyro::xycheck()"); -} - -void Gyro::check() { - warning("STUB: Gyro::check()"); + newMouse(5); } void Gyro::note(uint16 hertz) { @@ -267,15 +253,15 @@ void Gyro::blip() { warning("STUB: Gyro::blip()"); } -void Gyro::shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { +void Gyro::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { warning("STUB: Gyro::shadow()"); } -void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { +void Gyro::shadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { warning("STUB: Gyro::shbox()"); } -void Gyro::newgame() { +void Gyro::newGame() { for (byte gm = 0; gm < kMaxSprites; gm++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); @@ -283,47 +269,45 @@ void Gyro::newgame() { // Deallocate sprite. Sorry, beta testers! _vm->_trip->tr[0].init(0, true, _vm->_trip); - alive = true; + _alive = true; - score = 0; + _score = 0; //for gd:=0 to 5 do which[gd]:=1; - memset(&_vm->_gyro->dna, 0, sizeof(dnatype)); + memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); _vm->_scrolls->natural(); _vm->_lucerna->mousepage(0); - dna.spare_evening = "answer a questionnaire"; - dna.like2drink = "beer"; - - dna.pence = 30; // 2/6 - dna.rw = kDirectionStopped; - dna.wearing = clothes; - dna.obj[money - 1] = true; - dna.obj[bodkin - 1] = true; - dna.obj[bell - 1] = true; - dna.obj[clothes - 1] = true; + _dna._spareEvening = "answer a questionnaire"; + _dna._favouriteDrink = "beer"; + + _dna._money = 30; // 2/6 + _dna._direction = kDirectionStopped; + _dna._wearing = kObjectClothes; + _dna._objects[kObjectMoney - 1] = true; + _dna._objects[kObjectBodkin - 1] = true; + _dna._objects[kObjectBell - 1] = true; + _dna._objects[kObjectClothes - 1] = true; - thinkthing = true; - thinks = 2; + _thinkThing = true; + _thinks = 2; _vm->_lucerna->objectlist(); - ontoolbar = false; - seescroll = false; + _onToolbar = false; + _seeScroll = false; - ppos[0][1] = -177; _vm->_trip->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } - him = 254; - her = 254; - it = 254; - last_person = 254; // = Pardon? - dna.pass_num = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; - after_the_scroll = false; - dna.user_moves_avvy = false; - doing_sprite_run = false; - dna.avvy_in_bed = true; - enid_filename = ""; + _him = 254; + _her = 254; + _it = 254; + _lastPerson = 254; // = Pardon? + _dna._passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _dna._userMovesAvvy = false; + _doingSpriteRun = false; + _dna._avvyInBed = true; + _enidFilename = ""; for (byte gd = 0; gd <= 1; gd++) { - cp = 1 - cp; + _cp = 1 - _cp; _vm->_trip->getback(); } @@ -340,26 +324,26 @@ void Gyro::click() { warning("STUB: Gyro::click()"); } -void Gyro::slowdown() { +void Gyro::slowDown() { warning("STUB: Gyro::slowdown()"); } -bool Gyro::flagset(char x) { - for (uint16 i = 0; i < flags.size(); i++) { - if (flags[i] == x) +bool Gyro::setFlag(char x) { + for (uint16 i = 0; i < _flags.size(); i++) { + if (_flags[i] == x) return true; } return false; } -void Gyro::force_numlock() { +void Gyro::forceNumlock() { warning("STUB: Gyro::force_numlock()"); } -bool Gyro::pennycheck(uint16 howmuchby) { - dna.pence -= howmuchby; - if (dna.pence < 0) { +bool Gyro::updateMoney(uint16 howmuchby) { + _dna._money -= howmuchby; + if (_dna._money < 0) { _vm->_visa->dixi('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameover(); return false; @@ -369,7 +353,7 @@ bool Gyro::pennycheck(uint16 howmuchby) { // There'll may be problems with calling these functions because of the conversion of the arrays!!! // Keep an eye open! -Common::String Gyro::getname(byte whose) { +Common::String Gyro::getName(byte whose) { if (whose < 175) return kLads[whose - 150]; else @@ -377,7 +361,7 @@ Common::String Gyro::getname(byte whose) { } // Keep an eye open! ^ -byte Gyro::getnamechar(byte whose) { +byte Gyro::getNameChar(byte whose) { if (whose < 175) return kLadChar[whose - 150]; else @@ -385,78 +369,78 @@ byte Gyro::getnamechar(byte whose) { } // Keep an eye open! ^^ -Common::String Gyro::get_thing(byte which) { +Common::String Gyro::getThing(byte which) { Common::String get_thing_result; switch (which) { - case wine: - switch (dna.winestate) { + case kObjectWine: + switch (_dna._wineState) { case 1: case 4: - get_thing_result = things[which - 1]; + get_thing_result = kThings[which - 1]; break; case 3: get_thing_result = "Vinegar"; break; } break; - case onion: - if (dna.rotten_onion) + case kObjectOnion: + if (_dna._rottenOnion) get_thing_result = "rotten onion"; else - get_thing_result = things[which - 1]; + get_thing_result = kThings[which - 1]; break; default: - get_thing_result = things[which - 1]; + get_thing_result = kThings[which - 1]; } return get_thing_result; } // Keep an eye open! ^^^ -char Gyro::get_thingchar(byte which) { +char Gyro::getThingChar(byte which) { char get_thingchar_result; switch (which) { - case wine: - if (dna.winestate == 3) + case kObjectWine: + if (_dna._wineState == 3) get_thingchar_result = 'V'; // Vinegar else - get_thingchar_result = thingchar[which - 1]; + get_thingchar_result = kThingsChar[which - 1]; break; default: - get_thingchar_result = thingchar[which - 1]; + get_thingchar_result = kThingsChar[which - 1]; } return get_thingchar_result; } // Keep an eye open! ^^^^ -Common::String Gyro::get_better(byte which) { +Common::String Gyro::getItem(byte which) { Common::String get_better_result; if (which > 150) which -= 149; switch (which) { - case wine: - switch (dna.winestate) { + case kObjectWine: + switch (_dna._wineState) { case 0: case 1: case 4: - get_better_result = better[which - 1]; + get_better_result = kItems[which - 1]; break; case 3: get_better_result = "some vinegar"; break; } break; - case onion: - if (dna.rotten_onion) + case kObjectOnion: + if (_dna._rottenOnion) get_better_result = "a rotten onion"; - else if (dna.onion_in_vinegar) + else if (_dna._onionInVinegar) get_better_result = "a pickled onion (in the vinegar)"; else - get_better_result = better[which - 1]; + get_better_result = kItems[which - 1]; break; default: - if ((which < numobjs) && (which > 0)) - get_better_result = better[which - 1]; + if ((which < kObjectNum) && (which > 0)) + get_better_result = kItems[which - 1]; else get_better_result = ""; } @@ -464,24 +448,24 @@ Common::String Gyro::get_better(byte which) { } -Common::String Gyro::f5_does() { +Common::String Gyro::f5Does() { Common::String f5_does_result; - switch (dna.room) { + switch (_dna._room) { case r__yours: { - if (!dna.avvy_is_awake) + if (!_dna._avvyIsAwake) return Common::String(_vm->_acci->kVerbCodeWake) + "WWake up"; - else if (dna.avvy_in_bed) + else if (_dna._avvyInBed) return Common::String(_vm->_acci->kVerbCodeStand) + "GGet up"; } break; case r__insidecardiffcastle: - if (dna.standing_on_dais) + if (_dna._standingOnDais) return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb down"; else return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb up"; break; case r__nottspub: - if (dna.sitting_in_pub) + if (_dna._sittingInPub) return Common::String(_vm->_acci->kVerbCodeStand) + "SStand up"; else return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; @@ -495,7 +479,7 @@ Common::String Gyro::f5_does() { return Common::String(_vm->_acci->kPardon); // If all else fails... } -void Gyro::load_a_mouse(byte which) { +void Gyro::loadMouse(byte which) { Common::File f; if (!f.open("mice.avd")) { @@ -509,7 +493,7 @@ void Gyro::load_a_mouse(byte which) { // The AND mask. - f.seek(mouse_size * 2 * (which - 1) + 134); + f.seek(kMouseSize * 2 * (which - 1) + 134); ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); @@ -522,7 +506,7 @@ void Gyro::load_a_mouse(byte which) { mask.free(); // The OR mask. - f.seek(mouse_size * 2 * (which - 1) + 134 * 2); + f.seek(kMouseSize * 2 * (which - 1) + 134 * 2); mask = _vm->_graphics->loadPictureGraphic(f); @@ -545,17 +529,13 @@ void Gyro::load_a_mouse(byte which) { cursor.free(); } -void Gyro::background(byte x) { +void Gyro::setBackgroundColor(byte x) { warning("STUB: Gyro::background()"); } -void Gyro::hang_around_for_a_while() { +void Gyro::hangAroundForAWhile() { for (byte i = 0; i < 28; i++) - slowdown(); -} - -bool Gyro::mouse_near_text() { - return (my > 144) && (my < 188); + slowDown(); } } // End of namespace Avalanche diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index bd2e9b15e46a..89346d7498e6 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -43,201 +43,163 @@ namespace Avalanche { class AvalancheEngine; -static const byte numobjs = 18; // always preface with a # -static const int16 maxobjs = 12; // carry limit +static const byte kObjectNum = 18; // always preface with a # +static const int16 kCarryLimit = 12; // carry limit -static const int16 numlockCode = 32; // Code for Num Lock -static const int16 mouse_size = 134; +static const int16 kNumlockCode = 32; // Code for Num Lock +static const int16 kMouseSize = 134; struct MouseHotspotType { // mouse-void int16 _horizontal, _vertical; }; -struct dnatype { // here goes... Ux, uy, & ww now all belong to Trip5 - byte rw; // Realway- just for convenience! - byte carrying; // how many objects you're carrying... - bool obj[numobjs]; // ...and which ones they are. - int16 score; // your score, of course - int32 pence; // your current amount of dosh - byte room; // your current room - byte wearing; // what you're wearing - byte swore; // number of times you've sworn - byte saves; // number of times this game has been saved - byte rooms[100]; // Add one to each every time you enter a room - byte alcohol; // Your blood alcohol level. - byte playednim; // How many times you've played Nim. - bool wonnim; // Have you *won* Nim? (That's harder.) - byte winestate; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. - bool cwytalot_gone; // Has Cwytalot rushed off to Jerusalem yet? +struct DnaType { // Ux, uy, & ww now all belong to Trip5 + byte _direction; // The direction Avvy is currently facing. + byte _carryNum; // How many objects you're carrying... + bool _objects[kObjectNum]; // ...and which ones they are. + int16 _score; // your score, of course + int32 _money; // your current amount of dosh + byte _room; // your current room + byte _wearing; // what you're wearing + byte _sworeNum; // number of times you've sworn + byte _saveNum; // number of times this game has been saved + byte _roomCount[100]; // Add one to each every time you enter a room + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _wonNim; // Have you *won* Nim? (That's harder.) + byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte pass_num; // Number of the passw for this game. - bool ayles_is_awake; // pretty obvious! - byte drawbridge_open; // Between 0 (shut) and 4 (open). - byte avaricius_talk; // How much Avaricius has said to you. - bool bought_onion; // Have you bought an onion yet? - bool rotten_onion; // And has it rotted? - bool onion_in_vinegar; // Is the onion in the vinegar? + byte _passwordNum; // Number of the passw for this game. + bool _aylesIsAwake; // pretty obvious! + byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). + byte _avariciusTalk; // How much Avaricius has said to you. + bool _boughtOnion; // Have you bought an onion yet? + bool _rottenOnion; // And has it rotted? + bool _onionInVinegar; // Is the onion in the vinegar? - byte given2spludwick; // 0 = nothing given, 1 = onion... - byte brummie_stairs; // Progression through the stairs trick. - byte cardiff_things; // Things you get asked in Cardiff. + byte _givenToSpludwick; // 0 = nothing given, 1 = onion... + byte _brummieStairs; // Progression through the stairs trick. + byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool cwytalot_in_herts; // Have you passed Cwytalot in Herts? + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool avvy_is_awake; // Well? Is Avvy awake? (Screen 1 only.) - bool avvy_in_bed; // True if Avvy's in bed, but awake. + bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) + bool _avvyInBed; // True if Avvy's in bed, but awake. - bool user_moves_avvy; // If this is false, the user has no - // control over Avvy's movements. + bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte dogfoodpos; // Which way Dogfood's looking in the pub. + byte _dogFoodPos; // Which way Dogfood's looking in the pub. - bool givenbadgetoiby; // Have you given the badge to Iby yet? + bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool friar_will_tie_you_up; // If you're going to get tied up. - bool tied_up; // You ARE tied up! + bool _friarWillTieYouUp; // If you're going to get tied up. + bool _tiedUp; // You ARE tied up! - byte box_contents; // 0 = money (sixpence), 254 = empty, any - // other number implies the contents of the box. + byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool talked_to_crapulus; // Pretty self-explanatory. + bool _talkedToCrapulus; // Pretty self-explanatory. - byte jacques_awake; // 0=asleep, 1=awake, 2=gets up, 3=gone. + byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool ringing_bells; // Is Jacques ringing the bells? + bool _bellsAreRinging; // Is Jacques ringing the bells? - bool standing_on_dais; // In room 71, inside Cardiff Castle. - bool taken_pen; // Have you taken the pen (in Cardiff?) - bool arrow_triggered; // And has the arrow been triggered? - bool arrow_in_the_door; // Did the arrow hit the wall? + bool _standingOnDais; // In room 71, inside Cardiff Castle. + bool _takenPen; // Have you taken the pen (in Cardiff?) + bool _arrowTriggered; // And has the arrow been triggered? + bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String like2drink, - favourite_song, - worst_place_on_earth, - spare_evening; // Personalisation str's + Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 total_time; // Your total time playing this game, in ticks. + uint32 _totalTime; // Your total time playing this game, in ticks. - byte jumpstatus; // Fixes how high you're jumping. + byte _jumpStatus; // Fixes how high you're jumping. - bool mushroom_growing; // Is the mushroom growing in 42? + bool _mushroomGrowing; // Is the mushroom growing in 42? - bool spludwicks_here; // Is Spludwick at home? + bool _spludwickAtHome; // Is Spludwick at home? - byte last_room; - byte last_room_not_map; + byte _lastRoom; + byte _lastRoomNotMap; - bool crapulus_will_tell; // Will Crapulus tell you about - // Spludwick being away? + bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool enter_catacombs_from_lusties_room; - bool teetotal; // Are we touching any more drinks? - byte malagauche; // Position of Malagauche. See Celer for more info. - char drinking; // What's he getting you? + bool _enterCatacombsFromLustiesRoom; + bool _teetotal; // Are we touching any more drinks? + byte _malagauche; // Position of Malagauche. See Celer for more info. + char _drinking; // What's he getting you? - bool entered_lusties_room_as_monk; + bool _enteredLustiesRoomAsMonk; - byte cat_x, cat_y; // XY coords in the catacombs. + byte _catacombX, _catacombY; // XY coords in the catacombs. - bool avvys_in_the_cupboard; // On screen 22. + bool _avvysInTheCupboard; // On screen 22. - bool geida_follows; // Is Geida following you? + bool _geidaFollows; // Is Geida following you? - byte geida_spin, geida_time; // For the making "Geida dizzy" joke. + byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. - byte nextbell; // For the ringing. + byte _nextBell; // For the ringing. - bool geida_given_potion; // Does Geida have the potion? - bool lustie_is_asleep; // Is BDL asleep? + bool _givenPotionToGeida; // Does Geida have the potion? + bool _lustieIsAsleep; // Is BDL asleep? - byte flip_to_where, flip_to_ped; // For the sequencer. + byte _flipToWhere, _flipToPed; // For the sequencer. - bool been_tied_up; // In r__Robins. + bool _beenTiedUp; // In r__Robins. - bool sitting_in_pub; // Are you sitting down in the pub? - byte spurge_talk; // Count for talking to Spurge. + bool _sittingInPub; // Are you sitting down in the pub? + byte _spurgeTalkCount; // Count for talking to Spurge. - bool met_avaroid; + bool _metAvaroid; - bool taken_mushroom, - given_pen_to_ayles, - asked_dogfood_about_nim; + bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; }; -struct pedtype { - int16 x, y; - byte dir; +struct PedType { + int16 _x, _y; + byte _direction; }; -struct magictype { - byte op; // one of the operations - uint16 data; // data for them +struct MagicType { + byte _operation; // one of the operations + uint16 _data; // data for them }; -class fieldtype { +class FieldType { public: - int16 x1, y1, x2, y2; + int16 _x1, _y1, _x2, _y2; }; -struct bytefield { - byte x1, y1, x2, y2; +struct ByteField { + byte _x1, _y1, _x2, _y2; }; -class linetype : public fieldtype { +class LineType : public FieldType { public: - byte col; + byte _color; }; -enum controllers {cjoy, ckey}; - -typedef Common::String previoustype[20]; - -struct corridor_type { // Decarations for the corridors. - uint16 doors; // Door styles are calc'ed from this uint16. - // Assign a different number to each one! -}; - -struct demo_type { - uint16 delay; - char key, extd; +struct DemoType { + uint16 _delay; + char _key, _extd; }; struct QuasipedType { - byte whichped, fgc, room, bgc; - uint16 who; + byte _whichPed, _foregroundColor, _room, _backgroundColor; + uint16 _who; }; -/* A quasiped defines how people who aren't sprites talk. For example, - quasiped "A" is Dogfood. The rooms aren't stored because I'm leaving - that to context. */ typedef byte TuneType[31]; - -struct PointType { - int16 x, y; -}; - -struct vmctype { // Virtual Mouse Cursor - byte *andpic, *xorpic; - byte *backpic[2]; - PointType wherewas[2]; - byte picnumber; - int8 ofsx, ofsy; -}; - -struct sundry { - // Things which must be saved over a backtobootstrap, outside DNA. - Common::String qenid_filename; - bool qsoundfx; - char qthinks; - bool qthinkthing; -}; - -struct joysetup { - uint16 xmid, ymid, xmin, ymin, xmax, ymax; - byte centre; // Size of centre in tenths +struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA. + Common::String _qEnidFilename; + bool _qSoundFx; + byte _qThinks; + bool _qThinkThing; }; +#if 0 struct ednahead { // Edna header // This header starts at byte offset 177 in the .ASG file. char id[9]; // signature @@ -268,65 +230,67 @@ struct ednahead { // Edna header // DNA values follow, then footer (which is ignored) }; +#endif class Gyro { public: - static const char *vernum; - static const char *copyright; - static const int16 thisvercode = 130; - // as "vernum", but numerically & without the ".". - static const int16 thisgamecode = 2; // Avalot's code number + static const char *kVersionNum; + static const char *kCopyright; + static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". + static const int16 kGameCode = 2; // Avalot's code number // Objects you can hold: - static const char wine = 1; - static const char money = 2; - static const char bodkin = 3; - static const char potion = 4; - static const char chastity = 5; - static const char bolt = 6; - static const char crossbow = 7; - static const char lute = 8; - static const char badge = 9; - static const char mushroom = 10; - static const char key = 11; - static const char bell = 12; - static const char prescription = 13; - static const char pen = 14; - static const char ink = 15; - static const char clothes = 16; - static const char habit = 17; - static const char onion = 18; + enum Object { + kObjectWine = 1, + kObjectMoney, + kObjectBodkin, + kObjectPotion, + kObjectChastity, + kObjectBolt, + kObjectCrossbow, + kObjectLute, + kObjectBadge, + kObjectMushroom, + kObjectKey, + kObjectBell, + kObjectPrescription, + kObjectPen, + kObjectInk, + kObjectClothes, + kObjectHabit, + kObjectOnion + }; // People who hang around this game. + enum People { + // Boys: + kPeopleAvalot = 150, + kPeopleSpludwick = 151, + kPeopleCrapulus = 152, + kPeopleDrDuck = 153, + kPeopleMalagauche = 154, + kPeopleFriarTuck = 155, + kPeopleRobinHood = 156, + kPeopleCwytalot = 157, + kPeopleDuLustie = 158, + kPeopleDuke = 159, + kPeopleDogfood = 160, + kPeopleTrader = 161, + kPeopleIbythneth = 162, + kPeopleAyles = 163, + kPeoplePort = 164, + kPeopleSpurge = 165, + kPeopleJacques = 166, + // Girls: + kPeopleArkata = 175, + kPeopleGeida = 176, + kPeopleWisewoman = 178 + }; + + static const int16 kXW = 30; + static const int16 kYW = 36; // x width & y whatsit - // Boys: - static const uint16 pavalot = 150; - static const uint16 pspludwick = 151; - static const uint16 pcrapulus = 152; - static const uint16 pdrduck = 153; - static const uint16 pmalagauche = 154; - static const uint16 pfriartuck = 155; - static const uint16 probinhood = 156; - static const uint16 pcwytalot = 157; - static const uint16 pdulustie = 158; - static const uint16 pduke = 159; - static const uint16 pdogfood = 160; - static const uint16 ptrader = 161; - static const uint16 pibythneth = 162; - static const uint16 payles = 163; - static const uint16 pport = 164; - static const uint16 pspurge = 165; - static const uint16 pjacques = 166; - - // Girls: - static const uint16 parkata = 175; - static const uint16 pgeida = 176; - static const uint16 pwisewoman = 178; - - static const int16 xw = 30; - static const int16 yw = 36; // x width & y whatsit - - static const int16 margin = 5; + static const int16 kMargin = 5; static const MouseHotspotType kMouseHotSpots[9]; @@ -394,215 +358,155 @@ class Gyro { - - byte _interrogation; // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. - + byte _interrogation; + static byte _whereIs[29]; - bool _onCanDoPageSwap; // Variable static constant for overriding the ability of On to switch pages. // You may know better than On which page to switch to. + bool _onCanDoPageSwap; + - // previous:^previoustype; - dnatype dna; - byte lineNum; // Number of lines. - linetype lines[50]; // For Also. - int16 c; - //registers r; // http://www.freepascal.org/docs-html/rtl/dos/registers.html - enum { m_no , m_yes , m_virtual } visible; - bool dropsok, screturn, soundfx, cheat; - uint16 mx, my; // mouse x & y now - uint16 mpx, mpy; // mouse x & y when pressed - uint16 mrx, mry; // mouse x & y when released - byte mpress, mrelease; // times left mouse button has been pressed/released - byte keystatus; // Mouse key status - Common::String un[10]; - byte unn; - Common::String mousetext; - // which:array[0..5] of byte; - void *p; - bool weirdword; - byte to_do; - bool lmo, mousemade; - Common::String scroll[15]; - byte scrolln, score, whichwas; - byte thinks; - bool thinkthing; - - // pp:array[1..1000] of postype; - // bb:array[1..9000] of byte; - uint16 pptr, bptr; - int16 ppos[1][2]; - uint16 pozzes[24]; - byte anim; - void *copier; - int16 talkx, talky; - byte talkb, talkf; - byte scrollbells; // no. of times to ring the bell - bool ontoolbar, seescroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - - char objlist[10]; - - ::Graphics::Surface digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - ::Graphics::Surface rwlite[9]; // Maybe it will be needed to move them to the class itself instead. - // Called .free() for them in ~Gyro(). - - byte oldrw; - int8 lastscore[3]; - byte cmp; // current mouse-void - Common::String verbstr; // what you can do with your object. :-) - - Common::String *also[31][2]; - pedtype peds[15]; - magictype magics[15]; - magictype portals[7]; - fieldtype fields[30]; - byte numfields; - Common::String flags; - Common::String listen; - - uint16 oh, onh, om, hour, minutes, seconds; - - Common::String atkey; // For XTs, set to "alt-". For ATs, set to "f1". + DnaType _dna; + byte _lineNum; // Number of lines. + LineType _lines[50]; // For Also. + enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; + bool _dropsOk, _scReturn, _soundFx, _cheat; + Common::String _mouseText; + bool _weirdWord; + bool _letMeOut; + Common::String _scroll[15]; + byte _scrollNum, _score, _whichwas; + byte _thinks; + bool _thinkThing; - byte cp, ledstatus, defaultled; - FontType characters; - bool alive; - byte buffer[2000]; - uint16 bufsize; + int16 _talkX, _talkY; + byte _talkBackgroundColor, _talkFontColor; + byte _scrollBells; // no. of times to ring the bell + bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - byte oldjw; // Old joystick-way - controllers ctrl; + char _objectList[10]; - int16 underscroll; // Y-coord of just under the scroll text. + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + // Called .free() for them in ~Gyro(). - // TSkellern is only temporary, and I'll replace it - // with a local version when it's all fixed up. + byte _oldDirection; + int8 _scoreToDisplay[3]; + byte _currentMouse; // current mouse-void + Common::String _verbStr; // what you can do with your object. :-) - // tskellern:int32 absolute $0:244; { Over int $61 } + Common::String *_also[31][2]; + PedType _peds[15]; + MagicType _magics[15]; + MagicType _portals[7]; + FieldType _fields[30]; + byte _fieldNum; + Common::String _flags; + Common::String _listen; - bool ddmnow; // Kludge so we don't have to keep referring to Dropdown - Common::String roomname; // Name of this room + uint16 _oh, _onh, _om, _hours, _minutes, _seconds; - //text logfile; // http://wiki.freepascal.org/Text - bool log_epson; + Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". - bool cl_override; + byte _cp, _ledStatus, _defaultLed; + FontType _font; + bool _alive; + byte _buffer[2000]; + uint16 _bufSize; - byte locks; // ABSOLUTE $40:$17; + int16 _underScroll; // Y-coord of just under the scroll text. - Common::String subject; // What you're talking to them about. - byte subjnumber; // The same thing. + bool _dropdownActive; // Kludge so we don't have to keep referring to Dropdown + Common::String _roomnName; // Name of actual room - bool keyboardclick; // Is a keyboard click noise wanted? + Common::String _subject; // What you're talking to them about. + byte _subjectNum; // The same thing. - byte him, her, it; - int32 roomtime; // Set to 0 when you enter a room, added to in every loop. + bool _keyboardClick; // Is a keyboard click noise wanted? - bool after_the_scroll; + byte _him, _her, _it; + int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. // For the demo: - demo_type demo_rec; - Common::File demofile; // of demo_type - Common::DumpFile demofile_save; // uruk added it - first use located in constructor of Basher - - byte last_person; // Last person to have been selected using the People menu. + DemoType _demoRec; + Common::File _demoFile; // of demo_type + Common::DumpFile _demoFileSave; // uruk added it - first use located in constructor of Basher - bool doing_sprite_run; // Only set to True if we're doing a sprite_run - // at this moment. This stops the trippancy system - // from moving any of the sprites. + byte _lastPerson; // Last person to have been selected using the People menu. - vmctype vmc; - Common::String filetoload; + bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool holdthedawn; // If this is true, calling Dawn will do nothing. - // It's used, for example, at the start, to stop Load from dawning. + bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - uint16 storage_seg, storage_ofs; // Seg and ofs of the Storage area. - uint16 skellern; // Offset of the timer variable - 1 more than storage_OFS bool isLoaded; // Is it a loaded gamestate? - bool super_was_virtual, super_was_off; // Used by Super_Off and Super_On + Common::String _enidFilename; - Common::String enid_filename; - - joysetup js; - uint16 cxmin, cxmax, cymin, cymax; - bool use_joy_a; Gyro(AvalancheEngine *vm); ~Gyro(); - Common::String strf(int32 x); + Common::String intToStr(int32 x); - void newpointer(byte id); + void newMouse(byte id); void setMousePointerWait(); // Makes hourglass. - void on(); - - void off(); - - void xycheck(); // Only updates mx & my, not all other mouse vars. - - void check(); - void note(uint16 hertz); void blip(); - void shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); + void shadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); - void newgame(); // This sets up the DNA for a completely new game. + void newGame(); // This sets up the DNA for a completely new game. void click(); // "Audio keyboard feedback" - void slowdown(); - - bool flagset(char x); + void slowDown(); - void force_numlock(); + bool setFlag(char x); - bool pennycheck(uint16 howmuchby); + void forceNumlock(); - Common::String getname(byte whose); + bool updateMoney(uint16 howmuchby); // Called pennycheck in the original. - byte getnamechar(byte whose); + Common::String getName(byte whose); - Common::String get_thing(byte which); + byte getNameChar(byte whose); - char get_thingchar(byte which); + Common::String getThing(byte which); - Common::String get_better(byte which); + char getThingChar(byte which); - Common::String f5_does(); // This procedure determines what f5 does. + Common::String getItem(byte which); // Called get_better in the original. - void load_a_mouse(byte which); + Common::String f5Does(); // This procedure determines what f5 does. - void background(byte x); + void loadMouse(byte which); - void hang_around_for_a_while(); + void setBackgroundColor(byte x); - bool mouse_near_text(); + void hangAroundForAWhile(); private: AvalancheEngine *_vm; - static const Common::String things[numobjs]; + static const Common::String kThings[kObjectNum]; - static const char thingchar[]; + static const char kThingsChar[]; - static const Common::String better[numobjs]; + static const Common::String kItems[kObjectNum]; // 'better' in the original. - static const char betterchar[]; + static const char kItemsChar[]; // Similar as above. - void shadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); + void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; } // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index c4dc6fc97fcb..425cab0858d6 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -60,18 +60,18 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { Lucerna::~Lucerna() { for (byte i = 0; i < 31; i++) for (byte j = 0; j < 2; j++) - if (_vm->_gyro->also[i][j] != 0) { - delete _vm->_gyro->also[i][j]; - _vm->_gyro->also[i][j] = 0; + if (_vm->_gyro->_also[i][j] != 0) { + delete _vm->_gyro->_also[i][j]; + _vm->_gyro->_also[i][j] = 0; } } void Lucerna::init() { - _vm->_gyro->oh = _vm->_gyro->onh = _vm->_gyro->om = 17717; + _vm->_gyro->_oh = _vm->_gyro->_onh = _vm->_gyro->_om = 17717; for (byte i = 0; i < 31; i++) for (byte j = 0; j < 2; j++) - _vm->_gyro->also[i][j] = 0; + _vm->_gyro->_also[i][j] = 0; #if 0 if (_vm->_enhanced->atbios) @@ -92,7 +92,7 @@ void Lucerna::callVerb(byte id) { "assigned to it. You may press alt-A to see what the " + "current setting of this key is."); } else { - _vm->_gyro->weirdword = false; + _vm->_gyro->_weirdWord = false; _vm->_acci->_polite = true; _vm->_acci->_verb = id; _vm->_acci->doThat(); @@ -107,11 +107,11 @@ void Lucerna::draw_also_lines() { _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (ff = 0; ff < _vm->_gyro->lineNum; ff++) { + for (ff = 0; ff < _vm->_gyro->_lineNum; ff++) { // We had to check if the lines are within the borders of the screen. - if ((_vm->_gyro->lines[ff].x1 >= 0) && (_vm->_gyro->lines[ff].x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y1 >= 0) && (_vm->_gyro->lines[ff].y1 < _vm->_graphics->kScreenHeight) - && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + if ((_vm->_gyro->_lines[ff]._x1 >= 0) && (_vm->_gyro->_lines[ff]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[ff]._y1 >= 0) && (_vm->_gyro->_lines[ff]._y1 < _vm->_graphics->kScreenHeight) + && (_vm->_gyro->_lines[ff]._x2 >= 0) && (_vm->_gyro->_lines[ff]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[ff]._y2 >= 0) && (_vm->_gyro->_lines[ff]._y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_vm->_gyro->_lines[ff]._x1, _vm->_gyro->_lines[ff]._y1, _vm->_gyro->_lines[ff]._x2, _vm->_gyro->_lines[ff]._y2, _vm->_gyro->_lines[ff]._color); } CursorMan.showMouse(true); @@ -137,10 +137,10 @@ void Lucerna::scram1(Common::String &x) { void Lucerna::unscramble() { for (byte fv = 0; fv < 31; fv++) for (byte ff = 0; ff < 2; ff++) - if (_vm->_gyro->also[fv][ff] != 0) - scram1(*_vm->_gyro->also[fv][ff]); - scram1(_vm->_gyro->listen); - scram1(_vm->_gyro->flags); + if (_vm->_gyro->_also[fv][ff] != 0) + scram1(*_vm->_gyro->_also[fv][ff]); + scram1(_vm->_gyro->_listen); + scram1(_vm->_gyro->_flags); } void Lucerna::load_also(Common::String n) { @@ -148,9 +148,9 @@ void Lucerna::load_also(Common::String n) { for (fv = 0; fv < 31; fv++) for (ff = 0; ff < 2; ff++) - if (_vm->_gyro->also[fv][ff] != 0) { - delete _vm->_gyro->also[fv][ff]; - _vm->_gyro->also[fv][ff] = 0; + if (_vm->_gyro->_also[fv][ff] != 0) { + delete _vm->_gyro->_also[fv][ff]; + _vm->_gyro->_also[fv][ff] = 0; } Common::String filename; @@ -165,58 +165,58 @@ void Lucerna::load_also(Common::String n) { byte minnames = f.readByte(); for (fv = 0; fv <= minnames; fv++) { for (ff = 0; ff < 2; ff++) { - _vm->_gyro->also[fv][ff] = new Common::String; - *_vm->_gyro->also[fv][ff] = nextstring(); + _vm->_gyro->_also[fv][ff] = new Common::String; + *_vm->_gyro->_also[fv][ff] = nextstring(); } - *_vm->_gyro->also[fv][0] = Common::String('\x9D') + *_vm->_gyro->also[fv][0] + Common::String('\x9D'); + *_vm->_gyro->_also[fv][0] = Common::String('\x9D') + *_vm->_gyro->_also[fv][0] + Common::String('\x9D'); } - memset(_vm->_gyro->lines, 0xFF, sizeof(_vm->_gyro->lines)); + memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); //fv = getpixel(0, 0); - _vm->_gyro->lineNum = f.readByte(); - for (byte i = 0; i < _vm->_gyro->lineNum; i++) { - _vm->_gyro->lines[i].x1 = f.readSint16LE(); - _vm->_gyro->lines[i].y1 = f.readSint16LE(); - _vm->_gyro->lines[i].x2 = f.readSint16LE(); - _vm->_gyro->lines[i].y2 = f.readSint16LE(); - _vm->_gyro->lines[i].col = f.readByte(); + _vm->_gyro->_lineNum = f.readByte(); + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + _vm->_gyro->_lines[i]._x1 = f.readSint16LE(); + _vm->_gyro->_lines[i]._y1 = f.readSint16LE(); + _vm->_gyro->_lines[i]._x2 = f.readSint16LE(); + _vm->_gyro->_lines[i]._y2 = f.readSint16LE(); + _vm->_gyro->_lines[i]._color = f.readByte(); } - memset(_vm->_gyro->peds, 177, sizeof(_vm->_gyro->peds)); + memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); fv = f.readByte(); for (byte i = 0; i < fv; i++) { - _vm->_gyro->peds[i].x = f.readSint16LE(); - _vm->_gyro->peds[i].y = f.readSint16LE(); - _vm->_gyro->peds[i].dir = f.readByte(); + _vm->_gyro->_peds[i]._x = f.readSint16LE(); + _vm->_gyro->_peds[i]._y = f.readSint16LE(); + _vm->_gyro->_peds[i]._direction = f.readByte(); } - _vm->_gyro->numfields = f.readByte(); - for (byte i = 0; i < _vm->_gyro->numfields; i++) { - _vm->_gyro->fields[i].x1 = f.readSint16LE(); - _vm->_gyro->fields[i].y1 = f.readSint16LE(); - _vm->_gyro->fields[i].x2 = f.readSint16LE(); - _vm->_gyro->fields[i].y2 = f.readSint16LE(); + _vm->_gyro->_fieldNum = f.readByte(); + for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + _vm->_gyro->_fields[i]._x1 = f.readSint16LE(); + _vm->_gyro->_fields[i]._y1 = f.readSint16LE(); + _vm->_gyro->_fields[i]._x2 = f.readSint16LE(); + _vm->_gyro->_fields[i]._y2 = f.readSint16LE(); } for (byte i = 0; i < 15; i++) { - _vm->_gyro->magics[i].op = f.readByte(); - _vm->_gyro->magics[i].data = f.readUint16LE(); + _vm->_gyro->_magics[i]._operation = f.readByte(); + _vm->_gyro->_magics[i]._data = f.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro->portals[i].op = f.readByte(); - _vm->_gyro->portals[i].data = f.readUint16LE(); + _vm->_gyro->_portals[i]._operation = f.readByte(); + _vm->_gyro->_portals[i]._data = f.readUint16LE(); } - _vm->_gyro->flags.clear(); + _vm->_gyro->_flags.clear(); for (byte i = 0; i < 26; i++) - _vm->_gyro->flags += f.readByte(); + _vm->_gyro->_flags += f.readByte(); int16 listen_length = f.readByte(); - _vm->_gyro->listen.clear(); + _vm->_gyro->_listen.clear(); for (byte i = 0; i < listen_length; i++) - _vm->_gyro->listen += f.readByte(); + _vm->_gyro->_listen += f.readByte(); draw_also_lines(); @@ -226,7 +226,7 @@ void Lucerna::load_also(Common::String n) { f.close(); unscramble(); for (fv = 0; fv <= minnames; fv++) - *_vm->_gyro->also[fv][0] = Common::String(',') + *_vm->_gyro->also[fv][0] + ','; + *_vm->_gyro->_also[fv][0] = Common::String(',') + *_vm->_gyro->_also[fv][0] + ','; } void Lucerna::load(byte n) { // Load2, actually @@ -236,7 +236,7 @@ void Lucerna::load(byte n) { // Load2, actually _vm->_graphics->fleshColors(); - xx = _vm->_gyro->strf(n); + xx = _vm->_gyro->intToStr(n); Common::String filename; filename = filename.format("place%s.avd", xx.c_str()); if (!f.open(filename)) { @@ -245,12 +245,12 @@ void Lucerna::load(byte n) { // Load2, actually } f.seek(146); - if (!_vm->_gyro->roomname.empty()) - _vm->_gyro->roomname.clear(); + if (!_vm->_gyro->_roomnName.empty()) + _vm->_gyro->_roomnName.clear(); for (byte i = 0; i < 30; i++) { char actChar = f.readByte(); if ((32 <= actChar) && (actChar <= 126)) - _vm->_gyro->roomname += actChar; + _vm->_gyro->_roomnName += actChar; } // Compression method byte follows this... @@ -280,9 +280,9 @@ void Lucerna::find_people(byte room) { for (byte fv = 1; fv < 29; fv++) { if (_vm->_gyro->_whereIs[fv] == room) { if (fv < 25) - _vm->_gyro->him = fv + 150; + _vm->_gyro->_him = fv + 150; else - _vm->_gyro->her = fv + 150; + _vm->_gyro->_her = fv + 150; } } } @@ -290,17 +290,17 @@ void Lucerna::find_people(byte room) { void Lucerna::exitroom(byte x) { //nosound(); _vm->_celer->forgetBackgroundSprites(); - _vm->_gyro->seescroll = true; // This stops the trippancy system working over the length of this procedure. + _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { case r__spludwicks: _vm->_timeout->lose_timer(_vm->_timeout->reason_avariciustalks); - _vm->_gyro->dna.avaricius_talk = 0; + _vm->_gyro->_dna._avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: - if (_vm->_gyro->dna.drawbridge_open > 0) { - _vm->_gyro->dna.drawbridge_open = 4; // Fully open. + if (_vm->_gyro->_dna._drawbridgeOpen > 0) { + _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. _vm->_timeout->lose_timer(_vm->_timeout->reason_drawbridgefalls); } break; @@ -314,38 +314,38 @@ void Lucerna::exitroom(byte x) { _vm->_gyro->_interrogation = 0; // Leaving the room cancels all the questions automatically. - _vm->_gyro->seescroll = false; // Now it can work again! + _vm->_gyro->_seeScroll = false; // Now it can work again! - _vm->_gyro->dna.last_room = _vm->_gyro->dna.room; - if (_vm->_gyro->dna.room != r__map) - _vm->_gyro->dna.last_room_not_map = _vm->_gyro->dna.room; + _vm->_gyro->_dna._lastRoom = _vm->_gyro->_dna._room; + if (_vm->_gyro->_dna._room != r__map) + _vm->_gyro->_dna._lastRoomNotMap = _vm->_gyro->_dna._room; } void Lucerna::new_town() { // You've just entered a town from the map. _vm->_dropdown->setupMenu(); - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__outsidenottspub: // Entry into Nottingham. - if ((_vm->_gyro->dna.rooms[r__robins] > 0) && (_vm->_gyro->dna.been_tied_up) && (!_vm->_gyro->dna.taken_mushroom)) - _vm->_gyro->dna.mushroom_growing = true; + if ((_vm->_gyro->_dna._roomCount[r__robins] > 0) && (_vm->_gyro->_dna._beenTiedUp) && (!_vm->_gyro->_dna._takenMushroom)) + _vm->_gyro->_dna._mushroomGrowing = true; break; case r__wisewomans: { // Entry into Argent. - if (_vm->_gyro->dna.talked_to_crapulus && (! _vm->_gyro->dna.lustie_is_asleep)) { - _vm->_gyro->dna.spludwicks_here = !((_vm->_gyro->dna.rooms[r__wisewomans] % 3) == 1); - _vm->_gyro->dna.crapulus_will_tell = ! _vm->_gyro->dna.spludwicks_here; + if (_vm->_gyro->_dna._talkedToCrapulus && (! _vm->_gyro->_dna._lustieIsAsleep)) { + _vm->_gyro->_dna._spludwickAtHome = !((_vm->_gyro->_dna._roomCount[r__wisewomans] % 3) == 1); + _vm->_gyro->_dna._crapulusWillTell = ! _vm->_gyro->_dna._spludwickAtHome; } else { - _vm->_gyro->dna.spludwicks_here = true; - _vm->_gyro->dna.crapulus_will_tell = false; + _vm->_gyro->_dna._spludwickAtHome = true; + _vm->_gyro->_dna._crapulusWillTell = false; } - if (_vm->_gyro->dna.box_contents == _vm->_gyro->wine) - _vm->_gyro->dna.winestate = 3; // Vinegar + if (_vm->_gyro->_dna._boxContent == _vm->_gyro->kObjectWine) + _vm->_gyro->_dna._wineState = 3; // Vinegar } break; } - if (_vm->_gyro->dna.room != r__outsideducks) { - if ((_vm->_gyro->dna.obj[_vm->_gyro->onion - 1]) && !(_vm->_gyro->dna.onion_in_vinegar)) - _vm->_gyro->dna.rotten_onion = true; // You're holding the onion + if (_vm->_gyro->_dna._room != r__outsideducks) { + if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) && !(_vm->_gyro->_dna._onionInVinegar)) + _vm->_gyro->_dna._rottenOnion = true; // You're holding the onion } } @@ -361,33 +361,33 @@ void Lucerna::put_geida_at(byte whichped, byte &ped) { } void Lucerna::enterroom(byte x, byte ped) { - _vm->_gyro->seescroll = true; // This stops the trippancy system working over the length of this procedure. + _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. find_people(x); - _vm->_gyro->dna.room = x; + _vm->_gyro->_dna._room = x; if (ped != 0) - _vm->_gyro->dna.rooms[x]++; + _vm->_gyro->_dna._roomCount[x]++; load(x); - if ((_vm->_gyro->dna.rooms[x] == 0) && (! _vm->_gyro->flagset('S'))) + if ((_vm->_gyro->_dna._roomCount[x] == 0) && (! _vm->_gyro->setFlag('S'))) points(1); - _vm->_gyro->_whereIs[_vm->_gyro->pavalot - 150] = _vm->_gyro->dna.room; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; - if (_vm->_gyro->dna.geida_follows) - _vm->_gyro->_whereIs[_vm->_gyro->pgeida - 150] = x; + if (_vm->_gyro->_dna._geidaFollows) + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleGeida - 150] = x; - _vm->_gyro->roomtime = 0; + _vm->_gyro->_roomTime = 0; - if ((_vm->_gyro->dna.last_room == r__map) && (_vm->_gyro->dna.last_room_not_map != _vm->_gyro->dna.room)) + if ((_vm->_gyro->_dna._lastRoom == r__map) && (_vm->_gyro->_dna._lastRoomNotMap != _vm->_gyro->_dna._room)) new_town(); switch (x) { case r__yours: - if (_vm->_gyro->dna.avvy_in_bed) { + if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); @@ -396,12 +396,12 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideyours: if (ped > 0) { - if (! _vm->_gyro->dna.talked_to_crapulus) { + if (! _vm->_gyro->_dna._talkedToCrapulus) { - _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = r__outsideyours; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours; _vm->_trip->tr[1].init(8, false, _vm->_trip); // load Crapulus - if (_vm->_gyro->dna.rooms[r__outsideyours] == 1) { + if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { _vm->_trip->apped(2, 4); // Start on the right-hand side of the screen. _vm->_trip->tr[1].walkto(5); // Walks up to greet you. } else { @@ -412,34 +412,34 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // He always faces Avvy. - } else _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = r__nowhere; + } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; - if (_vm->_gyro->dna.crapulus_will_tell) { + if (_vm->_gyro->_dna._crapulusWillTell) { _vm->_trip->tr[1].init(8, false, _vm->_trip); _vm->_trip->apped(2, 2); _vm->_trip->tr[1].walkto(4); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); - _vm->_gyro->dna.crapulus_will_tell = false; + _vm->_gyro->_dna._crapulusWillTell = false; } } break; case r__outsidespludwicks: - if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { + if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); - _vm->_gyro->dna.spludwicks_here = true; + _vm->_gyro->_dna._spludwickAtHome = true; } break; case r__spludwicks: - if (_vm->_gyro->dna.spludwicks_here) { + if (_vm->_gyro->_dna._spludwickAtHome) { if (ped > 0) { _vm->_trip->tr[1].init(2, false, _vm->_trip); // load Spludwick _vm->_trip->apped(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } - _vm->_gyro->dna.dogfoodpos = 0; // _vm->_gyro->also Spludwick pos. + _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; @@ -448,19 +448,19 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__brummieroad: - if (_vm->_gyro->dna.geida_follows) + if (_vm->_gyro->_dna._geidaFollows) put_geida_at(5, ped); - if (_vm->_gyro->dna.cwytalot_gone) { - _vm->_gyro->magics[kColorLightred - 1].op = _vm->_gyro->kMagicNothing; - _vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] = r__nowhere; + if (_vm->_gyro->_dna._cwytalotGone) { + _vm->_gyro->_magics[kColorLightred - 1]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; - _vm->_gyro->_whereIs[_vm->_gyro->pcwytalot - 150] = r__brummieroad; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; - if (_vm->_gyro->dna.rooms[r__brummieroad] == 1) { // First time here... + if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... _vm->_trip->apped(2, 2); // He appears on the right of the screen... _vm->_trip->tr[1].walkto(4); // ...and he walks up... } else { @@ -473,31 +473,31 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentroad: - if ((_vm->_gyro->dna.cwytalot_gone) && (! _vm->_gyro->dna.cwytalot_in_herts) && (ped == 2) && - (_vm->_gyro->dna.rooms[r__argentroad] > 3)) { + if ((_vm->_gyro->_dna._cwytalotGone) && (! _vm->_gyro->_dna._passedCwytalotInHerts) && (ped == 2) && + (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot again _vm->_trip->apped(2, 1); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; - _vm->_gyro->dna.cwytalot_in_herts = true; + _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } break; case r__bridge: - if (_vm->_gyro->dna.drawbridge_open == 4) { // open + if (_vm->_gyro->_dna._drawbridgeOpen == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); - _vm->_gyro->magics[kColorGreen - 1].op = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. + _vm->_gyro->_magics[kColorGreen - 1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. } - if (_vm->_gyro->dna.geida_follows) + if (_vm->_gyro->_dna._geidaFollows) put_geida_at(ped + 3, ped); // load Geida break; case r__robins: if (ped > 0) { - if (! _vm->_gyro->dna.been_tied_up) { + if (! _vm->_gyro->_dna._beenTiedUp) { // A welcome party... or maybe not... _vm->_trip->tr[1].init(6, false, _vm->_trip); _vm->_trip->apped(2, 2); @@ -506,22 +506,22 @@ void Lucerna::enterroom(byte x, byte ped) { } } - if (_vm->_gyro->dna.been_tied_up) { - _vm->_gyro->_whereIs[_vm->_gyro->probinhood - 150] = 0; - _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = 0; + if (_vm->_gyro->_dna._beenTiedUp) { + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = 0; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 0; } - if (_vm->_gyro->dna.tied_up) + if (_vm->_gyro->_dna._tiedUp) _vm->_celer->drawBackgroundSprite(-1, -1, 2); - if (!_vm->_gyro->dna.mushroom_growing) + if (!_vm->_gyro->_dna._mushroomGrowing) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); break; case r__outsidecardiffcastle: if (ped > 0) - switch (_vm->_gyro->dna.cardiff_things) { + switch (_vm->_gyro->_dna._cardiffQuestionNum) { case 0 : { // You've answered NONE of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); _vm->_trip->apped(2, 2); @@ -530,7 +530,7 @@ void Lucerna::enterroom(byte x, byte ped) { } break; case 5 : - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); @@ -539,8 +539,8 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } - if (_vm->_gyro->dna.cardiff_things < 5) - _vm->_gyro->_interrogation = _vm->_gyro->dna.cardiff_things; + if (_vm->_gyro->_dna._cardiffQuestionNum < 5) + _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; else _vm->_gyro->_interrogation = 0; break; @@ -549,13 +549,13 @@ void Lucerna::enterroom(byte x, byte ped) { dawn(); //setactivepage(cp); if (ped > 0) - zoomout(_vm->_gyro->peds[ped - 1].x, _vm->_gyro->peds[ped - 1].y); + zoomout(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); //setactivepage(1 - cp); { - if ((_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) && (_vm->_gyro->dna.winestate != 3)) { + if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { _vm->_visa->dixi('q', 9); // Don't want to waste the wine! - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; objectlist(); } } @@ -568,33 +568,33 @@ void Lucerna::enterroom(byte x, byte ped) { switch (ped) { case 3: { // Enter from oubliette - _vm->_gyro->dna.cat_x = 8; - _vm->_gyro->dna.cat_y = 4; + _vm->_gyro->_dna._catacombX = 8; + _vm->_gyro->_dna._catacombY = 4; } break; case 5: { // Enter from du Lustie's - _vm->_gyro->dna.cat_x = 8; - _vm->_gyro->dna.cat_y = 7; + _vm->_gyro->_dna._catacombX = 8; + _vm->_gyro->_dna._catacombY = 7; } break; case 6: { // Enter from Geida's - _vm->_gyro->dna.cat_x = 4; - _vm->_gyro->dna.cat_y = 1; + _vm->_gyro->_dna._catacombX = 4; + _vm->_gyro->_dna._catacombY = 1; } break; } - _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; _vm->_trip->catamove(ped); - _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; } break; case r__argentpub: - if (_vm->_gyro->dna.wonnim) + if (_vm->_gyro->_dna._wonNim) _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. - _vm->_gyro->dna.malagauche = 0; // Ready to boot Malagauche - if (_vm->_gyro->dna.givenbadgetoiby) { + _vm->_gyro->_dna._malagauche = 0; // Ready to boot Malagauche + if (_vm->_gyro->_dna._givenBadgeToIby) { _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); } @@ -602,16 +602,16 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__lustiesroom: - _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. + _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_trip->tr[0].whichsprite == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); - else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) // already + else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); - if (_vm->_gyro->dna.geida_follows) { + if (_vm->_gyro->_dna._geidaFollows) { put_geida_at(5, ped); - if (_vm->_gyro->dna.lustie_is_asleep) { + if (_vm->_gyro->_dna._lustieIsAsleep) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); } @@ -619,13 +619,13 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__musicroom: - if (_vm->_gyro->dna.jacques_awake > 0) { - _vm->_gyro->dna.jacques_awake = 5; + if (_vm->_gyro->_dna._jacquesState > 0) { + _vm->_gyro->_dna._jacquesState = 5; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->magics[kColorBrown - 1].op = _vm->_gyro->kMagicNothing; - _vm->_gyro->_whereIs[_vm->_gyro->pjacques - 150] = 0; + _vm->_gyro->_magics[kColorBrown - 1]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleJacques - 150] = 0; } if (ped != 0) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); @@ -662,7 +662,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__wisewomans: _vm->_trip->tr[1].init(11, false, _vm->_trip); - if ((_vm->_gyro->dna.rooms[r__wisewomans] == 1) && (ped > 0)) { + if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { _vm->_trip->apped(2, 2); // Start on the right-hand side of the screen. _vm->_trip->tr[1].walkto(4); // Walks up to greet you. } else { @@ -680,18 +680,18 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); - if (_vm->_gyro->dna.arrow_in_the_door) + if (_vm->_gyro->_dna._arrowInTheDoor) _vm->_sequence->then_show(3); else _vm->_sequence->then_show(2); - if (_vm->_gyro->dna.taken_pen) + if (_vm->_gyro->_dna._takenPen) _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_sequence->start_to_close(); } else { _vm->_celer->drawBackgroundSprite(-1, -1, 1); - if (_vm->_gyro->dna.arrow_in_the_door) + if (_vm->_gyro->_dna._arrowInTheDoor) _vm->_celer->drawBackgroundSprite(-1, -1, 3); else _vm->_celer->drawBackgroundSprite(-1, -1, 2); @@ -732,7 +732,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__aylesoffice: - if (_vm->_gyro->dna.ayles_is_awake) + if (_vm->_gyro->_dna._aylesIsAwake) _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; // Ayles awake. @@ -743,18 +743,18 @@ void Lucerna::enterroom(byte x, byte ped) { case r__easthall: case r__westhall: - if (_vm->_gyro->dna.geida_follows) + if (_vm->_gyro->_dna._geidaFollows) put_geida_at(ped + 2, ped); break; case r__lusties: - if (_vm->_gyro->dna.geida_follows) + if (_vm->_gyro->_dna._geidaFollows) put_geida_at(ped + 6, ped); break; case r__nottspub: - if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->dna.dogfoodpos = 1; // Actually, du Lustie pos. + if (_vm->_gyro->_dna._sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. break; case r__outsideducks: @@ -771,11 +771,11 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__ducks: - _vm->_gyro->dna.dogfoodpos = 1; + _vm->_gyro->_dna._dogFoodPos = 1; break; // Actually, Duck pos. } - _vm->_gyro->seescroll = false; // Now it can work again! + _vm->_gyro->_seeScroll = false; // Now it can work again! if (_vm->_gyro->isLoaded) _vm->_gyro->isLoaded = false; @@ -783,9 +783,9 @@ void Lucerna::enterroom(byte x, byte ped) { void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! const int16 picsize = 966; - const bytefield thinkspace = {25, 170, 32, 200}; + const ByteField thinkspace = {25, 170, 32, 200}; - _vm->_gyro->thinks = z; + _vm->_gyro->_thinks = z; z--; _vm->_gyro->setMousePointerWait(); @@ -831,7 +831,7 @@ void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! _vm->_trip->getset[fv].remember(thinkspace); CursorMan.showMouse(true); - _vm->_gyro->thinkthing = th; + _vm->_gyro->_thinkThing = th; } void Lucerna::load_digits() { // Load the scoring digits & rwlites @@ -851,7 +851,7 @@ void Lucerna::load_digits() { // Load the scoring digits & rwlites f.read(_vm->_gyro->digit[fv], digitsize); #endif - _vm->_gyro->digit[fv] = _vm->_graphics->loadPictureGraphic(f); + _vm->_gyro->_digits[fv] = _vm->_graphics->loadPictureGraphic(f); } for (byte ff = 0; ff < 9; ff++) { @@ -862,7 +862,7 @@ void Lucerna::load_digits() { // Load the scoring digits & rwlites f.read(_vm->_gyro->rwlite[ff], rwlitesize); #endif - _vm->_gyro->rwlite[ff] = _vm->_graphics->loadPictureGraphic(f); + _vm->_gyro->_directions[ff] = _vm->_graphics->loadPictureGraphic(f); } f.close(); @@ -888,18 +888,18 @@ void Lucerna::toolbar() { // on; - _vm->_gyro->oldrw = 177; + _vm->_gyro->_oldDirection = 177; showrw(); } void Lucerna::showscore() { - const bytefield scorespace = {33, 177, 39, 200}; + const ByteField scorespace = {33, 177, 39, 200}; if (_vm->_gyro->kDemo) return; - uint16 score = _vm->_gyro->dna.score; + uint16 score = _vm->_gyro->_dna._score; int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { byte divisor = 1; @@ -915,8 +915,8 @@ void Lucerna::showscore() { //setactivepage(3); for (byte fv = 0; fv < 3; fv++) - if (_vm->_gyro->lastscore[fv] != numbers[fv]) - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); + if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv++) _vm->_trip->getset[fv].remember(scorespace); @@ -925,12 +925,12 @@ void Lucerna::showscore() { CursorMan.showMouse(true); for (byte i = 0; i < 3; i++) - _vm->_gyro->lastscore[i] = numbers[i]; + _vm->_gyro->_scoreToDisplay[i] = numbers[i]; } void Lucerna::points(byte num) { // Add on no. of points for (byte q = 1; q <= num; q++) { - _vm->_gyro->dna.score++; + _vm->_gyro->_dna._score++; #if 0 if (soundfx) { @@ -954,25 +954,25 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { switch (col) { case kColorGreen: { - _vm->_gyro->dna.rw = _vm->_trip->up; + _vm->_gyro->_dna._direction = _vm->_trip->up; _vm->_trip->rwsp(0, _vm->_trip->up); showrw(); } break; case kColorBrown: { - _vm->_gyro->dna.rw = _vm->_trip->down; + _vm->_gyro->_dna._direction = _vm->_trip->down; _vm->_trip->rwsp(0, _vm->_trip->down); showrw(); } break; case kColorCyan: { - _vm->_gyro->dna.rw = _vm->_trip->left; + _vm->_gyro->_dna._direction = _vm->_trip->left; _vm->_trip->rwsp(0, _vm->_trip->left); showrw(); } break; case kColorLightmagenta: { - _vm->_gyro->dna.rw = _vm->_trip->right; + _vm->_gyro->_dna._direction = _vm->_trip->right; _vm->_trip->rwsp(0, _vm->_trip->right); showrw(); } @@ -997,18 +997,18 @@ void Lucerna::fxtoggle() { } void Lucerna::objectlist() { - _vm->_gyro->dna.carrying = 0; - if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks - 1]) - thinkabout(_vm->_gyro->money, _vm->_gyro->kThing); // you always have money - for (byte fv = 0; fv < numobjs; fv++) - if (_vm->_gyro->dna.obj[fv]) { - _vm->_gyro->dna.carrying++; - _vm->_gyro->objlist[_vm->_gyro->dna.carrying] = fv + 1; + _vm->_gyro->_dna._carryNum = 0; + if (_vm->_gyro->_thinkThing && !_vm->_gyro->_dna._objects[_vm->_gyro->_thinks - 1]) + thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); // you always have money + for (byte fv = 0; fv < kObjectNum; fv++) + if (_vm->_gyro->_dna._objects[fv]) { + _vm->_gyro->_dna._carryNum++; + _vm->_gyro->_objectList[_vm->_gyro->_dna._carryNum] = fv + 1; } } void Lucerna::verte(Common::Point cursorPos) { - if (! _vm->_gyro->dna.user_moves_avvy) + if (! _vm->_gyro->_dna._userMovesAvvy) return; cursorPos.y /= 2; @@ -1062,28 +1062,28 @@ void Lucerna::verte(Common::Point cursorPos) { void Lucerna::checkclick() { Common::Point cursorPos = _vm->getMousePos(); - _vm->_gyro->ontoolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); + _vm->_gyro->_onToolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); /*if (_vm->_gyro->mrelease > 0) _vm->_gyro->after_the_scroll = false;*/ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newpointer(1); // up arrow + _vm->_gyro->newMouse(1); // up arrow else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) - _vm->_gyro->newpointer(8); //I-beam + _vm->_gyro->newMouse(8); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newpointer(2); // screwdriver - else if (!_vm->_gyro->ddmnow) { // Dropdown can handle its own pointers. + _vm->_gyro->newMouse(2); // screwdriver + else if (!_vm->_gyro->_dropdownActive) { // Dropdown can handle its own pointers. if (holdLeftMouse) { - _vm->_gyro->newpointer(7); // Mark's crosshairs + _vm->_gyro->newMouse(7); // Mark's crosshairs verte(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else - _vm->_gyro->newpointer(4); // fletch + _vm->_gyro->newMouse(4); // fletch } if (holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. - if (_vm->_gyro->dropsok) + if (_vm->_gyro->_dropsOk) _vm->_dropdown->updateMenu(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; @@ -1095,19 +1095,19 @@ void Lucerna::checkclick() { _vm->_parser->plotText(); } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. - if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake) + if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) mouseway(cursorPos); } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { _vm->updateEvents(); } while (holdLeftMouse); - if (_vm->_gyro->thinkthing) { - _vm->_acci->_thing = _vm->_gyro->thinks; + if (_vm->_gyro->_thinkThing) { + _vm->_acci->_thing = _vm->_gyro->_thinks; _vm->_acci->_thing += 49; _vm->_acci->_person = _vm->_acci->kPardon; } else { - _vm->_acci->_person = _vm->_gyro->thinks; + _vm->_acci->_person = _vm->_gyro->_thinks; _vm->_acci->_thing = _vm->_acci->kPardon; } callVerb(_vm->_acci->kVerbCodeExam); @@ -1126,9 +1126,9 @@ void Lucerna::checkclick() { } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxtoggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; - } else if (!_vm->_gyro->dropsok) - _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext; + _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; + } else if (!_vm->_gyro->_dropsOk) + _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; } } @@ -1185,9 +1185,9 @@ void Lucerna::dawn() { void Lucerna::showrw() { // It's data is loaded in load_digits(). - if (_vm->_gyro->oldrw == _vm->_gyro->dna.rw) + if (_vm->_gyro->_oldDirection == _vm->_gyro->_dna._direction) return; - _vm->_gyro->oldrw = _vm->_gyro->dna.rw; + _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; CursorMan.showMouse(false); #if 0 @@ -1197,7 +1197,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). } #endif - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->rwlite[_vm->_gyro->dna.rw], 0, 161); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_dna._direction], 0, 161); CursorMan.showMouse(true); //setactivepage(1 - cp); @@ -1227,7 +1227,7 @@ void Lucerna::hand(const Common::Point &a, byte c) { } void Lucerna::refresh_hands() { - const bytefield clockspace = {61, 166, 66, 200}; + const ByteField clockspace = {61, 166, 66, 200}; for (byte page_ = 0; page_ < 2; page_++) _vm->_trip->getset[page_].remember(clockspace); @@ -1236,13 +1236,13 @@ void Lucerna::refresh_hands() { void Lucerna::plothands() { // off; //setactivepage(3); - calchand(_vm->_gyro->onh, 14, ah, kColorYellow); - calchand(_vm->_gyro->om * 6, 17, am, kColorYellow); + calchand(_vm->_gyro->_onh, 14, ah, kColorYellow); + calchand(_vm->_gyro->_om * 6, 17, am, kColorYellow); hand(ah, kColorBrown); hand(am, kColorBrown); calchand(nh, 14, ah, kColorBrown); - calchand(_vm->_gyro->minutes * 6, 17, am, kColorBrown); + calchand(_vm->_gyro->_minutes * 6, 17, am, kColorBrown); hand(ah, kColorYellow); hand(am, kColorYellow); @@ -1261,26 +1261,26 @@ void Lucerna::clock_lucerna() { // ...Clock. TimeDate t; _vm->_system->getTimeAndDate(t); - _vm->_gyro->hour = t.tm_hour; - _vm->_gyro->minutes = t.tm_min; - _vm->_gyro->seconds = t.tm_sec; + _vm->_gyro->_hours = t.tm_hour; + _vm->_gyro->_minutes = t.tm_min; + _vm->_gyro->_seconds = t.tm_sec; - nh = (_vm->_gyro->hour % 12) * 30 + _vm->_gyro->minutes / 2; + nh = (_vm->_gyro->_hours % 12) * 30 + _vm->_gyro->_minutes / 2; - if (_vm->_gyro->oh != _vm->_gyro->hour) { + if (_vm->_gyro->_oh != _vm->_gyro->_hours) { plothands(); chime(); } - if (_vm->_gyro->om != _vm->_gyro->minutes) + if (_vm->_gyro->_om != _vm->_gyro->_minutes) plothands(); - if ((_vm->_gyro->hour == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) + if ((_vm->_gyro->_hours == 0) && (_vm->_gyro->_oh != 0) && (_vm->_gyro->_oh != 17717)) _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); - _vm->_gyro->oh = _vm->_gyro->hour; - _vm->_gyro->onh = nh; - _vm->_gyro->om = _vm->_gyro->minutes; + _vm->_gyro->_oh = _vm->_gyro->_hours; + _vm->_gyro->_onh = nh; + _vm->_gyro->_om = _vm->_gyro->_minutes; } @@ -1296,7 +1296,7 @@ void Lucerna::delavvy() { } void Lucerna::gameover() { - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; int16 sx = _vm->_trip->tr[0].x; int16 sy = _vm->_trip->tr[0].y; @@ -1308,7 +1308,7 @@ void Lucerna::gameover() { _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); - _vm->_gyro->alive = false; + _vm->_gyro->_alive = false; } /* OK. There are two kinds of redraw: Major and Minor. Minor is what happens @@ -1317,15 +1317,15 @@ void Lucerna::gameover() { void Lucerna::minor_redraw() { dusk(); - enterroom(_vm->_gyro->dna.room, 0); // Ped unknown or non-existant. + enterroom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant. for (byte fv = 0; fv <= 1; fv++) { - _vm->_gyro->cp = 1 - _vm->_gyro->cp; + _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; _vm->_trip->getback(); } for (byte i = 0; i < 3; i++) - _vm->_gyro->lastscore[i] = -1; // impossible digits + _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits showscore(); dawn(); @@ -1340,15 +1340,15 @@ uint16 Lucerna::bearing(byte whichped) { const double rad2deg = 180 / 3.14; // Pi - if (_vm->_trip->tr[0].x == _vm->_gyro->peds[whichped].x) + if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[whichped]._x) return 0; else { - if (_vm->_trip->tr[0].x < _vm->_gyro->peds[whichped].x) { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 90; + if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[whichped]._x) { + return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 90; } else { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 270; + return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 270; } } } @@ -1358,18 +1358,18 @@ void Lucerna::sprite_run() { sprites are still. It performs two fast cycles, only using a few of the links usually used, and without any extra animation. This should make the sprites the same on both pages. */ - _vm->_gyro->doing_sprite_run = true; + _vm->_gyro->_doingSpriteRun = true; _vm->_trip->get_back_loretta(); _vm->_trip->trippancy_link(); - _vm->_gyro->doing_sprite_run = false; + _vm->_gyro->_doingSpriteRun = false; } void Lucerna::fix_flashers() { - _vm->_gyro->ledstatus = 177; - _vm->_gyro->oldrw = 177; + _vm->_gyro->_ledStatus = 177; + _vm->_gyro->_oldDirection = 177; _vm->_scrolls->state(2); showrw(); } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index cecafcfb4ed9..5b72ee1289ab 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -96,7 +96,7 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F5: { _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callVerb(_vm->_gyro->f5_does()[0]); + _vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); } break; case Common::KEYCODE_F7: @@ -108,14 +108,13 @@ void Parser::handleFunctionKey(const Common::Event &event) { } void Parser::plotText() { - if (_vm->_gyro->mouse_near_text()) - CursorMan.showMouse(false); + CursorMan.showMouse(false); cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, kColorWhite); + _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -151,25 +150,24 @@ void Parser::drawCursor() { for (byte bit = 0; bit < 8; bit++) *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; - bytefield bf; - bf.x1 = _inputTextPos + 1; - bf.x2 = _inputTextPos + 2; - bf.y1 = 168; - bf.y2 = 168; + ByteField bf; + bf._x1 = _inputTextPos + 1; + bf._x2 = _inputTextPos + 2; + bf._y1 = 168; + bf._y2 = 168; for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(bf); } void Parser::wipeText() { - if (_vm->_gyro->mouse_near_text()) - CursorMan.showMouse(false); - + CursorMan.showMouse(false); cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. _quote = true; _inputTextPos = 0; + cursorOn(); CursorMan.showMouse(true); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 350e9f7bfe78..1392454663e6 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -54,7 +54,7 @@ void Scrolls::init() { } void Scrolls::state(byte x) { // Sets "Ready" light to whatever - if (_vm->_gyro->ledstatus == x) + if (_vm->_gyro->_ledStatus == x) return; // Already like that! byte color = kColorBlack; @@ -75,7 +75,7 @@ void Scrolls::state(byte x) { // Sets "Ready" light to whatever _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); - _vm->_gyro->ledstatus = x; + _vm->_gyro->_ledStatus = x; } void Scrolls::easteregg() { @@ -120,10 +120,10 @@ void Scrolls::normscroll() { Common::String e = "(c) 1994"; state(3); - _vm->_gyro->seescroll = true; + _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); - _vm->_gyro->newpointer(4); - _vm->_lucerna->mousepage(1 - _vm->_gyro->cp); + _vm->_gyro->newMouse(4); + _vm->_lucerna->mousepage(1 - _vm->_gyro->_cp); @@ -184,8 +184,8 @@ void Scrolls::normscroll() { #endif state(0); - _vm->_gyro->seescroll = false; - _vm->_lucerna->mousepage(_vm->_gyro->cp); + _vm->_gyro->_seeScroll = false; + _vm->_lucerna->mousepage(_vm->_gyro->_cp); CursorMan.showMouse(false); _vm->_lucerna->holdLeftMouse = false; // Used in Lucerna::checkclick(). @@ -220,19 +220,19 @@ bool Scrolls::they_match(TuneType &played) { void Scrolls::music_scroll() { state(3); - _vm->_gyro->seescroll = true; - _vm->_gyro->on(); - _vm->_gyro->newpointer(4); + _vm->_gyro->_seeScroll = true; + CursorMan.showMouse(true); + _vm->_gyro->newMouse(4); // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. // For now we act like the player just played the right tone. #if 0 if (they_match(played)) { #endif - _vm->_gyro->screturn = true; - _vm->_gyro->off(); + _vm->_gyro->_scReturn = true; + CursorMan.showMouse(false); state(0); - _vm->_gyro->seescroll = false; + _vm->_gyro->_seeScroll = false; _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up); warning("STUB: Scrolls::music_scroll()"); @@ -241,7 +241,7 @@ void Scrolls::music_scroll() { } _vm->_gyro->screturn = false; - _vm->_gyro->off(); + CursorMan.showMouse(false); state(0); _vm->_gyro->seescroll = false; #endif @@ -250,25 +250,25 @@ void Scrolls::music_scroll() { // ThatsAll, so put us back to $F- void Scrolls::resetscrolldriver() { // phew - _vm->_gyro->scrollbells = 0; + _vm->_gyro->_scrollBells = 0; cfont = roman; use_icon = 0; _vm->_gyro->_interrogation = 0; // always reset after a scroll comes up. } void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little... - for (byte fv = 0; fv < _vm->_gyro->scrollbells; fv++) + for (byte fv = 0; fv < _vm->_gyro->_scrollBells; fv++) _vm->_lucerna->errorled(); // ring the bell "x" times } void Scrolls::dodgem() { dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(dodgeCoord.x, _vm->_gyro->underscroll); // Move the pointer off the scroll. + g_system->warpMouse(dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. } void Scrolls::undodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->underscroll)) + if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) g_system->warpMouse(dodgeCoord.x, dodgeCoord.y); // No change, so restore the pointer's original position. } @@ -334,9 +334,9 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! lx = 0; - ly = (_vm->_gyro->scrolln) * 6; - for (b = 0; b < _vm->_gyro->scrolln; b++) { - ex = _vm->_gyro->scroll[b].size() * 8; + ly = (_vm->_gyro->_scrollNum) * 6; + for (b = 0; b < _vm->_gyro->_scrollNum; b++) { + ex = _vm->_gyro->_scroll[b].size() * 8; if (lx < ex) lx = ex; } @@ -406,51 +406,51 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t } - for (b = 0; b < _vm->_gyro->scrolln; b++) { - if (!_vm->_gyro->scroll[b].empty()) - switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) { + for (b = 0; b < _vm->_gyro->_scrollNum; b++) { + if (!_vm->_gyro->_scroll[b].empty()) + switch (_vm->_gyro->_scroll[b][_vm->_gyro->_scroll[b].size() - 1]) { case kControlCenter: { centre = true; - _vm->_gyro->scroll[b].deleteLastChar(); + _vm->_gyro->_scroll[b].deleteLastChar(); } break; case kControlLeftJustified: { centre = false; - _vm->_gyro->scroll[b].deleteLastChar(); + _vm->_gyro->_scroll[b].deleteLastChar(); } break; case kControlQuestion: { //settextjustify(1, 1); dix = mx + lx; diy = my + ly; - _vm->_gyro->scroll[b].setChar(' ', 0); + _vm->_gyro->_scroll[b].setChar(' ', 0); // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); - _vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); - _vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + _vm->_gyro->shadowBox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); + _vm->_gyro->shadowBox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); } break; } if (centre) - say(320 - _vm->_gyro->scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->scroll[b]); + say(320 - _vm->_gyro->_scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->_scroll[b]); else - say(mx + icon_indent, my, _vm->_gyro->scroll[b]); + say(mx + icon_indent, my, _vm->_gyro->_scroll[b]); my += 12; } - _vm->_gyro->underscroll = my * 2 + 6; // Multiplying because of the doubled screen height. + _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. //setvisualpage(1 - cp); dingdongbell(); //my = getpixel(0, 0); - _vm->_gyro->dropsok = false; + _vm->_gyro->_dropsOk = false; dodgem(); (this->*gotoit)(); undodgem(); - _vm->_gyro->dropsok = true; + _vm->_gyro->_dropsOk = true; //setvisualpage(cp); //mousepage(cp); CursorMan.showMouse(false); @@ -481,9 +481,9 @@ void Scrolls::bubble(func2 gotoit) { CursorMan.showMouse(false); xl = 0; - yl = _vm->_gyro->scrolln * 5; - for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { - uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8; + yl = _vm->_gyro->_scrollNum * 5; + for (byte fv = 0; fv < _vm->_gyro->_scrollNum; fv++) { + uint16 textWidth = _vm->_gyro->_scroll[fv].size() * 8; if (textWidth > xl) xl = textWidth; } @@ -494,36 +494,36 @@ void Scrolls::bubble(func2 gotoit) { my = yw * 2 - 2; xc = 0; - if ((_vm->_gyro->talkx - xw) < 0) - xc = -(_vm->_gyro->talkx - xw); - if ((_vm->_gyro->talkx + xw) > 639) - xc = 639 - (_vm->_gyro->talkx + xw); + if ((_vm->_gyro->_talkX - xw) < 0) + xc = -(_vm->_gyro->_talkX - xw); + if ((_vm->_gyro->_talkX + xw) > 639) + xc = 639 - (_vm->_gyro->_talkX + xw); - p[0].x = _vm->_gyro->talkx - 10; + p[0].x = _vm->_gyro->_talkX - 10; p[0].y = yw; - p[1].x = _vm->_gyro->talkx + 10; + p[1].x = _vm->_gyro->_talkX + 10; p[1].y = yw; - p[2].x = _vm->_gyro->talkx; - p[2].y = _vm->_gyro->talky; + p[2].x = _vm->_gyro->_talkX; + p[2].y = _vm->_gyro->_talkY; // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw + 9, 7, _vm->_gyro->talkx + xw - 8 + xc, my + 1), _vm->_gyro->talkb); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw - 1, 12, _vm->_gyro->talkx + xw + xc + 2, my - 4), _vm->_gyro->talkb); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw + 9, 7, _vm->_gyro->_talkX + xw - 8 + xc, my + 1), _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw - 1, 12, _vm->_gyro->_talkX + xw + xc + 2, my - 4), _vm->_gyro->_talkBackgroundColor); // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, 11, 0, 90, 9, _vm->_gyro->talkb); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, 11, 0, 90, 9, _vm->_gyro->_talkBackgroundColor); // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->talkb); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->_talkBackgroundColor); // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, 11, 90, 180, 9, _vm->_gyro->talkb); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, 11, 90, 180, 9, _vm->_gyro->_talkBackgroundColor); // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->talkb); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->talkb); + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->_talkBackgroundColor); yl -= 3; @@ -531,30 +531,30 @@ void Scrolls::bubble(func2 gotoit) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { - int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; - bool offset = _vm->_gyro->scroll[fv].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); + for (byte fv = 0; fv < _vm->_gyro->_scrollNum; fv++) { + int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[fv].size() / 2 * 8; + bool offset = _vm->_gyro->_scroll[fv].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[fv], _vm->_gyro->_font, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->_talkFontColor); } //setvisualpage(1 - cp); dingdongbell(); _vm->_gyro->_onCanDoPageSwap = false; CursorMan.showMouse(true); - _vm->_gyro->dropsok = false; + _vm->_gyro->_dropsOk = false; // This does the actual drawing to the screen. (this->*gotoit)(); CursorMan.showMouse(false); - _vm->_gyro->dropsok = true; + _vm->_gyro->_dropsOk = true; //setvisualpage(cp); CursorMan.showMouse(true); // sink; _vm->_gyro->_onCanDoPageSwap = true; resetscrolldriver(); - if (_vm->_gyro->mpress > 0) - _vm->_gyro->after_the_scroll = true; + /*if (_vm->_gyro->mpress > 0) + _vm->_gyro->after_the_scroll = true;*/ } bool Scrolls::ask(Common::String question) { @@ -563,35 +563,35 @@ bool Scrolls::ask(Common::String question) { } void Scrolls::resetscroll() { - _vm->_gyro->scrolln = 1; + _vm->_gyro->_scrollNum = 1; for (int j = 0; j < 15; j++) - if (!_vm->_gyro->scroll[j].empty()) - _vm->_gyro->scroll[j].clear(); + if (!_vm->_gyro->_scroll[j].empty()) + _vm->_gyro->_scroll[j].clear(); } void Scrolls::natural() { // Natural state of bubbles - _vm->_gyro->talkx = 320; - _vm->_gyro->talky = 200; - _vm->_gyro->talkb = 8; - _vm->_gyro->talkf = 15; + _vm->_gyro->_talkX = 320; + _vm->_gyro->_talkY = 200; + _vm->_gyro->_talkBackgroundColor = 8; + _vm->_gyro->_talkFontColor = 15; } Common::String Scrolls::lsd() { Common::String x; - if (_vm->_gyro->dna.pence < 12) { // just pence - x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd'; - } else if (_vm->_gyro->dna.pence < 240) { // shillings & pence - x = _vm->_gyro->strf(_vm->_gyro->dna.pence / 12) + '/'; - if ((_vm->_gyro->dna.pence % 12) == 0) + if (_vm->_gyro->_dna._money < 12) { // just pence + x = _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + 'd'; + } else if (_vm->_gyro->_dna._money < 240) { // shillings & pence + x = _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 12) + '/'; + if ((_vm->_gyro->_dna._money % 12) == 0) x = x + '-'; else - x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12); + x = x + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); } else // L, s & d - x = Common::String('') + _vm->_gyro->strf(_vm->_gyro->dna.pence / 240) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / 12) % 20) - + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12); - if (_vm->_gyro->dna.pence > 12) - x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)"; + x = Common::String('') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); + if (_vm->_gyro->_dna._money > 12) + x = x + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; return x; } @@ -606,16 +606,16 @@ void Scrolls::strip(Common::String &q) { } void Scrolls::solidify(byte n) { - if (!_vm->_gyro->scroll[n].contains(' ')) + if (!_vm->_gyro->_scroll[n].contains(' ')) return; // No spaces. // So there MUST be a space there, somewhere... do { - _vm->_gyro->scroll[n + 1] = _vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] + _vm->_gyro->scroll[n + 1]; - _vm->_gyro->scroll[n].deleteLastChar(); - } while (_vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] != ' '); + _vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; + _vm->_gyro->_scroll[n].deleteLastChar(); + } while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); - strip(_vm->_gyro->scroll[n]); + strip(_vm->_gyro->_scroll[n]); } void Scrolls::calldrivers() { @@ -630,39 +630,39 @@ void Scrolls::calldrivers() { warning("STUB: Scrolls::calldrivers()"); state(0); - _vm->_gyro->screturn = false; + _vm->_gyro->_scReturn = false; mouthnext = false; call_spriterun = true; - switch (_vm->_gyro->buffer[_vm->_gyro->bufsize - 1]) { + switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { case kControlToBuffer: - _vm->_gyro->bufsize--; + _vm->_gyro->_bufSize--; break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: { - _vm->_gyro->bufsize++; - _vm->_gyro->buffer[_vm->_gyro->bufsize - 1] = kControlParagraph; + _vm->_gyro->_bufSize++; + _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = kControlParagraph; } } - uint16 size = _vm->_gyro->bufsize; + uint16 size = _vm->_gyro->_bufSize; for (fv = 0; fv < size; fv++) { if (mouthnext) { - if (_vm->_gyro->buffer[fv] == kControlRegister) + if (_vm->_gyro->_buffer[fv] == kControlRegister) param = 0; - else if (('0' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= '9')) - param = _vm->_gyro->buffer[fv] - 48; - else if (('A' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= 'Z')) - param = _vm->_gyro->buffer[fv] - 55; + else if (('0' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= '9')) + param = _vm->_gyro->_buffer[fv] - 48; + else if (('A' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= 'Z')) + param = _vm->_gyro->_buffer[fv] - 55; mouthnext = false; } else { - switch (_vm->_gyro->buffer[fv]) { + switch (_vm->_gyro->_buffer[fv]) { case kControlParagraph: { - if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty())) + if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; if (call_spriterun) @@ -673,15 +673,15 @@ void Scrolls::calldrivers() { resetscroll(); - if (_vm->_gyro->screturn) + if (_vm->_gyro->_scReturn) return; } break; case kControlBell: - _vm->_gyro->scrollbells++; + _vm->_gyro->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: { - if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty())) + if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; if (call_spriterun) @@ -700,11 +700,11 @@ void Scrolls::calldrivers() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - _vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->kQuasipeds[param - 10].whichped - 1].x; - _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->kQuasipeds[param - 10].whichped - 1].y; // Position. + _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._x; + _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._y; // Position. - _vm->_gyro->talkf = _vm->_gyro->kQuasipeds[param - 10].fgc; - _vm->_gyro->talkb = _vm->_gyro->kQuasipeds[param - 10].bgc; // Colors. + _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[param - 10]._foregroundColor; + _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[param - 10]._backgroundColor; // Colors. } else { _vm->_lucerna->errorled(); // Not valid. natural(); @@ -714,7 +714,7 @@ void Scrolls::calldrivers() { resetscroll(); - if (_vm->_gyro->screturn) + if (_vm->_gyro->_scReturn) return; } break; @@ -724,29 +724,29 @@ void Scrolls::calldrivers() { display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: - display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->dna.pass_num]._word + kControlToBuffer); + display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum]._word + kControlToBuffer); break; case 3: - display(_vm->_gyro->dna.like2drink + kControlToBuffer); + display(_vm->_gyro->_dna._favouriteDrink + kControlToBuffer); break; case 4: - display(_vm->_gyro->dna.favourite_song + kControlToBuffer); + display(_vm->_gyro->_dna._favouriteSong + kControlToBuffer); break; case 5: - display(_vm->_gyro->dna.worst_place_on_earth + kControlToBuffer); + display(_vm->_gyro->_dna._worstPlaceOnEarth + kControlToBuffer); break; case 6: - display(_vm->_gyro->dna.spare_evening + kControlToBuffer); + display(_vm->_gyro->_dna._spareEvening + kControlToBuffer); break; case 9: - display(_vm->_gyro->strf(_vm->_gyro->dna.cat_x) + ',' + _vm->_gyro->strf(_vm->_gyro->dna.cat_y) + kControlToBuffer); + display(_vm->_gyro->intToStr(_vm->_gyro->_dna._catacombX) + ',' + _vm->_gyro->intToStr(_vm->_gyro->_dna._catacombY) + kControlToBuffer); break; case 10: - switch (_vm->_gyro->dna.box_contents) { + switch (_vm->_gyro->_dna._boxContent) { case 0: { // Sixpence. _vm->_visa->dixi('q', 37); // You find the sixpence. - _vm->_gyro->dna.pence += 6; - _vm->_gyro->dna.box_contents = _vm->_acci->kNothing; + _vm->_gyro->_dna._money += 6; + _vm->_gyro->_dna._boxContent = _vm->_acci->kNothing; _vm->_lucerna->points(2); return; } @@ -755,15 +755,15 @@ void Scrolls::calldrivers() { display("nothing at all. It's completely empty."); break; default: - display(_vm->_gyro->get_better(_vm->_gyro->dna.box_contents) + '.'); + display(_vm->_gyro->getItem(_vm->_gyro->_dna._boxContent) + '.'); } break; case 11: nn = 1; - for (byte nnn = 0; nnn < numobjs; nnn++) { - if (_vm->_gyro->dna.obj[nnn]) { + for (byte nnn = 0; nnn < kObjectNum; nnn++) { + if (_vm->_gyro->_dna._objects[nnn]) { nn++; - display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); + display(_vm->_gyro->getItem(nnn) + ", " + kControlToBuffer); } } break; @@ -773,15 +773,15 @@ void Scrolls::calldrivers() { use_icon = param; break; case kControlNewLine: - _vm->_gyro->scrolln++; + _vm->_gyro->_scrollNum++; break; case kControlQuestion: { if (call_spriterun) _vm->_lucerna->sprite_run(); call_spriterun = false; - _vm->_gyro->scrolln++; - _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] = kControlQuestion; + _vm->_gyro->_scrollNum++; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion; drawscroll(&Avalanche::Scrolls::dialogue); @@ -793,14 +793,14 @@ void Scrolls::calldrivers() { break; case kControlInsertSpaces: for (nn = 0; nn < 9; nn++) - _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += ' '; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; break; default: { // Add new char. - if (_vm->_gyro->scroll[_vm->_gyro->scrolln - 1].size() == 50) { - solidify(_vm->_gyro->scrolln - 1); - _vm->_gyro->scrolln++; + if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { + solidify(_vm->_gyro->_scrollNum - 1); + _vm->_gyro->_scrollNum++; } - _vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += _vm->_gyro->buffer[fv]; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[fv]; } } } @@ -808,8 +808,8 @@ void Scrolls::calldrivers() { } void Scrolls::display(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_gyro->bufsize = z.size(); - memcpy(_vm->_gyro->buffer, z.c_str(), _vm->_gyro->bufsize); + _vm->_gyro->_bufSize = z.size(); + memcpy(_vm->_gyro->_buffer, z.c_str(), _vm->_gyro->_bufSize); calldrivers(); } @@ -837,7 +837,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(_vm->_gyro->characters[i],16); + f.read(_vm->_gyro->_font[i],16); f.close(); } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 315646685a8a..15759bd1c0ed 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -65,8 +65,8 @@ void Sequence::then_show(byte what) { void Sequence::then_flip(byte where, byte ped) { then_show(now_flip); - _vm->_gyro->dna.flip_to_where = where; - _vm->_gyro->dna.flip_to_ped = ped; + _vm->_gyro->_dna._flipToWhere = where; + _vm->_gyro->_dna._flipToPed = ped; } void Sequence::start_to_close() { @@ -75,7 +75,7 @@ void Sequence::start_to_close() { } void Sequence::start_to_open() { - _vm->_gyro->dna.user_moves_avvy = false; // They can't move. + _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. _vm->_trip->stopwalking(); // And they're not moving now. start_to_close(); // Apart from that, it's the same thing. } @@ -93,8 +93,8 @@ void Sequence::call_sequencer() { return; // No more routines. break; case 177: // Flip room. - _vm->_gyro->dna.user_moves_avvy = true; - _vm->_trip->fliproom(_vm->_gyro->dna.flip_to_where, _vm->_gyro->dna.flip_to_ped); + _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_trip->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); if (seq[0] == 177) shove_left(); break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 5c4b60b701cf..dbb4f80acd70 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -73,7 +73,7 @@ void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { } void Timeout::one_tick() { - if (_vm->_gyro->ddmnow) + if (_vm->_gyro->_dropdownActive) return; for (byte fv = 0; fv < 7; fv++) { @@ -209,8 +209,8 @@ void Timeout::one_tick() { } } } - _vm->_gyro->roomtime++; // Cycles since you've been in this room. - _vm->_gyro->dna.total_time++; // Total amount of time for this game. + _vm->_gyro->_roomTime++; // Cycles since you've been in this room. + _vm->_gyro->_dna._totalTime++; // Total amount of time for this game. } void Timeout::lose_timer(byte which) { @@ -223,20 +223,20 @@ void Timeout::lose_timer(byte which) { } void Timeout::open_drawbridge() { - _vm->_gyro->dna.drawbridge_open++; - _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); + _vm->_gyro->_dna._drawbridgeOpen++; + _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_dna._drawbridgeOpen - 1); - if (_vm->_gyro->dna.drawbridge_open == 4) - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. + if (_vm->_gyro->_dna._drawbridgeOpen == 4) + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } void Timeout::avaricius_talks() { - _vm->_visa->dixi('q', _vm->_gyro->dna.avaricius_talk); - _vm->_gyro->dna.avaricius_talk++; + _vm->_visa->dixi('q', _vm->_gyro->_dna._avariciusTalk); + _vm->_gyro->_dna._avariciusTalk++; - if (_vm->_gyro->dna.avaricius_talk < 17) + if (_vm->_gyro->_dna._avariciusTalk < 17) set_up_timer(177, procavaricius_talks, reason_avariciustalks); else _vm->_lucerna->points(3); @@ -266,21 +266,21 @@ void Timeout::stairs() { _vm->_gyro->blip(); _vm->_trip->tr[0].walkto(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->dna.brummie_stairs = 2; - _vm->_gyro->magics[10].op = _vm->_gyro->kMagicSpecial; - _vm->_gyro->magics[10].data = 2; // Reached the bottom of the stairs. - _vm->_gyro->magics[3].op = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_gyro->_dna._brummieStairs = 2; + _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; + _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. + _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timeout::cardiff_survey() { - if (_vm->_gyro->dna.cardiff_things == 0) { - _vm->_gyro->dna.cardiff_things++; + if (_vm->_gyro->_dna._cardiffQuestionNum == 0) { + _vm->_gyro->_dna._cardiffQuestionNum++; _vm->_visa->dixi('q', 27); } - _vm->_visa->dixi('z', _vm->_gyro->dna.cardiff_things); + _vm->_visa->dixi('z', _vm->_gyro->_dna._cardiffQuestionNum); - _vm->_gyro->_interrogation = _vm->_gyro->dna.cardiff_things; + _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } @@ -296,8 +296,8 @@ void Timeout::cwytalot_in_herts() { void Timeout::get_tied_up() { _vm->_visa->dixi('q', 34); // ...Trouble! - _vm->_gyro->dna.user_moves_avvy = false; - _vm->_gyro->dna.been_tied_up = true; + _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_dna._beenTiedUp = true; _vm->_trip->stopwalking(); _vm->_trip->tr[1].stopwalk(); _vm->_trip->tr[1].stophoming(); @@ -309,14 +309,14 @@ void Timeout::get_tied_up() { void Timeout::get_tied_up2() { _vm->_trip->tr[0].walkto(4); _vm->_trip->tr[1].walkto(5); - _vm->_gyro->magics[3].op = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. - _vm->_gyro->dna.friar_will_tie_you_up = true; + _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. + _vm->_gyro->_dna._friarWillTieYouUp = true; } void Timeout::hang_around() { _vm->_trip->tr[1].check_me = false; _vm->_trip->tr[0].init(7, true, _vm->_trip); // Robin Hood - _vm->_gyro->_whereIs[_vm->_gyro->probinhood - 150] = r__robins; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; _vm->_trip->apped(1, 2); _vm->_visa->dixi('q', 39); _vm->_trip->tr[0].walkto(7); @@ -327,7 +327,7 @@ void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); _vm->_trip->tr[1].vanishifstill = false; _vm->_trip->tr[1].walkto(4); - _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = r__robins; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->dixi('q', 41); _vm->_trip->tr[0].done(); _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. @@ -335,20 +335,20 @@ void Timeout::hang_around2() { set_up_timer(1, procafter_the_shootemup, reason_hanging_around); // Immediately call the following proc (when you have a chance). - _vm->_gyro->dna.tied_up = false; + _vm->_gyro->_dna._tiedUp = false; _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. } void Timeout::after_the_shootemup() { - _vm->_trip->fliproom(_vm->_gyro->dna.room, 0); + _vm->_trip->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->_trip->tr[0].init(0, true, _vm->_trip); // Avalot. _vm->_trip->apped(1, 2); - _vm->_gyro->dna.user_moves_avvy = true; - _vm->_gyro->dna.obj[_vm->_gyro->crossbow - 1] = true; + _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; _vm->_lucerna->objectlist(); // Same as the added line above: TODO: Remove it later!!! @@ -377,9 +377,9 @@ void Timeout::after_the_shootemup() { } void Timeout::jacques_wakes_up() { - _vm->_gyro->dna.jacques_awake++; + _vm->_gyro->_dna._jacquesState++; - switch (_vm->_gyro->dna.jacques_awake) { // Additional pictures. + switch (_vm->_gyro->_dna._jacquesState) { // Additional pictures. case 1 : _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. _vm->_visa->dixi('Q', 45); @@ -387,22 +387,22 @@ void Timeout::jacques_wakes_up() { case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // You can't wake him up now. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. - _vm->_gyro->_whereIs[_vm->_gyro->pjacques - 150] = 0; // Gone! + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleJacques - 150] = 0; // Gone! break; } - if (_vm->_gyro->dna.jacques_awake == 5) { - _vm->_gyro->dna.ringing_bells = true; - _vm->_gyro->dna.ayles_is_awake = true; + if (_vm->_gyro->_dna._jacquesState == 5) { + _vm->_gyro->_dna._bellsAreRinging = true; + _vm->_gyro->_dna._aylesIsAwake = true; _vm->_lucerna->points(2); } - switch (_vm->_gyro->dna.jacques_awake) { + switch (_vm->_gyro->_dna._jacquesState) { case 1: case 2: case 3: @@ -441,9 +441,9 @@ void Timeout::naughty_duke3() { } void Timeout::jump() { - _vm->_gyro->dna.jumpstatus++; + _vm->_gyro->_dna._jumpStatus++; - switch (_vm->_gyro->dna.jumpstatus) { + switch (_vm->_gyro->_dna._jumpStatus) { case 1: case 2: case 3: @@ -462,24 +462,24 @@ void Timeout::jump() { break; } - if (_vm->_gyro->dna.jumpstatus == 20) { // End of jump. - _vm->_gyro->dna.user_moves_avvy = true; - _vm->_gyro->dna.jumpstatus = 0; + if (_vm->_gyro->_dna._jumpStatus == 20) { // End of jump. + _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_dna._jumpStatus = 0; } else { // Still jumping. set_up_timer(1, procjump, reason_jumping); } - if ((_vm->_gyro->dna.jumpstatus == 10) // You're at the highest point of your jump. - && (_vm->_gyro->dna.room == r__insidecardiffcastle) - && (_vm->_gyro->dna.arrow_in_the_door == true) + if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. + && (_vm->_gyro->_dna._room == r__insidecardiffcastle) + && (_vm->_gyro->_dna._arrowInTheDoor == true) && (_vm->_trip->infield(3))) { // Beside the wall // Grab the arrow! - if (_vm->_gyro->dna.carrying >= maxobjs) + if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->dna.arrow_in_the_door = false; // You've got it. - _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; + _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = true; _vm->_lucerna->objectlist(); _vm->_visa->dixi('q', 50); _vm->_lucerna->points(3); @@ -489,32 +489,32 @@ void Timeout::jump() { void Timeout::crapulus_says_splud_out() { _vm->_visa->dixi('q', 56); - _vm->_gyro->dna.crapulus_will_tell = false; + _vm->_gyro->_dna._crapulusWillTell = false; } void Timeout::buydrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. - _vm->_gyro->dna.malagauche = 0; + _vm->_gyro->_dna._malagauche = 0; - _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); // Display message about it. + _vm->_visa->dixi('D', _vm->_gyro->_dna._drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_visa->dixi('D', 1); // That'll be thruppence. - if (_vm->_gyro->pennycheck(3)) // Pay 3d. + if (_vm->_gyro->updateMoney(3)) // Pay 3d. _vm->_visa->dixi('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } void Timeout::buywine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. - _vm->_gyro->dna.malagauche = 0; + _vm->_gyro->_dna._malagauche = 0; _vm->_visa->dixi('D', 50); // You buy the wine. _vm->_visa->dixi('D', 1); // It'll be thruppence. - if (_vm->_gyro->pennycheck(3)) { + if (_vm->_gyro->updateMoney(3)) { _vm->_visa->dixi('D', 4); // You paid up. - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = true; _vm->_lucerna->objectlist(); - _vm->_gyro->dna.winestate = 1; // OK Wine. + _vm->_gyro->_dna._wineState = 1; // OK Wine. } } @@ -525,24 +525,24 @@ void Timeout::callsguards() { void Timeout::greetsmonk() { _vm->_visa->dixi('Q', 59); - _vm->_gyro->dna.entered_lusties_room_as_monk = true; + _vm->_gyro->_dna._enteredLustiesRoomAsMonk = true; } void Timeout::fall_down_oubliette() { - _vm->_gyro->magics[8].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; _vm->_trip->tr[0].iy++; // Increments dx/dy! _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } void Timeout::meet_avaroid() { - if (_vm->_gyro->dna.met_avaroid) { + if (_vm->_gyro->_dna._metAvaroid) { _vm->_scrolls->display(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); _vm->_lucerna->gameover(); } else { _vm->_visa->dixi('Q', 60); - _vm->_gyro->dna.met_avaroid = true; + _vm->_gyro->_dna._metAvaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); _vm->_trip->tr[0].face = _vm->_trip->left; @@ -550,7 +550,7 @@ void Timeout::meet_avaroid() { _vm->_trip->tr[0].ix = -3; _vm->_trip->tr[0].iy = -5; - _vm->_gyro->background(2); + _vm->_gyro->setBackgroundColor(2); } } @@ -561,7 +561,7 @@ void Timeout::rise_up_oubliette() { if (_vm->_trip->tr[0].iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else - _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::robin_hood_and_geida() { @@ -571,7 +571,7 @@ void Timeout::robin_hood_and_geida() { _vm->_trip->tr[1].stopwalk(); _vm->_trip->tr[1].face = _vm->_trip->left; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); - _vm->_gyro->dna.geida_follows = false; + _vm->_gyro->_dna._geidaFollows = false; } void Timeout::robin_hood_and_geida_talk() { @@ -589,7 +589,7 @@ void Timeout::avalot_returns() { _vm->_trip->tr[0].init(0, true, _vm->_trip); _vm->_trip->apped(1, 1); _vm->_visa->dixi('q', 67); - _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::avvy_sit_down() { @@ -598,8 +598,8 @@ void Timeout::avvy_sit_down() { set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->dna.sitting_in_pub = true; - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._sittingInPub = true; + _vm->_gyro->_dna._userMovesAvvy = false; _vm->_trip->tr[0].visible = false; } } @@ -610,7 +610,7 @@ void Timeout::ghost_room_phew() { } void Timeout::arkata_shouts() { - if (_vm->_gyro->dna.teetotal) + if (_vm->_gyro->_dna._teetotal) return; _vm->_visa->dixi('q', 76); @@ -632,7 +632,7 @@ void Timeout::winning() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); _vm->_scrolls->display(" T H E E N D "); - _vm->_gyro->lmo = true; + _vm->_gyro->_letMeOut = true; } void Timeout::avalot_falls() { @@ -664,7 +664,7 @@ void Timeout::spludwick_leaves_cauldron() { void Timeout::give_lute_to_geida() { // Moved here from Acci. _vm->_visa->dixi('Q', 86); _vm->_lucerna->points(4); - _vm->_gyro->dna.lustie_is_asleep = true; + _vm->_gyro->_dna._lustieIsAsleep = true; _vm->_sequence->first_show(5); _vm->_sequence->then_show(6); // He falls asleep... _vm->_sequence->start_to_close(); // Not really closing, but we're using the same procedure. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 0e16c776ce4d..c514734fcb0e 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -162,8 +162,8 @@ void triptype::turn(byte whichway) { void triptype::appear(int16 wx, int16 wy, byte wf) { x = (wx / 8) * 8; y = wy; - ox[_tr->_vm->_gyro->cp] = wx; - oy[_tr->_vm->_gyro->cp] = wy; + ox[_tr->_vm->_gyro->_cp] = wx; + oy[_tr->_vm->_gyro->_cp] = wy; turn(wf); visible = true; ix = 0; @@ -183,23 +183,23 @@ bool triptype::collision_check() { void triptype::walk() { byte tc; - bytefield r; + ByteField r; if (visible) { - r.x1 = (x / 8) - 1; - if (r.x1 == 255) - r.x1 = 0; - r.y1 = y - 2; - r.x2 = ((x + _info._xLength) / 8) + 1; - r.y2 = y + _info._yLength + 2; + r._x1 = (x / 8) - 1; + if (r._x1 == 255) + r._x1 = 0; + r._y1 = y - 2; + r._x2 = ((x + _info._xLength) / 8) + 1; + r._y2 = y + _info._yLength + 2; - _tr->getset[1 - _tr->_vm->_gyro->cp].remember(r); + _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); } - if (!_tr->_vm->_gyro->doing_sprite_run) { - ox[_tr->_vm->_gyro->cp] = x; - oy[_tr->_vm->_gyro->cp] = y; + if (!_tr->_vm->_gyro->_doingSpriteRun) { + ox[_tr->_vm->_gyro->_cp] = x; + oy[_tr->_vm->_gyro->_cp] = y; if (homing) homestep(); x = x + ix; @@ -212,22 +212,22 @@ void triptype::walk() { return; } - tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->cp], y, _info._yLength) - 1; + tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->_cp], y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) { - switch (_tr->_vm->_gyro->magics[tc].op) { + if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { + switch (_tr->_vm->_gyro->_magics[tc]._operation) { case Gyro::kMagicExclaim: { bounce(); _tr->mustexclaim = true; - _tr->saywhat = _tr->_vm->_gyro->magics[tc].data; + _tr->saywhat = _tr->_vm->_gyro->_magics[tc]._data; } break; case Gyro::kMagicBounce: bounce(); break; case Gyro::kMagicTransport: - _tr->fliproom(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff); + _tr->fliproom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); break; case Gyro::kMagicUnfinished: { bounce(); @@ -235,16 +235,16 @@ void triptype::walk() { } break; case Gyro::kMagicSpecial: - _tr->call_special(_tr->_vm->_gyro->magics[tc].data); + _tr->call_special(_tr->_vm->_gyro->_magics[tc]._data); break; case Gyro::kMagicOpenDoor: - _tr->open_the_door(_tr->_vm->_gyro->magics[tc].data >> 8, _tr->_vm->_gyro->magics[tc].data & 0xff, tc); + _tr->open_the_door(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); break; } } } - if (!_tr->_vm->_gyro->doing_sprite_run) { + if (!_tr->_vm->_gyro->_doingSpriteRun) { count++; if (((ix != 0) || (iy != 0)) && (count > 1)) { step++; @@ -256,8 +256,8 @@ void triptype::walk() { } void triptype::bounce() { - x = ox[_tr->_vm->_gyro->cp]; - y = oy[_tr->_vm->_gyro->cp]; + x = ox[_tr->_vm->_gyro->_cp]; + y = oy[_tr->_vm->_gyro->_cp]; if (check_me) _tr->stopwalking(); else @@ -278,9 +278,9 @@ int8 triptype::sgn(int16 val) { void triptype::walkto(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. - speed(sgn(_tr->_vm->_gyro->peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro->peds[pednum].y - y)); - hx = _tr->_vm->_gyro->peds[pednum].x - _info._xLength / 2; - hy = _tr->_vm->_gyro->peds[pednum].y - _info._yLength; + speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - y)); + hx = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; + hy = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; homing = true; } @@ -344,10 +344,10 @@ void triptype::stopwalk() { } void triptype::chatter() { - _tr->_vm->_gyro->talkx = x + _info._xLength / 2; - _tr->_vm->_gyro->talky = y; - _tr->_vm->_gyro->talkf = a.fgc; - _tr->_vm->_gyro->talkb = a.bgc; + _tr->_vm->_gyro->_talkX = x + _info._xLength / 2; + _tr->_vm->_gyro->_talkY = y; + _tr->_vm->_gyro->_talkFontColor = a.fgc; + _tr->_vm->_gyro->_talkBackgroundColor = a.bgc; } void triptype::set_up_saver(trip_saver_type &v) { @@ -436,14 +436,14 @@ getsettype *getsettype::init() { return this; } -void getsettype::remember(bytefield r) { +void getsettype::remember(ByteField r) { numleft++; //if (numleft > maxgetset) // error("Trip::remember() : runerr_Getset_Overflow"); gs[numleft] = r; } -void getsettype::recall(bytefield &r) { +void getsettype::recall(ByteField &r) { r = gs[numleft]; numleft--; } @@ -540,8 +540,8 @@ void Trip::catamove(byte ped) { - xy_uint16 = _vm->_gyro->dna.cat_x + _vm->_gyro->dna.cat_y * 256; - _vm->_gyro->dna.geida_spin = 0; + xy_uint16 = _vm->_gyro->_dna._catacombX + _vm->_gyro->_dna._catacombY * 256; + _vm->_gyro->_dna._geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs @@ -558,78 +558,78 @@ void Trip::catamove(byte ped) { case 2307: fliproom(r__lusties, 5); _vm->_scrolls->display("Oh no... here we go again..."); - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; tr[0].iy = 1; tr[0].ix = 0; return; } - if (!_vm->_gyro->dna.enter_catacombs_from_lusties_room) + if (!_vm->_gyro->_dna._enterCatacombsFromLustiesRoom) _vm->_lucerna->load(29); - here = _vm->_gyro->kCatacombMap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1]; + here = _vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; case 0x1: // no connection (wall + shield), - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x2: // wall with door - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. break; case 0x3: // wall with door and shield - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x5: // wall with door and window - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicNothing; // No door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[4].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->magics[1].op = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->magics[2].op = _vm->_gyro->kMagicSpecial; // Straight wall. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. break; } @@ -637,52 +637,52 @@ void Trip::catamove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; case 0x1: // no connection (wall + window), - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x2: // wall with door - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. break; case 0x3: // wall with door and window - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // No door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->magics[5].op = _vm->_gyro->kMagicSpecial; // Straight wall. - _vm->_gyro->portals[6].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. break; } @@ -690,39 +690,39 @@ void Trip::catamove(byte ped) { switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; break; case 0x1: _vm->_celer->drawBackgroundSprite(-1, -1, 22); - if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) - _vm->_gyro->magics[12].op = _vm->_gyro->kMagicExclaim; + if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicExclaim; else - _vm->_gyro->magics[12].op = _vm->_gyro->kMagicSpecial; // Right exit south. + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicSpecial; // Right exit south. - _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; break; case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->magics[6].op = _vm->_gyro->kMagicSpecial; // Middle exit south. - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicSpecial; // Middle exit south. + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; break; case 0x3: _vm->_celer->drawBackgroundSprite(-1, -1, 24); - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicSpecial; // Left exit south. - _vm->_gyro->magics[6].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->magics[12].op = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicSpecial; // Left exit south. + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. break; // LEFT handles: #if 0 @@ -734,8 +734,8 @@ void Trip::catamove(byte ped) { #endif case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. break; #if 0 case 0x3: @@ -752,8 +752,8 @@ void Trip::catamove(byte ped) { #endif case 0x5: _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. break; #if 0 case 0x6: @@ -773,26 +773,26 @@ void Trip::catamove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer->drawBackgroundSprite(-1, -1, 32); - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicSpecial; // Middle arch north. - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicSpecial; // Middle arch north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. } break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; case 0xe: // No connection + TORCH - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicBounce; - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; // Recessed door: case 0xf: - _vm->_gyro->magics[0].op = _vm->_gyro->kMagicNothing; // Door to Geida's room. + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicNothing; // Door to Geida's room. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->portals[3].op = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. break; } @@ -828,7 +828,7 @@ void Trip::catamove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_gyro->dna.geida_follows) && (ped > 0)) { + if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { if (!tr[1].quick) // If we don't already have her... tr[1].init(5, true, this); // ...Load Geida. apped(2, geida_ped(ped)); @@ -848,27 +848,27 @@ void Trip::call_special(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->dna.brummie_stairs = 1; - _vm->_gyro->magics[9].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_dna._brummieStairs = 1; + _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); stopwalking(); - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; break; case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. - _vm->_gyro->dna.brummie_stairs = 3; - _vm->_gyro->magics[10].op = _vm->_gyro->kMagicNothing; - _vm->_gyro->magics[11].op = _vm->_gyro->kMagicExclaim; - _vm->_gyro->magics[11].data = 5; - _vm->_gyro->magics[3].op = _vm->_gyro->kMagicBounce; // Now works as planned! + _vm->_gyro->_dna._brummieStairs = 3; + _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicExclaim; + _vm->_gyro->_magics[11]._data = 5; + _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! stopwalking(); _vm->_visa->dixi('q', 26); - _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->_dna._userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. tr[0].bounce(); // Must include that. - if (!_vm->_gyro->dna.arrow_triggered) { - _vm->_gyro->dna.arrow_triggered = true; + if (!_vm->_gyro->_dna._arrowTriggered) { + _vm->_gyro->_dna._arrowTriggered = true; apped(2, 4); // The dart starts at ped 4, and... tr[1].walkto(5); // flies to ped 5. tr[1].face = 0; // Only face. @@ -888,25 +888,25 @@ void Trip::call_special(uint16 which) { _vm->_enid->backToBootstrap(3); break; case 5: - if (_vm->_gyro->dna.friar_will_tie_you_up) { + if (_vm->_gyro->_dna._friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. - _vm->_gyro->magics[4].op = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. _vm->_visa->dixi('q', 35); tr[0].done(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->dixi('q', 36); - _vm->_gyro->dna.tied_up = true; - _vm->_gyro->dna.friar_will_tie_you_up = false; + _vm->_gyro->_dna._tiedUp = true; + _vm->_gyro->_dna._friarWillTieYouUp = false; tr[1].walkto(3); tr[1].vanishifstill = true; tr[1].check_me = true; // One of them must have Check_Me switched on. - _vm->_gyro->_whereIs[_vm->_gyro->pfriartuck - 150] = 177; // Not here, then. + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; tr[0].ix = 3; tr[0].iy = 0; tr[0].face = right; @@ -914,7 +914,7 @@ void Trip::call_special(uint16 which) { break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0].visible = false; - _vm->_gyro->magics[9].op = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); @@ -923,7 +923,7 @@ void Trip::call_special(uint16 which) { _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. - if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { + if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { _vm->_visa->dixi('q', 63); tr[1].turn(down); tr[1].stopwalk(); @@ -932,18 +932,18 @@ void Trip::call_special(uint16 which) { } break; case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... - if (!_vm->_gyro->dna.geida_follows) + if (!_vm->_gyro->_dna._geidaFollows) return; // DOESN'T COUNT: no Geida. tr[1].call_eachstep = false; // She no longer follows Avvy around. tr[1].walkto(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. - if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { + if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { // Into Geida's room. - if (_vm->_gyro->dna.obj[_vm->_gyro->key - 1]) + if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1]) _vm->_visa->dixi('q', 62); else { _vm->_visa->dixi('q', 61); @@ -951,12 +951,12 @@ void Trip::call_special(uint16 which) { } } _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_y--; + _vm->_gyro->_dna._catacombY--; catamove(4); - if (_vm->_gyro->dna.room != r__catacombs) + if (_vm->_gyro->_dna._room != r__catacombs) return; _vm->_lucerna->delavvy(); - switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->dna.cat_y - 1][_vm->_gyro->dna.cat_x - 1] & 0xf00) >> 8) { + switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { case 0x1: apped(1, 12); break; @@ -971,9 +971,9 @@ void Trip::call_special(uint16 which) { break; case 11: // _vm->_gyro->special 11: transfer east in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_x++; + _vm->_gyro->_dna._catacombX++; catamove(1); - if (_vm->_gyro->dna.room != r__catacombs) + if (_vm->_gyro->_dna._room != r__catacombs) return; _vm->_lucerna->delavvy(); apped(1, 1); @@ -982,9 +982,9 @@ void Trip::call_special(uint16 which) { break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_y += 1; + _vm->_gyro->_dna._catacombY += 1; catamove(2); - if (_vm->_gyro->dna.room != r__catacombs) + if (_vm->_gyro->_dna._room != r__catacombs) return; _vm->_lucerna->delavvy(); apped(1, 2); @@ -993,9 +993,9 @@ void Trip::call_special(uint16 which) { break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_x--; + _vm->_gyro->_dna._catacombX--; catamove(3); - if (_vm->_gyro->dna.room != r__catacombs) + if (_vm->_gyro->_dna._room != r__catacombs) return; _vm->_lucerna->delavvy(); apped(1, 3); @@ -1011,7 +1011,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { // This slides the door open. (The data really ought to be saved in // the Also file, and will be next time. However, for now, they're // here.) - switch (_vm->_gyro->dna.room) { + switch (_vm->_gyro->_dna._room) { case r__outsideyours: case r__outsidenottspub: case r__outsideducks: @@ -1038,7 +1038,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { case r__lusties: switch (magicnum) { case 14: - if (_vm->_gyro->dna.avvys_in_the_cupboard) { + if (_vm->_gyro->_dna._avvysInTheCupboard) { hide_in_the_cupboard(); _vm->_sequence->first_show(8); _vm->_sequence->then_show(7); @@ -1066,7 +1066,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { void Trip::newspeed() { // Given that you've just changed the speed in triptype.xs, this adjusts ix. - const bytefield lightspace = {40, 199, 47, 199}; + const ByteField lightspace = {40, 199, 47, 199}; byte page_; tr[0].ix = (tr[0].ix / 3) * tr[0].xs; @@ -1122,8 +1122,8 @@ void Trip::rwsp(byte t, byte dir) { void Trip::apped(byte trn, byte np) { trn--; np--; - tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info._xLength / 2, _vm->_gyro->peds[np].y - tr[trn]._info._yLength, _vm->_gyro->peds[np].dir); - rwsp(trn, _vm->_gyro->peds[np].dir); + tr[trn].appear(_vm->_gyro->_peds[np]._x - tr[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - tr[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); + rwsp(trn, _vm->_gyro->_peds[np]._direction); } #if 0 @@ -1134,20 +1134,14 @@ void Trip::apped(byte trn, byte np) { #endif //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. //x3,y3 = mx,my. x4,y4 = mx+16,my+16. -bool Trip::overlaps_with_mouse() { - bool overlaps_with_mouse_result; - overlaps_with_mouse_result = - (r.x2 * 8 >= _vm->_gyro->mx) && (_vm->_gyro->mx + 16 >= r.x1 * 8) && (r.y2 >= _vm->_gyro->my) && (_vm->_gyro->my + 16 >= r.y1); - return overlaps_with_mouse_result; -} void Trip::getback() { // Super_Off; - +#if 0 while (getset[1 - _vm->_gyro->cp].numleft > 0) { getset[1 - _vm->_gyro->cp].recall(r); -#if 0 + bool endangered = false; if overlaps_with_mouse and not endangered then begin @@ -1155,12 +1149,10 @@ void Trip::getback() { blitfix; Super_Off; end; -#endif //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); } -#if 0 if endangered then Super_On; #endif @@ -1234,13 +1226,13 @@ void Trip::arrow_procs(byte tripnum) { #endif _vm->_lucerna->gameover(); - _vm->_gyro->dna.user_moves_avvy = false; // Stop the user from moving him. + _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); } } else { // Arrow has hit the wall! tr[tripnum].done(); // Deallocate the arrow. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. - _vm->_gyro->dna.arrow_in_the_door = true; // So that we can pick it up. + _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. } } @@ -1299,21 +1291,21 @@ void Trip::spin(byte whichway, byte &tripnum) { if (tr[tripnum].whichsprite == 2) return; // Not for Spludwick - _vm->_gyro->dna.geida_spin += 1; - _vm->_gyro->dna.geida_time = 20; - if (_vm->_gyro->dna.geida_spin == 5) { + _vm->_gyro->_dna._geidaSpin += 1; + _vm->_gyro->_dna._geidaTime = 20; + if (_vm->_gyro->_dna._geidaSpin == 5) { _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_gyro->dna.geida_spin = 0; - _vm->_gyro->dna.geida_time = 0; // knock out records + _vm->_gyro->_dna._geidaSpin = 0; + _vm->_gyro->_dna._geidaTime = 0; // knock out records } } } void Trip::geida_procs(byte tripnum) { - if (_vm->_gyro->dna.geida_time > 0) { - _vm->_gyro->dna.geida_time--; - if (_vm->_gyro->dna.geida_time == 0) - _vm->_gyro->dna.geida_spin = 0; + if (_vm->_gyro->_dna._geidaTime > 0) { + _vm->_gyro->_dna._geidaTime--; + if (_vm->_gyro->_dna._geidaTime == 0) + _vm->_gyro->_dna._geidaSpin = 0; } if (tr[tripnum].y < (tr[0].y - 2)) { @@ -1388,7 +1380,7 @@ void Trip::call_andexors() { void Trip::trippancy_link() { byte fv; - if (_vm->_gyro->ddmnow | _vm->_gyro->ontoolbar | _vm->_gyro->seescroll) + if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; for (fv = 0; fv < numtr; fv++) { if (tr[fv].quick && tr[fv].visible) @@ -1443,8 +1435,8 @@ void Trip::get_back_loretta() { void Trip::stopwalking() { tr[0].stopwalk(); - _vm->_gyro->dna.rw = stopped; - if (_vm->_gyro->alive) + _vm->_gyro->_dna._direction = stopped; + if (_vm->_gyro->_alive) tr[0].step = 1; } @@ -1462,15 +1454,15 @@ void Trip::getsetclear() { } void Trip::hide_in_the_cupboard() { - if (_vm->_gyro->dna.avvys_in_the_cupboard) { - if (_vm->_gyro->dna.wearing == Acci::kNothing) + if (_vm->_gyro->_dna._avvysInTheCupboard) { + if (_vm->_gyro->_dna._wearing == Acci::kNothing) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { tr[0].visible = true; - _vm->_gyro->dna.user_moves_avvy = true; + _vm->_gyro->_dna._userMovesAvvy = true; apped(1, 3); // Walk out of the cupboard. _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); - _vm->_gyro->dna.avvys_in_the_cupboard = false; + _vm->_gyro->_dna._avvysInTheCupboard = false; _vm->_sequence->first_show(8); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); @@ -1478,50 +1470,36 @@ void Trip::hide_in_the_cupboard() { } else { // Not hiding in the cupboard tr[0].visible = false; - _vm->_gyro->dna.user_moves_avvy = false; + _vm->_gyro->_dna._userMovesAvvy = false; _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); - _vm->_gyro->dna.avvys_in_the_cupboard = true; + _vm->_gyro->_dna._avvysInTheCupboard = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); } } -void Trip::tidy_up(int16 a, int16 b, int16 c, int16 d) { - warning("STUB: Trip::tidy_up()"); -} - -void Trip::tidy_after_mouse() { - tidy_up(beforex, beforey, beforex + 15, beforey + 15); - _vm->_gyro->xycheck(); - tidy_up(_vm->_gyro->mx, _vm->_gyro->my, _vm->_gyro->mx + 15, _vm->_gyro->my + 15); -} - void Trip::fliproom(byte room, byte ped) { byte fv; - if (!_vm->_gyro->alive) { + if (!_vm->_gyro->_alive) { // You can't leave the room if you're dead. tr[0].ix = 0; tr[0].iy = 0; // Stop him from moving. return; } - if ((room == 177) && (_vm->_gyro->dna.room == r__lusties)) { + if ((room == 177) && (_vm->_gyro->_dna._room == r__lusties)) { hide_in_the_cupboard(); return; } - if ((_vm->_gyro->dna.jumpstatus > 0) && (_vm->_gyro->dna.room == r__insidecardiffcastle)) { + if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { // You can't *jump* out of Cardiff Castle! tr[0].ix = 0; return; } - _vm->_gyro->xycheck(); - beforex = _vm->_gyro->mx; - beforey = _vm->_gyro->my; - - _vm->_lucerna->exitroom(_vm->_gyro->dna.room); + _vm->_lucerna->exitroom(_vm->_gyro->_dna._room); _vm->_lucerna->dusk(); getsetclear(); @@ -1531,18 +1509,18 @@ void Trip::fliproom(byte room, byte ped) { tr[fv].done(); } // Deallocate sprite - if (_vm->_gyro->dna.room == r__lustiesroom) - _vm->_gyro->dna.enter_catacombs_from_lusties_room = true; + if (_vm->_gyro->_dna._room == r__lustiesroom) + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterroom(room, ped); apped(1, ped); - _vm->_gyro->dna.enter_catacombs_from_lusties_room = false; - _vm->_gyro->oldrw = _vm->_gyro->dna.rw; - _vm->_gyro->dna.rw = tr[0].face; + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; + _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; + _vm->_gyro->_dna._direction = tr[0].face; _vm->_lucerna->showrw(); for (fv = 0; fv <= 1; fv++) { - _vm->_gyro->cp = 1 - _vm->_gyro->cp; + _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; getback(); } _vm->_lucerna->dawn(); @@ -1556,13 +1534,13 @@ bool Trip::infield(byte which) { int16 yy = tr[0].y + tr[0]._info._yLength; - return (tr[0].x >= _vm->_gyro->fields[which].x1) && (tr[0].x <= _vm->_gyro->fields[which].x2) - && (yy >= _vm->_gyro->fields[which].y1) && (yy <= _vm->_gyro->fields[which].y2); + return (tr[0].x >= _vm->_gyro->_fields[which]._x1) && (tr[0].x <= _vm->_gyro->_fields[which]._x2) + && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); } bool Trip::neardoor() { - if (_vm->_gyro->numfields < 8) { + if (_vm->_gyro->_fieldNum < 8) { // there ARE no doors here! return false; } @@ -1570,9 +1548,9 @@ bool Trip::neardoor() { int16 ux = tr[0].x; int16 uy = tr[0].y + tr[0]._info._yLength; bool nd = false; - for (byte fv = 8; fv < _vm->_gyro->numfields; fv++) - if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2) - && (uy >= _vm->_gyro->fields[fv].y1) && (uy <= _vm->_gyro->fields[fv].y2)) + for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) + if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) + && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) nd = true; return nd; } @@ -1584,7 +1562,7 @@ void Trip::new_game_for_trippancy() { // Called by gyro.newgame void Trip::handleMoveKey(const Common::Event &event) { - if (!_vm->_gyro->dna.user_moves_avvy) + if (!_vm->_gyro->_dna._userMovesAvvy) return; if (_vm->_dropdown->_activeMenuItem._activeNow) @@ -1592,58 +1570,58 @@ void Trip::handleMoveKey(const Common::Event &event) { else { switch (event.kbd.keycode) { case Common::KEYCODE_UP: - if (_vm->_gyro->dna.rw != up) { - _vm->_gyro->dna.rw = up; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != up) { + _vm->_gyro->_dna._direction = up; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_DOWN: - if (_vm->_gyro->dna.rw != down) { - _vm->_gyro->dna.rw = down; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != down) { + _vm->_gyro->_dna._direction = down; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_LEFT: - if (_vm->_gyro->dna.rw != left) { - _vm->_gyro->dna.rw = left; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != left) { + _vm->_gyro->_dna._direction = left; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_RIGHT: - if (_vm->_gyro->dna.rw != right) { - _vm->_gyro->dna.rw = right; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != right) { + _vm->_gyro->_dna._direction = right; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->dna.rw != ur) { - _vm->_gyro->dna.rw = ur; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != ur) { + _vm->_gyro->_dna._direction = ur; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->dna.rw != dr) { - _vm->_gyro->dna.rw = dr; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != dr) { + _vm->_gyro->_dna._direction = dr; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_END: - if (_vm->_gyro->dna.rw != dl) { - _vm->_gyro->dna.rw = dl; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != dl) { + _vm->_gyro->_dna._direction = dl; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_HOME: - if (_vm->_gyro->dna.rw != ul) { - _vm->_gyro->dna.rw = ul; - rwsp(0, _vm->_gyro->dna.rw); + if (_vm->_gyro->_dna._direction != ul) { + _vm->_gyro->_dna._direction = ul; + rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index e3ed44fe43d8..4deebbc10406 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -130,12 +130,12 @@ const int16 maxgetset = 35; class getsettype { public: - bytefield gs[maxgetset]; + ByteField gs[maxgetset]; byte numleft; getsettype *init(); - void remember(bytefield r); - void recall(bytefield &r); + void remember(ByteField r); + void recall(ByteField &r); }; @@ -235,7 +235,7 @@ class Trip { private: AvalancheEngine *_vm; - bytefield r; + ByteField r; int16 beforex, beforey; @@ -247,8 +247,6 @@ class Trip { void hide_in_the_cupboard(); - bool overlaps_with_mouse(); - void follow_avvy_y(byte tripnum); void back_and_forth(byte tripnum); @@ -266,10 +264,6 @@ class Trip { void call_andexors(); void getsetclear(); - - void tidy_up(int16 a, int16 b, int16 c, int16 d); - - void tidy_after_mouse(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index fe31cc28dac1..4cdbe5a8dee6 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -49,13 +49,13 @@ bool Visa::bubbling = false; bool Visa::report_dixi_errors = true; void Visa::unskrimble() { - for (uint16 fv = 0; fv < _vm->_gyro->bufsize; fv++) - _vm->_gyro->buffer[fv] = (~(_vm->_gyro->buffer[fv] - (fv + 1))) % 256; + for (uint16 fv = 0; fv < _vm->_gyro->_bufSize; fv++) + _vm->_gyro->_buffer[fv] = (~(_vm->_gyro->_buffer[fv] - (fv + 1))) % 256; } void Visa::do_the_bubble() { - _vm->_gyro->bufsize++; - _vm->_gyro->buffer[_vm->_gyro->bufsize - 1] = 2; + _vm->_gyro->_bufSize++; + _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } void Visa::dixi(char block, byte point) { @@ -85,7 +85,7 @@ void Visa::dixi(char block, byte point) { if (error) { if (report_dixi_errors) { Common::String todisplay; - todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->strf(point).c_str()); + todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->intToStr(point).c_str()); _vm->_scrolls->display(todisplay); } return; @@ -96,8 +96,8 @@ void Visa::dixi(char block, byte point) { return; } sezfile.seek(sez_offset); - _vm->_gyro->bufsize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.close(); unskrimble(); @@ -146,8 +146,8 @@ void Visa::speech(byte who, byte subject) { return; } sezfile.seek(sez_offset); - _vm->_gyro->bufsize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->buffer, _vm->_gyro->bufsize); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.close(); unskrimble(); @@ -165,27 +165,27 @@ void Visa::talkto(byte whom) { bool no_matches; if (_vm->_acci->_person == _vm->_acci->kPardon) { - _vm->_acci->_person = _vm->_gyro->subjnumber; - _vm->_gyro->subjnumber = 0; + _vm->_acci->_person = _vm->_gyro->_subjectNum; + _vm->_gyro->_subjectNum = 0; } - if (_vm->_gyro->subjnumber == 0) + if (_vm->_gyro->_subjectNum == 0) switch (whom) { - case Gyro::pspludwick: - if ((_vm->_gyro->dna.lustie_is_asleep) & (!_vm->_gyro->dna.obj[_vm->_gyro->potion - 1])) { + case Gyro::kPeopleSpludwick: + if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1])) { dixi('q', 68); - _vm->_gyro->dna.obj[_vm->_gyro->potion - 1] = true; + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); return; } else { - if (_vm->_gyro->dna.talked_to_crapulus) + if (_vm->_gyro->_dna._talkedToCrapulus) // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_gyro->dna.given2spludwick) { + switch (_vm->_gyro->_dna._givenToSpludwick) { case 1: // Falltrough is intended. case 2:{ - _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->get_better(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->dna.given2spludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } break; @@ -201,57 +201,57 @@ void Visa::talkto(byte whom) { } } break; - case Gyro::pibythneth: - if (_vm->_gyro->dna.givenbadgetoiby) { + case Gyro::kPeopleIbythneth: + if (_vm->_gyro->_dna._givenBadgeToIby) { dixi('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. - case Gyro::pdogfood: - if (_vm->_gyro->dna.wonnim) { // We've won the game. + case Gyro::kPeopleDogfood: + if (_vm->_gyro->_dna._wonNim) { // We've won the game. dixi('q', 6); // "I'm Not Playing!" return; // Zap back. } else - _vm->_gyro->dna.asked_dogfood_about_nim = true; + _vm->_gyro->_dna._askedDogfoodAboutNim = true; break; - case Gyro::payles: - if (!_vm->_gyro->dna.ayles_is_awake) { + case Gyro::kPeopleAyles: + if (!_vm->_gyro->_dna._aylesIsAwake) { dixi('q', 43); // He's fast asleep! return; - } else if (!_vm->_gyro->dna.given_pen_to_ayles) { + } else if (!_vm->_gyro->_dna._givenPenToAyles) { dixi('q', 44); // Can you get me a pen, Avvy? return; } break; - case Gyro::pjacques: { + case Gyro::kPeopleJacques: { dixi('q', 43); return; } - case Gyro::pgeida: - if (_vm->_gyro->dna.geida_given_potion) - _vm->_gyro->dna.geida_follows = true; + case Gyro::kPeopleGeida: + if (_vm->_gyro->_dna._givenPotionToGeida) + _vm->_gyro->_dna._geidaFollows = true; else { dixi('u', 17); return; } break; - case Gyro::pspurge: - if (!_vm->_gyro->dna.sitting_in_pub) { + case Gyro::kPeopleSpurge: + if (!_vm->_gyro->_dna._sittingInPub) { dixi('q', 71); // Try going over and sitting down. return; } else { - if (_vm->_gyro->dna.spurge_talk < 5) - _vm->_gyro->dna.spurge_talk++; - if (_vm->_gyro->dna.spurge_talk > 1) { // no. 1 falls through - dixi('q', 70 + _vm->_gyro->dna.spurge_talk); + if (_vm->_gyro->_dna._spurgeTalkCount < 5) + _vm->_gyro->_dna._spurgeTalkCount++; + if (_vm->_gyro->_dna._spurgeTalkCount > 1) { // no. 1 falls through + dixi('q', 70 + _vm->_gyro->_dna._spurgeTalkCount); return; } } break; } // On a subject. Is there any reason to block it? - else if ((whom == _vm->_gyro->payles) && (!_vm->_gyro->dna.ayles_is_awake)) { + else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { dixi('q', 43); // He's fast asleep! return; } @@ -270,18 +270,18 @@ void Visa::talkto(byte whom) { if (no_matches) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); - speech(whom, _vm->_gyro->subjnumber); + speech(whom, _vm->_gyro->_subjectNum); if (!went_ok) dixi('n', whom); // File not found! - if ((_vm->_gyro->subjnumber == 0) && ((whom + 149) == _vm->_gyro->pcrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = true; + if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = true; _vm->_lucerna->objectlist(); dixi('q', 1); // Circular from Cardiff. - _vm->_gyro->dna.talked_to_crapulus = true; + _vm->_gyro->_dna._talkedToCrapulus = true; - _vm->_gyro->_whereIs[_vm->_gyro->pcrapulus - 150] = 177; // Crapulus walks off. + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].walkto(3); // Walks away. From f1bac0f193c7fe39d0241e0c3db60bc10642edfc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 6 Sep 2013 23:51:04 +0200 Subject: [PATCH 0835/1332] AVALANCHE: (Hopefully) fix some warnings reported by GCC and Clang --- engines/avalanche/acci2.cpp | 4 +-- engines/avalanche/dropdown2.cpp | 3 +- engines/avalanche/graphics.cpp | 59 +++++++++++++++++++-------------- engines/avalanche/lucerna2.cpp | 18 +++++----- engines/avalanche/scrolls2.cpp | 2 +- 5 files changed, 47 insertions(+), 39 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 7b3e84fd60f6..1661ad27b93e 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1527,9 +1527,9 @@ void Acci::doThat() { for (byte i = 0; i < 7; i++) toDisplay += _vm->_scrolls->kControlNewLine; toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine - + "The medival descendant of" + _vm->_scrolls->kControlNewLine + + "The medi\x91val descendant of" + _vm->_scrolls->kControlNewLine + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright " + + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \XEF " + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; _vm->_scrolls->display(toDisplay); _vm->_scrolls->aboutscroll = false; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 7424d829745e..10cefa13b26c 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -349,7 +349,8 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, return; else { byte i; - for (i = 0; text[i] != trigger; i++); // Search for the character in the string. + for (i = 0; text[i] != trigger; i++) + ; // Search for the character in the string. byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index eeb15ddb31f7..df310500f8f6 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -91,8 +91,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, yRadius++; // Check for an ellipse with negligable x and y radius. - if ((xRadius <= 1) && (yRadius <= 1)) - { + if ((xRadius <= 1) && (yRadius <= 1)) { *(byte *)_scrolls.getBasePtr(x, y) = color; endPoint.x = x; endPoint.y = y; @@ -104,15 +103,14 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, endAngle = endAngle % 361; // If impossible angles, then swap them! - if (endAngle < stAngle) - { + if (endAngle < stAngle) { uint16 tmpAngle=endAngle; endAngle=stAngle; stAngle=tmpAngle; } // Approximate the number of pixels required by using the circumference equation of an ellipse. - uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(double(xRadius), 2)+pow(double(yRadius), 2)) + 0.5); + uint16 numOfPixels = (uint16)floor(sqrt(3.0) * sqrt(pow(double(xRadius), 2) + pow(double(yRadius), 2)) + 0.5); // Calculate the angle precision required. double delta = 90.0 / numOfPixels; @@ -127,8 +125,8 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, // Set the end point. double tempTerm = endAngle * convfac; - endPoint.x = floor(xRadius * cos(tempTerm) + 0.5) + x; - endPoint.y = floor(yRadius * sin(tempTerm + pi) + 0.5) + y; + endPoint.x = (int16)floor(xRadius * cos(tempTerm) + 0.5) + x; + endPoint.y = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5) + y; // Calculate points. int16 xNext = xRadius; @@ -139,8 +137,8 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, // This is used by both sin and cos. tempTerm = (j + delta) * convfac; - xNext = floor(xRadius*cos(tempTerm) + 0.5); - yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); + xNext = (int16)floor(xRadius * cos(tempTerm) + 0.5); + yNext = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5); int16 xp = x + xTemp; int16 xm = x - xTemp; @@ -208,7 +206,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte } void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { - for (byte i = 0; i < text.size(); i++) + for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; for (byte bit = 0; bit < 8; bit++) { @@ -217,6 +215,7 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text *(byte *)surface.getBasePtr(x + i * 8 + 7 - bit, y + j) = color; } } + } } ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { @@ -229,8 +228,8 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (byte y = 0; y < height; y++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (byte y = 0; y < height; y++) { + for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (byte bit = 0; bit < 8; bit++) { @@ -239,7 +238,8 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } - + } + } return picture; } @@ -251,8 +251,8 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); - for (byte plane = 0; plane < 4; plane++) - for (uint16 y = 0; y < height; y++) + for (byte plane = 0; plane < 4; plane++) { + for (uint16 y = 0; y < height; y++) { for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (byte i = 0; i < 8; i++) { @@ -260,22 +260,26 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } } + } + } return picture; } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the spirte blank. - for (byte j = 0; j < sprite._yLength; j++) - for (byte i = 0; i < sprite._xLength; i++) + for (byte j = 0; j < sprite._yLength; j++) { + for (byte i = 0; i < sprite._xLength; i++) { if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *(byte *)_surface.getBasePtr(x + i, y + j) = 0; + } + } // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (byte j = 0; j < sprite._yLength; j++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (byte j = 0; j < sprite._yLength; j++) { + for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 i = 0; i < sprite._xLength; i += 8) { byte pixel = (*sprite._mani[picnum])[maniPos++]; for (byte bit = 0; bit < 8; bit++) { @@ -283,22 +287,27 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); } } + } + } } void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. - for (uint16 y = 0; y < picture.h; y++) - for (uint16 x = 0; x < picture.w; x++) - *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + for (uint16 y = 0; y < picture.h; y++) { + for (uint16 x = 0; x < picture.w; x++) { + *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + } + } } void Graphics::refreshScreen() { // These cycles are for doubling the screen height. - for (uint16 y = 0; y < _screen.h / 2; y++) - for (uint16 x = 0; x < _screen.w; x++) + for (uint16 y = 0; y < _screen.h / 2; y++) { + for (uint16 x = 0; x < _screen.w; x++) { for (byte j = 0; j < 2; j++) *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); - + } + } // Now we copy the stretched picture to the screen. g_system->copyRectToScreen(_screen.pixels, _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 425cab0858d6..81dc45875dd5 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1336,20 +1336,18 @@ void Lucerna::major_redraw() { } uint16 Lucerna::bearing(byte whichped) { - whichped--; // Different array indexes in Pascal and C. + byte pedId = whichped - 1; // Different array indexes in Pascal and C. const double rad2deg = 180 / 3.14; // Pi - if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[whichped]._x) + if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[pedId]._x) return 0; - else { - if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[whichped]._x) { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 90; - } else { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 270; - } + else if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + } else { + return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1392454663e6..531794c7705b 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -588,7 +588,7 @@ Common::String Scrolls::lsd() { else x = x + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); } else // L, s & d - x = Common::String('') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + x = Common::String('\x9C') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); if (_vm->_gyro->_dna._money > 12) x = x + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; From e34076739532a808a98afe15ee30f09841b3283f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 00:32:08 +0200 Subject: [PATCH 0836/1332] AVALANCHE: Move some static arrays to function bodies --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/gyro2.cpp | 58 +++++++++++++++++++------------------ engines/avalanche/gyro2.h | 15 ---------- 3 files changed, 31 insertions(+), 44 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1661ad27b93e..64c2d67b8b99 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1529,7 +1529,7 @@ void Acci::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + "The medi\x91val descendant of" + _vm->_scrolls->kControlNewLine + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \XEF " + + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \xEF " + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; _vm->_scrolls->display(toDisplay); _vm->_scrolls->aboutscroll = false; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index c0876f3dadb6..326713eca39e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -63,19 +63,6 @@ const MouseHotspotType Gyro::kMouseHotSpots[9] = { {0,0} // 9 - question mark }; -const Common::String Gyro::kLads[17] = { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" -}; - -const Common::String Gyro::kLasses[4] = -{"Arkata", "Geida", "\0xB1", "the Wise Woman"}; - -const char Gyro::kLadChar[] = "ASCDMTRwLfgeIyPu"; - -const char Gyro::kLassChar[] = "kG\0xB1o"; - // Art gallery at 2,1; notice about this at 2,2. const int32 Gyro::kCatacombMap[8][8] = { // Geida's room @@ -188,21 +175,6 @@ byte Gyro::_whereIs[29] = { r__wisewomans // The Wise Woman. }; -const Common::String Gyro::kThings[kObjectNum] = { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" -}; - -const char Gyro::kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar - -const Common::String Gyro::kItems[kObjectNum] = { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" -}; - const char Gyro::kItemsChar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { @@ -354,6 +326,16 @@ bool Gyro::updateMoney(uint16 howmuchby) { // There'll may be problems with calling these functions because of the conversion of the arrays!!! // Keep an eye open! Common::String Gyro::getName(byte whose) { + static const Common::String kLads[17] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", + "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", + "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + }; + + static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; + + assert((whose > 150) && (whose < 179)); + if (whose < 175) return kLads[whose - 150]; else @@ -362,6 +344,11 @@ Common::String Gyro::getName(byte whose) { // Keep an eye open! ^ byte Gyro::getNameChar(byte whose) { + static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; + static const char kLassChar[] = "kG\0xB1o"; + + assert((whose > 150) && (whose < 179)); + if (whose < 175) return kLadChar[whose - 150]; else @@ -370,6 +357,12 @@ byte Gyro::getNameChar(byte whose) { // Keep an eye open! ^^ Common::String Gyro::getThing(byte which) { + static const Common::String kThings[kObjectNum] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + }; + Common::String get_thing_result; switch (which) { case kObjectWine: @@ -397,6 +390,8 @@ Common::String Gyro::getThing(byte which) { // Keep an eye open! ^^^ char Gyro::getThingChar(byte which) { + static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar + char get_thingchar_result; switch (which) { case kObjectWine: @@ -413,6 +408,13 @@ char Gyro::getThingChar(byte which) { // Keep an eye open! ^^^^ Common::String Gyro::getItem(byte which) { + static const Common::String kItems[kObjectNum] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", + "an onion" + }; + Common::String get_better_result; if (which > 150) which -= 149; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 89346d7498e6..0dd90785fd3d 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -294,14 +294,6 @@ class Gyro { static const MouseHotspotType kMouseHotSpots[9]; - static const Common::String kLads[17]; - - static const Common::String kLasses[4]; - - static const char kLadChar[]; - - static const char kLassChar[]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. // For Thinkabout: @@ -498,14 +490,7 @@ class Gyro { private: AvalancheEngine *_vm; - static const Common::String kThings[kObjectNum]; - - static const char kThingsChar[]; - - static const Common::String kItems[kObjectNum]; // 'better' in the original. - static const char kItemsChar[]; // Similar as above. - void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; From c537d2f1e5c96e29622d7c9ae272c2a9e7b8a1a8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 00:34:38 +0200 Subject: [PATCH 0837/1332] AVALANCHE: Comment out some dead code --- engines/avalanche/gyro2.cpp | 3 ++- engines/avalanche/gyro2.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 326713eca39e..398e4a8624ad 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -175,7 +175,8 @@ byte Gyro::_whereIs[29] = { r__wisewomans // The Wise Woman. }; -const char Gyro::kItemsChar[] = "WMBParCLguKeSnIohn"; +// CHECKME: Useless? +// const char Gyro::kItemsChar[] = "WMBParCLguKeSnIohn"; Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _vm = vm; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 0dd90785fd3d..75dc50c72076 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -490,7 +490,8 @@ class Gyro { private: AvalancheEngine *_vm; - static const char kItemsChar[]; // Similar as above. + // CHECKME: Useless? + // static const char kItemsChar[]; void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; From 73afd0d8e1771110a6e7b3744acacd00fc6ca1b6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 00:41:39 +0200 Subject: [PATCH 0838/1332] AVALANCHE: Fix some more warnings --- engines/avalanche/acci2.cpp | 22 ++++++++++------------ engines/avalanche/acci2.h | 3 --- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 64c2d67b8b99..2df42e4542d7 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -192,17 +192,6 @@ const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { {255, "THIS"}, {255, "SENTINEL"} // for "Ken SENT Me" }; -const char Acci::kWhat[] = "That's not possible!"; - -const Acci::RankType Acci::kRanks[9] = { - {0, "Beginner"}, {10, "Novice"}, - {20, "Improving"}, {35, "Not bad"}, - {50, "Passable"}, {65, "Good"}, - {80, "Experienced"}, {108, "The BEST!"}, - {32767, "copyright'93"} -}; - - Acci::Acci(AvalancheEngine *vm) { _vm = vm; } @@ -251,6 +240,14 @@ void Acci::replace(Common::String oldChars, byte newChar) { } Common::String Acci::rank() { + static const RankType kRanks[9] = { + {0, "Beginner"}, {10, "Novice"}, + {20, "Improving"}, {35, "Not bad"}, + {50, "Passable"}, {65, "Good"}, + {80, "Experienced"}, {108, "The BEST!"}, + {32767, "copyright'93"} + }; + for (byte i = 0; i < 8; i++) { if ((_vm->_gyro->_dna._score >= kRanks[i]._score) && (_vm->_gyro->_dna._score < kRanks[i + 1]._score)) { return kRanks[i]._title; @@ -1304,7 +1301,8 @@ void Acci::heyThanks() { * @remarks Originally called 'do_that' */ void Acci::doThat() { - const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + static const char kWhat[] = "That's not possible!"; if (_thats == Common::String(kNothing)) { if (!_thats.empty()) diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 2f036630c417..9004fc6ad58e 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -82,9 +82,6 @@ class Acci { Common::String _title; }; - static const RankType kRanks[9]; - static const char kWhat[]; - Common::String _thats; Common::String _unknown; From 7be84e9d52cb90bd14a84926bbad34da707ea5d6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 01:26:28 +0200 Subject: [PATCH 0839/1332] AVALANCHE: Fix some more Clang warnings --- engines/avalanche/trip6.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 4deebbc10406..655adae8b69f 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -235,9 +235,9 @@ class Trip { private: AvalancheEngine *_vm; - ByteField r; - - int16 beforex, beforey; + // CHECKME: Useless? + // ByteField r; + // int16 beforex, beforey; byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); From 2dab04e14b82a110ea8b49b2f6778b5a5fe79375 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:29:19 -0500 Subject: [PATCH 0840/1332] ZVISION: Do full working window warp instead of image at a time --- engines/zvision/render_manager.cpp | 77 ++++++++++++++++++++++++------ engines/zvision/render_manager.h | 17 ++++--- engines/zvision/render_table.cpp | 50 +++++++------------ engines/zvision/render_table.h | 2 +- engines/zvision/zvision.cpp | 5 +- 5 files changed, 96 insertions(+), 55 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index e394baf50422..6c0e8d24f6eb 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -34,7 +34,7 @@ namespace ZVision { -RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat) +RenderManager::RenderManager(OSystem *system, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat) : _system(system), _workingWidth(workingWindow.width()), _workingHeight(workingWindow.height()), @@ -49,12 +49,14 @@ RenderManager::RenderManager(OSystem *system, const Common::Rect workingWindow, _accumulatedVelocityMilliseconds(0), _renderTable(_workingWidth, _workingHeight) { - _workingWindowBuffer = new uint16[_workingWidth *_workingHeight]; + _workingWindowBuffer.create(_workingWidth, _workingHeight, _pixelFormat); + _backBuffer.create(windowWidth, windowHeight, pixelFormat); } RenderManager::~RenderManager() { - delete[] _workingWindowBuffer; + _workingWindowBuffer.free(); _currentBackground.free(); + _backBuffer.free(); } void RenderManager::update(uint deltaTimeInMillis) { @@ -75,14 +77,29 @@ void RenderManager::update(uint deltaTimeInMillis) { } } -void RenderManager::clearWorkingWindowToColor(uint16 color) { +void RenderManager::renderBackbufferToScreen() { + //RenderTable::RenderState state = _renderTable.getRenderState(); + //if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + // _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left, _workingWindow.top), _backBuffer.w); + //} else { + //_system->copyRectToScreen(_workingWindowBuffer.getPixels(), _workingWindowBuffer.pitch, _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h); + //} + + // TODO: Add menu rendering + + //_system->copyRectToScreen(_backBuffer.getPixels(), _backBuffer.pitch, 0, 0, _backBuffer.w, _backBuffer.h); +} + +void RenderManager::clearWorkingWindowTo555Color(uint16 color) { uint32 workingWindowSize = _workingWidth * _workingHeight; + byte r, g, b; + Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(color, r, g, b); + uint16 colorIn565 = _pixelFormat.RGBToColor(r, g, b); + uint16 *bufferPtr = (uint16 *)_workingWindowBuffer.getPixels(); for (uint32 i = 0; i < workingWindowSize; i++) { - _workingWindowBuffer[i] = color; + bufferPtr[i] = color; } - - _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), _workingWindow.left, _workingWindow.top, _workingWidth, _workingHeight); } void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap) { @@ -136,13 +153,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (!subRect.isValidRect() || subRect.isEmpty()) return; - if (_renderTable.getRenderState() == RenderTable::FLAT) { - _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); - } else { - _renderTable.mutateImage((uint16 *)surface.getPixels(), _workingWindowBuffer, surface.w, surface.h, destinationX, destinationY, subRect, wrap); - - _system->copyRectToScreen(_workingWindowBuffer, _workingWidth * sizeof(uint16), destinationX + _workingWindow.left, destinationY + _workingWindow.top, subRect.width(), subRect.height()); - } + _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX, destinationY, subRect.width(), subRect.height()/*, wrap*/); } void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { @@ -250,6 +261,44 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: destination.convertToInPlace(_pixelFormat); } +void RenderManager::renderRectToWorkingWindow(uint16 *buffer, int32 destX, int32 destY, int32 width, int32 height, bool wrap) { + uint32 destOffset = 0; + uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); + + for (int32 y = 0; y < height; y++) { + for (int32 x = 0; x < width; x++) { + int32 sourceYIndex = y; + int32 sourceXIndex = x; + + if (wrap) { + while (sourceXIndex >= width) { + sourceXIndex -= width; + } + while (sourceXIndex < 0) { + sourceXIndex += width; + } + + while (sourceYIndex >= height) { + sourceYIndex -= height; + } + while (sourceYIndex < 0) { + sourceYIndex += height; + } + } else { + // Clamp the yIndex to the size of the image + sourceYIndex = CLIP(sourceYIndex, 0, height - 1); + + // Clamp the xIndex to the size of the image + sourceXIndex = CLIP(sourceXIndex, 0, width - 1); + } + + workingWindowBufferPtr[destOffset + x] = buffer[sourceYIndex * width + sourceXIndex]; + } + + destOffset += _workingWidth; + } +} + const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { // Convert from screen space to working window space Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 1dcbf76d8c84..bf44c884e83f 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -45,7 +45,7 @@ namespace ZVision { class RenderManager { public: - RenderManager(OSystem *system, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat); + RenderManager(OSystem *system, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat); ~RenderManager(); private: @@ -54,7 +54,8 @@ class RenderManager { // A buffer the exact same size as the workingWindow // It's used for panorama/tilt warping and for clearing the workingWindow to a single color - uint16 *_workingWindowBuffer; + Graphics::Surface _workingWindowBuffer; + Graphics::Surface _backBuffer; /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; @@ -90,9 +91,6 @@ class RenderManager { /** Holds any 'leftover' milliseconds between frames */ uint _accumulatedVelocityMilliseconds; - // TODO: Potentially merge this buffer and _workingWindowBuffer - byte *_scaledVideoFrameBuffer; - public: void initialize(); /** @@ -102,12 +100,17 @@ class RenderManager { */ void update(uint deltaTimeInMillis); + /** + * Renders the current state of the backbuffer to the screen + */ + void renderBackbufferToScreen(); + /** * Fills the entire workingWindow with the specified color * * @param color The color to fill the working window with. (In RGB 555) */ - void clearWorkingWindowToColor(uint16 color); + void clearWorkingWindowTo555Color(uint16 color); /** * Blits the image or a portion of the image to the backbuffer. Actual screen updates won't happen until the end of the frame. @@ -186,6 +189,8 @@ class RenderManager { void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); + void renderRectToWorkingWindow(uint16 *buffer, int32 x, int32 y, int32 width, int32 height, bool wrap); + void moveBackground(int offset); }; diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 5fd7a16caced..c72775b1ab73 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -100,45 +100,29 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap) { - for (int16 y = subRect.top; y < subRect.bottom; y++) { - int16 normalizedY = y - subRect.top; - int32 internalColumnIndex = (normalizedY + destinationY) * _numColumns; - int32 destColumnIndex = normalizedY * _numColumns; +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint16 destWidth) { + uint32 destColumnOffset = 0; - for (int16 x = subRect.left; x < subRect.right; x++) { - int16 normalizedX = x - subRect.left; + for (int16 y = 0; y < _numRows; y++) { + int32 sourceColumnOffset = y * _numColumns; - int32 index = internalColumnIndex + normalizedX + destinationX; + for (int16 x = 0; x < _numColumns; x++) { + int32 index = sourceColumnOffset + x; // RenderTable only stores offsets from the original coordinates - int16 sourceYIndex = y + _internalBuffer[index].y; - int16 sourceXIndex = x + _internalBuffer[index].x; - - if (wrap) { - while (sourceXIndex >= imageWidth) { - sourceXIndex -= imageWidth; - } - while (sourceXIndex < 0) { - sourceXIndex += imageWidth; - } - - while (sourceYIndex >= imageHeight) { - sourceYIndex -= imageHeight; - } - while (sourceYIndex < 0) { - sourceYIndex += imageHeight; - } - } else { - // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, imageHeight - 1); - - // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, imageWidth - 1); - } + int32 sourceYIndex = y + _internalBuffer[index].y; + int32 sourceXIndex = x + _internalBuffer[index].x; + + // Clamp the yIndex to the size of the image + sourceYIndex = CLIP(sourceYIndex, 0, _numRows - 1); + + // Clamp the xIndex to the size of the image + sourceXIndex = CLIP(sourceXIndex, 0, _numColumns - 1); - destBuffer[destColumnIndex + normalizedX] = sourceBuffer[sourceYIndex * imageWidth + sourceXIndex]; + destBuffer[destColumnOffset + x] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; } + + destColumnOffset += destWidth; } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index e5820803cb94..737fc84bfc5c 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 imageWidth, int16 imageHeight, int16 destinationX, int16 destinationY, const Common::Rect &subRect, bool wrap); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint16 destWidth); void generateRenderTable(); void setPanoramaFoV(float fov); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 85e357e80fd3..f8580703caf3 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -69,7 +69,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); - _renderManager = new RenderManager(_system, _workingWindow, _pixelFormat); + _renderManager = new RenderManager(_system, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat); debug("ZVision::ZVision"); } @@ -141,6 +141,9 @@ Common::Error ZVision::run() { _renderManager->update(deltaTime); _scriptManager->update(deltaTime); + // Render the backBuffer to the screen + _renderManager->renderBackbufferToScreen(); + // Update the screen _system->updateScreen(); From 6ce62475ca19e4c395ad0e341d9875fb8825fde4 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:29:48 -0500 Subject: [PATCH 0841/1332] ZVISION: Disable saving until it can be fixed --- engines/zvision/script_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index d5fcf81ed504..84d39ffe0668 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -272,7 +272,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, debug("Changing location to: %c %c %c %c %u", world, room, node, view, offset); // Auto save - _engine->getSaveManager()->autoSave(); + //_engine->getSaveManager()->autoSave(); // Clear all the containers _referenceTable.clear(); From b6366a2697f9d604fbb19ed38f1a1e51cf0d2b7f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:45:41 -0500 Subject: [PATCH 0842/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/render_table.cpp | 18 +++++++++--------- engines/zvision/render_table.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index c72775b1ab73..3e7a86e348db 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -100,24 +100,24 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint16 destWidth) { +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth) { uint32 destColumnOffset = 0; - for (int16 y = 0; y < _numRows; y++) { - int32 sourceColumnOffset = y * _numColumns; + for (uint32 y = 0; y < _numRows; y++) { + uint32 sourceColumnOffset = y * _numColumns; - for (int16 x = 0; x < _numColumns; x++) { - int32 index = sourceColumnOffset + x; + for (uint32 x = 0; x < _numColumns; x++) { + uint32 index = sourceColumnOffset + x; // RenderTable only stores offsets from the original coordinates - int32 sourceYIndex = y + _internalBuffer[index].y; - int32 sourceXIndex = x + _internalBuffer[index].x; + uint32 sourceYIndex = y + _internalBuffer[index].y; + uint32 sourceXIndex = x + _internalBuffer[index].x; // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, _numRows - 1); + sourceYIndex = CLIP(sourceYIndex, 0, _numRows - 1); // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, _numColumns - 1); + sourceXIndex = CLIP(sourceXIndex, 0, _numColumns - 1); destBuffer[destColumnOffset + x] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 737fc84bfc5c..ba3c7d2f5d65 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint16 destWidth); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth); void generateRenderTable(); void setPanoramaFoV(float fov); From 2840ce750eee4409dc4926d57dbe686640cac625 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:46:25 -0500 Subject: [PATCH 0843/1332] ZVISION: Save the Puzzle key, since ChangeLocation could be called Which wipes all the puzzles --- engines/zvision/script_manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 84d39ffe0668..860697c61e30 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -174,6 +174,8 @@ void ScriptManager::checkPuzzleCriteria() { if (puzzle->criteriaList.empty() || criteriaMet) { debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); + uint32 key = puzzle->key; + bool shouldContinue = true; for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { shouldContinue = shouldContinue && (*resultIter)->execute(_engine); @@ -183,7 +185,7 @@ void ScriptManager::checkPuzzleCriteria() { } // Set the puzzle as completed - setStateValue(puzzle->key, 1); + setStateValue(key, 1); if (!shouldContinue) { break; From e92e3c5b0b59869a78a41fe1013ed73ab6ac59fe Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:47:49 -0500 Subject: [PATCH 0844/1332] ZVISION: Delete action_node --- engines/zvision/action_node.cpp | 33 --------------------------- engines/zvision/action_node.h | 36 ------------------------------ engines/zvision/actions.cpp | 1 - engines/zvision/module.mk | 1 - engines/zvision/script_manager.cpp | 1 - 5 files changed, 72 deletions(-) delete mode 100644 engines/zvision/action_node.cpp delete mode 100644 engines/zvision/action_node.h diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp deleted file mode 100644 index eeb89309248c..000000000000 --- a/engines/zvision/action_node.cpp +++ /dev/null @@ -1,33 +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/scummsys.h" - -#include "zvision/action_node.h" -#include "zvision/zvision.h" -#include "zvision/script_manager.h" - -namespace ZVision { - - - -} // End of namespace ZVision diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h deleted file mode 100644 index c9beb7b38e9c..000000000000 --- a/engines/zvision/action_node.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. - * - */ - -#ifndef ZVISION_ACTION_NODE_H -#define ZVISION_ACTION_NODE_H - -#include "common/types.h" - -#include "zvision/control.h" - -namespace ZVision { - - - -} // End of namespace ZVision - -#endif diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 4c532ebf9db9..2a0a72be2075 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -30,7 +30,6 @@ #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" -#include "zvision/action_node.h" #include "zvision/zork_raw.h" #include "zvision/zork_avi_decoder.h" #include "zvision/timer_node.h" diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index c8c60ca8cede..c916ab81d318 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -1,7 +1,6 @@ MODULE := engines/zvision MODULE_OBJS := \ - action_node.o \ actions.o \ animation.o \ clock.o \ diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 860697c61e30..0af1ff131ab0 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -33,7 +33,6 @@ #include "zvision/cursor_manager.h" #include "zvision/save_manager.h" #include "zvision/actions.h" -#include "zvision/action_node.h" #include "zvision/utility.h" namespace ZVision { From 558a987143a23826c25779f2a8c139130bf341c0 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:48:15 -0500 Subject: [PATCH 0845/1332] ZVISION: Fix accidental signed read from save file header --- engines/zvision/save_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 9611b9c9b78e..595a0525c7c0 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -147,7 +147,7 @@ Common::Error SaveManager::loadGame(uint slot) { } bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { - if (in->readSint32BE() != SAVEGAME_ID) { + if (in->readUint32BE() != SAVEGAME_ID) { warning("File is not a ZVision save file. Aborting load"); return false; } From db83d1b5e58e461051ec3d74efa89f332ddae1f9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 6 Sep 2013 22:49:03 -0500 Subject: [PATCH 0846/1332] ZVISION: Actually use the converted color instead of the old one --- engines/zvision/render_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 6c0e8d24f6eb..b10a35d531aa 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -98,7 +98,7 @@ void RenderManager::clearWorkingWindowTo555Color(uint16 color) { uint16 *bufferPtr = (uint16 *)_workingWindowBuffer.getPixels(); for (uint32 i = 0; i < workingWindowSize; i++) { - bufferPtr[i] = color; + bufferPtr[i] = colorIn565; } } From e859e17e3b7753fdae839cd78f04a9370b85bb40 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 09:00:34 +0200 Subject: [PATCH 0847/1332] AVALANCHE: Janitorial - Remove trailing spaces, fix define names --- engines/avalanche/acci2.cpp | 68 ++++++++++++++-------------- engines/avalanche/acci2.h | 6 +-- engines/avalanche/avalanche.cpp | 32 ++++++------- engines/avalanche/avalanche.h | 10 ++--- engines/avalanche/avalot.cpp | 12 ++--- engines/avalanche/avalot.h | 6 +-- engines/avalanche/celer2.cpp | 24 +++++----- engines/avalanche/celer2.h | 6 +-- engines/avalanche/closing2.h | 6 +-- engines/avalanche/color.h | 6 +-- engines/avalanche/dropdown2.cpp | 56 +++++++++++------------ engines/avalanche/dropdown2.h | 6 +-- engines/avalanche/enid2.cpp | 6 +-- engines/avalanche/enid2.h | 6 +-- engines/avalanche/graphics.cpp | 38 ++++++++-------- engines/avalanche/graphics.h | 12 ++--- engines/avalanche/gyro2.cpp | 16 +++---- engines/avalanche/gyro2.h | 24 +++++----- engines/avalanche/lucerna2.cpp | 80 ++++++++++++++++----------------- engines/avalanche/lucerna2.h | 6 +-- engines/avalanche/parser.cpp | 4 +- engines/avalanche/parser.h | 8 ++-- engines/avalanche/pingo2.h | 6 +-- engines/avalanche/roomnums.h | 8 ++-- engines/avalanche/scrolls2.cpp | 26 +++++------ engines/avalanche/scrolls2.h | 10 ++--- engines/avalanche/sequence2.cpp | 6 +-- engines/avalanche/sequence2.h | 6 +-- engines/avalanche/timeout2.cpp | 8 ++-- engines/avalanche/timeout2.h | 10 ++--- engines/avalanche/trip6.cpp | 50 ++++++++++----------- engines/avalanche/trip6.h | 60 ++----------------------- engines/avalanche/visa2.cpp | 6 +-- engines/avalanche/visa2.h | 6 +-- 34 files changed, 293 insertions(+), 347 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2df42e4542d7..882fc3d3ed26 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -190,7 +190,7 @@ const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { {255, "SOME"}, {255, "AND"}, {255, "THAT"}, {255, "POCUS"}, {255, "HIS"}, {255, "THIS"}, {255, "SENTINEL"} // for "Ken SENT Me" -}; +}; Acci::Acci(AvalancheEngine *vm) { _vm = vm; @@ -210,7 +210,7 @@ void Acci::clearWords() { byte Acci::wordNum(Common::String word) { if (word.empty()) return 0; - + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { if (kVocabulary[i]._word == word) return kVocabulary[i]._number; @@ -258,7 +258,7 @@ Common::String Acci::rank() { Common::String Acci::totalTime() { // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. - const double ticksInOneSec = (double)(65535) / 3600; + const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; h = _vm->_gyro->_dna._totalTime / ticksInOneSec; // No. of seconds. @@ -302,7 +302,7 @@ void Acci::stripPunctuation(Common::String &word) { -void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { +void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { if (target == kPardon) { ambiguous = true; if (animate) @@ -314,7 +314,7 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getName(target) + " }"); else { Common::String z = _vm->_gyro->getItem(target); - if (z != "") + if (z != "") _vm->_scrolls->display(Common::String("{ ") + z + " }"); } } @@ -357,7 +357,7 @@ void Acci::properNouns() { if (_vm->_parser->_inputText[i] == ' ') _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); } - + // And the first character as well. _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); } @@ -365,7 +365,7 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + '.' + _vm->_scrolls->kControlSpeechBubble + _vm->_scrolls->kControlRegister + '2'); } @@ -378,7 +378,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_parser->_inputText.deleteChar(0); while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - + _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { @@ -428,7 +428,7 @@ void Acci::parse() { // First parsing - word identification if (!_thats.empty()) _thats.clear(); - + byte n = 0; _polite = false; _verb = kPardon; @@ -512,7 +512,7 @@ void Acci::parse() { } } - if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) + if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; else if (!_unknown.empty()) _unknown.clear(); @@ -521,7 +521,7 @@ void Acci::parse() { replace(Common::String('\xFF'), 0); // zap noise words replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine" - replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" + replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" replace(Common::String('\x4') + '\xE7', 17); // "get down" = "stand"... well, why not? replace(Common::String('\x12') + '\xE4', 2); // "go in" = "open [door]" replace(Common::String('\x1C') + '\xE5', 253); // "P' off" is a swear word @@ -538,14 +538,14 @@ void Acci::parse() { switch (_vm->_gyro->_dna._room) { case r__aylesoffice: replace(Common::String('\xCB'), 163); // Monk = Ayles - break; + break; case r__musicroom: replace(Common::String('\xCB'), 166); // Monk = Jacques - break; + break; default: replace(Common::String('\xCB'), 162); // Monk = Ibythneth } - + if (doPronouns()) { _vm->_gyro->_weirdWord = true; _thats = kNothing; @@ -556,7 +556,7 @@ void Acci::parse() { if (!_vm->_gyro->_subject.empty()) _vm->_gyro->_subject.clear(); _vm->_gyro->_subjectNum = 0; // Find subject of conversation. - + for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { _vm->_gyro->_subjectNum = (byte)_thats[i]; @@ -618,7 +618,7 @@ void Acci::parse() { } } -void Acci::examineObject() { +void Acci::examineObject() { if (_thing != _vm->_gyro->_thinks) _vm->_lucerna->thinkabout(_thing, _vm->_gyro->kThing); switch (_thing) { @@ -626,7 +626,7 @@ void Acci::examineObject() { switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_visa->dixi('t', 1); // Normal examine wine scroll - break; + break; case 2: _vm->_visa->dixi('d', 6); // Bad wine break; @@ -640,7 +640,7 @@ void Acci::examineObject() { _vm->_visa->dixi('q', 21); // Yucky onion. else _vm->_visa->dixi('t', 18); // Normal onion scroll - break; + break; default: _vm->_visa->dixi('t', _thing); // <<< Ordinarily } @@ -680,8 +680,8 @@ void Acci::exampers() { } // Otherwise... _vm->_visa->dixi('p', _person); - } - + } + // And afterwards... if ((_person == 14) && (!_vm->_gyro->_dna._aylesIsAwake)) _vm->_visa->dixi('Q', 13); @@ -697,7 +697,7 @@ bool Acci::holding() { _vm->_scrolls->display("Be reasonable!"); else if (!_vm->_gyro->_dna._objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_scrolls->display("You're not holding it, Avvy."); - else + else holdingResult = true; return holdingResult; @@ -821,7 +821,7 @@ void Acci::swallow() { // Eat something. void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - + for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) numPeople++; @@ -878,13 +878,13 @@ void Acci::lookAround() { switch (_vm->_gyro->_dna._catacombY * 256 + _vm->_gyro->_dna._catacombX) { case 258 : _vm->_visa->dixi('q', 80); // Inside art gallery. - break; + break; case 514 : _vm->_visa->dixi('q', 81); // Outside ditto. break; case 260 : _vm->_visa->dixi('q', 82); // Outside Geida's room. - break; + break; } break; default: @@ -892,9 +892,9 @@ void Acci::lookAround() { } } -void Acci::openDoor() { +void Acci::openDoor() { // Special cases. - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_dna._room) { case r__yours: if (_vm->_trip->infield(2)) { // Opening the box. @@ -925,7 +925,7 @@ void Acci::openDoor() { _vm->_visa->dixi('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: - _vm->_trip->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte + _vm->_trip->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte ); break; @@ -940,7 +940,7 @@ void Acci::openDoor() { _vm->_trip->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); break; } - + return; } } @@ -1049,7 +1049,7 @@ void Acci::goToCauldron() { * Check is it's possible to give something to Spludwick * @remarks Originally called 'give2spludwick' */ -bool Acci::giveToSpludwick() { +bool Acci::giveToSpludwick() { if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick] != _thing) { notInOrder(); return false; @@ -1468,7 +1468,7 @@ void Acci::doThat() { winSequence(); else _vm->_visa->dixi('q', 77); // That Geida woman! - break; + break; default: heyThanks(); } @@ -1620,7 +1620,7 @@ void Acci::doThat() { _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); } - break; + break; case r__musicroom: playHarp(); break; @@ -1801,7 +1801,7 @@ void Acci::doThat() { } } else _vm->_visa->dixi('D', 5); // Go to the bar! - break; + break; case r__outsideducks: if (_vm->_trip->infield(6)) { @@ -1832,7 +1832,7 @@ void Acci::doThat() { case r__nottspub: _vm->_visa->dixi('n', 15); // Can't sell to southerners. - break; + break; default: _vm->_visa->dixi('D', 0); // Can't buy that. } @@ -1972,7 +1972,7 @@ void Acci::doThat() { _vm->_scrolls->display("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: - _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + + _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; default: diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 9004fc6ad58e..ed44a758bd84 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -27,8 +27,8 @@ /* ACCIDENCE II The parser. */ -#ifndef ACCI2_H -#define ACCI2_H +#ifndef AVALANCHE_ACCI2_H +#define AVALANCHE_ACCI2_H #include "common/scummsys.h" #include "common/str.h" @@ -132,4 +132,4 @@ class Acci { } // End of namespace Avalanche. -#endif // ACCI2_H +#endif // AVALANCHE_ACCI2_H diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 9347b7762b73..9fd802d30a4a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -51,7 +51,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); - _rnd->setSeed(42); + _rnd->setSeed(42); } AvalancheEngine::~AvalancheEngine() { @@ -238,7 +238,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _gyro->_dna._spareEvening += actChr; } } - + sz.syncAsSint32LE(_gyro->_dna._totalTime); sz.syncAsByte(_gyro->_dna._jumpStatus); sz.syncAsByte(_gyro->_dna._mushroomGrowing); @@ -288,7 +288,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } } sz.syncAsByte(spriteNum); - + if (sz.isLoading()) { for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites. if (_trip->tr[i].quick) @@ -299,8 +299,8 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { for (byte i = 0; i < spriteNum; i++) { sz.syncAsByte(_trip->tr[i].whichsprite); sz.syncAsByte(_trip->tr[i].check_me); - - + + if (sz.isLoading()) { _trip->tr[i].quick = true; _trip->tr[i].init(_trip->tr[i].whichsprite, _trip->tr[i].check_me, _trip); @@ -379,7 +379,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { Common::Serializer sz(NULL, f); synchronize(sz); - + f->finalize(); delete f; @@ -465,7 +465,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _dropdown->setupMenu(); _gyro->_whereIs[0] = _gyro->_dna._room; - + _gyro->_alive = true; _lucerna->objectlist(); @@ -478,7 +478,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _trip->trippancy_link(); _celer->updateBackgroundSprites(); - + _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine @@ -618,14 +618,14 @@ Common::String AvalancheEngine::elmToStr(Elm how) { } void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { - warning("STUB: run(%s)", what.c_str()); + warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. } void AvalancheEngine::getArguments() { // This function should mess around with command line arguments, // but I am not sure if there'll be use of these arguments at all... - warning("STUB: getArguments()"); + warning("STUB: getArguments()"); } void AvalancheEngine::getSlope() { @@ -646,7 +646,7 @@ void AvalancheEngine::dosShell() { } // Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. -bool AvalancheEngine::keyPressed() { +bool AvalancheEngine::keyPressed() { warning("STUB: keyPressed()"); return false; } @@ -663,7 +663,7 @@ void AvalancheEngine::demo() { - + void AvalancheEngine::runAvalot() { bFlightOn(); @@ -681,7 +681,7 @@ Common::Error AvalancheEngine::run() { if (err != Common::kNoError) return err; - + // From bootstrp: @@ -690,7 +690,7 @@ Common::Error AvalancheEngine::run() { getArguments(); getSlope(); - _zoomy = true; + _zoomy = true; // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, // because zoomy's value is given there. Not sure yet what "zoomy" stands for. if (!_zoomy) @@ -702,7 +702,7 @@ Common::Error AvalancheEngine::run() { runAvalot(); // Needed for later implementation!!! Don't remove these comments!!! - + //if (dosexitcode != 77) quit(); // Didn't stop for us. //switch (_storage._operation) { @@ -727,6 +727,6 @@ Common::Error AvalancheEngine::run() { return Common::kNoError; } - + } // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 839618dbc69f..639f4cca3d80 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -25,8 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#ifndef AVALANCHE_H -#define AVALANCHE_H +#ifndef AVALANCHE_AVALANCHE_H +#define AVALANCHE_AVALANCHE_H #include "avalanche/console.h" @@ -90,11 +90,11 @@ class AvalancheEngine : public Engine { AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd); ~AvalancheEngine(); - Common::ErrorCode initialize(); + Common::ErrorCode initialize(); GUI::Debugger *getDebugger(); Common::RandomSource *_rnd; - + const AvalancheGameDescription *_gameDescription; uint32 getFeatures() const; const char *getGameId() const; @@ -172,4 +172,4 @@ class AvalancheEngine : public Engine { } // End of namespace Avalanche -#endif // AVALANCHE_H +#endif // AVALANCHE_AVALANCHE_H diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3d3a7a01fed1..a84d67a7affe 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -61,9 +61,9 @@ Avalot::Avalot(AvalancheEngine *vm) { void Avalot::handleKeyDown(Common::Event &event) { //if (keyboardclick) // click(); - // + // // To be implemented later with the sounds, I assume. - + if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) _vm->_parser->handleFunctionKey(event); @@ -169,7 +169,7 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); - if (loadSlot >= 0) { + if (loadSlot >= 0) { _vm->_gyro->_thinks = 2; // You always have money. _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); @@ -182,8 +182,8 @@ void Avalot::setup() { _vm->_lucerna->fxtoggle(); _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); - _vm->_visa->dixi('q', 83); // Info on the game, etc. - } + _vm->_visa->dixi('q', 83); // Info on the game, etc. + } } @@ -211,7 +211,7 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) _vm->_graphics->_surface.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i].col); for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 00f2edc758db..34a9d9f7ba6a 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -27,8 +27,8 @@ /* AVALOT The kernel of the program. */ -#ifndef AVALOT_H -#define AVALOT_H +#ifndef AVALANCHE_AVALOT_H +#define AVALANCHE_AVALOT_H #include "common/events.h" #include "common/system.h" @@ -50,4 +50,4 @@ class Avalot { } // End of namespace Avalanche -#endif // AVALOT_H +#endif // AVALANCHE_AVALOT_H diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index cd56ead2872c..8e1b13a22e8b 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -83,16 +83,16 @@ void Celer::updateBackgroundSprites() { case 11: case 21: drawBackgroundSprite(-1, -1, 12); // Looks forwards. - break; + break; case 8: case 18: case 28: case 32: drawBackgroundSprite(-1, -1, 11); // Looks at you. - break; + break; case 30: drawBackgroundSprite(-1, -1, 13); // Winks. - break; + break; case 33: _vm->_gyro->_dna._malagauche = 0; break; @@ -103,7 +103,7 @@ void Celer::updateBackgroundSprites() { case 179: case 197: drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. - break; + break; case 182: case 194: drawBackgroundSprite(-1, -1, 6); @@ -113,7 +113,7 @@ void Celer::updateBackgroundSprites() { break; case 199: _vm->_gyro->_dna._dogFoodPos = 177; // Impossible value for this. - break; + break; } if ((_vm->_gyro->_roomTime % 200 >= 0) && (_vm->_gyro->_roomTime % 200 <= 178)) { // Normally. @@ -177,7 +177,7 @@ void Celer::updateBackgroundSprites() { break; case 1: drawBackgroundSprite(-1, -1, 3); // Frame 1: Natural. - break; + break; } } break; @@ -186,10 +186,10 @@ void Celer::updateBackgroundSprites() { switch (_vm->_gyro->_roomTime % 54) { case 20: drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. - break; + break; case 23: drawBackgroundSprite(-1, -1, 2); // Frame 1: Back to normal. - break; + break; } } break; @@ -215,7 +215,7 @@ void Celer::updateBackgroundSprites() { switch (_vm->_gyro->_roomTime % 50) { case 45 : drawBackgroundSprite(-1, -1, 9); // Spurge blinks. - break; + break; case 49 : drawBackgroundSprite(-1, -1, 10); break; @@ -279,7 +279,7 @@ void Celer::loadBackgroundSprites(byte number) { for (byte i = 0; i < _spriteNum; i++) { f.seek(_offsets[i]); - + SpriteType sprite; sprite._type = PictureType(f.readByte()); sprite._x = f.readSint16LE(); @@ -289,7 +289,7 @@ void Celer::loadBackgroundSprites(byte number) { sprite._size = f.readSint32LE(); bool natural = f.readByte(); bool memorize = f.readByte(); - + if (memorize) { _sprites[i]._x = sprite._x; _sprites[i]._xl = sprite._xl; @@ -299,7 +299,7 @@ void Celer::loadBackgroundSprites(byte number) { if (natural) { _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back. - _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; + _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 674f6e162188..47a11bfad495 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -27,8 +27,8 @@ /* CELER The unit for updating the screen pics. */ -#ifndef CELER2_H -#define CELER2_H +#ifndef AVALANCHE_CELER2_H +#define AVALANCHE_CELER2_H #include "common/scummsys.h" #include "common/file.h" @@ -78,4 +78,4 @@ class Celer { } // End of namespace Avalanche. -#endif // CELER2_H +#endif // AVALANCHE_CELER2_H diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index 89e2d7358a05..e1bf8b2cab4b 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -27,8 +27,8 @@ /* CLOSING The closing screen and error handler. */ -#ifndef CLOSING2_H -#define CLOSING2_H +#ifndef AVALANCHE_CLOSING2_H +#define AVALANCHE_CLOSING2_H #include "common/scummsys.h" #include "common/str.h" @@ -68,4 +68,4 @@ class Closing { } // End of namespace Avalanche. -#endif // CLOSING2_H +#endif // AVALANCHE_CLOSING2_H diff --git a/engines/avalanche/color.h b/engines/avalanche/color.h index c0c348f9ab0d..e9f9c460bce2 100644 --- a/engines/avalanche/color.h +++ b/engines/avalanche/color.h @@ -27,8 +27,8 @@ // Color constants replacing the colors from the CRT unit of Pascal -#ifndef COLOR_H -#define COLOR_H +#ifndef AVALANCHE_COLOR_H +#define AVALANCHE_COLOR_H #include "common/system.h" @@ -55,4 +55,4 @@ enum Color { } // End of namespace Avalanche -#endif // COLOR_H +#endif // AVALANCHE_COLOR_H diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 10cefa13b26c..1d3a0235d40c 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -54,7 +54,7 @@ void HeadType::init(char trig, char altTrig, Common::String title, byte pos, Dro } void HeadType::draw() { - CursorMan.showMouse(false); + CursorMan.showMouse(false); _dr->drawMenuText(_xpos, 1, _trigger, _title, true, false); CursorMan.showMouse(true); } @@ -67,17 +67,17 @@ void HeadType::highlight() { warning("STUB: Dropdown::headytpe::highlight()"); _dr->drawMenuText(_xpos, 1, _trigger, _title, true, true); - + _dr->_activeMenuItem._left = _xpos; _dr->_activeMenuItem._activeNow = true; _dr->_vm->_gyro->_dropdownActive = true; _dr->_activeMenuItem._activeNum = _position; - + _dr->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { - if (key != _altTrigger) + if (key != _altTrigger) return true; return false; } @@ -118,7 +118,7 @@ void MenuItem::displayOption(byte y, bool highlit) { else backgroundColor = 7; _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); - + Common::String text = _options[y]._title; while (text.size() + _options[y]._shortcut.size() < _width) text += ' '; // Pad _options[y] with spaces. @@ -146,7 +146,7 @@ void MenuItem::display() { displayOption(0, true); for (byte y = 1; y < _optionNum; y++) displayOption(y, false); - + _dr->_vm->_gyro->_defaultLed = 1; _dr->_vm->_gyro->_currentMouse = 177; //mousepage(cp); @@ -155,8 +155,8 @@ void MenuItem::display() { void MenuItem::wipe() { //setactivepage(cp); - CursorMan.showMouse(false); - + CursorMan.showMouse(false); + _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); _activeNow = false; @@ -164,7 +164,7 @@ void MenuItem::wipe() { _firstlix = false; _dr->_vm->_gyro->_defaultLed = 2; - CursorMan.showMouse(true); + CursorMan.showMouse(true); } void MenuItem::moveHighlight(int8 inc) { @@ -176,15 +176,15 @@ void MenuItem::moveHighlight(int8 inc) { _highlightNum = highlightNum; } //setactivepage(cp); - CursorMan.showMouse(false); + CursorMan.showMouse(false); displayOption(_oldY, false); displayOption(_highlightNum, true); //setactivepage(1 - cp); _oldY = _highlightNum; - CursorMan.showMouse(true); + CursorMan.showMouse(true); } -void MenuItem::lightUp(Common::Point cursorPos) { +void MenuItem::lightUp(Common::Point cursorPos) { if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) return; _highlightNum = (cursorPos.y - 26) / 20; @@ -193,7 +193,7 @@ void MenuItem::lightUp(Common::Point cursorPos) { moveHighlight(0); } -void MenuItem::select(byte which) { +void MenuItem::select(byte which) { if (!_options[which]._valid) return; @@ -235,7 +235,7 @@ void MenuBar::draw() { const ByteField menuspace = {0, 0, 80, 9}; //setactivepage(3); - + _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); byte savecp = _dr->_vm->_gyro->_cp; @@ -343,7 +343,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, } _vm->_graphics->drawText(_vm->_graphics->_surface, text, font, 8, x * 8, y, fontColor); - + // Underline the selected character. if (!text.contains(trigger)) return; @@ -351,7 +351,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, byte i; for (i = 0; text[i] != trigger; i++) ; // Search for the character in the string. - + byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; @@ -508,7 +508,7 @@ void Dropdown::setupMenuWith() { // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - + if ((_vm->_gyro->_lastPerson == _vm->_gyro->kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_dna._room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. @@ -680,25 +680,25 @@ void Dropdown::runMenuWith() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } - break; + break; case 103: { // Cider _vm->_acci->_thing = 103; _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } - break; + break; case 104: { // Mead _vm->_acci->_thing = 107; _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } - break; + break; case 105: { // Onion (trader) _vm->_acci->_thing = 67; _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); return; } - break; + break; default: { _vm->_acci->_person = _vm->_acci->_thing; _vm->_acci->_thing = 254; @@ -709,7 +709,7 @@ void Dropdown::runMenuWith() { _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); } -void Dropdown::setupMenu() { +void Dropdown::setupMenu() { _menuBar.init(this); _activeMenuItem.init(this); @@ -730,13 +730,13 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); - do + do _vm->updateEvents(); while (_vm->_lucerna->holdLeftMouse); - + while (!_vm->shouldQuit()) { - do { + do { _vm->updateEvents(); // We updadte the cursor's picture. @@ -768,14 +768,14 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). - } + } } else { // Clicked on menu bar. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); _vm->_graphics->_surface.copyFrom(backup); _vm->_graphics->refreshScreen(); - + if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_lucerna->holdLeftMouse = false; @@ -787,7 +787,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... } } } - + // NOT clicked button... if ((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1)))) { diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown2.h index 4122d3fae4fb..95e258effbd2 100644 --- a/engines/avalanche/dropdown2.h +++ b/engines/avalanche/dropdown2.h @@ -27,8 +27,8 @@ /* DROPDOWN A customised version of Oopmenu (qv). */ -#ifndef DROPDOWN2_H -#define DROPDOWN2_H +#ifndef AVALANCHE_DROPDOWN2_H +#define AVALANCHE_DROPDOWN2_H #include "avalanche/color.h" @@ -164,4 +164,4 @@ class Dropdown { } // End of namespace Avalanche. -#endif // DROPDOWN2_H +#endif // AVALANCHE_DROPDOWN2_H diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index a22a205aaad2..7cf4075d1ad1 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -77,7 +77,7 @@ void Enid::expandMonthName(Common::String x) { Common::String Enid::expandDate(byte d, byte m, uint16 y) { const Common::String months[12] = { "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", - "Septem*", "Octo*", "Novem*", "Decem*" + "Septem*", "Octo*", "Novem*", "Decem*" }; Common::String expanddate_result; @@ -162,11 +162,11 @@ void Enid::showHeader() { _vm->_scrolls->display(Common::String("Dir: ") + _path + "\r\r\4"); } -void Enid::avvyBackground() { +void Enid::avvyBackground() { // Not really a filing procedure, // but it's only called just before edna_load, so I thought I'd put it // in Enid instead of, say, Lucerna. - + #if 0 port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. } diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h index 1cf14d10def0..97e249e187d1 100644 --- a/engines/avalanche/enid2.h +++ b/engines/avalanche/enid2.h @@ -27,8 +27,8 @@ /* ENID Edna's manager. Loads/saves files. */ -#ifndef ENID2_H -#define ENID2_H +#ifndef AVALANCHE_ENID2_H +#define AVALANCHE_ENID2_H #include "common/scummsys.h" @@ -75,4 +75,4 @@ class Enid { } // End of namespace Avalanche. -#endif // ENID2_H +#endif // AVALANCHE_ENID2_H diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index df310500f8f6..6058b006bffd 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -102,25 +102,25 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, stAngle = stAngle % 361; endAngle = endAngle % 361; - // If impossible angles, then swap them! + // If impossible angles, then swap them! if (endAngle < stAngle) { uint16 tmpAngle=endAngle; endAngle=stAngle; stAngle=tmpAngle; } - // Approximate the number of pixels required by using the circumference equation of an ellipse. + // Approximate the number of pixels required by using the circumference equation of an ellipse. uint16 numOfPixels = (uint16)floor(sqrt(3.0) * sqrt(pow(double(xRadius), 2) + pow(double(yRadius), 2)) + 0.5); // Calculate the angle precision required. double delta = 90.0 / numOfPixels; - // Always just go over the first 90 degrees. Could be optimized a - // bit if startAngle and endAngle lie in the same quadrant, left as an - // exercise for the reader. :) + // Always just go over the first 90 degrees. Could be optimized a + // bit if startAngle and endAngle lie in the same quadrant, left as an + // exercise for the reader. :) double j = 0; - // Calculate stop position, go 1 further than 90 because otherwise 1 pixel is sometimes not drawn. + // Calculate stop position, go 1 further than 90 because otherwise 1 pixel is sometimes not drawn. uint16 deltaEnd = 91; // Set the end point. @@ -128,7 +128,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, endPoint.x = (int16)floor(xRadius * cos(tempTerm) + 0.5) + x; endPoint.y = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5) + y; - // Calculate points. + // Calculate points. int16 xNext = xRadius; int16 yNext = 0; do { @@ -136,7 +136,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 yTemp = yNext; // This is used by both sin and cos. tempTerm = (j + delta) * convfac; - + xNext = (int16)floor(xRadius * cos(tempTerm) + 0.5); yNext = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5); @@ -145,18 +145,18 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 yp = y + yTemp; int16 ym = y - yTemp; - if ((j >= stAngle) && (j <= endAngle)) + if ((j >= stAngle) && (j <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,yp) = color; - if (((180-j) >= stAngle) && ((180-j) <= endAngle)) + if (((180-j) >= stAngle) && ((180-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,yp) = color; - if (((j+180) >= stAngle) && ((j+180) <= endAngle)) + if (((j+180) >= stAngle) && ((j+180) <= endAngle)) *(byte *)_scrolls.getBasePtr(xm,ym) = color; - if (((360-j) >= stAngle) && ((360-j) <= endAngle)) + if (((360-j) >= stAngle) && ((360-j) <= endAngle)) *(byte *)_scrolls.getBasePtr(xp,ym) = color; - + j += delta; } while (j <= deltaEnd); @@ -208,7 +208,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < fontHeight; j++) { - byte pixel = font[(byte)text[i]][j]; + byte pixel = font[(byte)text[i]][j]; for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) @@ -236,7 +236,7 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); - } + } } } } @@ -258,7 +258,7 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u for (byte i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); - } + } } } } @@ -285,7 +285,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 for (byte bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); - } + } } } } @@ -304,8 +304,8 @@ void Graphics::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { for (uint16 x = 0; x < _screen.w; x++) { - for (byte j = 0; j < 2; j++) - *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); + for (byte j = 0; j < 2; j++) + *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); } } // Now we copy the stretched picture to the screen. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ad6a68252b8f..a94ed77112dc 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -25,8 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#ifndef GRAPHICS_H -#define GRAPHICS_H +#ifndef AVALANCHE_GRAPHICS_H +#define AVALANCHE_GRAPHICS_H #include "common/file.h" @@ -38,7 +38,7 @@ class AvalancheEngine; typedef byte FontType[256][16]; // raw font type -typedef byte ManiType[2049]; // manitype = array[5..2053] of byte; +typedef byte ManiType[2049]; // manitype = array[5..2053] of byte; // Be aware!!! typedef byte SilType[51][11]; // 35, 4 @@ -69,12 +69,12 @@ class Graphics { ~Graphics(); void init(); void fleshColors(); - + // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) // TODO: Make it more accurate later. Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); - + void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); void drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color); void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color); @@ -100,4 +100,4 @@ class Graphics { } // End of namespace Avalanche -#endif // GRAPHICS_H +#endif // AVALANCHE_GRAPHICS_H diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 398e4a8624ad..1fd906d48d3b 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -119,7 +119,7 @@ const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroo // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Gyro::kQuasipeds[16] = { - {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). {3, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). {3, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). @@ -234,7 +234,7 @@ void Gyro::shadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { warning("STUB: Gyro::shbox()"); } -void Gyro::newGame() { +void Gyro::newGame() { for (byte gm = 0; gm < kMaxSprites; gm++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); @@ -259,7 +259,7 @@ void Gyro::newGame() { _dna._objects[kObjectBodkin - 1] = true; _dna._objects[kObjectBell - 1] = true; _dna._objects[kObjectClothes - 1] = true; - + _thinkThing = true; _thinks = 2; _vm->_lucerna->objectlist(); @@ -293,7 +293,7 @@ void Gyro::newGame() { _vm->_lucerna->sprite_run(); } -void Gyro::click() { +void Gyro::click() { warning("STUB: Gyro::click()"); } @@ -326,7 +326,7 @@ bool Gyro::updateMoney(uint16 howmuchby) { // There'll may be problems with calling these functions because of the conversion of the arrays!!! // Keep an eye open! -Common::String Gyro::getName(byte whose) { +Common::String Gyro::getName(byte whose) { static const Common::String kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", @@ -350,7 +350,7 @@ byte Gyro::getNameChar(byte whose) { assert((whose > 150) && (whose < 179)); - if (whose < 175) + if (whose < 175) return kLadChar[whose - 150]; else return kLassChar[whose - 175]; @@ -461,7 +461,7 @@ Common::String Gyro::f5Does() { return Common::String(_vm->_acci->kVerbCodeStand) + "GGet up"; } break; - case r__insidecardiffcastle: + case r__insidecardiffcastle: if (_dna._standingOnDais) return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb down"; else @@ -505,7 +505,7 @@ void Gyro::loadMouse(byte which) { for (byte k = 0; k < 2; k++) if (*(byte *)mask.getBasePtr(i, j) == 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; - + mask.free(); // The OR mask. diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 75dc50c72076..ca367cd66f19 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -27,8 +27,8 @@ /* GYRO It all revolves around this bit! */ -#ifndef GYRO2_H -#define GYRO2_H +#ifndef AVALANCHE_GYRO2_H +#define AVALANCHE_GYRO2_H #include "common/str.h" #include "common/scummsys.h" @@ -49,7 +49,7 @@ static const int16 kCarryLimit = 12; // carry limit static const int16 kNumlockCode = 32; // Code for Num Lock static const int16 kMouseSize = 134; -struct MouseHotspotType { // mouse-void +struct MouseHotspotType { // mouse-void int16 _horizontal, _vertical; }; @@ -115,7 +115,7 @@ struct DnaType { // Ux, uy, & ww now all belong to Trip5 byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? + bool _mushroomGrowing; // Is the mushroom growing in 42? bool _spludwickAtHome; // Is Spludwick at home? @@ -298,7 +298,7 @@ class Gyro { // For Thinkabout: static const bool kThing = true; - static const bool kPerson = false; + static const bool kPerson = false; // Magic/portal constants: enum Magics { @@ -310,7 +310,7 @@ class Gyro { kMagicSpecial, // Special function. kMagicOpenDoor // Opening door. }; - + // These following static constants should be included in CFG when it's written. static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. @@ -331,7 +331,7 @@ class Gyro { static const bool kDemo = false; // If this is true, we're in a demo of the game. static const char kSpludwicksOrder[3]; - + static const QuasipedType kQuasipeds[16]; enum Pitch { @@ -353,13 +353,13 @@ class Gyro { // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; - + static byte _whereIs[29]; // Variable static constant for overriding the ability of On to switch pages. // You may know better than On which page to switch to. - bool _onCanDoPageSwap; - + bool _onCanDoPageSwap; + @@ -489,7 +489,7 @@ class Gyro { private: AvalancheEngine *_vm; - + // CHECKME: Useless? // static const char kItemsChar[]; void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); @@ -497,4 +497,4 @@ class Gyro { } // End of namespace Avalanche -#endif // GYRO2_H +#endif // AVALANCHE_GYRO2_H diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 81dc45875dd5..47f838214307 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -80,7 +80,7 @@ void Lucerna::init() { _vm->_gyro->atkey = "alt-"; #endif } - + /** * Call a given Verb * @remarks Originally called 'callverb' @@ -101,7 +101,7 @@ void Lucerna::callVerb(byte id) { void Lucerna::draw_also_lines() { byte ff; - + CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); @@ -119,7 +119,7 @@ void Lucerna::draw_also_lines() { -// nextstring, scram1 and unscrable are only used in load_also +// nextstring, scram1 and unscrable are only used in load_also Common::String Lucerna::nextstring() { Common::String str; @@ -145,7 +145,7 @@ void Lucerna::unscramble() { void Lucerna::load_also(Common::String n) { byte ff, fv; - + for (fv = 0; fv < 31; fv++) for (ff = 0; ff < 2; ff++) if (_vm->_gyro->_also[fv][ff] != 0) { @@ -170,9 +170,9 @@ void Lucerna::load_also(Common::String n) { } *_vm->_gyro->_also[fv][0] = Common::String('\x9D') + *_vm->_gyro->_also[fv][0] + Common::String('\x9D'); } - + memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); - + //fv = getpixel(0, 0); _vm->_gyro->_lineNum = f.readByte(); for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { @@ -217,7 +217,7 @@ void Lucerna::load_also(Common::String n) { _vm->_gyro->_listen.clear(); for (byte i = 0; i < listen_length; i++) _vm->_gyro->_listen += f.readByte(); - + draw_also_lines(); //setactivepage(1); @@ -231,9 +231,9 @@ void Lucerna::load_also(Common::String n) { void Lucerna::load(byte n) { // Load2, actually Common::String xx; - + CursorMan.showMouse(false); - + _vm->_graphics->fleshColors(); xx = _vm->_gyro->intToStr(n); @@ -380,10 +380,10 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->_roomTime = 0; - + if ((_vm->_gyro->_dna._lastRoom == r__map) && (_vm->_gyro->_dna._lastRoomNotMap != _vm->_gyro->_dna._room)) new_town(); - + switch (x) { case r__yours: @@ -514,7 +514,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->_dna._tiedUp) _vm->_celer->drawBackgroundSprite(-1, -1, 2); - if (!_vm->_gyro->_dna._mushroomGrowing) + if (!_vm->_gyro->_dna._mushroomGrowing) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); break; @@ -571,17 +571,17 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->_dna._catacombX = 8; _vm->_gyro->_dna._catacombY = 4; } - break; + break; case 5: { // Enter from du Lustie's _vm->_gyro->_dna._catacombX = 8; _vm->_gyro->_dna._catacombY = 7; } - break; + break; case 6: { // Enter from Geida's _vm->_gyro->_dna._catacombX = 4; _vm->_gyro->_dna._catacombY = 1; } - break; + break; } _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; @@ -709,7 +709,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->start_to_close(); } break; - + case r__entrancehall: case r__insideabbey: case r__yourhall: @@ -804,19 +804,19 @@ void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! z = z - 149; if (z >= 25) z -= 8; - if (z == 20) + if (z == 20) z--; // Last time... } f.seek(z * picsize + 65); - + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); picture.free(); - + f.close(); CursorMan.showMouse(false); @@ -829,7 +829,7 @@ void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(thinkspace); - + CursorMan.showMouse(true); _vm->_gyro->_thinkThing = th; } @@ -845,7 +845,7 @@ void Lucerna::load_digits() { // Load the scoring digits & rwlites for (byte fv = 0; fv < 10; fv++) { f.seek(fv * digitsize); - + #if 0 _vm->_gyro->digit[fv] = new byte[digitsize]; f.read(_vm->_gyro->digit[fv], digitsize); @@ -856,7 +856,7 @@ void Lucerna::load_digits() { // Load the scoring digits & rwlites for (byte ff = 0; ff < 9; ff++) { f.seek(10 * digitsize + ff * rwlitesize); - + #if 0 _vm->_gyro->rwlite[ff] = new byte[rwlitesize]; f.read(_vm->_gyro->rwlite[ff], rwlitesize); @@ -875,7 +875,7 @@ void Lucerna::toolbar() { } f.seek(40); - + // off; ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); @@ -915,7 +915,7 @@ void Lucerna::showscore() { //setactivepage(3); for (byte fv = 0; fv < 3; fv++) - if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) + if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[fv]], 250 + (fv + 1) * 15, 177); for (byte fv = 0; fv < 2; fv++) @@ -1008,16 +1008,16 @@ void Lucerna::objectlist() { } void Lucerna::verte(Common::Point cursorPos) { - if (! _vm->_gyro->_dna._userMovesAvvy) + if (! _vm->_gyro->_dna._userMovesAvvy) return; cursorPos.y /= 2; byte what; // _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.) - if (cursorPos.x < _vm->_trip->tr[0].x) + if (cursorPos.x < _vm->_trip->tr[0].x) what = 1; - else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) + else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) what = 2; else what = 0; // On top @@ -1063,7 +1063,7 @@ void Lucerna::verte(Common::Point cursorPos) { void Lucerna::checkclick() { Common::Point cursorPos = _vm->getMousePos(); _vm->_gyro->_onToolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); - + /*if (_vm->_gyro->mrelease > 0) _vm->_gyro->after_the_scroll = false;*/ @@ -1080,7 +1080,7 @@ void Lucerna::checkclick() { } else _vm->_gyro->newMouse(4); // fletch } - + if (holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->_dropsOk) @@ -1185,11 +1185,11 @@ void Lucerna::dawn() { void Lucerna::showrw() { // It's data is loaded in load_digits(). - if (_vm->_gyro->_oldDirection == _vm->_gyro->_dna._direction) + if (_vm->_gyro->_oldDirection == _vm->_gyro->_dna._direction) return; _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; CursorMan.showMouse(false); - + #if 0 for (byte page_ = 0; page_ <= 1; page_++) { setactivepage(page_); @@ -1201,7 +1201,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). CursorMan.showMouse(true); //setactivepage(1 - cp); - + warning("STUB: Lucerna::showrw()"); } @@ -1277,7 +1277,7 @@ void Lucerna::clock_lucerna() { if ((_vm->_gyro->_hours == 0) && (_vm->_gyro->_oh != 0) && (_vm->_gyro->_oh != 17717)) _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); - + _vm->_gyro->_oh = _vm->_gyro->_hours; _vm->_gyro->_onh = nh; _vm->_gyro->_om = _vm->_gyro->_minutes; @@ -1287,11 +1287,11 @@ void Lucerna::clock_lucerna() { void Lucerna::delavvy() { CursorMan.showMouse(false); - + // triptype &with = _vm->_trip->tr[0]; // for (byte page_ = 0; page_ <= 1; page_++) // mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); - + CursorMan.showMouse(true); } @@ -1300,12 +1300,12 @@ void Lucerna::gameover() { int16 sx = _vm->_trip->tr[0].x; int16 sy = _vm->_trip->tr[0].y; - + _vm->_trip->tr[0].done(); _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls _vm->_trip->tr[0].step = 0; _vm->_trip->tr[0].appear(sx, sy, 0); - + _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); _vm->_gyro->_alive = false; @@ -1323,11 +1323,11 @@ void Lucerna::minor_redraw() { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; _vm->_trip->getback(); } - + for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits showscore(); - + dawn(); } @@ -1339,7 +1339,7 @@ uint16 Lucerna::bearing(byte whichped) { byte pedId = whichped - 1; // Different array indexes in Pascal and C. const double rad2deg = 180 / 3.14; // Pi - + if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[pedId]._x) return 0; else if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[pedId]._x) { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index f337d97f7bfe..1436e388b542 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -27,8 +27,8 @@ /* LUCERNA The screen, [keyboard] and mouse handler.*/ -#ifndef LUCERNA2_H -#define LUCERNA2_H +#ifndef AVALANCHE_LUCERNA2_H +#define AVALANCHE_LUCERNA2_H #include "common/scummsys.h" #include "common/file.h" @@ -139,4 +139,4 @@ class Lucerna { } // End of namespace Avalanche -#endif // LUCERNA2_H +#endif // AVALANCHE_LUCERNA2_H diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 5b72ee1289ab..073fdfdc7e8e 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -134,7 +134,7 @@ void Parser::cursorOff() { _cursorState = false; } -void Parser::tryDropdown() { +void Parser::tryDropdown() { warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown. } @@ -162,7 +162,7 @@ void Parser::drawCursor() { void Parser::wipeText() { CursorMan.showMouse(false); cursorOff(); - + _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. _quote = true; diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index e16df6d3bc18..70a87b6ea748 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -25,8 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#ifndef PARSER_H -#define PARSER_H +#ifndef AVALANCHE_PARSER_H +#define AVALANCHE_PARSER_H #include "common/events.h" @@ -41,7 +41,7 @@ class Parser { bool _quote; // 66 or 99 next? byte _leftMargin; bool _cursorState; - + Parser(AvalancheEngine *vm); @@ -77,4 +77,4 @@ class Parser { } // End of namespace Avalanche -#endif // PARSER_H +#endif // AVALANCHE_PARSER_H diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index 962523666086..1228ab2dbd03 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -27,8 +27,8 @@ /* PINGO Full-screen sub-parts of the game. */ -#ifndef PINGO2_H -#define PINGO2_H +#ifndef AVALANCHE_PINGO2_H +#define AVALANCHE_PINGO2_H #include "common/scummsys.h" #include "common/str.h" @@ -64,4 +64,4 @@ class Pingo { } // End of namespace Avalanche. -#endif // PINGO2_H +#endif // AVALANCHE_PINGO2_H diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index 4007504f6e73..e623c27a20ce 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -25,8 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#ifndef ROOMNUMS_H -#define ROOMNUMS_H +#ifndef AVALANCHE_ROOMNUMS_H +#define AVALANCHE_ROOMNUMS_H #include "common/system.h" @@ -80,9 +80,9 @@ const byte r__insidecardiffcastle = 71; //{ -------------- } -const byte r__bosskey = 98; // assumed +const byte r__bosskey = 98; // assumed const byte r__map = 99; } // End of namespace Avalanche -#endif // ROOMNUMS_H +#endif // AVALANCHE_ROOMNUMS_H diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 531794c7705b..d3f76b595c69 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -85,7 +85,7 @@ void Scrolls::easteregg() { void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwriting FontType itw; byte lz = z.size(); - + bool offset = x % 8 == 4; x = x / 8; y++; @@ -130,7 +130,7 @@ void Scrolls::normscroll() { ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! - + Common::Event event; while (!_vm->shouldQuit()) { _vm->_graphics->refreshScreen(); @@ -224,7 +224,7 @@ void Scrolls::music_scroll() { CursorMan.showMouse(true); _vm->_gyro->newMouse(4); - // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. + // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. // For now we act like the player just played the right tone. #if 0 if (they_match(played)) { @@ -239,7 +239,7 @@ void Scrolls::music_scroll() { return; #if 0 } - + _vm->_gyro->screturn = false; CursorMan.showMouse(false); state(0); @@ -261,12 +261,12 @@ void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little. _vm->_lucerna->errorled(); // ring the bell "x" times } -void Scrolls::dodgem() { +void Scrolls::dodgem() { dodgeCoord = _vm->getMousePos(); g_system->warpMouse(dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. } -void Scrolls::undodgem() { +void Scrolls::undodgem() { Common::Point actCoord = _vm->getMousePos(); if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) g_system->warpMouse(dodgeCoord.x, dodgeCoord.y); // No change, so restore the pointer's original position. @@ -357,7 +357,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorLightgray); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); - + // The body of the scroll. _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); @@ -381,7 +381,7 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t // int16 ey = my - ly; mx -= lx; my -= ly + 2; - + centre = false; switch (use_icon) { @@ -525,7 +525,7 @@ void Scrolls::bubble(func2 gotoit) { // "Tail" of the speech bubble. _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->_talkBackgroundColor); - + yl -= 3; // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). @@ -592,7 +592,7 @@ Common::String Scrolls::lsd() { + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); if (_vm->_gyro->_dna._money > 12) x = x + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; - + return x; } @@ -702,7 +702,7 @@ void Scrolls::calldrivers() { // sprites.) _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._x; _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._y; // Position. - + _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[param - 10]._foregroundColor; _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[param - 10]._backgroundColor; // Colors. } else { @@ -722,7 +722,7 @@ void Scrolls::calldrivers() { switch (param) { case 1: display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) - break; + break; case 2: display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum]._word + kControlToBuffer); break; @@ -831,7 +831,7 @@ void Scrolls::loadfont() { for (int16 i = 0; i < 256; i++) f.read(ch[1][i], 16); f.close(); - + if (!f.open("ttsmall.fnt")) { warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); return; diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 362000b153d4..3c1efc92ac2f 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -27,8 +27,8 @@ /* SCROLLS The scroll driver. */ -#ifndef SCROLLS2_H -#define SCROLLS2_H +#ifndef AVALANCHE_SCROLLS2_H +#define AVALANCHE_SCROLLS2_H #include "common/system.h" @@ -67,7 +67,7 @@ class Scrolls { Scrolls(AvalancheEngine *vm); - + void init(); void state(byte x); // Sets "Ready" light to whatever @@ -105,7 +105,7 @@ class Scrolls { int16 dix, diy; - + byte cfont; // Current font Common::Point dodgeCoord; @@ -150,4 +150,4 @@ class Scrolls { } // End of namespace Avalanche -#endif // SCROLLS2_H +#endif // AVALANCHE_SCROLLS2_H diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 15759bd1c0ed..4e51cf91a7fc 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -91,10 +91,10 @@ void Sequence::call_sequencer() { switch (seq[0]) { case 0: return; // No more routines. - break; + break; case 177: // Flip room. _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_trip->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); + _vm->_trip->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); if (seq[0] == 177) shove_left(); break; @@ -105,7 +105,7 @@ void Sequence::call_sequencer() { _vm->_celer->drawBackgroundSprite(-1, -1, seq[0]); shove_left(); } - + start_to_close(); // Make sure this PROC gets called again. } diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h index d93cf426e017..7fcb646fa5ba 100644 --- a/engines/avalanche/sequence2.h +++ b/engines/avalanche/sequence2.h @@ -27,8 +27,8 @@ /* SEQUENCE The sequencer. */ -#ifndef SEQUENCE2_H -#define SEQUENCE2_H +#ifndef AVALANCHE_SEQUENCE2_H +#define AVALANCHE_SEQUENCE2_H #include "common/scummsys.h" @@ -68,4 +68,4 @@ class Sequence { } // End of namespace Avalanche. -#endif // SEQUENCE2_H +#endif // AVALANCHE_SEQUENCE2_H diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index dbb4f80acd70..59c7ed45fb69 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -332,7 +332,7 @@ void Timeout::hang_around2() { _vm->_trip->tr[0].done(); _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. - set_up_timer(1, procafter_the_shootemup, reason_hanging_around); + set_up_timer(1, procafter_the_shootemup, reason_hanging_around); // Immediately call the following proc (when you have a chance). _vm->_gyro->_dna._tiedUp = false; @@ -341,7 +341,7 @@ void Timeout::hang_around2() { } void Timeout::after_the_shootemup() { - + _vm->_trip->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! @@ -614,7 +614,7 @@ void Timeout::arkata_shouts() { return; _vm->_visa->dixi('q', 76); - + set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } @@ -627,7 +627,7 @@ void Timeout::winning() { do { _vm->_lucerna->checkclick(); } while (!(_vm->_gyro->mrelease == 0)); -#endif +#endif // TODO: To be implemented with Pingo::winning_pic(). _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 2bac5a0031d6..0e7be3364020 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -27,8 +27,8 @@ /* TIMEOUT The scheduling unit. */ -#ifndef TIMEOUT2_H -#define TIMEOUT2_H +#ifndef AVALANCHE_TIMEOUT2_H +#define AVALANCHE_TIMEOUT2_H #include "common/scummsys.h" @@ -121,11 +121,11 @@ class Timeout { timetype times[7]; - + bool timerLost; // Is the timer "lost"? (Because of using lose_timer()) - + Timeout(AvalancheEngine *vm); void setParent(AvalancheEngine *vm); @@ -222,4 +222,4 @@ class Timeout { } // End of namespace Avalanche. -#endif // TIMEOUT2_H +#endif // AVALANCHE_TIMEOUT2_H diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index c514734fcb0e..ccaba83088dc 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -44,7 +44,7 @@ #include "common/file.h" namespace Avalanche { - + void triptype::init(byte spritenum, bool do_check, Trip *tr) { _tr = tr; @@ -73,14 +73,14 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { } inf.skip(2); // Replace variable named 'soa' in the original code. - + if (!a.name.empty()) a.name.clear(); byte nameSize = inf.readByte(); - for (byte i = 0; i < nameSize; i++) + for (byte i = 0; i < nameSize; i++) a.name += inf.readByte(); inf.skip(12 - nameSize); - + //inf.skip(1); // Same as above. byte commentSize = inf.readByte(); for (byte i = 0; i < commentSize; i++) @@ -147,9 +147,9 @@ void triptype::original() { void triptype::andexor() { if ((vanishifstill) && (ix == 0) && (iy == 0)) return; - byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). - _tr->_vm->_graphics->drawSprite(_info, picnum, x, y); + _tr->_vm->_graphics->drawSprite(_info, picnum, x, y); } void triptype::turn(byte whichway) { @@ -171,11 +171,11 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { } bool triptype::collision_check() { - for (byte fv = 0; fv < _tr->numtr; fv++) + for (byte fv = 0; fv < _tr->numtr; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + _info._xLength) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) && - (_tr->tr[fv].y == y)) + (_tr->tr[fv].y == y)) return true; return false; @@ -193,7 +193,7 @@ void triptype::walk() { r._y1 = y - 2; r._x2 = ((x + _info._xLength) / 8) + 1; r._y2 = y + _info._yLength + 2; - + _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); } @@ -470,7 +470,7 @@ Trip::~Trip() { void Trip::loadtrip() { for (int16 gm = 0; gm < numtr; gm++) tr[gm].original(); - + for (uint16 i = 0; i < sizeof(aa); i++) aa[i] = 0; } @@ -491,7 +491,7 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { for (fv = x1; fv <= x2; fv++) { for (ff = oy + yl; ff <= y + yl; ff++) { c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); - if (c > a) + if (c > a) a = c; } } @@ -520,7 +520,7 @@ byte Trip::geida_ped(byte which) { case 5: return 9; case 4: - return 10; + return 10; default: return 0; } @@ -539,10 +539,10 @@ void Trip::catamove(byte ped) { // catacombs has a different number for it. - + xy_uint16 = _vm->_gyro->_dna._catacombX + _vm->_gyro->_dna._catacombY * 256; _vm->_gyro->_dna._geidaSpin = 0; - + switch (xy_uint16) { case 1801: // Exit catacombs fliproom(r__lustiesroom, 4); @@ -696,7 +696,7 @@ void Trip::catamove(byte ped) { break; case 0x1: _vm->_celer->drawBackgroundSprite(-1, -1, 22); - + if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicExclaim; else @@ -724,7 +724,7 @@ void Trip::catamove(byte ped) { _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. break; - // LEFT handles: + // LEFT handles: #if 0 case 0x1: _vm->_celer->show_one(-1, -1, 4); @@ -837,7 +837,7 @@ void Trip::catamove(byte ped) { } } - + // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Trip::dawndelay() { @@ -875,7 +875,7 @@ void Trip::call_special(uint16 which) { // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ - + // OK! tr[1].call_eachstep = true; tr[1].eachstep = procarrow_procs; @@ -1005,7 +1005,7 @@ void Trip::call_special(uint16 which) { } } - + void Trip::open_the_door(byte whither, byte ped, byte magicnum) { // This slides the door open. (The data really ought to be saved in @@ -1087,7 +1087,7 @@ void Trip::newspeed() { for (page_ = 0; page_ <= 1; page_++) getset[page_].remember(lightspace); - + } void Trip::rwsp(byte t, byte dir) { @@ -1234,7 +1234,7 @@ void Trip::arrow_procs(byte tripnum) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. } - + } #if 0 @@ -1368,7 +1368,7 @@ void Trip::call_andexors() { } } while (!ok); - + _vm->_graphics->refreshBackground(); for (fv = 0; fv < 5; fv++) { @@ -1544,13 +1544,13 @@ bool Trip::neardoor() { // there ARE no doors here! return false; } - + int16 ux = tr[0].x; int16 uy = tr[0].y + tr[0]._info._yLength; bool nd = false; for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) - && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) + && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) nd = true; return nd; } @@ -1561,7 +1561,7 @@ void Trip::new_game_for_trippancy() { // Called by gyro.newgame -void Trip::handleMoveKey(const Common::Event &event) { +void Trip::handleMoveKey(const Common::Event &event) { if (!_vm->_gyro->_dna._userMovesAvvy) return; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index 655adae8b69f..e701464f852e 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -28,8 +28,8 @@ /* TRIP5 Trippancy V - the sprite animation subsystem */ -#ifndef TRIP6_H -#define TRIP6_H +#ifndef AVALANCHE_TRIP6_H +#define AVALANCHE_TRIP6_H #include "avalanche/graphics.h" @@ -120,12 +120,9 @@ class triptype { Trip *_tr; bool collision_check(); - int8 sgn(int16 val); }; - - const int16 maxgetset = 35; class getsettype { @@ -138,18 +135,11 @@ class getsettype { void recall(ByteField &r); }; - - - - - class Trip { public: friend class triptype; friend class getsettype; - - static const int16 up = 0; static const int16 right = 1; static const int16 down = 2; @@ -162,69 +152,37 @@ class Trip { static const int16 numtr = 5; // current max no. of sprites - - static const int16 procfollow_avvy_y = 1; - static const int16 procback_and_forth = 2; - static const int16 procface_avvy = 3; - static const int16 procarrow_procs = 4; - static const int16 procspludwick_procs = 5; - static const int16 procgrab_avvy = 6; - static const int16 procgeida_procs = 7; - - Trip(AvalancheEngine *vm); - ~Trip(); void trippancy_link(); - void get_back_loretta(); - void loadtrip(); - void call_special(uint16 which); - void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. - void catamove(byte ped); - void stopwalking(); - void tripkey(char dir); - void rwsp(byte t, byte dir); - void apped(byte trn, byte np); - void getback(); - void fliproom(byte room, byte ped); - bool infield(byte which); // Returns true if you're within field "which". - bool neardoor(); // Returns True if you're near a door. - void readstick(); - void newspeed(); - void new_game_for_trippancy(); - void take_a_step(byte &tripnum); - - - void handleMoveKey(const Common::Event &event); // To replace tripkey(). - triptype tr[numtr]; getsettype getset[2]; byte aa[1600]; @@ -240,32 +198,20 @@ class Trip { // int16 beforex, beforey; byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); - byte geida_ped(byte which); - void dawndelay(); - void hide_in_the_cupboard(); - void follow_avvy_y(byte tripnum); - void back_and_forth(byte tripnum); - void face_avvy(byte tripnum); - void arrow_procs(byte tripnum); - void grab_avvy(byte tripnum); - void spin(byte whichway, byte &tripnum); - void geida_procs(byte tripnum); - void call_andexors(); - void getsetclear(); }; } // End of namespace Avalanche. -#endif // TRIP6_H +#endif // AVALANCHE_TRIP6_H diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 4cdbe5a8dee6..f61236593e7f 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -49,7 +49,7 @@ bool Visa::bubbling = false; bool Visa::report_dixi_errors = true; void Visa::unskrimble() { - for (uint16 fv = 0; fv < _vm->_gyro->_bufSize; fv++) + for (uint16 fv = 0; fv < _vm->_gyro->_bufSize; fv++) _vm->_gyro->_buffer[fv] = (~(_vm->_gyro->_buffer[fv] - (fv + 1))) % 256; } @@ -182,7 +182,7 @@ void Visa::talkto(byte whom) { if (_vm->_gyro->_dna._talkedToCrapulus) // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_gyro->_dna._givenToSpludwick) { + switch (_vm->_gyro->_dna._givenToSpludwick) { case 1: // Falltrough is intended. case 2:{ _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); @@ -251,7 +251,7 @@ void Visa::talkto(byte whom) { break; } // On a subject. Is there any reason to block it? - else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { + else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { dixi('q', 43); // He's fast asleep! return; } diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index c3aa3f62553e..37cb177fbef6 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -27,8 +27,8 @@ /* VISA The new Sez handler. (Replaces Access.) */ -#ifndef VISA2_H -#define VISA2_H +#ifndef AVALANCHE_VISA2_H +#define AVALANCHE_VISA2_H #include "common/scummsys.h" @@ -60,4 +60,4 @@ class Visa { } // End of namespace Avalanche. -#endif // VISA2_H +#endif // AVALANCHE_VISA2_H From 5d2547c8f04d1b80a2f711472ad525dde657eb53 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 09:14:14 +0200 Subject: [PATCH 0848/1332] AVALANCHE: Rename some constants in trip6 --- engines/avalanche/acci2.cpp | 4 +- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/lucerna2.cpp | 36 ++++++------ engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/timeout2.cpp | 6 +- engines/avalanche/trip6.cpp | 100 ++++++++++++++++---------------- engines/avalanche/trip6.h | 24 ++++---- engines/avalanche/visa2.cpp | 2 +- 8 files changed, 89 insertions(+), 89 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 882fc3d3ed26..30f5a4b9a13f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1277,7 +1277,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. - for (byte i = 0; i < _vm->_trip->numtr; i++) { + for (byte i = 0; i < _vm->_trip->kSpriteNumbMax; i++) { if (_vm->_trip->tr[i].quick && ((_vm->_trip->tr[i].a.accinum + 149) == _person)) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; @@ -1573,7 +1573,7 @@ void Acci::doThat() { int16 y = _vm->_trip->tr[0].y; _vm->_trip->tr[0].done(); _vm->_trip->tr[0].init(i, true, _vm->_trip); - _vm->_trip->tr[0].appear(x, y, _vm->_trip->left); + _vm->_trip->tr[0].appear(x, y, _vm->_trip->kDirLeft); _vm->_trip->tr[0].visible = false; } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 9fd802d30a4a..4e3bbba319b3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -282,7 +282,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _trip->numtr; i++) { + for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { if (_trip->tr[i].quick) spriteNum++; } @@ -290,7 +290,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites. + for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { // Deallocate sprites. if (_trip->tr[i].quick) _trip->tr[i].done(); } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 47f838214307..a2df1fae2424 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -466,7 +466,7 @@ void Lucerna::enterroom(byte x, byte ped) { } else { // You've been here before. _vm->_trip->apped(2, 4); // He's standing in your way straight away... - _vm->_trip->tr[1].face = _vm->_trip->left; + _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; } } } @@ -535,7 +535,7 @@ void Lucerna::enterroom(byte x, byte ped) { default: { // You've answered SOME of his questions. _vm->_trip->tr[1].init(9, false, _vm->_trip); _vm->_trip->apped(2, 3); - _vm->_trip->tr[1].face = _vm->_trip->right; + _vm->_trip->tr[1].face = _vm->_trip->kDirRight; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -954,26 +954,26 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { switch (col) { case kColorGreen: { - _vm->_gyro->_dna._direction = _vm->_trip->up; - _vm->_trip->rwsp(0, _vm->_trip->up); + _vm->_gyro->_dna._direction = _vm->_trip->kDirUp; + _vm->_trip->rwsp(0, _vm->_trip->kDirUp); showrw(); } break; case kColorBrown: { - _vm->_gyro->_dna._direction = _vm->_trip->down; - _vm->_trip->rwsp(0, _vm->_trip->down); + _vm->_gyro->_dna._direction = _vm->_trip->kDirDown; + _vm->_trip->rwsp(0, _vm->_trip->kDirDown); showrw(); } break; case kColorCyan: { - _vm->_gyro->_dna._direction = _vm->_trip->left; - _vm->_trip->rwsp(0, _vm->_trip->left); + _vm->_gyro->_dna._direction = _vm->_trip->kDirLeft; + _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); showrw(); } break; case kColorLightmagenta: { - _vm->_gyro->_dna._direction = _vm->_trip->right; - _vm->_trip->rwsp(0, _vm->_trip->right); + _vm->_gyro->_dna._direction = _vm->_trip->kDirRight; + _vm->_trip->rwsp(0, _vm->_trip->kDirRight); showrw(); } break; @@ -1032,28 +1032,28 @@ void Lucerna::verte(Common::Point cursorPos) { _vm->_trip->stopwalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_trip->rwsp(0, _vm->_trip->left); + _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); break; case 2: - _vm->_trip->rwsp(0, _vm->_trip->right); + _vm->_trip->rwsp(0, _vm->_trip->kDirRight); break; case 3: - _vm->_trip->rwsp(0, _vm->_trip->up); + _vm->_trip->rwsp(0, _vm->_trip->kDirUp); break; case 4: - _vm->_trip->rwsp(0, _vm->_trip->ul); + _vm->_trip->rwsp(0, _vm->_trip->kDirUpLeft); break; case 5: - _vm->_trip->rwsp(0, _vm->_trip->ur); + _vm->_trip->rwsp(0, _vm->_trip->kDirUpRight); break; case 6: - _vm->_trip->rwsp(0, _vm->_trip->down); + _vm->_trip->rwsp(0, _vm->_trip->kDirDown); break; case 7: - _vm->_trip->rwsp(0, _vm->_trip->dl); + _vm->_trip->rwsp(0, _vm->_trip->kDirDownLeft); break; case 8: - _vm->_trip->rwsp(0, _vm->_trip->dr); + _vm->_trip->rwsp(0, _vm->_trip->kDirDownRight); break; } // No other values are possible. diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index d3f76b595c69..4105c16f10d0 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -691,7 +691,7 @@ void Scrolls::calldrivers() { if (param == 0) natural(); else if ((1 <= param) && (param <= 9)) { - if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. + if ((param > _vm->_trip->kSpriteNumbMax) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. _vm->_lucerna->errorled(); natural(); } else diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 59c7ed45fb69..9155643d2726 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -243,7 +243,7 @@ void Timeout::avaricius_talks() { } void Timeout::urinate() { - _vm->_trip->tr[0].turn(_vm->_trip->up); + _vm->_trip->tr[0].turn(_vm->_trip->kDirUp); _vm->_trip->stopwalking(); _vm->_lucerna->showrw(); set_up_timer(14, proctoilet2, reason_gototoilet); @@ -545,7 +545,7 @@ void Timeout::meet_avaroid() { _vm->_gyro->_dna._metAvaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - _vm->_trip->tr[0].face = _vm->_trip->left; + _vm->_trip->tr[0].face = _vm->_trip->kDirLeft; _vm->_trip->tr[0].x = 151; _vm->_trip->tr[0].ix = -3; _vm->_trip->tr[0].iy = -5; @@ -569,7 +569,7 @@ void Timeout::robin_hood_and_geida() { _vm->_trip->apped(1, 7); _vm->_trip->tr[0].walkto(6); _vm->_trip->tr[1].stopwalk(); - _vm->_trip->tr[1].face = _vm->_trip->left; + _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->_dna._geidaFollows = false; } diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index ccaba83088dc..c74efb5f928a 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -171,7 +171,7 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { } bool triptype::collision_check() { - for (byte fv = 0; fv < _tr->numtr; fv++) + for (byte fv = 0; fv < _tr->kSpriteNumbMax; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + _info._xLength) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) && @@ -326,14 +326,14 @@ void triptype::speed(int8 xx, int8 yy) { if (ix == 0) { // No horz movement if (iy < 0) - turn(_tr->up); + turn(_tr->kDirUp); else - turn(_tr->down); + turn(_tr->kDirDown); } else { if (ix < 0) - turn(_tr->left); + turn(_tr->kDirLeft); else - turn(_tr->right); + turn(_tr->kDirRight); } } @@ -461,14 +461,14 @@ Trip::Trip(AvalancheEngine *vm) { } Trip::~Trip() { - for (byte i = 0; i < numtr; i++) { + for (byte i = 0; i < kSpriteNumbMax; i++) { if (tr[i].quick) tr[i].done(); } } void Trip::loadtrip() { - for (int16 gm = 0; gm < numtr; gm++) + for (int16 gm = 0; gm < kSpriteNumbMax; gm++) tr[gm].original(); for (uint16 i = 0; i < sizeof(aa); i++) @@ -883,7 +883,7 @@ void Trip::call_special(uint16 which) { break; case 4: // This is the ghost room link. _vm->_lucerna->dusk(); - tr[0].turn(right); // you'll see this after we get back from bootstrap + tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_enid->backToBootstrap(3); break; @@ -909,7 +909,7 @@ void Trip::call_special(uint16 which) { _vm->_gyro->_dna._userMovesAvvy = false; tr[0].ix = 3; tr[0].iy = 0; - tr[0].face = right; + tr[0].face = kDirRight; _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. @@ -925,7 +925,7 @@ void Trip::call_special(uint16 which) { case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { _vm->_visa->dixi('q', 63); - tr[1].turn(down); + tr[1].turn(kDirDown); tr[1].stopwalk(); tr[1].call_eachstep = false; // Geida _vm->_lucerna->gameover(); @@ -1046,7 +1046,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { return; } else { apped(1, 6); - tr[0].face = right; // added by TT 12/3/1995 + tr[0].face = kDirRight; // added by TT 12/3/1995 _vm->_sequence->first_show(8); _vm->_sequence->then_show(9); } @@ -1092,28 +1092,28 @@ void Trip::newspeed() { void Trip::rwsp(byte t, byte dir) { switch (dir) { - case up: + case kDirUp: tr[t].speed(0, -tr[t].ys); break; - case down: + case kDirDown: tr[t].speed(0, tr[t].ys); break; - case left: + case kDirLeft: tr[t].speed(-tr[t].xs, 0); break; - case right: + case kDirRight: tr[t].speed(tr[t].xs, 0); break; - case ul: + case kDirUpLeft: tr[t].speed(-tr[t].xs, -tr[t].ys); break; - case ur: + case kDirUpRight: tr[t].speed(tr[t].xs, -tr[t].ys); break; - case dl: + case kDirDownLeft: tr[t].speed(-tr[t].xs, tr[t].ys); break; - case dr: + case kDirDownRight: tr[t].speed(tr[t].xs, tr[t].ys); break; } @@ -1160,7 +1160,7 @@ void Trip::getback() { // Eachstep procedures: void Trip::follow_avvy_y(byte tripnum) { - if (tr[0].face == left) + if (tr[0].face == kDirLeft) return; if (tr[tripnum].homing) tr[tripnum].hy = tr[1].y; @@ -1182,7 +1182,7 @@ void Trip::follow_avvy_y(byte tripnum) { void Trip::back_and_forth(byte tripnum) { if (!tr[tripnum].homing) { - if (tr[tripnum].face == right) + if (tr[tripnum].face == kDirRight) tr[tripnum].walkto(4); else tr[tripnum].walkto(5); @@ -1192,9 +1192,9 @@ void Trip::back_and_forth(byte tripnum) { void Trip::face_avvy(byte tripnum) { if (!tr[tripnum].homing) { if (tr[0].x >= tr[tripnum].x) - tr[tripnum].face = right; + tr[tripnum].face = kDirRight; else - tr[tripnum].face = left; + tr[tripnum].face = kDirLeft; } } @@ -1258,7 +1258,7 @@ void Trip::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 toy = tr[0].y - 1; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; - tr[tripnum].face = left; + tr[tripnum].face = kDirLeft; tr[tripnum].stopwalk(); // ... whatever ... } else { @@ -1310,14 +1310,14 @@ void Trip::geida_procs(byte tripnum) { if (tr[tripnum].y < (tr[0].y - 2)) { // Geida is further from the screen than Avvy. - spin(down, tripnum); + spin(kDirDown, tripnum); tr[tripnum].iy = 1; tr[tripnum].ix = 0; take_a_step(tripnum); return; } else if (tr[tripnum].y > (tr[0].y + 2)) { // Avvy is further from the screen than Geida. - spin(up, tripnum); + spin(kDirUp, tripnum); tr[tripnum].iy = -1; tr[tripnum].ix = 0; take_a_step(tripnum); @@ -1329,11 +1329,11 @@ void Trip::geida_procs(byte tripnum) { // Now the NPC which is following Avvy won't block his way and will walk next to him properly. if (tr[tripnum].x < tr[0].x - tr[0].xs * 8 - 12) { tr[tripnum].ix = tr[0].xs; - spin(right, tripnum); + spin(kDirRight, tripnum); take_a_step(tripnum); } else if (tr[tripnum].x > tr[0].x + tr[0].xs * 8 + 12) { tr[tripnum].ix = -tr[0].xs; - spin(left, tripnum); + spin(kDirLeft, tripnum); take_a_step(tripnum); } else tr[tripnum].ix = 0; @@ -1349,7 +1349,7 @@ void Trip::call_andexors() { for (int i = 0; i < 5; i++) order[i] = -1; - for (fv = 0; fv < numtr; fv++) { + for (fv = 0; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick && tr[fv].visible) order[fv] = fv; } @@ -1382,14 +1382,14 @@ void Trip::trippancy_link() { if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; - for (fv = 0; fv < numtr; fv++) { + for (fv = 0; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick && tr[fv].visible) tr[fv].walk(); } call_andexors(); - for (fv = 0; fv < numtr; fv++) { + for (fv = 0; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick && tr[fv].call_eachstep) { switch (tr[fv].eachstep) { case procfollow_avvy_y : @@ -1424,7 +1424,7 @@ void Trip::trippancy_link() { void Trip::get_back_loretta() { byte fv; - for (fv = 0; fv < numtr; fv++) { + for (fv = 0; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick) { getback(); return; @@ -1435,7 +1435,7 @@ void Trip::get_back_loretta() { void Trip::stopwalking() { tr[0].stopwalk(); - _vm->_gyro->_dna._direction = stopped; + _vm->_gyro->_dna._direction = kDirStopped; if (_vm->_gyro->_alive) tr[0].step = 1; } @@ -1504,7 +1504,7 @@ void Trip::fliproom(byte room, byte ped) { getsetclear(); - for (fv = 1; fv < numtr; fv++) { + for (fv = 1; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick) tr[fv].done(); } // Deallocate sprite @@ -1570,57 +1570,57 @@ void Trip::handleMoveKey(const Common::Event &event) { else { switch (event.kbd.keycode) { case Common::KEYCODE_UP: - if (_vm->_gyro->_dna._direction != up) { - _vm->_gyro->_dna._direction = up; + if (_vm->_gyro->_dna._direction != kDirUp) { + _vm->_gyro->_dna._direction = kDirUp; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_DOWN: - if (_vm->_gyro->_dna._direction != down) { - _vm->_gyro->_dna._direction = down; + if (_vm->_gyro->_dna._direction != kDirDown) { + _vm->_gyro->_dna._direction = kDirDown; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_LEFT: - if (_vm->_gyro->_dna._direction != left) { - _vm->_gyro->_dna._direction = left; + if (_vm->_gyro->_dna._direction != kDirLeft) { + _vm->_gyro->_dna._direction = kDirLeft; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_RIGHT: - if (_vm->_gyro->_dna._direction != right) { - _vm->_gyro->_dna._direction = right; + if (_vm->_gyro->_dna._direction != kDirRight) { + _vm->_gyro->_dna._direction = kDirRight; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->_dna._direction != ur) { - _vm->_gyro->_dna._direction = ur; + if (_vm->_gyro->_dna._direction != kDirUpRight) { + _vm->_gyro->_dna._direction = kDirUpRight; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->_dna._direction != dr) { - _vm->_gyro->_dna._direction = dr; + if (_vm->_gyro->_dna._direction != kDirDownRight) { + _vm->_gyro->_dna._direction = kDirDownRight; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_END: - if (_vm->_gyro->_dna._direction != dl) { - _vm->_gyro->_dna._direction = dl; + if (_vm->_gyro->_dna._direction != kDirDownLeft) { + _vm->_gyro->_dna._direction = kDirDownLeft; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); break; case Common::KEYCODE_HOME: - if (_vm->_gyro->_dna._direction != ul) { - _vm->_gyro->_dna._direction = ul; + if (_vm->_gyro->_dna._direction != kDirUpLeft) { + _vm->_gyro->_dna._direction = kDirUpLeft; rwsp(0, _vm->_gyro->_dna._direction); } else stopwalking(); diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index e701464f852e..76b435b16317 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -140,17 +140,17 @@ class Trip { friend class triptype; friend class getsettype; - static const int16 up = 0; - static const int16 right = 1; - static const int16 down = 2; - static const int16 left = 3; - static const int16 ur = 4; - static const int16 dr = 5; - static const int16 dl = 6; - static const int16 ul = 7; - static const int16 stopped = 8; - - static const int16 numtr = 5; // current max no. of sprites + static const int16 kDirUp = 0; + static const int16 kDirRight = 1; + static const int16 kDirDown = 2; + static const int16 kDirLeft = 3; + static const int16 kDirUpRight = 4; + static const int16 kDirDownRight = 5; + static const int16 kDirDownLeft = 6; + static const int16 kDirUpLeft = 7; + static const int16 kDirStopped = 8; + + static const int16 kSpriteNumbMax = 5; // current max no. of sprites static const int16 procfollow_avvy_y = 1; static const int16 procback_and_forth = 2; @@ -183,7 +183,7 @@ class Trip { void take_a_step(byte &tripnum); void handleMoveKey(const Common::Event &event); // To replace tripkey(). - triptype tr[numtr]; + triptype tr[kSpriteNumbMax]; getsettype getset[2]; byte aa[1600]; diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index f61236593e7f..2f438ba5f900 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -260,7 +260,7 @@ void Visa::talkto(byte whom) { whom -= 149; no_matches = true; - for (fv = 0; fv <= _vm->_trip->numtr; fv++) + for (fv = 0; fv <= _vm->_trip->kSpriteNumbMax; fv++) if (_vm->_trip->tr[fv].a.accinum == whom) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); no_matches = false; From cb05ea9bc6d04952e6cfc84ea9325b6a5e89bba1 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 12:35:44 +0200 Subject: [PATCH 0849/1332] AVALANCHE: Finish renaming/refactoring in Gyro. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/gyro2.cpp | 105 +++++++++++++-------------------- engines/avalanche/gyro2.h | 93 +++-------------------------- engines/avalanche/timeout2.cpp | 4 +- 4 files changed, 53 insertions(+), 151 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 30f5a4b9a13f..830087361b44 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1817,7 +1817,7 @@ void Acci::doThat() { _vm->_visa->dixi('D', 9); _vm->_lucerna->points(3); } - _vm->_gyro->updateMoney(3); // It costs thruppence. + _vm->_gyro->decreaseMoney(3); // It costs thruppence. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->_dna._boughtOnion = true; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 1fd906d48d3b..879cc1571473 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -37,20 +37,15 @@ #include "avalanche/acci2.h" #include "avalanche/trip6.h" -#include "common/textconsole.h" #include "common/file.h" - #include "common/random.h" - -//#include "dropdown.h" -//#include "basher.h" +#include "common/textconsole.h" namespace Avalanche { const char *Gyro::kVersionNum = "1.30"; const char *Gyro::kCopyright = "1995"; - const MouseHotspotType Gyro::kMouseHotSpots[9] = { {8,0}, // 1 - up-arrow {0,0}, // 2 - screwdriver @@ -66,15 +61,15 @@ const MouseHotspotType Gyro::kMouseHotSpots[9] = { // Art gallery at 2,1; notice about this at 2,2. const int32 Gyro::kCatacombMap[8][8] = { // Geida's room - // 1 2 3 | 4 5 6 7 8 - {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, - {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, - {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, - {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette - {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, - {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, - {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here - {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} + // 1 2 3 | 4 5 6 7 8 + {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, + {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, + {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette + {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, + {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here + {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} }; // vv Stairs trap. @@ -119,22 +114,22 @@ const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroo // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Gyro::kQuasipeds[16] = { - {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). - {3, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). - {3, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). - {3, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). - {6, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) - {2, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). - {2, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). - {2, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). - {3, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). - {2, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). - {2, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {3, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). - {4, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). - {5, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). - {2, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). + {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {3, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {3, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). + {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). + {3, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {6, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {2, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {2, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {2, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {3, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {2, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {2, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). + {3, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). + {4, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). + {5, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). + {2, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; @@ -143,9 +138,8 @@ const uint16 Gyro::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 49 const TuneType Gyro::kTune = { kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, - kPitchLower, kPitchHigher, kPitchHigher, - kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, - kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher + kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, + kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher }; byte Gyro::_whereIs[29] = { @@ -175,9 +169,6 @@ byte Gyro::_whereIs[29] = { r__wisewomans // The Wise Woman. }; -// CHECKME: Useless? -// const char Gyro::kItemsChar[] = "WMBParCLguKeSnIohn"; - Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _vm = vm; @@ -186,6 +177,7 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { for (int ff = 0; ff < 2; ff++) _also[fv][ff] = 0; } + _dna._totalTime = 0; } @@ -197,9 +189,9 @@ Gyro::~Gyro() { _digits[9].free(); } -Common::String Gyro::intToStr(int32 x) { - Common::String q = Common::String::format("%d", x); - return q; +Common::String Gyro::intToStr(int32 num) { + Common::String result = Common::String::format("%d", num); + return result; } void Gyro::newMouse(byte id) { @@ -230,28 +222,28 @@ void Gyro::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) warning("STUB: Gyro::shadow()"); } -void Gyro::shadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { +void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { warning("STUB: Gyro::shbox()"); } void Gyro::newGame() { - for (byte gm = 0; gm < kMaxSprites; gm++) { - if (_vm->_trip->tr[gm].quick) - _vm->_trip->tr[gm].done(); + for (byte i = 0; i < kMaxSprites; i++) { + if (_vm->_trip->tr[i].quick) + _vm->_trip->tr[i].done(); } // Deallocate sprite. Sorry, beta testers! _vm->_trip->tr[0].init(0, true, _vm->_trip); - _alive = true; + _alive = true; _score = 0; - //for gd:=0 to 5 do which[gd]:=1; memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); + _vm->_scrolls->natural(); _vm->_lucerna->mousepage(0); + _dna._spareEvening = "answer a questionnaire"; _dna._favouriteDrink = "beer"; - _dna._money = 30; // 2/6 _dna._direction = kDirectionStopped; _dna._wearing = kObjectClothes; @@ -279,7 +271,7 @@ void Gyro::newGame() { _dna._avvyInBed = true; _enidFilename = ""; - for (byte gd = 0; gd <= 1; gd++) { + for (byte i = 0; i <= 1; i++) { _cp = 1 - _cp; _vm->_trip->getback(); } @@ -287,7 +279,6 @@ void Gyro::newGame() { _vm->_lucerna->enterroom(1, 1); _vm->_trip->new_game_for_trippancy(); _vm->_lucerna->showscore(); - _vm->_dropdown->setupMenu(); _vm->_lucerna->clock_lucerna(); _vm->_lucerna->sprite_run(); @@ -314,7 +305,7 @@ void Gyro::forceNumlock() { warning("STUB: Gyro::force_numlock()"); } -bool Gyro::updateMoney(uint16 howmuchby) { +bool Gyro::decreaseMoney(uint16 howmuchby) { _dna._money -= howmuchby; if (_dna._money < 0) { _vm->_visa->dixi('Q', 2); // "You are now denariusless!" @@ -324,8 +315,6 @@ bool Gyro::updateMoney(uint16 howmuchby) { return true; } -// There'll may be problems with calling these functions because of the conversion of the arrays!!! -// Keep an eye open! Common::String Gyro::getName(byte whose) { static const Common::String kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", @@ -335,28 +324,22 @@ Common::String Gyro::getName(byte whose) { static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; - assert((whose > 150) && (whose < 179)); - if (whose < 175) return kLads[whose - 150]; else return kLasses[whose - 175]; } -// Keep an eye open! ^ byte Gyro::getNameChar(byte whose) { static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; static const char kLassChar[] = "kG\0xB1o"; - assert((whose > 150) && (whose < 179)); - if (whose < 175) return kLadChar[whose - 150]; else return kLassChar[whose - 175]; } -// Keep an eye open! ^^ Common::String Gyro::getThing(byte which) { static const Common::String kThings[kObjectNum] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", @@ -389,7 +372,6 @@ Common::String Gyro::getThing(byte which) { return get_thing_result; } -// Keep an eye open! ^^^ char Gyro::getThingChar(byte which) { static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar @@ -407,7 +389,6 @@ char Gyro::getThingChar(byte which) { return get_thingchar_result; } -// Keep an eye open! ^^^^ Common::String Gyro::getItem(byte which) { static const Common::String kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", @@ -522,13 +503,9 @@ void Gyro::loadMouse(byte which) { } mask.free(); - f.close(); - - CursorMan.replaceCursor(cursor.pixels, 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); - cursor.free(); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index ca367cd66f19..e1ce464f5626 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -69,7 +69,6 @@ struct DnaType { // Ux, uy, & ww now all belong to Trip5 bool _wonNim; // Have you *won* Nim? (That's harder.) byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte _passwordNum; // Number of the passw for this game. bool _aylesIsAwake; // pretty obvious! byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). @@ -77,82 +76,50 @@ struct DnaType { // Ux, uy, & ww now all belong to Trip5 bool _boughtOnion; // Have you bought an onion yet? bool _rottenOnion; // And has it rotted? bool _onionInVinegar; // Is the onion in the vinegar? - byte _givenToSpludwick; // 0 = nothing given, 1 = onion... byte _brummieStairs; // Progression through the stairs trick. byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) bool _avvyInBed; // True if Avvy's in bed, but awake. - bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _dogFoodPos; // Which way Dogfood's looking in the pub. - bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool _friarWillTieYouUp; // If you're going to get tied up. bool _tiedUp; // You ARE tied up! - byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool _talkedToCrapulus; // Pretty self-explanatory. - byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool _bellsAreRinging; // Is Jacques ringing the bells? - bool _standingOnDais; // In room 71, inside Cardiff Castle. bool _takenPen; // Have you taken the pen (in Cardiff?) bool _arrowTriggered; // And has the arrow been triggered? bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 _totalTime; // Your total time playing this game, in ticks. - byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; byte _lastRoomNotMap; - bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool _enterCatacombsFromLustiesRoom; bool _teetotal; // Are we touching any more drinks? byte _malagauche; // Position of Malagauche. See Celer for more info. char _drinking; // What's he getting you? - bool _enteredLustiesRoomAsMonk; - byte _catacombX, _catacombY; // XY coords in the catacombs. - bool _avvysInTheCupboard; // On screen 22. - bool _geidaFollows; // Is Geida following you? - byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. - byte _nextBell; // For the ringing. - bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? - byte _flipToWhere, _flipToPed; // For the sequencer. - bool _beenTiedUp; // In r__Robins. - bool _sittingInPub; // Are you sitting down in the pub? byte _spurgeTalkCount; // Count for talking to Spurge. - bool _metAvaroid; - bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; }; @@ -347,9 +314,6 @@ class Gyro { - - - // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; @@ -360,9 +324,6 @@ class Gyro { // You may know better than On which page to switch to. bool _onCanDoPageSwap; - - - DnaType _dna; byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. @@ -375,23 +336,18 @@ class Gyro { byte _scrollNum, _score, _whichwas; byte _thinks; bool _thinkThing; - int16 _talkX, _talkY; byte _talkBackgroundColor, _talkFontColor; byte _scrollBells; // no. of times to ring the bell bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - char _objectList[10]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. // Called .free() for them in ~Gyro(). - byte _oldDirection; int8 _scoreToDisplay[3]; byte _currentMouse; // current mouse-void Common::String _verbStr; // what you can do with your object. :-) - Common::String *_also[31][2]; PedType _peds[15]; MagicType _magics[15]; @@ -400,27 +356,19 @@ class Gyro { byte _fieldNum; Common::String _flags; Common::String _listen; - - uint16 _oh, _onh, _om, _hours, _minutes, _seconds; - + uint16 _oh, _onh, _om, _hours, _minutes, _seconds; // For Timeout. TODO: Move them into it. Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". - byte _cp, _ledStatus, _defaultLed; FontType _font; bool _alive; byte _buffer[2000]; uint16 _bufSize; - int16 _underScroll; // Y-coord of just under the scroll text. - bool _dropdownActive; // Kludge so we don't have to keep referring to Dropdown Common::String _roomnName; // Name of actual room - Common::String _subject; // What you're talking to them about. byte _subjectNum; // The same thing. - bool _keyboardClick; // Is a keyboard click noise wanted? - byte _him, _her, _it; int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. @@ -430,68 +378,45 @@ class Gyro { Common::DumpFile _demoFileSave; // uruk added it - first use located in constructor of Basher byte _lastPerson; // Last person to have been selected using the People menu. - bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - bool isLoaded; // Is it a loaded gamestate? - Common::String _enidFilename; Gyro(AvalancheEngine *vm); - ~Gyro(); - Common::String intToStr(int32 x); - + Common::String intToStr(int32 num); void newMouse(byte id); - void setMousePointerWait(); // Makes hourglass. + void loadMouse(byte which); void note(uint16 hertz); - void blip(); + void click(); // "Audio keyboard feedback" - void shadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); + void setBackgroundColor(byte x); + void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); void newGame(); // This sets up the DNA for a completely new game. - - void click(); // "Audio keyboard feedback" - void slowDown(); - bool setFlag(char x); - void forceNumlock(); - - bool updateMoney(uint16 howmuchby); // Called pennycheck in the original. - + bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. + void hangAroundForAWhile(); + Common::String getName(byte whose); - byte getNameChar(byte whose); - Common::String getThing(byte which); - char getThingChar(byte which); - Common::String getItem(byte which); // Called get_better in the original. - Common::String f5Does(); // This procedure determines what f5 does. - void loadMouse(byte which); - - void setBackgroundColor(byte x); - - void hangAroundForAWhile(); - private: AvalancheEngine *_vm; - // CHECKME: Useless? - // static const char kItemsChar[]; void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 9155643d2726..085df26923d4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -499,7 +499,7 @@ void Timeout::buydrinks() { _vm->_visa->dixi('D', _vm->_gyro->_dna._drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_visa->dixi('D', 1); // That'll be thruppence. - if (_vm->_gyro->updateMoney(3)) // Pay 3d. + if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. _vm->_visa->dixi('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -510,7 +510,7 @@ void Timeout::buywine() { _vm->_visa->dixi('D', 50); // You buy the wine. _vm->_visa->dixi('D', 1); // It'll be thruppence. - if (_vm->_gyro->updateMoney(3)) { + if (_vm->_gyro->decreaseMoney(3)) { _vm->_visa->dixi('D', 4); // You paid up. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = true; _vm->_lucerna->objectlist(); From cfd7d06539e32ca088f01cd13e8b328aef801e24 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 12:48:15 +0200 Subject: [PATCH 0850/1332] AVALANCHE: Fix bug due to unsaved changes. --- engines/avalanche/scrolls2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4105c16f10d0..67247a448375 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -426,8 +426,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_gyro->_scroll[b].setChar(' ', 0); // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); - _vm->_gyro->shadowBox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); - _vm->_gyro->shadowBox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + _vm->_gyro->drawShadowBox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); + _vm->_gyro->drawShadowBox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); } break; } From 2bed64b447516f1f702fd70952a9886fac454b0d Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 15:58:02 +0200 Subject: [PATCH 0851/1332] AVALANCHE: Do renaming/refactoring in Lucerna. --- engines/avalanche/acci2.cpp | 84 ++--- engines/avalanche/avalanche.cpp | 8 +- engines/avalanche/avalot.cpp | 22 +- engines/avalanche/dropdown2.cpp | 6 +- engines/avalanche/enid2.cpp | 4 +- engines/avalanche/gyro2.cpp | 13 +- engines/avalanche/lucerna2.cpp | 536 ++++++++++++-------------------- engines/avalanche/lucerna2.h | 119 +++---- engines/avalanche/scrolls2.cpp | 18 +- engines/avalanche/timeout2.cpp | 20 +- engines/avalanche/trip6.cpp | 18 +- engines/avalanche/visa2.cpp | 8 +- 12 files changed, 349 insertions(+), 507 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 830087361b44..0712fd05cdf8 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -620,7 +620,7 @@ void Acci::parse() { void Acci::examineObject() { if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkabout(_thing, _vm->_gyro->kThing); + _vm->_lucerna->thinkAbout(_thing, Gyro::kThing); switch (_thing) { case Gyro::kObjectWine : switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine. @@ -662,7 +662,7 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". void Acci::exampers() { if (isPersonHere()) { if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkabout(_person, _vm->_gyro->kPerson); + _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); _person -= 149; switch (_person) { // Special cases case 11: @@ -777,7 +777,7 @@ void Acci::swallow() { // Eat something. _vm->_pingo->wobble(); _vm->_visa->dixi('U', 2); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); drink(); break; case 2: @@ -789,7 +789,7 @@ void Acci::swallow() { // Eat something. case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); _vm->_visa->dixi('U', 3); - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: @@ -800,7 +800,7 @@ void Acci::swallow() { // Eat something. break; case Gyro::kObjectMushroom: _vm->_visa->dixi('U', 6); - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_dna._rottenOnion) @@ -808,7 +808,7 @@ void Acci::swallow() { // Eat something. else { _vm->_visa->dixi('U', 8); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); } break; default: @@ -981,7 +981,7 @@ void Acci::putProc() { + _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); else { // Put onion into vinegar! Yes! _vm->_gyro->_dna._onionInVinegar = true; - _vm->_lucerna->points(7); + _vm->_lucerna->incScore(7); _vm->_visa->dixi('u', 9); } } @@ -1015,7 +1015,7 @@ void Acci::putProc() { _vm->_gyro->_dna._boxContent = _thing; _vm->_gyro->_dna._objects[_thing - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_scrolls->display("OK, it's in the box."); openBox(false); // Shut box. @@ -1064,26 +1064,26 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_dna._givenToSpludwick++; _vm->_visa->dixi('q', 20); goToCauldron(); - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); } - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); break; case Gyro::kObjectInk: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._givenToSpludwick++; _vm->_visa->dixi('q', 24); goToCauldron(); - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = false; _vm->_visa->dixi('q', 25); - _vm->_lucerna->points(5); + _vm->_lucerna->incScore(5); _vm->_gyro->_dna._givenToSpludwick++; goToCauldron(); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); break; default: return true; @@ -1099,7 +1099,7 @@ void Acci::drink() { _vm->_gyro->_dna._teetotal = true; _vm->_gyro->_dna._avvyIsAwake = false; _vm->_gyro->_dna._avvyInBed = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_trip->fliproom(1, 1); @@ -1141,7 +1141,7 @@ void Acci::standUp() { _vm->_trip->apped(1, 2); _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. - _vm->_lucerna->points(1); + _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); } else @@ -1177,7 +1177,7 @@ void Acci::getProc(char thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->_dna._objects[thing - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else @@ -1197,7 +1197,7 @@ void Acci::getProc(char thing) { _vm->_trip->call_special(3); // Zap! _vm->_gyro->_dna._takenPen = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_scrolls->display("Taken."); } } else if (_vm->_gyro->_dna._standingOnDais) @@ -1219,8 +1219,8 @@ void Acci::getProc(char thing) { _vm->_gyro->_dna._mushroomGrowing = false; _vm->_gyro->_dna._takenMushroom = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = true; - _vm->_lucerna->objectlist(); - _vm->_lucerna->points(3); + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(3); } else _vm->_visa->dixi('q', 57); break; @@ -1239,7 +1239,7 @@ void Acci::giveGeidaTheLute() { return; } _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_visa->dixi('q', 64); // She plays it. _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); @@ -1422,7 +1422,7 @@ void Acci::doThat() { case Gyro::kPeopleIbythneth: if (_thing == _vm->_gyro->kObjectBadge) { _vm->_visa->dixi('q', 32); // Thanks! Wow! - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = false; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectHabit - 1] = true; _vm->_gyro->_dna._givenBadgeToIby = true; @@ -1438,8 +1438,8 @@ void Acci::doThat() { _vm->_visa->dixi('q', 54); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = true; _vm->_gyro->_dna._givenPenToAyles = true; - _vm->_lucerna->objectlist(); - _vm->_lucerna->points(2); + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(2); } else heyThanks(); } else @@ -1450,9 +1450,9 @@ void Acci::doThat() { case Gyro::kObjectPotion: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = false; _vm->_visa->dixi('u', 16); // She drinks it. - _vm->_lucerna->points(2); + _vm->_lucerna->incScore(2); _vm->_gyro->_dna._givenPotionToGeida = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); break; case Gyro::kObjectLute: giveGeidaTheLute(); @@ -1478,7 +1478,7 @@ void Acci::doThat() { } } } - _vm->_lucerna->objectlist(); // Just in case... + _vm->_lucerna->refreshObjectList(); // Just in case... } break; @@ -1539,7 +1539,7 @@ void Acci::doThat() { else if (_vm->_gyro->_dna._avvysInTheCupboard) { _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.'); _vm->_gyro->_dna._wearing = kNothing; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); } else _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); break; @@ -1561,7 +1561,7 @@ void Acci::doThat() { } else _vm->_gyro->_dna._wearing = _thing; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); byte i; if (_thing == _vm->_gyro->kObjectHabit) @@ -1608,13 +1608,13 @@ void Acci::doThat() { // You won - strange! _vm->_visa->dixi('Q', 7); // You won! Give us a lute! _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wonNim = true; _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. - _vm->_lucerna->points(7); // 7 points for winning! + _vm->_lucerna->incScore(7); // 7 points for winning! if (_vm->_gyro->_dna._playedNim == 1) - _vm->_lucerna->points(3); // 3 points for playing your 1st game. + _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1729,7 +1729,7 @@ void Acci::doThat() { _vm->_pingo->zonk(); _vm->_scrolls->display(Common::String("A crack of lightning shoots from the sky, and fries you.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); } _vm->_gyro->_dna._sworeNum++; break; @@ -1761,7 +1761,7 @@ void Acci::doThat() { } if (_vm->_gyro->_dna._alcoholLevel == 0) - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); @@ -1791,7 +1791,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->_dna._alcoholLevel == 0) - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; @@ -1815,11 +1815,11 @@ void Acci::doThat() { _vm->_visa->dixi('D', 11); else { _vm->_visa->dixi('D', 9); - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._boughtOnion = true; _vm->_gyro->_dna._rottenOnion = false; // It's OK when it leaves the stall! _vm->_gyro->_dna._onionInVinegar = false; @@ -1858,9 +1858,9 @@ void Acci::doThat() { _vm->_gyro->_dna._cwytalotGone = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = false; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = false; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; - _vm->_lucerna->points(7); + _vm->_lucerna->incScore(7); _vm->_trip->tr[1].walkto(2); _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].call_eachstep = false; @@ -1890,7 +1890,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._drawbridgeOpen != 0) _vm->_scrolls->display("Contrary to your expectations, the drawbridge fails to close again."); else { - _vm->_lucerna->points(4); + _vm->_lucerna->incScore(4); _vm->_scrolls->display("The drawbridge opens!"); _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); _vm->_gyro->_dna._drawbridgeOpen = 1; @@ -1903,7 +1903,7 @@ void Acci::doThat() { _vm->_enid->dir(_realWords[1]); break; case kVerbCodeDie: - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); break; case kVerbCodeScore: _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->intToStr(_vm->_gyro->_dna._score) + ',' + _vm->_scrolls->kControlCenter @@ -1959,7 +1959,7 @@ void Acci::doThat() { case 0: if (!_vm->_gyro->_dna._avvyIsAwake) { _vm->_gyro->_dna._avvyIsAwake = true; - _vm->_lucerna->points(1); + _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. if (_vm->_gyro->_dna._teetotal) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 4e3bbba319b3..fbdeb2583b08 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -460,7 +460,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _celer->forgetBackgroundSprites(); - _lucerna->minor_redraw(); + _lucerna->minorRedraw(); _dropdown->setupMenu(); @@ -468,11 +468,11 @@ bool AvalancheEngine::loadGame(const int16 slot) { _gyro->_alive = true; - _lucerna->objectlist(); + _lucerna->refreshObjectList(); _trip->newspeed(); - _lucerna->showrw(); + _lucerna->drawDirection(); _gyro->_onToolbar = false; _trip->trippancy_link(); @@ -720,7 +720,7 @@ Common::Error AvalancheEngine::run() { // break; //} - } while (false); + } while (!shouldQuit()); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a84d67a7affe..ff8a5aa8bf29 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -111,7 +111,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_KP5: if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) { _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. - _vm->_lucerna->showrw(); + _vm->_lucerna->drawDirection(); return; } case Common::KEYCODE_BACKSPACE: @@ -124,7 +124,7 @@ void Avalot::handleKeyDown(Common::Event &event) { break; } - _vm->_lucerna->showrw(); + _vm->_lucerna->drawDirection(); } @@ -137,11 +137,11 @@ void Avalot::setup() { _vm->_gyro->_holdTheDawn = true; _vm->_lucerna->dusk(); _vm->_gyro->_currentMouse = 177; - _vm->_lucerna->mouse_init(); // on; + _vm->_gyro->setMousePointerWait(); _vm->_gyro->_dropsOk = true; _vm->_gyro->_mouseText = ""; _vm->_gyro->_dropdownActive = false; - _vm->_lucerna->load_digits(); + _vm->_lucerna->loadDigits(); _vm->_gyro->_cheat = false; _vm->_gyro->_cp = 0; _vm->_parser->_inputTextPos = 0; @@ -151,7 +151,7 @@ void Avalot::setup() { // TSkellern = 0; Replace with a more local variable sometime _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionStopped; _vm->_gyro->_enidFilename = ""; // Undefined. - _vm->_lucerna->toolbar(); + _vm->_lucerna->drawToolbar(); _vm->_scrolls->state(2); for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. @@ -171,7 +171,7 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _vm->_gyro->_thinks = 2; // You always have money. - _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); + _vm->_lucerna->thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); _vm->loadGame(loadSlot); } else { @@ -179,8 +179,8 @@ void Avalot::setup() { _vm->_gyro->newGame(); // No game was requested- load the default. _vm->_gyro->_soundFx = ! _vm->_gyro->_soundFx; - _vm->_lucerna->fxtoggle(); - _vm->_lucerna->thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); + _vm->_lucerna->fxToggle(); + _vm->_lucerna->thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); _vm->_visa->dixi('q', 83); // Info on the game, etc. } @@ -198,13 +198,13 @@ void Avalot::run(Common::String arg) { - _vm->_lucerna->clock_lucerna(); + _vm->_lucerna->updateClock(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); _vm->_trip->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); _vm->_trip->trippancy_link(); - _vm->_lucerna->checkclick(); + _vm->_lucerna->checkClick(); _vm->_timeout->one_tick(); @@ -227,7 +227,7 @@ void Avalot::run(Common::String arg) { uint32 delay = _vm->_system->getMillis() - beginLoop; if (delay <= 55) _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (! _vm->_gyro->_letMeOut); + } while (!_vm->_gyro->_letMeOut && !_vm->shouldQuit()); //if (logging) // close(logfile); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 1d3a0235d40c..b0b3b2fd517b 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -562,7 +562,7 @@ void Dropdown::runMenuGame() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBoss); break; case 2: - _vm->_lucerna->major_redraw(); + _vm->_lucerna->majorRedraw(); break; case 3: _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); @@ -641,11 +641,11 @@ void Dropdown::runMenuAction() { } void Dropdown::runMenuObjects() { - _vm->_lucerna->thinkabout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum + 1], _vm->_gyro->kThing); + _vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum + 1], Gyro::kThing); } void Dropdown::runMenuPeople() { - _vm->_lucerna->thinkabout(people[_activeMenuItem._choiceNum], _vm->_gyro->kPerson); + _vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson); _vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; } diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 7cf4075d1ad1..d9421773918e 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -272,13 +272,13 @@ void Enid::ednaReload() { _vm->_gyro->_seeScroll = true; // This prevents display of the new sprites before the // new picture is loaded. - _vm->_lucerna->major_redraw(); + _vm->_lucerna->majorRedraw(); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; _vm->_gyro->_alive = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); if (_vm->_gyro->_holdTheDawn) { _vm->_gyro->_holdTheDawn = false; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 879cc1571473..cc624172d120 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -240,7 +240,6 @@ void Gyro::newGame() { memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); _vm->_scrolls->natural(); - _vm->_lucerna->mousepage(0); _dna._spareEvening = "answer a questionnaire"; _dna._favouriteDrink = "beer"; @@ -254,7 +253,7 @@ void Gyro::newGame() { _thinkThing = true; _thinks = 2; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _onToolbar = false; _seeScroll = false; @@ -276,12 +275,12 @@ void Gyro::newGame() { _vm->_trip->getback(); } - _vm->_lucerna->enterroom(1, 1); + _vm->_lucerna->enterRoom(1, 1); _vm->_trip->new_game_for_trippancy(); - _vm->_lucerna->showscore(); + _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); - _vm->_lucerna->clock_lucerna(); - _vm->_lucerna->sprite_run(); + _vm->_lucerna->updateClock(); + _vm->_lucerna->spriteRun(); } void Gyro::click() { @@ -309,7 +308,7 @@ bool Gyro::decreaseMoney(uint16 howmuchby) { _dna._money -= howmuchby; if (_dna._money < 0) { _vm->_visa->dixi('Q', 2); // "You are now denariusless!" - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); return false; } else return true; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a2df1fae2424..76b2836c0f2f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -47,13 +47,9 @@ #include "graphics/palette.h" -//#include "dropdown.h" -//#include "basher.h" - - namespace Avalanche { -Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { +Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false) { _vm = vm; } @@ -99,19 +95,17 @@ void Lucerna::callVerb(byte id) { } } -void Lucerna::draw_also_lines() { - byte ff; - +void Lucerna::drawAlsoLines() { CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (ff = 0; ff < _vm->_gyro->_lineNum; ff++) { + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { // We had to check if the lines are within the borders of the screen. - if ((_vm->_gyro->_lines[ff]._x1 >= 0) && (_vm->_gyro->_lines[ff]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[ff]._y1 >= 0) && (_vm->_gyro->_lines[ff]._y1 < _vm->_graphics->kScreenHeight) - && (_vm->_gyro->_lines[ff]._x2 >= 0) && (_vm->_gyro->_lines[ff]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[ff]._y2 >= 0) && (_vm->_gyro->_lines[ff]._y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_vm->_gyro->_lines[ff]._x1, _vm->_gyro->_lines[ff]._y1, _vm->_gyro->_lines[ff]._x2, _vm->_gyro->_lines[ff]._y2, _vm->_gyro->_lines[ff]._color); + if ((_vm->_gyro->_lines[i]._x1 >= 0) && (_vm->_gyro->_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y1 >= 0) && (_vm->_gyro->_lines[i]._y1 < _vm->_graphics->kScreenHeight) + && (_vm->_gyro->_lines[i]._x2 >= 0) && (_vm->_gyro->_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y2 >= 0) && (_vm->_gyro->_lines[i]._y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i]._color); } CursorMan.showMouse(true); @@ -121,173 +115,160 @@ void Lucerna::draw_also_lines() { // nextstring, scram1 and unscrable are only used in load_also -Common::String Lucerna::nextstring() { +Common::String Lucerna::readAlsoStringFromFile() { Common::String str; - byte length = f.readByte(); + byte length = file.readByte(); for (int i = 0; i < length; i++) - str += f.readByte(); + str += file.readByte(); return str; } -void Lucerna::scram1(Common::String &x) { - for (uint fz = 0; fz < x.size(); fz++) - x.setChar(x[fz] ^ 177, fz); +void Lucerna::scram(Common::String &str) { + for (uint i = 0; i < str.size(); i++) + str.setChar(str[i] ^ 177, i); } -void Lucerna::unscramble() { - for (byte fv = 0; fv < 31; fv++) - for (byte ff = 0; ff < 2; ff++) - if (_vm->_gyro->_also[fv][ff] != 0) - scram1(*_vm->_gyro->_also[fv][ff]); - scram1(_vm->_gyro->_listen); - scram1(_vm->_gyro->_flags); +void Lucerna::unScramble() { + for (byte i = 0; i < 31; i++) + for (byte j = 0; j < 2; j++) + if (_vm->_gyro->_also[i][j] != 0) + scram(*_vm->_gyro->_also[i][j]); + scram(_vm->_gyro->_listen); + scram(_vm->_gyro->_flags); } -void Lucerna::load_also(Common::String n) { - byte ff, fv; - - for (fv = 0; fv < 31; fv++) - for (ff = 0; ff < 2; ff++) - if (_vm->_gyro->_also[fv][ff] != 0) { - delete _vm->_gyro->_also[fv][ff]; - _vm->_gyro->_also[fv][ff] = 0; +void Lucerna::loadAlso(byte num) { + for (byte i = 0; i < 31; i++) + for (byte j = 0; j < 2; j++) + if (_vm->_gyro->_also[i][j] != 0) { + delete _vm->_gyro->_also[i][j]; + _vm->_gyro->_also[i][j] = 0; } Common::String filename; - filename = filename.format("also%s.avd", n.c_str()); - if (!f.open(filename)) { + filename = filename.format("also%d.avd", num); + if (!file.open(filename)) { warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); return; } - f.seek(128); + file.seek(128); - byte minnames = f.readByte(); - for (fv = 0; fv <= minnames; fv++) { - for (ff = 0; ff < 2; ff++) { - _vm->_gyro->_also[fv][ff] = new Common::String; - *_vm->_gyro->_also[fv][ff] = nextstring(); + byte alsoNum = file.readByte(); + for (byte i = 0; i <= alsoNum; i++) { + for (byte j = 0; j < 2; j++) { + _vm->_gyro->_also[i][j] = new Common::String; + *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } - *_vm->_gyro->_also[fv][0] = Common::String('\x9D') + *_vm->_gyro->_also[fv][0] + Common::String('\x9D'); + *_vm->_gyro->_also[i][0] = Common::String('\x9D') + *_vm->_gyro->_also[i][0] + Common::String('\x9D'); } memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); - //fv = getpixel(0, 0); - _vm->_gyro->_lineNum = f.readByte(); + _vm->_gyro->_lineNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { - _vm->_gyro->_lines[i]._x1 = f.readSint16LE(); - _vm->_gyro->_lines[i]._y1 = f.readSint16LE(); - _vm->_gyro->_lines[i]._x2 = f.readSint16LE(); - _vm->_gyro->_lines[i]._y2 = f.readSint16LE(); - _vm->_gyro->_lines[i]._color = f.readByte(); + _vm->_gyro->_lines[i]._x1 = file.readSint16LE(); + _vm->_gyro->_lines[i]._y1 = file.readSint16LE(); + _vm->_gyro->_lines[i]._x2 = file.readSint16LE(); + _vm->_gyro->_lines[i]._y2 = file.readSint16LE(); + _vm->_gyro->_lines[i]._color = file.readByte(); } memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); - fv = f.readByte(); - for (byte i = 0; i < fv; i++) { - _vm->_gyro->_peds[i]._x = f.readSint16LE(); - _vm->_gyro->_peds[i]._y = f.readSint16LE(); - _vm->_gyro->_peds[i]._direction = f.readByte(); + byte pedNum = file.readByte(); + for (byte i = 0; i < pedNum; i++) { + _vm->_gyro->_peds[i]._x = file.readSint16LE(); + _vm->_gyro->_peds[i]._y = file.readSint16LE(); + _vm->_gyro->_peds[i]._direction = file.readByte(); } - _vm->_gyro->_fieldNum = f.readByte(); + _vm->_gyro->_fieldNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { - _vm->_gyro->_fields[i]._x1 = f.readSint16LE(); - _vm->_gyro->_fields[i]._y1 = f.readSint16LE(); - _vm->_gyro->_fields[i]._x2 = f.readSint16LE(); - _vm->_gyro->_fields[i]._y2 = f.readSint16LE(); + _vm->_gyro->_fields[i]._x1 = file.readSint16LE(); + _vm->_gyro->_fields[i]._y1 = file.readSint16LE(); + _vm->_gyro->_fields[i]._x2 = file.readSint16LE(); + _vm->_gyro->_fields[i]._y2 = file.readSint16LE(); } for (byte i = 0; i < 15; i++) { - _vm->_gyro->_magics[i]._operation = f.readByte(); - _vm->_gyro->_magics[i]._data = f.readUint16LE(); + _vm->_gyro->_magics[i]._operation = file.readByte(); + _vm->_gyro->_magics[i]._data = file.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro->_portals[i]._operation = f.readByte(); - _vm->_gyro->_portals[i]._data = f.readUint16LE(); + _vm->_gyro->_portals[i]._operation = file.readByte(); + _vm->_gyro->_portals[i]._data = file.readUint16LE(); } _vm->_gyro->_flags.clear(); for (byte i = 0; i < 26; i++) - _vm->_gyro->_flags += f.readByte(); + _vm->_gyro->_flags += file.readByte(); - int16 listen_length = f.readByte(); + int16 listen_length = file.readByte(); _vm->_gyro->_listen.clear(); for (byte i = 0; i < listen_length; i++) - _vm->_gyro->_listen += f.readByte(); - - draw_also_lines(); + _vm->_gyro->_listen += file.readByte(); - //setactivepage(1); - warning("STUB: Lucerna::load_also()"); + drawAlsoLines(); - f.close(); - unscramble(); - for (fv = 0; fv <= minnames; fv++) - *_vm->_gyro->_also[fv][0] = Common::String(',') + *_vm->_gyro->_also[fv][0] + ','; + file.close(); + unScramble(); + for (byte i = 0; i <= alsoNum; i++) + *_vm->_gyro->_also[i][0] = Common::String(',') + *_vm->_gyro->_also[i][0] + ','; } -void Lucerna::load(byte n) { // Load2, actually - Common::String xx; - +void Lucerna::loadRoom(byte num) { CursorMan.showMouse(false); _vm->_graphics->fleshColors(); - xx = _vm->_gyro->intToStr(n); Common::String filename; - filename = filename.format("place%s.avd", xx.c_str()); - if (!f.open(filename)) { + filename = filename.format("place%d.avd", num); + if (!file.open(filename)) { warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); return; } - f.seek(146); + file.seek(146); if (!_vm->_gyro->_roomnName.empty()) _vm->_gyro->_roomnName.clear(); for (byte i = 0; i < 30; i++) { - char actChar = f.readByte(); + char actChar = file.readByte(); if ((32 <= actChar) && (actChar <= 126)) _vm->_gyro->_roomnName += actChar; } // Compression method byte follows this... - f.seek(177); + file.seek(177); - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); + _vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); _vm->_graphics->refreshBackground(); - f.close(); + file.close(); - load_also(xx); - _vm->_celer->loadBackgroundSprites(n); - // byte bit = *_vm->_graphics->getPixel(0,0); + loadAlso(num); + _vm->_celer->loadBackgroundSprites(num); CursorMan.showMouse(true); } -void Lucerna::zoomout(int16 x, int16 y) { -// int16 x1, y1, x2, y2; -// byte fv; - +void Lucerna::zoomOut(int16 x, int16 y) { warning("STUB: Lucerna::zoomout()"); } -void Lucerna::find_people(byte room) { - for (byte fv = 1; fv < 29; fv++) { - if (_vm->_gyro->_whereIs[fv] == room) { - if (fv < 25) - _vm->_gyro->_him = fv + 150; +void Lucerna::findPeople(byte room) { + for (byte i = 1; i < 29; i++) { + if (_vm->_gyro->_whereIs[i] == room) { + if (i < 25) + _vm->_gyro->_him = i + 150; else - _vm->_gyro->_her = fv + 150; + _vm->_gyro->_her = i + 150; } } } -void Lucerna::exitroom(byte x) { +void Lucerna::exitRoom(byte x) { //nosound(); _vm->_celer->forgetBackgroundSprites(); _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. @@ -321,7 +302,7 @@ void Lucerna::exitroom(byte x) { _vm->_gyro->_dna._lastRoomNotMap = _vm->_gyro->_dna._room; } -void Lucerna::new_town() { // You've just entered a town from the map. +void Lucerna::enterNewTown() { _vm->_dropdown->setupMenu(); switch (_vm->_gyro->_dna._room) { @@ -351,41 +332,41 @@ void Lucerna::new_town() { // You've just entered a town from the map. -void Lucerna::put_geida_at(byte whichped, byte &ped) { +void Lucerna::putGeidaAt(byte whichPed, byte &ped) { if (ped == 0) return; _vm->_trip->tr[1].init(5, false, _vm->_trip); // load Geida - _vm->_trip->apped(2, whichped); + _vm->_trip->apped(2, whichPed); _vm->_trip->tr[1].call_eachstep = true; _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; } -void Lucerna::enterroom(byte x, byte ped) { +void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. - find_people(x); - _vm->_gyro->_dna._room = x; + findPeople(room); + _vm->_gyro->_dna._room = room; if (ped != 0) - _vm->_gyro->_dna._roomCount[x]++; + _vm->_gyro->_dna._roomCount[room]++; - load(x); + loadRoom(room); - if ((_vm->_gyro->_dna._roomCount[x] == 0) && (! _vm->_gyro->setFlag('S'))) - points(1); + if ((_vm->_gyro->_dna._roomCount[room] == 0) && (! _vm->_gyro->setFlag('S'))) + incScore(1); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; if (_vm->_gyro->_dna._geidaFollows) - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleGeida - 150] = x; + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleGeida - 150] = room; _vm->_gyro->_roomTime = 0; if ((_vm->_gyro->_dna._lastRoom == r__map) && (_vm->_gyro->_dna._lastRoomNotMap != _vm->_gyro->_dna._room)) - new_town(); + enterNewTown(); - switch (x) { + switch (room) { case r__yours: if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); @@ -449,7 +430,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__brummieroad: if (_vm->_gyro->_dna._geidaFollows) - put_geida_at(5, ped); + putGeidaAt(5, ped); if (_vm->_gyro->_dna._cwytalotGone) { _vm->_gyro->_magics[kColorLightred - 1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; @@ -492,7 +473,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->_magics[kColorGreen - 1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. } if (_vm->_gyro->_dna._geidaFollows) - put_geida_at(ped + 3, ped); // load Geida + putGeidaAt(ped + 3, ped); // load Geida break; case r__robins: @@ -549,14 +530,14 @@ void Lucerna::enterroom(byte x, byte ped) { dawn(); //setactivepage(cp); if (ped > 0) - zoomout(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); + zoomOut(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); //setactivepage(1 - cp); { if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { _vm->_visa->dixi('q', 9); // Don't want to waste the wine! _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; - objectlist(); + refreshObjectList(); } } @@ -610,7 +591,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->_dna._geidaFollows) { - put_geida_at(5, ped); + putGeidaAt(5, ped); if (_vm->_gyro->_dna._lustieIsAsleep) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); @@ -738,18 +719,18 @@ void Lucerna::enterroom(byte x, byte ped) { break; // Ayles awake. case r__geidas: - put_geida_at(2, ped); + putGeidaAt(2, ped); break; // load Geida case r__easthall: case r__westhall: if (_vm->_gyro->_dna._geidaFollows) - put_geida_at(ped + 2, ped); + putGeidaAt(ped + 2, ped); break; case r__lusties: if (_vm->_gyro->_dna._geidaFollows) - put_geida_at(ped + 6, ped); + putGeidaAt(ped + 6, ped); break; case r__nottspub: @@ -781,43 +762,45 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_gyro->isLoaded = false; } -void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! - const int16 picsize = 966; - const ByteField thinkspace = {25, 170, 32, 200}; +void Lucerna::thinkAbout(byte object, bool type) { + const int16 picSize = 966; - _vm->_gyro->_thinks = z; - z--; + _vm->_gyro->_thinks = object; + object--; _vm->_gyro->setMousePointerWait(); - if (th) { - if (!f.open("thinks.avd")) { + switch (type) { + case Gyro::kThing: + if (!file.open("thinks.avd")) { warning("AVALANCHE: Lucerna: File not found: thinks.avd"); return; } - } else { - if (!f.open("folk.avd")) { + break; + case Gyro::kPerson: + if (!file.open("folk.avd")) { warning("AVALANCHE: Lucerna: File not found: folk.avd"); return; } - z = z - 149; - if (z >= 25) - z -= 8; - if (z == 20) - z--; // Last time... + object = object - 149; + if (object >= 25) + object -= 8; + if (object == 20) + object--; // Last time... + break; } - f.seek(z * picsize + 65); + file.seek(object * picSize + 65); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); picture.free(); - f.close(); + file.close(); CursorMan.showMouse(false); @@ -827,75 +810,57 @@ void Lucerna::thinkabout(byte z, bool th) { // Hey!!! Get it and put it!!! setactivepage(1 - cp); #endif - for (byte fv = 0; fv <= 1; fv++) - _vm->_trip->getset[fv].remember(thinkspace); - CursorMan.showMouse(true); - _vm->_gyro->_thinkThing = th; + _vm->_gyro->_thinkThing = type; } -void Lucerna::load_digits() { // Load the scoring digits & rwlites +void Lucerna::loadDigits() { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; - if (!f.open("digit.avd")) { + if (!file.open("digit.avd")) { warning("AVALANCHE: Lucerna: File not found: digit.avd"); return; } - for (byte fv = 0; fv < 10; fv++) { - f.seek(fv * digitsize); - -#if 0 - _vm->_gyro->digit[fv] = new byte[digitsize]; - f.read(_vm->_gyro->digit[fv], digitsize); -#endif - - _vm->_gyro->_digits[fv] = _vm->_graphics->loadPictureGraphic(f); + for (byte i = 0; i < 10; i++) { + file.seek(i * digitsize); + _vm->_gyro->_digits[i] = _vm->_graphics->loadPictureGraphic(file); } - for (byte ff = 0; ff < 9; ff++) { - f.seek(10 * digitsize + ff * rwlitesize); - -#if 0 - _vm->_gyro->rwlite[ff] = new byte[rwlitesize]; - f.read(_vm->_gyro->rwlite[ff], rwlitesize); -#endif - - _vm->_gyro->_directions[ff] = _vm->_graphics->loadPictureGraphic(f); + for (byte i = 0; i < 9; i++) { + file.seek(10 * digitsize + i * rwlitesize); + _vm->_gyro->_directions[i] = _vm->_graphics->loadPictureGraphic(file); } - f.close(); + file.close(); } -void Lucerna::toolbar() { - if (!f.open("useful.avd")) { +void Lucerna::drawToolbar() { + if (!file.open("useful.avd")) { warning("AVALANCHE: Lucerna: File not found: useful.avd"); return; } - f.seek(40); + file.seek(40); - // off; + CursorMan.showMouse(false); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(f); + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); picture.free(); - f.close(); + file.close(); - // on; + CursorMan.showMouse(true); _vm->_gyro->_oldDirection = 177; - showrw(); + drawDirection(); } -void Lucerna::showscore() { - - const ByteField scorespace = {33, 177, 39, 200}; - +void Lucerna::drawScore() { if (_vm->_gyro->kDemo) return; @@ -912,23 +877,17 @@ void Lucerna::showscore() { CursorMan.showMouse(false); - //setactivepage(3); - for (byte fv = 0; fv < 3; fv++) if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[fv]], 250 + (fv + 1) * 15, 177); - for (byte fv = 0; fv < 2; fv++) - _vm->_trip->getset[fv].remember(scorespace); - - //setactivepage(1 - cp); - CursorMan.showMouse(true); + for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = numbers[i]; } -void Lucerna::points(byte num) { // Add on no. of points +void Lucerna::incScore(byte num) { // Add on no. of points for (byte q = 1; q <= num; q++) { _vm->_gyro->_dna._score++; @@ -942,39 +901,35 @@ void Lucerna::points(byte num) { // Add on no. of points } warning("STUB: Lucerna::points()"); - showscore(); + drawScore(); } -void Lucerna::topcheck(Common::Point cursorPos) { - _vm->_dropdown->_menuBar.chooseMenuItem(cursorPos.x); -} - -void Lucerna::mouseway(const Common::Point &cursorPos) { - byte col = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); +void Lucerna::useCompass(const Common::Point &cursorPos) { + byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); - switch (col) { + switch (color) { case kColorGreen: { _vm->_gyro->_dna._direction = _vm->_trip->kDirUp; _vm->_trip->rwsp(0, _vm->_trip->kDirUp); - showrw(); + drawDirection(); } break; case kColorBrown: { _vm->_gyro->_dna._direction = _vm->_trip->kDirDown; _vm->_trip->rwsp(0, _vm->_trip->kDirDown); - showrw(); + drawDirection(); } break; case kColorCyan: { _vm->_gyro->_dna._direction = _vm->_trip->kDirLeft; _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); - showrw(); + drawDirection(); } break; case kColorLightmagenta: { _vm->_gyro->_dna._direction = _vm->_trip->kDirRight; _vm->_trip->rwsp(0, _vm->_trip->kDirRight); - showrw(); + drawDirection(); } break; case kColorRed: @@ -982,32 +937,28 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { case kColorLightcyan: case kColorYellow: { // Fall-throughs are intended. _vm->_trip->stopwalking(); - showrw(); + drawDirection(); } break; } } -void Lucerna::posxy() { - warning("STUB: Lucerna::posxy()"); -} - -void Lucerna::fxtoggle() { +void Lucerna::fxToggle() { warning("STUB: Lucerna::fxtoggle()"); } -void Lucerna::objectlist() { +void Lucerna::refreshObjectList() { _vm->_gyro->_dna._carryNum = 0; if (_vm->_gyro->_thinkThing && !_vm->_gyro->_dna._objects[_vm->_gyro->_thinks - 1]) - thinkabout(_vm->_gyro->kObjectMoney, _vm->_gyro->kThing); // you always have money - for (byte fv = 0; fv < kObjectNum; fv++) - if (_vm->_gyro->_dna._objects[fv]) { + thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); // you always have money + for (byte i = 0; i < kObjectNum; i++) + if (_vm->_gyro->_dna._objects[i]) { _vm->_gyro->_dna._carryNum++; - _vm->_gyro->_objectList[_vm->_gyro->_dna._carryNum] = fv + 1; + _vm->_gyro->_objectList[_vm->_gyro->_dna._carryNum] = i + 1; } } -void Lucerna::verte(Common::Point cursorPos) { +void Lucerna::guideAvvy(Common::Point cursorPos) { if (! _vm->_gyro->_dna._userMovesAvvy) return; @@ -1057,10 +1008,10 @@ void Lucerna::verte(Common::Point cursorPos) { break; } // No other values are possible. - showrw(); + drawDirection(); } -void Lucerna::checkclick() { +void Lucerna::checkClick() { Common::Point cursorPos = _vm->getMousePos(); _vm->_gyro->_onToolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); @@ -1076,7 +1027,7 @@ void Lucerna::checkclick() { else if (!_vm->_gyro->_dropdownActive) { // Dropdown can handle its own pointers. if (holdLeftMouse) { _vm->_gyro->newMouse(7); // Mark's crosshairs - verte(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. + guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else _vm->_gyro->newMouse(4); // fletch } @@ -1096,7 +1047,7 @@ void Lucerna::checkclick() { } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) - mouseway(cursorPos); + useCompass(cursorPos); } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { _vm->updateEvents(); @@ -1124,7 +1075,7 @@ void Lucerna::checkclick() { _vm->_trip->tr[0].xs = _vm->_gyro->kRun; _vm->_trip->newspeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) - fxtoggle(); + fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; } else if (!_vm->_gyro->_dropsOk) @@ -1132,170 +1083,102 @@ void Lucerna::checkclick() { } } -void Lucerna::mouse_init() { - _vm->_gyro->setMousePointerWait(); -} - -void Lucerna::mousepage(uint16 page_) { - warning("STUB: Lucerna::mousepage()"); -} - -void Lucerna::errorled() { +void Lucerna::errorLed() { warning("STUB: Lucerna::errorled()"); } int8 Lucerna::fades(int8 x) { - byte r = x / 16; - x = x % 16; - byte g = x / 4; - byte b = x % 4; - if (r > 0) - r--; - if (g > 0) - g--; - if (b > 0) - b--; - - return (16 * r + 4 * g + b); - // fades = x - 1; + warning("STUB: Lucerna::fades()"); + return 0; } - - - -void Lucerna::fadeout(byte n) { - warning("STUB: Lucerna::fadeout()"); // I'll bother with colors later. +void Lucerna::fadeOut(byte n) { + warning("STUB: Lucerna::fadeOut()"); } void Lucerna::dusk() { - warning("STUB: Lucerna::dusk()"); // I'll bother with colors later. + warning("STUB: Lucerna::dusk()"); } - - - -void Lucerna::fadein(byte n) { - warning("STUB: Lucerna::fadein()"); +void Lucerna::fadeIn(byte n) { + warning("STUB: Lucerna::fadeIn()"); } void Lucerna::dawn() { warning("STUB: Lucerna::dawn()"); } - - -void Lucerna::showrw() { // It's data is loaded in load_digits(). +void Lucerna::drawDirection() { // It's data is loaded in load_digits(). if (_vm->_gyro->_oldDirection == _vm->_gyro->_dna._direction) return; + _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; - CursorMan.showMouse(false); -#if 0 - for (byte page_ = 0; page_ <= 1; page_++) { - setactivepage(page_); - putimage(0, 161, rwlite[with.rw], 0); - } -#endif + CursorMan.showMouse(false); _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_dna._direction], 0, 161); CursorMan.showMouse(true); - //setactivepage(1 - cp); - - warning("STUB: Lucerna::showrw()"); } - - - - - -void Lucerna::calchand(uint16 ang, uint16 length, Common::Point &a, byte c) { - if (ang > 900) { - a.x = 177; +void Lucerna::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { + if (angle > 900) { + endPoint.x = 177; return; } - a = _vm->_graphics->drawArc(_vm->_graphics->_surface, _clockCenterX, _clockCenterY, 449 - ang, 450 - ang, length, c); + endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, _clockCenterX, _clockCenterY, 449 - angle, 450 - angle, length, color); } -void Lucerna::hand(const Common::Point &a, byte c) { - if (a.x == 177) +void Lucerna::drawHand(const Common::Point &endPoint, byte color) { + if (endPoint.x == 177) return; - _vm->_graphics->_surface.drawLine(_clockCenterX, _clockCenterY, a.x, a.y, c); -} - -void Lucerna::refresh_hands() { - const ByteField clockspace = {61, 166, 66, 200}; - - for (byte page_ = 0; page_ < 2; page_++) - _vm->_trip->getset[page_].remember(clockspace); + _vm->_graphics->_surface.drawLine(_clockCenterX, _clockCenterY, endPoint.x, endPoint.y, color); } -void Lucerna::plothands() { - // off; - //setactivepage(3); - calchand(_vm->_gyro->_onh, 14, ah, kColorYellow); - calchand(_vm->_gyro->_om * 6, 17, am, kColorYellow); - hand(ah, kColorBrown); - hand(am, kColorBrown); - - calchand(nh, 14, ah, kColorBrown); - calchand(_vm->_gyro->_minutes * 6, 17, am, kColorBrown); - hand(ah, kColorYellow); - hand(am, kColorYellow); - - //setactivepage(1 - cp); +void Lucerna::plotHands() { + calcHand(_vm->_gyro->_onh, 14, _clockHandHour, kColorYellow); + calcHand(_vm->_gyro->_om * 6, 17, _clockHandMinute, kColorYellow); + drawHand(_clockHandHour, kColorBrown); + drawHand(_clockHandMinute, kColorBrown); - refresh_hands(); - - // on; + calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); + calcHand(_vm->_gyro->_minutes * 6, 17, _clockHandMinute, kColorBrown); + drawHand(_clockHandHour, kColorYellow); + drawHand(_clockHandMinute, kColorYellow); } void Lucerna::chime() { warning("STUB: Lucerna::chime()"); } -void Lucerna::clock_lucerna() { - // ...Clock. +void Lucerna::updateClock() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. TimeDate t; _vm->_system->getTimeAndDate(t); _vm->_gyro->_hours = t.tm_hour; _vm->_gyro->_minutes = t.tm_min; _vm->_gyro->_seconds = t.tm_sec; - nh = (_vm->_gyro->_hours % 12) * 30 + _vm->_gyro->_minutes / 2; + _hourAngle = (_vm->_gyro->_hours % 12) * 30 + _vm->_gyro->_minutes / 2; if (_vm->_gyro->_oh != _vm->_gyro->_hours) { - plothands(); + plotHands(); chime(); } if (_vm->_gyro->_om != _vm->_gyro->_minutes) - plothands(); + plotHands(); if ((_vm->_gyro->_hours == 0) && (_vm->_gyro->_oh != 0) && (_vm->_gyro->_oh != 17717)) _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); _vm->_gyro->_oh = _vm->_gyro->_hours; - _vm->_gyro->_onh = nh; + _vm->_gyro->_onh = _hourAngle; _vm->_gyro->_om = _vm->_gyro->_minutes; } - - -void Lucerna::delavvy() { - CursorMan.showMouse(false); - -// triptype &with = _vm->_trip->tr[0]; -// for (byte page_ = 0; page_ <= 1; page_++) -// mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); - - CursorMan.showMouse(true); -} - -void Lucerna::gameover() { +void Lucerna::gameOver() { _vm->_gyro->_dna._userMovesAvvy = false; int16 sx = _vm->_trip->tr[0].x; @@ -1307,36 +1190,32 @@ void Lucerna::gameover() { _vm->_trip->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); - _vm->_gyro->_alive = false; } -/* OK. There are two kinds of redraw: Major and Minor. Minor is what happens - when you load a game, etc. Major redraws EVERYTHING. */ - -void Lucerna::minor_redraw() { +void Lucerna::minorRedraw() { dusk(); - enterroom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant. + enterRoom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant. - for (byte fv = 0; fv <= 1; fv++) { + for (byte i = 0; i <= 1; i++) { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; _vm->_trip->getback(); } for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits - showscore(); + drawScore(); dawn(); } -void Lucerna::major_redraw() { +void Lucerna::majorRedraw() { warning("STUB: Lucerna::major_redraw()"); } -uint16 Lucerna::bearing(byte whichped) { - byte pedId = whichped - 1; // Different array indexes in Pascal and C. +uint16 Lucerna::bearing(byte whichPed) { + byte pedId = whichPed - 1; // Different array indexes in Pascal and C. const double rad2deg = 180 / 3.14; // Pi @@ -1351,25 +1230,20 @@ uint16 Lucerna::bearing(byte whichped) { } } -void Lucerna::sprite_run() { -/* A sprite run is performed before displaying a scroll, if not all the - sprites are still. It performs two fast cycles, only using a few of - the links usually used, and without any extra animation. This should - make the sprites the same on both pages. */ +void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; _vm->_trip->get_back_loretta(); _vm->_trip->trippancy_link(); _vm->_gyro->_doingSpriteRun = false; - } -void Lucerna::fix_flashers() { +void Lucerna::fixFlashers() { _vm->_gyro->_ledStatus = 177; _vm->_gyro->_oldDirection = 177; _vm->_scrolls->state(2); - showrw(); + drawDirection(); } } // End of namespace Avalanche diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 1436e388b542..6835fe01c168 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -45,94 +45,69 @@ class Lucerna { void init(); void callVerb(byte id); - void draw_also_lines(); - void mouse_init(); - void mousepage(uint16 page_); - void load(byte n); - void exitroom(byte x); - void enterroom(byte x, byte ped); - void thinkabout(byte z, bool th); // Hey!!! Get it and put it!!! - void load_digits(); // Load the scoring digits & rwlites - void toolbar(); - void showscore(); - void points(byte num); // Add on no. of points - void mouseway(const Common::Point &cursorPos); - void posxy(); - void fxtoggle(); - void objectlist(); - void checkclick(); - void errorled(); + void drawAlsoLines(); + void loadRoom(byte num); + void exitRoom(byte x); + void enterRoom(byte room, byte ped); + void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! + void loadDigits(); // Load the scoring digits & rwlites + void drawToolbar(); + void drawScore(); + void incScore(byte num); // Add on no. of points + void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. + void fxToggle(); + void refreshObjectList(); + void checkClick(); + void errorLed(); void dusk(); void dawn(); - void showrw(); - void clock_lucerna(); - void delavvy(); - void gameover(); - void minor_redraw(); - void major_redraw(); - uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees. - void flesh_colors(); - void sprite_run(); - void fix_flashers(); - void load_also(Common::String n); + void drawDirection(); // Draws the little icon at the left end of the text input field. + void updateClock(); + void gameOver(); + uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. + void fixFlashers(); + void loadAlso(byte num); -private: - AvalancheEngine *_vm; + // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. + void minorRedraw(); + void majorRedraw(); - struct rgbrec { - int16 red; - int16 green; - int16 blue; - }; + // A sprite run is performed before displaying a scroll, if not all the sprites are still. It performs two fast cycles, only using a few of + // the links usually used, and without any extra animation. This should make the sprites the same on both pages. + void spriteRun(); - struct palettetype { - int32 size; - rgbrec colors[256]; - }; +private: + AvalancheEngine *_vm; //Clock static const int16 _clockCenterX = 510; static const int16 _clockCenterY = 183; - Common::Point ah, am; - uint16 nh; - - - palettetype fxpal[4]; - - bool fxhidden; - - Common::File f; + Common::Point _clockHandHour, _clockHandMinute; // ah and am in the original. + uint16 _hourAngle; // nh in the original. + bool _fxHidden; // Will de used in dust() and dawn(). + Common::File file; + Common::String readAlsoStringFromFile(); // 'nexstring' in the original. + void scram(Common::String &str); + void unScramble(); - Common::String nextstring(); - void scram1(Common::String &x); - void unscramble(); - - void zoomout(int16 x, int16 y); - - void find_people(byte room); - - void new_town(); - - void put_geida_at(byte whichped, byte &ped); - - void topcheck(Common::Point cursorPos); - - void verte(Common::Point cursorPos); + void zoomOut(int16 x, int16 y); // Only used when entering the map. + void enterNewTown(); // Onyl when entering a NEW town! Not returning to the last one, but choosing another from the map. + void findPeople(byte room); + void putGeidaAt(byte whichPed, byte &ped); + void guideAvvy(Common::Point cursorPos); // 'verte' in the original. + // Used in dusk() and dawn(). int8 fades(int8 x); + void fadeOut(byte n); + void fadeIn(byte n); - void fadeout(byte n); - - void fadein(byte n); - - // clock_lucerna - void calchand(uint16 ang, uint16 length, Common::Point &a, byte c); - void hand(const Common::Point &a, byte c); - void refresh_hands(); - void plothands(); + // Clock + void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); + void drawHand(const Common::Point &endPoint, byte color); + void plotHands(); void chime(); }; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 67247a448375..16e0fb11ad05 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -123,7 +123,6 @@ void Scrolls::normscroll() { _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); _vm->_gyro->newMouse(4); - _vm->_lucerna->mousepage(1 - _vm->_gyro->_cp); @@ -185,7 +184,6 @@ void Scrolls::normscroll() { state(0); _vm->_gyro->_seeScroll = false; - _vm->_lucerna->mousepage(_vm->_gyro->_cp); CursorMan.showMouse(false); _vm->_lucerna->holdLeftMouse = false; // Used in Lucerna::checkclick(). @@ -258,7 +256,7 @@ void Scrolls::resetscrolldriver() { // phew void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little... for (byte fv = 0; fv < _vm->_gyro->_scrollBells; fv++) - _vm->_lucerna->errorled(); // ring the bell "x" times + _vm->_lucerna->errorLed(); // ring the bell "x" times } void Scrolls::dodgem() { @@ -666,7 +664,7 @@ void Scrolls::calldrivers() { break; if (call_spriterun) - _vm->_lucerna->sprite_run(); + _vm->_lucerna->spriteRun(); call_spriterun = false; drawscroll(&Avalanche::Scrolls::normscroll); @@ -685,14 +683,14 @@ void Scrolls::calldrivers() { break; if (call_spriterun) - _vm->_lucerna->sprite_run(); + _vm->_lucerna->spriteRun(); call_spriterun = false; if (param == 0) natural(); else if ((1 <= param) && (param <= 9)) { if ((param > _vm->_trip->kSpriteNumbMax) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. - _vm->_lucerna->errorled(); + _vm->_lucerna->errorLed(); natural(); } else _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. @@ -706,7 +704,7 @@ void Scrolls::calldrivers() { _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[param - 10]._foregroundColor; _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[param - 10]._backgroundColor; // Colors. } else { - _vm->_lucerna->errorled(); // Not valid. + _vm->_lucerna->errorLed(); // Not valid. natural(); } @@ -747,7 +745,7 @@ void Scrolls::calldrivers() { _vm->_visa->dixi('q', 37); // You find the sixpence. _vm->_gyro->_dna._money += 6; _vm->_gyro->_dna._boxContent = _vm->_acci->kNothing; - _vm->_lucerna->points(2); + _vm->_lucerna->incScore(2); return; } break; @@ -777,7 +775,7 @@ void Scrolls::calldrivers() { break; case kControlQuestion: { if (call_spriterun) - _vm->_lucerna->sprite_run(); + _vm->_lucerna->spriteRun(); call_spriterun = false; _vm->_gyro->_scrollNum++; @@ -850,7 +848,7 @@ void Scrolls::musical_scroll() { + kControlInsertSpaces + "Q W E R T Y U I O P [ ]" + kControlNewLine + kControlNewLine + "Or press Enter to stop playing." + kControlToBuffer); - _vm->_lucerna->sprite_run(); + _vm->_lucerna->spriteRun(); drawscroll(&Avalanche::Scrolls::music_scroll); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 085df26923d4..2383d02fac01 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -239,13 +239,13 @@ void Timeout::avaricius_talks() { if (_vm->_gyro->_dna._avariciusTalk < 17) set_up_timer(177, procavaricius_talks, reason_avariciustalks); else - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); } void Timeout::urinate() { _vm->_trip->tr[0].turn(_vm->_trip->kDirUp); _vm->_trip->stopwalking(); - _vm->_lucerna->showrw(); + _vm->_lucerna->drawDirection(); set_up_timer(14, proctoilet2, reason_gototoilet); } @@ -349,7 +349,7 @@ void Timeout::after_the_shootemup() { _vm->_trip->apped(1, 2); _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") @@ -399,7 +399,7 @@ void Timeout::jacques_wakes_up() { if (_vm->_gyro->_dna._jacquesState == 5) { _vm->_gyro->_dna._bellsAreRinging = true; _vm->_gyro->_dna._aylesIsAwake = true; - _vm->_lucerna->points(2); + _vm->_lucerna->incScore(2); } switch (_vm->_gyro->_dna._jacquesState) { @@ -480,9 +480,9 @@ void Timeout::jump() { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_visa->dixi('q', 50); - _vm->_lucerna->points(3); + _vm->_lucerna->incScore(3); } } } @@ -513,14 +513,14 @@ void Timeout::buywine() { if (_vm->_gyro->decreaseMoney(3)) { _vm->_visa->dixi('D', 4); // You paid up. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wineState = 1; // OK Wine. } } void Timeout::callsguards() { _vm->_visa->dixi('Q', 58); // "GUARDS!!!" - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); } void Timeout::greetsmonk() { @@ -539,7 +539,7 @@ void Timeout::meet_avaroid() { if (_vm->_gyro->_dna._metAvaroid) { _vm->_scrolls->display(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); } else { _vm->_visa->dixi('Q', 60); _vm->_gyro->_dna._metAvaroid = true; @@ -663,7 +663,7 @@ void Timeout::spludwick_leaves_cauldron() { void Timeout::give_lute_to_geida() { // Moved here from Acci. _vm->_visa->dixi('Q', 86); - _vm->_lucerna->points(4); + _vm->_lucerna->incScore(4); _vm->_gyro->_dna._lustieIsAsleep = true; _vm->_sequence->first_show(5); _vm->_sequence->then_show(6); // He falls asleep... diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index c74efb5f928a..b94697f385a9 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -263,7 +263,7 @@ void triptype::bounce() { else stopwalk(); _tr->_vm->_gyro->_onCanDoPageSwap = false; - _tr->_vm->_lucerna->showrw(); + _tr->_vm->_lucerna->drawDirection(); _tr->_vm->_gyro->_onCanDoPageSwap = true; } @@ -565,7 +565,7 @@ void Trip::catamove(byte ped) { } if (!_vm->_gyro->_dna._enterCatacombsFromLustiesRoom) - _vm->_lucerna->load(29); + _vm->_lucerna->loadRoom(29); here = _vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1]; switch (here & 0xf) { // West. @@ -928,7 +928,7 @@ void Trip::call_special(uint16 which) { tr[1].turn(kDirDown); tr[1].stopwalk(); tr[1].call_eachstep = false; // Geida - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); } break; case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... @@ -955,7 +955,6 @@ void Trip::call_special(uint16 which) { catamove(4); if (_vm->_gyro->_dna._room != r__catacombs) return; - _vm->_lucerna->delavvy(); switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { case 0x1: apped(1, 12); @@ -975,7 +974,6 @@ void Trip::call_special(uint16 which) { catamove(1); if (_vm->_gyro->_dna._room != r__catacombs) return; - _vm->_lucerna->delavvy(); apped(1, 1); getback(); dawndelay(); @@ -986,7 +984,6 @@ void Trip::call_special(uint16 which) { catamove(2); if (_vm->_gyro->_dna._room != r__catacombs) return; - _vm->_lucerna->delavvy(); apped(1, 2); getback(); dawndelay(); @@ -997,7 +994,6 @@ void Trip::call_special(uint16 which) { catamove(3); if (_vm->_gyro->_dna._room != r__catacombs) return; - _vm->_lucerna->delavvy(); apped(1, 3); getback(); dawndelay(); @@ -1224,7 +1220,7 @@ void Trip::arrow_procs(byte tripnum) { end; on; #endif - _vm->_lucerna->gameover(); + _vm->_lucerna->gameOver(); _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); @@ -1499,7 +1495,7 @@ void Trip::fliproom(byte room, byte ped) { return; } - _vm->_lucerna->exitroom(_vm->_gyro->_dna._room); + _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); _vm->_lucerna->dusk(); getsetclear(); @@ -1512,12 +1508,12 @@ void Trip::fliproom(byte room, byte ped) { if (_vm->_gyro->_dna._room == r__lustiesroom) _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; - _vm->_lucerna->enterroom(room, ped); + _vm->_lucerna->enterRoom(room, ped); apped(1, ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; _vm->_gyro->_dna._direction = tr[0].face; - _vm->_lucerna->showrw(); + _vm->_lucerna->drawDirection(); for (fv = 0; fv <= 1; fv++) { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 2f438ba5f900..bcdf7b73accb 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -175,8 +175,8 @@ void Visa::talkto(byte whom) { if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1])) { dixi('q', 68); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; - _vm->_lucerna->objectlist(); - _vm->_lucerna->points(3); + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(3); return; } else { if (_vm->_gyro->_dna._talkedToCrapulus) @@ -277,7 +277,7 @@ void Visa::talkto(byte whom) { if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = true; - _vm->_lucerna->objectlist(); + _vm->_lucerna->refreshObjectList(); dixi('q', 1); // Circular from Cardiff. _vm->_gyro->_dna._talkedToCrapulus = true; @@ -286,7 +286,7 @@ void Visa::talkto(byte whom) { _vm->_trip->tr[1].vanishifstill = true; _vm->_trip->tr[1].walkto(3); // Walks away. - _vm->_lucerna->points(2); + _vm->_lucerna->incScore(2); } } From 467a7b1cce55680bddbae18fe655b386a4f3d051 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 18:00:00 +0200 Subject: [PATCH 0852/1332] AVALANCHE: Introduce a new class: Clock. --- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/dropdown2.cpp | 16 ++-- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/gyro2.h | 1 - engines/avalanche/lucerna2.cpp | 136 ++++++++++++++++---------------- engines/avalanche/lucerna2.h | 39 +++++---- engines/avalanche/scrolls2.cpp | 2 +- 8 files changed, 107 insertions(+), 95 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index fbdeb2583b08..27cfdd1178bf 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -525,10 +525,10 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). + _lucerna->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). break; case Common::EVENT_LBUTTONUP: - _lucerna->holdLeftMouse = false; // Same as above. + _lucerna->_holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: _avalot->handleKeyDown(event); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ff8a5aa8bf29..814de6368ad5 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -198,7 +198,7 @@ void Avalot::run(Common::String arg) { - _vm->_lucerna->updateClock(); + _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); _vm->_trip->get_back_loretta(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index b0b3b2fd517b..9894769d41ef 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -728,11 +728,11 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); - while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->holdLeftMouse) { + while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->_holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); - while (_vm->_lucerna->holdLeftMouse); + while (_vm->_lucerna->_holdLeftMouse); while (!_vm->shouldQuit()) { @@ -755,16 +755,16 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); - } while (!_vm->_lucerna->holdLeftMouse); + } while (!_vm->_lucerna->_holdLeftMouse); - if (_vm->_lucerna->holdLeftMouse) { + if (_vm->_lucerna->_holdLeftMouse) { if (cursorPos.y > 21) { if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1))))) { // Clicked OUTSIDE the menu. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); - _vm->_lucerna->holdLeftMouse = false; + _vm->_lucerna->_holdLeftMouse = false; backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). @@ -778,11 +778,11 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... - _vm->_lucerna->holdLeftMouse = false; + _vm->_lucerna->_holdLeftMouse = false; backup.free(); return; } else { - _vm->_lucerna->holdLeftMouse = true; + _vm->_lucerna->_holdLeftMouse = true; break; } } @@ -799,7 +799,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->refreshScreen(); _vm->updateEvents(); - if (!_vm->_lucerna->holdLeftMouse) + if (!_vm->_lucerna->_holdLeftMouse) break; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index cc624172d120..fd36aded840b 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -279,7 +279,7 @@ void Gyro::newGame() { _vm->_trip->new_game_for_trippancy(); _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); - _vm->_lucerna->updateClock(); + _vm->_lucerna->_clock.update(); _vm->_lucerna->spriteRun(); } diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index e1ce464f5626..21ea9da8e5c4 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -356,7 +356,6 @@ class Gyro { byte _fieldNum; Common::String _flags; Common::String _listen; - uint16 _oh, _onh, _om, _hours, _minutes, _seconds; // For Timeout. TODO: Move them into it. Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". byte _cp, _ledStatus, _defaultLed; FontType _font; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 76b2836c0f2f..5ecd00925e19 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -49,7 +49,71 @@ namespace Avalanche { -Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false) { +const Common::Point Clock::kCenter(510,183); + +Clock::Clock(AvalancheEngine *vm) { + _vm = vm; + _oldHour = _oldHourAngle = _oldMinute = 17717; +} + +void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. + TimeDate t; + _vm->_system->getTimeAndDate(t); + _hour = t.tm_hour; + _minute = t.tm_min; + _second = t.tm_sec; + + _hourAngle = (_hour % 12) * 30 + _minute / 2; + + if (_oldHour != _hour) { + plotHands(); + chime(); + } + + if (_oldMinute != _minute) + plotHands(); + + if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) + _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); + + _oldHour = _hour; + _oldHourAngle = _hourAngle; + _oldMinute = _minute; +} + +void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { + if (angle > 900) { + endPoint.x = 177; + return; + } + + endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenter.x, kCenter.y, 449 - angle, 450 - angle, length, color); +} + +void Clock::drawHand(const Common::Point &endPoint, byte color) { + if (endPoint.x == 177) + return; + + _vm->_graphics->_surface.drawLine(kCenter.x, kCenter.y, endPoint.x, endPoint.y, color); +} + +void Clock::plotHands() { + calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); + calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); + drawHand(_clockHandHour, kColorBrown); + drawHand(_clockHandMinute, kColorBrown); + + calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); + calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); + drawHand(_clockHandHour, kColorYellow); + drawHand(_clockHandMinute, kColorYellow); +} + +void Clock::chime() { + warning("STUB: Lucerna::chime()"); +} + +Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { _vm = vm; } @@ -63,8 +127,6 @@ Lucerna::~Lucerna() { } void Lucerna::init() { - _vm->_gyro->_oh = _vm->_gyro->_onh = _vm->_gyro->_om = 17717; - for (byte i = 0; i < 31; i++) for (byte j = 0; j < 2; j++) _vm->_gyro->_also[i][j] = 0; @@ -111,9 +173,7 @@ void Lucerna::drawAlsoLines() { CursorMan.showMouse(true); } - - -// nextstring, scram1 and unscrable are only used in load_also +// readAlsoStringFromFile, scram and unScramble are only used in loadAlso Common::String Lucerna::readAlsoStringFromFile() { Common::String str; @@ -1025,14 +1085,14 @@ void Lucerna::checkClick() { else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) _vm->_gyro->newMouse(2); // screwdriver else if (!_vm->_gyro->_dropdownActive) { // Dropdown can handle its own pointers. - if (holdLeftMouse) { + if (_holdLeftMouse) { _vm->_gyro->newMouse(7); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else _vm->_gyro->newMouse(4); // fletch } - if (holdLeftMouse) { + if (_holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->_dropsOk) _vm->_dropdown->updateMenu(); @@ -1051,7 +1111,7 @@ void Lucerna::checkClick() { } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { _vm->updateEvents(); - } while (holdLeftMouse); + } while (_holdLeftMouse); if (_vm->_gyro->_thinkThing) { _vm->_acci->_thing = _vm->_gyro->_thinks; @@ -1065,7 +1125,7 @@ void Lucerna::checkClick() { } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); - } while (holdLeftMouse); + } while (_holdLeftMouse); callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. @@ -1121,62 +1181,6 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). CursorMan.showMouse(true); } -void Lucerna::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { - if (angle > 900) { - endPoint.x = 177; - return; - } - - endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, _clockCenterX, _clockCenterY, 449 - angle, 450 - angle, length, color); -} - -void Lucerna::drawHand(const Common::Point &endPoint, byte color) { - if (endPoint.x == 177) - return; - - _vm->_graphics->_surface.drawLine(_clockCenterX, _clockCenterY, endPoint.x, endPoint.y, color); -} - -void Lucerna::plotHands() { - calcHand(_vm->_gyro->_onh, 14, _clockHandHour, kColorYellow); - calcHand(_vm->_gyro->_om * 6, 17, _clockHandMinute, kColorYellow); - drawHand(_clockHandHour, kColorBrown); - drawHand(_clockHandMinute, kColorBrown); - - calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); - calcHand(_vm->_gyro->_minutes * 6, 17, _clockHandMinute, kColorBrown); - drawHand(_clockHandHour, kColorYellow); - drawHand(_clockHandMinute, kColorYellow); -} - -void Lucerna::chime() { - warning("STUB: Lucerna::chime()"); -} - -void Lucerna::updateClock() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. - TimeDate t; - _vm->_system->getTimeAndDate(t); - _vm->_gyro->_hours = t.tm_hour; - _vm->_gyro->_minutes = t.tm_min; - _vm->_gyro->_seconds = t.tm_sec; - - _hourAngle = (_vm->_gyro->_hours % 12) * 30 + _vm->_gyro->_minutes / 2; - - if (_vm->_gyro->_oh != _vm->_gyro->_hours) { - plotHands(); - chime(); - } - - if (_vm->_gyro->_om != _vm->_gyro->_minutes) - plotHands(); - - if ((_vm->_gyro->_hours == 0) && (_vm->_gyro->_oh != 0) && (_vm->_gyro->_oh != 17717)) - _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); - - _vm->_gyro->_oh = _vm->_gyro->_hours; - _vm->_gyro->_onh = _hourAngle; - _vm->_gyro->_om = _vm->_gyro->_minutes; -} void Lucerna::gameOver() { _vm->_gyro->_dna._userMovesAvvy = false; diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 6835fe01c168..2260c46373ff 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -36,10 +36,32 @@ namespace Avalanche { class AvalancheEngine; -class Lucerna { +class Clock { public: - bool holdLeftMouse; + Clock(AvalancheEngine *vm); + + void update(); + +private: + static const Common::Point kCenter; + + AvalancheEngine *_vm; + + uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; // hourAngle = nh in the original. + Common::Point _clockHandHour, _clockHandMinute; // ah and am in the original. + + void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); + void drawHand(const Common::Point &endPoint, byte color); + void plotHands(); + void chime(); +}; + +class Lucerna { +public: + bool _holdLeftMouse; + Clock _clock; + Lucerna(AvalancheEngine *vm); ~Lucerna(); @@ -62,7 +84,6 @@ class Lucerna { void dusk(); void dawn(); void drawDirection(); // Draws the little icon at the left end of the text input field. - void updateClock(); void gameOver(); uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. void fixFlashers(); @@ -79,12 +100,6 @@ class Lucerna { private: AvalancheEngine *_vm; - //Clock - static const int16 _clockCenterX = 510; - static const int16 _clockCenterY = 183; - Common::Point _clockHandHour, _clockHandMinute; // ah and am in the original. - uint16 _hourAngle; // nh in the original. - bool _fxHidden; // Will de used in dust() and dawn(). Common::File file; @@ -104,12 +119,6 @@ class Lucerna { void fadeOut(byte n); void fadeIn(byte n); - // Clock - void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); - void drawHand(const Common::Point &endPoint, byte color); - void plotHands(); - void chime(); - }; } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 16e0fb11ad05..56f605a9d405 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -185,7 +185,7 @@ void Scrolls::normscroll() { state(0); _vm->_gyro->_seeScroll = false; CursorMan.showMouse(false); - _vm->_lucerna->holdLeftMouse = false; // Used in Lucerna::checkclick(). + _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::normscroll()"); } From 00a963b840c7d0cbb227cc4ac9f8e3ddaa2e9d42 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 18:03:36 +0200 Subject: [PATCH 0853/1332] AVALANCHE: Do renaming/refactoring in Parser. --- engines/avalanche/parser.cpp | 2 +- engines/avalanche/parser.h | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 073fdfdc7e8e..fc505e49847c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -135,7 +135,7 @@ void Parser::cursorOff() { } void Parser::tryDropdown() { - warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown. + warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown's keyboard handling. } int16 Parser::pos(const Common::String &crit, const Common::String &src) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 70a87b6ea748..b6ee0466aeaf 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -42,35 +42,23 @@ class Parser { byte _leftMargin; bool _cursorState; - - Parser(AvalancheEngine *vm); void init(); - void handleInputText(const Common::Event &event); - void handleBackspace(); - void handleReturn(); - void handleFunctionKey(const Common::Event &event); - void plotText(); - void cursorOn(); - void cursorOff(); - void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. - int16 pos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. private: AvalancheEngine *_vm; void drawCursor(); - void wipeText(); }; From 0fa45b0fd260dde0650f9d96a1eab084be332d54 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 18:18:25 +0200 Subject: [PATCH 0854/1332] AVALANCHE: Do renaming in Pingo. --- engines/avalanche/lucerna2.cpp | 5 +++-- engines/avalanche/pingo2.cpp | 20 ++++++++++---------- engines/avalanche/pingo2.h | 17 +++++------------ engines/avalanche/timeout2.cpp | 4 ++-- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5ecd00925e19..1f968db05549 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -74,7 +74,8 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so plotHands(); if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) - _vm->_scrolls->display(Common::String("Good morning!\n\nYes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!")); + _vm->_scrolls->display(Common::String("Good morning!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); _oldHour = _hour; _oldHourAngle = _hourAngle; @@ -110,7 +111,7 @@ void Clock::plotHands() { } void Clock::chime() { - warning("STUB: Lucerna::chime()"); + warning("STUB: Clock::chime()"); } Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index cc9592b62351..c61b6bbabd98 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -44,11 +44,11 @@ Pingo::Pingo(AvalancheEngine *vm) { _vm = vm; } -void Pingo::dplot(int16 x, int16 y, Common::String z) { - warning("STUB: Pingo::dplot()"); +void Pingo::dPlot(int16 x, int16 y, Common::String z) { + warning("STUB: Pingo::dPlot()"); } -void Pingo::bosskey() { +void Pingo::bossKey() { #if 0 const months : array[0..11] of char = 'JFMAMJJASOND'; @@ -82,7 +82,7 @@ begin; copy02; #endif - warning("STUB: Pingo::bosskey()"); + warning("STUB: Pingo::bossKey()"); } void Pingo::copy02() { // taken from Wobble (below) @@ -93,8 +93,8 @@ void Pingo::copy03() { // taken from Wobble (below) warning("STUB: Pingo::copy03()"); } -void Pingo::copypage(byte frp, byte top) { // taken from Copy02 (above) - warning("STUB: Pingo::copypage()"); +void Pingo::copyPage(byte frp, byte top) { // taken from Copy02 (above) + warning("STUB: Pingo::copyPage()"); } void Pingo::wobble() { @@ -109,7 +109,7 @@ void Pingo::zonk() { warning("STUB: Pingo::zonk()"); } -void Pingo::winning_pic() { +void Pingo::winningPic() { Common::File f; _vm->_lucerna->dusk(); @@ -128,12 +128,12 @@ void Pingo::winning_pic() { } #endif - warning("STUB: Pingo::winning_pic()"); + warning("STUB: Pingo::winningPic()"); f.close(); //setvisualpage(0); - warning("STUB: Pingo::winning_pic()"); + warning("STUB: Pingo::winningPic()"); _vm->_lucerna->dawn(); @@ -146,7 +146,7 @@ void Pingo::winning_pic() { major_redraw(); #endif - warning("STUB: Pingo::winning_pic()"); + warning("STUB: Pingo::winningPic()"); } } // End of namespace Avalanche. diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo2.h index 1228ab2dbd03..ee4fb587e78c 100644 --- a/engines/avalanche/pingo2.h +++ b/engines/avalanche/pingo2.h @@ -40,25 +40,18 @@ class Pingo { public: Pingo(AvalancheEngine *vm); - void bosskey(); - + void bossKey(); void copy02(); - - void copy03(); // Should always be replaced with _vm->_graph.refreshScreen(); - See Avalot::setup(); - - void copypage(byte frp, byte top); - + void copy03(); + void copyPage(byte frp, byte top); void wobble(); - void zonk(); - - void winning_pic(); + void winningPic(); private: AvalancheEngine *_vm; - void dplot(int16 x, int16 y, Common::String z); - + void dPlot(int16 x, int16 y, Common::String z); void zl(int16 x1, int16 y1, int16 x2, int16 y2); }; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 2383d02fac01..bc5a534eb7dc 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -621,14 +621,14 @@ void Timeout::arkata_shouts() { void Timeout::winning() { _vm->_visa->dixi('q', 79); - _vm->_pingo->winning_pic(); + _vm->_pingo->winningPic(); warning("STUB: Timeout::winning()"); #if 0 do { _vm->_lucerna->checkclick(); } while (!(_vm->_gyro->mrelease == 0)); #endif - // TODO: To be implemented with Pingo::winning_pic(). + // TODO: To be implemented with Pingo::winningPic(). _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); _vm->_scrolls->display(" T H E E N D "); From 0ad51df7d92857d7b526a09b6d1558e34e01f959 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 18:22:59 +0200 Subject: [PATCH 0855/1332] AVALANCHE: Remove 2 variables from Visa2 --- engines/avalanche/visa2.cpp | 14 +++----------- engines/avalanche/visa2.h | 10 +--------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index bcdf7b73accb..635e14db6e64 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -45,9 +45,6 @@ Visa::Visa(AvalancheEngine *vm) { _vm = vm; } -bool Visa::bubbling = false; -bool Visa::report_dixi_errors = true; - void Visa::unskrimble() { for (uint16 fv = 0; fv < _vm->_gyro->_bufSize; fv++) _vm->_gyro->_buffer[fv] = (~(_vm->_gyro->_buffer[fv] - (fv + 1))) % 256; @@ -58,7 +55,7 @@ void Visa::do_the_bubble() { _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } -void Visa::dixi(char block, byte point) { +void Visa::dixi(char block, byte point, bool report, bool bubbling) { Common::File indexfile, sezfile; uint16 idx_offset, sez_offset; bool error = false; @@ -83,7 +80,7 @@ void Visa::dixi(char block, byte point) { went_ok = !error; if (error) { - if (report_dixi_errors) { + if (report) { Common::String todisplay; todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->intToStr(point).c_str()); _vm->_scrolls->display(todisplay); @@ -113,12 +110,7 @@ void Visa::speech(byte who, byte subject) { if (subject == 0) { // No subject. - - bubbling = true; - report_dixi_errors = false; - dixi('s', who); - bubbling = false; - report_dixi_errors = true; + dixi('s', who, false, true); } else { // Subject given. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 37cb177fbef6..9d26d7a747e1 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -38,23 +38,15 @@ class AvalancheEngine; class Visa { public: Visa(AvalancheEngine *vm); - - void dixi(char block, byte point); - + void dixi(char block, byte point, bool report = true, bool bubbling = false); void talkto(byte whom); private: AvalancheEngine *_vm; - static bool bubbling; - static bool report_dixi_errors; - bool went_ok; - void unskrimble(); - void do_the_bubble(); - void speech(byte who, byte subject); }; From 9097e801537e0e80f2d7df7938f79d145ee362df Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 18:40:15 +0200 Subject: [PATCH 0856/1332] AVALANCHE: Minor cosmetic fixes in Lucerna. --- engines/avalanche/lucerna2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1f968db05549..0c2e01ae18bf 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1020,13 +1020,13 @@ void Lucerna::refreshObjectList() { } void Lucerna::guideAvvy(Common::Point cursorPos) { - if (! _vm->_gyro->_dna._userMovesAvvy) + if (!_vm->_gyro->_dna._userMovesAvvy) return; cursorPos.y /= 2; byte what; - // _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.) + // _vm->_trip->tr[0] is Avalot.) if (cursorPos.x < _vm->_trip->tr[0].x) what = 1; else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) From 1e1d5cafe50b6860875c2bb392c1180852e5037d Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 11:52:20 -0500 Subject: [PATCH 0857/1332] ZVISION: Re-enable rendering to the backbuffer --- engines/zvision/render_manager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b10a35d531aa..f528acfcaceb 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -78,16 +78,16 @@ void RenderManager::update(uint deltaTimeInMillis) { } void RenderManager::renderBackbufferToScreen() { - //RenderTable::RenderState state = _renderTable.getRenderState(); - //if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { - // _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left, _workingWindow.top), _backBuffer.w); - //} else { - //_system->copyRectToScreen(_workingWindowBuffer.getPixels(), _workingWindowBuffer.pitch, _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h); - //} + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left, _workingWindow.top), _backBuffer.w); + } else { + renderRectToWorkingWindow((uint16 *)_workingWindowBuffer.getPixels(), _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h, false); + } // TODO: Add menu rendering - //_system->copyRectToScreen(_backBuffer.getPixels(), _backBuffer.pitch, 0, 0, _backBuffer.w, _backBuffer.h); + _system->copyRectToScreen(_backBuffer.getPixels(), _backBuffer.pitch, 0, 0, _backBuffer.w, _backBuffer.h); } void RenderManager::clearWorkingWindowTo555Color(uint16 color) { @@ -153,7 +153,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (!subRect.isValidRect() || subRect.isEmpty()) return; - _system->copyRectToScreen(surface.getBasePtr(subRect.left, subRect.top), surface.pitch, destinationX, destinationY, subRect.width(), subRect.height()/*, wrap*/); + renderRectToWorkingWindow((uint16 *)surface.getBasePtr(subRect.left, subRect.top), destinationX, destinationY, subRect.width(), subRect.height(), wrap); } void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { From 94268fed060761b85a2d3d848590e658e2a9de8f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 11:52:49 -0500 Subject: [PATCH 0858/1332] ZVISION: Update ActionSetPartialScreen to use new function name --- engines/zvision/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 2a0a72be2075..d91c3b879d42 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -286,7 +286,7 @@ bool ActionSetPartialScreen::execute(ZVision *engine) { RenderManager *renderManager = engine->getRenderManager(); if (_backgroundColor > 0) { - renderManager->clearWorkingWindowToColor(_backgroundColor); + renderManager->clearWorkingWindowTo555Color(_backgroundColor); } renderManager->renderImageToScreen(_fileName, _x, _y); From d96555406ec215f390904d15c729ab6528f8b28f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 19:09:06 +0200 Subject: [PATCH 0859/1332] AVALANCHE: Rename trip into animation, some more renaming --- engines/avalanche/acci2.cpp | 98 +++--- .../avalanche/{trip6.cpp => animation.cpp} | 298 +++++++++--------- engines/avalanche/{trip6.h => animation.h} | 48 +-- engines/avalanche/avalanche.cpp | 74 ++--- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 16 +- engines/avalanche/celer2.cpp | 4 +- engines/avalanche/dropdown2.cpp | 18 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/gyro2.cpp | 16 +- engines/avalanche/lucerna2.cpp | 207 ++++++------ engines/avalanche/module.mk | 2 +- engines/avalanche/parser.cpp | 2 +- engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 6 +- engines/avalanche/sequence2.cpp | 6 +- engines/avalanche/timeout2.cpp | 118 +++---- engines/avalanche/visa2.cpp | 10 +- 18 files changed, 462 insertions(+), 469 deletions(-) rename engines/avalanche/{trip6.cpp => animation.cpp} (87%) rename engines/avalanche/{trip6.h => animation.h} (86%) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0712fd05cdf8..407bffbe2540 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -35,7 +35,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" #include "avalanche/pingo2.h" @@ -407,8 +407,8 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_dna._spareEvening.clear(); _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->dixi('z', 5); // His closing statement... - _vm->_trip->tr[1].walkto(4); // The end of the drawbridge - _vm->_trip->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1].walkto(4); // The end of the drawbridge + _vm->_animation->tr[1].vanishifstill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; break; @@ -708,7 +708,7 @@ void Acci::openBox(bool isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); @@ -716,7 +716,7 @@ void Acci::openBox(bool isOpening) { if (!isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_graphics->refreshScreen(); } } @@ -896,7 +896,7 @@ void Acci::openDoor() { // Special cases. switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_trip->infield(2)) { + if (_vm->_animation->infield(2)) { // Opening the box. _thing = 54; // The box. _person = kPardon; @@ -916,28 +916,28 @@ void Acci::openDoor() { return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) { - if (_vm->_trip->infield(fv + 1)) { + if (_vm->_animation->infield(fv + 1)) { fv -= 8; switch (_vm->_gyro->_portals[fv]._operation) { case Gyro::kMagicExclaim: - _vm->_trip->tr[0].bounce(); + _vm->_animation->tr[0].bounce(); _vm->_visa->dixi('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: - _vm->_trip->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte + _vm->_animation->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte ); break; case Gyro::kMagicUnfinished: - _vm->_trip->tr[0].bounce(); + _vm->_animation->tr[0].bounce(); _vm->_scrolls->display("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_trip->call_special(_vm->_gyro->_portals[fv]._data); + _vm->_animation->call_special(_vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicOpenDoor: - _vm->_trip->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); + _vm->_animation->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); break; } @@ -1040,9 +1040,9 @@ void Acci::notInOrder() { } void Acci::goToCauldron() { - _vm->_trip->tr[1].call_eachstep = false; // Stops Geida_Procs. + _vm->_animation->tr[1].call_eachstep = false; // Stops Geida_Procs. _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); - _vm->_trip->tr[1].walkto(2); + _vm->_animation->tr[1].walkto(2); } /** @@ -1102,9 +1102,9 @@ void Acci::drink() { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); - _vm->_trip->fliproom(1, 1); + _vm->_animation->fliproom(1, 1); _vm->_gyro->setBackgroundColor(14); - _vm->_trip->new_game_for_trippancy(); // Not really. + _vm->_animation->new_game_for_trippancy(); // Not really. } } @@ -1112,12 +1112,12 @@ void Acci::cardiffClimbing() { if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. _vm->_scrolls->display("You climb down, back onto the floor."); _vm->_gyro->_dna._standingOnDais = false; - _vm->_trip->apped(1, 3); + _vm->_animation->apped(1, 3); } else { // Clamber down. - if (_vm->_trip->infield(1)) { + if (_vm->_animation->infield(1)) { _vm->_scrolls->display("You clamber up onto the dais."); _vm->_gyro->_dna._standingOnDais = true; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); } else _vm->_scrolls->display("Get a bit closer, Avvy."); } @@ -1136,9 +1136,9 @@ void Acci::standUp() { _vm->_gyro->setBackgroundColor(0); _vm->_visa->dixi('d', 14); } - _vm->_trip->tr[0].visible = true; + _vm->_animation->tr[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); @@ -1155,8 +1155,8 @@ void Acci::standUp() { case r__nottspub: if (_vm->_gyro->_dna._sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. - _vm->_trip->tr[0].visible = true; // But standing up. - _vm->_trip->apped(1, 4); // And walking away. + _vm->_animation->tr[0]._visible = true; // But standing up. + _vm->_animation->apped(1, 4); // And walking away. _vm->_gyro->_dna._sittingInPub = false; // Really not sitting down. _vm->_gyro->_dna._userMovesAvvy = true; // And ambulant. } else @@ -1172,7 +1172,7 @@ void Acci::standUp() { void Acci::getProc(char thing) { switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_trip->infield(2)) { + if (_vm->_animation->infield(2)) { if (_vm->_gyro->_dna._boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); @@ -1188,13 +1188,13 @@ void Acci::getProc(char thing) { case r__insidecardiffcastle: switch (thing) { case Gyro::kObjectPen: - if (_vm->_trip->infield(2)) { // Standing on the dais. + if (_vm->_animation->infield(2)) { // Standing on the dais. if (_vm->_gyro->_dna._takenPen) _vm->_scrolls->display("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. - _vm->_trip->call_special(3); // Zap! + _vm->_animation->call_special(3); // Zap! _vm->_gyro->_dna._takenPen = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -1213,7 +1213,7 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { + if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->display("Got it!"); _vm->_gyro->_dna._mushroomGrowing = false; @@ -1247,7 +1247,7 @@ void Acci::giveGeidaTheLute() { } void Acci::playHarp() { - if (_vm->_trip->infield(7)) + if (_vm->_animation->infield(7)) _vm->_scrolls->musical_scroll(); else _vm->_scrolls->display("Get a bit closer to it, Avvy!"); @@ -1277,8 +1277,8 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. - for (byte i = 0; i < _vm->_trip->kSpriteNumbMax; i++) { - if (_vm->_trip->tr[i].quick && ((_vm->_trip->tr[i].a.accinum + 149) == _person)) { + for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->tr[i].quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } @@ -1568,13 +1568,13 @@ void Acci::doThat() { i = 3; else i = 0; - if (_vm->_trip->tr[0].whichsprite != i) { - int16 x = _vm->_trip->tr[0].x; - int16 y = _vm->_trip->tr[0].y; - _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(i, true, _vm->_trip); - _vm->_trip->tr[0].appear(x, y, _vm->_trip->kDirLeft); - _vm->_trip->tr[0].visible = false; + if (_vm->_animation->tr[0].whichsprite != i) { + int16 x = _vm->_animation->tr[0]._x; + int16 y = _vm->_animation->tr[0]._y; + _vm->_animation->tr[0].done(); + _vm->_animation->tr[0].init(i, true, _vm->_animation); + _vm->_animation->tr[0].appear(x, y, Animation::kDirLeft); + _vm->_animation->tr[0]._visible = false; } } break; @@ -1695,16 +1695,16 @@ void Acci::doThat() { if (_vm->_gyro->_dna._avariciusTalk > 0) _vm->_visa->dixi('q', 19); else { - if ((_vm->_gyro->_dna._room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! + if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->infield(2))) { // Avaricius appears! _vm->_visa->dixi('q', 17); if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->dixi('q', 18); else { - _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius - _vm->_trip->apped(2, 4); - _vm->_trip->tr[1].walkto(5); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procback_and_forth; + _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius + _vm->_animation->apped(2, 4); + _vm->_animation->tr[1].walkto(5); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procback_and_forth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } @@ -1744,7 +1744,7 @@ void Acci::doThat() { case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_dna._room) { case r__argentpub: - if (_vm->_trip->infield(6)) { // We're in a pub, and near the bar. + if (_vm->_animation->infield(6)) { // We're in a pub, and near the bar. switch (_thing) { case 51: case 53: @@ -1804,7 +1804,7 @@ void Acci::doThat() { break; case r__outsideducks: - if (_vm->_trip->infield(6)) { + if (_vm->_animation->infield(6)) { if (_thing == _vm->_gyro->kObjectOnion) { if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! @@ -1861,9 +1861,9 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->incScore(7); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[1].vanishifstill = true; - _vm->_trip->tr[1].call_eachstep = false; + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1].call_eachstep = false; _vm->_gyro->_whereIs[7] = 177; break; default: @@ -1984,7 +1984,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._sittingInPub) _vm->_scrolls->display("You're already sitting!"); else { - _vm->_trip->tr[0].walkto(4); // Move Avvy to the place, and sit him down. + _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } } else { // Default doodah. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/animation.cpp similarity index 87% rename from engines/avalanche/trip6.cpp rename to engines/avalanche/animation.cpp index b94697f385a9..5679e1b71528 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/animation.cpp @@ -29,7 +29,7 @@ #include "avalanche/avalanche.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" #include "avalanche/visa2.h" @@ -45,7 +45,7 @@ namespace Avalanche { -void triptype::init(byte spritenum, bool do_check, Trip *tr) { +void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { _tr = tr; const int32 idshould = -1317732048; @@ -74,33 +74,33 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { inf.skip(2); // Replace variable named 'soa' in the original code. - if (!a.name.empty()) - a.name.clear(); + if (!_stat._name.empty()) + _stat._name.clear(); byte nameSize = inf.readByte(); for (byte i = 0; i < nameSize; i++) - a.name += inf.readByte(); + _stat._name += inf.readByte(); inf.skip(12 - nameSize); //inf.skip(1); // Same as above. byte commentSize = inf.readByte(); for (byte i = 0; i < commentSize; i++) - a.comment += inf.readByte(); + _stat._comment += inf.readByte(); inf.skip(16 - commentSize); - a.num = inf.readByte(); + _stat._frameNum = inf.readByte(); _info._xLength = inf.readByte(); _info._yLength = inf.readByte(); - a.seq = inf.readByte(); + _stat.seq = inf.readByte(); _info._size = inf.readUint16LE(); - a.fgc = inf.readByte(); - a.bgc = inf.readByte(); - a.accinum = inf.readByte(); + _stat._fgBubbleCol = inf.readByte(); + _stat._bgBubbleCol = inf.readByte(); + _stat.accinum = inf.readByte(); totalnum = 0; // = 1; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { + for (byte aa = 0; aa < _stat._frameNum; aa++) { _info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)]; //getmem(sil[totalnum-1], 11 * (a.yl + 1)); @@ -117,10 +117,10 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { totalnum++; // on; - x = 0; - y = 0; + _x = 0; + _y = 0; quick = true; - visible = false; + _visible = false; xs = 3; ys = 1; if (spritenum == 1) @@ -139,71 +139,71 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { inf.close(); } -void triptype::original() { +void AnimationType::original() { quick = false; whichsprite = 177; } -void triptype::andexor() { +void AnimationType::andexor() { if ((vanishifstill) && (ix == 0) && (iy == 0)) return; - byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = face * _stat.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). - _tr->_vm->_graphics->drawSprite(_info, picnum, x, y); + _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } -void triptype::turn(byte whichway) { +void AnimationType::turn(byte whichway) { if (whichway == 8) - face = 0; + face = Animation::kDirUp; else face = whichway; } -void triptype::appear(int16 wx, int16 wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox[_tr->_vm->_gyro->_cp] = wx; - oy[_tr->_vm->_gyro->_cp] = wy; +void AnimationType::appear(int16 wx, int16 wy, byte wf) { + _x = (wx / 8) * 8; + _y = wy; + _oldX[_tr->_vm->_gyro->_cp] = wx; + _oldY[_tr->_vm->_gyro->_cp] = wy; turn(wf); - visible = true; + _visible = true; ix = 0; iy = 0; } -bool triptype::collision_check() { +bool AnimationType::collision_check() { for (byte fv = 0; fv < _tr->kSpriteNumbMax; fv++) if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && - ((x + _info._xLength) > _tr->tr[fv].x) && - (x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) && - (_tr->tr[fv].y == y)) + ((_x + _info._xLength) > _tr->tr[fv]._x) && + (_x < (_tr->tr[fv]._x + _tr->tr[fv]._info._xLength)) && + (_tr->tr[fv]._y == _y)) return true; return false; } -void triptype::walk() { +void AnimationType::walk() { byte tc; ByteField r; - if (visible) { - r._x1 = (x / 8) - 1; + if (_visible) { + r._x1 = (_x / 8) - 1; if (r._x1 == 255) r._x1 = 0; - r._y1 = y - 2; - r._x2 = ((x + _info._xLength) / 8) + 1; - r._y2 = y + _info._yLength + 2; + r._y1 = _y - 2; + r._x2 = ((_x + _info._xLength) / 8) + 1; + r._y2 = _y + _info._yLength + 2; _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); } if (!_tr->_vm->_gyro->_doingSpriteRun) { - ox[_tr->_vm->_gyro->_cp] = x; - oy[_tr->_vm->_gyro->_cp] = y; + _oldX[_tr->_vm->_gyro->_cp] = _x; + _oldY[_tr->_vm->_gyro->_cp] = _y; if (homing) homestep(); - x = x + ix; - y = y + iy; + _x = _x + ix; + _y = _y + iy; } if (check_me) { @@ -212,7 +212,7 @@ void triptype::walk() { return; } - tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->_cp], y, _info._yLength) - 1; + tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { @@ -248,16 +248,16 @@ void triptype::walk() { count++; if (((ix != 0) || (iy != 0)) && (count > 1)) { step++; - if (step == a.seq) + if (step == _stat.seq) step = 0; count = 0; } } } -void triptype::bounce() { - x = ox[_tr->_vm->_gyro->_cp]; - y = oy[_tr->_vm->_gyro->_cp]; +void AnimationType::bounce() { + _x = _oldX[_tr->_vm->_gyro->_cp]; + _y = _oldY[_tr->_vm->_gyro->_cp]; if (check_me) _tr->stopwalking(); else @@ -267,7 +267,7 @@ void triptype::bounce() { _tr->_vm->_gyro->_onCanDoPageSwap = true; } -int8 triptype::sgn(int16 val) { +int8 AnimationType::sgn(int16 val) { if (val > 0) return 1; else if (val < 0) @@ -276,30 +276,30 @@ int8 triptype::sgn(int16 val) { return 0; } -void triptype::walkto(byte pednum) { +void AnimationType::walkto(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. - speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - y)); + speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y)); hx = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; hy = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; homing = true; } -void triptype::stophoming() { +void AnimationType::stophoming() { homing = false; } -void triptype::homestep() { +void AnimationType::homestep() { int16 temp; - if ((hx == x) && (hy == y)) { + if ((hx == _x) && (hy == _y)) { // touching the target stopwalk(); return; } ix = 0; iy = 0; - if (hy != y) { - temp = hy - y; + if (hy != _y) { + temp = hy - _y; if (temp > 4) iy = 4; else if (temp < -4) @@ -307,8 +307,8 @@ void triptype::homestep() { else iy = temp; } - if (hx != x) { - temp = hx - x; + if (hx != _x) { + temp = hx - _x; if (temp > 4) ix = 4; else if (temp < -4) @@ -318,7 +318,7 @@ void triptype::homestep() { } } -void triptype::speed(int8 xx, int8 yy) { +void AnimationType::speed(int8 xx, int8 yy) { ix = xx; iy = yy; if ((ix == 0) && (iy == 0)) @@ -337,28 +337,28 @@ void triptype::speed(int8 xx, int8 yy) { } } -void triptype::stopwalk() { +void AnimationType::stopwalk() { ix = 0; iy = 0; homing = false; } -void triptype::chatter() { - _tr->_vm->_gyro->_talkX = x + _info._xLength / 2; - _tr->_vm->_gyro->_talkY = y; - _tr->_vm->_gyro->_talkFontColor = a.fgc; - _tr->_vm->_gyro->_talkBackgroundColor = a.bgc; +void AnimationType::chatter() { + _tr->_vm->_gyro->_talkX = _x + _info._xLength / 2; + _tr->_vm->_gyro->_talkY = _y; + _tr->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; + _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; } -void triptype::set_up_saver(trip_saver_type &v) { +void AnimationType::set_up_saver(trip_saver_type &v) { v.whichsprite = whichsprite; v.face = face; v.step = step; - v.x = x; - v.y = y; + v.x = _x; + v.y = _y; v.ix = ix; v.iy = iy; - v.visible = visible; + v.visible = _visible; v.homing = homing; v.check_me = check_me; v.count = count; @@ -373,15 +373,15 @@ void triptype::set_up_saver(trip_saver_type &v) { v.vanishifstill = vanishifstill; } -void triptype::unload_saver(trip_saver_type v) { +void AnimationType::unload_saver(trip_saver_type v) { whichsprite = v.whichsprite; face = v.face; step = v.step; - x = v.x; - y = v.y; + _x = v.x; + _y = v.y; ix = v.ix; iy = v.iy; - visible = v.visible; + _visible = v.visible; homing = v.homing; check_me = v.check_me; count = v.count; @@ -396,23 +396,23 @@ void triptype::unload_saver(trip_saver_type v) { vanishifstill = v.vanishifstill; } -void triptype::savedata(Common::File &f) { +void AnimationType::savedata(Common::File &f) { warning("STUB: triptype::savedata()"); } -void triptype::loaddata(Common::File &f) { +void AnimationType::loaddata(Common::File &f) { warning("STUB: triptype::loaddata()"); } -void triptype::save_data_to_mem(uint16 &where) { +void AnimationType::save_data_to_mem(uint16 &where) { warning("STUB: triptype::save_data_to_mem()"); } -void triptype::load_data_from_mem(uint16 &where) { +void AnimationType::load_data_from_mem(uint16 &where) { warning("STUB: triptype::load_data_from_mem()"); } -triptype *triptype::done() { +AnimationType *AnimationType::done() { Common::String xx; // nds:=num div seq; @@ -420,7 +420,7 @@ triptype *triptype::done() { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) { + for (byte aa = 0; aa < _stat._frameNum; aa++) { totalnum--; delete[] _info._mani[totalnum]; delete[] _info._sil[totalnum]; @@ -453,21 +453,21 @@ void getsettype::recall(ByteField &r) { -Trip::Trip(AvalancheEngine *vm) { +Animation::Animation(AvalancheEngine *vm) { _vm = vm; getsetclear(); mustexclaim = false; } -Trip::~Trip() { +Animation::~Animation() { for (byte i = 0; i < kSpriteNumbMax; i++) { if (tr[i].quick) tr[i].done(); } } -void Trip::loadtrip() { +void Animation::loadtrip() { for (int16 gm = 0; gm < kSpriteNumbMax; gm++) tr[gm].original(); @@ -475,7 +475,7 @@ void Trip::loadtrip() { aa[i] = 0; } -byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { +byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { byte a, c; int16 fv, ff; @@ -509,7 +509,7 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { return a; } -byte Trip::geida_ped(byte which) { +byte Animation::geida_ped(byte which) { switch (which) { case 1: return 7; @@ -526,7 +526,7 @@ byte Trip::geida_ped(byte which) { } } -void Trip::catamove(byte ped) { +void Animation::catamove(byte ped) { /* When you enter a new position in the catacombs, this procedure should be called. It changes the Also codes so that they may match the picture on the screen. (Coming soon: It draws up the screen, too.) */ @@ -840,11 +840,11 @@ void Trip::catamove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. -void Trip::dawndelay() { +void Animation::dawndelay() { _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); } -void Trip::call_special(uint16 which) { +void Animation::call_special(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -871,7 +871,7 @@ void Trip::call_special(uint16 which) { _vm->_gyro->_dna._arrowTriggered = true; apped(2, 4); // The dart starts at ped 4, and... tr[1].walkto(5); // flies to ped 5. - tr[1].face = 0; // Only face. + tr[1].face = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ @@ -913,7 +913,7 @@ void Trip::call_special(uint16 which) { _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. - tr[0].visible = false; + tr[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopwalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); @@ -1003,7 +1003,7 @@ void Trip::call_special(uint16 which) { -void Trip::open_the_door(byte whither, byte ped, byte magicnum) { +void Animation::open_the_door(byte whither, byte ped, byte magicnum) { // This slides the door open. (The data really ought to be saved in // the Also file, and will be next time. However, for now, they're // here.) @@ -1060,7 +1060,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { _vm->_sequence->start_to_open(); } -void Trip::newspeed() { +void Animation::newspeed() { // Given that you've just changed the speed in triptype.xs, this adjusts ix. const ByteField lightspace = {40, 199, 47, 199}; byte page_; @@ -1086,7 +1086,7 @@ void Trip::newspeed() { } -void Trip::rwsp(byte t, byte dir) { +void Animation::rwsp(byte t, byte dir) { switch (dir) { case kDirUp: tr[t].speed(0, -tr[t].ys); @@ -1115,7 +1115,7 @@ void Trip::rwsp(byte t, byte dir) { } } -void Trip::apped(byte trn, byte np) { +void Animation::apped(byte trn, byte np) { trn--; np--; tr[trn].appear(_vm->_gyro->_peds[np]._x - tr[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - tr[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); @@ -1131,7 +1131,7 @@ void Trip::apped(byte trn, byte np) { //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. //x3,y3 = mx,my. x4,y4 = mx+16,my+16. -void Trip::getback() { +void Animation::getback() { // Super_Off; #if 0 while (getset[1 - _vm->_gyro->cp].numleft > 0) { @@ -1155,28 +1155,28 @@ void Trip::getback() { } // Eachstep procedures: -void Trip::follow_avvy_y(byte tripnum) { +void Animation::follow_avvy_y(byte tripnum) { if (tr[0].face == kDirLeft) return; if (tr[tripnum].homing) - tr[tripnum].hy = tr[1].y; + tr[tripnum].hy = tr[1]._y; else { - if (tr[tripnum].y < tr[1].y) - tr[tripnum].y += 1; - else if (tr[tripnum].y > tr[1].y) - tr[tripnum].y -= 1; + if (tr[tripnum]._y < tr[1]._y) + tr[tripnum]._y += 1; + else if (tr[tripnum]._y > tr[1]._y) + tr[tripnum]._y -= 1; else return; if (tr[tripnum].ix == 0) { tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) + if (tr[tripnum].step == tr[tripnum]._stat.seq) tr[tripnum].step = 0; tr[tripnum].count = 0; } } } -void Trip::back_and_forth(byte tripnum) { +void Animation::back_and_forth(byte tripnum) { if (!tr[tripnum].homing) { if (tr[tripnum].face == kDirRight) tr[tripnum].walkto(4); @@ -1185,25 +1185,25 @@ void Trip::back_and_forth(byte tripnum) { } } -void Trip::face_avvy(byte tripnum) { +void Animation::face_avvy(byte tripnum) { if (!tr[tripnum].homing) { - if (tr[0].x >= tr[tripnum].x) + if (tr[0]._x >= tr[tripnum]._x) tr[tripnum].face = kDirRight; else tr[tripnum].face = kDirLeft; } } -void Trip::arrow_procs(byte tripnum) { +void Animation::arrow_procs(byte tripnum) { if (tr[tripnum].homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((tr[tripnum].y + tr[tripnum]._info._yLength) >= tr[0].y) // A - && (tr[tripnum].x <= (tr[0].x + tr[0]._info._xLength)) // B - && ((tr[tripnum].x + tr[tripnum]._info._xLength) >= tr[0].x)) { // C + if (((tr[tripnum]._y + tr[tripnum]._info._yLength) >= tr[0]._y) // A + && (tr[tripnum]._x <= (tr[0]._x + tr[0]._info._xLength)) // B + && ((tr[tripnum]._x + tr[tripnum]._info._xLength) >= tr[0]._x)) { // C // OK, it's hit him... what now? tr[1].call_eachstep = false; // prevent recursion. @@ -1249,39 +1249,39 @@ begin end; #endif -void Trip::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. - int16 tox = tr[0].x + 17; - int16 toy = tr[0].y - 1; - if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { +void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. + int16 tox = tr[0]._x + 17; + int16 toy = tr[0]._y - 1; + if ((tr[tripnum]._x == tox) && (tr[tripnum]._y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = kDirLeft; tr[tripnum].stopwalk(); // ... whatever ... } else { // Still some way to go. - if (tr[tripnum].x < tox) { - tr[tripnum].x += 5; - if (tr[tripnum].x > tox) - tr[tripnum].x = tox; + if (tr[tripnum]._x < tox) { + tr[tripnum]._x += 5; + if (tr[tripnum]._x > tox) + tr[tripnum]._x = tox; } - if (tr[tripnum].y < toy) - tr[tripnum].y++; + if (tr[tripnum]._y < toy) + tr[tripnum]._y++; tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum].a.seq) + if (tr[tripnum].step == tr[tripnum]._stat.seq) tr[tripnum].step = 0; } } -void Trip::take_a_step(byte &tripnum) { +void Animation::take_a_step(byte &tripnum) { if (tr[tripnum].ix == 0) { tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum].a.seq) + if (tr[tripnum].step == tr[tripnum]._stat.seq) tr[tripnum].step = 0; tr[tripnum].count = 0; } } -void Trip::spin(byte whichway, byte &tripnum) { +void Animation::spin(byte whichway, byte &tripnum) { if (tr[tripnum].face != whichway) { tr[tripnum].face = whichway; if (tr[tripnum].whichsprite == 2) @@ -1297,21 +1297,21 @@ void Trip::spin(byte whichway, byte &tripnum) { } } -void Trip::geida_procs(byte tripnum) { +void Animation::geida_procs(byte tripnum) { if (_vm->_gyro->_dna._geidaTime > 0) { _vm->_gyro->_dna._geidaTime--; if (_vm->_gyro->_dna._geidaTime == 0) _vm->_gyro->_dna._geidaSpin = 0; } - if (tr[tripnum].y < (tr[0].y - 2)) { + if (tr[tripnum]._y < (tr[0]._y - 2)) { // Geida is further from the screen than Avvy. spin(kDirDown, tripnum); tr[tripnum].iy = 1; tr[tripnum].ix = 0; take_a_step(tripnum); return; - } else if (tr[tripnum].y > (tr[0].y + 2)) { + } else if (tr[tripnum]._y > (tr[0]._y + 2)) { // Avvy is further from the screen than Geida. spin(kDirUp, tripnum); tr[tripnum].iy = -1; @@ -1323,11 +1323,11 @@ void Trip::geida_procs(byte tripnum) { tr[tripnum].iy = 0; // These 12-s are not in the original, I added them to make the following method more "smooth". // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (tr[tripnum].x < tr[0].x - tr[0].xs * 8 - 12) { + if (tr[tripnum]._x < tr[0]._x - tr[0].xs * 8 - 12) { tr[tripnum].ix = tr[0].xs; spin(kDirRight, tripnum); take_a_step(tripnum); - } else if (tr[tripnum].x > tr[0].x + tr[0].xs * 8 + 12) { + } else if (tr[tripnum]._x > tr[0]._x + tr[0].xs * 8 + 12) { tr[tripnum].ix = -tr[0].xs; spin(kDirLeft, tripnum); take_a_step(tripnum); @@ -1337,7 +1337,7 @@ void Trip::geida_procs(byte tripnum) { // That's all... -void Trip::call_andexors() { +void Animation::call_andexors() { int8 order[5]; byte fv, temp; bool ok; @@ -1346,7 +1346,7 @@ void Trip::call_andexors() { order[i] = -1; for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].visible) + if (tr[fv].quick && tr[fv]._visible) order[fv] = fv; } @@ -1354,7 +1354,7 @@ void Trip::call_andexors() { ok = true; for (fv = 0; fv < 4; fv++) { if (((order[fv] != -1) && (order[fv + 1] != -1)) - && (tr[order[fv]].y > tr[order[fv + 1]].y)) { + && (tr[order[fv]]._y > tr[order[fv + 1]]._y)) { // Swap them! temp = order[fv]; order[fv] = order[fv + 1]; @@ -1373,13 +1373,13 @@ void Trip::call_andexors() { } } -void Trip::trippancy_link() { +void Animation::trippancy_link() { byte fv; if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].visible) + if (tr[fv].quick && tr[fv]._visible) tr[fv].walk(); } @@ -1417,7 +1417,7 @@ void Trip::trippancy_link() { } } -void Trip::get_back_loretta() { +void Animation::get_back_loretta() { byte fv; for (fv = 0; fv < kSpriteNumbMax; fv++) { @@ -1429,32 +1429,32 @@ void Trip::get_back_loretta() { // for fv:=0 to 1 do begin cp:=1-cp; getback; end; } -void Trip::stopwalking() { +void Animation::stopwalking() { tr[0].stopwalk(); _vm->_gyro->_dna._direction = kDirStopped; if (_vm->_gyro->_alive) tr[0].step = 1; } -void Trip::tripkey(char dir) { +void Animation::tripkey(char dir) { warning("Replaced by Trip::handleMoveKey!"); } -void Trip::readstick() { +void Animation::readstick() { warning("STUB: Trip::readstick()"); } -void Trip::getsetclear() { +void Animation::getsetclear() { for (byte fv = 0; fv <= 1; fv++) getset[fv].init(); } -void Trip::hide_in_the_cupboard() { +void Animation::hide_in_the_cupboard() { if (_vm->_gyro->_dna._avvysInTheCupboard) { if (_vm->_gyro->_dna._wearing == Acci::kNothing) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { - tr[0].visible = true; + tr[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; apped(1, 3); // Walk out of the cupboard. _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); @@ -1465,7 +1465,7 @@ void Trip::hide_in_the_cupboard() { } } else { // Not hiding in the cupboard - tr[0].visible = false; + tr[0]._visible = false; _vm->_gyro->_dna._userMovesAvvy = false; _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); @@ -1474,7 +1474,7 @@ void Trip::hide_in_the_cupboard() { } } -void Trip::fliproom(byte room, byte ped) { +void Animation::fliproom(byte room, byte ped) { byte fv; if (!_vm->_gyro->_alive) { @@ -1525,24 +1525,24 @@ void Trip::fliproom(byte room, byte ped) { // tidy_after_mouse; } -bool Trip::infield(byte which) { +bool Animation::infield(byte which) { which--; // Pascal -> C: different array indexes. - int16 yy = tr[0].y + tr[0]._info._yLength; + int16 yy = tr[0]._y + tr[0]._info._yLength; - return (tr[0].x >= _vm->_gyro->_fields[which]._x1) && (tr[0].x <= _vm->_gyro->_fields[which]._x2) + return (tr[0]._x >= _vm->_gyro->_fields[which]._x1) && (tr[0]._x <= _vm->_gyro->_fields[which]._x2) && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); } -bool Trip::neardoor() { +bool Animation::neardoor() { if (_vm->_gyro->_fieldNum < 8) { // there ARE no doors here! return false; } - int16 ux = tr[0].x; - int16 uy = tr[0].y + tr[0]._info._yLength; + int16 ux = tr[0]._x; + int16 uy = tr[0]._y + tr[0]._info._yLength; bool nd = false; for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) @@ -1551,13 +1551,11 @@ bool Trip::neardoor() { return nd; } -void Trip::new_game_for_trippancy() { // Called by gyro.newgame - tr[0].visible = false; +void Animation::new_game_for_trippancy() { // Called by gyro.newgame + tr[0]._visible = false; } - - -void Trip::handleMoveKey(const Common::Event &event) { +void Animation::handleMoveKey(const Common::Event &event) { if (!_vm->_gyro->_dna._userMovesAvvy) return; diff --git a/engines/avalanche/trip6.h b/engines/avalanche/animation.h similarity index 86% rename from engines/avalanche/trip6.h rename to engines/avalanche/animation.h index 76b435b16317..b8ae547d8c83 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/animation.h @@ -25,11 +25,10 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* TRIP5 Trippancy V - the sprite animation subsystem */ +/* Original name TRIP5 / Trippancy V - the sprite animation subsystem */ - -#ifndef AVALANCHE_TRIP6_H -#define AVALANCHE_TRIP6_H +#ifndef AVALANCHE_ANIMATION_H +#define AVALANCHE_ANIMATION_H #include "avalanche/graphics.h" @@ -40,11 +39,13 @@ namespace Avalanche { class AvalancheEngine; struct adxtype { // Second revision of ADX type - Common::String name; // [13] name of character // uruk: Note to self: TRAILING /0 !!! Real size: 12 - Common::String comment; // [17] comment // uruk: Same here, but 16. - byte num; // number of pictures + // CHECKME: Useless? + Common::String _name; // name of character + Common::String _comment; // comment + // + byte _frameNum; // number of pictures byte seq; // how many in one stride - byte fgc, bgc; // foreground & background bubble colors + byte _fgBubbleCol, _bgBubbleCol; // foreground & background bubble colors byte accinum; // the number according to Acci (1=Avvy, etc.) }; @@ -69,20 +70,19 @@ struct trip_saver_type { bool vanishifstill; }; +class Animation; -class Trip; - -class triptype { +class AnimationType { public: SpriteInfo _info; - adxtype a; // vital statistics + adxtype _stat; // vital statistics byte face, step; - int16 x, y; // current xy coords - int16 ox[2], oy[2]; // last xy coords + int16 _x, _y; // current xy coords + int16 _oldX[2], _oldY[2]; // last xy coords int8 ix, iy; // amount to move sprite by, each step byte whichsprite; - bool quick, visible, homing, check_me; + bool quick, _visible, homing, check_me; int16 hx, hy; // homing x & y coords byte count; // counts before changing step byte xs, ys; // x & y speed @@ -92,7 +92,7 @@ class triptype { bool call_eachstep; // Do we call the eachstep procedure? byte eachstep; - void init(byte spritenum, bool do_check, Trip *tr); + void init(byte spritenum, bool do_check, Animation *tr); // loads & sets up the sprite void original(); // just sets Quick to false void andexor(); // drops sprite onto screen @@ -114,10 +114,10 @@ class triptype { void save_data_to_mem(uint16 &where); void load_data_from_mem(uint16 &where); - triptype *done(); + AnimationType *done(); private: - Trip *_tr; + Animation *_tr; bool collision_check(); int8 sgn(int16 val); @@ -135,9 +135,9 @@ class getsettype { void recall(ByteField &r); }; -class Trip { +class Animation { public: - friend class triptype; + friend class AnimationType; friend class getsettype; static const int16 kDirUp = 0; @@ -160,8 +160,8 @@ class Trip { static const int16 procgrab_avvy = 6; static const int16 procgeida_procs = 7; - Trip(AvalancheEngine *vm); - ~Trip(); + Animation(AvalancheEngine *vm); + ~Animation(); void trippancy_link(); void get_back_loretta(); @@ -183,7 +183,7 @@ class Trip { void take_a_step(byte &tripnum); void handleMoveKey(const Common::Event &event); // To replace tripkey(). - triptype tr[kSpriteNumbMax]; + AnimationType tr[kSpriteNumbMax]; getsettype getset[2]; byte aa[1600]; @@ -214,4 +214,4 @@ class Trip { } // End of namespace Avalanche. -#endif // AVALANCHE_TRIP6_H +#endif // AVALANCHE_ANIMATION_H diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 27cfdd1178bf..a7c8ea61db15 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -70,7 +70,7 @@ AvalancheEngine::~AvalancheEngine() { delete _celer; delete _sequence; delete _timeout; - delete _trip; + delete _animation; delete _acci; delete _dropdown; delete _closing; @@ -91,7 +91,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _celer = new Celer(this); _sequence = new Sequence(this); _timeout = new Timeout(this); - _trip = new Trip(this); + _animation = new Animation(this); _acci = new Acci(this); _dropdown = new Dropdown(this); _closing = new Closing(this); @@ -282,52 +282,52 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { - if (_trip->tr[i].quick) + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { + if (_animation->tr[i].quick) spriteNum++; } } sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { // Deallocate sprites. - if (_trip->tr[i].quick) - _trip->tr[i].done(); + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + if (_animation->tr[i].quick) + _animation->tr[i].done(); } } for (byte i = 0; i < spriteNum; i++) { - sz.syncAsByte(_trip->tr[i].whichsprite); - sz.syncAsByte(_trip->tr[i].check_me); + sz.syncAsByte(_animation->tr[i].whichsprite); + sz.syncAsByte(_animation->tr[i].check_me); if (sz.isLoading()) { - _trip->tr[i].quick = true; - _trip->tr[i].init(_trip->tr[i].whichsprite, _trip->tr[i].check_me, _trip); + _animation->tr[i].quick = true; + _animation->tr[i].init(_animation->tr[i].whichsprite, _animation->tr[i].check_me, _animation); } - sz.syncAsByte(_trip->tr[i].ix); - sz.syncAsByte(_trip->tr[i].iy); - sz.syncAsByte(_trip->tr[i].face); - sz.syncAsByte(_trip->tr[i].step); - sz.syncAsByte(_trip->tr[i].visible); - sz.syncAsByte(_trip->tr[i].homing); - sz.syncAsByte(_trip->tr[i].count); - sz.syncAsByte(_trip->tr[i]._info._xWidth); - sz.syncAsByte(_trip->tr[i].xs); - sz.syncAsByte(_trip->tr[i].ys); - sz.syncAsByte(_trip->tr[i].totalnum); - sz.syncAsSint16LE(_trip->tr[i].hx); - sz.syncAsSint16LE(_trip->tr[i].hy); - sz.syncAsByte(_trip->tr[i].call_eachstep); - sz.syncAsByte(_trip->tr[i].eachstep); - sz.syncAsByte(_trip->tr[i].vanishifstill); - - sz.syncAsSint16LE(_trip->tr[i].x); - sz.syncAsSint16LE(_trip->tr[i].y); - - if (sz.isLoading() && _trip->tr[i].visible) - _trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face); + sz.syncAsByte(_animation->tr[i].ix); + sz.syncAsByte(_animation->tr[i].iy); + sz.syncAsByte(_animation->tr[i].face); + sz.syncAsByte(_animation->tr[i].step); + sz.syncAsByte(_animation->tr[i]._visible); + sz.syncAsByte(_animation->tr[i].homing); + sz.syncAsByte(_animation->tr[i].count); + sz.syncAsByte(_animation->tr[i]._info._xWidth); + sz.syncAsByte(_animation->tr[i].xs); + sz.syncAsByte(_animation->tr[i].ys); + sz.syncAsByte(_animation->tr[i].totalnum); + sz.syncAsSint16LE(_animation->tr[i].hx); + sz.syncAsSint16LE(_animation->tr[i].hy); + sz.syncAsByte(_animation->tr[i].call_eachstep); + sz.syncAsByte(_animation->tr[i].eachstep); + sz.syncAsByte(_animation->tr[i].vanishifstill); + + sz.syncAsSint16LE(_animation->tr[i]._x); + sz.syncAsSint16LE(_animation->tr[i]._y); + + if (sz.isLoading() && _animation->tr[i]._visible) + _animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i].face); } //groi = 177; @@ -470,12 +470,12 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->refreshObjectList(); - _trip->newspeed(); + _animation->newspeed(); _lucerna->drawDirection(); _gyro->_onToolbar = false; - _trip->trippancy_link(); + _animation->trippancy_link(); _celer->updateBackgroundSprites(); @@ -484,8 +484,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); - if (_trip->tr[0].quick && _trip->tr[0].visible) - _trip->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. + if (_animation->tr[0].quick && _animation->tr[0]._visible) + _animation->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 639f4cca3d80..1973f9b6ff86 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -43,7 +43,7 @@ #include "avalanche/celer2.h" #include "avalanche/sequence2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/dropdown2.h" #include "avalanche/closing2.h" @@ -80,7 +80,7 @@ class AvalancheEngine : public Engine { Celer *_celer; Sequence *_sequence; Timeout *_timeout; - Trip *_trip; + Animation *_animation; Acci *_acci; Dropdown *_dropdown; Closing *_closing; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 814de6368ad5..c7ebb2142299 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -32,7 +32,7 @@ #include "avalanche/graphics.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" @@ -110,7 +110,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_END: case Common::KEYCODE_KP5: if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) { - _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. + _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->drawDirection(); return; } @@ -156,15 +156,15 @@ void Avalot::setup() { for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. - _vm->_trip->loadtrip(); + _vm->_animation->loadtrip(); - _vm->_trip->get_back_loretta(); + _vm->_animation->get_back_loretta(); _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); @@ -201,9 +201,9 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); - _vm->_trip->get_back_loretta(); + _vm->_animation->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_lucerna->checkClick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 8e1b13a22e8b..a261311f64fd 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/celer2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/roomnums.h" @@ -367,7 +367,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { warning("STUB: Celer::show_one()"); for (byte i = 0; i < 2; i++) - _vm->_trip->getset[i].remember(_r); + _vm->_animation->getset[i].remember(_r); } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 9894769d41ef..3c26496ecda5 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -33,7 +33,7 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/acci2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "common/textconsole.h" @@ -245,7 +245,7 @@ void MenuBar::draw() { _menuItems[i].draw(); for (byte page = 0; page <= 1; page++) - _dr->_vm->_trip->getset[page].remember(menuspace); + _dr->_vm->_animation->getset[page].remember(menuspace); _dr->_vm->_gyro->_cp = savecp; } @@ -455,12 +455,12 @@ void Dropdown::setupMenuAction() { _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); if (_vm->_gyro->_dna._room == 99) - _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->neardoor()); else - _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->neardoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) + if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -630,11 +630,11 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); break; case 5: { - if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) - _vm->_trip->tr[0].xs = _vm->_gyro->kRun; + if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) + _vm->_animation->tr[0].xs = _vm->_gyro->kRun; else - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); } break; } diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index d9421773918e..c3a195ecf4d1 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -32,7 +32,7 @@ #include "avalanche/enid2.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fd36aded840b..4ea4de776f85 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -35,7 +35,7 @@ #include "avalanche/lucerna2.h" #include "avalanche/visa2.h" #include "avalanche/acci2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/file.h" #include "common/random.h" @@ -228,12 +228,12 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { - if (_vm->_trip->tr[i].quick) - _vm->_trip->tr[i].done(); + if (_vm->_animation->tr[i].quick) + _vm->_animation->tr[i].done(); } // Deallocate sprite. Sorry, beta testers! - _vm->_trip->tr[0].init(0, true, _vm->_trip); + _vm->_animation->tr[0].init(0, true, _vm->_animation); _alive = true; _score = 0; @@ -257,7 +257,7 @@ void Gyro::newGame() { _onToolbar = false; _seeScroll = false; - _vm->_trip->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. + _vm->_animation->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = 254; @@ -272,11 +272,11 @@ void Gyro::newGame() { for (byte i = 0; i <= 1; i++) { _cp = 1 - _cp; - _vm->_trip->getback(); + _vm->_animation->getback(); } _vm->_lucerna->enterRoom(1, 1); - _vm->_trip->new_game_for_trippancy(); + _vm->_animation->new_game_for_trippancy(); _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); _vm->_lucerna->_clock.update(); @@ -454,7 +454,7 @@ Common::String Gyro::f5Does() { return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; break; case r__musicroom: - if (_vm->_trip->infield(7)) + if (_vm->_animation->infield(7)) return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; break; } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 0c2e01ae18bf..a034ace11740 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -34,7 +34,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" #include "avalanche/pingo2.h" @@ -396,10 +396,10 @@ void Lucerna::enterNewTown() { void Lucerna::putGeidaAt(byte whichPed, byte &ped) { if (ped == 0) return; - _vm->_trip->tr[1].init(5, false, _vm->_trip); // load Geida - _vm->_trip->apped(2, whichPed); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; + _vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida + _vm->_animation->apped(2, whichPed); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; } void Lucerna::enterRoom(byte room, byte ped) { @@ -441,25 +441,25 @@ void Lucerna::enterRoom(byte room, byte ped) { if (! _vm->_gyro->_dna._talkedToCrapulus) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours; - _vm->_trip->tr[1].init(8, false, _vm->_trip); // load Crapulus + _vm->_animation->tr[1].init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { - _vm->_trip->apped(2, 4); // Start on the right-hand side of the screen. - _vm->_trip->tr[1].walkto(5); // Walks up to greet you. + _vm->_animation->apped(2, 4); // Start on the right-hand side of the screen. + _vm->_animation->tr[1].walkto(5); // Walks up to greet you. } else { - _vm->_trip->apped(2, 5); // Starts where he was before. - _vm->_trip->tr[1].face = 3; + _vm->_animation->apped(2, 5); // Starts where he was before. + _vm->_animation->tr[1].face = Animation::kDirLeft; } - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // He always faces Avvy. + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; if (_vm->_gyro->_dna._crapulusWillTell) { - _vm->_trip->tr[1].init(8, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(4); + _vm->_animation->tr[1].init(8, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(4); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->_dna._crapulusWillTell = false; } @@ -476,15 +476,15 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__spludwicks: if (_vm->_gyro->_dna._spludwickAtHome) { if (ped > 0) { - _vm->_trip->tr[1].init(2, false, _vm->_trip); // load Spludwick - _vm->_trip->apped(2, 2); + _vm->_animation->tr[1].init(2, false, _vm->_animation); // load Spludwick + _vm->_animation->apped(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -497,18 +497,18 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; + _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procfollow_avvy_y; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... - _vm->_trip->apped(2, 2); // He appears on the right of the screen... - _vm->_trip->tr[1].walkto(4); // ...and he walks up... + _vm->_animation->apped(2, 2); // He appears on the right of the screen... + _vm->_animation->tr[1].walkto(4); // ...and he walks up... } else { // You've been here before. - _vm->_trip->apped(2, 4); // He's standing in your way straight away... - _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; + _vm->_animation->apped(2, 4); // He's standing in your way straight away... + _vm->_animation->tr[1].face = Animation::kDirLeft; } } } @@ -517,10 +517,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__argentroad: if ((_vm->_gyro->_dna._cwytalotGone) && (! _vm->_gyro->_dna._passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot again - _vm->_trip->apped(2, 1); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[1].vanishifstill = true; + _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again + _vm->_animation->apped(2, 1); + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].vanishifstill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); @@ -541,9 +541,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { if (! _vm->_gyro->_dna._beenTiedUp) { // A welcome party... or maybe not... - _vm->_trip->tr[1].init(6, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(3); + _vm->_animation->tr[1].init(6, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(3); _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -565,9 +565,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) switch (_vm->_gyro->_dna._cardiffQuestionNum) { case 0 : { // You've answered NONE of his questions. - _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(3); + _vm->_animation->tr[1].init(9, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(3); _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; @@ -575,9 +575,9 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. - _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 3); - _vm->_trip->tr[1].face = _vm->_trip->kDirRight; + _vm->_animation->tr[1].init(9, false, _vm->_animation); + _vm->_animation->apped(2, 3); + _vm->_animation->tr[1].face = Animation::kDirRight; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -627,7 +627,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; - _vm->_trip->catamove(ped); + _vm->_animation->catamove(ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; } break; @@ -645,7 +645,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. - if (_vm->_trip->tr[0].whichsprite == 0) // Avvy in his normal clothes + if (_vm->_animation->tr[0].whichsprite == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. @@ -703,22 +703,22 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__wisewomans: - _vm->_trip->tr[1].init(11, false, _vm->_trip); + _vm->_animation->tr[1].init(11, false, _vm->_animation); if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip->apped(2, 2); // Start on the right-hand side of the screen. - _vm->_trip->tr[1].walkto(4); // Walks up to greet you. + _vm->_animation->apped(2, 2); // Start on the right-hand side of the screen. + _vm->_animation->tr[1].walkto(4); // Walks up to greet you. } else { - _vm->_trip->apped(2, 4); // Starts where she was before. - _vm->_trip->tr[1].face = 3; + _vm->_animation->apped(2, 4); // Starts where she was before. + _vm->_animation->tr[1].face = Animation::kDirLeft; } - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // She always faces Avvy. + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // She always faces Avvy. break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_trip->tr[1].init(10, false, _vm->_trip); // Define the dart. + _vm->_animation->tr[1].init(10, false, _vm->_animation); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); @@ -969,37 +969,32 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); switch (color) { - case kColorGreen: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirUp; - _vm->_trip->rwsp(0, _vm->_trip->kDirUp); - drawDirection(); - } + case kColorGreen: + _vm->_gyro->_dna._direction = Animation::kDirUp; + _vm->_animation->rwsp(0, Animation::kDirUp); + drawDirection(); break; - case kColorBrown: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirDown; - _vm->_trip->rwsp(0, _vm->_trip->kDirDown); - drawDirection(); - } + case kColorBrown: + _vm->_gyro->_dna._direction = Animation::kDirDown; + _vm->_animation->rwsp(0, Animation::kDirDown); + drawDirection(); break; - case kColorCyan: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirLeft; - _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); - drawDirection(); - } + case kColorCyan: + _vm->_gyro->_dna._direction = Animation::kDirLeft; + _vm->_animation->rwsp(0, Animation::kDirLeft); + drawDirection(); break; - case kColorLightmagenta: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirRight; - _vm->_trip->rwsp(0, _vm->_trip->kDirRight); - drawDirection(); - } + case kColorLightmagenta: + _vm->_gyro->_dna._direction = Animation::kDirRight; + _vm->_animation->rwsp(0, Animation::kDirRight); + drawDirection(); break; case kColorRed: case kColorWhite: case kColorLightcyan: - case kColorYellow: { // Fall-throughs are intended. - _vm->_trip->stopwalking(); - drawDirection(); - } + case kColorYellow: // Fall-throughs are intended. + _vm->_animation->stopwalking(); + drawDirection(); break; } } @@ -1026,46 +1021,46 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { cursorPos.y /= 2; byte what; - // _vm->_trip->tr[0] is Avalot.) - if (cursorPos.x < _vm->_trip->tr[0].x) + // _vm->_animation->tr[0] is Avalot.) + if (cursorPos.x < _vm->_animation->tr[0]._x) what = 1; - else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) + else if (cursorPos.x > (_vm->_animation->tr[0]._x + _vm->_animation->tr[0]._info._xLength)) what = 2; else what = 0; // On top - if (cursorPos.y < _vm->_trip->tr[0].y) + if (cursorPos.y < _vm->_animation->tr[0]._y) what += 3; - else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info._yLength)) + else if (cursorPos.y > (_vm->_animation->tr[0]._y + _vm->_animation->tr[0]._info._yLength)) what += 6; switch (what) { case 0: - _vm->_trip->stopwalking(); + _vm->_animation->stopwalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); + _vm->_animation->rwsp(0, Animation::kDirLeft); break; case 2: - _vm->_trip->rwsp(0, _vm->_trip->kDirRight); + _vm->_animation->rwsp(0, Animation::kDirRight); break; case 3: - _vm->_trip->rwsp(0, _vm->_trip->kDirUp); + _vm->_animation->rwsp(0, Animation::kDirUp); break; case 4: - _vm->_trip->rwsp(0, _vm->_trip->kDirUpLeft); + _vm->_animation->rwsp(0, Animation::kDirUpLeft); break; case 5: - _vm->_trip->rwsp(0, _vm->_trip->kDirUpRight); + _vm->_animation->rwsp(0, Animation::kDirUpRight); break; case 6: - _vm->_trip->rwsp(0, _vm->_trip->kDirDown); + _vm->_animation->rwsp(0, Animation::kDirDown); break; case 7: - _vm->_trip->rwsp(0, _vm->_trip->kDirDownLeft); + _vm->_animation->rwsp(0, Animation::kDirDownLeft); break; case 8: - _vm->_trip->rwsp(0, _vm->_trip->kDirDownRight); + _vm->_animation->rwsp(0, Animation::kDirDownRight); break; } // No other values are possible. @@ -1130,11 +1125,11 @@ void Lucerna::checkClick() { callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->kRun; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kRun; + _vm->_animation->newspeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) @@ -1186,13 +1181,13 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). void Lucerna::gameOver() { _vm->_gyro->_dna._userMovesAvvy = false; - int16 sx = _vm->_trip->tr[0].x; - int16 sy = _vm->_trip->tr[0].y; + int16 sx = _vm->_animation->tr[0]._x; + int16 sy = _vm->_animation->tr[0]._y; - _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls - _vm->_trip->tr[0].step = 0; - _vm->_trip->tr[0].appear(sx, sy, 0); + _vm->_animation->tr[0].done(); + _vm->_animation->tr[0].init(12, true, _vm->_animation); // 12 = Avalot falls + _vm->_animation->tr[0].step = 0; + _vm->_animation->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); _vm->_gyro->_alive = false; @@ -1205,7 +1200,7 @@ void Lucerna::minorRedraw() { for (byte i = 0; i <= 1; i++) { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; - _vm->_trip->getback(); + _vm->_animation->getback(); } for (byte i = 0; i < 3; i++) @@ -1224,22 +1219,22 @@ uint16 Lucerna::bearing(byte whichPed) { const double rad2deg = 180 / 3.14; // Pi - if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[pedId]._x) + if (_vm->_animation->tr[0]._x == _vm->_gyro->_peds[pedId]._x) return 0; - else if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (_vm->_animation->tr[0]._x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; - _vm->_trip->get_back_loretta(); - _vm->_trip->trippancy_link(); + _vm->_animation->get_back_loretta(); + _vm->_animation->trippancy_link(); _vm->_gyro->_doingSpriteRun = false; } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 993e1cae2f0a..c46f8e21f190 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -16,7 +16,7 @@ MODULE_OBJS = \ celer2.o \ sequence2.o \ timeout2.o \ - trip6.o \ + animation.o \ acci2.o \ dropdown2.o \ closing2.o diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fc505e49847c..e20413b2f616 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -156,7 +156,7 @@ void Parser::drawCursor() { bf._y1 = 168; bf._y2 = 168; for (byte fv = 0; fv <= 1; fv++) - _vm->_trip->getset[fv].remember(bf); + _vm->_animation->getset[fv].remember(bf); } void Parser::wipeText() { diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index c61b6bbabd98..e522254ab2ce 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -32,7 +32,7 @@ #include "avalanche/pingo2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "common/textconsole.h" diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 56f605a9d405..c445a7e16444 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -32,7 +32,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" @@ -689,11 +689,11 @@ void Scrolls::calldrivers() { if (param == 0) natural(); else if ((1 <= param) && (param <= 9)) { - if ((param > _vm->_trip->kSpriteNumbMax) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. + if ((param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[param - 1].quick)) { // Not valid. _vm->_lucerna->errorLed(); natural(); } else - _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. + _vm->_animation->tr[param - 1].chatter(); // Normal sprite talking routine. } else if ((10 <= param) && (param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 4e51cf91a7fc..8e64dbc7bd2c 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -33,7 +33,7 @@ #include "avalanche/gyro2.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/scummsys.h" @@ -76,7 +76,7 @@ void Sequence::start_to_close() { void Sequence::start_to_open() { _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. - _vm->_trip->stopwalking(); // And they're not moving now. + _vm->_animation->stopwalking(); // And they're not moving now. start_to_close(); // Apart from that, it's the same thing. } @@ -94,7 +94,7 @@ void Sequence::call_sequencer() { break; case 177: // Flip room. _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_trip->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); + _vm->_animation->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); if (seq[0] == 177) shove_left(); break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index bc5a534eb7dc..38f276b04205 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -32,7 +32,7 @@ #include "avalanche/timeout2.h" #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "avalanche/acci2.h" #include "avalanche/sequence2.h" @@ -243,8 +243,8 @@ void Timeout::avaricius_talks() { } void Timeout::urinate() { - _vm->_trip->tr[0].turn(_vm->_trip->kDirUp); - _vm->_trip->stopwalking(); + _vm->_animation->tr[0].turn(Animation::kDirUp); + _vm->_animation->stopwalking(); _vm->_lucerna->drawDirection(); set_up_timer(14, proctoilet2, reason_gototoilet); } @@ -264,7 +264,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); - _vm->_trip->tr[0].walkto(4); + _vm->_animation->tr[0].walkto(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._brummieStairs = 2; _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; @@ -298,39 +298,39 @@ void Timeout::get_tied_up() { _vm->_visa->dixi('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; - _vm->_trip->stopwalking(); - _vm->_trip->tr[1].stopwalk(); - _vm->_trip->tr[1].stophoming(); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgrab_avvy; + _vm->_animation->stopwalking(); + _vm->_animation->tr[1].stopwalk(); + _vm->_animation->tr[1].stophoming(); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgrab_avvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } void Timeout::get_tied_up2() { - _vm->_trip->tr[0].walkto(4); - _vm->_trip->tr[1].walkto(5); + _vm->_animation->tr[0].walkto(4); + _vm->_animation->tr[1].walkto(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } void Timeout::hang_around() { - _vm->_trip->tr[1].check_me = false; - _vm->_trip->tr[0].init(7, true, _vm->_trip); // Robin Hood + _vm->_animation->tr[1].check_me = false; + _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); _vm->_visa->dixi('q', 39); - _vm->_trip->tr[0].walkto(7); + _vm->_animation->tr[0].walkto(7); set_up_timer(55, prochang_around2, reason_hanging_around); } void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); - _vm->_trip->tr[1].vanishifstill = false; - _vm->_trip->tr[1].walkto(4); + _vm->_animation->tr[1].vanishifstill = false; + _vm->_animation->tr[1].walkto(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->dixi('q', 41); - _vm->_trip->tr[0].done(); - _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. + _vm->_animation->tr[0].done(); + _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. set_up_timer(1, procafter_the_shootemup, reason_hanging_around); // Immediately call the following proc (when you have a chance). @@ -342,11 +342,11 @@ void Timeout::hang_around2() { void Timeout::after_the_shootemup() { - _vm->_trip->fliproom(_vm->_gyro->_dna._room, 0); + _vm->_animation->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_trip->tr[0].init(0, true, _vm->_trip); // Avalot. - _vm->_trip->apped(1, 2); + _vm->_animation->tr[0].init(0, true, _vm->_animation); // Avalot. + _vm->_animation->apped(1, 2); _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -415,9 +415,9 @@ void Timeout::jacques_wakes_up() { } void Timeout::naughty_duke() { // This is when the Duke comes in and takes your money. - _vm->_trip->tr[1].init(9, false, _vm->_trip); // Here comes the Duke. - _vm->_trip->apped(2, 1); // He starts at the door... - _vm->_trip->tr[1].walkto(3); // He walks over to you. + _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. + _vm->_animation->apped(2, 1); // He starts at the door... + _vm->_animation->tr[1].walkto(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -429,8 +429,8 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your void Timeout::naughty_duke2() { _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" - _vm->_trip->tr[1].walkto(1); // Walk to the door. - _vm->_trip->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1].walkto(1); // Walk to the door. + _vm->_animation->tr[1].vanishifstill = true; // Then go away! set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -450,7 +450,7 @@ void Timeout::jump() { case 5: case 7: case 9: - _vm->_trip->tr[0].y--; + _vm->_animation->tr[0]._y--; break; case 12: case 13: @@ -458,7 +458,7 @@ void Timeout::jump() { case 16: case 18: case 19: - _vm->_trip->tr[0].y++; + _vm->_animation->tr[0]._y++; break; } @@ -472,7 +472,7 @@ void Timeout::jump() { if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->_dna._room == r__insidecardiffcastle) && (_vm->_gyro->_dna._arrowInTheDoor == true) - && (_vm->_trip->infield(3))) { // Beside the wall + && (_vm->_animation->infield(3))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->display("You fail to grab it, because your hands are full."); @@ -530,8 +530,8 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; - _vm->_trip->tr[0].iy++; // Increments dx/dy! - _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; // Dowwwn we go... + _vm->_animation->tr[0].iy++; // Increments dx/dy! + _vm->_animation->tr[0]._y += _vm->_animation->tr[0].iy; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -545,62 +545,62 @@ void Timeout::meet_avaroid() { _vm->_gyro->_dna._metAvaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - _vm->_trip->tr[0].face = _vm->_trip->kDirLeft; - _vm->_trip->tr[0].x = 151; - _vm->_trip->tr[0].ix = -3; - _vm->_trip->tr[0].iy = -5; + _vm->_animation->tr[0].face = Animation::kDirLeft; + _vm->_animation->tr[0]._x = 151; + _vm->_animation->tr[0].ix = -3; + _vm->_animation->tr[0].iy = -5; _vm->_gyro->setBackgroundColor(2); } } void Timeout::rise_up_oubliette() { - _vm->_trip->tr[0].visible = true; - _vm->_trip->tr[0].iy++; // Decrements dx/dy! - _vm->_trip->tr[0].y -= _vm->_trip->tr[0].iy; // Uuuupppp we go... - if (_vm->_trip->tr[0].iy > 0) + _vm->_animation->tr[0]._visible = true; + _vm->_animation->tr[0].iy++; // Decrements dx/dy! + _vm->_animation->tr[0]._y -= _vm->_animation->tr[0].iy; // Uuuupppp we go... + if (_vm->_animation->tr[0].iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::robin_hood_and_geida() { - _vm->_trip->tr[0].init(7, true, _vm->_trip); - _vm->_trip->apped(1, 7); - _vm->_trip->tr[0].walkto(6); - _vm->_trip->tr[1].stopwalk(); - _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; + _vm->_animation->tr[0].init(7, true, _vm->_animation); + _vm->_animation->apped(1, 7); + _vm->_animation->tr[0].walkto(6); + _vm->_animation->tr[1].stopwalk(); + _vm->_animation->tr[1].face = Animation::kDirLeft; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->_dna._geidaFollows = false; } void Timeout::robin_hood_and_geida_talk() { _vm->_visa->dixi('q', 66); - _vm->_trip->tr[0].walkto(2); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[0].vanishifstill = true; - _vm->_trip->tr[1].vanishifstill = true; + _vm->_animation->tr[0].walkto(2); + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[0].vanishifstill = true; + _vm->_animation->tr[1].vanishifstill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } void Timeout::avalot_returns() { - _vm->_trip->tr[0].done(); - _vm->_trip->tr[1].done(); - _vm->_trip->tr[0].init(0, true, _vm->_trip); - _vm->_trip->apped(1, 1); + _vm->_animation->tr[0].done(); + _vm->_animation->tr[1].done(); + _vm->_animation->tr[0].init(0, true, _vm->_animation); + _vm->_animation->apped(1, 1); _vm->_visa->dixi('q', 67); _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::avvy_sit_down() { // This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. - if (_vm->_trip->tr[0].homing) // Still walking. + if (_vm->_animation->tr[0].homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dna._sittingInPub = true; _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_trip->tr[0].visible = false; + _vm->_animation->tr[0]._visible = false; } } @@ -636,8 +636,8 @@ void Timeout::winning() { } void Timeout::avalot_falls() { - if (_vm->_trip->tr[0].step < 5) { - _vm->_trip->tr[0].step++; + if (_vm->_animation->tr[0].step < 5) { + _vm->_animation->tr[0].step++; set_up_timer(3, procavalot_falls, reason_falling_over); } else { Common::String toDisplay; @@ -651,14 +651,14 @@ void Timeout::avalot_falls() { } void Timeout::spludwick_goes_to_cauldron() { - if (_vm->_trip->tr[1].homing) + if (_vm->_animation->tr[1].homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } void Timeout::spludwick_leaves_cauldron() { - _vm->_trip->tr[1].call_eachstep = true; // So that normal procs will continue. + _vm->_animation->tr[1].call_eachstep = true; // So that normal procs will continue. } void Timeout::give_lute_to_geida() { // Moved here from Acci. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 635e14db6e64..f3288ddd768c 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -34,7 +34,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/acci2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/textconsole.h" @@ -252,8 +252,8 @@ void Visa::talkto(byte whom) { whom -= 149; no_matches = true; - for (fv = 0; fv <= _vm->_trip->kSpriteNumbMax; fv++) - if (_vm->_trip->tr[fv].a.accinum == whom) { + for (fv = 0; fv <= _vm->_animation->kSpriteNumbMax; fv++) + if (_vm->_animation->tr[fv]._stat.accinum == whom) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); no_matches = false; break; @@ -275,8 +275,8 @@ void Visa::talkto(byte whom) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. - _vm->_trip->tr[1].vanishifstill = true; - _vm->_trip->tr[1].walkto(3); // Walks away. + _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1].walkto(3); // Walks away. _vm->_lucerna->incScore(2); } From 9198b166f7b99b9beedf833e0f2e573420db73fc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 20:02:14 +0200 Subject: [PATCH 0860/1332] AVALANCHE: Some more renaming in Animation --- engines/avalanche/acci2.cpp | 6 ++--- engines/avalanche/animation.cpp | 41 ++++++++++++++++++++------------- engines/avalanche/animation.h | 18 +++++++-------- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 12 +++++----- engines/avalanche/timeout2.cpp | 2 +- 7 files changed, 46 insertions(+), 37 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 407bffbe2540..5d09d055292c 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -708,7 +708,7 @@ void Acci::openBox(bool isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); - _vm->_animation->trippancy_link(); + _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); @@ -716,7 +716,7 @@ void Acci::openBox(bool isOpening) { if (!isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_celer->updateBackgroundSprites(); - _vm->_animation->trippancy_link(); + _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); } } @@ -1704,7 +1704,7 @@ void Acci::doThat() { _vm->_animation->apped(2, 4); _vm->_animation->tr[1].walkto(5); _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procback_and_forth; + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5679e1b71528..7b34c39be789 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -170,13 +170,18 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { iy = 0; } -bool AnimationType::collision_check() { - for (byte fv = 0; fv < _tr->kSpriteNumbMax; fv++) - if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && - ((_x + _info._xLength) > _tr->tr[fv]._x) && - (_x < (_tr->tr[fv]._x + _tr->tr[fv]._info._xLength)) && - (_tr->tr[fv]._y == _y)) +/** + * Check collision + * @remarks Originally called 'collision_check' + */ +bool AnimationType::checkCollision() { + for (byte i = 0; i < _tr->kSpriteNumbMax; i++) { + if (_tr->tr[i].quick && (_tr->tr[i].whichsprite != whichsprite) && + ((_x + _info._xLength) > _tr->tr[i]._x) && + (_x < (_tr->tr[i]._x + _tr->tr[i]._info._xLength)) && + (_tr->tr[i]._y == _y)) return true; + } return false; } @@ -207,7 +212,7 @@ void AnimationType::walk() { } if (check_me) { - if (collision_check()) { + if (checkCollision()) { bounce(); return; } @@ -833,7 +838,7 @@ void Animation::catamove(byte ped) { tr[1].init(5, true, this); // ...Load Geida. apped(2, geida_ped(ped)); tr[1].call_eachstep = true; - tr[1].eachstep = procgeida_procs; + tr[1].eachstep = kProcGeida; } } @@ -878,7 +883,7 @@ void Animation::call_special(uint16 which) { // OK! tr[1].call_eachstep = true; - tr[1].eachstep = procarrow_procs; + tr[1].eachstep = kProcArrow; } break; case 4: // This is the ghost room link. @@ -1373,7 +1378,11 @@ void Animation::call_andexors() { } } -void Animation::trippancy_link() { +/** + * Animation links + * @remarks Originally called 'trippancy_link' + */ +void Animation::animLink() { byte fv; if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) @@ -1388,23 +1397,23 @@ void Animation::trippancy_link() { for (fv = 0; fv < kSpriteNumbMax; fv++) { if (tr[fv].quick && tr[fv].call_eachstep) { switch (tr[fv].eachstep) { - case procfollow_avvy_y : + case kProcFollowAvvyY : follow_avvy_y(fv); break; - case procback_and_forth : + case kProcBackAndForth : back_and_forth(fv); break; - case procface_avvy : + case kProcFaceAvvy : face_avvy(fv); break; - case procarrow_procs : + case kProcArrow : arrow_procs(fv); break; // PROCSpludwick_procs : spludwick_procs(fv); - case procgrab_avvy : + case kProcGrabAvvy : grab_avvy(fv); break; - case procgeida_procs : + case kProcGeida : geida_procs(fv); break; } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index b8ae547d8c83..91837f1ab9bb 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -119,7 +119,7 @@ class AnimationType { private: Animation *_tr; - bool collision_check(); + bool checkCollision(); int8 sgn(int16 val); }; @@ -152,18 +152,18 @@ class Animation { static const int16 kSpriteNumbMax = 5; // current max no. of sprites - static const int16 procfollow_avvy_y = 1; - static const int16 procback_and_forth = 2; - static const int16 procface_avvy = 3; - static const int16 procarrow_procs = 4; - static const int16 procspludwick_procs = 5; - static const int16 procgrab_avvy = 6; - static const int16 procgeida_procs = 7; + static const int16 kProcFollowAvvyY = 1; + static const int16 kProcBackAndForth = 2; + static const int16 kProcFaceAvvy = 3; + static const int16 kProcArrow = 4; + static const int16 kProcsPludwick = 5; // Unused + static const int16 kProcGrabAvvy = 6; + static const int16 kProcGeida = 7; Animation(AvalancheEngine *vm); ~Animation(); - void trippancy_link(); + void animLink(); void get_back_loretta(); void loadtrip(); void call_special(uint16 which); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a7c8ea61db15..0c9fdd2acdc9 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -475,7 +475,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->drawDirection(); _gyro->_onToolbar = false; - _animation->trippancy_link(); + _animation->animLink(); _celer->updateBackgroundSprites(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c7ebb2142299..54a1c2244d8b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -203,7 +203,7 @@ void Avalot::run(Common::String arg) { _vm->_gyro->forceNumlock(); _vm->_animation->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); - _vm->_animation->trippancy_link(); + _vm->_animation->animLink(); _vm->_lucerna->checkClick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a034ace11740..1c191cb5383d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -399,7 +399,7 @@ void Lucerna::putGeidaAt(byte whichPed, byte &ped) { _vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida _vm->_animation->apped(2, whichPed); _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGeida; } void Lucerna::enterRoom(byte room, byte ped) { @@ -452,7 +452,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // He always faces Avvy. + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; @@ -484,7 +484,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGeida; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -499,7 +499,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procfollow_avvy_y; + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFollowAvvyY; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... @@ -713,7 +713,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // She always faces Avvy. + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. break; case r__insidecardiffcastle: @@ -1234,7 +1234,7 @@ void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; _vm->_animation->get_back_loretta(); - _vm->_animation->trippancy_link(); + _vm->_animation->animLink(); _vm->_gyro->_doingSpriteRun = false; } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 38f276b04205..7ba2136868b6 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -302,7 +302,7 @@ void Timeout::get_tied_up() { _vm->_animation->tr[1].stopwalk(); _vm->_animation->tr[1].stophoming(); _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->procgrab_avvy; + _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGrabAvvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } From c087998a8a65717f0353e8b8a708b4c4229e8f0b Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 20:37:42 +0200 Subject: [PATCH 0861/1332] AVALANCHE: Do renaming in scrolls2.h. --- engines/avalanche/acci2.cpp | 266 ++++++++++++++++---------------- engines/avalanche/animation.cpp | 18 +-- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 4 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 6 +- engines/avalanche/scrolls2.cpp | 194 ++++++++++++----------- engines/avalanche/scrolls2.h | 148 +++++++----------- engines/avalanche/timeout2.cpp | 18 +-- engines/avalanche/visa2.cpp | 12 +- 10 files changed, 318 insertions(+), 352 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 5d09d055292c..55f1e13fcd81 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -306,16 +306,16 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { if (target == kPardon) { ambiguous = true; if (animate) - _vm->_scrolls->display("Whom?"); + _vm->_scrolls->displayText("Whom?"); else - _vm->_scrolls->display("What?"); + _vm->_scrolls->displayText("What?"); } else { if (animate) - _vm->_scrolls->display(Common::String("{ ") + _vm->_gyro->getName(target) + " }"); + _vm->_scrolls->displayText(Common::String("{ ") + _vm->_gyro->getName(target) + " }"); else { Common::String z = _vm->_gyro->getItem(target); if (z != "") - _vm->_scrolls->display(Common::String("{ ") + z + " }"); + _vm->_scrolls->displayText(Common::String("{ ") + z + " }"); } } } @@ -365,7 +365,7 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + '1' + x + '.' + _vm->_scrolls->kControlSpeechBubble + _vm->_scrolls->kControlRegister + '2'); } @@ -599,7 +599,7 @@ void Acci::parse() { } if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); + _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -651,10 +651,10 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". return true; else { if (_person < 175) - _vm->_scrolls->display(Common::String('H') + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String('H') + _vm->_scrolls->kControlToBuffer); else - _vm->_scrolls->display(Common::String("Sh") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display("e isn't around at the moment."); + _vm->_scrolls->displayText(Common::String("Sh") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText("e isn't around at the moment."); return false; } } @@ -694,9 +694,9 @@ bool Acci::holding() { bool holdingResult = false; if (_thing > 100) - _vm->_scrolls->display("Be reasonable!"); + _vm->_scrolls->displayText("Be reasonable!"); else if (!_vm->_gyro->_dna._objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. - _vm->_scrolls->display("You're not holding it, Avvy."); + _vm->_scrolls->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -731,37 +731,37 @@ void Acci::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_scrolls->display(*_vm->_gyro->_also[_thing - 50][1]); + _vm->_scrolls->displayText(*_vm->_gyro->_also[_thing - 50][1]); openBox(false); } } } else if (_person != kPardon) exampers(); else - _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. + _vm->_scrolls->displayText("It's just as it looks on the picture."); // Don't know: guess. } void Acci::inventory() { byte itemNum = 0; - _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { itemNum++; if (itemNum == _vm->_gyro->_dna._carryNum) - _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->getItem(i + 1) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String("and ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + _vm->_scrolls->kControlToBuffer); if ((i + 1) == _vm->_gyro->_dna._wearing) - _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); if (itemNum < _vm->_gyro->_dna._carryNum) - _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", ") + _vm->_scrolls->kControlToBuffer); } } if (_vm->_gyro->_dna._wearing == kNothing) - _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + _vm->_scrolls->displayText(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); else - _vm->_scrolls->display("."); + _vm->_scrolls->displayText("."); } void Acci::swallow() { // Eat something. @@ -813,9 +813,9 @@ void Acci::swallow() { // Eat something. break; default: if ((_vm->_gyro->_dna._room == r__argentpub) || (_vm->_gyro->_dna._room == r__nottspub)) - _vm->_scrolls->display("Try BUYing things before you drink them!"); + _vm->_scrolls->displayText("Try BUYing things before you drink them!"); else - _vm->_scrolls->display("The taste of it makes you retch!"); + _vm->_scrolls->displayText("The taste of it makes you retch!"); } } @@ -835,24 +835,24 @@ void Acci::peopleInRoom() { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { actPerson++; if (actPerson == 1) // First on the list. - _vm->_scrolls->display(_vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); else if (actPerson < numPeople) // The middle... - _vm->_scrolls->display(Common::String(", ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); else // The end. - _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" and ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); } } if (numPeople == 1) - _vm->_scrolls->display(Common::String(" is") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" is") + _vm->_scrolls->kControlToBuffer); else - _vm->_scrolls->display(Common::String(" are") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" are") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(" here."); // End and display it. + _vm->_scrolls->displayText(" here."); // End and display it. } void Acci::lookAround() { - _vm->_scrolls->display(*_vm->_gyro->_also[0][1]); + _vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]); switch (_vm->_gyro->_dna._room) { case r__spludwicks: if (_vm->_gyro->_dna._avariciusTalk > 0) @@ -931,7 +931,7 @@ void Acci::openDoor() { break; case Gyro::kMagicUnfinished: _vm->_animation->tr[0].bounce(); - _vm->_scrolls->display("Sorry. This place is not available yet!"); + _vm->_scrolls->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: _vm->_animation->call_special(_vm->_gyro->_portals[fv]._data); @@ -946,16 +946,16 @@ void Acci::openDoor() { } if (_vm->_gyro->_dna._room == r__map) - _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " + _vm->_scrolls->displayText(Common::String("Avvy, you can complete the whole game without ever going " "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.")); else - _vm->_scrolls->display("Door? What door?"); + _vm->_scrolls->displayText("Door? What door?"); } void Acci::silly() { - _vm->_scrolls->display("Don't be silly!"); + _vm->_scrolls->displayText("Don't be silly!"); } void Acci::putProc() { @@ -974,10 +974,10 @@ void Acci::putProc() { case Gyro::kObjectWine: if (_thing == _vm->_gyro->kObjectOnion) { if (_vm->_gyro->_dna._rottenOnion) - _vm->_scrolls->display("That's a bit like shutting the stable door after the horse has bolted!"); + _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? if (_vm->_gyro->_dna._wineState != 3) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" + _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); else { // Put onion into vinegar! Yes! _vm->_gyro->_dna._onionInVinegar = true; @@ -992,31 +992,31 @@ void Acci::putProc() { case 54: if (_vm->_gyro->_dna._room == r__yours) { // Put something into the box. if (_vm->_gyro->_dna._boxContent != kNothing) - _vm->_scrolls->display("There's something in the box already, Avvy. Try taking that out first."); + _vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { case Gyro::kObjectMoney: - _vm->_scrolls->display("You'd better keep some ready cash on you!"); + _vm->_scrolls->displayText("You'd better keep some ready cash on you!"); break; case Gyro::kObjectBell: - _vm->_scrolls->display("That's a silly place to keep a bell."); + _vm->_scrolls->displayText("That's a silly place to keep a bell."); break; case Gyro::kObjectBodkin: - _vm->_scrolls->display("But you might need it!"); + _vm->_scrolls->displayText("But you might need it!"); break; case Gyro::kObjectOnion: - _vm->_scrolls->display("Just give it to Spludwick, Avvy!"); + _vm->_scrolls->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... if (_vm->_gyro->_dna._wearing == _thing) - _vm->_scrolls->display(Common::String("You'd better take ") + _vm->_gyro->getItem(_thing) + " off first!"); + _vm->_scrolls->displayText(Common::String("You'd better take ") + _vm->_gyro->getItem(_thing) + " off first!"); else { openBox(true); // Open box. _vm->_gyro->_dna._boxContent = _thing; _vm->_gyro->_dna._objects[_thing - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->display("OK, it's in the box."); + _vm->_scrolls->displayText("OK, it's in the box."); openBox(false); // Shut box. } @@ -1034,7 +1034,7 @@ void Acci::putProc() { void Acci::notInOrder() { - _vm->_scrolls->display(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") + _vm->_scrolls->displayText(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } @@ -1110,21 +1110,21 @@ void Acci::drink() { void Acci::cardiffClimbing() { if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. - _vm->_scrolls->display("You climb down, back onto the floor."); + _vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_gyro->_dna._standingOnDais = false; _vm->_animation->apped(1, 3); } else { // Clamber down. if (_vm->_animation->infield(1)) { - _vm->_scrolls->display("You clamber up onto the dais."); + _vm->_scrolls->displayText("You clamber up onto the dais."); _vm->_gyro->_dna._standingOnDais = true; _vm->_animation->apped(1, 2); } else - _vm->_scrolls->display("Get a bit closer, Avvy."); + _vm->_scrolls->displayText("Get a bit closer, Avvy."); } } void Acci::already() { - _vm->_scrolls->display("You're already standing!"); + _vm->_scrolls->displayText("You're already standing!"); } void Acci::standUp() { @@ -1175,13 +1175,13 @@ void Acci::getProc(char thing) { if (_vm->_animation->infield(2)) { if (_vm->_gyro->_dna._boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); - _vm->_scrolls->display("OK, I've got it."); + _vm->_scrolls->displayText("OK, I've got it."); _vm->_gyro->_dna._objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else - _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box."); + _vm->_scrolls->displayText(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box."); } else _vm->_visa->dixi('q', 57); break; @@ -1190,7 +1190,7 @@ void Acci::getProc(char thing) { case Gyro::kObjectPen: if (_vm->_animation->infield(2)) { // Standing on the dais. if (_vm->_gyro->_dna._takenPen) - _vm->_scrolls->display("It's not there, Avvy."); + _vm->_scrolls->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. @@ -1198,7 +1198,7 @@ void Acci::getProc(char thing) { _vm->_gyro->_dna._takenPen = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->display("Taken."); + _vm->_scrolls->displayText("Taken."); } } else if (_vm->_gyro->_dna._standingOnDais) _vm->_visa->dixi('q', 53); @@ -1215,7 +1215,7 @@ void Acci::getProc(char thing) { case r__robins: if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_scrolls->display("Got it!"); + _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_dna._mushroomGrowing = false; _vm->_gyro->_dna._takenMushroom = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = true; @@ -1235,7 +1235,7 @@ void Acci::getProc(char thing) { */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->_dna._room != r__lustiesroom) { - _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; @@ -1248,9 +1248,9 @@ void Acci::giveGeidaTheLute() { void Acci::playHarp() { if (_vm->_animation->infield(7)) - _vm->_scrolls->musical_scroll(); + _vm->_scrolls->musicalScroll(); else - _vm->_scrolls->display("Get a bit closer to it, Avvy!"); + _vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); } void Acci::winSequence() { @@ -1271,7 +1271,7 @@ void Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! return; } @@ -1279,7 +1279,7 @@ void Acci::personSpeaks() { for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->tr[i].quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } } @@ -1287,13 +1287,13 @@ void Acci::personSpeaks() { if (!found) { for (byte i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); } } } void Acci::heyThanks() { personSpeaks(); - _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); + _vm->_scrolls->displayText(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); _vm->_gyro->_dna._objects[_thing - 1] = false; } @@ -1321,11 +1321,11 @@ void Acci::doThat() { && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->_alive) { - _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); + _vm->_scrolls->displayText(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); return; } if (!_vm->_gyro->_dna._avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_scrolls->display("Talking in your sleep? Try waking up!"); + _vm->_scrolls->displayText("Talking in your sleep? Try waking up!"); return; } } @@ -1338,24 +1338,24 @@ void Acci::doThat() { openDoor(); break; case kVerbCodePause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - _vm->_scrolls->display(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + _vm->_scrolls->displayText(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue."); break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. if (_vm->_gyro->_dna._carryNum >= kCarryLimit) - _vm->_scrolls->display("You can't carry any more!"); + _vm->_scrolls->displayText("You can't carry any more!"); else getProc(_thing); } else { // Not... ditto. if (_person != kPardon) - _vm->_scrolls->display("You can't sweep folk off their feet!"); + _vm->_scrolls->displayText("You can't sweep folk off their feet!"); else - _vm->_scrolls->display("I assure you, you don't need it."); + _vm->_scrolls->displayText("I assure you, you don't need it."); } break; case kVerbCodeDrop: - _vm->_scrolls->display(Common::String("Two years ago you dropped a florin in the street. Three days ") + + _vm->_scrolls->displayText(Common::String("Two years ago you dropped a florin in the street. Three days ") + "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; case kVerbCodeInv: @@ -1364,7 +1364,7 @@ void Acci::doThat() { case kVerbCodeTalk: if (_person == kPardon) { if (_vm->_gyro->_subjectNum == 99) // They typed "say password". - _vm->_scrolls->display(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); + _vm->_scrolls->displayText(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); @@ -1378,7 +1378,7 @@ void Acci::doThat() { _person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; if ((_person == 0) || (_person == kPardon)) - _vm->_scrolls->display("Talk to whom?"); + _vm->_scrolls->displayText("Talk to whom?"); else if (isPersonHere()) _vm->_visa->talkto(_person); } @@ -1388,30 +1388,30 @@ void Acci::doThat() { case kVerbCodeGive: if (holding()) { if (_person == kPardon) - _vm->_scrolls->display("Give to whom?"); + _vm->_scrolls->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { case Gyro::kObjectMoney : - _vm->_scrolls->display("You can't bring yourself to give away your moneybag."); + _vm->_scrolls->displayText("You can't bring yourself to give away your moneybag."); break; case Gyro::kObjectBodkin: case Gyro::kObjectBell: case Gyro::kObjectClothes: case Gyro::kObjectHabit : - _vm->_scrolls->display("Don't give it away, it might be useful!"); + _vm->_scrolls->displayText("Don't give it away, it might be useful!"); break; default: switch (_person) { case Gyro::kPeopleCrapulus: if (_thing == _vm->_gyro->kObjectWine) { - _vm->_scrolls->display("Crapulus grabs the wine and gulps it down."); + _vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down."); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; } else heyThanks(); break; case Gyro::kPeopleCwytalot: if ((_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt)) - _vm->_scrolls->display(Common::String("You might be able to influence Cwytalot more if you used it!")); + _vm->_scrolls->displayText(Common::String("You might be able to influence Cwytalot more if you used it!")); else heyThanks(); break; @@ -1443,7 +1443,7 @@ void Acci::doThat() { } else heyThanks(); } else - _vm->_scrolls->display("But he's asleep!"); + _vm->_scrolls->displayText("But he's asleep!"); break; case Gyro::kPeopleGeida: switch (_thing) { @@ -1495,13 +1495,13 @@ void Acci::doThat() { // We don't handle these two because we use ScummVM's save/load system. case kVerbCodePay: - _vm->_scrolls->display("No money need change hands."); + _vm->_scrolls->displayText("No money need change hands."); break; case kVerbCodeLook: lookAround(); break; case kVerbCodeBreak: - _vm->_scrolls->display("Vandalism is prohibited within this game!"); + _vm->_scrolls->displayText("Vandalism is prohibited within this game!"); break; case kVerbCodeQuit: // quit if (_vm->_gyro->kDemo) { @@ -1511,15 +1511,15 @@ void Acci::doThat() { // exit(0); // Change this later!!! } if (!_polite) - _vm->_scrolls->display("How about a `please\", Avvy?"); - else if (_vm->_scrolls->ask(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) + _vm->_scrolls->displayText("How about a `please\", Avvy?"); + else if (_vm->_scrolls->displayQuestion(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) _vm->_gyro->_letMeOut = true; break; case kVerbCodeGo: - _vm->_scrolls->display("Just use the arrow keys to walk there."); + _vm->_scrolls->displayText("Just use the arrow keys to walk there."); break; case kVerbCodeInfo: { - _vm->_scrolls->aboutscroll = true; + _vm->_scrolls->_aboutScroll = true; Common::String toDisplay; for (byte i = 0; i < 7; i++) @@ -1529,34 +1529,34 @@ void Acci::doThat() { + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \xEF " + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; - _vm->_scrolls->display(toDisplay); - _vm->_scrolls->aboutscroll = false; + _vm->_scrolls->displayText(toDisplay); + _vm->_scrolls->_aboutScroll = false; } break; case kVerbCodeUndress: if (_vm->_gyro->_dna._wearing == kNothing) - _vm->_scrolls->display("You're already stark naked!"); + _vm->_scrolls->displayText("You're already stark naked!"); else if (_vm->_gyro->_dna._avvysInTheCupboard) { - _vm->_scrolls->display(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.'); + _vm->_scrolls->displayText(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.'); _vm->_gyro->_dna._wearing = kNothing; _vm->_lucerna->refreshObjectList(); } else - _vm->_scrolls->display("Hadn't you better find somewhere more private, Avvy?"); + _vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?"); break; case kVerbCodeWear: if (holding()) { // Wear something. switch (_thing) { case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you\?\?!"); + _vm->_scrolls->displayText("Hey, kWhat kind of a weirdo are you\?\?!"); break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! if (_vm->_gyro->_dna._wearing != kNothing) { if (_vm->_gyro->_dna._wearing == _thing) - _vm->_scrolls->display("You're already wearing that."); + _vm->_scrolls->displayText("You're already wearing that."); else - _vm->_scrolls->display("You'll be rather warm wearing two sets of clothes!"); + _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else _vm->_gyro->_dna._wearing = _thing; @@ -1579,7 +1579,7 @@ void Acci::doThat() { } break; default: - _vm->_scrolls->display(kWhat); + _vm->_scrolls->displayText(kWhat); } } break; @@ -1617,7 +1617,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); } break; @@ -1640,29 +1640,29 @@ void Acci::doThat() { if (_vm->_gyro->_dna._room == r__musicroom) playHarp(); else - _vm->_scrolls->display(kWhat); + _vm->_scrolls->displayText(kWhat); break; case 55: if (_vm->_gyro->_dna._room == r__argentpub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay"); else - _vm->_scrolls->display(kWhat); + _vm->_scrolls->displayText(kWhat); break; default: - _vm->_scrolls->display(kWhat); + _vm->_scrolls->displayText(kWhat); } } break; case kVerbCodeRing: if (holding()) { if (_thing == _vm->_gyro->kObjectBell) { - _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); + _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); + _vm->_scrolls->displayText("(Are you trying to join in, Avvy\?\?!)"); } else - _vm->_scrolls->display(kWhat); + _vm->_scrolls->displayText(kWhat); } break; case kVerbCodeHelp: @@ -1670,10 +1670,10 @@ void Acci::doThat() { warning("STUB: Acci::doThat() - case kVerbCodehelp"); break; case kVerbCodeLarrypass: - _vm->_scrolls->display("Wrong game!"); + _vm->_scrolls->displayText("Wrong game!"); break; case kVerbCodePhaon: - _vm->_scrolls->display("Hello, Phaon!"); + _vm->_scrolls->displayText("Hello, Phaon!"); break; case kVerbCodeBoss: // bosskey(); @@ -1681,14 +1681,14 @@ void Acci::doThat() { break; case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { - _vm->_scrolls->display("Hmm, I don't think anyone will notice..."); + _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else - _vm->_scrolls->display(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); break; case kVerbCodeCheat: - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); _vm->_gyro->_cheat = true; break; case kVerbCodeMagic: @@ -1709,25 +1709,25 @@ void Acci::doThat() { _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } } else - _vm->_scrolls->display("Nothing appears to happen..."); + _vm->_scrolls->displayText("Nothing appears to happen..."); } break; case kVerbCodeSmartAlec: - _vm->_scrolls->display("Listen, smart alec, that was just rhetoric."); + _vm->_scrolls->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: switch (_vm->_gyro->_dna._sworeNum) { case 0: - _vm->_scrolls->display(Common::String("Avvy! Do you mind? There might be kids playing!") + _vm->_scrolls->displayText(Common::String("Avvy! Do you mind? There might be kids playing!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(I shouldn't say it again, if I were you!)"); break; case 1: - _vm->_scrolls->display(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?") + _vm->_scrolls->displayText(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Don't do it again!"); break; default: _vm->_pingo->zonk(); - _vm->_scrolls->display(Common::String("A crack of lightning shoots from the sky, and fries you.") + _vm->_scrolls->displayText(Common::String("A crack of lightning shoots from the sky, and fries you.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna->gameOver(); } @@ -1735,11 +1735,11 @@ void Acci::doThat() { break; case kVerbCodeListen: if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) - _vm->_scrolls->display("All other noise is drowned out by the ringing of the bells."); + _vm->_scrolls->displayText("All other noise is drowned out by the ringing of the bells."); else if (_vm->_gyro->_listen.empty()) - _vm->_scrolls->display("You can't hear anything much at the moment, Avvy."); + _vm->_scrolls->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls->display(_vm->_gyro->_listen); + _vm->_scrolls->displayText(_vm->_gyro->_listen); break; case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_dna._room) { @@ -1764,7 +1764,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->_dna._drinking = _thing; _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -1784,12 +1784,12 @@ void Acci::doThat() { } if (_vm->_gyro->_dna._carryNum >= kCarryLimit) { - _vm->_scrolls->display("Your hands are full."); + _vm->_scrolls->displayText("Your hands are full."); return; } _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -1809,7 +1809,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_dna._carryNum >= kCarryLimit) - _vm->_scrolls->display("Before you ask, you remember that your hands are full."); + _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->_dna._boughtOnion) _vm->_visa->dixi('D', 11); @@ -1845,13 +1845,13 @@ void Acci::doThat() { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->dixi('Q', 10); - _vm->_scrolls->display("(At the very least, don't use your bare hands!)"); + _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls->display("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_scrolls->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: - _vm->_scrolls->display("Come on, Avvy! You're not going to get very far with only a crossbow!"); + _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: _vm->_visa->dixi('Q', 11); @@ -1888,10 +1888,10 @@ void Acci::doThat() { if (ok) { if (_vm->_gyro->_dna._drawbridgeOpen != 0) - _vm->_scrolls->display("Contrary to your expectations, the drawbridge fails to close again."); + _vm->_scrolls->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna->incScore(4); - _vm->_scrolls->display("The drawbridge opens!"); + _vm->_scrolls->displayText("The drawbridge opens!"); _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); _vm->_gyro->_dna._drawbridgeOpen = 1; } @@ -1906,7 +1906,7 @@ void Acci::doThat() { _vm->_lucerna->gameOver(); break; case kVerbCodeScore: - _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->intToStr(_vm->_gyro->_dna._score) + ',' + _vm->_scrolls->kControlCenter + _vm->_scrolls->displayText(Common::String("Your score is ") + _vm->_gyro->intToStr(_vm->_gyro->_dna._score) + ',' + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totalTime()); break; @@ -1918,7 +1918,7 @@ void Acci::doThat() { break; case kVerbCodeKiss: if (_person == kPardon) - _vm->_scrolls->display("Kiss whom?"); + _vm->_scrolls->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: @@ -1934,14 +1934,14 @@ void Acci::doThat() { _vm->_visa->dixi('U', 5); // You WHAT? } } else if ((150 <= _person) && (_person <= 174)) - _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??"); + _vm->_scrolls->displayText("Hey, kWhat kind of a weirdo are you??"); break; case kVerbCodeClimb: if (_vm->_gyro->_dna._room == r__insidecardiffcastle) cardiffClimbing(); else // In the wrong room! - _vm->_scrolls->display("Not with your head for heights, Avvy!"); + _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); @@ -1965,24 +1965,24 @@ void Acci::doThat() { if (_vm->_gyro->_dna._teetotal) _vm->_visa->dixi('d', 13); } else - _vm->_scrolls->display("You're already awake, Avvy!"); + _vm->_scrolls->displayText("You're already awake, Avvy!"); break; case Gyro::kPeopleAyles: if (!_vm->_gyro->_dna._aylesIsAwake) - _vm->_scrolls->display("You can't seem to wake him by yourself."); + _vm->_scrolls->displayText("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: - _vm->_scrolls->display(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + + _vm->_scrolls->displayText(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; default: - _vm->_scrolls->display("It's difficult to awaken people who aren't asleep...!"); + _vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!"); } break; case kVerbCodeSit: if (_vm->_gyro->_dna._room == r__nottspub) { if (_vm->_gyro->_dna._sittingInPub) - _vm->_scrolls->display("You're already sitting!"); + _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); @@ -1991,29 +1991,29 @@ void Acci::doThat() { _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); - _vm->_scrolls->display(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); + _vm->_scrolls->displayText(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); } break; case kVerbCodeRestart: - if (_vm->_scrolls->ask("Restart game and lose changes?")) { + if (_vm->_scrolls->displayQuestion("Restart game and lose changes?")) { _vm->_lucerna->dusk(); _vm->_gyro->newGame(); _vm->_lucerna->dawn(); } break; case kPardon: - _vm->_scrolls->display("Hey, a _verb would be helpful!"); + _vm->_scrolls->displayText("Hey, a _verb would be helpful!"); break; case kVerbCodeHello: personSpeaks(); - _vm->_scrolls->display(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble); break; case kVerbCodeThanks: personSpeaks(); - _vm->_scrolls->display(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble); break; default: - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlBell) + "Parser bug!"); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlBell) + "Parser bug!"); } } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 7b34c39be789..598ae7dfbe6a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -236,7 +236,7 @@ void AnimationType::walk() { break; case Gyro::kMagicUnfinished: { bounce(); - _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); + _tr->_vm->_scrolls->displayText("\7Sorry.\3\rThis place is not available yet!"); } break; case Gyro::kMagicSpecial: @@ -551,18 +551,18 @@ void Animation::catamove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs fliproom(r__lustiesroom, 4); - _vm->_scrolls->display("Phew! Nice to be out of there!"); + _vm->_scrolls->displayText("Phew! Nice to be out of there!"); return; case 1033: // Oubliette fliproom(r__oubliette, 1); - _vm->_scrolls->display(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); return; case 4: fliproom(r__geidas, 1); return; case 2307: fliproom(r__lusties, 5); - _vm->_scrolls->display("Oh no... here we go again..."); + _vm->_scrolls->displayText("Oh no... here we go again..."); _vm->_gyro->_dna._userMovesAvvy = false; tr[0].iy = 1; tr[0].ix = 0; @@ -924,7 +924,7 @@ void Animation::call_special(uint16 which) { _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); - _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. @@ -1295,7 +1295,7 @@ void Animation::spin(byte whichway, byte &tripnum) { _vm->_gyro->_dna._geidaSpin += 1; _vm->_gyro->_dna._geidaTime = 20; if (_vm->_gyro->_dna._geidaSpin == 5) { - _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_scrolls->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_gyro->_dna._geidaSpin = 0; _vm->_gyro->_dna._geidaTime = 0; // knock out records } @@ -1461,12 +1461,12 @@ void Animation::getsetclear() { void Animation::hide_in_the_cupboard() { if (_vm->_gyro->_dna._avvysInTheCupboard) { if (_vm->_gyro->_dna._wearing == Acci::kNothing) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { tr[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; apped(1, 3); // Walk out of the cupboard. - _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); + _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_dna._avvysInTheCupboard = false; _vm->_sequence->first_show(8); _vm->_sequence->then_show(7); @@ -1476,7 +1476,7 @@ void Animation::hide_in_the_cupboard() { // Not hiding in the cupboard tr[0]._visible = false; _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + _vm->_scrolls->displayText(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); _vm->_gyro->_dna._avvysInTheCupboard = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 0c9fdd2acdc9..9b04f640a36c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -479,7 +479,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _celer->updateBackgroundSprites(); - _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->displayText(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 54a1c2244d8b..72cb1d61920d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -132,7 +132,7 @@ void Avalot::handleKeyDown(Common::Event &event) { void Avalot::setup() { _vm->_gyro->_mouse = _vm->_gyro->kMouseStateNo; _vm->_gyro->_letMeOut = false; - _vm->_scrolls->resetscroll(); + _vm->_scrolls->resetScroll(); CursorMan.showMouse(true); _vm->_gyro->_holdTheDawn = true; _vm->_lucerna->dusk(); @@ -152,7 +152,7 @@ void Avalot::setup() { _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionStopped; _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); - _vm->_scrolls->state(2); + _vm->_scrolls->setReadyLight(2); for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 4ea4de776f85..6fa91cf87fe3 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -239,7 +239,7 @@ void Gyro::newGame() { _score = 0; memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); - _vm->_scrolls->natural(); + _vm->_scrolls->setBubbleStateNatural(); _dna._spareEvening = "answer a questionnaire"; _dna._favouriteDrink = "beer"; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1c191cb5383d..e56250f15c6d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -74,7 +74,7 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so plotHands(); if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) - _vm->_scrolls->display(Common::String("Good morning!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + _vm->_scrolls->displayText(Common::String("Good morning!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); _oldHour = _hour; @@ -146,7 +146,7 @@ void Lucerna::init() { */ void Lucerna::callVerb(byte id) { if (id == _vm->_acci->kPardon) { - _vm->_scrolls->display(Common::String("The f5 key lets you do a particular action in certain ") + + _vm->_scrolls->displayText(Common::String("The f5 key lets you do a particular action in certain ") + "situations. However, at the moment there is nothing " + "assigned to it. You may press alt-A to see what the " + "current setting of this key is."); @@ -1242,7 +1242,7 @@ void Lucerna::spriteRun() { void Lucerna::fixFlashers() { _vm->_gyro->_ledStatus = 177; _vm->_gyro->_oldDirection = 177; - _vm->_scrolls->state(2); + _vm->_scrolls->setReadyLight(2); drawDirection(); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index c445a7e16444..444762b275f8 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -49,11 +49,11 @@ Scrolls::Scrolls(AvalancheEngine *vm) { } void Scrolls::init() { - loadfont(); - resetscrolldriver(); + loadFont(); + resetScrollDriver(); } -void Scrolls::state(byte x) { // Sets "Ready" light to whatever +void Scrolls::setReadyLight(byte x) { // Sets "Ready" light to whatever if (_vm->_gyro->_ledStatus == x) return; // Already like that! @@ -78,7 +78,7 @@ void Scrolls::state(byte x) { // Sets "Ready" light to whatever _vm->_gyro->_ledStatus = x; } -void Scrolls::easteregg() { +void Scrolls::easterEgg() { warning("STUB: Scrolls::easteregg()"); } @@ -93,16 +93,16 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwrit for (byte xx = 0; xx < lz; xx++) { switch (z[xx]) { case kControlRoman: { - cfont = roman; + _currentFont = kFontStyleRoman; } break; case kControlItalic: { - cfont = italic; + _currentFont = kFontStyleItalic; } break; default: { for (byte yy = 0; yy < 12; yy++) - itw[(byte)z[xx]][yy] = ch[cfont][(byte)z[xx]][yy + 2]; + itw[(byte)z[xx]][yy] = _scrollFonts[_currentFont][(byte)z[xx]][yy + 2]; // We have to draw the characters one-by-one because of the accidental font changes. i++; @@ -115,11 +115,11 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwrit // Here are the procedures that Scroll calls. So they must be... $F+*/ -void Scrolls::normscroll() { +void Scrolls::scrollModeNormal() { Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; Common::String e = "(c) 1994"; - state(3); + setReadyLight(3); _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); _vm->_gyro->newMouse(4); @@ -182,7 +182,7 @@ void Scrolls::normscroll() { _vm->_gyro->screturn = r == '#'; // "back door" #endif - state(0); + setReadyLight(0); _vm->_gyro->_seeScroll = false; CursorMan.showMouse(false); _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). @@ -190,19 +190,19 @@ void Scrolls::normscroll() { warning("STUB: Scrolls::normscroll()"); } -void Scrolls::dialogue() { +void Scrolls::scrollModeDialogue() { warning("STUB: Scrolls::dialogue()"); } -void Scrolls::store_(byte what, TuneType &played) { +void Scrolls::store(byte what, TuneType &played) { memcpy(played + 1, played + 2, sizeof(played) - 1); played[30] = what; } -bool Scrolls::they_match(TuneType &played) { +bool Scrolls::theyMatch(TuneType &played) { byte fv, mistakes; mistakes = 0; @@ -216,8 +216,8 @@ bool Scrolls::they_match(TuneType &played) { return mistakes < 5; } -void Scrolls::music_scroll() { - state(3); +void Scrolls::scrollModeMusic() { + setReadyLight(3); _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); _vm->_gyro->newMouse(4); @@ -229,7 +229,7 @@ void Scrolls::music_scroll() { #endif _vm->_gyro->_scReturn = true; CursorMan.showMouse(false); - state(0); + setReadyLight(0); _vm->_gyro->_seeScroll = false; _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up); @@ -247,30 +247,30 @@ void Scrolls::music_scroll() { // ThatsAll, so put us back to $F- -void Scrolls::resetscrolldriver() { // phew +void Scrolls::resetScrollDriver() { // phew _vm->_gyro->_scrollBells = 0; - cfont = roman; - use_icon = 0; + _currentFont = kFontStyleRoman; + _useIcon = 0; _vm->_gyro->_interrogation = 0; // always reset after a scroll comes up. } -void Scrolls::dingdongbell() { // Pussy's in the well. Who put her in? Little... +void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... for (byte fv = 0; fv < _vm->_gyro->_scrollBells; fv++) _vm->_lucerna->errorLed(); // ring the bell "x" times } void Scrolls::dodgem() { - dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. + _dodgeCoord = _vm->getMousePos(); + g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. } -void Scrolls::undodgem() { +void Scrolls::unDodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) - g_system->warpMouse(dodgeCoord.x, dodgeCoord.y); // No change, so restore the pointer's original position. + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) + g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } -void Scrolls::geticon(int16 x, int16 y, byte which) { +void Scrolls::getIcon(int16 x, int16 y, byte which) { Common::File f; byte *p; @@ -292,7 +292,7 @@ void Scrolls::geticon(int16 x, int16 y, byte which) { f.close(); } -void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { +void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File f; Common::String filename; @@ -321,7 +321,7 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { f.close(); } -void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in the game. +void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the oldest procs in the game. byte b; int16 lx, ly, mx, my, ex; bool centre; @@ -343,8 +343,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t lx = lx / 2; ly -= 2; - if ((1 <= use_icon) && (use_icon <= 34)) - lx += halficonwidth; + if ((1 <= _useIcon) && (_useIcon <= 34)) + lx += kHalfIconWidth; _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); @@ -382,24 +382,24 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t centre = false; - switch (use_icon) { + switch (_useIcon) { case 0: icon_indent = 0; break; // No icon. case 34: { - block_drop("about", 28, 76, 15); + drawSign("about", 28, 76, 15); icon_indent = 0; } break; case 35: { - block_drop("gameover", 52, 59, 71); + drawSign("gameover", 52, 59, 71); icon_indent = 0; } break; } - if ((1 <= use_icon) && (use_icon <= 33)) { // Standard icon. - geticon(mx, my + ly / 2, use_icon); + if ((1 <= _useIcon) && (_useIcon <= 33)) { // Standard icon. + getIcon(mx, my + ly / 2, _useIcon); icon_indent = 53; } @@ -419,13 +419,13 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t break; case kControlQuestion: { //settextjustify(1, 1); - dix = mx + lx; - diy = my + ly; + _shadowBoxX = mx + lx; + _shadowBoxY = my + ly; _vm->_gyro->_scroll[b].setChar(' ', 0); // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); - _vm->_gyro->drawShadowBox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes."); - _vm->_gyro->drawShadowBox(dix + 5, diy - 24, dix + 65, diy - 10, "No."); + _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); + _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); } break; } @@ -440,14 +440,14 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. //setvisualpage(1 - cp); - dingdongbell(); + ringBell(); //my = getpixel(0, 0); _vm->_gyro->_dropsOk = false; dodgem(); (this->*gotoit)(); - undodgem(); + unDodgem(); _vm->_gyro->_dropsOk = true; //setvisualpage(cp); //mousepage(cp); @@ -458,14 +458,14 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t _vm->_gyro->_onCanDoPageSwap = true; // Normality again. CursorMan.showMouse(true); //settextjustify(0, 0); // sink - resetscrolldriver(); + resetScrollDriver(); /*if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true;*/ warning("STUB: Scrolls::drawscroll()"); } -void Scrolls::bubble(func2 gotoit) { +void Scrolls::drawBubble(ScrollsFunctionType gotoit) { int16 xl, yl, my, xw, yw; Common::Point p[3]; // byte *rp1, *rp2; // replace: 1=bubble, 2=pointer @@ -536,7 +536,7 @@ void Scrolls::bubble(func2 gotoit) { } //setvisualpage(1 - cp); - dingdongbell(); + ringBell(); _vm->_gyro->_onCanDoPageSwap = false; CursorMan.showMouse(true); _vm->_gyro->_dropsOk = false; @@ -550,31 +550,31 @@ void Scrolls::bubble(func2 gotoit) { //setvisualpage(cp); CursorMan.showMouse(true); // sink; _vm->_gyro->_onCanDoPageSwap = true; - resetscrolldriver(); + resetScrollDriver(); /*if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true;*/ } -bool Scrolls::ask(Common::String question) { +bool Scrolls::displayQuestion(Common::String question) { warning("STUB: Scrolls::ask()"); return true; } -void Scrolls::resetscroll() { +void Scrolls::resetScroll() { _vm->_gyro->_scrollNum = 1; for (int j = 0; j < 15; j++) if (!_vm->_gyro->_scroll[j].empty()) _vm->_gyro->_scroll[j].clear(); } -void Scrolls::natural() { // Natural state of bubbles +void Scrolls::setBubbleStateNatural() { _vm->_gyro->_talkX = 320; _vm->_gyro->_talkY = 200; _vm->_gyro->_talkBackgroundColor = 8; _vm->_gyro->_talkFontColor = 15; } -Common::String Scrolls::lsd() { +Common::String Scrolls::displayMoney() { Common::String x; if (_vm->_gyro->_dna._money < 12) { // just pence @@ -597,7 +597,7 @@ Common::String Scrolls::lsd() { -void Scrolls::strip(Common::String &q) { +void Scrolls::stripTrailingSpaces(Common::String &q) { while (q[q.size() - 1] == ' ') { q.deleteLastChar(); } @@ -613,10 +613,10 @@ void Scrolls::solidify(byte n) { _vm->_gyro->_scroll[n].deleteLastChar(); } while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); - strip(_vm->_gyro->_scroll[n]); + stripTrailingSpaces(_vm->_gyro->_scroll[n]); } -void Scrolls::calldrivers() { +void Scrolls::callScrollDriver() { uint16 fv; byte nn; bool mouthnext; @@ -627,7 +627,7 @@ void Scrolls::calldrivers() { //nosound(); warning("STUB: Scrolls::calldrivers()"); - state(0); + setReadyLight(0); _vm->_gyro->_scReturn = false; mouthnext = false; call_spriterun = true; @@ -650,11 +650,11 @@ void Scrolls::calldrivers() { for (fv = 0; fv < size; fv++) { if (mouthnext) { if (_vm->_gyro->_buffer[fv] == kControlRegister) - param = 0; + _param = 0; else if (('0' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= '9')) - param = _vm->_gyro->_buffer[fv] - 48; + _param = _vm->_gyro->_buffer[fv] - 48; else if (('A' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= 'Z')) - param = _vm->_gyro->_buffer[fv] - 55; + _param = _vm->_gyro->_buffer[fv] - 55; mouthnext = false; } else { @@ -667,9 +667,9 @@ void Scrolls::calldrivers() { _vm->_lucerna->spriteRun(); call_spriterun = false; - drawscroll(&Avalanche::Scrolls::normscroll); + drawScroll(&Avalanche::Scrolls::scrollModeNormal); - resetscroll(); + resetScroll(); if (_vm->_gyro->_scReturn) return; @@ -686,58 +686,58 @@ void Scrolls::calldrivers() { _vm->_lucerna->spriteRun(); call_spriterun = false; - if (param == 0) - natural(); - else if ((1 <= param) && (param <= 9)) { - if ((param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[param - 1].quick)) { // Not valid. + if (_param == 0) + setBubbleStateNatural(); + else if ((1 <= _param) && (_param <= 9)) { + if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[_param - 1].quick)) { // Not valid. _vm->_lucerna->errorLed(); - natural(); + setBubbleStateNatural(); } else - _vm->_animation->tr[param - 1].chatter(); // Normal sprite talking routine. - } else if ((10 <= param) && (param <= 36)) { + _vm->_animation->tr[_param - 1].chatter(); // Normal sprite talking routine. + } else if ((10 <= _param) && (_param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._x; - _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[param - 10]._whichPed - 1]._y; // Position. + _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._x; + _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._y; // Position. - _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[param - 10]._foregroundColor; - _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[param - 10]._backgroundColor; // Colors. + _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; + _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. } else { _vm->_lucerna->errorLed(); // Not valid. - natural(); + setBubbleStateNatural(); } - bubble(&Avalanche::Scrolls::normscroll); + drawBubble(&Avalanche::Scrolls::scrollModeNormal); - resetscroll(); + resetScroll(); if (_vm->_gyro->_scReturn) return; } break; case kControlNegative: - switch (param) { + switch (_param) { case 1: - display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion) + displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: - display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum]._word + kControlToBuffer); + displayText(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum]._word + kControlToBuffer); break; case 3: - display(_vm->_gyro->_dna._favouriteDrink + kControlToBuffer); + displayText(_vm->_gyro->_dna._favouriteDrink + kControlToBuffer); break; case 4: - display(_vm->_gyro->_dna._favouriteSong + kControlToBuffer); + displayText(_vm->_gyro->_dna._favouriteSong + kControlToBuffer); break; case 5: - display(_vm->_gyro->_dna._worstPlaceOnEarth + kControlToBuffer); + displayText(_vm->_gyro->_dna._worstPlaceOnEarth + kControlToBuffer); break; case 6: - display(_vm->_gyro->_dna._spareEvening + kControlToBuffer); + displayText(_vm->_gyro->_dna._spareEvening + kControlToBuffer); break; case 9: - display(_vm->_gyro->intToStr(_vm->_gyro->_dna._catacombX) + ',' + _vm->_gyro->intToStr(_vm->_gyro->_dna._catacombY) + kControlToBuffer); + displayText(_vm->_gyro->intToStr(_vm->_gyro->_dna._catacombX) + ',' + _vm->_gyro->intToStr(_vm->_gyro->_dna._catacombY) + kControlToBuffer); break; case 10: switch (_vm->_gyro->_dna._boxContent) { @@ -750,10 +750,10 @@ void Scrolls::calldrivers() { } break; case Acci::kNothing: - display("nothing at all. It's completely empty."); + displayText("nothing at all. It's completely empty."); break; default: - display(_vm->_gyro->getItem(_vm->_gyro->_dna._boxContent) + '.'); + displayText(_vm->_gyro->getItem(_vm->_gyro->_dna._boxContent) + '.'); } break; case 11: @@ -761,14 +761,14 @@ void Scrolls::calldrivers() { for (byte nnn = 0; nnn < kObjectNum; nnn++) { if (_vm->_gyro->_dna._objects[nnn]) { nn++; - display(_vm->_gyro->getItem(nnn) + ", " + kControlToBuffer); + displayText(_vm->_gyro->getItem(nnn) + ", " + kControlToBuffer); } } break; } break; case kControlIcon: - use_icon = param; + _useIcon = _param; break; case kControlNewLine: _vm->_gyro->_scrollNum++; @@ -781,9 +781,9 @@ void Scrolls::calldrivers() { _vm->_gyro->_scrollNum++; _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion; - drawscroll(&Avalanche::Scrolls::dialogue); + drawScroll(&Avalanche::Scrolls::scrollModeDialogue); - resetscroll(); + resetScroll(); } break; case kControlRegister: @@ -805,13 +805,13 @@ void Scrolls::calldrivers() { } } -void Scrolls::display(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! +void Scrolls::displayText(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! _vm->_gyro->_bufSize = z.size(); memcpy(_vm->_gyro->_buffer, z.c_str(), _vm->_gyro->_bufSize); - calldrivers(); + callScrollDriver(); } -void Scrolls::loadfont() { +void Scrolls::loadFont() { Common::File f; if (!f.open("avalot.fnt")) { @@ -819,7 +819,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(ch[0][i], 16); + f.read(_scrollFonts[0][i], 16); f.close(); if (!f.open("avitalic.fnt")) { @@ -827,7 +827,7 @@ void Scrolls::loadfont() { return; } for (int16 i = 0; i < 256; i++) - f.read(ch[1][i], 16); + f.read(_scrollFonts[1][i], 16); f.close(); if (!f.open("ttsmall.fnt")) { @@ -839,20 +839,16 @@ void Scrolls::loadfont() { f.close(); } -void Scrolls::okay() { - display("Okay!"); -} - -void Scrolls::musical_scroll() { - display(Common::String("To play the harp...") + kControlNewLine + kControlNewLine + "Use these keys:" + + kControlNewLine +void Scrolls::musicalScroll() { + displayText(Common::String("To play the harp...") + kControlNewLine + kControlNewLine + "Use these keys:" + + kControlNewLine + kControlInsertSpaces + "Q W E R T Y U I O P [ ]" + kControlNewLine + kControlNewLine + "Or press Enter to stop playing." + kControlToBuffer); _vm->_lucerna->spriteRun(); - drawscroll(&Avalanche::Scrolls::music_scroll); + drawScroll(&Avalanche::Scrolls::scrollModeMusic); - resetscroll(); + resetScroll(); } } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 3c1efc92ac2f..c043e4a30da5 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -37,115 +37,85 @@ class AvalancheEngine; class Scrolls; -typedef void (Scrolls::*func2)(); +typedef void (Scrolls::*ScrollsFunctionType)(); class Scrolls { public: // Constants to replace the command characters from Pascal. // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers - - static const char kControlSpeechBubble = 2; // ^B - static const char kControlCenter = 3; // ^C - static const char kControlToBuffer = 4; // ^D - static const char kControlItalic = 6; // ^F - static const char kControlBell = 7; // ^G - static const char kControlBackspace = 8; // ^H - static const char kControlInsertSpaces = 9; // ^I - static const char kControlLeftJustified = 12; // ^L - static const char kControlNewLine = 13; // ^M - static const char kControlParagraph = 16; // ^P - static const char kControlQuestion = 17; // ^Q - static const char kControlRoman = 18; // ^R - static const char kControlRegister = 19; // ^S - static const char kControlNegative = 21; // ^U - static const char kControlIcon = 22; // ^V - - - - bool aboutscroll; // Is this the about box? - - + enum ControlCharacter { + kControlSpeechBubble = 2, // ^B + kControlCenter = 3, // ^C + kControlToBuffer = 4, // ^D + kControlItalic = 6, // ^F + kControlBell = 7, // ^G + kControlBackspace = 8, // ^H + kControlInsertSpaces = 9, // ^I + kControlLeftJustified = 12, // ^L + kControlNewLine = 13, // ^M + kControlParagraph = 16, // ^P + kControlQuestion = 17, // ^Q + kControlRoman = 18, // ^R + kControlRegister = 19, // ^S + kControlNegative = 21, // ^U + kControlIcon = 22 // ^V + }; + + bool _aboutScroll; // Is this the about box? + FontType _scrollFonts[2]; Scrolls(AvalancheEngine *vm); void init(); - - void state(byte x); // Sets "Ready" light to whatever - - void drawscroll(func2 gotoit); // This is one of the oldest funcs in the game. - - void bubble(func2 gotoit); - - void resetscroll(); - - void calldrivers(); - - void display(Common::String z); - - bool ask(Common::String question); - - void natural(); - - Common::String lsd(); - - void okay(); // Says "Okay!" - - void musical_scroll(); - - FontType ch[2]; + void setReadyLight(byte x); // Sets "Ready" light to whatever. + void drawScroll(ScrollsFunctionType modeFunc); + void drawBubble(ScrollsFunctionType modeFunc); + void resetScroll(); + void callScrollDriver(); + void displayText(Common::String text); + bool displayQuestion(Common::String question); + void setBubbleStateNatural(); // Natural state of bubbles + Common::String displayMoney(); + void musicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. private: AvalancheEngine *_vm; - static const int16 roman = 0; - static const int16 italic = 1; - - static const int16 halficonwidth = 19; // Half the width of an icon. - + enum FontStyle { + kFontStyleRoman, + kFontStyleItalic + }; + static const int16 kHalfIconWidth = 19; // Half the width of an icon. - int16 dix, diy; + int16 _shadowBoxX, _shadowBoxY; + byte _currentFont; // Current font + Common::Point _dodgeCoord; + byte _param; // For using arguments code + byte _useIcon; - byte cfont; // Current font + // These 3 functions are always passed as ScrollsFunctionType parameters. + void scrollModeNormal(); + void scrollModeDialogue(); + void scrollModeMusic(); - Common::Point dodgeCoord; - byte param; // For using arguments code - - byte use_icon; - - - - void easteregg(); - - void say(int16 x, int16 y, Common::String z); - - void normscroll(); - - void dialogue(); - - void store_(byte what, TuneType &played); - - bool they_match(TuneType &played); - - void music_scroll(); - - void resetscrolldriver(); - - void dingdongbell(); - - void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. - - void undodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. - - void geticon(int16 x, int16 y, byte which); - - void block_drop(Common::String fn, int16 xl, int16 yl, int16 y); - - void strip(Common::String &q); // Strip trailing spaces. + // These 2 are used only in musicalScroll(). + void store(byte what, TuneType &played); + bool theyMatch(TuneType &played); + void stripTrailingSpaces(Common::String &str); // Original: strip. void solidify(byte n); // Does the word wrapping. - void loadfont(); + void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. + void unDodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. + + void easterEgg(); + void say(int16 x, int16 y, Common::String text); + void resetScrollDriver(); + void ringBell(); // Original: dingdongbell + void getIcon(int16 x, int16 y, byte which); + void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. + void loadFont(); }; } // End of namespace Avalanche diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 7ba2136868b6..69f6cce2ac03 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -250,16 +250,16 @@ void Timeout::urinate() { } void Timeout::toilet2() { - _vm->_scrolls->display("That's better!"); + _vm->_scrolls->displayText("That's better!"); } void Timeout::bang() { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); set_up_timer(30, procbang2, reason_explosion); } void Timeout::bang2() { - _vm->_scrolls->display("Hmm... sounds like Spludwick's up to something..."); + _vm->_scrolls->displayText("Hmm... sounds like Spludwick's up to something..."); } void Timeout::stairs() { @@ -352,7 +352,7 @@ void Timeout::after_the_shootemup() { _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! - _vm->_scrolls->display(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); #if 0 @@ -475,7 +475,7 @@ void Timeout::jump() { && (_vm->_animation->infield(3))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_dna._carryNum >= kCarryLimit) - _vm->_scrolls->display("You fail to grab it, because your hands are full."); + _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); else { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. @@ -537,7 +537,7 @@ void Timeout::fall_down_oubliette() { void Timeout::meet_avaroid() { if (_vm->_gyro->_dna._metAvaroid) { - _vm->_scrolls->display(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->displayText(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); _vm->_lucerna->gameOver(); } else { @@ -605,7 +605,7 @@ void Timeout::avvy_sit_down() { } void Timeout::ghost_room_phew() { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman + " You're glad to get out of " + _vm->_scrolls->kControlItalic + "there!"); } @@ -631,7 +631,7 @@ void Timeout::winning() { // TODO: To be implemented with Pingo::winningPic(). _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); - _vm->_scrolls->display(" T H E E N D "); + _vm->_scrolls->displayText(" T H E E N D "); _vm->_gyro->_letMeOut = true; } @@ -646,7 +646,7 @@ void Timeout::avalot_falls() { for (byte i = 0; i < 6; i++) toDisplay += _vm->_scrolls->kControlInsertSpaces; toDisplay = toDisplay + _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; - _vm->_scrolls->display(toDisplay); + _vm->_scrolls->displayText(toDisplay); } } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index f3288ddd768c..c657a4a87a81 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -83,7 +83,7 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { if (report) { Common::String todisplay; todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->intToStr(point).c_str()); - _vm->_scrolls->display(todisplay); + _vm->_scrolls->displayText(todisplay); } return; } @@ -101,7 +101,7 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { if (bubbling) do_the_bubble(); - _vm->_scrolls->calldrivers(); + _vm->_scrolls->callScrollDriver(); } void Visa::speech(byte who, byte subject) { @@ -145,7 +145,7 @@ void Visa::speech(byte who, byte subject) { unskrimble(); do_the_bubble(); - _vm->_scrolls->calldrivers(); + _vm->_scrolls->callScrollDriver(); went_ok = true; } @@ -177,7 +177,7 @@ void Visa::talkto(byte whom) { switch (_vm->_gyro->_dna._givenToSpludwick) { case 1: // Falltrough is intended. case 2:{ - _vm->_scrolls->display(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); return; } break; @@ -254,13 +254,13 @@ void Visa::talkto(byte whom) { no_matches = true; for (fv = 0; fv <= _vm->_animation->kSpriteNumbMax; fv++) if (_vm->_animation->tr[fv]._stat.accinum == whom) { - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); no_matches = false; break; } if (no_matches) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); speech(whom, _vm->_gyro->_subjectNum); From 2f12ac0d719e38b966c2e2123531364212b3d2db Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 14:07:13 -0500 Subject: [PATCH 0862/1332] ZVISION: Fix pixel copying errors in renderRectToWorkingWindow --- engines/zvision/render_manager.cpp | 35 +++++------------------------- engines/zvision/render_manager.h | 2 +- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index f528acfcaceb..7f796451f42e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -82,7 +82,7 @@ void RenderManager::renderBackbufferToScreen() { if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left, _workingWindow.top), _backBuffer.w); } else { - renderRectToWorkingWindow((uint16 *)_workingWindowBuffer.getPixels(), _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h, false); + _backBuffer.copyRectToSurface(_workingWindowBuffer.getPixels(), _workingWindowBuffer.pitch, _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h); } // TODO: Add menu rendering @@ -153,7 +153,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (!subRect.isValidRect() || subRect.isEmpty()) return; - renderRectToWorkingWindow((uint16 *)surface.getBasePtr(subRect.left, subRect.top), destinationX, destinationY, subRect.width(), subRect.height(), wrap); + renderRectToWorkingWindow((uint16 *)surface.getBasePtr(subRect.left, subRect.top), surface.w, destinationX, destinationY, subRect.width(), subRect.height()); } void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { @@ -261,41 +261,18 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: destination.convertToInPlace(_pixelFormat); } -void RenderManager::renderRectToWorkingWindow(uint16 *buffer, int32 destX, int32 destY, int32 width, int32 height, bool wrap) { +void RenderManager::renderRectToWorkingWindow(uint16 *buffer, int32 imageWidth, int32 destX, int32 destY, int32 width, int32 height) { uint32 destOffset = 0; + uint32 sourceOffset = 0; uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); for (int32 y = 0; y < height; y++) { for (int32 x = 0; x < width; x++) { - int32 sourceYIndex = y; - int32 sourceXIndex = x; - - if (wrap) { - while (sourceXIndex >= width) { - sourceXIndex -= width; - } - while (sourceXIndex < 0) { - sourceXIndex += width; - } - - while (sourceYIndex >= height) { - sourceYIndex -= height; - } - while (sourceYIndex < 0) { - sourceYIndex += height; - } - } else { - // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, height - 1); - - // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, width - 1); - } - - workingWindowBufferPtr[destOffset + x] = buffer[sourceYIndex * width + sourceXIndex]; + workingWindowBufferPtr[destOffset + x] = buffer[sourceOffset + x]; } destOffset += _workingWidth; + sourceOffset += imageWidth; } } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index bf44c884e83f..07b2e854aeab 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -189,7 +189,7 @@ class RenderManager { void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); - void renderRectToWorkingWindow(uint16 *buffer, int32 x, int32 y, int32 width, int32 height, bool wrap); + void renderRectToWorkingWindow(uint16 *buffer, int32 x, int32 y, int32 imageWidth, int32 width, int32 height); void moveBackground(int offset); }; From 48745ad197b2986c784bd18c5ae73c569a20b3e9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 14:32:51 -0500 Subject: [PATCH 0863/1332] ZVISION: Add dirty rectangling support for pure image rendering Still need to add support for ResultActions and Controls that directly use OSystem::copyRectToScreen() --- engines/zvision/render_manager.cpp | 27 +++++++++++++++++++++------ engines/zvision/render_manager.h | 3 +++ engines/zvision/render_table.cpp | 17 +++++++++-------- engines/zvision/render_table.h | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7f796451f42e..bd3e73563fbd 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -60,6 +60,10 @@ RenderManager::~RenderManager() { } void RenderManager::update(uint deltaTimeInMillis) { + // Clear the dirty rects from last frame + _workingWindowDirtyRect = Common::Rect(); + _backBufferDirtyRect = Common::Rect(); + // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. if (_backgroundInverseVelocity != 0) { _accumulatedVelocityMilliseconds += deltaTimeInMillis; @@ -78,16 +82,25 @@ void RenderManager::update(uint deltaTimeInMillis) { } void RenderManager::renderBackbufferToScreen() { - RenderTable::RenderState state = _renderTable.getRenderState(); - if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { - _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left, _workingWindow.top), _backBuffer.w); - } else { - _backBuffer.copyRectToSurface(_workingWindowBuffer.getPixels(), _workingWindowBuffer.pitch, _workingWindow.left, _workingWindow.top, _workingWindowBuffer.w, _workingWindowBuffer.h); + if (!_workingWindowDirtyRect.isEmpty()) { + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _renderTable.mutateImage((uint16 *)_workingWindowBuffer.getPixels(), (uint16 *)_backBuffer.getBasePtr(_workingWindow.left + _workingWindowDirtyRect.left, _workingWindow.top + _workingWindowDirtyRect.top), _backBuffer.w, _workingWindowDirtyRect); + } else { + _backBuffer.copyRectToSurface(_workingWindowBuffer.getBasePtr(_workingWindowDirtyRect.left, _workingWindowDirtyRect.top), _workingWindowBuffer.pitch, _workingWindow.left + _workingWindowDirtyRect.left, _workingWindow.top + _workingWindowDirtyRect.top, _workingWindowDirtyRect.width(), _workingWindowDirtyRect.height()); + } + + // Translate the working window dirty rect to screen coords + _workingWindowDirtyRect.translate(_workingWindow.left, _workingWindow.top); + // Then extend the backbuffer dirty rect to contain it + _backBufferDirtyRect.extend(_workingWindowDirtyRect); } // TODO: Add menu rendering - _system->copyRectToScreen(_backBuffer.getPixels(), _backBuffer.pitch, 0, 0, _backBuffer.w, _backBuffer.h); + if (!_backBufferDirtyRect.isEmpty()) { + _system->copyRectToScreen(_backBuffer.getBasePtr(_backBufferDirtyRect.left, _backBufferDirtyRect.top), _backBuffer.pitch, _backBufferDirtyRect.left, _backBufferDirtyRect.top, _backBufferDirtyRect.width(), _backBufferDirtyRect.height()); + } } void RenderManager::clearWorkingWindowTo555Color(uint16 color) { @@ -274,6 +287,8 @@ void RenderManager::renderRectToWorkingWindow(uint16 *buffer, int32 imageWidth, destOffset += _workingWidth; sourceOffset += imageWidth; } + + _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); } const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 07b2e854aeab..fd36ab573089 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -57,6 +57,9 @@ class RenderManager { Graphics::Surface _workingWindowBuffer; Graphics::Surface _backBuffer; + Common::Rect _workingWindowDirtyRect; + Common::Rect _backBufferDirtyRect; + /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _workingWidth; /** Height of the working window. Saved to prevent extraneous calls to _workingWindow.height() */ diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 3e7a86e348db..5eb208eb8c94 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -100,14 +100,15 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth) { - uint32 destColumnOffset = 0; +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect) { + uint32 destOffset = 0; - for (uint32 y = 0; y < _numRows; y++) { - uint32 sourceColumnOffset = y * _numColumns; + for (uint32 y = subRect.top; y < subRect.bottom; y++) { + uint32 sourceOffset = y * _numColumns; - for (uint32 x = 0; x < _numColumns; x++) { - uint32 index = sourceColumnOffset + x; + for (uint32 x = subRect.left; x < subRect.right; x++) { + uint32 normalizedX = x - subRect.left; + uint32 index = sourceOffset + x; // RenderTable only stores offsets from the original coordinates uint32 sourceYIndex = y + _internalBuffer[index].y; @@ -119,10 +120,10 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 d // Clamp the xIndex to the size of the image sourceXIndex = CLIP(sourceXIndex, 0, _numColumns - 1); - destBuffer[destColumnOffset + x] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; + destBuffer[destOffset + normalizedX] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; } - destColumnOffset += destWidth; + destOffset += destWidth; } } diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index ba3c7d2f5d65..7c8e7d6a2df3 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -66,7 +66,7 @@ class RenderTable { const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth); + void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect); void generateRenderTable(); void setPanoramaFoV(float fov); From 347d9706343d894a4cebb471ab293afd5c881060 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 21:37:54 +0200 Subject: [PATCH 0864/1332] AVALANCHE: Fix Clang warnings --- engines/avalanche/lucerna2.cpp | 6 ++---- engines/avalanche/lucerna2.h | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index e56250f15c6d..b51632e4c07f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -49,8 +49,6 @@ namespace Avalanche { -const Common::Point Clock::kCenter(510,183); - Clock::Clock(AvalancheEngine *vm) { _vm = vm; _oldHour = _oldHourAngle = _oldMinute = 17717; @@ -88,14 +86,14 @@ void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte return; } - endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenter.x, kCenter.y, 449 - angle, 450 - angle, length, color); + endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); } void Clock::drawHand(const Common::Point &endPoint, byte color) { if (endPoint.x == 177) return; - _vm->_graphics->_surface.drawLine(kCenter.x, kCenter.y, endPoint.x, endPoint.y, color); + _vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); } void Clock::plotHands() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 2260c46373ff..b7b4acfa1b07 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -43,7 +43,8 @@ class Clock { void update(); private: - static const Common::Point kCenter; + static const int kCenterX = 510; + static const int kCenterY = 183; AvalancheEngine *_vm; From f1e699199b194dcb15f991c6a2a6805f153a985a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 21:38:25 +0200 Subject: [PATCH 0865/1332] AVALANCHE: Some more renaming in Animation --- engines/avalanche/animation.h | 4 ++-- engines/avalanche/avalanche.cpp | 6 +++--- engines/avalanche/timeout2.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 91837f1ab9bb..f94fc2294c30 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -82,8 +82,8 @@ class AnimationType { int16 _oldX[2], _oldY[2]; // last xy coords int8 ix, iy; // amount to move sprite by, each step byte whichsprite; - bool quick, _visible, homing, check_me; - int16 hx, hy; // homing x & y coords + bool quick, _visible, _homing, check_me; + int16 _homingX, _homingY; // homing x & y coords byte count; // counts before changing step byte xs, ys; // x & y speed byte totalnum; // total number of sprites diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 9b04f640a36c..f0f2bc1ea97e 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -311,14 +311,14 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_animation->tr[i].face); sz.syncAsByte(_animation->tr[i].step); sz.syncAsByte(_animation->tr[i]._visible); - sz.syncAsByte(_animation->tr[i].homing); + sz.syncAsByte(_animation->tr[i]._homing); sz.syncAsByte(_animation->tr[i].count); sz.syncAsByte(_animation->tr[i]._info._xWidth); sz.syncAsByte(_animation->tr[i].xs); sz.syncAsByte(_animation->tr[i].ys); sz.syncAsByte(_animation->tr[i].totalnum); - sz.syncAsSint16LE(_animation->tr[i].hx); - sz.syncAsSint16LE(_animation->tr[i].hy); + sz.syncAsSint16LE(_animation->tr[i]._homingX); + sz.syncAsSint16LE(_animation->tr[i]._homingY); sz.syncAsByte(_animation->tr[i].call_eachstep); sz.syncAsByte(_animation->tr[i].eachstep); sz.syncAsByte(_animation->tr[i].vanishifstill); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 69f6cce2ac03..69f85b35a8e3 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -594,7 +594,7 @@ void Timeout::avalot_returns() { void Timeout::avvy_sit_down() { // This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. - if (_vm->_animation->tr[0].homing) // Still walking. + if (_vm->_animation->tr[0]._homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); @@ -651,7 +651,7 @@ void Timeout::avalot_falls() { } void Timeout::spludwick_goes_to_cauldron() { - if (_vm->_animation->tr[1].homing) + if (_vm->_animation->tr[1]._homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); From c158abc3139de4e746e5a1ea09c7cdca0baa93fe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 21:46:01 +0200 Subject: [PATCH 0866/1332] AVALANCHE: Add some missing brackets in Lucerna --- engines/avalanche/lucerna2.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index b51632e4c07f..653d3ca47764 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -117,18 +117,21 @@ Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { } Lucerna::~Lucerna() { - for (byte i = 0; i < 31; i++) - for (byte j = 0; j < 2; j++) + for (byte i = 0; i < 31; i++) { + for (byte j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; } + } + } } void Lucerna::init() { - for (byte i = 0; i < 31; i++) + for (byte i = 0; i < 31; i++) { for (byte j = 0; j < 2; j++) _vm->_gyro->_also[i][j] = 0; + } #if 0 if (_vm->_enhanced->atbios) @@ -188,22 +191,25 @@ void Lucerna::scram(Common::String &str) { } void Lucerna::unScramble() { - for (byte i = 0; i < 31; i++) - for (byte j = 0; j < 2; j++) + for (byte i = 0; i < 31; i++) { + for (byte j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) scram(*_vm->_gyro->_also[i][j]); + } + } scram(_vm->_gyro->_listen); scram(_vm->_gyro->_flags); } void Lucerna::loadAlso(byte num) { - for (byte i = 0; i < 31; i++) - for (byte j = 0; j < 2; j++) + for (byte i = 0; i < 31; i++) { + for (byte j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; } - + } + } Common::String filename; filename = filename.format("also%d.avd", num); if (!file.open(filename)) { @@ -936,9 +942,10 @@ void Lucerna::drawScore() { CursorMan.showMouse(false); - for (byte fv = 0; fv < 3; fv++) + for (byte fv = 0; fv < 3; fv++) { if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[fv]], 250 + (fv + 1) * 15, 177); + } CursorMan.showMouse(true); @@ -1005,11 +1012,13 @@ void Lucerna::refreshObjectList() { _vm->_gyro->_dna._carryNum = 0; if (_vm->_gyro->_thinkThing && !_vm->_gyro->_dna._objects[_vm->_gyro->_thinks - 1]) thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); // you always have money - for (byte i = 0; i < kObjectNum; i++) + + for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { _vm->_gyro->_dna._carryNum++; _vm->_gyro->_objectList[_vm->_gyro->_dna._carryNum] = i + 1; } + } } void Lucerna::guideAvvy(Common::Point cursorPos) { From fcd32da8654c1308f3f77d886b3bc899bf6fd85c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 21:50:37 +0200 Subject: [PATCH 0867/1332] AVALANCHE: Missing file from previous commit --- engines/avalanche/animation.cpp | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 598ae7dfbe6a..2a83e930bedf 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -126,7 +126,7 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { if (spritenum == 1) _tr->newspeed(); // Just for the lights. - homing = false; + _homing = false; ix = 0; iy = 0; step = 0; @@ -205,7 +205,7 @@ void AnimationType::walk() { if (!_tr->_vm->_gyro->_doingSpriteRun) { _oldX[_tr->_vm->_gyro->_cp] = _x; _oldY[_tr->_vm->_gyro->_cp] = _y; - if (homing) + if (_homing) homestep(); _x = _x + ix; _y = _y + iy; @@ -284,27 +284,27 @@ int8 AnimationType::sgn(int16 val) { void AnimationType::walkto(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y)); - hx = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; - hy = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; - homing = true; + _homingX = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; + _homingY = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; + _homing = true; } void AnimationType::stophoming() { - homing = false; + _homing = false; } void AnimationType::homestep() { int16 temp; - if ((hx == _x) && (hy == _y)) { + if ((_homingX == _x) && (_homingY == _y)) { // touching the target stopwalk(); return; } ix = 0; iy = 0; - if (hy != _y) { - temp = hy - _y; + if (_homingY != _y) { + temp = _homingY - _y; if (temp > 4) iy = 4; else if (temp < -4) @@ -312,8 +312,8 @@ void AnimationType::homestep() { else iy = temp; } - if (hx != _x) { - temp = hx - _x; + if (_homingX != _x) { + temp = _homingX - _x; if (temp > 4) ix = 4; else if (temp < -4) @@ -345,7 +345,7 @@ void AnimationType::speed(int8 xx, int8 yy) { void AnimationType::stopwalk() { ix = 0; iy = 0; - homing = false; + _homing = false; } void AnimationType::chatter() { @@ -364,15 +364,15 @@ void AnimationType::set_up_saver(trip_saver_type &v) { v.ix = ix; v.iy = iy; v.visible = _visible; - v.homing = homing; + v.homing = _homing; v.check_me = check_me; v.count = count; v.xw = _info._xWidth; v.xs = xs; v.ys = ys; v.totalnum = totalnum; - v.hx = hx; - v.hy = hy; + v.hx = _homingX; + v.hy = _homingY; v.call_eachstep = call_eachstep; v.eachstep = eachstep; v.vanishifstill = vanishifstill; @@ -387,15 +387,15 @@ void AnimationType::unload_saver(trip_saver_type v) { ix = v.ix; iy = v.iy; _visible = v.visible; - homing = v.homing; + _homing = v.homing; check_me = v.check_me; count = v.count; _info._xWidth = v.xw; xs = v.xs; ys = v.ys; totalnum = v.totalnum; - hx = v.hx; - hy = v.hy; + _homingX = v.hx; + _homingY = v.hy; call_eachstep = v.call_eachstep; eachstep = v.eachstep; vanishifstill = v.vanishifstill; @@ -1163,8 +1163,8 @@ void Animation::getback() { void Animation::follow_avvy_y(byte tripnum) { if (tr[0].face == kDirLeft) return; - if (tr[tripnum].homing) - tr[tripnum].hy = tr[1]._y; + if (tr[tripnum]._homing) + tr[tripnum]._homingY = tr[1]._y; else { if (tr[tripnum]._y < tr[1]._y) tr[tripnum]._y += 1; @@ -1182,7 +1182,7 @@ void Animation::follow_avvy_y(byte tripnum) { } void Animation::back_and_forth(byte tripnum) { - if (!tr[tripnum].homing) { + if (!tr[tripnum]._homing) { if (tr[tripnum].face == kDirRight) tr[tripnum].walkto(4); else @@ -1191,7 +1191,7 @@ void Animation::back_and_forth(byte tripnum) { } void Animation::face_avvy(byte tripnum) { - if (!tr[tripnum].homing) { + if (!tr[tripnum]._homing) { if (tr[0]._x >= tr[tripnum]._x) tr[tripnum].face = kDirRight; else @@ -1200,7 +1200,7 @@ void Animation::face_avvy(byte tripnum) { } void Animation::arrow_procs(byte tripnum) { - if (tr[tripnum].homing) { + if (tr[tripnum]._homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. // This is so if: a) the bottom of the arrow is below Avvy's head, From 6383c7397d221bc77d79351d04afa8c7b7daa007 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 21:51:00 +0200 Subject: [PATCH 0868/1332] AVALANCHE: Fix one more Clang warning --- engines/avalanche/lucerna2.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 653d3ca47764..1170ad32ff65 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -835,26 +835,22 @@ void Lucerna::thinkAbout(byte object, bool type) { _vm->_gyro->setMousePointerWait(); - switch (type) { - case Gyro::kThing: + if (type == Gyro::kThing) { if (!file.open("thinks.avd")) { warning("AVALANCHE: Lucerna: File not found: thinks.avd"); return; } - break; - case Gyro::kPerson: + } else { // Gyro::kPerson if (!file.open("folk.avd")) { warning("AVALANCHE: Lucerna: File not found: folk.avd"); return; } - object = object - 149; + object -= 149; if (object >= 25) object -= 8; if (object == 20) object--; // Last time... - - break; } file.seek(object * picSize + 65); From 5c00d5fe34ea5d8d0d27a9bb559c85a06d7693ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 23:03:27 +0200 Subject: [PATCH 0869/1332] AVALANCHE: More renaming, use int16 for loops based on kSpriteNumbMax --- engines/avalanche/acci2.cpp | 4 +- engines/avalanche/animation.cpp | 338 ++++++++++++++++---------------- engines/avalanche/animation.h | 16 +- engines/avalanche/avalanche.cpp | 22 +-- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/dropdown2.cpp | 8 +- engines/avalanche/gyro2.h | 6 +- engines/avalanche/lucerna2.cpp | 20 +- engines/avalanche/lucerna2.h | 2 +- engines/avalanche/sequence2.cpp | 2 +- engines/avalanche/timeout2.cpp | 26 +-- engines/avalanche/visa2.cpp | 7 +- 12 files changed, 220 insertions(+), 233 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 55f1e13fcd81..370ba87dab9a 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1277,7 +1277,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. - for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->tr[i].quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; @@ -1568,7 +1568,7 @@ void Acci::doThat() { i = 3; else i = 0; - if (_vm->_animation->tr[0].whichsprite != i) { + if (_vm->_animation->tr[0]._id != i) { int16 x = _vm->_animation->tr[0]._x; int16 y = _vm->_animation->tr[0]._y; _vm->_animation->tr[0].done(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 2a83e930bedf..739c884a965f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -96,43 +96,43 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { _stat._bgBubbleCol = inf.readByte(); _stat.accinum = inf.readByte(); - totalnum = 0; // = 1; + _animCount = 0; // = 1; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; for (byte aa = 0; aa < _stat._frameNum; aa++) { - _info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)]; + _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; //getmem(sil[totalnum-1], 11 * (a.yl + 1)); - _info._mani[totalnum] = new ManiType[_info._size - 6]; + _info._mani[_animCount] = new ManiType[_info._size - 6]; //getmem(mani[totalnum-1], a.size - 6); for (fv = 0; fv <= _info._yLength; fv++) - inf.read((*_info._sil[totalnum])[fv], _info._xWidth); + inf.read((*_info._sil[_animCount])[fv], _info._xWidth); //blockread(inf, (*sil[totalnum-1])[fv], xw); - inf.read(*_info._mani[totalnum], _info._size - 6); + inf.read(*_info._mani[_animCount], _info._size - 6); //blockread(inf, *mani[totalnum-1], a.size - 6); - totalnum++; + _animCount++; } - totalnum++; + _animCount++; // on; _x = 0; _y = 0; quick = true; _visible = false; - xs = 3; - ys = 1; + _speedX = 3; + _speedY = 1; if (spritenum == 1) _tr->newspeed(); // Just for the lights. _homing = false; - ix = 0; - iy = 0; + _moveX = 0; + _moveY = 0; step = 0; check_me = do_check; count = 0; - whichsprite = spritenum; + _id = spritenum; vanishifstill = false; call_eachstep = false; @@ -141,22 +141,22 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { void AnimationType::original() { quick = false; - whichsprite = 177; + _id = 177; } void AnimationType::andexor() { - if ((vanishifstill) && (ix == 0) && (iy == 0)) + if ((vanishifstill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = face * _stat.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = _facingDir * _stat.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } void AnimationType::turn(byte whichway) { if (whichway == 8) - face = Animation::kDirUp; + _facingDir = Animation::kDirUp; else - face = whichway; + _facingDir = whichway; } void AnimationType::appear(int16 wx, int16 wy, byte wf) { @@ -166,8 +166,8 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { _oldY[_tr->_vm->_gyro->_cp] = wy; turn(wf); _visible = true; - ix = 0; - iy = 0; + _moveX = 0; + _moveY = 0; } /** @@ -175,8 +175,8 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { * @remarks Originally called 'collision_check' */ bool AnimationType::checkCollision() { - for (byte i = 0; i < _tr->kSpriteNumbMax; i++) { - if (_tr->tr[i].quick && (_tr->tr[i].whichsprite != whichsprite) && + for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) { + if (_tr->tr[i].quick && (_tr->tr[i]._id != _id) && ((_x + _info._xLength) > _tr->tr[i]._x) && (_x < (_tr->tr[i]._x + _tr->tr[i]._info._xLength)) && (_tr->tr[i]._y == _y)) @@ -207,8 +207,8 @@ void AnimationType::walk() { _oldY[_tr->_vm->_gyro->_cp] = _y; if (_homing) homestep(); - _x = _x + ix; - _y = _y + iy; + _x = _x + _moveX; + _y = _y + _moveY; } if (check_me) { @@ -251,7 +251,7 @@ void AnimationType::walk() { if (!_tr->_vm->_gyro->_doingSpriteRun) { count++; - if (((ix != 0) || (iy != 0)) && (count > 1)) { + if (((_moveX != 0) || (_moveY != 0)) && (count > 1)) { step++; if (step == _stat.seq) step = 0; @@ -264,9 +264,9 @@ void AnimationType::bounce() { _x = _oldX[_tr->_vm->_gyro->_cp]; _y = _oldY[_tr->_vm->_gyro->_cp]; if (check_me) - _tr->stopwalking(); + _tr->stopWalking(); else - stopwalk(); + stopWalk(); _tr->_vm->_gyro->_onCanDoPageSwap = false; _tr->_vm->_lucerna->drawDirection(); _tr->_vm->_gyro->_onCanDoPageSwap = true; @@ -298,53 +298,53 @@ void AnimationType::homestep() { if ((_homingX == _x) && (_homingY == _y)) { // touching the target - stopwalk(); + stopWalk(); return; } - ix = 0; - iy = 0; + _moveX = 0; + _moveY = 0; if (_homingY != _y) { temp = _homingY - _y; if (temp > 4) - iy = 4; + _moveY = 4; else if (temp < -4) - iy = -4; + _moveY = -4; else - iy = temp; + _moveY = temp; } if (_homingX != _x) { temp = _homingX - _x; if (temp > 4) - ix = 4; + _moveX = 4; else if (temp < -4) - ix = -4; + _moveX = -4; else - ix = temp; + _moveX = temp; } } void AnimationType::speed(int8 xx, int8 yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) + _moveX = xx; + _moveY = yy; + if ((_moveX == 0) && (_moveY == 0)) return; // no movement - if (ix == 0) { + if (_moveX == 0) { // No horz movement - if (iy < 0) + if (_moveY < 0) turn(_tr->kDirUp); else turn(_tr->kDirDown); } else { - if (ix < 0) + if (_moveX < 0) turn(_tr->kDirLeft); else turn(_tr->kDirRight); } } -void AnimationType::stopwalk() { - ix = 0; - iy = 0; +void AnimationType::stopWalk() { + _moveX = 0; + _moveY = 0; _homing = false; } @@ -356,21 +356,21 @@ void AnimationType::chatter() { } void AnimationType::set_up_saver(trip_saver_type &v) { - v.whichsprite = whichsprite; - v.face = face; + v.whichsprite = _id; + v.face = _facingDir; v.step = step; v.x = _x; v.y = _y; - v.ix = ix; - v.iy = iy; + v.ix = _moveX; + v.iy = _moveY; v.visible = _visible; v.homing = _homing; v.check_me = check_me; v.count = count; v.xw = _info._xWidth; - v.xs = xs; - v.ys = ys; - v.totalnum = totalnum; + v.xs = _speedX; + v.ys = _speedY; + v.totalnum = _animCount; v.hx = _homingX; v.hy = _homingY; v.call_eachstep = call_eachstep; @@ -379,21 +379,21 @@ void AnimationType::set_up_saver(trip_saver_type &v) { } void AnimationType::unload_saver(trip_saver_type v) { - whichsprite = v.whichsprite; - face = v.face; + _id = v.whichsprite; + _facingDir = v.face; step = v.step; _x = v.x; _y = v.y; - ix = v.ix; - iy = v.iy; + _moveX = v.ix; + _moveY = v.iy; _visible = v.visible; _homing = v.homing; check_me = v.check_me; count = v.count; _info._xWidth = v.xw; - xs = v.xs; - ys = v.ys; - totalnum = v.totalnum; + _speedX = v.xs; + _speedY = v.ys; + _animCount = v.totalnum; _homingX = v.hx; _homingY = v.hy; call_eachstep = v.call_eachstep; @@ -418,21 +418,19 @@ void AnimationType::load_data_from_mem(uint16 &where) { } AnimationType *AnimationType::done() { - Common::String xx; - - // nds:=num div seq; - totalnum--; + _animCount--; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte aa = 0; aa < _stat._frameNum; aa++) { - totalnum--; - delete[] _info._mani[totalnum]; - delete[] _info._sil[totalnum]; + for (byte i = 0; i < _stat._frameNum; i++) { + _animCount--; + assert(_animCount >= 0); + delete[] _info._mani[_animCount]; + delete[] _info._sil[_animCount]; } quick = false; - whichsprite = 177; + _id = 177; return this; } @@ -453,11 +451,6 @@ void getsettype::recall(ByteField &r) { numleft--; } - - - - - Animation::Animation(AvalancheEngine *vm) { _vm = vm; @@ -466,15 +459,15 @@ Animation::Animation(AvalancheEngine *vm) { } Animation::~Animation() { - for (byte i = 0; i < kSpriteNumbMax; i++) { + for (int16 i = 0; i < kSpriteNumbMax; i++) { if (tr[i].quick) tr[i].done(); } } void Animation::loadtrip() { - for (int16 gm = 0; gm < kSpriteNumbMax; gm++) - tr[gm].original(); + for (int16 i = 0; i < kSpriteNumbMax; i++) + tr[i].original(); for (uint16 i = 0; i < sizeof(aa); i++) aa[i] = 0; @@ -564,8 +557,8 @@ void Animation::catamove(byte ped) { fliproom(r__lusties, 5); _vm->_scrolls->displayText("Oh no... here we go again..."); _vm->_gyro->_dna._userMovesAvvy = false; - tr[0].iy = 1; - tr[0].ix = 0; + tr[0]._moveY = 1; + tr[0]._moveX = 0; return; } @@ -856,7 +849,7 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_dna._brummieStairs = 1; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); - stopwalking(); + stopWalking(); _vm->_gyro->_dna._userMovesAvvy = false; break; case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. @@ -865,7 +858,7 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicExclaim; _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! - stopwalking(); + stopWalking(); _vm->_visa->dixi('q', 26); _vm->_gyro->_dna._userMovesAvvy = true; break; @@ -876,7 +869,7 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_dna._arrowTriggered = true; apped(2, 4); // The dart starts at ped 4, and... tr[1].walkto(5); // flies to ped 5. - tr[1].face = kDirUp; // Only face. + tr[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ @@ -912,15 +905,15 @@ void Animation::call_special(uint16 which) { break; case 6: // _vm->_gyro->special 6: fall down oubliette. _vm->_gyro->_dna._userMovesAvvy = false; - tr[0].ix = 3; - tr[0].iy = 0; - tr[0].face = kDirRight; + tr[0]._moveX = 3; + tr[0]._moveY = 0; + tr[0]._facingDir = kDirRight; _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - stopwalking(); + stopWalking(); _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); @@ -931,7 +924,7 @@ void Animation::call_special(uint16 which) { if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { _vm->_visa->dixi('q', 63); tr[1].turn(kDirDown); - tr[1].stopwalk(); + tr[1].stopWalk(); tr[1].call_eachstep = false; // Geida _vm->_lucerna->gameOver(); } @@ -1040,14 +1033,14 @@ void Animation::open_the_door(byte whither, byte ped, byte magicnum) { switch (magicnum) { case 14: if (_vm->_gyro->_dna._avvysInTheCupboard) { - hide_in_the_cupboard(); + hideInCupboard(); _vm->_sequence->first_show(8); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); return; } else { apped(1, 6); - tr[0].face = kDirRight; // added by TT 12/3/1995 + tr[0]._facingDir = kDirRight; // added by TT 12/3/1995 _vm->_sequence->first_show(8); _vm->_sequence->then_show(9); } @@ -1070,16 +1063,16 @@ void Animation::newspeed() { const ByteField lightspace = {40, 199, 47, 199}; byte page_; - tr[0].ix = (tr[0].ix / 3) * tr[0].xs; + tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX; //setactivepage(3); - if (tr[0].xs == _vm->_gyro->kRun) + if (tr[0]._speedX == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - if (tr[0].xs == _vm->_gyro->kRun) + if (tr[0]._speedX == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); @@ -1094,28 +1087,28 @@ void Animation::newspeed() { void Animation::rwsp(byte t, byte dir) { switch (dir) { case kDirUp: - tr[t].speed(0, -tr[t].ys); + tr[t].speed(0, -tr[t]._speedY); break; case kDirDown: - tr[t].speed(0, tr[t].ys); + tr[t].speed(0, tr[t]._speedY); break; case kDirLeft: - tr[t].speed(-tr[t].xs, 0); + tr[t].speed(-tr[t]._speedX, 0); break; case kDirRight: - tr[t].speed(tr[t].xs, 0); + tr[t].speed(tr[t]._speedX, 0); break; case kDirUpLeft: - tr[t].speed(-tr[t].xs, -tr[t].ys); + tr[t].speed(-tr[t]._speedX, -tr[t]._speedY); break; case kDirUpRight: - tr[t].speed(tr[t].xs, -tr[t].ys); + tr[t].speed(tr[t]._speedX, -tr[t]._speedY); break; case kDirDownLeft: - tr[t].speed(-tr[t].xs, tr[t].ys); + tr[t].speed(-tr[t]._speedX, tr[t]._speedY); break; case kDirDownRight: - tr[t].speed(tr[t].xs, tr[t].ys); + tr[t].speed(tr[t]._speedX, tr[t]._speedY); break; } } @@ -1161,7 +1154,7 @@ void Animation::getback() { // Eachstep procedures: void Animation::follow_avvy_y(byte tripnum) { - if (tr[0].face == kDirLeft) + if (tr[0]._facingDir == kDirLeft) return; if (tr[tripnum]._homing) tr[tripnum]._homingY = tr[1]._y; @@ -1172,7 +1165,7 @@ void Animation::follow_avvy_y(byte tripnum) { tr[tripnum]._y -= 1; else return; - if (tr[tripnum].ix == 0) { + if (tr[tripnum]._moveX == 0) { tr[tripnum].step += 1; if (tr[tripnum].step == tr[tripnum]._stat.seq) tr[tripnum].step = 0; @@ -1183,7 +1176,7 @@ void Animation::follow_avvy_y(byte tripnum) { void Animation::back_and_forth(byte tripnum) { if (!tr[tripnum]._homing) { - if (tr[tripnum].face == kDirRight) + if (tr[tripnum]._facingDir == kDirRight) tr[tripnum].walkto(4); else tr[tripnum].walkto(5); @@ -1193,9 +1186,9 @@ void Animation::back_and_forth(byte tripnum) { void Animation::face_avvy(byte tripnum) { if (!tr[tripnum]._homing) { if (tr[0]._x >= tr[tripnum]._x) - tr[tripnum].face = kDirRight; + tr[tripnum]._facingDir = kDirRight; else - tr[tripnum].face = kDirLeft; + tr[tripnum]._facingDir = kDirLeft; } } @@ -1259,8 +1252,8 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 toy = tr[0]._y - 1; if ((tr[tripnum]._x == tox) && (tr[tripnum]._y == toy)) { tr[tripnum].call_eachstep = false; - tr[tripnum].face = kDirLeft; - tr[tripnum].stopwalk(); + tr[tripnum]._facingDir = kDirLeft; + tr[tripnum].stopWalk(); // ... whatever ... } else { // Still some way to go. @@ -1278,7 +1271,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. } void Animation::take_a_step(byte &tripnum) { - if (tr[tripnum].ix == 0) { + if (tr[tripnum]._moveX == 0) { tr[tripnum].step++; if (tr[tripnum].step == tr[tripnum]._stat.seq) tr[tripnum].step = 0; @@ -1287,9 +1280,9 @@ void Animation::take_a_step(byte &tripnum) { } void Animation::spin(byte whichway, byte &tripnum) { - if (tr[tripnum].face != whichway) { - tr[tripnum].face = whichway; - if (tr[tripnum].whichsprite == 2) + if (tr[tripnum]._facingDir != whichway) { + tr[tripnum]._facingDir = whichway; + if (tr[tripnum]._id == 2) return; // Not for Spludwick _vm->_gyro->_dna._geidaSpin += 1; @@ -1312,58 +1305,58 @@ void Animation::geida_procs(byte tripnum) { if (tr[tripnum]._y < (tr[0]._y - 2)) { // Geida is further from the screen than Avvy. spin(kDirDown, tripnum); - tr[tripnum].iy = 1; - tr[tripnum].ix = 0; + tr[tripnum]._moveY = 1; + tr[tripnum]._moveX = 0; take_a_step(tripnum); return; } else if (tr[tripnum]._y > (tr[0]._y + 2)) { // Avvy is further from the screen than Geida. spin(kDirUp, tripnum); - tr[tripnum].iy = -1; - tr[tripnum].ix = 0; + tr[tripnum]._moveY = -1; + tr[tripnum]._moveX = 0; take_a_step(tripnum); return; } - tr[tripnum].iy = 0; + tr[tripnum]._moveY = 0; // These 12-s are not in the original, I added them to make the following method more "smooth". // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (tr[tripnum]._x < tr[0]._x - tr[0].xs * 8 - 12) { - tr[tripnum].ix = tr[0].xs; + if (tr[tripnum]._x < tr[0]._x - tr[0]._speedX * 8 - 12) { + tr[tripnum]._moveX = tr[0]._speedX; spin(kDirRight, tripnum); take_a_step(tripnum); - } else if (tr[tripnum]._x > tr[0]._x + tr[0].xs * 8 + 12) { - tr[tripnum].ix = -tr[0].xs; + } else if (tr[tripnum]._x > tr[0]._x + tr[0]._speedX * 8 + 12) { + tr[tripnum]._moveX = -tr[0]._speedX; spin(kDirLeft, tripnum); take_a_step(tripnum); } else - tr[tripnum].ix = 0; + tr[tripnum]._moveX = 0; } // That's all... void Animation::call_andexors() { int8 order[5]; - byte fv, temp; + byte temp; bool ok; for (int i = 0; i < 5; i++) order[i] = -1; - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv]._visible) - order[fv] = fv; + for (int16 i = 0; i < kSpriteNumbMax; i++) { + if (tr[i].quick && tr[i]._visible) + order[i] = i; } do { ok = true; - for (fv = 0; fv < 4; fv++) { - if (((order[fv] != -1) && (order[fv + 1] != -1)) - && (tr[order[fv]]._y > tr[order[fv + 1]]._y)) { + for (byte i = 0; i < 4; i++) { + if (((order[i] != -1) && (order[i + 1] != -1)) + && (tr[order[i]]._y > tr[order[i + 1]]._y)) { // Swap them! - temp = order[fv]; - order[fv] = order[fv + 1]; - order[fv + 1] = temp; + temp = order[i]; + order[i] = order[i + 1]; + order[i + 1] = temp; ok = false; } } @@ -1372,9 +1365,9 @@ void Animation::call_andexors() { _vm->_graphics->refreshBackground(); - for (fv = 0; fv < 5; fv++) { - if (order[fv] > -1) - tr[order[fv]].andexor(); + for (byte i = 0; i < 5; i++) { + if (order[i] > -1) + tr[order[i]].andexor(); } } @@ -1383,38 +1376,36 @@ void Animation::call_andexors() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - byte fv; - if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv]._visible) - tr[fv].walk(); + for (int16 i = 0; i < kSpriteNumbMax; i++) { + if (tr[i].quick && tr[i]._visible) + tr[i].walk(); } call_andexors(); - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].call_eachstep) { - switch (tr[fv].eachstep) { + for (int16 i = 0; i < kSpriteNumbMax; i++) { + if (tr[i].quick && tr[i].call_eachstep) { + switch (tr[i].eachstep) { case kProcFollowAvvyY : - follow_avvy_y(fv); + follow_avvy_y(i); break; case kProcBackAndForth : - back_and_forth(fv); + back_and_forth(i); break; case kProcFaceAvvy : - face_avvy(fv); + face_avvy(i); break; case kProcArrow : - arrow_procs(fv); + arrow_procs(i); break; // PROCSpludwick_procs : spludwick_procs(fv); case kProcGrabAvvy : - grab_avvy(fv); + grab_avvy(i); break; case kProcGeida : - geida_procs(fv); + geida_procs(i); break; } } @@ -1427,10 +1418,8 @@ void Animation::animLink() { } void Animation::get_back_loretta() { - byte fv; - - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick) { + for (int16 i = 0; i < kSpriteNumbMax; i++) { + if (tr[i].quick) { getback(); return; } @@ -1438,8 +1427,8 @@ void Animation::get_back_loretta() { // for fv:=0 to 1 do begin cp:=1-cp; getback; end; } -void Animation::stopwalking() { - tr[0].stopwalk(); +void Animation::stopWalking() { + tr[0].stopWalk(); _vm->_gyro->_dna._direction = kDirStopped; if (_vm->_gyro->_alive) tr[0].step = 1; @@ -1458,7 +1447,11 @@ void Animation::getsetclear() { getset[fv].init(); } -void Animation::hide_in_the_cupboard() { +/** + * Hide in the cupboard + * @remarks Originally called 'hide_in_the_cupboard' + */ +void Animation::hideInCupboard() { if (_vm->_gyro->_dna._avvysInTheCupboard) { if (_vm->_gyro->_dna._wearing == Acci::kNothing) _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); @@ -1484,23 +1477,21 @@ void Animation::hide_in_the_cupboard() { } void Animation::fliproom(byte room, byte ped) { - byte fv; - if (!_vm->_gyro->_alive) { // You can't leave the room if you're dead. - tr[0].ix = 0; - tr[0].iy = 0; // Stop him from moving. + tr[0]._moveX = 0; + tr[0]._moveY = 0; // Stop him from moving. return; } if ((room == 177) && (_vm->_gyro->_dna._room == r__lusties)) { - hide_in_the_cupboard(); + hideInCupboard(); return; } if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { // You can't *jump* out of Cardiff Castle! - tr[0].ix = 0; + tr[0]._moveX = 0; return; } @@ -1508,10 +1499,9 @@ void Animation::fliproom(byte room, byte ped) { _vm->_lucerna->dusk(); getsetclear(); - - for (fv = 1; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick) - tr[fv].done(); + for (int16 i = 1; i < kSpriteNumbMax; i++) { + if (tr[i].quick) + tr[i].done(); } // Deallocate sprite if (_vm->_gyro->_dna._room == r__lustiesroom) @@ -1521,10 +1511,10 @@ void Animation::fliproom(byte room, byte ped) { apped(1, ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; - _vm->_gyro->_dna._direction = tr[0].face; + _vm->_gyro->_dna._direction = tr[0]._facingDir; _vm->_lucerna->drawDirection(); - for (fv = 0; fv <= 1; fv++) { + for (byte i = 0; i <= 1; i++) { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; getback(); } @@ -1577,59 +1567,59 @@ void Animation::handleMoveKey(const Common::Event &event) { _vm->_gyro->_dna._direction = kDirUp; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_DOWN: if (_vm->_gyro->_dna._direction != kDirDown) { _vm->_gyro->_dna._direction = kDirDown; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_LEFT: if (_vm->_gyro->_dna._direction != kDirLeft) { _vm->_gyro->_dna._direction = kDirLeft; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_RIGHT: if (_vm->_gyro->_dna._direction != kDirRight) { _vm->_gyro->_dna._direction = kDirRight; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_PAGEUP: if (_vm->_gyro->_dna._direction != kDirUpRight) { _vm->_gyro->_dna._direction = kDirUpRight; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_PAGEDOWN: if (_vm->_gyro->_dna._direction != kDirDownRight) { _vm->_gyro->_dna._direction = kDirDownRight; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_END: if (_vm->_gyro->_dna._direction != kDirDownLeft) { _vm->_gyro->_dna._direction = kDirDownLeft; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_HOME: if (_vm->_gyro->_dna._direction != kDirUpLeft) { _vm->_gyro->_dna._direction = kDirUpLeft; rwsp(0, _vm->_gyro->_dna._direction); } else - stopwalking(); + stopWalking(); break; case Common::KEYCODE_KP5: - stopwalking(); + stopWalking(); break; default: break; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index f94fc2294c30..5e339346e15e 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -77,16 +77,16 @@ class AnimationType { SpriteInfo _info; adxtype _stat; // vital statistics - byte face, step; + byte _facingDir, step; int16 _x, _y; // current xy coords int16 _oldX[2], _oldY[2]; // last xy coords - int8 ix, iy; // amount to move sprite by, each step - byte whichsprite; + int8 _moveX, _moveY; // amount to move sprite by, each step + byte _id; bool quick, _visible, _homing, check_me; int16 _homingX, _homingY; // homing x & y coords byte count; // counts before changing step - byte xs, ys; // x & y speed - byte totalnum; // total number of sprites + byte _speedX, _speedY; // x & y speed + byte _animCount; // total number of sprites bool vanishifstill; // Do we show this sprite if it's still? bool call_eachstep; // Do we call the eachstep procedure? @@ -104,7 +104,7 @@ class AnimationType { void stophoming(); // self-explanatory void homestep(); // calculates ix & iy for one homing step void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc - void stopwalk(); // Stops the sprite from moving + void stopWalk(); // Stops the sprite from moving void chatter(); // Sets up talk vars void set_up_saver(trip_saver_type &v); void unload_saver(trip_saver_type v); @@ -169,7 +169,7 @@ class Animation { void call_special(uint16 which); void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. void catamove(byte ped); - void stopwalking(); + void stopWalking(); void tripkey(char dir); void rwsp(byte t, byte dir); void apped(byte trn, byte np); @@ -200,7 +200,7 @@ class Animation { byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); byte geida_ped(byte which); void dawndelay(); - void hide_in_the_cupboard(); + void hideInCupboard(); void follow_avvy_y(byte tripnum); void back_and_forth(byte tripnum); void face_avvy(byte tripnum); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f0f2bc1ea97e..50b451a3720c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -282,7 +282,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { + for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { if (_animation->tr[i].quick) spriteNum++; } @@ -290,33 +290,33 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. if (_animation->tr[i].quick) _animation->tr[i].done(); } } for (byte i = 0; i < spriteNum; i++) { - sz.syncAsByte(_animation->tr[i].whichsprite); + sz.syncAsByte(_animation->tr[i]._id); sz.syncAsByte(_animation->tr[i].check_me); if (sz.isLoading()) { _animation->tr[i].quick = true; - _animation->tr[i].init(_animation->tr[i].whichsprite, _animation->tr[i].check_me, _animation); + _animation->tr[i].init(_animation->tr[i]._id, _animation->tr[i].check_me, _animation); } - sz.syncAsByte(_animation->tr[i].ix); - sz.syncAsByte(_animation->tr[i].iy); - sz.syncAsByte(_animation->tr[i].face); + sz.syncAsByte(_animation->tr[i]._moveX); + sz.syncAsByte(_animation->tr[i]._moveY); + sz.syncAsByte(_animation->tr[i]._facingDir); sz.syncAsByte(_animation->tr[i].step); sz.syncAsByte(_animation->tr[i]._visible); sz.syncAsByte(_animation->tr[i]._homing); sz.syncAsByte(_animation->tr[i].count); sz.syncAsByte(_animation->tr[i]._info._xWidth); - sz.syncAsByte(_animation->tr[i].xs); - sz.syncAsByte(_animation->tr[i].ys); - sz.syncAsByte(_animation->tr[i].totalnum); + sz.syncAsByte(_animation->tr[i]._speedX); + sz.syncAsByte(_animation->tr[i]._speedY); + sz.syncAsByte(_animation->tr[i]._animCount); sz.syncAsSint16LE(_animation->tr[i]._homingX); sz.syncAsSint16LE(_animation->tr[i]._homingY); sz.syncAsByte(_animation->tr[i].call_eachstep); @@ -327,7 +327,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsSint16LE(_animation->tr[i]._y); if (sz.isLoading() && _animation->tr[i]._visible) - _animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i].face); + _animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i]._facingDir); } //groi = 177; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 72cb1d61920d..ee805efb70f7 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -163,7 +163,7 @@ void Avalot::setup() { _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->newspeed(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 3c26496ecda5..74d0a2582345 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -460,7 +460,7 @@ void Dropdown::setupMenuAction() { _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->neardoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) + if (_vm->_animation->tr[0]._speedX == _vm->_gyro->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -630,10 +630,10 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); break; case 5: { - if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) - _vm->_animation->tr[0].xs = _vm->_gyro->kRun; + if (_vm->_animation->tr[0]._speedX == _vm->_gyro->kWalk) + _vm->_animation->tr[0]._speedX = _vm->_gyro->kRun; else - _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->newspeed(); } break; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 21ea9da8e5c4..faab64c07066 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -152,13 +152,14 @@ struct DemoType { char _key, _extd; }; +typedef byte TuneType[31]; + struct QuasipedType { byte _whichPed, _foregroundColor, _room, _backgroundColor; uint16 _who; }; -typedef byte TuneType[31]; - +#if 0 struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA. Common::String _qEnidFilename; bool _qSoundFx; @@ -166,7 +167,6 @@ struct Sundry { // Things which must be saved over a backtobootstrap, outside DN bool _qThinkThing; }; -#if 0 struct ednahead { // Edna header // This header starts at byte offset 177 in the .ASG file. char id[9]; // signature diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 1170ad32ff65..94a58fa05db6 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -452,7 +452,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].walkto(5); // Walks up to greet you. } else { _vm->_animation->apped(2, 5); // Starts where he was before. - _vm->_animation->tr[1].face = Animation::kDirLeft; + _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; } _vm->_animation->tr[1].call_eachstep = true; @@ -512,7 +512,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } else { // You've been here before. _vm->_animation->apped(2, 4); // He's standing in your way straight away... - _vm->_animation->tr[1].face = Animation::kDirLeft; + _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; } } } @@ -581,7 +581,7 @@ void Lucerna::enterRoom(byte room, byte ped) { default: { // You've answered SOME of his questions. _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 3); - _vm->_animation->tr[1].face = Animation::kDirRight; + _vm->_animation->tr[1]._facingDir = Animation::kDirRight; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -649,7 +649,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. - if (_vm->_animation->tr[0].whichsprite == 0) // Avvy in his normal clothes + if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. @@ -713,7 +713,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].walkto(4); // Walks up to greet you. } else { _vm->_animation->apped(2, 4); // Starts where she was before. - _vm->_animation->tr[1].face = Animation::kDirLeft; + _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; } _vm->_animation->tr[1].call_eachstep = true; @@ -994,7 +994,7 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { case kColorWhite: case kColorLightcyan: case kColorYellow: // Fall-throughs are intended. - _vm->_animation->stopwalking(); + _vm->_animation->stopWalking(); drawDirection(); break; } @@ -1039,7 +1039,7 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { switch (what) { case 0: - _vm->_animation->stopwalking(); + _vm->_animation->stopWalking(); break; // Clicked on Avvy: no movement. case 1: _vm->_animation->rwsp(0, Animation::kDirLeft); @@ -1128,10 +1128,10 @@ void Lucerna::checkClick() { callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->newspeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_animation->tr[0].xs = _vm->_gyro->kRun; + _vm->_animation->tr[0]._speedX = _vm->_gyro->kRun; _vm->_animation->newspeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); @@ -1174,9 +1174,7 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_dna._direction], 0, 161); - CursorMan.showMouse(true); } diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index b7b4acfa1b07..ad0e4a2a981c 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -101,7 +101,7 @@ class Lucerna { private: AvalancheEngine *_vm; - bool _fxHidden; // Will de used in dust() and dawn(). + bool _fxHidden; // Will de used in dusk() and dawn(). Common::File file; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 8e64dbc7bd2c..f2d4241e8a3c 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -76,7 +76,7 @@ void Sequence::start_to_close() { void Sequence::start_to_open() { _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. - _vm->_animation->stopwalking(); // And they're not moving now. + _vm->_animation->stopWalking(); // And they're not moving now. start_to_close(); // Apart from that, it's the same thing. } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 69f85b35a8e3..2b954907a9c5 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -244,7 +244,7 @@ void Timeout::avaricius_talks() { void Timeout::urinate() { _vm->_animation->tr[0].turn(Animation::kDirUp); - _vm->_animation->stopwalking(); + _vm->_animation->stopWalking(); _vm->_lucerna->drawDirection(); set_up_timer(14, proctoilet2, reason_gototoilet); } @@ -298,8 +298,8 @@ void Timeout::get_tied_up() { _vm->_visa->dixi('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; - _vm->_animation->stopwalking(); - _vm->_animation->tr[1].stopwalk(); + _vm->_animation->stopWalking(); + _vm->_animation->tr[1].stopWalk(); _vm->_animation->tr[1].stophoming(); _vm->_animation->tr[1].call_eachstep = true; _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGrabAvvy; @@ -530,8 +530,8 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; - _vm->_animation->tr[0].iy++; // Increments dx/dy! - _vm->_animation->tr[0]._y += _vm->_animation->tr[0].iy; // Dowwwn we go... + _vm->_animation->tr[0]._moveY++; // Increments dx/dy! + _vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -545,10 +545,10 @@ void Timeout::meet_avaroid() { _vm->_gyro->_dna._metAvaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - _vm->_animation->tr[0].face = Animation::kDirLeft; + _vm->_animation->tr[0]._facingDir = Animation::kDirLeft; _vm->_animation->tr[0]._x = 151; - _vm->_animation->tr[0].ix = -3; - _vm->_animation->tr[0].iy = -5; + _vm->_animation->tr[0]._moveX = -3; + _vm->_animation->tr[0]._moveY = -5; _vm->_gyro->setBackgroundColor(2); } @@ -556,9 +556,9 @@ void Timeout::meet_avaroid() { void Timeout::rise_up_oubliette() { _vm->_animation->tr[0]._visible = true; - _vm->_animation->tr[0].iy++; // Decrements dx/dy! - _vm->_animation->tr[0]._y -= _vm->_animation->tr[0].iy; // Uuuupppp we go... - if (_vm->_animation->tr[0].iy > 0) + _vm->_animation->tr[0]._moveY++; // Decrements dx/dy! + _vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go... + if (_vm->_animation->tr[0]._moveY > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else _vm->_gyro->_dna._userMovesAvvy = true; @@ -568,8 +568,8 @@ void Timeout::robin_hood_and_geida() { _vm->_animation->tr[0].init(7, true, _vm->_animation); _vm->_animation->apped(1, 7); _vm->_animation->tr[0].walkto(6); - _vm->_animation->tr[1].stopwalk(); - _vm->_animation->tr[1].face = Animation::kDirLeft; + _vm->_animation->tr[1].stopWalk(); + _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->_dna._geidaFollows = false; } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index c657a4a87a81..1fd7405563c2 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -153,7 +153,6 @@ void Visa::speech(byte who, byte subject) { } void Visa::talkto(byte whom) { - byte fv; bool no_matches; if (_vm->_acci->_person == _vm->_acci->kPardon) { @@ -252,9 +251,9 @@ void Visa::talkto(byte whom) { whom -= 149; no_matches = true; - for (fv = 0; fv <= _vm->_animation->kSpriteNumbMax; fv++) - if (_vm->_animation->tr[fv]._stat.accinum == whom) { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); + for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) + if (_vm->_animation->tr[i]._stat.accinum == whom) { + _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); no_matches = false; break; } From f59892b45e63fa1db1e9505279d9010071ed1074 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 23:42:34 +0200 Subject: [PATCH 0870/1332] AVALANCHE: More renaming in animation --- engines/avalanche/acci2.cpp | 16 +-- engines/avalanche/animation.cpp | 224 ++++++++++++++++---------------- engines/avalanche/animation.h | 90 ++++++------- engines/avalanche/avalanche.cpp | 24 ++-- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 24 ++-- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/timeout2.cpp | 20 +-- engines/avalanche/visa2.cpp | 2 +- 9 files changed, 203 insertions(+), 201 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 370ba87dab9a..24d74b547095 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -408,7 +408,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->dixi('z', 5); // His closing statement... _vm->_animation->tr[1].walkto(4); // The end of the drawbridge - _vm->_animation->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; break; @@ -937,7 +937,7 @@ void Acci::openDoor() { _vm->_animation->call_special(_vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicOpenDoor: - _vm->_animation->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); + _vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); break; } @@ -1040,7 +1040,7 @@ void Acci::notInOrder() { } void Acci::goToCauldron() { - _vm->_animation->tr[1].call_eachstep = false; // Stops Geida_Procs. + _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); _vm->_animation->tr[1].walkto(2); } @@ -1278,7 +1278,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->tr[i].quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { + if (_vm->_animation->tr[i]._quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } @@ -1703,8 +1703,8 @@ void Acci::doThat() { _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius _vm->_animation->apped(2, 4); _vm->_animation->tr[1].walkto(5); - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcBackAndForth; + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } @@ -1862,8 +1862,8 @@ void Acci::doThat() { _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->incScore(7); _vm->_animation->tr[1].walkto(2); - _vm->_animation->tr[1].vanishifstill = true; - _vm->_animation->tr[1].call_eachstep = false; + _vm->_animation->tr[1]._vanishIfStill = true; + _vm->_animation->tr[1]._callEachStepFl = false; _vm->_gyro->_whereIs[7] = 177; break; default: diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 739c884a965f..a4b129b7362a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -45,18 +45,16 @@ namespace Avalanche { -void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { +void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { _tr = tr; const int32 idshould = -1317732048; - byte fv; - int32 id; - Common::File inf; if (spritenum == 177) return; // Already running! Common::String filename; + Common::File inf; filename = filename.format("sprite%d.avd", spritenum); if (!inf.open(filename)) { warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); @@ -65,7 +63,7 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { inf.seek(177); - id = inf.readSint32LE(); + int32 id = inf.readSint32LE(); if (id != idshould) { //output << '\7'; inf.close(); @@ -100,14 +98,13 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte aa = 0; aa < _stat._frameNum; aa++) { - + for (byte i = 0; i < _stat._frameNum; i++) { _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; //getmem(sil[totalnum-1], 11 * (a.yl + 1)); _info._mani[_animCount] = new ManiType[_info._size - 6]; //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= _info._yLength; fv++) - inf.read((*_info._sil[_animCount])[fv], _info._xWidth); + for (byte j = 0; j <= _info._yLength; j++) + inf.read((*_info._sil[_animCount])[j], _info._xWidth); //blockread(inf, (*sil[totalnum-1])[fv], xw); inf.read(*_info._mani[_animCount], _info._size - 6); //blockread(inf, *mani[totalnum-1], a.size - 6); @@ -119,7 +116,7 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { // on; _x = 0; _y = 0; - quick = true; + _quick = true; _visible = false; _speedX = 3; _speedY = 1; @@ -129,25 +126,25 @@ void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { _homing = false; _moveX = 0; _moveY = 0; - step = 0; - check_me = do_check; - count = 0; + _stepNum = 0; + _doCheck = doCheck; + _count = 0; _id = spritenum; - vanishifstill = false; - call_eachstep = false; + _vanishIfStill = false; + _callEachStepFl = false; inf.close(); } void AnimationType::original() { - quick = false; + _quick = false; _id = 177; } void AnimationType::andexor() { - if ((vanishifstill) && (_moveX == 0) && (_moveY == 0)) + if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = _facingDir * _stat.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = _facingDir * _stat.seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } @@ -176,7 +173,7 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { */ bool AnimationType::checkCollision() { for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) { - if (_tr->tr[i].quick && (_tr->tr[i]._id != _id) && + if (_tr->tr[i]._quick && (_tr->tr[i]._id != _id) && ((_x + _info._xLength) > _tr->tr[i]._x) && (_x < (_tr->tr[i]._x + _tr->tr[i]._info._xLength)) && (_tr->tr[i]._y == _y)) @@ -211,7 +208,7 @@ void AnimationType::walk() { _y = _y + _moveY; } - if (check_me) { + if (_doCheck) { if (checkCollision()) { bounce(); return; @@ -243,19 +240,19 @@ void AnimationType::walk() { _tr->call_special(_tr->_vm->_gyro->_magics[tc]._data); break; case Gyro::kMagicOpenDoor: - _tr->open_the_door(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); + _tr->openDoor(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); break; } } } if (!_tr->_vm->_gyro->_doingSpriteRun) { - count++; - if (((_moveX != 0) || (_moveY != 0)) && (count > 1)) { - step++; - if (step == _stat.seq) - step = 0; - count = 0; + _count++; + if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { + _stepNum++; + if (_stepNum == _stat.seq) + _stepNum = 0; + _count = 0; } } } @@ -263,7 +260,7 @@ void AnimationType::walk() { void AnimationType::bounce() { _x = _oldX[_tr->_vm->_gyro->_cp]; _y = _oldY[_tr->_vm->_gyro->_cp]; - if (check_me) + if (_doCheck) _tr->stopWalking(); else stopWalk(); @@ -355,50 +352,54 @@ void AnimationType::chatter() { _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; } -void AnimationType::set_up_saver(trip_saver_type &v) { - v.whichsprite = _id; - v.face = _facingDir; - v.step = step; - v.x = _x; - v.y = _y; - v.ix = _moveX; - v.iy = _moveY; - v.visible = _visible; - v.homing = _homing; - v.check_me = check_me; - v.count = count; - v.xw = _info._xWidth; - v.xs = _speedX; - v.ys = _speedY; - v.totalnum = _animCount; - v.hx = _homingX; - v.hy = _homingY; - v.call_eachstep = call_eachstep; - v.eachstep = eachstep; - v.vanishifstill = vanishifstill; +/** + * Init Saver structure + * @remarks Originally called 'set_up_saver' + */ +void AnimationType::setupSaver(AnimationSaver &sav) { + sav._id = _id; + sav._facingDir = _facingDir; + sav._stepNum = _stepNum; + sav._x = _x; + sav._y = _y; + sav._moveX = _moveX; + sav._moveY = _moveY; + sav._visible = _visible; + sav._homing = _homing; + sav._doCheck = _doCheck; + sav._count = _count; + sav._xWidth = _info._xWidth; + sav._speedX = _speedX; + sav._speedY = _speedY; + sav._animCount = _animCount; + sav._homingX = _homingX; + sav._homingY = _homingY; + sav._callEachStepFl = _callEachStepFl; + sav._eachStepProc = _eachStepProc; + sav._vanishIfStill = _vanishIfStill; } -void AnimationType::unload_saver(trip_saver_type v) { - _id = v.whichsprite; - _facingDir = v.face; - step = v.step; - _x = v.x; - _y = v.y; - _moveX = v.ix; - _moveY = v.iy; - _visible = v.visible; - _homing = v.homing; - check_me = v.check_me; - count = v.count; - _info._xWidth = v.xw; - _speedX = v.xs; - _speedY = v.ys; - _animCount = v.totalnum; - _homingX = v.hx; - _homingY = v.hy; - call_eachstep = v.call_eachstep; - eachstep = v.eachstep; - vanishifstill = v.vanishifstill; +void AnimationType::unload_saver(AnimationSaver sav) { + _id = sav._id; + _facingDir = sav._facingDir; + _stepNum = sav._stepNum; + _x = sav._x; + _y = sav._y; + _moveX = sav._moveX; + _moveY = sav._moveY; + _visible = sav._visible; + _homing = sav._homing; + _doCheck = sav._doCheck; + _count = sav._count; + _info._xWidth = sav._xWidth; + _speedX = sav._speedX; + _speedY = sav._speedY; + _animCount = sav._animCount; + _homingX = sav._homingX; + _homingY = sav._homingY; + _callEachStepFl = sav._callEachStepFl; + _eachStepProc = sav._eachStepProc; + _vanishIfStill = sav._vanishIfStill; } void AnimationType::savedata(Common::File &f) { @@ -429,7 +430,7 @@ AnimationType *AnimationType::done() { delete[] _info._sil[_animCount]; } - quick = false; + _quick = false; _id = 177; return this; } @@ -460,7 +461,7 @@ Animation::Animation(AvalancheEngine *vm) { Animation::~Animation() { for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick) + if (tr[i]._quick) tr[i].done(); } } @@ -827,11 +828,11 @@ void Animation::catamove(byte ped) { } if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { - if (!tr[1].quick) // If we don't already have her... + if (!tr[1]._quick) // If we don't already have her... tr[1].init(5, true, this); // ...Load Geida. apped(2, geida_ped(ped)); - tr[1].call_eachstep = true; - tr[1].eachstep = kProcGeida; + tr[1]._callEachStepFl = true; + tr[1]._eachStepProc = kProcGeida; } } @@ -875,8 +876,8 @@ void Animation::call_special(uint16 which) { // graphic of the arrow buried in the plaster. */ // OK! - tr[1].call_eachstep = true; - tr[1].eachstep = kProcArrow; + tr[1]._callEachStepFl = true; + tr[1]._eachStepProc = kProcArrow; } break; case 4: // This is the ghost room link. @@ -897,8 +898,8 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_dna._tiedUp = true; _vm->_gyro->_dna._friarWillTieYouUp = false; tr[1].walkto(3); - tr[1].vanishifstill = true; - tr[1].check_me = true; // One of them must have Check_Me switched on. + tr[1]._vanishIfStill = true; + tr[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } @@ -925,14 +926,14 @@ void Animation::call_special(uint16 which) { _vm->_visa->dixi('q', 63); tr[1].turn(kDirDown); tr[1].stopWalk(); - tr[1].call_eachstep = false; // Geida + tr[1]._callEachStepFl = false; // Geida _vm->_lucerna->gameOver(); } break; case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... if (!_vm->_gyro->_dna._geidaFollows) return; // DOESN'T COUNT: no Geida. - tr[1].call_eachstep = false; // She no longer follows Avvy around. + tr[1]._callEachStepFl = false; // She no longer follows Avvy around. tr[1].walkto(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; @@ -999,12 +1000,14 @@ void Animation::call_special(uint16 which) { } } - - -void Animation::open_the_door(byte whither, byte ped, byte magicnum) { -// This slides the door open. (The data really ought to be saved in -// the Also file, and will be next time. However, for now, they're -// here.) +/** + * Open the Door. + * This slides the door open. The data really ought to be saved in + * the Also file, and will be next time. However, for now, they're + * here. + * @remarks Originally called 'open_the_door' + */ +void Animation::openDoor(byte whither, byte ped, byte magicnum) { switch (_vm->_gyro->_dna._room) { case r__outsideyours: case r__outsidenottspub: @@ -1059,9 +1062,8 @@ void Animation::open_the_door(byte whither, byte ped, byte magicnum) { } void Animation::newspeed() { - // Given that you've just changed the speed in triptype.xs, this adjusts ix. + // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. const ByteField lightspace = {40, 199, 47, 199}; - byte page_; tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX; @@ -1079,8 +1081,8 @@ void Animation::newspeed() { //setactivepage(1 - cp); - for (page_ = 0; page_ <= 1; page_++) - getset[page_].remember(lightspace); + for (byte i = 0; i <= 1; i++) + getset[i].remember(lightspace); } @@ -1166,10 +1168,10 @@ void Animation::follow_avvy_y(byte tripnum) { else return; if (tr[tripnum]._moveX == 0) { - tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum]._stat.seq) - tr[tripnum].step = 0; - tr[tripnum].count = 0; + tr[tripnum]._stepNum += 1; + if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + tr[tripnum]._stepNum = 0; + tr[tripnum]._count = 0; } } } @@ -1204,7 +1206,7 @@ void Animation::arrow_procs(byte tripnum) { && ((tr[tripnum]._x + tr[tripnum]._info._xLength) >= tr[0]._x)) { // C // OK, it's hit him... what now? - tr[1].call_eachstep = false; // prevent recursion. + tr[1]._callEachStepFl = false; // prevent recursion. _vm->_visa->dixi('Q', 47); // Complaint! tr[tripnum].done(); // Deallocate the arrow. #if 0 @@ -1251,7 +1253,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 tox = tr[0]._x + 17; int16 toy = tr[0]._y - 1; if ((tr[tripnum]._x == tox) && (tr[tripnum]._y == toy)) { - tr[tripnum].call_eachstep = false; + tr[tripnum]._callEachStepFl = false; tr[tripnum]._facingDir = kDirLeft; tr[tripnum].stopWalk(); // ... whatever ... @@ -1264,18 +1266,18 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. } if (tr[tripnum]._y < toy) tr[tripnum]._y++; - tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum]._stat.seq) - tr[tripnum].step = 0; + tr[tripnum]._stepNum++; + if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + tr[tripnum]._stepNum = 0; } } void Animation::take_a_step(byte &tripnum) { if (tr[tripnum]._moveX == 0) { - tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum]._stat.seq) - tr[tripnum].step = 0; - tr[tripnum].count = 0; + tr[tripnum]._stepNum++; + if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + tr[tripnum]._stepNum = 0; + tr[tripnum]._count = 0; } } @@ -1344,7 +1346,7 @@ void Animation::call_andexors() { order[i] = -1; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick && tr[i]._visible) + if (tr[i]._quick && tr[i]._visible) order[i] = i; } @@ -1379,15 +1381,15 @@ void Animation::animLink() { if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick && tr[i]._visible) + if (tr[i]._quick && tr[i]._visible) tr[i].walk(); } call_andexors(); for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick && tr[i].call_eachstep) { - switch (tr[i].eachstep) { + if (tr[i]._quick && tr[i]._callEachStepFl) { + switch (tr[i]._eachStepProc) { case kProcFollowAvvyY : follow_avvy_y(i); break; @@ -1419,7 +1421,7 @@ void Animation::animLink() { void Animation::get_back_loretta() { for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick) { + if (tr[i]._quick) { getback(); return; } @@ -1431,7 +1433,7 @@ void Animation::stopWalking() { tr[0].stopWalk(); _vm->_gyro->_dna._direction = kDirStopped; if (_vm->_gyro->_alive) - tr[0].step = 1; + tr[0]._stepNum = 1; } void Animation::tripkey(char dir) { @@ -1500,7 +1502,7 @@ void Animation::fliproom(byte room, byte ped) { getsetclear(); for (int16 i = 1; i < kSpriteNumbMax; i++) { - if (tr[i].quick) + if (tr[i]._quick) tr[i].done(); } // Deallocate sprite diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 5e339346e15e..72c86a48de5c 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -49,25 +49,25 @@ struct adxtype { // Second revision of ADX type byte accinum; // the number according to Acci (1=Avvy, etc.) }; -struct trip_saver_type { - byte whichsprite; - byte face; - byte step; - int16 x; - int16 y; - int8 ix; - int8 iy; - bool visible; - bool homing; - bool check_me; - byte count; - byte xw, xs, ys; - byte totalnum; - int16 hx; - int16 hy; - bool call_eachstep; - byte eachstep; - bool vanishifstill; +struct AnimationSaver { + byte _id; + byte _facingDir; + byte _stepNum; + int16 _x; + int16 _y; + int8 _moveX; + int8 _moveY; + bool _visible; + bool _homing; + bool _doCheck; + byte _count; + byte _xWidth, _speedX, _speedY; + byte _animCount; + int16 _homingX; + int16 _homingY; + bool _callEachStepFl; + byte _eachStepProc; + bool _vanishIfStill; }; class Animation; @@ -77,22 +77,22 @@ class AnimationType { SpriteInfo _info; adxtype _stat; // vital statistics - byte _facingDir, step; + byte _facingDir, _stepNum; int16 _x, _y; // current xy coords int16 _oldX[2], _oldY[2]; // last xy coords int8 _moveX, _moveY; // amount to move sprite by, each step byte _id; - bool quick, _visible, _homing, check_me; + bool _quick, _visible, _homing, _doCheck; int16 _homingX, _homingY; // homing x & y coords - byte count; // counts before changing step + byte _count; // counts before changing step byte _speedX, _speedY; // x & y speed byte _animCount; // total number of sprites - bool vanishifstill; // Do we show this sprite if it's still? + bool _vanishIfStill; // Do we show this sprite if it's still? - bool call_eachstep; // Do we call the eachstep procedure? - byte eachstep; + bool _callEachStepFl; // Do we call the eachstep procedure? + byte _eachStepProc; - void init(byte spritenum, bool do_check, Animation *tr); + void init(byte spritenum, bool doCheck, Animation *tr); // loads & sets up the sprite void original(); // just sets Quick to false void andexor(); // drops sprite onto screen @@ -106,8 +106,8 @@ class AnimationType { void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc void stopWalk(); // Stops the sprite from moving void chatter(); // Sets up talk vars - void set_up_saver(trip_saver_type &v); - void unload_saver(trip_saver_type v); + void setupSaver(AnimationSaver &sav); + void unload_saver(AnimationSaver sav); void savedata(Common::File &f); // Self-explanatory, void loaddata(Common::File &f); // really. @@ -140,25 +140,25 @@ class Animation { friend class AnimationType; friend class getsettype; - static const int16 kDirUp = 0; - static const int16 kDirRight = 1; - static const int16 kDirDown = 2; - static const int16 kDirLeft = 3; - static const int16 kDirUpRight = 4; - static const int16 kDirDownRight = 5; - static const int16 kDirDownLeft = 6; - static const int16 kDirUpLeft = 7; - static const int16 kDirStopped = 8; + static const byte kDirUp = 0; + static const byte kDirRight = 1; + static const byte kDirDown = 2; + static const byte kDirLeft = 3; + static const byte kDirUpRight = 4; + static const byte kDirDownRight = 5; + static const byte kDirDownLeft = 6; + static const byte kDirUpLeft = 7; + static const byte kDirStopped = 8; static const int16 kSpriteNumbMax = 5; // current max no. of sprites - static const int16 kProcFollowAvvyY = 1; - static const int16 kProcBackAndForth = 2; - static const int16 kProcFaceAvvy = 3; - static const int16 kProcArrow = 4; - static const int16 kProcsPludwick = 5; // Unused - static const int16 kProcGrabAvvy = 6; - static const int16 kProcGeida = 7; + static const byte kProcFollowAvvyY = 1; + static const byte kProcBackAndForth = 2; + static const byte kProcFaceAvvy = 3; + static const byte kProcArrow = 4; + static const byte kProcsPludwick = 5; // Unused + static const byte kProcGrabAvvy = 6; + static const byte kProcGeida = 7; Animation(AvalancheEngine *vm); ~Animation(); @@ -167,7 +167,7 @@ class Animation { void get_back_loretta(); void loadtrip(); void call_special(uint16 which); - void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. + void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. void catamove(byte ped); void stopWalking(); void tripkey(char dir); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 50b451a3720c..7462268714ea 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -283,7 +283,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { - if (_animation->tr[i].quick) + if (_animation->tr[i]._quick) spriteNum++; } } @@ -291,37 +291,37 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { if (sz.isLoading()) { for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. - if (_animation->tr[i].quick) + if (_animation->tr[i]._quick) _animation->tr[i].done(); } } for (byte i = 0; i < spriteNum; i++) { sz.syncAsByte(_animation->tr[i]._id); - sz.syncAsByte(_animation->tr[i].check_me); + sz.syncAsByte(_animation->tr[i]._doCheck); if (sz.isLoading()) { - _animation->tr[i].quick = true; - _animation->tr[i].init(_animation->tr[i]._id, _animation->tr[i].check_me, _animation); + _animation->tr[i]._quick = true; + _animation->tr[i].init(_animation->tr[i]._id, _animation->tr[i]._doCheck, _animation); } sz.syncAsByte(_animation->tr[i]._moveX); sz.syncAsByte(_animation->tr[i]._moveY); sz.syncAsByte(_animation->tr[i]._facingDir); - sz.syncAsByte(_animation->tr[i].step); + sz.syncAsByte(_animation->tr[i]._stepNum); sz.syncAsByte(_animation->tr[i]._visible); sz.syncAsByte(_animation->tr[i]._homing); - sz.syncAsByte(_animation->tr[i].count); + sz.syncAsByte(_animation->tr[i]._count); sz.syncAsByte(_animation->tr[i]._info._xWidth); sz.syncAsByte(_animation->tr[i]._speedX); sz.syncAsByte(_animation->tr[i]._speedY); sz.syncAsByte(_animation->tr[i]._animCount); sz.syncAsSint16LE(_animation->tr[i]._homingX); sz.syncAsSint16LE(_animation->tr[i]._homingY); - sz.syncAsByte(_animation->tr[i].call_eachstep); - sz.syncAsByte(_animation->tr[i].eachstep); - sz.syncAsByte(_animation->tr[i].vanishifstill); + sz.syncAsByte(_animation->tr[i]._callEachStepFl); + sz.syncAsByte(_animation->tr[i]._eachStepProc); + sz.syncAsByte(_animation->tr[i]._vanishIfStill); sz.syncAsSint16LE(_animation->tr[i]._x); sz.syncAsSint16LE(_animation->tr[i]._y); @@ -484,14 +484,14 @@ bool AvalancheEngine::loadGame(const int16 slot) { + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); - if (_animation->tr[0].quick && _animation->tr[0]._visible) + if (_animation->tr[0]._quick && _animation->tr[0]._visible) _animation->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. return true; } Common::String AvalancheEngine::expandDate(int d, int m, int y) { - const Common::String months[12] = { + static const Common::String months[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 6fa91cf87fe3..f7e917ed8875 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -228,7 +228,7 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { - if (_vm->_animation->tr[i].quick) + if (_vm->_animation->tr[i]._quick) _vm->_animation->tr[i].done(); } // Deallocate sprite. Sorry, beta testers! diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 94a58fa05db6..3464a7c9f4bf 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -402,8 +402,8 @@ void Lucerna::putGeidaAt(byte whichPed, byte &ped) { return; _vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida _vm->_animation->apped(2, whichPed); - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGeida; + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida; } void Lucerna::enterRoom(byte room, byte ped) { @@ -455,8 +455,8 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; } - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; @@ -487,8 +487,8 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGeida; + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -502,8 +502,8 @@ void Lucerna::enterRoom(byte room, byte ped) { } else { if (ped > 0) { _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFollowAvvyY; + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... @@ -524,7 +524,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->apped(2, 1); _vm->_animation->tr[1].walkto(2); - _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); @@ -716,8 +716,8 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; } - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. break; case r__insidecardiffcastle: @@ -1187,7 +1187,7 @@ void Lucerna::gameOver() { _vm->_animation->tr[0].done(); _vm->_animation->tr[0].init(12, true, _vm->_animation); // 12 = Avalot falls - _vm->_animation->tr[0].step = 0; + _vm->_animation->tr[0]._stepNum = 0; _vm->_animation->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 444762b275f8..5e41ab27c284 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -689,7 +689,7 @@ void Scrolls::callScrollDriver() { if (_param == 0) setBubbleStateNatural(); else if ((1 <= _param) && (_param <= 9)) { - if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[_param - 1].quick)) { // Not valid. + if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[_param - 1]._quick)) { // Not valid. _vm->_lucerna->errorLed(); setBubbleStateNatural(); } else diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 2b954907a9c5..842a7dca6efb 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -301,8 +301,8 @@ void Timeout::get_tied_up() { _vm->_animation->stopWalking(); _vm->_animation->tr[1].stopWalk(); _vm->_animation->tr[1].stophoming(); - _vm->_animation->tr[1].call_eachstep = true; - _vm->_animation->tr[1].eachstep = _vm->_animation->kProcGrabAvvy; + _vm->_animation->tr[1]._callEachStepFl = true; + _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } @@ -314,7 +314,7 @@ void Timeout::get_tied_up2() { } void Timeout::hang_around() { - _vm->_animation->tr[1].check_me = false; + _vm->_animation->tr[1]._doCheck = false; _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; _vm->_animation->apped(1, 2); @@ -325,7 +325,7 @@ void Timeout::hang_around() { void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); - _vm->_animation->tr[1].vanishifstill = false; + _vm->_animation->tr[1]._vanishIfStill = false; _vm->_animation->tr[1].walkto(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->dixi('q', 41); @@ -430,7 +430,7 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your void Timeout::naughty_duke2() { _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" _vm->_animation->tr[1].walkto(1); // Walk to the door. - _vm->_animation->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -578,8 +578,8 @@ void Timeout::robin_hood_and_geida_talk() { _vm->_visa->dixi('q', 66); _vm->_animation->tr[0].walkto(2); _vm->_animation->tr[1].walkto(2); - _vm->_animation->tr[0].vanishifstill = true; - _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[0]._vanishIfStill = true; + _vm->_animation->tr[1]._vanishIfStill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } @@ -636,8 +636,8 @@ void Timeout::winning() { } void Timeout::avalot_falls() { - if (_vm->_animation->tr[0].step < 5) { - _vm->_animation->tr[0].step++; + if (_vm->_animation->tr[0]._stepNum < 5) { + _vm->_animation->tr[0]._stepNum++; set_up_timer(3, procavalot_falls, reason_falling_over); } else { Common::String toDisplay; @@ -658,7 +658,7 @@ void Timeout::spludwick_goes_to_cauldron() { } void Timeout::spludwick_leaves_cauldron() { - _vm->_animation->tr[1].call_eachstep = true; // So that normal procs will continue. + _vm->_animation->tr[1]._callEachStepFl = true; // So that normal procs will continue. } void Timeout::give_lute_to_geida() { // Moved here from Acci. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 1fd7405563c2..66f1faf4c86f 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -274,7 +274,7 @@ void Visa::talkto(byte whom) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. - _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1]._vanishIfStill = true; _vm->_animation->tr[1].walkto(3); // Walks away. _vm->_lucerna->incScore(2); From d2b554ab419f7ed088dd52e64759329a408b4968 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 7 Sep 2013 23:48:48 +0200 Subject: [PATCH 0871/1332] AVALANCHE: More renaming in Lucerna. Fix accidentally modified strings in Acci. --- engines/avalanche/acci2.cpp | 8 +- engines/avalanche/scrolls2.cpp | 255 +++++++++++++++------------------ engines/avalanche/scrolls2.h | 2 +- 3 files changed, 118 insertions(+), 147 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 370ba87dab9a..5fa2992b8d3f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -599,7 +599,7 @@ void Acci::parse() { } if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); + _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea what \"") + _unknown + "\" means. Can you rephrase it?"); _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -1548,7 +1548,7 @@ void Acci::doThat() { switch (_thing) { case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->displayText("Hey, kWhat kind of a weirdo are you\?\?!"); + _vm->_scrolls->displayText("Hey, what kind of a weirdo are you\?\?!"); break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! @@ -1934,7 +1934,7 @@ void Acci::doThat() { _vm->_visa->dixi('U', 5); // You WHAT? } } else if ((150 <= _person) && (_person <= 174)) - _vm->_scrolls->displayText("Hey, kWhat kind of a weirdo are you??"); + _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); break; case kVerbCodeClimb: @@ -2002,7 +2002,7 @@ void Acci::doThat() { } break; case kPardon: - _vm->_scrolls->displayText("Hey, a _verb would be helpful!"); + _vm->_scrolls->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: personSpeaks(); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 444762b275f8..8c88675e68b9 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -40,8 +40,6 @@ #include "common/textconsole.h" #include "common/file.h" -//#include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... - namespace Avalanche { Scrolls::Scrolls(AvalancheEngine *vm) { @@ -53,12 +51,12 @@ void Scrolls::init() { resetScrollDriver(); } -void Scrolls::setReadyLight(byte x) { // Sets "Ready" light to whatever - if (_vm->_gyro->_ledStatus == x) +void Scrolls::setReadyLight(byte state) { // Sets "Ready" light to whatever + if (_vm->_gyro->_ledStatus == state) return; // Already like that! byte color = kColorBlack; - switch (x) { + switch (state) { case 0: color = kColorBlack; break; // Off @@ -75,14 +73,14 @@ void Scrolls::setReadyLight(byte x) { // Sets "Ready" light to whatever _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); - _vm->_gyro->_ledStatus = x; + _vm->_gyro->_ledStatus = state; } void Scrolls::easterEgg() { - warning("STUB: Scrolls::easteregg()"); + warning("STUB: Scrolls::easterEgg()"); } -void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwriting +void Scrolls::say(int16 x, int16 y, Common::String z) { FontType itw; byte lz = z.size(); @@ -113,8 +111,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwrit } } -// Here are the procedures that Scroll calls. So they must be... $F+*/ - void Scrolls::scrollModeNormal() { Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; Common::String e = "(c) 1994"; @@ -124,8 +120,6 @@ void Scrolls::scrollModeNormal() { CursorMan.showMouse(true); _vm->_gyro->newMouse(4); - - ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! @@ -143,8 +137,6 @@ void Scrolls::scrollModeNormal() { _vm->_graphics->_surface.copyFrom(temp); temp.free(); - - #if 0 char r; bool oktoexit; @@ -187,28 +179,23 @@ void Scrolls::scrollModeNormal() { CursorMan.showMouse(false); _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). - warning("STUB: Scrolls::normscroll()"); + warning("STUB: Scrolls::scrollModeNormal()"); } void Scrolls::scrollModeDialogue() { - warning("STUB: Scrolls::dialogue()"); + warning("STUB: Scrolls::scrollModeDialogue()"); } - - - void Scrolls::store(byte what, TuneType &played) { memcpy(played + 1, played + 2, sizeof(played) - 1); played[30] = what; } bool Scrolls::theyMatch(TuneType &played) { - byte fv, mistakes; + byte mistakes = 0; - mistakes = 0; - - for (fv = 1; fv <= sizeof(played); fv++) { - if (played[fv] != _vm->_gyro->kTune[fv]) { + for (byte i = 0; i < sizeof(played); i++) { + if (played[i] != _vm->_gyro->kTune[i]) { mistakes += 1; } } @@ -245,18 +232,16 @@ void Scrolls::scrollModeMusic() { #endif } -// ThatsAll, so put us back to $F- - -void Scrolls::resetScrollDriver() { // phew +void Scrolls::resetScrollDriver() { _vm->_gyro->_scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; - _vm->_gyro->_interrogation = 0; // always reset after a scroll comes up. + _vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. } void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... - for (byte fv = 0; fv < _vm->_gyro->_scrollBells; fv++) - _vm->_lucerna->errorLed(); // ring the bell "x" times + for (byte i = 0; i < _vm->_gyro->_scrollBells; i++) + _vm->_lucerna->errorLed(); // Ring the bell "x" times. } void Scrolls::dodgem() { @@ -271,33 +256,32 @@ void Scrolls::unDodgem() { } void Scrolls::getIcon(int16 x, int16 y, byte which) { - Common::File f; - byte *p; + Common::File file; - if (!f.open("icons.avd")) { + if (!file.open("icons.avd")) { warning("AVALANCHE: Scrolls: File not found: icons.avd"); return; } which--; - f.seek(which * 426); + file.seek(which * 426); - p = new byte[426]; - f.read(p, 426); + byte *p = new byte[426]; + file.read(p, 426); //putimage(x, y, p, 0); - warning("STUB: Scrolls::geticon()"); + warning("STUB: Scrolls::getIcon()"); delete[] p; - f.close(); + file.close(); } void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { - Common::File f; + Common::File file; Common::String filename; filename = filename.format("%s.avd", fn.c_str()); - if (!f.open(filename)) { + if (!file.open(filename)) { warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); return; } @@ -316,30 +300,27 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { bit = getpixel(0, 0); #endif - warning("STUB: Scrolls::block_drop()"); + warning("STUB: Scrolls::drawSign()"); - f.close(); + file.close(); } -void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the oldest procs in the game. - byte b; - int16 lx, ly, mx, my, ex; - bool centre; - byte icon_indent = 0; +void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { + int16 ex; //setvisualpage(cp); //setactivepage(1 - cp); _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! - lx = 0; - ly = (_vm->_gyro->_scrollNum) * 6; - for (b = 0; b < _vm->_gyro->_scrollNum; b++) { - ex = _vm->_gyro->_scroll[b].size() * 8; + int16 lx = 0; + int16 ly = (_vm->_gyro->_scrollNum) * 6; + for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + ex = _vm->_gyro->_scroll[i].size() * 8; if (lx < ex) lx = ex; } - mx = 320; - my = 100; // Getmaxx & getmaxy div 2, both. + int16 mx = 320; + int16 my = 100; // Getmaxx & getmaxy div 2, both. lx = lx / 2; ly -= 2; @@ -380,48 +361,49 @@ void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the old mx -= lx; my -= ly + 2; - centre = false; + bool centre = false; + byte iconIndent = 0; switch (_useIcon) { case 0: - icon_indent = 0; + iconIndent = 0; break; // No icon. case 34: { drawSign("about", 28, 76, 15); - icon_indent = 0; + iconIndent = 0; } break; case 35: { drawSign("gameover", 52, 59, 71); - icon_indent = 0; + iconIndent = 0; } break; } if ((1 <= _useIcon) && (_useIcon <= 33)) { // Standard icon. getIcon(mx, my + ly / 2, _useIcon); - icon_indent = 53; + iconIndent = 53; } - for (b = 0; b < _vm->_gyro->_scrollNum; b++) { - if (!_vm->_gyro->_scroll[b].empty()) - switch (_vm->_gyro->_scroll[b][_vm->_gyro->_scroll[b].size() - 1]) { + for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + if (!_vm->_gyro->_scroll[i].empty()) + switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { case kControlCenter: { centre = true; - _vm->_gyro->_scroll[b].deleteLastChar(); + _vm->_gyro->_scroll[i].deleteLastChar(); } break; case kControlLeftJustified: { centre = false; - _vm->_gyro->_scroll[b].deleteLastChar(); + _vm->_gyro->_scroll[i].deleteLastChar(); } break; case kControlQuestion: { //settextjustify(1, 1); _shadowBoxX = mx + lx; _shadowBoxY = my + ly; - _vm->_gyro->_scroll[b].setChar(' ', 0); + _vm->_gyro->_scroll[i].setChar(' ', 0); // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); @@ -431,9 +413,9 @@ void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the old } if (centre) - say(320 - _vm->_gyro->_scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->_scroll[b]); + say(320 - _vm->_gyro->_scroll[i].size() * 4 + iconIndent, my, _vm->_gyro->_scroll[i]); else - say(mx + icon_indent, my, _vm->_gyro->_scroll[b]); + say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); my += 12; } @@ -445,7 +427,7 @@ void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the old _vm->_gyro->_dropsOk = false; dodgem(); - (this->*gotoit)(); + (this->*modeFunc)(); unDodgem(); _vm->_gyro->_dropsOk = true; @@ -462,12 +444,11 @@ void Scrolls::drawScroll(ScrollsFunctionType gotoit) { // This is one of the old /*if (_vm->_gyro->mpress > 0) _vm->_gyro->after_the_scroll = true;*/ - warning("STUB: Scrolls::drawscroll()"); + warning("STUB: Scrolls::drawScroll()"); } -void Scrolls::drawBubble(ScrollsFunctionType gotoit) { - int16 xl, yl, my, xw, yw; - Common::Point p[3]; +void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { + Common::Point points[3]; // byte *rp1, *rp2; // replace: 1=bubble, 2=pointer int16 xc; // x correction @@ -478,18 +459,18 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { CursorMan.showMouse(false); - xl = 0; - yl = _vm->_gyro->_scrollNum * 5; - for (byte fv = 0; fv < _vm->_gyro->_scrollNum; fv++) { - uint16 textWidth = _vm->_gyro->_scroll[fv].size() * 8; + int16 xl = 0; + int16 yl = _vm->_gyro->_scrollNum * 5; + for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; } xl = xl / 2; - xw = xl + 18; - yw = yl + 7; - my = yw * 2 - 2; + int16 xw = xl + 18; + int16 yw = yl + 7; + int16 my = yw * 2 - 2; xc = 0; if ((_vm->_gyro->_talkX - xw) < 0) @@ -497,12 +478,12 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { if ((_vm->_gyro->_talkX + xw) > 639) xc = 639 - (_vm->_gyro->_talkX + xw); - p[0].x = _vm->_gyro->_talkX - 10; - p[0].y = yw; - p[1].x = _vm->_gyro->_talkX + 10; - p[1].y = yw; - p[2].x = _vm->_gyro->_talkX; - p[2].y = _vm->_gyro->_talkY; + points[0].x = _vm->_gyro->_talkX - 10; + points[0].y = yw; + points[1].x = _vm->_gyro->_talkX + 10; + points[1].y = yw; + points[2].x = _vm->_gyro->_talkX; + points[2].y = _vm->_gyro->_talkY; // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); @@ -521,7 +502,7 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); yl -= 3; @@ -529,10 +510,10 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (byte fv = 0; fv < _vm->_gyro->_scrollNum; fv++) { - int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[fv].size() / 2 * 8; - bool offset = _vm->_gyro->_scroll[fv].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[fv], _vm->_gyro->_font, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->_talkFontColor); + for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; + bool offset = _vm->_gyro->_scroll[i].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); } //setvisualpage(1 - cp); @@ -542,7 +523,7 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { _vm->_gyro->_dropsOk = false; // This does the actual drawing to the screen. - (this->*gotoit)(); + (this->*modeFunc)(); CursorMan.showMouse(false); _vm->_gyro->_dropsOk = true; @@ -556,15 +537,15 @@ void Scrolls::drawBubble(ScrollsFunctionType gotoit) { } bool Scrolls::displayQuestion(Common::String question) { - warning("STUB: Scrolls::ask()"); + warning("STUB: Scrolls::displayQuestion()"); return true; } void Scrolls::resetScroll() { _vm->_gyro->_scrollNum = 1; - for (int j = 0; j < 15; j++) - if (!_vm->_gyro->_scroll[j].empty()) - _vm->_gyro->_scroll[j].clear(); + for (int i = 0; i < 15; i++) + if (!_vm->_gyro->_scroll[i].empty()) + _vm->_gyro->_scroll[i].clear(); } void Scrolls::setBubbleStateNatural() { @@ -575,31 +556,28 @@ void Scrolls::setBubbleStateNatural() { } Common::String Scrolls::displayMoney() { - Common::String x; + Common::String result; if (_vm->_gyro->_dna._money < 12) { // just pence - x = _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + 'd'; + result = _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + 'd'; } else if (_vm->_gyro->_dna._money < 240) { // shillings & pence - x = _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 12) + '/'; + result = _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 12) + '/'; if ((_vm->_gyro->_dna._money % 12) == 0) - x = x + '-'; + result = result + '-'; else - x = x + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); + result = result + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); } else // L, s & d - x = Common::String('\x9C') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + result = Common::String('\x9C') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); if (_vm->_gyro->_dna._money > 12) - x = x + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; + result = result + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; - return x; + return result; } - - - -void Scrolls::stripTrailingSpaces(Common::String &q) { - while (q[q.size() - 1] == ' ') { - q.deleteLastChar(); +void Scrolls::stripTrailingSpaces(Common::String &str) { + while (str[str.size() - 1] == ' ') { + str.deleteLastChar(); } } @@ -617,10 +595,6 @@ void Scrolls::solidify(byte n) { } void Scrolls::callScrollDriver() { - uint16 fv; - byte nn; - bool mouthnext; - bool call_spriterun; // Only call sprite_run the FIRST time. // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? @@ -629,8 +603,8 @@ void Scrolls::callScrollDriver() { setReadyLight(0); _vm->_gyro->_scReturn = false; - mouthnext = false; - call_spriterun = true; + bool mouthnext = false; + bool call_spriterun = true; // Only call sprite_run the FIRST time. switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { case kControlToBuffer: @@ -647,18 +621,18 @@ void Scrolls::callScrollDriver() { uint16 size = _vm->_gyro->_bufSize; - for (fv = 0; fv < size; fv++) { + for (uint16 i = 0; i < size; i++) { if (mouthnext) { - if (_vm->_gyro->_buffer[fv] == kControlRegister) + if (_vm->_gyro->_buffer[i] == kControlRegister) _param = 0; - else if (('0' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= '9')) - _param = _vm->_gyro->_buffer[fv] - 48; - else if (('A' <= _vm->_gyro->_buffer[fv]) && (_vm->_gyro->_buffer[fv] <= 'Z')) - _param = _vm->_gyro->_buffer[fv] - 55; + else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) + _param = _vm->_gyro->_buffer[i] - 48; + else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) + _param = _vm->_gyro->_buffer[i] - 55; mouthnext = false; } else { - switch (_vm->_gyro->_buffer[fv]) { + switch (_vm->_gyro->_buffer[i]) { case kControlParagraph: { if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; @@ -757,12 +731,9 @@ void Scrolls::callScrollDriver() { } break; case 11: - nn = 1; - for (byte nnn = 0; nnn < kObjectNum; nnn++) { - if (_vm->_gyro->_dna._objects[nnn]) { - nn++; - displayText(_vm->_gyro->getItem(nnn) + ", " + kControlToBuffer); - } + for (byte j = 0; j < kObjectNum; j++) { + if (_vm->_gyro->_dna._objects[j]) + displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); } break; } @@ -790,7 +761,7 @@ void Scrolls::callScrollDriver() { mouthnext = true; break; case kControlInsertSpaces: - for (nn = 0; nn < 9; nn++) + for (byte j = 0; j < 9; j++) _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; break; default: { // Add new char. @@ -798,45 +769,45 @@ void Scrolls::callScrollDriver() { solidify(_vm->_gyro->_scrollNum - 1); _vm->_gyro->_scrollNum++; } - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[fv]; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; } } } } } -void Scrolls::displayText(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_gyro->_bufSize = z.size(); - memcpy(_vm->_gyro->_buffer, z.c_str(), _vm->_gyro->_bufSize); +void Scrolls::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! + _vm->_gyro->_bufSize = text.size(); + memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); callScrollDriver(); } void Scrolls::loadFont() { - Common::File f; + Common::File file; - if (!f.open("avalot.fnt")) { + if (!file.open("avalot.fnt")) { warning("AVALANCHE: Scrolls: File not found: avalot.fnt"); return; } for (int16 i = 0; i < 256; i++) - f.read(_scrollFonts[0][i], 16); - f.close(); + file.read(_scrollFonts[0][i], 16); + file.close(); - if (!f.open("avitalic.fnt")) { + if (!file.open("avitalic.fnt")) { warning("AVALANCHE: Scrolls: File not found: avitalic.fnt"); return; } for (int16 i = 0; i < 256; i++) - f.read(_scrollFonts[1][i], 16); - f.close(); + file.read(_scrollFonts[1][i], 16); + file.close(); - if (!f.open("ttsmall.fnt")) { + if (!file.open("ttsmall.fnt")) { warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); return; } for (int16 i = 0; i < 256; i++) - f.read(_vm->_gyro->_font[i],16); - f.close(); + file.read(_vm->_gyro->_font[i],16); + file.close(); } void Scrolls::musicalScroll() { diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index c043e4a30da5..026c5888e126 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -67,7 +67,7 @@ class Scrolls { Scrolls(AvalancheEngine *vm); void init(); - void setReadyLight(byte x); // Sets "Ready" light to whatever. + void setReadyLight(byte state); // Sets "Ready" light to whatever. void drawScroll(ScrollsFunctionType modeFunc); void drawBubble(ScrollsFunctionType modeFunc); void resetScroll(); From 93013b5c76a0417b5f314f5da1a238b7357bb43f Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 00:02:20 +0200 Subject: [PATCH 0872/1332] AVALANCHE: Do renaming in Sequence. --- engines/avalanche/acci2.cpp | 8 ++--- engines/avalanche/animation.cpp | 44 ++++++++++++------------ engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/lucerna2.cpp | 60 ++++++++++++++++----------------- engines/avalanche/sequence2.cpp | 52 +++++++++++++--------------- engines/avalanche/sequence2.h | 29 ++++++---------- engines/avalanche/timeout2.cpp | 16 ++++----- 7 files changed, 99 insertions(+), 112 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index cf4e20fa55c3..4938aaa0c2f3 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1255,10 +1255,10 @@ void Acci::playHarp() { void Acci::winSequence() { _vm->_visa->dixi('q', 78); - _vm->_sequence->first_show(7); - _vm->_sequence->then_show(8); - _vm->_sequence->then_show(9); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(7); + _vm->_sequence->thenShow(8); + _vm->_sequence->thenShow(9); + _vm->_sequence->startToClose(); _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index a4b129b7362a..c71ecd6b2225 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1012,53 +1012,53 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { case r__outsideyours: case r__outsidenottspub: case r__outsideducks: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(2); - _vm->_sequence->then_show(3); + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(2); + _vm->_sequence->thenShow(3); break; case r__insidecardiffcastle: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(5); + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(5); break; case r__avvysgarden: case r__entrancehall: case r__insideabbey: case r__yourhall: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(2); + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(2); break; case r__musicroom: case r__outsideargentpub: - _vm->_sequence->first_show(5); - _vm->_sequence->then_show(6); + _vm->_sequence->firstShow(5); + _vm->_sequence->thenShow(6); break; case r__lusties: switch (magicnum) { case 14: if (_vm->_gyro->_dna._avvysInTheCupboard) { hideInCupboard(); - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(8); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); return; } else { apped(1, 6); tr[0]._facingDir = kDirRight; // added by TT 12/3/1995 - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(9); + _vm->_sequence->firstShow(8); + _vm->_sequence->thenShow(9); } break; case 12: - _vm->_sequence->first_show(4); - _vm->_sequence->then_show(5); - _vm->_sequence->then_show(6); + _vm->_sequence->firstShow(4); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(6); break; } break; } - _vm->_sequence->then_flip(whither, ped); - _vm->_sequence->start_to_open(); + _vm->_sequence->thenFlip(whither, ped); + _vm->_sequence->startToOpen(); } void Animation::newspeed() { @@ -1463,9 +1463,9 @@ void Animation::hideInCupboard() { apped(1, 3); // Walk out of the cupboard. _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_dna._avvysInTheCupboard = false; - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(8); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); } } else { // Not hiding in the cupboard diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7462268714ea..34391652240d 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -341,7 +341,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } //blockwrite(f, seq, sizeof(seq)); // Sequencer information. - sz.syncBytes(_sequence->seq, _sequence->seq_length); + sz.syncBytes(_sequence->_seq, _sequence->kSeqLength); } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3464a7c9f4bf..30d88e572320 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -676,10 +676,10 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped != 0) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(6); - _vm->_sequence->then_show(5); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(6); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); } break; @@ -687,11 +687,11 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped == 2) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(3); - _vm->_sequence->then_show(2); - _vm->_sequence->then_show(1); - _vm->_sequence->then_show(4); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(3); + _vm->_sequence->thenShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(4); + _vm->_sequence->startToClose(); } break; @@ -699,10 +699,10 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped == 2) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(6); - _vm->_sequence->then_show(5); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(6); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); } break; @@ -725,16 +725,16 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(10, false, _vm->_animation); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(1); + _vm->_sequence->firstShow(1); if (_vm->_gyro->_dna._arrowInTheDoor) - _vm->_sequence->then_show(3); + _vm->_sequence->thenShow(3); else - _vm->_sequence->then_show(2); + _vm->_sequence->thenShow(2); if (_vm->_gyro->_dna._takenPen) _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_sequence->start_to_close(); + _vm->_sequence->startToClose(); } else { _vm->_celer->drawBackgroundSprite(-1, -1, 1); if (_vm->_gyro->_dna._arrowInTheDoor) @@ -749,10 +749,10 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped == 1) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(2); - _vm->_sequence->then_show(1); - _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(3); + _vm->_sequence->startToClose(); } break; @@ -770,10 +770,10 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(2); - _vm->_sequence->then_show(1); - _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(3); + _vm->_sequence->startToClose(); } break; @@ -808,11 +808,11 @@ void Lucerna::enterRoom(byte room, byte ped) { // Shut the door _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_sequence->first_show(3); - _vm->_sequence->first_show(2); - _vm->_sequence->then_show(1); - _vm->_sequence->then_show(4); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(3); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(4); + _vm->_sequence->startToClose(); } break; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index f2d4241e8a3c..66a95195eb67 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -43,70 +43,66 @@ Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; } -void Sequence::first_show(byte what) { +void Sequence::firstShow(byte what) { // First, we need to blank out the entire array. - for (uint i = 0; i < sizeof(seq); i++) - seq[i] = 0; - - // Then it's just the same as then_show. - then_show(what); + for (uint i = 0; i < sizeof(_seq); i++) + _seq[i] = 0; + // Then it's just the same as thenShow. + thenShow(what); } -void Sequence::then_show(byte what) { - for (int16 fv = 0; fv < seq_length; fv++) { - if (seq[fv] == 0) { - seq[fv] = what; +void Sequence::thenShow(byte what) { + for (int16 i = 0; i < kSeqLength; i++) { + if (_seq[i] == 0) { + _seq[i] = what; return; } } } -void Sequence::then_flip(byte where, byte ped) { - then_show(now_flip); +void Sequence::thenFlip(byte where, byte ped) { + thenShow(kNowFlip); _vm->_gyro->_dna._flipToWhere = where; _vm->_gyro->_dna._flipToPed = ped; } -void Sequence::start_to_close() { +void Sequence::startToClose() { _vm->_timeout->lose_timer(_vm->_timeout->reason_sequencer); _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->reason_sequencer); } -void Sequence::start_to_open() { +void Sequence::startToOpen() { _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. - start_to_close(); // Apart from that, it's the same thing. + startToClose(); // Apart from that, it's the same thing. } - - -// This PROC is called by Timeout when it's time to do another frame. -void Sequence::shove_left() { - memcpy(seq, seq+1, seq_length - 1); // Shift everything to the left. +void Sequence::shoveLeft() { + memcpy(_seq, _seq+1, kSeqLength - 1); // Shift everything to the left. } -void Sequence::call_sequencer() { - switch (seq[0]) { +void Sequence::callSequencer() { + switch (_seq[0]) { case 0: return; // No more routines. break; case 177: // Flip room. _vm->_gyro->_dna._userMovesAvvy = true; _vm->_animation->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); - if (seq[0] == 177) - shove_left(); + if (_seq[0] == 177) + shoveLeft(); break; } - if ((seq[0] >= 1) && (seq[0] <= 176)) { + if ((_seq[0] >= 1) && (_seq[0] <= 176)) { // Show a frame. - _vm->_celer->drawBackgroundSprite(-1, -1, seq[0]); - shove_left(); + _vm->_celer->drawBackgroundSprite(-1, -1, _seq[0]); + shoveLeft(); } - start_to_close(); // Make sure this PROC gets called again. + startToClose(); // Make sure this PROC gets called again. } } // End of namespace Avalanche. diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h index 7fcb646fa5ba..07c90b455b77 100644 --- a/engines/avalanche/sequence2.h +++ b/engines/avalanche/sequence2.h @@ -37,33 +37,24 @@ class AvalancheEngine; class Sequence { public: - static const int16 now_flip = 177; - - static const int16 seq_length = 10; - - - - byte seq[seq_length]; + static const int16 kNowFlip = 177; + static const int16 kSeqLength = 10; + byte _seq[kSeqLength]; Sequence(AvalancheEngine *vm); - void first_show(byte what); - - void then_show(byte what); - - void then_flip(byte where, byte ped); - - void start_to_close(); - - void start_to_open(); - - void call_sequencer(); + void firstShow(byte what); + void thenShow(byte what); + void thenFlip(byte where, byte ped); + void startToClose(); + void startToOpen(); + void callSequencer(); private: AvalancheEngine *_vm; - void shove_left(); + void shoveLeft(); // This PROC is called by Timeout when it's time to do another frame. }; } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 842a7dca6efb..bd136d54bfd4 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -143,7 +143,7 @@ void Timeout::one_tick() { jump(); break; case procsequence: - _vm->_sequence->call_sequencer(); + _vm->_sequence->callSequencer(); break; case proccrapulus_splud_out: crapulus_says_splud_out(); @@ -421,8 +421,8 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_sequence->first_show(2); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(2); + _vm->_sequence->startToClose(); set_up_timer(50, procnaughty_duke2, reason_naughty_duke); } @@ -436,8 +436,8 @@ void Timeout::naughty_duke2() { void Timeout::naughty_duke3() { _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_sequence->first_show(2); - _vm->_sequence->start_to_close(); + _vm->_sequence->firstShow(2); + _vm->_sequence->startToClose(); } void Timeout::jump() { @@ -665,9 +665,9 @@ void Timeout::give_lute_to_geida() { // Moved here from Acci. _vm->_visa->dixi('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_dna._lustieIsAsleep = true; - _vm->_sequence->first_show(5); - _vm->_sequence->then_show(6); // He falls asleep... - _vm->_sequence->start_to_close(); // Not really closing, but we're using the same procedure. + _vm->_sequence->firstShow(5); + _vm->_sequence->thenShow(6); // He falls asleep... + _vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure. } } // End of namespace Avalanche. From 1847a0ddbf582603da854938b8d1b774ff03749c Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 00:24:59 +0200 Subject: [PATCH 0873/1332] AVALANCHE: Start renaming in Timeout. --- engines/avalanche/timeout2.h | 61 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 0e7be3364020..8536fefe2c1c 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -37,36 +37,37 @@ class AvalancheEngine; class Timeout { public: - // reason_ now runs between 1 and 28. - - static const int16 reason_drawbridgefalls = 2; - static const int16 reason_avariciustalks = 3; - static const int16 reason_gototoilet = 4; - static const int16 reason_explosion = 5; - static const int16 reason_brummiestairs = 6; - static const int16 reason_cardiffsurvey = 7; - static const int16 reason_cwytalot_in_herts = 8; - static const int16 reason_getting_tied_up = 9; - static const int16 reason_hanging_around = 10; // Tied to the tree in Nottingham. - static const int16 reason_jacques_waking_up = 11; - static const int16 reason_naughty_duke = 12; - static const int16 reason_jumping = 13; - static const int16 reason_sequencer = 14; - static const int16 reason_crapulus_says_spludwick_out = 15; - static const int16 reason_dawndelay = 16; - static const int16 reason_drinks = 17; - static const int16 reason_du_lustie_talks = 18; - static const int16 reason_falling_down_oubliette = 19; - static const int16 reason_meeting_avaroid = 20; - static const int16 reason_rising_up_oubliette = 21; - static const int16 reason_robin_hood_and_geida = 22; - static const int16 reason_sitting_down = 23; - static const int16 reason_ghost_room_phew = 1; - static const int16 reason_arkata_shouts = 24; - static const int16 reason_winning = 25; - static const int16 reason_falling_over = 26; - static const int16 reason_spludwalk = 27; - static const int16 reason_geida_sings = 28; + // Reason runs between 1 and 28. + enum Reason { + kReasonDrawbridgeFalls = 2, + kReasonAvariciusTalks = 3, + kReasonGoToToilet = 4, + kReasonExplosion = 5, + kReasonBrummieStairs = 6, + kReasonCardiffsurvey = 7, + kReasonCwytalotInHerts = 8, + kReasonGettingTiedUp = 9, + kReasonHangingAround = 10, // Tied to the tree in Nottingham. + kReasonJacquesWakingUp = 11, + kReasonNaughtyDuke = 12, + kReasonJumping = 13, + kReasonSequencer = 14, + kReasonCrapulusSaysSpludwickOut = 15, + kReasonDawndelay = 16, + kReasonDrinks = 17, + kReasonDuLustieTalks = 18, + kReasonFallingDownOubliette = 19, + kReasonMeetingAvaroid = 20, + kReasonRisingUpOubliette = 21, + kReasonRobinHoodAndGeida = 22, + kReasonSittingDown = 23, + kReasonGhostRoomPhew = 1, + kReasonArkataShouts = 24, + kReasonWinning = 25, + kReasonFallingOver = 26, + kReasonSpludWalk = 27, + kReasonGeidaSings = 28 + }; // procx now runs between 1 and 41. From 3f2ed1c803d36842b01320da28d4e68592317781 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 00:26:16 +0200 Subject: [PATCH 0874/1332] AVALANCHE: Everything that is missing from the last commit... --- engines/avalanche/acci2.cpp | 24 ++++++++--------- engines/avalanche/animation.cpp | 18 ++++++------- engines/avalanche/lucerna2.cpp | 28 ++++++++++---------- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/sequence2.cpp | 4 +-- engines/avalanche/timeout2.cpp | 46 ++++++++++++++++----------------- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 4938aaa0c2f3..bdbb6174d362 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -379,7 +379,7 @@ void Acci::storeInterrogation(byte interrogation) { while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // If you want to use any other timer, put this into the case statement. + _vm->_timeout->lose_timer(_vm->_timeout->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { case 1: @@ -1041,7 +1041,7 @@ void Acci::notInOrder() { void Acci::goToCauldron() { _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->kReasonSpludWalk); _vm->_animation->tr[1].walkto(2); } @@ -1143,7 +1143,7 @@ void Acci::standUp() { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; - _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonArkataShouts); } else already(); break; @@ -1242,7 +1242,7 @@ void Acci::giveGeidaTheLute() { _vm->_lucerna->refreshObjectList(); _vm->_visa->dixi('q', 64); // She plays it. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->kReasonGeidaSings); _vm->_enid->backToBootstrap(4); } @@ -1259,7 +1259,7 @@ void Acci::winSequence() { _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); _vm->_sequence->startToClose(); - _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); + _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->kReasonWinning); } void Acci::personSpeaks() { @@ -1682,7 +1682,7 @@ void Acci::doThat() { case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); - _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); + _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->kReasonGoToToilet); } else _vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); @@ -1706,7 +1706,7 @@ void Acci::doThat() { _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; - _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); + _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->kReasonAvariciusTalks); } } else _vm->_scrolls->displayText("Nothing appears to happen..."); @@ -1769,7 +1769,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->kReasonDrinks); break; case 52: examine(); @@ -1795,7 +1795,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->kReasonDrinks); } break; } @@ -1892,7 +1892,7 @@ void Acci::doThat() { else { _vm->_lucerna->incScore(4); _vm->_scrolls->displayText("The drawbridge opens!"); - _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->kReasonDrawbridgeFalls); _vm->_gyro->_dna._drawbridgeOpen = 1; } } else @@ -1944,7 +1944,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: - _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->kReasonJumping); _vm->_gyro->_dna._userMovesAvvy = false; break; case kVerbCodeHiscores: @@ -1985,7 +1985,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->kReasonSittingDown); } } else { // Default doodah. _vm->_lucerna->dusk(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index c71ecd6b2225..127fbf91782c 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -840,7 +840,7 @@ void Animation::catamove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Animation::dawndelay() { - _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); + _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->kReasonDawndelay); } void Animation::call_special(uint16 which) { @@ -849,7 +849,7 @@ void Animation::call_special(uint16 which) { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_dna._brummieStairs = 1; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); + _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->kReasonBrummieStairs); stopWalking(); _vm->_gyro->_dna._userMovesAvvy = false; break; @@ -883,7 +883,7 @@ void Animation::call_special(uint16 which) { case 4: // This is the ghost room link. _vm->_lucerna->dusk(); tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap - _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->kReasonGhostRoomPhew); _vm->_enid->backToBootstrap(3); break; case 5: @@ -901,7 +901,7 @@ void Animation::call_special(uint16 which) { tr[1]._vanishIfStill = true; tr[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. - _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); + _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->kReasonHangingAround); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. @@ -909,17 +909,17 @@ void Animation::call_special(uint16 which) { tr[0]._moveX = 3; tr[0]._moveY = 0; tr[0]._facingDir = kDirRight; - _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->kReasonFallingDownOubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopWalking(); - _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); + _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { @@ -937,7 +937,7 @@ void Animation::call_special(uint16 which) { tr[1].walkto(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); + _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->kReasonRobinHoodAndGeida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { @@ -1223,7 +1223,7 @@ void Animation::arrow_procs(byte tripnum) { _vm->_lucerna->gameOver(); _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. - _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); + _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->kReasonNaughtyDuke); } } else { // Arrow has hit the wall! tr[tripnum].done(); // Deallocate the arrow. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 30d88e572320..a6c6286b47b6 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -340,21 +340,21 @@ void Lucerna::exitRoom(byte x) { switch (x) { case r__spludwicks: - _vm->_timeout->lose_timer(_vm->_timeout->reason_avariciustalks); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonAvariciusTalks); _vm->_gyro->_dna._avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: if (_vm->_gyro->_dna._drawbridgeOpen > 0) { _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. - _vm->_timeout->lose_timer(_vm->_timeout->reason_drawbridgefalls); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonDrawbridgeFalls); } break; case r__outsidecardiffcastle: - _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonCardiffsurvey); break; case r__robins: - _vm->_timeout->lose_timer(_vm->_timeout->reason_getting_tied_up); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonGettingTiedUp); break; } @@ -436,7 +436,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); + _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->kReasonArkataShouts); } break; @@ -464,7 +464,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(8, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(4); - _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } } @@ -472,7 +472,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); + _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->kReasonExplosion); _vm->_gyro->_dna._spludwickAtHome = true; } break; @@ -527,7 +527,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->kReasonCwytalotInHerts); } break; @@ -548,7 +548,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(6, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); + _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->kReasonGettingTiedUp); } } @@ -572,7 +572,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); + _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->kReasonCardiffsurvey); } break; case 5 : @@ -582,7 +582,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 3); _vm->_animation->tr[1]._facingDir = Animation::kDirRight; - _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->kReasonCardiffsurvey); } } if (_vm->_gyro->_dna._cardiffQuestionNum < 5) @@ -650,10 +650,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes - _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->kReasonDuLustieTalks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->kReasonDuLustieTalks); if (_vm->_gyro->_dna._geidaFollows) { putGeidaAt(5, ped); @@ -1190,7 +1190,7 @@ void Lucerna::gameOver() { _vm->_animation->tr[0]._stepNum = 0; _vm->_animation->tr[0].appear(sx, sy, 0); - _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->kReasonFallingOver); _vm->_gyro->_alive = false; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 133372dcce78..62f2fe3bf3d7 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -219,7 +219,7 @@ void Scrolls::scrollModeMusic() { setReadyLight(0); _vm->_gyro->_seeScroll = false; - _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up); + _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->kReasonJacquesWakingUp); warning("STUB: Scrolls::music_scroll()"); return; #if 0 diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 66a95195eb67..e233b1300aa5 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -69,8 +69,8 @@ void Sequence::thenFlip(byte where, byte ped) { } void Sequence::startToClose() { - _vm->_timeout->lose_timer(_vm->_timeout->reason_sequencer); - _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->reason_sequencer); + _vm->_timeout->lose_timer(_vm->_timeout->kReasonSequencer); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->kReasonSequencer); } void Sequence::startToOpen() { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index bd136d54bfd4..df2ba941f3a6 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -229,7 +229,7 @@ void Timeout::open_drawbridge() { if (_vm->_gyro->_dna._drawbridgeOpen == 4) _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. else - set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); + set_up_timer(7, procopen_drawbridge, kReasonDrawbridgeFalls); } void Timeout::avaricius_talks() { @@ -237,7 +237,7 @@ void Timeout::avaricius_talks() { _vm->_gyro->_dna._avariciusTalk++; if (_vm->_gyro->_dna._avariciusTalk < 17) - set_up_timer(177, procavaricius_talks, reason_avariciustalks); + set_up_timer(177, procavaricius_talks, kReasonAvariciusTalks); else _vm->_lucerna->incScore(3); } @@ -246,7 +246,7 @@ void Timeout::urinate() { _vm->_animation->tr[0].turn(Animation::kDirUp); _vm->_animation->stopWalking(); _vm->_lucerna->drawDirection(); - set_up_timer(14, proctoilet2, reason_gototoilet); + set_up_timer(14, proctoilet2, kReasonGoToToilet); } void Timeout::toilet2() { @@ -255,7 +255,7 @@ void Timeout::toilet2() { void Timeout::bang() { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); - set_up_timer(30, procbang2, reason_explosion); + set_up_timer(30, procbang2, kReasonExplosion); } void Timeout::bang2() { @@ -282,7 +282,7 @@ void Timeout::cardiff_survey() { _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; - set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); + set_up_timer(182, proccardiffsurvey, kReasonCardiffsurvey); } void Timeout::cardiff_return() { @@ -303,7 +303,7 @@ void Timeout::get_tied_up() { _vm->_animation->tr[1].stophoming(); _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; - set_up_timer(70, procget_tied_up2, reason_getting_tied_up); + set_up_timer(70, procget_tied_up2, kReasonGettingTiedUp); } void Timeout::get_tied_up2() { @@ -320,7 +320,7 @@ void Timeout::hang_around() { _vm->_animation->apped(1, 2); _vm->_visa->dixi('q', 39); _vm->_animation->tr[0].walkto(7); - set_up_timer(55, prochang_around2, reason_hanging_around); + set_up_timer(55, prochang_around2, kReasonHangingAround); } void Timeout::hang_around2() { @@ -332,7 +332,7 @@ void Timeout::hang_around2() { _vm->_animation->tr[0].done(); _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. - set_up_timer(1, procafter_the_shootemup, reason_hanging_around); + set_up_timer(1, procafter_the_shootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). _vm->_gyro->_dna._tiedUp = false; @@ -406,10 +406,10 @@ void Timeout::jacques_wakes_up() { case 1: case 2: case 3: - set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up); + set_up_timer(12, procjacques_wakes_up, kReasonJacquesWakingUp); break; case 4: - set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up); + set_up_timer(24, procjacques_wakes_up, kReasonJacquesWakingUp); break; } } @@ -424,14 +424,14 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); - set_up_timer(50, procnaughty_duke2, reason_naughty_duke); + set_up_timer(50, procnaughty_duke2, kReasonNaughtyDuke); } void Timeout::naughty_duke2() { _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" _vm->_animation->tr[1].walkto(1); // Walk to the door. _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! - set_up_timer(32, procnaughty_duke3, reason_naughty_duke); + set_up_timer(32, procnaughty_duke3, kReasonNaughtyDuke); } void Timeout::naughty_duke3() { @@ -466,7 +466,7 @@ void Timeout::jump() { _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._jumpStatus = 0; } else { // Still jumping. - set_up_timer(1, procjump, reason_jumping); + set_up_timer(1, procjump, kReasonJumping); } if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. @@ -532,7 +532,7 @@ void Timeout::fall_down_oubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; _vm->_animation->tr[0]._moveY++; // Increments dx/dy! _vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go... - set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); + set_up_timer(3, procfall_down_oubliette, kReasonFallingDownOubliette); } void Timeout::meet_avaroid() { @@ -543,7 +543,7 @@ void Timeout::meet_avaroid() { } else { _vm->_visa->dixi('Q', 60); _vm->_gyro->_dna._metAvaroid = true; - set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); + set_up_timer(1, procrise_up_oubliette, kReasonRisingUpOubliette); _vm->_animation->tr[0]._facingDir = Animation::kDirLeft; _vm->_animation->tr[0]._x = 151; @@ -559,7 +559,7 @@ void Timeout::rise_up_oubliette() { _vm->_animation->tr[0]._moveY++; // Decrements dx/dy! _vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go... if (_vm->_animation->tr[0]._moveY > 0) - set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); + set_up_timer(3, procrise_up_oubliette, kReasonRisingUpOubliette); else _vm->_gyro->_dna._userMovesAvvy = true; } @@ -570,7 +570,7 @@ void Timeout::robin_hood_and_geida() { _vm->_animation->tr[0].walkto(6); _vm->_animation->tr[1].stopWalk(); _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; - set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); + set_up_timer(20, procrobin_hood_and_geida_talk, kReasonRobinHoodAndGeida); _vm->_gyro->_dna._geidaFollows = false; } @@ -580,7 +580,7 @@ void Timeout::robin_hood_and_geida_talk() { _vm->_animation->tr[1].walkto(2); _vm->_animation->tr[0]._vanishIfStill = true; _vm->_animation->tr[1]._vanishIfStill = true; - set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); + set_up_timer(162, procavalot_returns, kReasonRobinHoodAndGeida); } void Timeout::avalot_returns() { @@ -595,7 +595,7 @@ void Timeout::avalot_returns() { void Timeout::avvy_sit_down() { // This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. if (_vm->_animation->tr[0]._homing) // Still walking. - set_up_timer(1, procavvy_sit_down, reason_sitting_down); + set_up_timer(1, procavvy_sit_down, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dna._sittingInPub = true; @@ -615,7 +615,7 @@ void Timeout::arkata_shouts() { _vm->_visa->dixi('q', 76); - set_up_timer(160, procarkata_shouts, reason_arkata_shouts); + set_up_timer(160, procarkata_shouts, kReasonArkataShouts); } void Timeout::winning() { @@ -638,7 +638,7 @@ void Timeout::winning() { void Timeout::avalot_falls() { if (_vm->_animation->tr[0]._stepNum < 5) { _vm->_animation->tr[0]._stepNum++; - set_up_timer(3, procavalot_falls, reason_falling_over); + set_up_timer(3, procavalot_falls, kReasonFallingOver); } else { Common::String toDisplay; for (byte i = 0; i < 6; i++) @@ -652,9 +652,9 @@ void Timeout::avalot_falls() { void Timeout::spludwick_goes_to_cauldron() { if (_vm->_animation->tr[1]._homing) - set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); + set_up_timer(1, procspludwick_goes_to_cauldron, kReasonSpludWalk); else - set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); + set_up_timer(17, procspludwick_leaves_cauldron, kReasonSpludWalk); } void Timeout::spludwick_leaves_cauldron() { From 70e75dd6403a25f220e2e5eb0af9c3f0e940288c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:03:25 -0500 Subject: [PATCH 0875/1332] ZVISION: Make the declaration and implementation of copyRectToWorkingWindow be the same --- engines/zvision/render_manager.cpp | 4 ++-- engines/zvision/render_manager.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index bd3e73563fbd..3793ea8cf956 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -166,7 +166,7 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (!subRect.isValidRect() || subRect.isEmpty()) return; - renderRectToWorkingWindow((uint16 *)surface.getBasePtr(subRect.left, subRect.top), surface.w, destinationX, destinationY, subRect.width(), subRect.height()); + copyRectToWorkingWindow((const uint16 *)surface.getBasePtr(subRect.left, subRect.top), destinationX, destinationY, surface.w, subRect.width(), subRect.height()); } void RenderManager::renderImageToScreen(const Common::String &fileName, int16 destinationX, int16 destinationY, bool wrap) { @@ -274,7 +274,7 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: destination.convertToInPlace(_pixelFormat); } -void RenderManager::renderRectToWorkingWindow(uint16 *buffer, int32 imageWidth, int32 destX, int32 destY, int32 width, int32 height) { +void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height) { uint32 destOffset = 0; uint32 sourceOffset = 0; uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index fd36ab573089..9881676583f8 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -108,6 +108,8 @@ class RenderManager { */ void renderBackbufferToScreen(); + void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); + /** * Fills the entire workingWindow with the specified color * @@ -192,8 +194,6 @@ class RenderManager { void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); - void renderRectToWorkingWindow(uint16 *buffer, int32 x, int32 y, int32 imageWidth, int32 width, int32 height); - void moveBackground(int offset); }; From 47ee636f0503f39531371e3e611a4b6fb81906e0 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:04:01 -0500 Subject: [PATCH 0876/1332] ZVISION: Make LeverControl render to the working window instead of directly to the screen --- engines/zvision/lever_control.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 744fde1e1c7c..318710e62720 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -32,6 +32,7 @@ #include "zvision/lever_control.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "zvision/render_manager.h" #include "zvision/cursor_manager.h" #include "zvision/rlf_animation.h" #include "zvision/zork_avi_decoder.h" @@ -375,7 +376,6 @@ void LeverControl::renderFrame(uint frameNumber) { } const uint16 *frameData; - int pitch; int x = _animationCoords.left; int y = _animationCoords.top; int width; @@ -384,19 +384,17 @@ void LeverControl::renderFrame(uint frameNumber) { if (_fileType == RLF) { // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can frameData = _animation.rlf->getFrameData(frameNumber); - pitch = _animation.rlf->width() * sizeof(uint16); width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() } else if (_fileType == AVI) { _animation.avi->seekToFrame(frameNumber); const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); frameData = (const uint16 *)surface->getPixels(); - pitch = surface->pitch; width = surface->w; height = surface->h; } - _engine->_system->copyRectToScreen(frameData, pitch, x + _engine->_workingWindow.left, y + _engine->_workingWindow.top, width, height); + _engine->getRenderManager()->copyRectToWorkingWindow(frameData, x, y, width, width, height); } } // End of namespace ZVision From aea107071350a9566c1bd2a8362c2df937f29f67 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:04:42 -0500 Subject: [PATCH 0877/1332] ZVISION: Allow RLF seeking without returning a frame --- engines/zvision/rlf_animation.cpp | 28 ++++++++++++++++++++-------- engines/zvision/rlf_animation.h | 2 ++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index ffc272c1c80e..dfd3289f669f 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -155,16 +155,13 @@ RlfAnimation::Frame RlfAnimation::readNextFrame() { return frame; } -const uint16 *RlfAnimation::getFrameData(uint frameNumber) { +void RlfAnimation::seekToFrame(int frameNumber) { assert(!_stream); - assert(frameNumber < _frameCount); + assert(frameNumber < _frameCount || frameNumber >= -1); - // Since this method is so expensive, first check to see if we can use - // getNextFrame() it's cheap. - if ((int)frameNumber == _currentFrame) { - return _currentFrameBuffer; - } else if (_currentFrame + 1 == (int)frameNumber) { - return getNextFrame(); + if (frameNumber == -1) { + _currentFrame = -1; + return; } int closestFrame = _currentFrame; @@ -182,6 +179,21 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } _currentFrame = frameNumber; +} + +const uint16 *RlfAnimation::getFrameData(uint frameNumber) { + assert(!_stream); + assert(frameNumber < _frameCount); + + // Since this method is so expensive, first check to see if we can use + // getNextFrame() it's cheap. + if ((int)frameNumber == _currentFrame) { + return _currentFrameBuffer; + } else if (_currentFrame + 1 == (int)frameNumber) { + return getNextFrame(); + } + + seekToFrame(frameNumber); return _currentFrameBuffer; } diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 6f93934f1f7a..b7d25952950e 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -77,6 +77,8 @@ class RlfAnimation { uint height() { return _height; } uint32 frameTime() { return _frameTime; } + void seekToFrame(int frameNumber); + const uint16 *getFrameData(uint frameNumber); const uint16 *getNextFrame(); From acfa7ff3e11bf9024451a6e3505f5f07d5646e1f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:05:15 -0500 Subject: [PATCH 0878/1332] ZVISION: Add scr parse line for ActionAssign It was already implemented, just not added to the scr parsing --- engines/zvision/scr_file_handling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 06767c534000..378408df665d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -168,7 +168,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:attenuate*", true)) { // TODO: Implement ActionAttenuate } else if (line.matchString("*:assign*", true)) { - // TODO: Implement ActionAssign + actionList.push_back(new ActionAssign(line)); } else if (line.matchString("*:change_location*", true)) { actionList.push_back(new ActionChangeLocation(line)); } else if (line.matchString("*:crossfade*", true)) { From 81184d342c6c03932d4c9c4620302283a09273be Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:05:47 -0500 Subject: [PATCH 0879/1332] ZVISION: Delete a Control * when removing it from _activeControls --- engines/zvision/script_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 0af1ff131ab0..f499adaa44c8 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -108,6 +108,7 @@ void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { if ((*iter)->process(deltaTimeMillis)) { + delete (*iter); // Remove the node iter = _activeControls.erase(iter); } else { From eeace477a08d68ead85d39b90084b4e633a6127a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:06:20 -0500 Subject: [PATCH 0880/1332] ZVISION: Set a Puzzle as completed before executing its ResultActions --- engines/zvision/script_manager.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index f499adaa44c8..4952ebdda4b4 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -174,7 +174,8 @@ void ScriptManager::checkPuzzleCriteria() { if (puzzle->criteriaList.empty() || criteriaMet) { debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); - uint32 key = puzzle->key; + // Set the puzzle as completed + setStateValue(puzzle->key, 1); bool shouldContinue = true; for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { @@ -184,9 +185,6 @@ void ScriptManager::checkPuzzleCriteria() { } } - // Set the puzzle as completed - setStateValue(key, 1); - if (!shouldContinue) { break; } From f783f2c28a13e9513ec6a0fc0fccac22d3502d2d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 10:29:38 +0200 Subject: [PATCH 0881/1332] AVALANCHE: Silent some CppCheck warnings, rename some loop variables --- engines/avalanche/animation.cpp | 28 +++++++++++----------------- engines/avalanche/detection.cpp | 3 +-- engines/avalanche/dropdown2.cpp | 3 +-- engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 8 +++++--- engines/avalanche/visa2.cpp | 19 ++++++++++--------- engines/avalanche/visa2.h | 2 +- 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 127fbf91782c..6b6138ca0264 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -184,11 +184,8 @@ bool AnimationType::checkCollision() { } void AnimationType::walk() { - byte tc; - ByteField r; - - if (_visible) { + ByteField r; r._x1 = (_x / 8) - 1; if (r._x1 == 255) r._x1 = 0; @@ -204,8 +201,8 @@ void AnimationType::walk() { _oldY[_tr->_vm->_gyro->_cp] = _y; if (_homing) homestep(); - _x = _x + _moveX; - _y = _y + _moveY; + _x += _moveX; + _y += _moveY; } if (_doCheck) { @@ -214,7 +211,7 @@ void AnimationType::walk() { return; } - tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { @@ -475,11 +472,8 @@ void Animation::loadtrip() { } byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - byte a, c; - int16 fv, ff; - // if not alive then begin checkfeet:=0; exit; end; - a = 0; + byte a = 0; //setactivepage(2); if (x1 < 0) @@ -487,17 +481,17 @@ byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { if (x2 > 639) x2 = 639; if (oy < y) { - for (fv = x1; fv <= x2; fv++) { - for (ff = oy + yl; ff <= y + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + for (int16 i = x1; i <= x2; i++) { + for (int16 j = oy + yl; j <= y + yl; j++) { + byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); if (c > a) a = c; } } } else { - for (fv = x1; fv <= x2; fv++) { - for (ff = y + yl; ff <= oy + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + for (int16 i = x1; i <= x2; i++) { + for (int16 j = y + yl; j <= oy + yl; j++) { + byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); if (c > a) a = c; } diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 39c6f0836f15..97b823eb1d1a 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -117,13 +117,12 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { SaveStateList saveList; char slot[3]; - int slotNum = 0; for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { slot[0] = filename->c_str()[filename->size() - 6]; slot[1] = filename->c_str()[filename->size() - 5]; slot[2] = '\0'; // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot - slotNum = atoi(slot); + int slotNum = atoi(slot); if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { Common::InSaveFile *file = saveFileMan->openForLoading(*filename); if (file) { diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 74d0a2582345..33a2671a8bb0 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -168,9 +168,8 @@ void MenuItem::wipe() { } void MenuItem::moveHighlight(int8 inc) { - int8 highlightNum; if (inc != 0) { - highlightNum = _highlightNum + inc; + int8 highlightNum = _highlightNum + inc; if ((highlightNum < 0) || (highlightNum >= _optionNum)) return; _highlightNum = highlightNum; diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index e522254ab2ce..3ebb47ed98d0 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -53,7 +53,7 @@ void Pingo::bossKey() { const months : array[0..11] of char = 'JFMAMJJASOND'; title = 'Net Profits'; - fish = #224; { } + fish = 224; // '' var fv:byte; gd,gm:int16; r:char; begin; dusk; delavvy; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 62f2fe3bf3d7..c79002a61275 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -356,7 +356,8 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); - ex = mx - lx; +// CHECKME: unused? +// ex = mx - lx; // int16 ey = my - ly; mx -= lx; my -= ly + 2; @@ -466,7 +467,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { if (textWidth > xl) xl = textWidth; } - xl = xl / 2; + xl /= 2; int16 xw = xl + 18; int16 yw = yl + 7; @@ -505,7 +506,8 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); - yl -= 3; + // CHECKME: Unused? + // yl -= 3; // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 66f1faf4c86f..b31b64bcf9fc 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -43,6 +43,7 @@ namespace Avalanche { Visa::Visa(AvalancheEngine *vm) { _vm = vm; + noError = true; } void Visa::unskrimble() { @@ -77,7 +78,7 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { indexfile.close(); - went_ok = !error; + noError = !error; if (error) { if (report) { @@ -106,7 +107,6 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { void Visa::speech(byte who, byte subject) { Common::File indexfile, sezfile; - uint16 idx_offset, sez_offset, next_idx_offset; if (subject == 0) { // No subject. @@ -114,7 +114,7 @@ void Visa::speech(byte who, byte subject) { } else { // Subject given. - went_ok = false; // Assume that until we know otherwise. + noError = false; // Assume that until we know otherwise. if (!indexfile.open("converse.avd")) { warning("AVALANCHE: Visa: File not found: converse.avd"); @@ -122,13 +122,14 @@ void Visa::speech(byte who, byte subject) { } indexfile.seek(who * 2 - 2); - idx_offset = indexfile.readUint16LE(); - next_idx_offset = indexfile.readUint16LE(); + uint16 idx_offset = indexfile.readUint16LE(); + uint16 next_idx_offset = indexfile.readUint16LE(); - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) + return; indexfile.seek(idx_offset + subject * 2); - sez_offset = indexfile.readUint16LE(); + uint16 sez_offset = indexfile.readUint16LE(); if ((sez_offset == 0) || (indexfile.err())) return; indexfile.close(); @@ -146,7 +147,7 @@ void Visa::speech(byte who, byte subject) { do_the_bubble(); _vm->_scrolls->callScrollDriver(); - went_ok = true; + noError = true; } warning("STUB: Visa::speech()"); @@ -263,7 +264,7 @@ void Visa::talkto(byte whom) { speech(whom, _vm->_gyro->_subjectNum); - if (!went_ok) + if (!noError) dixi('n', whom); // File not found! if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 9d26d7a747e1..2d12e3322ddb 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -44,7 +44,7 @@ class Visa { private: AvalancheEngine *_vm; - bool went_ok; + bool noError; void unskrimble(); void do_the_bubble(); void speech(byte who, byte subject); From 8a4a5b3c56d86e846617f03703a8003dba2936ef Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 10:48:22 +0200 Subject: [PATCH 0882/1332] AVALANCHE: Renaming in timeout2.h --- engines/avalanche/acci2.cpp | 26 +-- engines/avalanche/animation.cpp | 18 +- engines/avalanche/avalanche.cpp | 6 +- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 28 +-- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/sequence2.cpp | 4 +- engines/avalanche/timeout2.cpp | 298 ++++++++++++++++---------------- engines/avalanche/timeout2.h | 220 ++++++++++------------- 9 files changed, 279 insertions(+), 325 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index bdbb6174d362..2b223b7fd6e2 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -379,7 +379,7 @@ void Acci::storeInterrogation(byte interrogation) { while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - _vm->_timeout->lose_timer(_vm->_timeout->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. + _vm->_timeout->loseTimer(_vm->_timeout->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { case 1: @@ -419,7 +419,7 @@ void Acci::storeInterrogation(byte interrogation) { } if (interrogation < 4) - _vm->_timeout->cardiff_survey(); + _vm->_timeout->cardiffSurvey(); } @@ -1041,7 +1041,7 @@ void Acci::notInOrder() { void Acci::goToCauldron() { _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->kReasonSpludWalk); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcSpludwickGoesToCauldron, _vm->_timeout->kReasonSpludWalk); _vm->_animation->tr[1].walkto(2); } @@ -1143,7 +1143,7 @@ void Acci::standUp() { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; - _vm->_timeout->lose_timer(_vm->_timeout->kReasonArkataShouts); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonArkataShouts); } else already(); break; @@ -1242,7 +1242,7 @@ void Acci::giveGeidaTheLute() { _vm->_lucerna->refreshObjectList(); _vm->_visa->dixi('q', 64); // She plays it. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->kReasonGeidaSings); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcGiveLuteToGeida, _vm->_timeout->kReasonGeidaSings); _vm->_enid->backToBootstrap(4); } @@ -1259,7 +1259,7 @@ void Acci::winSequence() { _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); _vm->_sequence->startToClose(); - _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->kReasonWinning); + _vm->_timeout->addTimer(30, _vm->_timeout->kProcWinning, _vm->_timeout->kReasonWinning); } void Acci::personSpeaks() { @@ -1682,7 +1682,7 @@ void Acci::doThat() { case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); - _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->kReasonGoToToilet); + _vm->_timeout->addTimer(4, _vm->_timeout->kProcUrinate, _vm->_timeout->kReasonGoToToilet); } else _vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); @@ -1706,7 +1706,7 @@ void Acci::doThat() { _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; - _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->kReasonAvariciusTalks); + _vm->_timeout->addTimer(177, _vm->_timeout->kProcAvariciusTalks, _vm->_timeout->kReasonAvariciusTalks); } } else _vm->_scrolls->displayText("Nothing appears to happen..."); @@ -1769,7 +1769,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->kReasonDrinks); + _vm->_timeout->addTimer(27, _vm->_timeout->kProcBuyDrinks, _vm->_timeout->kReasonDrinks); break; case 52: examine(); @@ -1795,7 +1795,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->kReasonDrinks); + _vm->_timeout->addTimer(27, _vm->_timeout->kProcBuyWine, _vm->_timeout->kReasonDrinks); } break; } @@ -1892,7 +1892,7 @@ void Acci::doThat() { else { _vm->_lucerna->incScore(4); _vm->_scrolls->displayText("The drawbridge opens!"); - _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->kReasonDrawbridgeFalls); + _vm->_timeout->addTimer(7, _vm->_timeout->kProcOpenDrawbridge, _vm->_timeout->kReasonDrawbridgeFalls); _vm->_gyro->_dna._drawbridgeOpen = 1; } } else @@ -1944,7 +1944,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: - _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->kReasonJumping); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcJump, _vm->_timeout->kReasonJumping); _vm->_gyro->_dna._userMovesAvvy = false; break; case kVerbCodeHiscores: @@ -1985,7 +1985,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. - _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->kReasonSittingDown); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcAvvySitDown, _vm->_timeout->kReasonSittingDown); } } else { // Default doodah. _vm->_lucerna->dusk(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 127fbf91782c..7fbcf892c1ec 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -840,7 +840,7 @@ void Animation::catamove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Animation::dawndelay() { - _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->kReasonDawndelay); + _vm->_timeout->addTimer(2, _vm->_timeout->kProcDawnDelay, _vm->_timeout->kReasonDawndelay); } void Animation::call_special(uint16 which) { @@ -849,7 +849,7 @@ void Animation::call_special(uint16 which) { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_dna._brummieStairs = 1; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->kReasonBrummieStairs); + _vm->_timeout->addTimer(10, _vm->_timeout->kProcStairs, _vm->_timeout->kReasonBrummieStairs); stopWalking(); _vm->_gyro->_dna._userMovesAvvy = false; break; @@ -883,7 +883,7 @@ void Animation::call_special(uint16 which) { case 4: // This is the ghost room link. _vm->_lucerna->dusk(); tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap - _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->kReasonGhostRoomPhew); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcGhostRoomPhew, _vm->_timeout->kReasonGhostRoomPhew); _vm->_enid->backToBootstrap(3); break; case 5: @@ -901,7 +901,7 @@ void Animation::call_special(uint16 which) { tr[1]._vanishIfStill = true; tr[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. - _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->kReasonHangingAround); + _vm->_timeout->addTimer(364, _vm->_timeout->kProcHangAround, _vm->_timeout->kReasonHangingAround); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. @@ -909,17 +909,17 @@ void Animation::call_special(uint16 which) { tr[0]._moveX = 3; tr[0]._moveY = 0; tr[0]._facingDir = kDirRight; - _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->kReasonFallingDownOubliette); + _vm->_timeout->addTimer(1, _vm->_timeout->kProcFallDownOubliette, _vm->_timeout->kReasonFallingDownOubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopWalking(); - _vm->_timeout->lose_timer(_vm->_timeout->kReasonFallingDownOubliette); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->kReasonMeetingAvaroid); + _vm->_timeout->addTimer(200, _vm->_timeout->kProcMeetAvaroid, _vm->_timeout->kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { @@ -937,7 +937,7 @@ void Animation::call_special(uint16 which) { tr[1].walkto(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->kReasonRobinHoodAndGeida); + _vm->_timeout->addTimer(40, _vm->_timeout->kProcRobinHoodAndGeida, _vm->_timeout->kReasonRobinHoodAndGeida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { @@ -1223,7 +1223,7 @@ void Animation::arrow_procs(byte tripnum) { _vm->_lucerna->gameOver(); _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. - _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->kReasonNaughtyDuke); + _vm->_timeout->addTimer(55, _vm->_timeout->kProcNaughtyDuke, _vm->_timeout->kReasonNaughtyDuke); } } else { // Arrow has hit the wall! tr[tripnum].done(); // Deallocate the arrow. diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 34391652240d..6d921ce6f556 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -335,9 +335,9 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. for (byte i = 0; i < 7; i++) { - sz.syncAsSint32LE(_timeout->times[i].time_left); - sz.syncAsByte(_timeout->times[i].then_where); - sz.syncAsByte(_timeout->times[i].what_for); + sz.syncAsSint32LE(_timeout->_times[i]._timeLeft); + sz.syncAsByte(_timeout->_times[i]._thenWhere); + sz.syncAsByte(_timeout->_times[i]._whatFor); } //blockwrite(f, seq, sizeof(seq)); // Sequencer information. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ee805efb70f7..052619c48fbc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -205,7 +205,7 @@ void Avalot::run(Common::String arg) { _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); - _vm->_timeout->one_tick(); + _vm->_timeout->updateTimer(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a6c6286b47b6..07fe6b42703d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -340,21 +340,21 @@ void Lucerna::exitRoom(byte x) { switch (x) { case r__spludwicks: - _vm->_timeout->lose_timer(_vm->_timeout->kReasonAvariciusTalks); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonAvariciusTalks); _vm->_gyro->_dna._avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: if (_vm->_gyro->_dna._drawbridgeOpen > 0) { _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. - _vm->_timeout->lose_timer(_vm->_timeout->kReasonDrawbridgeFalls); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonDrawbridgeFalls); } break; case r__outsidecardiffcastle: - _vm->_timeout->lose_timer(_vm->_timeout->kReasonCardiffsurvey); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonCardiffsurvey); break; case r__robins: - _vm->_timeout->lose_timer(_vm->_timeout->kReasonGettingTiedUp); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonGettingTiedUp); break; } @@ -436,7 +436,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->kReasonArkataShouts); + _vm->_timeout->addTimer(100, _vm->_timeout->kProcArkataShouts, _vm->_timeout->kReasonArkataShouts); } break; @@ -464,7 +464,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(8, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(4); - _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->kReasonCrapulusSaysSpludwickOut); + _vm->_timeout->addTimer(20, _vm->_timeout->kProcCrapulusSpludOut, _vm->_timeout->kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } } @@ -472,7 +472,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->kReasonExplosion); + _vm->_timeout->addTimer(20, _vm->_timeout->kProcBang, _vm->_timeout->kReasonExplosion); _vm->_gyro->_dna._spludwickAtHome = true; } break; @@ -527,7 +527,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->kReasonCwytalotInHerts); + _vm->_timeout->addTimer(20, _vm->_timeout->kProcCwytalotInHerts, _vm->_timeout->kReasonCwytalotInHerts); } break; @@ -548,7 +548,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(6, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->kReasonGettingTiedUp); + _vm->_timeout->addTimer(36, _vm->_timeout->kProcGetTiedUp, _vm->_timeout->kReasonGettingTiedUp); } } @@ -572,7 +572,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->kReasonCardiffsurvey); + _vm->_timeout->addTimer(47, _vm->_timeout->kProcCardiffSurvey, _vm->_timeout->kReasonCardiffsurvey); } break; case 5 : @@ -582,7 +582,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 3); _vm->_animation->tr[1]._facingDir = Animation::kDirRight; - _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->kReasonCardiffsurvey); + _vm->_timeout->addTimer(3, _vm->_timeout->kProcCardiffReturn, _vm->_timeout->kReasonCardiffsurvey); } } if (_vm->_gyro->_dna._cardiffQuestionNum < 5) @@ -650,10 +650,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes - _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->kReasonDuLustieTalks); + _vm->_timeout->addTimer(3, _vm->_timeout->kProcCallsGuards, _vm->_timeout->kReasonDuLustieTalks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->kReasonDuLustieTalks); + _vm->_timeout->addTimer(3, _vm->_timeout->kProcGreetsMonk, _vm->_timeout->kReasonDuLustieTalks); if (_vm->_gyro->_dna._geidaFollows) { putGeidaAt(5, ped); @@ -1190,7 +1190,7 @@ void Lucerna::gameOver() { _vm->_animation->tr[0]._stepNum = 0; _vm->_animation->tr[0].appear(sx, sy, 0); - _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->kReasonFallingOver); + _vm->_timeout->addTimer(3, _vm->_timeout->kProcAvalotFalls, _vm->_timeout->kReasonFallingOver); _vm->_gyro->_alive = false; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 62f2fe3bf3d7..3c9fbefd5119 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -219,7 +219,7 @@ void Scrolls::scrollModeMusic() { setReadyLight(0); _vm->_gyro->_seeScroll = false; - _vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->kReasonJacquesWakingUp); + _vm->_timeout->addTimer(8, _vm->_timeout->kProcJacquesWakesUp, _vm->_timeout->kReasonJacquesWakingUp); warning("STUB: Scrolls::music_scroll()"); return; #if 0 diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index e233b1300aa5..8f8a3db39147 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -69,8 +69,8 @@ void Sequence::thenFlip(byte where, byte ped) { } void Sequence::startToClose() { - _vm->_timeout->lose_timer(_vm->_timeout->kReasonSequencer); - _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->kReasonSequencer); + _vm->_timeout->loseTimer(_vm->_timeout->kReasonSequencer); + _vm->_timeout->addTimer(7, _vm->_timeout->kProcSequence, _vm->_timeout->kReasonSequencer); } void Sequence::startToOpen() { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index df2ba941f3a6..5a73db20caea 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -47,163 +47,163 @@ Timeout::Timeout(AvalancheEngine *vm) { _vm = vm; for (byte i = 0; i < 7; i++) { - times[i].time_left = 0; - times[i].then_where = 0; - times[i].what_for = 0; + _times[i]._timeLeft = 0; + _times[i]._thenWhere = 0; + _times[i]._whatFor = 0; } } -void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { - if ((_vm->_gyro->isLoaded == false) || (timerLost == true)) { +void Timeout::addTimer(int32 howlong, byte whither, byte why) { + if ((_vm->_gyro->isLoaded == false) || (_timerLost == true)) { byte i = 0; - while ((i < 7) && (times[i].time_left != 0)) + while ((i < 7) && (_times[i]._timeLeft != 0)) i++; if (i == 7) return; // Oh dear... // Everything's OK here! - times[i].time_left = howlong; - times[i].then_where = whither; - times[i].what_for = why; + _times[i]._timeLeft = howlong; + _times[i]._thenWhere = whither; + _times[i]._whatFor = why; } else { _vm->_gyro->isLoaded = false; return; } } -void Timeout::one_tick() { +void Timeout::updateTimer() { if (_vm->_gyro->_dropdownActive) return; for (byte fv = 0; fv < 7; fv++) { - if (times[fv].time_left > 0) { - times[fv].time_left--; + if (_times[fv]._timeLeft > 0) { + _times[fv]._timeLeft--; - if (times[fv].time_left == 0) { - switch (times[fv].then_where) { - case procopen_drawbridge : - open_drawbridge(); + if (_times[fv]._timeLeft == 0) { + switch (_times[fv]._thenWhere) { + case kProcOpenDrawbridge : + openDrawbridge(); break; - case procavaricius_talks : - avaricius_talks(); + case kProcAvariciusTalks : + avariciusTalks(); break; - case procurinate : + case kProcUrinate : urinate(); break; - case proctoilet2 : - toilet2(); + case kProcToilet : + toilet(); break; - case procbang: + case kProcBang: bang(); break; - case procbang2: + case kProcBang2: bang2(); break; - case procstairs: + case kProcStairs: stairs(); break; - case proccardiffsurvey: - cardiff_survey(); + case kProcCardiffSurvey: + cardiffSurvey(); break; - case proccardiff_return: - cardiff_return(); + case kProcCardiffReturn: + cardiffReturn(); break; - case proc_cwytalot_in_herts: - cwytalot_in_herts(); + case kProcCwytalotInHerts: + cwytalotInHerts(); break; - case procget_tied_up: - get_tied_up(); + case kProcGetTiedUp: + getTiedUp(); break; - case procget_tied_up2: - get_tied_up2(); + case kProcGetTiedUp2: + getTiedUp2(); break; - case prochang_around: - hang_around(); + case kProcHangAround: + hangAround(); break; - case prochang_around2: - hang_around2(); + case kProcHangAround2: + hangAround2(); break; - case procafter_the_shootemup: - after_the_shootemup(); + case kProcAfterTheShootemup: + afterTheShootemup(); break; - case procjacques_wakes_up: - jacques_wakes_up(); + case kProcJacquesWakesUp: + jacquesWakesUp(); break; - case procnaughty_duke: - naughty_duke(); + case kProcNaughtyDuke: + naughtyDuke(); break; - case procnaughty_duke2: - naughty_duke2(); + case kProcNaughtyDuke2: + naughtyDuke2(); break; - case procnaughty_duke3: - naughty_duke3(); + case kProcNaughtyDuke3: + naughtyDuke3(); break; - case procjump: + case kProcJump: jump(); break; - case procsequence: + case kProcSequence: _vm->_sequence->callSequencer(); break; - case proccrapulus_splud_out: - crapulus_says_splud_out(); + case kProcCrapulusSpludOut: + crapulusSaysSpludOut(); break; - case procdawn_delay: + case kProcDawnDelay: _vm->_lucerna->dawn(); break; - case procbuydrinks: - buydrinks(); + case kProcBuyDrinks: + buyDrinks(); break; - case procbuywine: - buywine(); + case kProcBuyWine: + buyWine(); break; - case proccallsguards: - callsguards(); + case kProcCallsGuards: + callsGuards(); break; - case procgreetsmonk: - greetsmonk(); + case kProcGreetsMonk: + greetsMonk(); break; - case procfall_down_oubliette: - fall_down_oubliette(); + case kProcFallDownOubliette: + fallDownOubliette(); break; - case procmeet_avaroid: - meet_avaroid(); + case kProcMeetAvaroid: + meetAvaroid(); break; - case procrise_up_oubliette: - rise_up_oubliette(); + case kProcRiseUpOubliette: + riseUpOubliette(); break; - case procrobin_hood_and_geida: - robin_hood_and_geida(); + case kProcRobinHoodAndGeida: + robinHoodAndGeida(); break; - case procrobin_hood_and_geida_talk: - robin_hood_and_geida_talk(); + case kProcRobinHoodAndGeidaTalk: + robinHoodAndGeidaTalk(); break; - case procavalot_returns: - avalot_returns(); + case kProcAvalotReturns: + avalotReturns(); break; - case procavvy_sit_down: - avvy_sit_down(); + case kProcAvvySitDown: + avvySitDown(); break; - case procghost_room_phew: - ghost_room_phew(); + case kProcGhostRoomPhew: + ghostRoomPhew(); break; - case procarkata_shouts: - arkata_shouts(); + case kProcArkataShouts: + arkataShouts(); break; - case procwinning: + case kProcWinning: winning(); break; - case procavalot_falls: - avalot_falls(); + case kProcAvalotFalls: + avalotFalls(); break; - case procspludwick_goes_to_cauldron: - spludwick_goes_to_cauldron(); + case kProcSpludwickGoesToCauldron: + spludwickGoesToCauldron(); break; - case procspludwick_leaves_cauldron: - spludwick_leaves_cauldron(); + case kProcSpludwickLeavesCauldron: + spludwickLeavesCauldron(); break; - case procgive_lute_to_geida: - give_lute_to_geida(); + case kProcGiveLuteToGeida: + giveLuteToGeida(); break; } } @@ -213,31 +213,31 @@ void Timeout::one_tick() { _vm->_gyro->_dna._totalTime++; // Total amount of time for this game. } -void Timeout::lose_timer(byte which) { +void Timeout::loseTimer(byte which) { for (byte fv = 0; fv < 7; fv++) { - if (times[fv].what_for == which) - times[fv].time_left = 0; // Cancel this one! + if (_times[fv]._whatFor == which) + _times[fv]._timeLeft = 0; // Cancel this one! } - timerLost = true; + _timerLost = true; } -void Timeout::open_drawbridge() { +void Timeout::openDrawbridge() { _vm->_gyro->_dna._drawbridgeOpen++; _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_dna._drawbridgeOpen - 1); if (_vm->_gyro->_dna._drawbridgeOpen == 4) _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. else - set_up_timer(7, procopen_drawbridge, kReasonDrawbridgeFalls); + addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } -void Timeout::avaricius_talks() { +void Timeout::avariciusTalks() { _vm->_visa->dixi('q', _vm->_gyro->_dna._avariciusTalk); _vm->_gyro->_dna._avariciusTalk++; if (_vm->_gyro->_dna._avariciusTalk < 17) - set_up_timer(177, procavaricius_talks, kReasonAvariciusTalks); + addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); else _vm->_lucerna->incScore(3); } @@ -246,16 +246,16 @@ void Timeout::urinate() { _vm->_animation->tr[0].turn(Animation::kDirUp); _vm->_animation->stopWalking(); _vm->_lucerna->drawDirection(); - set_up_timer(14, proctoilet2, kReasonGoToToilet); + addTimer(14, kProcToilet, kReasonGoToToilet); } -void Timeout::toilet2() { +void Timeout::toilet() { _vm->_scrolls->displayText("That's better!"); } void Timeout::bang() { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); - set_up_timer(30, procbang2, kReasonExplosion); + addTimer(30, kProcBang2, kReasonExplosion); } void Timeout::bang2() { @@ -272,7 +272,7 @@ void Timeout::stairs() { _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) } -void Timeout::cardiff_survey() { +void Timeout::cardiffSurvey() { if (_vm->_gyro->_dna._cardiffQuestionNum == 0) { _vm->_gyro->_dna._cardiffQuestionNum++; _vm->_visa->dixi('q', 27); @@ -282,19 +282,19 @@ void Timeout::cardiff_survey() { _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; - set_up_timer(182, proccardiffsurvey, kReasonCardiffsurvey); + addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } -void Timeout::cardiff_return() { +void Timeout::cardiffReturn() { _vm->_visa->dixi('q', 28); - cardiff_survey(); // Add end of question. + cardiffSurvey(); // Add end of question. } -void Timeout::cwytalot_in_herts() { +void Timeout::cwytalotInHerts() { _vm->_visa->dixi('q', 29); } -void Timeout::get_tied_up() { +void Timeout::getTiedUp() { _vm->_visa->dixi('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; @@ -303,27 +303,27 @@ void Timeout::get_tied_up() { _vm->_animation->tr[1].stophoming(); _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; - set_up_timer(70, procget_tied_up2, kReasonGettingTiedUp); + addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } -void Timeout::get_tied_up2() { +void Timeout::getTiedUp2() { _vm->_animation->tr[0].walkto(4); _vm->_animation->tr[1].walkto(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } -void Timeout::hang_around() { +void Timeout::hangAround() { _vm->_animation->tr[1]._doCheck = false; _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; _vm->_animation->apped(1, 2); _vm->_visa->dixi('q', 39); _vm->_animation->tr[0].walkto(7); - set_up_timer(55, prochang_around2, kReasonHangingAround); + addTimer(55, kProcHangAround2, kReasonHangingAround); } -void Timeout::hang_around2() { +void Timeout::hangAround2() { _vm->_visa->dixi('q', 40); _vm->_animation->tr[1]._vanishIfStill = false; _vm->_animation->tr[1].walkto(4); @@ -332,7 +332,7 @@ void Timeout::hang_around2() { _vm->_animation->tr[0].done(); _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. - set_up_timer(1, procafter_the_shootemup, kReasonHangingAround); + addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). _vm->_gyro->_dna._tiedUp = false; @@ -340,7 +340,7 @@ void Timeout::hang_around2() { _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. } -void Timeout::after_the_shootemup() { +void Timeout::afterTheShootemup() { _vm->_animation->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! @@ -376,7 +376,7 @@ void Timeout::after_the_shootemup() { _vm->_visa->dixi('q', 70); } -void Timeout::jacques_wakes_up() { +void Timeout::jacquesWakesUp() { _vm->_gyro->_dna._jacquesState++; switch (_vm->_gyro->_dna._jacquesState) { // Additional pictures. @@ -406,15 +406,15 @@ void Timeout::jacques_wakes_up() { case 1: case 2: case 3: - set_up_timer(12, procjacques_wakes_up, kReasonJacquesWakingUp); + addTimer(12, kProcJacquesWakesUp, kReasonJacquesWakingUp); break; case 4: - set_up_timer(24, procjacques_wakes_up, kReasonJacquesWakingUp); + addTimer(24, kProcJacquesWakesUp, kReasonJacquesWakingUp); break; } } -void Timeout::naughty_duke() { // This is when the Duke comes in and takes your money. +void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your money. _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->apped(2, 1); // He starts at the door... _vm->_animation->tr[1].walkto(3); // He walks over to you. @@ -424,17 +424,17 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); - set_up_timer(50, procnaughty_duke2, kReasonNaughtyDuke); + addTimer(50, kProcNaughtyDuke2, kReasonNaughtyDuke); } -void Timeout::naughty_duke2() { +void Timeout::naughtyDuke2() { _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" _vm->_animation->tr[1].walkto(1); // Walk to the door. _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! - set_up_timer(32, procnaughty_duke3, kReasonNaughtyDuke); + addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } -void Timeout::naughty_duke3() { +void Timeout::naughtyDuke3() { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); @@ -466,7 +466,7 @@ void Timeout::jump() { _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._jumpStatus = 0; } else { // Still jumping. - set_up_timer(1, procjump, kReasonJumping); + addTimer(1, kProcJump, kReasonJumping); } if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. @@ -487,12 +487,12 @@ void Timeout::jump() { } } -void Timeout::crapulus_says_splud_out() { +void Timeout::crapulusSaysSpludOut() { _vm->_visa->dixi('q', 56); _vm->_gyro->_dna._crapulusWillTell = false; } -void Timeout::buydrinks() { +void Timeout::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; @@ -504,7 +504,7 @@ void Timeout::buydrinks() { _vm->_acci->drink(); } -void Timeout::buywine() { +void Timeout::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; @@ -518,24 +518,24 @@ void Timeout::buywine() { } } -void Timeout::callsguards() { +void Timeout::callsGuards() { _vm->_visa->dixi('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } -void Timeout::greetsmonk() { +void Timeout::greetsMonk() { _vm->_visa->dixi('Q', 59); _vm->_gyro->_dna._enteredLustiesRoomAsMonk = true; } -void Timeout::fall_down_oubliette() { +void Timeout::fallDownOubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; _vm->_animation->tr[0]._moveY++; // Increments dx/dy! _vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go... - set_up_timer(3, procfall_down_oubliette, kReasonFallingDownOubliette); + addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); } -void Timeout::meet_avaroid() { +void Timeout::meetAvaroid() { if (_vm->_gyro->_dna._metAvaroid) { _vm->_scrolls->displayText(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); @@ -543,7 +543,7 @@ void Timeout::meet_avaroid() { } else { _vm->_visa->dixi('Q', 60); _vm->_gyro->_dna._metAvaroid = true; - set_up_timer(1, procrise_up_oubliette, kReasonRisingUpOubliette); + addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); _vm->_animation->tr[0]._facingDir = Animation::kDirLeft; _vm->_animation->tr[0]._x = 151; @@ -554,36 +554,36 @@ void Timeout::meet_avaroid() { } } -void Timeout::rise_up_oubliette() { +void Timeout::riseUpOubliette() { _vm->_animation->tr[0]._visible = true; _vm->_animation->tr[0]._moveY++; // Decrements dx/dy! _vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go... if (_vm->_animation->tr[0]._moveY > 0) - set_up_timer(3, procrise_up_oubliette, kReasonRisingUpOubliette); + addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else _vm->_gyro->_dna._userMovesAvvy = true; } -void Timeout::robin_hood_and_geida() { +void Timeout::robinHoodAndGeida() { _vm->_animation->tr[0].init(7, true, _vm->_animation); _vm->_animation->apped(1, 7); _vm->_animation->tr[0].walkto(6); _vm->_animation->tr[1].stopWalk(); _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; - set_up_timer(20, procrobin_hood_and_geida_talk, kReasonRobinHoodAndGeida); + addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); _vm->_gyro->_dna._geidaFollows = false; } -void Timeout::robin_hood_and_geida_talk() { +void Timeout::robinHoodAndGeidaTalk() { _vm->_visa->dixi('q', 66); _vm->_animation->tr[0].walkto(2); _vm->_animation->tr[1].walkto(2); _vm->_animation->tr[0]._vanishIfStill = true; _vm->_animation->tr[1]._vanishIfStill = true; - set_up_timer(162, procavalot_returns, kReasonRobinHoodAndGeida); + addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); } -void Timeout::avalot_returns() { +void Timeout::avalotReturns() { _vm->_animation->tr[0].done(); _vm->_animation->tr[1].done(); _vm->_animation->tr[0].init(0, true, _vm->_animation); @@ -592,10 +592,10 @@ void Timeout::avalot_returns() { _vm->_gyro->_dna._userMovesAvvy = true; } -void Timeout::avvy_sit_down() { +void Timeout::avvySitDown() { // This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. if (_vm->_animation->tr[0]._homing) // Still walking. - set_up_timer(1, procavvy_sit_down, kReasonSittingDown); + addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dna._sittingInPub = true; @@ -604,18 +604,18 @@ void Timeout::avvy_sit_down() { } } -void Timeout::ghost_room_phew() { +void Timeout::ghostRoomPhew() { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman + " You're glad to get out of " + _vm->_scrolls->kControlItalic + "there!"); } -void Timeout::arkata_shouts() { +void Timeout::arkataShouts() { if (_vm->_gyro->_dna._teetotal) return; _vm->_visa->dixi('q', 76); - set_up_timer(160, procarkata_shouts, kReasonArkataShouts); + addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timeout::winning() { @@ -635,10 +635,10 @@ void Timeout::winning() { _vm->_gyro->_letMeOut = true; } -void Timeout::avalot_falls() { +void Timeout::avalotFalls() { if (_vm->_animation->tr[0]._stepNum < 5) { _vm->_animation->tr[0]._stepNum++; - set_up_timer(3, procavalot_falls, kReasonFallingOver); + addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay; for (byte i = 0; i < 6; i++) @@ -650,18 +650,18 @@ void Timeout::avalot_falls() { } } -void Timeout::spludwick_goes_to_cauldron() { +void Timeout::spludwickGoesToCauldron() { if (_vm->_animation->tr[1]._homing) - set_up_timer(1, procspludwick_goes_to_cauldron, kReasonSpludWalk); + addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludWalk); else - set_up_timer(17, procspludwick_leaves_cauldron, kReasonSpludWalk); + addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludWalk); } -void Timeout::spludwick_leaves_cauldron() { +void Timeout::spludwickLeavesCauldron() { _vm->_animation->tr[1]._callEachStepFl = true; // So that normal procs will continue. } -void Timeout::give_lute_to_geida() { // Moved here from Acci. +void Timeout::giveLuteToGeida() { // Moved here from Acci. _vm->_visa->dixi('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_dna._lustieIsAsleep = true; diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 8536fefe2c1c..a2223e727574 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -69,156 +69,110 @@ class Timeout { kReasonGeidaSings = 28 }; - // procx now runs between 1 and 41. - - static const int16 procopen_drawbridge = 3; - static const int16 procavaricius_talks = 4; - static const int16 procurinate = 5; - static const int16 proctoilet2 = 6; - static const int16 procbang = 7; - static const int16 procbang2 = 8; - static const int16 procstairs = 9; - static const int16 proccardiffsurvey = 10; - static const int16 proccardiff_return = 11; - static const int16 proc_cwytalot_in_herts = 12; - static const int16 procget_tied_up = 13; - static const int16 procget_tied_up2 = 1; - static const int16 prochang_around = 14; - static const int16 prochang_around2 = 15; - static const int16 procafter_the_shootemup = 32; - static const int16 procjacques_wakes_up = 16; - static const int16 procnaughty_duke = 17; - static const int16 procnaughty_duke2 = 18; - static const int16 procnaughty_duke3 = 38; - static const int16 procjump = 19; - static const int16 procsequence = 20; - static const int16 proccrapulus_splud_out = 21; - static const int16 procdawn_delay = 22; - static const int16 procbuydrinks = 23; - static const int16 procbuywine = 24; - static const int16 proccallsguards = 25; - static const int16 procgreetsmonk = 26; - static const int16 procfall_down_oubliette = 27; - static const int16 procmeet_avaroid = 28; - static const int16 procrise_up_oubliette = 29; - static const int16 procrobin_hood_and_geida = 2; - static const int16 procrobin_hood_and_geida_talk = 30; - static const int16 procavalot_returns = 31; - static const int16 procavvy_sit_down = 33; // In Nottingham. - static const int16 procghost_room_phew = 34; - static const int16 procarkata_shouts = 35; - static const int16 procwinning = 36; - static const int16 procavalot_falls = 37; - static const int16 procspludwick_goes_to_cauldron = 39; - static const int16 procspludwick_leaves_cauldron = 40; - static const int16 procgive_lute_to_geida = 41; - - struct timetype { - int32 time_left; - byte then_where; - byte what_for; + // Proc runs between 1 and 41. + enum Proc { + kProcOpenDrawbridge = 3, + kProcAvariciusTalks = 4, + kProcUrinate = 5, + kProcToilet = 6, + kProcBang = 7, + kProcBang2 = 8, + kProcStairs = 9, + kProcCardiffSurvey = 10, + kProcCardiffReturn = 11, + kProcCwytalotInHerts = 12, + kProcGetTiedUp = 13, + kProcGetTiedUp2 = 1, + kProcHangAround = 14, + kProcHangAround2 = 15, + kProcAfterTheShootemup = 32, + kProcJacquesWakesUp = 16, + kProcNaughtyDuke = 17, + kProcNaughtyDuke2 = 18, + kProcNaughtyDuke3 = 38, + kProcJump = 19, + kProcSequence = 20, + kProcCrapulusSpludOut = 21, + kProcDawnDelay = 22, + kProcBuyDrinks = 23, + kProcBuyWine = 24, + kProcCallsGuards = 25, + kProcGreetsMonk = 26, + kProcFallDownOubliette = 27, + kProcMeetAvaroid = 28, + kProcRiseUpOubliette = 29, + kProcRobinHoodAndGeida = 2, + kProcRobinHoodAndGeidaTalk = 30, + kProcAvalotReturns = 31, + kProcAvvySitDown = 33, // In Nottingham. + kProcGhostRoomPhew = 34, + kProcArkataShouts = 35, + kProcWinning = 36, + kProcAvalotFalls = 37, + kProcSpludwickGoesToCauldron = 39, + kProcSpludwickLeavesCauldron = 40, + kProcGiveLuteToGeida = 41 }; + struct TimeType { + int32 _timeLeft; + byte _thenWhere; + byte _whatFor; + }; - - timetype times[7]; - - bool timerLost; // Is the timer "lost"? (Because of using lose_timer()) - - + TimeType _times[7]; + bool _timerLost; // Is the timer "lost"? (Because of using loseTimer()) Timeout(AvalancheEngine *vm); - void setParent(AvalancheEngine *vm); - - void set_up_timer(int32 howlong, byte whither, byte why); - - void one_tick(); - - void lose_timer(byte which); + void addTimer(int32 howlong, byte whither, byte why); // Original: set_up_timer() + void updateTimer(); // Original: one_tick() + void loseTimer(byte which); // Procedures to do things at the end of amounts of time: - - void open_drawbridge(); - - void avaricius_talks(); - + void openDrawbridge(); + void avariciusTalks(); void urinate(); - - void toilet2(); - + void toilet(); void bang(); - void bang2(); - void stairs(); - - void cardiff_survey(); - - void cardiff_return(); - - void cwytalot_in_herts(); - - void get_tied_up(); - - void get_tied_up2(); - - void hang_around(); - - void hang_around2(); - - void after_the_shootemup(); - - void jacques_wakes_up(); - - void naughty_duke(); - - void naughty_duke2(); - - void naughty_duke3(); - + void cardiffSurvey(); + void cardiffReturn(); + void cwytalotInHerts(); + void getTiedUp(); + void getTiedUp2(); + void hangAround(); + void hangAround2(); + void afterTheShootemup(); + void jacquesWakesUp(); + void naughtyDuke(); + void naughtyDuke2(); + void naughtyDuke3(); void jump(); - - void crapulus_says_splud_out(); - - void buydrinks(); - - void buywine(); - - void callsguards(); - - void greetsmonk(); - - void fall_down_oubliette(); - - void meet_avaroid(); - - void rise_up_oubliette(); - - void robin_hood_and_geida(); - - void robin_hood_and_geida_talk(); - - void avalot_returns(); - - void avvy_sit_down(); - - void ghost_room_phew(); - - void arkata_shouts(); - + void crapulusSaysSpludOut(); + void buyDrinks(); + void buyWine(); + void callsGuards(); + void greetsMonk(); + void fallDownOubliette(); + void meetAvaroid(); + void riseUpOubliette(); + void robinHoodAndGeida(); + void robinHoodAndGeidaTalk(); + void avalotReturns(); + void avvySitDown(); + void ghostRoomPhew(); + void arkataShouts(); void winning(); - - void avalot_falls(); - - void spludwick_goes_to_cauldron(); - - void spludwick_leaves_cauldron(); - - void give_lute_to_geida(); + void avalotFalls(); + void spludwickGoesToCauldron(); + void spludwickLeavesCauldron(); + void giveLuteToGeida(); private: AvalancheEngine *_vm; + }; } // End of namespace Avalanche. From 21ff074fda6d6c3e2f62a9dc0993fd0ef0c375c7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 10:53:33 +0200 Subject: [PATCH 0883/1332] AVALANCHE: Fix uninitialized variable in TimeOut --- engines/avalanche/timeout2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 5a73db20caea..fe1bba53f87d 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -51,6 +51,7 @@ Timeout::Timeout(AvalancheEngine *vm) { _times[i]._thenWhere = 0; _times[i]._whatFor = 0; } + _timerLost = false; } void Timeout::addTimer(int32 howlong, byte whither, byte why) { From 26099360a9cb39dc7670585dc927e86c7078e5bd Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 10:57:44 +0200 Subject: [PATCH 0884/1332] AVALANCHE: Renaming/refactoring in Visa. --- engines/avalanche/visa2.cpp | 72 +++++++++++++++++-------------------- engines/avalanche/visa2.h | 11 +++--- 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index b31b64bcf9fc..8eaa1daf6451 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -38,7 +38,6 @@ #include "common/textconsole.h" - namespace Avalanche { Visa::Visa(AvalancheEngine *vm) { @@ -46,17 +45,17 @@ Visa::Visa(AvalancheEngine *vm) { noError = true; } -void Visa::unskrimble() { - for (uint16 fv = 0; fv < _vm->_gyro->_bufSize; fv++) - _vm->_gyro->_buffer[fv] = (~(_vm->_gyro->_buffer[fv] - (fv + 1))) % 256; +void Visa::unSkrimble() { + for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) + _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; } -void Visa::do_the_bubble() { +void Visa::doTheBubble() { _vm->_gyro->_bufSize++; _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } -void Visa::dixi(char block, byte point, bool report, bool bubbling) { +void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling) { Common::File indexfile, sezfile; uint16 idx_offset, sez_offset; bool error = false; @@ -97,23 +96,20 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { _vm->_gyro->_bufSize = sezfile.readUint16LE(); sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.close(); - unskrimble(); + unSkrimble(); if (bubbling) - do_the_bubble(); + doTheBubble(); _vm->_scrolls->callScrollDriver(); } -void Visa::speech(byte who, byte subject) { +void Visa::speak(byte who, byte subject) { Common::File indexfile, sezfile; - if (subject == 0) { - // No subject. - dixi('s', who, false, true); - } else { - // Subject given. - + if (subject == 0) { // No subject. + displayScrollChain('s', who, false, true); + } else { // Subject given. noError = false; // Assume that until we know otherwise. if (!indexfile.open("converse.avd")) { @@ -143,19 +139,15 @@ void Visa::speech(byte who, byte subject) { sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.close(); - unskrimble(); - do_the_bubble(); + unSkrimble(); + doTheBubble(); _vm->_scrolls->callScrollDriver(); noError = true; } - - warning("STUB: Visa::speech()"); } -void Visa::talkto(byte whom) { - bool no_matches; - +void Visa::talkTo(byte whom) { if (_vm->_acci->_person == _vm->_acci->kPardon) { _vm->_acci->_person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; @@ -165,7 +157,7 @@ void Visa::talkto(byte whom) { switch (whom) { case Gyro::kPeopleSpludwick: if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1])) { - dixi('q', 68); + displayScrollChain('q', 68); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); @@ -182,61 +174,61 @@ void Visa::talkto(byte whom) { } break; case 3: { - dixi('q', 30); // Need any help with the game? + displayScrollChain('q', 30); // Need any help with the game? return; } break; } else { - dixi('q', 42); // Haven't talked to Crapulus. Go and talk to him. + displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. return; } } break; case Gyro::kPeopleIbythneth: if (_vm->_gyro->_dna._givenBadgeToIby) { - dixi('q', 33); // Thanks a lot! + displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. case Gyro::kPeopleDogfood: if (_vm->_gyro->_dna._wonNim) { // We've won the game. - dixi('q', 6); // "I'm Not Playing!" + displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else _vm->_gyro->_dna._askedDogfoodAboutNim = true; break; case Gyro::kPeopleAyles: if (!_vm->_gyro->_dna._aylesIsAwake) { - dixi('q', 43); // He's fast asleep! + displayScrollChain('q', 43); // He's fast asleep! return; } else if (!_vm->_gyro->_dna._givenPenToAyles) { - dixi('q', 44); // Can you get me a pen, Avvy? + displayScrollChain('q', 44); // Can you get me a pen, Avvy? return; } break; case Gyro::kPeopleJacques: { - dixi('q', 43); + displayScrollChain('q', 43); return; } case Gyro::kPeopleGeida: if (_vm->_gyro->_dna._givenPotionToGeida) _vm->_gyro->_dna._geidaFollows = true; else { - dixi('u', 17); + displayScrollChain('u', 17); return; } break; case Gyro::kPeopleSpurge: if (!_vm->_gyro->_dna._sittingInPub) { - dixi('q', 71); // Try going over and sitting down. + displayScrollChain('q', 71); // Try going over and sitting down. return; } else { if (_vm->_gyro->_dna._spurgeTalkCount < 5) _vm->_gyro->_dna._spurgeTalkCount++; if (_vm->_gyro->_dna._spurgeTalkCount > 1) { // no. 1 falls through - dixi('q', 70 + _vm->_gyro->_dna._spurgeTalkCount); + displayScrollChain('q', 70 + _vm->_gyro->_dna._spurgeTalkCount); return; } } @@ -244,33 +236,33 @@ void Visa::talkto(byte whom) { } // On a subject. Is there any reason to block it? else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { - dixi('q', 43); // He's fast asleep! + displayScrollChain('q', 43); // He's fast asleep! return; } if (whom > 149) whom -= 149; - no_matches = true; + bool noMatches = true; for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) if (_vm->_animation->tr[i]._stat.accinum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); - no_matches = false; + noMatches = false; break; } - if (no_matches) + if (noMatches) _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); - speech(whom, _vm->_gyro->_subjectNum); + speak(whom, _vm->_gyro->_subjectNum); if (!noError) - dixi('n', whom); // File not found! + displayScrollChain('n', whom); // File not found! if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = true; _vm->_lucerna->refreshObjectList(); - dixi('q', 1); // Circular from Cardiff. + displayScrollChain('q', 1); // Circular from Cardiff. _vm->_gyro->_dna._talkedToCrapulus = true; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 2d12e3322ddb..7a1597c1c5c8 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -38,16 +38,17 @@ class AvalancheEngine; class Visa { public: Visa(AvalancheEngine *vm); - void dixi(char block, byte point, bool report = true, bool bubbling = false); - void talkto(byte whom); + + void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); // Original: dixi(). + void talkTo(byte whom); private: AvalancheEngine *_vm; bool noError; - void unskrimble(); - void do_the_bubble(); - void speech(byte who, byte subject); + void unSkrimble(); + void doTheBubble(); + void speak(byte who, byte subject); // Original: speech(). }; } // End of namespace Avalanche. From b9c14ccb087801c6d40ee568e51921e62f8a1db2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 11:14:00 +0200 Subject: [PATCH 0885/1332] AVALANCHE: Some more renaming in Timeout. Add some Doxygen comments --- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/timeout2.cpp | 302 +++++++++++++++++--------------- engines/avalanche/timeout2.h | 8 +- 3 files changed, 162 insertions(+), 152 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6d921ce6f556..2e7b7f311523 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -336,8 +336,8 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. for (byte i = 0; i < 7; i++) { sz.syncAsSint32LE(_timeout->_times[i]._timeLeft); - sz.syncAsByte(_timeout->_times[i]._thenWhere); - sz.syncAsByte(_timeout->_times[i]._whatFor); + sz.syncAsByte(_timeout->_times[i]._action); + sz.syncAsByte(_timeout->_times[i]._reason); } //blockwrite(f, seq, sizeof(seq)); // Sequencer information. diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index fe1bba53f87d..fb73ce55c334 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -48,165 +48,174 @@ Timeout::Timeout(AvalancheEngine *vm) { for (byte i = 0; i < 7; i++) { _times[i]._timeLeft = 0; - _times[i]._thenWhere = 0; - _times[i]._whatFor = 0; + _times[i]._action = 0; + _times[i]._reason = 0; } _timerLost = false; } -void Timeout::addTimer(int32 howlong, byte whither, byte why) { +/** + * Add a nex timer + * @remarks Originally called 'set_up_timer' + */ +void Timeout::addTimer(int32 duration, byte action, byte reason) { if ((_vm->_gyro->isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; if (i == 7) - return; // Oh dear... + return; // Oh dear... No timer left // Everything's OK here! - _times[i]._timeLeft = howlong; - _times[i]._thenWhere = whither; - _times[i]._whatFor = why; + _times[i]._timeLeft = duration; + _times[i]._action = action; + _times[i]._reason = reason; } else { _vm->_gyro->isLoaded = false; return; } } +/** + * Update the timers + * @remarks Originally called 'one_tick' + */ void Timeout::updateTimer() { if (_vm->_gyro->_dropdownActive) return; - for (byte fv = 0; fv < 7; fv++) { - if (_times[fv]._timeLeft > 0) { - _times[fv]._timeLeft--; - - if (_times[fv]._timeLeft == 0) { - switch (_times[fv]._thenWhere) { - case kProcOpenDrawbridge : - openDrawbridge(); - break; - case kProcAvariciusTalks : - avariciusTalks(); - break; - case kProcUrinate : - urinate(); - break; - case kProcToilet : - toilet(); - break; - case kProcBang: - bang(); - break; - case kProcBang2: - bang2(); - break; - case kProcStairs: - stairs(); - break; - case kProcCardiffSurvey: - cardiffSurvey(); - break; - case kProcCardiffReturn: - cardiffReturn(); - break; - case kProcCwytalotInHerts: - cwytalotInHerts(); - break; - case kProcGetTiedUp: - getTiedUp(); - break; - case kProcGetTiedUp2: - getTiedUp2(); - break; - case kProcHangAround: - hangAround(); - break; - case kProcHangAround2: - hangAround2(); - break; - case kProcAfterTheShootemup: - afterTheShootemup(); - break; - case kProcJacquesWakesUp: - jacquesWakesUp(); - break; - case kProcNaughtyDuke: - naughtyDuke(); - break; - case kProcNaughtyDuke2: - naughtyDuke2(); - break; - case kProcNaughtyDuke3: - naughtyDuke3(); - break; - case kProcJump: - jump(); - break; - case kProcSequence: - _vm->_sequence->callSequencer(); - break; - case kProcCrapulusSpludOut: - crapulusSaysSpludOut(); - break; - case kProcDawnDelay: - _vm->_lucerna->dawn(); - break; - case kProcBuyDrinks: - buyDrinks(); - break; - case kProcBuyWine: - buyWine(); - break; - case kProcCallsGuards: - callsGuards(); - break; - case kProcGreetsMonk: - greetsMonk(); - break; - case kProcFallDownOubliette: - fallDownOubliette(); - break; - case kProcMeetAvaroid: - meetAvaroid(); - break; - case kProcRiseUpOubliette: - riseUpOubliette(); - break; - case kProcRobinHoodAndGeida: - robinHoodAndGeida(); - break; - case kProcRobinHoodAndGeidaTalk: - robinHoodAndGeidaTalk(); - break; - case kProcAvalotReturns: - avalotReturns(); - break; - case kProcAvvySitDown: - avvySitDown(); - break; - case kProcGhostRoomPhew: - ghostRoomPhew(); - break; - case kProcArkataShouts: - arkataShouts(); - break; - case kProcWinning: - winning(); - break; - case kProcAvalotFalls: - avalotFalls(); - break; - case kProcSpludwickGoesToCauldron: - spludwickGoesToCauldron(); - break; - case kProcSpludwickLeavesCauldron: - spludwickLeavesCauldron(); - break; - case kProcGiveLuteToGeida: - giveLuteToGeida(); - break; - } + for (byte i = 0; i < 7; i++) { + if (_times[i]._timeLeft <= 0) + continue; + + _times[i]._timeLeft--; + + if (_times[i]._timeLeft == 0) { + switch (_times[i]._action) { + case kProcOpenDrawbridge : + openDrawbridge(); + break; + case kProcAvariciusTalks : + avariciusTalks(); + break; + case kProcUrinate : + urinate(); + break; + case kProcToilet : + toilet(); + break; + case kProcBang: + bang(); + break; + case kProcBang2: + bang2(); + break; + case kProcStairs: + stairs(); + break; + case kProcCardiffSurvey: + cardiffSurvey(); + break; + case kProcCardiffReturn: + cardiffReturn(); + break; + case kProcCwytalotInHerts: + cwytalotInHerts(); + break; + case kProcGetTiedUp: + getTiedUp(); + break; + case kProcGetTiedUp2: + getTiedUp2(); + break; + case kProcHangAround: + hangAround(); + break; + case kProcHangAround2: + hangAround2(); + break; + case kProcAfterTheShootemup: + afterTheShootemup(); + break; + case kProcJacquesWakesUp: + jacquesWakesUp(); + break; + case kProcNaughtyDuke: + naughtyDuke(); + break; + case kProcNaughtyDuke2: + naughtyDuke2(); + break; + case kProcNaughtyDuke3: + naughtyDuke3(); + break; + case kProcJump: + jump(); + break; + case kProcSequence: + _vm->_sequence->callSequencer(); + break; + case kProcCrapulusSpludOut: + crapulusSaysSpludOut(); + break; + case kProcDawnDelay: + _vm->_lucerna->dawn(); + break; + case kProcBuyDrinks: + buyDrinks(); + break; + case kProcBuyWine: + buyWine(); + break; + case kProcCallsGuards: + callsGuards(); + break; + case kProcGreetsMonk: + greetsMonk(); + break; + case kProcFallDownOubliette: + fallDownOubliette(); + break; + case kProcMeetAvaroid: + meetAvaroid(); + break; + case kProcRiseUpOubliette: + riseUpOubliette(); + break; + case kProcRobinHoodAndGeida: + robinHoodAndGeida(); + break; + case kProcRobinHoodAndGeidaTalk: + robinHoodAndGeidaTalk(); + break; + case kProcAvalotReturns: + avalotReturns(); + break; + case kProcAvvySitDown: + avvySitDown(); + break; + case kProcGhostRoomPhew: + ghostRoomPhew(); + break; + case kProcArkataShouts: + arkataShouts(); + break; + case kProcWinning: + winning(); + break; + case kProcAvalotFalls: + avalotFalls(); + break; + case kProcSpludwickGoesToCauldron: + spludwickGoesToCauldron(); + break; + case kProcSpludwickLeavesCauldron: + spludwickLeavesCauldron(); + break; + case kProcGiveLuteToGeida: + giveLuteToGeida(); + break; } } } @@ -215,9 +224,9 @@ void Timeout::updateTimer() { } void Timeout::loseTimer(byte which) { - for (byte fv = 0; fv < 7; fv++) { - if (_times[fv]._whatFor == which) - _times[fv]._timeLeft = 0; // Cancel this one! + for (byte i = 0; i < 7; i++) { + if (_times[i]._reason == which) + _times[i]._timeLeft = 0; // Cancel this one! } _timerLost = true; @@ -280,9 +289,7 @@ void Timeout::cardiffSurvey() { } _vm->_visa->dixi('z', _vm->_gyro->_dna._cardiffQuestionNum); - _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; - addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } @@ -363,7 +370,7 @@ void Timeout::afterTheShootemup() { gain = (shootscore + 5) / 10; // Rounding up. display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" + - strf(shootscore) + " 10) = " + strf(gain) + " points."); + strf(shootscore) + " 0xF6 10) = " + strf(gain) + " points."); if (gain > 20) { display("But we won't let you have more than 20 points!"); @@ -593,8 +600,12 @@ void Timeout::avalotReturns() { _vm->_gyro->_dna._userMovesAvvy = true; } +/** + * This is used when you sit down in the pub in Notts. It loops around + * so that it will happen when Avvy stops walking. + * @remarks Originally called 'avvy_sit_down' + */ void Timeout::avvySitDown() { -// This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. if (_vm->_animation->tr[0]._homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { @@ -615,14 +626,13 @@ void Timeout::arkataShouts() { return; _vm->_visa->dixi('q', 76); - addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timeout::winning() { _vm->_visa->dixi('q', 79); - _vm->_pingo->winningPic(); + warning("STUB: Timeout::winning()"); #if 0 do { diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index a2223e727574..5f1769a66366 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -116,8 +116,8 @@ class Timeout { struct TimeType { int32 _timeLeft; - byte _thenWhere; - byte _whatFor; + byte _action; + byte _reason; }; TimeType _times[7]; @@ -125,8 +125,8 @@ class Timeout { Timeout(AvalancheEngine *vm); - void addTimer(int32 howlong, byte whither, byte why); // Original: set_up_timer() - void updateTimer(); // Original: one_tick() + void addTimer(int32 duration, byte action, byte reason); + void updateTimer(); void loseTimer(byte which); // Procedures to do things at the end of amounts of time: From 1b25defe3417d8ff526a37b5448fe96b415626a5 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 11:20:37 +0200 Subject: [PATCH 0886/1332] AVALANCHE: Missing files from last commit... --- engines/avalanche/acci2.cpp | 172 ++++++++++++++++---------------- engines/avalanche/animation.cpp | 16 +-- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 4 +- engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/timeout2.cpp | 56 +++++------ 7 files changed, 127 insertions(+), 127 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2b223b7fd6e2..3691ae9afc4c 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -406,7 +406,7 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->_dna._spareEvening.empty()) _vm->_gyro->_dna._spareEvening.clear(); _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; - _vm->_visa->dixi('z', 5); // His closing statement... + _vm->_visa->displayScrollChain('z', 5); // His closing statement... _vm->_animation->tr[1].walkto(4); // The end of the drawbridge _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; @@ -625,24 +625,24 @@ void Acci::examineObject() { case Gyro::kObjectWine : switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: - _vm->_visa->dixi('t', 1); // Normal examine wine scroll + _vm->_visa->displayScrollChain('t', 1); // Normal examine wine scroll break; case 2: - _vm->_visa->dixi('d', 6); // Bad wine + _vm->_visa->displayScrollChain('d', 6); // Bad wine break; case 3: - _vm->_visa->dixi('d', 7); // Vinegar + _vm->_visa->displayScrollChain('d', 7); // Vinegar break; } break; case Gyro::kObjectOnion: if (_vm->_gyro->_dna._rottenOnion) - _vm->_visa->dixi('q', 21); // Yucky onion. + _vm->_visa->displayScrollChain('q', 21); // Yucky onion. else - _vm->_visa->dixi('t', 18); // Normal onion scroll + _vm->_visa->displayScrollChain('t', 18); // Normal onion scroll break; default: - _vm->_visa->dixi('t', _thing); // <<< Ordinarily + _vm->_visa->displayScrollChain('t', _thing); // <<< Ordinarily } } @@ -667,24 +667,24 @@ void Acci::exampers() { switch (_person) { // Special cases case 11: if (_vm->_gyro->_dna._wonNim) { - _vm->_visa->dixi('Q', 8); // "I'm Not Playing!" + _vm->_visa->displayScrollChain('Q', 8); // "I'm Not Playing!" return; } break; case 99: if (_vm->_gyro->_dna._lustieIsAsleep) { - _vm->_visa->dixi('Q', 65); // He's asleep. (65! Wow!) + _vm->_visa->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) return; } break; } // Otherwise... - _vm->_visa->dixi('p', _person); + _vm->_visa->displayScrollChain('p', _person); } // And afterwards... if ((_person == 14) && (!_vm->_gyro->_dna._aylesIsAwake)) - _vm->_visa->dixi('Q', 13); + _vm->_visa->displayScrollChain('Q', 13); } bool Acci::holding() { @@ -770,43 +770,43 @@ void Acci::swallow() { // Eat something. switch (_vm->_gyro->_dna._wineState) { // 4 is perfect case 1: if (_vm->_gyro->_dna._teetotal) { - _vm->_visa->dixi('D', 6); + _vm->_visa->displayScrollChain('D', 6); return; } - _vm->_visa->dixi('U', 1); + _vm->_visa->displayScrollChain('U', 1); _vm->_pingo->wobble(); - _vm->_visa->dixi('U', 2); + _vm->_visa->displayScrollChain('U', 2); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; case 2: case 3: - _vm->_visa->dixi('d', 8); + _vm->_visa->displayScrollChain('d', 8); break; // You can't drink it! } break; case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); - _vm->_visa->dixi('U', 3); + _vm->_visa->displayScrollChain('U', 3); _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: - _vm->_visa->dixi('U', 4); + _vm->_visa->displayScrollChain('U', 4); break; case Gyro::kObjectChastity: - _vm->_visa->dixi('U', 5); + _vm->_visa->displayScrollChain('U', 5); break; case Gyro::kObjectMushroom: - _vm->_visa->dixi('U', 6); + _vm->_visa->displayScrollChain('U', 6); _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_dna._rottenOnion) - _vm->_visa->dixi('U', 11); + _vm->_visa->displayScrollChain('U', 11); else { - _vm->_visa->dixi('U', 8); + _vm->_visa->displayScrollChain('U', 8); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } @@ -856,34 +856,34 @@ void Acci::lookAround() { switch (_vm->_gyro->_dna._room) { case r__spludwicks: if (_vm->_gyro->_dna._avariciusTalk > 0) - _vm->_visa->dixi('q', 23); + _vm->_visa->displayScrollChain('q', 23); else peopleInRoom(); break; case r__robins: if (_vm->_gyro->_dna._tiedUp) - _vm->_visa->dixi('q', 38); + _vm->_visa->displayScrollChain('q', 38); if (_vm->_gyro->_dna._mushroomGrowing) - _vm->_visa->dixi('q', 55); + _vm->_visa->displayScrollChain('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->_dna._takenPen) - _vm->_visa->dixi('q', 49); + _vm->_visa->displayScrollChain('q', 49); break; case r__lustiesroom: if (_vm->_gyro->_dna._lustieIsAsleep) - _vm->_visa->dixi('q', 65); + _vm->_visa->displayScrollChain('q', 65); break; case r__catacombs: switch (_vm->_gyro->_dna._catacombY * 256 + _vm->_gyro->_dna._catacombX) { case 258 : - _vm->_visa->dixi('q', 80); // Inside art gallery. + _vm->_visa->displayScrollChain('q', 80); // Inside art gallery. break; case 514 : - _vm->_visa->dixi('q', 81); // Outside ditto. + _vm->_visa->displayScrollChain('q', 81); // Outside ditto. break; case 260 : - _vm->_visa->dixi('q', 82); // Outside Geida's room. + _vm->_visa->displayScrollChain('q', 82); // Outside Geida's room. break; } break; @@ -906,7 +906,7 @@ void Acci::openDoor() { break; case r__spludwicks: if (_thing == 61) { - _vm->_visa->dixi('q', 85); + _vm->_visa->displayScrollChain('q', 85); return; } break; @@ -922,7 +922,7 @@ void Acci::openDoor() { switch (_vm->_gyro->_portals[fv]._operation) { case Gyro::kMagicExclaim: _vm->_animation->tr[0].bounce(); - _vm->_visa->dixi('x', _vm->_gyro->_portals[fv]._data); + _vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: _vm->_animation->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte @@ -982,7 +982,7 @@ void Acci::putProc() { else { // Put onion into vinegar! Yes! _vm->_gyro->_dna._onionInVinegar = true; _vm->_lucerna->incScore(7); - _vm->_visa->dixi('u', 9); + _vm->_visa->displayScrollChain('u', 9); } } } else @@ -1059,10 +1059,10 @@ bool Acci::giveToSpludwick() { case Gyro::kObjectOnion: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; if (_vm->_gyro->_dna._rottenOnion) - _vm->_visa->dixi('q', 22); + _vm->_visa->displayScrollChain('q', 22); else { _vm->_gyro->_dna._givenToSpludwick++; - _vm->_visa->dixi('q', 20); + _vm->_visa->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); } @@ -1072,13 +1072,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._givenToSpludwick++; - _vm->_visa->dixi('q', 24); + _vm->_visa->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = false; - _vm->_visa->dixi('q', 25); + _vm->_visa->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_dna._givenToSpludwick++; goToCauldron(); @@ -1132,9 +1132,9 @@ void Acci::standUp() { case r__yours: // Avvy isn't asleep. if (_vm->_gyro->_dna._avvyIsAwake && _vm->_gyro->_dna._avvyInBed) { // But he's in bed. if (_vm->_gyro->_dna._teetotal) { - _vm->_visa->dixi('d', 12); + _vm->_visa->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); - _vm->_visa->dixi('d', 14); + _vm->_visa->displayScrollChain('d', 14); } _vm->_animation->tr[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; @@ -1183,7 +1183,7 @@ void Acci::getProc(char thing) { } else _vm->_scrolls->displayText(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box."); } else - _vm->_visa->dixi('q', 57); + _vm->_visa->displayScrollChain('q', 57); break; case r__insidecardiffcastle: switch (thing) { @@ -1201,15 +1201,15 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText("Taken."); } } else if (_vm->_gyro->_dna._standingOnDais) - _vm->_visa->dixi('q', 53); + _vm->_visa->displayScrollChain('q', 53); else - _vm->_visa->dixi('q', 51); + _vm->_visa->displayScrollChain('q', 51); break; case Gyro::kObjectBolt: - _vm->_visa->dixi('q', 52); + _vm->_visa->displayScrollChain('q', 52); break; default: - _vm->_visa->dixi('q', 57); + _vm->_visa->displayScrollChain('q', 57); } break; case r__robins: @@ -1222,10 +1222,10 @@ void Acci::getProc(char thing) { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else - _vm->_visa->dixi('q', 57); + _vm->_visa->displayScrollChain('q', 57); break; default: - _vm->_visa->dixi('q', 57); + _vm->_visa->displayScrollChain('q', 57); } } @@ -1240,7 +1240,7 @@ void Acci::giveGeidaTheLute() { } _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_visa->dixi('q', 64); // She plays it. + _vm->_visa->displayScrollChain('q', 64); // She plays it. _vm->_timeout->addTimer(1, _vm->_timeout->kProcGiveLuteToGeida, _vm->_timeout->kReasonGeidaSings); _vm->_enid->backToBootstrap(4); @@ -1254,7 +1254,7 @@ void Acci::playHarp() { } void Acci::winSequence() { - _vm->_visa->dixi('q', 78); + _vm->_visa->displayScrollChain('q', 78); _vm->_sequence->firstShow(7); _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); @@ -1380,10 +1380,10 @@ void Acci::doThat() { if ((_person == 0) || (_person == kPardon)) _vm->_scrolls->displayText("Talk to whom?"); else if (isPersonHere()) - _vm->_visa->talkto(_person); + _vm->_visa->talkTo(_person); } } else if (isPersonHere()) - _vm->_visa->talkto(_person); + _vm->_visa->talkTo(_person); break; case kVerbCodeGive: if (holding()) { @@ -1421,7 +1421,7 @@ void Acci::doThat() { break; case Gyro::kPeopleIbythneth: if (_thing == _vm->_gyro->kObjectBadge) { - _vm->_visa->dixi('q', 32); // Thanks! Wow! + _vm->_visa->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = false; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectHabit - 1] = true; @@ -1435,7 +1435,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._aylesIsAwake) { if (_thing == _vm->_gyro->kObjectPen) { _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = false; - _vm->_visa->dixi('q', 54); + _vm->_visa->displayScrollChain('q', 54); _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = true; _vm->_gyro->_dna._givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); @@ -1449,7 +1449,7 @@ void Acci::doThat() { switch (_thing) { case Gyro::kObjectPotion: _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = false; - _vm->_visa->dixi('u', 16); // She drinks it. + _vm->_visa->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_dna._givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); @@ -1467,7 +1467,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._givenPotionToGeida) winSequence(); else - _vm->_visa->dixi('q', 77); // That Geida woman! + _vm->_visa->displayScrollChain('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1593,20 +1593,20 @@ void Acci::doThat() { // The player automatically wins the game everytime he wins, until I implement the mini-game. if (_vm->_gyro->_dna._wonNim) { // Already won the game. - _vm->_visa->dixi('Q', 6); + _vm->_visa->displayScrollChain('Q', 6); return; } if (!_vm->_gyro->_dna._askedDogfoodAboutNim) { - _vm->_visa->dixi('q', 84); + _vm->_visa->displayScrollChain('q', 84); return; } - _vm->_visa->dixi('Q', 3); + _vm->_visa->displayScrollChain('Q', 3); _vm->_gyro->_dna._playedNim++; // You won - strange! - _vm->_visa->dixi('Q', 7); // You won! Give us a lute! + _vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute! _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wonNim = true; @@ -1628,13 +1628,13 @@ void Acci::doThat() { } else if (holding()) { switch (_thing) { case Gyro::kObjectLute : - _vm->_visa->dixi('U', 7); + _vm->_visa->displayScrollChain('U', 7); if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] == _vm->_gyro->_dna._room) - _vm->_visa->dixi('U', 10); + _vm->_visa->displayScrollChain('U', 10); if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleDuLustie - 150] == _vm->_gyro->_dna._room) - _vm->_visa->dixi('U', 15); + _vm->_visa->displayScrollChain('U', 15); break; case 52: if (_vm->_gyro->_dna._room == r__musicroom) @@ -1693,12 +1693,12 @@ void Acci::doThat() { break; case kVerbCodeMagic: if (_vm->_gyro->_dna._avariciusTalk > 0) - _vm->_visa->dixi('q', 19); + _vm->_visa->displayScrollChain('q', 19); else { if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->infield(2))) { // Avaricius appears! - _vm->_visa->dixi('q', 17); + _vm->_visa->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == 12) - _vm->_visa->dixi('q', 18); + _vm->_visa->displayScrollChain('q', 18); else { _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius _vm->_animation->apped(2, 4); @@ -1751,12 +1751,12 @@ void Acci::doThat() { case 54: case 58: // Beer, whisky, cider or mead. if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. - _vm->_visa->dixi('D', 15); + _vm->_visa->displayScrollChain('D', 15); return; } if (_vm->_gyro->_dna._teetotal) { - _vm->_visa->dixi('D', 6); + _vm->_visa->displayScrollChain('D', 6); return; } @@ -1776,10 +1776,10 @@ void Acci::doThat() { break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) // We've already got the wine! - _vm->_visa->dixi('D', 2); // 1 bottle's shufishent! + _vm->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. - _vm->_visa->dixi('D', 15); + _vm->_visa->displayScrollChain('D', 15); return; } @@ -1800,21 +1800,21 @@ void Acci::doThat() { break; } } else - _vm->_visa->dixi('D', 5); // Go to the bar! + _vm->_visa->displayScrollChain('D', 5); // Go to the bar! break; case r__outsideducks: if (_vm->_animation->infield(6)) { if (_thing == _vm->_gyro->kObjectOnion) { if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) - _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! + _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->_dna._boughtOnion) - _vm->_visa->dixi('D', 11); + _vm->_visa->displayScrollChain('D', 11); else { - _vm->_visa->dixi('D', 9); + _vm->_visa->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. @@ -1825,16 +1825,16 @@ void Acci::doThat() { _vm->_gyro->_dna._onionInVinegar = false; } } else - _vm->_visa->dixi('D', 0); + _vm->_visa->displayScrollChain('D', 0); } else - _vm->_visa->dixi('D', 0); + _vm->_visa->displayScrollChain('D', 0); break; case r__nottspub: - _vm->_visa->dixi('n', 15); // Can't sell to southerners. + _vm->_visa->displayScrollChain('n', 15); // Can't sell to southerners. break; default: - _vm->_visa->dixi('D', 0); // Can't buy that. + _vm->_visa->displayScrollChain('D', 0); // Can't buy that. } break; case kVerbCodeAttack: @@ -1844,7 +1844,7 @@ void Acci::doThat() { switch (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: - _vm->_visa->dixi('Q', 10); + _vm->_visa->displayScrollChain('Q', 10); _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); break; case 1: @@ -1854,7 +1854,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: - _vm->_visa->dixi('Q', 11); + _vm->_visa->displayScrollChain('Q', 11); _vm->_gyro->_dna._cwytalotGone = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = false; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = false; @@ -1867,14 +1867,14 @@ void Acci::doThat() { _vm->_gyro->_whereIs[7] = 177; break; default: - _vm->_visa->dixi('Q', 10); // Please try not to be so violent! + _vm->_visa->displayScrollChain('Q', 10); // Please try not to be so violent! } } else - _vm->_visa->dixi('Q', 10); + _vm->_visa->displayScrollChain('Q', 10); break; case kVerbCodePasswd: if (_vm->_gyro->_dna._room != r__bridge) - _vm->_visa->dixi('Q', 12); + _vm->_visa->displayScrollChain('Q', 12); else { bool ok = true; for (byte i = 0; i < _thats.size(); i++) { @@ -1896,7 +1896,7 @@ void Acci::doThat() { _vm->_gyro->_dna._drawbridgeOpen = 1; } } else - _vm->_visa->dixi('Q', 12); + _vm->_visa->displayScrollChain('Q', 12); } break; case kVerbCodeDir: @@ -1922,16 +1922,16 @@ void Acci::doThat() { else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: - _vm->_visa->dixi('U', 12); + _vm->_visa->displayScrollChain('U', 12); break; case Gyro::kPeopleGeida: - _vm->_visa->dixi('U', 13); + _vm->_visa->displayScrollChain('U', 13); break; case Gyro::kPeopleWisewoman: - _vm->_visa->dixi('U', 14); + _vm->_visa->displayScrollChain('U', 14); break; default: - _vm->_visa->dixi('U', 5); // You WHAT? + _vm->_visa->displayScrollChain('U', 5); // You WHAT? } } else if ((150 <= _person) && (_person <= 174)) _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); @@ -1963,7 +1963,7 @@ void Acci::doThat() { _vm->_gyro->_dna._avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. if (_vm->_gyro->_dna._teetotal) - _vm->_visa->dixi('d', 13); + _vm->_visa->displayScrollChain('d', 13); } else _vm->_scrolls->displayText("You're already awake, Avvy!"); break; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 68f59deef540..68266f366d43 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -854,7 +854,7 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! stopWalking(); - _vm->_visa->dixi('q', 26); + _vm->_visa->displayScrollChain('q', 26); _vm->_gyro->_dna._userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. @@ -884,11 +884,11 @@ void Animation::call_special(uint16 which) { if (_vm->_gyro->_dna._friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. - _vm->_visa->dixi('q', 35); + _vm->_visa->displayScrollChain('q', 35); tr[0].done(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_visa->dixi('q', 36); + _vm->_visa->displayScrollChain('q', 36); _vm->_gyro->_dna._tiedUp = true; _vm->_gyro->_dna._friarWillTieYouUp = false; tr[1].walkto(3); @@ -917,7 +917,7 @@ void Animation::call_special(uint16 which) { break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { - _vm->_visa->dixi('q', 63); + _vm->_visa->displayScrollChain('q', 63); tr[1].turn(kDirDown); tr[1].stopWalk(); tr[1]._callEachStepFl = false; // Geida @@ -937,9 +937,9 @@ void Animation::call_special(uint16 which) { if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { // Into Geida's room. if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1]) - _vm->_visa->dixi('q', 62); + _vm->_visa->displayScrollChain('q', 62); else { - _vm->_visa->dixi('q', 61); + _vm->_visa->displayScrollChain('q', 61); return; } } @@ -1201,7 +1201,7 @@ void Animation::arrow_procs(byte tripnum) { // OK, it's hit him... what now? tr[1]._callEachStepFl = false; // prevent recursion. - _vm->_visa->dixi('Q', 47); // Complaint! + _vm->_visa->displayScrollChain('Q', 47); // Complaint! tr[tripnum].done(); // Deallocate the arrow. #if 0 tr[1].done; { Deallocate normal pic of Avvy. } @@ -1409,7 +1409,7 @@ void Animation::animLink() { if (mustexclaim) { mustexclaim = false; - _vm->_visa->dixi('x', saywhat); + _vm->_visa->displayScrollChain('x', saywhat); } } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 052619c48fbc..e0e05144c4a3 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -182,7 +182,7 @@ void Avalot::setup() { _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); - _vm->_visa->dixi('q', 83); // Info on the game, etc. + _vm->_visa->displayScrollChain('q', 83); // Info on the game, etc. } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index f7e917ed8875..3f29ca4376bf 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -307,7 +307,7 @@ void Gyro::forceNumlock() { bool Gyro::decreaseMoney(uint16 howmuchby) { _dna._money -= howmuchby; if (_dna._money < 0) { - _vm->_visa->dixi('Q', 2); // "You are now denariusless!" + _vm->_visa->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; } else diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 07fe6b42703d..598ff6386945 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -600,13 +600,13 @@ void Lucerna::enterRoom(byte room, byte ped) { { if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { - _vm->_visa->dixi('q', 9); // Don't want to waste the wine! + _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; refreshObjectList(); } } - _vm->_visa->dixi('q', 69); + _vm->_visa->displayScrollChain('q', 69); break; case r__catacombs: diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 6c05d7a946eb..01c61be208ff 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -718,7 +718,7 @@ void Scrolls::callScrollDriver() { case 10: switch (_vm->_gyro->_dna._boxContent) { case 0: { // Sixpence. - _vm->_visa->dixi('q', 37); // You find the sixpence. + _vm->_visa->displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_dna._money += 6; _vm->_gyro->_dna._boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index fb73ce55c334..0f484fc5e845 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -243,7 +243,7 @@ void Timeout::openDrawbridge() { } void Timeout::avariciusTalks() { - _vm->_visa->dixi('q', _vm->_gyro->_dna._avariciusTalk); + _vm->_visa->displayScrollChain('q', _vm->_gyro->_dna._avariciusTalk); _vm->_gyro->_dna._avariciusTalk++; if (_vm->_gyro->_dna._avariciusTalk < 17) @@ -285,25 +285,25 @@ void Timeout::stairs() { void Timeout::cardiffSurvey() { if (_vm->_gyro->_dna._cardiffQuestionNum == 0) { _vm->_gyro->_dna._cardiffQuestionNum++; - _vm->_visa->dixi('q', 27); + _vm->_visa->displayScrollChain('q', 27); } - _vm->_visa->dixi('z', _vm->_gyro->_dna._cardiffQuestionNum); + _vm->_visa->displayScrollChain('z', _vm->_gyro->_dna._cardiffQuestionNum); _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } void Timeout::cardiffReturn() { - _vm->_visa->dixi('q', 28); + _vm->_visa->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } void Timeout::cwytalotInHerts() { - _vm->_visa->dixi('q', 29); + _vm->_visa->displayScrollChain('q', 29); } void Timeout::getTiedUp() { - _vm->_visa->dixi('q', 34); // ...Trouble! + _vm->_visa->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; _vm->_animation->stopWalking(); @@ -326,17 +326,17 @@ void Timeout::hangAround() { _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; _vm->_animation->apped(1, 2); - _vm->_visa->dixi('q', 39); + _vm->_visa->displayScrollChain('q', 39); _vm->_animation->tr[0].walkto(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timeout::hangAround2() { - _vm->_visa->dixi('q', 40); + _vm->_visa->displayScrollChain('q', 40); _vm->_animation->tr[1]._vanishIfStill = false; _vm->_animation->tr[1].walkto(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; - _vm->_visa->dixi('q', 41); + _vm->_visa->displayScrollChain('q', 41); _vm->_animation->tr[0].done(); _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. @@ -381,7 +381,7 @@ void Timeout::afterTheShootemup() { warning("STUB: Timeout::after_the_shootemup()"); - _vm->_visa->dixi('q', 70); + _vm->_visa->displayScrollChain('q', 70); } void Timeout::jacquesWakesUp() { @@ -390,7 +390,7 @@ void Timeout::jacquesWakesUp() { switch (_vm->_gyro->_dna._jacquesState) { // Additional pictures. case 1 : _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. - _vm->_visa->dixi('Q', 45); + _vm->_visa->displayScrollChain('Q', 45); break; case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. @@ -436,7 +436,7 @@ void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your m } void Timeout::naughtyDuke2() { - _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" + _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" _vm->_animation->tr[1].walkto(1); // Walk to the door. _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); @@ -489,14 +489,14 @@ void Timeout::jump() { _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_visa->dixi('q', 50); + _vm->_visa->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); } } } void Timeout::crapulusSaysSpludOut() { - _vm->_visa->dixi('q', 56); + _vm->_visa->displayScrollChain('q', 56); _vm->_gyro->_dna._crapulusWillTell = false; } @@ -504,11 +504,11 @@ void Timeout::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; - _vm->_visa->dixi('D', _vm->_gyro->_dna._drinking); // Display message about it. + _vm->_visa->displayScrollChain('D', _vm->_gyro->_dna._drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. - _vm->_visa->dixi('D', 1); // That'll be thruppence. + _vm->_visa->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. - _vm->_visa->dixi('D', 3); // Tell 'em you paid up. + _vm->_visa->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -516,10 +516,10 @@ void Timeout::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; - _vm->_visa->dixi('D', 50); // You buy the wine. - _vm->_visa->dixi('D', 1); // It'll be thruppence. + _vm->_visa->displayScrollChain('D', 50); // You buy the wine. + _vm->_visa->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { - _vm->_visa->dixi('D', 4); // You paid up. + _vm->_visa->displayScrollChain('D', 4); // You paid up. _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wineState = 1; // OK Wine. @@ -527,12 +527,12 @@ void Timeout::buyWine() { } void Timeout::callsGuards() { - _vm->_visa->dixi('Q', 58); // "GUARDS!!!" + _vm->_visa->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } void Timeout::greetsMonk() { - _vm->_visa->dixi('Q', 59); + _vm->_visa->displayScrollChain('Q', 59); _vm->_gyro->_dna._enteredLustiesRoomAsMonk = true; } @@ -549,7 +549,7 @@ void Timeout::meetAvaroid() { + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); _vm->_lucerna->gameOver(); } else { - _vm->_visa->dixi('Q', 60); + _vm->_visa->displayScrollChain('Q', 60); _vm->_gyro->_dna._metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); @@ -583,7 +583,7 @@ void Timeout::robinHoodAndGeida() { } void Timeout::robinHoodAndGeidaTalk() { - _vm->_visa->dixi('q', 66); + _vm->_visa->displayScrollChain('q', 66); _vm->_animation->tr[0].walkto(2); _vm->_animation->tr[1].walkto(2); _vm->_animation->tr[0]._vanishIfStill = true; @@ -596,7 +596,7 @@ void Timeout::avalotReturns() { _vm->_animation->tr[1].done(); _vm->_animation->tr[0].init(0, true, _vm->_animation); _vm->_animation->apped(1, 1); - _vm->_visa->dixi('q', 67); + _vm->_visa->displayScrollChain('q', 67); _vm->_gyro->_dna._userMovesAvvy = true; } @@ -625,12 +625,12 @@ void Timeout::arkataShouts() { if (_vm->_gyro->_dna._teetotal) return; - _vm->_visa->dixi('q', 76); + _vm->_visa->displayScrollChain('q', 76); addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timeout::winning() { - _vm->_visa->dixi('q', 79); + _vm->_visa->displayScrollChain('q', 79); _vm->_pingo->winningPic(); warning("STUB: Timeout::winning()"); @@ -673,7 +673,7 @@ void Timeout::spludwickLeavesCauldron() { } void Timeout::giveLuteToGeida() { // Moved here from Acci. - _vm->_visa->dixi('Q', 86); + _vm->_visa->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_dna._lustieIsAsleep = true; _vm->_sequence->firstShow(5); From f42f29d8f8e1cc39b02cf1827318ff8fb59d3dd7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 11:30:23 +0200 Subject: [PATCH 0887/1332] AVALANCHE: Rename Timeout into Timer --- engines/avalanche/acci2.cpp | 30 +++--- engines/avalanche/animation.cpp | 20 ++-- engines/avalanche/animation.h | 2 +- engines/avalanche/avalanche.cpp | 10 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 4 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 30 +++--- engines/avalanche/module.mk | 2 +- engines/avalanche/scrolls2.cpp | 4 +- engines/avalanche/sequence2.cpp | 6 +- engines/avalanche/sequence2.h | 2 +- engines/avalanche/{timeout2.cpp => timer.cpp} | 94 +++++++++---------- engines/avalanche/{timeout2.h => timer.h} | 16 ++-- 14 files changed, 113 insertions(+), 113 deletions(-) rename engines/avalanche/{timeout2.cpp => timer.cpp} (91%) rename engines/avalanche/{timeout2.h => timer.h} (95%) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 3691ae9afc4c..fe7296782dba 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -34,7 +34,7 @@ #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" @@ -379,7 +379,7 @@ void Acci::storeInterrogation(byte interrogation) { while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - _vm->_timeout->loseTimer(_vm->_timeout->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. + _vm->_timer->loseTimer(_vm->_timer->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { case 1: @@ -419,7 +419,7 @@ void Acci::storeInterrogation(byte interrogation) { } if (interrogation < 4) - _vm->_timeout->cardiffSurvey(); + _vm->_timer->cardiffSurvey(); } @@ -1041,7 +1041,7 @@ void Acci::notInOrder() { void Acci::goToCauldron() { _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timeout->addTimer(1, _vm->_timeout->kProcSpludwickGoesToCauldron, _vm->_timeout->kReasonSpludWalk); + _vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludWalk); _vm->_animation->tr[1].walkto(2); } @@ -1143,7 +1143,7 @@ void Acci::standUp() { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; - _vm->_timeout->loseTimer(_vm->_timeout->kReasonArkataShouts); + _vm->_timer->loseTimer(_vm->_timer->kReasonArkataShouts); } else already(); break; @@ -1242,7 +1242,7 @@ void Acci::giveGeidaTheLute() { _vm->_lucerna->refreshObjectList(); _vm->_visa->displayScrollChain('q', 64); // She plays it. - _vm->_timeout->addTimer(1, _vm->_timeout->kProcGiveLuteToGeida, _vm->_timeout->kReasonGeidaSings); + _vm->_timer->addTimer(1, _vm->_timer->kProcGiveLuteToGeida, _vm->_timer->kReasonGeidaSings); _vm->_enid->backToBootstrap(4); } @@ -1259,7 +1259,7 @@ void Acci::winSequence() { _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); _vm->_sequence->startToClose(); - _vm->_timeout->addTimer(30, _vm->_timeout->kProcWinning, _vm->_timeout->kReasonWinning); + _vm->_timer->addTimer(30, _vm->_timer->kProcWinning, _vm->_timer->kReasonWinning); } void Acci::personSpeaks() { @@ -1506,7 +1506,7 @@ void Acci::doThat() { case kVerbCodeQuit: // quit if (_vm->_gyro->kDemo) { warning("STUB: Acci::doThat() - case kVerbCodequit"); - // _vm->_visa->dixi('pos', 31); + // _vm->_visa->displayScrollChain('pos', 31); // close(demofile); // exit(0); // Change this later!!! } @@ -1682,7 +1682,7 @@ void Acci::doThat() { case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); - _vm->_timeout->addTimer(4, _vm->_timeout->kProcUrinate, _vm->_timeout->kReasonGoToToilet); + _vm->_timer->addTimer(4, _vm->_timer->kProcUrinate, _vm->_timer->kReasonGoToToilet); } else _vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); @@ -1706,7 +1706,7 @@ void Acci::doThat() { _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; - _vm->_timeout->addTimer(177, _vm->_timeout->kProcAvariciusTalks, _vm->_timeout->kReasonAvariciusTalks); + _vm->_timer->addTimer(177, _vm->_timer->kProcAvariciusTalks, _vm->_timer->kReasonAvariciusTalks); } } else _vm->_scrolls->displayText("Nothing appears to happen..."); @@ -1769,7 +1769,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->addTimer(27, _vm->_timeout->kProcBuyDrinks, _vm->_timeout->kReasonDrinks); + _vm->_timer->addTimer(27, _vm->_timer->kProcBuyDrinks, _vm->_timer->kReasonDrinks); break; case 52: examine(); @@ -1795,7 +1795,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timeout->addTimer(27, _vm->_timeout->kProcBuyWine, _vm->_timeout->kReasonDrinks); + _vm->_timer->addTimer(27, _vm->_timer->kProcBuyWine, _vm->_timer->kReasonDrinks); } break; } @@ -1892,7 +1892,7 @@ void Acci::doThat() { else { _vm->_lucerna->incScore(4); _vm->_scrolls->displayText("The drawbridge opens!"); - _vm->_timeout->addTimer(7, _vm->_timeout->kProcOpenDrawbridge, _vm->_timeout->kReasonDrawbridgeFalls); + _vm->_timer->addTimer(7, _vm->_timer->kProcOpenDrawbridge, _vm->_timer->kReasonDrawbridgeFalls); _vm->_gyro->_dna._drawbridgeOpen = 1; } } else @@ -1944,7 +1944,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: - _vm->_timeout->addTimer(1, _vm->_timeout->kProcJump, _vm->_timeout->kReasonJumping); + _vm->_timer->addTimer(1, _vm->_timer->kProcJump, _vm->_timer->kReasonJumping); _vm->_gyro->_dna._userMovesAvvy = false; break; case kVerbCodeHiscores: @@ -1985,7 +1985,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. - _vm->_timeout->addTimer(1, _vm->_timeout->kProcAvvySitDown, _vm->_timeout->kReasonSittingDown); + _vm->_timer->addTimer(1, _vm->_timer->kProcAvvySitDown, _vm->_timer->kReasonSittingDown); } } else { // Default doodah. _vm->_lucerna->dusk(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 68266f366d43..df8724feb506 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -36,7 +36,7 @@ #include "avalanche/gyro2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/enid2.h" #include "common/scummsys.h" @@ -834,7 +834,7 @@ void Animation::catamove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Animation::dawndelay() { - _vm->_timeout->addTimer(2, _vm->_timeout->kProcDawnDelay, _vm->_timeout->kReasonDawndelay); + _vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay); } void Animation::call_special(uint16 which) { @@ -843,7 +843,7 @@ void Animation::call_special(uint16 which) { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_dna._brummieStairs = 1; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - _vm->_timeout->addTimer(10, _vm->_timeout->kProcStairs, _vm->_timeout->kReasonBrummieStairs); + _vm->_timer->addTimer(10, _vm->_timer->kProcStairs, _vm->_timer->kReasonBrummieStairs); stopWalking(); _vm->_gyro->_dna._userMovesAvvy = false; break; @@ -877,7 +877,7 @@ void Animation::call_special(uint16 which) { case 4: // This is the ghost room link. _vm->_lucerna->dusk(); tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap - _vm->_timeout->addTimer(1, _vm->_timeout->kProcGhostRoomPhew, _vm->_timeout->kReasonGhostRoomPhew); + _vm->_timer->addTimer(1, _vm->_timer->kProcGhostRoomPhew, _vm->_timer->kReasonGhostRoomPhew); _vm->_enid->backToBootstrap(3); break; case 5: @@ -895,7 +895,7 @@ void Animation::call_special(uint16 which) { tr[1]._vanishIfStill = true; tr[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. - _vm->_timeout->addTimer(364, _vm->_timeout->kProcHangAround, _vm->_timeout->kReasonHangingAround); + _vm->_timer->addTimer(364, _vm->_timer->kProcHangAround, _vm->_timer->kReasonHangingAround); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. @@ -903,17 +903,17 @@ void Animation::call_special(uint16 which) { tr[0]._moveX = 3; tr[0]._moveY = 0; tr[0]._facingDir = kDirRight; - _vm->_timeout->addTimer(1, _vm->_timeout->kProcFallDownOubliette, _vm->_timeout->kReasonFallingDownOubliette); + _vm->_timer->addTimer(1, _vm->_timer->kProcFallDownOubliette, _vm->_timer->kReasonFallingDownOubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. tr[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopWalking(); - _vm->_timeout->loseTimer(_vm->_timeout->kReasonFallingDownOubliette); + _vm->_timer->loseTimer(_vm->_timer->kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout->addTimer(200, _vm->_timeout->kProcMeetAvaroid, _vm->_timeout->kReasonMeetingAvaroid); + _vm->_timer->addTimer(200, _vm->_timer->kProcMeetAvaroid, _vm->_timer->kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { @@ -931,7 +931,7 @@ void Animation::call_special(uint16 which) { tr[1].walkto(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_timeout->addTimer(40, _vm->_timeout->kProcRobinHoodAndGeida, _vm->_timeout->kReasonRobinHoodAndGeida); + _vm->_timer->addTimer(40, _vm->_timer->kProcRobinHoodAndGeida, _vm->_timer->kReasonRobinHoodAndGeida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { @@ -1217,7 +1217,7 @@ void Animation::arrow_procs(byte tripnum) { _vm->_lucerna->gameOver(); _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. - _vm->_timeout->addTimer(55, _vm->_timeout->kProcNaughtyDuke, _vm->_timeout->kReasonNaughtyDuke); + _vm->_timer->addTimer(55, _vm->_timer->kProcNaughtyDuke, _vm->_timer->kReasonNaughtyDuke); } } else { // Arrow has hit the wall! tr[tripnum].done(); // Deallocate the arrow. diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 72c86a48de5c..b820d2d8081d 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* Original name TRIP5 / Trippancy V - the sprite animation subsystem */ +/* Original name: TRIP5 / Trippancy V - the sprite animation subsystem */ #ifndef AVALANCHE_ANIMATION_H #define AVALANCHE_ANIMATION_H diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2e7b7f311523..b28fe7fb5fad 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -69,7 +69,7 @@ AvalancheEngine::~AvalancheEngine() { delete _enid; delete _celer; delete _sequence; - delete _timeout; + delete _timer; delete _animation; delete _acci; delete _dropdown; @@ -90,7 +90,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _enid = new Enid(this); _celer = new Celer(this); _sequence = new Sequence(this); - _timeout = new Timeout(this); + _timer = new Timer(this); _animation = new Animation(this); _acci = new Acci(this); _dropdown = new Dropdown(this); @@ -335,9 +335,9 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. for (byte i = 0; i < 7; i++) { - sz.syncAsSint32LE(_timeout->_times[i]._timeLeft); - sz.syncAsByte(_timeout->_times[i]._action); - sz.syncAsByte(_timeout->_times[i]._reason); + sz.syncAsSint32LE(_timer->_times[i]._timeLeft); + sz.syncAsByte(_timer->_times[i]._action); + sz.syncAsByte(_timer->_times[i]._reason); } //blockwrite(f, seq, sizeof(seq)); // Sequencer information. diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 1973f9b6ff86..998363a242d9 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -42,7 +42,7 @@ #include "avalanche/enid2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/dropdown2.h" @@ -79,7 +79,7 @@ class AvalancheEngine : public Engine { Enid *_enid; Celer *_celer; Sequence *_sequence; - Timeout *_timeout; + Timer *_timer; Animation *_animation; Acci *_acci; Dropdown *_dropdown; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e0e05144c4a3..a4392383b183 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -38,7 +38,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/dropdown2.h" #include "avalanche/pingo2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/celer2.h" #include "avalanche/enid2.h" #include "avalanche/visa2.h" @@ -205,7 +205,7 @@ void Avalot::run(Common::String arg) { _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); - _vm->_timeout->updateTimer(); + _vm->_timer->updateTimer(); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index c3a195ecf4d1..f6e22dfc59e0 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -33,7 +33,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" #include "avalanche/animation.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 598ff6386945..1cf7b3ef7075 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -33,7 +33,7 @@ #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" @@ -340,21 +340,21 @@ void Lucerna::exitRoom(byte x) { switch (x) { case r__spludwicks: - _vm->_timeout->loseTimer(_vm->_timeout->kReasonAvariciusTalks); + _vm->_timer->loseTimer(_vm->_timer->kReasonAvariciusTalks); _vm->_gyro->_dna._avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: if (_vm->_gyro->_dna._drawbridgeOpen > 0) { _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. - _vm->_timeout->loseTimer(_vm->_timeout->kReasonDrawbridgeFalls); + _vm->_timer->loseTimer(_vm->_timer->kReasonDrawbridgeFalls); } break; case r__outsidecardiffcastle: - _vm->_timeout->loseTimer(_vm->_timeout->kReasonCardiffsurvey); + _vm->_timer->loseTimer(_vm->_timer->kReasonCardiffsurvey); break; case r__robins: - _vm->_timeout->loseTimer(_vm->_timeout->kReasonGettingTiedUp); + _vm->_timer->loseTimer(_vm->_timer->kReasonGettingTiedUp); break; } @@ -436,7 +436,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_timeout->addTimer(100, _vm->_timeout->kProcArkataShouts, _vm->_timeout->kReasonArkataShouts); + _vm->_timer->addTimer(100, _vm->_timer->kProcArkataShouts, _vm->_timer->kReasonArkataShouts); } break; @@ -464,7 +464,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(8, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(4); - _vm->_timeout->addTimer(20, _vm->_timeout->kProcCrapulusSpludOut, _vm->_timeout->kReasonCrapulusSaysSpludwickOut); + _vm->_timer->addTimer(20, _vm->_timer->kProcCrapulusSpludOut, _vm->_timer->kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } } @@ -472,7 +472,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timeout->addTimer(20, _vm->_timeout->kProcBang, _vm->_timeout->kReasonExplosion); + _vm->_timer->addTimer(20, _vm->_timer->kProcBang, _vm->_timer->kReasonExplosion); _vm->_gyro->_dna._spludwickAtHome = true; } break; @@ -527,7 +527,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timeout->addTimer(20, _vm->_timeout->kProcCwytalotInHerts, _vm->_timeout->kReasonCwytalotInHerts); + _vm->_timer->addTimer(20, _vm->_timer->kProcCwytalotInHerts, _vm->_timer->kReasonCwytalotInHerts); } break; @@ -548,7 +548,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(6, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->addTimer(36, _vm->_timeout->kProcGetTiedUp, _vm->_timeout->kReasonGettingTiedUp); + _vm->_timer->addTimer(36, _vm->_timer->kProcGetTiedUp, _vm->_timer->kReasonGettingTiedUp); } } @@ -572,7 +572,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 2); _vm->_animation->tr[1].walkto(3); - _vm->_timeout->addTimer(47, _vm->_timeout->kProcCardiffSurvey, _vm->_timeout->kReasonCardiffsurvey); + _vm->_timer->addTimer(47, _vm->_timer->kProcCardiffSurvey, _vm->_timer->kReasonCardiffsurvey); } break; case 5 : @@ -582,7 +582,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 3); _vm->_animation->tr[1]._facingDir = Animation::kDirRight; - _vm->_timeout->addTimer(3, _vm->_timeout->kProcCardiffReturn, _vm->_timeout->kReasonCardiffsurvey); + _vm->_timer->addTimer(3, _vm->_timer->kProcCardiffReturn, _vm->_timer->kReasonCardiffsurvey); } } if (_vm->_gyro->_dna._cardiffQuestionNum < 5) @@ -650,10 +650,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes - _vm->_timeout->addTimer(3, _vm->_timeout->kProcCallsGuards, _vm->_timeout->kReasonDuLustieTalks); + _vm->_timer->addTimer(3, _vm->_timer->kProcCallsGuards, _vm->_timer->kReasonDuLustieTalks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timeout->addTimer(3, _vm->_timeout->kProcGreetsMonk, _vm->_timeout->kReasonDuLustieTalks); + _vm->_timer->addTimer(3, _vm->_timer->kProcGreetsMonk, _vm->_timer->kReasonDuLustieTalks); if (_vm->_gyro->_dna._geidaFollows) { putGeidaAt(5, ped); @@ -1190,7 +1190,7 @@ void Lucerna::gameOver() { _vm->_animation->tr[0]._stepNum = 0; _vm->_animation->tr[0].appear(sx, sy, 0); - _vm->_timeout->addTimer(3, _vm->_timeout->kProcAvalotFalls, _vm->_timeout->kReasonFallingOver); + _vm->_timer->addTimer(3, _vm->_timer->kProcAvalotFalls, _vm->_timer->kReasonFallingOver); _vm->_gyro->_alive = false; } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index c46f8e21f190..0f1722a48261 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -15,7 +15,7 @@ MODULE_OBJS = \ enid2.o \ celer2.o \ sequence2.o \ - timeout2.o \ + timer.o \ animation.o \ acci2.o \ dropdown2.o \ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 01c61be208ff..f8972d5bd3d7 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -35,7 +35,7 @@ #include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/visa2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "common/textconsole.h" #include "common/file.h" @@ -219,7 +219,7 @@ void Scrolls::scrollModeMusic() { setReadyLight(0); _vm->_gyro->_seeScroll = false; - _vm->_timeout->addTimer(8, _vm->_timeout->kProcJacquesWakesUp, _vm->_timeout->kReasonJacquesWakingUp); + _vm->_timer->addTimer(8, _vm->_timer->kProcJacquesWakesUp, _vm->_timer->kReasonJacquesWakingUp); warning("STUB: Scrolls::music_scroll()"); return; #if 0 diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 8f8a3db39147..48b8017515e8 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -31,7 +31,7 @@ #include "avalanche/sequence2.h" #include "avalanche/gyro2.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/celer2.h" #include "avalanche/animation.h" @@ -69,8 +69,8 @@ void Sequence::thenFlip(byte where, byte ped) { } void Sequence::startToClose() { - _vm->_timeout->loseTimer(_vm->_timeout->kReasonSequencer); - _vm->_timeout->addTimer(7, _vm->_timeout->kProcSequence, _vm->_timeout->kReasonSequencer); + _vm->_timer->loseTimer(_vm->_timer->kReasonSequencer); + _vm->_timer->addTimer(7, _vm->_timer->kProcSequence, _vm->_timer->kReasonSequencer); } void Sequence::startToOpen() { diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h index 07c90b455b77..67650d519dcb 100644 --- a/engines/avalanche/sequence2.h +++ b/engines/avalanche/sequence2.h @@ -54,7 +54,7 @@ class Sequence { private: AvalancheEngine *_vm; - void shoveLeft(); // This PROC is called by Timeout when it's time to do another frame. + void shoveLeft(); // This PROC is called by Timer when it's time to do another frame. }; } // End of namespace Avalanche. diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timer.cpp similarity index 91% rename from engines/avalanche/timeout2.cpp rename to engines/avalanche/timer.cpp index 0f484fc5e845..2656aeaa84d0 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timer.cpp @@ -25,11 +25,11 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* TIMEOUT The scheduling unit. */ +/* Original name: TIMEOUT The scheduling unit. */ #include "avalanche/avalanche.h" -#include "avalanche/timeout2.h" +#include "avalanche/timer.h" #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/animation.h" @@ -43,7 +43,7 @@ namespace Avalanche { -Timeout::Timeout(AvalancheEngine *vm) { +Timer::Timer(AvalancheEngine *vm) { _vm = vm; for (byte i = 0; i < 7; i++) { @@ -58,7 +58,7 @@ Timeout::Timeout(AvalancheEngine *vm) { * Add a nex timer * @remarks Originally called 'set_up_timer' */ -void Timeout::addTimer(int32 duration, byte action, byte reason) { +void Timer::addTimer(int32 duration, byte action, byte reason) { if ((_vm->_gyro->isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) @@ -81,7 +81,7 @@ void Timeout::addTimer(int32 duration, byte action, byte reason) { * Update the timers * @remarks Originally called 'one_tick' */ -void Timeout::updateTimer() { +void Timer::updateTimer() { if (_vm->_gyro->_dropdownActive) return; @@ -223,7 +223,7 @@ void Timeout::updateTimer() { _vm->_gyro->_dna._totalTime++; // Total amount of time for this game. } -void Timeout::loseTimer(byte which) { +void Timer::loseTimer(byte which) { for (byte i = 0; i < 7; i++) { if (_times[i]._reason == which) _times[i]._timeLeft = 0; // Cancel this one! @@ -232,7 +232,7 @@ void Timeout::loseTimer(byte which) { _timerLost = true; } -void Timeout::openDrawbridge() { +void Timer::openDrawbridge() { _vm->_gyro->_dna._drawbridgeOpen++; _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_dna._drawbridgeOpen - 1); @@ -242,7 +242,7 @@ void Timeout::openDrawbridge() { addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } -void Timeout::avariciusTalks() { +void Timer::avariciusTalks() { _vm->_visa->displayScrollChain('q', _vm->_gyro->_dna._avariciusTalk); _vm->_gyro->_dna._avariciusTalk++; @@ -252,27 +252,27 @@ void Timeout::avariciusTalks() { _vm->_lucerna->incScore(3); } -void Timeout::urinate() { +void Timer::urinate() { _vm->_animation->tr[0].turn(Animation::kDirUp); _vm->_animation->stopWalking(); _vm->_lucerna->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); } -void Timeout::toilet() { +void Timer::toilet() { _vm->_scrolls->displayText("That's better!"); } -void Timeout::bang() { +void Timer::bang() { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); addTimer(30, kProcBang2, kReasonExplosion); } -void Timeout::bang2() { +void Timer::bang2() { _vm->_scrolls->displayText("Hmm... sounds like Spludwick's up to something..."); } -void Timeout::stairs() { +void Timer::stairs() { _vm->_gyro->blip(); _vm->_animation->tr[0].walkto(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); @@ -282,7 +282,7 @@ void Timeout::stairs() { _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) } -void Timeout::cardiffSurvey() { +void Timer::cardiffSurvey() { if (_vm->_gyro->_dna._cardiffQuestionNum == 0) { _vm->_gyro->_dna._cardiffQuestionNum++; _vm->_visa->displayScrollChain('q', 27); @@ -293,16 +293,16 @@ void Timeout::cardiffSurvey() { addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } -void Timeout::cardiffReturn() { +void Timer::cardiffReturn() { _vm->_visa->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } -void Timeout::cwytalotInHerts() { +void Timer::cwytalotInHerts() { _vm->_visa->displayScrollChain('q', 29); } -void Timeout::getTiedUp() { +void Timer::getTiedUp() { _vm->_visa->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; @@ -314,14 +314,14 @@ void Timeout::getTiedUp() { addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } -void Timeout::getTiedUp2() { +void Timer::getTiedUp2() { _vm->_animation->tr[0].walkto(4); _vm->_animation->tr[1].walkto(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } -void Timeout::hangAround() { +void Timer::hangAround() { _vm->_animation->tr[1]._doCheck = false; _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; @@ -331,7 +331,7 @@ void Timeout::hangAround() { addTimer(55, kProcHangAround2, kReasonHangingAround); } -void Timeout::hangAround2() { +void Timer::hangAround2() { _vm->_visa->displayScrollChain('q', 40); _vm->_animation->tr[1]._vanishIfStill = false; _vm->_animation->tr[1].walkto(4); @@ -348,7 +348,7 @@ void Timeout::hangAround2() { _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. } -void Timeout::afterTheShootemup() { +void Timer::afterTheShootemup() { _vm->_animation->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! @@ -379,12 +379,12 @@ void Timeout::afterTheShootemup() { points(gain); #endif - warning("STUB: Timeout::after_the_shootemup()"); + warning("STUB: Timer::after_the_shootemup()"); _vm->_visa->displayScrollChain('q', 70); } -void Timeout::jacquesWakesUp() { +void Timer::jacquesWakesUp() { _vm->_gyro->_dna._jacquesState++; switch (_vm->_gyro->_dna._jacquesState) { // Additional pictures. @@ -422,7 +422,7 @@ void Timeout::jacquesWakesUp() { } } -void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your money. +void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->apped(2, 1); // He starts at the door... _vm->_animation->tr[1].walkto(3); // He walks over to you. @@ -435,20 +435,20 @@ void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your m addTimer(50, kProcNaughtyDuke2, kReasonNaughtyDuke); } -void Timeout::naughtyDuke2() { +void Timer::naughtyDuke2() { _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" _vm->_animation->tr[1].walkto(1); // Walk to the door. _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } -void Timeout::naughtyDuke3() { +void Timer::naughtyDuke3() { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); } -void Timeout::jump() { +void Timer::jump() { _vm->_gyro->_dna._jumpStatus++; switch (_vm->_gyro->_dna._jumpStatus) { @@ -495,12 +495,12 @@ void Timeout::jump() { } } -void Timeout::crapulusSaysSpludOut() { +void Timer::crapulusSaysSpludOut() { _vm->_visa->displayScrollChain('q', 56); _vm->_gyro->_dna._crapulusWillTell = false; } -void Timeout::buyDrinks() { +void Timer::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; @@ -512,7 +512,7 @@ void Timeout::buyDrinks() { _vm->_acci->drink(); } -void Timeout::buyWine() { +void Timer::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_dna._malagauche = 0; @@ -526,24 +526,24 @@ void Timeout::buyWine() { } } -void Timeout::callsGuards() { +void Timer::callsGuards() { _vm->_visa->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } -void Timeout::greetsMonk() { +void Timer::greetsMonk() { _vm->_visa->displayScrollChain('Q', 59); _vm->_gyro->_dna._enteredLustiesRoomAsMonk = true; } -void Timeout::fallDownOubliette() { +void Timer::fallDownOubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; _vm->_animation->tr[0]._moveY++; // Increments dx/dy! _vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); } -void Timeout::meetAvaroid() { +void Timer::meetAvaroid() { if (_vm->_gyro->_dna._metAvaroid) { _vm->_scrolls->displayText(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); @@ -562,7 +562,7 @@ void Timeout::meetAvaroid() { } } -void Timeout::riseUpOubliette() { +void Timer::riseUpOubliette() { _vm->_animation->tr[0]._visible = true; _vm->_animation->tr[0]._moveY++; // Decrements dx/dy! _vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go... @@ -572,7 +572,7 @@ void Timeout::riseUpOubliette() { _vm->_gyro->_dna._userMovesAvvy = true; } -void Timeout::robinHoodAndGeida() { +void Timer::robinHoodAndGeida() { _vm->_animation->tr[0].init(7, true, _vm->_animation); _vm->_animation->apped(1, 7); _vm->_animation->tr[0].walkto(6); @@ -582,7 +582,7 @@ void Timeout::robinHoodAndGeida() { _vm->_gyro->_dna._geidaFollows = false; } -void Timeout::robinHoodAndGeidaTalk() { +void Timer::robinHoodAndGeidaTalk() { _vm->_visa->displayScrollChain('q', 66); _vm->_animation->tr[0].walkto(2); _vm->_animation->tr[1].walkto(2); @@ -591,7 +591,7 @@ void Timeout::robinHoodAndGeidaTalk() { addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); } -void Timeout::avalotReturns() { +void Timer::avalotReturns() { _vm->_animation->tr[0].done(); _vm->_animation->tr[1].done(); _vm->_animation->tr[0].init(0, true, _vm->_animation); @@ -605,7 +605,7 @@ void Timeout::avalotReturns() { * so that it will happen when Avvy stops walking. * @remarks Originally called 'avvy_sit_down' */ -void Timeout::avvySitDown() { +void Timer::avvySitDown() { if (_vm->_animation->tr[0]._homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { @@ -616,12 +616,12 @@ void Timeout::avvySitDown() { } } -void Timeout::ghostRoomPhew() { +void Timer::ghostRoomPhew() { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman + " You're glad to get out of " + _vm->_scrolls->kControlItalic + "there!"); } -void Timeout::arkataShouts() { +void Timer::arkataShouts() { if (_vm->_gyro->_dna._teetotal) return; @@ -629,11 +629,11 @@ void Timeout::arkataShouts() { addTimer(160, kProcArkataShouts, kReasonArkataShouts); } -void Timeout::winning() { +void Timer::winning() { _vm->_visa->displayScrollChain('q', 79); _vm->_pingo->winningPic(); - warning("STUB: Timeout::winning()"); + warning("STUB: Timer::winning()"); #if 0 do { _vm->_lucerna->checkclick(); @@ -646,7 +646,7 @@ void Timeout::winning() { _vm->_gyro->_letMeOut = true; } -void Timeout::avalotFalls() { +void Timer::avalotFalls() { if (_vm->_animation->tr[0]._stepNum < 5) { _vm->_animation->tr[0]._stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); @@ -661,18 +661,18 @@ void Timeout::avalotFalls() { } } -void Timeout::spludwickGoesToCauldron() { +void Timer::spludwickGoesToCauldron() { if (_vm->_animation->tr[1]._homing) addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludWalk); else addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludWalk); } -void Timeout::spludwickLeavesCauldron() { +void Timer::spludwickLeavesCauldron() { _vm->_animation->tr[1]._callEachStepFl = true; // So that normal procs will continue. } -void Timeout::giveLuteToGeida() { // Moved here from Acci. +void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_visa->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_dna._lustieIsAsleep = true; diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timer.h similarity index 95% rename from engines/avalanche/timeout2.h rename to engines/avalanche/timer.h index 5f1769a66366..c8b664b74388 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timer.h @@ -25,17 +25,17 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* TIMEOUT The scheduling unit. */ +/* Original name: TIMEOUT The scheduling unit. */ -#ifndef AVALANCHE_TIMEOUT2_H -#define AVALANCHE_TIMEOUT2_H +#ifndef AVALANCHE_TIMER_H +#define AVALANCHE_TIMER_H #include "common/scummsys.h" namespace Avalanche { class AvalancheEngine; -class Timeout { +class Timer { public: // Reason runs between 1 and 28. enum Reason { @@ -114,16 +114,16 @@ class Timeout { kProcGiveLuteToGeida = 41 }; - struct TimeType { + struct TimerType { int32 _timeLeft; byte _action; byte _reason; }; - TimeType _times[7]; + TimerType _times[7]; bool _timerLost; // Is the timer "lost"? (Because of using loseTimer()) - Timeout(AvalancheEngine *vm); + Timer(AvalancheEngine *vm); void addTimer(int32 duration, byte action, byte reason); void updateTimer(); @@ -177,4 +177,4 @@ class Timeout { } // End of namespace Avalanche. -#endif // AVALANCHE_TIMEOUT2_H +#endif // AVALANCHE_TIMER_H From aafaaef37f76f9deb6d34c2ef76da87d103e7b52 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 11:34:21 +0200 Subject: [PATCH 0888/1332] AVALANCHE: Some renaming in Animation. --- engines/avalanche/acci2.cpp | 10 +-- engines/avalanche/animation.cpp | 115 +++----------------------------- engines/avalanche/animation.h | 68 ++++++------------- engines/avalanche/celer2.cpp | 3 - engines/avalanche/dropdown2.cpp | 3 - engines/avalanche/lucerna2.cpp | 14 ++-- engines/avalanche/parser.cpp | 2 - engines/avalanche/timeout2.cpp | 20 +++--- engines/avalanche/visa2.cpp | 2 +- 9 files changed, 54 insertions(+), 183 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 3691ae9afc4c..3861a773cbd0 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -407,7 +407,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_dna._spareEvening.clear(); _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->displayScrollChain('z', 5); // His closing statement... - _vm->_animation->tr[1].walkto(4); // The end of the drawbridge + _vm->_animation->tr[1].walkTo(4); // The end of the drawbridge _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; @@ -1042,7 +1042,7 @@ void Acci::notInOrder() { void Acci::goToCauldron() { _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. _vm->_timeout->addTimer(1, _vm->_timeout->kProcSpludwickGoesToCauldron, _vm->_timeout->kReasonSpludWalk); - _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].walkTo(2); } /** @@ -1702,7 +1702,7 @@ void Acci::doThat() { else { _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius _vm->_animation->apped(2, 4); - _vm->_animation->tr[1].walkto(5); + _vm->_animation->tr[1].walkTo(5); _vm->_animation->tr[1]._callEachStepFl = true; _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; @@ -1861,7 +1861,7 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->incScore(7); - _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].walkTo(2); _vm->_animation->tr[1]._vanishIfStill = true; _vm->_animation->tr[1]._callEachStepFl = false; _vm->_gyro->_whereIs[7] = 177; @@ -1984,7 +1984,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._sittingInPub) _vm->_scrolls->displayText("You're already sitting!"); else { - _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. + _vm->_animation->tr[0].walkTo(4); // Move Avvy to the place, and sit him down. _vm->_timeout->addTimer(1, _vm->_timeout->kProcAvvySitDown, _vm->_timeout->kReasonSittingDown); } } else { // Default doodah. diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 68266f366d43..83ff5d65d4c9 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -192,15 +192,13 @@ void AnimationType::walk() { r._y1 = _y - 2; r._x2 = ((_x + _info._xLength) / 8) + 1; r._y2 = _y + _info._yLength + 2; - - _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); } if (!_tr->_vm->_gyro->_doingSpriteRun) { _oldX[_tr->_vm->_gyro->_cp] = _x; _oldY[_tr->_vm->_gyro->_cp] = _y; if (_homing) - homestep(); + homeStep(); _x += _moveX; _y += _moveY; } @@ -275,7 +273,7 @@ int8 AnimationType::sgn(int16 val) { return 0; } -void AnimationType::walkto(byte pednum) { +void AnimationType::walkTo(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y)); _homingX = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; @@ -287,7 +285,7 @@ void AnimationType::stophoming() { _homing = false; } -void AnimationType::homestep() { +void AnimationType::homeStep() { int16 temp; if ((_homingX == _x) && (_homingY == _y)) { @@ -349,73 +347,7 @@ void AnimationType::chatter() { _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; } -/** - * Init Saver structure - * @remarks Originally called 'set_up_saver' - */ -void AnimationType::setupSaver(AnimationSaver &sav) { - sav._id = _id; - sav._facingDir = _facingDir; - sav._stepNum = _stepNum; - sav._x = _x; - sav._y = _y; - sav._moveX = _moveX; - sav._moveY = _moveY; - sav._visible = _visible; - sav._homing = _homing; - sav._doCheck = _doCheck; - sav._count = _count; - sav._xWidth = _info._xWidth; - sav._speedX = _speedX; - sav._speedY = _speedY; - sav._animCount = _animCount; - sav._homingX = _homingX; - sav._homingY = _homingY; - sav._callEachStepFl = _callEachStepFl; - sav._eachStepProc = _eachStepProc; - sav._vanishIfStill = _vanishIfStill; -} - -void AnimationType::unload_saver(AnimationSaver sav) { - _id = sav._id; - _facingDir = sav._facingDir; - _stepNum = sav._stepNum; - _x = sav._x; - _y = sav._y; - _moveX = sav._moveX; - _moveY = sav._moveY; - _visible = sav._visible; - _homing = sav._homing; - _doCheck = sav._doCheck; - _count = sav._count; - _info._xWidth = sav._xWidth; - _speedX = sav._speedX; - _speedY = sav._speedY; - _animCount = sav._animCount; - _homingX = sav._homingX; - _homingY = sav._homingY; - _callEachStepFl = sav._callEachStepFl; - _eachStepProc = sav._eachStepProc; - _vanishIfStill = sav._vanishIfStill; -} - -void AnimationType::savedata(Common::File &f) { - warning("STUB: triptype::savedata()"); -} - -void AnimationType::loaddata(Common::File &f) { - warning("STUB: triptype::loaddata()"); -} - -void AnimationType::save_data_to_mem(uint16 &where) { - warning("STUB: triptype::save_data_to_mem()"); -} - -void AnimationType::load_data_from_mem(uint16 &where) { - warning("STUB: triptype::load_data_from_mem()"); -} - -AnimationType *AnimationType::done() { +void AnimationType::done() { _animCount--; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) @@ -429,30 +361,11 @@ AnimationType *AnimationType::done() { _quick = false; _id = 177; - return this; -} - -getsettype *getsettype::init() { - numleft = 0; // initialize array pointer - return this; -} - -void getsettype::remember(ByteField r) { - numleft++; - //if (numleft > maxgetset) - // error("Trip::remember() : runerr_Getset_Overflow"); - gs[numleft] = r; -} - -void getsettype::recall(ByteField &r) { - r = gs[numleft]; - numleft--; } Animation::Animation(AvalancheEngine *vm) { _vm = vm; - getsetclear(); mustexclaim = false; } @@ -863,7 +776,7 @@ void Animation::call_special(uint16 which) { if (!_vm->_gyro->_dna._arrowTriggered) { _vm->_gyro->_dna._arrowTriggered = true; apped(2, 4); // The dart starts at ped 4, and... - tr[1].walkto(5); // flies to ped 5. + tr[1].walkTo(5); // flies to ped 5. tr[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk @@ -891,7 +804,7 @@ void Animation::call_special(uint16 which) { _vm->_visa->displayScrollChain('q', 36); _vm->_gyro->_dna._tiedUp = true; _vm->_gyro->_dna._friarWillTieYouUp = false; - tr[1].walkto(3); + tr[1].walkTo(3); tr[1]._vanishIfStill = true; tr[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. @@ -928,7 +841,7 @@ void Animation::call_special(uint16 which) { if (!_vm->_gyro->_dna._geidaFollows) return; // DOESN'T COUNT: no Geida. tr[1]._callEachStepFl = false; // She no longer follows Avvy around. - tr[1].walkto(4); // She walks to somewhere... + tr[1].walkTo(4); // She walks to somewhere... tr[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; _vm->_timeout->addTimer(40, _vm->_timeout->kProcRobinHoodAndGeida, _vm->_timeout->kReasonRobinHoodAndGeida); @@ -1074,10 +987,6 @@ void Animation::newspeed() { _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); //setactivepage(1 - cp); - - for (byte i = 0; i <= 1; i++) - getset[i].remember(lightspace); - } void Animation::rwsp(byte t, byte dir) { @@ -1173,9 +1082,9 @@ void Animation::follow_avvy_y(byte tripnum) { void Animation::back_and_forth(byte tripnum) { if (!tr[tripnum]._homing) { if (tr[tripnum]._facingDir == kDirRight) - tr[tripnum].walkto(4); + tr[tripnum].walkTo(4); else - tr[tripnum].walkto(5); + tr[tripnum].walkTo(5); } } @@ -1438,11 +1347,6 @@ void Animation::readstick() { warning("STUB: Trip::readstick()"); } -void Animation::getsetclear() { - for (byte fv = 0; fv <= 1; fv++) - getset[fv].init(); -} - /** * Hide in the cupboard * @remarks Originally called 'hide_in_the_cupboard' @@ -1493,7 +1397,6 @@ void Animation::fliproom(byte room, byte ped) { _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); _vm->_lucerna->dusk(); - getsetclear(); for (int16 i = 1; i < kSpriteNumbMax; i++) { if (tr[i]._quick) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 72c86a48de5c..99ed6e265d6b 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -76,45 +76,35 @@ class AnimationType { public: SpriteInfo _info; - adxtype _stat; // vital statistics + adxtype _stat; // Vital statistics. byte _facingDir, _stepNum; - int16 _x, _y; // current xy coords - int16 _oldX[2], _oldY[2]; // last xy coords - int8 _moveX, _moveY; // amount to move sprite by, each step + int16 _x, _y; // Current xy coords. + int16 _oldX[2], _oldY[2]; // Last xy coords. + int8 _moveX, _moveY; // Amount to move sprite by, each step. byte _id; bool _quick, _visible, _homing, _doCheck; - int16 _homingX, _homingY; // homing x & y coords - byte _count; // counts before changing step - byte _speedX, _speedY; // x & y speed - byte _animCount; // total number of sprites + int16 _homingX, _homingY; // Homing x & y coords. + byte _count; // Counts before changing step. + byte _speedX, _speedY; // x & y speed. + byte _animCount; // Total number of sprites. bool _vanishIfStill; // Do we show this sprite if it's still? - bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; - void init(byte spritenum, bool doCheck, Animation *tr); - // loads & sets up the sprite - void original(); // just sets Quick to false - void andexor(); // drops sprite onto screen - void turn(byte whichway); // turns him round - void appear(int16 wx, int16 wy, byte wf); // switches him on - void bounce(); // bounces off walls. - void walk(); // prepares for andexor, etc. - void walkto(byte pednum); // home in on a point - void stophoming(); // self-explanatory - void homestep(); // calculates ix & iy for one homing step - void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc - void stopWalk(); // Stops the sprite from moving - void chatter(); // Sets up talk vars - void setupSaver(AnimationSaver &sav); - void unload_saver(AnimationSaver sav); - - void savedata(Common::File &f); // Self-explanatory, - void loaddata(Common::File &f); // really. - - void save_data_to_mem(uint16 &where); - void load_data_from_mem(uint16 &where); - AnimationType *done(); + void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite. + void original(); // Just sets 'quick' to false. + void andexor(); // Drops sprite onto screen. + void turn(byte whichway); // Turns character round. + void appear(int16 wx, int16 wy, byte wf); // Switches it on. + void bounce(); // Bounces off walls. + void walk(); // Prepares for andexor, etc. + void walkTo(byte pednum); // Home in on a point. + void stophoming(); // Self-explanatory. + void homeStep(); // Calculates ix & iy for one homing step. + void speed(int8 xx, int8 yy); // Sets ix & iy, non-homing, etc. + void stopWalk(); // Stops the sprite from moving. + void chatter(); // Sets up talk vars. + void done(); private: Animation *_tr; @@ -123,18 +113,6 @@ class AnimationType { int8 sgn(int16 val); }; -const int16 maxgetset = 35; - -class getsettype { -public: - ByteField gs[maxgetset]; - byte numleft; - - getsettype *init(); - void remember(ByteField r); - void recall(ByteField &r); -}; - class Animation { public: friend class AnimationType; @@ -184,7 +162,6 @@ class Animation { void handleMoveKey(const Common::Event &event); // To replace tripkey(). AnimationType tr[kSpriteNumbMax]; - getsettype getset[2]; byte aa[1600]; bool mustexclaim; @@ -209,7 +186,6 @@ class Animation { void spin(byte whichway, byte &tripnum); void geida_procs(byte tripnum); void call_andexors(); - void getsetclear(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index a261311f64fd..5069a92e0aa1 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -365,9 +365,6 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); - - for (byte i = 0; i < 2; i++) - _vm->_animation->getset[i].remember(_r); } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 33a2671a8bb0..ef448152dbf9 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -243,9 +243,6 @@ void MenuBar::draw() { for (byte i = 0; i < _menuNum; i++) _menuItems[i].draw(); - for (byte page = 0; page <= 1; page++) - _dr->_vm->_animation->getset[page].remember(menuspace); - _dr->_vm->_gyro->_cp = savecp; } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 598ff6386945..0fcdbcaa82a2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -449,7 +449,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { _vm->_animation->apped(2, 4); // Start on the right-hand side of the screen. - _vm->_animation->tr[1].walkto(5); // Walks up to greet you. + _vm->_animation->tr[1].walkTo(5); // Walks up to greet you. } else { _vm->_animation->apped(2, 5); // Starts where he was before. _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; @@ -463,7 +463,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._crapulusWillTell) { _vm->_animation->tr[1].init(8, false, _vm->_animation); _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkto(4); + _vm->_animation->tr[1].walkTo(4); _vm->_timeout->addTimer(20, _vm->_timeout->kProcCrapulusSpludOut, _vm->_timeout->kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } @@ -508,7 +508,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... _vm->_animation->apped(2, 2); // He appears on the right of the screen... - _vm->_animation->tr[1].walkto(4); // ...and he walks up... + _vm->_animation->tr[1].walkTo(4); // ...and he walks up... } else { // You've been here before. _vm->_animation->apped(2, 4); // He's standing in your way straight away... @@ -523,7 +523,7 @@ void Lucerna::enterRoom(byte room, byte ped) { (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->apped(2, 1); - _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].walkTo(2); _vm->_animation->tr[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? @@ -547,7 +547,7 @@ void Lucerna::enterRoom(byte room, byte ped) { // A welcome party... or maybe not... _vm->_animation->tr[1].init(6, false, _vm->_animation); _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkto(3); + _vm->_animation->tr[1].walkTo(3); _vm->_timeout->addTimer(36, _vm->_timeout->kProcGetTiedUp, _vm->_timeout->kReasonGettingTiedUp); } } @@ -571,7 +571,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case 0 : { // You've answered NONE of his questions. _vm->_animation->tr[1].init(9, false, _vm->_animation); _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkto(3); + _vm->_animation->tr[1].walkTo(3); _vm->_timeout->addTimer(47, _vm->_timeout->kProcCardiffSurvey, _vm->_timeout->kReasonCardiffsurvey); } break; @@ -710,7 +710,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->tr[1].init(11, false, _vm->_animation); if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { _vm->_animation->apped(2, 2); // Start on the right-hand side of the screen. - _vm->_animation->tr[1].walkto(4); // Walks up to greet you. + _vm->_animation->tr[1].walkTo(4); // Walks up to greet you. } else { _vm->_animation->apped(2, 4); // Starts where she was before. _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e20413b2f616..a378b0d54bf1 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -155,8 +155,6 @@ void Parser::drawCursor() { bf._x2 = _inputTextPos + 2; bf._y1 = 168; bf._y2 = 168; - for (byte fv = 0; fv <= 1; fv++) - _vm->_animation->getset[fv].remember(bf); } void Parser::wipeText() { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 0f484fc5e845..25ca5851c148 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -274,7 +274,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); - _vm->_animation->tr[0].walkto(4); + _vm->_animation->tr[0].walkTo(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._brummieStairs = 2; _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; @@ -315,8 +315,8 @@ void Timeout::getTiedUp() { } void Timeout::getTiedUp2() { - _vm->_animation->tr[0].walkto(4); - _vm->_animation->tr[1].walkto(5); + _vm->_animation->tr[0].walkTo(4); + _vm->_animation->tr[1].walkTo(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } @@ -327,14 +327,14 @@ void Timeout::hangAround() { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; _vm->_animation->apped(1, 2); _vm->_visa->displayScrollChain('q', 39); - _vm->_animation->tr[0].walkto(7); + _vm->_animation->tr[0].walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timeout::hangAround2() { _vm->_visa->displayScrollChain('q', 40); _vm->_animation->tr[1]._vanishIfStill = false; - _vm->_animation->tr[1].walkto(4); + _vm->_animation->tr[1].walkTo(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); _vm->_animation->tr[0].done(); @@ -425,7 +425,7 @@ void Timeout::jacquesWakesUp() { void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your money. _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->apped(2, 1); // He starts at the door... - _vm->_animation->tr[1].walkto(3); // He walks over to you. + _vm->_animation->tr[1].walkTo(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -437,7 +437,7 @@ void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your m void Timeout::naughtyDuke2() { _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" - _vm->_animation->tr[1].walkto(1); // Walk to the door. + _vm->_animation->tr[1].walkTo(1); // Walk to the door. _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } @@ -575,7 +575,7 @@ void Timeout::riseUpOubliette() { void Timeout::robinHoodAndGeida() { _vm->_animation->tr[0].init(7, true, _vm->_animation); _vm->_animation->apped(1, 7); - _vm->_animation->tr[0].walkto(6); + _vm->_animation->tr[0].walkTo(6); _vm->_animation->tr[1].stopWalk(); _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); @@ -584,8 +584,8 @@ void Timeout::robinHoodAndGeida() { void Timeout::robinHoodAndGeidaTalk() { _vm->_visa->displayScrollChain('q', 66); - _vm->_animation->tr[0].walkto(2); - _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[0].walkTo(2); + _vm->_animation->tr[1].walkTo(2); _vm->_animation->tr[0]._vanishIfStill = true; _vm->_animation->tr[1]._vanishIfStill = true; addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 8eaa1daf6451..98a1e227fd0f 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -268,7 +268,7 @@ void Visa::talkTo(byte whom) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. _vm->_animation->tr[1]._vanishIfStill = true; - _vm->_animation->tr[1].walkto(3); // Walks away. + _vm->_animation->tr[1].walkTo(3); // Walks away. _vm->_lucerna->incScore(2); } From 8f152c083394a877db1d2576e6654cdbdee5999e Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 11:40:35 +0200 Subject: [PATCH 0889/1332] AVALANCHE: Renaming/refactoring in Animation. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/animation.cpp | 15 ++++++------ engines/avalanche/animation.h | 42 +++++++-------------------------- engines/avalanche/dropdown2.cpp | 2 -- engines/avalanche/visa2.cpp | 2 +- 5 files changed, 18 insertions(+), 45 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index aa99517cfda1..d30b659c24f8 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1278,7 +1278,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->tr[i]._quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { + if (_vm->_animation->tr[i]._quick && ((_vm->_animation->tr[i]._stat._acciNum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 9aee7db95c41..bdf2bb462711 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -88,11 +88,11 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { _stat._frameNum = inf.readByte(); _info._xLength = inf.readByte(); _info._yLength = inf.readByte(); - _stat.seq = inf.readByte(); + _stat._seq = inf.readByte(); _info._size = inf.readUint16LE(); _stat._fgBubbleCol = inf.readByte(); _stat._bgBubbleCol = inf.readByte(); - _stat.accinum = inf.readByte(); + _stat._acciNum = inf.readByte(); _animCount = 0; // = 1; _info._xWidth = _info._xLength / 8; @@ -144,7 +144,7 @@ void AnimationType::original() { void AnimationType::andexor() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = _facingDir * _stat.seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } @@ -245,7 +245,7 @@ void AnimationType::walk() { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; - if (_stepNum == _stat.seq) + if (_stepNum == _stat._seq) _stepNum = 0; _count = 0; } @@ -970,7 +970,6 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { void Animation::newspeed() { // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. - const ByteField lightspace = {40, 199, 47, 199}; tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX; @@ -1072,7 +1071,7 @@ void Animation::follow_avvy_y(byte tripnum) { return; if (tr[tripnum]._moveX == 0) { tr[tripnum]._stepNum += 1; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; tr[tripnum]._count = 0; } @@ -1170,7 +1169,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. if (tr[tripnum]._y < toy) tr[tripnum]._y++; tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; } } @@ -1178,7 +1177,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. void Animation::take_a_step(byte &tripnum) { if (tr[tripnum]._moveX == 0) { tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; tr[tripnum]._count = 0; } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 00f11540f113..7cb8e12f0bc4 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -37,46 +37,23 @@ namespace Avalanche { class AvalancheEngine; +class Animation; -struct adxtype { // Second revision of ADX type - // CHECKME: Useless? - Common::String _name; // name of character - Common::String _comment; // comment +struct StatType { + Common::String _name; // Name of character. + Common::String _comment; // Comment. // - byte _frameNum; // number of pictures - byte seq; // how many in one stride - byte _fgBubbleCol, _bgBubbleCol; // foreground & background bubble colors - byte accinum; // the number according to Acci (1=Avvy, etc.) -}; - -struct AnimationSaver { - byte _id; - byte _facingDir; - byte _stepNum; - int16 _x; - int16 _y; - int8 _moveX; - int8 _moveY; - bool _visible; - bool _homing; - bool _doCheck; - byte _count; - byte _xWidth, _speedX, _speedY; - byte _animCount; - int16 _homingX; - int16 _homingY; - bool _callEachStepFl; - byte _eachStepProc; - bool _vanishIfStill; + byte _frameNum; // Number of pictures. + byte _seq; // How many in one stride. + byte _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. + byte _acciNum; // The number according to Acci. (1=Avvy, etc.) }; -class Animation; - class AnimationType { public: SpriteInfo _info; - adxtype _stat; // Vital statistics. + StatType _stat; // Vital statistics. byte _facingDir, _stepNum; int16 _x, _y; // Current xy coords. int16 _oldX[2], _oldY[2]; // Last xy coords. @@ -116,7 +93,6 @@ class AnimationType { class Animation { public: friend class AnimationType; - friend class getsettype; static const byte kDirUp = 0; static const byte kDirRight = 1; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index ef448152dbf9..2d6d2722087d 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -231,8 +231,6 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Drop } void MenuBar::draw() { - const ByteField menuspace = {0, 0, 80, 9}; - //setactivepage(3); _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 98a1e227fd0f..b0be1886bd39 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -245,7 +245,7 @@ void Visa::talkTo(byte whom) { bool noMatches = true; for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) - if (_vm->_animation->tr[i]._stat.accinum == whom) { + if (_vm->_animation->tr[i]._stat._acciNum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); noMatches = false; break; From 3cc438171a55d21dbbe7644dcbb2317b2b4041fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 11:47:00 +0200 Subject: [PATCH 0890/1332] AVALANCHE: Review variable scope in Visa2, add some doxygen comments --- engines/avalanche/visa2.cpp | 142 ++++++++++++++++++------------------ engines/avalanche/visa2.h | 6 +- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index b0be1886bd39..9904e94fbc4b 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -42,7 +42,7 @@ namespace Avalanche { Visa::Visa(AvalancheEngine *vm) { _vm = vm; - noError = true; + _noError = true; } void Visa::unSkrimble() { @@ -55,29 +55,32 @@ void Visa::doTheBubble() { _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } +/** + * Display a string in a scroll + * @remarks Originally called 'dixi' + */ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling) { - Common::File indexfile, sezfile; - uint16 idx_offset, sez_offset; - bool error = false; - + Common::File indexfile; if (!indexfile.open("avalot.idx")) { warning("AVALANCHE: Visa: File not found: avalot.idx"); return; } + bool error = false; + indexfile.seek((toupper(block) - 65) * 2); - idx_offset = indexfile.readUint16LE(); + uint16 idx_offset = indexfile.readUint16LE(); if (idx_offset == 0) error = true; indexfile.seek(idx_offset + point * 2); - sez_offset = indexfile.readUint16LE(); + uint16 sez_offset = indexfile.readUint16LE(); if (sez_offset == 0) error = true; indexfile.close(); - noError = !error; + _noError = !error; if (error) { if (report) { @@ -88,6 +91,7 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling return; } + Common::File sezfile; if (!sezfile.open("avalot.sez")) { warning("AVALANCHE: Visa: File not found: avalot.sez"); return; @@ -104,47 +108,53 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling _vm->_scrolls->callScrollDriver(); } +/** + * Start speech + * @remarks Originally called 'speech' + */ void Visa::speak(byte who, byte subject) { - Common::File indexfile, sezfile; - if (subject == 0) { // No subject. displayScrollChain('s', who, false, true); - } else { // Subject given. - noError = false; // Assume that until we know otherwise. - - if (!indexfile.open("converse.avd")) { - warning("AVALANCHE: Visa: File not found: converse.avd"); - return; - } + return; + } - indexfile.seek(who * 2 - 2); - uint16 idx_offset = indexfile.readUint16LE(); - uint16 next_idx_offset = indexfile.readUint16LE(); + // Subject given. + _noError = false; // Assume that until we know otherwise. - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) - return; + Common::File indexfile; + if (!indexfile.open("converse.avd")) { + warning("AVALANCHE: Visa: File not found: converse.avd"); + return; + } - indexfile.seek(idx_offset + subject * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if ((sez_offset == 0) || (indexfile.err())) - return; - indexfile.close(); + indexfile.seek(who * 2 - 2); + uint16 idx_offset = indexfile.readUint16LE(); + uint16 next_idx_offset = indexfile.readUint16LE(); - if (!sezfile.open("avalot.sez")) { - warning("AVALANCHE: Visa: File not found: avalot.sez"); - return; - } - sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); - sezfile.close(); + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) + return; - unSkrimble(); - doTheBubble(); + indexfile.seek(idx_offset + subject * 2); + uint16 sez_offset = indexfile.readUint16LE(); + if ((sez_offset == 0) || (indexfile.err())) + return; + indexfile.close(); - _vm->_scrolls->callScrollDriver(); - noError = true; + Common::File sezfile; + if (!sezfile.open("avalot.sez")) { + warning("AVALANCHE: Visa: File not found: avalot.sez"); + return; } + sezfile.seek(sez_offset); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + sezfile.close(); + + unSkrimble(); + doTheBubble(); + + _vm->_scrolls->callScrollDriver(); + _noError = true; } void Visa::talkTo(byte whom) { @@ -153,7 +163,7 @@ void Visa::talkTo(byte whom) { _vm->_gyro->_subjectNum = 0; } - if (_vm->_gyro->_subjectNum == 0) + if (_vm->_gyro->_subjectNum == 0) { switch (whom) { case Gyro::kPeopleSpludwick: if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1])) { @@ -162,27 +172,21 @@ void Visa::talkTo(byte whom) { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); return; - } else { - if (_vm->_gyro->_dna._talkedToCrapulus) - // Spludwick - what does he need? - // 0 - let it through to use normal routine. - switch (_vm->_gyro->_dna._givenToSpludwick) { - case 1: // Falltrough is intended. - case 2:{ - _vm->_scrolls->displayText(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); - return; - } - break; - case 3: { - displayScrollChain('q', 30); // Need any help with the game? - return; - } - break; - } - else { - displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. + } else if (_vm->_gyro->_dna._talkedToCrapulus) { + // Spludwick - what does he need? + // 0 - let it through to use normal routine. + switch (_vm->_gyro->_dna._givenToSpludwick) { + case 1: // Fallthrough is intended. + case 2: + _vm->_scrolls->displayText(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + return; + case 3: + displayScrollChain('q', 30); // Need any help with the game? return; } + } else { + displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. + return; } break; case Gyro::kPeopleIbythneth: @@ -208,10 +212,10 @@ void Visa::talkTo(byte whom) { } break; - case Gyro::kPeopleJacques: { + case Gyro::kPeopleJacques: displayScrollChain('q', 43); return; - } + case Gyro::kPeopleGeida: if (_vm->_gyro->_dna._givenPotionToGeida) _vm->_gyro->_dna._geidaFollows = true; @@ -233,30 +237,31 @@ void Visa::talkTo(byte whom) { } } break; - } - // On a subject. Is there any reason to block it? - else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { - displayScrollChain('q', 43); // He's fast asleep! - return; } + // On a subject. Is there any reason to block it? + } else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { + displayScrollChain('q', 43); // He's fast asleep! + return; + } if (whom > 149) whom -= 149; bool noMatches = true; - for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) + for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->tr[i]._stat._acciNum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); noMatches = false; break; } + } if (noMatches) _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); speak(whom, _vm->_gyro->_subjectNum); - if (!noError) + if (!_noError) displayScrollChain('n', whom); // File not found! if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only @@ -264,7 +269,6 @@ void Visa::talkTo(byte whom) { _vm->_lucerna->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. _vm->_gyro->_dna._talkedToCrapulus = true; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. _vm->_animation->tr[1]._vanishIfStill = true; diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 7a1597c1c5c8..c811053fabfd 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -39,16 +39,16 @@ class Visa { public: Visa(AvalancheEngine *vm); - void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); // Original: dixi(). + void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); void talkTo(byte whom); private: AvalancheEngine *_vm; - bool noError; + bool _noError; void unSkrimble(); void doTheBubble(); - void speak(byte who, byte subject); // Original: speech(). + void speak(byte who, byte subject); }; } // End of namespace Avalanche. From c0243036a293430b7872b3450735c9cc9e68930a Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 12:06:08 +0200 Subject: [PATCH 0891/1332] AVALANCHE: Renaming/refactoring in Animation. --- engines/avalanche/acci2.cpp | 88 +++---- engines/avalanche/animation.cpp | 433 ++++++++++++++------------------ engines/avalanche/animation.h | 40 ++- engines/avalanche/avalanche.cpp | 64 ++--- engines/avalanche/avalot.cpp | 8 +- engines/avalanche/dropdown2.cpp | 14 +- engines/avalanche/gyro2.cpp | 17 +- engines/avalanche/lucerna2.cpp | 168 ++++++------- engines/avalanche/scrolls2.cpp | 4 +- engines/avalanche/sequence2.cpp | 2 +- engines/avalanche/timer.cpp | 112 ++++----- engines/avalanche/visa2.cpp | 6 +- 12 files changed, 432 insertions(+), 524 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index d30b659c24f8..10b32cf7c0c4 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -407,8 +407,8 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_dna._spareEvening.clear(); _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->displayScrollChain('z', 5); // His closing statement... - _vm->_animation->tr[1].walkTo(4); // The end of the drawbridge - _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! + _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge + _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; break; @@ -896,7 +896,7 @@ void Acci::openDoor() { // Special cases. switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_animation->infield(2)) { + if (_vm->_animation->inField(2)) { // Opening the box. _thing = 54; // The box. _person = kPardon; @@ -916,25 +916,25 @@ void Acci::openDoor() { return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) { - if (_vm->_animation->infield(fv + 1)) { + if (_vm->_animation->inField(fv + 1)) { fv -= 8; switch (_vm->_gyro->_portals[fv]._operation) { case Gyro::kMagicExclaim: - _vm->_animation->tr[0].bounce(); + _vm->_animation->_sprites[0].bounce(); _vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: - _vm->_animation->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte + _vm->_animation->flipRoom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte ); break; case Gyro::kMagicUnfinished: - _vm->_animation->tr[0].bounce(); + _vm->_animation->_sprites[0].bounce(); _vm->_scrolls->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_animation->call_special(_vm->_gyro->_portals[fv]._data); + _vm->_animation->callSpecial(_vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicOpenDoor: _vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); @@ -1040,9 +1040,9 @@ void Acci::notInOrder() { } void Acci::goToCauldron() { - _vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs. + _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. _vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludWalk); - _vm->_animation->tr[1].walkTo(2); + _vm->_animation->_sprites[1].walkTo(2); } /** @@ -1102,9 +1102,9 @@ void Acci::drink() { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); - _vm->_animation->fliproom(1, 1); + _vm->_animation->flipRoom(1, 1); _vm->_gyro->setBackgroundColor(14); - _vm->_animation->new_game_for_trippancy(); // Not really. + _vm->_animation->_sprites[0]._visible = false; } } @@ -1112,12 +1112,12 @@ void Acci::cardiffClimbing() { if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. _vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_gyro->_dna._standingOnDais = false; - _vm->_animation->apped(1, 3); + _vm->_animation->appearPed(1, 3); } else { // Clamber down. - if (_vm->_animation->infield(1)) { + if (_vm->_animation->inField(1)) { _vm->_scrolls->displayText("You clamber up onto the dais."); _vm->_gyro->_dna._standingOnDais = true; - _vm->_animation->apped(1, 2); + _vm->_animation->appearPed(1, 2); } else _vm->_scrolls->displayText("Get a bit closer, Avvy."); } @@ -1136,9 +1136,9 @@ void Acci::standUp() { _vm->_gyro->setBackgroundColor(0); _vm->_visa->displayScrollChain('d', 14); } - _vm->_animation->tr[0]._visible = true; + _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_animation->apped(1, 2); + _vm->_animation->appearPed(1, 2); _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); @@ -1155,8 +1155,8 @@ void Acci::standUp() { case r__nottspub: if (_vm->_gyro->_dna._sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. - _vm->_animation->tr[0]._visible = true; // But standing up. - _vm->_animation->apped(1, 4); // And walking away. + _vm->_animation->_sprites[0]._visible = true; // But standing up. + _vm->_animation->appearPed(1, 4); // And walking away. _vm->_gyro->_dna._sittingInPub = false; // Really not sitting down. _vm->_gyro->_dna._userMovesAvvy = true; // And ambulant. } else @@ -1172,7 +1172,7 @@ void Acci::standUp() { void Acci::getProc(char thing) { switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_animation->infield(2)) { + if (_vm->_animation->inField(2)) { if (_vm->_gyro->_dna._boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->displayText("OK, I've got it."); @@ -1188,13 +1188,13 @@ void Acci::getProc(char thing) { case r__insidecardiffcastle: switch (thing) { case Gyro::kObjectPen: - if (_vm->_animation->infield(2)) { // Standing on the dais. + if (_vm->_animation->inField(2)) { // Standing on the dais. if (_vm->_gyro->_dna._takenPen) _vm->_scrolls->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. - _vm->_animation->call_special(3); // Zap! + _vm->_animation->callSpecial(3); // Zap! _vm->_gyro->_dna._takenPen = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -1213,7 +1213,7 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { + if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_dna._mushroomGrowing = false; @@ -1247,7 +1247,7 @@ void Acci::giveGeidaTheLute() { } void Acci::playHarp() { - if (_vm->_animation->infield(7)) + if (_vm->_animation->inField(7)) _vm->_scrolls->musicalScroll(); else _vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); @@ -1278,7 +1278,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->tr[i]._quick && ((_vm->_animation->tr[i]._stat._acciNum + 149) == _person)) { + if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } @@ -1568,13 +1568,13 @@ void Acci::doThat() { i = 3; else i = 0; - if (_vm->_animation->tr[0]._id != i) { - int16 x = _vm->_animation->tr[0]._x; - int16 y = _vm->_animation->tr[0]._y; - _vm->_animation->tr[0].done(); - _vm->_animation->tr[0].init(i, true, _vm->_animation); - _vm->_animation->tr[0].appear(x, y, Animation::kDirLeft); - _vm->_animation->tr[0]._visible = false; + if (_vm->_animation->_sprites[0]._id != i) { + int16 x = _vm->_animation->_sprites[0]._x; + int16 y = _vm->_animation->_sprites[0]._y; + _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[0].init(i, true, _vm->_animation); + _vm->_animation->_sprites[0].appear(x, y, Animation::kDirLeft); + _vm->_animation->_sprites[0]._visible = false; } } break; @@ -1695,16 +1695,16 @@ void Acci::doThat() { if (_vm->_gyro->_dna._avariciusTalk > 0) _vm->_visa->displayScrollChain('q', 19); else { - if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->infield(2))) { // Avaricius appears! + if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! _vm->_visa->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->displayScrollChain('q', 18); else { - _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius - _vm->_animation->apped(2, 4); - _vm->_animation->tr[1].walkTo(5); - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth; + _vm->_animation->_sprites[1].init(1, false, _vm->_animation); // Avaricius + _vm->_animation->appearPed(2, 4); + _vm->_animation->_sprites[1].walkTo(5); + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timer->addTimer(177, _vm->_timer->kProcAvariciusTalks, _vm->_timer->kReasonAvariciusTalks); } @@ -1744,7 +1744,7 @@ void Acci::doThat() { case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_dna._room) { case r__argentpub: - if (_vm->_animation->infield(6)) { // We're in a pub, and near the bar. + if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar. switch (_thing) { case 51: case 53: @@ -1804,7 +1804,7 @@ void Acci::doThat() { break; case r__outsideducks: - if (_vm->_animation->infield(6)) { + if (_vm->_animation->inField(6)) { if (_thing == _vm->_gyro->kObjectOnion) { if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! @@ -1861,9 +1861,9 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->incScore(7); - _vm->_animation->tr[1].walkTo(2); - _vm->_animation->tr[1]._vanishIfStill = true; - _vm->_animation->tr[1]._callEachStepFl = false; + _vm->_animation->_sprites[1].walkTo(2); + _vm->_animation->_sprites[1]._vanishIfStill = true; + _vm->_animation->_sprites[1]._callEachStepFl = false; _vm->_gyro->_whereIs[7] = 177; break; default: @@ -1984,7 +1984,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._sittingInPub) _vm->_scrolls->displayText("You're already sitting!"); else { - _vm->_animation->tr[0].walkTo(4); // Move Avvy to the place, and sit him down. + _vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, _vm->_timer->kProcAvvySitDown, _vm->_timer->kReasonSittingDown); } } else { // Default doodah. diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index bdf2bb462711..f83173ef77d2 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -121,7 +121,7 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { _speedX = 3; _speedY = 1; if (spritenum == 1) - _tr->newspeed(); // Just for the lights. + _tr->updateSpeed(); // Just for the lights. _homing = false; _moveX = 0; @@ -173,10 +173,10 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { */ bool AnimationType::checkCollision() { for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) { - if (_tr->tr[i]._quick && (_tr->tr[i]._id != _id) && - ((_x + _info._xLength) > _tr->tr[i]._x) && - (_x < (_tr->tr[i]._x + _tr->tr[i]._info._xLength)) && - (_tr->tr[i]._y == _y)) + if (_tr->_sprites[i]._quick && (_tr->_sprites[i]._id != _id) && + ((_x + _info._xLength) > _tr->_sprites[i]._x) && + (_x < (_tr->_sprites[i]._x + _tr->_sprites[i]._info._xLength)) && + (_tr->_sprites[i]._y == _y)) return true; } @@ -209,22 +209,22 @@ void AnimationType::walk() { return; } - byte tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte tc = _tr->checkFeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { switch (_tr->_vm->_gyro->_magics[tc]._operation) { case Gyro::kMagicExclaim: { bounce(); - _tr->mustexclaim = true; - _tr->saywhat = _tr->_vm->_gyro->_magics[tc]._data; + _tr->_mustExclaim = true; + _tr->_sayWhat = _tr->_vm->_gyro->_magics[tc]._data; } break; case Gyro::kMagicBounce: bounce(); break; case Gyro::kMagicTransport: - _tr->fliproom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); + _tr->flipRoom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); break; case Gyro::kMagicUnfinished: { bounce(); @@ -232,7 +232,7 @@ void AnimationType::walk() { } break; case Gyro::kMagicSpecial: - _tr->call_special(_tr->_vm->_gyro->_magics[tc]._data); + _tr->callSpecial(_tr->_vm->_gyro->_magics[tc]._data); break; case Gyro::kMagicOpenDoor: _tr->openDoor(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); @@ -366,25 +366,22 @@ void AnimationType::done() { Animation::Animation(AvalancheEngine *vm) { _vm = vm; - mustexclaim = false; + _mustExclaim = false; } Animation::~Animation() { for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i]._quick) - tr[i].done(); + if (_sprites[i]._quick) + _sprites[i].done(); } } -void Animation::loadtrip() { +void Animation::loadAnims() { for (int16 i = 0; i < kSpriteNumbMax; i++) - tr[i].original(); - - for (uint16 i = 0; i < sizeof(aa); i++) - aa[i] = 0; + _sprites[i].original(); } -byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { +byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { // if not alive then begin checkfeet:=0; exit; end; byte a = 0; @@ -432,11 +429,7 @@ byte Animation::geida_ped(byte which) { } } -void Animation::catamove(byte ped) { -/* When you enter a new position in the catacombs, this procedure should - be called. It changes the Also codes so that they may match the picture - on the screen. (Coming soon: It draws up the screen, too.) */ - +void Animation::catacombMove(byte ped) { int32 here; uint16 xy_uint16; byte fv; @@ -451,22 +444,22 @@ void Animation::catamove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs - fliproom(r__lustiesroom, 4); + flipRoom(r__lustiesroom, 4); _vm->_scrolls->displayText("Phew! Nice to be out of there!"); return; case 1033: // Oubliette - fliproom(r__oubliette, 1); + flipRoom(r__oubliette, 1); _vm->_scrolls->displayText(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); return; case 4: - fliproom(r__geidas, 1); + flipRoom(r__geidas, 1); return; case 2307: - fliproom(r__lusties, 5); + flipRoom(r__lusties, 5); _vm->_scrolls->displayText("Oh no... here we go again..."); _vm->_gyro->_dna._userMovesAvvy = false; - tr[0]._moveY = 1; - tr[0]._moveX = 0; + _sprites[0]._moveY = 1; + _sprites[0]._moveX = 0; return; } @@ -735,11 +728,11 @@ void Animation::catamove(byte ped) { } if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { - if (!tr[1]._quick) // If we don't already have her... - tr[1].init(5, true, this); // ...Load Geida. - apped(2, geida_ped(ped)); - tr[1]._callEachStepFl = true; - tr[1]._eachStepProc = kProcGeida; + if (!_sprites[1]._quick) // If we don't already have her... + _sprites[1].init(5, true, this); // ...Load Geida. + appearPed(2, geida_ped(ped)); + _sprites[1]._callEachStepFl = true; + _sprites[1]._eachStepProc = kProcGeida; } } @@ -750,7 +743,7 @@ void Animation::dawndelay() { _vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay); } -void Animation::call_special(uint16 which) { +void Animation::callSpecial(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -771,25 +764,25 @@ void Animation::call_special(uint16 which) { _vm->_gyro->_dna._userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. - tr[0].bounce(); // Must include that. + _sprites[0].bounce(); // Must include that. if (!_vm->_gyro->_dna._arrowTriggered) { _vm->_gyro->_dna._arrowTriggered = true; - apped(2, 4); // The dart starts at ped 4, and... - tr[1].walkTo(5); // flies to ped 5. - tr[1]._facingDir = kDirUp; // Only face. + appearPed(2, 4); // The dart starts at ped 4, and... + _sprites[1].walkTo(5); // flies to ped 5. + _sprites[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ // OK! - tr[1]._callEachStepFl = true; - tr[1]._eachStepProc = kProcArrow; + _sprites[1]._callEachStepFl = true; + _sprites[1]._eachStepProc = kProcArrow; } break; case 4: // This is the ghost room link. _vm->_lucerna->dusk(); - tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap + _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, _vm->_timer->kProcGhostRoomPhew, _vm->_timer->kReasonGhostRoomPhew); _vm->_enid->backToBootstrap(3); break; @@ -798,28 +791,28 @@ void Animation::call_special(uint16 which) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. _vm->_visa->displayScrollChain('q', 35); - tr[0].done(); + _sprites[0].done(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->displayScrollChain('q', 36); _vm->_gyro->_dna._tiedUp = true; _vm->_gyro->_dna._friarWillTieYouUp = false; - tr[1].walkTo(3); - tr[1]._vanishIfStill = true; - tr[1]._doCheck = true; // One of them must have Check_Me switched on. + _sprites[1].walkTo(3); + _sprites[1]._vanishIfStill = true; + _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. _vm->_timer->addTimer(364, _vm->_timer->kProcHangAround, _vm->_timer->kReasonHangingAround); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. _vm->_gyro->_dna._userMovesAvvy = false; - tr[0]._moveX = 3; - tr[0]._moveY = 0; - tr[0]._facingDir = kDirRight; + _sprites[0]._moveX = 3; + _sprites[0]._moveY = 0; + _sprites[0]._facingDir = kDirRight; _vm->_timer->addTimer(1, _vm->_timer->kProcFallDownOubliette, _vm->_timer->kReasonFallingDownOubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. - tr[0]._visible = false; + _sprites[0]._visible = false; _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; stopWalking(); _vm->_timer->loseTimer(_vm->_timer->kReasonFallingDownOubliette); @@ -831,18 +824,18 @@ void Animation::call_special(uint16 which) { case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { _vm->_visa->displayScrollChain('q', 63); - tr[1].turn(kDirDown); - tr[1].stopWalk(); - tr[1]._callEachStepFl = false; // Geida + _sprites[1].turn(kDirDown); + _sprites[1].stopWalk(); + _sprites[1]._callEachStepFl = false; // Geida _vm->_lucerna->gameOver(); } break; case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... if (!_vm->_gyro->_dna._geidaFollows) return; // DOESN'T COUNT: no Geida. - tr[1]._callEachStepFl = false; // She no longer follows Avvy around. - tr[1].walkTo(4); // She walks to somewhere... - tr[0].done(); // Lose Avvy. + _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. + _sprites[1].walkTo(4); // She walks to somewhere... + _sprites[0].done(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; _vm->_timer->addTimer(40, _vm->_timer->kProcRobinHoodAndGeida, _vm->_timer->kReasonRobinHoodAndGeida); break; @@ -858,50 +851,46 @@ void Animation::call_special(uint16 which) { } _vm->_lucerna->dusk(); _vm->_gyro->_dna._catacombY--; - catamove(4); + catacombMove(4); if (_vm->_gyro->_dna._room != r__catacombs) return; switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { case 0x1: - apped(1, 12); + appearPed(1, 12); break; case 0x3: - apped(1, 11); + appearPed(1, 11); break; default: - apped(1, 4); + appearPed(1, 4); } - getback(); dawndelay(); break; case 11: // _vm->_gyro->special 11: transfer east in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->_dna._catacombX++; - catamove(1); + catacombMove(1); if (_vm->_gyro->_dna._room != r__catacombs) return; - apped(1, 1); - getback(); + appearPed(1, 1); dawndelay(); break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->_dna._catacombY += 1; - catamove(2); + catacombMove(2); if (_vm->_gyro->_dna._room != r__catacombs) return; - apped(1, 2); - getback(); + appearPed(1, 2); dawndelay(); break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. _vm->_lucerna->dusk(); _vm->_gyro->_dna._catacombX--; - catamove(3); + catacombMove(3); if (_vm->_gyro->_dna._room != r__catacombs) return; - apped(1, 3); - getback(); + appearPed(1, 3); dawndelay(); break; } @@ -949,8 +938,8 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { _vm->_sequence->startToClose(); return; } else { - apped(1, 6); - tr[0]._facingDir = kDirRight; // added by TT 12/3/1995 + appearPed(1, 6); + _sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(9); } @@ -968,19 +957,19 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { _vm->_sequence->startToOpen(); } -void Animation::newspeed() { +void Animation::updateSpeed() { // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. - tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX; + _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; //setactivepage(3); - if (tr[0]._speedX == _vm->_gyro->kRun) + if (_sprites[0]._speedX == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - if (tr[0]._speedX == _vm->_gyro->kRun) + if (_sprites[0]._speedX == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); @@ -988,129 +977,97 @@ void Animation::newspeed() { //setactivepage(1 - cp); } -void Animation::rwsp(byte t, byte dir) { +void Animation::changeDirection(byte t, byte dir) { switch (dir) { case kDirUp: - tr[t].speed(0, -tr[t]._speedY); + _sprites[t].speed(0, -_sprites[t]._speedY); break; case kDirDown: - tr[t].speed(0, tr[t]._speedY); + _sprites[t].speed(0, _sprites[t]._speedY); break; case kDirLeft: - tr[t].speed(-tr[t]._speedX, 0); + _sprites[t].speed(-_sprites[t]._speedX, 0); break; case kDirRight: - tr[t].speed(tr[t]._speedX, 0); + _sprites[t].speed(_sprites[t]._speedX, 0); break; case kDirUpLeft: - tr[t].speed(-tr[t]._speedX, -tr[t]._speedY); + _sprites[t].speed(-_sprites[t]._speedX, -_sprites[t]._speedY); break; case kDirUpRight: - tr[t].speed(tr[t]._speedX, -tr[t]._speedY); + _sprites[t].speed(_sprites[t]._speedX, -_sprites[t]._speedY); break; case kDirDownLeft: - tr[t].speed(-tr[t]._speedX, tr[t]._speedY); + _sprites[t].speed(-_sprites[t]._speedX, _sprites[t]._speedY); break; case kDirDownRight: - tr[t].speed(tr[t]._speedX, tr[t]._speedY); + _sprites[t].speed(_sprites[t]._speedX, _sprites[t]._speedY); break; } } -void Animation::apped(byte trn, byte np) { +void Animation::appearPed(byte trn, byte np) { trn--; np--; - tr[trn].appear(_vm->_gyro->_peds[np]._x - tr[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - tr[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); - rwsp(trn, _vm->_gyro->_peds[np]._direction); -} - -#if 0 - function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; - begin // By De Morgan's law: - overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); - end; -#endif - //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. - //x3,y3 = mx,my. x4,y4 = mx+16,my+16. - -void Animation::getback() { - // Super_Off; -#if 0 - while (getset[1 - _vm->_gyro->cp].numleft > 0) { - getset[1 - _vm->_gyro->cp].recall(r); - - - bool endangered = false; - if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end; - - //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); - } - - if endangered then - Super_On; -#endif + _sprites[trn].appear(_vm->_gyro->_peds[np]._x - _sprites[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - _sprites[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); + changeDirection(trn, _vm->_gyro->_peds[np]._direction); } // Eachstep procedures: void Animation::follow_avvy_y(byte tripnum) { - if (tr[0]._facingDir == kDirLeft) + if (_sprites[0]._facingDir == kDirLeft) return; - if (tr[tripnum]._homing) - tr[tripnum]._homingY = tr[1]._y; + if (_sprites[tripnum]._homing) + _sprites[tripnum]._homingY = _sprites[1]._y; else { - if (tr[tripnum]._y < tr[1]._y) - tr[tripnum]._y += 1; - else if (tr[tripnum]._y > tr[1]._y) - tr[tripnum]._y -= 1; + if (_sprites[tripnum]._y < _sprites[1]._y) + _sprites[tripnum]._y += 1; + else if (_sprites[tripnum]._y > _sprites[1]._y) + _sprites[tripnum]._y -= 1; else return; - if (tr[tripnum]._moveX == 0) { - tr[tripnum]._stepNum += 1; - if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) - tr[tripnum]._stepNum = 0; - tr[tripnum]._count = 0; + if (_sprites[tripnum]._moveX == 0) { + _sprites[tripnum]._stepNum += 1; + if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) + _sprites[tripnum]._stepNum = 0; + _sprites[tripnum]._count = 0; } } } void Animation::back_and_forth(byte tripnum) { - if (!tr[tripnum]._homing) { - if (tr[tripnum]._facingDir == kDirRight) - tr[tripnum].walkTo(4); + if (!_sprites[tripnum]._homing) { + if (_sprites[tripnum]._facingDir == kDirRight) + _sprites[tripnum].walkTo(4); else - tr[tripnum].walkTo(5); + _sprites[tripnum].walkTo(5); } } void Animation::face_avvy(byte tripnum) { - if (!tr[tripnum]._homing) { - if (tr[0]._x >= tr[tripnum]._x) - tr[tripnum]._facingDir = kDirRight; + if (!_sprites[tripnum]._homing) { + if (_sprites[0]._x >= _sprites[tripnum]._x) + _sprites[tripnum]._facingDir = kDirRight; else - tr[tripnum]._facingDir = kDirLeft; + _sprites[tripnum]._facingDir = kDirLeft; } } void Animation::arrow_procs(byte tripnum) { - if (tr[tripnum]._homing) { + if (_sprites[tripnum]._homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((tr[tripnum]._y + tr[tripnum]._info._yLength) >= tr[0]._y) // A - && (tr[tripnum]._x <= (tr[0]._x + tr[0]._info._xLength)) // B - && ((tr[tripnum]._x + tr[tripnum]._info._xLength) >= tr[0]._x)) { // C + if (((_sprites[tripnum]._y + _sprites[tripnum]._info._yLength) >= _sprites[0]._y) // A + && (_sprites[tripnum]._x <= (_sprites[0]._x + _sprites[0]._info._xLength)) // B + && ((_sprites[tripnum]._x + _sprites[tripnum]._info._xLength) >= _sprites[0]._x)) { // C // OK, it's hit him... what now? - tr[1]._callEachStepFl = false; // prevent recursion. + _sprites[1]._callEachStepFl = false; // prevent recursion. _vm->_visa->displayScrollChain('Q', 47); // Complaint! - tr[tripnum].done(); // Deallocate the arrow. + _sprites[tripnum].done(); // Deallocate the arrow. #if 0 tr[1].done; { Deallocate normal pic of Avvy. } @@ -1128,7 +1085,7 @@ void Animation::arrow_procs(byte tripnum) { _vm->_timer->addTimer(55, _vm->_timer->kProcNaughtyDuke, _vm->_timer->kReasonNaughtyDuke); } } else { // Arrow has hit the wall! - tr[tripnum].done(); // Deallocate the arrow. + _sprites[tripnum].done(); // Deallocate the arrow. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. } @@ -1152,41 +1109,41 @@ end; #endif void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. - int16 tox = tr[0]._x + 17; - int16 toy = tr[0]._y - 1; - if ((tr[tripnum]._x == tox) && (tr[tripnum]._y == toy)) { - tr[tripnum]._callEachStepFl = false; - tr[tripnum]._facingDir = kDirLeft; - tr[tripnum].stopWalk(); + int16 tox = _sprites[0]._x + 17; + int16 toy = _sprites[0]._y - 1; + if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) { + _sprites[tripnum]._callEachStepFl = false; + _sprites[tripnum]._facingDir = kDirLeft; + _sprites[tripnum].stopWalk(); // ... whatever ... } else { // Still some way to go. - if (tr[tripnum]._x < tox) { - tr[tripnum]._x += 5; - if (tr[tripnum]._x > tox) - tr[tripnum]._x = tox; + if (_sprites[tripnum]._x < tox) { + _sprites[tripnum]._x += 5; + if (_sprites[tripnum]._x > tox) + _sprites[tripnum]._x = tox; } - if (tr[tripnum]._y < toy) - tr[tripnum]._y++; - tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) - tr[tripnum]._stepNum = 0; + if (_sprites[tripnum]._y < toy) + _sprites[tripnum]._y++; + _sprites[tripnum]._stepNum++; + if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) + _sprites[tripnum]._stepNum = 0; } } -void Animation::take_a_step(byte &tripnum) { - if (tr[tripnum]._moveX == 0) { - tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) - tr[tripnum]._stepNum = 0; - tr[tripnum]._count = 0; +void Animation::takeAStep(byte &tripnum) { + if (_sprites[tripnum]._moveX == 0) { + _sprites[tripnum]._stepNum++; + if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) + _sprites[tripnum]._stepNum = 0; + _sprites[tripnum]._count = 0; } } void Animation::spin(byte whichway, byte &tripnum) { - if (tr[tripnum]._facingDir != whichway) { - tr[tripnum]._facingDir = whichway; - if (tr[tripnum]._id == 2) + if (_sprites[tripnum]._facingDir != whichway) { + _sprites[tripnum]._facingDir = whichway; + if (_sprites[tripnum]._id == 2) return; // Not for Spludwick _vm->_gyro->_dna._geidaSpin += 1; @@ -1206,35 +1163,35 @@ void Animation::geida_procs(byte tripnum) { _vm->_gyro->_dna._geidaSpin = 0; } - if (tr[tripnum]._y < (tr[0]._y - 2)) { + if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { // Geida is further from the screen than Avvy. spin(kDirDown, tripnum); - tr[tripnum]._moveY = 1; - tr[tripnum]._moveX = 0; - take_a_step(tripnum); + _sprites[tripnum]._moveY = 1; + _sprites[tripnum]._moveX = 0; + takeAStep(tripnum); return; - } else if (tr[tripnum]._y > (tr[0]._y + 2)) { + } else if (_sprites[tripnum]._y > (_sprites[0]._y + 2)) { // Avvy is further from the screen than Geida. spin(kDirUp, tripnum); - tr[tripnum]._moveY = -1; - tr[tripnum]._moveX = 0; - take_a_step(tripnum); + _sprites[tripnum]._moveY = -1; + _sprites[tripnum]._moveX = 0; + takeAStep(tripnum); return; } - tr[tripnum]._moveY = 0; + _sprites[tripnum]._moveY = 0; // These 12-s are not in the original, I added them to make the following method more "smooth". // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (tr[tripnum]._x < tr[0]._x - tr[0]._speedX * 8 - 12) { - tr[tripnum]._moveX = tr[0]._speedX; + if (_sprites[tripnum]._x < _sprites[0]._x - _sprites[0]._speedX * 8 - 12) { + _sprites[tripnum]._moveX = _sprites[0]._speedX; spin(kDirRight, tripnum); - take_a_step(tripnum); - } else if (tr[tripnum]._x > tr[0]._x + tr[0]._speedX * 8 + 12) { - tr[tripnum]._moveX = -tr[0]._speedX; + takeAStep(tripnum); + } else if (_sprites[tripnum]._x > _sprites[0]._x + _sprites[0]._speedX * 8 + 12) { + _sprites[tripnum]._moveX = -_sprites[0]._speedX; spin(kDirLeft, tripnum); - take_a_step(tripnum); + takeAStep(tripnum); } else - tr[tripnum]._moveX = 0; + _sprites[tripnum]._moveX = 0; } // That's all... @@ -1248,7 +1205,7 @@ void Animation::call_andexors() { order[i] = -1; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i]._quick && tr[i]._visible) + if (_sprites[i]._quick && _sprites[i]._visible) order[i] = i; } @@ -1256,7 +1213,7 @@ void Animation::call_andexors() { ok = true; for (byte i = 0; i < 4; i++) { if (((order[i] != -1) && (order[i + 1] != -1)) - && (tr[order[i]]._y > tr[order[i + 1]]._y)) { + && (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) { // Swap them! temp = order[i]; order[i] = order[i + 1]; @@ -1271,7 +1228,7 @@ void Animation::call_andexors() { for (byte i = 0; i < 5; i++) { if (order[i] > -1) - tr[order[i]].andexor(); + _sprites[order[i]].andexor(); } } @@ -1283,15 +1240,15 @@ void Animation::animLink() { if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i]._quick && tr[i]._visible) - tr[i].walk(); + if (_sprites[i]._quick && _sprites[i]._visible) + _sprites[i].walk(); } call_andexors(); for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i]._quick && tr[i]._callEachStepFl) { - switch (tr[i]._eachStepProc) { + if (_sprites[i]._quick && _sprites[i]._callEachStepFl) { + switch (_sprites[i]._eachStepProc) { case kProcFollowAvvyY : follow_avvy_y(i); break; @@ -1315,35 +1272,17 @@ void Animation::animLink() { } } - if (mustexclaim) { - mustexclaim = false; - _vm->_visa->displayScrollChain('x', saywhat); - } -} - -void Animation::get_back_loretta() { - for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (tr[i]._quick) { - getback(); - return; - } + if (_mustExclaim) { + _mustExclaim = false; + _vm->_visa->displayScrollChain('x', _sayWhat); } - // for fv:=0 to 1 do begin cp:=1-cp; getback; end; } void Animation::stopWalking() { - tr[0].stopWalk(); + _sprites[0].stopWalk(); _vm->_gyro->_dna._direction = kDirStopped; if (_vm->_gyro->_alive) - tr[0]._stepNum = 1; -} - -void Animation::tripkey(char dir) { - warning("Replaced by Trip::handleMoveKey!"); -} - -void Animation::readstick() { - warning("STUB: Trip::readstick()"); + _sprites[0]._stepNum = 1; } /** @@ -1355,9 +1294,9 @@ void Animation::hideInCupboard() { if (_vm->_gyro->_dna._wearing == Acci::kNothing) _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); else { - tr[0]._visible = true; + _sprites[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; - apped(1, 3); // Walk out of the cupboard. + appearPed(1, 3); // Walk out of the cupboard. _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_dna._avvysInTheCupboard = false; _vm->_sequence->firstShow(8); @@ -1366,7 +1305,7 @@ void Animation::hideInCupboard() { } } else { // Not hiding in the cupboard - tr[0]._visible = false; + _sprites[0]._visible = false; _vm->_gyro->_dna._userMovesAvvy = false; _vm->_scrolls->displayText(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); @@ -1375,11 +1314,11 @@ void Animation::hideInCupboard() { } } -void Animation::fliproom(byte room, byte ped) { +void Animation::flipRoom(byte room, byte ped) { if (!_vm->_gyro->_alive) { // You can't leave the room if you're dead. - tr[0]._moveX = 0; - tr[0]._moveY = 0; // Stop him from moving. + _sprites[0]._moveX = 0; + _sprites[0]._moveY = 0; // Stop him from moving. return; } @@ -1390,7 +1329,7 @@ void Animation::fliproom(byte room, byte ped) { if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { // You can't *jump* out of Cardiff Castle! - tr[0]._moveX = 0; + _sprites[0]._moveX = 0; return; } @@ -1398,48 +1337,44 @@ void Animation::fliproom(byte room, byte ped) { _vm->_lucerna->dusk(); for (int16 i = 1; i < kSpriteNumbMax; i++) { - if (tr[i]._quick) - tr[i].done(); + if (_sprites[i]._quick) + _sprites[i].done(); } // Deallocate sprite if (_vm->_gyro->_dna._room == r__lustiesroom) _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterRoom(room, ped); - apped(1, ped); + appearPed(1, ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; - _vm->_gyro->_dna._direction = tr[0]._facingDir; + _vm->_gyro->_dna._direction = _sprites[0]._facingDir; _vm->_lucerna->drawDirection(); - for (byte i = 0; i <= 1; i++) { - _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; - getback(); - } _vm->_lucerna->dawn(); // Tidy up after mouse. I know it's a kludge... // tidy_after_mouse; } -bool Animation::infield(byte which) { +bool Animation::inField(byte which) { which--; // Pascal -> C: different array indexes. - int16 yy = tr[0]._y + tr[0]._info._yLength; + int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; - return (tr[0]._x >= _vm->_gyro->_fields[which]._x1) && (tr[0]._x <= _vm->_gyro->_fields[which]._x2) + return (_sprites[0]._x >= _vm->_gyro->_fields[which]._x1) && (_sprites[0]._x <= _vm->_gyro->_fields[which]._x2) && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); } -bool Animation::neardoor() { +bool Animation::nearDoor() { if (_vm->_gyro->_fieldNum < 8) { // there ARE no doors here! return false; } - int16 ux = tr[0]._x; - int16 uy = tr[0]._y + tr[0]._info._yLength; + int16 ux = _sprites[0]._x; + int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; bool nd = false; for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) @@ -1448,10 +1383,6 @@ bool Animation::neardoor() { return nd; } -void Animation::new_game_for_trippancy() { // Called by gyro.newgame - tr[0]._visible = false; -} - void Animation::handleMoveKey(const Common::Event &event) { if (!_vm->_gyro->_dna._userMovesAvvy) return; @@ -1463,56 +1394,56 @@ void Animation::handleMoveKey(const Common::Event &event) { case Common::KEYCODE_UP: if (_vm->_gyro->_dna._direction != kDirUp) { _vm->_gyro->_dna._direction = kDirUp; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_DOWN: if (_vm->_gyro->_dna._direction != kDirDown) { _vm->_gyro->_dna._direction = kDirDown; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_LEFT: if (_vm->_gyro->_dna._direction != kDirLeft) { _vm->_gyro->_dna._direction = kDirLeft; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_RIGHT: if (_vm->_gyro->_dna._direction != kDirRight) { _vm->_gyro->_dna._direction = kDirRight; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_PAGEUP: if (_vm->_gyro->_dna._direction != kDirUpRight) { _vm->_gyro->_dna._direction = kDirUpRight; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_PAGEDOWN: if (_vm->_gyro->_dna._direction != kDirDownRight) { _vm->_gyro->_dna._direction = kDirDownRight; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_END: if (_vm->_gyro->_dna._direction != kDirDownLeft) { _vm->_gyro->_dna._direction = kDirDownLeft; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; case Common::KEYCODE_HOME: if (_vm->_gyro->_dna._direction != kDirUpLeft) { _vm->_gyro->_dna._direction = kDirUpLeft; - rwsp(0, _vm->_gyro->_dna._direction); + changeDirection(0, _vm->_gyro->_dna._direction); } else stopWalking(); break; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 7cb8e12f0bc4..cfb1cfe97df6 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -118,39 +118,28 @@ class Animation { ~Animation(); void animLink(); - void get_back_loretta(); - void loadtrip(); - void call_special(uint16 which); + void loadAnims(); // Original: loadtrip(). + void callSpecial(uint16 which); void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. - void catamove(byte ped); + void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. void stopWalking(); - void tripkey(char dir); - void rwsp(byte t, byte dir); - void apped(byte trn, byte np); - void getback(); - void fliproom(byte room, byte ped); - bool infield(byte which); // Returns true if you're within field "which". - bool neardoor(); // Returns True if you're near a door. - void readstick(); - void newspeed(); - void new_game_for_trippancy(); - void take_a_step(byte &tripnum); + void changeDirection(byte t, byte dir); + void appearPed(byte trn, byte np); + void flipRoom(byte room, byte ped); + bool inField(byte which); // Returns true if you're within field "which". + bool nearDoor(); // Returns True if you're near a door. + void updateSpeed(); void handleMoveKey(const Common::Event &event); // To replace tripkey(). - AnimationType tr[kSpriteNumbMax]; - byte aa[1600]; + AnimationType _sprites[kSpriteNumbMax]; - bool mustexclaim; - uint16 saywhat; + bool _mustExclaim; + uint16 _sayWhat; private: AvalancheEngine *_vm; - // CHECKME: Useless? - // ByteField r; - // int16 beforex, beforey; - - byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); + byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); byte geida_ped(byte which); void dawndelay(); void hideInCupboard(); @@ -160,7 +149,10 @@ class Animation { void arrow_procs(byte tripnum); void grab_avvy(byte tripnum); void spin(byte whichway, byte &tripnum); + + void takeAStep(byte &tripnum); void geida_procs(byte tripnum); + void call_andexors(); }; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b28fe7fb5fad..195ddef50dd3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -283,7 +283,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { - if (_animation->tr[i]._quick) + if (_animation->_sprites[i]._quick) spriteNum++; } } @@ -291,43 +291,43 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { if (sz.isLoading()) { for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. - if (_animation->tr[i]._quick) - _animation->tr[i].done(); + if (_animation->_sprites[i]._quick) + _animation->_sprites[i].done(); } } for (byte i = 0; i < spriteNum; i++) { - sz.syncAsByte(_animation->tr[i]._id); - sz.syncAsByte(_animation->tr[i]._doCheck); + sz.syncAsByte(_animation->_sprites[i]._id); + sz.syncAsByte(_animation->_sprites[i]._doCheck); if (sz.isLoading()) { - _animation->tr[i]._quick = true; - _animation->tr[i].init(_animation->tr[i]._id, _animation->tr[i]._doCheck, _animation); + _animation->_sprites[i]._quick = true; + _animation->_sprites[i].init(_animation->_sprites[i]._id, _animation->_sprites[i]._doCheck, _animation); } - sz.syncAsByte(_animation->tr[i]._moveX); - sz.syncAsByte(_animation->tr[i]._moveY); - sz.syncAsByte(_animation->tr[i]._facingDir); - sz.syncAsByte(_animation->tr[i]._stepNum); - sz.syncAsByte(_animation->tr[i]._visible); - sz.syncAsByte(_animation->tr[i]._homing); - sz.syncAsByte(_animation->tr[i]._count); - sz.syncAsByte(_animation->tr[i]._info._xWidth); - sz.syncAsByte(_animation->tr[i]._speedX); - sz.syncAsByte(_animation->tr[i]._speedY); - sz.syncAsByte(_animation->tr[i]._animCount); - sz.syncAsSint16LE(_animation->tr[i]._homingX); - sz.syncAsSint16LE(_animation->tr[i]._homingY); - sz.syncAsByte(_animation->tr[i]._callEachStepFl); - sz.syncAsByte(_animation->tr[i]._eachStepProc); - sz.syncAsByte(_animation->tr[i]._vanishIfStill); - - sz.syncAsSint16LE(_animation->tr[i]._x); - sz.syncAsSint16LE(_animation->tr[i]._y); - - if (sz.isLoading() && _animation->tr[i]._visible) - _animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i]._facingDir); + sz.syncAsByte(_animation->_sprites[i]._moveX); + sz.syncAsByte(_animation->_sprites[i]._moveY); + sz.syncAsByte(_animation->_sprites[i]._facingDir); + sz.syncAsByte(_animation->_sprites[i]._stepNum); + sz.syncAsByte(_animation->_sprites[i]._visible); + sz.syncAsByte(_animation->_sprites[i]._homing); + sz.syncAsByte(_animation->_sprites[i]._count); + sz.syncAsByte(_animation->_sprites[i]._info._xWidth); + sz.syncAsByte(_animation->_sprites[i]._speedX); + sz.syncAsByte(_animation->_sprites[i]._speedY); + sz.syncAsByte(_animation->_sprites[i]._animCount); + sz.syncAsSint16LE(_animation->_sprites[i]._homingX); + sz.syncAsSint16LE(_animation->_sprites[i]._homingY); + sz.syncAsByte(_animation->_sprites[i]._callEachStepFl); + sz.syncAsByte(_animation->_sprites[i]._eachStepProc); + sz.syncAsByte(_animation->_sprites[i]._vanishIfStill); + + sz.syncAsSint16LE(_animation->_sprites[i]._x); + sz.syncAsSint16LE(_animation->_sprites[i]._y); + + if (sz.isLoading() && _animation->_sprites[i]._visible) + _animation->_sprites[i].appear(_animation->_sprites[i]._x, _animation->_sprites[i]._y, _animation->_sprites[i]._facingDir); } //groi = 177; @@ -470,7 +470,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->refreshObjectList(); - _animation->newspeed(); + _animation->updateSpeed(); _lucerna->drawDirection(); @@ -484,8 +484,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); - if (_animation->tr[0]._quick && _animation->tr[0]._visible) - _animation->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. + if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible) + _animation->changeDirection(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a4392383b183..99c3950ef155 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -156,15 +156,14 @@ void Avalot::setup() { for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. - _vm->_animation->loadtrip(); + _vm->_animation->loadAnims(); - _vm->_animation->get_back_loretta(); _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; - _vm->_animation->newspeed(); + _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; + _vm->_animation->updateSpeed(); @@ -201,7 +200,6 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); - _vm->_animation->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 2d6d2722087d..12af639ab7f0 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -449,12 +449,12 @@ void Dropdown::setupMenuAction() { _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); if (_vm->_gyro->_dna._room == 99) - _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->neardoor()); + _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else - _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->neardoor()); + _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->tr[0]._speedX == _vm->_gyro->kWalk) + if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -624,11 +624,11 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); break; case 5: { - if (_vm->_animation->tr[0]._speedX == _vm->_gyro->kWalk) - _vm->_animation->tr[0]._speedX = _vm->_gyro->kRun; + if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) + _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun; else - _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; - _vm->_animation->newspeed(); + _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; + _vm->_animation->updateSpeed(); } break; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 3f29ca4376bf..c80ac4bc8235 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -228,12 +228,12 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { - if (_vm->_animation->tr[i]._quick) - _vm->_animation->tr[i].done(); + if (_vm->_animation->_sprites[i]._quick) + _vm->_animation->_sprites[i].done(); } // Deallocate sprite. Sorry, beta testers! - _vm->_animation->tr[0].init(0, true, _vm->_animation); + _vm->_animation->_sprites[0].init(0, true, _vm->_animation); _alive = true; _score = 0; @@ -257,7 +257,7 @@ void Gyro::newGame() { _onToolbar = false; _seeScroll = false; - _vm->_animation->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. + _vm->_animation->_sprites[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = 254; @@ -270,13 +270,8 @@ void Gyro::newGame() { _dna._avvyInBed = true; _enidFilename = ""; - for (byte i = 0; i <= 1; i++) { - _cp = 1 - _cp; - _vm->_animation->getback(); - } - _vm->_lucerna->enterRoom(1, 1); - _vm->_animation->new_game_for_trippancy(); + _vm->_animation->_sprites[0]._visible = false; _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); _vm->_lucerna->_clock.update(); @@ -454,7 +449,7 @@ Common::String Gyro::f5Does() { return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; break; case r__musicroom: - if (_vm->_animation->infield(7)) + if (_vm->_animation->inField(7)) return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; break; } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 8398439adfb9..5782ac94972a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -400,10 +400,10 @@ void Lucerna::enterNewTown() { void Lucerna::putGeidaAt(byte whichPed, byte &ped) { if (ped == 0) return; - _vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida - _vm->_animation->apped(2, whichPed); - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida; + _vm->_animation->_sprites[1].init(5, false, _vm->_animation); // load Geida + _vm->_animation->appearPed(2, whichPed); + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida; } void Lucerna::enterRoom(byte room, byte ped) { @@ -445,25 +445,25 @@ void Lucerna::enterRoom(byte room, byte ped) { if (! _vm->_gyro->_dna._talkedToCrapulus) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours; - _vm->_animation->tr[1].init(8, false, _vm->_animation); // load Crapulus + _vm->_animation->_sprites[1].init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { - _vm->_animation->apped(2, 4); // Start on the right-hand side of the screen. - _vm->_animation->tr[1].walkTo(5); // Walks up to greet you. + _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. + _vm->_animation->_sprites[1].walkTo(5); // Walks up to greet you. } else { - _vm->_animation->apped(2, 5); // Starts where he was before. - _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; + _vm->_animation->appearPed(2, 5); // Starts where he was before. + _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; } - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; if (_vm->_gyro->_dna._crapulusWillTell) { - _vm->_animation->tr[1].init(8, false, _vm->_animation); - _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkTo(4); + _vm->_animation->_sprites[1].init(8, false, _vm->_animation); + _vm->_animation->appearPed(2, 2); + _vm->_animation->_sprites[1].walkTo(4); _vm->_timer->addTimer(20, _vm->_timer->kProcCrapulusSpludOut, _vm->_timer->kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } @@ -480,15 +480,15 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__spludwicks: if (_vm->_gyro->_dna._spludwickAtHome) { if (ped > 0) { - _vm->_animation->tr[1].init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->apped(2, 2); + _vm->_animation->_sprites[1].init(2, false, _vm->_animation); // load Spludwick + _vm->_animation->appearPed(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida; + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -501,18 +501,18 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { - _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY; + _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... - _vm->_animation->apped(2, 2); // He appears on the right of the screen... - _vm->_animation->tr[1].walkTo(4); // ...and he walks up... + _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... + _vm->_animation->_sprites[1].walkTo(4); // ...and he walks up... } else { // You've been here before. - _vm->_animation->apped(2, 4); // He's standing in your way straight away... - _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; + _vm->_animation->appearPed(2, 4); // He's standing in your way straight away... + _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; } } } @@ -521,10 +521,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__argentroad: if ((_vm->_gyro->_dna._cwytalotGone) && (! _vm->_gyro->_dna._passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { - _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->apped(2, 1); - _vm->_animation->tr[1].walkTo(2); - _vm->_animation->tr[1]._vanishIfStill = true; + _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot again + _vm->_animation->appearPed(2, 1); + _vm->_animation->_sprites[1].walkTo(2); + _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timer->addTimer(20, _vm->_timer->kProcCwytalotInHerts, _vm->_timer->kReasonCwytalotInHerts); @@ -545,9 +545,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { if (! _vm->_gyro->_dna._beenTiedUp) { // A welcome party... or maybe not... - _vm->_animation->tr[1].init(6, false, _vm->_animation); - _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkTo(3); + _vm->_animation->_sprites[1].init(6, false, _vm->_animation); + _vm->_animation->appearPed(2, 2); + _vm->_animation->_sprites[1].walkTo(3); _vm->_timer->addTimer(36, _vm->_timer->kProcGetTiedUp, _vm->_timer->kReasonGettingTiedUp); } } @@ -569,9 +569,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) switch (_vm->_gyro->_dna._cardiffQuestionNum) { case 0 : { // You've answered NONE of his questions. - _vm->_animation->tr[1].init(9, false, _vm->_animation); - _vm->_animation->apped(2, 2); - _vm->_animation->tr[1].walkTo(3); + _vm->_animation->_sprites[1].init(9, false, _vm->_animation); + _vm->_animation->appearPed(2, 2); + _vm->_animation->_sprites[1].walkTo(3); _vm->_timer->addTimer(47, _vm->_timer->kProcCardiffSurvey, _vm->_timer->kReasonCardiffsurvey); } break; @@ -579,9 +579,9 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. - _vm->_animation->tr[1].init(9, false, _vm->_animation); - _vm->_animation->apped(2, 3); - _vm->_animation->tr[1]._facingDir = Animation::kDirRight; + _vm->_animation->_sprites[1].init(9, false, _vm->_animation); + _vm->_animation->appearPed(2, 3); + _vm->_animation->_sprites[1]._facingDir = Animation::kDirRight; _vm->_timer->addTimer(3, _vm->_timer->kProcCardiffReturn, _vm->_timer->kReasonCardiffsurvey); } } @@ -631,7 +631,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; - _vm->_animation->catamove(ped); + _vm->_animation->catacombMove(ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; } break; @@ -649,7 +649,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. - if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes + if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes _vm->_timer->addTimer(3, _vm->_timer->kProcCallsGuards, _vm->_timer->kReasonDuLustieTalks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. @@ -707,22 +707,22 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__wisewomans: - _vm->_animation->tr[1].init(11, false, _vm->_animation); + _vm->_animation->_sprites[1].init(11, false, _vm->_animation); if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { - _vm->_animation->apped(2, 2); // Start on the right-hand side of the screen. - _vm->_animation->tr[1].walkTo(4); // Walks up to greet you. + _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. + _vm->_animation->_sprites[1].walkTo(4); // Walks up to greet you. } else { - _vm->_animation->apped(2, 4); // Starts where she was before. - _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; + _vm->_animation->appearPed(2, 4); // Starts where she was before. + _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; } - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_animation->tr[1].init(10, false, _vm->_animation); // Define the dart. + _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(1); @@ -972,22 +972,22 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { switch (color) { case kColorGreen: _vm->_gyro->_dna._direction = Animation::kDirUp; - _vm->_animation->rwsp(0, Animation::kDirUp); + _vm->_animation->changeDirection(0, Animation::kDirUp); drawDirection(); break; case kColorBrown: _vm->_gyro->_dna._direction = Animation::kDirDown; - _vm->_animation->rwsp(0, Animation::kDirDown); + _vm->_animation->changeDirection(0, Animation::kDirDown); drawDirection(); break; case kColorCyan: _vm->_gyro->_dna._direction = Animation::kDirLeft; - _vm->_animation->rwsp(0, Animation::kDirLeft); + _vm->_animation->changeDirection(0, Animation::kDirLeft); drawDirection(); break; case kColorLightmagenta: _vm->_gyro->_dna._direction = Animation::kDirRight; - _vm->_animation->rwsp(0, Animation::kDirRight); + _vm->_animation->changeDirection(0, Animation::kDirRight); drawDirection(); break; case kColorRed: @@ -1025,16 +1025,16 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { byte what; // _vm->_animation->tr[0] is Avalot.) - if (cursorPos.x < _vm->_animation->tr[0]._x) + if (cursorPos.x < _vm->_animation->_sprites[0]._x) what = 1; - else if (cursorPos.x > (_vm->_animation->tr[0]._x + _vm->_animation->tr[0]._info._xLength)) + else if (cursorPos.x > (_vm->_animation->_sprites[0]._x + _vm->_animation->_sprites[0]._info._xLength)) what = 2; else what = 0; // On top - if (cursorPos.y < _vm->_animation->tr[0]._y) + if (cursorPos.y < _vm->_animation->_sprites[0]._y) what += 3; - else if (cursorPos.y > (_vm->_animation->tr[0]._y + _vm->_animation->tr[0]._info._yLength)) + else if (cursorPos.y > (_vm->_animation->_sprites[0]._y + _vm->_animation->_sprites[0]._info._yLength)) what += 6; switch (what) { @@ -1042,28 +1042,28 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { _vm->_animation->stopWalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_animation->rwsp(0, Animation::kDirLeft); + _vm->_animation->changeDirection(0, Animation::kDirLeft); break; case 2: - _vm->_animation->rwsp(0, Animation::kDirRight); + _vm->_animation->changeDirection(0, Animation::kDirRight); break; case 3: - _vm->_animation->rwsp(0, Animation::kDirUp); + _vm->_animation->changeDirection(0, Animation::kDirUp); break; case 4: - _vm->_animation->rwsp(0, Animation::kDirUpLeft); + _vm->_animation->changeDirection(0, Animation::kDirUpLeft); break; case 5: - _vm->_animation->rwsp(0, Animation::kDirUpRight); + _vm->_animation->changeDirection(0, Animation::kDirUpRight); break; case 6: - _vm->_animation->rwsp(0, Animation::kDirDown); + _vm->_animation->changeDirection(0, Animation::kDirDown); break; case 7: - _vm->_animation->rwsp(0, Animation::kDirDownLeft); + _vm->_animation->changeDirection(0, Animation::kDirDownLeft); break; case 8: - _vm->_animation->rwsp(0, Animation::kDirDownRight); + _vm->_animation->changeDirection(0, Animation::kDirDownRight); break; } // No other values are possible. @@ -1128,11 +1128,11 @@ void Lucerna::checkClick() { callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk; - _vm->_animation->newspeed(); + _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; + _vm->_animation->updateSpeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_animation->tr[0]._speedX = _vm->_gyro->kRun; - _vm->_animation->newspeed(); + _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun; + _vm->_animation->updateSpeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) @@ -1182,13 +1182,13 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). void Lucerna::gameOver() { _vm->_gyro->_dna._userMovesAvvy = false; - int16 sx = _vm->_animation->tr[0]._x; - int16 sy = _vm->_animation->tr[0]._y; + int16 sx = _vm->_animation->_sprites[0]._x; + int16 sy = _vm->_animation->_sprites[0]._y; - _vm->_animation->tr[0].done(); - _vm->_animation->tr[0].init(12, true, _vm->_animation); // 12 = Avalot falls - _vm->_animation->tr[0]._stepNum = 0; - _vm->_animation->tr[0].appear(sx, sy, 0); + _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[0].init(12, true, _vm->_animation); // 12 = Avalot falls + _vm->_animation->_sprites[0]._stepNum = 0; + _vm->_animation->_sprites[0].appear(sx, sy, 0); _vm->_timer->addTimer(3, _vm->_timer->kProcAvalotFalls, _vm->_timer->kReasonFallingOver); _vm->_gyro->_alive = false; @@ -1199,11 +1199,6 @@ void Lucerna::minorRedraw() { enterRoom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant. - for (byte i = 0; i <= 1; i++) { - _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; - _vm->_animation->getback(); - } - for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits drawScore(); @@ -1220,23 +1215,20 @@ uint16 Lucerna::bearing(byte whichPed) { const double rad2deg = 180 / 3.14; // Pi - if (_vm->_animation->tr[0]._x == _vm->_gyro->_peds[pedId]._x) + if (_vm->_animation->_sprites[0]._x == _vm->_gyro->_peds[pedId]._x) return 0; - else if (_vm->_animation->tr[0]._x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (_vm->_animation->_sprites[0]._x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; - - _vm->_animation->get_back_loretta(); _vm->_animation->animLink(); - _vm->_gyro->_doingSpriteRun = false; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f8972d5bd3d7..30e5bc4d264c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -665,11 +665,11 @@ void Scrolls::callScrollDriver() { if (_param == 0) setBubbleStateNatural(); else if ((1 <= _param) && (_param <= 9)) { - if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[_param - 1]._quick)) { // Not valid. + if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->_sprites[_param - 1]._quick)) { // Not valid. _vm->_lucerna->errorLed(); setBubbleStateNatural(); } else - _vm->_animation->tr[_param - 1].chatter(); // Normal sprite talking routine. + _vm->_animation->_sprites[_param - 1].chatter(); // Normal sprite talking routine. } else if ((10 <= _param) && (_param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 48b8017515e8..600a3cae4de1 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -90,7 +90,7 @@ void Sequence::callSequencer() { break; case 177: // Flip room. _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_animation->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); + _vm->_animation->flipRoom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); if (_seq[0] == 177) shoveLeft(); break; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 928ea256da43..cb765e1a8883 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -253,7 +253,7 @@ void Timer::avariciusTalks() { } void Timer::urinate() { - _vm->_animation->tr[0].turn(Animation::kDirUp); + _vm->_animation->_sprites[0].turn(Animation::kDirUp); _vm->_animation->stopWalking(); _vm->_lucerna->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); @@ -274,7 +274,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_gyro->blip(); - _vm->_animation->tr[0].walkTo(4); + _vm->_animation->_sprites[0].walkTo(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._brummieStairs = 2; _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; @@ -307,38 +307,38 @@ void Timer::getTiedUp() { _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; _vm->_animation->stopWalking(); - _vm->_animation->tr[1].stopWalk(); - _vm->_animation->tr[1].stophoming(); - _vm->_animation->tr[1]._callEachStepFl = true; - _vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; + _vm->_animation->_sprites[1].stopWalk(); + _vm->_animation->_sprites[1].stophoming(); + _vm->_animation->_sprites[1]._callEachStepFl = true; + _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } void Timer::getTiedUp2() { - _vm->_animation->tr[0].walkTo(4); - _vm->_animation->tr[1].walkTo(5); + _vm->_animation->_sprites[0].walkTo(4); + _vm->_animation->_sprites[1].walkTo(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } void Timer::hangAround() { - _vm->_animation->tr[1]._doCheck = false; - _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood + _vm->_animation->_sprites[1]._doCheck = false; + _vm->_animation->_sprites[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; - _vm->_animation->apped(1, 2); + _vm->_animation->appearPed(1, 2); _vm->_visa->displayScrollChain('q', 39); - _vm->_animation->tr[0].walkTo(7); + _vm->_animation->_sprites[0].walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { _vm->_visa->displayScrollChain('q', 40); - _vm->_animation->tr[1]._vanishIfStill = false; - _vm->_animation->tr[1].walkTo(4); + _vm->_animation->_sprites[1]._vanishIfStill = false; + _vm->_animation->_sprites[1].walkTo(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); - _vm->_animation->tr[0].done(); - _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. + _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[1].done(); // Get rid of Robin Hood and Friar Tuck. addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). @@ -350,11 +350,11 @@ void Timer::hangAround2() { void Timer::afterTheShootemup() { - _vm->_animation->fliproom(_vm->_gyro->_dna._room, 0); + _vm->_animation->flipRoom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_animation->tr[0].init(0, true, _vm->_animation); // Avalot. - _vm->_animation->apped(1, 2); + _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. + _vm->_animation->appearPed(1, 2); _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -423,9 +423,9 @@ void Timer::jacquesWakesUp() { } void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. - _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. - _vm->_animation->apped(2, 1); // He starts at the door... - _vm->_animation->tr[1].walkTo(3); // He walks over to you. + _vm->_animation->_sprites[1].init(9, false, _vm->_animation); // Here comes the Duke. + _vm->_animation->appearPed(2, 1); // He starts at the door... + _vm->_animation->_sprites[1].walkTo(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -437,8 +437,8 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon void Timer::naughtyDuke2() { _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" - _vm->_animation->tr[1].walkTo(1); // Walk to the door. - _vm->_animation->tr[1]._vanishIfStill = true; // Then go away! + _vm->_animation->_sprites[1].walkTo(1); // Walk to the door. + _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } @@ -458,7 +458,7 @@ void Timer::jump() { case 5: case 7: case 9: - _vm->_animation->tr[0]._y--; + _vm->_animation->_sprites[0]._y--; break; case 12: case 13: @@ -466,7 +466,7 @@ void Timer::jump() { case 16: case 18: case 19: - _vm->_animation->tr[0]._y++; + _vm->_animation->_sprites[0]._y++; break; } @@ -480,7 +480,7 @@ void Timer::jump() { if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->_dna._room == r__insidecardiffcastle) && (_vm->_gyro->_dna._arrowInTheDoor == true) - && (_vm->_animation->infield(3))) { // Beside the wall + && (_vm->_animation->inField(3))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); @@ -538,8 +538,8 @@ void Timer::greetsMonk() { void Timer::fallDownOubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; - _vm->_animation->tr[0]._moveY++; // Increments dx/dy! - _vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go... + _vm->_animation->_sprites[0]._moveY++; // Increments dx/dy! + _vm->_animation->_sprites[0]._y += _vm->_animation->_sprites[0]._moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); } @@ -553,49 +553,49 @@ void Timer::meetAvaroid() { _vm->_gyro->_dna._metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); - _vm->_animation->tr[0]._facingDir = Animation::kDirLeft; - _vm->_animation->tr[0]._x = 151; - _vm->_animation->tr[0]._moveX = -3; - _vm->_animation->tr[0]._moveY = -5; + _vm->_animation->_sprites[0]._facingDir = Animation::kDirLeft; + _vm->_animation->_sprites[0]._x = 151; + _vm->_animation->_sprites[0]._moveX = -3; + _vm->_animation->_sprites[0]._moveY = -5; _vm->_gyro->setBackgroundColor(2); } } void Timer::riseUpOubliette() { - _vm->_animation->tr[0]._visible = true; - _vm->_animation->tr[0]._moveY++; // Decrements dx/dy! - _vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go... - if (_vm->_animation->tr[0]._moveY > 0) + _vm->_animation->_sprites[0]._visible = true; + _vm->_animation->_sprites[0]._moveY++; // Decrements dx/dy! + _vm->_animation->_sprites[0]._y -= _vm->_animation->_sprites[0]._moveY; // Uuuupppp we go... + if (_vm->_animation->_sprites[0]._moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else _vm->_gyro->_dna._userMovesAvvy = true; } void Timer::robinHoodAndGeida() { - _vm->_animation->tr[0].init(7, true, _vm->_animation); - _vm->_animation->apped(1, 7); - _vm->_animation->tr[0].walkTo(6); - _vm->_animation->tr[1].stopWalk(); - _vm->_animation->tr[1]._facingDir = Animation::kDirLeft; + _vm->_animation->_sprites[0].init(7, true, _vm->_animation); + _vm->_animation->appearPed(1, 7); + _vm->_animation->_sprites[0].walkTo(6); + _vm->_animation->_sprites[1].stopWalk(); + _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); _vm->_gyro->_dna._geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { _vm->_visa->displayScrollChain('q', 66); - _vm->_animation->tr[0].walkTo(2); - _vm->_animation->tr[1].walkTo(2); - _vm->_animation->tr[0]._vanishIfStill = true; - _vm->_animation->tr[1]._vanishIfStill = true; + _vm->_animation->_sprites[0].walkTo(2); + _vm->_animation->_sprites[1].walkTo(2); + _vm->_animation->_sprites[0]._vanishIfStill = true; + _vm->_animation->_sprites[1]._vanishIfStill = true; addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); } void Timer::avalotReturns() { - _vm->_animation->tr[0].done(); - _vm->_animation->tr[1].done(); - _vm->_animation->tr[0].init(0, true, _vm->_animation); - _vm->_animation->apped(1, 1); + _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[1].done(); + _vm->_animation->_sprites[0].init(0, true, _vm->_animation); + _vm->_animation->appearPed(1, 1); _vm->_visa->displayScrollChain('q', 67); _vm->_gyro->_dna._userMovesAvvy = true; } @@ -606,13 +606,13 @@ void Timer::avalotReturns() { * @remarks Originally called 'avvy_sit_down' */ void Timer::avvySitDown() { - if (_vm->_animation->tr[0]._homing) // Still walking. + if (_vm->_animation->_sprites[0]._homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dna._sittingInPub = true; _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_animation->tr[0]._visible = false; + _vm->_animation->_sprites[0]._visible = false; } } @@ -647,8 +647,8 @@ void Timer::winning() { } void Timer::avalotFalls() { - if (_vm->_animation->tr[0]._stepNum < 5) { - _vm->_animation->tr[0]._stepNum++; + if (_vm->_animation->_sprites[0]._stepNum < 5) { + _vm->_animation->_sprites[0]._stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay; @@ -662,14 +662,14 @@ void Timer::avalotFalls() { } void Timer::spludwickGoesToCauldron() { - if (_vm->_animation->tr[1]._homing) + if (_vm->_animation->_sprites[1]._homing) addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludWalk); else addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludWalk); } void Timer::spludwickLeavesCauldron() { - _vm->_animation->tr[1]._callEachStepFl = true; // So that normal procs will continue. + _vm->_animation->_sprites[1]._callEachStepFl = true; // So that normal procs will continue. } void Timer::giveLuteToGeida() { // Moved here from Acci. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index b0be1886bd39..edea1230d8a2 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -245,7 +245,7 @@ void Visa::talkTo(byte whom) { bool noMatches = true; for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) - if (_vm->_animation->tr[i]._stat._acciNum == whom) { + if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); noMatches = false; break; @@ -267,8 +267,8 @@ void Visa::talkTo(byte whom) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. - _vm->_animation->tr[1]._vanishIfStill = true; - _vm->_animation->tr[1].walkTo(3); // Walks away. + _vm->_animation->_sprites[1]._vanishIfStill = true; + _vm->_animation->_sprites[1].walkTo(3); // Walks away. _vm->_lucerna->incScore(2); } From 55d64e1ed10a5921836c49cb29f6d2a9d61a31be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 12:08:59 +0200 Subject: [PATCH 0892/1332] AVALANCHE: Add some doxygen comments in Lucerna --- engines/avalanche/lucerna2.cpp | 20 ++++++++++++++++++++ engines/avalanche/lucerna2.h | 19 ++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 5782ac94972a..2ec32b2ca0b3 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -177,6 +177,10 @@ void Lucerna::drawAlsoLines() { // readAlsoStringFromFile, scram and unScramble are only used in loadAlso +/** + * Check is it's possible to give something to Spludwick + * @remarks Originally called 'nextstring' + */ Common::String Lucerna::readAlsoStringFromFile() { Common::String str; byte length = file.readByte(); @@ -367,6 +371,12 @@ void Lucerna::exitRoom(byte x) { _vm->_gyro->_dna._lastRoomNotMap = _vm->_gyro->_dna._room; } + +/** + * Only when entering a NEW town! Not returning to the last one, + * but choosing another from the map. + * @remarks Originally called 'new_town' + */ void Lucerna::enterNewTown() { _vm->_dropdown->setupMenu(); @@ -1017,6 +1027,9 @@ void Lucerna::refreshObjectList() { } } +/** + * @remarks Originally called 'verte' + */ void Lucerna::guideAvvy(Common::Point cursorPos) { if (!_vm->_gyro->_dna._userMovesAvvy) return; @@ -1226,6 +1239,13 @@ uint16 Lucerna::bearing(byte whichPed) { } } +/** + * A sprite run is performed before displaying a scroll, if not all the + * sprites are still. It performs two fast cycles, only using a few of + * the links usually used, and without any extra animation. This should + * make the sprites the same on both pages. + * @remarks Originally called 'sprite_run' + */ void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; _vm->_animation->animLink(); diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index ad0e4a2a981c..9c1cc6ce441a 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -48,14 +48,13 @@ class Clock { AvalancheEngine *_vm; - uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; // hourAngle = nh in the original. - Common::Point _clockHandHour, _clockHandMinute; // ah and am in the original. + uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; + Common::Point _clockHandHour, _clockHandMinute; void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); void drawHand(const Common::Point &endPoint, byte color); void plotHands(); void chime(); - }; class Lucerna { @@ -94,28 +93,26 @@ class Lucerna { void minorRedraw(); void majorRedraw(); - // A sprite run is performed before displaying a scroll, if not all the sprites are still. It performs two fast cycles, only using a few of - // the links usually used, and without any extra animation. This should make the sprites the same on both pages. void spriteRun(); private: AvalancheEngine *_vm; - bool _fxHidden; // Will de used in dusk() and dawn(). - Common::File file; - Common::String readAlsoStringFromFile(); // 'nexstring' in the original. + Common::String readAlsoStringFromFile(); void scram(Common::String &str); void unScramble(); void zoomOut(int16 x, int16 y); // Only used when entering the map. - void enterNewTown(); // Onyl when entering a NEW town! Not returning to the last one, but choosing another from the map. + void enterNewTown(); void findPeople(byte room); void putGeidaAt(byte whichPed, byte &ped); - void guideAvvy(Common::Point cursorPos); // 'verte' in the original. + void guideAvvy(Common::Point cursorPos); + + // Will be used in dusk() and dawn(). + bool _fxHidden; - // Used in dusk() and dawn(). int8 fades(int8 x); void fadeOut(byte n); void fadeIn(byte n); From b7844c3548a7e911262d35d8ee0a122a5decca7a Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 12:21:02 +0200 Subject: [PATCH 0893/1332] AVALANCHE: More renaming/refactoring in Animation. --- engines/avalanche/animation.cpp | 46 +++++++++++----------- engines/avalanche/animation.h | 67 ++++++++++++++++----------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f83173ef77d2..204121b3bc2a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -141,7 +141,7 @@ void AnimationType::original() { _id = 177; } -void AnimationType::andexor() { +void AnimationType::draw() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). @@ -412,7 +412,7 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { return a; } -byte Animation::geida_ped(byte which) { +byte Animation::geidaPed(byte which) { switch (which) { case 1: return 7; @@ -730,7 +730,7 @@ void Animation::catacombMove(byte ped) { if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. - appearPed(2, geida_ped(ped)); + appearPed(2, geidaPed(ped)); _sprites[1]._callEachStepFl = true; _sprites[1]._eachStepProc = kProcGeida; } @@ -739,7 +739,7 @@ void Animation::catacombMove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. -void Animation::dawndelay() { +void Animation::dawnDelay() { _vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay); } @@ -864,7 +864,7 @@ void Animation::callSpecial(uint16 which) { default: appearPed(1, 4); } - dawndelay(); + dawnDelay(); break; case 11: // _vm->_gyro->special 11: transfer east in catacombs. _vm->_lucerna->dusk(); @@ -873,7 +873,7 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_dna._room != r__catacombs) return; appearPed(1, 1); - dawndelay(); + dawnDelay(); break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. _vm->_lucerna->dusk(); @@ -882,7 +882,7 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_dna._room != r__catacombs) return; appearPed(1, 2); - dawndelay(); + dawnDelay(); break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. _vm->_lucerna->dusk(); @@ -891,7 +891,7 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_dna._room != r__catacombs) return; appearPed(1, 3); - dawndelay(); + dawnDelay(); break; } } @@ -1014,7 +1014,7 @@ void Animation::appearPed(byte trn, byte np) { } // Eachstep procedures: -void Animation::follow_avvy_y(byte tripnum) { +void Animation::followAvalotY(byte tripnum) { if (_sprites[0]._facingDir == kDirLeft) return; if (_sprites[tripnum]._homing) @@ -1035,7 +1035,7 @@ void Animation::follow_avvy_y(byte tripnum) { } } -void Animation::back_and_forth(byte tripnum) { +void Animation::backAndForth(byte tripnum) { if (!_sprites[tripnum]._homing) { if (_sprites[tripnum]._facingDir == kDirRight) _sprites[tripnum].walkTo(4); @@ -1044,7 +1044,7 @@ void Animation::back_and_forth(byte tripnum) { } } -void Animation::face_avvy(byte tripnum) { +void Animation::faceAvvy(byte tripnum) { if (!_sprites[tripnum]._homing) { if (_sprites[0]._x >= _sprites[tripnum]._x) _sprites[tripnum]._facingDir = kDirRight; @@ -1053,7 +1053,7 @@ void Animation::face_avvy(byte tripnum) { } } -void Animation::arrow_procs(byte tripnum) { +void Animation::arrowProcs(byte tripnum) { if (_sprites[tripnum]._homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. @@ -1108,7 +1108,7 @@ begin end; #endif -void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. +void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 tox = _sprites[0]._x + 17; int16 toy = _sprites[0]._y - 1; if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) { @@ -1156,7 +1156,7 @@ void Animation::spin(byte whichway, byte &tripnum) { } } -void Animation::geida_procs(byte tripnum) { +void Animation::geidaProcs(byte tripnum) { if (_vm->_gyro->_dna._geidaTime > 0) { _vm->_gyro->_dna._geidaTime--; if (_vm->_gyro->_dna._geidaTime == 0) @@ -1196,7 +1196,7 @@ void Animation::geida_procs(byte tripnum) { // That's all... -void Animation::call_andexors() { +void Animation::drawSprites() { int8 order[5]; byte temp; bool ok; @@ -1228,7 +1228,7 @@ void Animation::call_andexors() { for (byte i = 0; i < 5; i++) { if (order[i] > -1) - _sprites[order[i]].andexor(); + _sprites[order[i]].draw(); } } @@ -1244,29 +1244,29 @@ void Animation::animLink() { _sprites[i].walk(); } - call_andexors(); + drawSprites(); for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._callEachStepFl) { switch (_sprites[i]._eachStepProc) { case kProcFollowAvvyY : - follow_avvy_y(i); + followAvalotY(i); break; case kProcBackAndForth : - back_and_forth(i); + backAndForth(i); break; case kProcFaceAvvy : - face_avvy(i); + faceAvvy(i); break; case kProcArrow : - arrow_procs(i); + arrowProcs(i); break; // PROCSpludwick_procs : spludwick_procs(fv); case kProcGrabAvvy : - grab_avvy(i); + grabAvvy(i); break; case kProcGeida : - geida_procs(i); + geidaProcs(i); break; } } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index cfb1cfe97df6..d6a87dc547f1 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -42,7 +42,6 @@ class Animation; struct StatType { Common::String _name; // Name of character. Common::String _comment; // Comment. - // byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. byte _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. @@ -52,7 +51,6 @@ struct StatType { class AnimationType { public: SpriteInfo _info; - StatType _stat; // Vital statistics. byte _facingDir, _stepNum; int16 _x, _y; // Current xy coords. @@ -70,7 +68,7 @@ class AnimationType { void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite. void original(); // Just sets 'quick' to false. - void andexor(); // Drops sprite onto screen. + void draw(); // Drops sprite onto screen. Original: andexor(). void turn(byte whichway); // Turns character round. void appear(int16 wx, int16 wy, byte wf); // Switches it on. void bounce(); // Bounces off walls. @@ -94,25 +92,27 @@ class Animation { public: friend class AnimationType; - static const byte kDirUp = 0; - static const byte kDirRight = 1; - static const byte kDirDown = 2; - static const byte kDirLeft = 3; - static const byte kDirUpRight = 4; - static const byte kDirDownRight = 5; - static const byte kDirDownLeft = 6; - static const byte kDirUpLeft = 7; - static const byte kDirStopped = 8; + enum Direction { + kDirUp, kDirRight, kDirDown, kDirLeft, + kDirUpRight, kDirDownRight, kDirDownLeft, kDirUpLeft, + kDirStopped + }; static const int16 kSpriteNumbMax = 5; // current max no. of sprites - static const byte kProcFollowAvvyY = 1; - static const byte kProcBackAndForth = 2; - static const byte kProcFaceAvvy = 3; - static const byte kProcArrow = 4; - static const byte kProcsPludwick = 5; // Unused - static const byte kProcGrabAvvy = 6; - static const byte kProcGeida = 7; + enum Proc { + kProcFollowAvvyY = 1, + kProcBackAndForth, + kProcFaceAvvy, + kProcArrow, + kProcSpludwick, // Unused + kProcGrabAvvy, + kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick. + }; + + AnimationType _sprites[kSpriteNumbMax]; + bool _mustExclaim; + uint16 _sayWhat; Animation(AvalancheEngine *vm); ~Animation(); @@ -131,29 +131,28 @@ class Animation { void updateSpeed(); void handleMoveKey(const Common::Event &event); // To replace tripkey(). - AnimationType _sprites[kSpriteNumbMax]; - - bool _mustExclaim; - uint16 _sayWhat; - private: AvalancheEngine *_vm; byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); - byte geida_ped(byte which); - void dawndelay(); + byte geidaPed(byte which); + void dawnDelay(); + + void grabAvvy(byte tripnum); + void arrowProcs(byte tripnum); void hideInCupboard(); - void follow_avvy_y(byte tripnum); - void back_and_forth(byte tripnum); - void face_avvy(byte tripnum); - void arrow_procs(byte tripnum); - void grab_avvy(byte tripnum); - void spin(byte whichway, byte &tripnum); + // Different movements for NPCs: + void followAvalotY(byte tripnum); // Original: follow_avvy_y(). + void backAndForth(byte tripnum); + void faceAvvy(byte tripnum); + + // Movements for Homing NPCs: Spludwick and Geida. + void spin(byte whichway, byte &tripnum); void takeAStep(byte &tripnum); - void geida_procs(byte tripnum); + void geidaProcs(byte tripnum); - void call_andexors(); + void drawSprites(); // Original: call_andexors(). }; } // End of namespace Avalanche. From 2eb4002e365ab79870f68f09c030770e632c1166 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 12:23:48 +0200 Subject: [PATCH 0894/1332] AVALANCHE: Check function scope in Animation, set a function private --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/animation.cpp | 38 ++++++++++++++++----------------- engines/avalanche/animation.h | 22 +++++++++---------- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 2 +- engines/avalanche/timer.cpp | 10 ++++----- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 10b32cf7c0c4..939f50f71261 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1571,7 +1571,7 @@ void Acci::doThat() { if (_vm->_animation->_sprites[0]._id != i) { int16 x = _vm->_animation->_sprites[0]._x; int16 y = _vm->_animation->_sprites[0]._y; - _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[0].remove(); _vm->_animation->_sprites[0].init(i, true, _vm->_animation); _vm->_animation->_sprites[0].appear(x, y, Animation::kDirLeft); _vm->_animation->_sprites[0]._visible = false; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f83173ef77d2..d70b6c858caf 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -264,7 +264,7 @@ void AnimationType::bounce() { _tr->_vm->_gyro->_onCanDoPageSwap = true; } -int8 AnimationType::sgn(int16 val) { +int8 AnimationType::getSign(int16 val) { if (val > 0) return 1; else if (val < 0) @@ -275,13 +275,13 @@ int8 AnimationType::sgn(int16 val) { void AnimationType::walkTo(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. - speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y)); + setSpeed(getSign(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, getSign(_tr->_vm->_gyro->_peds[pednum]._y - _y)); _homingX = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; _homingY = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; _homing = true; } -void AnimationType::stophoming() { +void AnimationType::stopHoming() { _homing = false; } @@ -315,7 +315,7 @@ void AnimationType::homeStep() { } } -void AnimationType::speed(int8 xx, int8 yy) { +void AnimationType::setSpeed(int8 xx, int8 yy) { _moveX = xx; _moveY = yy; if ((_moveX == 0) && (_moveY == 0)) @@ -347,7 +347,7 @@ void AnimationType::chatter() { _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; } -void AnimationType::done() { +void AnimationType::remove() { _animCount--; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) @@ -372,7 +372,7 @@ Animation::Animation(AvalancheEngine *vm) { Animation::~Animation() { for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick) - _sprites[i].done(); + _sprites[i].remove(); } } @@ -791,7 +791,7 @@ void Animation::callSpecial(uint16 which) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. _vm->_visa->displayScrollChain('q', 35); - _sprites[0].done(); + _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->displayScrollChain('q', 36); @@ -835,7 +835,7 @@ void Animation::callSpecial(uint16 which) { return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1].walkTo(4); // She walks to somewhere... - _sprites[0].done(); // Lose Avvy. + _sprites[0].remove(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; _vm->_timer->addTimer(40, _vm->_timer->kProcRobinHoodAndGeida, _vm->_timer->kReasonRobinHoodAndGeida); break; @@ -980,28 +980,28 @@ void Animation::updateSpeed() { void Animation::changeDirection(byte t, byte dir) { switch (dir) { case kDirUp: - _sprites[t].speed(0, -_sprites[t]._speedY); + _sprites[t].setSpeed(0, -_sprites[t]._speedY); break; case kDirDown: - _sprites[t].speed(0, _sprites[t]._speedY); + _sprites[t].setSpeed(0, _sprites[t]._speedY); break; case kDirLeft: - _sprites[t].speed(-_sprites[t]._speedX, 0); + _sprites[t].setSpeed(-_sprites[t]._speedX, 0); break; case kDirRight: - _sprites[t].speed(_sprites[t]._speedX, 0); + _sprites[t].setSpeed(_sprites[t]._speedX, 0); break; case kDirUpLeft: - _sprites[t].speed(-_sprites[t]._speedX, -_sprites[t]._speedY); + _sprites[t].setSpeed(-_sprites[t]._speedX, -_sprites[t]._speedY); break; case kDirUpRight: - _sprites[t].speed(_sprites[t]._speedX, -_sprites[t]._speedY); + _sprites[t].setSpeed(_sprites[t]._speedX, -_sprites[t]._speedY); break; case kDirDownLeft: - _sprites[t].speed(-_sprites[t]._speedX, _sprites[t]._speedY); + _sprites[t].setSpeed(-_sprites[t]._speedX, _sprites[t]._speedY); break; case kDirDownRight: - _sprites[t].speed(_sprites[t]._speedX, _sprites[t]._speedY); + _sprites[t].setSpeed(_sprites[t]._speedX, _sprites[t]._speedY); break; } } @@ -1067,7 +1067,7 @@ void Animation::arrow_procs(byte tripnum) { _sprites[1]._callEachStepFl = false; // prevent recursion. _vm->_visa->displayScrollChain('Q', 47); // Complaint! - _sprites[tripnum].done(); // Deallocate the arrow. + _sprites[tripnum].remove(); // Deallocate the arrow. #if 0 tr[1].done; { Deallocate normal pic of Avvy. } @@ -1085,7 +1085,7 @@ void Animation::arrow_procs(byte tripnum) { _vm->_timer->addTimer(55, _vm->_timer->kProcNaughtyDuke, _vm->_timer->kReasonNaughtyDuke); } } else { // Arrow has hit the wall! - _sprites[tripnum].done(); // Deallocate the arrow. + _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. } @@ -1338,7 +1338,7 @@ void Animation::flipRoom(byte room, byte ped) { for (int16 i = 1; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick) - _sprites[i].done(); + _sprites[i].remove(); } // Deallocate sprite if (_vm->_gyro->_dna._room == r__lustiesroom) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index cfb1cfe97df6..3c0be925c196 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -42,7 +42,7 @@ class Animation; struct StatType { Common::String _name; // Name of character. Common::String _comment; // Comment. - // + byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. byte _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. @@ -68,26 +68,26 @@ class AnimationType { bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; - void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite. - void original(); // Just sets 'quick' to false. void andexor(); // Drops sprite onto screen. - void turn(byte whichway); // Turns character round. void appear(int16 wx, int16 wy, byte wf); // Switches it on. void bounce(); // Bounces off walls. + void chatter(); // Sets up talk vars. + void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite. + void original(); // Just sets 'quick' to false. + void remove(); + void setSpeed(int8 xx, int8 yy); // Sets ix & iy, non-homing, etc. + void stopHoming(); // Self-explanatory. + void stopWalk(); // Stops the sprite from moving. + void turn(byte whichway); // Turns character round. void walk(); // Prepares for andexor, etc. void walkTo(byte pednum); // Home in on a point. - void stophoming(); // Self-explanatory. - void homeStep(); // Calculates ix & iy for one homing step. - void speed(int8 xx, int8 yy); // Sets ix & iy, non-homing, etc. - void stopWalk(); // Stops the sprite from moving. - void chatter(); // Sets up talk vars. - void done(); private: Animation *_tr; bool checkCollision(); - int8 sgn(int16 val); + int8 getSign(int16 val); + void homeStep(); // Calculates ix & iy for one homing step. }; class Animation { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 195ddef50dd3..d59c18b23ec2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -292,7 +292,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { if (sz.isLoading()) { for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. if (_animation->_sprites[i]._quick) - _animation->_sprites[i].done(); + _animation->_sprites[i].remove(); } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index c80ac4bc8235..513052fd1937 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -229,7 +229,7 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { if (_vm->_animation->_sprites[i]._quick) - _vm->_animation->_sprites[i].done(); + _vm->_animation->_sprites[i].remove(); } // Deallocate sprite. Sorry, beta testers! diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 2ec32b2ca0b3..390c13bfa98f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1198,7 +1198,7 @@ void Lucerna::gameOver() { int16 sx = _vm->_animation->_sprites[0]._x; int16 sy = _vm->_animation->_sprites[0]._y; - _vm->_animation->_sprites[0].done(); + _vm->_animation->_sprites[0].remove(); _vm->_animation->_sprites[0].init(12, true, _vm->_animation); // 12 = Avalot falls _vm->_animation->_sprites[0]._stepNum = 0; _vm->_animation->_sprites[0].appear(sx, sy, 0); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index cb765e1a8883..7eee3fc31fc6 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -308,7 +308,7 @@ void Timer::getTiedUp() { _vm->_gyro->_dna._beenTiedUp = true; _vm->_animation->stopWalking(); _vm->_animation->_sprites[1].stopWalk(); - _vm->_animation->_sprites[1].stophoming(); + _vm->_animation->_sprites[1].stopHoming(); _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); @@ -337,8 +337,8 @@ void Timer::hangAround2() { _vm->_animation->_sprites[1].walkTo(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); - _vm->_animation->_sprites[0].done(); - _vm->_animation->_sprites[1].done(); // Get rid of Robin Hood and Friar Tuck. + _vm->_animation->_sprites[0].remove(); + _vm->_animation->_sprites[1].remove(); // Get rid of Robin Hood and Friar Tuck. addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). @@ -592,8 +592,8 @@ void Timer::robinHoodAndGeidaTalk() { } void Timer::avalotReturns() { - _vm->_animation->_sprites[0].done(); - _vm->_animation->_sprites[1].done(); + _vm->_animation->_sprites[0].remove(); + _vm->_animation->_sprites[1].remove(); _vm->_animation->_sprites[0].init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); _vm->_visa->displayScrollChain('q', 67); From e6956a994b980e81cd83784b67b7feb0d2250a75 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 12:46:16 +0200 Subject: [PATCH 0895/1332] AVALANCHE: Change type of kSpriteNumbMax to byte --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/animation.cpp | 14 +++++++------- engines/avalanche/animation.h | 2 +- engines/avalanche/avalanche.cpp | 4 ++-- engines/avalanche/visa2.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 939f50f71261..384d27421001 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1277,7 +1277,7 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. - for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 15e8bd7cb083..9b51ee8781e4 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -172,7 +172,7 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { * @remarks Originally called 'collision_check' */ bool AnimationType::checkCollision() { - for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) { + for (byte i = 0; i < _tr->kSpriteNumbMax; i++) { if (_tr->_sprites[i]._quick && (_tr->_sprites[i]._id != _id) && ((_x + _info._xLength) > _tr->_sprites[i]._x) && (_x < (_tr->_sprites[i]._x + _tr->_sprites[i]._info._xLength)) && @@ -370,14 +370,14 @@ Animation::Animation(AvalancheEngine *vm) { } Animation::~Animation() { - for (int16 i = 0; i < kSpriteNumbMax; i++) { + for (byte i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick) _sprites[i].remove(); } } void Animation::loadAnims() { - for (int16 i = 0; i < kSpriteNumbMax; i++) + for (byte i = 0; i < kSpriteNumbMax; i++) _sprites[i].original(); } @@ -1204,7 +1204,7 @@ void Animation::drawSprites() { for (int i = 0; i < 5; i++) order[i] = -1; - for (int16 i = 0; i < kSpriteNumbMax; i++) { + for (byte i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) order[i] = i; } @@ -1239,14 +1239,14 @@ void Animation::drawSprites() { void Animation::animLink() { if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; - for (int16 i = 0; i < kSpriteNumbMax; i++) { + for (byte i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) _sprites[i].walk(); } drawSprites(); - for (int16 i = 0; i < kSpriteNumbMax; i++) { + for (byte i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._callEachStepFl) { switch (_sprites[i]._eachStepProc) { case kProcFollowAvvyY : @@ -1336,7 +1336,7 @@ void Animation::flipRoom(byte room, byte ped) { _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); _vm->_lucerna->dusk(); - for (int16 i = 1; i < kSpriteNumbMax; i++) { + for (byte i = 1; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick) _sprites[i].remove(); } // Deallocate sprite diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 7b00bc9ec95b..1193057c525c 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -98,7 +98,7 @@ class Animation { kDirStopped }; - static const int16 kSpriteNumbMax = 5; // current max no. of sprites + static const byte kSpriteNumbMax = 5; // current max no. of sprites enum Proc { kProcFollowAvvyY = 1, diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d59c18b23ec2..d2e9a8de9b2e 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -282,7 +282,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { if (_animation->_sprites[i]._quick) spriteNum++; } @@ -290,7 +290,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. if (_animation->_sprites[i]._quick) _animation->_sprites[i].remove(); } diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index d7e1563fceb6..81e46712b404 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -248,7 +248,7 @@ void Visa::talkTo(byte whom) { whom -= 149; bool noMatches = true; - for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); noMatches = false; From 48f2a79ed2adefbc9b3fe79ef1dc54e052871d83 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 12:53:19 +0200 Subject: [PATCH 0896/1332] AVALANCHE: Rename _tr to _anim. --- engines/avalanche/animation.cpp | 82 ++++++++++++++++----------------- engines/avalanche/animation.h | 4 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 15e8bd7cb083..0875dd223e6f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -45,8 +45,8 @@ namespace Avalanche { -void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { - _tr = tr; +void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { + _anim = anim; const int32 idshould = -1317732048; @@ -121,7 +121,7 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { _speedX = 3; _speedY = 1; if (spritenum == 1) - _tr->updateSpeed(); // Just for the lights. + _anim->updateSpeed(); // Just for the lights. _homing = false; _moveX = 0; @@ -146,7 +146,7 @@ void AnimationType::draw() { return; byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). - _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); + _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } void AnimationType::turn(byte whichway) { @@ -159,8 +159,8 @@ void AnimationType::turn(byte whichway) { void AnimationType::appear(int16 wx, int16 wy, byte wf) { _x = (wx / 8) * 8; _y = wy; - _oldX[_tr->_vm->_gyro->_cp] = wx; - _oldY[_tr->_vm->_gyro->_cp] = wy; + _oldX[_anim->_vm->_gyro->_cp] = wx; + _oldY[_anim->_vm->_gyro->_cp] = wy; turn(wf); _visible = true; _moveX = 0; @@ -172,11 +172,11 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { * @remarks Originally called 'collision_check' */ bool AnimationType::checkCollision() { - for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) { - if (_tr->_sprites[i]._quick && (_tr->_sprites[i]._id != _id) && - ((_x + _info._xLength) > _tr->_sprites[i]._x) && - (_x < (_tr->_sprites[i]._x + _tr->_sprites[i]._info._xLength)) && - (_tr->_sprites[i]._y == _y)) + for (int16 i = 0; i < _anim->kSpriteNumbMax; i++) { + if (_anim->_sprites[i]._quick && (_anim->_sprites[i]._id != _id) && + ((_x + _info._xLength) > _anim->_sprites[i]._x) && + (_x < (_anim->_sprites[i]._x + _anim->_sprites[i]._info._xLength)) && + (_anim->_sprites[i]._y == _y)) return true; } @@ -194,9 +194,9 @@ void AnimationType::walk() { r._y2 = _y + _info._yLength + 2; } - if (!_tr->_vm->_gyro->_doingSpriteRun) { - _oldX[_tr->_vm->_gyro->_cp] = _x; - _oldY[_tr->_vm->_gyro->_cp] = _y; + if (!_anim->_vm->_gyro->_doingSpriteRun) { + _oldX[_anim->_vm->_gyro->_cp] = _x; + _oldY[_anim->_vm->_gyro->_cp] = _y; if (_homing) homeStep(); _x += _moveX; @@ -209,39 +209,39 @@ void AnimationType::walk() { return; } - byte tc = _tr->checkFeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte tc = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { - switch (_tr->_vm->_gyro->_magics[tc]._operation) { + if ((tc != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { + switch (_anim->_vm->_gyro->_magics[tc]._operation) { case Gyro::kMagicExclaim: { bounce(); - _tr->_mustExclaim = true; - _tr->_sayWhat = _tr->_vm->_gyro->_magics[tc]._data; + _anim->_mustExclaim = true; + _anim->_sayWhat = _anim->_vm->_gyro->_magics[tc]._data; } break; case Gyro::kMagicBounce: bounce(); break; case Gyro::kMagicTransport: - _tr->flipRoom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); + _anim->flipRoom(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff); break; case Gyro::kMagicUnfinished: { bounce(); - _tr->_vm->_scrolls->displayText("\7Sorry.\3\rThis place is not available yet!"); + _anim->_vm->_scrolls->displayText("\7Sorry.\3\rThis place is not available yet!"); } break; case Gyro::kMagicSpecial: - _tr->callSpecial(_tr->_vm->_gyro->_magics[tc]._data); + _anim->callSpecial(_anim->_vm->_gyro->_magics[tc]._data); break; case Gyro::kMagicOpenDoor: - _tr->openDoor(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); + _anim->openDoor(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff, tc); break; } } } - if (!_tr->_vm->_gyro->_doingSpriteRun) { + if (!_anim->_vm->_gyro->_doingSpriteRun) { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; @@ -253,15 +253,15 @@ void AnimationType::walk() { } void AnimationType::bounce() { - _x = _oldX[_tr->_vm->_gyro->_cp]; - _y = _oldY[_tr->_vm->_gyro->_cp]; + _x = _oldX[_anim->_vm->_gyro->_cp]; + _y = _oldY[_anim->_vm->_gyro->_cp]; if (_doCheck) - _tr->stopWalking(); + _anim->stopWalking(); else stopWalk(); - _tr->_vm->_gyro->_onCanDoPageSwap = false; - _tr->_vm->_lucerna->drawDirection(); - _tr->_vm->_gyro->_onCanDoPageSwap = true; + _anim->_vm->_gyro->_onCanDoPageSwap = false; + _anim->_vm->_lucerna->drawDirection(); + _anim->_vm->_gyro->_onCanDoPageSwap = true; } int8 AnimationType::getSign(int16 val) { @@ -275,9 +275,9 @@ int8 AnimationType::getSign(int16 val) { void AnimationType::walkTo(byte pednum) { pednum--; // Pascal -> C conversion: different array indexes. - setSpeed(getSign(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, getSign(_tr->_vm->_gyro->_peds[pednum]._y - _y)); - _homingX = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; - _homingY = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; + setSpeed(getSign(_anim->_vm->_gyro->_peds[pednum]._x - _x) * 4, getSign(_anim->_vm->_gyro->_peds[pednum]._y - _y)); + _homingX = _anim->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; + _homingY = _anim->_vm->_gyro->_peds[pednum]._y - _info._yLength; _homing = true; } @@ -323,14 +323,14 @@ void AnimationType::setSpeed(int8 xx, int8 yy) { if (_moveX == 0) { // No horz movement if (_moveY < 0) - turn(_tr->kDirUp); + turn(_anim->kDirUp); else - turn(_tr->kDirDown); + turn(_anim->kDirDown); } else { if (_moveX < 0) - turn(_tr->kDirLeft); + turn(_anim->kDirLeft); else - turn(_tr->kDirRight); + turn(_anim->kDirRight); } } @@ -341,10 +341,10 @@ void AnimationType::stopWalk() { } void AnimationType::chatter() { - _tr->_vm->_gyro->_talkX = _x + _info._xLength / 2; - _tr->_vm->_gyro->_talkY = _y; - _tr->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; - _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_gyro->_talkX = _x + _info._xLength / 2; + _anim->_vm->_gyro->_talkY = _y; + _anim->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; + _anim->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; } void AnimationType::remove() { diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 7b00bc9ec95b..f78d0b157b78 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -66,7 +66,7 @@ class AnimationType { bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; - void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite. + void init(byte spritenum, bool doCheck, Animation *anim); // Loads & sets up the sprite. void original(); // Just sets 'quick' to false. void draw(); // Drops sprite onto screen. Original: andexor(). void turn(byte whichway); // Turns character round. @@ -82,7 +82,7 @@ class AnimationType { void remove(); private: - Animation *_tr; + Animation *_anim; bool checkCollision(); int8 getSign(int16 val); From 7df4c94aeb6c1408d26d6ada58d728b6eac17717 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 14:10:40 +0200 Subject: [PATCH 0897/1332] AVALANCHE: Some renaming in Timer and Acci2, add some doxygen comments --- engines/avalanche/acci2.cpp | 53 +++++++++++++++++++++---------------- engines/avalanche/acci2.h | 4 +-- engines/avalanche/timer.cpp | 4 +-- engines/avalanche/timer.h | 2 +- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 384d27421001..1c10a36fe3df 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -300,8 +300,6 @@ void Acci::stripPunctuation(Common::String &word) { } } - - void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { if (target == kPardon) { ambiguous = true; @@ -347,8 +345,6 @@ bool Acci::doPronouns() { return ambiguous; } - - void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); @@ -512,10 +508,11 @@ void Acci::parse() { } } + Common::String unkString; if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) - _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; - else if (!_unknown.empty()) - _unknown.clear(); + unkString = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; + else + unkString.clear(); // Replace words' codes that mean the same. replace(Common::String('\xFF'), 0); // zap noise words @@ -598,9 +595,9 @@ void Acci::parse() { _polite = true; } - if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea what \"") + _unknown + "\" means. Can you rephrase it?"); - _vm->_gyro->_weirdWord = true; + if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea what \"") + unkString + "\" means. Can you rephrase it?"); + _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -687,7 +684,11 @@ void Acci::exampers() { _vm->_visa->displayScrollChain('Q', 13); } -bool Acci::holding() { +/** + * Return whether Avvy is holding an object or not + * @remarks Originally called 'holding' + */ +bool Acci::isHolding() { if ((51 <= _thing) && (_thing <= 99)) // Also. return true; @@ -725,7 +726,7 @@ void Acci::openBox(bool isOpening) { void Acci::examine() { // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. if ((_person == kPardon) && (_thing != kPardon)) { - if (holding()) { + if (isHolding()) { // Remember: it's been Slipped! Ie subtract 49. if ((1 <= _thing) && (_thing <= 49)) // Standard object examineObject(); @@ -959,13 +960,13 @@ void Acci::silly() { } void Acci::putProc() { - if (!holding()) + if (!isHolding()) return; _thing2 -= 49; // Slip the second object. char temp = _thing; _thing = _thing2; - if (!holding()) + if (!isHolding()) return; _thing = temp; @@ -1031,17 +1032,23 @@ void Acci::putProc() { } } - - +/** + * Display text when ingredients are not in the right order + * @remarks Originally called 'not_in_order' + */ void Acci::notInOrder() { _vm->_scrolls->displayText(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); } +/** + * Move Spludwick to cauldron + * @remarks Originally called 'go_to_cauldron' + */ void Acci::goToCauldron() { _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludWalk); + _vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludwickWalk); _vm->_animation->_sprites[1].walkTo(2); } @@ -1386,7 +1393,7 @@ void Acci::doThat() { _vm->_visa->talkTo(_person); break; case kVerbCodeGive: - if (holding()) { + if (isHolding()) { if (_person == kPardon) _vm->_scrolls->displayText("Give to whom?"); else if (isPersonHere()) { @@ -1484,7 +1491,7 @@ void Acci::doThat() { case kVerbCodeEat: case kVerbCodeDrink: - if (holding()) + if (isHolding()) swallow(); break; @@ -1544,7 +1551,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?"); break; case kVerbCodeWear: - if (holding()) { // Wear something. + if (isHolding()) { // Wear something. switch (_thing) { case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph @@ -1625,7 +1632,7 @@ void Acci::doThat() { playHarp(); break; } - } else if (holding()) { + } else if (isHolding()) { switch (_thing) { case Gyro::kObjectLute : _vm->_visa->displayScrollChain('U', 7); @@ -1655,7 +1662,7 @@ void Acci::doThat() { } break; case kVerbCodeRing: - if (holding()) { + if (isHolding()) { if (_thing == _vm->_gyro->kObjectBell) { _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) @@ -2022,7 +2029,7 @@ void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) { case kVerbCodeExam: answer = "Examine"; ansKey = 'x'; - break; // The ubiqutous one. + break; // The ubiquitous one. // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. case kVerbCodeDrink: answer = "Drink"; diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index ed44a758bd84..55ad64e65f5a 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -83,8 +83,6 @@ class Acci { }; Common::String _thats; - Common::String _unknown; - byte _thing2; AvalancheEngine *_vm; @@ -108,7 +106,7 @@ class Acci { void examineObject(); // Examine a standard object-thing bool isPersonHere(); void exampers(); - bool holding(); + bool isHolding(); void openBox(bool isOpening); void examine(); void inventory(); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 7eee3fc31fc6..883e1a25a40e 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -663,9 +663,9 @@ void Timer::avalotFalls() { void Timer::spludwickGoesToCauldron() { if (_vm->_animation->_sprites[1]._homing) - addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludWalk); + addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludwickWalk); else - addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludWalk); + addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludwickWalk); } void Timer::spludwickLeavesCauldron() { diff --git a/engines/avalanche/timer.h b/engines/avalanche/timer.h index c8b664b74388..134a4dc94ee0 100644 --- a/engines/avalanche/timer.h +++ b/engines/avalanche/timer.h @@ -65,7 +65,7 @@ class Timer { kReasonArkataShouts = 24, kReasonWinning = 25, kReasonFallingOver = 26, - kReasonSpludWalk = 27, + kReasonSpludwickWalk = 27, kReasonGeidaSings = 28 }; From b60767fce8100f04828128948f1b1e30e69f4257 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 15:20:41 +0200 Subject: [PATCH 0898/1332] AVALANCHE: Do not set pixels directly --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/gyro2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 6058b006bffd..8f51f749e38a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -309,7 +309,7 @@ void Graphics::refreshScreen() { } } // Now we copy the stretched picture to the screen. - g_system->copyRectToScreen(_screen.pixels, _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); + g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 513052fd1937..ab1b9d8686c9 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -499,7 +499,7 @@ void Gyro::loadMouse(byte which) { mask.free(); f.close(); - CursorMan.replaceCursor(cursor.pixels, 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); cursor.free(); } From 78417de0d119e940243c6499be01f2aebf669f2e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 18:50:47 +0200 Subject: [PATCH 0899/1332] AVALANCHE: Start simplifying String use --- engines/avalanche/visa2.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 81e46712b404..a1863065daa5 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -177,8 +177,11 @@ void Visa::talkTo(byte whom) { // 0 - let it through to use normal routine. switch (_vm->_gyro->_dna._givenToSpludwick) { case 1: // Fallthrough is intended. - case 2: - _vm->_scrolls->displayText(Common::String("Can you get me ") + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) + ", please?" + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + case 2: { + Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]); + Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } return; case 3: displayScrollChain('q', 30); // Need any help with the game? @@ -250,14 +253,17 @@ void Visa::talkTo(byte whom) { bool noMatches = true; for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); noMatches = false; break; } } - if (noMatches) - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + _vm->_scrolls->kControlRegister + _vm->_scrolls->kControlToBuffer); + if (noMatches) { + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, Scrolls::kControlRegister, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } speak(whom, _vm->_gyro->_subjectNum); From f33ba719245a8da967ef5de414ecaa35d39df7e1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 18:52:40 +0200 Subject: [PATCH 0900/1332] AVALANCHE: Fix bug in Visa2 --- engines/avalanche/visa2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index a1863065daa5..b356aef7c8e8 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -84,8 +84,7 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling if (error) { if (report) { - Common::String todisplay; - todisplay.format("%cError accessing scroll %c%s", 7, block, _vm->_gyro->intToStr(point).c_str()); + Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Scrolls::kControlBell, block, point); _vm->_scrolls->displayText(todisplay); } return; From cb66911ed2d9c0c19bf2ecec3eb71d398e5a94b7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 20:24:09 +0200 Subject: [PATCH 0901/1332] AVALANCHE: Rework more strings in Scroll2 --- engines/avalanche/scrolls2.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 30e5bc4d264c..d4cd5b1f3a9c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -561,18 +561,20 @@ Common::String Scrolls::displayMoney() { Common::String result; if (_vm->_gyro->_dna._money < 12) { // just pence - result = _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + 'd'; + result = Common::String::format("%dd", _vm->_gyro->_dna._money); } else if (_vm->_gyro->_dna._money < 240) { // shillings & pence - result = _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 12) + '/'; if ((_vm->_gyro->_dna._money % 12) == 0) - result = result + '-'; + result = Common::String::format("%d/-", _vm->_gyro->_dna._money / 12); else - result = result + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); - } else // L, s & d - result = Common::String('\x9C') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) - + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); - if (_vm->_gyro->_dna._money > 12) - result = result + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; + result = Common::String::format("%d/%d", _vm->_gyro->_dna._money / 12, _vm->_gyro->_dna._money % 12); + } else { // L, s & d + result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_dna._money / 240, (_vm->_gyro->_dna._money / 12) % 20, + _vm->_gyro->_dna._money % 12); + } + if (_vm->_gyro->_dna._money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_dna._money); + result += extraStr; + } return result; } @@ -813,14 +815,12 @@ void Scrolls::loadFont() { } void Scrolls::musicalScroll() { - displayText(Common::String("To play the harp...") + kControlNewLine + kControlNewLine + "Use these keys:" + + kControlNewLine - + kControlInsertSpaces + "Q W E R T Y U I O P [ ]" + kControlNewLine + kControlNewLine + "Or press Enter to stop playing." - + kControlToBuffer); + Common::String tmpStr = Common::String::format("To play the harp...%c%cUse these keys:%c%cQ W E R T Y U I O P [ ]%c%cOr press Enter to stop playing.%c", + kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); + displayText(tmpStr); _vm->_lucerna->spriteRun(); - drawScroll(&Avalanche::Scrolls::scrollModeMusic); - resetScroll(); } From e77db05208bede59f9a3aa33ba8c3b175e48b0fc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 22:23:58 +0200 Subject: [PATCH 0902/1332] AVALANCHE: Rework some more string uses --- engines/avalanche/animation.cpp | 3 +-- engines/avalanche/gyro2.cpp | 27 ++++++++++++--------------- engines/avalanche/scrolls2.cpp | 10 +++++----- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 006ed5a3d3b3..d3f66ede0926 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -53,9 +53,8 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { if (spritenum == 177) return; // Already running! - Common::String filename; Common::File inf; - filename = filename.format("sprite%d.avd", spritenum); + Common::String filename = Common::String::format("sprite%d.avd", spritenum); if (!inf.open(filename)) { warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); return; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index ab1b9d8686c9..70c2150d1e91 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -190,8 +190,7 @@ Gyro::~Gyro() { } Common::String Gyro::intToStr(int32 num) { - Common::String result = Common::String::format("%d", num); - return result; + return Common::String::format("%d", num); } void Gyro::newMouse(byte id) { @@ -427,34 +426,32 @@ Common::String Gyro::getItem(byte which) { Common::String Gyro::f5Does() { - Common::String f5_does_result; switch (_dna._room) { - case r__yours: { - if (!_dna._avvyIsAwake) - return Common::String(_vm->_acci->kVerbCodeWake) + "WWake up"; - else if (_dna._avvyInBed) - return Common::String(_vm->_acci->kVerbCodeStand) + "GGet up"; - } + case r__yours: + if (!_dna._avvyIsAwake) + return Common::String::format("%cWWake up", Acci::kVerbCodeWake); + else if (_dna._avvyInBed) + return Common::String::format("%cGGet up", Acci::kVerbCodeStand); break; case r__insidecardiffcastle: if (_dna._standingOnDais) - return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb down"; + return Common::String::format("%cCClimb down", Acci::kVerbCodeClimb); else - return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb up"; + return Common::String::format("%cCClimb up", Acci::kVerbCodeClimb); break; case r__nottspub: if (_dna._sittingInPub) - return Common::String(_vm->_acci->kVerbCodeStand) + "SStand up"; + return Common::String::format("%cSStand up", Acci::kVerbCodeStand); else - return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; + return Common::String::format("%cSSit down", Acci::kVerbCodeSit); break; case r__musicroom: if (_vm->_animation->inField(7)) - return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; + return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay); break; } - return Common::String(_vm->_acci->kPardon); // If all else fails... + return Common::String::format("%c", _vm->_acci->kPardon); // If all else fails... } void Gyro::loadMouse(byte which) { diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index d4cd5b1f3a9c..ab895a166045 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -85,7 +85,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { byte lz = z.size(); bool offset = x % 8 == 4; - x = x / 8; + x /= 8; y++; int16 i = 0; for (byte xx = 0; xx < lz; xx++) { @@ -112,7 +112,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { } void Scrolls::scrollModeNormal() { - Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; + Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); Common::String e = "(c) 1994"; setReadyLight(3); @@ -161,7 +161,8 @@ void Scrolls::scrollModeNormal() { if (aboutscroll) { move(e[2 - 1], e[1 - 1], 7); e[8 - 1] = inchar; - if (egg == e) easteregg(); + if (egg == e) + easteregg(); } oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); if (! oktoexit) errorled(); @@ -278,9 +279,8 @@ void Scrolls::getIcon(int16 x, int16 y, byte which) { void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File file; + Common::String filename = Common::String::format("%s.avd", fn.c_str()); - Common::String filename; - filename = filename.format("%s.avd", fn.c_str()); if (!file.open(filename)) { warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); return; From f7bce3bede1c48efcb92aee26ff7e26158fa99ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 23:13:58 +0200 Subject: [PATCH 0903/1332] AVALANCHE: Rework some more strings --- engines/avalanche/acci2.cpp | 17 ++++++++++------- engines/avalanche/animation.cpp | 18 +++++++++++------- engines/avalanche/timer.cpp | 13 +++++++------ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1c10a36fe3df..b10a6bc2da5f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -270,9 +270,9 @@ Common::String Acci::totalTime() { Common::String result = "You've been playing for "; if (h > 0) - result = result + _vm->_gyro->intToStr(h) + " hours, "; + result += _vm->_gyro->intToStr(h) + " hours, "; if ((m > 0) || (h != 0)) - result = result + _vm->_gyro->intToStr(m) + " minutes and "; + result += _vm->_gyro->intToStr(m) + " minutes and "; return result + _vm->_gyro->intToStr(s) + " seconds."; } @@ -308,12 +308,15 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { else _vm->_scrolls->displayText("What?"); } else { - if (animate) - _vm->_scrolls->displayText(Common::String("{ ") + _vm->_gyro->getName(target) + " }"); - else { + if (animate) { + Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); + _vm->_scrolls->displayText(tmpStr); + } else { Common::String z = _vm->_gyro->getItem(target); - if (z != "") - _vm->_scrolls->displayText(Common::String("{ ") + z + " }"); + if (z != "") { + Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); + _vm->_scrolls->displayText(tmpStr); + } } } } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d3f66ede0926..9b7b0678b63a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -446,9 +446,11 @@ void Animation::catacombMove(byte ped) { flipRoom(r__lustiesroom, 4); _vm->_scrolls->displayText("Phew! Nice to be out of there!"); return; - case 1033: // Oubliette + case 1033:{ // Oubliette flipRoom(r__oubliette, 1); - _vm->_scrolls->displayText(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } return; case 4: flipRoom(r__geidas, 1); @@ -1290,9 +1292,10 @@ void Animation::stopWalking() { */ void Animation::hideInCupboard() { if (_vm->_gyro->_dna._avvysInTheCupboard) { - if (_vm->_gyro->_dna._wearing == Acci::kNothing) - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); - else { + if (_vm->_gyro->_dna._wearing == Acci::kNothing) { + Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Scrolls::kControlItalic, Scrolls::kControlRoman); + _vm->_scrolls->displayText(tmpStr); + } else { _sprites[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; appearPed(1, 3); // Walk out of the cupboard. @@ -1306,8 +1309,9 @@ void Animation::hideInCupboard() { // Not hiding in the cupboard _sprites[0]._visible = false; _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_scrolls->displayText(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph - + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); + Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ + "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); + _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_dna._avvysInTheCupboard = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 883e1a25a40e..eaa2211224fc 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -264,7 +264,8 @@ void Timer::toilet() { } void Timer::bang() { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "< BANG! >"); + Common::String tmpStr = Common::String::format("%c< BANG! >", Scrolls::kControlItalic); + _vm->_scrolls->displayText(tmpStr); addTimer(30, kProcBang2, kReasonExplosion); } @@ -545,8 +546,8 @@ void Timer::fallDownOubliette() { void Timer::meetAvaroid() { if (_vm->_gyro->_dna._metAvaroid) { - _vm->_scrolls->displayText(Common::String("You can't expect to be ") + _vm->_scrolls->kControlItalic + "that" - + _vm->_scrolls->kControlRoman + " lucky twice in a row!"); + Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Scrolls::kControlItalic, Scrolls::kControlRoman); + _vm->_scrolls->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { _vm->_visa->displayScrollChain('Q', 60); @@ -617,8 +618,8 @@ void Timer::avvySitDown() { } void Timer::ghostRoomPhew() { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "PHEW!" + _vm->_scrolls->kControlRoman - + " You're glad to get out of " + _vm->_scrolls->kControlItalic + "there!"); + Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); + _vm->_scrolls->displayText(tmpStr); } void Timer::arkataShouts() { @@ -656,7 +657,7 @@ void Timer::avalotFalls() { toDisplay += _vm->_scrolls->kControlNewLine; for (byte i = 0; i < 6; i++) toDisplay += _vm->_scrolls->kControlInsertSpaces; - toDisplay = toDisplay + _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; + toDisplay += _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; _vm->_scrolls->displayText(toDisplay); } } From 2d2ce624a9aa9d2b6c0a5e6d2e505510607cf956 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 Sep 2013 23:37:13 +0200 Subject: [PATCH 0904/1332] AVALANCHE: Rework some more strings --- engines/avalanche/acci2.cpp | 16 +++++++++------- engines/avalanche/animation.cpp | 6 +++--- engines/avalanche/lucerna2.cpp | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index b10a6bc2da5f..cc2d5c4ec20d 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -364,8 +364,8 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + '1' + x - + '.' + _vm->_scrolls->kControlSpeechBubble + _vm->_scrolls->kControlRegister + '2'); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), Scrolls::kControlSpeechBubble, Scrolls::kControlRegister); + _vm->_scrolls->displayText(tmpStr); } void Acci::storeInterrogation(byte interrogation) { @@ -480,7 +480,7 @@ void Acci::parse() { if (!thisword.empty()) { for (byte i = 0; i < 31; i++) { if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { - _thats = _thats + Common::String(99 + i); + _thats += Common::String(99 + i); notfound = false; } } @@ -599,7 +599,8 @@ void Acci::parse() { } if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->displayText(Common::String("Sorry, but I have no idea what \"") + unkString + "\" means. Can you rephrase it?"); + Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); + _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -650,11 +651,12 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_dna._room)) return true; else { + Common::String tmpStr; if (_person < 175) - _vm->_scrolls->displayText(Common::String('H') + _vm->_scrolls->kControlToBuffer); + tmpStr = Common::String::format("H%ce isn't around at the moment.", Scrolls::kControlToBuffer); else - _vm->_scrolls->displayText(Common::String("Sh") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->displayText("e isn't around at the moment."); + tmpStr = Common::String::format("Sh%ce isn't around at the moment.", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); return false; } } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 9b7b0678b63a..9e73ea73c02e 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -213,11 +213,10 @@ void AnimationType::walk() { if ((tc != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { switch (_anim->_vm->_gyro->_magics[tc]._operation) { - case Gyro::kMagicExclaim: { + case Gyro::kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = _anim->_vm->_gyro->_magics[tc]._data; - } break; case Gyro::kMagicBounce: bounce(); @@ -227,7 +226,8 @@ void AnimationType::walk() { break; case Gyro::kMagicUnfinished: { bounce(); - _anim->_vm->_scrolls->displayText("\7Sorry.\3\rThis place is not available yet!"); + Common::String tmpStr = Common::String::format("%cSorry.%cThis place is not available yet!", Scrolls::kControlBell, Scrolls::kControlCenter, Scrolls::kControlRoman); + _anim->_vm->_scrolls->displayText(tmpStr); } break; case Gyro::kMagicSpecial: diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 390c13bfa98f..a99e74beef8d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -71,10 +71,12 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so if (_oldMinute != _minute) plotHands(); - if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) - _vm->_scrolls->displayText(Common::String("Good morning!") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); - + if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { + Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ + "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", + Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); + } _oldHour = _hour; _oldHourAngle = _hourAngle; _oldMinute = _minute; @@ -147,10 +149,10 @@ void Lucerna::init() { */ void Lucerna::callVerb(byte id) { if (id == _vm->_acci->kPardon) { - _vm->_scrolls->displayText(Common::String("The f5 key lets you do a particular action in certain ") + - "situations. However, at the moment there is nothing " + - "assigned to it. You may press alt-A to see what the " + - "current setting of this key is."); + Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ + "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ + "what the current setting of this key is."); + _vm->_scrolls->displayText(tmpStr); } else { _vm->_gyro->_weirdWord = false; _vm->_acci->_polite = true; From 524edfcbc358432dea7e8e96f4646dfe94b03596 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Sep 2013 07:20:25 +0200 Subject: [PATCH 0905/1332] AVALANCHE: Rework more strings (still WIP) --- engines/avalanche/acci2.cpp | 8 ++++---- engines/avalanche/lucerna2.cpp | 3 +-- engines/avalanche/scrolls2.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index cc2d5c4ec20d..34768b4147d4 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1917,10 +1917,10 @@ void Acci::doThat() { case kVerbCodeDie: _vm->_lucerna->gameOver(); break; - case kVerbCodeScore: - _vm->_scrolls->displayText(Common::String("Your score is ") + _vm->_gyro->intToStr(_vm->_gyro->_dna._score) + ',' + _vm->_scrolls->kControlCenter - + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totalTime()); + case kVerbCodeScore: { + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dna._score, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str()); + _vm->_scrolls->displayText(tmpStr); + } break; case kVerbCodePut: putProc(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a99e74beef8d..a10c5e14ee42 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -293,8 +293,7 @@ void Lucerna::loadRoom(byte num) { _vm->_graphics->fleshColors(); - Common::String filename; - filename = filename.format("place%d.avd", num); + Common::String filename = Common::String::format("place%d.avd", num); if (!file.open(filename)) { warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); return; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index ab895a166045..abc6ebdbf698 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -714,8 +714,10 @@ void Scrolls::callScrollDriver() { case 6: displayText(_vm->_gyro->_dna._spareEvening + kControlToBuffer); break; - case 9: - displayText(_vm->_gyro->intToStr(_vm->_gyro->_dna._catacombX) + ',' + _vm->_gyro->intToStr(_vm->_gyro->_dna._catacombY) + kControlToBuffer); + case 9: { + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_dna._catacombX, _vm->_gyro->_dna._catacombY, kControlToBuffer); + displayText(tmpStr); + } break; case 10: switch (_vm->_gyro->_dna._boxContent) { From 6a9572670cf4a325e2f583e492c14f2f9edbd2b9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:06:42 -0500 Subject: [PATCH 0906/1332] ZVISION: Add method for getting a pointer to a Control --- engines/zvision/script_manager.cpp | 8 ++++++++ engines/zvision/script_manager.h | 1 + 2 files changed, 9 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 4952ebdda4b4..b9217e72501e 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -228,6 +228,14 @@ void ScriptManager::addControl(Control *control) { _activeControls.push_back(control); } +Control *ScriptManager::getControl(uint32 key) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + if ((*iter)->getKey() == key) { + return (*iter); + } + } +} + void ScriptManager::enableControl(uint32 key) { for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { if ((*iter)->getKey() == key) { diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 61ad4fa87a78..15d456ea6b4d 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -83,6 +83,7 @@ class ScriptManager { void addToStateValue(uint32 key, uint valueToAdd); void addControl(Control *control); + Control *getControl(uint32 key); void enableControl(uint32 key); void disableControl(uint32 key); From 46278f6f59505050d516460094237e30abaa58e0 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:07:47 -0500 Subject: [PATCH 0907/1332] ZVISION: Implement AnimationControl This handles playing animations asyncronously over numerous frames --- engines/zvision/animation_control.cpp | 122 ++++++++++++++++++++++++++ engines/zvision/animation_control.h | 78 ++++++++++++++++ engines/zvision/module.mk | 1 + 3 files changed, 201 insertions(+) create mode 100644 engines/zvision/animation_control.cpp create mode 100644 engines/zvision/animation_control.h diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp new file mode 100644 index 000000000000..5da39e4583a6 --- /dev/null +++ b/engines/zvision/animation_control.cpp @@ -0,0 +1,122 @@ +/* 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/scummsys.h" + +#include "video/video_decoder.h" + +#include "zvision/animation_control.h" +#include "zvision/zvision.h" +#include "zvision/render_manager.h" +#include "zvision/script_manager.h" +#include "zvision/rlf_animation.h" +#include "zvision/zork_avi_decoder.h" + + +namespace ZVision { + +AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Common::String &fileName) + : Control(engine, controlKey), + _fileType(RLF), + _loopCount(1), + _currentLoop(0), + _accumulatedTime(0) { + if (fileName.hasSuffix(".rlf")) { + _fileType = RLF; + _animation.rlf = new RlfAnimation(fileName, false); + } else if (fileName.hasSuffix(".avi")) { + _fileType = AVI; + _animation.avi = new ZorkAVIDecoder(); + _animation.avi->loadFile(fileName); + } else { + warning("Unrecognized animation file type: %s", fileName.c_str()); + } +} + +AnimationControl::~AnimationControl() { + if (_fileType == RLF) { + delete _animation.rlf; + } else if (_fileType == AVI) { + delete _animation.avi; + } +} + +bool AnimationControl::process(uint32 deltaTimeInMillis) { + if (!_enabled) { + return false; + } + + bool finished = false; + + if (_fileType == RLF) { + _accumulatedTime += deltaTimeInMillis; + + uint32 frameTime = _animation.rlf->frameTime(); + if (_accumulatedTime >= frameTime) { + _accumulatedTime -= frameTime; + + _engine->getRenderManager()->copyRectToWorkingWindow(_animation.rlf->getNextFrame(), _x, _y, _animation.rlf->width(), _animation.rlf->width(), _animation.rlf->height()); + + if (_animation.rlf->endOfAnimation()) { + _animation.rlf->seekToFrame(-1); + if (_loopCount > 0) { + _currentLoop++; + if (_currentLoop >= _loopCount) { + finished = true; + } + } + } + } + } else if (_fileType == AVI) { + if (!_animation.avi->isPlaying()) { + _animation.avi->start(); + } + + if (_animation.avi->needsUpdate()) { + const Graphics::Surface *frame = _animation.avi->decodeNextFrame(); + + if (frame) { + _engine->getRenderManager()->copyRectToWorkingWindow((const uint16 *)frame->getPixels(), _x, _y, frame->w, frame->w, frame->h); + } + } + + if (_animation.avi->endOfVideo()) { + _animation.avi->rewind(); + if (_loopCount > 0) { + _currentLoop++; + if (_currentLoop >= _loopCount) { + finished = true; + } + } + } + } + + if (finished) { + _engine->getScriptManager()->setStateValue(_animationKey, 2); + disable(); + _currentLoop = 0; + } + + return false; +} + +} // End of namespace ZVision diff --git a/engines/zvision/animation_control.h b/engines/zvision/animation_control.h new file mode 100644 index 000000000000..036ce4b66b05 --- /dev/null +++ b/engines/zvision/animation_control.h @@ -0,0 +1,78 @@ +/* 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 ZVISION_ANIMATION_CONTROL_H +#define ZVISION_ANIMATION_CONTROL_H + +#include "common/types.h" + +#include "zvision/control.h" + + +namespace Video { +class VideoDecoder; +} + +namespace ZVision { + +class ZVision; +class RlfAnimation; + +class AnimationControl : public Control { +public: + AnimationControl(ZVision *engine, uint32 controlKey, const Common::String &fileName); + ~AnimationControl(); + +private: + enum FileType { + RLF = 1, + AVI = 2 + }; + +private: + uint32 _animationKey; + + union { + RlfAnimation *rlf; + Video::VideoDecoder *avi; + } _animation; + + FileType _fileType; + uint _loopCount; + int32 _x; + int32 _y; + + uint _accumulatedTime; + uint _currentLoop; + +public: + bool process(uint32 deltaTimeInMillis); + + void setAnimationKey(uint32 animationKey) { _animationKey = animationKey; } + void setLoopCount(uint loopCount) { _loopCount = loopCount; } + void setXPos(int32 x) { _x = x; } + void setYPost(int32 y) { _y = y; } +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index c916ab81d318..814a4ba0c2d4 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -3,6 +3,7 @@ MODULE := engines/zvision MODULE_OBJS := \ actions.o \ animation.o \ + animation_control.o \ clock.o \ console.o \ control.o \ From 5c3cfaa6d2428da3ed33bcdf163008457df8000b Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:08:20 -0500 Subject: [PATCH 0908/1332] ZVISION: Implement ActionPreloadAnimation::execute() --- engines/zvision/actions.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index d91c3b879d42..86eca5841160 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,6 +33,7 @@ #include "zvision/zork_raw.h" #include "zvision/zork_avi_decoder.h" #include "zvision/timer_node.h" +#include "zvision/animation_control.h" namespace ZVision { @@ -212,7 +213,13 @@ ActionPreloadAnimation::ActionPreloadAnimation(const Common::String &line) { } bool ActionPreloadAnimation::execute(ZVision *engine) { - // TODO: Implement + // TODO: We ignore the mask and framerate atm. Mask refers to a key color used for binary alpha. We assume the framerate is the default framerate embedded in the videos + + // TODO: Check if the Control already exists + + // Create the control, but disable it until PlayPreload is called + engine->getScriptManager()->addControl(new AnimationControl(engine, _key, _fileName)); + engine->getScriptManager()->disableControl(_key); return true; } From b1587f8ba0f335aff7133f7422953be83aa4c5ae Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:08:49 -0500 Subject: [PATCH 0909/1332] ZVISION: Implement ActionPlayPreloadAnimation --- engines/zvision/actions.cpp | 27 +++++++++++++++++++++++++++ engines/zvision/actions.h | 17 +++++++++++++++++ engines/zvision/scr_file_handling.cpp | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 86eca5841160..3d25fa9e9910 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -245,6 +245,33 @@ bool ActionPlayAnimation::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionPlayPreloadAnimation +////////////////////////////////////////////////////////////////////////////// + +ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(const Common::String &line) { + sscanf(line.c_str(), + "%*[^:]:%*[^:]:%u(%u %u %u %u %u %u %u %u)", + &_animationKey, &_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount); +} + +bool ActionPlayPreloadAnimation::execute(ZVision *engine) { + // Find the control + AnimationControl *control = (AnimationControl *)engine->getScriptManager()->getControl(_controlKey); + + // Set the needed values within the control + control->setAnimationKey(_animationKey); + control->setLoopCount(_loopCount); + control->setXPos(_x1); + control->setYPost(_y1); + + // Enable the control. ScriptManager will take care of the rest + control->enable(); + + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionQuit ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index b36e277d0ecc..5d7cdad68f35 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -242,6 +242,23 @@ class ActionPlayAnimation : public ResultAction { uint _loopCount; }; +class ActionPlayPreloadAnimation : public ResultAction { +public: + ActionPlayPreloadAnimation(const Common::String &line); + bool execute(ZVision *engine); + +private: + uint32 _animationKey; + uint32 _controlKey; + uint32 _x1; + uint32 _y1; + uint32 _x2; + uint32 _y2; + uint _startFrame; + uint _endFrame; + uint _loopCount; +}; + class ActionPreloadAnimation : public ResultAction { public: ActionPreloadAnimation(const Common::String &line); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 378408df665d..3d4718557f7a 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -202,7 +202,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:pan_track*", true)) { // TODO: Implement ActionPanTrack } else if (line.matchString("*:playpreload*", true)) { - // TODO: Implement ActionPlayPreload + actionList.push_back(new ActionPlayPreloadAnimation(line)); } else if (line.matchString("*:preferences*", true)) { // TODO: Implement ActionPreferences } else if (line.matchString("*:quit*", true)) { From 6e806e51ad38a43fc82fc269ed12151b79ea01bd Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 7 Sep 2013 18:15:24 -0500 Subject: [PATCH 0910/1332] ZVISION: Stop avi playback once the animation is finished --- engines/zvision/animation_control.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index 5da39e4583a6..2d401d2b6f41 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -104,6 +104,7 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { if (_loopCount > 0) { _currentLoop++; if (_currentLoop >= _loopCount) { + _animation.avi->stop(); finished = true; } } From 106522661c70e4ff270016f5419cccca5c86820c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 03:17:50 -0500 Subject: [PATCH 0911/1332] ZVISION: Create method for rendering to the working window with binary alpha --- engines/zvision/render_manager.cpp | 20 ++++++++++++++++++++ engines/zvision/render_manager.h | 1 + 2 files changed, 21 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 3793ea8cf956..3f19cae6fe9e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -291,6 +291,26 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); } +void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor) { + uint32 destOffset = 0; + uint32 sourceOffset = 0; + uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); + + for (int32 y = 0; y < height; y++) { + for (int32 x = 0; x < width; x++) { + uint16 color = buffer[sourceOffset + x]; + if (color != alphaColor) { + workingWindowBufferPtr[destOffset + x] = color; + } + } + + destOffset += _workingWidth; + sourceOffset += imageWidth; + } + + _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); +} + const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { // Convert from screen space to working window space Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 9881676583f8..41a11bd1139f 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -109,6 +109,7 @@ class RenderManager { void renderBackbufferToScreen(); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); + void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor); /** * Fills the entire workingWindow with the specified color From 87e78e4c338aa7cde9c53e00eaa6ca1ad97d5d94 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 03:20:20 -0500 Subject: [PATCH 0912/1332] ZVISION: Create method for getting the RenderManager backbuffer --- engines/zvision/render_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 41a11bd1139f..bb673e992930 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -176,6 +176,7 @@ class RenderManager { RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); + const Graphics::Surface *getBackBuffer() { return &_backBuffer; } private: /** From af94158723c2698b17faf83fccc585ce747c7e68 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 03:18:51 -0500 Subject: [PATCH 0913/1332] ZVISION: Save a thumbnail of the RenderManager backbuffer instead of the actual screen This prevents things like the GMM being in the thumbnail --- engines/zvision/save_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 595a0525c7c0..4f8bfeb83618 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -30,6 +30,7 @@ #include "zvision/save_manager.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "zvision/render_manager.h" namespace ZVision { @@ -88,7 +89,7 @@ void SaveManager::autoSave() { void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { // Create a thumbnail and save it - Graphics::saveThumbnail(*file); + Graphics::saveThumbnail(*file, *_engine->getRenderManager()->getBackBuffer()); // Write out the save date/time TimeDate td; From c7358ed4f78437e26aeb05d2113e86ee35d14632 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 03:20:47 -0500 Subject: [PATCH 0914/1332] ZVISION: Create class for rendering TrueType fonts --- engines/zvision/module.mk | 1 + engines/zvision/truetype_font.cpp | 191 ++++++++++++++++++++++++++++++ engines/zvision/truetype_font.h | 129 ++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100644 engines/zvision/truetype_font.cpp create mode 100644 engines/zvision/truetype_font.h diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 814a4ba0c2d4..9fa119d353ed 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -23,6 +23,7 @@ MODULE_OBJS := \ scripts.o \ single_value_container.o \ timer_node.o \ + truetype_font.o \ utility.o \ video.o \ zvision.o \ diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp new file mode 100644 index 000000000000..b3aafc26d713 --- /dev/null +++ b/engines/zvision/truetype_font.cpp @@ -0,0 +1,191 @@ +/* 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/scummsys.h" + +#include "common/debug.h" +#include "common/file.h" +#include "common/system.h" + +#include "graphics/fonts/ttf.h" +#include "graphics/surface.h" + +#include "zvision/truetype_font.h" +#include "zvision/zvision.h" +#include "zvision/render_manager.h" + + +namespace ZVision { + +TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight, const Graphics::PixelFormat pixelFormat) + : _engine(engine), + _pixelFormat(pixelFormat), + _isBold(false), + _isItalic(false), + _isStriked(false), + _isUnderline(false), + _fontHeight(fontHeight), + _font(0), + _lineHeight(0), + _maxCharWidth(0), + _maxCharHeight(0) { + for (int i = 0; i < NUM_CACHED_TEXTS; i++) { + _cachedTexts[i] = 0; + } +} + +TruetypeFont::~TruetypeFont(void) { + clearCache(); + + delete _font; +} + +void TruetypeFont::clearCache() { + for (int i = 0; i < NUM_CACHED_TEXTS; i++) { + if (_cachedTexts[i]) { + delete _cachedTexts[i]; + } + _cachedTexts[i] = 0; + } +} + +bool TruetypeFont::loadFile(const Common::String &filename) { + Common::File file; + if (file.open(filename)) { + debug("TTF font file %s could not be opened", filename.c_str()); + return false; + } + + _font = Graphics::loadTTFFont(file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72). + _lineHeight = _font->getFontHeight(); + + return true; +} + +void TruetypeFont::drawText(const Common::String &text, int x, int y, int width, TextAlign align, int maxHeight) { + if (text.equals("")) { + return; + } + + // Find the cached surface, if it exists + uint32 minUseTime = UINT_MAX; + int minIndex = -1; + Graphics::Surface *surface = nullptr; + + for (int i = 0; i < NUM_CACHED_TEXTS; i++) { + if (_cachedTexts[i] == nullptr) { + minUseTime = 0; + minIndex = i; + } else { + if (_cachedTexts[i]->_text == text && _cachedTexts[i]->_align == align && _cachedTexts[i]->_width == width && _cachedTexts[i]->_maxHeight == maxHeight) { + surface = _cachedTexts[i]->_surface; + _cachedTexts[i]->_marked = true; + _cachedTexts[i]->_lastUsed = g_system->getMillis(); + break; + } else { + if (_cachedTexts[i]->_lastUsed < minUseTime) { + minUseTime = _cachedTexts[i]->_lastUsed; + minIndex = i; + } + } + } + } + + // It's not cached, so create one + if (!surface) { + surface = renderTextToTexture(text, width, align, maxHeight); + if (surface) { + // Write the new surface to cache + if (_cachedTexts[minIndex] != nullptr) { + delete _cachedTexts[minIndex]; + } + _cachedTexts[minIndex] = new CachedText; + + _cachedTexts[minIndex]->_surface = surface; + _cachedTexts[minIndex]->_align = align; + _cachedTexts[minIndex]->_width = width; + _cachedTexts[minIndex]->_maxHeight = maxHeight; + _cachedTexts[minIndex]->_text = text; + _cachedTexts[minIndex]->_marked = true; + _cachedTexts[minIndex]->_lastUsed = _engine->_system->getMillis(); + } + } + + + // Render it to the working window + if (surface) { + _engine->getRenderManager()->copyRectToWorkingWindow((uint16 *)surface->getPixels(), x, y, surface->w, surface->w, surface->h); + } +} + +Graphics::Surface *TruetypeFont::renderTextToTexture(const Common::String &text, int width, TextAlign align, int maxHeight) { + Common::Array lines; + _font->wordWrapText(text, width, lines); + + while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) { + lines.pop_back(); + } + if (lines.size() == 0) { + return nullptr; + } + + Graphics::TextAlign alignment = Graphics::kTextAlignInvalid; + if (align == ALIGN_LEFT) { + alignment = Graphics::kTextAlignLeft; + } else if (align == ALIGN_CENTER) { + alignment = Graphics::kTextAlignCenter; + } else if (align == ALIGN_RIGHT) { + alignment = Graphics::kTextAlignRight; + } + + Graphics::Surface *surface = new Graphics::Surface(); + surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _pixelFormat); + + uint32 alphaColor = 0xffffffff; + int heightOffset = 0; + for (Common::Array::iterator it = lines.begin(); it != lines.end(); it++) { + _font->drawString(surface, *it, 0, heightOffset, width, alphaColor, alignment); + heightOffset += (int)_lineHeight; + } + + return surface; + // TODO: _isUnderline, _isBold, _isItalic, _isStriked +} + +void TruetypeFont::measureText(const Common::String &text, int maxWidth, int maxHeight, int &textWidthOut, int &textHeightOut) { + if (maxWidth >= 0) { + Common::Array lines; + _font->wordWrapText(text, maxWidth, lines); + Common::Array::iterator it; + textWidthOut = 0; + for (it = lines.begin(); it != lines.end(); ++it) { + textWidthOut = MAX(textWidthOut, _font->getStringWidth(*it)); + } + + textHeightOut = (int)(lines.size() * getLineHeight()); + } else { + textWidthOut = _font->getStringWidth(text); + textHeightOut = _fontHeight; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h new file mode 100644 index 000000000000..2618dc407e9c --- /dev/null +++ b/engines/zvision/truetype_font.h @@ -0,0 +1,129 @@ +/* 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 file is based on engines/wintermute/base/fonts/base_font_truetype.h/.cpp + +#ifndef ZVISION_TRUETYPE_FONT_H +#define ZVISION_TRUETYPE_FONT_H + +#include "common/types.h" + +#include "graphics/font.h" + + +namespace Graphics { +struct Surface; +} + +namespace ZVision { + +class ZVision; + +class TruetypeFont { +public: + TruetypeFont(ZVision *engine, int32 fontHeight, const Graphics::PixelFormat pixelFormat); + ~TruetypeFont(); + +public: + enum { + NUM_CACHED_TEXTS = 30 + }; + + enum TextAlign { + ALIGN_LEFT = 0, + ALIGN_RIGHT, + ALIGN_CENTER + }; + + class CachedText { + public: + Common::String _text; + int32 _width; + TextAlign _align; + int32 _maxHeight; + Graphics::Surface *_surface; + int32 _textOffset; + bool _marked; + uint32 _lastUsed; + + CachedText() { + _width = _maxHeight = -1; + _align = ALIGN_LEFT; + _surface = 0; + _lastUsed = 0; + _marked = false; + } + + virtual ~CachedText() { + delete _surface; + } + }; + +private: + ZVision *_engine; + const Graphics::PixelFormat _pixelFormat; + + Graphics::Font *_font; + + float _lineHeight; + + size_t _maxCharWidth; + size_t _maxCharHeight; + + CachedText *_cachedTexts[NUM_CACHED_TEXTS]; + +public: + bool _isBold; + bool _isItalic; + bool _isUnderline; + bool _isStriked; + int32 _fontHeight; + + //BaseArray _layers; + +public: + int getTextWidth(const byte *text, int maxLength = -1); + int getTextHeight(const byte *text, int width); + void drawText(const Common::String &text, int x, int y, int width, TextAlign align = ALIGN_LEFT, int max_height = -1); + int getLetterHeight(); + + void initLoop() {} + void afterLoad() {} + + bool loadBuffer(byte *buffer); + bool loadFile(const Common::String &filename); + + float getLineHeight() const { return _lineHeight; } + + void clearCache(); + + static TruetypeFont *createFromFile(ZVision *game, const Common::String &filename); + +private: + void measureText(const Common::String &text, int maxWidth, int maxHeight, int &textWidthOut, int &textHeightOut); + Graphics::Surface *renderTextToTexture(const Common::String &text, int width, TextAlign align, int maxHeight); + bool initFont(); +}; + +} // End of namespace ZVision + +#endif From 511cb7447e6ebd9a0c54c3e767eb8ea754fd5398 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:12:36 -0500 Subject: [PATCH 0915/1332] ZVISION: Create method for converting image space to working window space --- engines/zvision/render_manager.cpp | 13 +++++++++++++ engines/zvision/render_manager.h | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 3f19cae6fe9e..c0554dc20ab8 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -338,6 +338,19 @@ const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point & return newPoint; } +const Common::Point RenderManager::imageSpaceToWorkingWindowSpace(const Common::Point &point) { + Common::Point newPoint(point); + + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA) { + newPoint += (Common::Point(_screenCenterX, 0) - _backgroundOffset); + } else if (state == RenderTable::TILT) { + newPoint += (Common::Point(0, _screenCenterY) - _backgroundOffset); + } + + return newPoint; +} + RenderTable *RenderManager::getRenderTable() { return &_renderTable; } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index bb673e992930..0294d6a19f46 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -173,6 +173,15 @@ class RenderManager { * @return Point in image coordinate space */ const Common::Point screenSpaceToImageSpace(const Common::Point &point); + /** + * Converts a point in image coordinate space to ***PRE-WARP*** + * working window coordinate space + * + * @param point Point in image coordinate space + * @return Point in PRE-WARP working window coordinate space + */ + const Common::Point imageSpaceToWorkingWindowSpace(const Common::Point &point); + RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); From a415964c6da8f36fcf649f7e0f9fb94791cd02ff Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:13:01 -0500 Subject: [PATCH 0916/1332] ZVISION: Create method for clipping a rect to the working window --- engines/zvision/render_manager.cpp | 11 +++++++++++ engines/zvision/render_manager.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index c0554dc20ab8..8ac07632d6c0 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -351,6 +351,17 @@ const Common::Point RenderManager::imageSpaceToWorkingWindowSpace(const Common:: return newPoint; } +bool RenderManager::clipRectToWorkingWindow(Common::Rect &rect) { + if (!_workingWindow.contains(rect)) { + return false; + } + + // We can't clip against the actual working window rect because it's in screen space + // But rect is in working window space + rect.clip(_workingWidth, _workingHeight); + return true; +} + RenderTable *RenderManager::getRenderTable() { return &_renderTable; } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 0294d6a19f46..cbf69b9df2e4 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -182,6 +182,14 @@ class RenderManager { */ const Common::Point imageSpaceToWorkingWindowSpace(const Common::Point &point); + /** + * Clip a rectangle to the working window. If it returns false, the original rect + * is not inside the working window. + * + * @param rect The rectangle to clip against the working window + * @return Is rect at least partially inside the working window (true) or completely outside (false) + */ + bool clipRectToWorkingWindow(Common::Rect &rect); RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); From f9b9bf5b9b5b6a438a12a77aab90bdb77deeca65 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:13:39 -0500 Subject: [PATCH 0917/1332] ZVISION: Create method for transposing a surface --- engines/zvision/render_manager.cpp | 18 ++++++++++++++++++ engines/zvision/render_manager.h | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 8ac07632d6c0..441580c1bc6f 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -432,4 +432,22 @@ uint32 RenderManager::getCurrentBackgroundOffset() { } } +Graphics::Surface *RenderManager::tranposeSurface(const Graphics::Surface *surface) { + Graphics::Surface *tranposedSurface = new Graphics::Surface(); + tranposedSurface->create(surface->h, surface->w, surface->format); + + uint16 *source = (uint16 *)surface->getPixels(); + uint16 *dest = (uint16 *)tranposedSurface->getPixels(); + + for (uint32 y = 0; y < tranposedSurface->h; y++) { + uint32 columnIndex = y * tranposedSurface->w; + + for (uint32 x = 0; x < tranposedSurface->w; x++) { + dest[columnIndex + x] = source[x * surface->w + y]; + } + } + + return tranposedSurface; +} + } // End of namespace ZVision diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index cbf69b9df2e4..51636ef682e7 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -195,6 +195,17 @@ class RenderManager { uint32 getCurrentBackgroundOffset(); const Graphics::Surface *getBackBuffer() { return &_backBuffer; } + /** + * Creates a copy of surface and transposes the data. + * + * Note: The user is responsible for calling free() on the returned surface + * and then deleting it + * + * @param surface The data to be transposed + * @return A copy of the surface with the data transposed + */ + static Graphics::Surface *tranposeSurface(const Graphics::Surface *surface); + private: /** * Renders a subRectangle of an image to the backbuffer. The destinationRect and SubRect From 3b7189993c3fbd6f6f98108b8e1d828964dc84a9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:14:33 -0500 Subject: [PATCH 0918/1332] ZVISION: Let Rlf animations output Surfaces instead of uint16 arrays --- engines/zvision/rlf_animation.cpp | 22 ++++++++++------------ engines/zvision/rlf_animation.h | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index dfd3289f669f..0ffeeb0f0f4e 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -45,7 +45,6 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) _frameTime(0), _frames(0), _currentFrame(-1), - _currentFrameBuffer(0), _frameBufferByteSize(0) { if (!_file.open(fileName)) { warning("RLF animation file %s could not be opened", fileName.c_str()); @@ -57,7 +56,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) return; } - _currentFrameBuffer = new uint16[_width * _height]; + _currentFrameBuffer.create(_width, _height, _pixelFormat565); _frameBufferByteSize = _width * _height * sizeof(uint16); if (!stream) { @@ -71,7 +70,6 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) } RlfAnimation::~RlfAnimation() { - delete[] _currentFrameBuffer; for (uint i = 0; i < _frameCount; i++) { delete[] _frames[i].encodedData; } @@ -181,23 +179,23 @@ void RlfAnimation::seekToFrame(int frameNumber) { _currentFrame = frameNumber; } -const uint16 *RlfAnimation::getFrameData(uint frameNumber) { +const Graphics::Surface *RlfAnimation::getFrameData(uint frameNumber) { assert(!_stream); assert(frameNumber < _frameCount); // Since this method is so expensive, first check to see if we can use // getNextFrame() it's cheap. if ((int)frameNumber == _currentFrame) { - return _currentFrameBuffer; + return &_currentFrameBuffer; } else if (_currentFrame + 1 == (int)frameNumber) { return getNextFrame(); } seekToFrame(frameNumber); - return _currentFrameBuffer; + return &_currentFrameBuffer; } -const uint16 *RlfAnimation::getNextFrame() { +const Graphics::Surface *RlfAnimation::getNextFrame() { assert(_currentFrame + 1 < (int)_frameCount); if (_stream) { @@ -207,22 +205,22 @@ const uint16 *RlfAnimation::getNextFrame() { } _currentFrame++; - return _currentFrameBuffer; + return &_currentFrameBuffer; } void RlfAnimation::applyFrameToCurrent(uint frameNumber) { if (_frames[frameNumber].type == Masked) { - decodeMaskedRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); + decodeMaskedRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer.getPixels(), _frames[frameNumber].encodedSize, _frameBufferByteSize); } else if (_frames[frameNumber].type == Simple) { - decodeSimpleRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); + decodeSimpleRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer.getPixels(), _frames[frameNumber].encodedSize, _frameBufferByteSize); } } void RlfAnimation::applyFrameToCurrent(const RlfAnimation::Frame &frame) { if (frame.type == Masked) { - decodeMaskedRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer, frame.encodedSize, _frameBufferByteSize); + decodeMaskedRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer.getPixels(), frame.encodedSize, _frameBufferByteSize); } else if (frame.type == Simple) { - decodeSimpleRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer, frame.encodedSize, _frameBufferByteSize); + decodeSimpleRunLengthEncoding(frame.encodedData, (int8 *)_currentFrameBuffer.getPixels(), frame.encodedSize, _frameBufferByteSize); } } diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index b7d25952950e..133bf3913ec7 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -68,7 +68,7 @@ class RlfAnimation { Common::List _completeFrames; int _currentFrame; - uint16 *_currentFrameBuffer; + Graphics::Surface _currentFrameBuffer; uint32 _frameBufferByteSize; public: @@ -79,8 +79,8 @@ class RlfAnimation { void seekToFrame(int frameNumber); - const uint16 *getFrameData(uint frameNumber); - const uint16 *getNextFrame(); + const Graphics::Surface *getFrameData(uint frameNumber); + const Graphics::Surface *getNextFrame(); bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } From 31cdf227d20906986884113910680e2b22965be8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:15:08 -0500 Subject: [PATCH 0919/1332] ZVISION: Clip animations to the working window --- engines/zvision/animation_control.cpp | 48 +++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index 2d401d2b6f41..cd5ebf1549d4 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -71,10 +71,31 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { _accumulatedTime += deltaTimeInMillis; uint32 frameTime = _animation.rlf->frameTime(); - if (_accumulatedTime >= frameTime) { + while (_accumulatedTime >= frameTime) { _accumulatedTime -= frameTime; - _engine->getRenderManager()->copyRectToWorkingWindow(_animation.rlf->getNextFrame(), _x, _y, _animation.rlf->width(), _animation.rlf->width(), _animation.rlf->height()); + RenderManager *renderManager = _engine->getRenderManager(); + Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); + Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _animation.rlf->width(), workingWindowPoint.y + _animation.rlf->height()); + + // If the clip returns false, it means the animation is outside the working window + if (!renderManager->clipRectToWorkingWindow(subRect)) { + return false; + } + + const Graphics::Surface *frame = _animation.rlf->getNextFrame(); + + RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); + if (state == RenderTable::PANORAMA) { + Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); + + renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + + tranposedFrame->free(); + delete tranposedFrame; + } else { + renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + } if (_animation.rlf->endOfAnimation()) { _animation.rlf->seekToFrame(-1); @@ -95,7 +116,28 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { const Graphics::Surface *frame = _animation.avi->decodeNextFrame(); if (frame) { - _engine->getRenderManager()->copyRectToWorkingWindow((const uint16 *)frame->getPixels(), _x, _y, frame->w, frame->w, frame->h); + RenderManager *renderManager = _engine->getRenderManager(); + Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); + Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + frame->w, workingWindowPoint.y + frame->h); + + // If the clip returns false, it means the animation is outside the working window + if (!renderManager->clipRectToWorkingWindow(subRect)) { + return false; + } + + RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); + if (state == RenderTable::PANORAMA) { + Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); + + renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); + + tranposedFrame->free(); + delete tranposedFrame; + } else { + renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); + } + + } } From 8354f236285bfd55536a19b177a4fcfbdd0aaa1b Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:15:32 -0500 Subject: [PATCH 0920/1332] ZVISION: Add a debug assert to make sure we're not trying to render ouside the working window --- engines/zvision/render_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 441580c1bc6f..04163fab6128 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -289,6 +289,9 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i } _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); + + // TODO: Remove this from release. It's here to make sure code that uses this function clips their destinations correctly + assert(_workingWindowDirtyRect.width() <= _workingWidth && _workingWindowDirtyRect.height() <= _workingHeight); } void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor) { From 077f0b24912688b53adb24757a2a87ce52175ae9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:15:55 -0500 Subject: [PATCH 0921/1332] ZVISION: Update LeverControl to use the new RlfAnimation outputs --- engines/zvision/lever_control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 318710e62720..93a6054850d5 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -383,7 +383,7 @@ void LeverControl::renderFrame(uint frameNumber) { if (_fileType == RLF) { // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can - frameData = _animation.rlf->getFrameData(frameNumber); + frameData = (const uint16 *)_animation.rlf->getFrameData(frameNumber)->getPixels(); width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() } else if (_fileType == AVI) { From 9e563f01134ec9063d743ef487eb25cae581e2d2 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:25:34 -0500 Subject: [PATCH 0922/1332] ZVISION: Add comments to AnimationControl::process() --- engines/zvision/animation_control.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index cd5ebf1549d4..ca3e225a8a2a 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -74,6 +74,9 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { while (_accumulatedTime >= frameTime) { _accumulatedTime -= frameTime; + // Make sure the frame is inside the working window + // If it's not, then just return + RenderManager *renderManager = _engine->getRenderManager(); Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _animation.rlf->width(), workingWindowPoint.y + _animation.rlf->height()); @@ -85,18 +88,21 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { const Graphics::Surface *frame = _animation.rlf->getNextFrame(); + // Animation frames for PANORAMAs are transposed, so un-transpose them RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); if (state == RenderTable::PANORAMA) { Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + // Cleanup tranposedFrame->free(); delete tranposedFrame; } else { renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); } + // Check if we should continue looping if (_animation.rlf->endOfAnimation()) { _animation.rlf->seekToFrame(-1); if (_loopCount > 0) { @@ -116,6 +122,9 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { const Graphics::Surface *frame = _animation.avi->decodeNextFrame(); if (frame) { + // Make sure the frame is inside the working window + // If it's not, then just return + RenderManager *renderManager = _engine->getRenderManager(); Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + frame->w, workingWindowPoint.y + frame->h); @@ -125,22 +134,23 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { return false; } + // Animation frames for PANORAMAs are transposed, so un-transpose them RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); if (state == RenderTable::PANORAMA) { Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); + // Cleanup tranposedFrame->free(); delete tranposedFrame; } else { renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); } - - } } + // Check if we should continue looping if (_animation.avi->endOfVideo()) { _animation.avi->rewind(); if (_loopCount > 0) { @@ -153,6 +163,8 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { } } + // If we're done, set _animation key = 2 (Why 2? I don't know. It's just the value that they used) + // Then disable the control. DON'T delete it. It can be re-used if (finished) { _engine->getScriptManager()->setStateValue(_animationKey, 2); disable(); From edd1a117ae821d96498a78a357ab29018f1c019a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 15:47:06 -0500 Subject: [PATCH 0923/1332] ZVISION: Cache animation frames so they can be re-rendered when the background moves --- engines/zvision/animation_control.cpp | 128 +++++++++++++++++++------- engines/zvision/animation_control.h | 2 + 2 files changed, 96 insertions(+), 34 deletions(-) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index ca3e225a8a2a..8c8f6eb23844 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -39,7 +39,8 @@ AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Com _fileType(RLF), _loopCount(1), _currentLoop(0), - _accumulatedTime(0) { + _accumulatedTime(0), + _cachedFrame(0) { if (fileName.hasSuffix(".rlf")) { _fileType = RLF; _animation.rlf = new RlfAnimation(fileName, false); @@ -50,6 +51,8 @@ AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Com } else { warning("Unrecognized animation file type: %s", fileName.c_str()); } + + _cachedFrame = new Graphics::Surface(); } AnimationControl::~AnimationControl() { @@ -58,6 +61,9 @@ AnimationControl::~AnimationControl() { } else if (_fileType == AVI) { delete _animation.avi; } + + _cachedFrame->free(); + delete _cachedFrame; } bool AnimationControl::process(uint32 deltaTimeInMillis) { @@ -71,47 +77,75 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { _accumulatedTime += deltaTimeInMillis; uint32 frameTime = _animation.rlf->frameTime(); - while (_accumulatedTime >= frameTime) { - _accumulatedTime -= frameTime; + if (_accumulatedTime >= frameTime) { + while (_accumulatedTime >= frameTime) { + _accumulatedTime -= frameTime; - // Make sure the frame is inside the working window - // If it's not, then just return + // Make sure the frame is inside the working window + // If it's not, then just return - RenderManager *renderManager = _engine->getRenderManager(); - Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); - Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _animation.rlf->width(), workingWindowPoint.y + _animation.rlf->height()); + RenderManager *renderManager = _engine->getRenderManager(); + Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); + Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _animation.rlf->width(), workingWindowPoint.y + _animation.rlf->height()); - // If the clip returns false, it means the animation is outside the working window - if (!renderManager->clipRectToWorkingWindow(subRect)) { - return false; - } + // If the clip returns false, it means the animation is outside the working window + if (!renderManager->clipRectToWorkingWindow(subRect)) { + return false; + } - const Graphics::Surface *frame = _animation.rlf->getNextFrame(); + const Graphics::Surface *frame = _animation.rlf->getNextFrame(); - // Animation frames for PANORAMAs are transposed, so un-transpose them - RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); - if (state == RenderTable::PANORAMA) { - Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); + // Animation frames for PANORAMAs are transposed, so un-transpose them + RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); + if (state == RenderTable::PANORAMA) { + Graphics::Surface *tranposedFrame = RenderManager::tranposeSurface(frame); - renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); - // Cleanup - tranposedFrame->free(); - delete tranposedFrame; - } else { - renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); - } + // If the background can move, we need to cache the last frame so it can be rendered during background movement + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _cachedFrame = tranposedFrame; + } else { + // Cleanup + tranposedFrame->free(); + delete tranposedFrame; + } + } else { + renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + + // If the background can move, we need to cache the last frame so it can be rendered during background movement + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _cachedFrame->copyFrom(*frame); + } + } - // Check if we should continue looping - if (_animation.rlf->endOfAnimation()) { - _animation.rlf->seekToFrame(-1); - if (_loopCount > 0) { - _currentLoop++; - if (_currentLoop >= _loopCount) { - finished = true; + // Check if we should continue looping + if (_animation.rlf->endOfAnimation()) { + _animation.rlf->seekToFrame(-1); + if (_loopCount > 0) { + _currentLoop++; + if (_currentLoop >= _loopCount) { + finished = true; + } } } } + } else { + // If the background can move, we have to keep rendering animation frames, otherwise the animation flickers during background movement + RenderManager *renderManager = _engine->getRenderManager(); + RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); + + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); + Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _cachedFrame->w, workingWindowPoint.y + _cachedFrame->h); + + // If the clip returns false, it means the animation is outside the working window + if (!renderManager->clipRectToWorkingWindow(subRect)) { + return false; + } + + renderManager->copyRectToWorkingWindow((uint16 *)_cachedFrame->getBasePtr(_cachedFrame->w - subRect.width(), _cachedFrame->h - subRect.height()), subRect.left, subRect.top, _cachedFrame->w, subRect.width(), subRect.height()); + } } } else if (_fileType == AVI) { if (!_animation.avi->isPlaying()) { @@ -141,11 +175,37 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { renderManager->copyRectToWorkingWindow((uint16 *)tranposedFrame->getBasePtr(tranposedFrame->w - subRect.width(), tranposedFrame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); - // Cleanup - tranposedFrame->free(); - delete tranposedFrame; + // If the background can move, we need to cache the last frame so it can be rendered during background movement + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _cachedFrame = tranposedFrame; + } else { + // Cleanup + tranposedFrame->free(); + delete tranposedFrame; + } } else { renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); + + // If the background can move, we need to cache the last frame so it can be rendered during background movement + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + _cachedFrame->copyFrom(*frame); + } + } + } else { + // If the background can move, we have to keep rendering animation frames, otherwise the animation flickers during background movement + RenderManager *renderManager = _engine->getRenderManager(); + RenderTable::RenderState state = renderManager->getRenderTable()->getRenderState(); + + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + Common::Point workingWindowPoint = renderManager->imageSpaceToWorkingWindowSpace(Common::Point(_x, _y)); + Common::Rect subRect(workingWindowPoint.x, workingWindowPoint.y, workingWindowPoint.x + _cachedFrame->w, workingWindowPoint.y + _cachedFrame->h); + + // If the clip returns false, it means the animation is outside the working window + if (!renderManager->clipRectToWorkingWindow(subRect)) { + return false; + } + + renderManager->copyRectToWorkingWindow((uint16 *)_cachedFrame->getBasePtr(_cachedFrame->w - subRect.width(), _cachedFrame->h - subRect.height()), subRect.left, subRect.top, _cachedFrame->w, subRect.width(), subRect.height()); } } } diff --git a/engines/zvision/animation_control.h b/engines/zvision/animation_control.h index 036ce4b66b05..6b104d4c06b6 100644 --- a/engines/zvision/animation_control.h +++ b/engines/zvision/animation_control.h @@ -64,6 +64,8 @@ class AnimationControl : public Control { uint _accumulatedTime; uint _currentLoop; + Graphics::Surface *_cachedFrame; + public: bool process(uint32 deltaTimeInMillis); From 072b852cdc627b060505d1a4da4e0bb4a0300c51 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 16:40:10 -0500 Subject: [PATCH 0924/1332] ZVISION: Remove extraneous methods from TrueTypeFont --- engines/zvision/truetype_font.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index 2618dc407e9c..48657417a2e8 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -106,10 +106,6 @@ class TruetypeFont { void drawText(const Common::String &text, int x, int y, int width, TextAlign align = ALIGN_LEFT, int max_height = -1); int getLetterHeight(); - void initLoop() {} - void afterLoad() {} - - bool loadBuffer(byte *buffer); bool loadFile(const Common::String &filename); float getLineHeight() const { return _lineHeight; } @@ -121,7 +117,6 @@ class TruetypeFont { private: void measureText(const Common::String &text, int maxWidth, int maxHeight, int &textWidthOut, int &textHeightOut); Graphics::Surface *renderTextToTexture(const Common::String &text, int width, TextAlign align, int maxHeight); - bool initFont(); }; } // End of namespace ZVision From f5f053d335f019a0c26dc8c11730cf0231d9bc60 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 16:40:38 -0500 Subject: [PATCH 0925/1332] ZVISION: Use default dpi for font --- engines/zvision/truetype_font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index b3aafc26d713..dacd7967d33f 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -75,7 +75,7 @@ bool TruetypeFont::loadFile(const Common::String &filename) { return false; } - _font = Graphics::loadTTFFont(file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72). + _font = Graphics::loadTTFFont(file, _fontHeight); _lineHeight = _font->getFontHeight(); return true; From 4a4330cec727fd5e08015479bdec94331b2e7662 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 17:05:35 -0500 Subject: [PATCH 0926/1332] ZVISION: Cleanup the cached frame before loading the next one --- engines/zvision/animation_control.cpp | 25 ++++++++++++++++++++++++- engines/zvision/animation_control.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index 8c8f6eb23844..f80faea0f934 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -40,7 +40,8 @@ AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Com _loopCount(1), _currentLoop(0), _accumulatedTime(0), - _cachedFrame(0) { + _cachedFrame(0), + _cachedFrameNeedsDeletion(false) { if (fileName.hasSuffix(".rlf")) { _fileType = RLF; _animation.rlf = new RlfAnimation(fileName, false); @@ -104,7 +105,13 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + if (_cachedFrameNeedsDeletion) { + _cachedFrame->free(); + delete _cachedFrame; + _cachedFrameNeedsDeletion = false; + } _cachedFrame = tranposedFrame; + _cachedFrameNeedsDeletion = true; } else { // Cleanup tranposedFrame->free(); @@ -115,6 +122,11 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + if (_cachedFrameNeedsDeletion) { + _cachedFrame->free(); + delete _cachedFrame; + _cachedFrameNeedsDeletion = false; + } _cachedFrame->copyFrom(*frame); } } @@ -177,7 +189,13 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + if (_cachedFrameNeedsDeletion) { + _cachedFrame->free(); + delete _cachedFrame; + _cachedFrameNeedsDeletion = false; + } _cachedFrame = tranposedFrame; + _cachedFrameNeedsDeletion = true; } else { // Cleanup tranposedFrame->free(); @@ -188,6 +206,11 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + if (_cachedFrameNeedsDeletion) { + _cachedFrame->free(); + delete _cachedFrame; + _cachedFrameNeedsDeletion = false; + } _cachedFrame->copyFrom(*frame); } } diff --git a/engines/zvision/animation_control.h b/engines/zvision/animation_control.h index 6b104d4c06b6..935f4abb4bc2 100644 --- a/engines/zvision/animation_control.h +++ b/engines/zvision/animation_control.h @@ -65,6 +65,7 @@ class AnimationControl : public Control { uint _currentLoop; Graphics::Surface *_cachedFrame; + bool _cachedFrameNeedsDeletion; public: bool process(uint32 deltaTimeInMillis); From 0874212fa72264404803c3ebc0b75fc63f2be754 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 8 Sep 2013 17:06:06 -0500 Subject: [PATCH 0927/1332] ZVISION: Cleanup _currentFrameBuffer during descruction --- engines/zvision/rlf_animation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 0ffeeb0f0f4e..5ce58e68fd88 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -74,6 +74,7 @@ RlfAnimation::~RlfAnimation() { delete[] _frames[i].encodedData; } delete[] _frames; + _currentFrameBuffer.free(); } bool RlfAnimation::readHeader() { From e12e0eb2ff324c3032f8375162b4275c71f9a9e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Sep 2013 23:00:24 +0200 Subject: [PATCH 0928/1332] AVALANCHE: Rework some more strings, identify some dead code in avalanche.cpp --- engines/avalanche/acci2.cpp | 13 +- engines/avalanche/avalanche.cpp | 225 ++++++++++++-------------------- engines/avalanche/avalanche.h | 35 ++--- engines/avalanche/avalot.cpp | 7 - engines/avalanche/lucerna2.cpp | 14 +- engines/avalanche/timer.cpp | 12 +- 6 files changed, 128 insertions(+), 178 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 34768b4147d4..0db9db7c9f23 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -512,8 +512,9 @@ void Acci::parse() { } Common::String unkString; - if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) - unkString = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; + int16 pos = _vm->_parser->pos(Common::String('\xFE'), _thats); + if (pos > -1) + unkString = _realWords[pos]; else unkString.clear(); @@ -982,10 +983,10 @@ void Acci::putProc() { if (_vm->_gyro->_dna._rottenOnion) _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_gyro->_dna._wineState != 3) - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" - + _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); - else { // Put onion into vinegar! Yes! + if (_vm->_gyro->_dna._wineState != 3) { + Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman); + _vm->_scrolls->displayText(tmpStr); + } else { // Put onion into vinegar! Yes! _vm->_gyro->_dna._onionInVinegar = true; _vm->_lucerna->incScore(7); _vm->_visa->displayScrollChain('u', 9); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d2e9a8de9b2e..3a952192cc43 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -97,7 +97,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _closing = new Closing(this); _graphics->init(); - _scrolls->init(); _lucerna->init(); _acci->init(); @@ -106,7 +105,6 @@ Common::ErrorCode AvalancheEngine::initialize() { return Common::kNoError; } - GUI::Debugger *AvalancheEngine::getDebugger() { return _console; } @@ -115,8 +113,6 @@ Common::Platform AvalancheEngine::getPlatform() const { return _platform; } - - bool AvalancheEngine::hasFeature(EngineFeature f) const { return (f == kSupportsSavingDuringRuntime) || (f == kSupportsLoadingDuringRuntime); } @@ -125,8 +121,6 @@ const char *AvalancheEngine::getCopyrightString() const { return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman."; } - - void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_gyro->_dna._direction); @@ -300,7 +294,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_animation->_sprites[i]._id); sz.syncAsByte(_animation->_sprites[i]._doCheck); - if (sz.isLoading()) { _animation->_sprites[i]._quick = true; _animation->_sprites[i].init(_animation->_sprites[i]._id, _animation->_sprites[i]._doCheck, _animation); @@ -322,7 +315,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_animation->_sprites[i]._callEachStepFl); sz.syncAsByte(_animation->_sprites[i]._eachStepProc); sz.syncAsByte(_animation->_sprites[i]._vanishIfStill); - sz.syncAsSint16LE(_animation->_sprites[i]._x); sz.syncAsSint16LE(_animation->_sprites[i]._y); @@ -377,26 +369,19 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { f->writeSint16LE(t.tm_year); Common::Serializer sz(NULL, f); - synchronize(sz); - f->finalize(); - delete f; return true; } - - Common::String AvalancheEngine::getSaveFileName(const int slot) { Common::String upperName = _targetName; upperName.toUppercase(); return upperName+ Common::String::format("-%02d.SAV", slot); } - - bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! return (!_gyro->_seeScroll); } @@ -433,8 +418,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { char actChar = f->readByte(); description += actChar; } - description.toUppercase(); + description.toUppercase(); ::Graphics::skipThumbnail(*f); // Read the time the game was saved. @@ -444,13 +429,10 @@ bool AvalancheEngine::loadGame(const int16 slot) { t.tm_year = f->readSint16LE(); Common::Serializer sz(f, NULL); - synchronize(sz); - delete f; _gyro->isLoaded = true; - _gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. if (_gyro->_holdTheDawn) { @@ -459,30 +441,22 @@ bool AvalancheEngine::loadGame(const int16 slot) { } _celer->forgetBackgroundSprites(); - _lucerna->minorRedraw(); - _dropdown->setupMenu(); - _gyro->_whereIs[0] = _gyro->_dna._room; - _gyro->_alive = true; - _lucerna->refreshObjectList(); - _animation->updateSpeed(); - _lucerna->drawDirection(); - _gyro->_onToolbar = false; _animation->animLink(); - _celer->updateBackgroundSprites(); - _scrolls->displayText(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" - + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine - + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine - + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); + Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", + Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter, + Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName, Scrolls::kControlNewLine, + Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); + _scrolls->displayText(tmpStr); if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible) _animation->changeDirection(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. @@ -496,29 +470,26 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { }; Common::String month = months[m]; - Common::String day = _gyro->intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) switch (d % 10) { case 1: - day = day + "st"; + day += "st"; break; case 2: - day = day + "nd"; + day += "nd"; break; case 3: - day = day + "rd"; + day += "rd"; break; default: - day = day + "th"; + day += "th"; } return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); } - - void AvalancheEngine::updateEvents() { Common::Event event; @@ -547,76 +518,13 @@ Common::Point AvalancheEngine::getMousePos() { return _eventMan->getMousePos(); } - - - - // From Bootstrp: - const char AvalancheEngine::kRuncodes[2][3] = {"et", "Go"}; - - -// The original ones were all commented out, so porbably there's no need -// of these two cursor functions at all. TODO: Remove later. -void AvalancheEngine::cursorOff() { - warning("STUB: cursorOff()"); -} - -void AvalancheEngine::cursorOn() { - warning("STUB: cursorOn()"); -} - -// Needed later. -void AvalancheEngine::quit() { - cursorOn(); -} - -// Needed in dos_shell(). TODO: Remove later. -Common::String AvalancheEngine::commandCom() { - warning("STUB: commandCom()"); - return ("STUB: commandCom()"); -} - -// Needed for run_avalot()'s errors. TODO: Remove later. -void AvalancheEngine::explain(byte error) { - warning("STUB: explain()"); -} - - - -//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) - -void AvalancheEngine::bFlight() { //interrupt; - _storage._skellern++; -} - void AvalancheEngine::bFlightOn() { _storage._skellern = kReset; // setintvec(0x1c, &b_flight); } - -void AvalancheEngine::bFlightOff() { - // setintvec(0x1c, old_1c); -} - - - -Common::String AvalancheEngine::elmToStr(Elm how) { - switch (how) { - case kNormal: - case kMusical: - return Common::String("jsb"); - case kRegi: - return Common::String("REGI"); - case kElmpoyten: - return Common::String("ELMPOYTEN"); - // Useless, but silent a warning - default: - return Common::String(""); - } -} - void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. @@ -637,54 +545,22 @@ void AvalancheEngine::callMenu() { warning("STUB: callMenu()"); } -void AvalancheEngine::runDemo() { - warning("STUB: runDemo()"); -} - -void AvalancheEngine::dosShell() { - warning("STUB: dosShell()"); -} - -// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. -bool AvalancheEngine::keyPressed() { - warning("STUB: keyPressed()"); - return false; -} - -// Same as keypressed1(). -void AvalancheEngine::flushBuffer() { - warning("STUB: flushBuffer()"); -} - -// Same as keypressed1(). -void AvalancheEngine::demo() { - warning("STUB: demo()"); -} - - - - void AvalancheEngine::runAvalot() { bFlightOn(); _avalot->run(Common::String(kRuncodes[_firstTime]) + _arguments); - // TODO: Check if parameteres are ever used (probably not) and eventually remove them. - // If there's an error initalizing avalot, i'll handle it in there, not here + // TODO: Check if parameters are ever used (probably not) and eventually remove them. + // If there's an error initializing avalot, i'll handle it in there, not here _firstTime = false; } - - Common::Error AvalancheEngine::run() { Common::ErrorCode err = initialize(); if (err != Common::kNoError) return err; - - // From bootstrp: - _firstTime = true; getArguments(); @@ -696,8 +572,6 @@ Common::Error AvalancheEngine::run() { if (!_zoomy) callMenu(); // Not run when zoomy. - - do { runAvalot(); @@ -722,11 +596,84 @@ Common::Error AvalancheEngine::run() { } while (!shouldQuit()); + return Common::kNoError; +} +#if 0 +void AvalancheEngine::bFlightOff() { + // setintvec(0x1c, old_1c); +} - return Common::kNoError; +Common::String AvalancheEngine::elmToStr(Elm how) { + switch (how) { + case kNormal: + case kMusical: + return Common::String("jsb"); + case kRegi: + return Common::String("REGI"); + case kElmpoyten: + return Common::String("ELMPOYTEN"); + // Useless, but silent a warning + default: + return Common::String(""); + } +} + +// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. +bool AvalancheEngine::keyPressed() { + warning("STUB: keyPressed()"); + return false; +} + +// Same as keypressed1(). +void AvalancheEngine::flushBuffer() { + warning("STUB: flushBuffer()"); +} + +// Same as keypressed1(). +void AvalancheEngine::demo() { + warning("STUB: demo()"); +} + +void AvalancheEngine::runDemo() { + warning("STUB: runDemo()"); +} + +void AvalancheEngine::dosShell() { + warning("STUB: dosShell()"); +} + +//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) +void AvalancheEngine::bFlight() { //interrupt; + _storage._skellern++; } +// Needed in dos_shell(). TODO: Remove later. +Common::String AvalancheEngine::commandCom() { + warning("STUB: commandCom()"); + return ("STUB: commandCom()"); +} +// Needed for run_avalot()'s errors. TODO: Remove later. +void AvalancheEngine::explain(byte error) { + warning("STUB: explain()"); +} + +// The original ones were all commented out, so probably there's no need +// of these two cursor functions at all. TODO: Remove later. +void AvalancheEngine::cursorOff() { + warning("STUB: cursorOff()"); +} + +void AvalancheEngine::cursorOn() { + warning("STUB: cursorOn()"); +} + +// Needed later. +void AvalancheEngine::quit() { + cursorOn(); +} + +#endif } // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 998363a242d9..d6327521b6cb 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -141,33 +141,38 @@ class AvalancheEngine : public Engine { byte _contents[1000]; } _storage; - Common::String _arguments, _demoArgs, _argsWithNoFilename; + Common::String _arguments; bool _firstTime; - byte _originalMode; - byte *_old1c; - Common::String _segofs; bool _zoomy; - int32 _soundcard, _speed, _baseaddr, _irq, _dma; - void cursorOff(); - void cursorOn(); - void quit(); - Common::String commandCom(); - void explain(byte error); - void bFlight(); void bFlightOn(); - void bFlightOff(); - Common::String elmToStr(Elm how); void run(Common::String what, bool withJsb, bool withBflight, Elm how); void getArguments(); void getSlope(); void callMenu(); void runAvalot(); - void runDemo(); - void dosShell(); + +#if 0 + Common::String _demoArgs, _argsWithNoFilename; + byte _originalMode; + byte *_old1c; + Common::String _segofs; + int32 _soundcard, _speed, _baseaddr, _irq, _dma; + + void bFlightOff(); + Common::String elmToStr(Elm how); bool keyPressed(); void flushBuffer(); void demo(); + void runDemo(); + void dosShell(); + void bFlight(); + Common::String commandCom(); + void explain(byte error); + void cursorOff(); + void cursorOn(); + void quit(); +#endif }; } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 99c3950ef155..287f8443b390 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -185,8 +185,6 @@ void Avalot::setup() { } } - - void Avalot::run(Common::String arg) { setup(); @@ -195,8 +193,6 @@ void Avalot::run(Common::String arg) { _vm->updateEvents(); // The event handler. - - _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); @@ -205,8 +201,6 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->checkClick(); _vm->_timer->updateTimer(); - - #ifdef DEBUG // ONLY FOR TESTING!!! for (byte i = 0; i < _vm->_gyro->_lineNum; i++) @@ -219,7 +213,6 @@ void Avalot::run(Common::String arg) { // ONLY FOR TESTING!!! #endif - _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. uint32 delay = _vm->_system->getMillis() - beginLoop; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a10c5e14ee42..041236c73b11 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -217,7 +217,7 @@ void Lucerna::loadAlso(byte num) { } } Common::String filename; - filename = filename.format("also%d.avd", num); + filename = Common::String::format("also%d.avd", num); if (!file.open(filename)) { warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); return; @@ -226,12 +226,14 @@ void Lucerna::loadAlso(byte num) { file.seek(128); byte alsoNum = file.readByte(); + Common::String tmpStr; for (byte i = 0; i <= alsoNum; i++) { for (byte j = 0; j < 2; j++) { _vm->_gyro->_also[i][j] = new Common::String; *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } - *_vm->_gyro->_also[i][0] = Common::String('\x9D') + *_vm->_gyro->_also[i][0] + Common::String('\x9D'); + tmpStr = Common::String::format("\x9D%s\x9D", *_vm->_gyro->_also[i][0]); + *_vm->_gyro->_also[i][0] = tmpStr; } memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); @@ -284,8 +286,10 @@ void Lucerna::loadAlso(byte num) { file.close(); unScramble(); - for (byte i = 0; i <= alsoNum; i++) - *_vm->_gyro->_also[i][0] = Common::String(',') + *_vm->_gyro->_also[i][0] + ','; + for (byte i = 0; i <= alsoNum; i++) { + tmpStr = Common::String::format(",%s,", *_vm->_gyro->_also[i][0]); + *_vm->_gyro->_also[i][0] = tmpStr; + } } void Lucerna::loadRoom(byte num) { @@ -1150,7 +1154,7 @@ void Lucerna::checkClick() { } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; + _vm->_gyro->_mouseText.insertChar(Scrolls::kControlNewLine, 0); } else if (!_vm->_gyro->_dropsOk) _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index eaa2211224fc..cb6f10ad123b 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -652,12 +652,12 @@ void Timer::avalotFalls() { _vm->_animation->_sprites[0]._stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { - Common::String toDisplay; - for (byte i = 0; i < 6; i++) - toDisplay += _vm->_scrolls->kControlNewLine; - for (byte i = 0; i < 6; i++) - toDisplay += _vm->_scrolls->kControlInsertSpaces; - toDisplay += _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; + Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", + Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, + Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, + Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, + Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, + Scrolls::kControlRegister, Scrolls::kControlIcon); _vm->_scrolls->displayText(toDisplay); } } From 1ca62e51b9a66711fd1b266bed1432509c489f8f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Sep 2013 23:16:48 +0200 Subject: [PATCH 0929/1332] AVALANCHE: refactor the way ControlCharacter enum is accessed --- engines/avalanche/acci2.cpp | 102 ++++++++++++++++++------------------ engines/avalanche/timer.cpp | 2 +- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0db9db7c9f23..59a8ed8c37e3 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -750,23 +750,23 @@ void Acci::examine() { void Acci::inventory() { byte itemNum = 0; - _vm->_scrolls->displayText(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String("You're carrying ") + Scrolls::kControlToBuffer); for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { itemNum++; if (itemNum == _vm->_gyro->_dna._carryNum) - _vm->_scrolls->displayText(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String("and ") + Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + Scrolls::kControlToBuffer); if ((i + 1) == _vm->_gyro->_dna._wearing) - _vm->_scrolls->displayText(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", which you're wearing") + Scrolls::kControlToBuffer); if (itemNum < _vm->_gyro->_dna._carryNum) - _vm->_scrolls->displayText(Common::String(", ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", ") + Scrolls::kControlToBuffer); } } if (_vm->_gyro->_dna._wearing == kNothing) - _vm->_scrolls->displayText(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + _vm->_scrolls->displayText(Common::String("...") + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "...and you're stark naked!"); else _vm->_scrolls->displayText("."); } @@ -842,18 +842,18 @@ void Acci::peopleInRoom() { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { actPerson++; if (actPerson == 1) // First on the list. - _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); else if (actPerson < numPeople) // The middle... - _vm->_scrolls->displayText(Common::String(", ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(", ") + _vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); else // The end. - _vm->_scrolls->displayText(Common::String(" and ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" and ") + _vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); } } if (numPeople == 1) - _vm->_scrolls->displayText(Common::String(" is") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" is") + Scrolls::kControlToBuffer); else - _vm->_scrolls->displayText(Common::String(" are") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(" are") + Scrolls::kControlToBuffer); _vm->_scrolls->displayText(" here."); // End and display it. } @@ -1015,9 +1015,10 @@ void Acci::putProc() { _vm->_scrolls->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_gyro->_dna._wearing == _thing) - _vm->_scrolls->displayText(Common::String("You'd better take ") + _vm->_gyro->getItem(_thing) + " off first!"); - else { + if (_vm->_gyro->_dna._wearing == _thing) { + Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); + _vm->_scrolls->displayText(tmpStr); + } else { openBox(true); // Open box. _vm->_gyro->_dna._boxContent = _thing; @@ -1043,9 +1044,10 @@ void Acci::putProc() { * @remarks Originally called 'not_in_order' */ void Acci::notInOrder() { - _vm->_scrolls->displayText(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ") - + _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]) - + _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ + "What I need next is %s%c2%c", _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]), + Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); } /** @@ -1180,8 +1182,6 @@ void Acci::standUp() { } } - - void Acci::getProc(char thing) { switch (_vm->_gyro->_dna._room) { case r__yours: @@ -1193,8 +1193,10 @@ void Acci::getProc(char thing) { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); - } else - _vm->_scrolls->displayText(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box."); + } else { + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing)); + _vm->_scrolls->displayText(tmpStr); + } } else _vm->_visa->displayScrollChain('q', 57); break; @@ -1248,7 +1250,7 @@ void Acci::getProc(char thing) { */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->_dna._room != r__lustiesroom) { - _vm->_scrolls->displayText(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Not yet. Try later!") + Scrolls::kControlRegister + '2' + Scrolls::kControlSpeechBubble); return; } _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; @@ -1284,7 +1286,7 @@ void Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! + _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + '1' + Scrolls::kControlToBuffer); // Avvy himself! return; } @@ -1292,7 +1294,7 @@ void Acci::personSpeaks() { for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + byte(i + 49) + Scrolls::kControlToBuffer); found = true; } } @@ -1300,13 +1302,13 @@ void Acci::personSpeaks() { if (!found) { for (byte i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + byte(i + 65) + Scrolls::kControlToBuffer); } } } void Acci::heyThanks() { personSpeaks(); - _vm->_scrolls->displayText(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); + _vm->_scrolls->displayText(Common::String("Hey, thanks!") + Scrolls::kControlSpeechBubble + "(But now, you've lost it!)"); _vm->_gyro->_dna._objects[_thing - 1] = false; } @@ -1351,7 +1353,7 @@ void Acci::doThat() { openDoor(); break; case kVerbCodePause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - _vm->_scrolls->displayText(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + _vm->_scrolls->displayText(Common::String("Game paused.") + Scrolls::kControlCenter + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue."); break; case kVerbCodeGet: @@ -1377,7 +1379,7 @@ void Acci::doThat() { case kVerbCodeTalk: if (_person == kPardon) { if (_vm->_gyro->_subjectNum == 99) // They typed "say password". - _vm->_scrolls->displayText(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?"); + _vm->_scrolls->displayText(Common::String("Yes, but what ") + Scrolls::kControlItalic + "is" + Scrolls::kControlRoman + " the password?"); else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); @@ -1525,7 +1527,7 @@ void Acci::doThat() { } if (!_polite) _vm->_scrolls->displayText("How about a `please\", Avvy?"); - else if (_vm->_scrolls->displayQuestion(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?")) + else if (_vm->_scrolls->displayQuestion(Common::String(Scrolls::kControlRegister) + 'C' + Scrolls::kControlIcon + "Do you really want to quit?")) _vm->_gyro->_letMeOut = true; break; case kVerbCodeGo: @@ -1536,12 +1538,12 @@ void Acci::doThat() { Common::String toDisplay; for (byte i = 0; i < 7; i++) - toDisplay += _vm->_scrolls->kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine - + "The medi\x91val descendant of" + _vm->_scrolls->kControlNewLine - + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \xEF " - + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; + toDisplay += Scrolls::kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Scrolls::kControlCenter + Scrolls::kControlNewLine + + "The medi\x91val descendant of" + Scrolls::kControlNewLine + + "Denarius Avaricius Sextus" + Scrolls::kControlNewLine + Scrolls::kControlNewLine + + "version " + _vm->_gyro->kVersionNum + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Copyright \xEF " + + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Scrolls::kControlRegister + 'Y' + Scrolls::kControlIcon; _vm->_scrolls->displayText(toDisplay); _vm->_scrolls->_aboutScroll = false; } @@ -1631,7 +1633,7 @@ void Acci::doThat() { // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); } break; case r__musicroom: @@ -1697,11 +1699,11 @@ void Acci::doThat() { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, _vm->_timer->kProcUrinate, _vm->_timer->kReasonGoToToilet); } else - _vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY" - + _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!"); + _vm->_scrolls->displayText(Common::String("It would be ") + Scrolls::kControlItalic + "VERY" + + Scrolls::kControlRoman + " unwise to do that here, Avvy!"); break; case kVerbCodeCheat: - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled."); + _vm->_scrolls->displayText(Common::String(Scrolls::kControlItalic) + "Cheat mode now enabled."); _vm->_gyro->_cheat = true; break; case kVerbCodeMagic: @@ -1732,16 +1734,16 @@ void Acci::doThat() { switch (_vm->_gyro->_dna._sworeNum) { case 0: _vm->_scrolls->displayText(Common::String("Avvy! Do you mind? There might be kids playing!") - + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(I shouldn't say it again, if I were you!)"); + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "(I shouldn't say it again, if I were you!)"); break; case 1: _vm->_scrolls->displayText(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?") - + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Don't do it again!"); + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Don't do it again!"); break; default: _vm->_pingo->zonk(); _vm->_scrolls->displayText(Common::String("A crack of lightning shoots from the sky, and fries you.") - + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); _vm->_lucerna->gameOver(); } _vm->_gyro->_dna._sworeNum++; @@ -1777,7 +1779,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); _vm->_gyro->_dna._drinking = _thing; _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -1802,7 +1804,7 @@ void Acci::doThat() { } _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_scrolls->displayText(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Wine, please.") + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -1985,8 +1987,8 @@ void Acci::doThat() { _vm->_scrolls->displayText("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: - _vm->_scrolls->displayText(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' + - _vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); + _vm->_scrolls->displayText(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + Scrolls::kControlRegister + '1' + + Scrolls::kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); break; default: _vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!"); @@ -2004,7 +2006,7 @@ void Acci::doThat() { _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); - _vm->_scrolls->displayText(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened..."); + _vm->_scrolls->displayText(Common::String("A few hours later...") + Scrolls::kControlParagraph + "nothing much has happened..."); } break; case kVerbCodeRestart: @@ -2019,14 +2021,14 @@ void Acci::doThat() { break; case kVerbCodeHello: personSpeaks(); - _vm->_scrolls->displayText(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("Hello.") + Scrolls::kControlSpeechBubble); break; case kVerbCodeThanks: personSpeaks(); - _vm->_scrolls->displayText(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble); + _vm->_scrolls->displayText(Common::String("That's OK.") + Scrolls::kControlSpeechBubble); break; default: - _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlBell) + "Parser bug!"); + _vm->_scrolls->displayText(Common::String(Scrolls::kControlBell) + "Parser bug!"); } } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index cb6f10ad123b..973b1d32107c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -362,7 +362,7 @@ void Timer::afterTheShootemup() { // Same as the added line above: TODO: Remove it later!!! _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") - + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)"); + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); #if 0 byte shootscore, gain; From bc64dcf276f15fe9bd808d087762e100fb7d931d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Sep 2013 23:34:12 +0200 Subject: [PATCH 0930/1332] AVALANCHE: harmonize the use of constants for kMagic, kProc, kObject, kPeople --- engines/avalanche/acci2.cpp | 98 ++++++++--------- engines/avalanche/animation.cpp | 182 ++++++++++++++++---------------- engines/avalanche/avalanche.cpp | 9 +- engines/avalanche/avalanche.h | 9 +- engines/avalanche/avalot.cpp | 4 +- engines/avalanche/dropdown2.cpp | 6 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/lucerna2.cpp | 64 +++++------ engines/avalanche/scrolls2.cpp | 2 +- engines/avalanche/sequence2.cpp | 4 +- engines/avalanche/timer.cpp | 24 ++--- engines/avalanche/visa2.cpp | 12 +-- 12 files changed, 208 insertions(+), 208 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 59a8ed8c37e3..cec9c422f969 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -378,7 +378,7 @@ void Acci::storeInterrogation(byte interrogation) { while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) _vm->_parser->_inputText.deleteLastChar(); - _vm->_timer->loseTimer(_vm->_timer->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. + _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { case 1: @@ -408,7 +408,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_visa->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; break; case 99: @@ -783,7 +783,7 @@ void Acci::swallow() { // Eat something. _vm->_visa->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_visa->displayScrollChain('U', 2); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; @@ -814,7 +814,7 @@ void Acci::swallow() { // Eat something. _vm->_visa->displayScrollChain('U', 11); else { _vm->_visa->displayScrollChain('U', 8); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } break; @@ -979,7 +979,7 @@ void Acci::putProc() { // Thing is the _thing which you're putting in. _thing2 is where you're putting it. switch (_thing2) { case Gyro::kObjectWine: - if (_thing == _vm->_gyro->kObjectOnion) { + if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_dna._rottenOnion) _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? @@ -1056,7 +1056,7 @@ void Acci::notInOrder() { */ void Acci::goToCauldron() { _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludwickWalk); + _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); _vm->_animation->_sprites[1].walkTo(2); } @@ -1072,7 +1072,7 @@ bool Acci::giveToSpludwick() { switch (_thing) { case Gyro::kObjectOnion: - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = false; if (_vm->_gyro->_dna._rottenOnion) _vm->_visa->displayScrollChain('q', 22); else { @@ -1084,7 +1084,7 @@ bool Acci::giveToSpludwick() { _vm->_lucerna->refreshObjectList(); break; case Gyro::kObjectInk: - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._givenToSpludwick++; _vm->_visa->displayScrollChain('q', 24); @@ -1092,12 +1092,12 @@ bool Acci::giveToSpludwick() { _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectMushroom - 1] = false; _vm->_visa->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_dna._givenToSpludwick++; goToCauldron(); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = true; _vm->_lucerna->refreshObjectList(); break; default: @@ -1110,7 +1110,7 @@ bool Acci::giveToSpludwick() { void Acci::drink() { _vm->_gyro->_dna._alcoholLevel += 1; if (_vm->_gyro->_dna._alcoholLevel == 5) { - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1] = true; // Get the key. + _vm->_gyro->_dna._objects[Gyro::kObjectKey - 1] = true; // Get the key. _vm->_gyro->_dna._teetotal = true; _vm->_gyro->_dna._avvyIsAwake = false; _vm->_gyro->_dna._avvyInBed = true; @@ -1158,7 +1158,7 @@ void Acci::standUp() { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; - _vm->_timer->loseTimer(_vm->_timer->kReasonArkataShouts); + _vm->_timer->loseTimer(Timer::kReasonArkataShouts); } else already(); break; @@ -1211,7 +1211,7 @@ void Acci::getProc(char thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. _vm->_animation->callSpecial(3); // Zap! _vm->_gyro->_dna._takenPen = true; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_scrolls->displayText("Taken."); } @@ -1228,12 +1228,12 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { + if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_dna._mushroomGrowing = false; _vm->_gyro->_dna._takenMushroom = true; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectMushroom - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else @@ -1253,11 +1253,11 @@ void Acci::giveGeidaTheLute() { _vm->_scrolls->displayText(Common::String("Not yet. Try later!") + Scrolls::kControlRegister + '2' + Scrolls::kControlSpeechBubble); return; } - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_visa->displayScrollChain('q', 64); // She plays it. - _vm->_timer->addTimer(1, _vm->_timer->kProcGiveLuteToGeida, _vm->_timer->kReasonGeidaSings); + _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); _vm->_enid->backToBootstrap(4); } @@ -1274,7 +1274,7 @@ void Acci::winSequence() { _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); _vm->_sequence->startToClose(); - _vm->_timer->addTimer(30, _vm->_timer->kProcWinning, _vm->_timer->kReasonWinning); + _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); } void Acci::personSpeaks() { @@ -1418,14 +1418,14 @@ void Acci::doThat() { default: switch (_person) { case Gyro::kPeopleCrapulus: - if (_thing == _vm->_gyro->kObjectWine) { + if (_thing == Gyro::kObjectWine) { _vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; } else heyThanks(); break; case Gyro::kPeopleCwytalot: - if ((_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt)) + if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) _vm->_scrolls->displayText(Common::String("You might be able to influence Cwytalot more if you used it!")); else heyThanks(); @@ -1435,11 +1435,11 @@ void Acci::doThat() { heyThanks(); break; case Gyro::kPeopleIbythneth: - if (_thing == _vm->_gyro->kObjectBadge) { + if (_thing == Gyro::kObjectBadge) { _vm->_visa->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = false; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectHabit - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectBadge - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectHabit - 1] = true; _vm->_gyro->_dna._givenBadgeToIby = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); @@ -1448,10 +1448,10 @@ void Acci::doThat() { break; case Gyro::kPeopleAyles: if (_vm->_gyro->_dna._aylesIsAwake) { - if (_thing == _vm->_gyro->kObjectPen) { - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = false; + if (_thing == Gyro::kObjectPen) { + _vm->_gyro->_dna._objects[Gyro::kObjectPen - 1] = false; _vm->_visa->displayScrollChain('q', 54); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectInk - 1] = true; _vm->_gyro->_dna._givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(2); @@ -1463,7 +1463,7 @@ void Acci::doThat() { case Gyro::kPeopleGeida: switch (_thing) { case Gyro::kObjectPotion: - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = false; _vm->_visa->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_dna._givenPotionToGeida = true; @@ -1579,7 +1579,7 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); byte i; - if (_thing == _vm->_gyro->kObjectHabit) + if (_thing == Gyro::kObjectHabit) i = 3; else i = 0; @@ -1622,7 +1622,7 @@ void Acci::doThat() { // You won - strange! _vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wonNim = true; _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. @@ -1645,10 +1645,10 @@ void Acci::doThat() { case Gyro::kObjectLute : _vm->_visa->displayScrollChain('U', 7); - if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] == _vm->_gyro->_dna._room) + if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_dna._room) _vm->_visa->displayScrollChain('U', 10); - if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleDuLustie - 150] == _vm->_gyro->_dna._room) + if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_dna._room) _vm->_visa->displayScrollChain('U', 15); break; case 52: @@ -1671,7 +1671,7 @@ void Acci::doThat() { break; case kVerbCodeRing: if (isHolding()) { - if (_thing == _vm->_gyro->kObjectBell) { + if (_thing == Gyro::kObjectBell) { _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph @@ -1697,7 +1697,7 @@ void Acci::doThat() { case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); - _vm->_timer->addTimer(4, _vm->_timer->kProcUrinate, _vm->_timer->kReasonGoToToilet); + _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else _vm->_scrolls->displayText(Common::String("It would be ") + Scrolls::kControlItalic + "VERY" + Scrolls::kControlRoman + " unwise to do that here, Avvy!"); @@ -1721,7 +1721,7 @@ void Acci::doThat() { _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; - _vm->_timer->addTimer(177, _vm->_timer->kProcAvariciusTalks, _vm->_timer->kReasonAvariciusTalks); + _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else _vm->_scrolls->displayText("Nothing appears to happen..."); @@ -1784,13 +1784,13 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timer->addTimer(27, _vm->_timer->kProcBuyDrinks, _vm->_timer->kReasonDrinks); + _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: - if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) // We've already got the wine! + if (_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]) // We've already got the wine! _vm->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. @@ -1810,7 +1810,7 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->_dna._malagauche = 177; - _vm->_timer->addTimer(27, _vm->_timer->kProcBuyWine, _vm->_timer->kReasonDrinks); + _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); } break; } @@ -1820,8 +1820,8 @@ void Acci::doThat() { case r__outsideducks: if (_vm->_animation->inField(6)) { - if (_thing == _vm->_gyro->kObjectOnion) { - if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) + if (_thing == Gyro::kObjectOnion) { + if (_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]) _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); @@ -1833,7 +1833,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._boughtOnion = true; _vm->_gyro->_dna._rottenOnion = false; // It's OK when it leaves the stall! @@ -1854,9 +1854,9 @@ void Acci::doThat() { break; case kVerbCodeAttack: if ((_vm->_gyro->_dna._room == r__brummieroad) && - ((_person == 157) || (_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt)) + ((_person == 157) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_dna._room)) { - switch (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] * 2) { + switch (_vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->displayScrollChain('Q', 10); @@ -1871,10 +1871,10 @@ void Acci::doThat() { case 3: _vm->_visa->displayScrollChain('Q', 11); _vm->_gyro->_dna._cwytalotGone = true; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = false; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; _vm->_lucerna->incScore(7); _vm->_animation->_sprites[1].walkTo(2); _vm->_animation->_sprites[1]._vanishIfStill = true; @@ -1907,7 +1907,7 @@ void Acci::doThat() { else { _vm->_lucerna->incScore(4); _vm->_scrolls->displayText("The drawbridge opens!"); - _vm->_timer->addTimer(7, _vm->_timer->kProcOpenDrawbridge, _vm->_timer->kReasonDrawbridgeFalls); + _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); _vm->_gyro->_dna._drawbridgeOpen = 1; } } else @@ -1959,7 +1959,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: - _vm->_timer->addTimer(1, _vm->_timer->kProcJump, _vm->_timer->kReasonJumping); + _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); _vm->_gyro->_dna._userMovesAvvy = false; break; case kVerbCodeHiscores: @@ -2000,7 +2000,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down. - _vm->_timer->addTimer(1, _vm->_timer->kProcAvvySitDown, _vm->_timer->kReasonSittingDown); + _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. _vm->_lucerna->dusk(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 9e73ea73c02e..747f014dfb1e 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -470,66 +470,66 @@ void Animation::catacombMove(byte ped) { switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; case 0x1: // no connection (wall + shield), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x2: // wall with door - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. break; case 0x3: // wall with door and shield - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x5: // wall with door and window - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // No door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[2]._operation = Gyro::kMagicSpecial; // Straight wall. break; } @@ -537,52 +537,52 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; case 0x1: // no connection (wall + window), - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x2: // wall with door - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. break; case 0x3: // wall with door and window - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // No door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicSpecial; // Straight wall. + _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. break; } @@ -590,39 +590,39 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; + _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; + _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x1: _vm->_celer->drawBackgroundSprite(-1, -1, 22); if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicExclaim; + _vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; else - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicSpecial; // Right exit south. + _vm->_gyro->_magics[12]._operation = Gyro::kMagicSpecial; // Right exit south. - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; + _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; break; case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicSpecial; // Middle exit south. - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. + _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; + _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x3: _vm->_celer->drawBackgroundSprite(-1, -1, 24); - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicSpecial; // Left exit south. - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. + _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; + _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; + _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. break; // LEFT handles: #if 0 @@ -634,8 +634,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x2: _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; #if 0 case 0x3: @@ -652,8 +652,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x5: _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; #if 0 case 0x6: @@ -673,26 +673,26 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_celer->drawBackgroundSprite(-1, -1, 32); - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicSpecial; // Middle arch north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. + _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. } break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; + _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; case 0xe: // No connection + TORCH - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; + _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; // Recessed door: case 0xf: - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicNothing; // Door to Geida's room. + _vm->_gyro->_magics[0]._operation = Gyro::kMagicNothing; // Door to Geida's room. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; } @@ -741,7 +741,7 @@ void Animation::catacombMove(byte ped) { // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Animation::dawnDelay() { - _vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay); + _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); } void Animation::callSpecial(uint16 which) { @@ -749,17 +749,17 @@ void Animation::callSpecial(uint16 which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_dna._brummieStairs = 1; - _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - _vm->_timer->addTimer(10, _vm->_timer->kProcStairs, _vm->_timer->kReasonBrummieStairs); + _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; + _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); _vm->_gyro->_dna._userMovesAvvy = false; break; case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. _vm->_gyro->_dna._brummieStairs = 3; - _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicNothing; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicExclaim; + _vm->_gyro->_magics[10]._operation = Gyro::kMagicNothing; + _vm->_gyro->_magics[11]._operation = Gyro::kMagicExclaim; _vm->_gyro->_magics[11]._data = 5; - _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! + _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! stopWalking(); _vm->_visa->displayScrollChain('q', 26); _vm->_gyro->_dna._userMovesAvvy = true; @@ -784,13 +784,13 @@ void Animation::callSpecial(uint16 which) { case 4: // This is the ghost room link. _vm->_lucerna->dusk(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap - _vm->_timer->addTimer(1, _vm->_timer->kProcGhostRoomPhew, _vm->_timer->kReasonGhostRoomPhew); + _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); _vm->_enid->backToBootstrap(3); break; case 5: if (_vm->_gyro->_dna._friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. + _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. _vm->_visa->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; @@ -801,8 +801,8 @@ void Animation::callSpecial(uint16 which) { _sprites[1].walkTo(3); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. - _vm->_timer->addTimer(364, _vm->_timer->kProcHangAround, _vm->_timer->kReasonHangingAround); + _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 177; // Not here, then. + _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; case 6: // _vm->_gyro->special 6: fall down oubliette. @@ -810,17 +810,17 @@ void Animation::callSpecial(uint16 which) { _sprites[0]._moveX = 3; _sprites[0]._moveY = 0; _sprites[0]._facingDir = kDirRight; - _vm->_timer->addTimer(1, _vm->_timer->kProcFallDownOubliette, _vm->_timer->kReasonFallingDownOubliette); + _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); break; case 7: // _vm->_gyro->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; stopWalking(); - _vm->_timer->loseTimer(_vm->_timer->kReasonFallingDownOubliette); + _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timer->addTimer(200, _vm->_timer->kProcMeetAvaroid, _vm->_timer->kReasonMeetingAvaroid); + _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { @@ -838,12 +838,12 @@ void Animation::callSpecial(uint16 which) { _sprites[1].walkTo(4); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_timer->addTimer(40, _vm->_timer->kProcRobinHoodAndGeida, _vm->_timer->kReasonRobinHoodAndGeida); + _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { // Into Geida's room. - if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1]) + if (_vm->_gyro->_dna._objects[Gyro::kObjectKey - 1]) _vm->_visa->displayScrollChain('q', 62); else { _vm->_visa->displayScrollChain('q', 61); @@ -1083,7 +1083,7 @@ void Animation::arrowProcs(byte tripnum) { _vm->_lucerna->gameOver(); _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. - _vm->_timer->addTimer(55, _vm->_timer->kProcNaughtyDuke, _vm->_timer->kReasonNaughtyDuke); + _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3a952192cc43..cdd6b7c3ab4e 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -525,10 +525,6 @@ void AvalancheEngine::bFlightOn() { _storage._skellern = kReset; // setintvec(0x1c, &b_flight); } -void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { - warning("STUB: run(%s)", what.c_str()); - // Probably there'll be no need of this function, as all *.AVX-es will become classes. -} void AvalancheEngine::getArguments() { // This function should mess around with command line arguments, @@ -600,6 +596,11 @@ Common::Error AvalancheEngine::run() { } #if 0 +void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { + warning("STUB: run(%s)", what.c_str()); + // Probably there'll be no need of this function, as all *.AVX-es will become classes. +} + void AvalancheEngine::bFlightOff() { // setintvec(0x1c, old_1c); } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index d6327521b6cb..69c157fdbbab 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -126,10 +126,6 @@ class AvalancheEngine : public Engine { AvalancheConsole *_console; Common::Platform _platform; - // From bootstrp: - - enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; - static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; static const char kRuncodes[2][3]; static const int16 kReset = 0; @@ -146,19 +142,22 @@ class AvalancheEngine : public Engine { bool _zoomy; void bFlightOn(); - void run(Common::String what, bool withJsb, bool withBflight, Elm how); void getArguments(); void getSlope(); void callMenu(); void runAvalot(); #if 0 + // From bootstrp: + enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; + Common::String _demoArgs, _argsWithNoFilename; byte _originalMode; byte *_old1c; Common::String _segofs; int32 _soundcard, _speed, _baseaddr, _irq, _dma; + void run(Common::String what, bool withJsb, bool withBflight, Elm how); void bFlightOff(); Common::String elmToStr(Elm how); bool keyPressed(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 287f8443b390..af0079099d89 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -170,7 +170,7 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _vm->_gyro->_thinks = 2; // You always have money. - _vm->_lucerna->thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); + _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); _vm->loadGame(loadSlot); } else { @@ -179,7 +179,7 @@ void Avalot::setup() { _vm->_gyro->_soundFx = ! _vm->_gyro->_soundFx; _vm->_lucerna->fxToggle(); - _vm->_lucerna->thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); + _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); _vm->_visa->displayScrollChain('q', 83); // Info on the game, etc. } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 12af639ab7f0..0a5fe9f4d3cf 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -503,7 +503,7 @@ void Dropdown::setupMenuWith() { // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_gyro->_lastPerson == _vm->_gyro->kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) + if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_dna._room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { @@ -528,7 +528,7 @@ void Dropdown::setupMenuWith() { break; case Gyro::kPeopleMalagauche: { bool isSober = !_vm->_gyro->_dna._teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]); + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); @@ -537,7 +537,7 @@ void Dropdown::setupMenuWith() { } break; case Gyro::kPeopleTrader: { - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]); + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; } break; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index f6e22dfc59e0..a59db04a9fae 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -274,7 +274,7 @@ void Enid::ednaReload() { _vm->_lucerna->majorRedraw(); - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; + _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_dna._room; _vm->_gyro->_alive = true; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 041236c73b11..ccb85b49c000 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -349,21 +349,21 @@ void Lucerna::exitRoom(byte x) { switch (x) { case r__spludwicks: - _vm->_timer->loseTimer(_vm->_timer->kReasonAvariciusTalks); + _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); _vm->_gyro->_dna._avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: if (_vm->_gyro->_dna._drawbridgeOpen > 0) { _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. - _vm->_timer->loseTimer(_vm->_timer->kReasonDrawbridgeFalls); + _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); } break; case r__outsidecardiffcastle: - _vm->_timer->loseTimer(_vm->_timer->kReasonCardiffsurvey); + _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); break; case r__robins: - _vm->_timer->loseTimer(_vm->_timer->kReasonGettingTiedUp); + _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); break; } @@ -398,14 +398,14 @@ void Lucerna::enterNewTown() { _vm->_gyro->_dna._spludwickAtHome = true; _vm->_gyro->_dna._crapulusWillTell = false; } - if (_vm->_gyro->_dna._boxContent == _vm->_gyro->kObjectWine) + if (_vm->_gyro->_dna._boxContent == Gyro::kObjectWine) _vm->_gyro->_dna._wineState = 3; // Vinegar } break; } if (_vm->_gyro->_dna._room != r__outsideducks) { - if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) && !(_vm->_gyro->_dna._onionInVinegar)) + if ((_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_dna._onionInVinegar)) _vm->_gyro->_dna._rottenOnion = true; // You're holding the onion } } @@ -434,10 +434,10 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((_vm->_gyro->_dna._roomCount[room] == 0) && (! _vm->_gyro->setFlag('S'))) incScore(1); - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleAvalot - 150] = _vm->_gyro->_dna._room; + _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_dna._room; if (_vm->_gyro->_dna._geidaFollows) - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleGeida - 150] = room; + _vm->_gyro->_whereIs[Gyro::kPeopleGeida - 150] = room; _vm->_gyro->_roomTime = 0; @@ -451,7 +451,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); - _vm->_timer->addTimer(100, _vm->_timer->kProcArkataShouts, _vm->_timer->kReasonArkataShouts); + _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } break; @@ -459,7 +459,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { if (! _vm->_gyro->_dna._talkedToCrapulus) { - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours; + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__outsideyours; _vm->_animation->_sprites[1].init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { @@ -473,13 +473,13 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. - } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; + } else _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; if (_vm->_gyro->_dna._crapulusWillTell) { _vm->_animation->_sprites[1].init(8, false, _vm->_animation); _vm->_animation->appearPed(2, 2); _vm->_animation->_sprites[1].walkTo(4); - _vm->_timer->addTimer(20, _vm->_timer->kProcCrapulusSpludOut, _vm->_timer->kReasonCrapulusSaysSpludwickOut); + _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_dna._crapulusWillTell = false; } } @@ -487,7 +487,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timer->addTimer(20, _vm->_timer->kProcBang, _vm->_timer->kReasonExplosion); + _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); _vm->_gyro->_dna._spludwickAtHome = true; } break; @@ -512,14 +512,14 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._geidaFollows) putGeidaAt(5, ped); if (_vm->_gyro->_dna._cwytalotGone) { - _vm->_gyro->_magics[kColorLightred - 1]._operation = _vm->_gyro->kMagicNothing; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; + _vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... @@ -542,7 +542,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timer->addTimer(20, _vm->_timer->kProcCwytalotInHerts, _vm->_timer->kReasonCwytalotInHerts); + _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); } break; @@ -550,7 +550,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_dna._drawbridgeOpen == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); - _vm->_gyro->_magics[kColorGreen - 1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. + _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. } if (_vm->_gyro->_dna._geidaFollows) putGeidaAt(ped + 3, ped); // load Geida @@ -563,13 +563,13 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->_sprites[1].init(6, false, _vm->_animation); _vm->_animation->appearPed(2, 2); _vm->_animation->_sprites[1].walkTo(3); - _vm->_timer->addTimer(36, _vm->_timer->kProcGetTiedUp, _vm->_timer->kReasonGettingTiedUp); + _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } } if (_vm->_gyro->_dna._beenTiedUp) { - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = 0; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 0; + _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = 0; + _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 0; } if (_vm->_gyro->_dna._tiedUp) @@ -587,17 +587,17 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->_sprites[1].init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 2); _vm->_animation->_sprites[1].walkTo(3); - _vm->_timer->addTimer(47, _vm->_timer->kProcCardiffSurvey, _vm->_timer->kReasonCardiffsurvey); + _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); } break; case 5 : - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. _vm->_animation->_sprites[1].init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 3); _vm->_animation->_sprites[1]._facingDir = Animation::kDirRight; - _vm->_timer->addTimer(3, _vm->_timer->kProcCardiffReturn, _vm->_timer->kReasonCardiffsurvey); + _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } } if (_vm->_gyro->_dna._cardiffQuestionNum < 5) @@ -614,9 +614,9 @@ void Lucerna::enterRoom(byte room, byte ped) { //setactivepage(1 - cp); { - if ((_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { + if ((_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false; + _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } } @@ -665,10 +665,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes - _vm->_timer->addTimer(3, _vm->_timer->kProcCallsGuards, _vm->_timer->kReasonDuLustieTalks); + _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timer->addTimer(3, _vm->_timer->kProcGreetsMonk, _vm->_timer->kReasonDuLustieTalks); + _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); if (_vm->_gyro->_dna._geidaFollows) { putGeidaAt(5, ped); @@ -685,8 +685,8 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->_magics[kColorBrown - 1]._operation = _vm->_gyro->kMagicNothing; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleJacques - 150] = 0; + _vm->_gyro->_magics[kColorBrown - 1]._operation = Gyro::kMagicNothing; + _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; } if (ped != 0) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); @@ -1022,7 +1022,7 @@ void Lucerna::fxToggle() { void Lucerna::refreshObjectList() { _vm->_gyro->_dna._carryNum = 0; if (_vm->_gyro->_thinkThing && !_vm->_gyro->_dna._objects[_vm->_gyro->_thinks - 1]) - thinkAbout(_vm->_gyro->kObjectMoney, Gyro::kThing); // you always have money + thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { @@ -1208,7 +1208,7 @@ void Lucerna::gameOver() { _vm->_animation->_sprites[0]._stepNum = 0; _vm->_animation->_sprites[0].appear(sx, sy, 0); - _vm->_timer->addTimer(3, _vm->_timer->kProcAvalotFalls, _vm->_timer->kReasonFallingOver); + _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); _vm->_gyro->_alive = false; } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index abc6ebdbf698..1fd261786571 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -220,7 +220,7 @@ void Scrolls::scrollModeMusic() { setReadyLight(0); _vm->_gyro->_seeScroll = false; - _vm->_timer->addTimer(8, _vm->_timer->kProcJacquesWakesUp, _vm->_timer->kReasonJacquesWakingUp); + _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); warning("STUB: Scrolls::music_scroll()"); return; #if 0 diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 600a3cae4de1..b5eb6a4d15aa 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -69,8 +69,8 @@ void Sequence::thenFlip(byte where, byte ped) { } void Sequence::startToClose() { - _vm->_timer->loseTimer(_vm->_timer->kReasonSequencer); - _vm->_timer->addTimer(7, _vm->_timer->kProcSequence, _vm->_timer->kReasonSequencer); + _vm->_timer->loseTimer(Timer::kReasonSequencer); + _vm->_timer->addTimer(7, Timer::kProcSequence, Timer::kReasonSequencer); } void Sequence::startToOpen() { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 973b1d32107c..c2fa07316007 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -237,7 +237,7 @@ void Timer::openDrawbridge() { _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_dna._drawbridgeOpen - 1); if (_vm->_gyro->_dna._drawbridgeOpen == 4) - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // You may enter the drawbridge. + _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } @@ -278,9 +278,9 @@ void Timer::stairs() { _vm->_animation->_sprites[0].walkTo(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._brummieStairs = 2; - _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; + _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { @@ -318,14 +318,14 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(4); _vm->_animation->_sprites[1].walkTo(5); - _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. + _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } void Timer::hangAround() { _vm->_animation->_sprites[1]._doCheck = false; _vm->_animation->_sprites[0].init(7, true, _vm->_animation); // Robin Hood - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; + _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); _vm->_visa->displayScrollChain('q', 39); _vm->_animation->_sprites[0].walkTo(7); @@ -336,7 +336,7 @@ void Timer::hangAround2() { _vm->_visa->displayScrollChain('q', 40); _vm->_animation->_sprites[1]._vanishIfStill = false; _vm->_animation->_sprites[1].walkTo(4); - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; + _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); _vm->_animation->_sprites[1].remove(); // Get rid of Robin Hood and Friar Tuck. @@ -357,7 +357,7 @@ void Timer::afterTheShootemup() { _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(1, 2); _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! @@ -396,12 +396,12 @@ void Timer::jacquesWakesUp() { case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // You can't wake him up now. + _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleJacques - 150] = 0; // Gone! + _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! break; } @@ -488,7 +488,7 @@ void Timer::jump() { else { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_visa->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); @@ -521,7 +521,7 @@ void Timer::buyWine() { _vm->_visa->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { _vm->_visa->displayScrollChain('D', 4); // You paid up. - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_dna._wineState = 1; // OK Wine. } @@ -538,7 +538,7 @@ void Timer::greetsMonk() { } void Timer::fallDownOubliette() { - _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; _vm->_animation->_sprites[0]._moveY++; // Increments dx/dy! _vm->_animation->_sprites[0]._y += _vm->_animation->_sprites[0]._moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index b356aef7c8e8..dfc99d4cd59a 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -165,9 +165,9 @@ void Visa::talkTo(byte whom) { if (_vm->_gyro->_subjectNum == 0) { switch (whom) { case Gyro::kPeopleSpludwick: - if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1])) { + if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true; + _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); return; @@ -241,7 +241,7 @@ void Visa::talkTo(byte whom) { break; } // On a subject. Is there any reason to block it? - } else if ((whom == _vm->_gyro->kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { + } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -269,12 +269,12 @@ void Visa::talkTo(byte whom) { if (!_noError) displayScrollChain('n', whom); // File not found! - if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = true; + if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_gyro->_dna._objects[Gyro::kObjectBadge - 1] = true; _vm->_lucerna->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. _vm->_gyro->_dna._talkedToCrapulus = true; - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1].walkTo(3); // Walks away. From 1cb0c0ec5ef639fe5ad083125db509ad32fdf738 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Sep 2013 23:48:36 +0200 Subject: [PATCH 0931/1332] AVALANCHE: harmonize the use of constants for kDir, kDirection, kVerbs --- engines/avalanche/acci2.cpp | 4 +-- engines/avalanche/animation.cpp | 8 ++--- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/dropdown2.cpp | 60 ++++++++++++++++----------------- engines/avalanche/lucerna2.cpp | 14 ++++---- engines/avalanche/parser.cpp | 2 +- engines/avalanche/timer.cpp | 4 +-- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index cec9c422f969..ffcc8e57f651 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1154,7 +1154,7 @@ void Acci::standUp() { _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; _vm->_animation->appearPed(1, 2); - _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; + _vm->_gyro->_dna._direction = Gyro::kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_dna._avvyInBed = false; @@ -1719,7 +1719,7 @@ void Acci::doThat() { _vm->_animation->appearPed(2, 4); _vm->_animation->_sprites[1].walkTo(5); _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcBackAndForth; + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcBackAndForth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 747f014dfb1e..5bff12307b1a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -322,14 +322,14 @@ void AnimationType::setSpeed(int8 xx, int8 yy) { if (_moveX == 0) { // No horz movement if (_moveY < 0) - turn(_anim->kDirUp); + turn(Animation::kDirUp); else - turn(_anim->kDirDown); + turn(Animation::kDirDown); } else { if (_moveX < 0) - turn(_anim->kDirLeft); + turn(Animation::kDirLeft); else - turn(_anim->kDirRight); + turn(Animation::kDirRight); } } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index af0079099d89..f6fb1ed592ad 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -149,7 +149,7 @@ void Avalot::setup() { _vm->_gyro->_ledStatus = 177; _vm->_gyro->_defaultLed = 2; // TSkellern = 0; Replace with a more local variable sometime - _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionStopped; + _vm->_gyro->_dna._direction = Gyro::kDirectionStopped; _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 0a5fe9f4d3cf..a934ed0f583c 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -285,26 +285,26 @@ void Dropdown::findWhatYouCanDoWithIt() { case Gyro::kObjectWine: case Gyro::kObjectPotion: case Gyro::kObjectInk: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeDrink; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeDrink; break; case Gyro::kObjectBell: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeRing; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeRing; break; case Gyro::kObjectChastity: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeWear; break; case Gyro::kObjectLute: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodePlay; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodePlay; break; case Gyro::kObjectMushroom: case Gyro::kObjectOnion: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeEat; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeEat; break; case Gyro::kObjectClothes: - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeWear; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeWear; break; default: - _vm->_gyro->_verbStr = _vm->_acci->kVerbCodeExam; // Anything else. + _vm->_gyro->_verbStr = Acci::kVerbCodeExam; // Anything else. } } @@ -508,22 +508,22 @@ void Dropdown::setupMenuWith() { _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodeGive; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); - _vm->_gyro->_verbStr = Common::String(_vm->_acci->kVerbCodeExam) + _vm->_acci->kVerbCodeTalk; + _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeTalk; switch (_vm->_gyro->_thinks) { case Gyro::kPeopleGeida: case Gyro::kPeopleArkata: { _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodeKiss; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeKiss; } break; case Gyro::kPeopleDogfood: { _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_dna._wonNim); // True if you HAVEN'T won. - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + _vm->_acci->kVerbCodePlay; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodePlay; } break; case Gyro::kPeopleMalagauche: { @@ -550,19 +550,19 @@ void Dropdown::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeHelp); + _vm->_lucerna->callVerb(Acci::kVerbCodeHelp); break; case 1: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBoss); + _vm->_lucerna->callVerb(Acci::kVerbCodeBoss); break; case 2: _vm->_lucerna->majorRedraw(); break; case 3: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); + _vm->_lucerna->callVerb(Acci::kVerbCodeScore); break; case 4: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInfo); + _vm->_lucerna->callVerb(Acci::kVerbCodeInfo); break; } } @@ -571,18 +571,18 @@ void Dropdown::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeRestart); + _vm->_lucerna->callVerb(Acci::kVerbCodeRestart); break; case 1: { if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeLoad); + _vm->_lucerna->callVerb(Acci::kVerbCodeLoad); } break; case 2: { if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeSave); + _vm->_lucerna->callVerb(Acci::kVerbCodeSave); } break; case 3: @@ -593,7 +593,7 @@ void Dropdown::runMenuFile() { _vm->_enid->backToBootstrap(2); break; case 5: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeQuit); + _vm->_lucerna->callVerb(Acci::kVerbCodeQuit); break; } } @@ -611,17 +611,17 @@ void Dropdown::runMenuAction() { break; case 1: _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodePause); + _vm->_lucerna->callVerb(Acci::kVerbCodePause); break; case 2: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeOpen); + _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); break; case 3: _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeLook); + _vm->_lucerna->callVerb(Acci::kVerbCodeLook); break; case 4: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); + _vm->_lucerna->callVerb(Acci::kVerbCodeInv); break; case 5: { if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) @@ -650,7 +650,7 @@ void Dropdown::runMenuWith() { _vm->_acci->_thing += 49; - if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == _vm->_acci->kVerbCodeGive) + if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive) _vm->_acci->_person = _vm->_gyro->_lastPerson; else _vm->_acci->_person = 254; @@ -659,37 +659,37 @@ void Dropdown::runMenuWith() { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { case 100: { // Beer _vm->_acci->_thing = 100; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; case 101: { // Wine _vm->_acci->_thing = 50; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; case 102: { // Whisky _vm->_acci->_thing = 102; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; case 103: { // Cider _vm->_acci->_thing = 103; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; case 104: { // Mead _vm->_acci->_thing = 107; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; case 105: { // Onion (trader) _vm->_acci->_thing = 67; - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeBuy); + _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; } break; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index ccb85b49c000..3fe95603c1f2 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -418,7 +418,7 @@ void Lucerna::putGeidaAt(byte whichPed, byte &ped) { _vm->_animation->_sprites[1].init(5, false, _vm->_animation); // load Geida _vm->_animation->appearPed(2, whichPed); _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida; + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGeida; } void Lucerna::enterRoom(byte room, byte ped) { @@ -471,7 +471,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy. + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; @@ -503,7 +503,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida; + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGeida; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -518,7 +518,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY; + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFollowAvvyY; _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... @@ -732,7 +732,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy. + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. break; case r__insidecardiffcastle: @@ -1138,13 +1138,13 @@ void Lucerna::checkClick() { _vm->_acci->_person = _vm->_gyro->_thinks; _vm->_acci->_thing = _vm->_acci->kPardon; } - callVerb(_vm->_acci->kVerbCodeExam); + callVerb(Acci::kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (_holdLeftMouse); - callVerb(_vm->_acci->kVerbCodeScore); + callVerb(Acci::kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index a378b0d54bf1..9be66ef1cf08 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -100,7 +100,7 @@ void Parser::handleFunctionKey(const Common::Event &event) { } break; case Common::KEYCODE_F7: - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeOpen); + _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); break; default: break; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index c2fa07316007..b88c53d1557c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -311,7 +311,7 @@ void Timer::getTiedUp() { _vm->_animation->_sprites[1].stopWalk(); _vm->_animation->_sprites[1].stopHoming(); _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGrabAvvy; + _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGrabAvvy; addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } @@ -642,7 +642,7 @@ void Timer::winning() { #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeScore); + _vm->_lucerna->callVerb(Acci::kVerbCodeScore); _vm->_scrolls->displayText(" T H E E N D "); _vm->_gyro->_letMeOut = true; } From 94b98ac5f682fda44e28b9f231878966e2077623 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 10 Sep 2013 08:12:06 +0200 Subject: [PATCH 0932/1332] AVALANCHE: Various cleanup --- engines/avalanche/acci2.cpp | 68 ++++++++++++++++++++-------------- engines/avalanche/avalot.cpp | 2 - engines/avalanche/scrolls2.cpp | 6 ++- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ffcc8e57f651..de36039b3610 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -364,7 +364,8 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), Scrolls::kControlSpeechBubble, Scrolls::kControlRegister); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), + Scrolls::kControlSpeechBubble, Scrolls::kControlRegister); _vm->_scrolls->displayText(tmpStr); } @@ -476,7 +477,7 @@ void Acci::parse() { bool notfound = true; - // Check also[] first, which conatins words about the actual room. + // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { for (byte i = 0; i < 31; i++) { if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { @@ -519,16 +520,16 @@ void Acci::parse() { unkString.clear(); // Replace words' codes that mean the same. - replace(Common::String('\xFF'), 0); // zap noise words - replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" - replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine" - replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" - replace(Common::String('\x4') + '\xE7', 17); // "get down" = "stand"... well, why not? - replace(Common::String('\x12') + '\xE4', 2); // "go in" = "open [door]" - replace(Common::String('\x1C') + '\xE5', 253); // "P' off" is a swear word - replace(Common::String('\x4') + '\x6' , 6); // "Take inventory" (remember Colossal Adventure?) - replace(Common::String('\x28') + '\xE8', 21); // "put on" = "don" - replace(Common::String('\x4') + '\xE5', 20); // "take off" = "doff" + replace(Common::String("\xFF"), 0); // zap noise words + replace(Common::String("\xD\xE2"), 1); // "look at" = "examine" + replace(Common::String("\xD\xE4"), 1); // "look in" = "examine" + replace(Common::String("\x4\xE6"), 17); // "get up" = "stand" + replace(Common::String("\x4\xE7"), 17); // "get down" = "stand"... well, why not? + replace(Common::String("\x12\xE4"), 2); // "go in" = "open [door]" + replace(Common::String("\x1C\xE5"), 253); // "P' off" is a swear word + replace(Common::String("\x4\x6"), 6); // "Take inventory" (remember Colossal Adventure?) + replace(Common::String("\x28\xE8"), 21); // "put on" = "don" + replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person if (_vm->_gyro->_dna._room == r__nottspub) @@ -654,9 +655,9 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". else { Common::String tmpStr; if (_person < 175) - tmpStr = Common::String::format("H%ce isn't around at the moment.", Scrolls::kControlToBuffer); + tmpStr = Common::String::format("He isn't around at the moment."); else - tmpStr = Common::String::format("Sh%ce isn't around at the moment.", Scrolls::kControlToBuffer); + tmpStr = Common::String::format("She isn't around at the moment."); _vm->_scrolls->displayText(tmpStr); return false; } @@ -1250,7 +1251,8 @@ void Acci::getProc(char thing) { */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->_dna._room != r__lustiesroom) { - _vm->_scrolls->displayText(Common::String("Not yet. Try later!") + Scrolls::kControlRegister + '2' + Scrolls::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); return; } _vm->_gyro->_dna._objects[Gyro::kObjectLute - 1] = false; @@ -1286,7 +1288,8 @@ void Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { - _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + '1' + Scrolls::kControlToBuffer); // Avvy himself! + Common::String tmpStr = Common::String::format("%c1%c", Scrolls::kControlRegister, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); // Avvy himself! return; } @@ -1294,21 +1297,26 @@ void Acci::personSpeaks() { for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + byte(i + 49) + Scrolls::kControlToBuffer); + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, '1' + i, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); found = true; } } - if (!found) { - for (byte i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) - _vm->_scrolls->displayText(Common::String(Scrolls::kControlRegister) + byte(i + 65) + Scrolls::kControlToBuffer); + if (found) + return; + + for (byte i = 0; i < 16; i++) { + if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) { + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, 'A' + i, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); } } } void Acci::heyThanks() { personSpeaks(); - _vm->_scrolls->displayText(Common::String("Hey, thanks!") + Scrolls::kControlSpeechBubble + "(But now, you've lost it!)"); + Common::String tmpStr = Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_dna._objects[_thing - 1] = false; } @@ -1895,8 +1903,9 @@ void Acci::doThat() { for (byte i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - for (byte j = 0; j < kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word.size(); j++) { - if (kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word[j] != temp[j]) + int pwdId = _vm->_gyro->_dna._passwordNum + kFirstPassword; + for (byte j = 0; j < kVocabulary[pwdId]._word.size(); j++) { + if (kVocabulary[pwdId]._word[j] != temp[j]) ok = false; } } @@ -1986,9 +1995,11 @@ void Acci::doThat() { if (!_vm->_gyro->_dna._aylesIsAwake) _vm->_scrolls->displayText("You can't seem to wake him by yourself."); break; - case Gyro::kPeopleJacques: - _vm->_scrolls->displayText(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + Scrolls::kControlRegister + '1' + - Scrolls::kControlSpeechBubble + "Hmmm... that doesn't seem to do any good..."); + case Gyro::kPeopleJacques: { + Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ + "Hmmm... that doesn't seem to do any good...", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } break; default: _vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!"); @@ -2006,7 +2017,8 @@ void Acci::doThat() { _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); - _vm->_scrolls->displayText(Common::String("A few hours later...") + Scrolls::kControlParagraph + "nothing much has happened..."); + Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Scrolls::kControlParagraph); + _vm->_scrolls->displayText(tmpStr); } break; case kVerbCodeRestart: diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f6fb1ed592ad..2643299ec532 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -127,8 +127,6 @@ void Avalot::handleKeyDown(Common::Event &event) { _vm->_lucerna->drawDirection(); } - - void Avalot::setup() { _vm->_gyro->_mouse = _vm->_gyro->kMouseStateNo; _vm->_gyro->_letMeOut = false; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1fd261786571..22fc7085b2fc 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -699,8 +699,10 @@ void Scrolls::callScrollDriver() { case 1: displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; - case 2: - displayText(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum]._word + kControlToBuffer); + case 2: { + int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum; + displayText(_vm->_acci->kVocabulary[pwdId]._word + kControlToBuffer); + } break; case 3: displayText(_vm->_gyro->_dna._favouriteDrink + kControlToBuffer); From 49dbac6a2a5cde294a4c4c9a47467e7b5d95e08b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 11 Sep 2013 08:43:13 +0200 Subject: [PATCH 0933/1332] AVALANCHE: Some polishing in Acci2 --- engines/avalanche/acci2.cpp | 74 +++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index de36039b3610..ad32ebdaeda6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -261,19 +261,18 @@ Common::String Acci::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = _vm->_gyro->_dna._totalTime / ticksInOneSec; // No. of seconds. - h = floor((float)h); + h = floor(_vm->_gyro->_dna._totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; - h = h / 3600; + h /= 3600; s = m % 60; - m = m / 60; + m /= 60; Common::String result = "You've been playing for "; if (h > 0) - result += _vm->_gyro->intToStr(h) + " hours, "; + result += Common::String::format("%d hours, ", h); if ((m > 0) || (h != 0)) - result += _vm->_gyro->intToStr(m) + " minutes and "; - return result + _vm->_gyro->intToStr(s) + " seconds."; + result = Common::String::format("%d minutes and ", m); + return result + Common::String::format("%d seconds", s); } void Acci::cheatParse(Common::String codes) { @@ -751,24 +750,35 @@ void Acci::examine() { void Acci::inventory() { byte itemNum = 0; - _vm->_scrolls->displayText(Common::String("You're carrying ") + Scrolls::kControlToBuffer); + Common::String tmpStr = Common::String::format("You're carrying %c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { itemNum++; - if (itemNum == _vm->_gyro->_dna._carryNum) - _vm->_scrolls->displayText(Common::String("and ") + Scrolls::kControlToBuffer); + if (itemNum == _vm->_gyro->_dna._carryNum) { + tmpStr = Common::String::format("and %c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } + _vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + Scrolls::kControlToBuffer); - if ((i + 1) == _vm->_gyro->_dna._wearing) - _vm->_scrolls->displayText(Common::String(", which you're wearing") + Scrolls::kControlToBuffer); - if (itemNum < _vm->_gyro->_dna._carryNum) - _vm->_scrolls->displayText(Common::String(", ") + Scrolls::kControlToBuffer); + + if ((i + 1) == _vm->_gyro->_dna._wearing) { + tmpStr = Common::String::format(", which you're wearing%c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } + + if (itemNum < _vm->_gyro->_dna._carryNum) { + tmpStr = Common::String::format(", %c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } } } - if (_vm->_gyro->_dna._wearing == kNothing) - _vm->_scrolls->displayText(Common::String("...") + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "...and you're stark naked!"); - else + if (_vm->_gyro->_dna._wearing == kNothing) { + tmpStr = Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); + } else _vm->_scrolls->displayText("."); } @@ -838,23 +848,30 @@ void Acci::peopleInRoom() { if (numPeople == 0) // If nobody's here, we can cut out straight away. return; + Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (byte i = 1; i < 29; i++) { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { actPerson++; if (actPerson == 1) // First on the list. _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); - else if (actPerson < numPeople) // The middle... - _vm->_scrolls->displayText(Common::String(", ") + _vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); - else // The end. - _vm->_scrolls->displayText(Common::String(" and ") + _vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); + else if (actPerson < numPeople) { // The middle... + tmpStr = Common::String::format(", %s%c", _vm->_gyro->getName(i + 150), Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } else { // The end. + tmpStr = Common::String::format(" and %s%c", _vm->_gyro->getName(i + 150), Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } } } - if (numPeople == 1) - _vm->_scrolls->displayText(Common::String(" is") + Scrolls::kControlToBuffer); - else - _vm->_scrolls->displayText(Common::String(" are") + Scrolls::kControlToBuffer); + if (numPeople == 1) { + tmpStr = Common::String::format(" is%c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } else { + tmpStr = Common::String::format(" are%c", Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } _vm->_scrolls->displayText(" here."); // End and display it. } @@ -1360,9 +1377,10 @@ void Acci::doThat() { case kVerbCodeOpen: openDoor(); break; - case kVerbCodePause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - _vm->_scrolls->displayText(Common::String("Game paused.") + Scrolls::kControlCenter + Scrolls::kControlNewLine + Scrolls::kControlNewLine - + "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue."); + case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); + } break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. From 2f42e9ce4607c228177e57e0e28a2333efc289e6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 11 Sep 2013 22:49:16 +0200 Subject: [PATCH 0934/1332] AVALANCHE: Identify useless variables and function in Closing2 --- engines/avalanche/closing2.cpp | 7 ++++--- engines/avalanche/closing2.h | 22 +++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/closing2.cpp b/engines/avalanche/closing2.cpp index c9bfcd0cd423..7da630bae3f6 100644 --- a/engines/avalanche/closing2.cpp +++ b/engines/avalanche/closing2.cpp @@ -79,8 +79,9 @@ void Closing::exitGame() { showScreen(); // No halt- it's already set up. } -void Closing::handleBug() { - warning("STUB: Closing::handleBug()"); -} +// CHECKME: Useless? +// void Closing::handleBug() { +// warning("STUB: Closing::handleBug()"); +//} } // End of namespace Avalanche. diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index e1bf8b2cab4b..a2543fd3afd3 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -33,37 +33,33 @@ #include "common/scummsys.h" #include "common/str.h" - - namespace Avalanche { class AvalancheEngine; class Closing { public: Closing(AvalancheEngine *vm); - void exitGame(); private: +// CHECKME: Useless values? enum ScreenType { - kScreenBugAlert = 1, - kScreenRamCram = 2, - kScreenNagScreen = 3, - kScreenTwoCopies = 5 +// kScreenBugAlert = 1, +// kScreenRamCram = 2, +// kScreenTwoCopies = 5, + kScreenNagScreen = 3 }; AvalancheEngine *_vm; - Common::String q; //absolute $B8FA:0* ; Nobody's using the graphics memory now. - Common::File f; - void getScreen(ScreenType which); - void showScreen(); - void putIn(Common::String str, uint16 where); - void handleBug(); + // CHECKME: Unused? + // Common::String q; //absolute $B8FA:0* ; Nobody's using the graphics memory now. + // Common::File f; + // void handleBug(); }; } // End of namespace Avalanche. From 4c12daf55a35e06313cb0a5086b5cc5dae8dd971 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 Sep 2013 00:32:45 +0200 Subject: [PATCH 0935/1332] AVALANCHE: Polish some more strings --- engines/avalanche/acci2.cpp | 75 +++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ad32ebdaeda6..ad4bd1353668 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -971,8 +971,8 @@ void Acci::openDoor() { } if (_vm->_gyro->_dna._room == r__map) - _vm->_scrolls->displayText(Common::String("Avvy, you can complete the whole game without ever going " - "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.")); + _vm->_scrolls->displayText("Avvy, you can complete the whole game without ever going " \ + "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else _vm->_scrolls->displayText("Door? What door?"); } @@ -1361,7 +1361,7 @@ void Acci::doThat() { && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->_alive) { - _vm->_scrolls->displayText(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); + _vm->_scrolls->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } if (!_vm->_gyro->_dna._avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { @@ -1396,7 +1396,7 @@ void Acci::doThat() { } break; case kVerbCodeDrop: - _vm->_scrolls->displayText(Common::String("Two years ago you dropped a florin in the street. Three days ") + + _vm->_scrolls->displayText("Two years ago you dropped a florin in the street. Three days " \ "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; case kVerbCodeInv: @@ -1404,9 +1404,10 @@ void Acci::doThat() { break; case kVerbCodeTalk: if (_person == kPardon) { - if (_vm->_gyro->_subjectNum == 99) // They typed "say password". - _vm->_scrolls->displayText(Common::String("Yes, but what ") + Scrolls::kControlItalic + "is" + Scrolls::kControlRoman + " the password?"); - else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { + if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". + Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Scrolls::kControlItalic, Scrolls::kControlRoman); + _vm->_scrolls->displayText(tmpStr); + } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); for (byte i = 0; i < 10; i++) @@ -1452,7 +1453,7 @@ void Acci::doThat() { break; case Gyro::kPeopleCwytalot: if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - _vm->_scrolls->displayText(Common::String("You might be able to influence Cwytalot more if you used it!")); + _vm->_scrolls->displayText("You might be able to influence Cwytalot more if you used it!"); else heyThanks(); break; @@ -1578,7 +1579,8 @@ void Acci::doThat() { if (_vm->_gyro->_dna._wearing == kNothing) _vm->_scrolls->displayText("You're already stark naked!"); else if (_vm->_gyro->_dna._avvysInTheCupboard) { - _vm->_scrolls->displayText(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.'); + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_dna._wearing).c_str()); + _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_dna._wearing = kNothing; _vm->_lucerna->refreshObjectList(); } else @@ -1724,13 +1726,16 @@ void Acci::doThat() { if (_vm->_gyro->setFlag('P')) { _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); - } else - _vm->_scrolls->displayText(Common::String("It would be ") + Scrolls::kControlItalic + "VERY" - + Scrolls::kControlRoman + " unwise to do that here, Avvy!"); + } else { + Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Scrolls::kControlItalic, Scrolls::kControlRoman); + _vm->_scrolls->displayText(tmpStr); + } break; - case kVerbCodeCheat: - _vm->_scrolls->displayText(Common::String(Scrolls::kControlItalic) + "Cheat mode now enabled."); + case kVerbCodeCheat: { + Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Scrolls::kControlItalic); + _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_cheat = true; + } break; case kVerbCodeMagic: if (_vm->_gyro->_dna._avariciusTalk > 0) @@ -1758,19 +1763,25 @@ void Acci::doThat() { break; case kVerbCodeExpletive: switch (_vm->_gyro->_dna._sworeNum) { - case 0: - _vm->_scrolls->displayText(Common::String("Avvy! Do you mind? There might be kids playing!") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "(I shouldn't say it again, if I were you!)"); + case 0: { + Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ + "(I shouldn't say it again, if I were you!)", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); + } break; - case 1: - _vm->_scrolls->displayText(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Don't do it again!"); + case 1: { + Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ + "do things I tell you not to?%c%cDon't do it again!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); + } break; - default: + default: { _vm->_pingo->zonk(); - _vm->_scrolls->displayText(Common::String("A crack of lightning shoots from the sky, and fries you.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "(`Such is the anger of the gods, Avvy!\")"); + // CHECKME: Weird character in string + Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + _vm->_scrolls->displayText(tmpStr); _vm->_lucerna->gameOver(); + } } _vm->_gyro->_dna._sworeNum++; break; @@ -1830,7 +1841,8 @@ void Acci::doThat() { } _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_scrolls->displayText(Common::String("Wine, please.") + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, '1', Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -2049,16 +2061,21 @@ void Acci::doThat() { case kPardon: _vm->_scrolls->displayText("Hey, a verb would be helpful!"); break; - case kVerbCodeHello: + case kVerbCodeHello: { personSpeaks(); - _vm->_scrolls->displayText(Common::String("Hello.") + Scrolls::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } break; - case kVerbCodeThanks: + case kVerbCodeThanks: { personSpeaks(); - _vm->_scrolls->displayText(Common::String("That's OK.") + Scrolls::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } break; default: - _vm->_scrolls->displayText(Common::String(Scrolls::kControlBell) + "Parser bug!"); + Common::String tmpStr = Common::String::format("%cParser bug!", Scrolls::kControlBell); + _vm->_scrolls->displayText(tmpStr); } } From 11c496c31b6eb410d5bd10d346606a92c82664b4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 Sep 2013 07:43:15 +0200 Subject: [PATCH 0936/1332] AVALANCHE: Complete 2 comments, get rid of Scrolls::kControlToBuffer in one function (for further discussions) --- engines/avalanche/acci2.cpp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ad4bd1353668..2c2c37a8e154 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -750,36 +750,30 @@ void Acci::examine() { void Acci::inventory() { byte itemNum = 0; - Common::String tmpStr = Common::String::format("You're carrying %c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("You're carrying "); for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { itemNum++; - if (itemNum == _vm->_gyro->_dna._carryNum) { - tmpStr = Common::String::format("and %c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + if (itemNum == _vm->_gyro->_dna._carryNum) + tmpStr += "and %c"; - _vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + Scrolls::kControlToBuffer); + tmpStr += _vm->_gyro->getItem(i + 1); - if ((i + 1) == _vm->_gyro->_dna._wearing) { - tmpStr = Common::String::format(", which you're wearing%c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + if ((i + 1) == _vm->_gyro->_dna._wearing) + tmpStr += ", which you're wearing"; - if (itemNum < _vm->_gyro->_dna._carryNum) { - tmpStr = Common::String::format(", %c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + if (itemNum < _vm->_gyro->_dna._carryNum) + tmpStr += ", "; } } if (_vm->_gyro->_dna._wearing == kNothing) { - tmpStr = Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); } else - _vm->_scrolls->displayText("."); + tmpStr += '.'; + + _vm->_scrolls->displayText(tmpStr); } void Acci::swallow() { // Eat something. @@ -1630,7 +1624,7 @@ void Acci::doThat() { if (_thing == kPardon) { switch (_vm->_gyro->_dna._room) { // They just typed "play"... case r__argentpub: { // ...in the pub, => play Nim. - warning("STUB: Acci::doThat() - case kVerbCodeplay"); + warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. @@ -1688,7 +1682,7 @@ void Acci::doThat() { case 55: if (_vm->_gyro->_dna._room == r__argentpub) // play_nim(); - warning("STUB: Acci::doThat() - case kVerbCodeplay"); + warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); else _vm->_scrolls->displayText(kWhat); break; From 6f4e80e36e7729bd2137a1a2bde712521861b0b3 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Thu, 12 Sep 2013 09:30:28 -0500 Subject: [PATCH 0937/1332] ZVISION: Add wrapper function for copyRectToSurface Also rename some arguments to make them more clear --- graphics/surface.cpp | 18 ++++++++++++------ graphics/surface.h | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index d808121c871e..a8173f0e9c09 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -133,17 +133,17 @@ const Surface Surface::getSubArea(const Common::Rect &area) const { return subSurface; } -void Surface::copyRectToSurface(const void *buffer, int pitch, int x, int y, int width, int height) { +void Surface::copyRectToSurface(const void *buffer, int pitch, int destX, int destY, int width, int height) { assert(buffer); - assert(x >= 0 && x < w); - assert(y >= 0 && y < h); - assert(height > 0 && y + height <= h); - assert(width > 0 && x + width <= w); + assert(destX >= 0 && destX < w); + assert(destY >= 0 && destY < h); + assert(height > 0 && destY + height <= h); + assert(width > 0 && destX + width <= w); // Copy buffer data to internal buffer const byte *src = (const byte *)buffer; - byte *dst = (byte *)getBasePtr(x, y); + byte *dst = (byte *)getBasePtr(destX, destY); for (int i = 0; i < height; i++) { memcpy(dst, src, width * format.bytesPerPixel); src += pitch; @@ -151,6 +151,12 @@ void Surface::copyRectToSurface(const void *buffer, int pitch, int x, int y, int } } +void Surface::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect) { + assert(srcSurface.format == format); + + copyRectToSurface(srcSurface.getBasePtr(subRect.left, subRect.top), srcSurface.pitch, destX, destY, subRect.width(), subRect.height()); +} + 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 ad52ed8238c5..1492e71e68ea 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -214,12 +214,23 @@ struct Surface { * * @param buffer The buffer containing the graphics data source * @param pitch The pitch of the buffer (number of bytes in a scanline) - * @param x The x coordinate of the destination rectangle - * @param y The y coordinate of the destination rectangle + * @param destX The x coordinate of the destination rectangle + * @param destY The y coordinate of the destination rectangle * @param width The width of the destination rectangle * @param height The height of the destination rectangle */ - void copyRectToSurface(const void *buffer, int pitch, int x, int y, int width, int height); + void copyRectToSurface(const void *buffer, int pitch, int destX, int destY, int width, int height); + /** + * Copies a bitmap to the Surface internal buffer. The pixel format + * of buffer must match the pixel format of the Surface. + * + * @param srcSurface The source of the bitmap data + * @param destX The x coordinate of the destination rectangle + * @param destY The y coordinate of the destination rectangle + * @param subRect The subRect of surface to be blitted + * @return + */ + void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect); /** * Convert the data to another pixel format. From b936611e030f6748013b5360c8617d44643cb335 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 Sep 2013 21:44:36 +0200 Subject: [PATCH 0938/1332] AVALANCHE: Fix various warnings reported by GCC and/or wjp --- engines/avalanche/acci2.cpp | 24 ++++++++++++------------ engines/avalanche/animation.cpp | 4 ++-- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/lucerna2.cpp | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 2c2c37a8e154..74ddad958f26 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -654,9 +654,9 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". else { Common::String tmpStr; if (_person < 175) - tmpStr = Common::String::format("He isn't around at the moment."); + tmpStr = "He isn't around at the moment."; else - tmpStr = Common::String::format("She isn't around at the moment."); + tmpStr = "She isn't around at the moment."; _vm->_scrolls->displayText(tmpStr); return false; } @@ -750,13 +750,13 @@ void Acci::examine() { void Acci::inventory() { byte itemNum = 0; - Common::String tmpStr = Common::String::format("You're carrying "); + Common::String tmpStr = Common::String("You're carrying "); for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_dna._objects[i]) { itemNum++; if (itemNum == _vm->_gyro->_dna._carryNum) - tmpStr += "and %c"; + tmpStr += "and "; tmpStr += _vm->_gyro->getItem(i + 1); @@ -768,9 +768,9 @@ void Acci::inventory() { } } - if (_vm->_gyro->_dna._wearing == kNothing) { + if (_vm->_gyro->_dna._wearing == kNothing) tmpStr += Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - } else + else tmpStr += '.'; _vm->_scrolls->displayText(tmpStr); @@ -850,10 +850,10 @@ void Acci::peopleInRoom() { if (actPerson == 1) // First on the list. _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); else if (actPerson < numPeople) { // The middle... - tmpStr = Common::String::format(", %s%c", _vm->_gyro->getName(i + 150), Scrolls::kControlToBuffer); + tmpStr = Common::String::format(", %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer); _vm->_scrolls->displayText(tmpStr); } else { // The end. - tmpStr = Common::String::format(" and %s%c", _vm->_gyro->getName(i + 150), Scrolls::kControlToBuffer); + tmpStr = Common::String::format(" and %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer); _vm->_scrolls->displayText(tmpStr); } } @@ -1056,9 +1056,9 @@ void Acci::putProc() { * @remarks Originally called 'not_in_order' */ void Acci::notInOrder() { + Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ - "What I need next is %s%c2%c", _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]), - Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + "What I need next is %s%c2%c", itemStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); } @@ -1206,7 +1206,7 @@ void Acci::getProc(char thing) { _vm->_gyro->_dna._boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else { - Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing)); + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); _vm->_scrolls->displayText(tmpStr); } } else @@ -1835,7 +1835,7 @@ void Acci::doThat() { } _vm->_celer->drawBackgroundSprite(-1, -1, 12); - Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, '1', Scrolls::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); if (_vm->_gyro->_dna._alcoholLevel == 0) _vm->_lucerna->incScore(3); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5bff12307b1a..615bf94d4029 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -226,7 +226,7 @@ void AnimationType::walk() { break; case Gyro::kMagicUnfinished: { bounce(); - Common::String tmpStr = Common::String::format("%cSorry.%cThis place is not available yet!", Scrolls::kControlBell, Scrolls::kControlCenter, Scrolls::kControlRoman); + Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Scrolls::kControlBell, Scrolls::kControlCenter, Scrolls::kControlRoman); _anim->_vm->_scrolls->displayText(tmpStr); } break; @@ -352,8 +352,8 @@ void AnimationType::remove() { if ((_info._xLength % 8) > 0) _info._xWidth++; for (byte i = 0; i < _stat._frameNum; i++) { + assert(_animCount > 0); _animCount--; - assert(_animCount >= 0); delete[] _info._mani[_animCount]; delete[] _info._sil[_animCount]; } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index cdd6b7c3ab4e..ce3fb8eaf66c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -454,7 +454,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter, - Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName, Scrolls::kControlNewLine, + Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName.c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _scrolls->displayText(tmpStr); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3fe95603c1f2..71d38d3c0cf8 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -232,7 +232,7 @@ void Lucerna::loadAlso(byte num) { _vm->_gyro->_also[i][j] = new Common::String; *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } - tmpStr = Common::String::format("\x9D%s\x9D", *_vm->_gyro->_also[i][0]); + tmpStr = Common::String::format("\x9D%s\x9D", *_vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } @@ -287,7 +287,7 @@ void Lucerna::loadAlso(byte num) { file.close(); unScramble(); for (byte i = 0; i <= alsoNum; i++) { - tmpStr = Common::String::format(",%s,", *_vm->_gyro->_also[i][0]); + tmpStr = Common::String::format(",%s,", *_vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } } From 65f39c14c92cf1453c58dd87db1b473f25b4dbd8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 00:18:14 +0200 Subject: [PATCH 0939/1332] AVALANCHE: Remove some verbosity related to excessive use of Common::String in Acci2 --- engines/avalanche/acci2.cpp | 58 ++++++++++++++++--------------------- engines/avalanche/acci2.h | 2 +- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 74ddad958f26..1b6446c09dc5 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -848,26 +848,20 @@ void Acci::peopleInRoom() { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { actPerson++; if (actPerson == 1) // First on the list. - _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer); - else if (actPerson < numPeople) { // The middle... - tmpStr = Common::String::format(", %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } else { // The end. - tmpStr = Common::String::format(" and %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + tmpStr = _vm->_gyro->getName(i + 150); + else if (actPerson < numPeople) // The middle... + tmpStr += ", " + _vm->_gyro->getName(i + 150); + else // The end. + tmpStr += " and " + _vm->_gyro->getName(i + 150); } } - if (numPeople == 1) { - tmpStr = Common::String::format(" is%c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } else { - tmpStr = Common::String::format(" are%c", Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + if (numPeople == 1) + tmpStr += " is"; + else + tmpStr += " are"; - _vm->_scrolls->displayText(" here."); // End and display it. + _vm->_scrolls->displayText(tmpStr + " here."); // End and display it. } void Acci::lookAround() { @@ -1290,7 +1284,7 @@ void Acci::winSequence() { _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); } -void Acci::personSpeaks() { +Common::String Acci::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_dna._room)) _person = _vm->_gyro->_her; @@ -1299,34 +1293,32 @@ void Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { - Common::String tmpStr = Common::String::format("%c1%c", Scrolls::kControlRegister, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); // Avvy himself! - return; + return Common::String::format("%c1", Scrolls::kControlRegister); // Avvy himself! } bool found = false; // The _person we're looking for's code is in _person. + Common::String tmpStr; for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, '1' + i, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i); found = true; } } if (found) - return; + return tmpStr; for (byte i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, 'A' + i, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } + if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) + tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); } + + return tmpStr; } void Acci::heyThanks() { - personSpeaks(); - Common::String tmpStr = Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_dna._objects[_thing - 1] = false; } @@ -2056,14 +2048,14 @@ void Acci::doThat() { _vm->_scrolls->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { - personSpeaks(); - Common::String tmpStr = Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble); + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); } break; case kVerbCodeThanks: { - personSpeaks(); - Common::String tmpStr = Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble); + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); } break; diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index 55ad64e65f5a..dab5371f4264 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -124,7 +124,7 @@ class Acci { void giveGeidaTheLute(); void playHarp(); void winSequence(); - void personSpeaks(); + Common::String personSpeaks(); void heyThanks(); }; From 7fdb5c439ec98c93fbdb2195c8f1a62b0c448a05 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 01:08:37 +0200 Subject: [PATCH 0940/1332] AVALANCHE: Fix bug in scrollModeNormal() --- engines/avalanche/scrolls2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 22fc7085b2fc..1d2cd4530896 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -112,7 +112,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { } void Scrolls::scrollModeNormal() { - Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); + Common::String egg = Common::String::format("%c%c%c%c%c+***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); Common::String e = "(c) 1994"; setReadyLight(3); From 8a59c9c1b27cc026ba096c44486f504ba1eb8c5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 01:27:20 +0200 Subject: [PATCH 0941/1332] AVALANCHE: undo previous commit, add comments about kControlNegative and a missing stub --- engines/avalanche/scrolls2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1d2cd4530896..ab7d0385404c 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -112,7 +112,11 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { } void Scrolls::scrollModeNormal() { - Common::String egg = Common::String::format("%c%c%c%c%c+***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); + // Original code is: + // egg : array[1..8] of char = ^P^L^U^G^H+'***'; + // this is not using kControl characters: it's the secret code to be entered to trigger the easter egg + // TODO: To be fixed when the Easter egg code is implemented + Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace); Common::String e = "(c) 1994"; setReadyLight(3); @@ -137,6 +141,7 @@ void Scrolls::scrollModeNormal() { _vm->_graphics->_surface.copyFrom(temp); temp.free(); + warning("STUB: scrollModeNormal() - Check Easter Egg trigger"); #if 0 char r; bool oktoexit; @@ -694,6 +699,8 @@ void Scrolls::callScrollDriver() { return; } break; + + // CHECME: The whole kControlNegative block seems completely unused, as the only use (the easter egg check) is a false positive case kControlNegative: switch (_param) { case 1: From f7c34949db4df92aced4a654072ef74bd064c421 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 08:29:19 +0200 Subject: [PATCH 0942/1332] AVALANCHE: Error out when critical files are missing --- engines/avalanche/animation.cpp | 6 ++--- engines/avalanche/celer2.cpp | 12 +++------ engines/avalanche/gyro2.cpp | 6 ++--- engines/avalanche/lucerna2.cpp | 43 +++++++++---------------------- engines/avalanche/pingo2.cpp | 6 ++--- engines/avalanche/scrolls2.cpp | 45 +++++++++++++-------------------- engines/avalanche/visa2.cpp | 26 ++++++++----------- 7 files changed, 49 insertions(+), 95 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 615bf94d4029..57353255db86 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -55,10 +55,8 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { Common::File inf; Common::String filename = Common::String::format("sprite%d.avd", spritenum); - if (!inf.open(filename)) { - warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); - return; - } + if (!inf.open(filename)) + error("AVALANCHE: Trip: File not found: %s", filename.c_str()); inf.seek(177); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 5069a92e0aa1..acbe5e9eadb4 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -267,10 +267,8 @@ void Celer::updateBackgroundSprites() { void Celer::loadBackgroundSprites(byte number) { Common::File f; _filename = _filename.format("chunk%d.avd", number); - if (!f.open(_filename)) { - warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); - return; - } + if (!f.open(_filename)) + error("AVALANCHE: Celer: File not found: %s", _filename.c_str()); f.seek(44); _spriteNum = f.readByte(); @@ -336,10 +334,8 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { drawSprite(destX, destY, _sprites[which]); } else { Common::File f; - if (!f.open(_filename)) { // Filename was set in loadBackgroundSprites(). - warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); - return; - } + if (!f.open(_filename)) // Filename was set in loadBackgroundSprites(). + error("AVALANCHE: Celer: File not found: %s", _filename.c_str()); f.seek(_offsets[which]); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 70c2150d1e91..ecd1be14b74e 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -457,10 +457,8 @@ Common::String Gyro::f5Does() { void Gyro::loadMouse(byte which) { Common::File f; - if (!f.open("mice.avd")) { - warning("AVALANCHE: Gyro: File not found: mice.avd"); - return; - } + if (!f.open("mice.avd")) + error("AVALANCHE: Gyro: File not found: mice.avd"); ::Graphics::Surface cursor; cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 71d38d3c0cf8..784c83ed7d64 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -218,10 +218,8 @@ void Lucerna::loadAlso(byte num) { } Common::String filename; filename = Common::String::format("also%d.avd", num); - if (!file.open(filename)) { - warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - return; - } + if (!file.open(filename)) + error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); file.seek(128); @@ -298,10 +296,8 @@ void Lucerna::loadRoom(byte num) { _vm->_graphics->fleshColors(); Common::String filename = Common::String::format("place%d.avd", num); - if (!file.open(filename)) { - warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - return; - } + if (!file.open(filename)) + error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); file.seek(146); if (!_vm->_gyro->_roomnName.empty()) @@ -851,15 +847,11 @@ void Lucerna::thinkAbout(byte object, bool type) { _vm->_gyro->setMousePointerWait(); if (type == Gyro::kThing) { - if (!file.open("thinks.avd")) { - warning("AVALANCHE: Lucerna: File not found: thinks.avd"); - return; - } + if (!file.open("thinks.avd")) + error("AVALANCHE: Lucerna: File not found: thinks.avd"); } else { // Gyro::kPerson - if (!file.open("folk.avd")) { - warning("AVALANCHE: Lucerna: File not found: folk.avd"); - return; - } + if (!file.open("folk.avd")) + error("AVALANCHE: Lucerna: File not found: folk.avd"); object -= 149; if (object >= 25) @@ -869,13 +861,10 @@ void Lucerna::thinkAbout(byte object, bool type) { } file.seek(object * picSize + 65); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); picture.free(); - file.close(); CursorMan.showMouse(false); @@ -894,10 +883,8 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; - if (!file.open("digit.avd")) { - warning("AVALANCHE: Lucerna: File not found: digit.avd"); - return; - } + if (!file.open("digit.avd")) + error("AVALANCHE: Lucerna: File not found: digit.avd"); for (byte i = 0; i < 10; i++) { file.seek(i * digitsize); @@ -913,25 +900,19 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites } void Lucerna::drawToolbar() { - if (!file.open("useful.avd")) { - warning("AVALANCHE: Lucerna: File not found: useful.avd"); - return; - } + if (!file.open("useful.avd")) + error("AVALANCHE: Lucerna: File not found: useful.avd"); file.seek(40); CursorMan.showMouse(false); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); picture.free(); - file.close(); CursorMan.showMouse(true); - _vm->_gyro->_oldDirection = 177; drawDirection(); } diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 3ebb47ed98d0..9f99d8c1847d 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -113,10 +113,8 @@ void Pingo::winningPic() { Common::File f; _vm->_lucerna->dusk(); - if (!f.open("finale.avd")) { - warning("AVALANCHE: Lucerna: File not found: finale.avd"); - return; - } + if (!f.open("finale.avd")) + error("AVALANCHE: Lucerna: File not found: finale.avd"); #if 0 for (byte bit = 0; bit <= 3; bit++) { diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index ab7d0385404c..4e114517ad86 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -264,10 +264,8 @@ void Scrolls::unDodgem() { void Scrolls::getIcon(int16 x, int16 y, byte which) { Common::File file; - if (!file.open("icons.avd")) { - warning("AVALANCHE: Scrolls: File not found: icons.avd"); - return; - } + if (!file.open("icons.avd")) + error("AVALANCHE: Scrolls: File not found: icons.avd"); which--; file.seek(which * 426); @@ -286,10 +284,8 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File file; Common::String filename = Common::String::format("%s.avd", fn.c_str()); - if (!file.open(filename)) { - warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); - return; - } + if (!file.open(filename)) + error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); #if 0 uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); @@ -730,14 +726,12 @@ void Scrolls::callScrollDriver() { break; case 10: switch (_vm->_gyro->_dna._boxContent) { - case 0: { // Sixpence. + case 0: // Sixpence. _vm->_visa->displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_dna._money += 6; _vm->_gyro->_dna._boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); return; - } - break; case Acci::kNothing: displayText("nothing at all. It's completely empty."); break; @@ -759,7 +753,7 @@ void Scrolls::callScrollDriver() { case kControlNewLine: _vm->_gyro->_scrollNum++; break; - case kControlQuestion: { + case kControlQuestion: if (call_spriterun) _vm->_lucerna->spriteRun(); call_spriterun = false; @@ -768,9 +762,7 @@ void Scrolls::callScrollDriver() { _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion; drawScroll(&Avalanche::Scrolls::scrollModeDialogue); - resetScroll(); - } break; case kControlRegister: mouthnext = true; @@ -779,13 +771,13 @@ void Scrolls::callScrollDriver() { for (byte j = 0; j < 9; j++) _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; break; - default: { // Add new char. + default: // Add new char. if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { solidify(_vm->_gyro->_scrollNum - 1); _vm->_gyro->_scrollNum++; } _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; - } + break; } } } @@ -800,26 +792,23 @@ void Scrolls::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A void Scrolls::loadFont() { Common::File file; - if (!file.open("avalot.fnt")) { - warning("AVALANCHE: Scrolls: File not found: avalot.fnt"); - return; - } + if (!file.open("avalot.fnt")) + error("AVALANCHE: Scrolls: File not found: avalot.fnt"); + for (int16 i = 0; i < 256; i++) file.read(_scrollFonts[0][i], 16); file.close(); - if (!file.open("avitalic.fnt")) { - warning("AVALANCHE: Scrolls: File not found: avitalic.fnt"); - return; - } + if (!file.open("avitalic.fnt")) + error("AVALANCHE: Scrolls: File not found: avitalic.fnt"); + for (int16 i = 0; i < 256; i++) file.read(_scrollFonts[1][i], 16); file.close(); - if (!file.open("ttsmall.fnt")) { - warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); - return; - } + if (!file.open("ttsmall.fnt")) + error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); + for (int16 i = 0; i < 256; i++) file.read(_vm->_gyro->_font[i],16); file.close(); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index dfc99d4cd59a..2354fe535a50 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -61,10 +61,8 @@ void Visa::doTheBubble() { */ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling) { Common::File indexfile; - if (!indexfile.open("avalot.idx")) { - warning("AVALANCHE: Visa: File not found: avalot.idx"); - return; - } + if (!indexfile.open("avalot.idx")) + error("AVALANCHE: Visa: File not found: avalot.idx"); bool error = false; @@ -91,10 +89,9 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling } Common::File sezfile; - if (!sezfile.open("avalot.sez")) { - warning("AVALANCHE: Visa: File not found: avalot.sez"); - return; - } + if (!sezfile.open("avalot.sez")) + error("AVALANCHE: Visa: File not found: avalot.sez"); + sezfile.seek(sez_offset); _vm->_gyro->_bufSize = sezfile.readUint16LE(); sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); @@ -121,10 +118,8 @@ void Visa::speak(byte who, byte subject) { _noError = false; // Assume that until we know otherwise. Common::File indexfile; - if (!indexfile.open("converse.avd")) { - warning("AVALANCHE: Visa: File not found: converse.avd"); - return; - } + if (!indexfile.open("converse.avd")) + error("AVALANCHE: Visa: File not found: converse.avd"); indexfile.seek(who * 2 - 2); uint16 idx_offset = indexfile.readUint16LE(); @@ -140,10 +135,9 @@ void Visa::speak(byte who, byte subject) { indexfile.close(); Common::File sezfile; - if (!sezfile.open("avalot.sez")) { - warning("AVALANCHE: Visa: File not found: avalot.sez"); - return; - } + if (!sezfile.open("avalot.sez")) + error("AVALANCHE: Visa: File not found: avalot.sez"); + sezfile.seek(sez_offset); _vm->_gyro->_bufSize = sezfile.readUint16LE(); sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); From 5e59ade554312ac841d620ccb92f38b15419dd9a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 08:31:57 +0200 Subject: [PATCH 0943/1332] AVALANCHE: Fix compilation --- engines/avalanche/visa2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 2354fe535a50..931f10f9ae68 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -90,7 +90,7 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling Common::File sezfile; if (!sezfile.open("avalot.sez")) - error("AVALANCHE: Visa: File not found: avalot.sez"); + ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); _vm->_gyro->_bufSize = sezfile.readUint16LE(); From 59532fd567ab05bde42768069f9c00de4781dada Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 13 Sep 2013 17:07:26 +0200 Subject: [PATCH 0944/1332] AVALANCHE: Fix crash. --- engines/avalanche/lucerna2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 784c83ed7d64..82aabe2bd6bf 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -230,7 +230,7 @@ void Lucerna::loadAlso(byte num) { _vm->_gyro->_also[i][j] = new Common::String; *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } - tmpStr = Common::String::format("\x9D%s\x9D", *_vm->_gyro->_also[i][0]->c_str()); + tmpStr = Common::String::format("\x9D%s\x9D", _vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } @@ -285,7 +285,7 @@ void Lucerna::loadAlso(byte num) { file.close(); unScramble(); for (byte i = 0; i <= alsoNum; i++) { - tmpStr = Common::String::format(",%s,", *_vm->_gyro->_also[i][0]->c_str()); + tmpStr = Common::String::format(",%s,", _vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } } From 44ff5eeafb14b85f89d9d2d234af7a19a20d997b Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 13 Sep 2013 17:27:24 +0200 Subject: [PATCH 0945/1332] AVALANCHE: Remove unnecessary error() call. --- engines/avalanche/celer2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index acbe5e9eadb4..10c2efce4141 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -268,7 +268,7 @@ void Celer::loadBackgroundSprites(byte number) { Common::File f; _filename = _filename.format("chunk%d.avd", number); if (!f.open(_filename)) - error("AVALANCHE: Celer: File not found: %s", _filename.c_str()); + return; // We skip because some rooms don't have sprites in the background. f.seek(44); _spriteNum = f.readByte(); From 82e76e7b5391ae87dc44d7986b2dfd40c53c3fc8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 21:30:03 +0200 Subject: [PATCH 0946/1332] AVALANCHE: Remove DNA structure which was essentially a savegame structure unused in ScummVM --- engines/avalanche/acci2.cpp | 350 ++++++++++++++++---------------- engines/avalanche/animation.cpp | 168 +++++++-------- engines/avalanche/avalanche.cpp | 186 ++++++++--------- engines/avalanche/avalot.cpp | 4 +- engines/avalanche/celer2.cpp | 46 ++--- engines/avalanche/dropdown2.cpp | 16 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/gyro2.cpp | 137 ++++++++++--- engines/avalanche/gyro2.h | 142 ++++++------- engines/avalanche/lucerna2.cpp | 192 +++++++++--------- engines/avalanche/scrolls2.cpp | 42 ++-- engines/avalanche/sequence2.cpp | 10 +- engines/avalanche/timer.cpp | 104 +++++----- engines/avalanche/visa2.cpp | 40 ++-- 14 files changed, 761 insertions(+), 678 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1b6446c09dc5..747bcca5b42b 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -249,7 +249,7 @@ Common::String Acci::rank() { }; for (byte i = 0; i < 8; i++) { - if ((_vm->_gyro->_dna._score >= kRanks[i]._score) && (_vm->_gyro->_dna._score < kRanks[i + 1]._score)) { + if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } } @@ -261,7 +261,7 @@ Common::String Acci::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = floor(_vm->_gyro->_dna._totalTime / ticksInOneSec); // No. of seconds. + h = floor(_vm->_gyro->_totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; h /= 3600; s = m % 60; @@ -384,32 +384,32 @@ void Acci::storeInterrogation(byte interrogation) { case 1: _vm->_parser->_inputText.toLowercase(); sayIt(); - _vm->_gyro->_dna._favouriteDrink = _vm->_parser->_inputText; - _vm->_gyro->_dna._cardiffQuestionNum = 2; + _vm->_gyro->_favouriteDrink = _vm->_parser->_inputText; + _vm->_gyro->_cardiffQuestionNum = 2; break; case 2: properNouns(); sayIt(); - _vm->_gyro->_dna._favouriteSong = _vm->_parser->_inputText; - _vm->_gyro->_dna._cardiffQuestionNum = 3; + _vm->_gyro->_favouriteSong = _vm->_parser->_inputText; + _vm->_gyro->_cardiffQuestionNum = 3; break; case 3: properNouns(); sayIt(); - _vm->_gyro->_dna._worstPlaceOnEarth = _vm->_parser->_inputText; - _vm->_gyro->_dna._cardiffQuestionNum = 4; + _vm->_gyro->_worstPlaceOnEarth = _vm->_parser->_inputText; + _vm->_gyro->_cardiffQuestionNum = 4; break; case 4: _vm->_parser->_inputText.toLowercase(); sayIt(); - if (!_vm->_gyro->_dna._spareEvening.empty()) - _vm->_gyro->_dna._spareEvening.clear(); - _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; + if (!_vm->_gyro->_spareEvening.empty()) + _vm->_gyro->_spareEvening.clear(); + _vm->_gyro->_spareEvening = _vm->_parser->_inputText; _vm->_visa->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_dna._cardiffQuestionNum = 5; + _vm->_gyro->_cardiffQuestionNum = 5; break; case 99: //store_high(_vm->_parser->_inputText); @@ -531,12 +531,12 @@ void Acci::parse() { replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_gyro->_dna._room == r__nottspub) + if (_vm->_gyro->_room == r__nottspub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__aylesoffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; @@ -625,7 +625,7 @@ void Acci::examineObject() { _vm->_lucerna->thinkAbout(_thing, Gyro::kThing); switch (_thing) { case Gyro::kObjectWine : - switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine. + switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_visa->displayScrollChain('t', 1); // Normal examine wine scroll break; @@ -638,7 +638,7 @@ void Acci::examineObject() { } break; case Gyro::kObjectOnion: - if (_vm->_gyro->_dna._rottenOnion) + if (_vm->_gyro->_rottenOnion) _vm->_visa->displayScrollChain('q', 21); // Yucky onion. else _vm->_visa->displayScrollChain('t', 18); // Normal onion scroll @@ -649,7 +649,7 @@ void Acci::examineObject() { } bool Acci::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_dna._room)) + if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_room)) return true; else { Common::String tmpStr; @@ -669,13 +669,13 @@ void Acci::exampers() { _person -= 149; switch (_person) { // Special cases case 11: - if (_vm->_gyro->_dna._wonNim) { + if (_vm->_gyro->_wonNim) { _vm->_visa->displayScrollChain('Q', 8); // "I'm Not Playing!" return; } break; case 99: - if (_vm->_gyro->_dna._lustieIsAsleep) { + if (_vm->_gyro->_lustieIsAsleep) { _vm->_visa->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) return; } @@ -686,7 +686,7 @@ void Acci::exampers() { } // And afterwards... - if ((_person == 14) && (!_vm->_gyro->_dna._aylesIsAwake)) + if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) _vm->_visa->displayScrollChain('Q', 13); } @@ -702,7 +702,7 @@ bool Acci::isHolding() { if (_thing > 100) _vm->_scrolls->displayText("Be reasonable!"); - else if (!_vm->_gyro->_dna._objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_scrolls->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -711,7 +711,7 @@ bool Acci::isHolding() { } void Acci::openBox(bool isOpening) { - if ((_vm->_gyro->_dna._room == r__yours) && (_thing == 54)) { + if ((_vm->_gyro->_room == r__yours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); @@ -753,22 +753,22 @@ void Acci::inventory() { Common::String tmpStr = Common::String("You're carrying "); for (byte i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_dna._objects[i]) { + if (_vm->_gyro->_objects[i]) { itemNum++; - if (itemNum == _vm->_gyro->_dna._carryNum) + if (itemNum == _vm->_gyro->_carryNum) tmpStr += "and "; tmpStr += _vm->_gyro->getItem(i + 1); - if ((i + 1) == _vm->_gyro->_dna._wearing) + if ((i + 1) == _vm->_gyro->_wearing) tmpStr += ", which you're wearing"; - if (itemNum < _vm->_gyro->_dna._carryNum) + if (itemNum < _vm->_gyro->_carryNum) tmpStr += ", "; } } - if (_vm->_gyro->_dna._wearing == kNothing) + if (_vm->_gyro->_wearing == kNothing) tmpStr += Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); else tmpStr += '.'; @@ -779,16 +779,16 @@ void Acci::inventory() { void Acci::swallow() { // Eat something. switch (_thing) { case Gyro::kObjectWine: - switch (_vm->_gyro->_dna._wineState) { // 4 is perfect + switch (_vm->_gyro->_wineState) { // 4 is perfect case 1: - if (_vm->_gyro->_dna._teetotal) { + if (_vm->_gyro->_teetotal) { _vm->_visa->displayScrollChain('D', 6); return; } _vm->_visa->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_visa->displayScrollChain('U', 2); - _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; @@ -815,16 +815,16 @@ void Acci::swallow() { // Eat something. _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: - if (_vm->_gyro->_dna._rottenOnion) + if (_vm->_gyro->_rottenOnion) _vm->_visa->displayScrollChain('U', 11); else { _vm->_visa->displayScrollChain('U', 8); - _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } break; default: - if ((_vm->_gyro->_dna._room == r__argentpub) || (_vm->_gyro->_dna._room == r__nottspub)) + if ((_vm->_gyro->_room == r__argentpub) || (_vm->_gyro->_room == r__nottspub)) _vm->_scrolls->displayText("Try BUYing things before you drink them!"); else _vm->_scrolls->displayText("The taste of it makes you retch!"); @@ -835,7 +835,7 @@ void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) numPeople++; } @@ -845,7 +845,7 @@ void Acci::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (byte i = 1; i < 29; i++) { - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) { + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { actPerson++; if (actPerson == 1) // First on the list. tmpStr = _vm->_gyro->getName(i + 150); @@ -866,29 +866,29 @@ void Acci::peopleInRoom() { void Acci::lookAround() { _vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]); - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__spludwicks: - if (_vm->_gyro->_dna._avariciusTalk > 0) + if (_vm->_gyro->_avariciusTalk > 0) _vm->_visa->displayScrollChain('q', 23); else peopleInRoom(); break; case r__robins: - if (_vm->_gyro->_dna._tiedUp) + if (_vm->_gyro->_tiedUp) _vm->_visa->displayScrollChain('q', 38); - if (_vm->_gyro->_dna._mushroomGrowing) + if (_vm->_gyro->_mushroomGrowing) _vm->_visa->displayScrollChain('q', 55); break; case r__insidecardiffcastle: - if (!_vm->_gyro->_dna._takenPen) + if (!_vm->_gyro->_takenPen) _vm->_visa->displayScrollChain('q', 49); break; case r__lustiesroom: - if (_vm->_gyro->_dna._lustieIsAsleep) + if (_vm->_gyro->_lustieIsAsleep) _vm->_visa->displayScrollChain('q', 65); break; case r__catacombs: - switch (_vm->_gyro->_dna._catacombY * 256 + _vm->_gyro->_dna._catacombX) { + switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : _vm->_visa->displayScrollChain('q', 80); // Inside art gallery. break; @@ -907,7 +907,7 @@ void Acci::lookAround() { void Acci::openDoor() { // Special cases. - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__yours: if (_vm->_animation->inField(2)) { // Opening the box. @@ -925,7 +925,7 @@ void Acci::openDoor() { break; } - if ((!_vm->_gyro->_dna._userMovesAvvy) && (_vm->_gyro->_dna._room != r__lusties)) + if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != r__lusties)) return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) { @@ -958,7 +958,7 @@ void Acci::openDoor() { } } - if (_vm->_gyro->_dna._room == r__map) + if (_vm->_gyro->_room == r__map) _vm->_scrolls->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else @@ -986,14 +986,14 @@ void Acci::putProc() { switch (_thing2) { case Gyro::kObjectWine: if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_dna._rottenOnion) + if (_vm->_gyro->_rottenOnion) _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_gyro->_dna._wineState != 3) { + if (_vm->_gyro->_wineState != 3) { Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman); _vm->_scrolls->displayText(tmpStr); } else { // Put onion into vinegar! Yes! - _vm->_gyro->_dna._onionInVinegar = true; + _vm->_gyro->_onionInVinegar = true; _vm->_lucerna->incScore(7); _vm->_visa->displayScrollChain('u', 9); } @@ -1003,8 +1003,8 @@ void Acci::putProc() { break; case 54: - if (_vm->_gyro->_dna._room == r__yours) { // Put something into the box. - if (_vm->_gyro->_dna._boxContent != kNothing) + if (_vm->_gyro->_room == r__yours) { // Put something into the box. + if (_vm->_gyro->_boxContent != kNothing) _vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { @@ -1021,14 +1021,14 @@ void Acci::putProc() { _vm->_scrolls->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_gyro->_dna._wearing == _thing) { + if (_vm->_gyro->_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); _vm->_scrolls->displayText(tmpStr); } else { openBox(true); // Open box. - _vm->_gyro->_dna._boxContent = _thing; - _vm->_gyro->_dna._objects[_thing - 1] = false; + _vm->_gyro->_boxContent = _thing; + _vm->_gyro->_objects[_thing - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_scrolls->displayText("OK, it's in the box."); @@ -1050,7 +1050,7 @@ void Acci::putProc() { * @remarks Originally called 'not_in_order' */ void Acci::notInOrder() { - Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]); + Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ "What I need next is %s%c2%c", itemStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); @@ -1071,18 +1071,18 @@ void Acci::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Acci::giveToSpludwick() { - if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick] != _thing) { + if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick] != _thing) { notInOrder(); return false; } switch (_thing) { case Gyro::kObjectOnion: - _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = false; - if (_vm->_gyro->_dna._rottenOnion) + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; + if (_vm->_gyro->_rottenOnion) _vm->_visa->displayScrollChain('q', 22); else { - _vm->_gyro->_dna._givenToSpludwick++; + _vm->_gyro->_givenToSpludwick++; _vm->_visa->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); @@ -1090,20 +1090,20 @@ bool Acci::giveToSpludwick() { _vm->_lucerna->refreshObjectList(); break; case Gyro::kObjectInk: - _vm->_gyro->_dna._objects[Gyro::kObjectInk - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_dna._givenToSpludwick++; + _vm->_gyro->_givenToSpludwick++; _vm->_visa->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: - _vm->_gyro->_dna._objects[Gyro::kObjectMushroom - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; _vm->_visa->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); - _vm->_gyro->_dna._givenToSpludwick++; + _vm->_gyro->_givenToSpludwick++; goToCauldron(); - _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; _vm->_lucerna->refreshObjectList(); break; default: @@ -1114,12 +1114,12 @@ bool Acci::giveToSpludwick() { } void Acci::drink() { - _vm->_gyro->_dna._alcoholLevel += 1; - if (_vm->_gyro->_dna._alcoholLevel == 5) { - _vm->_gyro->_dna._objects[Gyro::kObjectKey - 1] = true; // Get the key. - _vm->_gyro->_dna._teetotal = true; - _vm->_gyro->_dna._avvyIsAwake = false; - _vm->_gyro->_dna._avvyInBed = true; + _vm->_gyro->_alcoholLevel += 1; + if (_vm->_gyro->_alcoholLevel == 5) { + _vm->_gyro->_objects[Gyro::kObjectKey - 1] = true; // Get the key. + _vm->_gyro->_teetotal = true; + _vm->_gyro->_avvyIsAwake = false; + _vm->_gyro->_avvyInBed = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); @@ -1130,14 +1130,14 @@ void Acci::drink() { } void Acci::cardiffClimbing() { - if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. + if (_vm->_gyro->_standingOnDais) { // Clamber up. _vm->_scrolls->displayText("You climb down, back onto the floor."); - _vm->_gyro->_dna._standingOnDais = false; + _vm->_gyro->_standingOnDais = false; _vm->_animation->appearPed(1, 3); } else { // Clamber down. if (_vm->_animation->inField(1)) { _vm->_scrolls->displayText("You clamber up onto the dais."); - _vm->_gyro->_dna._standingOnDais = true; + _vm->_gyro->_standingOnDais = true; _vm->_animation->appearPed(1, 2); } else _vm->_scrolls->displayText("Get a bit closer, Avvy."); @@ -1149,21 +1149,21 @@ void Acci::already() { } void Acci::standUp() { - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__yours: // Avvy isn't asleep. - if (_vm->_gyro->_dna._avvyIsAwake && _vm->_gyro->_dna._avvyInBed) { // But he's in bed. - if (_vm->_gyro->_dna._teetotal) { + if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. + if (_vm->_gyro->_teetotal) { _vm->_visa->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); _vm->_visa->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; - _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_userMovesAvvy = true; _vm->_animation->appearPed(1, 2); - _vm->_gyro->_dna._direction = Gyro::kDirectionLeft; + _vm->_gyro->_direction = Gyro::kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); - _vm->_gyro->_dna._avvyInBed = false; + _vm->_gyro->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); } else already(); @@ -1174,12 +1174,12 @@ void Acci::standUp() { break; case r__nottspub: - if (_vm->_gyro->_dna._sittingInPub) { + if (_vm->_gyro->_sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(1, 4); // And walking away. - _vm->_gyro->_dna._sittingInPub = false; // Really not sitting down. - _vm->_gyro->_dna._userMovesAvvy = true; // And ambulant. + _vm->_gyro->_sittingInPub = false; // Really not sitting down. + _vm->_gyro->_userMovesAvvy = true; // And ambulant. } else already(); break; @@ -1189,15 +1189,15 @@ void Acci::standUp() { } void Acci::getProc(char thing) { - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__yours: if (_vm->_animation->inField(2)) { - if (_vm->_gyro->_dna._boxContent == thing) { + if (_vm->_gyro->_boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->displayText("OK, I've got it."); - _vm->_gyro->_dna._objects[thing - 1] = true; + _vm->_gyro->_objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_dna._boxContent = kNothing; + _vm->_gyro->_boxContent = kNothing; _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); @@ -1210,18 +1210,18 @@ void Acci::getProc(char thing) { switch (thing) { case Gyro::kObjectPen: if (_vm->_animation->inField(2)) { // Standing on the dais. - if (_vm->_gyro->_dna._takenPen) + if (_vm->_gyro->_takenPen) _vm->_scrolls->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. _vm->_animation->callSpecial(3); // Zap! - _vm->_gyro->_dna._takenPen = true; - _vm->_gyro->_dna._objects[Gyro::kObjectPen - 1] = true; + _vm->_gyro->_takenPen = true; + _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_scrolls->displayText("Taken."); } - } else if (_vm->_gyro->_dna._standingOnDais) + } else if (_vm->_gyro->_standingOnDais) _vm->_visa->displayScrollChain('q', 53); else _vm->_visa->displayScrollChain('q', 51); @@ -1234,12 +1234,12 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { + if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->displayText("Got it!"); - _vm->_gyro->_dna._mushroomGrowing = false; - _vm->_gyro->_dna._takenMushroom = true; - _vm->_gyro->_dna._objects[Gyro::kObjectMushroom - 1] = true; + _vm->_gyro->_mushroomGrowing = false; + _vm->_gyro->_takenMushroom = true; + _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else @@ -1255,12 +1255,12 @@ void Acci::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Acci::giveGeidaTheLute() { - if (_vm->_gyro->_dna._room != r__lustiesroom) { + if (_vm->_gyro->_room != r__lustiesroom) { Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); return; } - _vm->_gyro->_dna._objects[Gyro::kObjectLute - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_visa->displayScrollChain('q', 64); // She plays it. @@ -1286,13 +1286,13 @@ void Acci::winSequence() { Common::String Acci::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_dna._room)) + if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_room)) _person = _vm->_gyro->_her; else _person = _vm->_gyro->_him; } - if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) { + if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { return Common::String::format("%c1", Scrolls::kControlRegister); // Avvy himself! } @@ -1310,7 +1310,7 @@ Common::String Acci::personSpeaks() { return tmpStr; for (byte i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) + if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); } @@ -1320,7 +1320,7 @@ void Acci::heyThanks() { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); - _vm->_gyro->_dna._objects[_thing - 1] = false; + _vm->_gyro->_objects[_thing - 1] = false; } /** @@ -1350,7 +1350,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } - if (!_vm->_gyro->_dna._avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_scrolls->displayText("Talking in your sleep? Try waking up!"); return; } @@ -1370,7 +1370,7 @@ void Acci::doThat() { break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_gyro->_dna._carryNum >= kCarryLimit) + if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("You can't carry any more!"); else getProc(_thing); @@ -1433,7 +1433,7 @@ void Acci::doThat() { case Gyro::kPeopleCrapulus: if (_thing == Gyro::kObjectWine) { _vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; } else heyThanks(); break; @@ -1451,21 +1451,21 @@ void Acci::doThat() { if (_thing == Gyro::kObjectBadge) { _vm->_visa->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); - _vm->_gyro->_dna._objects[Gyro::kObjectBadge - 1] = false; - _vm->_gyro->_dna._objects[Gyro::kObjectHabit - 1] = true; - _vm->_gyro->_dna._givenBadgeToIby = true; + _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; + _vm->_gyro->_givenBadgeToIby = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); } else heyThanks(); break; case Gyro::kPeopleAyles: - if (_vm->_gyro->_dna._aylesIsAwake) { + if (_vm->_gyro->_aylesIsAwake) { if (_thing == Gyro::kObjectPen) { - _vm->_gyro->_dna._objects[Gyro::kObjectPen - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; _vm->_visa->displayScrollChain('q', 54); - _vm->_gyro->_dna._objects[Gyro::kObjectInk - 1] = true; - _vm->_gyro->_dna._givenPenToAyles = true; + _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; + _vm->_gyro->_givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(2); } else @@ -1476,10 +1476,10 @@ void Acci::doThat() { case Gyro::kPeopleGeida: switch (_thing) { case Gyro::kObjectPotion: - _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; _vm->_visa->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); - _vm->_gyro->_dna._givenPotionToGeida = true; + _vm->_gyro->_givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); break; case Gyro::kObjectLute: @@ -1492,7 +1492,7 @@ void Acci::doThat() { case Gyro::kPeopleArkata: switch (_thing) { case Gyro::kObjectPotion: - if (_vm->_gyro->_dna._givenPotionToGeida) + if (_vm->_gyro->_givenPotionToGeida) winSequence(); else _vm->_visa->displayScrollChain('q', 77); // That Geida woman! @@ -1562,12 +1562,12 @@ void Acci::doThat() { } break; case kVerbCodeUndress: - if (_vm->_gyro->_dna._wearing == kNothing) + if (_vm->_gyro->_wearing == kNothing) _vm->_scrolls->displayText("You're already stark naked!"); - else if (_vm->_gyro->_dna._avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_dna._wearing).c_str()); + else if (_vm->_gyro->_avvysInTheCupboard) { + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); _vm->_scrolls->displayText(tmpStr); - _vm->_gyro->_dna._wearing = kNothing; + _vm->_gyro->_wearing = kNothing; _vm->_lucerna->refreshObjectList(); } else _vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?"); @@ -1581,14 +1581,14 @@ void Acci::doThat() { break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! - if (_vm->_gyro->_dna._wearing != kNothing) { - if (_vm->_gyro->_dna._wearing == _thing) + if (_vm->_gyro->_wearing != kNothing) { + if (_vm->_gyro->_wearing == _thing) _vm->_scrolls->displayText("You're already wearing that."); else _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_gyro->_dna._wearing = _thing; + _vm->_gyro->_wearing = _thing; _vm->_lucerna->refreshObjectList(); @@ -1614,35 +1614,35 @@ void Acci::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_gyro->_dna._room) { // They just typed "play"... + switch (_vm->_gyro->_room) { // They just typed "play"... case r__argentpub: { // ...in the pub, => play Nim. warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_gyro->_dna._wonNim) { // Already won the game. + if (_vm->_gyro->_wonNim) { // Already won the game. _vm->_visa->displayScrollChain('Q', 6); return; } - if (!_vm->_gyro->_dna._askedDogfoodAboutNim) { + if (!_vm->_gyro->_askedDogfoodAboutNim) { _vm->_visa->displayScrollChain('q', 84); return; } _vm->_visa->displayScrollChain('Q', 3); - _vm->_gyro->_dna._playedNim++; + _vm->_gyro->_playedNim++; // You won - strange! _vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_dna._objects[Gyro::kObjectLute - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_dna._wonNim = true; + _vm->_gyro->_wonNim = true; _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. _vm->_lucerna->incScore(7); // 7 points for winning! - if (_vm->_gyro->_dna._playedNim == 1) + if (_vm->_gyro->_playedNim == 1) _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! @@ -1659,20 +1659,20 @@ void Acci::doThat() { case Gyro::kObjectLute : _vm->_visa->displayScrollChain('U', 7); - if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_dna._room) + if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) _vm->_visa->displayScrollChain('U', 10); - if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_dna._room) + if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) _vm->_visa->displayScrollChain('U', 15); break; case 52: - if (_vm->_gyro->_dna._room == r__musicroom) + if (_vm->_gyro->_room == r__musicroom) playHarp(); else _vm->_scrolls->displayText(kWhat); break; case 55: - if (_vm->_gyro->_dna._room == r__argentpub) + if (_vm->_gyro->_room == r__argentpub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); else @@ -1687,7 +1687,7 @@ void Acci::doThat() { if (isHolding()) { if (_thing == Gyro::kObjectBell) { _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_scrolls->displayText("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1724,10 +1724,10 @@ void Acci::doThat() { } break; case kVerbCodeMagic: - if (_vm->_gyro->_dna._avariciusTalk > 0) + if (_vm->_gyro->_avariciusTalk > 0) _vm->_visa->displayScrollChain('q', 19); else { - if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! + if ((_vm->_gyro->_room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! _vm->_visa->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->displayScrollChain('q', 18); @@ -1737,7 +1737,7 @@ void Acci::doThat() { _vm->_animation->_sprites[1].walkTo(5); _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcBackAndForth; - _vm->_gyro->_dna._avariciusTalk = 14; + _vm->_gyro->_avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else @@ -1748,7 +1748,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: - switch (_vm->_gyro->_dna._sworeNum) { + switch (_vm->_gyro->_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ "(I shouldn't say it again, if I were you!)", Scrolls::kControlNewLine, Scrolls::kControlNewLine); @@ -1769,10 +1769,10 @@ void Acci::doThat() { _vm->_lucerna->gameOver(); } } - _vm->_gyro->_dna._sworeNum++; + _vm->_gyro->_sworeNum++; break; case kVerbCodeListen: - if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) _vm->_scrolls->displayText("All other noise is drowned out by the ringing of the bells."); else if (_vm->_gyro->_listen.empty()) _vm->_scrolls->displayText("You can't hear anything much at the moment, Avvy."); @@ -1780,7 +1780,7 @@ void Acci::doThat() { _vm->_scrolls->displayText(_vm->_gyro->_listen); break; case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__argentpub: if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar. switch (_thing) { @@ -1788,40 +1788,40 @@ void Acci::doThat() { case 53: case 54: case 58: // Beer, whisky, cider or mead. - if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. + if (_vm->_gyro->_malagauche == 177) { // Already getting us one. _vm->_visa->displayScrollChain('D', 15); return; } - if (_vm->_gyro->_dna._teetotal) { + if (_vm->_gyro->_teetotal) { _vm->_visa->displayScrollChain('D', 6); return; } - if (_vm->_gyro->_dna._alcoholLevel == 0) + if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); - _vm->_gyro->_dna._drinking = _thing; + _vm->_gyro->_drinking = _thing; _vm->_celer->drawBackgroundSprite(-1, -1, 10); - _vm->_gyro->_dna._malagauche = 177; + _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: - if (_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]) // We've already got the wine! + if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! _vm->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent! else { - if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one. + if (_vm->_gyro->_malagauche == 177) { // Already getting us one. _vm->_visa->displayScrollChain('D', 15); return; } - if (_vm->_gyro->_dna._carryNum >= kCarryLimit) { + if (_vm->_gyro->_carryNum >= kCarryLimit) { _vm->_scrolls->displayText("Your hands are full."); return; } @@ -1829,10 +1829,10 @@ void Acci::doThat() { _vm->_celer->drawBackgroundSprite(-1, -1, 12); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); - if (_vm->_gyro->_dna._alcoholLevel == 0) + if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_celer->drawBackgroundSprite(-1, -1, 10); - _vm->_gyro->_dna._malagauche = 177; + _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); } @@ -1845,23 +1845,23 @@ void Acci::doThat() { case r__outsideducks: if (_vm->_animation->inField(6)) { if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]) + if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! - else if (_vm->_gyro->_dna._carryNum >= kCarryLimit) + else if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); else { - if (_vm->_gyro->_dna._boughtOnion) + if (_vm->_gyro->_boughtOnion) _vm->_visa->displayScrollChain('D', 11); else { _vm->_visa->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. - _vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_dna._boughtOnion = true; - _vm->_gyro->_dna._rottenOnion = false; // It's OK when it leaves the stall! - _vm->_gyro->_dna._onionInVinegar = false; + _vm->_gyro->_boughtOnion = true; + _vm->_gyro->_rottenOnion = false; // It's OK when it leaves the stall! + _vm->_gyro->_onionInVinegar = false; } } else _vm->_visa->displayScrollChain('D', 0); @@ -1877,10 +1877,10 @@ void Acci::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_gyro->_dna._room == r__brummieroad) && + if ((_vm->_gyro->_room == r__brummieroad) && ((_person == 157) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_dna._room)) { - switch (_vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] * 2) { + && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_room)) { + switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_visa->displayScrollChain('Q', 10); @@ -1894,9 +1894,9 @@ void Acci::doThat() { break; case 3: _vm->_visa->displayScrollChain('Q', 11); - _vm->_gyro->_dna._cwytalotGone = true; - _vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] = false; - _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] = false; + _vm->_gyro->_cwytalotGone = true; + _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; _vm->_lucerna->incScore(7); @@ -1912,14 +1912,14 @@ void Acci::doThat() { _vm->_visa->displayScrollChain('Q', 10); break; case kVerbCodePasswd: - if (_vm->_gyro->_dna._room != r__bridge) + if (_vm->_gyro->_room != r__bridge) _vm->_visa->displayScrollChain('Q', 12); else { bool ok = true; for (byte i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - int pwdId = _vm->_gyro->_dna._passwordNum + kFirstPassword; + int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; for (byte j = 0; j < kVocabulary[pwdId]._word.size(); j++) { if (kVocabulary[pwdId]._word[j] != temp[j]) ok = false; @@ -1927,13 +1927,13 @@ void Acci::doThat() { } if (ok) { - if (_vm->_gyro->_dna._drawbridgeOpen != 0) + if (_vm->_gyro->_drawbridgeOpen != 0) _vm->_scrolls->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna->incScore(4); _vm->_scrolls->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); - _vm->_gyro->_dna._drawbridgeOpen = 1; + _vm->_gyro->_drawbridgeOpen = 1; } } else _vm->_visa->displayScrollChain('Q', 12); @@ -1946,7 +1946,7 @@ void Acci::doThat() { _vm->_lucerna->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dna._score, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str()); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str()); _vm->_scrolls->displayText(tmpStr); } break; @@ -1978,14 +1978,14 @@ void Acci::doThat() { break; case kVerbCodeClimb: - if (_vm->_gyro->_dna._room == r__insidecardiffcastle) + if (_vm->_gyro->_room == r__insidecardiffcastle) cardiffClimbing(); else // In the wrong room! _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; break; case kVerbCodeHiscores: // show_highs(); @@ -1997,18 +1997,18 @@ void Acci::doThat() { case kPardon: case Gyro::kPeopleAvalot: case 0: - if (!_vm->_gyro->_dna._avvyIsAwake) { - _vm->_gyro->_dna._avvyIsAwake = true; + if (!_vm->_gyro->_avvyIsAwake) { + _vm->_gyro->_avvyIsAwake = true; _vm->_lucerna->incScore(1); - _vm->_gyro->_dna._avvyInBed = true; + _vm->_gyro->_avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. - if (_vm->_gyro->_dna._teetotal) + if (_vm->_gyro->_teetotal) _vm->_visa->displayScrollChain('d', 13); } else _vm->_scrolls->displayText("You're already awake, Avvy!"); break; case Gyro::kPeopleAyles: - if (!_vm->_gyro->_dna._aylesIsAwake) + if (!_vm->_gyro->_aylesIsAwake) _vm->_scrolls->displayText("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: { @@ -2022,8 +2022,8 @@ void Acci::doThat() { } break; case kVerbCodeSit: - if (_vm->_gyro->_dna._room == r__nottspub) { - if (_vm->_gyro->_dna._sittingInPub) + if (_vm->_gyro->_room == r__nottspub) { + if (_vm->_gyro->_sittingInPub) _vm->_scrolls->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down. diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 57353255db86..bdca9fdcf17b 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -436,8 +436,8 @@ void Animation::catacombMove(byte ped) { - xy_uint16 = _vm->_gyro->_dna._catacombX + _vm->_gyro->_dna._catacombY * 256; - _vm->_gyro->_dna._geidaSpin = 0; + xy_uint16 = _vm->_gyro->_catacombX + _vm->_gyro->_catacombY * 256; + _vm->_gyro->_geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs @@ -456,15 +456,15 @@ void Animation::catacombMove(byte ped) { case 2307: flipRoom(r__lusties, 5); _vm->_scrolls->displayText("Oh no... here we go again..."); - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; return; } - if (!_vm->_gyro->_dna._enterCatacombsFromLustiesRoom) + if (!_vm->_gyro->_enterCatacombsFromLustiesRoom) _vm->_lucerna->loadRoom(29); - here = _vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1]; + here = _vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) @@ -595,7 +595,7 @@ void Animation::catacombMove(byte ped) { case 0x1: _vm->_celer->drawBackgroundSprite(-1, -1, 22); - if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) + if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) _vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; else _vm->_gyro->_magics[12]._operation = Gyro::kMagicSpecial; // Right exit south. @@ -726,7 +726,7 @@ void Animation::catacombMove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { + if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. appearPed(2, geidaPed(ped)); @@ -746,27 +746,27 @@ void Animation::callSpecial(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_dna._brummieStairs = 1; + _vm->_gyro->_brummieStairs = 1; _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; break; case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. - _vm->_gyro->_dna._brummieStairs = 3; + _vm->_gyro->_brummieStairs = 3; _vm->_gyro->_magics[10]._operation = Gyro::kMagicNothing; _vm->_gyro->_magics[11]._operation = Gyro::kMagicExclaim; _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! stopWalking(); _vm->_visa->displayScrollChain('q', 26); - _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. _sprites[0].bounce(); // Must include that. - if (!_vm->_gyro->_dna._arrowTriggered) { - _vm->_gyro->_dna._arrowTriggered = true; + if (!_vm->_gyro->_arrowTriggered) { + _vm->_gyro->_arrowTriggered = true; appearPed(2, 4); // The dart starts at ped 4, and... _sprites[1].walkTo(5); // flies to ped 5. _sprites[1]._facingDir = kDirUp; // Only face. @@ -786,7 +786,7 @@ void Animation::callSpecial(uint16 which) { _vm->_enid->backToBootstrap(3); break; case 5: - if (_vm->_gyro->_dna._friarWillTieYouUp) { + if (_vm->_gyro->_friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. _vm->_visa->displayScrollChain('q', 35); @@ -794,8 +794,8 @@ void Animation::callSpecial(uint16 which) { //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->displayScrollChain('q', 36); - _vm->_gyro->_dna._tiedUp = true; - _vm->_gyro->_dna._friarWillTieYouUp = false; + _vm->_gyro->_tiedUp = true; + _vm->_gyro->_friarWillTieYouUp = false; _sprites[1].walkTo(3); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. @@ -804,7 +804,7 @@ void Animation::callSpecial(uint16 which) { } break; case 6: // _vm->_gyro->special 6: fall down oubliette. - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; _sprites[0]._moveX = 3; _sprites[0]._moveY = 0; _sprites[0]._facingDir = kDirRight; @@ -821,7 +821,7 @@ void Animation::callSpecial(uint16 which) { _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. - if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { + if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { _vm->_visa->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); @@ -830,18 +830,18 @@ void Animation::callSpecial(uint16 which) { } break; case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... - if (!_vm->_gyro->_dna._geidaFollows) + if (!_vm->_gyro->_geidaFollows) return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1].walkTo(4); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; case 10: // _vm->_gyro->special 10: transfer north in catacombs. - if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { + if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { // Into Geida's room. - if (_vm->_gyro->_dna._objects[Gyro::kObjectKey - 1]) + if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) _vm->_visa->displayScrollChain('q', 62); else { _vm->_visa->displayScrollChain('q', 61); @@ -849,11 +849,11 @@ void Animation::callSpecial(uint16 which) { } } _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombY--; + _vm->_gyro->_catacombY--; catacombMove(4); - if (_vm->_gyro->_dna._room != r__catacombs) + if (_vm->_gyro->_room != r__catacombs) return; - switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { + switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { case 0x1: appearPed(1, 12); break; @@ -867,27 +867,27 @@ void Animation::callSpecial(uint16 which) { break; case 11: // _vm->_gyro->special 11: transfer east in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombX++; + _vm->_gyro->_catacombX++; catacombMove(1); - if (_vm->_gyro->_dna._room != r__catacombs) + if (_vm->_gyro->_room != r__catacombs) return; appearPed(1, 1); dawnDelay(); break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombY += 1; + _vm->_gyro->_catacombY += 1; catacombMove(2); - if (_vm->_gyro->_dna._room != r__catacombs) + if (_vm->_gyro->_room != r__catacombs) return; appearPed(1, 2); dawnDelay(); break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombX--; + _vm->_gyro->_catacombX--; catacombMove(3); - if (_vm->_gyro->_dna._room != r__catacombs) + if (_vm->_gyro->_room != r__catacombs) return; appearPed(1, 3); dawnDelay(); @@ -903,7 +903,7 @@ void Animation::callSpecial(uint16 which) { * @remarks Originally called 'open_the_door' */ void Animation::openDoor(byte whither, byte ped, byte magicnum) { - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__outsideyours: case r__outsidenottspub: case r__outsideducks: @@ -930,7 +930,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { case r__lusties: switch (magicnum) { case 14: - if (_vm->_gyro->_dna._avvysInTheCupboard) { + if (_vm->_gyro->_avvysInTheCupboard) { hideInCupboard(); _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); @@ -1080,13 +1080,13 @@ void Animation::arrowProcs(byte tripnum) { #endif _vm->_lucerna->gameOver(); - _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. + _vm->_gyro->_userMovesAvvy = false; // Stop the user from moving him. _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. - _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. + _vm->_gyro->_arrowInTheDoor = true; // So that we can pick it up. } } @@ -1145,21 +1145,21 @@ void Animation::spin(byte whichway, byte &tripnum) { if (_sprites[tripnum]._id == 2) return; // Not for Spludwick - _vm->_gyro->_dna._geidaSpin += 1; - _vm->_gyro->_dna._geidaTime = 20; - if (_vm->_gyro->_dna._geidaSpin == 5) { + _vm->_gyro->_geidaSpin += 1; + _vm->_gyro->_geidaTime = 20; + if (_vm->_gyro->_geidaSpin == 5) { _vm->_scrolls->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_gyro->_dna._geidaSpin = 0; - _vm->_gyro->_dna._geidaTime = 0; // knock out records + _vm->_gyro->_geidaSpin = 0; + _vm->_gyro->_geidaTime = 0; // knock out records } } } void Animation::geidaProcs(byte tripnum) { - if (_vm->_gyro->_dna._geidaTime > 0) { - _vm->_gyro->_dna._geidaTime--; - if (_vm->_gyro->_dna._geidaTime == 0) - _vm->_gyro->_dna._geidaSpin = 0; + if (_vm->_gyro->_geidaTime > 0) { + _vm->_gyro->_geidaTime--; + if (_vm->_gyro->_geidaTime == 0) + _vm->_gyro->_geidaSpin = 0; } if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { @@ -1279,7 +1279,7 @@ void Animation::animLink() { void Animation::stopWalking() { _sprites[0].stopWalk(); - _vm->_gyro->_dna._direction = kDirStopped; + _vm->_gyro->_direction = kDirStopped; if (_vm->_gyro->_alive) _sprites[0]._stepNum = 1; } @@ -1289,16 +1289,16 @@ void Animation::stopWalking() { * @remarks Originally called 'hide_in_the_cupboard' */ void Animation::hideInCupboard() { - if (_vm->_gyro->_dna._avvysInTheCupboard) { - if (_vm->_gyro->_dna._wearing == Acci::kNothing) { + if (_vm->_gyro->_avvysInTheCupboard) { + if (_vm->_gyro->_wearing == Acci::kNothing) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Scrolls::kControlItalic, Scrolls::kControlRoman); _vm->_scrolls->displayText(tmpStr); } else { _sprites[0]._visible = true; - _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_userMovesAvvy = true; appearPed(1, 3); // Walk out of the cupboard. _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); - _vm->_gyro->_dna._avvysInTheCupboard = false; + _vm->_gyro->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); _vm->_sequence->startToClose(); @@ -1306,11 +1306,11 @@ void Animation::hideInCupboard() { } else { // Not hiding in the cupboard _sprites[0]._visible = false; - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); _vm->_scrolls->displayText(tmpStr); - _vm->_gyro->_dna._avvysInTheCupboard = true; + _vm->_gyro->_avvysInTheCupboard = true; _vm->_celer->drawBackgroundSprite(-1, -1, 8); } } @@ -1323,18 +1323,18 @@ void Animation::flipRoom(byte room, byte ped) { return; } - if ((room == 177) && (_vm->_gyro->_dna._room == r__lusties)) { + if ((room == 177) && (_vm->_gyro->_room == r__lusties)) { hideInCupboard(); return; } - if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { + if ((_vm->_gyro->_jumpStatus > 0) && (_vm->_gyro->_room == r__insidecardiffcastle)) { // You can't *jump* out of Cardiff Castle! _sprites[0]._moveX = 0; return; } - _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); + _vm->_lucerna->exitRoom(_vm->_gyro->_room); _vm->_lucerna->dusk(); for (int16 i = 1; i < kSpriteNumbMax; i++) { @@ -1342,14 +1342,14 @@ void Animation::flipRoom(byte room, byte ped) { _sprites[i].remove(); } // Deallocate sprite - if (_vm->_gyro->_dna._room == r__lustiesroom) - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; + if (_vm->_gyro->_room == r__lustiesroom) + _vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterRoom(room, ped); appearPed(1, ped); - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; - _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; - _vm->_gyro->_dna._direction = _sprites[0]._facingDir; + _vm->_gyro->_enterCatacombsFromLustiesRoom = false; + _vm->_gyro->_oldDirection = _vm->_gyro->_direction; + _vm->_gyro->_direction = _sprites[0]._facingDir; _vm->_lucerna->drawDirection(); _vm->_lucerna->dawn(); @@ -1385,7 +1385,7 @@ bool Animation::nearDoor() { } void Animation::handleMoveKey(const Common::Event &event) { - if (!_vm->_gyro->_dna._userMovesAvvy) + if (!_vm->_gyro->_userMovesAvvy) return; if (_vm->_dropdown->_activeMenuItem._activeNow) @@ -1393,58 +1393,58 @@ void Animation::handleMoveKey(const Common::Event &event) { else { switch (event.kbd.keycode) { case Common::KEYCODE_UP: - if (_vm->_gyro->_dna._direction != kDirUp) { - _vm->_gyro->_dna._direction = kDirUp; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirUp) { + _vm->_gyro->_direction = kDirUp; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_DOWN: - if (_vm->_gyro->_dna._direction != kDirDown) { - _vm->_gyro->_dna._direction = kDirDown; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirDown) { + _vm->_gyro->_direction = kDirDown; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_LEFT: - if (_vm->_gyro->_dna._direction != kDirLeft) { - _vm->_gyro->_dna._direction = kDirLeft; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirLeft) { + _vm->_gyro->_direction = kDirLeft; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_RIGHT: - if (_vm->_gyro->_dna._direction != kDirRight) { - _vm->_gyro->_dna._direction = kDirRight; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirRight) { + _vm->_gyro->_direction = kDirRight; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->_dna._direction != kDirUpRight) { - _vm->_gyro->_dna._direction = kDirUpRight; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirUpRight) { + _vm->_gyro->_direction = kDirUpRight; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->_dna._direction != kDirDownRight) { - _vm->_gyro->_dna._direction = kDirDownRight; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirDownRight) { + _vm->_gyro->_direction = kDirDownRight; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_END: - if (_vm->_gyro->_dna._direction != kDirDownLeft) { - _vm->_gyro->_dna._direction = kDirDownLeft; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirDownLeft) { + _vm->_gyro->_direction = kDirDownLeft; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; case Common::KEYCODE_HOME: - if (_vm->_gyro->_dna._direction != kDirUpLeft) { - _vm->_gyro->_dna._direction = kDirUpLeft; - changeDirection(0, _vm->_gyro->_dna._direction); + if (_vm->_gyro->_direction != kDirUpLeft) { + _vm->_gyro->_direction = kDirUpLeft; + changeDirection(0, _vm->_gyro->_direction); } else stopWalking(); break; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index ce3fb8eaf66c..611a8ef3a82b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,146 +123,146 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); - sz.syncAsByte(_gyro->_dna._direction); - sz.syncAsByte(_gyro->_dna._carryNum); + sz.syncAsByte(_gyro->_direction); + sz.syncAsByte(_gyro->_carryNum); for (byte i = 0; i < kObjectNum; i++) - sz.syncAsByte(_gyro->_dna._objects[i]); - sz.syncAsSint16LE(_gyro->_dna._score); - sz.syncAsSint32LE(_gyro->_dna._money); - sz.syncAsByte(_gyro->_dna._room); - sz.syncAsByte(_gyro->_dna._wearing); - sz.syncAsByte(_gyro->_dna._sworeNum); - sz.syncAsByte(_gyro->_dna._saveNum); - sz.syncBytes(_gyro->_dna._roomCount, 100); - sz.syncAsByte(_gyro->_dna._alcoholLevel); - sz.syncAsByte(_gyro->_dna._playedNim); - sz.syncAsByte(_gyro->_dna._wonNim); - sz.syncAsByte(_gyro->_dna._wineState); - sz.syncAsByte(_gyro->_dna._cwytalotGone); - sz.syncAsByte(_gyro->_dna._passwordNum); - sz.syncAsByte(_gyro->_dna._aylesIsAwake); - sz.syncAsByte(_gyro->_dna._drawbridgeOpen); - sz.syncAsByte(_gyro->_dna._avariciusTalk); - sz.syncAsByte(_gyro->_dna._boughtOnion); - sz.syncAsByte(_gyro->_dna._rottenOnion); - sz.syncAsByte(_gyro->_dna._onionInVinegar); - sz.syncAsByte(_gyro->_dna._givenToSpludwick); - sz.syncAsByte(_gyro->_dna._brummieStairs); - sz.syncAsByte(_gyro->_dna._cardiffQuestionNum); - sz.syncAsByte(_gyro->_dna._passedCwytalotInHerts); - sz.syncAsByte(_gyro->_dna._avvyIsAwake); - sz.syncAsByte(_gyro->_dna._avvyInBed); - sz.syncAsByte(_gyro->_dna._userMovesAvvy); - sz.syncAsByte(_gyro->_dna._dogFoodPos); - sz.syncAsByte(_gyro->_dna._givenBadgeToIby); - sz.syncAsByte(_gyro->_dna._friarWillTieYouUp); - sz.syncAsByte(_gyro->_dna._tiedUp); - sz.syncAsByte(_gyro->_dna._boxContent); - sz.syncAsByte(_gyro->_dna._talkedToCrapulus); - sz.syncAsByte(_gyro->_dna._jacquesState); - sz.syncAsByte(_gyro->_dna._bellsAreRinging); - sz.syncAsByte(_gyro->_dna._standingOnDais); - sz.syncAsByte(_gyro->_dna._takenPen); - sz.syncAsByte(_gyro->_dna._arrowTriggered); - sz.syncAsByte(_gyro->_dna._arrowInTheDoor); + sz.syncAsByte(_gyro->_objects[i]); + sz.syncAsSint16LE(_gyro->_dnascore); + sz.syncAsSint32LE(_gyro->_money); + sz.syncAsByte(_gyro->_room); + sz.syncAsByte(_gyro->_wearing); + sz.syncAsByte(_gyro->_sworeNum); + sz.syncAsByte(_gyro->_saveNum); + sz.syncBytes(_gyro->_roomCount, 100); + sz.syncAsByte(_gyro->_alcoholLevel); + sz.syncAsByte(_gyro->_playedNim); + sz.syncAsByte(_gyro->_wonNim); + sz.syncAsByte(_gyro->_wineState); + sz.syncAsByte(_gyro->_cwytalotGone); + sz.syncAsByte(_gyro->_passwordNum); + sz.syncAsByte(_gyro->_aylesIsAwake); + sz.syncAsByte(_gyro->_drawbridgeOpen); + sz.syncAsByte(_gyro->_avariciusTalk); + sz.syncAsByte(_gyro->_boughtOnion); + sz.syncAsByte(_gyro->_rottenOnion); + sz.syncAsByte(_gyro->_onionInVinegar); + sz.syncAsByte(_gyro->_givenToSpludwick); + sz.syncAsByte(_gyro->_brummieStairs); + sz.syncAsByte(_gyro->_cardiffQuestionNum); + sz.syncAsByte(_gyro->_passedCwytalotInHerts); + sz.syncAsByte(_gyro->_avvyIsAwake); + sz.syncAsByte(_gyro->_avvyInBed); + sz.syncAsByte(_gyro->_userMovesAvvy); + sz.syncAsByte(_gyro->_dogFoodPos); + sz.syncAsByte(_gyro->_givenBadgeToIby); + sz.syncAsByte(_gyro->_friarWillTieYouUp); + sz.syncAsByte(_gyro->_tiedUp); + sz.syncAsByte(_gyro->_boxContent); + sz.syncAsByte(_gyro->_talkedToCrapulus); + sz.syncAsByte(_gyro->_jacquesState); + sz.syncAsByte(_gyro->_bellsAreRinging); + sz.syncAsByte(_gyro->_standingOnDais); + sz.syncAsByte(_gyro->_takenPen); + sz.syncAsByte(_gyro->_arrowTriggered); + sz.syncAsByte(_gyro->_arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _gyro->_dna._favouriteDrink.size(); + uint16 like2drinkSize = _gyro->_favouriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _gyro->_dna._favouriteDrink[i]; + char actChr = _gyro->_favouriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _gyro->_dna._favouriteSong.size(); + uint16 favourite_songSize = _gyro->_favouriteSong.size(); sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _gyro->_dna._favouriteSong[i]; + char actChr = _gyro->_favouriteSong[i]; sz.syncAsByte(actChr); } - uint16 worst_place_on_earthSize = _gyro->_dna._worstPlaceOnEarth.size(); + uint16 worst_place_on_earthSize = _gyro->_worstPlaceOnEarth.size(); sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr = _gyro->_dna._worstPlaceOnEarth[i]; + char actChr = _gyro->_worstPlaceOnEarth[i]; sz.syncAsByte(actChr); } - uint16 spare_eveningSize = _gyro->_dna._spareEvening.size(); + uint16 spare_eveningSize = _gyro->_spareEvening.size(); sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr = _gyro->_dna._spareEvening[i]; + char actChr = _gyro->_spareEvening[i]; sz.syncAsByte(actChr); } } else { - if (!_gyro->_dna._favouriteDrink.empty()) - _gyro->_dna._favouriteDrink.clear(); + if (!_gyro->_favouriteDrink.empty()) + _gyro->_favouriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _gyro->_dna._favouriteDrink += actChr; + _gyro->_favouriteDrink += actChr; } - if (!_gyro->_dna._favouriteSong.empty()) - _gyro->_dna._favouriteSong.clear(); + if (!_gyro->_favouriteSong.empty()) + _gyro->_favouriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _gyro->_dna._favouriteSong += actChr; + _gyro->_favouriteSong += actChr; } - if (!_gyro->_dna._worstPlaceOnEarth.empty()) - _gyro->_dna._worstPlaceOnEarth.clear(); + if (!_gyro->_worstPlaceOnEarth.empty()) + _gyro->_worstPlaceOnEarth.clear(); uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { sz.syncAsByte(actChr); - _gyro->_dna._worstPlaceOnEarth += actChr; + _gyro->_worstPlaceOnEarth += actChr; } - if (!_gyro->_dna._spareEvening.empty()) - _gyro->_dna._spareEvening.clear(); + if (!_gyro->_spareEvening.empty()) + _gyro->_spareEvening.clear(); uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { sz.syncAsByte(actChr); - _gyro->_dna._spareEvening += actChr; + _gyro->_spareEvening += actChr; } } - sz.syncAsSint32LE(_gyro->_dna._totalTime); - sz.syncAsByte(_gyro->_dna._jumpStatus); - sz.syncAsByte(_gyro->_dna._mushroomGrowing); - sz.syncAsByte(_gyro->_dna._spludwickAtHome); - sz.syncAsByte(_gyro->_dna._lastRoom); - sz.syncAsByte(_gyro->_dna._lastRoomNotMap); - sz.syncAsByte(_gyro->_dna._crapulusWillTell); - sz.syncAsByte(_gyro->_dna._enterCatacombsFromLustiesRoom); - sz.syncAsByte(_gyro->_dna._teetotal); - sz.syncAsByte(_gyro->_dna._malagauche); - sz.syncAsByte(_gyro->_dna._drinking); - sz.syncAsByte(_gyro->_dna._enteredLustiesRoomAsMonk); - sz.syncAsByte(_gyro->_dna._catacombX); - sz.syncAsByte(_gyro->_dna._catacombY); - sz.syncAsByte(_gyro->_dna._avvysInTheCupboard); - sz.syncAsByte(_gyro->_dna._geidaFollows); - sz.syncAsByte(_gyro->_dna._geidaSpin); - sz.syncAsByte(_gyro->_dna._geidaTime); - sz.syncAsByte(_gyro->_dna._nextBell); - sz.syncAsByte(_gyro->_dna._givenPotionToGeida); - sz.syncAsByte(_gyro->_dna._lustieIsAsleep); - sz.syncAsByte(_gyro->_dna._flipToWhere); - sz.syncAsByte(_gyro->_dna._flipToPed); - sz.syncAsByte(_gyro->_dna._beenTiedUp); - sz.syncAsByte(_gyro->_dna._sittingInPub); - sz.syncAsByte(_gyro->_dna._spurgeTalkCount); - sz.syncAsByte(_gyro->_dna._metAvaroid); - sz.syncAsByte(_gyro->_dna._takenMushroom); - sz.syncAsByte(_gyro->_dna._givenPenToAyles); - sz.syncAsByte(_gyro->_dna._askedDogfoodAboutNim); + sz.syncAsSint32LE(_gyro->_totalTime); + sz.syncAsByte(_gyro->_jumpStatus); + sz.syncAsByte(_gyro->_mushroomGrowing); + sz.syncAsByte(_gyro->_spludwickAtHome); + sz.syncAsByte(_gyro->_lastRoom); + sz.syncAsByte(_gyro->_lastRoomNotMap); + sz.syncAsByte(_gyro->_crapulusWillTell); + sz.syncAsByte(_gyro->_enterCatacombsFromLustiesRoom); + sz.syncAsByte(_gyro->_teetotal); + sz.syncAsByte(_gyro->_malagauche); + sz.syncAsByte(_gyro->_drinking); + sz.syncAsByte(_gyro->_enteredLustiesRoomAsMonk); + sz.syncAsByte(_gyro->_catacombX); + sz.syncAsByte(_gyro->_catacombY); + sz.syncAsByte(_gyro->_avvysInTheCupboard); + sz.syncAsByte(_gyro->_geidaFollows); + sz.syncAsByte(_gyro->_geidaSpin); + sz.syncAsByte(_gyro->_geidaTime); + sz.syncAsByte(_gyro->_nextBell); + sz.syncAsByte(_gyro->_givenPotionToGeida); + sz.syncAsByte(_gyro->_lustieIsAsleep); + sz.syncAsByte(_gyro->_flipToWhere); + sz.syncAsByte(_gyro->_flipToPed); + sz.syncAsByte(_gyro->_beenTiedUp); + sz.syncAsByte(_gyro->_sittingInPub); + sz.syncAsByte(_gyro->_spurgeTalkCount); + sz.syncAsByte(_gyro->_metAvaroid); + sz.syncAsByte(_gyro->_takenMushroom); + sz.syncAsByte(_gyro->_givenPenToAyles); + sz.syncAsByte(_gyro->_askedDogfoodAboutNim); #if 0 @@ -443,7 +443,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _celer->forgetBackgroundSprites(); _lucerna->minorRedraw(); _dropdown->setupMenu(); - _gyro->_whereIs[0] = _gyro->_dna._room; + _gyro->_whereIs[0] = _gyro->_room; _gyro->_alive = true; _lucerna->refreshObjectList(); _animation->updateSpeed(); @@ -459,7 +459,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _scrolls->displayText(tmpStr); if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible) - _animation->changeDirection(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. + _animation->changeDirection(0, _gyro->_direction); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2643299ec532..5a9fa60dc30e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -109,7 +109,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_HOME: case Common::KEYCODE_END: case Common::KEYCODE_KP5: - if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) { + if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) { _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->drawDirection(); return; @@ -147,7 +147,7 @@ void Avalot::setup() { _vm->_gyro->_ledStatus = 177; _vm->_gyro->_defaultLed = 2; // TSkellern = 0; Replace with a more local variable sometime - _vm->_gyro->_dna._direction = Gyro::kDirectionStopped; + _vm->_gyro->_direction = Gyro::kDirectionStopped; _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 10c2efce4141..143725a92c4d 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -57,7 +57,7 @@ void Celer::updateBackgroundSprites() { if (_vm->_gyro->_dropdownActive) return; // No animation when the menus are up. - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__outsideargentpub: if ((_vm->_gyro->_roomTime % 12) == 0) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 4); @@ -71,14 +71,14 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->_roomTime / 2) % 4); break; case r__yours: - if ((!_vm->_gyro->_dna._avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) + if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 2); break; case r__argentpub: - if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_dna._malagauche != 177)) { + if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { // Malagauche cycle. - _vm->_gyro->_dna._malagauche += 1; - switch (_vm->_gyro->_dna._malagauche) { + _vm->_gyro->_malagauche += 1; + switch (_vm->_gyro->_malagauche) { case 1: case 11: case 21: @@ -94,7 +94,7 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 13); // Winks. break; case 33: - _vm->_gyro->_dna._malagauche = 0; + _vm->_gyro->_malagauche = 0; break; } } @@ -112,7 +112,7 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 7); break; case 199: - _vm->_gyro->_dna._dogFoodPos = 177; // Impossible value for this. + _vm->_gyro->_dogFoodPos = 177; // Impossible value for this. break; } @@ -125,9 +125,9 @@ void Celer::updateBackgroundSprites() { else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) direction = 4; - if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dna._dogFoodPos = direction; + _vm->_gyro->_dogFoodPos = direction; } } break; @@ -150,7 +150,7 @@ void Celer::updateBackgroundSprites() { } break; case r__lustiesroom: - if (!(_vm->_gyro->_dna._lustieIsAsleep)) { + if (!(_vm->_gyro->_lustieIsAsleep)) { byte direction = 0; uint16 angle = _vm->_lucerna->bearing(2); if ((_vm->_gyro->_roomTime % 45) > 42) @@ -163,14 +163,14 @@ void Celer::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? } } break; case r__aylesoffice: - if ((!_vm->_gyro->_dna._aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { + if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { switch ((_vm->_gyro->_roomTime / 14) % 2) { case 0: drawBackgroundSprite(-1, -1, 1); // Frame 2: EGA. @@ -182,7 +182,7 @@ void Celer::updateBackgroundSprites() { } break; case r__robins: - if (_vm->_gyro->_dna._tiedUp) { + if (_vm->_gyro->_tiedUp) { switch (_vm->_gyro->_roomTime % 54) { case 20: drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. @@ -207,9 +207,9 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? } switch (_vm->_gyro->_roomTime % 50) { @@ -239,22 +239,22 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_gyro->_dna._dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dna._dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? } break; } } - if ((_vm->_gyro->_dna._bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { + if ((_vm->_gyro->_bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { // They're ringing the bells. switch (_vm->_gyro->_roomTime % 4) { case 1: - if (_vm->_gyro->_dna._nextBell < 5) - _vm->_gyro->_dna._nextBell = 12; - _vm->_gyro->_dna._nextBell--; - _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->_dna._nextBell]); + if (_vm->_gyro->_nextBell < 5) + _vm->_gyro->_nextBell = 12; + _vm->_gyro->_nextBell--; + _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->_nextBell]); break; case 2: //nosound(); diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index a934ed0f583c..62f4680c5717 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -448,7 +448,7 @@ void Dropdown::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_gyro->_dna._room == 99) + if (_vm->_gyro->_room == 99) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); @@ -469,7 +469,7 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); for (byte i = 150; i <= 178; i++) - if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_dna._room) { + if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people = people + i; } @@ -480,7 +480,7 @@ void Dropdown::setupMenuPeople() { void Dropdown::setupMenuObjects() { _activeMenuItem.reset(); for (byte i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_dna._objects[i]) + if (_vm->_gyro->_objects[i]) _activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); } _activeMenuItem.display(); @@ -504,7 +504,7 @@ void Dropdown::setupMenuWith() { // or (c), the _person you've selected is YOU! if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) - || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_dna._room)) + || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); @@ -522,13 +522,13 @@ void Dropdown::setupMenuWith() { } break; case Gyro::kPeopleDogfood: { - _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_dna._wonNim); // True if you HAVEN'T won. + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodePlay; } break; case Gyro::kPeopleMalagauche: { - bool isSober = !_vm->_gyro->_dna._teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]); + bool isSober = !_vm->_gyro->_teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); @@ -537,7 +537,7 @@ void Dropdown::setupMenuWith() { } break; case Gyro::kPeopleTrader: { - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]); + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; } break; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index a59db04a9fae..4c8013e87905 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -274,7 +274,7 @@ void Enid::ednaReload() { _vm->_lucerna->majorRedraw(); - _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_dna._room; + _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; _vm->_gyro->_alive = true; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index ecd1be14b74e..d9e0d7480463 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -178,7 +178,7 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _also[fv][ff] = 0; } - _dna._totalTime = 0; + _totalTime = 0; } Gyro::~Gyro() { @@ -225,6 +225,89 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String warning("STUB: Gyro::shbox()"); } +void Gyro::resetVariables() { +// Replaces memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); + _direction = 0; + _carryNum = 0; + for (int i = 0; i < kObjectNum; i++) + _objects[i] = false; + + _dnascore = 0; + _money = 0; + _room = 0; + _wearing = 0; + _sworeNum = 0; + _saveNum = 0; + for (int i = 0; i < 100; i++) + _roomCount[100] = 0; + + _alcoholLevel = 0; + _playedNim = 0; + _wonNim = false; + _wineState = 0; + _cwytalotGone = false; + _passwordNum = 0; + _aylesIsAwake = false; + _drawbridgeOpen = 0; + _avariciusTalk = 0; + _boughtOnion = false; + _rottenOnion = false; + _onionInVinegar = false; + _givenToSpludwick = 0; + _brummieStairs = 0; + _cardiffQuestionNum = 0; + _passedCwytalotInHerts = false; + _avvyIsAwake = false; + _avvyInBed = false; + _userMovesAvvy = false; + _dogFoodPos = 0; + _givenBadgeToIby = false; + _friarWillTieYouUp = false; + _tiedUp = false; + _boxContent = 0; + _talkedToCrapulus = false; + _jacquesState = 0; + _bellsAreRinging = false; + _standingOnDais = false; + _takenPen = false; + _arrowTriggered = false; + _arrowInTheDoor = false; + _favouriteDrink = ""; + _favouriteSong = ""; + _worstPlaceOnEarth = ""; + _spareEvening = ""; + _totalTime = 0; + _jumpStatus = 0; + _mushroomGrowing = false; + _spludwickAtHome = false; + _lastRoom = 0; + _lastRoomNotMap = 0; + _crapulusWillTell = false; + _enterCatacombsFromLustiesRoom = false; + _teetotal = false; + _malagauche = 0; + _drinking = 0; + _enteredLustiesRoomAsMonk = false; + _catacombX = 0; + _catacombY = 0; + _avvysInTheCupboard = false; + _geidaFollows = false; + _geidaSpin = 0; + _geidaTime = 0; + _nextBell = 0; + _givenPotionToGeida = false; + _lustieIsAsleep = false; + _flipToWhere = 0; + _flipToPed = 0; + _beenTiedUp = false; + _sittingInPub = false; + _spurgeTalkCount = 0; + _metAvaroid = false; + _takenMushroom = false; + _givenPenToAyles = false; + _askedDogfoodAboutNim = false; +} + void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { if (_vm->_animation->_sprites[i]._quick) @@ -236,19 +319,19 @@ void Gyro::newGame() { _alive = true; _score = 0; - memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); + resetVariables(); _vm->_scrolls->setBubbleStateNatural(); - _dna._spareEvening = "answer a questionnaire"; - _dna._favouriteDrink = "beer"; - _dna._money = 30; // 2/6 - _dna._direction = kDirectionStopped; - _dna._wearing = kObjectClothes; - _dna._objects[kObjectMoney - 1] = true; - _dna._objects[kObjectBodkin - 1] = true; - _dna._objects[kObjectBell - 1] = true; - _dna._objects[kObjectClothes - 1] = true; + _spareEvening = "answer a questionnaire"; + _favouriteDrink = "beer"; + _money = 30; // 2/6 + _direction = kDirectionStopped; + _wearing = kObjectClothes; + _objects[kObjectMoney - 1] = true; + _objects[kObjectBodkin - 1] = true; + _objects[kObjectBell - 1] = true; + _objects[kObjectClothes - 1] = true; _thinkThing = true; _thinks = 2; @@ -263,10 +346,10 @@ void Gyro::newGame() { _her = 254; _it = 254; _lastPerson = 254; // = Pardon? - _dna._passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; - _dna._userMovesAvvy = false; + _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _userMovesAvvy = false; _doingSpriteRun = false; - _dna._avvyInBed = true; + _avvyInBed = true; _enidFilename = ""; _vm->_lucerna->enterRoom(1, 1); @@ -299,8 +382,8 @@ void Gyro::forceNumlock() { } bool Gyro::decreaseMoney(uint16 howmuchby) { - _dna._money -= howmuchby; - if (_dna._money < 0) { + _money -= howmuchby; + if (_money < 0) { _vm->_visa->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; @@ -343,7 +426,7 @@ Common::String Gyro::getThing(byte which) { Common::String get_thing_result; switch (which) { case kObjectWine: - switch (_dna._wineState) { + switch (_wineState) { case 1: case 4: get_thing_result = kThings[which - 1]; @@ -354,7 +437,7 @@ Common::String Gyro::getThing(byte which) { } break; case kObjectOnion: - if (_dna._rottenOnion) + if (_rottenOnion) get_thing_result = "rotten onion"; else get_thing_result = kThings[which - 1]; @@ -371,7 +454,7 @@ char Gyro::getThingChar(byte which) { char get_thingchar_result; switch (which) { case kObjectWine: - if (_dna._wineState == 3) + if (_wineState == 3) get_thingchar_result = 'V'; // Vinegar else get_thingchar_result = kThingsChar[which - 1]; @@ -396,7 +479,7 @@ Common::String Gyro::getItem(byte which) { switch (which) { case kObjectWine: - switch (_dna._wineState) { + switch (_wineState) { case 0: case 1: case 4: @@ -408,9 +491,9 @@ Common::String Gyro::getItem(byte which) { } break; case kObjectOnion: - if (_dna._rottenOnion) + if (_rottenOnion) get_better_result = "a rotten onion"; - else if (_dna._onionInVinegar) + else if (_onionInVinegar) get_better_result = "a pickled onion (in the vinegar)"; else get_better_result = kItems[which - 1]; @@ -426,21 +509,21 @@ Common::String Gyro::getItem(byte which) { Common::String Gyro::f5Does() { - switch (_dna._room) { + switch (_room) { case r__yours: - if (!_dna._avvyIsAwake) + if (!_avvyIsAwake) return Common::String::format("%cWWake up", Acci::kVerbCodeWake); - else if (_dna._avvyInBed) + else if (_avvyInBed) return Common::String::format("%cGGet up", Acci::kVerbCodeStand); break; case r__insidecardiffcastle: - if (_dna._standingOnDais) + if (_standingOnDais) return Common::String::format("%cCClimb down", Acci::kVerbCodeClimb); else return Common::String::format("%cCClimb up", Acci::kVerbCodeClimb); break; case r__nottspub: - if (_dna._sittingInPub) + if (_sittingInPub) return Common::String::format("%cSStand up", Acci::kVerbCodeStand); else return Common::String::format("%cSSit down", Acci::kVerbCodeSit); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index faab64c07066..35addc3a5047 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -53,76 +53,6 @@ struct MouseHotspotType { // mouse-void int16 _horizontal, _vertical; }; -struct DnaType { // Ux, uy, & ww now all belong to Trip5 - byte _direction; // The direction Avvy is currently facing. - byte _carryNum; // How many objects you're carrying... - bool _objects[kObjectNum]; // ...and which ones they are. - int16 _score; // your score, of course - int32 _money; // your current amount of dosh - byte _room; // your current room - byte _wearing; // what you're wearing - byte _sworeNum; // number of times you've sworn - byte _saveNum; // number of times this game has been saved - byte _roomCount[100]; // Add one to each every time you enter a room - byte _alcoholLevel; // Your blood alcohol level. - byte _playedNim; // How many times you've played Nim. - bool _wonNim; // Have you *won* Nim? (That's harder.) - byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. - bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte _passwordNum; // Number of the passw for this game. - bool _aylesIsAwake; // pretty obvious! - byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). - byte _avariciusTalk; // How much Avaricius has said to you. - bool _boughtOnion; // Have you bought an onion yet? - bool _rottenOnion; // And has it rotted? - bool _onionInVinegar; // Is the onion in the vinegar? - byte _givenToSpludwick; // 0 = nothing given, 1 = onion... - byte _brummieStairs; // Progression through the stairs trick. - byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) - bool _avvyInBed; // True if Avvy's in bed, but awake. - bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _dogFoodPos; // Which way Dogfood's looking in the pub. - bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool _friarWillTieYouUp; // If you're going to get tied up. - bool _tiedUp; // You ARE tied up! - byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool _talkedToCrapulus; // Pretty self-explanatory. - byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool _bellsAreRinging; // Is Jacques ringing the bells? - bool _standingOnDais; // In room 71, inside Cardiff Castle. - bool _takenPen; // Have you taken the pen (in Cardiff?) - bool _arrowTriggered; // And has the arrow been triggered? - bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 _totalTime; // Your total time playing this game, in ticks. - byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; - byte _lastRoomNotMap; - bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool _enterCatacombsFromLustiesRoom; - bool _teetotal; // Are we touching any more drinks? - byte _malagauche; // Position of Malagauche. See Celer for more info. - char _drinking; // What's he getting you? - bool _enteredLustiesRoomAsMonk; - byte _catacombX, _catacombY; // XY coords in the catacombs. - bool _avvysInTheCupboard; // On screen 22. - bool _geidaFollows; // Is Geida following you? - byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. - byte _nextBell; // For the ringing. - bool _givenPotionToGeida; // Does Geida have the potion? - bool _lustieIsAsleep; // Is BDL asleep? - byte _flipToWhere, _flipToPed; // For the sequencer. - bool _beenTiedUp; // In r__Robins. - bool _sittingInPub; // Are you sitting down in the pub? - byte _spurgeTalkCount; // Count for talking to Spurge. - bool _metAvaroid; - bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; -}; - struct PedType { int16 _x, _y; byte _direction; @@ -324,7 +254,76 @@ class Gyro { // You may know better than On which page to switch to. bool _onCanDoPageSwap; - DnaType _dna; + // Former DNA structure + byte _direction; // The direction Avvy is currently facing. + byte _carryNum; // How many objects you're carrying... + bool _objects[kObjectNum]; // ...and which ones they are. + int16 _dnascore; // your score, of course + int32 _money; // your current amount of dosh + byte _room; // your current room + byte _wearing; // what you're wearing + byte _sworeNum; // number of times you've sworn + byte _saveNum; // number of times this game has been saved + byte _roomCount[100]; // Add one to each every time you enter a room + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _wonNim; // Have you *won* Nim? (That's harder.) + byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? + byte _passwordNum; // Number of the passw for this game. + bool _aylesIsAwake; // pretty obvious! + byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). + byte _avariciusTalk; // How much Avaricius has said to you. + bool _boughtOnion; // Have you bought an onion yet? + bool _rottenOnion; // And has it rotted? + bool _onionInVinegar; // Is the onion in the vinegar? + byte _givenToSpludwick; // 0 = nothing given, 1 = onion... + byte _brummieStairs; // Progression through the stairs trick. + byte _cardiffQuestionNum; // Things you get asked in Cardiff. + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) + bool _avvyInBed; // True if Avvy's in bed, but awake. + bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. + byte _dogFoodPos; // Which way Dogfood's looking in the pub. + bool _givenBadgeToIby; // Have you given the badge to Iby yet? + bool _friarWillTieYouUp; // If you're going to get tied up. + bool _tiedUp; // You ARE tied up! + byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. + bool _talkedToCrapulus; // Pretty self-explanatory. + byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. + bool _bellsAreRinging; // Is Jacques ringing the bells? + bool _standingOnDais; // In room 71, inside Cardiff Castle. + bool _takenPen; // Have you taken the pen (in Cardiff?) + bool _arrowTriggered; // And has the arrow been triggered? + bool _arrowInTheDoor; // Did the arrow hit the wall? + Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's + uint32 _totalTime; // Your total time playing this game, in ticks. + byte _jumpStatus; // Fixes how high you're jumping. + bool _mushroomGrowing; // Is the mushroom growing in 42? + bool _spludwickAtHome; // Is Spludwick at home? + byte _lastRoom; + byte _lastRoomNotMap; + bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? + bool _enterCatacombsFromLustiesRoom; + bool _teetotal; // Are we touching any more drinks? + byte _malagauche; // Position of Malagauche. See Celer for more info. + char _drinking; // What's he getting you? + bool _enteredLustiesRoomAsMonk; + byte _catacombX, _catacombY; // XY coords in the catacombs. + bool _avvysInTheCupboard; // On screen 22. + bool _geidaFollows; // Is Geida following you? + byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. + byte _nextBell; // For the ringing. + bool _givenPotionToGeida; // Does Geida have the potion? + bool _lustieIsAsleep; // Is BDL asleep? + byte _flipToWhere, _flipToPed; // For the sequencer. + bool _beenTiedUp; // In r__Robins. + bool _sittingInPub; // Are you sitting down in the pub? + byte _spurgeTalkCount; // Count for talking to Spurge. + bool _metAvaroid; + bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; + // End of former DNA Structure + byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; @@ -399,6 +398,7 @@ class Gyro { void setBackgroundColor(byte x); void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); + void resetVariables(); void newGame(); // This sets up the DNA for a completely new game. void slowDown(); bool setFlag(char x); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 82aabe2bd6bf..12b75523a4ed 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -346,12 +346,12 @@ void Lucerna::exitRoom(byte x) { switch (x) { case r__spludwicks: _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); - _vm->_gyro->_dna._avariciusTalk = 0; + _vm->_gyro->_avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case r__bridge: - if (_vm->_gyro->_dna._drawbridgeOpen > 0) { - _vm->_gyro->_dna._drawbridgeOpen = 4; // Fully open. + if (_vm->_gyro->_drawbridgeOpen > 0) { + _vm->_gyro->_drawbridgeOpen = 4; // Fully open. _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); } break; @@ -367,9 +367,9 @@ void Lucerna::exitRoom(byte x) { _vm->_gyro->_seeScroll = false; // Now it can work again! - _vm->_gyro->_dna._lastRoom = _vm->_gyro->_dna._room; - if (_vm->_gyro->_dna._room != r__map) - _vm->_gyro->_dna._lastRoomNotMap = _vm->_gyro->_dna._room; + _vm->_gyro->_lastRoom = _vm->_gyro->_room; + if (_vm->_gyro->_room != r__map) + _vm->_gyro->_lastRoomNotMap = _vm->_gyro->_room; } @@ -381,28 +381,28 @@ void Lucerna::exitRoom(byte x) { void Lucerna::enterNewTown() { _vm->_dropdown->setupMenu(); - switch (_vm->_gyro->_dna._room) { + switch (_vm->_gyro->_room) { case r__outsidenottspub: // Entry into Nottingham. - if ((_vm->_gyro->_dna._roomCount[r__robins] > 0) && (_vm->_gyro->_dna._beenTiedUp) && (!_vm->_gyro->_dna._takenMushroom)) - _vm->_gyro->_dna._mushroomGrowing = true; + if ((_vm->_gyro->_roomCount[r__robins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) + _vm->_gyro->_mushroomGrowing = true; break; case r__wisewomans: { // Entry into Argent. - if (_vm->_gyro->_dna._talkedToCrapulus && (! _vm->_gyro->_dna._lustieIsAsleep)) { - _vm->_gyro->_dna._spludwickAtHome = !((_vm->_gyro->_dna._roomCount[r__wisewomans] % 3) == 1); - _vm->_gyro->_dna._crapulusWillTell = ! _vm->_gyro->_dna._spludwickAtHome; + if (_vm->_gyro->_talkedToCrapulus && (! _vm->_gyro->_lustieIsAsleep)) { + _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[r__wisewomans] % 3) == 1); + _vm->_gyro->_crapulusWillTell = ! _vm->_gyro->_spludwickAtHome; } else { - _vm->_gyro->_dna._spludwickAtHome = true; - _vm->_gyro->_dna._crapulusWillTell = false; + _vm->_gyro->_spludwickAtHome = true; + _vm->_gyro->_crapulusWillTell = false; } - if (_vm->_gyro->_dna._boxContent == Gyro::kObjectWine) - _vm->_gyro->_dna._wineState = 3; // Vinegar + if (_vm->_gyro->_boxContent == Gyro::kObjectWine) + _vm->_gyro->_wineState = 3; // Vinegar } break; } - if (_vm->_gyro->_dna._room != r__outsideducks) { - if ((_vm->_gyro->_dna._objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_dna._onionInVinegar)) - _vm->_gyro->_dna._rottenOnion = true; // You're holding the onion + if (_vm->_gyro->_room != r__outsideducks) { + if ((_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_onionInVinegar)) + _vm->_gyro->_rottenOnion = true; // You're holding the onion } } @@ -421,30 +421,30 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. findPeople(room); - _vm->_gyro->_dna._room = room; + _vm->_gyro->_room = room; if (ped != 0) - _vm->_gyro->_dna._roomCount[room]++; + _vm->_gyro->_roomCount[room]++; loadRoom(room); - if ((_vm->_gyro->_dna._roomCount[room] == 0) && (! _vm->_gyro->setFlag('S'))) + if ((_vm->_gyro->_roomCount[room] == 0) && (! _vm->_gyro->setFlag('S'))) incScore(1); - _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_dna._room; + _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; - if (_vm->_gyro->_dna._geidaFollows) + if (_vm->_gyro->_geidaFollows) _vm->_gyro->_whereIs[Gyro::kPeopleGeida - 150] = room; _vm->_gyro->_roomTime = 0; - if ((_vm->_gyro->_dna._lastRoom == r__map) && (_vm->_gyro->_dna._lastRoomNotMap != _vm->_gyro->_dna._room)) + if ((_vm->_gyro->_lastRoom == r__map) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) enterNewTown(); switch (room) { case r__yours: - if (_vm->_gyro->_dna._avvyInBed) { + if (_vm->_gyro->_avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); @@ -453,12 +453,12 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsideyours: if (ped > 0) { - if (! _vm->_gyro->_dna._talkedToCrapulus) { + if (! _vm->_gyro->_talkedToCrapulus) { _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__outsideyours; _vm->_animation->_sprites[1].init(8, false, _vm->_animation); // load Crapulus - if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { + if (_vm->_gyro->_roomCount[r__outsideyours] == 1) { _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. _vm->_animation->_sprites[1].walkTo(5); // Walks up to greet you. } else { @@ -471,32 +471,32 @@ void Lucerna::enterRoom(byte room, byte ped) { } else _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; - if (_vm->_gyro->_dna._crapulusWillTell) { + if (_vm->_gyro->_crapulusWillTell) { _vm->_animation->_sprites[1].init(8, false, _vm->_animation); _vm->_animation->appearPed(2, 2); _vm->_animation->_sprites[1].walkTo(4); _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); - _vm->_gyro->_dna._crapulusWillTell = false; + _vm->_gyro->_crapulusWillTell = false; } } break; case r__outsidespludwicks: - if ((_vm->_gyro->_dna._roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { + if ((_vm->_gyro->_roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); - _vm->_gyro->_dna._spludwickAtHome = true; + _vm->_gyro->_spludwickAtHome = true; } break; case r__spludwicks: - if (_vm->_gyro->_dna._spludwickAtHome) { + if (_vm->_gyro->_spludwickAtHome) { if (ped > 0) { _vm->_animation->_sprites[1].init(2, false, _vm->_animation); // load Spludwick _vm->_animation->appearPed(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } - _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. + _vm->_gyro->_dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. _vm->_animation->_sprites[1]._callEachStepFl = true; _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGeida; @@ -505,9 +505,9 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__brummieroad: - if (_vm->_gyro->_dna._geidaFollows) + if (_vm->_gyro->_geidaFollows) putGeidaAt(5, ped); - if (_vm->_gyro->_dna._cwytalotGone) { + if (_vm->_gyro->_cwytalotGone) { _vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__nowhere; } else { @@ -517,7 +517,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFollowAvvyY; _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; - if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... + if (_vm->_gyro->_roomCount[r__brummieroad] == 1) { // First time here... _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... _vm->_animation->_sprites[1].walkTo(4); // ...and he walks up... } else { @@ -530,31 +530,31 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__argentroad: - if ((_vm->_gyro->_dna._cwytalotGone) && (! _vm->_gyro->_dna._passedCwytalotInHerts) && (ped == 2) && - (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { + if ((_vm->_gyro->_cwytalotGone) && (! _vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && + (_vm->_gyro->_roomCount[r__argentroad] > 3)) { _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->appearPed(2, 1); _vm->_animation->_sprites[1].walkTo(2); _vm->_animation->_sprites[1]._vanishIfStill = true; - _vm->_gyro->_dna._passedCwytalotInHerts = true; + _vm->_gyro->_passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); } break; case r__bridge: - if (_vm->_gyro->_dna._drawbridgeOpen == 4) { // open + if (_vm->_gyro->_drawbridgeOpen == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. } - if (_vm->_gyro->_dna._geidaFollows) + if (_vm->_gyro->_geidaFollows) putGeidaAt(ped + 3, ped); // load Geida break; case r__robins: if (ped > 0) { - if (! _vm->_gyro->_dna._beenTiedUp) { + if (! _vm->_gyro->_beenTiedUp) { // A welcome party... or maybe not... _vm->_animation->_sprites[1].init(6, false, _vm->_animation); _vm->_animation->appearPed(2, 2); @@ -563,22 +563,22 @@ void Lucerna::enterRoom(byte room, byte ped) { } } - if (_vm->_gyro->_dna._beenTiedUp) { + if (_vm->_gyro->_beenTiedUp) { _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = 0; _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 0; } - if (_vm->_gyro->_dna._tiedUp) + if (_vm->_gyro->_tiedUp) _vm->_celer->drawBackgroundSprite(-1, -1, 2); - if (!_vm->_gyro->_dna._mushroomGrowing) + if (!_vm->_gyro->_mushroomGrowing) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); break; case r__outsidecardiffcastle: if (ped > 0) - switch (_vm->_gyro->_dna._cardiffQuestionNum) { + switch (_vm->_gyro->_cardiffQuestionNum) { case 0 : { // You've answered NONE of his questions. _vm->_animation->_sprites[1].init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 2); @@ -596,8 +596,8 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } } - if (_vm->_gyro->_dna._cardiffQuestionNum < 5) - _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; + if (_vm->_gyro->_cardiffQuestionNum < 5) + _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; else _vm->_gyro->_interrogation = 0; break; @@ -610,9 +610,9 @@ void Lucerna::enterRoom(byte room, byte ped) { //setactivepage(1 - cp); { - if ((_vm->_gyro->_dna._objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_dna._wineState != 3)) { + if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! - _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } } @@ -625,33 +625,33 @@ void Lucerna::enterRoom(byte room, byte ped) { switch (ped) { case 3: { // Enter from oubliette - _vm->_gyro->_dna._catacombX = 8; - _vm->_gyro->_dna._catacombY = 4; + _vm->_gyro->_catacombX = 8; + _vm->_gyro->_catacombY = 4; } break; case 5: { // Enter from du Lustie's - _vm->_gyro->_dna._catacombX = 8; - _vm->_gyro->_dna._catacombY = 7; + _vm->_gyro->_catacombX = 8; + _vm->_gyro->_catacombY = 7; } break; case 6: { // Enter from Geida's - _vm->_gyro->_dna._catacombX = 4; - _vm->_gyro->_dna._catacombY = 1; + _vm->_gyro->_catacombX = 4; + _vm->_gyro->_catacombY = 1; } break; } - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; + _vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_animation->catacombMove(ped); - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; + _vm->_gyro->_enterCatacombsFromLustiesRoom = false; } break; case r__argentpub: - if (_vm->_gyro->_dna._wonNim) + if (_vm->_gyro->_wonNim) _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. - _vm->_gyro->_dna._malagauche = 0; // Ready to boot Malagauche - if (_vm->_gyro->_dna._givenBadgeToIby) { + _vm->_gyro->_malagauche = 0; // Ready to boot Malagauche + if (_vm->_gyro->_givenBadgeToIby) { _vm->_celer->drawBackgroundSprite(-1, -1, 8); _vm->_celer->drawBackgroundSprite(-1, -1, 9); } @@ -659,16 +659,16 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__lustiesroom: - _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. + _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); - else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already + else if (! _vm->_gyro->_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); - if (_vm->_gyro->_dna._geidaFollows) { + if (_vm->_gyro->_geidaFollows) { putGeidaAt(5, ped); - if (_vm->_gyro->_dna._lustieIsAsleep) { + if (_vm->_gyro->_lustieIsAsleep) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); } @@ -676,8 +676,8 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__musicroom: - if (_vm->_gyro->_dna._jacquesState > 0) { - _vm->_gyro->_dna._jacquesState = 5; + if (_vm->_gyro->_jacquesState > 0) { + _vm->_gyro->_jacquesState = 5; _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_celer->drawBackgroundSprite(-1, -1, 4); @@ -719,7 +719,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__wisewomans: _vm->_animation->_sprites[1].init(11, false, _vm->_animation); - if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { + if ((_vm->_gyro->_roomCount[r__wisewomans] == 1) && (ped > 0)) { _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. _vm->_animation->_sprites[1].walkTo(4); // Walks up to greet you. } else { @@ -737,18 +737,18 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(1); - if (_vm->_gyro->_dna._arrowInTheDoor) + if (_vm->_gyro->_arrowInTheDoor) _vm->_sequence->thenShow(3); else _vm->_sequence->thenShow(2); - if (_vm->_gyro->_dna._takenPen) + if (_vm->_gyro->_takenPen) _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_sequence->startToClose(); } else { _vm->_celer->drawBackgroundSprite(-1, -1, 1); - if (_vm->_gyro->_dna._arrowInTheDoor) + if (_vm->_gyro->_arrowInTheDoor) _vm->_celer->drawBackgroundSprite(-1, -1, 3); else _vm->_celer->drawBackgroundSprite(-1, -1, 2); @@ -789,7 +789,7 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__aylesoffice: - if (_vm->_gyro->_dna._aylesIsAwake) + if (_vm->_gyro->_aylesIsAwake) _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; // Ayles awake. @@ -800,18 +800,18 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__easthall: case r__westhall: - if (_vm->_gyro->_dna._geidaFollows) + if (_vm->_gyro->_geidaFollows) putGeidaAt(ped + 2, ped); break; case r__lusties: - if (_vm->_gyro->_dna._geidaFollows) + if (_vm->_gyro->_geidaFollows) putGeidaAt(ped + 6, ped); break; case r__nottspub: - if (_vm->_gyro->_dna._sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. + if (_vm->_gyro->_sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. break; case r__outsideducks: @@ -828,7 +828,7 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__ducks: - _vm->_gyro->_dna._dogFoodPos = 1; + _vm->_gyro->_dogFoodPos = 1; break; // Actually, Duck pos. } @@ -921,7 +921,7 @@ void Lucerna::drawScore() { if (_vm->_gyro->kDemo) return; - uint16 score = _vm->_gyro->_dna._score; + uint16 score = _vm->_gyro->_dnascore; int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { byte divisor = 1; @@ -947,7 +947,7 @@ void Lucerna::drawScore() { void Lucerna::incScore(byte num) { // Add on no. of points for (byte q = 1; q <= num; q++) { - _vm->_gyro->_dna._score++; + _vm->_gyro->_dnascore++; #if 0 if (soundfx) { @@ -967,22 +967,22 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { switch (color) { case kColorGreen: - _vm->_gyro->_dna._direction = Animation::kDirUp; + _vm->_gyro->_direction = Animation::kDirUp; _vm->_animation->changeDirection(0, Animation::kDirUp); drawDirection(); break; case kColorBrown: - _vm->_gyro->_dna._direction = Animation::kDirDown; + _vm->_gyro->_direction = Animation::kDirDown; _vm->_animation->changeDirection(0, Animation::kDirDown); drawDirection(); break; case kColorCyan: - _vm->_gyro->_dna._direction = Animation::kDirLeft; + _vm->_gyro->_direction = Animation::kDirLeft; _vm->_animation->changeDirection(0, Animation::kDirLeft); drawDirection(); break; case kColorLightmagenta: - _vm->_gyro->_dna._direction = Animation::kDirRight; + _vm->_gyro->_direction = Animation::kDirRight; _vm->_animation->changeDirection(0, Animation::kDirRight); drawDirection(); break; @@ -1001,14 +1001,14 @@ void Lucerna::fxToggle() { } void Lucerna::refreshObjectList() { - _vm->_gyro->_dna._carryNum = 0; - if (_vm->_gyro->_thinkThing && !_vm->_gyro->_dna._objects[_vm->_gyro->_thinks - 1]) + _vm->_gyro->_carryNum = 0; + if (_vm->_gyro->_thinkThing && !_vm->_gyro->_objects[_vm->_gyro->_thinks - 1]) thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money for (byte i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_dna._objects[i]) { - _vm->_gyro->_dna._carryNum++; - _vm->_gyro->_objectList[_vm->_gyro->_dna._carryNum] = i + 1; + if (_vm->_gyro->_objects[i]) { + _vm->_gyro->_carryNum++; + _vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; } } } @@ -1017,7 +1017,7 @@ void Lucerna::refreshObjectList() { * @remarks Originally called 'verte' */ void Lucerna::guideAvvy(Common::Point cursorPos) { - if (!_vm->_gyro->_dna._userMovesAvvy) + if (!_vm->_gyro->_userMovesAvvy) return; cursorPos.y /= 2; @@ -1104,7 +1104,7 @@ void Lucerna::checkClick() { _vm->_parser->plotText(); } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. - if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) + if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) useCompass(cursorPos); } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { @@ -1167,19 +1167,19 @@ void Lucerna::dawn() { } void Lucerna::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_gyro->_oldDirection == _vm->_gyro->_dna._direction) + if (_vm->_gyro->_oldDirection == _vm->_gyro->_direction) return; - _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; + _vm->_gyro->_oldDirection = _vm->_gyro->_direction; CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_dna._direction], 0, 161); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_direction], 0, 161); CursorMan.showMouse(true); } void Lucerna::gameOver() { - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_userMovesAvvy = false; int16 sx = _vm->_animation->_sprites[0]._x; int16 sy = _vm->_animation->_sprites[0]._y; @@ -1196,7 +1196,7 @@ void Lucerna::gameOver() { void Lucerna::minorRedraw() { dusk(); - enterRoom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant. + enterRoom(_vm->_gyro->_room, 0); // Ped unknown or non-existant. for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 4e114517ad86..2830e9eee034 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -561,19 +561,19 @@ void Scrolls::setBubbleStateNatural() { Common::String Scrolls::displayMoney() { Common::String result; - if (_vm->_gyro->_dna._money < 12) { // just pence - result = Common::String::format("%dd", _vm->_gyro->_dna._money); - } else if (_vm->_gyro->_dna._money < 240) { // shillings & pence - if ((_vm->_gyro->_dna._money % 12) == 0) - result = Common::String::format("%d/-", _vm->_gyro->_dna._money / 12); + if (_vm->_gyro->_money < 12) { // just pence + result = Common::String::format("%dd", _vm->_gyro->_money); + } else if (_vm->_gyro->_money < 240) { // shillings & pence + if ((_vm->_gyro->_money % 12) == 0) + result = Common::String::format("%d/-", _vm->_gyro->_money / 12); else - result = Common::String::format("%d/%d", _vm->_gyro->_dna._money / 12, _vm->_gyro->_dna._money % 12); + result = Common::String::format("%d/%d", _vm->_gyro->_money / 12, _vm->_gyro->_money % 12); } else { // L, s & d - result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_dna._money / 240, (_vm->_gyro->_dna._money / 12) % 20, - _vm->_gyro->_dna._money % 12); + result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20, + _vm->_gyro->_money % 12); } - if (_vm->_gyro->_dna._money > 12) { - Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_dna._money); + if (_vm->_gyro->_money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); result += extraStr; } @@ -703,45 +703,45 @@ void Scrolls::callScrollDriver() { displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: { - int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_dna._passwordNum; + int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_passwordNum; displayText(_vm->_acci->kVocabulary[pwdId]._word + kControlToBuffer); } break; case 3: - displayText(_vm->_gyro->_dna._favouriteDrink + kControlToBuffer); + displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); break; case 4: - displayText(_vm->_gyro->_dna._favouriteSong + kControlToBuffer); + displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); break; case 5: - displayText(_vm->_gyro->_dna._worstPlaceOnEarth + kControlToBuffer); + displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); break; case 6: - displayText(_vm->_gyro->_dna._spareEvening + kControlToBuffer); + displayText(_vm->_gyro->_spareEvening + kControlToBuffer); break; case 9: { - Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_dna._catacombX, _vm->_gyro->_dna._catacombY, kControlToBuffer); + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_catacombX, _vm->_gyro->_catacombY, kControlToBuffer); displayText(tmpStr); } break; case 10: - switch (_vm->_gyro->_dna._boxContent) { + switch (_vm->_gyro->_boxContent) { case 0: // Sixpence. _vm->_visa->displayScrollChain('q', 37); // You find the sixpence. - _vm->_gyro->_dna._money += 6; - _vm->_gyro->_dna._boxContent = _vm->_acci->kNothing; + _vm->_gyro->_money += 6; + _vm->_gyro->_boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); return; case Acci::kNothing: displayText("nothing at all. It's completely empty."); break; default: - displayText(_vm->_gyro->getItem(_vm->_gyro->_dna._boxContent) + '.'); + displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); } break; case 11: for (byte j = 0; j < kObjectNum; j++) { - if (_vm->_gyro->_dna._objects[j]) + if (_vm->_gyro->_objects[j]) displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); } break; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index b5eb6a4d15aa..22ee7fc0e46b 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -64,8 +64,8 @@ void Sequence::thenShow(byte what) { void Sequence::thenFlip(byte where, byte ped) { thenShow(kNowFlip); - _vm->_gyro->_dna._flipToWhere = where; - _vm->_gyro->_dna._flipToPed = ped; + _vm->_gyro->_flipToWhere = where; + _vm->_gyro->_flipToPed = ped; } void Sequence::startToClose() { @@ -74,7 +74,7 @@ void Sequence::startToClose() { } void Sequence::startToOpen() { - _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. + _vm->_gyro->_userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. startToClose(); // Apart from that, it's the same thing. } @@ -89,8 +89,8 @@ void Sequence::callSequencer() { return; // No more routines. break; case 177: // Flip room. - _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_animation->flipRoom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); + _vm->_gyro->_userMovesAvvy = true; + _vm->_animation->flipRoom(_vm->_gyro->_flipToWhere, _vm->_gyro->_flipToPed); if (_seq[0] == 177) shoveLeft(); break; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b88c53d1557c..019f2da84f2f 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -220,7 +220,7 @@ void Timer::updateTimer() { } } _vm->_gyro->_roomTime++; // Cycles since you've been in this room. - _vm->_gyro->_dna._totalTime++; // Total amount of time for this game. + _vm->_gyro->_totalTime++; // Total amount of time for this game. } void Timer::loseTimer(byte which) { @@ -233,20 +233,20 @@ void Timer::loseTimer(byte which) { } void Timer::openDrawbridge() { - _vm->_gyro->_dna._drawbridgeOpen++; - _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_dna._drawbridgeOpen - 1); + _vm->_gyro->_drawbridgeOpen++; + _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 1); - if (_vm->_gyro->_dna._drawbridgeOpen == 4) + if (_vm->_gyro->_drawbridgeOpen == 4) _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } void Timer::avariciusTalks() { - _vm->_visa->displayScrollChain('q', _vm->_gyro->_dna._avariciusTalk); - _vm->_gyro->_dna._avariciusTalk++; + _vm->_visa->displayScrollChain('q', _vm->_gyro->_avariciusTalk); + _vm->_gyro->_avariciusTalk++; - if (_vm->_gyro->_dna._avariciusTalk < 17) + if (_vm->_gyro->_avariciusTalk < 17) addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); else _vm->_lucerna->incScore(3); @@ -277,20 +277,20 @@ void Timer::stairs() { _vm->_gyro->blip(); _vm->_animation->_sprites[0].walkTo(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->_dna._brummieStairs = 2; + _vm->_gyro->_brummieStairs = 2; _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { - if (_vm->_gyro->_dna._cardiffQuestionNum == 0) { - _vm->_gyro->_dna._cardiffQuestionNum++; + if (_vm->_gyro->_cardiffQuestionNum == 0) { + _vm->_gyro->_cardiffQuestionNum++; _vm->_visa->displayScrollChain('q', 27); } - _vm->_visa->displayScrollChain('z', _vm->_gyro->_dna._cardiffQuestionNum); - _vm->_gyro->_interrogation = _vm->_gyro->_dna._cardiffQuestionNum; + _vm->_visa->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); + _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } @@ -305,8 +305,8 @@ void Timer::cwytalotInHerts() { void Timer::getTiedUp() { _vm->_visa->displayScrollChain('q', 34); // ...Trouble! - _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_gyro->_dna._beenTiedUp = true; + _vm->_gyro->_userMovesAvvy = false; + _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); _vm->_animation->_sprites[1].stopWalk(); _vm->_animation->_sprites[1].stopHoming(); @@ -319,7 +319,7 @@ void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(4); _vm->_animation->_sprites[1].walkTo(5); _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. - _vm->_gyro->_dna._friarWillTieYouUp = true; + _vm->_gyro->_friarWillTieYouUp = true; } void Timer::hangAround() { @@ -344,20 +344,20 @@ void Timer::hangAround2() { addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). - _vm->_gyro->_dna._tiedUp = false; + _vm->_gyro->_tiedUp = false; _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. } void Timer::afterTheShootemup() { - _vm->_animation->flipRoom(_vm->_gyro->_dna._room, 0); + _vm->_animation->flipRoom(_vm->_gyro->_room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(1, 2); - _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_gyro->_dna._objects[Gyro::kObjectCrossbow - 1] = true; + _vm->_gyro->_userMovesAvvy = true; + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! @@ -386,9 +386,9 @@ void Timer::afterTheShootemup() { } void Timer::jacquesWakesUp() { - _vm->_gyro->_dna._jacquesState++; + _vm->_gyro->_jacquesState++; - switch (_vm->_gyro->_dna._jacquesState) { // Additional pictures. + switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. _vm->_visa->displayScrollChain('Q', 45); @@ -405,13 +405,13 @@ void Timer::jacquesWakesUp() { break; } - if (_vm->_gyro->_dna._jacquesState == 5) { - _vm->_gyro->_dna._bellsAreRinging = true; - _vm->_gyro->_dna._aylesIsAwake = true; + if (_vm->_gyro->_jacquesState == 5) { + _vm->_gyro->_bellsAreRinging = true; + _vm->_gyro->_aylesIsAwake = true; _vm->_lucerna->incScore(2); } - switch (_vm->_gyro->_dna._jacquesState) { + switch (_vm->_gyro->_jacquesState) { case 1: case 2: case 3: @@ -450,9 +450,9 @@ void Timer::naughtyDuke3() { } void Timer::jump() { - _vm->_gyro->_dna._jumpStatus++; + _vm->_gyro->_jumpStatus++; - switch (_vm->_gyro->_dna._jumpStatus) { + switch (_vm->_gyro->_jumpStatus) { case 1: case 2: case 3: @@ -471,24 +471,24 @@ void Timer::jump() { break; } - if (_vm->_gyro->_dna._jumpStatus == 20) { // End of jump. - _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_gyro->_dna._jumpStatus = 0; + if (_vm->_gyro->_jumpStatus == 20) { // End of jump. + _vm->_gyro->_userMovesAvvy = true; + _vm->_gyro->_jumpStatus = 0; } else { // Still jumping. addTimer(1, kProcJump, kReasonJumping); } - if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. - && (_vm->_gyro->_dna._room == r__insidecardiffcastle) - && (_vm->_gyro->_dna._arrowInTheDoor == true) + if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. + && (_vm->_gyro->_room == r__insidecardiffcastle) + && (_vm->_gyro->_arrowInTheDoor == true) && (_vm->_animation->inField(3))) { // Beside the wall // Grab the arrow! - if (_vm->_gyro->_dna._carryNum >= kCarryLimit) + if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); else { _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->_dna._arrowInTheDoor = false; // You've got it. - _vm->_gyro->_dna._objects[Gyro::kObjectBolt - 1] = true; + _vm->_gyro->_arrowInTheDoor = false; // You've got it. + _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_visa->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); @@ -498,14 +498,14 @@ void Timer::jump() { void Timer::crapulusSaysSpludOut() { _vm->_visa->displayScrollChain('q', 56); - _vm->_gyro->_dna._crapulusWillTell = false; + _vm->_gyro->_crapulusWillTell = false; } void Timer::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. - _vm->_gyro->_dna._malagauche = 0; + _vm->_gyro->_malagauche = 0; - _vm->_visa->displayScrollChain('D', _vm->_gyro->_dna._drinking); // Display message about it. + _vm->_visa->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_visa->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. @@ -515,15 +515,15 @@ void Timer::buyDrinks() { void Timer::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. - _vm->_gyro->_dna._malagauche = 0; + _vm->_gyro->_malagauche = 0; _vm->_visa->displayScrollChain('D', 50); // You buy the wine. _vm->_visa->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { _vm->_visa->displayScrollChain('D', 4); // You paid up. - _vm->_gyro->_dna._objects[Gyro::kObjectWine - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_dna._wineState = 1; // OK Wine. + _vm->_gyro->_wineState = 1; // OK Wine. } } @@ -534,7 +534,7 @@ void Timer::callsGuards() { void Timer::greetsMonk() { _vm->_visa->displayScrollChain('Q', 59); - _vm->_gyro->_dna._enteredLustiesRoomAsMonk = true; + _vm->_gyro->_enteredLustiesRoomAsMonk = true; } void Timer::fallDownOubliette() { @@ -545,13 +545,13 @@ void Timer::fallDownOubliette() { } void Timer::meetAvaroid() { - if (_vm->_gyro->_dna._metAvaroid) { + if (_vm->_gyro->_metAvaroid) { Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Scrolls::kControlItalic, Scrolls::kControlRoman); _vm->_scrolls->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { _vm->_visa->displayScrollChain('Q', 60); - _vm->_gyro->_dna._metAvaroid = true; + _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); _vm->_animation->_sprites[0]._facingDir = Animation::kDirLeft; @@ -570,7 +570,7 @@ void Timer::riseUpOubliette() { if (_vm->_animation->_sprites[0]._moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else - _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { @@ -580,7 +580,7 @@ void Timer::robinHoodAndGeida() { _vm->_animation->_sprites[1].stopWalk(); _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); - _vm->_gyro->_dna._geidaFollows = false; + _vm->_gyro->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { @@ -598,7 +598,7 @@ void Timer::avalotReturns() { _vm->_animation->_sprites[0].init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); _vm->_visa->displayScrollChain('q', 67); - _vm->_gyro->_dna._userMovesAvvy = true; + _vm->_gyro->_userMovesAvvy = true; } /** @@ -611,8 +611,8 @@ void Timer::avvySitDown() { addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_dna._sittingInPub = true; - _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_gyro->_sittingInPub = true; + _vm->_gyro->_userMovesAvvy = false; _vm->_animation->_sprites[0]._visible = false; } } @@ -623,7 +623,7 @@ void Timer::ghostRoomPhew() { } void Timer::arkataShouts() { - if (_vm->_gyro->_dna._teetotal) + if (_vm->_gyro->_teetotal) return; _vm->_visa->displayScrollChain('q', 76); @@ -676,7 +676,7 @@ void Timer::spludwickLeavesCauldron() { void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_visa->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); - _vm->_gyro->_dna._lustieIsAsleep = true; + _vm->_gyro->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); _vm->_sequence->thenShow(6); // He falls asleep... _vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 931f10f9ae68..a7125d4f8491 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -159,19 +159,19 @@ void Visa::talkTo(byte whom) { if (_vm->_gyro->_subjectNum == 0) { switch (whom) { case Gyro::kPeopleSpludwick: - if ((_vm->_gyro->_dna._lustieIsAsleep) & (!_vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1])) { + if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_gyro->_dna._objects[Gyro::kObjectPotion - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); return; - } else if (_vm->_gyro->_dna._talkedToCrapulus) { + } else if (_vm->_gyro->_talkedToCrapulus) { // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_gyro->_dna._givenToSpludwick) { + switch (_vm->_gyro->_givenToSpludwick) { case 1: // Fallthrough is intended. case 2: { - Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick]); + Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); } @@ -186,23 +186,23 @@ void Visa::talkTo(byte whom) { } break; case Gyro::kPeopleIbythneth: - if (_vm->_gyro->_dna._givenBadgeToIby) { + if (_vm->_gyro->_givenBadgeToIby) { displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. case Gyro::kPeopleDogfood: - if (_vm->_gyro->_dna._wonNim) { // We've won the game. + if (_vm->_gyro->_wonNim) { // We've won the game. displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else - _vm->_gyro->_dna._askedDogfoodAboutNim = true; + _vm->_gyro->_askedDogfoodAboutNim = true; break; case Gyro::kPeopleAyles: - if (!_vm->_gyro->_dna._aylesIsAwake) { + if (!_vm->_gyro->_aylesIsAwake) { displayScrollChain('q', 43); // He's fast asleep! return; - } else if (!_vm->_gyro->_dna._givenPenToAyles) { + } else if (!_vm->_gyro->_givenPenToAyles) { displayScrollChain('q', 44); // Can you get me a pen, Avvy? return; } @@ -213,29 +213,29 @@ void Visa::talkTo(byte whom) { return; case Gyro::kPeopleGeida: - if (_vm->_gyro->_dna._givenPotionToGeida) - _vm->_gyro->_dna._geidaFollows = true; + if (_vm->_gyro->_givenPotionToGeida) + _vm->_gyro->_geidaFollows = true; else { displayScrollChain('u', 17); return; } break; case Gyro::kPeopleSpurge: - if (!_vm->_gyro->_dna._sittingInPub) { + if (!_vm->_gyro->_sittingInPub) { displayScrollChain('q', 71); // Try going over and sitting down. return; } else { - if (_vm->_gyro->_dna._spurgeTalkCount < 5) - _vm->_gyro->_dna._spurgeTalkCount++; - if (_vm->_gyro->_dna._spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_gyro->_dna._spurgeTalkCount); + if (_vm->_gyro->_spurgeTalkCount < 5) + _vm->_gyro->_spurgeTalkCount++; + if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); return; } } break; } // On a subject. Is there any reason to block it? - } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_dna._aylesIsAwake)) { + } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -264,10 +264,10 @@ void Visa::talkTo(byte whom) { displayScrollChain('n', whom); // File not found! if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->_dna._objects[Gyro::kObjectBadge - 1] = true; + _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; _vm->_lucerna->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_gyro->_dna._talkedToCrapulus = true; + _vm->_gyro->_talkedToCrapulus = true; _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. _vm->_animation->_sprites[1]._vanishIfStill = true; From b083878dbefeb95c9bc9d4493839121565da6342 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 22:58:24 +0200 Subject: [PATCH 0947/1332] AVALANCHE: Remove duplicated direction enum, move direction to animation class --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/animation.cpp | 54 ++++++++++++++++----------------- engines/avalanche/animation.h | 2 ++ engines/avalanche/avalanche.cpp | 5 +-- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/gyro2.cpp | 6 ++-- engines/avalanche/gyro2.h | 14 --------- engines/avalanche/lucerna2.cpp | 18 +++++------ 8 files changed, 46 insertions(+), 57 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 747bcca5b42b..8387b0ff8420 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1160,7 +1160,7 @@ void Acci::standUp() { _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; _vm->_animation->appearPed(1, 2); - _vm->_gyro->_direction = Gyro::kDirectionLeft; + _vm->_animation->_direction = Animation::kDirLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_avvyInBed = false; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index bdca9fdcf17b..5ce809c76d28 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1279,7 +1279,7 @@ void Animation::animLink() { void Animation::stopWalking() { _sprites[0].stopWalk(); - _vm->_gyro->_direction = kDirStopped; + _direction = kDirStopped; if (_vm->_gyro->_alive) _sprites[0]._stepNum = 1; } @@ -1348,8 +1348,8 @@ void Animation::flipRoom(byte room, byte ped) { _vm->_lucerna->enterRoom(room, ped); appearPed(1, ped); _vm->_gyro->_enterCatacombsFromLustiesRoom = false; - _vm->_gyro->_oldDirection = _vm->_gyro->_direction; - _vm->_gyro->_direction = _sprites[0]._facingDir; + _oldDirection = _direction; + _direction = _sprites[0]._facingDir; _vm->_lucerna->drawDirection(); _vm->_lucerna->dawn(); @@ -1393,58 +1393,58 @@ void Animation::handleMoveKey(const Common::Event &event) { else { switch (event.kbd.keycode) { case Common::KEYCODE_UP: - if (_vm->_gyro->_direction != kDirUp) { - _vm->_gyro->_direction = kDirUp; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirUp) { + _direction = kDirUp; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_DOWN: - if (_vm->_gyro->_direction != kDirDown) { - _vm->_gyro->_direction = kDirDown; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirDown) { + _direction = kDirDown; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_LEFT: - if (_vm->_gyro->_direction != kDirLeft) { - _vm->_gyro->_direction = kDirLeft; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirLeft) { + _direction = kDirLeft; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_RIGHT: - if (_vm->_gyro->_direction != kDirRight) { - _vm->_gyro->_direction = kDirRight; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirRight) { + _direction = kDirRight; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->_direction != kDirUpRight) { - _vm->_gyro->_direction = kDirUpRight; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirUpRight) { + _direction = kDirUpRight; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->_direction != kDirDownRight) { - _vm->_gyro->_direction = kDirDownRight; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirDownRight) { + _direction = kDirDownRight; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_END: - if (_vm->_gyro->_direction != kDirDownLeft) { - _vm->_gyro->_direction = kDirDownLeft; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirDownLeft) { + _direction = kDirDownLeft; + changeDirection(0, _direction); } else stopWalking(); break; case Common::KEYCODE_HOME: - if (_vm->_gyro->_direction != kDirUpLeft) { - _vm->_gyro->_direction = kDirUpLeft; - changeDirection(0, _vm->_gyro->_direction); + if (_direction != kDirUpLeft) { + _direction = kDirUpLeft; + changeDirection(0, _direction); } else stopWalking(); break; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 73abadac2e25..185f2f8e98d6 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -113,6 +113,8 @@ class Animation { AnimationType _sprites[kSpriteNumbMax]; bool _mustExclaim; uint16 _sayWhat; + byte _direction; // The direction Avvy is currently facing. + byte _oldDirection; Animation(AvalancheEngine *vm); ~Animation(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 611a8ef3a82b..a5acf0988e64 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,7 +123,7 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); - sz.syncAsByte(_gyro->_direction); + sz.syncAsByte(_animation->_direction); sz.syncAsByte(_gyro->_carryNum); for (byte i = 0; i < kObjectNum; i++) sz.syncAsByte(_gyro->_objects[i]); @@ -459,7 +459,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _scrolls->displayText(tmpStr); if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible) - _animation->changeDirection(0, _gyro->_direction); // We push Avvy in the right direction is he was moving. + _animation->changeDirection(0, _animation->_direction); // We push Avvy in the right direction is he was moving. return true; } @@ -487,6 +487,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day += "th"; } + // Y2K compliant ;) return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5a9fa60dc30e..a4ead4a50843 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -147,7 +147,7 @@ void Avalot::setup() { _vm->_gyro->_ledStatus = 177; _vm->_gyro->_defaultLed = 2; // TSkellern = 0; Replace with a more local variable sometime - _vm->_gyro->_direction = Gyro::kDirectionStopped; + _vm->_animation->_direction = Animation::kDirStopped; _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index d9e0d7480463..1b950739fd8b 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -227,7 +227,7 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::resetVariables() { // Replaces memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); - _direction = 0; + _vm->_animation->_direction = 0; _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -326,7 +326,7 @@ void Gyro::newGame() { _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; _money = 30; // 2/6 - _direction = kDirectionStopped; + _vm->_animation->_direction = Animation::kDirStopped; _wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; @@ -339,7 +339,7 @@ void Gyro::newGame() { _onToolbar = false; _seeScroll = false; - _vm->_animation->_sprites[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. + _vm->_animation->_sprites[0].appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = 254; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 35addc3a5047..7581863dcaa1 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -211,24 +211,12 @@ class Gyro { // These following static constants should be included in CFG when it's written. static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. - static const int16 kBorder = 1; // size of border on shadowboxes - - enum Direction { - kDirectionUp, kDirectionRight, kDirectionDown, kDirectionLeft, - kDirectionUpRight, kDirectionDownRight, kDirectionDownLeft, kDirectionUpLeft, - kDirectionStopped - }; - static const int16 kWalk = 3; static const int16 kRun = 5; - static const int32 kCatacombMap[8][8]; - static const bool kDemo = false; // If this is true, we're in a demo of the game. - static const char kSpludwicksOrder[3]; - static const QuasipedType kQuasipeds[16]; enum Pitch { @@ -255,7 +243,6 @@ class Gyro { bool _onCanDoPageSwap; // Former DNA structure - byte _direction; // The direction Avvy is currently facing. byte _carryNum; // How many objects you're carrying... bool _objects[kObjectNum]; // ...and which ones they are. int16 _dnascore; // your score, of course @@ -343,7 +330,6 @@ class Gyro { ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. // Called .free() for them in ~Gyro(). - byte _oldDirection; int8 _scoreToDisplay[3]; byte _currentMouse; // current mouse-void Common::String _verbStr; // what you can do with your object. :-) diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 12b75523a4ed..9a7d0487637f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -913,7 +913,7 @@ void Lucerna::drawToolbar() { file.close(); CursorMan.showMouse(true); - _vm->_gyro->_oldDirection = 177; + _vm->_animation->_oldDirection = 177; drawDirection(); } @@ -967,22 +967,22 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { switch (color) { case kColorGreen: - _vm->_gyro->_direction = Animation::kDirUp; + _vm->_animation->_direction = Animation::kDirUp; _vm->_animation->changeDirection(0, Animation::kDirUp); drawDirection(); break; case kColorBrown: - _vm->_gyro->_direction = Animation::kDirDown; + _vm->_animation->_direction = Animation::kDirDown; _vm->_animation->changeDirection(0, Animation::kDirDown); drawDirection(); break; case kColorCyan: - _vm->_gyro->_direction = Animation::kDirLeft; + _vm->_animation->_direction = Animation::kDirLeft; _vm->_animation->changeDirection(0, Animation::kDirLeft); drawDirection(); break; case kColorLightmagenta: - _vm->_gyro->_direction = Animation::kDirRight; + _vm->_animation->_direction = Animation::kDirRight; _vm->_animation->changeDirection(0, Animation::kDirRight); drawDirection(); break; @@ -1167,13 +1167,13 @@ void Lucerna::dawn() { } void Lucerna::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_gyro->_oldDirection == _vm->_gyro->_direction) + if (_vm->_animation->_oldDirection == _vm->_animation->_direction) return; - _vm->_gyro->_oldDirection = _vm->_gyro->_direction; + _vm->_animation->_oldDirection = _vm->_animation->_direction; CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_gyro->_direction], 0, 161); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_animation->_direction], 0, 161); CursorMan.showMouse(true); } @@ -1240,7 +1240,7 @@ void Lucerna::spriteRun() { void Lucerna::fixFlashers() { _vm->_gyro->_ledStatus = 177; - _vm->_gyro->_oldDirection = 177; + _vm->_animation->_oldDirection = 177; _vm->_scrolls->setReadyLight(2); drawDirection(); } From a773f0eb2bc93af65769160f0f5359e7c6e2168a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 23:18:53 +0200 Subject: [PATCH 0948/1332] AVALANCHE: Remove some dead/useless code --- engines/avalanche/acci2.cpp | 6 ------ engines/avalanche/gyro2.cpp | 1 - engines/avalanche/gyro2.h | 3 +-- engines/avalanche/lucerna2.cpp | 3 --- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 8387b0ff8420..c31bc90aac1f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1532,12 +1532,6 @@ void Acci::doThat() { _vm->_scrolls->displayText("Vandalism is prohibited within this game!"); break; case kVerbCodeQuit: // quit - if (_vm->_gyro->kDemo) { - warning("STUB: Acci::doThat() - case kVerbCodequit"); - // _vm->_visa->displayScrollChain('pos', 31); - // close(demofile); - // exit(0); // Change this later!!! - } if (!_polite) _vm->_scrolls->displayText("How about a `please\", Avvy?"); else if (_vm->_scrolls->displayQuestion(Common::String(Scrolls::kControlRegister) + 'C' + Scrolls::kControlIcon + "Do you really want to quit?")) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 1b950739fd8b..17d21f420586 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -318,7 +318,6 @@ void Gyro::newGame() { _vm->_animation->_sprites[0].init(0, true, _vm->_animation); _alive = true; - _score = 0; resetVariables(); _vm->_scrolls->setBubbleStateNatural(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 7581863dcaa1..20e240af0b3f 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -215,7 +215,6 @@ class Gyro { static const int16 kWalk = 3; static const int16 kRun = 5; static const int32 kCatacombMap[8][8]; - static const bool kDemo = false; // If this is true, we're in a demo of the game. static const char kSpludwicksOrder[3]; static const QuasipedType kQuasipeds[16]; @@ -319,7 +318,7 @@ class Gyro { bool _weirdWord; bool _letMeOut; Common::String _scroll[15]; - byte _scrollNum, _score, _whichwas; + byte _scrollNum, _whichwas; byte _thinks; bool _thinkThing; int16 _talkX, _talkY; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 9a7d0487637f..76329e311872 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -918,9 +918,6 @@ void Lucerna::drawToolbar() { } void Lucerna::drawScore() { - if (_vm->_gyro->kDemo) - return; - uint16 score = _vm->_gyro->_dnascore; int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { From c288b09ca094422e484fd6d686dd8209cc69b0ac Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Sep 2013 23:30:08 +0200 Subject: [PATCH 0949/1332] AVALANCHE: Simplify the use of string for displayQuestion() --- engines/avalanche/acci2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index c31bc90aac1f..95cd06a2b4b9 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1534,8 +1534,11 @@ void Acci::doThat() { case kVerbCodeQuit: // quit if (!_polite) _vm->_scrolls->displayText("How about a `please\", Avvy?"); - else if (_vm->_scrolls->displayQuestion(Common::String(Scrolls::kControlRegister) + 'C' + Scrolls::kControlIcon + "Do you really want to quit?")) - _vm->_gyro->_letMeOut = true; + else { + Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Scrolls::kControlRegister, Scrolls::kControlIcon); + if (_vm->_scrolls->displayQuestion(tmpStr)) + _vm->_gyro->_letMeOut = true; + } break; case kVerbCodeGo: _vm->_scrolls->displayText("Just use the arrow keys to walk there."); From ef219d5c99adf8dab171c45fbb7f03921f485e2b Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 14 Sep 2013 01:44:13 +0200 Subject: [PATCH 0950/1332] AVALANCHE: Silence clang warning. --- engines/avalanche/acci2.cpp | 421 +++++++++++++++++++++++---------- engines/avalanche/acci2.h | 7 +- engines/avalanche/scrolls2.cpp | 2 +- 3 files changed, 303 insertions(+), 127 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 8387b0ff8420..c5a5a8e383f6 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -48,123 +48,287 @@ namespace Avalanche { -const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { +Acci::Acci(AvalancheEngine *vm) { + _vm = vm; +} + +void Acci::init() { + _vm->_gyro->_weirdWord = false; + + // Initailaze the vocabulary. // Verbs: 1-49 - {1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, // short - {2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"}, - {3, "PAUSE"}, {47, "TA"}, // Early to avoid Take and Talk. - {4, "TAKE"}, {4, "GET"}, {4, "PICK"}, - {5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"}, - {7, "SAY"}, {7, "ASK"}, - {8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"}, - {9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"}, - {11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"}, - {13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"}, - {15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"}, - {17, "STAND"}, - {18, "GO"}, {19, "INFO"}, {20, "UNDRESS"}, - {20, "DOFF"}, - {21, "DRESS"}, {21, "WEAR"}, {21, "DON"}, - {22, "PLAY"}, - {22, "STRUM"}, {23, "RING"}, {24, "HELP"}, - {25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"}, - {255, "NINET"}, // block for NINETY - {28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"}, - {30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"}, - {30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"}, - {30, "WIZZY"}, {30, "PLOVER"}, - {30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"}, - {30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"}, - {30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"}, - {30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"}, - {30, "BONESCROLLS"}, {30, "RADOF"}, - {31, "RESTART"}, - {32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"}, - {33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"}, - {34, "ORDER"}, {34, "DEMAND"}, - {35, "ATTACK"}, {35, "HIT"}, {35, "KILL"}, - {35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"}, - {35, "FIRE"}, + _vocabulary[0].init(1, "EXAMINE"); + _vocabulary[1].init(1, "READ"); + _vocabulary[2].init(1, "XAM"); + _vocabulary[3].init(2, "OPEN"); + _vocabulary[4].init(2, "LEAVE"); + _vocabulary[5].init(2, "UNLOCK"); + _vocabulary[6].init(3, "PAUSE"); + _vocabulary[7].init(47, "TA"); // Early to avoid Take and Talk. + _vocabulary[8].init(4, "TAKE"); + _vocabulary[9].init(4, "GET"); + _vocabulary[10].init(4, "PICK"); + _vocabulary[11].init(5, "DROP"); + _vocabulary[12].init(6, "INVENTORY"); + _vocabulary[13].init(7, "TALK"); + _vocabulary[14].init(7, "SAY"); + _vocabulary[15].init(7, "ASK"); + _vocabulary[16].init(8, "GIVE"); + _vocabulary[17].init(9, "DRINK"); + _vocabulary[18].init(9, "IMBIBE"); + _vocabulary[19].init(9, "DRAIN"); + _vocabulary[20].init(10, "LOAD"); + _vocabulary[21].init(10, "RESTORE"); + _vocabulary[22].init(11, "SAVE"); + _vocabulary[23].init(12, "BRIBE"); + _vocabulary[24].init(12, "PAY"); + _vocabulary[25].init(13, "LOOK"); + _vocabulary[26].init(14, "BREAK"); + _vocabulary[27].init(15, "QUIT"); + _vocabulary[28].init(15, "EXIT"); + _vocabulary[29].init(16, "SIT"); + _vocabulary[30].init(16, "SLEEP"); + _vocabulary[31].init(17, "STAND"); + + _vocabulary[32].init(18, "GO"); + _vocabulary[33].init(19, "INFO"); + _vocabulary[34].init(20, "UNDRESS"); + _vocabulary[35].init(20, "DOFF"); + _vocabulary[36].init(21, "DRESS"); + _vocabulary[37].init(21, "WEAR"); + _vocabulary[38].init(21, "DON"); + _vocabulary[39].init(22, "PLAY"); + _vocabulary[40].init(22, "STRUM"); + _vocabulary[41].init(23, "RING"); + _vocabulary[42].init(24, "HELP"); + _vocabulary[43].init(25, "KENDAL"); + _vocabulary[44].init(26, "CAPYBARA"); + _vocabulary[45].init(27, "BOSS"); + _vocabulary[46].init(255, "NINET"); // block for NINETY + _vocabulary[47].init(28, "URINATE"); + _vocabulary[48].init(28, "MINGITE"); + _vocabulary[49].init(29, "NINETY"); + _vocabulary[50].init(30, "ABRACADABRA"); + _vocabulary[51].init(30, "PLUGH"); + _vocabulary[52].init(30, "XYZZY"); + _vocabulary[53].init(30, "HOCUS"); + _vocabulary[54].init(30, "POCUS"); + _vocabulary[55].init(30, "IZZY"); + _vocabulary[56].init(30, "WIZZY"); + _vocabulary[57].init(30, "PLOVER"); + _vocabulary[58].init(30, "MELENKURION"); + _vocabulary[59].init(30, "ZORTON"); + _vocabulary[60].init(30, "BLERBI"); + _vocabulary[61].init(30, "THURB"); + _vocabulary[62].init(30, "SNOEZE"); + _vocabulary[63].init(30, "SAMOHT"); + _vocabulary[64].init(30, "NOSIDE"); + _vocabulary[65].init(30, "PHUGGG"); + _vocabulary[66].init(30, "KNERL"); + _vocabulary[67].init(30, "MAGIC"); + _vocabulary[68].init(30, "KLAETU"); + _vocabulary[69].init(30, "VODEL"); + _vocabulary[70].init(30, "BONESCROLLS"); + _vocabulary[71].init(30, "RADOF"); + + _vocabulary[72].init(31, "RESTART"); + _vocabulary[73].init(32, "SWALLOW"); + _vocabulary[74].init(32, "EAT"); + _vocabulary[75].init(33, "LISTEN"); + _vocabulary[76].init(33, "HEAR"); + _vocabulary[77].init(34, "BUY"); + _vocabulary[78].init(34, "PURCHASE"); + _vocabulary[79].init(34, "ORDER"); + _vocabulary[80].init(34, "DEMAND"); + _vocabulary[81].init(35, "ATTACK"); + _vocabulary[82].init(35, "HIT"); + _vocabulary[83].init(35, "KILL"); + _vocabulary[84].init(35, "PUNCH"); + _vocabulary[85].init(35, "KICK"); + _vocabulary[86].init(35, "SHOOT"); + _vocabulary[87].init(35, "FIRE"); // Passwords: 36 - {36, "TIROS"}, {36, "WORDY"}, {36, "STACK"}, - {36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"}, - {36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"}, - {36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"}, - {36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"}, - {36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"}, - {36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"}, - {36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"}, - {36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"}, - {36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"}, - {37, "DIR"}, {37, "LS"}, {38, "DIE"}, - {39, "SCORE"}, - {40, "PUT"}, {40, "INSERT"}, {41, "KISS"}, - {41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"}, - {42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"}, - {44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"}, - {46, "HELLO"}, {46, "HI"}, {46, "YO"}, - {47, "THANKS"}, // = 47, "ta", which was defined earlier. + _vocabulary[88].init(36, "TIROS"); + _vocabulary[89].init(36, "WORDY"); + _vocabulary[90].init(36, "STACK"); + _vocabulary[91].init(36, "SHADOW"); + _vocabulary[92].init(36, "OWL"); + _vocabulary[93].init(36, "ACORN"); + _vocabulary[94].init(36, "DOMESDAY"); + _vocabulary[95].init(36, "FLOPPY"); + _vocabulary[96].init(36, "DIODE"); + _vocabulary[97].init(36, "FIELD"); + _vocabulary[98].init(36, "COWSLIP"); + _vocabulary[99].init(36, "OSBYTE"); + _vocabulary[100].init(36, "OSCLI"); + _vocabulary[101].init(36, "TIMBER"); + _vocabulary[102].init(36, "ADVAL"); + _vocabulary[103].init(36, "NEUTRON"); + _vocabulary[104].init(36, "POSITRON"); + _vocabulary[105].init(36, "ELECTRON"); + _vocabulary[106].init(36, "CIRCUIT"); + _vocabulary[107].init(36, "AURUM"); + _vocabulary[108].init(36, "PETRIFY"); + _vocabulary[109].init(36, "EBBY"); + _vocabulary[110].init(36, "CATAPULT"); + _vocabulary[111].init(36, "GAMERS"); + _vocabulary[112].init(36, "FUDGE"); + _vocabulary[113].init(36, "CANDLE"); + _vocabulary[114].init(36, "BEEB"); + _vocabulary[115].init(36, "MICRO"); + _vocabulary[116].init(36, "SESAME"); + _vocabulary[117].init(36, "LORDSHIP"); + + _vocabulary[118].init(37, "DIR"); + _vocabulary[119].init(37, "LS"); + _vocabulary[120].init(38, "DIE"); + _vocabulary[121].init(39, "SCORE"); + _vocabulary[122].init(40, "PUT"); + _vocabulary[123].init(40, "INSERT"); + _vocabulary[124].init(41, "KISS"); + _vocabulary[125].init(41, "SNOG"); + _vocabulary[126].init(41, "CUDDLE"); + _vocabulary[127].init(42, "CLIMB"); + _vocabulary[128].init(42, "CLAMBER"); + _vocabulary[129].init(43, "JUMP"); + _vocabulary[130].init(44, "HIGHSCORES"); + _vocabulary[131].init(44, "HISCORES"); + _vocabulary[132].init(45, "WAKEN"); + _vocabulary[133].init(45, "AWAKEN"); + _vocabulary[134].init(46, "HELLO"); + _vocabulary[135].init(46, "HI"); + _vocabulary[136].init(46, "YO"); + _vocabulary[137].init(47, "THANKS"); // = 47, "ta", which was defined earlier. // Nouns - Objects: 50-100 - {50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"}, - {50, "VINEGAR"}, {51, "MONEYBAG"}, - {51, "BAG"}, {51, "CASH"}, {51, "DOSH"}, - {51, "WALLET"}, - {52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"}, - {54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"}, - {55, "ARROW"}, {55, "DART"}, - {56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"}, - {58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"}, - {59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"}, - {62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"}, - {63, "PEN"}, {63, "QUILL"}, {64, "INK"}, - {64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"}, - {66, "DISGUISE"}, {67, "ONION"}, - {99, "PASSWORD"}, + _vocabulary[138].init(50, "WINE"); + _vocabulary[139].init(50, "BOOZE"); + _vocabulary[140].init(50, "NASTY"); + _vocabulary[141].init(50, "VINEGAR"); + _vocabulary[142].init(51, "MONEYBAG"); + _vocabulary[143].init(51, "BAG"); + _vocabulary[144].init(51, "CASH"); + _vocabulary[145].init(51, "DOSH"); + _vocabulary[146].init(51, "WALLET"); + _vocabulary[147].init(52, "BODKIN"); + _vocabulary[148].init(52, "DAGGER"); + _vocabulary[149].init(53, "POTION"); + _vocabulary[150].init(54, "CHASTITY"); + _vocabulary[151].init(54, "BELT"); + _vocabulary[152].init(55, "BOLT"); + _vocabulary[153].init(55, "ARROW"); + _vocabulary[154].init(55, "DART"); + _vocabulary[155].init(56, "CROSSBOW"); + _vocabulary[156].init(56, "BOW"); + _vocabulary[157].init(57, "LUTE"); + _vocabulary[158].init(58, "PILGRIM"); + _vocabulary[159].init(58, "BADGE"); + _vocabulary[160].init(59, "MUSHROOMS"); + _vocabulary[161].init(59, "TOADSTOOLS"); + _vocabulary[162].init(60, "KEY"); + _vocabulary[163].init(61, "BELL"); + _vocabulary[164].init(62, "PRESCRIPT"); + _vocabulary[165].init(62, "SCROLL"); + _vocabulary[166].init(62, "MESSAGE"); + _vocabulary[167].init(63, "PEN"); + _vocabulary[168].init(63, "QUILL"); + _vocabulary[169].init(64, "INK"); + _vocabulary[170].init(64, "INKPOT"); + _vocabulary[171].init(65, "CLOTHES"); + _vocabulary[172].init(66, "HABIT"); + _vocabulary[173].init(66, "DISGUISE"); + _vocabulary[174].init(67, "ONION"); + + _vocabulary[175].init(99, "PASSWORD"); // Objects from Also are placed between 101 and 131. - // Nouns - People - Male: 150-174 - {150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"}, - {150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"}, - {151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"}, - {152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"}, - {158, "DU"}, // <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke. - {152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"}, - {154, "MALAGAUCHE"}, - {155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"}, - {156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"}, - {157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"}, - {159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"}, - {160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"}, - {161, "STALLHOLDER"}, - {162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"}, - {163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"}, - {166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"}, + _vocabulary[176].init(150, "AVVY"); + _vocabulary[177].init(150, "AVALOT"); + _vocabulary[178].init(150, "YOURSELF"); + _vocabulary[179].init(150, "ME"); + _vocabulary[180].init(150, "MYSELF"); + _vocabulary[181].init(151, "SPLUDWICK"); + _vocabulary[182].init(151, "THOMAS"); + _vocabulary[183].init(151, "ALCHEMIST"); + _vocabulary[184].init(151, "CHEMIST"); + _vocabulary[185].init(152, "CRAPULUS"); + _vocabulary[186].init(152, "SERF"); + _vocabulary[187].init(152, "SLAVE"); + _vocabulary[188].init(158, "DU"); // Put in early for Baron DU Lustie to save confusion with Duck & Duke. + _vocabulary[189].init(152, "CRAPPY"); + _vocabulary[190].init(153, "DUCK"); + _vocabulary[191].init(153, "DOCTOR"); + _vocabulary[192].init(154, "MALAGAUCHE"); + _vocabulary[193].init(155, "FRIAR"); + _vocabulary[194].init(155, "TUCK"); + _vocabulary[195].init(156, "ROBIN"); + _vocabulary[196].init(156, "HOOD"); + _vocabulary[197].init(157, "CWYTALOT"); + _vocabulary[198].init(157, "GUARD"); + _vocabulary[199].init(157, "BRIDGEKEEP"); + _vocabulary[200].init(158, "BARON"); + _vocabulary[201].init(158, "LUSTIE"); + _vocabulary[202].init(159, "DUKE"); + _vocabulary[203].init(159, "GRACE"); + _vocabulary[204].init(160, "DOGFOOD"); + _vocabulary[205].init(160, "MINSTREL"); + _vocabulary[206].init(161, "TRADER"); + _vocabulary[207].init(161, "SHOPKEEPER"); + _vocabulary[208].init(161, "STALLHOLDER"); + _vocabulary[209].init(162, "PILGRIM"); + _vocabulary[210].init(162, "IBYTHNETH"); + _vocabulary[211].init(163, "ABBOT"); + _vocabulary[212].init(163, "AYLES"); + _vocabulary[213].init(164, "PORT"); + _vocabulary[214].init(165, "SPURGE"); + _vocabulary[215].init(166, "JACQUES"); + _vocabulary[216].init(166, "SLEEPER"); + _vocabulary[217].init(166, "RINGER"); // Nouns - People - Female: 175-199 - {175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"}, - {176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"}, - {178, "WITCH"}, + _vocabulary[218].init(175, "WIFE"); + _vocabulary[219].init(175, "ARKATA"); + _vocabulary[220].init(176, "GEDALODAVA"); + _vocabulary[221].init(176, "GEIDA"); + _vocabulary[222].init(176, "PRINCESS"); + _vocabulary[223].init(178, "WISE"); + _vocabulary[224].init(178, "WITCH"); // Pronouns: 200-224 - {200, "HIM"}, {200, "MAN"}, {200, "GUY"}, - {200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"}, - {201, "HER"}, {201, "GIRL"}, {201, "WOMAN"}, - {202, "IT"}, {202, "THING"}, - {203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"}, + _vocabulary[225].init(200, "HIM"); + _vocabulary[226].init(200, "MAN"); + _vocabulary[227].init(200, "GUY"); + _vocabulary[228].init(200, "DUDE"); + _vocabulary[229].init(200, "CHAP"); + _vocabulary[230].init(200, "FELLOW"); + _vocabulary[231].init(201, "HER"); + _vocabulary[232].init(201, "GIRL"); + _vocabulary[233].init(201, "WOMAN"); + _vocabulary[234].init(202, "IT"); + _vocabulary[235].init(202, "THING"); + _vocabulary[236].init(203, "MONK"); + _vocabulary[237].init(204, "BARMAN"); + _vocabulary[238].init(204, "BARTENDER"); // Prepositions: 225-249 - {225, "TO"}, {226, "AT"}, {227, "UP"}, - {228, "INTO"}, {228, "INSIDE"}, {229, "OFF"}, - {230, "UP"}, {231, "DOWN"}, {232, "ON"}, + _vocabulary[239].init(225, "TO"); + _vocabulary[240].init(226, "AT"); + _vocabulary[241].init(227, "UP"); + _vocabulary[242].init(228, "INTO"); + _vocabulary[243].init(228, "INSIDE"); + _vocabulary[244].init(229, "OFF"); + _vocabulary[245].init(230, "UP"); + _vocabulary[246].init(231, "DOWN"); + _vocabulary[247].init(232, "ON"); // Please: 251 - {251, "PLEASE"}, + _vocabulary[248].init(251, "PLEASE"); // About: 252 - {252, "ABOUT"}, {252, "CONCERNING"}, + _vocabulary[249].init(252, "ABOUT"); + _vocabulary[250].init(252, "CONCERNING"); // Swear words: 253 /* I M P O R T A N T M E S S A G E @@ -174,30 +338,37 @@ const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = { GOODNESS KNOWS WHO WROTE THEM. READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ - - {253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"}, - {253, "FART"}, {253, "FUCK"}, {253, "BALLS"}, - {253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"}, - {253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"}, - {253, "SMEG"}, - // ...and other even ruder words. You didn't read them, did you? Good. */ + _vocabulary[251].init(253, "SHIT"); + _vocabulary[252].init(28 , "PISS"); + _vocabulary[253].init(28 , "PEE"); + _vocabulary[254].init(253, "FART"); + _vocabulary[255].init(253, "FUCK"); + _vocabulary[256].init(253, "BALLS"); + _vocabulary[257].init(253, "BLAST"); + _vocabulary[258].init(253, "BUGGER"); + _vocabulary[259].init(253, "KNICKERS"); + _vocabulary[260].init(253, "BLOODY"); + _vocabulary[261].init(253, "HELL"); + _vocabulary[262].init(253, "DAMN"); + _vocabulary[263].init(253, "SMEG"); + // ...and other even ruder words. You didn't read them, did you? Good. // Answer-back smart-alec words: 249 - {249, "YES"}, {249, "NO"}, {249, "BECAUSE"}, + _vocabulary[264].init(249, "YES"); + _vocabulary[265].init(249, "NO"); + _vocabulary[266].init(249, "BECAUSE"); // Noise words: 255 - {255, "THE"}, {255, "A"}, {255, "NOW"}, - {255, "SOME"}, {255, "AND"}, {255, "THAT"}, - {255, "POCUS"}, {255, "HIS"}, - {255, "THIS"}, {255, "SENTINEL"} // for "Ken SENT Me" -}; - -Acci::Acci(AvalancheEngine *vm) { - _vm = vm; -} - -void Acci::init() { - _vm->_gyro->_weirdWord = false; + _vocabulary[267].init(255, "THE"); + _vocabulary[268].init(255, "A"); + _vocabulary[269].init(255, "NOW"); + _vocabulary[270].init(255, "SOME"); + _vocabulary[271].init(255, "AND"); + _vocabulary[272].init(255, "THAT"); + _vocabulary[273].init(255, "POCUS"); + _vocabulary[274].init(255, "HIS"); + _vocabulary[275].init(255, "THIS"); + _vocabulary[276].init(255, "SENTINEL"); // for "Ken SENT Me" } void Acci::clearWords() { @@ -212,14 +383,14 @@ byte Acci::wordNum(Common::String word) { return 0; for (int32 i = kParserWordsNum - 1; i >= 0; i--) { - if (kVocabulary[i]._word == word) - return kVocabulary[i]._number; + if (_vocabulary[i]._word == word) + return _vocabulary[i]._number; } // If not found as a whole, we look for it as a substring. for (int32 i = kParserWordsNum - 1; i >= 0; i--) { - if (Common::String(kVocabulary[i]._word.c_str(), word.size()) == word) - return kVocabulary[i]._number; + if (Common::String(_vocabulary[i]._word.c_str(), word.size()) == word) + return _vocabulary[i]._number; } return kPardon; @@ -1920,8 +2091,8 @@ void Acci::doThat() { Common::String temp = _realWords[i]; temp.toUppercase(); int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; - for (byte j = 0; j < kVocabulary[pwdId]._word.size(); j++) { - if (kVocabulary[pwdId]._word[j] != temp[j]) + for (byte j = 0; j < _vocabulary[pwdId]._word.size(); j++) { + if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; } } diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index dab5371f4264..07816cc772a1 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -60,9 +60,14 @@ class Acci { struct VocabEntry { byte _number; Common::String _word; + + void init(byte number, Common::String word) { + _number = number; + _word = word; + } }; - static const VocabEntry kVocabulary[kParserWordsNum]; + VocabEntry _vocabulary[kParserWordsNum]; Common::String _realWords[11]; byte _verb, _person, _thing; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 2830e9eee034..3bcb2e0cccfe 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -704,7 +704,7 @@ void Scrolls::callScrollDriver() { break; case 2: { int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_passwordNum; - displayText(_vm->_acci->kVocabulary[pwdId]._word + kControlToBuffer); + displayText(_vm->_acci->_vocabulary[pwdId]._word + kControlToBuffer); } break; case 3: From b710844971ec4e193444648239a45446da4ac697 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 14 Sep 2013 01:52:18 +0200 Subject: [PATCH 0951/1332] AVALANCHE: Repair regression introduced when removing DNA. --- engines/avalanche/gyro2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 17d21f420586..58868069a16c 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -239,7 +239,7 @@ void Gyro::resetVariables() { _sworeNum = 0; _saveNum = 0; for (int i = 0; i < 100; i++) - _roomCount[100] = 0; + _roomCount[i] = 0; _alcoholLevel = 0; _playedNim = 0; From 5be2d50e14a37952716c41f896700274510f166a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 14 Sep 2013 19:38:52 +0200 Subject: [PATCH 0952/1332] AVALANCHE: Reduce verbosity related to animation sprites --- engines/avalanche/acci2.cpp | 24 +++--- engines/avalanche/avalanche.cpp | 59 ++++++------- engines/avalanche/dropdown2.cpp | 7 +- engines/avalanche/gyro2.cpp | 12 +-- engines/avalanche/lucerna2.cpp | 142 +++++++++++++++++--------------- engines/avalanche/scrolls2.cpp | 5 +- engines/avalanche/timer.cpp | 108 ++++++++++++++---------- 7 files changed, 200 insertions(+), 157 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index c2556192999c..ad1e3725ee59 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1765,13 +1765,14 @@ void Acci::doThat() { i = 3; else i = 0; - if (_vm->_animation->_sprites[0]._id != i) { - int16 x = _vm->_animation->_sprites[0]._x; - int16 y = _vm->_animation->_sprites[0]._y; - _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[0].init(i, true, _vm->_animation); - _vm->_animation->_sprites[0].appear(x, y, Animation::kDirLeft); - _vm->_animation->_sprites[0]._visible = false; + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; + if (spr->_id != i) { + int16 x = spr->_x; + int16 y = spr->_y; + spr->remove(); + spr->init(i, true, _vm->_animation); + spr->appear(x, y, Animation::kDirLeft); + spr->_visible = false; } } break; @@ -1900,11 +1901,12 @@ void Acci::doThat() { if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->displayScrollChain('q', 18); else { - _vm->_animation->_sprites[1].init(1, false, _vm->_animation); // Avaricius + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->init(1, false, _vm->_animation); // Avaricius _vm->_animation->appearPed(2, 4); - _vm->_animation->_sprites[1].walkTo(5); - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcBackAndForth; + spr->walkTo(5); + spr->_callEachStepFl = true; + spr->_eachStepProc = Animation::kProcBackAndForth; _vm->_gyro->_avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a5acf0988e64..66b7462d63b3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -285,41 +285,43 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { if (sz.isLoading()) { for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. - if (_animation->_sprites[i]._quick) - _animation->_sprites[i].remove(); + AnimationType *spr = &_animation->_sprites[i]; + if (spr->_quick) + spr->remove(); } } for (byte i = 0; i < spriteNum; i++) { - sz.syncAsByte(_animation->_sprites[i]._id); - sz.syncAsByte(_animation->_sprites[i]._doCheck); + AnimationType *spr = &_animation->_sprites[i]; + sz.syncAsByte(spr->_id); + sz.syncAsByte(spr->_doCheck); if (sz.isLoading()) { - _animation->_sprites[i]._quick = true; - _animation->_sprites[i].init(_animation->_sprites[i]._id, _animation->_sprites[i]._doCheck, _animation); + spr->_quick = true; + spr->init(spr->_id, spr->_doCheck, _animation); } - sz.syncAsByte(_animation->_sprites[i]._moveX); - sz.syncAsByte(_animation->_sprites[i]._moveY); - sz.syncAsByte(_animation->_sprites[i]._facingDir); - sz.syncAsByte(_animation->_sprites[i]._stepNum); - sz.syncAsByte(_animation->_sprites[i]._visible); - sz.syncAsByte(_animation->_sprites[i]._homing); - sz.syncAsByte(_animation->_sprites[i]._count); - sz.syncAsByte(_animation->_sprites[i]._info._xWidth); - sz.syncAsByte(_animation->_sprites[i]._speedX); - sz.syncAsByte(_animation->_sprites[i]._speedY); - sz.syncAsByte(_animation->_sprites[i]._animCount); - sz.syncAsSint16LE(_animation->_sprites[i]._homingX); - sz.syncAsSint16LE(_animation->_sprites[i]._homingY); - sz.syncAsByte(_animation->_sprites[i]._callEachStepFl); - sz.syncAsByte(_animation->_sprites[i]._eachStepProc); - sz.syncAsByte(_animation->_sprites[i]._vanishIfStill); - sz.syncAsSint16LE(_animation->_sprites[i]._x); - sz.syncAsSint16LE(_animation->_sprites[i]._y); - - if (sz.isLoading() && _animation->_sprites[i]._visible) - _animation->_sprites[i].appear(_animation->_sprites[i]._x, _animation->_sprites[i]._y, _animation->_sprites[i]._facingDir); + sz.syncAsByte(spr->_moveX); + sz.syncAsByte(spr->_moveY); + sz.syncAsByte(spr->_facingDir); + sz.syncAsByte(spr->_stepNum); + sz.syncAsByte(spr->_visible); + sz.syncAsByte(spr->_homing); + sz.syncAsByte(spr->_count); + sz.syncAsByte(spr->_info._xWidth); + sz.syncAsByte(spr->_speedX); + sz.syncAsByte(spr->_speedY); + sz.syncAsByte(spr->_animCount); + sz.syncAsSint16LE(spr->_homingX); + sz.syncAsSint16LE(spr->_homingY); + sz.syncAsByte(spr->_callEachStepFl); + sz.syncAsByte(spr->_eachStepProc); + sz.syncAsByte(spr->_vanishIfStill); + sz.syncAsSint16LE(spr->_x); + sz.syncAsSint16LE(spr->_y); + + if (sz.isLoading() && spr->_visible) + spr->appear(spr->_x, spr->_y, spr->_facingDir); } //groi = 177; @@ -458,7 +460,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _scrolls->displayText(tmpStr); - if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible) + AnimationType *avvy = &_animation->_sprites[0]; + if (avvy->_quick && avvy->_visible) _animation->changeDirection(0, _animation->_direction); // We push Avvy in the right direction is he was moving. return true; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 62f4680c5717..1f499a22afe5 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -624,10 +624,11 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callVerb(Acci::kVerbCodeInv); break; case 5: { - if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) - _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (avvy->_speedX == _vm->_gyro->kWalk) + avvy->_speedX = _vm->_gyro->kRun; else - _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; + avvy->_speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); } break; diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 58868069a16c..9be471c9fde8 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -310,12 +310,14 @@ void Gyro::resetVariables() { void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { - if (_vm->_animation->_sprites[i]._quick) - _vm->_animation->_sprites[i].remove(); + AnimationType *spr = &_vm->_animation->_sprites[i]; + if (spr->_quick) + spr->remove(); } // Deallocate sprite. Sorry, beta testers! - _vm->_animation->_sprites[0].init(0, true, _vm->_animation); + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(0, true, _vm->_animation); _alive = true; resetVariables(); @@ -338,7 +340,7 @@ void Gyro::newGame() { _onToolbar = false; _seeScroll = false; - _vm->_animation->_sprites[0].appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. + avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = 254; @@ -352,7 +354,7 @@ void Gyro::newGame() { _enidFilename = ""; _vm->_lucerna->enterRoom(1, 1); - _vm->_animation->_sprites[0]._visible = false; + avvy->_visible = false; _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); _vm->_lucerna->_clock.update(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 76329e311872..88512390e95f 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -411,10 +411,12 @@ void Lucerna::enterNewTown() { void Lucerna::putGeidaAt(byte whichPed, byte &ped) { if (ped == 0) return; - _vm->_animation->_sprites[1].init(5, false, _vm->_animation); // load Geida + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + + spr1->init(5, false, _vm->_animation); // load Geida _vm->_animation->appearPed(2, whichPed); - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGeida; + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcGeida; } void Lucerna::enterRoom(byte room, byte ped) { @@ -453,28 +455,29 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsideyours: if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (! _vm->_gyro->_talkedToCrapulus) { - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__outsideyours; - _vm->_animation->_sprites[1].init(8, false, _vm->_animation); // load Crapulus + spr1->init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_roomCount[r__outsideyours] == 1) { _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. - _vm->_animation->_sprites[1].walkTo(5); // Walks up to greet you. + spr1->walkTo(5); // Walks up to greet you. } else { _vm->_animation->appearPed(2, 5); // Starts where he was before. - _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; + spr1->_facingDir = Animation::kDirLeft; } - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. - } else _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; + } else + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; if (_vm->_gyro->_crapulusWillTell) { - _vm->_animation->_sprites[1].init(8, false, _vm->_animation); + spr1->init(8, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - _vm->_animation->_sprites[1].walkTo(4); + spr1->walkTo(4); _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_crapulusWillTell = false; } @@ -490,16 +493,17 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__spludwicks: if (_vm->_gyro->_spludwickAtHome) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (ped > 0) { - _vm->_animation->_sprites[1].init(2, false, _vm->_animation); // load Spludwick + spr1->init(2, false, _vm->_animation); // load Spludwick _vm->_animation->appearPed(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } _vm->_gyro->_dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGeida; + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcGeida; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -512,30 +516,31 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { - _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFollowAvvyY; + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(4, false, _vm->_animation); // 4 = Cwytalot + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFollowAvvyY; _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_roomCount[r__brummieroad] == 1) { // First time here... _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... - _vm->_animation->_sprites[1].walkTo(4); // ...and he walks up... + spr1->walkTo(4); // ...and he walks up... } else { // You've been here before. _vm->_animation->appearPed(2, 4); // He's standing in your way straight away... - _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; + spr1->_facingDir = Animation::kDirLeft; } } } break; case r__argentroad: - if ((_vm->_gyro->_cwytalotGone) && (! _vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && - (_vm->_gyro->_roomCount[r__argentroad] > 3)) { - _vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot again + if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[r__argentroad] > 3)) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->appearPed(2, 1); - _vm->_animation->_sprites[1].walkTo(2); - _vm->_animation->_sprites[1]._vanishIfStill = true; + spr1->walkTo(2); + spr1->_vanishIfStill = true; _vm->_gyro->_passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); @@ -556,9 +561,10 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { if (! _vm->_gyro->_beenTiedUp) { // A welcome party... or maybe not... - _vm->_animation->_sprites[1].init(6, false, _vm->_animation); + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(6, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - _vm->_animation->_sprites[1].walkTo(3); + spr1->walkTo(3); _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } } @@ -577,28 +583,30 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__outsidecardiffcastle: - if (ped > 0) + if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; switch (_vm->_gyro->_cardiffQuestionNum) { - case 0 : { // You've answered NONE of his questions. - _vm->_animation->_sprites[1].init(9, false, _vm->_animation); + case 0 : // You've answered NONE of his questions. + spr1->init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - _vm->_animation->_sprites[1].walkTo(3); + spr1->walkTo(3); _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); - } - break; + break; case 5 : _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; break; // You've answered ALL his questions. => nothing happens. - default: { // You've answered SOME of his questions. - _vm->_animation->_sprites[1].init(9, false, _vm->_animation); + default: // You've answered SOME of his questions. + spr1->init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 3); - _vm->_animation->_sprites[1]._facingDir = Animation::kDirRight; + spr1->_facingDir = Animation::kDirRight; _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } - } + } + if (_vm->_gyro->_cardiffQuestionNum < 5) _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; - else _vm->_gyro->_interrogation = 0; + else + _vm->_gyro->_interrogation = 0; break; case r__map: @@ -717,18 +725,20 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__wisewomans: - _vm->_animation->_sprites[1].init(11, false, _vm->_animation); + case r__wisewomans: { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(11, false, _vm->_animation); if ((_vm->_gyro->_roomCount[r__wisewomans] == 1) && (ped > 0)) { _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. - _vm->_animation->_sprites[1].walkTo(4); // Walks up to greet you. + spr1->walkTo(4); // Walks up to greet you. } else { _vm->_animation->appearPed(2, 4); // Starts where she was before. - _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; + spr1->_facingDir = Animation::kDirLeft; } - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. + } break; case r__insidecardiffcastle: @@ -810,7 +820,8 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__nottspub: - if (_vm->_gyro->_sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); + if (_vm->_gyro->_sittingInPub) + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. break; @@ -833,9 +844,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_gyro->_seeScroll = false; // Now it can work again! - - if (_vm->_gyro->isLoaded) - _vm->_gyro->isLoaded = false; + _vm->_gyro->isLoaded = false; } void Lucerna::thinkAbout(byte object, bool type) { @@ -1021,16 +1030,17 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { byte what; // _vm->_animation->tr[0] is Avalot.) - if (cursorPos.x < _vm->_animation->_sprites[0]._x) + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (cursorPos.x < avvy->_x) what = 1; - else if (cursorPos.x > (_vm->_animation->_sprites[0]._x + _vm->_animation->_sprites[0]._info._xLength)) + else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) what = 2; else what = 0; // On top - if (cursorPos.y < _vm->_animation->_sprites[0]._y) + if (cursorPos.y < avvy->_y) what += 3; - else if (cursorPos.y > (_vm->_animation->_sprites[0]._y + _vm->_animation->_sprites[0]._info._yLength)) + else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) what += 6; switch (what) { @@ -1178,13 +1188,14 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). void Lucerna::gameOver() { _vm->_gyro->_userMovesAvvy = false; - int16 sx = _vm->_animation->_sprites[0]._x; - int16 sy = _vm->_animation->_sprites[0]._y; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + int16 sx = avvy->_x; + int16 sy = avvy->_y; - _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[0].init(12, true, _vm->_animation); // 12 = Avalot falls - _vm->_animation->_sprites[0]._stepNum = 0; - _vm->_animation->_sprites[0].appear(sx, sy, 0); + avvy->remove(); + avvy->init(12, true, _vm->_animation); // 12 = Avalot falls + avvy->_stepNum = 0; + avvy->appear(sx, sy, 0); _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); _vm->_gyro->_alive = false; @@ -1207,18 +1218,17 @@ void Lucerna::majorRedraw() { } uint16 Lucerna::bearing(byte whichPed) { - byte pedId = whichPed - 1; // Different array indexes in Pascal and C. + static const double rad2deg = 180 / 3.14; // Pi - const double rad2deg = 180 / 3.14; // Pi + byte pedId = whichPed - 1; // Different array indexes in Pascal and C. + AnimationType *avvy = &_vm->_animation->_sprites[0]; - if (_vm->_animation->_sprites[0]._x == _vm->_gyro->_peds[pedId]._x) + if (avvy->_x == _vm->_gyro->_peds[pedId]._x) return 0; - else if (_vm->_animation->_sprites[0]._x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (avvy->_x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 3bcb2e0cccfe..f6c5dab8f219 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -668,11 +668,12 @@ void Scrolls::callScrollDriver() { if (_param == 0) setBubbleStateNatural(); else if ((1 <= _param) && (_param <= 9)) { - if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->_sprites[_param - 1]._quick)) { // Not valid. + AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; + if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. _vm->_lucerna->errorLed(); setBubbleStateNatural(); } else - _vm->_animation->_sprites[_param - 1].chatter(); // Normal sprite talking routine. + spr->chatter(); // Normal sprite talking routine. } else if ((10 <= _param) && (_param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 019f2da84f2f..2df7ce217a93 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -308,10 +308,12 @@ void Timer::getTiedUp() { _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); - _vm->_animation->_sprites[1].stopWalk(); - _vm->_animation->_sprites[1].stopHoming(); - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGrabAvvy; + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->stopWalk(); + spr->stopHoming(); + spr->_callEachStepFl = true; + spr->_eachStepProc = Animation::kProcGrabAvvy; addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } @@ -324,22 +326,25 @@ void Timer::getTiedUp2() { void Timer::hangAround() { _vm->_animation->_sprites[1]._doCheck = false; - _vm->_animation->_sprites[0].init(7, true, _vm->_animation); // Robin Hood + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); _vm->_visa->displayScrollChain('q', 39); - _vm->_animation->_sprites[0].walkTo(7); + avvy->walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { _vm->_visa->displayScrollChain('q', 40); - _vm->_animation->_sprites[1]._vanishIfStill = false; - _vm->_animation->_sprites[1].walkTo(4); + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = false; + spr->walkTo(4); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[1].remove(); // Get rid of Robin Hood and Friar Tuck. + spr->remove(); // Get rid of Robin Hood and Friar Tuck. addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). @@ -424,9 +429,10 @@ void Timer::jacquesWakesUp() { } void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. - _vm->_animation->_sprites[1].init(9, false, _vm->_animation); // Here comes the Duke. + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->appearPed(2, 1); // He starts at the door... - _vm->_animation->_sprites[1].walkTo(3); // He walks over to you. + spr->walkTo(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -437,9 +443,10 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon } void Timer::naughtyDuke2() { + AnimationType *spr = &_vm->_animation->_sprites[1]; _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" - _vm->_animation->_sprites[1].walkTo(1); // Walk to the door. - _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! + spr->walkTo(1); // Walk to the door. + spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } @@ -450,8 +457,9 @@ void Timer::naughtyDuke3() { } void Timer::jump() { - _vm->_gyro->_jumpStatus++; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + _vm->_gyro->_jumpStatus++; switch (_vm->_gyro->_jumpStatus) { case 1: case 2: @@ -459,7 +467,7 @@ void Timer::jump() { case 5: case 7: case 9: - _vm->_animation->_sprites[0]._y--; + avvy->_y--; break; case 12: case 13: @@ -467,7 +475,7 @@ void Timer::jump() { case 16: case 18: case 19: - _vm->_animation->_sprites[0]._y++; + avvy->_y++; break; } @@ -539,8 +547,10 @@ void Timer::greetsMonk() { void Timer::fallDownOubliette() { _vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; - _vm->_animation->_sprites[0]._moveY++; // Increments dx/dy! - _vm->_animation->_sprites[0]._y += _vm->_animation->_sprites[0]._moveY; // Dowwwn we go... + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_moveY++; // Increments dx/dy! + avvy->_y += avvy->_moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); } @@ -554,48 +564,59 @@ void Timer::meetAvaroid() { _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); - _vm->_animation->_sprites[0]._facingDir = Animation::kDirLeft; - _vm->_animation->_sprites[0]._x = 151; - _vm->_animation->_sprites[0]._moveX = -3; - _vm->_animation->_sprites[0]._moveY = -5; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_facingDir = Animation::kDirLeft; + avvy->_x = 151; + avvy->_moveX = -3; + avvy->_moveY = -5; _vm->_gyro->setBackgroundColor(2); } } void Timer::riseUpOubliette() { - _vm->_animation->_sprites[0]._visible = true; - _vm->_animation->_sprites[0]._moveY++; // Decrements dx/dy! - _vm->_animation->_sprites[0]._y -= _vm->_animation->_sprites[0]._moveY; // Uuuupppp we go... - if (_vm->_animation->_sprites[0]._moveY > 0) + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_visible = true; + avvy->_moveY++; // Decrements dx/dy! + avvy->_y -= avvy->_moveY; // Uuuupppp we go... + if (avvy->_moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else _vm->_gyro->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { - _vm->_animation->_sprites[0].init(7, true, _vm->_animation); + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(7, true, _vm->_animation); _vm->_animation->appearPed(1, 7); - _vm->_animation->_sprites[0].walkTo(6); - _vm->_animation->_sprites[1].stopWalk(); - _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; + avvy->walkTo(6); + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->stopWalk(); + spr->_facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); _vm->_gyro->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { _vm->_visa->displayScrollChain('q', 66); - _vm->_animation->_sprites[0].walkTo(2); - _vm->_animation->_sprites[1].walkTo(2); - _vm->_animation->_sprites[0]._vanishIfStill = true; - _vm->_animation->_sprites[1]._vanishIfStill = true; + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *spr = &_vm->_animation->_sprites[1]; + avvy->walkTo(2); + spr->walkTo(2); + avvy->_vanishIfStill = true; + spr->_vanishIfStill = true; + addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); } void Timer::avalotReturns() { - _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[1].remove(); - _vm->_animation->_sprites[0].init(0, true, _vm->_animation); + AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *spr = &_vm->_animation->_sprites[1]; + avvy->remove(); + spr->remove(); + avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); _vm->_visa->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; @@ -607,18 +628,20 @@ void Timer::avalotReturns() { * @remarks Originally called 'avvy_sit_down' */ void Timer::avvySitDown() { - if (_vm->_animation->_sprites[0]._homing) // Still walking. + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_sittingInPub = true; _vm->_gyro->_userMovesAvvy = false; - _vm->_animation->_sprites[0]._visible = false; + avvy->_visible = false; } } void Timer::ghostRoomPhew() { - Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); + Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", + Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); _vm->_scrolls->displayText(tmpStr); } @@ -648,8 +671,9 @@ void Timer::winning() { } void Timer::avalotFalls() { - if (_vm->_animation->_sprites[0]._stepNum < 5) { - _vm->_animation->_sprites[0]._stepNum++; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (avvy->_stepNum < 5) { + avvy->_stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", From d7c2f495957ddd8181fe464b10de06646225c6f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 00:35:40 +0200 Subject: [PATCH 0953/1332] AVALANCHE: reduce the verbosity of a forgotten animation sprite --- engines/avalanche/visa2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index a7125d4f8491..cbf0e050698c 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -270,8 +270,9 @@ void Visa::talkTo(byte whom) { _vm->_gyro->_talkedToCrapulus = true; _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. - _vm->_animation->_sprites[1]._vanishIfStill = true; - _vm->_animation->_sprites[1].walkTo(3); // Walks away. + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = true; + spr->walkTo(3); // Walks away. _vm->_lucerna->incScore(2); } From fb86c6db0dc58dedaed5ebc6391940229faf9b5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 00:36:23 +0200 Subject: [PATCH 0954/1332] AVALANCHE: Janitorial: remove extra space after ! in boolean operations --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/lucerna2.cpp | 12 ++++++------ engines/avalanche/scrolls2.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a4ead4a50843..796ab800f5d8 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -175,7 +175,7 @@ void Avalot::setup() { _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). _vm->_gyro->newGame(); // No game was requested- load the default. - _vm->_gyro->_soundFx = ! _vm->_gyro->_soundFx; + _vm->_gyro->_soundFx = !_vm->_gyro->_soundFx; _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 88512390e95f..a4b1094789a3 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -387,9 +387,9 @@ void Lucerna::enterNewTown() { _vm->_gyro->_mushroomGrowing = true; break; case r__wisewomans: { // Entry into Argent. - if (_vm->_gyro->_talkedToCrapulus && (! _vm->_gyro->_lustieIsAsleep)) { + if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[r__wisewomans] % 3) == 1); - _vm->_gyro->_crapulusWillTell = ! _vm->_gyro->_spludwickAtHome; + _vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; } else { _vm->_gyro->_spludwickAtHome = true; _vm->_gyro->_crapulusWillTell = false; @@ -429,7 +429,7 @@ void Lucerna::enterRoom(byte room, byte ped) { loadRoom(room); - if ((_vm->_gyro->_roomCount[room] == 0) && (! _vm->_gyro->setFlag('S'))) + if ((_vm->_gyro->_roomCount[room] == 0) && (!_vm->_gyro->setFlag('S'))) incScore(1); _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; @@ -456,7 +456,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__outsideyours: if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; - if (! _vm->_gyro->_talkedToCrapulus) { + if (!_vm->_gyro->_talkedToCrapulus) { _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__outsideyours; spr1->init(8, false, _vm->_animation); // load Crapulus @@ -559,7 +559,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__robins: if (ped > 0) { - if (! _vm->_gyro->_beenTiedUp) { + if (!_vm->_gyro->_beenTiedUp) { // A welcome party... or maybe not... AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(6, false, _vm->_animation); @@ -670,7 +670,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); - else if (! _vm->_gyro->_enteredLustiesRoomAsMonk) // already + else if (!_vm->_gyro->_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f6c5dab8f219..333b21525ca0 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -170,7 +170,7 @@ void Scrolls::scrollModeNormal() { easteregg(); } oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); - if (! oktoexit) errorled(); + if (!oktoexit) errorled(); } } while (!((oktoexit) || (mrelease > 0))); From a506b0b3e4490f69d58b1d3646de6065d98822d4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 01:10:10 +0200 Subject: [PATCH 0955/1332] AVALANCHE: Reduce some more verbosity --- engines/avalanche/acci2.cpp | 19 ++++++++----------- engines/avalanche/animation.cpp | 11 ++++++----- engines/avalanche/lucerna2.cpp | 10 ++++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ad1e3725ee59..bbbc04af61bd 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1099,29 +1099,26 @@ void Acci::openDoor() { if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != r__lusties)) return; // No doors can open if you can't move Avvy. - for (byte fv = 8; fv < 15; fv++) { - if (_vm->_animation->inField(fv + 1)) { - fv -= 8; - - switch (_vm->_gyro->_portals[fv]._operation) { + for (byte i = 0; i < 7; i++) { + if (_vm->_animation->inField(i + 9)) { + MagicType *portal = &_vm->_gyro->_portals[i]; + switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data); + _vm->_visa->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: - _vm->_animation->flipRoom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte - (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte - ); + _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); break; case Gyro::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_scrolls->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_animation->callSpecial(_vm->_gyro->_portals[fv]._data); + _vm->_animation->callSpecial(portal->_data); break; case Gyro::kMagicOpenDoor: - _vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); + _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); break; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5ce809c76d28..56f2ddf54c28 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -210,17 +210,18 @@ void AnimationType::walk() { // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { - switch (_anim->_vm->_gyro->_magics[tc]._operation) { + MagicType *magic = &_anim->_vm->_gyro->_magics[tc]; + switch (magic->_operation) { case Gyro::kMagicExclaim: bounce(); _anim->_mustExclaim = true; - _anim->_sayWhat = _anim->_vm->_gyro->_magics[tc]._data; + _anim->_sayWhat = magic->_data; break; case Gyro::kMagicBounce: bounce(); break; case Gyro::kMagicTransport: - _anim->flipRoom(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff); + _anim->flipRoom(magic->_data >> 8, magic->_data & 0xff); break; case Gyro::kMagicUnfinished: { bounce(); @@ -229,10 +230,10 @@ void AnimationType::walk() { } break; case Gyro::kMagicSpecial: - _anim->callSpecial(_anim->_vm->_gyro->_magics[tc]._data); + _anim->callSpecial(magic->_data); break; case Gyro::kMagicOpenDoor: - _anim->openDoor(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff, tc); + _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, tc); break; } } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a4b1094789a3..3b32d1f5a3b4 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -262,13 +262,15 @@ void Lucerna::loadAlso(byte num) { } for (byte i = 0; i < 15; i++) { - _vm->_gyro->_magics[i]._operation = file.readByte(); - _vm->_gyro->_magics[i]._data = file.readUint16LE(); + MagicType *magic = &_vm->_gyro->_magics[i]; + magic->_operation = file.readByte(); + magic->_data = file.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro->_portals[i]._operation = file.readByte(); - _vm->_gyro->_portals[i]._data = file.readUint16LE(); + MagicType *portal = &_vm->_gyro->_portals[i]; + portal->_operation = file.readByte(); + portal->_data = file.readUint16LE(); } _vm->_gyro->_flags.clear(); From 010d9f854e46ffbcb9b138e3dacffe9df25a116c Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 02:36:55 +0200 Subject: [PATCH 0956/1332] AVALANCHE: Remove comment from AvalancheEngine::expandDate. It works as intended, no need to repair. --- engines/avalanche/avalanche.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 66b7462d63b3..6312546ef48b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -490,7 +490,6 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day += "th"; } - // Y2K compliant ;) return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); } From f7ee139501403e4f55d1a6fcbe5c421d3317cfa1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 10:50:43 +0200 Subject: [PATCH 0957/1332] AVALANCHE: Reduce verbosity some more --- engines/avalanche/animation.cpp | 50 ++++++++++++++++----------------- engines/avalanche/animation.h | 2 +- engines/avalanche/avalot.cpp | 11 +++++--- engines/avalanche/lucerna2.cpp | 50 ++++++++++++++++----------------- engines/avalanche/scrolls2.cpp | 5 ++-- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 56f2ddf54c28..c6fbe957b448 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -170,11 +170,9 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { */ bool AnimationType::checkCollision() { for (byte i = 0; i < _anim->kSpriteNumbMax; i++) { - if (_anim->_sprites[i]._quick && (_anim->_sprites[i]._id != _id) && - ((_x + _info._xLength) > _anim->_sprites[i]._x) && - (_x < (_anim->_sprites[i]._x + _anim->_sprites[i]._info._xLength)) && - (_anim->_sprites[i]._y == _y)) - return true; + AnimationType *spr = &_anim->_sprites[i]; + if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) + return true; } return false; @@ -271,11 +269,12 @@ int8 AnimationType::getSign(int16 val) { return 0; } -void AnimationType::walkTo(byte pednum) { - pednum--; // Pascal -> C conversion: different array indexes. - setSpeed(getSign(_anim->_vm->_gyro->_peds[pednum]._x - _x) * 4, getSign(_anim->_vm->_gyro->_peds[pednum]._y - _y)); - _homingX = _anim->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; - _homingY = _anim->_vm->_gyro->_peds[pednum]._y - _info._yLength; +void AnimationType::walkTo(byte pedNum) { + PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum - 1]; // Pascal -> C conversion: different array indexes. + + setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); + _homingX = curPed->_x - _info._xLength / 2; + _homingY = curPed->_y - _info._yLength; _homing = true; } @@ -1006,11 +1005,11 @@ void Animation::changeDirection(byte t, byte dir) { } } -void Animation::appearPed(byte trn, byte np) { - trn--; - np--; - _sprites[trn].appear(_vm->_gyro->_peds[np]._x - _sprites[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - _sprites[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); - changeDirection(trn, _vm->_gyro->_peds[np]._direction); +void Animation::appearPed(byte sprNum, byte pedNum) { + AnimationType *curSpr = &_sprites[sprNum - 1]; + PedType *curPed = &_vm->_gyro->_peds[pedNum - 1]; + curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); + changeDirection(sprNum - 1, curPed->_direction); } // Eachstep procedures: @@ -1360,13 +1359,10 @@ void Animation::flipRoom(byte room, byte ped) { } bool Animation::inField(byte which) { - which--; // Pascal -> C: different array indexes. - + FieldType *curField = &_vm->_gyro->_fields[which - 1]; // Pascal -> C: different array indexes. int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; - return (_sprites[0]._x >= _vm->_gyro->_fields[which]._x1) && (_sprites[0]._x <= _vm->_gyro->_fields[which]._x2) - && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); - + return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } bool Animation::nearDoor() { @@ -1377,12 +1373,14 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - bool nd = false; - for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) - if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) - && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) - nd = true; - return nd; + + for (byte i = 8; i < _vm->_gyro->_fieldNum; i++) { + FieldType *curField = &_vm->_gyro->_fields[i]; + if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) + return true; + } + + return false; } void Animation::handleMoveKey(const Common::Event &event) { diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 185f2f8e98d6..2765a7cd0b2d 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -126,7 +126,7 @@ class Animation { void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. void stopWalking(); void changeDirection(byte t, byte dir); - void appearPed(byte trn, byte np); + void appearPed(byte sprNum, byte pedNum); void flipRoom(byte room, byte ped); bool inField(byte which); // Returns true if you're within field "which". bool nearDoor(); // Returns True if you're near a door. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 796ab800f5d8..fe5d4d040d48 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,12 +201,15 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i].col); + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + LineType *curLine = &_vm->_gyro->_lines[i]; + _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); + } for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { - if (_vm->_gyro->_fields[i]._x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->_fields[i]._x1, _vm->_gyro->_fields[i]._y1, _vm->_gyro->_fields[i]._x2, _vm->_gyro->_fields[i]._y2), kColorLightmagenta); + FieldType *curField = &_vm->_gyro->_fields[i]; + if (curField->_x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } // ONLY FOR TESTING!!! #endif diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3b32d1f5a3b4..dc635aae66f0 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -238,27 +238,30 @@ void Lucerna::loadAlso(byte num) { _vm->_gyro->_lineNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { - _vm->_gyro->_lines[i]._x1 = file.readSint16LE(); - _vm->_gyro->_lines[i]._y1 = file.readSint16LE(); - _vm->_gyro->_lines[i]._x2 = file.readSint16LE(); - _vm->_gyro->_lines[i]._y2 = file.readSint16LE(); - _vm->_gyro->_lines[i]._color = file.readByte(); + LineType *curLine = &_vm->_gyro->_lines[i]; + curLine->_x1 = file.readSint16LE(); + curLine->_y1 = file.readSint16LE(); + curLine->_x2 = file.readSint16LE(); + curLine->_y2 = file.readSint16LE(); + curLine->_color = file.readByte(); } memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); byte pedNum = file.readByte(); for (byte i = 0; i < pedNum; i++) { - _vm->_gyro->_peds[i]._x = file.readSint16LE(); - _vm->_gyro->_peds[i]._y = file.readSint16LE(); - _vm->_gyro->_peds[i]._direction = file.readByte(); + PedType *curPed = &_vm->_gyro->_peds[i]; + curPed->_x = file.readSint16LE(); + curPed->_y = file.readSint16LE(); + curPed->_direction = file.readByte(); } _vm->_gyro->_fieldNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { - _vm->_gyro->_fields[i]._x1 = file.readSint16LE(); - _vm->_gyro->_fields[i]._y1 = file.readSint16LE(); - _vm->_gyro->_fields[i]._x2 = file.readSint16LE(); - _vm->_gyro->_fields[i]._y2 = file.readSint16LE(); + FieldType *curField = &_vm->_gyro->_fields[i]; + curField->_x1 = file.readSint16LE(); + curField->_y1 = file.readSint16LE(); + curField->_x2 = file.readSint16LE(); + curField->_y2 = file.readSint16LE(); } for (byte i = 0; i < 15; i++) { @@ -323,8 +326,6 @@ void Lucerna::loadRoom(byte num) { CursorMan.showMouse(true); } - - void Lucerna::zoomOut(int16 x, int16 y) { warning("STUB: Lucerna::zoomout()"); } @@ -619,12 +620,10 @@ void Lucerna::enterRoom(byte room, byte ped) { zoomOut(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); //setactivepage(1 - cp); - { - if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - refreshObjectList(); - } + if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { + _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; + refreshObjectList(); } _vm->_visa->displayScrollChain('q', 69); @@ -1221,16 +1220,15 @@ void Lucerna::majorRedraw() { uint16 Lucerna::bearing(byte whichPed) { static const double rad2deg = 180 / 3.14; // Pi - - byte pedId = whichPed - 1; // Different array indexes in Pascal and C. AnimationType *avvy = &_vm->_animation->_sprites[0]; + PedType *curPed = &_vm->_gyro->_peds[whichPed - 1]; // Different array indexes in Pascal and C. - if (avvy->_x == _vm->_gyro->_peds[pedId]._x) + if (avvy->_x == curPed->_x) return 0; - else if (avvy->_x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (avvy->_x < curPed->_x) { + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 333b21525ca0..f96d56edc1cd 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -678,8 +678,9 @@ void Scrolls::callScrollDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._x; - _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._y; // Position. + PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]; + _vm->_gyro->_talkX = quasiPed->_x; + _vm->_gyro->_talkY = quasiPed->_y; // Position. _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. From ba05f95bb472af8530f70e62afd07a84ee273140 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 12:25:07 +0200 Subject: [PATCH 0958/1332] AVALANCHE: Get rid of Visa. Move everything from it to Scrolls. --- engines/avalanche/acci2.cpp | 173 ++++++++++---------- engines/avalanche/animation.cpp | 17 +- engines/avalanche/avalanche.cpp | 2 - engines/avalanche/avalanche.h | 2 - engines/avalanche/avalot.cpp | 3 +- engines/avalanche/gyro2.cpp | 3 +- engines/avalanche/lucerna2.cpp | 5 +- engines/avalanche/module.mk | 1 - engines/avalanche/scrolls2.cpp | 239 ++++++++++++++++++++++++++- engines/avalanche/scrolls2.h | 10 ++ engines/avalanche/timer.cpp | 57 ++++--- engines/avalanche/visa2.cpp | 281 -------------------------------- engines/avalanche/visa2.h | 56 ------- 13 files changed, 373 insertions(+), 476 deletions(-) delete mode 100644 engines/avalanche/visa2.cpp delete mode 100644 engines/avalanche/visa2.h diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index bbbc04af61bd..1008a6015756 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -33,7 +33,6 @@ #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" @@ -576,7 +575,7 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->_spareEvening.empty()) _vm->_gyro->_spareEvening.clear(); _vm->_gyro->_spareEvening = _vm->_parser->_inputText; - _vm->_visa->displayScrollChain('z', 5); // His closing statement... + _vm->_scrolls->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; @@ -798,24 +797,24 @@ void Acci::examineObject() { case Gyro::kObjectWine : switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: - _vm->_visa->displayScrollChain('t', 1); // Normal examine wine scroll + _vm->_scrolls->displayScrollChain('t', 1); // Normal examine wine scroll break; case 2: - _vm->_visa->displayScrollChain('d', 6); // Bad wine + _vm->_scrolls->displayScrollChain('d', 6); // Bad wine break; case 3: - _vm->_visa->displayScrollChain('d', 7); // Vinegar + _vm->_scrolls->displayScrollChain('d', 7); // Vinegar break; } break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('q', 21); // Yucky onion. + _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion. else - _vm->_visa->displayScrollChain('t', 18); // Normal onion scroll + _vm->_scrolls->displayScrollChain('t', 18); // Normal onion scroll break; default: - _vm->_visa->displayScrollChain('t', _thing); // <<< Ordinarily + _vm->_scrolls->displayScrollChain('t', _thing); // <<< Ordinarily } } @@ -841,24 +840,24 @@ void Acci::exampers() { switch (_person) { // Special cases case 11: if (_vm->_gyro->_wonNim) { - _vm->_visa->displayScrollChain('Q', 8); // "I'm Not Playing!" + _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" return; } break; case 99: if (_vm->_gyro->_lustieIsAsleep) { - _vm->_visa->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) + _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) return; } break; } // Otherwise... - _vm->_visa->displayScrollChain('p', _person); + _vm->_scrolls->displayScrollChain('p', _person); } // And afterwards... if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) - _vm->_visa->displayScrollChain('Q', 13); + _vm->_scrolls->displayScrollChain('Q', 13); } /** @@ -953,43 +952,43 @@ void Acci::swallow() { // Eat something. switch (_vm->_gyro->_wineState) { // 4 is perfect case 1: if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('D', 6); + _vm->_scrolls->displayScrollChain('D', 6); return; } - _vm->_visa->displayScrollChain('U', 1); + _vm->_scrolls->displayScrollChain('U', 1); _vm->_pingo->wobble(); - _vm->_visa->displayScrollChain('U', 2); + _vm->_scrolls->displayScrollChain('U', 2); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; case 2: case 3: - _vm->_visa->displayScrollChain('d', 8); + _vm->_scrolls->displayScrollChain('d', 8); break; // You can't drink it! } break; case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); - _vm->_visa->displayScrollChain('U', 3); + _vm->_scrolls->displayScrollChain('U', 3); _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: - _vm->_visa->displayScrollChain('U', 4); + _vm->_scrolls->displayScrollChain('U', 4); break; case Gyro::kObjectChastity: - _vm->_visa->displayScrollChain('U', 5); + _vm->_scrolls->displayScrollChain('U', 5); break; case Gyro::kObjectMushroom: - _vm->_visa->displayScrollChain('U', 6); + _vm->_scrolls->displayScrollChain('U', 6); _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('U', 11); + _vm->_scrolls->displayScrollChain('U', 11); else { - _vm->_visa->displayScrollChain('U', 8); + _vm->_scrolls->displayScrollChain('U', 8); _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } @@ -1040,34 +1039,34 @@ void Acci::lookAround() { switch (_vm->_gyro->_room) { case r__spludwicks: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_visa->displayScrollChain('q', 23); + _vm->_scrolls->displayScrollChain('q', 23); else peopleInRoom(); break; case r__robins: if (_vm->_gyro->_tiedUp) - _vm->_visa->displayScrollChain('q', 38); + _vm->_scrolls->displayScrollChain('q', 38); if (_vm->_gyro->_mushroomGrowing) - _vm->_visa->displayScrollChain('q', 55); + _vm->_scrolls->displayScrollChain('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->_takenPen) - _vm->_visa->displayScrollChain('q', 49); + _vm->_scrolls->displayScrollChain('q', 49); break; case r__lustiesroom: if (_vm->_gyro->_lustieIsAsleep) - _vm->_visa->displayScrollChain('q', 65); + _vm->_scrolls->displayScrollChain('q', 65); break; case r__catacombs: switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : - _vm->_visa->displayScrollChain('q', 80); // Inside art gallery. + _vm->_scrolls->displayScrollChain('q', 80); // Inside art gallery. break; case 514 : - _vm->_visa->displayScrollChain('q', 81); // Outside ditto. + _vm->_scrolls->displayScrollChain('q', 81); // Outside ditto. break; case 260 : - _vm->_visa->displayScrollChain('q', 82); // Outside Geida's room. + _vm->_scrolls->displayScrollChain('q', 82); // Outside Geida's room. break; } break; @@ -1090,7 +1089,7 @@ void Acci::openDoor() { break; case r__spludwicks: if (_thing == 61) { - _vm->_visa->displayScrollChain('q', 85); + _vm->_scrolls->displayScrollChain('q', 85); return; } break; @@ -1105,7 +1104,7 @@ void Acci::openDoor() { switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_visa->displayScrollChain('x', portal->_data); + _vm->_scrolls->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); @@ -1163,7 +1162,7 @@ void Acci::putProc() { } else { // Put onion into vinegar! Yes! _vm->_gyro->_onionInVinegar = true; _vm->_lucerna->incScore(7); - _vm->_visa->displayScrollChain('u', 9); + _vm->_scrolls->displayScrollChain('u', 9); } } } else @@ -1248,10 +1247,10 @@ bool Acci::giveToSpludwick() { case Gyro::kObjectOnion: _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; if (_vm->_gyro->_rottenOnion) - _vm->_visa->displayScrollChain('q', 22); + _vm->_scrolls->displayScrollChain('q', 22); else { _vm->_gyro->_givenToSpludwick++; - _vm->_visa->displayScrollChain('q', 20); + _vm->_scrolls->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); } @@ -1261,13 +1260,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_givenToSpludwick++; - _vm->_visa->displayScrollChain('q', 24); + _vm->_scrolls->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; - _vm->_visa->displayScrollChain('q', 25); + _vm->_scrolls->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_givenToSpludwick++; goToCauldron(); @@ -1321,9 +1320,9 @@ void Acci::standUp() { case r__yours: // Avvy isn't asleep. if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('d', 12); + _vm->_scrolls->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); - _vm->_visa->displayScrollChain('d', 14); + _vm->_scrolls->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; @@ -1372,7 +1371,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText(tmpStr); } } else - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); break; case r__insidecardiffcastle: switch (thing) { @@ -1390,15 +1389,15 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText("Taken."); } } else if (_vm->_gyro->_standingOnDais) - _vm->_visa->displayScrollChain('q', 53); + _vm->_scrolls->displayScrollChain('q', 53); else - _vm->_visa->displayScrollChain('q', 51); + _vm->_scrolls->displayScrollChain('q', 51); break; case Gyro::kObjectBolt: - _vm->_visa->displayScrollChain('q', 52); + _vm->_scrolls->displayScrollChain('q', 52); break; default: - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); } break; case r__robins: @@ -1411,10 +1410,10 @@ void Acci::getProc(char thing) { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); break; default: - _vm->_visa->displayScrollChain('q', 57); + _vm->_scrolls->displayScrollChain('q', 57); } } @@ -1430,7 +1429,7 @@ void Acci::giveGeidaTheLute() { } _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_visa->displayScrollChain('q', 64); // She plays it. + _vm->_scrolls->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); _vm->_enid->backToBootstrap(4); @@ -1444,7 +1443,7 @@ void Acci::playHarp() { } void Acci::winSequence() { - _vm->_visa->displayScrollChain('q', 78); + _vm->_scrolls->displayScrollChain('q', 78); _vm->_sequence->firstShow(7); _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); @@ -1576,10 +1575,10 @@ void Acci::doThat() { if ((_person == 0) || (_person == kPardon)) _vm->_scrolls->displayText("Talk to whom?"); else if (isPersonHere()) - _vm->_visa->talkTo(_person); + _vm->_scrolls->talkTo(_person); } } else if (isPersonHere()) - _vm->_visa->talkTo(_person); + _vm->_scrolls->talkTo(_person); break; case kVerbCodeGive: if (isHolding()) { @@ -1617,7 +1616,7 @@ void Acci::doThat() { break; case Gyro::kPeopleIbythneth: if (_thing == Gyro::kObjectBadge) { - _vm->_visa->displayScrollChain('q', 32); // Thanks! Wow! + _vm->_scrolls->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; @@ -1631,7 +1630,7 @@ void Acci::doThat() { if (_vm->_gyro->_aylesIsAwake) { if (_thing == Gyro::kObjectPen) { _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; - _vm->_visa->displayScrollChain('q', 54); + _vm->_scrolls->displayScrollChain('q', 54); _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; _vm->_gyro->_givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); @@ -1645,7 +1644,7 @@ void Acci::doThat() { switch (_thing) { case Gyro::kObjectPotion: _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; - _vm->_visa->displayScrollChain('u', 16); // She drinks it. + _vm->_scrolls->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); @@ -1663,7 +1662,7 @@ void Acci::doThat() { if (_vm->_gyro->_givenPotionToGeida) winSequence(); else - _vm->_visa->displayScrollChain('q', 77); // That Geida woman! + _vm->_scrolls->displayScrollChain('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1788,20 +1787,20 @@ void Acci::doThat() { // The player automatically wins the game everytime he wins, until I implement the mini-game. if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_visa->displayScrollChain('Q', 6); + _vm->_scrolls->displayScrollChain('Q', 6); return; } if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_visa->displayScrollChain('q', 84); + _vm->_scrolls->displayScrollChain('q', 84); return; } - _vm->_visa->displayScrollChain('Q', 3); + _vm->_scrolls->displayScrollChain('Q', 3); _vm->_gyro->_playedNim++; // You won - strange! - _vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; @@ -1823,13 +1822,13 @@ void Acci::doThat() { } else if (isHolding()) { switch (_thing) { case Gyro::kObjectLute : - _vm->_visa->displayScrollChain('U', 7); + _vm->_scrolls->displayScrollChain('U', 7); if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) - _vm->_visa->displayScrollChain('U', 10); + _vm->_scrolls->displayScrollChain('U', 10); if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) - _vm->_visa->displayScrollChain('U', 15); + _vm->_scrolls->displayScrollChain('U', 15); break; case 52: if (_vm->_gyro->_room == r__musicroom) @@ -1891,12 +1890,12 @@ void Acci::doThat() { break; case kVerbCodeMagic: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_visa->displayScrollChain('q', 19); + _vm->_scrolls->displayScrollChain('q', 19); else { if ((_vm->_gyro->_room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! - _vm->_visa->displayScrollChain('q', 17); + _vm->_scrolls->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == 12) - _vm->_visa->displayScrollChain('q', 18); + _vm->_scrolls->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius @@ -1956,12 +1955,12 @@ void Acci::doThat() { case 54: case 58: // Beer, whisky, cider or mead. if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_visa->displayScrollChain('D', 15); + _vm->_scrolls->displayScrollChain('D', 15); return; } if (_vm->_gyro->_teetotal) { - _vm->_visa->displayScrollChain('D', 6); + _vm->_scrolls->displayScrollChain('D', 6); return; } @@ -1981,10 +1980,10 @@ void Acci::doThat() { break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! - _vm->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent! + _vm->_scrolls->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_visa->displayScrollChain('D', 15); + _vm->_scrolls->displayScrollChain('D', 15); return; } @@ -2006,21 +2005,21 @@ void Acci::doThat() { break; } } else - _vm->_visa->displayScrollChain('D', 5); // Go to the bar! + _vm->_scrolls->displayScrollChain('D', 5); // Go to the bar! break; case r__outsideducks: if (_vm->_animation->inField(6)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) - _vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things! + _vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->_boughtOnion) - _vm->_visa->displayScrollChain('D', 11); + _vm->_scrolls->displayScrollChain('D', 11); else { - _vm->_visa->displayScrollChain('D', 9); + _vm->_scrolls->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. @@ -2031,16 +2030,16 @@ void Acci::doThat() { _vm->_gyro->_onionInVinegar = false; } } else - _vm->_visa->displayScrollChain('D', 0); + _vm->_scrolls->displayScrollChain('D', 0); } else - _vm->_visa->displayScrollChain('D', 0); + _vm->_scrolls->displayScrollChain('D', 0); break; case r__nottspub: - _vm->_visa->displayScrollChain('n', 15); // Can't sell to southerners. + _vm->_scrolls->displayScrollChain('n', 15); // Can't sell to southerners. break; default: - _vm->_visa->displayScrollChain('D', 0); // Can't buy that. + _vm->_scrolls->displayScrollChain('D', 0); // Can't buy that. } break; case kVerbCodeAttack: @@ -2050,7 +2049,7 @@ void Acci::doThat() { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: - _vm->_visa->displayScrollChain('Q', 10); + _vm->_scrolls->displayScrollChain('Q', 10); _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); break; case 1: @@ -2060,7 +2059,7 @@ void Acci::doThat() { _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: - _vm->_visa->displayScrollChain('Q', 11); + _vm->_scrolls->displayScrollChain('Q', 11); _vm->_gyro->_cwytalotGone = true; _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; @@ -2073,14 +2072,14 @@ void Acci::doThat() { _vm->_gyro->_whereIs[7] = 177; break; default: - _vm->_visa->displayScrollChain('Q', 10); // Please try not to be so violent! + _vm->_scrolls->displayScrollChain('Q', 10); // Please try not to be so violent! } } else - _vm->_visa->displayScrollChain('Q', 10); + _vm->_scrolls->displayScrollChain('Q', 10); break; case kVerbCodePasswd: if (_vm->_gyro->_room != r__bridge) - _vm->_visa->displayScrollChain('Q', 12); + _vm->_scrolls->displayScrollChain('Q', 12); else { bool ok = true; for (byte i = 0; i < _thats.size(); i++) { @@ -2103,7 +2102,7 @@ void Acci::doThat() { _vm->_gyro->_drawbridgeOpen = 1; } } else - _vm->_visa->displayScrollChain('Q', 12); + _vm->_scrolls->displayScrollChain('Q', 12); } break; case kVerbCodeDir: @@ -2129,16 +2128,16 @@ void Acci::doThat() { else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: - _vm->_visa->displayScrollChain('U', 12); + _vm->_scrolls->displayScrollChain('U', 12); break; case Gyro::kPeopleGeida: - _vm->_visa->displayScrollChain('U', 13); + _vm->_scrolls->displayScrollChain('U', 13); break; case Gyro::kPeopleWisewoman: - _vm->_visa->displayScrollChain('U', 14); + _vm->_scrolls->displayScrollChain('U', 14); break; default: - _vm->_visa->displayScrollChain('U', 5); // You WHAT? + _vm->_scrolls->displayScrollChain('U', 5); // You WHAT? } } else if ((150 <= _person) && (_person <= 174)) _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); @@ -2170,7 +2169,7 @@ void Acci::doThat() { _vm->_gyro->_avvyInBed = true; _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) - _vm->_visa->displayScrollChain('d', 13); + _vm->_scrolls->displayScrollChain('d', 13); } else _vm->_scrolls->displayText("You're already awake, Avvy!"); break; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index c6fbe957b448..21063e09a7c4 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -32,7 +32,6 @@ #include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/visa2.h" #include "avalanche/gyro2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" @@ -759,7 +758,7 @@ void Animation::callSpecial(uint16 which) { _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! stopWalking(); - _vm->_visa->displayScrollChain('q', 26); + _vm->_scrolls->displayScrollChain('q', 26); _vm->_gyro->_userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. @@ -789,11 +788,11 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. - _vm->_visa->displayScrollChain('q', 35); + _vm->_scrolls->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_visa->displayScrollChain('q', 36); + _vm->_scrolls->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; _sprites[1].walkTo(3); @@ -822,7 +821,7 @@ void Animation::callSpecial(uint16 which) { break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_visa->displayScrollChain('q', 63); + _vm->_scrolls->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida @@ -842,9 +841,9 @@ void Animation::callSpecial(uint16 which) { if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { // Into Geida's room. if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) - _vm->_visa->displayScrollChain('q', 62); + _vm->_scrolls->displayScrollChain('q', 62); else { - _vm->_visa->displayScrollChain('q', 61); + _vm->_scrolls->displayScrollChain('q', 61); return; } } @@ -1065,7 +1064,7 @@ void Animation::arrowProcs(byte tripnum) { // OK, it's hit him... what now? _sprites[1]._callEachStepFl = false; // prevent recursion. - _vm->_visa->displayScrollChain('Q', 47); // Complaint! + _vm->_scrolls->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. #if 0 tr[1].done; { Deallocate normal pic of Avvy. } @@ -1273,7 +1272,7 @@ void Animation::animLink() { if (_mustExclaim) { _mustExclaim = false; - _vm->_visa->displayScrollChain('x', _sayWhat); + _vm->_scrolls->displayScrollChain('x', _sayWhat); } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 6312546ef48b..c768fc1346cb 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -64,7 +64,6 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _pingo; delete _scrolls; - delete _visa; delete _lucerna; delete _enid; delete _celer; @@ -85,7 +84,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _gyro = new Gyro(this); _pingo = new Pingo(this); _scrolls = new Scrolls(this); - _visa = new Visa(this); _lucerna = new Lucerna(this); _enid = new Enid(this); _celer = new Celer(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 69c157fdbbab..b93c117377b3 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -37,7 +37,6 @@ #include "avalanche/gyro2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" @@ -74,7 +73,6 @@ class AvalancheEngine : public Engine { Gyro *_gyro; Pingo *_pingo; Scrolls *_scrolls; - Visa *_visa; Lucerna *_lucerna; Enid *_enid; Celer *_celer; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index fe5d4d040d48..a5b3e06ff8e2 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -41,7 +41,6 @@ #include "avalanche/timer.h" #include "avalanche/celer2.h" #include "avalanche/enid2.h" -#include "avalanche/visa2.h" #include "avalanche/closing2.h" #include "common/str.h" @@ -179,7 +178,7 @@ void Avalot::setup() { _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); - _vm->_visa->displayScrollChain('q', 83); // Info on the game, etc. + _vm->_scrolls->displayScrollChain('q', 83); // Info on the game, etc. } } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 9be471c9fde8..8bfa53f616dd 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -33,7 +33,6 @@ #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/visa2.h" #include "avalanche/acci2.h" #include "avalanche/animation.h" @@ -385,7 +384,7 @@ void Gyro::forceNumlock() { bool Gyro::decreaseMoney(uint16 howmuchby) { _money -= howmuchby; if (_money < 0) { - _vm->_visa->displayScrollChain('Q', 2); // "You are now denariusless!" + _vm->_scrolls->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; } else diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index dc635aae66f0..961202b7ad0a 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/enid2.h" @@ -621,12 +620,12 @@ void Lucerna::enterRoom(byte room, byte ped) { //setactivepage(1 - cp); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_scrolls->displayScrollChain('q', 9); // Don't want to waste the wine! _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } - _vm->_visa->displayScrollChain('q', 69); + _vm->_scrolls->displayScrollChain('q', 69); break; case r__catacombs: diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 0f1722a48261..6881a3e21647 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -10,7 +10,6 @@ MODULE_OBJS = \ gyro2.o \ pingo2.o \ scrolls2.o \ - visa2.o \ lucerna2.o \ enid2.o \ celer2.o \ diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index f96d56edc1cd..56e9b2f1c475 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -34,7 +34,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/animation.h" #include "avalanche/acci2.h" -#include "avalanche/visa2.h" #include "avalanche/timer.h" #include "common/textconsole.h" @@ -44,6 +43,7 @@ namespace Avalanche { Scrolls::Scrolls(AvalancheEngine *vm) { _vm = vm; + _noError = true; } void Scrolls::init() { @@ -729,7 +729,7 @@ void Scrolls::callScrollDriver() { case 10: switch (_vm->_gyro->_boxContent) { case 0: // Sixpence. - _vm->_visa->displayScrollChain('q', 37); // You find the sixpence. + _vm->_scrolls->displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_money += 6; _vm->_gyro->_boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); @@ -826,4 +826,239 @@ void Scrolls::musicalScroll() { resetScroll(); } +// From Visa: + +void Scrolls::unSkrimble() { + for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) + _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; +} + +void Scrolls::doTheBubble() { + _vm->_gyro->_bufSize++; + _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; +} + +/** + * Display a string in a scroll + * @remarks Originally called 'dixi' + */ +void Scrolls::displayScrollChain(char block, byte point, bool report, bool bubbling) { + Common::File indexfile; + if (!indexfile.open("avalot.idx")) + error("AVALANCHE: Visa: File not found: avalot.idx"); + + bool error = false; + + indexfile.seek((toupper(block) - 65) * 2); + uint16 idx_offset = indexfile.readUint16LE(); + if (idx_offset == 0) + error = true; + + indexfile.seek(idx_offset + point * 2); + uint16 sez_offset = indexfile.readUint16LE(); + if (sez_offset == 0) + error = true; + + indexfile.close(); + + _noError = !error; + + if (error) { + if (report) { + Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Scrolls::kControlBell, block, point); + _vm->_scrolls->displayText(todisplay); + } + return; + } + + Common::File sezfile; + if (!sezfile.open("avalot.sez")) + ::error("AVALANCHE: Visa: File not found: avalot.sez"); + + sezfile.seek(sez_offset); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + sezfile.close(); + unSkrimble(); + + if (bubbling) + doTheBubble(); + + _vm->_scrolls->callScrollDriver(); +} + +/** + * Start speech + * @remarks Originally called 'speech' + */ +void Scrolls::speak(byte who, byte subject) { + if (subject == 0) { // No subject. + displayScrollChain('s', who, false, true); + return; + } + + // Subject given. + _noError = false; // Assume that until we know otherwise. + + Common::File indexfile; + if (!indexfile.open("converse.avd")) + error("AVALANCHE: Visa: File not found: converse.avd"); + + indexfile.seek(who * 2 - 2); + uint16 idx_offset = indexfile.readUint16LE(); + uint16 next_idx_offset = indexfile.readUint16LE(); + + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) + return; + + indexfile.seek(idx_offset + subject * 2); + uint16 sez_offset = indexfile.readUint16LE(); + if ((sez_offset == 0) || (indexfile.err())) + return; + indexfile.close(); + + Common::File sezfile; + if (!sezfile.open("avalot.sez")) + error("AVALANCHE: Visa: File not found: avalot.sez"); + + sezfile.seek(sez_offset); + _vm->_gyro->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + sezfile.close(); + + unSkrimble(); + doTheBubble(); + + _vm->_scrolls->callScrollDriver(); + _noError = true; +} + +void Scrolls::talkTo(byte whom) { + if (_vm->_acci->_person == _vm->_acci->kPardon) { + _vm->_acci->_person = _vm->_gyro->_subjectNum; + _vm->_gyro->_subjectNum = 0; + } + + if (_vm->_gyro->_subjectNum == 0) { + switch (whom) { + case Gyro::kPeopleSpludwick: + if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { + displayScrollChain('q', 68); + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(3); + return; + } else if (_vm->_gyro->_talkedToCrapulus) { + // Spludwick - what does he need? + // 0 - let it through to use normal routine. + switch (_vm->_gyro->_givenToSpludwick) { + case 1: // Fallthrough is intended. + case 2: { + Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); + Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); + _vm->_scrolls->displayText(tmpStr); + } + return; + case 3: + displayScrollChain('q', 30); // Need any help with the game? + return; + } + } else { + displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. + return; + } + break; + case Gyro::kPeopleIbythneth: + if (_vm->_gyro->_givenBadgeToIby) { + displayScrollChain('q', 33); // Thanks a lot! + return; // And leave the proc. + } + break; // Or... just continue, 'cos he hasn't got it. + case Gyro::kPeopleDogfood: + if (_vm->_gyro->_wonNim) { // We've won the game. + displayScrollChain('q', 6); // "I'm Not Playing!" + return; // Zap back. + } else + _vm->_gyro->_askedDogfoodAboutNim = true; + break; + case Gyro::kPeopleAyles: + if (!_vm->_gyro->_aylesIsAwake) { + displayScrollChain('q', 43); // He's fast asleep! + return; + } else if (!_vm->_gyro->_givenPenToAyles) { + displayScrollChain('q', 44); // Can you get me a pen, Avvy? + return; + } + break; + + case Gyro::kPeopleJacques: + displayScrollChain('q', 43); + return; + + case Gyro::kPeopleGeida: + if (_vm->_gyro->_givenPotionToGeida) + _vm->_gyro->_geidaFollows = true; + else { + displayScrollChain('u', 17); + return; + } + break; + case Gyro::kPeopleSpurge: + if (!_vm->_gyro->_sittingInPub) { + displayScrollChain('q', 71); // Try going over and sitting down. + return; + } else { + if (_vm->_gyro->_spurgeTalkCount < 5) + _vm->_gyro->_spurgeTalkCount++; + if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); + return; + } + } + break; + } + // On a subject. Is there any reason to block it? + } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { + displayScrollChain('q', 43); // He's fast asleep! + return; + } + + if (whom > 149) + whom -= 149; + + bool noMatches = true; + for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + noMatches = false; + break; + } + } + + if (noMatches) { + Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, Scrolls::kControlRegister, Scrolls::kControlToBuffer); + _vm->_scrolls->displayText(tmpStr); + } + + speak(whom, _vm->_gyro->_subjectNum); + + if (!_noError) + displayScrollChain('n', whom); // File not found! + + if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; + _vm->_lucerna->refreshObjectList(); + displayScrollChain('q', 1); // Circular from Cardiff. + _vm->_gyro->_talkedToCrapulus = true; + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = true; + spr->walkTo(3); // Walks away. + + _vm->_lucerna->incScore(2); + } +} + } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 026c5888e126..a8938a5d34e8 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -78,6 +78,10 @@ class Scrolls { Common::String displayMoney(); void musicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. + // From Visa: + void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); + void talkTo(byte whom); + private: AvalancheEngine *_vm; @@ -116,6 +120,12 @@ class Scrolls { void getIcon(int16 x, int16 y, byte which); void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void loadFont(); + + // From Visa: + bool _noError; + void unSkrimble(); + void doTheBubble(); + void speak(byte who, byte subject); }; } // End of namespace Avalanche diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 2df7ce217a93..4e3f3aa2a9ce 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -30,7 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/timer.h" -#include "avalanche/visa2.h" #include "avalanche/lucerna2.h" #include "avalanche/animation.h" #include "avalanche/scrolls2.h" @@ -243,7 +242,7 @@ void Timer::openDrawbridge() { } void Timer::avariciusTalks() { - _vm->_visa->displayScrollChain('q', _vm->_gyro->_avariciusTalk); + _vm->_scrolls->displayScrollChain('q', _vm->_gyro->_avariciusTalk); _vm->_gyro->_avariciusTalk++; if (_vm->_gyro->_avariciusTalk < 17) @@ -286,25 +285,25 @@ void Timer::stairs() { void Timer::cardiffSurvey() { if (_vm->_gyro->_cardiffQuestionNum == 0) { _vm->_gyro->_cardiffQuestionNum++; - _vm->_visa->displayScrollChain('q', 27); + _vm->_scrolls->displayScrollChain('q', 27); } - _vm->_visa->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); + _vm->_scrolls->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } void Timer::cardiffReturn() { - _vm->_visa->displayScrollChain('q', 28); + _vm->_scrolls->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } void Timer::cwytalotInHerts() { - _vm->_visa->displayScrollChain('q', 29); + _vm->_scrolls->displayScrollChain('q', 29); } void Timer::getTiedUp() { - _vm->_visa->displayScrollChain('q', 34); // ...Trouble! + _vm->_scrolls->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); @@ -331,18 +330,18 @@ void Timer::hangAround() { avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); - _vm->_visa->displayScrollChain('q', 39); + _vm->_scrolls->displayScrollChain('q', 39); avvy->walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { - _vm->_visa->displayScrollChain('q', 40); + _vm->_scrolls->displayScrollChain('q', 40); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(4); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; - _vm->_visa->displayScrollChain('q', 41); + _vm->_scrolls->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -387,7 +386,7 @@ void Timer::afterTheShootemup() { warning("STUB: Timer::after_the_shootemup()"); - _vm->_visa->displayScrollChain('q', 70); + _vm->_scrolls->displayScrollChain('q', 70); } void Timer::jacquesWakesUp() { @@ -396,7 +395,7 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. - _vm->_visa->displayScrollChain('Q', 45); + _vm->_scrolls->displayScrollChain('Q', 45); break; case 2 : // Going through the door. _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. @@ -444,7 +443,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon void Timer::naughtyDuke2() { AnimationType *spr = &_vm->_animation->_sprites[1]; - _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" + _vm->_scrolls->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(1); // Walk to the door. spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); @@ -498,14 +497,14 @@ void Timer::jump() { _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_visa->displayScrollChain('q', 50); + _vm->_scrolls->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); } } } void Timer::crapulusSaysSpludOut() { - _vm->_visa->displayScrollChain('q', 56); + _vm->_scrolls->displayScrollChain('q', 56); _vm->_gyro->_crapulusWillTell = false; } @@ -513,11 +512,11 @@ void Timer::buyDrinks() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_visa->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. + _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. - _vm->_visa->displayScrollChain('D', 1); // That'll be thruppence. + _vm->_scrolls->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. - _vm->_visa->displayScrollChain('D', 3); // Tell 'em you paid up. + _vm->_scrolls->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -525,10 +524,10 @@ void Timer::buyWine() { _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_visa->displayScrollChain('D', 50); // You buy the wine. - _vm->_visa->displayScrollChain('D', 1); // It'll be thruppence. + _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. + _vm->_scrolls->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { - _vm->_visa->displayScrollChain('D', 4); // You paid up. + _vm->_scrolls->displayScrollChain('D', 4); // You paid up. _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wineState = 1; // OK Wine. @@ -536,12 +535,12 @@ void Timer::buyWine() { } void Timer::callsGuards() { - _vm->_visa->displayScrollChain('Q', 58); // "GUARDS!!!" + _vm->_scrolls->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } void Timer::greetsMonk() { - _vm->_visa->displayScrollChain('Q', 59); + _vm->_scrolls->displayScrollChain('Q', 59); _vm->_gyro->_enteredLustiesRoomAsMonk = true; } @@ -560,7 +559,7 @@ void Timer::meetAvaroid() { _vm->_scrolls->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { - _vm->_visa->displayScrollChain('Q', 60); + _vm->_scrolls->displayScrollChain('Q', 60); _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); @@ -599,7 +598,7 @@ void Timer::robinHoodAndGeida() { } void Timer::robinHoodAndGeidaTalk() { - _vm->_visa->displayScrollChain('q', 66); + _vm->_scrolls->displayScrollChain('q', 66); AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -618,7 +617,7 @@ void Timer::avalotReturns() { spr->remove(); avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); - _vm->_visa->displayScrollChain('q', 67); + _vm->_scrolls->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } @@ -649,12 +648,12 @@ void Timer::arkataShouts() { if (_vm->_gyro->_teetotal) return; - _vm->_visa->displayScrollChain('q', 76); + _vm->_scrolls->displayScrollChain('q', 76); addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timer::winning() { - _vm->_visa->displayScrollChain('q', 79); + _vm->_scrolls->displayScrollChain('q', 79); _vm->_pingo->winningPic(); warning("STUB: Timer::winning()"); @@ -698,7 +697,7 @@ void Timer::spludwickLeavesCauldron() { } void Timer::giveLuteToGeida() { // Moved here from Acci. - _vm->_visa->displayScrollChain('Q', 86); + _vm->_scrolls->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp deleted file mode 100644 index cbf0e050698c..000000000000 --- a/engines/avalanche/visa2.cpp +++ /dev/null @@ -1,281 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* VISA The new Sez handler. (Replaces Access.) */ - -#include "avalanche/avalanche.h" - -#include "avalanche/visa2.h" -#include "avalanche/gyro2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/acci2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/animation.h" - -#include "common/textconsole.h" - -namespace Avalanche { - -Visa::Visa(AvalancheEngine *vm) { - _vm = vm; - _noError = true; -} - -void Visa::unSkrimble() { - for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) - _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; -} - -void Visa::doTheBubble() { - _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; -} - -/** - * Display a string in a scroll - * @remarks Originally called 'dixi' - */ -void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling) { - Common::File indexfile; - if (!indexfile.open("avalot.idx")) - error("AVALANCHE: Visa: File not found: avalot.idx"); - - bool error = false; - - indexfile.seek((toupper(block) - 65) * 2); - uint16 idx_offset = indexfile.readUint16LE(); - if (idx_offset == 0) - error = true; - - indexfile.seek(idx_offset + point * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if (sez_offset == 0) - error = true; - - indexfile.close(); - - _noError = !error; - - if (error) { - if (report) { - Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Scrolls::kControlBell, block, point); - _vm->_scrolls->displayText(todisplay); - } - return; - } - - Common::File sezfile; - if (!sezfile.open("avalot.sez")) - ::error("AVALANCHE: Visa: File not found: avalot.sez"); - - sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); - sezfile.close(); - unSkrimble(); - - if (bubbling) - doTheBubble(); - - _vm->_scrolls->callScrollDriver(); -} - -/** - * Start speech - * @remarks Originally called 'speech' - */ -void Visa::speak(byte who, byte subject) { - if (subject == 0) { // No subject. - displayScrollChain('s', who, false, true); - return; - } - - // Subject given. - _noError = false; // Assume that until we know otherwise. - - Common::File indexfile; - if (!indexfile.open("converse.avd")) - error("AVALANCHE: Visa: File not found: converse.avd"); - - indexfile.seek(who * 2 - 2); - uint16 idx_offset = indexfile.readUint16LE(); - uint16 next_idx_offset = indexfile.readUint16LE(); - - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) - return; - - indexfile.seek(idx_offset + subject * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if ((sez_offset == 0) || (indexfile.err())) - return; - indexfile.close(); - - Common::File sezfile; - if (!sezfile.open("avalot.sez")) - error("AVALANCHE: Visa: File not found: avalot.sez"); - - sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); - sezfile.close(); - - unSkrimble(); - doTheBubble(); - - _vm->_scrolls->callScrollDriver(); - _noError = true; -} - -void Visa::talkTo(byte whom) { - if (_vm->_acci->_person == _vm->_acci->kPardon) { - _vm->_acci->_person = _vm->_gyro->_subjectNum; - _vm->_gyro->_subjectNum = 0; - } - - if (_vm->_gyro->_subjectNum == 0) { - switch (whom) { - case Gyro::kPeopleSpludwick: - if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { - displayScrollChain('q', 68); - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(3); - return; - } else if (_vm->_gyro->_talkedToCrapulus) { - // Spludwick - what does he need? - // 0 - let it through to use normal routine. - switch (_vm->_gyro->_givenToSpludwick) { - case 1: // Fallthrough is intended. - case 2: { - Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); - Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); - } - return; - case 3: - displayScrollChain('q', 30); // Need any help with the game? - return; - } - } else { - displayScrollChain('q', 42); // Haven't talked to Crapulus. Go and talk to him. - return; - } - break; - case Gyro::kPeopleIbythneth: - if (_vm->_gyro->_givenBadgeToIby) { - displayScrollChain('q', 33); // Thanks a lot! - return; // And leave the proc. - } - break; // Or... just continue, 'cos he hasn't got it. - case Gyro::kPeopleDogfood: - if (_vm->_gyro->_wonNim) { // We've won the game. - displayScrollChain('q', 6); // "I'm Not Playing!" - return; // Zap back. - } else - _vm->_gyro->_askedDogfoodAboutNim = true; - break; - case Gyro::kPeopleAyles: - if (!_vm->_gyro->_aylesIsAwake) { - displayScrollChain('q', 43); // He's fast asleep! - return; - } else if (!_vm->_gyro->_givenPenToAyles) { - displayScrollChain('q', 44); // Can you get me a pen, Avvy? - return; - } - break; - - case Gyro::kPeopleJacques: - displayScrollChain('q', 43); - return; - - case Gyro::kPeopleGeida: - if (_vm->_gyro->_givenPotionToGeida) - _vm->_gyro->_geidaFollows = true; - else { - displayScrollChain('u', 17); - return; - } - break; - case Gyro::kPeopleSpurge: - if (!_vm->_gyro->_sittingInPub) { - displayScrollChain('q', 71); // Try going over and sitting down. - return; - } else { - if (_vm->_gyro->_spurgeTalkCount < 5) - _vm->_gyro->_spurgeTalkCount++; - if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); - return; - } - } - break; - } - // On a subject. Is there any reason to block it? - } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { - displayScrollChain('q', 43); // He's fast asleep! - return; - } - - if (whom > 149) - whom -= 149; - - bool noMatches = true; - for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - noMatches = false; - break; - } - } - - if (noMatches) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, Scrolls::kControlRegister, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); - } - - speak(whom, _vm->_gyro->_subjectNum); - - if (!_noError) - displayScrollChain('n', whom); // File not found! - - if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; - _vm->_lucerna->refreshObjectList(); - displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_gyro->_talkedToCrapulus = true; - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. - - AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->_vanishIfStill = true; - spr->walkTo(3); // Walks away. - - _vm->_lucerna->incScore(2); - } -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h deleted file mode 100644 index c811053fabfd..000000000000 --- a/engines/avalanche/visa2.h +++ /dev/null @@ -1,56 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* VISA The new Sez handler. (Replaces Access.) */ - -#ifndef AVALANCHE_VISA2_H -#define AVALANCHE_VISA2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Visa { -public: - Visa(AvalancheEngine *vm); - - void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); - void talkTo(byte whom); - -private: - AvalancheEngine *_vm; - - bool _noError; - void unSkrimble(); - void doTheBubble(); - void speak(byte who, byte subject); -}; - -} // End of namespace Avalanche. - -#endif // AVALANCHE_VISA2_H From 4979cc5f69739f7d493076ebbedcc7a0eb77ef35 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 12:44:49 +0200 Subject: [PATCH 0959/1332] AVALANCHE: Rename Gyro::_dogFoodPos. Add comments to clarify it's function. --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/celer2.cpp | 18 +++++++++--------- engines/avalanche/gyro2.cpp | 2 +- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 10 ++++------ 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c768fc1346cb..9f2f46e8ceee 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -151,7 +151,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_gyro->_avvyIsAwake); sz.syncAsByte(_gyro->_avvyInBed); sz.syncAsByte(_gyro->_userMovesAvvy); - sz.syncAsByte(_gyro->_dogFoodPos); + sz.syncAsByte(_gyro->_npcFacing); sz.syncAsByte(_gyro->_givenBadgeToIby); sz.syncAsByte(_gyro->_friarWillTieYouUp); sz.syncAsByte(_gyro->_tiedUp); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 143725a92c4d..7e2891e69122 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -112,7 +112,7 @@ void Celer::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 7); break; case 199: - _vm->_gyro->_dogFoodPos = 177; // Impossible value for this. + _vm->_gyro->_npcFacing = 177; // Impossible value for this. break; } @@ -125,9 +125,9 @@ void Celer::updateBackgroundSprites() { else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) direction = 4; - if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_npcFacing) { // Dogfood. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dogFoodPos = direction; + _vm->_gyro->_npcFacing = direction; } } break; @@ -163,9 +163,9 @@ void Celer::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_npcFacing) { // du Lustie. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_npcFacing = direction; } } break; @@ -207,9 +207,9 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_npcFacing) { // Port. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_npcFacing = direction; } switch (_vm->_gyro->_roomTime % 50) { @@ -239,9 +239,9 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_gyro->_dogFoodPos) { // Only if it's changed. + if (direction != _vm->_gyro->_npcFacing) { // Duck. drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->_dogFoodPos = direction; // We use DogfoodPos here too - why not? + _vm->_gyro->_npcFacing = direction; } break; } diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 8bfa53f616dd..7598d6c33178 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -259,7 +259,7 @@ void Gyro::resetVariables() { _avvyIsAwake = false; _avvyInBed = false; _userMovesAvvy = false; - _dogFoodPos = 0; + _npcFacing = 0; _givenBadgeToIby = false; _friarWillTieYouUp = false; _tiedUp = false; diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 20e240af0b3f..0f8b9aea5d97 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -270,7 +270,7 @@ class Gyro { bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) bool _avvyInBed; // True if Avvy's in bed, but awake. bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _dogFoodPos; // Which way Dogfood's looking in the pub. + byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. bool _givenBadgeToIby; // Have you given the badge to Iby yet? bool _friarWillTieYouUp; // If you're going to get tied up. bool _tiedUp; // You ARE tied up! diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 961202b7ad0a..c45c85c61bae 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -502,8 +502,6 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[1] = r__spludwicks; } - _vm->_gyro->_dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } else @@ -667,7 +665,7 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__lustiesroom: - _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. + _vm->_gyro->_npcFacing = 1; // du Lustie. if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (!_vm->_gyro->_enteredLustiesRoomAsMonk) // already @@ -822,7 +820,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__nottspub: if (_vm->_gyro->_sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_dogFoodPos = 1; // Actually, du Lustie pos. + _vm->_gyro->_npcFacing = 1; // Port. break; case r__outsideducks: @@ -839,8 +837,8 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__ducks: - _vm->_gyro->_dogFoodPos = 1; - break; // Actually, Duck pos. + _vm->_gyro->_npcFacing = 1; // Duck. + break; } _vm->_gyro->_seeScroll = false; // Now it can work again! From 7ee6e8699f97e691ea89266781f1c77437764658 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 13:03:21 +0200 Subject: [PATCH 0960/1332] AVALANCHE: Remove the '2' from the source files' names. --- engines/avalanche/{acci2.cpp => acci.cpp} | 16 +++++++-------- engines/avalanche/{acci2.h => acci.h} | 0 engines/avalanche/animation.cpp | 12 +++++------ engines/avalanche/avalanche.h | 20 +++++++++---------- engines/avalanche/avalot.cpp | 18 ++++++++--------- engines/avalanche/{celer2.cpp => celer.cpp} | 6 +++--- engines/avalanche/{celer2.h => celer.h} | 0 .../avalanche/{closing2.cpp => closing.cpp} | 6 +++--- engines/avalanche/{closing2.h => closing.h} | 0 .../avalanche/{dropdown2.cpp => dropdown.cpp} | 10 +++++----- engines/avalanche/{dropdown2.h => dropdown.h} | 0 engines/avalanche/{enid2.cpp => enid.cpp} | 10 +++++----- engines/avalanche/{enid2.h => enid.h} | 0 engines/avalanche/{gyro2.cpp => gyro.cpp} | 10 +++++----- engines/avalanche/{gyro2.h => gyro.h} | 0 .../avalanche/{lucerna2.cpp => lucerna.cpp} | 16 +++++++-------- engines/avalanche/{lucerna2.h => lucerna.h} | 0 engines/avalanche/module.mk | 20 +++++++++---------- engines/avalanche/{pingo2.cpp => pingo.cpp} | 8 ++++---- engines/avalanche/{pingo2.h => pingo.h} | 0 .../avalanche/{scrolls2.cpp => scrolls.cpp} | 8 ++++---- engines/avalanche/{scrolls2.h => scrolls.h} | 0 .../avalanche/{sequence2.cpp => sequence.cpp} | 6 +++--- engines/avalanche/{sequence2.h => sequence.h} | 0 engines/avalanche/timer.cpp | 12 +++++------ 25 files changed, 89 insertions(+), 89 deletions(-) rename engines/avalanche/{acci2.cpp => acci.cpp} (99%) rename engines/avalanche/{acci2.h => acci.h} (100%) rename engines/avalanche/{celer2.cpp => celer.cpp} (99%) rename engines/avalanche/{celer2.h => celer.h} (100%) rename engines/avalanche/{closing2.cpp => closing.cpp} (96%) rename engines/avalanche/{closing2.h => closing.h} (100%) rename engines/avalanche/{dropdown2.cpp => dropdown.cpp} (99%) rename engines/avalanche/{dropdown2.h => dropdown.h} (100%) rename engines/avalanche/{enid2.cpp => enid.cpp} (97%) rename engines/avalanche/{enid2.h => enid.h} (100%) rename engines/avalanche/{gyro2.cpp => gyro.cpp} (99%) rename engines/avalanche/{gyro2.h => gyro.h} (100%) rename engines/avalanche/{lucerna2.cpp => lucerna.cpp} (99%) rename engines/avalanche/{lucerna2.h => lucerna.h} (100%) rename engines/avalanche/{pingo2.cpp => pingo.cpp} (96%) rename engines/avalanche/{pingo2.h => pingo.h} (100%) rename engines/avalanche/{scrolls2.cpp => scrolls.cpp} (99%) rename engines/avalanche/{scrolls2.h => scrolls.h} (100%) rename engines/avalanche/{sequence2.cpp => sequence.cpp} (96%) rename engines/avalanche/{sequence2.h => sequence.h} (100%) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci.cpp similarity index 99% rename from engines/avalanche/acci2.cpp rename to engines/avalanche/acci.cpp index 1008a6015756..3b633c1dfa26 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci.cpp @@ -29,16 +29,16 @@ #include "avalanche/avalanche.h" -#include "avalanche/acci2.h" -#include "avalanche/gyro2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/scrolls2.h" +#include "avalanche/acci.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" +#include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/enid2.h" -#include "avalanche/celer2.h" -#include "avalanche/pingo2.h" -#include "avalanche/sequence2.h" +#include "avalanche/enid.h" +#include "avalanche/celer.h" +#include "avalanche/pingo.h" +#include "avalanche/sequence.h" #include "common/textconsole.h" diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci.h similarity index 100% rename from engines/avalanche/acci2.h rename to engines/avalanche/acci.h diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 21063e09a7c4..526f6a851710 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -30,13 +30,13 @@ #include "avalanche/avalanche.h" #include "avalanche/animation.h" -#include "avalanche/scrolls2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/gyro2.h" -#include "avalanche/celer2.h" -#include "avalanche/sequence2.h" +#include "avalanche/scrolls.h" +#include "avalanche/lucerna.h" +#include "avalanche/gyro.h" +#include "avalanche/celer.h" +#include "avalanche/sequence.h" #include "avalanche/timer.h" -#include "avalanche/enid2.h" +#include "avalanche/enid.h" #include "common/scummsys.h" #include "common/textconsole.h" diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index b93c117377b3..30eaee03fdb3 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -34,18 +34,18 @@ #include "avalanche/parser.h" #include "avalanche/avalot.h" -#include "avalanche/gyro2.h" -#include "avalanche/pingo2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/enid2.h" -#include "avalanche/celer2.h" -#include "avalanche/sequence2.h" +#include "avalanche/gyro.h" +#include "avalanche/pingo.h" +#include "avalanche/scrolls.h" +#include "avalanche/lucerna.h" +#include "avalanche/enid.h" +#include "avalanche/celer.h" +#include "avalanche/sequence.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/acci2.h" -#include "avalanche/dropdown2.h" -#include "avalanche/closing2.h" +#include "avalanche/acci.h" +#include "avalanche/dropdown.h" +#include "avalanche/closing.h" #include "common/serializer.h" diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a5b3e06ff8e2..a52186d4e29e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -31,17 +31,17 @@ #include "avalanche/graphics.h" #include "avalanche/avalot.h" -#include "avalanche/gyro2.h" +#include "avalanche/gyro.h" #include "avalanche/animation.h" -#include "avalanche/gyro2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/dropdown2.h" -#include "avalanche/pingo2.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" +#include "avalanche/scrolls.h" +#include "avalanche/dropdown.h" +#include "avalanche/pingo.h" #include "avalanche/timer.h" -#include "avalanche/celer2.h" -#include "avalanche/enid2.h" -#include "avalanche/closing2.h" +#include "avalanche/celer.h" +#include "avalanche/enid.h" +#include "avalanche/closing.h" #include "common/str.h" #include "common/textconsole.h" diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer.cpp similarity index 99% rename from engines/avalanche/celer2.cpp rename to engines/avalanche/celer.cpp index 7e2891e69122..f8b2604ee097 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer.cpp @@ -29,10 +29,10 @@ #include "avalanche/avalanche.h" -#include "avalanche/celer2.h" +#include "avalanche/celer.h" #include "avalanche/animation.h" -#include "avalanche/lucerna2.h" -#include "avalanche/gyro2.h" +#include "avalanche/lucerna.h" +#include "avalanche/gyro.h" #include "avalanche/roomnums.h" #include "common/textconsole.h" diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer.h similarity index 100% rename from engines/avalanche/celer2.h rename to engines/avalanche/celer.h diff --git a/engines/avalanche/closing2.cpp b/engines/avalanche/closing.cpp similarity index 96% rename from engines/avalanche/closing2.cpp rename to engines/avalanche/closing.cpp index 7da630bae3f6..df53bc38b97e 100644 --- a/engines/avalanche/closing2.cpp +++ b/engines/avalanche/closing.cpp @@ -29,9 +29,9 @@ #include "avalanche/avalanche.h" -#include "avalanche/closing2.h" -#include "avalanche/gyro2.h" -#include "avalanche/lucerna2.h" +#include "avalanche/closing.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" #include "common/textconsole.h" #include "common/random.h" diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing.h similarity index 100% rename from engines/avalanche/closing2.h rename to engines/avalanche/closing.h diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown.cpp similarity index 99% rename from engines/avalanche/dropdown2.cpp rename to engines/avalanche/dropdown.cpp index 1f499a22afe5..2e070e6b0b02 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown.cpp @@ -29,12 +29,12 @@ #include "avalanche/avalanche.h" -#include "avalanche/dropdown2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/gyro2.h" -#include "avalanche/acci2.h" +#include "avalanche/dropdown.h" +#include "avalanche/lucerna.h" +#include "avalanche/gyro.h" +#include "avalanche/acci.h" #include "avalanche/animation.h" -#include "avalanche/enid2.h" +#include "avalanche/enid.h" #include "common/textconsole.h" diff --git a/engines/avalanche/dropdown2.h b/engines/avalanche/dropdown.h similarity index 100% rename from engines/avalanche/dropdown2.h rename to engines/avalanche/dropdown.h diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid.cpp similarity index 97% rename from engines/avalanche/enid2.cpp rename to engines/avalanche/enid.cpp index 4c8013e87905..4e8071a1095e 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid.cpp @@ -29,13 +29,13 @@ #include "avalanche/avalanche.h" -#include "avalanche/enid2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/lucerna2.h" +#include "avalanche/enid.h" +#include "avalanche/scrolls.h" +#include "avalanche/lucerna.h" #include "avalanche/animation.h" #include "avalanche/timer.h" -#include "avalanche/celer2.h" -#include "avalanche/sequence2.h" +#include "avalanche/celer.h" +#include "avalanche/sequence.h" #include "common/textconsole.h" diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid.h similarity index 100% rename from engines/avalanche/enid2.h rename to engines/avalanche/enid.h diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro.cpp similarity index 99% rename from engines/avalanche/gyro2.cpp rename to engines/avalanche/gyro.cpp index 7598d6c33178..1e95c6b725c1 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro.cpp @@ -29,11 +29,11 @@ #include "avalanche/avalanche.h" -#include "avalanche/gyro2.h" -#include "avalanche/pingo2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/acci2.h" +#include "avalanche/gyro.h" +#include "avalanche/pingo.h" +#include "avalanche/scrolls.h" +#include "avalanche/lucerna.h" +#include "avalanche/acci.h" #include "avalanche/animation.h" #include "common/file.h" diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro.h similarity index 100% rename from engines/avalanche/gyro2.h rename to engines/avalanche/gyro.h diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna.cpp similarity index 99% rename from engines/avalanche/lucerna2.cpp rename to engines/avalanche/lucerna.cpp index c45c85c61bae..31a88743411c 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna.cpp @@ -29,16 +29,16 @@ #include "avalanche/avalanche.h" -#include "avalanche/lucerna2.h" -#include "avalanche/gyro2.h" -#include "avalanche/scrolls2.h" +#include "avalanche/lucerna.h" +#include "avalanche/gyro.h" +#include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/enid2.h" -#include "avalanche/celer2.h" -#include "avalanche/pingo2.h" -#include "avalanche/sequence2.h" -#include "avalanche/acci2.h" +#include "avalanche/enid.h" +#include "avalanche/celer.h" +#include "avalanche/pingo.h" +#include "avalanche/sequence.h" +#include "avalanche/acci.h" #include "avalanche/roomnums.h" #include "common/rect.h" diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna.h similarity index 100% rename from engines/avalanche/lucerna2.h rename to engines/avalanche/lucerna.h diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 6881a3e21647..aabf34c4afb1 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -7,18 +7,18 @@ MODULE_OBJS = \ avalot.o \ console.o \ detection.o \ - gyro2.o \ - pingo2.o \ - scrolls2.o \ - lucerna2.o \ - enid2.o \ - celer2.o \ - sequence2.o \ + gyro.o \ + pingo.o \ + scrolls.o \ + lucerna.o \ + enid.o \ + celer.o \ + sequence.o \ timer.o \ animation.o \ - acci2.o \ - dropdown2.o \ - closing2.o + acci.o \ + dropdown.o \ + closing.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo.cpp similarity index 96% rename from engines/avalanche/pingo2.cpp rename to engines/avalanche/pingo.cpp index 9f99d8c1847d..5f2df1bc119f 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo.cpp @@ -29,11 +29,11 @@ #include "avalanche/avalanche.h" -#include "avalanche/pingo2.h" -#include "avalanche/gyro2.h" -#include "avalanche/lucerna2.h" +#include "avalanche/pingo.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls2.h" +#include "avalanche/scrolls.h" #include "common/textconsole.h" #include "common/file.h" diff --git a/engines/avalanche/pingo2.h b/engines/avalanche/pingo.h similarity index 100% rename from engines/avalanche/pingo2.h rename to engines/avalanche/pingo.h diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls.cpp similarity index 99% rename from engines/avalanche/scrolls2.cpp rename to engines/avalanche/scrolls.cpp index 56e9b2f1c475..6e1bb0b49266 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls.cpp @@ -29,11 +29,11 @@ #include "avalanche/avalanche.h" -#include "avalanche/scrolls2.h" -#include "avalanche/gyro2.h" -#include "avalanche/lucerna2.h" +#include "avalanche/scrolls.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/acci2.h" +#include "avalanche/acci.h" #include "avalanche/timer.h" #include "common/textconsole.h" diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls.h similarity index 100% rename from engines/avalanche/scrolls2.h rename to engines/avalanche/scrolls.h diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence.cpp similarity index 96% rename from engines/avalanche/sequence2.cpp rename to engines/avalanche/sequence.cpp index 22ee7fc0e46b..0e6d72acdd9f 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence.cpp @@ -29,10 +29,10 @@ #include "avalanche/avalanche.h" -#include "avalanche/sequence2.h" -#include "avalanche/gyro2.h" +#include "avalanche/sequence.h" +#include "avalanche/gyro.h" #include "avalanche/timer.h" -#include "avalanche/celer2.h" +#include "avalanche/celer.h" #include "avalanche/animation.h" #include "common/scummsys.h" diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence.h similarity index 100% rename from engines/avalanche/sequence2.h rename to engines/avalanche/sequence.h diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 4e3f3aa2a9ce..736a5812ceaf 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -30,13 +30,13 @@ #include "avalanche/avalanche.h" #include "avalanche/timer.h" -#include "avalanche/lucerna2.h" +#include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls2.h" -#include "avalanche/acci2.h" -#include "avalanche/sequence2.h" -#include "avalanche/enid2.h" -#include "avalanche/pingo2.h" +#include "avalanche/scrolls.h" +#include "avalanche/acci.h" +#include "avalanche/sequence.h" +#include "avalanche/enid.h" +#include "avalanche/pingo.h" #include "common/textconsole.h" From a81b499062bf968b94bfaaa96d84aa893bf87343 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 13:21:03 +0200 Subject: [PATCH 0961/1332] AVALANCHE: Get rid of Enid. --- engines/avalanche/acci.cpp | 5 +- engines/avalanche/animation.cpp | 3 +- engines/avalanche/avalanche.cpp | 2 - engines/avalanche/avalanche.h | 2 - engines/avalanche/avalot.cpp | 1 - engines/avalanche/dropdown.cpp | 3 +- engines/avalanche/enid.cpp | 302 -------------------------------- engines/avalanche/enid.h | 78 --------- engines/avalanche/lucerna.cpp | 1 - engines/avalanche/module.mk | 1 - engines/avalanche/timer.cpp | 3 +- 11 files changed, 5 insertions(+), 396 deletions(-) delete mode 100644 engines/avalanche/enid.cpp delete mode 100644 engines/avalanche/enid.h diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3b633c1dfa26..a90e1f0a214f 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -35,7 +35,6 @@ #include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/enid.h" #include "avalanche/celer.h" #include "avalanche/pingo.h" #include "avalanche/sequence.h" @@ -1432,7 +1431,7 @@ void Acci::giveGeidaTheLute() { _vm->_scrolls->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); - _vm->_enid->backToBootstrap(4); + //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! } void Acci::playHarp() { @@ -2106,7 +2105,7 @@ void Acci::doThat() { } break; case kVerbCodeDir: - _vm->_enid->dir(_realWords[1]); + //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! break; case kVerbCodeDie: _vm->_lucerna->gameOver(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 526f6a851710..5f89ccb22474 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -36,7 +36,6 @@ #include "avalanche/celer.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" -#include "avalanche/enid.h" #include "common/scummsys.h" #include "common/textconsole.h" @@ -782,7 +781,7 @@ void Animation::callSpecial(uint16 which) { _vm->_lucerna->dusk(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); - _vm->_enid->backToBootstrap(3); + //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: if (_vm->_gyro->_friarWillTieYouUp) { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 9f2f46e8ceee..c6f74f80f08c 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -65,7 +65,6 @@ AvalancheEngine::~AvalancheEngine() { delete _pingo; delete _scrolls; delete _lucerna; - delete _enid; delete _celer; delete _sequence; delete _timer; @@ -85,7 +84,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _pingo = new Pingo(this); _scrolls = new Scrolls(this); _lucerna = new Lucerna(this); - _enid = new Enid(this); _celer = new Celer(this); _sequence = new Sequence(this); _timer = new Timer(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 30eaee03fdb3..8da159165dd4 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -38,7 +38,6 @@ #include "avalanche/pingo.h" #include "avalanche/scrolls.h" #include "avalanche/lucerna.h" -#include "avalanche/enid.h" #include "avalanche/celer.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" @@ -74,7 +73,6 @@ class AvalancheEngine : public Engine { Pingo *_pingo; Scrolls *_scrolls; Lucerna *_lucerna; - Enid *_enid; Celer *_celer; Sequence *_sequence; Timer *_timer; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a52186d4e29e..788b41897e03 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -40,7 +40,6 @@ #include "avalanche/pingo.h" #include "avalanche/timer.h" #include "avalanche/celer.h" -#include "avalanche/enid.h" #include "avalanche/closing.h" #include "common/str.h" diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 2e070e6b0b02..5efa63e59130 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -34,7 +34,6 @@ #include "avalanche/gyro.h" #include "avalanche/acci.h" #include "avalanche/animation.h" -#include "avalanche/enid.h" #include "common/textconsole.h" @@ -590,7 +589,7 @@ void Dropdown::runMenuFile() { warning("STUB: Dropdown::runMenuFile()"); break; case 4: - _vm->_enid->backToBootstrap(2); + //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: _vm->_lucerna->callVerb(Acci::kVerbCodeQuit); diff --git a/engines/avalanche/enid.cpp b/engines/avalanche/enid.cpp deleted file mode 100644 index 4e8071a1095e..000000000000 --- a/engines/avalanche/enid.cpp +++ /dev/null @@ -1,302 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* ENID Edna's manager. Loads/saves files. */ - -#include "avalanche/avalanche.h" - -#include "avalanche/enid.h" -#include "avalanche/scrolls.h" -#include "avalanche/lucerna.h" -#include "avalanche/animation.h" -#include "avalanche/timer.h" -#include "avalanche/celer.h" -#include "avalanche/sequence.h" - -#include "common/textconsole.h" - -namespace Avalanche { - -Enid::Enid(AvalancheEngine *vm) { - _vm = vm; -} - -// CHECKME: useless? -#if 0 -const Common::String Enid::kCrlf = Common::String(char(15)) + Common::String(char(12)); -const char Enid::kTab = '\t'; -const char Enid::kEof = '\n'; - -const Common::String Enid::kEdnaFirst = - Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + // 64 - kCrlf + kEof + kCrlf + kCrlf + // 7 - kTab + "Glory to God in the highest," + kCrlf + // 31 - kTab + "and on earth peace, goodwill toward men." + // 42 - kCrlf + kTab + kTab + kTab + kTab + // 6 - "Luke 2:14." + // 10 - kCrlf + kCrlf + kCrlf + // 6 - "1234567890" +kCrlf; // 11 - -const Common::String Enid::kEdnaId = Common::String("TT\xB1\x30\x01\x75\xB1\x99\xB1"); -const int16 Enid::kAge = 18; -const Common::String Enid::kWasHere = "Thomas was here "; -const Enid::FourType Enid::kAvariciusFile = "Avvy"; - -/** - * Expand month name - * @remarks Originally called 'addon' - */ -void Enid::expandMonthName(Common::String x) { - _month += x; -} - -Common::String Enid::expandDate(byte d, byte m, uint16 y) { - const Common::String months[12] = { - "Jan#", "Febr#", "March", "April", "May", "June", "July", "August", - "Septem*", "Octo*", "Novem*", "Decem*" - }; - - Common::String expanddate_result; - _month = months[m]; - switch (_month[_month.size()]) { - case '#': - expandMonthName("uary"); - break; - case '*': - expandMonthName("ber"); - break; - } - - _day = _vm->_gyro->strf(d); - - // d is always positive - if ((d <= 9) || ((d >= 21) && (d <= 31))) { - switch (d % 10) { - case 1: - _day = _day + "st"; - break; - case 2: - _day = _day + "nd"; - break; - case 3: - _day = _day + "rd"; - break; - default: - _day = _day + "th"; - } - } - - expanddate_result = _day + ' ' + _month + ' ' + _vm->_gyro->strf(y); - return expanddate_result; -} - -void Enid::showBug(char icon, Common::String strn) { - _vm->_scrolls->display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); -} - -bool Enid::testBug(byte what) { - bool test_bug_result; - if (what == 0) { - test_bug_result = false; - return test_bug_result; - } - switch (what) { - case 2: - showBug('7', "Error in filename!"); - break; - case 101: - showBug('6', "Disk full!"); - break; - case 150: - showBug('4', "Disk is write-protected!"); - break; - default: - showBug('B', "Saving error!"); - } - test_bug_result = true; - return test_bug_result; -} - -void Enid::ednaSave(Common::String name) { - warning("STUB: Enid::ednaSave()"); -} - -void Enid::loadError(Common::String x, char icon) { - if (_vm->_gyro->holdthedawn) { - _vm->_gyro->holdthedawn = false; - _vm->_lucerna->dawn(); - } - _vm->_scrolls->display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); - _bug = true; -} - -void Enid::ednaLoad(Common::String name) { - warning("STUB: Enid::ednaLoad()"); -} - -void Enid::showHeader() { - _vm->_scrolls->display(Common::String("Dir: ") + _path + "\r\r\4"); -} - -void Enid::avvyBackground() { - // Not really a filing procedure, - // but it's only called just before edna_load, so I thought I'd put it - // in Enid instead of, say, Lucerna. - -#if 0 - port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. } - - asm - mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" } - mov dx,$3ce; mov al,4; out dx,al; { register. } - mov dx,$3c5; mov al,1; out dx,al; - mov dx,$3cf; out dx,al; - - mov bx,$A000; call far ptr @drawup; - mov bx,$A400; call far ptr @drawup; - - jmp @the_end; - - @drawup: - - mov es,bx; { The segment to copy it to... } - mov di,$370; { The offset (10 pixels down, plus 1 offset.) } - - mov cx,10; - mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" } - mov ax,$AEAA; call far ptr @sameline; - mov ax,$A4EA; call far ptr @sameline; - mov ax,$44A4; call far ptr @sameline; - - mov cx,9; - mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" } - mov ax,$AAEA; call far ptr @sameline; - mov ax,$AA4E; call far ptr @sameline; - mov ax,$444A; call far ptr @sameline; - - mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" } - mov ax,$AAAE; call far ptr @sameline; - mov ax,$EAA4; call far ptr @sameline; - mov ax,$A444; call far ptr @sameline; - - mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" } - mov ax,$EAAA; call far ptr @sameline; - mov ax,$4EAA; call far ptr @sameline; - mov ax,$4A44; call far ptr @sameline; - - ret; - - - { Replicate the same line many times. } - - @sameline: - { Requires: - what to copy in AX, - how many lines in CX, and - original offset in DI. } - push cx; - push di; - - @samelineloop: - - push cx; - mov cx,40; { No. of times to repeat it on one line. } - - repz stosw; { Fast uint16-copying } - - pop cx; - - add di,1200; { The next one will be 16 lines down. } - - loop @samelineloop; - pop di; - add di,80; - pop cx; - - ret; - - @the_end: - end; -#endif -} - -void Enid::toSundry(Sundry &sund) { - sund._qEnidFilename = _vm->_gyro->_enidFilename; - sund._qSoundFx = _vm->_gyro->_soundFx; - sund._qThinks = _vm->_gyro->_thinks; - sund._qThinkThing = _vm->_gyro->_thinkThing; -} - -void Enid::fromSundry(Sundry sund) { - _vm->_gyro->_enidFilename = sund._qEnidFilename; - _vm->_gyro->_soundFx = sund._qSoundFx; - _vm->_gyro->_thinks = sund._qThinks; - _vm->_gyro->_thinkThing = sund._qThinkThing; -} - -void Enid::restoreDna() { -// uint16 here, fv; -// sundry sund; - - warning("STUB: Enid::restoreDna()"); -} - -void Enid::ednaReload() { - - restoreDna(); - - _vm->_gyro->_seeScroll = true; // This prevents display of the new sprites before the - // new picture is loaded. - - _vm->_lucerna->majorRedraw(); - - _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; - - _vm->_gyro->_alive = true; - - _vm->_lucerna->refreshObjectList(); - - if (_vm->_gyro->_holdTheDawn) { - _vm->_gyro->_holdTheDawn = false; - _vm->_lucerna->dawn(); - } -} - -bool Enid::thereWasAProblem() { - return _bug; -} - -#endif - -void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! - warning("STUB: Enid::dir()"); -} -void Enid::backToBootstrap(byte what) { - warning("STUB: Enid::back_to_bootstrap()"); -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/enid.h b/engines/avalanche/enid.h deleted file mode 100644 index 97e249e187d1..000000000000 --- a/engines/avalanche/enid.h +++ /dev/null @@ -1,78 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* ENID Edna's manager. Loads/saves files. */ - -#ifndef AVALANCHE_ENID2_H -#define AVALANCHE_ENID2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Enid { -public: - Enid(AvalancheEngine *vm); - void dir(Common::String where); - void backToBootstrap(byte what); - -private: - AvalancheEngine *_vm; - -// CHECKME: useless? -// static const Common::String kCrlf; -// static const char kTab, kEof; -// static const Common::String kEdnaFirst, kEdnaId, kWasHere; -// static const int16 kAge; -// void expandMonthName(Common::String x); -// Common::String expandDate(byte d, byte m, uint16 y); -// void ednaSave(Common::String name); -// void showBug(char icon, Common::String strn); -// bool testBug(byte what); -// void loadError(Common::String x, char icon); -// void ednaLoad(Common::String name); -// void showHeader(); -// void toSundry(sundry &sund); -// void fromSundry(sundry sund); -// void avvyBackground(); -// void ednaReload(); // From Bootstrap's storage. -// void restoreDna(); -// bool thereWasAProblem(); - -// typedef char FourType[5]; -// static const FourType kAvariciusFile; - -// bool _bug; -// Common::String _path, _groi; -// Common::String _month, _day; - -}; - -} // End of namespace Avalanche. - -#endif // AVALANCHE_ENID2_H diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 31a88743411c..e848442c5c6b 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -34,7 +34,6 @@ #include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/enid.h" #include "avalanche/celer.h" #include "avalanche/pingo.h" #include "avalanche/sequence.h" diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index aabf34c4afb1..0da172cf9f9d 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -11,7 +11,6 @@ MODULE_OBJS = \ pingo.o \ scrolls.o \ lucerna.o \ - enid.o \ celer.o \ sequence.o \ timer.o \ diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 736a5812ceaf..efe5bf30b764 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -35,7 +35,6 @@ #include "avalanche/scrolls.h" #include "avalanche/acci.h" #include "avalanche/sequence.h" -#include "avalanche/enid.h" #include "avalanche/pingo.h" #include "common/textconsole.h" @@ -350,7 +349,7 @@ void Timer::hangAround2() { _vm->_gyro->_tiedUp = false; - _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up. + // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! } void Timer::afterTheShootemup() { From cccc126d156f4f64445eb0eef43affe3a99a5080 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 15:17:37 +0200 Subject: [PATCH 0962/1332] AVALANCHE: Convert index use from Pascal to C in Bearing() --- engines/avalanche/celer.cpp | 13 +++++++------ engines/avalanche/lucerna.cpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index f8b2604ee097..94ef574199e3 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -118,11 +118,12 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 200 >= 0) && (_vm->_gyro->_roomTime % 200 <= 178)) { // Normally. byte direction = 0; - if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) + uint16 angle = _vm->_lucerna->bearing(1); + if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) direction = 3; - else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) + else if ((angle >= 293) && (angle <= 357)) direction = 2; - else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) + else if ((angle >= 271) && (angle <= 292)) direction = 4; if (direction != _vm->_gyro->_npcFacing) { // Dogfood. @@ -152,7 +153,7 @@ void Celer::updateBackgroundSprites() { case r__lustiesroom: if (!(_vm->_gyro->_lustieIsAsleep)) { byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(2); + uint16 angle = _vm->_lucerna->bearing(1); if ((_vm->_gyro->_roomTime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. @@ -196,7 +197,7 @@ void Celer::updateBackgroundSprites() { case r__nottspub: { // Bearing of Avvy from Port. byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(5); + uint16 angle = _vm->_lucerna->bearing(4); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 2; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -228,7 +229,7 @@ void Celer::updateBackgroundSprites() { // Bearing of Avvy from Duck. byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(2); + uint16 angle = _vm->_lucerna->bearing(1); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 4; // Middle. else if ((angle >= 45) && (angle <= 180)) diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index e848442c5c6b..ac27ea6cfc90 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1217,7 +1217,7 @@ void Lucerna::majorRedraw() { uint16 Lucerna::bearing(byte whichPed) { static const double rad2deg = 180 / 3.14; // Pi AnimationType *avvy = &_vm->_animation->_sprites[0]; - PedType *curPed = &_vm->_gyro->_peds[whichPed - 1]; // Different array indexes in Pascal and C. + PedType *curPed = &_vm->_gyro->_peds[whichPed]; if (avvy->_x == curPed->_x) return 0; From ecbd87353e74712a86b1dfe171629c01c729670a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 15:50:05 +0200 Subject: [PATCH 0963/1332] AVALANCHE: Convert index use from Pascal to C in walkTo() --- engines/avalanche/acci.cpp | 10 +++++----- engines/avalanche/animation.cpp | 12 ++++++------ engines/avalanche/lucerna.cpp | 14 +++++++------- engines/avalanche/scrolls.cpp | 2 +- engines/avalanche/timer.cpp | 20 ++++++++++---------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index a90e1f0a214f..59aaa90da224 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -575,7 +575,7 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_spareEvening.clear(); _vm->_gyro->_spareEvening = _vm->_parser->_inputText; _vm->_scrolls->displayScrollChain('z', 5); // His closing statement... - _vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge + _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; _vm->_gyro->_cardiffQuestionNum = 5; @@ -1229,7 +1229,7 @@ void Acci::notInOrder() { void Acci::goToCauldron() { _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); - _vm->_animation->_sprites[1].walkTo(2); + _vm->_animation->_sprites[1].walkTo(1); } /** @@ -1899,7 +1899,7 @@ void Acci::doThat() { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius _vm->_animation->appearPed(2, 4); - spr->walkTo(5); + spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; _vm->_gyro->_avariciusTalk = 14; @@ -2065,7 +2065,7 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; _vm->_lucerna->incScore(7); - _vm->_animation->_sprites[1].walkTo(2); + _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; _vm->_gyro->_whereIs[7] = 177; @@ -2191,7 +2191,7 @@ void Acci::doThat() { if (_vm->_gyro->_sittingInPub) _vm->_scrolls->displayText("You're already sitting!"); else { - _vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down. + _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5f89ccb22474..8ece6b1f40a9 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -268,7 +268,7 @@ int8 AnimationType::getSign(int16 val) { } void AnimationType::walkTo(byte pedNum) { - PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum - 1]; // Pascal -> C conversion: different array indexes. + PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum]; setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); _homingX = curPed->_x - _info._xLength / 2; @@ -766,7 +766,7 @@ void Animation::callSpecial(uint16 which) { if (!_vm->_gyro->_arrowTriggered) { _vm->_gyro->_arrowTriggered = true; appearPed(2, 4); // The dart starts at ped 4, and... - _sprites[1].walkTo(5); // flies to ped 5. + _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk @@ -794,7 +794,7 @@ void Animation::callSpecial(uint16 which) { _vm->_scrolls->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; - _sprites[1].walkTo(3); + _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 177; // Not here, then. @@ -831,7 +831,7 @@ void Animation::callSpecial(uint16 which) { if (!_vm->_gyro->_geidaFollows) return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. - _sprites[1].walkTo(4); // She walks to somewhere... + _sprites[1].walkTo(3); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. _vm->_gyro->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); @@ -1035,9 +1035,9 @@ void Animation::followAvalotY(byte tripnum) { void Animation::backAndForth(byte tripnum) { if (!_sprites[tripnum]._homing) { if (_sprites[tripnum]._facingDir == kDirRight) - _sprites[tripnum].walkTo(4); + _sprites[tripnum].walkTo(3); else - _sprites[tripnum].walkTo(5); + _sprites[tripnum].walkTo(4); } } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index ac27ea6cfc90..cb9e0c988625 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -463,7 +463,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_roomCount[r__outsideyours] == 1) { _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. - spr1->walkTo(5); // Walks up to greet you. + spr1->walkTo(4); // Walks up to greet you. } else { _vm->_animation->appearPed(2, 5); // Starts where he was before. spr1->_facingDir = Animation::kDirLeft; @@ -478,7 +478,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_crapulusWillTell) { spr1->init(8, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - spr1->walkTo(4); + spr1->walkTo(3); _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_crapulusWillTell = false; } @@ -523,7 +523,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_roomCount[r__brummieroad] == 1) { // First time here... _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... - spr1->walkTo(4); // ...and he walks up... + spr1->walkTo(3); // ...and he walks up... } else { // You've been here before. _vm->_animation->appearPed(2, 4); // He's standing in your way straight away... @@ -538,7 +538,7 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->appearPed(2, 1); - spr1->walkTo(2); + spr1->walkTo(1); spr1->_vanishIfStill = true; _vm->_gyro->_passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? @@ -563,7 +563,7 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(6, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - spr1->walkTo(3); + spr1->walkTo(2); _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } } @@ -588,7 +588,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case 0 : // You've answered NONE of his questions. spr1->init(9, false, _vm->_animation); _vm->_animation->appearPed(2, 2); - spr1->walkTo(3); + spr1->walkTo(2); _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); break; case 5 : @@ -727,7 +727,7 @@ void Lucerna::enterRoom(byte room, byte ped) { spr1->init(11, false, _vm->_animation); if ((_vm->_gyro->_roomCount[r__wisewomans] == 1) && (ped > 0)) { _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. - spr1->walkTo(4); // Walks up to greet you. + spr1->walkTo(3); // Walks up to greet you. } else { _vm->_animation->appearPed(2, 4); // Starts where she was before. spr1->_facingDir = Animation::kDirLeft; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 6e1bb0b49266..0390ecaa9822 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1055,7 +1055,7 @@ void Scrolls::talkTo(byte whom) { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; - spr->walkTo(3); // Walks away. + spr->walkTo(2); // Walks away. _vm->_lucerna->incScore(2); } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index efe5bf30b764..2380eb5ba4bc 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -273,7 +273,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_gyro->blip(); - _vm->_animation->_sprites[0].walkTo(4); + _vm->_animation->_sprites[0].walkTo(3); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_brummieStairs = 2; _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; @@ -316,8 +316,8 @@ void Timer::getTiedUp() { } void Timer::getTiedUp2() { - _vm->_animation->_sprites[0].walkTo(4); - _vm->_animation->_sprites[1].walkTo(5); + _vm->_animation->_sprites[0].walkTo(3); + _vm->_animation->_sprites[1].walkTo(4); _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_friarWillTieYouUp = true; } @@ -330,7 +330,7 @@ void Timer::hangAround() { _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); _vm->_scrolls->displayScrollChain('q', 39); - avvy->walkTo(7); + avvy->walkTo(6); addTimer(55, kProcHangAround2, kReasonHangingAround); } @@ -338,7 +338,7 @@ void Timer::hangAround2() { _vm->_scrolls->displayScrollChain('q', 40); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; - spr->walkTo(4); + spr->walkTo(3); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; _vm->_scrolls->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); @@ -430,7 +430,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->appearPed(2, 1); // He starts at the door... - spr->walkTo(3); // He walks over to you. + spr->walkTo(2); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -443,7 +443,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon void Timer::naughtyDuke2() { AnimationType *spr = &_vm->_animation->_sprites[1]; _vm->_scrolls->displayScrollChain('q', 48); // "Ha ha, it worked again!" - spr->walkTo(1); // Walk to the door. + spr->walkTo(0); // Walk to the door. spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } @@ -587,7 +587,7 @@ void Timer::robinHoodAndGeida() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); _vm->_animation->appearPed(1, 7); - avvy->walkTo(6); + avvy->walkTo(5); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->stopWalk(); @@ -601,8 +601,8 @@ void Timer::robinHoodAndGeidaTalk() { AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *spr = &_vm->_animation->_sprites[1]; - avvy->walkTo(2); - spr->walkTo(2); + avvy->walkTo(1); + spr->walkTo(1); avvy->_vanishIfStill = true; spr->_vanishIfStill = true; From ddd7a95737c3222a786298f868234a613413b5ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 16:01:05 +0200 Subject: [PATCH 0964/1332] AVALANCHE: Convert index use from Pascal to C in appearPed() --- engines/avalanche/acci.cpp | 10 +++++----- engines/avalanche/animation.cpp | 24 ++++++++++++------------ engines/avalanche/lucerna.cpp | 26 +++++++++++++------------- engines/avalanche/timer.cpp | 10 +++++----- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 59aaa90da224..d15e6d039726 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1299,12 +1299,12 @@ void Acci::cardiffClimbing() { if (_vm->_gyro->_standingOnDais) { // Clamber up. _vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_gyro->_standingOnDais = false; - _vm->_animation->appearPed(1, 3); + _vm->_animation->appearPed(1, 2); } else { // Clamber down. if (_vm->_animation->inField(1)) { _vm->_scrolls->displayText("You clamber up onto the dais."); _vm->_gyro->_standingOnDais = true; - _vm->_animation->appearPed(1, 2); + _vm->_animation->appearPed(1, 1); } else _vm->_scrolls->displayText("Get a bit closer, Avvy."); } @@ -1325,7 +1325,7 @@ void Acci::standUp() { } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; - _vm->_animation->appearPed(1, 2); + _vm->_animation->appearPed(1, 1); _vm->_animation->_direction = Animation::kDirLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); @@ -1343,7 +1343,7 @@ void Acci::standUp() { if (_vm->_gyro->_sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. - _vm->_animation->appearPed(1, 4); // And walking away. + _vm->_animation->appearPed(1, 3); // And walking away. _vm->_gyro->_sittingInPub = false; // Really not sitting down. _vm->_gyro->_userMovesAvvy = true; // And ambulant. } else @@ -1898,7 +1898,7 @@ void Acci::doThat() { else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius - _vm->_animation->appearPed(2, 4); + _vm->_animation->appearPed(2, 3); spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 8ece6b1f40a9..024718205ab3 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -727,7 +727,7 @@ void Animation::catacombMove(byte ped) { if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. - appearPed(2, geidaPed(ped)); + appearPed(2, geidaPed(ped) - 1); _sprites[1]._callEachStepFl = true; _sprites[1]._eachStepProc = kProcGeida; } @@ -765,7 +765,7 @@ void Animation::callSpecial(uint16 which) { if (!_vm->_gyro->_arrowTriggered) { _vm->_gyro->_arrowTriggered = true; - appearPed(2, 4); // The dart starts at ped 4, and... + appearPed(2, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate @@ -853,13 +853,13 @@ void Animation::callSpecial(uint16 which) { return; switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { case 0x1: - appearPed(1, 12); + appearPed(1, 11); break; case 0x3: - appearPed(1, 11); + appearPed(1, 10); break; default: - appearPed(1, 4); + appearPed(1, 3); } dawnDelay(); break; @@ -869,7 +869,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(1); if (_vm->_gyro->_room != r__catacombs) return; - appearPed(1, 1); + appearPed(1, 0); dawnDelay(); break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. @@ -878,7 +878,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(2); if (_vm->_gyro->_room != r__catacombs) return; - appearPed(1, 2); + appearPed(1, 1); dawnDelay(); break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. @@ -887,7 +887,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(3); if (_vm->_gyro->_room != r__catacombs) return; - appearPed(1, 3); + appearPed(1, 2); dawnDelay(); break; } @@ -935,7 +935,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { _vm->_sequence->startToClose(); return; } else { - appearPed(1, 6); + appearPed(1, 5); _sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(9); @@ -1005,7 +1005,7 @@ void Animation::changeDirection(byte t, byte dir) { void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = &_sprites[sprNum - 1]; - PedType *curPed = &_vm->_gyro->_peds[pedNum - 1]; + PedType *curPed = &_vm->_gyro->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); changeDirection(sprNum - 1, curPed->_direction); } @@ -1294,7 +1294,7 @@ void Animation::hideInCupboard() { } else { _sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; - appearPed(1, 3); // Walk out of the cupboard. + appearPed(1, 2); // Walk out of the cupboard. _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); @@ -1344,7 +1344,7 @@ void Animation::flipRoom(byte room, byte ped) { _vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterRoom(room, ped); - appearPed(1, ped); + appearPed(1, ped - 1); _vm->_gyro->_enterCatacombsFromLustiesRoom = false; _oldDirection = _direction; _direction = _sprites[0]._facingDir; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index cb9e0c988625..dd0a647c44dc 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -415,7 +415,7 @@ void Lucerna::putGeidaAt(byte whichPed, byte &ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(2, whichPed); + _vm->_animation->appearPed(2, whichPed - 1); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } @@ -462,10 +462,10 @@ void Lucerna::enterRoom(byte room, byte ped) { spr1->init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_roomCount[r__outsideyours] == 1) { - _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. + _vm->_animation->appearPed(2, 3); // Start on the right-hand side of the screen. spr1->walkTo(4); // Walks up to greet you. } else { - _vm->_animation->appearPed(2, 5); // Starts where he was before. + _vm->_animation->appearPed(2, 4); // Starts where he was before. spr1->_facingDir = Animation::kDirLeft; } @@ -477,7 +477,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_crapulusWillTell) { spr1->init(8, false, _vm->_animation); - _vm->_animation->appearPed(2, 2); + _vm->_animation->appearPed(2, 1); spr1->walkTo(3); _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_crapulusWillTell = false; @@ -497,7 +497,7 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (ped > 0) { spr1->init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->appearPed(2, 2); + _vm->_animation->appearPed(2, 1); _vm->_gyro->_whereIs[1] = r__spludwicks; } @@ -522,11 +522,11 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_roomCount[r__brummieroad] == 1) { // First time here... - _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... + _vm->_animation->appearPed(2, 1); // He appears on the right of the screen... spr1->walkTo(3); // ...and he walks up... } else { // You've been here before. - _vm->_animation->appearPed(2, 4); // He's standing in your way straight away... + _vm->_animation->appearPed(2, 3); // He's standing in your way straight away... spr1->_facingDir = Animation::kDirLeft; } } @@ -537,7 +537,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[r__argentroad] > 3)) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->appearPed(2, 1); + _vm->_animation->appearPed(2, 0); spr1->walkTo(1); spr1->_vanishIfStill = true; _vm->_gyro->_passedCwytalotInHerts = true; @@ -562,7 +562,7 @@ void Lucerna::enterRoom(byte room, byte ped) { // A welcome party... or maybe not... AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(2, 2); + _vm->_animation->appearPed(2, 1); spr1->walkTo(2); _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } @@ -587,7 +587,7 @@ void Lucerna::enterRoom(byte room, byte ped) { switch (_vm->_gyro->_cardiffQuestionNum) { case 0 : // You've answered NONE of his questions. spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(2, 2); + _vm->_animation->appearPed(2, 1); spr1->walkTo(2); _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); break; @@ -596,7 +596,7 @@ void Lucerna::enterRoom(byte room, byte ped) { break; // You've answered ALL his questions. => nothing happens. default: // You've answered SOME of his questions. spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(2, 3); + _vm->_animation->appearPed(2, 2); spr1->_facingDir = Animation::kDirRight; _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } @@ -726,10 +726,10 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(11, false, _vm->_animation); if ((_vm->_gyro->_roomCount[r__wisewomans] == 1) && (ped > 0)) { - _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. + _vm->_animation->appearPed(2, 1); // Start on the right-hand side of the screen. spr1->walkTo(3); // Walks up to greet you. } else { - _vm->_animation->appearPed(2, 4); // Starts where she was before. + _vm->_animation->appearPed(2, 3); // Starts where she was before. spr1->_facingDir = Animation::kDirLeft; } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 2380eb5ba4bc..faab01c7428b 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -328,7 +328,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; - _vm->_animation->appearPed(1, 2); + _vm->_animation->appearPed(1, 1); _vm->_scrolls->displayScrollChain('q', 39); avvy->walkTo(6); addTimer(55, kProcHangAround2, kReasonHangingAround); @@ -358,7 +358,7 @@ void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. - _vm->_animation->appearPed(1, 2); + _vm->_animation->appearPed(1, 1); _vm->_gyro->_userMovesAvvy = true; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -429,7 +429,7 @@ void Timer::jacquesWakesUp() { void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(9, false, _vm->_animation); // Here comes the Duke. - _vm->_animation->appearPed(2, 1); // He starts at the door... + _vm->_animation->appearPed(2, 0); // He starts at the door... spr->walkTo(2); // He walks over to you. // Let's get the door opening. @@ -586,7 +586,7 @@ void Timer::riseUpOubliette() { void Timer::robinHoodAndGeida() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); - _vm->_animation->appearPed(1, 7); + _vm->_animation->appearPed(1, 6); avvy->walkTo(5); AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -615,7 +615,7 @@ void Timer::avalotReturns() { avvy->remove(); spr->remove(); avvy->init(0, true, _vm->_animation); - _vm->_animation->appearPed(1, 1); + _vm->_animation->appearPed(1, 0); _vm->_scrolls->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } From 83ee99a3814a33d1a9e174cf3b6379d741a516ef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 16:26:25 +0200 Subject: [PATCH 0965/1332] AVALANCHE: Convert index use from Pascal to C in putGeidaAt() --- engines/avalanche/lucerna.cpp | 18 ++++++++---------- engines/avalanche/lucerna.h | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index dd0a647c44dc..097b5da46654 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -407,15 +407,13 @@ void Lucerna::enterNewTown() { } } - - -void Lucerna::putGeidaAt(byte whichPed, byte &ped) { +void Lucerna::putGeidaAt(byte whichPed, byte ped) { if (ped == 0) return; AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(2, whichPed - 1); + _vm->_animation->appearPed(2, whichPed); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } @@ -509,7 +507,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__brummieroad: if (_vm->_gyro->_geidaFollows) - putGeidaAt(5, ped); + putGeidaAt(4, ped); if (_vm->_gyro->_cwytalotGone) { _vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__nowhere; @@ -553,7 +551,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. } if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 3, ped); // load Geida + putGeidaAt(ped + 2, ped); // load Geida break; case r__robins: @@ -672,7 +670,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); if (_vm->_gyro->_geidaFollows) { - putGeidaAt(5, ped); + putGeidaAt(4, ped); if (_vm->_gyro->_lustieIsAsleep) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); @@ -802,18 +800,18 @@ void Lucerna::enterRoom(byte room, byte ped) { break; // Ayles awake. case r__geidas: - putGeidaAt(2, ped); + putGeidaAt(1, ped); break; // load Geida case r__easthall: case r__westhall: if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 2, ped); + putGeidaAt(ped + 1, ped); break; case r__lusties: if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 6, ped); + putGeidaAt(ped + 5, ped); break; case r__nottspub: diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h index 9c1cc6ce441a..87b1931e259e 100644 --- a/engines/avalanche/lucerna.h +++ b/engines/avalanche/lucerna.h @@ -107,7 +107,7 @@ class Lucerna { void zoomOut(int16 x, int16 y); // Only used when entering the map. void enterNewTown(); void findPeople(byte room); - void putGeidaAt(byte whichPed, byte &ped); + void putGeidaAt(byte whichPed, byte ped); void guideAvvy(Common::Point cursorPos); // Will be used in dusk() and dawn(). From d70b856da90ece5cc0d1e210a9992212a5da39a6 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 16:50:12 +0200 Subject: [PATCH 0966/1332] AVALANCHE: Rename room number constans. Repair Lucerna::enterRoom(). --- engines/avalanche/acci.cpp | 66 ++++++++++---------- engines/avalanche/animation.cpp | 44 ++++++------- engines/avalanche/celer.cpp | 22 +++---- engines/avalanche/gyro.cpp | 46 +++++++------- engines/avalanche/lucerna.cpp | 106 ++++++++++++++++---------------- engines/avalanche/roomnums.h | 86 +++++++++++--------------- engines/avalanche/timer.cpp | 6 +- 7 files changed, 181 insertions(+), 195 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index a90e1f0a214f..390097a14563 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -700,16 +700,16 @@ void Acci::parse() { replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_gyro->_room == r__nottspub) + if (_vm->_gyro->_room == kRoomNottsPub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche switch (_vm->_gyro->_room) { - case r__aylesoffice: + case kRoomAylesOffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; - case r__musicroom: + case kRoomMusicRoom: replace(Common::String('\xCB'), 166); // Monk = Jacques break; default: @@ -880,7 +880,7 @@ bool Acci::isHolding() { } void Acci::openBox(bool isOpening) { - if ((_vm->_gyro->_room == r__yours) && (_thing == 54)) { + if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); @@ -993,7 +993,7 @@ void Acci::swallow() { // Eat something. } break; default: - if ((_vm->_gyro->_room == r__argentpub) || (_vm->_gyro->_room == r__nottspub)) + if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) _vm->_scrolls->displayText("Try BUYing things before you drink them!"); else _vm->_scrolls->displayText("The taste of it makes you retch!"); @@ -1036,27 +1036,27 @@ void Acci::peopleInRoom() { void Acci::lookAround() { _vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]); switch (_vm->_gyro->_room) { - case r__spludwicks: + case kRoomSpludwicks: if (_vm->_gyro->_avariciusTalk > 0) _vm->_scrolls->displayScrollChain('q', 23); else peopleInRoom(); break; - case r__robins: + case kRoomRobins: if (_vm->_gyro->_tiedUp) _vm->_scrolls->displayScrollChain('q', 38); if (_vm->_gyro->_mushroomGrowing) _vm->_scrolls->displayScrollChain('q', 55); break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: if (!_vm->_gyro->_takenPen) _vm->_scrolls->displayScrollChain('q', 49); break; - case r__lustiesroom: + case kRoomLustiesRoom: if (_vm->_gyro->_lustieIsAsleep) _vm->_scrolls->displayScrollChain('q', 65); break; - case r__catacombs: + case kRoomCatacombs: switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : _vm->_scrolls->displayScrollChain('q', 80); // Inside art gallery. @@ -1077,7 +1077,7 @@ void Acci::lookAround() { void Acci::openDoor() { // Special cases. switch (_vm->_gyro->_room) { - case r__yours: + case kRoomYours: if (_vm->_animation->inField(2)) { // Opening the box. _thing = 54; // The box. @@ -1086,7 +1086,7 @@ void Acci::openDoor() { return; } break; - case r__spludwicks: + case kRoomSpludwicks: if (_thing == 61) { _vm->_scrolls->displayScrollChain('q', 85); return; @@ -1094,7 +1094,7 @@ void Acci::openDoor() { break; } - if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != r__lusties)) + if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. for (byte i = 0; i < 7; i++) { @@ -1124,7 +1124,7 @@ void Acci::openDoor() { } } - if (_vm->_gyro->_room == r__map) + if (_vm->_gyro->_room == kRoomMap) _vm->_scrolls->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else @@ -1169,7 +1169,7 @@ void Acci::putProc() { break; case 54: - if (_vm->_gyro->_room == r__yours) { // Put something into the box. + if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. if (_vm->_gyro->_boxContent != kNothing) _vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first."); else { @@ -1316,7 +1316,7 @@ void Acci::already() { void Acci::standUp() { switch (_vm->_gyro->_room) { - case r__yours: // Avvy isn't asleep. + case kRoomYours: // Avvy isn't asleep. if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. if (_vm->_gyro->_teetotal) { _vm->_scrolls->displayScrollChain('d', 12); @@ -1335,11 +1335,11 @@ void Acci::standUp() { already(); break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: cardiffClimbing(); break; - case r__nottspub: + case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. @@ -1356,7 +1356,7 @@ void Acci::standUp() { void Acci::getProc(char thing) { switch (_vm->_gyro->_room) { - case r__yours: + case kRoomYours: if (_vm->_animation->inField(2)) { if (_vm->_gyro->_boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); @@ -1372,7 +1372,7 @@ void Acci::getProc(char thing) { } else _vm->_scrolls->displayScrollChain('q', 57); break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: switch (thing) { case Gyro::kObjectPen: if (_vm->_animation->inField(2)) { // Standing on the dais. @@ -1399,7 +1399,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayScrollChain('q', 57); } break; - case r__robins: + case kRoomRobins: if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->displayText("Got it!"); @@ -1421,7 +1421,7 @@ void Acci::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Acci::giveGeidaTheLute() { - if (_vm->_gyro->_room != r__lustiesroom) { + if (_vm->_gyro->_room != kRoomLustiesRoom) { Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); return; @@ -1779,7 +1779,7 @@ void Acci::doThat() { case kVerbCodePlay: if (_thing == kPardon) { switch (_vm->_gyro->_room) { // They just typed "play"... - case r__argentpub: { // ...in the pub, => play Nim. + case kRoomArgentPub: { // ...in the pub, => play Nim. warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). @@ -1814,7 +1814,7 @@ void Acci::doThat() { + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); } break; - case r__musicroom: + case kRoomMusicRoom: playHarp(); break; } @@ -1830,13 +1830,13 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('U', 15); break; case 52: - if (_vm->_gyro->_room == r__musicroom) + if (_vm->_gyro->_room == kRoomMusicRoom) playHarp(); else _vm->_scrolls->displayText(kWhat); break; case 55: - if (_vm->_gyro->_room == r__argentpub) + if (_vm->_gyro->_room == kRoomArgentPub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); else @@ -1946,7 +1946,7 @@ void Acci::doThat() { break; case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_room) { - case r__argentpub: + case kRoomArgentPub: if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar. switch (_thing) { case 51: @@ -2007,7 +2007,7 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('D', 5); // Go to the bar! break; - case r__outsideducks: + case kRoomOutsideDucks: if (_vm->_animation->inField(6)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) @@ -2034,7 +2034,7 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('D', 0); break; - case r__nottspub: + case kRoomNottsPub: _vm->_scrolls->displayScrollChain('n', 15); // Can't sell to southerners. break; default: @@ -2042,7 +2042,7 @@ void Acci::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_gyro->_room == r__brummieroad) && + if ((_vm->_gyro->_room == kRoomBrummieRoad) && ((_person == 157) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_room)) { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { @@ -2077,7 +2077,7 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('Q', 10); break; case kVerbCodePasswd: - if (_vm->_gyro->_room != r__bridge) + if (_vm->_gyro->_room != kRoomBridge) _vm->_scrolls->displayScrollChain('Q', 12); else { bool ok = true; @@ -2143,7 +2143,7 @@ void Acci::doThat() { break; case kVerbCodeClimb: - if (_vm->_gyro->_room == r__insidecardiffcastle) + if (_vm->_gyro->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); @@ -2187,7 +2187,7 @@ void Acci::doThat() { } break; case kVerbCodeSit: - if (_vm->_gyro->_room == r__nottspub) { + if (_vm->_gyro->_room == kRoomNottsPub) { if (_vm->_gyro->_sittingInPub) _vm->_scrolls->displayText("You're already sitting!"); else { diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5f89ccb22474..ab90c274ef3b 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -439,20 +439,20 @@ void Animation::catacombMove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs - flipRoom(r__lustiesroom, 4); + flipRoom(kRoomLustiesRoom, 4); _vm->_scrolls->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette - flipRoom(r__oubliette, 1); + flipRoom(kRoomOubliette, 1); Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); } return; case 4: - flipRoom(r__geidas, 1); + flipRoom(kRoomGeidas, 1); return; case 2307: - flipRoom(r__lusties, 5); + flipRoom(kRoomLusties, 5); _vm->_scrolls->displayText("Oh no... here we go again..."); _vm->_gyro->_userMovesAvvy = false; _sprites[0]._moveY = 1; @@ -849,7 +849,7 @@ void Animation::callSpecial(uint16 which) { _vm->_lucerna->dusk(); _vm->_gyro->_catacombY--; catacombMove(4); - if (_vm->_gyro->_room != r__catacombs) + if (_vm->_gyro->_room != kRoomCatacombs) return; switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { case 0x1: @@ -867,7 +867,7 @@ void Animation::callSpecial(uint16 which) { _vm->_lucerna->dusk(); _vm->_gyro->_catacombX++; catacombMove(1); - if (_vm->_gyro->_room != r__catacombs) + if (_vm->_gyro->_room != kRoomCatacombs) return; appearPed(1, 1); dawnDelay(); @@ -876,7 +876,7 @@ void Animation::callSpecial(uint16 which) { _vm->_lucerna->dusk(); _vm->_gyro->_catacombY += 1; catacombMove(2); - if (_vm->_gyro->_room != r__catacombs) + if (_vm->_gyro->_room != kRoomCatacombs) return; appearPed(1, 2); dawnDelay(); @@ -885,7 +885,7 @@ void Animation::callSpecial(uint16 which) { _vm->_lucerna->dusk(); _vm->_gyro->_catacombX--; catacombMove(3); - if (_vm->_gyro->_room != r__catacombs) + if (_vm->_gyro->_room != kRoomCatacombs) return; appearPed(1, 3); dawnDelay(); @@ -902,30 +902,30 @@ void Animation::callSpecial(uint16 which) { */ void Animation::openDoor(byte whither, byte ped, byte magicnum) { switch (_vm->_gyro->_room) { - case r__outsideyours: - case r__outsidenottspub: - case r__outsideducks: + case kRoomOutsideYours: + case kRoomOutsideNottsPub: + case kRoomOutsideDucks: _vm->_sequence->firstShow(1); _vm->_sequence->thenShow(2); _vm->_sequence->thenShow(3); break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: _vm->_sequence->firstShow(1); _vm->_sequence->thenShow(5); break; - case r__avvysgarden: - case r__entrancehall: - case r__insideabbey: - case r__yourhall: + case kRoomAvvysGarden: + case kRoomEntranceHall: + case kRoomInsideAbbey: + case kRoomYourHall: _vm->_sequence->firstShow(1); _vm->_sequence->thenShow(2); break; - case r__musicroom: - case r__outsideargentpub: + case kRoomMusicRoom: + case kRoomOutsideArgentPub: _vm->_sequence->firstShow(5); _vm->_sequence->thenShow(6); break; - case r__lusties: + case kRoomLusties: switch (magicnum) { case 14: if (_vm->_gyro->_avvysInTheCupboard) { @@ -1321,12 +1321,12 @@ void Animation::flipRoom(byte room, byte ped) { return; } - if ((room == 177) && (_vm->_gyro->_room == r__lusties)) { + if ((room == 177) && (_vm->_gyro->_room == kRoomLusties)) { hideInCupboard(); return; } - if ((_vm->_gyro->_jumpStatus > 0) && (_vm->_gyro->_room == r__insidecardiffcastle)) { + if ((_vm->_gyro->_jumpStatus > 0) && (_vm->_gyro->_room == kRoomInsideCardiffCastle)) { // You can't *jump* out of Cardiff Castle! _sprites[0]._moveX = 0; return; @@ -1340,7 +1340,7 @@ void Animation::flipRoom(byte room, byte ped) { _sprites[i].remove(); } // Deallocate sprite - if (_vm->_gyro->_room == r__lustiesroom) + if (_vm->_gyro->_room == kRoomLustiesRoom) _vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterRoom(room, ped); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index f8b2604ee097..6a86bf78c41f 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -58,23 +58,23 @@ void Celer::updateBackgroundSprites() { return; // No animation when the menus are up. switch (_vm->_gyro->_room) { - case r__outsideargentpub: + case kRoomOutsideArgentPub: if ((_vm->_gyro->_roomTime % 12) == 0) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 4); break; - case r__brummieroad: + case kRoomBrummieRoad: if ((_vm->_gyro->_roomTime % 2) == 0) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 2) % 4); break; - case r__bridge: + case kRoomBridge: if ((_vm->_gyro->_roomTime % 2) == 0) drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->_roomTime / 2) % 4); break; - case r__yours: + case kRoomYours: if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 2); break; - case r__argentpub: + case kRoomArgentPub: if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { // Malagauche cycle. _vm->_gyro->_malagauche += 1; @@ -131,7 +131,7 @@ void Celer::updateBackgroundSprites() { } } break; - case r__westhall: + case kRoomWestHall: if ((_vm->_gyro->_roomTime % 3) == 0) { switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { case 4: @@ -149,7 +149,7 @@ void Celer::updateBackgroundSprites() { } } break; - case r__lustiesroom: + case kRoomLustiesRoom: if (!(_vm->_gyro->_lustieIsAsleep)) { byte direction = 0; uint16 angle = _vm->_lucerna->bearing(2); @@ -169,7 +169,7 @@ void Celer::updateBackgroundSprites() { } } break; - case r__aylesoffice: + case kRoomAylesOffice: if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { switch ((_vm->_gyro->_roomTime / 14) % 2) { case 0: @@ -181,7 +181,7 @@ void Celer::updateBackgroundSprites() { } } break; - case r__robins: + case kRoomRobins: if (_vm->_gyro->_tiedUp) { switch (_vm->_gyro->_roomTime % 54) { case 20: @@ -193,7 +193,7 @@ void Celer::updateBackgroundSprites() { } } break; - case r__nottspub: { + case kRoomNottsPub: { // Bearing of Avvy from Port. byte direction = 0; uint16 angle = _vm->_lucerna->bearing(5); @@ -222,7 +222,7 @@ void Celer::updateBackgroundSprites() { } break; } - case r__ducks: { + case kRoomDucks: { if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 3) % 3); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 1e95c6b725c1..5cc877d99c5e 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -143,29 +143,29 @@ const TuneType Gyro::kTune = { byte Gyro::_whereIs[29] = { // The Lads - r__yours, // Avvy - r__spludwicks, // Spludwick - r__outsideyours, // Crapulus - r__ducks, // Duck - r__DucksRoom's not defined yet. - r__argentpub, // Malagauche - r__robins, // Friar Tuck. + kRoomYours, // Avvy + kRoomSpludwicks, // Spludwick + kRoomOutsideYours, // Crapulus + kRoomDucks, // Duck - r__DucksRoom's not defined yet. + kRoomArgentPub, // Malagauche + kRoomRobins, // Friar Tuck. 177, // Robin Hood - can't meet him at the start. - r__brummieroad, // Cwytalot - r__lustiesroom, // Baron du Lustie. - r__outsidecardiffcastle, // The Duke of Cardiff. - r__argentpub, // Dogfood - r__outsideducks, // Trader - r__argentpub, // Ibythneth - r__aylesoffice, // Ayles - r__nottspub, // Port - r__nottspub, // Spurge - r__musicroom, // Jacques + kRoomBrummieRoad, // Cwytalot + kRoomLustiesRoom, // Baron du Lustie. + kRoomOutsideCardiffCastle, // The Duke of Cardiff. + kRoomArgentPub, // Dogfood + kRoomOutsideDucks, // Trader + kRoomArgentPub, // Ibythneth + kRoomAylesOffice, // Ayles + kRoomNottsPub, // Port + kRoomNottsPub, // Spurge + kRoomMusicRoom, // Jacques 0, 0, 0, 0, 0, 0, 0, 0, // The Lasses - r__yours, // Arkata - r__geidas, // Geida + kRoomYours, // Arkata + kRoomGeidas, // Geida 177, // nobody allocated here! - r__wisewomans // The Wise Woman. + kRoomWiseWomans // The Wise Woman. }; Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { @@ -510,25 +510,25 @@ Common::String Gyro::getItem(byte which) { Common::String Gyro::f5Does() { switch (_room) { - case r__yours: + case kRoomYours: if (!_avvyIsAwake) return Common::String::format("%cWWake up", Acci::kVerbCodeWake); else if (_avvyInBed) return Common::String::format("%cGGet up", Acci::kVerbCodeStand); break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: if (_standingOnDais) return Common::String::format("%cCClimb down", Acci::kVerbCodeClimb); else return Common::String::format("%cCClimb up", Acci::kVerbCodeClimb); break; - case r__nottspub: + case kRoomNottsPub: if (_sittingInPub) return Common::String::format("%cSStand up", Acci::kVerbCodeStand); else return Common::String::format("%cSSit down", Acci::kVerbCodeSit); break; - case r__musicroom: + case kRoomMusicRoom: if (_vm->_animation->inField(7)) return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay); break; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index e848442c5c6b..7d1e35d28e2b 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -345,21 +345,21 @@ void Lucerna::exitRoom(byte x) { _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { - case r__spludwicks: + case kRoomSpludwicks: _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); _vm->_gyro->_avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; - case r__bridge: + case kRoomBridge: if (_vm->_gyro->_drawbridgeOpen > 0) { _vm->_gyro->_drawbridgeOpen = 4; // Fully open. _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); } break; - case r__outsidecardiffcastle: + case kRoomOutsideCardiffCastle: _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); break; - case r__robins: + case kRoomRobins: _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); break; } @@ -369,7 +369,7 @@ void Lucerna::exitRoom(byte x) { _vm->_gyro->_seeScroll = false; // Now it can work again! _vm->_gyro->_lastRoom = _vm->_gyro->_room; - if (_vm->_gyro->_room != r__map) + if (_vm->_gyro->_room != kRoomMap) _vm->_gyro->_lastRoomNotMap = _vm->_gyro->_room; } @@ -383,13 +383,13 @@ void Lucerna::enterNewTown() { _vm->_dropdown->setupMenu(); switch (_vm->_gyro->_room) { - case r__outsidenottspub: // Entry into Nottingham. - if ((_vm->_gyro->_roomCount[r__robins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) + case kRoomOutsideNottsPub: // Entry into Nottingham. + if ((_vm->_gyro->_roomCount[kRoomRobins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) _vm->_gyro->_mushroomGrowing = true; break; - case r__wisewomans: { // Entry into Argent. + case kRoomWiseWomans: { // Entry into Argent. if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[r__wisewomans] % 3) == 1); + _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[kRoomWiseWomans] % 3) == 1); _vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; } else { _vm->_gyro->_spludwickAtHome = true; @@ -401,7 +401,7 @@ void Lucerna::enterNewTown() { break; } - if (_vm->_gyro->_room != r__outsideducks) { + if (_vm->_gyro->_room != kRoomOutsideDucks) { if ((_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_onionInVinegar)) _vm->_gyro->_rottenOnion = true; // You're holding the onion } @@ -441,12 +441,12 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_roomTime = 0; - if ((_vm->_gyro->_lastRoom == r__map) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) + if ((_vm->_gyro->_lastRoom == kRoomMap) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) enterNewTown(); switch (room) { - case r__yours: + case kRoomYours: if (_vm->_gyro->_avvyInBed) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); @@ -454,14 +454,14 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__outsideyours: + case kRoomOutsideYours: if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (!_vm->_gyro->_talkedToCrapulus) { - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__outsideyours; + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomOutsideYours; spr1->init(8, false, _vm->_animation); // load Crapulus - if (_vm->_gyro->_roomCount[r__outsideyours] == 1) { + if (_vm->_gyro->_roomCount[kRoomOutsideYours] == 1) { _vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen. spr1->walkTo(5); // Walks up to greet you. } else { @@ -473,7 +473,7 @@ void Lucerna::enterRoom(byte room, byte ped) { spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. } else - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = r__nowhere; + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomNowhere; if (_vm->_gyro->_crapulusWillTell) { spr1->init(8, false, _vm->_animation); @@ -485,43 +485,43 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__outsidespludwicks: - if ((_vm->_gyro->_roomCount[r__outsidespludwicks] == 1) && (ped == 1)) { + case kRoomOutsideSpludwicks: + if ((_vm->_gyro->_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); _vm->_gyro->_spludwickAtHome = true; } break; - case r__spludwicks: + case kRoomSpludwicks: if (_vm->_gyro->_spludwickAtHome) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (ped > 0) { spr1->init(2, false, _vm->_animation); // load Spludwick _vm->_animation->appearPed(2, 2); - _vm->_gyro->_whereIs[1] = r__spludwicks; + _vm->_gyro->_whereIs[1] = kRoomSpludwicks; } spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } else - _vm->_gyro->_whereIs[1] = r__nowhere; + _vm->_gyro->_whereIs[1] = kRoomNowhere; break; - case r__brummieroad: + case kRoomBrummieRoad: if (_vm->_gyro->_geidaFollows) putGeidaAt(5, ped); if (_vm->_gyro->_cwytalotGone) { _vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__nowhere; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomNowhere; } else { if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcFollowAvvyY; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = r__brummieroad; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomBrummieRoad; - if (_vm->_gyro->_roomCount[r__brummieroad] == 1) { // First time here... + if (_vm->_gyro->_roomCount[kRoomBrummieRoad] == 1) { // First time here... _vm->_animation->appearPed(2, 2); // He appears on the right of the screen... spr1->walkTo(4); // ...and he walks up... } else { @@ -533,8 +533,8 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__argentroad: - if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[r__argentroad] > 3)) { + case kRoomArgentRoad: + if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[kRoomArgentRoad] > 3)) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again _vm->_animation->appearPed(2, 1); @@ -546,7 +546,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__bridge: + case kRoomBridge: if (_vm->_gyro->_drawbridgeOpen == 4) { // open _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge _vm->_graphics->refreshBackground(); @@ -556,7 +556,7 @@ void Lucerna::enterRoom(byte room, byte ped) { putGeidaAt(ped + 3, ped); // load Geida break; - case r__robins: + case kRoomRobins: if (ped > 0) { if (!_vm->_gyro->_beenTiedUp) { // A welcome party... or maybe not... @@ -581,7 +581,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_graphics->refreshBackground(); break; - case r__outsidecardiffcastle: + case kRoomOutsideCardiffCastle: if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; switch (_vm->_gyro->_cardiffQuestionNum) { @@ -608,12 +608,12 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_interrogation = 0; break; - case r__map: + case kRoomMap: // You're entering the map. dawn(); //setactivepage(cp); if (ped > 0) - zoomOut(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); + zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); //setactivepage(1 - cp); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { @@ -625,7 +625,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_scrolls->displayScrollChain('q', 69); break; - case r__catacombs: + case kRoomCatacombs: if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { switch (ped) { @@ -652,7 +652,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__argentpub: + case kRoomArgentPub: if (_vm->_gyro->_wonNim) _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. _vm->_gyro->_malagauche = 0; // Ready to boot Malagauche @@ -663,7 +663,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_graphics->refreshBackground(); break; - case r__lustiesroom: + case kRoomLustiesRoom: _vm->_gyro->_npcFacing = 1; // du Lustie. if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); @@ -680,7 +680,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__musicroom: + case kRoomMusicRoom: if (_vm->_gyro->_jacquesState > 0) { _vm->_gyro->_jacquesState = 5; _vm->_celer->drawBackgroundSprite(-1, -1, 2); @@ -699,7 +699,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__outsidenottspub: + case kRoomOutsideNottsPub: if (ped == 2) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); @@ -711,7 +711,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__outsideargentpub: + case kRoomOutsideArgentPub: if (ped == 2) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); @@ -722,10 +722,10 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__wisewomans: { + case kRoomWiseWomans: { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(11, false, _vm->_animation); - if ((_vm->_gyro->_roomCount[r__wisewomans] == 1) && (ped > 0)) { + if ((_vm->_gyro->_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { _vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen. spr1->walkTo(4); // Walks up to greet you. } else { @@ -738,7 +738,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__insidecardiffcastle: + case kRoomInsideCardiffCastle: if (ped > 0) { _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -763,7 +763,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__avvysgarden: + case kRoomAvvysGarden: if (ped == 1) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); @@ -774,9 +774,9 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__entrancehall: - case r__insideabbey: - case r__yourhall: + case kRoomEntranceHall: + case kRoomInsideAbbey: + case kRoomYourHall: if (ped == 2) { #if 0 // It was the original: @@ -795,34 +795,34 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__aylesoffice: + case kRoomAylesOffice: if (_vm->_gyro->_aylesIsAwake) _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; // Ayles awake. - case r__geidas: + case kRoomGeidas: putGeidaAt(2, ped); break; // load Geida - case r__easthall: - case r__westhall: + case kRoomEastHall: + case kRoomWestHall: if (_vm->_gyro->_geidaFollows) putGeidaAt(ped + 2, ped); break; - case r__lusties: + case kRoomLusties: if (_vm->_gyro->_geidaFollows) putGeidaAt(ped + 6, ped); break; - case r__nottspub: + case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_npcFacing = 1; // Port. break; - case r__outsideducks: + case kRoomOutsideDucks: if (ped == 2) { // Shut the door _vm->_celer->drawBackgroundSprite(-1, -1, 3); @@ -835,7 +835,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } break; - case r__ducks: + case kRoomDucks: _vm->_gyro->_npcFacing = 1; // Duck. break; } diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index e623c27a20ce..c87fc4c2d2fe 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -32,56 +32,42 @@ namespace Avalanche { -const byte r__nowhere = 0; -const byte r__yours = 1; -const byte r__outsideyours = 2; -const byte r__outsidespludwicks = 3; -const byte r__yourhall = 5; -const byte r__musicroom = 7; -const byte r__outsideargentpub = 9; -const byte r__argentroad = 10; -const byte r__wisewomans = 11; -const byte r__spludwicks = 12; -const byte r__insideabbey = 13; -const byte r__outsideabbey = 14; // assumed -const byte r__avvysgarden = 15; -const byte r__aylesoffice = 16; -const byte r__argentpub = 19; -const byte r__brummieroad = 20; -const byte r__bridge = 21; // ? not sure -const byte r__lusties = 22; -const byte r__lustiesroom = 23; -const byte r__westhall = 25; -const byte r__easthall = 26; -const byte r__oubliette = 27; -const byte r__geidas = 28; -const byte r__catacombs = 29; - -//{ -------------- } - -const byte r__entrancehall = 40; -const byte r__robins = 42; -const byte r__outsidenottspub = 46; -const byte r__nottspub = 47; - -//{ -------------- } - -const byte r__outsideducks = 50; -const byte r__ducks = 51; - -//{ -------------- } - -const byte r__outsidecardiffcastle = 70; -const byte r__insidecardiffcastle = 71; - -//{ -------------- } - -// place80 appears to be bogus - -//{ -------------- } - -const byte r__bosskey = 98; // assumed -const byte r__map = 99; +enum Room { + kRoomNowhere = 0, + kRoomYours = 1, + kRoomOutsideYours = 2, + kRoomOutsideSpludwicks = 3, + kRoomYourHall = 5, + kRoomMusicRoom = 7, + kRoomOutsideArgentPub = 9, + kRoomArgentRoad = 10, + kRoomWiseWomans = 11, + kRoomSpludwicks = 12, + kRoomInsideAbbey = 13, + kRoomOutsideAbbey = 14, + kRoomAvvysGarden = 15, + kRoomAylesOffice = 16, + kRoomArgentPub = 19, + kRoomBrummieRoad = 20, + kRoomBridge = 21, + kRoomLusties = 22, + kRoomLustiesRoom = 23, + kRoomWestHall = 25, + kRoomEastHall = 26, + kRoomOubliette = 27, + kRoomGeidas = 28, + kRoomCatacombs = 29, + kRoomEntranceHall = 40, + kRoomRobins = 42, + kRoomOutsideNottsPub = 46, + kRoomNottsPub = 47, + kRoomOutsideDucks = 50, + kRoomDucks = 51, + kRoomOutsideCardiffCastle = 70, + kRoomInsideCardiffCastle = 71, + kRoomBossKey = 98, // assumed + kRoomMap = 99 +}; } // End of namespace Avalanche diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index efe5bf30b764..8cc21fd86aea 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -327,7 +327,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; + _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; _vm->_animation->appearPed(1, 2); _vm->_scrolls->displayScrollChain('q', 39); avvy->walkTo(7); @@ -339,7 +339,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(4); - _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; + _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; _vm->_scrolls->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -485,7 +485,7 @@ void Timer::jump() { } if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. - && (_vm->_gyro->_room == r__insidecardiffcastle) + && (_vm->_gyro->_room == kRoomInsideCardiffCastle) && (_vm->_gyro->_arrowInTheDoor == true) && (_vm->_animation->inField(3))) { // Beside the wall // Grab the arrow! From eaf6ecb7cdf3e372f143a4d9e7c89e89df508862 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 17:17:40 +0200 Subject: [PATCH 0967/1332] AVALANCHE: Fix indexes used by kQuasipeds (Pascal -> C) --- engines/avalanche/gyro.cpp | 33 +++++++++++++++++---------------- engines/avalanche/scrolls.cpp | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 5cc877d99c5e..defa9f9e0c39 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -113,22 +113,23 @@ const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroo // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Gyro::kQuasipeds[16] = { - {2, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). - {3, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). - {3, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {3, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). - {3, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). - {6, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) - {2, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). - {2, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). - {2, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). - {3, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). - {2, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). - {2, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {3, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). - {4, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). - {5, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). - {2, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). +// _whichPed, _foregroundColor, _room, _backgroundColor, _who + {1, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {2, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {2, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). + {2, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). + {2, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {5, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {1, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {1, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {1, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {2, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {1, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {1, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). + {2, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). + {3, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). + {4, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). + {1, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 0390ecaa9822..3ecec3c83b1f 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -678,7 +678,7 @@ void Scrolls::callScrollDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]; + PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; _vm->_gyro->_talkX = quasiPed->_x; _vm->_gyro->_talkY = quasiPed->_y; // Position. From ac49e6d09bb6bdc2ecb46178eef74170121d7851 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 17:29:12 +0200 Subject: [PATCH 0968/1332] AVALANCHE: Get rid of a magic value in kQuasipeds initialization --- engines/avalanche/gyro.cpp | 4 ++-- engines/avalanche/gyro.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index defa9f9e0c39..539f1430b3b7 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -117,7 +117,7 @@ const QuasipedType Gyro::kQuasipeds[16] = { {1, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). {2, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). {2, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {2, kColorBlack, 23, kColorRed, 177}, // D: Hawk (screen 23). + {2, kColorBlack, 23, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). {2, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). {5, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) {1, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). @@ -126,7 +126,7 @@ const QuasipedType Gyro::kQuasipeds[16] = { {2, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). {1, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). {1, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {2, kColorWhite, 27, kColorRed, 177}, // M: Avaroid (screen 27). + {2, kColorWhite, 27, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). {3, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). {4, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). {1, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 0f8b9aea5d97..7785f4fe3a52 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -181,6 +181,7 @@ class Gyro { // Girls: kPeopleArkata = 175, kPeopleGeida = 176, + kPeopleInvisible = 177, kPeopleWisewoman = 178 }; From 34acc80d7329352ecc55c36091877a2c3e8ec307 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 17:42:32 +0200 Subject: [PATCH 0969/1332] AVALANCHE: Get rid of several magic values --- engines/avalanche/acci.cpp | 6 +++--- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/gyro.cpp | 4 ++-- engines/avalanche/lucerna.cpp | 4 ++-- engines/avalanche/roomnums.h | 3 ++- engines/avalanche/scrolls.cpp | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3c3357ed1367..dc8ebc212f35 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1893,7 +1893,7 @@ void Acci::doThat() { else { if ((_vm->_gyro->_room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! _vm->_scrolls->displayScrollChain('q', 17); - if (_vm->_gyro->_whereIs[1] == 12) + if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) _vm->_scrolls->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2044,7 +2044,7 @@ void Acci::doThat() { case kVerbCodeAttack: if ((_vm->_gyro->_room == kRoomBrummieRoad) && ((_person == 157) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - && (_vm->_gyro->_whereIs[7] == _vm->_gyro->_room)) { + && (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: @@ -2068,7 +2068,7 @@ void Acci::doThat() { _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_gyro->_whereIs[7] = 177; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; break; default: _vm->_scrolls->displayScrollChain('Q', 10); // Please try not to be so violent! diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index eaf74fa124ad..833aa5cc31aa 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -797,7 +797,7 @@ void Animation::callSpecial(uint16 which) { _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 177; // Not here, then. + _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index c6f74f80f08c..24e5f56dd1e1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -441,7 +441,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _celer->forgetBackgroundSprites(); _lucerna->minorRedraw(); _dropdown->setupMenu(); - _gyro->_whereIs[0] = _gyro->_room; + _gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; _gyro->_alive = true; _lucerna->refreshObjectList(); _animation->updateSpeed(); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 539f1430b3b7..d6ea248d7877 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -150,7 +150,7 @@ byte Gyro::_whereIs[29] = { kRoomDucks, // Duck - r__DucksRoom's not defined yet. kRoomArgentPub, // Malagauche kRoomRobins, // Friar Tuck. - 177, // Robin Hood - can't meet him at the start. + kRoomDummy, // Robin Hood - can't meet him at the start. kRoomBrummieRoad, // Cwytalot kRoomLustiesRoom, // Baron du Lustie. kRoomOutsideCardiffCastle, // The Duke of Cardiff. @@ -165,7 +165,7 @@ byte Gyro::_whereIs[29] = { // The Lasses kRoomYours, // Arkata kRoomGeidas, // Geida - 177, // nobody allocated here! + kRoomDummy, // nobody allocated here! kRoomWiseWomans // The Wise Woman. }; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index c735346f9db9..65e1478e182f 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -496,13 +496,13 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { spr1->init(2, false, _vm->_animation); // load Spludwick _vm->_animation->appearPed(2, 1); - _vm->_gyro->_whereIs[1] = kRoomSpludwicks; + _vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomSpludwicks; } spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } else - _vm->_gyro->_whereIs[1] = kRoomNowhere; + _vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomNowhere; break; case kRoomBrummieRoad: diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index c87fc4c2d2fe..a963468db2fa 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -66,7 +66,8 @@ enum Room { kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, kRoomBossKey = 98, // assumed - kRoomMap = 99 + kRoomMap = 99, + kRoomDummy = 177 // Dummy room }; } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 3ecec3c83b1f..87fdb0b76838 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -1051,7 +1051,7 @@ void Scrolls::talkTo(byte whom) { _vm->_lucerna->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. _vm->_gyro->_talkedToCrapulus = true; - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = 177; // Crapulus walks off. + _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; From 982e8c652383c18cf5ef801b8f185cb1ae875f10 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 17:49:22 +0200 Subject: [PATCH 0970/1332] AVALANCHE: Remove hardcoded room number from the initialization of kQuadipeds --- engines/avalanche/gyro.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index d6ea248d7877..0b50b2d0bd5c 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -113,23 +113,23 @@ const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroo // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Gyro::kQuasipeds[16] = { -// _whichPed, _foregroundColor, _room, _backgroundColor, _who - {1, kColorLightgray, 19, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). - {2, kColorGreen, 19, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). - {2, kColorWhite, 1, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {2, kColorBlack, 23, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). - {2, kColorLightgreen, 50, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). - {5, kColorYellow, 42, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) - {1, kColorBlue, 16, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). - {1, kColorBrown, 7, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). - {1, kColorLightgreen, 47, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). - {2, kColorYellow, 47, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). - {1, kColorLightgray, 23, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). - {1, kColorYellow, 27, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {2, kColorWhite, 27, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). - {3, kColorLightgray, 19, kColorDarkgray, kPeopleMalagauche}, // N: Malagauche (screen 19). - {4, kColorLightmagenta, 47, kColorRed, kPeoplePort}, // O: Port (screen 47). - {1, kColorLightgreen, 51, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). +//_whichPed, _foregroundColor, _room, _backgroundColor, _who + {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). + {2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). + {2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). + {2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). + {3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19). + {4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47). + {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; From 18a992856ed50cac71233166aa25d239c5a45c27 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 18:16:46 +0200 Subject: [PATCH 0971/1332] AVALANCHE: Get rid of some more magic values --- engines/avalanche/acci.cpp | 12 ++++++------ engines/avalanche/animation.cpp | 2 +- engines/avalanche/dropdown.cpp | 8 ++++---- engines/avalanche/gyro.cpp | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index dc8ebc212f35..56ac2e9e43cc 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -782,7 +782,7 @@ void Acci::parse() { _vm->_gyro->_it = _thing; if (_person != kPardon) { - if (_person < 175) + if (_person < Gyro::kPeopleArkata) _vm->_gyro->_him = _person; else _vm->_gyro->_her = _person; @@ -822,7 +822,7 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". return true; else { Common::String tmpStr; - if (_person < 175) + if (_person < Gyro::kPeopleArkata) tmpStr = "He isn't around at the moment."; else tmpStr = "She isn't around at the moment."; @@ -1891,7 +1891,7 @@ void Acci::doThat() { if (_vm->_gyro->_avariciusTalk > 0) _vm->_scrolls->displayScrollChain('q', 19); else { - if ((_vm->_gyro->_room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears! + if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(2))) { // Avaricius appears! _vm->_scrolls->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) _vm->_scrolls->displayScrollChain('q', 18); @@ -2043,8 +2043,8 @@ void Acci::doThat() { break; case kVerbCodeAttack: if ((_vm->_gyro->_room == kRoomBrummieRoad) && - ((_person == 157) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - && (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { + ((_person == Gyro::kPeopleCwytalot) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && + (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: @@ -2138,7 +2138,7 @@ void Acci::doThat() { default: _vm->_scrolls->displayScrollChain('U', 5); // You WHAT? } - } else if ((150 <= _person) && (_person <= 174)) + } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); break; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 833aa5cc31aa..b476fe9d055a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1321,7 +1321,7 @@ void Animation::flipRoom(byte room, byte ped) { return; } - if ((room == 177) && (_vm->_gyro->_room == kRoomLusties)) { + if ((room == kRoomDummy) && (_vm->_gyro->_room == kRoomLusties)) { hideInCupboard(); return; } diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 5efa63e59130..86c4a1d2b935 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -447,7 +447,7 @@ void Dropdown::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_gyro->_room == 99) + if (_vm->_gyro->_room == kRoomMap) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); @@ -470,7 +470,7 @@ void Dropdown::setupMenuPeople() { for (byte i = 150; i <= 178; i++) if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); - people = people + i; + people += i; } _activeMenuItem.display(); @@ -653,7 +653,7 @@ void Dropdown::runMenuWith() { if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive) _vm->_acci->_person = _vm->_gyro->_lastPerson; else - _vm->_acci->_person = 254; + _vm->_acci->_person = Acci::kPardon; } else { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { @@ -695,7 +695,7 @@ void Dropdown::runMenuWith() { break; default: { _vm->_acci->_person = _vm->_acci->_thing; - _vm->_acci->_thing = 254; + _vm->_acci->_thing = Acci::kPardon; _vm->_gyro->_subjectNum = 0; } } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 0b50b2d0bd5c..7866100e38a1 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -234,7 +234,7 @@ void Gyro::resetVariables() { _dnascore = 0; _money = 0; - _room = 0; + _room = kRoomNowhere; _wearing = 0; _sworeNum = 0; _saveNum = 0; @@ -343,10 +343,10 @@ void Gyro::newGame() { avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } - _him = 254; - _her = 254; - _it = 254; - _lastPerson = 254; // = Pardon? + _him = Acci::kPardon; + _her = Acci::kPardon; + _it = Acci::kPardon; + _lastPerson = Acci::kPardon; // = Pardon? _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; From ca596423809fff56b7e48148572df18967a012c1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 18:27:40 +0200 Subject: [PATCH 0972/1332] AVALANCHE: for consistency, replace fv and ff loop variables by i and j. Remove some commented dead code --- engines/avalanche/animation.cpp | 17 +++++------------ engines/avalanche/gyro.cpp | 6 +++--- engines/avalanche/lucerna.cpp | 10 +++++----- engines/avalanche/scrolls.cpp | 4 ++-- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index b476fe9d055a..e15ecfaab7c9 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -95,14 +95,10 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _info._xWidth++; for (byte i = 0; i < _stat._frameNum; i++) { _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; - //getmem(sil[totalnum-1], 11 * (a.yl + 1)); _info._mani[_animCount] = new ManiType[_info._size - 6]; - //getmem(mani[totalnum-1], a.size - 6); for (byte j = 0; j <= _info._yLength; j++) inf.read((*_info._sil[_animCount])[j], _info._xWidth); - //blockread(inf, (*sil[totalnum-1])[fv], xw); inf.read(*_info._mani[_animCount], _info._size - 6); - //blockread(inf, *mani[totalnum-1], a.size - 6); _animCount++; } @@ -427,7 +423,6 @@ byte Animation::geidaPed(byte which) { void Animation::catacombMove(byte ped) { int32 here; uint16 xy_uint16; - byte fv; // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. @@ -703,14 +698,14 @@ void Animation::catacombMove(byte ped) { _vm->_celer->drawBackgroundSprite(-1, -1, 2); break; // [5,7] : "Ite Mingite" sign. case 258: - for (fv = 0; fv <= 2; fv++) { // [2,1] : Art gallery - pictures - _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); - _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); + for (int i = 0; i <= 2; i++) { // [2,1] : Art gallery - pictures + _vm->_celer->drawBackgroundSprite(130 + i * 120, 70, 15); + _vm->_celer->drawBackgroundSprite(184 + i * 120, 78, 16); } break; case 1287: - for (fv = 10; fv <= 13; fv++) - _vm->_celer->drawBackgroundSprite(-1, -1, fv); + for (int i = 10; i <= 13; i++) + _vm->_celer->drawBackgroundSprite(-1, -1, i); break; // [7,5] : 4 candles. case 776: _vm->_celer->drawBackgroundSprite(-1, -1, 10); @@ -733,8 +728,6 @@ void Animation::catacombMove(byte ped) { } } - - // This proc gets called whenever you touch a line defined as _vm->_gyro->special. void Animation::dawnDelay() { _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 7866100e38a1..398a7a710a52 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -173,9 +173,9 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { _vm = vm; // Needed because of Lucerna::load_also() - for (int fv = 0; fv < 31; fv++) { - for (int ff = 0; ff < 2; ff++) - _also[fv][ff] = 0; + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) + _also[i][j] = 0; } _totalTime = 0; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 65e1478e182f..c8c76d45535b 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -935,9 +935,9 @@ void Lucerna::drawScore() { CursorMan.showMouse(false); - for (byte fv = 0; fv < 3; fv++) { - if (_vm->_gyro->_scoreToDisplay[fv] != numbers[fv]) - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[fv]], 250 + (fv + 1) * 15, 177); + for (byte i = 0; i < 3; i++) { + if (_vm->_gyro->_scoreToDisplay[i] != numbers[i]) + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[i]], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); @@ -947,12 +947,12 @@ void Lucerna::drawScore() { } void Lucerna::incScore(byte num) { // Add on no. of points - for (byte q = 1; q <= num; q++) { + for (byte i = 1; i <= num; i++) { _vm->_gyro->_dnascore++; #if 0 if (soundfx) { - for (byte fv = 1; fv <= 97; fv++) + for (byte j = 1; j <= 97; j++) sound(177 + dna.score * 3); } nosound; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 87fdb0b76838..26aea4bd3750 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -290,13 +290,13 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { #if 0 uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); byte bit; - for (uint16 fv = 1; fv <= yl; fv++) + for (uint16 i = 1; i <= yl; i++) for (bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (fv * 80)], xl); + blockread(f, mem[0xa000 * st + (i * 80)], xl); } bit = getpixel(0, 0); #endif From b3c1a64aa1884066f683ea5acf683564bddee3e6 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 18:37:14 +0200 Subject: [PATCH 0973/1332] AVALANCHE: Fix multiple bugs. --- engines/avalanche/celer.cpp | 1 - engines/avalanche/dropdown.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index e3aafdbba6d0..3d7803465f46 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -259,7 +259,6 @@ void Celer::updateBackgroundSprites() { break; case 2: //nosound(); - updateBackgroundSprites(); break; } } diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 86c4a1d2b935..4c5afe573123 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -338,7 +338,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, _vm->_graphics->drawText(_vm->_graphics->_surface, text, font, 8, x * 8, y, fontColor); // Underline the selected character. - if (!text.contains(trigger)) + if ((trigger == 0) || !text.contains(trigger) ) return; else { byte i; From 5de5c3900db34b884b5d3a91eb02f0b4db02a962 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 18:53:09 +0200 Subject: [PATCH 0974/1332] AVALANCHE: Repair Acci::exampers(). --- engines/avalanche/acci.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 56ac2e9e43cc..8747b7e57bd9 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -843,7 +843,7 @@ void Acci::exampers() { return; } break; - case 99: + case 9: if (_vm->_gyro->_lustieIsAsleep) { _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) return; @@ -852,11 +852,10 @@ void Acci::exampers() { } // Otherwise... _vm->_scrolls->displayScrollChain('p', _person); + // And afterwards... + if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) + _vm->_scrolls->displayScrollChain('Q', 13); } - - // And afterwards... - if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) - _vm->_scrolls->displayScrollChain('Q', 13); } /** From 45dc123b8417ce85edab4de8b7e1050e51bc8661 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 19:19:38 +0200 Subject: [PATCH 0975/1332] AVALANCHE: Rework exampers() --- engines/avalanche/acci.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 8747b7e57bd9..5436090dfb38 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -835,26 +835,25 @@ void Acci::exampers() { if (isPersonHere()) { if (_thing != _vm->_gyro->_thinks) _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); - _person -= 149; + byte newPerson = _person - 149; switch (_person) { // Special cases - case 11: - if (_vm->_gyro->_wonNim) { + case Gyro::kPeopleDogfood: + if (_vm->_gyro->_wonNim) _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" - return; - } break; - case 9: - if (_vm->_gyro->_lustieIsAsleep) { + case Gyro::kPeopleDuLustie: + if (_vm->_gyro->_lustieIsAsleep) _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) - return; - } break; + case Gyro::kPeopleAyles: + _vm->_scrolls->displayScrollChain('p', newPerson); + if (!_vm->_gyro->_aylesIsAwake) + _vm->_scrolls->displayScrollChain('Q', 13); + break; + default: + _vm->_scrolls->displayScrollChain('p', newPerson); } - // Otherwise... - _vm->_scrolls->displayScrollChain('p', _person); - // And afterwards... - if ((_person == 14) && (!_vm->_gyro->_aylesIsAwake)) - _vm->_scrolls->displayScrollChain('Q', 13); + _person = newPerson; } } From c877ddf4113cbfb4304ba53685713ad207b80069 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Sep 2013 20:12:30 +0200 Subject: [PATCH 0976/1332] AVALANCHE: Rework Acci:exampers(). --- engines/avalanche/acci.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 5436090dfb38..dc794359b32b 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -835,24 +835,19 @@ void Acci::exampers() { if (isPersonHere()) { if (_thing != _vm->_gyro->_thinks) _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); + byte newPerson = _person - 149; - switch (_person) { // Special cases - case Gyro::kPeopleDogfood: - if (_vm->_gyro->_wonNim) - _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" - break; - case Gyro::kPeopleDuLustie: - if (_vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) - break; - case Gyro::kPeopleAyles: - _vm->_scrolls->displayScrollChain('p', newPerson); - if (!_vm->_gyro->_aylesIsAwake) - _vm->_scrolls->displayScrollChain('Q', 13); - break; - default: + + if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) + _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" + else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) + _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) + else _vm->_scrolls->displayScrollChain('p', newPerson); - } + + if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) + _vm->_scrolls->displayScrollChain('Q', 13); + _person = newPerson; } } From d643ca1571eef1f81b5880fcb796f1ee268ef234 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:04:58 -0500 Subject: [PATCH 0977/1332] ZVISION: Remove unused Console functions --- engines/zvision/console.cpp | 39 ------------------------------------- engines/zvision/console.h | 3 --- 2 files changed, 42 deletions(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 8b4dffa98a08..4ea4a8e96318 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -51,9 +51,6 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); - DCmd_Register("dumpcursorfilenames", WRAP_METHOD(Console, cmdDumpAllCursorFileNames)); - DCmd_Register("showcursor", WRAP_METHOD(Console, cmdShowCursor)); - DCmd_Register("dumpalllevfiles", WRAP_METHOD(Console, cmdDumpAllLevFiles)); DCmd_Register("parseallscrfiles", WRAP_METHOD(Console, cmdParseAllScrFiles)); } @@ -190,42 +187,6 @@ bool Console::cmdDumpFile(int argc, const char **argv) { return true; } -bool Console::cmdDumpAllCursorFileNames(int argc, const char **argv) { - Common::DumpFile outputFile; - outputFile.open("cursorFileNames.txt"); - - Common::ArchiveMemberList list; - SearchMan.listMatchingMembers(list, "*.zcr"); - - // Register the file entries within the zfs archives with the SearchMan - for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { - outputFile.writeString((*iter)->getName()); - outputFile.writeByte('\n'); - } - - return true; -} - -bool Console::cmdShowCursor(int argc, const char **argv) { - ZorkCursor cursor(argv[1]); - - _engine->_system->copyRectToScreen(cursor.getSurface(), cursor.getWidth() * 2, 0, 0, cursor.getWidth(), cursor.getHeight()); - - return true; -} - -bool Console::cmdDumpAllLevFiles(int argc, const char **argv) { - Common::ArchiveMemberList list; - SearchMan.listMatchingMembers(list, "*.lev"); - - for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { - Common::String fileName = (*iter)->getName(); - writeFileContentsToFile(fileName, fileName); - } - - return true; -} - bool Console::cmdParseAllScrFiles(int argc, const char **argv) { Common::ArchiveMemberList list; SearchMan.listMatchingMembers(list, "*.scr"); diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 612e5eec00a1..fdb20642e96c 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -47,9 +47,6 @@ class Console : public GUI::Debugger { bool cmdSetPanoramaScale(int argc, const char **argv); bool cmdChangeLocation(int argc, const char **argv); bool cmdDumpFile(int argc, const char **argv); - bool cmdDumpAllCursorFileNames(int argc, const char **argv); - bool cmdShowCursor(int argc, const char **argv); - bool cmdDumpAllLevFiles(int argc, const char **argv); bool cmdParseAllScrFiles(int argc, const char **argv); }; From c20a9ac6ae3cac5ff45d5d2329ff8571d507b01f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:05:25 -0500 Subject: [PATCH 0978/1332] ZVISION: Add key press support to Controls --- engines/zvision/control.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 9144c32dd421..baa2dfb4f369 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -25,6 +25,8 @@ #include "common/types.h" +#include "common/keyboard.h" + namespace Common { class SeekableReadStream; @@ -68,6 +70,18 @@ class Control { * @return Was the cursor changed? */ virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { return false; } + /** + * Called when a key is pressed. Default is NOP. + * + * @param keycode The key that was pressed + */ + virtual void onKeyDown(Common::KeyState keyState) {} + /** + * Called when a key is released. Default is NOP. + * + * @param keycode The key that was pressed + */ + virtual void onKeyUp(Common::KeyState keyState) {} /** * Processes the node given the deltaTime since last frame. Default is NOP. * From d3b6caab2f122f05bc5ecae49bcce1c285cb09de Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:07:02 -0500 Subject: [PATCH 0979/1332] ZVISION: Remove unused key functions --- engines/zvision/events.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 9283328202b1..ae84a22d398c 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -67,15 +67,6 @@ void ZVision::processEvents() { if (_event.kbd.hasFlags(Common::KBD_CTRL)) quitGame(); break; - case Common::KEYCODE_F1: - cycleThroughCursors(); - break; - case Common::KEYCODE_F2: - { - RlfAnimation *animation = new RlfAnimation("te2ea21c.rlf"); - playAnimation(animation, 0, 0); - break; - } default: break; } From 752807b4710ae7ff5c96f3ced985a56da0227d7c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:07:46 -0500 Subject: [PATCH 0980/1332] ZVISION: Add method to copy a portion of the working window to a surface --- engines/zvision/render_manager.cpp | 14 ++++++++++++++ engines/zvision/render_manager.h | 1 + 2 files changed, 15 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 04163fab6128..38807a745756 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -311,6 +311,20 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i sourceOffset += imageWidth; } +void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const { + uint32 destOffset = 0; + uint32 sourceOffset = 0; + uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(subRect.left, subRect.top); + uint16 *destPtr = (uint16 *)destSurface->getBasePtr(destX, destY); + + for (int32 y = 0; y < subRect.height(); y++) { + for (int32 x = 0; x < subRect.width(); x++) { + destPtr[destOffset + x] = workingWindowBufferPtr[sourceOffset + x]; + } + + destOffset += destSurface->w; + sourceOffset += _workingWidth; + } _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 51636ef682e7..ce5c77491767 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -194,6 +194,7 @@ class RenderManager { RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); const Graphics::Surface *getBackBuffer() { return &_backBuffer; } + void copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const; /** * Creates a copy of surface and transposes the data. From b50afa2b154c412c40b534a41e9654da8786f5e6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:08:14 -0500 Subject: [PATCH 0981/1332] ZVISION: Remove unused function --- engines/zvision/zvision.cpp | 55 ------------------------------------- engines/zvision/zvision.h | 10 ++----- 2 files changed, 3 insertions(+), 62 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index f8580703caf3..09f5ea30b152 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -175,59 +175,4 @@ Common::String ZVision::generateAutoSaveFileName() { return Common::String::format("%s.auto", _targetName.c_str()); } -void ZVision::cycleThroughCursors() { - Common::ArchiveMemberList list; - SearchMan.listMatchingMembers(list, "*.zcr"); - - Common::ArchiveMemberList::iterator iter = list.begin(); - ZorkCursor cursor; - bool cursorChanged = false; - - _system->showMouse(true); - - bool done = false; - while (!done && !shouldQuit()) { - _clock.update(); - uint32 currentTime = _clock.getLastMeasuredTime(); - - while (_eventMan->pollEvent(_event)) { - if (_event.type == Common::EVENT_KEYDOWN) { - switch (_event.kbd.keycode) { - case Common::KEYCODE_LEFT: - --iter; - cursorChanged = true; - break; - case Common::KEYCODE_RIGHT: - ++iter; - cursorChanged = true; - break; - case Common::KEYCODE_RETURN: - debug("%s", (*iter)->getName().c_str()); - break; - case Common::KEYCODE_ESCAPE: - done = true; - break; - default: - break; - } - } - } - - if (cursorChanged) { - cursor = ZorkCursor((*iter)->getName()); - - _system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getHeight(), true, &_pixelFormat); - cursorChanged = false; - } - - _system->updateScreen(); - - // Calculate the frame delay based off a desired frame time - int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); - // Ensure non-negative - delay = delay < 0 ? 0 : delay; - _system->delayMillis(delay); - } -} - } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 1a259d0a22b3..2e5359b10b5f 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -131,18 +131,14 @@ class ZVision : public Engine { void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); void playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - /** - * Utility method to cycle through all the cursors in the game. After - * calling, use Left and Right arrows to cycle. Esc to quit. This is a - * blocking function call. - */ - void cycleThroughCursors(); - Common::String generateSaveFileName(uint slot); Common::String generateAutoSaveFileName(); private: void initialize(); + void initFonts(); + + void parseStrFile(const Common::String fileName); /** Called every frame from ZVision::run() to process any events from EventMan */ void processEvents(); From 0eeeeded920d50444b0e8ca865725231dffb0961 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:09:16 -0500 Subject: [PATCH 0982/1332] ZVISION: Add ScriptManager support for key press events --- engines/zvision/script_manager.cpp | 12 ++++++++++++ engines/zvision/script_manager.h | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index b9217e72501e..8dd944b1e9eb 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -275,6 +275,18 @@ bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Commo return cursorWasChanged; } +void ScriptManager::onKeyDown(Common::KeyState keyState) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->onKeyDown(keyState); + } +} + +void ScriptManager::onKeyUp(Common::KeyState keyState) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + (*iter)->onKeyUp(keyState); + } +} + void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { assert(world != 0); debug("Changing location to: %c %c %c %c %u", world, room, node, view, offset); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 15d456ea6b4d..274905f88d4d 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -110,6 +110,18 @@ class ScriptManager { * @return Was the cursor changed? */ bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + /** + * Called when a key is pressed. + * + * @param keycode The key that was pressed + */ + void onKeyDown(Common::KeyState keyState); + /** + * Called when a key is released. + * + * @param keycode The key that was pressed + */ + void onKeyUp(Common::KeyState keyState); void changeLocation(char world, char room, char node, char view, uint32 offset); From 8ba295d7103322a5193cc051da81ae82ccf5947b Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:09:42 -0500 Subject: [PATCH 0983/1332] ZVISION: Add key press support to the main event loop --- engines/zvision/events.cpp | 10 ++++------ engines/zvision/zvision.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index ae84a22d398c..1b6b2c25088c 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -71,9 +71,11 @@ void ZVision::processEvents() { break; } - onKeyDown(_event.kbd.keycode); + _scriptManager->onKeyDown(_event.kbd); + break; + case Common::EVENT_KEYUP: + _scriptManager->onKeyUp(_event.kbd); break; - default: break; } @@ -177,8 +179,4 @@ void ZVision::onMouseMove(const Common::Point &pos) { } } -void ZVision::onKeyDown(uint keyCode) { - -} - } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 2e5359b10b5f..94bcfdf17101 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -146,7 +146,6 @@ class ZVision : public Engine { void onMouseDown(const Common::Point &pos); void onMouseUp(const Common::Point &pos); void onMouseMove(const Common::Point &pos); - void onKeyDown(uint keyCode); }; } // End of namespace ZVision From 466eba1e9fb271b3d6b3a4e9f02a30a9333f68da Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:10:17 -0500 Subject: [PATCH 0984/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 5ce58e68fd88..79638511add8 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -156,7 +156,7 @@ RlfAnimation::Frame RlfAnimation::readNextFrame() { void RlfAnimation::seekToFrame(int frameNumber) { assert(!_stream); - assert(frameNumber < _frameCount || frameNumber >= -1); + assert(frameNumber < (int)_frameCount || frameNumber >= -1); if (frameNumber == -1) { _currentFrame = -1; @@ -173,7 +173,7 @@ void RlfAnimation::seekToFrame(int frameNumber) { } } - for (uint i = closestFrame; i <= frameNumber; i++) { + for (int i = closestFrame; i <= frameNumber; i++) { applyFrameToCurrent(i); } From 3986f333eff094d3104feae263b42e6e9ed85968 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:30:47 -0500 Subject: [PATCH 0985/1332] ZVISION: Move dirty rect extension to the correct function Source control mishap --- engines/zvision/render_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 38807a745756..62580323d37e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -311,6 +311,8 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i sourceOffset += imageWidth; } + _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); +} void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const { uint32 destOffset = 0; uint32 sourceOffset = 0; @@ -325,7 +327,6 @@ void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSur destOffset += destSurface->w; sourceOffset += _workingWidth; } - _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); } const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { From 36a0b666b3096da5a7ef169c598897be1cb06078 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:41:45 -0500 Subject: [PATCH 0986/1332] ZVISION: Add better alpha support for blitting Instead of blitting directly to the working window, we cache the alpha pixels, then blit directly to the backbuffer instead of to the working window. This ensures that if the alpha'd content changes, the old changes won't appear in any new frames --- engines/zvision/render_manager.cpp | 49 +++++++++++++++++++++++++----- engines/zvision/render_manager.h | 13 ++++++++ 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 62580323d37e..72fa5d3fc65c 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -98,11 +98,37 @@ void RenderManager::renderBackbufferToScreen() { // TODO: Add menu rendering + // Render alpha entries + processAlphaEntries(); + if (!_backBufferDirtyRect.isEmpty()) { _system->copyRectToScreen(_backBuffer.getBasePtr(_backBufferDirtyRect.left, _backBufferDirtyRect.top), _backBuffer.pitch, _backBufferDirtyRect.left, _backBufferDirtyRect.top, _backBufferDirtyRect.width(), _backBufferDirtyRect.height()); } } +void RenderManager::processAlphaEntries() { + for (Common::List::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + uint32 destOffset = 0; + uint32 sourceOffset = 0; + uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr((*iter).destX + _workingWindow.left, (*iter).destY + _workingWindow.top); + uint16 *entryPtr = (uint16 *)(*iter).data->getPixels(); + + for (int32 y = 0; y < (*iter).height; y++) { + for (int32 x = 0; x < (*iter).width; x++) { + uint16 color = entryPtr[sourceOffset + x]; + if (color != (*iter).alphaColor) { + backbufferPtr[destOffset + x] = color; + } + } + + destOffset += _workingWidth; + sourceOffset += (*iter).width; + } + + _backBufferDirtyRect.extend(Common::Rect((*iter).destX + _workingWindow.left, (*iter).destY + _workingWindow.top, (*iter).destX + _workingWindow.left + (*iter).width, (*iter).destY + _workingWindow.top + (*iter).height)); + } +} + void RenderManager::clearWorkingWindowTo555Color(uint16 color) { uint32 workingWindowSize = _workingWidth * _workingHeight; byte r, g, b; @@ -295,24 +321,31 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i } void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor) { - uint32 destOffset = 0; + AlphaDataEntry entry; + entry.alphaColor = alphaColor; + entry.data = new Graphics::Surface(); + entry.data->create(width, height, _pixelFormat); + entry.destX = destX; + entry.destY = destY; + entry.width = width; + entry.height = height; + uint32 sourceOffset = 0; - uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); + uint32 destOffset = 0; + uint16 *surfacePtr = (uint16 *)entry.data->getPixels(); for (int32 y = 0; y < height; y++) { for (int32 x = 0; x < width; x++) { - uint16 color = buffer[sourceOffset + x]; - if (color != alphaColor) { - workingWindowBufferPtr[destOffset + x] = color; - } + surfacePtr[destOffset + x] = buffer[sourceOffset + x]; } - destOffset += _workingWidth; + destOffset += width; sourceOffset += imageWidth; } - _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); + _alphaDataEntries.push_back(entry); } + void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const { uint32 destOffset = 0; uint32 sourceOffset = 0; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index ce5c77491767..f6106b39a35d 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -48,6 +48,16 @@ class RenderManager { RenderManager(OSystem *system, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat); ~RenderManager(); +private: + struct AlphaDataEntry { + Graphics::Surface *data; + uint16 alphaColor; + uint16 destX; + uint16 destY; + uint16 width; + uint16 height; + }; + private: OSystem *_system; const Graphics::PixelFormat _pixelFormat; @@ -56,6 +66,7 @@ class RenderManager { // It's used for panorama/tilt warping and for clearing the workingWindow to a single color Graphics::Surface _workingWindowBuffer; Graphics::Surface _backBuffer; + Common::List _alphaDataEntries; Common::Rect _workingWindowDirtyRect; Common::Rect _backBufferDirtyRect; @@ -108,6 +119,8 @@ class RenderManager { */ void renderBackbufferToScreen(); + void processAlphaEntries(); + void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor); From 259d11762dbf32ec1db6869510657331bb8c88e9 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:42:55 -0500 Subject: [PATCH 0987/1332] ZVISION: Add support for ActionRandom and ActionTimer They were already implemented, they just weren't being used --- engines/zvision/scr_file_handling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 3d4718557f7a..fa89f756e452 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -208,7 +208,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:quit*", true)) { actionList.push_back(new ActionQuit()); } else if (line.matchString("*:random*", true)) { - // TODO: Implement ActionRandom + actionList.push_back(new ActionRandom(line)); } else if (line.matchString("*:region*", true)) { // TODO: Implement ActionRegion } else if (line.matchString("*:restore_game*", true)) { @@ -230,7 +230,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:syncsound*", true)) { // TODO: Implement ActionSyncSound } else if (line.matchString("*:timer*", true)) { - // TODO: Implement ActionTimer + actionList.push_back(new ActionTimer(line)); } else if (line.matchString("*:ttytext*", true)) { // TODO: Implement ActionTTYText } else if (line.matchString("*:universe_music*", true)) { From 0d78208562ad1709170734195587ac6e6a597dae Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:43:41 -0500 Subject: [PATCH 0988/1332] ZVISION: Add focus support for Controls --- engines/zvision/control.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/control.h b/engines/zvision/control.h index baa2dfb4f369..a27938129870 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -48,6 +48,8 @@ class Control { virtual void enable(); virtual void disable(); + virtual void focus() {} + virtual void unfocus() {} /** * Called when LeftMouse is pushed. Default is NOP. * From 6ee253a4d8dce2f8c45f8d8256b49505db9eff4e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:44:33 -0500 Subject: [PATCH 0989/1332] ZVISION: Add focus support for the ScriptManager --- engines/zvision/script_manager.cpp | 17 ++++++++++++++++- engines/zvision/script_manager.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 8dd944b1e9eb..3126aee8bbd9 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -38,7 +38,8 @@ namespace ZVision { ScriptManager::ScriptManager(ZVision *engine) - : _engine(engine) { + : _engine(engine), + _currentlyFocusedControl(0) { } ScriptManager::~ScriptManager() { @@ -254,6 +255,20 @@ void ScriptManager::disableControl(uint32 key) { } } +void ScriptManager::focusControl(uint32 key) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + uint32 controlKey = (*iter)->getKey(); + + if (controlKey == key) { + (*iter)->focus(); + } else if (controlKey == _currentlyFocusedControl) { + (*iter)->unfocus(); + } + } + + _currentlyFocusedControl = key; +} + void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 274905f88d4d..349f25919892 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -74,6 +74,8 @@ class ScriptManager { Location _currentLocation; + uint32 _currentlyFocusedControl; + public: void initialize(); void update(uint deltaTimeMillis); @@ -88,6 +90,8 @@ class ScriptManager { void enableControl(uint32 key); void disableControl(uint32 key); + void focusControl(uint32 key); + /** * Called when LeftMouse is pushed. * From 5cd1d2d1c2d9fc754450f548cff9aa8afaffd975 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:45:02 -0500 Subject: [PATCH 0990/1332] ZVISION: Ensure getControl always returns something --- engines/zvision/script_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 3126aee8bbd9..1acbcdfcf211 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -235,6 +235,8 @@ Control *ScriptManager::getControl(uint32 key) { return (*iter); } } + + return nullptr; } void ScriptManager::enableControl(uint32 key) { From 2900aaa90a87a1821578cadd457ba2465f02de01 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:45:23 -0500 Subject: [PATCH 0991/1332] ZVISION: Add a reminder for how inventory is accessed --- engines/zvision/events.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 1b6b2c25088c..c1b894c29024 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -48,6 +48,7 @@ void ZVision::processEvents() { break; case Common::EVENT_RBUTTONDOWN: + // TODO: Inventory logic break; case Common::EVENT_MOUSEMOVE: From a2d19c7a6e5f80d8a3a6e0fa296e45c24442ed5f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:45:53 -0500 Subject: [PATCH 0992/1332] ZVISION: Actually store the ZVision pointer --- engines/zvision/save_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index ae65750b42dd..219a8e7715bb 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -44,7 +44,7 @@ struct SaveGameHeader { class SaveManager { public: - SaveManager(ZVision *engine); + SaveManager(ZVision *engine) : _engine(engine) {} private: ZVision *_engine; From f6c36aa14ce31340694292063722e1e7d0ba6840 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:46:35 -0500 Subject: [PATCH 0993/1332] ZVISION: Create an instance of the SaveManager --- engines/zvision/zvision.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 09f5ea30b152..f1e525d2d569 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -39,6 +39,7 @@ #include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/cursor_manager.h" +#include "zvision/save_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" @@ -71,6 +72,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat); + _saveManager = new SaveManager(this); debug("ZVision::ZVision"); } From c643718dae5ca7f7fce8672ffa6000661e9fceaa Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:51:32 -0500 Subject: [PATCH 0994/1332] ZVISION: Clean up the TruetypeFont class and add alpha support Remove caching. We don't render font enough to warrant it. Use Graphics::TextAlign instead of rolling our own. Remove methods we don't use. --- engines/zvision/truetype_font.cpp | 128 ++++++------------------------ engines/zvision/truetype_font.h | 65 +-------------- 2 files changed, 26 insertions(+), 167 deletions(-) diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index dacd7967d33f..d88f22a727c9 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -26,6 +26,7 @@ #include "common/file.h" #include "common/system.h" +#include "graphics/font.h" #include "graphics/fonts/ttf.h" #include "graphics/surface.h" @@ -36,43 +37,27 @@ namespace ZVision { -TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight, const Graphics::PixelFormat pixelFormat) +TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight) : _engine(engine), - _pixelFormat(pixelFormat), - _isBold(false), - _isItalic(false), - _isStriked(false), - _isUnderline(false), _fontHeight(fontHeight), _font(0), _lineHeight(0), _maxCharWidth(0), _maxCharHeight(0) { - for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - _cachedTexts[i] = 0; - } } TruetypeFont::~TruetypeFont(void) { - clearCache(); - delete _font; } -void TruetypeFont::clearCache() { - for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - if (_cachedTexts[i]) { - delete _cachedTexts[i]; - } - _cachedTexts[i] = 0; - } -} - bool TruetypeFont::loadFile(const Common::String &filename) { Common::File file; - if (file.open(filename)) { - debug("TTF font file %s could not be opened", filename.c_str()); - return false; + + if (!Common::File::exists(filename)) { + debug("TTF font file %s was not found. Reverting to arial.ttf", filename.c_str()); + file.open("arial.ttf"); + } else { + file.open(filename); } _font = Graphics::loadTTFFont(file, _fontHeight); @@ -81,65 +66,25 @@ bool TruetypeFont::loadFile(const Common::String &filename) { return true; } -void TruetypeFont::drawText(const Common::String &text, int x, int y, int width, TextAlign align, int maxHeight) { +Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { if (text.equals("")) { - return; - } - - // Find the cached surface, if it exists - uint32 minUseTime = UINT_MAX; - int minIndex = -1; - Graphics::Surface *surface = nullptr; - - for (int i = 0; i < NUM_CACHED_TEXTS; i++) { - if (_cachedTexts[i] == nullptr) { - minUseTime = 0; - minIndex = i; - } else { - if (_cachedTexts[i]->_text == text && _cachedTexts[i]->_align == align && _cachedTexts[i]->_width == width && _cachedTexts[i]->_maxHeight == maxHeight) { - surface = _cachedTexts[i]->_surface; - _cachedTexts[i]->_marked = true; - _cachedTexts[i]->_lastUsed = g_system->getMillis(); - break; - } else { - if (_cachedTexts[i]->_lastUsed < minUseTime) { - minUseTime = _cachedTexts[i]->_lastUsed; - minIndex = i; - } - } - } + return nullptr; } - // It's not cached, so create one - if (!surface) { - surface = renderTextToTexture(text, width, align, maxHeight); - if (surface) { - // Write the new surface to cache - if (_cachedTexts[minIndex] != nullptr) { - delete _cachedTexts[minIndex]; - } - _cachedTexts[minIndex] = new CachedText; - - _cachedTexts[minIndex]->_surface = surface; - _cachedTexts[minIndex]->_align = align; - _cachedTexts[minIndex]->_width = width; - _cachedTexts[minIndex]->_maxHeight = maxHeight; - _cachedTexts[minIndex]->_text = text; - _cachedTexts[minIndex]->_marked = true; - _cachedTexts[minIndex]->_lastUsed = _engine->_system->getMillis(); - } - } + Graphics::Surface *surface = new Graphics::Surface(); + if (!wrap) { + int width = MIN(_font->getStringWidth(text), maxWidth); + surface->create(width, _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + // Copy the pixels from the RenderManager::_workingWindow, so we can get nice antialiasing + _engine->getRenderManager()->copyWorkingWindowSubRectToSurface(surface, 0, 0, Common::Rect(destX, destY, destX + width, destY + _lineHeight)); - // Render it to the working window - if (surface) { - _engine->getRenderManager()->copyRectToWorkingWindow((uint16 *)surface->getPixels(), x, y, surface->w, surface->w, surface->h); + _font->drawString(surface, text, destX, destY, maxWidth, textColor, align); + return surface; } -} -Graphics::Surface *TruetypeFont::renderTextToTexture(const Common::String &text, int width, TextAlign align, int maxHeight) { Common::Array lines; - _font->wordWrapText(text, width, lines); + _font->wordWrapText(text, maxWidth, lines); while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) { lines.pop_back(); @@ -148,44 +93,17 @@ Graphics::Surface *TruetypeFont::renderTextToTexture(const Common::String &text, return nullptr; } - Graphics::TextAlign alignment = Graphics::kTextAlignInvalid; - if (align == ALIGN_LEFT) { - alignment = Graphics::kTextAlignLeft; - } else if (align == ALIGN_CENTER) { - alignment = Graphics::kTextAlignCenter; - } else if (align == ALIGN_RIGHT) { - alignment = Graphics::kTextAlignRight; - } - - Graphics::Surface *surface = new Graphics::Surface(); - surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _pixelFormat); + surface->create(maxWidth, lines.size() * _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + // Copy the pixels from the RenderManager::_workingWindow, so we can get nice antialiasing + _engine->getRenderManager()->copyWorkingWindowSubRectToSurface(surface, 0, 0, Common::Rect(destX, destY, destX + maxWidth, destY + lines.size() * _lineHeight)); - uint32 alphaColor = 0xffffffff; int heightOffset = 0; for (Common::Array::iterator it = lines.begin(); it != lines.end(); it++) { - _font->drawString(surface, *it, 0, heightOffset, width, alphaColor, alignment); + _font->drawString(surface, *it, destX, destY + heightOffset, maxWidth, textColor, align); heightOffset += (int)_lineHeight; } return surface; - // TODO: _isUnderline, _isBold, _isItalic, _isStriked -} - -void TruetypeFont::measureText(const Common::String &text, int maxWidth, int maxHeight, int &textWidthOut, int &textHeightOut) { - if (maxWidth >= 0) { - Common::Array lines; - _font->wordWrapText(text, maxWidth, lines); - Common::Array::iterator it; - textWidthOut = 0; - for (it = lines.begin(); it != lines.end(); ++it) { - textWidthOut = MAX(textWidthOut, _font->getStringWidth(*it)); - } - - textHeightOut = (int)(lines.size() * getLineHeight()); - } else { - textWidthOut = _font->getStringWidth(text); - textHeightOut = _fontHeight; - } } } // End of namespace ZVision diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index 48657417a2e8..c8d0a95b2879 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -28,7 +28,7 @@ #include "common/types.h" #include "graphics/font.h" - +#include "graphics/pixelformat.h" namespace Graphics { struct Surface; @@ -40,83 +40,24 @@ class ZVision; class TruetypeFont { public: - TruetypeFont(ZVision *engine, int32 fontHeight, const Graphics::PixelFormat pixelFormat); + TruetypeFont(ZVision *engine, int32 fontHeight); ~TruetypeFont(); -public: - enum { - NUM_CACHED_TEXTS = 30 - }; - - enum TextAlign { - ALIGN_LEFT = 0, - ALIGN_RIGHT, - ALIGN_CENTER - }; - - class CachedText { - public: - Common::String _text; - int32 _width; - TextAlign _align; - int32 _maxHeight; - Graphics::Surface *_surface; - int32 _textOffset; - bool _marked; - uint32 _lastUsed; - - CachedText() { - _width = _maxHeight = -1; - _align = ALIGN_LEFT; - _surface = 0; - _lastUsed = 0; - _marked = false; - } - - virtual ~CachedText() { - delete _surface; - } - }; - private: ZVision *_engine; - const Graphics::PixelFormat _pixelFormat; - Graphics::Font *_font; - float _lineHeight; size_t _maxCharWidth; size_t _maxCharHeight; - CachedText *_cachedTexts[NUM_CACHED_TEXTS]; - public: - bool _isBold; - bool _isItalic; - bool _isUnderline; - bool _isStriked; int32 _fontHeight; - //BaseArray _layers; - public: - int getTextWidth(const byte *text, int maxLength = -1); - int getTextHeight(const byte *text, int width); - void drawText(const Common::String &text, int x, int y, int width, TextAlign align = ALIGN_LEFT, int max_height = -1); - int getLetterHeight(); - bool loadFile(const Common::String &filename); - - float getLineHeight() const { return _lineHeight; } - void clearCache(); - - static TruetypeFont *createFromFile(ZVision *game, const Common::String &filename); - -private: - void measureText(const Common::String &text, int maxWidth, int maxHeight, int &textWidthOut, int &textHeightOut); - Graphics::Surface *renderTextToTexture(const Common::String &text, int width, TextAlign align, int maxHeight); + Graphics::Surface *drawTextToSurface(const Common::String &text, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap); }; } // End of namespace ZVision From dc8c7ca2c04372a39af5cca80040daa8923e9658 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:52:27 -0500 Subject: [PATCH 0995/1332] ZVISION: Add RenderManager text support --- engines/zvision/render_manager.cpp | 16 ++++++++++++++++ engines/zvision/render_manager.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 72fa5d3fc65c..1c1ce40c6c4c 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -346,6 +346,22 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i _alphaDataEntries.push_back(entry); } +Common::Rect RenderManager::renderTextToWorkingWindow(const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { + AlphaDataEntry entry; + entry.alphaColor = 0; + entry.destX = destX; + entry.destY = destY; + + // Draw the text to the working window + entry.data = font->drawTextToSurface(text, destX, destY, textColor, maxWidth, maxHeight, align, wrap); + entry.width = entry.data->w; + entry.height = entry.data->h; + + _alphaDataEntries.push_back(entry); + + return Common::Rect(destX, destY, destX + entry.width, destY + entry.height); +} + void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const { uint32 destOffset = 0; uint32 sourceOffset = 0; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index f6106b39a35d..84914cc5d38f 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -29,6 +29,7 @@ #include "graphics/surface.h" #include "zvision/render_table.h" +#include "zvision/truetype_font.h" class OSystem; @@ -124,6 +125,8 @@ class RenderManager { void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor); + Common::Rect renderTextToWorkingWindow(const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true); + /** * Fills the entire workingWindow with the specified color * From 05b3b170d45125ba52c7b795a89d3ce8141c77ab Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:53:23 -0500 Subject: [PATCH 0996/1332] ZVISION: Add more documentation for clearWorkingWindowTo555Color() --- engines/zvision/render_manager.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 84914cc5d38f..50d2d1076f33 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -128,7 +128,8 @@ class RenderManager { Common::Rect renderTextToWorkingWindow(const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true); /** - * Fills the entire workingWindow with the specified color + * Fills the entire workingWindow with the specified color. Internally, the color + * will be converted to RGB 565 and then blitted. * * @param color The color to fill the working window with. (In RGB 555) */ From 82ea7ca0e7bad570195f41392f717a42254aff5f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:55:37 -0500 Subject: [PATCH 0997/1332] ZVISION: Create the StringManager class This parses the XXXXX.STR files into styled fonts and phrases. The styles and the phrases are used in the game for messages to the user and for general purpose fonts. --- engines/zvision/module.mk | 1 + engines/zvision/string_manager.cpp | 235 +++++++++++++++++++++++++++++ engines/zvision/string_manager.h | 84 +++++++++++ 3 files changed, 320 insertions(+) create mode 100644 engines/zvision/string_manager.cpp create mode 100644 engines/zvision/string_manager.h diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 9fa119d353ed..cb4a3609e93a 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -22,6 +22,7 @@ MODULE_OBJS := \ script_manager.o \ scripts.o \ single_value_container.o \ + string_manager.o \ timer_node.o \ truetype_font.o \ utility.o \ diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp new file mode 100644 index 000000000000..818b60c73253 --- /dev/null +++ b/engines/zvision/string_manager.cpp @@ -0,0 +1,235 @@ +/* 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/scummsys.h" + +#include "common/file.h" +#include "common/tokenizer.h" +#include "common/debug.h" + +#include "graphics/fontman.h" + +#include "zvision/string_manager.h" +#include "zvision/truetype_font.h" + + +namespace ZVision { + +const Graphics::PixelFormat StringManager::_pixelFormat565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + +StringManager::StringManager(ZVision *engine) + : _engine(engine) { +} + +StringManager::~StringManager() { + for (Common::HashMap::iterator iter = _fonts.begin(); iter != _fonts.end(); iter++) { + delete (*iter)._value; + } +} + +void StringManager::initialize(ZVisionGameId gameId) { + if (gameId == ZorkNemesis) { + // TODO: Check this hardcoded filename against all versions of Nemesis + parseStrFile("nemesis.str"); + } else if (gameId == ZorkGrandInquisitor) { + // TODO: Check this hardcoded filename against all versions of Grand Inquisitor + parseStrFile("inquis.str"); + } +} + +void StringManager::parseStrFile(const Common::String &fileName) { + Common::File file; + if (!file.open(fileName)) { + warning("%s does not exist. String parsing failed", fileName.c_str()); + return; + } + + Common::String line = file.readLine(); + + uint lineNumber = 0; + while (!file.eos()) { + Common::String asciiLine = wideToASCII(line.c_str(), line.size()); + + char tagString[150]; + uint tagStringCursor = 0; + char textString[150]; + uint textStringCursor = 0; + bool inTag = false; + + for (uint i = 0; i < asciiLine.size(); i++) { + switch (asciiLine[i]) { + case '<': + inTag = true; + break; + case '>': + inTag = false; + parseTag(Common::String(tagString, tagStringCursor), Common::String(textString, textStringCursor), i); + tagStringCursor = 0; + textStringCursor = 0; + break; + default: + if (inTag) { + textString[tagStringCursor] = asciiLine[i]; + tagStringCursor++; + } else { + textString[textStringCursor] = asciiLine[i]; + textStringCursor++; + } + break; + } + } + + // STR files add a null character after the CR/LF. We need to skip over that before we can read another line + file.readByte(); + + line = file.readLine(); + lineNumber++; + } +} + +void StringManager::parseTag(const Common::String &tagString, const Common::String &textString, uint lineNumber) { + Common::StringTokenizer tokenizer(tagString); + + Common::String token = tokenizer.nextToken(); + + Common::String fontName; + bool bold = false; + Graphics::TextAlign align = Graphics::kTextAlignLeft; + int point = 12; + int red = 0; + int green = 0; + int blue = 0; + + while (!token.empty()) { + if (token.matchString("font", true)) { + fontName = tokenizer.nextToken(); + } else if (token.matchString("bold", true)) { + token = tokenizer.nextToken(); + if (token.matchString("on", false)) { + bold = true; + } + } else if (token.matchString("justify", true)) { + token = tokenizer.nextToken(); + if (token.matchString("center", false)) { + align = Graphics::kTextAlignCenter; + } else if (token.matchString("right", false)) { + align = Graphics::kTextAlignRight; + } + } else if (token.matchString("point", true)) { + point = atoi(tokenizer.nextToken().c_str()); + } else if (token.matchString("red", true)) { + red = atoi(tokenizer.nextToken().c_str()); + } else if (token.matchString("green", true)) { + green = atoi(tokenizer.nextToken().c_str()); + } else if (token.matchString("blue", true)) { + blue = atoi(tokenizer.nextToken().c_str()); + } + + token = tokenizer.nextToken(); + } + + Common::String newFontName; + if (fontName.matchString("times new roman", true)) { + if (bold) { + newFontName = "timesbd.ttf"; + } else { + newFontName = "times.ttf"; + } + } else if (fontName.matchString("courier new", true)) { + if (bold) { + newFontName = "courbd.ttf"; + } else { + newFontName = "cour.ttf"; + } + } else if (fontName.matchString("century schoolbook", true)) { + if (bold) { + newFontName = "censcbkbd.ttf"; + } else { + newFontName = "censcbk.ttf"; + } + } else if (fontName.matchString("times new roman", true)) { + if (bold) { + newFontName = "courbd.ttf"; + } else { + newFontName = "cour.ttf"; + } + } else { + debug("Could not identify font: %s. Reverting to Arial", fontName.c_str()); + if (bold) { + newFontName = "zorknorm.ttf"; + } else { + newFontName = "arial.ttf"; + } + } + + // Push an empty TextFragment onto the end of the list + // Creating the TextFragement before filling it prevents extra data copying during creation + _inGameText->fragments.push_back(TextFragment()); + TextFragment *fragment = &_inGameText->fragments.back(); + + Common::String fontKey = Common::String::format("%s-&d", newFontName.c_str(), point); + if (_fonts.contains(fontKey)) { + fragment->style.font = _fonts[fontKey]; + } else { + fragment->style.font = new TruetypeFont(_engine, point); + fragment->style.font->loadFile(newFontName); + } + + fragment->style.align = align; + fragment->style.color = _pixelFormat565.ARGBToColor(0, red, green, blue); + fragment->text = textString; +} + +Common::String StringManager::wideToASCII(const char *wideStr, uint arrayLength) { + // TODO: Contemplate using a largish static buffer instead of a dynamic heap buffer + uint newSize = arrayLength / 2; + char *asciiString = new char[newSize]; + + // Don't spam the user with warnings about UTF-16 support. + // Just do one warning per String + bool charOverflowWarning = false; + // Crush each octet pair to a single octet with a simple cast + for (uint i = 0; i < newSize; i++) { + uint16 value = READ_LE_UINT16(wideStr + (i * 2)); + if (value > 255) { + charOverflowWarning = true; + value = 255; + } + asciiString[i] = (char)value; + } + + if (charOverflowWarning) { + warning("UTF-16 is not supported. Characters greater than 255 are clamped to 255"); + } + + Common::String returnString(asciiString, newSize); + // Cleanup. Common::String constructor does a memmove() internally so we can safely delete + delete[] asciiString; + + return returnString; +} + +StringManager::TextStyle StringManager::getTextStyle(uint stringNumber) { + return _inGameText[stringNumber].fragments.front().style; +} + +} // End of namespace ZVision diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h new file mode 100644 index 000000000000..a9d2dc1a1d13 --- /dev/null +++ b/engines/zvision/string_manager.h @@ -0,0 +1,84 @@ +/* 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 ZVISION_STRING_MANAGER_H +#define ZVISION_STRING_MANAGER_H + +#include "common/types.h" + +#include "zvision/detection.h" +#include "zvision/truetype_font.h" + + +namespace Graphics { +class FontManager; +} + +namespace ZVision { + +class ZVision; + +class StringManager { +public: + StringManager(ZVision *engine); + ~StringManager(); + +public: + struct TextStyle { + TruetypeFont *font; + uint16 color; // In RBG 565 + Graphics::TextAlign align; + }; + + struct TextFragment { + TextStyle style; + Common::String text; + }; + +private: + struct InGameText { + Common::List fragments; + }; + +private: + ZVision *_engine; + // NOTE: We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56 + InGameText _inGameText[56]; + Common::HashMap _fonts; + + static const Graphics::PixelFormat _pixelFormat565; + +public: + void initialize(ZVisionGameId gameId); + StringManager::TextStyle getTextStyle(uint stringNumber); + +private: + void parseStrFile(const Common::String &fileName); + void parseTag(const Common::String &tagString, const Common::String &textString, uint lineNumber); + + static Common::String wideToASCII(const char *wideStr, uint arrayLength); +}; + +} // End of namespace ZVision + +#endif From c312b147fa7f5a28491975ae0bcc4b419e7e126a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 14:55:59 -0500 Subject: [PATCH 0998/1332] ZVISION: Create an instance of StringManager --- engines/zvision/zvision.cpp | 3 ++- engines/zvision/zvision.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index f1e525d2d569..dc1cf476a768 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -40,6 +40,7 @@ #include "zvision/render_manager.h" #include "zvision/cursor_manager.h" #include "zvision/save_manager.h" +#include "zvision/string_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" @@ -71,8 +72,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Create managers _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat); - _saveManager = new SaveManager(this); + _stringManager = new StringManager(this); debug("ZVision::ZVision"); } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 94bcfdf17101..a481aba28f04 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -48,6 +48,7 @@ class Console; class ScriptManager; class RenderManager; class CursorManager; +class StringManager; class SaveManager; class RlfAnimation; @@ -97,6 +98,7 @@ class ZVision : public Engine { RenderManager *_renderManager; CursorManager *_cursorManager; SaveManager *_saveManager; + StringManager *_stringManager; // Clock Clock _clock; @@ -114,6 +116,7 @@ class ZVision : public Engine { RenderManager *getRenderManager() const { return _renderManager; } CursorManager *getCursorManager() const { return _cursorManager; } SaveManager *getSaveManager() const { return _saveManager; } + StringManager *getStringManager() const { return _stringManager; } Common::RandomSource *getRandomSource() const { return _rnd; } ZVisionGameId getGameId() const { return _gameDescription->gameId; } From d82ff7aea8d866bf5be2accfab321c39dd727c66 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 16:26:49 -0500 Subject: [PATCH 0999/1332] ZVISION: Create Console method to render text --- engines/zvision/console.cpp | 12 ++++++++++++ engines/zvision/console.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 4ea4a8e96318..3969aa1f1472 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -32,6 +32,7 @@ #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" +#include "zvision/string_manager.h" #include "zvision/zork_avi_decoder.h" #include "zvision/zork_raw.h" #include "zvision/utility.h" @@ -52,6 +53,7 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("changelocation", WRAP_METHOD(Console, cmdChangeLocation)); DCmd_Register("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); DCmd_Register("parseallscrfiles", WRAP_METHOD(Console, cmdParseAllScrFiles)); + DCmd_Register("rendertext", WRAP_METHOD(Console, cmdRenderText)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -198,4 +200,14 @@ bool Console::cmdParseAllScrFiles(int argc, const char **argv) { return true; } +bool Console::cmdRenderText(int argc, const char **argv) { + if (argc != 7) { + DebugPrintf("Use rendertext <1 or 0: wrap> to render text\n"); + return true; + } + + StringManager::TextStyle style = _engine->getStringManager()->getTextStyle(atoi(argv[2])); + _engine->getRenderManager()->renderTextToWorkingWindow(Common::String(argv[1]), style.font, atoi(argv[3]), atoi(argv[4]), style.color, atoi(argv[5]), -1, Graphics::kTextAlignLeft, atoi(argv[6]) == 0 ? false : true); +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index fdb20642e96c..0ca1b8cc70ab 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -48,6 +48,7 @@ class Console : public GUI::Debugger { bool cmdChangeLocation(int argc, const char **argv); bool cmdDumpFile(int argc, const char **argv); bool cmdParseAllScrFiles(int argc, const char **argv); + bool cmdRenderText(int argc, const char **argv); }; } // End of namespace ZVision From 2b2f85063afd2fcd5d7b24851ad697de58e9c8a6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 15 Sep 2013 16:27:19 -0500 Subject: [PATCH 1000/1332] ZVISION: Clean up StringManager and SaveManager after use --- engines/zvision/zvision.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index dc1cf476a768..2d14e5d6a821 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -83,6 +83,8 @@ ZVision::~ZVision() { // Dispose of resources delete _console; delete _cursorManager; + delete _stringManager; + delete _saveManager; delete _renderManager; delete _scriptManager; delete _rnd; From d6be9ed7db8db20aee90bd1c275d5b9d8bb7b9b3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 00:05:35 +0200 Subject: [PATCH 1001/1332] AVALANCHE: More index conversion in appearPed --- engines/avalanche/acci.cpp | 10 +++++----- engines/avalanche/animation.cpp | 26 +++++++++++++------------- engines/avalanche/lucerna.cpp | 26 +++++++++++++------------- engines/avalanche/timer.cpp | 10 +++++----- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index dc794359b32b..f4620f45113e 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1292,12 +1292,12 @@ void Acci::cardiffClimbing() { if (_vm->_gyro->_standingOnDais) { // Clamber up. _vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_gyro->_standingOnDais = false; - _vm->_animation->appearPed(1, 2); + _vm->_animation->appearPed(0, 2); } else { // Clamber down. if (_vm->_animation->inField(1)) { _vm->_scrolls->displayText("You clamber up onto the dais."); _vm->_gyro->_standingOnDais = true; - _vm->_animation->appearPed(1, 1); + _vm->_animation->appearPed(0, 1); } else _vm->_scrolls->displayText("Get a bit closer, Avvy."); } @@ -1318,7 +1318,7 @@ void Acci::standUp() { } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; - _vm->_animation->appearPed(1, 1); + _vm->_animation->appearPed(0, 1); _vm->_animation->_direction = Animation::kDirLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); @@ -1336,7 +1336,7 @@ void Acci::standUp() { if (_vm->_gyro->_sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. - _vm->_animation->appearPed(1, 3); // And walking away. + _vm->_animation->appearPed(0, 3); // And walking away. _vm->_gyro->_sittingInPub = false; // Really not sitting down. _vm->_gyro->_userMovesAvvy = true; // And ambulant. } else @@ -1891,7 +1891,7 @@ void Acci::doThat() { else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius - _vm->_animation->appearPed(2, 3); + _vm->_animation->appearPed(1, 3); spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index e15ecfaab7c9..2327e5129d11 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -722,7 +722,7 @@ void Animation::catacombMove(byte ped) { if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. - appearPed(2, geidaPed(ped) - 1); + appearPed(1, geidaPed(ped) - 1); _sprites[1]._callEachStepFl = true; _sprites[1]._eachStepProc = kProcGeida; } @@ -758,7 +758,7 @@ void Animation::callSpecial(uint16 which) { if (!_vm->_gyro->_arrowTriggered) { _vm->_gyro->_arrowTriggered = true; - appearPed(2, 3); // The dart starts at ped 4, and... + appearPed(1, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate @@ -846,13 +846,13 @@ void Animation::callSpecial(uint16 which) { return; switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { case 0x1: - appearPed(1, 11); + appearPed(0, 11); break; case 0x3: - appearPed(1, 10); + appearPed(0, 10); break; default: - appearPed(1, 3); + appearPed(0, 3); } dawnDelay(); break; @@ -862,7 +862,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(1); if (_vm->_gyro->_room != kRoomCatacombs) return; - appearPed(1, 0); + appearPed(0, 0); dawnDelay(); break; case 12: // _vm->_gyro->special 12: transfer south in catacombs. @@ -871,7 +871,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(2); if (_vm->_gyro->_room != kRoomCatacombs) return; - appearPed(1, 1); + appearPed(0, 1); dawnDelay(); break; case 13: // _vm->_gyro->special 13: transfer west in catacombs. @@ -880,7 +880,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(3); if (_vm->_gyro->_room != kRoomCatacombs) return; - appearPed(1, 2); + appearPed(0, 2); dawnDelay(); break; } @@ -928,7 +928,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { _vm->_sequence->startToClose(); return; } else { - appearPed(1, 5); + appearPed(0, 5); _sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(9); @@ -997,10 +997,10 @@ void Animation::changeDirection(byte t, byte dir) { } void Animation::appearPed(byte sprNum, byte pedNum) { - AnimationType *curSpr = &_sprites[sprNum - 1]; + AnimationType *curSpr = &_sprites[sprNum]; PedType *curPed = &_vm->_gyro->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); - changeDirection(sprNum - 1, curPed->_direction); + changeDirection(sprNum, curPed->_direction); } // Eachstep procedures: @@ -1287,7 +1287,7 @@ void Animation::hideInCupboard() { } else { _sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; - appearPed(1, 2); // Walk out of the cupboard. + appearPed(0, 2); // Walk out of the cupboard. _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); @@ -1337,7 +1337,7 @@ void Animation::flipRoom(byte room, byte ped) { _vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_lucerna->enterRoom(room, ped); - appearPed(1, ped - 1); + appearPed(0, ped - 1); _vm->_gyro->_enterCatacombsFromLustiesRoom = false; _oldDirection = _direction; _direction = _sprites[0]._facingDir; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index c8c76d45535b..5ba0e70bc938 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -413,7 +413,7 @@ void Lucerna::putGeidaAt(byte whichPed, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(2, whichPed); + _vm->_animation->appearPed(1, whichPed); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } @@ -460,10 +460,10 @@ void Lucerna::enterRoom(byte room, byte ped) { spr1->init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_roomCount[kRoomOutsideYours] == 1) { - _vm->_animation->appearPed(2, 3); // Start on the right-hand side of the screen. + _vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. spr1->walkTo(4); // Walks up to greet you. } else { - _vm->_animation->appearPed(2, 4); // Starts where he was before. + _vm->_animation->appearPed(1, 4); // Starts where he was before. spr1->_facingDir = Animation::kDirLeft; } @@ -475,7 +475,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_crapulusWillTell) { spr1->init(8, false, _vm->_animation); - _vm->_animation->appearPed(2, 1); + _vm->_animation->appearPed(1, 1); spr1->walkTo(3); _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _vm->_gyro->_crapulusWillTell = false; @@ -495,7 +495,7 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (ped > 0) { spr1->init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->appearPed(2, 1); + _vm->_animation->appearPed(1, 1); _vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomSpludwicks; } @@ -520,11 +520,11 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomBrummieRoad; if (_vm->_gyro->_roomCount[kRoomBrummieRoad] == 1) { // First time here... - _vm->_animation->appearPed(2, 1); // He appears on the right of the screen... + _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... spr1->walkTo(3); // ...and he walks up... } else { // You've been here before. - _vm->_animation->appearPed(2, 3); // He's standing in your way straight away... + _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... spr1->_facingDir = Animation::kDirLeft; } } @@ -535,7 +535,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[kRoomArgentRoad] > 3)) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->appearPed(2, 0); + _vm->_animation->appearPed(1, 0); spr1->walkTo(1); spr1->_vanishIfStill = true; _vm->_gyro->_passedCwytalotInHerts = true; @@ -560,7 +560,7 @@ void Lucerna::enterRoom(byte room, byte ped) { // A welcome party... or maybe not... AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(2, 1); + _vm->_animation->appearPed(1, 1); spr1->walkTo(2); _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } @@ -585,7 +585,7 @@ void Lucerna::enterRoom(byte room, byte ped) { switch (_vm->_gyro->_cardiffQuestionNum) { case 0 : // You've answered NONE of his questions. spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(2, 1); + _vm->_animation->appearPed(1, 1); spr1->walkTo(2); _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); break; @@ -594,7 +594,7 @@ void Lucerna::enterRoom(byte room, byte ped) { break; // You've answered ALL his questions. => nothing happens. default: // You've answered SOME of his questions. spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(2, 2); + _vm->_animation->appearPed(1, 2); spr1->_facingDir = Animation::kDirRight; _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } @@ -724,10 +724,10 @@ void Lucerna::enterRoom(byte room, byte ped) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(11, false, _vm->_animation); if ((_vm->_gyro->_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { - _vm->_animation->appearPed(2, 1); // Start on the right-hand side of the screen. + _vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. spr1->walkTo(3); // Walks up to greet you. } else { - _vm->_animation->appearPed(2, 3); // Starts where she was before. + _vm->_animation->appearPed(1, 3); // Starts where she was before. spr1->_facingDir = Animation::kDirLeft; } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 161944050ef4..0f5eb1229661 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -328,7 +328,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; - _vm->_animation->appearPed(1, 1); + _vm->_animation->appearPed(0, 1); _vm->_scrolls->displayScrollChain('q', 39); avvy->walkTo(6); addTimer(55, kProcHangAround2, kReasonHangingAround); @@ -358,7 +358,7 @@ void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. - _vm->_animation->appearPed(1, 1); + _vm->_animation->appearPed(0, 1); _vm->_gyro->_userMovesAvvy = true; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -429,7 +429,7 @@ void Timer::jacquesWakesUp() { void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(9, false, _vm->_animation); // Here comes the Duke. - _vm->_animation->appearPed(2, 0); // He starts at the door... + _vm->_animation->appearPed(1, 0); // He starts at the door... spr->walkTo(2); // He walks over to you. // Let's get the door opening. @@ -586,7 +586,7 @@ void Timer::riseUpOubliette() { void Timer::robinHoodAndGeida() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); - _vm->_animation->appearPed(1, 6); + _vm->_animation->appearPed(0, 6); avvy->walkTo(5); AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -615,7 +615,7 @@ void Timer::avalotReturns() { avvy->remove(); spr->remove(); avvy->init(0, true, _vm->_animation); - _vm->_animation->appearPed(1, 0); + _vm->_animation->appearPed(0, 0); _vm->_scrolls->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } From 23ba373c9145060c3e766d56f845382a3e7c6ea6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 00:26:36 +0200 Subject: [PATCH 1002/1332] AVALANCHE: More index conversion in inField() --- engines/avalanche/acci.cpp | 30 ++++++++++++++---------------- engines/avalanche/animation.cpp | 2 +- engines/avalanche/gyro.cpp | 2 +- engines/avalanche/timer.cpp | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index f4620f45113e..3f78b16cbe5f 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -1071,7 +1071,7 @@ void Acci::openDoor() { // Special cases. switch (_vm->_gyro->_room) { case kRoomYours: - if (_vm->_animation->inField(2)) { + if (_vm->_animation->inField(1)) { // Opening the box. _thing = 54; // The box. _person = kPardon; @@ -1091,7 +1091,7 @@ void Acci::openDoor() { return; // No doors can open if you can't move Avvy. for (byte i = 0; i < 7; i++) { - if (_vm->_animation->inField(i + 9)) { + if (_vm->_animation->inField(i + 8)) { MagicType *portal = &_vm->_gyro->_portals[i]; switch (portal->_operation) { case Gyro::kMagicExclaim: @@ -1293,14 +1293,12 @@ void Acci::cardiffClimbing() { _vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_gyro->_standingOnDais = false; _vm->_animation->appearPed(0, 2); - } else { // Clamber down. - if (_vm->_animation->inField(1)) { - _vm->_scrolls->displayText("You clamber up onto the dais."); - _vm->_gyro->_standingOnDais = true; - _vm->_animation->appearPed(0, 1); - } else + } else if (_vm->_animation->inField(0)) { // Clamber down + _vm->_scrolls->displayText("You clamber up onto the dais."); + _vm->_gyro->_standingOnDais = true; + _vm->_animation->appearPed(0, 1); + } else _vm->_scrolls->displayText("Get a bit closer, Avvy."); - } } void Acci::already() { @@ -1350,7 +1348,7 @@ void Acci::standUp() { void Acci::getProc(char thing) { switch (_vm->_gyro->_room) { case kRoomYours: - if (_vm->_animation->inField(2)) { + if (_vm->_animation->inField(1)) { if (_vm->_gyro->_boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->displayText("OK, I've got it."); @@ -1368,7 +1366,7 @@ void Acci::getProc(char thing) { case kRoomInsideCardiffCastle: switch (thing) { case Gyro::kObjectPen: - if (_vm->_animation->inField(2)) { // Standing on the dais. + if (_vm->_animation->inField(1)) { // Standing on the dais. if (_vm->_gyro->_takenPen) _vm->_scrolls->displayText("It's not there, Avvy."); else { @@ -1393,7 +1391,7 @@ void Acci::getProc(char thing) { } break; case kRoomRobins: - if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_mushroomGrowing)) { + if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_mushroomGrowing = false; @@ -1428,7 +1426,7 @@ void Acci::giveGeidaTheLute() { } void Acci::playHarp() { - if (_vm->_animation->inField(7)) + if (_vm->_animation->inField(6)) _vm->_scrolls->musicalScroll(); else _vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); @@ -1884,7 +1882,7 @@ void Acci::doThat() { if (_vm->_gyro->_avariciusTalk > 0) _vm->_scrolls->displayScrollChain('q', 19); else { - if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(2))) { // Avaricius appears! + if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! _vm->_scrolls->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) _vm->_scrolls->displayScrollChain('q', 18); @@ -1940,7 +1938,7 @@ void Acci::doThat() { case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_room) { case kRoomArgentPub: - if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar. + if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. switch (_thing) { case 51: case 53: @@ -2001,7 +1999,7 @@ void Acci::doThat() { break; case kRoomOutsideDucks: - if (_vm->_animation->inField(6)) { + if (_vm->_animation->inField(5)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) _vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things! diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 2327e5129d11..2baa232c56f1 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1350,7 +1350,7 @@ void Animation::flipRoom(byte room, byte ped) { } bool Animation::inField(byte which) { - FieldType *curField = &_vm->_gyro->_fields[which - 1]; // Pascal -> C: different array indexes. + FieldType *curField = &_vm->_gyro->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 398a7a710a52..601adeed4f42 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -530,7 +530,7 @@ Common::String Gyro::f5Does() { return Common::String::format("%cSSit down", Acci::kVerbCodeSit); break; case kRoomMusicRoom: - if (_vm->_animation->inField(7)) + if (_vm->_animation->inField(5)) return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay); break; } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 0f5eb1229661..892dde08bdf6 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -487,7 +487,7 @@ void Timer::jump() { if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->_room == kRoomInsideCardiffCastle) && (_vm->_gyro->_arrowInTheDoor == true) - && (_vm->_animation->inField(3))) { // Beside the wall + && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); From 9d259d0a07f0aefc4488eb2306560760cc486354 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 01:15:47 +0200 Subject: [PATCH 1003/1332] AVALANCHE: fix index in loadMouse, misc cleanup --- engines/avalanche/acci.cpp | 112 +++++++++++++++----------------- engines/avalanche/animation.cpp | 5 +- engines/avalanche/dropdown.cpp | 71 ++++++++------------ engines/avalanche/gyro.cpp | 23 ++++--- engines/avalanche/lucerna.cpp | 20 +++--- engines/avalanche/parser.cpp | 3 +- engines/avalanche/scrolls.cpp | 40 +++++------- 7 files changed, 120 insertions(+), 154 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3f78b16cbe5f..ba8dbbdef921 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -495,20 +495,17 @@ bool Acci::doPronouns() { for (byte i = 0; i < _thats.size(); i++) { byte wordCode = _thats[i]; switch (wordCode) { - case 200: { + case 200: displayWhat(_vm->_gyro->_him, true, ambiguous); _thats.setChar(_vm->_gyro->_him, i); - } break; - case 201: { + case 201: displayWhat(_vm->_gyro->_her, true, ambiguous); _thats.setChar(_vm->_gyro->_her, i); - } break; - case 202: { + case 202: displayWhat(_vm->_gyro->_it, false, ambiguous); _thats.setChar(_vm->_gyro->_it, i); - } break; } } @@ -1735,31 +1732,31 @@ void Acci::doThat() { break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! - if (_vm->_gyro->_wearing != kNothing) { - if (_vm->_gyro->_wearing == _thing) - _vm->_scrolls->displayText("You're already wearing that."); - else - _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); - return; - } else - _vm->_gyro->_wearing = _thing; + if (_vm->_gyro->_wearing != kNothing) { + if (_vm->_gyro->_wearing == _thing) + _vm->_scrolls->displayText("You're already wearing that."); + else + _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); + return; + } else + _vm->_gyro->_wearing = _thing; - _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->refreshObjectList(); - byte i; - if (_thing == Gyro::kObjectHabit) - i = 3; - else - i = 0; - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; - if (spr->_id != i) { - int16 x = spr->_x; - int16 y = spr->_y; - spr->remove(); - spr->init(i, true, _vm->_animation); - spr->appear(x, y, Animation::kDirLeft); - spr->_visible = false; - } + byte i; + if (_thing == Gyro::kObjectHabit) + i = 3; + else + i = 0; + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; + if (spr->_id != i) { + int16 x = spr->_x; + int16 y = spr->_y; + spr->remove(); + spr->init(i, true, _vm->_animation); + spr->appear(x, y, Animation::kDirLeft); + spr->_visible = false; + } } break; default: @@ -1770,40 +1767,39 @@ void Acci::doThat() { case kVerbCodePlay: if (_thing == kPardon) { switch (_vm->_gyro->_room) { // They just typed "play"... - case kRoomArgentPub: { // ...in the pub, => play Nim. - warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); - // play_nim(); - // The following parts are copied from play_nim(). - // The player automatically wins the game everytime he wins, until I implement the mini-game. - - if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_scrolls->displayScrollChain('Q', 6); - return; - } + case kRoomArgentPub: // ...in the pub, => play Nim. + warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); + // play_nim(); + // The following parts are copied from play_nim(). + // The player automatically wins the game everytime he wins, until I implement the mini-game. + + if (_vm->_gyro->_wonNim) { // Already won the game. + _vm->_scrolls->displayScrollChain('Q', 6); + return; + } - if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_scrolls->displayScrollChain('q', 84); - return; - } + if (!_vm->_gyro->_askedDogfoodAboutNim) { + _vm->_scrolls->displayScrollChain('q', 84); + return; + } - _vm->_scrolls->displayScrollChain('Q', 3); - _vm->_gyro->_playedNim++; + _vm->_scrolls->displayScrollChain('Q', 3); + _vm->_gyro->_playedNim++; - // You won - strange! - _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_wonNim = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. - _vm->_lucerna->incScore(7); // 7 points for winning! + // You won - strange! + _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_wonNim = true; + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. + _vm->_lucerna->incScore(7); // 7 points for winning! - if (_vm->_gyro->_playedNim == 1) - _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. + if (_vm->_gyro->_playedNim == 1) + _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. - // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); - } + // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! + _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); break; case kRoomMusicRoom: playHarp(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 2baa232c56f1..f3076da63adc 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -656,7 +656,7 @@ void Animation::catacombMove(byte ped) { // ARCHWAYS: case 0x7: case 0x8: - case 0x9: { + case 0x9: _vm->_celer->drawBackgroundSprite(-1, -1, 6); if (((here & 0xf000) >> 12) > 0x7) @@ -666,8 +666,7 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - } - break; + break; // DECORATIONS: case 0xd: // No connection + WINDOW _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 4c5afe573123..c43a5b08522f 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -399,10 +399,9 @@ void Dropdown::parseKey(char r, char re) { //case 13: // _activeMenuItem.select(_activeMenuItem._highlightNum); // break; - //default: { + //default: // if (_activeMenuItem._activeNow) // _activeMenuItem.parseKey(r); - // } //} warning("STUB: Dropdown::parseKey()"); // To be implemented properly later! Don't remove the comment above! } @@ -467,11 +466,12 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); - for (byte i = 150; i <= 178; i++) + for (byte i = 150; i <= 178; i++) { if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people += i; } + } _activeMenuItem.display(); } @@ -515,16 +515,14 @@ void Dropdown::setupMenuWith() { _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeTalk; switch (_vm->_gyro->_thinks) { case Gyro::kPeopleGeida: - case Gyro::kPeopleArkata: { + case Gyro::kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeKiss; - } - break; - case Gyro::kPeopleDogfood: { + break; + case Gyro::kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodePlay; - } - break; + break; case Gyro::kPeopleMalagauche: { bool isSober = !_vm->_gyro->_teetotal; _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); @@ -533,13 +531,12 @@ void Dropdown::setupMenuWith() { _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 101 + 100 + 102 + 103 + 104; - } - break; - case Gyro::kPeopleTrader: { + } + break; + case Gyro::kPeopleTrader: _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; - } - break; + break; } } _activeMenuItem.display(); @@ -572,18 +569,16 @@ void Dropdown::runMenuFile() { case 0: _vm->_lucerna->callVerb(Acci::kVerbCodeRestart); break; - case 1: { + case 1: if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); _vm->_lucerna->callVerb(Acci::kVerbCodeLoad); - } - break; - case 2: { + break; + case 2: if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); _vm->_lucerna->callVerb(Acci::kVerbCodeSave); - } - break; + break; case 3: //_vm->_basher->filename_edit(); warning("STUB: Dropdown::runMenuFile()"); @@ -601,13 +596,12 @@ void Dropdown::runMenuAction() { Common::String f5Does; // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { - case 0: { + case 0: _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; f5Does = _vm->_gyro->f5Does(); _vm->_lucerna->callVerb(f5Does[0]); - } - break; + break; case 1: _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callVerb(Acci::kVerbCodePause); @@ -629,8 +623,8 @@ void Dropdown::runMenuAction() { else avvy->_speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); - } - break; + } + break; } } @@ -657,48 +651,35 @@ void Dropdown::runMenuWith() { } else { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { - case 100: { // Beer + case 100: // Beer _vm->_acci->_thing = 100; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 101: { // Wine + case 101: // Wine _vm->_acci->_thing = 50; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 102: { // Whisky + case 102: // Whisky _vm->_acci->_thing = 102; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 103: { // Cider + case 103: // Cider _vm->_acci->_thing = 103; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 104: { // Mead + case 104: // Mead _vm->_acci->_thing = 107; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 105: { // Onion (trader) + case 105: // Onion (trader) _vm->_acci->_thing = 67; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - default: { + default: _vm->_acci->_person = _vm->_acci->_thing; _vm->_acci->_thing = Acci::kPardon; _vm->_gyro->_subjectNum = 0; } - } } _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 601adeed4f42..a0403c0bb6dd 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -198,7 +198,7 @@ void Gyro::newMouse(byte id) { return; _currentMouse = id; - loadMouse(id); + loadMouse(id - 1); } /** @@ -550,35 +550,40 @@ void Gyro::loadMouse(byte which) { // The AND mask. - f.seek(kMouseSize * 2 * (which - 1) + 134); + f.seek(kMouseSize * 2 * which + 134); ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) - for (byte i = 0; i < mask.w; i++) - for (byte k = 0; k < 2; k++) + for (byte j = 0; j < mask.h; j++) { + for (byte i = 0; i < mask.w; i++) { + for (byte k = 0; k < 2; k++) { if (*(byte *)mask.getBasePtr(i, j) == 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; + } + } + } mask.free(); // The OR mask. - f.seek(kMouseSize * 2 * (which - 1) + 134 * 2); + f.seek(kMouseSize * 2 * which + 134 * 2); mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) - for (byte i = 0; i < mask.w; i++) + for (byte j = 0; j < mask.h; j++) { + for (byte i = 0; i < mask.w; i++) { for (byte k = 0; k < 2; k++) { byte pixel = *(byte *)mask.getBasePtr(i, j); if (pixel != 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; } + } + } mask.free(); f.close(); - CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); cursor.free(); } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 5ba0e70bc938..0450ea9f36ab 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -387,7 +387,7 @@ void Lucerna::enterNewTown() { if ((_vm->_gyro->_roomCount[kRoomRobins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) _vm->_gyro->_mushroomGrowing = true; break; - case kRoomWiseWomans: { // Entry into Argent. + case kRoomWiseWomans: // Entry into Argent. if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[kRoomWiseWomans] % 3) == 1); _vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; @@ -397,8 +397,7 @@ void Lucerna::enterNewTown() { } if (_vm->_gyro->_boxContent == Gyro::kObjectWine) _vm->_gyro->_wineState = 3; // Vinegar - } - break; + break; } if (_vm->_gyro->_room != kRoomOutsideDucks) { @@ -627,21 +626,18 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { switch (ped) { - case 3: { // Enter from oubliette + case 3: // Enter from oubliette _vm->_gyro->_catacombX = 8; _vm->_gyro->_catacombY = 4; - } - break; - case 5: { // Enter from du Lustie's + break; + case 5: // Enter from du Lustie's _vm->_gyro->_catacombX = 8; _vm->_gyro->_catacombY = 7; - } - break; - case 6: { // Enter from Geida's + break; + case 6: // Enter from Geida's _vm->_gyro->_catacombX = 4; _vm->_gyro->_catacombY = 1; - } - break; + break; } _vm->_gyro->_enterCatacombsFromLustiesRoom = true; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 9be66ef1cf08..e2667b1fc787 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -93,11 +93,10 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { - case Common::KEYCODE_F5: { + case Common::KEYCODE_F5: _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); - } break; case Common::KEYCODE_F7: _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 26aea4bd3750..3e277c997cb6 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -90,13 +90,11 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { int16 i = 0; for (byte xx = 0; xx < lz; xx++) { switch (z[xx]) { - case kControlRoman: { + case kControlRoman: _currentFont = kFontStyleRoman; - } break; - case kControlItalic: { + case kControlItalic: _currentFont = kFontStyleItalic; - } break; default: { for (byte yy = 0; yy < 12; yy++) @@ -370,15 +368,13 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { case 0: iconIndent = 0; break; // No icon. - case 34: { + case 34: drawSign("about", 28, 76, 15); iconIndent = 0; - } break; - case 35: { + case 35: drawSign("gameover", 52, 59, 71); iconIndent = 0; - } break; } @@ -391,17 +387,15 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { if (!_vm->_gyro->_scroll[i].empty()) switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { - case kControlCenter: { + case kControlCenter: centre = true; _vm->_gyro->_scroll[i].deleteLastChar(); - } break; - case kControlLeftJustified: { + case kControlLeftJustified: centre = false; _vm->_gyro->_scroll[i].deleteLastChar(); - } break; - case kControlQuestion: { + case kControlQuestion: //settextjustify(1, 1); _shadowBoxX = mx + lx; _shadowBoxY = my + ly; @@ -410,7 +404,6 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { // inc(diy,14); _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); - } break; } @@ -618,10 +611,9 @@ void Scrolls::callScrollDriver() { case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box - default: { + default: + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = kControlParagraph; - } } uint16 size = _vm->_gyro->_bufSize; @@ -638,7 +630,7 @@ void Scrolls::callScrollDriver() { mouthnext = false; } else { switch (_vm->_gyro->_buffer[i]) { - case kControlParagraph: { + case kControlParagraph: if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; @@ -652,12 +644,11 @@ void Scrolls::callScrollDriver() { if (_vm->_gyro->_scReturn) return; - } - break; + break; case kControlBell: _vm->_gyro->_scrollBells++; break; // #7 = "Bel" - case kControlSpeechBubble: { + case kControlSpeechBubble: if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; @@ -695,8 +686,7 @@ void Scrolls::callScrollDriver() { if (_vm->_gyro->_scReturn) return; - } - break; + break; // CHECME: The whole kControlNegative block seems completely unused, as the only use (the easter egg check) is a false positive case kControlNegative: @@ -760,8 +750,8 @@ void Scrolls::callScrollDriver() { _vm->_lucerna->spriteRun(); call_spriterun = false; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; _vm->_gyro->_scrollNum++; - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion; drawScroll(&Avalanche::Scrolls::scrollModeDialogue); resetScroll(); @@ -834,8 +824,8 @@ void Scrolls::unSkrimble() { } void Scrolls::doTheBubble() { + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } /** From 41afb2dd90caa5dc09a688d253c119e28ef25318 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:00:52 -0500 Subject: [PATCH 1004/1332] ZVISION: Move clearing dirty rects to after they are blitted instead the beginning of each frame --- engines/zvision/render_manager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 1c1ce40c6c4c..a5c659d115bd 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -60,10 +60,6 @@ RenderManager::~RenderManager() { } void RenderManager::update(uint deltaTimeInMillis) { - // Clear the dirty rects from last frame - _workingWindowDirtyRect = Common::Rect(); - _backBufferDirtyRect = Common::Rect(); - // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. if (_backgroundInverseVelocity != 0) { _accumulatedVelocityMilliseconds += deltaTimeInMillis; @@ -93,7 +89,14 @@ void RenderManager::renderBackbufferToScreen() { // Translate the working window dirty rect to screen coords _workingWindowDirtyRect.translate(_workingWindow.left, _workingWindow.top); // Then extend the backbuffer dirty rect to contain it - _backBufferDirtyRect.extend(_workingWindowDirtyRect); + if (_backBufferDirtyRect.isEmpty()) { + _backBufferDirtyRect = _workingWindowDirtyRect; + } else { + _backBufferDirtyRect.extend(_workingWindowDirtyRect); + } + + // Clear the dirty rect + _workingWindowDirtyRect = Common::Rect(); } // TODO: Add menu rendering @@ -103,6 +106,7 @@ void RenderManager::renderBackbufferToScreen() { if (!_backBufferDirtyRect.isEmpty()) { _system->copyRectToScreen(_backBuffer.getBasePtr(_backBufferDirtyRect.left, _backBufferDirtyRect.top), _backBuffer.pitch, _backBufferDirtyRect.left, _backBufferDirtyRect.top, _backBufferDirtyRect.width(), _backBufferDirtyRect.height()); + _backBufferDirtyRect = Common::Rect(); } } From 7ce6823158122d0b1922e675eccf31fd5382f9ef Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:02:57 -0500 Subject: [PATCH 1005/1332] ZVISION: Convert _alphaDataEntries to a HashMap So entries can be easily identified and removed if necessary --- engines/zvision/render_manager.cpp | 32 ++++++++++++++++++------------ engines/zvision/render_manager.h | 7 ++++--- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index a5c659d115bd..c25f670acf77 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -111,25 +111,31 @@ void RenderManager::renderBackbufferToScreen() { } void RenderManager::processAlphaEntries() { - for (Common::List::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + // TODO: Add dirty rectangling support. AKA only draw an entry if the _backbufferDirtyRect intersects/contains the entry Rect + + for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { uint32 destOffset = 0; uint32 sourceOffset = 0; - uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr((*iter).destX + _workingWindow.left, (*iter).destY + _workingWindow.top); - uint16 *entryPtr = (uint16 *)(*iter).data->getPixels(); + uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top); + uint16 *entryPtr = (uint16 *)(*iter)._value.data->getPixels(); - for (int32 y = 0; y < (*iter).height; y++) { - for (int32 x = 0; x < (*iter).width; x++) { + for (int32 y = 0; y < (*iter)._value.height; y++) { + for (int32 x = 0; x < (*iter)._value.width; x++) { uint16 color = entryPtr[sourceOffset + x]; - if (color != (*iter).alphaColor) { + if (color != (*iter)._value.alphaColor) { backbufferPtr[destOffset + x] = color; } } - destOffset += _workingWidth; - sourceOffset += (*iter).width; + destOffset += _backBuffer.w; + sourceOffset += (*iter)._value.width; } - _backBufferDirtyRect.extend(Common::Rect((*iter).destX + _workingWindow.left, (*iter).destY + _workingWindow.top, (*iter).destX + _workingWindow.left + (*iter).width, (*iter).destY + _workingWindow.top + (*iter).height)); + if (_backBufferDirtyRect.isEmpty()) { + _backBufferDirtyRect = Common::Rect((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top, (*iter)._value.destX + _workingWindow.left + (*iter)._value.width, (*iter)._value.destY + _workingWindow.top + (*iter)._value.height); + } else { + _backBufferDirtyRect.extend(Common::Rect((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top, (*iter)._value.destX + _workingWindow.left + (*iter)._value.width, (*iter)._value.destY + _workingWindow.top + (*iter)._value.height)); + } } } @@ -324,7 +330,7 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i assert(_workingWindowDirtyRect.width() <= _workingWidth && _workingWindowDirtyRect.height() <= _workingHeight); } -void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor) { +void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor, uint32 idNumber) { AlphaDataEntry entry; entry.alphaColor = alphaColor; entry.data = new Graphics::Surface(); @@ -347,10 +353,10 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i sourceOffset += imageWidth; } - _alphaDataEntries.push_back(entry); + _alphaDataEntries[idNumber] = entry; } -Common::Rect RenderManager::renderTextToWorkingWindow(const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { +Common::Rect RenderManager::renderTextToWorkingWindow(uint32 idNumber, const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { AlphaDataEntry entry; entry.alphaColor = 0; entry.destX = destX; @@ -361,7 +367,7 @@ Common::Rect RenderManager::renderTextToWorkingWindow(const Common::String &text entry.width = entry.data->w; entry.height = entry.data->h; - _alphaDataEntries.push_back(entry); + _alphaDataEntries[idNumber] = entry; return Common::Rect(destX, destY, destX + entry.width, destY + entry.height); } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 50d2d1076f33..e7030b06fe60 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -25,6 +25,7 @@ #include "common/types.h" #include "common/rect.h" +#include "common/hashmap.h" #include "graphics/surface.h" @@ -67,7 +68,7 @@ class RenderManager { // It's used for panorama/tilt warping and for clearing the workingWindow to a single color Graphics::Surface _workingWindowBuffer; Graphics::Surface _backBuffer; - Common::List _alphaDataEntries; + Common::HashMap _alphaDataEntries; Common::Rect _workingWindowDirtyRect; Common::Rect _backBufferDirtyRect; @@ -123,9 +124,9 @@ class RenderManager { void processAlphaEntries(); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); - void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor); + void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor, uint32 idNumber); - Common::Rect renderTextToWorkingWindow(const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true); + Common::Rect renderTextToWorkingWindow(uint32 idNumber, const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true); /** * Fills the entire workingWindow with the specified color. Internally, the color From cdd793ed224579870daa73061ff0478e179ff21d Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:03:35 -0500 Subject: [PATCH 1006/1332] ZVISION: Check is a dirty rect is empty before extending it So extends dont extend from 0,0 --- engines/zvision/render_manager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index c25f670acf77..13e8cba24061 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -324,7 +324,11 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i sourceOffset += imageWidth; } - _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); + if (_workingWindowDirtyRect.isEmpty()) { + _workingWindowDirtyRect = Common::Rect(destX, destY, destX + width, destY + height); + } else { + _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); + } // TODO: Remove this from release. It's here to make sure code that uses this function clips their destinations correctly assert(_workingWindowDirtyRect.width() <= _workingWidth && _workingWindowDirtyRect.height() <= _workingHeight); From 3a6cb86489c7e0a7c171dbb9d317dd2cdbf4cccf Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:04:03 -0500 Subject: [PATCH 1007/1332] ZVISION: Add methods to clear and remove AlphaEntries --- engines/zvision/render_manager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index e7030b06fe60..2fc3f230dff3 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -122,6 +122,8 @@ class RenderManager { void renderBackbufferToScreen(); void processAlphaEntries(); + void clearAlphaEntries() { _alphaDataEntries.clear(); } + void removeAlphaEntry(uint32 idNumber) { _alphaDataEntries.erase(idNumber); } void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor, uint32 idNumber); From 2187245012c2912fdebc8ec74a52a6488bc6d045 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:04:23 -0500 Subject: [PATCH 1008/1332] ZVISION: Remove all AlphaEntries on room change --- engines/zvision/script_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 1acbcdfcf211..e01498329377 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -329,6 +329,9 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, // Reset the background velocity _engine->getRenderManager()->setBackgroundVelocity(0); + // Remove any alphaEntries + _engine->getRenderManager()->clearAlphaEntries(); + // Clean the global state table cleanStateTable(); From 1f9f392279b05433e265711758bc5ecec65eb08b Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:04:34 -0500 Subject: [PATCH 1009/1332] ZVISION: Enable auto saving --- engines/zvision/script_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index e01498329377..4b4e0f74fe6d 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -309,7 +309,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, debug("Changing location to: %c %c %c %c %u", world, room, node, view, offset); // Auto save - //_engine->getSaveManager()->autoSave(); + _engine->getSaveManager()->autoSave(); // Clear all the containers _referenceTable.clear(); From 4c4f08a99e0b7ff914c6f9c2cb1b38caeba9009f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:05:24 -0500 Subject: [PATCH 1010/1332] ZVISION: Convert cmdRenderText to use new function syntax --- engines/zvision/console.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 3969aa1f1472..0d290a661af8 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -207,7 +207,9 @@ bool Console::cmdRenderText(int argc, const char **argv) { } StringManager::TextStyle style = _engine->getStringManager()->getTextStyle(atoi(argv[2])); - _engine->getRenderManager()->renderTextToWorkingWindow(Common::String(argv[1]), style.font, atoi(argv[3]), atoi(argv[4]), style.color, atoi(argv[5]), -1, Graphics::kTextAlignLeft, atoi(argv[6]) == 0 ? false : true); + _engine->getRenderManager()->renderTextToWorkingWindow(333, Common::String(argv[1]), style.font, atoi(argv[3]), atoi(argv[4]), style.color, atoi(argv[5]), -1, Graphics::kTextAlignLeft, atoi(argv[6]) == 0 ? false : true); + + return true; } } // End of namespace ZVision From 14cfc65c0d3f3ac678c17614140ea32902abec69 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:07:45 -0500 Subject: [PATCH 1011/1332] ZVISION: Use wide-to-ASCII conversion to read a line instead of stream.readLine() SeekableReadStream::readLine() wasn't finding the CRLF's properly --- engines/zvision/string_manager.cpp | 42 ++++++++++++++++++------------ engines/zvision/string_manager.h | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 818b60c73253..127b62f34ee7 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -98,10 +98,10 @@ void StringManager::parseStrFile(const Common::String &fileName) { } } - // STR files add a null character after the CR/LF. We need to skip over that before we can read another line - file.readByte(); + if (textStringCursor > 0) { + _inGameText[lineNumber].fragments.back().text = Common::String(textString, textStringCursor); + } - line = file.readLine(); lineNumber++; } } @@ -199,33 +199,43 @@ void StringManager::parseTag(const Common::String &tagString, const Common::Stri fragment->text = textString; } -Common::String StringManager::wideToASCII(const char *wideStr, uint arrayLength) { - // TODO: Contemplate using a largish static buffer instead of a dynamic heap buffer - uint newSize = arrayLength / 2; - char *asciiString = new char[newSize]; +Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { + // NOTE: Hardcoded size. All strings I've checked are less than 290 chars + char asciiString[300]; // Don't spam the user with warnings about UTF-16 support. // Just do one warning per String bool charOverflowWarning = false; - // Crush each octet pair to a single octet with a simple cast - for (uint i = 0; i < newSize; i++) { - uint16 value = READ_LE_UINT16(wideStr + (i * 2)); + + uint16 value = stream.readUint16LE(); + uint i = 0; + while (!stream.eos()) { + // Check for CRLF + if (value == 0x0A0D) { + // Read in the extra NULL char + stream.readByte(); // \0 + // End of the line. Break + break; + } + + // Crush each octet pair to a single octet with a simple cast if (value > 255) { charOverflowWarning = true; value = 255; } - asciiString[i] = (char)value; + char charValue = (char)value; + + asciiString[i] = charValue; + i++; + + value = stream.readUint16LE(); } if (charOverflowWarning) { warning("UTF-16 is not supported. Characters greater than 255 are clamped to 255"); } - Common::String returnString(asciiString, newSize); - // Cleanup. Common::String constructor does a memmove() internally so we can safely delete - delete[] asciiString; - - return returnString; + return Common::String(asciiString, i); } StringManager::TextStyle StringManager::getTextStyle(uint stringNumber) { diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index a9d2dc1a1d13..a214c6c625be 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -76,7 +76,7 @@ class StringManager { void parseStrFile(const Common::String &fileName); void parseTag(const Common::String &tagString, const Common::String &textString, uint lineNumber); - static Common::String wideToASCII(const char *wideStr, uint arrayLength); + static Common::String readWideLine(Common::SeekableReadStream &stream); }; } // End of namespace ZVision From d59cf9fda66f8bcd89f12248d7337727d708f425 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:10:35 -0500 Subject: [PATCH 1012/1332] ZVISION: Convert StringManager::parseStr to use readWideLine() --- engines/zvision/string_manager.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 127b62f34ee7..1cc3c15fd282 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -63,11 +63,16 @@ void StringManager::parseStrFile(const Common::String &fileName) { return; } - Common::String line = file.readLine(); - uint lineNumber = 0; while (!file.eos()) { - Common::String asciiLine = wideToASCII(line.c_str(), line.size()); + _lastStyle.align = Graphics::kTextAlignLeft; + _lastStyle.color = 0; + _lastStyle.font = nullptr; + + Common::String asciiLine = readWideLine(file); + if (asciiLine.empty()) { + continue; + } char tagString[150]; uint tagStringCursor = 0; @@ -79,16 +84,19 @@ void StringManager::parseStrFile(const Common::String &fileName) { switch (asciiLine[i]) { case '<': inTag = true; + if (!_inGameText[lineNumber].fragments.empty()) { + _inGameText[lineNumber].fragments.back().text = Common::String(textString, textStringCursor); + textStringCursor = 0; + } break; case '>': inTag = false; - parseTag(Common::String(tagString, tagStringCursor), Common::String(textString, textStringCursor), i); + parseTag(Common::String(tagString, tagStringCursor), lineNumber); tagStringCursor = 0; - textStringCursor = 0; break; default: if (inTag) { - textString[tagStringCursor] = asciiLine[i]; + tagString[tagStringCursor] = asciiLine[i]; tagStringCursor++; } else { textString[textStringCursor] = asciiLine[i]; From a2c36a16b52d5bccbfdc141e3f75bfca9aa8535a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:11:52 -0500 Subject: [PATCH 1013/1332] ZVISION: Fix parseTag font name logic --- engines/zvision/string_manager.cpp | 96 ++++++++++++++++-------------- engines/zvision/string_manager.h | 4 +- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 1cc3c15fd282..4c4fc7b1682f 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -114,15 +114,15 @@ void StringManager::parseStrFile(const Common::String &fileName) { } } -void StringManager::parseTag(const Common::String &tagString, const Common::String &textString, uint lineNumber) { +void StringManager::parseTag(const Common::String &tagString, uint lineNumber) { Common::StringTokenizer tokenizer(tagString); Common::String token = tokenizer.nextToken(); Common::String fontName; bool bold = false; - Graphics::TextAlign align = Graphics::kTextAlignLeft; - int point = 12; + Graphics::TextAlign align = _lastStyle.align; + int point = _lastStyle.font != nullptr ? _lastStyle.font->_fontHeight : 12; int red = 0; int green = 0; int blue = 0; @@ -155,56 +155,60 @@ void StringManager::parseTag(const Common::String &tagString, const Common::Stri token = tokenizer.nextToken(); } - Common::String newFontName; - if (fontName.matchString("times new roman", true)) { - if (bold) { - newFontName = "timesbd.ttf"; - } else { - newFontName = "times.ttf"; - } - } else if (fontName.matchString("courier new", true)) { - if (bold) { - newFontName = "courbd.ttf"; - } else { - newFontName = "cour.ttf"; - } - } else if (fontName.matchString("century schoolbook", true)) { - if (bold) { - newFontName = "censcbkbd.ttf"; - } else { - newFontName = "censcbk.ttf"; - } - } else if (fontName.matchString("times new roman", true)) { - if (bold) { - newFontName = "courbd.ttf"; + TextFragment fragment = _inGameText->fragments.back(); + + if (fontName.empty()) { + fragment.style.font = _lastStyle.font; + } else { + Common::String newFontName; + if (fontName.matchString("*times new roman*", true)) { + if (bold) { + newFontName = "timesbd.ttf"; + } else { + newFontName = "times.ttf"; + } + } else if (fontName.matchString("*courier new*", true)) { + if (bold) { + newFontName = "courbd.ttf"; + } else { + newFontName = "cour.ttf"; + } + } else if (fontName.matchString("*century schoolbook*", true)) { + if (bold) { + newFontName = "censcbkbd.ttf"; + } else { + newFontName = "censcbk.ttf"; + } + } else if (fontName.matchString("*garamond*", true)) { + if (bold) { + newFontName = "garabd.ttf"; + } else { + newFontName = "gara.ttf"; + } } else { - newFontName = "cour.ttf"; + debug("Could not identify font: %s. Reverting to Arial", fontName.c_str()); + if (bold) { + newFontName = "zorknorm.ttf"; + } else { + newFontName = "arial.ttf"; + } } - } else { - debug("Could not identify font: %s. Reverting to Arial", fontName.c_str()); - if (bold) { - newFontName = "zorknorm.ttf"; + + Common::String fontKey = Common::String::format("%s-%d", newFontName.c_str(), point); + if (_fonts.contains(fontKey)) { + fragment.style.font = _fonts[fontKey]; } else { - newFontName = "arial.ttf"; + fragment.style.font = new TruetypeFont(_engine, point); + fragment.style.font->loadFile(newFontName); + _fonts[fontKey] = fragment.style.font; } } - // Push an empty TextFragment onto the end of the list - // Creating the TextFragement before filling it prevents extra data copying during creation - _inGameText->fragments.push_back(TextFragment()); - TextFragment *fragment = &_inGameText->fragments.back(); - - Common::String fontKey = Common::String::format("%s-&d", newFontName.c_str(), point); - if (_fonts.contains(fontKey)) { - fragment->style.font = _fonts[fontKey]; - } else { - fragment->style.font = new TruetypeFont(_engine, point); - fragment->style.font->loadFile(newFontName); - } + fragment.style.align = align; + fragment.style.color = _pixelFormat565.ARGBToColor(0, red, green, blue); + _inGameText[lineNumber].fragments.push_back(fragment); - fragment->style.align = align; - fragment->style.color = _pixelFormat565.ARGBToColor(0, red, green, blue); - fragment->text = textString; + _lastStyle = fragment.style; } Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index a214c6c625be..e3539a732c0d 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -68,13 +68,15 @@ class StringManager { static const Graphics::PixelFormat _pixelFormat565; + TextStyle _lastStyle; + public: void initialize(ZVisionGameId gameId); StringManager::TextStyle getTextStyle(uint stringNumber); private: void parseStrFile(const Common::String &fileName); - void parseTag(const Common::String &tagString, const Common::String &textString, uint lineNumber); + void parseTag(const Common::String &tagString, uint lineNumber); static Common::String readWideLine(Common::SeekableReadStream &stream); }; From c7e2bdd2b2730225d1d76b22c71e7733ed61f23c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:12:08 -0500 Subject: [PATCH 1014/1332] ZVISION: Remove extraneous function --- engines/zvision/render_manager.cpp | 16 ---------------- engines/zvision/render_manager.h | 1 - 2 files changed, 17 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 13e8cba24061..7f10535bb27e 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -376,22 +376,6 @@ Common::Rect RenderManager::renderTextToWorkingWindow(uint32 idNumber, const Com return Common::Rect(destX, destY, destX + entry.width, destY + entry.height); } -void RenderManager::copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const { - uint32 destOffset = 0; - uint32 sourceOffset = 0; - uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(subRect.left, subRect.top); - uint16 *destPtr = (uint16 *)destSurface->getBasePtr(destX, destY); - - for (int32 y = 0; y < subRect.height(); y++) { - for (int32 x = 0; x < subRect.width(); x++) { - destPtr[destOffset + x] = workingWindowBufferPtr[sourceOffset + x]; - } - - destOffset += destSurface->w; - sourceOffset += _workingWidth; - } -} - const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { // Convert from screen space to working window space Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 2fc3f230dff3..b0a42d9ba7c0 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -214,7 +214,6 @@ class RenderManager { RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); const Graphics::Surface *getBackBuffer() { return &_backBuffer; } - void copyWorkingWindowSubRectToSurface(Graphics::Surface *destSurface, uint16 destX, uint16 destY, Common::Rect subRect) const; /** * Creates a copy of surface and transposes the data. From 2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:12:45 -0500 Subject: [PATCH 1015/1332] ZVISION: Test for file.open() success before continuing with font loading --- engines/zvision/truetype_font.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index d88f22a727c9..8c5c279e78bb 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -53,11 +53,17 @@ TruetypeFont::~TruetypeFont(void) { bool TruetypeFont::loadFile(const Common::String &filename) { Common::File file; + bool fileOpened = false; if (!Common::File::exists(filename)) { debug("TTF font file %s was not found. Reverting to arial.ttf", filename.c_str()); - file.open("arial.ttf"); + fileOpened = file.open("arial.ttf"); } else { - file.open(filename); + fileOpened = file.open(filename); + } + + if (!fileOpened) { + debug("TTF file could not be opened"); + return false; } _font = Graphics::loadTTFFont(file, _fontHeight); From ff5b7ba2a8102ae04bc2743d88a6d343b7247210 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:14:28 -0500 Subject: [PATCH 1016/1332] ZVISION: Draw string to 0, 0 instead of destX, destY --- engines/zvision/truetype_font.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index 8c5c279e78bb..8fd331df4865 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -82,10 +82,11 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, i if (!wrap) { int width = MIN(_font->getStringWidth(text), maxWidth); surface->create(width, _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - // Copy the pixels from the RenderManager::_workingWindow, so we can get nice antialiasing - _engine->getRenderManager()->copyWorkingWindowSubRectToSurface(surface, 0, 0, Common::Rect(destX, destY, destX + width, destY + _lineHeight)); + // TODO: Add better alpha support by getting the pixels from the backbuffer. + // However doing that requires some kind of caching system so future text doesn't try to use this text as it's alpha background. + surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0); - _font->drawString(surface, text, destX, destY, maxWidth, textColor, align); + _font->drawString(surface, text, 0, 0, maxWidth, textColor, align); return surface; } @@ -100,12 +101,11 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, i } surface->create(maxWidth, lines.size() * _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - // Copy the pixels from the RenderManager::_workingWindow, so we can get nice antialiasing - _engine->getRenderManager()->copyWorkingWindowSubRectToSurface(surface, 0, 0, Common::Rect(destX, destY, destX + maxWidth, destY + lines.size() * _lineHeight)); + surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0); int heightOffset = 0; for (Common::Array::iterator it = lines.begin(); it != lines.end(); it++) { - _font->drawString(surface, *it, destX, destY + heightOffset, maxWidth, textColor, align); + _font->drawString(surface, *it, 0, 0 + heightOffset, maxWidth, textColor, align); heightOffset += (int)_lineHeight; } From 0c28fbca7c49ae70779f1e7aa150c42e7ac1276c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:14:49 -0500 Subject: [PATCH 1017/1332] ZVISION: Remove extraneous empty line --- engines/zvision/truetype_font.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index c8d0a95b2879..ae7732cba42f 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -55,8 +55,7 @@ class TruetypeFont { int32 _fontHeight; public: - bool loadFile(const Common::String &filename); - + bool loadFile(const Common::String &filename); Graphics::Surface *drawTextToSurface(const Common::String &text, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap); }; From 035ee29f1d084316cad130fbc9de66073983c47e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:15:10 -0500 Subject: [PATCH 1018/1332] ZVISION: Initialize StringManager --- engines/zvision/zvision.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 2d14e5d6a821..c8a4cbb0caed 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -125,6 +125,7 @@ void ZVision::initialize() { _cursorManager = new CursorManager(this, &_pixelFormat); _cursorManager->initialize(); _scriptManager->initialize(); + _stringManager->initialize(_gameDescription->gameId); // Create debugger console. It requires GFX to be initialized _console = new Console(this); From 4af62cfd3a9e0826c7303d3a0759fd103f8c92ea Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:15:30 -0500 Subject: [PATCH 1019/1332] ZVISION: Register the "fonts" directory with SearchMan --- engines/zvision/zvision.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index c8a4cbb0caed..b0719086982f 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -103,6 +103,7 @@ void ZVision::initialize() { SearchMan.addSubDirectoryMatching(gameDataDir, "zassets2", 0, 2, true); SearchMan.addSubDirectoryMatching(gameDataDir, "znemmx", 0, 1, true); SearchMan.addSubDirectoryMatching(gameDataDir, "zgi", 0, 4, true); + SearchMan.addSubDirectoryMatching(gameDataDir, "fonts", 0, 1, true); // Find zfs archive files Common::ArchiveMemberList list; From a0a67a2d470816b13bab10371494652d77b23611 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:16:42 -0500 Subject: [PATCH 1020/1332] ZVISION: Partially implement InputControl --- engines/zvision/input_control.cpp | 141 ++++++++++++++++++++++++++++++ engines/zvision/input_control.h | 60 +++++++++++++ engines/zvision/module.mk | 1 + 3 files changed, 202 insertions(+) create mode 100644 engines/zvision/input_control.cpp create mode 100644 engines/zvision/input_control.h diff --git a/engines/zvision/input_control.cpp b/engines/zvision/input_control.cpp new file mode 100644 index 000000000000..ab4cc6bd625c --- /dev/null +++ b/engines/zvision/input_control.cpp @@ -0,0 +1,141 @@ +/* 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/scummsys.h" + +#include "common/str.h" +#include "common/stream.h" +#include "common/rect.h" + +#include "zvision/input_control.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/string_manager.h" +#include "zvision/render_manager.h" +#include "zvision/utility.h" + + +namespace ZVision { + +InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : Control(engine, key), + _nextTabstop(0), + _focused(false), + _textChanged(false), + _cursorOffset(0) { + // Loop until we find the closing brace + Common::String line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + + while (!stream.eos() && !line.contains('}')) { + if (line.matchString("*rectangle*", true)) { + int x1; + int y1; + int x2; + int y2; + + sscanf(line.c_str(), "%*[^(](%d %d %d %d)", &x1, &y1, &x2, &y2); + + _textRectangle = Common::Rect(x1, y1, x2, y2); + } else if (line.matchString("*aux_hotspot*", true)) { + int x1; + int y1; + int x2; + int y2; + + sscanf(line.c_str(), "%*[^(](%d %d %d %d)", &x1, &y1, &x2, &y2); + + _headerRectangle = Common::Rect(x1, y1, x2, y2); + } else if (line.matchString("*string_init*", true)) { + uint fontFormatNumber; + + sscanf(line.c_str(), "%*[^(](%u)", &fontFormatNumber); + + _textStyle = _engine->getStringManager()->getTextStyle(fontFormatNumber); + } else if (line.matchString("*next_tabstop*", true)) { + sscanf(line.c_str(), "%*[^(](%u)", &_nextTabstop); + } else if (line.matchString("*cursor_animation*", true)) { + char fileName[25]; + + sscanf(line.c_str(), "%*[^(](%25s %*u)", fileName); + + _cursorAnimationFileName = Common::String(fileName); + } else if (line.matchString("*cursor_dimensions*", true)) { + // Ignore, use the dimensions in the animation file + } else if (line.matchString("*cursor_animation_frames*", true)) { + // Ignore, use the frame count in the animation file + } else if (line.matchString("*focus*", true)) { + _focused = true; + } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); + } +} + +void InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + _engine->getScriptManager()->focusControl(_key); +} + +void InputControl::onKeyDown(Common::KeyState keyState) { + if (!_focused) { + return; + } + + if (keyState.keycode == Common::KEYCODE_BACKSPACE) { + _currentInputText.deleteLastChar(); + } else if (keyState.keycode == Common::KEYCODE_TAB) { + _focused = false; + // Focus the next input control + _engine->getScriptManager()->focusControl(_nextTabstop); + } else { + // Otherwise, append the new character to the end of the current text + + uint16 asciiValue = keyState.ascii; + // We only care about text values + if (asciiValue >= 32 && asciiValue <= 126) { + _currentInputText += (char)asciiValue; + _textChanged = true; + } + } +} + +bool InputControl::process(uint32 deltaTimeInMillis) { + if (!_focused) { + return false; + } + + // First see if we need to render the text + if (_textChanged) { + // Blit the text using the RenderManager + Common::Rect destRect = _engine->getRenderManager()->renderTextToWorkingWindow(_key, _currentInputText, _textStyle.font, _textRectangle.left, _textRectangle.top, _textStyle.color, _textRectangle.width()); + + _cursorOffset = destRect.left - _textRectangle.left; + } + + // Render the next frame of the animation + // TODO: Implement animation handling + + return false; +} + +} // End of namespace ZVision diff --git a/engines/zvision/input_control.h b/engines/zvision/input_control.h new file mode 100644 index 000000000000..33a1b343137e --- /dev/null +++ b/engines/zvision/input_control.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. + * + */ + +#ifndef ZVISION_INPUT_CONTROL_H +#define ZVISION_INPUT_CONTROL_H + +#include "common/types.h" + +#include "zvision/control.h" +#include "zvision/string_manager.h" + + +namespace ZVision { + +class InputControl : public Control { +public: + InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + +private: + Common::Rect _textRectangle; + Common::Rect _headerRectangle; + StringManager::TextStyle _textStyle; + uint32 _nextTabstop; + Common::String _cursorAnimationFileName; + bool _focused; + + Common::String _currentInputText; + bool _textChanged; + uint _cursorOffset; + +public: + void focus() { _focused = true; } + void unfocus() { _focused = false; } + void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); + void onKeyDown(Common::KeyState keyState); + bool process(uint32 deltaTimeInMillis); +}; + +} // End of namespace ZVision + +#endif diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index cb4a3609e93a..2f2929db676e 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -11,6 +11,7 @@ MODULE_OBJS := \ cursor_manager.o \ detection.o \ events.o \ + input_control.o \ lever_control.o \ lzss_read_stream.o \ push_toggle_control.o \ From 3f19e7a0fbf5da196e37438914e574cc6aee99c6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 16 Sep 2013 14:10:31 +0200 Subject: [PATCH 1021/1332] AVALANCHE: Repair exit condition of the main loop. --- engines/avalanche/avalanche.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 24e5f56dd1e1..75ab53f87084 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -589,7 +589,7 @@ Common::Error AvalancheEngine::run() { // break; //} - } while (!shouldQuit()); + } while (!_gyro->_letMeOut && !shouldQuit()); return Common::kNoError; } From 5f6fc0de6be8cb048e3a757197912d872a7d6e27 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 16 Sep 2013 14:36:30 +0200 Subject: [PATCH 1022/1332] AVALANCHE: Remove unnecessary error() call. --- engines/avalanche/celer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 3d7803465f46..3efcdc48c012 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -335,7 +335,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { } else { Common::File f; if (!f.open(_filename)) // Filename was set in loadBackgroundSprites(). - error("AVALANCHE: Celer: File not found: %s", _filename.c_str()); + return; // We skip because some rooms don't have sprites in the background. f.seek(_offsets[which]); From fe72db6c85d31fdc13e39f3575d63ef061ab8cc9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 16 Sep 2013 16:18:02 +0200 Subject: [PATCH 1023/1332] AVALANCHE: Make Graphics::drawPicture more safe. Fix an index-bug regarding Gyro::_objectList. --- engines/avalanche/dropdown.cpp | 2 +- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/graphics.h | 2 +- engines/avalanche/lucerna.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index c43a5b08522f..edf99ae9a2aa 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -629,7 +629,7 @@ void Dropdown::runMenuAction() { } void Dropdown::runMenuObjects() { - _vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum + 1], Gyro::kThing); + _vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing); } void Dropdown::runMenuPeople() { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 8f51f749e38a..a6cbe3d765ac 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -291,7 +291,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { for (uint16 x = 0; x < picture.w; x++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index a94ed77112dc..41b1016cb486 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -85,7 +85,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); void refreshBackground(); diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 0450ea9f36ab..275375c8adf7 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1004,8 +1004,8 @@ void Lucerna::refreshObjectList() { for (byte i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) { - _vm->_gyro->_carryNum++; _vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; + _vm->_gyro->_carryNum++; } } } From 7f26871be13e64883e1f535f64735a93954ec8d4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 20:19:06 +0200 Subject: [PATCH 1024/1332] AVALANCHE: Remove dead code --- engines/avalanche/avalot.cpp | 1 - engines/avalanche/gyro.cpp | 4 ---- engines/avalanche/gyro.h | 1 - 3 files changed, 6 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 788b41897e03..1330ee51ad51 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -191,7 +191,6 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); - _vm->_gyro->forceNumlock(); _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index a0403c0bb6dd..62dd4a380558 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -378,10 +378,6 @@ bool Gyro::setFlag(char x) { return false; } -void Gyro::forceNumlock() { - warning("STUB: Gyro::force_numlock()"); -} - bool Gyro::decreaseMoney(uint16 howmuchby) { _money -= howmuchby; if (_money < 0) { diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 7785f4fe3a52..977a2e79ae0d 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -388,7 +388,6 @@ class Gyro { void newGame(); // This sets up the DNA for a completely new game. void slowDown(); bool setFlag(char x); - void forceNumlock(); bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. void hangAroundForAWhile(); From 68533445a0c8f308907ad815b28abb2ba558e161 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 20:20:02 +0200 Subject: [PATCH 1025/1332] AVALANCHE: Index conversion related to drawBackgroundSprite() --- engines/avalanche/acci.cpp | 30 ++++----- engines/avalanche/animation.cpp | 110 ++++++++++++++++---------------- engines/avalanche/celer.cpp | 71 ++++++++++----------- engines/avalanche/celer.h | 2 +- engines/avalanche/lucerna.cpp | 44 ++++++------- engines/avalanche/sequence.cpp | 2 +- engines/avalanche/timer.cpp | 26 ++++---- 7 files changed, 141 insertions(+), 144 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index ba8dbbdef921..3b46053e5609 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -871,7 +871,7 @@ bool Acci::isHolding() { void Acci::openBox(bool isOpening) { if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); @@ -880,7 +880,7 @@ void Acci::openBox(bool isOpening) { _vm->_system->delayMillis(55); if (!isOpening) { - _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); @@ -1315,7 +1315,7 @@ void Acci::standUp() { _vm->_gyro->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->_direction = Animation::kDirLeft; - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); @@ -1329,7 +1329,7 @@ void Acci::standUp() { case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) { - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. _vm->_gyro->_sittingInPub = false; // Really not sitting down. @@ -1347,12 +1347,12 @@ void Acci::getProc(char thing) { case kRoomYours: if (_vm->_animation->inField(1)) { if (_vm->_gyro->_boxContent == thing) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_scrolls->displayText("OK, I've got it."); _vm->_gyro->_objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_boxContent = kNothing; - _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); _vm->_scrolls->displayText(tmpStr); @@ -1368,7 +1368,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! _vm->_gyro->_takenPen = true; _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; @@ -1389,7 +1389,7 @@ void Acci::getProc(char thing) { break; case kRoomRobins: if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_mushroomGrowing = false; _vm->_gyro->_takenMushroom = true; @@ -1608,8 +1608,8 @@ void Acci::doThat() { _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; _vm->_gyro->_givenBadgeToIby = true; + _vm->_celer->drawBackgroundSprite(-1, -1, 7); _vm->_celer->drawBackgroundSprite(-1, -1, 8); - _vm->_celer->drawBackgroundSprite(-1, -1, 9); } else heyThanks(); break; @@ -1791,7 +1791,7 @@ void Acci::doThat() { _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. + _vm->_celer->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. _vm->_lucerna->incScore(7); // 7 points for winning! if (_vm->_gyro->_playedNim == 1) @@ -1953,11 +1953,11 @@ void Acci::doThat() { if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 11); _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); _vm->_gyro->_drinking = _thing; - _vm->_celer->drawBackgroundSprite(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; @@ -1978,12 +1978,12 @@ void Acci::doThat() { return; } - _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); @@ -2153,7 +2153,7 @@ void Acci::doThat() { _vm->_gyro->_avvyIsAwake = true; _vm->_lucerna->incScore(1); _vm->_gyro->_avvyInBed = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) _vm->_scrolls->displayScrollChain('d', 13); } else diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f3076da63adc..3bd3bde1a3d5 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -464,59 +464,59 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); + _vm->_celer->drawBackgroundSprite(-1, -1, 27); break; case 0x1: // no connection (wall + shield), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x2: // wall with door _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. + _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. @@ -531,44 +531,44 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); + _vm->_celer->drawBackgroundSprite(-1, -1, 18); break; case 0x1: // no connection (wall + window), _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // ...window. break; case 0x2: // wall with door _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. _vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. @@ -586,7 +586,7 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x1: - _vm->_celer->drawBackgroundSprite(-1, -1, 22); + _vm->_celer->drawBackgroundSprite(-1, -1, 21); if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) _vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; @@ -597,13 +597,13 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; break; case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 23); + _vm->_celer->drawBackgroundSprite(-1, -1, 22); _vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x3: - _vm->_celer->drawBackgroundSprite(-1, -1, 24); + _vm->_celer->drawBackgroundSprite(-1, -1, 23); _vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; @@ -624,7 +624,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; @@ -642,7 +642,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x5: - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; @@ -657,12 +657,12 @@ void Animation::catacombMove(byte ped) { case 0x7: case 0x8: case 0x9: - _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->drawBackgroundSprite(-1, -1, 31); + _vm->_celer->drawBackgroundSprite(-1, -1, 30); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->drawBackgroundSprite(-1, -1, 32); + _vm->_celer->drawBackgroundSprite(-1, -1, 31); _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. @@ -671,50 +671,50 @@ void Animation::catacombMove(byte ped) { case 0xd: // No connection + WINDOW _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 14); + _vm->_celer->drawBackgroundSprite(-1, -1, 13); break; case 0xe: // No connection + TORCH _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 7); break; // Recessed door: case 0xf: _vm->_gyro->_magics[0]._operation = Gyro::kMagicNothing; // Door to Geida's room. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; } switch (xy_uint16) { case 514: - _vm->_celer->drawBackgroundSprite(-1, -1, 17); + _vm->_celer->drawBackgroundSprite(-1, -1, 16); break; // [2,2] : "Art Gallery" sign over door. case 264: - _vm->_celer->drawBackgroundSprite(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; // [8,1] : "The Wrong Way!" sign. case 1797: - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); break; // [5,7] : "Ite Mingite" sign. case 258: for (int i = 0; i <= 2; i++) { // [2,1] : Art gallery - pictures - _vm->_celer->drawBackgroundSprite(130 + i * 120, 70, 15); - _vm->_celer->drawBackgroundSprite(184 + i * 120, 78, 16); + _vm->_celer->drawBackgroundSprite(130 + i * 120, 70, 14); + _vm->_celer->drawBackgroundSprite(184 + i * 120, 78, 15); } break; case 1287: for (int i = 10; i <= 13; i++) - _vm->_celer->drawBackgroundSprite(-1, -1, i); + _vm->_celer->drawBackgroundSprite(-1, -1, i - 1); break; // [7,5] : 4 candles. case 776: - _vm->_celer->drawBackgroundSprite(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); break; // [8,3] : 1 candle. case 2049: - _vm->_celer->drawBackgroundSprite(-1, -1, 11); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); break; // [1,8] : another candle. case 257: + _vm->_celer->drawBackgroundSprite(-1, -1, 11); _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_celer->drawBackgroundSprite(-1, -1, 13); break; // [1,1] : the other two. } @@ -735,7 +735,7 @@ void Animation::dawnDelay() { void Animation::callSpecial(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); _vm->_gyro->_brummieStairs = 1; _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); @@ -782,7 +782,7 @@ void Animation::callSpecial(uint16 which) { _vm->_scrolls->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_scrolls->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; @@ -1075,7 +1075,7 @@ void Animation::arrowProcs(byte tripnum) { } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_gyro->_arrowInTheDoor = true; // So that we can pick it up. } @@ -1301,7 +1301,7 @@ void Animation::hideInCupboard() { "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_avvysInTheCupboard = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 7); } } diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 3efcdc48c012..f6e3773ae321 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -60,19 +60,19 @@ void Celer::updateBackgroundSprites() { switch (_vm->_gyro->_room) { case kRoomOutsideArgentPub: if ((_vm->_gyro->_roomTime % 12) == 0) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 4); + drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 4); break; case kRoomBrummieRoad: if ((_vm->_gyro->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 2) % 4); + drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 2) % 4); break; case kRoomBridge: if ((_vm->_gyro->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->_roomTime / 2) % 4); + drawBackgroundSprite(-1, -1, 3 + (_vm->_gyro->_roomTime / 2) % 4); break; case kRoomYours: if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 12) % 2); + drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 2); break; case kRoomArgentPub: if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { @@ -82,16 +82,16 @@ void Celer::updateBackgroundSprites() { case 1: case 11: case 21: - drawBackgroundSprite(-1, -1, 12); // Looks forwards. + drawBackgroundSprite(-1, -1, 11); // Looks forwards. break; case 8: case 18: case 28: case 32: - drawBackgroundSprite(-1, -1, 11); // Looks at you. + drawBackgroundSprite(-1, -1, 10); // Looks at you. break; case 30: - drawBackgroundSprite(-1, -1, 13); // Winks. + drawBackgroundSprite(-1, -1, 12); // Winks. break; case 33: _vm->_gyro->_malagauche = 0; @@ -102,14 +102,14 @@ void Celer::updateBackgroundSprites() { switch (_vm->_gyro->_roomTime % 200) { case 179: case 197: - drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle. break; case 182: case 194: - drawBackgroundSprite(-1, -1, 6); + drawBackgroundSprite(-1, -1, 5); break; case 185: - drawBackgroundSprite(-1, -1, 7); + drawBackgroundSprite(-1, -1, 6); break; case 199: _vm->_gyro->_npcFacing = 177; // Impossible value for this. @@ -127,7 +127,7 @@ void Celer::updateBackgroundSprites() { direction = 4; if (direction != _vm->_gyro->_npcFacing) { // Dogfood. - drawBackgroundSprite(-1, -1, direction); + drawBackgroundSprite(-1, -1, direction - 1); _vm->_gyro->_npcFacing = direction; } } @@ -136,16 +136,16 @@ void Celer::updateBackgroundSprites() { if ((_vm->_gyro->_roomTime % 3) == 0) { switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { case 4: - drawBackgroundSprite(-1, -1, 1); + drawBackgroundSprite(-1, -1, 0); break; case 1: case 3: case 5: - drawBackgroundSprite(-1, -1, 2); + drawBackgroundSprite(-1, -1, 1); break; case 0: case 2: - drawBackgroundSprite(-1, -1, 3); + drawBackgroundSprite(-1, -1, 2); break; } } @@ -165,7 +165,7 @@ void Celer::updateBackgroundSprites() { direction = 3; // Right. if (direction != _vm->_gyro->_npcFacing) { // du Lustie. - drawBackgroundSprite(-1, -1, direction); + drawBackgroundSprite(-1, -1, direction - 1); _vm->_gyro->_npcFacing = direction; } } @@ -174,10 +174,10 @@ void Celer::updateBackgroundSprites() { if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { switch ((_vm->_gyro->_roomTime / 14) % 2) { case 0: - drawBackgroundSprite(-1, -1, 1); // Frame 2: EGA. + drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA. break; case 1: - drawBackgroundSprite(-1, -1, 3); // Frame 1: Natural. + drawBackgroundSprite(-1, -1, 2); // Frame 1: Natural. break; } } @@ -186,10 +186,10 @@ void Celer::updateBackgroundSprites() { if (_vm->_gyro->_tiedUp) { switch (_vm->_gyro->_roomTime % 54) { case 20: - drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. + drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks. break; case 23: - drawBackgroundSprite(-1, -1, 2); // Frame 1: Back to normal. + drawBackgroundSprite(-1, -1, 1); // Frame 1: Back to normal. break; } } @@ -209,23 +209,23 @@ void Celer::updateBackgroundSprites() { direction--; // Blinks. if (direction != _vm->_gyro->_npcFacing) { // Port. - drawBackgroundSprite(-1, -1, direction); + drawBackgroundSprite(-1, -1, direction - 1); _vm->_gyro->_npcFacing = direction; } switch (_vm->_gyro->_roomTime % 50) { case 45 : - drawBackgroundSprite(-1, -1, 9); // Spurge blinks. + drawBackgroundSprite(-1, -1, 8); // Spurge blinks. break; case 49 : - drawBackgroundSprite(-1, -1, 10); + drawBackgroundSprite(-1, -1, 9); break; } break; } case kRoomDucks: { if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->_roomTime / 3) % 3); + drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; @@ -241,7 +241,7 @@ void Celer::updateBackgroundSprites() { direction++; // Duck blinks. if (direction != _vm->_gyro->_npcFacing) { // Duck. - drawBackgroundSprite(-1, -1, direction); + drawBackgroundSprite(-1, -1, direction - 1); _vm->_gyro->_npcFacing = direction; } break; @@ -321,23 +321,23 @@ void Celer::forgetBackgroundSprites() { } } -void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { - which--; // For the difference between the Pascal and C array indexes. - //setactivepage(3); - warning("STUB: Celer::show_one()"); - - if (_sprites[which]._x > kOnDisk) { +/** + * Draw background animation + * @remarks Originally called 'show_one' + */ +void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { + if (_sprites[sprId]._x > kOnDisk) { if (destX < 0) { - destX = _sprites[which]._x * 8; - destY = _sprites[which]._y; + destX = _sprites[sprId]._x * 8; + destY = _sprites[sprId]._y; } - drawSprite(destX, destY, _sprites[which]); + drawSprite(destX, destY, _sprites[sprId]); } else { Common::File f; if (!f.open(_filename)) // Filename was set in loadBackgroundSprites(). return; // We skip because some rooms don't have sprites in the background. - f.seek(_offsets[which]); + f.seek(_offsets[sprId]); SpriteType sprite; sprite._type = PictureType(f.readByte()); @@ -358,9 +358,6 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { sprite._picture.free(); f.close(); } - - //setactivepage(1 - cp); - warning("STUB: Celer::show_one()"); } diff --git a/engines/avalanche/celer.h b/engines/avalanche/celer.h index 47a11bfad495..538a76595612 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/celer.h @@ -51,7 +51,7 @@ class Celer { // Setting the destination to negative coordinates means the picture should be drawn to it's original position. // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. - void drawBackgroundSprite(int16 destX, int16 destY, byte which); + void drawBackgroundSprite(int16 destX, int16 destY, byte sprId); private: enum PictureType {kEga, kBgi, kNaturalImage}; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 275375c8adf7..3fdca0c561e3 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -445,7 +445,7 @@ void Lucerna::enterRoom(byte room, byte ped) { switch (room) { case kRoomYours: if (_vm->_gyro->_avvyInBed) { - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } @@ -545,7 +545,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomBridge: if (_vm->_gyro->_drawbridgeOpen == 4) { // open - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Position of drawbridge + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge _vm->_graphics->refreshBackground(); _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. } @@ -571,10 +571,10 @@ void Lucerna::enterRoom(byte room, byte ped) { } if (_vm->_gyro->_tiedUp) - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); if (!_vm->_gyro->_mushroomGrowing) - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; @@ -648,11 +648,11 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomArgentPub: if (_vm->_gyro->_wonNim) - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // No lute by the settle. + _vm->_celer->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. _vm->_gyro->_malagauche = 0; // Ready to boot Malagauche if (_vm->_gyro->_givenBadgeToIby) { + _vm->_celer->drawBackgroundSprite(-1, -1, 7); _vm->_celer->drawBackgroundSprite(-1, -1, 8); - _vm->_celer->drawBackgroundSprite(-1, -1, 9); } _vm->_graphics->refreshBackground(); break; @@ -668,7 +668,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_geidaFollows) { putGeidaAt(4, ped); if (_vm->_gyro->_lustieIsAsleep) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_graphics->refreshBackground(); } } @@ -677,14 +677,14 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomMusicRoom: if (_vm->_gyro->_jacquesState > 0) { _vm->_gyro->_jacquesState = 5; - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_magics[kColorBrown - 1]._operation = Gyro::kMagicNothing; _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; } if (ped != 0) { - _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -695,7 +695,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomOutsideNottsPub: if (ped == 2) { - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->thenShow(2); @@ -707,7 +707,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomOutsideArgentPub: if (ped == 2) { - _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -735,7 +735,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(1); if (_vm->_gyro->_arrowInTheDoor) @@ -744,22 +744,22 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_sequence->thenShow(2); if (_vm->_gyro->_takenPen) - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_sequence->startToClose(); } else { - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); if (_vm->_gyro->_arrowInTheDoor) - _vm->_celer->drawBackgroundSprite(-1, -1, 3); - else _vm->_celer->drawBackgroundSprite(-1, -1, 2); + else + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); } break; case kRoomAvvysGarden: if (ped == 1) { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -780,7 +780,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_sequence->start_to_close(); #endif - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -791,7 +791,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomAylesOffice: if (_vm->_gyro->_aylesIsAwake) - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); break; // Ayles awake. @@ -812,14 +812,14 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_npcFacing = 1; // Port. break; case kRoomOutsideDucks: if (ped == 2) { // Shut the door - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->firstShow(2); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 0e6d72acdd9f..1b55e885890b 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -98,7 +98,7 @@ void Sequence::callSequencer() { if ((_seq[0] >= 1) && (_seq[0] <= 176)) { // Show a frame. - _vm->_celer->drawBackgroundSprite(-1, -1, _seq[0]); + _vm->_celer->drawBackgroundSprite(-1, -1, _seq[0] - 1); shoveLeft(); } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 892dde08bdf6..8c169c5a9f2e 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -232,7 +232,7 @@ void Timer::loseTimer(byte which) { void Timer::openDrawbridge() { _vm->_gyro->_drawbridgeOpen++; - _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 1); + _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); if (_vm->_gyro->_drawbridgeOpen == 4) _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. @@ -274,7 +274,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_gyro->blip(); _vm->_animation->_sprites[0].walkTo(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_brummieStairs = 2; _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. @@ -393,17 +393,17 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. + _vm->_celer->drawBackgroundSprite(-1, -1, 0); // Eyes open. _vm->_scrolls->displayScrollChain('Q', 45); break; case 2 : // Going through the door. - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Not on the floor. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // But going through the door. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! break; } @@ -433,7 +433,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon spr->walkTo(2); // He walks over to you. // Let's get the door opening. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); @@ -449,7 +449,7 @@ void Timer::naughtyDuke2() { } void Timer::naughtyDuke3() { - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); } @@ -492,7 +492,7 @@ void Timer::jump() { if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); else { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -508,7 +508,7 @@ void Timer::crapulusSaysSpludOut() { } void Timer::buyDrinks() { - _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. @@ -520,7 +520,7 @@ void Timer::buyDrinks() { } void Timer::buyWine() { - _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. @@ -630,7 +630,7 @@ void Timer::avvySitDown() { if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_sittingInPub = true; _vm->_gyro->_userMovesAvvy = false; avvy->_visible = false; From 6e08f55160eb9048d892d0b2f13cf4eb12206cc3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 Sep 2013 22:57:38 +0200 Subject: [PATCH 1026/1332] AVALANCHE: Review all for statements --- engines/avalanche/acci.cpp | 38 ++++++++++---------- engines/avalanche/animation.cpp | 18 +++++----- engines/avalanche/avalanche.cpp | 14 ++++---- engines/avalanche/avalot.cpp | 6 ++-- engines/avalanche/celer.cpp | 6 ++-- engines/avalanche/detection.cpp | 4 +-- engines/avalanche/dropdown.cpp | 22 ++++++------ engines/avalanche/graphics.cpp | 28 +++++++-------- engines/avalanche/gyro.cpp | 18 +++++----- engines/avalanche/lucerna.cpp | 62 ++++++++++++++++----------------- engines/avalanche/parser.cpp | 2 +- engines/avalanche/pingo.cpp | 2 +- engines/avalanche/scrolls.cpp | 22 ++++++------ engines/avalanche/timer.cpp | 6 ++-- 14 files changed, 124 insertions(+), 124 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3b46053e5609..b607478ba95a 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -370,7 +370,7 @@ void Acci::init() { } void Acci::clearWords() { - for (byte i = 0; i < 11; i++) { + for (int i = 0; i < 11; i++) { if (!_realWords[i].empty()) _realWords[i].clear(); } @@ -400,7 +400,7 @@ void Acci::replace(Common::String oldChars, byte newChar) { if (newChar == 0) _thats.deleteChar(pos); else { - for (byte i = pos; i < pos + oldChars.size(); i++) + for (uint i = pos; i < pos + oldChars.size(); i++) _thats.deleteChar(pos); _thats.insertChar(newChar, pos); } @@ -417,7 +417,7 @@ Common::String Acci::rank() { {32767, "copyright'93"} }; - for (byte i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } @@ -458,7 +458,7 @@ void Acci::cheatParse(Common::String codes) { void Acci::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - for (byte i = 0; i < 32; i++) { + for (int i = 0; i < 32; i++) { for (;;) { int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); if (pos == -1) @@ -492,7 +492,7 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { bool Acci::doPronouns() { bool ambiguous = false; - for (byte i = 0; i < _thats.size(); i++) { + for (uint i = 0; i < _thats.size(); i++) { byte wordCode = _thats[i]; switch (wordCode) { case 200: @@ -517,7 +517,7 @@ void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); // We set every word's first character to uppercase. - for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { + for (uint i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { if (_vm->_parser->_inputText[i] == ' ') _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); } @@ -644,7 +644,7 @@ void Acci::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { - for (byte i = 0; i < 31; i++) { + for (int i = 0; i < 31; i++) { if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; @@ -666,13 +666,13 @@ void Acci::parse() { // Delete words we already processed. int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); if (spacePos > -1) { - for (byte i = 0; i <= spacePos; i++) + for (int i = 0; i <= spacePos; i++) inputTextUpper.deleteChar(0); } spacePos = _vm->_parser->pos(Common::String(' '), inputText); if (spacePos > -1) { - for (byte i = 0; i <= spacePos; i++) + for (int i = 0; i <= spacePos; i++) inputText.deleteChar(0); } } @@ -911,7 +911,7 @@ void Acci::inventory() { byte itemNum = 0; Common::String tmpStr = Common::String("You're carrying "); - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) { itemNum++; if (itemNum == _vm->_gyro->_carryNum) @@ -993,7 +993,7 @@ void Acci::swallow() { // Eat something. void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! + for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) numPeople++; } @@ -1003,7 +1003,7 @@ void Acci::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. - for (byte i = 1; i < 29; i++) { + for (int i = 1; i < 29; i++) { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { actPerson++; if (actPerson == 1) // First on the list. @@ -1087,7 +1087,7 @@ void Acci::openDoor() { if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { MagicType *portal = &_vm->_gyro->_portals[i]; switch (portal->_operation) { @@ -1453,7 +1453,7 @@ Common::String Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. Common::String tmpStr; - for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i); found = true; @@ -1463,7 +1463,7 @@ Common::String Acci::personSpeaks() { if (found) return tmpStr; - for (byte i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); } @@ -1550,7 +1550,7 @@ void Acci::doThat() { } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); - for (byte i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; _verb = _vm->_gyro->_subjectNum; @@ -1701,7 +1701,7 @@ void Acci::doThat() { _vm->_scrolls->_aboutScroll = true; Common::String toDisplay; - for (byte i = 0; i < 7; i++) + for (int i = 0; i < 7; i++) toDisplay += Scrolls::kControlNewLine; toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Scrolls::kControlCenter + Scrolls::kControlNewLine + "The medi\x91val descendant of" + Scrolls::kControlNewLine @@ -2068,11 +2068,11 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('Q', 12); else { bool ok = true; - for (byte i = 0; i < _thats.size(); i++) { + for (uint i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; - for (byte j = 0; j < _vocabulary[pwdId]._word.size(); j++) { + for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 3bd3bde1a3d5..edcc53cdcf78 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -70,13 +70,13 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { if (!_stat._name.empty()) _stat._name.clear(); byte nameSize = inf.readByte(); - for (byte i = 0; i < nameSize; i++) + for (int i = 0; i < nameSize; i++) _stat._name += inf.readByte(); inf.skip(12 - nameSize); //inf.skip(1); // Same as above. byte commentSize = inf.readByte(); - for (byte i = 0; i < commentSize; i++) + for (int i = 0; i < commentSize; i++) _stat._comment += inf.readByte(); inf.skip(16 - commentSize); @@ -93,10 +93,10 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _stat._frameNum; i++) { _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; _info._mani[_animCount] = new ManiType[_info._size - 6]; - for (byte j = 0; j <= _info._yLength; j++) + for (int j = 0; j <= _info._yLength; j++) inf.read((*_info._sil[_animCount])[j], _info._xWidth); inf.read(*_info._mani[_animCount], _info._size - 6); @@ -163,7 +163,7 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { * @remarks Originally called 'collision_check' */ bool AnimationType::checkCollision() { - for (byte i = 0; i < _anim->kSpriteNumbMax; i++) { + for (int i = 0; i < _anim->kSpriteNumbMax; i++) { AnimationType *spr = &_anim->_sprites[i]; if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) return true; @@ -343,7 +343,7 @@ void AnimationType::remove() { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _stat._frameNum; i++) { assert(_animCount > 0); _animCount--; delete[] _info._mani[_animCount]; @@ -1200,7 +1200,7 @@ void Animation::drawSprites() { do { ok = true; - for (byte i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { if (((order[i] != -1) && (order[i + 1] != -1)) && (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) { // Swap them! @@ -1215,7 +1215,7 @@ void Animation::drawSprites() { _vm->_graphics->refreshBackground(); - for (byte i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { if (order[i] > -1) _sprites[order[i]].draw(); } @@ -1364,7 +1364,7 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - for (byte i = 8; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 8; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) return true; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 75ab53f87084..33c72c848fa9 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -121,7 +121,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_animation->_direction); sz.syncAsByte(_gyro->_carryNum); - for (byte i = 0; i < kObjectNum; i++) + for (int i = 0; i < kObjectNum; i++) sz.syncAsByte(_gyro->_objects[i]); sz.syncAsSint16LE(_gyro->_dnascore); sz.syncAsSint32LE(_gyro->_money); @@ -262,7 +262,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { #if 0 - for (byte groi = 0; groi < numtr; groi++) { + for (int groi = 0; groi < numtr; groi++) { if (tr[groi].quick) { blockwrite(f, groi, 1); tr[groi].savedata(f); @@ -272,7 +272,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { + for (int i = 0; i < _animation->kSpriteNumbMax; i++) { if (_animation->_sprites[i]._quick) spriteNum++; } @@ -280,14 +280,14 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + for (int i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. AnimationType *spr = &_animation->_sprites[i]; if (spr->_quick) spr->remove(); } } - for (byte i = 0; i < spriteNum; i++) { + for (int i = 0; i < spriteNum; i++) { AnimationType *spr = &_animation->_sprites[i]; sz.syncAsByte(spr->_id); sz.syncAsByte(spr->_doCheck); @@ -324,7 +324,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, groi, 1); //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); sz.syncAsByte(_timer->_times[i]._action); sz.syncAsByte(_timer->_times[i]._reason); @@ -396,7 +396,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += f->readByte(); if (signature != "AVAL") return false; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 1330ee51ad51..2d93ed89546a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -149,7 +149,7 @@ void Avalot::setup() { _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. _vm->_animation->loadAnims(); @@ -198,12 +198,12 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { LineType *curLine = &_vm->_gyro->_lines[i]; _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); } - for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; if (curField->_x1 < 640) _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index f6e3773ae321..6edb4d2bb429 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -272,10 +272,10 @@ void Celer::loadBackgroundSprites(byte number) { f.seek(44); _spriteNum = f.readByte(); - for (byte i = 0; i < _spriteNum; i++) + for (int i = 0; i < _spriteNum; i++) _offsets[i] = f.readSint32LE(); - for (byte i = 0; i < _spriteNum; i++) { + for (int i = 0; i < _spriteNum; i++) { f.seek(_offsets[i]); SpriteType sprite; @@ -315,7 +315,7 @@ void Celer::loadBackgroundSprites(byte number) { } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _spriteNum; i++) { + for (int i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); } diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 97b823eb1d1a..6e34a5afb9cc 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -128,7 +128,7 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { if (file) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += file->readByte(); if (signature != "AVAL") { warning("Savegame of incompatible type!"); @@ -176,7 +176,7 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, if (f) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += f->readByte(); if (signature != "AVAL") { warning("Savegame of incompatible type!"); diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index edf99ae9a2aa..d088654c6a38 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -143,7 +143,7 @@ void MenuItem::display() { _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); displayOption(0, true); - for (byte y = 1; y < _optionNum; y++) + for (int y = 1; y < _optionNum; y++) displayOption(y, false); _dr->_vm->_gyro->_defaultLed = 1; @@ -209,7 +209,7 @@ void MenuItem::select(byte which) { void MenuItem::parseKey(char c) { c = toupper(c); bool found = false; - for (byte i = 0; i < _optionNum; i++) { + for (int i = 0; i < _optionNum; i++) { if ((toupper(_options[i]._trigger) == c) && _options[i]._valid) { select(i); found = true; @@ -237,7 +237,7 @@ void MenuBar::draw() { byte savecp = _dr->_vm->_gyro->_cp; _dr->_vm->_gyro->_cp = 3; - for (byte i = 0; i < _menuNum; i++) + for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); _dr->_vm->_gyro->_cp = savecp; @@ -325,12 +325,12 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, ander = 170; FontType font; - for (byte i = 0; i < text.size(); i++) { - for (byte j = 0; j < 8; j++) { + for (uint i = 0; i < text.size(); i++) { + for (int j = 0; j < 8; j++) { byte idx = text[i]; font[idx][j] = _vm->_gyro->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. - for (byte k = 0; k < 8; k++) + for (int k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; } } @@ -346,7 +346,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, ; // Search for the character in the string. byte pixel = ander; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; @@ -438,7 +438,7 @@ void Dropdown::setupMenuAction() { _activeMenuItem.reset(); Common::String f5Does = _vm->_gyro->f5Does(); - for (byte i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); if (f5Does.empty()) @@ -466,7 +466,7 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); - for (byte i = 150; i <= 178; i++) { + for (int i = 150; i <= 178; i++) { if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people += i; @@ -478,7 +478,7 @@ void Dropdown::setupMenuPeople() { void Dropdown::setupMenuObjects() { _activeMenuItem.reset(); - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) _activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); } @@ -491,7 +491,7 @@ void Dropdown::setupMenuWith() { if (_vm->_gyro->_thinkThing) { findWhatYouCanDoWithIt(); - for (byte i = 0; i < _vm->_gyro->_verbStr.size(); i++) { + for (uint i = 0; i < _vm->_gyro->_verbStr.size(); i++) { char vbchar; Common::String verb; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a6cbe3d765ac..5b5d39ec6c1b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -62,7 +62,7 @@ void Graphics::init() { _egaPalette[i][2] = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; } - for (byte i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -176,7 +176,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte // Get the top and the bottom of the triangle. uint16 maxY = p[0].y, minY = p[0].y; - for (byte i = 1; i < 3; i++) { + for (int i = 1; i < 3; i++) { if (p[i].y < minY) minY = p[i].y; if (p[i].y > maxY) @@ -206,10 +206,10 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte } void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { - for (byte i = 0; i < text.size(); i++) { - for (byte j = 0; j < fontHeight; j++) { + for (uint i = 0; i < text.size(); i++) { + for (int j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) *(byte *)surface.getBasePtr(x + i * 8 + 7 - bit, y + j) = color; @@ -228,11 +228,11 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (byte y = 0; y < height; y++) { + for (int y = 0; y < height; y++) { for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); @@ -251,11 +251,11 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); - for (byte plane = 0; plane < 4; plane++) { + for (int plane = 0; plane < 4; plane++) { for (uint16 y = 0; y < height; y++) { for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); - for (byte i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } @@ -268,8 +268,8 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the spirte blank. - for (byte j = 0; j < sprite._yLength; j++) { - for (byte i = 0; i < sprite._xLength; i++) { + for (int j = 0; j < sprite._yLength; j++) { + for (int i = 0; i < sprite._xLength; i++) { if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *(byte *)_surface.getBasePtr(x + i, y + j) = 0; } @@ -278,11 +278,11 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (byte j = 0; j < sprite._yLength; j++) { + for (int j = 0; j < sprite._yLength; j++) { for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 i = 0; i < sprite._xLength; i += 8) { byte pixel = (*sprite._mani[picnum])[maniPos++]; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); } @@ -304,7 +304,7 @@ void Graphics::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { for (uint16 x = 0; x < _screen.w; x++) { - for (byte j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); } } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 62dd4a380558..2cb9d0e6e8b7 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -182,7 +182,7 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { } Gyro::~Gyro() { - for (byte i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { _digits[i].free(); _directions[i].free(); } @@ -309,7 +309,7 @@ void Gyro::resetVariables() { } void Gyro::newGame() { - for (byte i = 0; i < kMaxSprites; i++) { + for (int i = 0; i < kMaxSprites; i++) { AnimationType *spr = &_vm->_animation->_sprites[i]; if (spr->_quick) spr->remove(); @@ -550,9 +550,9 @@ void Gyro::loadMouse(byte which) { ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) { - for (byte i = 0; i < mask.w; i++) { - for (byte k = 0; k < 2; k++) { + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { if (*(byte *)mask.getBasePtr(i, j) == 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; } @@ -566,9 +566,9 @@ void Gyro::loadMouse(byte which) { mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) { - for (byte i = 0; i < mask.w; i++) { - for (byte k = 0; k < 2; k++) { + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { byte pixel = *(byte *)mask.getBasePtr(i, j); if (pixel != 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; @@ -588,7 +588,7 @@ void Gyro::setBackgroundColor(byte x) { } void Gyro::hangAroundForAWhile() { - for (byte i = 0; i < 28; i++) + for (int i = 0; i < 28; i++) slowDown(); } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 3fdca0c561e3..2b75d5abcc35 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -117,8 +117,8 @@ Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { } Lucerna::~Lucerna() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; @@ -128,8 +128,8 @@ Lucerna::~Lucerna() { } void Lucerna::init() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) _vm->_gyro->_also[i][j] = 0; } @@ -165,7 +165,7 @@ void Lucerna::drawAlsoLines() { _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { // We had to check if the lines are within the borders of the screen. if ((_vm->_gyro->_lines[i]._x1 >= 0) && (_vm->_gyro->_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y1 >= 0) && (_vm->_gyro->_lines[i]._y1 < _vm->_graphics->kScreenHeight) && (_vm->_gyro->_lines[i]._x2 >= 0) && (_vm->_gyro->_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y2 >= 0) && (_vm->_gyro->_lines[i]._y2 < _vm->_graphics->kScreenHeight)) @@ -195,8 +195,8 @@ void Lucerna::scram(Common::String &str) { } void Lucerna::unScramble() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) scram(*_vm->_gyro->_also[i][j]); } @@ -206,8 +206,8 @@ void Lucerna::unScramble() { } void Lucerna::loadAlso(byte num) { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; @@ -223,8 +223,8 @@ void Lucerna::loadAlso(byte num) { byte alsoNum = file.readByte(); Common::String tmpStr; - for (byte i = 0; i <= alsoNum; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i <= alsoNum; i++) { + for (int j = 0; j < 2; j++) { _vm->_gyro->_also[i][j] = new Common::String; *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } @@ -235,7 +235,7 @@ void Lucerna::loadAlso(byte num) { memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); _vm->_gyro->_lineNum = file.readByte(); - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { LineType *curLine = &_vm->_gyro->_lines[i]; curLine->_x1 = file.readSint16LE(); curLine->_y1 = file.readSint16LE(); @@ -246,7 +246,7 @@ void Lucerna::loadAlso(byte num) { memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); byte pedNum = file.readByte(); - for (byte i = 0; i < pedNum; i++) { + for (int i = 0; i < pedNum; i++) { PedType *curPed = &_vm->_gyro->_peds[i]; curPed->_x = file.readSint16LE(); curPed->_y = file.readSint16LE(); @@ -254,7 +254,7 @@ void Lucerna::loadAlso(byte num) { } _vm->_gyro->_fieldNum = file.readByte(); - for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; curField->_x1 = file.readSint16LE(); curField->_y1 = file.readSint16LE(); @@ -262,32 +262,32 @@ void Lucerna::loadAlso(byte num) { curField->_y2 = file.readSint16LE(); } - for (byte i = 0; i < 15; i++) { + for (int i = 0; i < 15; i++) { MagicType *magic = &_vm->_gyro->_magics[i]; magic->_operation = file.readByte(); magic->_data = file.readUint16LE(); } - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { MagicType *portal = &_vm->_gyro->_portals[i]; portal->_operation = file.readByte(); portal->_data = file.readUint16LE(); } _vm->_gyro->_flags.clear(); - for (byte i = 0; i < 26; i++) + for (int i = 0; i < 26; i++) _vm->_gyro->_flags += file.readByte(); int16 listen_length = file.readByte(); _vm->_gyro->_listen.clear(); - for (byte i = 0; i < listen_length; i++) + for (int i = 0; i < listen_length; i++) _vm->_gyro->_listen += file.readByte(); drawAlsoLines(); file.close(); unScramble(); - for (byte i = 0; i <= alsoNum; i++) { + for (int i = 0; i <= alsoNum; i++) { tmpStr = Common::String::format(",%s,", _vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } @@ -305,7 +305,7 @@ void Lucerna::loadRoom(byte num) { file.seek(146); if (!_vm->_gyro->_roomnName.empty()) _vm->_gyro->_roomnName.clear(); - for (byte i = 0; i < 30; i++) { + for (int i = 0; i < 30; i++) { char actChar = file.readByte(); if ((32 <= actChar) && (actChar <= 126)) _vm->_gyro->_roomnName += actChar; @@ -329,7 +329,7 @@ void Lucerna::zoomOut(int16 x, int16 y) { } void Lucerna::findPeople(byte room) { - for (byte i = 1; i < 29; i++) { + for (int i = 1; i < 29; i++) { if (_vm->_gyro->_whereIs[i] == room) { if (i < 25) _vm->_gyro->_him = i + 150; @@ -886,12 +886,12 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites if (!file.open("digit.avd")) error("AVALANCHE: Lucerna: File not found: digit.avd"); - for (byte i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { file.seek(i * digitsize); _vm->_gyro->_digits[i] = _vm->_graphics->loadPictureGraphic(file); } - for (byte i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { file.seek(10 * digitsize + i * rwlitesize); _vm->_gyro->_directions[i] = _vm->_graphics->loadPictureGraphic(file); } @@ -920,9 +920,9 @@ void Lucerna::drawToolbar() { void Lucerna::drawScore() { uint16 score = _vm->_gyro->_dnascore; int8 numbers[3] = {0, 0, 0}; - for (byte i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { byte divisor = 1; - for (byte j = 0; j < (2 - i); j++) + for (int j = 0; j < (2 - i); j++) divisor *= 10; numbers[i] = score / divisor; score -= numbers[i] * divisor; @@ -931,24 +931,24 @@ void Lucerna::drawScore() { CursorMan.showMouse(false); - for (byte i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { if (_vm->_gyro->_scoreToDisplay[i] != numbers[i]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[i]], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = numbers[i]; } void Lucerna::incScore(byte num) { // Add on no. of points - for (byte i = 1; i <= num; i++) { + for (int i = 1; i <= num; i++) { _vm->_gyro->_dnascore++; #if 0 if (soundfx) { - for (byte j = 1; j <= 97; j++) + for (int j = 1; j <= 97; j++) sound(177 + dna.score * 3); } nosound; @@ -1002,7 +1002,7 @@ void Lucerna::refreshObjectList() { if (_vm->_gyro->_thinkThing && !_vm->_gyro->_objects[_vm->_gyro->_thinks - 1]) thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) { _vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; _vm->_gyro->_carryNum++; @@ -1197,7 +1197,7 @@ void Lucerna::minorRedraw() { enterRoom(_vm->_gyro->_room, 0); // Ped unknown or non-existant. - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits drawScore(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e2667b1fc787..7f2ad4ff3ab9 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -146,7 +146,7 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) { void Parser::drawCursor() { // Draw the '_' character. - for (byte bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; ByteField bf; diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 5f2df1bc119f..8fa1ef0d6a1c 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -117,7 +117,7 @@ void Pingo::winningPic() { error("AVALANCHE: Lucerna: File not found: finale.avd"); #if 0 - for (byte bit = 0; bit <= 3; bit++) { + for (int bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 3e277c997cb6..0cde27dc68c3 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -88,7 +88,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { x /= 8; y++; int16 i = 0; - for (byte xx = 0; xx < lz; xx++) { + for (int xx = 0; xx < lz; xx++) { switch (z[xx]) { case kControlRoman: _currentFont = kFontStyleRoman; @@ -97,7 +97,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { _currentFont = kFontStyleItalic; break; default: { - for (byte yy = 0; yy < 12; yy++) + for (int yy = 0; yy < 12; yy++) itw[(byte)z[xx]][yy] = _scrollFonts[_currentFont][(byte)z[xx]][yy + 2]; // We have to draw the characters one-by-one because of the accidental font changes. @@ -198,7 +198,7 @@ void Scrolls::store(byte what, TuneType &played) { bool Scrolls::theyMatch(TuneType &played) { byte mistakes = 0; - for (byte i = 0; i < sizeof(played); i++) { + for (int i = 0; i < sizeof(played); i++) { if (played[i] != _vm->_gyro->kTune[i]) { mistakes += 1; } @@ -244,7 +244,7 @@ void Scrolls::resetScrollDriver() { } void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... - for (byte i = 0; i < _vm->_gyro->_scrollBells; i++) + for (int i = 0; i < _vm->_gyro->_scrollBells; i++) _vm->_lucerna->errorLed(); // Ring the bell "x" times. } @@ -313,7 +313,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { int16 lx = 0; int16 ly = (_vm->_gyro->_scrollNum) * 6; - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { ex = _vm->_gyro->_scroll[i].size() * 8; if (lx < ex) lx = ex; @@ -384,7 +384,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { } - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { if (!_vm->_gyro->_scroll[i].empty()) switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { case kControlCenter: @@ -456,7 +456,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { int16 xl = 0; int16 yl = _vm->_gyro->_scrollNum * 5; - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; @@ -506,7 +506,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; bool offset = _vm->_gyro->_scroll[i].size() % 2; _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); @@ -732,7 +732,7 @@ void Scrolls::callScrollDriver() { } break; case 11: - for (byte j = 0; j < kObjectNum; j++) { + for (int j = 0; j < kObjectNum; j++) { if (_vm->_gyro->_objects[j]) displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); } @@ -760,7 +760,7 @@ void Scrolls::callScrollDriver() { mouthnext = true; break; case kControlInsertSpaces: - for (byte j = 0; j < 9; j++) + for (int j = 0; j < 9; j++) _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; break; default: // Add new char. @@ -1017,7 +1017,7 @@ void Scrolls::talkTo(byte whom) { whom -= 149; bool noMatches = true; - for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); _vm->_scrolls->displayText(tmpStr); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 8c169c5a9f2e..2a8a569b590c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -44,7 +44,7 @@ namespace Avalanche { Timer::Timer(AvalancheEngine *vm) { _vm = vm; - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { _times[i]._timeLeft = 0; _times[i]._action = 0; _times[i]._reason = 0; @@ -83,7 +83,7 @@ void Timer::updateTimer() { if (_vm->_gyro->_dropdownActive) return; - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_times[i]._timeLeft <= 0) continue; @@ -222,7 +222,7 @@ void Timer::updateTimer() { } void Timer::loseTimer(byte which) { - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_times[i]._reason == which) _times[i]._timeLeft = 0; // Cancel this one! } From 5ec472ae2fc5d391714617457ec01c24d67057c2 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 22:10:26 -0500 Subject: [PATCH 1027/1332] ZVISION: Add version support for save files --- engines/zvision/save_manager.cpp | 10 ++++++++++ engines/zvision/save_manager.h | 1 + 2 files changed, 11 insertions(+) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 4f8bfeb83618..ff6e1c36faa5 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -44,6 +44,9 @@ void SaveManager::saveGame(uint slot, const Common::String &saveName) { // Write out the savegame header file->writeUint32BE(SAVEGAME_ID); + // Write version + file->writeByte(1); + // Write savegame name file->writeString(saveName); file->writeByte(0); @@ -58,6 +61,7 @@ void SaveManager::saveGame(uint slot, const Common::String &saveName) { // Skip over the header info autoSaveFile->readSint32BE(); // SAVEGAME_ID + autoSaveFile->readByte(); // Version autoSaveFile->seek(5, SEEK_CUR); // The string "auto" with terminating NULL // Read the rest to a buffer @@ -79,6 +83,9 @@ void SaveManager::autoSave() { // Write out the savegame header file->writeUint32BE(SAVEGAME_ID); + // Version + file->writeByte(1); + file->writeString("auto"); file->writeByte(0); @@ -153,6 +160,9 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea return false; } + // Read in the version + header.version = in->readByte(); + // Read in the save name header.saveName.clear(); char ch; diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index 219a8e7715bb..864f176e10f9 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -36,6 +36,7 @@ namespace ZVision { class ZVision; struct SaveGameHeader { + byte version; Common::String saveName; Graphics::Surface *thumbnail; int saveYear, saveMonth, saveDay; From 6664f31ed24b2d8b384221faffdeb6eda0f69835 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 17 Sep 2013 11:03:49 -0500 Subject: [PATCH 1028/1332] ZVISION: Convert the current save version to a const --- engines/zvision/save_manager.cpp | 4 ++-- engines/zvision/save_manager.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index ff6e1c36faa5..cf2d96575ef8 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -45,7 +45,7 @@ void SaveManager::saveGame(uint slot, const Common::String &saveName) { file->writeUint32BE(SAVEGAME_ID); // Write version - file->writeByte(1); + file->writeByte(SAVE_VERSION); // Write savegame name file->writeString(saveName); @@ -84,7 +84,7 @@ void SaveManager::autoSave() { file->writeUint32BE(SAVEGAME_ID); // Version - file->writeByte(1); + file->writeByte(SAVE_VERSION); file->writeString("auto"); file->writeByte(0); diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index 864f176e10f9..8d0ebc75af66 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -51,6 +51,10 @@ class SaveManager { ZVision *_engine; static const uint32 SAVEGAME_ID; + enum { + SAVE_VERSION = 1 + }; + public: void autoSave(); void saveGame(uint slot, const Common::String &saveName); From 6148a0a878eb543731653870fcb369a8c86a2dfc Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 17 Sep 2013 11:04:41 -0500 Subject: [PATCH 1029/1332] ZVISION: Add a check against reading newer save game versions --- engines/zvision/save_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index cf2d96575ef8..e09d31557a0d 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -27,6 +27,8 @@ #include "graphics/surface.h" #include "graphics/thumbnail.h" +#include "gui/message.h" + #include "zvision/save_manager.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" @@ -163,6 +165,13 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea // Read in the version header.version = in->readByte(); + // Check that the save version isn't newer than this binary + if (header.version > SAVE_VERSION) { + uint tempVersion = header.version; + GUI::MessageDialog dialog(Common::String::format("This save file uses version %u, but this engine only supports up to version %d. You will need an updated version of the engine to use this save file.", tempVersion, SAVE_VERSION), "OK"); + dialog.runModal(); + } + // Read in the save name header.saveName.clear(); char ch; From d06c64d0762eb5f4b3f32c5402d05e801bb80ed8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 17 Sep 2013 11:05:49 -0500 Subject: [PATCH 1030/1332] ZVISION: Append chars to a Common::String object instead of using a static buffer --- engines/zvision/string_manager.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 4c4fc7b1682f..8c7e0aaa3df7 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -212,15 +212,13 @@ void StringManager::parseTag(const Common::String &tagString, uint lineNumber) { } Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { - // NOTE: Hardcoded size. All strings I've checked are less than 290 chars - char asciiString[300]; + Common::String asciiString; // Don't spam the user with warnings about UTF-16 support. // Just do one warning per String bool charOverflowWarning = false; uint16 value = stream.readUint16LE(); - uint i = 0; while (!stream.eos()) { // Check for CRLF if (value == 0x0A0D) { @@ -233,12 +231,11 @@ Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { // Crush each octet pair to a single octet with a simple cast if (value > 255) { charOverflowWarning = true; - value = 255; + value = '?'; } char charValue = (char)value; - asciiString[i] = charValue; - i++; + asciiString += charValue; value = stream.readUint16LE(); } @@ -247,7 +244,7 @@ Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { warning("UTF-16 is not supported. Characters greater than 255 are clamped to 255"); } - return Common::String(asciiString, i); + return asciiString; } StringManager::TextStyle StringManager::getTextStyle(uint stringNumber) { From 7790b4cc5bbbc895d9ee8f2dc09d259f231b85f0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Sep 2013 00:05:14 +0200 Subject: [PATCH 1031/1332] AVALANCHE: Janitorial - Clean up misc style glitches --- engines/avalanche/dropdown.cpp | 57 +++++++++++++++------------------- engines/avalanche/dropdown.h | 2 +- engines/avalanche/graphics.cpp | 6 ++-- engines/avalanche/parser.cpp | 16 ++++------ engines/avalanche/scrolls.cpp | 14 +++------ engines/avalanche/timer.cpp | 3 +- 6 files changed, 40 insertions(+), 58 deletions(-) diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index d088654c6a38..8ae3af0db1bf 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -81,8 +81,6 @@ bool HeadType::parseAltTrigger(char key) { return false; } - - void MenuItem::init(Dropdown *dr) { _dr = dr; _activeNow = false; @@ -135,12 +133,12 @@ void MenuItem::display() { _firstlix = true; _flx1 = _left - 2; _flx2 = _left + _width; - fly = 15 + _optionNum * 10; + _fly = 15 + _optionNum * 10; _activeNow = true; _dr->_vm->_gyro->_dropdownActive = true; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, fly), _dr->kMenuBackgroundColor); - _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), _dr->kMenuBackgroundColor); + _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), _dr->kMenuBorderColor); displayOption(0, true); for (int y = 1; y < _optionNum; y++) @@ -183,7 +181,7 @@ void MenuItem::moveHighlight(int8 inc) { } void MenuItem::lightUp(Common::Point cursorPos) { - if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) + if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((_fly - 3) * 2 + 1))) return; _highlightNum = (cursorPos.y - 26) / 20; if (_highlightNum == _oldY) @@ -263,14 +261,12 @@ void MenuBar::setupMenuItem(byte which) { } void MenuBar::chooseMenuItem(int16 x) { - byte i = 0; - do { + for (int i = 0; i < _menuNum; i++) { if ((x > _menuItems[i]._xpos * 8) && (x < _menuItems[i]._xright * 8)) { setupMenuItem(i); - return; + break; } - i++; - } while (i < _menuNum); + } } Dropdown::Dropdown(AvalancheEngine *vm) { @@ -641,14 +637,12 @@ void Dropdown::runMenuWith() { _vm->_acci->_thing = _vm->_gyro->_thinks; if (_vm->_gyro->_thinkThing) { - _vm->_acci->_thing += 49; if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive) _vm->_acci->_person = _vm->_gyro->_lastPerson; else _vm->_acci->_person = Acci::kPardon; - } else { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer @@ -720,7 +714,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) _vm->_gyro->newMouse(1); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { - if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem.fly * 2 + 1)) + if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) _vm->_gyro->newMouse(3); // Right-arrow else _vm->_gyro->newMouse(4); // Fletch @@ -735,7 +729,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (_vm->_lucerna->_holdLeftMouse) { if (cursorPos.y > 21) { if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) - && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1))))) { + && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) { // Clicked OUTSIDE the menu. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); @@ -765,28 +759,27 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... // NOT clicked button... if ((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) - && (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1)))) { + && (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1)))) { - // We act only if the button is released over a menu item. - while (!_vm->shouldQuit()) { - cursorPos = _vm->getMousePos(); - _activeMenuItem.lightUp(cursorPos); - _vm->_graphics->refreshScreen(); + // We act only if the button is released over a menu item. + while (!_vm->shouldQuit()) { + cursorPos = _vm->getMousePos(); + _activeMenuItem.lightUp(cursorPos); + _vm->_graphics->refreshScreen(); - _vm->updateEvents(); - if (!_vm->_lucerna->_holdLeftMouse) - break; - } + _vm->updateEvents(); + if (!_vm->_lucerna->_holdLeftMouse) + break; + } - uint16 which = (cursorPos.y - 26) / 20; - _activeMenuItem.select(which); - if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing. - backup.free(); - return; - } + uint16 which = (cursorPos.y - 26) / 20; + _activeMenuItem.select(which); + if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing. + backup.free(); + return; + } } } - } } diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/dropdown.h index 95e258effbd2..b14f4cb196d7 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/dropdown.h @@ -74,7 +74,7 @@ class MenuItem { byte _optionNum; uint16 _width, _left; bool _firstlix; - int16 _flx1, _flx2, fly; + int16 _flx1, _flx2, _fly; byte _oldY; // used by lightUp */ bool _activeNow; // Is there an active option now? byte _activeNum; // And if so, which is it? diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 5b5d39ec6c1b..806ef3f14c04 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -71,8 +71,7 @@ void Graphics::init() { _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } -void Graphics::fleshColors() -{ +void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } @@ -294,9 +293,8 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { - for (uint16 x = 0; x < picture.w; x++) { + for (uint16 x = 0; x < picture.w; x++) *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); - } } } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 7f2ad4ff3ab9..4bf05884f7a7 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -80,14 +80,12 @@ void Parser::handleBackspace() { void Parser::handleReturn() { if (_vm->_dropdown->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); - else { - if (!_inputText.empty()) { - _inputTextBackup = _inputText; - _vm->_acci->parse(); - _vm->_acci->doThat(); - _inputText.clear(); - wipeText(); - } + else if (!_inputText.empty()) { + _inputTextBackup = _inputText; + _vm->_acci->parse(); + _vm->_acci->doThat(); + _inputText.clear(); + wipeText(); } } @@ -108,11 +106,9 @@ void Parser::handleFunctionKey(const Common::Event &event) { void Parser::plotText() { CursorMan.showMouse(false); - cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); cursorOn(); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 0cde27dc68c3..398396de846a 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -28,7 +28,6 @@ /* SCROLLS The scroll driver. */ #include "avalanche/avalanche.h" - #include "avalanche/scrolls.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" @@ -199,9 +198,8 @@ bool Scrolls::theyMatch(TuneType &played) { byte mistakes = 0; for (int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->_gyro->kTune[i]) { + if (played[i] != _vm->_gyro->kTune[i]) mistakes += 1; - } } return mistakes < 5; @@ -320,7 +318,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { } int16 mx = 320; int16 my = 100; // Getmaxx & getmaxy div 2, both. - lx = lx / 2; + lx /= 2; ly -= 2; if ((1 <= _useIcon) && (_useIcon <= 34)) @@ -539,9 +537,10 @@ bool Scrolls::displayQuestion(Common::String question) { void Scrolls::resetScroll() { _vm->_gyro->_scrollNum = 1; - for (int i = 0; i < 15; i++) + for (int i = 0; i < 15; i++) { if (!_vm->_gyro->_scroll[i].empty()) _vm->_gyro->_scroll[i].clear(); + } } void Scrolls::setBubbleStateNatural() { @@ -574,9 +573,8 @@ Common::String Scrolls::displayMoney() { } void Scrolls::stripTrailingSpaces(Common::String &str) { - while (str[str.size() - 1] == ' ') { + while (str[str.size() - 1] == ' ') str.deleteLastChar(); - } } void Scrolls::solidify(byte n) { @@ -594,8 +592,6 @@ void Scrolls::solidify(byte n) { void Scrolls::callScrollDriver() { // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? - - //nosound(); warning("STUB: Scrolls::calldrivers()"); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 2a8a569b590c..ebace781e2dd 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -480,9 +480,8 @@ void Timer::jump() { if (_vm->_gyro->_jumpStatus == 20) { // End of jump. _vm->_gyro->_userMovesAvvy = true; _vm->_gyro->_jumpStatus = 0; - } else { // Still jumping. + } else // Still jumping. addTimer(1, kProcJump, kReasonJumping); - } if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->_room == kRoomInsideCardiffCastle) From 8be433b96066bbdee815ef719815a2904ef2621b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Sep 2013 07:47:52 +0200 Subject: [PATCH 1032/1332] AVALANCHE: Rename DropDown into Menu, add some access functions --- engines/avalanche/animation.cpp | 4 +- engines/avalanche/avalanche.cpp | 6 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 8 +- engines/avalanche/celer.cpp | 2 +- engines/avalanche/gyro.cpp | 2 +- engines/avalanche/gyro.h | 1 - engines/avalanche/lucerna.cpp | 6 +- engines/avalanche/{dropdown.cpp => menu.cpp} | 166 ++++++++++--------- engines/avalanche/{dropdown.h => menu.h} | 35 ++-- engines/avalanche/module.mk | 2 +- engines/avalanche/parser.cpp | 4 +- engines/avalanche/timer.cpp | 2 +- 13 files changed, 125 insertions(+), 117 deletions(-) rename engines/avalanche/{dropdown.cpp => menu.cpp} (87%) rename engines/avalanche/{dropdown.h => menu.h} (89%) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index edcc53cdcf78..e3634e0677d8 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1226,7 +1226,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) + if (_vm->_menu->isActive() | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) @@ -1377,7 +1377,7 @@ void Animation::handleMoveKey(const Common::Event &event) { if (!_vm->_gyro->_userMovesAvvy) return; - if (_vm->_dropdown->_activeMenuItem._activeNow) + if (_vm->_menu->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); else { switch (event.kbd.keycode) { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 33c72c848fa9..980fcab96acd 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -70,7 +70,7 @@ AvalancheEngine::~AvalancheEngine() { delete _timer; delete _animation; delete _acci; - delete _dropdown; + delete _menu; delete _closing; delete _gyro; } @@ -89,7 +89,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _timer = new Timer(this); _animation = new Animation(this); _acci = new Acci(this); - _dropdown = new Dropdown(this); + _menu = new Menu(this); _closing = new Closing(this); _graphics->init(); @@ -440,7 +440,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _celer->forgetBackgroundSprites(); _lucerna->minorRedraw(); - _dropdown->setupMenu(); + _menu->setup(); _gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; _gyro->_alive = true; _lucerna->refreshObjectList(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 8da159165dd4..4a01c729d216 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -43,7 +43,7 @@ #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/acci.h" -#include "avalanche/dropdown.h" +#include "avalanche/menu.h" #include "avalanche/closing.h" #include "common/serializer.h" @@ -78,7 +78,7 @@ class AvalancheEngine : public Engine { Timer *_timer; Animation *_animation; Acci *_acci; - Dropdown *_dropdown; + Menu *_menu; Closing *_closing; OSystem *_system; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2d93ed89546a..687572c2af37 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,7 +28,6 @@ /* AVALOT The kernel of the program. */ #include "avalanche/avalanche.h" - #include "avalanche/graphics.h" #include "avalanche/avalot.h" #include "avalanche/gyro.h" @@ -36,7 +35,7 @@ #include "avalanche/gyro.h" #include "avalanche/lucerna.h" #include "avalanche/scrolls.h" -#include "avalanche/dropdown.h" +#include "avalanche/menu.h" #include "avalanche/pingo.h" #include "avalanche/timer.h" #include "avalanche/celer.h" @@ -136,7 +135,6 @@ void Avalot::setup() { _vm->_gyro->setMousePointerWait(); _vm->_gyro->_dropsOk = true; _vm->_gyro->_mouseText = ""; - _vm->_gyro->_dropdownActive = false; _vm->_lucerna->loadDigits(); _vm->_gyro->_cheat = false; _vm->_gyro->_cp = 0; @@ -161,7 +159,7 @@ void Avalot::setup() { _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); - + _vm->_menu->init(); int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { @@ -190,7 +188,7 @@ void Avalot::run(Common::String arg) { _vm->updateEvents(); // The event handler. _vm->_lucerna->_clock.update(); - _vm->_dropdown->updateMenu(); + _vm->_menu->update(); _vm->_celer->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 6edb4d2bb429..61a45c7e2646 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -54,7 +54,7 @@ Celer::~Celer() { * @remarks Originally called 'pics_link' */ void Celer::updateBackgroundSprites() { - if (_vm->_gyro->_dropdownActive) + if (_vm->_menu->isActive()) return; // No animation when the menus are up. switch (_vm->_gyro->_room) { diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 2cb9d0e6e8b7..ec695947bf6b 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -356,7 +356,7 @@ void Gyro::newGame() { _vm->_lucerna->enterRoom(1, 1); avvy->_visible = false; _vm->_lucerna->drawScore(); - _vm->_dropdown->setupMenu(); + _vm->_menu->setup(); _vm->_lucerna->_clock.update(); _vm->_lucerna->spriteRun(); } diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 977a2e79ae0d..b01f3e1a06a0 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -348,7 +348,6 @@ class Gyro { byte _buffer[2000]; uint16 _bufSize; int16 _underScroll; // Y-coord of just under the scroll text. - bool _dropdownActive; // Kludge so we don't have to keep referring to Dropdown Common::String _roomnName; // Name of actual room Common::String _subject; // What you're talking to them about. byte _subjectNum; // The same thing. diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 2b75d5abcc35..336c686a6f42 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -380,7 +380,7 @@ void Lucerna::exitRoom(byte x) { * @remarks Originally called 'new_town' */ void Lucerna::enterNewTown() { - _vm->_dropdown->setupMenu(); + _vm->_menu->setup(); switch (_vm->_gyro->_room) { case kRoomOutsideNottsPub: // Entry into Nottingham. @@ -1080,7 +1080,7 @@ void Lucerna::checkClick() { _vm->_gyro->newMouse(8); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) _vm->_gyro->newMouse(2); // screwdriver - else if (!_vm->_gyro->_dropdownActive) { // Dropdown can handle its own pointers. + else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { _vm->_gyro->newMouse(7); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. @@ -1091,7 +1091,7 @@ void Lucerna::checkClick() { if (_holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_vm->_gyro->_dropsOk) - _vm->_dropdown->updateMenu(); + _vm->_menu->update(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/menu.cpp similarity index 87% rename from engines/avalanche/dropdown.cpp rename to engines/avalanche/menu.cpp index 8ae3af0db1bf..69267da55c09 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/menu.cpp @@ -28,8 +28,7 @@ /* DROPDOWN A customised version of Oopmenu (qv). */ #include "avalanche/avalanche.h" - -#include "avalanche/dropdown.h" +#include "avalanche/menu.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" #include "avalanche/acci.h" @@ -39,7 +38,7 @@ namespace Avalanche { -void HeadType::init(char trig, char altTrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr) { +void HeadType::init(char trig, char altTrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr) { _trigger = trig; _altTrigger = altTrig; _title = title; @@ -69,8 +68,8 @@ void HeadType::highlight() { _dr->_activeMenuItem._left = _xpos; _dr->_activeMenuItem._activeNow = true; - _dr->_vm->_gyro->_dropdownActive = true; _dr->_activeMenuItem._activeNum = _position; + _dr->_menuActive = true; _dr->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. } @@ -81,11 +80,12 @@ bool HeadType::parseAltTrigger(char key) { return false; } -void MenuItem::init(Dropdown *dr) { +void MenuItem::init(Menu *dr) { _dr = dr; + _activeNow = false; - _dr->_vm->_gyro->_dropdownActive = false; _activeNum = 1; + _dr->_menuActive = false; } void MenuItem::reset() { @@ -135,7 +135,7 @@ void MenuItem::display() { _flx2 = _left + _width; _fly = 15 + _optionNum * 10; _activeNow = true; - _dr->_vm->_gyro->_dropdownActive = true; + _dr->_menuActive = true; _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), _dr->kMenuBackgroundColor); _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), _dr->kMenuBorderColor); @@ -157,7 +157,7 @@ void MenuItem::wipe() { _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); _activeNow = false; - _dr->_vm->_gyro->_dropdownActive = false; + _dr->_menuActive = false; _firstlix = false; _dr->_vm->_gyro->_defaultLed = 2; @@ -217,12 +217,12 @@ void MenuItem::parseKey(char c) { _dr->_vm->_gyro->blip(); } -void MenuBar::init(Dropdown *dr) { +void MenuBar::init(Menu *dr) { _dr = dr; _menuNum = 0; } -void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc) { +void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc) { _menuItems[_menuNum].init(trig, altTrig, title, _menuNum, setupFunc, chooseFunc, _dr); _menuNum++; } @@ -269,13 +269,13 @@ void MenuBar::chooseMenuItem(int16 x) { } } -Dropdown::Dropdown(AvalancheEngine *vm) { +Menu::Menu(AvalancheEngine *vm) { _vm = vm; _activeMenuItem.init(this); _menuBar.init(this); } -void Dropdown::findWhatYouCanDoWithIt() { +void Menu::findWhatYouCanDoWithIt() { switch (_vm->_gyro->_thinks) { case Gyro::kObjectWine: case Gyro::kObjectPotion: @@ -303,7 +303,7 @@ void Dropdown::findWhatYouCanDoWithIt() { } } -void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) { +void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) { byte fontColor; byte backgroundColor; if (highlighted) { @@ -352,64 +352,67 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, _vm->_graphics->refreshScreen(); } -void Dropdown::bleep() { +void Menu::bleep() { warning("STUB: Dropdown::bleep()"); } -void Dropdown::parseKey(char r, char re) { - //switch (r) { - //case 0: - //case 224: { - // switch (re) { - // case 'K': - // if (_activeMenuItem._activeNum > 1) { - // _activeMenuItem.wipe(); - // _menuBar.setupMenuItem(_activeMenuItem._activeNum - 1); - // } else { - // // Get menu on the left-hand side. - // _activeMenuItem.wipe(); - // _menuBar.chooseMenuItem((_menuBar._menuNum - 1) * kSpacing + kIndent); - // } - // break; - // case 'M': - // if (_activeMenuItem._activeNum < _menuBar._menuNum) { - // _activeMenuItem.wipe(); - // _menuBar.setupMenuItem(_activeMenuItem._activeNum + 1); - // } else { - // // Get menu on the far right-hand side. - // _activeMenuItem.wipe(); - // _menuBar.chooseMenuItem(kIndent); - // } - // break; - // case 'H': - // _activeMenuItem.moveHighlight(-1); - // break; - // case 'P': - // _activeMenuItem.moveHighlight(1); - // break; - // default: - // _menuBar.parseAltTrigger(re); - // } - //} - //break; - //case 13: - // _activeMenuItem.select(_activeMenuItem._highlightNum); - // break; - //default: - // if (_activeMenuItem._activeNow) - // _activeMenuItem.parseKey(r); - //} +void Menu::parseKey(char r, char re) { +#if 0 + switch (r) { + case 0: + case 224: { + switch (re) { + case 'K': + if (_activeMenuItem._activeNum > 1) { + _activeMenuItem.wipe(); + _menuBar.setupMenuItem(_activeMenuItem._activeNum - 1); + } else { + // Get menu on the left-hand side. + _activeMenuItem.wipe(); + _menuBar.chooseMenuItem((_menuBar._menuNum - 1) * kSpacing + kIndent); + } + break; + case 'M': + if (_activeMenuItem._activeNum < _menuBar._menuNum) { + _activeMenuItem.wipe(); + _menuBar.setupMenuItem(_activeMenuItem._activeNum + 1); + } else { + // Get menu on the far right-hand side. + _activeMenuItem.wipe(); + _menuBar.chooseMenuItem(kIndent); + } + break; + case 'H': + _activeMenuItem.moveHighlight(-1); + break; + case 'P': + _activeMenuItem.moveHighlight(1); + break; + default: + _menuBar.parseAltTrigger(re); + } + } + break; + case 13: + _activeMenuItem.select(_activeMenuItem._highlightNum); + break; + default: + if (_activeMenuItem._activeNow) + _activeMenuItem.parseKey(r); + } +#endif + warning("STUB: Dropdown::parseKey()"); // To be implemented properly later! Don't remove the comment above! } -Common::String Dropdown::selectGender(byte x) { +Common::String Menu::selectGender(byte x) { if (x < 175) return "im"; else return "er"; } -void Dropdown::setupMenuGame() { +void Menu::setupMenuGame() { _activeMenuItem.reset(); _activeMenuItem.setupOption("Help...", 'H', "f1", true); _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", true); @@ -419,7 +422,7 @@ void Dropdown::setupMenuGame() { _activeMenuItem.display(); } -void Dropdown::setupMenuFile() { +void Menu::setupMenuFile() { _activeMenuItem.reset(); _activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true); @@ -430,7 +433,7 @@ void Dropdown::setupMenuFile() { _activeMenuItem.display(); } -void Dropdown::setupMenuAction() { +void Menu::setupMenuAction() { _activeMenuItem.reset(); Common::String f5Does = _vm->_gyro->f5Does(); @@ -456,7 +459,7 @@ void Dropdown::setupMenuAction() { _activeMenuItem.display(); } -void Dropdown::setupMenuPeople() { +void Menu::setupMenuPeople() { if (!people.empty()) people.clear(); @@ -472,7 +475,7 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.display(); } -void Dropdown::setupMenuObjects() { +void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) @@ -481,7 +484,7 @@ void Dropdown::setupMenuObjects() { _activeMenuItem.display(); } -void Dropdown::setupMenuWith() { +void Menu::setupMenuWith() { _activeMenuItem.reset(); if (_vm->_gyro->_thinkThing) { @@ -538,7 +541,7 @@ void Dropdown::setupMenuWith() { _activeMenuItem.display(); } -void Dropdown::runMenuGame() { +void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: @@ -559,7 +562,7 @@ void Dropdown::runMenuGame() { } } -void Dropdown::runMenuFile() { +void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: @@ -588,7 +591,7 @@ void Dropdown::runMenuFile() { } } -void Dropdown::runMenuAction() { +void Menu::runMenuAction() { Common::String f5Does; // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { @@ -624,16 +627,16 @@ void Dropdown::runMenuAction() { } } -void Dropdown::runMenuObjects() { +void Menu::runMenuObjects() { _vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing); } -void Dropdown::runMenuPeople() { +void Menu::runMenuPeople() { _vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson); _vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; } -void Dropdown::runMenuWith() { +void Menu::runMenuWith() { _vm->_acci->_thing = _vm->_gyro->_thinks; if (_vm->_gyro->_thinkThing) { @@ -678,21 +681,21 @@ void Dropdown::runMenuWith() { _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); } -void Dropdown::setupMenu() { +void Menu::setup() { _menuBar.init(this); _activeMenuItem.init(this); - _menuBar.createMenuItem('F', "File", '!', &Avalanche::Dropdown::setupMenuFile, &Avalanche::Dropdown::runMenuFile); - _menuBar.createMenuItem('G', "Game", 34, &Avalanche::Dropdown::setupMenuGame, &Avalanche::Dropdown::runMenuGame); - _menuBar.createMenuItem('A', "Action", 30, &Avalanche::Dropdown::setupMenuAction, &Avalanche::Dropdown::runMenuAction); - _menuBar.createMenuItem('O', "Objects", 24, &Avalanche::Dropdown::setupMenuObjects, &Avalanche::Dropdown::runMenuObjects); - _menuBar.createMenuItem('P', "People", 25, &Avalanche::Dropdown::setupMenuPeople, &Avalanche::Dropdown::runMenuPeople); - _menuBar.createMenuItem('W', "With", 17, &Avalanche::Dropdown::setupMenuWith, &Avalanche::Dropdown::runMenuWith); + _menuBar.createMenuItem('F', "File", '!', &Avalanche::Menu::setupMenuFile, &Avalanche::Menu::runMenuFile); + _menuBar.createMenuItem('G', "Game", 34, &Avalanche::Menu::setupMenuGame, &Avalanche::Menu::runMenuGame); + _menuBar.createMenuItem('A', "Action", 30, &Avalanche::Menu::setupMenuAction, &Avalanche::Menu::runMenuAction); + _menuBar.createMenuItem('O', "Objects", 24, &Avalanche::Menu::setupMenuObjects, &Avalanche::Menu::runMenuObjects); + _menuBar.createMenuItem('P', "People", 25, &Avalanche::Menu::setupMenuPeople, &Avalanche::Menu::runMenuPeople); + _menuBar.createMenuItem('W', "With", 17, &Avalanche::Menu::setupMenuWith, &Avalanche::Menu::runMenuWith); _menuBar.draw(); } -void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... +void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... Common::Point cursorPos = _vm->getMousePos(); ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); @@ -786,4 +789,11 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... backup.free(); } +bool Menu::isActive() { + return _menuActive; +} + +void Menu::init() { + _menuActive = false; +} } // End of namespace Avalanche. diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/menu.h similarity index 89% rename from engines/avalanche/dropdown.h rename to engines/avalanche/menu.h index b14f4cb196d7..ad0821e93220 100644 --- a/engines/avalanche/dropdown.h +++ b/engines/avalanche/menu.h @@ -31,18 +31,15 @@ #define AVALANCHE_DROPDOWN2_H #include "avalanche/color.h" - #include "common/scummsys.h" #include "common/str.h" - - namespace Avalanche { class AvalancheEngine; -class Dropdown; +class Menu; -typedef void (Dropdown::*DropdownFunc)(); +typedef void (Menu::*MenuFunc)(); class HeadType { public: @@ -50,15 +47,15 @@ class HeadType { char _trigger, _altTrigger; byte _position; int16 _xpos, _xright; - DropdownFunc _setupFunc, _chooseFunc; + MenuFunc _setupFunc, _chooseFunc; - void init(char trig, char alTtrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr); + void init(char trig, char alTtrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr); void draw(); void highlight(); bool parseAltTrigger(char key); private: - Dropdown *_dr; + Menu *_dr; }; struct OptionType { @@ -81,7 +78,7 @@ class MenuItem { byte _choiceNum; // Your choice? byte _highlightNum; - void init(Dropdown *dr); + void init(Menu *dr); void reset(); void setupOption(Common::String title, char trigger, Common::String shortcut, bool valid); void display(); @@ -93,7 +90,7 @@ class MenuItem { void parseKey(char c); private: - Dropdown *_dr; + Menu *_dr; }; class MenuBar { @@ -101,18 +98,18 @@ class MenuBar { HeadType _menuItems[8]; byte _menuNum; - void init(Dropdown *dr); - void createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc); + void init(Menu *dr); + void createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc); void draw(); void parseAltTrigger(char c); void setupMenuItem(byte which); void chooseMenuItem(int16 x); private: - Dropdown *_dr; + Menu *_dr; }; -class Dropdown { +class Menu { public: friend class HeadType; friend class MenuItem; @@ -123,11 +120,13 @@ class Dropdown { Common::String people; - Dropdown(AvalancheEngine *vm); + Menu(AvalancheEngine *vm); void parseKey(char r, char re); - void updateMenu(); - void setupMenu(); // Standard menu bar. + void update(); + void setup(); // Standard menu bar. + bool isActive(); + void init(); private: static const byte kIndent = 5; @@ -140,6 +139,8 @@ class Dropdown { static const byte kHighlightFontColor = kColorWhite; static const byte kDisabledColor = kColorDarkgray; + bool _menuActive; // Kludge so we don't have to keep referring to Dropdown + AvalancheEngine *_vm; Common::String selectGender(byte x); // Returns "im" for boys, and "er" for girls. diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 0da172cf9f9d..4a0c7034b6a3 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -16,7 +16,7 @@ MODULE_OBJS = \ timer.o \ animation.o \ acci.o \ - dropdown.o \ + menu.o \ closing.o # This module can be built as a plugin diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4bf05884f7a7..903a01b7965f 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -65,7 +65,7 @@ void Parser::handleInputText(const Common::Event &event) { } void Parser::handleBackspace() { - if (!_vm->_dropdown->_activeMenuItem._activeNow) { + if (!_vm->_menu->_activeMenuItem._activeNow) { if (_inputTextPos > _leftMargin) { _inputTextPos--; if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) @@ -78,7 +78,7 @@ void Parser::handleBackspace() { } void Parser::handleReturn() { - if (_vm->_dropdown->_activeMenuItem._activeNow) + if (_vm->_menu->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); else if (!_inputText.empty()) { _inputTextBackup = _inputText; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index ebace781e2dd..8038f01bf1d4 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -80,7 +80,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { * @remarks Originally called 'one_tick' */ void Timer::updateTimer() { - if (_vm->_gyro->_dropdownActive) + if (_vm->_menu->isActive()) return; for (int i = 0; i < 7; i++) { From 9ba81f6097cf02a5e38c797746d4e8a5d46e8a6c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Sep 2013 08:00:30 +0200 Subject: [PATCH 1033/1332] AVALANCHE: move some engine init instructions to Gyro --- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 24 ++++++------------------ engines/avalanche/gyro.cpp | 20 ++++++++++++++++++++ engines/avalanche/gyro.h | 9 ++------- engines/avalanche/lucerna.cpp | 2 +- engines/avalanche/timer.cpp | 4 ++-- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 980fcab96acd..1c92d2b0ed5d 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -430,7 +430,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { synchronize(sz); delete f; - _gyro->isLoaded = true; + _gyro->_isLoaded = true; _gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. if (_gyro->_holdTheDawn) { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 687572c2af37..0bee2b77cc20 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -125,34 +125,22 @@ void Avalot::handleKeyDown(Common::Event &event) { } void Avalot::setup() { - _vm->_gyro->_mouse = _vm->_gyro->kMouseStateNo; - _vm->_gyro->_letMeOut = false; + _vm->_gyro->init(); + _vm->_scrolls->resetScroll(); - CursorMan.showMouse(true); - _vm->_gyro->_holdTheDawn = true; _vm->_lucerna->dusk(); - _vm->_gyro->_currentMouse = 177; - _vm->_gyro->setMousePointerWait(); - _vm->_gyro->_dropsOk = true; - _vm->_gyro->_mouseText = ""; _vm->_lucerna->loadDigits(); - _vm->_gyro->_cheat = false; - _vm->_gyro->_cp = 0; + _vm->_parser->_inputTextPos = 0; _vm->_parser->_quote = true; - _vm->_gyro->_ledStatus = 177; - _vm->_gyro->_defaultLed = 2; + // TSkellern = 0; Replace with a more local variable sometime - _vm->_animation->_direction = Animation::kDirStopped; - _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); - for (int i = 0; i < 3; i++) - _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. + _vm->_animation->_direction = Animation::kDirStopped; _vm->_animation->loadAnims(); - _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); @@ -168,7 +156,7 @@ void Avalot::setup() { _vm->loadGame(loadSlot); } else { - _vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame(). + _vm->_gyro->_isLoaded = false; // Set to true in _vm->loadGame(). _vm->_gyro->newGame(); // No game was requested- load the default. _vm->_gyro->_soundFx = !_vm->_gyro->_soundFx; diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index ec695947bf6b..ec4929e456a4 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -592,4 +592,24 @@ void Gyro::hangAroundForAWhile() { slowDown(); } +void Gyro::init() { + _mouse = kMouseStateNo; + _letMeOut = false; + _holdTheDawn = true; + _currentMouse = 177; + _dropsOk = true; + _mouseText = ""; + _cheat = false; + _cp = 0; + _ledStatus = 177; + _defaultLed = 2; + _enidFilename = ""; // Undefined. + for (int i = 0; i < 3; i++) + _scoreToDisplay[i] = -1; // Impossible digits. + _holdTheDawn = false; + + setMousePointerWait(); + CursorMan.showMouse(true); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index b01f3e1a06a0..27bbcb8871ff 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -42,7 +42,6 @@ namespace Avalanche { class AvalancheEngine; - static const byte kObjectNum = 18; // always preface with a # static const int16 kCarryLimit = 12; // carry limit @@ -187,11 +186,8 @@ class Gyro { static const int16 kXW = 30; static const int16 kYW = 36; // x width & y whatsit - static const int16 kMargin = 5; - static const MouseHotspotType kMouseHotSpots[9]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. // For Thinkabout: @@ -363,11 +359,9 @@ class Gyro { byte _lastPerson; // Last person to have been selected using the People menu. bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - bool isLoaded; // Is it a loaded gamestate? + bool _isLoaded; // Is it a loaded gamestate? Common::String _enidFilename; - - Gyro(AvalancheEngine *vm); ~Gyro(); @@ -397,6 +391,7 @@ class Gyro { Common::String getItem(byte which); // Called get_better in the original. Common::String f5Does(); // This procedure determines what f5 does. + void init(); private: AvalancheEngine *_vm; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 336c686a6f42..d5f48dba34ec 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -835,7 +835,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_gyro->_seeScroll = false; // Now it can work again! - _vm->_gyro->isLoaded = false; + _vm->_gyro->_isLoaded = false; } void Lucerna::thinkAbout(byte object, bool type) { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 8038f01bf1d4..bd31c2d05a0d 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -57,7 +57,7 @@ Timer::Timer(AvalancheEngine *vm) { * @remarks Originally called 'set_up_timer' */ void Timer::addTimer(int32 duration, byte action, byte reason) { - if ((_vm->_gyro->isLoaded == false) || (_timerLost == true)) { + if ((_vm->_gyro->_isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; @@ -70,7 +70,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { _times[i]._action = action; _times[i]._reason = reason; } else { - _vm->_gyro->isLoaded = false; + _vm->_gyro->_isLoaded = false; return; } } From edc147774100ffcdfb6aeaa896151e75790564ce Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Sep 2013 08:07:20 +0200 Subject: [PATCH 1034/1332] AVALANCHE: Remove index hack used for mouse pointer (Pascal to C conversion) --- engines/avalanche/gyro.cpp | 6 +++--- engines/avalanche/lucerna.cpp | 10 +++++----- engines/avalanche/menu.cpp | 8 ++++---- engines/avalanche/scrolls.cpp | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index ec4929e456a4..cea537da31dc 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -196,9 +196,9 @@ Common::String Gyro::intToStr(int32 num) { void Gyro::newMouse(byte id) { if (id == _currentMouse) return; - _currentMouse = id; - loadMouse(id - 1); + _currentMouse = id; + loadMouse(id); } /** @@ -206,7 +206,7 @@ void Gyro::newMouse(byte id) { * @remarks Originally called 'wait' */ void Gyro::setMousePointerWait() { - newMouse(5); + newMouse(4); } void Gyro::note(uint16 hertz) { diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index d5f48dba34ec..ae6e8b71db24 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -1075,17 +1075,17 @@ void Lucerna::checkClick() { _vm->_gyro->after_the_scroll = false;*/ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newMouse(1); // up arrow + _vm->_gyro->newMouse(0); // up arrow else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) - _vm->_gyro->newMouse(8); //I-beam + _vm->_gyro->newMouse(7); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newMouse(2); // screwdriver + _vm->_gyro->newMouse(1); // screwdriver else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { - _vm->_gyro->newMouse(7); // Mark's crosshairs + _vm->_gyro->newMouse(6); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else - _vm->_gyro->newMouse(4); // fletch + _vm->_gyro->newMouse(3); // fletch } if (_holdLeftMouse) { diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 69267da55c09..a51ec4693e4f 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -715,14 +715,14 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newMouse(1); // Up arrow + _vm->_gyro->newMouse(0); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->_gyro->newMouse(3); // Right-arrow + _vm->_gyro->newMouse(2); // Right-arrow else - _vm->_gyro->newMouse(4); // Fletch + _vm->_gyro->newMouse(3); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newMouse(2); // Screwdriver + _vm->_gyro->newMouse(1); // Screwdriver _activeMenuItem.lightUp(cursorPos); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 398396de846a..043921150d6c 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -119,7 +119,7 @@ void Scrolls::scrollModeNormal() { setReadyLight(3); _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); - _vm->_gyro->newMouse(4); + _vm->_gyro->newMouse(3); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -209,7 +209,7 @@ void Scrolls::scrollModeMusic() { setReadyLight(3); _vm->_gyro->_seeScroll = true; CursorMan.showMouse(true); - _vm->_gyro->newMouse(4); + _vm->_gyro->newMouse(3); // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. // For now we act like the player just played the right tone. From 23b225ca0d1da28a45507824edcff1c9ca0f917b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Sep 2013 23:59:26 +0200 Subject: [PATCH 1035/1332] AVALANCHE: Add sound class, blip(), playNote() and click() --- engines/avalanche/avalanche.cpp | 2 + engines/avalanche/avalanche.h | 2 + engines/avalanche/avalot.cpp | 7 +-- engines/avalanche/celer.cpp | 3 +- engines/avalanche/gyro.cpp | 12 ---- engines/avalanche/gyro.h | 4 -- engines/avalanche/lucerna.cpp | 10 ++-- engines/avalanche/menu.cpp | 2 +- engines/avalanche/module.mk | 3 +- engines/avalanche/parser.cpp | 4 +- engines/avalanche/sound.cpp | 101 ++++++++++++++++++++++++++++++++ engines/avalanche/sound.h | 54 +++++++++++++++++ engines/avalanche/timer.cpp | 2 +- 13 files changed, 173 insertions(+), 33 deletions(-) create mode 100644 engines/avalanche/sound.cpp create mode 100644 engines/avalanche/sound.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 1c92d2b0ed5d..b363b8a307b1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -73,6 +73,7 @@ AvalancheEngine::~AvalancheEngine() { delete _menu; delete _closing; delete _gyro; + delete _sound; } Common::ErrorCode AvalancheEngine::initialize() { @@ -91,6 +92,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _acci = new Acci(this); _menu = new Menu(this); _closing = new Closing(this); + _sound = new SoundHandler(this); _graphics->init(); _scrolls->init(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 4a01c729d216..c930fe7347c9 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -45,6 +45,7 @@ #include "avalanche/acci.h" #include "avalanche/menu.h" #include "avalanche/closing.h" +#include "avalanche/sound.h" #include "common/serializer.h" @@ -80,6 +81,7 @@ class AvalancheEngine : public Engine { Acci *_acci; Menu *_menu; Closing *_closing; + SoundHandler *_sound; OSystem *_system; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0bee2b77cc20..565d54c9f7b0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -56,11 +56,8 @@ Avalot::Avalot(AvalancheEngine *vm) { } void Avalot::handleKeyDown(Common::Event &event) { - //if (keyboardclick) - // click(); - // - // To be implemented later with the sounds, I assume. - +// if (keyboardclick) + _vm->_sound->click(); if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) _vm->_parser->handleFunctionKey(event); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 61a45c7e2646..37a01ed6a032 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -255,7 +255,8 @@ void Celer::updateBackgroundSprites() { if (_vm->_gyro->_nextBell < 5) _vm->_gyro->_nextBell = 12; _vm->_gyro->_nextBell--; - _vm->_gyro->note(_vm->_gyro->kNotes[_vm->_gyro->_nextBell]); + // CHECKME: 2 is a guess. No length in the original? + _vm->_sound->playNote(_vm->_gyro->kNotes[_vm->_gyro->_nextBell], 2); break; case 2: //nosound(); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index cea537da31dc..c1ea6a257509 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -209,14 +209,6 @@ void Gyro::setMousePointerWait() { newMouse(4); } -void Gyro::note(uint16 hertz) { - warning("STUB: Gyro::note()"); -} - -void Gyro::blip() { - warning("STUB: Gyro::blip()"); -} - void Gyro::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { warning("STUB: Gyro::shadow()"); } @@ -361,10 +353,6 @@ void Gyro::newGame() { _vm->_lucerna->spriteRun(); } -void Gyro::click() { - warning("STUB: Gyro::click()"); -} - void Gyro::slowDown() { warning("STUB: Gyro::slowdown()"); } diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 27bbcb8871ff..f62c2506045f 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -370,10 +370,6 @@ class Gyro { void setMousePointerWait(); // Makes hourglass. void loadMouse(byte which); - void note(uint16 hertz); - void blip(); - void click(); // "Audio keyboard feedback" - void setBackgroundColor(byte x); void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index ae6e8b71db24..0206d0ab9c8a 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -946,13 +946,11 @@ void Lucerna::incScore(byte num) { // Add on no. of points for (int i = 1; i <= num; i++) { _vm->_gyro->_dnascore++; -#if 0 - if (soundfx) { +// if (soundfx) { for (int j = 1; j <= 97; j++) - sound(177 + dna.score * 3); - } - nosound; -#endif + // Length os 2 is a guess, the original doesn't have a delay specified + _vm->_sound->playNote(177 + _vm->_gyro->_dnascore * 3, 2); +// } } warning("STUB: Lucerna::points()"); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index a51ec4693e4f..aa7cba7a8223 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -214,7 +214,7 @@ void MenuItem::parseKey(char c) { } } if (!found) - _dr->_vm->_gyro->blip(); + _dr->_vm->_sound->blip(); } void MenuBar::init(Menu *dr) { diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 4a0c7034b6a3..0fea70e88ea5 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -17,7 +17,8 @@ MODULE_OBJS = \ animation.o \ acci.o \ menu.o \ - closing.o + closing.o \ + sound.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 903a01b7965f..5f9e5d8965d8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -60,7 +60,7 @@ void Parser::handleInputText(const Common::Event &event) { _inputTextPos++; plotText(); } else - _vm->_gyro->blip(); + _vm->_sound->blip(); // } } @@ -73,7 +73,7 @@ void Parser::handleBackspace() { _inputText.deleteChar(_inputTextPos); plotText(); } else - _vm->_gyro->blip(); + _vm->_sound->blip(); } } diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp new file mode 100644 index 000000000000..bec542659437 --- /dev/null +++ b/engines/avalanche/sound.cpp @@ -0,0 +1,101 @@ +/* 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/system.h" +#include "common/textconsole.h" +#include "common/config-manager.h" + +#include "audio/decoders/raw.h" +#include "audio/audiostream.h" + +#include "avalanche/avalanche.h" +#include "avalanche/sound.h" + +namespace Avalanche { + +SoundHandler::SoundHandler(AvalancheEngine *vm) : _vm(vm) { + _speakerStream = new Audio::PCSpeaker(_vm->_mixer->getOutputRate()); + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, + _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); +} + +SoundHandler::~SoundHandler() { + _vm->_mixer->stopHandle(_speakerHandle); + delete _speakerStream; +} + +/** + * Stop any sound that might be playing + */ +void SoundHandler::stopSound() { + _vm->_mixer->stopAll(); +} + +/** + * Turn digitized sound on and off + */ +void SoundHandler::toggleSound() { +// _vm->_config._soundFl = !_vm->_config._soundFl; +} + +/** + * Initialize for MCI sound and midi + */ +void SoundHandler::initSound() { + //_midiPlayer->open(); +} + +void SoundHandler::syncVolume() { + int soundVolume; + + if (ConfMan.getBool("sfx_mute") || ConfMan.getBool("mute")) + soundVolume = -1; + else + soundVolume = MIN(255, ConfMan.getInt("sfx_volume")); + + _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolume); +} + +void SoundHandler::playNote(int freq, int length) { + // Does the user not want any sound? +// if (!_vm->_config._soundFl || !_vm->_mixer->isReady()) + if (!_vm->_mixer->isReady()) + return; + + // Start a note playing (we will stop it when the timer expires). + _speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, freq, length); +} + +void SoundHandler::click() { + _vm->_mixer->stopAll(); + + playNote(7177, 1); +} + +void SoundHandler::blip() { + _vm->_mixer->stopAll(); + + playNote(177, 77); +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h new file mode 100644 index 000000000000..65dda96406fd --- /dev/null +++ b/engines/avalanche/sound.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 AVALANCHE_SOUND_H +#define AVALANCHE_SOUND_H + +#include "audio/mixer.h" +#include "audio/midiplayer.h" +#include "audio/softsynth/pcspk.h" + +namespace Avalanche { + +class SoundHandler { +public: + SoundHandler(AvalancheEngine *vm); + ~SoundHandler(); + + void toggleSound(); + void playNote(int freq, int length); + void click(); + void blip(); + void initSound(); + void syncVolume(); + +private: + AvalancheEngine *_vm; + Audio::PCSpeaker *_speakerStream; + Audio::SoundHandle _speakerHandle; + + void stopSound(); +}; + +} // End of namespace Avalanche + +#endif //AVALANCHE_SOUND_H diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index bd31c2d05a0d..cbce6cb2293c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -272,7 +272,7 @@ void Timer::bang2() { } void Timer::stairs() { - _vm->_gyro->blip(); + _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_brummieStairs = 2; From d26a06a970c17c83ab3d8a85f462172edfa9b07f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 Sep 2013 00:11:50 +0200 Subject: [PATCH 1036/1332] AVALANCHE: Remove useless includes --- engines/avalanche/sound.cpp | 4 ---- engines/avalanche/sound.h | 1 - 2 files changed, 5 deletions(-) diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index bec542659437..b031e32af319 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -20,12 +20,8 @@ * */ -#include "common/debug.h" #include "common/system.h" -#include "common/textconsole.h" #include "common/config-manager.h" - -#include "audio/decoders/raw.h" #include "audio/audiostream.h" #include "avalanche/avalanche.h" diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h index 65dda96406fd..d8ffbd7291f3 100644 --- a/engines/avalanche/sound.h +++ b/engines/avalanche/sound.h @@ -24,7 +24,6 @@ #define AVALANCHE_SOUND_H #include "audio/mixer.h" -#include "audio/midiplayer.h" #include "audio/softsynth/pcspk.h" namespace Avalanche { From 2238db712cf45d1b82d51fcbf31098d6ce9d6da8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 Sep 2013 00:23:59 +0200 Subject: [PATCH 1037/1332] AVALANCHE: Remove useless function, add _soundFl --- engines/avalanche/sound.cpp | 13 +++---------- engines/avalanche/sound.h | 3 ++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index b031e32af319..7ab94c772c61 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -30,6 +30,7 @@ namespace Avalanche { SoundHandler::SoundHandler(AvalancheEngine *vm) : _vm(vm) { + _soundFl = true; _speakerStream = new Audio::PCSpeaker(_vm->_mixer->getOutputRate()); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); @@ -51,14 +52,7 @@ void SoundHandler::stopSound() { * Turn digitized sound on and off */ void SoundHandler::toggleSound() { -// _vm->_config._soundFl = !_vm->_config._soundFl; -} - -/** - * Initialize for MCI sound and midi - */ -void SoundHandler::initSound() { - //_midiPlayer->open(); + _soundFl = !_soundFl; } void SoundHandler::syncVolume() { @@ -74,8 +68,7 @@ void SoundHandler::syncVolume() { void SoundHandler::playNote(int freq, int length) { // Does the user not want any sound? -// if (!_vm->_config._soundFl || !_vm->_mixer->isReady()) - if (!_vm->_mixer->isReady()) + if (!_soundFl || !_vm->_mixer->isReady()) return; // Start a note playing (we will stop it when the timer expires). diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h index d8ffbd7291f3..a982e98ced0e 100644 --- a/engines/avalanche/sound.h +++ b/engines/avalanche/sound.h @@ -30,6 +30,8 @@ namespace Avalanche { class SoundHandler { public: + bool _soundFl; + SoundHandler(AvalancheEngine *vm); ~SoundHandler(); @@ -37,7 +39,6 @@ class SoundHandler { void playNote(int freq, int length); void click(); void blip(); - void initSound(); void syncVolume(); private: From 035604091017142b59dc317dd8d2ad9320610da8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 Sep 2013 19:04:01 +0200 Subject: [PATCH 1038/1332] AVALANCHE: Remove some STUBs, add calls to stopSound() --- engines/avalanche/celer.cpp | 2 +- engines/avalanche/closing.cpp | 9 ++++----- engines/avalanche/lucerna.cpp | 3 +-- engines/avalanche/menu.cpp | 5 +---- engines/avalanche/scrolls.cpp | 3 ++- engines/avalanche/sound.h | 3 +-- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index 37a01ed6a032..0ebd84695596 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -259,7 +259,7 @@ void Celer::updateBackgroundSprites() { _vm->_sound->playNote(_vm->_gyro->kNotes[_vm->_gyro->_nextBell], 2); break; case 2: - //nosound(); + _vm->_sound->stopSound(); break; } } diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index df53bc38b97e..900000d8bceb 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -68,13 +68,12 @@ void Closing::exitGame() { "ignore", "stare at", "shriek at", "frighten", "quieten" }; - Common::String result; - - //nosound(); - warning("STUB: Closing::exitGame()"); + _vm->_sound->stopSound(); getScreen(kScreenNagScreen); - result = nouns[_vm->_rnd->getRandomNumber(12)] + " will " + verbs[_vm->_rnd->getRandomNumber(12)] + " you"; + byte nounId = _vm->_rnd->getRandomNumber(12); + byte verbId = _vm->_rnd->getRandomNumber(12); + Common::String result = nouns[nounId] + " will " + verbs[verbId] + " you"; putIn(result, 1628); showScreen(); // No halt- it's already set up. } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 0206d0ab9c8a..2f3845249daa 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -340,7 +340,7 @@ void Lucerna::findPeople(byte room) { } void Lucerna::exitRoom(byte x) { - //nosound(); + _vm->_sound->stopSound(); _vm->_celer->forgetBackgroundSprites(); _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. @@ -365,7 +365,6 @@ void Lucerna::exitRoom(byte x) { } _vm->_gyro->_interrogation = 0; // Leaving the room cancels all the questions automatically. - _vm->_gyro->_seeScroll = false; // Now it can work again! _vm->_gyro->_lastRoom = _vm->_gyro->_room; diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index aa7cba7a8223..2d899dad78da 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -60,10 +60,7 @@ void HeadType::draw() { void HeadType::highlight() { CursorMan.showMouse(false); - //nosound(); - //setactivepage(cp); - warning("STUB: Dropdown::headytpe::highlight()"); - + _dr->_vm->_sound->stopSound(); _dr->drawMenuText(_xpos, 1, _trigger, _title, true, true); _dr->_activeMenuItem._left = _xpos; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 043921150d6c..8df46355a076 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -592,9 +592,10 @@ void Scrolls::solidify(byte n) { void Scrolls::callScrollDriver() { // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? - //nosound(); warning("STUB: Scrolls::calldrivers()"); + _vm->_sound->stopSound(); + setReadyLight(0); _vm->_gyro->_scReturn = false; bool mouthnext = false; diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h index a982e98ced0e..da2ece3b1481 100644 --- a/engines/avalanche/sound.h +++ b/engines/avalanche/sound.h @@ -40,13 +40,12 @@ class SoundHandler { void click(); void blip(); void syncVolume(); + void stopSound(); private: AvalancheEngine *_vm; Audio::PCSpeaker *_speakerStream; Audio::SoundHandle _speakerHandle; - - void stopSound(); }; } // End of namespace Avalanche From 21a9de5df23395b5a5466a7345222a045eab8135 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 19 Sep 2013 20:53:47 +0200 Subject: [PATCH 1039/1332] AVALANCHE: Rename Celer to Background. --- engines/avalanche/acci.cpp | 38 +++--- engines/avalanche/animation.cpp | 114 +++++++++--------- engines/avalanche/avalanche.cpp | 8 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 4 +- .../avalanche/{celer.cpp => background.cpp} | 18 +-- engines/avalanche/{celer.h => background.h} | 6 +- engines/avalanche/lucerna.cpp | 52 ++++---- engines/avalanche/module.mk | 2 +- engines/avalanche/sequence.cpp | 4 +- engines/avalanche/timer.cpp | 26 ++-- 11 files changed, 138 insertions(+), 138 deletions(-) rename engines/avalanche/{celer.cpp => background.cpp} (95%) rename engines/avalanche/{celer.h => background.h} (97%) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index b607478ba95a..e303d3ba5236 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -35,7 +35,7 @@ #include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/pingo.h" #include "avalanche/sequence.h" @@ -871,17 +871,17 @@ bool Acci::isHolding() { void Acci::openBox(bool isOpening) { if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_background->drawBackgroundSprite(-1, -1, 4); - _vm->_celer->updateBackgroundSprites(); + _vm->_background->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); if (!isOpening) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); - _vm->_celer->updateBackgroundSprites(); + _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); } @@ -1315,7 +1315,7 @@ void Acci::standUp() { _vm->_gyro->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->_direction = Animation::kDirLeft; - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. + _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. _vm->_lucerna->incScore(1); _vm->_gyro->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); @@ -1329,7 +1329,7 @@ void Acci::standUp() { case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) { - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Not sitting down. + _vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. _vm->_gyro->_sittingInPub = false; // Really not sitting down. @@ -1347,12 +1347,12 @@ void Acci::getProc(char thing) { case kRoomYours: if (_vm->_animation->inField(1)) { if (_vm->_gyro->_boxContent == thing) { - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_background->drawBackgroundSprite(-1, -1, 4); _vm->_scrolls->displayText("OK, I've got it."); _vm->_gyro->_objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_boxContent = kNothing; - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_background->drawBackgroundSprite(-1, -1, 5); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); _vm->_scrolls->displayText(tmpStr); @@ -1368,7 +1368,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // No pen there now. + _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! _vm->_gyro->_takenPen = true; _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; @@ -1389,7 +1389,7 @@ void Acci::getProc(char thing) { break; case kRoomRobins: if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_scrolls->displayText("Got it!"); _vm->_gyro->_mushroomGrowing = false; _vm->_gyro->_takenMushroom = true; @@ -1608,8 +1608,8 @@ void Acci::doThat() { _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; _vm->_gyro->_givenBadgeToIby = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 7); - _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 8); } else heyThanks(); break; @@ -1791,7 +1791,7 @@ void Acci::doThat() { _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. + _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. _vm->_lucerna->incScore(7); // 7 points for winning! if (_vm->_gyro->_playedNim == 1) @@ -1953,11 +1953,11 @@ void Acci::doThat() { if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 11); + _vm->_background->drawBackgroundSprite(-1, -1, 11); _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); _vm->_gyro->_drinking = _thing; - _vm->_celer->drawBackgroundSprite(-1, -1, 9); + _vm->_background->drawBackgroundSprite(-1, -1, 9); _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; @@ -1978,12 +1978,12 @@ void Acci::doThat() { return; } - _vm->_celer->drawBackgroundSprite(-1, -1, 11); + _vm->_background->drawBackgroundSprite(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); _vm->_scrolls->displayText(tmpStr); if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 9); + _vm->_background->drawBackgroundSprite(-1, -1, 9); _vm->_gyro->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); @@ -2153,7 +2153,7 @@ void Acci::doThat() { _vm->_gyro->_avvyIsAwake = true; _vm->_lucerna->incScore(1); _vm->_gyro->_avvyInBed = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. + _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) _vm->_scrolls->displayScrollChain('d', 13); } else diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index e3634e0677d8..c30104f0b611 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -33,7 +33,7 @@ #include "avalanche/scrolls.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" @@ -464,59 +464,59 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); + _vm->_background->drawBackgroundSprite(-1, -1, 27); break; case 0x1: // no connection (wall + shield), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // ...shield. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x2: // wall with door _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // ...shield. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // ...window. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 4); // ...window. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 6); // ...torches. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 6); // ...torches. + _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... + _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. @@ -531,44 +531,44 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); + _vm->_background->drawBackgroundSprite(-1, -1, 18); break; case 0x1: // no connection (wall + window), _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // ...window. + _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window. break; case 0x2: // wall with door _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door. + _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. + _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and... + _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 17); // ...torches. + _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 17); // ...torches. + _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... + _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and... + _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. _vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. @@ -586,7 +586,7 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x1: - _vm->_celer->drawBackgroundSprite(-1, -1, 21); + _vm->_background->drawBackgroundSprite(-1, -1, 21); if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) _vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; @@ -597,13 +597,13 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; break; case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 22); + _vm->_background->drawBackgroundSprite(-1, -1, 22); _vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; break; case 0x3: - _vm->_celer->drawBackgroundSprite(-1, -1, 23); + _vm->_background->drawBackgroundSprite(-1, -1, 23); _vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; @@ -624,7 +624,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_background->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; @@ -642,7 +642,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x5: - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; @@ -657,12 +657,12 @@ void Animation::catacombMove(byte ped) { case 0x7: case 0x8: case 0x9: - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_background->drawBackgroundSprite(-1, -1, 5); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->drawBackgroundSprite(-1, -1, 30); + _vm->_background->drawBackgroundSprite(-1, -1, 30); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->drawBackgroundSprite(-1, -1, 31); + _vm->_background->drawBackgroundSprite(-1, -1, 31); _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. @@ -671,50 +671,50 @@ void Animation::catacombMove(byte ped) { case 0xd: // No connection + WINDOW _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 13); + _vm->_background->drawBackgroundSprite(-1, -1, 13); break; case 0xe: // No connection + TORCH _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 7); break; // Recessed door: case 0xf: _vm->_gyro->_magics[0]._operation = Gyro::kMagicNothing; // Door to Geida's room. - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. break; } switch (xy_uint16) { case 514: - _vm->_celer->drawBackgroundSprite(-1, -1, 16); + _vm->_background->drawBackgroundSprite(-1, -1, 16); break; // [2,2] : "Art Gallery" sign over door. case 264: - _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_background->drawBackgroundSprite(-1, -1, 8); break; // [8,1] : "The Wrong Way!" sign. case 1797: - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); break; // [5,7] : "Ite Mingite" sign. case 258: for (int i = 0; i <= 2; i++) { // [2,1] : Art gallery - pictures - _vm->_celer->drawBackgroundSprite(130 + i * 120, 70, 14); - _vm->_celer->drawBackgroundSprite(184 + i * 120, 78, 15); + _vm->_background->drawBackgroundSprite(130 + i * 120, 70, 14); + _vm->_background->drawBackgroundSprite(184 + i * 120, 78, 15); } break; case 1287: for (int i = 10; i <= 13; i++) - _vm->_celer->drawBackgroundSprite(-1, -1, i - 1); + _vm->_background->drawBackgroundSprite(-1, -1, i - 1); break; // [7,5] : 4 candles. case 776: - _vm->_celer->drawBackgroundSprite(-1, -1, 9); + _vm->_background->drawBackgroundSprite(-1, -1, 9); break; // [8,3] : 1 candle. case 2049: - _vm->_celer->drawBackgroundSprite(-1, -1, 10); + _vm->_background->drawBackgroundSprite(-1, -1, 10); break; // [1,8] : another candle. case 257: - _vm->_celer->drawBackgroundSprite(-1, -1, 11); - _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_background->drawBackgroundSprite(-1, -1, 11); + _vm->_background->drawBackgroundSprite(-1, -1, 12); break; // [1,1] : the other two. } @@ -735,7 +735,7 @@ void Animation::dawnDelay() { void Animation::callSpecial(uint16 which) { switch (which) { case 1: // _vm->_gyro->special 1: Room 22: top of stairs. - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_gyro->_brummieStairs = 1; _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); @@ -782,7 +782,7 @@ void Animation::callSpecial(uint16 which) { _vm->_scrolls->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_scrolls->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; @@ -1075,7 +1075,7 @@ void Animation::arrowProcs(byte tripnum) { } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. + _vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_gyro->_arrowInTheDoor = true; // So that we can pick it up. } @@ -1301,7 +1301,7 @@ void Animation::hideInCupboard() { "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); _vm->_scrolls->displayText(tmpStr); _vm->_gyro->_avvysInTheCupboard = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 7); } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b363b8a307b1..f9e8dfc6e7d5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -65,7 +65,7 @@ AvalancheEngine::~AvalancheEngine() { delete _pingo; delete _scrolls; delete _lucerna; - delete _celer; + delete _background; delete _sequence; delete _timer; delete _animation; @@ -85,7 +85,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _pingo = new Pingo(this); _scrolls = new Scrolls(this); _lucerna = new Lucerna(this); - _celer = new Celer(this); + _background = new Background(this); _sequence = new Sequence(this); _timer = new Timer(this); _animation = new Animation(this); @@ -440,7 +440,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->dawn(); } - _celer->forgetBackgroundSprites(); + _background->forgetBackgroundSprites(); _lucerna->minorRedraw(); _menu->setup(); _gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; @@ -450,7 +450,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->drawDirection(); _gyro->_onToolbar = false; _animation->animLink(); - _celer->updateBackgroundSprites(); + _background->updateBackgroundSprites(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter, diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index c930fe7347c9..739fcd0bb89c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -38,7 +38,7 @@ #include "avalanche/pingo.h" #include "avalanche/scrolls.h" #include "avalanche/lucerna.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" #include "avalanche/animation.h" @@ -74,7 +74,7 @@ class AvalancheEngine : public Engine { Pingo *_pingo; Scrolls *_scrolls; Lucerna *_lucerna; - Celer *_celer; + Background *_background; Sequence *_sequence; Timer *_timer; Animation *_animation; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 565d54c9f7b0..f4d180e68b1d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -38,7 +38,7 @@ #include "avalanche/menu.h" #include "avalanche/pingo.h" #include "avalanche/timer.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/closing.h" #include "common/str.h" @@ -174,7 +174,7 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->_clock.update(); _vm->_menu->update(); - _vm->_celer->updateBackgroundSprites(); + _vm->_background->updateBackgroundSprites(); _vm->_animation->animLink(); _vm->_lucerna->checkClick(); _vm->_timer->updateTimer(); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/background.cpp similarity index 95% rename from engines/avalanche/celer.cpp rename to engines/avalanche/background.cpp index 0ebd84695596..3437949145e9 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/background.cpp @@ -29,7 +29,7 @@ #include "avalanche/avalanche.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/animation.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" @@ -39,21 +39,21 @@ namespace Avalanche { -const int16 Celer::kOnDisk = -1; +const int16 Background::kOnDisk = -1; -Celer::Celer(AvalancheEngine *vm) { +Background::Background(AvalancheEngine *vm) { _vm = vm; _spriteNum = 0; } -Celer::~Celer() { +Background::~Background() { forgetBackgroundSprites(); } /** * @remarks Originally called 'pics_link' */ -void Celer::updateBackgroundSprites() { +void Background::updateBackgroundSprites() { if (_vm->_menu->isActive()) return; // No animation when the menus are up. @@ -265,7 +265,7 @@ void Celer::updateBackgroundSprites() { } } -void Celer::loadBackgroundSprites(byte number) { +void Background::loadBackgroundSprites(byte number) { Common::File f; _filename = _filename.format("chunk%d.avd", number); if (!f.open(_filename)) @@ -315,7 +315,7 @@ void Celer::loadBackgroundSprites(byte number) { f.close(); } -void Celer::forgetBackgroundSprites() { +void Background::forgetBackgroundSprites() { for (int i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); @@ -326,7 +326,7 @@ void Celer::forgetBackgroundSprites() { * Draw background animation * @remarks Originally called 'show_one' */ -void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { +void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { if (_sprites[sprId]._x > kOnDisk) { if (destX < 0) { destX = _sprites[sprId]._x * 8; @@ -363,7 +363,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { -void Celer::drawSprite(int16 x, int16 y, SpriteType &sprite) { +void Background::drawSprite(int16 x, int16 y, SpriteType &sprite) { _r._x1 = x; _r._y1 = y; _r._y2 = y + sprite._yl; diff --git a/engines/avalanche/celer.h b/engines/avalanche/background.h similarity index 97% rename from engines/avalanche/celer.h rename to engines/avalanche/background.h index 538a76595612..18e47e7d8813 100644 --- a/engines/avalanche/celer.h +++ b/engines/avalanche/background.h @@ -39,10 +39,10 @@ namespace Avalanche { class AvalancheEngine; -class Celer { +class Background { public: - Celer(AvalancheEngine *vm); - ~Celer(); + Background(AvalancheEngine *vm); + ~Background(); void updateBackgroundSprites(); void loadBackgroundSprites(byte number); diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 2f3845249daa..4143a43ca136 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -34,7 +34,7 @@ #include "avalanche/scrolls.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/pingo.h" #include "avalanche/sequence.h" #include "avalanche/acci.h" @@ -320,7 +320,7 @@ void Lucerna::loadRoom(byte num) { file.close(); loadAlso(num); - _vm->_celer->loadBackgroundSprites(num); + _vm->_background->loadBackgroundSprites(num); CursorMan.showMouse(true); } @@ -341,7 +341,7 @@ void Lucerna::findPeople(byte room) { void Lucerna::exitRoom(byte x) { _vm->_sound->stopSound(); - _vm->_celer->forgetBackgroundSprites(); + _vm->_background->forgetBackgroundSprites(); _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { @@ -444,7 +444,7 @@ void Lucerna::enterRoom(byte room, byte ped) { switch (room) { case kRoomYours: if (_vm->_gyro->_avvyInBed) { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } @@ -544,7 +544,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomBridge: if (_vm->_gyro->_drawbridgeOpen == 4) { // open - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge + _vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge _vm->_graphics->refreshBackground(); _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. } @@ -570,10 +570,10 @@ void Lucerna::enterRoom(byte room, byte ped) { } if (_vm->_gyro->_tiedUp) - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); if (!_vm->_gyro->_mushroomGrowing) - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; @@ -647,11 +647,11 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomArgentPub: if (_vm->_gyro->_wonNim) - _vm->_celer->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. + _vm->_background->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. _vm->_gyro->_malagauche = 0; // Ready to boot Malagauche if (_vm->_gyro->_givenBadgeToIby) { - _vm->_celer->drawBackgroundSprite(-1, -1, 7); - _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 8); } _vm->_graphics->refreshBackground(); break; @@ -667,7 +667,7 @@ void Lucerna::enterRoom(byte room, byte ped) { if (_vm->_gyro->_geidaFollows) { putGeidaAt(4, ped); if (_vm->_gyro->_lustieIsAsleep) { - _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_background->drawBackgroundSprite(-1, -1, 4); _vm->_graphics->refreshBackground(); } } @@ -676,14 +676,14 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomMusicRoom: if (_vm->_gyro->_jacquesState > 0) { _vm->_gyro->_jacquesState = 5; - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_background->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_magics[kColorBrown - 1]._operation = Gyro::kMagicNothing; _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; } if (ped != 0) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_background->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -694,7 +694,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomOutsideNottsPub: if (ped == 2) { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->thenShow(2); @@ -706,7 +706,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomOutsideArgentPub: if (ped == 2) { - _vm->_celer->drawBackgroundSprite(-1, -1, 5); + _vm->_background->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -734,7 +734,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(1); if (_vm->_gyro->_arrowInTheDoor) @@ -743,22 +743,22 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_sequence->thenShow(2); if (_vm->_gyro->_takenPen) - _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_background->drawBackgroundSprite(-1, -1, 3); _vm->_sequence->startToClose(); } else { - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); if (_vm->_gyro->_arrowInTheDoor) - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); else - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); } break; case kRoomAvvysGarden: if (ped == 1) { - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -779,7 +779,7 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_sequence->start_to_close(); #endif - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -790,7 +790,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomAylesOffice: if (_vm->_gyro->_aylesIsAwake) - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); break; // Ayles awake. @@ -811,14 +811,14 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomNottsPub: if (_vm->_gyro->_sittingInPub) - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_npcFacing = 1; // Port. break; case kRoomOutsideDucks: if (ped == 2) { // Shut the door - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->firstShow(2); diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 0fea70e88ea5..4c50329f6838 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -11,7 +11,7 @@ MODULE_OBJS = \ pingo.o \ scrolls.o \ lucerna.o \ - celer.o \ + background.o \ sequence.o \ timer.o \ animation.o \ diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 1b55e885890b..c3940cdc6df5 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -32,7 +32,7 @@ #include "avalanche/sequence.h" #include "avalanche/gyro.h" #include "avalanche/timer.h" -#include "avalanche/celer.h" +#include "avalanche/background.h" #include "avalanche/animation.h" #include "common/scummsys.h" @@ -98,7 +98,7 @@ void Sequence::callSequencer() { if ((_seq[0] >= 1) && (_seq[0] <= 176)) { // Show a frame. - _vm->_celer->drawBackgroundSprite(-1, -1, _seq[0] - 1); + _vm->_background->drawBackgroundSprite(-1, -1, _seq[0] - 1); shoveLeft(); } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index cbce6cb2293c..59161e38200d 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -232,7 +232,7 @@ void Timer::loseTimer(byte which) { void Timer::openDrawbridge() { _vm->_gyro->_drawbridgeOpen++; - _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); + _vm->_background->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); if (_vm->_gyro->_drawbridgeOpen == 4) _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. @@ -274,7 +274,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_brummieStairs = 2; _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. @@ -393,17 +393,17 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : - _vm->_celer->drawBackgroundSprite(-1, -1, 0); // Eyes open. + _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. _vm->_scrolls->displayScrollChain('Q', 45); break; case 2 : // Going through the door. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Not on the floor. - _vm->_celer->drawBackgroundSprite(-1, -1, 2); // But going through the door. + _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. + _vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door. _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. + _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. + _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! break; } @@ -433,7 +433,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon spr->walkTo(2); // He walks over to you. // Let's get the door opening. - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); @@ -449,7 +449,7 @@ void Timer::naughtyDuke2() { } void Timer::naughtyDuke3() { - _vm->_celer->drawBackgroundSprite(-1, -1, 0); + _vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); } @@ -491,7 +491,7 @@ void Timer::jump() { if (_vm->_gyro->_carryNum >= kCarryLimit) _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); else { - _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -507,7 +507,7 @@ void Timer::crapulusSaysSpludOut() { } void Timer::buyDrinks() { - _vm->_celer->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. + _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. @@ -519,7 +519,7 @@ void Timer::buyDrinks() { } void Timer::buyWine() { - _vm->_celer->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. + _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. @@ -629,7 +629,7 @@ void Timer::avvySitDown() { if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { - _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_sittingInPub = true; _vm->_gyro->_userMovesAvvy = false; avvy->_visible = false; From 31637f198333999a75e513267002819b1ee6e752 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 19 Sep 2013 21:21:53 +0200 Subject: [PATCH 1040/1332] AVALANCHE: Cosmetic modifications. --- engines/avalanche/acci.cpp | 1 - engines/avalanche/animation.cpp | 1 - engines/avalanche/avalanche.h | 2 -- engines/avalanche/avalot.cpp | 4 ---- engines/avalanche/background.cpp | 3 +-- engines/avalanche/background.h | 2 +- engines/avalanche/closing.cpp | 3 --- engines/avalanche/detection.cpp | 8 +++++--- engines/avalanche/graphics.cpp | 4 ++-- engines/avalanche/graphics.h | 2 +- engines/avalanche/gyro.cpp | 1 - engines/avalanche/gyro.h | 6 +++--- engines/avalanche/lucerna.cpp | 1 - engines/avalanche/menu.cpp | 2 +- engines/avalanche/menu.h | 3 ++- engines/avalanche/sequence.cpp | 1 - engines/avalanche/sound.cpp | 5 +++-- engines/avalanche/timer.cpp | 1 - 18 files changed, 19 insertions(+), 31 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index e303d3ba5236..3301d474f41f 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -28,7 +28,6 @@ /* ACCIDENCE II The parser. */ #include "avalanche/avalanche.h" - #include "avalanche/acci.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index c30104f0b611..ed6f92f0063a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -28,7 +28,6 @@ /* TRIP5 Trippancy V - the sprite animation subsystem */ #include "avalanche/avalanche.h" - #include "avalanche/animation.h" #include "avalanche/scrolls.h" #include "avalanche/lucerna.h" diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 739fcd0bb89c..cd13cf5824bb 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -29,10 +29,8 @@ #define AVALANCHE_AVALANCHE_H #include "avalanche/console.h" - #include "avalanche/graphics.h" #include "avalanche/parser.h" - #include "avalanche/avalot.h" #include "avalanche/gyro.h" #include "avalanche/pingo.h" diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f4d180e68b1d..ac961a6d176a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -45,12 +45,8 @@ #include "common/textconsole.h" #include "common/config-manager.h" - - namespace Avalanche { - - Avalot::Avalot(AvalancheEngine *vm) { _vm = vm; } diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 3437949145e9..5f182bcf2fc2 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -25,10 +25,9 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* CELER The unit for updating the screen pics. */ +/* Original name: CELER The unit for updating the screen pics. */ #include "avalanche/avalanche.h" - #include "avalanche/background.h" #include "avalanche/animation.h" #include "avalanche/lucerna.h" diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 18e47e7d8813..915abb9f9066 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* CELER The unit for updating the screen pics. */ +/* Original name: CELER The unit for updating the screen pics. */ #ifndef AVALANCHE_CELER2_H #define AVALANCHE_CELER2_H diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 900000d8bceb..85d5fe0bb83c 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -28,7 +28,6 @@ /* CLOSING The closing screen and error handler. */ #include "avalanche/avalanche.h" - #include "avalanche/closing.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" @@ -36,8 +35,6 @@ #include "common/textconsole.h" #include "common/random.h" - - namespace Avalanche { Closing::Closing(AvalancheEngine *vm) { diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 6e34a5afb9cc..1b243d2845c4 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -25,12 +25,14 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#include "engines/advancedDetector.h" +#include "avalanche/avalanche.h" + #include "common/system.h" #include "common/savefile.h" -#include "graphics/thumbnail.h" -#include "avalanche/avalanche.h" +#include "engines/advancedDetector.h" + +#include "graphics/thumbnail.h" namespace Avalanche { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 806ef3f14c04..97624cf1deed 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -25,8 +25,6 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -#include "math.h" - #include "avalanche/avalanche.h" #include "avalanche/graphics.h" @@ -37,6 +35,8 @@ #include "graphics/palette.h" +#include "math.h" + namespace Avalanche { const byte Graphics::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 41b1016cb486..7706c5f75e89 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -29,9 +29,9 @@ #define AVALANCHE_GRAPHICS_H #include "common/file.h" +#include "common/rect.h" #include "graphics/surface.h" -#include "common/rect.h" namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index c1ea6a257509..9d4aa19d1ca1 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -28,7 +28,6 @@ /* GYRO It all revolves around this bit! */ #include "avalanche/avalanche.h" - #include "avalanche/gyro.h" #include "avalanche/pingo.h" #include "avalanche/scrolls.h" diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index f62c2506045f..659d2008ec83 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -30,15 +30,15 @@ #ifndef AVALANCHE_GYRO2_H #define AVALANCHE_GYRO2_H +#include "avalanche/roomnums.h" +#include "avalanche/color.h" + #include "common/str.h" #include "common/scummsys.h" #include "common/file.h" #include "graphics/surface.h" -#include "avalanche/roomnums.h" -#include "avalanche/color.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 4143a43ca136..3b30739cff53 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -28,7 +28,6 @@ /* LUCERNA The screen, [keyboard] and mouse handler.*/ #include "avalanche/avalanche.h" - #include "avalanche/lucerna.h" #include "avalanche/gyro.h" #include "avalanche/scrolls.h" diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 2d899dad78da..3e67a667e908 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ - /* DROPDOWN A customised version of Oopmenu (qv). */ +/* Original name: DROPDOWN A customised version of Oopmenu (qv). */ #include "avalanche/avalanche.h" #include "avalanche/menu.h" diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index ad0821e93220..9a00a2821f16 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -25,12 +25,13 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* DROPDOWN A customised version of Oopmenu (qv). */ +/* Original name: DROPDOWN A customised version of Oopmenu (qv). */ #ifndef AVALANCHE_DROPDOWN2_H #define AVALANCHE_DROPDOWN2_H #include "avalanche/color.h" + #include "common/scummsys.h" #include "common/str.h" diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index c3940cdc6df5..cb6bd06e6cd9 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -28,7 +28,6 @@ /* SEQUENCE The sequencer. */ #include "avalanche/avalanche.h" - #include "avalanche/sequence.h" #include "avalanche/gyro.h" #include "avalanche/timer.h" diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index 7ab94c772c61..dba679e17b15 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -20,13 +20,14 @@ * */ -#include "common/system.h" -#include "common/config-manager.h" #include "audio/audiostream.h" #include "avalanche/avalanche.h" #include "avalanche/sound.h" +#include "common/system.h" +#include "common/config-manager.h" + namespace Avalanche { SoundHandler::SoundHandler(AvalancheEngine *vm) : _vm(vm) { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 59161e38200d..b473e773bdfb 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -28,7 +28,6 @@ /* Original name: TIMEOUT The scheduling unit. */ #include "avalanche/avalanche.h" - #include "avalanche/timer.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" From 16f5f32376dc6648c5ffb6ca461a45105f4f3435 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 19 Sep 2013 22:45:03 +0200 Subject: [PATCH 1041/1332] AVALANCHE: Repair Scrolls::musicalScroll() and Scrolls::store(). --- engines/avalanche/scrolls.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 8df46355a076..83656a365e76 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -190,7 +190,7 @@ void Scrolls::scrollModeDialogue() { } void Scrolls::store(byte what, TuneType &played) { - memcpy(played + 1, played + 2, sizeof(played) - 1); + memcpy(played, played + 1, sizeof(played) - 1); played[30] = what; } @@ -809,7 +809,9 @@ void Scrolls::musicalScroll() { displayText(tmpStr); _vm->_lucerna->spriteRun(); + CursorMan.showMouse(false); drawScroll(&Avalanche::Scrolls::scrollModeMusic); + CursorMan.showMouse(true); resetScroll(); } From 5ccff749a5d3bdbc3c9fac3023e5a336f4f8f2c1 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 20 Sep 2013 00:23:20 +0200 Subject: [PATCH 1042/1332] AVALANCHE: Add minigame: playing the harp. --- engines/avalanche/gyro.cpp | 2 - engines/avalanche/gyro.h | 1 - engines/avalanche/scrolls.cpp | 125 ++++++++++++++++++++++++++++------ 3 files changed, 104 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 9d4aa19d1ca1..0754ae3ca76e 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -131,8 +131,6 @@ const QuasipedType Gyro::kQuasipeds[16] = { {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; -const char Gyro::kMusicKeys[] = "QWERTYUIOP[]"; - const uint16 Gyro::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; const TuneType Gyro::kTune = { diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 659d2008ec83..51b6c155f10d 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -221,7 +221,6 @@ class Gyro { kPitchHigher }; - static const char kMusicKeys[]; static const uint16 kNotes[12]; static const TuneType kTune; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 83656a365e76..9e5617022688 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -131,7 +131,9 @@ void Scrolls::scrollModeNormal() { _vm->getEvent(event); if ((event.type == Common::EVENT_LBUTTONUP) || - ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS)))) + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) + || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) + || (event.kbd.keycode == Common::KEYCODE_PLUS)))) break; } @@ -208,30 +210,111 @@ bool Scrolls::theyMatch(TuneType &played) { void Scrolls::scrollModeMusic() { setReadyLight(3); _vm->_gyro->_seeScroll = true; - CursorMan.showMouse(true); + CursorMan.showMouse(false); _vm->_gyro->newMouse(3); - // Since there are no sounds in the game yet, it's pretty pointless to implement this function further. - // For now we act like the player just played the right tone. -#if 0 - if (they_match(played)) { -#endif - _vm->_gyro->_scReturn = true; - CursorMan.showMouse(false); - setReadyLight(0); - _vm->_gyro->_seeScroll = false; + TuneType played; + for (int i = 0; i < sizeof(played); i++) + played[i] = 0; + byte lastOne = 0, thisOne = 0; - _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); - warning("STUB: Scrolls::music_scroll()"); - return; -#if 0 - } + _vm->_gyro->_seeScroll = true; - _vm->_gyro->screturn = false; - CursorMan.showMouse(false); - state(0); - _vm->_gyro->seescroll = false; -#endif + ::Graphics::Surface temp; + temp.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + + Common::Event event; + while (!_vm->shouldQuit()) { + _vm->_graphics->refreshScreen(); + + _vm->getEvent(event); + + // When we stop playing? + if ((event.type == Common::EVENT_LBUTTONDOWN) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)))) { + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); + _vm->_gyro->_seeScroll = false; + CursorMan.showMouse(true); + return; + } + + // When we DO play: + if ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_q) + || (event.kbd.keycode == Common::KEYCODE_w) || (event.kbd.keycode == Common::KEYCODE_e) + || (event.kbd.keycode == Common::KEYCODE_r) || (event.kbd.keycode == Common::KEYCODE_t) + || (event.kbd.keycode == Common::KEYCODE_y) || (event.kbd.keycode == Common::KEYCODE_u) + || (event.kbd.keycode == Common::KEYCODE_i) || (event.kbd.keycode == Common::KEYCODE_o) + || (event.kbd.keycode == Common::KEYCODE_p) || (event.kbd.keycode == Common::KEYCODE_LEFTBRACKET) + || (event.kbd.keycode == Common::KEYCODE_RIGHTBRACKET))) { + byte value; + switch (event.kbd.keycode) { + case Common::KEYCODE_q: + value = 0; + break; + case Common::KEYCODE_w: + value = 1; + break; + case Common::KEYCODE_e: + value = 2; + break; + case Common::KEYCODE_r: + value = 3; + break; + case Common::KEYCODE_t: + value = 4; + break; + case Common::KEYCODE_y: + value = 5; + break; + case Common::KEYCODE_u: + value = 6; + break; + case Common::KEYCODE_i: + value = 7; + break; + case Common::KEYCODE_o: + value = 8; + break; + case Common::KEYCODE_p: + value = 9; + break; + case Common::KEYCODE_LEFTBRACKET: + value = 10; + break; + case Common::KEYCODE_RIGHTBRACKET: + value = 11; + break; + } + + lastOne = thisOne; + thisOne = value; + + _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); + + if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. + if (thisOne < lastOne) + store(Gyro::kPitchLower, played); + else if (thisOne == lastOne) + store(Gyro::kPitchSame, played); + else + store(Gyro::kPitchHigher, played); + } + + if (theyMatch(played)) { + setReadyLight(0); + _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); + + + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); + _vm->_gyro->_seeScroll = false; + CursorMan.showMouse(true); + return; + } + } + } } void Scrolls::resetScrollDriver() { From 207335d0f22ef821bd9c314ce13346ec6ff8b7c5 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 20 Sep 2013 00:56:41 +0200 Subject: [PATCH 1043/1332] AVALANCHE: Repair minigame: Harp. --- engines/avalanche/gyro.h | 3 ++- engines/avalanche/scrolls.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 51b6c155f10d..155feee8ded7 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -216,9 +216,10 @@ class Gyro { static const QuasipedType kQuasipeds[16]; enum Pitch { + kPitchInvalid, kPitchLower, kPitchSame, - kPitchHigher + kPitchHigher, }; static const uint16 kNotes[12]; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 9e5617022688..8936bfad8be7 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -215,8 +215,8 @@ void Scrolls::scrollModeMusic() { TuneType played; for (int i = 0; i < sizeof(played); i++) - played[i] = 0; - byte lastOne = 0, thisOne = 0; + played[i] = Gyro::kPitchInvalid; + int8 lastOne = -1, thisOne = -1; // Invalid values. _vm->_gyro->_seeScroll = true; From 4b84999a30670350faa7e950113dba309475f168 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 20 Sep 2013 01:20:31 +0200 Subject: [PATCH 1044/1332] AVALANCHE: Another addition regarding the harp game. --- engines/avalanche/scrolls.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 8936bfad8be7..6a2cd8d2c073 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -292,6 +292,7 @@ void Scrolls::scrollModeMusic() { thisOne = value; _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); + _vm->_system->delayMillis(500); if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. if (thisOne < lastOne) From 95b2e2724361b2bdfa2a8291c36a825893255e48 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 20 Sep 2013 01:50:18 +0200 Subject: [PATCH 1045/1332] AVALANCHE: A little revision of the harp minigame. --- engines/avalanche/scrolls.cpp | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 6a2cd8d2c073..2b8e11487d4b 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -233,21 +233,17 @@ void Scrolls::scrollModeMusic() { // When we stop playing? if ((event.type == Common::EVENT_LBUTTONDOWN) || ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)))) { - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); - _vm->_gyro->_seeScroll = false; - CursorMan.showMouse(true); - return; + break; } // When we DO play: - if ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_q) - || (event.kbd.keycode == Common::KEYCODE_w) || (event.kbd.keycode == Common::KEYCODE_e) - || (event.kbd.keycode == Common::KEYCODE_r) || (event.kbd.keycode == Common::KEYCODE_t) - || (event.kbd.keycode == Common::KEYCODE_y) || (event.kbd.keycode == Common::KEYCODE_u) - || (event.kbd.keycode == Common::KEYCODE_i) || (event.kbd.keycode == Common::KEYCODE_o) - || (event.kbd.keycode == Common::KEYCODE_p) || (event.kbd.keycode == Common::KEYCODE_LEFTBRACKET) - || (event.kbd.keycode == Common::KEYCODE_RIGHTBRACKET))) { + if ((event.type == Common::EVENT_KEYDOWN) + && ((event.kbd.keycode == Common::KEYCODE_q) || (event.kbd.keycode == Common::KEYCODE_w) + || (event.kbd.keycode == Common::KEYCODE_e) || (event.kbd.keycode == Common::KEYCODE_r) + || (event.kbd.keycode == Common::KEYCODE_t) || (event.kbd.keycode == Common::KEYCODE_y) + || (event.kbd.keycode == Common::KEYCODE_u) || (event.kbd.keycode == Common::KEYCODE_i) + || (event.kbd.keycode == Common::KEYCODE_o) || (event.kbd.keycode == Common::KEYCODE_p) + || (event.kbd.keycode == Common::KEYCODE_LEFTBRACKET) || (event.kbd.keycode == Common::KEYCODE_RIGHTBRACKET))) { byte value; switch (event.kbd.keycode) { case Common::KEYCODE_q: @@ -292,7 +288,7 @@ void Scrolls::scrollModeMusic() { thisOne = value; _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); - _vm->_system->delayMillis(500); + _vm->_system->delayMillis(200); if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. if (thisOne < lastOne) @@ -306,16 +302,15 @@ void Scrolls::scrollModeMusic() { if (theyMatch(played)) { setReadyLight(0); _vm->_timer->addTimer(8, Timer::kProcJacquesWakesUp, Timer::kReasonJacquesWakingUp); - - - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); - _vm->_gyro->_seeScroll = false; - CursorMan.showMouse(true); - return; + break; } } } + + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); + _vm->_gyro->_seeScroll = false; + CursorMan.showMouse(true); } void Scrolls::resetScrollDriver() { From f78de9b382c916f194fe89d2c44cf0139fba1fc8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:02:18 +0200 Subject: [PATCH 1046/1332] AVALANCHE: Add check on shouldQuit() in Harp mini-game --- engines/avalanche/scrolls.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 2b8e11487d4b..67c8fbd9c09d 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -130,7 +130,8 @@ void Scrolls::scrollModeNormal() { _vm->_graphics->refreshScreen(); _vm->getEvent(event); - if ((event.type == Common::EVENT_LBUTTONUP) || + if (_vm->shouldQuit() || + (event.type == Common::EVENT_LBUTTONUP) || ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS)))) From bb58813eeec71104e770867533e55940d6262de9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:02:18 +0200 Subject: [PATCH 1047/1332] AVALANCHE: Remove code used for Demo --- engines/avalanche/avalanche.cpp | 15 --------------- engines/avalanche/avalanche.h | 4 +--- engines/avalanche/gyro.h | 10 ---------- engines/avalanche/scrolls.cpp | 7 +------ 4 files changed, 2 insertions(+), 34 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f9e8dfc6e7d5..b7fa2ac48f7b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -621,26 +621,11 @@ Common::String AvalancheEngine::elmToStr(Elm how) { } } -// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. -bool AvalancheEngine::keyPressed() { - warning("STUB: keyPressed()"); - return false; -} - // Same as keypressed1(). void AvalancheEngine::flushBuffer() { warning("STUB: flushBuffer()"); } -// Same as keypressed1(). -void AvalancheEngine::demo() { - warning("STUB: demo()"); -} - -void AvalancheEngine::runDemo() { - warning("STUB: runDemo()"); -} - void AvalancheEngine::dosShell() { warning("STUB: dosShell()"); } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index cd13cf5824bb..90f3436d63b0 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -147,7 +147,7 @@ class AvalancheEngine : public Engine { // From bootstrp: enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; - Common::String _demoArgs, _argsWithNoFilename; + Common::String _argsWithNoFilename; byte _originalMode; byte *_old1c; Common::String _segofs; @@ -158,8 +158,6 @@ class AvalancheEngine : public Engine { Common::String elmToStr(Elm how); bool keyPressed(); void flushBuffer(); - void demo(); - void runDemo(); void dosShell(); void bFlight(); Common::String commandCom(); diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 155feee8ded7..a50fa1536ecd 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -76,11 +76,6 @@ class LineType : public FieldType { byte _color; }; -struct DemoType { - uint16 _delay; - char _key, _extd; -}; - typedef byte TuneType[31]; struct QuasipedType { @@ -351,11 +346,6 @@ class Gyro { byte _him, _her, _it; int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - // For the demo: - DemoType _demoRec; - Common::File _demoFile; // of demo_type - Common::DumpFile _demoFileSave; // uruk added it - first use located in constructor of Basher - byte _lastPerson; // Last person to have been selected using the People menu. bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 67c8fbd9c09d..fdcf5202fceb 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -151,12 +151,7 @@ void Scrolls::scrollModeNormal() { //#ifdef RECORD slowdown(); basher::count += 1; #endif - if (_vm->_gyro->demo) { - if (_vm->_basher->demo_ready()) - break; - if (_vm->_enhanced->keypressede()) - return; - } else if (_vm->_enhanced->keypressede()) + if (_vm->_enhanced->keypressede()) break; } while (!((mrelease > 0) || (buttona1()) || (buttonb1()))); From f88ca9dc81e81a03c476d0224422a42d7d30e225 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:35:50 +0200 Subject: [PATCH 1048/1332] AVALANCHE: Remove misc dead or useless code: useless arguments, stubbed ini file reading, etc --- engines/avalanche/avalanche.cpp | 55 ++++----------------------------- engines/avalanche/avalanche.h | 20 ++++-------- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/avalot.h | 2 +- 4 files changed, 14 insertions(+), 65 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b7fa2ac48f7b..7d216fad33ec 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -519,63 +519,15 @@ Common::Point AvalancheEngine::getMousePos() { return _eventMan->getMousePos(); } -// From Bootstrp: -const char AvalancheEngine::kRuncodes[2][3] = {"et", "Go"}; - -void AvalancheEngine::bFlightOn() { - _storage._skellern = kReset; - // setintvec(0x1c, &b_flight); -} - -void AvalancheEngine::getArguments() { - // This function should mess around with command line arguments, - // but I am not sure if there'll be use of these arguments at all... - warning("STUB: getArguments()"); -} - -void AvalancheEngine::getSlope() { - // Same as get_arguments() - warning("STUB: getSlope()"); -} - -void AvalancheEngine::callMenu() { - warning("STUB: callMenu()"); -} - -void AvalancheEngine::runAvalot() { - bFlightOn(); - - _avalot->run(Common::String(kRuncodes[_firstTime]) + _arguments); - // TODO: Check if parameters are ever used (probably not) and eventually remove them. - // If there's an error initializing avalot, i'll handle it in there, not here - - _firstTime = false; -} - Common::Error AvalancheEngine::run() { Common::ErrorCode err = initialize(); if (err != Common::kNoError) return err; - // From bootstrp: - _firstTime = true; - - getArguments(); - getSlope(); - - _zoomy = true; - // Don't call the menu by default. Might be modified later, if get_slope() gets implemented, - // because zoomy's value is given there. Not sure yet what "zoomy" stands for. - if (!_zoomy) - callMenu(); // Not run when zoomy. - do { - runAvalot(); + _avalot->runAvalot(); // Needed for later implementation!!! Don't remove these comments!!! - - //if (dosexitcode != 77) quit(); // Didn't stop for us. - //switch (_storage._operation) { //case kRunShootemup: // run("seu.avx", kJsb, kBflight, kNormal); @@ -602,6 +554,11 @@ void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, E // Probably there'll be no need of this function, as all *.AVX-es will become classes. } +void AvalancheEngine::bFlightOn() { + _storage._skellern = kReset; + // setintvec(0x1c, &b_flight); +} + void AvalancheEngine::bFlightOff() { // setintvec(0x1c, old_1c); } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 90f3436d63b0..16482c8c927f 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -122,28 +122,18 @@ class AvalancheEngine : public Engine { AvalancheConsole *_console; Common::Platform _platform; - static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; - static const char kRuncodes[2][3]; - static const int16 kReset = 0; - static const bool kJsb = true, kNoJsb = false, kBflight = true, kNoBflight = false; - +#if 0 struct { byte _operation; uint16 _skellern; byte _contents[1000]; } _storage; - Common::String _arguments; - bool _firstTime; - bool _zoomy; + static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; + static const int16 kReset = 0; - void bFlightOn(); - void getArguments(); - void getSlope(); - void callMenu(); - void runAvalot(); + static const bool kJsb = true, kNoJsb = false, kBflight = true, kNoBflight = false; -#if 0 // From bootstrp: enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; @@ -152,8 +142,10 @@ class AvalancheEngine : public Engine { byte *_old1c; Common::String _segofs; int32 _soundcard, _speed, _baseaddr, _irq, _dma; + bool _zoomy; void run(Common::String what, bool withJsb, bool withBflight, Elm how); + void bFlightOn(); void bFlightOff(); Common::String elmToStr(Elm how); bool keyPressed(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ac961a6d176a..dbc38be178b0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -160,7 +160,7 @@ void Avalot::setup() { } } -void Avalot::run(Common::String arg) { +void Avalot::runAvalot() { setup(); do { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 34a9d9f7ba6a..1f2046604ffd 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -42,7 +42,7 @@ class Avalot { void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void setup(); - void run(Common::String arg); + void runAvalot(); private: AvalancheEngine *_vm; From b11bf988f49c889650b9ab9ce1c0edd12c9f9d0f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:46:39 +0200 Subject: [PATCH 1049/1332] AVALANCHE: Remove roomnums.h --- engines/avalanche/background.cpp | 1 - engines/avalanche/gyro.h | 14 +++++- engines/avalanche/lucerna.cpp | 1 - engines/avalanche/roomnums.h | 75 -------------------------------- 4 files changed, 13 insertions(+), 78 deletions(-) delete mode 100644 engines/avalanche/roomnums.h diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 5f182bcf2fc2..d9f606b74e8f 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -32,7 +32,6 @@ #include "avalanche/animation.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" -#include "avalanche/roomnums.h" #include "common/textconsole.h" diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index a50fa1536ecd..6bd2040917a1 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -30,7 +30,6 @@ #ifndef AVALANCHE_GYRO2_H #define AVALANCHE_GYRO2_H -#include "avalanche/roomnums.h" #include "avalanche/color.h" #include "common/str.h" @@ -42,6 +41,19 @@ namespace Avalanche { class AvalancheEngine; +// CHECKME: kRoomBossKey is a guess +enum Room { + kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, + kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10, + kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14, + kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20, + kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25, + kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29, + kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47, + kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, + kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room +}; + static const byte kObjectNum = 18; // always preface with a # static const int16 kCarryLimit = 12; // carry limit diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 3b30739cff53..b50a5160ba57 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -37,7 +37,6 @@ #include "avalanche/pingo.h" #include "avalanche/sequence.h" #include "avalanche/acci.h" -#include "avalanche/roomnums.h" #include "common/rect.h" #include "common/system.h" diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h deleted file mode 100644 index a963468db2fa..000000000000 --- a/engines/avalanche/roomnums.h +++ /dev/null @@ -1,75 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -#ifndef AVALANCHE_ROOMNUMS_H -#define AVALANCHE_ROOMNUMS_H - -#include "common/system.h" - -namespace Avalanche { - -enum Room { - kRoomNowhere = 0, - kRoomYours = 1, - kRoomOutsideYours = 2, - kRoomOutsideSpludwicks = 3, - kRoomYourHall = 5, - kRoomMusicRoom = 7, - kRoomOutsideArgentPub = 9, - kRoomArgentRoad = 10, - kRoomWiseWomans = 11, - kRoomSpludwicks = 12, - kRoomInsideAbbey = 13, - kRoomOutsideAbbey = 14, - kRoomAvvysGarden = 15, - kRoomAylesOffice = 16, - kRoomArgentPub = 19, - kRoomBrummieRoad = 20, - kRoomBridge = 21, - kRoomLusties = 22, - kRoomLustiesRoom = 23, - kRoomWestHall = 25, - kRoomEastHall = 26, - kRoomOubliette = 27, - kRoomGeidas = 28, - kRoomCatacombs = 29, - kRoomEntranceHall = 40, - kRoomRobins = 42, - kRoomOutsideNottsPub = 46, - kRoomNottsPub = 47, - kRoomOutsideDucks = 50, - kRoomDucks = 51, - kRoomOutsideCardiffCastle = 70, - kRoomInsideCardiffCastle = 71, - kRoomBossKey = 98, // assumed - kRoomMap = 99, - kRoomDummy = 177 // Dummy room -}; - -} // End of namespace Avalanche - -#endif // AVALANCHE_ROOMNUMS_H From a7bb292cbaa32fed01e65ea24ead472572a72f5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:52:18 +0200 Subject: [PATCH 1050/1332] AVALANCHE: Remove color.h --- engines/avalanche/color.h | 58 --------------------------------------- engines/avalanche/gyro.h | 9 ++++-- engines/avalanche/menu.h | 2 -- 3 files changed, 7 insertions(+), 62 deletions(-) delete mode 100644 engines/avalanche/color.h diff --git a/engines/avalanche/color.h b/engines/avalanche/color.h deleted file mode 100644 index e9f9c460bce2..000000000000 --- a/engines/avalanche/color.h +++ /dev/null @@ -1,58 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -// Color constants replacing the colors from the CRT unit of Pascal - -#ifndef AVALANCHE_COLOR_H -#define AVALANCHE_COLOR_H - -#include "common/system.h" - -namespace Avalanche { - -enum Color { - kColorBlack, - kColorBlue, - kColorGreen, - kColorCyan, - kColorRed, - kColorMagenta, - kColorBrown, - kColorLightgray, - kColorDarkgray, - kColorLightblue, - kColorLightgreen, - kColorLightcyan, - kColorLightred, - kColorLightmagenta, - kColorYellow, - kColorWhite -}; - -} // End of namespace Avalanche - -#endif // AVALANCHE_COLOR_H diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 6bd2040917a1..43809becee80 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -30,8 +30,6 @@ #ifndef AVALANCHE_GYRO2_H #define AVALANCHE_GYRO2_H -#include "avalanche/color.h" - #include "common/str.h" #include "common/scummsys.h" #include "common/file.h" @@ -41,6 +39,13 @@ namespace Avalanche { class AvalancheEngine; +enum Color { + kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, + kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, + kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, + kColorWhite +}; + // CHECKME: kRoomBossKey is a guess enum Room { kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 9a00a2821f16..5f9c8961318f 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -30,8 +30,6 @@ #ifndef AVALANCHE_DROPDOWN2_H #define AVALANCHE_DROPDOWN2_H -#include "avalanche/color.h" - #include "common/scummsys.h" #include "common/str.h" From 6943fcfb031d21823a2ca4a93b80159bd516e586 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 07:55:10 +0200 Subject: [PATCH 1051/1332] AVALANCHE: Janitorial - leftover Bristish -> American English --- engines/avalanche/menu.cpp | 2 +- engines/avalanche/menu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 3e67a667e908..2a537eb456a0 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* Original name: DROPDOWN A customised version of Oopmenu (qv). */ +/* Original name: DROPDOWN A customized version of Oopmenu (qv). */ #include "avalanche/avalanche.h" #include "avalanche/menu.h" diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 5f9c8961318f..35acbbe718ed 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -25,7 +25,7 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ -/* Original name: DROPDOWN A customised version of Oopmenu (qv). */ +/* Original name: DROPDOWN A customized version of Oopmenu (qv). */ #ifndef AVALANCHE_DROPDOWN2_H #define AVALANCHE_DROPDOWN2_H From 2b6364674093a4bbb2bc0865bc3db748f7436784 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 23:09:43 +0200 Subject: [PATCH 1052/1332] AVALANCHE: Remove some useless/dead code --- engines/avalanche/animation.cpp | 8 -------- engines/avalanche/gyro.cpp | 2 +- engines/avalanche/gyro.h | 8 -------- engines/avalanche/lucerna.cpp | 4 ---- engines/avalanche/menu.cpp | 10 +--------- engines/avalanche/pingo.cpp | 7 ++----- engines/avalanche/scrolls.cpp | 31 +++++++------------------------ 7 files changed, 11 insertions(+), 59 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index ed6f92f0063a..e2f772145b50 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -248,9 +248,7 @@ void AnimationType::bounce() { _anim->stopWalking(); else stopWalk(); - _anim->_vm->_gyro->_onCanDoPageSwap = false; _anim->_vm->_lucerna->drawDirection(); - _anim->_vm->_gyro->_onCanDoPageSwap = true; } int8 AnimationType::getSign(int16 val) { @@ -375,7 +373,6 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { // if not alive then begin checkfeet:=0; exit; end; byte a = 0; - //setactivepage(2); if (x1 < 0) x1 = 0; if (x2 > 639) @@ -398,7 +395,6 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { } } - //setactivepage(1 - cp); return a; } @@ -950,8 +946,6 @@ void Animation::updateSpeed() { _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - //setactivepage(3); - if (_sprites[0]._speedX == _vm->_gyro->kRun) _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else @@ -961,8 +955,6 @@ void Animation::updateSpeed() { _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); - - //setactivepage(1 - cp); } void Animation::changeDirection(byte t, byte dir) { diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 0754ae3ca76e..e338ecddbc99 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -166,7 +166,7 @@ byte Gyro::_whereIs[29] = { kRoomWiseWomans // The Wise Woman. }; -Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { +Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0) { _vm = vm; // Needed because of Lucerna::load_also() diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 43809becee80..16d7df22ba41 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -235,21 +235,13 @@ class Gyro { }; static const uint16 kNotes[12]; - static const TuneType kTune; - - // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; - static byte _whereIs[29]; - // Variable static constant for overriding the ability of On to switch pages. - // You may know better than On which page to switch to. - bool _onCanDoPageSwap; - // Former DNA structure byte _carryNum; // How many objects you're carrying... bool _objects[kObjectNum]; // ...and which ones they are. diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index b50a5160ba57..98a977532379 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -605,10 +605,8 @@ void Lucerna::enterRoom(byte room, byte ped) { case kRoomMap: // You're entering the map. dawn(); - //setactivepage(cp); if (ped > 0) zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); - //setactivepage(1 - cp); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { _vm->_scrolls->displayScrollChain('q', 9); // Don't want to waste the wine! @@ -867,9 +865,7 @@ void Lucerna::thinkAbout(byte object, bool type) { CursorMan.showMouse(false); #if 0 - setactivepage(3); putimage(x, y, p, 0); - setactivepage(1 - cp); #endif CursorMan.showMouse(true); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 2a537eb456a0..4be95730157c 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -123,8 +123,6 @@ void MenuItem::displayOption(byte y, bool highlit) { void MenuItem::display() { CursorMan.showMouse(false); - //setactivepage(cp); - //setvisualpage(cp); //setfillstyle(1, menu_b); //setcolor(menu_border); _firstlix = true; @@ -143,12 +141,11 @@ void MenuItem::display() { _dr->_vm->_gyro->_defaultLed = 1; _dr->_vm->_gyro->_currentMouse = 177; - //mousepage(cp); + CursorMan.showMouse(true); // 4 = fletch } void MenuItem::wipe() { - //setactivepage(cp); CursorMan.showMouse(false); _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); @@ -168,11 +165,9 @@ void MenuItem::moveHighlight(int8 inc) { return; _highlightNum = highlightNum; } - //setactivepage(cp); CursorMan.showMouse(false); displayOption(_oldY, false); displayOption(_highlightNum, true); - //setactivepage(1 - cp); _oldY = _highlightNum; CursorMan.showMouse(true); } @@ -225,8 +220,6 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu } void MenuBar::draw() { - //setactivepage(3); - _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); byte savecp = _dr->_vm->_gyro->_cp; @@ -703,7 +696,6 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->updateEvents(); while (_vm->_lucerna->_holdLeftMouse); - while (!_vm->shouldQuit()) { do { _vm->updateEvents(); diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 8fa1ef0d6a1c..0e6ec52f3138 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -57,7 +57,7 @@ const var fv:byte; gd,gm:int16; r:char; begin; dusk; delavvy; - setactivepage(3); mousepage(3); setvisualpage(3); off; + off; cleardevice; setfillstyle(xhatchfill,11); settextstyle(1,0,4); settextjustify(1,1); dplot(320,10,title); @@ -78,7 +78,7 @@ begin; newpointer(6); { TTHand } dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); - dusk; setvisualpage(0); setactivepage(0); mousepage(0); dawn; + dusk; dawn; copy02; #endif @@ -126,11 +126,8 @@ void Pingo::winningPic() { } #endif - warning("STUB: Pingo::winningPic()"); - f.close(); - //setvisualpage(0); warning("STUB: Pingo::winningPic()"); _vm->_lucerna->dawn(); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index fdcf5202fceb..b2a81a7b2e8e 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -378,14 +378,9 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { } void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { - int16 ex; - - //setvisualpage(cp); - //setactivepage(1 - cp); - _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! - int16 lx = 0; int16 ly = (_vm->_gyro->_scrollNum) * 6; + int16 ex; for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { ex = _vm->_gyro->_scroll[i].size() * 8; if (lx < ex) @@ -489,7 +484,6 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { } _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. - //setvisualpage(1 - cp); ringBell(); //my = getpixel(0, 0); _vm->_gyro->_dropsOk = false; @@ -499,13 +493,10 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { unDodgem(); _vm->_gyro->_dropsOk = true; - //setvisualpage(cp); - //mousepage(cp); CursorMan.showMouse(false); // mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0); //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); //blitfix(); - _vm->_gyro->_onCanDoPageSwap = true; // Normality again. CursorMan.showMouse(true); //settextjustify(0, 0); // sink resetScrollDriver(); @@ -518,15 +509,8 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { Common::Point points[3]; // byte *rp1, *rp2; // replace: 1=bubble, 2=pointer - int16 xc; // x correction - - //setvisualpage(cp); - //setactivepage(1 - cp); - _vm->_gyro->_onCanDoPageSwap = false; // On can now no longer swap pages. So we can do what we want without its interference! - //mousepage(1 - cp); // Mousepage CursorMan.showMouse(false); - int16 xl = 0; int16 yl = _vm->_gyro->_scrollNum * 5; for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { @@ -539,7 +523,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { int16 xw = xl + 18; int16 yw = yl + 7; int16 my = yw * 2 - 2; - xc = 0; + int16 xc = 0; if ((_vm->_gyro->_talkX - xw) < 0) xc = -(_vm->_gyro->_talkX - xw); @@ -585,9 +569,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); } - //setvisualpage(1 - cp); ringBell(); - _vm->_gyro->_onCanDoPageSwap = false; CursorMan.showMouse(true); _vm->_gyro->_dropsOk = false; @@ -597,12 +579,13 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { CursorMan.showMouse(false); _vm->_gyro->_dropsOk = true; - //setvisualpage(cp); CursorMan.showMouse(true); // sink; - _vm->_gyro->_onCanDoPageSwap = true; resetScrollDriver(); - /*if (_vm->_gyro->mpress > 0) - _vm->_gyro->after_the_scroll = true;*/ + +#if 0 + if (_vm->_gyro->mpress > 0) + _vm->_gyro->after_the_scroll = true; +#endif } bool Scrolls::displayQuestion(Common::String question) { From c7f888de7c903a959df29440594888bc9caed4b7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Sep 2013 23:19:30 +0200 Subject: [PATCH 1053/1332] AVALANCHE: Remove remaining off and on calls in commented code --- engines/avalanche/animation.cpp | 6 +++--- engines/avalanche/menu.cpp | 24 ++++++++++++------------ engines/avalanche/menu.h | 2 +- engines/avalanche/pingo.cpp | 6 ++++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index e2f772145b50..90966c4cf921 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -103,7 +103,7 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { } _animCount++; - // on; + CursorMan.showMouse(true); _x = 0; _y = 0; _quick = true; @@ -1051,13 +1051,13 @@ void Animation::arrowProcs(byte tripnum) { #if 0 tr[1].done; { Deallocate normal pic of Avvy. } - off; + CursorMan.showMouse(false); for byte fv:=0 to 1 do begin cp:=1-cp; getback; end; - on; + CursorMan.showMouse(true); #endif _vm->_lucerna->gameOver(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 4be95730157c..701435e096f3 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -38,37 +38,37 @@ namespace Avalanche { -void HeadType::init(char trig, char altTrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr) { +void HeadType::init(char trig, char altTrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *menu) { _trigger = trig; _altTrigger = altTrig; _title = title; _position = pos; - _xpos = _position * _dr->kSpacing + _dr->kIndent; - _xright = (_position + 1) * _dr->kSpacing + _dr->kIndent; + _xpos = _position * _menu->kSpacing + _menu->kIndent; + _xright = (_position + 1) * _menu->kSpacing + _menu->kIndent; _setupFunc = setupFunc; _chooseFunc = chooseFunc; - _dr = dr; + _menu = menu; } void HeadType::draw() { CursorMan.showMouse(false); - _dr->drawMenuText(_xpos, 1, _trigger, _title, true, false); + _menu->drawMenuText(_xpos, 1, _trigger, _title, true, false); CursorMan.showMouse(true); } void HeadType::highlight() { CursorMan.showMouse(false); - _dr->_vm->_sound->stopSound(); - _dr->drawMenuText(_xpos, 1, _trigger, _title, true, true); + _menu->_vm->_sound->stopSound(); + _menu->drawMenuText(_xpos, 1, _trigger, _title, true, true); - _dr->_activeMenuItem._left = _xpos; - _dr->_activeMenuItem._activeNow = true; - _dr->_activeMenuItem._activeNum = _position; - _dr->_menuActive = true; + _menu->_activeMenuItem._left = _xpos; + _menu->_activeMenuItem._activeNow = true; + _menu->_activeMenuItem._activeNum = _position; + _menu->_menuActive = true; - _dr->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. + _menu->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 35acbbe718ed..da9f93b05993 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -54,7 +54,7 @@ class HeadType { bool parseAltTrigger(char key); private: - Menu *_dr; + Menu *_menu; }; struct OptionType { diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 0e6ec52f3138..b97fb6728287 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -57,7 +57,7 @@ const var fv:byte; gd,gm:int16; r:char; begin; dusk; delavvy; - off; + CursorMan.showMouse(false); cleardevice; setfillstyle(xhatchfill,11); settextstyle(1,0,4); settextjustify(1,1); dplot(320,10,title); @@ -76,7 +76,9 @@ begin; setcolor(yellow); outtextxy(gd+1,gm-1,fish); end; newpointer(6); { TTHand } - dawn; on; setbkcolor(1); repeat check until (mpress>0) or keypressed; + dawn; + CursorMan.showMouse(true); + setbkcolor(1); repeat check until (mpress>0) or keypressed; while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); dusk; dawn; copy02; From 8557b06197bde4574be34810bcf59c3530acc326 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:03:49 -0500 Subject: [PATCH 1054/1332] ZVISION: Load the state values before changing location --- engines/zvision/save_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index e09d31557a0d..70de9050e8c8 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -144,12 +144,12 @@ Common::Error SaveManager::loadGame(uint slot) { uint32 offset = (char)saveFile->readUint32LE(); ScriptManager *scriptManager = _engine->getScriptManager(); - // Load the room - scriptManager->changeLocation(world, room, node, view, offset); - // Update the state table values scriptManager->deserializeStateTable(saveFile); + // Load the room + scriptManager->changeLocation(world, room, node, view, offset); + // Update the controls scriptManager->deserializeControls(saveFile); From ca80deea62a0ca675ec53148e0e3237e716c5082 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:04:31 -0500 Subject: [PATCH 1055/1332] ZVISION: Only allow save slots in the range [1, 20] This is the range supported by the ZNem / ZGI save menus --- engines/zvision/save_manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 70de9050e8c8..dbed109d51f6 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -40,6 +40,9 @@ namespace ZVision { const uint32 SaveManager::SAVEGAME_ID = MKTAG('Z', 'E', 'N', 'G'); void SaveManager::saveGame(uint slot, const Common::String &saveName) { + // The games only support 20 slots + assert(slot <=1 && slot <= 20); + Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::OutSaveFile *file = saveFileManager->openForSaving(_engine->generateSaveFileName(slot)); @@ -126,6 +129,9 @@ void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { } Common::Error SaveManager::loadGame(uint slot) { + // The games only support 20 slots + assert(slot <= 1 && slot <= 20); + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_engine->generateSaveFileName(slot)); if (saveFile == 0) { return Common::kPathDoesNotExist; From 51fc627c05e4fdbd240c75399a249ce8378e999a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:05:38 -0500 Subject: [PATCH 1056/1332] ZVISION: Clear out the current state table values before loading any from a save file --- engines/zvision/script_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 4b4e0f74fe6d..b968e512132b 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -390,6 +390,9 @@ void ScriptManager::serializeStateTable(Common::WriteStream *stream) { } void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) { + // Clear out the current table values + _globalState.clear(); + // Read the number of key/value pairs uint32 numberOfPairs = stream->readUint32LE(); From 8f7fa517d627ad81ca6a07b5a86b6de0774713a1 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:08:36 -0500 Subject: [PATCH 1057/1332] ZVISION: Directly access _globalState instead of using setStateValue setStateValue does a _referenceTable lookup and potentially adds Puzzles to _puzzlesToCheck. We know that _referenceTable and _puzzlesToCheck with be cleared during ScriptManager::changeLocation(), so using setStateValues ends up just being wasteful. --- engines/zvision/script_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index b968e512132b..75f88ddd8a76 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -399,7 +399,8 @@ void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) { for (uint32 i = 0; i < numberOfPairs; i++) { uint32 key = stream->readUint32LE(); uint32 value = stream->readUint32LE(); - setStateValue(key, value); + // Directly access the state table so we don't trigger Puzzle checks + _globalState[key] = value; } } From 1ced56fee7a90ff79cf97f34f3721f7234f2f9bc Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:09:05 -0500 Subject: [PATCH 1058/1332] ZVISION: Add documentation to SaveManager --- engines/zvision/save_manager.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index 8d0ebc75af66..6445f10cafc4 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -56,8 +56,27 @@ class SaveManager { }; public: + /** + * Called every room change. Saves the state of the room just before + * we switched rooms. Uses ZVision::generateAutoSaveFileName() to + * create the save file name. + */ void autoSave(); + /** + * Copies the data from the last auto-save into a new save file. We + * can't use the current state data because the save menu *IS* a room. + * The file is named using ZVision::generateSaveFileName(slot) + * + * @param slot The save slot this save pertains to. Must be [1, 20] + * @param saveName The internal name for this save. This is NOT the name of the actual save file. + */ void saveGame(uint slot, const Common::String &saveName); + /** + * Loads the state data from the save file that slot references. Uses + * ZVision::generateSaveFileName(slot) to get the save file name. + * + * @param slot The save slot to load. Must be [1, 20] + */ Common::Error loadGame(uint slot); private: From 7ff86ba6f9ce7a549a1b327396bce166de083803 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:31:59 -0500 Subject: [PATCH 1059/1332] ZVISION: Add documentation for RlfAnimation --- engines/zvision/rlf_animation.h | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 133bf3913ec7..3f205d9666c3 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -77,21 +77,88 @@ class RlfAnimation { uint height() { return _height; } uint32 frameTime() { return _frameTime; } + /** + * Seeks to the frameNumber and updates the internal Surface with + * the new frame data. If frameNumber == -1, it only sets _currentFrame, + * the internal Surface is unchanged. This function requires _stream = false + * + * @param frameNumber The frame number to seek to + */ void seekToFrame(int frameNumber); + /** + * Returns the pixel data of the frame specified. It will try to use + * getNextFrame() if possible. If not, it uses seekToFrame() to + * update the internal Surface and then returns a pointer to it. + * This function requires _stream = false + * + * @param frameNumber The frame number to get data for + * @return A pointer to the pixel data. Do NOT delete this. + */ const Graphics::Surface *getFrameData(uint frameNumber); + /** + * Returns the pixel data of the next frame. It is up to the user to + * check if the next frame is valid before calling this. + * IE. Use endOfAnimation() + * + * @return A pointer to the pixel data. Do NOT delete this. + */ const Graphics::Surface *getNextFrame(); + /** + * @return Is the currentFrame is the last frame in the animation? + */ bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } private: + /** + * Reads in the header of the RLF file + * + * @return Will return false if the header magic number is wrong + */ bool readHeader(); + /** + * Reads the next frame from the RLF file, stores the data in + * a Frame object, then returns the object + * + * @return A Frame object representing the frame data + */ Frame readNextFrame(); + /** + * Applies the frame corresponding to frameNumber on top of _currentFrameBuffer. + * This function requires _stream = false so it can look up the Frame object + * referenced by frameNumber. + * + * @param frameNumber The frame number to apply to _currentFrameBuffer + */ void applyFrameToCurrent(uint frameNumber); + /** + * Applies the data from a Frame object on top of a _currentFrameBuffer. + * + * @param frame A Frame object to apply to _currentFrameBuffer + */ void applyFrameToCurrent(const RlfAnimation::Frame &frame); + /** + * Decode frame data that uses masked run length encoding. This is the encoding + * used by P-frames. + * + * @param source The source pixel data + * @param dest The destination buffer + * @param sourceSize The size of the source pixel data + * @param destSize The size of the destination buffer + */ void decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; + /** + * Decode frame data that uses simple run length encoding. This is the encoding + * used by I-frames. + * + * @param source The source pixel data + * @param dest The destination buffer + * @param sourceSize The size of the source pixel data + * @param destSize The size of the destination buffer + */ void decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint32 sourceSize, uint32 destSize) const; }; From 39b4d8b71c7293f95442560680a6f2a64b62dbd2 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 12:10:16 +0200 Subject: [PATCH 1060/1332] AVALANCHE: Some cleanup and comment modifications. --- engines/avalanche/acci.cpp | 20 ++++------- engines/avalanche/animation.cpp | 61 +++++++-------------------------- 2 files changed, 20 insertions(+), 61 deletions(-) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3301d474f41f..28f05a9ca8ce 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -444,11 +444,6 @@ Common::String Acci::totalTime() { } void Acci::cheatParse(Common::String codes) { -// uint16 num; -// int16 e; -// char cmd; -// int16 se, sx, sy; - warning("STUB: Acci::cheatParse()"); } @@ -804,12 +799,12 @@ void Acci::examineObject() { break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion. + _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion else - _vm->_scrolls->displayScrollChain('t', 18); // Normal onion scroll + _vm->_scrolls->displayScrollChain('t', 18); // Normal onion break; default: - _vm->_scrolls->displayScrollChain('t', _thing); // <<< Ordinarily + _vm->_scrolls->displayScrollChain('t', _thing); // Ordinarily } } @@ -837,7 +832,7 @@ void Acci::exampers() { if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. (65! Wow!) + _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. else _vm->_scrolls->displayScrollChain('p', newPerson); @@ -891,7 +886,7 @@ void Acci::examine() { // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. if ((_person == kPardon) && (_thing != kPardon)) { if (isHolding()) { - // Remember: it's been Slipped! Ie subtract 49. + // Remember: it's been slipped! Ie subtract 49. if ((1 <= _thing) && (_thing <= 49)) // Standard object examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing @@ -934,7 +929,7 @@ void Acci::inventory() { _vm->_scrolls->displayText(tmpStr); } -void Acci::swallow() { // Eat something. +void Acci::swallow() { // Eat something. switch (_thing) { case Gyro::kObjectWine: switch (_vm->_gyro->_wineState) { // 4 is perfect @@ -1120,8 +1115,6 @@ void Acci::openDoor() { _vm->_scrolls->displayText("Door? What door?"); } - - void Acci::silly() { _vm->_scrolls->displayText("Don't be silly!"); } @@ -1469,6 +1462,7 @@ Common::String Acci::personSpeaks() { return tmpStr; } + void Acci::heyThanks() { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 90966c4cf921..4b129e2047ab 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -197,11 +197,11 @@ void AnimationType::walk() { return; } - byte tc = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((tc != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { - MagicType *magic = &_anim->_vm->_gyro->_magics[tc]; + if ((magicColor != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { + MagicType *magic = &_anim->_vm->_gyro->_magics[magicColor]; switch (magic->_operation) { case Gyro::kMagicExclaim: bounce(); @@ -224,7 +224,7 @@ void AnimationType::walk() { _anim->callSpecial(magic->_data); break; case Gyro::kMagicOpenDoor: - _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, tc); + _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor); break; } } @@ -370,8 +370,7 @@ void Animation::loadAnims() { } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - // if not alive then begin checkfeet:=0; exit; end; - byte a = 0; + byte returnColor = 0; if (x1 < 0) x1 = 0; @@ -380,22 +379,22 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { if (oy < y) { for (int16 i = x1; i <= x2; i++) { for (int16 j = oy + yl; j <= y + yl; j++) { - byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); - if (c > a) - a = c; + byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); + if (actColor > returnColor) + returnColor = actColor; } } } else { for (int16 i = x1; i <= x2; i++) { for (int16 j = y + yl; j <= oy + yl; j++) { - byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); - if (c > a) - a = c; + byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); + if (actColor > returnColor) + returnColor = actColor; } } } - return a; + return returnColor; } byte Animation::geidaPed(byte which) { @@ -421,9 +420,6 @@ void Animation::catacombMove(byte ped) { // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. - - - xy_uint16 = _vm->_gyro->_catacombX + _vm->_gyro->_catacombY * 256; _vm->_gyro->_geidaSpin = 0; @@ -572,8 +568,6 @@ void Animation::catacombMove(byte ped) { break; } - /* ---- */ - switch ((here & 0xf00) >> 8) { // South case 0: // No connection. _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; @@ -993,7 +987,6 @@ void Animation::appearPed(byte sprNum, byte pedNum) { changeDirection(sprNum, curPed->_direction); } -// Eachstep procedures: void Animation::followAvalotY(byte tripnum) { if (_sprites[0]._facingDir == kDirLeft) return; @@ -1048,17 +1041,7 @@ void Animation::arrowProcs(byte tripnum) { _sprites[1]._callEachStepFl = false; // prevent recursion. _vm->_scrolls->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. -#if 0 - tr[1].done; { Deallocate normal pic of Avvy. } - - CursorMan.showMouse(false); - for byte fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - CursorMan.showMouse(true); -#endif + _vm->_lucerna->gameOver(); _vm->_gyro->_userMovesAvvy = false; // Stop the user from moving him. @@ -1072,22 +1055,6 @@ void Animation::arrowProcs(byte tripnum) { } -#if 0 -procedure Spludwick_procs(tripnum:byte); -var fv:byte; -begin - with tr[tripnum] do - if not homing then { We only need to do anything if Spludwick *stops* - walking. } - with _vm->_gyro->dna do - begin - inc(DogfoodPos); - if DogfoodPos=8 then DogfoodPos:=1; - walkto(DogfoodPos); - end; -end; -#endif - void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham. int16 tox = _sprites[0]._x + 17; int16 toy = _sprites[0]._y - 1; @@ -1203,7 +1170,6 @@ void Animation::drawSprites() { } } while (!ok); - _vm->_graphics->refreshBackground(); for (int i = 0; i < 5; i++) { @@ -1437,5 +1403,4 @@ void Animation::handleMoveKey(const Common::Event &event) { } } - } // End of namespace Avalanche. From c34bc12af20e21e100138d8e9dc37006f404420d Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 12:36:19 +0200 Subject: [PATCH 1061/1332] AVALANCHE: Remove useless code. --- engines/avalanche/avalanche.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7d216fad33ec..f140ae90b6ee 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -527,7 +527,7 @@ Common::Error AvalancheEngine::run() { do { _avalot->runAvalot(); - // Needed for later implementation!!! Don't remove these comments!!! +#if 0 //switch (_storage._operation) { //case kRunShootemup: // run("seu.avx", kJsb, kBflight, kNormal); @@ -542,6 +542,7 @@ Common::Error AvalancheEngine::run() { // run("golden.avx", kJsb, kBflight, kMusical); // break; //} +#endif } while (!_gyro->_letMeOut && !shouldQuit()); @@ -554,15 +555,6 @@ void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, E // Probably there'll be no need of this function, as all *.AVX-es will become classes. } -void AvalancheEngine::bFlightOn() { - _storage._skellern = kReset; - // setintvec(0x1c, &b_flight); -} - -void AvalancheEngine::bFlightOff() { - // setintvec(0x1c, old_1c); -} - Common::String AvalancheEngine::elmToStr(Elm how) { switch (how) { case kNormal: @@ -587,11 +579,6 @@ void AvalancheEngine::dosShell() { warning("STUB: dosShell()"); } -//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) -void AvalancheEngine::bFlight() { //interrupt; - _storage._skellern++; -} - // Needed in dos_shell(). TODO: Remove later. Common::String AvalancheEngine::commandCom() { warning("STUB: commandCom()"); @@ -603,16 +590,6 @@ void AvalancheEngine::explain(byte error) { warning("STUB: explain()"); } -// The original ones were all commented out, so probably there's no need -// of these two cursor functions at all. TODO: Remove later. -void AvalancheEngine::cursorOff() { - warning("STUB: cursorOff()"); -} - -void AvalancheEngine::cursorOn() { - warning("STUB: cursorOn()"); -} - // Needed later. void AvalancheEngine::quit() { cursorOn(); From 8d5ce97ca457c9bc2ee055f879f17d748282a102 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 12:39:03 +0200 Subject: [PATCH 1062/1332] AVALANCHE: Mostly cosmetic modifications in avalot.cpp. --- engines/avalanche/avalot.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index dbc38be178b0..7126f332e711 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -127,7 +127,6 @@ void Avalot::setup() { _vm->_parser->_inputTextPos = 0; _vm->_parser->_quote = true; - // TSkellern = 0; Replace with a more local variable sometime _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); @@ -150,7 +149,7 @@ void Avalot::setup() { _vm->loadGame(loadSlot); } else { _vm->_gyro->_isLoaded = false; // Set to true in _vm->loadGame(). - _vm->_gyro->newGame(); // No game was requested- load the default. + _vm->_gyro->newGame(); _vm->_gyro->_soundFx = !_vm->_gyro->_soundFx; _vm->_lucerna->fxToggle(); @@ -176,7 +175,6 @@ void Avalot::runAvalot() { _vm->_timer->updateTimer(); #ifdef DEBUG - // ONLY FOR TESTING!!! for (int i = 0; i < _vm->_gyro->_lineNum; i++) { LineType *curLine = &_vm->_gyro->_lines[i]; _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); @@ -187,10 +185,9 @@ void Avalot::runAvalot() { if (curField->_x1 < 640) _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } - // ONLY FOR TESTING!!! #endif - _vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed. + _vm->_graphics->refreshScreen(); uint32 delay = _vm->_system->getMillis() - beginLoop; if (delay <= 55) From 3650f5d6a74d7c0ce74701c4a9dc915700fdd5f2 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 13:10:14 +0200 Subject: [PATCH 1063/1332] AVALANCHE: More clean up, removement of dead code. --- engines/avalanche/background.cpp | 2 -- engines/avalanche/background.h | 2 +- engines/avalanche/closing.cpp | 5 ----- engines/avalanche/closing.h | 14 +++++--------- engines/avalanche/graphics.h | 5 +++-- engines/avalanche/gyro.h | 31 ------------------------------- engines/avalanche/lucerna.cpp | 17 +++-------------- 7 files changed, 12 insertions(+), 64 deletions(-) diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index d9f606b74e8f..3a70fd79154f 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -359,8 +359,6 @@ void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { } } - - void Background::drawSprite(int16 x, int16 y, SpriteType &sprite) { _r._x1 = x; _r._y1 = y; diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 915abb9f9066..d38106d38fed 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -71,7 +71,7 @@ class Background { SpriteType _sprites[40]; ByteField _r; Common::String _filename; - static const int16 kOnDisk; // Value of memos[fv].x when it's not in memory. + static const int16 kOnDisk; // Value of _sprites[fv]._x when it's not in memory. void drawSprite(int16 x, int16 y, SpriteType &sprite); }; diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 85d5fe0bb83c..39f177e6aaee 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -75,9 +75,4 @@ void Closing::exitGame() { showScreen(); // No halt- it's already set up. } -// CHECKME: Useless? -// void Closing::handleBug() { -// warning("STUB: Closing::handleBug()"); -//} - } // End of namespace Avalanche. diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index a2543fd3afd3..b4c80a8e8954 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -42,12 +42,12 @@ class Closing { void exitGame(); private: -// CHECKME: Useless values? + // Will be needed during implementation of Closing. enum ScreenType { -// kScreenBugAlert = 1, -// kScreenRamCram = 2, -// kScreenTwoCopies = 5, - kScreenNagScreen = 3 + kScreenBugAlert = 1, + kScreenRamCram = 2, + kScreenNagScreen = 3, + kScreenTwoCopies = 5 }; AvalancheEngine *_vm; @@ -56,10 +56,6 @@ class Closing { void showScreen(); void putIn(Common::String str, uint16 where); - // CHECKME: Unused? - // Common::String q; //absolute $B8FA:0* ; Nobody's using the graphics memory now. - // Common::File f; - // void handleBug(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 7706c5f75e89..4cf338bb3f26 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -36,9 +36,10 @@ namespace Avalanche { class AvalancheEngine; -typedef byte FontType[256][16]; // raw font type +typedef byte FontType[256][16]; -typedef byte ManiType[2049]; // manitype = array[5..2053] of byte; +typedef byte ManiType[2049]; +// manitype = array[5..2053] of byte; // Be aware!!! typedef byte SilType[51][11]; // 35, 4 diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 16d7df22ba41..67ca2cfbd1b4 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -107,37 +107,6 @@ struct Sundry { // Things which must be saved over a backtobootstrap, outside DN byte _qThinks; bool _qThinkThing; }; - -struct ednahead { // Edna header - // This header starts at byte offset 177 in the .ASG file. - char id[9]; // signature - uint16 revision; // EDNA revision, here 2 (1=dna256) - Common::String game; // Long name, eg Lord Avalot D'Argent - Common::String shortname; // Short name, eg Avalot - uint16 number; // Game's code number, here 2 - uint16 ver; // Version number as int16 (eg 1.00 = 100) - Common::String verstr; // Vernum as Common::String (eg 1.00 = "1.00") - Common::String filename; // Filename, eg AVALOT.EXE - byte osbyte; // Saving OS (here 1=DOS. See below for others. - Common::String os; // Saving OS in text format. - - // Info on this particular game - - Common::String fn; // Filename (not extension ('cos that's .ASG)) - byte d, m; // D, M, Y are the Day, Month & Year this game was... - uint16 y; // ...saved on. - Common::String desc; // Description of game (same as in Avaricius!) - uint16 len; // Length of DNA (it's not going to be above 65535!) - - // Quick reference & miscellaneous - - uint16 saves; // no. of times this game has been saved - int16 cash; // contents of your wallet in numerical form - Common::String money; // ditto in Common::String form (eg 5/-, or 1 denarius) - uint16 points; // your score - - // DNA values follow, then footer (which is ignored) -}; #endif class Gyro { diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 98a977532379..539bb40ed816 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -173,8 +173,6 @@ void Lucerna::drawAlsoLines() { CursorMan.showMouse(true); } -// readAlsoStringFromFile, scram and unScramble are only used in loadAlso - /** * Check is it's possible to give something to Spludwick * @remarks Originally called 'nextstring' @@ -438,7 +436,6 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((_vm->_gyro->_lastRoom == kRoomMap) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) enterNewTown(); - switch (room) { case kRoomYours: if (_vm->_gyro->_avvyInBed) { @@ -855,6 +852,8 @@ void Lucerna::thinkAbout(byte object, bool type) { object--; // Last time... } + CursorMan.showMouse(false); + file.seek(object * picSize + 65); ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); @@ -862,12 +861,6 @@ void Lucerna::thinkAbout(byte object, bool type) { picture.free(); file.close(); - CursorMan.showMouse(false); - -#if 0 - putimage(x, y, p, 0); -#endif - CursorMan.showMouse(true); _vm->_gyro->_thinkThing = type; } @@ -935,7 +928,7 @@ void Lucerna::drawScore() { _vm->_gyro->_scoreToDisplay[i] = numbers[i]; } -void Lucerna::incScore(byte num) { // Add on no. of points +void Lucerna::incScore(byte num) { for (int i = 1; i <= num; i++) { _vm->_gyro->_dnascore++; @@ -1214,10 +1207,6 @@ uint16 Lucerna::bearing(byte whichPed) { } /** - * A sprite run is performed before displaying a scroll, if not all the - * sprites are still. It performs two fast cycles, only using a few of - * the links usually used, and without any extra animation. This should - * make the sprites the same on both pages. * @remarks Originally called 'sprite_run' */ void Lucerna::spriteRun() { From 2df1aa6287b889baa6e545c0448a1d6f92dd7155 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 13:33:43 +0200 Subject: [PATCH 1064/1332] AVALANCHE: More clean up, removement of dead code, some rearranging. --- engines/avalanche/menu.cpp | 3 +-- engines/avalanche/menu.h | 4 ++-- engines/avalanche/module.mk | 22 +++++++++++----------- engines/avalanche/pingo.cpp | 35 ----------------------------------- engines/avalanche/scrolls.cpp | 30 +++--------------------------- 5 files changed, 17 insertions(+), 77 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 701435e096f3..b786399815b2 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -123,8 +123,7 @@ void MenuItem::displayOption(byte y, bool highlit) { void MenuItem::display() { CursorMan.showMouse(false); - //setfillstyle(1, menu_b); - //setcolor(menu_border); + _firstlix = true; _flx1 = _left - 2; _flx2 = _left + _width; diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index da9f93b05993..e1d42055bb30 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -71,7 +71,7 @@ class MenuItem { uint16 _width, _left; bool _firstlix; int16 _flx1, _flx2, _fly; - byte _oldY; // used by lightUp */ + byte _oldY; // used by lightUp bool _activeNow; // Is there an active option now? byte _activeNum; // And if so, which is it? byte _choiceNum; // Your choice? @@ -138,7 +138,7 @@ class Menu { static const byte kHighlightFontColor = kColorWhite; static const byte kDisabledColor = kColorDarkgray; - bool _menuActive; // Kludge so we don't have to keep referring to Dropdown + bool _menuActive; // Kludge so we don't have to keep referring to the menu. AvalancheEngine *_vm; diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 4c50329f6838..be8a103f669a 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -1,25 +1,25 @@ MODULE := engines/avalanche MODULE_OBJS = \ + acci.o \ + animation.o \ avalanche.o \ - graphics.o \ - parser.o \ avalot.o \ + background.o \ + closing.o \ console.o \ detection.o \ + graphics.o \ gyro.o \ + lucerna.o \ + menu.o \ + parser.o \ pingo.o \ scrolls.o \ - lucerna.o \ - background.o \ sequence.o \ - timer.o \ - animation.o \ - acci.o \ - menu.o \ - closing.o \ - sound.o - + sound.o \ + timer.o + # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) PLUGIN := 1 diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index b97fb6728287..7196f466879b 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -49,41 +49,6 @@ void Pingo::dPlot(int16 x, int16 y, Common::String z) { } void Pingo::bossKey() { -#if 0 -const - months : array[0..11] of char = 'JFMAMJJASOND'; - title = 'Net Profits'; - fish = 224; // '' -var fv:byte; gd,gm:int16; r:char; -begin; - dusk; delavvy; - CursorMan.showMouse(false); - cleardevice; setfillstyle(xhatchfill,11); - settextstyle(1,0,4); settextjustify(1,1); - dplot(320,10,title); - settextstyle(1,0,0); setusercharsize(4,3,7,12); - for fv:=0 to 11 do - begin; - dplot(26+fv*52,187,months[fv]); - bar(fv*52,177-fv*14,51+fv*52,180); - rectangle(fv*52,177-fv*14,51+fv*52,180); - end; - settextstyle(0,0,1); - for fv:=1 to 177 do - begin; - gd:=random(630); gm:=random(160)+30; - setcolor(lightred); outtextxy(gd ,gm ,fish); - setcolor(yellow); outtextxy(gd+1,gm-1,fish); - end; - newpointer(6); { TTHand } - dawn; - CursorMan.showMouse(true); - setbkcolor(1); repeat check until (mpress>0) or keypressed; - while keypressed do r:=readkey; setbkcolor(0); settextjustify(0,0); - dusk; dawn; - copy02; -#endif - warning("STUB: Pingo::bossKey()"); } diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index b2a81a7b2e8e..d4462aac1734 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -423,9 +423,6 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); -// CHECKME: unused? -// ex = mx - lx; -// int16 ey = my - ly; mx -= lx; my -= ly + 2; @@ -451,7 +448,6 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { if (!_vm->_gyro->_scroll[i].empty()) switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { @@ -485,7 +481,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. ringBell(); - //my = getpixel(0, 0); + _vm->_gyro->_dropsOk = false; dodgem(); @@ -493,22 +489,12 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { unDodgem(); _vm->_gyro->_dropsOk = true; - CursorMan.showMouse(false); - // mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0); - //mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp); - //blitfix(); - CursorMan.showMouse(true); - //settextjustify(0, 0); // sink + resetScrollDriver(); - /*if (_vm->_gyro->mpress > 0) - _vm->_gyro->after_the_scroll = true;*/ - - warning("STUB: Scrolls::drawScroll()"); } void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { Common::Point points[3]; -// byte *rp1, *rp2; // replace: 1=bubble, 2=pointer CursorMan.showMouse(false); int16 xl = 0; @@ -557,9 +543,6 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); - // CHECKME: Unused? - // yl -= 3; - // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. @@ -570,22 +553,15 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { } ringBell(); - CursorMan.showMouse(true); + CursorMan.showMouse(false); _vm->_gyro->_dropsOk = false; // This does the actual drawing to the screen. (this->*modeFunc)(); - CursorMan.showMouse(false); _vm->_gyro->_dropsOk = true; - CursorMan.showMouse(true); // sink; resetScrollDriver(); - -#if 0 - if (_vm->_gyro->mpress > 0) - _vm->_gyro->after_the_scroll = true; -#endif } bool Scrolls::displayQuestion(Common::String question) { From 2dcdca571192faebdc1799461fe907fad7087ef3 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 14:16:32 +0200 Subject: [PATCH 1065/1332] AVALANCHE: Silence GCC warnings and repair Scrolls::scrollModeNormal(). --- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/graphics.h | 2 +- engines/avalanche/gyro.h | 4 ++-- engines/avalanche/scrolls.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 97624cf1deed..aa363bb0a230 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -290,7 +290,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { for (uint16 x = 0; x < picture.w; x++) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 4cf338bb3f26..de08a9a2c593 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -86,7 +86,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); void refreshBackground(); diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h index 67ca2cfbd1b4..99fe6f7142fb 100644 --- a/engines/avalanche/gyro.h +++ b/engines/avalanche/gyro.h @@ -93,7 +93,7 @@ class LineType : public FieldType { byte _color; }; -typedef byte TuneType[31]; +typedef int8 TuneType[31]; struct QuasipedType { byte _whichPed, _foregroundColor, _room, _backgroundColor; @@ -200,7 +200,7 @@ class Gyro { kPitchInvalid, kPitchLower, kPitchSame, - kPitchHigher, + kPitchHigher }; static const uint16 kNotes[12]; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index d4462aac1734..ca5b515780fd 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -118,7 +118,6 @@ void Scrolls::scrollModeNormal() { setReadyLight(3); _vm->_gyro->_seeScroll = true; - CursorMan.showMouse(true); _vm->_gyro->newMouse(3); ::Graphics::Surface temp; @@ -177,7 +176,6 @@ void Scrolls::scrollModeNormal() { setReadyLight(0); _vm->_gyro->_seeScroll = false; - CursorMan.showMouse(false); _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::scrollModeNormal()"); @@ -278,6 +276,8 @@ void Scrolls::scrollModeMusic() { case Common::KEYCODE_RIGHTBRACKET: value = 11; break; + default: + break; } lastOne = thisOne; From 3b57efaf992b3dccbf60b0f94004c587b93fec32 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 14:25:54 +0200 Subject: [PATCH 1066/1332] AVALANCHE: Revise Graphics::drawPicture(). --- engines/avalanche/graphics.cpp | 4 ++-- engines/avalanche/graphics.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index aa363bb0a230..643025fec77e 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -290,11 +290,11 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { for (uint16 x = 0; x < picture.w; x++) - *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + *(byte *)target.getBasePtr(x + destX, y + destY) = *(const byte *)picture.getBasePtr(x, y); } } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index de08a9a2c593..4cf338bb3f26 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -86,7 +86,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); void refreshBackground(); From 897a0d0a61cc393a80a276b94d37c2d0d7c8dfbc Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 14:36:23 +0200 Subject: [PATCH 1067/1332] AVALANCHE: Silence more GCC warnings. --- engines/avalanche/parser.cpp | 6 ------ engines/avalanche/scrolls.cpp | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 5f9e5d8965d8..d341e7662625 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -144,12 +144,6 @@ void Parser::drawCursor() { // Draw the '_' character. for (int bit = 0; bit < 8; bit++) *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; - - ByteField bf; - bf._x1 = _inputTextPos + 1; - bf._x2 = _inputTextPos + 2; - bf._y1 = 168; - bf._y2 = 168; } void Parser::wipeText() { diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index ca5b515780fd..0b1b4a487029 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -193,7 +193,7 @@ void Scrolls::store(byte what, TuneType &played) { bool Scrolls::theyMatch(TuneType &played) { byte mistakes = 0; - for (int i = 0; i < sizeof(played); i++) { + for (byte i = 0; i < sizeof(played); i++) { if (played[i] != _vm->_gyro->kTune[i]) mistakes += 1; } @@ -208,7 +208,7 @@ void Scrolls::scrollModeMusic() { _vm->_gyro->newMouse(3); TuneType played; - for (int i = 0; i < sizeof(played); i++) + for (byte i = 0; i < sizeof(played); i++) played[i] = Gyro::kPitchInvalid; int8 lastOne = -1, thisOne = -1; // Invalid values. From e0b4280a949606d63d438cdb3046f630f837f183 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 14:49:35 +0200 Subject: [PATCH 1068/1332] AVALANCHE: Change byte to unsigned int in for loops. --- engines/avalanche/scrolls.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 0b1b4a487029..e5d08ecfc67e 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -193,7 +193,7 @@ void Scrolls::store(byte what, TuneType &played) { bool Scrolls::theyMatch(TuneType &played) { byte mistakes = 0; - for (byte i = 0; i < sizeof(played); i++) { + for (unsigned int i = 0; i < sizeof(played); i++) { if (played[i] != _vm->_gyro->kTune[i]) mistakes += 1; } @@ -208,7 +208,7 @@ void Scrolls::scrollModeMusic() { _vm->_gyro->newMouse(3); TuneType played; - for (byte i = 0; i < sizeof(played); i++) + for (unsigned int i = 0; i < sizeof(played); i++) played[i] = Gyro::kPitchInvalid; int8 lastOne = -1, thisOne = -1; // Invalid values. From ba103fd5dd8ecde9962ccad03b79a440c06f7a7b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 15:36:13 +0200 Subject: [PATCH 1069/1332] AVALANCHE: Some polishing in Animation --- engines/avalanche/animation.cpp | 54 ++++++++++++++------------------- engines/avalanche/animation.h | 2 +- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 4b129e2047ab..c014b95f9eec 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -59,12 +59,12 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { int32 id = inf.readSint32LE(); if (id != idshould) { - //output << '\7'; inf.close(); return; } - inf.skip(2); // Replace variable named 'soa' in the original code. + // Replace variable named 'soa' in the original code. + inf.skip(2); if (!_stat._name.empty()) _stat._name.clear(); @@ -73,7 +73,6 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _stat._name += inf.readByte(); inf.skip(12 - nameSize); - //inf.skip(1); // Same as above. byte commentSize = inf.readByte(); for (int i = 0; i < commentSize; i++) _stat._comment += inf.readByte(); @@ -134,7 +133,8 @@ void AnimationType::original() { void AnimationType::draw() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + + byte picnum = _facingDir * _stat._seq + _stepNum; _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } @@ -370,47 +370,42 @@ void Animation::loadAnims() { } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - byte returnColor = 0; + if (!_vm->_gyro->_alive) + return 0; if (x1 < 0) x1 = 0; if (x2 > 639) x2 = 639; - if (oy < y) { - for (int16 i = x1; i <= x2; i++) { - for (int16 j = oy + yl; j <= y + yl; j++) { - byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); - if (actColor > returnColor) - returnColor = actColor; - } - } - } else { - for (int16 i = x1; i <= x2; i++) { - for (int16 j = y + yl; j <= oy + yl; j++) { - byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); - if (actColor > returnColor) - returnColor = actColor; - } + + int16 minY = MIN(oy, y) + yl; + int16 maxY = MAX(oy, y) + yl; + byte returnColor = 0; + + for (int16 i = x1; i <= x2; i++) { + for (int16 j = minY; j <= maxY; j++) { + byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); + returnColor = MAX(returnColor, actColor); } } return returnColor; } -byte Animation::geidaPed(byte which) { - switch (which) { +byte Animation::geidaPed(byte ped) { + switch (ped) { case 1: - return 7; + return 6; case 2: case 6: - return 8; + return 7; case 3: case 5: - return 9; + return 8; case 4: - return 10; + return 9; default: - return 0; + error("geidaPed(): Unhandled ped value %d", ped); } } @@ -710,7 +705,7 @@ void Animation::catacombMove(byte ped) { if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. - appearPed(1, geidaPed(ped) - 1); + appearPed(1, geidaPed(ped)); _sprites[1]._callEachStepFl = true; _sprites[1]._eachStepProc = kProcGeida; } @@ -1300,9 +1295,6 @@ void Animation::flipRoom(byte room, byte ped) { _vm->_lucerna->drawDirection(); _vm->_lucerna->dawn(); - - // Tidy up after mouse. I know it's a kludge... - // tidy_after_mouse; } bool Animation::inField(byte which) { diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 2765a7cd0b2d..1f13fd140763 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -137,7 +137,7 @@ class Animation { AvalancheEngine *_vm; byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); - byte geidaPed(byte which); + byte geidaPed(byte ped); void dawnDelay(); void grabAvvy(byte tripnum); From d82975fc38c9334c15810fff216ab59fd5af5ec2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 16:09:33 +0200 Subject: [PATCH 1070/1332] AVALANCHE: Add an assert in flipRoom(), fix an issue in post-STU functions --- engines/avalanche/animation.cpp | 1 + engines/avalanche/timer.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index c014b95f9eec..fafd088b58ce 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1258,6 +1258,7 @@ void Animation::hideInCupboard() { } void Animation::flipRoom(byte room, byte ped) { + assert((ped > 0) && (ped < 15)); if (!_vm->_gyro->_alive) { // You can't leave the room if you're dead. _sprites[0]._moveX = 0; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b473e773bdfb..ac5f096e40e8 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -353,8 +353,10 @@ void Timer::hangAround2() { void Timer::afterTheShootemup() { - _vm->_animation->flipRoom(_vm->_gyro->_room, 0); + // CHECKME: is it correct? // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! + _vm->_animation->flipRoom(_vm->_gyro->_room, 1); + // _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); From 628c5bb5155e8f1de23763c1e300aaa351aca871 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 16:20:57 +0200 Subject: [PATCH 1071/1332] AVALANCHE: Remove comment. (Answer: It is.) --- engines/avalanche/timer.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index ac5f096e40e8..9f51e2a73428 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -352,11 +352,8 @@ void Timer::hangAround2() { } void Timer::afterTheShootemup() { - - // CHECKME: is it correct? // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->_animation->flipRoom(_vm->_gyro->_room, 1); - // _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); From 350d622324581fe0ceb2eee38d4a7750690a0cf0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 18:06:37 +0200 Subject: [PATCH 1072/1332] AVALANCHE: rename scrolls to dialogs --- engines/avalanche/acci.cpp | 472 +++++++++--------- engines/avalanche/animation.cpp | 44 +- engines/avalanche/avalanche.cpp | 14 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 8 +- .../avalanche/{scrolls.cpp => dialogs.cpp} | 114 ++--- engines/avalanche/{scrolls.h => dialogs.h} | 28 +- engines/avalanche/gyro.cpp | 6 +- engines/avalanche/lucerna.cpp | 16 +- engines/avalanche/module.mk | 2 +- engines/avalanche/pingo.cpp | 2 +- engines/avalanche/timer.cpp | 94 ++-- 12 files changed, 402 insertions(+), 402 deletions(-) rename engines/avalanche/{scrolls.cpp => dialogs.cpp} (92%) rename engines/avalanche/{scrolls.h => dialogs.h} (87%) diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 28f05a9ca8ce..f98eb916b629 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -31,7 +31,7 @@ #include "avalanche/acci.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/background.h" @@ -466,18 +466,18 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { if (target == kPardon) { ambiguous = true; if (animate) - _vm->_scrolls->displayText("Whom?"); + _vm->_dialogs->displayText("Whom?"); else - _vm->_scrolls->displayText("What?"); + _vm->_dialogs->displayText("What?"); } else { if (animate) { Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { Common::String z = _vm->_gyro->getItem(target); if (z != "") { Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } } } @@ -523,9 +523,9 @@ void Acci::properNouns() { void Acci::sayIt() { Common::String x = _vm->_parser->_inputText; x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), - Scrolls::kControlSpeechBubble, Scrolls::kControlRegister); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), + Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); + _vm->_dialogs->displayText(tmpStr); } void Acci::storeInterrogation(byte interrogation) { @@ -565,7 +565,7 @@ void Acci::storeInterrogation(byte interrogation) { if (!_vm->_gyro->_spareEvening.empty()) _vm->_gyro->_spareEvening.clear(); _vm->_gyro->_spareEvening = _vm->_parser->_inputText; - _vm->_scrolls->displayScrollChain('z', 5); // His closing statement... + _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; @@ -761,7 +761,7 @@ void Acci::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_weirdWord = true; } else _vm->_gyro->_weirdWord = false; @@ -787,24 +787,24 @@ void Acci::examineObject() { case Gyro::kObjectWine : switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: - _vm->_scrolls->displayScrollChain('t', 1); // Normal examine wine scroll + _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll break; case 2: - _vm->_scrolls->displayScrollChain('d', 6); // Bad wine + _vm->_dialogs->displayScrollChain('d', 6); // Bad wine break; case 3: - _vm->_scrolls->displayScrollChain('d', 7); // Vinegar + _vm->_dialogs->displayScrollChain('d', 7); // Vinegar break; } break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('q', 21); // Yucky onion + _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else - _vm->_scrolls->displayScrollChain('t', 18); // Normal onion + _vm->_dialogs->displayScrollChain('t', 18); // Normal onion break; default: - _vm->_scrolls->displayScrollChain('t', _thing); // Ordinarily + _vm->_dialogs->displayScrollChain('t', _thing); // Ordinarily } } @@ -817,7 +817,7 @@ bool Acci::isPersonHere() { // Person equivalent of "holding". tmpStr = "He isn't around at the moment."; else tmpStr = "She isn't around at the moment."; - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); return false; } } @@ -830,14 +830,14 @@ void Acci::exampers() { byte newPerson = _person - 149; if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) - _vm->_scrolls->displayScrollChain('Q', 8); // "I'm Not Playing!" + _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('Q', 65); // He's asleep. + _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else - _vm->_scrolls->displayScrollChain('p', newPerson); + _vm->_dialogs->displayScrollChain('p', newPerson); if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) - _vm->_scrolls->displayScrollChain('Q', 13); + _vm->_dialogs->displayScrollChain('Q', 13); _person = newPerson; } @@ -854,9 +854,9 @@ bool Acci::isHolding() { bool holdingResult = false; if (_thing > 100) - _vm->_scrolls->displayText("Be reasonable!"); + _vm->_dialogs->displayText("Be reasonable!"); else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. - _vm->_scrolls->displayText("You're not holding it, Avvy."); + _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -891,14 +891,14 @@ void Acci::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_scrolls->displayText(*_vm->_gyro->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); openBox(false); } } } else if (_person != kPardon) exampers(); else - _vm->_scrolls->displayText("It's just as it looks on the picture."); // Don't know: guess. + _vm->_dialogs->displayText("It's just as it looks on the picture."); // Don't know: guess. } void Acci::inventory() { @@ -922,11 +922,11 @@ void Acci::inventory() { } if (_vm->_gyro->_wearing == kNothing) - tmpStr += Common::String::format("...%c%c...and you're stark naked!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); + tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); else tmpStr += '.'; - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } void Acci::swallow() { // Eat something. @@ -935,52 +935,52 @@ void Acci::swallow() { // Eat something. switch (_vm->_gyro->_wineState) { // 4 is perfect case 1: if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('D', 6); + _vm->_dialogs->displayScrollChain('D', 6); return; } - _vm->_scrolls->displayScrollChain('U', 1); + _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); - _vm->_scrolls->displayScrollChain('U', 2); + _vm->_dialogs->displayScrollChain('U', 2); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; _vm->_lucerna->refreshObjectList(); drink(); break; case 2: case 3: - _vm->_scrolls->displayScrollChain('d', 8); + _vm->_dialogs->displayScrollChain('d', 8); break; // You can't drink it! } break; case Gyro::kObjectPotion: _vm->_gyro->setBackgroundColor(4); - _vm->_scrolls->displayScrollChain('U', 3); + _vm->_dialogs->displayScrollChain('U', 3); _vm->_lucerna->gameOver(); _vm->_gyro->setBackgroundColor(0); break; case Gyro::kObjectInk: - _vm->_scrolls->displayScrollChain('U', 4); + _vm->_dialogs->displayScrollChain('U', 4); break; case Gyro::kObjectChastity: - _vm->_scrolls->displayScrollChain('U', 5); + _vm->_dialogs->displayScrollChain('U', 5); break; case Gyro::kObjectMushroom: - _vm->_scrolls->displayScrollChain('U', 6); + _vm->_dialogs->displayScrollChain('U', 6); _vm->_lucerna->gameOver(); break; case Gyro::kObjectOnion: if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('U', 11); + _vm->_dialogs->displayScrollChain('U', 11); else { - _vm->_scrolls->displayScrollChain('U', 8); + _vm->_dialogs->displayScrollChain('U', 8); _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; _vm->_lucerna->refreshObjectList(); } break; default: if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) - _vm->_scrolls->displayText("Try BUYing things before you drink them!"); + _vm->_dialogs->displayText("Try BUYing things before you drink them!"); else - _vm->_scrolls->displayText("The taste of it makes you retch!"); + _vm->_dialogs->displayText("The taste of it makes you retch!"); } } @@ -1014,42 +1014,42 @@ void Acci::peopleInRoom() { else tmpStr += " are"; - _vm->_scrolls->displayText(tmpStr + " here."); // End and display it. + _vm->_dialogs->displayText(tmpStr + " here."); // End and display it. } void Acci::lookAround() { - _vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]); + _vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); switch (_vm->_gyro->_room) { case kRoomSpludwicks: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_scrolls->displayScrollChain('q', 23); + _vm->_dialogs->displayScrollChain('q', 23); else peopleInRoom(); break; case kRoomRobins: if (_vm->_gyro->_tiedUp) - _vm->_scrolls->displayScrollChain('q', 38); + _vm->_dialogs->displayScrollChain('q', 38); if (_vm->_gyro->_mushroomGrowing) - _vm->_scrolls->displayScrollChain('q', 55); + _vm->_dialogs->displayScrollChain('q', 55); break; case kRoomInsideCardiffCastle: if (!_vm->_gyro->_takenPen) - _vm->_scrolls->displayScrollChain('q', 49); + _vm->_dialogs->displayScrollChain('q', 49); break; case kRoomLustiesRoom: if (_vm->_gyro->_lustieIsAsleep) - _vm->_scrolls->displayScrollChain('q', 65); + _vm->_dialogs->displayScrollChain('q', 65); break; case kRoomCatacombs: switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { case 258 : - _vm->_scrolls->displayScrollChain('q', 80); // Inside art gallery. + _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. break; case 514 : - _vm->_scrolls->displayScrollChain('q', 81); // Outside ditto. + _vm->_dialogs->displayScrollChain('q', 81); // Outside ditto. break; case 260 : - _vm->_scrolls->displayScrollChain('q', 82); // Outside Geida's room. + _vm->_dialogs->displayScrollChain('q', 82); // Outside Geida's room. break; } break; @@ -1072,7 +1072,7 @@ void Acci::openDoor() { break; case kRoomSpludwicks: if (_thing == 61) { - _vm->_scrolls->displayScrollChain('q', 85); + _vm->_dialogs->displayScrollChain('q', 85); return; } break; @@ -1087,14 +1087,14 @@ void Acci::openDoor() { switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_scrolls->displayScrollChain('x', portal->_data); + _vm->_dialogs->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); break; case Gyro::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); - _vm->_scrolls->displayText("Sorry. This place is not available yet!"); + _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: _vm->_animation->callSpecial(portal->_data); @@ -1109,14 +1109,14 @@ void Acci::openDoor() { } if (_vm->_gyro->_room == kRoomMap) - _vm->_scrolls->displayText("Avvy, you can complete the whole game without ever going " \ + _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else - _vm->_scrolls->displayText("Door? What door?"); + _vm->_dialogs->displayText("Door? What door?"); } void Acci::silly() { - _vm->_scrolls->displayText("Don't be silly!"); + _vm->_dialogs->displayText("Don't be silly!"); } void Acci::putProc() { @@ -1135,15 +1135,15 @@ void Acci::putProc() { case Gyro::kObjectWine: if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!"); + _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? if (_vm->_gyro->_wineState != 3) { - Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! _vm->_gyro->_onionInVinegar = true; _vm->_lucerna->incScore(7); - _vm->_scrolls->displayScrollChain('u', 9); + _vm->_dialogs->displayScrollChain('u', 9); } } } else @@ -1153,32 +1153,32 @@ void Acci::putProc() { case 54: if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. if (_vm->_gyro->_boxContent != kNothing) - _vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first."); + _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { case Gyro::kObjectMoney: - _vm->_scrolls->displayText("You'd better keep some ready cash on you!"); + _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); break; case Gyro::kObjectBell: - _vm->_scrolls->displayText("That's a silly place to keep a bell."); + _vm->_dialogs->displayText("That's a silly place to keep a bell."); break; case Gyro::kObjectBodkin: - _vm->_scrolls->displayText("But you might need it!"); + _vm->_dialogs->displayText("But you might need it!"); break; case Gyro::kObjectOnion: - _vm->_scrolls->displayText("Just give it to Spludwick, Avvy!"); + _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... if (_vm->_gyro->_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { openBox(true); // Open box. _vm->_gyro->_boxContent = _thing; _vm->_gyro->_objects[_thing - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayText("OK, it's in the box."); + _vm->_dialogs->displayText("OK, it's in the box."); openBox(false); // Shut box. } @@ -1200,8 +1200,8 @@ void Acci::putProc() { void Acci::notInOrder() { Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ - "What I need next is %s%c2%c", itemStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } /** @@ -1228,10 +1228,10 @@ bool Acci::giveToSpludwick() { case Gyro::kObjectOnion: _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; if (_vm->_gyro->_rottenOnion) - _vm->_scrolls->displayScrollChain('q', 22); + _vm->_dialogs->displayScrollChain('q', 22); else { _vm->_gyro->_givenToSpludwick++; - _vm->_scrolls->displayScrollChain('q', 20); + _vm->_dialogs->displayScrollChain('q', 20); goToCauldron(); _vm->_lucerna->incScore(3); } @@ -1241,13 +1241,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_givenToSpludwick++; - _vm->_scrolls->displayScrollChain('q', 24); + _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); _vm->_lucerna->incScore(3); break; case Gyro::kObjectMushroom: _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; - _vm->_scrolls->displayScrollChain('q', 25); + _vm->_dialogs->displayScrollChain('q', 25); _vm->_lucerna->incScore(5); _vm->_gyro->_givenToSpludwick++; goToCauldron(); @@ -1279,19 +1279,19 @@ void Acci::drink() { void Acci::cardiffClimbing() { if (_vm->_gyro->_standingOnDais) { // Clamber up. - _vm->_scrolls->displayText("You climb down, back onto the floor."); + _vm->_dialogs->displayText("You climb down, back onto the floor."); _vm->_gyro->_standingOnDais = false; _vm->_animation->appearPed(0, 2); } else if (_vm->_animation->inField(0)) { // Clamber down - _vm->_scrolls->displayText("You clamber up onto the dais."); + _vm->_dialogs->displayText("You clamber up onto the dais."); _vm->_gyro->_standingOnDais = true; _vm->_animation->appearPed(0, 1); } else - _vm->_scrolls->displayText("Get a bit closer, Avvy."); + _vm->_dialogs->displayText("Get a bit closer, Avvy."); } void Acci::already() { - _vm->_scrolls->displayText("You're already standing!"); + _vm->_dialogs->displayText("You're already standing!"); } void Acci::standUp() { @@ -1299,9 +1299,9 @@ void Acci::standUp() { case kRoomYours: // Avvy isn't asleep. if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('d', 12); + _vm->_dialogs->displayScrollChain('d', 12); _vm->_gyro->setBackgroundColor(0); - _vm->_scrolls->displayScrollChain('d', 14); + _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; @@ -1340,24 +1340,24 @@ void Acci::getProc(char thing) { if (_vm->_animation->inField(1)) { if (_vm->_gyro->_boxContent == thing) { _vm->_background->drawBackgroundSprite(-1, -1, 4); - _vm->_scrolls->displayText("OK, I've got it."); + _vm->_dialogs->displayText("OK, I've got it."); _vm->_gyro->_objects[thing - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_boxContent = kNothing; _vm->_background->drawBackgroundSprite(-1, -1, 5); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } } else - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); break; case kRoomInsideCardiffCastle: switch (thing) { case Gyro::kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. if (_vm->_gyro->_takenPen) - _vm->_scrolls->displayText("It's not there, Avvy."); + _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. @@ -1365,34 +1365,34 @@ void Acci::getProc(char thing) { _vm->_gyro->_takenPen = true; _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayText("Taken."); + _vm->_dialogs->displayText("Taken."); } } else if (_vm->_gyro->_standingOnDais) - _vm->_scrolls->displayScrollChain('q', 53); + _vm->_dialogs->displayScrollChain('q', 53); else - _vm->_scrolls->displayScrollChain('q', 51); + _vm->_dialogs->displayScrollChain('q', 51); break; case Gyro::kObjectBolt: - _vm->_scrolls->displayScrollChain('q', 52); + _vm->_dialogs->displayScrollChain('q', 52); break; default: - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); } break; case kRoomRobins: if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_scrolls->displayText("Got it!"); + _vm->_dialogs->displayText("Got it!"); _vm->_gyro->_mushroomGrowing = false; _vm->_gyro->_takenMushroom = true; _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_lucerna->incScore(3); } else - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); break; default: - _vm->_scrolls->displayScrollChain('q', 57); + _vm->_dialogs->displayScrollChain('q', 57); } } @@ -1402,13 +1402,13 @@ void Acci::getProc(char thing) { */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->_room != kRoomLustiesRoom) { - Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); return; } _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayScrollChain('q', 64); // She plays it. + _vm->_dialogs->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! @@ -1416,13 +1416,13 @@ void Acci::giveGeidaTheLute() { void Acci::playHarp() { if (_vm->_animation->inField(6)) - _vm->_scrolls->musicalScroll(); + _vm->_dialogs->displayMusicalScroll(); else - _vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); + _vm->_dialogs->displayText("Get a bit closer to it, Avvy!"); } void Acci::winSequence() { - _vm->_scrolls->displayScrollChain('q', 78); + _vm->_dialogs->displayScrollChain('q', 78); _vm->_sequence->firstShow(7); _vm->_sequence->thenShow(8); _vm->_sequence->thenShow(9); @@ -1439,7 +1439,7 @@ Common::String Acci::personSpeaks() { } if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { - return Common::String::format("%c1", Scrolls::kControlRegister); // Avvy himself! + return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } bool found = false; // The _person we're looking for's code is in _person. @@ -1447,7 +1447,7 @@ Common::String Acci::personSpeaks() { for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i); + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, '1' + i); found = true; } } @@ -1457,7 +1457,7 @@ Common::String Acci::personSpeaks() { for (int i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) - tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); } return tmpStr; @@ -1465,8 +1465,8 @@ Common::String Acci::personSpeaks() { void Acci::heyThanks() { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_objects[_thing - 1] = false; } @@ -1494,11 +1494,11 @@ void Acci::doThat() { && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_gyro->_alive) { - _vm->_scrolls->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); + _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_scrolls->displayText("Talking in your sleep? Try waking up!"); + _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); return; } } @@ -1511,25 +1511,25 @@ void Acci::doThat() { openDoor(); break; case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("You can't carry any more!"); + _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); } else { // Not... ditto. if (_person != kPardon) - _vm->_scrolls->displayText("You can't sweep folk off their feet!"); + _vm->_dialogs->displayText("You can't sweep folk off their feet!"); else - _vm->_scrolls->displayText("I assure you, you don't need it."); + _vm->_dialogs->displayText("I assure you, you don't need it."); } break; case kVerbCodeDrop: - _vm->_scrolls->displayText("Two years ago you dropped a florin in the street. Three days " \ + _vm->_dialogs->displayText("Two years ago you dropped a florin in the street. Three days " \ "later it was gone! So now you never leave ANYTHING lying around. OK?"); break; case kVerbCodeInv: @@ -1538,8 +1538,8 @@ void Acci::doThat() { case kVerbCodeTalk: if (_person == kPardon) { if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". - Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); @@ -1553,40 +1553,40 @@ void Acci::doThat() { _person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; if ((_person == 0) || (_person == kPardon)) - _vm->_scrolls->displayText("Talk to whom?"); + _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) - _vm->_scrolls->talkTo(_person); + _vm->_dialogs->talkTo(_person); } } else if (isPersonHere()) - _vm->_scrolls->talkTo(_person); + _vm->_dialogs->talkTo(_person); break; case kVerbCodeGive: if (isHolding()) { if (_person == kPardon) - _vm->_scrolls->displayText("Give to whom?"); + _vm->_dialogs->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { case Gyro::kObjectMoney : - _vm->_scrolls->displayText("You can't bring yourself to give away your moneybag."); + _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); break; case Gyro::kObjectBodkin: case Gyro::kObjectBell: case Gyro::kObjectClothes: case Gyro::kObjectHabit : - _vm->_scrolls->displayText("Don't give it away, it might be useful!"); + _vm->_dialogs->displayText("Don't give it away, it might be useful!"); break; default: switch (_person) { case Gyro::kPeopleCrapulus: if (_thing == Gyro::kObjectWine) { - _vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down."); + _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; } else heyThanks(); break; case Gyro::kPeopleCwytalot: if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - _vm->_scrolls->displayText("You might be able to influence Cwytalot more if you used it!"); + _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else heyThanks(); break; @@ -1596,7 +1596,7 @@ void Acci::doThat() { break; case Gyro::kPeopleIbythneth: if (_thing == Gyro::kObjectBadge) { - _vm->_scrolls->displayScrollChain('q', 32); // Thanks! Wow! + _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! _vm->_lucerna->incScore(3); _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; @@ -1610,7 +1610,7 @@ void Acci::doThat() { if (_vm->_gyro->_aylesIsAwake) { if (_thing == Gyro::kObjectPen) { _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; - _vm->_scrolls->displayScrollChain('q', 54); + _vm->_dialogs->displayScrollChain('q', 54); _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; _vm->_gyro->_givenPenToAyles = true; _vm->_lucerna->refreshObjectList(); @@ -1618,13 +1618,13 @@ void Acci::doThat() { } else heyThanks(); } else - _vm->_scrolls->displayText("But he's asleep!"); + _vm->_dialogs->displayText("But he's asleep!"); break; case Gyro::kPeopleGeida: switch (_thing) { case Gyro::kObjectPotion: _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; - _vm->_scrolls->displayScrollChain('u', 16); // She drinks it. + _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. _vm->_lucerna->incScore(2); _vm->_gyro->_givenPotionToGeida = true; _vm->_lucerna->refreshObjectList(); @@ -1642,7 +1642,7 @@ void Acci::doThat() { if (_vm->_gyro->_givenPotionToGeida) winSequence(); else - _vm->_scrolls->displayScrollChain('q', 77); // That Geida woman! + _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1670,66 +1670,66 @@ void Acci::doThat() { // We don't handle these two because we use ScummVM's save/load system. case kVerbCodePay: - _vm->_scrolls->displayText("No money need change hands."); + _vm->_dialogs->displayText("No money need change hands."); break; case kVerbCodeLook: lookAround(); break; case kVerbCodeBreak: - _vm->_scrolls->displayText("Vandalism is prohibited within this game!"); + _vm->_dialogs->displayText("Vandalism is prohibited within this game!"); break; case kVerbCodeQuit: // quit if (!_polite) - _vm->_scrolls->displayText("How about a `please\", Avvy?"); + _vm->_dialogs->displayText("How about a `please\", Avvy?"); else { - Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Scrolls::kControlRegister, Scrolls::kControlIcon); - if (_vm->_scrolls->displayQuestion(tmpStr)) + Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); + if (_vm->_dialogs->displayQuestion(tmpStr)) _vm->_gyro->_letMeOut = true; } break; case kVerbCodeGo: - _vm->_scrolls->displayText("Just use the arrow keys to walk there."); + _vm->_dialogs->displayText("Just use the arrow keys to walk there."); break; case kVerbCodeInfo: { - _vm->_scrolls->_aboutScroll = true; + _vm->_dialogs->_aboutBox = true; Common::String toDisplay; for (int i = 0; i < 7; i++) - toDisplay += Scrolls::kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Scrolls::kControlCenter + Scrolls::kControlNewLine - + "The medi\x91val descendant of" + Scrolls::kControlNewLine - + "Denarius Avaricius Sextus" + Scrolls::kControlNewLine + Scrolls::kControlNewLine - + "version " + _vm->_gyro->kVersionNum + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Copyright \xEF " - + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Scrolls::kControlRegister + 'Y' + Scrolls::kControlIcon; - _vm->_scrolls->displayText(toDisplay); - _vm->_scrolls->_aboutScroll = false; + toDisplay += Dialogs::kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + + "The medi\x91val descendant of" + Dialogs::kControlNewLine + + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine + + "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + _vm->_dialogs->displayText(toDisplay); + _vm->_dialogs->_aboutBox = false; } break; case kVerbCodeUndress: if (_vm->_gyro->_wearing == kNothing) - _vm->_scrolls->displayText("You're already stark naked!"); + _vm->_dialogs->displayText("You're already stark naked!"); else if (_vm->_gyro->_avvysInTheCupboard) { Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_wearing = kNothing; _vm->_lucerna->refreshObjectList(); } else - _vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?"); + _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); break; case kVerbCodeWear: if (isHolding()) { // Wear something. switch (_thing) { case Gyro::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->displayText("Hey, what kind of a weirdo are you\?\?!"); + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! if (_vm->_gyro->_wearing != kNothing) { if (_vm->_gyro->_wearing == _thing) - _vm->_scrolls->displayText("You're already wearing that."); + _vm->_dialogs->displayText("You're already wearing that."); else - _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); + _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else _vm->_gyro->_wearing = _thing; @@ -1753,7 +1753,7 @@ void Acci::doThat() { } break; default: - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } } break; @@ -1767,20 +1767,20 @@ void Acci::doThat() { // The player automatically wins the game everytime he wins, until I implement the mini-game. if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_scrolls->displayScrollChain('Q', 6); + _vm->_dialogs->displayScrollChain('Q', 6); return; } if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_scrolls->displayScrollChain('q', 84); + _vm->_dialogs->displayScrollChain('q', 84); return; } - _vm->_scrolls->displayScrollChain('Q', 3); + _vm->_dialogs->displayScrollChain('Q', 3); _vm->_gyro->_playedNim++; // You won - strange! - _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wonNim = true; @@ -1791,8 +1791,8 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); break; case kRoomMusicRoom: playHarp(); @@ -1801,41 +1801,41 @@ void Acci::doThat() { } else if (isHolding()) { switch (_thing) { case Gyro::kObjectLute : - _vm->_scrolls->displayScrollChain('U', 7); + _vm->_dialogs->displayScrollChain('U', 7); if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) - _vm->_scrolls->displayScrollChain('U', 10); + _vm->_dialogs->displayScrollChain('U', 10); if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) - _vm->_scrolls->displayScrollChain('U', 15); + _vm->_dialogs->displayScrollChain('U', 15); break; case 52: if (_vm->_gyro->_room == kRoomMusicRoom) playHarp(); else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); break; case 55: if (_vm->_gyro->_room == kRoomArgentPub) // play_nim(); warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); break; default: - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } } break; case kVerbCodeRing: if (isHolding()) { if (_thing == Gyro::kObjectBell) { - _vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); + _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph - _vm->_scrolls->displayText("(Are you trying to join in, Avvy\?\?!)"); + _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else - _vm->_scrolls->displayText(kWhat); + _vm->_dialogs->displayText(kWhat); } break; case kVerbCodeHelp: @@ -1843,10 +1843,10 @@ void Acci::doThat() { warning("STUB: Acci::doThat() - case kVerbCodehelp"); break; case kVerbCodeLarrypass: - _vm->_scrolls->displayText("Wrong game!"); + _vm->_dialogs->displayText("Wrong game!"); break; case kVerbCodePhaon: - _vm->_scrolls->displayText("Hello, Phaon!"); + _vm->_dialogs->displayText("Hello, Phaon!"); break; case kVerbCodeBoss: // bosskey(); @@ -1854,27 +1854,27 @@ void Acci::doThat() { break; case kVerbCodePee: if (_vm->_gyro->setFlag('P')) { - _vm->_scrolls->displayText("Hmm, I don't think anyone will notice..."); + _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { - Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeCheat: { - Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_cheat = true; } break; case kVerbCodeMagic: if (_vm->_gyro->_avariciusTalk > 0) - _vm->_scrolls->displayScrollChain('q', 19); + _vm->_dialogs->displayScrollChain('q', 19); else { if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! - _vm->_scrolls->displayScrollChain('q', 17); + _vm->_dialogs->displayScrollChain('q', 17); if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) - _vm->_scrolls->displayScrollChain('q', 18); + _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; spr->init(1, false, _vm->_animation); // Avaricius @@ -1886,31 +1886,31 @@ void Acci::doThat() { _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else - _vm->_scrolls->displayText("Nothing appears to happen..."); + _vm->_dialogs->displayText("Nothing appears to happen..."); } break; case kVerbCodeSmartAlec: - _vm->_scrolls->displayText("Listen, smart alec, that was just rhetoric."); + _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: switch (_vm->_gyro->_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ - "(I shouldn't say it again, if I were you!)", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; case 1: { Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ - "do things I tell you not to?%c%cDon't do it again!", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + "do things I tell you not to?%c%cDon't do it again!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } break; default: { _vm->_pingo->zonk(); // CHECKME: Weird character in string - Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); _vm->_lucerna->gameOver(); } } @@ -1918,11 +1918,11 @@ void Acci::doThat() { break; case kVerbCodeListen: if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) - _vm->_scrolls->displayText("All other noise is drowned out by the ringing of the bells."); + _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); else if (_vm->_gyro->_listen.empty()) - _vm->_scrolls->displayText("You can't hear anything much at the moment, Avvy."); + _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_scrolls->displayText(_vm->_gyro->_listen); + _vm->_dialogs->displayText(_vm->_gyro->_listen); break; case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_room) { @@ -1934,12 +1934,12 @@ void Acci::doThat() { case 54: case 58: // Beer, whisky, cider or mead. if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_scrolls->displayScrollChain('D', 15); + _vm->_dialogs->displayScrollChain('D', 15); return; } if (_vm->_gyro->_teetotal) { - _vm->_scrolls->displayScrollChain('D', 6); + _vm->_dialogs->displayScrollChain('D', 6); return; } @@ -1947,7 +1947,7 @@ void Acci::doThat() { _vm->_lucerna->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 11); - _vm->_scrolls->displayText(booze[_thing - 51] + ", please." + Scrolls::kControlRegister + '1' + Scrolls::kControlSpeechBubble); + _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); _vm->_gyro->_drinking = _thing; _vm->_background->drawBackgroundSprite(-1, -1, 9); @@ -1959,21 +1959,21 @@ void Acci::doThat() { break; // We have a right one here - buy Pepsi??! case Gyro::kObjectWine: if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! - _vm->_scrolls->displayScrollChain('D', 2); // 1 bottle's shufishent! + _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_scrolls->displayScrollChain('D', 15); + _vm->_dialogs->displayScrollChain('D', 15); return; } if (_vm->_gyro->_carryNum >= kCarryLimit) { - _vm->_scrolls->displayText("Your hands are full."); + _vm->_dialogs->displayText("Your hands are full."); return; } _vm->_background->drawBackgroundSprite(-1, -1, 11); - Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); if (_vm->_gyro->_alcoholLevel == 0) _vm->_lucerna->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 9); @@ -1984,21 +1984,21 @@ void Acci::doThat() { break; } } else - _vm->_scrolls->displayScrollChain('D', 5); // Go to the bar! + _vm->_dialogs->displayScrollChain('D', 5); // Go to the bar! break; case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { if (_thing == Gyro::kObjectOnion) { if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) - _vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things! + _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("Before you ask, you remember that your hands are full."); + _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { if (_vm->_gyro->_boughtOnion) - _vm->_scrolls->displayScrollChain('D', 11); + _vm->_dialogs->displayScrollChain('D', 11); else { - _vm->_scrolls->displayScrollChain('D', 9); + _vm->_dialogs->displayScrollChain('D', 9); _vm->_lucerna->incScore(3); } _vm->_gyro->decreaseMoney(3); // It costs thruppence. @@ -2009,16 +2009,16 @@ void Acci::doThat() { _vm->_gyro->_onionInVinegar = false; } } else - _vm->_scrolls->displayScrollChain('D', 0); + _vm->_dialogs->displayScrollChain('D', 0); } else - _vm->_scrolls->displayScrollChain('D', 0); + _vm->_dialogs->displayScrollChain('D', 0); break; case kRoomNottsPub: - _vm->_scrolls->displayScrollChain('n', 15); // Can't sell to southerners. + _vm->_dialogs->displayScrollChain('n', 15); // Can't sell to southerners. break; default: - _vm->_scrolls->displayScrollChain('D', 0); // Can't buy that. + _vm->_dialogs->displayScrollChain('D', 0); // Can't buy that. } break; case kVerbCodeAttack: @@ -2028,17 +2028,17 @@ void Acci::doThat() { switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: - _vm->_scrolls->displayScrollChain('Q', 10); - _vm->_scrolls->displayText("(At the very least, don't use your bare hands!)"); + _vm->_dialogs->displayScrollChain('Q', 10); + _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_scrolls->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: - _vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); + _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: - _vm->_scrolls->displayScrollChain('Q', 11); + _vm->_dialogs->displayScrollChain('Q', 11); _vm->_gyro->_cwytalotGone = true; _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; @@ -2051,14 +2051,14 @@ void Acci::doThat() { _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; break; default: - _vm->_scrolls->displayScrollChain('Q', 10); // Please try not to be so violent! + _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! } } else - _vm->_scrolls->displayScrollChain('Q', 10); + _vm->_dialogs->displayScrollChain('Q', 10); break; case kVerbCodePasswd: if (_vm->_gyro->_room != kRoomBridge) - _vm->_scrolls->displayScrollChain('Q', 12); + _vm->_dialogs->displayScrollChain('Q', 12); else { bool ok = true; for (uint i = 0; i < _thats.size(); i++) { @@ -2073,15 +2073,15 @@ void Acci::doThat() { if (ok) { if (_vm->_gyro->_drawbridgeOpen != 0) - _vm->_scrolls->displayText("Contrary to your expectations, the drawbridge fails to close again."); + _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { _vm->_lucerna->incScore(4); - _vm->_scrolls->displayText("The drawbridge opens!"); + _vm->_dialogs->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); _vm->_gyro->_drawbridgeOpen = 1; } } else - _vm->_scrolls->displayScrollChain('Q', 12); + _vm->_dialogs->displayScrollChain('Q', 12); } break; case kVerbCodeDir: @@ -2091,8 +2091,8 @@ void Acci::doThat() { _vm->_lucerna->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str()); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodePut: @@ -2103,30 +2103,30 @@ void Acci::doThat() { break; case kVerbCodeKiss: if (_person == kPardon) - _vm->_scrolls->displayText("Kiss whom?"); + _vm->_dialogs->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { case Gyro::kPeopleArkata: - _vm->_scrolls->displayScrollChain('U', 12); + _vm->_dialogs->displayScrollChain('U', 12); break; case Gyro::kPeopleGeida: - _vm->_scrolls->displayScrollChain('U', 13); + _vm->_dialogs->displayScrollChain('U', 13); break; case Gyro::kPeopleWisewoman: - _vm->_scrolls->displayScrollChain('U', 14); + _vm->_dialogs->displayScrollChain('U', 14); break; default: - _vm->_scrolls->displayScrollChain('U', 5); // You WHAT? + _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? } } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) - _vm->_scrolls->displayText("Hey, what kind of a weirdo are you??"); + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); break; case kVerbCodeClimb: if (_vm->_gyro->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! - _vm->_scrolls->displayText("Not with your head for heights, Avvy!"); + _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); @@ -2148,28 +2148,28 @@ void Acci::doThat() { _vm->_gyro->_avvyInBed = true; _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. if (_vm->_gyro->_teetotal) - _vm->_scrolls->displayScrollChain('d', 13); + _vm->_dialogs->displayScrollChain('d', 13); } else - _vm->_scrolls->displayText("You're already awake, Avvy!"); + _vm->_dialogs->displayText("You're already awake, Avvy!"); break; case Gyro::kPeopleAyles: if (!_vm->_gyro->_aylesIsAwake) - _vm->_scrolls->displayText("You can't seem to wake him by yourself."); + _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; case Gyro::kPeopleJacques: { Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ - "Hmmm... that doesn't seem to do any good...", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; default: - _vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!"); + _vm->_dialogs->displayText("It's difficult to awaken people who aren't asleep...!"); } break; case kVerbCodeSit: if (_vm->_gyro->_room == kRoomNottsPub) { if (_vm->_gyro->_sittingInPub) - _vm->_scrolls->displayText("You're already sitting!"); + _vm->_dialogs->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); @@ -2178,35 +2178,35 @@ void Acci::doThat() { _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); _vm->_lucerna->dawn(); - Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Scrolls::kControlParagraph); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: - if (_vm->_scrolls->displayQuestion("Restart game and lose changes?")) { + if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { _vm->_lucerna->dusk(); _vm->_gyro->newGame(); _vm->_lucerna->dawn(); } break; case kPardon: - _vm->_scrolls->displayText("Hey, a verb would be helpful!"); + _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("Hello.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeThanks: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + tmpStr += Common::String::format("That's OK.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } break; default: - Common::String tmpStr = Common::String::format("%cParser bug!", Scrolls::kControlBell); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cParser bug!", Dialogs::kControlBell); + _vm->_dialogs->displayText(tmpStr); } } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index fafd088b58ce..8fb28eda1522 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -29,7 +29,7 @@ #include "avalanche/avalanche.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" #include "avalanche/background.h" @@ -216,8 +216,8 @@ void AnimationType::walk() { break; case Gyro::kMagicUnfinished: { bounce(); - Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Scrolls::kControlBell, Scrolls::kControlCenter, Scrolls::kControlRoman); - _anim->_vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); + _anim->_vm->_dialogs->displayText(tmpStr); } break; case Gyro::kMagicSpecial: @@ -421,12 +421,12 @@ void Animation::catacombMove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs flipRoom(kRoomLustiesRoom, 4); - _vm->_scrolls->displayText("Phew! Nice to be out of there!"); + _vm->_dialogs->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette flipRoom(kRoomOubliette, 1); - Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } return; case 4: @@ -434,7 +434,7 @@ void Animation::catacombMove(byte ped) { return; case 2307: flipRoom(kRoomLusties, 5); - _vm->_scrolls->displayText("Oh no... here we go again..."); + _vm->_dialogs->displayText("Oh no... here we go again..."); _vm->_gyro->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; @@ -733,7 +733,7 @@ void Animation::callSpecial(uint16 which) { _vm->_gyro->_magics[11]._data = 5; _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! stopWalking(); - _vm->_scrolls->displayScrollChain('q', 26); + _vm->_dialogs->displayScrollChain('q', 26); _vm->_gyro->_userMovesAvvy = true; break; case 3: // _vm->_gyro->special 3: Room 71: triggers dart. @@ -763,11 +763,11 @@ void Animation::callSpecial(uint16 which) { if (_vm->_gyro->_friarWillTieYouUp) { // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. - _vm->_scrolls->displayScrollChain('q', 35); + _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_scrolls->displayScrollChain('q', 36); + _vm->_dialogs->displayScrollChain('q', 36); _vm->_gyro->_tiedUp = true; _vm->_gyro->_friarWillTieYouUp = false; _sprites[1].walkTo(2); @@ -791,12 +791,12 @@ void Animation::callSpecial(uint16 which) { _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); - _vm->_scrolls->displayText("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; case 8: // _vm->_gyro->special 8: leave du Lustie's room. if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_scrolls->displayScrollChain('q', 63); + _vm->_dialogs->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida @@ -816,9 +816,9 @@ void Animation::callSpecial(uint16 which) { if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { // Into Geida's room. if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) - _vm->_scrolls->displayScrollChain('q', 62); + _vm->_dialogs->displayScrollChain('q', 62); else { - _vm->_scrolls->displayScrollChain('q', 61); + _vm->_dialogs->displayScrollChain('q', 61); return; } } @@ -1034,7 +1034,7 @@ void Animation::arrowProcs(byte tripnum) { // OK, it's hit him... what now? _sprites[1]._callEachStepFl = false; // prevent recursion. - _vm->_scrolls->displayScrollChain('Q', 47); // Complaint! + _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_lucerna->gameOver(); @@ -1091,7 +1091,7 @@ void Animation::spin(byte whichway, byte &tripnum) { _vm->_gyro->_geidaSpin += 1; _vm->_gyro->_geidaTime = 20; if (_vm->_gyro->_geidaSpin == 5) { - _vm->_scrolls->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_gyro->_geidaSpin = 0; _vm->_gyro->_geidaTime = 0; // knock out records } @@ -1215,7 +1215,7 @@ void Animation::animLink() { if (_mustExclaim) { _mustExclaim = false; - _vm->_scrolls->displayScrollChain('x', _sayWhat); + _vm->_dialogs->displayScrollChain('x', _sayWhat); } } @@ -1233,13 +1233,13 @@ void Animation::stopWalking() { void Animation::hideInCupboard() { if (_vm->_gyro->_avvysInTheCupboard) { if (_vm->_gyro->_wearing == Acci::kNothing) { - Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; _vm->_gyro->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. - _vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!"); + _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_gyro->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); @@ -1250,8 +1250,8 @@ void Animation::hideInCupboard() { _sprites[0]._visible = false; _vm->_gyro->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ - "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Scrolls::kControlParagraph); - _vm->_scrolls->displayText(tmpStr); + "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); + _vm->_dialogs->displayText(tmpStr); _vm->_gyro->_avvysInTheCupboard = true; _vm->_background->drawBackgroundSprite(-1, -1, 7); } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index f140ae90b6ee..d7a07fe41df6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -63,7 +63,7 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _pingo; - delete _scrolls; + delete _dialogs; delete _lucerna; delete _background; delete _sequence; @@ -83,7 +83,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); _pingo = new Pingo(this); - _scrolls = new Scrolls(this); + _dialogs = new Dialogs(this); _lucerna = new Lucerna(this); _background = new Background(this); _sequence = new Sequence(this); @@ -95,7 +95,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _sound = new SoundHandler(this); _graphics->init(); - _scrolls->init(); + _dialogs->init(); _lucerna->init(); _acci->init(); _parser->init(); @@ -453,10 +453,10 @@ bool AvalancheEngine::loadGame(const int16 slot) { _background->updateBackgroundSprites(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", - Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter, - Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName.c_str(), Scrolls::kControlNewLine, - Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); - _scrolls->displayText(tmpStr); + Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, _gyro->_roomnName.c_str(), Dialogs::kControlNewLine, + Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); + _dialogs->displayText(tmpStr); AnimationType *avvy = &_animation->_sprites[0]; if (avvy->_quick && avvy->_visible) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 16482c8c927f..2a7df29a329e 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -34,7 +34,7 @@ #include "avalanche/avalot.h" #include "avalanche/gyro.h" #include "avalanche/pingo.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/background.h" #include "avalanche/sequence.h" @@ -70,7 +70,7 @@ class AvalancheEngine : public Engine { Avalot *_avalot; Gyro *_gyro; Pingo *_pingo; - Scrolls *_scrolls; + Dialogs *_dialogs; Lucerna *_lucerna; Background *_background; Sequence *_sequence; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7126f332e711..5dc7fcfcba1f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -34,7 +34,7 @@ #include "avalanche/animation.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/menu.h" #include "avalanche/pingo.h" #include "avalanche/timer.h" @@ -120,7 +120,7 @@ void Avalot::handleKeyDown(Common::Event &event) { void Avalot::setup() { _vm->_gyro->init(); - _vm->_scrolls->resetScroll(); + _vm->_dialogs->reset(); _vm->_lucerna->dusk(); _vm->_lucerna->loadDigits(); @@ -128,7 +128,7 @@ void Avalot::setup() { _vm->_parser->_quote = true; _vm->_lucerna->drawToolbar(); - _vm->_scrolls->setReadyLight(2); + _vm->_dialogs->setReadyLight(2); _vm->_animation->_direction = Animation::kDirStopped; _vm->_animation->loadAnims(); @@ -155,7 +155,7 @@ void Avalot::setup() { _vm->_lucerna->fxToggle(); _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); - _vm->_scrolls->displayScrollChain('q', 83); // Info on the game, etc. + _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. } } diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/dialogs.cpp similarity index 92% rename from engines/avalanche/scrolls.cpp rename to engines/avalanche/dialogs.cpp index e5d08ecfc67e..a496fcd177aa 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/dialogs.cpp @@ -28,7 +28,7 @@ /* SCROLLS The scroll driver. */ #include "avalanche/avalanche.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/gyro.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" @@ -40,17 +40,17 @@ namespace Avalanche { -Scrolls::Scrolls(AvalancheEngine *vm) { +Dialogs::Dialogs(AvalancheEngine *vm) { _vm = vm; _noError = true; } -void Scrolls::init() { +void Dialogs::init() { loadFont(); resetScrollDriver(); } -void Scrolls::setReadyLight(byte state) { // Sets "Ready" light to whatever +void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever if (_vm->_gyro->_ledStatus == state) return; // Already like that! @@ -75,11 +75,11 @@ void Scrolls::setReadyLight(byte state) { // Sets "Ready" light to whatever _vm->_gyro->_ledStatus = state; } -void Scrolls::easterEgg() { +void Dialogs::easterEgg() { warning("STUB: Scrolls::easterEgg()"); } -void Scrolls::say(int16 x, int16 y, Common::String z) { +void Dialogs::say(int16 x, int16 y, Common::String z) { FontType itw; byte lz = z.size(); @@ -97,7 +97,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { break; default: { for (int yy = 0; yy < 12; yy++) - itw[(byte)z[xx]][yy] = _scrollFonts[_currentFont][(byte)z[xx]][yy + 2]; + itw[(byte)z[xx]][yy] = _fonts[_currentFont][(byte)z[xx]][yy + 2]; // We have to draw the characters one-by-one because of the accidental font changes. i++; @@ -108,7 +108,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { } } -void Scrolls::scrollModeNormal() { +void Dialogs::scrollModeNormal() { // Original code is: // egg : array[1..8] of char = ^P^L^U^G^H+'***'; // this is not using kControl characters: it's the secret code to be entered to trigger the easter egg @@ -181,16 +181,16 @@ void Scrolls::scrollModeNormal() { warning("STUB: Scrolls::scrollModeNormal()"); } -void Scrolls::scrollModeDialogue() { +void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); } -void Scrolls::store(byte what, TuneType &played) { +void Dialogs::store(byte what, TuneType &played) { memcpy(played, played + 1, sizeof(played) - 1); played[30] = what; } -bool Scrolls::theyMatch(TuneType &played) { +bool Dialogs::theyMatch(TuneType &played) { byte mistakes = 0; for (unsigned int i = 0; i < sizeof(played); i++) { @@ -201,7 +201,7 @@ bool Scrolls::theyMatch(TuneType &played) { return mistakes < 5; } -void Scrolls::scrollModeMusic() { +void Dialogs::scrollModeMusic() { setReadyLight(3); _vm->_gyro->_seeScroll = true; CursorMan.showMouse(false); @@ -309,30 +309,30 @@ void Scrolls::scrollModeMusic() { CursorMan.showMouse(true); } -void Scrolls::resetScrollDriver() { +void Dialogs::resetScrollDriver() { _vm->_gyro->_scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; _vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. } -void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... +void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... for (int i = 0; i < _vm->_gyro->_scrollBells; i++) _vm->_lucerna->errorLed(); // Ring the bell "x" times. } -void Scrolls::dodgem() { +void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. } -void Scrolls::unDodgem() { +void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } -void Scrolls::getIcon(int16 x, int16 y, byte which) { +void Dialogs::getIcon(int16 x, int16 y, byte which) { Common::File file; if (!file.open("icons.avd")) @@ -351,7 +351,7 @@ void Scrolls::getIcon(int16 x, int16 y, byte which) { file.close(); } -void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { +void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File file; Common::String filename = Common::String::format("%s.avd", fn.c_str()); @@ -377,7 +377,7 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { file.close(); } -void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { +void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; int16 ly = (_vm->_gyro->_scrollNum) * 6; int16 ex; @@ -493,7 +493,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { resetScrollDriver(); } -void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { +void Dialogs::drawBubble(DialogFunctionType modeFunc) { Common::Point points[3]; CursorMan.showMouse(false); @@ -564,12 +564,12 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { resetScrollDriver(); } -bool Scrolls::displayQuestion(Common::String question) { +bool Dialogs::displayQuestion(Common::String question) { warning("STUB: Scrolls::displayQuestion()"); return true; } -void Scrolls::resetScroll() { +void Dialogs::reset() { _vm->_gyro->_scrollNum = 1; for (int i = 0; i < 15; i++) { if (!_vm->_gyro->_scroll[i].empty()) @@ -577,14 +577,14 @@ void Scrolls::resetScroll() { } } -void Scrolls::setBubbleStateNatural() { +void Dialogs::setBubbleStateNatural() { _vm->_gyro->_talkX = 320; _vm->_gyro->_talkY = 200; _vm->_gyro->_talkBackgroundColor = 8; _vm->_gyro->_talkFontColor = 15; } -Common::String Scrolls::displayMoney() { +Common::String Dialogs::displayMoney() { Common::String result; if (_vm->_gyro->_money < 12) { // just pence @@ -606,12 +606,12 @@ Common::String Scrolls::displayMoney() { return result; } -void Scrolls::stripTrailingSpaces(Common::String &str) { +void Dialogs::stripTrailingSpaces(Common::String &str) { while (str[str.size() - 1] == ' ') str.deleteLastChar(); } -void Scrolls::solidify(byte n) { +void Dialogs::solidify(byte n) { if (!_vm->_gyro->_scroll[n].contains(' ')) return; // No spaces. @@ -624,7 +624,7 @@ void Scrolls::solidify(byte n) { stripTrailingSpaces(_vm->_gyro->_scroll[n]); } -void Scrolls::callScrollDriver() { +void Dialogs::callDialogDriver() { // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? warning("STUB: Scrolls::calldrivers()"); @@ -669,9 +669,9 @@ void Scrolls::callScrollDriver() { _vm->_lucerna->spriteRun(); call_spriterun = false; - drawScroll(&Avalanche::Scrolls::scrollModeNormal); + drawScroll(&Avalanche::Dialogs::scrollModeNormal); - resetScroll(); + reset(); if (_vm->_gyro->_scReturn) return; @@ -711,9 +711,9 @@ void Scrolls::callScrollDriver() { setBubbleStateNatural(); } - drawBubble(&Avalanche::Scrolls::scrollModeNormal); + drawBubble(&Avalanche::Dialogs::scrollModeNormal); - resetScroll(); + reset(); if (_vm->_gyro->_scReturn) return; @@ -750,7 +750,7 @@ void Scrolls::callScrollDriver() { case 10: switch (_vm->_gyro->_boxContent) { case 0: // Sixpence. - _vm->_scrolls->displayScrollChain('q', 37); // You find the sixpence. + _vm->_dialogs->displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_money += 6; _vm->_gyro->_boxContent = _vm->_acci->kNothing; _vm->_lucerna->incScore(2); @@ -784,8 +784,8 @@ void Scrolls::callScrollDriver() { _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; _vm->_gyro->_scrollNum++; - drawScroll(&Avalanche::Scrolls::scrollModeDialogue); - resetScroll(); + drawScroll(&Avalanche::Dialogs::scrollModeDialogue); + reset(); break; case kControlRegister: mouthnext = true; @@ -806,27 +806,27 @@ void Scrolls::callScrollDriver() { } } -void Scrolls::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! +void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! _vm->_gyro->_bufSize = text.size(); memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); - callScrollDriver(); + callDialogDriver(); } -void Scrolls::loadFont() { +void Dialogs::loadFont() { Common::File file; if (!file.open("avalot.fnt")) error("AVALANCHE: Scrolls: File not found: avalot.fnt"); for (int16 i = 0; i < 256; i++) - file.read(_scrollFonts[0][i], 16); + file.read(_fonts[0][i], 16); file.close(); if (!file.open("avitalic.fnt")) error("AVALANCHE: Scrolls: File not found: avitalic.fnt"); for (int16 i = 0; i < 256; i++) - file.read(_scrollFonts[1][i], 16); + file.read(_fonts[1][i], 16); file.close(); if (!file.open("ttsmall.fnt")) @@ -837,26 +837,26 @@ void Scrolls::loadFont() { file.close(); } -void Scrolls::musicalScroll() { +void Dialogs::displayMusicalScroll() { Common::String tmpStr = Common::String::format("To play the harp...%c%cUse these keys:%c%cQ W E R T Y U I O P [ ]%c%cOr press Enter to stop playing.%c", kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); displayText(tmpStr); _vm->_lucerna->spriteRun(); CursorMan.showMouse(false); - drawScroll(&Avalanche::Scrolls::scrollModeMusic); + drawScroll(&Avalanche::Dialogs::scrollModeMusic); CursorMan.showMouse(true); - resetScroll(); + reset(); } // From Visa: -void Scrolls::unSkrimble() { +void Dialogs::unSkrimble() { for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; } -void Scrolls::doTheBubble() { +void Dialogs::doTheBubble() { _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; _vm->_gyro->_bufSize++; } @@ -865,7 +865,7 @@ void Scrolls::doTheBubble() { * Display a string in a scroll * @remarks Originally called 'dixi' */ -void Scrolls::displayScrollChain(char block, byte point, bool report, bool bubbling) { +void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbling) { Common::File indexfile; if (!indexfile.open("avalot.idx")) error("AVALANCHE: Visa: File not found: avalot.idx"); @@ -888,8 +888,8 @@ void Scrolls::displayScrollChain(char block, byte point, bool report, bool bubbl if (error) { if (report) { - Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Scrolls::kControlBell, block, point); - _vm->_scrolls->displayText(todisplay); + Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Dialogs::kControlBell, block, point); + _vm->_dialogs->displayText(todisplay); } return; } @@ -907,14 +907,14 @@ void Scrolls::displayScrollChain(char block, byte point, bool report, bool bubbl if (bubbling) doTheBubble(); - _vm->_scrolls->callScrollDriver(); + _vm->_dialogs->callDialogDriver(); } /** * Start speech * @remarks Originally called 'speech' */ -void Scrolls::speak(byte who, byte subject) { +void Dialogs::speak(byte who, byte subject) { if (subject == 0) { // No subject. displayScrollChain('s', who, false, true); return; @@ -952,11 +952,11 @@ void Scrolls::speak(byte who, byte subject) { unSkrimble(); doTheBubble(); - _vm->_scrolls->callScrollDriver(); + _vm->_dialogs->callDialogDriver(); _noError = true; } -void Scrolls::talkTo(byte whom) { +void Dialogs::talkTo(byte whom) { if (_vm->_acci->_person == _vm->_acci->kPardon) { _vm->_acci->_person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; @@ -978,8 +978,8 @@ void Scrolls::talkTo(byte whom) { case 1: // Fallthrough is intended. case 2: { Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); - Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Scrolls::kControlRegister, Scrolls::kControlSpeechBubble); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); } return; case 3: @@ -1052,16 +1052,16 @@ void Scrolls::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, i + 49, Dialogs::kControlToBuffer); + _vm->_dialogs->displayText(tmpStr); noMatches = false; break; } } if (noMatches) { - Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, Scrolls::kControlRegister, Scrolls::kControlToBuffer); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, Dialogs::kControlRegister, Dialogs::kControlToBuffer); + _vm->_dialogs->displayText(tmpStr); } speak(whom, _vm->_gyro->_subjectNum); diff --git a/engines/avalanche/scrolls.h b/engines/avalanche/dialogs.h similarity index 87% rename from engines/avalanche/scrolls.h rename to engines/avalanche/dialogs.h index a8938a5d34e8..9cb4470959a8 100644 --- a/engines/avalanche/scrolls.h +++ b/engines/avalanche/dialogs.h @@ -27,19 +27,19 @@ /* SCROLLS The scroll driver. */ -#ifndef AVALANCHE_SCROLLS2_H -#define AVALANCHE_SCROLLS2_H +#ifndef AVALANCHE_DIALOGS_H +#define AVALANCHE_DIALOGS_H #include "common/system.h" namespace Avalanche { class AvalancheEngine; -class Scrolls; +class Dialogs; -typedef void (Scrolls::*ScrollsFunctionType)(); +typedef void (Dialogs::*DialogFunctionType)(); -class Scrolls { +class Dialogs { public: // Constants to replace the command characters from Pascal. // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers @@ -61,22 +61,22 @@ class Scrolls { kControlIcon = 22 // ^V }; - bool _aboutScroll; // Is this the about box? - FontType _scrollFonts[2]; + bool _aboutBox; // Is this the about box? + FontType _fonts[2]; - Scrolls(AvalancheEngine *vm); + Dialogs(AvalancheEngine *vm); void init(); void setReadyLight(byte state); // Sets "Ready" light to whatever. - void drawScroll(ScrollsFunctionType modeFunc); - void drawBubble(ScrollsFunctionType modeFunc); - void resetScroll(); - void callScrollDriver(); + void drawScroll(DialogFunctionType modeFunc); + void drawBubble(DialogFunctionType modeFunc); + void reset(); + void callDialogDriver(); void displayText(Common::String text); bool displayQuestion(Common::String question); void setBubbleStateNatural(); // Natural state of bubbles Common::String displayMoney(); - void musicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. + void displayMusicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. // From Visa: void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); @@ -130,4 +130,4 @@ class Scrolls { } // End of namespace Avalanche -#endif // AVALANCHE_SCROLLS2_H +#endif // AVALANCHE_DIALOGS_H diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index e338ecddbc99..3d86d34b38b3 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/gyro.h" #include "avalanche/pingo.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/lucerna.h" #include "avalanche/acci.h" #include "avalanche/animation.h" @@ -311,7 +311,7 @@ void Gyro::newGame() { _alive = true; resetVariables(); - _vm->_scrolls->setBubbleStateNatural(); + _vm->_dialogs->setBubbleStateNatural(); _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; @@ -366,7 +366,7 @@ bool Gyro::setFlag(char x) { bool Gyro::decreaseMoney(uint16 howmuchby) { _money -= howmuchby; if (_money < 0) { - _vm->_scrolls->displayScrollChain('Q', 2); // "You are now denariusless!" + _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" _vm->_lucerna->gameOver(); return false; } else diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 539bb40ed816..34ba7c11c111 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/timer.h" #include "avalanche/animation.h" #include "avalanche/background.h" @@ -70,8 +70,8 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", - Scrolls::kControlNewLine, Scrolls::kControlNewLine); - _vm->_scrolls->displayText(tmpStr); + Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); } _oldHour = _hour; _oldHourAngle = _hourAngle; @@ -148,7 +148,7 @@ void Lucerna::callVerb(byte id) { Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ "what the current setting of this key is."); - _vm->_scrolls->displayText(tmpStr); + _vm->_dialogs->displayText(tmpStr); } else { _vm->_gyro->_weirdWord = false; _vm->_acci->_polite = true; @@ -606,12 +606,12 @@ void Lucerna::enterRoom(byte room, byte ped) { zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_scrolls->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; refreshObjectList(); } - _vm->_scrolls->displayScrollChain('q', 69); + _vm->_dialogs->displayScrollChain('q', 69); break; case kRoomCatacombs: @@ -1117,7 +1117,7 @@ void Lucerna::checkClick() { } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _vm->_gyro->_mouseText.insertChar(Scrolls::kControlNewLine, 0); + _vm->_gyro->_mouseText.insertChar(Dialogs::kControlNewLine, 0); } else if (!_vm->_gyro->_dropsOk) _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; } @@ -1218,7 +1218,7 @@ void Lucerna::spriteRun() { void Lucerna::fixFlashers() { _vm->_gyro->_ledStatus = 177; _vm->_animation->_oldDirection = 177; - _vm->_scrolls->setReadyLight(2); + _vm->_dialogs->setReadyLight(2); drawDirection(); } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index be8a103f669a..f044a41071e3 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -15,7 +15,7 @@ MODULE_OBJS = \ menu.o \ parser.o \ pingo.o \ - scrolls.o \ + dialogs.o \ sequence.o \ sound.o \ timer.o diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 7196f466879b..95e15e599f87 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -33,7 +33,7 @@ #include "avalanche/gyro.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "common/textconsole.h" #include "common/file.h" diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 9f51e2a73428..c76c9892df2a 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -31,7 +31,7 @@ #include "avalanche/timer.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/scrolls.h" +#include "avalanche/dialogs.h" #include "avalanche/acci.h" #include "avalanche/sequence.h" #include "avalanche/pingo.h" @@ -240,7 +240,7 @@ void Timer::openDrawbridge() { } void Timer::avariciusTalks() { - _vm->_scrolls->displayScrollChain('q', _vm->_gyro->_avariciusTalk); + _vm->_dialogs->displayScrollChain('q', _vm->_gyro->_avariciusTalk); _vm->_gyro->_avariciusTalk++; if (_vm->_gyro->_avariciusTalk < 17) @@ -257,17 +257,17 @@ void Timer::urinate() { } void Timer::toilet() { - _vm->_scrolls->displayText("That's better!"); + _vm->_dialogs->displayText("That's better!"); } void Timer::bang() { - Common::String tmpStr = Common::String::format("%c< BANG! >", Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("%c< BANG! >", Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); addTimer(30, kProcBang2, kReasonExplosion); } void Timer::bang2() { - _vm->_scrolls->displayText("Hmm... sounds like Spludwick's up to something..."); + _vm->_dialogs->displayText("Hmm... sounds like Spludwick's up to something..."); } void Timer::stairs() { @@ -283,25 +283,25 @@ void Timer::stairs() { void Timer::cardiffSurvey() { if (_vm->_gyro->_cardiffQuestionNum == 0) { _vm->_gyro->_cardiffQuestionNum++; - _vm->_scrolls->displayScrollChain('q', 27); + _vm->_dialogs->displayScrollChain('q', 27); } - _vm->_scrolls->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); + _vm->_dialogs->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } void Timer::cardiffReturn() { - _vm->_scrolls->displayScrollChain('q', 28); + _vm->_dialogs->displayScrollChain('q', 28); cardiffSurvey(); // Add end of question. } void Timer::cwytalotInHerts() { - _vm->_scrolls->displayScrollChain('q', 29); + _vm->_dialogs->displayScrollChain('q', 29); } void Timer::getTiedUp() { - _vm->_scrolls->displayScrollChain('q', 34); // ...Trouble! + _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); @@ -328,18 +328,18 @@ void Timer::hangAround() { avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; _vm->_animation->appearPed(0, 1); - _vm->_scrolls->displayScrollChain('q', 39); + _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { - _vm->_scrolls->displayScrollChain('q', 40); + _vm->_dialogs->displayScrollChain('q', 40); AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; - _vm->_scrolls->displayScrollChain('q', 41); + _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -362,8 +362,8 @@ void Timer::afterTheShootemup() { _vm->_lucerna->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") + + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); #if 0 byte shootscore, gain; @@ -383,7 +383,7 @@ void Timer::afterTheShootemup() { warning("STUB: Timer::after_the_shootemup()"); - _vm->_scrolls->displayScrollChain('q', 70); + _vm->_dialogs->displayScrollChain('q', 70); } void Timer::jacquesWakesUp() { @@ -392,7 +392,7 @@ void Timer::jacquesWakesUp() { switch (_vm->_gyro->_jacquesState) { // Additional pictures. case 1 : _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. - _vm->_scrolls->displayScrollChain('Q', 45); + _vm->_dialogs->displayScrollChain('Q', 45); break; case 2 : // Going through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. @@ -440,7 +440,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon void Timer::naughtyDuke2() { AnimationType *spr = &_vm->_animation->_sprites[1]; - _vm->_scrolls->displayScrollChain('q', 48); // "Ha ha, it worked again!" + _vm->_dialogs->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(0); // Walk to the door. spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); @@ -487,20 +487,20 @@ void Timer::jump() { && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_scrolls->displayText("You fail to grab it, because your hands are full."); + _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_lucerna->refreshObjectList(); - _vm->_scrolls->displayScrollChain('q', 50); + _vm->_dialogs->displayScrollChain('q', 50); _vm->_lucerna->incScore(3); } } } void Timer::crapulusSaysSpludOut() { - _vm->_scrolls->displayScrollChain('q', 56); + _vm->_dialogs->displayScrollChain('q', 56); _vm->_gyro->_crapulusWillTell = false; } @@ -508,11 +508,11 @@ void Timer::buyDrinks() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_scrolls->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. + _vm->_dialogs->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. - _vm->_scrolls->displayScrollChain('D', 1); // That'll be thruppence. + _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. - _vm->_scrolls->displayScrollChain('D', 3); // Tell 'em you paid up. + _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_acci->drink(); } @@ -520,10 +520,10 @@ void Timer::buyWine() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_gyro->_malagauche = 0; - _vm->_scrolls->displayScrollChain('D', 50); // You buy the wine. - _vm->_scrolls->displayScrollChain('D', 1); // It'll be thruppence. + _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. + _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) { - _vm->_scrolls->displayScrollChain('D', 4); // You paid up. + _vm->_dialogs->displayScrollChain('D', 4); // You paid up. _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_lucerna->refreshObjectList(); _vm->_gyro->_wineState = 1; // OK Wine. @@ -531,12 +531,12 @@ void Timer::buyWine() { } void Timer::callsGuards() { - _vm->_scrolls->displayScrollChain('Q', 58); // "GUARDS!!!" + _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_lucerna->gameOver(); } void Timer::greetsMonk() { - _vm->_scrolls->displayScrollChain('Q', 59); + _vm->_dialogs->displayScrollChain('Q', 59); _vm->_gyro->_enteredLustiesRoomAsMonk = true; } @@ -551,11 +551,11 @@ void Timer::fallDownOubliette() { void Timer::meetAvaroid() { if (_vm->_gyro->_metAvaroid) { - Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Scrolls::kControlItalic, Scrolls::kControlRoman); - _vm->_scrolls->displayText(tmpStr); + Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); _vm->_lucerna->gameOver(); } else { - _vm->_scrolls->displayScrollChain('Q', 60); + _vm->_dialogs->displayScrollChain('Q', 60); _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); @@ -594,7 +594,7 @@ void Timer::robinHoodAndGeida() { } void Timer::robinHoodAndGeidaTalk() { - _vm->_scrolls->displayScrollChain('q', 66); + _vm->_dialogs->displayScrollChain('q', 66); AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -613,7 +613,7 @@ void Timer::avalotReturns() { spr->remove(); avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(0, 0); - _vm->_scrolls->displayScrollChain('q', 67); + _vm->_dialogs->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; } @@ -636,20 +636,20 @@ void Timer::avvySitDown() { void Timer::ghostRoomPhew() { Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", - Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); - _vm->_scrolls->displayText(tmpStr); + Dialogs::kControlItalic, Dialogs::kControlRoman, Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); } void Timer::arkataShouts() { if (_vm->_gyro->_teetotal) return; - _vm->_scrolls->displayScrollChain('q', 76); + _vm->_dialogs->displayScrollChain('q', 76); addTimer(160, kProcArkataShouts, kReasonArkataShouts); } void Timer::winning() { - _vm->_scrolls->displayScrollChain('q', 79); + _vm->_dialogs->displayScrollChain('q', 79); _vm->_pingo->winningPic(); warning("STUB: Timer::winning()"); @@ -661,7 +661,7 @@ void Timer::winning() { // TODO: To be implemented with Pingo::winningPic(). _vm->_lucerna->callVerb(Acci::kVerbCodeScore); - _vm->_scrolls->displayText(" T H E E N D "); + _vm->_dialogs->displayText(" T H E E N D "); _vm->_gyro->_letMeOut = true; } @@ -672,12 +672,12 @@ void Timer::avalotFalls() { addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", - Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, - Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, - Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, - Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, - Scrolls::kControlRegister, Scrolls::kControlIcon); - _vm->_scrolls->displayText(toDisplay); + Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, + Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, + Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, + Dialogs::kControlRegister, Dialogs::kControlIcon); + _vm->_dialogs->displayText(toDisplay); } } @@ -693,7 +693,7 @@ void Timer::spludwickLeavesCauldron() { } void Timer::giveLuteToGeida() { // Moved here from Acci. - _vm->_scrolls->displayScrollChain('Q', 86); + _vm->_dialogs->displayScrollChain('Q', 86); _vm->_lucerna->incScore(4); _vm->_gyro->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); From a80af5326e14e444856b9a772e793c370666ba26 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 18:37:52 +0200 Subject: [PATCH 1073/1332] AVALANCHE: Merge Acci and Parser --- engines/avalanche/acci.cpp | 2246 ------------------------------- engines/avalanche/acci.h | 138 -- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalanche.cpp | 3 - engines/avalanche/avalanche.h | 2 - engines/avalanche/dialogs.cpp | 27 +- engines/avalanche/gyro.cpp | 25 +- engines/avalanche/lucerna.cpp | 23 +- engines/avalanche/menu.cpp | 105 +- engines/avalanche/module.mk | 1 - engines/avalanche/parser.cpp | 2246 ++++++++++++++++++++++++++++++- engines/avalanche/parser.h | 92 +- engines/avalanche/timer.cpp | 5 +- 13 files changed, 2408 insertions(+), 2507 deletions(-) delete mode 100644 engines/avalanche/acci.cpp delete mode 100644 engines/avalanche/acci.h diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp deleted file mode 100644 index f98eb916b629..000000000000 --- a/engines/avalanche/acci.cpp +++ /dev/null @@ -1,2246 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* ACCIDENCE II The parser. */ - -#include "avalanche/avalanche.h" -#include "avalanche/acci.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" -#include "avalanche/dialogs.h" -#include "avalanche/timer.h" -#include "avalanche/animation.h" -#include "avalanche/background.h" -#include "avalanche/pingo.h" -#include "avalanche/sequence.h" - -#include "common/textconsole.h" - -#include -#include - -namespace Avalanche { - -Acci::Acci(AvalancheEngine *vm) { - _vm = vm; -} - -void Acci::init() { - _vm->_gyro->_weirdWord = false; - - // Initailaze the vocabulary. - // Verbs: 1-49 - _vocabulary[0].init(1, "EXAMINE"); - _vocabulary[1].init(1, "READ"); - _vocabulary[2].init(1, "XAM"); - _vocabulary[3].init(2, "OPEN"); - _vocabulary[4].init(2, "LEAVE"); - _vocabulary[5].init(2, "UNLOCK"); - _vocabulary[6].init(3, "PAUSE"); - _vocabulary[7].init(47, "TA"); // Early to avoid Take and Talk. - _vocabulary[8].init(4, "TAKE"); - _vocabulary[9].init(4, "GET"); - _vocabulary[10].init(4, "PICK"); - _vocabulary[11].init(5, "DROP"); - _vocabulary[12].init(6, "INVENTORY"); - _vocabulary[13].init(7, "TALK"); - _vocabulary[14].init(7, "SAY"); - _vocabulary[15].init(7, "ASK"); - _vocabulary[16].init(8, "GIVE"); - _vocabulary[17].init(9, "DRINK"); - _vocabulary[18].init(9, "IMBIBE"); - _vocabulary[19].init(9, "DRAIN"); - _vocabulary[20].init(10, "LOAD"); - _vocabulary[21].init(10, "RESTORE"); - _vocabulary[22].init(11, "SAVE"); - _vocabulary[23].init(12, "BRIBE"); - _vocabulary[24].init(12, "PAY"); - _vocabulary[25].init(13, "LOOK"); - _vocabulary[26].init(14, "BREAK"); - _vocabulary[27].init(15, "QUIT"); - _vocabulary[28].init(15, "EXIT"); - _vocabulary[29].init(16, "SIT"); - _vocabulary[30].init(16, "SLEEP"); - _vocabulary[31].init(17, "STAND"); - - _vocabulary[32].init(18, "GO"); - _vocabulary[33].init(19, "INFO"); - _vocabulary[34].init(20, "UNDRESS"); - _vocabulary[35].init(20, "DOFF"); - _vocabulary[36].init(21, "DRESS"); - _vocabulary[37].init(21, "WEAR"); - _vocabulary[38].init(21, "DON"); - _vocabulary[39].init(22, "PLAY"); - _vocabulary[40].init(22, "STRUM"); - _vocabulary[41].init(23, "RING"); - _vocabulary[42].init(24, "HELP"); - _vocabulary[43].init(25, "KENDAL"); - _vocabulary[44].init(26, "CAPYBARA"); - _vocabulary[45].init(27, "BOSS"); - _vocabulary[46].init(255, "NINET"); // block for NINETY - _vocabulary[47].init(28, "URINATE"); - _vocabulary[48].init(28, "MINGITE"); - _vocabulary[49].init(29, "NINETY"); - _vocabulary[50].init(30, "ABRACADABRA"); - _vocabulary[51].init(30, "PLUGH"); - _vocabulary[52].init(30, "XYZZY"); - _vocabulary[53].init(30, "HOCUS"); - _vocabulary[54].init(30, "POCUS"); - _vocabulary[55].init(30, "IZZY"); - _vocabulary[56].init(30, "WIZZY"); - _vocabulary[57].init(30, "PLOVER"); - _vocabulary[58].init(30, "MELENKURION"); - _vocabulary[59].init(30, "ZORTON"); - _vocabulary[60].init(30, "BLERBI"); - _vocabulary[61].init(30, "THURB"); - _vocabulary[62].init(30, "SNOEZE"); - _vocabulary[63].init(30, "SAMOHT"); - _vocabulary[64].init(30, "NOSIDE"); - _vocabulary[65].init(30, "PHUGGG"); - _vocabulary[66].init(30, "KNERL"); - _vocabulary[67].init(30, "MAGIC"); - _vocabulary[68].init(30, "KLAETU"); - _vocabulary[69].init(30, "VODEL"); - _vocabulary[70].init(30, "BONESCROLLS"); - _vocabulary[71].init(30, "RADOF"); - - _vocabulary[72].init(31, "RESTART"); - _vocabulary[73].init(32, "SWALLOW"); - _vocabulary[74].init(32, "EAT"); - _vocabulary[75].init(33, "LISTEN"); - _vocabulary[76].init(33, "HEAR"); - _vocabulary[77].init(34, "BUY"); - _vocabulary[78].init(34, "PURCHASE"); - _vocabulary[79].init(34, "ORDER"); - _vocabulary[80].init(34, "DEMAND"); - _vocabulary[81].init(35, "ATTACK"); - _vocabulary[82].init(35, "HIT"); - _vocabulary[83].init(35, "KILL"); - _vocabulary[84].init(35, "PUNCH"); - _vocabulary[85].init(35, "KICK"); - _vocabulary[86].init(35, "SHOOT"); - _vocabulary[87].init(35, "FIRE"); - - // Passwords: 36 - _vocabulary[88].init(36, "TIROS"); - _vocabulary[89].init(36, "WORDY"); - _vocabulary[90].init(36, "STACK"); - _vocabulary[91].init(36, "SHADOW"); - _vocabulary[92].init(36, "OWL"); - _vocabulary[93].init(36, "ACORN"); - _vocabulary[94].init(36, "DOMESDAY"); - _vocabulary[95].init(36, "FLOPPY"); - _vocabulary[96].init(36, "DIODE"); - _vocabulary[97].init(36, "FIELD"); - _vocabulary[98].init(36, "COWSLIP"); - _vocabulary[99].init(36, "OSBYTE"); - _vocabulary[100].init(36, "OSCLI"); - _vocabulary[101].init(36, "TIMBER"); - _vocabulary[102].init(36, "ADVAL"); - _vocabulary[103].init(36, "NEUTRON"); - _vocabulary[104].init(36, "POSITRON"); - _vocabulary[105].init(36, "ELECTRON"); - _vocabulary[106].init(36, "CIRCUIT"); - _vocabulary[107].init(36, "AURUM"); - _vocabulary[108].init(36, "PETRIFY"); - _vocabulary[109].init(36, "EBBY"); - _vocabulary[110].init(36, "CATAPULT"); - _vocabulary[111].init(36, "GAMERS"); - _vocabulary[112].init(36, "FUDGE"); - _vocabulary[113].init(36, "CANDLE"); - _vocabulary[114].init(36, "BEEB"); - _vocabulary[115].init(36, "MICRO"); - _vocabulary[116].init(36, "SESAME"); - _vocabulary[117].init(36, "LORDSHIP"); - - _vocabulary[118].init(37, "DIR"); - _vocabulary[119].init(37, "LS"); - _vocabulary[120].init(38, "DIE"); - _vocabulary[121].init(39, "SCORE"); - _vocabulary[122].init(40, "PUT"); - _vocabulary[123].init(40, "INSERT"); - _vocabulary[124].init(41, "KISS"); - _vocabulary[125].init(41, "SNOG"); - _vocabulary[126].init(41, "CUDDLE"); - _vocabulary[127].init(42, "CLIMB"); - _vocabulary[128].init(42, "CLAMBER"); - _vocabulary[129].init(43, "JUMP"); - _vocabulary[130].init(44, "HIGHSCORES"); - _vocabulary[131].init(44, "HISCORES"); - _vocabulary[132].init(45, "WAKEN"); - _vocabulary[133].init(45, "AWAKEN"); - _vocabulary[134].init(46, "HELLO"); - _vocabulary[135].init(46, "HI"); - _vocabulary[136].init(46, "YO"); - _vocabulary[137].init(47, "THANKS"); // = 47, "ta", which was defined earlier. - - // Nouns - Objects: 50-100 - _vocabulary[138].init(50, "WINE"); - _vocabulary[139].init(50, "BOOZE"); - _vocabulary[140].init(50, "NASTY"); - _vocabulary[141].init(50, "VINEGAR"); - _vocabulary[142].init(51, "MONEYBAG"); - _vocabulary[143].init(51, "BAG"); - _vocabulary[144].init(51, "CASH"); - _vocabulary[145].init(51, "DOSH"); - _vocabulary[146].init(51, "WALLET"); - _vocabulary[147].init(52, "BODKIN"); - _vocabulary[148].init(52, "DAGGER"); - _vocabulary[149].init(53, "POTION"); - _vocabulary[150].init(54, "CHASTITY"); - _vocabulary[151].init(54, "BELT"); - _vocabulary[152].init(55, "BOLT"); - _vocabulary[153].init(55, "ARROW"); - _vocabulary[154].init(55, "DART"); - _vocabulary[155].init(56, "CROSSBOW"); - _vocabulary[156].init(56, "BOW"); - _vocabulary[157].init(57, "LUTE"); - _vocabulary[158].init(58, "PILGRIM"); - _vocabulary[159].init(58, "BADGE"); - _vocabulary[160].init(59, "MUSHROOMS"); - _vocabulary[161].init(59, "TOADSTOOLS"); - _vocabulary[162].init(60, "KEY"); - _vocabulary[163].init(61, "BELL"); - _vocabulary[164].init(62, "PRESCRIPT"); - _vocabulary[165].init(62, "SCROLL"); - _vocabulary[166].init(62, "MESSAGE"); - _vocabulary[167].init(63, "PEN"); - _vocabulary[168].init(63, "QUILL"); - _vocabulary[169].init(64, "INK"); - _vocabulary[170].init(64, "INKPOT"); - _vocabulary[171].init(65, "CLOTHES"); - _vocabulary[172].init(66, "HABIT"); - _vocabulary[173].init(66, "DISGUISE"); - _vocabulary[174].init(67, "ONION"); - - _vocabulary[175].init(99, "PASSWORD"); - - // Objects from Also are placed between 101 and 131. - // Nouns - People - Male: 150-174 - _vocabulary[176].init(150, "AVVY"); - _vocabulary[177].init(150, "AVALOT"); - _vocabulary[178].init(150, "YOURSELF"); - _vocabulary[179].init(150, "ME"); - _vocabulary[180].init(150, "MYSELF"); - _vocabulary[181].init(151, "SPLUDWICK"); - _vocabulary[182].init(151, "THOMAS"); - _vocabulary[183].init(151, "ALCHEMIST"); - _vocabulary[184].init(151, "CHEMIST"); - _vocabulary[185].init(152, "CRAPULUS"); - _vocabulary[186].init(152, "SERF"); - _vocabulary[187].init(152, "SLAVE"); - _vocabulary[188].init(158, "DU"); // Put in early for Baron DU Lustie to save confusion with Duck & Duke. - _vocabulary[189].init(152, "CRAPPY"); - _vocabulary[190].init(153, "DUCK"); - _vocabulary[191].init(153, "DOCTOR"); - _vocabulary[192].init(154, "MALAGAUCHE"); - _vocabulary[193].init(155, "FRIAR"); - _vocabulary[194].init(155, "TUCK"); - _vocabulary[195].init(156, "ROBIN"); - _vocabulary[196].init(156, "HOOD"); - _vocabulary[197].init(157, "CWYTALOT"); - _vocabulary[198].init(157, "GUARD"); - _vocabulary[199].init(157, "BRIDGEKEEP"); - _vocabulary[200].init(158, "BARON"); - _vocabulary[201].init(158, "LUSTIE"); - _vocabulary[202].init(159, "DUKE"); - _vocabulary[203].init(159, "GRACE"); - _vocabulary[204].init(160, "DOGFOOD"); - _vocabulary[205].init(160, "MINSTREL"); - _vocabulary[206].init(161, "TRADER"); - _vocabulary[207].init(161, "SHOPKEEPER"); - _vocabulary[208].init(161, "STALLHOLDER"); - _vocabulary[209].init(162, "PILGRIM"); - _vocabulary[210].init(162, "IBYTHNETH"); - _vocabulary[211].init(163, "ABBOT"); - _vocabulary[212].init(163, "AYLES"); - _vocabulary[213].init(164, "PORT"); - _vocabulary[214].init(165, "SPURGE"); - _vocabulary[215].init(166, "JACQUES"); - _vocabulary[216].init(166, "SLEEPER"); - _vocabulary[217].init(166, "RINGER"); - - // Nouns - People - Female: 175-199 - _vocabulary[218].init(175, "WIFE"); - _vocabulary[219].init(175, "ARKATA"); - _vocabulary[220].init(176, "GEDALODAVA"); - _vocabulary[221].init(176, "GEIDA"); - _vocabulary[222].init(176, "PRINCESS"); - _vocabulary[223].init(178, "WISE"); - _vocabulary[224].init(178, "WITCH"); - - // Pronouns: 200-224 - _vocabulary[225].init(200, "HIM"); - _vocabulary[226].init(200, "MAN"); - _vocabulary[227].init(200, "GUY"); - _vocabulary[228].init(200, "DUDE"); - _vocabulary[229].init(200, "CHAP"); - _vocabulary[230].init(200, "FELLOW"); - _vocabulary[231].init(201, "HER"); - _vocabulary[232].init(201, "GIRL"); - _vocabulary[233].init(201, "WOMAN"); - _vocabulary[234].init(202, "IT"); - _vocabulary[235].init(202, "THING"); - _vocabulary[236].init(203, "MONK"); - _vocabulary[237].init(204, "BARMAN"); - _vocabulary[238].init(204, "BARTENDER"); - - // Prepositions: 225-249 - _vocabulary[239].init(225, "TO"); - _vocabulary[240].init(226, "AT"); - _vocabulary[241].init(227, "UP"); - _vocabulary[242].init(228, "INTO"); - _vocabulary[243].init(228, "INSIDE"); - _vocabulary[244].init(229, "OFF"); - _vocabulary[245].init(230, "UP"); - _vocabulary[246].init(231, "DOWN"); - _vocabulary[247].init(232, "ON"); - - // Please: 251 - _vocabulary[248].init(251, "PLEASE"); - - // About: 252 - _vocabulary[249].init(252, "ABOUT"); - _vocabulary[250].init(252, "CONCERNING"); - - // Swear words: 253 - /* I M P O R T A N T M E S S A G E - - DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE - DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. - GOODNESS KNOWS WHO WROTE THEM. - READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. - WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ - _vocabulary[251].init(253, "SHIT"); - _vocabulary[252].init(28 , "PISS"); - _vocabulary[253].init(28 , "PEE"); - _vocabulary[254].init(253, "FART"); - _vocabulary[255].init(253, "FUCK"); - _vocabulary[256].init(253, "BALLS"); - _vocabulary[257].init(253, "BLAST"); - _vocabulary[258].init(253, "BUGGER"); - _vocabulary[259].init(253, "KNICKERS"); - _vocabulary[260].init(253, "BLOODY"); - _vocabulary[261].init(253, "HELL"); - _vocabulary[262].init(253, "DAMN"); - _vocabulary[263].init(253, "SMEG"); - // ...and other even ruder words. You didn't read them, did you? Good. - - // Answer-back smart-alec words: 249 - _vocabulary[264].init(249, "YES"); - _vocabulary[265].init(249, "NO"); - _vocabulary[266].init(249, "BECAUSE"); - - // Noise words: 255 - _vocabulary[267].init(255, "THE"); - _vocabulary[268].init(255, "A"); - _vocabulary[269].init(255, "NOW"); - _vocabulary[270].init(255, "SOME"); - _vocabulary[271].init(255, "AND"); - _vocabulary[272].init(255, "THAT"); - _vocabulary[273].init(255, "POCUS"); - _vocabulary[274].init(255, "HIS"); - _vocabulary[275].init(255, "THIS"); - _vocabulary[276].init(255, "SENTINEL"); // for "Ken SENT Me" -} - -void Acci::clearWords() { - for (int i = 0; i < 11; i++) { - if (!_realWords[i].empty()) - _realWords[i].clear(); - } -} - -byte Acci::wordNum(Common::String word) { - if (word.empty()) - return 0; - - for (int32 i = kParserWordsNum - 1; i >= 0; i--) { - if (_vocabulary[i]._word == word) - return _vocabulary[i]._number; - } - - // If not found as a whole, we look for it as a substring. - for (int32 i = kParserWordsNum - 1; i >= 0; i--) { - if (Common::String(_vocabulary[i]._word.c_str(), word.size()) == word) - return _vocabulary[i]._number; - } - - return kPardon; -} - -void Acci::replace(Common::String oldChars, byte newChar) { - int16 pos = _vm->_parser->pos(oldChars, _thats); - while (pos != -1) { - if (newChar == 0) - _thats.deleteChar(pos); - else { - for (uint i = pos; i < pos + oldChars.size(); i++) - _thats.deleteChar(pos); - _thats.insertChar(newChar, pos); - } - pos = _vm->_parser->pos(oldChars, _thats); - } -} - -Common::String Acci::rank() { - static const RankType kRanks[9] = { - {0, "Beginner"}, {10, "Novice"}, - {20, "Improving"}, {35, "Not bad"}, - {50, "Passable"}, {65, "Good"}, - {80, "Experienced"}, {108, "The BEST!"}, - {32767, "copyright'93"} - }; - - for (int i = 0; i < 8; i++) { - if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { - return kRanks[i]._title; - } - } - return ""; -} - -Common::String Acci::totalTime() { - // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. - const double ticksInOneSec = (double)(65535) / 3600; - uint16 h, m, s; - - h = floor(_vm->_gyro->_totalTime / ticksInOneSec); // No. of seconds. - m = h % 3600; - h /= 3600; - s = m % 60; - m /= 60; - - Common::String result = "You've been playing for "; - if (h > 0) - result += Common::String::format("%d hours, ", h); - if ((m > 0) || (h != 0)) - result = Common::String::format("%d minutes and ", m); - return result + Common::String::format("%d seconds", s); -} - -void Acci::cheatParse(Common::String codes) { - warning("STUB: Acci::cheatParse()"); -} - - - -void Acci::stripPunctuation(Common::String &word) { - const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - - for (int i = 0; i < 32; i++) { - for (;;) { - int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); - if (pos == -1) - break; - word.deleteChar(pos); - } - } -} - -void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { - if (target == kPardon) { - ambiguous = true; - if (animate) - _vm->_dialogs->displayText("Whom?"); - else - _vm->_dialogs->displayText("What?"); - } else { - if (animate) { - Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); - _vm->_dialogs->displayText(tmpStr); - } else { - Common::String z = _vm->_gyro->getItem(target); - if (z != "") { - Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); - _vm->_dialogs->displayText(tmpStr); - } - } - } -} - -bool Acci::doPronouns() { - bool ambiguous = false; - - for (uint i = 0; i < _thats.size(); i++) { - byte wordCode = _thats[i]; - switch (wordCode) { - case 200: - displayWhat(_vm->_gyro->_him, true, ambiguous); - _thats.setChar(_vm->_gyro->_him, i); - break; - case 201: - displayWhat(_vm->_gyro->_her, true, ambiguous); - _thats.setChar(_vm->_gyro->_her, i); - break; - case 202: - displayWhat(_vm->_gyro->_it, false, ambiguous); - _thats.setChar(_vm->_gyro->_it, i); - break; - } - } - - return ambiguous; -} - -void Acci::properNouns() { - _vm->_parser->_inputText.toLowercase(); - - // We set every word's first character to uppercase. - for (uint i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { - if (_vm->_parser->_inputText[i] == ' ') - _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); - } - - // And the first character as well. - _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); -} - -void Acci::sayIt() { - Common::String x = _vm->_parser->_inputText; - x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), - Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); - _vm->_dialogs->displayText(tmpStr); -} - -void Acci::storeInterrogation(byte interrogation) { - if (_vm->_parser->_inputText.empty()) - return; - - // Strip _vm->_parser->_inputText: - while ((_vm->_parser->_inputText[0] == ' ') && (!_vm->_parser->_inputText.empty())) - _vm->_parser->_inputText.deleteChar(0); - while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty())) - _vm->_parser->_inputText.deleteLastChar(); - - _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. - - switch (interrogation) { - case 1: - _vm->_parser->_inputText.toLowercase(); - sayIt(); - _vm->_gyro->_favouriteDrink = _vm->_parser->_inputText; - _vm->_gyro->_cardiffQuestionNum = 2; - break; - case 2: - properNouns(); - sayIt(); - _vm->_gyro->_favouriteSong = _vm->_parser->_inputText; - _vm->_gyro->_cardiffQuestionNum = 3; - break; - case 3: - properNouns(); - sayIt(); - _vm->_gyro->_worstPlaceOnEarth = _vm->_parser->_inputText; - _vm->_gyro->_cardiffQuestionNum = 4; - break; - case 4: - _vm->_parser->_inputText.toLowercase(); - sayIt(); - if (!_vm->_gyro->_spareEvening.empty()) - _vm->_gyro->_spareEvening.clear(); - _vm->_gyro->_spareEvening = _vm->_parser->_inputText; - _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... - _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge - _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! - _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_cardiffQuestionNum = 5; - break; - case 99: - //store_high(_vm->_parser->_inputText); - warning("STUB: Acci::store_interrogation()"); - break; - } - - if (interrogation < 4) - _vm->_timer->cardiffSurvey(); -} - - - -void Acci::parse() { - // First parsing - word identification - if (!_thats.empty()) - _thats.clear(); - - byte n = 0; - _polite = false; - _verb = kPardon; - _thing = kPardon; - _thing2 = kPardon; - _person = kPardon; - clearWords(); - - - // A cheat mode attempt. - if (_vm->_parser->_inputText[0] == '.') { - cheatParse(_vm->_parser->_inputText); - _thats = kNothing; - return; - } - - // Are we being interrogated right now? - if (_vm->_gyro->_interrogation > 0) { - storeInterrogation(_vm->_gyro->_interrogation); - _vm->_gyro->_weirdWord = true; - return; - } - - // Actually process the command. - Common::String inputText = _vm->_parser->_inputText + ' '; - Common::String inputTextUpper = inputText; - inputTextUpper.toUppercase(); - while (!inputTextUpper.empty()) { - while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) { - inputTextUpper.deleteChar(0); - inputText.deleteChar(0); - } - if (inputTextUpper.empty()) - break; - - // Get the following word of the strings. - byte size = _vm->_parser->pos(Common::String(' '), inputTextUpper) + 1; - char *subStr = new char[size]; - Common::strlcpy(subStr, inputTextUpper.c_str(), size); - Common::String thisword = subStr; - Common::strlcpy(subStr, inputText.c_str(), size); - _realWords[n] = subStr; - delete[] subStr; - - stripPunctuation(inputTextUpper); - - bool notfound = true; - - // Check also[] first, which contains words about the actual room. - if (!thisword.empty()) { - for (int i = 0; i < 31; i++) { - if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { - _thats += Common::String(99 + i); - notfound = false; - } - } - } - - // Check Accis's own table (words[]) for "global" commands. - if (notfound) { - byte answer = wordNum(thisword); - if (answer == kPardon) { - notfound = true; - _thats = _thats + kPardon; - } else - _thats = _thats + answer; - n++; - } - - // Delete words we already processed. - int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); - if (spacePos > -1) { - for (int i = 0; i <= spacePos; i++) - inputTextUpper.deleteChar(0); - } - - spacePos = _vm->_parser->pos(Common::String(' '), inputText); - if (spacePos > -1) { - for (int i = 0; i <= spacePos; i++) - inputText.deleteChar(0); - } - } - - Common::String unkString; - int16 pos = _vm->_parser->pos(Common::String('\xFE'), _thats); - if (pos > -1) - unkString = _realWords[pos]; - else - unkString.clear(); - - // Replace words' codes that mean the same. - replace(Common::String("\xFF"), 0); // zap noise words - replace(Common::String("\xD\xE2"), 1); // "look at" = "examine" - replace(Common::String("\xD\xE4"), 1); // "look in" = "examine" - replace(Common::String("\x4\xE6"), 17); // "get up" = "stand" - replace(Common::String("\x4\xE7"), 17); // "get down" = "stand"... well, why not? - replace(Common::String("\x12\xE4"), 2); // "go in" = "open [door]" - replace(Common::String("\x1C\xE5"), 253); // "P' off" is a swear word - replace(Common::String("\x4\x6"), 6); // "Take inventory" (remember Colossal Adventure?) - replace(Common::String("\x28\xE8"), 21); // "put on" = "don" - replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" - - // Words that could mean more than one _person - if (_vm->_gyro->_room == kRoomNottsPub) - replace(Common::String('\xCC'), 164); // Barman = Port - else - replace(Common::String('\xCC'), 154); // Barman = Malagauche - - switch (_vm->_gyro->_room) { - case kRoomAylesOffice: - replace(Common::String('\xCB'), 163); // Monk = Ayles - break; - case kRoomMusicRoom: - replace(Common::String('\xCB'), 166); // Monk = Jacques - break; - default: - replace(Common::String('\xCB'), 162); // Monk = Ibythneth - } - - if (doPronouns()) { - _vm->_gyro->_weirdWord = true; - _thats = kNothing; - return; - } - - // Second parsing. - if (!_vm->_gyro->_subject.empty()) - _vm->_gyro->_subject.clear(); - _vm->_gyro->_subjectNum = 0; // Find subject of conversation. - - for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { - if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { - _vm->_gyro->_subjectNum = (byte)_thats[i]; - _thats.setChar(kMoved, i); - break; - } - } - - if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found. - for (uint16 i = 0; i < _thats.size() - 1; i++) { - if ((byte)_thats[i] == 252) { // The word is "about", or something similar. - _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; - _thats.setChar(0, i + 1); - break; - } - } - } - - if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". - for (uint16 i = 0; i < _thats.size() - 1; i++) { - if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { - // SAY not followed by a preposition - _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; - _thats.setChar(0, i + 1); - break; - } - } - } - - for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. - if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) - _verb = (byte)_thats[i]; - else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { - _thing2 = _thing; - _thing = (byte)_thats[i]; - } else if ((150 <= (byte)_thats[i]) && ((byte)_thats[i] <= 199)) - _person = (byte)_thats[i]; - else if ((byte)_thats[i] == 251) - _polite = true; - } - - if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); - _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_weirdWord = true; - } else - _vm->_gyro->_weirdWord = false; - - if (_thats.empty()) - _thats = kNothing; - - if (_thing != kPardon) - _vm->_gyro->_it = _thing; - - if (_person != kPardon) { - if (_person < Gyro::kPeopleArkata) - _vm->_gyro->_him = _person; - else - _vm->_gyro->_her = _person; - } -} - -void Acci::examineObject() { - if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkAbout(_thing, Gyro::kThing); - switch (_thing) { - case Gyro::kObjectWine : - switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. - case 1: - _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll - break; - case 2: - _vm->_dialogs->displayScrollChain('d', 6); // Bad wine - break; - case 3: - _vm->_dialogs->displayScrollChain('d', 7); // Vinegar - break; - } - break; - case Gyro::kObjectOnion: - if (_vm->_gyro->_rottenOnion) - _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion - else - _vm->_dialogs->displayScrollChain('t', 18); // Normal onion - break; - default: - _vm->_dialogs->displayScrollChain('t', _thing); // Ordinarily - } -} - -bool Acci::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_room)) - return true; - else { - Common::String tmpStr; - if (_person < Gyro::kPeopleArkata) - tmpStr = "He isn't around at the moment."; - else - tmpStr = "She isn't around at the moment."; - _vm->_dialogs->displayText(tmpStr); - return false; - } -} - -void Acci::exampers() { - if (isPersonHere()) { - if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); - - byte newPerson = _person - 149; - - if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) - _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" - else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) - _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. - else - _vm->_dialogs->displayScrollChain('p', newPerson); - - if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) - _vm->_dialogs->displayScrollChain('Q', 13); - - _person = newPerson; - } -} - -/** - * Return whether Avvy is holding an object or not - * @remarks Originally called 'holding' - */ -bool Acci::isHolding() { - if ((51 <= _thing) && (_thing <= 99)) // Also. - return true; - - bool holdingResult = false; - - if (_thing > 100) - _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. - _vm->_dialogs->displayText("You're not holding it, Avvy."); - else - holdingResult = true; - - return holdingResult; -} - -void Acci::openBox(bool isOpening) { - if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); - - _vm->_background->updateBackgroundSprites(); - _vm->_animation->animLink(); - _vm->_graphics->refreshScreen(); - - _vm->_system->delayMillis(55); - - if (!isOpening) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); - _vm->_background->updateBackgroundSprites(); - _vm->_animation->animLink(); - _vm->_graphics->refreshScreen(); - } - } -} - -void Acci::examine() { - // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. - if ((_person == kPardon) && (_thing != kPardon)) { - if (isHolding()) { - // Remember: it's been slipped! Ie subtract 49. - if ((1 <= _thing) && (_thing <= 49)) // Standard object - examineObject(); - else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing - openBox(true); - _vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); - openBox(false); - } - } - } else if (_person != kPardon) - exampers(); - else - _vm->_dialogs->displayText("It's just as it looks on the picture."); // Don't know: guess. -} - -void Acci::inventory() { - byte itemNum = 0; - Common::String tmpStr = Common::String("You're carrying "); - - for (int i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_objects[i]) { - itemNum++; - if (itemNum == _vm->_gyro->_carryNum) - tmpStr += "and "; - - tmpStr += _vm->_gyro->getItem(i + 1); - - if ((i + 1) == _vm->_gyro->_wearing) - tmpStr += ", which you're wearing"; - - if (itemNum < _vm->_gyro->_carryNum) - tmpStr += ", "; - } - } - - if (_vm->_gyro->_wearing == kNothing) - tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); - else - tmpStr += '.'; - - _vm->_dialogs->displayText(tmpStr); -} - -void Acci::swallow() { // Eat something. - switch (_thing) { - case Gyro::kObjectWine: - switch (_vm->_gyro->_wineState) { // 4 is perfect - case 1: - if (_vm->_gyro->_teetotal) { - _vm->_dialogs->displayScrollChain('D', 6); - return; - } - _vm->_dialogs->displayScrollChain('U', 1); - _vm->_pingo->wobble(); - _vm->_dialogs->displayScrollChain('U', 2); - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - _vm->_lucerna->refreshObjectList(); - drink(); - break; - case 2: - case 3: - _vm->_dialogs->displayScrollChain('d', 8); - break; // You can't drink it! - } - break; - case Gyro::kObjectPotion: - _vm->_gyro->setBackgroundColor(4); - _vm->_dialogs->displayScrollChain('U', 3); - _vm->_lucerna->gameOver(); - _vm->_gyro->setBackgroundColor(0); - break; - case Gyro::kObjectInk: - _vm->_dialogs->displayScrollChain('U', 4); - break; - case Gyro::kObjectChastity: - _vm->_dialogs->displayScrollChain('U', 5); - break; - case Gyro::kObjectMushroom: - _vm->_dialogs->displayScrollChain('U', 6); - _vm->_lucerna->gameOver(); - break; - case Gyro::kObjectOnion: - if (_vm->_gyro->_rottenOnion) - _vm->_dialogs->displayScrollChain('U', 11); - else { - _vm->_dialogs->displayScrollChain('U', 8); - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; - _vm->_lucerna->refreshObjectList(); - } - break; - default: - if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) - _vm->_dialogs->displayText("Try BUYing things before you drink them!"); - else - _vm->_dialogs->displayText("The taste of it makes you retch!"); - } -} - -void Acci::peopleInRoom() { - byte numPeople = 0; // Number of people in the room. - - for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) - numPeople++; - } - - if (numPeople == 0) // If nobody's here, we can cut out straight away. - return; - - Common::String tmpStr; - byte actPerson = 0; // Actually listed people. - for (int i = 1; i < 29; i++) { - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { - actPerson++; - if (actPerson == 1) // First on the list. - tmpStr = _vm->_gyro->getName(i + 150); - else if (actPerson < numPeople) // The middle... - tmpStr += ", " + _vm->_gyro->getName(i + 150); - else // The end. - tmpStr += " and " + _vm->_gyro->getName(i + 150); - } - } - - if (numPeople == 1) - tmpStr += " is"; - else - tmpStr += " are"; - - _vm->_dialogs->displayText(tmpStr + " here."); // End and display it. -} - -void Acci::lookAround() { - _vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); - switch (_vm->_gyro->_room) { - case kRoomSpludwicks: - if (_vm->_gyro->_avariciusTalk > 0) - _vm->_dialogs->displayScrollChain('q', 23); - else - peopleInRoom(); - break; - case kRoomRobins: - if (_vm->_gyro->_tiedUp) - _vm->_dialogs->displayScrollChain('q', 38); - if (_vm->_gyro->_mushroomGrowing) - _vm->_dialogs->displayScrollChain('q', 55); - break; - case kRoomInsideCardiffCastle: - if (!_vm->_gyro->_takenPen) - _vm->_dialogs->displayScrollChain('q', 49); - break; - case kRoomLustiesRoom: - if (_vm->_gyro->_lustieIsAsleep) - _vm->_dialogs->displayScrollChain('q', 65); - break; - case kRoomCatacombs: - switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { - case 258 : - _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. - break; - case 514 : - _vm->_dialogs->displayScrollChain('q', 81); // Outside ditto. - break; - case 260 : - _vm->_dialogs->displayScrollChain('q', 82); // Outside Geida's room. - break; - } - break; - default: - peopleInRoom(); - } -} - -void Acci::openDoor() { - // Special cases. - switch (_vm->_gyro->_room) { - case kRoomYours: - if (_vm->_animation->inField(1)) { - // Opening the box. - _thing = 54; // The box. - _person = kPardon; - examine(); - return; - } - break; - case kRoomSpludwicks: - if (_thing == 61) { - _vm->_dialogs->displayScrollChain('q', 85); - return; - } - break; - } - - if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) - return; // No doors can open if you can't move Avvy. - - for (int i = 0; i < 7; i++) { - if (_vm->_animation->inField(i + 8)) { - MagicType *portal = &_vm->_gyro->_portals[i]; - switch (portal->_operation) { - case Gyro::kMagicExclaim: - _vm->_animation->_sprites[0].bounce(); - _vm->_dialogs->displayScrollChain('x', portal->_data); - break; - case Gyro::kMagicTransport: - _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); - break; - case Gyro::kMagicUnfinished: - _vm->_animation->_sprites[0].bounce(); - _vm->_dialogs->displayText("Sorry. This place is not available yet!"); - break; - case Gyro::kMagicSpecial: - _vm->_animation->callSpecial(portal->_data); - break; - case Gyro::kMagicOpenDoor: - _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); - break; - } - - return; - } - } - - if (_vm->_gyro->_room == kRoomMap) - _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ - "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); - else - _vm->_dialogs->displayText("Door? What door?"); -} - -void Acci::silly() { - _vm->_dialogs->displayText("Don't be silly!"); -} - -void Acci::putProc() { - if (!isHolding()) - return; - - _thing2 -= 49; // Slip the second object. - char temp = _thing; - _thing = _thing2; - if (!isHolding()) - return; - _thing = temp; - - // Thing is the _thing which you're putting in. _thing2 is where you're putting it. - switch (_thing2) { - case Gyro::kObjectWine: - if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_rottenOnion) - _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); - else { // Put onion into wine? - if (_vm->_gyro->_wineState != 3) { - Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); - _vm->_dialogs->displayText(tmpStr); - } else { // Put onion into vinegar! Yes! - _vm->_gyro->_onionInVinegar = true; - _vm->_lucerna->incScore(7); - _vm->_dialogs->displayScrollChain('u', 9); - } - } - } else - silly(); - break; - - case 54: - if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. - if (_vm->_gyro->_boxContent != kNothing) - _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); - else { - switch (_thing) { - case Gyro::kObjectMoney: - _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); - break; - case Gyro::kObjectBell: - _vm->_dialogs->displayText("That's a silly place to keep a bell."); - break; - case Gyro::kObjectBodkin: - _vm->_dialogs->displayText("But you might need it!"); - break; - case Gyro::kObjectOnion: - _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); - break; - default: // Put the object into the box... - if (_vm->_gyro->_wearing == _thing) { - Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); - _vm->_dialogs->displayText(tmpStr); - } else { - openBox(true); // Open box. - - _vm->_gyro->_boxContent = _thing; - _vm->_gyro->_objects[_thing - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_dialogs->displayText("OK, it's in the box."); - - openBox(false); // Shut box. - } - } - } - } else - silly(); - break; - - default: - silly(); - } -} - -/** - * Display text when ingredients are not in the right order - * @remarks Originally called 'not_in_order' - */ -void Acci::notInOrder() { - Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); - Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ - "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); -} - -/** - * Move Spludwick to cauldron - * @remarks Originally called 'go_to_cauldron' - */ -void Acci::goToCauldron() { - _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. - _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); - _vm->_animation->_sprites[1].walkTo(1); -} - -/** - * Check is it's possible to give something to Spludwick - * @remarks Originally called 'give2spludwick' - */ -bool Acci::giveToSpludwick() { - if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick] != _thing) { - notInOrder(); - return false; - } - - switch (_thing) { - case Gyro::kObjectOnion: - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; - if (_vm->_gyro->_rottenOnion) - _vm->_dialogs->displayScrollChain('q', 22); - else { - _vm->_gyro->_givenToSpludwick++; - _vm->_dialogs->displayScrollChain('q', 20); - goToCauldron(); - _vm->_lucerna->incScore(3); - } - _vm->_lucerna->refreshObjectList(); - break; - case Gyro::kObjectInk: - _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_givenToSpludwick++; - _vm->_dialogs->displayScrollChain('q', 24); - goToCauldron(); - _vm->_lucerna->incScore(3); - break; - case Gyro::kObjectMushroom: - _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; - _vm->_dialogs->displayScrollChain('q', 25); - _vm->_lucerna->incScore(5); - _vm->_gyro->_givenToSpludwick++; - goToCauldron(); - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; - _vm->_lucerna->refreshObjectList(); - break; - default: - return true; - } - - return false; -} - -void Acci::drink() { - _vm->_gyro->_alcoholLevel += 1; - if (_vm->_gyro->_alcoholLevel == 5) { - _vm->_gyro->_objects[Gyro::kObjectKey - 1] = true; // Get the key. - _vm->_gyro->_teetotal = true; - _vm->_gyro->_avvyIsAwake = false; - _vm->_gyro->_avvyInBed = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->dusk(); - _vm->_gyro->hangAroundForAWhile(); - _vm->_animation->flipRoom(1, 1); - _vm->_gyro->setBackgroundColor(14); - _vm->_animation->_sprites[0]._visible = false; - } -} - -void Acci::cardiffClimbing() { - if (_vm->_gyro->_standingOnDais) { // Clamber up. - _vm->_dialogs->displayText("You climb down, back onto the floor."); - _vm->_gyro->_standingOnDais = false; - _vm->_animation->appearPed(0, 2); - } else if (_vm->_animation->inField(0)) { // Clamber down - _vm->_dialogs->displayText("You clamber up onto the dais."); - _vm->_gyro->_standingOnDais = true; - _vm->_animation->appearPed(0, 1); - } else - _vm->_dialogs->displayText("Get a bit closer, Avvy."); -} - -void Acci::already() { - _vm->_dialogs->displayText("You're already standing!"); -} - -void Acci::standUp() { - switch (_vm->_gyro->_room) { - case kRoomYours: // Avvy isn't asleep. - if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. - if (_vm->_gyro->_teetotal) { - _vm->_dialogs->displayScrollChain('d', 12); - _vm->_gyro->setBackgroundColor(0); - _vm->_dialogs->displayScrollChain('d', 14); - } - _vm->_animation->_sprites[0]._visible = true; - _vm->_gyro->_userMovesAvvy = true; - _vm->_animation->appearPed(0, 1); - _vm->_animation->_direction = Animation::kDirLeft; - _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. - _vm->_lucerna->incScore(1); - _vm->_gyro->_avvyInBed = false; - _vm->_timer->loseTimer(Timer::kReasonArkataShouts); - } else - already(); - break; - - case kRoomInsideCardiffCastle: - cardiffClimbing(); - break; - - case kRoomNottsPub: - if (_vm->_gyro->_sittingInPub) { - _vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down. - _vm->_animation->_sprites[0]._visible = true; // But standing up. - _vm->_animation->appearPed(0, 3); // And walking away. - _vm->_gyro->_sittingInPub = false; // Really not sitting down. - _vm->_gyro->_userMovesAvvy = true; // And ambulant. - } else - already(); - break; - default: - already(); - } -} - -void Acci::getProc(char thing) { - switch (_vm->_gyro->_room) { - case kRoomYours: - if (_vm->_animation->inField(1)) { - if (_vm->_gyro->_boxContent == thing) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); - _vm->_dialogs->displayText("OK, I've got it."); - _vm->_gyro->_objects[thing - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_boxContent = kNothing; - _vm->_background->drawBackgroundSprite(-1, -1, 5); - } else { - Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); - _vm->_dialogs->displayText(tmpStr); - } - } else - _vm->_dialogs->displayScrollChain('q', 57); - break; - case kRoomInsideCardiffCastle: - switch (thing) { - case Gyro::kObjectPen: - if (_vm->_animation->inField(1)) { // Standing on the dais. - if (_vm->_gyro->_takenPen) - _vm->_dialogs->displayText("It's not there, Avvy."); - else { - // OK: we're taking the pen, and it's there. - _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. - _vm->_animation->callSpecial(3); // Zap! - _vm->_gyro->_takenPen = true; - _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_dialogs->displayText("Taken."); - } - } else if (_vm->_gyro->_standingOnDais) - _vm->_dialogs->displayScrollChain('q', 53); - else - _vm->_dialogs->displayScrollChain('q', 51); - break; - case Gyro::kObjectBolt: - _vm->_dialogs->displayScrollChain('q', 52); - break; - default: - _vm->_dialogs->displayScrollChain('q', 57); - } - break; - case kRoomRobins: - if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_dialogs->displayText("Got it!"); - _vm->_gyro->_mushroomGrowing = false; - _vm->_gyro->_takenMushroom = true; - _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(3); - } else - _vm->_dialogs->displayScrollChain('q', 57); - break; - default: - _vm->_dialogs->displayScrollChain('q', 57); - } -} - -/** - * Give the lute to Geida - * @remarks Originally called 'give_Geida_the_lute' - */ -void Acci::giveGeidaTheLute() { - if (_vm->_gyro->_room != kRoomLustiesRoom) { - Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - return; - } - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_dialogs->displayScrollChain('q', 64); // She plays it. - - _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); - //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! -} - -void Acci::playHarp() { - if (_vm->_animation->inField(6)) - _vm->_dialogs->displayMusicalScroll(); - else - _vm->_dialogs->displayText("Get a bit closer to it, Avvy!"); -} - -void Acci::winSequence() { - _vm->_dialogs->displayScrollChain('q', 78); - _vm->_sequence->firstShow(7); - _vm->_sequence->thenShow(8); - _vm->_sequence->thenShow(9); - _vm->_sequence->startToClose(); - _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); -} - -Common::String Acci::personSpeaks() { - if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_room)) - _person = _vm->_gyro->_her; - else - _person = _vm->_gyro->_him; - } - - if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { - return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! - } - - bool found = false; // The _person we're looking for's code is in _person. - Common::String tmpStr; - - for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, '1' + i); - found = true; - } - } - - if (found) - return tmpStr; - - for (int i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) - tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); - } - - return tmpStr; -} - -void Acci::heyThanks() { - Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_objects[_thing - 1] = false; -} - -/** - * @remarks Originally called 'do_that' - */ -void Acci::doThat() { - static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; - static const char kWhat[] = "That's not possible!"; - - if (_thats == Common::String(kNothing)) { - if (!_thats.empty()) - _thats.clear(); - return; - } - - if (_vm->_gyro->_weirdWord) - return; - - if (_thing < 200) - _thing -= 49; // "Slip" - - - if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) - && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) - && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_gyro->_alive) { - _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); - return; - } - if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); - return; - } - } - - switch (_verb) { - case kVerbCodeExam: - examine(); - break; - case kVerbCodeOpen: - openDoor(); - break; - case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); - _vm->_dialogs->displayText(tmpStr); - } - break; - case kVerbCodeGet: - if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_dialogs->displayText("You can't carry any more!"); - else - getProc(_thing); - } else { // Not... ditto. - if (_person != kPardon) - _vm->_dialogs->displayText("You can't sweep folk off their feet!"); - else - _vm->_dialogs->displayText("I assure you, you don't need it."); - } - break; - case kVerbCodeDrop: - _vm->_dialogs->displayText("Two years ago you dropped a florin in the street. Three days " \ - "later it was gone! So now you never leave ANYTHING lying around. OK?"); - break; - case kVerbCodeInv: - inventory(); - break; - case kVerbCodeTalk: - if (_person == kPardon) { - if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". - Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); - _vm->_dialogs->displayText(tmpStr); - } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { - _thats.deleteChar(0); - - for (int i = 0; i < 10; i++) - _realWords[i] = _realWords[i + 1]; - - _verb = _vm->_gyro->_subjectNum; - doThat(); - return; - } else { - _person = _vm->_gyro->_subjectNum; - _vm->_gyro->_subjectNum = 0; - if ((_person == 0) || (_person == kPardon)) - _vm->_dialogs->displayText("Talk to whom?"); - else if (isPersonHere()) - _vm->_dialogs->talkTo(_person); - } - } else if (isPersonHere()) - _vm->_dialogs->talkTo(_person); - break; - case kVerbCodeGive: - if (isHolding()) { - if (_person == kPardon) - _vm->_dialogs->displayText("Give to whom?"); - else if (isPersonHere()) { - switch (_thing) { - case Gyro::kObjectMoney : - _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); - break; - case Gyro::kObjectBodkin: - case Gyro::kObjectBell: - case Gyro::kObjectClothes: - case Gyro::kObjectHabit : - _vm->_dialogs->displayText("Don't give it away, it might be useful!"); - break; - default: - switch (_person) { - case Gyro::kPeopleCrapulus: - if (_thing == Gyro::kObjectWine) { - _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - } else - heyThanks(); - break; - case Gyro::kPeopleCwytalot: - if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) - _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); - else - heyThanks(); - break; - case Gyro::kPeopleSpludwick: - if (giveToSpludwick()) - heyThanks(); - break; - case Gyro::kPeopleIbythneth: - if (_thing == Gyro::kObjectBadge) { - _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! - _vm->_lucerna->incScore(3); - _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; - _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; - _vm->_gyro->_givenBadgeToIby = true; - _vm->_background->drawBackgroundSprite(-1, -1, 7); - _vm->_background->drawBackgroundSprite(-1, -1, 8); - } else - heyThanks(); - break; - case Gyro::kPeopleAyles: - if (_vm->_gyro->_aylesIsAwake) { - if (_thing == Gyro::kObjectPen) { - _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; - _vm->_dialogs->displayScrollChain('q', 54); - _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; - _vm->_gyro->_givenPenToAyles = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(2); - } else - heyThanks(); - } else - _vm->_dialogs->displayText("But he's asleep!"); - break; - case Gyro::kPeopleGeida: - switch (_thing) { - case Gyro::kObjectPotion: - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; - _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. - _vm->_lucerna->incScore(2); - _vm->_gyro->_givenPotionToGeida = true; - _vm->_lucerna->refreshObjectList(); - break; - case Gyro::kObjectLute: - giveGeidaTheLute(); - break; - default: - heyThanks(); - } - break; - case Gyro::kPeopleArkata: - switch (_thing) { - case Gyro::kObjectPotion: - if (_vm->_gyro->_givenPotionToGeida) - winSequence(); - else - _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! - break; - default: - heyThanks(); - } - break; - default: - heyThanks(); - } - } - } - _vm->_lucerna->refreshObjectList(); // Just in case... - } - break; - - case kVerbCodeEat: - case kVerbCodeDrink: - if (isHolding()) - swallow(); - break; - - case kVerbCodeLoad: - break; - case kVerbCodeSave: - break; - // We don't handle these two because we use ScummVM's save/load system. - - case kVerbCodePay: - _vm->_dialogs->displayText("No money need change hands."); - break; - case kVerbCodeLook: - lookAround(); - break; - case kVerbCodeBreak: - _vm->_dialogs->displayText("Vandalism is prohibited within this game!"); - break; - case kVerbCodeQuit: // quit - if (!_polite) - _vm->_dialogs->displayText("How about a `please\", Avvy?"); - else { - Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); - if (_vm->_dialogs->displayQuestion(tmpStr)) - _vm->_gyro->_letMeOut = true; - } - break; - case kVerbCodeGo: - _vm->_dialogs->displayText("Just use the arrow keys to walk there."); - break; - case kVerbCodeInfo: { - _vm->_dialogs->_aboutBox = true; - - Common::String toDisplay; - for (int i = 0; i < 7; i++) - toDisplay += Dialogs::kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine - + "The medi\x91val descendant of" + Dialogs::kControlNewLine - + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; - _vm->_dialogs->displayText(toDisplay); - _vm->_dialogs->_aboutBox = false; - } - break; - case kVerbCodeUndress: - if (_vm->_gyro->_wearing == kNothing) - _vm->_dialogs->displayText("You're already stark naked!"); - else if (_vm->_gyro->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); - _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_wearing = kNothing; - _vm->_lucerna->refreshObjectList(); - } else - _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); - break; - case kVerbCodeWear: - if (isHolding()) { // Wear something. - switch (_thing) { - case Gyro::kObjectChastity: - // \? are used to avoid that ??! is parsed as a trigraph - _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); - break; - case Gyro::kObjectClothes: - case Gyro::kObjectHabit: { // Change this! - if (_vm->_gyro->_wearing != kNothing) { - if (_vm->_gyro->_wearing == _thing) - _vm->_dialogs->displayText("You're already wearing that."); - else - _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); - return; - } else - _vm->_gyro->_wearing = _thing; - - _vm->_lucerna->refreshObjectList(); - - byte i; - if (_thing == Gyro::kObjectHabit) - i = 3; - else - i = 0; - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; - if (spr->_id != i) { - int16 x = spr->_x; - int16 y = spr->_y; - spr->remove(); - spr->init(i, true, _vm->_animation); - spr->appear(x, y, Animation::kDirLeft); - spr->_visible = false; - } - } - break; - default: - _vm->_dialogs->displayText(kWhat); - } - } - break; - case kVerbCodePlay: - if (_thing == kPardon) { - switch (_vm->_gyro->_room) { // They just typed "play"... - case kRoomArgentPub: // ...in the pub, => play Nim. - warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); - // play_nim(); - // The following parts are copied from play_nim(). - // The player automatically wins the game everytime he wins, until I implement the mini-game. - - if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_dialogs->displayScrollChain('Q', 6); - return; - } - - if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_dialogs->displayScrollChain('q', 84); - return; - } - - _vm->_dialogs->displayScrollChain('Q', 3); - _vm->_gyro->_playedNim++; - - // You won - strange! - _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_wonNim = true; - _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. - _vm->_lucerna->incScore(7); // 7 points for winning! - - if (_vm->_gyro->_playedNim == 1) - _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. - - // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); - break; - case kRoomMusicRoom: - playHarp(); - break; - } - } else if (isHolding()) { - switch (_thing) { - case Gyro::kObjectLute : - _vm->_dialogs->displayScrollChain('U', 7); - - if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) - _vm->_dialogs->displayScrollChain('U', 10); - - if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) - _vm->_dialogs->displayScrollChain('U', 15); - break; - case 52: - if (_vm->_gyro->_room == kRoomMusicRoom) - playHarp(); - else - _vm->_dialogs->displayText(kWhat); - break; - case 55: - if (_vm->_gyro->_room == kRoomArgentPub) - // play_nim(); - warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); - else - _vm->_dialogs->displayText(kWhat); - break; - default: - _vm->_dialogs->displayText(kWhat); - } - } - break; - case kVerbCodeRing: - if (isHolding()) { - if (_thing == Gyro::kObjectBell) { - _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) - // \? are used to avoid that ??! is parsed as a trigraph - _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); - } else - _vm->_dialogs->displayText(kWhat); - } - break; - case kVerbCodeHelp: - // boot_help(); - warning("STUB: Acci::doThat() - case kVerbCodehelp"); - break; - case kVerbCodeLarrypass: - _vm->_dialogs->displayText("Wrong game!"); - break; - case kVerbCodePhaon: - _vm->_dialogs->displayText("Hello, Phaon!"); - break; - case kVerbCodeBoss: - // bosskey(); - warning("STUB: Acci::doThat() - case kVerbCodeboss"); - break; - case kVerbCodePee: - if (_vm->_gyro->setFlag('P')) { - _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); - _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); - } else { - Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Dialogs::kControlItalic, Dialogs::kControlRoman); - _vm->_dialogs->displayText(tmpStr); - } - break; - case kVerbCodeCheat: { - Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); - _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_cheat = true; - } - break; - case kVerbCodeMagic: - if (_vm->_gyro->_avariciusTalk > 0) - _vm->_dialogs->displayScrollChain('q', 19); - else { - if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! - _vm->_dialogs->displayScrollChain('q', 17); - if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) - _vm->_dialogs->displayScrollChain('q', 18); - else { - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->init(1, false, _vm->_animation); // Avaricius - _vm->_animation->appearPed(1, 3); - spr->walkTo(4); - spr->_callEachStepFl = true; - spr->_eachStepProc = Animation::kProcBackAndForth; - _vm->_gyro->_avariciusTalk = 14; - _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); - } - } else - _vm->_dialogs->displayText("Nothing appears to happen..."); - } - break; - case kVerbCodeSmartAlec: - _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); - break; - case kVerbCodeExpletive: - switch (_vm->_gyro->_sworeNum) { - case 0: { - Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ - "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); - _vm->_dialogs->displayText(tmpStr); - } - break; - case 1: { - Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ - "do things I tell you not to?%c%cDon't do it again!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); - _vm->_dialogs->displayText(tmpStr); - } - break; - default: { - _vm->_pingo->zonk(); - // CHECKME: Weird character in string - Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); - _vm->_dialogs->displayText(tmpStr); - _vm->_lucerna->gameOver(); - } - } - _vm->_gyro->_sworeNum++; - break; - case kVerbCodeListen: - if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) - _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); - else if (_vm->_gyro->_listen.empty()) - _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); - else - _vm->_dialogs->displayText(_vm->_gyro->_listen); - break; - case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_gyro->_room) { - case kRoomArgentPub: - if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. - switch (_thing) { - case 51: - case 53: - case 54: - case 58: // Beer, whisky, cider or mead. - if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_dialogs->displayScrollChain('D', 15); - return; - } - - if (_vm->_gyro->_teetotal) { - _vm->_dialogs->displayScrollChain('D', 6); - return; - } - - if (_vm->_gyro->_alcoholLevel == 0) - _vm->_lucerna->incScore(3); - - _vm->_background->drawBackgroundSprite(-1, -1, 11); - _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); - _vm->_gyro->_drinking = _thing; - - _vm->_background->drawBackgroundSprite(-1, -1, 9); - _vm->_gyro->_malagauche = 177; - _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); - break; - case 52: - examine(); - break; // We have a right one here - buy Pepsi??! - case Gyro::kObjectWine: - if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! - _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! - else { - if (_vm->_gyro->_malagauche == 177) { // Already getting us one. - _vm->_dialogs->displayScrollChain('D', 15); - return; - } - - if (_vm->_gyro->_carryNum >= kCarryLimit) { - _vm->_dialogs->displayText("Your hands are full."); - return; - } - - _vm->_background->drawBackgroundSprite(-1, -1, 11); - Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - if (_vm->_gyro->_alcoholLevel == 0) - _vm->_lucerna->incScore(3); - _vm->_background->drawBackgroundSprite(-1, -1, 9); - _vm->_gyro->_malagauche = 177; - - _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); - } - break; - } - } else - _vm->_dialogs->displayScrollChain('D', 5); // Go to the bar! - break; - - case kRoomOutsideDucks: - if (_vm->_animation->inField(5)) { - if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) - _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! - else if (_vm->_gyro->_carryNum >= kCarryLimit) - _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); - else { - if (_vm->_gyro->_boughtOnion) - _vm->_dialogs->displayScrollChain('D', 11); - else { - _vm->_dialogs->displayScrollChain('D', 9); - _vm->_lucerna->incScore(3); - } - _vm->_gyro->decreaseMoney(3); // It costs thruppence. - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_boughtOnion = true; - _vm->_gyro->_rottenOnion = false; // It's OK when it leaves the stall! - _vm->_gyro->_onionInVinegar = false; - } - } else - _vm->_dialogs->displayScrollChain('D', 0); - } else - _vm->_dialogs->displayScrollChain('D', 0); - break; - - case kRoomNottsPub: - _vm->_dialogs->displayScrollChain('n', 15); // Can't sell to southerners. - break; - default: - _vm->_dialogs->displayScrollChain('D', 0); // Can't buy that. - } - break; - case kVerbCodeAttack: - if ((_vm->_gyro->_room == kRoomBrummieRoad) && - ((_person == Gyro::kPeopleCwytalot) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && - (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { - switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { - // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. - case 0: - _vm->_dialogs->displayScrollChain('Q', 10); - _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); - break; - case 1: - _vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); - break; - case 2: - _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); - break; - case 3: - _vm->_dialogs->displayScrollChain('Q', 11); - _vm->_gyro->_cwytalotGone = true; - _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; - _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; - _vm->_lucerna->incScore(7); - _vm->_animation->_sprites[1].walkTo(1); - _vm->_animation->_sprites[1]._vanishIfStill = true; - _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; - break; - default: - _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! - } - } else - _vm->_dialogs->displayScrollChain('Q', 10); - break; - case kVerbCodePasswd: - if (_vm->_gyro->_room != kRoomBridge) - _vm->_dialogs->displayScrollChain('Q', 12); - else { - bool ok = true; - for (uint i = 0; i < _thats.size(); i++) { - Common::String temp = _realWords[i]; - temp.toUppercase(); - int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; - for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { - if (_vocabulary[pwdId]._word[j] != temp[j]) - ok = false; - } - } - - if (ok) { - if (_vm->_gyro->_drawbridgeOpen != 0) - _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); - else { - _vm->_lucerna->incScore(4); - _vm->_dialogs->displayText("The drawbridge opens!"); - _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); - _vm->_gyro->_drawbridgeOpen = 1; - } - } else - _vm->_dialogs->displayScrollChain('Q', 12); - } - break; - case kVerbCodeDir: - //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! - break; - case kVerbCodeDie: - _vm->_lucerna->gameOver(); - break; - case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); - _vm->_dialogs->displayText(tmpStr); - } - break; - case kVerbCodePut: - putProc(); - break; - case kVerbCodeStand: - standUp(); - break; - case kVerbCodeKiss: - if (_person == kPardon) - _vm->_dialogs->displayText("Kiss whom?"); - else if (isPersonHere()) { - switch (_person) { - case Gyro::kPeopleArkata: - _vm->_dialogs->displayScrollChain('U', 12); - break; - case Gyro::kPeopleGeida: - _vm->_dialogs->displayScrollChain('U', 13); - break; - case Gyro::kPeopleWisewoman: - _vm->_dialogs->displayScrollChain('U', 14); - break; - default: - _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? - } - } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) - _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); - - break; - case kVerbCodeClimb: - if (_vm->_gyro->_room == kRoomInsideCardiffCastle) - cardiffClimbing(); - else // In the wrong room! - _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); - break; - case kVerbCodeJump: - _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); - _vm->_gyro->_userMovesAvvy = false; - break; - case kVerbCodeHiscores: - // show_highs(); - warning("STUB: Acci::doThat() - case kVerbCodehighscores"); - break; - case kVerbCodeWake: - if (isPersonHere()) - switch (_person) { - case kPardon: - case Gyro::kPeopleAvalot: - case 0: - if (!_vm->_gyro->_avvyIsAwake) { - _vm->_gyro->_avvyIsAwake = true; - _vm->_lucerna->incScore(1); - _vm->_gyro->_avvyInBed = true; - _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. - if (_vm->_gyro->_teetotal) - _vm->_dialogs->displayScrollChain('d', 13); - } else - _vm->_dialogs->displayText("You're already awake, Avvy!"); - break; - case Gyro::kPeopleAyles: - if (!_vm->_gyro->_aylesIsAwake) - _vm->_dialogs->displayText("You can't seem to wake him by yourself."); - break; - case Gyro::kPeopleJacques: { - Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ - "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - } - break; - default: - _vm->_dialogs->displayText("It's difficult to awaken people who aren't asleep...!"); - } - break; - case kVerbCodeSit: - if (_vm->_gyro->_room == kRoomNottsPub) { - if (_vm->_gyro->_sittingInPub) - _vm->_dialogs->displayText("You're already sitting!"); - else { - _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. - _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); - } - } else { // Default doodah. - _vm->_lucerna->dusk(); - _vm->_gyro->hangAroundForAWhile(); - _vm->_lucerna->dawn(); - Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); - _vm->_dialogs->displayText(tmpStr); - } - break; - case kVerbCodeRestart: - if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { - _vm->_lucerna->dusk(); - _vm->_gyro->newGame(); - _vm->_lucerna->dawn(); - } - break; - case kPardon: - _vm->_dialogs->displayText("Hey, a verb would be helpful!"); - break; - case kVerbCodeHello: { - Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hello.%c", Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - } - break; - case kVerbCodeThanks: { - Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("That's OK.%c", Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - } - break; - default: - Common::String tmpStr = Common::String::format("%cParser bug!", Dialogs::kControlBell); - _vm->_dialogs->displayText(tmpStr); - } -} - -void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) { - switch (verb) { - case kVerbCodeExam: - answer = "Examine"; - ansKey = 'x'; - break; // The ubiquitous one. - // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. - case kVerbCodeDrink: - answer = "Drink"; - ansKey = 'D'; - break; - case kVerbCodeWear: - answer = "Wear"; - ansKey = 'W'; - break; - case kVerbCodeRing: - answer = "Ring"; - ansKey = 'R'; - break; // Only the bell! - case kVerbCodePlay: - answer = "Play"; - ansKey = 'P'; - break; - case kVerbCodeEat: - answer = "Eat"; - ansKey = 'E'; - break; - default: - answer = "? Unknown!"; // Bug! - ansKey = '?'; - } -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/acci.h b/engines/avalanche/acci.h deleted file mode 100644 index 07816cc772a1..000000000000 --- a/engines/avalanche/acci.h +++ /dev/null @@ -1,138 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* ACCIDENCE II The parser. */ - -#ifndef AVALANCHE_ACCI2_H -#define AVALANCHE_ACCI2_H - -#include "common/scummsys.h" -#include "common/str.h" - -namespace Avalanche { -class AvalancheEngine; - -class Acci { -public: - enum VerbCode { - kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, - kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, - kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, - kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, - kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, - kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, - kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, - kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, - kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, - kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 - }; - - static const byte kPardon = 254; // Didn't understand / wasn't given. - static const int16 kParserWordsNum = 277; // How many words does the parser know? - static const byte kNothing = 250; - static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.) - static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS". - - struct VocabEntry { - byte _number; - Common::String _word; - - void init(byte number, Common::String word) { - _number = number; - _word = word; - } - }; - - VocabEntry _vocabulary[kParserWordsNum]; - - Common::String _realWords[11]; - byte _verb, _person, _thing; - bool _polite; - - Acci(AvalancheEngine *vm); - - void init(); - void parse(); - void doThat(); - void verbOpt(byte verb, Common::String &answer, char &ansKey); - void drink(); - -private: - struct RankType { - uint16 _score; - Common::String _title; - }; - - Common::String _thats; - byte _thing2; - - AvalancheEngine *_vm; - - byte wordNum(Common::String word); - void replace(Common::String oldChars, byte newChar); - - Common::String rank(); - Common::String totalTime(); - - void clearWords(); - void cheatParse(Common::String codes); - void stripPunctuation(Common::String &word); // Strips punctuation from word. - void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective! - bool doPronouns(); - void properNouns(); - void lookAround(); // This is called when you say "look". - void sayIt(); // This makes Avalot say the response. - void openDoor(); - void storeInterrogation(byte interrogation); - void examineObject(); // Examine a standard object-thing - bool isPersonHere(); - void exampers(); - bool isHolding(); - void openBox(bool isOpening); - void examine(); - void inventory(); - void swallow(); - void peopleInRoom(); // This lists the other people in the room. - void silly(); - void putProc(); // Called when you call kVerbCodeput. - void notInOrder(); - void goToCauldron(); - bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!". - void cardiffClimbing(); - void already(); - void standUp(); // Called when you ask Avvy to stand. - void getProc(char thing); - void giveGeidaTheLute(); - void playHarp(); - void winSequence(); - Common::String personSpeaks(); - void heyThanks(); -}; - -} // End of namespace Avalanche. - -#endif // AVALANCHE_ACCI2_H diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 8fb28eda1522..d274591fde5c 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1232,7 +1232,7 @@ void Animation::stopWalking() { */ void Animation::hideInCupboard() { if (_vm->_gyro->_avvysInTheCupboard) { - if (_vm->_gyro->_wearing == Acci::kNothing) { + if (_vm->_gyro->_wearing == Parser::kNothing) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d7a07fe41df6..7dcf4a0e1f4f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -69,7 +69,6 @@ AvalancheEngine::~AvalancheEngine() { delete _sequence; delete _timer; delete _animation; - delete _acci; delete _menu; delete _closing; delete _gyro; @@ -89,7 +88,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _sequence = new Sequence(this); _timer = new Timer(this); _animation = new Animation(this); - _acci = new Acci(this); _menu = new Menu(this); _closing = new Closing(this); _sound = new SoundHandler(this); @@ -97,7 +95,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _graphics->init(); _dialogs->init(); _lucerna->init(); - _acci->init(); _parser->init(); return Common::kNoError; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 2a7df29a329e..781031c9c1ee 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -40,7 +40,6 @@ #include "avalanche/sequence.h" #include "avalanche/timer.h" #include "avalanche/animation.h" -#include "avalanche/acci.h" #include "avalanche/menu.h" #include "avalanche/closing.h" #include "avalanche/sound.h" @@ -76,7 +75,6 @@ class AvalancheEngine : public Engine { Sequence *_sequence; Timer *_timer; Animation *_animation; - Acci *_acci; Menu *_menu; Closing *_closing; SoundHandler *_sound; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index a496fcd177aa..69a398439ab8 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -32,7 +32,6 @@ #include "avalanche/gyro.h" #include "avalanche/lucerna.h" #include "avalanche/animation.h" -#include "avalanche/acci.h" #include "avalanche/timer.h" #include "common/textconsole.h" @@ -726,8 +725,8 @@ void Dialogs::callDialogDriver() { displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: { - int pwdId = _vm->_acci->kFirstPassword + _vm->_gyro->_passwordNum; - displayText(_vm->_acci->_vocabulary[pwdId]._word + kControlToBuffer); + int pwdId = _vm->_parser->kFirstPassword + _vm->_gyro->_passwordNum; + displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer); } break; case 3: @@ -750,12 +749,12 @@ void Dialogs::callDialogDriver() { case 10: switch (_vm->_gyro->_boxContent) { case 0: // Sixpence. - _vm->_dialogs->displayScrollChain('q', 37); // You find the sixpence. + displayScrollChain('q', 37); // You find the sixpence. _vm->_gyro->_money += 6; - _vm->_gyro->_boxContent = _vm->_acci->kNothing; + _vm->_gyro->_boxContent = _vm->_parser->kNothing; _vm->_lucerna->incScore(2); return; - case Acci::kNothing: + case Parser::kNothing: displayText("nothing at all. It's completely empty."); break; default: @@ -889,7 +888,7 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl if (error) { if (report) { Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Dialogs::kControlBell, block, point); - _vm->_dialogs->displayText(todisplay); + displayText(todisplay); } return; } @@ -907,7 +906,7 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl if (bubbling) doTheBubble(); - _vm->_dialogs->callDialogDriver(); + callDialogDriver(); } /** @@ -952,13 +951,13 @@ void Dialogs::speak(byte who, byte subject) { unSkrimble(); doTheBubble(); - _vm->_dialogs->callDialogDriver(); + callDialogDriver(); _noError = true; } void Dialogs::talkTo(byte whom) { - if (_vm->_acci->_person == _vm->_acci->kPardon) { - _vm->_acci->_person = _vm->_gyro->_subjectNum; + if (_vm->_parser->_person == _vm->_parser->kPardon) { + _vm->_parser->_person = _vm->_gyro->_subjectNum; _vm->_gyro->_subjectNum = 0; } @@ -979,7 +978,7 @@ void Dialogs::talkTo(byte whom) { case 2: { Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); + displayText(tmpStr); } return; case 3: @@ -1053,7 +1052,7 @@ void Dialogs::talkTo(byte whom) { for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, i + 49, Dialogs::kControlToBuffer); - _vm->_dialogs->displayText(tmpStr); + displayText(tmpStr); noMatches = false; break; } @@ -1061,7 +1060,7 @@ void Dialogs::talkTo(byte whom) { if (noMatches) { Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, Dialogs::kControlRegister, Dialogs::kControlToBuffer); - _vm->_dialogs->displayText(tmpStr); + displayText(tmpStr); } speak(whom, _vm->_gyro->_subjectNum); diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 3d86d34b38b3..99608399d8c1 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -32,7 +32,6 @@ #include "avalanche/pingo.h" #include "avalanche/dialogs.h" #include "avalanche/lucerna.h" -#include "avalanche/acci.h" #include "avalanche/animation.h" #include "common/file.h" @@ -332,10 +331,10 @@ void Gyro::newGame() { avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } - _him = Acci::kPardon; - _her = Acci::kPardon; - _it = Acci::kPardon; - _lastPerson = Acci::kPardon; // = Pardon? + _him = Parser::kPardon; + _her = Parser::kPardon; + _it = Parser::kPardon; + _lastPerson = Parser::kPardon; // = Pardon? _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; @@ -494,29 +493,29 @@ Common::String Gyro::f5Does() { switch (_room) { case kRoomYours: if (!_avvyIsAwake) - return Common::String::format("%cWWake up", Acci::kVerbCodeWake); + return Common::String::format("%cWWake up", Parser::kVerbCodeWake); else if (_avvyInBed) - return Common::String::format("%cGGet up", Acci::kVerbCodeStand); + return Common::String::format("%cGGet up", Parser::kVerbCodeStand); break; case kRoomInsideCardiffCastle: if (_standingOnDais) - return Common::String::format("%cCClimb down", Acci::kVerbCodeClimb); + return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb); else - return Common::String::format("%cCClimb up", Acci::kVerbCodeClimb); + return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb); break; case kRoomNottsPub: if (_sittingInPub) - return Common::String::format("%cSStand up", Acci::kVerbCodeStand); + return Common::String::format("%cSStand up", Parser::kVerbCodeStand); else - return Common::String::format("%cSSit down", Acci::kVerbCodeSit); + return Common::String::format("%cSSit down", Parser::kVerbCodeSit); break; case kRoomMusicRoom: if (_vm->_animation->inField(5)) - return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay); + return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay); break; } - return Common::String::format("%c", _vm->_acci->kPardon); // If all else fails... + return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails... } void Gyro::loadMouse(byte which) { diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 34ba7c11c111..88c13571a079 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -36,7 +36,6 @@ #include "avalanche/background.h" #include "avalanche/pingo.h" #include "avalanche/sequence.h" -#include "avalanche/acci.h" #include "common/rect.h" #include "common/system.h" @@ -144,16 +143,16 @@ void Lucerna::init() { * @remarks Originally called 'callverb' */ void Lucerna::callVerb(byte id) { - if (id == _vm->_acci->kPardon) { + if (id == _vm->_parser->kPardon) { Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ "what the current setting of this key is."); _vm->_dialogs->displayText(tmpStr); } else { _vm->_gyro->_weirdWord = false; - _vm->_acci->_polite = true; - _vm->_acci->_verb = id; - _vm->_acci->doThat(); + _vm->_parser->_polite = true; + _vm->_parser->_verb = id; + _vm->_parser->doThat(); } } @@ -1094,20 +1093,20 @@ void Lucerna::checkClick() { } while (_holdLeftMouse); if (_vm->_gyro->_thinkThing) { - _vm->_acci->_thing = _vm->_gyro->_thinks; - _vm->_acci->_thing += 49; - _vm->_acci->_person = _vm->_acci->kPardon; + _vm->_parser->_thing = _vm->_gyro->_thinks; + _vm->_parser->_thing += 49; + _vm->_parser->_person = _vm->_parser->kPardon; } else { - _vm->_acci->_person = _vm->_gyro->_thinks; - _vm->_acci->_thing = _vm->_acci->kPardon; + _vm->_parser->_person = _vm->_gyro->_thinks; + _vm->_parser->_thing = _vm->_parser->kPardon; } - callVerb(Acci::kVerbCodeExam); + callVerb(Parser::kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (_holdLeftMouse); - callVerb(Acci::kVerbCodeScore); + callVerb(Parser::kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index b786399815b2..64b3b97eca4f 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -31,7 +31,6 @@ #include "avalanche/menu.h" #include "avalanche/lucerna.h" #include "avalanche/gyro.h" -#include "avalanche/acci.h" #include "avalanche/animation.h" #include "common/textconsole.h" @@ -269,26 +268,26 @@ void Menu::findWhatYouCanDoWithIt() { case Gyro::kObjectWine: case Gyro::kObjectPotion: case Gyro::kObjectInk: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeDrink; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; break; case Gyro::kObjectBell: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeRing; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; break; case Gyro::kObjectChastity: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeWear; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; case Gyro::kObjectLute: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodePlay; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; break; case Gyro::kObjectMushroom: case Gyro::kObjectOnion: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeEat; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; break; case Gyro::kObjectClothes: - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeWear; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; default: - _vm->_gyro->_verbStr = Acci::kVerbCodeExam; // Anything else. + _vm->_gyro->_verbStr = Parser::kVerbCodeExam; // Anything else. } } @@ -483,33 +482,33 @@ void Menu::setupMenuWith() { char vbchar; Common::String verb; - _vm->_acci->verbOpt(_vm->_gyro->_verbStr[i], verb, vbchar); + _vm->_parser->verbOpt(_vm->_gyro->_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_acci->kNothing) + if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_parser->kNothing) || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeGive; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); - _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeTalk; + _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; switch (_vm->_gyro->_thinks) { case Gyro::kPeopleGeida: case Gyro::kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeKiss; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeKiss; break; case Gyro::kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodePlay; + _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodePlay; break; case Gyro::kPeopleMalagauche: { bool isSober = !_vm->_gyro->_teetotal; @@ -534,19 +533,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(Acci::kVerbCodeHelp); + _vm->_lucerna->callVerb(Parser::kVerbCodeHelp); break; case 1: - _vm->_lucerna->callVerb(Acci::kVerbCodeBoss); + _vm->_lucerna->callVerb(Parser::kVerbCodeBoss); break; case 2: _vm->_lucerna->majorRedraw(); break; case 3: - _vm->_lucerna->callVerb(Acci::kVerbCodeScore); + _vm->_lucerna->callVerb(Parser::kVerbCodeScore); break; case 4: - _vm->_lucerna->callVerb(Acci::kVerbCodeInfo); + _vm->_lucerna->callVerb(Parser::kVerbCodeInfo); break; } } @@ -555,17 +554,17 @@ void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(Acci::kVerbCodeRestart); + _vm->_lucerna->callVerb(Parser::kVerbCodeRestart); break; case 1: - if (!_vm->_acci->_realWords[1].empty()) - _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callVerb(Acci::kVerbCodeLoad); + if (!_vm->_parser->_realWords[1].empty()) + _vm->_parser->_realWords[1].clear(); + _vm->_lucerna->callVerb(Parser::kVerbCodeLoad); break; case 2: - if (!_vm->_acci->_realWords[1].empty()) - _vm->_acci->_realWords[1].clear(); - _vm->_lucerna->callVerb(Acci::kVerbCodeSave); + if (!_vm->_parser->_realWords[1].empty()) + _vm->_parser->_realWords[1].clear(); + _vm->_lucerna->callVerb(Parser::kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -575,7 +574,7 @@ void Menu::runMenuFile() { //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - _vm->_lucerna->callVerb(Acci::kVerbCodeQuit); + _vm->_lucerna->callVerb(Parser::kVerbCodeQuit); break; } } @@ -585,24 +584,24 @@ void Menu::runMenuAction() { // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_acci->_person = _vm->_acci->kPardon; - _vm->_acci->_thing = _vm->_acci->kPardon; + _vm->_parser->_person = _vm->_parser->kPardon; + _vm->_parser->_thing = _vm->_parser->kPardon; f5Does = _vm->_gyro->f5Does(); _vm->_lucerna->callVerb(f5Does[0]); break; case 1: - _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callVerb(Acci::kVerbCodePause); + _vm->_parser->_thing = _vm->_parser->kPardon; + _vm->_lucerna->callVerb(Parser::kVerbCodePause); break; case 2: - _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); + _vm->_lucerna->callVerb(Parser::kVerbCodeOpen); break; case 3: - _vm->_acci->_thing = _vm->_acci->kPardon; - _vm->_lucerna->callVerb(Acci::kVerbCodeLook); + _vm->_parser->_thing = _vm->_parser->kPardon; + _vm->_lucerna->callVerb(Parser::kVerbCodeLook); break; case 4: - _vm->_lucerna->callVerb(Acci::kVerbCodeInv); + _vm->_lucerna->callVerb(Parser::kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -626,44 +625,44 @@ void Menu::runMenuPeople() { } void Menu::runMenuWith() { - _vm->_acci->_thing = _vm->_gyro->_thinks; + _vm->_parser->_thing = _vm->_gyro->_thinks; if (_vm->_gyro->_thinkThing) { - _vm->_acci->_thing += 49; + _vm->_parser->_thing += 49; - if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive) - _vm->_acci->_person = _vm->_gyro->_lastPerson; + if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) + _vm->_parser->_person = _vm->_gyro->_lastPerson; else - _vm->_acci->_person = Acci::kPardon; + _vm->_parser->_person = Parser::kPardon; } else { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer - _vm->_acci->_thing = 100; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 100; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; case 101: // Wine - _vm->_acci->_thing = 50; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 50; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; case 102: // Whisky - _vm->_acci->_thing = 102; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 102; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; case 103: // Cider - _vm->_acci->_thing = 103; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 103; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; case 104: // Mead - _vm->_acci->_thing = 107; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 107; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; case 105: // Onion (trader) - _vm->_acci->_thing = 67; - _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); + _vm->_parser->_thing = 67; + _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); return; default: - _vm->_acci->_person = _vm->_acci->_thing; - _vm->_acci->_thing = Acci::kPardon; + _vm->_parser->_person = _vm->_parser->_thing; + _vm->_parser->_thing = Parser::kPardon; _vm->_gyro->_subjectNum = 0; } } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index f044a41071e3..541123f24f15 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -1,7 +1,6 @@ MODULE := engines/avalanche MODULE_OBJS = \ - acci.o \ animation.o \ avalanche.o \ avalot.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d341e7662625..29fadda330c8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -27,6 +27,19 @@ #include "avalanche/avalanche.h" #include "avalanche/parser.h" +#include "avalanche/gyro.h" +#include "avalanche/lucerna.h" +#include "avalanche/dialogs.h" +#include "avalanche/timer.h" +#include "avalanche/animation.h" +#include "avalanche/background.h" +#include "avalanche/pingo.h" +#include "avalanche/sequence.h" + +#include "common/textconsole.h" + +#include +#include namespace Avalanche { @@ -39,13 +52,330 @@ void Parser::init() { if (!_inputText.empty()) _inputText.clear(); _inputTextPos = 0; + + _vm->_gyro->_weirdWord = false; + + // Initailaze the vocabulary. + // Verbs: 1-49 + _vocabulary[0].init(1, "EXAMINE"); + _vocabulary[1].init(1, "READ"); + _vocabulary[2].init(1, "XAM"); + _vocabulary[3].init(2, "OPEN"); + _vocabulary[4].init(2, "LEAVE"); + _vocabulary[5].init(2, "UNLOCK"); + _vocabulary[6].init(3, "PAUSE"); + _vocabulary[7].init(47, "TA"); // Early to avoid Take and Talk. + _vocabulary[8].init(4, "TAKE"); + _vocabulary[9].init(4, "GET"); + _vocabulary[10].init(4, "PICK"); + _vocabulary[11].init(5, "DROP"); + _vocabulary[12].init(6, "INVENTORY"); + _vocabulary[13].init(7, "TALK"); + _vocabulary[14].init(7, "SAY"); + _vocabulary[15].init(7, "ASK"); + _vocabulary[16].init(8, "GIVE"); + _vocabulary[17].init(9, "DRINK"); + _vocabulary[18].init(9, "IMBIBE"); + _vocabulary[19].init(9, "DRAIN"); + _vocabulary[20].init(10, "LOAD"); + _vocabulary[21].init(10, "RESTORE"); + _vocabulary[22].init(11, "SAVE"); + _vocabulary[23].init(12, "BRIBE"); + _vocabulary[24].init(12, "PAY"); + _vocabulary[25].init(13, "LOOK"); + _vocabulary[26].init(14, "BREAK"); + _vocabulary[27].init(15, "QUIT"); + _vocabulary[28].init(15, "EXIT"); + _vocabulary[29].init(16, "SIT"); + _vocabulary[30].init(16, "SLEEP"); + _vocabulary[31].init(17, "STAND"); + + _vocabulary[32].init(18, "GO"); + _vocabulary[33].init(19, "INFO"); + _vocabulary[34].init(20, "UNDRESS"); + _vocabulary[35].init(20, "DOFF"); + _vocabulary[36].init(21, "DRESS"); + _vocabulary[37].init(21, "WEAR"); + _vocabulary[38].init(21, "DON"); + _vocabulary[39].init(22, "PLAY"); + _vocabulary[40].init(22, "STRUM"); + _vocabulary[41].init(23, "RING"); + _vocabulary[42].init(24, "HELP"); + _vocabulary[43].init(25, "KENDAL"); + _vocabulary[44].init(26, "CAPYBARA"); + _vocabulary[45].init(27, "BOSS"); + _vocabulary[46].init(255, "NINET"); // block for NINETY + _vocabulary[47].init(28, "URINATE"); + _vocabulary[48].init(28, "MINGITE"); + _vocabulary[49].init(29, "NINETY"); + _vocabulary[50].init(30, "ABRACADABRA"); + _vocabulary[51].init(30, "PLUGH"); + _vocabulary[52].init(30, "XYZZY"); + _vocabulary[53].init(30, "HOCUS"); + _vocabulary[54].init(30, "POCUS"); + _vocabulary[55].init(30, "IZZY"); + _vocabulary[56].init(30, "WIZZY"); + _vocabulary[57].init(30, "PLOVER"); + _vocabulary[58].init(30, "MELENKURION"); + _vocabulary[59].init(30, "ZORTON"); + _vocabulary[60].init(30, "BLERBI"); + _vocabulary[61].init(30, "THURB"); + _vocabulary[62].init(30, "SNOEZE"); + _vocabulary[63].init(30, "SAMOHT"); + _vocabulary[64].init(30, "NOSIDE"); + _vocabulary[65].init(30, "PHUGGG"); + _vocabulary[66].init(30, "KNERL"); + _vocabulary[67].init(30, "MAGIC"); + _vocabulary[68].init(30, "KLAETU"); + _vocabulary[69].init(30, "VODEL"); + _vocabulary[70].init(30, "BONESCROLLS"); + _vocabulary[71].init(30, "RADOF"); + + _vocabulary[72].init(31, "RESTART"); + _vocabulary[73].init(32, "SWALLOW"); + _vocabulary[74].init(32, "EAT"); + _vocabulary[75].init(33, "LISTEN"); + _vocabulary[76].init(33, "HEAR"); + _vocabulary[77].init(34, "BUY"); + _vocabulary[78].init(34, "PURCHASE"); + _vocabulary[79].init(34, "ORDER"); + _vocabulary[80].init(34, "DEMAND"); + _vocabulary[81].init(35, "ATTACK"); + _vocabulary[82].init(35, "HIT"); + _vocabulary[83].init(35, "KILL"); + _vocabulary[84].init(35, "PUNCH"); + _vocabulary[85].init(35, "KICK"); + _vocabulary[86].init(35, "SHOOT"); + _vocabulary[87].init(35, "FIRE"); + + // Passwords: 36 + _vocabulary[88].init(36, "TIROS"); + _vocabulary[89].init(36, "WORDY"); + _vocabulary[90].init(36, "STACK"); + _vocabulary[91].init(36, "SHADOW"); + _vocabulary[92].init(36, "OWL"); + _vocabulary[93].init(36, "ACORN"); + _vocabulary[94].init(36, "DOMESDAY"); + _vocabulary[95].init(36, "FLOPPY"); + _vocabulary[96].init(36, "DIODE"); + _vocabulary[97].init(36, "FIELD"); + _vocabulary[98].init(36, "COWSLIP"); + _vocabulary[99].init(36, "OSBYTE"); + _vocabulary[100].init(36, "OSCLI"); + _vocabulary[101].init(36, "TIMBER"); + _vocabulary[102].init(36, "ADVAL"); + _vocabulary[103].init(36, "NEUTRON"); + _vocabulary[104].init(36, "POSITRON"); + _vocabulary[105].init(36, "ELECTRON"); + _vocabulary[106].init(36, "CIRCUIT"); + _vocabulary[107].init(36, "AURUM"); + _vocabulary[108].init(36, "PETRIFY"); + _vocabulary[109].init(36, "EBBY"); + _vocabulary[110].init(36, "CATAPULT"); + _vocabulary[111].init(36, "GAMERS"); + _vocabulary[112].init(36, "FUDGE"); + _vocabulary[113].init(36, "CANDLE"); + _vocabulary[114].init(36, "BEEB"); + _vocabulary[115].init(36, "MICRO"); + _vocabulary[116].init(36, "SESAME"); + _vocabulary[117].init(36, "LORDSHIP"); + + _vocabulary[118].init(37, "DIR"); + _vocabulary[119].init(37, "LS"); + _vocabulary[120].init(38, "DIE"); + _vocabulary[121].init(39, "SCORE"); + _vocabulary[122].init(40, "PUT"); + _vocabulary[123].init(40, "INSERT"); + _vocabulary[124].init(41, "KISS"); + _vocabulary[125].init(41, "SNOG"); + _vocabulary[126].init(41, "CUDDLE"); + _vocabulary[127].init(42, "CLIMB"); + _vocabulary[128].init(42, "CLAMBER"); + _vocabulary[129].init(43, "JUMP"); + _vocabulary[130].init(44, "HIGHSCORES"); + _vocabulary[131].init(44, "HISCORES"); + _vocabulary[132].init(45, "WAKEN"); + _vocabulary[133].init(45, "AWAKEN"); + _vocabulary[134].init(46, "HELLO"); + _vocabulary[135].init(46, "HI"); + _vocabulary[136].init(46, "YO"); + _vocabulary[137].init(47, "THANKS"); // = 47, "ta", which was defined earlier. + + // Nouns - Objects: 50-100 + _vocabulary[138].init(50, "WINE"); + _vocabulary[139].init(50, "BOOZE"); + _vocabulary[140].init(50, "NASTY"); + _vocabulary[141].init(50, "VINEGAR"); + _vocabulary[142].init(51, "MONEYBAG"); + _vocabulary[143].init(51, "BAG"); + _vocabulary[144].init(51, "CASH"); + _vocabulary[145].init(51, "DOSH"); + _vocabulary[146].init(51, "WALLET"); + _vocabulary[147].init(52, "BODKIN"); + _vocabulary[148].init(52, "DAGGER"); + _vocabulary[149].init(53, "POTION"); + _vocabulary[150].init(54, "CHASTITY"); + _vocabulary[151].init(54, "BELT"); + _vocabulary[152].init(55, "BOLT"); + _vocabulary[153].init(55, "ARROW"); + _vocabulary[154].init(55, "DART"); + _vocabulary[155].init(56, "CROSSBOW"); + _vocabulary[156].init(56, "BOW"); + _vocabulary[157].init(57, "LUTE"); + _vocabulary[158].init(58, "PILGRIM"); + _vocabulary[159].init(58, "BADGE"); + _vocabulary[160].init(59, "MUSHROOMS"); + _vocabulary[161].init(59, "TOADSTOOLS"); + _vocabulary[162].init(60, "KEY"); + _vocabulary[163].init(61, "BELL"); + _vocabulary[164].init(62, "PRESCRIPT"); + _vocabulary[165].init(62, "SCROLL"); + _vocabulary[166].init(62, "MESSAGE"); + _vocabulary[167].init(63, "PEN"); + _vocabulary[168].init(63, "QUILL"); + _vocabulary[169].init(64, "INK"); + _vocabulary[170].init(64, "INKPOT"); + _vocabulary[171].init(65, "CLOTHES"); + _vocabulary[172].init(66, "HABIT"); + _vocabulary[173].init(66, "DISGUISE"); + _vocabulary[174].init(67, "ONION"); + + _vocabulary[175].init(99, "PASSWORD"); + + // Objects from Also are placed between 101 and 131. + // Nouns - People - Male: 150-174 + _vocabulary[176].init(150, "AVVY"); + _vocabulary[177].init(150, "AVALOT"); + _vocabulary[178].init(150, "YOURSELF"); + _vocabulary[179].init(150, "ME"); + _vocabulary[180].init(150, "MYSELF"); + _vocabulary[181].init(151, "SPLUDWICK"); + _vocabulary[182].init(151, "THOMAS"); + _vocabulary[183].init(151, "ALCHEMIST"); + _vocabulary[184].init(151, "CHEMIST"); + _vocabulary[185].init(152, "CRAPULUS"); + _vocabulary[186].init(152, "SERF"); + _vocabulary[187].init(152, "SLAVE"); + _vocabulary[188].init(158, "DU"); // Put in early for Baron DU Lustie to save confusion with Duck & Duke. + _vocabulary[189].init(152, "CRAPPY"); + _vocabulary[190].init(153, "DUCK"); + _vocabulary[191].init(153, "DOCTOR"); + _vocabulary[192].init(154, "MALAGAUCHE"); + _vocabulary[193].init(155, "FRIAR"); + _vocabulary[194].init(155, "TUCK"); + _vocabulary[195].init(156, "ROBIN"); + _vocabulary[196].init(156, "HOOD"); + _vocabulary[197].init(157, "CWYTALOT"); + _vocabulary[198].init(157, "GUARD"); + _vocabulary[199].init(157, "BRIDGEKEEP"); + _vocabulary[200].init(158, "BARON"); + _vocabulary[201].init(158, "LUSTIE"); + _vocabulary[202].init(159, "DUKE"); + _vocabulary[203].init(159, "GRACE"); + _vocabulary[204].init(160, "DOGFOOD"); + _vocabulary[205].init(160, "MINSTREL"); + _vocabulary[206].init(161, "TRADER"); + _vocabulary[207].init(161, "SHOPKEEPER"); + _vocabulary[208].init(161, "STALLHOLDER"); + _vocabulary[209].init(162, "PILGRIM"); + _vocabulary[210].init(162, "IBYTHNETH"); + _vocabulary[211].init(163, "ABBOT"); + _vocabulary[212].init(163, "AYLES"); + _vocabulary[213].init(164, "PORT"); + _vocabulary[214].init(165, "SPURGE"); + _vocabulary[215].init(166, "JACQUES"); + _vocabulary[216].init(166, "SLEEPER"); + _vocabulary[217].init(166, "RINGER"); + + // Nouns - People - Female: 175-199 + _vocabulary[218].init(175, "WIFE"); + _vocabulary[219].init(175, "ARKATA"); + _vocabulary[220].init(176, "GEDALODAVA"); + _vocabulary[221].init(176, "GEIDA"); + _vocabulary[222].init(176, "PRINCESS"); + _vocabulary[223].init(178, "WISE"); + _vocabulary[224].init(178, "WITCH"); + + // Pronouns: 200-224 + _vocabulary[225].init(200, "HIM"); + _vocabulary[226].init(200, "MAN"); + _vocabulary[227].init(200, "GUY"); + _vocabulary[228].init(200, "DUDE"); + _vocabulary[229].init(200, "CHAP"); + _vocabulary[230].init(200, "FELLOW"); + _vocabulary[231].init(201, "HER"); + _vocabulary[232].init(201, "GIRL"); + _vocabulary[233].init(201, "WOMAN"); + _vocabulary[234].init(202, "IT"); + _vocabulary[235].init(202, "THING"); + _vocabulary[236].init(203, "MONK"); + _vocabulary[237].init(204, "BARMAN"); + _vocabulary[238].init(204, "BARTENDER"); + + // Prepositions: 225-249 + _vocabulary[239].init(225, "TO"); + _vocabulary[240].init(226, "AT"); + _vocabulary[241].init(227, "UP"); + _vocabulary[242].init(228, "INTO"); + _vocabulary[243].init(228, "INSIDE"); + _vocabulary[244].init(229, "OFF"); + _vocabulary[245].init(230, "UP"); + _vocabulary[246].init(231, "DOWN"); + _vocabulary[247].init(232, "ON"); + + // Please: 251 + _vocabulary[248].init(251, "PLEASE"); + + // About: 252 + _vocabulary[249].init(252, "ABOUT"); + _vocabulary[250].init(252, "CONCERNING"); + + // Swear words: 253 + /* I M P O R T A N T M E S S A G E + + DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE + DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM. + GOODNESS KNOWS WHO WROTE THEM. + READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM. + WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */ + _vocabulary[251].init(253, "SHIT"); + _vocabulary[252].init(28 , "PISS"); + _vocabulary[253].init(28 , "PEE"); + _vocabulary[254].init(253, "FART"); + _vocabulary[255].init(253, "FUCK"); + _vocabulary[256].init(253, "BALLS"); + _vocabulary[257].init(253, "BLAST"); + _vocabulary[258].init(253, "BUGGER"); + _vocabulary[259].init(253, "KNICKERS"); + _vocabulary[260].init(253, "BLOODY"); + _vocabulary[261].init(253, "HELL"); + _vocabulary[262].init(253, "DAMN"); + _vocabulary[263].init(253, "SMEG"); + // ...and other even ruder words. You didn't read them, did you? Good. + + // Answer-back smart-alec words: 249 + _vocabulary[264].init(249, "YES"); + _vocabulary[265].init(249, "NO"); + _vocabulary[266].init(249, "BECAUSE"); + + // Noise words: 255 + _vocabulary[267].init(255, "THE"); + _vocabulary[268].init(255, "A"); + _vocabulary[269].init(255, "NOW"); + _vocabulary[270].init(255, "SOME"); + _vocabulary[271].init(255, "AND"); + _vocabulary[272].init(255, "THAT"); + _vocabulary[273].init(255, "POCUS"); + _vocabulary[274].init(255, "HIS"); + _vocabulary[275].init(255, "THIS"); + _vocabulary[276].init(255, "SENTINEL"); // for "Ken SENT Me" } void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; warning("STUB: Parser::handleInputText()"); -// if (_vm->_dropdown->_activeMenuItem._activeNow) { -// _vm->_dropdown->parseKey(inChar, _vm->_enhanced->extd); +// if (_vm->_menu->_activeMenuItem._activeNow) { +// _vm->_menu->parseKey(inChar, _vm->_enhanced->extd); // } else { if (_inputText.size() < 76) { if ((inChar == '"') || (inChar == '`')) { @@ -65,25 +395,26 @@ void Parser::handleInputText(const Common::Event &event) { } void Parser::handleBackspace() { - if (!_vm->_menu->_activeMenuItem._activeNow) { - if (_inputTextPos > _leftMargin) { - _inputTextPos--; - if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) - _quote = !_quote; - _inputText.deleteChar(_inputTextPos); - plotText(); - } else - _vm->_sound->blip(); - } + if (_vm->_menu->_activeMenuItem._activeNow) + return; + + if (_inputTextPos > _leftMargin) { + _inputTextPos--; + if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) + _quote = !_quote; + _inputText.deleteChar(_inputTextPos); + plotText(); + } else + _vm->_sound->blip(); } void Parser::handleReturn() { if (_vm->_menu->_activeMenuItem._activeNow) - _vm->_parser->tryDropdown(); + tryDropdown(); else if (!_inputText.empty()) { _inputTextBackup = _inputText; - _vm->_acci->parse(); - _vm->_acci->doThat(); + parse(); + doThat(); _inputText.clear(); wipeText(); } @@ -92,12 +423,12 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_F5: - _vm->_acci->_person = _vm->_acci->kPardon; - _vm->_acci->_thing = _vm->_acci->kPardon; + _person = kPardon; + _thing = kPardon; _vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); break; case Common::KEYCODE_F7: - _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); + _vm->_lucerna->callVerb(Parser::kVerbCodeOpen); break; default: break; @@ -109,7 +440,7 @@ void Parser::plotText() { cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); + _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -133,7 +464,7 @@ void Parser::tryDropdown() { warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown's keyboard handling. } -int16 Parser::pos(const Common::String &crit, const Common::String &src) { +int16 Parser::getPos(const Common::String &crit, const Common::String &src) { if (src.contains(crit)) return strstr(src.c_str(),crit.c_str()) - src.c_str(); else @@ -159,4 +490,1879 @@ void Parser::wipeText() { CursorMan.showMouse(true); } +void Parser::clearWords() { + for (int i = 0; i < 11; i++) { + if (!_realWords[i].empty()) + _realWords[i].clear(); + } +} + +byte Parser::wordNum(Common::String word) { + if (word.empty()) + return 0; + + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { + if (_vocabulary[i]._word == word) + return _vocabulary[i]._number; + } + + // If not found as a whole, we look for it as a substring. + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { + if (Common::String(_vocabulary[i]._word.c_str(), word.size()) == word) + return _vocabulary[i]._number; + } + + return kPardon; +} + +void Parser::replace(Common::String oldChars, byte newChar) { + int16 pos = getPos(oldChars, _thats); + while (pos != -1) { + if (newChar == 0) + _thats.deleteChar(pos); + else { + for (uint i = pos; i < pos + oldChars.size(); i++) + _thats.deleteChar(pos); + _thats.insertChar(newChar, pos); + } + pos = getPos(oldChars, _thats); + } +} + +Common::String Parser::rank() { + static const RankType kRanks[9] = { + {0, "Beginner"}, {10, "Novice"}, + {20, "Improving"}, {35, "Not bad"}, + {50, "Passable"}, {65, "Good"}, + {80, "Experienced"}, {108, "The BEST!"}, + {32767, "copyright'93"} + }; + + for (int i = 0; i < 8; i++) { + if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { + return kRanks[i]._title; + } + } + return ""; +} + +Common::String Parser::totalTime() { + // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. + const double ticksInOneSec = (double)(65535) / 3600; + uint16 h, m, s; + + h = floor(_vm->_gyro->_totalTime / ticksInOneSec); // No. of seconds. + m = h % 3600; + h /= 3600; + s = m % 60; + m /= 60; + + Common::String result = "You've been playing for "; + if (h > 0) + result += Common::String::format("%d hours, ", h); + if ((m > 0) || (h != 0)) + result = Common::String::format("%d minutes and ", m); + return result + Common::String::format("%d seconds", s); +} + +void Parser::cheatParse(Common::String codes) { + warning("STUB: Parser::cheatParse()"); +} + + + +void Parser::stripPunctuation(Common::String &word) { + const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; + + for (int i = 0; i < 32; i++) { + for (;;) { + int16 pos = getPos(Common::String(punct[i]), word); + if (pos == -1) + break; + word.deleteChar(pos); + } + } +} + +void Parser::displayWhat(byte target, bool animate, bool &ambiguous) { + if (target == kPardon) { + ambiguous = true; + if (animate) + _vm->_dialogs->displayText("Whom?"); + else + _vm->_dialogs->displayText("What?"); + } else { + if (animate) { + Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); + _vm->_dialogs->displayText(tmpStr); + } else { + Common::String z = _vm->_gyro->getItem(target); + if (z != "") { + Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); + _vm->_dialogs->displayText(tmpStr); + } + } + } +} + +bool Parser::doPronouns() { + bool ambiguous = false; + + for (uint i = 0; i < _thats.size(); i++) { + byte wordCode = _thats[i]; + switch (wordCode) { + case 200: + displayWhat(_vm->_gyro->_him, true, ambiguous); + _thats.setChar(_vm->_gyro->_him, i); + break; + case 201: + displayWhat(_vm->_gyro->_her, true, ambiguous); + _thats.setChar(_vm->_gyro->_her, i); + break; + case 202: + displayWhat(_vm->_gyro->_it, false, ambiguous); + _thats.setChar(_vm->_gyro->_it, i); + break; + } + } + + return ambiguous; +} + +void Parser::properNouns() { + _inputText.toLowercase(); + + // We set every word's first character to uppercase. + for (uint i = 1; i < (_inputText.size() - 1); i++) { + if (_inputText[i] == ' ') + _inputText.setChar(toupper(_inputText[i + 1]), i + 1); + } + + // And the first character as well. + _inputText.setChar(toupper(_inputText[0]), 0); +} + +void Parser::sayIt() { + Common::String x = _inputText; + x.setChar(toupper(x[0]), 0); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), + Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); + _vm->_dialogs->displayText(tmpStr); +} + +void Parser::storeInterrogation(byte interrogation) { + if (_inputText.empty()) + return; + + // Strip _inputText: + while ((_inputText[0] == ' ') && (!_inputText.empty())) + _inputText.deleteChar(0); + while ((_inputText.lastChar() == ' ') && (!_inputText.empty())) + _inputText.deleteLastChar(); + + _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement. + + switch (interrogation) { + case 1: + _inputText.toLowercase(); + sayIt(); + _vm->_gyro->_favouriteDrink = _inputText; + _vm->_gyro->_cardiffQuestionNum = 2; + break; + case 2: + properNouns(); + sayIt(); + _vm->_gyro->_favouriteSong = _inputText; + _vm->_gyro->_cardiffQuestionNum = 3; + break; + case 3: + properNouns(); + sayIt(); + _vm->_gyro->_worstPlaceOnEarth = _inputText; + _vm->_gyro->_cardiffQuestionNum = 4; + break; + case 4: + _inputText.toLowercase(); + sayIt(); + if (!_vm->_gyro->_spareEvening.empty()) + _vm->_gyro->_spareEvening.clear(); + _vm->_gyro->_spareEvening = _inputText; + _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... + _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge + _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! + _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; + _vm->_gyro->_cardiffQuestionNum = 5; + break; + case 99: + //store_high(_inputText); + warning("STUB: Parser::store_interrogation()"); + break; + } + + if (interrogation < 4) + _vm->_timer->cardiffSurvey(); +} + + + +void Parser::parse() { + // First parsing - word identification + if (!_thats.empty()) + _thats.clear(); + + byte n = 0; + _polite = false; + _verb = kPardon; + _thing = kPardon; + _thing2 = kPardon; + _person = kPardon; + clearWords(); + + + // A cheat mode attempt. + if (_inputText[0] == '.') { + cheatParse(_inputText); + _thats = kNothing; + return; + } + + // Are we being interrogated right now? + if (_vm->_gyro->_interrogation > 0) { + storeInterrogation(_vm->_gyro->_interrogation); + _vm->_gyro->_weirdWord = true; + return; + } + + // Actually process the command. + Common::String inputText = _inputText + ' '; + Common::String inputTextUpper = inputText; + inputTextUpper.toUppercase(); + while (!inputTextUpper.empty()) { + while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) { + inputTextUpper.deleteChar(0); + inputText.deleteChar(0); + } + if (inputTextUpper.empty()) + break; + + // Get the following word of the strings. + byte size = getPos(Common::String(' '), inputTextUpper) + 1; + char *subStr = new char[size]; + Common::strlcpy(subStr, inputTextUpper.c_str(), size); + Common::String thisword = subStr; + Common::strlcpy(subStr, inputText.c_str(), size); + _realWords[n] = subStr; + delete[] subStr; + + stripPunctuation(inputTextUpper); + + bool notfound = true; + + // Check also[] first, which contains words about the actual room. + if (!thisword.empty()) { + for (int i = 0; i < 31; i++) { + if ((_vm->_gyro->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { + _thats += Common::String(99 + i); + notfound = false; + } + } + } + + // Check Accis's own table (words[]) for "global" commands. + if (notfound) { + byte answer = wordNum(thisword); + if (answer == kPardon) { + notfound = true; + _thats = _thats + kPardon; + } else + _thats = _thats + answer; + n++; + } + + // Delete words we already processed. + int16 spacePos = getPos(Common::String(' '), inputTextUpper); + if (spacePos > -1) { + for (int i = 0; i <= spacePos; i++) + inputTextUpper.deleteChar(0); + } + + spacePos = getPos(Common::String(' '), inputText); + if (spacePos > -1) { + for (int i = 0; i <= spacePos; i++) + inputText.deleteChar(0); + } + } + + Common::String unkString; + int16 pos = getPos(Common::String('\xFE'), _thats); + if (pos > -1) + unkString = _realWords[pos]; + else + unkString.clear(); + + // Replace words' codes that mean the same. + replace(Common::String("\xFF"), 0); // zap noise words + replace(Common::String("\xD\xE2"), 1); // "look at" = "examine" + replace(Common::String("\xD\xE4"), 1); // "look in" = "examine" + replace(Common::String("\x4\xE6"), 17); // "get up" = "stand" + replace(Common::String("\x4\xE7"), 17); // "get down" = "stand"... well, why not? + replace(Common::String("\x12\xE4"), 2); // "go in" = "open [door]" + replace(Common::String("\x1C\xE5"), 253); // "P' off" is a swear word + replace(Common::String("\x4\x6"), 6); // "Take inventory" (remember Colossal Adventure?) + replace(Common::String("\x28\xE8"), 21); // "put on" = "don" + replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" + + // Words that could mean more than one _person + if (_vm->_gyro->_room == kRoomNottsPub) + replace(Common::String('\xCC'), 164); // Barman = Port + else + replace(Common::String('\xCC'), 154); // Barman = Malagauche + + switch (_vm->_gyro->_room) { + case kRoomAylesOffice: + replace(Common::String('\xCB'), 163); // Monk = Ayles + break; + case kRoomMusicRoom: + replace(Common::String('\xCB'), 166); // Monk = Jacques + break; + default: + replace(Common::String('\xCB'), 162); // Monk = Ibythneth + } + + if (doPronouns()) { + _vm->_gyro->_weirdWord = true; + _thats = kNothing; + return; + } + + // Second parsing. + if (!_vm->_gyro->_subject.empty()) + _vm->_gyro->_subject.clear(); + _vm->_gyro->_subjectNum = 0; // Find subject of conversation. + + for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { + if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { + _vm->_gyro->_subjectNum = (byte)_thats[i]; + _thats.setChar(kMoved, i); + break; + } + } + + if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found. + for (uint16 i = 0; i < _thats.size() - 1; i++) { + if ((byte)_thats[i] == 252) { // The word is "about", or something similar. + _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; + _thats.setChar(0, i + 1); + break; + } + } + } + + if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + for (uint16 i = 0; i < _thats.size() - 1; i++) { + if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { + // SAY not followed by a preposition + _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; + _thats.setChar(0, i + 1); + break; + } + } + } + + for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. + if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) + _verb = (byte)_thats[i]; + else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { + _thing2 = _thing; + _thing = (byte)_thats[i]; + } else if ((150 <= (byte)_thats[i]) && ((byte)_thats[i] <= 199)) + _person = (byte)_thats[i]; + else if ((byte)_thats[i] == 251) + _polite = true; + } + + if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); + _vm->_dialogs->displayText(tmpStr); + _vm->_gyro->_weirdWord = true; + } else + _vm->_gyro->_weirdWord = false; + + if (_thats.empty()) + _thats = kNothing; + + if (_thing != kPardon) + _vm->_gyro->_it = _thing; + + if (_person != kPardon) { + if (_person < Gyro::kPeopleArkata) + _vm->_gyro->_him = _person; + else + _vm->_gyro->_her = _person; + } +} + +void Parser::examineObject() { + if (_thing != _vm->_gyro->_thinks) + _vm->_lucerna->thinkAbout(_thing, Gyro::kThing); + switch (_thing) { + case Gyro::kObjectWine : + switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. + case 1: + _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll + break; + case 2: + _vm->_dialogs->displayScrollChain('d', 6); // Bad wine + break; + case 3: + _vm->_dialogs->displayScrollChain('d', 7); // Vinegar + break; + } + break; + case Gyro::kObjectOnion: + if (_vm->_gyro->_rottenOnion) + _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion + else + _vm->_dialogs->displayScrollChain('t', 18); // Normal onion + break; + default: + _vm->_dialogs->displayScrollChain('t', _thing); // Ordinarily + } +} + +bool Parser::isPersonHere() { // Person equivalent of "holding". + if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_room)) + return true; + else { + Common::String tmpStr; + if (_person < Gyro::kPeopleArkata) + tmpStr = "He isn't around at the moment."; + else + tmpStr = "She isn't around at the moment."; + _vm->_dialogs->displayText(tmpStr); + return false; + } +} + +void Parser::exampers() { + if (isPersonHere()) { + if (_thing != _vm->_gyro->_thinks) + _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); + + byte newPerson = _person - 149; + + if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) + _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" + else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) + _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. + else + _vm->_dialogs->displayScrollChain('p', newPerson); + + if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) + _vm->_dialogs->displayScrollChain('Q', 13); + + _person = newPerson; + } +} + +/** + * Return whether Avvy is holding an object or not + * @remarks Originally called 'holding' + */ +bool Parser::isHolding() { + if ((51 <= _thing) && (_thing <= 99)) // Also. + return true; + + bool holdingResult = false; + + if (_thing > 100) + _vm->_dialogs->displayText("Be reasonable!"); + else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + _vm->_dialogs->displayText("You're not holding it, Avvy."); + else + holdingResult = true; + + return holdingResult; +} + +void Parser::openBox(bool isOpening) { + if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { + _vm->_background->drawBackgroundSprite(-1, -1, 4); + + _vm->_background->updateBackgroundSprites(); + _vm->_animation->animLink(); + _vm->_graphics->refreshScreen(); + + _vm->_system->delayMillis(55); + + if (!isOpening) { + _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->updateBackgroundSprites(); + _vm->_animation->animLink(); + _vm->_graphics->refreshScreen(); + } + } +} + +void Parser::examine() { + // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. + if ((_person == kPardon) && (_thing != kPardon)) { + if (isHolding()) { + // Remember: it's been slipped! Ie subtract 49. + if ((1 <= _thing) && (_thing <= 49)) // Standard object + examineObject(); + else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing + openBox(true); + _vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); + openBox(false); + } + } + } else if (_person != kPardon) + exampers(); + else + _vm->_dialogs->displayText("It's just as it looks on the picture."); // Don't know: guess. +} + +void Parser::inventory() { + byte itemNum = 0; + Common::String tmpStr = Common::String("You're carrying "); + + for (int i = 0; i < kObjectNum; i++) { + if (_vm->_gyro->_objects[i]) { + itemNum++; + if (itemNum == _vm->_gyro->_carryNum) + tmpStr += "and "; + + tmpStr += _vm->_gyro->getItem(i + 1); + + if ((i + 1) == _vm->_gyro->_wearing) + tmpStr += ", which you're wearing"; + + if (itemNum < _vm->_gyro->_carryNum) + tmpStr += ", "; + } + } + + if (_vm->_gyro->_wearing == kNothing) + tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + else + tmpStr += '.'; + + _vm->_dialogs->displayText(tmpStr); +} + +void Parser::swallow() { // Eat something. + switch (_thing) { + case Gyro::kObjectWine: + switch (_vm->_gyro->_wineState) { // 4 is perfect + case 1: + if (_vm->_gyro->_teetotal) { + _vm->_dialogs->displayScrollChain('D', 6); + return; + } + _vm->_dialogs->displayScrollChain('U', 1); + _vm->_pingo->wobble(); + _vm->_dialogs->displayScrollChain('U', 2); + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; + _vm->_lucerna->refreshObjectList(); + drink(); + break; + case 2: + case 3: + _vm->_dialogs->displayScrollChain('d', 8); + break; // You can't drink it! + } + break; + case Gyro::kObjectPotion: + _vm->_gyro->setBackgroundColor(4); + _vm->_dialogs->displayScrollChain('U', 3); + _vm->_lucerna->gameOver(); + _vm->_gyro->setBackgroundColor(0); + break; + case Gyro::kObjectInk: + _vm->_dialogs->displayScrollChain('U', 4); + break; + case Gyro::kObjectChastity: + _vm->_dialogs->displayScrollChain('U', 5); + break; + case Gyro::kObjectMushroom: + _vm->_dialogs->displayScrollChain('U', 6); + _vm->_lucerna->gameOver(); + break; + case Gyro::kObjectOnion: + if (_vm->_gyro->_rottenOnion) + _vm->_dialogs->displayScrollChain('U', 11); + else { + _vm->_dialogs->displayScrollChain('U', 8); + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; + _vm->_lucerna->refreshObjectList(); + } + break; + default: + if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) + _vm->_dialogs->displayText("Try BUYing things before you drink them!"); + else + _vm->_dialogs->displayText("The taste of it makes you retch!"); + } +} + +void Parser::peopleInRoom() { + byte numPeople = 0; // Number of people in the room. + + for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) + numPeople++; + } + + if (numPeople == 0) // If nobody's here, we can cut out straight away. + return; + + Common::String tmpStr; + byte actPerson = 0; // Actually listed people. + for (int i = 1; i < 29; i++) { + if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { + actPerson++; + if (actPerson == 1) // First on the list. + tmpStr = _vm->_gyro->getName(i + 150); + else if (actPerson < numPeople) // The middle... + tmpStr += ", " + _vm->_gyro->getName(i + 150); + else // The end. + tmpStr += " and " + _vm->_gyro->getName(i + 150); + } + } + + if (numPeople == 1) + tmpStr += " is"; + else + tmpStr += " are"; + + _vm->_dialogs->displayText(tmpStr + " here."); // End and display it. +} + +void Parser::lookAround() { + _vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); + switch (_vm->_gyro->_room) { + case kRoomSpludwicks: + if (_vm->_gyro->_avariciusTalk > 0) + _vm->_dialogs->displayScrollChain('q', 23); + else + peopleInRoom(); + break; + case kRoomRobins: + if (_vm->_gyro->_tiedUp) + _vm->_dialogs->displayScrollChain('q', 38); + if (_vm->_gyro->_mushroomGrowing) + _vm->_dialogs->displayScrollChain('q', 55); + break; + case kRoomInsideCardiffCastle: + if (!_vm->_gyro->_takenPen) + _vm->_dialogs->displayScrollChain('q', 49); + break; + case kRoomLustiesRoom: + if (_vm->_gyro->_lustieIsAsleep) + _vm->_dialogs->displayScrollChain('q', 65); + break; + case kRoomCatacombs: + switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { + case 258 : + _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. + break; + case 514 : + _vm->_dialogs->displayScrollChain('q', 81); // Outside ditto. + break; + case 260 : + _vm->_dialogs->displayScrollChain('q', 82); // Outside Geida's room. + break; + } + break; + default: + peopleInRoom(); + } +} + +void Parser::openDoor() { + // Special cases. + switch (_vm->_gyro->_room) { + case kRoomYours: + if (_vm->_animation->inField(1)) { + // Opening the box. + _thing = 54; // The box. + _person = kPardon; + examine(); + return; + } + break; + case kRoomSpludwicks: + if (_thing == 61) { + _vm->_dialogs->displayScrollChain('q', 85); + return; + } + break; + } + + if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) + return; // No doors can open if you can't move Avvy. + + for (int i = 0; i < 7; i++) { + if (_vm->_animation->inField(i + 8)) { + MagicType *portal = &_vm->_gyro->_portals[i]; + switch (portal->_operation) { + case Gyro::kMagicExclaim: + _vm->_animation->_sprites[0].bounce(); + _vm->_dialogs->displayScrollChain('x', portal->_data); + break; + case Gyro::kMagicTransport: + _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); + break; + case Gyro::kMagicUnfinished: + _vm->_animation->_sprites[0].bounce(); + _vm->_dialogs->displayText("Sorry. This place is not available yet!"); + break; + case Gyro::kMagicSpecial: + _vm->_animation->callSpecial(portal->_data); + break; + case Gyro::kMagicOpenDoor: + _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); + break; + } + + return; + } + } + + if (_vm->_gyro->_room == kRoomMap) + _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ + "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); + else + _vm->_dialogs->displayText("Door? What door?"); +} + +void Parser::silly() { + _vm->_dialogs->displayText("Don't be silly!"); +} + +void Parser::putProc() { + if (!isHolding()) + return; + + _thing2 -= 49; // Slip the second object. + char temp = _thing; + _thing = _thing2; + if (!isHolding()) + return; + _thing = temp; + + // Thing is the _thing which you're putting in. _thing2 is where you're putting it. + switch (_thing2) { + case Gyro::kObjectWine: + if (_thing == Gyro::kObjectOnion) { + if (_vm->_gyro->_rottenOnion) + _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); + else { // Put onion into wine? + if (_vm->_gyro->_wineState != 3) { + Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); + } else { // Put onion into vinegar! Yes! + _vm->_gyro->_onionInVinegar = true; + _vm->_lucerna->incScore(7); + _vm->_dialogs->displayScrollChain('u', 9); + } + } + } else + silly(); + break; + + case 54: + if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. + if (_vm->_gyro->_boxContent != kNothing) + _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); + else { + switch (_thing) { + case Gyro::kObjectMoney: + _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); + break; + case Gyro::kObjectBell: + _vm->_dialogs->displayText("That's a silly place to keep a bell."); + break; + case Gyro::kObjectBodkin: + _vm->_dialogs->displayText("But you might need it!"); + break; + case Gyro::kObjectOnion: + _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); + break; + default: // Put the object into the box... + if (_vm->_gyro->_wearing == _thing) { + Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); + _vm->_dialogs->displayText(tmpStr); + } else { + openBox(true); // Open box. + + _vm->_gyro->_boxContent = _thing; + _vm->_gyro->_objects[_thing - 1] = false; + _vm->_lucerna->refreshObjectList(); + _vm->_dialogs->displayText("OK, it's in the box."); + + openBox(false); // Shut box. + } + } + } + } else + silly(); + break; + + default: + silly(); + } +} + +/** + * Display text when ingredients are not in the right order + * @remarks Originally called 'not_in_order' + */ +void Parser::notInOrder() { + Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); + Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ + "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); +} + +/** + * Move Spludwick to cauldron + * @remarks Originally called 'go_to_cauldron' + */ +void Parser::goToCauldron() { + _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. + _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); + _vm->_animation->_sprites[1].walkTo(1); +} + +/** + * Check is it's possible to give something to Spludwick + * @remarks Originally called 'give2spludwick' + */ +bool Parser::giveToSpludwick() { + if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick] != _thing) { + notInOrder(); + return false; + } + + switch (_thing) { + case Gyro::kObjectOnion: + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; + if (_vm->_gyro->_rottenOnion) + _vm->_dialogs->displayScrollChain('q', 22); + else { + _vm->_gyro->_givenToSpludwick++; + _vm->_dialogs->displayScrollChain('q', 20); + goToCauldron(); + _vm->_lucerna->incScore(3); + } + _vm->_lucerna->refreshObjectList(); + break; + case Gyro::kObjectInk: + _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_givenToSpludwick++; + _vm->_dialogs->displayScrollChain('q', 24); + goToCauldron(); + _vm->_lucerna->incScore(3); + break; + case Gyro::kObjectMushroom: + _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; + _vm->_dialogs->displayScrollChain('q', 25); + _vm->_lucerna->incScore(5); + _vm->_gyro->_givenToSpludwick++; + goToCauldron(); + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; + _vm->_lucerna->refreshObjectList(); + break; + default: + return true; + } + + return false; +} + +void Parser::drink() { + _vm->_gyro->_alcoholLevel += 1; + if (_vm->_gyro->_alcoholLevel == 5) { + _vm->_gyro->_objects[Gyro::kObjectKey - 1] = true; // Get the key. + _vm->_gyro->_teetotal = true; + _vm->_gyro->_avvyIsAwake = false; + _vm->_gyro->_avvyInBed = true; + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->dusk(); + _vm->_gyro->hangAroundForAWhile(); + _vm->_animation->flipRoom(1, 1); + _vm->_gyro->setBackgroundColor(14); + _vm->_animation->_sprites[0]._visible = false; + } +} + +void Parser::cardiffClimbing() { + if (_vm->_gyro->_standingOnDais) { // Clamber up. + _vm->_dialogs->displayText("You climb down, back onto the floor."); + _vm->_gyro->_standingOnDais = false; + _vm->_animation->appearPed(0, 2); + } else if (_vm->_animation->inField(0)) { // Clamber down + _vm->_dialogs->displayText("You clamber up onto the dais."); + _vm->_gyro->_standingOnDais = true; + _vm->_animation->appearPed(0, 1); + } else + _vm->_dialogs->displayText("Get a bit closer, Avvy."); +} + +void Parser::already() { + _vm->_dialogs->displayText("You're already standing!"); +} + +void Parser::standUp() { + switch (_vm->_gyro->_room) { + case kRoomYours: // Avvy isn't asleep. + if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. + if (_vm->_gyro->_teetotal) { + _vm->_dialogs->displayScrollChain('d', 12); + _vm->_gyro->setBackgroundColor(0); + _vm->_dialogs->displayScrollChain('d', 14); + } + _vm->_animation->_sprites[0]._visible = true; + _vm->_gyro->_userMovesAvvy = true; + _vm->_animation->appearPed(0, 1); + _vm->_animation->_direction = Animation::kDirLeft; + _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. + _vm->_lucerna->incScore(1); + _vm->_gyro->_avvyInBed = false; + _vm->_timer->loseTimer(Timer::kReasonArkataShouts); + } else + already(); + break; + + case kRoomInsideCardiffCastle: + cardiffClimbing(); + break; + + case kRoomNottsPub: + if (_vm->_gyro->_sittingInPub) { + _vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down. + _vm->_animation->_sprites[0]._visible = true; // But standing up. + _vm->_animation->appearPed(0, 3); // And walking away. + _vm->_gyro->_sittingInPub = false; // Really not sitting down. + _vm->_gyro->_userMovesAvvy = true; // And ambulant. + } else + already(); + break; + default: + already(); + } +} + +void Parser::getProc(char thing) { + switch (_vm->_gyro->_room) { + case kRoomYours: + if (_vm->_animation->inField(1)) { + if (_vm->_gyro->_boxContent == thing) { + _vm->_background->drawBackgroundSprite(-1, -1, 4); + _vm->_dialogs->displayText("OK, I've got it."); + _vm->_gyro->_objects[thing - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_boxContent = kNothing; + _vm->_background->drawBackgroundSprite(-1, -1, 5); + } else { + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); + _vm->_dialogs->displayText(tmpStr); + } + } else + _vm->_dialogs->displayScrollChain('q', 57); + break; + case kRoomInsideCardiffCastle: + switch (thing) { + case Gyro::kObjectPen: + if (_vm->_animation->inField(1)) { // Standing on the dais. + if (_vm->_gyro->_takenPen) + _vm->_dialogs->displayText("It's not there, Avvy."); + else { + // OK: we're taking the pen, and it's there. + _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. + _vm->_animation->callSpecial(3); // Zap! + _vm->_gyro->_takenPen = true; + _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_dialogs->displayText("Taken."); + } + } else if (_vm->_gyro->_standingOnDais) + _vm->_dialogs->displayScrollChain('q', 53); + else + _vm->_dialogs->displayScrollChain('q', 51); + break; + case Gyro::kObjectBolt: + _vm->_dialogs->displayScrollChain('q', 52); + break; + default: + _vm->_dialogs->displayScrollChain('q', 57); + } + break; + case kRoomRobins: + if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_dialogs->displayText("Got it!"); + _vm->_gyro->_mushroomGrowing = false; + _vm->_gyro->_takenMushroom = true; + _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(3); + } else + _vm->_dialogs->displayScrollChain('q', 57); + break; + default: + _vm->_dialogs->displayScrollChain('q', 57); + } +} + +/** + * Give the lute to Geida + * @remarks Originally called 'give_Geida_the_lute' + */ +void Parser::giveGeidaTheLute() { + if (_vm->_gyro->_room != kRoomLustiesRoom) { + Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + return; + } + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; + _vm->_lucerna->refreshObjectList(); + _vm->_dialogs->displayScrollChain('q', 64); // She plays it. + + _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); + //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! +} + +void Parser::playHarp() { + if (_vm->_animation->inField(6)) + _vm->_dialogs->displayMusicalScroll(); + else + _vm->_dialogs->displayText("Get a bit closer to it, Avvy!"); +} + +void Parser::winSequence() { + _vm->_dialogs->displayScrollChain('q', 78); + _vm->_sequence->firstShow(7); + _vm->_sequence->thenShow(8); + _vm->_sequence->thenShow(9); + _vm->_sequence->startToClose(); + _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); +} + +Common::String Parser::personSpeaks() { + if ((_person == kPardon) || (_person == 0)) { + if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_room)) + _person = _vm->_gyro->_her; + else + _person = _vm->_gyro->_him; + } + + if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { + return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! + } + + bool found = false; // The _person we're looking for's code is in _person. + Common::String tmpStr; + + for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, '1' + i); + found = true; + } + } + + if (found) + return tmpStr; + + for (int i = 0; i < 16; i++) { + if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) + tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); + } + + return tmpStr; +} + +void Parser::heyThanks() { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + _vm->_gyro->_objects[_thing - 1] = false; +} + +/** + * @remarks Originally called 'do_that' + */ +void Parser::doThat() { + static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + static const char kWhat[] = "That's not possible!"; + + if (_thats == Common::String(kNothing)) { + if (!_thats.empty()) + _thats.clear(); + return; + } + + if (_vm->_gyro->_weirdWord) + return; + + if (_thing < 200) + _thing -= 49; // "Slip" + + + if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) + && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) + && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { + if (!_vm->_gyro->_alive) { + _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); + return; + } + if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); + return; + } + } + + switch (_verb) { + case kVerbCodeExam: + examine(); + break; + case kVerbCodeOpen: + openDoor(); + break; + case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); + } + break; + case kVerbCodeGet: + if (_thing != kPardon) { // Legitimate try to pick something up. + if (_vm->_gyro->_carryNum >= kCarryLimit) + _vm->_dialogs->displayText("You can't carry any more!"); + else + getProc(_thing); + } else { // Not... ditto. + if (_person != kPardon) + _vm->_dialogs->displayText("You can't sweep folk off their feet!"); + else + _vm->_dialogs->displayText("I assure you, you don't need it."); + } + break; + case kVerbCodeDrop: + _vm->_dialogs->displayText("Two years ago you dropped a florin in the street. Three days " \ + "later it was gone! So now you never leave ANYTHING lying around. OK?"); + break; + case kVerbCodeInv: + inventory(); + break; + case kVerbCodeTalk: + if (_person == kPardon) { + if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". + Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); + } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { + _thats.deleteChar(0); + + for (int i = 0; i < 10; i++) + _realWords[i] = _realWords[i + 1]; + + _verb = _vm->_gyro->_subjectNum; + doThat(); + return; + } else { + _person = _vm->_gyro->_subjectNum; + _vm->_gyro->_subjectNum = 0; + if ((_person == 0) || (_person == kPardon)) + _vm->_dialogs->displayText("Talk to whom?"); + else if (isPersonHere()) + _vm->_dialogs->talkTo(_person); + } + } else if (isPersonHere()) + _vm->_dialogs->talkTo(_person); + break; + case kVerbCodeGive: + if (isHolding()) { + if (_person == kPardon) + _vm->_dialogs->displayText("Give to whom?"); + else if (isPersonHere()) { + switch (_thing) { + case Gyro::kObjectMoney : + _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); + break; + case Gyro::kObjectBodkin: + case Gyro::kObjectBell: + case Gyro::kObjectClothes: + case Gyro::kObjectHabit : + _vm->_dialogs->displayText("Don't give it away, it might be useful!"); + break; + default: + switch (_person) { + case Gyro::kPeopleCrapulus: + if (_thing == Gyro::kObjectWine) { + _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; + } else + heyThanks(); + break; + case Gyro::kPeopleCwytalot: + if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) + _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); + else + heyThanks(); + break; + case Gyro::kPeopleSpludwick: + if (giveToSpludwick()) + heyThanks(); + break; + case Gyro::kPeopleIbythneth: + if (_thing == Gyro::kObjectBadge) { + _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! + _vm->_lucerna->incScore(3); + _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; + _vm->_gyro->_givenBadgeToIby = true; + _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 8); + } else + heyThanks(); + break; + case Gyro::kPeopleAyles: + if (_vm->_gyro->_aylesIsAwake) { + if (_thing == Gyro::kObjectPen) { + _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; + _vm->_dialogs->displayScrollChain('q', 54); + _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; + _vm->_gyro->_givenPenToAyles = true; + _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->incScore(2); + } else + heyThanks(); + } else + _vm->_dialogs->displayText("But he's asleep!"); + break; + case Gyro::kPeopleGeida: + switch (_thing) { + case Gyro::kObjectPotion: + _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; + _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. + _vm->_lucerna->incScore(2); + _vm->_gyro->_givenPotionToGeida = true; + _vm->_lucerna->refreshObjectList(); + break; + case Gyro::kObjectLute: + giveGeidaTheLute(); + break; + default: + heyThanks(); + } + break; + case Gyro::kPeopleArkata: + switch (_thing) { + case Gyro::kObjectPotion: + if (_vm->_gyro->_givenPotionToGeida) + winSequence(); + else + _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! + break; + default: + heyThanks(); + } + break; + default: + heyThanks(); + } + } + } + _vm->_lucerna->refreshObjectList(); // Just in case... + } + break; + + case kVerbCodeEat: + case kVerbCodeDrink: + if (isHolding()) + swallow(); + break; + + case kVerbCodeLoad: + break; + case kVerbCodeSave: + break; + // We don't handle these two because we use ScummVM's save/load system. + + case kVerbCodePay: + _vm->_dialogs->displayText("No money need change hands."); + break; + case kVerbCodeLook: + lookAround(); + break; + case kVerbCodeBreak: + _vm->_dialogs->displayText("Vandalism is prohibited within this game!"); + break; + case kVerbCodeQuit: // quit + if (!_polite) + _vm->_dialogs->displayText("How about a `please\", Avvy?"); + else { + Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); + if (_vm->_dialogs->displayQuestion(tmpStr)) + _vm->_gyro->_letMeOut = true; + } + break; + case kVerbCodeGo: + _vm->_dialogs->displayText("Just use the arrow keys to walk there."); + break; + case kVerbCodeInfo: { + _vm->_dialogs->_aboutBox = true; + + Common::String toDisplay; + for (int i = 0; i < 7; i++) + toDisplay += Dialogs::kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + + "The medi\x91val descendant of" + Dialogs::kControlNewLine + + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine + + "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + _vm->_dialogs->displayText(toDisplay); + _vm->_dialogs->_aboutBox = false; + } + break; + case kVerbCodeUndress: + if (_vm->_gyro->_wearing == kNothing) + _vm->_dialogs->displayText("You're already stark naked!"); + else if (_vm->_gyro->_avvysInTheCupboard) { + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); + _vm->_dialogs->displayText(tmpStr); + _vm->_gyro->_wearing = kNothing; + _vm->_lucerna->refreshObjectList(); + } else + _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); + break; + case kVerbCodeWear: + if (isHolding()) { // Wear something. + switch (_thing) { + case Gyro::kObjectChastity: + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); + break; + case Gyro::kObjectClothes: + case Gyro::kObjectHabit: { // Change this! + if (_vm->_gyro->_wearing != kNothing) { + if (_vm->_gyro->_wearing == _thing) + _vm->_dialogs->displayText("You're already wearing that."); + else + _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); + return; + } else + _vm->_gyro->_wearing = _thing; + + _vm->_lucerna->refreshObjectList(); + + byte i; + if (_thing == Gyro::kObjectHabit) + i = 3; + else + i = 0; + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; + if (spr->_id != i) { + int16 x = spr->_x; + int16 y = spr->_y; + spr->remove(); + spr->init(i, true, _vm->_animation); + spr->appear(x, y, Animation::kDirLeft); + spr->_visible = false; + } + } + break; + default: + _vm->_dialogs->displayText(kWhat); + } + } + break; + case kVerbCodePlay: + if (_thing == kPardon) { + switch (_vm->_gyro->_room) { // They just typed "play"... + case kRoomArgentPub: // ...in the pub, => play Nim. + warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); + // play_nim(); + // The following parts are copied from play_nim(). + // The player automatically wins the game everytime he wins, until I implement the mini-game. + + if (_vm->_gyro->_wonNim) { // Already won the game. + _vm->_dialogs->displayScrollChain('Q', 6); + return; + } + + if (!_vm->_gyro->_askedDogfoodAboutNim) { + _vm->_dialogs->displayScrollChain('q', 84); + return; + } + + _vm->_dialogs->displayScrollChain('Q', 3); + _vm->_gyro->_playedNim++; + + // You won - strange! + _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_wonNim = true; + _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. + _vm->_lucerna->incScore(7); // 7 points for winning! + + if (_vm->_gyro->_playedNim == 1) + _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. + + // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); + break; + case kRoomMusicRoom: + playHarp(); + break; + } + } else if (isHolding()) { + switch (_thing) { + case Gyro::kObjectLute : + _vm->_dialogs->displayScrollChain('U', 7); + + if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) + _vm->_dialogs->displayScrollChain('U', 10); + + if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) + _vm->_dialogs->displayScrollChain('U', 15); + break; + case 52: + if (_vm->_gyro->_room == kRoomMusicRoom) + playHarp(); + else + _vm->_dialogs->displayText(kWhat); + break; + case 55: + if (_vm->_gyro->_room == kRoomArgentPub) + // play_nim(); + warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); + else + _vm->_dialogs->displayText(kWhat); + break; + default: + _vm->_dialogs->displayText(kWhat); + } + } + break; + case kVerbCodeRing: + if (isHolding()) { + if (_thing == Gyro::kObjectBell) { + _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); + if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); + } else + _vm->_dialogs->displayText(kWhat); + } + break; + case kVerbCodeHelp: + // boot_help(); + warning("STUB: Parser::doThat() - case kVerbCodehelp"); + break; + case kVerbCodeLarrypass: + _vm->_dialogs->displayText("Wrong game!"); + break; + case kVerbCodePhaon: + _vm->_dialogs->displayText("Hello, Phaon!"); + break; + case kVerbCodeBoss: + // bosskey(); + warning("STUB: Parser::doThat() - case kVerbCodeboss"); + break; + case kVerbCodePee: + if (_vm->_gyro->setFlag('P')) { + _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); + _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); + } else { + Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Dialogs::kControlItalic, Dialogs::kControlRoman); + _vm->_dialogs->displayText(tmpStr); + } + break; + case kVerbCodeCheat: { + Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); + _vm->_dialogs->displayText(tmpStr); + _vm->_gyro->_cheat = true; + } + break; + case kVerbCodeMagic: + if (_vm->_gyro->_avariciusTalk > 0) + _vm->_dialogs->displayScrollChain('q', 19); + else { + if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! + _vm->_dialogs->displayScrollChain('q', 17); + if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) + _vm->_dialogs->displayScrollChain('q', 18); + else { + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->init(1, false, _vm->_animation); // Avaricius + _vm->_animation->appearPed(1, 3); + spr->walkTo(4); + spr->_callEachStepFl = true; + spr->_eachStepProc = Animation::kProcBackAndForth; + _vm->_gyro->_avariciusTalk = 14; + _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); + } + } else + _vm->_dialogs->displayText("Nothing appears to happen..."); + } + break; + case kVerbCodeSmartAlec: + _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); + break; + case kVerbCodeExpletive: + switch (_vm->_gyro->_sworeNum) { + case 0: { + Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ + "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); + } + break; + case 1: { + Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ + "do things I tell you not to?%c%cDon't do it again!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); + } + break; + default: { + _vm->_pingo->zonk(); + // CHECKME: Weird character in string + Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); + _vm->_lucerna->gameOver(); + } + } + _vm->_gyro->_sworeNum++; + break; + case kVerbCodeListen: + if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); + else if (_vm->_gyro->_listen.empty()) + _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); + else + _vm->_dialogs->displayText(_vm->_gyro->_listen); + break; + case kVerbCodeBuy: // What are they trying to buy? + switch (_vm->_gyro->_room) { + case kRoomArgentPub: + if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. + switch (_thing) { + case 51: + case 53: + case 54: + case 58: // Beer, whisky, cider or mead. + if (_vm->_gyro->_malagauche == 177) { // Already getting us one. + _vm->_dialogs->displayScrollChain('D', 15); + return; + } + + if (_vm->_gyro->_teetotal) { + _vm->_dialogs->displayScrollChain('D', 6); + return; + } + + if (_vm->_gyro->_alcoholLevel == 0) + _vm->_lucerna->incScore(3); + + _vm->_background->drawBackgroundSprite(-1, -1, 11); + _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); + _vm->_gyro->_drinking = _thing; + + _vm->_background->drawBackgroundSprite(-1, -1, 9); + _vm->_gyro->_malagauche = 177; + _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); + break; + case 52: + examine(); + break; // We have a right one here - buy Pepsi??! + case Gyro::kObjectWine: + if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! + _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! + else { + if (_vm->_gyro->_malagauche == 177) { // Already getting us one. + _vm->_dialogs->displayScrollChain('D', 15); + return; + } + + if (_vm->_gyro->_carryNum >= kCarryLimit) { + _vm->_dialogs->displayText("Your hands are full."); + return; + } + + _vm->_background->drawBackgroundSprite(-1, -1, 11); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + if (_vm->_gyro->_alcoholLevel == 0) + _vm->_lucerna->incScore(3); + _vm->_background->drawBackgroundSprite(-1, -1, 9); + _vm->_gyro->_malagauche = 177; + + _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); + } + break; + } + } else + _vm->_dialogs->displayScrollChain('D', 5); // Go to the bar! + break; + + case kRoomOutsideDucks: + if (_vm->_animation->inField(5)) { + if (_thing == Gyro::kObjectOnion) { + if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) + _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! + else if (_vm->_gyro->_carryNum >= kCarryLimit) + _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); + else { + if (_vm->_gyro->_boughtOnion) + _vm->_dialogs->displayScrollChain('D', 11); + else { + _vm->_dialogs->displayScrollChain('D', 9); + _vm->_lucerna->incScore(3); + } + _vm->_gyro->decreaseMoney(3); // It costs thruppence. + _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_boughtOnion = true; + _vm->_gyro->_rottenOnion = false; // It's OK when it leaves the stall! + _vm->_gyro->_onionInVinegar = false; + } + } else + _vm->_dialogs->displayScrollChain('D', 0); + } else + _vm->_dialogs->displayScrollChain('D', 0); + break; + + case kRoomNottsPub: + _vm->_dialogs->displayScrollChain('n', 15); // Can't sell to southerners. + break; + default: + _vm->_dialogs->displayScrollChain('D', 0); // Can't buy that. + } + break; + case kVerbCodeAttack: + if ((_vm->_gyro->_room == kRoomBrummieRoad) && + ((_person == Gyro::kPeopleCwytalot) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && + (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { + switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { + // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. + case 0: + _vm->_dialogs->displayScrollChain('Q', 10); + _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); + break; + case 1: + _vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); + break; + case 2: + _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); + break; + case 3: + _vm->_dialogs->displayScrollChain('Q', 11); + _vm->_gyro->_cwytalotGone = true; + _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; + _vm->_lucerna->incScore(7); + _vm->_animation->_sprites[1].walkTo(1); + _vm->_animation->_sprites[1]._vanishIfStill = true; + _vm->_animation->_sprites[1]._callEachStepFl = false; + _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; + break; + default: + _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! + } + } else + _vm->_dialogs->displayScrollChain('Q', 10); + break; + case kVerbCodePasswd: + if (_vm->_gyro->_room != kRoomBridge) + _vm->_dialogs->displayScrollChain('Q', 12); + else { + bool ok = true; + for (uint i = 0; i < _thats.size(); i++) { + Common::String temp = _realWords[i]; + temp.toUppercase(); + int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; + for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { + if (_vocabulary[pwdId]._word[j] != temp[j]) + ok = false; + } + } + + if (ok) { + if (_vm->_gyro->_drawbridgeOpen != 0) + _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); + else { + _vm->_lucerna->incScore(4); + _vm->_dialogs->displayText("The drawbridge opens!"); + _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); + _vm->_gyro->_drawbridgeOpen = 1; + } + } else + _vm->_dialogs->displayScrollChain('Q', 12); + } + break; + case kVerbCodeDir: + //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! + break; + case kVerbCodeDie: + _vm->_lucerna->gameOver(); + break; + case kVerbCodeScore: { + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + _vm->_dialogs->displayText(tmpStr); + } + break; + case kVerbCodePut: + putProc(); + break; + case kVerbCodeStand: + standUp(); + break; + case kVerbCodeKiss: + if (_person == kPardon) + _vm->_dialogs->displayText("Kiss whom?"); + else if (isPersonHere()) { + switch (_person) { + case Gyro::kPeopleArkata: + _vm->_dialogs->displayScrollChain('U', 12); + break; + case Gyro::kPeopleGeida: + _vm->_dialogs->displayScrollChain('U', 13); + break; + case Gyro::kPeopleWisewoman: + _vm->_dialogs->displayScrollChain('U', 14); + break; + default: + _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? + } + } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) + _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); + + break; + case kVerbCodeClimb: + if (_vm->_gyro->_room == kRoomInsideCardiffCastle) + cardiffClimbing(); + else // In the wrong room! + _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); + break; + case kVerbCodeJump: + _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); + _vm->_gyro->_userMovesAvvy = false; + break; + case kVerbCodeHiscores: + // show_highs(); + warning("STUB: Parser::doThat() - case kVerbCodehighscores"); + break; + case kVerbCodeWake: + if (isPersonHere()) + switch (_person) { + case kPardon: + case Gyro::kPeopleAvalot: + case 0: + if (!_vm->_gyro->_avvyIsAwake) { + _vm->_gyro->_avvyIsAwake = true; + _vm->_lucerna->incScore(1); + _vm->_gyro->_avvyInBed = true; + _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. + if (_vm->_gyro->_teetotal) + _vm->_dialogs->displayScrollChain('d', 13); + } else + _vm->_dialogs->displayText("You're already awake, Avvy!"); + break; + case Gyro::kPeopleAyles: + if (!_vm->_gyro->_aylesIsAwake) + _vm->_dialogs->displayText("You can't seem to wake him by yourself."); + break; + case Gyro::kPeopleJacques: { + Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ + "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + } + break; + default: + _vm->_dialogs->displayText("It's difficult to awaken people who aren't asleep...!"); + } + break; + case kVerbCodeSit: + if (_vm->_gyro->_room == kRoomNottsPub) { + if (_vm->_gyro->_sittingInPub) + _vm->_dialogs->displayText("You're already sitting!"); + else { + _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. + _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); + } + } else { // Default doodah. + _vm->_lucerna->dusk(); + _vm->_gyro->hangAroundForAWhile(); + _vm->_lucerna->dawn(); + Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); + _vm->_dialogs->displayText(tmpStr); + } + break; + case kVerbCodeRestart: + if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { + _vm->_lucerna->dusk(); + _vm->_gyro->newGame(); + _vm->_lucerna->dawn(); + } + break; + case kPardon: + _vm->_dialogs->displayText("Hey, a verb would be helpful!"); + break; + case kVerbCodeHello: { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hello.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + } + break; + case kVerbCodeThanks: { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("That's OK.%c", Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(tmpStr); + } + break; + default: + Common::String tmpStr = Common::String::format("%cParser bug!", Dialogs::kControlBell); + _vm->_dialogs->displayText(tmpStr); + } +} + +void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) { + switch (verb) { + case kVerbCodeExam: + answer = "Examine"; + ansKey = 'x'; + break; // The ubiquitous one. + // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. + case kVerbCodeDrink: + answer = "Drink"; + ansKey = 'D'; + break; + case kVerbCodeWear: + answer = "Wear"; + ansKey = 'W'; + break; + case kVerbCodeRing: + answer = "Ring"; + ansKey = 'R'; + break; // Only the bell! + case kVerbCodePlay: + answer = "Play"; + ansKey = 'P'; + break; + case kVerbCodeEat: + answer = "Eat"; + ansKey = 'E'; + break; + default: + answer = "? Unknown!"; // Bug! + ansKey = '?'; + } +} + } // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index b6ee0466aeaf..1084c01a90ca 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -29,12 +29,49 @@ #define AVALANCHE_PARSER_H #include "common/events.h" +#include "common/scummsys.h" +#include "common/str.h" + namespace Avalanche { class AvalancheEngine; class Parser { public: + enum VerbCode { + kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, + kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, + kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, + kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, + kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, + kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, + kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, + kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, + kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 + }; + + static const byte kPardon = 254; // Didn't understand / wasn't given. + static const int16 kParserWordsNum = 277; // How many words does the parser know? + static const byte kNothing = 250; + static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.) + static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS". + + struct VocabEntry { + byte _number; + Common::String _word; + + void init(byte number, Common::String word) { + _number = number; + _word = word; + } + }; + + VocabEntry _vocabulary[kParserWordsNum]; + + Common::String _realWords[11]; + byte _verb, _person, _thing; + bool _polite; Common::String _inputText; // Original name: current Common::String _inputTextBackup; byte _inputTextPos; // Original name: curpos @@ -45,6 +82,11 @@ class Parser { Parser(AvalancheEngine *vm); void init(); + void parse(); + void doThat(); + void verbOpt(byte verb, Common::String &answer, char &ansKey); + void drink(); + void handleInputText(const Common::Event &event); void handleBackspace(); void handleReturn(); @@ -53,11 +95,59 @@ class Parser { void cursorOn(); void cursorOff(); void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. - int16 pos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + int16 getPos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. private: AvalancheEngine *_vm; + struct RankType { + uint16 _score; + Common::String _title; + }; + + Common::String _thats; + byte _thing2; + + byte wordNum(Common::String word); + void replace(Common::String oldChars, byte newChar); + + Common::String rank(); + Common::String totalTime(); + + void clearWords(); + void cheatParse(Common::String codes); + void stripPunctuation(Common::String &word); // Strips punctuation from word. + void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective! + bool doPronouns(); + void properNouns(); + void lookAround(); // This is called when you say "look". + void sayIt(); // This makes Avalot say the response. + void openDoor(); + void storeInterrogation(byte interrogation); + void examineObject(); // Examine a standard object-thing + bool isPersonHere(); + void exampers(); + bool isHolding(); + void openBox(bool isOpening); + void examine(); + void inventory(); + void swallow(); + void peopleInRoom(); // This lists the other people in the room. + void silly(); + void putProc(); // Called when you call kVerbCodeput. + void notInOrder(); + void goToCauldron(); + bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!". + void cardiffClimbing(); + void already(); + void standUp(); // Called when you ask Avvy to stand. + void getProc(char thing); + void giveGeidaTheLute(); + void playHarp(); + void winSequence(); + Common::String personSpeaks(); + void heyThanks(); + void drawCursor(); void wipeText(); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index c76c9892df2a..b40731adc6d5 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna.h" #include "avalanche/animation.h" #include "avalanche/dialogs.h" -#include "avalanche/acci.h" #include "avalanche/sequence.h" #include "avalanche/pingo.h" @@ -513,7 +512,7 @@ void Timer::buyDrinks() { _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. - _vm->_acci->drink(); + _vm->_parser->drink(); } void Timer::buyWine() { @@ -660,7 +659,7 @@ void Timer::winning() { #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_lucerna->callVerb(Acci::kVerbCodeScore); + _vm->_lucerna->callVerb(Parser::kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); _vm->_gyro->_letMeOut = true; } From 183f10e4a08dfe714b49866b079beffd98cafffc Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 19:12:44 +0200 Subject: [PATCH 1074/1332] AVALANCHE: Simplify Sequence::firstShow(). --- engines/avalanche/sequence.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index cb6bd06e6cd9..871a38573afb 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -43,12 +43,10 @@ Sequence::Sequence(AvalancheEngine *vm) { } void Sequence::firstShow(byte what) { - // First, we need to blank out the entire array. - for (uint i = 0; i < sizeof(_seq); i++) - _seq[i] = 0; + _seq[0] = what; - // Then it's just the same as thenShow. - thenShow(what); + for (uint i = 1; i < kSeqLength; i++) + _seq[i] = 0; } void Sequence::thenShow(byte what) { From ed7e71d226fa833577bba1939b3bc034a0ad877a Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 19:22:21 +0200 Subject: [PATCH 1075/1332] AVALANCHE: Some revision in Sequence. --- engines/avalanche/sequence.cpp | 7 ++++--- engines/avalanche/sequence.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 871a38573afb..a17200ebc08d 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -77,7 +77,9 @@ void Sequence::startToOpen() { } void Sequence::shoveLeft() { - memcpy(_seq, _seq+1, kSeqLength - 1); // Shift everything to the left. + for (uint i = 0; i < kSeqLength - 1; i++) + _seq[i] = _seq[i + 1]; + _seq[kSeqLength - 1] = 0; } void Sequence::callSequencer() { @@ -93,8 +95,7 @@ void Sequence::callSequencer() { break; } - if ((_seq[0] >= 1) && (_seq[0] <= 176)) { - // Show a frame. + if (_seq[0] <= 176) { // Show a frame. _vm->_background->drawBackgroundSprite(-1, -1, _seq[0] - 1); shoveLeft(); } diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 67650d519dcb..c1461c696c73 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -54,7 +54,7 @@ class Sequence { private: AvalancheEngine *_vm; - void shoveLeft(); // This PROC is called by Timer when it's time to do another frame. + void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. }; } // End of namespace Avalanche. From 89471e76d1177f2cbe5f2b638fe69559de85b84f Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 19:30:37 +0200 Subject: [PATCH 1076/1332] AVALANCHE: More revision in Sequence. --- engines/avalanche/sequence.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index a17200ebc08d..712275e73d25 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -83,20 +83,22 @@ void Sequence::shoveLeft() { } void Sequence::callSequencer() { - switch (_seq[0]) { + byte curSeq = _seq[0]; + + switch (curSeq) { case 0: return; // No more routines. break; case 177: // Flip room. _vm->_gyro->_userMovesAvvy = true; _vm->_animation->flipRoom(_vm->_gyro->_flipToWhere, _vm->_gyro->_flipToPed); - if (_seq[0] == 177) + if (curSeq == 177) shoveLeft(); break; } - if (_seq[0] <= 176) { // Show a frame. - _vm->_background->drawBackgroundSprite(-1, -1, _seq[0] - 1); + if (curSeq <= 176) { // Show a frame. + _vm->_background->drawBackgroundSprite(-1, -1, curSeq - 1); shoveLeft(); } From 2d9c9e8c7f26a2c5977d52214283893617d97ffc Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 00:42:20 -0500 Subject: [PATCH 1077/1332] ZVISION: Remove unused animation functions --- engines/zvision/animation.cpp | 131 ---------------------------------- engines/zvision/zvision.h | 3 - 2 files changed, 134 deletions(-) delete mode 100644 engines/zvision/animation.cpp diff --git a/engines/zvision/animation.cpp b/engines/zvision/animation.cpp deleted file mode 100644 index f43e854f734e..000000000000 --- a/engines/zvision/animation.cpp +++ /dev/null @@ -1,131 +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/scummsys.h" - -#include "common/system.h" -#include "video/video_decoder.h" - -#include "zvision/zvision.h" -#include "zvision/rlf_animation.h" - - -namespace ZVision { - -void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) { - bool skip = false; - uint32 frameTime = animation->frameTime(); - uint width = animation->width(); - uint height = animation->height(); - - uint16 newX = x + _workingWindow.left; - uint16 newY = y + _workingWindow.top; - - uint32 accumulatedTime = 0; - - // Only continue while the video is still playing - while (!shouldQuit() && !skip && !animation->endOfAnimation()) { - _clock.update(); - uint32 currentTime = _clock.getLastMeasuredTime(); - accumulatedTime += _clock.getDeltaTime(); - - // Check for engine quit and video stop key presses - while (_eventMan->pollEvent(_event)) { - switch (_event.type) { - case Common::EVENT_KEYDOWN: - switch (_event.kbd.keycode) { - case Common::KEYCODE_q: - if (_event.kbd.hasFlags(Common::KBD_CTRL)) - quitGame(); - break; - case Common::KEYCODE_SPACE: - skip = true; - break; - default: - break; - } - default: - break; - } - } - - while (accumulatedTime >= frameTime && !animation->endOfAnimation()) { - accumulatedTime -= frameTime; - - _system->copyRectToScreen(animation->getNextFrame(), width * sizeof(uint16), newX, newY, width, height); - } - - // Always update the screen so the mouse continues to render - _system->updateScreen(); - - // Calculate the frame delay based off a desired frame time - int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); - // Ensure non-negative - delay = delay < 0 ? 0 : delay; - _system->delayMillis(delay); - } -} - -void ZVision::playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) { - _clock.stop(); - animation->start(); - - // Only continue while the video is still playing - while (!shouldQuit() && !animation->endOfVideo() && animation->isPlaying()) { - // Check for engine quit and video stop key presses - while (!animation->endOfVideo() && animation->isPlaying() && _eventMan->pollEvent(_event)) { - switch (_event.type) { - case Common::EVENT_KEYDOWN: - switch (_event.kbd.keycode) { - case Common::KEYCODE_q: - if (_event.kbd.hasFlags(Common::KBD_CTRL)) - quitGame(); - break; - case Common::KEYCODE_SPACE: - animation->stop(); - break; - default: - break; - } - default: - break; - } - } - - if (animation->needsUpdate()) { - const Graphics::Surface *frame = animation->decodeNextFrame(); - - if (frame) { - _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); - } - } - - // Always update the screen so the mouse continues to render - _system->updateScreen(); - - _system->delayMillis(animation->getTimeToNextFrame()); - } - - _clock.start(); -} - -} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index a481aba28f04..efd94f1074bc 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -131,9 +131,6 @@ class ZVision : public Engine { */ void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true); - void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - void playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); - Common::String generateSaveFileName(uint slot); Common::String generateAutoSaveFileName(); From cfe176619a52de5d31eebbca228639db49110102 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 01:37:41 -0500 Subject: [PATCH 1078/1332] ZVISION: Remove unused function arguments --- engines/zvision/render_manager.cpp | 2 +- engines/zvision/truetype_font.cpp | 2 +- engines/zvision/truetype_font.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7f10535bb27e..dc942fe3d070 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -367,7 +367,7 @@ Common::Rect RenderManager::renderTextToWorkingWindow(uint32 idNumber, const Com entry.destY = destY; // Draw the text to the working window - entry.data = font->drawTextToSurface(text, destX, destY, textColor, maxWidth, maxHeight, align, wrap); + entry.data = font->drawTextToSurface(text, textColor, maxWidth, maxHeight, align, wrap); entry.width = entry.data->w; entry.height = entry.data->h; diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index 8fd331df4865..80d0d6bddb52 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -72,7 +72,7 @@ bool TruetypeFont::loadFile(const Common::String &filename) { return true; } -Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { +Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) { if (text.equals("")) { return nullptr; } diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index ae7732cba42f..d35da878eef0 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -56,7 +56,7 @@ class TruetypeFont { public: bool loadFile(const Common::String &filename); - Graphics::Surface *drawTextToSurface(const Common::String &text, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap); + Graphics::Surface *drawTextToSurface(const Common::String &text, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap); }; } // End of namespace ZVision From 7a557c4bcd970582fcd28eacb9644bac5714edbf Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 01:43:28 -0500 Subject: [PATCH 1079/1332] ZVISION: Add documentation to TruetypeFont --- engines/zvision/truetype_font.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index d35da878eef0..c7475d1adbf1 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -55,7 +55,25 @@ class TruetypeFont { int32 _fontHeight; public: + /** + * Loads a .ttf file into memory. This must be called + * before any calls to drawTextToSurface + * + * @param filename The file name of the .ttf file to load + */ bool loadFile(const Common::String &filename); + /** + * Renders the supplied text to a Surface using 0x0 as the + * background color. + * + * @param text The to render + * @param textColor The color to render the text with + * @param maxWidth The max width the text should take up. + * @param maxHeight The max height the text should take up. + * @param align The alignment of the text within the bounds of maxWidth + * @param wrap If true, any words extending past maxWidth will wrap to a new line. If false, ellipses will be rendered to show that the text didn't fit + * @return A Surface containing the rendered text + */ Graphics::Surface *drawTextToSurface(const Common::String &text, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap); }; From 69bcb76d050c162b02295784f8a3bb83d73d82c8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sat, 21 Sep 2013 02:14:11 -0500 Subject: [PATCH 1080/1332] ZVISION: Add documentation to RenderManager --- engines/zvision/render_manager.h | 76 +++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index b0a42d9ba7c0..71f4807c2981 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -65,12 +65,17 @@ class RenderManager { const Graphics::PixelFormat _pixelFormat; // A buffer the exact same size as the workingWindow - // It's used for panorama/tilt warping and for clearing the workingWindow to a single color + // This buffer stores everything un-warped, then does a warp at the end of the frame Graphics::Surface _workingWindowBuffer; + // A buffer representing the entire screen. Any graphical updates are first done with this buffer + // before actually being blitted to the screen Graphics::Surface _backBuffer; + // A list of Alpha Entries that need to be blitted to the backbuffer Common::HashMap _alphaDataEntries; + // A rectangle representing the portion of the working window where the pixels have been changed since last frame Common::Rect _workingWindowDirtyRect; + // A rectangle representing the portion of the backbuffer where the pixels have been changed since last frame Common::Rect _backBufferDirtyRect; /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ @@ -121,13 +126,61 @@ class RenderManager { */ void renderBackbufferToScreen(); + /** + * Renders all AlphaEntries to the backbuffer + */ void processAlphaEntries(); + /** + * Clears the AlphaEntry list + */ void clearAlphaEntries() { _alphaDataEntries.clear(); } + /** + * Removes a specific AlphaEntry from the list + * + * @param idNumber The id number identifing the AlphaEntry + */ void removeAlphaEntry(uint32 idNumber) { _alphaDataEntries.erase(idNumber); } + /** + * Copies a sub-rectangle of a buffer to the working window + * + * @param buffer The pixel data to copy to the working window + * @param destX The X destination in the working window where the subRect of data should be put + * @param destY The Y destination in the working window where the subRect of data should be put + * @param imageWidth The width of the source image + * @param width The width of the sub rectangle + * @param height The height of the sub rectangle + */ void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); + /** + * Copies a sub-rectangle of a buffer to the working window with binary alpha support. + * + * @param buffer The pixel data to copy to the working window + * @param destX The X destination in the working window where the subRect of data should be put + * @param destY The Y destination in the working window where the subRect of data should be put + * @param imageWidth The width of the source image + * @param width The width of the sub rectangle + * @param height The height of the sub rectangle + * @param alphaColor The color to interpret as meaning 'transparent' + * @param idNumber A unique identifier for the data being copied over. + */ void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor, uint32 idNumber); + /** + * Renders the supplied text to the working window + * + * @param idNumber A unique identifier for the text + * @param text The text to be rendered + * @param font The font to use to render the text + * @param destX The X destination in the working window where the text should be rendered + * @param destY The Y destination in the working window where the text should be rendered + * @param textColor The color to render the text with (in RBG 565) + * @param maxWidth The max width the text should take up. + * @param maxHeight The max height the text should take up. + * @param align The alignment of the text within the bounds of maxWidth + * @param wrap If true, any words extending past maxWidth will wrap to a new line. If false, ellipses will be rendered to show that the text didn't fit + * @return A rectangle representing where the text was drawn in the working window + */ Common::Rect renderTextToWorkingWindow(uint32 idNumber, const Common::String &text, TruetypeFont *font, int destX, int destY, uint16 textColor, int maxWidth, int maxHeight = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool wrap = true); /** @@ -242,8 +295,29 @@ class RenderManager { */ void renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap); + /** + * Reads an image file pixel data into a Surface buffer. In the process + * it converts the pixel data from RGB 555 to RGB 565. Also, if the image + * is transposed, it will un-transpose the pixel data. The function will + * call destination::create() if the dimensions of destination do not match + * up with the dimensions of the image. + * + * @param fileName The name of a .tga file + * @param destination A reference to the Surface to store the pixel data in + */ void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); + /** + * Move the background image by an offset. If we are currently in Panorama mode, + * the offset will correspond to a horizontal motion. If we are currently in Tilt mode, + * the offset will correspond to a vertical motion. This function should not be called + * if we are in Flat mode. + * + * The RenderManager will take care of wrapping the image. + * Ex: If the image has width 1400px, it is legal to offset 1500px. + * + * @param offset The amount to move the background + */ void moveBackground(int offset); }; From 4b4f07a7f6e8643080de8048d94e7d22bc7f3753 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 22:26:36 +0200 Subject: [PATCH 1081/1332] AVALANCHE: Merge Gyro, Lucerna and Avalot --- engines/avalanche/animation.cpp | 418 ++++--- engines/avalanche/avalanche.cpp | 224 ++-- engines/avalanche/avalanche.h | 4 - engines/avalanche/avalot.cpp | 1774 +++++++++++++++++++++++++++++- engines/avalanche/avalot.h | 392 +++++++ engines/avalanche/background.cpp | 96 +- engines/avalanche/closing.cpp | 2 - engines/avalanche/dialogs.cpp | 374 ++++--- engines/avalanche/gyro.cpp | 599 ---------- engines/avalanche/gyro.h | 367 ------ engines/avalanche/lucerna.cpp | 1224 --------------------- engines/avalanche/lucerna.h | 124 --- engines/avalanche/menu.cpp | 210 ++-- engines/avalanche/module.mk | 2 - engines/avalanche/parser.cpp | 706 ++++++------ engines/avalanche/pingo.cpp | 8 +- engines/avalanche/sequence.cpp | 11 +- engines/avalanche/timer.cpp | 167 ++- 18 files changed, 3236 insertions(+), 3466 deletions(-) delete mode 100644 engines/avalanche/gyro.cpp delete mode 100644 engines/avalanche/gyro.h delete mode 100644 engines/avalanche/lucerna.cpp delete mode 100644 engines/avalanche/lucerna.h diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d274591fde5c..0593b046af7e 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -30,8 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/animation.h" #include "avalanche/dialogs.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h" #include "avalanche/background.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" @@ -149,8 +147,8 @@ void AnimationType::turn(byte whichway) { void AnimationType::appear(int16 wx, int16 wy, byte wf) { _x = (wx / 8) * 8; _y = wy; - _oldX[_anim->_vm->_gyro->_cp] = wx; - _oldY[_anim->_vm->_gyro->_cp] = wy; + _oldX[_anim->_vm->_avalot->_cp] = wx; + _oldY[_anim->_vm->_avalot->_cp] = wy; turn(wf); _visible = true; _moveX = 0; @@ -182,9 +180,9 @@ void AnimationType::walk() { r._y2 = _y + _info._yLength + 2; } - if (!_anim->_vm->_gyro->_doingSpriteRun) { - _oldX[_anim->_vm->_gyro->_cp] = _x; - _oldY[_anim->_vm->_gyro->_cp] = _y; + if (!_anim->_vm->_avalot->_doingSpriteRun) { + _oldX[_anim->_vm->_avalot->_cp] = _x; + _oldY[_anim->_vm->_avalot->_cp] = _y; if (_homing) homeStep(); _x += _moveX; @@ -197,40 +195,40 @@ void AnimationType::walk() { return; } - byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_avalot->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((magicColor != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { - MagicType *magic = &_anim->_vm->_gyro->_magics[magicColor]; + if ((magicColor != 255) & (!_anim->_vm->_avalot->_doingSpriteRun)) { + MagicType *magic = &_anim->_vm->_avalot->_magics[magicColor]; switch (magic->_operation) { - case Gyro::kMagicExclaim: + case Avalot::kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = magic->_data; break; - case Gyro::kMagicBounce: + case Avalot::kMagicBounce: bounce(); break; - case Gyro::kMagicTransport: + case Avalot::kMagicTransport: _anim->flipRoom(magic->_data >> 8, magic->_data & 0xff); break; - case Gyro::kMagicUnfinished: { + case Avalot::kMagicUnfinished: { bounce(); Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); _anim->_vm->_dialogs->displayText(tmpStr); } break; - case Gyro::kMagicSpecial: + case Avalot::kMagicSpecial: _anim->callSpecial(magic->_data); break; - case Gyro::kMagicOpenDoor: + case Avalot::kMagicOpenDoor: _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor); break; } } } - if (!_anim->_vm->_gyro->_doingSpriteRun) { + if (!_anim->_vm->_avalot->_doingSpriteRun) { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; @@ -242,13 +240,13 @@ void AnimationType::walk() { } void AnimationType::bounce() { - _x = _oldX[_anim->_vm->_gyro->_cp]; - _y = _oldY[_anim->_vm->_gyro->_cp]; + _x = _oldX[_anim->_vm->_avalot->_cp]; + _y = _oldY[_anim->_vm->_avalot->_cp]; if (_doCheck) _anim->stopWalking(); else stopWalk(); - _anim->_vm->_lucerna->drawDirection(); + _anim->_vm->_avalot->drawDirection(); } int8 AnimationType::getSign(int16 val) { @@ -261,7 +259,7 @@ int8 AnimationType::getSign(int16 val) { } void AnimationType::walkTo(byte pedNum) { - PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum]; + PedType *curPed = &_anim->_vm->_avalot->_peds[pedNum]; setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); _homingX = curPed->_x - _info._xLength / 2; @@ -329,10 +327,10 @@ void AnimationType::stopWalk() { } void AnimationType::chatter() { - _anim->_vm->_gyro->_talkX = _x + _info._xLength / 2; - _anim->_vm->_gyro->_talkY = _y; - _anim->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; - _anim->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_avalot->_talkX = _x + _info._xLength / 2; + _anim->_vm->_avalot->_talkY = _y; + _anim->_vm->_avalot->_talkFontColor = _stat._fgBubbleCol; + _anim->_vm->_avalot->_talkBackgroundColor = _stat._bgBubbleCol; } void AnimationType::remove() { @@ -370,7 +368,7 @@ void Animation::loadAnims() { } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - if (!_vm->_gyro->_alive) + if (!_vm->_avalot->_alive) return 0; if (x1 < 0) @@ -415,8 +413,8 @@ void Animation::catacombMove(byte ped) { // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. - xy_uint16 = _vm->_gyro->_catacombX + _vm->_gyro->_catacombY * 256; - _vm->_gyro->_geidaSpin = 0; + xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256; + _vm->_avalot->_geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs @@ -435,78 +433,78 @@ void Animation::catacombMove(byte ped) { case 2307: flipRoom(kRoomLusties, 5); _vm->_dialogs->displayText("Oh no... here we go again..."); - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; return; } - if (!_vm->_gyro->_enterCatacombsFromLustiesRoom) - _vm->_lucerna->loadRoom(29); - here = _vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1]; + if (!_vm->_avalot->_enterCatacombsFromLustiesRoom) + _vm->_avalot->loadRoom(29); + here = _vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); break; case 0x1: // no connection (wall + shield), - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x2: // wall with door - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[2]._operation = Gyro::kMagicSpecial; // Straight wall. + _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall. + _vm->_avalot->_magics[2]._operation = Avalot::kMagicSpecial; // Straight wall. break; } @@ -514,127 +512,127 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 18); break; case 0x1: // no connection (wall + window), - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window. break; case 0x2: // wall with door - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door. _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicSpecial; // Straight wall. - _vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicSpecial; // Straight wall. + _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. break; } switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; - _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; - _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; + _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; + _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; + _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; break; case 0x1: _vm->_background->drawBackgroundSprite(-1, -1, 21); - if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) - _vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; + if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows)) + _vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim; else - _vm->_gyro->_magics[12]._operation = Gyro::kMagicSpecial; // Right exit south. + _vm->_avalot->_magics[12]._operation = Avalot::kMagicSpecial; // Right exit south. - _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; - _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; + _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; + _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; break; case 0x2: _vm->_background->drawBackgroundSprite(-1, -1, 22); - _vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. - _vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; - _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; + _vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south. + _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; + _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; break; case 0x3: _vm->_background->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. - _vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; - _vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; + _vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south. + _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; + _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; - _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; + _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. break; // LEFT handles: #if 0 case 0x1: _vm->_celer->show_one(-1, -1, 4); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } + _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } break; #endif case 0x2: _vm->_background->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. + _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; #if 0 case 0x3: _vm->_celer->show_one(-1, -1, 4); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } { Change magic number! } + _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } break; // RIGHT handles: case 0x4: _vm->_celer->show_one(-1, -1, 3); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } + _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } break; #endif case 0x5: _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. + _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; #if 0 case 0x6: _vm->_celer->show_one(-1, -1, 3); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } + _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } break; #endif // ARCHWAYS: @@ -648,25 +646,25 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_background->drawBackgroundSprite(-1, -1, 31); - _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. - _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north. + _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; - _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; + _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 13); break; case 0xe: // No connection + TORCH - _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; - _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; + _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. _vm->_background->drawBackgroundSprite(-1, -1, 7); break; // Recessed door: case 0xf: - _vm->_gyro->_magics[0]._operation = Gyro::kMagicNothing; // Door to Geida's room. + _vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room. _vm->_background->drawBackgroundSprite(-1, -1, 0); - _vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. + _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; } @@ -702,7 +700,7 @@ void Animation::catacombMove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { + if ((_vm->_avalot->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. appearPed(1, geidaPed(ped)); @@ -711,36 +709,36 @@ void Animation::catacombMove(byte ped) { } } -// This proc gets called whenever you touch a line defined as _vm->_gyro->special. +// This proc gets called whenever you touch a line defined as _vm->_avalot->special. void Animation::dawnDelay() { _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); } void Animation::callSpecial(uint16 which) { switch (which) { - case 1: // _vm->_gyro->special 1: Room 22: top of stairs. + case 1: // _vm->_avalot->special 1: Room 22: top of stairs. _vm->_background->drawBackgroundSprite(-1, -1, 0); - _vm->_gyro->_brummieStairs = 1; - _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; + _vm->_avalot->_brummieStairs = 1; + _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_userMovesAvvy = false; break; - case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. - _vm->_gyro->_brummieStairs = 3; - _vm->_gyro->_magics[10]._operation = Gyro::kMagicNothing; - _vm->_gyro->_magics[11]._operation = Gyro::kMagicExclaim; - _vm->_gyro->_magics[11]._data = 5; - _vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! + case 2: // _vm->_avalot->special 2: Room 22: bottom of stairs. + _vm->_avalot->_brummieStairs = 3; + _vm->_avalot->_magics[10]._operation = Avalot::kMagicNothing; + _vm->_avalot->_magics[11]._operation = Avalot::kMagicExclaim; + _vm->_avalot->_magics[11]._data = 5; + _vm->_avalot->_magics[3]._operation = Avalot::kMagicBounce; // Now works as planned! stopWalking(); _vm->_dialogs->displayScrollChain('q', 26); - _vm->_gyro->_userMovesAvvy = true; + _vm->_avalot->_userMovesAvvy = true; break; - case 3: // _vm->_gyro->special 3: Room 71: triggers dart. + case 3: // _vm->_avalot->special 3: Room 71: triggers dart. _sprites[0].bounce(); // Must include that. - if (!_vm->_gyro->_arrowTriggered) { - _vm->_gyro->_arrowTriggered = true; + if (!_vm->_avalot->_arrowTriggered) { + _vm->_avalot->_arrowTriggered = true; appearPed(1, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. @@ -754,80 +752,80 @@ void Animation::callSpecial(uint16 which) { } break; case 4: // This is the ghost room link. - _vm->_lucerna->dusk(); + _vm->_avalot->dusk(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - if (_vm->_gyro->_friarWillTieYouUp) { - // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. - _vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. + if (_vm->_avalot->_friarWillTieYouUp) { + // _vm->_avalot->special 5: Room 42: touched tree, and get tied up. + _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Boundary effect is now working again. _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); - _vm->_gyro->_tiedUp = true; - _vm->_gyro->_friarWillTieYouUp = false; + _vm->_avalot->_tiedUp = true; + _vm->_avalot->_friarWillTieYouUp = false; _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. + _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; - case 6: // _vm->_gyro->special 6: fall down oubliette. - _vm->_gyro->_userMovesAvvy = false; + case 6: // _vm->_avalot->special 6: fall down oubliette. + _vm->_avalot->_userMovesAvvy = false; _sprites[0]._moveX = 3; _sprites[0]._moveY = 0; _sprites[0]._facingDir = kDirRight; _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); break; - case 7: // _vm->_gyro->special 7: stop falling down oubliette. + case 7: // _vm->_avalot->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; + _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); - //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); - //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); + //_vm->_avalot->mblit(12, 80, 38, 160, 3, 0); + //_vm->_avalot->mblit(12, 80, 38, 160, 3, 1); _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; - case 8: // _vm->_gyro->special 8: leave du Lustie's room. - if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { + case 8: // _vm->_avalot->special 8: leave du Lustie's room. + if ((_vm->_avalot->_geidaFollows) && (!_vm->_avalot->_lustieIsAsleep)) { _vm->_dialogs->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); } break; - case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... - if (!_vm->_gyro->_geidaFollows) + case 9: // _vm->_avalot->special 9: lose Geida to Robin Hood... + if (!_vm->_avalot->_geidaFollows) return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1].walkTo(3); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; - case 10: // _vm->_gyro->special 10: transfer north in catacombs. - if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { + case 10: // _vm->_avalot->special 10: transfer north in catacombs. + if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) { // Into Geida's room. - if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) + if (_vm->_avalot->_objects[Avalot::kObjectKey - 1]) _vm->_dialogs->displayScrollChain('q', 62); else { _vm->_dialogs->displayScrollChain('q', 61); return; } } - _vm->_lucerna->dusk(); - _vm->_gyro->_catacombY--; + _vm->_avalot->dusk(); + _vm->_avalot->_catacombY--; catacombMove(4); - if (_vm->_gyro->_room != kRoomCatacombs) + if (_vm->_avalot->_room != kRoomCatacombs) return; - switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { + switch ((_vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1] & 0xf00) >> 8) { case 0x1: appearPed(0, 11); break; @@ -839,29 +837,29 @@ void Animation::callSpecial(uint16 which) { } dawnDelay(); break; - case 11: // _vm->_gyro->special 11: transfer east in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_catacombX++; + case 11: // _vm->_avalot->special 11: transfer east in catacombs. + _vm->_avalot->dusk(); + _vm->_avalot->_catacombX++; catacombMove(1); - if (_vm->_gyro->_room != kRoomCatacombs) + if (_vm->_avalot->_room != kRoomCatacombs) return; appearPed(0, 0); dawnDelay(); break; - case 12: // _vm->_gyro->special 12: transfer south in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_catacombY += 1; + case 12: // _vm->_avalot->special 12: transfer south in catacombs. + _vm->_avalot->dusk(); + _vm->_avalot->_catacombY += 1; catacombMove(2); - if (_vm->_gyro->_room != kRoomCatacombs) + if (_vm->_avalot->_room != kRoomCatacombs) return; appearPed(0, 1); dawnDelay(); break; - case 13: // _vm->_gyro->special 13: transfer west in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_catacombX--; + case 13: // _vm->_avalot->special 13: transfer west in catacombs. + _vm->_avalot->dusk(); + _vm->_avalot->_catacombX--; catacombMove(3); - if (_vm->_gyro->_room != kRoomCatacombs) + if (_vm->_avalot->_room != kRoomCatacombs) return; appearPed(0, 2); dawnDelay(); @@ -877,7 +875,7 @@ void Animation::callSpecial(uint16 which) { * @remarks Originally called 'open_the_door' */ void Animation::openDoor(byte whither, byte ped, byte magicnum) { - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomOutsideYours: case kRoomOutsideNottsPub: case kRoomOutsideDucks: @@ -904,7 +902,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { case kRoomLusties: switch (magicnum) { case 14: - if (_vm->_gyro->_avvysInTheCupboard) { + if (_vm->_avalot->_avvysInTheCupboard) { hideInCupboard(); _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); @@ -935,12 +933,12 @@ void Animation::updateSpeed() { _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - if (_sprites[0]._speedX == _vm->_gyro->kRun) + if (_sprites[0]._speedX == _vm->_avalot->kRun) _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); else _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - if (_sprites[0]._speedX == _vm->_gyro->kRun) + if (_sprites[0]._speedX == _vm->_avalot->kRun) _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); else _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); @@ -977,7 +975,7 @@ void Animation::changeDirection(byte t, byte dir) { void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = &_sprites[sprNum]; - PedType *curPed = &_vm->_gyro->_peds[pedNum]; + PedType *curPed = &_vm->_avalot->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); changeDirection(sprNum, curPed->_direction); } @@ -1037,15 +1035,15 @@ void Animation::arrowProcs(byte tripnum) { _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); - _vm->_gyro->_userMovesAvvy = false; // Stop the user from moving him. + _vm->_avalot->_userMovesAvvy = false; // Stop the user from moving him. _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. - _vm->_gyro->_arrowInTheDoor = true; // So that we can pick it up. + _vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up. } } @@ -1088,21 +1086,21 @@ void Animation::spin(byte whichway, byte &tripnum) { if (_sprites[tripnum]._id == 2) return; // Not for Spludwick - _vm->_gyro->_geidaSpin += 1; - _vm->_gyro->_geidaTime = 20; - if (_vm->_gyro->_geidaSpin == 5) { + _vm->_avalot->_geidaSpin += 1; + _vm->_avalot->_geidaTime = 20; + if (_vm->_avalot->_geidaSpin == 5) { _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_gyro->_geidaSpin = 0; - _vm->_gyro->_geidaTime = 0; // knock out records + _vm->_avalot->_geidaSpin = 0; + _vm->_avalot->_geidaTime = 0; // knock out records } } } void Animation::geidaProcs(byte tripnum) { - if (_vm->_gyro->_geidaTime > 0) { - _vm->_gyro->_geidaTime--; - if (_vm->_gyro->_geidaTime == 0) - _vm->_gyro->_geidaSpin = 0; + if (_vm->_avalot->_geidaTime > 0) { + _vm->_avalot->_geidaTime--; + if (_vm->_avalot->_geidaTime == 0) + _vm->_avalot->_geidaSpin = 0; } if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { @@ -1178,7 +1176,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_menu->isActive() | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) + if (_vm->_menu->isActive() | _vm->_avalot->_onToolbar | _vm->_avalot->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) @@ -1222,7 +1220,7 @@ void Animation::animLink() { void Animation::stopWalking() { _sprites[0].stopWalk(); _direction = kDirStopped; - if (_vm->_gyro->_alive) + if (_vm->_avalot->_alive) _sprites[0]._stepNum = 1; } @@ -1231,16 +1229,16 @@ void Animation::stopWalking() { * @remarks Originally called 'hide_in_the_cupboard' */ void Animation::hideInCupboard() { - if (_vm->_gyro->_avvysInTheCupboard) { - if (_vm->_gyro->_wearing == Parser::kNothing) { + if (_vm->_avalot->_avvysInTheCupboard) { + if (_vm->_avalot->_wearing == Parser::kNothing) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; - _vm->_gyro->_userMovesAvvy = true; + _vm->_avalot->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); - _vm->_gyro->_avvysInTheCupboard = false; + _vm->_avalot->_avvysInTheCupboard = false; _vm->_sequence->firstShow(8); _vm->_sequence->thenShow(7); _vm->_sequence->startToClose(); @@ -1248,65 +1246,65 @@ void Animation::hideInCupboard() { } else { // Not hiding in the cupboard _sprites[0]._visible = false; - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_avvysInTheCupboard = true; + _vm->_avalot->_avvysInTheCupboard = true; _vm->_background->drawBackgroundSprite(-1, -1, 7); } } void Animation::flipRoom(byte room, byte ped) { assert((ped > 0) && (ped < 15)); - if (!_vm->_gyro->_alive) { + if (!_vm->_avalot->_alive) { // You can't leave the room if you're dead. _sprites[0]._moveX = 0; _sprites[0]._moveY = 0; // Stop him from moving. return; } - if ((room == kRoomDummy) && (_vm->_gyro->_room == kRoomLusties)) { + if ((room == kRoomDummy) && (_vm->_avalot->_room == kRoomLusties)) { hideInCupboard(); return; } - if ((_vm->_gyro->_jumpStatus > 0) && (_vm->_gyro->_room == kRoomInsideCardiffCastle)) { + if ((_vm->_avalot->_jumpStatus > 0) && (_vm->_avalot->_room == kRoomInsideCardiffCastle)) { // You can't *jump* out of Cardiff Castle! _sprites[0]._moveX = 0; return; } - _vm->_lucerna->exitRoom(_vm->_gyro->_room); - _vm->_lucerna->dusk(); + _vm->_avalot->exitRoom(_vm->_avalot->_room); + _vm->_avalot->dusk(); for (int16 i = 1; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick) _sprites[i].remove(); } // Deallocate sprite - if (_vm->_gyro->_room == kRoomLustiesRoom) - _vm->_gyro->_enterCatacombsFromLustiesRoom = true; + if (_vm->_avalot->_room == kRoomLustiesRoom) + _vm->_avalot->_enterCatacombsFromLustiesRoom = true; - _vm->_lucerna->enterRoom(room, ped); + _vm->_avalot->enterRoom(room, ped); appearPed(0, ped - 1); - _vm->_gyro->_enterCatacombsFromLustiesRoom = false; + _vm->_avalot->_enterCatacombsFromLustiesRoom = false; _oldDirection = _direction; _direction = _sprites[0]._facingDir; - _vm->_lucerna->drawDirection(); + _vm->_avalot->drawDirection(); - _vm->_lucerna->dawn(); + _vm->_avalot->dawn(); } bool Animation::inField(byte which) { - FieldType *curField = &_vm->_gyro->_fields[which]; + FieldType *curField = &_vm->_avalot->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } bool Animation::nearDoor() { - if (_vm->_gyro->_fieldNum < 8) { + if (_vm->_avalot->_fieldNum < 8) { // there ARE no doors here! return false; } @@ -1314,8 +1312,8 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - for (int i = 8; i < _vm->_gyro->_fieldNum; i++) { - FieldType *curField = &_vm->_gyro->_fields[i]; + for (int i = 8; i < _vm->_avalot->_fieldNum; i++) { + FieldType *curField = &_vm->_avalot->_fields[i]; if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) return true; } @@ -1324,7 +1322,7 @@ bool Animation::nearDoor() { } void Animation::handleMoveKey(const Common::Event &event) { - if (!_vm->_gyro->_userMovesAvvy) + if (!_vm->_avalot->_userMovesAvvy) return; if (_vm->_menu->_activeMenuItem._activeNow) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7dcf4a0e1f4f..673280cb4ba1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -64,14 +64,12 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _pingo; delete _dialogs; - delete _lucerna; delete _background; delete _sequence; delete _timer; delete _animation; delete _menu; delete _closing; - delete _gyro; delete _sound; } @@ -80,10 +78,8 @@ Common::ErrorCode AvalancheEngine::initialize() { _parser = new Parser(this); _avalot = new Avalot(this); - _gyro = new Gyro(this); _pingo = new Pingo(this); _dialogs = new Dialogs(this); - _lucerna = new Lucerna(this); _background = new Background(this); _sequence = new Sequence(this); _timer = new Timer(this); @@ -94,7 +90,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _graphics->init(); _dialogs->init(); - _lucerna->init(); + _avalot->init(); _parser->init(); return Common::kNoError; @@ -119,145 +115,145 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_animation->_direction); - sz.syncAsByte(_gyro->_carryNum); + sz.syncAsByte(_avalot->_carryNum); for (int i = 0; i < kObjectNum; i++) - sz.syncAsByte(_gyro->_objects[i]); - sz.syncAsSint16LE(_gyro->_dnascore); - sz.syncAsSint32LE(_gyro->_money); - sz.syncAsByte(_gyro->_room); - sz.syncAsByte(_gyro->_wearing); - sz.syncAsByte(_gyro->_sworeNum); - sz.syncAsByte(_gyro->_saveNum); - sz.syncBytes(_gyro->_roomCount, 100); - sz.syncAsByte(_gyro->_alcoholLevel); - sz.syncAsByte(_gyro->_playedNim); - sz.syncAsByte(_gyro->_wonNim); - sz.syncAsByte(_gyro->_wineState); - sz.syncAsByte(_gyro->_cwytalotGone); - sz.syncAsByte(_gyro->_passwordNum); - sz.syncAsByte(_gyro->_aylesIsAwake); - sz.syncAsByte(_gyro->_drawbridgeOpen); - sz.syncAsByte(_gyro->_avariciusTalk); - sz.syncAsByte(_gyro->_boughtOnion); - sz.syncAsByte(_gyro->_rottenOnion); - sz.syncAsByte(_gyro->_onionInVinegar); - sz.syncAsByte(_gyro->_givenToSpludwick); - sz.syncAsByte(_gyro->_brummieStairs); - sz.syncAsByte(_gyro->_cardiffQuestionNum); - sz.syncAsByte(_gyro->_passedCwytalotInHerts); - sz.syncAsByte(_gyro->_avvyIsAwake); - sz.syncAsByte(_gyro->_avvyInBed); - sz.syncAsByte(_gyro->_userMovesAvvy); - sz.syncAsByte(_gyro->_npcFacing); - sz.syncAsByte(_gyro->_givenBadgeToIby); - sz.syncAsByte(_gyro->_friarWillTieYouUp); - sz.syncAsByte(_gyro->_tiedUp); - sz.syncAsByte(_gyro->_boxContent); - sz.syncAsByte(_gyro->_talkedToCrapulus); - sz.syncAsByte(_gyro->_jacquesState); - sz.syncAsByte(_gyro->_bellsAreRinging); - sz.syncAsByte(_gyro->_standingOnDais); - sz.syncAsByte(_gyro->_takenPen); - sz.syncAsByte(_gyro->_arrowTriggered); - sz.syncAsByte(_gyro->_arrowInTheDoor); + sz.syncAsByte(_avalot->_objects[i]); + sz.syncAsSint16LE(_avalot->_dnascore); + sz.syncAsSint32LE(_avalot->_money); + sz.syncAsByte(_avalot->_room); + sz.syncAsByte(_avalot->_wearing); + sz.syncAsByte(_avalot->_sworeNum); + sz.syncAsByte(_avalot->_saveNum); + sz.syncBytes(_avalot->_roomCount, 100); + sz.syncAsByte(_avalot->_alcoholLevel); + sz.syncAsByte(_avalot->_playedNim); + sz.syncAsByte(_avalot->_wonNim); + sz.syncAsByte(_avalot->_wineState); + sz.syncAsByte(_avalot->_cwytalotGone); + sz.syncAsByte(_avalot->_passwordNum); + sz.syncAsByte(_avalot->_aylesIsAwake); + sz.syncAsByte(_avalot->_drawbridgeOpen); + sz.syncAsByte(_avalot->_avariciusTalk); + sz.syncAsByte(_avalot->_boughtOnion); + sz.syncAsByte(_avalot->_rottenOnion); + sz.syncAsByte(_avalot->_onionInVinegar); + sz.syncAsByte(_avalot->_givenToSpludwick); + sz.syncAsByte(_avalot->_brummieStairs); + sz.syncAsByte(_avalot->_cardiffQuestionNum); + sz.syncAsByte(_avalot->_passedCwytalotInHerts); + sz.syncAsByte(_avalot->_avvyIsAwake); + sz.syncAsByte(_avalot->_avvyInBed); + sz.syncAsByte(_avalot->_userMovesAvvy); + sz.syncAsByte(_avalot->_npcFacing); + sz.syncAsByte(_avalot->_givenBadgeToIby); + sz.syncAsByte(_avalot->_friarWillTieYouUp); + sz.syncAsByte(_avalot->_tiedUp); + sz.syncAsByte(_avalot->_boxContent); + sz.syncAsByte(_avalot->_talkedToCrapulus); + sz.syncAsByte(_avalot->_jacquesState); + sz.syncAsByte(_avalot->_bellsAreRinging); + sz.syncAsByte(_avalot->_standingOnDais); + sz.syncAsByte(_avalot->_takenPen); + sz.syncAsByte(_avalot->_arrowTriggered); + sz.syncAsByte(_avalot->_arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _gyro->_favouriteDrink.size(); + uint16 like2drinkSize = _avalot->_favouriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _gyro->_favouriteDrink[i]; + char actChr = _avalot->_favouriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _gyro->_favouriteSong.size(); + uint16 favourite_songSize = _avalot->_favouriteSong.size(); sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _gyro->_favouriteSong[i]; + char actChr = _avalot->_favouriteSong[i]; sz.syncAsByte(actChr); } - uint16 worst_place_on_earthSize = _gyro->_worstPlaceOnEarth.size(); + uint16 worst_place_on_earthSize = _avalot->_worstPlaceOnEarth.size(); sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr = _gyro->_worstPlaceOnEarth[i]; + char actChr = _avalot->_worstPlaceOnEarth[i]; sz.syncAsByte(actChr); } - uint16 spare_eveningSize = _gyro->_spareEvening.size(); + uint16 spare_eveningSize = _avalot->_spareEvening.size(); sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr = _gyro->_spareEvening[i]; + char actChr = _avalot->_spareEvening[i]; sz.syncAsByte(actChr); } } else { - if (!_gyro->_favouriteDrink.empty()) - _gyro->_favouriteDrink.clear(); + if (!_avalot->_favouriteDrink.empty()) + _avalot->_favouriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _gyro->_favouriteDrink += actChr; + _avalot->_favouriteDrink += actChr; } - if (!_gyro->_favouriteSong.empty()) - _gyro->_favouriteSong.clear(); + if (!_avalot->_favouriteSong.empty()) + _avalot->_favouriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _gyro->_favouriteSong += actChr; + _avalot->_favouriteSong += actChr; } - if (!_gyro->_worstPlaceOnEarth.empty()) - _gyro->_worstPlaceOnEarth.clear(); + if (!_avalot->_worstPlaceOnEarth.empty()) + _avalot->_worstPlaceOnEarth.clear(); uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { sz.syncAsByte(actChr); - _gyro->_worstPlaceOnEarth += actChr; + _avalot->_worstPlaceOnEarth += actChr; } - if (!_gyro->_spareEvening.empty()) - _gyro->_spareEvening.clear(); + if (!_avalot->_spareEvening.empty()) + _avalot->_spareEvening.clear(); uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { sz.syncAsByte(actChr); - _gyro->_spareEvening += actChr; + _avalot->_spareEvening += actChr; } } - sz.syncAsSint32LE(_gyro->_totalTime); - sz.syncAsByte(_gyro->_jumpStatus); - sz.syncAsByte(_gyro->_mushroomGrowing); - sz.syncAsByte(_gyro->_spludwickAtHome); - sz.syncAsByte(_gyro->_lastRoom); - sz.syncAsByte(_gyro->_lastRoomNotMap); - sz.syncAsByte(_gyro->_crapulusWillTell); - sz.syncAsByte(_gyro->_enterCatacombsFromLustiesRoom); - sz.syncAsByte(_gyro->_teetotal); - sz.syncAsByte(_gyro->_malagauche); - sz.syncAsByte(_gyro->_drinking); - sz.syncAsByte(_gyro->_enteredLustiesRoomAsMonk); - sz.syncAsByte(_gyro->_catacombX); - sz.syncAsByte(_gyro->_catacombY); - sz.syncAsByte(_gyro->_avvysInTheCupboard); - sz.syncAsByte(_gyro->_geidaFollows); - sz.syncAsByte(_gyro->_geidaSpin); - sz.syncAsByte(_gyro->_geidaTime); - sz.syncAsByte(_gyro->_nextBell); - sz.syncAsByte(_gyro->_givenPotionToGeida); - sz.syncAsByte(_gyro->_lustieIsAsleep); - sz.syncAsByte(_gyro->_flipToWhere); - sz.syncAsByte(_gyro->_flipToPed); - sz.syncAsByte(_gyro->_beenTiedUp); - sz.syncAsByte(_gyro->_sittingInPub); - sz.syncAsByte(_gyro->_spurgeTalkCount); - sz.syncAsByte(_gyro->_metAvaroid); - sz.syncAsByte(_gyro->_takenMushroom); - sz.syncAsByte(_gyro->_givenPenToAyles); - sz.syncAsByte(_gyro->_askedDogfoodAboutNim); + sz.syncAsSint32LE(_avalot->_totalTime); + sz.syncAsByte(_avalot->_jumpStatus); + sz.syncAsByte(_avalot->_mushroomGrowing); + sz.syncAsByte(_avalot->_spludwickAtHome); + sz.syncAsByte(_avalot->_lastRoom); + sz.syncAsByte(_avalot->_lastRoomNotMap); + sz.syncAsByte(_avalot->_crapulusWillTell); + sz.syncAsByte(_avalot->_enterCatacombsFromLustiesRoom); + sz.syncAsByte(_avalot->_teetotal); + sz.syncAsByte(_avalot->_malagauche); + sz.syncAsByte(_avalot->_drinking); + sz.syncAsByte(_avalot->_enteredLustiesRoomAsMonk); + sz.syncAsByte(_avalot->_catacombX); + sz.syncAsByte(_avalot->_catacombY); + sz.syncAsByte(_avalot->_avvysInTheCupboard); + sz.syncAsByte(_avalot->_geidaFollows); + sz.syncAsByte(_avalot->_geidaSpin); + sz.syncAsByte(_avalot->_geidaTime); + sz.syncAsByte(_avalot->_nextBell); + sz.syncAsByte(_avalot->_givenPotionToGeida); + sz.syncAsByte(_avalot->_lustieIsAsleep); + sz.syncAsByte(_avalot->_flipToWhere); + sz.syncAsByte(_avalot->_flipToPed); + sz.syncAsByte(_avalot->_beenTiedUp); + sz.syncAsByte(_avalot->_sittingInPub); + sz.syncAsByte(_avalot->_spurgeTalkCount); + sz.syncAsByte(_avalot->_metAvaroid); + sz.syncAsByte(_avalot->_takenMushroom); + sz.syncAsByte(_avalot->_givenPenToAyles); + sz.syncAsByte(_avalot->_askedDogfoodAboutNim); #if 0 @@ -334,7 +330,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return (!_gyro->_seeScroll && _gyro->_alive); + return (!_avalot->_seeScroll && _avalot->_alive); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { @@ -380,7 +376,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) { } bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! - return (!_gyro->_seeScroll); + return (!_avalot->_seeScroll); } Common::Error AvalancheEngine::loadGameState(int slot) { @@ -429,29 +425,29 @@ bool AvalancheEngine::loadGame(const int16 slot) { synchronize(sz); delete f; - _gyro->_isLoaded = true; - _gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. + _avalot->_isLoaded = true; + _avalot->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. - if (_gyro->_holdTheDawn) { - _gyro->_holdTheDawn = false; - _lucerna->dawn(); + if (_avalot->_holdTheDawn) { + _avalot->_holdTheDawn = false; + _avalot->dawn(); } _background->forgetBackgroundSprites(); - _lucerna->minorRedraw(); + _avalot->minorRedraw(); _menu->setup(); - _gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; - _gyro->_alive = true; - _lucerna->refreshObjectList(); + _avalot->_whereIs[Avalot::kPeopleAvalot - 150] = _avalot->_room; + _avalot->_alive = true; + _avalot->refreshObjectList(); _animation->updateSpeed(); - _lucerna->drawDirection(); - _gyro->_onToolbar = false; + _avalot->drawDirection(); + _avalot->_onToolbar = false; _animation->animLink(); _background->updateBackgroundSprites(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, - Dialogs::kControlNewLine, Dialogs::kControlNewLine, _gyro->_roomnName.c_str(), Dialogs::kControlNewLine, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, _avalot->_roomnName.c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _dialogs->displayText(tmpStr); @@ -468,7 +464,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { }; Common::String month = months[m]; - Common::String day = _gyro->intToStr(d); + Common::String day = _avalot->intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) switch (d % 10) { @@ -485,7 +481,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day += "th"; } - return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); + return day + ' ' + month + ' ' + _avalot->intToStr(y + 1900); } void AvalancheEngine::updateEvents() { @@ -494,10 +490,10 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _lucerna->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). + _avalot->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). break; case Common::EVENT_LBUTTONUP: - _lucerna->_holdLeftMouse = false; // Same as above. + _avalot->_holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: _avalot->handleKeyDown(event); @@ -541,7 +537,7 @@ Common::Error AvalancheEngine::run() { //} #endif - } while (!_gyro->_letMeOut && !shouldQuit()); + } while (!_avalot->_letMeOut && !shouldQuit()); return Common::kNoError; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 781031c9c1ee..289cf60d30ba 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -32,10 +32,8 @@ #include "avalanche/graphics.h" #include "avalanche/parser.h" #include "avalanche/avalot.h" -#include "avalanche/gyro.h" #include "avalanche/pingo.h" #include "avalanche/dialogs.h" -#include "avalanche/lucerna.h" #include "avalanche/background.h" #include "avalanche/sequence.h" #include "avalanche/timer.h" @@ -67,10 +65,8 @@ class AvalancheEngine : public Engine { Parser *_parser; Avalot *_avalot; - Gyro *_gyro; Pingo *_pingo; Dialogs *_dialogs; - Lucerna *_lucerna; Background *_background; Sequence *_sequence; Timer *_timer; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5dc7fcfcba1f..e514d7933d0b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -30,10 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/graphics.h" #include "avalanche/avalot.h" -#include "avalanche/gyro.h" #include "avalanche/animation.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" #include "avalanche/dialogs.h" #include "avalanche/menu.h" #include "avalanche/pingo.h" @@ -41,14 +38,232 @@ #include "avalanche/background.h" #include "avalanche/closing.h" +#include "common/file.h" +#include "common/random.h" #include "common/str.h" #include "common/textconsole.h" #include "common/config-manager.h" namespace Avalanche { -Avalot::Avalot(AvalancheEngine *vm) { +const char *Avalot::kVersionNum = "1.30"; +const char *Avalot::kCopyright = "1995"; + +const MouseHotspotType Avalot::kMouseHotSpots[9] = { + {8,0}, // 1 - up-arrow + {0,0}, // 2 - screwdriver + {15,6}, // 3 - right-arrow + {0,0}, // 4 - fletch + {8,7}, // 5 - hourglass + {4,0}, // 6 - TTHand + {8,5}, // 7- Mark's crosshairs + {8,7}, // 8- I-beam + {0,0} // 9 - question mark +}; + +// Art gallery at 2,1; notice about this at 2,2. +const int32 Avalot::kCatacombMap[8][8] = { + // Geida's room + // 1 2 3 | 4 5 6 7 8 + {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, + {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, + {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette + {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, + {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here + {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} +}; +// vv Stairs trap. + +/* Explanation: $NSEW. + Nibble N: North. + 0 = no connection, + 2 = (left,) middle(, right) door with left-hand handle, + 5 = (left,) middle(, right) door with right-hand handle, + 7 = arch, + 8 = arch and 1 north of it, + 9 = arch and 2 north of it, + D = no connection + WINDOW, + E = no connection + TORCH, + F = recessed door (to Geida's room.) + + Nibble S: South. + 0 = no connection, + 1,2,3 = left, middle, right door. + + Nibble E: East. + 0 = no connection (wall), + 1 = no connection (wall + window), + 2 = wall with door, + 3 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. + + Nibble W: West. + 0 = no connection (wall), + 1 = no connection (wall + shield), + 2 = wall with door, + 3 = wall with door and shield, + 4 = no connection (window), + 5 = wall with door and window, + 6 = wall with candles, + 7 = wall with door and candles, + F = straight-through corridor. */ + +const char Avalot::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; + +// A quasiped defines how people who aren't sprites talk. For example, quasiped +// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. +const QuasipedType Avalot::kQuasipeds[16] = { +//_whichPed, _foregroundColor, _room, _backgroundColor, _who + {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). + {2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). + {2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). + {2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). + {3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19). + {4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47). + {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). +}; + +const uint16 Avalot::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; + +const TuneType Avalot::kTune = { + kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, + kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, + kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher +}; + +byte Avalot::_whereIs[29] = { + // The Lads + kRoomYours, // Avvy + kRoomSpludwicks, // Spludwick + kRoomOutsideYours, // Crapulus + kRoomDucks, // Duck - r__DucksRoom's not defined yet. + kRoomArgentPub, // Malagauche + kRoomRobins, // Friar Tuck. + kRoomDummy, // Robin Hood - can't meet him at the start. + kRoomBrummieRoad, // Cwytalot + kRoomLustiesRoom, // Baron du Lustie. + kRoomOutsideCardiffCastle, // The Duke of Cardiff. + kRoomArgentPub, // Dogfood + kRoomOutsideDucks, // Trader + kRoomArgentPub, // Ibythneth + kRoomAylesOffice, // Ayles + kRoomNottsPub, // Port + kRoomNottsPub, // Spurge + kRoomMusicRoom, // Jacques + 0, 0, 0, 0, 0, 0, 0, 0, + // The Lasses + kRoomYours, // Arkata + kRoomGeidas, // Geida + kRoomDummy, // nobody allocated here! + kRoomWiseWomans // The Wise Woman. +}; + +Clock::Clock(AvalancheEngine *vm) { + _vm = vm; + _oldHour = _oldHourAngle = _oldMinute = 17717; +} + +void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. + TimeDate t; + _vm->_system->getTimeAndDate(t); + _hour = t.tm_hour; + _minute = t.tm_min; + _second = t.tm_sec; + + _hourAngle = (_hour % 12) * 30 + _minute / 2; + + if (_oldHour != _hour) { + plotHands(); + chime(); + } + + if (_oldMinute != _minute) + plotHands(); + + if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { + Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ + "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", + Dialogs::kControlNewLine, Dialogs::kControlNewLine); + _vm->_dialogs->displayText(tmpStr); + } + _oldHour = _hour; + _oldHourAngle = _hourAngle; + _oldMinute = _minute; +} + +void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { + if (angle > 900) { + endPoint.x = 177; + return; + } + + endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); +} + +void Clock::drawHand(const Common::Point &endPoint, byte color) { + if (endPoint.x == 177) + return; + + _vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); +} + +void Clock::plotHands() { + calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); + calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); + drawHand(_clockHandHour, kColorBrown); + drawHand(_clockHandMinute, kColorBrown); + + calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); + calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); + drawHand(_clockHandHour, kColorYellow); + drawHand(_clockHandMinute, kColorYellow); +} + +void Clock::chime() { + warning("STUB: Clock::chime()"); +} + + +Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogation(0) { _vm = vm; + + // Needed because of Lucerna::load_also() + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) + _also[i][j] = 0; + } + + _totalTime = 0; +} + +Avalot::~Avalot() { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { + if (_also[i][j] != 0) { + delete _also[i][j]; + _also[i][j] = 0; + } + } + } + + for (int i = 0; i < 9; i++) { + _digits[i].free(); + _directions[i].free(); + } + _digits[9].free(); } void Avalot::handleKeyDown(Common::Event &event) { @@ -99,9 +314,9 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_HOME: case Common::KEYCODE_END: case Common::KEYCODE_KP5: - if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) { + if (_alive && _avvyIsAwake) { _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. - _vm->_lucerna->drawDirection(); + drawDirection(); return; } case Common::KEYCODE_BACKSPACE: @@ -114,46 +329,46 @@ void Avalot::handleKeyDown(Common::Event &event) { break; } - _vm->_lucerna->drawDirection(); + drawDirection(); } void Avalot::setup() { - _vm->_gyro->init(); + init(); _vm->_dialogs->reset(); - _vm->_lucerna->dusk(); - _vm->_lucerna->loadDigits(); + dusk(); + loadDigits(); _vm->_parser->_inputTextPos = 0; _vm->_parser->_quote = true; - _vm->_lucerna->drawToolbar(); + drawToolbar(); _vm->_dialogs->setReadyLight(2); _vm->_animation->_direction = Animation::kDirStopped; _vm->_animation->loadAnims(); - _vm->_lucerna->dawn(); + dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; + _vm->_animation->_sprites[0]._speedX = kWalk; _vm->_animation->updateSpeed(); _vm->_menu->init(); int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { - _vm->_gyro->_thinks = 2; // You always have money. - _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); + _thinks = 2; // You always have money. + thinkAbout(Avalot::kObjectMoney, Avalot::kThing); _vm->loadGame(loadSlot); } else { - _vm->_gyro->_isLoaded = false; // Set to true in _vm->loadGame(). - _vm->_gyro->newGame(); + _isLoaded = false; // Set to true in _vm->loadGame(). + newGame(); - _vm->_gyro->_soundFx = !_vm->_gyro->_soundFx; - _vm->_lucerna->fxToggle(); - _vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); + _soundFx = !_soundFx; + fxToggle(); + thinkAbout(Avalot::kObjectMoney, Avalot::kThing); _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. } @@ -167,21 +382,21 @@ void Avalot::runAvalot() { _vm->updateEvents(); // The event handler. - _vm->_lucerna->_clock.update(); + _clock.update(); _vm->_menu->update(); _vm->_background->updateBackgroundSprites(); _vm->_animation->animLink(); - _vm->_lucerna->checkClick(); + checkClick(); _vm->_timer->updateTimer(); #ifdef DEBUG - for (int i = 0; i < _vm->_gyro->_lineNum; i++) { - LineType *curLine = &_vm->_gyro->_lines[i]; + for (int i = 0; i < _lineNum; i++) { + LineType *curLine = &_lines[i]; _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); } - for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { - FieldType *curField = &_vm->_gyro->_fields[i]; + for (int i = 0; i < _fieldNum; i++) { + FieldType *curField = &_fields[i]; if (curField->_x1 < 640) _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } @@ -191,8 +406,8 @@ void Avalot::runAvalot() { uint32 delay = _vm->_system->getMillis() - beginLoop; if (delay <= 55) - _vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (!_vm->_gyro->_letMeOut && !_vm->shouldQuit()); + _vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). + } while (!_letMeOut && !_vm->shouldQuit()); //if (logging) // close(logfile); @@ -201,4 +416,1507 @@ void Avalot::runAvalot() { _vm->_closing->exitGame(); } +void Avalot::init() { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) + _also[i][j] = 0; + } + +#if 0 + if (_vm->_enhanced->atbios) + atkey = "f1"; + else + atkey = "alt-"; +#endif + + _mouse = kMouseStateNo; + _letMeOut = false; + _holdTheDawn = true; + _currentMouse = 177; + _dropsOk = true; + _mouseText = ""; + _cheat = false; + _cp = 0; + _ledStatus = 177; + _defaultLed = 2; + _enidFilename = ""; // Undefined. + for (int i = 0; i < 3; i++) + _scoreToDisplay[i] = -1; // Impossible digits. + _holdTheDawn = false; + + setMousePointerWait(); + CursorMan.showMouse(true); +} + +/** + * Call a given Verb + * @remarks Originally called 'callverb' + */ +void Avalot::callVerb(byte id) { + if (id == _vm->_parser->kPardon) { + Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ + "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ + "what the current setting of this key is."); + _vm->_dialogs->displayText(tmpStr); + } else { + _weirdWord = false; + _vm->_parser->_polite = true; + _vm->_parser->_verb = id; + _vm->_parser->doThat(); + } +} + +void Avalot::drawAlsoLines() { + CursorMan.showMouse(false); + + _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); + _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + + for (int i = 0; i < _lineNum; i++) { + // We had to check if the lines are within the borders of the screen. + if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _vm->_graphics->kScreenHeight) + && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); + } + + CursorMan.showMouse(true); +} + +/** + * Check is it's possible to give something to Spludwick + * @remarks Originally called 'nextstring' + */ +Common::String Avalot::readAlsoStringFromFile() { + Common::String str; + byte length = file.readByte(); + for (int i = 0; i < length; i++) + str += file.readByte(); + return str; +} + +void Avalot::scram(Common::String &str) { + for (uint i = 0; i < str.size(); i++) + str.setChar(str[i] ^ 177, i); +} + +void Avalot::unScramble() { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { + if (_also[i][j] != 0) + scram(*_also[i][j]); + } + } + scram(_listen); + scram(_flags); +} + +void Avalot::loadAlso(byte num) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { + if (_also[i][j] != 0) { + delete _also[i][j]; + _also[i][j] = 0; + } + } + } + Common::String filename; + filename = Common::String::format("also%d.avd", num); + if (!file.open(filename)) + error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + + file.seek(128); + + byte alsoNum = file.readByte(); + Common::String tmpStr; + for (int i = 0; i <= alsoNum; i++) { + for (int j = 0; j < 2; j++) { + _also[i][j] = new Common::String; + *_also[i][j] = readAlsoStringFromFile(); + } + tmpStr = Common::String::format("\x9D%s\x9D", _also[i][0]->c_str()); + *_also[i][0] = tmpStr; + } + + memset(_lines, 0xFF, sizeof(_lines)); + + _lineNum = file.readByte(); + for (int i = 0; i < _lineNum; i++) { + LineType *curLine = &_lines[i]; + curLine->_x1 = file.readSint16LE(); + curLine->_y1 = file.readSint16LE(); + curLine->_x2 = file.readSint16LE(); + curLine->_y2 = file.readSint16LE(); + curLine->_color = file.readByte(); + } + + memset(_peds, 177, sizeof(_peds)); + byte pedNum = file.readByte(); + for (int i = 0; i < pedNum; i++) { + PedType *curPed = &_peds[i]; + curPed->_x = file.readSint16LE(); + curPed->_y = file.readSint16LE(); + curPed->_direction = file.readByte(); + } + + _fieldNum = file.readByte(); + for (int i = 0; i < _fieldNum; i++) { + FieldType *curField = &_fields[i]; + curField->_x1 = file.readSint16LE(); + curField->_y1 = file.readSint16LE(); + curField->_x2 = file.readSint16LE(); + curField->_y2 = file.readSint16LE(); + } + + for (int i = 0; i < 15; i++) { + MagicType *magic = &_magics[i]; + magic->_operation = file.readByte(); + magic->_data = file.readUint16LE(); + } + + for (int i = 0; i < 7; i++) { + MagicType *portal = &_portals[i]; + portal->_operation = file.readByte(); + portal->_data = file.readUint16LE(); + } + + _flags.clear(); + for (int i = 0; i < 26; i++) + _flags += file.readByte(); + + int16 listen_length = file.readByte(); + _listen.clear(); + for (int i = 0; i < listen_length; i++) + _listen += file.readByte(); + + drawAlsoLines(); + + file.close(); + unScramble(); + for (int i = 0; i <= alsoNum; i++) { + tmpStr = Common::String::format(",%s,", _also[i][0]->c_str()); + *_also[i][0] = tmpStr; + } +} + +void Avalot::loadRoom(byte num) { + CursorMan.showMouse(false); + + _vm->_graphics->fleshColors(); + + Common::String filename = Common::String::format("place%d.avd", num); + if (!file.open(filename)) + error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + + file.seek(146); + if (!_roomnName.empty()) + _roomnName.clear(); + for (int i = 0; i < 30; i++) { + char actChar = file.readByte(); + if ((32 <= actChar) && (actChar <= 126)) + _roomnName += actChar; + } + // Compression method byte follows this... + + file.seek(177); + + _vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); + _vm->_graphics->refreshBackground(); + + file.close(); + + loadAlso(num); + _vm->_background->loadBackgroundSprites(num); + CursorMan.showMouse(true); +} + +void Avalot::zoomOut(int16 x, int16 y) { + warning("STUB: Avalot::zoomout()"); +} + +void Avalot::findPeople(byte room) { + for (int i = 1; i < 29; i++) { + if (_whereIs[i] == room) { + if (i < 25) + _him = i + 150; + else + _her = i + 150; + } + } +} + +void Avalot::exitRoom(byte x) { + _vm->_sound->stopSound(); + _vm->_background->forgetBackgroundSprites(); + _seeScroll = true; // This stops the trippancy system working over the length of this procedure. + + switch (x) { + case kRoomSpludwicks: + _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); + _avariciusTalk = 0; + // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. + break; + case kRoomBridge: + if (_drawbridgeOpen > 0) { + _drawbridgeOpen = 4; // Fully open. + _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); + } + break; + case kRoomOutsideCardiffCastle: + _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); + break; + case kRoomRobins: + _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); + break; + } + + _interrogation = 0; // Leaving the room cancels all the questions automatically. + _seeScroll = false; // Now it can work again! + + _lastRoom = _room; + if (_room != kRoomMap) + _lastRoomNotMap = _room; +} + + +/** + * Only when entering a NEW town! Not returning to the last one, + * but choosing another from the map. + * @remarks Originally called 'new_town' + */ +void Avalot::enterNewTown() { + _vm->_menu->setup(); + + switch (_room) { + case kRoomOutsideNottsPub: // Entry into Nottingham. + if ((_roomCount[kRoomRobins] > 0) && (_beenTiedUp) && (!_takenMushroom)) + _mushroomGrowing = true; + break; + case kRoomWiseWomans: // Entry into Argent. + if (_talkedToCrapulus && (!_lustieIsAsleep)) { + _spludwickAtHome = !((_roomCount[kRoomWiseWomans] % 3) == 1); + _crapulusWillTell = !_spludwickAtHome; + } else { + _spludwickAtHome = true; + _crapulusWillTell = false; + } + if (_boxContent == Avalot::kObjectWine) + _wineState = 3; // Vinegar + break; + } + + if ((_room != kRoomOutsideDucks) && (_objects[Avalot::kObjectOnion - 1]) && !(_onionInVinegar)) + _rottenOnion = true; // You're holding the onion +} + +void Avalot::putGeidaAt(byte whichPed, byte ped) { + if (ped == 0) + return; + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + + spr1->init(5, false, _vm->_animation); // load Geida + _vm->_animation->appearPed(1, whichPed); + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcGeida; +} + +void Avalot::enterRoom(byte room, byte ped) { + _seeScroll = true; // This stops the trippancy system working over the length of this procedure. + + findPeople(room); + _room = room; + if (ped != 0) + _roomCount[room]++; + + loadRoom(room); + + if ((_roomCount[room] == 0) && (!setFlag('S'))) + incScore(1); + + _whereIs[Avalot::kPeopleAvalot - 150] = _room; + + if (_geidaFollows) + _whereIs[Avalot::kPeopleGeida - 150] = room; + + _roomTime = 0; + + + if ((_lastRoom == kRoomMap) && (_lastRoomNotMap != _room)) + enterNewTown(); + + switch (room) { + case kRoomYours: + if (_avvyInBed) { + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_graphics->refreshBackground(); + _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); + } + break; + + case kRoomOutsideYours: + if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + if (!_talkedToCrapulus) { + _whereIs[Avalot::kPeopleCrapulus - 150] = kRoomOutsideYours; + spr1->init(8, false, _vm->_animation); // load Crapulus + + if (_roomCount[kRoomOutsideYours] == 1) { + _vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. + spr1->walkTo(4); // Walks up to greet you. + } else { + _vm->_animation->appearPed(1, 4); // Starts where he was before. + spr1->_facingDir = Animation::kDirLeft; + } + + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. + + } else + _whereIs[Avalot::kPeopleCrapulus - 150] = kRoomNowhere; + + if (_crapulusWillTell) { + spr1->init(8, false, _vm->_animation); + _vm->_animation->appearPed(1, 1); + spr1->walkTo(3); + _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); + _crapulusWillTell = false; + } + } + break; + + case kRoomOutsideSpludwicks: + if ((_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { + _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); + _spludwickAtHome = true; + } + break; + + case kRoomSpludwicks: + if (_spludwickAtHome) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + if (ped > 0) { + spr1->init(2, false, _vm->_animation); // load Spludwick + _vm->_animation->appearPed(1, 1); + _whereIs[Avalot::kPeopleSpludwick - 150] = kRoomSpludwicks; + } + + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcGeida; + } else + _whereIs[Avalot::kPeopleSpludwick - 150] = kRoomNowhere; + break; + + case kRoomBrummieRoad: + if (_geidaFollows) + putGeidaAt(4, ped); + if (_cwytalotGone) { + _magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; + _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomNowhere; + } else { + if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(4, false, _vm->_animation); // 4 = Cwytalot + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFollowAvvyY; + _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomBrummieRoad; + + if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... + _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... + spr1->walkTo(3); // ...and he walks up... + } else { + // You've been here before. + _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... + spr1->_facingDir = Animation::kDirLeft; + } + } + } + break; + + case kRoomArgentRoad: + if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again + _vm->_animation->appearPed(1, 0); + spr1->walkTo(1); + spr1->_vanishIfStill = true; + _passedCwytalotInHerts = true; + // whereis[#157] = r__Nowhere; // can we fit this in? + _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); + } + break; + + case kRoomBridge: + if (_drawbridgeOpen == 4) { // open + _vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge + _vm->_graphics->refreshBackground(); + _magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. + } + if (_geidaFollows) + putGeidaAt(ped + 2, ped); // load Geida + break; + + case kRoomRobins: + if (ped > 0) { + if (!_beenTiedUp) { + // A welcome party... or maybe not... + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(6, false, _vm->_animation); + _vm->_animation->appearPed(1, 1); + spr1->walkTo(2); + _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); + } + } + + if (_beenTiedUp) { + _whereIs[Avalot::kPeopleRobinHood - 150] = 0; + _whereIs[Avalot::kPeopleFriarTuck - 150] = 0; + } + + if (_tiedUp) + _vm->_background->drawBackgroundSprite(-1, -1, 1); + + if (!_mushroomGrowing) + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_graphics->refreshBackground(); + break; + + case kRoomOutsideCardiffCastle: + if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + switch (_cardiffQuestionNum) { + case 0 : // You've answered NONE of his questions. + spr1->init(9, false, _vm->_animation); + _vm->_animation->appearPed(1, 1); + spr1->walkTo(2); + _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); + break; + case 5 : + _magics[1]._operation = Avalot::kMagicNothing; + break; // You've answered ALL his questions. => nothing happens. + default: // You've answered SOME of his questions. + spr1->init(9, false, _vm->_animation); + _vm->_animation->appearPed(1, 2); + spr1->_facingDir = Animation::kDirRight; + _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); + } + } + + if (_cardiffQuestionNum < 5) + _interrogation = _cardiffQuestionNum; + else + _interrogation = 0; + break; + + case kRoomMap: + // You're entering the map. + dawn(); + if (ped > 0) + zoomOut(_peds[ped]._x, _peds[ped]._y); + + if ((_objects[Avalot::kObjectWine - 1]) && (_wineState != 3)) { + _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! + _objects[Avalot::kObjectWine - 1] = false; + refreshObjectList(); + } + + _vm->_dialogs->displayScrollChain('q', 69); + break; + + case kRoomCatacombs: + if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { + + switch (ped) { + case 3: // Enter from oubliette + _catacombX = 8; + _catacombY = 4; + break; + case 5: // Enter from du Lustie's + _catacombX = 8; + _catacombY = 7; + break; + case 6: // Enter from Geida's + _catacombX = 4; + _catacombY = 1; + break; + } + + _enterCatacombsFromLustiesRoom = true; + _vm->_animation->catacombMove(ped); + _enterCatacombsFromLustiesRoom = false; + } + break; + + case kRoomArgentPub: + if (_wonNim) + _vm->_background->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. + _malagauche = 0; // Ready to boot Malagauche + if (_givenBadgeToIby) { + _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->drawBackgroundSprite(-1, -1, 8); + } + _vm->_graphics->refreshBackground(); + break; + + case kRoomLustiesRoom: + _npcFacing = 1; // du Lustie. + if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes + _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); + else if (!_enteredLustiesRoomAsMonk) // already + // Presumably, Avvy dressed as a monk. + _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); + + if (_geidaFollows) { + putGeidaAt(4, ped); + if (_lustieIsAsleep) { + _vm->_background->drawBackgroundSprite(-1, -1, 4); + _vm->_graphics->refreshBackground(); + } + } + break; + + case kRoomMusicRoom: + if (_jacquesState > 0) { + _jacquesState = 5; + _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_graphics->refreshBackground(); + _vm->_background->drawBackgroundSprite(-1, -1, 3); + _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; + _whereIs[Avalot::kPeopleJacques - 150] = 0; + } + if (ped != 0) { + _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(6); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); + } + break; + + case kRoomOutsideNottsPub: + if (ped == 2) { + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(3); + _vm->_sequence->thenShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(4); + _vm->_sequence->startToClose(); + } + break; + + case kRoomOutsideArgentPub: + if (ped == 2) { + _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(6); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); + } + break; + + case kRoomWiseWomans: { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(11, false, _vm->_animation); + if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { + _vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. + spr1->walkTo(3); // Walks up to greet you. + } else { + _vm->_animation->appearPed(1, 3); // Starts where she was before. + spr1->_facingDir = Animation::kDirLeft; + } + + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. + } + break; + + case kRoomInsideCardiffCastle: + if (ped > 0) { + _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. + _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(1); + if (_arrowInTheDoor) + _vm->_sequence->thenShow(3); + else + _vm->_sequence->thenShow(2); + + if (_takenPen) + _vm->_background->drawBackgroundSprite(-1, -1, 3); + + _vm->_sequence->startToClose(); + } else { + _vm->_background->drawBackgroundSprite(-1, -1, 0); + if (_arrowInTheDoor) + _vm->_background->drawBackgroundSprite(-1, -1, 2); + else + _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_graphics->refreshBackground(); + } + break; + + case kRoomAvvysGarden: + if (ped == 1) { + _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(3); + _vm->_sequence->startToClose(); + } + break; + + case kRoomEntranceHall: + case kRoomInsideAbbey: + case kRoomYourHall: + if (ped == 2) { +#if 0 + // It was the original: + _vm->_celer->show_one(-1, -1, 2); + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(3); + _vm->_sequence->start_to_close(); +#endif + + _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(3); + _vm->_sequence->startToClose(); + } + break; + + case kRoomAylesOffice: + if (_aylesIsAwake) + _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_graphics->refreshBackground(); + break; // Ayles awake. + + case kRoomGeidas: + putGeidaAt(1, ped); + break; // load Geida + + case kRoomEastHall: + case kRoomWestHall: + if (_geidaFollows) + putGeidaAt(ped + 1, ped); + break; + + case kRoomLusties: + if (_geidaFollows) + putGeidaAt(ped + 5, ped); + break; + + case kRoomNottsPub: + if (_sittingInPub) + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _npcFacing = 1; // Port. + break; + + case kRoomOutsideDucks: + if (ped == 2) { + // Shut the door + _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->firstShow(3); + _vm->_sequence->firstShow(2); + _vm->_sequence->thenShow(1); + _vm->_sequence->thenShow(4); + _vm->_sequence->startToClose(); + } + break; + + case kRoomDucks: + _npcFacing = 1; // Duck. + break; + } + + _seeScroll = false; // Now it can work again! + _isLoaded = false; +} + +void Avalot::thinkAbout(byte object, bool type) { + const int16 picSize = 966; + + _thinks = object; + object--; + + setMousePointerWait(); + + if (type == Avalot::kThing) { + if (!file.open("thinks.avd")) + error("AVALANCHE: Lucerna: File not found: thinks.avd"); + } else { // Avalot::kPerson + if (!file.open("folk.avd")) + error("AVALANCHE: Lucerna: File not found: folk.avd"); + + object -= 149; + if (object >= 25) + object -= 8; + if (object == 20) + object--; // Last time... + } + + CursorMan.showMouse(false); + + file.seek(object * picSize + 65); + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); + + picture.free(); + file.close(); + + CursorMan.showMouse(true); + _thinkThing = type; +} + +void Avalot::loadDigits() { // Load the scoring digits & rwlites + const byte digitsize = 134; + const byte rwlitesize = 126; + + if (!file.open("digit.avd")) + error("AVALANCHE: Lucerna: File not found: digit.avd"); + + for (int i = 0; i < 10; i++) { + file.seek(i * digitsize); + _digits[i] = _vm->_graphics->loadPictureGraphic(file); + } + + for (int i = 0; i < 9; i++) { + file.seek(10 * digitsize + i * rwlitesize); + _directions[i] = _vm->_graphics->loadPictureGraphic(file); + } + + file.close(); +} + +void Avalot::drawToolbar() { + if (!file.open("useful.avd")) + error("AVALANCHE: Lucerna: File not found: useful.avd"); + + file.seek(40); + + CursorMan.showMouse(false); + ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); + + picture.free(); + file.close(); + + CursorMan.showMouse(true); + _vm->_animation->_oldDirection = 177; + drawDirection(); +} + +void Avalot::drawScore() { + uint16 score = _dnascore; + int8 numbers[3] = {0, 0, 0}; + for (int i = 0; i < 2; i++) { + byte divisor = 1; + for (int j = 0; j < (2 - i); j++) + divisor *= 10; + numbers[i] = score / divisor; + score -= numbers[i] * divisor; + } + numbers[2] = score; + + CursorMan.showMouse(false); + + for (int i = 0; i < 3; i++) { + if (_scoreToDisplay[i] != numbers[i]) + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); + } + + CursorMan.showMouse(true); + + for (int i = 0; i < 3; i++) + _scoreToDisplay[i] = numbers[i]; +} + +void Avalot::incScore(byte num) { + for (int i = 1; i <= num; i++) { + _dnascore++; + +// if (soundfx) { + for (int j = 1; j <= 97; j++) + // Length os 2 is a guess, the original doesn't have a delay specified + _vm->_sound->playNote(177 + _dnascore * 3, 2); +// } + } + warning("STUB: Avalot::points()"); + + drawScore(); +} + +void Avalot::useCompass(const Common::Point &cursorPos) { + byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); + + switch (color) { + case kColorGreen: + _vm->_animation->_direction = Animation::kDirUp; + _vm->_animation->changeDirection(0, Animation::kDirUp); + drawDirection(); + break; + case kColorBrown: + _vm->_animation->_direction = Animation::kDirDown; + _vm->_animation->changeDirection(0, Animation::kDirDown); + drawDirection(); + break; + case kColorCyan: + _vm->_animation->_direction = Animation::kDirLeft; + _vm->_animation->changeDirection(0, Animation::kDirLeft); + drawDirection(); + break; + case kColorLightmagenta: + _vm->_animation->_direction = Animation::kDirRight; + _vm->_animation->changeDirection(0, Animation::kDirRight); + drawDirection(); + break; + case kColorRed: + case kColorWhite: + case kColorLightcyan: + case kColorYellow: // Fall-throughs are intended. + _vm->_animation->stopWalking(); + drawDirection(); + break; + } +} + +void Avalot::fxToggle() { + warning("STUB: Avalot::fxtoggle()"); +} + +void Avalot::refreshObjectList() { + _carryNum = 0; + if (_thinkThing && !_objects[_thinks - 1]) + thinkAbout(Avalot::kObjectMoney, Avalot::kThing); // you always have money + + for (int i = 0; i < kObjectNum; i++) { + if (_objects[i]) { + _objectList[_carryNum] = i + 1; + _carryNum++; + } + } +} + +/** + * @remarks Originally called 'verte' + */ +void Avalot::guideAvvy(Common::Point cursorPos) { + if (!_userMovesAvvy) + return; + + cursorPos.y /= 2; + byte what; + + // _vm->_animation->tr[0] is Avalot.) + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (cursorPos.x < avvy->_x) + what = 1; + else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) + what = 2; + else + what = 0; // On top + + if (cursorPos.y < avvy->_y) + what += 3; + else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) + what += 6; + + switch (what) { + case 0: + _vm->_animation->stopWalking(); + break; // Clicked on Avvy: no movement. + case 1: + _vm->_animation->changeDirection(0, Animation::kDirLeft); + break; + case 2: + _vm->_animation->changeDirection(0, Animation::kDirRight); + break; + case 3: + _vm->_animation->changeDirection(0, Animation::kDirUp); + break; + case 4: + _vm->_animation->changeDirection(0, Animation::kDirUpLeft); + break; + case 5: + _vm->_animation->changeDirection(0, Animation::kDirUpRight); + break; + case 6: + _vm->_animation->changeDirection(0, Animation::kDirDown); + break; + case 7: + _vm->_animation->changeDirection(0, Animation::kDirDownLeft); + break; + case 8: + _vm->_animation->changeDirection(0, Animation::kDirDownRight); + break; + } // No other values are possible. + + drawDirection(); +} + +void Avalot::checkClick() { + Common::Point cursorPos = _vm->getMousePos(); + _onToolbar = kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); + + /*if (mrelease > 0) + after_the_scroll = false;*/ + + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) + newMouse(0); // up arrow + else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) + newMouse(7); //I-beam + else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) + newMouse(1); // screwdriver + else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. + if (_holdLeftMouse) { + newMouse(6); // Mark's crosshairs + guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. + } else + newMouse(3); // fletch + } + + if (_holdLeftMouse) { + if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. + if (_dropsOk) + _vm->_menu->update(); + } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. + _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; + if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) + _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; + if (_vm->_parser->_inputTextPos < 1) + _vm->_parser->_inputTextPos = 1; + _vm->_parser->_inputTextPos--; + _vm->_parser->plotText(); + } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. + if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. + if (_alive && _avvyIsAwake) + useCompass(cursorPos); + } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. + do { + _vm->updateEvents(); + } while (_holdLeftMouse); + + if (_thinkThing) { + _vm->_parser->_thing = _thinks; + _vm->_parser->_thing += 49; + _vm->_parser->_person = _vm->_parser->kPardon; + } else { + _vm->_parser->_person = _thinks; + _vm->_parser->_thing = _vm->_parser->kPardon; + } + callVerb(Parser::kVerbCodeExam); + } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. + do { + _vm->updateEvents(); + } while (_holdLeftMouse); + + callVerb(Parser::kVerbCodeScore); + } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. + _vm->_animation->_sprites[0]._speedX = kWalk; + _vm->_animation->updateSpeed(); + } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. + _vm->_animation->_sprites[0]._speedX = kRun; + _vm->_animation->updateSpeed(); + } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) + fxToggle(); + else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) + _mouseText.insertChar(Dialogs::kControlNewLine, 0); + } else if (!_dropsOk) + _mouseText = Common::String(13) + _mouseText; + } +} + +void Avalot::errorLed() { + warning("STUB: Avalot::errorled()"); +} + +int8 Avalot::fades(int8 x) { + warning("STUB: Avalot::fades()"); + return 0; +} + +void Avalot::fadeOut(byte n) { + warning("STUB: Avalot::fadeOut()"); +} + +void Avalot::dusk() { + warning("STUB: Avalot::dusk()"); +} + +void Avalot::fadeIn(byte n) { + warning("STUB: Avalot::fadeIn()"); +} + +void Avalot::dawn() { + warning("STUB: Avalot::dawn()"); +} + +void Avalot::drawDirection() { // It's data is loaded in load_digits(). + if (_vm->_animation->_oldDirection == _vm->_animation->_direction) + return; + + _vm->_animation->_oldDirection = _vm->_animation->_direction; + + CursorMan.showMouse(false); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->_direction], 0, 161); + CursorMan.showMouse(true); +} + + +void Avalot::gameOver() { + _userMovesAvvy = false; + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + int16 sx = avvy->_x; + int16 sy = avvy->_y; + + avvy->remove(); + avvy->init(12, true, _vm->_animation); // 12 = Avalot falls + avvy->_stepNum = 0; + avvy->appear(sx, sy, 0); + + _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); + _alive = false; +} + +void Avalot::minorRedraw() { + dusk(); + + enterRoom(_room, 0); // Ped unknown or non-existant. + + for (int i = 0; i < 3; i++) + _scoreToDisplay[i] = -1; // impossible digits + drawScore(); + + dawn(); +} + +void Avalot::majorRedraw() { + warning("STUB: Avalot::major_redraw()"); +} + +uint16 Avalot::bearing(byte whichPed) { + static const double rad2deg = 180 / 3.14; // Pi + AnimationType *avvy = &_vm->_animation->_sprites[0]; + PedType *curPed = &_peds[whichPed]; + + if (avvy->_x == curPed->_x) + return 0; + else if (avvy->_x < curPed->_x) { + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); + } else { + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); + } +} + +/** + * @remarks Originally called 'sprite_run' + */ +void Avalot::spriteRun() { + _doingSpriteRun = true; + _vm->_animation->animLink(); + _doingSpriteRun = false; +} + +void Avalot::fixFlashers() { + _ledStatus = 177; + _vm->_animation->_oldDirection = 177; + _vm->_dialogs->setReadyLight(2); + drawDirection(); +} + +Common::String Avalot::intToStr(int32 num) { + return Common::String::format("%d", num); +} + +void Avalot::newMouse(byte id) { + if (id == _currentMouse) + return; + + _currentMouse = id; + loadMouse(id); +} + +/** + * Set the mouse pointer to 'HourGlass" + * @remarks Originally called 'wait' + */ +void Avalot::setMousePointerWait() { + newMouse(4); +} + +void Avalot::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { + warning("STUB: Avalot::shadow()"); +} + +void Avalot::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { + warning("STUB: Avalot::shbox()"); +} + +void Avalot::resetVariables() { +// Replaces memset(&_dna, 0, sizeof(DnaType)); + _vm->_animation->_direction = 0; + _carryNum = 0; + for (int i = 0; i < kObjectNum; i++) + _objects[i] = false; + + _dnascore = 0; + _money = 0; + _room = kRoomNowhere; + _wearing = 0; + _sworeNum = 0; + _saveNum = 0; + for (int i = 0; i < 100; i++) + _roomCount[i] = 0; + + _alcoholLevel = 0; + _playedNim = 0; + _wonNim = false; + _wineState = 0; + _cwytalotGone = false; + _passwordNum = 0; + _aylesIsAwake = false; + _drawbridgeOpen = 0; + _avariciusTalk = 0; + _boughtOnion = false; + _rottenOnion = false; + _onionInVinegar = false; + _givenToSpludwick = 0; + _brummieStairs = 0; + _cardiffQuestionNum = 0; + _passedCwytalotInHerts = false; + _avvyIsAwake = false; + _avvyInBed = false; + _userMovesAvvy = false; + _npcFacing = 0; + _givenBadgeToIby = false; + _friarWillTieYouUp = false; + _tiedUp = false; + _boxContent = 0; + _talkedToCrapulus = false; + _jacquesState = 0; + _bellsAreRinging = false; + _standingOnDais = false; + _takenPen = false; + _arrowTriggered = false; + _arrowInTheDoor = false; + _favouriteDrink = ""; + _favouriteSong = ""; + _worstPlaceOnEarth = ""; + _spareEvening = ""; + _totalTime = 0; + _jumpStatus = 0; + _mushroomGrowing = false; + _spludwickAtHome = false; + _lastRoom = 0; + _lastRoomNotMap = 0; + _crapulusWillTell = false; + _enterCatacombsFromLustiesRoom = false; + _teetotal = false; + _malagauche = 0; + _drinking = 0; + _enteredLustiesRoomAsMonk = false; + _catacombX = 0; + _catacombY = 0; + _avvysInTheCupboard = false; + _geidaFollows = false; + _geidaSpin = 0; + _geidaTime = 0; + _nextBell = 0; + _givenPotionToGeida = false; + _lustieIsAsleep = false; + _flipToWhere = 0; + _flipToPed = 0; + _beenTiedUp = false; + _sittingInPub = false; + _spurgeTalkCount = 0; + _metAvaroid = false; + _takenMushroom = false; + _givenPenToAyles = false; + _askedDogfoodAboutNim = false; +} + +void Avalot::newGame() { + for (int i = 0; i < kMaxSprites; i++) { + AnimationType *spr = &_vm->_animation->_sprites[i]; + if (spr->_quick) + spr->remove(); + } + // Deallocate sprite. Sorry, beta testers! + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(0, true, _vm->_animation); + + _alive = true; + resetVariables(); + + _vm->_dialogs->setBubbleStateNatural(); + + _spareEvening = "answer a questionnaire"; + _favouriteDrink = "beer"; + _money = 30; // 2/6 + _vm->_animation->_direction = Animation::kDirStopped; + _wearing = kObjectClothes; + _objects[kObjectMoney - 1] = true; + _objects[kObjectBodkin - 1] = true; + _objects[kObjectBell - 1] = true; + _objects[kObjectClothes - 1] = true; + + _thinkThing = true; + _thinks = 2; + refreshObjectList(); + _onToolbar = false; + _seeScroll = false; + + avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. + //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; + // fillchar(previous^,sizeof(previous^),#0); { blank out array } + _him = Parser::kPardon; + _her = Parser::kPardon; + _it = Parser::kPardon; + _lastPerson = Parser::kPardon; // = Pardon? + _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _userMovesAvvy = false; + _doingSpriteRun = false; + _avvyInBed = true; + _enidFilename = ""; + + enterRoom(1, 1); + avvy->_visible = false; + drawScore(); + _vm->_menu->setup(); + _clock.update(); + spriteRun(); +} + +void Avalot::slowDown() { + warning("STUB: Avalot::slowdown()"); +} + +bool Avalot::setFlag(char x) { + for (uint16 i = 0; i < _flags.size(); i++) { + if (_flags[i] == x) + return true; + } + + return false; +} + +bool Avalot::decreaseMoney(uint16 howmuchby) { + _money -= howmuchby; + if (_money < 0) { + _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" + gameOver(); + return false; + } else + return true; +} + +Common::String Avalot::getName(byte whose) { + static const Common::String kLads[17] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", + "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", + "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + }; + + static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; + + if (whose < 175) + return kLads[whose - 150]; + else + return kLasses[whose - 175]; +} + +byte Avalot::getNameChar(byte whose) { + static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; + static const char kLassChar[] = "kG\0xB1o"; + + if (whose < 175) + return kLadChar[whose - 150]; + else + return kLassChar[whose - 175]; +} + +Common::String Avalot::getThing(byte which) { + static const Common::String kThings[kObjectNum] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + }; + + Common::String get_thing_result; + switch (which) { + case kObjectWine: + switch (_wineState) { + case 1: + case 4: + get_thing_result = kThings[which - 1]; + break; + case 3: + get_thing_result = "Vinegar"; + break; + } + break; + case kObjectOnion: + if (_rottenOnion) + get_thing_result = "rotten onion"; + else + get_thing_result = kThings[which - 1]; + break; + default: + get_thing_result = kThings[which - 1]; + } + return get_thing_result; +} + +char Avalot::getThingChar(byte which) { + static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar + + char get_thingchar_result; + switch (which) { + case kObjectWine: + if (_wineState == 3) + get_thingchar_result = 'V'; // Vinegar + else + get_thingchar_result = kThingsChar[which - 1]; + break; + default: + get_thingchar_result = kThingsChar[which - 1]; + } + return get_thingchar_result; +} + +Common::String Avalot::getItem(byte which) { + static const Common::String kItems[kObjectNum] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", + "an onion" + }; + + Common::String get_better_result; + if (which > 150) + which -= 149; + + switch (which) { + case kObjectWine: + switch (_wineState) { + case 0: + case 1: + case 4: + get_better_result = kItems[which - 1]; + break; + case 3: + get_better_result = "some vinegar"; + break; + } + break; + case kObjectOnion: + if (_rottenOnion) + get_better_result = "a rotten onion"; + else if (_onionInVinegar) + get_better_result = "a pickled onion (in the vinegar)"; + else + get_better_result = kItems[which - 1]; + break; + default: + if ((which < kObjectNum) && (which > 0)) + get_better_result = kItems[which - 1]; + else + get_better_result = ""; + } + return get_better_result; +} + + +Common::String Avalot::f5Does() { + switch (_room) { + case kRoomYours: + if (!_avvyIsAwake) + return Common::String::format("%cWWake up", Parser::kVerbCodeWake); + else if (_avvyInBed) + return Common::String::format("%cGGet up", Parser::kVerbCodeStand); + break; + case kRoomInsideCardiffCastle: + if (_standingOnDais) + return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb); + else + return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb); + break; + case kRoomNottsPub: + if (_sittingInPub) + return Common::String::format("%cSStand up", Parser::kVerbCodeStand); + else + return Common::String::format("%cSSit down", Parser::kVerbCodeSit); + break; + case kRoomMusicRoom: + if (_vm->_animation->inField(5)) + return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay); + break; + } + + return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails... +} + +void Avalot::loadMouse(byte which) { + Common::File f; + + if (!f.open("mice.avd")) + error("AVALANCHE: Gyro: File not found: mice.avd"); + + ::Graphics::Surface cursor; + cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); + cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); + + + // The AND mask. + f.seek(kMouseSize * 2 * which + 134); + + ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); + + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { + if (*(byte *)mask.getBasePtr(i, j) == 0) + *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; + } + } + } + + mask.free(); + + // The OR mask. + f.seek(kMouseSize * 2 * which + 134 * 2); + + mask = _vm->_graphics->loadPictureGraphic(f); + + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel != 0) + *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; + } + } + } + + mask.free(); + f.close(); + + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); + cursor.free(); +} + +void Avalot::setBackgroundColor(byte x) { + warning("STUB: Avalot::background()"); +} + +void Avalot::hangAroundForAWhile() { + for (int i = 0; i < 28; i++) + slowDown(); +} } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 1f2046604ffd..51be1a3dd415 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -32,20 +32,412 @@ #include "common/events.h" #include "common/system.h" +#include "common/str.h" +#include "common/scummsys.h" +#include "common/file.h" +#include "graphics/surface.h" namespace Avalanche { class AvalancheEngine; +class Clock { +public: + Clock(AvalancheEngine *vm); + + void update(); + +private: + static const int kCenterX = 510; + static const int kCenterY = 183; + + AvalancheEngine *_vm; + + uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; + Common::Point _clockHandHour, _clockHandMinute; + + void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); + void drawHand(const Common::Point &endPoint, byte color); + void plotHands(); + void chime(); +}; + +enum Color { + kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, + kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, + kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, + kColorWhite +}; + +// CHECKME: kRoomBossKey is a guess +enum Room { + kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, + kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10, + kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14, + kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20, + kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25, + kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29, + kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47, + kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, + kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room +}; + +static const byte kObjectNum = 18; // always preface with a # +static const int16 kCarryLimit = 12; // carry limit + +static const int16 kNumlockCode = 32; // Code for Num Lock +static const int16 kMouseSize = 134; + +struct MouseHotspotType { // mouse-void + int16 _horizontal, _vertical; +}; + +struct PedType { + int16 _x, _y; + byte _direction; +}; + +struct MagicType { + byte _operation; // one of the operations + uint16 _data; // data for them +}; + +class FieldType { +public: + int16 _x1, _y1, _x2, _y2; +}; + +struct ByteField { + byte _x1, _y1, _x2, _y2; +}; + +class LineType : public FieldType { +public: + byte _color; +}; + +typedef int8 TuneType[31]; + +struct QuasipedType { + byte _whichPed, _foregroundColor, _room, _backgroundColor; + uint16 _who; +}; + +#if 0 +struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA. + Common::String _qEnidFilename; + bool _qSoundFx; + byte _qThinks; + bool _qThinkThing; +}; +#endif + class Avalot { public: + // Objects you can hold: + enum Object { + kObjectWine = 1, + kObjectMoney, + kObjectBodkin, + kObjectPotion, + kObjectChastity, + kObjectBolt, + kObjectCrossbow, + kObjectLute, + kObjectBadge, + kObjectMushroom, + kObjectKey, + kObjectBell, + kObjectPrescription, + kObjectPen, + kObjectInk, + kObjectClothes, + kObjectHabit, + kObjectOnion + }; + + // People who hang around this game. + enum People { + // Boys: + kPeopleAvalot = 150, + kPeopleSpludwick = 151, + kPeopleCrapulus = 152, + kPeopleDrDuck = 153, + kPeopleMalagauche = 154, + kPeopleFriarTuck = 155, + kPeopleRobinHood = 156, + kPeopleCwytalot = 157, + kPeopleDuLustie = 158, + kPeopleDuke = 159, + kPeopleDogfood = 160, + kPeopleTrader = 161, + kPeopleIbythneth = 162, + kPeopleAyles = 163, + kPeoplePort = 164, + kPeopleSpurge = 165, + kPeopleJacques = 166, + // Girls: + kPeopleArkata = 175, + kPeopleGeida = 176, + kPeopleInvisible = 177, + kPeopleWisewoman = 178 + }; + + static const int16 kXW = 30; + static const int16 kYW = 36; // x width & y whatsit + static const int16 kMargin = 5; + static const MouseHotspotType kMouseHotSpots[9]; + static const int16 kMaxSprites = 2; // Current max no. of sprites. + + // For Thinkabout: + static const bool kThing = true; + static const bool kPerson = false; + + // Magic/portal constants: + enum Magics { + kMagicNothing, // Ignore it if this line is touched. + kMagicBounce, // Bounce off this line. Not valid for portals. + kMagicExclaim, // Put up a chain of scrolls. + kMagicTransport, // Enter new room. + kMagicUnfinished, // Unfinished connection. + kMagicSpecial, // Special function. + kMagicOpenDoor // Opening door. + }; + + // These following static constants should be included in CFG when it's written. + + static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. + static const int16 kBorder = 1; // size of border on shadowboxes + static const int16 kWalk = 3; + static const int16 kRun = 5; + static const int32 kCatacombMap[8][8]; + static const char kSpludwicksOrder[3]; + static const QuasipedType kQuasipeds[16]; + + enum Pitch { + kPitchInvalid, + kPitchLower, + kPitchSame, + kPitchHigher + }; + + static const uint16 kNotes[12]; + static const TuneType kTune; + + static const char *kVersionNum; + static const char *kCopyright; + static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". + static const int16 kGameCode = 2; // Avalot's code number + + + Avalot(AvalancheEngine *vm); + ~Avalot(); + + bool _holdLeftMouse; + Clock _clock; + + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. + // If a scroll comes up, or you leave the room, it's automatically set to zero. + byte _interrogation; + static byte _whereIs[29]; + + // Former DNA structure + byte _carryNum; // How many objects you're carrying... + bool _objects[kObjectNum]; // ...and which ones they are. + int16 _dnascore; // your score, of course + int32 _money; // your current amount of dosh + byte _room; // your current room + byte _wearing; // what you're wearing + byte _sworeNum; // number of times you've sworn + byte _saveNum; // number of times this game has been saved + byte _roomCount[100]; // Add one to each every time you enter a room + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _wonNim; // Have you *won* Nim? (That's harder.) + byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? + byte _passwordNum; // Number of the passw for this game. + bool _aylesIsAwake; // pretty obvious! + byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). + byte _avariciusTalk; // How much Avaricius has said to you. + bool _boughtOnion; // Have you bought an onion yet? + bool _rottenOnion; // And has it rotted? + bool _onionInVinegar; // Is the onion in the vinegar? + byte _givenToSpludwick; // 0 = nothing given, 1 = onion... + byte _brummieStairs; // Progression through the stairs trick. + byte _cardiffQuestionNum; // Things you get asked in Cardiff. + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) + bool _avvyInBed; // True if Avvy's in bed, but awake. + bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. + byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. + bool _givenBadgeToIby; // Have you given the badge to Iby yet? + bool _friarWillTieYouUp; // If you're going to get tied up. + bool _tiedUp; // You ARE tied up! + byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. + bool _talkedToCrapulus; // Pretty self-explanatory. + byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. + bool _bellsAreRinging; // Is Jacques ringing the bells? + bool _standingOnDais; // In room 71, inside Cardiff Castle. + bool _takenPen; // Have you taken the pen (in Cardiff?) + bool _arrowTriggered; // And has the arrow been triggered? + bool _arrowInTheDoor; // Did the arrow hit the wall? + Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's + uint32 _totalTime; // Your total time playing this game, in ticks. + byte _jumpStatus; // Fixes how high you're jumping. + bool _mushroomGrowing; // Is the mushroom growing in 42? + bool _spludwickAtHome; // Is Spludwick at home? + byte _lastRoom; + byte _lastRoomNotMap; + bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? + bool _enterCatacombsFromLustiesRoom; + bool _teetotal; // Are we touching any more drinks? + byte _malagauche; // Position of Malagauche. See Celer for more info. + char _drinking; // What's he getting you? + bool _enteredLustiesRoomAsMonk; + byte _catacombX, _catacombY; // XY coords in the catacombs. + bool _avvysInTheCupboard; // On screen 22. + bool _geidaFollows; // Is Geida following you? + byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. + byte _nextBell; // For the ringing. + bool _givenPotionToGeida; // Does Geida have the potion? + bool _lustieIsAsleep; // Is BDL asleep? + byte _flipToWhere, _flipToPed; // For the sequencer. + bool _beenTiedUp; // In r__Robins. + bool _sittingInPub; // Are you sitting down in the pub? + byte _spurgeTalkCount; // Count for talking to Spurge. + bool _metAvaroid; + bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; + // End of former DNA Structure + + byte _lineNum; // Number of lines. + LineType _lines[50]; // For Also. + enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; + bool _dropsOk, _scReturn, _soundFx, _cheat; + Common::String _mouseText; + bool _weirdWord; + bool _letMeOut; + Common::String _scroll[15]; + byte _scrollNum, _whichwas; + byte _thinks; + bool _thinkThing; + int16 _talkX, _talkY; + byte _talkBackgroundColor, _talkFontColor; + byte _scrollBells; // no. of times to ring the bell + bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? + char _objectList[10]; + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + // Called .free() for them in ~Gyro(). + int8 _scoreToDisplay[3]; + byte _currentMouse; // current mouse-void + Common::String _verbStr; // what you can do with your object. :-) + Common::String *_also[31][2]; + PedType _peds[15]; + MagicType _magics[15]; + MagicType _portals[7]; + FieldType _fields[30]; + byte _fieldNum; + Common::String _flags; + Common::String _listen; + Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". + byte _cp, _ledStatus, _defaultLed; + FontType _font; + bool _alive; + byte _buffer[2000]; + uint16 _bufSize; + int16 _underScroll; // Y-coord of just under the scroll text. + Common::String _roomnName; // Name of actual room + Common::String _subject; // What you're talking to them about. + byte _subjectNum; // The same thing. + bool _keyboardClick; // Is a keyboard click noise wanted? + byte _him, _her, _it; + int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. + + byte _lastPerson; // Last person to have been selected using the People menu. + bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. + bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. + bool _isLoaded; // Is it a loaded gamestate? + Common::String _enidFilename; void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void setup(); void runAvalot(); + void init(); + void callVerb(byte id); + void drawAlsoLines(); + void loadRoom(byte num); + void exitRoom(byte x); + void enterRoom(byte room, byte ped); + void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! + void loadDigits(); // Load the scoring digits & rwlites + void drawToolbar(); + void drawScore(); + void incScore(byte num); // Add on no. of points + void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. + void fxToggle(); + void refreshObjectList(); + void checkClick(); + void errorLed(); + void dusk(); + void dawn(); + void drawDirection(); // Draws the little icon at the left end of the text input field. + void gameOver(); + uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. + void fixFlashers(); + void loadAlso(byte num); + + // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. + void minorRedraw(); + void majorRedraw(); + + void spriteRun(); + + Common::String intToStr(int32 num); + void newMouse(byte id); + void setMousePointerWait(); // Makes hourglass. + void loadMouse(byte which); + + void setBackgroundColor(byte x); + void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); + + void resetVariables(); + void newGame(); // This sets up the DNA for a completely new game. + void slowDown(); + bool setFlag(char x); + bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. + void hangAroundForAWhile(); + + Common::String getName(byte whose); + byte getNameChar(byte whose); + Common::String getThing(byte which); + char getThingChar(byte which); + Common::String getItem(byte which); // Called get_better in the original. + Common::String f5Does(); // This procedure determines what f5 does. + private: AvalancheEngine *_vm; + + Common::File file; + Common::String readAlsoStringFromFile(); + void scram(Common::String &str); + void unScramble(); + + void zoomOut(int16 x, int16 y); // Only used when entering the map. + void enterNewTown(); + void findPeople(byte room); + void putGeidaAt(byte whichPed, byte ped); + void guideAvvy(Common::Point cursorPos); + + // Will be used in dusk() and dawn(). + bool _fxHidden; + + int8 fades(int8 x); + void fadeOut(byte n); + void fadeIn(byte n); + + void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; } // End of namespace Avalanche diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 3a70fd79154f..9da9161110e8 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -30,8 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/background.h" #include "avalanche/animation.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h" #include "common/textconsole.h" @@ -55,28 +53,28 @@ void Background::updateBackgroundSprites() { if (_vm->_menu->isActive()) return; // No animation when the menus are up. - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomOutsideArgentPub: - if ((_vm->_gyro->_roomTime % 12) == 0) - drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 4); + if ((_vm->_avalot->_roomTime % 12) == 0) + drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 4); break; case kRoomBrummieRoad: - if ((_vm->_gyro->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 2) % 4); + if ((_vm->_avalot->_roomTime % 2) == 0) + drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 2) % 4); break; case kRoomBridge: - if ((_vm->_gyro->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, 3 + (_vm->_gyro->_roomTime / 2) % 4); + if ((_vm->_avalot->_roomTime % 2) == 0) + drawBackgroundSprite(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4); break; case kRoomYours: - if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) - drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 2); + if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0)) + drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 2); break; case kRoomArgentPub: - if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { + if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) { // Malagauche cycle. - _vm->_gyro->_malagauche += 1; - switch (_vm->_gyro->_malagauche) { + _vm->_avalot->_malagauche += 1; + switch (_vm->_avalot->_malagauche) { case 1: case 11: case 21: @@ -92,12 +90,12 @@ void Background::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 12); // Winks. break; case 33: - _vm->_gyro->_malagauche = 0; + _vm->_avalot->_malagauche = 0; break; } } - switch (_vm->_gyro->_roomTime % 200) { + switch (_vm->_avalot->_roomTime % 200) { case 179: case 197: drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle. @@ -110,13 +108,13 @@ void Background::updateBackgroundSprites() { drawBackgroundSprite(-1, -1, 6); break; case 199: - _vm->_gyro->_npcFacing = 177; // Impossible value for this. + _vm->_avalot->_npcFacing = 177; // Impossible value for this. break; } - if ((_vm->_gyro->_roomTime % 200 >= 0) && (_vm->_gyro->_roomTime % 200 <= 178)) { // Normally. + if ((_vm->_avalot->_roomTime % 200 >= 0) && (_vm->_avalot->_roomTime % 200 <= 178)) { // Normally. byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(1); + uint16 angle = _vm->_avalot->bearing(1); if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) direction = 3; else if ((angle >= 293) && (angle <= 357)) @@ -124,15 +122,15 @@ void Background::updateBackgroundSprites() { else if ((angle >= 271) && (angle <= 292)) direction = 4; - if (direction != _vm->_gyro->_npcFacing) { // Dogfood. + if (direction != _vm->_avalot->_npcFacing) { // Dogfood. drawBackgroundSprite(-1, -1, direction - 1); - _vm->_gyro->_npcFacing = direction; + _vm->_avalot->_npcFacing = direction; } } break; case kRoomWestHall: - if ((_vm->_gyro->_roomTime % 3) == 0) { - switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { + if ((_vm->_avalot->_roomTime % 3) == 0) { + switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) { case 4: drawBackgroundSprite(-1, -1, 0); break; @@ -149,10 +147,10 @@ void Background::updateBackgroundSprites() { } break; case kRoomLustiesRoom: - if (!(_vm->_gyro->_lustieIsAsleep)) { + if (!(_vm->_avalot->_lustieIsAsleep)) { byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(1); - if ((_vm->_gyro->_roomTime % 45) > 42) + uint16 angle = _vm->_avalot->bearing(1); + if ((_vm->_avalot->_roomTime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) @@ -162,15 +160,15 @@ void Background::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_gyro->_npcFacing) { // du Lustie. + if (direction != _vm->_avalot->_npcFacing) { // du Lustie. drawBackgroundSprite(-1, -1, direction - 1); - _vm->_gyro->_npcFacing = direction; + _vm->_avalot->_npcFacing = direction; } } break; case kRoomAylesOffice: - if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { - switch ((_vm->_gyro->_roomTime / 14) % 2) { + if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) { + switch ((_vm->_avalot->_roomTime / 14) % 2) { case 0: drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA. break; @@ -181,8 +179,8 @@ void Background::updateBackgroundSprites() { } break; case kRoomRobins: - if (_vm->_gyro->_tiedUp) { - switch (_vm->_gyro->_roomTime % 54) { + if (_vm->_avalot->_tiedUp) { + switch (_vm->_avalot->_roomTime % 54) { case 20: drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks. break; @@ -195,7 +193,7 @@ void Background::updateBackgroundSprites() { case kRoomNottsPub: { // Bearing of Avvy from Port. byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(4); + uint16 angle = _vm->_avalot->bearing(4); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 2; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -203,15 +201,15 @@ void Background::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_gyro->_roomTime % 60) > 57) + if ((_vm->_avalot->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_gyro->_npcFacing) { // Port. + if (direction != _vm->_avalot->_npcFacing) { // Port. drawBackgroundSprite(-1, -1, direction - 1); - _vm->_gyro->_npcFacing = direction; + _vm->_avalot->_npcFacing = direction; } - switch (_vm->_gyro->_roomTime % 50) { + switch (_vm->_avalot->_roomTime % 50) { case 45 : drawBackgroundSprite(-1, -1, 8); // Spurge blinks. break; @@ -222,12 +220,12 @@ void Background::updateBackgroundSprites() { break; } case kRoomDucks: { - if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 3) % 3); + if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; - uint16 angle = _vm->_lucerna->bearing(1); + uint16 angle = _vm->_avalot->bearing(1); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 4; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -235,26 +233,26 @@ void Background::updateBackgroundSprites() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_gyro->_roomTime % 45) > 42) + if ((_vm->_avalot->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_gyro->_npcFacing) { // Duck. + if (direction != _vm->_avalot->_npcFacing) { // Duck. drawBackgroundSprite(-1, -1, direction - 1); - _vm->_gyro->_npcFacing = direction; + _vm->_avalot->_npcFacing = direction; } break; } } - if ((_vm->_gyro->_bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { + if ((_vm->_avalot->_bellsAreRinging) && (_vm->_avalot->setFlag('B'))) { // They're ringing the bells. - switch (_vm->_gyro->_roomTime % 4) { + switch (_vm->_avalot->_roomTime % 4) { case 1: - if (_vm->_gyro->_nextBell < 5) - _vm->_gyro->_nextBell = 12; - _vm->_gyro->_nextBell--; + if (_vm->_avalot->_nextBell < 5) + _vm->_avalot->_nextBell = 12; + _vm->_avalot->_nextBell--; // CHECKME: 2 is a guess. No length in the original? - _vm->_sound->playNote(_vm->_gyro->kNotes[_vm->_gyro->_nextBell], 2); + _vm->_sound->playNote(_vm->_avalot->kNotes[_vm->_avalot->_nextBell], 2); break; case 2: _vm->_sound->stopSound(); diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 39f177e6aaee..822148499aca 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -29,8 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/closing.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" #include "common/textconsole.h" #include "common/random.h" diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 69a398439ab8..3004f621a437 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -29,8 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/dialogs.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" #include "avalanche/animation.h" #include "avalanche/timer.h" @@ -50,7 +48,7 @@ void Dialogs::init() { } void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever - if (_vm->_gyro->_ledStatus == state) + if (_vm->_avalot->_ledStatus == state) return; // Already like that! byte color = kColorBlack; @@ -71,7 +69,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); - _vm->_gyro->_ledStatus = state; + _vm->_avalot->_ledStatus = state; } void Dialogs::easterEgg() { @@ -116,8 +114,8 @@ void Dialogs::scrollModeNormal() { Common::String e = "(c) 1994"; setReadyLight(3); - _vm->_gyro->_seeScroll = true; - _vm->_gyro->newMouse(3); + _vm->_avalot->_seeScroll = true; + _vm->_avalot->newMouse(3); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -145,7 +143,7 @@ void Dialogs::scrollModeNormal() { bool oktoexit; do { do { - _vm->_gyro->check(); // was "checkclick;" + _vm->_avalot->check(); // was "checkclick;" //#ifdef RECORD slowdown(); basher::count += 1; #endif @@ -170,12 +168,12 @@ void Dialogs::scrollModeNormal() { //#ifdef RECORD record_one(); #endif - _vm->_gyro->screturn = r == '#'; // "back door" + _vm->_avalot->screturn = r == '#'; // "back door" #endif setReadyLight(0); - _vm->_gyro->_seeScroll = false; - _vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). + _vm->_avalot->_seeScroll = false; + _vm->_avalot->_holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::scrollModeNormal()"); } @@ -193,7 +191,7 @@ bool Dialogs::theyMatch(TuneType &played) { byte mistakes = 0; for (unsigned int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->_gyro->kTune[i]) + if (played[i] != _vm->_avalot->kTune[i]) mistakes += 1; } @@ -202,16 +200,16 @@ bool Dialogs::theyMatch(TuneType &played) { void Dialogs::scrollModeMusic() { setReadyLight(3); - _vm->_gyro->_seeScroll = true; + _vm->_avalot->_seeScroll = true; CursorMan.showMouse(false); - _vm->_gyro->newMouse(3); + _vm->_avalot->newMouse(3); TuneType played; for (unsigned int i = 0; i < sizeof(played); i++) - played[i] = Gyro::kPitchInvalid; + played[i] = Avalot::kPitchInvalid; int8 lastOne = -1, thisOne = -1; // Invalid values. - _vm->_gyro->_seeScroll = true; + _vm->_avalot->_seeScroll = true; ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -282,16 +280,16 @@ void Dialogs::scrollModeMusic() { lastOne = thisOne; thisOne = value; - _vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); + _vm->_sound->playNote(_vm->_avalot->kNotes[thisOne], 100); _vm->_system->delayMillis(200); - if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. + if (!_vm->_avalot->_bellsAreRinging) { // These handle playing the right tune. if (thisOne < lastOne) - store(Gyro::kPitchLower, played); + store(Avalot::kPitchLower, played); else if (thisOne == lastOne) - store(Gyro::kPitchSame, played); + store(Avalot::kPitchSame, played); else - store(Gyro::kPitchHigher, played); + store(Avalot::kPitchHigher, played); } if (theyMatch(played)) { @@ -304,30 +302,30 @@ void Dialogs::scrollModeMusic() { _vm->_graphics->_surface.copyFrom(temp); temp.free(); - _vm->_gyro->_seeScroll = false; + _vm->_avalot->_seeScroll = false; CursorMan.showMouse(true); } void Dialogs::resetScrollDriver() { - _vm->_gyro->_scrollBells = 0; + _vm->_avalot->_scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; - _vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. + _vm->_avalot->_interrogation = 0; // Always reset after a scroll comes up. } void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_gyro->_scrollBells; i++) - _vm->_lucerna->errorLed(); // Ring the bell "x" times. + for (int i = 0; i < _vm->_avalot->_scrollBells; i++) + _vm->_avalot->errorLed(); // Ring the bell "x" times. } void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. + g_system->warpMouse(_dodgeCoord.x, _vm->_avalot->_underScroll); // Move the pointer off the scroll. } void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_avalot->_underScroll)) g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } @@ -358,7 +356,7 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); #if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); + uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_avalot->cp) * _vm->_avalot->pagetop); byte bit; for (uint16 i = 1; i <= yl; i++) for (bit = 0; bit <= 3; bit++) { @@ -378,10 +376,10 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_vm->_gyro->_scrollNum) * 6; + int16 ly = (_vm->_avalot->_scrollNum) * 6; int16 ex; - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - ex = _vm->_gyro->_scroll[i].size() * 8; + for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { + ex = _vm->_avalot->_scroll[i].size() * 8; if (lx < ex) lx = ex; } @@ -447,47 +445,47 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - if (!_vm->_gyro->_scroll[i].empty()) - switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { + for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { + if (!_vm->_avalot->_scroll[i].empty()) + switch (_vm->_avalot->_scroll[i][_vm->_avalot->_scroll[i].size() - 1]) { case kControlCenter: centre = true; - _vm->_gyro->_scroll[i].deleteLastChar(); + _vm->_avalot->_scroll[i].deleteLastChar(); break; case kControlLeftJustified: centre = false; - _vm->_gyro->_scroll[i].deleteLastChar(); + _vm->_avalot->_scroll[i].deleteLastChar(); break; case kControlQuestion: //settextjustify(1, 1); _shadowBoxX = mx + lx; _shadowBoxY = my + ly; - _vm->_gyro->_scroll[i].setChar(' ', 0); + _vm->_avalot->_scroll[i].setChar(' ', 0); // byte groi = *_vm->_graphics->getPixel(0, 0); // inc(diy,14); - _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); - _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); + _vm->_avalot->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); + _vm->_avalot->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } if (centre) - say(320 - _vm->_gyro->_scroll[i].size() * 4 + iconIndent, my, _vm->_gyro->_scroll[i]); + say(320 - _vm->_avalot->_scroll[i].size() * 4 + iconIndent, my, _vm->_avalot->_scroll[i]); else - say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); + say(mx + iconIndent, my, _vm->_avalot->_scroll[i]); my += 12; } - _vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. + _vm->_avalot->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. ringBell(); - _vm->_gyro->_dropsOk = false; + _vm->_avalot->_dropsOk = false; dodgem(); (this->*modeFunc)(); unDodgem(); - _vm->_gyro->_dropsOk = true; + _vm->_avalot->_dropsOk = true; resetScrollDriver(); } @@ -497,9 +495,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = _vm->_gyro->_scrollNum * 5; - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; + int16 yl = _vm->_avalot->_scrollNum * 5; + for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { + uint16 textWidth = _vm->_avalot->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; } @@ -510,55 +508,55 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { int16 my = yw * 2 - 2; int16 xc = 0; - if ((_vm->_gyro->_talkX - xw) < 0) - xc = -(_vm->_gyro->_talkX - xw); - if ((_vm->_gyro->_talkX + xw) > 639) - xc = 639 - (_vm->_gyro->_talkX + xw); + if ((_vm->_avalot->_talkX - xw) < 0) + xc = -(_vm->_avalot->_talkX - xw); + if ((_vm->_avalot->_talkX + xw) > 639) + xc = 639 - (_vm->_avalot->_talkX + xw); - points[0].x = _vm->_gyro->_talkX - 10; + points[0].x = _vm->_avalot->_talkX - 10; points[0].y = yw; - points[1].x = _vm->_gyro->_talkX + 10; + points[1].x = _vm->_avalot->_talkX + 10; points[1].y = yw; - points[2].x = _vm->_gyro->_talkX; - points[2].y = _vm->_gyro->_talkY; + points[2].x = _vm->_avalot->_talkX; + points[2].y = _vm->_avalot->_talkY; // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw + 9, 7, _vm->_gyro->_talkX + xw - 8 + xc, my + 1), _vm->_gyro->_talkBackgroundColor); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw - 1, 12, _vm->_gyro->_talkX + xw + xc + 2, my - 4), _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw + 9, 7, _vm->_avalot->_talkX + xw - 8 + xc, my + 1), _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw - 1, 12, _vm->_avalot->_talkX + xw + xc + 2, my - 4), _vm->_avalot->_talkBackgroundColor); // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, 11, 0, 90, 9, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, 11, 0, 90, 9, _vm->_avalot->_talkBackgroundColor); // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_avalot->_talkBackgroundColor); // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, 11, 90, 180, 9, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, 11, 90, 180, 9, _vm->_avalot->_talkBackgroundColor); // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_avalot->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_avalot->_talkBackgroundColor); // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). - // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. + // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Avalot::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { - int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; - bool offset = _vm->_gyro->_scroll[i].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); + for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { + int16 x = xc + _vm->_avalot->_talkX - _vm->_avalot->_scroll[i].size() / 2 * 8; + bool offset = _vm->_avalot->_scroll[i].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_avalot->_scroll[i], _vm->_avalot->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_avalot->_talkFontColor); } ringBell(); CursorMan.showMouse(false); - _vm->_gyro->_dropsOk = false; + _vm->_avalot->_dropsOk = false; // This does the actual drawing to the screen. (this->*modeFunc)(); - _vm->_gyro->_dropsOk = true; + _vm->_avalot->_dropsOk = true; CursorMan.showMouse(true); // sink; resetScrollDriver(); } @@ -569,36 +567,36 @@ bool Dialogs::displayQuestion(Common::String question) { } void Dialogs::reset() { - _vm->_gyro->_scrollNum = 1; + _vm->_avalot->_scrollNum = 1; for (int i = 0; i < 15; i++) { - if (!_vm->_gyro->_scroll[i].empty()) - _vm->_gyro->_scroll[i].clear(); + if (!_vm->_avalot->_scroll[i].empty()) + _vm->_avalot->_scroll[i].clear(); } } void Dialogs::setBubbleStateNatural() { - _vm->_gyro->_talkX = 320; - _vm->_gyro->_talkY = 200; - _vm->_gyro->_talkBackgroundColor = 8; - _vm->_gyro->_talkFontColor = 15; + _vm->_avalot->_talkX = 320; + _vm->_avalot->_talkY = 200; + _vm->_avalot->_talkBackgroundColor = 8; + _vm->_avalot->_talkFontColor = 15; } Common::String Dialogs::displayMoney() { Common::String result; - if (_vm->_gyro->_money < 12) { // just pence - result = Common::String::format("%dd", _vm->_gyro->_money); - } else if (_vm->_gyro->_money < 240) { // shillings & pence - if ((_vm->_gyro->_money % 12) == 0) - result = Common::String::format("%d/-", _vm->_gyro->_money / 12); + if (_vm->_avalot->_money < 12) { // just pence + result = Common::String::format("%dd", _vm->_avalot->_money); + } else if (_vm->_avalot->_money < 240) { // shillings & pence + if ((_vm->_avalot->_money % 12) == 0) + result = Common::String::format("%d/-", _vm->_avalot->_money / 12); else - result = Common::String::format("%d/%d", _vm->_gyro->_money / 12, _vm->_gyro->_money % 12); + result = Common::String::format("%d/%d", _vm->_avalot->_money / 12, _vm->_avalot->_money % 12); } else { // L, s & d - result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20, - _vm->_gyro->_money % 12); + result = Common::String::format("\x9C%d.%d.%d", _vm->_avalot->_money / 240, (_vm->_avalot->_money / 12) % 20, + _vm->_avalot->_money % 12); } - if (_vm->_gyro->_money > 12) { - Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); + if (_vm->_avalot->_money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_avalot->_money); result += extraStr; } @@ -611,16 +609,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) { } void Dialogs::solidify(byte n) { - if (!_vm->_gyro->_scroll[n].contains(' ')) + if (!_vm->_avalot->_scroll[n].contains(' ')) return; // No spaces. // So there MUST be a space there, somewhere... do { - _vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; - _vm->_gyro->_scroll[n].deleteLastChar(); - } while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); + _vm->_avalot->_scroll[n + 1] = _vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] + _vm->_avalot->_scroll[n + 1]; + _vm->_avalot->_scroll[n].deleteLastChar(); + } while (_vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] != ' '); - stripTrailingSpaces(_vm->_gyro->_scroll[n]); + stripTrailingSpaces(_vm->_avalot->_scroll[n]); } void Dialogs::callDialogDriver() { @@ -630,60 +628,60 @@ void Dialogs::callDialogDriver() { _vm->_sound->stopSound(); setReadyLight(0); - _vm->_gyro->_scReturn = false; + _vm->_avalot->_scReturn = false; bool mouthnext = false; bool call_spriterun = true; // Only call sprite_run the FIRST time. - switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { + switch (_vm->_avalot->_buffer[_vm->_avalot->_bufSize - 1]) { case kControlToBuffer: - _vm->_gyro->_bufSize--; + _vm->_avalot->_bufSize--; break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: - _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; - _vm->_gyro->_bufSize++; + _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = kControlParagraph; + _vm->_avalot->_bufSize++; } - uint16 size = _vm->_gyro->_bufSize; + uint16 size = _vm->_avalot->_bufSize; for (uint16 i = 0; i < size; i++) { if (mouthnext) { - if (_vm->_gyro->_buffer[i] == kControlRegister) + if (_vm->_avalot->_buffer[i] == kControlRegister) _param = 0; - else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) - _param = _vm->_gyro->_buffer[i] - 48; - else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) - _param = _vm->_gyro->_buffer[i] - 55; + else if (('0' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= '9')) + _param = _vm->_avalot->_buffer[i] - 48; + else if (('A' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= 'Z')) + _param = _vm->_avalot->_buffer[i] - 55; mouthnext = false; } else { - switch (_vm->_gyro->_buffer[i]) { + switch (_vm->_avalot->_buffer[i]) { case kControlParagraph: - if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) + if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) break; if (call_spriterun) - _vm->_lucerna->spriteRun(); + _vm->_avalot->spriteRun(); call_spriterun = false; drawScroll(&Avalanche::Dialogs::scrollModeNormal); reset(); - if (_vm->_gyro->_scReturn) + if (_vm->_avalot->_scReturn) return; break; case kControlBell: - _vm->_gyro->_scrollBells++; + _vm->_avalot->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) + if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) break; if (call_spriterun) - _vm->_lucerna->spriteRun(); + _vm->_avalot->spriteRun(); call_spriterun = false; if (_param == 0) @@ -691,7 +689,7 @@ void Dialogs::callDialogDriver() { else if ((1 <= _param) && (_param <= 9)) { AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. - _vm->_lucerna->errorLed(); + _vm->_avalot->errorLed(); setBubbleStateNatural(); } else spr->chatter(); // Normal sprite talking routine. @@ -699,14 +697,14 @@ void Dialogs::callDialogDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; - _vm->_gyro->_talkX = quasiPed->_x; - _vm->_gyro->_talkY = quasiPed->_y; // Position. + PedType *quasiPed = &_vm->_avalot->_peds[_vm->_avalot->kQuasipeds[_param - 10]._whichPed]; + _vm->_avalot->_talkX = quasiPed->_x; + _vm->_avalot->_talkY = quasiPed->_y; // Position. - _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; - _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. + _vm->_avalot->_talkFontColor = _vm->_avalot->kQuasipeds[_param - 10]._foregroundColor; + _vm->_avalot->_talkBackgroundColor = _vm->_avalot->kQuasipeds[_param - 10]._backgroundColor; // Colors. } else { - _vm->_lucerna->errorLed(); // Not valid. + _vm->_avalot->errorLed(); // Not valid. setBubbleStateNatural(); } @@ -714,7 +712,7 @@ void Dialogs::callDialogDriver() { reset(); - if (_vm->_gyro->_scReturn) + if (_vm->_avalot->_scReturn) return; break; @@ -725,46 +723,46 @@ void Dialogs::callDialogDriver() { displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: { - int pwdId = _vm->_parser->kFirstPassword + _vm->_gyro->_passwordNum; + int pwdId = _vm->_parser->kFirstPassword + _vm->_avalot->_passwordNum; displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer); } break; case 3: - displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); + displayText(_vm->_avalot->_favouriteDrink + kControlToBuffer); break; case 4: - displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); + displayText(_vm->_avalot->_favouriteSong + kControlToBuffer); break; case 5: - displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); + displayText(_vm->_avalot->_worstPlaceOnEarth + kControlToBuffer); break; case 6: - displayText(_vm->_gyro->_spareEvening + kControlToBuffer); + displayText(_vm->_avalot->_spareEvening + kControlToBuffer); break; case 9: { - Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_catacombX, _vm->_gyro->_catacombY, kControlToBuffer); + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_avalot->_catacombX, _vm->_avalot->_catacombY, kControlToBuffer); displayText(tmpStr); } break; case 10: - switch (_vm->_gyro->_boxContent) { + switch (_vm->_avalot->_boxContent) { case 0: // Sixpence. displayScrollChain('q', 37); // You find the sixpence. - _vm->_gyro->_money += 6; - _vm->_gyro->_boxContent = _vm->_parser->kNothing; - _vm->_lucerna->incScore(2); + _vm->_avalot->_money += 6; + _vm->_avalot->_boxContent = _vm->_parser->kNothing; + _vm->_avalot->incScore(2); return; case Parser::kNothing: displayText("nothing at all. It's completely empty."); break; default: - displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); + displayText(_vm->_avalot->getItem(_vm->_avalot->_boxContent) + '.'); } break; case 11: for (int j = 0; j < kObjectNum; j++) { - if (_vm->_gyro->_objects[j]) - displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); + if (_vm->_avalot->_objects[j]) + displayText(_vm->_avalot->getItem(j) + ", " + kControlToBuffer); } break; } @@ -773,15 +771,15 @@ void Dialogs::callDialogDriver() { _useIcon = _param; break; case kControlNewLine: - _vm->_gyro->_scrollNum++; + _vm->_avalot->_scrollNum++; break; case kControlQuestion: if (call_spriterun) - _vm->_lucerna->spriteRun(); + _vm->_avalot->spriteRun(); call_spriterun = false; - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; - _vm->_gyro->_scrollNum++; + _vm->_avalot->_scroll[_vm->_avalot->_scrollNum] = kControlQuestion; + _vm->_avalot->_scrollNum++; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -791,14 +789,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; + _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += ' '; break; default: // Add new char. - if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { - solidify(_vm->_gyro->_scrollNum - 1); - _vm->_gyro->_scrollNum++; + if (_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1].size() == 50) { + solidify(_vm->_avalot->_scrollNum - 1); + _vm->_avalot->_scrollNum++; } - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; + _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += _vm->_avalot->_buffer[i]; break; } } @@ -806,8 +804,8 @@ void Dialogs::callDialogDriver() { } void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_gyro->_bufSize = text.size(); - memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); + _vm->_avalot->_bufSize = text.size(); + memcpy(_vm->_avalot->_buffer, text.c_str(), _vm->_avalot->_bufSize); callDialogDriver(); } @@ -832,7 +830,7 @@ void Dialogs::loadFont() { error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); for (int16 i = 0; i < 256; i++) - file.read(_vm->_gyro->_font[i],16); + file.read(_vm->_avalot->_font[i],16); file.close(); } @@ -841,7 +839,7 @@ void Dialogs::displayMusicalScroll() { kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); displayText(tmpStr); - _vm->_lucerna->spriteRun(); + _vm->_avalot->spriteRun(); CursorMan.showMouse(false); drawScroll(&Avalanche::Dialogs::scrollModeMusic); CursorMan.showMouse(true); @@ -851,13 +849,13 @@ void Dialogs::displayMusicalScroll() { // From Visa: void Dialogs::unSkrimble() { - for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) - _vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; + for (uint16 i = 0; i < _vm->_avalot->_bufSize; i++) + _vm->_avalot->_buffer[i] = (~(_vm->_avalot->_buffer[i] - (i + 1))) % 256; } void Dialogs::doTheBubble() { - _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; - _vm->_gyro->_bufSize++; + _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = 2; + _vm->_avalot->_bufSize++; } /** @@ -898,8 +896,8 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + _vm->_avalot->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); sezfile.close(); unSkrimble(); @@ -944,8 +942,8 @@ void Dialogs::speak(byte who, byte subject) { error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_gyro->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); + _vm->_avalot->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); sezfile.close(); unSkrimble(); @@ -957,26 +955,26 @@ void Dialogs::speak(byte who, byte subject) { void Dialogs::talkTo(byte whom) { if (_vm->_parser->_person == _vm->_parser->kPardon) { - _vm->_parser->_person = _vm->_gyro->_subjectNum; - _vm->_gyro->_subjectNum = 0; + _vm->_parser->_person = _vm->_avalot->_subjectNum; + _vm->_avalot->_subjectNum = 0; } - if (_vm->_gyro->_subjectNum == 0) { + if (_vm->_avalot->_subjectNum == 0) { switch (whom) { - case Gyro::kPeopleSpludwick: - if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { + case Avalot::kPeopleSpludwick: + if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[Avalot::kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(3); + _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->incScore(3); return; - } else if (_vm->_gyro->_talkedToCrapulus) { + } else if (_vm->_avalot->_talkedToCrapulus) { // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_gyro->_givenToSpludwick) { + switch (_vm->_avalot->_givenToSpludwick) { case 1: // Fallthrough is intended. case 2: { - Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); + Common::String objStr = _vm->_avalot->getItem(Avalot::kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); displayText(tmpStr); } @@ -990,57 +988,57 @@ void Dialogs::talkTo(byte whom) { return; } break; - case Gyro::kPeopleIbythneth: - if (_vm->_gyro->_givenBadgeToIby) { + case Avalot::kPeopleIbythneth: + if (_vm->_avalot->_givenBadgeToIby) { displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. - case Gyro::kPeopleDogfood: - if (_vm->_gyro->_wonNim) { // We've won the game. + case Avalot::kPeopleDogfood: + if (_vm->_avalot->_wonNim) { // We've won the game. displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else - _vm->_gyro->_askedDogfoodAboutNim = true; + _vm->_avalot->_askedDogfoodAboutNim = true; break; - case Gyro::kPeopleAyles: - if (!_vm->_gyro->_aylesIsAwake) { + case Avalot::kPeopleAyles: + if (!_vm->_avalot->_aylesIsAwake) { displayScrollChain('q', 43); // He's fast asleep! return; - } else if (!_vm->_gyro->_givenPenToAyles) { + } else if (!_vm->_avalot->_givenPenToAyles) { displayScrollChain('q', 44); // Can you get me a pen, Avvy? return; } break; - case Gyro::kPeopleJacques: + case Avalot::kPeopleJacques: displayScrollChain('q', 43); return; - case Gyro::kPeopleGeida: - if (_vm->_gyro->_givenPotionToGeida) - _vm->_gyro->_geidaFollows = true; + case Avalot::kPeopleGeida: + if (_vm->_avalot->_givenPotionToGeida) + _vm->_avalot->_geidaFollows = true; else { displayScrollChain('u', 17); return; } break; - case Gyro::kPeopleSpurge: - if (!_vm->_gyro->_sittingInPub) { + case Avalot::kPeopleSpurge: + if (!_vm->_avalot->_sittingInPub) { displayScrollChain('q', 71); // Try going over and sitting down. return; } else { - if (_vm->_gyro->_spurgeTalkCount < 5) - _vm->_gyro->_spurgeTalkCount++; - if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); + if (_vm->_avalot->_spurgeTalkCount < 5) + _vm->_avalot->_spurgeTalkCount++; + if (_vm->_avalot->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_avalot->_spurgeTalkCount); return; } } break; } // On a subject. Is there any reason to block it? - } else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { + } else if ((whom == Avalot::kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -1063,23 +1061,23 @@ void Dialogs::talkTo(byte whom) { displayText(tmpStr); } - speak(whom, _vm->_gyro->_subjectNum); + speak(whom, _vm->_avalot->_subjectNum); if (!_noError) displayScrollChain('n', whom); // File not found! - if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; - _vm->_lucerna->refreshObjectList(); + if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == Avalot::kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_avalot->_objects[Avalot::kObjectBadge - 1] = true; + _vm->_avalot->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_gyro->_talkedToCrapulus = true; - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. + _vm->_avalot->_talkedToCrapulus = true; + _vm->_avalot->_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; spr->walkTo(2); // Walks away. - _vm->_lucerna->incScore(2); + _vm->_avalot->incScore(2); } } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp deleted file mode 100644 index 99608399d8c1..000000000000 --- a/engines/avalanche/gyro.cpp +++ /dev/null @@ -1,599 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* GYRO It all revolves around this bit! */ - -#include "avalanche/avalanche.h" -#include "avalanche/gyro.h" -#include "avalanche/pingo.h" -#include "avalanche/dialogs.h" -#include "avalanche/lucerna.h" -#include "avalanche/animation.h" - -#include "common/file.h" -#include "common/random.h" -#include "common/textconsole.h" - -namespace Avalanche { - -const char *Gyro::kVersionNum = "1.30"; -const char *Gyro::kCopyright = "1995"; - -const MouseHotspotType Gyro::kMouseHotSpots[9] = { - {8,0}, // 1 - up-arrow - {0,0}, // 2 - screwdriver - {15,6}, // 3 - right-arrow - {0,0}, // 4 - fletch - {8,7}, // 5 - hourglass - {4,0}, // 6 - TTHand - {8,5}, // 7- Mark's crosshairs - {8,7}, // 8- I-beam - {0,0} // 9 - question mark -}; - -// Art gallery at 2,1; notice about this at 2,2. -const int32 Gyro::kCatacombMap[8][8] = { - // Geida's room - // 1 2 3 | 4 5 6 7 8 - {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, - {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, - {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, - {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette - {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, - {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, - {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here - {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} -}; -// vv Stairs trap. - -/* Explanation: $NSEW. - Nibble N: North. - 0 = no connection, - 2 = (left,) middle(, right) door with left-hand handle, - 5 = (left,) middle(, right) door with right-hand handle, - 7 = arch, - 8 = arch and 1 north of it, - 9 = arch and 2 north of it, - D = no connection + WINDOW, - E = no connection + TORCH, - F = recessed door (to Geida's room.) - - Nibble S: South. - 0 = no connection, - 1,2,3 = left, middle, right door. - - Nibble E: East. - 0 = no connection (wall), - 1 = no connection (wall + window), - 2 = wall with door, - 3 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. - - Nibble W: West. - 0 = no connection (wall), - 1 = no connection (wall + shield), - 2 = wall with door, - 3 = wall with door and shield, - 4 = no connection (window), - 5 = wall with door and window, - 6 = wall with candles, - 7 = wall with door and candles, - F = straight-through corridor. */ - -const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; - -// A quasiped defines how people who aren't sprites talk. For example, quasiped -// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. -const QuasipedType Gyro::kQuasipeds[16] = { -//_whichPed, _foregroundColor, _room, _backgroundColor, _who - {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). - {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). - {2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). - {2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). - {5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) - {1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). - {1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). - {1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). - {2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). - {1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). - {1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). - {3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19). - {4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47). - {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). -}; - -const uint16 Gyro::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; - -const TuneType Gyro::kTune = { - kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, - kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, - kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher -}; - -byte Gyro::_whereIs[29] = { - // The Lads - kRoomYours, // Avvy - kRoomSpludwicks, // Spludwick - kRoomOutsideYours, // Crapulus - kRoomDucks, // Duck - r__DucksRoom's not defined yet. - kRoomArgentPub, // Malagauche - kRoomRobins, // Friar Tuck. - kRoomDummy, // Robin Hood - can't meet him at the start. - kRoomBrummieRoad, // Cwytalot - kRoomLustiesRoom, // Baron du Lustie. - kRoomOutsideCardiffCastle, // The Duke of Cardiff. - kRoomArgentPub, // Dogfood - kRoomOutsideDucks, // Trader - kRoomArgentPub, // Ibythneth - kRoomAylesOffice, // Ayles - kRoomNottsPub, // Port - kRoomNottsPub, // Spurge - kRoomMusicRoom, // Jacques - 0, 0, 0, 0, 0, 0, 0, 0, - // The Lasses - kRoomYours, // Arkata - kRoomGeidas, // Geida - kRoomDummy, // nobody allocated here! - kRoomWiseWomans // The Wise Woman. -}; - -Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0) { - _vm = vm; - - // Needed because of Lucerna::load_also() - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _also[i][j] = 0; - } - - _totalTime = 0; -} - -Gyro::~Gyro() { - for (int i = 0; i < 9; i++) { - _digits[i].free(); - _directions[i].free(); - } - _digits[9].free(); -} - -Common::String Gyro::intToStr(int32 num) { - return Common::String::format("%d", num); -} - -void Gyro::newMouse(byte id) { - if (id == _currentMouse) - return; - - _currentMouse = id; - loadMouse(id); -} - -/** - * Set the mouse pointer to 'HourGlass" - * @remarks Originally called 'wait' - */ -void Gyro::setMousePointerWait() { - newMouse(4); -} - -void Gyro::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { - warning("STUB: Gyro::shadow()"); -} - -void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { - warning("STUB: Gyro::shbox()"); -} - -void Gyro::resetVariables() { -// Replaces memset(&_vm->_gyro->_dna, 0, sizeof(DnaType)); - _vm->_animation->_direction = 0; - _carryNum = 0; - for (int i = 0; i < kObjectNum; i++) - _objects[i] = false; - - _dnascore = 0; - _money = 0; - _room = kRoomNowhere; - _wearing = 0; - _sworeNum = 0; - _saveNum = 0; - for (int i = 0; i < 100; i++) - _roomCount[i] = 0; - - _alcoholLevel = 0; - _playedNim = 0; - _wonNim = false; - _wineState = 0; - _cwytalotGone = false; - _passwordNum = 0; - _aylesIsAwake = false; - _drawbridgeOpen = 0; - _avariciusTalk = 0; - _boughtOnion = false; - _rottenOnion = false; - _onionInVinegar = false; - _givenToSpludwick = 0; - _brummieStairs = 0; - _cardiffQuestionNum = 0; - _passedCwytalotInHerts = false; - _avvyIsAwake = false; - _avvyInBed = false; - _userMovesAvvy = false; - _npcFacing = 0; - _givenBadgeToIby = false; - _friarWillTieYouUp = false; - _tiedUp = false; - _boxContent = 0; - _talkedToCrapulus = false; - _jacquesState = 0; - _bellsAreRinging = false; - _standingOnDais = false; - _takenPen = false; - _arrowTriggered = false; - _arrowInTheDoor = false; - _favouriteDrink = ""; - _favouriteSong = ""; - _worstPlaceOnEarth = ""; - _spareEvening = ""; - _totalTime = 0; - _jumpStatus = 0; - _mushroomGrowing = false; - _spludwickAtHome = false; - _lastRoom = 0; - _lastRoomNotMap = 0; - _crapulusWillTell = false; - _enterCatacombsFromLustiesRoom = false; - _teetotal = false; - _malagauche = 0; - _drinking = 0; - _enteredLustiesRoomAsMonk = false; - _catacombX = 0; - _catacombY = 0; - _avvysInTheCupboard = false; - _geidaFollows = false; - _geidaSpin = 0; - _geidaTime = 0; - _nextBell = 0; - _givenPotionToGeida = false; - _lustieIsAsleep = false; - _flipToWhere = 0; - _flipToPed = 0; - _beenTiedUp = false; - _sittingInPub = false; - _spurgeTalkCount = 0; - _metAvaroid = false; - _takenMushroom = false; - _givenPenToAyles = false; - _askedDogfoodAboutNim = false; -} - -void Gyro::newGame() { - for (int i = 0; i < kMaxSprites; i++) { - AnimationType *spr = &_vm->_animation->_sprites[i]; - if (spr->_quick) - spr->remove(); - } - // Deallocate sprite. Sorry, beta testers! - - AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->init(0, true, _vm->_animation); - - _alive = true; - resetVariables(); - - _vm->_dialogs->setBubbleStateNatural(); - - _spareEvening = "answer a questionnaire"; - _favouriteDrink = "beer"; - _money = 30; // 2/6 - _vm->_animation->_direction = Animation::kDirStopped; - _wearing = kObjectClothes; - _objects[kObjectMoney - 1] = true; - _objects[kObjectBodkin - 1] = true; - _objects[kObjectBell - 1] = true; - _objects[kObjectClothes - 1] = true; - - _thinkThing = true; - _thinks = 2; - _vm->_lucerna->refreshObjectList(); - _onToolbar = false; - _seeScroll = false; - - avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. - //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; - // fillchar(previous^,sizeof(previous^),#0); { blank out array } - _him = Parser::kPardon; - _her = Parser::kPardon; - _it = Parser::kPardon; - _lastPerson = Parser::kPardon; // = Pardon? - _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; - _userMovesAvvy = false; - _doingSpriteRun = false; - _avvyInBed = true; - _enidFilename = ""; - - _vm->_lucerna->enterRoom(1, 1); - avvy->_visible = false; - _vm->_lucerna->drawScore(); - _vm->_menu->setup(); - _vm->_lucerna->_clock.update(); - _vm->_lucerna->spriteRun(); -} - -void Gyro::slowDown() { - warning("STUB: Gyro::slowdown()"); -} - -bool Gyro::setFlag(char x) { - for (uint16 i = 0; i < _flags.size(); i++) { - if (_flags[i] == x) - return true; - } - - return false; -} - -bool Gyro::decreaseMoney(uint16 howmuchby) { - _money -= howmuchby; - if (_money < 0) { - _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" - _vm->_lucerna->gameOver(); - return false; - } else - return true; -} - -Common::String Gyro::getName(byte whose) { - static const Common::String kLads[17] = { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" - }; - - static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; - - if (whose < 175) - return kLads[whose - 150]; - else - return kLasses[whose - 175]; -} - -byte Gyro::getNameChar(byte whose) { - static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; - static const char kLassChar[] = "kG\0xB1o"; - - if (whose < 175) - return kLadChar[whose - 150]; - else - return kLassChar[whose - 175]; -} - -Common::String Gyro::getThing(byte which) { - static const Common::String kThings[kObjectNum] = { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" - }; - - Common::String get_thing_result; - switch (which) { - case kObjectWine: - switch (_wineState) { - case 1: - case 4: - get_thing_result = kThings[which - 1]; - break; - case 3: - get_thing_result = "Vinegar"; - break; - } - break; - case kObjectOnion: - if (_rottenOnion) - get_thing_result = "rotten onion"; - else - get_thing_result = kThings[which - 1]; - break; - default: - get_thing_result = kThings[which - 1]; - } - return get_thing_result; -} - -char Gyro::getThingChar(byte which) { - static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar - - char get_thingchar_result; - switch (which) { - case kObjectWine: - if (_wineState == 3) - get_thingchar_result = 'V'; // Vinegar - else - get_thingchar_result = kThingsChar[which - 1]; - break; - default: - get_thingchar_result = kThingsChar[which - 1]; - } - return get_thingchar_result; -} - -Common::String Gyro::getItem(byte which) { - static const Common::String kItems[kObjectNum] = { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" - }; - - Common::String get_better_result; - if (which > 150) - which -= 149; - - switch (which) { - case kObjectWine: - switch (_wineState) { - case 0: - case 1: - case 4: - get_better_result = kItems[which - 1]; - break; - case 3: - get_better_result = "some vinegar"; - break; - } - break; - case kObjectOnion: - if (_rottenOnion) - get_better_result = "a rotten onion"; - else if (_onionInVinegar) - get_better_result = "a pickled onion (in the vinegar)"; - else - get_better_result = kItems[which - 1]; - break; - default: - if ((which < kObjectNum) && (which > 0)) - get_better_result = kItems[which - 1]; - else - get_better_result = ""; - } - return get_better_result; -} - - -Common::String Gyro::f5Does() { - switch (_room) { - case kRoomYours: - if (!_avvyIsAwake) - return Common::String::format("%cWWake up", Parser::kVerbCodeWake); - else if (_avvyInBed) - return Common::String::format("%cGGet up", Parser::kVerbCodeStand); - break; - case kRoomInsideCardiffCastle: - if (_standingOnDais) - return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb); - else - return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb); - break; - case kRoomNottsPub: - if (_sittingInPub) - return Common::String::format("%cSStand up", Parser::kVerbCodeStand); - else - return Common::String::format("%cSSit down", Parser::kVerbCodeSit); - break; - case kRoomMusicRoom: - if (_vm->_animation->inField(5)) - return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay); - break; - } - - return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails... -} - -void Gyro::loadMouse(byte which) { - Common::File f; - - if (!f.open("mice.avd")) - error("AVALANCHE: Gyro: File not found: mice.avd"); - - ::Graphics::Surface cursor; - cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); - cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); - - - // The AND mask. - f.seek(kMouseSize * 2 * which + 134); - - ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); - - for (int j = 0; j < mask.h; j++) { - for (int i = 0; i < mask.w; i++) { - for (int k = 0; k < 2; k++) { - if (*(byte *)mask.getBasePtr(i, j) == 0) - *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; - } - } - } - - mask.free(); - - // The OR mask. - f.seek(kMouseSize * 2 * which + 134 * 2); - - mask = _vm->_graphics->loadPictureGraphic(f); - - for (int j = 0; j < mask.h; j++) { - for (int i = 0; i < mask.w; i++) { - for (int k = 0; k < 2; k++) { - byte pixel = *(byte *)mask.getBasePtr(i, j); - if (pixel != 0) - *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; - } - } - } - - mask.free(); - f.close(); - - CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); - cursor.free(); -} - -void Gyro::setBackgroundColor(byte x) { - warning("STUB: Gyro::background()"); -} - -void Gyro::hangAroundForAWhile() { - for (int i = 0; i < 28; i++) - slowDown(); -} - -void Gyro::init() { - _mouse = kMouseStateNo; - _letMeOut = false; - _holdTheDawn = true; - _currentMouse = 177; - _dropsOk = true; - _mouseText = ""; - _cheat = false; - _cp = 0; - _ledStatus = 177; - _defaultLed = 2; - _enidFilename = ""; // Undefined. - for (int i = 0; i < 3; i++) - _scoreToDisplay[i] = -1; // Impossible digits. - _holdTheDawn = false; - - setMousePointerWait(); - CursorMan.showMouse(true); -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h deleted file mode 100644 index 99fe6f7142fb..000000000000 --- a/engines/avalanche/gyro.h +++ /dev/null @@ -1,367 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* GYRO It all revolves around this bit! */ - -#ifndef AVALANCHE_GYRO2_H -#define AVALANCHE_GYRO2_H - -#include "common/str.h" -#include "common/scummsys.h" -#include "common/file.h" - -#include "graphics/surface.h" - -namespace Avalanche { -class AvalancheEngine; - -enum Color { - kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, - kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, - kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, - kColorWhite -}; - -// CHECKME: kRoomBossKey is a guess -enum Room { - kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, - kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10, - kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14, - kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20, - kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25, - kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29, - kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47, - kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, - kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room -}; - -static const byte kObjectNum = 18; // always preface with a # -static const int16 kCarryLimit = 12; // carry limit - -static const int16 kNumlockCode = 32; // Code for Num Lock -static const int16 kMouseSize = 134; - -struct MouseHotspotType { // mouse-void - int16 _horizontal, _vertical; -}; - -struct PedType { - int16 _x, _y; - byte _direction; -}; - -struct MagicType { - byte _operation; // one of the operations - uint16 _data; // data for them -}; - -class FieldType { -public: - int16 _x1, _y1, _x2, _y2; -}; - -struct ByteField { - byte _x1, _y1, _x2, _y2; -}; - -class LineType : public FieldType { -public: - byte _color; -}; - -typedef int8 TuneType[31]; - -struct QuasipedType { - byte _whichPed, _foregroundColor, _room, _backgroundColor; - uint16 _who; -}; - -#if 0 -struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA. - Common::String _qEnidFilename; - bool _qSoundFx; - byte _qThinks; - bool _qThinkThing; -}; -#endif - -class Gyro { -public: - static const char *kVersionNum; - static const char *kCopyright; - static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". - static const int16 kGameCode = 2; // Avalot's code number - - // Objects you can hold: - enum Object { - kObjectWine = 1, - kObjectMoney, - kObjectBodkin, - kObjectPotion, - kObjectChastity, - kObjectBolt, - kObjectCrossbow, - kObjectLute, - kObjectBadge, - kObjectMushroom, - kObjectKey, - kObjectBell, - kObjectPrescription, - kObjectPen, - kObjectInk, - kObjectClothes, - kObjectHabit, - kObjectOnion - }; - - // People who hang around this game. - enum People { - // Boys: - kPeopleAvalot = 150, - kPeopleSpludwick = 151, - kPeopleCrapulus = 152, - kPeopleDrDuck = 153, - kPeopleMalagauche = 154, - kPeopleFriarTuck = 155, - kPeopleRobinHood = 156, - kPeopleCwytalot = 157, - kPeopleDuLustie = 158, - kPeopleDuke = 159, - kPeopleDogfood = 160, - kPeopleTrader = 161, - kPeopleIbythneth = 162, - kPeopleAyles = 163, - kPeoplePort = 164, - kPeopleSpurge = 165, - kPeopleJacques = 166, - // Girls: - kPeopleArkata = 175, - kPeopleGeida = 176, - kPeopleInvisible = 177, - kPeopleWisewoman = 178 - }; - - static const int16 kXW = 30; - static const int16 kYW = 36; // x width & y whatsit - static const int16 kMargin = 5; - static const MouseHotspotType kMouseHotSpots[9]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. - - // For Thinkabout: - static const bool kThing = true; - static const bool kPerson = false; - - // Magic/portal constants: - enum Magics { - kMagicNothing, // Ignore it if this line is touched. - kMagicBounce, // Bounce off this line. Not valid for portals. - kMagicExclaim, // Put up a chain of scrolls. - kMagicTransport, // Enter new room. - kMagicUnfinished, // Unfinished connection. - kMagicSpecial, // Special function. - kMagicOpenDoor // Opening door. - }; - - // These following static constants should be included in CFG when it's written. - - static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. - static const int16 kBorder = 1; // size of border on shadowboxes - static const int16 kWalk = 3; - static const int16 kRun = 5; - static const int32 kCatacombMap[8][8]; - static const char kSpludwicksOrder[3]; - static const QuasipedType kQuasipeds[16]; - - enum Pitch { - kPitchInvalid, - kPitchLower, - kPitchSame, - kPitchHigher - }; - - static const uint16 kNotes[12]; - static const TuneType kTune; - - // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. - // If a scroll comes up, or you leave the room, it's automatically set to zero. - byte _interrogation; - static byte _whereIs[29]; - - // Former DNA structure - byte _carryNum; // How many objects you're carrying... - bool _objects[kObjectNum]; // ...and which ones they are. - int16 _dnascore; // your score, of course - int32 _money; // your current amount of dosh - byte _room; // your current room - byte _wearing; // what you're wearing - byte _sworeNum; // number of times you've sworn - byte _saveNum; // number of times this game has been saved - byte _roomCount[100]; // Add one to each every time you enter a room - byte _alcoholLevel; // Your blood alcohol level. - byte _playedNim; // How many times you've played Nim. - bool _wonNim; // Have you *won* Nim? (That's harder.) - byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. - bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte _passwordNum; // Number of the passw for this game. - bool _aylesIsAwake; // pretty obvious! - byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). - byte _avariciusTalk; // How much Avaricius has said to you. - bool _boughtOnion; // Have you bought an onion yet? - bool _rottenOnion; // And has it rotted? - bool _onionInVinegar; // Is the onion in the vinegar? - byte _givenToSpludwick; // 0 = nothing given, 1 = onion... - byte _brummieStairs; // Progression through the stairs trick. - byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) - bool _avvyInBed; // True if Avvy's in bed, but awake. - bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. - bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool _friarWillTieYouUp; // If you're going to get tied up. - bool _tiedUp; // You ARE tied up! - byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool _talkedToCrapulus; // Pretty self-explanatory. - byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool _bellsAreRinging; // Is Jacques ringing the bells? - bool _standingOnDais; // In room 71, inside Cardiff Castle. - bool _takenPen; // Have you taken the pen (in Cardiff?) - bool _arrowTriggered; // And has the arrow been triggered? - bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 _totalTime; // Your total time playing this game, in ticks. - byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; - byte _lastRoomNotMap; - bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool _enterCatacombsFromLustiesRoom; - bool _teetotal; // Are we touching any more drinks? - byte _malagauche; // Position of Malagauche. See Celer for more info. - char _drinking; // What's he getting you? - bool _enteredLustiesRoomAsMonk; - byte _catacombX, _catacombY; // XY coords in the catacombs. - bool _avvysInTheCupboard; // On screen 22. - bool _geidaFollows; // Is Geida following you? - byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. - byte _nextBell; // For the ringing. - bool _givenPotionToGeida; // Does Geida have the potion? - bool _lustieIsAsleep; // Is BDL asleep? - byte _flipToWhere, _flipToPed; // For the sequencer. - bool _beenTiedUp; // In r__Robins. - bool _sittingInPub; // Are you sitting down in the pub? - byte _spurgeTalkCount; // Count for talking to Spurge. - bool _metAvaroid; - bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; - // End of former DNA Structure - - byte _lineNum; // Number of lines. - LineType _lines[50]; // For Also. - enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; - bool _dropsOk, _scReturn, _soundFx, _cheat; - Common::String _mouseText; - bool _weirdWord; - bool _letMeOut; - Common::String _scroll[15]; - byte _scrollNum, _whichwas; - byte _thinks; - bool _thinkThing; - int16 _talkX, _talkY; - byte _talkBackgroundColor, _talkFontColor; - byte _scrollBells; // no. of times to ring the bell - bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - char _objectList[10]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. - // Called .free() for them in ~Gyro(). - int8 _scoreToDisplay[3]; - byte _currentMouse; // current mouse-void - Common::String _verbStr; // what you can do with your object. :-) - Common::String *_also[31][2]; - PedType _peds[15]; - MagicType _magics[15]; - MagicType _portals[7]; - FieldType _fields[30]; - byte _fieldNum; - Common::String _flags; - Common::String _listen; - Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". - byte _cp, _ledStatus, _defaultLed; - FontType _font; - bool _alive; - byte _buffer[2000]; - uint16 _bufSize; - int16 _underScroll; // Y-coord of just under the scroll text. - Common::String _roomnName; // Name of actual room - Common::String _subject; // What you're talking to them about. - byte _subjectNum; // The same thing. - bool _keyboardClick; // Is a keyboard click noise wanted? - byte _him, _her, _it; - int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - - byte _lastPerson; // Last person to have been selected using the People menu. - bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - bool _isLoaded; // Is it a loaded gamestate? - Common::String _enidFilename; - - Gyro(AvalancheEngine *vm); - ~Gyro(); - - Common::String intToStr(int32 num); - void newMouse(byte id); - void setMousePointerWait(); // Makes hourglass. - void loadMouse(byte which); - - void setBackgroundColor(byte x); - void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); - - void resetVariables(); - void newGame(); // This sets up the DNA for a completely new game. - void slowDown(); - bool setFlag(char x); - bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. - void hangAroundForAWhile(); - - Common::String getName(byte whose); - byte getNameChar(byte whose); - Common::String getThing(byte which); - char getThingChar(byte which); - Common::String getItem(byte which); // Called get_better in the original. - Common::String f5Does(); // This procedure determines what f5 does. - - void init(); -private: - AvalancheEngine *_vm; - - void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); -}; - -} // End of namespace Avalanche - -#endif // AVALANCHE_GYRO2_H diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp deleted file mode 100644 index 88c13571a079..000000000000 --- a/engines/avalanche/lucerna.cpp +++ /dev/null @@ -1,1224 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LUCERNA The screen, [keyboard] and mouse handler.*/ - -#include "avalanche/avalanche.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h" -#include "avalanche/dialogs.h" -#include "avalanche/timer.h" -#include "avalanche/animation.h" -#include "avalanche/background.h" -#include "avalanche/pingo.h" -#include "avalanche/sequence.h" - -#include "common/rect.h" -#include "common/system.h" - -#include "graphics/palette.h" - -namespace Avalanche { - -Clock::Clock(AvalancheEngine *vm) { - _vm = vm; - _oldHour = _oldHourAngle = _oldMinute = 17717; -} - -void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. - TimeDate t; - _vm->_system->getTimeAndDate(t); - _hour = t.tm_hour; - _minute = t.tm_min; - _second = t.tm_sec; - - _hourAngle = (_hour % 12) * 30 + _minute / 2; - - if (_oldHour != _hour) { - plotHands(); - chime(); - } - - if (_oldMinute != _minute) - plotHands(); - - if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { - Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ - "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", - Dialogs::kControlNewLine, Dialogs::kControlNewLine); - _vm->_dialogs->displayText(tmpStr); - } - _oldHour = _hour; - _oldHourAngle = _hourAngle; - _oldMinute = _minute; -} - -void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { - if (angle > 900) { - endPoint.x = 177; - return; - } - - endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); -} - -void Clock::drawHand(const Common::Point &endPoint, byte color) { - if (endPoint.x == 177) - return; - - _vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); -} - -void Clock::plotHands() { - calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); - calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); - drawHand(_clockHandHour, kColorBrown); - drawHand(_clockHandMinute, kColorBrown); - - calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); - calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); - drawHand(_clockHandHour, kColorYellow); - drawHand(_clockHandMinute, kColorYellow); -} - -void Clock::chime() { - warning("STUB: Clock::chime()"); -} - -Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { - _vm = vm; -} - -Lucerna::~Lucerna() { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) { - if (_vm->_gyro->_also[i][j] != 0) { - delete _vm->_gyro->_also[i][j]; - _vm->_gyro->_also[i][j] = 0; - } - } - } -} - -void Lucerna::init() { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _vm->_gyro->_also[i][j] = 0; - } - -#if 0 - if (_vm->_enhanced->atbios) - _vm->_gyro->atkey = "f1"; - else - _vm->_gyro->atkey = "alt-"; -#endif -} - -/** - * Call a given Verb - * @remarks Originally called 'callverb' - */ -void Lucerna::callVerb(byte id) { - if (id == _vm->_parser->kPardon) { - Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ - "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ - "what the current setting of this key is."); - _vm->_dialogs->displayText(tmpStr); - } else { - _vm->_gyro->_weirdWord = false; - _vm->_parser->_polite = true; - _vm->_parser->_verb = id; - _vm->_parser->doThat(); - } -} - -void Lucerna::drawAlsoLines() { - CursorMan.showMouse(false); - - _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - - for (int i = 0; i < _vm->_gyro->_lineNum; i++) { - // We had to check if the lines are within the borders of the screen. - if ((_vm->_gyro->_lines[i]._x1 >= 0) && (_vm->_gyro->_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y1 >= 0) && (_vm->_gyro->_lines[i]._y1 < _vm->_graphics->kScreenHeight) - && (_vm->_gyro->_lines[i]._x2 >= 0) && (_vm->_gyro->_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y2 >= 0) && (_vm->_gyro->_lines[i]._y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i]._color); - } - - CursorMan.showMouse(true); -} - -/** - * Check is it's possible to give something to Spludwick - * @remarks Originally called 'nextstring' - */ -Common::String Lucerna::readAlsoStringFromFile() { - Common::String str; - byte length = file.readByte(); - for (int i = 0; i < length; i++) - str += file.readByte(); - return str; -} - -void Lucerna::scram(Common::String &str) { - for (uint i = 0; i < str.size(); i++) - str.setChar(str[i] ^ 177, i); -} - -void Lucerna::unScramble() { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) { - if (_vm->_gyro->_also[i][j] != 0) - scram(*_vm->_gyro->_also[i][j]); - } - } - scram(_vm->_gyro->_listen); - scram(_vm->_gyro->_flags); -} - -void Lucerna::loadAlso(byte num) { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) { - if (_vm->_gyro->_also[i][j] != 0) { - delete _vm->_gyro->_also[i][j]; - _vm->_gyro->_also[i][j] = 0; - } - } - } - Common::String filename; - filename = Common::String::format("also%d.avd", num); - if (!file.open(filename)) - error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - - file.seek(128); - - byte alsoNum = file.readByte(); - Common::String tmpStr; - for (int i = 0; i <= alsoNum; i++) { - for (int j = 0; j < 2; j++) { - _vm->_gyro->_also[i][j] = new Common::String; - *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); - } - tmpStr = Common::String::format("\x9D%s\x9D", _vm->_gyro->_also[i][0]->c_str()); - *_vm->_gyro->_also[i][0] = tmpStr; - } - - memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); - - _vm->_gyro->_lineNum = file.readByte(); - for (int i = 0; i < _vm->_gyro->_lineNum; i++) { - LineType *curLine = &_vm->_gyro->_lines[i]; - curLine->_x1 = file.readSint16LE(); - curLine->_y1 = file.readSint16LE(); - curLine->_x2 = file.readSint16LE(); - curLine->_y2 = file.readSint16LE(); - curLine->_color = file.readByte(); - } - - memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); - byte pedNum = file.readByte(); - for (int i = 0; i < pedNum; i++) { - PedType *curPed = &_vm->_gyro->_peds[i]; - curPed->_x = file.readSint16LE(); - curPed->_y = file.readSint16LE(); - curPed->_direction = file.readByte(); - } - - _vm->_gyro->_fieldNum = file.readByte(); - for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { - FieldType *curField = &_vm->_gyro->_fields[i]; - curField->_x1 = file.readSint16LE(); - curField->_y1 = file.readSint16LE(); - curField->_x2 = file.readSint16LE(); - curField->_y2 = file.readSint16LE(); - } - - for (int i = 0; i < 15; i++) { - MagicType *magic = &_vm->_gyro->_magics[i]; - magic->_operation = file.readByte(); - magic->_data = file.readUint16LE(); - } - - for (int i = 0; i < 7; i++) { - MagicType *portal = &_vm->_gyro->_portals[i]; - portal->_operation = file.readByte(); - portal->_data = file.readUint16LE(); - } - - _vm->_gyro->_flags.clear(); - for (int i = 0; i < 26; i++) - _vm->_gyro->_flags += file.readByte(); - - int16 listen_length = file.readByte(); - _vm->_gyro->_listen.clear(); - for (int i = 0; i < listen_length; i++) - _vm->_gyro->_listen += file.readByte(); - - drawAlsoLines(); - - file.close(); - unScramble(); - for (int i = 0; i <= alsoNum; i++) { - tmpStr = Common::String::format(",%s,", _vm->_gyro->_also[i][0]->c_str()); - *_vm->_gyro->_also[i][0] = tmpStr; - } -} - -void Lucerna::loadRoom(byte num) { - CursorMan.showMouse(false); - - _vm->_graphics->fleshColors(); - - Common::String filename = Common::String::format("place%d.avd", num); - if (!file.open(filename)) - error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - - file.seek(146); - if (!_vm->_gyro->_roomnName.empty()) - _vm->_gyro->_roomnName.clear(); - for (int i = 0; i < 30; i++) { - char actChar = file.readByte(); - if ((32 <= actChar) && (actChar <= 126)) - _vm->_gyro->_roomnName += actChar; - } - // Compression method byte follows this... - - file.seek(177); - - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->refreshBackground(); - - file.close(); - - loadAlso(num); - _vm->_background->loadBackgroundSprites(num); - CursorMan.showMouse(true); -} - -void Lucerna::zoomOut(int16 x, int16 y) { - warning("STUB: Lucerna::zoomout()"); -} - -void Lucerna::findPeople(byte room) { - for (int i = 1; i < 29; i++) { - if (_vm->_gyro->_whereIs[i] == room) { - if (i < 25) - _vm->_gyro->_him = i + 150; - else - _vm->_gyro->_her = i + 150; - } - } -} - -void Lucerna::exitRoom(byte x) { - _vm->_sound->stopSound(); - _vm->_background->forgetBackgroundSprites(); - _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. - - switch (x) { - case kRoomSpludwicks: - _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); - _vm->_gyro->_avariciusTalk = 0; - // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. - break; - case kRoomBridge: - if (_vm->_gyro->_drawbridgeOpen > 0) { - _vm->_gyro->_drawbridgeOpen = 4; // Fully open. - _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); - } - break; - case kRoomOutsideCardiffCastle: - _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); - break; - case kRoomRobins: - _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); - break; - } - - _vm->_gyro->_interrogation = 0; // Leaving the room cancels all the questions automatically. - _vm->_gyro->_seeScroll = false; // Now it can work again! - - _vm->_gyro->_lastRoom = _vm->_gyro->_room; - if (_vm->_gyro->_room != kRoomMap) - _vm->_gyro->_lastRoomNotMap = _vm->_gyro->_room; -} - - -/** - * Only when entering a NEW town! Not returning to the last one, - * but choosing another from the map. - * @remarks Originally called 'new_town' - */ -void Lucerna::enterNewTown() { - _vm->_menu->setup(); - - switch (_vm->_gyro->_room) { - case kRoomOutsideNottsPub: // Entry into Nottingham. - if ((_vm->_gyro->_roomCount[kRoomRobins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) - _vm->_gyro->_mushroomGrowing = true; - break; - case kRoomWiseWomans: // Entry into Argent. - if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { - _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[kRoomWiseWomans] % 3) == 1); - _vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; - } else { - _vm->_gyro->_spludwickAtHome = true; - _vm->_gyro->_crapulusWillTell = false; - } - if (_vm->_gyro->_boxContent == Gyro::kObjectWine) - _vm->_gyro->_wineState = 3; // Vinegar - break; - } - - if (_vm->_gyro->_room != kRoomOutsideDucks) { - if ((_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_onionInVinegar)) - _vm->_gyro->_rottenOnion = true; // You're holding the onion - } -} - -void Lucerna::putGeidaAt(byte whichPed, byte ped) { - if (ped == 0) - return; - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - - spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(1, whichPed); - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcGeida; -} - -void Lucerna::enterRoom(byte room, byte ped) { - _vm->_gyro->_seeScroll = true; // This stops the trippancy system working over the length of this procedure. - - findPeople(room); - _vm->_gyro->_room = room; - if (ped != 0) - _vm->_gyro->_roomCount[room]++; - - loadRoom(room); - - if ((_vm->_gyro->_roomCount[room] == 0) && (!_vm->_gyro->setFlag('S'))) - incScore(1); - - _vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; - - if (_vm->_gyro->_geidaFollows) - _vm->_gyro->_whereIs[Gyro::kPeopleGeida - 150] = room; - - _vm->_gyro->_roomTime = 0; - - - if ((_vm->_gyro->_lastRoom == kRoomMap) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) - enterNewTown(); - - switch (room) { - case kRoomYours: - if (_vm->_gyro->_avvyInBed) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); - } - break; - - case kRoomOutsideYours: - if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - if (!_vm->_gyro->_talkedToCrapulus) { - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomOutsideYours; - spr1->init(8, false, _vm->_animation); // load Crapulus - - if (_vm->_gyro->_roomCount[kRoomOutsideYours] == 1) { - _vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. - spr1->walkTo(4); // Walks up to greet you. - } else { - _vm->_animation->appearPed(1, 4); // Starts where he was before. - spr1->_facingDir = Animation::kDirLeft; - } - - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. - - } else - _vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomNowhere; - - if (_vm->_gyro->_crapulusWillTell) { - spr1->init(8, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); - spr1->walkTo(3); - _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); - _vm->_gyro->_crapulusWillTell = false; - } - } - break; - - case kRoomOutsideSpludwicks: - if ((_vm->_gyro->_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { - _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); - _vm->_gyro->_spludwickAtHome = true; - } - break; - - case kRoomSpludwicks: - if (_vm->_gyro->_spludwickAtHome) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - if (ped > 0) { - spr1->init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->appearPed(1, 1); - _vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomSpludwicks; - } - - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcGeida; - } else - _vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomNowhere; - break; - - case kRoomBrummieRoad: - if (_vm->_gyro->_geidaFollows) - putGeidaAt(4, ped); - if (_vm->_gyro->_cwytalotGone) { - _vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomNowhere; - } else { - if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcFollowAvvyY; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomBrummieRoad; - - if (_vm->_gyro->_roomCount[kRoomBrummieRoad] == 1) { // First time here... - _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... - spr1->walkTo(3); // ...and he walks up... - } else { - // You've been here before. - _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... - spr1->_facingDir = Animation::kDirLeft; - } - } - } - break; - - case kRoomArgentRoad: - if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[kRoomArgentRoad] > 3)) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->appearPed(1, 0); - spr1->walkTo(1); - spr1->_vanishIfStill = true; - _vm->_gyro->_passedCwytalotInHerts = true; - // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); - } - break; - - case kRoomBridge: - if (_vm->_gyro->_drawbridgeOpen == 4) { // open - _vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge - _vm->_graphics->refreshBackground(); - _vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. - } - if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 2, ped); // load Geida - break; - - case kRoomRobins: - if (ped > 0) { - if (!_vm->_gyro->_beenTiedUp) { - // A welcome party... or maybe not... - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); - spr1->walkTo(2); - _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); - } - } - - if (_vm->_gyro->_beenTiedUp) { - _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = 0; - _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 0; - } - - if (_vm->_gyro->_tiedUp) - _vm->_background->drawBackgroundSprite(-1, -1, 1); - - if (!_vm->_gyro->_mushroomGrowing) - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_graphics->refreshBackground(); - break; - - case kRoomOutsideCardiffCastle: - if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - switch (_vm->_gyro->_cardiffQuestionNum) { - case 0 : // You've answered NONE of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); - spr1->walkTo(2); - _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); - break; - case 5 : - _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; - break; // You've answered ALL his questions. => nothing happens. - default: // You've answered SOME of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 2); - spr1->_facingDir = Animation::kDirRight; - _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); - } - } - - if (_vm->_gyro->_cardiffQuestionNum < 5) - _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; - else - _vm->_gyro->_interrogation = 0; - break; - - case kRoomMap: - // You're entering the map. - dawn(); - if (ped > 0) - zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); - - if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - refreshObjectList(); - } - - _vm->_dialogs->displayScrollChain('q', 69); - break; - - case kRoomCatacombs: - if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { - - switch (ped) { - case 3: // Enter from oubliette - _vm->_gyro->_catacombX = 8; - _vm->_gyro->_catacombY = 4; - break; - case 5: // Enter from du Lustie's - _vm->_gyro->_catacombX = 8; - _vm->_gyro->_catacombY = 7; - break; - case 6: // Enter from Geida's - _vm->_gyro->_catacombX = 4; - _vm->_gyro->_catacombY = 1; - break; - } - - _vm->_gyro->_enterCatacombsFromLustiesRoom = true; - _vm->_animation->catacombMove(ped); - _vm->_gyro->_enterCatacombsFromLustiesRoom = false; - } - break; - - case kRoomArgentPub: - if (_vm->_gyro->_wonNim) - _vm->_background->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. - _vm->_gyro->_malagauche = 0; // Ready to boot Malagauche - if (_vm->_gyro->_givenBadgeToIby) { - _vm->_background->drawBackgroundSprite(-1, -1, 7); - _vm->_background->drawBackgroundSprite(-1, -1, 8); - } - _vm->_graphics->refreshBackground(); - break; - - case kRoomLustiesRoom: - _vm->_gyro->_npcFacing = 1; // du Lustie. - if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes - _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); - else if (!_vm->_gyro->_enteredLustiesRoomAsMonk) // already - // Presumably, Avvy dressed as a monk. - _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); - - if (_vm->_gyro->_geidaFollows) { - putGeidaAt(4, ped); - if (_vm->_gyro->_lustieIsAsleep) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); - _vm->_graphics->refreshBackground(); - } - } - break; - - case kRoomMusicRoom: - if (_vm->_gyro->_jacquesState > 0) { - _vm->_gyro->_jacquesState = 5; - _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_background->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_magics[kColorBrown - 1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; - } - if (ped != 0) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(6); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); - } - break; - - case kRoomOutsideNottsPub: - if (ped == 2) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(3); - _vm->_sequence->thenShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(4); - _vm->_sequence->startToClose(); - } - break; - - case kRoomOutsideArgentPub: - if (ped == 2) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(6); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); - } - break; - - case kRoomWiseWomans: { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(11, false, _vm->_animation); - if ((_vm->_gyro->_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { - _vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. - spr1->walkTo(3); // Walks up to greet you. - } else { - _vm->_animation->appearPed(1, 3); // Starts where she was before. - spr1->_facingDir = Animation::kDirLeft; - } - - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. - } - break; - - case kRoomInsideCardiffCastle: - if (ped > 0) { - _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_background->drawBackgroundSprite(-1, -1, 0); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(1); - if (_vm->_gyro->_arrowInTheDoor) - _vm->_sequence->thenShow(3); - else - _vm->_sequence->thenShow(2); - - if (_vm->_gyro->_takenPen) - _vm->_background->drawBackgroundSprite(-1, -1, 3); - - _vm->_sequence->startToClose(); - } else { - _vm->_background->drawBackgroundSprite(-1, -1, 0); - if (_vm->_gyro->_arrowInTheDoor) - _vm->_background->drawBackgroundSprite(-1, -1, 2); - else - _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_graphics->refreshBackground(); - } - break; - - case kRoomAvvysGarden: - if (ped == 1) { - _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(3); - _vm->_sequence->startToClose(); - } - break; - - case kRoomEntranceHall: - case kRoomInsideAbbey: - case kRoomYourHall: - if (ped == 2) { -#if 0 - // It was the original: - _vm->_celer->show_one(-1, -1, 2); - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close(); -#endif - - _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(3); - _vm->_sequence->startToClose(); - } - break; - - case kRoomAylesOffice: - if (_vm->_gyro->_aylesIsAwake) - _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_graphics->refreshBackground(); - break; // Ayles awake. - - case kRoomGeidas: - putGeidaAt(1, ped); - break; // load Geida - - case kRoomEastHall: - case kRoomWestHall: - if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 1, ped); - break; - - case kRoomLusties: - if (_vm->_gyro->_geidaFollows) - putGeidaAt(ped + 5, ped); - break; - - case kRoomNottsPub: - if (_vm->_gyro->_sittingInPub) - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->_npcFacing = 1; // Port. - break; - - case kRoomOutsideDucks: - if (ped == 2) { - // Shut the door - _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(3); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(4); - _vm->_sequence->startToClose(); - } - break; - - case kRoomDucks: - _vm->_gyro->_npcFacing = 1; // Duck. - break; - } - - _vm->_gyro->_seeScroll = false; // Now it can work again! - _vm->_gyro->_isLoaded = false; -} - -void Lucerna::thinkAbout(byte object, bool type) { - const int16 picSize = 966; - - _vm->_gyro->_thinks = object; - object--; - - _vm->_gyro->setMousePointerWait(); - - if (type == Gyro::kThing) { - if (!file.open("thinks.avd")) - error("AVALANCHE: Lucerna: File not found: thinks.avd"); - } else { // Gyro::kPerson - if (!file.open("folk.avd")) - error("AVALANCHE: Lucerna: File not found: folk.avd"); - - object -= 149; - if (object >= 25) - object -= 8; - if (object == 20) - object--; // Last time... - } - - CursorMan.showMouse(false); - - file.seek(object * picSize + 65); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); - - picture.free(); - file.close(); - - CursorMan.showMouse(true); - _vm->_gyro->_thinkThing = type; -} - -void Lucerna::loadDigits() { // Load the scoring digits & rwlites - const byte digitsize = 134; - const byte rwlitesize = 126; - - if (!file.open("digit.avd")) - error("AVALANCHE: Lucerna: File not found: digit.avd"); - - for (int i = 0; i < 10; i++) { - file.seek(i * digitsize); - _vm->_gyro->_digits[i] = _vm->_graphics->loadPictureGraphic(file); - } - - for (int i = 0; i < 9; i++) { - file.seek(10 * digitsize + i * rwlitesize); - _vm->_gyro->_directions[i] = _vm->_graphics->loadPictureGraphic(file); - } - - file.close(); -} - -void Lucerna::drawToolbar() { - if (!file.open("useful.avd")) - error("AVALANCHE: Lucerna: File not found: useful.avd"); - - file.seek(40); - - CursorMan.showMouse(false); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); - - picture.free(); - file.close(); - - CursorMan.showMouse(true); - _vm->_animation->_oldDirection = 177; - drawDirection(); -} - -void Lucerna::drawScore() { - uint16 score = _vm->_gyro->_dnascore; - int8 numbers[3] = {0, 0, 0}; - for (int i = 0; i < 2; i++) { - byte divisor = 1; - for (int j = 0; j < (2 - i); j++) - divisor *= 10; - numbers[i] = score / divisor; - score -= numbers[i] * divisor; - } - numbers[2] = score; - - CursorMan.showMouse(false); - - for (int i = 0; i < 3; i++) { - if (_vm->_gyro->_scoreToDisplay[i] != numbers[i]) - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[i]], 250 + (i + 1) * 15, 177); - } - - CursorMan.showMouse(true); - - for (int i = 0; i < 3; i++) - _vm->_gyro->_scoreToDisplay[i] = numbers[i]; -} - -void Lucerna::incScore(byte num) { - for (int i = 1; i <= num; i++) { - _vm->_gyro->_dnascore++; - -// if (soundfx) { - for (int j = 1; j <= 97; j++) - // Length os 2 is a guess, the original doesn't have a delay specified - _vm->_sound->playNote(177 + _vm->_gyro->_dnascore * 3, 2); -// } - } - warning("STUB: Lucerna::points()"); - - drawScore(); -} - -void Lucerna::useCompass(const Common::Point &cursorPos) { - byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); - - switch (color) { - case kColorGreen: - _vm->_animation->_direction = Animation::kDirUp; - _vm->_animation->changeDirection(0, Animation::kDirUp); - drawDirection(); - break; - case kColorBrown: - _vm->_animation->_direction = Animation::kDirDown; - _vm->_animation->changeDirection(0, Animation::kDirDown); - drawDirection(); - break; - case kColorCyan: - _vm->_animation->_direction = Animation::kDirLeft; - _vm->_animation->changeDirection(0, Animation::kDirLeft); - drawDirection(); - break; - case kColorLightmagenta: - _vm->_animation->_direction = Animation::kDirRight; - _vm->_animation->changeDirection(0, Animation::kDirRight); - drawDirection(); - break; - case kColorRed: - case kColorWhite: - case kColorLightcyan: - case kColorYellow: // Fall-throughs are intended. - _vm->_animation->stopWalking(); - drawDirection(); - break; - } -} - -void Lucerna::fxToggle() { - warning("STUB: Lucerna::fxtoggle()"); -} - -void Lucerna::refreshObjectList() { - _vm->_gyro->_carryNum = 0; - if (_vm->_gyro->_thinkThing && !_vm->_gyro->_objects[_vm->_gyro->_thinks - 1]) - thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money - - for (int i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_objects[i]) { - _vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; - _vm->_gyro->_carryNum++; - } - } -} - -/** - * @remarks Originally called 'verte' - */ -void Lucerna::guideAvvy(Common::Point cursorPos) { - if (!_vm->_gyro->_userMovesAvvy) - return; - - cursorPos.y /= 2; - byte what; - - // _vm->_animation->tr[0] is Avalot.) - AnimationType *avvy = &_vm->_animation->_sprites[0]; - if (cursorPos.x < avvy->_x) - what = 1; - else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) - what = 2; - else - what = 0; // On top - - if (cursorPos.y < avvy->_y) - what += 3; - else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) - what += 6; - - switch (what) { - case 0: - _vm->_animation->stopWalking(); - break; // Clicked on Avvy: no movement. - case 1: - _vm->_animation->changeDirection(0, Animation::kDirLeft); - break; - case 2: - _vm->_animation->changeDirection(0, Animation::kDirRight); - break; - case 3: - _vm->_animation->changeDirection(0, Animation::kDirUp); - break; - case 4: - _vm->_animation->changeDirection(0, Animation::kDirUpLeft); - break; - case 5: - _vm->_animation->changeDirection(0, Animation::kDirUpRight); - break; - case 6: - _vm->_animation->changeDirection(0, Animation::kDirDown); - break; - case 7: - _vm->_animation->changeDirection(0, Animation::kDirDownLeft); - break; - case 8: - _vm->_animation->changeDirection(0, Animation::kDirDownRight); - break; - } // No other values are possible. - - drawDirection(); -} - -void Lucerna::checkClick() { - Common::Point cursorPos = _vm->getMousePos(); - _vm->_gyro->_onToolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); - - /*if (_vm->_gyro->mrelease > 0) - _vm->_gyro->after_the_scroll = false;*/ - - if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newMouse(0); // up arrow - else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) - _vm->_gyro->newMouse(7); //I-beam - else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newMouse(1); // screwdriver - else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. - if (_holdLeftMouse) { - _vm->_gyro->newMouse(6); // Mark's crosshairs - guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. - } else - _vm->_gyro->newMouse(3); // fletch - } - - if (_holdLeftMouse) { - if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. - if (_vm->_gyro->_dropsOk) - _vm->_menu->update(); - } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. - _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; - if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) - _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; - if (_vm->_parser->_inputTextPos < 1) - _vm->_parser->_inputTextPos = 1; - _vm->_parser->_inputTextPos--; - _vm->_parser->plotText(); - } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. - if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. - if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) - useCompass(cursorPos); - } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. - do { - _vm->updateEvents(); - } while (_holdLeftMouse); - - if (_vm->_gyro->_thinkThing) { - _vm->_parser->_thing = _vm->_gyro->_thinks; - _vm->_parser->_thing += 49; - _vm->_parser->_person = _vm->_parser->kPardon; - } else { - _vm->_parser->_person = _vm->_gyro->_thinks; - _vm->_parser->_thing = _vm->_parser->kPardon; - } - callVerb(Parser::kVerbCodeExam); - } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. - do { - _vm->updateEvents(); - } while (_holdLeftMouse); - - callVerb(Parser::kVerbCodeScore); - } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; - _vm->_animation->updateSpeed(); - } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun; - _vm->_animation->updateSpeed(); - } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) - fxToggle(); - else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _vm->_gyro->_mouseText.insertChar(Dialogs::kControlNewLine, 0); - } else if (!_vm->_gyro->_dropsOk) - _vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; - } -} - -void Lucerna::errorLed() { - warning("STUB: Lucerna::errorled()"); -} - -int8 Lucerna::fades(int8 x) { - warning("STUB: Lucerna::fades()"); - return 0; -} - -void Lucerna::fadeOut(byte n) { - warning("STUB: Lucerna::fadeOut()"); -} - -void Lucerna::dusk() { - warning("STUB: Lucerna::dusk()"); -} - -void Lucerna::fadeIn(byte n) { - warning("STUB: Lucerna::fadeIn()"); -} - -void Lucerna::dawn() { - warning("STUB: Lucerna::dawn()"); -} - -void Lucerna::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_animation->_oldDirection == _vm->_animation->_direction) - return; - - _vm->_animation->_oldDirection = _vm->_animation->_direction; - - CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_animation->_direction], 0, 161); - CursorMan.showMouse(true); -} - - -void Lucerna::gameOver() { - _vm->_gyro->_userMovesAvvy = false; - - AnimationType *avvy = &_vm->_animation->_sprites[0]; - int16 sx = avvy->_x; - int16 sy = avvy->_y; - - avvy->remove(); - avvy->init(12, true, _vm->_animation); // 12 = Avalot falls - avvy->_stepNum = 0; - avvy->appear(sx, sy, 0); - - _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); - _vm->_gyro->_alive = false; -} - -void Lucerna::minorRedraw() { - dusk(); - - enterRoom(_vm->_gyro->_room, 0); // Ped unknown or non-existant. - - for (int i = 0; i < 3; i++) - _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits - drawScore(); - - dawn(); -} - -void Lucerna::majorRedraw() { - warning("STUB: Lucerna::major_redraw()"); -} - -uint16 Lucerna::bearing(byte whichPed) { - static const double rad2deg = 180 / 3.14; // Pi - AnimationType *avvy = &_vm->_animation->_sprites[0]; - PedType *curPed = &_vm->_gyro->_peds[whichPed]; - - if (avvy->_x == curPed->_x) - return 0; - else if (avvy->_x < curPed->_x) { - return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); - } else { - return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); - } -} - -/** - * @remarks Originally called 'sprite_run' - */ -void Lucerna::spriteRun() { - _vm->_gyro->_doingSpriteRun = true; - _vm->_animation->animLink(); - _vm->_gyro->_doingSpriteRun = false; -} - -void Lucerna::fixFlashers() { - _vm->_gyro->_ledStatus = 177; - _vm->_animation->_oldDirection = 177; - _vm->_dialogs->setReadyLight(2); - drawDirection(); -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h deleted file mode 100644 index 87b1931e259e..000000000000 --- a/engines/avalanche/lucerna.h +++ /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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LUCERNA The screen, [keyboard] and mouse handler.*/ - -#ifndef AVALANCHE_LUCERNA2_H -#define AVALANCHE_LUCERNA2_H - -#include "common/scummsys.h" -#include "common/file.h" - -namespace Avalanche { -class AvalancheEngine; - -class Clock { -public: - Clock(AvalancheEngine *vm); - - void update(); - -private: - static const int kCenterX = 510; - static const int kCenterY = 183; - - AvalancheEngine *_vm; - - uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; - Common::Point _clockHandHour, _clockHandMinute; - - void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); - void drawHand(const Common::Point &endPoint, byte color); - void plotHands(); - void chime(); -}; - -class Lucerna { -public: - bool _holdLeftMouse; - Clock _clock; - - Lucerna(AvalancheEngine *vm); - ~Lucerna(); - - void init(); - void callVerb(byte id); - void drawAlsoLines(); - void loadRoom(byte num); - void exitRoom(byte x); - void enterRoom(byte room, byte ped); - void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! - void loadDigits(); // Load the scoring digits & rwlites - void drawToolbar(); - void drawScore(); - void incScore(byte num); // Add on no. of points - void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. - void fxToggle(); - void refreshObjectList(); - void checkClick(); - void errorLed(); - void dusk(); - void dawn(); - void drawDirection(); // Draws the little icon at the left end of the text input field. - void gameOver(); - uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. - void fixFlashers(); - void loadAlso(byte num); - - // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. - void minorRedraw(); - void majorRedraw(); - - void spriteRun(); - -private: - AvalancheEngine *_vm; - - Common::File file; - - Common::String readAlsoStringFromFile(); - void scram(Common::String &str); - void unScramble(); - - void zoomOut(int16 x, int16 y); // Only used when entering the map. - void enterNewTown(); - void findPeople(byte room); - void putGeidaAt(byte whichPed, byte ped); - void guideAvvy(Common::Point cursorPos); - - // Will be used in dusk() and dawn(). - bool _fxHidden; - - int8 fades(int8 x); - void fadeOut(byte n); - void fadeIn(byte n); - -}; - -} // End of namespace Avalanche - -#endif // AVALANCHE_LUCERNA2_H diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 64b3b97eca4f..0fb1f62ca593 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -29,8 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/menu.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h" #include "avalanche/animation.h" #include "common/textconsole.h" @@ -67,7 +65,7 @@ void HeadType::highlight() { _menu->_activeMenuItem._activeNum = _position; _menu->_menuActive = true; - _menu->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. + _menu->_vm->_avalot->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { @@ -137,8 +135,8 @@ void MenuItem::display() { for (int y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_gyro->_defaultLed = 1; - _dr->_vm->_gyro->_currentMouse = 177; + _dr->_vm->_avalot->_defaultLed = 1; + _dr->_vm->_avalot->_currentMouse = 177; CursorMan.showMouse(true); // 4 = fletch } @@ -151,7 +149,7 @@ void MenuItem::wipe() { _activeNow = false; _dr->_menuActive = false; _firstlix = false; - _dr->_vm->_gyro->_defaultLed = 2; + _dr->_vm->_avalot->_defaultLed = 2; CursorMan.showMouse(true); } @@ -220,13 +218,13 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu void MenuBar::draw() { _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); - byte savecp = _dr->_vm->_gyro->_cp; - _dr->_vm->_gyro->_cp = 3; + byte savecp = _dr->_vm->_avalot->_cp; + _dr->_vm->_avalot->_cp = 3; for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); - _dr->_vm->_gyro->_cp = savecp; + _dr->_vm->_avalot->_cp = savecp; } void MenuBar::parseAltTrigger(char c) { @@ -264,30 +262,30 @@ Menu::Menu(AvalancheEngine *vm) { } void Menu::findWhatYouCanDoWithIt() { - switch (_vm->_gyro->_thinks) { - case Gyro::kObjectWine: - case Gyro::kObjectPotion: - case Gyro::kObjectInk: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; + switch (_vm->_avalot->_thinks) { + case Avalot::kObjectWine: + case Avalot::kObjectPotion: + case Avalot::kObjectInk: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; break; - case Gyro::kObjectBell: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; + case Avalot::kObjectBell: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; break; - case Gyro::kObjectChastity: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + case Avalot::kObjectChastity: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; - case Gyro::kObjectLute: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; + case Avalot::kObjectLute: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; break; - case Gyro::kObjectMushroom: - case Gyro::kObjectOnion: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; + case Avalot::kObjectMushroom: + case Avalot::kObjectOnion: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; break; - case Gyro::kObjectClothes: - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + case Avalot::kObjectClothes: + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; default: - _vm->_gyro->_verbStr = Parser::kVerbCodeExam; // Anything else. + _vm->_avalot->_verbStr = Parser::kVerbCodeExam; // Anything else. } } @@ -312,7 +310,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < 8; j++) { byte idx = text[i]; - font[idx][j] = _vm->_gyro->_font[idx][j] & ander; // Set the font. + font[idx][j] = _vm->_avalot->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. for (int k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; @@ -414,9 +412,9 @@ void Menu::setupMenuFile() { _activeMenuItem.reset(); _activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true); - _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->_alive); - _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->_alive); - _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->_atKey + '1', true); + _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive); + _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive); + _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_avalot->_atKey + '1', true); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.display(); } @@ -424,7 +422,7 @@ void Menu::setupMenuFile() { void Menu::setupMenuAction() { _activeMenuItem.reset(); - Common::String f5Does = _vm->_gyro->f5Does(); + Common::String f5Does = _vm->_avalot->f5Does(); for (int i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); @@ -433,13 +431,13 @@ void Menu::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_gyro->_room == kRoomMap) + if (_vm->_avalot->_room == kRoomMap) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) + if (_vm->_animation->_sprites[0]._speedX == _vm->_avalot->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -454,8 +452,8 @@ void Menu::setupMenuPeople() { _activeMenuItem.reset(); for (int i = 150; i <= 178; i++) { - if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { - _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); + if (_vm->_avalot->_whereIs[i - 150] == _vm->_avalot->_room) { + _activeMenuItem.setupOption(_vm->_avalot->getName(i), _vm->_avalot->getNameChar(i), "", true); people += i; } } @@ -466,8 +464,8 @@ void Menu::setupMenuPeople() { void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_objects[i]) - _activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); + if (_vm->_avalot->_objects[i]) + _activeMenuItem.setupOption(_vm->_avalot->getThing(i + 1), _vm->_avalot->getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -475,54 +473,54 @@ void Menu::setupMenuObjects() { void Menu::setupMenuWith() { _activeMenuItem.reset(); - if (_vm->_gyro->_thinkThing) { + if (_vm->_avalot->_thinkThing) { findWhatYouCanDoWithIt(); - for (uint i = 0; i < _vm->_gyro->_verbStr.size(); i++) { + for (uint i = 0; i < _vm->_avalot->_verbStr.size(); i++) { char vbchar; Common::String verb; - _vm->_parser->verbOpt(_vm->_gyro->_verbStr[i], verb, vbchar); + _vm->_parser->verbOpt(_vm->_avalot->_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_parser->kNothing) - || (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_room)) + if ((_vm->_avalot->_lastPerson == Avalot::kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) + || (_vm->_avalot->_whereIs[_vm->_avalot->_lastPerson - 150] != _vm->_avalot->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { - _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeGive; + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); - _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); - _vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; - switch (_vm->_gyro->_thinks) { - case Gyro::kPeopleGeida: - case Gyro::kPeopleArkata: + _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); + _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; + switch (_vm->_avalot->_thinks) { + case Avalot::kPeopleGeida: + case Avalot::kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeKiss; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss; break; - case Gyro::kPeopleDogfood: - _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodePlay; + case Avalot::kPeopleDogfood: + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay; break; - case Gyro::kPeopleMalagauche: { - bool isSober = !_vm->_gyro->_teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); + case Avalot::kPeopleMalagauche: { + bool isSober = !_vm->_avalot->_teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[Avalot::kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 101 + 100 + 102 + 103 + 104; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 101 + 100 + 102 + 103 + 104; } break; - case Gyro::kPeopleTrader: - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); - _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; + case Avalot::kPeopleTrader: + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[Avalot::kObjectOnion - 1]); + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105; break; } } @@ -533,19 +531,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(Parser::kVerbCodeHelp); + _vm->_avalot->callVerb(Parser::kVerbCodeHelp); break; case 1: - _vm->_lucerna->callVerb(Parser::kVerbCodeBoss); + _vm->_avalot->callVerb(Parser::kVerbCodeBoss); break; case 2: - _vm->_lucerna->majorRedraw(); + _vm->_avalot->majorRedraw(); break; case 3: - _vm->_lucerna->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(Parser::kVerbCodeScore); break; case 4: - _vm->_lucerna->callVerb(Parser::kVerbCodeInfo); + _vm->_avalot->callVerb(Parser::kVerbCodeInfo); break; } } @@ -554,17 +552,17 @@ void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_lucerna->callVerb(Parser::kVerbCodeRestart); + _vm->_avalot->callVerb(Parser::kVerbCodeRestart); break; case 1: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_lucerna->callVerb(Parser::kVerbCodeLoad); + _vm->_avalot->callVerb(Parser::kVerbCodeLoad); break; case 2: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_lucerna->callVerb(Parser::kVerbCodeSave); + _vm->_avalot->callVerb(Parser::kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -574,7 +572,7 @@ void Menu::runMenuFile() { //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - _vm->_lucerna->callVerb(Parser::kVerbCodeQuit); + _vm->_avalot->callVerb(Parser::kVerbCodeQuit); break; } } @@ -586,29 +584,29 @@ void Menu::runMenuAction() { case 0: _vm->_parser->_person = _vm->_parser->kPardon; _vm->_parser->_thing = _vm->_parser->kPardon; - f5Does = _vm->_gyro->f5Does(); - _vm->_lucerna->callVerb(f5Does[0]); + f5Does = _vm->_avalot->f5Does(); + _vm->_avalot->callVerb(f5Does[0]); break; case 1: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_lucerna->callVerb(Parser::kVerbCodePause); + _vm->_avalot->callVerb(Parser::kVerbCodePause); break; case 2: - _vm->_lucerna->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(Parser::kVerbCodeOpen); break; case 3: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_lucerna->callVerb(Parser::kVerbCodeLook); + _vm->_avalot->callVerb(Parser::kVerbCodeLook); break; case 4: - _vm->_lucerna->callVerb(Parser::kVerbCodeInv); + _vm->_avalot->callVerb(Parser::kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; - if (avvy->_speedX == _vm->_gyro->kWalk) - avvy->_speedX = _vm->_gyro->kRun; + if (avvy->_speedX == _vm->_avalot->kWalk) + avvy->_speedX = _vm->_avalot->kRun; else - avvy->_speedX = _vm->_gyro->kWalk; + avvy->_speedX = _vm->_avalot->kWalk; _vm->_animation->updateSpeed(); } break; @@ -616,57 +614,57 @@ void Menu::runMenuAction() { } void Menu::runMenuObjects() { - _vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing); + _vm->_avalot->thinkAbout(_vm->_avalot->_objectList[_activeMenuItem._choiceNum], Avalot::kThing); } void Menu::runMenuPeople() { - _vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson); - _vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; + _vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson); + _vm->_avalot->_lastPerson = people[_activeMenuItem._choiceNum]; } void Menu::runMenuWith() { - _vm->_parser->_thing = _vm->_gyro->_thinks; + _vm->_parser->_thing = _vm->_avalot->_thinks; - if (_vm->_gyro->_thinkThing) { + if (_vm->_avalot->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) - _vm->_parser->_person = _vm->_gyro->_lastPerson; + if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) + _vm->_parser->_person = _vm->_avalot->_lastPerson; else _vm->_parser->_person = Parser::kPardon; } else { - switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { + switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; case 102: // Whisky _vm->_parser->_thing = 102; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; case 103: // Cider _vm->_parser->_thing = 103; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; case 104: // Mead _vm->_parser->_thing = 107; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; case 105: // Onion (trader) _vm->_parser->_thing = 67; - _vm->_lucerna->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; default: _vm->_parser->_person = _vm->_parser->_thing; _vm->_parser->_thing = Parser::kPardon; - _vm->_gyro->_subjectNum = 0; + _vm->_avalot->_subjectNum = 0; } } - _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); + _vm->_avalot->callVerb(_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { @@ -688,11 +686,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); - while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->_holdLeftMouse) { + while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_avalot->_holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); - while (_vm->_lucerna->_holdLeftMouse); + while (_vm->_avalot->_holdLeftMouse); while (!_vm->shouldQuit()) { do { @@ -702,28 +700,28 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_gyro->newMouse(0); // Up arrow + _vm->_avalot->newMouse(0); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->_gyro->newMouse(2); // Right-arrow + _vm->_avalot->newMouse(2); // Right-arrow else - _vm->_gyro->newMouse(3); // Fletch + _vm->_avalot->newMouse(3); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_gyro->newMouse(1); // Screwdriver + _vm->_avalot->newMouse(1); // Screwdriver _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); - } while (!_vm->_lucerna->_holdLeftMouse); + } while (!_vm->_avalot->_holdLeftMouse); - if (_vm->_lucerna->_holdLeftMouse) { + if (_vm->_avalot->_holdLeftMouse) { if (cursorPos.y > 21) { if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) { // Clicked OUTSIDE the menu. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); - _vm->_lucerna->_holdLeftMouse = false; + _vm->_avalot->_holdLeftMouse = false; backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). @@ -737,11 +735,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... - _vm->_lucerna->_holdLeftMouse = false; + _vm->_avalot->_holdLeftMouse = false; backup.free(); return; } else { - _vm->_lucerna->_holdLeftMouse = true; + _vm->_avalot->_holdLeftMouse = true; break; } } @@ -758,7 +756,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->refreshScreen(); _vm->updateEvents(); - if (!_vm->_lucerna->_holdLeftMouse) + if (!_vm->_avalot->_holdLeftMouse) break; } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 541123f24f15..9c1205df0205 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -9,8 +9,6 @@ MODULE_OBJS = \ console.o \ detection.o \ graphics.o \ - gyro.o \ - lucerna.o \ menu.o \ parser.o \ pingo.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 29fadda330c8..4a58763d0c90 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -27,8 +27,6 @@ #include "avalanche/avalanche.h" #include "avalanche/parser.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" #include "avalanche/dialogs.h" #include "avalanche/timer.h" #include "avalanche/animation.h" @@ -53,7 +51,7 @@ void Parser::init() { _inputText.clear(); _inputTextPos = 0; - _vm->_gyro->_weirdWord = false; + _vm->_avalot->_weirdWord = false; // Initailaze the vocabulary. // Verbs: 1-49 @@ -425,10 +423,10 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F5: _person = kPardon; _thing = kPardon; - _vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); + _vm->_avalot->callVerb(_vm->_avalot->f5Does()[0]); break; case Common::KEYCODE_F7: - _vm->_lucerna->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(Parser::kVerbCodeOpen); break; default: break; @@ -440,7 +438,7 @@ void Parser::plotText() { cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); + _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_avalot->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -539,7 +537,7 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { + if ((_vm->_avalot->_dnascore >= kRanks[i]._score) && (_vm->_avalot->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } } @@ -551,7 +549,7 @@ Common::String Parser::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = floor(_vm->_gyro->_totalTime / ticksInOneSec); // No. of seconds. + h = floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; h /= 3600; s = m % 60; @@ -593,10 +591,10 @@ void Parser::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_dialogs->displayText("What?"); } else { if (animate) { - Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); + Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName(target).c_str()); _vm->_dialogs->displayText(tmpStr); } else { - Common::String z = _vm->_gyro->getItem(target); + Common::String z = _vm->_avalot->getItem(target); if (z != "") { Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); _vm->_dialogs->displayText(tmpStr); @@ -612,16 +610,16 @@ bool Parser::doPronouns() { byte wordCode = _thats[i]; switch (wordCode) { case 200: - displayWhat(_vm->_gyro->_him, true, ambiguous); - _thats.setChar(_vm->_gyro->_him, i); + displayWhat(_vm->_avalot->_him, true, ambiguous); + _thats.setChar(_vm->_avalot->_him, i); break; case 201: - displayWhat(_vm->_gyro->_her, true, ambiguous); - _thats.setChar(_vm->_gyro->_her, i); + displayWhat(_vm->_avalot->_her, true, ambiguous); + _thats.setChar(_vm->_avalot->_her, i); break; case 202: - displayWhat(_vm->_gyro->_it, false, ambiguous); - _thats.setChar(_vm->_gyro->_it, i); + displayWhat(_vm->_avalot->_it, false, ambiguous); + _thats.setChar(_vm->_avalot->_it, i); break; } } @@ -666,32 +664,32 @@ void Parser::storeInterrogation(byte interrogation) { case 1: _inputText.toLowercase(); sayIt(); - _vm->_gyro->_favouriteDrink = _inputText; - _vm->_gyro->_cardiffQuestionNum = 2; + _vm->_avalot->_favouriteDrink = _inputText; + _vm->_avalot->_cardiffQuestionNum = 2; break; case 2: properNouns(); sayIt(); - _vm->_gyro->_favouriteSong = _inputText; - _vm->_gyro->_cardiffQuestionNum = 3; + _vm->_avalot->_favouriteSong = _inputText; + _vm->_avalot->_cardiffQuestionNum = 3; break; case 3: properNouns(); sayIt(); - _vm->_gyro->_worstPlaceOnEarth = _inputText; - _vm->_gyro->_cardiffQuestionNum = 4; + _vm->_avalot->_worstPlaceOnEarth = _inputText; + _vm->_avalot->_cardiffQuestionNum = 4; break; case 4: _inputText.toLowercase(); sayIt(); - if (!_vm->_gyro->_spareEvening.empty()) - _vm->_gyro->_spareEvening.clear(); - _vm->_gyro->_spareEvening = _inputText; + if (!_vm->_avalot->_spareEvening.empty()) + _vm->_avalot->_spareEvening.clear(); + _vm->_avalot->_spareEvening = _inputText; _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! - _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; - _vm->_gyro->_cardiffQuestionNum = 5; + _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; + _vm->_avalot->_cardiffQuestionNum = 5; break; case 99: //store_high(_inputText); @@ -727,9 +725,9 @@ void Parser::parse() { } // Are we being interrogated right now? - if (_vm->_gyro->_interrogation > 0) { - storeInterrogation(_vm->_gyro->_interrogation); - _vm->_gyro->_weirdWord = true; + if (_vm->_avalot->_interrogation > 0) { + storeInterrogation(_vm->_avalot->_interrogation); + _vm->_avalot->_weirdWord = true; return; } @@ -761,7 +759,7 @@ void Parser::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { for (int i = 0; i < 31; i++) { - if ((_vm->_gyro->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { + if ((_vm->_avalot->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; } @@ -813,12 +811,12 @@ void Parser::parse() { replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_gyro->_room == kRoomNottsPub) + if (_vm->_avalot->_room == kRoomNottsPub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomAylesOffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; @@ -830,39 +828,39 @@ void Parser::parse() { } if (doPronouns()) { - _vm->_gyro->_weirdWord = true; + _vm->_avalot->_weirdWord = true; _thats = kNothing; return; } // Second parsing. - if (!_vm->_gyro->_subject.empty()) - _vm->_gyro->_subject.clear(); - _vm->_gyro->_subjectNum = 0; // Find subject of conversation. + if (!_vm->_avalot->_subject.empty()) + _vm->_avalot->_subject.clear(); + _vm->_avalot->_subjectNum = 0; // Find subject of conversation. for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { - _vm->_gyro->_subjectNum = (byte)_thats[i]; + _vm->_avalot->_subjectNum = (byte)_thats[i]; _thats.setChar(kMoved, i); break; } } - if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found. + if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // Still not found. for (uint16 i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. - _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; + _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } } } - if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". for (uint16 i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition - _vm->_gyro->_subjectNum = (byte)_thats[i + 1]; + _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } @@ -884,30 +882,30 @@ void Parser::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_weirdWord = true; + _vm->_avalot->_weirdWord = true; } else - _vm->_gyro->_weirdWord = false; + _vm->_avalot->_weirdWord = false; if (_thats.empty()) _thats = kNothing; if (_thing != kPardon) - _vm->_gyro->_it = _thing; + _vm->_avalot->_it = _thing; if (_person != kPardon) { - if (_person < Gyro::kPeopleArkata) - _vm->_gyro->_him = _person; + if (_person < Avalot::kPeopleArkata) + _vm->_avalot->_him = _person; else - _vm->_gyro->_her = _person; + _vm->_avalot->_her = _person; } } void Parser::examineObject() { - if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkAbout(_thing, Gyro::kThing); + if (_thing != _vm->_avalot->_thinks) + _vm->_avalot->thinkAbout(_thing, Avalot::kThing); switch (_thing) { - case Gyro::kObjectWine : - switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. + case Avalot::kObjectWine : + switch (_vm->_avalot->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll break; @@ -919,8 +917,8 @@ void Parser::examineObject() { break; } break; - case Gyro::kObjectOnion: - if (_vm->_gyro->_rottenOnion) + case Avalot::kObjectOnion: + if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else _vm->_dialogs->displayScrollChain('t', 18); // Normal onion @@ -931,11 +929,11 @@ void Parser::examineObject() { } bool Parser::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_room)) + if ((_person == kPardon) || (_person == 0) || (_vm->_avalot->_whereIs[_person - 150] == _vm->_avalot->_room)) return true; else { Common::String tmpStr; - if (_person < Gyro::kPeopleArkata) + if (_person < Avalot::kPeopleArkata) tmpStr = "He isn't around at the moment."; else tmpStr = "She isn't around at the moment."; @@ -946,19 +944,19 @@ bool Parser::isPersonHere() { // Person equivalent of "holding". void Parser::exampers() { if (isPersonHere()) { - if (_thing != _vm->_gyro->_thinks) - _vm->_lucerna->thinkAbout(_person, Gyro::kPerson); + if (_thing != _vm->_avalot->_thinks) + _vm->_avalot->thinkAbout(_person, Avalot::kPerson); byte newPerson = _person - 149; - if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) + if ((_person == Avalot::kPeopleDogfood) && _vm->_avalot->_wonNim) _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" - else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) + else if ((_person == Avalot::kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else _vm->_dialogs->displayScrollChain('p', newPerson); - if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) + if ((_person == Avalot::kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) _vm->_dialogs->displayScrollChain('Q', 13); _person = newPerson; @@ -977,7 +975,7 @@ bool Parser::isHolding() { if (_thing > 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_gyro->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_avalot->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -986,7 +984,7 @@ bool Parser::isHolding() { } void Parser::openBox(bool isOpening) { - if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { + if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) { _vm->_background->drawBackgroundSprite(-1, -1, 4); _vm->_background->updateBackgroundSprites(); @@ -1013,7 +1011,7 @@ void Parser::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_avalot->_also[_thing - 50][1]); openBox(false); } } @@ -1028,22 +1026,22 @@ void Parser::inventory() { Common::String tmpStr = Common::String("You're carrying "); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_gyro->_objects[i]) { + if (_vm->_avalot->_objects[i]) { itemNum++; - if (itemNum == _vm->_gyro->_carryNum) + if (itemNum == _vm->_avalot->_carryNum) tmpStr += "and "; - tmpStr += _vm->_gyro->getItem(i + 1); + tmpStr += _vm->_avalot->getItem(i + 1); - if ((i + 1) == _vm->_gyro->_wearing) + if ((i + 1) == _vm->_avalot->_wearing) tmpStr += ", which you're wearing"; - if (itemNum < _vm->_gyro->_carryNum) + if (itemNum < _vm->_avalot->_carryNum) tmpStr += ", "; } } - if (_vm->_gyro->_wearing == kNothing) + if (_vm->_avalot->_wearing == kNothing) tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); else tmpStr += '.'; @@ -1053,18 +1051,18 @@ void Parser::inventory() { void Parser::swallow() { // Eat something. switch (_thing) { - case Gyro::kObjectWine: - switch (_vm->_gyro->_wineState) { // 4 is perfect + case Avalot::kObjectWine: + switch (_vm->_avalot->_wineState) { // 4 is perfect case 1: - if (_vm->_gyro->_teetotal) { + if (_vm->_avalot->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_dialogs->displayScrollChain('U', 2); - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_objects[Avalot::kObjectWine - 1] = false; + _vm->_avalot->refreshObjectList(); drink(); break; case 2: @@ -1073,33 +1071,33 @@ void Parser::swallow() { // Eat something. break; // You can't drink it! } break; - case Gyro::kObjectPotion: - _vm->_gyro->setBackgroundColor(4); + case Avalot::kObjectPotion: + _vm->_avalot->setBackgroundColor(4); _vm->_dialogs->displayScrollChain('U', 3); - _vm->_lucerna->gameOver(); - _vm->_gyro->setBackgroundColor(0); + _vm->_avalot->gameOver(); + _vm->_avalot->setBackgroundColor(0); break; - case Gyro::kObjectInk: + case Avalot::kObjectInk: _vm->_dialogs->displayScrollChain('U', 4); break; - case Gyro::kObjectChastity: + case Avalot::kObjectChastity: _vm->_dialogs->displayScrollChain('U', 5); break; - case Gyro::kObjectMushroom: + case Avalot::kObjectMushroom: _vm->_dialogs->displayScrollChain('U', 6); - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); break; - case Gyro::kObjectOnion: - if (_vm->_gyro->_rottenOnion) + case Avalot::kObjectOnion: + if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('U', 11); else { _vm->_dialogs->displayScrollChain('U', 8); - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; + _vm->_avalot->refreshObjectList(); } break; default: - if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) + if ((_vm->_avalot->_room == kRoomArgentPub) || (_vm->_avalot->_room == kRoomNottsPub)) _vm->_dialogs->displayText("Try BUYing things before you drink them!"); else _vm->_dialogs->displayText("The taste of it makes you retch!"); @@ -1110,7 +1108,7 @@ void Parser::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) + if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room) numPeople++; } @@ -1120,14 +1118,14 @@ void Parser::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (int i = 1; i < 29; i++) { - if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { + if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room) { actPerson++; if (actPerson == 1) // First on the list. - tmpStr = _vm->_gyro->getName(i + 150); + tmpStr = _vm->_avalot->getName(i + 150); else if (actPerson < numPeople) // The middle... - tmpStr += ", " + _vm->_gyro->getName(i + 150); + tmpStr += ", " + _vm->_avalot->getName(i + 150); else // The end. - tmpStr += " and " + _vm->_gyro->getName(i + 150); + tmpStr += " and " + _vm->_avalot->getName(i + 150); } } @@ -1140,30 +1138,30 @@ void Parser::peopleInRoom() { } void Parser::lookAround() { - _vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); - switch (_vm->_gyro->_room) { + _vm->_dialogs->displayText(*_vm->_avalot->_also[0][1]); + switch (_vm->_avalot->_room) { case kRoomSpludwicks: - if (_vm->_gyro->_avariciusTalk > 0) + if (_vm->_avalot->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 23); else peopleInRoom(); break; case kRoomRobins: - if (_vm->_gyro->_tiedUp) + if (_vm->_avalot->_tiedUp) _vm->_dialogs->displayScrollChain('q', 38); - if (_vm->_gyro->_mushroomGrowing) + if (_vm->_avalot->_mushroomGrowing) _vm->_dialogs->displayScrollChain('q', 55); break; case kRoomInsideCardiffCastle: - if (!_vm->_gyro->_takenPen) + if (!_vm->_avalot->_takenPen) _vm->_dialogs->displayScrollChain('q', 49); break; case kRoomLustiesRoom: - if (_vm->_gyro->_lustieIsAsleep) + if (_vm->_avalot->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('q', 65); break; case kRoomCatacombs: - switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { + switch (_vm->_avalot->_catacombY * 256 + _vm->_avalot->_catacombX) { case 258 : _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. break; @@ -1182,7 +1180,7 @@ void Parser::lookAround() { void Parser::openDoor() { // Special cases. - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { // Opening the box. @@ -1200,28 +1198,28 @@ void Parser::openDoor() { break; } - if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) + if ((!_vm->_avalot->_userMovesAvvy) && (_vm->_avalot->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { - MagicType *portal = &_vm->_gyro->_portals[i]; + MagicType *portal = &_vm->_avalot->_portals[i]; switch (portal->_operation) { - case Gyro::kMagicExclaim: + case Avalot::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; - case Gyro::kMagicTransport: + case Avalot::kMagicTransport: _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); break; - case Gyro::kMagicUnfinished: + case Avalot::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; - case Gyro::kMagicSpecial: + case Avalot::kMagicSpecial: _vm->_animation->callSpecial(portal->_data); break; - case Gyro::kMagicOpenDoor: + case Avalot::kMagicOpenDoor: _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); break; } @@ -1230,7 +1228,7 @@ void Parser::openDoor() { } } - if (_vm->_gyro->_room == kRoomMap) + if (_vm->_avalot->_room == kRoomMap) _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else @@ -1254,17 +1252,17 @@ void Parser::putProc() { // Thing is the _thing which you're putting in. _thing2 is where you're putting it. switch (_thing2) { - case Gyro::kObjectWine: - if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_rottenOnion) + case Avalot::kObjectWine: + if (_thing == Avalot::kObjectOnion) { + if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_gyro->_wineState != 3) { + if (_vm->_avalot->_wineState != 3) { Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! - _vm->_gyro->_onionInVinegar = true; - _vm->_lucerna->incScore(7); + _vm->_avalot->_onionInVinegar = true; + _vm->_avalot->incScore(7); _vm->_dialogs->displayScrollChain('u', 9); } } @@ -1273,33 +1271,33 @@ void Parser::putProc() { break; case 54: - if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. - if (_vm->_gyro->_boxContent != kNothing) + if (_vm->_avalot->_room == kRoomYours) { // Put something into the box. + if (_vm->_avalot->_boxContent != kNothing) _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { - case Gyro::kObjectMoney: + case Avalot::kObjectMoney: _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); break; - case Gyro::kObjectBell: + case Avalot::kObjectBell: _vm->_dialogs->displayText("That's a silly place to keep a bell."); break; - case Gyro::kObjectBodkin: + case Avalot::kObjectBodkin: _vm->_dialogs->displayText("But you might need it!"); break; - case Gyro::kObjectOnion: + case Avalot::kObjectOnion: _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_gyro->_wearing == _thing) { - Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); + if (_vm->_avalot->_wearing == _thing) { + Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { openBox(true); // Open box. - _vm->_gyro->_boxContent = _thing; - _vm->_gyro->_objects[_thing - 1] = false; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_boxContent = _thing; + _vm->_avalot->_objects[_thing - 1] = false; + _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayText("OK, it's in the box."); openBox(false); // Shut box. @@ -1320,7 +1318,7 @@ void Parser::putProc() { * @remarks Originally called 'not_in_order' */ void Parser::notInOrder() { - Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); + Common::String itemStr = _vm->_avalot->getItem(_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); @@ -1341,40 +1339,40 @@ void Parser::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Parser::giveToSpludwick() { - if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick] != _thing) { + if (_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick] != _thing) { notInOrder(); return false; } switch (_thing) { - case Gyro::kObjectOnion: - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; - if (_vm->_gyro->_rottenOnion) + case Avalot::kObjectOnion: + _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; + if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 22); else { - _vm->_gyro->_givenToSpludwick++; + _vm->_avalot->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 20); goToCauldron(); - _vm->_lucerna->incScore(3); + _vm->_avalot->incScore(3); } - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->refreshObjectList(); break; - case Gyro::kObjectInk: - _vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_givenToSpludwick++; + case Avalot::kObjectInk: + _vm->_avalot->_objects[Avalot::kObjectInk - 1] = false; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); - _vm->_lucerna->incScore(3); + _vm->_avalot->incScore(3); break; - case Gyro::kObjectMushroom: - _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; + case Avalot::kObjectMushroom: + _vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = false; _vm->_dialogs->displayScrollChain('q', 25); - _vm->_lucerna->incScore(5); - _vm->_gyro->_givenToSpludwick++; + _vm->_avalot->incScore(5); + _vm->_avalot->_givenToSpludwick++; goToCauldron(); - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; + _vm->_avalot->refreshObjectList(); break; default: return true; @@ -1384,29 +1382,29 @@ bool Parser::giveToSpludwick() { } void Parser::drink() { - _vm->_gyro->_alcoholLevel += 1; - if (_vm->_gyro->_alcoholLevel == 5) { - _vm->_gyro->_objects[Gyro::kObjectKey - 1] = true; // Get the key. - _vm->_gyro->_teetotal = true; - _vm->_gyro->_avvyIsAwake = false; - _vm->_gyro->_avvyInBed = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->dusk(); - _vm->_gyro->hangAroundForAWhile(); + _vm->_avalot->_alcoholLevel += 1; + if (_vm->_avalot->_alcoholLevel == 5) { + _vm->_avalot->_objects[Avalot::kObjectKey - 1] = true; // Get the key. + _vm->_avalot->_teetotal = true; + _vm->_avalot->_avvyIsAwake = false; + _vm->_avalot->_avvyInBed = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->dusk(); + _vm->_avalot->hangAroundForAWhile(); _vm->_animation->flipRoom(1, 1); - _vm->_gyro->setBackgroundColor(14); + _vm->_avalot->setBackgroundColor(14); _vm->_animation->_sprites[0]._visible = false; } } void Parser::cardiffClimbing() { - if (_vm->_gyro->_standingOnDais) { // Clamber up. + if (_vm->_avalot->_standingOnDais) { // Clamber up. _vm->_dialogs->displayText("You climb down, back onto the floor."); - _vm->_gyro->_standingOnDais = false; + _vm->_avalot->_standingOnDais = false; _vm->_animation->appearPed(0, 2); } else if (_vm->_animation->inField(0)) { // Clamber down _vm->_dialogs->displayText("You clamber up onto the dais."); - _vm->_gyro->_standingOnDais = true; + _vm->_avalot->_standingOnDais = true; _vm->_animation->appearPed(0, 1); } else _vm->_dialogs->displayText("Get a bit closer, Avvy."); @@ -1417,21 +1415,21 @@ void Parser::already() { } void Parser::standUp() { - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomYours: // Avvy isn't asleep. - if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) { // But he's in bed. - if (_vm->_gyro->_teetotal) { + if (_vm->_avalot->_avvyIsAwake && _vm->_avalot->_avvyInBed) { // But he's in bed. + if (_vm->_avalot->_teetotal) { _vm->_dialogs->displayScrollChain('d', 12); - _vm->_gyro->setBackgroundColor(0); + _vm->_avalot->setBackgroundColor(0); _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; - _vm->_gyro->_userMovesAvvy = true; + _vm->_avalot->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->_direction = Animation::kDirLeft; _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. - _vm->_lucerna->incScore(1); - _vm->_gyro->_avvyInBed = false; + _vm->_avalot->incScore(1); + _vm->_avalot->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); } else already(); @@ -1442,12 +1440,12 @@ void Parser::standUp() { break; case kRoomNottsPub: - if (_vm->_gyro->_sittingInPub) { + if (_vm->_avalot->_sittingInPub) { _vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. - _vm->_gyro->_sittingInPub = false; // Really not sitting down. - _vm->_gyro->_userMovesAvvy = true; // And ambulant. + _vm->_avalot->_sittingInPub = false; // Really not sitting down. + _vm->_avalot->_userMovesAvvy = true; // And ambulant. } else already(); break; @@ -1457,18 +1455,18 @@ void Parser::standUp() { } void Parser::getProc(char thing) { - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { - if (_vm->_gyro->_boxContent == thing) { + if (_vm->_avalot->_boxContent == thing) { _vm->_background->drawBackgroundSprite(-1, -1, 4); _vm->_dialogs->displayText("OK, I've got it."); - _vm->_gyro->_objects[thing - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_boxContent = kNothing; + _vm->_avalot->_objects[thing - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_boxContent = kNothing; _vm->_background->drawBackgroundSprite(-1, -1, 5); } else { - Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str()); _vm->_dialogs->displayText(tmpStr); } } else @@ -1476,25 +1474,25 @@ void Parser::getProc(char thing) { break; case kRoomInsideCardiffCastle: switch (thing) { - case Gyro::kObjectPen: + case Avalot::kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. - if (_vm->_gyro->_takenPen) + if (_vm->_avalot->_takenPen) _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! - _vm->_gyro->_takenPen = true; - _vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_takenPen = true; + _vm->_avalot->_objects[Avalot::kObjectPen - 1] = true; + _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayText("Taken."); } - } else if (_vm->_gyro->_standingOnDais) + } else if (_vm->_avalot->_standingOnDais) _vm->_dialogs->displayScrollChain('q', 53); else _vm->_dialogs->displayScrollChain('q', 51); break; - case Gyro::kObjectBolt: + case Avalot::kObjectBolt: _vm->_dialogs->displayScrollChain('q', 52); break; default: @@ -1502,14 +1500,14 @@ void Parser::getProc(char thing) { } break; case kRoomRobins: - if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { + if ((thing == Avalot::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_dialogs->displayText("Got it!"); - _vm->_gyro->_mushroomGrowing = false; - _vm->_gyro->_takenMushroom = true; - _vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(3); + _vm->_avalot->_mushroomGrowing = false; + _vm->_avalot->_takenMushroom = true; + _vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->incScore(3); } else _vm->_dialogs->displayScrollChain('q', 57); break; @@ -1523,13 +1521,13 @@ void Parser::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Parser::giveGeidaTheLute() { - if (_vm->_gyro->_room != kRoomLustiesRoom) { + if (_vm->_avalot->_room != kRoomLustiesRoom) { Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); return; } - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_objects[Avalot::kObjectLute - 1] = false; + _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); @@ -1554,13 +1552,13 @@ void Parser::winSequence() { Common::String Parser::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_room)) - _person = _vm->_gyro->_her; + if ((_vm->_avalot->_him == kPardon) || (_vm->_avalot->_whereIs[_vm->_avalot->_him - 150] != _vm->_avalot->_room)) + _person = _vm->_avalot->_her; else - _person = _vm->_gyro->_him; + _person = _vm->_avalot->_him; } - if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { + if (_vm->_avalot->_whereIs[_person - 150] != _vm->_avalot->_room) { return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } @@ -1578,7 +1576,7 @@ Common::String Parser::personSpeaks() { return tmpStr; for (int i = 0; i < 16; i++) { - if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) + if ((_vm->_avalot->kQuasipeds[i]._who == _person) && (_vm->_avalot->kQuasipeds[i]._room == _vm->_avalot->_room)) tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); } @@ -1589,7 +1587,7 @@ void Parser::heyThanks() { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_objects[_thing - 1] = false; + _vm->_avalot->_objects[_thing - 1] = false; } /** @@ -1605,7 +1603,7 @@ void Parser::doThat() { return; } - if (_vm->_gyro->_weirdWord) + if (_vm->_avalot->_weirdWord) return; if (_thing < 200) @@ -1615,11 +1613,11 @@ void Parser::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_gyro->_alive) { + if (!_vm->_avalot->_alive) { _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } - if (!_vm->_gyro->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + if (!_vm->_avalot->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); return; } @@ -1639,7 +1637,7 @@ void Parser::doThat() { break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_gyro->_carryNum >= kCarryLimit) + if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); @@ -1659,21 +1657,21 @@ void Parser::doThat() { break; case kVerbCodeTalk: if (_person == kPardon) { - if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". + if (_vm->_avalot->_subjectNum == 99) { // They typed "say password". Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { + } else if (((1 <= _vm->_avalot->_subjectNum) && (_vm->_avalot->_subjectNum <= 49)) || (_vm->_avalot->_subjectNum == 253) || (_vm->_avalot->_subjectNum == 249)) { _thats.deleteChar(0); for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = _vm->_gyro->_subjectNum; + _verb = _vm->_avalot->_subjectNum; doThat(); return; } else { - _person = _vm->_gyro->_subjectNum; - _vm->_gyro->_subjectNum = 0; + _person = _vm->_avalot->_subjectNum; + _vm->_avalot->_subjectNum = 0; if ((_person == 0) || (_person == kPardon)) _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) @@ -1688,80 +1686,80 @@ void Parser::doThat() { _vm->_dialogs->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { - case Gyro::kObjectMoney : + case Avalot::kObjectMoney : _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); break; - case Gyro::kObjectBodkin: - case Gyro::kObjectBell: - case Gyro::kObjectClothes: - case Gyro::kObjectHabit : + case Avalot::kObjectBodkin: + case Avalot::kObjectBell: + case Avalot::kObjectClothes: + case Avalot::kObjectHabit : _vm->_dialogs->displayText("Don't give it away, it might be useful!"); break; default: switch (_person) { - case Gyro::kPeopleCrapulus: - if (_thing == Gyro::kObjectWine) { + case Avalot::kPeopleCrapulus: + if (_thing == Avalot::kObjectWine) { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; + _vm->_avalot->_objects[Avalot::kObjectWine - 1] = false; } else heyThanks(); break; - case Gyro::kPeopleCwytalot: - if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) + case Avalot::kPeopleCwytalot: + if ((_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt)) _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else heyThanks(); break; - case Gyro::kPeopleSpludwick: + case Avalot::kPeopleSpludwick: if (giveToSpludwick()) heyThanks(); break; - case Gyro::kPeopleIbythneth: - if (_thing == Gyro::kObjectBadge) { + case Avalot::kPeopleIbythneth: + if (_thing == Avalot::kObjectBadge) { _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! - _vm->_lucerna->incScore(3); - _vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; - _vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; - _vm->_gyro->_givenBadgeToIby = true; + _vm->_avalot->incScore(3); + _vm->_avalot->_objects[Avalot::kObjectBadge - 1] = false; + _vm->_avalot->_objects[Avalot::kObjectHabit - 1] = true; + _vm->_avalot->_givenBadgeToIby = true; _vm->_background->drawBackgroundSprite(-1, -1, 7); _vm->_background->drawBackgroundSprite(-1, -1, 8); } else heyThanks(); break; - case Gyro::kPeopleAyles: - if (_vm->_gyro->_aylesIsAwake) { - if (_thing == Gyro::kObjectPen) { - _vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; + case Avalot::kPeopleAyles: + if (_vm->_avalot->_aylesIsAwake) { + if (_thing == Avalot::kObjectPen) { + _vm->_avalot->_objects[Avalot::kObjectPen - 1] = false; _vm->_dialogs->displayScrollChain('q', 54); - _vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; - _vm->_gyro->_givenPenToAyles = true; - _vm->_lucerna->refreshObjectList(); - _vm->_lucerna->incScore(2); + _vm->_avalot->_objects[Avalot::kObjectInk - 1] = true; + _vm->_avalot->_givenPenToAyles = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->incScore(2); } else heyThanks(); } else _vm->_dialogs->displayText("But he's asleep!"); break; - case Gyro::kPeopleGeida: + case Avalot::kPeopleGeida: switch (_thing) { - case Gyro::kObjectPotion: - _vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; + case Avalot::kObjectPotion: + _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = false; _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. - _vm->_lucerna->incScore(2); - _vm->_gyro->_givenPotionToGeida = true; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->incScore(2); + _vm->_avalot->_givenPotionToGeida = true; + _vm->_avalot->refreshObjectList(); break; - case Gyro::kObjectLute: + case Avalot::kObjectLute: giveGeidaTheLute(); break; default: heyThanks(); } break; - case Gyro::kPeopleArkata: + case Avalot::kPeopleArkata: switch (_thing) { - case Gyro::kObjectPotion: - if (_vm->_gyro->_givenPotionToGeida) + case Avalot::kObjectPotion: + if (_vm->_avalot->_givenPotionToGeida) winSequence(); else _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! @@ -1775,7 +1773,7 @@ void Parser::doThat() { } } } - _vm->_lucerna->refreshObjectList(); // Just in case... + _vm->_avalot->refreshObjectList(); // Just in case... } break; @@ -1806,7 +1804,7 @@ void Parser::doThat() { else { Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); if (_vm->_dialogs->displayQuestion(tmpStr)) - _vm->_gyro->_letMeOut = true; + _vm->_avalot->_letMeOut = true; } break; case kVerbCodeGo: @@ -1821,45 +1819,45 @@ void Parser::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + "The medi\x91val descendant of" + Dialogs::kControlNewLine + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + + "version " + _vm->_avalot->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->_avalot->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; _vm->_dialogs->displayText(toDisplay); _vm->_dialogs->_aboutBox = false; } break; case kVerbCodeUndress: - if (_vm->_gyro->_wearing == kNothing) + if (_vm->_avalot->_wearing == kNothing) _vm->_dialogs->displayText("You're already stark naked!"); - else if (_vm->_gyro->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); + else if (_vm->_avalot->_avvysInTheCupboard) { + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_vm->_avalot->_wearing).c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_wearing = kNothing; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_wearing = kNothing; + _vm->_avalot->refreshObjectList(); } else _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); break; case kVerbCodeWear: if (isHolding()) { // Wear something. switch (_thing) { - case Gyro::kObjectChastity: + case Avalot::kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); break; - case Gyro::kObjectClothes: - case Gyro::kObjectHabit: { // Change this! - if (_vm->_gyro->_wearing != kNothing) { - if (_vm->_gyro->_wearing == _thing) + case Avalot::kObjectClothes: + case Avalot::kObjectHabit: { // Change this! + if (_vm->_avalot->_wearing != kNothing) { + if (_vm->_avalot->_wearing == _thing) _vm->_dialogs->displayText("You're already wearing that."); else _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_gyro->_wearing = _thing; + _vm->_avalot->_wearing = _thing; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->refreshObjectList(); byte i; - if (_thing == Gyro::kObjectHabit) + if (_thing == Avalot::kObjectHabit) i = 3; else i = 0; @@ -1881,36 +1879,36 @@ void Parser::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_gyro->_room) { // They just typed "play"... + switch (_vm->_avalot->_room) { // They just typed "play"... case kRoomArgentPub: // ...in the pub, => play Nim. warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_gyro->_wonNim) { // Already won the game. + if (_vm->_avalot->_wonNim) { // Already won the game. _vm->_dialogs->displayScrollChain('Q', 6); return; } - if (!_vm->_gyro->_askedDogfoodAboutNim) { + if (!_vm->_avalot->_askedDogfoodAboutNim) { _vm->_dialogs->displayScrollChain('q', 84); return; } _vm->_dialogs->displayScrollChain('Q', 3); - _vm->_gyro->_playedNim++; + _vm->_avalot->_playedNim++; // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_wonNim = true; + _vm->_avalot->_objects[Avalot::kObjectLute - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_wonNim = true; _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. - _vm->_lucerna->incScore(7); // 7 points for winning! + _vm->_avalot->incScore(7); // 7 points for winning! - if (_vm->_gyro->_playedNim == 1) - _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. + if (_vm->_avalot->_playedNim == 1) + _vm->_avalot->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1922,23 +1920,23 @@ void Parser::doThat() { } } else if (isHolding()) { switch (_thing) { - case Gyro::kObjectLute : + case Avalot::kObjectLute : _vm->_dialogs->displayScrollChain('U', 7); - if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) + if (_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 10); - if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) + if (_vm->_avalot->_whereIs[Avalot::kPeopleDuLustie - 150] == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 15); break; case 52: - if (_vm->_gyro->_room == kRoomMusicRoom) + if (_vm->_avalot->_room == kRoomMusicRoom) playHarp(); else _vm->_dialogs->displayText(kWhat); break; case 55: - if (_vm->_gyro->_room == kRoomArgentPub) + if (_vm->_avalot->_room == kRoomArgentPub) // play_nim(); warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); else @@ -1951,9 +1949,9 @@ void Parser::doThat() { break; case kVerbCodeRing: if (isHolding()) { - if (_thing == Gyro::kObjectBell) { + if (_thing == Avalot::kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1975,7 +1973,7 @@ void Parser::doThat() { warning("STUB: Parser::doThat() - case kVerbCodeboss"); break; case kVerbCodePee: - if (_vm->_gyro->setFlag('P')) { + if (_vm->_avalot->setFlag('P')) { _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { @@ -1986,16 +1984,16 @@ void Parser::doThat() { case kVerbCodeCheat: { Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); _vm->_dialogs->displayText(tmpStr); - _vm->_gyro->_cheat = true; + _vm->_avalot->_cheat = true; } break; case kVerbCodeMagic: - if (_vm->_gyro->_avariciusTalk > 0) + if (_vm->_avalot->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 19); else { - if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! + if ((_vm->_avalot->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! _vm->_dialogs->displayScrollChain('q', 17); - if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) + if (_vm->_avalot->_whereIs[1] == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2004,7 +2002,7 @@ void Parser::doThat() { spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; - _vm->_gyro->_avariciusTalk = 14; + _vm->_avalot->_avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else @@ -2015,7 +2013,7 @@ void Parser::doThat() { _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: - switch (_vm->_gyro->_sworeNum) { + switch (_vm->_avalot->_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); @@ -2033,21 +2031,21 @@ void Parser::doThat() { // CHECKME: Weird character in string Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); _vm->_dialogs->displayText(tmpStr); - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); } } - _vm->_gyro->_sworeNum++; + _vm->_avalot->_sworeNum++; break; case kVerbCodeListen: - if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) + if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); - else if (_vm->_gyro->_listen.empty()) + else if (_vm->_avalot->_listen.empty()) _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_dialogs->displayText(_vm->_gyro->_listen); + _vm->_dialogs->displayText(_vm->_avalot->_listen); break; case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_gyro->_room) { + switch (_vm->_avalot->_room) { case kRoomArgentPub: if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. switch (_thing) { @@ -2055,40 +2053,40 @@ void Parser::doThat() { case 53: case 54: case 58: // Beer, whisky, cider or mead. - if (_vm->_gyro->_malagauche == 177) { // Already getting us one. + if (_vm->_avalot->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_gyro->_teetotal) { + if (_vm->_avalot->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } - if (_vm->_gyro->_alcoholLevel == 0) - _vm->_lucerna->incScore(3); + if (_vm->_avalot->_alcoholLevel == 0) + _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 11); _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); - _vm->_gyro->_drinking = _thing; + _vm->_avalot->_drinking = _thing; _vm->_background->drawBackgroundSprite(-1, -1, 9); - _vm->_gyro->_malagauche = 177; + _vm->_avalot->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! - case Gyro::kObjectWine: - if (_vm->_gyro->_objects[Gyro::kObjectWine - 1]) // We've already got the wine! + case Avalot::kObjectWine: + if (_vm->_avalot->_objects[Avalot::kObjectWine - 1]) // We've already got the wine! _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { - if (_vm->_gyro->_malagauche == 177) { // Already getting us one. + if (_vm->_avalot->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_gyro->_carryNum >= kCarryLimit) { + if (_vm->_avalot->_carryNum >= kCarryLimit) { _vm->_dialogs->displayText("Your hands are full."); return; } @@ -2096,10 +2094,10 @@ void Parser::doThat() { _vm->_background->drawBackgroundSprite(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - if (_vm->_gyro->_alcoholLevel == 0) - _vm->_lucerna->incScore(3); + if (_vm->_avalot->_alcoholLevel == 0) + _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 9); - _vm->_gyro->_malagauche = 177; + _vm->_avalot->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); } @@ -2111,24 +2109,24 @@ void Parser::doThat() { case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { - if (_thing == Gyro::kObjectOnion) { - if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) + if (_thing == Avalot::kObjectOnion) { + if (_vm->_avalot->_objects[Avalot::kObjectOnion - 1]) _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! - else if (_vm->_gyro->_carryNum >= kCarryLimit) + else if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { - if (_vm->_gyro->_boughtOnion) + if (_vm->_avalot->_boughtOnion) _vm->_dialogs->displayScrollChain('D', 11); else { _vm->_dialogs->displayScrollChain('D', 9); - _vm->_lucerna->incScore(3); + _vm->_avalot->incScore(3); } - _vm->_gyro->decreaseMoney(3); // It costs thruppence. - _vm->_gyro->_objects[Gyro::kObjectOnion - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_boughtOnion = true; - _vm->_gyro->_rottenOnion = false; // It's OK when it leaves the stall! - _vm->_gyro->_onionInVinegar = false; + _vm->_avalot->decreaseMoney(3); // It costs thruppence. + _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_boughtOnion = true; + _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! + _vm->_avalot->_onionInVinegar = false; } } else _vm->_dialogs->displayScrollChain('D', 0); @@ -2144,33 +2142,33 @@ void Parser::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_gyro->_room == kRoomBrummieRoad) && - ((_person == Gyro::kPeopleCwytalot) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && - (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { - switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { + if ((_vm->_avalot->_room == kRoomBrummieRoad) && + ((_person == Avalot::kPeopleCwytalot) || (_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt)) && + (_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room)) { + switch (_vm->_avalot->_objects[Avalot::kObjectBolt - 1] + _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_dialogs->displayScrollChain('Q', 10); _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_dialogs->displayText("Attack _vm->_avalot->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: _vm->_dialogs->displayScrollChain('Q', 11); - _vm->_gyro->_cwytalotGone = true; - _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; - _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; - _vm->_lucerna->incScore(7); + _vm->_avalot->_cwytalotGone = true; + _vm->_avalot->_objects[Avalot::kObjectBolt - 1] = false; + _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = false; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_magics[11]._operation = Avalot::kMagicNothing; + _vm->_avalot->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; + _vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] = kRoomDummy; break; default: _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! @@ -2179,14 +2177,14 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('Q', 10); break; case kVerbCodePasswd: - if (_vm->_gyro->_room != kRoomBridge) + if (_vm->_avalot->_room != kRoomBridge) _vm->_dialogs->displayScrollChain('Q', 12); else { bool ok = true; for (uint i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; + int pwdId = _vm->_avalot->_passwordNum + kFirstPassword; for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; @@ -2194,13 +2192,13 @@ void Parser::doThat() { } if (ok) { - if (_vm->_gyro->_drawbridgeOpen != 0) + if (_vm->_avalot->_drawbridgeOpen != 0) _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { - _vm->_lucerna->incScore(4); + _vm->_avalot->incScore(4); _vm->_dialogs->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); - _vm->_gyro->_drawbridgeOpen = 1; + _vm->_avalot->_drawbridgeOpen = 1; } } else _vm->_dialogs->displayScrollChain('Q', 12); @@ -2210,10 +2208,10 @@ void Parser::doThat() { //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! break; case kVerbCodeDie: - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_avalot->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); _vm->_dialogs->displayText(tmpStr); } break; @@ -2228,31 +2226,31 @@ void Parser::doThat() { _vm->_dialogs->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { - case Gyro::kPeopleArkata: + case Avalot::kPeopleArkata: _vm->_dialogs->displayScrollChain('U', 12); break; - case Gyro::kPeopleGeida: + case Avalot::kPeopleGeida: _vm->_dialogs->displayScrollChain('U', 13); break; - case Gyro::kPeopleWisewoman: + case Avalot::kPeopleWisewoman: _vm->_dialogs->displayScrollChain('U', 14); break; default: _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? } - } else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) + } else if ((Avalot::kPeopleAvalot <= _person) && (_person < Avalot::kPeopleArkata)) _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); break; case kVerbCodeClimb: - if (_vm->_gyro->_room == kRoomInsideCardiffCastle) + if (_vm->_avalot->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_userMovesAvvy = false; break; case kVerbCodeHiscores: // show_highs(); @@ -2262,23 +2260,23 @@ void Parser::doThat() { if (isPersonHere()) switch (_person) { case kPardon: - case Gyro::kPeopleAvalot: + case Avalot::kPeopleAvalot: case 0: - if (!_vm->_gyro->_avvyIsAwake) { - _vm->_gyro->_avvyIsAwake = true; - _vm->_lucerna->incScore(1); - _vm->_gyro->_avvyInBed = true; + if (!_vm->_avalot->_avvyIsAwake) { + _vm->_avalot->_avvyIsAwake = true; + _vm->_avalot->incScore(1); + _vm->_avalot->_avvyInBed = true; _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. - if (_vm->_gyro->_teetotal) + if (_vm->_avalot->_teetotal) _vm->_dialogs->displayScrollChain('d', 13); } else _vm->_dialogs->displayText("You're already awake, Avvy!"); break; - case Gyro::kPeopleAyles: - if (!_vm->_gyro->_aylesIsAwake) + case Avalot::kPeopleAyles: + if (!_vm->_avalot->_aylesIsAwake) _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; - case Gyro::kPeopleJacques: { + case Avalot::kPeopleJacques: { Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); @@ -2289,26 +2287,26 @@ void Parser::doThat() { } break; case kVerbCodeSit: - if (_vm->_gyro->_room == kRoomNottsPub) { - if (_vm->_gyro->_sittingInPub) + if (_vm->_avalot->_room == kRoomNottsPub) { + if (_vm->_avalot->_sittingInPub) _vm->_dialogs->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. - _vm->_lucerna->dusk(); - _vm->_gyro->hangAroundForAWhile(); - _vm->_lucerna->dawn(); + _vm->_avalot->dusk(); + _vm->_avalot->hangAroundForAWhile(); + _vm->_avalot->dawn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { - _vm->_lucerna->dusk(); - _vm->_gyro->newGame(); - _vm->_lucerna->dawn(); + _vm->_avalot->dusk(); + _vm->_avalot->newGame(); + _vm->_avalot->dawn(); } break; case kPardon: diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 95e15e599f87..368fa0dfd7e4 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -30,8 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/pingo.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h" #include "avalanche/animation.h" #include "avalanche/dialogs.h" @@ -78,7 +76,7 @@ void Pingo::zonk() { void Pingo::winningPic() { Common::File f; - _vm->_lucerna->dusk(); + _vm->_avalot->dusk(); if (!f.open("finale.avd")) error("AVALANCHE: Lucerna: File not found: finale.avd"); @@ -97,11 +95,11 @@ void Pingo::winningPic() { warning("STUB: Pingo::winningPic()"); - _vm->_lucerna->dawn(); + _vm->_avalot->dawn(); #if 0 do { - _vm->_gyro->check(); + _vm->_avalot->check(); } while (!(keypressed() || (mrelease > 0))); while (keypressed()) char r = readkey(); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 712275e73d25..8ca3844bc9e0 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -29,7 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/sequence.h" -#include "avalanche/gyro.h" #include "avalanche/timer.h" #include "avalanche/background.h" #include "avalanche/animation.h" @@ -61,8 +60,8 @@ void Sequence::thenShow(byte what) { void Sequence::thenFlip(byte where, byte ped) { thenShow(kNowFlip); - _vm->_gyro->_flipToWhere = where; - _vm->_gyro->_flipToPed = ped; + _vm->_avalot->_flipToWhere = where; + _vm->_avalot->_flipToPed = ped; } void Sequence::startToClose() { @@ -71,7 +70,7 @@ void Sequence::startToClose() { } void Sequence::startToOpen() { - _vm->_gyro->_userMovesAvvy = false; // They can't move. + _vm->_avalot->_userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. startToClose(); // Apart from that, it's the same thing. } @@ -90,8 +89,8 @@ void Sequence::callSequencer() { return; // No more routines. break; case 177: // Flip room. - _vm->_gyro->_userMovesAvvy = true; - _vm->_animation->flipRoom(_vm->_gyro->_flipToWhere, _vm->_gyro->_flipToPed); + _vm->_avalot->_userMovesAvvy = true; + _vm->_animation->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); if (curSeq == 177) shoveLeft(); break; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b40731adc6d5..081f7a314bf3 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -29,7 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/timer.h" -#include "avalanche/lucerna.h" #include "avalanche/animation.h" #include "avalanche/dialogs.h" #include "avalanche/sequence.h" @@ -55,7 +54,7 @@ Timer::Timer(AvalancheEngine *vm) { * @remarks Originally called 'set_up_timer' */ void Timer::addTimer(int32 duration, byte action, byte reason) { - if ((_vm->_gyro->_isLoaded == false) || (_timerLost == true)) { + if ((_vm->_avalot->_isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; @@ -68,7 +67,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { _times[i]._action = action; _times[i]._reason = reason; } else { - _vm->_gyro->_isLoaded = false; + _vm->_avalot->_isLoaded = false; return; } } @@ -156,7 +155,7 @@ void Timer::updateTimer() { crapulusSaysSpludOut(); break; case kProcDawnDelay: - _vm->_lucerna->dawn(); + _vm->_avalot->dawn(); break; case kProcBuyDrinks: buyDrinks(); @@ -215,8 +214,8 @@ void Timer::updateTimer() { } } } - _vm->_gyro->_roomTime++; // Cycles since you've been in this room. - _vm->_gyro->_totalTime++; // Total amount of time for this game. + _vm->_avalot->_roomTime++; // Cycles since you've been in this room. + _vm->_avalot->_totalTime++; // Total amount of time for this game. } void Timer::loseTimer(byte which) { @@ -229,29 +228,29 @@ void Timer::loseTimer(byte which) { } void Timer::openDrawbridge() { - _vm->_gyro->_drawbridgeOpen++; - _vm->_background->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); + _vm->_avalot->_drawbridgeOpen++; + _vm->_background->drawBackgroundSprite(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); - if (_vm->_gyro->_drawbridgeOpen == 4) - _vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. + if (_vm->_avalot->_drawbridgeOpen == 4) + _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } void Timer::avariciusTalks() { - _vm->_dialogs->displayScrollChain('q', _vm->_gyro->_avariciusTalk); - _vm->_gyro->_avariciusTalk++; + _vm->_dialogs->displayScrollChain('q', _vm->_avalot->_avariciusTalk); + _vm->_avalot->_avariciusTalk++; - if (_vm->_gyro->_avariciusTalk < 17) + if (_vm->_avalot->_avariciusTalk < 17) addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); else - _vm->_lucerna->incScore(3); + _vm->_avalot->incScore(3); } void Timer::urinate() { _vm->_animation->_sprites[0].turn(Animation::kDirUp); _vm->_animation->stopWalking(); - _vm->_lucerna->drawDirection(); + _vm->_avalot->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); } @@ -273,20 +272,20 @@ void Timer::stairs() { _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_brummieStairs = 2; - _vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; - _vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_avalot->_brummieStairs = 2; + _vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial; + _vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs. + _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { - if (_vm->_gyro->_cardiffQuestionNum == 0) { - _vm->_gyro->_cardiffQuestionNum++; + if (_vm->_avalot->_cardiffQuestionNum == 0) { + _vm->_avalot->_cardiffQuestionNum++; _vm->_dialogs->displayScrollChain('q', 27); } - _vm->_dialogs->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); - _vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; + _vm->_dialogs->displayScrollChain('z', _vm->_avalot->_cardiffQuestionNum); + _vm->_avalot->_interrogation = _vm->_avalot->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } @@ -301,8 +300,8 @@ void Timer::cwytalotInHerts() { void Timer::getTiedUp() { _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! - _vm->_gyro->_userMovesAvvy = false; - _vm->_gyro->_beenTiedUp = true; + _vm->_avalot->_userMovesAvvy = false; + _vm->_avalot->_beenTiedUp = true; _vm->_animation->stopWalking(); AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -316,8 +315,8 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[1].walkTo(4); - _vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. - _vm->_gyro->_friarWillTieYouUp = true; + _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // No effect when you touch the boundaries. + _vm->_avalot->_friarWillTieYouUp = true; } void Timer::hangAround() { @@ -325,7 +324,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; + _vm->_avalot->_whereIs[Avalot::kPeopleRobinHood - 150] = kRoomRobins; _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); @@ -337,7 +336,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); - _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; + _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomRobins; _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -345,20 +344,20 @@ void Timer::hangAround2() { addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). - _vm->_gyro->_tiedUp = false; + _vm->_avalot->_tiedUp = false; // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! } void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_animation->flipRoom(_vm->_gyro->_room, 1); + _vm->_animation->flipRoom(_vm->_avalot->_room, 1); _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); - _vm->_gyro->_userMovesAvvy = true; - _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_userMovesAvvy = true; + _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = true; + _vm->_avalot->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") @@ -386,9 +385,9 @@ void Timer::afterTheShootemup() { } void Timer::jacquesWakesUp() { - _vm->_gyro->_jacquesState++; + _vm->_avalot->_jacquesState++; - switch (_vm->_gyro->_jacquesState) { // Additional pictures. + switch (_vm->_avalot->_jacquesState) { // Additional pictures. case 1 : _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. _vm->_dialogs->displayScrollChain('Q', 45); @@ -396,22 +395,22 @@ void Timer::jacquesWakesUp() { case 2 : // Going through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. _vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door. - _vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // You can't wake him up now. + _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. - _vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! + _vm->_avalot->_whereIs[Avalot::kPeopleJacques - 150] = 0; // Gone! break; } - if (_vm->_gyro->_jacquesState == 5) { - _vm->_gyro->_bellsAreRinging = true; - _vm->_gyro->_aylesIsAwake = true; - _vm->_lucerna->incScore(2); + if (_vm->_avalot->_jacquesState == 5) { + _vm->_avalot->_bellsAreRinging = true; + _vm->_avalot->_aylesIsAwake = true; + _vm->_avalot->incScore(2); } - switch (_vm->_gyro->_jacquesState) { + switch (_vm->_avalot->_jacquesState) { case 1: case 2: case 3: @@ -454,8 +453,8 @@ void Timer::naughtyDuke3() { void Timer::jump() { AnimationType *avvy = &_vm->_animation->_sprites[0]; - _vm->_gyro->_jumpStatus++; - switch (_vm->_gyro->_jumpStatus) { + _vm->_avalot->_jumpStatus++; + switch (_vm->_avalot->_jumpStatus) { case 1: case 2: case 3: @@ -474,73 +473,73 @@ void Timer::jump() { break; } - if (_vm->_gyro->_jumpStatus == 20) { // End of jump. - _vm->_gyro->_userMovesAvvy = true; - _vm->_gyro->_jumpStatus = 0; + if (_vm->_avalot->_jumpStatus == 20) { // End of jump. + _vm->_avalot->_userMovesAvvy = true; + _vm->_avalot->_jumpStatus = 0; } else // Still jumping. addTimer(1, kProcJump, kReasonJumping); - if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. - && (_vm->_gyro->_room == kRoomInsideCardiffCastle) - && (_vm->_gyro->_arrowInTheDoor == true) + if ((_vm->_avalot->_jumpStatus == 10) // You're at the highest point of your jump. + && (_vm->_avalot->_room == kRoomInsideCardiffCastle) + && (_vm->_avalot->_arrowInTheDoor == true) && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! - if (_vm->_gyro->_carryNum >= kCarryLimit) + if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { _vm->_background->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_arrowInTheDoor = false; // You've got it. - _vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; - _vm->_lucerna->refreshObjectList(); + _vm->_avalot->_arrowInTheDoor = false; // You've got it. + _vm->_avalot->_objects[Avalot::kObjectBolt - 1] = true; + _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 50); - _vm->_lucerna->incScore(3); + _vm->_avalot->incScore(3); } } } void Timer::crapulusSaysSpludOut() { _vm->_dialogs->displayScrollChain('q', 56); - _vm->_gyro->_crapulusWillTell = false; + _vm->_avalot->_crapulusWillTell = false; } void Timer::buyDrinks() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. - _vm->_gyro->_malagauche = 0; + _vm->_avalot->_malagauche = 0; - _vm->_dialogs->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. + _vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. - if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. + if (_vm->_avalot->decreaseMoney(3)) // Pay 3d. _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_parser->drink(); } void Timer::buyWine() { _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. - _vm->_gyro->_malagauche = 0; + _vm->_avalot->_malagauche = 0; _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. - if (_vm->_gyro->decreaseMoney(3)) { + if (_vm->_avalot->decreaseMoney(3)) { _vm->_dialogs->displayScrollChain('D', 4); // You paid up. - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_wineState = 1; // OK Wine. + _vm->_avalot->_objects[Avalot::kObjectWine - 1] = true; + _vm->_avalot->refreshObjectList(); + _vm->_avalot->_wineState = 1; // OK Wine. } } void Timer::callsGuards() { _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); } void Timer::greetsMonk() { _vm->_dialogs->displayScrollChain('Q', 59); - _vm->_gyro->_enteredLustiesRoomAsMonk = true; + _vm->_avalot->_enteredLustiesRoomAsMonk = true; } void Timer::fallDownOubliette() { - _vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; + _vm->_avalot->_magics[8]._operation = Avalot::kMagicNothing; AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! @@ -549,13 +548,13 @@ void Timer::fallDownOubliette() { } void Timer::meetAvaroid() { - if (_vm->_gyro->_metAvaroid) { + if (_vm->_avalot->_metAvaroid) { Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - _vm->_lucerna->gameOver(); + _vm->_avalot->gameOver(); } else { _vm->_dialogs->displayScrollChain('Q', 60); - _vm->_gyro->_metAvaroid = true; + _vm->_avalot->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -564,7 +563,7 @@ void Timer::meetAvaroid() { avvy->_moveX = -3; avvy->_moveY = -5; - _vm->_gyro->setBackgroundColor(2); + _vm->_avalot->setBackgroundColor(2); } } @@ -576,7 +575,7 @@ void Timer::riseUpOubliette() { if (avvy->_moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else - _vm->_gyro->_userMovesAvvy = true; + _vm->_avalot->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { @@ -589,7 +588,7 @@ void Timer::robinHoodAndGeida() { spr->stopWalk(); spr->_facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); - _vm->_gyro->_geidaFollows = false; + _vm->_avalot->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { @@ -613,7 +612,7 @@ void Timer::avalotReturns() { avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(0, 0); _vm->_dialogs->displayScrollChain('q', 67); - _vm->_gyro->_userMovesAvvy = true; + _vm->_avalot->_userMovesAvvy = true; } /** @@ -627,8 +626,8 @@ void Timer::avvySitDown() { addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_background->drawBackgroundSprite(-1, -1, 2); - _vm->_gyro->_sittingInPub = true; - _vm->_gyro->_userMovesAvvy = false; + _vm->_avalot->_sittingInPub = true; + _vm->_avalot->_userMovesAvvy = false; avvy->_visible = false; } } @@ -640,7 +639,7 @@ void Timer::ghostRoomPhew() { } void Timer::arkataShouts() { - if (_vm->_gyro->_teetotal) + if (_vm->_avalot->_teetotal) return; _vm->_dialogs->displayScrollChain('q', 76); @@ -654,14 +653,14 @@ void Timer::winning() { warning("STUB: Timer::winning()"); #if 0 do { - _vm->_lucerna->checkclick(); - } while (!(_vm->_gyro->mrelease == 0)); + _vm->_avalot->checkclick(); + } while (!(_vm->_avalot->mrelease == 0)); #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_lucerna->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(Parser::kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); - _vm->_gyro->_letMeOut = true; + _vm->_avalot->_letMeOut = true; } void Timer::avalotFalls() { @@ -693,8 +692,8 @@ void Timer::spludwickLeavesCauldron() { void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_dialogs->displayScrollChain('Q', 86); - _vm->_lucerna->incScore(4); - _vm->_gyro->_lustieIsAsleep = true; + _vm->_avalot->incScore(4); + _vm->_avalot->_lustieIsAsleep = true; _vm->_sequence->firstShow(5); _vm->_sequence->thenShow(6); // He falls asleep... _vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure. From 45ad88b73b654b5ba0ea28e271a742ae17e966c3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 22:39:56 +0200 Subject: [PATCH 1082/1332] AVALANCHE: uncomment some sound code, code cleanup --- engines/avalanche/avalot.cpp | 53 ++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e514d7933d0b..772c1ad6a056 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -267,7 +267,6 @@ Avalot::~Avalot() { } void Avalot::handleKeyDown(Common::Event &event) { -// if (keyboardclick) _vm->_sound->click(); if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) @@ -409,8 +408,6 @@ void Avalot::runAvalot() { _vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). } while (!_letMeOut && !_vm->shouldQuit()); - //if (logging) - // close(logfile); warning("STUB: Avalot::run()"); _vm->_closing->exitGame(); @@ -811,22 +808,20 @@ void Avalot::enterRoom(byte room, byte ped) { if (_cwytalotGone) { _magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomNowhere; - } else { - if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot - spr1->_callEachStepFl = true; - spr1->_eachStepProc = Animation::kProcFollowAvvyY; - _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomBrummieRoad; - - if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... - _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... - spr1->walkTo(3); // ...and he walks up... - } else { - // You've been here before. - _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... - spr1->_facingDir = Animation::kDirLeft; - } + } else if (ped > 0) { + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(4, false, _vm->_animation); // 4 = Cwytalot + spr1->_callEachStepFl = true; + spr1->_eachStepProc = Animation::kProcFollowAvvyY; + _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomBrummieRoad; + + if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... + _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... + spr1->walkTo(3); // ...and he walks up... + } else { + // You've been here before. + _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... + spr1->_facingDir = Animation::kDirLeft; } } break; @@ -855,15 +850,13 @@ void Avalot::enterRoom(byte room, byte ped) { break; case kRoomRobins: - if (ped > 0) { - if (!_beenTiedUp) { - // A welcome party... or maybe not... - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); - spr1->walkTo(2); - _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); - } + if ((ped > 0) && (!_beenTiedUp)) { + // A welcome party... or maybe not... + AnimationType *spr1 = &_vm->_animation->_sprites[1]; + spr1->init(6, false, _vm->_animation); + _vm->_animation->appearPed(1, 1); + spr1->walkTo(2); + _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } if (_beenTiedUp) { @@ -1239,11 +1232,11 @@ void Avalot::incScore(byte num) { for (int i = 1; i <= num; i++) { _dnascore++; -// if (soundfx) { + if (_soundFx) { for (int j = 1; j <= 97; j++) // Length os 2 is a guess, the original doesn't have a delay specified _vm->_sound->playNote(177 + _dnascore * 3, 2); -// } + } } warning("STUB: Avalot::points()"); From 66fe0b2ebc054f167931a661620e59d66c664a15 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 22:48:39 +0200 Subject: [PATCH 1083/1332] AVALANCHE: Remove useless comments. --- engines/avalanche/avalanche.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 673280cb4ba1..729778832164 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -113,7 +113,6 @@ const char *AvalancheEngine::getCopyrightString() const { } void AvalancheEngine::synchronize(Common::Serializer &sz) { - //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_animation->_direction); sz.syncAsByte(_avalot->_carryNum); for (int i = 0; i < kObjectNum; i++) @@ -255,16 +254,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_givenPenToAyles); sz.syncAsByte(_avalot->_askedDogfoodAboutNim); - -#if 0 - for (int groi = 0; groi < numtr; groi++) { - if (tr[groi].quick) { - blockwrite(f, groi, 1); - tr[groi].savedata(f); - } - } -#endif - byte spriteNum = 0; if (sz.isSaving()) { for (int i = 0; i < _animation->kSpriteNumbMax; i++) { @@ -315,17 +304,12 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { spr->appear(spr->_x, spr->_y, spr->_facingDir); } - //groi = 177; - //blockwrite(f, groi, 1); - - //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); sz.syncAsByte(_timer->_times[i]._action); sz.syncAsByte(_timer->_times[i]._reason); } - //blockwrite(f, seq, sizeof(seq)); // Sequencer information. sz.syncBytes(_sequence->_seq, _sequence->kSeqLength); } From 79a961c89d4f8fd46b70a01cc0d717274c415402 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 23:34:21 +0200 Subject: [PATCH 1084/1332] AVALANCHE: Move some variables, fix savegame counter increment when saving --- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalanche.cpp | 40 +++++++++++++++++---------------- engines/avalanche/avalot.cpp | 6 ++--- engines/avalanche/avalot.h | 2 -- engines/avalanche/parser.cpp | 22 +++++++++--------- engines/avalanche/parser.h | 4 +++- 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 0593b046af7e..70f007ae4d8a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1230,7 +1230,7 @@ void Animation::stopWalking() { */ void Animation::hideInCupboard() { if (_vm->_avalot->_avvysInTheCupboard) { - if (_vm->_avalot->_wearing == Parser::kNothing) { + if (_vm->_parser->_wearing == Parser::kNothing) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 729778832164..282c629ba104 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -120,8 +120,10 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsSint16LE(_avalot->_dnascore); sz.syncAsSint32LE(_avalot->_money); sz.syncAsByte(_avalot->_room); - sz.syncAsByte(_avalot->_wearing); - sz.syncAsByte(_avalot->_sworeNum); + sz.syncAsByte(_parser->_wearing); + sz.syncAsByte(_parser->_sworeNum); + if (sz.isSaving()) + _avalot->_saveNum++; sz.syncAsByte(_avalot->_saveNum); sz.syncBytes(_avalot->_roomCount, 100); sz.syncAsByte(_avalot->_alcoholLevel); @@ -474,7 +476,7 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _avalot->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). + _avalot->_holdLeftMouse = true; // Used in Avalot::checkclick() and Menu::menu_link(). break; case Common::EVENT_LBUTTONUP: _avalot->_holdLeftMouse = false; // Same as above. @@ -505,20 +507,20 @@ Common::Error AvalancheEngine::run() { _avalot->runAvalot(); #if 0 - //switch (_storage._operation) { - //case kRunShootemup: - // run("seu.avx", kJsb, kBflight, kNormal); - // break; - //case kRunDosshell: - // dosShell(); - // break; - //case kRunGhostroom: - // run("g-room.avx", kJsb, kNoBflight, kNormal); - // break; - //case kRunGolden: - // run("golden.avx", kJsb, kBflight, kMusical); - // break; - //} + switch (_storage._operation) { + case kRunShootemup: + run("seu.avx", kJsb, kBflight, kNormal); + break; + case kRunDosshell: + dosShell(); + break; + case kRunGhostroom: + run("g-room.avx", kJsb, kNoBflight, kNormal); + break; + case kRunGolden: + run("golden.avx", kJsb, kBflight, kMusical); + break; + } #endif } while (!_avalot->_letMeOut && !shouldQuit()); @@ -528,8 +530,8 @@ Common::Error AvalancheEngine::run() { #if 0 void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { - warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. + warning("STUB: run(%s)", what.c_str()); } Common::String AvalancheEngine::elmToStr(Elm how) { @@ -541,7 +543,7 @@ Common::String AvalancheEngine::elmToStr(Elm how) { return Common::String("REGI"); case kElmpoyten: return Common::String("ELMPOYTEN"); - // Useless, but silent a warning + // Useless, but silent a warning default: return Common::String(""); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 772c1ad6a056..c5d942dc0d2e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1560,8 +1560,8 @@ void Avalot::resetVariables() { _dnascore = 0; _money = 0; _room = kRoomNowhere; - _wearing = 0; - _sworeNum = 0; + _vm->_parser->_wearing = 0; + _vm->_parser->_sworeNum = 0; _saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; @@ -1653,7 +1653,7 @@ void Avalot::newGame() { _favouriteDrink = "beer"; _money = 30; // 2/6 _vm->_animation->_direction = Animation::kDirStopped; - _wearing = kObjectClothes; + _vm->_parser->_wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; _objects[kObjectBell - 1] = true; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 51be1a3dd415..cc503749eb82 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -247,8 +247,6 @@ class Avalot { int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh byte _room; // your current room - byte _wearing; // what you're wearing - byte _sworeNum; // number of times you've sworn byte _saveNum; // number of times this game has been saved byte _roomCount[100]; // Add one to each every time you enter a room byte _alcoholLevel; // Your blood alcohol level. diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4a58763d0c90..72336280aee4 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1033,7 +1033,7 @@ void Parser::inventory() { tmpStr += _vm->_avalot->getItem(i + 1); - if ((i + 1) == _vm->_avalot->_wearing) + if ((i + 1) == _wearing) tmpStr += ", which you're wearing"; if (itemNum < _vm->_avalot->_carryNum) @@ -1041,7 +1041,7 @@ void Parser::inventory() { } } - if (_vm->_avalot->_wearing == kNothing) + if (_wearing == kNothing) tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); else tmpStr += '.'; @@ -1289,7 +1289,7 @@ void Parser::putProc() { _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_avalot->_wearing == _thing) { + if (_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { @@ -1826,12 +1826,12 @@ void Parser::doThat() { } break; case kVerbCodeUndress: - if (_vm->_avalot->_wearing == kNothing) + if (_wearing == kNothing) _vm->_dialogs->displayText("You're already stark naked!"); else if (_vm->_avalot->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_vm->_avalot->_wearing).c_str()); + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_wearing).c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_wearing = kNothing; + _wearing = kNothing; _vm->_avalot->refreshObjectList(); } else _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); @@ -1845,14 +1845,14 @@ void Parser::doThat() { break; case Avalot::kObjectClothes: case Avalot::kObjectHabit: { // Change this! - if (_vm->_avalot->_wearing != kNothing) { - if (_vm->_avalot->_wearing == _thing) + if (_wearing != kNothing) { + if (_wearing == _thing) _vm->_dialogs->displayText("You're already wearing that."); else _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_avalot->_wearing = _thing; + _wearing = _thing; _vm->_avalot->refreshObjectList(); @@ -2013,7 +2013,7 @@ void Parser::doThat() { _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: - switch (_vm->_avalot->_sworeNum) { + switch (_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); @@ -2034,7 +2034,7 @@ void Parser::doThat() { _vm->_avalot->gameOver(); } } - _vm->_avalot->_sworeNum++; + _sworeNum++; break; case kVerbCodeListen: if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 1084c01a90ca..d117e56bddfc 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -32,7 +32,6 @@ #include "common/scummsys.h" #include "common/str.h" - namespace Avalanche { class AvalancheEngine; @@ -79,6 +78,9 @@ class Parser { byte _leftMargin; bool _cursorState; + byte _wearing; // what you're wearing + byte _sworeNum; // number of times you've sworn + Parser(AvalancheEngine *vm); void init(); From 9450faf15087d9c9074dea39d1483ccca68d6986 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Sep 2013 23:36:30 +0200 Subject: [PATCH 1085/1332] AVALANCHE: Implement Clock::chime(). --- engines/avalanche/avalot.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c5d942dc0d2e..4390985f13ef 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -233,7 +233,21 @@ void Clock::plotHands() { } void Clock::chime() { - warning("STUB: Clock::chime()"); + if ((_oldHour == 17717) || (!_vm->_avalot->_soundFx)) // Too high - must be first time around + return; + + byte hour = _hour % 12; + if (hour == 0) + hour = 12; + + _vm->_avalot->setMousePointerWait(); + + for (int i = 1; i <= hour; i++) { + for (int j = 1; j <= 3; j++) + _vm->_sound->playNote((i % 3) * 64 + 140 - j * 30, 50 - j * 12); + if (i != hour) + _vm->_system->delayMillis(100); + } } From 2ffcd492be4b596575f1fde10e0e8696ff3c0811 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 22 Sep 2013 00:06:52 +0200 Subject: [PATCH 1086/1332] AVALANCHE: Implement Avalot::zoomOut(). --- engines/avalanche/avalot.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4390985f13ef..3979707a5bf2 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -641,7 +641,25 @@ void Avalot::loadRoom(byte num) { } void Avalot::zoomOut(int16 x, int16 y) { - warning("STUB: Avalot::zoomout()"); + //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! + + ::Graphics::Surface backup; + backup.copyFrom(_vm->_graphics->_surface); + + for (byte i = 1; i <= 20; i ++) { + int16 x1 = x - (x / 20) * i; + int16 y1 = y - ((y - 10) / 20) * i; + int16 x2 = x + (((639 - x) / 20) * i); + int16 y2 = y + (((161 - y) / 20) * i); + + _vm->_graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); + _vm->_graphics->refreshScreen(); + _vm->_system->delayMillis(17); + _vm->_graphics->_surface.copyFrom(backup); + _vm->_graphics->refreshScreen(); + } + + backup.free(); } void Avalot::findPeople(byte room) { From 03f6a56e20f225b638dce00d99861379d568cb65 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 22 Sep 2013 00:19:20 +0200 Subject: [PATCH 1087/1332] AVALANCHE: Remove comment, replace character. --- engines/avalanche/parser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 72336280aee4..d24a37d2a72c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1631,7 +1631,7 @@ void Parser::doThat() { openDoor(); break; case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the \"O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the `O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); _vm->_dialogs->displayText(tmpStr); } break; @@ -2028,7 +2028,6 @@ void Parser::doThat() { break; default: { _vm->_pingo->zonk(); - // CHECKME: Weird character in string Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); _vm->_dialogs->displayText(tmpStr); _vm->_avalot->gameOver(); From 302e74cac1fe18404d59d84135fa6debfec239cb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 22 Sep 2013 17:44:46 +0200 Subject: [PATCH 1088/1332] AVALANCHE: Fix GCC warning --- engines/avalanche/sequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 8ca3844bc9e0..53e43b5abe6f 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -44,7 +44,7 @@ Sequence::Sequence(AvalancheEngine *vm) { void Sequence::firstShow(byte what) { _seq[0] = what; - for (uint i = 1; i < kSeqLength; i++) + for (int i = 1; i < kSeqLength; i++) _seq[i] = 0; } From 863709ca576652767af00e9dcb84dfaab11e1a9e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 22 Sep 2013 17:45:48 +0200 Subject: [PATCH 1089/1332] AVALANCHE: Move some variables --- engines/avalanche/avalanche.cpp | 10 +++++----- engines/avalanche/avalanche.h | 5 +++-- engines/avalanche/avalot.cpp | 8 ++++---- engines/avalanche/avalot.h | 4 ---- engines/avalanche/parser.cpp | 16 ++++++++-------- engines/avalanche/parser.h | 3 +++ 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 282c629ba104..110cef74e516 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,11 +123,11 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_parser->_wearing); sz.syncAsByte(_parser->_sworeNum); if (sz.isSaving()) - _avalot->_saveNum++; - sz.syncAsByte(_avalot->_saveNum); + _saveNum++; + sz.syncAsByte(_saveNum); sz.syncBytes(_avalot->_roomCount, 100); - sz.syncAsByte(_avalot->_alcoholLevel); - sz.syncAsByte(_avalot->_playedNim); + sz.syncAsByte(_parser->_alcoholLevel); + sz.syncAsByte(_parser->_playedNim); sz.syncAsByte(_avalot->_wonNim); sz.syncAsByte(_avalot->_wineState); sz.syncAsByte(_avalot->_cwytalotGone); @@ -135,7 +135,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_aylesIsAwake); sz.syncAsByte(_avalot->_drawbridgeOpen); sz.syncAsByte(_avalot->_avariciusTalk); - sz.syncAsByte(_avalot->_boughtOnion); + sz.syncAsByte(_parser->_boughtOnion); sz.syncAsByte(_avalot->_rottenOnion); sz.syncAsByte(_avalot->_onionInVinegar); sz.syncAsByte(_avalot->_givenToSpludwick); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 289cf60d30ba..27a5bd63210a 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -61,10 +61,11 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: - Graphics *_graphics; - Parser *_parser; + byte _saveNum; // number of times this game has been saved Avalot *_avalot; + Graphics *_graphics; + Parser *_parser; Pingo *_pingo; Dialogs *_dialogs; Background *_background; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3979707a5bf2..86bd7fef1bec 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1594,12 +1594,12 @@ void Avalot::resetVariables() { _room = kRoomNowhere; _vm->_parser->_wearing = 0; _vm->_parser->_sworeNum = 0; - _saveNum = 0; + _vm->_saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; - _alcoholLevel = 0; - _playedNim = 0; + _vm->_parser->_alcoholLevel = 0; + _vm->_parser->_playedNim = 0; _wonNim = false; _wineState = 0; _cwytalotGone = false; @@ -1607,7 +1607,7 @@ void Avalot::resetVariables() { _aylesIsAwake = false; _drawbridgeOpen = 0; _avariciusTalk = 0; - _boughtOnion = false; + _vm->_parser->_boughtOnion = false; _rottenOnion = false; _onionInVinegar = false; _givenToSpludwick = 0; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index cc503749eb82..efd04ff35a7b 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -247,10 +247,7 @@ class Avalot { int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh byte _room; // your current room - byte _saveNum; // number of times this game has been saved byte _roomCount[100]; // Add one to each every time you enter a room - byte _alcoholLevel; // Your blood alcohol level. - byte _playedNim; // How many times you've played Nim. bool _wonNim; // Have you *won* Nim? (That's harder.) byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? @@ -258,7 +255,6 @@ class Avalot { bool _aylesIsAwake; // pretty obvious! byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). byte _avariciusTalk; // How much Avaricius has said to you. - bool _boughtOnion; // Have you bought an onion yet? bool _rottenOnion; // And has it rotted? bool _onionInVinegar; // Is the onion in the vinegar? byte _givenToSpludwick; // 0 = nothing given, 1 = onion... diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d24a37d2a72c..67f4243c18aa 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1382,8 +1382,8 @@ bool Parser::giveToSpludwick() { } void Parser::drink() { - _vm->_avalot->_alcoholLevel += 1; - if (_vm->_avalot->_alcoholLevel == 5) { + _alcoholLevel += 1; + if (_alcoholLevel == 5) { _vm->_avalot->_objects[Avalot::kObjectKey - 1] = true; // Get the key. _vm->_avalot->_teetotal = true; _vm->_avalot->_avvyIsAwake = false; @@ -1897,7 +1897,7 @@ void Parser::doThat() { } _vm->_dialogs->displayScrollChain('Q', 3); - _vm->_avalot->_playedNim++; + _playedNim++; // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! @@ -1907,7 +1907,7 @@ void Parser::doThat() { _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. _vm->_avalot->incScore(7); // 7 points for winning! - if (_vm->_avalot->_playedNim == 1) + if (_playedNim == 1) _vm->_avalot->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! @@ -2062,7 +2062,7 @@ void Parser::doThat() { return; } - if (_vm->_avalot->_alcoholLevel == 0) + if (_alcoholLevel == 0) _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 11); @@ -2093,7 +2093,7 @@ void Parser::doThat() { _vm->_background->drawBackgroundSprite(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - if (_vm->_avalot->_alcoholLevel == 0) + if (_alcoholLevel == 0) _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 9); _vm->_avalot->_malagauche = 177; @@ -2114,7 +2114,7 @@ void Parser::doThat() { else if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { - if (_vm->_avalot->_boughtOnion) + if (_boughtOnion) _vm->_dialogs->displayScrollChain('D', 11); else { _vm->_dialogs->displayScrollChain('D', 9); @@ -2123,7 +2123,7 @@ void Parser::doThat() { _vm->_avalot->decreaseMoney(3); // It costs thruppence. _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = true; _vm->_avalot->refreshObjectList(); - _vm->_avalot->_boughtOnion = true; + _boughtOnion = true; _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! _vm->_avalot->_onionInVinegar = false; } diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index d117e56bddfc..13734136a53a 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -80,6 +80,9 @@ class Parser { byte _wearing; // what you're wearing byte _sworeNum; // number of times you've sworn + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _boughtOnion; // Have you bought an onion yet? Parser(AvalancheEngine *vm); From 061c06c1286ba20b58412e494cf39a40eabb35b6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 22 Sep 2013 20:20:51 +0200 Subject: [PATCH 1090/1332] AVALANCHE: (hopefully) fix a GCC warning --- engines/avalanche/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 67f4243c18aa..1bfbe93f3a7f 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -549,7 +549,7 @@ Common::String Parser::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds. + h = (uint16)floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; h /= 3600; s = m % 60; From 48979c557bc580efa3fc02021fbae955a3ce4f09 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 14:41:56 -0500 Subject: [PATCH 1091/1332] ZVISION: Remove animation.o since animation.cpp is now gone --- engines/zvision/module.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 2f2929db676e..6a6eedc4d5e4 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -2,7 +2,6 @@ MODULE := engines/zvision MODULE_OBJS := \ actions.o \ - animation.o \ animation_control.o \ clock.o \ console.o \ From 9a5305a977b3b4c72c73196c4f67cee4d767fbbe Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 14:55:32 -0500 Subject: [PATCH 1092/1332] ZVISION: Add vertical pipes to prevent multi-line comments --- engines/zvision/lever_control.cpp | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 93a6054850d5..7f0cd401b241 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -323,27 +323,27 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm // Origin => (pointOne.x, pointOne.y) // * => (pointTwo.x, pointTwo.y) // - // 90 - // ^ - // * | * - // \ | / - // \ | / - // \ | / - // Quadrant 1 \ | / Quadrant 0 - // \ | / - // \ | / - // angle ( \|/ ) -angle - // 180 <----------------------------------------> 0 - // -angle ( /|\ ) angle - // / | \ - // / | \ - // Quadrant 3 / | \ Quadrant 2 - // / | \ - // / | \ - // / | \ - // * | * - // ^ - // 270 + // 90 | + // ^ | + // * | * | + // \ | / | + // \ | / | + // \ | / | + // Quadrant 1 \ | / Quadrant 0 | + // \ | / | + // \ | / | + // angle ( \|/ ) -angle | + // 180 <----------------------------------------> 0 | + // -angle ( /|\ ) angle | + // / | \ | + // / | \ | + // Quadrant 3 / | \ Quadrant 2 | + // / | \ | + // / | \ | + // / | \ | + // * | * | + // ^ | + // 270 | // Convert the local angles to unit circle angles switch (quadrant) { From 79573d0331b108162149f00f47b208376be2b8a5 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:02:58 -0500 Subject: [PATCH 1093/1332] ZVISION: Fix shadowing in the Direction constructor --- engines/zvision/lever_control.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index b5677a269ec4..80fda4f5fde8 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -48,7 +48,7 @@ class LeverControl : public Control { }; struct Direction { - Direction(uint angle, uint toFrame) : angle(angle), toFrame(toFrame) {} + Direction(uint a, uint t) : angle(a), toFrame(t) {} uint angle; uint toFrame; From 9fefed67f420b2097d43592850947144b2630b3d Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:11:38 -0500 Subject: [PATCH 1094/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/render_table.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 5eb208eb8c94..dc5ebdb7919b 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -103,10 +103,10 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect) { uint32 destOffset = 0; - for (uint32 y = subRect.top; y < subRect.bottom; y++) { + for (int16 y = subRect.top; y < subRect.bottom; y++) { uint32 sourceOffset = y * _numColumns; - for (uint32 x = subRect.left; x < subRect.right; x++) { + for (int16 x = subRect.left; x < subRect.right; x++) { uint32 normalizedX = x - subRect.left; uint32 index = sourceOffset + x; From 61eb94e5c8a7502563d5720a9db71ba1646b49bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 22 Sep 2013 22:47:12 +0200 Subject: [PATCH 1095/1332] AVALANCHE: Use struct for consistency in Avalot --- engines/avalanche/avalot.cpp | 1 - engines/avalanche/avalot.h | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 86bd7fef1bec..8feec3f03e3b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -137,7 +137,6 @@ const QuasipedType Avalot::kQuasipeds[16] = { }; const uint16 Avalot::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; - const TuneType Avalot::kTune = { kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index efd04ff35a7b..29433ee83105 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -101,8 +101,7 @@ struct MagicType { uint16 _data; // data for them }; -class FieldType { -public: +struct FieldType { int16 _x1, _y1, _x2, _y2; }; @@ -110,8 +109,7 @@ struct ByteField { byte _x1, _y1, _x2, _y2; }; -class LineType : public FieldType { -public: +struct LineType : public FieldType { byte _color; }; From 713baa37695104e2aa23c4e821b2aeb5ce41a576 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:47:16 -0500 Subject: [PATCH 1096/1332] ZVISION: Fix memory leak in SaveManager --- engines/zvision/save_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index dbed109d51f6..631885e5ae61 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -80,6 +80,7 @@ void SaveManager::saveGame(uint slot, const Common::String &saveName) { // Cleanup delete[] buffer; file->finalize(); + delete file; } void SaveManager::autoSave() { @@ -96,7 +97,9 @@ void SaveManager::autoSave() { writeSaveGameData(file); + // Cleanup file->finalize(); + delete file; } void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { From dd0a6fe0e3258ca1e71051705b5603fd8d9ca3fd Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:52:24 -0500 Subject: [PATCH 1097/1332] ZVISION: Convert hardcoded number to an anonymous enum --- engines/zvision/string_manager.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index e3539a732c0d..b67573b3a327 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -60,10 +60,13 @@ class StringManager { Common::List fragments; }; + enum { + NUM_TEXT_LINES = 56 // Max number of lines in a .str file. We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56 + }; + private: ZVision *_engine; - // NOTE: We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56 - InGameText _inGameText[56]; + InGameText _inGameText[NUM_TEXT_LINES]; Common::HashMap _fonts; static const Graphics::PixelFormat _pixelFormat565; From 9d1b0e1f8bf991abb8eb0cd484ce5025757e1efe Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:52:56 -0500 Subject: [PATCH 1098/1332] ZVISION: Assert that we don't exceed our hardcoded number of lines --- engines/zvision/string_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 8c7e0aaa3df7..d00ea2136940 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -111,6 +111,7 @@ void StringManager::parseStrFile(const Common::String &fileName) { } lineNumber++; + assert(lineNumber <= NUM_TEXT_LINES); } } From 701250efb57ef94e35d2b7b6f0d6d045b713e6f5 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:53:15 -0500 Subject: [PATCH 1099/1332] GRAPHICS: Remove variable shadowing --- graphics/surface.cpp | 6 +++--- graphics/surface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index a8173f0e9c09..777c1058fb13 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -133,7 +133,7 @@ const Surface Surface::getSubArea(const Common::Rect &area) const { return subSurface; } -void Surface::copyRectToSurface(const void *buffer, int pitch, int destX, int destY, int width, int height) { +void Surface::copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height) { assert(buffer); assert(destX >= 0 && destX < w); @@ -146,8 +146,8 @@ void Surface::copyRectToSurface(const void *buffer, int pitch, int destX, int de byte *dst = (byte *)getBasePtr(destX, destY); for (int i = 0; i < height; i++) { memcpy(dst, src, width * format.bytesPerPixel); - src += pitch; - dst += this->pitch; + src += srcPitch; + dst += pitch; } } diff --git a/graphics/surface.h b/graphics/surface.h index 1492e71e68ea..07e289b0bb37 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -219,7 +219,7 @@ struct Surface { * @param width The width of the destination rectangle * @param height The height of the destination rectangle */ - void copyRectToSurface(const void *buffer, int pitch, int destX, int destY, int width, int height); + void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height); /** * Copies a bitmap to the Surface internal buffer. The pixel format * of buffer must match the pixel format of the Surface. From a7ffd9ade641a2fd63ea8b04822942bda16a8f4c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 15:55:22 -0500 Subject: [PATCH 1100/1332] ZVISION: Cleanup all AlphaEntries after use --- engines/zvision/render_manager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index dc942fe3d070..d0356abba443 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -57,6 +57,10 @@ RenderManager::~RenderManager() { _workingWindowBuffer.free(); _currentBackground.free(); _backBuffer.free(); + + for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + delete (*iter)._value.data; + } } void RenderManager::update(uint deltaTimeInMillis) { From 02caaa573539bcd0760a47ecfd3c24c813568cc0 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 22 Sep 2013 23:36:25 +0200 Subject: [PATCH 1101/1332] AVALANCHE: Optimize Animation::updateSpeed(). --- engines/avalanche/animation.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 70f007ae4d8a..18164c767328 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -933,15 +933,13 @@ void Animation::updateSpeed() { _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - if (_sprites[0]._speedX == _vm->_avalot->kRun) - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); - else - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - - if (_sprites[0]._speedX == _vm->_avalot->kRun) + if (_sprites[0]._speedX == _vm->_avalot->kRun) { _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); - else + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); + } else { _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); + } } void Animation::changeDirection(byte t, byte dir) { From fdd477df616f307bc599c2274d312ae1b62703a2 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 17:50:39 -0500 Subject: [PATCH 1102/1332] ZVISION: Free AlphaDataEntry Surfaces before deleting them --- engines/zvision/render_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index d0356abba443..b3561fffaf19 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -59,6 +59,7 @@ RenderManager::~RenderManager() { _backBuffer.free(); for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + (*iter)._value.data->free(); delete (*iter)._value.data; } } From dfba1a01446a32245944a86ee08a843587050753 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 17:56:41 -0500 Subject: [PATCH 1103/1332] ZVISION: Don't cast away const-ness --- engines/zvision/render_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b3561fffaf19..55a24c9c86c7 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -506,7 +506,7 @@ Graphics::Surface *RenderManager::tranposeSurface(const Graphics::Surface *surfa Graphics::Surface *tranposedSurface = new Graphics::Surface(); tranposedSurface->create(surface->h, surface->w, surface->format); - uint16 *source = (uint16 *)surface->getPixels(); + const uint16 *source = (const uint16 *)surface->getPixels(); uint16 *dest = (uint16 *)tranposedSurface->getPixels(); for (uint32 y = 0; y < tranposedSurface->h; y++) { From cbe9c151aa305e929527a1dd81d34e7c818ae128 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 Sep 2013 23:16:57 +0200 Subject: [PATCH 1104/1332] AVALANCHE: Refactor some variables. This breaks savegame compatibility --- engines/avalanche/animation.cpp | 79 +++++++++++++++++++++------------ engines/avalanche/animation.h | 34 ++++++++------ engines/avalanche/avalanche.cpp | 8 ++-- engines/avalanche/avalot.cpp | 63 +++++++++++++------------- engines/avalanche/avalot.h | 4 +- engines/avalanche/parser.cpp | 9 +++- engines/avalanche/parser.h | 4 ++ engines/avalanche/timer.cpp | 6 +-- 8 files changed, 123 insertions(+), 84 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 18164c767328..7ddc58945f70 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -137,14 +137,14 @@ void AnimationType::draw() { _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } -void AnimationType::turn(byte whichway) { +void AnimationType::turn(Direction whichway) { if (whichway == 8) - _facingDir = Animation::kDirUp; + _facingDir = kDirUp; else _facingDir = whichway; } -void AnimationType::appear(int16 wx, int16 wy, byte wf) { +void AnimationType::appear(int16 wx, int16 wy, Direction wf) { _x = (wx / 8) * 8; _y = wy; _oldX[_anim->_vm->_avalot->_cp] = wx; @@ -309,14 +309,14 @@ void AnimationType::setSpeed(int8 xx, int8 yy) { if (_moveX == 0) { // No horz movement if (_moveY < 0) - turn(Animation::kDirUp); + turn(kDirUp); else - turn(Animation::kDirDown); + turn(kDirDown); } else { if (_moveX < 0) - turn(Animation::kDirLeft); + turn(kDirLeft); else - turn(Animation::kDirRight); + turn(kDirRight); } } @@ -942,7 +942,7 @@ void Animation::updateSpeed() { } } -void Animation::changeDirection(byte t, byte dir) { +void Animation::setMoveSpeed(byte t, Direction dir) { switch (dir) { case kDirUp: _sprites[t].setSpeed(0, -_sprites[t]._speedY); @@ -975,7 +975,7 @@ void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = &_sprites[sprNum]; PedType *curPed = &_vm->_avalot->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); - changeDirection(sprNum, curPed->_direction); + setMoveSpeed(sprNum, curPed->_direction); } void Animation::followAvalotY(byte tripnum) { @@ -1078,19 +1078,20 @@ void Animation::takeAStep(byte &tripnum) { } } -void Animation::spin(byte whichway, byte &tripnum) { - if (_sprites[tripnum]._facingDir != whichway) { - _sprites[tripnum]._facingDir = whichway; - if (_sprites[tripnum]._id == 2) - return; // Not for Spludwick +void Animation::spin(Direction dir, byte &tripnum) { + if (_sprites[tripnum]._facingDir == dir) + return; - _vm->_avalot->_geidaSpin += 1; - _vm->_avalot->_geidaTime = 20; - if (_vm->_avalot->_geidaSpin == 5) { - _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_avalot->_geidaSpin = 0; - _vm->_avalot->_geidaTime = 0; // knock out records - } + _sprites[tripnum]._facingDir = dir; + if (_sprites[tripnum]._id == 2) + return; // Not for Spludwick + + _vm->_avalot->_geidaSpin += 1; + _vm->_avalot->_geidaTime = 20; + if (_vm->_avalot->_geidaSpin == 5) { + _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_avalot->_geidaSpin = 0; + _vm->_avalot->_geidaTime = 0; // knock out records } } @@ -1330,56 +1331,56 @@ void Animation::handleMoveKey(const Common::Event &event) { case Common::KEYCODE_UP: if (_direction != kDirUp) { _direction = kDirUp; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_DOWN: if (_direction != kDirDown) { _direction = kDirDown; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_LEFT: if (_direction != kDirLeft) { _direction = kDirLeft; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_RIGHT: if (_direction != kDirRight) { _direction = kDirRight; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_PAGEUP: if (_direction != kDirUpRight) { _direction = kDirUpRight; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_PAGEDOWN: if (_direction != kDirDownRight) { _direction = kDirDownRight; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_END: if (_direction != kDirDownLeft) { _direction = kDirDownLeft; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; case Common::KEYCODE_HOME: if (_direction != kDirUpLeft) { _direction = kDirUpLeft; - changeDirection(0, _direction); + setMoveSpeed(0, _direction); } else stopWalking(); break; @@ -1392,4 +1393,24 @@ void Animation::handleMoveKey(const Common::Event &event) { } } +void Animation::setDirection(Direction dir) { + _direction = dir; +} + +void Animation::setOldDirection(Direction dir) { + _oldDirection = dir; +} + +Direction Animation::getDirection() { + return _direction; +} + +Direction Animation::getOldDirection() { + return _oldDirection; +} + +void Animation::synchronize(Common::Serializer &sz) { + sz.syncAsByte(_direction); +} + } // End of namespace Avalanche. diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 1f13fd140763..a411de7c20cd 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -39,6 +39,12 @@ namespace Avalanche { class AvalancheEngine; class Animation; +enum Direction { + kDirUp = 0, kDirRight, kDirDown, kDirLeft, + kDirUpRight, kDirDownRight, kDirDownLeft, kDirUpLeft, + kDirStopped, kDirNone = 177 +}; + struct StatType { Common::String _name; // Name of character. Common::String _comment; // Comment. @@ -52,7 +58,8 @@ class AnimationType { public: SpriteInfo _info; StatType _stat; // Vital statistics. - byte _facingDir, _stepNum; + Direction _facingDir; + byte _stepNum; int16 _x, _y; // Current xy coords. int16 _oldX[2], _oldY[2]; // Last xy coords. int8 _moveX, _moveY; // Amount to move sprite by, each step. @@ -69,8 +76,8 @@ class AnimationType { void init(byte spritenum, bool doCheck, Animation *anim); // Loads & sets up the sprite. void original(); // Just sets 'quick' to false. void draw(); // Drops sprite onto screen. Original: andexor(). - void turn(byte whichway); // Turns character round. - void appear(int16 wx, int16 wy, byte wf); // Switches it on. + void turn(Direction whichway); // Turns character round. + void appear(int16 wx, int16 wy, Direction wf); // Switches it on. void bounce(); // Bounces off walls. void walk(); // Prepares for andexor, etc. void walkTo(byte pednum); // Home in on a point. @@ -92,12 +99,6 @@ class Animation { public: friend class AnimationType; - enum Direction { - kDirUp, kDirRight, kDirDown, kDirLeft, - kDirUpRight, kDirDownRight, kDirDownLeft, kDirUpLeft, - kDirStopped - }; - static const byte kSpriteNumbMax = 5; // current max no. of sprites enum Proc { @@ -113,8 +114,6 @@ class Animation { AnimationType _sprites[kSpriteNumbMax]; bool _mustExclaim; uint16 _sayWhat; - byte _direction; // The direction Avvy is currently facing. - byte _oldDirection; Animation(AvalancheEngine *vm); ~Animation(); @@ -125,7 +124,7 @@ class Animation { void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. void stopWalking(); - void changeDirection(byte t, byte dir); + void setMoveSpeed(byte t, Direction dir); void appearPed(byte sprNum, byte pedNum); void flipRoom(byte room, byte ped); bool inField(byte which); // Returns true if you're within field "which". @@ -133,7 +132,16 @@ class Animation { void updateSpeed(); void handleMoveKey(const Common::Event &event); // To replace tripkey(). + void setDirection(Direction dir); + void setOldDirection(Direction dir); + Direction getDirection(); + Direction getOldDirection(); + + void synchronize(Common::Serializer &sz); private: + Direction _direction; // The direction Avvy is currently facing. + Direction _oldDirection; + AvalancheEngine *_vm; byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); @@ -150,7 +158,7 @@ class Animation { void faceAvvy(byte tripnum); // Movements for Homing NPCs: Spludwick and Geida. - void spin(byte whichway, byte &tripnum); + void spin(Direction dir, byte &tripnum); void takeAStep(byte &tripnum); void geidaProcs(byte tripnum); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 110cef74e516..b8f06bf134dc 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -113,15 +113,15 @@ const char *AvalancheEngine::getCopyrightString() const { } void AvalancheEngine::synchronize(Common::Serializer &sz) { - sz.syncAsByte(_animation->_direction); + _animation->synchronize(sz); + _parser->synchronize(sz); + sz.syncAsByte(_avalot->_carryNum); for (int i = 0; i < kObjectNum; i++) sz.syncAsByte(_avalot->_objects[i]); sz.syncAsSint16LE(_avalot->_dnascore); sz.syncAsSint32LE(_avalot->_money); sz.syncAsByte(_avalot->_room); - sz.syncAsByte(_parser->_wearing); - sz.syncAsByte(_parser->_sworeNum); if (sz.isSaving()) _saveNum++; sz.syncAsByte(_saveNum); @@ -439,7 +439,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { AnimationType *avvy = &_animation->_sprites[0]; if (avvy->_quick && avvy->_visible) - _animation->changeDirection(0, _animation->_direction); // We push Avvy in the right direction is he was moving. + _animation->setMoveSpeed(0, _animation->getDirection()); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 8feec3f03e3b..b1c2edd10b8b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -357,7 +357,7 @@ void Avalot::setup() { drawToolbar(); _vm->_dialogs->setReadyLight(2); - _vm->_animation->_direction = Animation::kDirStopped; + _vm->_animation->setDirection(kDirStopped); _vm->_animation->loadAnims(); dawn(); @@ -565,7 +565,7 @@ void Avalot::loadAlso(byte num) { PedType *curPed = &_peds[i]; curPed->_x = file.readSint16LE(); curPed->_y = file.readSint16LE(); - curPed->_direction = file.readByte(); + curPed->_direction = (Direction)file.readByte(); } _fieldNum = file.readByte(); @@ -792,7 +792,7 @@ void Avalot::enterRoom(byte room, byte ped) { spr1->walkTo(4); // Walks up to greet you. } else { _vm->_animation->appearPed(1, 4); // Starts where he was before. - spr1->_facingDir = Animation::kDirLeft; + spr1->_facingDir = kDirLeft; } spr1->_callEachStepFl = true; @@ -852,7 +852,7 @@ void Avalot::enterRoom(byte room, byte ped) { } else { // You've been here before. _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... - spr1->_facingDir = Animation::kDirLeft; + spr1->_facingDir = kDirLeft; } } break; @@ -919,7 +919,7 @@ void Avalot::enterRoom(byte room, byte ped) { default: // You've answered SOME of his questions. spr1->init(9, false, _vm->_animation); _vm->_animation->appearPed(1, 2); - spr1->_facingDir = Animation::kDirRight; + spr1->_facingDir = kDirRight; _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } } @@ -1047,7 +1047,7 @@ void Avalot::enterRoom(byte room, byte ped) { spr1->walkTo(3); // Walks up to greet you. } else { _vm->_animation->appearPed(1, 3); // Starts where she was before. - spr1->_facingDir = Animation::kDirLeft; + spr1->_facingDir = kDirLeft; } spr1->_callEachStepFl = true; @@ -1230,7 +1230,7 @@ void Avalot::drawToolbar() { file.close(); CursorMan.showMouse(true); - _vm->_animation->_oldDirection = 177; + _vm->_animation->setOldDirection(kDirNone); drawDirection(); } @@ -1279,23 +1279,23 @@ void Avalot::useCompass(const Common::Point &cursorPos) { switch (color) { case kColorGreen: - _vm->_animation->_direction = Animation::kDirUp; - _vm->_animation->changeDirection(0, Animation::kDirUp); + _vm->_animation->setDirection(kDirUp); + _vm->_animation->setMoveSpeed(0, kDirUp); drawDirection(); break; case kColorBrown: - _vm->_animation->_direction = Animation::kDirDown; - _vm->_animation->changeDirection(0, Animation::kDirDown); + _vm->_animation->setDirection(kDirDown); + _vm->_animation->setMoveSpeed(0, kDirDown); drawDirection(); break; case kColorCyan: - _vm->_animation->_direction = Animation::kDirLeft; - _vm->_animation->changeDirection(0, Animation::kDirLeft); + _vm->_animation->setDirection(kDirLeft); + _vm->_animation->setMoveSpeed(0, kDirLeft); drawDirection(); break; case kColorLightmagenta: - _vm->_animation->_direction = Animation::kDirRight; - _vm->_animation->changeDirection(0, Animation::kDirRight); + _vm->_animation->setDirection(kDirRight); + _vm->_animation->setMoveSpeed(0, kDirRight); drawDirection(); break; case kColorRed: @@ -1354,28 +1354,28 @@ void Avalot::guideAvvy(Common::Point cursorPos) { _vm->_animation->stopWalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_animation->changeDirection(0, Animation::kDirLeft); + _vm->_animation->setMoveSpeed(0, kDirLeft); break; case 2: - _vm->_animation->changeDirection(0, Animation::kDirRight); + _vm->_animation->setMoveSpeed(0, kDirRight); break; case 3: - _vm->_animation->changeDirection(0, Animation::kDirUp); + _vm->_animation->setMoveSpeed(0, kDirUp); break; case 4: - _vm->_animation->changeDirection(0, Animation::kDirUpLeft); + _vm->_animation->setMoveSpeed(0, kDirUpLeft); break; case 5: - _vm->_animation->changeDirection(0, Animation::kDirUpRight); + _vm->_animation->setMoveSpeed(0, kDirUpRight); break; case 6: - _vm->_animation->changeDirection(0, Animation::kDirDown); + _vm->_animation->setMoveSpeed(0, kDirDown); break; case 7: - _vm->_animation->changeDirection(0, Animation::kDirDownLeft); + _vm->_animation->setMoveSpeed(0, kDirDownLeft); break; case 8: - _vm->_animation->changeDirection(0, Animation::kDirDownRight); + _vm->_animation->setMoveSpeed(0, kDirDownRight); break; } // No other values are possible. @@ -1480,13 +1480,13 @@ void Avalot::dawn() { } void Avalot::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_animation->_oldDirection == _vm->_animation->_direction) + if (_vm->_animation->getOldDirection() == _vm->_animation->getDirection()) return; - _vm->_animation->_oldDirection = _vm->_animation->_direction; + _vm->_animation->setOldDirection(_vm->_animation->getDirection()); CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->_direction], 0, 161); + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->getDirection()], 0, 161); CursorMan.showMouse(true); } @@ -1501,7 +1501,7 @@ void Avalot::gameOver() { avvy->remove(); avvy->init(12, true, _vm->_animation); // 12 = Avalot falls avvy->_stepNum = 0; - avvy->appear(sx, sy, 0); + avvy->appear(sx, sy, kDirUp); _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); _alive = false; @@ -1548,7 +1548,7 @@ void Avalot::spriteRun() { void Avalot::fixFlashers() { _ledStatus = 177; - _vm->_animation->_oldDirection = 177; + _vm->_animation->setOldDirection(kDirNone); _vm->_dialogs->setReadyLight(2); drawDirection(); } @@ -1582,8 +1582,7 @@ void Avalot::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Strin } void Avalot::resetVariables() { -// Replaces memset(&_dna, 0, sizeof(DnaType)); - _vm->_animation->_direction = 0; + _vm->_animation->setDirection(kDirUp); _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -1683,7 +1682,7 @@ void Avalot::newGame() { _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; _money = 30; // 2/6 - _vm->_animation->_direction = Animation::kDirStopped; + _vm->_animation->setDirection(kDirStopped); _vm->_parser->_wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; @@ -1696,7 +1695,7 @@ void Avalot::newGame() { _onToolbar = false; _seeScroll = false; - avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot. + avvy->appear(300, 117, kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = Parser::kPardon; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 29433ee83105..0179d898bb26 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -30,6 +30,8 @@ #ifndef AVALANCHE_AVALOT_H #define AVALANCHE_AVALOT_H +#include "avalanche/animation.h" + #include "common/events.h" #include "common/system.h" #include "common/str.h" @@ -93,7 +95,7 @@ struct MouseHotspotType { // mouse-void struct PedType { int16 _x, _y; - byte _direction; + Direction _direction; }; struct MagicType { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 1bfbe93f3a7f..c54b48205202 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1426,7 +1426,7 @@ void Parser::standUp() { _vm->_animation->_sprites[0]._visible = true; _vm->_avalot->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); - _vm->_animation->_direction = Animation::kDirLeft; + _vm->_animation->setDirection(kDirLeft); _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. _vm->_avalot->incScore(1); _vm->_avalot->_avvyInBed = false; @@ -1867,7 +1867,7 @@ void Parser::doThat() { int16 y = spr->_y; spr->remove(); spr->init(i, true, _vm->_animation); - spr->appear(x, y, Animation::kDirLeft); + spr->appear(x, y, kDirLeft); spr->_visible = false; } } @@ -2362,4 +2362,9 @@ void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) { } } +void Parser::synchronize(Common::Serializer &sz) { + sz.syncAsByte(_wearing); + sz.syncAsByte(_sworeNum); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 13734136a53a..8f49a48e7451 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -31,6 +31,8 @@ #include "common/events.h" #include "common/scummsys.h" #include "common/str.h" +#include "common/serializer.h" + namespace Avalanche { class AvalancheEngine; @@ -102,6 +104,8 @@ class Parser { void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. int16 getPos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + void synchronize(Common::Serializer &sz); + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 081f7a314bf3..1fc69a278bfc 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -248,7 +248,7 @@ void Timer::avariciusTalks() { } void Timer::urinate() { - _vm->_animation->_sprites[0].turn(Animation::kDirUp); + _vm->_animation->_sprites[0].turn(kDirUp); _vm->_animation->stopWalking(); _vm->_avalot->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); @@ -558,7 +558,7 @@ void Timer::meetAvaroid() { addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->_facingDir = Animation::kDirLeft; + avvy->_facingDir = kDirLeft; avvy->_x = 151; avvy->_moveX = -3; avvy->_moveY = -5; @@ -586,7 +586,7 @@ void Timer::robinHoodAndGeida() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->stopWalk(); - spr->_facingDir = Animation::kDirLeft; + spr->_facingDir = kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); _vm->_avalot->_geidaFollows = false; } From f4e37939c7cb36041b610d8a8d42576959b94ed9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 24 Sep 2013 07:31:43 +0200 Subject: [PATCH 1105/1332] AVALANCHE: Move 2 enums out of Avalot classes, set private some parser variables --- engines/avalanche/animation.cpp | 6 +- engines/avalanche/avalanche.cpp | 5 +- engines/avalanche/avalot.cpp | 43 ++++---- engines/avalanche/avalot.h | 99 ++++++++--------- engines/avalanche/dialogs.cpp | 26 ++--- engines/avalanche/menu.cpp | 34 +++--- engines/avalanche/parser.cpp | 185 +++++++++++++++++--------------- engines/avalanche/parser.h | 9 +- engines/avalanche/timer.cpp | 12 +-- 9 files changed, 213 insertions(+), 206 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 7ddc58945f70..1172b1cc64ee 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -771,7 +771,7 @@ void Animation::callSpecial(uint16 which) { _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. + _vm->_avalot->_whereIs[kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; @@ -813,7 +813,7 @@ void Animation::callSpecial(uint16 which) { case 10: // _vm->_avalot->special 10: transfer north in catacombs. if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) { // Into Geida's room. - if (_vm->_avalot->_objects[Avalot::kObjectKey - 1]) + if (_vm->_avalot->_objects[kObjectKey - 1]) _vm->_dialogs->displayScrollChain('q', 62); else { _vm->_dialogs->displayScrollChain('q', 61); @@ -1229,7 +1229,7 @@ void Animation::stopWalking() { */ void Animation::hideInCupboard() { if (_vm->_avalot->_avvysInTheCupboard) { - if (_vm->_parser->_wearing == Parser::kNothing) { + if (_vm->_parser->_wearing == kObjectDummy) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b8f06bf134dc..b0db9648a8df 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -126,8 +126,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _saveNum++; sz.syncAsByte(_saveNum); sz.syncBytes(_avalot->_roomCount, 100); - sz.syncAsByte(_parser->_alcoholLevel); - sz.syncAsByte(_parser->_playedNim); sz.syncAsByte(_avalot->_wonNim); sz.syncAsByte(_avalot->_wineState); sz.syncAsByte(_avalot->_cwytalotGone); @@ -135,7 +133,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_aylesIsAwake); sz.syncAsByte(_avalot->_drawbridgeOpen); sz.syncAsByte(_avalot->_avariciusTalk); - sz.syncAsByte(_parser->_boughtOnion); sz.syncAsByte(_avalot->_rottenOnion); sz.syncAsByte(_avalot->_onionInVinegar); sz.syncAsByte(_avalot->_givenToSpludwick); @@ -422,7 +419,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _background->forgetBackgroundSprites(); _avalot->minorRedraw(); _menu->setup(); - _avalot->_whereIs[Avalot::kPeopleAvalot - 150] = _avalot->_room; + _avalot->_whereIs[kPeopleAvalot - 150] = _avalot->_room; _avalot->_alive = true; _avalot->refreshObjectList(); _animation->updateSpeed(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b1c2edd10b8b..afee7228d6d4 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -371,7 +371,7 @@ void Avalot::setup() { int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _thinks = 2; // You always have money. - thinkAbout(Avalot::kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, Avalot::kThing); _vm->loadGame(loadSlot); } else { @@ -380,7 +380,7 @@ void Avalot::setup() { _soundFx = !_soundFx; fxToggle(); - thinkAbout(Avalot::kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, Avalot::kThing); _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. } @@ -727,12 +727,12 @@ void Avalot::enterNewTown() { _spludwickAtHome = true; _crapulusWillTell = false; } - if (_boxContent == Avalot::kObjectWine) + if (_boxContent == kObjectWine) _wineState = 3; // Vinegar break; } - if ((_room != kRoomOutsideDucks) && (_objects[Avalot::kObjectOnion - 1]) && !(_onionInVinegar)) + if ((_room != kRoomOutsideDucks) && (_objects[kObjectOnion - 1]) && !(_onionInVinegar)) _rottenOnion = true; // You're holding the onion } @@ -760,10 +760,10 @@ void Avalot::enterRoom(byte room, byte ped) { if ((_roomCount[room] == 0) && (!setFlag('S'))) incScore(1); - _whereIs[Avalot::kPeopleAvalot - 150] = _room; + _whereIs[kPeopleAvalot - 150] = _room; if (_geidaFollows) - _whereIs[Avalot::kPeopleGeida - 150] = room; + _whereIs[kPeopleGeida - 150] = room; _roomTime = 0; @@ -784,7 +784,7 @@ void Avalot::enterRoom(byte room, byte ped) { if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; if (!_talkedToCrapulus) { - _whereIs[Avalot::kPeopleCrapulus - 150] = kRoomOutsideYours; + _whereIs[kPeopleCrapulus - 150] = kRoomOutsideYours; spr1->init(8, false, _vm->_animation); // load Crapulus if (_roomCount[kRoomOutsideYours] == 1) { @@ -799,7 +799,7 @@ void Avalot::enterRoom(byte room, byte ped) { spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. } else - _whereIs[Avalot::kPeopleCrapulus - 150] = kRoomNowhere; + _whereIs[kPeopleCrapulus - 150] = kRoomNowhere; if (_crapulusWillTell) { spr1->init(8, false, _vm->_animation); @@ -824,13 +824,13 @@ void Avalot::enterRoom(byte room, byte ped) { if (ped > 0) { spr1->init(2, false, _vm->_animation); // load Spludwick _vm->_animation->appearPed(1, 1); - _whereIs[Avalot::kPeopleSpludwick - 150] = kRoomSpludwicks; + _whereIs[kPeopleSpludwick - 150] = kRoomSpludwicks; } spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } else - _whereIs[Avalot::kPeopleSpludwick - 150] = kRoomNowhere; + _whereIs[kPeopleSpludwick - 150] = kRoomNowhere; break; case kRoomBrummieRoad: @@ -838,13 +838,13 @@ void Avalot::enterRoom(byte room, byte ped) { putGeidaAt(4, ped); if (_cwytalotGone) { _magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; - _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomNowhere; + _whereIs[kPeopleCwytalot - 150] = kRoomNowhere; } else if (ped > 0) { AnimationType *spr1 = &_vm->_animation->_sprites[1]; spr1->init(4, false, _vm->_animation); // 4 = Cwytalot spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcFollowAvvyY; - _whereIs[Avalot::kPeopleCwytalot - 150] = kRoomBrummieRoad; + _whereIs[kPeopleCwytalot - 150] = kRoomBrummieRoad; if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... @@ -891,8 +891,8 @@ void Avalot::enterRoom(byte room, byte ped) { } if (_beenTiedUp) { - _whereIs[Avalot::kPeopleRobinHood - 150] = 0; - _whereIs[Avalot::kPeopleFriarTuck - 150] = 0; + _whereIs[kPeopleRobinHood - 150] = 0; + _whereIs[kPeopleFriarTuck - 150] = 0; } if (_tiedUp) @@ -936,9 +936,9 @@ void Avalot::enterRoom(byte room, byte ped) { if (ped > 0) zoomOut(_peds[ped]._x, _peds[ped]._y); - if ((_objects[Avalot::kObjectWine - 1]) && (_wineState != 3)) { + if ((_objects[kObjectWine - 1]) && (_wineState != 3)) { _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! - _objects[Avalot::kObjectWine - 1] = false; + _objects[kObjectWine - 1] = false; refreshObjectList(); } @@ -1004,7 +1004,7 @@ void Avalot::enterRoom(byte room, byte ped) { _vm->_graphics->refreshBackground(); _vm->_background->drawBackgroundSprite(-1, -1, 3); _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; - _whereIs[Avalot::kPeopleJacques - 150] = 0; + _whereIs[kPeopleJacques - 150] = 0; } if (ped != 0) { _vm->_background->drawBackgroundSprite(-1, -1, 5); @@ -1315,7 +1315,7 @@ void Avalot::fxToggle() { void Avalot::refreshObjectList() { _carryNum = 0; if (_thinkThing && !_objects[_thinks - 1]) - thinkAbout(Avalot::kObjectMoney, Avalot::kThing); // you always have money + thinkAbout(kObjectMoney, Avalot::kThing); // you always have money for (int i = 0; i < kObjectNum; i++) { if (_objects[i]) { @@ -1590,14 +1590,10 @@ void Avalot::resetVariables() { _dnascore = 0; _money = 0; _room = kRoomNowhere; - _vm->_parser->_wearing = 0; - _vm->_parser->_sworeNum = 0; _vm->_saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; - _vm->_parser->_alcoholLevel = 0; - _vm->_parser->_playedNim = 0; _wonNim = false; _wineState = 0; _cwytalotGone = false; @@ -1605,7 +1601,6 @@ void Avalot::resetVariables() { _aylesIsAwake = false; _drawbridgeOpen = 0; _avariciusTalk = 0; - _vm->_parser->_boughtOnion = false; _rottenOnion = false; _onionInVinegar = false; _givenToSpludwick = 0; @@ -1661,6 +1656,8 @@ void Avalot::resetVariables() { _takenMushroom = false; _givenPenToAyles = false; _askedDogfoodAboutNim = false; + + _vm->_parser->resetVariables(); } void Avalot::newGame() { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 0179d898bb26..89f67b82fbd2 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -83,6 +83,56 @@ enum Room { kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room }; +// Objects you can hold: +enum Object { + kObjectWine = 1, + kObjectMoney, + kObjectBodkin, + kObjectPotion, + kObjectChastity, + kObjectBolt, + kObjectCrossbow, + kObjectLute, + kObjectBadge, + kObjectMushroom, + kObjectKey, + kObjectBell, + kObjectPrescription, + kObjectPen, + kObjectInk, + kObjectClothes, + kObjectHabit, + kObjectOnion, + kObjectDummy = 177 +}; + +// People who hang around this game. +enum People { + // Boys: + kPeopleAvalot = 150, + kPeopleSpludwick = 151, + kPeopleCrapulus = 152, + kPeopleDrDuck = 153, + kPeopleMalagauche = 154, + kPeopleFriarTuck = 155, + kPeopleRobinHood = 156, + kPeopleCwytalot = 157, + kPeopleDuLustie = 158, + kPeopleDuke = 159, + kPeopleDogfood = 160, + kPeopleTrader = 161, + kPeopleIbythneth = 162, + kPeopleAyles = 163, + kPeoplePort = 164, + kPeopleSpurge = 165, + kPeopleJacques = 166, + // Girls: + kPeopleArkata = 175, + kPeopleGeida = 176, + kPeopleInvisible = 177, + kPeopleWisewoman = 178 +}; + static const byte kObjectNum = 18; // always preface with a # static const int16 kCarryLimit = 12; // carry limit @@ -133,55 +183,6 @@ struct Sundry { // Things which must be saved over a backtobootstrap, outside DN class Avalot { public: - // Objects you can hold: - enum Object { - kObjectWine = 1, - kObjectMoney, - kObjectBodkin, - kObjectPotion, - kObjectChastity, - kObjectBolt, - kObjectCrossbow, - kObjectLute, - kObjectBadge, - kObjectMushroom, - kObjectKey, - kObjectBell, - kObjectPrescription, - kObjectPen, - kObjectInk, - kObjectClothes, - kObjectHabit, - kObjectOnion - }; - - // People who hang around this game. - enum People { - // Boys: - kPeopleAvalot = 150, - kPeopleSpludwick = 151, - kPeopleCrapulus = 152, - kPeopleDrDuck = 153, - kPeopleMalagauche = 154, - kPeopleFriarTuck = 155, - kPeopleRobinHood = 156, - kPeopleCwytalot = 157, - kPeopleDuLustie = 158, - kPeopleDuke = 159, - kPeopleDogfood = 160, - kPeopleTrader = 161, - kPeopleIbythneth = 162, - kPeopleAyles = 163, - kPeoplePort = 164, - kPeopleSpurge = 165, - kPeopleJacques = 166, - // Girls: - kPeopleArkata = 175, - kPeopleGeida = 176, - kPeopleInvisible = 177, - kPeopleWisewoman = 178 - }; - static const int16 kXW = 30; static const int16 kYW = 36; // x width & y whatsit static const int16 kMargin = 5; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 3004f621a437..37f8fc14ed99 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -961,10 +961,10 @@ void Dialogs::talkTo(byte whom) { if (_vm->_avalot->_subjectNum == 0) { switch (whom) { - case Avalot::kPeopleSpludwick: - if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[Avalot::kObjectPotion - 1])) { + case kPeopleSpludwick: + if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; + _vm->_avalot->_objects[kObjectPotion - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->incScore(3); return; @@ -988,20 +988,20 @@ void Dialogs::talkTo(byte whom) { return; } break; - case Avalot::kPeopleIbythneth: + case kPeopleIbythneth: if (_vm->_avalot->_givenBadgeToIby) { displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. - case Avalot::kPeopleDogfood: + case kPeopleDogfood: if (_vm->_avalot->_wonNim) { // We've won the game. displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else _vm->_avalot->_askedDogfoodAboutNim = true; break; - case Avalot::kPeopleAyles: + case kPeopleAyles: if (!_vm->_avalot->_aylesIsAwake) { displayScrollChain('q', 43); // He's fast asleep! return; @@ -1011,11 +1011,11 @@ void Dialogs::talkTo(byte whom) { } break; - case Avalot::kPeopleJacques: + case kPeopleJacques: displayScrollChain('q', 43); return; - case Avalot::kPeopleGeida: + case kPeopleGeida: if (_vm->_avalot->_givenPotionToGeida) _vm->_avalot->_geidaFollows = true; else { @@ -1023,7 +1023,7 @@ void Dialogs::talkTo(byte whom) { return; } break; - case Avalot::kPeopleSpurge: + case kPeopleSpurge: if (!_vm->_avalot->_sittingInPub) { displayScrollChain('q', 71); // Try going over and sitting down. return; @@ -1038,7 +1038,7 @@ void Dialogs::talkTo(byte whom) { break; } // On a subject. Is there any reason to block it? - } else if ((whom == Avalot::kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) { + } else if ((whom == kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -1066,12 +1066,12 @@ void Dialogs::talkTo(byte whom) { if (!_noError) displayScrollChain('n', whom); // File not found! - if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == Avalot::kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_avalot->_objects[Avalot::kObjectBadge - 1] = true; + if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_avalot->_objects[kObjectBadge - 1] = true; _vm->_avalot->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. _vm->_avalot->_talkedToCrapulus = true; - _vm->_avalot->_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. + _vm->_avalot->_whereIs[kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 0fb1f62ca593..fab349ebc464 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -263,25 +263,25 @@ Menu::Menu(AvalancheEngine *vm) { void Menu::findWhatYouCanDoWithIt() { switch (_vm->_avalot->_thinks) { - case Avalot::kObjectWine: - case Avalot::kObjectPotion: - case Avalot::kObjectInk: + case kObjectWine: + case kObjectPotion: + case kObjectInk: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; break; - case Avalot::kObjectBell: + case kObjectBell: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; break; - case Avalot::kObjectChastity: + case kObjectChastity: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; - case Avalot::kObjectLute: + case kObjectLute: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; break; - case Avalot::kObjectMushroom: - case Avalot::kObjectOnion: + case kObjectMushroom: + case kObjectOnion: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; break; - case Avalot::kObjectClothes: + case kObjectClothes: _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; break; default: @@ -487,7 +487,7 @@ void Menu::setupMenuWith() { // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_avalot->_lastPerson == Avalot::kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) + if ((_vm->_avalot->_lastPerson == kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) || (_vm->_avalot->_whereIs[_vm->_avalot->_lastPerson - 150] != _vm->_avalot->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { @@ -499,18 +499,18 @@ void Menu::setupMenuWith() { _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; switch (_vm->_avalot->_thinks) { - case Avalot::kPeopleGeida: - case Avalot::kPeopleArkata: + case kPeopleGeida: + case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss; break; - case Avalot::kPeopleDogfood: + case kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay; break; - case Avalot::kPeopleMalagauche: { + case kPeopleMalagauche: { bool isSober = !_vm->_avalot->_teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[Avalot::kObjectWine - 1]); + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); @@ -518,8 +518,8 @@ void Menu::setupMenuWith() { _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 101 + 100 + 102 + 103 + 104; } break; - case Avalot::kPeopleTrader: - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[Avalot::kObjectOnion - 1]); + case kPeopleTrader: + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[kObjectOnion - 1]); _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105; break; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index c54b48205202..94d3d2477dd6 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -893,7 +893,7 @@ void Parser::parse() { _vm->_avalot->_it = _thing; if (_person != kPardon) { - if (_person < Avalot::kPeopleArkata) + if (_person < kPeopleArkata) _vm->_avalot->_him = _person; else _vm->_avalot->_her = _person; @@ -904,7 +904,7 @@ void Parser::examineObject() { if (_thing != _vm->_avalot->_thinks) _vm->_avalot->thinkAbout(_thing, Avalot::kThing); switch (_thing) { - case Avalot::kObjectWine : + case kObjectWine : switch (_vm->_avalot->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll @@ -917,7 +917,7 @@ void Parser::examineObject() { break; } break; - case Avalot::kObjectOnion: + case kObjectOnion: if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else @@ -933,7 +933,7 @@ bool Parser::isPersonHere() { // Person equivalent of "holding". return true; else { Common::String tmpStr; - if (_person < Avalot::kPeopleArkata) + if (_person < kPeopleArkata) tmpStr = "He isn't around at the moment."; else tmpStr = "She isn't around at the moment."; @@ -949,14 +949,14 @@ void Parser::exampers() { byte newPerson = _person - 149; - if ((_person == Avalot::kPeopleDogfood) && _vm->_avalot->_wonNim) + if ((_person == kPeopleDogfood) && _vm->_avalot->_wonNim) _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" - else if ((_person == Avalot::kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep) + else if ((_person == kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else _vm->_dialogs->displayScrollChain('p', newPerson); - if ((_person == Avalot::kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) + if ((_person == kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) _vm->_dialogs->displayScrollChain('Q', 13); _person = newPerson; @@ -1051,7 +1051,7 @@ void Parser::inventory() { void Parser::swallow() { // Eat something. switch (_thing) { - case Avalot::kObjectWine: + case kObjectWine: switch (_vm->_avalot->_wineState) { // 4 is perfect case 1: if (_vm->_avalot->_teetotal) { @@ -1061,7 +1061,7 @@ void Parser::swallow() { // Eat something. _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_dialogs->displayScrollChain('U', 2); - _vm->_avalot->_objects[Avalot::kObjectWine - 1] = false; + _vm->_avalot->_objects[kObjectWine - 1] = false; _vm->_avalot->refreshObjectList(); drink(); break; @@ -1071,28 +1071,28 @@ void Parser::swallow() { // Eat something. break; // You can't drink it! } break; - case Avalot::kObjectPotion: + case kObjectPotion: _vm->_avalot->setBackgroundColor(4); _vm->_dialogs->displayScrollChain('U', 3); _vm->_avalot->gameOver(); _vm->_avalot->setBackgroundColor(0); break; - case Avalot::kObjectInk: + case kObjectInk: _vm->_dialogs->displayScrollChain('U', 4); break; - case Avalot::kObjectChastity: + case kObjectChastity: _vm->_dialogs->displayScrollChain('U', 5); break; - case Avalot::kObjectMushroom: + case kObjectMushroom: _vm->_dialogs->displayScrollChain('U', 6); _vm->_avalot->gameOver(); break; - case Avalot::kObjectOnion: + case kObjectOnion: if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('U', 11); else { _vm->_dialogs->displayScrollChain('U', 8); - _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; + _vm->_avalot->_objects[kObjectOnion - 1] = false; _vm->_avalot->refreshObjectList(); } break; @@ -1252,8 +1252,8 @@ void Parser::putProc() { // Thing is the _thing which you're putting in. _thing2 is where you're putting it. switch (_thing2) { - case Avalot::kObjectWine: - if (_thing == Avalot::kObjectOnion) { + case kObjectWine: + if (_thing == kObjectOnion) { if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? @@ -1276,16 +1276,16 @@ void Parser::putProc() { _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { - case Avalot::kObjectMoney: + case kObjectMoney: _vm->_dialogs->displayText("You'd better keep some ready cash on you!"); break; - case Avalot::kObjectBell: + case kObjectBell: _vm->_dialogs->displayText("That's a silly place to keep a bell."); break; - case Avalot::kObjectBodkin: + case kObjectBodkin: _vm->_dialogs->displayText("But you might need it!"); break; - case Avalot::kObjectOnion: + case kObjectOnion: _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... @@ -1345,8 +1345,8 @@ bool Parser::giveToSpludwick() { } switch (_thing) { - case Avalot::kObjectOnion: - _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; + case kObjectOnion: + _vm->_avalot->_objects[kObjectOnion - 1] = false; if (_vm->_avalot->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 22); else { @@ -1357,21 +1357,21 @@ bool Parser::giveToSpludwick() { } _vm->_avalot->refreshObjectList(); break; - case Avalot::kObjectInk: - _vm->_avalot->_objects[Avalot::kObjectInk - 1] = false; + case kObjectInk: + _vm->_avalot->_objects[kObjectInk - 1] = false; _vm->_avalot->refreshObjectList(); _vm->_avalot->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); _vm->_avalot->incScore(3); break; - case Avalot::kObjectMushroom: - _vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = false; + case kObjectMushroom: + _vm->_avalot->_objects[kObjectMushroom - 1] = false; _vm->_dialogs->displayScrollChain('q', 25); _vm->_avalot->incScore(5); _vm->_avalot->_givenToSpludwick++; goToCauldron(); - _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; + _vm->_avalot->_objects[kObjectPotion - 1] = true; _vm->_avalot->refreshObjectList(); break; default: @@ -1384,7 +1384,7 @@ bool Parser::giveToSpludwick() { void Parser::drink() { _alcoholLevel += 1; if (_alcoholLevel == 5) { - _vm->_avalot->_objects[Avalot::kObjectKey - 1] = true; // Get the key. + _vm->_avalot->_objects[kObjectKey - 1] = true; // Get the key. _vm->_avalot->_teetotal = true; _vm->_avalot->_avvyIsAwake = false; _vm->_avalot->_avvyInBed = true; @@ -1474,7 +1474,7 @@ void Parser::getProc(char thing) { break; case kRoomInsideCardiffCastle: switch (thing) { - case Avalot::kObjectPen: + case kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. if (_vm->_avalot->_takenPen) _vm->_dialogs->displayText("It's not there, Avvy."); @@ -1483,7 +1483,7 @@ void Parser::getProc(char thing) { _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! _vm->_avalot->_takenPen = true; - _vm->_avalot->_objects[Avalot::kObjectPen - 1] = true; + _vm->_avalot->_objects[kObjectPen - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayText("Taken."); } @@ -1492,7 +1492,7 @@ void Parser::getProc(char thing) { else _vm->_dialogs->displayScrollChain('q', 51); break; - case Avalot::kObjectBolt: + case kObjectBolt: _vm->_dialogs->displayScrollChain('q', 52); break; default: @@ -1500,12 +1500,12 @@ void Parser::getProc(char thing) { } break; case kRoomRobins: - if ((thing == Avalot::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { + if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { _vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_dialogs->displayText("Got it!"); _vm->_avalot->_mushroomGrowing = false; _vm->_avalot->_takenMushroom = true; - _vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = true; + _vm->_avalot->_objects[kObjectMushroom - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->incScore(3); } else @@ -1526,7 +1526,7 @@ void Parser::giveGeidaTheLute() { _vm->_dialogs->displayText(tmpStr); return; } - _vm->_avalot->_objects[Avalot::kObjectLute - 1] = false; + _vm->_avalot->_objects[kObjectLute - 1] = false; _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 64); // She plays it. @@ -1686,52 +1686,52 @@ void Parser::doThat() { _vm->_dialogs->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { - case Avalot::kObjectMoney : + case kObjectMoney : _vm->_dialogs->displayText("You can't bring yourself to give away your moneybag."); break; - case Avalot::kObjectBodkin: - case Avalot::kObjectBell: - case Avalot::kObjectClothes: - case Avalot::kObjectHabit : + case kObjectBodkin: + case kObjectBell: + case kObjectClothes: + case kObjectHabit : _vm->_dialogs->displayText("Don't give it away, it might be useful!"); break; default: switch (_person) { - case Avalot::kPeopleCrapulus: - if (_thing == Avalot::kObjectWine) { + case kPeopleCrapulus: + if (_thing == kObjectWine) { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_avalot->_objects[Avalot::kObjectWine - 1] = false; + _vm->_avalot->_objects[kObjectWine - 1] = false; } else heyThanks(); break; - case Avalot::kPeopleCwytalot: - if ((_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt)) + case kPeopleCwytalot: + if ((_thing == kObjectCrossbow) || (_thing == kObjectBolt)) _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else heyThanks(); break; - case Avalot::kPeopleSpludwick: + case kPeopleSpludwick: if (giveToSpludwick()) heyThanks(); break; - case Avalot::kPeopleIbythneth: - if (_thing == Avalot::kObjectBadge) { + case kPeopleIbythneth: + if (_thing == kObjectBadge) { _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! _vm->_avalot->incScore(3); - _vm->_avalot->_objects[Avalot::kObjectBadge - 1] = false; - _vm->_avalot->_objects[Avalot::kObjectHabit - 1] = true; + _vm->_avalot->_objects[kObjectBadge - 1] = false; + _vm->_avalot->_objects[kObjectHabit - 1] = true; _vm->_avalot->_givenBadgeToIby = true; _vm->_background->drawBackgroundSprite(-1, -1, 7); _vm->_background->drawBackgroundSprite(-1, -1, 8); } else heyThanks(); break; - case Avalot::kPeopleAyles: + case kPeopleAyles: if (_vm->_avalot->_aylesIsAwake) { - if (_thing == Avalot::kObjectPen) { - _vm->_avalot->_objects[Avalot::kObjectPen - 1] = false; + if (_thing == kObjectPen) { + _vm->_avalot->_objects[kObjectPen - 1] = false; _vm->_dialogs->displayScrollChain('q', 54); - _vm->_avalot->_objects[Avalot::kObjectInk - 1] = true; + _vm->_avalot->_objects[kObjectInk - 1] = true; _vm->_avalot->_givenPenToAyles = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->incScore(2); @@ -1740,25 +1740,25 @@ void Parser::doThat() { } else _vm->_dialogs->displayText("But he's asleep!"); break; - case Avalot::kPeopleGeida: + case kPeopleGeida: switch (_thing) { - case Avalot::kObjectPotion: - _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = false; + case kObjectPotion: + _vm->_avalot->_objects[kObjectPotion - 1] = false; _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. _vm->_avalot->incScore(2); _vm->_avalot->_givenPotionToGeida = true; _vm->_avalot->refreshObjectList(); break; - case Avalot::kObjectLute: + case kObjectLute: giveGeidaTheLute(); break; default: heyThanks(); } break; - case Avalot::kPeopleArkata: + case kPeopleArkata: switch (_thing) { - case Avalot::kObjectPotion: + case kObjectPotion: if (_vm->_avalot->_givenPotionToGeida) winSequence(); else @@ -1839,12 +1839,12 @@ void Parser::doThat() { case kVerbCodeWear: if (isHolding()) { // Wear something. switch (_thing) { - case Avalot::kObjectChastity: + case kObjectChastity: // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); break; - case Avalot::kObjectClothes: - case Avalot::kObjectHabit: { // Change this! + case kObjectClothes: + case kObjectHabit: { // Change this! if (_wearing != kNothing) { if (_wearing == _thing) _vm->_dialogs->displayText("You're already wearing that."); @@ -1857,7 +1857,7 @@ void Parser::doThat() { _vm->_avalot->refreshObjectList(); byte i; - if (_thing == Avalot::kObjectHabit) + if (_thing == kObjectHabit) i = 3; else i = 0; @@ -1901,7 +1901,7 @@ void Parser::doThat() { // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_avalot->_objects[Avalot::kObjectLute - 1] = true; + _vm->_avalot->_objects[kObjectLute - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->_wonNim = true; _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. @@ -1920,13 +1920,13 @@ void Parser::doThat() { } } else if (isHolding()) { switch (_thing) { - case Avalot::kObjectLute : + case kObjectLute : _vm->_dialogs->displayScrollChain('U', 7); - if (_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room) + if (_vm->_avalot->_whereIs[kPeopleCwytalot - 150] == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 10); - if (_vm->_avalot->_whereIs[Avalot::kPeopleDuLustie - 150] == _vm->_avalot->_room) + if (_vm->_avalot->_whereIs[kPeopleDuLustie - 150] == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 15); break; case 52: @@ -1949,7 +1949,7 @@ void Parser::doThat() { break; case kVerbCodeRing: if (isHolding()) { - if (_thing == Avalot::kObjectBell) { + if (_thing == kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph @@ -2076,8 +2076,8 @@ void Parser::doThat() { case 52: examine(); break; // We have a right one here - buy Pepsi??! - case Avalot::kObjectWine: - if (_vm->_avalot->_objects[Avalot::kObjectWine - 1]) // We've already got the wine! + case kObjectWine: + if (_vm->_avalot->_objects[kObjectWine - 1]) // We've already got the wine! _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { if (_vm->_avalot->_malagauche == 177) { // Already getting us one. @@ -2108,8 +2108,8 @@ void Parser::doThat() { case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { - if (_thing == Avalot::kObjectOnion) { - if (_vm->_avalot->_objects[Avalot::kObjectOnion - 1]) + if (_thing == kObjectOnion) { + if (_vm->_avalot->_objects[kObjectOnion - 1]) _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! else if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); @@ -2121,7 +2121,7 @@ void Parser::doThat() { _vm->_avalot->incScore(3); } _vm->_avalot->decreaseMoney(3); // It costs thruppence. - _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = true; + _vm->_avalot->_objects[kObjectOnion - 1] = true; _vm->_avalot->refreshObjectList(); _boughtOnion = true; _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! @@ -2142,9 +2142,9 @@ void Parser::doThat() { break; case kVerbCodeAttack: if ((_vm->_avalot->_room == kRoomBrummieRoad) && - ((_person == Avalot::kPeopleCwytalot) || (_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt)) && - (_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room)) { - switch (_vm->_avalot->_objects[Avalot::kObjectBolt - 1] + _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] * 2) { + ((_person == kPeopleCwytalot) || (_thing == kObjectCrossbow) || (_thing == kObjectBolt)) && + (_vm->_avalot->_whereIs[kPeopleCwytalot - 150] == _vm->_avalot->_room)) { + switch (_vm->_avalot->_objects[kObjectBolt - 1] + _vm->_avalot->_objects[kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_dialogs->displayScrollChain('Q', 10); @@ -2159,15 +2159,15 @@ void Parser::doThat() { case 3: _vm->_dialogs->displayScrollChain('Q', 11); _vm->_avalot->_cwytalotGone = true; - _vm->_avalot->_objects[Avalot::kObjectBolt - 1] = false; - _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = false; + _vm->_avalot->_objects[kObjectBolt - 1] = false; + _vm->_avalot->_objects[kObjectCrossbow - 1] = false; _vm->_avalot->refreshObjectList(); _vm->_avalot->_magics[11]._operation = Avalot::kMagicNothing; _vm->_avalot->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] = kRoomDummy; + _vm->_avalot->_whereIs[kPeopleCwytalot - 150] = kRoomDummy; break; default: _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! @@ -2225,19 +2225,19 @@ void Parser::doThat() { _vm->_dialogs->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { - case Avalot::kPeopleArkata: + case kPeopleArkata: _vm->_dialogs->displayScrollChain('U', 12); break; - case Avalot::kPeopleGeida: + case kPeopleGeida: _vm->_dialogs->displayScrollChain('U', 13); break; - case Avalot::kPeopleWisewoman: + case kPeopleWisewoman: _vm->_dialogs->displayScrollChain('U', 14); break; default: _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? } - } else if ((Avalot::kPeopleAvalot <= _person) && (_person < Avalot::kPeopleArkata)) + } else if ((kPeopleAvalot <= _person) && (_person < kPeopleArkata)) _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); break; @@ -2259,7 +2259,7 @@ void Parser::doThat() { if (isPersonHere()) switch (_person) { case kPardon: - case Avalot::kPeopleAvalot: + case kPeopleAvalot: case 0: if (!_vm->_avalot->_avvyIsAwake) { _vm->_avalot->_avvyIsAwake = true; @@ -2271,11 +2271,11 @@ void Parser::doThat() { } else _vm->_dialogs->displayText("You're already awake, Avvy!"); break; - case Avalot::kPeopleAyles: + case kPeopleAyles: if (!_vm->_avalot->_aylesIsAwake) _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; - case Avalot::kPeopleJacques: { + case kPeopleJacques: { Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); @@ -2362,9 +2362,20 @@ void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) { } } +void Parser::resetVariables() { + _wearing = 0; + _sworeNum = 0; + _alcoholLevel = 0; + _playedNim = 0; + _boughtOnion = false; +} + void Parser::synchronize(Common::Serializer &sz) { sz.syncAsByte(_wearing); sz.syncAsByte(_sworeNum); + sz.syncAsByte(_alcoholLevel); + sz.syncAsByte(_playedNim); + sz.syncAsByte(_boughtOnion); } } // End of namespace Avalanche diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 8f49a48e7451..30b5929fb5f9 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -81,10 +81,6 @@ class Parser { bool _cursorState; byte _wearing; // what you're wearing - byte _sworeNum; // number of times you've sworn - byte _alcoholLevel; // Your blood alcohol level. - byte _playedNim; // How many times you've played Nim. - bool _boughtOnion; // Have you bought an onion yet? Parser(AvalancheEngine *vm); @@ -104,6 +100,7 @@ class Parser { void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. int16 getPos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + void resetVariables(); void synchronize(Common::Serializer &sz); private: @@ -116,6 +113,10 @@ class Parser { Common::String _thats; byte _thing2; + byte _sworeNum; // number of times you've sworn + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _boughtOnion; // Have you bought an onion yet? byte wordNum(Common::String word); void replace(Common::String oldChars, byte newChar); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 1fc69a278bfc..ae9481c9c1b0 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -324,7 +324,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_avalot->_whereIs[Avalot::kPeopleRobinHood - 150] = kRoomRobins; + _vm->_avalot->_whereIs[kPeopleRobinHood - 150] = kRoomRobins; _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); @@ -336,7 +336,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); - _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomRobins; + _vm->_avalot->_whereIs[kPeopleFriarTuck - 150] = kRoomRobins; _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -356,7 +356,7 @@ void Timer::afterTheShootemup() { _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = true; + _vm->_avalot->_objects[kObjectCrossbow - 1] = true; _vm->_avalot->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! @@ -400,7 +400,7 @@ void Timer::jacquesWakesUp() { case 3 : // Gone through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. - _vm->_avalot->_whereIs[Avalot::kPeopleJacques - 150] = 0; // Gone! + _vm->_avalot->_whereIs[kPeopleJacques - 150] = 0; // Gone! break; } @@ -489,7 +489,7 @@ void Timer::jump() { else { _vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_avalot->_arrowInTheDoor = false; // You've got it. - _vm->_avalot->_objects[Avalot::kObjectBolt - 1] = true; + _vm->_avalot->_objects[kObjectBolt - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 50); _vm->_avalot->incScore(3); @@ -522,7 +522,7 @@ void Timer::buyWine() { _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. if (_vm->_avalot->decreaseMoney(3)) { _vm->_dialogs->displayScrollChain('D', 4); // You paid up. - _vm->_avalot->_objects[Avalot::kObjectWine - 1] = true; + _vm->_avalot->_objects[kObjectWine - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->_wineState = 1; // OK Wine. } From 0b7de38dc1969fa2cee4337d0071b97071cceaae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 24 Sep 2013 08:15:28 +0200 Subject: [PATCH 1106/1332] AVALANCHE: Use Room enum instead of byte in misc place --- engines/avalanche/animation.cpp | 116 ++----------------------- engines/avalanche/animation.h | 4 +- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 147 ++++++++++++++++++++++++++++---- engines/avalanche/avalot.h | 15 +++- engines/avalanche/dialogs.cpp | 2 +- engines/avalanche/menu.cpp | 4 +- engines/avalanche/parser.cpp | 30 +++---- engines/avalanche/sequence.cpp | 4 +- engines/avalanche/sequence.h | 2 +- engines/avalanche/timer.cpp | 8 +- 11 files changed, 177 insertions(+), 157 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 1172b1cc64ee..92ebb4bac484 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -210,7 +210,7 @@ void AnimationType::walk() { bounce(); break; case Avalot::kMagicTransport: - _anim->flipRoom(magic->_data >> 8, magic->_data & 0xff); + _anim->_vm->_avalot->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); break; case Avalot::kMagicUnfinished: { bounce(); @@ -222,7 +222,7 @@ void AnimationType::walk() { _anim->callSpecial(magic->_data); break; case Avalot::kMagicOpenDoor: - _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor); + _anim->_vm->_avalot->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); break; } } @@ -418,20 +418,20 @@ void Animation::catacombMove(byte ped) { switch (xy_uint16) { case 1801: // Exit catacombs - flipRoom(kRoomLustiesRoom, 4); + _vm->_avalot->flipRoom(kRoomLustiesRoom, 4); _vm->_dialogs->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette - flipRoom(kRoomOubliette, 1); + _vm->_avalot->flipRoom(kRoomOubliette, 1); Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } return; case 4: - flipRoom(kRoomGeidas, 1); + _vm->_avalot->flipRoom(kRoomGeidas, 1); return; case 2307: - flipRoom(kRoomLusties, 5); + _vm->_avalot->flipRoom(kRoomLusties, 5); _vm->_dialogs->displayText("Oh no... here we go again..."); _vm->_avalot->_userMovesAvvy = false; _sprites[0]._moveY = 1; @@ -771,7 +771,7 @@ void Animation::callSpecial(uint16 which) { _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_avalot->_whereIs[kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. + _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; @@ -867,67 +867,6 @@ void Animation::callSpecial(uint16 which) { } } -/** - * Open the Door. - * This slides the door open. The data really ought to be saved in - * the Also file, and will be next time. However, for now, they're - * here. - * @remarks Originally called 'open_the_door' - */ -void Animation::openDoor(byte whither, byte ped, byte magicnum) { - switch (_vm->_avalot->_room) { - case kRoomOutsideYours: - case kRoomOutsideNottsPub: - case kRoomOutsideDucks: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(2); - _vm->_sequence->thenShow(3); - break; - case kRoomInsideCardiffCastle: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(5); - break; - case kRoomAvvysGarden: - case kRoomEntranceHall: - case kRoomInsideAbbey: - case kRoomYourHall: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(2); - break; - case kRoomMusicRoom: - case kRoomOutsideArgentPub: - _vm->_sequence->firstShow(5); - _vm->_sequence->thenShow(6); - break; - case kRoomLusties: - switch (magicnum) { - case 14: - if (_vm->_avalot->_avvysInTheCupboard) { - hideInCupboard(); - _vm->_sequence->firstShow(8); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); - return; - } else { - appearPed(0, 5); - _sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 - _vm->_sequence->firstShow(8); - _vm->_sequence->thenShow(9); - } - break; - case 12: - _vm->_sequence->firstShow(4); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(6); - break; - } - break; - } - - _vm->_sequence->thenFlip(whither, ped); - _vm->_sequence->startToOpen(); -} - void Animation::updateSpeed() { // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. @@ -1254,47 +1193,6 @@ void Animation::hideInCupboard() { } } -void Animation::flipRoom(byte room, byte ped) { - assert((ped > 0) && (ped < 15)); - if (!_vm->_avalot->_alive) { - // You can't leave the room if you're dead. - _sprites[0]._moveX = 0; - _sprites[0]._moveY = 0; // Stop him from moving. - return; - } - - if ((room == kRoomDummy) && (_vm->_avalot->_room == kRoomLusties)) { - hideInCupboard(); - return; - } - - if ((_vm->_avalot->_jumpStatus > 0) && (_vm->_avalot->_room == kRoomInsideCardiffCastle)) { - // You can't *jump* out of Cardiff Castle! - _sprites[0]._moveX = 0; - return; - } - - _vm->_avalot->exitRoom(_vm->_avalot->_room); - _vm->_avalot->dusk(); - - for (int16 i = 1; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick) - _sprites[i].remove(); - } // Deallocate sprite - - if (_vm->_avalot->_room == kRoomLustiesRoom) - _vm->_avalot->_enterCatacombsFromLustiesRoom = true; - - _vm->_avalot->enterRoom(room, ped); - appearPed(0, ped - 1); - _vm->_avalot->_enterCatacombsFromLustiesRoom = false; - _oldDirection = _direction; - _direction = _sprites[0]._facingDir; - _vm->_avalot->drawDirection(); - - _vm->_avalot->dawn(); -} - bool Animation::inField(byte which) { FieldType *curField = &_vm->_avalot->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index a411de7c20cd..47109811b977 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -121,16 +121,15 @@ class Animation { void animLink(); void loadAnims(); // Original: loadtrip(). void callSpecial(uint16 which); - void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. void stopWalking(); void setMoveSpeed(byte t, Direction dir); void appearPed(byte sprNum, byte pedNum); - void flipRoom(byte room, byte ped); bool inField(byte which); // Returns true if you're within field "which". bool nearDoor(); // Returns True if you're near a door. void updateSpeed(); void handleMoveKey(const Common::Event &event); // To replace tripkey(). + void hideInCupboard(); void setDirection(Direction dir); void setOldDirection(Direction dir); @@ -150,7 +149,6 @@ class Animation { void grabAvvy(byte tripnum); void arrowProcs(byte tripnum); - void hideInCupboard(); // Different movements for NPCs: void followAvalotY(byte tripnum); // Original: follow_avvy_y(). diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index b0db9648a8df..4e92901cf8c3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -419,7 +419,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _background->forgetBackgroundSprites(); _avalot->minorRedraw(); _menu->setup(); - _avalot->_whereIs[kPeopleAvalot - 150] = _avalot->_room; + _avalot->setRoom(kPeopleAvalot, _avalot->_room); _avalot->_alive = true; _avalot->refreshObjectList(); _animation->updateSpeed(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index afee7228d6d4..747604d254f0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -143,7 +143,7 @@ const TuneType Avalot::kTune = { kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher }; -byte Avalot::_whereIs[29] = { +Room Avalot::_whereIs[29] = { // The Lads kRoomYours, // Avvy kRoomSpludwicks, // Spludwick @@ -162,7 +162,14 @@ byte Avalot::_whereIs[29] = { kRoomNottsPub, // Port kRoomNottsPub, // Spurge kRoomMusicRoom, // Jacques - 0, 0, 0, 0, 0, 0, 0, 0, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, + kRoomNowhere, // The Lasses kRoomYours, // Arkata kRoomGeidas, // Geida @@ -747,23 +754,23 @@ void Avalot::putGeidaAt(byte whichPed, byte ped) { spr1->_eachStepProc = Animation::kProcGeida; } -void Avalot::enterRoom(byte room, byte ped) { +void Avalot::enterRoom(Room roomId, byte ped) { _seeScroll = true; // This stops the trippancy system working over the length of this procedure. - findPeople(room); - _room = room; + findPeople(roomId); + _room = roomId; if (ped != 0) - _roomCount[room]++; + _roomCount[roomId]++; - loadRoom(room); + loadRoom(roomId); - if ((_roomCount[room] == 0) && (!setFlag('S'))) + if ((_roomCount[roomId] == 0) && (!setFlag('S'))) incScore(1); _whereIs[kPeopleAvalot - 150] = _room; if (_geidaFollows) - _whereIs[kPeopleGeida - 150] = room; + _whereIs[kPeopleGeida - 150] = roomId; _roomTime = 0; @@ -771,7 +778,7 @@ void Avalot::enterRoom(byte room, byte ped) { if ((_lastRoom == kRoomMap) && (_lastRoomNotMap != _room)) enterNewTown(); - switch (room) { + switch (roomId) { case kRoomYours: if (_avvyInBed) { _vm->_background->drawBackgroundSprite(-1, -1, 2); @@ -891,8 +898,8 @@ void Avalot::enterRoom(byte room, byte ped) { } if (_beenTiedUp) { - _whereIs[kPeopleRobinHood - 150] = 0; - _whereIs[kPeopleFriarTuck - 150] = 0; + _whereIs[kPeopleRobinHood - 150] = kRoomNowhere; + _whereIs[kPeopleFriarTuck - 150] = kRoomNowhere; } if (_tiedUp) @@ -1004,7 +1011,7 @@ void Avalot::enterRoom(byte room, byte ped) { _vm->_graphics->refreshBackground(); _vm->_background->drawBackgroundSprite(-1, -1, 3); _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; - _whereIs[kPeopleJacques - 150] = 0; + _whereIs[kPeopleJacques - 150] = kRoomNowhere; } if (ped != 0) { _vm->_background->drawBackgroundSprite(-1, -1, 5); @@ -1647,7 +1654,7 @@ void Avalot::resetVariables() { _nextBell = 0; _givenPotionToGeida = false; _lustieIsAsleep = false; - _flipToWhere = 0; + _flipToWhere = kRoomNowhere; _flipToPed = 0; _beenTiedUp = false; _sittingInPub = false; @@ -1705,7 +1712,7 @@ void Avalot::newGame() { _avvyInBed = true; _enidFilename = ""; - enterRoom(1, 1); + enterRoom(kRoomYours, 1); avvy->_visible = false; drawScore(); _vm->_menu->setup(); @@ -1939,4 +1946,114 @@ void Avalot::hangAroundForAWhile() { for (int i = 0; i < 28; i++) slowDown(); } + +void Avalot::flipRoom(Room room, byte ped) { + assert((ped > 0) && (ped < 15)); + if (!_alive) { + // You can't leave the room if you're dead. + _vm->_animation->_sprites[0]._moveX = 0; + _vm->_animation->_sprites[0]._moveY = 0; // Stop him from moving. + return; + } + + if ((room == kRoomDummy) && (_room == kRoomLusties)) { + _vm->_animation->hideInCupboard(); + return; + } + + if ((_jumpStatus > 0) && (_room == kRoomInsideCardiffCastle)) { + // You can't *jump* out of Cardiff Castle! + _vm->_animation->_sprites[0]._moveX = 0; + return; + } + + exitRoom(_room); + dusk(); + + for (int16 i = 1; i < _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->_sprites[i]._quick) + _vm->_animation->_sprites[i].remove(); + } // Deallocate sprite + + if (_room == kRoomLustiesRoom) + _enterCatacombsFromLustiesRoom = true; + + enterRoom(room, ped); + _vm->_animation->appearPed(0, ped - 1); + _enterCatacombsFromLustiesRoom = false; + _vm->_animation->setOldDirection(_vm->_animation->getDirection()); + _vm->_animation->setDirection(_vm->_animation->_sprites[0]._facingDir); + drawDirection(); + + dawn(); +} + +/** + * Open the Door. + * This slides the door open. The data really ought to be saved in + * the Also file, and will be next time. However, for now, they're + * here. + * @remarks Originally called 'open_the_door' + */ +void Avalot::openDoor(Room whither, byte ped, byte magicnum) { + switch (_room) { + case kRoomOutsideYours: + case kRoomOutsideNottsPub: + case kRoomOutsideDucks: + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(2); + _vm->_sequence->thenShow(3); + break; + case kRoomInsideCardiffCastle: + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(5); + break; + case kRoomAvvysGarden: + case kRoomEntranceHall: + case kRoomInsideAbbey: + case kRoomYourHall: + _vm->_sequence->firstShow(1); + _vm->_sequence->thenShow(2); + break; + case kRoomMusicRoom: + case kRoomOutsideArgentPub: + _vm->_sequence->firstShow(5); + _vm->_sequence->thenShow(6); + break; + case kRoomLusties: + switch (magicnum) { + case 14: + if (_avvysInTheCupboard) { + _vm->_animation->hideInCupboard(); + _vm->_sequence->firstShow(8); + _vm->_sequence->thenShow(7); + _vm->_sequence->startToClose(); + return; + } else { + _vm->_animation->appearPed(0, 5); + _vm->_animation->_sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 + _vm->_sequence->firstShow(8); + _vm->_sequence->thenShow(9); + } + break; + case 12: + _vm->_sequence->firstShow(4); + _vm->_sequence->thenShow(5); + _vm->_sequence->thenShow(6); + break; + } + break; + } + + _vm->_sequence->thenFlip(whither, ped); + _vm->_sequence->startToOpen(); +} + +void Avalot::setRoom(byte persId, Room roomId) { + _whereIs[persId - 150] = roomId; +} + +Room Avalot::getRoom(byte persId) { + return _whereIs[persId - 150]; +} } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 89f67b82fbd2..92cc456b221f 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -240,14 +240,13 @@ class Avalot { // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; - static byte _whereIs[29]; // Former DNA structure byte _carryNum; // How many objects you're carrying... bool _objects[kObjectNum]; // ...and which ones they are. int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh - byte _room; // your current room + Room _room; // your current room byte _roomCount[100]; // Add one to each every time you enter a room bool _wonNim; // Have you *won* Nim? (That's harder.) byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. @@ -297,7 +296,8 @@ class Avalot { byte _nextBell; // For the ringing. bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? - byte _flipToWhere, _flipToPed; // For the sequencer. + Room _flipToWhere; + byte _flipToPed; // For the sequencer. bool _beenTiedUp; // In r__Robins. bool _sittingInPub; // Are you sitting down in the pub? byte _spurgeTalkCount; // Count for talking to Spurge. @@ -364,7 +364,7 @@ class Avalot { void drawAlsoLines(); void loadRoom(byte num); void exitRoom(byte x); - void enterRoom(byte room, byte ped); + void enterRoom(Room room, byte ped); void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! void loadDigits(); // Load the scoring digits & rwlites void drawToolbar(); @@ -411,9 +411,16 @@ class Avalot { Common::String getItem(byte which); // Called get_better in the original. Common::String f5Does(); // This procedure determines what f5 does. + void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. + void flipRoom(Room room, byte ped); + + void setRoom(byte persId, Room roomId); + Room getRoom(byte persId); private: AvalancheEngine *_vm; + static Room _whereIs[29]; + Common::File file; Common::String readAlsoStringFromFile(); void scram(Common::String &str); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 37f8fc14ed99..e9d89c2192fa 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1071,7 +1071,7 @@ void Dialogs::talkTo(byte whom) { _vm->_avalot->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. _vm->_avalot->_talkedToCrapulus = true; - _vm->_avalot->_whereIs[kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. + _vm->_avalot->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index fab349ebc464..6af0e7942939 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -452,7 +452,7 @@ void Menu::setupMenuPeople() { _activeMenuItem.reset(); for (int i = 150; i <= 178; i++) { - if (_vm->_avalot->_whereIs[i - 150] == _vm->_avalot->_room) { + if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) { _activeMenuItem.setupOption(_vm->_avalot->getName(i), _vm->_avalot->getNameChar(i), "", true); people += i; } @@ -488,7 +488,7 @@ void Menu::setupMenuWith() { // or (c), the _person you've selected is YOU! if ((_vm->_avalot->_lastPerson == kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) - || (_vm->_avalot->_whereIs[_vm->_avalot->_lastPerson - 150] != _vm->_avalot->_room)) + || (_vm->_avalot->getRoom(_vm->_avalot->_lastPerson) != _vm->_avalot->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 94d3d2477dd6..8e60a5654ab7 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -929,7 +929,7 @@ void Parser::examineObject() { } bool Parser::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_avalot->_whereIs[_person - 150] == _vm->_avalot->_room)) + if ((_person == kPardon) || (_person == 0) || (_vm->_avalot->getRoom(_person) == _vm->_avalot->_room)) return true; else { Common::String tmpStr; @@ -1107,8 +1107,8 @@ void Parser::swallow() { // Eat something. void Parser::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room) + for (int i = 151; i < 179; i++) { // Start at 1 so we don't list Avvy himself! + if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) numPeople++; } @@ -1117,8 +1117,8 @@ void Parser::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. - for (int i = 1; i < 29; i++) { - if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room) { + for (int i = 151; i < 179; i++) { + if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) { actPerson++; if (actPerson == 1) // First on the list. tmpStr = _vm->_avalot->getName(i + 150); @@ -1210,7 +1210,7 @@ void Parser::openDoor() { _vm->_dialogs->displayScrollChain('x', portal->_data); break; case Avalot::kMagicTransport: - _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); + _vm->_avalot->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; case Avalot::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); @@ -1220,7 +1220,7 @@ void Parser::openDoor() { _vm->_animation->callSpecial(portal->_data); break; case Avalot::kMagicOpenDoor: - _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); + _vm->_avalot->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); break; } @@ -1391,7 +1391,7 @@ void Parser::drink() { _vm->_avalot->refreshObjectList(); _vm->_avalot->dusk(); _vm->_avalot->hangAroundForAWhile(); - _vm->_animation->flipRoom(1, 1); + _vm->_avalot->flipRoom(kRoomYours, 1); _vm->_avalot->setBackgroundColor(14); _vm->_animation->_sprites[0]._visible = false; } @@ -1552,13 +1552,13 @@ void Parser::winSequence() { Common::String Parser::personSpeaks() { if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_avalot->_him == kPardon) || (_vm->_avalot->_whereIs[_vm->_avalot->_him - 150] != _vm->_avalot->_room)) + if ((_vm->_avalot->_him == kPardon) || (_vm->_avalot->getRoom(_vm->_avalot->_him) != _vm->_avalot->_room)) _person = _vm->_avalot->_her; else _person = _vm->_avalot->_him; } - if (_vm->_avalot->_whereIs[_person - 150] != _vm->_avalot->_room) { + if (_vm->_avalot->getRoom(_person) != _vm->_avalot->_room) { return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } @@ -1923,10 +1923,10 @@ void Parser::doThat() { case kObjectLute : _vm->_dialogs->displayScrollChain('U', 7); - if (_vm->_avalot->_whereIs[kPeopleCwytalot - 150] == _vm->_avalot->_room) + if (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 10); - if (_vm->_avalot->_whereIs[kPeopleDuLustie - 150] == _vm->_avalot->_room) + if (_vm->_avalot->getRoom(kPeopleDuLustie) == _vm->_avalot->_room) _vm->_dialogs->displayScrollChain('U', 15); break; case 52: @@ -1993,7 +1993,7 @@ void Parser::doThat() { else { if ((_vm->_avalot->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! _vm->_dialogs->displayScrollChain('q', 17); - if (_vm->_avalot->_whereIs[1] == kRoomSpludwicks) + if (_vm->_avalot->getRoom(kPeopleSpludwick) == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2143,7 +2143,7 @@ void Parser::doThat() { case kVerbCodeAttack: if ((_vm->_avalot->_room == kRoomBrummieRoad) && ((_person == kPeopleCwytalot) || (_thing == kObjectCrossbow) || (_thing == kObjectBolt)) && - (_vm->_avalot->_whereIs[kPeopleCwytalot - 150] == _vm->_avalot->_room)) { + (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room)) { switch (_vm->_avalot->_objects[kObjectBolt - 1] + _vm->_avalot->_objects[kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: @@ -2167,7 +2167,7 @@ void Parser::doThat() { _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_avalot->_whereIs[kPeopleCwytalot - 150] = kRoomDummy; + _vm->_avalot->setRoom(kPeopleCwytalot, kRoomDummy); break; default: _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 53e43b5abe6f..0d26cbb677c0 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -57,7 +57,7 @@ void Sequence::thenShow(byte what) { } } -void Sequence::thenFlip(byte where, byte ped) { +void Sequence::thenFlip(Room where, byte ped) { thenShow(kNowFlip); _vm->_avalot->_flipToWhere = where; @@ -90,7 +90,7 @@ void Sequence::callSequencer() { break; case 177: // Flip room. _vm->_avalot->_userMovesAvvy = true; - _vm->_animation->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); + _vm->_avalot->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); if (curSeq == 177) shoveLeft(); break; diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index c1461c696c73..a160b58a7e30 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -46,7 +46,7 @@ class Sequence { void firstShow(byte what); void thenShow(byte what); - void thenFlip(byte where, byte ped); + void thenFlip(Room where, byte ped); void startToClose(); void startToOpen(); void callSequencer(); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index ae9481c9c1b0..425feeaaf6ff 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -324,7 +324,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_avalot->_whereIs[kPeopleRobinHood - 150] = kRoomRobins; + _vm->_avalot->setRoom(kPeopleRobinHood, kRoomRobins); _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); @@ -336,7 +336,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); - _vm->_avalot->_whereIs[kPeopleFriarTuck - 150] = kRoomRobins; + _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomRobins); _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -351,7 +351,7 @@ void Timer::hangAround2() { void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_animation->flipRoom(_vm->_avalot->_room, 1); + _vm->_avalot->flipRoom(_vm->_avalot->_room, 1); _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); @@ -400,7 +400,7 @@ void Timer::jacquesWakesUp() { case 3 : // Gone through the door. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. - _vm->_avalot->_whereIs[kPeopleJacques - 150] = 0; // Gone! + _vm->_avalot->setRoom(kPeopleJacques, kRoomNowhere); // Gone! break; } From 29db14c7ddac3ba0afbe9f40c3f9219392c86f53 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 22 Sep 2013 23:28:32 -0500 Subject: [PATCH 1107/1332] ZVISION: Don't cast away const-ness --- engines/zvision/animation_control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index f80faea0f934..bb810a86d0be 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -118,7 +118,7 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { delete tranposedFrame; } } else { - renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); + renderManager->copyRectToWorkingWindow((const uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, _animation.rlf->width(), subRect.width(), subRect.height()); // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { @@ -202,7 +202,7 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) { delete tranposedFrame; } } else { - renderManager->copyRectToWorkingWindow((uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); + renderManager->copyRectToWorkingWindow((const uint16 *)frame->getBasePtr(frame->w - subRect.width(), frame->h - subRect.height()), subRect.left, subRect.top, frame->w, subRect.width(), subRect.height()); // If the background can move, we need to cache the last frame so it can be rendered during background movement if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { From 3ae30372bcf3bff39f8d4fd0df65536bc589ae8f Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 24 Sep 2013 18:25:53 +0200 Subject: [PATCH 1108/1332] AVALANCHE: Repair bug regarding uninitialized direction in Avalot. Some renaming in Animation. --- engines/avalanche/animation.cpp | 6 +++--- engines/avalanche/animation.h | 4 ++-- engines/avalanche/avalot.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 92ebb4bac484..5fd109ad5ca3 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -123,7 +123,7 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { inf.close(); } -void AnimationType::original() { +void AnimationType::reset() { _quick = false; _id = 177; } @@ -362,9 +362,9 @@ Animation::~Animation() { } } -void Animation::loadAnims() { +void Animation::resetAnims() { for (int16 i = 0; i < kSpriteNumbMax; i++) - _sprites[i].original(); + _sprites[i].reset(); } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 47109811b977..47fab38d4c9d 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -74,7 +74,7 @@ class AnimationType { byte _eachStepProc; void init(byte spritenum, bool doCheck, Animation *anim); // Loads & sets up the sprite. - void original(); // Just sets 'quick' to false. + void reset(); // Just sets 'quick' to false. Original name: original(). void draw(); // Drops sprite onto screen. Original: andexor(). void turn(Direction whichway); // Turns character round. void appear(int16 wx, int16 wy, Direction wf); // Switches it on. @@ -119,7 +119,7 @@ class Animation { ~Animation(); void animLink(); - void loadAnims(); // Original: loadtrip(). + void resetAnims(); // Original: loadtrip(). void callSpecial(uint16 which); void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. void stopWalking(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 747604d254f0..9abdd9c13c74 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -361,12 +361,12 @@ void Avalot::setup() { _vm->_parser->_inputTextPos = 0; _vm->_parser->_quote = true; + _vm->_animation->setDirection(kDirStopped); + _vm->_animation->resetAnims(); + drawToolbar(); _vm->_dialogs->setReadyLight(2); - _vm->_animation->setDirection(kDirStopped); - _vm->_animation->loadAnims(); - dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); From b3f6ce975ff7eb50eb775ce3c5113e85e60c1434 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 24 Sep 2013 21:24:52 +0200 Subject: [PATCH 1109/1332] AVALANCHE: Use People enum as a type for several variables, modify functions accordingly --- engines/avalanche/avalot.cpp | 38 ++++++------ engines/avalanche/avalot.h | 85 +++------------------------ engines/avalanche/dialogs.cpp | 4 +- engines/avalanche/enums.h | 107 ++++++++++++++++++++++++++++++++++ engines/avalanche/menu.cpp | 14 ++--- engines/avalanche/parser.cpp | 58 +++++++++--------- engines/avalanche/parser.h | 5 +- 7 files changed, 177 insertions(+), 134 deletions(-) create mode 100644 engines/avalanche/enums.h diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 9abdd9c13c74..90d25421366f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -672,9 +672,9 @@ void Avalot::findPeople(byte room) { for (int i = 1; i < 29; i++) { if (_whereIs[i] == room) { if (i < 25) - _him = i + 150; + _him = (People)(150 + i); else - _her = i + 150; + _her = (People)(150 + i); } } } @@ -1434,9 +1434,9 @@ void Avalot::checkClick() { if (_thinkThing) { _vm->_parser->_thing = _thinks; _vm->_parser->_thing += 49; - _vm->_parser->_person = _vm->_parser->kPardon; + _vm->_parser->_person = kPeoplePardon; } else { - _vm->_parser->_person = _thinks; + _vm->_parser->_person = (People) _thinks; _vm->_parser->_thing = _vm->_parser->kPardon; } callVerb(Parser::kVerbCodeExam); @@ -1702,10 +1702,10 @@ void Avalot::newGame() { avvy->appear(300, 117, kDirRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } - _him = Parser::kPardon; - _her = Parser::kPardon; + _him = kPeoplePardon; + _her = kPeoplePardon; _it = Parser::kPardon; - _lastPerson = Parser::kPardon; // = Pardon? + _lastPerson = kPeoplePardon; // = Pardon? _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; @@ -1743,7 +1743,7 @@ bool Avalot::decreaseMoney(uint16 howmuchby) { return true; } -Common::String Avalot::getName(byte whose) { +Common::String Avalot::getName(People whose) { static const Common::String kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", @@ -1752,20 +1752,20 @@ Common::String Avalot::getName(byte whose) { static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; - if (whose < 175) - return kLads[whose - 150]; + if (whose < kPeopleArkata) + return kLads[whose - kPeopleAvalot]; else - return kLasses[whose - 175]; + return kLasses[whose - kPeopleArkata]; } -byte Avalot::getNameChar(byte whose) { +byte Avalot::getNameChar(People whose) { static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; static const char kLassChar[] = "kG\0xB1o"; - if (whose < 175) - return kLadChar[whose - 150]; + if (whose < kPeopleArkata) + return kLadChar[whose - kPeopleAvalot]; else - return kLassChar[whose - 175]; + return kLassChar[whose - kPeopleArkata]; } Common::String Avalot::getThing(byte which) { @@ -2049,11 +2049,11 @@ void Avalot::openDoor(Room whither, byte ped, byte magicnum) { _vm->_sequence->startToOpen(); } -void Avalot::setRoom(byte persId, Room roomId) { - _whereIs[persId - 150] = roomId; +void Avalot::setRoom(People persId, Room roomId) { + _whereIs[persId - kPeopleAvalot] = roomId; } -Room Avalot::getRoom(byte persId) { - return _whereIs[persId - 150]; +Room Avalot::getRoom(People persId) { + return _whereIs[persId - kPeopleAvalot]; } } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 92cc456b221f..3999c19f255f 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -63,76 +63,6 @@ class Clock { void chime(); }; -enum Color { - kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, - kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, - kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, - kColorWhite -}; - -// CHECKME: kRoomBossKey is a guess -enum Room { - kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, - kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10, - kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14, - kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20, - kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25, - kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29, - kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47, - kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, - kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room -}; - -// Objects you can hold: -enum Object { - kObjectWine = 1, - kObjectMoney, - kObjectBodkin, - kObjectPotion, - kObjectChastity, - kObjectBolt, - kObjectCrossbow, - kObjectLute, - kObjectBadge, - kObjectMushroom, - kObjectKey, - kObjectBell, - kObjectPrescription, - kObjectPen, - kObjectInk, - kObjectClothes, - kObjectHabit, - kObjectOnion, - kObjectDummy = 177 -}; - -// People who hang around this game. -enum People { - // Boys: - kPeopleAvalot = 150, - kPeopleSpludwick = 151, - kPeopleCrapulus = 152, - kPeopleDrDuck = 153, - kPeopleMalagauche = 154, - kPeopleFriarTuck = 155, - kPeopleRobinHood = 156, - kPeopleCwytalot = 157, - kPeopleDuLustie = 158, - kPeopleDuke = 159, - kPeopleDogfood = 160, - kPeopleTrader = 161, - kPeopleIbythneth = 162, - kPeopleAyles = 163, - kPeoplePort = 164, - kPeopleSpurge = 165, - kPeopleJacques = 166, - // Girls: - kPeopleArkata = 175, - kPeopleGeida = 176, - kPeopleInvisible = 177, - kPeopleWisewoman = 178 -}; - static const byte kObjectNum = 18; // always preface with a # static const int16 kCarryLimit = 12; // carry limit @@ -169,7 +99,7 @@ typedef int8 TuneType[31]; struct QuasipedType { byte _whichPed, _foregroundColor, _room, _backgroundColor; - uint16 _who; + People _who; }; #if 0 @@ -346,10 +276,11 @@ class Avalot { Common::String _subject; // What you're talking to them about. byte _subjectNum; // The same thing. bool _keyboardClick; // Is a keyboard click noise wanted? - byte _him, _her, _it; + People _him, _her; + byte _it; int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - byte _lastPerson; // Last person to have been selected using the People menu. + People _lastPerson; // Last person to have been selected using the People menu. bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. bool _isLoaded; // Is it a loaded gamestate? @@ -404,8 +335,8 @@ class Avalot { bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. void hangAroundForAWhile(); - Common::String getName(byte whose); - byte getNameChar(byte whose); + Common::String getName(People whose); + byte getNameChar(People whose); Common::String getThing(byte which); char getThingChar(byte which); Common::String getItem(byte which); // Called get_better in the original. @@ -414,8 +345,8 @@ class Avalot { void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. void flipRoom(Room room, byte ped); - void setRoom(byte persId, Room roomId); - Room getRoom(byte persId); + void setRoom(People persId, Room roomId); + Room getRoom(People persId); private: AvalancheEngine *_vm; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index e9d89c2192fa..68bd2c29b6df 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -954,8 +954,8 @@ void Dialogs::speak(byte who, byte subject) { } void Dialogs::talkTo(byte whom) { - if (_vm->_parser->_person == _vm->_parser->kPardon) { - _vm->_parser->_person = _vm->_avalot->_subjectNum; + if (_vm->_parser->_person == kPeoplePardon) { + _vm->_parser->_person = (People)_vm->_avalot->_subjectNum; _vm->_avalot->_subjectNum = 0; } diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h new file mode 100644 index 000000000000..9965091eb892 --- /dev/null +++ b/engines/avalanche/enums.h @@ -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. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +#ifndef AVALANCHE_ENUMS_H +#define AVALANCHE_ENUMS_H + +namespace Avalanche { +enum Color { + kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, + kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, + kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, + kColorWhite +}; + +// CHECKME: kRoomBossKey is a guess +enum Room { + kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3, + kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10, + kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14, + kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20, + kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25, + kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29, + kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47, + kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71, + kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room +}; + +// Objects you can hold: +enum Object { + kObjectWine = 1, + kObjectMoney, + kObjectBodkin, + kObjectPotion, + kObjectChastity, + kObjectBolt, + kObjectCrossbow, + kObjectLute, + kObjectBadge, + kObjectMushroom, + kObjectKey, + kObjectBell, + kObjectPrescription, + kObjectPen, + kObjectInk, + kObjectClothes, + kObjectHabit, + kObjectOnion, + kObjectDummy = 177 +}; + +// People who hang around this game. +enum People { + // Boys: + kPeopleAvalot = 150, + kPeopleSpludwick = 151, + kPeopleCrapulus = 152, + kPeopleDrDuck = 153, + kPeopleMalagauche = 154, + kPeopleFriarTuck = 155, + kPeopleRobinHood = 156, + kPeopleCwytalot = 157, + kPeopleDuLustie = 158, + kPeopleDuke = 159, + kPeopleDogfood = 160, + kPeopleTrader = 161, + kPeopleIbythneth = 162, + kPeopleAyles = 163, + kPeoplePort = 164, + kPeopleSpurge = 165, + kPeopleJacques = 166, + // Girls: + kPeopleArkata = 175, + kPeopleGeida = 176, + kPeopleInvisible = 177, + kPeopleWisewoman = 178, + // + kPeoplePardon = 254, + kPeopleNone = 0 +}; + +} // End of namespace Avalanche + +#endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 6af0e7942939..0686fbbf4420 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -451,9 +451,9 @@ void Menu::setupMenuPeople() { _activeMenuItem.reset(); - for (int i = 150; i <= 178; i++) { - if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) { - _activeMenuItem.setupOption(_vm->_avalot->getName(i), _vm->_avalot->getNameChar(i), "", true); + for (int i = kPeopleAvalot; i <= kPeopleWisewoman; i++) { + if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { + _activeMenuItem.setupOption(_vm->_avalot->getName((People)i), _vm->_avalot->getNameChar((People)i), "", true); people += i; } } @@ -582,7 +582,7 @@ void Menu::runMenuAction() { // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_parser->_person = _vm->_parser->kPardon; + _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; f5Does = _vm->_avalot->f5Does(); _vm->_avalot->callVerb(f5Does[0]); @@ -619,7 +619,7 @@ void Menu::runMenuObjects() { void Menu::runMenuPeople() { _vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson); - _vm->_avalot->_lastPerson = people[_activeMenuItem._choiceNum]; + _vm->_avalot->_lastPerson = (People)people[_activeMenuItem._choiceNum]; } void Menu::runMenuWith() { @@ -631,7 +631,7 @@ void Menu::runMenuWith() { if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) _vm->_parser->_person = _vm->_avalot->_lastPerson; else - _vm->_parser->_person = Parser::kPardon; + _vm->_parser->_person = kPeoplePardon; } else { switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer @@ -659,7 +659,7 @@ void Menu::runMenuWith() { _vm->_avalot->callVerb(Parser::kVerbCodeBuy); return; default: - _vm->_parser->_person = _vm->_parser->_thing; + _vm->_parser->_person = (People)_vm->_parser->_thing; _vm->_parser->_thing = Parser::kPardon; _vm->_avalot->_subjectNum = 0; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 8e60a5654ab7..3e318558ef41 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -421,7 +421,7 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_F5: - _person = kPardon; + _person = kPeoplePardon; _thing = kPardon; _vm->_avalot->callVerb(_vm->_avalot->f5Does()[0]); break; @@ -591,7 +591,7 @@ void Parser::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_dialogs->displayText("What?"); } else { if (animate) { - Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName(target).c_str()); + Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName((People)target).c_str()); _vm->_dialogs->displayText(tmpStr); } else { Common::String z = _vm->_avalot->getItem(target); @@ -713,7 +713,7 @@ void Parser::parse() { _verb = kPardon; _thing = kPardon; _thing2 = kPardon; - _person = kPardon; + _person = kPeoplePardon; clearWords(); @@ -868,14 +868,15 @@ void Parser::parse() { } for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. - if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) - _verb = (byte)_thats[i]; - else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { + byte curChar = (byte)_thats[i]; + if ((curChar == 253) || (curChar == 249) || ((1 <= curChar) && (curChar <= 49))) + _verb = curChar; + else if ((50 <= curChar) && (curChar <= 149)) { _thing2 = _thing; - _thing = (byte)_thats[i]; - } else if ((150 <= (byte)_thats[i]) && ((byte)_thats[i] <= 199)) - _person = (byte)_thats[i]; - else if ((byte)_thats[i] == 251) + _thing = curChar; + } else if ((150 <= curChar) && (curChar <= 199)) + _person = (People)curChar; + else if (curChar == 251) _polite = true; } @@ -929,7 +930,7 @@ void Parser::examineObject() { } bool Parser::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPardon) || (_person == 0) || (_vm->_avalot->getRoom(_person) == _vm->_avalot->_room)) + if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->_avalot->getRoom(_person) == _vm->_avalot->_room)) return true; else { Common::String tmpStr; @@ -959,7 +960,8 @@ void Parser::exampers() { if ((_person == kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) _vm->_dialogs->displayScrollChain('Q', 13); - _person = newPerson; + // CHECKME: Present in the original, but it doesn't make sense. + // _person = newPerson; } } @@ -1004,7 +1006,7 @@ void Parser::openBox(bool isOpening) { void Parser::examine() { // EITHER it's an object OR it's an Also OR it's a _person OR it's something else. - if ((_person == kPardon) && (_thing != kPardon)) { + if ((_person == kPeoplePardon) && (_thing != kPardon)) { if (isHolding()) { // Remember: it's been slipped! Ie subtract 49. if ((1 <= _thing) && (_thing <= 49)) // Standard object @@ -1108,7 +1110,7 @@ void Parser::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (int i = 151; i < 179; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) + if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) numPeople++; } @@ -1118,14 +1120,14 @@ void Parser::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (int i = 151; i < 179; i++) { - if (_vm->_avalot->getRoom(i) == _vm->_avalot->_room) { + if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { actPerson++; if (actPerson == 1) // First on the list. - tmpStr = _vm->_avalot->getName(i + 150); + tmpStr = _vm->_avalot->getName((People)i); else if (actPerson < numPeople) // The middle... - tmpStr += ", " + _vm->_avalot->getName(i + 150); + tmpStr += ", " + _vm->_avalot->getName((People)i); else // The end. - tmpStr += " and " + _vm->_avalot->getName(i + 150); + tmpStr += " and " + _vm->_avalot->getName((People)i); } } @@ -1185,7 +1187,7 @@ void Parser::openDoor() { if (_vm->_animation->inField(1)) { // Opening the box. _thing = 54; // The box. - _person = kPardon; + _person = kPeoplePardon; examine(); return; } @@ -1551,8 +1553,8 @@ void Parser::winSequence() { } Common::String Parser::personSpeaks() { - if ((_person == kPardon) || (_person == 0)) { - if ((_vm->_avalot->_him == kPardon) || (_vm->_avalot->getRoom(_vm->_avalot->_him) != _vm->_avalot->_room)) + if ((_person == kPeoplePardon) || (_person == kPeopleNone)) { + if ((_vm->_avalot->_him == kPeoplePardon) || (_vm->_avalot->getRoom(_vm->_avalot->_him) != _vm->_avalot->_room)) _person = _vm->_avalot->_her; else _person = _vm->_avalot->_him; @@ -1642,7 +1644,7 @@ void Parser::doThat() { else getProc(_thing); } else { // Not... ditto. - if (_person != kPardon) + if (_person != kPeoplePardon) _vm->_dialogs->displayText("You can't sweep folk off their feet!"); else _vm->_dialogs->displayText("I assure you, you don't need it."); @@ -1656,7 +1658,7 @@ void Parser::doThat() { inventory(); break; case kVerbCodeTalk: - if (_person == kPardon) { + if (_person == kPeoplePardon) { if (_vm->_avalot->_subjectNum == 99) { // They typed "say password". Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); @@ -1670,9 +1672,9 @@ void Parser::doThat() { doThat(); return; } else { - _person = _vm->_avalot->_subjectNum; + _person = (People)_vm->_avalot->_subjectNum; _vm->_avalot->_subjectNum = 0; - if ((_person == 0) || (_person == kPardon)) + if ((_person == kPeopleNone) || (_person == kPeoplePardon)) _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) _vm->_dialogs->talkTo(_person); @@ -1682,7 +1684,7 @@ void Parser::doThat() { break; case kVerbCodeGive: if (isHolding()) { - if (_person == kPardon) + if (_person == kPeoplePardon) _vm->_dialogs->displayText("Give to whom?"); else if (isPersonHere()) { switch (_thing) { @@ -2221,7 +2223,7 @@ void Parser::doThat() { standUp(); break; case kVerbCodeKiss: - if (_person == kPardon) + if (_person == kPeoplePardon) _vm->_dialogs->displayText("Kiss whom?"); else if (isPersonHere()) { switch (_person) { @@ -2258,7 +2260,7 @@ void Parser::doThat() { case kVerbCodeWake: if (isPersonHere()) switch (_person) { - case kPardon: + case kPeoplePardon: case kPeopleAvalot: case 0: if (!_vm->_avalot->_avvyIsAwake) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 30b5929fb5f9..a0e26817d673 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -28,6 +28,8 @@ #ifndef AVALANCHE_PARSER_H #define AVALANCHE_PARSER_H +#include "avalanche/enums.h" + #include "common/events.h" #include "common/scummsys.h" #include "common/str.h" @@ -71,7 +73,8 @@ class Parser { VocabEntry _vocabulary[kParserWordsNum]; Common::String _realWords[11]; - byte _verb, _person, _thing; + byte _verb, _thing; + People _person; bool _polite; Common::String _inputText; // Original name: current Common::String _inputTextBackup; From b4a81fc2ac46484f9111eccb099562c3cfa5fc0f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 24 Sep 2013 22:36:57 +0200 Subject: [PATCH 1110/1332] AVALANCHE: Use enum for verbs --- engines/avalanche/avalot.cpp | 23 ++++++------ engines/avalanche/avalot.h | 2 +- engines/avalanche/enums.h | 65 ++++++++++++--------------------- engines/avalanche/menu.cpp | 71 ++++++++++++++++++------------------ engines/avalanche/parser.cpp | 17 +++++---- engines/avalanche/parser.h | 16 +------- engines/avalanche/timer.cpp | 2 +- 7 files changed, 86 insertions(+), 110 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 90d25421366f..5d182341bc7a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -37,6 +37,7 @@ #include "avalanche/timer.h" #include "avalanche/background.h" #include "avalanche/closing.h" +#include "avalanche/enums.h" #include "common/file.h" #include "common/random.h" @@ -469,7 +470,7 @@ void Avalot::init() { * Call a given Verb * @remarks Originally called 'callverb' */ -void Avalot::callVerb(byte id) { +void Avalot::callVerb(VerbCode id) { if (id == _vm->_parser->kPardon) { Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ @@ -1439,13 +1440,13 @@ void Avalot::checkClick() { _vm->_parser->_person = (People) _thinks; _vm->_parser->_thing = _vm->_parser->kPardon; } - callVerb(Parser::kVerbCodeExam); + callVerb(kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { _vm->updateEvents(); } while (_holdLeftMouse); - callVerb(Parser::kVerbCodeScore); + callVerb(kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. _vm->_animation->_sprites[0]._speedX = kWalk; _vm->_animation->updateSpeed(); @@ -1864,29 +1865,29 @@ Common::String Avalot::f5Does() { switch (_room) { case kRoomYours: if (!_avvyIsAwake) - return Common::String::format("%cWWake up", Parser::kVerbCodeWake); + return Common::String::format("%cWWake up", kVerbCodeWake); else if (_avvyInBed) - return Common::String::format("%cGGet up", Parser::kVerbCodeStand); + return Common::String::format("%cGGet up", kVerbCodeStand); break; case kRoomInsideCardiffCastle: if (_standingOnDais) - return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb); + return Common::String::format("%cCClimb down", kVerbCodeClimb); else - return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb); + return Common::String::format("%cCClimb up", kVerbCodeClimb); break; case kRoomNottsPub: if (_sittingInPub) - return Common::String::format("%cSStand up", Parser::kVerbCodeStand); + return Common::String::format("%cSStand up", kVerbCodeStand); else - return Common::String::format("%cSSit down", Parser::kVerbCodeSit); + return Common::String::format("%cSSit down", kVerbCodeSit); break; case kRoomMusicRoom: if (_vm->_animation->inField(5)) - return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay); + return Common::String::format("%cPPlay the harp", kVerbCodePlay); break; } - return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails... + return Common::String::format("%c", kVerbCodePardon); // If all else fails... } void Avalot::loadMouse(byte which) { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 3999c19f255f..ae4024a588d1 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -291,7 +291,7 @@ class Avalot { void runAvalot(); void init(); - void callVerb(byte id); + void callVerb(VerbCode id); void drawAlsoLines(); void loadRoom(byte num); void exitRoom(byte x); diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 9965091eb892..c3c9a54480d4 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -51,55 +51,38 @@ enum Room { // Objects you can hold: enum Object { - kObjectWine = 1, - kObjectMoney, - kObjectBodkin, - kObjectPotion, - kObjectChastity, - kObjectBolt, - kObjectCrossbow, - kObjectLute, - kObjectBadge, - kObjectMushroom, - kObjectKey, - kObjectBell, - kObjectPrescription, - kObjectPen, - kObjectInk, - kObjectClothes, - kObjectHabit, - kObjectOnion, - kObjectDummy = 177 + kObjectWine = 1, kObjectMoney, kObjectBodkin, kObjectPotion, kObjectChastity, + kObjectBolt, kObjectCrossbow, kObjectLute, kObjectBadge, kObjectMushroom, + kObjectKey, kObjectBell, kObjectPrescription, kObjectPen, kObjectInk, + kObjectClothes, kObjectHabit, kObjectOnion, kObjectDummy = 177 }; // People who hang around this game. enum People { // Boys: - kPeopleAvalot = 150, - kPeopleSpludwick = 151, - kPeopleCrapulus = 152, - kPeopleDrDuck = 153, - kPeopleMalagauche = 154, - kPeopleFriarTuck = 155, - kPeopleRobinHood = 156, - kPeopleCwytalot = 157, - kPeopleDuLustie = 158, - kPeopleDuke = 159, - kPeopleDogfood = 160, - kPeopleTrader = 161, - kPeopleIbythneth = 162, - kPeopleAyles = 163, - kPeoplePort = 164, - kPeopleSpurge = 165, + kPeopleAvalot = 150, kPeopleSpludwick = 151, kPeopleCrapulus = 152, kPeopleDrDuck = 153, + kPeopleMalagauche = 154, kPeopleFriarTuck = 155, kPeopleRobinHood = 156, kPeopleCwytalot = 157, + kPeopleDuLustie = 158, kPeopleDuke = 159, kPeopleDogfood = 160, kPeopleTrader = 161, + kPeopleIbythneth = 162, kPeopleAyles = 163, kPeoplePort = 164, kPeopleSpurge = 165, kPeopleJacques = 166, // Girls: - kPeopleArkata = 175, - kPeopleGeida = 176, - kPeopleInvisible = 177, - kPeopleWisewoman = 178, + kPeopleArkata = 175, kPeopleGeida = 176, kPeopleInvisible = 177, kPeopleWisewoman = 178, // - kPeoplePardon = 254, - kPeopleNone = 0 + kPeoplePardon = 254, kPeopleNone = 0 +}; + +enum VerbCode { + kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, + kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, + kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, + kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, + kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, + kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, + kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, + kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, + kVerbCodeHello = 46, kVerbCodeThanks = 47, + kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253, kVerbCodePardon = 254 }; } // End of namespace Avalanche diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 0686fbbf4420..42a787e04646 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -266,26 +266,26 @@ void Menu::findWhatYouCanDoWithIt() { case kObjectWine: case kObjectPotion: case kObjectInk: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; break; case kObjectBell: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; break; case kObjectChastity: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; case kObjectLute: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; break; case kObjectMushroom: case kObjectOnion: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; break; case kObjectClothes: - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; default: - _vm->_avalot->_verbStr = Parser::kVerbCodeExam; // Anything else. + _vm->_avalot->_verbStr = kVerbCodeExam; // Anything else. } } @@ -492,21 +492,21 @@ void Menu::setupMenuWith() { _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeGive; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); - _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; + _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; switch (_vm->_avalot->_thinks) { case kPeopleGeida: case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeKiss; break; case kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay; + _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodePlay; break; case kPeopleMalagauche: { bool isSober = !_vm->_avalot->_teetotal; @@ -531,19 +531,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(Parser::kVerbCodeHelp); + _vm->_avalot->callVerb(kVerbCodeHelp); break; case 1: - _vm->_avalot->callVerb(Parser::kVerbCodeBoss); + _vm->_avalot->callVerb(kVerbCodeBoss); break; case 2: _vm->_avalot->majorRedraw(); break; case 3: - _vm->_avalot->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(kVerbCodeScore); break; case 4: - _vm->_avalot->callVerb(Parser::kVerbCodeInfo); + _vm->_avalot->callVerb(kVerbCodeInfo); break; } } @@ -552,17 +552,17 @@ void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(Parser::kVerbCodeRestart); + _vm->_avalot->callVerb(kVerbCodeRestart); break; case 1: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(Parser::kVerbCodeLoad); + _vm->_avalot->callVerb(kVerbCodeLoad); break; case 2: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(Parser::kVerbCodeSave); + _vm->_avalot->callVerb(kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -572,34 +572,35 @@ void Menu::runMenuFile() { //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - _vm->_avalot->callVerb(Parser::kVerbCodeQuit); + _vm->_avalot->callVerb(kVerbCodeQuit); break; } } void Menu::runMenuAction() { - Common::String f5Does; // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { - case 0: + case 0: { _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; - f5Does = _vm->_avalot->f5Does(); - _vm->_avalot->callVerb(f5Does[0]); + Common::String f5Does = _vm->_avalot->f5Does(); + VerbCode verb = (VerbCode)f5Does[0]; + _vm->_avalot->callVerb(verb); + } break; case 1: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(Parser::kVerbCodePause); + _vm->_avalot->callVerb(kVerbCodePause); break; case 2: - _vm->_avalot->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(kVerbCodeOpen); break; case 3: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(Parser::kVerbCodeLook); + _vm->_avalot->callVerb(kVerbCodeLook); break; case 4: - _vm->_avalot->callVerb(Parser::kVerbCodeInv); + _vm->_avalot->callVerb(kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -628,7 +629,7 @@ void Menu::runMenuWith() { if (_vm->_avalot->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) + if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) _vm->_parser->_person = _vm->_avalot->_lastPerson; else _vm->_parser->_person = kPeoplePardon; @@ -636,27 +637,27 @@ void Menu::runMenuWith() { switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 102: // Whisky _vm->_parser->_thing = 102; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 103: // Cider _vm->_parser->_thing = 103; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 104: // Mead _vm->_parser->_thing = 107; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; case 105: // Onion (trader) _vm->_parser->_thing = 67; - _vm->_avalot->callVerb(Parser::kVerbCodeBuy); + _vm->_avalot->callVerb(kVerbCodeBuy); return; default: _vm->_parser->_person = (People)_vm->_parser->_thing; @@ -664,7 +665,7 @@ void Menu::runMenuWith() { _vm->_avalot->_subjectNum = 0; } } - _vm->_avalot->callVerb(_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); + _vm->_avalot->callVerb((VerbCode)_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 3e318558ef41..0685bcf6d470 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -420,13 +420,16 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { - case Common::KEYCODE_F5: + case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; - _vm->_avalot->callVerb(_vm->_avalot->f5Does()[0]); + Common::String f5does = _vm->_avalot->f5Does(); + VerbCode verb = (VerbCode)f5does[0]; + _vm->_avalot->callVerb(verb); + } break; case Common::KEYCODE_F7: - _vm->_avalot->callVerb(Parser::kVerbCodeOpen); + _vm->_avalot->callVerb(kVerbCodeOpen); break; default: break; @@ -710,7 +713,7 @@ void Parser::parse() { byte n = 0; _polite = false; - _verb = kPardon; + _verb = kVerbCodePardon; _thing = kPardon; _thing2 = kPardon; _person = kPeoplePardon; @@ -870,7 +873,7 @@ void Parser::parse() { for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. byte curChar = (byte)_thats[i]; if ((curChar == 253) || (curChar == 249) || ((1 <= curChar) && (curChar <= 49))) - _verb = curChar; + _verb = (VerbCode)curChar; else if ((50 <= curChar) && (curChar <= 149)) { _thing2 = _thing; _thing = curChar; @@ -1668,7 +1671,7 @@ void Parser::doThat() { for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = _vm->_avalot->_subjectNum; + _verb = (VerbCode)_vm->_avalot->_subjectNum; doThat(); return; } else { @@ -2310,7 +2313,7 @@ void Parser::doThat() { _vm->_avalot->dawn(); } break; - case kPardon: + case kVerbCodePardon: _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index a0e26817d673..e45d668b46a2 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -41,19 +41,6 @@ class AvalancheEngine; class Parser { public: - enum VerbCode { - kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, - kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, - kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, - kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, - kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, - kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, - kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, - kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, - kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, - kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 - }; - static const byte kPardon = 254; // Didn't understand / wasn't given. static const int16 kParserWordsNum = 277; // How many words does the parser know? static const byte kNothing = 250; @@ -73,7 +60,8 @@ class Parser { VocabEntry _vocabulary[kParserWordsNum]; Common::String _realWords[11]; - byte _verb, _thing; + VerbCode _verb; + byte _thing; People _person; bool _polite; Common::String _inputText; // Original name: current diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 425feeaaf6ff..342ed7b8bc91 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -658,7 +658,7 @@ void Timer::winning() { #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_avalot->callVerb(Parser::kVerbCodeScore); + _vm->_avalot->callVerb(kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); _vm->_avalot->_letMeOut = true; } From dfb37fb2f0f38b489d15df56ae71b261d0c0229c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 24 Sep 2013 17:32:58 -0500 Subject: [PATCH 1111/1332] ZVISION: Remove CLIPs from mutateImage Due to the math of the Panorama/Tilt, all pixel offsets are going to be closer to the center of the image. Also, mutateImage is now being called on a finished buffer, rather than an image at a time. Therefore, it no longer has to handle image wrapping. Thus, there is no case in which a pixel offset would be outside the image bounds. --- engines/zvision/render_table.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index dc5ebdb7919b..19f95a5d8f6f 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -113,12 +113,6 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 d // RenderTable only stores offsets from the original coordinates uint32 sourceYIndex = y + _internalBuffer[index].y; uint32 sourceXIndex = x + _internalBuffer[index].x; - - // Clamp the yIndex to the size of the image - sourceYIndex = CLIP(sourceYIndex, 0, _numRows - 1); - - // Clamp the xIndex to the size of the image - sourceXIndex = CLIP(sourceXIndex, 0, _numColumns - 1); destBuffer[destOffset + normalizedX] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; } From 929dcd42f5a3dfb233df545ee6434a71511e5174 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 07:18:08 +0200 Subject: [PATCH 1112/1332] AVALANCHE: Reduce verbosity in Background, remove a useless variable --- engines/avalanche/animation.cpp | 112 +++++++++++++++---------------- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/avalot.cpp | 52 +++++++------- engines/avalanche/background.cpp | 64 +++++++++--------- engines/avalanche/background.h | 8 +-- engines/avalanche/parser.cpp | 39 ++++++----- engines/avalanche/parser.h | 1 - engines/avalanche/sequence.cpp | 2 +- engines/avalanche/timer.cpp | 26 +++---- 9 files changed, 153 insertions(+), 155 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5fd109ad5ca3..1369031bffc5 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -448,59 +448,59 @@ void Animation::catacombMove(byte ped) { _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); + _vm->_background->draw(-1, -1, 27); break; case 0x1: // no connection (wall + shield), _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x2: // wall with door _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 29); // ...door, and... + _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 29); // ...door, and... + _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... - _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. + _vm->_background->draw(-1, -1, 27); // Wall, plus... + _vm->_background->draw(-1, -1, 29); // ...door, and... + _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall. @@ -515,44 +515,44 @@ void Animation::catacombMove(byte ped) { _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); + _vm->_background->draw(-1, -1, 18); break; case 0x1: // no connection (wall + window), _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window. + _vm->_background->draw(-1, -1, 18); // Wall, plus... + _vm->_background->draw(-1, -1, 19); // ...window. break; case 0x2: // wall with door _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door. + _vm->_background->draw(-1, -1, 18); // Wall, plus... + _vm->_background->draw(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and... - _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window. + _vm->_background->draw(-1, -1, 18); // Wall, plus... + _vm->_background->draw(-1, -1, 19); // ...door, and... + _vm->_background->draw(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. + _vm->_background->draw(-1, -1, 18); // Wall, plus... + _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... - _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and... - _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. + _vm->_background->draw(-1, -1, 18); // Wall, plus... + _vm->_background->draw(-1, -1, 20); // ...door, and... + _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. _vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall. @@ -568,7 +568,7 @@ void Animation::catacombMove(byte ped) { _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; break; case 0x1: - _vm->_background->drawBackgroundSprite(-1, -1, 21); + _vm->_background->draw(-1, -1, 21); if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows)) _vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim; @@ -579,13 +579,13 @@ void Animation::catacombMove(byte ped) { _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; break; case 0x2: - _vm->_background->drawBackgroundSprite(-1, -1, 22); + _vm->_background->draw(-1, -1, 22); _vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south. _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; break; case 0x3: - _vm->_background->drawBackgroundSprite(-1, -1, 23); + _vm->_background->draw(-1, -1, 23); _vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south. _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; @@ -606,7 +606,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x2: - _vm->_background->drawBackgroundSprite(-1, -1, 3); + _vm->_background->draw(-1, -1, 3); _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; @@ -624,7 +624,7 @@ void Animation::catacombMove(byte ped) { break; #endif case 0x5: - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; @@ -639,12 +639,12 @@ void Animation::catacombMove(byte ped) { case 0x7: case 0x8: case 0x9: - _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->draw(-1, -1, 5); if (((here & 0xf000) >> 12) > 0x7) - _vm->_background->drawBackgroundSprite(-1, -1, 30); + _vm->_background->draw(-1, -1, 30); if (((here & 0xf000) >> 12) == 0x9) - _vm->_background->drawBackgroundSprite(-1, -1, 31); + _vm->_background->draw(-1, -1, 31); _vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north. _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. @@ -653,50 +653,50 @@ void Animation::catacombMove(byte ped) { case 0xd: // No connection + WINDOW _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 13); + _vm->_background->draw(-1, -1, 13); break; case 0xe: // No connection + TORCH _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. - _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->draw(-1, -1, 7); break; // Recessed door: case 0xf: _vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room. - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. break; } switch (xy_uint16) { case 514: - _vm->_background->drawBackgroundSprite(-1, -1, 16); + _vm->_background->draw(-1, -1, 16); break; // [2,2] : "Art Gallery" sign over door. case 264: - _vm->_background->drawBackgroundSprite(-1, -1, 8); + _vm->_background->draw(-1, -1, 8); break; // [8,1] : "The Wrong Way!" sign. case 1797: - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); break; // [5,7] : "Ite Mingite" sign. case 258: for (int i = 0; i <= 2; i++) { // [2,1] : Art gallery - pictures - _vm->_background->drawBackgroundSprite(130 + i * 120, 70, 14); - _vm->_background->drawBackgroundSprite(184 + i * 120, 78, 15); + _vm->_background->draw(130 + i * 120, 70, 14); + _vm->_background->draw(184 + i * 120, 78, 15); } break; case 1287: for (int i = 10; i <= 13; i++) - _vm->_background->drawBackgroundSprite(-1, -1, i - 1); + _vm->_background->draw(-1, -1, i - 1); break; // [7,5] : 4 candles. case 776: - _vm->_background->drawBackgroundSprite(-1, -1, 9); + _vm->_background->draw(-1, -1, 9); break; // [8,3] : 1 candle. case 2049: - _vm->_background->drawBackgroundSprite(-1, -1, 10); + _vm->_background->draw(-1, -1, 10); break; // [1,8] : another candle. case 257: - _vm->_background->drawBackgroundSprite(-1, -1, 11); - _vm->_background->drawBackgroundSprite(-1, -1, 12); + _vm->_background->draw(-1, -1, 11); + _vm->_background->draw(-1, -1, 12); break; // [1,1] : the other two. } @@ -717,7 +717,7 @@ void Animation::dawnDelay() { void Animation::callSpecial(uint16 which) { switch (which) { case 1: // _vm->_avalot->special 1: Room 22: top of stairs. - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); _vm->_avalot->_brummieStairs = 1; _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); @@ -764,7 +764,7 @@ void Animation::callSpecial(uint16 which) { _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); _vm->_avalot->_tiedUp = true; _vm->_avalot->_friarWillTieYouUp = false; @@ -979,7 +979,7 @@ void Animation::arrowProcs(byte tripnum) { } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. + _vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up. } @@ -1189,7 +1189,7 @@ void Animation::hideInCupboard() { "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); _vm->_avalot->_avvysInTheCupboard = true; - _vm->_background->drawBackgroundSprite(-1, -1, 7); + _vm->_background->draw(-1, -1, 7); } } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 4e92901cf8c3..07203411df71 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -416,7 +416,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _avalot->dawn(); } - _background->forgetBackgroundSprites(); + _background->release(); _avalot->minorRedraw(); _menu->setup(); _avalot->setRoom(kPeopleAvalot, _avalot->_room); @@ -426,7 +426,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _avalot->drawDirection(); _avalot->_onToolbar = false; _animation->animLink(); - _background->updateBackgroundSprites(); + _background->update(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5d182341bc7a..e0881ac1cd5c 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -404,7 +404,7 @@ void Avalot::runAvalot() { _clock.update(); _vm->_menu->update(); - _vm->_background->updateBackgroundSprites(); + _vm->_background->update(); _vm->_animation->animLink(); checkClick(); _vm->_timer->updateTimer(); @@ -643,7 +643,7 @@ void Avalot::loadRoom(byte num) { file.close(); loadAlso(num); - _vm->_background->loadBackgroundSprites(num); + _vm->_background->load(num); CursorMan.showMouse(true); } @@ -682,7 +682,7 @@ void Avalot::findPeople(byte room) { void Avalot::exitRoom(byte x) { _vm->_sound->stopSound(); - _vm->_background->forgetBackgroundSprites(); + _vm->_background->release(); _seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { @@ -782,7 +782,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { switch (roomId) { case kRoomYours: if (_avvyInBed) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } @@ -880,7 +880,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomBridge: if (_drawbridgeOpen == 4) { // open - _vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge + _vm->_background->draw(-1, -1, 2); // Position of drawbridge _vm->_graphics->refreshBackground(); _magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. } @@ -904,10 +904,10 @@ void Avalot::enterRoom(Room roomId, byte ped) { } if (_tiedUp) - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); if (!_mushroomGrowing) - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); break; @@ -979,11 +979,11 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomArgentPub: if (_wonNim) - _vm->_background->drawBackgroundSprite(-1, -1, 0); // No lute by the settle. + _vm->_background->draw(-1, -1, 0); // No lute by the settle. _malagauche = 0; // Ready to boot Malagauche if (_givenBadgeToIby) { - _vm->_background->drawBackgroundSprite(-1, -1, 7); - _vm->_background->drawBackgroundSprite(-1, -1, 8); + _vm->_background->draw(-1, -1, 7); + _vm->_background->draw(-1, -1, 8); } _vm->_graphics->refreshBackground(); break; @@ -999,7 +999,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (_geidaFollows) { putGeidaAt(4, ped); if (_lustieIsAsleep) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); + _vm->_background->draw(-1, -1, 4); _vm->_graphics->refreshBackground(); } } @@ -1008,14 +1008,14 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomMusicRoom: if (_jacquesState > 0) { _jacquesState = 5; - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_background->drawBackgroundSprite(-1, -1, 3); + _vm->_background->draw(-1, -1, 3); _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; _whereIs[kPeopleJacques - 150] = kRoomNowhere; } if (ped != 0) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->draw(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -1026,7 +1026,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomOutsideNottsPub: if (ped == 2) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->thenShow(2); @@ -1038,7 +1038,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomOutsideArgentPub: if (ped == 2) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->draw(-1, -1, 5); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(6); _vm->_sequence->thenShow(5); @@ -1066,7 +1066,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(1); if (_arrowInTheDoor) @@ -1075,22 +1075,22 @@ void Avalot::enterRoom(Room roomId, byte ped) { _vm->_sequence->thenShow(2); if (_takenPen) - _vm->_background->drawBackgroundSprite(-1, -1, 3); + _vm->_background->draw(-1, -1, 3); _vm->_sequence->startToClose(); } else { - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); if (_arrowInTheDoor) - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); else - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); } break; case kRoomAvvysGarden: if (ped == 1) { - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -1111,7 +1111,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { _vm->_sequence->start_to_close(); #endif - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(2); _vm->_sequence->thenShow(1); @@ -1122,7 +1122,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomAylesOffice: if (_aylesIsAwake) - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); break; // Ayles awake. @@ -1143,14 +1143,14 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomNottsPub: if (_sittingInPub) - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _npcFacing = 1; // Port. break; case kRoomOutsideDucks: if (ped == 2) { // Shut the door - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->firstShow(3); _vm->_sequence->firstShow(2); diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 9da9161110e8..b243078859a8 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -43,32 +43,32 @@ Background::Background(AvalancheEngine *vm) { } Background::~Background() { - forgetBackgroundSprites(); + release(); } /** * @remarks Originally called 'pics_link' */ -void Background::updateBackgroundSprites() { +void Background::update() { if (_vm->_menu->isActive()) return; // No animation when the menus are up. switch (_vm->_avalot->_room) { case kRoomOutsideArgentPub: if ((_vm->_avalot->_roomTime % 12) == 0) - drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 4); + draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 4); break; case kRoomBrummieRoad: if ((_vm->_avalot->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 2) % 4); + draw(-1, -1, (_vm->_avalot->_roomTime / 2) % 4); break; case kRoomBridge: if ((_vm->_avalot->_roomTime % 2) == 0) - drawBackgroundSprite(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4); + draw(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4); break; case kRoomYours: if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0)) - drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 2); + draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 2); break; case kRoomArgentPub: if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) { @@ -78,16 +78,16 @@ void Background::updateBackgroundSprites() { case 1: case 11: case 21: - drawBackgroundSprite(-1, -1, 11); // Looks forwards. + draw(-1, -1, 11); // Looks forwards. break; case 8: case 18: case 28: case 32: - drawBackgroundSprite(-1, -1, 10); // Looks at you. + draw(-1, -1, 10); // Looks at you. break; case 30: - drawBackgroundSprite(-1, -1, 12); // Winks. + draw(-1, -1, 12); // Winks. break; case 33: _vm->_avalot->_malagauche = 0; @@ -98,14 +98,14 @@ void Background::updateBackgroundSprites() { switch (_vm->_avalot->_roomTime % 200) { case 179: case 197: - drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle. + draw(-1, -1, 4); // Dogfood's drinking cycle. break; case 182: case 194: - drawBackgroundSprite(-1, -1, 5); + draw(-1, -1, 5); break; case 185: - drawBackgroundSprite(-1, -1, 6); + draw(-1, -1, 6); break; case 199: _vm->_avalot->_npcFacing = 177; // Impossible value for this. @@ -123,7 +123,7 @@ void Background::updateBackgroundSprites() { direction = 4; if (direction != _vm->_avalot->_npcFacing) { // Dogfood. - drawBackgroundSprite(-1, -1, direction - 1); + draw(-1, -1, direction - 1); _vm->_avalot->_npcFacing = direction; } } @@ -132,16 +132,16 @@ void Background::updateBackgroundSprites() { if ((_vm->_avalot->_roomTime % 3) == 0) { switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) { case 4: - drawBackgroundSprite(-1, -1, 0); + draw(-1, -1, 0); break; case 1: case 3: case 5: - drawBackgroundSprite(-1, -1, 1); + draw(-1, -1, 1); break; case 0: case 2: - drawBackgroundSprite(-1, -1, 2); + draw(-1, -1, 2); break; } } @@ -161,7 +161,7 @@ void Background::updateBackgroundSprites() { direction = 3; // Right. if (direction != _vm->_avalot->_npcFacing) { // du Lustie. - drawBackgroundSprite(-1, -1, direction - 1); + draw(-1, -1, direction - 1); _vm->_avalot->_npcFacing = direction; } } @@ -170,10 +170,10 @@ void Background::updateBackgroundSprites() { if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) { switch ((_vm->_avalot->_roomTime / 14) % 2) { case 0: - drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA. + draw(-1, -1, 0); // Frame 2: EGA. break; case 1: - drawBackgroundSprite(-1, -1, 2); // Frame 1: Natural. + draw(-1, -1, 2); // Frame 1: Natural. break; } } @@ -182,10 +182,10 @@ void Background::updateBackgroundSprites() { if (_vm->_avalot->_tiedUp) { switch (_vm->_avalot->_roomTime % 54) { case 20: - drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks. + draw(-1, -1, 3); // Frame 4: Avalot blinks. break; case 23: - drawBackgroundSprite(-1, -1, 1); // Frame 1: Back to normal. + draw(-1, -1, 1); // Frame 1: Back to normal. break; } } @@ -205,23 +205,23 @@ void Background::updateBackgroundSprites() { direction--; // Blinks. if (direction != _vm->_avalot->_npcFacing) { // Port. - drawBackgroundSprite(-1, -1, direction - 1); + draw(-1, -1, direction - 1); _vm->_avalot->_npcFacing = direction; } switch (_vm->_avalot->_roomTime % 50) { case 45 : - drawBackgroundSprite(-1, -1, 8); // Spurge blinks. + draw(-1, -1, 8); // Spurge blinks. break; case 49 : - drawBackgroundSprite(-1, -1, 9); + draw(-1, -1, 9); break; } break; } case kRoomDucks: { if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 3) % 3); + draw(-1, -1, (_vm->_avalot->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; @@ -237,7 +237,7 @@ void Background::updateBackgroundSprites() { direction++; // Duck blinks. if (direction != _vm->_avalot->_npcFacing) { // Duck. - drawBackgroundSprite(-1, -1, direction - 1); + draw(-1, -1, direction - 1); _vm->_avalot->_npcFacing = direction; } break; @@ -261,7 +261,7 @@ void Background::updateBackgroundSprites() { } } -void Background::loadBackgroundSprites(byte number) { +void Background::load(byte number) { Common::File f; _filename = _filename.format("chunk%d.avd", number); if (!f.open(_filename)) @@ -276,7 +276,7 @@ void Background::loadBackgroundSprites(byte number) { f.seek(_offsets[i]); SpriteType sprite; - sprite._type = PictureType(f.readByte()); + sprite._type = (PictureType)(f.readByte()); sprite._x = f.readSint16LE(); sprite._y = f.readSint16LE(); sprite._xl = f.readSint16LE(); @@ -311,7 +311,7 @@ void Background::loadBackgroundSprites(byte number) { f.close(); } -void Background::forgetBackgroundSprites() { +void Background::release() { for (int i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); @@ -322,7 +322,7 @@ void Background::forgetBackgroundSprites() { * Draw background animation * @remarks Originally called 'show_one' */ -void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { +void Background::draw(int16 destX, int16 destY, byte sprId) { if (_sprites[sprId]._x > kOnDisk) { if (destX < 0) { destX = _sprites[sprId]._x * 8; @@ -337,13 +337,13 @@ void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) { f.seek(_offsets[sprId]); SpriteType sprite; - sprite._type = PictureType(f.readByte()); + sprite._type = (PictureType)(f.readByte()); sprite._x = f.readSint16LE(); sprite._y = f.readSint16LE(); sprite._xl = f.readSint16LE(); sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); - f.skip(2); // For the now not existing natural and memorize data members of the SpriteType (called chunkblocktype in the original). + f.skip(2); // Natural and Memorize are used in Load() sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index d38106d38fed..8d88cb36a436 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -44,14 +44,14 @@ class Background { Background(AvalancheEngine *vm); ~Background(); - void updateBackgroundSprites(); - void loadBackgroundSprites(byte number); - void forgetBackgroundSprites(); + void update(); + void load(byte number); + void release(); // Setting the destination to negative coordinates means the picture should be drawn to it's original position. // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. - void drawBackgroundSprite(int16 destX, int16 destY, byte sprId); + void draw(int16 destX, int16 destY, byte sprId); private: enum PictureType {kEga, kBgi, kNaturalImage}; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 0685bcf6d470..4abdb3143167 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -46,7 +46,6 @@ Parser::Parser(AvalancheEngine *vm) { } void Parser::init() { - _leftMargin = 0; if (!_inputText.empty()) _inputText.clear(); _inputTextPos = 0; @@ -396,7 +395,7 @@ void Parser::handleBackspace() { if (_vm->_menu->_activeMenuItem._activeNow) return; - if (_inputTextPos > _leftMargin) { + if (_inputTextPos > 0) { _inputTextPos--; if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`')) _quote = !_quote; @@ -990,17 +989,17 @@ bool Parser::isHolding() { void Parser::openBox(bool isOpening) { if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); + _vm->_background->draw(-1, -1, 4); - _vm->_background->updateBackgroundSprites(); + _vm->_background->update(); _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); if (!isOpening) { - _vm->_background->drawBackgroundSprite(-1, -1, 5); - _vm->_background->updateBackgroundSprites(); + _vm->_background->draw(-1, -1, 5); + _vm->_background->update(); _vm->_animation->animLink(); _vm->_graphics->refreshScreen(); } @@ -1432,7 +1431,7 @@ void Parser::standUp() { _vm->_avalot->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->setDirection(kDirLeft); - _vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. + _vm->_background->draw(-1, -1, 3); // Picture of empty pillow. _vm->_avalot->incScore(1); _vm->_avalot->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); @@ -1446,7 +1445,7 @@ void Parser::standUp() { case kRoomNottsPub: if (_vm->_avalot->_sittingInPub) { - _vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down. + _vm->_background->draw(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. _vm->_avalot->_sittingInPub = false; // Really not sitting down. @@ -1464,12 +1463,12 @@ void Parser::getProc(char thing) { case kRoomYours: if (_vm->_animation->inField(1)) { if (_vm->_avalot->_boxContent == thing) { - _vm->_background->drawBackgroundSprite(-1, -1, 4); + _vm->_background->draw(-1, -1, 4); _vm->_dialogs->displayText("OK, I've got it."); _vm->_avalot->_objects[thing - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->_boxContent = kNothing; - _vm->_background->drawBackgroundSprite(-1, -1, 5); + _vm->_background->draw(-1, -1, 5); } else { Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str()); _vm->_dialogs->displayText(tmpStr); @@ -1485,7 +1484,7 @@ void Parser::getProc(char thing) { _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now. + _vm->_background->draw(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! _vm->_avalot->_takenPen = true; _vm->_avalot->_objects[kObjectPen - 1] = true; @@ -1506,7 +1505,7 @@ void Parser::getProc(char thing) { break; case kRoomRobins: if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_dialogs->displayText("Got it!"); _vm->_avalot->_mushroomGrowing = false; _vm->_avalot->_takenMushroom = true; @@ -1726,8 +1725,8 @@ void Parser::doThat() { _vm->_avalot->_objects[kObjectBadge - 1] = false; _vm->_avalot->_objects[kObjectHabit - 1] = true; _vm->_avalot->_givenBadgeToIby = true; - _vm->_background->drawBackgroundSprite(-1, -1, 7); - _vm->_background->drawBackgroundSprite(-1, -1, 8); + _vm->_background->draw(-1, -1, 7); + _vm->_background->draw(-1, -1, 8); } else heyThanks(); break; @@ -1909,7 +1908,7 @@ void Parser::doThat() { _vm->_avalot->_objects[kObjectLute - 1] = true; _vm->_avalot->refreshObjectList(); _vm->_avalot->_wonNim = true; - _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. + _vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it. _vm->_avalot->incScore(7); // 7 points for winning! if (_playedNim == 1) @@ -2070,11 +2069,11 @@ void Parser::doThat() { if (_alcoholLevel == 0) _vm->_avalot->incScore(3); - _vm->_background->drawBackgroundSprite(-1, -1, 11); + _vm->_background->draw(-1, -1, 11); _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); _vm->_avalot->_drinking = _thing; - _vm->_background->drawBackgroundSprite(-1, -1, 9); + _vm->_background->draw(-1, -1, 9); _vm->_avalot->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; @@ -2095,12 +2094,12 @@ void Parser::doThat() { return; } - _vm->_background->drawBackgroundSprite(-1, -1, 11); + _vm->_background->draw(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); if (_alcoholLevel == 0) _vm->_avalot->incScore(3); - _vm->_background->drawBackgroundSprite(-1, -1, 9); + _vm->_background->draw(-1, -1, 9); _vm->_avalot->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); @@ -2270,7 +2269,7 @@ void Parser::doThat() { _vm->_avalot->_avvyIsAwake = true; _vm->_avalot->incScore(1); _vm->_avalot->_avvyInBed = true; - _vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. + _vm->_background->draw(-1, -1, 2); // Picture of Avvy, awake in bed. if (_vm->_avalot->_teetotal) _vm->_dialogs->displayScrollChain('d', 13); } else diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index e45d668b46a2..4ec7fe64b463 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -68,7 +68,6 @@ class Parser { Common::String _inputTextBackup; byte _inputTextPos; // Original name: curpos bool _quote; // 66 or 99 next? - byte _leftMargin; bool _cursorState; byte _wearing; // what you're wearing diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 0d26cbb677c0..61de6b8bf352 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -97,7 +97,7 @@ void Sequence::callSequencer() { } if (curSeq <= 176) { // Show a frame. - _vm->_background->drawBackgroundSprite(-1, -1, curSeq - 1); + _vm->_background->draw(-1, -1, curSeq - 1); shoveLeft(); } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 342ed7b8bc91..52a5bff45317 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -229,7 +229,7 @@ void Timer::loseTimer(byte which) { void Timer::openDrawbridge() { _vm->_avalot->_drawbridgeOpen++; - _vm->_background->drawBackgroundSprite(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); + _vm->_background->draw(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); if (_vm->_avalot->_drawbridgeOpen == 4) _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. @@ -271,7 +271,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_avalot->_brummieStairs = 2; _vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial; _vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs. @@ -389,17 +389,17 @@ void Timer::jacquesWakesUp() { switch (_vm->_avalot->_jacquesState) { // Additional pictures. case 1 : - _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. + _vm->_background->draw(-1, -1, 0); // Eyes open. _vm->_dialogs->displayScrollChain('Q', 45); break; case 2 : // Going through the door. - _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. - _vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door. + _vm->_background->draw(-1, -1, 1); // Not on the floor. + _vm->_background->draw(-1, -1, 2); // But going through the door. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. - _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. - _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. + _vm->_background->draw(-1, -1, 1); // Not on the floor, either. + _vm->_background->draw(-1, -1, 3); // He's gone... so the door's open. _vm->_avalot->setRoom(kPeopleJacques, kRoomNowhere); // Gone! break; } @@ -429,7 +429,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon spr->walkTo(2); // He walks over to you. // Let's get the door opening. - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); @@ -445,7 +445,7 @@ void Timer::naughtyDuke2() { } void Timer::naughtyDuke3() { - _vm->_background->drawBackgroundSprite(-1, -1, 0); + _vm->_background->draw(-1, -1, 0); _vm->_sequence->firstShow(2); _vm->_sequence->startToClose(); } @@ -487,7 +487,7 @@ void Timer::jump() { if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { - _vm->_background->drawBackgroundSprite(-1, -1, 1); + _vm->_background->draw(-1, -1, 1); _vm->_avalot->_arrowInTheDoor = false; // You've got it. _vm->_avalot->_objects[kObjectBolt - 1] = true; _vm->_avalot->refreshObjectList(); @@ -503,7 +503,7 @@ void Timer::crapulusSaysSpludOut() { } void Timer::buyDrinks() { - _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. + _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. _vm->_avalot->_malagauche = 0; _vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it. @@ -515,7 +515,7 @@ void Timer::buyDrinks() { } void Timer::buyWine() { - _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. + _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. _vm->_avalot->_malagauche = 0; _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. @@ -625,7 +625,7 @@ void Timer::avvySitDown() { if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { - _vm->_background->drawBackgroundSprite(-1, -1, 2); + _vm->_background->draw(-1, -1, 2); _vm->_avalot->_sittingInPub = true; _vm->_avalot->_userMovesAvvy = false; avvy->_visible = false; From 5637987bd74c9d5670b6b9b1a2578717abf52dfb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 07:35:56 +0200 Subject: [PATCH 1113/1332] AVALANCHE: Simplify loadMouse() --- engines/avalanche/avalot.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e0881ac1cd5c..c9ffdff98763 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1908,9 +1908,10 @@ void Avalot::loadMouse(byte which) { for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { - for (int k = 0; k < 2; k++) { - if (*(byte *)mask.getBasePtr(i, j) == 0) - *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel == 0) { + *(byte *)cursor.getBasePtr(i, j * 2 ) = 0; + *(byte *)cursor.getBasePtr(i, j * 2 + 1) = 0; } } } @@ -1924,10 +1925,10 @@ void Avalot::loadMouse(byte which) { for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { - for (int k = 0; k < 2; k++) { - byte pixel = *(byte *)mask.getBasePtr(i, j); - if (pixel != 0) - *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel != 0) { + *(byte *)cursor.getBasePtr(i, j * 2 ) = pixel; + *(byte *)cursor.getBasePtr(i, j * 2 + 1) = pixel; } } } From 1b1655d0c859bae76ad2f418eb2f7ef62414f2da Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 07:46:09 +0200 Subject: [PATCH 1114/1332] AVALANCHE: use nullptr for empty pointers --- engines/avalanche/avalot.cpp | 14 +++++++------- engines/avalanche/parser.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c9ffdff98763..b6c3f0b1b9ad 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -264,7 +264,7 @@ Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogati // Needed because of Lucerna::load_also() for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) - _also[i][j] = 0; + _also[i][j] = nullptr; } _totalTime = 0; @@ -273,9 +273,9 @@ Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogati Avalot::~Avalot() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { - if (_also[i][j] != 0) { + if (_also[i][j] != nullptr) { delete _also[i][j]; - _also[i][j] = 0; + _also[i][j] = nullptr; } } } @@ -437,7 +437,7 @@ void Avalot::runAvalot() { void Avalot::init() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) - _also[i][j] = 0; + _also[i][j] = nullptr; } #if 0 @@ -520,7 +520,7 @@ void Avalot::scram(Common::String &str) { void Avalot::unScramble() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { - if (_also[i][j] != 0) + if (_also[i][j] != nullptr) scram(*_also[i][j]); } } @@ -531,9 +531,9 @@ void Avalot::unScramble() { void Avalot::loadAlso(byte num) { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { - if (_also[i][j] != 0) { + if (_also[i][j] != nullptr) { delete _also[i][j]; - _also[i][j] = 0; + _also[i][j] = nullptr; } } } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4abdb3143167..30e08c71c056 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -761,7 +761,7 @@ void Parser::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { for (int i = 0; i < 31; i++) { - if ((_vm->_avalot->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { + if ((_vm->_avalot->_also[i][0]) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; } From 890eed446c628c8087d728dcc0b9bfba74ec4fcc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 07:57:57 +0200 Subject: [PATCH 1115/1332] AVALANCHE: rename a parameter, remove a useless (unitialized) variable, disable some menu entries --- engines/avalanche/avalot.cpp | 4 ++-- engines/avalanche/avalot.h | 3 +-- engines/avalanche/menu.cpp | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b6c3f0b1b9ad..a315d5cc90fc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1734,8 +1734,8 @@ bool Avalot::setFlag(char x) { return false; } -bool Avalot::decreaseMoney(uint16 howmuchby) { - _money -= howmuchby; +bool Avalot::decreaseMoney(uint16 amount) { + _money -= amount; if (_money < 0) { _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" gameOver(); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index ae4024a588d1..bbd01d712353 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -265,7 +265,6 @@ class Avalot { byte _fieldNum; Common::String _flags; Common::String _listen; - Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1". byte _cp, _ledStatus, _defaultLed; FontType _font; bool _alive; @@ -332,7 +331,7 @@ class Avalot { void newGame(); // This sets up the DNA for a completely new game. void slowDown(); bool setFlag(char x); - bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original. + bool decreaseMoney(uint16 amount); // Called pennycheck in the original. void hangAroundForAWhile(); Common::String getName(People whose); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 42a787e04646..c3caec7b5566 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -401,7 +401,7 @@ Common::String Menu::selectGender(byte x) { void Menu::setupMenuGame() { _activeMenuItem.reset(); _activeMenuItem.setupOption("Help...", 'H', "f1", true); - _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", true); + _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", false); _activeMenuItem.setupOption("Untrash screen", 'U', "ctrl-f7", true); _activeMenuItem.setupOption("Score and rank", 'S', "f9", true); _activeMenuItem.setupOption("About Avvy...", 'A', "shift-f10", true); @@ -414,7 +414,7 @@ void Menu::setupMenuFile() { _activeMenuItem.setupOption("Load...", 'L', "^f3", true); _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive); _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive); - _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_avalot->_atKey + '1', true); + _activeMenuItem.setupOption("DOS Shell", 'D', "alt-1", false); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.display(); } From d8bee6be1388167b46811abfbec4102cc768df52 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 25 Sep 2013 02:30:02 -0500 Subject: [PATCH 1116/1332] ZVISION: Set the state value at each frame of a return animation Some Puzzles trigger off the intermediate frames --- engines/zvision/lever_control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 7f0cd401b241..f3d369fbfbcf 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -260,7 +260,6 @@ bool LeverControl::process(uint32 deltaTimeInMillis) { if (_returnRoutesCurrentProgress == _frameInfo[_currentFrame].returnRoute.end()) { _isReturning = false; _currentFrame = _returnRoutesCurrentFrame; - _engine->getScriptManager()->setStateValue(_key, _currentFrame); return false; } @@ -271,6 +270,7 @@ bool LeverControl::process(uint32 deltaTimeInMillis) { _returnRoutesCurrentFrame--; } + _engine->getScriptManager()->setStateValue(_key, _returnRoutesCurrentFrame); renderFrame(_returnRoutesCurrentFrame); } } From cd3dc276d9c3f4b2311e86a65e1f16491bf79961 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 25 Sep 2013 02:30:37 -0500 Subject: [PATCH 1117/1332] ZVISION: Only save a thumbnail of the backbuffer instead of the whole thing --- engines/zvision/save_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 631885e5ae61..08a72648f718 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -104,8 +104,8 @@ void SaveManager::autoSave() { void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { // Create a thumbnail and save it - Graphics::saveThumbnail(*file, *_engine->getRenderManager()->getBackBuffer()); - + Graphics::saveThumbnail(*file); + // Write out the save date/time TimeDate td; g_system->getTimeAndDate(td); From 07c32312146bb7fe5adec41f03a2463893756361 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 25 Sep 2013 02:32:42 -0500 Subject: [PATCH 1118/1332] ZVISION: Remove memory corrupting assignment This was a code error left over from previous changes. We just create a new TextFramgment each time and hand it to List::push_back() --- engines/zvision/string_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index d00ea2136940..d069e28a7673 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -156,7 +156,7 @@ void StringManager::parseTag(const Common::String &tagString, uint lineNumber) { token = tokenizer.nextToken(); } - TextFragment fragment = _inGameText->fragments.back(); + TextFragment fragment; if (fontName.empty()) { fragment.style.font = _lastStyle.font; From 6cd9bd141ce6d94c274d5fe054a36f46d6064aa0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 23:54:35 +0200 Subject: [PATCH 1119/1332] AVALANCHE: Move some variables to Animation, break savegame compatibility --- engines/avalanche/animation.cpp | 78 ++++++++++++++++++++++++++++----- engines/avalanche/animation.h | 3 ++ engines/avalanche/avalanche.cpp | 52 ---------------------- engines/avalanche/avalot.cpp | 3 +- engines/avalanche/avalot.h | 1 - 5 files changed, 72 insertions(+), 65 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 1369031bffc5..662ac520df26 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -414,7 +414,7 @@ void Animation::catacombMove(byte ped) { // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256; - _vm->_avalot->_geidaSpin = 0; + _geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs @@ -1025,20 +1025,20 @@ void Animation::spin(Direction dir, byte &tripnum) { if (_sprites[tripnum]._id == 2) return; // Not for Spludwick - _vm->_avalot->_geidaSpin += 1; - _vm->_avalot->_geidaTime = 20; - if (_vm->_avalot->_geidaSpin == 5) { + _geidaSpin++; + _geidaTime = 20; + if (_geidaSpin == 5) { _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_avalot->_geidaSpin = 0; - _vm->_avalot->_geidaTime = 0; // knock out records + _geidaSpin = 0; + _geidaTime = 0; // knock out records } } void Animation::geidaProcs(byte tripnum) { - if (_vm->_avalot->_geidaTime > 0) { - _vm->_avalot->_geidaTime--; - if (_vm->_avalot->_geidaTime == 0) - _vm->_avalot->_geidaSpin = 0; + if (_geidaTime > 0) { + _geidaTime--; + if (_geidaTime == 0) + _geidaSpin = 0; } if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { @@ -1307,8 +1307,66 @@ Direction Animation::getOldDirection() { return _oldDirection; } +void Animation::resetVariables() { + _geidaSpin = 0; + _geidaTime = 0; +} + void Animation::synchronize(Common::Serializer &sz) { sz.syncAsByte(_direction); + sz.syncAsByte(_geidaSpin); + sz.syncAsByte(_geidaTime); + + byte spriteNum = 0; + if (sz.isSaving()) { + for (int i = 0; i < kSpriteNumbMax; i++) { + if (_sprites[i]._quick) + spriteNum++; + } + } + sz.syncAsByte(spriteNum); + + if (sz.isLoading()) { + for (int i = 0; i < kSpriteNumbMax; i++) { // Deallocate sprites. + AnimationType *spr = &_sprites[i]; + if (spr->_quick) + spr->remove(); + } + } + + for (int i = 0; i < spriteNum; i++) { + AnimationType *spr = &_sprites[i]; + sz.syncAsByte(spr->_id); + sz.syncAsByte(spr->_doCheck); + + if (sz.isLoading()) { + spr->_quick = true; + spr->init(spr->_id, spr->_doCheck, this); + } + + sz.syncAsByte(spr->_moveX); + sz.syncAsByte(spr->_moveY); + sz.syncAsByte(spr->_facingDir); + sz.syncAsByte(spr->_stepNum); + sz.syncAsByte(spr->_visible); + sz.syncAsByte(spr->_homing); + sz.syncAsByte(spr->_count); + sz.syncAsByte(spr->_info._xWidth); + sz.syncAsByte(spr->_speedX); + sz.syncAsByte(spr->_speedY); + sz.syncAsByte(spr->_animCount); + sz.syncAsSint16LE(spr->_homingX); + sz.syncAsSint16LE(spr->_homingY); + sz.syncAsByte(spr->_callEachStepFl); + sz.syncAsByte(spr->_eachStepProc); + sz.syncAsByte(spr->_vanishIfStill); + sz.syncAsSint16LE(spr->_x); + sz.syncAsSint16LE(spr->_y); + + if (sz.isLoading() && spr->_visible) + spr->appear(spr->_x, spr->_y, spr->_facingDir); + } + } } // End of namespace Avalanche. diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 47fab38d4c9d..1b616f9fae90 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -136,11 +136,14 @@ class Animation { Direction getDirection(); Direction getOldDirection(); + void resetVariables(); void synchronize(Common::Serializer &sz); private: Direction _direction; // The direction Avvy is currently facing. Direction _oldDirection; + byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. + AvalancheEngine *_vm; byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 07203411df71..cddb8ba270e4 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -238,8 +238,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_catacombY); sz.syncAsByte(_avalot->_avvysInTheCupboard); sz.syncAsByte(_avalot->_geidaFollows); - sz.syncAsByte(_avalot->_geidaSpin); - sz.syncAsByte(_avalot->_geidaTime); sz.syncAsByte(_avalot->_nextBell); sz.syncAsByte(_avalot->_givenPotionToGeida); sz.syncAsByte(_avalot->_lustieIsAsleep); @@ -253,56 +251,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_givenPenToAyles); sz.syncAsByte(_avalot->_askedDogfoodAboutNim); - byte spriteNum = 0; - if (sz.isSaving()) { - for (int i = 0; i < _animation->kSpriteNumbMax; i++) { - if (_animation->_sprites[i]._quick) - spriteNum++; - } - } - sz.syncAsByte(spriteNum); - - if (sz.isLoading()) { - for (int i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. - AnimationType *spr = &_animation->_sprites[i]; - if (spr->_quick) - spr->remove(); - } - } - - for (int i = 0; i < spriteNum; i++) { - AnimationType *spr = &_animation->_sprites[i]; - sz.syncAsByte(spr->_id); - sz.syncAsByte(spr->_doCheck); - - if (sz.isLoading()) { - spr->_quick = true; - spr->init(spr->_id, spr->_doCheck, _animation); - } - - sz.syncAsByte(spr->_moveX); - sz.syncAsByte(spr->_moveY); - sz.syncAsByte(spr->_facingDir); - sz.syncAsByte(spr->_stepNum); - sz.syncAsByte(spr->_visible); - sz.syncAsByte(spr->_homing); - sz.syncAsByte(spr->_count); - sz.syncAsByte(spr->_info._xWidth); - sz.syncAsByte(spr->_speedX); - sz.syncAsByte(spr->_speedY); - sz.syncAsByte(spr->_animCount); - sz.syncAsSint16LE(spr->_homingX); - sz.syncAsSint16LE(spr->_homingY); - sz.syncAsByte(spr->_callEachStepFl); - sz.syncAsByte(spr->_eachStepProc); - sz.syncAsByte(spr->_vanishIfStill); - sz.syncAsSint16LE(spr->_x); - sz.syncAsSint16LE(spr->_y); - - if (sz.isLoading() && spr->_visible) - spr->appear(spr->_x, spr->_y, spr->_facingDir); - } - for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); sz.syncAsByte(_timer->_times[i]._action); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a315d5cc90fc..78bcc2659fba 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1650,8 +1650,6 @@ void Avalot::resetVariables() { _catacombY = 0; _avvysInTheCupboard = false; _geidaFollows = false; - _geidaSpin = 0; - _geidaTime = 0; _nextBell = 0; _givenPotionToGeida = false; _lustieIsAsleep = false; @@ -1666,6 +1664,7 @@ void Avalot::resetVariables() { _askedDogfoodAboutNim = false; _vm->_parser->resetVariables(); + _vm->_animation->resetVariables(); } void Avalot::newGame() { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index bbd01d712353..2a5234af08e0 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -222,7 +222,6 @@ class Avalot { byte _catacombX, _catacombY; // XY coords in the catacombs. bool _avvysInTheCupboard; // On screen 22. bool _geidaFollows; // Is Geida following you? - byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. byte _nextBell; // For the ringing. bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? From 90c6e6a6899cd8af6ca01dbac80d039c9f93e8a3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 25 Sep 2013 23:57:08 +0200 Subject: [PATCH 1120/1332] AVALANCHE: Janitorial - Use ++ and -- when possible --- engines/avalanche/animation.cpp | 8 ++++---- engines/avalanche/background.cpp | 2 +- engines/avalanche/dialogs.cpp | 4 ++-- engines/avalanche/parser.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 662ac520df26..11e05553265c 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -848,7 +848,7 @@ void Animation::callSpecial(uint16 which) { break; case 12: // _vm->_avalot->special 12: transfer south in catacombs. _vm->_avalot->dusk(); - _vm->_avalot->_catacombY += 1; + _vm->_avalot->_catacombY++; catacombMove(2); if (_vm->_avalot->_room != kRoomCatacombs) return; @@ -924,13 +924,13 @@ void Animation::followAvalotY(byte tripnum) { _sprites[tripnum]._homingY = _sprites[1]._y; else { if (_sprites[tripnum]._y < _sprites[1]._y) - _sprites[tripnum]._y += 1; + _sprites[tripnum]._y++; else if (_sprites[tripnum]._y > _sprites[1]._y) - _sprites[tripnum]._y -= 1; + _sprites[tripnum]._y--; else return; if (_sprites[tripnum]._moveX == 0) { - _sprites[tripnum]._stepNum += 1; + _sprites[tripnum]._stepNum++; if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) _sprites[tripnum]._stepNum = 0; _sprites[tripnum]._count = 0; diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index b243078859a8..00c51beba654 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -73,7 +73,7 @@ void Background::update() { case kRoomArgentPub: if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) { // Malagauche cycle. - _vm->_avalot->_malagauche += 1; + _vm->_avalot->_malagauche++; switch (_vm->_avalot->_malagauche) { case 1: case 11: diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 68bd2c29b6df..930bb40eec0b 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -145,7 +145,7 @@ void Dialogs::scrollModeNormal() { do { _vm->_avalot->check(); // was "checkclick;" -//#ifdef RECORD slowdown(); basher::count += 1; #endif +//#ifdef RECORD slowdown(); basher::count++; #endif if (_vm->_enhanced->keypressede()) break; @@ -192,7 +192,7 @@ bool Dialogs::theyMatch(TuneType &played) { for (unsigned int i = 0; i < sizeof(played); i++) { if (played[i] != _vm->_avalot->kTune[i]) - mistakes += 1; + mistakes++; } return mistakes < 5; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 30e08c71c056..064d6aa7add8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1386,7 +1386,7 @@ bool Parser::giveToSpludwick() { } void Parser::drink() { - _alcoholLevel += 1; + _alcoholLevel++; if (_alcoholLevel == 5) { _vm->_avalot->_objects[kObjectKey - 1] = true; // Get the key. _vm->_avalot->_teetotal = true; From 8efaa45425cdb8d10d7f3fbc58a3a143c3033ff2 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 26 Sep 2013 19:22:48 +0200 Subject: [PATCH 1121/1332] AVALANCHE: Partially implement (there are still missing features: icon, keyboard control) the last missing type of scrolls: dialogs. Move some functions/variables, remove unused code in order to do so. --- engines/avalanche/avalot.cpp | 26 +++++------- engines/avalanche/avalot.h | 7 +--- engines/avalanche/dialogs.cpp | 76 +++++++++++++++++++++++++++++------ engines/avalanche/dialogs.h | 7 +++- 4 files changed, 80 insertions(+), 36 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 78bcc2659fba..42f29424ec39 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -51,15 +51,15 @@ const char *Avalot::kVersionNum = "1.30"; const char *Avalot::kCopyright = "1995"; const MouseHotspotType Avalot::kMouseHotSpots[9] = { - {8,0}, // 1 - up-arrow - {0,0}, // 2 - screwdriver - {15,6}, // 3 - right-arrow - {0,0}, // 4 - fletch - {8,7}, // 5 - hourglass - {4,0}, // 6 - TTHand - {8,5}, // 7- Mark's crosshairs - {8,7}, // 8- I-beam - {0,0} // 9 - question mark + {8,0}, // 0 - up-arrow + {0,0}, // 1 - screwdriver + {15,6}, // 2 - right-arrow + {0,0}, // 3 - fletch + {8,7}, // 4 - hourglass + {4,0}, // 5 - TTHand + {8,5}, // 6 - Mark's crosshairs + {8,7}, // 7 - I-beam + {0,0} // 8 - question mark }; // Art gallery at 2,1; notice about this at 2,2. @@ -1581,14 +1581,6 @@ void Avalot::setMousePointerWait() { newMouse(4); } -void Avalot::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { - warning("STUB: Avalot::shadow()"); -} - -void Avalot::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { - warning("STUB: Avalot::shbox()"); -} - void Avalot::resetVariables() { _vm->_animation->setDirection(kDirUp); _carryNum = 0; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 2a5234af08e0..fa6169024642 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -237,7 +237,7 @@ class Avalot { byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; - bool _dropsOk, _scReturn, _soundFx, _cheat; + bool _dropsOk, _soundFx, _cheat; Common::String _mouseText; bool _weirdWord; bool _letMeOut; @@ -324,8 +324,7 @@ class Avalot { void loadMouse(byte which); void setBackgroundColor(byte x); - void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t); - + void resetVariables(); void newGame(); // This sets up the DNA for a completely new game. void slowDown(); @@ -367,8 +366,6 @@ class Avalot { int8 fades(int8 x); void fadeOut(byte n); void fadeIn(byte n); - - void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc); }; } // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 930bb40eec0b..7eb8d50b3b89 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -178,8 +178,60 @@ void Dialogs::scrollModeNormal() { warning("STUB: Scrolls::scrollModeNormal()"); } +void Dialogs::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2) { + for (byte i = 0; i < 2; i ++) { + _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite); + _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite); + + _vm->_graphics->_scrolls.fillRect(Common::Rect(x2 - i, y1 + i, x2 - i + 1, y2 - i + 1), kColorDarkgray); + _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y2 - i, x2 - i, y2 - i + 1), kColorDarkgray); + } +} + +void Dialogs::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) { + CursorMan.showMouse(false); + + drawShadow(x1, y1, x2, y2); + + bool offset = text.size() % 2; + x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3; + y1 = (y2 - y1) / 2 + y1 - 4; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_avalot->_font, 8, x1, y1, kColorBlue); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_avalot->_font, 8, x1, y1, kColorBlue); + + CursorMan.showMouse(true); +} + void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); + // It should work with keypresses too! TODO: Implement it! + + _vm->_avalot->loadMouse(5); + + ::Graphics::Surface temp; + temp.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + + Common::Event event; + while (!_vm->shouldQuit()) { + _vm->_graphics->refreshScreen(); + + _vm->getEvent(event); + Common::Point cursorPos = _vm->getMousePos(); + cursorPos.y /= 2; + if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP)) { + if ((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) { + _scReturn = true; + break; + } else if ((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) { + _scReturn = false; + break; + } + } + } + + _vm->_graphics->_surface.copyFrom(temp); + temp.free(); } void Dialogs::store(byte what, TuneType &played) { @@ -457,14 +509,11 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { _vm->_avalot->_scroll[i].deleteLastChar(); break; case kControlQuestion: - //settextjustify(1, 1); _shadowBoxX = mx + lx; _shadowBoxY = my + ly; _vm->_avalot->_scroll[i].setChar(' ', 0); - // byte groi = *_vm->_graphics->getPixel(0, 0); - // inc(diy,14); - _vm->_avalot->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); - _vm->_avalot->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); + drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); + drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } @@ -561,11 +610,6 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { resetScrollDriver(); } -bool Dialogs::displayQuestion(Common::String question) { - warning("STUB: Scrolls::displayQuestion()"); - return true; -} - void Dialogs::reset() { _vm->_avalot->_scrollNum = 1; for (int i = 0; i < 15; i++) { @@ -628,7 +672,7 @@ void Dialogs::callDialogDriver() { _vm->_sound->stopSound(); setReadyLight(0); - _vm->_avalot->_scReturn = false; + _scReturn = false; bool mouthnext = false; bool call_spriterun = true; // Only call sprite_run the FIRST time. @@ -670,7 +714,7 @@ void Dialogs::callDialogDriver() { reset(); - if (_vm->_avalot->_scReturn) + if (_scReturn) return; break; case kControlBell: @@ -712,7 +756,7 @@ void Dialogs::callDialogDriver() { reset(); - if (_vm->_avalot->_scReturn) + if (_scReturn) return; break; @@ -809,6 +853,12 @@ void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A callDialogDriver(); } +bool Dialogs::displayQuestion(Common::String question) { + displayText(question + kControlNewLine + kControlQuestion); + warning("STUB: Dialogs::displayQuestion()"); + return _scReturn; +} + void Dialogs::loadFont() { Common::File file; diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 9cb4470959a8..d754eb1672dc 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -97,10 +97,15 @@ class Dialogs { Common::Point _dodgeCoord; byte _param; // For using arguments code byte _useIcon; + bool _scReturn; - // These 3 functions are always passed as ScrollsFunctionType parameters. + // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); + // The "asking" scroll. Used indirectly in diplayQuestion(). + void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2); + void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); void scrollModeDialogue(); + // Part of the harp mini-game. void scrollModeMusic(); // These 2 are used only in musicalScroll(). From df3fe7b0ec1c3afbba1539bf3cea510cef798ee1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 26 Sep 2013 20:16:33 +0200 Subject: [PATCH 1122/1332] AVALANCHE: Objectify Sequence. This commit breaks savegames. --- engines/avalanche/animation.cpp | 4 +- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/avalot.cpp | 74 +++++-------------- engines/avalanche/parser.cpp | 5 +- engines/avalanche/sequence.cpp | 126 ++++++++++++++++++++++++++++++++ engines/avalanche/sequence.h | 32 ++++++-- engines/avalanche/timer.cpp | 11 +-- 7 files changed, 177 insertions(+), 79 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 11e05553265c..101eccbdfea9 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1177,9 +1177,7 @@ void Animation::hideInCupboard() { appearPed(0, 2); // Walk out of the cupboard. _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_avalot->_avvysInTheCupboard = false; - _vm->_sequence->firstShow(8); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); + _vm->_sequence->startCupboardSeq(); } } else { // Not hiding in the cupboard diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index cddb8ba270e4..339d027cf927 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -115,6 +115,7 @@ const char *AvalancheEngine::getCopyrightString() const { void AvalancheEngine::synchronize(Common::Serializer &sz) { _animation->synchronize(sz); _parser->synchronize(sz); + _sequence->synchronize(sz); sz.syncAsByte(_avalot->_carryNum); for (int i = 0; i < kObjectNum; i++) @@ -256,8 +257,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_timer->_times[i]._action); sz.syncAsByte(_timer->_times[i]._reason); } - - sz.syncBytes(_sequence->_seq, _sequence->kSeqLength); + } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 42f29424ec39..a290c7323d05 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1017,10 +1017,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped != 0) { _vm->_background->draw(-1, -1, 5); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(6); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); + _vm->_sequence->startMusicRoomSeq(); } break; @@ -1028,11 +1025,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 2) { _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(3); - _vm->_sequence->thenShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(4); - _vm->_sequence->startToClose(); + _vm->_sequence->startNottsSeq(); } break; @@ -1040,10 +1033,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 2) { _vm->_background->draw(-1, -1, 5); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(6); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); + _vm->_sequence->startMusicRoomSeq(); } break; @@ -1068,16 +1058,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. _vm->_background->draw(-1, -1, 0); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(1); - if (_arrowInTheDoor) - _vm->_sequence->thenShow(3); - else - _vm->_sequence->thenShow(2); - - if (_takenPen) - _vm->_background->draw(-1, -1, 3); - - _vm->_sequence->startToClose(); + _vm->_sequence->startCardiffSeq2(); } else { _vm->_background->draw(-1, -1, 0); if (_arrowInTheDoor) @@ -1092,10 +1073,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 1) { _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(3); - _vm->_sequence->startToClose(); + _vm->_sequence->startGardenSeq(); } break; @@ -1113,10 +1091,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { _vm->_background->draw(-1, -1, 1); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(3); - _vm->_sequence->startToClose(); + _vm->_sequence->startGardenSeq(); } break; @@ -1152,11 +1127,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { // Shut the door _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_sequence->firstShow(3); - _vm->_sequence->firstShow(2); - _vm->_sequence->thenShow(1); - _vm->_sequence->thenShow(4); - _vm->_sequence->startToClose(); + _vm->_sequence->startDuckSeq(); } break; @@ -1993,53 +1964,42 @@ void Avalot::openDoor(Room whither, byte ped, byte magicnum) { case kRoomOutsideYours: case kRoomOutsideNottsPub: case kRoomOutsideDucks: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(2); - _vm->_sequence->thenShow(3); + _vm->_sequence->startOutsideSeq(whither, ped); break; case kRoomInsideCardiffCastle: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(5); + _vm->_sequence->startCardiffSeq(whither, ped); break; case kRoomAvvysGarden: case kRoomEntranceHall: case kRoomInsideAbbey: case kRoomYourHall: - _vm->_sequence->firstShow(1); - _vm->_sequence->thenShow(2); + _vm->_sequence->startHallSeq(whither, ped); break; case kRoomMusicRoom: case kRoomOutsideArgentPub: - _vm->_sequence->firstShow(5); - _vm->_sequence->thenShow(6); + _vm->_sequence->startMusicRoomSeq2(whither, ped); break; case kRoomLusties: switch (magicnum) { case 14: if (_avvysInTheCupboard) { _vm->_animation->hideInCupboard(); - _vm->_sequence->firstShow(8); - _vm->_sequence->thenShow(7); - _vm->_sequence->startToClose(); + _vm->_sequence->startLustiesSeq1(); return; } else { _vm->_animation->appearPed(0, 5); - _vm->_animation->_sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995 - _vm->_sequence->firstShow(8); - _vm->_sequence->thenShow(9); + _vm->_animation->_sprites[0]._facingDir = kDirRight; + _vm->_sequence->startLustiesSeq2(whither, ped); } break; case 12: - _vm->_sequence->firstShow(4); - _vm->_sequence->thenShow(5); - _vm->_sequence->thenShow(6); + _vm->_sequence->startLustiesSeq3(whither, ped); break; } break; + default: + _vm->_sequence->startDummySeq(whither, ped); } - - _vm->_sequence->thenFlip(whither, ped); - _vm->_sequence->startToOpen(); } void Avalot::setRoom(People persId, Room roomId) { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 064d6aa7add8..b8b461b053f6 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1547,10 +1547,7 @@ void Parser::playHarp() { void Parser::winSequence() { _vm->_dialogs->displayScrollChain('q', 78); - _vm->_sequence->firstShow(7); - _vm->_sequence->thenShow(8); - _vm->_sequence->thenShow(9); - _vm->_sequence->startToClose(); + _vm->_sequence->startWinSeq(); _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); } diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 61de6b8bf352..472dca986225 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -104,4 +104,130 @@ void Sequence::callSequencer() { startToClose(); // Make sure this PROC gets called again. } +void Sequence::startHallSeq(Room whither, byte ped) { + firstShow(1); + thenShow(2); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startOutsideSeq(Room whither, byte ped) { + firstShow(1); + thenShow(2); + thenShow(3); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startCardiffSeq(Room whither, byte ped) { + firstShow(1); + thenShow(5); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startNaughtyDukeSeq() { + firstShow(2); + startToClose(); +} + +void Sequence::startGardenSeq() { + firstShow(2); + thenShow(1); + thenShow(3); + startToClose(); +} + +// FIXME! 2 firstShow()! +void Sequence::startDuckSeq() { + firstShow(3); + firstShow(2); + thenShow(1); + thenShow(4); + startToClose(); +} + +void Sequence::startNottsSeq() { + firstShow(3); + thenShow(2); + thenShow(1); + thenShow(4); + startToClose(); +} + +void Sequence::startLustiesSeq3(Room whither, byte ped) { + firstShow(4); + thenShow(5); + thenShow(6); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startMusicRoomSeq2(Room whither, byte ped) { + firstShow(5); + thenShow(6); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startGeidaLuteSeq() { + firstShow(5); + thenShow(6); // He falls asleep... + startToClose(); // Not really closing, but we're using the same procedure. +} + +void Sequence::startMusicRoomSeq() { + firstShow(6); + thenShow(5); + thenShow(7); + startToClose(); +} + +void Sequence::startWinSeq() { + firstShow(7); + thenShow(8); + thenShow(9); + startToClose(); +} + +void Sequence::startCupboardSeq() { + firstShow(8); + thenShow(7); + startToClose(); +} + +void Sequence::startLustiesSeq1() { + firstShow(8); + thenShow(7); + startToClose(); +} + +void Sequence::startLustiesSeq2(Room whither, byte ped) { + firstShow(8); + thenShow(9); + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::startCardiffSeq2() { + firstShow(1); + if (_vm->_avalot->_arrowInTheDoor) + thenShow(3); + else + thenShow(2); + + if (_vm->_avalot->_takenPen) + _vm->_background->draw(-1, -1, 3); + + startToClose(); +} + +void Sequence::startDummySeq(Room whither, byte ped) { + thenFlip(whither, ped); + startToOpen(); +} + +void Sequence::synchronize(Common::Serializer &sz) { + sz.syncBytes(_seq, kSeqLength); +} } // End of namespace Avalanche. diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index a160b58a7e30..2c84abb8bfde 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -36,25 +36,45 @@ namespace Avalanche { class AvalancheEngine; class Sequence { -public: +private: static const int16 kNowFlip = 177; static const int16 kSeqLength = 10; +public: byte _seq[kSeqLength]; Sequence(AvalancheEngine *vm); + void synchronize(Common::Serializer &sz); - void firstShow(byte what); - void thenShow(byte what); - void thenFlip(Room where, byte ped); - void startToClose(); - void startToOpen(); void callSequencer(); + void startCupboardSeq(); + void startMusicRoomSeq(); + void startMusicRoomSeq2(Room whither, byte ped); + void startGardenSeq(); + void startGeidaLuteSeq(); + void startWinSeq(); + void startNaughtyDukeSeq(); + void startLustiesSeq1(); + void startLustiesSeq2(Room whither, byte ped); + void startLustiesSeq3(Room whither, byte ped); + void startHallSeq(Room whither, byte ped); + void startCardiffSeq(Room whither, byte ped); + void startOutsideSeq(Room whither, byte ped); + void startDuckSeq(); + void startCardiffSeq2(); + void startNottsSeq(); + void startDummySeq(Room whither, byte ped); + private: AvalancheEngine *_vm; void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. + void firstShow(byte what); + void thenShow(byte what); + void thenFlip(Room where, byte ped); + void startToClose(); + void startToOpen(); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 52a5bff45317..d1d25ba74068 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -430,8 +430,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon // Let's get the door opening. _vm->_background->draw(-1, -1, 0); - _vm->_sequence->firstShow(2); - _vm->_sequence->startToClose(); + _vm->_sequence->startNaughtyDukeSeq(); addTimer(50, kProcNaughtyDuke2, kReasonNaughtyDuke); } @@ -441,13 +440,13 @@ void Timer::naughtyDuke2() { _vm->_dialogs->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(0); // Walk to the door. spr->_vanishIfStill = true; // Then go away! + addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } void Timer::naughtyDuke3() { _vm->_background->draw(-1, -1, 0); - _vm->_sequence->firstShow(2); - _vm->_sequence->startToClose(); + _vm->_sequence->startNaughtyDukeSeq(); } void Timer::jump() { @@ -694,9 +693,7 @@ void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_dialogs->displayScrollChain('Q', 86); _vm->_avalot->incScore(4); _vm->_avalot->_lustieIsAsleep = true; - _vm->_sequence->firstShow(5); - _vm->_sequence->thenShow(6); // He falls asleep... - _vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure. + _vm->_sequence->startGeidaLuteSeq(); } } // End of namespace Avalanche. From 03cae64498d853c2f42dfd3e01b34cdb94b27089 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 26 Sep 2013 20:31:11 +0200 Subject: [PATCH 1123/1332] AVALANCHE: Fix bug in Sequence. --- engines/avalanche/sequence.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 472dca986225..10e3dbc192f0 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -138,10 +138,9 @@ void Sequence::startGardenSeq() { startToClose(); } -// FIXME! 2 firstShow()! void Sequence::startDuckSeq() { firstShow(3); - firstShow(2); + thenShow(2); thenShow(1); thenShow(4); startToClose(); From dc3471bc099b15fe79f5d5d54b6daa1dac1c4240 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 00:09:47 +0200 Subject: [PATCH 1124/1332] AVALANCHE: Rename Sequence functions --- engines/avalanche/sequence.cpp | 146 ++++++++++++++++----------------- engines/avalanche/sequence.h | 10 +-- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 10e3dbc192f0..54c7dccc6156 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -41,14 +41,14 @@ Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; } -void Sequence::firstShow(byte what) { +void Sequence::init(byte what) { _seq[0] = what; for (int i = 1; i < kSeqLength; i++) _seq[i] = 0; } -void Sequence::thenShow(byte what) { +void Sequence::add(byte what) { for (int16 i = 0; i < kSeqLength; i++) { if (_seq[i] == 0) { _seq[i] = what; @@ -57,22 +57,22 @@ void Sequence::thenShow(byte what) { } } -void Sequence::thenFlip(Room where, byte ped) { - thenShow(kNowFlip); +void Sequence::switchRoom(Room where, byte ped) { + add(kNowFlip); _vm->_avalot->_flipToWhere = where; _vm->_avalot->_flipToPed = ped; } -void Sequence::startToClose() { +void Sequence::startTimer() { _vm->_timer->loseTimer(Timer::kReasonSequencer); _vm->_timer->addTimer(7, Timer::kProcSequence, Timer::kReasonSequencer); } -void Sequence::startToOpen() { +void Sequence::startTimerImmobilized() { _vm->_avalot->_userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. - startToClose(); // Apart from that, it's the same thing. + startTimer(); // Apart from that, it's the same thing. } void Sequence::shoveLeft() { @@ -101,129 +101,129 @@ void Sequence::callSequencer() { shoveLeft(); } - startToClose(); // Make sure this PROC gets called again. + startTimer(); // Make sure this PROC gets called again. } void Sequence::startHallSeq(Room whither, byte ped) { - firstShow(1); - thenShow(2); - thenFlip(whither, ped); - startToOpen(); + init(1); + add(2); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startOutsideSeq(Room whither, byte ped) { - firstShow(1); - thenShow(2); - thenShow(3); - thenFlip(whither, ped); - startToOpen(); + init(1); + add(2); + add(3); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startCardiffSeq(Room whither, byte ped) { - firstShow(1); - thenShow(5); - thenFlip(whither, ped); - startToOpen(); + init(1); + add(5); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startNaughtyDukeSeq() { - firstShow(2); - startToClose(); + init(2); + startTimer(); } void Sequence::startGardenSeq() { - firstShow(2); - thenShow(1); - thenShow(3); - startToClose(); + init(2); + add(1); + add(3); + startTimer(); } void Sequence::startDuckSeq() { - firstShow(3); - thenShow(2); - thenShow(1); - thenShow(4); - startToClose(); + init(3); + add(2); + add(1); + add(4); + startTimer(); } void Sequence::startNottsSeq() { - firstShow(3); - thenShow(2); - thenShow(1); - thenShow(4); - startToClose(); + init(3); + add(2); + add(1); + add(4); + startTimer(); } void Sequence::startLustiesSeq3(Room whither, byte ped) { - firstShow(4); - thenShow(5); - thenShow(6); - thenFlip(whither, ped); - startToOpen(); + init(4); + add(5); + add(6); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startMusicRoomSeq2(Room whither, byte ped) { - firstShow(5); - thenShow(6); - thenFlip(whither, ped); - startToOpen(); + init(5); + add(6); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startGeidaLuteSeq() { - firstShow(5); - thenShow(6); // He falls asleep... - startToClose(); // Not really closing, but we're using the same procedure. + init(5); + add(6); // He falls asleep... + startTimer(); // Not really closing, but we're using the same procedure. } void Sequence::startMusicRoomSeq() { - firstShow(6); - thenShow(5); - thenShow(7); - startToClose(); + init(6); + add(5); + add(7); + startTimer(); } void Sequence::startWinSeq() { - firstShow(7); - thenShow(8); - thenShow(9); - startToClose(); + init(7); + add(8); + add(9); + startTimer(); } void Sequence::startCupboardSeq() { - firstShow(8); - thenShow(7); - startToClose(); + init(8); + add(7); + startTimer(); } void Sequence::startLustiesSeq1() { - firstShow(8); - thenShow(7); - startToClose(); + init(8); + add(7); + startTimer(); } void Sequence::startLustiesSeq2(Room whither, byte ped) { - firstShow(8); - thenShow(9); - thenFlip(whither, ped); - startToOpen(); + init(8); + add(9); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::startCardiffSeq2() { - firstShow(1); + init(1); if (_vm->_avalot->_arrowInTheDoor) - thenShow(3); + add(3); else - thenShow(2); + add(2); if (_vm->_avalot->_takenPen) _vm->_background->draw(-1, -1, 3); - startToClose(); + startTimer(); } void Sequence::startDummySeq(Room whither, byte ped) { - thenFlip(whither, ped); - startToOpen(); + switchRoom(whither, ped); + startTimerImmobilized(); } void Sequence::synchronize(Common::Serializer &sz) { diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 2c84abb8bfde..b026ef3609d2 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -70,11 +70,11 @@ class Sequence { AvalancheEngine *_vm; void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. - void firstShow(byte what); - void thenShow(byte what); - void thenFlip(Room where, byte ped); - void startToClose(); - void startToOpen(); + void init(byte what); + void add(byte what); + void switchRoom(Room where, byte ped); + void startTimer(); + void startTimerImmobilized(); }; } // End of namespace Avalanche. From 75cbbda822714fdc07906adcdb123a2eab217089 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 00:21:59 +0200 Subject: [PATCH 1125/1332] AVALANCHE: More function deduplication, remove a magic value --- engines/avalanche/avalot.cpp | 4 ++-- engines/avalanche/sequence.cpp | 19 +++---------------- engines/avalanche/sequence.h | 2 -- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a290c7323d05..397d1b7a3c3a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1025,7 +1025,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 2) { _vm->_background->draw(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_sequence->startNottsSeq(); + _vm->_sequence->startDuckSeq(); } break; @@ -1984,7 +1984,7 @@ void Avalot::openDoor(Room whither, byte ped, byte magicnum) { case 14: if (_avvysInTheCupboard) { _vm->_animation->hideInCupboard(); - _vm->_sequence->startLustiesSeq1(); + _vm->_sequence->startCupboardSeq(); return; } else { _vm->_animation->appearPed(0, 5); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 54c7dccc6156..707cd9f300f3 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -88,10 +88,11 @@ void Sequence::callSequencer() { case 0: return; // No more routines. break; - case 177: // Flip room. + case kNowFlip: // Flip room. _vm->_avalot->_userMovesAvvy = true; _vm->_avalot->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); - if (curSeq == 177) + // CHECKME: Always true? + if (curSeq == kNowFlip) shoveLeft(); break; } @@ -146,14 +147,6 @@ void Sequence::startDuckSeq() { startTimer(); } -void Sequence::startNottsSeq() { - init(3); - add(2); - add(1); - add(4); - startTimer(); -} - void Sequence::startLustiesSeq3(Room whither, byte ped) { init(4); add(5); @@ -195,12 +188,6 @@ void Sequence::startCupboardSeq() { startTimer(); } -void Sequence::startLustiesSeq1() { - init(8); - add(7); - startTimer(); -} - void Sequence::startLustiesSeq2(Room whither, byte ped) { init(8); add(9); diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index b026ef3609d2..7f164853e17d 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -55,7 +55,6 @@ class Sequence { void startGeidaLuteSeq(); void startWinSeq(); void startNaughtyDukeSeq(); - void startLustiesSeq1(); void startLustiesSeq2(Room whither, byte ped); void startLustiesSeq3(Room whither, byte ped); void startHallSeq(Room whither, byte ped); @@ -63,7 +62,6 @@ class Sequence { void startOutsideSeq(Room whither, byte ped); void startDuckSeq(); void startCardiffSeq2(); - void startNottsSeq(); void startDummySeq(Room whither, byte ped); private: From e166f6fc44be9322cd502520af0cd1daa6b07813 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 00:33:08 +0200 Subject: [PATCH 1126/1332] AVALANCHE: Move a couple of variables to Sequence, more private variables --- engines/avalanche/avalanche.cpp | 2 -- engines/avalanche/avalot.cpp | 3 +-- engines/avalanche/avalot.h | 2 -- engines/avalanche/sequence.cpp | 13 ++++++++++--- engines/avalanche/sequence.h | 32 +++++++++++++++++--------------- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 339d027cf927..222414ca02f6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -242,8 +242,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_nextBell); sz.syncAsByte(_avalot->_givenPotionToGeida); sz.syncAsByte(_avalot->_lustieIsAsleep); - sz.syncAsByte(_avalot->_flipToWhere); - sz.syncAsByte(_avalot->_flipToPed); sz.syncAsByte(_avalot->_beenTiedUp); sz.syncAsByte(_avalot->_sittingInPub); sz.syncAsByte(_avalot->_spurgeTalkCount); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 397d1b7a3c3a..6bf1b4691362 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1616,8 +1616,6 @@ void Avalot::resetVariables() { _nextBell = 0; _givenPotionToGeida = false; _lustieIsAsleep = false; - _flipToWhere = kRoomNowhere; - _flipToPed = 0; _beenTiedUp = false; _sittingInPub = false; _spurgeTalkCount = 0; @@ -1628,6 +1626,7 @@ void Avalot::resetVariables() { _vm->_parser->resetVariables(); _vm->_animation->resetVariables(); + _vm->_sequence->resetVariables(); } void Avalot::newGame() { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index fa6169024642..a80d80d27541 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -225,8 +225,6 @@ class Avalot { byte _nextBell; // For the ringing. bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? - Room _flipToWhere; - byte _flipToPed; // For the sequencer. bool _beenTiedUp; // In r__Robins. bool _sittingInPub; // Are you sitting down in the pub? byte _spurgeTalkCount; // Count for talking to Spurge. diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 707cd9f300f3..bbbbf6229c9c 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -41,6 +41,11 @@ Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; } +void Sequence::resetVariables() { + _flipToWhere = kRoomNowhere; + _flipToPed = 0; +} + void Sequence::init(byte what) { _seq[0] = what; @@ -60,8 +65,8 @@ void Sequence::add(byte what) { void Sequence::switchRoom(Room where, byte ped) { add(kNowFlip); - _vm->_avalot->_flipToWhere = where; - _vm->_avalot->_flipToPed = ped; + _flipToWhere = where; + _flipToPed = ped; } void Sequence::startTimer() { @@ -90,7 +95,7 @@ void Sequence::callSequencer() { break; case kNowFlip: // Flip room. _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); + _vm->_avalot->flipRoom(_flipToWhere, _flipToPed); // CHECKME: Always true? if (curSeq == kNowFlip) shoveLeft(); @@ -215,5 +220,7 @@ void Sequence::startDummySeq(Room whither, byte ped) { void Sequence::synchronize(Common::Serializer &sz) { sz.syncBytes(_seq, kSeqLength); + sz.syncAsByte(_flipToWhere); + sz.syncAsByte(_flipToPed); } } // End of namespace Avalanche. diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 7f164853e17d..94025babf4d1 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -27,8 +27,8 @@ /* SEQUENCE The sequencer. */ -#ifndef AVALANCHE_SEQUENCE2_H -#define AVALANCHE_SEQUENCE2_H +#ifndef AVALANCHE_SEQUENCE_H +#define AVALANCHE_SEQUENCE_H #include "common/scummsys.h" @@ -40,12 +40,24 @@ class Sequence { static const int16 kNowFlip = 177; static const int16 kSeqLength = 10; -public: byte _seq[kSeqLength]; + Room _flipToWhere; + byte _flipToPed; + + AvalancheEngine *_vm; + + void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. + void init(byte what); + void add(byte what); + void switchRoom(Room where, byte ped); + void startTimer(); + void startTimerImmobilized(); + +public: Sequence(AvalancheEngine *vm); void synchronize(Common::Serializer &sz); - + void resetVariables(); void callSequencer(); void startCupboardSeq(); @@ -63,18 +75,8 @@ class Sequence { void startDuckSeq(); void startCardiffSeq2(); void startDummySeq(Room whither, byte ped); - -private: - AvalancheEngine *_vm; - - void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. - void init(byte what); - void add(byte what); - void switchRoom(Room where, byte ped); - void startTimer(); - void startTimerImmobilized(); }; } // End of namespace Avalanche. -#endif // AVALANCHE_SEQUENCE2_H +#endif // AVALANCHE_SEQUENCE_H From 08883a807f8c568109430910836aeee6b96b64f2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 01:34:38 +0200 Subject: [PATCH 1127/1332] AVALANCHE: Merge Avalot and AvalancheEngine --- engines/avalanche/animation.cpp | 378 ++++++++-------- engines/avalanche/avalanche.cpp | 233 +++++----- engines/avalanche/avalanche.h | 247 ++++++++++- engines/avalanche/avalot.cpp | 732 +++++++++++++++---------------- engines/avalanche/avalot.h | 255 ----------- engines/avalanche/background.cpp | 94 ++-- engines/avalanche/dialogs.cpp | 354 +++++++-------- engines/avalanche/menu.cpp | 178 ++++---- engines/avalanche/parser.cpp | 564 ++++++++++++------------ engines/avalanche/pingo.cpp | 6 +- engines/avalanche/sequence.cpp | 10 +- engines/avalanche/timer.cpp | 166 +++---- 12 files changed, 1595 insertions(+), 1622 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 101eccbdfea9..cb64bb8fe08f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -147,8 +147,8 @@ void AnimationType::turn(Direction whichway) { void AnimationType::appear(int16 wx, int16 wy, Direction wf) { _x = (wx / 8) * 8; _y = wy; - _oldX[_anim->_vm->_avalot->_cp] = wx; - _oldY[_anim->_vm->_avalot->_cp] = wy; + _oldX[_anim->_vm->_cp] = wx; + _oldY[_anim->_vm->_cp] = wy; turn(wf); _visible = true; _moveX = 0; @@ -180,9 +180,9 @@ void AnimationType::walk() { r._y2 = _y + _info._yLength + 2; } - if (!_anim->_vm->_avalot->_doingSpriteRun) { - _oldX[_anim->_vm->_avalot->_cp] = _x; - _oldY[_anim->_vm->_avalot->_cp] = _y; + if (!_anim->_vm->_doingSpriteRun) { + _oldX[_anim->_vm->_cp] = _x; + _oldY[_anim->_vm->_cp] = _y; if (_homing) homeStep(); _x += _moveX; @@ -195,40 +195,40 @@ void AnimationType::walk() { return; } - byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_avalot->_cp], _y, _info._yLength) - 1; + byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((magicColor != 255) & (!_anim->_vm->_avalot->_doingSpriteRun)) { - MagicType *magic = &_anim->_vm->_avalot->_magics[magicColor]; + if ((magicColor != 255) & (!_anim->_vm->_doingSpriteRun)) { + MagicType *magic = &_anim->_vm->_magics[magicColor]; switch (magic->_operation) { - case Avalot::kMagicExclaim: + case AvalancheEngine::kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = magic->_data; break; - case Avalot::kMagicBounce: + case AvalancheEngine::kMagicBounce: bounce(); break; - case Avalot::kMagicTransport: - _anim->_vm->_avalot->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); + case AvalancheEngine::kMagicTransport: + _anim->_vm->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); break; - case Avalot::kMagicUnfinished: { + case AvalancheEngine::kMagicUnfinished: { bounce(); Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); _anim->_vm->_dialogs->displayText(tmpStr); } break; - case Avalot::kMagicSpecial: + case AvalancheEngine::kMagicSpecial: _anim->callSpecial(magic->_data); break; - case Avalot::kMagicOpenDoor: - _anim->_vm->_avalot->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); + case AvalancheEngine::kMagicOpenDoor: + _anim->_vm->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); break; } } } - if (!_anim->_vm->_avalot->_doingSpriteRun) { + if (!_anim->_vm->_doingSpriteRun) { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; @@ -240,13 +240,13 @@ void AnimationType::walk() { } void AnimationType::bounce() { - _x = _oldX[_anim->_vm->_avalot->_cp]; - _y = _oldY[_anim->_vm->_avalot->_cp]; + _x = _oldX[_anim->_vm->_cp]; + _y = _oldY[_anim->_vm->_cp]; if (_doCheck) _anim->stopWalking(); else stopWalk(); - _anim->_vm->_avalot->drawDirection(); + _anim->_vm->drawDirection(); } int8 AnimationType::getSign(int16 val) { @@ -259,7 +259,7 @@ int8 AnimationType::getSign(int16 val) { } void AnimationType::walkTo(byte pedNum) { - PedType *curPed = &_anim->_vm->_avalot->_peds[pedNum]; + PedType *curPed = &_anim->_vm->_peds[pedNum]; setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); _homingX = curPed->_x - _info._xLength / 2; @@ -327,10 +327,10 @@ void AnimationType::stopWalk() { } void AnimationType::chatter() { - _anim->_vm->_avalot->_talkX = _x + _info._xLength / 2; - _anim->_vm->_avalot->_talkY = _y; - _anim->_vm->_avalot->_talkFontColor = _stat._fgBubbleCol; - _anim->_vm->_avalot->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_talkX = _x + _info._xLength / 2; + _anim->_vm->_talkY = _y; + _anim->_vm->_talkFontColor = _stat._fgBubbleCol; + _anim->_vm->_talkBackgroundColor = _stat._bgBubbleCol; } void AnimationType::remove() { @@ -368,7 +368,7 @@ void Animation::resetAnims() { } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - if (!_vm->_avalot->_alive) + if (!_vm->_alive) return 0; if (x1 < 0) @@ -413,98 +413,98 @@ void Animation::catacombMove(byte ped) { // XY_uint16 is cat_x+cat_y*256. Thus, every room in the // catacombs has a different number for it. - xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256; + xy_uint16 = _vm->_catacombX + _vm->_catacombY * 256; _geidaSpin = 0; switch (xy_uint16) { case 1801: // Exit catacombs - _vm->_avalot->flipRoom(kRoomLustiesRoom, 4); + _vm->flipRoom(kRoomLustiesRoom, 4); _vm->_dialogs->displayText("Phew! Nice to be out of there!"); return; case 1033:{ // Oubliette - _vm->_avalot->flipRoom(kRoomOubliette, 1); + _vm->flipRoom(kRoomOubliette, 1); Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } return; case 4: - _vm->_avalot->flipRoom(kRoomGeidas, 1); + _vm->flipRoom(kRoomGeidas, 1); return; case 2307: - _vm->_avalot->flipRoom(kRoomLusties, 5); + _vm->flipRoom(kRoomLusties, 5); _vm->_dialogs->displayText("Oh no... here we go again..."); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; _sprites[0]._moveY = 1; _sprites[0]._moveX = 0; return; } - if (!_vm->_avalot->_enterCatacombsFromLustiesRoom) - _vm->_avalot->loadRoom(29); - here = _vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1]; + if (!_vm->_enterCatacombsFromLustiesRoom) + _vm->loadRoom(29); + here = _vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); break; case 0x1: // no connection (wall + shield), - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x2: // wall with door - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // No door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches - _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall. - _vm->_avalot->_magics[2]._operation = Avalot::kMagicSpecial; // Straight wall. + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. + _vm->_magics[2]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. break; } @@ -512,127 +512,127 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); break; case 0x1: // no connection (wall + window), - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...window. break; case 0x2: // wall with door - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...door, and... _vm->_background->draw(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // No door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door, and... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicSpecial; // Straight wall. - _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[4]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. + _vm->_magics[5]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. + _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. break; } switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; case 0x1: _vm->_background->draw(-1, -1, 21); - if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows)) - _vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim; + if ((xy_uint16 == 2051) && (_vm->_geidaFollows)) + _vm->_magics[12]._operation = AvalancheEngine::kMagicExclaim; else - _vm->_avalot->_magics[12]._operation = Avalot::kMagicSpecial; // Right exit south. + _vm->_magics[12]._operation = AvalancheEngine::kMagicSpecial; // Right exit south. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; break; case 0x2: _vm->_background->draw(-1, -1, 22); - _vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south. - _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[6]._operation = AvalancheEngine::kMagicSpecial; // Middle exit south. + _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; case 0x3: _vm->_background->draw(-1, -1, 23); - _vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south. - _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; - _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce; + _vm->_magics[11]._operation = AvalancheEngine::kMagicSpecial; // Left exit south. + _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. break; // LEFT handles: #if 0 case 0x1: _vm->_celer->show_one(-1, -1, 4); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Left exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif case 0x2: _vm->_background->draw(-1, -1, 3); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; #if 0 case 0x3: _vm->_celer->show_one(-1, -1, 4); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Right exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; // RIGHT handles: case 0x4: _vm->_celer->show_one(-1, -1, 3); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Left exit north. } { Change magic number! } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif case 0x5: _vm->_background->draw(-1, -1, 2); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; #if 0 case 0x6: _vm->_celer->show_one(-1, -1, 3); - _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } - _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. } + _vm->magics[1].op = _vm->bounces; // { Right exit north. } + _vm->portals[12].op = _vm->special; // { Door. } break; #endif // ARCHWAYS: @@ -646,25 +646,25 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_background->draw(-1, -1, 31); - _vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north. - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicSpecial; // Middle arch north. + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 13); break; case 0xe: // No connection + TORCH - _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; - _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door. + _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; + _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. _vm->_background->draw(-1, -1, 7); break; // Recessed door: case 0xf: - _vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room. + _vm->_magics[0]._operation = AvalancheEngine::kMagicNothing; // Door to Geida's room. _vm->_background->draw(-1, -1, 0); - _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door. + _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. break; } @@ -700,7 +700,7 @@ void Animation::catacombMove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_avalot->_geidaFollows) && (ped > 0)) { + if ((_vm->_geidaFollows) && (ped > 0)) { if (!_sprites[1]._quick) // If we don't already have her... _sprites[1].init(5, true, this); // ...Load Geida. appearPed(1, geidaPed(ped)); @@ -709,36 +709,36 @@ void Animation::catacombMove(byte ped) { } } -// This proc gets called whenever you touch a line defined as _vm->_avalot->special. +// This proc gets called whenever you touch a line defined as _vm->special. void Animation::dawnDelay() { _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); } void Animation::callSpecial(uint16 which) { switch (which) { - case 1: // _vm->_avalot->special 1: Room 22: top of stairs. + case 1: // _vm->special 1: Room 22: top of stairs. _vm->_background->draw(-1, -1, 0); - _vm->_avalot->_brummieStairs = 1; - _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; + _vm->_brummieStairs = 1; + _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; break; - case 2: // _vm->_avalot->special 2: Room 22: bottom of stairs. - _vm->_avalot->_brummieStairs = 3; - _vm->_avalot->_magics[10]._operation = Avalot::kMagicNothing; - _vm->_avalot->_magics[11]._operation = Avalot::kMagicExclaim; - _vm->_avalot->_magics[11]._data = 5; - _vm->_avalot->_magics[3]._operation = Avalot::kMagicBounce; // Now works as planned! + case 2: // _vm->special 2: Room 22: bottom of stairs. + _vm->_brummieStairs = 3; + _vm->_magics[10]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[11]._operation = AvalancheEngine::kMagicExclaim; + _vm->_magics[11]._data = 5; + _vm->_magics[3]._operation = AvalancheEngine::kMagicBounce; // Now works as planned! stopWalking(); _vm->_dialogs->displayScrollChain('q', 26); - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; break; - case 3: // _vm->_avalot->special 3: Room 71: triggers dart. + case 3: // _vm->special 3: Room 71: triggers dart. _sprites[0].bounce(); // Must include that. - if (!_vm->_avalot->_arrowTriggered) { - _vm->_avalot->_arrowTriggered = true; + if (!_vm->_arrowTriggered) { + _vm->_arrowTriggered = true; appearPed(1, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. @@ -752,80 +752,80 @@ void Animation::callSpecial(uint16 which) { } break; case 4: // This is the ghost room link. - _vm->_avalot->dusk(); + _vm->dusk(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - if (_vm->_avalot->_friarWillTieYouUp) { - // _vm->_avalot->special 5: Room 42: touched tree, and get tied up. - _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Boundary effect is now working again. + if (_vm->_friarWillTieYouUp) { + // _vm->special 5: Room 42: touched tree, and get tied up. + _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Boundary effect is now working again. _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; _vm->_background->draw(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); - _vm->_avalot->_tiedUp = true; - _vm->_avalot->_friarWillTieYouUp = false; + _vm->_tiedUp = true; + _vm->_friarWillTieYouUp = false; _sprites[1].walkTo(2); _sprites[1]._vanishIfStill = true; _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. - _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. + _vm->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; - case 6: // _vm->_avalot->special 6: fall down oubliette. - _vm->_avalot->_userMovesAvvy = false; + case 6: // _vm->special 6: fall down oubliette. + _vm->_userMovesAvvy = false; _sprites[0]._moveX = 3; _sprites[0]._moveY = 0; _sprites[0]._facingDir = kDirRight; _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); break; - case 7: // _vm->_avalot->special 7: stop falling down oubliette. + case 7: // _vm->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing; + _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); - //_vm->_avalot->mblit(12, 80, 38, 160, 3, 0); - //_vm->_avalot->mblit(12, 80, 38, 160, 3, 1); + //_vm->mblit(12, 80, 38, 160, 3, 0); + //_vm->mblit(12, 80, 38, 160, 3, 1); _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; - case 8: // _vm->_avalot->special 8: leave du Lustie's room. - if ((_vm->_avalot->_geidaFollows) && (!_vm->_avalot->_lustieIsAsleep)) { + case 8: // _vm->special 8: leave du Lustie's room. + if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) { _vm->_dialogs->displayScrollChain('q', 63); _sprites[1].turn(kDirDown); _sprites[1].stopWalk(); _sprites[1]._callEachStepFl = false; // Geida - _vm->_avalot->gameOver(); + _vm->gameOver(); } break; - case 9: // _vm->_avalot->special 9: lose Geida to Robin Hood... - if (!_vm->_avalot->_geidaFollows) + case 9: // _vm->special 9: lose Geida to Robin Hood... + if (!_vm->_geidaFollows) return; // DOESN'T COUNT: no Geida. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1].walkTo(3); // She walks to somewhere... _sprites[0].remove(); // Lose Avvy. - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; - case 10: // _vm->_avalot->special 10: transfer north in catacombs. - if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) { + case 10: // _vm->special 10: transfer north in catacombs. + if ((_vm->_catacombX == 4) && (_vm->_catacombY == 1)) { // Into Geida's room. - if (_vm->_avalot->_objects[kObjectKey - 1]) + if (_vm->_objects[kObjectKey - 1]) _vm->_dialogs->displayScrollChain('q', 62); else { _vm->_dialogs->displayScrollChain('q', 61); return; } } - _vm->_avalot->dusk(); - _vm->_avalot->_catacombY--; + _vm->dusk(); + _vm->_catacombY--; catacombMove(4); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; - switch ((_vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1] & 0xf00) >> 8) { + switch ((_vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1] & 0xf00) >> 8) { case 0x1: appearPed(0, 11); break; @@ -837,29 +837,29 @@ void Animation::callSpecial(uint16 which) { } dawnDelay(); break; - case 11: // _vm->_avalot->special 11: transfer east in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombX++; + case 11: // _vm->special 11: transfer east in catacombs. + _vm->dusk(); + _vm->_catacombX++; catacombMove(1); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 0); dawnDelay(); break; - case 12: // _vm->_avalot->special 12: transfer south in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombY++; + case 12: // _vm->special 12: transfer south in catacombs. + _vm->dusk(); + _vm->_catacombY++; catacombMove(2); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 1); dawnDelay(); break; - case 13: // _vm->_avalot->special 13: transfer west in catacombs. - _vm->_avalot->dusk(); - _vm->_avalot->_catacombX--; + case 13: // _vm->special 13: transfer west in catacombs. + _vm->dusk(); + _vm->_catacombX--; catacombMove(3); - if (_vm->_avalot->_room != kRoomCatacombs) + if (_vm->_room != kRoomCatacombs) return; appearPed(0, 2); dawnDelay(); @@ -872,7 +872,7 @@ void Animation::updateSpeed() { _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - if (_sprites[0]._speedX == _vm->_avalot->kRun) { + if (_sprites[0]._speedX == _vm->kRun) { _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); } else { @@ -912,7 +912,7 @@ void Animation::setMoveSpeed(byte t, Direction dir) { void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = &_sprites[sprNum]; - PedType *curPed = &_vm->_avalot->_peds[pedNum]; + PedType *curPed = &_vm->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); setMoveSpeed(sprNum, curPed->_direction); } @@ -972,15 +972,15 @@ void Animation::arrowProcs(byte tripnum) { _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _sprites[tripnum].remove(); // Deallocate the arrow. - _vm->_avalot->gameOver(); + _vm->gameOver(); - _vm->_avalot->_userMovesAvvy = false; // Stop the user from moving him. + _vm->_userMovesAvvy = false; // Stop the user from moving him. _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! _sprites[tripnum].remove(); // Deallocate the arrow. _vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door. - _vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up. + _vm->_arrowInTheDoor = true; // So that we can pick it up. } } @@ -1114,7 +1114,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_menu->isActive() | _vm->_avalot->_onToolbar | _vm->_avalot->_seeScroll) + if (_vm->_menu->isActive() | _vm->_onToolbar | _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) @@ -1158,7 +1158,7 @@ void Animation::animLink() { void Animation::stopWalking() { _sprites[0].stopWalk(); _direction = kDirStopped; - if (_vm->_avalot->_alive) + if (_vm->_alive) _sprites[0]._stepNum = 1; } @@ -1167,39 +1167,39 @@ void Animation::stopWalking() { * @remarks Originally called 'hide_in_the_cupboard' */ void Animation::hideInCupboard() { - if (_vm->_avalot->_avvysInTheCupboard) { + if (_vm->_avvysInTheCupboard) { if (_vm->_parser->_wearing == kObjectDummy) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); - _vm->_avalot->_avvysInTheCupboard = false; + _vm->_avvysInTheCupboard = false; _vm->_sequence->startCupboardSeq(); } } else { // Not hiding in the cupboard _sprites[0]._visible = false; - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_avvysInTheCupboard = true; + _vm->_avvysInTheCupboard = true; _vm->_background->draw(-1, -1, 7); } } bool Animation::inField(byte which) { - FieldType *curField = &_vm->_avalot->_fields[which]; + FieldType *curField = &_vm->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } bool Animation::nearDoor() { - if (_vm->_avalot->_fieldNum < 8) { + if (_vm->_fieldNum < 8) { // there ARE no doors here! return false; } @@ -1207,8 +1207,8 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - for (int i = 8; i < _vm->_avalot->_fieldNum; i++) { - FieldType *curField = &_vm->_avalot->_fields[i]; + for (int i = 8; i < _vm->_fieldNum; i++) { + FieldType *curField = &_vm->_fields[i]; if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) return true; } @@ -1217,7 +1217,7 @@ bool Animation::nearDoor() { } void Animation::handleMoveKey(const Common::Event &event) { - if (!_vm->_avalot->_userMovesAvvy) + if (!_vm->_userMovesAvvy) return; if (_vm->_menu->_activeMenuItem._activeNow) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 222414ca02f6..cd943513ba46 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -45,13 +45,21 @@ namespace Avalanche { AvalancheEngine *AvalancheEngine::s_Engine = 0; -AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) { +AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd), _fxHidden(false), _interrogation(0) { _system = syst; s_Engine = this; _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); _rnd->setSeed(42); + + // Needed because of Lucerna::load_also() + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) + _also[i][j] = nullptr; + } + + _totalTime = 0; } AvalancheEngine::~AvalancheEngine() { @@ -61,7 +69,7 @@ AvalancheEngine::~AvalancheEngine() { delete _graphics; delete _parser; - delete _avalot; + delete _clock; delete _pingo; delete _dialogs; delete _background; @@ -71,13 +79,28 @@ AvalancheEngine::~AvalancheEngine() { delete _menu; delete _closing; delete _sound; + + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { + if (_also[i][j] != nullptr) { + delete _also[i][j]; + _also[i][j] = nullptr; + } + } + } + + for (int i = 0; i < 9; i++) { + _digits[i].free(); + _directions[i].free(); + } + _digits[9].free(); } Common::ErrorCode AvalancheEngine::initialize() { _graphics = new Graphics(this); _parser = new Parser(this); - _avalot = new Avalot(this); + _clock = new Clock(this); _pingo = new Pingo(this); _dialogs = new Dialogs(this); _background = new Background(this); @@ -90,7 +113,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _graphics->init(); _dialogs->init(); - _avalot->init(); + init(); _parser->init(); return Common::kNoError; @@ -117,138 +140,138 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _parser->synchronize(sz); _sequence->synchronize(sz); - sz.syncAsByte(_avalot->_carryNum); + sz.syncAsByte(_carryNum); for (int i = 0; i < kObjectNum; i++) - sz.syncAsByte(_avalot->_objects[i]); - sz.syncAsSint16LE(_avalot->_dnascore); - sz.syncAsSint32LE(_avalot->_money); - sz.syncAsByte(_avalot->_room); + sz.syncAsByte(_objects[i]); + sz.syncAsSint16LE(_dnascore); + sz.syncAsSint32LE(_money); + sz.syncAsByte(_room); if (sz.isSaving()) _saveNum++; sz.syncAsByte(_saveNum); - sz.syncBytes(_avalot->_roomCount, 100); - sz.syncAsByte(_avalot->_wonNim); - sz.syncAsByte(_avalot->_wineState); - sz.syncAsByte(_avalot->_cwytalotGone); - sz.syncAsByte(_avalot->_passwordNum); - sz.syncAsByte(_avalot->_aylesIsAwake); - sz.syncAsByte(_avalot->_drawbridgeOpen); - sz.syncAsByte(_avalot->_avariciusTalk); - sz.syncAsByte(_avalot->_rottenOnion); - sz.syncAsByte(_avalot->_onionInVinegar); - sz.syncAsByte(_avalot->_givenToSpludwick); - sz.syncAsByte(_avalot->_brummieStairs); - sz.syncAsByte(_avalot->_cardiffQuestionNum); - sz.syncAsByte(_avalot->_passedCwytalotInHerts); - sz.syncAsByte(_avalot->_avvyIsAwake); - sz.syncAsByte(_avalot->_avvyInBed); - sz.syncAsByte(_avalot->_userMovesAvvy); - sz.syncAsByte(_avalot->_npcFacing); - sz.syncAsByte(_avalot->_givenBadgeToIby); - sz.syncAsByte(_avalot->_friarWillTieYouUp); - sz.syncAsByte(_avalot->_tiedUp); - sz.syncAsByte(_avalot->_boxContent); - sz.syncAsByte(_avalot->_talkedToCrapulus); - sz.syncAsByte(_avalot->_jacquesState); - sz.syncAsByte(_avalot->_bellsAreRinging); - sz.syncAsByte(_avalot->_standingOnDais); - sz.syncAsByte(_avalot->_takenPen); - sz.syncAsByte(_avalot->_arrowTriggered); - sz.syncAsByte(_avalot->_arrowInTheDoor); + sz.syncBytes(_roomCount, 100); + sz.syncAsByte(_wonNim); + sz.syncAsByte(_wineState); + sz.syncAsByte(_cwytalotGone); + sz.syncAsByte(_passwordNum); + sz.syncAsByte(_aylesIsAwake); + sz.syncAsByte(_drawbridgeOpen); + sz.syncAsByte(_avariciusTalk); + sz.syncAsByte(_rottenOnion); + sz.syncAsByte(_onionInVinegar); + sz.syncAsByte(_givenToSpludwick); + sz.syncAsByte(_brummieStairs); + sz.syncAsByte(_cardiffQuestionNum); + sz.syncAsByte(_passedCwytalotInHerts); + sz.syncAsByte(_avvyIsAwake); + sz.syncAsByte(_avvyInBed); + sz.syncAsByte(_userMovesAvvy); + sz.syncAsByte(_npcFacing); + sz.syncAsByte(_givenBadgeToIby); + sz.syncAsByte(_friarWillTieYouUp); + sz.syncAsByte(_tiedUp); + sz.syncAsByte(_boxContent); + sz.syncAsByte(_talkedToCrapulus); + sz.syncAsByte(_jacquesState); + sz.syncAsByte(_bellsAreRinging); + sz.syncAsByte(_standingOnDais); + sz.syncAsByte(_takenPen); + sz.syncAsByte(_arrowTriggered); + sz.syncAsByte(_arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _avalot->_favouriteDrink.size(); + uint16 like2drinkSize = _favouriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _avalot->_favouriteDrink[i]; + char actChr = _favouriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _avalot->_favouriteSong.size(); + uint16 favourite_songSize = _favouriteSong.size(); sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _avalot->_favouriteSong[i]; + char actChr = _favouriteSong[i]; sz.syncAsByte(actChr); } - uint16 worst_place_on_earthSize = _avalot->_worstPlaceOnEarth.size(); + uint16 worst_place_on_earthSize = _worstPlaceOnEarth.size(); sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr = _avalot->_worstPlaceOnEarth[i]; + char actChr = _worstPlaceOnEarth[i]; sz.syncAsByte(actChr); } - uint16 spare_eveningSize = _avalot->_spareEvening.size(); + uint16 spare_eveningSize = _spareEvening.size(); sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr = _avalot->_spareEvening[i]; + char actChr = _spareEvening[i]; sz.syncAsByte(actChr); } } else { - if (!_avalot->_favouriteDrink.empty()) - _avalot->_favouriteDrink.clear(); + if (!_favouriteDrink.empty()) + _favouriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _avalot->_favouriteDrink += actChr; + _favouriteDrink += actChr; } - if (!_avalot->_favouriteSong.empty()) - _avalot->_favouriteSong.clear(); + if (!_favouriteSong.empty()) + _favouriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _avalot->_favouriteSong += actChr; + _favouriteSong += actChr; } - if (!_avalot->_worstPlaceOnEarth.empty()) - _avalot->_worstPlaceOnEarth.clear(); + if (!_worstPlaceOnEarth.empty()) + _worstPlaceOnEarth.clear(); uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { sz.syncAsByte(actChr); - _avalot->_worstPlaceOnEarth += actChr; + _worstPlaceOnEarth += actChr; } - if (!_avalot->_spareEvening.empty()) - _avalot->_spareEvening.clear(); + if (!_spareEvening.empty()) + _spareEvening.clear(); uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { sz.syncAsByte(actChr); - _avalot->_spareEvening += actChr; + _spareEvening += actChr; } } - sz.syncAsSint32LE(_avalot->_totalTime); - sz.syncAsByte(_avalot->_jumpStatus); - sz.syncAsByte(_avalot->_mushroomGrowing); - sz.syncAsByte(_avalot->_spludwickAtHome); - sz.syncAsByte(_avalot->_lastRoom); - sz.syncAsByte(_avalot->_lastRoomNotMap); - sz.syncAsByte(_avalot->_crapulusWillTell); - sz.syncAsByte(_avalot->_enterCatacombsFromLustiesRoom); - sz.syncAsByte(_avalot->_teetotal); - sz.syncAsByte(_avalot->_malagauche); - sz.syncAsByte(_avalot->_drinking); - sz.syncAsByte(_avalot->_enteredLustiesRoomAsMonk); - sz.syncAsByte(_avalot->_catacombX); - sz.syncAsByte(_avalot->_catacombY); - sz.syncAsByte(_avalot->_avvysInTheCupboard); - sz.syncAsByte(_avalot->_geidaFollows); - sz.syncAsByte(_avalot->_nextBell); - sz.syncAsByte(_avalot->_givenPotionToGeida); - sz.syncAsByte(_avalot->_lustieIsAsleep); - sz.syncAsByte(_avalot->_beenTiedUp); - sz.syncAsByte(_avalot->_sittingInPub); - sz.syncAsByte(_avalot->_spurgeTalkCount); - sz.syncAsByte(_avalot->_metAvaroid); - sz.syncAsByte(_avalot->_takenMushroom); - sz.syncAsByte(_avalot->_givenPenToAyles); - sz.syncAsByte(_avalot->_askedDogfoodAboutNim); + sz.syncAsSint32LE(_totalTime); + sz.syncAsByte(_jumpStatus); + sz.syncAsByte(_mushroomGrowing); + sz.syncAsByte(_spludwickAtHome); + sz.syncAsByte(_lastRoom); + sz.syncAsByte(_lastRoomNotMap); + sz.syncAsByte(_crapulusWillTell); + sz.syncAsByte(_enterCatacombsFromLustiesRoom); + sz.syncAsByte(_teetotal); + sz.syncAsByte(_malagauche); + sz.syncAsByte(_drinking); + sz.syncAsByte(_enteredLustiesRoomAsMonk); + sz.syncAsByte(_catacombX); + sz.syncAsByte(_catacombY); + sz.syncAsByte(_avvysInTheCupboard); + sz.syncAsByte(_geidaFollows); + sz.syncAsByte(_nextBell); + sz.syncAsByte(_givenPotionToGeida); + sz.syncAsByte(_lustieIsAsleep); + sz.syncAsByte(_beenTiedUp); + sz.syncAsByte(_sittingInPub); + sz.syncAsByte(_spurgeTalkCount); + sz.syncAsByte(_metAvaroid); + sz.syncAsByte(_takenMushroom); + sz.syncAsByte(_givenPenToAyles); + sz.syncAsByte(_askedDogfoodAboutNim); for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); @@ -259,7 +282,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! - return (!_avalot->_seeScroll && _avalot->_alive); + return (!_seeScroll && _alive); } Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { @@ -305,7 +328,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) { } bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! - return (!_avalot->_seeScroll); + return (!_seeScroll); } Common::Error AvalancheEngine::loadGameState(int slot) { @@ -354,29 +377,29 @@ bool AvalancheEngine::loadGame(const int16 slot) { synchronize(sz); delete f; - _avalot->_isLoaded = true; - _avalot->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. + _isLoaded = true; + _seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. - if (_avalot->_holdTheDawn) { - _avalot->_holdTheDawn = false; - _avalot->dawn(); + if (_holdTheDawn) { + _holdTheDawn = false; + dawn(); } _background->release(); - _avalot->minorRedraw(); + minorRedraw(); _menu->setup(); - _avalot->setRoom(kPeopleAvalot, _avalot->_room); - _avalot->_alive = true; - _avalot->refreshObjectList(); + setRoom(kPeopleAvalot, _room); + _alive = true; + refreshObjectList(); _animation->updateSpeed(); - _avalot->drawDirection(); - _avalot->_onToolbar = false; + drawDirection(); + _onToolbar = false; _animation->animLink(); _background->update(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, - Dialogs::kControlNewLine, Dialogs::kControlNewLine, _avalot->_roomnName.c_str(), Dialogs::kControlNewLine, + Dialogs::kControlNewLine, Dialogs::kControlNewLine, _roomnName.c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _dialogs->displayText(tmpStr); @@ -393,7 +416,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { }; Common::String month = months[m]; - Common::String day = _avalot->intToStr(d); + Common::String day = intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) switch (d % 10) { @@ -410,7 +433,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) { day += "th"; } - return day + ' ' + month + ' ' + _avalot->intToStr(y + 1900); + return day + ' ' + month + ' ' + intToStr(y + 1900); } void AvalancheEngine::updateEvents() { @@ -419,13 +442,13 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _avalot->_holdLeftMouse = true; // Used in Avalot::checkclick() and Menu::menu_link(). + _holdLeftMouse = true; // Used in checkclick() and Menu::menu_link(). break; case Common::EVENT_LBUTTONUP: - _avalot->_holdLeftMouse = false; // Same as above. + _holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: - _avalot->handleKeyDown(event); + handleKeyDown(event); break; default: break; @@ -447,7 +470,7 @@ Common::Error AvalancheEngine::run() { return err; do { - _avalot->runAvalot(); + runAvalot(); #if 0 switch (_storage._operation) { @@ -466,7 +489,7 @@ Common::Error AvalancheEngine::run() { } #endif - } while (!_avalot->_letMeOut && !shouldQuit()); + } while (!_letMeOut && !shouldQuit()); return Common::kNoError; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 27a5bd63210a..597772199768 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -59,11 +59,18 @@ struct AvalancheGameDescription; static const int kSavegameVersion = 1; +enum Pitch { + kPitchInvalid, + kPitchLower, + kPitchSame, + kPitchHigher +}; + class AvalancheEngine : public Engine { public: byte _saveNum; // number of times this game has been saved - Avalot *_avalot; + Clock *_clock; Graphics *_graphics; Parser *_parser; Pingo *_pingo; @@ -153,6 +160,244 @@ class AvalancheEngine : public Engine { void cursorOn(); void quit(); #endif + +public: + static const int16 kXW = 30; + static const int16 kYW = 36; // x width & y whatsit + static const int16 kMargin = 5; + static const MouseHotspotType kMouseHotSpots[9]; + static const int16 kMaxSprites = 2; // Current max no. of sprites. + + // For Thinkabout: + static const bool kThing = true; + static const bool kPerson = false; + + // Magic/portal constants: + enum Magics { + kMagicNothing, // Ignore it if this line is touched. + kMagicBounce, // Bounce off this line. Not valid for portals. + kMagicExclaim, // Put up a chain of scrolls. + kMagicTransport, // Enter new room. + kMagicUnfinished, // Unfinished connection. + kMagicSpecial, // Special function. + kMagicOpenDoor // Opening door. + }; + + // These following static constants should be included in CFG when it's written. + + static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. + static const int16 kBorder = 1; // size of border on shadowboxes + static const int16 kWalk = 3; + static const int16 kRun = 5; + static const int32 kCatacombMap[8][8]; + static const char kSpludwicksOrder[3]; + static const QuasipedType kQuasipeds[16]; + + static const uint16 kNotes[12]; + static const TuneType kTune; + + static const char *kVersionNum; + static const char *kCopyright; + static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". + static const int16 kGameCode = 2; // Avalot's code number + + bool _holdLeftMouse; + + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. + // If a scroll comes up, or you leave the room, it's automatically set to zero. + byte _interrogation; + + // Former DNA structure + byte _carryNum; // How many objects you're carrying... + bool _objects[kObjectNum]; // ...and which ones they are. + int16 _dnascore; // your score, of course + int32 _money; // your current amount of dosh + Room _room; // your current room + byte _roomCount[100]; // Add one to each every time you enter a room + bool _wonNim; // Have you *won* Nim? (That's harder.) + byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. + bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? + byte _passwordNum; // Number of the passw for this game. + bool _aylesIsAwake; // pretty obvious! + byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). + byte _avariciusTalk; // How much Avaricius has said to you. + bool _rottenOnion; // And has it rotted? + bool _onionInVinegar; // Is the onion in the vinegar? + byte _givenToSpludwick; // 0 = nothing given, 1 = onion... + byte _brummieStairs; // Progression through the stairs trick. + byte _cardiffQuestionNum; // Things you get asked in Cardiff. + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) + bool _avvyInBed; // True if Avvy's in bed, but awake. + bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. + byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. + bool _givenBadgeToIby; // Have you given the badge to Iby yet? + bool _friarWillTieYouUp; // If you're going to get tied up. + bool _tiedUp; // You ARE tied up! + byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. + bool _talkedToCrapulus; // Pretty self-explanatory. + byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. + bool _bellsAreRinging; // Is Jacques ringing the bells? + bool _standingOnDais; // In room 71, inside Cardiff Castle. + bool _takenPen; // Have you taken the pen (in Cardiff?) + bool _arrowTriggered; // And has the arrow been triggered? + bool _arrowInTheDoor; // Did the arrow hit the wall? + Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's + uint32 _totalTime; // Your total time playing this game, in ticks. + byte _jumpStatus; // Fixes how high you're jumping. + bool _mushroomGrowing; // Is the mushroom growing in 42? + bool _spludwickAtHome; // Is Spludwick at home? + byte _lastRoom; + byte _lastRoomNotMap; + bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? + bool _enterCatacombsFromLustiesRoom; + bool _teetotal; // Are we touching any more drinks? + byte _malagauche; // Position of Malagauche. See Celer for more info. + char _drinking; // What's he getting you? + bool _enteredLustiesRoomAsMonk; + byte _catacombX, _catacombY; // XY coords in the catacombs. + bool _avvysInTheCupboard; // On screen 22. + bool _geidaFollows; // Is Geida following you? + byte _nextBell; // For the ringing. + bool _givenPotionToGeida; // Does Geida have the potion? + bool _lustieIsAsleep; // Is BDL asleep? + bool _beenTiedUp; // In r__Robins. + bool _sittingInPub; // Are you sitting down in the pub? + byte _spurgeTalkCount; // Count for talking to Spurge. + bool _metAvaroid; + bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; + // End of former DNA Structure + + byte _lineNum; // Number of lines. + LineType _lines[50]; // For Also. + enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; + bool _dropsOk, _soundFx, _cheat; + Common::String _mouseText; + bool _weirdWord; + bool _letMeOut; + Common::String _scroll[15]; + byte _scrollNum, _whichwas; + byte _thinks; + bool _thinkThing; + int16 _talkX, _talkY; + byte _talkBackgroundColor, _talkFontColor; + byte _scrollBells; // no. of times to ring the bell + bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? + char _objectList[10]; + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + // Called .free() for them in ~Gyro(). + int8 _scoreToDisplay[3]; + byte _currentMouse; // current mouse-void + Common::String _verbStr; // what you can do with your object. :-) + Common::String *_also[31][2]; + PedType _peds[15]; + MagicType _magics[15]; + MagicType _portals[7]; + FieldType _fields[30]; + byte _fieldNum; + Common::String _flags; + Common::String _listen; + byte _cp, _ledStatus, _defaultLed; + FontType _font; + bool _alive; + byte _buffer[2000]; + uint16 _bufSize; + int16 _underScroll; // Y-coord of just under the scroll text. + Common::String _roomnName; // Name of actual room + Common::String _subject; // What you're talking to them about. + byte _subjectNum; // The same thing. + bool _keyboardClick; // Is a keyboard click noise wanted? + People _him, _her; + byte _it; + int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. + + People _lastPerson; // Last person to have been selected using the People menu. + bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. + bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. + bool _isLoaded; // Is it a loaded gamestate? + Common::String _enidFilename; + + void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). + void setup(); + void runAvalot(); + + void init(); + void callVerb(VerbCode id); + void drawAlsoLines(); + void loadRoom(byte num); + void exitRoom(byte x); + void enterRoom(Room room, byte ped); + void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! + void loadDigits(); // Load the scoring digits & rwlites + void drawToolbar(); + void drawScore(); + void incScore(byte num); // Add on no. of points + void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. + void fxToggle(); + void refreshObjectList(); + void checkClick(); + void errorLed(); + void dusk(); + void dawn(); + void drawDirection(); // Draws the little icon at the left end of the text input field. + void gameOver(); + uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. + void fixFlashers(); + void loadAlso(byte num); + + // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. + void minorRedraw(); + void majorRedraw(); + + void spriteRun(); + + Common::String intToStr(int32 num); + void newMouse(byte id); + void setMousePointerWait(); // Makes hourglass. + void loadMouse(byte which); + + void setBackgroundColor(byte x); + + void resetVariables(); + void newGame(); // This sets up the DNA for a completely new game. + void slowDown(); + bool setFlag(char x); + bool decreaseMoney(uint16 amount); // Called pennycheck in the original. + void hangAroundForAWhile(); + + Common::String getName(People whose); + byte getNameChar(People whose); + Common::String getThing(byte which); + char getThingChar(byte which); + Common::String getItem(byte which); // Called get_better in the original. + Common::String f5Does(); // This procedure determines what f5 does. + + void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. + void flipRoom(Room room, byte ped); + + void setRoom(People persId, Room roomId); + Room getRoom(People persId); +private: + static Room _whereIs[29]; + + Common::File file; + Common::String readAlsoStringFromFile(); + void scram(Common::String &str); + void unScramble(); + + void zoomOut(int16 x, int16 y); // Only used when entering the map. + void enterNewTown(); + void findPeople(byte room); + void putGeidaAt(byte whichPed, byte ped); + void guideAvvy(Common::Point cursorPos); + + // Will be used in dusk() and dawn(). + bool _fxHidden; + + int8 fades(int8 x); + void fadeOut(byte n); + void fadeIn(byte n); }; } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6bf1b4691362..e5ed210d0543 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,16 +28,6 @@ /* AVALOT The kernel of the program. */ #include "avalanche/avalanche.h" -#include "avalanche/graphics.h" -#include "avalanche/avalot.h" -#include "avalanche/animation.h" -#include "avalanche/dialogs.h" -#include "avalanche/menu.h" -#include "avalanche/pingo.h" -#include "avalanche/timer.h" -#include "avalanche/background.h" -#include "avalanche/closing.h" -#include "avalanche/enums.h" #include "common/file.h" #include "common/random.h" @@ -47,10 +37,10 @@ namespace Avalanche { -const char *Avalot::kVersionNum = "1.30"; -const char *Avalot::kCopyright = "1995"; +const char *AvalancheEngine::kVersionNum = "1.30"; +const char *AvalancheEngine::kCopyright = "1995"; -const MouseHotspotType Avalot::kMouseHotSpots[9] = { +const MouseHotspotType AvalancheEngine::kMouseHotSpots[9] = { {8,0}, // 0 - up-arrow {0,0}, // 1 - screwdriver {15,6}, // 2 - right-arrow @@ -63,7 +53,7 @@ const MouseHotspotType Avalot::kMouseHotSpots[9] = { }; // Art gallery at 2,1; notice about this at 2,2. -const int32 Avalot::kCatacombMap[8][8] = { +const int32 AvalancheEngine::kCatacombMap[8][8] = { // Geida's room // 1 2 3 | 4 5 6 7 8 {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, @@ -113,11 +103,11 @@ const int32 Avalot::kCatacombMap[8][8] = { 7 = wall with door and candles, F = straight-through corridor. */ -const char Avalot::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; +const char AvalancheEngine::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. -const QuasipedType Avalot::kQuasipeds[16] = { +const QuasipedType AvalancheEngine::kQuasipeds[16] = { //_whichPed, _foregroundColor, _room, _backgroundColor, _who {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). @@ -137,14 +127,14 @@ const QuasipedType Avalot::kQuasipeds[16] = { {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). }; -const uint16 Avalot::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; -const TuneType Avalot::kTune = { +const uint16 AvalancheEngine::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; +const TuneType AvalancheEngine::kTune = { kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher }; -Room Avalot::_whereIs[29] = { +Room AvalancheEngine::_whereIs[29] = { // The Lads kRoomYours, // Avvy kRoomSpludwicks, // Spludwick @@ -240,14 +230,14 @@ void Clock::plotHands() { } void Clock::chime() { - if ((_oldHour == 17717) || (!_vm->_avalot->_soundFx)) // Too high - must be first time around + if ((_oldHour == 17717) || (!_vm->_soundFx)) // Too high - must be first time around return; byte hour = _hour % 12; if (hour == 0) hour = 12; - _vm->_avalot->setMousePointerWait(); + _vm->setMousePointerWait(); for (int i = 1; i <= hour; i++) { for (int j = 1; j <= 3; j++) @@ -258,42 +248,13 @@ void Clock::chime() { } -Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogation(0) { - _vm = vm; - - // Needed because of Lucerna::load_also() - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _also[i][j] = nullptr; - } - - _totalTime = 0; -} - -Avalot::~Avalot() { - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) { - if (_also[i][j] != nullptr) { - delete _also[i][j]; - _also[i][j] = nullptr; - } - } - } - - for (int i = 0; i < 9; i++) { - _digits[i].free(); - _directions[i].free(); - } - _digits[9].free(); -} - -void Avalot::handleKeyDown(Common::Event &event) { - _vm->_sound->click(); +void AvalancheEngine::handleKeyDown(Common::Event &event) { + _sound->click(); if ((Common::KEYCODE_F1 <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_F15)) - _vm->_parser->handleFunctionKey(event); + _parser->handleFunctionKey(event); else if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47)) - _vm->_parser->handleInputText(event); + _parser->handleInputText(event); else switch (event.kbd.keycode) { // We can control Avvy with the numpad as well. case Common::KEYCODE_KP8: @@ -335,15 +296,15 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_END: case Common::KEYCODE_KP5: if (_alive && _avvyIsAwake) { - _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. + _animation->handleMoveKey(event); // Fallthroughs are intended. drawDirection(); return; } case Common::KEYCODE_BACKSPACE: - _vm->_parser->handleBackspace(); + _parser->handleBackspace(); break; case Common::KEYCODE_RETURN: - _vm->_parser->handleReturn(); + _parser->handleReturn(); break; default: break; @@ -352,89 +313,89 @@ void Avalot::handleKeyDown(Common::Event &event) { drawDirection(); } -void Avalot::setup() { +void AvalancheEngine::setup() { init(); - _vm->_dialogs->reset(); + _dialogs->reset(); dusk(); loadDigits(); - _vm->_parser->_inputTextPos = 0; - _vm->_parser->_quote = true; + _parser->_inputTextPos = 0; + _parser->_quote = true; - _vm->_animation->setDirection(kDirStopped); - _vm->_animation->resetAnims(); + _animation->setDirection(kDirStopped); + _animation->resetAnims(); drawToolbar(); - _vm->_dialogs->setReadyLight(2); + _dialogs->setReadyLight(2); dawn(); - _vm->_parser->_cursorState = false; - _vm->_parser->cursorOn(); - _vm->_animation->_sprites[0]._speedX = kWalk; - _vm->_animation->updateSpeed(); + _parser->_cursorState = false; + _parser->cursorOn(); + _animation->_sprites[0]._speedX = kWalk; + _animation->updateSpeed(); - _vm->_menu->init(); + _menu->init(); int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _thinks = 2; // You always have money. - thinkAbout(kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, kThing); - _vm->loadGame(loadSlot); + loadGame(loadSlot); } else { _isLoaded = false; // Set to true in _vm->loadGame(). newGame(); _soundFx = !_soundFx; fxToggle(); - thinkAbout(kObjectMoney, Avalot::kThing); + thinkAbout(kObjectMoney, kThing); - _vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc. + _dialogs->displayScrollChain('q', 83); // Info on the game, etc. } } -void Avalot::runAvalot() { +void AvalancheEngine::runAvalot() { setup(); do { - uint32 beginLoop = _vm->_system->getMillis(); + uint32 beginLoop = _system->getMillis(); - _vm->updateEvents(); // The event handler. + updateEvents(); // The event handler. - _clock.update(); - _vm->_menu->update(); - _vm->_background->update(); - _vm->_animation->animLink(); + _clock->update(); + _menu->update(); + _background->update(); + _animation->animLink(); checkClick(); - _vm->_timer->updateTimer(); + _timer->updateTimer(); #ifdef DEBUG for (int i = 0; i < _lineNum; i++) { LineType *curLine = &_lines[i]; - _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); + _graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); } for (int i = 0; i < _fieldNum; i++) { FieldType *curField = &_fields[i]; if (curField->_x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); + _graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } #endif - _vm->_graphics->refreshScreen(); + _graphics->refreshScreen(); - uint32 delay = _vm->_system->getMillis() - beginLoop; + uint32 delay = _system->getMillis() - beginLoop; if (delay <= 55) - _vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (!_letMeOut && !_vm->shouldQuit()); + _system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). + } while (!_letMeOut && !shouldQuit()); - warning("STUB: Avalot::run()"); + warning("STUB: run()"); - _vm->_closing->exitGame(); + _closing->exitGame(); } -void Avalot::init() { +void AvalancheEngine::init() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) _also[i][j] = nullptr; @@ -470,31 +431,31 @@ void Avalot::init() { * Call a given Verb * @remarks Originally called 'callverb' */ -void Avalot::callVerb(VerbCode id) { - if (id == _vm->_parser->kPardon) { +void AvalancheEngine::callVerb(VerbCode id) { + if (id == _parser->kPardon) { Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ "what the current setting of this key is."); - _vm->_dialogs->displayText(tmpStr); + _dialogs->displayText(tmpStr); } else { _weirdWord = false; - _vm->_parser->_polite = true; - _vm->_parser->_verb = id; - _vm->_parser->doThat(); + _parser->_polite = true; + _parser->_verb = id; + _parser->doThat(); } } -void Avalot::drawAlsoLines() { +void AvalancheEngine::drawAlsoLines() { CursorMan.showMouse(false); - _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + _graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); + _graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); for (int i = 0; i < _lineNum; i++) { // We had to check if the lines are within the borders of the screen. - if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _vm->_graphics->kScreenHeight) - && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); + if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _graphics->kScreenHeight) + && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _graphics->kScreenHeight)) + _graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); } CursorMan.showMouse(true); @@ -504,7 +465,7 @@ void Avalot::drawAlsoLines() { * Check is it's possible to give something to Spludwick * @remarks Originally called 'nextstring' */ -Common::String Avalot::readAlsoStringFromFile() { +Common::String AvalancheEngine::readAlsoStringFromFile() { Common::String str; byte length = file.readByte(); for (int i = 0; i < length; i++) @@ -512,12 +473,12 @@ Common::String Avalot::readAlsoStringFromFile() { return str; } -void Avalot::scram(Common::String &str) { +void AvalancheEngine::scram(Common::String &str) { for (uint i = 0; i < str.size(); i++) str.setChar(str[i] ^ 177, i); } -void Avalot::unScramble() { +void AvalancheEngine::unScramble() { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { if (_also[i][j] != nullptr) @@ -528,7 +489,7 @@ void Avalot::unScramble() { scram(_flags); } -void Avalot::loadAlso(byte num) { +void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { if (_also[i][j] != nullptr) { @@ -616,10 +577,10 @@ void Avalot::loadAlso(byte num) { } } -void Avalot::loadRoom(byte num) { +void AvalancheEngine::loadRoom(byte num) { CursorMan.showMouse(false); - _vm->_graphics->fleshColors(); + _graphics->fleshColors(); Common::String filename = Common::String::format("place%d.avd", num); if (!file.open(filename)) @@ -637,21 +598,21 @@ void Avalot::loadRoom(byte num) { file.seek(177); - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->refreshBackground(); + _graphics->_background = _graphics->loadPictureRow(file, _graphics->kBackgroundWidth, _graphics->kBackgroundHeight); + _graphics->refreshBackground(); file.close(); loadAlso(num); - _vm->_background->load(num); + _background->load(num); CursorMan.showMouse(true); } -void Avalot::zoomOut(int16 x, int16 y) { +void AvalancheEngine::zoomOut(int16 x, int16 y) { //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! ::Graphics::Surface backup; - backup.copyFrom(_vm->_graphics->_surface); + backup.copyFrom(_graphics->_surface); for (byte i = 1; i <= 20; i ++) { int16 x1 = x - (x / 20) * i; @@ -659,17 +620,17 @@ void Avalot::zoomOut(int16 x, int16 y) { int16 x2 = x + (((639 - x) / 20) * i); int16 y2 = y + (((161 - y) / 20) * i); - _vm->_graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); - _vm->_graphics->refreshScreen(); - _vm->_system->delayMillis(17); - _vm->_graphics->_surface.copyFrom(backup); - _vm->_graphics->refreshScreen(); + _graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); + _graphics->refreshScreen(); + _system->delayMillis(17); + _graphics->_surface.copyFrom(backup); + _graphics->refreshScreen(); } backup.free(); } -void Avalot::findPeople(byte room) { +void AvalancheEngine::findPeople(byte room) { for (int i = 1; i < 29; i++) { if (_whereIs[i] == room) { if (i < 25) @@ -680,28 +641,28 @@ void Avalot::findPeople(byte room) { } } -void Avalot::exitRoom(byte x) { - _vm->_sound->stopSound(); - _vm->_background->release(); +void AvalancheEngine::exitRoom(byte x) { + _sound->stopSound(); + _background->release(); _seeScroll = true; // This stops the trippancy system working over the length of this procedure. switch (x) { case kRoomSpludwicks: - _vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); + _timer->loseTimer(Timer::kReasonAvariciusTalks); _avariciusTalk = 0; // He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. break; case kRoomBridge: if (_drawbridgeOpen > 0) { _drawbridgeOpen = 4; // Fully open. - _vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); + _timer->loseTimer(Timer::kReasonDrawbridgeFalls); } break; case kRoomOutsideCardiffCastle: - _vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); + _timer->loseTimer(Timer::kReasonCardiffsurvey); break; case kRoomRobins: - _vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); + _timer->loseTimer(Timer::kReasonGettingTiedUp); break; } @@ -719,8 +680,8 @@ void Avalot::exitRoom(byte x) { * but choosing another from the map. * @remarks Originally called 'new_town' */ -void Avalot::enterNewTown() { - _vm->_menu->setup(); +void AvalancheEngine::enterNewTown() { + _menu->setup(); switch (_room) { case kRoomOutsideNottsPub: // Entry into Nottingham. @@ -744,18 +705,18 @@ void Avalot::enterNewTown() { _rottenOnion = true; // You're holding the onion } -void Avalot::putGeidaAt(byte whichPed, byte ped) { +void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) { if (ped == 0) return; - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(5, false, _vm->_animation); // load Geida - _vm->_animation->appearPed(1, whichPed); + spr1->init(5, false, _animation); // load Geida + _animation->appearPed(1, whichPed); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; } -void Avalot::enterRoom(Room roomId, byte ped) { +void AvalancheEngine::enterRoom(Room roomId, byte ped) { _seeScroll = true; // This stops the trippancy system working over the length of this procedure. findPeople(roomId); @@ -782,24 +743,24 @@ void Avalot::enterRoom(Room roomId, byte ped) { switch (roomId) { case kRoomYours: if (_avvyInBed) { - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); } break; case kRoomOutsideYours: if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; if (!_talkedToCrapulus) { _whereIs[kPeopleCrapulus - 150] = kRoomOutsideYours; - spr1->init(8, false, _vm->_animation); // load Crapulus + spr1->init(8, false, _animation); // load Crapulus if (_roomCount[kRoomOutsideYours] == 1) { - _vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. + _animation->appearPed(1, 3); // Start on the right-hand side of the screen. spr1->walkTo(4); // Walks up to greet you. } else { - _vm->_animation->appearPed(1, 4); // Starts where he was before. + _animation->appearPed(1, 4); // Starts where he was before. spr1->_facingDir = kDirLeft; } @@ -810,10 +771,10 @@ void Avalot::enterRoom(Room roomId, byte ped) { _whereIs[kPeopleCrapulus - 150] = kRoomNowhere; if (_crapulusWillTell) { - spr1->init(8, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + spr1->init(8, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(3); - _vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); + _timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); _crapulusWillTell = false; } } @@ -821,17 +782,17 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomOutsideSpludwicks: if ((_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { - _vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); + _timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); _spludwickAtHome = true; } break; case kRoomSpludwicks: if (_spludwickAtHome) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; if (ped > 0) { - spr1->init(2, false, _vm->_animation); // load Spludwick - _vm->_animation->appearPed(1, 1); + spr1->init(2, false, _animation); // load Spludwick + _animation->appearPed(1, 1); _whereIs[kPeopleSpludwick - 150] = kRoomSpludwicks; } @@ -845,21 +806,21 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (_geidaFollows) putGeidaAt(4, ped); if (_cwytalotGone) { - _magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; + _magics[kColorLightred - 1]._operation = kMagicNothing; _whereIs[kPeopleCwytalot - 150] = kRoomNowhere; } else if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(4, false, _animation); // 4 = Cwytalot spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcFollowAvvyY; _whereIs[kPeopleCwytalot - 150] = kRoomBrummieRoad; if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... - _vm->_animation->appearPed(1, 1); // He appears on the right of the screen... + _animation->appearPed(1, 1); // He appears on the right of the screen... spr1->walkTo(3); // ...and he walks up... } else { // You've been here before. - _vm->_animation->appearPed(1, 3); // He's standing in your way straight away... + _animation->appearPed(1, 3); // He's standing in your way straight away... spr1->_facingDir = kDirLeft; } } @@ -867,22 +828,22 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomArgentRoad: if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again - _vm->_animation->appearPed(1, 0); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(4, false, _animation); // 4 = Cwytalot again + _animation->appearPed(1, 0); spr1->walkTo(1); spr1->_vanishIfStill = true; _passedCwytalotInHerts = true; // whereis[#157] = r__Nowhere; // can we fit this in? - _vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); + _timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); } break; case kRoomBridge: if (_drawbridgeOpen == 4) { // open - _vm->_background->draw(-1, -1, 2); // Position of drawbridge - _vm->_graphics->refreshBackground(); - _magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. + _background->draw(-1, -1, 2); // Position of drawbridge + _graphics->refreshBackground(); + _magics[kColorGreen - 1]._operation = kMagicNothing; // You may enter the drawbridge. } if (_geidaFollows) putGeidaAt(ped + 2, ped); // load Geida @@ -891,11 +852,11 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomRobins: if ((ped > 0) && (!_beenTiedUp)) { // A welcome party... or maybe not... - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(6, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(6, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(2); - _vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); + _timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); } if (_beenTiedUp) { @@ -904,31 +865,31 @@ void Avalot::enterRoom(Room roomId, byte ped) { } if (_tiedUp) - _vm->_background->draw(-1, -1, 1); + _background->draw(-1, -1, 1); if (!_mushroomGrowing) - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); break; case kRoomOutsideCardiffCastle: if (ped > 0) { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; + AnimationType *spr1 = &_animation->_sprites[1]; switch (_cardiffQuestionNum) { case 0 : // You've answered NONE of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 1); + spr1->init(9, false, _animation); + _animation->appearPed(1, 1); spr1->walkTo(2); - _vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); + _timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); break; case 5 : - _magics[1]._operation = Avalot::kMagicNothing; + _magics[1]._operation = kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: // You've answered SOME of his questions. - spr1->init(9, false, _vm->_animation); - _vm->_animation->appearPed(1, 2); + spr1->init(9, false, _animation); + _animation->appearPed(1, 2); spr1->_facingDir = kDirRight; - _vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); + _timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); } } @@ -945,12 +906,12 @@ void Avalot::enterRoom(Room roomId, byte ped) { zoomOut(_peds[ped]._x, _peds[ped]._y); if ((_objects[kObjectWine - 1]) && (_wineState != 3)) { - _vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! + _dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! _objects[kObjectWine - 1] = false; refreshObjectList(); } - _vm->_dialogs->displayScrollChain('q', 69); + _dialogs->displayScrollChain('q', 69); break; case kRoomCatacombs: @@ -972,35 +933,35 @@ void Avalot::enterRoom(Room roomId, byte ped) { } _enterCatacombsFromLustiesRoom = true; - _vm->_animation->catacombMove(ped); + _animation->catacombMove(ped); _enterCatacombsFromLustiesRoom = false; } break; case kRoomArgentPub: if (_wonNim) - _vm->_background->draw(-1, -1, 0); // No lute by the settle. + _background->draw(-1, -1, 0); // No lute by the settle. _malagauche = 0; // Ready to boot Malagauche if (_givenBadgeToIby) { - _vm->_background->draw(-1, -1, 7); - _vm->_background->draw(-1, -1, 8); + _background->draw(-1, -1, 7); + _background->draw(-1, -1, 8); } - _vm->_graphics->refreshBackground(); + _graphics->refreshBackground(); break; case kRoomLustiesRoom: _npcFacing = 1; // du Lustie. - if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes - _vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); + if (_animation->_sprites[0]._id == 0) // Avvy in his normal clothes + _timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (!_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. - _vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); + _timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); if (_geidaFollows) { putGeidaAt(4, ped); if (_lustieIsAsleep) { - _vm->_background->draw(-1, -1, 4); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 4); + _graphics->refreshBackground(); } } break; @@ -1008,43 +969,43 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomMusicRoom: if (_jacquesState > 0) { _jacquesState = 5; - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_background->draw(-1, -1, 3); - _magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _background->draw(-1, -1, 3); + _magics[kColorBrown - 1]._operation = kMagicNothing; _whereIs[kPeopleJacques - 150] = kRoomNowhere; } if (ped != 0) { - _vm->_background->draw(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startMusicRoomSeq(); + _background->draw(-1, -1, 5); + _graphics->refreshBackground(); + _sequence->startMusicRoomSeq(); } break; case kRoomOutsideNottsPub: if (ped == 2) { - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startDuckSeq(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _sequence->startDuckSeq(); } break; case kRoomOutsideArgentPub: if (ped == 2) { - _vm->_background->draw(-1, -1, 5); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startMusicRoomSeq(); + _background->draw(-1, -1, 5); + _graphics->refreshBackground(); + _sequence->startMusicRoomSeq(); } break; case kRoomWiseWomans: { - AnimationType *spr1 = &_vm->_animation->_sprites[1]; - spr1->init(11, false, _vm->_animation); + AnimationType *spr1 = &_animation->_sprites[1]; + spr1->init(11, false, _animation); if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { - _vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. + _animation->appearPed(1, 1); // Start on the right-hand side of the screen. spr1->walkTo(3); // Walks up to greet you. } else { - _vm->_animation->appearPed(1, 3); // Starts where she was before. + _animation->appearPed(1, 3); // Starts where she was before. spr1->_facingDir = kDirLeft; } @@ -1055,25 +1016,25 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { - _vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. - _vm->_background->draw(-1, -1, 0); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startCardiffSeq2(); + _animation->_sprites[1].init(10, false, _animation); // Define the dart. + _background->draw(-1, -1, 0); + _graphics->refreshBackground(); + _sequence->startCardiffSeq2(); } else { - _vm->_background->draw(-1, -1, 0); + _background->draw(-1, -1, 0); if (_arrowInTheDoor) - _vm->_background->draw(-1, -1, 2); + _background->draw(-1, -1, 2); else - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); } break; case kRoomAvvysGarden: if (ped == 1) { - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startGardenSeq(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _sequence->startGardenSeq(); } break; @@ -1083,22 +1044,22 @@ void Avalot::enterRoom(Room roomId, byte ped) { if (ped == 2) { #if 0 // It was the original: - _vm->_celer->show_one(-1, -1, 2); - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(3); - _vm->_sequence->start_to_close(); + _celer->show_one(-1, -1, 2); + _sequence->first_show(1); + _sequence->then_show(3); + _sequence->start_to_close(); #endif - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startGardenSeq(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); + _sequence->startGardenSeq(); } break; case kRoomAylesOffice: if (_aylesIsAwake) - _vm->_background->draw(-1, -1, 1); - _vm->_graphics->refreshBackground(); + _background->draw(-1, -1, 1); + _graphics->refreshBackground(); break; // Ayles awake. case kRoomGeidas: @@ -1118,16 +1079,16 @@ void Avalot::enterRoom(Room roomId, byte ped) { case kRoomNottsPub: if (_sittingInPub) - _vm->_background->draw(-1, -1, 2); + _background->draw(-1, -1, 2); _npcFacing = 1; // Port. break; case kRoomOutsideDucks: if (ped == 2) { // Shut the door - _vm->_background->draw(-1, -1, 2); - _vm->_graphics->refreshBackground(); - _vm->_sequence->startDuckSeq(); + _background->draw(-1, -1, 2); + _graphics->refreshBackground(); + _sequence->startDuckSeq(); } break; @@ -1140,7 +1101,7 @@ void Avalot::enterRoom(Room roomId, byte ped) { _isLoaded = false; } -void Avalot::thinkAbout(byte object, bool type) { +void AvalancheEngine::thinkAbout(byte object, bool type) { const int16 picSize = 966; _thinks = object; @@ -1148,10 +1109,10 @@ void Avalot::thinkAbout(byte object, bool type) { setMousePointerWait(); - if (type == Avalot::kThing) { + if (type == kThing) { if (!file.open("thinks.avd")) error("AVALANCHE: Lucerna: File not found: thinks.avd"); - } else { // Avalot::kPerson + } else { // kPerson if (!file.open("folk.avd")) error("AVALANCHE: Lucerna: File not found: folk.avd"); @@ -1165,8 +1126,8 @@ void Avalot::thinkAbout(byte object, bool type) { CursorMan.showMouse(false); file.seek(object * picSize + 65); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); + ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); + _graphics->drawPicture(_graphics->_surface, picture, 205, 170); picture.free(); file.close(); @@ -1175,7 +1136,7 @@ void Avalot::thinkAbout(byte object, bool type) { _thinkThing = type; } -void Avalot::loadDigits() { // Load the scoring digits & rwlites +void AvalancheEngine::loadDigits() { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; @@ -1184,36 +1145,36 @@ void Avalot::loadDigits() { // Load the scoring digits & rwlites for (int i = 0; i < 10; i++) { file.seek(i * digitsize); - _digits[i] = _vm->_graphics->loadPictureGraphic(file); + _digits[i] = _graphics->loadPictureGraphic(file); } for (int i = 0; i < 9; i++) { file.seek(10 * digitsize + i * rwlitesize); - _directions[i] = _vm->_graphics->loadPictureGraphic(file); + _directions[i] = _graphics->loadPictureGraphic(file); } file.close(); } -void Avalot::drawToolbar() { +void AvalancheEngine::drawToolbar() { if (!file.open("useful.avd")) error("AVALANCHE: Lucerna: File not found: useful.avd"); file.seek(40); CursorMan.showMouse(false); - ::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); + ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); + _graphics->drawPicture(_graphics->_surface, picture, 5, 169); picture.free(); file.close(); CursorMan.showMouse(true); - _vm->_animation->setOldDirection(kDirNone); + _animation->setOldDirection(kDirNone); drawDirection(); } -void Avalot::drawScore() { +void AvalancheEngine::drawScore() { uint16 score = _dnascore; int8 numbers[3] = {0, 0, 0}; for (int i = 0; i < 2; i++) { @@ -1229,7 +1190,7 @@ void Avalot::drawScore() { for (int i = 0; i < 3; i++) { if (_scoreToDisplay[i] != numbers[i]) - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); + _graphics->drawPicture(_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); @@ -1238,63 +1199,63 @@ void Avalot::drawScore() { _scoreToDisplay[i] = numbers[i]; } -void Avalot::incScore(byte num) { +void AvalancheEngine::incScore(byte num) { for (int i = 1; i <= num; i++) { _dnascore++; if (_soundFx) { for (int j = 1; j <= 97; j++) // Length os 2 is a guess, the original doesn't have a delay specified - _vm->_sound->playNote(177 + _dnascore * 3, 2); + _sound->playNote(177 + _dnascore * 3, 2); } } - warning("STUB: Avalot::points()"); + warning("STUB: points()"); drawScore(); } -void Avalot::useCompass(const Common::Point &cursorPos) { - byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); +void AvalancheEngine::useCompass(const Common::Point &cursorPos) { + byte color = *(byte *)_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); switch (color) { case kColorGreen: - _vm->_animation->setDirection(kDirUp); - _vm->_animation->setMoveSpeed(0, kDirUp); + _animation->setDirection(kDirUp); + _animation->setMoveSpeed(0, kDirUp); drawDirection(); break; case kColorBrown: - _vm->_animation->setDirection(kDirDown); - _vm->_animation->setMoveSpeed(0, kDirDown); + _animation->setDirection(kDirDown); + _animation->setMoveSpeed(0, kDirDown); drawDirection(); break; case kColorCyan: - _vm->_animation->setDirection(kDirLeft); - _vm->_animation->setMoveSpeed(0, kDirLeft); + _animation->setDirection(kDirLeft); + _animation->setMoveSpeed(0, kDirLeft); drawDirection(); break; case kColorLightmagenta: - _vm->_animation->setDirection(kDirRight); - _vm->_animation->setMoveSpeed(0, kDirRight); + _animation->setDirection(kDirRight); + _animation->setMoveSpeed(0, kDirRight); drawDirection(); break; case kColorRed: case kColorWhite: case kColorLightcyan: case kColorYellow: // Fall-throughs are intended. - _vm->_animation->stopWalking(); + _animation->stopWalking(); drawDirection(); break; } } -void Avalot::fxToggle() { - warning("STUB: Avalot::fxtoggle()"); +void AvalancheEngine::fxToggle() { + warning("STUB: fxtoggle()"); } -void Avalot::refreshObjectList() { +void AvalancheEngine::refreshObjectList() { _carryNum = 0; if (_thinkThing && !_objects[_thinks - 1]) - thinkAbout(kObjectMoney, Avalot::kThing); // you always have money + thinkAbout(kObjectMoney, kThing); // you always have money for (int i = 0; i < kObjectNum; i++) { if (_objects[i]) { @@ -1307,15 +1268,15 @@ void Avalot::refreshObjectList() { /** * @remarks Originally called 'verte' */ -void Avalot::guideAvvy(Common::Point cursorPos) { +void AvalancheEngine::guideAvvy(Common::Point cursorPos) { if (!_userMovesAvvy) return; cursorPos.y /= 2; byte what; - // _vm->_animation->tr[0] is Avalot.) - AnimationType *avvy = &_vm->_animation->_sprites[0]; + // _animation->tr[0] is Avalot.) + AnimationType *avvy = &_animation->_sprites[0]; if (cursorPos.x < avvy->_x) what = 1; else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) @@ -1330,39 +1291,39 @@ void Avalot::guideAvvy(Common::Point cursorPos) { switch (what) { case 0: - _vm->_animation->stopWalking(); + _animation->stopWalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_animation->setMoveSpeed(0, kDirLeft); + _animation->setMoveSpeed(0, kDirLeft); break; case 2: - _vm->_animation->setMoveSpeed(0, kDirRight); + _animation->setMoveSpeed(0, kDirRight); break; case 3: - _vm->_animation->setMoveSpeed(0, kDirUp); + _animation->setMoveSpeed(0, kDirUp); break; case 4: - _vm->_animation->setMoveSpeed(0, kDirUpLeft); + _animation->setMoveSpeed(0, kDirUpLeft); break; case 5: - _vm->_animation->setMoveSpeed(0, kDirUpRight); + _animation->setMoveSpeed(0, kDirUpRight); break; case 6: - _vm->_animation->setMoveSpeed(0, kDirDown); + _animation->setMoveSpeed(0, kDirDown); break; case 7: - _vm->_animation->setMoveSpeed(0, kDirDownLeft); + _animation->setMoveSpeed(0, kDirDownLeft); break; case 8: - _vm->_animation->setMoveSpeed(0, kDirDownRight); + _animation->setMoveSpeed(0, kDirDownRight); break; } // No other values are possible. drawDirection(); } -void Avalot::checkClick() { - Common::Point cursorPos = _vm->getMousePos(); +void AvalancheEngine::checkClick() { + Common::Point cursorPos = getMousePos(); _onToolbar = kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); /*if (mrelease > 0) @@ -1374,7 +1335,7 @@ void Avalot::checkClick() { newMouse(7); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) newMouse(1); // screwdriver - else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. + else if (!_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { newMouse(6); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. @@ -1385,45 +1346,45 @@ void Avalot::checkClick() { if (_holdLeftMouse) { if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. if (_dropsOk) - _vm->_menu->update(); + _menu->update(); } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. - _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; - if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) - _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; - if (_vm->_parser->_inputTextPos < 1) - _vm->_parser->_inputTextPos = 1; - _vm->_parser->_inputTextPos--; - _vm->_parser->plotText(); + _parser->_inputTextPos = (cursorPos.x - 23) / 8; + if (_parser->_inputTextPos > _parser->_inputText.size() + 1) + _parser->_inputTextPos = _parser->_inputText.size() + 1; + if (_parser->_inputTextPos < 1) + _parser->_inputTextPos = 1; + _parser->_inputTextPos--; + _parser->plotText(); } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. if (_alive && _avvyIsAwake) useCompass(cursorPos); } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. do { - _vm->updateEvents(); + updateEvents(); } while (_holdLeftMouse); if (_thinkThing) { - _vm->_parser->_thing = _thinks; - _vm->_parser->_thing += 49; - _vm->_parser->_person = kPeoplePardon; + _parser->_thing = _thinks; + _parser->_thing += 49; + _parser->_person = kPeoplePardon; } else { - _vm->_parser->_person = (People) _thinks; - _vm->_parser->_thing = _vm->_parser->kPardon; + _parser->_person = (People) _thinks; + _parser->_thing = _parser->kPardon; } callVerb(kVerbCodeExam); } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. do { - _vm->updateEvents(); + updateEvents(); } while (_holdLeftMouse); callVerb(kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = kWalk; - _vm->_animation->updateSpeed(); + _animation->_sprites[0]._speedX = kWalk; + _animation->updateSpeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_animation->_sprites[0]._speedX = kRun; - _vm->_animation->updateSpeed(); + _animation->_sprites[0]._speedX = kRun; + _animation->updateSpeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) @@ -1433,60 +1394,60 @@ void Avalot::checkClick() { } } -void Avalot::errorLed() { - warning("STUB: Avalot::errorled()"); +void AvalancheEngine::errorLed() { + warning("STUB: errorled()"); } -int8 Avalot::fades(int8 x) { - warning("STUB: Avalot::fades()"); +int8 AvalancheEngine::fades(int8 x) { + warning("STUB: fades()"); return 0; } -void Avalot::fadeOut(byte n) { - warning("STUB: Avalot::fadeOut()"); +void AvalancheEngine::fadeOut(byte n) { + warning("STUB: fadeOut()"); } -void Avalot::dusk() { - warning("STUB: Avalot::dusk()"); +void AvalancheEngine::dusk() { + warning("STUB: dusk()"); } -void Avalot::fadeIn(byte n) { - warning("STUB: Avalot::fadeIn()"); +void AvalancheEngine::fadeIn(byte n) { + warning("STUB: fadeIn()"); } -void Avalot::dawn() { - warning("STUB: Avalot::dawn()"); +void AvalancheEngine::dawn() { + warning("STUB: dawn()"); } -void Avalot::drawDirection() { // It's data is loaded in load_digits(). - if (_vm->_animation->getOldDirection() == _vm->_animation->getDirection()) +void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits(). + if (_animation->getOldDirection() == _animation->getDirection()) return; - _vm->_animation->setOldDirection(_vm->_animation->getDirection()); + _animation->setOldDirection(_animation->getDirection()); CursorMan.showMouse(false); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->getDirection()], 0, 161); + _graphics->drawPicture(_graphics->_surface, _directions[_animation->getDirection()], 0, 161); CursorMan.showMouse(true); } -void Avalot::gameOver() { +void AvalancheEngine::gameOver() { _userMovesAvvy = false; - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = &_animation->_sprites[0]; int16 sx = avvy->_x; int16 sy = avvy->_y; avvy->remove(); - avvy->init(12, true, _vm->_animation); // 12 = Avalot falls + avvy->init(12, true, _animation); // 12 = Avalot falls avvy->_stepNum = 0; avvy->appear(sx, sy, kDirUp); - _vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); + _timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); _alive = false; } -void Avalot::minorRedraw() { +void AvalancheEngine::minorRedraw() { dusk(); enterRoom(_room, 0); // Ped unknown or non-existant. @@ -1498,13 +1459,13 @@ void Avalot::minorRedraw() { dawn(); } -void Avalot::majorRedraw() { - warning("STUB: Avalot::major_redraw()"); +void AvalancheEngine::majorRedraw() { + warning("STUB: major_redraw()"); } -uint16 Avalot::bearing(byte whichPed) { +uint16 AvalancheEngine::bearing(byte whichPed) { static const double rad2deg = 180 / 3.14; // Pi - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = &_animation->_sprites[0]; PedType *curPed = &_peds[whichPed]; if (avvy->_x == curPed->_x) @@ -1519,24 +1480,24 @@ uint16 Avalot::bearing(byte whichPed) { /** * @remarks Originally called 'sprite_run' */ -void Avalot::spriteRun() { +void AvalancheEngine::spriteRun() { _doingSpriteRun = true; - _vm->_animation->animLink(); + _animation->animLink(); _doingSpriteRun = false; } -void Avalot::fixFlashers() { +void AvalancheEngine::fixFlashers() { _ledStatus = 177; - _vm->_animation->setOldDirection(kDirNone); - _vm->_dialogs->setReadyLight(2); + _animation->setOldDirection(kDirNone); + _dialogs->setReadyLight(2); drawDirection(); } -Common::String Avalot::intToStr(int32 num) { +Common::String AvalancheEngine::intToStr(int32 num) { return Common::String::format("%d", num); } -void Avalot::newMouse(byte id) { +void AvalancheEngine::newMouse(byte id) { if (id == _currentMouse) return; @@ -1548,12 +1509,12 @@ void Avalot::newMouse(byte id) { * Set the mouse pointer to 'HourGlass" * @remarks Originally called 'wait' */ -void Avalot::setMousePointerWait() { +void AvalancheEngine::setMousePointerWait() { newMouse(4); } -void Avalot::resetVariables() { - _vm->_animation->setDirection(kDirUp); +void AvalancheEngine::resetVariables() { + _animation->setDirection(kDirUp); _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -1561,7 +1522,7 @@ void Avalot::resetVariables() { _dnascore = 0; _money = 0; _room = kRoomNowhere; - _vm->_saveNum = 0; + _saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; @@ -1624,32 +1585,32 @@ void Avalot::resetVariables() { _givenPenToAyles = false; _askedDogfoodAboutNim = false; - _vm->_parser->resetVariables(); - _vm->_animation->resetVariables(); - _vm->_sequence->resetVariables(); + _parser->resetVariables(); + _animation->resetVariables(); + _sequence->resetVariables(); } -void Avalot::newGame() { +void AvalancheEngine::newGame() { for (int i = 0; i < kMaxSprites; i++) { - AnimationType *spr = &_vm->_animation->_sprites[i]; + AnimationType *spr = &_animation->_sprites[i]; if (spr->_quick) spr->remove(); } // Deallocate sprite. Sorry, beta testers! - AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->init(0, true, _vm->_animation); + AnimationType *avvy = &_animation->_sprites[0]; + avvy->init(0, true, _animation); _alive = true; resetVariables(); - _vm->_dialogs->setBubbleStateNatural(); + _dialogs->setBubbleStateNatural(); _spareEvening = "answer a questionnaire"; _favouriteDrink = "beer"; _money = 30; // 2/6 - _vm->_animation->setDirection(kDirStopped); - _vm->_parser->_wearing = kObjectClothes; + _animation->setDirection(kDirStopped); + _parser->_wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; _objects[kObjectBell - 1] = true; @@ -1668,7 +1629,7 @@ void Avalot::newGame() { _her = kPeoplePardon; _it = Parser::kPardon; _lastPerson = kPeoplePardon; // = Pardon? - _passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _passwordNum = _rnd->getRandomNumber(30) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; _avvyInBed = true; @@ -1677,16 +1638,16 @@ void Avalot::newGame() { enterRoom(kRoomYours, 1); avvy->_visible = false; drawScore(); - _vm->_menu->setup(); - _clock.update(); + _menu->setup(); + _clock->update(); spriteRun(); } -void Avalot::slowDown() { - warning("STUB: Avalot::slowdown()"); +void AvalancheEngine::slowDown() { + warning("STUB: slowdown()"); } -bool Avalot::setFlag(char x) { +bool AvalancheEngine::setFlag(char x) { for (uint16 i = 0; i < _flags.size(); i++) { if (_flags[i] == x) return true; @@ -1695,17 +1656,17 @@ bool Avalot::setFlag(char x) { return false; } -bool Avalot::decreaseMoney(uint16 amount) { +bool AvalancheEngine::decreaseMoney(uint16 amount) { _money -= amount; if (_money < 0) { - _vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" + _dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" gameOver(); return false; } else return true; } -Common::String Avalot::getName(People whose) { +Common::String AvalancheEngine::getName(People whose) { static const Common::String kLads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", @@ -1720,7 +1681,7 @@ Common::String Avalot::getName(People whose) { return kLasses[whose - kPeopleArkata]; } -byte Avalot::getNameChar(People whose) { +byte AvalancheEngine::getNameChar(People whose) { static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; static const char kLassChar[] = "kG\0xB1o"; @@ -1730,7 +1691,7 @@ byte Avalot::getNameChar(People whose) { return kLassChar[whose - kPeopleArkata]; } -Common::String Avalot::getThing(byte which) { +Common::String AvalancheEngine::getThing(byte which) { static const Common::String kThings[kObjectNum] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", @@ -1762,7 +1723,7 @@ Common::String Avalot::getThing(byte which) { return get_thing_result; } -char Avalot::getThingChar(byte which) { +char AvalancheEngine::getThingChar(byte which) { static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar char get_thingchar_result; @@ -1779,7 +1740,7 @@ char Avalot::getThingChar(byte which) { return get_thingchar_result; } -Common::String Avalot::getItem(byte which) { +Common::String AvalancheEngine::getItem(byte which) { static const Common::String kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", @@ -1821,8 +1782,7 @@ Common::String Avalot::getItem(byte which) { return get_better_result; } - -Common::String Avalot::f5Does() { +Common::String AvalancheEngine::f5Does() { switch (_room) { case kRoomYours: if (!_avvyIsAwake) @@ -1843,7 +1803,7 @@ Common::String Avalot::f5Does() { return Common::String::format("%cSSit down", kVerbCodeSit); break; case kRoomMusicRoom: - if (_vm->_animation->inField(5)) + if (_animation->inField(5)) return Common::String::format("%cPPlay the harp", kVerbCodePlay); break; } @@ -1851,7 +1811,7 @@ Common::String Avalot::f5Does() { return Common::String::format("%c", kVerbCodePardon); // If all else fails... } -void Avalot::loadMouse(byte which) { +void AvalancheEngine::loadMouse(byte which) { Common::File f; if (!f.open("mice.avd")) @@ -1865,7 +1825,7 @@ void Avalot::loadMouse(byte which) { // The AND mask. f.seek(kMouseSize * 2 * which + 134); - ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); + ::Graphics::Surface mask = _graphics->loadPictureGraphic(f); for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { @@ -1882,7 +1842,7 @@ void Avalot::loadMouse(byte which) { // The OR mask. f.seek(kMouseSize * 2 * which + 134 * 2); - mask = _vm->_graphics->loadPictureGraphic(f); + mask = _graphics->loadPictureGraphic(f); for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { @@ -1901,51 +1861,51 @@ void Avalot::loadMouse(byte which) { cursor.free(); } -void Avalot::setBackgroundColor(byte x) { - warning("STUB: Avalot::background()"); +void AvalancheEngine::setBackgroundColor(byte x) { + warning("STUB: background()"); } -void Avalot::hangAroundForAWhile() { +void AvalancheEngine::hangAroundForAWhile() { for (int i = 0; i < 28; i++) slowDown(); } -void Avalot::flipRoom(Room room, byte ped) { +void AvalancheEngine::flipRoom(Room room, byte ped) { assert((ped > 0) && (ped < 15)); if (!_alive) { // You can't leave the room if you're dead. - _vm->_animation->_sprites[0]._moveX = 0; - _vm->_animation->_sprites[0]._moveY = 0; // Stop him from moving. + _animation->_sprites[0]._moveX = 0; + _animation->_sprites[0]._moveY = 0; // Stop him from moving. return; } if ((room == kRoomDummy) && (_room == kRoomLusties)) { - _vm->_animation->hideInCupboard(); + _animation->hideInCupboard(); return; } if ((_jumpStatus > 0) && (_room == kRoomInsideCardiffCastle)) { // You can't *jump* out of Cardiff Castle! - _vm->_animation->_sprites[0]._moveX = 0; + _animation->_sprites[0]._moveX = 0; return; } exitRoom(_room); dusk(); - for (int16 i = 1; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._quick) - _vm->_animation->_sprites[i].remove(); + for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) { + if (_animation->_sprites[i]._quick) + _animation->_sprites[i].remove(); } // Deallocate sprite if (_room == kRoomLustiesRoom) _enterCatacombsFromLustiesRoom = true; enterRoom(room, ped); - _vm->_animation->appearPed(0, ped - 1); + _animation->appearPed(0, ped - 1); _enterCatacombsFromLustiesRoom = false; - _vm->_animation->setOldDirection(_vm->_animation->getDirection()); - _vm->_animation->setDirection(_vm->_animation->_sprites[0]._facingDir); + _animation->setOldDirection(_animation->getDirection()); + _animation->setDirection(_animation->_sprites[0]._facingDir); drawDirection(); dawn(); @@ -1958,54 +1918,54 @@ void Avalot::flipRoom(Room room, byte ped) { * here. * @remarks Originally called 'open_the_door' */ -void Avalot::openDoor(Room whither, byte ped, byte magicnum) { +void AvalancheEngine::openDoor(Room whither, byte ped, byte magicnum) { switch (_room) { case kRoomOutsideYours: case kRoomOutsideNottsPub: case kRoomOutsideDucks: - _vm->_sequence->startOutsideSeq(whither, ped); + _sequence->startOutsideSeq(whither, ped); break; case kRoomInsideCardiffCastle: - _vm->_sequence->startCardiffSeq(whither, ped); + _sequence->startCardiffSeq(whither, ped); break; case kRoomAvvysGarden: case kRoomEntranceHall: case kRoomInsideAbbey: case kRoomYourHall: - _vm->_sequence->startHallSeq(whither, ped); + _sequence->startHallSeq(whither, ped); break; case kRoomMusicRoom: case kRoomOutsideArgentPub: - _vm->_sequence->startMusicRoomSeq2(whither, ped); + _sequence->startMusicRoomSeq2(whither, ped); break; case kRoomLusties: switch (magicnum) { case 14: if (_avvysInTheCupboard) { - _vm->_animation->hideInCupboard(); - _vm->_sequence->startCupboardSeq(); + _animation->hideInCupboard(); + _sequence->startCupboardSeq(); return; } else { - _vm->_animation->appearPed(0, 5); - _vm->_animation->_sprites[0]._facingDir = kDirRight; - _vm->_sequence->startLustiesSeq2(whither, ped); + _animation->appearPed(0, 5); + _animation->_sprites[0]._facingDir = kDirRight; + _sequence->startLustiesSeq2(whither, ped); } break; case 12: - _vm->_sequence->startLustiesSeq3(whither, ped); + _sequence->startLustiesSeq3(whither, ped); break; } break; default: - _vm->_sequence->startDummySeq(whither, ped); + _sequence->startDummySeq(whither, ped); } } -void Avalot::setRoom(People persId, Room roomId) { +void AvalancheEngine::setRoom(People persId, Room roomId) { _whereIs[persId - kPeopleAvalot] = roomId; } -Room Avalot::getRoom(People persId) { +Room AvalancheEngine::getRoom(People persId) { return _whereIs[persId - kPeopleAvalot]; } } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index a80d80d27541..af7ba2c71dbe 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -111,261 +111,6 @@ struct Sundry { // Things which must be saved over a backtobootstrap, outside DN }; #endif -class Avalot { -public: - static const int16 kXW = 30; - static const int16 kYW = 36; // x width & y whatsit - static const int16 kMargin = 5; - static const MouseHotspotType kMouseHotSpots[9]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. - - // For Thinkabout: - static const bool kThing = true; - static const bool kPerson = false; - - // Magic/portal constants: - enum Magics { - kMagicNothing, // Ignore it if this line is touched. - kMagicBounce, // Bounce off this line. Not valid for portals. - kMagicExclaim, // Put up a chain of scrolls. - kMagicTransport, // Enter new room. - kMagicUnfinished, // Unfinished connection. - kMagicSpecial, // Special function. - kMagicOpenDoor // Opening door. - }; - - // These following static constants should be included in CFG when it's written. - - static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. - static const int16 kBorder = 1; // size of border on shadowboxes - static const int16 kWalk = 3; - static const int16 kRun = 5; - static const int32 kCatacombMap[8][8]; - static const char kSpludwicksOrder[3]; - static const QuasipedType kQuasipeds[16]; - - enum Pitch { - kPitchInvalid, - kPitchLower, - kPitchSame, - kPitchHigher - }; - - static const uint16 kNotes[12]; - static const TuneType kTune; - - static const char *kVersionNum; - static const char *kCopyright; - static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". - static const int16 kGameCode = 2; // Avalot's code number - - - - Avalot(AvalancheEngine *vm); - ~Avalot(); - - bool _holdLeftMouse; - Clock _clock; - - // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. - // If a scroll comes up, or you leave the room, it's automatically set to zero. - byte _interrogation; - - // Former DNA structure - byte _carryNum; // How many objects you're carrying... - bool _objects[kObjectNum]; // ...and which ones they are. - int16 _dnascore; // your score, of course - int32 _money; // your current amount of dosh - Room _room; // your current room - byte _roomCount[100]; // Add one to each every time you enter a room - bool _wonNim; // Have you *won* Nim? (That's harder.) - byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. - bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? - byte _passwordNum; // Number of the passw for this game. - bool _aylesIsAwake; // pretty obvious! - byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). - byte _avariciusTalk; // How much Avaricius has said to you. - bool _rottenOnion; // And has it rotted? - bool _onionInVinegar; // Is the onion in the vinegar? - byte _givenToSpludwick; // 0 = nothing given, 1 = onion... - byte _brummieStairs; // Progression through the stairs trick. - byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? - bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) - bool _avvyInBed; // True if Avvy's in bed, but awake. - bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. - byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment. - bool _givenBadgeToIby; // Have you given the badge to Iby yet? - bool _friarWillTieYouUp; // If you're going to get tied up. - bool _tiedUp; // You ARE tied up! - byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box. - bool _talkedToCrapulus; // Pretty self-explanatory. - byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone. - bool _bellsAreRinging; // Is Jacques ringing the bells? - bool _standingOnDais; // In room 71, inside Cardiff Castle. - bool _takenPen; // Have you taken the pen (in Cardiff?) - bool _arrowTriggered; // And has the arrow been triggered? - bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's - uint32 _totalTime; // Your total time playing this game, in ticks. - byte _jumpStatus; // Fixes how high you're jumping. - bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; - byte _lastRoomNotMap; - bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? - bool _enterCatacombsFromLustiesRoom; - bool _teetotal; // Are we touching any more drinks? - byte _malagauche; // Position of Malagauche. See Celer for more info. - char _drinking; // What's he getting you? - bool _enteredLustiesRoomAsMonk; - byte _catacombX, _catacombY; // XY coords in the catacombs. - bool _avvysInTheCupboard; // On screen 22. - bool _geidaFollows; // Is Geida following you? - byte _nextBell; // For the ringing. - bool _givenPotionToGeida; // Does Geida have the potion? - bool _lustieIsAsleep; // Is BDL asleep? - bool _beenTiedUp; // In r__Robins. - bool _sittingInPub; // Are you sitting down in the pub? - byte _spurgeTalkCount; // Count for talking to Spurge. - bool _metAvaroid; - bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; - // End of former DNA Structure - - byte _lineNum; // Number of lines. - LineType _lines[50]; // For Also. - enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; - bool _dropsOk, _soundFx, _cheat; - Common::String _mouseText; - bool _weirdWord; - bool _letMeOut; - Common::String _scroll[15]; - byte _scrollNum, _whichwas; - byte _thinks; - bool _thinkThing; - int16 _talkX, _talkY; - byte _talkBackgroundColor, _talkFontColor; - byte _scrollBells; // no. of times to ring the bell - bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? - char _objectList[10]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. - // Called .free() for them in ~Gyro(). - int8 _scoreToDisplay[3]; - byte _currentMouse; // current mouse-void - Common::String _verbStr; // what you can do with your object. :-) - Common::String *_also[31][2]; - PedType _peds[15]; - MagicType _magics[15]; - MagicType _portals[7]; - FieldType _fields[30]; - byte _fieldNum; - Common::String _flags; - Common::String _listen; - byte _cp, _ledStatus, _defaultLed; - FontType _font; - bool _alive; - byte _buffer[2000]; - uint16 _bufSize; - int16 _underScroll; // Y-coord of just under the scroll text. - Common::String _roomnName; // Name of actual room - Common::String _subject; // What you're talking to them about. - byte _subjectNum; // The same thing. - bool _keyboardClick; // Is a keyboard click noise wanted? - People _him, _her; - byte _it; - int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - - People _lastPerson; // Last person to have been selected using the People menu. - bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. - bool _isLoaded; // Is it a loaded gamestate? - Common::String _enidFilename; - - void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). - void setup(); - void runAvalot(); - - void init(); - void callVerb(VerbCode id); - void drawAlsoLines(); - void loadRoom(byte num); - void exitRoom(byte x); - void enterRoom(Room room, byte ped); - void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! - void loadDigits(); // Load the scoring digits & rwlites - void drawToolbar(); - void drawScore(); - void incScore(byte num); // Add on no. of points - void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. - void fxToggle(); - void refreshObjectList(); - void checkClick(); - void errorLed(); - void dusk(); - void dawn(); - void drawDirection(); // Draws the little icon at the left end of the text input field. - void gameOver(); - uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. - void fixFlashers(); - void loadAlso(byte num); - - // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. - void minorRedraw(); - void majorRedraw(); - - void spriteRun(); - - Common::String intToStr(int32 num); - void newMouse(byte id); - void setMousePointerWait(); // Makes hourglass. - void loadMouse(byte which); - - void setBackgroundColor(byte x); - - void resetVariables(); - void newGame(); // This sets up the DNA for a completely new game. - void slowDown(); - bool setFlag(char x); - bool decreaseMoney(uint16 amount); // Called pennycheck in the original. - void hangAroundForAWhile(); - - Common::String getName(People whose); - byte getNameChar(People whose); - Common::String getThing(byte which); - char getThingChar(byte which); - Common::String getItem(byte which); // Called get_better in the original. - Common::String f5Does(); // This procedure determines what f5 does. - - void openDoor(Room whither, byte ped, byte magicnum); // Handles slidey-open doors. - void flipRoom(Room room, byte ped); - - void setRoom(People persId, Room roomId); - Room getRoom(People persId); -private: - AvalancheEngine *_vm; - - static Room _whereIs[29]; - - Common::File file; - Common::String readAlsoStringFromFile(); - void scram(Common::String &str); - void unScramble(); - - void zoomOut(int16 x, int16 y); // Only used when entering the map. - void enterNewTown(); - void findPeople(byte room); - void putGeidaAt(byte whichPed, byte ped); - void guideAvvy(Common::Point cursorPos); - - // Will be used in dusk() and dawn(). - bool _fxHidden; - - int8 fades(int8 x); - void fadeOut(byte n); - void fadeIn(byte n); -}; - } // End of namespace Avalanche #endif // AVALANCHE_AVALOT_H diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 00c51beba654..c4abc660decd 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -53,28 +53,28 @@ void Background::update() { if (_vm->_menu->isActive()) return; // No animation when the menus are up. - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomOutsideArgentPub: - if ((_vm->_avalot->_roomTime % 12) == 0) - draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 4); + if ((_vm->_roomTime % 12) == 0) + draw(-1, -1, (_vm->_roomTime / 12) % 4); break; case kRoomBrummieRoad: - if ((_vm->_avalot->_roomTime % 2) == 0) - draw(-1, -1, (_vm->_avalot->_roomTime / 2) % 4); + if ((_vm->_roomTime % 2) == 0) + draw(-1, -1, (_vm->_roomTime / 2) % 4); break; case kRoomBridge: - if ((_vm->_avalot->_roomTime % 2) == 0) - draw(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4); + if ((_vm->_roomTime % 2) == 0) + draw(-1, -1, 3 + (_vm->_roomTime / 2) % 4); break; case kRoomYours: - if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0)) - draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 2); + if ((!_vm->_avvyIsAwake) && ((_vm->_roomTime % 4) == 0)) + draw(-1, -1, (_vm->_roomTime / 12) % 2); break; case kRoomArgentPub: - if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) { + if (((_vm->_roomTime % 7) == 1) && (_vm->_malagauche != 177)) { // Malagauche cycle. - _vm->_avalot->_malagauche++; - switch (_vm->_avalot->_malagauche) { + _vm->_malagauche++; + switch (_vm->_malagauche) { case 1: case 11: case 21: @@ -90,12 +90,12 @@ void Background::update() { draw(-1, -1, 12); // Winks. break; case 33: - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; break; } } - switch (_vm->_avalot->_roomTime % 200) { + switch (_vm->_roomTime % 200) { case 179: case 197: draw(-1, -1, 4); // Dogfood's drinking cycle. @@ -108,13 +108,13 @@ void Background::update() { draw(-1, -1, 6); break; case 199: - _vm->_avalot->_npcFacing = 177; // Impossible value for this. + _vm->_npcFacing = 177; // Impossible value for this. break; } - if ((_vm->_avalot->_roomTime % 200 >= 0) && (_vm->_avalot->_roomTime % 200 <= 178)) { // Normally. + if ((_vm->_roomTime % 200 >= 0) && (_vm->_roomTime % 200 <= 178)) { // Normally. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); + uint16 angle = _vm->bearing(1); if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) direction = 3; else if ((angle >= 293) && (angle <= 357)) @@ -122,15 +122,15 @@ void Background::update() { else if ((angle >= 271) && (angle <= 292)) direction = 4; - if (direction != _vm->_avalot->_npcFacing) { // Dogfood. + if (direction != _vm->_npcFacing) { // Dogfood. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } } break; case kRoomWestHall: - if ((_vm->_avalot->_roomTime % 3) == 0) { - switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) { + if ((_vm->_roomTime % 3) == 0) { + switch ((_vm->_roomTime / int32(3)) % int32(6)) { case 4: draw(-1, -1, 0); break; @@ -147,10 +147,10 @@ void Background::update() { } break; case kRoomLustiesRoom: - if (!(_vm->_avalot->_lustieIsAsleep)) { + if (!(_vm->_lustieIsAsleep)) { byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); - if ((_vm->_avalot->_roomTime % 45) > 42) + uint16 angle = _vm->bearing(1); + if ((_vm->_roomTime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) @@ -160,15 +160,15 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 3; // Right. - if (direction != _vm->_avalot->_npcFacing) { // du Lustie. + if (direction != _vm->_npcFacing) { // du Lustie. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } } break; case kRoomAylesOffice: - if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) { - switch ((_vm->_avalot->_roomTime / 14) % 2) { + if ((!_vm->_aylesIsAwake) && (_vm->_roomTime % 14 == 0)) { + switch ((_vm->_roomTime / 14) % 2) { case 0: draw(-1, -1, 0); // Frame 2: EGA. break; @@ -179,8 +179,8 @@ void Background::update() { } break; case kRoomRobins: - if (_vm->_avalot->_tiedUp) { - switch (_vm->_avalot->_roomTime % 54) { + if (_vm->_tiedUp) { + switch (_vm->_roomTime % 54) { case 20: draw(-1, -1, 3); // Frame 4: Avalot blinks. break; @@ -193,7 +193,7 @@ void Background::update() { case kRoomNottsPub: { // Bearing of Avvy from Port. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(4); + uint16 angle = _vm->bearing(4); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 2; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -201,15 +201,15 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_avalot->_roomTime % 60) > 57) + if ((_vm->_roomTime % 60) > 57) direction--; // Blinks. - if (direction != _vm->_avalot->_npcFacing) { // Port. + if (direction != _vm->_npcFacing) { // Port. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } - switch (_vm->_avalot->_roomTime % 50) { + switch (_vm->_roomTime % 50) { case 45 : draw(-1, -1, 8); // Spurge blinks. break; @@ -220,12 +220,12 @@ void Background::update() { break; } case kRoomDucks: { - if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers. - draw(-1, -1, (_vm->_avalot->_roomTime / 3) % 3); + if ((_vm->_roomTime % 3) == 0) // The fire flickers. + draw(-1, -1, (_vm->_roomTime / 3) % 3); // Bearing of Avvy from Duck. byte direction = 0; - uint16 angle = _vm->_avalot->bearing(1); + uint16 angle = _vm->bearing(1); if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) direction = 4; // Middle. else if ((angle >= 45) && (angle <= 180)) @@ -233,26 +233,26 @@ void Background::update() { else if ((angle >= 181) && (angle <= 314)) direction = 8; // Right. - if ((_vm->_avalot->_roomTime % 45) > 42) + if ((_vm->_roomTime % 45) > 42) direction++; // Duck blinks. - if (direction != _vm->_avalot->_npcFacing) { // Duck. + if (direction != _vm->_npcFacing) { // Duck. draw(-1, -1, direction - 1); - _vm->_avalot->_npcFacing = direction; + _vm->_npcFacing = direction; } break; } } - if ((_vm->_avalot->_bellsAreRinging) && (_vm->_avalot->setFlag('B'))) { + if ((_vm->_bellsAreRinging) && (_vm->setFlag('B'))) { // They're ringing the bells. - switch (_vm->_avalot->_roomTime % 4) { + switch (_vm->_roomTime % 4) { case 1: - if (_vm->_avalot->_nextBell < 5) - _vm->_avalot->_nextBell = 12; - _vm->_avalot->_nextBell--; + if (_vm->_nextBell < 5) + _vm->_nextBell = 12; + _vm->_nextBell--; // CHECKME: 2 is a guess. No length in the original? - _vm->_sound->playNote(_vm->_avalot->kNotes[_vm->_avalot->_nextBell], 2); + _vm->_sound->playNote(_vm->kNotes[_vm->_nextBell], 2); break; case 2: _vm->_sound->stopSound(); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 7eb8d50b3b89..c8fe128b578b 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -48,7 +48,7 @@ void Dialogs::init() { } void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever - if (_vm->_avalot->_ledStatus == state) + if (_vm->_ledStatus == state) return; // Already like that! byte color = kColorBlack; @@ -69,7 +69,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); CursorMan.showMouse(true); - _vm->_avalot->_ledStatus = state; + _vm->_ledStatus = state; } void Dialogs::easterEgg() { @@ -114,8 +114,8 @@ void Dialogs::scrollModeNormal() { Common::String e = "(c) 1994"; setReadyLight(3); - _vm->_avalot->_seeScroll = true; - _vm->_avalot->newMouse(3); + _vm->_seeScroll = true; + _vm->newMouse(3); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -143,7 +143,7 @@ void Dialogs::scrollModeNormal() { bool oktoexit; do { do { - _vm->_avalot->check(); // was "checkclick;" + _vm->check(); // was "checkclick;" //#ifdef RECORD slowdown(); basher::count++; #endif @@ -168,12 +168,12 @@ void Dialogs::scrollModeNormal() { //#ifdef RECORD record_one(); #endif - _vm->_avalot->screturn = r == '#'; // "back door" + _vm->screturn = r == '#'; // "back door" #endif setReadyLight(0); - _vm->_avalot->_seeScroll = false; - _vm->_avalot->_holdLeftMouse = false; // Used in Lucerna::checkclick(). + _vm->_seeScroll = false; + _vm->_holdLeftMouse = false; // Used in Lucerna::checkclick(). warning("STUB: Scrolls::scrollModeNormal()"); } @@ -196,8 +196,8 @@ void Dialogs::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Stri bool offset = text.size() % 2; x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3; y1 = (y2 - y1) / 2 + y1 - 4; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_avalot->_font, 8, x1, y1, kColorBlue); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_avalot->_font, 8, x1, y1, kColorBlue); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_font, 8, x1, y1, kColorBlue); + _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_font, 8, x1, y1, kColorBlue); CursorMan.showMouse(true); } @@ -206,7 +206,7 @@ void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); // It should work with keypresses too! TODO: Implement it! - _vm->_avalot->loadMouse(5); + _vm->loadMouse(5); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -243,7 +243,7 @@ bool Dialogs::theyMatch(TuneType &played) { byte mistakes = 0; for (unsigned int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->_avalot->kTune[i]) + if (played[i] != _vm->kTune[i]) mistakes++; } @@ -252,16 +252,16 @@ bool Dialogs::theyMatch(TuneType &played) { void Dialogs::scrollModeMusic() { setReadyLight(3); - _vm->_avalot->_seeScroll = true; + _vm->_seeScroll = true; CursorMan.showMouse(false); - _vm->_avalot->newMouse(3); + _vm->newMouse(3); TuneType played; for (unsigned int i = 0; i < sizeof(played); i++) - played[i] = Avalot::kPitchInvalid; + played[i] = kPitchInvalid; int8 lastOne = -1, thisOne = -1; // Invalid values. - _vm->_avalot->_seeScroll = true; + _vm->_seeScroll = true; ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -332,16 +332,16 @@ void Dialogs::scrollModeMusic() { lastOne = thisOne; thisOne = value; - _vm->_sound->playNote(_vm->_avalot->kNotes[thisOne], 100); + _vm->_sound->playNote(_vm->kNotes[thisOne], 100); _vm->_system->delayMillis(200); - if (!_vm->_avalot->_bellsAreRinging) { // These handle playing the right tune. + if (!_vm->_bellsAreRinging) { // These handle playing the right tune. if (thisOne < lastOne) - store(Avalot::kPitchLower, played); + store(kPitchLower, played); else if (thisOne == lastOne) - store(Avalot::kPitchSame, played); + store(kPitchSame, played); else - store(Avalot::kPitchHigher, played); + store(kPitchHigher, played); } if (theyMatch(played)) { @@ -354,30 +354,30 @@ void Dialogs::scrollModeMusic() { _vm->_graphics->_surface.copyFrom(temp); temp.free(); - _vm->_avalot->_seeScroll = false; + _vm->_seeScroll = false; CursorMan.showMouse(true); } void Dialogs::resetScrollDriver() { - _vm->_avalot->_scrollBells = 0; + _vm->_scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; - _vm->_avalot->_interrogation = 0; // Always reset after a scroll comes up. + _vm->_interrogation = 0; // Always reset after a scroll comes up. } void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_avalot->_scrollBells; i++) - _vm->_avalot->errorLed(); // Ring the bell "x" times. + for (int i = 0; i < _vm->_scrollBells; i++) + _vm->errorLed(); // Ring the bell "x" times. } void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(_dodgeCoord.x, _vm->_avalot->_underScroll); // Move the pointer off the scroll. + g_system->warpMouse(_dodgeCoord.x, _vm->_underScroll); // Move the pointer off the scroll. } void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_avalot->_underScroll)) + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_underScroll)) g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } @@ -408,7 +408,7 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); #if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_avalot->cp) * _vm->_avalot->pagetop); + uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->cp) * _vm->pagetop); byte bit; for (uint16 i = 1; i <= yl; i++) for (bit = 0; bit <= 3; bit++) { @@ -428,10 +428,10 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_vm->_avalot->_scrollNum) * 6; + int16 ly = (_vm->_scrollNum) * 6; int16 ex; - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - ex = _vm->_avalot->_scroll[i].size() * 8; + for (int i = 0; i < _vm->_scrollNum; i++) { + ex = _vm->_scroll[i].size() * 8; if (lx < ex) lx = ex; } @@ -497,44 +497,44 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - if (!_vm->_avalot->_scroll[i].empty()) - switch (_vm->_avalot->_scroll[i][_vm->_avalot->_scroll[i].size() - 1]) { + for (int i = 0; i < _vm->_scrollNum; i++) { + if (!_vm->_scroll[i].empty()) + switch (_vm->_scroll[i][_vm->_scroll[i].size() - 1]) { case kControlCenter: centre = true; - _vm->_avalot->_scroll[i].deleteLastChar(); + _vm->_scroll[i].deleteLastChar(); break; case kControlLeftJustified: centre = false; - _vm->_avalot->_scroll[i].deleteLastChar(); + _vm->_scroll[i].deleteLastChar(); break; case kControlQuestion: _shadowBoxX = mx + lx; _shadowBoxY = my + ly; - _vm->_avalot->_scroll[i].setChar(' ', 0); + _vm->_scroll[i].setChar(' ', 0); drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } if (centre) - say(320 - _vm->_avalot->_scroll[i].size() * 4 + iconIndent, my, _vm->_avalot->_scroll[i]); + say(320 - _vm->_scroll[i].size() * 4 + iconIndent, my, _vm->_scroll[i]); else - say(mx + iconIndent, my, _vm->_avalot->_scroll[i]); + say(mx + iconIndent, my, _vm->_scroll[i]); my += 12; } - _vm->_avalot->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. + _vm->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. ringBell(); - _vm->_avalot->_dropsOk = false; + _vm->_dropsOk = false; dodgem(); (this->*modeFunc)(); unDodgem(); - _vm->_avalot->_dropsOk = true; + _vm->_dropsOk = true; resetScrollDriver(); } @@ -544,9 +544,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = _vm->_avalot->_scrollNum * 5; - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - uint16 textWidth = _vm->_avalot->_scroll[i].size() * 8; + int16 yl = _vm->_scrollNum * 5; + for (int i = 0; i < _vm->_scrollNum; i++) { + uint16 textWidth = _vm->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; } @@ -557,90 +557,90 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { int16 my = yw * 2 - 2; int16 xc = 0; - if ((_vm->_avalot->_talkX - xw) < 0) - xc = -(_vm->_avalot->_talkX - xw); - if ((_vm->_avalot->_talkX + xw) > 639) - xc = 639 - (_vm->_avalot->_talkX + xw); + if ((_vm->_talkX - xw) < 0) + xc = -(_vm->_talkX - xw); + if ((_vm->_talkX + xw) > 639) + xc = 639 - (_vm->_talkX + xw); - points[0].x = _vm->_avalot->_talkX - 10; + points[0].x = _vm->_talkX - 10; points[0].y = yw; - points[1].x = _vm->_avalot->_talkX + 10; + points[1].x = _vm->_talkX + 10; points[1].y = yw; - points[2].x = _vm->_avalot->_talkX; - points[2].y = _vm->_avalot->_talkY; + points[2].x = _vm->_talkX; + points[2].y = _vm->_talkY; // Backup the screen before drawing the bubble. _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw + 9, 7, _vm->_avalot->_talkX + xw - 8 + xc, my + 1), _vm->_avalot->_talkBackgroundColor); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw - 1, 12, _vm->_avalot->_talkX + xw + xc + 2, my - 4), _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); + _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, 11, 0, 90, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, 11, 90, 180, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_avalot->_talkBackgroundColor); + _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_talkBackgroundColor); // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). - // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Avalot::characters instead. + // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { - int16 x = xc + _vm->_avalot->_talkX - _vm->_avalot->_scroll[i].size() / 2 * 8; - bool offset = _vm->_avalot->_scroll[i].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_avalot->_scroll[i], _vm->_avalot->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_avalot->_talkFontColor); + for (int i = 0; i < _vm->_scrollNum; i++) { + int16 x = xc + _vm->_talkX - _vm->_scroll[i].size() / 2 * 8; + bool offset = _vm->_scroll[i].size() % 2; + _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); } ringBell(); CursorMan.showMouse(false); - _vm->_avalot->_dropsOk = false; + _vm->_dropsOk = false; // This does the actual drawing to the screen. (this->*modeFunc)(); - _vm->_avalot->_dropsOk = true; + _vm->_dropsOk = true; CursorMan.showMouse(true); // sink; resetScrollDriver(); } void Dialogs::reset() { - _vm->_avalot->_scrollNum = 1; + _vm->_scrollNum = 1; for (int i = 0; i < 15; i++) { - if (!_vm->_avalot->_scroll[i].empty()) - _vm->_avalot->_scroll[i].clear(); + if (!_vm->_scroll[i].empty()) + _vm->_scroll[i].clear(); } } void Dialogs::setBubbleStateNatural() { - _vm->_avalot->_talkX = 320; - _vm->_avalot->_talkY = 200; - _vm->_avalot->_talkBackgroundColor = 8; - _vm->_avalot->_talkFontColor = 15; + _vm->_talkX = 320; + _vm->_talkY = 200; + _vm->_talkBackgroundColor = 8; + _vm->_talkFontColor = 15; } Common::String Dialogs::displayMoney() { Common::String result; - if (_vm->_avalot->_money < 12) { // just pence - result = Common::String::format("%dd", _vm->_avalot->_money); - } else if (_vm->_avalot->_money < 240) { // shillings & pence - if ((_vm->_avalot->_money % 12) == 0) - result = Common::String::format("%d/-", _vm->_avalot->_money / 12); + if (_vm->_money < 12) { // just pence + result = Common::String::format("%dd", _vm->_money); + } else if (_vm->_money < 240) { // shillings & pence + if ((_vm->_money % 12) == 0) + result = Common::String::format("%d/-", _vm->_money / 12); else - result = Common::String::format("%d/%d", _vm->_avalot->_money / 12, _vm->_avalot->_money % 12); + result = Common::String::format("%d/%d", _vm->_money / 12, _vm->_money % 12); } else { // L, s & d - result = Common::String::format("\x9C%d.%d.%d", _vm->_avalot->_money / 240, (_vm->_avalot->_money / 12) % 20, - _vm->_avalot->_money % 12); + result = Common::String::format("\x9C%d.%d.%d", _vm->_money / 240, (_vm->_money / 12) % 20, + _vm->_money % 12); } - if (_vm->_avalot->_money > 12) { - Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_avalot->_money); + if (_vm->_money > 12) { + Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_money); result += extraStr; } @@ -653,16 +653,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) { } void Dialogs::solidify(byte n) { - if (!_vm->_avalot->_scroll[n].contains(' ')) + if (!_vm->_scroll[n].contains(' ')) return; // No spaces. // So there MUST be a space there, somewhere... do { - _vm->_avalot->_scroll[n + 1] = _vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] + _vm->_avalot->_scroll[n + 1]; - _vm->_avalot->_scroll[n].deleteLastChar(); - } while (_vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] != ' '); + _vm->_scroll[n + 1] = _vm->_scroll[n][_vm->_scroll[n].size() - 1] + _vm->_scroll[n + 1]; + _vm->_scroll[n].deleteLastChar(); + } while (_vm->_scroll[n][_vm->_scroll[n].size() - 1] != ' '); - stripTrailingSpaces(_vm->_avalot->_scroll[n]); + stripTrailingSpaces(_vm->_scroll[n]); } void Dialogs::callDialogDriver() { @@ -676,38 +676,38 @@ void Dialogs::callDialogDriver() { bool mouthnext = false; bool call_spriterun = true; // Only call sprite_run the FIRST time. - switch (_vm->_avalot->_buffer[_vm->_avalot->_bufSize - 1]) { + switch (_vm->_buffer[_vm->_bufSize - 1]) { case kControlToBuffer: - _vm->_avalot->_bufSize--; + _vm->_bufSize--; break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: - _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = kControlParagraph; - _vm->_avalot->_bufSize++; + _vm->_buffer[_vm->_bufSize] = kControlParagraph; + _vm->_bufSize++; } - uint16 size = _vm->_avalot->_bufSize; + uint16 size = _vm->_bufSize; for (uint16 i = 0; i < size; i++) { if (mouthnext) { - if (_vm->_avalot->_buffer[i] == kControlRegister) + if (_vm->_buffer[i] == kControlRegister) _param = 0; - else if (('0' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= '9')) - _param = _vm->_avalot->_buffer[i] - 48; - else if (('A' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= 'Z')) - _param = _vm->_avalot->_buffer[i] - 55; + else if (('0' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= '9')) + _param = _vm->_buffer[i] - 48; + else if (('A' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= 'Z')) + _param = _vm->_buffer[i] - 55; mouthnext = false; } else { - switch (_vm->_avalot->_buffer[i]) { + switch (_vm->_buffer[i]) { case kControlParagraph: - if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) + if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) break; if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; drawScroll(&Avalanche::Dialogs::scrollModeNormal); @@ -718,14 +718,14 @@ void Dialogs::callDialogDriver() { return; break; case kControlBell: - _vm->_avalot->_scrollBells++; + _vm->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty())) + if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) break; if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; if (_param == 0) @@ -733,7 +733,7 @@ void Dialogs::callDialogDriver() { else if ((1 <= _param) && (_param <= 9)) { AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. - _vm->_avalot->errorLed(); + _vm->errorLed(); setBubbleStateNatural(); } else spr->chatter(); // Normal sprite talking routine. @@ -741,14 +741,14 @@ void Dialogs::callDialogDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - PedType *quasiPed = &_vm->_avalot->_peds[_vm->_avalot->kQuasipeds[_param - 10]._whichPed]; - _vm->_avalot->_talkX = quasiPed->_x; - _vm->_avalot->_talkY = quasiPed->_y; // Position. + PedType *quasiPed = &_vm->_peds[_vm->kQuasipeds[_param - 10]._whichPed]; + _vm->_talkX = quasiPed->_x; + _vm->_talkY = quasiPed->_y; // Position. - _vm->_avalot->_talkFontColor = _vm->_avalot->kQuasipeds[_param - 10]._foregroundColor; - _vm->_avalot->_talkBackgroundColor = _vm->_avalot->kQuasipeds[_param - 10]._backgroundColor; // Colors. + _vm->_talkFontColor = _vm->kQuasipeds[_param - 10]._foregroundColor; + _vm->_talkBackgroundColor = _vm->kQuasipeds[_param - 10]._backgroundColor; // Colors. } else { - _vm->_avalot->errorLed(); // Not valid. + _vm->errorLed(); // Not valid. setBubbleStateNatural(); } @@ -767,46 +767,46 @@ void Dialogs::callDialogDriver() { displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) break; case 2: { - int pwdId = _vm->_parser->kFirstPassword + _vm->_avalot->_passwordNum; + int pwdId = _vm->_parser->kFirstPassword + _vm->_passwordNum; displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer); } break; case 3: - displayText(_vm->_avalot->_favouriteDrink + kControlToBuffer); + displayText(_vm->_favouriteDrink + kControlToBuffer); break; case 4: - displayText(_vm->_avalot->_favouriteSong + kControlToBuffer); + displayText(_vm->_favouriteSong + kControlToBuffer); break; case 5: - displayText(_vm->_avalot->_worstPlaceOnEarth + kControlToBuffer); + displayText(_vm->_worstPlaceOnEarth + kControlToBuffer); break; case 6: - displayText(_vm->_avalot->_spareEvening + kControlToBuffer); + displayText(_vm->_spareEvening + kControlToBuffer); break; case 9: { - Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_avalot->_catacombX, _vm->_avalot->_catacombY, kControlToBuffer); + Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_catacombX, _vm->_catacombY, kControlToBuffer); displayText(tmpStr); } break; case 10: - switch (_vm->_avalot->_boxContent) { + switch (_vm->_boxContent) { case 0: // Sixpence. displayScrollChain('q', 37); // You find the sixpence. - _vm->_avalot->_money += 6; - _vm->_avalot->_boxContent = _vm->_parser->kNothing; - _vm->_avalot->incScore(2); + _vm->_money += 6; + _vm->_boxContent = _vm->_parser->kNothing; + _vm->incScore(2); return; case Parser::kNothing: displayText("nothing at all. It's completely empty."); break; default: - displayText(_vm->_avalot->getItem(_vm->_avalot->_boxContent) + '.'); + displayText(_vm->getItem(_vm->_boxContent) + '.'); } break; case 11: for (int j = 0; j < kObjectNum; j++) { - if (_vm->_avalot->_objects[j]) - displayText(_vm->_avalot->getItem(j) + ", " + kControlToBuffer); + if (_vm->_objects[j]) + displayText(_vm->getItem(j) + ", " + kControlToBuffer); } break; } @@ -815,15 +815,15 @@ void Dialogs::callDialogDriver() { _useIcon = _param; break; case kControlNewLine: - _vm->_avalot->_scrollNum++; + _vm->_scrollNum++; break; case kControlQuestion: if (call_spriterun) - _vm->_avalot->spriteRun(); + _vm->spriteRun(); call_spriterun = false; - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum] = kControlQuestion; - _vm->_avalot->_scrollNum++; + _vm->_scroll[_vm->_scrollNum] = kControlQuestion; + _vm->_scrollNum++; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -833,14 +833,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += ' '; + _vm->_scroll[_vm->_scrollNum - 1] += ' '; break; default: // Add new char. - if (_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1].size() == 50) { - solidify(_vm->_avalot->_scrollNum - 1); - _vm->_avalot->_scrollNum++; + if (_vm->_scroll[_vm->_scrollNum - 1].size() == 50) { + solidify(_vm->_scrollNum - 1); + _vm->_scrollNum++; } - _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += _vm->_avalot->_buffer[i]; + _vm->_scroll[_vm->_scrollNum - 1] += _vm->_buffer[i]; break; } } @@ -848,8 +848,8 @@ void Dialogs::callDialogDriver() { } void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_avalot->_bufSize = text.size(); - memcpy(_vm->_avalot->_buffer, text.c_str(), _vm->_avalot->_bufSize); + _vm->_bufSize = text.size(); + memcpy(_vm->_buffer, text.c_str(), _vm->_bufSize); callDialogDriver(); } @@ -880,7 +880,7 @@ void Dialogs::loadFont() { error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); for (int16 i = 0; i < 256; i++) - file.read(_vm->_avalot->_font[i],16); + file.read(_vm->_font[i],16); file.close(); } @@ -889,7 +889,7 @@ void Dialogs::displayMusicalScroll() { kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); displayText(tmpStr); - _vm->_avalot->spriteRun(); + _vm->spriteRun(); CursorMan.showMouse(false); drawScroll(&Avalanche::Dialogs::scrollModeMusic); CursorMan.showMouse(true); @@ -899,13 +899,13 @@ void Dialogs::displayMusicalScroll() { // From Visa: void Dialogs::unSkrimble() { - for (uint16 i = 0; i < _vm->_avalot->_bufSize; i++) - _vm->_avalot->_buffer[i] = (~(_vm->_avalot->_buffer[i] - (i + 1))) % 256; + for (uint16 i = 0; i < _vm->_bufSize; i++) + _vm->_buffer[i] = (~(_vm->_buffer[i] - (i + 1))) % 256; } void Dialogs::doTheBubble() { - _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = 2; - _vm->_avalot->_bufSize++; + _vm->_buffer[_vm->_bufSize] = 2; + _vm->_bufSize++; } /** @@ -946,8 +946,8 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_avalot->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); + _vm->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_buffer, _vm->_bufSize); sezfile.close(); unSkrimble(); @@ -992,8 +992,8 @@ void Dialogs::speak(byte who, byte subject) { error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_avalot->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize); + _vm->_bufSize = sezfile.readUint16LE(); + sezfile.read(_vm->_buffer, _vm->_bufSize); sezfile.close(); unSkrimble(); @@ -1005,26 +1005,26 @@ void Dialogs::speak(byte who, byte subject) { void Dialogs::talkTo(byte whom) { if (_vm->_parser->_person == kPeoplePardon) { - _vm->_parser->_person = (People)_vm->_avalot->_subjectNum; - _vm->_avalot->_subjectNum = 0; + _vm->_parser->_person = (People)_vm->_subjectNum; + _vm->_subjectNum = 0; } - if (_vm->_avalot->_subjectNum == 0) { + if (_vm->_subjectNum == 0) { switch (whom) { case kPeopleSpludwick: - if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[kObjectPotion - 1])) { + if ((_vm->_lustieIsAsleep) & (!_vm->_objects[kObjectPotion - 1])) { displayScrollChain('q', 68); - _vm->_avalot->_objects[kObjectPotion - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(3); + _vm->_objects[kObjectPotion - 1] = true; + _vm->refreshObjectList(); + _vm->incScore(3); return; - } else if (_vm->_avalot->_talkedToCrapulus) { + } else if (_vm->_talkedToCrapulus) { // Spludwick - what does he need? // 0 - let it through to use normal routine. - switch (_vm->_avalot->_givenToSpludwick) { + switch (_vm->_givenToSpludwick) { case 1: // Fallthrough is intended. case 2: { - Common::String objStr = _vm->_avalot->getItem(Avalot::kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); + Common::String objStr = _vm->getItem(AvalancheEngine::kSpludwicksOrder[_vm->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); displayText(tmpStr); } @@ -1039,23 +1039,23 @@ void Dialogs::talkTo(byte whom) { } break; case kPeopleIbythneth: - if (_vm->_avalot->_givenBadgeToIby) { + if (_vm->_givenBadgeToIby) { displayScrollChain('q', 33); // Thanks a lot! return; // And leave the proc. } break; // Or... just continue, 'cos he hasn't got it. case kPeopleDogfood: - if (_vm->_avalot->_wonNim) { // We've won the game. + if (_vm->_wonNim) { // We've won the game. displayScrollChain('q', 6); // "I'm Not Playing!" return; // Zap back. } else - _vm->_avalot->_askedDogfoodAboutNim = true; + _vm->_askedDogfoodAboutNim = true; break; case kPeopleAyles: - if (!_vm->_avalot->_aylesIsAwake) { + if (!_vm->_aylesIsAwake) { displayScrollChain('q', 43); // He's fast asleep! return; - } else if (!_vm->_avalot->_givenPenToAyles) { + } else if (!_vm->_givenPenToAyles) { displayScrollChain('q', 44); // Can you get me a pen, Avvy? return; } @@ -1066,29 +1066,29 @@ void Dialogs::talkTo(byte whom) { return; case kPeopleGeida: - if (_vm->_avalot->_givenPotionToGeida) - _vm->_avalot->_geidaFollows = true; + if (_vm->_givenPotionToGeida) + _vm->_geidaFollows = true; else { displayScrollChain('u', 17); return; } break; case kPeopleSpurge: - if (!_vm->_avalot->_sittingInPub) { + if (!_vm->_sittingInPub) { displayScrollChain('q', 71); // Try going over and sitting down. return; } else { - if (_vm->_avalot->_spurgeTalkCount < 5) - _vm->_avalot->_spurgeTalkCount++; - if (_vm->_avalot->_spurgeTalkCount > 1) { // no. 1 falls through - displayScrollChain('q', 70 + _vm->_avalot->_spurgeTalkCount); + if (_vm->_spurgeTalkCount < 5) + _vm->_spurgeTalkCount++; + if (_vm->_spurgeTalkCount > 1) { // no. 1 falls through + displayScrollChain('q', 70 + _vm->_spurgeTalkCount); return; } } break; } // On a subject. Is there any reason to block it? - } else if ((whom == kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) { + } else if ((whom == kPeopleAyles) && (!_vm->_aylesIsAwake)) { displayScrollChain('q', 43); // He's fast asleep! return; } @@ -1111,23 +1111,23 @@ void Dialogs::talkTo(byte whom) { displayText(tmpStr); } - speak(whom, _vm->_avalot->_subjectNum); + speak(whom, _vm->_subjectNum); if (!_noError) displayScrollChain('n', whom); // File not found! - if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == kPeopleCrapulus)) { // Crapulus: get the badge - first time only - _vm->_avalot->_objects[kObjectBadge - 1] = true; - _vm->_avalot->refreshObjectList(); + if ((_vm->_subjectNum == 0) && ((whom + 149) == kPeopleCrapulus)) { // Crapulus: get the badge - first time only + _vm->_objects[kObjectBadge - 1] = true; + _vm->refreshObjectList(); displayScrollChain('q', 1); // Circular from Cardiff. - _vm->_avalot->_talkedToCrapulus = true; - _vm->_avalot->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. + _vm->_talkedToCrapulus = true; + _vm->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = true; spr->walkTo(2); // Walks away. - _vm->_avalot->incScore(2); + _vm->incScore(2); } } diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index c3caec7b5566..7264cbcf1960 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -65,7 +65,7 @@ void HeadType::highlight() { _menu->_activeMenuItem._activeNum = _position; _menu->_menuActive = true; - _menu->_vm->_avalot->_currentMouse = 177; // Force redraw of cursor. + _menu->_vm->_currentMouse = 177; // Force redraw of cursor. } bool HeadType::parseAltTrigger(char key) { @@ -135,8 +135,8 @@ void MenuItem::display() { for (int y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_avalot->_defaultLed = 1; - _dr->_vm->_avalot->_currentMouse = 177; + _dr->_vm->_defaultLed = 1; + _dr->_vm->_currentMouse = 177; CursorMan.showMouse(true); // 4 = fletch } @@ -149,7 +149,7 @@ void MenuItem::wipe() { _activeNow = false; _dr->_menuActive = false; _firstlix = false; - _dr->_vm->_avalot->_defaultLed = 2; + _dr->_vm->_defaultLed = 2; CursorMan.showMouse(true); } @@ -218,13 +218,13 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu void MenuBar::draw() { _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); - byte savecp = _dr->_vm->_avalot->_cp; - _dr->_vm->_avalot->_cp = 3; + byte savecp = _dr->_vm->_cp; + _dr->_vm->_cp = 3; for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); - _dr->_vm->_avalot->_cp = savecp; + _dr->_vm->_cp = savecp; } void MenuBar::parseAltTrigger(char c) { @@ -262,30 +262,30 @@ Menu::Menu(AvalancheEngine *vm) { } void Menu::findWhatYouCanDoWithIt() { - switch (_vm->_avalot->_thinks) { + switch (_vm->_thinks) { case kObjectWine: case kObjectPotion: case kObjectInk: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; break; case kObjectBell: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; break; case kObjectChastity: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; case kObjectLute: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; break; case kObjectMushroom: case kObjectOnion: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; break; case kObjectClothes: - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; default: - _vm->_avalot->_verbStr = kVerbCodeExam; // Anything else. + _vm->_verbStr = kVerbCodeExam; // Anything else. } } @@ -310,7 +310,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < 8; j++) { byte idx = text[i]; - font[idx][j] = _vm->_avalot->_font[idx][j] & ander; // Set the font. + font[idx][j] = _vm->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. for (int k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; @@ -412,8 +412,8 @@ void Menu::setupMenuFile() { _activeMenuItem.reset(); _activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true); - _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive); - _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive); + _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_alive); + _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_alive); _activeMenuItem.setupOption("DOS Shell", 'D', "alt-1", false); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.display(); @@ -422,7 +422,7 @@ void Menu::setupMenuFile() { void Menu::setupMenuAction() { _activeMenuItem.reset(); - Common::String f5Does = _vm->_avalot->f5Does(); + Common::String f5Does = _vm->f5Does(); for (int i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); @@ -431,13 +431,13 @@ void Menu::setupMenuAction() { else _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); - if (_vm->_avalot->_room == kRoomMap) + if (_vm->_room == kRoomMap) _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); else _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->_sprites[0]._speedX == _vm->_avalot->kWalk) + if (_vm->_animation->_sprites[0]._speedX == _vm->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -452,8 +452,8 @@ void Menu::setupMenuPeople() { _activeMenuItem.reset(); for (int i = kPeopleAvalot; i <= kPeopleWisewoman; i++) { - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { - _activeMenuItem.setupOption(_vm->_avalot->getName((People)i), _vm->_avalot->getNameChar((People)i), "", true); + if (_vm->getRoom((People)i) == _vm->_room) { + _activeMenuItem.setupOption(_vm->getName((People)i), _vm->getNameChar((People)i), "", true); people += i; } } @@ -464,8 +464,8 @@ void Menu::setupMenuPeople() { void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_avalot->_objects[i]) - _activeMenuItem.setupOption(_vm->_avalot->getThing(i + 1), _vm->_avalot->getThingChar(i + 1), "", true); + if (_vm->_objects[i]) + _activeMenuItem.setupOption(_vm->getThing(i + 1), _vm->getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -473,54 +473,54 @@ void Menu::setupMenuObjects() { void Menu::setupMenuWith() { _activeMenuItem.reset(); - if (_vm->_avalot->_thinkThing) { + if (_vm->_thinkThing) { findWhatYouCanDoWithIt(); - for (uint i = 0; i < _vm->_avalot->_verbStr.size(); i++) { + for (uint i = 0; i < _vm->_verbStr.size(); i++) { char vbchar; Common::String verb; - _vm->_parser->verbOpt(_vm->_avalot->_verbStr[i], verb, vbchar); + _vm->_parser->verbOpt(_vm->_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_avalot->_lastPerson == kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) - || (_vm->_avalot->getRoom(_vm->_avalot->_lastPerson) != _vm->_avalot->_room)) + if ((_vm->_lastPerson == kPeopleAvalot) || (_vm->_lastPerson == _vm->_parser->kNothing) + || (_vm->getRoom(_vm->_lastPerson) != _vm->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { - _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeGive; + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->getName(_vm->_lastPerson), 'G', "", true); + _vm->_verbStr = _vm->_verbStr + kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); - _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); - _vm->_avalot->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; - switch (_vm->_avalot->_thinks) { + _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_thinks), 'T', "", true); + _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; + switch (_vm->_thinks) { case kPeopleGeida: case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodeKiss; + _vm->_verbStr = _vm->_verbStr + kVerbCodeKiss; break; case kPeopleDogfood: - _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + kVerbCodePlay; + _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_wonNim); // True if you HAVEN'T won. + _vm->_verbStr = _vm->_verbStr + kVerbCodePlay; break; case kPeopleMalagauche: { - bool isSober = !_vm->_avalot->_teetotal; - _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[kObjectWine - 1]); + bool isSober = !_vm->_teetotal; + _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_objects[kObjectWine - 1]); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 101 + 100 + 102 + 103 + 104; + _vm->_verbStr = _vm->_verbStr + 101 + 100 + 102 + 103 + 104; } break; case kPeopleTrader: - _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[kObjectOnion - 1]); - _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105; + _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_objects[kObjectOnion - 1]); + _vm->_verbStr = _vm->_verbStr + 105; break; } } @@ -531,19 +531,19 @@ void Menu::runMenuGame() { // Help, boss, untrash screen. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(kVerbCodeHelp); + _vm->callVerb(kVerbCodeHelp); break; case 1: - _vm->_avalot->callVerb(kVerbCodeBoss); + _vm->callVerb(kVerbCodeBoss); break; case 2: - _vm->_avalot->majorRedraw(); + _vm->majorRedraw(); break; case 3: - _vm->_avalot->callVerb(kVerbCodeScore); + _vm->callVerb(kVerbCodeScore); break; case 4: - _vm->_avalot->callVerb(kVerbCodeInfo); + _vm->callVerb(kVerbCodeInfo); break; } } @@ -552,17 +552,17 @@ void Menu::runMenuFile() { // New game, load, save, save as, DOS shell, about, quit. switch (_activeMenuItem._choiceNum) { case 0: - _vm->_avalot->callVerb(kVerbCodeRestart); + _vm->callVerb(kVerbCodeRestart); break; case 1: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(kVerbCodeLoad); + _vm->callVerb(kVerbCodeLoad); break; case 2: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); - _vm->_avalot->callVerb(kVerbCodeSave); + _vm->callVerb(kVerbCodeSave); break; case 3: //_vm->_basher->filename_edit(); @@ -572,7 +572,7 @@ void Menu::runMenuFile() { //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; case 5: - _vm->_avalot->callVerb(kVerbCodeQuit); + _vm->callVerb(kVerbCodeQuit); break; } } @@ -583,31 +583,31 @@ void Menu::runMenuAction() { case 0: { _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; - Common::String f5Does = _vm->_avalot->f5Does(); + Common::String f5Does = _vm->f5Does(); VerbCode verb = (VerbCode)f5Does[0]; - _vm->_avalot->callVerb(verb); + _vm->callVerb(verb); } break; case 1: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(kVerbCodePause); + _vm->callVerb(kVerbCodePause); break; case 2: - _vm->_avalot->callVerb(kVerbCodeOpen); + _vm->callVerb(kVerbCodeOpen); break; case 3: _vm->_parser->_thing = _vm->_parser->kPardon; - _vm->_avalot->callVerb(kVerbCodeLook); + _vm->callVerb(kVerbCodeLook); break; case 4: - _vm->_avalot->callVerb(kVerbCodeInv); + _vm->callVerb(kVerbCodeInv); break; case 5: { AnimationType *avvy = &_vm->_animation->_sprites[0]; - if (avvy->_speedX == _vm->_avalot->kWalk) - avvy->_speedX = _vm->_avalot->kRun; + if (avvy->_speedX == _vm->kWalk) + avvy->_speedX = _vm->kRun; else - avvy->_speedX = _vm->_avalot->kWalk; + avvy->_speedX = _vm->kWalk; _vm->_animation->updateSpeed(); } break; @@ -615,57 +615,57 @@ void Menu::runMenuAction() { } void Menu::runMenuObjects() { - _vm->_avalot->thinkAbout(_vm->_avalot->_objectList[_activeMenuItem._choiceNum], Avalot::kThing); + _vm->thinkAbout(_vm->_objectList[_activeMenuItem._choiceNum], AvalancheEngine::kThing); } void Menu::runMenuPeople() { - _vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson); - _vm->_avalot->_lastPerson = (People)people[_activeMenuItem._choiceNum]; + _vm->thinkAbout(people[_activeMenuItem._choiceNum], AvalancheEngine::kPerson); + _vm->_lastPerson = (People)people[_activeMenuItem._choiceNum]; } void Menu::runMenuWith() { - _vm->_parser->_thing = _vm->_avalot->_thinks; + _vm->_parser->_thing = _vm->_thinks; - if (_vm->_avalot->_thinkThing) { + if (_vm->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) - _vm->_parser->_person = _vm->_avalot->_lastPerson; + if (_vm->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) + _vm->_parser->_person = _vm->_lastPerson; else _vm->_parser->_person = kPeoplePardon; } else { - switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) { + switch (_vm->_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 102: // Whisky _vm->_parser->_thing = 102; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 103: // Cider _vm->_parser->_thing = 103; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 104: // Mead _vm->_parser->_thing = 107; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; case 105: // Onion (trader) _vm->_parser->_thing = 67; - _vm->_avalot->callVerb(kVerbCodeBuy); + _vm->callVerb(kVerbCodeBuy); return; default: _vm->_parser->_person = (People)_vm->_parser->_thing; _vm->_parser->_thing = Parser::kPardon; - _vm->_avalot->_subjectNum = 0; + _vm->_subjectNum = 0; } } - _vm->_avalot->callVerb((VerbCode)_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]); + _vm->callVerb((VerbCode)_vm->_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { @@ -687,11 +687,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... ::Graphics::Surface backup; backup.copyFrom(_vm->_graphics->_surface); - while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_avalot->_holdLeftMouse) { + while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); - while (_vm->_avalot->_holdLeftMouse); + while (_vm->_holdLeftMouse); while (!_vm->shouldQuit()) { do { @@ -701,28 +701,28 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_avalot->newMouse(0); // Up arrow + _vm->newMouse(0); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->_avalot->newMouse(2); // Right-arrow + _vm->newMouse(2); // Right-arrow else - _vm->_avalot->newMouse(3); // Fletch + _vm->newMouse(3); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_avalot->newMouse(1); // Screwdriver + _vm->newMouse(1); // Screwdriver _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); - } while (!_vm->_avalot->_holdLeftMouse); + } while (!_vm->_holdLeftMouse); - if (_vm->_avalot->_holdLeftMouse) { + if (_vm->_holdLeftMouse) { if (cursorPos.y > 21) { if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) { // Clicked OUTSIDE the menu. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); - _vm->_avalot->_holdLeftMouse = false; + _vm->_holdLeftMouse = false; backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). @@ -736,11 +736,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... - _vm->_avalot->_holdLeftMouse = false; + _vm->_holdLeftMouse = false; backup.free(); return; } else { - _vm->_avalot->_holdLeftMouse = true; + _vm->_holdLeftMouse = true; break; } } @@ -757,7 +757,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->refreshScreen(); _vm->updateEvents(); - if (!_vm->_avalot->_holdLeftMouse) + if (!_vm->_holdLeftMouse) break; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index b8b461b053f6..f8f0d4478cfd 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -50,7 +50,7 @@ void Parser::init() { _inputText.clear(); _inputTextPos = 0; - _vm->_avalot->_weirdWord = false; + _vm->_weirdWord = false; // Initailaze the vocabulary. // Verbs: 1-49 @@ -422,13 +422,13 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; - Common::String f5does = _vm->_avalot->f5Does(); + Common::String f5does = _vm->f5Does(); VerbCode verb = (VerbCode)f5does[0]; - _vm->_avalot->callVerb(verb); + _vm->callVerb(verb); } break; case Common::KEYCODE_F7: - _vm->_avalot->callVerb(kVerbCodeOpen); + _vm->callVerb(kVerbCodeOpen); break; default: break; @@ -440,7 +440,7 @@ void Parser::plotText() { cursorOff(); _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_avalot->_font, 8, 24, 161, kColorWhite); + _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); @@ -539,7 +539,7 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_avalot->_dnascore >= kRanks[i]._score) && (_vm->_avalot->_dnascore < kRanks[i + 1]._score)) { + if ((_vm->_dnascore >= kRanks[i]._score) && (_vm->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } } @@ -551,7 +551,7 @@ Common::String Parser::totalTime() { const double ticksInOneSec = (double)(65535) / 3600; uint16 h, m, s; - h = (uint16)floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds. + h = (uint16)floor(_vm->_totalTime / ticksInOneSec); // No. of seconds. m = h % 3600; h /= 3600; s = m % 60; @@ -593,10 +593,10 @@ void Parser::displayWhat(byte target, bool animate, bool &ambiguous) { _vm->_dialogs->displayText("What?"); } else { if (animate) { - Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName((People)target).c_str()); + Common::String tmpStr = Common::String::format("{ %s }", _vm->getName((People)target).c_str()); _vm->_dialogs->displayText(tmpStr); } else { - Common::String z = _vm->_avalot->getItem(target); + Common::String z = _vm->getItem(target); if (z != "") { Common::String tmpStr = Common::String::format("{ %s }", z.c_str()); _vm->_dialogs->displayText(tmpStr); @@ -612,16 +612,16 @@ bool Parser::doPronouns() { byte wordCode = _thats[i]; switch (wordCode) { case 200: - displayWhat(_vm->_avalot->_him, true, ambiguous); - _thats.setChar(_vm->_avalot->_him, i); + displayWhat(_vm->_him, true, ambiguous); + _thats.setChar(_vm->_him, i); break; case 201: - displayWhat(_vm->_avalot->_her, true, ambiguous); - _thats.setChar(_vm->_avalot->_her, i); + displayWhat(_vm->_her, true, ambiguous); + _thats.setChar(_vm->_her, i); break; case 202: - displayWhat(_vm->_avalot->_it, false, ambiguous); - _thats.setChar(_vm->_avalot->_it, i); + displayWhat(_vm->_it, false, ambiguous); + _thats.setChar(_vm->_it, i); break; } } @@ -666,32 +666,32 @@ void Parser::storeInterrogation(byte interrogation) { case 1: _inputText.toLowercase(); sayIt(); - _vm->_avalot->_favouriteDrink = _inputText; - _vm->_avalot->_cardiffQuestionNum = 2; + _vm->_favouriteDrink = _inputText; + _vm->_cardiffQuestionNum = 2; break; case 2: properNouns(); sayIt(); - _vm->_avalot->_favouriteSong = _inputText; - _vm->_avalot->_cardiffQuestionNum = 3; + _vm->_favouriteSong = _inputText; + _vm->_cardiffQuestionNum = 3; break; case 3: properNouns(); sayIt(); - _vm->_avalot->_worstPlaceOnEarth = _inputText; - _vm->_avalot->_cardiffQuestionNum = 4; + _vm->_worstPlaceOnEarth = _inputText; + _vm->_cardiffQuestionNum = 4; break; case 4: _inputText.toLowercase(); sayIt(); - if (!_vm->_avalot->_spareEvening.empty()) - _vm->_avalot->_spareEvening.clear(); - _vm->_avalot->_spareEvening = _inputText; + if (!_vm->_spareEvening.empty()) + _vm->_spareEvening.clear(); + _vm->_spareEvening = _inputText; _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! - _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; - _vm->_avalot->_cardiffQuestionNum = 5; + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; + _vm->_cardiffQuestionNum = 5; break; case 99: //store_high(_inputText); @@ -727,9 +727,9 @@ void Parser::parse() { } // Are we being interrogated right now? - if (_vm->_avalot->_interrogation > 0) { - storeInterrogation(_vm->_avalot->_interrogation); - _vm->_avalot->_weirdWord = true; + if (_vm->_interrogation > 0) { + storeInterrogation(_vm->_interrogation); + _vm->_weirdWord = true; return; } @@ -761,7 +761,7 @@ void Parser::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { for (int i = 0; i < 31; i++) { - if ((_vm->_avalot->_also[i][0]) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { + if ((_vm->_also[i][0]) && (getPos(',' + thisword, *_vm->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; } @@ -813,12 +813,12 @@ void Parser::parse() { replace(Common::String("\x4\xE5"), 20); // "take off" = "doff" // Words that could mean more than one _person - if (_vm->_avalot->_room == kRoomNottsPub) + if (_vm->_room == kRoomNottsPub) replace(Common::String('\xCC'), 164); // Barman = Port else replace(Common::String('\xCC'), 154); // Barman = Malagauche - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomAylesOffice: replace(Common::String('\xCB'), 163); // Monk = Ayles break; @@ -830,39 +830,39 @@ void Parser::parse() { } if (doPronouns()) { - _vm->_avalot->_weirdWord = true; + _vm->_weirdWord = true; _thats = kNothing; return; } // Second parsing. - if (!_vm->_avalot->_subject.empty()) - _vm->_avalot->_subject.clear(); - _vm->_avalot->_subjectNum = 0; // Find subject of conversation. + if (!_vm->_subject.empty()) + _vm->_subject.clear(); + _vm->_subjectNum = 0; // Find subject of conversation. for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { - _vm->_avalot->_subjectNum = (byte)_thats[i]; + _vm->_subjectNum = (byte)_thats[i]; _thats.setChar(kMoved, i); break; } } - if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // Still not found. + if ((_vm->_subjectNum == 0) && !_thats.empty()) { // Still not found. for (uint16 i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. - _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; + _vm->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } } } - if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + if ((_vm->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". for (uint16 i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition - _vm->_avalot->_subjectNum = (byte)_thats[i + 1]; + _vm->_subjectNum = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } @@ -885,30 +885,30 @@ void Parser::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_weirdWord = true; + _vm->_weirdWord = true; } else - _vm->_avalot->_weirdWord = false; + _vm->_weirdWord = false; if (_thats.empty()) _thats = kNothing; if (_thing != kPardon) - _vm->_avalot->_it = _thing; + _vm->_it = _thing; if (_person != kPardon) { if (_person < kPeopleArkata) - _vm->_avalot->_him = _person; + _vm->_him = _person; else - _vm->_avalot->_her = _person; + _vm->_her = _person; } } void Parser::examineObject() { - if (_thing != _vm->_avalot->_thinks) - _vm->_avalot->thinkAbout(_thing, Avalot::kThing); + if (_thing != _vm->_thinks) + _vm->thinkAbout(_thing, AvalancheEngine::kThing); switch (_thing) { case kObjectWine : - switch (_vm->_avalot->_wineState) {// 4 is perfect wine. 0 is not holding the wine. + switch (_vm->_wineState) {// 4 is perfect wine. 0 is not holding the wine. case 1: _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll break; @@ -921,7 +921,7 @@ void Parser::examineObject() { } break; case kObjectOnion: - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion else _vm->_dialogs->displayScrollChain('t', 18); // Normal onion @@ -932,7 +932,7 @@ void Parser::examineObject() { } bool Parser::isPersonHere() { // Person equivalent of "holding". - if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->_avalot->getRoom(_person) == _vm->_avalot->_room)) + if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->getRoom(_person) == _vm->_room)) return true; else { Common::String tmpStr; @@ -947,19 +947,19 @@ bool Parser::isPersonHere() { // Person equivalent of "holding". void Parser::exampers() { if (isPersonHere()) { - if (_thing != _vm->_avalot->_thinks) - _vm->_avalot->thinkAbout(_person, Avalot::kPerson); + if (_thing != _vm->_thinks) + _vm->thinkAbout(_person, AvalancheEngine::kPerson); byte newPerson = _person - 149; - if ((_person == kPeopleDogfood) && _vm->_avalot->_wonNim) + if ((_person == kPeopleDogfood) && _vm->_wonNim) _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" - else if ((_person == kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep) + else if ((_person == kPeopleDuLustie) && _vm->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. else _vm->_dialogs->displayScrollChain('p', newPerson); - if ((_person == kPeopleAyles) && !_vm->_avalot->_aylesIsAwake) + if ((_person == kPeopleAyles) && !_vm->_aylesIsAwake) _vm->_dialogs->displayScrollChain('Q', 13); // CHECKME: Present in the original, but it doesn't make sense. @@ -979,7 +979,7 @@ bool Parser::isHolding() { if (_thing > 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_avalot->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -988,7 +988,7 @@ bool Parser::isHolding() { } void Parser::openBox(bool isOpening) { - if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) { + if ((_vm->_room == kRoomYours) && (_thing == 54)) { _vm->_background->draw(-1, -1, 4); _vm->_background->update(); @@ -1015,7 +1015,7 @@ void Parser::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing openBox(true); - _vm->_dialogs->displayText(*_vm->_avalot->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_also[_thing - 50][1]); openBox(false); } } @@ -1030,17 +1030,17 @@ void Parser::inventory() { Common::String tmpStr = Common::String("You're carrying "); for (int i = 0; i < kObjectNum; i++) { - if (_vm->_avalot->_objects[i]) { + if (_vm->_objects[i]) { itemNum++; - if (itemNum == _vm->_avalot->_carryNum) + if (itemNum == _vm->_carryNum) tmpStr += "and "; - tmpStr += _vm->_avalot->getItem(i + 1); + tmpStr += _vm->getItem(i + 1); if ((i + 1) == _wearing) tmpStr += ", which you're wearing"; - if (itemNum < _vm->_avalot->_carryNum) + if (itemNum < _vm->_carryNum) tmpStr += ", "; } } @@ -1056,17 +1056,17 @@ void Parser::inventory() { void Parser::swallow() { // Eat something. switch (_thing) { case kObjectWine: - switch (_vm->_avalot->_wineState) { // 4 is perfect + switch (_vm->_wineState) { // 4 is perfect case 1: - if (_vm->_avalot->_teetotal) { + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } _vm->_dialogs->displayScrollChain('U', 1); _vm->_pingo->wobble(); _vm->_dialogs->displayScrollChain('U', 2); - _vm->_avalot->_objects[kObjectWine - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectWine - 1] = false; + _vm->refreshObjectList(); drink(); break; case 2: @@ -1076,10 +1076,10 @@ void Parser::swallow() { // Eat something. } break; case kObjectPotion: - _vm->_avalot->setBackgroundColor(4); + _vm->setBackgroundColor(4); _vm->_dialogs->displayScrollChain('U', 3); - _vm->_avalot->gameOver(); - _vm->_avalot->setBackgroundColor(0); + _vm->gameOver(); + _vm->setBackgroundColor(0); break; case kObjectInk: _vm->_dialogs->displayScrollChain('U', 4); @@ -1089,19 +1089,19 @@ void Parser::swallow() { // Eat something. break; case kObjectMushroom: _vm->_dialogs->displayScrollChain('U', 6); - _vm->_avalot->gameOver(); + _vm->gameOver(); break; case kObjectOnion: - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('U', 11); else { _vm->_dialogs->displayScrollChain('U', 8); - _vm->_avalot->_objects[kObjectOnion - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectOnion - 1] = false; + _vm->refreshObjectList(); } break; default: - if ((_vm->_avalot->_room == kRoomArgentPub) || (_vm->_avalot->_room == kRoomNottsPub)) + if ((_vm->_room == kRoomArgentPub) || (_vm->_room == kRoomNottsPub)) _vm->_dialogs->displayText("Try BUYing things before you drink them!"); else _vm->_dialogs->displayText("The taste of it makes you retch!"); @@ -1112,7 +1112,7 @@ void Parser::peopleInRoom() { byte numPeople = 0; // Number of people in the room. for (int i = 151; i < 179; i++) { // Start at 1 so we don't list Avvy himself! - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) + if (_vm->getRoom((People)i) == _vm->_room) numPeople++; } @@ -1122,14 +1122,14 @@ void Parser::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. for (int i = 151; i < 179; i++) { - if (_vm->_avalot->getRoom((People)i) == _vm->_avalot->_room) { + if (_vm->getRoom((People)i) == _vm->_room) { actPerson++; if (actPerson == 1) // First on the list. - tmpStr = _vm->_avalot->getName((People)i); + tmpStr = _vm->getName((People)i); else if (actPerson < numPeople) // The middle... - tmpStr += ", " + _vm->_avalot->getName((People)i); + tmpStr += ", " + _vm->getName((People)i); else // The end. - tmpStr += " and " + _vm->_avalot->getName((People)i); + tmpStr += " and " + _vm->getName((People)i); } } @@ -1142,30 +1142,30 @@ void Parser::peopleInRoom() { } void Parser::lookAround() { - _vm->_dialogs->displayText(*_vm->_avalot->_also[0][1]); - switch (_vm->_avalot->_room) { + _vm->_dialogs->displayText(*_vm->_also[0][1]); + switch (_vm->_room) { case kRoomSpludwicks: - if (_vm->_avalot->_avariciusTalk > 0) + if (_vm->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 23); else peopleInRoom(); break; case kRoomRobins: - if (_vm->_avalot->_tiedUp) + if (_vm->_tiedUp) _vm->_dialogs->displayScrollChain('q', 38); - if (_vm->_avalot->_mushroomGrowing) + if (_vm->_mushroomGrowing) _vm->_dialogs->displayScrollChain('q', 55); break; case kRoomInsideCardiffCastle: - if (!_vm->_avalot->_takenPen) + if (!_vm->_takenPen) _vm->_dialogs->displayScrollChain('q', 49); break; case kRoomLustiesRoom: - if (_vm->_avalot->_lustieIsAsleep) + if (_vm->_lustieIsAsleep) _vm->_dialogs->displayScrollChain('q', 65); break; case kRoomCatacombs: - switch (_vm->_avalot->_catacombY * 256 + _vm->_avalot->_catacombX) { + switch (_vm->_catacombY * 256 + _vm->_catacombX) { case 258 : _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. break; @@ -1184,7 +1184,7 @@ void Parser::lookAround() { void Parser::openDoor() { // Special cases. - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { // Opening the box. @@ -1202,29 +1202,29 @@ void Parser::openDoor() { break; } - if ((!_vm->_avalot->_userMovesAvvy) && (_vm->_avalot->_room != kRoomLusties)) + if ((!_vm->_userMovesAvvy) && (_vm->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { - MagicType *portal = &_vm->_avalot->_portals[i]; + MagicType *portal = &_vm->_portals[i]; switch (portal->_operation) { - case Avalot::kMagicExclaim: + case AvalancheEngine::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; - case Avalot::kMagicTransport: - _vm->_avalot->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); + case AvalancheEngine::kMagicTransport: + _vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; - case Avalot::kMagicUnfinished: + case AvalancheEngine::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; - case Avalot::kMagicSpecial: + case AvalancheEngine::kMagicSpecial: _vm->_animation->callSpecial(portal->_data); break; - case Avalot::kMagicOpenDoor: - _vm->_avalot->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); + case AvalancheEngine::kMagicOpenDoor: + _vm->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); break; } @@ -1232,7 +1232,7 @@ void Parser::openDoor() { } } - if (_vm->_avalot->_room == kRoomMap) + if (_vm->_room == kRoomMap) _vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \ "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."); else @@ -1258,15 +1258,15 @@ void Parser::putProc() { switch (_thing2) { case kObjectWine: if (_thing == kObjectOnion) { - if (_vm->_avalot->_rottenOnion) + if (_vm->_rottenOnion) _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? - if (_vm->_avalot->_wineState != 3) { + if (_vm->_wineState != 3) { Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! - _vm->_avalot->_onionInVinegar = true; - _vm->_avalot->incScore(7); + _vm->_onionInVinegar = true; + _vm->incScore(7); _vm->_dialogs->displayScrollChain('u', 9); } } @@ -1275,8 +1275,8 @@ void Parser::putProc() { break; case 54: - if (_vm->_avalot->_room == kRoomYours) { // Put something into the box. - if (_vm->_avalot->_boxContent != kNothing) + if (_vm->_room == kRoomYours) { // Put something into the box. + if (_vm->_boxContent != kNothing) _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { switch (_thing) { @@ -1294,14 +1294,14 @@ void Parser::putProc() { break; default: // Put the object into the box... if (_wearing == _thing) { - Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str()); + Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { openBox(true); // Open box. - _vm->_avalot->_boxContent = _thing; - _vm->_avalot->_objects[_thing - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_boxContent = _thing; + _vm->_objects[_thing - 1] = false; + _vm->refreshObjectList(); _vm->_dialogs->displayText("OK, it's in the box."); openBox(false); // Shut box. @@ -1322,7 +1322,7 @@ void Parser::putProc() { * @remarks Originally called 'not_in_order' */ void Parser::notInOrder() { - Common::String itemStr = _vm->_avalot->getItem(_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]); + Common::String itemStr = _vm->getItem(_vm->kSpludwicksOrder[_vm->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); @@ -1343,40 +1343,40 @@ void Parser::goToCauldron() { * @remarks Originally called 'give2spludwick' */ bool Parser::giveToSpludwick() { - if (_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick] != _thing) { + if (_vm->kSpludwicksOrder[_vm->_givenToSpludwick] != _thing) { notInOrder(); return false; } switch (_thing) { case kObjectOnion: - _vm->_avalot->_objects[kObjectOnion - 1] = false; - if (_vm->_avalot->_rottenOnion) + _vm->_objects[kObjectOnion - 1] = false; + if (_vm->_rottenOnion) _vm->_dialogs->displayScrollChain('q', 22); else { - _vm->_avalot->_givenToSpludwick++; + _vm->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 20); goToCauldron(); - _vm->_avalot->incScore(3); + _vm->incScore(3); } - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); break; case kObjectInk: - _vm->_avalot->_objects[kObjectInk - 1] = false; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_givenToSpludwick++; + _vm->_objects[kObjectInk - 1] = false; + _vm->refreshObjectList(); + _vm->_givenToSpludwick++; _vm->_dialogs->displayScrollChain('q', 24); goToCauldron(); - _vm->_avalot->incScore(3); + _vm->incScore(3); break; case kObjectMushroom: - _vm->_avalot->_objects[kObjectMushroom - 1] = false; + _vm->_objects[kObjectMushroom - 1] = false; _vm->_dialogs->displayScrollChain('q', 25); - _vm->_avalot->incScore(5); - _vm->_avalot->_givenToSpludwick++; + _vm->incScore(5); + _vm->_givenToSpludwick++; goToCauldron(); - _vm->_avalot->_objects[kObjectPotion - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectPotion - 1] = true; + _vm->refreshObjectList(); break; default: return true; @@ -1388,27 +1388,27 @@ bool Parser::giveToSpludwick() { void Parser::drink() { _alcoholLevel++; if (_alcoholLevel == 5) { - _vm->_avalot->_objects[kObjectKey - 1] = true; // Get the key. - _vm->_avalot->_teetotal = true; - _vm->_avalot->_avvyIsAwake = false; - _vm->_avalot->_avvyInBed = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->dusk(); - _vm->_avalot->hangAroundForAWhile(); - _vm->_avalot->flipRoom(kRoomYours, 1); - _vm->_avalot->setBackgroundColor(14); + _vm->_objects[kObjectKey - 1] = true; // Get the key. + _vm->_teetotal = true; + _vm->_avvyIsAwake = false; + _vm->_avvyInBed = true; + _vm->refreshObjectList(); + _vm->dusk(); + _vm->hangAroundForAWhile(); + _vm->flipRoom(kRoomYours, 1); + _vm->setBackgroundColor(14); _vm->_animation->_sprites[0]._visible = false; } } void Parser::cardiffClimbing() { - if (_vm->_avalot->_standingOnDais) { // Clamber up. + if (_vm->_standingOnDais) { // Clamber up. _vm->_dialogs->displayText("You climb down, back onto the floor."); - _vm->_avalot->_standingOnDais = false; + _vm->_standingOnDais = false; _vm->_animation->appearPed(0, 2); } else if (_vm->_animation->inField(0)) { // Clamber down _vm->_dialogs->displayText("You clamber up onto the dais."); - _vm->_avalot->_standingOnDais = true; + _vm->_standingOnDais = true; _vm->_animation->appearPed(0, 1); } else _vm->_dialogs->displayText("Get a bit closer, Avvy."); @@ -1419,21 +1419,21 @@ void Parser::already() { } void Parser::standUp() { - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: // Avvy isn't asleep. - if (_vm->_avalot->_avvyIsAwake && _vm->_avalot->_avvyInBed) { // But he's in bed. - if (_vm->_avalot->_teetotal) { + if (_vm->_avvyIsAwake && _vm->_avvyInBed) { // But he's in bed. + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('d', 12); - _vm->_avalot->setBackgroundColor(0); + _vm->setBackgroundColor(0); _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->setDirection(kDirLeft); _vm->_background->draw(-1, -1, 3); // Picture of empty pillow. - _vm->_avalot->incScore(1); - _vm->_avalot->_avvyInBed = false; + _vm->incScore(1); + _vm->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); } else already(); @@ -1444,12 +1444,12 @@ void Parser::standUp() { break; case kRoomNottsPub: - if (_vm->_avalot->_sittingInPub) { + if (_vm->_sittingInPub) { _vm->_background->draw(-1, -1, 3); // Not sitting down. _vm->_animation->_sprites[0]._visible = true; // But standing up. _vm->_animation->appearPed(0, 3); // And walking away. - _vm->_avalot->_sittingInPub = false; // Really not sitting down. - _vm->_avalot->_userMovesAvvy = true; // And ambulant. + _vm->_sittingInPub = false; // Really not sitting down. + _vm->_userMovesAvvy = true; // And ambulant. } else already(); break; @@ -1459,18 +1459,18 @@ void Parser::standUp() { } void Parser::getProc(char thing) { - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomYours: if (_vm->_animation->inField(1)) { - if (_vm->_avalot->_boxContent == thing) { + if (_vm->_boxContent == thing) { _vm->_background->draw(-1, -1, 4); _vm->_dialogs->displayText("OK, I've got it."); - _vm->_avalot->_objects[thing - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_boxContent = kNothing; + _vm->_objects[thing - 1] = true; + _vm->refreshObjectList(); + _vm->_boxContent = kNothing; _vm->_background->draw(-1, -1, 5); } else { - Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str()); + Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->getItem(thing).c_str()); _vm->_dialogs->displayText(tmpStr); } } else @@ -1480,18 +1480,18 @@ void Parser::getProc(char thing) { switch (thing) { case kObjectPen: if (_vm->_animation->inField(1)) { // Standing on the dais. - if (_vm->_avalot->_takenPen) + if (_vm->_takenPen) _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_background->draw(-1, -1, 3); // No pen there now. _vm->_animation->callSpecial(3); // Zap! - _vm->_avalot->_takenPen = true; - _vm->_avalot->_objects[kObjectPen - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_takenPen = true; + _vm->_objects[kObjectPen - 1] = true; + _vm->refreshObjectList(); _vm->_dialogs->displayText("Taken."); } - } else if (_vm->_avalot->_standingOnDais) + } else if (_vm->_standingOnDais) _vm->_dialogs->displayScrollChain('q', 53); else _vm->_dialogs->displayScrollChain('q', 51); @@ -1504,14 +1504,14 @@ void Parser::getProc(char thing) { } break; case kRoomRobins: - if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) { + if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_mushroomGrowing)) { _vm->_background->draw(-1, -1, 2); _vm->_dialogs->displayText("Got it!"); - _vm->_avalot->_mushroomGrowing = false; - _vm->_avalot->_takenMushroom = true; - _vm->_avalot->_objects[kObjectMushroom - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(3); + _vm->_mushroomGrowing = false; + _vm->_takenMushroom = true; + _vm->_objects[kObjectMushroom - 1] = true; + _vm->refreshObjectList(); + _vm->incScore(3); } else _vm->_dialogs->displayScrollChain('q', 57); break; @@ -1525,13 +1525,13 @@ void Parser::getProc(char thing) { * @remarks Originally called 'give_Geida_the_lute' */ void Parser::giveGeidaTheLute() { - if (_vm->_avalot->_room != kRoomLustiesRoom) { + if (_vm->_room != kRoomLustiesRoom) { Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); return; } - _vm->_avalot->_objects[kObjectLute - 1] = false; - _vm->_avalot->refreshObjectList(); + _vm->_objects[kObjectLute - 1] = false; + _vm->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 64); // She plays it. _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); @@ -1553,13 +1553,13 @@ void Parser::winSequence() { Common::String Parser::personSpeaks() { if ((_person == kPeoplePardon) || (_person == kPeopleNone)) { - if ((_vm->_avalot->_him == kPeoplePardon) || (_vm->_avalot->getRoom(_vm->_avalot->_him) != _vm->_avalot->_room)) - _person = _vm->_avalot->_her; + if ((_vm->_him == kPeoplePardon) || (_vm->getRoom(_vm->_him) != _vm->_room)) + _person = _vm->_her; else - _person = _vm->_avalot->_him; + _person = _vm->_him; } - if (_vm->_avalot->getRoom(_person) != _vm->_avalot->_room) { + if (_vm->getRoom(_person) != _vm->_room) { return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! } @@ -1577,7 +1577,7 @@ Common::String Parser::personSpeaks() { return tmpStr; for (int i = 0; i < 16; i++) { - if ((_vm->_avalot->kQuasipeds[i]._who == _person) && (_vm->_avalot->kQuasipeds[i]._room == _vm->_avalot->_room)) + if ((_vm->kQuasipeds[i]._who == _person) && (_vm->kQuasipeds[i]._room == _vm->_room)) tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); } @@ -1588,7 +1588,7 @@ void Parser::heyThanks() { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_objects[_thing - 1] = false; + _vm->_objects[_thing - 1] = false; } /** @@ -1604,7 +1604,7 @@ void Parser::doThat() { return; } - if (_vm->_avalot->_weirdWord) + if (_vm->_weirdWord) return; if (_thing < 200) @@ -1614,11 +1614,11 @@ void Parser::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_avalot->_alive) { + if (!_vm->_alive) { _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); return; } - if (!_vm->_avalot->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + if (!_vm->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { _vm->_dialogs->displayText("Talking in your sleep? Try waking up!"); return; } @@ -1638,7 +1638,7 @@ void Parser::doThat() { break; case kVerbCodeGet: if (_thing != kPardon) { // Legitimate try to pick something up. - if (_vm->_avalot->_carryNum >= kCarryLimit) + if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); @@ -1658,21 +1658,21 @@ void Parser::doThat() { break; case kVerbCodeTalk: if (_person == kPeoplePardon) { - if (_vm->_avalot->_subjectNum == 99) { // They typed "say password". + if (_vm->_subjectNum == 99) { // They typed "say password". Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - } else if (((1 <= _vm->_avalot->_subjectNum) && (_vm->_avalot->_subjectNum <= 49)) || (_vm->_avalot->_subjectNum == 253) || (_vm->_avalot->_subjectNum == 249)) { + } else if (((1 <= _vm->_subjectNum) && (_vm->_subjectNum <= 49)) || (_vm->_subjectNum == 253) || (_vm->_subjectNum == 249)) { _thats.deleteChar(0); for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; - _verb = (VerbCode)_vm->_avalot->_subjectNum; + _verb = (VerbCode)_vm->_subjectNum; doThat(); return; } else { - _person = (People)_vm->_avalot->_subjectNum; - _vm->_avalot->_subjectNum = 0; + _person = (People)_vm->_subjectNum; + _vm->_subjectNum = 0; if ((_person == kPeopleNone) || (_person == kPeoplePardon)) _vm->_dialogs->displayText("Talk to whom?"); else if (isPersonHere()) @@ -1701,7 +1701,7 @@ void Parser::doThat() { case kPeopleCrapulus: if (_thing == kObjectWine) { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); - _vm->_avalot->_objects[kObjectWine - 1] = false; + _vm->_objects[kObjectWine - 1] = false; } else heyThanks(); break; @@ -1718,24 +1718,24 @@ void Parser::doThat() { case kPeopleIbythneth: if (_thing == kObjectBadge) { _vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! - _vm->_avalot->incScore(3); - _vm->_avalot->_objects[kObjectBadge - 1] = false; - _vm->_avalot->_objects[kObjectHabit - 1] = true; - _vm->_avalot->_givenBadgeToIby = true; + _vm->incScore(3); + _vm->_objects[kObjectBadge - 1] = false; + _vm->_objects[kObjectHabit - 1] = true; + _vm->_givenBadgeToIby = true; _vm->_background->draw(-1, -1, 7); _vm->_background->draw(-1, -1, 8); } else heyThanks(); break; case kPeopleAyles: - if (_vm->_avalot->_aylesIsAwake) { + if (_vm->_aylesIsAwake) { if (_thing == kObjectPen) { - _vm->_avalot->_objects[kObjectPen - 1] = false; + _vm->_objects[kObjectPen - 1] = false; _vm->_dialogs->displayScrollChain('q', 54); - _vm->_avalot->_objects[kObjectInk - 1] = true; - _vm->_avalot->_givenPenToAyles = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->incScore(2); + _vm->_objects[kObjectInk - 1] = true; + _vm->_givenPenToAyles = true; + _vm->refreshObjectList(); + _vm->incScore(2); } else heyThanks(); } else @@ -1744,11 +1744,11 @@ void Parser::doThat() { case kPeopleGeida: switch (_thing) { case kObjectPotion: - _vm->_avalot->_objects[kObjectPotion - 1] = false; + _vm->_objects[kObjectPotion - 1] = false; _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. - _vm->_avalot->incScore(2); - _vm->_avalot->_givenPotionToGeida = true; - _vm->_avalot->refreshObjectList(); + _vm->incScore(2); + _vm->_givenPotionToGeida = true; + _vm->refreshObjectList(); break; case kObjectLute: giveGeidaTheLute(); @@ -1760,7 +1760,7 @@ void Parser::doThat() { case kPeopleArkata: switch (_thing) { case kObjectPotion: - if (_vm->_avalot->_givenPotionToGeida) + if (_vm->_givenPotionToGeida) winSequence(); else _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! @@ -1774,7 +1774,7 @@ void Parser::doThat() { } } } - _vm->_avalot->refreshObjectList(); // Just in case... + _vm->refreshObjectList(); // Just in case... } break; @@ -1805,7 +1805,7 @@ void Parser::doThat() { else { Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); if (_vm->_dialogs->displayQuestion(tmpStr)) - _vm->_avalot->_letMeOut = true; + _vm->_letMeOut = true; } break; case kVerbCodeGo: @@ -1820,8 +1820,8 @@ void Parser::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + "The medi\x91val descendant of" + Dialogs::kControlNewLine + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + _vm->_avalot->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + _vm->_avalot->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + + "version " + _vm->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + _vm->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; _vm->_dialogs->displayText(toDisplay); _vm->_dialogs->_aboutBox = false; } @@ -1829,11 +1829,11 @@ void Parser::doThat() { case kVerbCodeUndress: if (_wearing == kNothing) _vm->_dialogs->displayText("You're already stark naked!"); - else if (_vm->_avalot->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_wearing).c_str()); + else if (_vm->_avvysInTheCupboard) { + Common::String tmpStr = Common::String::format("You take off %s.", _vm->getItem(_wearing).c_str()); _vm->_dialogs->displayText(tmpStr); _wearing = kNothing; - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); } else _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); break; @@ -1855,7 +1855,7 @@ void Parser::doThat() { } else _wearing = _thing; - _vm->_avalot->refreshObjectList(); + _vm->refreshObjectList(); byte i; if (_thing == kObjectHabit) @@ -1880,19 +1880,19 @@ void Parser::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_avalot->_room) { // They just typed "play"... + switch (_vm->_room) { // They just typed "play"... case kRoomArgentPub: // ...in the pub, => play Nim. warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_avalot->_wonNim) { // Already won the game. + if (_vm->_wonNim) { // Already won the game. _vm->_dialogs->displayScrollChain('Q', 6); return; } - if (!_vm->_avalot->_askedDogfoodAboutNim) { + if (!_vm->_askedDogfoodAboutNim) { _vm->_dialogs->displayScrollChain('q', 84); return; } @@ -1902,14 +1902,14 @@ void Parser::doThat() { // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_avalot->_objects[kObjectLute - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_wonNim = true; + _vm->_objects[kObjectLute - 1] = true; + _vm->refreshObjectList(); + _vm->_wonNim = true; _vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it. - _vm->_avalot->incScore(7); // 7 points for winning! + _vm->incScore(7); // 7 points for winning! if (_playedNim == 1) - _vm->_avalot->incScore(3); // 3 points for playing your 1st game. + _vm->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1924,20 +1924,20 @@ void Parser::doThat() { case kObjectLute : _vm->_dialogs->displayScrollChain('U', 7); - if (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room) + if (_vm->getRoom(kPeopleCwytalot) == _vm->_room) _vm->_dialogs->displayScrollChain('U', 10); - if (_vm->_avalot->getRoom(kPeopleDuLustie) == _vm->_avalot->_room) + if (_vm->getRoom(kPeopleDuLustie) == _vm->_room) _vm->_dialogs->displayScrollChain('U', 15); break; case 52: - if (_vm->_avalot->_room == kRoomMusicRoom) + if (_vm->_room == kRoomMusicRoom) playHarp(); else _vm->_dialogs->displayText(kWhat); break; case 55: - if (_vm->_avalot->_room == kRoomArgentPub) + if (_vm->_room == kRoomArgentPub) // play_nim(); warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); else @@ -1952,7 +1952,7 @@ void Parser::doThat() { if (isHolding()) { if (_thing == kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1974,7 +1974,7 @@ void Parser::doThat() { warning("STUB: Parser::doThat() - case kVerbCodeboss"); break; case kVerbCodePee: - if (_vm->_avalot->setFlag('P')) { + if (_vm->setFlag('P')) { _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { @@ -1985,16 +1985,16 @@ void Parser::doThat() { case kVerbCodeCheat: { Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_cheat = true; + _vm->_cheat = true; } break; case kVerbCodeMagic: - if (_vm->_avalot->_avariciusTalk > 0) + if (_vm->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 19); else { - if ((_vm->_avalot->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! + if ((_vm->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! _vm->_dialogs->displayScrollChain('q', 17); - if (_vm->_avalot->getRoom(kPeopleSpludwick) == kRoomSpludwicks) + if (_vm->getRoom(kPeopleSpludwick) == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2003,7 +2003,7 @@ void Parser::doThat() { spr->walkTo(4); spr->_callEachStepFl = true; spr->_eachStepProc = Animation::kProcBackAndForth; - _vm->_avalot->_avariciusTalk = 14; + _vm->_avariciusTalk = 14; _vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks); } } else @@ -2031,21 +2031,21 @@ void Parser::doThat() { _vm->_pingo->zonk(); Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->gameOver(); + _vm->gameOver(); } } _sworeNum++; break; case kVerbCodeListen: - if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); - else if (_vm->_avalot->_listen.empty()) + else if (_vm->_listen.empty()) _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); else - _vm->_dialogs->displayText(_vm->_avalot->_listen); + _vm->_dialogs->displayText(_vm->_listen); break; case kVerbCodeBuy: // What are they trying to buy? - switch (_vm->_avalot->_room) { + switch (_vm->_room) { case kRoomArgentPub: if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. switch (_thing) { @@ -2053,40 +2053,40 @@ void Parser::doThat() { case 53: case 54: case 58: // Beer, whisky, cider or mead. - if (_vm->_avalot->_malagauche == 177) { // Already getting us one. + if (_vm->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_avalot->_teetotal) { + if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); return; } if (_alcoholLevel == 0) - _vm->_avalot->incScore(3); + _vm->incScore(3); _vm->_background->draw(-1, -1, 11); _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); - _vm->_avalot->_drinking = _thing; + _vm->_drinking = _thing; _vm->_background->draw(-1, -1, 9); - _vm->_avalot->_malagauche = 177; + _vm->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks); break; case 52: examine(); break; // We have a right one here - buy Pepsi??! case kObjectWine: - if (_vm->_avalot->_objects[kObjectWine - 1]) // We've already got the wine! + if (_vm->_objects[kObjectWine - 1]) // We've already got the wine! _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! else { - if (_vm->_avalot->_malagauche == 177) { // Already getting us one. + if (_vm->_malagauche == 177) { // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } - if (_vm->_avalot->_carryNum >= kCarryLimit) { + if (_vm->_carryNum >= kCarryLimit) { _vm->_dialogs->displayText("Your hands are full."); return; } @@ -2095,9 +2095,9 @@ void Parser::doThat() { Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); if (_alcoholLevel == 0) - _vm->_avalot->incScore(3); + _vm->incScore(3); _vm->_background->draw(-1, -1, 9); - _vm->_avalot->_malagauche = 177; + _vm->_malagauche = 177; _vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks); } @@ -2110,23 +2110,23 @@ void Parser::doThat() { case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { if (_thing == kObjectOnion) { - if (_vm->_avalot->_objects[kObjectOnion - 1]) + if (_vm->_objects[kObjectOnion - 1]) _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! - else if (_vm->_avalot->_carryNum >= kCarryLimit) + else if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { if (_boughtOnion) _vm->_dialogs->displayScrollChain('D', 11); else { _vm->_dialogs->displayScrollChain('D', 9); - _vm->_avalot->incScore(3); + _vm->incScore(3); } - _vm->_avalot->decreaseMoney(3); // It costs thruppence. - _vm->_avalot->_objects[kObjectOnion - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->decreaseMoney(3); // It costs thruppence. + _vm->_objects[kObjectOnion - 1] = true; + _vm->refreshObjectList(); _boughtOnion = true; - _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! - _vm->_avalot->_onionInVinegar = false; + _vm->_rottenOnion = false; // It's OK when it leaves the stall! + _vm->_onionInVinegar = false; } } else _vm->_dialogs->displayScrollChain('D', 0); @@ -2142,33 +2142,33 @@ void Parser::doThat() { } break; case kVerbCodeAttack: - if ((_vm->_avalot->_room == kRoomBrummieRoad) && + if ((_vm->_room == kRoomBrummieRoad) && ((_person == kPeopleCwytalot) || (_thing == kObjectCrossbow) || (_thing == kObjectBolt)) && - (_vm->_avalot->getRoom(kPeopleCwytalot) == _vm->_avalot->_room)) { - switch (_vm->_avalot->_objects[kObjectBolt - 1] + _vm->_avalot->_objects[kObjectCrossbow - 1] * 2) { + (_vm->getRoom(kPeopleCwytalot) == _vm->_room)) { + switch (_vm->_objects[kObjectBolt - 1] + _vm->_objects[kObjectCrossbow - 1] * 2) { // 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both. case 0: _vm->_dialogs->displayScrollChain('Q', 10); _vm->_dialogs->displayText("(At the very least, don't use your bare hands!)"); break; case 1: - _vm->_dialogs->displayText("Attack _vm->_avalot->him with only a crossbow bolt? Are you planning on playing darts?!"); + _vm->_dialogs->displayText("Attack _vm->him with only a crossbow bolt? Are you planning on playing darts?!"); break; case 2: _vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!"); break; case 3: _vm->_dialogs->displayScrollChain('Q', 11); - _vm->_avalot->_cwytalotGone = true; - _vm->_avalot->_objects[kObjectBolt - 1] = false; - _vm->_avalot->_objects[kObjectCrossbow - 1] = false; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_magics[11]._operation = Avalot::kMagicNothing; - _vm->_avalot->incScore(7); + _vm->_cwytalotGone = true; + _vm->_objects[kObjectBolt - 1] = false; + _vm->_objects[kObjectCrossbow - 1] = false; + _vm->refreshObjectList(); + _vm->_magics[11]._operation = AvalancheEngine::kMagicNothing; + _vm->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; _vm->_animation->_sprites[1]._callEachStepFl = false; - _vm->_avalot->setRoom(kPeopleCwytalot, kRoomDummy); + _vm->setRoom(kPeopleCwytalot, kRoomDummy); break; default: _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! @@ -2177,14 +2177,14 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('Q', 10); break; case kVerbCodePasswd: - if (_vm->_avalot->_room != kRoomBridge) + if (_vm->_room != kRoomBridge) _vm->_dialogs->displayScrollChain('Q', 12); else { bool ok = true; for (uint i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); - int pwdId = _vm->_avalot->_passwordNum + kFirstPassword; + int pwdId = _vm->_passwordNum + kFirstPassword; for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; @@ -2192,13 +2192,13 @@ void Parser::doThat() { } if (ok) { - if (_vm->_avalot->_drawbridgeOpen != 0) + if (_vm->_drawbridgeOpen != 0) _vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again."); else { - _vm->_avalot->incScore(4); + _vm->incScore(4); _vm->_dialogs->displayText("The drawbridge opens!"); _vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); - _vm->_avalot->_drawbridgeOpen = 1; + _vm->_drawbridgeOpen = 1; } } else _vm->_dialogs->displayScrollChain('Q', 12); @@ -2208,10 +2208,10 @@ void Parser::doThat() { //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! break; case kVerbCodeDie: - _vm->_avalot->gameOver(); + _vm->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_avalot->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); _vm->_dialogs->displayText(tmpStr); } break; @@ -2243,14 +2243,14 @@ void Parser::doThat() { break; case kVerbCodeClimb: - if (_vm->_avalot->_room == kRoomInsideCardiffCastle) + if (_vm->_room == kRoomInsideCardiffCastle) cardiffClimbing(); else // In the wrong room! _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: _vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); - _vm->_avalot->_userMovesAvvy = false; + _vm->_userMovesAvvy = false; break; case kVerbCodeHiscores: // show_highs(); @@ -2262,18 +2262,18 @@ void Parser::doThat() { case kPeoplePardon: case kPeopleAvalot: case 0: - if (!_vm->_avalot->_avvyIsAwake) { - _vm->_avalot->_avvyIsAwake = true; - _vm->_avalot->incScore(1); - _vm->_avalot->_avvyInBed = true; + if (!_vm->_avvyIsAwake) { + _vm->_avvyIsAwake = true; + _vm->incScore(1); + _vm->_avvyInBed = true; _vm->_background->draw(-1, -1, 2); // Picture of Avvy, awake in bed. - if (_vm->_avalot->_teetotal) + if (_vm->_teetotal) _vm->_dialogs->displayScrollChain('d', 13); } else _vm->_dialogs->displayText("You're already awake, Avvy!"); break; case kPeopleAyles: - if (!_vm->_avalot->_aylesIsAwake) + if (!_vm->_aylesIsAwake) _vm->_dialogs->displayText("You can't seem to wake him by yourself."); break; case kPeopleJacques: { @@ -2287,26 +2287,26 @@ void Parser::doThat() { } break; case kVerbCodeSit: - if (_vm->_avalot->_room == kRoomNottsPub) { - if (_vm->_avalot->_sittingInPub) + if (_vm->_room == kRoomNottsPub) { + if (_vm->_sittingInPub) _vm->_dialogs->displayText("You're already sitting!"); else { _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. - _vm->_avalot->dusk(); - _vm->_avalot->hangAroundForAWhile(); - _vm->_avalot->dawn(); + _vm->dusk(); + _vm->hangAroundForAWhile(); + _vm->dawn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { - _vm->_avalot->dusk(); - _vm->_avalot->newGame(); - _vm->_avalot->dawn(); + _vm->dusk(); + _vm->newGame(); + _vm->dawn(); } break; case kVerbCodePardon: diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 368fa0dfd7e4..9a11e6f66118 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -76,7 +76,7 @@ void Pingo::zonk() { void Pingo::winningPic() { Common::File f; - _vm->_avalot->dusk(); + _vm->dusk(); if (!f.open("finale.avd")) error("AVALANCHE: Lucerna: File not found: finale.avd"); @@ -95,11 +95,11 @@ void Pingo::winningPic() { warning("STUB: Pingo::winningPic()"); - _vm->_avalot->dawn(); + _vm->dawn(); #if 0 do { - _vm->_avalot->check(); + _vm->check(); } while (!(keypressed() || (mrelease > 0))); while (keypressed()) char r = readkey(); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index bbbbf6229c9c..fecbc0c3c34e 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -75,7 +75,7 @@ void Sequence::startTimer() { } void Sequence::startTimerImmobilized() { - _vm->_avalot->_userMovesAvvy = false; // They can't move. + _vm->_userMovesAvvy = false; // They can't move. _vm->_animation->stopWalking(); // And they're not moving now. startTimer(); // Apart from that, it's the same thing. } @@ -94,8 +94,8 @@ void Sequence::callSequencer() { return; // No more routines. break; case kNowFlip: // Flip room. - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->flipRoom(_flipToWhere, _flipToPed); + _vm->_userMovesAvvy = true; + _vm->flipRoom(_flipToWhere, _flipToPed); // CHECKME: Always true? if (curSeq == kNowFlip) shoveLeft(); @@ -202,12 +202,12 @@ void Sequence::startLustiesSeq2(Room whither, byte ped) { void Sequence::startCardiffSeq2() { init(1); - if (_vm->_avalot->_arrowInTheDoor) + if (_vm->_arrowInTheDoor) add(3); else add(2); - if (_vm->_avalot->_takenPen) + if (_vm->_takenPen) _vm->_background->draw(-1, -1, 3); startTimer(); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index d1d25ba74068..5576a4826ed4 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -54,7 +54,7 @@ Timer::Timer(AvalancheEngine *vm) { * @remarks Originally called 'set_up_timer' */ void Timer::addTimer(int32 duration, byte action, byte reason) { - if ((_vm->_avalot->_isLoaded == false) || (_timerLost == true)) { + if ((_vm->_isLoaded == false) || (_timerLost == true)) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; @@ -67,7 +67,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { _times[i]._action = action; _times[i]._reason = reason; } else { - _vm->_avalot->_isLoaded = false; + _vm->_isLoaded = false; return; } } @@ -155,7 +155,7 @@ void Timer::updateTimer() { crapulusSaysSpludOut(); break; case kProcDawnDelay: - _vm->_avalot->dawn(); + _vm->dawn(); break; case kProcBuyDrinks: buyDrinks(); @@ -214,8 +214,8 @@ void Timer::updateTimer() { } } } - _vm->_avalot->_roomTime++; // Cycles since you've been in this room. - _vm->_avalot->_totalTime++; // Total amount of time for this game. + _vm->_roomTime++; // Cycles since you've been in this room. + _vm->_totalTime++; // Total amount of time for this game. } void Timer::loseTimer(byte which) { @@ -228,29 +228,29 @@ void Timer::loseTimer(byte which) { } void Timer::openDrawbridge() { - _vm->_avalot->_drawbridgeOpen++; - _vm->_background->draw(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); + _vm->_drawbridgeOpen++; + _vm->_background->draw(-1, -1, _vm->_drawbridgeOpen - 2); - if (_vm->_avalot->_drawbridgeOpen == 4) - _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. + if (_vm->_drawbridgeOpen == 4) + _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } void Timer::avariciusTalks() { - _vm->_dialogs->displayScrollChain('q', _vm->_avalot->_avariciusTalk); - _vm->_avalot->_avariciusTalk++; + _vm->_dialogs->displayScrollChain('q', _vm->_avariciusTalk); + _vm->_avariciusTalk++; - if (_vm->_avalot->_avariciusTalk < 17) + if (_vm->_avariciusTalk < 17) addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); else - _vm->_avalot->incScore(3); + _vm->incScore(3); } void Timer::urinate() { _vm->_animation->_sprites[0].turn(kDirUp); _vm->_animation->stopWalking(); - _vm->_avalot->drawDirection(); + _vm->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); } @@ -272,20 +272,20 @@ void Timer::stairs() { _vm->_sound->blip(); _vm->_animation->_sprites[0].walkTo(3); _vm->_background->draw(-1, -1, 1); - _vm->_avalot->_brummieStairs = 2; - _vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial; - _vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_brummieStairs = 2; + _vm->_magics[10]._operation = AvalancheEngine::kMagicSpecial; + _vm->_magics[10]._data = 2; // Reached the bottom of the stairs. + _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { - if (_vm->_avalot->_cardiffQuestionNum == 0) { - _vm->_avalot->_cardiffQuestionNum++; + if (_vm->_cardiffQuestionNum == 0) { + _vm->_cardiffQuestionNum++; _vm->_dialogs->displayScrollChain('q', 27); } - _vm->_dialogs->displayScrollChain('z', _vm->_avalot->_cardiffQuestionNum); - _vm->_avalot->_interrogation = _vm->_avalot->_cardiffQuestionNum; + _vm->_dialogs->displayScrollChain('z', _vm->_cardiffQuestionNum); + _vm->_interrogation = _vm->_cardiffQuestionNum; addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); } @@ -300,8 +300,8 @@ void Timer::cwytalotInHerts() { void Timer::getTiedUp() { _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! - _vm->_avalot->_userMovesAvvy = false; - _vm->_avalot->_beenTiedUp = true; + _vm->_userMovesAvvy = false; + _vm->_beenTiedUp = true; _vm->_animation->stopWalking(); AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -315,8 +315,8 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[1].walkTo(4); - _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // No effect when you touch the boundaries. - _vm->_avalot->_friarWillTieYouUp = true; + _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // No effect when you touch the boundaries. + _vm->_friarWillTieYouUp = true; } void Timer::hangAround() { @@ -324,7 +324,7 @@ void Timer::hangAround() { AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->init(7, true, _vm->_animation); // Robin Hood - _vm->_avalot->setRoom(kPeopleRobinHood, kRoomRobins); + _vm->setRoom(kPeopleRobinHood, kRoomRobins); _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); avvy->walkTo(6); @@ -336,7 +336,7 @@ void Timer::hangAround2() { AnimationType *spr = &_vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); - _vm->_avalot->setRoom(kPeopleFriarTuck, kRoomRobins); + _vm->setRoom(kPeopleFriarTuck, kRoomRobins); _vm->_dialogs->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -344,20 +344,20 @@ void Timer::hangAround2() { addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). - _vm->_avalot->_tiedUp = false; + _vm->_tiedUp = false; // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! } void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_avalot->flipRoom(_vm->_avalot->_room, 1); + _vm->flipRoom(_vm->_room, 1); _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->appearPed(0, 1); - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->_objects[kObjectCrossbow - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_userMovesAvvy = true; + _vm->_objects[kObjectCrossbow - 1] = true; + _vm->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") @@ -385,9 +385,9 @@ void Timer::afterTheShootemup() { } void Timer::jacquesWakesUp() { - _vm->_avalot->_jacquesState++; + _vm->_jacquesState++; - switch (_vm->_avalot->_jacquesState) { // Additional pictures. + switch (_vm->_jacquesState) { // Additional pictures. case 1 : _vm->_background->draw(-1, -1, 0); // Eyes open. _vm->_dialogs->displayScrollChain('Q', 45); @@ -395,22 +395,22 @@ void Timer::jacquesWakesUp() { case 2 : // Going through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor. _vm->_background->draw(-1, -1, 2); // But going through the door. - _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now. + _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor, either. _vm->_background->draw(-1, -1, 3); // He's gone... so the door's open. - _vm->_avalot->setRoom(kPeopleJacques, kRoomNowhere); // Gone! + _vm->setRoom(kPeopleJacques, kRoomNowhere); // Gone! break; } - if (_vm->_avalot->_jacquesState == 5) { - _vm->_avalot->_bellsAreRinging = true; - _vm->_avalot->_aylesIsAwake = true; - _vm->_avalot->incScore(2); + if (_vm->_jacquesState == 5) { + _vm->_bellsAreRinging = true; + _vm->_aylesIsAwake = true; + _vm->incScore(2); } - switch (_vm->_avalot->_jacquesState) { + switch (_vm->_jacquesState) { case 1: case 2: case 3: @@ -452,8 +452,8 @@ void Timer::naughtyDuke3() { void Timer::jump() { AnimationType *avvy = &_vm->_animation->_sprites[0]; - _vm->_avalot->_jumpStatus++; - switch (_vm->_avalot->_jumpStatus) { + _vm->_jumpStatus++; + switch (_vm->_jumpStatus) { case 1: case 2: case 3: @@ -472,73 +472,73 @@ void Timer::jump() { break; } - if (_vm->_avalot->_jumpStatus == 20) { // End of jump. - _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->_jumpStatus = 0; + if (_vm->_jumpStatus == 20) { // End of jump. + _vm->_userMovesAvvy = true; + _vm->_jumpStatus = 0; } else // Still jumping. addTimer(1, kProcJump, kReasonJumping); - if ((_vm->_avalot->_jumpStatus == 10) // You're at the highest point of your jump. - && (_vm->_avalot->_room == kRoomInsideCardiffCastle) - && (_vm->_avalot->_arrowInTheDoor == true) + if ((_vm->_jumpStatus == 10) // You're at the highest point of your jump. + && (_vm->_room == kRoomInsideCardiffCastle) + && (_vm->_arrowInTheDoor == true) && (_vm->_animation->inField(2))) { // Beside the wall // Grab the arrow! - if (_vm->_avalot->_carryNum >= kCarryLimit) + if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You fail to grab it, because your hands are full."); else { _vm->_background->draw(-1, -1, 1); - _vm->_avalot->_arrowInTheDoor = false; // You've got it. - _vm->_avalot->_objects[kObjectBolt - 1] = true; - _vm->_avalot->refreshObjectList(); + _vm->_arrowInTheDoor = false; // You've got it. + _vm->_objects[kObjectBolt - 1] = true; + _vm->refreshObjectList(); _vm->_dialogs->displayScrollChain('q', 50); - _vm->_avalot->incScore(3); + _vm->incScore(3); } } } void Timer::crapulusSaysSpludOut() { _vm->_dialogs->displayScrollChain('q', 56); - _vm->_avalot->_crapulusWillTell = false; + _vm->_crapulusWillTell = false; } void Timer::buyDrinks() { _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; - _vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it. + _vm->_dialogs->displayScrollChain('D', _vm->_drinking); // Display message about it. _vm->_pingo->wobble(); // Do the special effects. _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. - if (_vm->_avalot->decreaseMoney(3)) // Pay 3d. + if (_vm->decreaseMoney(3)) // Pay 3d. _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_parser->drink(); } void Timer::buyWine() { _vm->_background->draw(-1, -1, 10); // Malagauche gets up again. - _vm->_avalot->_malagauche = 0; + _vm->_malagauche = 0; _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. - if (_vm->_avalot->decreaseMoney(3)) { + if (_vm->decreaseMoney(3)) { _vm->_dialogs->displayScrollChain('D', 4); // You paid up. - _vm->_avalot->_objects[kObjectWine - 1] = true; - _vm->_avalot->refreshObjectList(); - _vm->_avalot->_wineState = 1; // OK Wine. + _vm->_objects[kObjectWine - 1] = true; + _vm->refreshObjectList(); + _vm->_wineState = 1; // OK Wine. } } void Timer::callsGuards() { _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" - _vm->_avalot->gameOver(); + _vm->gameOver(); } void Timer::greetsMonk() { _vm->_dialogs->displayScrollChain('Q', 59); - _vm->_avalot->_enteredLustiesRoomAsMonk = true; + _vm->_enteredLustiesRoomAsMonk = true; } void Timer::fallDownOubliette() { - _vm->_avalot->_magics[8]._operation = Avalot::kMagicNothing; + _vm->_magics[8]._operation = AvalancheEngine::kMagicNothing; AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! @@ -547,13 +547,13 @@ void Timer::fallDownOubliette() { } void Timer::meetAvaroid() { - if (_vm->_avalot->_metAvaroid) { + if (_vm->_metAvaroid) { Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->gameOver(); + _vm->gameOver(); } else { _vm->_dialogs->displayScrollChain('Q', 60); - _vm->_avalot->_metAvaroid = true; + _vm->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -562,7 +562,7 @@ void Timer::meetAvaroid() { avvy->_moveX = -3; avvy->_moveY = -5; - _vm->_avalot->setBackgroundColor(2); + _vm->setBackgroundColor(2); } } @@ -574,7 +574,7 @@ void Timer::riseUpOubliette() { if (avvy->_moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { @@ -587,7 +587,7 @@ void Timer::robinHoodAndGeida() { spr->stopWalk(); spr->_facingDir = kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); - _vm->_avalot->_geidaFollows = false; + _vm->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { @@ -611,7 +611,7 @@ void Timer::avalotReturns() { avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(0, 0); _vm->_dialogs->displayScrollChain('q', 67); - _vm->_avalot->_userMovesAvvy = true; + _vm->_userMovesAvvy = true; } /** @@ -625,8 +625,8 @@ void Timer::avvySitDown() { addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_background->draw(-1, -1, 2); - _vm->_avalot->_sittingInPub = true; - _vm->_avalot->_userMovesAvvy = false; + _vm->_sittingInPub = true; + _vm->_userMovesAvvy = false; avvy->_visible = false; } } @@ -638,7 +638,7 @@ void Timer::ghostRoomPhew() { } void Timer::arkataShouts() { - if (_vm->_avalot->_teetotal) + if (_vm->_teetotal) return; _vm->_dialogs->displayScrollChain('q', 76); @@ -652,14 +652,14 @@ void Timer::winning() { warning("STUB: Timer::winning()"); #if 0 do { - _vm->_avalot->checkclick(); - } while (!(_vm->_avalot->mrelease == 0)); + _vm->checkclick(); + } while (!(_vm->mrelease == 0)); #endif // TODO: To be implemented with Pingo::winningPic(). - _vm->_avalot->callVerb(kVerbCodeScore); + _vm->callVerb(kVerbCodeScore); _vm->_dialogs->displayText(" T H E E N D "); - _vm->_avalot->_letMeOut = true; + _vm->_letMeOut = true; } void Timer::avalotFalls() { @@ -691,8 +691,8 @@ void Timer::spludwickLeavesCauldron() { void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_dialogs->displayScrollChain('Q', 86); - _vm->_avalot->incScore(4); - _vm->_avalot->_lustieIsAsleep = true; + _vm->incScore(4); + _vm->_lustieIsAsleep = true; _vm->_sequence->startGeidaLuteSeq(); } From 64f799773e94838f8e0d5226692f4113e9bf0bf2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 08:21:04 +0200 Subject: [PATCH 1128/1332] AVALANCHE: Misc minor polishing --- engines/avalanche/animation.cpp | 1 + engines/avalanche/avalot.cpp | 1 - engines/avalanche/dialogs.cpp | 6 ++++++ engines/avalanche/dialogs.h | 2 ++ engines/avalanche/parser.cpp | 20 +++++--------------- engines/avalanche/parser.h | 1 - 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index cb64bb8fe08f..960705f17a7b 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -363,6 +363,7 @@ Animation::~Animation() { } void Animation::resetAnims() { + setDirection(kDirStopped); for (int16 i = 0; i < kSpriteNumbMax; i++) _sprites[i].reset(); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e5ed210d0543..e542ee40b02d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -323,7 +323,6 @@ void AvalancheEngine::setup() { _parser->_inputTextPos = 0; _parser->_quote = true; - _animation->setDirection(kDirStopped); _animation->resetAnims(); drawToolbar(); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index c8fe128b578b..a3cbd63c01e4 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1131,4 +1131,10 @@ void Dialogs::talkTo(byte whom) { } } +void Dialogs::sayIt(Common::String str) { + Common::String x = str; + x.setChar(toupper(x[0]), 0); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", kControlRegister, x.c_str(), kControlSpeechBubble, kControlRegister); + displayText(tmpStr); +} } // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index d754eb1672dc..9904ec6b8b1c 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -82,6 +82,8 @@ class Dialogs { void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); void talkTo(byte whom); + void sayIt(Common::String str); // This makes Avalot say the response. + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index f8f0d4478cfd..e4c91a8fed80 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -569,8 +569,6 @@ void Parser::cheatParse(Common::String codes) { warning("STUB: Parser::cheatParse()"); } - - void Parser::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; @@ -642,14 +640,6 @@ void Parser::properNouns() { _inputText.setChar(toupper(_inputText[0]), 0); } -void Parser::sayIt() { - Common::String x = _inputText; - x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), - Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); - _vm->_dialogs->displayText(tmpStr); -} - void Parser::storeInterrogation(byte interrogation) { if (_inputText.empty()) return; @@ -665,25 +655,25 @@ void Parser::storeInterrogation(byte interrogation) { switch (interrogation) { case 1: _inputText.toLowercase(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_favouriteDrink = _inputText; _vm->_cardiffQuestionNum = 2; break; case 2: properNouns(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_favouriteSong = _inputText; _vm->_cardiffQuestionNum = 3; break; case 3: properNouns(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_worstPlaceOnEarth = _inputText; _vm->_cardiffQuestionNum = 4; break; case 4: _inputText.toLowercase(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); if (!_vm->_spareEvening.empty()) _vm->_spareEvening.clear(); _vm->_spareEvening = _inputText; @@ -710,7 +700,6 @@ void Parser::parse() { if (!_thats.empty()) _thats.clear(); - byte n = 0; _polite = false; _verb = kVerbCodePardon; _thing = kPardon; @@ -736,6 +725,7 @@ void Parser::parse() { // Actually process the command. Common::String inputText = _inputText + ' '; Common::String inputTextUpper = inputText; + byte n = 0; inputTextUpper.toUppercase(); while (!inputTextUpper.empty()) { while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 4ec7fe64b463..4d5889388c9f 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -121,7 +121,6 @@ class Parser { bool doPronouns(); void properNouns(); void lookAround(); // This is called when you say "look". - void sayIt(); // This makes Avalot say the response. void openDoor(); void storeInterrogation(byte interrogation); void examineObject(); // Examine a standard object-thing From d7230fe8560ef49b1958ba53109af85a40267fca Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 08:33:58 +0200 Subject: [PATCH 1129/1332] AVALANCHE: Remove a couple of unused variables --- engines/avalanche/avalanche.h | 2 -- engines/avalanche/avalot.cpp | 3 --- 2 files changed, 5 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 597772199768..91473e185af9 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -270,7 +270,6 @@ class AvalancheEngine : public Engine { byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. - enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse; bool _dropsOk, _soundFx, _cheat; Common::String _mouseText; bool _weirdWord; @@ -316,7 +315,6 @@ class AvalancheEngine : public Engine { bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. bool _isLoaded; // Is it a loaded gamestate? - Common::String _enidFilename; void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void setup(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e542ee40b02d..f77b54fc6196 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -407,7 +407,6 @@ void AvalancheEngine::init() { atkey = "alt-"; #endif - _mouse = kMouseStateNo; _letMeOut = false; _holdTheDawn = true; _currentMouse = 177; @@ -417,7 +416,6 @@ void AvalancheEngine::init() { _cp = 0; _ledStatus = 177; _defaultLed = 2; - _enidFilename = ""; // Undefined. for (int i = 0; i < 3; i++) _scoreToDisplay[i] = -1; // Impossible digits. _holdTheDawn = false; @@ -1632,7 +1630,6 @@ void AvalancheEngine::newGame() { _userMovesAvvy = false; _doingSpriteRun = false; _avvyInBed = true; - _enidFilename = ""; enterRoom(kRoomYours, 1); avvy->_visible = false; From 649fa6e5f02e7d6d3d8a6265f90d9f2a68a76887 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 21:57:24 +0200 Subject: [PATCH 1130/1332] AVALANCHE: Use the Color enum, remove some magic values, identify some dead variables --- engines/avalanche/animation.cpp | 4 ++-- engines/avalanche/animation.h | 2 +- engines/avalanche/avalanche.h | 2 +- engines/avalanche/avalot.cpp | 7 ++++--- engines/avalanche/avalot.h | 11 +++++++---- engines/avalanche/dialogs.cpp | 6 +++--- engines/avalanche/enums.h | 8 ++++---- engines/avalanche/graphics.cpp | 8 ++++---- engines/avalanche/graphics.h | 9 +++++---- engines/avalanche/menu.cpp | 12 ++++++------ engines/avalanche/menu.h | 14 ++++++++------ 11 files changed, 45 insertions(+), 38 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 960705f17a7b..5d60a73d1427 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -81,8 +81,8 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _info._yLength = inf.readByte(); _stat._seq = inf.readByte(); _info._size = inf.readUint16LE(); - _stat._fgBubbleCol = inf.readByte(); - _stat._bgBubbleCol = inf.readByte(); + _stat._fgBubbleCol = (Color)inf.readByte(); + _stat._bgBubbleCol = (Color)inf.readByte(); _stat._acciNum = inf.readByte(); _animCount = 0; // = 1; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 1b616f9fae90..591e955e8ff6 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -50,7 +50,7 @@ struct StatType { Common::String _comment; // Comment. byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. - byte _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. + Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. byte _acciNum; // The number according to Acci. (1=Avvy, etc.) }; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 91473e185af9..212840ba3fbf 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -279,7 +279,7 @@ class AvalancheEngine : public Engine { byte _thinks; bool _thinkThing; int16 _talkX, _talkY; - byte _talkBackgroundColor, _talkFontColor; + Color _talkBackgroundColor, _talkFontColor; byte _scrollBells; // no. of times to ring the bell bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f77b54fc6196..2bf5a93c57ae 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,7 +201,7 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so _oldMinute = _minute; } -void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { +void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color) { if (angle > 900) { endPoint.x = 177; return; @@ -210,7 +210,7 @@ void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); } -void Clock::drawHand(const Common::Point &endPoint, byte color) { +void Clock::drawHand(const Common::Point &endPoint, Color color) { if (endPoint.x == 177) return; @@ -522,7 +522,7 @@ void AvalancheEngine::loadAlso(byte num) { curLine->_y1 = file.readSint16LE(); curLine->_x2 = file.readSint16LE(); curLine->_y2 = file.readSint16LE(); - curLine->_color = file.readByte(); + curLine->_color = (Color)file.readByte(); } memset(_peds, 177, sizeof(_peds)); @@ -1483,6 +1483,7 @@ void AvalancheEngine::spriteRun() { _doingSpriteRun = false; } +// CHECKME: Unused function void AvalancheEngine::fixFlashers() { _ledStatus = 177; _animation->setOldDirection(kDirNone); diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index af7ba2c71dbe..189b9cb48874 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -57,8 +57,8 @@ class Clock { uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; Common::Point _clockHandHour, _clockHandMinute; - void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color); - void drawHand(const Common::Point &endPoint, byte color); + void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color); + void drawHand(const Common::Point &endPoint, Color color); void plotHands(); void chime(); }; @@ -92,13 +92,16 @@ struct ByteField { }; struct LineType : public FieldType { - byte _color; + Color _color; }; typedef int8 TuneType[31]; struct QuasipedType { - byte _whichPed, _foregroundColor, _room, _backgroundColor; + byte _whichPed; + Color _foregroundColor; + Room _room; + Color _backgroundColor; People _who; }; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index a3cbd63c01e4..3970f682318b 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -51,7 +51,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever if (_vm->_ledStatus == state) return; // Already like that! - byte color = kColorBlack; + Color color = kColorBlack; switch (state) { case 0: color = kColorBlack; @@ -621,8 +621,8 @@ void Dialogs::reset() { void Dialogs::setBubbleStateNatural() { _vm->_talkX = 320; _vm->_talkY = 200; - _vm->_talkBackgroundColor = 8; - _vm->_talkFontColor = 15; + _vm->_talkBackgroundColor = kColorDarkgray; + _vm->_talkFontColor = kColorWhite; } Common::String Dialogs::displayMoney() { diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index c3c9a54480d4..a25b58e938b0 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -30,10 +30,10 @@ namespace Avalanche { enum Color { - kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed, - kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, - kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, - kColorWhite + kColorBlack = 0, kColorBlue, kColorGreen, kColorCyan, kColorRed, + kColorMagenta = 5, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue, + kColorLightgreen = 10, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow, + kColorWhite = 15 }; // CHECKME: kRoomBossKey is a guess diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 643025fec77e..bc0a83ab5b4b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -76,7 +76,7 @@ void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } -Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { +Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { Common::Point endPoint; const double pi = 3.14; const double convfac = pi / 180.0; @@ -162,12 +162,12 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, return endPoint; } -void Graphics::drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) { +void Graphics::drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { while (radius > 0) drawArc(surface, x, y, stAngle, endAngle, radius--, color); } -void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color) { +void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color) { // Draw the borders with a marking color. _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255); _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255); @@ -204,7 +204,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color); } -void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { +void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 4cf338bb3f26..e83dbf6e7296 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -32,6 +32,7 @@ #include "common/rect.h" #include "graphics/surface.h" +#include "avalanche/enums.h" namespace Avalanche { class AvalancheEngine; @@ -74,11 +75,11 @@ class Graphics { // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) // TODO: Make it more accurate later. - Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); + Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); - void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color); - void drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color); - void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color); + void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); + void drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color); + void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 7264cbcf1960..81fb818025f3 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -103,11 +103,11 @@ void MenuItem::setupOption(Common::String title, char trigger, Common::String sh } void MenuItem::displayOption(byte y, bool highlit) { - byte backgroundColor; + Color backgroundColor; if (highlit) - backgroundColor = 0; + backgroundColor = kColorBlack; else - backgroundColor = 7; + backgroundColor = kColorLightgray; _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); Common::String text = _options[y]._title; @@ -290,8 +290,8 @@ void Menu::findWhatYouCanDoWithIt() { } void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) { - byte fontColor; - byte backgroundColor; + Color fontColor; + Color backgroundColor; if (highlighted) { fontColor = kColorWhite; backgroundColor = kColorBlack; @@ -339,7 +339,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo } void Menu::bleep() { - warning("STUB: Dropdown::bleep()"); + warning("STUB: Menu::bleep()"); } void Menu::parseKey(char r, char re) { diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index e1d42055bb30..815ff230e996 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -131,12 +131,14 @@ class Menu { static const byte kIndent = 5; static const byte kSpacing = 10; - static const byte kMenuBackgroundColor = kColorLightgray; - static const byte kMenuFontColor = kColorBlack; - static const byte kMenuBorderColor = kColorBlack; - static const byte kHighlightBackgroundColor = kColorBlack; - static const byte kHighlightFontColor = kColorWhite; - static const byte kDisabledColor = kColorDarkgray; + static const Color kMenuBackgroundColor = kColorLightgray; + static const Color kMenuBorderColor = kColorBlack; + +// Checkme: Useless constants? +// static const Color kMenuFontColor = kColorBlack; +// static const Color kHighlightBackgroundColor = kColorBlack; +// static const Color kHighlightFontColor = kColorWhite; +// static const Color kDisabledColor = kColorDarkgray; bool _menuActive; // Kludge so we don't have to keep referring to the menu. From 75258758ef64ae606a7aa6c4949bcb2b22ad1451 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 23:22:36 +0200 Subject: [PATCH 1131/1332] AVALANCHE: Move Zoom to Graphics --- engines/avalanche/avalanche.h | 1 - engines/avalanche/avalot.cpp | 24 +----------------------- engines/avalanche/graphics.cpp | 27 +++++++++++++++++++++++---- engines/avalanche/graphics.h | 1 + 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 212840ba3fbf..024b484eb02b 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -384,7 +384,6 @@ class AvalancheEngine : public Engine { void scram(Common::String &str); void unScramble(); - void zoomOut(int16 x, int16 y); // Only used when entering the map. void enterNewTown(); void findPeople(byte room); void putGeidaAt(byte whichPed, byte ped); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2bf5a93c57ae..27f7338555d9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -605,28 +605,6 @@ void AvalancheEngine::loadRoom(byte num) { CursorMan.showMouse(true); } -void AvalancheEngine::zoomOut(int16 x, int16 y) { - //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! - - ::Graphics::Surface backup; - backup.copyFrom(_graphics->_surface); - - for (byte i = 1; i <= 20; i ++) { - int16 x1 = x - (x / 20) * i; - int16 y1 = y - ((y - 10) / 20) * i; - int16 x2 = x + (((639 - x) / 20) * i); - int16 y2 = y + (((161 - y) / 20) * i); - - _graphics->_surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); - _graphics->refreshScreen(); - _system->delayMillis(17); - _graphics->_surface.copyFrom(backup); - _graphics->refreshScreen(); - } - - backup.free(); -} - void AvalancheEngine::findPeople(byte room) { for (int i = 1; i < 29; i++) { if (_whereIs[i] == room) { @@ -900,7 +878,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { // You're entering the map. dawn(); if (ped > 0) - zoomOut(_peds[ped]._x, _peds[ped]._y); + _graphics->zoomOut(_peds[ped]._x, _peds[ped]._y); if ((_objects[kObjectWine - 1]) && (_wineState != 3)) { _dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index bc0a83ab5b4b..a2099045220a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -30,11 +30,8 @@ #include "common/system.h" #include "common/rect.h" - #include "engines/util.h" - #include "graphics/palette.h" - #include "math.h" namespace Avalanche { @@ -312,7 +309,29 @@ void Graphics::refreshScreen() { } void Graphics::refreshBackground() { - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); + drawPicture(_surface, _background, 0, 10); +} + +void Graphics::zoomOut(int16 x, int16 y) { + //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! + + ::Graphics::Surface backup; + backup.copyFrom(_surface); + + for (byte i = 1; i <= 20; i ++) { + int16 x1 = x - (x / 20) * i; + int16 y1 = y - ((y - 10) / 20) * i; + int16 x2 = x + (((639 - x) / 20) * i); + int16 y2 = y + (((161 - y) / 20) * i); + + _surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); + refreshScreen(); + _vm->_system->delayMillis(17); + _surface.copyFrom(backup); + refreshScreen(); + } + + backup.free(); } } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e83dbf6e7296..979b3725ce1d 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -90,6 +90,7 @@ class Graphics { void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); void refreshBackground(); + void zoomOut(int16 x, int16 y); // Only used when entering the map. private: AvalancheEngine *_vm; From 00e5a4830bda004f5b4193c9d0d97a21f3e253ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 23:48:53 +0200 Subject: [PATCH 1132/1332] AVALANCHE: Move background loading to Graphics --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/graphics.cpp | 4 ++++ engines/avalanche/graphics.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 27f7338555d9..0e71f600e046 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -595,7 +595,7 @@ void AvalancheEngine::loadRoom(byte num) { file.seek(177); - _graphics->_background = _graphics->loadPictureRow(file, _graphics->kBackgroundWidth, _graphics->kBackgroundHeight); + _graphics->loadBackground(file); _graphics->refreshBackground(); file.close(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a2099045220a..79df06b8c047 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -308,6 +308,10 @@ void Graphics::refreshScreen() { g_system->updateScreen(); } +void Graphics::loadBackground(Common::File &file) { + _background = loadPictureRow(file, kBackgroundWidth, kBackgroundHeight); +} + void Graphics::refreshBackground() { drawPicture(_surface, _background, 0, 10); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 979b3725ce1d..b1b186af41c2 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -89,6 +89,7 @@ class Graphics { void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. void refreshScreen(); + void loadBackground(Common::File &file); void refreshBackground(); void zoomOut(int16 x, int16 y); // Only used when entering the map. From 7a8d252ddb9115d4cfea0bdc5e94b38ac3ddad23 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 09:43:28 +0200 Subject: [PATCH 1133/1332] AVALANCHE: Move Digits and Directions to Graphics --- engines/avalanche/avalanche.cpp | 6 ------ engines/avalanche/avalanche.h | 3 --- engines/avalanche/avalot.cpp | 29 +++++------------------------ engines/avalanche/graphics.cpp | 33 +++++++++++++++++++++++++++++++++ engines/avalanche/graphics.h | 14 ++++++++++---- 5 files changed, 48 insertions(+), 37 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index cd943513ba46..729bb8bdc55a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -88,12 +88,6 @@ AvalancheEngine::~AvalancheEngine() { } } } - - for (int i = 0; i < 9; i++) { - _digits[i].free(); - _directions[i].free(); - } - _digits[9].free(); } Common::ErrorCode AvalancheEngine::initialize() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 024b484eb02b..2e2724f864af 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -283,8 +283,6 @@ class AvalancheEngine : public Engine { byte _scrollBells; // no. of times to ring the bell bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! - ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. // Called .free() for them in ~Gyro(). int8 _scoreToDisplay[3]; byte _currentMouse; // current mouse-void @@ -327,7 +325,6 @@ class AvalancheEngine : public Engine { void exitRoom(byte x); void enterRoom(Room room, byte ped); void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! - void loadDigits(); // Load the scoring digits & rwlites void drawToolbar(); void drawScore(); void incScore(byte num); // Add on no. of points diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0e71f600e046..096a5d7dd0af 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -318,7 +318,7 @@ void AvalancheEngine::setup() { _dialogs->reset(); dusk(); - loadDigits(); + _graphics->loadDigits(file); _parser->_inputTextPos = 0; _parser->_quote = true; @@ -1111,26 +1111,6 @@ void AvalancheEngine::thinkAbout(byte object, bool type) { _thinkThing = type; } -void AvalancheEngine::loadDigits() { // Load the scoring digits & rwlites - const byte digitsize = 134; - const byte rwlitesize = 126; - - if (!file.open("digit.avd")) - error("AVALANCHE: Lucerna: File not found: digit.avd"); - - for (int i = 0; i < 10; i++) { - file.seek(i * digitsize); - _digits[i] = _graphics->loadPictureGraphic(file); - } - - for (int i = 0; i < 9; i++) { - file.seek(10 * digitsize + i * rwlitesize); - _directions[i] = _graphics->loadPictureGraphic(file); - } - - file.close(); -} - void AvalancheEngine::drawToolbar() { if (!file.open("useful.avd")) error("AVALANCHE: Lucerna: File not found: useful.avd"); @@ -1138,10 +1118,11 @@ void AvalancheEngine::drawToolbar() { file.seek(40); CursorMan.showMouse(false); + ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); _graphics->drawPicture(_graphics->_surface, picture, 5, 169); - picture.free(); + file.close(); CursorMan.showMouse(true); @@ -1165,7 +1146,7 @@ void AvalancheEngine::drawScore() { for (int i = 0; i < 3; i++) { if (_scoreToDisplay[i] != numbers[i]) - _graphics->drawPicture(_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); + _graphics->drawDigit(numbers[i], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); @@ -1401,7 +1382,7 @@ void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits(). _animation->setOldDirection(_animation->getDirection()); CursorMan.showMouse(false); - _graphics->drawPicture(_graphics->_surface, _directions[_animation->getDirection()], 0, 161); + _graphics->drawDirection(_animation->getDirection(), 0, 161); CursorMan.showMouse(true); } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 79df06b8c047..efed0fa97f2f 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -48,6 +48,11 @@ Graphics::~Graphics() { _background.free(); _screen.free(); _scrolls.free(); + + for (int i = 0; i < 10; i++) + _digits[i].free(); + for (int i = 0; i < 9; i++) + _directions[i].free(); } void Graphics::init() { @@ -68,6 +73,26 @@ void Graphics::init() { _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); } +void Graphics::loadDigits(Common::File &file) { // Load the scoring digits & rwlites + const byte digitsize = 134; + const byte rwlitesize = 126; + + if (!file.open("digit.avd")) + error("AVALANCHE: Lucerna: File not found: digit.avd"); + + for (int i = 0; i < 10; i++) { + file.seek(i * digitsize); + _digits[i] = loadPictureGraphic(file); + } + + for (int i = 0; i < 9; i++) { + file.seek(10 * digitsize + i * rwlitesize); + _directions[i] = loadPictureGraphic(file); + } + + file.close(); +} + void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); @@ -214,6 +239,14 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text } } +void Graphics::drawDigit(int index, int x, int y) { + drawPicture(_surface, _digits[index], x, y); +} + +void Graphics::drawDirection(int index, int x, int y) { + drawPicture(_surface, _directions[index], x, y); +} + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index b1b186af41c2..ea05ef13ef1d 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -70,6 +70,8 @@ class Graphics { Graphics(AvalancheEngine *vm); ~Graphics(); void init(); + void loadDigits(Common::File &file); // Load the scoring digits & rwlites + void fleshColors(); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. @@ -80,6 +82,8 @@ class Graphics { void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color); void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + void drawDigit(int index, int x, int y); + void drawDirection(int index, int x, int y); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data @@ -94,12 +98,14 @@ class Graphics { void zoomOut(int16 x, int16 y); // Only used when entering the map. private: - AvalancheEngine *_vm; - static const byte kEgaPaletteIndex[16]; - - byte _egaPalette[64][3]; + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) + byte _egaPalette[64][3]; + + AvalancheEngine *_vm; + }; } // End of namespace Avalanche From 7d66cdf417f4e4673004fd5802e4a9649e38d179 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 10:00:23 +0200 Subject: [PATCH 1134/1332] AVALANCHE: Move mouse cursor display functions to Graphics --- engines/avalanche/avalanche.h | 2 - engines/avalanche/avalot.cpp | 80 +++++----------------------------- engines/avalanche/dialogs.cpp | 6 +-- engines/avalanche/graphics.cpp | 56 +++++++++++++++++++++++- engines/avalanche/graphics.h | 7 +-- engines/avalanche/menu.cpp | 8 ++-- engines/avalanche/pingo.cpp | 2 +- 7 files changed, 78 insertions(+), 83 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 2e2724f864af..1d36c4c64086 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -348,9 +348,7 @@ class AvalancheEngine : public Engine { void spriteRun(); Common::String intToStr(int32 num); - void newMouse(byte id); void setMousePointerWait(); // Makes hourglass. - void loadMouse(byte which); void setBackgroundColor(byte x); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 096a5d7dd0af..33bffb0f52fc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -498,7 +498,7 @@ void AvalancheEngine::loadAlso(byte num) { Common::String filename; filename = Common::String::format("also%d.avd", num); if (!file.open(filename)) - error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + error("AVALANCHE: File not found: %s", filename.c_str()); file.seek(128); @@ -581,7 +581,7 @@ void AvalancheEngine::loadRoom(byte num) { Common::String filename = Common::String::format("place%d.avd", num); if (!file.open(filename)) - error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + error("AVALANCHE: File not found: %s", filename.c_str()); file.seek(146); if (!_roomnName.empty()) @@ -1086,10 +1086,10 @@ void AvalancheEngine::thinkAbout(byte object, bool type) { if (type == kThing) { if (!file.open("thinks.avd")) - error("AVALANCHE: Lucerna: File not found: thinks.avd"); + error("AVALANCHE: File not found: thinks.avd"); } else { // kPerson if (!file.open("folk.avd")) - error("AVALANCHE: Lucerna: File not found: folk.avd"); + error("AVALANCHE: File not found: folk.avd"); object -= 149; if (object >= 25) @@ -1113,7 +1113,7 @@ void AvalancheEngine::thinkAbout(byte object, bool type) { void AvalancheEngine::drawToolbar() { if (!file.open("useful.avd")) - error("AVALANCHE: Lucerna: File not found: useful.avd"); + error("AVALANCHE: File not found: useful.avd"); file.seek(40); @@ -1286,17 +1286,17 @@ void AvalancheEngine::checkClick() { after_the_scroll = false;*/ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - newMouse(0); // up arrow + _graphics->loadMouse(0); // up arrow else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) - newMouse(7); //I-beam + _graphics->loadMouse(7); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - newMouse(1); // screwdriver + _graphics->loadMouse(1); // screwdriver else if (!_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { - newMouse(6); // Mark's crosshairs + _graphics->loadMouse(6); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else - newMouse(3); // fletch + _graphics->loadMouse(3); // fletch } if (_holdLeftMouse) { @@ -1454,20 +1454,12 @@ Common::String AvalancheEngine::intToStr(int32 num) { return Common::String::format("%d", num); } -void AvalancheEngine::newMouse(byte id) { - if (id == _currentMouse) - return; - - _currentMouse = id; - loadMouse(id); -} - /** * Set the mouse pointer to 'HourGlass" * @remarks Originally called 'wait' */ void AvalancheEngine::setMousePointerWait() { - newMouse(4); + _graphics->loadMouse(4); } void AvalancheEngine::resetVariables() { @@ -1767,56 +1759,6 @@ Common::String AvalancheEngine::f5Does() { return Common::String::format("%c", kVerbCodePardon); // If all else fails... } -void AvalancheEngine::loadMouse(byte which) { - Common::File f; - - if (!f.open("mice.avd")) - error("AVALANCHE: Gyro: File not found: mice.avd"); - - ::Graphics::Surface cursor; - cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); - cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); - - - // The AND mask. - f.seek(kMouseSize * 2 * which + 134); - - ::Graphics::Surface mask = _graphics->loadPictureGraphic(f); - - for (int j = 0; j < mask.h; j++) { - for (int i = 0; i < mask.w; i++) { - byte pixel = *(byte *)mask.getBasePtr(i, j); - if (pixel == 0) { - *(byte *)cursor.getBasePtr(i, j * 2 ) = 0; - *(byte *)cursor.getBasePtr(i, j * 2 + 1) = 0; - } - } - } - - mask.free(); - - // The OR mask. - f.seek(kMouseSize * 2 * which + 134 * 2); - - mask = _graphics->loadPictureGraphic(f); - - for (int j = 0; j < mask.h; j++) { - for (int i = 0; i < mask.w; i++) { - byte pixel = *(byte *)mask.getBasePtr(i, j); - if (pixel != 0) { - *(byte *)cursor.getBasePtr(i, j * 2 ) = pixel; - *(byte *)cursor.getBasePtr(i, j * 2 + 1) = pixel; - } - } - } - - mask.free(); - f.close(); - - CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); - cursor.free(); -} - void AvalancheEngine::setBackgroundColor(byte x) { warning("STUB: background()"); } diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 3970f682318b..d37d7592a4c2 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -115,7 +115,7 @@ void Dialogs::scrollModeNormal() { setReadyLight(3); _vm->_seeScroll = true; - _vm->newMouse(3); + _vm->_graphics->loadMouse(3); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -206,7 +206,7 @@ void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); // It should work with keypresses too! TODO: Implement it! - _vm->loadMouse(5); + _vm->_graphics->loadMouse(5); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -254,7 +254,7 @@ void Dialogs::scrollModeMusic() { setReadyLight(3); _vm->_seeScroll = true; CursorMan.showMouse(false); - _vm->newMouse(3); + _vm->_graphics->loadMouse(3); TuneType played; for (unsigned int i = 0; i < sizeof(played); i++) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index efed0fa97f2f..744876d27f51 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -78,7 +78,7 @@ void Graphics::loadDigits(Common::File &file) { // Load the scoring digits & r const byte rwlitesize = 126; if (!file.open("digit.avd")) - error("AVALANCHE: Lucerna: File not found: digit.avd"); + error("AVALANCHE: File not found: digit.avd"); for (int i = 0; i < 10; i++) { file.seek(i * digitsize); @@ -93,6 +93,60 @@ void Graphics::loadDigits(Common::File &file) { // Load the scoring digits & r file.close(); } +void Graphics::loadMouse(byte which) { + if (which == _vm->_currentMouse) + return; + + _vm->_currentMouse = which; + + Common::File f; + if (!f.open("mice.avd")) + error("AVALANCHE: Gyro: File not found: mice.avd"); + + ::Graphics::Surface cursor; + cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); + cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); + + + // The AND mask. + f.seek(kMouseSize * 2 * which + 134); + + ::Graphics::Surface mask = loadPictureGraphic(f); + + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel == 0) { + *(byte *)cursor.getBasePtr(i, j * 2 ) = 0; + *(byte *)cursor.getBasePtr(i, j * 2 + 1) = 0; + } + } + } + + mask.free(); + + // The OR mask. + f.seek(kMouseSize * 2 * which + 134 * 2); + + mask = loadPictureGraphic(f); + + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + byte pixel = *(byte *)mask.getBasePtr(i, j); + if (pixel != 0) { + *(byte *)cursor.getBasePtr(i, j * 2 ) = pixel; + *(byte *)cursor.getBasePtr(i, j * 2 + 1) = pixel; + } + } + } + + mask.free(); + f.close(); + + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, AvalancheEngine::kMouseHotSpots[which]._horizontal, AvalancheEngine::kMouseHotSpots[which]._vertical * 2, 255, false); + cursor.free(); +} + void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ea05ef13ef1d..137d3e4ade33 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -71,11 +71,12 @@ class Graphics { ~Graphics(); void init(); void loadDigits(Common::File &file); // Load the scoring digits & rwlites + void loadMouse(byte which); void fleshColors(); // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. - // Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().) + // Returns the end point of the arc. (Needed in Clock.) // TODO: Make it more accurate later. Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); @@ -91,7 +92,7 @@ class Graphics { ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. + void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. void refreshScreen(); void loadBackground(Common::File &file); void refreshBackground(); @@ -99,7 +100,7 @@ class Graphics { private: static const byte kEgaPaletteIndex[16]; - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! + ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) byte _egaPalette[64][3]; diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 81fb818025f3..c8687650472d 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -701,14 +701,14 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->newMouse(0); // Up arrow + _vm->_graphics->loadMouse(0); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->newMouse(2); // Right-arrow + _vm->_graphics->loadMouse(2); // Right-arrow else - _vm->newMouse(3); // Fletch + _vm->_graphics->loadMouse(3); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->newMouse(1); // Screwdriver + _vm->_graphics->loadMouse(1); // Screwdriver _activeMenuItem.lightUp(cursorPos); diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 9a11e6f66118..bffceabe0772 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -79,7 +79,7 @@ void Pingo::winningPic() { _vm->dusk(); if (!f.open("finale.avd")) - error("AVALANCHE: Lucerna: File not found: finale.avd"); + error("AVALANCHE: File not found: finale.avd"); #if 0 for (int bit = 0; bit <= 3; bit++) { From 726fa64bbf04dc84b78d9a165652cdeced7f4cde Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 10:11:21 +0200 Subject: [PATCH 1135/1332] AVALANCHE: Use an enum for the Mouse cursor identifier --- engines/avalanche/avalanche.h | 1 - engines/avalanche/avalot.cpp | 24 ++++++++---------------- engines/avalanche/dialogs.cpp | 6 +++--- engines/avalanche/enums.h | 4 ++++ engines/avalanche/menu.cpp | 10 +++++----- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 1d36c4c64086..5736291ad7b7 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -348,7 +348,6 @@ class AvalancheEngine : public Engine { void spriteRun(); Common::String intToStr(int32 num); - void setMousePointerWait(); // Makes hourglass. void setBackgroundColor(byte x); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 33bffb0f52fc..bb69de864b27 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -237,7 +237,7 @@ void Clock::chime() { if (hour == 0) hour = 12; - _vm->setMousePointerWait(); + _vm->_graphics->loadMouse(kCurWait); for (int i = 1; i <= hour; i++) { for (int j = 1; j <= 3; j++) @@ -420,7 +420,7 @@ void AvalancheEngine::init() { _scoreToDisplay[i] = -1; // Impossible digits. _holdTheDawn = false; - setMousePointerWait(); + _graphics->loadMouse(kCurWait); CursorMan.showMouse(true); } @@ -1082,7 +1082,7 @@ void AvalancheEngine::thinkAbout(byte object, bool type) { _thinks = object; object--; - setMousePointerWait(); + _graphics->loadMouse(kCurWait); if (type == kThing) { if (!file.open("thinks.avd")) @@ -1286,17 +1286,17 @@ void AvalancheEngine::checkClick() { after_the_scroll = false;*/ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _graphics->loadMouse(0); // up arrow + _graphics->loadMouse(kCurUpArrow); // up arrow else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) - _graphics->loadMouse(7); //I-beam + _graphics->loadMouse(kCurIBeam); //I-beam else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _graphics->loadMouse(1); // screwdriver + _graphics->loadMouse(kCurScrewDriver); // screwdriver else if (!_menu->isActive()) { // Dropdown can handle its own pointers. if (_holdLeftMouse) { - _graphics->loadMouse(6); // Mark's crosshairs + _graphics->loadMouse(kCurCrosshair); // Mark's crosshairs guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. } else - _graphics->loadMouse(3); // fletch + _graphics->loadMouse(kCurFletch); // fletch } if (_holdLeftMouse) { @@ -1454,14 +1454,6 @@ Common::String AvalancheEngine::intToStr(int32 num) { return Common::String::format("%d", num); } -/** - * Set the mouse pointer to 'HourGlass" - * @remarks Originally called 'wait' - */ -void AvalancheEngine::setMousePointerWait() { - _graphics->loadMouse(4); -} - void AvalancheEngine::resetVariables() { _animation->setDirection(kDirUp); _carryNum = 0; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index d37d7592a4c2..32bf3690682d 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -115,7 +115,7 @@ void Dialogs::scrollModeNormal() { setReadyLight(3); _vm->_seeScroll = true; - _vm->_graphics->loadMouse(3); + _vm->_graphics->loadMouse(kCurFletch); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -206,7 +206,7 @@ void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); // It should work with keypresses too! TODO: Implement it! - _vm->_graphics->loadMouse(5); + _vm->_graphics->loadMouse(kCurHand); ::Graphics::Surface temp; temp.copyFrom(_vm->_graphics->_surface); @@ -254,7 +254,7 @@ void Dialogs::scrollModeMusic() { setReadyLight(3); _vm->_seeScroll = true; CursorMan.showMouse(false); - _vm->_graphics->loadMouse(3); + _vm->_graphics->loadMouse(kCurFletch); TuneType played; for (unsigned int i = 0; i < sizeof(played); i++) diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index a25b58e938b0..4abd35c0fcfc 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -87,4 +87,8 @@ enum VerbCode { } // End of namespace Avalanche +enum MouseCursor { + kCurUpArrow = 0, kCurScrewDriver = 1, kCurRightArrow = 2, kCurFletch = 3, kCurWait = 4, kCurHand = 5, + kCurCrosshair = 6, kCurIBeam = 7 +}; #endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index c8687650472d..7beacc86b2e6 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -697,18 +697,18 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... do { _vm->updateEvents(); - // We updadte the cursor's picture. + // We update the cursor's picture. cursorPos = _vm->getMousePos(); // Change arrow... if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) - _vm->_graphics->loadMouse(0); // Up arrow + _vm->_graphics->loadMouse(kCurUpArrow); // Up arrow else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) - _vm->_graphics->loadMouse(2); // Right-arrow + _vm->_graphics->loadMouse(kCurRightArrow); // Right-arrow else - _vm->_graphics->loadMouse(3); // Fletch + _vm->_graphics->loadMouse(kCurFletch); // Fletch } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) - _vm->_graphics->loadMouse(1); // Screwdriver + _vm->_graphics->loadMouse(kCurScrewDriver); // Screwdriver _activeMenuItem.lightUp(cursorPos); From fdbcb5f785dcc4a4bf8b178c11f4a92d07467e6c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 10:41:52 +0200 Subject: [PATCH 1136/1332] AVALANCHE: Move some more functions to Graphics --- engines/avalanche/avalanche.h | 3 -- engines/avalanche/avalot.cpp | 59 +++++----------------------------- engines/avalanche/enums.h | 4 +++ engines/avalanche/graphics.cpp | 51 +++++++++++++++++++++++++++++ engines/avalanche/graphics.h | 19 +++++++---- engines/avalanche/parser.cpp | 8 ++--- engines/avalanche/timer.cpp | 2 +- 7 files changed, 80 insertions(+), 66 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 5736291ad7b7..ae490e005677 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -320,7 +320,6 @@ class AvalancheEngine : public Engine { void init(); void callVerb(VerbCode id); - void drawAlsoLines(); void loadRoom(byte num); void exitRoom(byte x); void enterRoom(Room room, byte ped); @@ -349,8 +348,6 @@ class AvalancheEngine : public Engine { Common::String intToStr(int32 num); - void setBackgroundColor(byte x); - void resetVariables(); void newGame(); // This sets up the DNA for a completely new game. void slowDown(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index bb69de864b27..bcd501001eb6 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -442,22 +442,6 @@ void AvalancheEngine::callVerb(VerbCode id) { } } -void AvalancheEngine::drawAlsoLines() { - CursorMan.showMouse(false); - - _graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); - _graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - - for (int i = 0; i < _lineNum; i++) { - // We had to check if the lines are within the borders of the screen. - if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _graphics->kScreenHeight) - && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _graphics->kScreenHeight)) - _graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); - } - - CursorMan.showMouse(true); -} - /** * Check is it's possible to give something to Spludwick * @remarks Originally called 'nextstring' @@ -564,7 +548,7 @@ void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i < listen_length; i++) _listen += file.readByte(); - drawAlsoLines(); + _graphics->drawAlsoLines(); file.close(); unScramble(); @@ -1077,19 +1061,14 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { } void AvalancheEngine::thinkAbout(byte object, bool type) { - const int16 picSize = 966; - _thinks = object; object--; - _graphics->loadMouse(kCurWait); - + Common::String filename; if (type == kThing) { - if (!file.open("thinks.avd")) - error("AVALANCHE: File not found: thinks.avd"); + filename = "thinks.avd"; } else { // kPerson - if (!file.open("folk.avd")) - error("AVALANCHE: File not found: folk.avd"); + filename = "folk.avd"; object -= 149; if (object >= 25) @@ -1098,34 +1077,16 @@ void AvalancheEngine::thinkAbout(byte object, bool type) { object--; // Last time... } + _graphics->loadMouse(kCurWait); CursorMan.showMouse(false); - - file.seek(object * picSize + 65); - ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); - _graphics->drawPicture(_graphics->_surface, picture, 205, 170); - - picture.free(); - file.close(); - + _graphics->drawThinkPic(filename, object); CursorMan.showMouse(true); + _thinkThing = type; } void AvalancheEngine::drawToolbar() { - if (!file.open("useful.avd")) - error("AVALANCHE: File not found: useful.avd"); - - file.seek(40); - - CursorMan.showMouse(false); - - ::Graphics::Surface picture = _graphics->loadPictureGraphic(file); - _graphics->drawPicture(_graphics->_surface, picture, 5, 169); - picture.free(); - - file.close(); - - CursorMan.showMouse(true); + _graphics->drawToolbar(); _animation->setOldDirection(kDirNone); drawDirection(); } @@ -1751,10 +1712,6 @@ Common::String AvalancheEngine::f5Does() { return Common::String::format("%c", kVerbCodePardon); // If all else fails... } -void AvalancheEngine::setBackgroundColor(byte x) { - warning("STUB: background()"); -} - void AvalancheEngine::hangAroundForAWhile() { for (int i = 0; i < 28; i++) slowDown(); diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 4abd35c0fcfc..e10033a64cf6 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -91,4 +91,8 @@ enum MouseCursor { kCurUpArrow = 0, kCurScrewDriver = 1, kCurRightArrow = 2, kCurFletch = 3, kCurWait = 4, kCurHand = 5, kCurCrosshair = 6, kCurIBeam = 7 }; + +static const int16 kScreenWidth = 640; +static const int16 kScreenHeight = 200; + #endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 744876d27f51..9c7c07e748eb 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -147,6 +147,36 @@ void Graphics::loadMouse(byte which) { cursor.free(); } +void Graphics::drawThinkPic(Common::String filename, int id) { + static const int16 kPicSize = 966; + Common::File file; + if (!file.open(filename)) + error("drawThinkPic(): File not found: %s", filename.c_str()); + + file.seek(id * kPicSize + 65); + ::Graphics::Surface picture = loadPictureGraphic(file); + drawPicture(_surface, picture, 205, 170); + + picture.free(); + file.close(); +} + +void Graphics::drawToolbar() { + Common::File file; + if (!file.open("useful.avd")) + error("drawToolbar(): File not found: useful.avd"); + + file.seek(40); + + CursorMan.showMouse(false); + ::Graphics::Surface picture = loadPictureGraphic(file); + drawPicture(_surface, picture, 5, 169); + CursorMan.showMouse(true); + + picture.free(); + file.close(); +} + void Graphics::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); @@ -349,6 +379,22 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } +void Graphics::drawAlsoLines() { + CursorMan.showMouse(false); + + _magics.fillRect(Common::Rect(0, 0, 640, 200), 0); + _magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + + for (int i = 0; i < _vm->_lineNum; i++) { + // We had to check if the lines are within the borders of the screen. + if ((_vm->_lines[i]._x1 >= 0) && (_vm->_lines[i]._x1 < kScreenWidth) && (_vm->_lines[i]._y1 >= 0) && (_vm->_lines[i]._y1 < kScreenHeight) + && (_vm->_lines[i]._x2 >= 0) && (_vm->_lines[i]._x2 < kScreenWidth) && (_vm->_lines[i]._y2 >= 0) && (_vm->_lines[i]._y2 < kScreenHeight)) + _magics.drawLine(_vm->_lines[i]._x1, _vm->_lines[i]._y1, _vm->_lines[i]._x2, _vm->_lines[i]._y2, _vm->_lines[i]._color); + } + + CursorMan.showMouse(true); +} + void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the spirte blank. for (int j = 0; j < sprite._yLength; j++) { @@ -425,4 +471,9 @@ void Graphics::zoomOut(int16 x, int16 y) { backup.free(); } +// Original name background() +void Graphics::setBackgroundColor(Color x) { + warning("STUB: setBackgroundColor(%d)", x); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 137d3e4ade33..3df59727a5ec 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -56,12 +56,6 @@ class SpriteInfo { class Graphics { public: - static const int16 kScreenWidth = 640; - static const int16 kScreenHeight = 200; - static const uint16 kBackgroundWidth = kScreenWidth; - static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. - // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). - ::Graphics::Surface _surface; ::Graphics::Surface _background; ::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also @@ -85,20 +79,30 @@ class Graphics { void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color); void drawDigit(int index, int x, int y); void drawDirection(int index, int x, int y); + void drawAlsoLines(); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data - ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. + + void drawThinkPic(Common::String filename, int id); + void drawToolbar(); + void refreshScreen(); void loadBackground(Common::File &file); void refreshBackground(); + void setBackgroundColor(Color x); + void zoomOut(int16 x, int16 y); // Only used when entering the map. private: + static const uint16 kBackgroundWidth = kScreenWidth; + static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. + // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). + static const byte kEgaPaletteIndex[16]; ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. @@ -107,6 +111,7 @@ class Graphics { AvalancheEngine *_vm; + ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. }; } // End of namespace Avalanche diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e4c91a8fed80..95bf535f8cc8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1066,10 +1066,10 @@ void Parser::swallow() { // Eat something. } break; case kObjectPotion: - _vm->setBackgroundColor(4); + _vm->_graphics->setBackgroundColor(kColorRed); _vm->_dialogs->displayScrollChain('U', 3); _vm->gameOver(); - _vm->setBackgroundColor(0); + _vm->_graphics->setBackgroundColor(kColorBlack); break; case kObjectInk: _vm->_dialogs->displayScrollChain('U', 4); @@ -1386,7 +1386,7 @@ void Parser::drink() { _vm->dusk(); _vm->hangAroundForAWhile(); _vm->flipRoom(kRoomYours, 1); - _vm->setBackgroundColor(14); + _vm->_graphics->setBackgroundColor(kColorYellow); _vm->_animation->_sprites[0]._visible = false; } } @@ -1414,7 +1414,7 @@ void Parser::standUp() { if (_vm->_avvyIsAwake && _vm->_avvyInBed) { // But he's in bed. if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('d', 12); - _vm->setBackgroundColor(0); + _vm->_graphics->setBackgroundColor(kColorBlack); _vm->_dialogs->displayScrollChain('d', 14); } _vm->_animation->_sprites[0]._visible = true; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 5576a4826ed4..1d145e439e1c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -562,7 +562,7 @@ void Timer::meetAvaroid() { avvy->_moveX = -3; avvy->_moveY = -5; - _vm->setBackgroundColor(2); + _vm->_graphics->setBackgroundColor(kColorGreen); } } From 0edb0e0434359d5ced78fa4f0a32ed1dafc51103 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 14:31:54 +0200 Subject: [PATCH 1137/1332] AVALANCHE: Set the Magic surface as private, some associated rework --- engines/avalanche/animation.cpp | 10 +--------- engines/avalanche/avalot.cpp | 16 +++++++++++++--- engines/avalanche/graphics.cpp | 25 +++++++++++++++---------- engines/avalanche/graphics.h | 6 ++++-- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5d60a73d1427..2a309f31a948 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -379,16 +379,8 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { int16 minY = MIN(oy, y) + yl; int16 maxY = MAX(oy, y) + yl; - byte returnColor = 0; - for (int16 i = x1; i <= x2; i++) { - for (int16 j = minY; j <= maxY; j++) { - byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); - returnColor = MAX(returnColor, actColor); - } - } - - return returnColor; + return _vm->_graphics->getAlsoColor(x1, minY, x2, maxY); } byte Animation::geidaPed(byte ped) { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index bcd501001eb6..7527bb637191 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -543,14 +543,24 @@ void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i < 26; i++) _flags += file.readByte(); - int16 listen_length = file.readByte(); + int16 size = file.readByte(); _listen.clear(); - for (int i = 0; i < listen_length; i++) + for (int i = 0; i < size; i++) _listen += file.readByte(); - _graphics->drawAlsoLines(); + _graphics->prepareAlsoDisplay(); + + CursorMan.showMouse(false); + for (int i = 0; i < _lineNum; i++) { + // We had to check if the lines are within the borders of the screen. + if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < kScreenHeight) + && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < kScreenHeight)) + _graphics->drawAlsoLines(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); + } + CursorMan.showMouse(true); file.close(); + unScramble(); for (int i = 0; i <= alsoNum; i++) { tmpStr = Common::String::format(",%s,", _also[i][0]->c_str()); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9c7c07e748eb..12e43671ee49 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -379,24 +379,29 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } -void Graphics::drawAlsoLines() { - CursorMan.showMouse(false); - +void Graphics::prepareAlsoDisplay() { _magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _magics.frameRect(Common::Rect(0, 45, 640, 161), 15); +} - for (int i = 0; i < _vm->_lineNum; i++) { - // We had to check if the lines are within the borders of the screen. - if ((_vm->_lines[i]._x1 >= 0) && (_vm->_lines[i]._x1 < kScreenWidth) && (_vm->_lines[i]._y1 >= 0) && (_vm->_lines[i]._y1 < kScreenHeight) - && (_vm->_lines[i]._x2 >= 0) && (_vm->_lines[i]._x2 < kScreenWidth) && (_vm->_lines[i]._y2 >= 0) && (_vm->_lines[i]._y2 < kScreenHeight)) - _magics.drawLine(_vm->_lines[i]._x1, _vm->_lines[i]._y1, _vm->_lines[i]._x2, _vm->_lines[i]._y2, _vm->_lines[i]._color); +void Graphics::drawAlsoLines(int x1, int y1, int x2, int y2, Color color) { + _magics.drawLine(x1, y1, x2, y2, color); +} + +byte Graphics::getAlsoColor(int x1, int y1, int x2, int y2) { + byte returnColor = 0; + for (int16 i = x1; i <= x2; i++) { + for (int16 j = y1; j <= y2; j++) { + byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); + returnColor = MAX(returnColor, actColor); + } } - CursorMan.showMouse(true); + return returnColor; } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { - // First we make the pixels of the spirte blank. + // First we make the pixels of the sprite blank. for (int j = 0; j < sprite._yLength; j++) { for (int i = 0; i < sprite._xLength; i++) { if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 3df59727a5ec..b1b65edf8473 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -58,7 +58,6 @@ class Graphics { public: ::Graphics::Surface _surface; ::Graphics::Surface _background; - ::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also ::Graphics::Surface _scrolls; Graphics(AvalancheEngine *vm); @@ -79,7 +78,9 @@ class Graphics { void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color); void drawDigit(int index, int x, int y); void drawDirection(int index, int x, int y); - void drawAlsoLines(); + void prepareAlsoDisplay(); + void drawAlsoLines(int x1, int y1, int x2, int y2, Color color); + byte getAlsoColor(int x1, int y1, int x2, int y2); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data @@ -104,6 +105,7 @@ class Graphics { // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). static const byte kEgaPaletteIndex[16]; + ::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) From 6a7326ec26b4882061a17cf399fa2f685c3d776e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 15:08:41 +0200 Subject: [PATCH 1138/1332] AVALANCHE: More rework on Graphic code --- engines/avalanche/avalot.cpp | 4 +-- engines/avalanche/dialogs.cpp | 50 +++++++++------------------------- engines/avalanche/dialogs.h | 2 -- engines/avalanche/graphics.cpp | 48 ++++++++++++++++++++++++++++---- engines/avalanche/graphics.h | 15 ++++++---- engines/avalanche/menu.cpp | 2 +- engines/avalanche/parser.cpp | 4 +-- 7 files changed, 70 insertions(+), 55 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 7527bb637191..6622a8d4e875 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -548,14 +548,14 @@ void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i < size; i++) _listen += file.readByte(); - _graphics->prepareAlsoDisplay(); + _graphics->clearAlso(); CursorMan.showMouse(false); for (int i = 0; i < _lineNum; i++) { // We had to check if the lines are within the borders of the screen. if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < kScreenHeight) && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < kScreenHeight)) - _graphics->drawAlsoLines(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); + _graphics->setAlsoLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); } CursorMan.showMouse(true); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 32bf3690682d..9367c072c28c 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -99,7 +99,7 @@ void Dialogs::say(int16 x, int16 y, Common::String z) { // We have to draw the characters one-by-one because of the accidental font changes. i++; Common::String chr(z[xx]); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, kColorBlack); + _vm->_graphics->drawScrollText(chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, kColorBlack); } } } @@ -178,30 +178,6 @@ void Dialogs::scrollModeNormal() { warning("STUB: Scrolls::scrollModeNormal()"); } -void Dialogs::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2) { - for (byte i = 0; i < 2; i ++) { - _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite); - _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite); - - _vm->_graphics->_scrolls.fillRect(Common::Rect(x2 - i, y1 + i, x2 - i + 1, y2 - i + 1), kColorDarkgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y2 - i, x2 - i, y2 - i + 1), kColorDarkgray); - } -} - -void Dialogs::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) { - CursorMan.showMouse(false); - - drawShadow(x1, y1, x2, y2); - - bool offset = text.size() % 2; - x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3; - y1 = (y2 - y1) / 2 + y1 - 4; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_font, 8, x1, y1, kColorBlue); - _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_font, 8, x1, y1, kColorBlue); - - CursorMan.showMouse(true); -} - void Dialogs::scrollModeDialogue() { warning("STUB: Scrolls::scrollModeDialogue()"); // It should work with keypresses too! TODO: Implement it! @@ -448,8 +424,8 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { CursorMan.showMouse(false); // The right corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorLightgray); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorLightgray); + _vm->_graphics->drawPieSlice(mx + lx, my - ly, 0, 90, 15, kColorLightgray); + _vm->_graphics->drawPieSlice(mx + lx, my + ly, 270, 360, 15, kColorLightgray); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); @@ -459,10 +435,10 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); // The left corners of the scroll. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); + _vm->_graphics->drawPieSlice(mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); + _vm->_graphics->drawPieSlice(mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); @@ -512,8 +488,8 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { _shadowBoxX = mx + lx; _shadowBoxY = my + ly; _vm->_scroll[i].setChar(' ', 0); - drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); - drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); + _vm->_graphics->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); + _vm->_graphics->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } @@ -577,16 +553,16 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); + _vm->_graphics->drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_talkBackgroundColor); + _vm->_graphics->drawTriangle(points, _vm->_talkBackgroundColor); // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). @@ -595,7 +571,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { for (int i = 0; i < _vm->_scrollNum; i++) { int16 x = xc + _vm->_talkX - _vm->_scroll[i].size() / 2 * 8; bool offset = _vm->_scroll[i].size() % 2; - _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); + _vm->_graphics->drawScrollText(_vm->_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); } ringBell(); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 9904ec6b8b1c..d3088ec35b51 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -104,8 +104,6 @@ class Dialogs { // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); // The "asking" scroll. Used indirectly in diplayQuestion(). - void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2); - void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); void scrollModeDialogue(); // Part of the harp mini-game. void scrollModeMusic(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 12e43671ee49..007c5101f380 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -268,12 +268,12 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, return endPoint; } -void Graphics::drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { +void Graphics::drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { while (radius > 0) - drawArc(surface, x, y, stAngle, endAngle, radius--, color); + drawArc(_scrolls, x, y, stAngle, endAngle, radius--, color); } -void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color) { +void Graphics::drawTriangle(Common::Point *p, Color color) { // Draw the borders with a marking color. _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255); _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255); @@ -310,7 +310,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, Colo _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color); } -void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { +void Graphics::drawText(::Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; @@ -323,6 +323,14 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text } } +void Graphics::drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { + _vm->_graphics->drawText(_surface, text, font, fontHeight, x, y, color); +} + +void Graphics::drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { + _vm->_graphics->drawText(_scrolls, text, font, fontHeight, x, y, color); +} + void Graphics::drawDigit(int index, int x, int y) { drawPicture(_surface, _digits[index], x, y); } @@ -331,6 +339,30 @@ void Graphics::drawDirection(int index, int x, int y) { drawPicture(_surface, _directions[index], x, y); } +void Graphics::drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2) { + for (byte i = 0; i < 2; i ++) { + _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite); + _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite); + + _scrolls.fillRect(Common::Rect(x2 - i, y1 + i, x2 - i + 1, y2 - i + 1), kColorDarkgray); + _scrolls.fillRect(Common::Rect(x1 + i, y2 - i, x2 - i, y2 - i + 1), kColorDarkgray); + } +} + +void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) { + CursorMan.showMouse(false); + + drawScrollShadow(x1, y1, x2, y2); + + bool offset = text.size() % 2; + x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3; + y1 = (y2 - y1) / 2 + y1 - 4; + drawScrollText(text, _vm->_font, 8, x1, y1, kColorBlue); + drawScrollText(Common::String('_'), _vm->_font, 8, x1, y1, kColorBlue); + + CursorMan.showMouse(true); +} + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. @@ -379,12 +411,16 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } -void Graphics::prepareAlsoDisplay() { +void Graphics::clearAlso() { _magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _magics.frameRect(Common::Rect(0, 45, 640, 161), 15); } -void Graphics::drawAlsoLines(int x1, int y1, int x2, int y2, Color color) { +void Graphics::clearTextBar() { + _surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. +} + +void Graphics::setAlsoLine(int x1, int y1, int x2, int y2, Color color) { _magics.drawLine(x1, y1, x2, y2, color); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index b1b65edf8473..de2723115dd2 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -73,13 +73,17 @@ class Graphics { // TODO: Make it more accurate later. Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); - void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); - void drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color); - void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); + void drawTriangle(Common::Point *p, Color color); + void drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + void drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); void drawDigit(int index, int x, int y); void drawDirection(int index, int x, int y); - void prepareAlsoDisplay(); - void drawAlsoLines(int x1, int y1, int x2, int y2, Color color); + void drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2); + void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); + void clearAlso(); + void clearTextBar(); + void setAlsoLine(int x1, int y1, int x2, int y2, Color color); byte getAlsoColor(int x1, int y1, int x2, int y2); // The caller has to .free() the returned Surfaces!!! @@ -114,6 +118,7 @@ class Graphics { AvalancheEngine *_vm; ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. + void drawText(::Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); }; } // End of namespace Avalanche diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 7beacc86b2e6..24183f8efc63 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -317,7 +317,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo } } - _vm->_graphics->drawText(_vm->_graphics->_surface, text, font, 8, x * 8, y, fontColor); + _vm->_graphics->drawNormalText(text, font, 8, x * 8, y, fontColor); // Underline the selected character. if ((trigger == 0) || !text.contains(trigger) ) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 95bf535f8cc8..b86cc636dec2 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -439,8 +439,8 @@ void Parser::plotText() { CursorMan.showMouse(false); cursorOff(); - _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. - _vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_font, 8, 24, 161, kColorWhite); + _vm->_graphics->clearTextBar(); + _vm->_graphics->drawNormalText(_inputText, _vm->_font, 8, 24, 161, kColorWhite); cursorOn(); CursorMan.showMouse(true); From ef8b661c3d80a498f0bacf0b954764084c95262b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Sep 2013 17:09:50 +0200 Subject: [PATCH 1139/1332] AVALANCHE: Partially move drawScroll to Graphics --- engines/avalanche/dialogs.cpp | 28 +--------------------------- engines/avalanche/graphics.cpp | 30 ++++++++++++++++++++++++++++++ engines/avalanche/graphics.h | 1 + 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 9367c072c28c..d2c413163b3a 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -419,34 +419,8 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { if ((1 <= _useIcon) && (_useIcon <= 34)) lx += kHalfIconWidth; - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); - CursorMan.showMouse(false); - - // The right corners of the scroll. - _vm->_graphics->drawPieSlice(mx + lx, my - ly, 0, 90, 15, kColorLightgray); - _vm->_graphics->drawPieSlice(mx + lx, my + ly, 270, 360, 15, kColorLightgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); - - // The body of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); - - // The left corners of the scroll. - _vm->_graphics->drawPieSlice(mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); - _vm->_graphics->drawPieSlice(mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); - _vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); - _vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); - - // The rear borders of the scroll. - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); - _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); + _vm->_graphics->drawScroll(mx, lx, my, ly); mx -= lx; my -= ly + 2; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 007c5101f380..1961ce9a394f 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -363,6 +363,36 @@ void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Str CursorMan.showMouse(true); } +void Graphics::drawScroll(int mx, int lx, int my, int ly) { + _scrolls.copyFrom(_surface); + + // The right corners of the scroll. + drawPieSlice(mx + lx, my - ly, 0, 90, 15, kColorLightgray); + drawPieSlice(mx + lx, my + ly, 270, 360, 15, kColorLightgray); + drawArc(_scrolls, mx + lx, my - ly, 0, 90, 15, kColorRed); + drawArc(_scrolls, mx + lx, my + ly, 270, 360, 15, kColorRed); + + // The body of the scroll. + _scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), kColorLightgray); + _scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), kColorLightgray); + _scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), kColorLightgray); + + // The left corners of the scroll. + drawPieSlice(mx - lx - 31, my - ly, 0, 180, 15, kColorDarkgray); + drawArc(_scrolls, mx - lx - 31, my - ly, 0, 180, 15, kColorRed); + _scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, kColorRed); + drawPieSlice(mx - lx - 31, my + ly, 180, 360, 15, kColorDarkgray); + drawArc(_scrolls, mx - lx - 31, my + ly, 180, 360, 15, kColorRed); + _scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, kColorRed); + + // The rear borders of the scroll. + _scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), kColorRed); + _scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); + _scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); + _scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); + +} + ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index de2723115dd2..8fdc39f34f18 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -81,6 +81,7 @@ class Graphics { void drawDirection(int index, int x, int y); void drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2); void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); + void drawScroll(int mx, int lx, int my, int ly); void clearAlso(); void clearTextBar(); void setAlsoLine(int x1, int y1, int x2, int y2, Color color); From 1af03774ccda57e153b3d3664613818645f5f4ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 11:26:21 +0200 Subject: [PATCH 1140/1332] AVALANCHE: Add some more graphic functions --- engines/avalanche/animation.cpp | 12 ++---------- engines/avalanche/graphics.cpp | 34 +++++++++++++++++++++++++-------- engines/avalanche/graphics.h | 6 ++++++ engines/avalanche/menu.cpp | 16 +++++++--------- engines/avalanche/parser.cpp | 2 +- 5 files changed, 42 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 2a309f31a948..bf97328c5a54 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -861,17 +861,9 @@ void Animation::callSpecial(uint16 which) { } void Animation::updateSpeed() { - // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. - + // Given that you've just changed the speed in _speedX, this adjusts _moveX. _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - - if (_sprites[0]._speedX == _vm->kRun) { - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); - } else { - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - } + _vm->_graphics->drawSpeedBar(_sprites[0]._speedX); } void Animation::setMoveSpeed(byte t, Direction dir) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 1961ce9a394f..2d0a45eaa027 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -48,6 +48,7 @@ Graphics::~Graphics() { _background.free(); _screen.free(); _scrolls.free(); + _backup.free(); for (int i = 0; i < 10; i++) _digits[i].free(); @@ -363,6 +364,15 @@ void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Str CursorMan.showMouse(true); } +void Graphics::drawSpeedBar(int speed) { + if (speed == _vm->kRun) { + _surface.drawLine(336, 199, 338, 199, kColorLightblue); + _surface.drawLine(371, 199, 373, 199, kColorYellow); + } else { + _surface.drawLine(371, 199, 373, 199, kColorLightblue); + _surface.drawLine(336, 199, 338, 199, kColorYellow); + } +} void Graphics::drawScroll(int mx, int lx, int my, int ly) { _scrolls.copyFrom(_surface); @@ -390,7 +400,6 @@ void Graphics::drawScroll(int mx, int lx, int my, int ly) { _scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), kColorRed); _scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); _scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); - } ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { @@ -523,9 +532,7 @@ void Graphics::refreshBackground() { void Graphics::zoomOut(int16 x, int16 y) { //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! - ::Graphics::Surface backup; - backup.copyFrom(_surface); - + saveScreen(); for (byte i = 1; i <= 20; i ++) { int16 x1 = x - (x / 20) * i; int16 y1 = y - ((y - 10) / 20) * i; @@ -535,11 +542,10 @@ void Graphics::zoomOut(int16 x, int16 y) { _surface.frameRect(Common::Rect(x1, y1, x2, y2), kColorWhite); refreshScreen(); _vm->_system->delayMillis(17); - _surface.copyFrom(backup); - refreshScreen(); - } - backup.free(); + restoreScreen(); + } + removeBackup(); } // Original name background() @@ -547,4 +553,16 @@ void Graphics::setBackgroundColor(Color x) { warning("STUB: setBackgroundColor(%d)", x); } +void Graphics::saveScreen() { + _backup.copyFrom(_surface); +} + +void Graphics::removeBackup() { + _backup.free(); +} + +void Graphics::restoreScreen() { + _surface.copyFrom(_backup); + refreshScreen(); +} } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 8fdc39f34f18..c6f1f6059e5c 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -82,6 +82,8 @@ class Graphics { void drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2); void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); void drawScroll(int mx, int lx, int my, int ly); + void drawSpeedBar(int speed); + void clearAlso(); void clearTextBar(); void setAlsoLine(int x1, int y1, int x2, int y2, Color color); @@ -104,6 +106,9 @@ class Graphics { void zoomOut(int16 x, int16 y); // Only used when entering the map. + void saveScreen(); + void removeBackup(); + void restoreScreen(); private: static const uint16 kBackgroundWidth = kScreenWidth; static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. @@ -114,6 +119,7 @@ class Graphics { ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) + ::Graphics::Surface _backup; byte _egaPalette[64][3]; AvalancheEngine *_vm; diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 24183f8efc63..8d9d105befb0 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -683,10 +683,9 @@ void Menu::setup() { } void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... - Common::Point cursorPos = _vm->getMousePos(); - ::Graphics::Surface backup; - backup.copyFrom(_vm->_graphics->_surface); + _vm->_graphics->saveScreen(); + Common::Point cursorPos = _vm->getMousePos(); while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_holdLeftMouse) { _menuBar.chooseMenuItem(cursorPos.x); do @@ -723,7 +722,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); _vm->_holdLeftMouse = false; - backup.free(); + _vm->_graphics->removeBackup(); return; } // No "else"- clicking on menu has no effect (only releasing). } @@ -731,13 +730,12 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... // Clicked on menu bar. if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); - _vm->_graphics->_surface.copyFrom(backup); - _vm->_graphics->refreshScreen(); + _vm->_graphics->restoreScreen(); if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_holdLeftMouse = false; - backup.free(); + _vm->_graphics->removeBackup(); return; } else { _vm->_holdLeftMouse = true; @@ -764,7 +762,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... uint16 which = (cursorPos.y - 26) / 20; _activeMenuItem.select(which); if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing. - backup.free(); + _vm->_graphics->removeBackup(); return; } } @@ -772,7 +770,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... } } - backup.free(); + _vm->_graphics->removeBackup(); } bool Menu::isActive() { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index b86cc636dec2..8d0199680072 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -481,7 +481,7 @@ void Parser::wipeText() { CursorMan.showMouse(false); cursorOff(); - _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. + _vm->_graphics->clearTextBar(); _quote = true; _inputTextPos = 0; From ffbe4646c16b7620040c6b63d20779d5fa50bd6b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 12:13:06 +0200 Subject: [PATCH 1141/1332] AVALANCHE: move some more functions to Graphics --- engines/avalanche/dialogs.cpp | 53 ++++++++++------------------------ engines/avalanche/graphics.cpp | 49 +++++++++++++++++++++++++++---- engines/avalanche/graphics.h | 6 ++++ engines/avalanche/parser.cpp | 10 ++----- engines/avalanche/parser.h | 1 - 5 files changed, 67 insertions(+), 52 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index d2c413163b3a..9868c772e1fb 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -65,9 +65,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever warning("STUB: Scrolls::state()"); CursorMan.showMouse(false); - - _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); - + _vm->_graphics->drawReadyLight(color); CursorMan.showMouse(true); _vm->_ledStatus = state; } @@ -117,9 +115,8 @@ void Dialogs::scrollModeNormal() { _vm->_seeScroll = true; _vm->_graphics->loadMouse(kCurFletch); - ::Graphics::Surface temp; - temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + _vm->_graphics->saveScreen(); + _vm->_graphics->showScroll(); Common::Event event; while (!_vm->shouldQuit()) { @@ -134,8 +131,8 @@ void Dialogs::scrollModeNormal() { break; } - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); + _vm->_graphics->restoreScreen(); + _vm->_graphics->removeBackup(); warning("STUB: scrollModeNormal() - Check Easter Egg trigger"); #if 0 @@ -184,9 +181,8 @@ void Dialogs::scrollModeDialogue() { _vm->_graphics->loadMouse(kCurHand); - ::Graphics::Surface temp; - temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + _vm->_graphics->saveScreen(); + _vm->_graphics->showScroll(); Common::Event event; while (!_vm->shouldQuit()) { @@ -206,8 +202,8 @@ void Dialogs::scrollModeDialogue() { } } - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); + _vm->_graphics->restoreScreen(); + _vm->_graphics->removeBackup(); } void Dialogs::store(byte what, TuneType &played) { @@ -239,9 +235,8 @@ void Dialogs::scrollModeMusic() { _vm->_seeScroll = true; - ::Graphics::Surface temp; - temp.copyFrom(_vm->_graphics->_surface); - _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!! + _vm->_graphics->saveScreen(); + _vm->_graphics->showScroll(); Common::Event event; while (!_vm->shouldQuit()) { @@ -328,8 +323,9 @@ void Dialogs::scrollModeMusic() { } } - _vm->_graphics->_surface.copyFrom(temp); - temp.free(); + _vm->_graphics->restoreScreen(); + _vm->_graphics->removeBackup(); + _vm->_seeScroll = false; CursorMan.showMouse(true); } @@ -512,6 +508,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { if ((_vm->_talkX + xw) > 639) xc = 639 - (_vm->_talkX + xw); + // Compute triangle coords for the tail of the bubble points[0].x = _vm->_talkX - 10; points[0].y = yw; points[1].x = _vm->_talkX + 10; @@ -519,25 +516,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { points[2].x = _vm->_talkX; points[2].y = _vm->_talkY; - // Backup the screen before drawing the bubble. - _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); - - // The body of the bubble. - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); - _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); - - // Top right corner of the bubble. - _vm->_graphics->drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); - // Bottom right corner of the bubble. - _vm->_graphics->drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); - // Top left corner of the bubble. - _vm->_graphics->drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); - // Bottom left corner of the bubble. - _vm->_graphics->drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); - - // "Tail" of the speech bubble. - _vm->_graphics->drawTriangle(points, _vm->_talkBackgroundColor); - + _vm->_graphics->prepareBubble(xc, xw, my, points); // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 2d0a45eaa027..f39cd6acc327 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -325,11 +325,11 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String text, } void Graphics::drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { - _vm->_graphics->drawText(_surface, text, font, fontHeight, x, y, color); + drawText(_surface, text, font, fontHeight, x, y, color); } void Graphics::drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { - _vm->_graphics->drawText(_scrolls, text, font, fontHeight, x, y, color); + drawText(_scrolls, text, font, fontHeight, x, y, color); } void Graphics::drawDigit(int index, int x, int y) { @@ -467,7 +467,7 @@ byte Graphics::getAlsoColor(int x1, int y1, int x2, int y2) { byte returnColor = 0; for (int16 i = x1; i <= x2; i++) { for (int16 j = y1; j <= y2; j++) { - byte actColor = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); + byte actColor = *(byte *)_magics.getBasePtr(i, j); returnColor = MAX(returnColor, actColor); } } @@ -508,6 +508,38 @@ void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surfac } } +void Graphics::drawCursor(byte pos) { + int pixPos = 24 + (pos * 8); + // Draw the '_' character. + for (int i = 0; i < 8; i++) + *(byte *)_surface.getBasePtr(pixPos + i, 168) = kColorWhite; +} + +void Graphics::drawReadyLight(Color color) { + _surface.fillRect(Common::Rect(419, 195, 438, 197), color); +} + +void Graphics::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { + // Backup the screen before drawing the bubble. + _scrolls.copyFrom(_surface); + + // The body of the bubble. + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); + + // Top right corner of the bubble. + drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); + // Bottom right corner of the bubble. + drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); + // Top left corner of the bubble. + drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); + // Bottom left corner of the bubble. + drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); + + // "Tail" of the speech bubble. + drawTriangle(points, _vm->_talkBackgroundColor); +} + void Graphics::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { @@ -548,9 +580,8 @@ void Graphics::zoomOut(int16 x, int16 y) { removeBackup(); } -// Original name background() -void Graphics::setBackgroundColor(Color x) { - warning("STUB: setBackgroundColor(%d)", x); +void Graphics::showScroll() { + _surface.copyFrom(_scrolls); // TODO: Rework it using getSubArea !!!!!!! } void Graphics::saveScreen() { @@ -565,4 +596,10 @@ void Graphics::restoreScreen() { _surface.copyFrom(_backup); refreshScreen(); } + +// Original name background() +void Graphics::setBackgroundColor(Color x) { + warning("STUB: setBackgroundColor(%d)", x); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c6f1f6059e5c..fbedf4c4d8fc 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -98,6 +98,10 @@ class Graphics { void drawThinkPic(Common::String filename, int id); void drawToolbar(); + void drawCursor(byte pos); + void drawReadyLight(Color color); + + void prepareBubble(int xc, int xw, int my, Common::Point points[3]); void refreshScreen(); void loadBackground(Common::File &file); @@ -106,6 +110,8 @@ class Graphics { void zoomOut(int16 x, int16 y); // Only used when entering the map. + void showScroll(); + void saveScreen(); void removeBackup(); void restoreScreen(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 8d0199680072..f2bea80c2617 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -449,14 +449,14 @@ void Parser::plotText() { void Parser::cursorOn() { if (_cursorState == true) return; - drawCursor(); + _vm->_graphics->drawCursor(_inputTextPos); _cursorState = true; } void Parser::cursorOff() { if (_cursorState == false) return; - drawCursor(); + _vm->_graphics->drawCursor(_inputTextPos); _cursorState = false; } @@ -471,12 +471,6 @@ int16 Parser::getPos(const Common::String &crit, const Common::String &src) { return -1; } -void Parser::drawCursor() { - // Draw the '_' character. - for (int bit = 0; bit < 8; bit++) - *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; -} - void Parser::wipeText() { CursorMan.showMouse(false); cursorOff(); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 4d5889388c9f..f7d3eb1d3ccd 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -147,7 +147,6 @@ class Parser { Common::String personSpeaks(); void heyThanks(); - void drawCursor(); void wipeText(); }; From 063bc8d8c95e74732e1b78f2dc62f36b43e03fc1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 12:14:15 +0200 Subject: [PATCH 1142/1332] AVALANCHE: Scrolls is now set to private --- engines/avalanche/graphics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index fbedf4c4d8fc..c05f809783a2 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -58,7 +58,6 @@ class Graphics { public: ::Graphics::Surface _surface; ::Graphics::Surface _background; - ::Graphics::Surface _scrolls; Graphics(AvalancheEngine *vm); ~Graphics(); @@ -125,6 +124,7 @@ class Graphics { ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) + ::Graphics::Surface _scrolls; ::Graphics::Surface _backup; byte _egaPalette[64][3]; From de12f46db5d636c005118db2743bbb7b8a8e6287 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 17:54:03 +0200 Subject: [PATCH 1143/1332] AVALANCHE: Rename Graphics to avoid confusion, add drawBackgroundSprite(), set _background private --- engines/avalanche/avalanche.cpp | 6 +- engines/avalanche/avalanche.h | 2 +- engines/avalanche/background.cpp | 4 +- engines/avalanche/background.h | 20 +++--- engines/avalanche/detection.cpp | 2 +- engines/avalanche/graphics.cpp | 112 ++++++++++++++++--------------- engines/avalanche/graphics.h | 34 +++++----- 7 files changed, 93 insertions(+), 87 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 729bb8bdc55a..617d23cd19e8 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -91,7 +91,7 @@ AvalancheEngine::~AvalancheEngine() { } Common::ErrorCode AvalancheEngine::initialize() { - _graphics = new Graphics(this); + _graphics = new GraphicManager(this); _parser = new Parser(this); _clock = new Clock(this); @@ -299,7 +299,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { f->writeUint32LE(desc.size()); f->write(desc.c_str(), desc.size()); - ::Graphics::saveThumbnail(*f); + Graphics::saveThumbnail(*f); TimeDate t; _system->getTimeAndDate(t); @@ -359,7 +359,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { } description.toUppercase(); - ::Graphics::skipThumbnail(*f); + Graphics::skipThumbnail(*f); // Read the time the game was saved. TimeDate t; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index ae490e005677..69fba35e25ee 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -71,7 +71,7 @@ class AvalancheEngine : public Engine { byte _saveNum; // number of times this game has been saved Clock *_clock; - Graphics *_graphics; + GraphicManager *_graphics; Parser *_parser; Pingo *_pingo; Dialogs *_dialogs; diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index c4abc660decd..3f2c812ed6ce 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -295,7 +295,7 @@ void Background::load(byte number) { if (natural) { _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back. _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; - _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); + _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, Graphics::PixelFormat::createFormatCLUT8()); for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) @@ -373,7 +373,7 @@ void Background::drawSprite(int16 x, int16 y, SpriteType &sprite) { } // These pictures are practically parts of the background. -10 is for the drop-down menu. - _vm->_graphics->drawPicture(_vm->_graphics->_background, sprite._picture, x, y - 10); + _vm->_graphics->drawBackgroundSprite(x, y - 10, sprite); } } // End of namespace Avalanche. diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 8d88cb36a436..1ce70e858c12 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -39,6 +39,16 @@ namespace Avalanche { class AvalancheEngine; +enum PictureType {kEga, kBgi, kNaturalImage}; + +struct SpriteType { + PictureType _type; + int16 _x, _y; + int16 _xl, _yl; + int32 _size; + Graphics::Surface _picture; +}; + class Background { public: Background(AvalancheEngine *vm); @@ -54,16 +64,6 @@ class Background { void draw(int16 destX, int16 destY, byte sprId); private: - enum PictureType {kEga, kBgi, kNaturalImage}; - - struct SpriteType { - PictureType _type; - int16 _x, _y; - int16 _xl, _yl; - int32 _size; - ::Graphics::Surface _picture; - }; - AvalancheEngine *_vm; int32 _offsets[40]; diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 1b243d2845c4..8afd8e58f4b7 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -204,7 +204,7 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, SaveStateDescriptor desc(slot, description); - ::Graphics::Surface *const thumbnail = ::Graphics::loadThumbnail(*f); + Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*f); desc.setThumbnail(thumbnail); delete f; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index f39cd6acc327..61cb40a11afe 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -36,13 +36,13 @@ namespace Avalanche { -const byte Graphics::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; +const byte GraphicManager::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; -Graphics::Graphics(AvalancheEngine *vm) { +GraphicManager::GraphicManager(AvalancheEngine *vm) { _vm = vm; } -Graphics::~Graphics() { +GraphicManager::~GraphicManager() { _surface.free(); _magics.free(); _background.free(); @@ -56,7 +56,7 @@ Graphics::~Graphics() { _directions[i].free(); } -void Graphics::init() { +void GraphicManager::init() { initGraphics(kScreenWidth, kScreenHeight * 2, true); // Doubling the height. for (int i = 0; i < 64; ++i) { @@ -68,13 +68,13 @@ void Graphics::init() { for (int i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); - _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - _screen.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8()); - _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); + _surface.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); + _magics.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); + _screen.create(kScreenWidth, kScreenHeight * 2, Graphics::PixelFormat::createFormatCLUT8()); + _scrolls.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); } -void Graphics::loadDigits(Common::File &file) { // Load the scoring digits & rwlites +void GraphicManager::loadDigits(Common::File &file) { // Load the scoring digits & rwlites const byte digitsize = 134; const byte rwlitesize = 126; @@ -94,7 +94,7 @@ void Graphics::loadDigits(Common::File &file) { // Load the scoring digits & r file.close(); } -void Graphics::loadMouse(byte which) { +void GraphicManager::loadMouse(byte which) { if (which == _vm->_currentMouse) return; @@ -104,15 +104,15 @@ void Graphics::loadMouse(byte which) { if (!f.open("mice.avd")) error("AVALANCHE: Gyro: File not found: mice.avd"); - ::Graphics::Surface cursor; - cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8()); + Graphics::Surface cursor; + cursor.create(16, 32, Graphics::PixelFormat::createFormatCLUT8()); cursor.fillRect(Common::Rect(0, 0, 16, 32), 255); // The AND mask. f.seek(kMouseSize * 2 * which + 134); - ::Graphics::Surface mask = loadPictureGraphic(f); + Graphics::Surface mask = loadPictureGraphic(f); for (int j = 0; j < mask.h; j++) { for (int i = 0; i < mask.w; i++) { @@ -148,21 +148,21 @@ void Graphics::loadMouse(byte which) { cursor.free(); } -void Graphics::drawThinkPic(Common::String filename, int id) { +void GraphicManager::drawThinkPic(Common::String filename, int id) { static const int16 kPicSize = 966; Common::File file; if (!file.open(filename)) error("drawThinkPic(): File not found: %s", filename.c_str()); file.seek(id * kPicSize + 65); - ::Graphics::Surface picture = loadPictureGraphic(file); + Graphics::Surface picture = loadPictureGraphic(file); drawPicture(_surface, picture, 205, 170); picture.free(); file.close(); } -void Graphics::drawToolbar() { +void GraphicManager::drawToolbar() { Common::File file; if (!file.open("useful.avd")) error("drawToolbar(): File not found: useful.avd"); @@ -170,7 +170,7 @@ void Graphics::drawToolbar() { file.seek(40); CursorMan.showMouse(false); - ::Graphics::Surface picture = loadPictureGraphic(file); + Graphics::Surface picture = loadPictureGraphic(file); drawPicture(_surface, picture, 5, 169); CursorMan.showMouse(true); @@ -178,12 +178,12 @@ void Graphics::drawToolbar() { file.close(); } -void Graphics::fleshColors() { +void GraphicManager::fleshColors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); } -Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { +Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { Common::Point endPoint; const double pi = 3.14; const double convfac = pi / 180.0; @@ -269,12 +269,12 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, return endPoint; } -void Graphics::drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { +void GraphicManager::drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { while (radius > 0) drawArc(_scrolls, x, y, stAngle, endAngle, radius--, color); } -void Graphics::drawTriangle(Common::Point *p, Color color) { +void GraphicManager::drawTriangle(Common::Point *p, Color color) { // Draw the borders with a marking color. _scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255); _scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255); @@ -311,7 +311,7 @@ void Graphics::drawTriangle(Common::Point *p, Color color) { _scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color); } -void Graphics::drawText(::Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { +void GraphicManager::drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { for (uint i = 0; i < text.size(); i++) { for (int j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; @@ -324,23 +324,23 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String text, } } -void Graphics::drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { +void GraphicManager::drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { drawText(_surface, text, font, fontHeight, x, y, color); } -void Graphics::drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { +void GraphicManager::drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) { drawText(_scrolls, text, font, fontHeight, x, y, color); } -void Graphics::drawDigit(int index, int x, int y) { +void GraphicManager::drawDigit(int index, int x, int y) { drawPicture(_surface, _digits[index], x, y); } -void Graphics::drawDirection(int index, int x, int y) { +void GraphicManager::drawDirection(int index, int x, int y) { drawPicture(_surface, _directions[index], x, y); } -void Graphics::drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2) { +void GraphicManager::drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2) { for (byte i = 0; i < 2; i ++) { _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite); _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite); @@ -350,7 +350,7 @@ void Graphics::drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2) { } } -void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) { +void GraphicManager::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) { CursorMan.showMouse(false); drawScrollShadow(x1, y1, x2, y2); @@ -364,7 +364,7 @@ void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::Str CursorMan.showMouse(true); } -void Graphics::drawSpeedBar(int speed) { +void GraphicManager::drawSpeedBar(int speed) { if (speed == _vm->kRun) { _surface.drawLine(336, 199, 338, 199, kColorLightblue); _surface.drawLine(371, 199, 373, 199, kColorYellow); @@ -373,7 +373,7 @@ void Graphics::drawSpeedBar(int speed) { _surface.drawLine(336, 199, 338, 199, kColorYellow); } } -void Graphics::drawScroll(int mx, int lx, int my, int ly) { +void GraphicManager::drawScroll(int mx, int lx, int my, int ly) { _scrolls.copyFrom(_surface); // The right corners of the scroll. @@ -402,14 +402,18 @@ void Graphics::drawScroll(int mx, int lx, int my, int ly) { _scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); } -::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { +void GraphicManager::drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite) { + drawPicture(_background, sprite._picture, x, y); +} + +Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 width = file.readUint16LE() + 1; uint16 height = file.readUint16LE() + 1; - ::Graphics::Surface picture; // We make a Surface object for the picture itself. - picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); + Graphics::Surface picture; // We make a Surface object for the picture itself. + picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. for (int y = 0; y < height; y++) { @@ -427,13 +431,13 @@ ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { return picture; } -::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, uint16 height) { +Graphics::Surface GraphicManager::loadPictureRow(Common::File &file, uint16 width, uint16 height) { // This function is our own creation, very much like the one above. The main differences are that // we don't read the width and the height from the file, the planes are in a different order // and we read the picture plane-by-plane. - ::Graphics::Surface picture; - picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); + Graphics::Surface picture; + picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); for (int plane = 0; plane < 4; plane++) { for (uint16 y = 0; y < height; y++) { @@ -450,20 +454,20 @@ ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, u return picture; } -void Graphics::clearAlso() { +void GraphicManager::clearAlso() { _magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _magics.frameRect(Common::Rect(0, 45, 640, 161), 15); } -void Graphics::clearTextBar() { +void GraphicManager::clearTextBar() { _surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. } -void Graphics::setAlsoLine(int x1, int y1, int x2, int y2, Color color) { +void GraphicManager::setAlsoLine(int x1, int y1, int x2, int y2, Color color) { _magics.drawLine(x1, y1, x2, y2, color); } -byte Graphics::getAlsoColor(int x1, int y1, int x2, int y2) { +byte GraphicManager::getAlsoColor(int x1, int y1, int x2, int y2) { byte returnColor = 0; for (int16 i = x1; i <= x2; i++) { for (int16 j = y1; j <= y2; j++) { @@ -475,7 +479,7 @@ byte Graphics::getAlsoColor(int x1, int y1, int x2, int y2) { return returnColor; } -void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { +void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the sprite blank. for (int j = 0; j < sprite._yLength; j++) { for (int i = 0; i < sprite._xLength; i++) { @@ -500,7 +504,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } } -void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { +void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { for (uint16 x = 0; x < picture.w; x++) @@ -508,18 +512,18 @@ void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surfac } } -void Graphics::drawCursor(byte pos) { +void GraphicManager::drawCursor(byte pos) { int pixPos = 24 + (pos * 8); // Draw the '_' character. for (int i = 0; i < 8; i++) *(byte *)_surface.getBasePtr(pixPos + i, 168) = kColorWhite; } -void Graphics::drawReadyLight(Color color) { +void GraphicManager::drawReadyLight(Color color) { _surface.fillRect(Common::Rect(419, 195, 438, 197), color); } -void Graphics::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { +void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { // Backup the screen before drawing the bubble. _scrolls.copyFrom(_surface); @@ -540,7 +544,7 @@ void Graphics::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { drawTriangle(points, _vm->_talkBackgroundColor); } -void Graphics::refreshScreen() { +void GraphicManager::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { for (uint16 x = 0; x < _screen.w; x++) { @@ -553,15 +557,15 @@ void Graphics::refreshScreen() { g_system->updateScreen(); } -void Graphics::loadBackground(Common::File &file) { +void GraphicManager::loadBackground(Common::File &file) { _background = loadPictureRow(file, kBackgroundWidth, kBackgroundHeight); } -void Graphics::refreshBackground() { +void GraphicManager::refreshBackground() { drawPicture(_surface, _background, 0, 10); } -void Graphics::zoomOut(int16 x, int16 y) { +void GraphicManager::zoomOut(int16 x, int16 y) { //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! saveScreen(); @@ -580,25 +584,25 @@ void Graphics::zoomOut(int16 x, int16 y) { removeBackup(); } -void Graphics::showScroll() { +void GraphicManager::showScroll() { _surface.copyFrom(_scrolls); // TODO: Rework it using getSubArea !!!!!!! } -void Graphics::saveScreen() { +void GraphicManager::saveScreen() { _backup.copyFrom(_surface); } -void Graphics::removeBackup() { +void GraphicManager::removeBackup() { _backup.free(); } -void Graphics::restoreScreen() { +void GraphicManager::restoreScreen() { _surface.copyFrom(_backup); refreshScreen(); } // Original name background() -void Graphics::setBackgroundColor(Color x) { +void GraphicManager::setBackgroundColor(Color x) { warning("STUB: setBackgroundColor(%d)", x); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c05f809783a2..5c5f91d7f53e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -36,6 +36,7 @@ namespace Avalanche { class AvalancheEngine; +struct SpriteType; typedef byte FontType[256][16]; @@ -54,13 +55,12 @@ class SpriteInfo { uint16 _size; // The size of one picture. }; -class Graphics { +class GraphicManager { public: - ::Graphics::Surface _surface; - ::Graphics::Surface _background; + Graphics::Surface _surface; - Graphics(AvalancheEngine *vm); - ~Graphics(); + GraphicManager(AvalancheEngine *vm); + ~GraphicManager(); void init(); void loadDigits(Common::File &file); // Load the scoring digits & rwlites void loadMouse(byte which); @@ -70,7 +70,7 @@ class Graphics { // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Clock.) // TODO: Make it more accurate later. - Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); + Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(Common::Point *p, Color color); @@ -82,6 +82,7 @@ class Graphics { void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); void drawScroll(int mx, int lx, int my, int ly); void drawSpeedBar(int speed); + void drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite); void clearAlso(); void clearTextBar(); @@ -90,10 +91,10 @@ class Graphics { // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data - ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. + Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. + void drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. void drawThinkPic(Common::String filename, int id); void drawToolbar(); @@ -120,18 +121,19 @@ class Graphics { // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). static const byte kEgaPaletteIndex[16]; - ::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also - ::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! - ::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. - ::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) - ::Graphics::Surface _scrolls; - ::Graphics::Surface _backup; + Graphics::Surface _background; + Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also + Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! + Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) + Graphics::Surface _scrolls; + Graphics::Surface _backup; byte _egaPalette[64][3]; AvalancheEngine *_vm; - ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. - void drawText(::Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. + void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); }; } // End of namespace Avalanche From 6b41b38049d4a7450f0b4a2c6e71c1ba22f8cb70 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 19:03:52 +0200 Subject: [PATCH 1144/1332] AVALANCHE: Move code from Menu to Graphics --- engines/avalanche/graphics.cpp | 22 ++++++++++++++++++++++ engines/avalanche/graphics.h | 4 ++++ engines/avalanche/menu.cpp | 28 +++++++++++----------------- engines/avalanche/menu.h | 5 ++--- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 61cb40a11afe..77113ee54b74 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -364,6 +364,14 @@ void GraphicManager::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Commo CursorMan.showMouse(true); } +void GraphicManager::drawMenuBar(Color color) { + _surface.fillRect(Common::Rect(0, 0, 640, 10), color); +} + +void GraphicManager::drawMenuBlock(int x1, int y1, int x2, int y2, Color color) { + _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); +} + void GraphicManager::drawSpeedBar(int speed) { if (speed == _vm->kRun) { _surface.drawLine(336, 199, 338, 199, kColorLightblue); @@ -544,6 +552,20 @@ void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[ drawTriangle(points, _vm->_talkBackgroundColor); } +// And set the background of the text to the desired color. +void GraphicManager::wipeChar(int x, int y, Color color) { + for (int k = 0; k < 8; k++) + *(byte *)_surface.getBasePtr(x + k, y) = color; +} + +void GraphicManager::drawChar(byte ander, int x, int y, Color color) { + byte pixel = ander; + for (int bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit) + *(byte *)_surface.getBasePtr(x + 7 - bit, y) = color; + } +} void GraphicManager::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 5c5f91d7f53e..383370d87b0d 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -81,8 +81,12 @@ class GraphicManager { void drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2); void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text); void drawScroll(int mx, int lx, int my, int ly); + void drawMenuBar(Color color); void drawSpeedBar(int speed); void drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite); + void drawMenuBlock(int x1, int y1, int x2, int y2, Color color); + void wipeChar(int x, int y, Color color); + void drawChar(byte ander, int x, int y, Color color); void clearAlso(); void clearTextBar(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 8d9d105befb0..21ed2d581383 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -103,18 +103,18 @@ void MenuItem::setupOption(Common::String title, char trigger, Common::String sh } void MenuItem::displayOption(byte y, bool highlit) { + Common::String text = _options[y]._title; + while (text.size() + _options[y]._shortcut.size() < _width) + text += ' '; // Pad _options[y] with spaces. + text += _options[y]._shortcut; + Color backgroundColor; if (highlit) backgroundColor = kColorBlack; else backgroundColor = kColorLightgray; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10), backgroundColor); - - Common::String text = _options[y]._title; - while (text.size() + _options[y]._shortcut.size() < _width) - text += ' '; // Pad _options[y] with spaces. - text += _options[y]._shortcut; + _dr->_vm->_graphics->drawMenuBlock((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10, backgroundColor); _dr->drawMenuText(_left, 4 + (y + 1) * 10, _options[y]._trigger, text, _options[y]._valid, highlit); } @@ -128,8 +128,8 @@ void MenuItem::display() { _activeNow = true; _dr->_menuActive = true; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), _dr->kMenuBackgroundColor); - _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), _dr->kMenuBorderColor); + _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), kMenuBackgroundColor); + _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), kMenuBorderColor); displayOption(0, true); for (int y = 1; y < _optionNum; y++) @@ -216,7 +216,7 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu } void MenuBar::draw() { - _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); + _dr->_vm->_graphics->drawMenuBar(kMenuBackgroundColor); byte savecp = _dr->_vm->_cp; _dr->_vm->_cp = 3; @@ -312,8 +312,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo byte idx = text[i]; font[idx][j] = _vm->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. - for (int k = 0; k < 8; k++) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; + _vm->_graphics->wipeChar(x * 8 + i * 8, y + j, backgroundColor); } } @@ -327,12 +326,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo for (i = 0; text[i] != trigger; i++) ; // Search for the character in the string. - byte pixel = ander; - for (int bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - if (pixelBit) - *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; - } + _vm->_graphics->drawChar(ander, x * 8 + i * 8, y + 8, fontColor); } _vm->_graphics->refreshScreen(); diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 815ff230e996..eb357f597dc5 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -39,6 +39,8 @@ class AvalancheEngine; class Menu; typedef void (Menu::*MenuFunc)(); +static const Color kMenuBackgroundColor = kColorLightgray; +static const Color kMenuBorderColor = kColorBlack; class HeadType { public: @@ -131,9 +133,6 @@ class Menu { static const byte kIndent = 5; static const byte kSpacing = 10; - static const Color kMenuBackgroundColor = kColorLightgray; - static const Color kMenuBorderColor = kColorBlack; - // Checkme: Useless constants? // static const Color kMenuFontColor = kColorBlack; // static const Color kHighlightBackgroundColor = kColorBlack; From 1c9ac623fa6ccd3f28095b9a8763ce79cb1ac358 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 19:49:57 +0200 Subject: [PATCH 1145/1332] AVALANCHE: Rework calcHand, move another function to Graphics --- engines/avalanche/avalot.cpp | 17 ++++++++--------- engines/avalanche/avalot.h | 2 +- engines/avalanche/graphics.cpp | 9 +++++++++ engines/avalanche/graphics.h | 2 ++ engines/avalanche/menu.cpp | 3 +-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6622a8d4e875..c73208ca61db 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,13 +201,12 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so _oldMinute = _minute; } -void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color) { +Common::Point Clock::calcHand(uint16 angle, uint16 length, Color color) { if (angle > 900) { - endPoint.x = 177; - return; + return(Common::Point(177, 177)); } - endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); + return(_vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color)); } void Clock::drawHand(const Common::Point &endPoint, Color color) { @@ -218,13 +217,13 @@ void Clock::drawHand(const Common::Point &endPoint, Color color) { } void Clock::plotHands() { - calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); - calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); + _clockHandHour = calcHand(_oldHourAngle, 14, kColorYellow); + _clockHandMinute = calcHand(_oldMinute * 6, 17, kColorYellow); drawHand(_clockHandHour, kColorBrown); drawHand(_clockHandMinute, kColorBrown); - calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); - calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); + _clockHandHour = calcHand(_hourAngle, 14, kColorBrown); + _clockHandMinute = calcHand(_minute * 6, 17, kColorBrown); drawHand(_clockHandHour, kColorYellow); drawHand(_clockHandMinute, kColorYellow); } @@ -1142,7 +1141,7 @@ void AvalancheEngine::incScore(byte num) { } void AvalancheEngine::useCompass(const Common::Point &cursorPos) { - byte color = *(byte *)_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); + byte color = _graphics->getScreenColor(cursorPos); switch (color) { case kColorGreen: diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 189b9cb48874..6c5ef3155bdf 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -57,7 +57,7 @@ class Clock { uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; Common::Point _clockHandHour, _clockHandMinute; - void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color); + Common::Point calcHand(uint16 angle, uint16 length, Color color); void drawHand(const Common::Point &endPoint, Color color); void plotHands(); void chime(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 77113ee54b74..c4846d573c26 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -372,6 +372,11 @@ void GraphicManager::drawMenuBlock(int x1, int y1, int x2, int y2, Color color) _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } +void GraphicManager::drawMenuItem(int x1, int y1, int x2, int y2) { + _surface.fillRect(Common::Rect(x1, y1, x2, y2), kMenuBackgroundColor); + _surface.frameRect(Common::Rect(x1 - 1, y1 - 1, x2 + 1, y2 + 1), kMenuBorderColor); +} + void GraphicManager::drawSpeedBar(int speed) { if (speed == _vm->kRun) { _surface.drawLine(336, 199, 338, 199, kColorLightblue); @@ -487,6 +492,10 @@ byte GraphicManager::getAlsoColor(int x1, int y1, int x2, int y2) { return returnColor; } +byte GraphicManager::getScreenColor(Common::Point pos) { + return *(byte *)_surface.getBasePtr(pos.x, pos.y / 2); +} + void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the sprite blank. for (int j = 0; j < sprite._yLength; j++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 383370d87b0d..7af1f8a8b089 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -85,6 +85,7 @@ class GraphicManager { void drawSpeedBar(int speed); void drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite); void drawMenuBlock(int x1, int y1, int x2, int y2, Color color); + void drawMenuItem(int x1, int y1, int x2, int y2); void wipeChar(int x, int y, Color color); void drawChar(byte ander, int x, int y, Color color); @@ -92,6 +93,7 @@ class GraphicManager { void clearTextBar(); void setAlsoLine(int x1, int y1, int x2, int y2, Color color); byte getAlsoColor(int x1, int y1, int x2, int y2); + byte getScreenColor(Common::Point pos); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 21ed2d581383..f1c638913e0e 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -128,8 +128,7 @@ void MenuItem::display() { _activeNow = true; _dr->_menuActive = true; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), kMenuBackgroundColor); - _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), kMenuBorderColor); + _dr->_vm->_graphics->drawMenuItem((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly); displayOption(0, true); for (int y = 1; y < _optionNum; y++) From 4464409d7378d82f255ff04c7d22c7b802d4b511 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 21:28:43 +0200 Subject: [PATCH 1146/1332] AVALANCHE: Set drawArc private --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/graphics.cpp | 4 ++++ engines/avalanche/graphics.h | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index c73208ca61db..10b4dfcdbd96 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -206,7 +206,7 @@ Common::Point Clock::calcHand(uint16 angle, uint16 length, Color color) { return(Common::Point(177, 177)); } - return(_vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color)); + return(_vm->_graphics->drawScreenArc(kCenterX, kCenterY, 449 - angle, 450 - angle, length, color)); } void Clock::drawHand(const Common::Point &endPoint, Color color) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index c4846d573c26..9fb9ec17d259 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -269,6 +269,10 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 return endPoint; } +Common::Point GraphicManager::drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { + return drawArc(_surface, x, y, stAngle, endAngle, radius, color); +} + void GraphicManager::drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { while (radius > 0) drawArc(_scrolls, x, y, stAngle, endAngle, radius--, color); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 7af1f8a8b089..100a5dad72c8 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -67,11 +67,7 @@ class GraphicManager { void fleshColors(); - // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. - // Returns the end point of the arc. (Needed in Clock.) - // TODO: Make it more accurate later. - Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); - + Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(Common::Point *p, Color color); void drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); @@ -140,6 +136,10 @@ class GraphicManager { Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. + // Returns the end point of the arc. (Needed in Clock.) + // TODO: Make it more accurate later. + Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); }; } // End of namespace Avalanche From bea6980529daed3ba02f02cacd459df61c463d0b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 22:19:12 +0200 Subject: [PATCH 1147/1332] AVALANCHE: Move debug display of magic lines to debugger --- engines/avalanche/avalanche.cpp | 8 +++++++- engines/avalanche/avalanche.h | 3 ++- engines/avalanche/avalot.cpp | 14 +------------- engines/avalanche/console.cpp | 21 ++++++++++++++++++--- engines/avalanche/console.h | 19 +++++++++++-------- engines/avalanche/graphics.cpp | 16 ++++++++++++++++ engines/avalanche/graphics.h | 1 + 7 files changed, 56 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 617d23cd19e8..0a4e7b1c03f6 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * } _totalTime = 0; + _showDebugLines = false; } AvalancheEngine::~AvalancheEngine() { @@ -442,7 +443,12 @@ void AvalancheEngine::updateEvents() { _holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: - handleKeyDown(event); + if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _console->attach(); + _console->onFrame(); + } else + handleKeyDown(event); break; default: break; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 69fba35e25ee..fdb303e44176 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -202,7 +202,7 @@ class AvalancheEngine : public Engine { static const int16 kGameCode = 2; // Avalot's code number bool _holdLeftMouse; - + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; @@ -268,6 +268,7 @@ class AvalancheEngine : public Engine { bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; // End of former DNA Structure + bool _showDebugLines; byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. bool _dropsOk, _soundFx, _cheat; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 10b4dfcdbd96..bf0bc35e3eec 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -368,19 +368,7 @@ void AvalancheEngine::runAvalot() { checkClick(); _timer->updateTimer(); -#ifdef DEBUG - for (int i = 0; i < _lineNum; i++) { - LineType *curLine = &_lines[i]; - _graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); - } - - for (int i = 0; i < _fieldNum; i++) { - FieldType *curField = &_fields[i]; - if (curField->_x1 < 640) - _graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); - } -#endif - + _graphics->drawDebugLines(); _graphics->refreshScreen(); uint32 delay = _system->getMillis() - beginLoop; diff --git a/engines/avalanche/console.cpp b/engines/avalanche/console.cpp index 03f198fbf557..656cc1907cdd 100644 --- a/engines/avalanche/console.cpp +++ b/engines/avalanche/console.cpp @@ -30,10 +30,25 @@ namespace Avalanche { - AvalancheConsole::AvalancheConsole(AvalancheEngine *vm) : GUI::Debugger(), _vm(vm) { - } +AvalancheConsole::AvalancheConsole(AvalancheEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("magic_lines", WRAP_METHOD(AvalancheConsole, Cmd_MagicLines)); +} + +AvalancheConsole::~AvalancheConsole() { +} - AvalancheConsole::~AvalancheConsole() { +/** + * This command loads up the specified new scene number + */ +bool AvalancheConsole::Cmd_MagicLines(int argc, const char **argv) { + if (argc != 1) { + DebugPrintf("Usage: %s\n", argv[0]); + return true; } + _vm->_showDebugLines = !_vm->_showDebugLines; + return false; +} + + } // End of namespace Avalanche diff --git a/engines/avalanche/console.h b/engines/avalanche/console.h index 138c3db05cc7..166515d9136a 100644 --- a/engines/avalanche/console.h +++ b/engines/avalanche/console.h @@ -32,16 +32,19 @@ namespace Avalanche { - class AvalancheEngine; +class AvalancheEngine; - class AvalancheConsole : public GUI::Debugger { - public: - AvalancheConsole(AvalancheEngine *vm); - virtual ~AvalancheConsole(void); +class AvalancheConsole : public GUI::Debugger { +public: + AvalancheConsole(AvalancheEngine *vm); + virtual ~AvalancheConsole(void); - private: - AvalancheEngine *_vm; - }; +protected: + bool Cmd_MagicLines(int argc, const char **argv); + +private: + AvalancheEngine *_vm; +}; } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9fb9ec17d259..4db93c435ced 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -423,6 +423,22 @@ void GraphicManager::drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite) drawPicture(_background, sprite._picture, x, y); } +void GraphicManager::drawDebugLines() { + if (!_vm->_showDebugLines) + return; + + for (int i = 0; i < _vm->_lineNum; i++) { + LineType *curLine = &_vm->_lines[i]; + _surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->_color); + } + + for (int i = 0; i < _vm->_fieldNum; i++) { + FieldType *curField = &_vm->_fields[i]; + if (curField->_x1 < 640) + _surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); + } +} + Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 100a5dad72c8..80724f8216b5 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -84,6 +84,7 @@ class GraphicManager { void drawMenuItem(int x1, int y1, int x2, int y2); void wipeChar(int x, int y, Color color); void drawChar(byte ander, int x, int y, Color color); + void drawDebugLines(); void clearAlso(); void clearTextBar(); From 24bca9d9277d9557571295d62ff75eb3ce45ac23 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 23:29:57 +0200 Subject: [PATCH 1148/1332] AVALANCHE: Silent warnings reported by wjp --- engines/avalanche/parser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index f2bea80c2617..a0051b29491d 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1184,6 +1184,8 @@ void Parser::openDoor() { return; } break; + default: + break; } if ((!_vm->_userMovesAvvy) && (_vm->_room != kRoomLusties)) @@ -1902,6 +1904,8 @@ void Parser::doThat() { case kRoomMusicRoom: playHarp(); break; + default: + break; } } else if (isHolding()) { switch (_thing) { From 55a3af61c99e621f7306b416f23df7ccc0478942 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Sep 2013 23:59:01 +0200 Subject: [PATCH 1149/1332] AVALANCHE: Fix more gcc warnings reported by wjp --- engines/avalanche/animation.cpp | 2 ++ engines/avalanche/avalot.cpp | 7 +++++++ engines/avalanche/background.cpp | 2 ++ 3 files changed, 11 insertions(+) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index bf97328c5a54..57f9cdb7c5f5 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -892,6 +892,8 @@ void Animation::setMoveSpeed(byte t, Direction dir) { case kDirDownRight: _sprites[t].setSpeed(_sprites[t]._speedX, _sprites[t]._speedY); break; + default: + break; } } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index bf0bc35e3eec..5d7877d2578e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -655,6 +655,8 @@ void AvalancheEngine::enterNewTown() { if (_boxContent == kObjectWine) _wineState = 3; // Vinegar break; + default: + break; } if ((_room != kRoomOutsideDucks) && (_objects[kObjectOnion - 1]) && !(_onionInVinegar)) @@ -1051,6 +1053,9 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomDucks: _npcFacing = 1; // Duck. break; + + default: + break; } _seeScroll = false; // Now it can work again! @@ -1704,6 +1709,8 @@ Common::String AvalancheEngine::f5Does() { if (_animation->inField(5)) return Common::String::format("%cPPlay the harp", kVerbCodePlay); break; + default: + break; } return Common::String::format("%c", kVerbCodePardon); // If all else fails... diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 3f2c812ed6ce..8e6b4e5c2443 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -242,6 +242,8 @@ void Background::update() { } break; } + default: + break; } if ((_vm->_bellsAreRinging) && (_vm->setFlag('B'))) { From 11576c5aa940bbdf90f6fb79f39fbc23118cfd6c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:41:43 -0500 Subject: [PATCH 1150/1332] ZVISION: Rename ZVisionGameIds to use standard format --- engines/zvision/cursor_manager.cpp | 8 ++++---- engines/zvision/detection.cpp | 6 +++--- engines/zvision/detection.h | 6 +++--- engines/zvision/string_manager.cpp | 4 ++-- engines/zvision/zork_raw.cpp | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 50fa5031b270..69a4280157f2 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -47,10 +47,10 @@ CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixel _pixelFormat(pixelFormat), _cursorIsPushed(false) { // WARNING: The index IDLE_CURSOR_INDEX is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly - if (_engine->getGameId() == ZorkNemesis) { + if (_engine->getGameId() == GID_NEMESIS) { Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[IDLE_CURSOR_INDEX])); _idleCursor = ZorkCursor(name); - } else if (_engine->getGameId() == ZorkGrandInquisitor) { + } else if (_engine->getGameId() == GID_GRANDINQUISITOR) { _idleCursor = ZorkCursor(_zgiCursorFileNames[IDLE_CURSOR_INDEX]); } } @@ -77,7 +77,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) } for (int i = 0; i < NUM_CURSORS; i++) { - if (_engine->getGameId() == ZorkNemesis) { + if (_engine->getGameId() == GID_NEMESIS) { if (cursorName.equals(_cursorNames[i])) { _currentCursor = cursorName; @@ -88,7 +88,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) changeCursor(ZorkCursor(name)); return; } - } else if (_engine->getGameId() == ZorkGrandInquisitor) { + } else if (_engine->getGameId() == GID_GRANDINQUISITOR) { if (cursorName.equals(_cursorNames[i])) { _currentCursor = cursorName; diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index d9bb692f0708..28b7134fae49 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -68,7 +68,7 @@ static const ZVisionGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, - ZorkNemesis + GID_NEMESIS }, { @@ -82,12 +82,12 @@ static const ZVisionGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, - ZorkGrandInquisitor + GID_GRANDINQUISITOR }, { AD_TABLE_END_MARKER, - None + GID_NONE } }; diff --git a/engines/zvision/detection.h b/engines/zvision/detection.h index f08cfd2fe139..f9acb4d14465 100644 --- a/engines/zvision/detection.h +++ b/engines/zvision/detection.h @@ -28,9 +28,9 @@ namespace ZVision { enum ZVisionGameId { - None = 0, - ZorkNemesis = 1, - ZorkGrandInquisitor = 2 + GID_NONE = 0, + GID_NEMESIS = 1, + GID_GRANDINQUISITOR = 2 }; struct ZVisionGameDescription { diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index d069e28a7673..b2d19d904e9d 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -47,10 +47,10 @@ StringManager::~StringManager() { } void StringManager::initialize(ZVisionGameId gameId) { - if (gameId == ZorkNemesis) { + if (gameId == GID_NEMESIS) { // TODO: Check this hardcoded filename against all versions of Nemesis parseStrFile("nemesis.str"); - } else if (gameId == ZorkGrandInquisitor) { + } else if (gameId == GID_GRANDINQUISITOR) { // TODO: Check this hardcoded filename against all versions of Grand Inquisitor parseStrFile("inquis.str"); } diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 92f659203b30..ebb750874871 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -164,13 +164,13 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, SoundParams soundParams; - if (engine->getGameId() == ZorkNemesis) { + if (engine->getGameId() == GID_NEMESIS) { for (int i = 0; i < 6; i++) { if (zNemSoundParamLookupTable[i].identifier == (fileName[6])) soundParams = zNemSoundParamLookupTable[i]; } } - else if (engine->getGameId() == ZorkGrandInquisitor) { + else if (engine->getGameId() == GID_GRANDINQUISITOR) { for (int i = 0; i < 6; i++) { if (zgiSoundParamLookupTable[i].identifier == (fileName[7])) soundParams = zgiSoundParamLookupTable[i]; From ec41600795716c610a11e0556f5ea60dee3d7015 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Sep 2013 07:04:24 +0200 Subject: [PATCH 1151/1332] AVALANCHE: Rename getFlag(), change _roomTime to uint32 --- engines/avalanche/avalanche.h | 4 ++-- engines/avalanche/avalot.cpp | 4 ++-- engines/avalanche/background.cpp | 4 ++-- engines/avalanche/parser.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index fdb303e44176..70e2e8689f7e 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -308,7 +308,7 @@ class AvalancheEngine : public Engine { bool _keyboardClick; // Is a keyboard click noise wanted? People _him, _her; byte _it; - int32 _roomTime; // Set to 0 when you enter a room, added to in every loop. + uint32 _roomTime; // Set to 0 when you enter a room, added to in every loop. People _lastPerson; // Last person to have been selected using the People menu. bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. @@ -352,7 +352,7 @@ class AvalancheEngine : public Engine { void resetVariables(); void newGame(); // This sets up the DNA for a completely new game. void slowDown(); - bool setFlag(char x); + bool getFlag(char x); bool decreaseMoney(uint16 amount); // Called pennycheck in the original. void hangAroundForAWhile(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5d7877d2578e..797301898bfc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -684,7 +684,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { loadRoom(roomId); - if ((_roomCount[roomId] == 0) && (!setFlag('S'))) + if ((_roomCount[roomId] == 0) && (!getFlag('S'))) incScore(1); _whereIs[kPeopleAvalot - 150] = _room; @@ -1550,7 +1550,7 @@ void AvalancheEngine::slowDown() { warning("STUB: slowdown()"); } -bool AvalancheEngine::setFlag(char x) { +bool AvalancheEngine::getFlag(char x) { for (uint16 i = 0; i < _flags.size(); i++) { if (_flags[i] == x) return true; diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 8e6b4e5c2443..e5835ab95c2b 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -130,7 +130,7 @@ void Background::update() { break; case kRoomWestHall: if ((_vm->_roomTime % 3) == 0) { - switch ((_vm->_roomTime / int32(3)) % int32(6)) { + switch ((_vm->_roomTime / 3) % 6) { case 4: draw(-1, -1, 0); break; @@ -246,7 +246,7 @@ void Background::update() { break; } - if ((_vm->_bellsAreRinging) && (_vm->setFlag('B'))) { + if ((_vm->_bellsAreRinging) && (_vm->getFlag('B'))) { // They're ringing the bells. switch (_vm->_roomTime % 4) { case 1: diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index a0051b29491d..658c8fef9abf 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1940,7 +1940,7 @@ void Parser::doThat() { if (isHolding()) { if (_thing == kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); - if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->getFlag('B'))) // \? are used to avoid that ??! is parsed as a trigraph _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else @@ -1962,7 +1962,7 @@ void Parser::doThat() { warning("STUB: Parser::doThat() - case kVerbCodeboss"); break; case kVerbCodePee: - if (_vm->setFlag('P')) { + if (_vm->getFlag('P')) { _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { @@ -2025,7 +2025,7 @@ void Parser::doThat() { _sworeNum++; break; case kVerbCodeListen: - if ((_vm->_bellsAreRinging) & (_vm->setFlag('B'))) + if ((_vm->_bellsAreRinging) & (_vm->getFlag('B'))) _vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); else if (_vm->_listen.empty()) _vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy."); From c2da192e7f9bf836e3abd9e87ab155be9a490770 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Sep 2013 07:22:59 +0200 Subject: [PATCH 1152/1332] AVALANCHE: Remove bytefields, which are set but never used --- engines/avalanche/animation.cpp | 10 ---------- engines/avalanche/avalot.h | 4 ---- engines/avalanche/background.cpp | 17 +++-------------- engines/avalanche/background.h | 1 - 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 57f9cdb7c5f5..89fd16f25831 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -170,16 +170,6 @@ bool AnimationType::checkCollision() { } void AnimationType::walk() { - if (_visible) { - ByteField r; - r._x1 = (_x / 8) - 1; - if (r._x1 == 255) - r._x1 = 0; - r._y1 = _y - 2; - r._x2 = ((_x + _info._xLength) / 8) + 1; - r._y2 = _y + _info._yLength + 2; - } - if (!_anim->_vm->_doingSpriteRun) { _oldX[_anim->_vm->_cp] = _x; _oldY[_anim->_vm->_cp] = _y; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 6c5ef3155bdf..a9ec69fb3b72 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -87,10 +87,6 @@ struct FieldType { int16 _x1, _y1, _x2, _y2; }; -struct ByteField { - byte _x1, _y1, _x2, _y2; -}; - struct LineType : public FieldType { Color _color; }; diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index e5835ab95c2b..e9d3672d4f84 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -359,21 +359,10 @@ void Background::draw(int16 destX, int16 destY, byte sprId) { } } +/** + * @remarks Originally called 'display_it' + */ void Background::drawSprite(int16 x, int16 y, SpriteType &sprite) { - _r._x1 = x; - _r._y1 = y; - _r._y2 = y + sprite._yl; - - switch (sprite._type) { - case kNaturalImage: // Allow fallthrough on purpose. - case kBgi: - _r._x2 = x + sprite._xl + 1; - break; - case kEga: - _r._x2 = x + sprite._xl; - break; - } - // These pictures are practically parts of the background. -10 is for the drop-down menu. _vm->_graphics->drawBackgroundSprite(x, y - 10, sprite); } diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 1ce70e858c12..36bb1d486e09 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -69,7 +69,6 @@ class Background { int32 _offsets[40]; byte _spriteNum; SpriteType _sprites[40]; - ByteField _r; Common::String _filename; static const int16 kOnDisk; // Value of _sprites[fv]._x when it's not in memory. From 53f6c2f693755014b0dfe1652e85eeab9cfc18a9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 30 Sep 2013 12:43:39 +0200 Subject: [PATCH 1153/1332] AVALANCHE: Implement keyboard control in Dialogs::scrollModeDialogue(). --- engines/avalanche/dialogs.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 9868c772e1fb..d991ca771171 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -176,9 +176,6 @@ void Dialogs::scrollModeNormal() { } void Dialogs::scrollModeDialogue() { - warning("STUB: Scrolls::scrollModeDialogue()"); - // It should work with keypresses too! TODO: Implement it! - _vm->_graphics->loadMouse(kCurHand); _vm->_graphics->saveScreen(); @@ -189,13 +186,25 @@ void Dialogs::scrollModeDialogue() { _vm->_graphics->refreshScreen(); _vm->getEvent(event); + Common::Point cursorPos = _vm->getMousePos(); cursorPos.y /= 2; - if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP)) { - if ((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) { + + char inChar = 0; + if (event.type == Common::EVENT_KEYDOWN) { + inChar = (char)event.kbd.ascii; + Common::String temp(inChar); + temp.toUppercase(); + inChar = temp[0]; + } + + if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP) || (event.type == Common::EVENT_KEYDOWN)) { + if (((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) + || (inChar == 'Y') || (inChar == 'J') || (inChar == 'O')) { // Yes, Ja, Oui _scReturn = true; break; - } else if ((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) { + } else if (((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) + || (inChar == 'N')){ // No, Non, Nein _scReturn = false; break; } From b160a156c1653f32c57ce9479cb27c44e5ed4dc7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Sep 2013 20:53:06 +0200 Subject: [PATCH 1154/1332] AVALANCHE: Little refactoring in background --- engines/avalanche/background.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index e9d3672d4f84..0d350c17e352 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -110,21 +110,21 @@ void Background::update() { case 199: _vm->_npcFacing = 177; // Impossible value for this. break; - } - - if ((_vm->_roomTime % 200 >= 0) && (_vm->_roomTime % 200 <= 178)) { // Normally. - byte direction = 0; - uint16 angle = _vm->bearing(1); - if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) - direction = 3; - else if ((angle >= 293) && (angle <= 357)) - direction = 2; - else if ((angle >= 271) && (angle <= 292)) - direction = 4; - - if (direction != _vm->_npcFacing) { // Dogfood. - draw(-1, -1, direction - 1); - _vm->_npcFacing = direction; + default: + if (_vm->_roomTime % 200 <= 178) { // Normally. + byte direction = 0; + uint16 angle = _vm->bearing(1); + if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) + direction = 3; + else if ((angle >= 293) && (angle <= 357)) + direction = 2; + else if ((angle >= 271) && (angle <= 292)) + direction = 4; + + if (direction != _vm->_npcFacing) { // Dogfood. + draw(-1, -1, direction - 1); + _vm->_npcFacing = direction; + } } } break; From 98b5fe757f2559acd90b05f20ce4425ab8c73b0f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Sep 2013 22:00:05 +0200 Subject: [PATCH 1155/1332] AVALANCHE: Remove various dead variables and associated code --- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalanche.cpp | 1 - engines/avalanche/avalanche.h | 7 +------ engines/avalanche/avalot.cpp | 2 -- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 89fd16f25831..f7f103d988f0 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1091,7 +1091,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_menu->isActive() | _vm->_onToolbar | _vm->_seeScroll) + if (_vm->_menu->isActive() | _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 0a4e7b1c03f6..54bede1af9d5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -388,7 +388,6 @@ bool AvalancheEngine::loadGame(const int16 slot) { refreshObjectList(); _animation->updateSpeed(); drawDirection(); - _onToolbar = false; _animation->animLink(); _background->update(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 70e2e8689f7e..e27848c1dc1b 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -162,9 +162,6 @@ class AvalancheEngine : public Engine { #endif public: - static const int16 kXW = 30; - static const int16 kYW = 36; // x width & y whatsit - static const int16 kMargin = 5; static const MouseHotspotType kMouseHotSpots[9]; static const int16 kMaxSprites = 2; // Current max no. of sprites. @@ -184,8 +181,6 @@ class AvalancheEngine : public Engine { }; // These following static constants should be included in CFG when it's written. - - static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar. static const int16 kBorder = 1; // size of border on shadowboxes static const int16 kWalk = 3; static const int16 kRun = 5; @@ -282,7 +277,7 @@ class AvalancheEngine : public Engine { int16 _talkX, _talkY; Color _talkBackgroundColor, _talkFontColor; byte _scrollBells; // no. of times to ring the bell - bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? + bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; // Called .free() for them in ~Gyro(). int8 _scoreToDisplay[3]; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 797301898bfc..1e739709b1bb 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1243,7 +1243,6 @@ void AvalancheEngine::guideAvvy(Common::Point cursorPos) { void AvalancheEngine::checkClick() { Common::Point cursorPos = getMousePos(); - _onToolbar = kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); /*if (mrelease > 0) after_the_scroll = false;*/ @@ -1523,7 +1522,6 @@ void AvalancheEngine::newGame() { _thinkThing = true; _thinks = 2; refreshObjectList(); - _onToolbar = false; _seeScroll = false; avvy->appear(300, 117, kDirRight); // Needed to initialize Avalot. From 9b8566ae18fcd1028f71f8f5d6a4498da1abc1e0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 00:12:28 +0200 Subject: [PATCH 1156/1332] AVALANCHE: Move several variables to make them private --- engines/avalanche/animation.cpp | 6 ++++-- engines/avalanche/avalanche.cpp | 3 +-- engines/avalanche/avalanche.h | 16 ++++++---------- engines/avalanche/avalot.cpp | 3 +-- engines/avalanche/background.cpp | 15 +++++++++++---- engines/avalanche/background.h | 3 +++ 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f7f103d988f0..3de2c7c83c4c 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -720,8 +720,8 @@ void Animation::callSpecial(uint16 which) { case 3: // _vm->special 3: Room 71: triggers dart. _sprites[0].bounce(); // Must include that. - if (!_vm->_arrowTriggered) { - _vm->_arrowTriggered = true; + if (!_arrowTriggered) { + _arrowTriggered = true; appearPed(1, 3); // The dart starts at ped 4, and... _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1]._facingDir = kDirUp; // Only face. @@ -1285,6 +1285,7 @@ Direction Animation::getOldDirection() { void Animation::resetVariables() { _geidaSpin = 0; _geidaTime = 0; + _arrowTriggered = false; } void Animation::synchronize(Common::Serializer &sz) { @@ -1342,6 +1343,7 @@ void Animation::synchronize(Common::Serializer &sz) { spr->appear(spr->_x, spr->_y, spr->_facingDir); } + sz.syncAsByte(_arrowTriggered); } } // End of namespace Avalanche. diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 54bede1af9d5..251cc0c71a1b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -134,6 +134,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { _animation->synchronize(sz); _parser->synchronize(sz); _sequence->synchronize(sz); + _background->synchronize(sz); sz.syncAsByte(_carryNum); for (int i = 0; i < kObjectNum; i++) @@ -171,7 +172,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_bellsAreRinging); sz.syncAsByte(_standingOnDais); sz.syncAsByte(_takenPen); - sz.syncAsByte(_arrowTriggered); sz.syncAsByte(_arrowInTheDoor); if (sz.isSaving()) { @@ -257,7 +257,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_catacombY); sz.syncAsByte(_avvysInTheCupboard); sz.syncAsByte(_geidaFollows); - sz.syncAsByte(_nextBell); sz.syncAsByte(_givenPotionToGeida); sz.syncAsByte(_lustieIsAsleep); sz.syncAsByte(_beenTiedUp); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e27848c1dc1b..db4434a00908 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -181,7 +181,6 @@ class AvalancheEngine : public Engine { }; // These following static constants should be included in CFG when it's written. - static const int16 kBorder = 1; // size of border on shadowboxes static const int16 kWalk = 3; static const int16 kRun = 5; static const int32 kCatacombMap[8][8]; @@ -193,8 +192,6 @@ class AvalancheEngine : public Engine { static const char *kVersionNum; static const char *kCopyright; - static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".". - static const int16 kGameCode = 2; // Avalot's code number bool _holdLeftMouse; @@ -208,7 +205,6 @@ class AvalancheEngine : public Engine { int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh Room _room; // your current room - byte _roomCount[100]; // Add one to each every time you enter a room bool _wonNim; // Have you *won* Nim? (That's harder.) byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? @@ -221,7 +217,6 @@ class AvalancheEngine : public Engine { byte _givenToSpludwick; // 0 = nothing given, 1 = onion... byte _brummieStairs; // Progression through the stairs trick. byte _cardiffQuestionNum; // Things you get asked in Cardiff. - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.) bool _avvyInBed; // True if Avvy's in bed, but awake. bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements. @@ -235,15 +230,11 @@ class AvalancheEngine : public Engine { bool _bellsAreRinging; // Is Jacques ringing the bells? bool _standingOnDais; // In room 71, inside Cardiff Castle. bool _takenPen; // Have you taken the pen (in Cardiff?) - bool _arrowTriggered; // And has the arrow been triggered? bool _arrowInTheDoor; // Did the arrow hit the wall? Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's uint32 _totalTime; // Your total time playing this game, in ticks. byte _jumpStatus; // Fixes how high you're jumping. bool _mushroomGrowing; // Is the mushroom growing in 42? - bool _spludwickAtHome; // Is Spludwick at home? - byte _lastRoom; - byte _lastRoomNotMap; bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away? bool _enterCatacombsFromLustiesRoom; bool _teetotal; // Are we touching any more drinks? @@ -253,7 +244,6 @@ class AvalancheEngine : public Engine { byte _catacombX, _catacombY; // XY coords in the catacombs. bool _avvysInTheCupboard; // On screen 22. bool _geidaFollows; // Is Geida following you? - byte _nextBell; // For the ringing. bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? bool _beenTiedUp; // In r__Robins. @@ -366,6 +356,12 @@ class AvalancheEngine : public Engine { private: static Room _whereIs[29]; + bool _spludwickAtHome; // Is Spludwick at home? + byte _lastRoom; + byte _lastRoomNotMap; + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + byte _roomCount[100]; // Add one to each every time you enter a room + Common::File file; Common::String readAlsoStringFromFile(); void scram(Common::String &str); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 1e739709b1bb..922be91806dd 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1455,7 +1455,6 @@ void AvalancheEngine::resetVariables() { _bellsAreRinging = false; _standingOnDais = false; _takenPen = false; - _arrowTriggered = false; _arrowInTheDoor = false; _favouriteDrink = ""; _favouriteSong = ""; @@ -1477,7 +1476,6 @@ void AvalancheEngine::resetVariables() { _catacombY = 0; _avvysInTheCupboard = false; _geidaFollows = false; - _nextBell = 0; _givenPotionToGeida = false; _lustieIsAsleep = false; _beenTiedUp = false; @@ -1491,6 +1489,7 @@ void AvalancheEngine::resetVariables() { _parser->resetVariables(); _animation->resetVariables(); _sequence->resetVariables(); + _background->resetVariables(); } void AvalancheEngine::newGame() { diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 0d350c17e352..e72e4a4cca77 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -250,11 +250,11 @@ void Background::update() { // They're ringing the bells. switch (_vm->_roomTime % 4) { case 1: - if (_vm->_nextBell < 5) - _vm->_nextBell = 12; - _vm->_nextBell--; + if (_nextBell < 5) + _nextBell = 12; + _nextBell--; // CHECKME: 2 is a guess. No length in the original? - _vm->_sound->playNote(_vm->kNotes[_vm->_nextBell], 2); + _vm->_sound->playNote(_vm->kNotes[_nextBell], 2); break; case 2: _vm->_sound->stopSound(); @@ -367,4 +367,11 @@ void Background::drawSprite(int16 x, int16 y, SpriteType &sprite) { _vm->_graphics->drawBackgroundSprite(x, y - 10, sprite); } +void Background::resetVariables() { + _nextBell = 0; +} + +void Background::synchronize(Common::Serializer &sz) { + sz.syncAsByte(_nextBell); +} } // End of namespace Avalanche. diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 36bb1d486e09..f4fcd38b9bcd 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -62,10 +62,13 @@ class Background { // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. void draw(int16 destX, int16 destY, byte sprId); + void resetVariables(); + void synchronize(Common::Serializer &sz); private: AvalancheEngine *_vm; + byte _nextBell; // For the ringing. int32 _offsets[40]; byte _spriteNum; SpriteType _sprites[40]; From 6c11712373c536a0a0e84c7e4f5d5f39ce79467e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 06:50:27 +0200 Subject: [PATCH 1157/1332] AVALANCHE: More refactoring --- engines/avalanche/animation.h | 1 + engines/avalanche/avalanche.h | 7 ++++--- engines/avalanche/avalot.cpp | 8 ++------ engines/avalanche/parser.cpp | 19 +++++++++++++------ engines/avalanche/parser.h | 2 ++ 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 591e955e8ff6..d5d85106d844 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -141,6 +141,7 @@ class Animation { private: Direction _direction; // The direction Avvy is currently facing. Direction _oldDirection; + bool _arrowTriggered; // And has the arrow been triggered? byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index db4434a00908..e9e764359e29 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -256,9 +256,8 @@ class AvalancheEngine : public Engine { bool _showDebugLines; byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. - bool _dropsOk, _soundFx, _cheat; - Common::String _mouseText; - bool _weirdWord; + bool _dropsOk; + bool _cheat; // CHECKME: Currently unused bool _letMeOut; Common::String _scroll[15]; byte _scrollNum, _whichwas; @@ -299,6 +298,7 @@ class AvalancheEngine : public Engine { bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. bool _isLoaded; // Is it a loaded gamestate? + bool _soundFx; void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void setup(); @@ -361,6 +361,7 @@ class AvalancheEngine : public Engine { byte _lastRoomNotMap; bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? byte _roomCount[100]; // Add one to each every time you enter a room + Common::String _mouseText; Common::File file; Common::String readAlsoStringFromFile(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 922be91806dd..79f89535b348 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -421,12 +421,8 @@ void AvalancheEngine::callVerb(VerbCode id) { "situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ "what the current setting of this key is."); _dialogs->displayText(tmpStr); - } else { - _weirdWord = false; - _parser->_polite = true; - _parser->_verb = id; - _parser->doThat(); - } + } else + _parser->doVerb(id); } /** diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 658c8fef9abf..2064fa7deccf 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -50,7 +50,7 @@ void Parser::init() { _inputText.clear(); _inputTextPos = 0; - _vm->_weirdWord = false; + _weirdWord = false; // Initailaze the vocabulary. // Verbs: 1-49 @@ -712,7 +712,7 @@ void Parser::parse() { // Are we being interrogated right now? if (_vm->_interrogation > 0) { storeInterrogation(_vm->_interrogation); - _vm->_weirdWord = true; + _weirdWord = true; return; } @@ -814,7 +814,7 @@ void Parser::parse() { } if (doPronouns()) { - _vm->_weirdWord = true; + _weirdWord = true; _thats = kNothing; return; } @@ -869,9 +869,9 @@ void Parser::parse() { if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_weirdWord = true; + _weirdWord = true; } else - _vm->_weirdWord = false; + _weirdWord = false; if (_thats.empty()) _thats = kNothing; @@ -1590,7 +1590,7 @@ void Parser::doThat() { return; } - if (_vm->_weirdWord) + if (_weirdWord) return; if (_thing < 200) @@ -2351,6 +2351,13 @@ void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) { } } +void Parser::doVerb(VerbCode id) { + _weirdWord = false; + _polite = true; + _verb = id; + doThat(); +} + void Parser::resetVariables() { _wearing = 0; _sworeNum = 0; diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index f7d3eb1d3ccd..f20aa9015ab1 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -69,6 +69,7 @@ class Parser { byte _inputTextPos; // Original name: curpos bool _quote; // 66 or 99 next? bool _cursorState; + bool _weirdWord; byte _wearing; // what you're wearing @@ -89,6 +90,7 @@ class Parser { void cursorOff(); void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it. int16 getPos(const Common::String &crit, const Common::String &src); // Returns the index of the first appearance of crit in src. + void doVerb(VerbCode id); void resetVariables(); void synchronize(Common::Serializer &sz); From 15acaa1a77b5f6cba5829d5274d3ffe99fa56fbb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 07:11:20 +0200 Subject: [PATCH 1158/1332] AVALANCHE: Move _scroll and _scrollNum to Dialogs. Remove a useless variable --- engines/avalanche/avalanche.h | 6 ++- engines/avalanche/dialogs.cpp | 72 +++++++++++++++++------------------ engines/avalanche/dialogs.h | 2 + 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e9e764359e29..06d7e68a8ed0 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -259,8 +259,10 @@ class AvalancheEngine : public Engine { bool _dropsOk; bool _cheat; // CHECKME: Currently unused bool _letMeOut; - Common::String _scroll[15]; - byte _scrollNum, _whichwas; + + + + byte _thinks; bool _thinkThing; int16 _talkX, _talkY; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index d991ca771171..43b85cf92de7 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -409,10 +409,10 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_vm->_scrollNum) * 6; + int16 ly = (_scrollNum) * 6; int16 ex; - for (int i = 0; i < _vm->_scrollNum; i++) { - ex = _vm->_scroll[i].size() * 8; + for (int i = 0; i < _scrollNum; i++) { + ex = _scroll[i].size() * 8; if (lx < ex) lx = ex; } @@ -452,30 +452,30 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _vm->_scrollNum; i++) { - if (!_vm->_scroll[i].empty()) - switch (_vm->_scroll[i][_vm->_scroll[i].size() - 1]) { + for (int i = 0; i < _scrollNum; i++) { + if (!_scroll[i].empty()) + switch (_scroll[i][_scroll[i].size() - 1]) { case kControlCenter: centre = true; - _vm->_scroll[i].deleteLastChar(); + _scroll[i].deleteLastChar(); break; case kControlLeftJustified: centre = false; - _vm->_scroll[i].deleteLastChar(); + _scroll[i].deleteLastChar(); break; case kControlQuestion: _shadowBoxX = mx + lx; _shadowBoxY = my + ly; - _vm->_scroll[i].setChar(' ', 0); + _scroll[i].setChar(' ', 0); _vm->_graphics->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); _vm->_graphics->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); break; } if (centre) - say(320 - _vm->_scroll[i].size() * 4 + iconIndent, my, _vm->_scroll[i]); + say(320 - _scroll[i].size() * 4 + iconIndent, my, _scroll[i]); else - say(mx + iconIndent, my, _vm->_scroll[i]); + say(mx + iconIndent, my, _scroll[i]); my += 12; } @@ -499,9 +499,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = _vm->_scrollNum * 5; - for (int i = 0; i < _vm->_scrollNum; i++) { - uint16 textWidth = _vm->_scroll[i].size() * 8; + int16 yl = _scrollNum * 5; + for (int i = 0; i < _scrollNum; i++) { + uint16 textWidth = _scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; } @@ -530,10 +530,10 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _vm->_scrollNum; i++) { - int16 x = xc + _vm->_talkX - _vm->_scroll[i].size() / 2 * 8; - bool offset = _vm->_scroll[i].size() % 2; - _vm->_graphics->drawScrollText(_vm->_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); + for (int i = 0; i < _scrollNum; i++) { + int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; + bool offset = _scroll[i].size() % 2; + _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); } ringBell(); @@ -549,10 +549,10 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { } void Dialogs::reset() { - _vm->_scrollNum = 1; + _scrollNum = 1; for (int i = 0; i < 15; i++) { - if (!_vm->_scroll[i].empty()) - _vm->_scroll[i].clear(); + if (!_scroll[i].empty()) + _scroll[i].clear(); } } @@ -591,16 +591,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) { } void Dialogs::solidify(byte n) { - if (!_vm->_scroll[n].contains(' ')) + if (!_scroll[n].contains(' ')) return; // No spaces. // So there MUST be a space there, somewhere... do { - _vm->_scroll[n + 1] = _vm->_scroll[n][_vm->_scroll[n].size() - 1] + _vm->_scroll[n + 1]; - _vm->_scroll[n].deleteLastChar(); - } while (_vm->_scroll[n][_vm->_scroll[n].size() - 1] != ' '); + _scroll[n + 1] = _scroll[n][_scroll[n].size() - 1] + _scroll[n + 1]; + _scroll[n].deleteLastChar(); + } while (_scroll[n][_scroll[n].size() - 1] != ' '); - stripTrailingSpaces(_vm->_scroll[n]); + stripTrailingSpaces(_scroll[n]); } void Dialogs::callDialogDriver() { @@ -641,7 +641,7 @@ void Dialogs::callDialogDriver() { } else { switch (_vm->_buffer[i]) { case kControlParagraph: - if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) + if ((_scrollNum == 1) && (_scroll[0].empty())) break; if (call_spriterun) @@ -659,7 +659,7 @@ void Dialogs::callDialogDriver() { _vm->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_vm->_scrollNum == 1) && (_vm->_scroll[0].empty())) + if ((_scrollNum == 1) && (_scroll[0].empty())) break; if (call_spriterun) @@ -753,15 +753,15 @@ void Dialogs::callDialogDriver() { _useIcon = _param; break; case kControlNewLine: - _vm->_scrollNum++; + _scrollNum++; break; case kControlQuestion: if (call_spriterun) _vm->spriteRun(); call_spriterun = false; - _vm->_scroll[_vm->_scrollNum] = kControlQuestion; - _vm->_scrollNum++; + _scroll[_scrollNum] = kControlQuestion; + _scrollNum++; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -771,14 +771,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _vm->_scroll[_vm->_scrollNum - 1] += ' '; + _scroll[_scrollNum - 1] += ' '; break; default: // Add new char. - if (_vm->_scroll[_vm->_scrollNum - 1].size() == 50) { - solidify(_vm->_scrollNum - 1); - _vm->_scrollNum++; + if (_scroll[_scrollNum - 1].size() == 50) { + solidify(_scrollNum - 1); + _scrollNum++; } - _vm->_scroll[_vm->_scrollNum - 1] += _vm->_buffer[i]; + _scroll[_scrollNum - 1] += _vm->_buffer[i]; break; } } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index d3088ec35b51..5e0a06aa2704 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -96,9 +96,11 @@ class Dialogs { int16 _shadowBoxX, _shadowBoxY; byte _currentFont; // Current font + Common::String _scroll[15]; Common::Point _dodgeCoord; byte _param; // For using arguments code byte _useIcon; + byte _scrollNum; bool _scReturn; // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. From bc4a8f8671470a063e13f7b079b337d673207ffa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 07:29:15 +0200 Subject: [PATCH 1159/1332] AVALANCHE: _scrollNum is now a C index --- engines/avalanche/dialogs.cpp | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 43b85cf92de7..a07b0c611ded 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -409,9 +409,9 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_scrollNum) * 6; + int16 ly = (_scrollNum + 1) * 6; int16 ex; - for (int i = 0; i < _scrollNum; i++) { + for (int i = 0; i <= _scrollNum; i++) { ex = _scroll[i].size() * 8; if (lx < ex) lx = ex; @@ -452,7 +452,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i < _scrollNum; i++) { + for (int i = 0; i <= _scrollNum; i++) { if (!_scroll[i].empty()) switch (_scroll[i][_scroll[i].size() - 1]) { case kControlCenter: @@ -499,8 +499,8 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = _scrollNum * 5; - for (int i = 0; i < _scrollNum; i++) { + int16 yl = (_scrollNum + 1) * 5; + for (int i = 0; i <= _scrollNum; i++) { uint16 textWidth = _scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; @@ -530,7 +530,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i < _scrollNum; i++) { + for (int i = 0; i <= _scrollNum; i++) { int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; bool offset = _scroll[i].size() % 2; _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); @@ -549,7 +549,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { } void Dialogs::reset() { - _scrollNum = 1; + _scrollNum = 0; for (int i = 0; i < 15; i++) { if (!_scroll[i].empty()) _scroll[i].clear(); @@ -612,7 +612,7 @@ void Dialogs::callDialogDriver() { setReadyLight(0); _scReturn = false; bool mouthnext = false; - bool call_spriterun = true; // Only call sprite_run the FIRST time. + bool callSpriteRun = true; // Only call sprite_run the FIRST time. switch (_vm->_buffer[_vm->_bufSize - 1]) { case kControlToBuffer: @@ -641,12 +641,12 @@ void Dialogs::callDialogDriver() { } else { switch (_vm->_buffer[i]) { case kControlParagraph: - if ((_scrollNum == 1) && (_scroll[0].empty())) + if ((_scrollNum == 0) && (_scroll[0].empty())) break; - if (call_spriterun) + if (callSpriteRun) _vm->spriteRun(); - call_spriterun = false; + callSpriteRun = false; drawScroll(&Avalanche::Dialogs::scrollModeNormal); @@ -659,12 +659,12 @@ void Dialogs::callDialogDriver() { _vm->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_scrollNum == 1) && (_scroll[0].empty())) + if ((_scrollNum == 0) && (_scroll[0].empty())) break; - if (call_spriterun) + if (callSpriteRun) _vm->spriteRun(); - call_spriterun = false; + callSpriteRun = false; if (_param == 0) setBubbleStateNatural(); @@ -756,12 +756,12 @@ void Dialogs::callDialogDriver() { _scrollNum++; break; case kControlQuestion: - if (call_spriterun) + if (callSpriteRun) _vm->spriteRun(); - call_spriterun = false; + callSpriteRun = false; - _scroll[_scrollNum] = kControlQuestion; _scrollNum++; + _scroll[_scrollNum] = kControlQuestion; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -771,14 +771,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _scroll[_scrollNum - 1] += ' '; + _scroll[_scrollNum] += ' '; break; default: // Add new char. - if (_scroll[_scrollNum - 1].size() == 50) { - solidify(_scrollNum - 1); + if (_scroll[_scrollNum].size() == 50) { + solidify(_scrollNum); _scrollNum++; } - _scroll[_scrollNum - 1] += _vm->_buffer[i]; + _scroll[_scrollNum] += _vm->_buffer[i]; break; } } From a06bbb4fe78fc9722fde2dbd7d3d39ec64430f7e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 07:31:13 +0200 Subject: [PATCH 1160/1332] AVALANCHE: Rename _scrollNum to improve readibility --- engines/avalanche/dialogs.cpp | 34 +++++++++++++++++----------------- engines/avalanche/dialogs.h | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index a07b0c611ded..f15216cb2a0b 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -409,9 +409,9 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; - int16 ly = (_scrollNum + 1) * 6; + int16 ly = (_maxLineNum + 1) * 6; int16 ex; - for (int i = 0; i <= _scrollNum; i++) { + for (int i = 0; i <= _maxLineNum; i++) { ex = _scroll[i].size() * 8; if (lx < ex) lx = ex; @@ -452,7 +452,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 53; } - for (int i = 0; i <= _scrollNum; i++) { + for (int i = 0; i <= _maxLineNum; i++) { if (!_scroll[i].empty()) switch (_scroll[i][_scroll[i].size() - 1]) { case kControlCenter: @@ -499,8 +499,8 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { CursorMan.showMouse(false); int16 xl = 0; - int16 yl = (_scrollNum + 1) * 5; - for (int i = 0; i <= _scrollNum; i++) { + int16 yl = (_maxLineNum + 1) * 5; + for (int i = 0; i <= _maxLineNum; i++) { uint16 textWidth = _scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; @@ -530,7 +530,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (int i = 0; i <= _scrollNum; i++) { + for (int i = 0; i <= _maxLineNum; i++) { int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; bool offset = _scroll[i].size() % 2; _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); @@ -549,7 +549,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { } void Dialogs::reset() { - _scrollNum = 0; + _maxLineNum = 0; for (int i = 0; i < 15; i++) { if (!_scroll[i].empty()) _scroll[i].clear(); @@ -641,7 +641,7 @@ void Dialogs::callDialogDriver() { } else { switch (_vm->_buffer[i]) { case kControlParagraph: - if ((_scrollNum == 0) && (_scroll[0].empty())) + if ((_maxLineNum == 0) && (_scroll[0].empty())) break; if (callSpriteRun) @@ -659,7 +659,7 @@ void Dialogs::callDialogDriver() { _vm->_scrollBells++; break; // #7 = "Bel" case kControlSpeechBubble: - if ((_scrollNum == 0) && (_scroll[0].empty())) + if ((_maxLineNum == 0) && (_scroll[0].empty())) break; if (callSpriteRun) @@ -753,15 +753,15 @@ void Dialogs::callDialogDriver() { _useIcon = _param; break; case kControlNewLine: - _scrollNum++; + _maxLineNum++; break; case kControlQuestion: if (callSpriteRun) _vm->spriteRun(); callSpriteRun = false; - _scrollNum++; - _scroll[_scrollNum] = kControlQuestion; + _maxLineNum++; + _scroll[_maxLineNum] = kControlQuestion; drawScroll(&Avalanche::Dialogs::scrollModeDialogue); reset(); @@ -771,14 +771,14 @@ void Dialogs::callDialogDriver() { break; case kControlInsertSpaces: for (int j = 0; j < 9; j++) - _scroll[_scrollNum] += ' '; + _scroll[_maxLineNum] += ' '; break; default: // Add new char. - if (_scroll[_scrollNum].size() == 50) { - solidify(_scrollNum); - _scrollNum++; + if (_scroll[_maxLineNum].size() == 50) { + solidify(_maxLineNum); + _maxLineNum++; } - _scroll[_scrollNum] += _vm->_buffer[i]; + _scroll[_maxLineNum] += _vm->_buffer[i]; break; } } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 5e0a06aa2704..a7eb2315173a 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -100,7 +100,7 @@ class Dialogs { Common::Point _dodgeCoord; byte _param; // For using arguments code byte _useIcon; - byte _scrollNum; + byte _maxLineNum; bool _scReturn; // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. From 63f43aa9590607e18157bb08c7f0de68ff8ae0a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 07:43:21 +0200 Subject: [PATCH 1161/1332] AVALANCHE: Move some more variables out of Avalanche --- engines/avalanche/animation.cpp | 3 +-- engines/avalanche/avalanche.h | 7 ++----- engines/avalanche/avalot.h | 2 +- engines/avalanche/dialogs.cpp | 18 ++++++++---------- engines/avalanche/dialogs.h | 1 + engines/avalanche/graphics.cpp | 19 ++++++++++++------- engines/avalanche/graphics.h | 2 ++ 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 3de2c7c83c4c..836864bf9e8b 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -319,8 +319,7 @@ void AnimationType::stopWalk() { void AnimationType::chatter() { _anim->_vm->_talkX = _x + _info._xLength / 2; _anim->_vm->_talkY = _y; - _anim->_vm->_talkFontColor = _stat._fgBubbleCol; - _anim->_vm->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_graphics->setDialogColor(_stat._bgBubbleCol, _stat._fgBubbleCol); } void AnimationType::remove() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 06d7e68a8ed0..845aa09f0865 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -259,15 +259,12 @@ class AvalancheEngine : public Engine { bool _dropsOk; bool _cheat; // CHECKME: Currently unused bool _letMeOut; + byte _thinks; + bool _thinkThing; - - byte _thinks; - bool _thinkThing; int16 _talkX, _talkY; - Color _talkBackgroundColor, _talkFontColor; - byte _scrollBells; // no. of times to ring the bell bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; // Called .free() for them in ~Gyro(). diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index a9ec69fb3b72..292596b89f80 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -95,7 +95,7 @@ typedef int8 TuneType[31]; struct QuasipedType { byte _whichPed; - Color _foregroundColor; + Color _textColor; Room _room; Color _backgroundColor; People _who; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index f15216cb2a0b..551b45e98476 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -340,14 +340,14 @@ void Dialogs::scrollModeMusic() { } void Dialogs::resetScrollDriver() { - _vm->_scrollBells = 0; + _scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; _vm->_interrogation = 0; // Always reset after a scroll comes up. } void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_scrollBells; i++) + for (int i = 0; i < _scrollBells; i++) _vm->errorLed(); // Ring the bell "x" times. } @@ -533,7 +533,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { for (int i = 0; i <= _maxLineNum; i++) { int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; bool offset = _scroll[i].size() % 2; - _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); + _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_graphics->_talkFontColor); } ringBell(); @@ -559,8 +559,7 @@ void Dialogs::reset() { void Dialogs::setBubbleStateNatural() { _vm->_talkX = 320; _vm->_talkY = 200; - _vm->_talkBackgroundColor = kColorDarkgray; - _vm->_talkFontColor = kColorWhite; + _vm->_graphics->setDialogColor(kColorDarkgray, kColorWhite); } Common::String Dialogs::displayMoney() { @@ -656,8 +655,8 @@ void Dialogs::callDialogDriver() { return; break; case kControlBell: - _vm->_scrollBells++; - break; // #7 = "Bel" + _scrollBells++; + break; case kControlSpeechBubble: if ((_maxLineNum == 0) && (_scroll[0].empty())) break; @@ -682,9 +681,8 @@ void Dialogs::callDialogDriver() { PedType *quasiPed = &_vm->_peds[_vm->kQuasipeds[_param - 10]._whichPed]; _vm->_talkX = quasiPed->_x; _vm->_talkY = quasiPed->_y; // Position. - - _vm->_talkFontColor = _vm->kQuasipeds[_param - 10]._foregroundColor; - _vm->_talkBackgroundColor = _vm->kQuasipeds[_param - 10]._backgroundColor; // Colors. + + _vm->_graphics->setDialogColor(_vm->kQuasipeds[_param - 10]._backgroundColor, _vm->kQuasipeds[_param - 10]._textColor); } else { _vm->errorLed(); // Not valid. setBubbleStateNatural(); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index a7eb2315173a..fec842907d15 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -102,6 +102,7 @@ class Dialogs { byte _useIcon; byte _maxLineNum; bool _scReturn; + byte _scrollBells; // no. of times to ring the bell // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4db93c435ced..2d3d82ebd781 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -565,20 +565,20 @@ void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[ _scrolls.copyFrom(_surface); // The body of the bubble. - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _talkBackgroundColor); // Top right corner of the bubble. - drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _talkBackgroundColor); // Bottom right corner of the bubble. - drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _talkBackgroundColor); // Top left corner of the bubble. - drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _talkBackgroundColor); // Bottom left corner of the bubble. - drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _talkBackgroundColor); // "Tail" of the speech bubble. - drawTriangle(points, _vm->_talkBackgroundColor); + drawTriangle(points, _talkBackgroundColor); } // And set the background of the text to the desired color. @@ -652,6 +652,11 @@ void GraphicManager::restoreScreen() { refreshScreen(); } +void GraphicManager::setDialogColor(Color bg, Color text) { + _talkBackgroundColor = bg; + _talkFontColor = text; +} + // Original name background() void GraphicManager::setBackgroundColor(Color x) { warning("STUB: setBackgroundColor(%d)", x); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 80724f8216b5..c78ac56a9c9e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -58,6 +58,7 @@ class SpriteInfo { class GraphicManager { public: Graphics::Surface _surface; + Color _talkBackgroundColor, _talkFontColor; GraphicManager(AvalancheEngine *vm); ~GraphicManager(); @@ -110,6 +111,7 @@ class GraphicManager { void loadBackground(Common::File &file); void refreshBackground(); void setBackgroundColor(Color x); + void setDialogColor(Color bg, Color text); void zoomOut(int16 x, int16 y); // Only used when entering the map. From bfb28c7a399662bca7269f9e5dbc8788b7bb4d58 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 1 Oct 2013 08:51:07 +0200 Subject: [PATCH 1162/1332] AVALANCHE: Move drawSign() from Dialogs to Graphics. Implement it. --- engines/avalanche/dialogs.cpp | 30 ++---------------------------- engines/avalanche/dialogs.h | 1 - engines/avalanche/graphics.cpp | 34 ++++++++++++++++++++++++++++++++++ engines/avalanche/graphics.h | 1 + 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 551b45e98476..9557b36b7429 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -381,32 +381,6 @@ void Dialogs::getIcon(int16 x, int16 y, byte which) { file.close(); } -void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { - Common::File file; - Common::String filename = Common::String::format("%s.avd", fn.c_str()); - - if (!file.open(filename)) - error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); - -#if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->cp) * _vm->pagetop); - byte bit; - for (uint16 i = 1; i <= yl; i++) - for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (i * 80)], xl); - } - bit = getpixel(0, 0); -#endif - - warning("STUB: Scrolls::drawSign()"); - - file.close(); -} - void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; int16 ly = (_maxLineNum + 1) * 6; @@ -438,11 +412,11 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 0; break; // No icon. case 34: - drawSign("about", 28, 76, 15); + _vm->_graphics->drawSign("about", 28, 76, 15); iconIndent = 0; break; case 35: - drawSign("gameover", 52, 59, 71); + _vm->_graphics->drawSign("gameover", 52, 59, 71); iconIndent = 0; break; } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index fec842907d15..19ee9e36a272 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -126,7 +126,6 @@ class Dialogs { void resetScrollDriver(); void ringBell(); // Original: dingdongbell void getIcon(int16 x, int16 y, byte which); - void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void loadFont(); // From Visa: diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 2d3d82ebd781..4435e5939bf7 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -560,6 +560,40 @@ void GraphicManager::drawReadyLight(Color color) { _surface.fillRect(Common::Rect(419, 195, 438, 197), color); } +void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { + Common::File file; + Common::String filename = Common::String::format("%s.avd", fn.c_str()); + + if (!file.open(filename)) + error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); + + // I know it looks very similar to the loadPicture methods, but in truth it's the combination of the two. + + uint16 width = xl * 8; + uint16 height = yl; + + Graphics::Surface sign; // We make a Surface object for the picture itself. + sign.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + + // Produce the picture. We read it in row-by-row, and every row has 4 planes. + for (int y = 0; y < height; y++) { + for (int8 plane = 0; plane < 4; plane++) { // The planes are in the "right" order. + for (uint16 x = 0; x < width; x += 8) { + byte pixel = file.readByte(); + for (int bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit != 0) + *(byte *)sign.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + } + } + } + } + + drawPicture(_scrolls, sign, kScreenWidth / 2 - width / 2, y); + + file.close(); +} + void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { // Backup the screen before drawing the bubble. _scrolls.copyFrom(_surface); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c78ac56a9c9e..aa9c209c4f70 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -104,6 +104,7 @@ class GraphicManager { void drawToolbar(); void drawCursor(byte pos); void drawReadyLight(Color color); + void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void prepareBubble(int xc, int xw, int my, Common::Point points[3]); From 8408fa46c73de4923e456ee13210f171953ad820 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 1 Oct 2013 09:40:41 +0200 Subject: [PATCH 1163/1332] AVALANCHE: Implement Dialogs::displayQuestion(), repair setSeed() and getRandomNumber() calls. --- engines/avalanche/avalanche.cpp | 4 +++- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/closing.cpp | 4 ++-- engines/avalanche/dialogs.cpp | 13 ++++++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 251cc0c71a1b..645178418097 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -51,7 +51,9 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); - _rnd->setSeed(42); + TimeDate time; + _system->getTimeAndDate(time); + _rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour); // Needed because of Lucerna::load_also() for (int i = 0; i < 31; i++) { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 79f89535b348..4dac2ccedcb9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1526,7 +1526,7 @@ void AvalancheEngine::newGame() { _her = kPeoplePardon; _it = Parser::kPardon; _lastPerson = kPeoplePardon; // = Pardon? - _passwordNum = _rnd->getRandomNumber(30) + 1; //Random(30) + 1; + _passwordNum = _rnd->getRandomNumber(29) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; _avvyInBed = true; diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 822148499aca..e7314a05501a 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -66,8 +66,8 @@ void Closing::exitGame() { _vm->_sound->stopSound(); getScreen(kScreenNagScreen); - byte nounId = _vm->_rnd->getRandomNumber(12); - byte verbId = _vm->_rnd->getRandomNumber(12); + byte nounId = _vm->_rnd->getRandomNumber(11); + byte verbId = _vm->_rnd->getRandomNumber(11); Common::String result = nouns[nounId] + " will " + verbs[verbId] + " you"; putIn(result, 1628); showScreen(); // No halt- it's already set up. diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 9557b36b7429..c0383045c730 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -34,6 +34,7 @@ #include "common/textconsole.h" #include "common/file.h" +#include "common/random.h" namespace Avalanche { @@ -765,7 +766,17 @@ void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A bool Dialogs::displayQuestion(Common::String question) { displayText(question + kControlNewLine + kControlQuestion); - warning("STUB: Dialogs::displayQuestion()"); + + if (_scReturn && (_vm->_rnd->getRandomNumber(1) == 0)) { // Half-and-half chance. + Common::String tmpStr = Common::String::format("...Positive about that?%cI%c%c%c", kControlRegister, kControlIcon, kControlNewLine, kControlQuestion); + displayText(tmpStr); // Be annoying! + if (_scReturn && (_vm->_rnd->getRandomNumber(3) == 3)) { // Another 25% chance + // \? are used to avoid that ??! is parsed as a trigraph + tmpStr = Common::String::format("%c100%% certain\?\?!%c%c%c%c", kControlInsertSpaces, kControlInsertSpaces, kControlIcon, kControlNewLine, kControlQuestion); + displayText(tmpStr); // Be very annoying! + } + } + return _scReturn; } From bb8157772cca0f5c7192781a8816af35b09e88e2 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 1 Oct 2013 09:57:41 +0200 Subject: [PATCH 1164/1332] AVALANCHE: Rename getIcon() to drawIcon(), move it to Graphics from Dialogs, implement it. Repair Dialogs::scrollModeDialogue(). --- engines/avalanche/dialogs.cpp | 23 ++--------------------- engines/avalanche/dialogs.h | 1 - engines/avalanche/graphics.cpp | 16 ++++++++++++++++ engines/avalanche/graphics.h | 1 + 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index c0383045c730..34c32c04af13 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -192,7 +192,7 @@ void Dialogs::scrollModeDialogue() { cursorPos.y /= 2; char inChar = 0; - if (event.type == Common::EVENT_KEYDOWN) { + if ((event.type == Common::EVENT_KEYDOWN) && (event.kbd.ascii <= 122) && (event.kbd.ascii >= 97)) { inChar = (char)event.kbd.ascii; Common::String temp(inChar); temp.toUppercase(); @@ -363,25 +363,6 @@ void Dialogs::unDodgem() { g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } -void Dialogs::getIcon(int16 x, int16 y, byte which) { - Common::File file; - - if (!file.open("icons.avd")) - error("AVALANCHE: Scrolls: File not found: icons.avd"); - - which--; - file.seek(which * 426); - - byte *p = new byte[426]; - file.read(p, 426); - - //putimage(x, y, p, 0); - warning("STUB: Scrolls::getIcon()"); - - delete[] p; - file.close(); -} - void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; int16 ly = (_maxLineNum + 1) * 6; @@ -423,7 +404,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { } if ((1 <= _useIcon) && (_useIcon <= 33)) { // Standard icon. - getIcon(mx, my + ly / 2, _useIcon); + _vm->_graphics->drawIcon(mx, my + ly / 2, _useIcon); iconIndent = 53; } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 19ee9e36a272..745169d7944e 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -125,7 +125,6 @@ class Dialogs { void say(int16 x, int16 y, Common::String text); void resetScrollDriver(); void ringBell(); // Original: dingdongbell - void getIcon(int16 x, int16 y, byte which); void loadFont(); // From Visa: diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4435e5939bf7..a7d9c3964e68 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -594,6 +594,22 @@ void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { file.close(); } +void GraphicManager::drawIcon(int16 x, int16 y, byte which) { + Common::File file; + + if (!file.open("icons.avd")) + error("AVALANCHE: Scrolls: File not found: icons.avd"); + + which--; + file.seek(which * 426); + + Graphics::Surface icon = loadPictureGraphic(file); + drawPicture(_scrolls, icon, x, y); + + icon.free(); + file.close(); +} + void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { // Backup the screen before drawing the bubble. _scrolls.copyFrom(_surface); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index aa9c209c4f70..a09552fc91c5 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -105,6 +105,7 @@ class GraphicManager { void drawCursor(byte pos); void drawReadyLight(Color color); void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. + void drawIcon(int16 x, int16 y, byte which); // Draws an icon to the current scroll. void prepareBubble(int xc, int xw, int my, Common::Point points[3]); From f9a5eb4629472df1d1d8ba62f9c2e54f1c9a383a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 21:04:37 +0200 Subject: [PATCH 1165/1332] AVALANCHE: Set private some more variables --- engines/avalanche/animation.h | 3 ++- engines/avalanche/avalanche.h | 7 ++----- engines/avalanche/menu.cpp | 36 +++++++++++++++++------------------ engines/avalanche/menu.h | 1 + 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index d5d85106d844..e880fbf9e75c 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -61,7 +61,6 @@ class AnimationType { Direction _facingDir; byte _stepNum; int16 _x, _y; // Current xy coords. - int16 _oldX[2], _oldY[2]; // Last xy coords. int8 _moveX, _moveY; // Amount to move sprite by, each step. byte _id; bool _quick, _visible, _homing, _doCheck; @@ -91,6 +90,8 @@ class AnimationType { private: Animation *_anim; + int16 _oldX[2], _oldY[2]; // Last xy coords. + bool checkCollision(); int8 getSign(int16 val); }; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 845aa09f0865..6f03132e587c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -261,16 +261,12 @@ class AvalancheEngine : public Engine { bool _letMeOut; byte _thinks; bool _thinkThing; - - - int16 _talkX, _talkY; bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; // Called .free() for them in ~Gyro(). - int8 _scoreToDisplay[3]; + byte _currentMouse; // current mouse-void - Common::String _verbStr; // what you can do with your object. :-) Common::String *_also[31][2]; PedType _peds[15]; MagicType _magics[15]; @@ -361,6 +357,7 @@ class AvalancheEngine : public Engine { bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? byte _roomCount[100]; // Add one to each every time you enter a room Common::String _mouseText; + int8 _scoreToDisplay[3]; Common::File file; Common::String readAlsoStringFromFile(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index f1c638913e0e..a2670ed801e1 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -265,26 +265,26 @@ void Menu::findWhatYouCanDoWithIt() { case kObjectWine: case kObjectPotion: case kObjectInk: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeDrink; break; case kObjectBell: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeRing; break; case kObjectChastity: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; case kObjectLute: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodePlay; break; case kObjectMushroom: case kObjectOnion: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeEat; break; case kObjectClothes: - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeWear; break; default: - _vm->_verbStr = kVerbCodeExam; // Anything else. + _verbStr = kVerbCodeExam; // Anything else. } } @@ -469,11 +469,11 @@ void Menu::setupMenuWith() { if (_vm->_thinkThing) { findWhatYouCanDoWithIt(); - for (uint i = 0; i < _vm->_verbStr.size(); i++) { + for (uint i = 0; i < _verbStr.size(); i++) { char vbchar; Common::String verb; - _vm->_parser->verbOpt(_vm->_verbStr[i], verb, vbchar); + _vm->_parser->verbOpt(_verbStr[i], verb, vbchar); _activeMenuItem.setupOption(verb, vbchar, "", true); } @@ -485,21 +485,21 @@ void Menu::setupMenuWith() { _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { _activeMenuItem.setupOption(Common::String("Give to ") + _vm->getName(_vm->_lastPerson), 'G', "", true); - _vm->_verbStr = _vm->_verbStr + kVerbCodeGive; + _verbStr = _verbStr + kVerbCodeGive; } } else { _activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_thinks), 'T', "", true); - _vm->_verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; + _verbStr = Common::String(kVerbCodeExam) + kVerbCodeTalk; switch (_vm->_thinks) { case kPeopleGeida: case kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); - _vm->_verbStr = _vm->_verbStr + kVerbCodeKiss; + _verbStr = _verbStr + kVerbCodeKiss; break; case kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_wonNim); // True if you HAVEN'T won. - _vm->_verbStr = _vm->_verbStr + kVerbCodePlay; + _verbStr = _verbStr + kVerbCodePlay; break; case kPeopleMalagauche: { bool isSober = !_vm->_teetotal; @@ -508,12 +508,12 @@ void Menu::setupMenuWith() { _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); - _vm->_verbStr = _vm->_verbStr + 101 + 100 + 102 + 103 + 104; + _verbStr = _verbStr + 101 + 100 + 102 + 103 + 104; } break; case kPeopleTrader: _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_objects[kObjectOnion - 1]); - _vm->_verbStr = _vm->_verbStr + 105; + _verbStr = _verbStr + 105; break; } } @@ -622,12 +622,12 @@ void Menu::runMenuWith() { if (_vm->_thinkThing) { _vm->_parser->_thing += 49; - if (_vm->_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) + if (_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) _vm->_parser->_person = _vm->_lastPerson; else _vm->_parser->_person = kPeoplePardon; } else { - switch (_vm->_verbStr[_activeMenuItem._choiceNum]) { + switch (_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer _vm->_parser->_thing = 100; _vm->callVerb(kVerbCodeBuy); @@ -658,7 +658,7 @@ void Menu::runMenuWith() { _vm->_subjectNum = 0; } } - _vm->callVerb((VerbCode)_vm->_verbStr[_activeMenuItem._choiceNum]); + _vm->callVerb((VerbCode)_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index eb357f597dc5..ef74e73d1d0f 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -139,6 +139,7 @@ class Menu { // static const Color kHighlightFontColor = kColorWhite; // static const Color kDisabledColor = kColorDarkgray; + Common::String _verbStr; // what you can do with your object. :-) bool _menuActive; // Kludge so we don't have to keep referring to the menu. AvalancheEngine *_vm; From ce50d8698727bb22b33a86f0d804071247c53fe3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 21:58:01 +0200 Subject: [PATCH 1166/1332] AVALANCHE: Remove useless variable, move variables to dialogs --- engines/avalanche/avalanche.h | 6 ++-- engines/avalanche/avalot.cpp | 1 - engines/avalanche/dialogs.cpp | 55 ++++++++++++++++++----------------- engines/avalanche/dialogs.h | 2 ++ engines/avalanche/menu.cpp | 2 -- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 6f03132e587c..f024f247fa9d 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -273,13 +273,10 @@ class AvalancheEngine : public Engine { MagicType _portals[7]; FieldType _fields[30]; byte _fieldNum; - Common::String _flags; Common::String _listen; - byte _cp, _ledStatus, _defaultLed; + byte _cp, _ledStatus; FontType _font; bool _alive; - byte _buffer[2000]; - uint16 _bufSize; int16 _underScroll; // Y-coord of just under the scroll text. Common::String _roomnName; // Name of actual room Common::String _subject; // What you're talking to them about. @@ -357,6 +354,7 @@ class AvalancheEngine : public Engine { bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? byte _roomCount[100]; // Add one to each every time you enter a room Common::String _mouseText; + Common::String _flags; int8 _scoreToDisplay[3]; Common::File file; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4dac2ccedcb9..0c5685bf36c9 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -402,7 +402,6 @@ void AvalancheEngine::init() { _cheat = false; _cp = 0; _ledStatus = 177; - _defaultLed = 2; for (int i = 0; i < 3; i++) _scoreToDisplay[i] = -1; // Impossible digits. _holdTheDawn = false; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 34c32c04af13..f04c2338095c 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -569,32 +569,30 @@ void Dialogs::callDialogDriver() { bool mouthnext = false; bool callSpriteRun = true; // Only call sprite_run the FIRST time. - switch (_vm->_buffer[_vm->_bufSize - 1]) { + switch (_buffer[_bufSize - 1]) { case kControlToBuffer: - _vm->_bufSize--; + _bufSize--; break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: - _vm->_buffer[_vm->_bufSize] = kControlParagraph; - _vm->_bufSize++; + _buffer[_bufSize] = kControlParagraph; + _bufSize++; } - uint16 size = _vm->_bufSize; - - for (uint16 i = 0; i < size; i++) { + for (uint16 i = 0; i < _bufSize; i++) { if (mouthnext) { - if (_vm->_buffer[i] == kControlRegister) + if (_buffer[i] == kControlRegister) _param = 0; - else if (('0' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= '9')) - _param = _vm->_buffer[i] - 48; - else if (('A' <= _vm->_buffer[i]) && (_vm->_buffer[i] <= 'Z')) - _param = _vm->_buffer[i] - 55; + else if (('0' <= _buffer[i]) && (_buffer[i] <= '9')) + _param = _buffer[i] - 48; + else if (('A' <= _buffer[i]) && (_buffer[i] <= 'Z')) + _param = _buffer[i] - 55; mouthnext = false; } else { - switch (_vm->_buffer[i]) { + switch (_buffer[i]) { case kControlParagraph: if ((_maxLineNum == 0) && (_scroll[0].empty())) break; @@ -732,7 +730,7 @@ void Dialogs::callDialogDriver() { solidify(_maxLineNum); _maxLineNum++; } - _scroll[_maxLineNum] += _vm->_buffer[i]; + _scroll[_maxLineNum] += _buffer[i]; break; } } @@ -740,8 +738,8 @@ void Dialogs::callDialogDriver() { } void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _vm->_bufSize = text.size(); - memcpy(_vm->_buffer, text.c_str(), _vm->_bufSize); + _bufSize = text.size(); + memcpy(_buffer, text.c_str(), _bufSize); callDialogDriver(); } @@ -801,13 +799,14 @@ void Dialogs::displayMusicalScroll() { // From Visa: void Dialogs::unSkrimble() { - for (uint16 i = 0; i < _vm->_bufSize; i++) - _vm->_buffer[i] = (~(_vm->_buffer[i] - (i + 1))) % 256; + for (uint16 i = 0; i < _bufSize; i++) + _buffer[i] = (~(_buffer[i] - (i + 1))) % 256; } void Dialogs::doTheBubble() { - _vm->_buffer[_vm->_bufSize] = 2; - _vm->_bufSize++; + _buffer[_bufSize] = 2; + _bufSize++; + assert(_bufSize < 2000); } /** @@ -848,8 +847,9 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _vm->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_buffer, _vm->_bufSize); + _bufSize = sezfile.readUint16LE(); + assert(_bufSize < 2000); + sezfile.read(_buffer, _bufSize); sezfile.close(); unSkrimble(); @@ -884,8 +884,8 @@ void Dialogs::speak(byte who, byte subject) { return; indexfile.seek(idx_offset + subject * 2); - uint16 sez_offset = indexfile.readUint16LE(); - if ((sez_offset == 0) || (indexfile.err())) + uint16 sezOffset = indexfile.readUint16LE(); + if ((sezOffset == 0) || (indexfile.err())) return; indexfile.close(); @@ -893,9 +893,10 @@ void Dialogs::speak(byte who, byte subject) { if (!sezfile.open("avalot.sez")) error("AVALANCHE: Visa: File not found: avalot.sez"); - sezfile.seek(sez_offset); - _vm->_bufSize = sezfile.readUint16LE(); - sezfile.read(_vm->_buffer, _vm->_bufSize); + sezfile.seek(sezOffset); + _bufSize = sezfile.readUint16LE(); + assert(_bufSize < 2000); + sezfile.read(_buffer, _bufSize); sezfile.close(); unSkrimble(); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 745169d7944e..9c70767eb1f0 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -103,6 +103,8 @@ class Dialogs { byte _maxLineNum; bool _scReturn; byte _scrollBells; // no. of times to ring the bell + byte _buffer[2000]; + uint16 _bufSize; // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index a2670ed801e1..23c49cc1213a 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -134,7 +134,6 @@ void MenuItem::display() { for (int y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_defaultLed = 1; _dr->_vm->_currentMouse = 177; CursorMan.showMouse(true); // 4 = fletch @@ -148,7 +147,6 @@ void MenuItem::wipe() { _activeNow = false; _dr->_menuActive = false; _firstlix = false; - _dr->_vm->_defaultLed = 2; CursorMan.showMouse(true); } From ae456719738cfbcfa5f756d0fd1cfc82a99057fd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 22:52:30 +0200 Subject: [PATCH 1167/1332] AVALANCHE: More work on variables --- engines/avalanche/avalanche.h | 54 ++++++++++++++++------------------- engines/avalanche/avalot.cpp | 11 +------ engines/avalanche/dialogs.cpp | 6 ++-- engines/avalanche/dialogs.h | 1 + engines/avalanche/menu.cpp | 14 +++++---- engines/avalanche/menu.h | 2 ++ engines/avalanche/parser.cpp | 4 --- engines/avalanche/parser.h | 2 -- 8 files changed, 41 insertions(+), 53 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index f024f247fa9d..cbbc469ac5e3 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -277,46 +277,27 @@ class AvalancheEngine : public Engine { byte _cp, _ledStatus; FontType _font; bool _alive; - int16 _underScroll; // Y-coord of just under the scroll text. - Common::String _roomnName; // Name of actual room - Common::String _subject; // What you're talking to them about. byte _subjectNum; // The same thing. - bool _keyboardClick; // Is a keyboard click noise wanted? People _him, _her; byte _it; uint32 _roomTime; // Set to 0 when you enter a room, added to in every loop. - People _lastPerson; // Last person to have been selected using the People menu. bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites. - bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. bool _isLoaded; // Is it a loaded gamestate? bool _soundFx; - void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). - void setup(); - void runAvalot(); - - void init(); void callVerb(VerbCode id); void loadRoom(byte num); - void exitRoom(byte x); - void enterRoom(Room room, byte ped); void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!! - void drawToolbar(); - void drawScore(); void incScore(byte num); // Add on no. of points - void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. void fxToggle(); void refreshObjectList(); - void checkClick(); void errorLed(); void dusk(); void dawn(); void drawDirection(); // Draws the little icon at the left end of the text input field. void gameOver(); uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. - void fixFlashers(); - void loadAlso(byte num); // There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING. void minorRedraw(); @@ -326,12 +307,13 @@ class AvalancheEngine : public Engine { Common::String intToStr(int32 num); - void resetVariables(); + + + + void newGame(); // This sets up the DNA for a completely new game. - void slowDown(); bool getFlag(char x); bool decreaseMoney(uint16 amount); // Called pennycheck in the original. - void hangAroundForAWhile(); Common::String getName(People whose); byte getNameChar(People whose); @@ -348,31 +330,45 @@ class AvalancheEngine : public Engine { private: static Room _whereIs[29]; + // Will be used in dusk() and dawn(). + bool _fxHidden; bool _spludwickAtHome; // Is Spludwick at home? + bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? + bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. byte _lastRoom; byte _lastRoomNotMap; - bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? byte _roomCount[100]; // Add one to each every time you enter a room Common::String _mouseText; Common::String _flags; + Common::String _roomnName; // Name of actual room int8 _scoreToDisplay[3]; Common::File file; Common::String readAlsoStringFromFile(); + + void runAvalot(); + void init(); + void setup(); void scram(Common::String &str); void unScramble(); - + void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void enterNewTown(); void findPeople(byte room); void putGeidaAt(byte whichPed, byte ped); void guideAvvy(Common::Point cursorPos); - - // Will be used in dusk() and dawn(). - bool _fxHidden; - - int8 fades(int8 x); void fadeOut(byte n); void fadeIn(byte n); + void enterRoom(Room room, byte ped); + void exitRoom(byte x); + void drawToolbar(); + void drawScore(); + void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement. + void checkClick(); + void fixFlashers(); + void loadAlso(byte num); + void resetVariables(); + + int8 fades(int8 x); }; } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 0c5685bf36c9..29224c100963 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1485,6 +1485,7 @@ void AvalancheEngine::resetVariables() { _animation->resetVariables(); _sequence->resetVariables(); _background->resetVariables(); + _menu->resetVariables(); } void AvalancheEngine::newGame() { @@ -1524,7 +1525,6 @@ void AvalancheEngine::newGame() { _him = kPeoplePardon; _her = kPeoplePardon; _it = Parser::kPardon; - _lastPerson = kPeoplePardon; // = Pardon? _passwordNum = _rnd->getRandomNumber(29) + 1; //Random(30) + 1; _userMovesAvvy = false; _doingSpriteRun = false; @@ -1538,10 +1538,6 @@ void AvalancheEngine::newGame() { spriteRun(); } -void AvalancheEngine::slowDown() { - warning("STUB: slowdown()"); -} - bool AvalancheEngine::getFlag(char x) { for (uint16 i = 0; i < _flags.size(); i++) { if (_flags[i] == x) @@ -1708,11 +1704,6 @@ Common::String AvalancheEngine::f5Does() { return Common::String::format("%c", kVerbCodePardon); // If all else fails... } -void AvalancheEngine::hangAroundForAWhile() { - for (int i = 0; i < 28; i++) - slowDown(); -} - void AvalancheEngine::flipRoom(Room room, byte ped) { assert((ped > 0) && (ped < 15)); if (!_alive) { diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index f04c2338095c..926f6624b51f 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -354,12 +354,12 @@ void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); - g_system->warpMouse(_dodgeCoord.x, _vm->_underScroll); // Move the pointer off the scroll. + g_system->warpMouse(_dodgeCoord.x, _underScroll); // Move the pointer off the scroll. } void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); - if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_underScroll)) + if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _underScroll)) g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. } @@ -436,7 +436,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { my += 12; } - _vm->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. + _underScroll = (my + 3) * 2; // Multiplying because of the doubled screen height. ringBell(); _vm->_dropsOk = false; diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 9c70767eb1f0..9cd4e729d4d8 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -105,6 +105,7 @@ class Dialogs { byte _scrollBells; // no. of times to ring the bell byte _buffer[2000]; uint16 _bufSize; + int16 _underScroll; // Y-coord of just under the scroll text. // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 23c49cc1213a..92949c5be295 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -478,11 +478,11 @@ void Menu::setupMenuWith() { // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // or (c), the _person you've selected is YOU! - if ((_vm->_lastPerson == kPeopleAvalot) || (_vm->_lastPerson == _vm->_parser->kNothing) - || (_vm->getRoom(_vm->_lastPerson) != _vm->_room)) + if ((_lastPerson == kPeopleAvalot) || (_lastPerson == _vm->_parser->kNothing) + || (_vm->getRoom(_lastPerson) != _vm->_room)) _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. else { - _activeMenuItem.setupOption(Common::String("Give to ") + _vm->getName(_vm->_lastPerson), 'G', "", true); + _activeMenuItem.setupOption(Common::String("Give to ") + _vm->getName(_lastPerson), 'G', "", true); _verbStr = _verbStr + kVerbCodeGive; } } else { @@ -611,7 +611,7 @@ void Menu::runMenuObjects() { void Menu::runMenuPeople() { _vm->thinkAbout(people[_activeMenuItem._choiceNum], AvalancheEngine::kPerson); - _vm->_lastPerson = (People)people[_activeMenuItem._choiceNum]; + _lastPerson = (People)people[_activeMenuItem._choiceNum]; } void Menu::runMenuWith() { @@ -621,7 +621,7 @@ void Menu::runMenuWith() { _vm->_parser->_thing += 49; if (_verbStr[_activeMenuItem._choiceNum] == kVerbCodeGive) - _vm->_parser->_person = _vm->_lastPerson; + _vm->_parser->_person = _lastPerson; else _vm->_parser->_person = kPeoplePardon; } else { @@ -771,4 +771,8 @@ bool Menu::isActive() { void Menu::init() { _menuActive = false; } + +void Menu::resetVariables() { + _lastPerson = kPeoplePardon; // = Pardon? +} } // End of namespace Avalanche. diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index ef74e73d1d0f..5de54a2dc863 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -128,6 +128,7 @@ class Menu { void setup(); // Standard menu bar. bool isActive(); void init(); + void resetVariables(); private: static const byte kIndent = 5; @@ -141,6 +142,7 @@ class Menu { Common::String _verbStr; // what you can do with your object. :-) bool _menuActive; // Kludge so we don't have to keep referring to the menu. + People _lastPerson; // Last person to have been selected using the People menu. AvalancheEngine *_vm; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 2064fa7deccf..beb683a2ce30 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -820,8 +820,6 @@ void Parser::parse() { } // Second parsing. - if (!_vm->_subject.empty()) - _vm->_subject.clear(); _vm->_subjectNum = 0; // Find subject of conversation. for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) { @@ -1380,7 +1378,6 @@ void Parser::drink() { _vm->_avvyInBed = true; _vm->refreshObjectList(); _vm->dusk(); - _vm->hangAroundForAWhile(); _vm->flipRoom(kRoomYours, 1); _vm->_graphics->setBackgroundColor(kColorYellow); _vm->_animation->_sprites[0]._visible = false; @@ -2284,7 +2281,6 @@ void Parser::doThat() { } } else { // Default doodah. _vm->dusk(); - _vm->hangAroundForAWhile(); _vm->dawn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); _vm->_dialogs->displayText(tmpStr); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index f20aa9015ab1..4ebf559d85eb 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -148,9 +148,7 @@ class Parser { void winSequence(); Common::String personSpeaks(); void heyThanks(); - void wipeText(); - }; } // End of namespace Avalanche From 199ba0ddf4ec0251c0e70bd56a8f4be0cb6282b7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 23:15:53 +0200 Subject: [PATCH 1168/1332] AVALANCHE: Remove verbosity related to the use of Magics enum --- engines/avalanche/animation.cpp | 172 ++++++++++++++++---------------- engines/avalanche/avalanche.h | 19 ---- engines/avalanche/avalot.cpp | 59 ----------- engines/avalanche/enums.h | 15 ++- engines/avalanche/menu.cpp | 63 +++++++++++- engines/avalanche/menu.h | 4 + engines/avalanche/parser.cpp | 14 +-- engines/avalanche/timer.cpp | 12 +-- 8 files changed, 177 insertions(+), 181 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 836864bf9e8b..fd7da5745c9d 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -191,27 +191,27 @@ void AnimationType::walk() { if ((magicColor != 255) & (!_anim->_vm->_doingSpriteRun)) { MagicType *magic = &_anim->_vm->_magics[magicColor]; switch (magic->_operation) { - case AvalancheEngine::kMagicExclaim: + case kMagicExclaim: bounce(); _anim->_mustExclaim = true; _anim->_sayWhat = magic->_data; break; - case AvalancheEngine::kMagicBounce: + case kMagicBounce: bounce(); break; - case AvalancheEngine::kMagicTransport: + case kMagicTransport: _anim->_vm->flipRoom((Room)(magic->_data >> 8), magic->_data & 0xff); break; - case AvalancheEngine::kMagicUnfinished: { + case kMagicUnfinished: { bounce(); Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); _anim->_vm->_dialogs->displayText(tmpStr); } break; - case AvalancheEngine::kMagicSpecial: + case kMagicSpecial: _anim->callSpecial(magic->_data); break; - case AvalancheEngine::kMagicOpenDoor: + case kMagicOpenDoor: _anim->_vm->openDoor((Room)(magic->_data >> 8), magic->_data & 0xff, magicColor); break; } @@ -427,66 +427,66 @@ void Animation::catacombMove(byte ped) { switch (here & 0xf) { // West. case 0: // no connection (wall) - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); break; case 0x1: // no connection (wall + shield), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x2: // wall with door - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door. break; case 0x3: // wall with door and shield - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 28); // ...shield. break; case 0x4: // no connection (wall + window), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x5: // wall with door and window - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 4); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicNothing; // No door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicNothing; // No door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0x7: // wall with door and torches - _vm->_magics[1]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[4]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[1]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[2]._operation = kMagicNothing; // Straight wall. + _vm->_portals[4]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 27); // Wall, plus... _vm->_background->draw(-1, -1, 29); // ...door, and... _vm->_background->draw(-1, -1, 6); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. - _vm->_magics[2]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. + _vm->_magics[1]._operation = kMagicNothing; // Sloping wall. + _vm->_magics[2]._operation = kMagicSpecial; // Straight wall. break; } @@ -494,90 +494,90 @@ void Animation::catacombMove(byte ped) { switch ((here & 0xf0) >> 4) { // East case 0: // no connection (wall) - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); break; case 0x1: // no connection (wall + window), - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...window. break; case 0x2: // wall with door - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door. break; case 0x3: // wall with door and window - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 19); // ...door, and... _vm->_background->draw(-1, -1, 20); // ...window. break; case 0x6: // no connection (wall + torches), - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // No door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // No door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0x7: // wall with door and torches - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[4]._operation = kMagicBounce; // Sloping wall. + _vm->_magics[5]._operation = kMagicNothing; // Straight wall. + _vm->_portals[6]._operation = kMagicSpecial; // Door. _vm->_background->draw(-1, -1, 18); // Wall, plus... _vm->_background->draw(-1, -1, 20); // ...door, and... _vm->_background->draw(-1, -1, 17); // ...torches. break; case 0xf: // straight-through corridor. - _vm->_magics[4]._operation = AvalancheEngine::kMagicNothing; // Sloping wall. - _vm->_magics[5]._operation = AvalancheEngine::kMagicSpecial; // Straight wall. - _vm->_portals[6]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[4]._operation = kMagicNothing; // Sloping wall. + _vm->_magics[5]._operation = kMagicSpecial; // Straight wall. + _vm->_portals[6]._operation = kMagicNothing; // Door. break; } switch ((here & 0xf00) >> 8) { // South case 0: // No connection. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[11]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; case 0x1: _vm->_background->draw(-1, -1, 21); if ((xy_uint16 == 2051) && (_vm->_geidaFollows)) - _vm->_magics[12]._operation = AvalancheEngine::kMagicExclaim; + _vm->_magics[12]._operation = kMagicExclaim; else - _vm->_magics[12]._operation = AvalancheEngine::kMagicSpecial; // Right exit south. + _vm->_magics[12]._operation = kMagicSpecial; // Right exit south. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[11]._operation = kMagicBounce; break; case 0x2: _vm->_background->draw(-1, -1, 22); - _vm->_magics[6]._operation = AvalancheEngine::kMagicSpecial; // Middle exit south. - _vm->_magics[11]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[6]._operation = kMagicSpecial; // Middle exit south. + _vm->_magics[11]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; case 0x3: _vm->_background->draw(-1, -1, 23); - _vm->_magics[11]._operation = AvalancheEngine::kMagicSpecial; // Left exit south. - _vm->_magics[6]._operation = AvalancheEngine::kMagicBounce; - _vm->_magics[12]._operation = AvalancheEngine::kMagicBounce; + _vm->_magics[11]._operation = kMagicSpecial; // Left exit south. + _vm->_magics[6]._operation = kMagicBounce; + _vm->_magics[12]._operation = kMagicBounce; break; } switch ((here & 0xf000) >> 12) { // North case 0: // No connection - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. break; // LEFT handles: #if 0 @@ -589,8 +589,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x2: _vm->_background->draw(-1, -1, 3); - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[0]._operation = kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; #if 0 case 0x3: @@ -607,8 +607,8 @@ void Animation::catacombMove(byte ped) { #endif case 0x5: _vm->_background->draw(-1, -1, 2); - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; // Middle exit north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_magics[0]._operation = kMagicBounce; // Middle exit north. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; #if 0 case 0x6: @@ -628,25 +628,25 @@ void Animation::catacombMove(byte ped) { if (((here & 0xf000) >> 12) == 0x9) _vm->_background->draw(-1, -1, 31); - _vm->_magics[0]._operation = AvalancheEngine::kMagicSpecial; // Middle arch north. - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicSpecial; // Middle arch north. + _vm->_portals[3]._operation = kMagicNothing; // Door. break; // DECORATIONS: case 0xd: // No connection + WINDOW - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 13); break; case 0xe: // No connection + TORCH - _vm->_magics[0]._operation = AvalancheEngine::kMagicBounce; - _vm->_portals[3]._operation = AvalancheEngine::kMagicNothing; // Door. + _vm->_magics[0]._operation = kMagicBounce; + _vm->_portals[3]._operation = kMagicNothing; // Door. _vm->_background->draw(-1, -1, 7); break; // Recessed door: case 0xf: - _vm->_magics[0]._operation = AvalancheEngine::kMagicNothing; // Door to Geida's room. + _vm->_magics[0]._operation = kMagicNothing; // Door to Geida's room. _vm->_background->draw(-1, -1, 0); - _vm->_portals[3]._operation = AvalancheEngine::kMagicSpecial; // Door. + _vm->_portals[3]._operation = kMagicSpecial; // Door. break; } @@ -701,17 +701,17 @@ void Animation::callSpecial(uint16 which) { case 1: // _vm->special 1: Room 22: top of stairs. _vm->_background->draw(-1, -1, 0); _vm->_brummieStairs = 1; - _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[9]._operation = kMagicNothing; _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); stopWalking(); _vm->_userMovesAvvy = false; break; case 2: // _vm->special 2: Room 22: bottom of stairs. _vm->_brummieStairs = 3; - _vm->_magics[10]._operation = AvalancheEngine::kMagicNothing; - _vm->_magics[11]._operation = AvalancheEngine::kMagicExclaim; + _vm->_magics[10]._operation = kMagicNothing; + _vm->_magics[11]._operation = kMagicExclaim; _vm->_magics[11]._data = 5; - _vm->_magics[3]._operation = AvalancheEngine::kMagicBounce; // Now works as planned! + _vm->_magics[3]._operation = kMagicBounce; // Now works as planned! stopWalking(); _vm->_dialogs->displayScrollChain('q', 26); _vm->_userMovesAvvy = true; @@ -742,7 +742,7 @@ void Animation::callSpecial(uint16 which) { case 5: if (_vm->_friarWillTieYouUp) { // _vm->special 5: Room 42: touched tree, and get tied up. - _vm->_magics[4]._operation = AvalancheEngine::kMagicBounce; // Boundary effect is now working again. + _vm->_magics[4]._operation = kMagicBounce; // Boundary effect is now working again. _vm->_dialogs->displayScrollChain('q', 35); _sprites[0].remove(); //tr[1].vanishifstill:=true; @@ -766,7 +766,7 @@ void Animation::callSpecial(uint16 which) { break; case 7: // _vm->special 7: stop falling down oubliette. _sprites[0]._visible = false; - _vm->_magics[9]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[9]._operation = kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); //_vm->mblit(12, 80, 38, 160, 3, 0); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index cbbc469ac5e3..d7941ee485e4 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -169,17 +169,6 @@ class AvalancheEngine : public Engine { static const bool kThing = true; static const bool kPerson = false; - // Magic/portal constants: - enum Magics { - kMagicNothing, // Ignore it if this line is touched. - kMagicBounce, // Bounce off this line. Not valid for portals. - kMagicExclaim, // Put up a chain of scrolls. - kMagicTransport, // Enter new room. - kMagicUnfinished, // Unfinished connection. - kMagicSpecial, // Special function. - kMagicOpenDoor // Opening door. - }; - // These following static constants should be included in CFG when it's written. static const int16 kWalk = 3; static const int16 kRun = 5; @@ -306,19 +295,11 @@ class AvalancheEngine : public Engine { void spriteRun(); Common::String intToStr(int32 num); - - - - - void newGame(); // This sets up the DNA for a completely new game. bool getFlag(char x); bool decreaseMoney(uint16 amount); // Called pennycheck in the original. Common::String getName(People whose); - byte getNameChar(People whose); - Common::String getThing(byte which); - char getThingChar(byte which); Common::String getItem(byte which); // Called get_better in the original. Common::String f5Does(); // This procedure determines what f5 does. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 29224c100963..4732bbbd1e9d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1572,65 +1572,6 @@ Common::String AvalancheEngine::getName(People whose) { return kLasses[whose - kPeopleArkata]; } -byte AvalancheEngine::getNameChar(People whose) { - static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; - static const char kLassChar[] = "kG\0xB1o"; - - if (whose < kPeopleArkata) - return kLadChar[whose - kPeopleAvalot]; - else - return kLassChar[whose - kPeopleArkata]; -} - -Common::String AvalancheEngine::getThing(byte which) { - static const Common::String kThings[kObjectNum] = { - "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", - "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", - "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" - }; - - Common::String get_thing_result; - switch (which) { - case kObjectWine: - switch (_wineState) { - case 1: - case 4: - get_thing_result = kThings[which - 1]; - break; - case 3: - get_thing_result = "Vinegar"; - break; - } - break; - case kObjectOnion: - if (_rottenOnion) - get_thing_result = "rotten onion"; - else - get_thing_result = kThings[which - 1]; - break; - default: - get_thing_result = kThings[which - 1]; - } - return get_thing_result; -} - -char AvalancheEngine::getThingChar(byte which) { - static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar - - char get_thingchar_result; - switch (which) { - case kObjectWine: - if (_wineState == 3) - get_thingchar_result = 'V'; // Vinegar - else - get_thingchar_result = kThingsChar[which - 1]; - break; - default: - get_thingchar_result = kThingsChar[which - 1]; - } - return get_thingchar_result; -} - Common::String AvalancheEngine::getItem(byte which) { static const Common::String kItems[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index e10033a64cf6..779bfb7e7c9d 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -85,14 +85,25 @@ enum VerbCode { kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253, kVerbCodePardon = 254 }; -} // End of namespace Avalanche - enum MouseCursor { kCurUpArrow = 0, kCurScrewDriver = 1, kCurRightArrow = 2, kCurFletch = 3, kCurWait = 4, kCurHand = 5, kCurCrosshair = 6, kCurIBeam = 7 }; +// Magic/portal constants: +enum Magics { + kMagicNothing, // Ignore it if this line is touched. + kMagicBounce, // Bounce off this line. Not valid for portals. + kMagicExclaim, // Put up a chain of scrolls. + kMagicTransport, // Enter new room. + kMagicUnfinished, // Unfinished connection. + kMagicSpecial, // Special function. + kMagicOpenDoor // Opening door. +}; + static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; +} // End of namespace Avalanche + #endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 92949c5be295..2a3e3d945328 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -444,7 +444,7 @@ void Menu::setupMenuPeople() { for (int i = kPeopleAvalot; i <= kPeopleWisewoman; i++) { if (_vm->getRoom((People)i) == _vm->_room) { - _activeMenuItem.setupOption(_vm->getName((People)i), _vm->getNameChar((People)i), "", true); + _activeMenuItem.setupOption(_vm->getName((People)i), getNameChar((People)i), "", true); people += i; } } @@ -456,7 +456,7 @@ void Menu::setupMenuObjects() { _activeMenuItem.reset(); for (int i = 0; i < kObjectNum; i++) { if (_vm->_objects[i]) - _activeMenuItem.setupOption(_vm->getThing(i + 1), _vm->getThingChar(i + 1), "", true); + _activeMenuItem.setupOption(getThing(i + 1), getThingChar(i + 1), "", true); } _activeMenuItem.display(); } @@ -764,6 +764,65 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _vm->_graphics->removeBackup(); } +char Menu::getThingChar(byte which) { + static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar + + char result; + switch (which) { + case kObjectWine: + if (_vm->_wineState == 3) + result = 'V'; // Vinegar + else + result = kThingsChar[which - 1]; + break; + default: + result = kThingsChar[which - 1]; + } + return result; +} + +byte Menu::getNameChar(People whose) { + static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; + static const char kLassChar[] = "kG\0xB1o"; + + if (whose < kPeopleArkata) + return kLadChar[whose - kPeopleAvalot]; + else + return kLassChar[whose - kPeopleArkata]; +} + +Common::String Menu::getThing(byte which) { + static const Common::String kThings[kObjectNum] = { + "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", + "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", + "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" + }; + + Common::String result; + switch (which) { + case kObjectWine: + switch (_vm->_wineState) { + case 1: + case 4: + result = kThings[which - 1]; + break; + case 3: + result = "Vinegar"; + break; + } + break; + case kObjectOnion: + if (_vm->_rottenOnion) + result = "rotten onion"; + else + result = kThings[which - 1]; + break; + default: + result = kThings[which - 1]; + } + return result; +} + bool Menu::isActive() { return _menuActive; } diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index 5de54a2dc863..a71093b6ad47 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -151,6 +151,10 @@ class Menu { void drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted); void bleep(); + char getThingChar(byte which); + byte getNameChar(People whose); + Common::String getThing(byte which); + void setupMenuGame(); void setupMenuFile(); void setupMenuAction(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index beb683a2ce30..979c45153100 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -674,7 +674,7 @@ void Parser::storeInterrogation(byte interrogation) { _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! - _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[1]._operation = kMagicNothing; _vm->_cardiffQuestionNum = 5; break; case 99: @@ -1193,21 +1193,21 @@ void Parser::openDoor() { if (_vm->_animation->inField(i + 8)) { MagicType *portal = &_vm->_portals[i]; switch (portal->_operation) { - case AvalancheEngine::kMagicExclaim: + case kMagicExclaim: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; - case AvalancheEngine::kMagicTransport: + case kMagicTransport: _vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; - case AvalancheEngine::kMagicUnfinished: + case kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; - case AvalancheEngine::kMagicSpecial: + case kMagicSpecial: _vm->_animation->callSpecial(portal->_data); break; - case AvalancheEngine::kMagicOpenDoor: + case kMagicOpenDoor: _vm->openDoor((Room)(portal->_data >> 8), portal->_data & 0x0F, i + 9); break; } @@ -2148,7 +2148,7 @@ void Parser::doThat() { _vm->_objects[kObjectBolt - 1] = false; _vm->_objects[kObjectCrossbow - 1] = false; _vm->refreshObjectList(); - _vm->_magics[11]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[11]._operation = kMagicNothing; _vm->incScore(7); _vm->_animation->_sprites[1].walkTo(1); _vm->_animation->_sprites[1]._vanishIfStill = true; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 1d145e439e1c..ff5cf828c5e8 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -232,7 +232,7 @@ void Timer::openDrawbridge() { _vm->_background->draw(-1, -1, _vm->_drawbridgeOpen - 2); if (_vm->_drawbridgeOpen == 4) - _vm->_magics[1]._operation = AvalancheEngine::kMagicNothing; // You may enter the drawbridge. + _vm->_magics[1]._operation = kMagicNothing; // You may enter the drawbridge. else addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); } @@ -273,9 +273,9 @@ void Timer::stairs() { _vm->_animation->_sprites[0].walkTo(3); _vm->_background->draw(-1, -1, 1); _vm->_brummieStairs = 2; - _vm->_magics[10]._operation = AvalancheEngine::kMagicSpecial; + _vm->_magics[10]._operation = kMagicSpecial; _vm->_magics[10]._data = 2; // Reached the bottom of the stairs. - _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // Stop them hitting the sides (or the game will hang.) + _vm->_magics[3]._operation = kMagicNothing; // Stop them hitting the sides (or the game will hang.) } void Timer::cardiffSurvey() { @@ -315,7 +315,7 @@ void Timer::getTiedUp() { void Timer::getTiedUp2() { _vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[1].walkTo(4); - _vm->_magics[3]._operation = AvalancheEngine::kMagicNothing; // No effect when you touch the boundaries. + _vm->_magics[3]._operation = kMagicNothing; // No effect when you touch the boundaries. _vm->_friarWillTieYouUp = true; } @@ -395,7 +395,7 @@ void Timer::jacquesWakesUp() { case 2 : // Going through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor. _vm->_background->draw(-1, -1, 2); // But going through the door. - _vm->_magics[5]._operation = AvalancheEngine::kMagicNothing; // You can't wake him up now. + _vm->_magics[5]._operation = kMagicNothing; // You can't wake him up now. break; case 3 : // Gone through the door. _vm->_background->draw(-1, -1, 1); // Not on the floor, either. @@ -538,7 +538,7 @@ void Timer::greetsMonk() { } void Timer::fallDownOubliette() { - _vm->_magics[8]._operation = AvalancheEngine::kMagicNothing; + _vm->_magics[8]._operation = kMagicNothing; AnimationType *avvy = &_vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! From c9432b8467ee5ef489a2d99f91edefb26dd31d60 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 23:23:07 +0200 Subject: [PATCH 1169/1332] AVALANCHE: more work on variables --- engines/avalanche/avalanche.h | 3 --- engines/avalanche/avalot.cpp | 3 --- engines/avalanche/parser.cpp | 7 +++++-- engines/avalanche/parser.h | 3 +++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index d7941ee485e4..a54e092d2f00 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -179,9 +179,6 @@ class AvalancheEngine : public Engine { static const uint16 kNotes[12]; static const TuneType kTune; - static const char *kVersionNum; - static const char *kCopyright; - bool _holdLeftMouse; // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4732bbbd1e9d..5ccb1ca6e6e3 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -37,9 +37,6 @@ namespace Avalanche { -const char *AvalancheEngine::kVersionNum = "1.30"; -const char *AvalancheEngine::kCopyright = "1995"; - const MouseHotspotType AvalancheEngine::kMouseHotSpots[9] = { {8,0}, // 0 - up-arrow {0,0}, // 1 - screwdriver diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 979c45153100..cc65386b4fba 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -41,6 +41,9 @@ namespace Avalanche { +const char *Parser::kCopyright = "1995"; +const char *Parser::kVersionNum = "1.30"; + Parser::Parser(AvalancheEngine *vm) { _vm = vm; } @@ -1803,8 +1806,8 @@ void Parser::doThat() { toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine + "The medi\x91val descendant of" + Dialogs::kControlNewLine + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + _vm->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + _vm->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + + "version " + kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " + + kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; _vm->_dialogs->displayText(toDisplay); _vm->_dialogs->_aboutBox = false; } diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 4ebf559d85eb..98adc3bbcd0e 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -103,6 +103,9 @@ class Parser { Common::String _title; }; + static const char *kCopyright; + static const char *kVersionNum; + Common::String _thats; byte _thing2; byte _sworeNum; // number of times you've sworn From 5a4bd0d837a780be737a9c7d978d23a4c2954606 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 23:31:31 +0200 Subject: [PATCH 1170/1332] AVALANCHE: some more work on variables --- engines/avalanche/avalanche.h | 4 +--- engines/avalanche/avalot.cpp | 12 ------------ engines/avalanche/avalot.h | 4 ---- engines/avalanche/graphics.cpp | 14 +++++++++++++- engines/avalanche/graphics.h | 6 ++++++ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index a54e092d2f00..d68d837c2c04 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -162,9 +162,6 @@ class AvalancheEngine : public Engine { #endif public: - static const MouseHotspotType kMouseHotSpots[9]; - static const int16 kMaxSprites = 2; // Current max no. of sprites. - // For Thinkabout: static const bool kThing = true; static const bool kPerson = false; @@ -306,6 +303,7 @@ class AvalancheEngine : public Engine { void setRoom(People persId, Room roomId); Room getRoom(People persId); private: + static const int16 kMaxSprites = 2; // Current max no. of sprites. static Room _whereIs[29]; // Will be used in dusk() and dawn(). diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5ccb1ca6e6e3..aa4f73d3add0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -37,18 +37,6 @@ namespace Avalanche { -const MouseHotspotType AvalancheEngine::kMouseHotSpots[9] = { - {8,0}, // 0 - up-arrow - {0,0}, // 1 - screwdriver - {15,6}, // 2 - right-arrow - {0,0}, // 3 - fletch - {8,7}, // 4 - hourglass - {4,0}, // 5 - TTHand - {8,5}, // 6 - Mark's crosshairs - {8,7}, // 7 - I-beam - {0,0} // 8 - question mark -}; - // Art gallery at 2,1; notice about this at 2,2. const int32 AvalancheEngine::kCatacombMap[8][8] = { // Geida's room diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 292596b89f80..5381edd6cb34 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -69,10 +69,6 @@ static const int16 kCarryLimit = 12; // carry limit static const int16 kNumlockCode = 32; // Code for Num Lock static const int16 kMouseSize = 134; -struct MouseHotspotType { // mouse-void - int16 _horizontal, _vertical; -}; - struct PedType { int16 _x, _y; Direction _direction; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a7d9c3964e68..4c398dfd20d2 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -38,6 +38,18 @@ namespace Avalanche { const byte GraphicManager::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63}; +const MouseHotspotType GraphicManager::kMouseHotSpots[9] = { + {8,0}, // 0 - up-arrow + {0,0}, // 1 - screwdriver + {15,6}, // 2 - right-arrow + {0,0}, // 3 - fletch + {8,7}, // 4 - hourglass + {4,0}, // 5 - TTHand + {8,5}, // 6 - Mark's crosshairs + {8,7}, // 7 - I-beam + {0,0} // 8 - question mark +}; + GraphicManager::GraphicManager(AvalancheEngine *vm) { _vm = vm; } @@ -144,7 +156,7 @@ void GraphicManager::loadMouse(byte which) { mask.free(); f.close(); - CursorMan.replaceCursor(cursor.getPixels(), 16, 32, AvalancheEngine::kMouseHotSpots[which]._horizontal, AvalancheEngine::kMouseHotSpots[which]._vertical * 2, 255, false); + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); cursor.free(); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index a09552fc91c5..b3710742cabe 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -55,8 +55,14 @@ class SpriteInfo { uint16 _size; // The size of one picture. }; +struct MouseHotspotType { // mouse-void + int16 _horizontal, _vertical; +}; + class GraphicManager { public: + static const MouseHotspotType kMouseHotSpots[9]; + Graphics::Surface _surface; Color _talkBackgroundColor, _talkFontColor; From 546e911af998bb4948e4c930abfc731391d04509 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Oct 2013 07:25:20 +0200 Subject: [PATCH 1171/1332] AVALANCHE: Use Doxygen comments in Animation --- engines/avalanche/animation.cpp | 68 +++++++++++++++++++++++++++++++-- engines/avalanche/animation.h | 45 +++++++++++----------- 2 files changed, 87 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index fd7da5745c9d..74307e73ffff 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -40,6 +40,9 @@ namespace Avalanche { +/** + * Loads & sets up the sprite. + */ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _anim = anim; @@ -123,11 +126,19 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { inf.close(); } +/** + * Just sets 'quick' to false. + * @remarks Originally called 'original' + */ void AnimationType::reset() { _quick = false; _id = 177; } +/** + * Drops sprite onto screen. + * @remarks Originally called 'andexor' + */ void AnimationType::draw() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; @@ -137,6 +148,9 @@ void AnimationType::draw() { _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } +/** + * Turns character round. + */ void AnimationType::turn(Direction whichway) { if (whichway == 8) _facingDir = kDirUp; @@ -144,6 +158,9 @@ void AnimationType::turn(Direction whichway) { _facingDir = whichway; } +/** + * Switches it on. + */ void AnimationType::appear(int16 wx, int16 wy, Direction wf) { _x = (wx / 8) * 8; _y = wy; @@ -169,6 +186,9 @@ bool AnimationType::checkCollision() { return false; } +/** + * Prepares for draw(), etc. + */ void AnimationType::walk() { if (!_anim->_vm->_doingSpriteRun) { _oldX[_anim->_vm->_cp] = _x; @@ -229,6 +249,9 @@ void AnimationType::walk() { } } +/** + * Bounces off walls + */ void AnimationType::bounce() { _x = _oldX[_anim->_vm->_cp]; _y = _oldY[_anim->_vm->_cp]; @@ -248,6 +271,9 @@ int8 AnimationType::getSign(int16 val) { return 0; } +/** + * Home in on a point. + */ void AnimationType::walkTo(byte pedNum) { PedType *curPed = &_anim->_vm->_peds[pedNum]; @@ -261,6 +287,9 @@ void AnimationType::stopHoming() { _homing = false; } +/** + * Calculates ix & iy for one homing step. + */ void AnimationType::homeStep() { int16 temp; @@ -291,6 +320,9 @@ void AnimationType::homeStep() { } } +/** + * Sets ix & iy, non-homing, etc. + */ void AnimationType::setSpeed(int8 xx, int8 yy) { _moveX = xx; _moveY = yy; @@ -310,12 +342,18 @@ void AnimationType::setSpeed(int8 xx, int8 yy) { } } +/** + * Stops the sprite from moving. + */ void AnimationType::stopWalk() { _moveX = 0; _moveY = 0; _homing = false; } +/** + * Sets up talk vars. + */ void AnimationType::chatter() { _anim->_vm->_talkX = _x + _info._xLength / 2; _anim->_vm->_talkY = _y; @@ -351,6 +389,10 @@ Animation::~Animation() { } } +/** + * Resets Animation variables. + * @remarks Originally called 'loadtrip' + */ void Animation::resetAnims() { setDirection(kDirStopped); for (int16 i = 0; i < kSpriteNumbMax; i++) @@ -389,6 +431,11 @@ byte Animation::geidaPed(byte ped) { } } +/** + * When you enter a new position in the catacombs, this procedure should be + * called. It changes the 'also' codes so that they may match the picture + * on the screen. + */ void Animation::catacombMove(byte ped) { int32 here; uint16 xy_uint16; @@ -691,7 +738,9 @@ void Animation::catacombMove(byte ped) { } } -// This proc gets called whenever you touch a line defined as _vm->special. +/** + * This proc gets called whenever you touch a line defined as _vm->special. + */ void Animation::dawnDelay() { _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); } @@ -893,6 +942,9 @@ void Animation::appearPed(byte sprNum, byte pedNum) { setMoveSpeed(sprNum, curPed->_direction); } +/** + * @remarks Originally called 'follow_avvy_y' + */ void Animation::followAvalotY(byte tripnum) { if (_sprites[0]._facingDir == kDirLeft) return; @@ -1048,8 +1100,9 @@ void Animation::geidaProcs(byte tripnum) { _sprites[tripnum]._moveX = 0; } -// That's all... - +/** + * @remarks Originally called 'call_andexors' + */ void Animation::drawSprites() { int8 order[5]; byte temp; @@ -1167,6 +1220,9 @@ void Animation::hideInCupboard() { } } +/** + * Returns true if you're within field "which". + */ bool Animation::inField(byte which) { FieldType *curField = &_vm->_fields[which]; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; @@ -1174,6 +1230,9 @@ bool Animation::inField(byte which) { return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } +/** + * Returns True if you're near a door. + */ bool Animation::nearDoor() { if (_vm->_fieldNum < 8) { // there ARE no doors here! @@ -1192,6 +1251,9 @@ bool Animation::nearDoor() { return false; } +/** + * @remarks Originally called 'tripkey' + */ void Animation::handleMoveKey(const Common::Event &event) { if (!_vm->_userMovesAvvy) return; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index e880fbf9e75c..b975e030124b 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -72,19 +72,19 @@ class AnimationType { bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; - void init(byte spritenum, bool doCheck, Animation *anim); // Loads & sets up the sprite. - void reset(); // Just sets 'quick' to false. Original name: original(). - void draw(); // Drops sprite onto screen. Original: andexor(). - void turn(Direction whichway); // Turns character round. - void appear(int16 wx, int16 wy, Direction wf); // Switches it on. - void bounce(); // Bounces off walls. - void walk(); // Prepares for andexor, etc. - void walkTo(byte pednum); // Home in on a point. - void stopHoming(); // Self-explanatory. - void homeStep(); // Calculates ix & iy for one homing step. - void setSpeed(int8 xx, int8 yy); // Sets ix & iy, non-homing, etc. - void stopWalk(); // Stops the sprite from moving. - void chatter(); // Sets up talk vars. + void init(byte spritenum, bool doCheck, Animation *anim); + void reset(); + void draw(); + void turn(Direction whichway); + void appear(int16 wx, int16 wy, Direction wf); + void bounce(); + void walk(); + void walkTo(byte pednum); + void stopHoming(); + void homeStep(); + void setSpeed(int8 xx, int8 yy); + void stopWalk(); + void chatter(); void remove(); private: @@ -113,23 +113,21 @@ class Animation { }; AnimationType _sprites[kSpriteNumbMax]; - bool _mustExclaim; - uint16 _sayWhat; Animation(AvalancheEngine *vm); ~Animation(); void animLink(); - void resetAnims(); // Original: loadtrip(). + void resetAnims(); void callSpecial(uint16 which); - void catacombMove(byte ped); // When you enter a new position in the catacombs, this procedure should be called. It changes the 'also' codes so that they may match the picture on the screen. + void catacombMove(byte ped); void stopWalking(); void setMoveSpeed(byte t, Direction dir); void appearPed(byte sprNum, byte pedNum); - bool inField(byte which); // Returns true if you're within field "which". - bool nearDoor(); // Returns True if you're near a door. + bool inField(byte which); + bool nearDoor(); void updateSpeed(); - void handleMoveKey(const Common::Event &event); // To replace tripkey(). + void handleMoveKey(const Common::Event &event); void hideInCupboard(); void setDirection(Direction dir); @@ -143,8 +141,9 @@ class Animation { Direction _direction; // The direction Avvy is currently facing. Direction _oldDirection; bool _arrowTriggered; // And has the arrow been triggered? - + bool _mustExclaim; byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. + uint16 _sayWhat; AvalancheEngine *_vm; @@ -156,7 +155,7 @@ class Animation { void arrowProcs(byte tripnum); // Different movements for NPCs: - void followAvalotY(byte tripnum); // Original: follow_avvy_y(). + void followAvalotY(byte tripnum); void backAndForth(byte tripnum); void faceAvvy(byte tripnum); @@ -165,7 +164,7 @@ class Animation { void takeAStep(byte &tripnum); void geidaProcs(byte tripnum); - void drawSprites(); // Original: call_andexors(). + void drawSprites(); }; } // End of namespace Avalanche. From 4b93e2543548e994a2b8c25c6f1513d20b0beccf Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 2 Oct 2013 07:25:46 +0200 Subject: [PATCH 1172/1332] AVALANCHE: Repair shadowed variable. --- engines/avalanche/graphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4c398dfd20d2..ff998a05348c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -588,14 +588,14 @@ void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { sign.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (int y = 0; y < height; y++) { + for (int yy = 0; yy < height; yy++) { for (int8 plane = 0; plane < 4; plane++) { // The planes are in the "right" order. - for (uint16 x = 0; x < width; x += 8) { + for (uint16 xx = 0; xx < width; xx += 8) { byte pixel = file.readByte(); for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) - *(byte *)sign.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + *(byte *)sign.getBasePtr(xx + 7 - bit, yy) += (pixelBit << plane); } } } From 8652224e58ba462763e80efe7f93d484380dd64e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Oct 2013 07:48:45 +0200 Subject: [PATCH 1173/1332] AVALANCHE: Move ControlCharacter enum to enums --- engines/avalanche/animation.cpp | 9 ++-- engines/avalanche/avalanche.cpp | 6 +-- engines/avalanche/avalot.cpp | 4 +- engines/avalanche/dialogs.cpp | 9 ++-- engines/avalanche/dialogs.h | 20 --------- engines/avalanche/enums.h | 20 +++++++++ engines/avalanche/parser.cpp | 80 ++++++++++++++++++--------------- engines/avalanche/timer.cpp | 20 ++++----- 8 files changed, 90 insertions(+), 78 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 74307e73ffff..f415d9006c79 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -224,7 +224,8 @@ void AnimationType::walk() { break; case kMagicUnfinished: { bounce(); - Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", + kControlBell, kControlCenter, kControlRoman); _anim->_vm->_dialogs->displayText(tmpStr); } break; @@ -452,7 +453,7 @@ void Animation::catacombMove(byte ped) { return; case 1033:{ // Oubliette _vm->flipRoom(kRoomOubliette, 1); - Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Oh, NO!%c1%c", kControlRegister, kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } return; @@ -1198,7 +1199,7 @@ void Animation::stopWalking() { void Animation::hideInCupboard() { if (_vm->_avvysInTheCupboard) { if (_vm->_parser->_wearing == kObjectDummy) { - Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { _sprites[0]._visible = true; @@ -1213,7 +1214,7 @@ void Animation::hideInCupboard() { _sprites[0]._visible = false; _vm->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ - "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); + "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", kControlParagraph); _vm->_dialogs->displayText(tmpStr); _vm->_avvysInTheCupboard = true; _vm->_background->draw(-1, -1, 7); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 645178418097..26d767107875 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -393,9 +393,9 @@ bool AvalancheEngine::loadGame(const int16 slot) { _background->update(); Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", - Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, - Dialogs::kControlNewLine, Dialogs::kControlNewLine, _roomnName.c_str(), Dialogs::kControlNewLine, - Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); + kControlItalic, kControlRoman, description.c_str(), kControlCenter, kControlNewLine, + kControlNewLine, _roomnName.c_str(), kControlNewLine, kControlNewLine, + expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _dialogs->displayText(tmpStr); AnimationType *avvy = &_animation->_sprites[0]; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index aa4f73d3add0..4f30b824d5cf 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -178,7 +178,7 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ "midnight. Are you having an all-night Avvy session? Glad you like the game that much!", - Dialogs::kControlNewLine, Dialogs::kControlNewLine); + kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); } _oldHour = _hour; @@ -1286,7 +1286,7 @@ void AvalancheEngine::checkClick() { } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) - _mouseText.insertChar(Dialogs::kControlNewLine, 0); + _mouseText.insertChar(kControlNewLine, 0); } else if (!_dropsOk) _mouseText = Common::String(13) + _mouseText; } diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 926f6624b51f..f3b26886004f 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -836,7 +836,7 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl if (error) { if (report) { - Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", Dialogs::kControlBell, block, point); + Common::String todisplay = Common::String::format("%cError accessing scroll %c%d", kControlBell, block, point); displayText(todisplay); } return; @@ -928,7 +928,8 @@ void Dialogs::talkTo(byte whom) { case 1: // Fallthrough is intended. case 2: { Common::String objStr = _vm->getItem(AvalancheEngine::kSpludwicksOrder[_vm->_givenToSpludwick]); - Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", + objStr.c_str(), kControlRegister, kControlSpeechBubble); displayText(tmpStr); } return; @@ -1002,7 +1003,7 @@ void Dialogs::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { - Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, i + 49, Dialogs::kControlToBuffer); + Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); noMatches = false; break; @@ -1010,7 +1011,7 @@ void Dialogs::talkTo(byte whom) { } if (noMatches) { - Common::String tmpStr = Common::String::format("%c%c%c", Dialogs::kControlRegister, Dialogs::kControlRegister, Dialogs::kControlToBuffer); + Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, kControlRegister, kControlToBuffer); displayText(tmpStr); } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 9cd4e729d4d8..94ffaf940122 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -41,26 +41,6 @@ typedef void (Dialogs::*DialogFunctionType)(); class Dialogs { public: - // Constants to replace the command characters from Pascal. - // For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers - enum ControlCharacter { - kControlSpeechBubble = 2, // ^B - kControlCenter = 3, // ^C - kControlToBuffer = 4, // ^D - kControlItalic = 6, // ^F - kControlBell = 7, // ^G - kControlBackspace = 8, // ^H - kControlInsertSpaces = 9, // ^I - kControlLeftJustified = 12, // ^L - kControlNewLine = 13, // ^M - kControlParagraph = 16, // ^P - kControlQuestion = 17, // ^Q - kControlRoman = 18, // ^R - kControlRegister = 19, // ^S - kControlNegative = 21, // ^U - kControlIcon = 22 // ^V - }; - bool _aboutBox; // Is this the about box? FontType _fonts[2]; diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 779bfb7e7c9d..155c9ac0609f 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -101,6 +101,26 @@ enum Magics { kMagicOpenDoor // Opening door. }; +// Constants to replace the command characters from Pascal. +// For more information, see: https://github.com/urukgit/avalot/wiki/Scrolldrivers +enum ControlCharacter { + kControlSpeechBubble = 2, // ^B + kControlCenter = 3, // ^C + kControlToBuffer = 4, // ^D + kControlItalic = 6, // ^F + kControlBell = 7, // ^G + kControlBackspace = 8, // ^H + kControlInsertSpaces = 9, // ^I + kControlLeftJustified = 12, // ^L + kControlNewLine = 13, // ^M + kControlParagraph = 16, // ^P + kControlQuestion = 17, // ^Q + kControlRoman = 18, // ^R + kControlRegister = 19, // ^S + kControlNegative = 21, // ^U + kControlIcon = 22 // ^V +}; + static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index cc65386b4fba..115b5662e2f9 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -867,7 +867,8 @@ void Parser::parse() { _polite = true; } - if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && + (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str()); _vm->_dialogs->displayText(tmpStr); _weirdWord = true; @@ -1031,7 +1032,7 @@ void Parser::inventory() { } if (_wearing == kNothing) - tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + tmpStr += Common::String::format("...%c%c...and you're stark naked!", kControlNewLine, kControlNewLine); else tmpStr += '.'; @@ -1249,7 +1250,8 @@ void Parser::putProc() { _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); else { // Put onion into wine? if (_vm->_wineState != 3) { - Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", + kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { // Put onion into vinegar! Yes! _vm->_onionInVinegar = true; @@ -1311,7 +1313,7 @@ void Parser::putProc() { void Parser::notInOrder() { Common::String itemStr = _vm->getItem(_vm->kSpludwicksOrder[_vm->_givenToSpludwick]); Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \ - "What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + "What I need next is %s%c2%c", itemStr.c_str(), kControlRegister, kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } @@ -1512,7 +1514,7 @@ void Parser::getProc(char thing) { */ void Parser::giveGeidaTheLute() { if (_vm->_room != kRoomLustiesRoom) { - Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", kControlRegister, kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); return; } @@ -1546,7 +1548,7 @@ Common::String Parser::personSpeaks() { } if (_vm->getRoom(_person) != _vm->_room) { - return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself! + return Common::String::format("%c1", kControlRegister); // Avvy himself! } bool found = false; // The _person we're looking for's code is in _person. @@ -1554,7 +1556,7 @@ Common::String Parser::personSpeaks() { for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, '1' + i); + tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); found = true; } } @@ -1564,7 +1566,7 @@ Common::String Parser::personSpeaks() { for (int i = 0; i < 16; i++) { if ((_vm->kQuasipeds[i]._who == _person) && (_vm->kQuasipeds[i]._room == _vm->_room)) - tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i); + tmpStr += Common::String::format("%c%c", kControlRegister, 'A' + i); } return tmpStr; @@ -1572,7 +1574,7 @@ Common::String Parser::personSpeaks() { void Parser::heyThanks() { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); _vm->_objects[_thing - 1] = false; } @@ -1601,7 +1603,8 @@ void Parser::doThat() { && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { if (!_vm->_alive) { - _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"); + _vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? " \ + "Try restarting, or restoring a saved game!"); return; } if (!_vm->_avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { @@ -1617,8 +1620,11 @@ void Parser::doThat() { case kVerbCodeOpen: openDoor(); break; - case kVerbCodePause: { // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code. - Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the `O.K.\" box to continue.", Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine); + case kVerbCodePause: { + // Note that the original game doesn't care about the "O.K." box neither, it accepts + // clicks from everywhere on the screen to continue. Just like my code. + Common::String tmpStr = Common::String::format("Game paused.%c%c%cPress Enter, Esc, or click the mouse on the `O.K.\" " \ + "box to continue.", kControlCenter, kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); } break; @@ -1645,7 +1651,7 @@ void Parser::doThat() { case kVerbCodeTalk: if (_person == kPeoplePardon) { if (_vm->_subjectNum == 99) { // They typed "say password". - Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } else if (((1 <= _vm->_subjectNum) && (_vm->_subjectNum <= 49)) || (_vm->_subjectNum == 253) || (_vm->_subjectNum == 249)) { _thats.deleteChar(0); @@ -1789,7 +1795,7 @@ void Parser::doThat() { if (!_polite) _vm->_dialogs->displayText("How about a `please\", Avvy?"); else { - Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon); + Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", kControlRegister, kControlIcon); if (_vm->_dialogs->displayQuestion(tmpStr)) _vm->_letMeOut = true; } @@ -1802,12 +1808,12 @@ void Parser::doThat() { Common::String toDisplay; for (int i = 0; i < 7; i++) - toDisplay += Dialogs::kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine - + "The medi\x91val descendant of" + Dialogs::kControlNewLine - + "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine - + "version " + kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " - + kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; + toDisplay += kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + kControlCenter + kControlNewLine + + "The medi\x91val descendant of" + kControlNewLine + + "Denarius Avaricius Sextus" + kControlNewLine + kControlNewLine + + "version " + kVersionNum + kControlNewLine + kControlNewLine + "Copyright \xEF " + + kCopyright + ", Mark, Mike and Thomas Thurman." + kControlRegister + 'Y' + kControlIcon; _vm->_dialogs->displayText(toDisplay); _vm->_dialogs->_aboutBox = false; } @@ -1898,8 +1904,9 @@ void Parser::doThat() { _vm->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", " \ + "but I haven't implemented it yet: you win and get the lute automatically.") + + kControlNewLine + kControlNewLine + "Peter (uruk)"); break; case kRoomMusicRoom: playHarp(); @@ -1966,12 +1973,12 @@ void Parser::doThat() { _vm->_dialogs->displayText("Hmm, I don't think anyone will notice..."); _vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet); } else { - Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", Dialogs::kControlItalic, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("It would be %cVERY%c unwise to do that here, Avvy!", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeCheat: { - Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic); + Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", kControlItalic); _vm->_dialogs->displayText(tmpStr); _vm->_cheat = true; } @@ -2005,19 +2012,20 @@ void Parser::doThat() { switch (_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ - "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + "(I shouldn't say it again, if I were you!)", kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); } break; case 1: { Common::String tmpStr = Common::String::format("You hear a distant rumble of thunder. Must you always" \ - "do things I tell you not to?%c%cDon't do it again!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + "do things I tell you not to?%c%cDon't do it again!", kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); } break; default: { _vm->_pingo->zonk(); - Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine); + Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you." \ + "%c%c(`Such is the anger of the gods, Avvy!\")", kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); _vm->gameOver(); } @@ -2055,7 +2063,7 @@ void Parser::doThat() { _vm->incScore(3); _vm->_background->draw(-1, -1, 11); - _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); + _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + kControlRegister + '1' + kControlSpeechBubble); _vm->_drinking = _thing; _vm->_background->draw(-1, -1, 9); @@ -2080,7 +2088,7 @@ void Parser::doThat() { } _vm->_background->draw(-1, -1, 11); - Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + Common::String tmpStr = Common::String::format("Wine, please.%c1%c", kControlRegister, kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); if (_alcoholLevel == 0) _vm->incScore(3); @@ -2199,7 +2207,9 @@ void Parser::doThat() { _vm->gameOver(); break; case kVerbCodeScore: { - Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); + Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%c " \ + "This gives you a rank of %s.%c%c%s", _vm->_dnascore, kControlCenter, kControlNewLine, kControlNewLine, + kControlNewLine, rank().c_str(), kControlNewLine, kControlNewLine, totalTime().c_str()); _vm->_dialogs->displayText(tmpStr); } break; @@ -2266,7 +2276,7 @@ void Parser::doThat() { break; case kPeopleJacques: { Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \ - "Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); + "Hmmm... that doesn't seem to do any good...", kControlRegister, kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } break; @@ -2285,7 +2295,7 @@ void Parser::doThat() { } else { // Default doodah. _vm->dusk(); _vm->dawn(); - Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph); + Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", kControlParagraph); _vm->_dialogs->displayText(tmpStr); } break; @@ -2301,18 +2311,18 @@ void Parser::doThat() { break; case kVerbCodeHello: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hello.%c", Dialogs::kControlSpeechBubble); + tmpStr += Common::String::format("Hello.%c", kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeThanks: { Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("That's OK.%c", Dialogs::kControlSpeechBubble); + tmpStr += Common::String::format("That's OK.%c", kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } break; default: - Common::String tmpStr = Common::String::format("%cParser bug!", Dialogs::kControlBell); + Common::String tmpStr = Common::String::format("%cParser bug!", kControlBell); _vm->_dialogs->displayText(tmpStr); } } diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index ff5cf828c5e8..f34531734ecf 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -259,7 +259,7 @@ void Timer::toilet() { } void Timer::bang() { - Common::String tmpStr = Common::String::format("%c< BANG! >", Dialogs::kControlItalic); + Common::String tmpStr = Common::String::format("%c< BANG! >", kControlItalic); _vm->_dialogs->displayText(tmpStr); addTimer(30, kProcBang2, kReasonExplosion); } @@ -360,8 +360,8 @@ void Timer::afterTheShootemup() { _vm->refreshObjectList(); // Same as the added line above: TODO: Remove it later!!! - _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") - + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Peter (uruk)"); + _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", " \ + "but I haven't implemented it yet: you get the crossbow automatically.") + kControlNewLine + kControlNewLine + "Peter (uruk)"); #if 0 byte shootscore, gain; @@ -548,7 +548,8 @@ void Timer::fallDownOubliette() { void Timer::meetAvaroid() { if (_vm->_metAvaroid) { - Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); + Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", + kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); _vm->gameOver(); } else { @@ -633,7 +634,7 @@ void Timer::avvySitDown() { void Timer::ghostRoomPhew() { Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", - Dialogs::kControlItalic, Dialogs::kControlRoman, Dialogs::kControlItalic); + kControlItalic, kControlRoman, kControlItalic); _vm->_dialogs->displayText(tmpStr); } @@ -669,11 +670,10 @@ void Timer::avalotFalls() { addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", - Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, - Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, - Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, - Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, Dialogs::kControlInsertSpaces, - Dialogs::kControlRegister, Dialogs::kControlIcon); + kControlNewLine, kControlNewLine, kControlNewLine, kControlNewLine, + kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlInsertSpaces, + kControlInsertSpaces, kControlInsertSpaces, kControlInsertSpaces, + kControlInsertSpaces, kControlRegister, kControlIcon); _vm->_dialogs->displayText(toDisplay); } } From 7854f05b794eece823390f348875bd17512202e0 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:41:56 -0500 Subject: [PATCH 1174/1332] ZVISION: Remove empty file --- engines/zvision/module.mk | 1 - engines/zvision/scripts.cpp | 31 ------------------------------- 2 files changed, 32 deletions(-) delete mode 100644 engines/zvision/scripts.cpp diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 6a6eedc4d5e4..c2c99502c657 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -20,7 +20,6 @@ MODULE_OBJS := \ save_manager.o \ scr_file_handling.o \ script_manager.o \ - scripts.o \ single_value_container.o \ string_manager.o \ timer_node.o \ diff --git a/engines/zvision/scripts.cpp b/engines/zvision/scripts.cpp deleted file mode 100644 index b6deb1b51010..000000000000 --- a/engines/zvision/scripts.cpp +++ /dev/null @@ -1,31 +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/scummsys.h" - -#include "zvision/zvision.h" - -namespace ZVision { - - - -} // End of namespace ZVision From a6ae661ef89a5c86b33dd84bf7b4dbd3dfbaec45 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:42:46 -0500 Subject: [PATCH 1175/1332] ZVISION: Add newline at end of file --- engines/zvision/subtitles.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/subtitles.h b/engines/zvision/subtitles.h index e88108327fc5..13426e03e4d1 100644 --- a/engines/zvision/subtitles.h +++ b/engines/zvision/subtitles.h @@ -26,4 +26,4 @@ // TODO: Implement Subtitles -#endif \ No newline at end of file +#endif From ea5a6a7bde5b3da4b3f568151c60a0789f26093f Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:43:27 -0500 Subject: [PATCH 1176/1332] ZVISION: Fix debug typo copy-paste error --- engines/zvision/zfs_archive.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index 3577ce3d147e..5f4b2a2cd978 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -41,13 +41,13 @@ ZfsArchive::ZfsArchive(const Common::String &fileName) : _fileName(fileName) { readHeaders(&zfsFile); - debug(0, "ArjArchive::ArjArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); + debug(0, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); } ZfsArchive::ZfsArchive(const Common::String &fileName, Common::SeekableReadStream *stream) : _fileName(fileName) { readHeaders(stream); - debug(0, "ArjArchive::ArjArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); + debug(0, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); } ZfsArchive::~ZfsArchive() { From 229e4fe3be9770a3c91fa78ddb892043a6277cf0 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:45:57 -0500 Subject: [PATCH 1177/1332] ZVISION: Move creation of the managers to ZVision::initialize() In order to make the ZVision constructor as lightweight as possible --- engines/zvision/zvision.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index b0719086982f..1e34587f3c58 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -54,7 +54,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ _desiredFrameTime(33), /* ~30 fps */ - _clock(_system) { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you @@ -65,15 +64,13 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) // Here is the right place to set up the engine specific debug channels //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); + _clock(_system), + _scriptManager(nullptr), + _renderManager(nullptr), + _saveManager(nullptr), + _stringManager(nullptr), + _cursorManager(nullptr) { - // Register random source - _rnd = new Common::RandomSource("zvision"); - - // Create managers - _scriptManager = new ScriptManager(this); - _renderManager = new RenderManager(_system, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat); - _saveManager = new SaveManager(this); - _stringManager = new StringManager(this); debug("ZVision::ZVision"); } @@ -122,8 +119,17 @@ void ZVision::initialize() { initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat); - // CursorManager must be created after all the directories have been added + // Register random source + _rnd = new Common::RandomSource("zvision"); + + // Create managers + _scriptManager = new ScriptManager(this); + _renderManager = new RenderManager(_system, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat); + _saveManager = new SaveManager(this); + _stringManager = new StringManager(this); _cursorManager = new CursorManager(this, &_pixelFormat); + + // Initialize the managers _cursorManager->initialize(); _scriptManager->initialize(); _stringManager->initialize(_gameDescription->gameId); From 031be61b07ba52d1ac561332981790e877f9768e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:46:25 -0500 Subject: [PATCH 1178/1332] ZVISION: Clean up the ZVision constructor --- engines/zvision/zvision.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 1e34587f3c58..86e0aedebf4a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -54,16 +54,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ _desiredFrameTime(33), /* ~30 fps */ - - // Put your engine in a sane state, but do nothing big yet; - // in particular, do not load data from files; rather, if you - // need to do such things, do them from run(). - - // Do not initialize graphics here - - // Here is the right place to set up the engine specific debug channels - //DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel"); - //DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example"); _clock(_system), _scriptManager(nullptr), _renderManager(nullptr), From 02aaffd8943bd6713bf6b9e473124956c1f9d592 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:48:27 -0500 Subject: [PATCH 1179/1332] ZVISION: Break comment into multiple lines for readability --- engines/zvision/zvision.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 86e0aedebf4a..9fa3cd32e77f 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -82,7 +82,9 @@ ZVision::~ZVision() { void ZVision::initialize() { const Common::FSNode gameDataDir(ConfMan.get("path")); - // TODO: There are 10 file clashes when we flatten the directories. From a quick look, the files are exactly the same, so it shouldn't matter. But I'm noting it here just in-case it does become a problem. + // TODO: There are 10 file clashes when we flatten the directories. + // From a quick look, the files are exactly the same, so it shouldn't matter. + // But I'm noting it here just in-case it does become a problem. SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); SearchMan.addSubDirectoryMatching(gameDataDir, "data3", 0, 4, true); From 72ae75e64a1aa15839f489895220c76250e2943a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:57:15 -0500 Subject: [PATCH 1180/1332] ZVISION: Clean up zvision.h --- engines/zvision/zvision.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index efd94f1074bc..bc7f9e32dbaa 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -52,14 +52,6 @@ class StringManager; class SaveManager; class RlfAnimation; -// our engine debug channels -enum { - kZDebugExample = 1 << 0, - kZDebugExample2 = 1 << 1 - // next new channel must be 1 << 2 (4) - // the current limitation is 32 debug channels (1 << 31 is the last one) -}; - class ZVision : public Engine { public: ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); From 98e7627591ca8ac2acde347d9f41f6d810f94f67 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 29 Sep 2013 21:57:35 -0500 Subject: [PATCH 1181/1332] ZVISION: Add debug levels --- engines/zvision/rlf_animation.cpp | 12 ++++-------- engines/zvision/script_manager.cpp | 4 ++-- engines/zvision/zfs_archive.cpp | 6 +++--- engines/zvision/zvision.cpp | 4 ++-- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 79638511add8..72da42737c27 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -242,8 +242,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { - // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + debug(2, "Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -263,8 +262,7 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { - // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + debug(2, "Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -290,8 +288,7 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 if (sourceOffset + 1 >= sourceSize) { return; } else if (destOffset + 1 >= destSize) { - // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + debug(2, "Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } @@ -320,8 +317,7 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 numberOfSamples += 2; while (numberOfSamples > 0) { if (destOffset + 1 >= destSize) { - // TODO: Make this warning silent or in a high debug level. It happens for almost all frames. - //warning("Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); + debug(2, "Frame decoding overflow\n\tsourceOffset=%u\tsourceSize=%u\n\tdestOffset=%u\tdestSize=%u", sourceOffset, sourceSize, destOffset, destSize); return; } diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 75f88ddd8a76..e23a08f92e31 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -173,7 +173,7 @@ void ScriptManager::checkPuzzleCriteria() { // criteriaList can be empty. Aka, the puzzle should be executed immediately if (puzzle->criteriaList.empty() || criteriaMet) { - debug("Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); + debug(1, "Puzzle %u criteria passed. Executing its ResultActions", puzzle->key); // Set the puzzle as completed setStateValue(puzzle->key, 1); @@ -306,7 +306,7 @@ void ScriptManager::onKeyUp(Common::KeyState keyState) { void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) { assert(world != 0); - debug("Changing location to: %c %c %c %c %u", world, room, node, view, offset); + debug(1, "Changing location to: %c %c %c %c %u", world, room, node, view, offset); // Auto save _engine->getSaveManager()->autoSave(); diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index 5f4b2a2cd978..0836336f302e 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -41,17 +41,17 @@ ZfsArchive::ZfsArchive(const Common::String &fileName) : _fileName(fileName) { readHeaders(&zfsFile); - debug(0, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); + debug(1, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); } ZfsArchive::ZfsArchive(const Common::String &fileName, Common::SeekableReadStream *stream) : _fileName(fileName) { readHeaders(stream); - debug(0, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); + debug(1, "ZfsArchive::ZfsArchive(%s): Located %d files", _fileName.c_str(), _entryHeaders.size()); } ZfsArchive::~ZfsArchive() { - debug(0, "ZfsArchive Destructor Called"); + debug(1, "ZfsArchive Destructor Called"); ZfsEntryHeaderMap::iterator it = _entryHeaders.begin(); for ( ; it != _entryHeaders.end(); ++it) { delete it->_value; diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 9fa3cd32e77f..6cdc144424e0 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -61,11 +61,11 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _stringManager(nullptr), _cursorManager(nullptr) { - debug("ZVision::ZVision"); + debug(1, "ZVision::ZVision"); } ZVision::~ZVision() { - debug("ZVision::~ZVision"); + debug(1, "ZVision::~ZVision"); // Dispose of resources delete _console; From 3c8c4c836f2ac544570f032516aa2e90bc2dd4bf Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:01:56 -0500 Subject: [PATCH 1182/1332] ZVISION: Move bit flag to an enum for clarity --- engines/zvision/actions.cpp | 3 +-- engines/zvision/actions.h | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 3d25fa9e9910..461c4493ebcc 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -367,8 +367,7 @@ bool ActionStreamVideo::execute(ZVision *engine) { } Common::Rect destRect; - // 0x1 flags that the destRect dimensions are different from the original video dimensions - if ((_flags & 0x1) == 0x1) { + if ((_flags & DIFFERENT_DIMENSIONS) == DIFFERENT_DIMENSIONS) { destRect = Common::Rect(_x1, _y1, _x2, _y2); } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 5d7cdad68f35..206b5e16b1e6 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -321,6 +321,10 @@ class ActionStreamVideo : public ResultAction { bool execute(ZVision *engine); private: + enum { + DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions + }; + Common::String _fileName; uint _x1; uint _y1; From db28babf066b83576a5d9b67d5c7e29c931fbb66 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:02:44 -0500 Subject: [PATCH 1183/1332] ZVISION: Create file on the heap to prevent memory scope problems --- engines/zvision/actions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 461c4493ebcc..75b771c14333 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -180,9 +180,9 @@ bool ActionMusic::execute(ZVision *engine) { Audio::RewindableAudioStream *audioStream; if (_fileName.contains(".wav")) { - Common::File file; - if (file.open(_fileName)) { - audioStream = Audio::makeWAVStream(&file, DisposeAfterUse::NO); + Common::File *file = new Common::File(); + if (file->open(_fileName)) { + audioStream = Audio::makeWAVStream(file, DisposeAfterUse::YES); } } else { audioStream = makeRawZorkStream(_fileName, engine); From 01238925da50c8467ce24cfe6c2cca07494a8b8e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:09:53 -0500 Subject: [PATCH 1184/1332] ZVISION: Fix curly braces formatting --- engines/zvision/lzss_read_stream.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 03ab12d8be8d..4a5a4f3657bc 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -45,39 +45,38 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) uint mask = 1; for (int i = 0; i < 8; i++) { - if ((flagbyte & mask) == mask) - { + if ((flagbyte & mask) == mask) { byte data = _source->readByte(); - if (_source->eos()) + if (_source->eos()) { return destinationCursor; + } _window[_windowCursor] = data; destination[destinationCursor++] = data; // Increment and wrap the window cursor _windowCursor = (_windowCursor + 1) & 0xFFF; - } - else - { + } else { byte low = _source->readByte(); - if (_source->eos()) + if (_source->eos()) { return destinationCursor; + } byte high = _source->readByte(); - if (_source->eos()) + if (_source->eos()) { return destinationCursor; + } uint16 length = (high & 0xF) + 2; uint16 offset = low | ((high & 0xF0)<<4); - for(int j = 0; j <= length; j++) - { + for(int j = 0; j <= length; j++) { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; destination[destinationCursor++] = temp; _windowCursor = (_windowCursor + 1) & 0xFFF; } - }; + } mask = mask << 1; } From e08023c4b62f5cbd74de93af924f7e4d689a4754 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:10:55 -0500 Subject: [PATCH 1185/1332] ZVISION: Add newline to end of module.mk --- engines/zvision/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index c2c99502c657..261168f13390 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -40,4 +40,4 @@ PLUGIN := 1 endif # Include common rules -include $(srcdir)/rules.mk \ No newline at end of file +include $(srcdir)/rules.mk From 239493305d1662c38c015e5cc1d321b6fe5baef7 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:15:44 -0500 Subject: [PATCH 1186/1332] ZVISION: Replace all occurances of (*iter). with iter-> --- engines/zvision/lever_control.cpp | 4 ++-- engines/zvision/puzzle.h | 2 +- engines/zvision/render_manager.cpp | 20 ++++++++++---------- engines/zvision/script_manager.cpp | 16 ++++++++-------- engines/zvision/string_manager.cpp | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index f3d369fbfbcf..62d147c8cd85 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -230,8 +230,8 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common _lastMousePos = backgroundImageSpacePos; for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { - if (angle >= (int)(*iter).angle - ANGLE_DELTA && angle <= (int)(*iter).angle + ANGLE_DELTA) { - _currentFrame = (*iter).toFrame; + if (angle >= (int)iter->angle - ANGLE_DELTA && angle <= (int)iter->angle + ANGLE_DELTA) { + _currentFrame = iter->toFrame; renderFrame(_currentFrame); break; } diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 512a9636b917..679a01726220 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -36,7 +36,7 @@ struct Puzzle { ~Puzzle() { for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - delete (*iter); + delete *iter; } } diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 55a24c9c86c7..7c4fe43353ec 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -59,8 +59,8 @@ RenderManager::~RenderManager() { _backBuffer.free(); for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { - (*iter)._value.data->free(); - delete (*iter)._value.data; + iter->_value.data->free(); + delete iter->_value.data; } } @@ -121,25 +121,25 @@ void RenderManager::processAlphaEntries() { for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { uint32 destOffset = 0; uint32 sourceOffset = 0; - uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top); - uint16 *entryPtr = (uint16 *)(*iter)._value.data->getPixels(); + uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top); + uint16 *entryPtr = (uint16 *)iter->_value.data->getPixels(); - for (int32 y = 0; y < (*iter)._value.height; y++) { - for (int32 x = 0; x < (*iter)._value.width; x++) { + for (int32 y = 0; y < iter->_value.height; y++) { + for (int32 x = 0; x < iter->_value.width; x++) { uint16 color = entryPtr[sourceOffset + x]; - if (color != (*iter)._value.alphaColor) { + if (color != iter->_value.alphaColor) { backbufferPtr[destOffset + x] = color; } } destOffset += _backBuffer.w; - sourceOffset += (*iter)._value.width; + sourceOffset += iter->_value.width; } if (_backBufferDirtyRect.isEmpty()) { - _backBufferDirtyRect = Common::Rect((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top, (*iter)._value.destX + _workingWindow.left + (*iter)._value.width, (*iter)._value.destY + _workingWindow.top + (*iter)._value.height); + _backBufferDirtyRect = Common::Rect(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top, iter->_value.destX + _workingWindow.left + iter->_value.width, iter->_value.destY + _workingWindow.top + iter->_value.height); } else { - _backBufferDirtyRect.extend(Common::Rect((*iter)._value.destX + _workingWindow.left, (*iter)._value.destY + _workingWindow.top, (*iter)._value.destX + _workingWindow.left + (*iter)._value.width, (*iter)._value.destY + _workingWindow.top + (*iter)._value.height)); + _backBufferDirtyRect.extend(Common::Rect(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top, iter->_value.destX + _workingWindow.left + iter->_value.width, iter->_value.destY + _workingWindow.top + iter->_value.height)); } } } diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index e23a08f92e31..5cc7846b3a9f 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -71,7 +71,7 @@ void ScriptManager::createReferenceTable() { // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle for (Common::List >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); criteriaIter++) { - for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { _referenceTable[entryIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well @@ -88,7 +88,7 @@ void ScriptManager::createReferenceTable() { // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle for (Common::List >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); criteriaIter++) { - for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { _referenceTable[entryIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well @@ -135,16 +135,16 @@ void ScriptManager::checkPuzzleCriteria() { for (Common::List >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); criteriaIter++) { criteriaMet = false; - for (Common::List::iterator entryIter = (*criteriaIter).begin(); entryIter != (*criteriaIter).end(); entryIter++) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { // Get the value to compare against uint argumentValue; - if ((*entryIter).argumentIsAKey) + if (entryIter->argumentIsAKey) argumentValue = getStateValue(entryIter->argument); else argumentValue = entryIter->argument; // Do the comparison - switch ((*entryIter).criteriaOperator) { + switch (entryIter->criteriaOperator) { case Puzzle::EQUAL_TO: criteriaMet = getStateValue(entryIter->key) == argumentValue; break; @@ -197,7 +197,7 @@ void ScriptManager::cleanStateTable() { for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { // If the value is equal to zero, we can purge it since getStateValue() // will return zero if _globalState doesn't contain a key - if ((*iter)._value == 0) { + if (iter->_value == 0) { // Remove the node _globalState.erase(iter); } @@ -384,8 +384,8 @@ void ScriptManager::serializeStateTable(Common::WriteStream *stream) { for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { // Write out the key/value pair - stream->writeUint32LE((*iter)._key); - stream->writeUint32LE((*iter)._value); + stream->writeUint32LE(iter->_key); + stream->writeUint32LE(iter->_value); } } diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index b2d19d904e9d..9ae479b47d1b 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -42,7 +42,7 @@ StringManager::StringManager(ZVision *engine) StringManager::~StringManager() { for (Common::HashMap::iterator iter = _fonts.begin(); iter != _fonts.end(); iter++) { - delete (*iter)._value; + delete iter->_value; } } From ffaffa2bc4163fcc72c40416ba713076ba9e8a01 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:27:03 -0500 Subject: [PATCH 1187/1332] ZVISION: Convert all for-loops to use pre-increment instead of post-increment --- engines/zvision/cursor_manager.cpp | 2 +- engines/zvision/lever_control.cpp | 2 +- engines/zvision/lzss_read_stream.cpp | 4 +- engines/zvision/puzzle.h | 2 +- engines/zvision/render_manager.cpp | 26 +++++----- engines/zvision/render_table.cpp | 12 ++--- engines/zvision/rlf_animation.cpp | 8 ++-- engines/zvision/script_manager.cpp | 72 ++++++++++++++-------------- engines/zvision/string_manager.cpp | 4 +- engines/zvision/utility.h | 2 +- engines/zvision/video.cpp | 12 ++--- engines/zvision/zfs_archive.cpp | 4 +- engines/zvision/zork_raw.cpp | 4 +- 13 files changed, 77 insertions(+), 77 deletions(-) diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 69a4280157f2..0f524bf8072b 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -76,7 +76,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) return; } - for (int i = 0; i < NUM_CURSORS; i++) { + for (int i = 0; i < NUM_CURSORS; ++i) { if (_engine->getGameId() == GID_NEMESIS) { if (cursorName.equals(_cursorNames[i])) { _currentCursor = cursorName; diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 62d147c8cd85..4e04ed4263d7 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -229,7 +229,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos); _lastMousePos = backgroundImageSpacePos; - for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) { + for (Common::List::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); ++iter) { if (angle >= (int)iter->angle - ANGLE_DELTA && angle <= (int)iter->angle + ANGLE_DELTA) { _currentFrame = iter->toFrame; renderFrame(_currentFrame); diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index 4a5a4f3657bc..a90f40b3e474 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -44,7 +44,7 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) break; uint mask = 1; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; ++i) { if ((flagbyte & mask) == mask) { byte data = _source->readByte(); if (_source->eos()) { @@ -70,7 +70,7 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) uint16 length = (high & 0xF) + 2; uint16 offset = low | ((high & 0xF0)<<4); - for(int j = 0; j <= length; j++) { + for(int j = 0; j <= length; ++j) { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; destination[destinationCursor++] = temp; diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 679a01726220..75ea9541d2f6 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -35,7 +35,7 @@ struct Puzzle { Puzzle() : key(0), flags(0) {} ~Puzzle() { - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) { delete *iter; } } diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 7c4fe43353ec..b8286266daff 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -58,7 +58,7 @@ RenderManager::~RenderManager() { _currentBackground.free(); _backBuffer.free(); - for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { iter->_value.data->free(); delete iter->_value.data; } @@ -118,14 +118,14 @@ void RenderManager::renderBackbufferToScreen() { void RenderManager::processAlphaEntries() { // TODO: Add dirty rectangling support. AKA only draw an entry if the _backbufferDirtyRect intersects/contains the entry Rect - for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) { + for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { uint32 destOffset = 0; uint32 sourceOffset = 0; uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top); uint16 *entryPtr = (uint16 *)iter->_value.data->getPixels(); - for (int32 y = 0; y < iter->_value.height; y++) { - for (int32 x = 0; x < iter->_value.width; x++) { + for (int32 y = 0; y < iter->_value.height; ++y) { + for (int32 x = 0; x < iter->_value.width; ++x) { uint16 color = entryPtr[sourceOffset + x]; if (color != iter->_value.alphaColor) { backbufferPtr[destOffset + x] = color; @@ -151,7 +151,7 @@ void RenderManager::clearWorkingWindowTo555Color(uint16 color) { uint16 colorIn565 = _pixelFormat.RGBToColor(r, g, b); uint16 *bufferPtr = (uint16 *)_workingWindowBuffer.getPixels(); - for (uint32 i = 0; i < workingWindowSize; i++) { + for (uint32 i = 0; i < workingWindowSize; ++i) { bufferPtr[i] = colorIn565; } } @@ -293,10 +293,10 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: if (isTransposed) { uint16 *dest = (uint16 *)destination.getPixels(); - for (uint32 y = 0; y < imageHeight; y++) { + for (uint32 y = 0; y < imageHeight; ++y) { uint32 columnIndex = y * imageWidth; - for (uint32 x = 0; x < imageWidth; x++) { + for (uint32 x = 0; x < imageWidth; ++x) { dest[columnIndex + x] = buffer[x * imageHeight + y]; } } @@ -320,8 +320,8 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i uint32 sourceOffset = 0; uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); - for (int32 y = 0; y < height; y++) { - for (int32 x = 0; x < width; x++) { + for (int32 y = 0; y < height; ++y) { + for (int32 x = 0; x < width; ++x) { workingWindowBufferPtr[destOffset + x] = buffer[sourceOffset + x]; } @@ -353,8 +353,8 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i uint32 destOffset = 0; uint16 *surfacePtr = (uint16 *)entry.data->getPixels(); - for (int32 y = 0; y < height; y++) { - for (int32 x = 0; x < width; x++) { + for (int32 y = 0; y < height; ++y) { + for (int32 x = 0; x < width; ++x) { surfacePtr[destOffset + x] = buffer[sourceOffset + x]; } @@ -509,10 +509,10 @@ Graphics::Surface *RenderManager::tranposeSurface(const Graphics::Surface *surfa const uint16 *source = (const uint16 *)surface->getPixels(); uint16 *dest = (uint16 *)tranposedSurface->getPixels(); - for (uint32 y = 0; y < tranposedSurface->h; y++) { + for (uint32 y = 0; y < tranposedSurface->h; ++y) { uint32 columnIndex = y * tranposedSurface->w; - for (uint32 x = 0; x < tranposedSurface->w; x++) { + for (uint32 x = 0; x < tranposedSurface->w; ++x) { dest[columnIndex + x] = source[x * surface->w + y]; } } diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 19f95a5d8f6f..ce247e23fd21 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -103,10 +103,10 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect) { uint32 destOffset = 0; - for (int16 y = subRect.top; y < subRect.bottom; y++) { + for (int16 y = subRect.top; y < subRect.bottom; ++y) { uint32 sourceOffset = y * _numColumns; - for (int16 x = subRect.left; x < subRect.right; x++) { + for (int16 x = subRect.left; x < subRect.right; ++x) { uint32 normalizedX = x - subRect.left; uint32 index = sourceOffset + x; @@ -144,7 +144,7 @@ void RenderTable::generatePanoramaLookupTable() { float fovInRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f); float cylinderRadius = halfHeight / tan(fovInRadians); - for (uint x = 0; x < _numColumns; x++) { + for (uint x = 0; x < _numColumns; ++x) { // Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen) // Alpha represents the horizontal angle between the viewer at the center of a cylinder and x float alpha = atan(((float)x - halfWidth + 0.01f) / cylinderRadius); @@ -155,7 +155,7 @@ void RenderTable::generatePanoramaLookupTable() { float cosAlpha = cos(alpha); - for (uint y = 0; y < _numRows; y++) { + for (uint y = 0; y < _numRows; ++y) { // To calculate y in cylinder coordinates, we can do similar triangles comparison, // comparing the triangle from the center to the screen and from the center to the edge of the cylinder int32 yInCylinderCoords = int32(floor(halfHeight + ((float)y - halfHeight) * cosAlpha)); @@ -176,7 +176,7 @@ void RenderTable::generateTiltLookupTable() { float fovInRadians = (_tiltOptions.fieldOfView * M_PI / 180.0f); float cylinderRadius = halfWidth / tan(fovInRadians); - for (uint y = 0; y < _numRows; y++) { + for (uint y = 0; y < _numRows; ++y) { // Add an offset of 0.01 to overcome zero tan/atan issue (horizontal line on half of screen) // Alpha represents the vertical angle between the viewer at the center of a cylinder and y @@ -189,7 +189,7 @@ void RenderTable::generateTiltLookupTable() { float cosAlpha = cos(alpha); uint32 columnIndex = y * _numColumns; - for (uint x = 0; x < _numColumns; x++) { + for (uint x = 0; x < _numColumns; ++x) { // To calculate x in cylinder coordinates, we can do similar triangles comparison, // comparing the triangle from the center to the screen and from the center to the edge of the cylinder int32 xInCylinderCoords = int32(floor(halfWidth + ((float)x - halfWidth) * cosAlpha)); diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 72da42737c27..d932fa7698ba 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -63,14 +63,14 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) _frames = new Frame[_frameCount]; // Read in each frame - for (uint i = 0; i < _frameCount; i++) { + for (uint i = 0; i < _frameCount; ++i) { _frames[i] = readNextFrame(); } } } RlfAnimation::~RlfAnimation() { - for (uint i = 0; i < _frameCount; i++) { + for (uint i = 0; i < _frameCount; ++i) { delete[] _frames[i].encodedData; } delete[] _frames; @@ -165,7 +165,7 @@ void RlfAnimation::seekToFrame(int frameNumber) { int closestFrame = _currentFrame; int distance = (int)frameNumber - _currentFrame; - for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { + for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); ++iter) { int newDistance = (int)frameNumber - (int)(*iter); if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) { closestFrame = (*iter); @@ -173,7 +173,7 @@ void RlfAnimation::seekToFrame(int frameNumber) { } } - for (int i = closestFrame; i <= frameNumber; i++) { + for (int i = closestFrame; i <= frameNumber; ++i) { applyFrameToCurrent(i); } diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 5cc7846b3a9f..31983a684e42 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -43,13 +43,13 @@ ScriptManager::ScriptManager(ZVision *engine) } ScriptManager::~ScriptManager() { - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { delete (*iter); } - for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { delete (*iter); } - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { delete (*iter); } } @@ -66,12 +66,12 @@ void ScriptManager::update(uint deltaTimeMillis) { void ScriptManager::createReferenceTable() { // Iterate through each local Puzzle - for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) { + for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); ++activePuzzleIter) { Puzzle *puzzlePtr = (*activePuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle - for (Common::List >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); criteriaIter++) { - for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { + for (Common::List >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); ++criteriaIter) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) { _referenceTable[entryIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well @@ -83,12 +83,12 @@ void ScriptManager::createReferenceTable() { } // Iterate through each global Puzzle - for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) { + for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); ++globalPuzzleIter) { Puzzle *puzzlePtr = (*globalPuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle - for (Common::List >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); criteriaIter++) { - for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { + for (Common::List >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); ++criteriaIter) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) { _referenceTable[entryIter->key].push_back(puzzlePtr); // If the argument is a key, add a reference to it as well @@ -100,7 +100,7 @@ void ScriptManager::createReferenceTable() { } // Remove duplicate entries - for (Common::HashMap >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); referenceTableIter++) { + for (Common::HashMap >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); ++referenceTableIter) { removeDuplicateEntries(referenceTableIter->_value); } } @@ -113,7 +113,7 @@ void ScriptManager::updateNodes(uint deltaTimeMillis) { // Remove the node iter = _activeControls.erase(iter); } else { - iter++; + ++iter; } } } @@ -132,10 +132,10 @@ void ScriptManager::checkPuzzleCriteria() { // Check each Criteria bool criteriaMet = false; - for (Common::List >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); criteriaIter++) { + for (Common::List >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); ++criteriaIter) { criteriaMet = false; - for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) { + for (Common::List::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) { // Get the value to compare against uint argumentValue; if (entryIter->argumentIsAKey) @@ -179,7 +179,7 @@ void ScriptManager::checkPuzzleCriteria() { setStateValue(puzzle->key, 1); bool shouldContinue = true; - for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + for (Common::List::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); ++resultIter) { shouldContinue = shouldContinue && (*resultIter)->execute(_engine); if (!shouldContinue) { break; @@ -194,7 +194,7 @@ void ScriptManager::checkPuzzleCriteria() { } void ScriptManager::cleanStateTable() { - for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { + for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { // If the value is equal to zero, we can purge it since getStateValue() // will return zero if _globalState doesn't contain a key if (iter->_value == 0) { @@ -215,7 +215,7 @@ void ScriptManager::setStateValue(uint32 key, uint value) { _globalState[key] = value; if (_referenceTable.contains(key)) { - for (Common::Array::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); iter++) { + for (Common::Array::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); ++iter) { _puzzlesToCheck.push((*iter)); } } @@ -230,7 +230,7 @@ void ScriptManager::addControl(Control *control) { } Control *ScriptManager::getControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { return (*iter); } @@ -240,7 +240,7 @@ Control *ScriptManager::getControl(uint32 key) { } void ScriptManager::enableControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->enable(); break; @@ -249,7 +249,7 @@ void ScriptManager::enableControl(uint32 key) { } void ScriptManager::disableControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->disable(); break; @@ -258,7 +258,7 @@ void ScriptManager::disableControl(uint32 key) { } void ScriptManager::focusControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { uint32 controlKey = (*iter)->getKey(); if (controlKey == key) { @@ -272,20 +272,20 @@ void ScriptManager::focusControl(uint32 key) { } void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); } } void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos); } } bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { bool cursorWasChanged = false; - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos); } @@ -293,13 +293,13 @@ bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Commo } void ScriptManager::onKeyDown(Common::KeyState keyState) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onKeyDown(keyState); } } void ScriptManager::onKeyUp(Common::KeyState keyState) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onKeyUp(keyState); } } @@ -314,11 +314,11 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, // Clear all the containers _referenceTable.clear(); _puzzlesToCheck.clear(); - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { delete (*iter); } _activePuzzles.clear(); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { delete (*iter); } _activeControls.clear(); @@ -343,12 +343,12 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _engine->getRenderManager()->setBackgroundPosition(offset); // Enable all the controls - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->enable(); } // Add all the local puzzles to the queue to be checked - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) { + for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { // Reset any Puzzles that have the flag ONCE_PER_INST if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter)->key, 0); @@ -358,7 +358,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, } // Add all the global puzzles to the queue to be checked - for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) { + for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { // Reset any Puzzles that have the flag ONCE_PER_INST if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter)->key, 0); @@ -382,7 +382,7 @@ void ScriptManager::serializeStateTable(Common::WriteStream *stream) { // Write the number of state value entries stream->writeUint32LE(_globalState.size()); - for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) { + for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { // Write out the key/value pair stream->writeUint32LE(iter->_key); stream->writeUint32LE(iter->_value); @@ -396,7 +396,7 @@ void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) { // Read the number of key/value pairs uint32 numberOfPairs = stream->readUint32LE(); - for (uint32 i = 0; i < numberOfPairs; i++) { + for (uint32 i = 0; i < numberOfPairs; ++i) { uint32 key = stream->readUint32LE(); uint32 value = stream->readUint32LE(); // Directly access the state table so we don't trigger Puzzle checks @@ -408,14 +408,14 @@ void ScriptManager::serializeControls(Common::WriteStream *stream) { // Count how many controls need to save their data // Because WriteStream isn't seekable uint32 numberOfControlsNeedingSerialization = 0; - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->needsSerialization()) { numberOfControlsNeedingSerialization++; } } stream->writeUint32LE(numberOfControlsNeedingSerialization); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->serialize(stream); } } @@ -423,9 +423,9 @@ void ScriptManager::serializeControls(Common::WriteStream *stream) { void ScriptManager::deserializeControls(Common::SeekableReadStream *stream) { uint32 numberOfControls = stream->readUint32LE(); - for (uint32 i = 0; i < numberOfControls; i++) { + for (uint32 i = 0; i < numberOfControls; ++i) { uint32 key = stream->readUint32LE(); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->deserialize(stream); break; diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 9ae479b47d1b..9ff1dd2e8758 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -41,7 +41,7 @@ StringManager::StringManager(ZVision *engine) } StringManager::~StringManager() { - for (Common::HashMap::iterator iter = _fonts.begin(); iter != _fonts.end(); iter++) { + for (Common::HashMap::iterator iter = _fonts.begin(); iter != _fonts.end(); ++iter) { delete iter->_value; } } @@ -80,7 +80,7 @@ void StringManager::parseStrFile(const Common::String &fileName) { uint textStringCursor = 0; bool inTag = false; - for (uint i = 0; i < asciiLine.size(); i++) { + for (uint i = 0; i < asciiLine.size(); ++i) { switch (asciiLine[i]) { case '<': inTag = true; diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 3348a43fe36e..af47de7fe0fe 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -70,7 +70,7 @@ template void removeDuplicateEntries(Common::Array &container) { Common::sort(container.begin(), container.end()); - for (uint i = 0; i + 1 < container.size(); i++) { + for (uint i = 0; i + 1 < container.size(); ++i) { while (i + 1 < container.size() && container[i] == container[i + 1]) { container.remove_at(i + 1); } diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 5230653ca322..2fe4d231ef34 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -43,11 +43,11 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, const byte *srcPtr = src; if (bytesPerPixel == 1) { - for (uint32 y = 0; y < srcHeight; y++) { - for (uint32 x = 0; x < srcWidth; x++) { + for (uint32 y = 0; y < srcHeight; ++y) { + for (uint32 x = 0; x < srcWidth; ++x) { const byte color = *srcPtr++; - for (uint i = 0; i < scaleAmount; i++) { + for (uint i = 0; i < scaleAmount; ++i) { dst[i] = color; dst[pitch + i] = color; } @@ -56,12 +56,12 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, dst += pitch; } } else if (bytesPerPixel == 2) { - for (uint32 y = 0; y < srcHeight; y++) { - for (uint32 x = 0; x < srcWidth; x++) { + for (uint32 y = 0; y < srcHeight; ++y) { + for (uint32 x = 0; x < srcWidth; ++x) { const byte color = *srcPtr++; const byte color2 = *srcPtr++; - for (uint i = 0; i < scaleAmount; i++) { + for (uint i = 0; i < scaleAmount; ++i) { uint index = i *2; dst[index] = color; diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index 0836336f302e..b0444fa5114c 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -78,7 +78,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { nextOffset = stream->readUint32LE(); // Read in each entry header - for (uint32 i = 0; i < _header.filesPerBlock; i++) { + for (uint32 i = 0; i < _header.filesPerBlock; ++i) { ZfsEntryHeader entryHeader; entryHeader.name = readEntryName(stream); @@ -149,7 +149,7 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common:: } void ZfsArchive::unXor(byte *buffer, uint32 length, const byte *xorKey) const { - for (uint32 i = 0; i < length; i++) + for (uint32 i = 0; i < length; ++i) buffer[i] ^= xorKey[i % 4]; } diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index ebb750874871..1231e406cb7e 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -165,13 +165,13 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, SoundParams soundParams; if (engine->getGameId() == GID_NEMESIS) { - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; ++i) { if (zNemSoundParamLookupTable[i].identifier == (fileName[6])) soundParams = zNemSoundParamLookupTable[i]; } } else if (engine->getGameId() == GID_GRANDINQUISITOR) { - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; ++i) { if (zgiSoundParamLookupTable[i].identifier == (fileName[7])) soundParams = zgiSoundParamLookupTable[i]; } From 4172334b51a33c0b68ad81ceba2aaf1a6e70d8f2 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:44:29 -0500 Subject: [PATCH 1188/1332] ZVISION: Remove global const variables Instead, use ColorMasks --- engines/zvision/rlf_animation.cpp | 19 +++++++++---------- engines/zvision/rlf_animation.h | 3 --- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index d932fa7698ba..008a2462672a 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -28,14 +28,13 @@ #include "common/debug.h" #include "common/endian.h" +#include "graphics/colormasks.h" + #include "zvision/rlf_animation.h" namespace ZVision { -const Graphics::PixelFormat RlfAnimation::_pixelFormat555 = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); -const Graphics::PixelFormat RlfAnimation::_pixelFormat565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) : _stream(stream), _lastFrameRead(0), @@ -56,7 +55,7 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) return; } - _currentFrameBuffer.create(_width, _height, _pixelFormat565); + _currentFrameBuffer.create(_width, _height, Graphics::createPixelFormat<565>()); _frameBufferByteSize = _width * _height * sizeof(uint16); if (!stream) { @@ -247,8 +246,8 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 destColor = _pixelFormat565.RGBToColor(r, g, b); + Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = Graphics::RGBToColor>(r, g, b); WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; @@ -293,8 +292,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 destColor = _pixelFormat565.RGBToColor(r, g, b); + Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = Graphics::RGBToColor>(r, g, b); WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; @@ -310,8 +309,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - _pixelFormat555.colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 sampleColor = _pixelFormat565.RGBToColor(r, g, b); + Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 sampleColor = Graphics::RGBToColor>(r, g, b); sourceOffset += 2; numberOfSamples += 2; diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 3f205d9666c3..ca9004f8b6ef 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -52,9 +52,6 @@ class RlfAnimation { uint32 encodedSize; }; - const static Graphics::PixelFormat _pixelFormat555; - const static Graphics::PixelFormat _pixelFormat565; - private: Common::File _file; bool _stream; From 4c06affe84640ffa1fc8487a4344b41c225d7d8e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:47:57 -0500 Subject: [PATCH 1189/1332] ZVISION: Convert _completeFrames to an Array --- engines/zvision/rlf_animation.cpp | 6 +++--- engines/zvision/rlf_animation.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 008a2462672a..f0d5ac5284b3 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -164,10 +164,10 @@ void RlfAnimation::seekToFrame(int frameNumber) { int closestFrame = _currentFrame; int distance = (int)frameNumber - _currentFrame; - for (Common::List::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); ++iter) { - int newDistance = (int)frameNumber - (int)(*iter); + for (int i = 0; i < _completeFrames.size(); ++i) { + int newDistance = (int)frameNumber - (int)(_completeFrames[i]); if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) { - closestFrame = (*iter); + closestFrame = _completeFrames[i]; distance = newDistance; } } diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index ca9004f8b6ef..53247eb4abca 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -62,7 +62,7 @@ class RlfAnimation { uint _height; uint32 _frameTime; // In milliseconds Frame *_frames; - Common::List _completeFrames; + Common::Array _completeFrames; int _currentFrame; Graphics::Surface _currentFrameBuffer; From afe8cba1a1d161062a54400258467167cab76776 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:49:33 -0500 Subject: [PATCH 1190/1332] ZVISION: Fix spacing --- engines/zvision/save_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 08a72648f718..9cc664ce5afb 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -41,7 +41,7 @@ const uint32 SaveManager::SAVEGAME_ID = MKTAG('Z', 'E', 'N', 'G'); void SaveManager::saveGame(uint slot, const Common::String &saveName) { // The games only support 20 slots - assert(slot <=1 && slot <= 20); + assert(slot <= 1 && slot <= 20); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::OutSaveFile *file = saveFileManager->openForSaving(_engine->generateSaveFileName(slot)); From 0deb84522988488b8b93d57bb525fd4a6f8e4588 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:56:35 -0500 Subject: [PATCH 1191/1332] ZVISION: Remove global const variable Replace with ColorMasks --- engines/zvision/string_manager.cpp | 5 ++--- engines/zvision/string_manager.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 9ff1dd2e8758..cac6858ef0fa 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -27,6 +27,7 @@ #include "common/debug.h" #include "graphics/fontman.h" +#include "graphics/colormasks.h" #include "zvision/string_manager.h" #include "zvision/truetype_font.h" @@ -34,8 +35,6 @@ namespace ZVision { -const Graphics::PixelFormat StringManager::_pixelFormat565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - StringManager::StringManager(ZVision *engine) : _engine(engine) { } @@ -206,7 +205,7 @@ void StringManager::parseTag(const Common::String &tagString, uint lineNumber) { } fragment.style.align = align; - fragment.style.color = _pixelFormat565.ARGBToColor(0, red, green, blue); + fragment.style.color = Graphics::ARGBToColor>(0, red, green, blue); _inGameText[lineNumber].fragments.push_back(fragment); _lastStyle = fragment.style; diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index b67573b3a327..74d13cd9940d 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -69,8 +69,6 @@ class StringManager { InGameText _inGameText[NUM_TEXT_LINES]; Common::HashMap _fonts; - static const Graphics::PixelFormat _pixelFormat565; - TextStyle _lastStyle; public: From 28ac59307b43da50964ad732a65dc676d613ad73 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:57:32 -0500 Subject: [PATCH 1192/1332] ZVISION: Update warning message to correspond to the behavior --- engines/zvision/string_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index cac6858ef0fa..3c9a3c6f0ceb 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -241,7 +241,7 @@ Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { } if (charOverflowWarning) { - warning("UTF-16 is not supported. Characters greater than 255 are clamped to 255"); + warning("UTF-16 is not supported. Characters greater than 255 are replaced with '?'"); } return asciiString; From 1f9ba897b8aa8afe776928ecd5ca480b8b2fc3a8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:00:57 -0500 Subject: [PATCH 1193/1332] ZVISION: Convert _timeLeft to a signed int This allows time decrementing to go negative instead of wrapping to UINT_MAX. Which makes comparisons easier. --- engines/zvision/timer_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index 21c344bb15d2..4bc8397ff0bc 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -48,7 +48,7 @@ class TimerNode : public Control { inline bool needsSerialization() { return true; } private: - uint32 _timeLeft; + int32 _timeLeft; }; } // End of namespace ZVision From b913e9f8a330328a6600539ecd03754e19560f97 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:46:57 -0500 Subject: [PATCH 1194/1332] ZVISION: Update removeDuplicateEntries to preserve order The new algorithm is potentially slower, but it doesn't need to use sort. Speed shouldn't be a problem because the function isn't used that often and in each case the size of the container is small. --- engines/zvision/utility.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index af47de7fe0fe..14077080f52e 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -61,20 +61,34 @@ void trimCommentsAndWhiteSpace(Common::String *string); void dumpEveryResultAction(const Common::String &destFile); /** - * Removes all duplicate entries from container. + * Removes all duplicate entries from container. Relative order will be preserved. * - * @param container - * @return + * @param container The Array to remove duplicate entries from */ template void removeDuplicateEntries(Common::Array &container) { - Common::sort(container.begin(), container.end()); + // Length of modified array + int newLength = 1; + int j; + + for(int i = 1; i < container.size(); i++) { + for(j = 0; j < newLength; j++) { + if (container[i] == container[j]) { + break; + } + } - for (uint i = 0; i + 1 < container.size(); ++i) { - while (i + 1 < container.size() && container[i] == container[i + 1]) { - container.remove_at(i + 1); + // If none of the values in index[0..j] of container are the same as array[i], + // then copy the current value to corresponding new position in array + if (j == newLength) { + container[newLength++] = container[i]; } } + + // Actually remove the unneeded space + while (container.size() < newLength) { + container.pop_back(); + } } /** From 1c8a5582a2dd23c01bda6002e746a4e5749b21b6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:47:16 -0500 Subject: [PATCH 1195/1332] ZVISION: Remove unnesessary operator overload --- engines/zvision/puzzle.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 75ea9541d2f6..97b839f9a7be 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -74,13 +74,6 @@ struct Puzzle { // This has to be list of pointers because ResultAction is abstract Common::List resultActions; uint flags; - - // Used by the ScriptManager to allow unique-ification of _referenceTable - // The unique-ification is done by sorting, then iterating and removing duplicates - // The sort uses operator< - inline bool operator<(const Puzzle &other) const { - return key < other.key; - } }; } // End of namespace ZVision From 18b1c3130fa1c6dbce79b83491c524e4a1f37867 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:48:34 -0500 Subject: [PATCH 1196/1332] ZVISION: Move two lookup tables inside the RawZorkStream class Instead of being global variables. --- engines/zvision/zork_raw.cpp | 23 +++++++++++++++++++---- engines/zvision/zork_raw.h | 17 ++--------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 1231e406cb7e..55ad2076e05b 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -52,6 +52,21 @@ const int32 RawZorkStream::_amplitudeLookupTable[89] = {0x0007, 0x0008, 0x0009, 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B, 0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF}; +const SoundParams RawZorkStream::_zNemSoundParamLookupTable[6] = {{'6', 0x2B11, false, false}, + {'a', 0x5622, false, true}, + {'b', 0x5622, true, true}, + {'n', 0x2B11, false, true}, + {'s', 0x5622, false, true}, + {'t', 0x5622, true, true} +}; + +const SoundParams RawZorkStream::_zgiSoundParamLookupTable[5] = {{'a',0x5622, false, false}, + {'k',0x2B11, true, true}, + {'p',0x5622, false, true}, + {'q',0x5622, true, true}, + {'u',0xAC44, true, true} +}; + RawZorkStream::RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream) : _rate(rate), _stereo(0), @@ -166,14 +181,14 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, if (engine->getGameId() == GID_NEMESIS) { for (int i = 0; i < 6; ++i) { - if (zNemSoundParamLookupTable[i].identifier == (fileName[6])) - soundParams = zNemSoundParamLookupTable[i]; + if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6])) + soundParams = RawZorkStream::_zNemSoundParamLookupTable[i]; } } else if (engine->getGameId() == GID_GRANDINQUISITOR) { for (int i = 0; i < 6; ++i) { - if (zgiSoundParamLookupTable[i].identifier == (fileName[7])) - soundParams = zgiSoundParamLookupTable[i]; + if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7])) + soundParams = RawZorkStream::_zgiSoundParamLookupTable[i]; } } diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index f19ffc16618d..62433b137b76 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -41,21 +41,6 @@ struct SoundParams { bool packed; }; -const SoundParams zNemSoundParamLookupTable[6] = {{'6', 0x2B11, false, false}, - {'a', 0x5622, false, true}, - {'b', 0x5622, true, true}, - {'n', 0x2B11, false, true}, - {'s', 0x5622, false, true}, - {'t', 0x5622, true, true} -}; - -const SoundParams zgiSoundParamLookupTable[5] = {{'a',0x5622, false, false}, - {'k',0x2B11, true, true}, - {'p',0x5622, false, true}, - {'q',0x5622, true, true}, - {'u',0xAC44, true, true} -}; - /** * This is a stream, which allows for playing raw ADPCM data from a stream. */ @@ -67,6 +52,8 @@ class RawZorkStream : public Audio::RewindableAudioStream { } public: + static const SoundParams _zNemSoundParamLookupTable[6]; + static const SoundParams _zgiSoundParamLookupTable[5]; private: const int _rate; // Sample rate of stream From 1140c8b48d6d814aa512af348bcb0463006250d3 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:49:01 -0500 Subject: [PATCH 1197/1332] ZVISION: Fix space formatting --- engines/zvision/zork_raw.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 62433b137b76..51248e341aaf 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -89,28 +89,28 @@ class RawZorkStream : public Audio::RewindableAudioStream { /** * Creates an audio stream, which plays from the given buffer. * - * @param buffer Buffer to play from. - * @param size Size of the buffer in bytes. - * @param rate Rate of the sound data. - * @param disposeAfterUse Whether to free the buffer after use (with free!). - * @return The new SeekableAudioStream (or 0 on failure). + * @param buffer Buffer to play from. + * @param size Size of the buffer in bytes. + * @param rate Rate of the sound data. + * @param dispose AfterUse Whether to free the buffer after use (with free!). + * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, int rate, - bool stereo, + bool stereo, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** * Creates an audio stream, which plays from the given stream. * - * @param stream Stream object to play from. - * @param rate Rate of the sound data. - * @param disposeAfterUse Whether to delete the stream after use. - * @return The new SeekableAudioStream (or 0 on failure). + * @param stream Stream object to play from. + * @param rate Rate of the sound data. + * @param dispose AfterUse Whether to delete the stream after use. + * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, int rate, - bool stereo, + bool stereo, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); From 1bdcae7f18c652b5ab0ab1b8993503745bf5102e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:50:36 -0500 Subject: [PATCH 1198/1332] ZVISION: Rename zvision.h inclusion guard to be consistent with the other files --- engines/zvision/zvision.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index bc7f9e32dbaa..13bdb3c755e6 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -21,8 +21,8 @@ * */ -#ifndef ZVISION_H -#define ZVISION_H +#ifndef ZVISION_ZVISION_H +#define ZVISION_ZVISION_H #include "common/random.h" #include "common/events.h" From bad28dc15872e208bf21f1e6fa2ab906bca598c4 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 20:08:41 -0500 Subject: [PATCH 1199/1332] ZVISION: Standardize includes order and format Format is: common/scummsys.h (Only if a .cpp file) header file for this file (Only if a .cpp file) zengine includes other includes, grouped by module --- engines/zvision/actions.cpp | 10 ++++++---- engines/zvision/actions.h | 5 +---- engines/zvision/animation_control.cpp | 7 +++++-- engines/zvision/animation_control.h | 10 ++++++++-- engines/zvision/clock.cpp | 3 ++- engines/zvision/console.cpp | 15 +++++++++------ engines/zvision/control.cpp | 5 +++-- engines/zvision/control.h | 2 -- engines/zvision/cursor.cpp | 4 ++-- engines/zvision/cursor.h | 3 +-- engines/zvision/cursor_manager.cpp | 8 +++++--- engines/zvision/cursor_manager.h | 4 ++-- engines/zvision/detection.cpp | 8 +++++--- engines/zvision/detection.h | 1 + engines/zvision/events.cpp | 13 ++++++++----- engines/zvision/input_control.cpp | 9 +++++---- engines/zvision/input_control.h | 4 ++-- engines/zvision/lever_control.cpp | 16 +++++++++------- engines/zvision/lever_control.h | 4 +--- engines/zvision/lzss_read_stream.cpp | 1 + engines/zvision/lzss_read_stream.h | 2 +- engines/zvision/push_toggle_control.cpp | 6 ++++-- engines/zvision/push_toggle_control.h | 4 +--- engines/zvision/puzzle.h | 2 +- engines/zvision/render_manager.cpp | 7 +++++-- engines/zvision/render_manager.h | 6 +++--- engines/zvision/render_table.cpp | 6 ++++-- engines/zvision/render_table.h | 5 ++--- engines/zvision/rlf_animation.cpp | 4 ++-- engines/zvision/rlf_animation.h | 3 +-- engines/zvision/save_manager.cpp | 11 ++++++----- engines/zvision/save_manager.h | 6 ++++-- engines/zvision/scr_file_handling.cpp | 2 ++ engines/zvision/script_manager.cpp | 12 +++++++----- engines/zvision/script_manager.h | 5 +++-- engines/zvision/single_value_container.cpp | 3 ++- engines/zvision/string_manager.cpp | 7 ++++--- engines/zvision/string_manager.h | 2 -- engines/zvision/timer_node.cpp | 6 ++++-- engines/zvision/timer_node.h | 2 -- engines/zvision/truetype_font.cpp | 9 +++++---- engines/zvision/truetype_font.h | 3 +-- engines/zvision/utility.cpp | 8 +++++--- engines/zvision/utility.h | 1 + engines/zvision/vector2.h | 3 +++ engines/zvision/video.cpp | 12 ++++++++---- engines/zvision/zfs_archive.cpp | 5 ++--- engines/zvision/zfs_archive.h | 1 + engines/zvision/zork_avi_decoder.cpp | 7 +++++-- engines/zvision/zork_avi_decoder.h | 1 + engines/zvision/zork_raw.cpp | 11 +++++++---- engines/zvision/zork_raw.h | 2 +- engines/zvision/zvision.cpp | 22 +++++++++++----------- engines/zvision/zvision.h | 6 +++--- 54 files changed, 186 insertions(+), 138 deletions(-) diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 75b771c14333..eae4ec2ed585 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -22,11 +22,8 @@ #include "common/scummsys.h" -#include "common/file.h" - -#include "audio/decoders/wave.h" - #include "zvision/actions.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" @@ -35,6 +32,11 @@ #include "zvision/timer_node.h" #include "zvision/animation_control.h" +#include "common/file.h" + +#include "audio/decoders/wave.h" + + namespace ZVision { ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 206b5e16b1e6..afa3e3a2acf7 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -23,13 +23,10 @@ #ifndef ZVISION_ACTIONS_H #define ZVISION_ACTIONS_H -#include "common/scummsys.h" +#include "common/str.h" #include "audio/mixer.h" -namespace Common { -class String; -} namespace ZVision { diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index bb810a86d0be..114338050142 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -22,15 +22,18 @@ #include "common/scummsys.h" -#include "video/video_decoder.h" - #include "zvision/animation_control.h" + #include "zvision/zvision.h" #include "zvision/render_manager.h" #include "zvision/script_manager.h" #include "zvision/rlf_animation.h" #include "zvision/zork_avi_decoder.h" +#include "video/video_decoder.h" + +#include "graphics/surface.h" + namespace ZVision { diff --git a/engines/zvision/animation_control.h b/engines/zvision/animation_control.h index 935f4abb4bc2..2ac36914836c 100644 --- a/engines/zvision/animation_control.h +++ b/engines/zvision/animation_control.h @@ -23,15 +23,21 @@ #ifndef ZVISION_ANIMATION_CONTROL_H #define ZVISION_ANIMATION_CONTROL_H -#include "common/types.h" - #include "zvision/control.h" +namespace Common { +class String; +} + namespace Video { class VideoDecoder; } +namespace Graphics { +struct Surface; +} + namespace ZVision { class ZVision; diff --git a/engines/zvision/clock.cpp b/engines/zvision/clock.cpp index fe322525f8b7..c8ee717a33b4 100644 --- a/engines/zvision/clock.cpp +++ b/engines/zvision/clock.cpp @@ -23,9 +23,10 @@ #include "common/scummsys.h" +#include "zvision/clock.h" + #include "common/system.h" -#include "zvision/clock.h" namespace ZVision { diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index 0d290a661af8..a095d3fa6a62 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -22,13 +22,8 @@ #include "common/scummsys.h" -#include "common/system.h" -#include "gui/debugger.h" -#include "common/file.h" -#include "common/bufferedstream.h" -#include "audio/mixer.h" - #include "zvision/console.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" @@ -38,6 +33,14 @@ #include "zvision/utility.h" #include "zvision/cursor.h" +#include "common/system.h" +#include "common/file.h" +#include "common/bufferedstream.h" + +#include "gui/debugger.h" + +#include "audio/mixer.h" + namespace ZVision { diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index ad0a4c501335..bcbdabc1432f 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -22,13 +22,14 @@ #include "common/scummsys.h" -#include "common/stream.h" - #include "zvision/control.h" + #include "zvision/zvision.h" #include "zvision/render_manager.h" #include "zvision/utility.h" +#include "common/stream.h" + namespace ZVision { diff --git a/engines/zvision/control.h b/engines/zvision/control.h index a27938129870..770c540a1217 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -23,8 +23,6 @@ #ifndef ZVISION_CONTROL_H #define ZVISION_CONTROL_H -#include "common/types.h" - #include "common/keyboard.h" diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp index bb0700cebe5a..9023d97e0dd8 100644 --- a/engines/zvision/cursor.cpp +++ b/engines/zvision/cursor.cpp @@ -22,11 +22,11 @@ #include "common/scummsys.h" +#include "zvision/cursor.h" + #include "common/str.h" #include "common/file.h" -#include "zvision/cursor.h" - namespace ZVision { diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index 805a8e798243..18ac28ce8b23 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -23,10 +23,9 @@ #ifndef ZVISION_CURSOR_H #define ZVISION_CURSOR_H -#include "common/types.h" - #include "graphics/surface.h" + namespace Common { class String; } diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 0f524bf8072b..595e7946dd96 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -22,13 +22,15 @@ #include "common/scummsys.h" +#include "zvision/cursor_manager.h" + +#include "zvision/zvision.h" + #include "common/system.h" + #include "graphics/pixelformat.h" #include "graphics/cursorman.h" -#include "zvision/zvision.h" -#include "zvision/cursor_manager.h" - namespace ZVision { diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index 1c09620b7edd..0a369aaf9e93 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -23,10 +23,10 @@ #ifndef ZVISION_CURSOR_MANAGER_H #define ZVISION_CURSOR_MANAGER_H -#include "common/types.h" - #include "zvision/cursor.h" +#include "common/str.h" + namespace Graphics { struct PixelFormat; diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 28b7134fae49..06e921dfa8de 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -21,16 +21,18 @@ * */ +#include "common/scummsys.h" + #include "base/plugins.h" +#include "zvision/zvision.h" +#include "zvision/detection.h" + #include "common/translation.h" #include "common/savefile.h" #include "common/str-array.h" #include "common/system.h" -#include "zvision/zvision.h" -#include "zvision/detection.h" - namespace ZVision { diff --git a/engines/zvision/detection.h b/engines/zvision/detection.h index f9acb4d14465..34417601e863 100644 --- a/engines/zvision/detection.h +++ b/engines/zvision/detection.h @@ -25,6 +25,7 @@ #include "engines/advancedDetector.h" + namespace ZVision { enum ZVisionGameId { diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index c1b894c29024..1103dc300078 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -23,17 +23,20 @@ #include "common/scummsys.h" #include "zvision/zvision.h" -#include "zvision/console.h" -#include "common/events.h" -#include "engines/util.h" -#include "common/system.h" -#include "common/rational.h" +#include "zvision/console.h" #include "zvision/cursor_manager.h" #include "zvision/render_manager.h" #include "zvision/script_manager.h" #include "zvision/rlf_animation.h" +#include "common/events.h" +#include "common/system.h" +#include "common/rational.h" + +#include "engines/util.h" + + namespace ZVision { void ZVision::processEvents() { diff --git a/engines/zvision/input_control.cpp b/engines/zvision/input_control.cpp index ab4cc6bd625c..a445e1aae52c 100644 --- a/engines/zvision/input_control.cpp +++ b/engines/zvision/input_control.cpp @@ -22,17 +22,18 @@ #include "common/scummsys.h" -#include "common/str.h" -#include "common/stream.h" -#include "common/rect.h" - #include "zvision/input_control.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/string_manager.h" #include "zvision/render_manager.h" #include "zvision/utility.h" +#include "common/str.h" +#include "common/stream.h" +#include "common/rect.h" + namespace ZVision { diff --git a/engines/zvision/input_control.h b/engines/zvision/input_control.h index 33a1b343137e..aab2c991dcfa 100644 --- a/engines/zvision/input_control.h +++ b/engines/zvision/input_control.h @@ -23,11 +23,11 @@ #ifndef ZVISION_INPUT_CONTROL_H #define ZVISION_INPUT_CONTROL_H -#include "common/types.h" - #include "zvision/control.h" #include "zvision/string_manager.h" +#include "common/rect.h" + namespace ZVision { diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 4e04ed4263d7..79049b8fcba0 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -22,14 +22,8 @@ #include "common/scummsys.h" -#include "common/stream.h" -#include "common/file.h" -#include "common/tokenizer.h" -#include "common/system.h" - -#include "graphics/surface.h" - #include "zvision/lever_control.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/render_manager.h" @@ -38,6 +32,14 @@ #include "zvision/zork_avi_decoder.h" #include "zvision/utility.h" +#include "common/stream.h" +#include "common/file.h" +#include "common/tokenizer.h" +#include "common/system.h" + +#include "graphics/surface.h" + + namespace ZVision { LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index 80fda4f5fde8..8ef8f06feceb 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -23,13 +23,11 @@ #ifndef ZVISION_LEVER_CONTROL_H #define ZVISION_LEVER_CONTROL_H -#include "common/types.h" +#include "zvision/control.h" #include "common/list.h" #include "common/rect.h" -#include "zvision/control.h" - namespace ZVision { diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index a90f40b3e474..bbbda6f526be 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -24,6 +24,7 @@ #include "zvision/lzss_read_stream.h" + namespace ZVision { LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index 25a8b672222d..f6b1eb1a6519 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -23,10 +23,10 @@ #ifndef ZVISION_LZSS_STREAM_H #define ZVISION_LZSS_STREAM_H -#include "common/types.h" #include "common/stream.h" #include "common/array.h" + namespace Common { class SeekableReadStream; } diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp index f4c0bc987ebc..689311ba5b85 100644 --- a/engines/zvision/push_toggle_control.cpp +++ b/engines/zvision/push_toggle_control.cpp @@ -22,14 +22,16 @@ #include "common/scummsys.h" -#include "common/stream.h" - #include "zvision/push_toggle_control.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" #include "zvision/cursor_manager.h" #include "zvision/utility.h" +#include "common/stream.h" + + namespace ZVision { PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) diff --git a/engines/zvision/push_toggle_control.h b/engines/zvision/push_toggle_control.h index 8ab6f619bbb8..2a407cada94b 100644 --- a/engines/zvision/push_toggle_control.h +++ b/engines/zvision/push_toggle_control.h @@ -23,12 +23,10 @@ #ifndef ZVISION_PUSH_TOGGLE_CONTROL_H #define ZVISION_PUSH_TOGGLE_CONTROL_H -#include "common/types.h" +#include "zvision/control.h" #include "common/rect.h" -#include "zvision/control.h" - namespace ZVision { diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 97b839f9a7be..1e730365dcb2 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -23,11 +23,11 @@ #ifndef ZVISION_PUZZLE_H #define ZVISION_PUZZLE_H +#include "zvision/actions.h" #include "common/list.h" #include "common/ptr.h" -#include "zvision/actions.h" namespace ZVision { diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index b8286266daff..a8ceabcd7439 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -22,15 +22,18 @@ #include "common/scummsys.h" +#include "zvision/render_manager.h" + +#include "zvision/lzss_read_stream.h" + #include "common/file.h" #include "common/system.h" #include "common/stream.h" #include "engines/util.h" + #include "graphics/decoders/tga.h" -#include "zvision/render_manager.h" -#include "zvision/lzss_read_stream.h" namespace ZVision { diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 71f4807c2981..64d36f5c9de0 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -23,14 +23,14 @@ #ifndef ZVISION_RENDER_MANAGER_H #define ZVISION_RENDER_MANAGER_H -#include "common/types.h" +#include "zvision/render_table.h" +#include "zvision/truetype_font.h" + #include "common/rect.h" #include "common/hashmap.h" #include "graphics/surface.h" -#include "zvision/render_table.h" -#include "zvision/truetype_font.h" class OSystem; diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index ce247e23fd21..f4437101dbab 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -22,11 +22,13 @@ #include "common/scummsys.h" -#include "graphics/colormasks.h" - #include "zvision/render_table.h" + #include "zvision/vector2.h" +#include "graphics/colormasks.h" + + namespace ZVision { RenderTable::RenderTable(uint numColumns, uint numRows) diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 7c8e7d6a2df3..b188b1492f07 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -23,11 +23,10 @@ #ifndef ZVISION_RENDER_TABLE_H #define ZVISION_RENDER_TABLE_H -#include "common/types.h" -#include "common/rect.h" - #include "zvision/vector2.h" +#include "common/rect.h" + namespace ZVision { class RenderTable { diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index f0d5ac5284b3..94e48d3609c1 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -22,6 +22,8 @@ #include "common/scummsys.h" +#include "zvision/rlf_animation.h" + #include "common/str.h" #include "common/file.h" #include "common/textconsole.h" @@ -30,8 +32,6 @@ #include "graphics/colormasks.h" -#include "zvision/rlf_animation.h" - namespace ZVision { diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 53247eb4abca..fe5b0d68b47e 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -23,9 +23,8 @@ #ifndef ZVISION_RLF_ANIMATION_H #define ZVISION_RLF_ANIMATION_H -#include "common/types.h" - #include "common/file.h" + #include "graphics/surface.h" diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index 9cc664ce5afb..c3deadd7033f 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -22,6 +22,12 @@ #include "common/scummsys.h" +#include "zvision/save_manager.h" + +#include "zvision/zvision.h" +#include "zvision/script_manager.h" +#include "zvision/render_manager.h" + #include "common/system.h" #include "graphics/surface.h" @@ -29,11 +35,6 @@ #include "gui/message.h" -#include "zvision/save_manager.h" -#include "zvision/zvision.h" -#include "zvision/script_manager.h" -#include "zvision/render_manager.h" - namespace ZVision { diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index 6445f10cafc4..b4770e68b2ad 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -23,14 +23,16 @@ #ifndef ZVISION_SAVE_MANAGER_H #define ZVISION_SAVE_MANAGER_H -#include "common/types.h" - #include "common/savefile.h" namespace Common { class String; } +namespace Graphics { +struct Surface; +} + namespace ZVision { class ZVision; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index fa89f756e452..e90408cf0d71 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "zvision/script_manager.h" + #include "zvision/utility.h" #include "zvision/puzzle.h" #include "zvision/actions.h" @@ -33,6 +34,7 @@ #include "common/file.h" #include "common/tokenizer.h" + namespace ZVision { void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 31983a684e42..f3e14e6f5b60 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -22,19 +22,21 @@ #include "common/scummsys.h" -#include "common/algorithm.h" -#include "common/hashmap.h" -#include "common/debug.h" -#include "common/stream.h" +#include "zvision/script_manager.h" #include "zvision/zvision.h" -#include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/cursor_manager.h" #include "zvision/save_manager.h" #include "zvision/actions.h" #include "zvision/utility.h" +#include "common/algorithm.h" +#include "common/hashmap.h" +#include "common/debug.h" +#include "common/stream.h" + + namespace ZVision { ScriptManager::ScriptManager(ZVision *engine) diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 349f25919892..6276095e1218 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -23,11 +23,12 @@ #ifndef ZVISION_SCRIPT_MANAGER_H #define ZVISION_SCRIPT_MANAGER_H +#include "zvision/puzzle.h" +#include "zvision/control.h" + #include "common/hashmap.h" #include "common/queue.h" -#include "zvision/puzzle.h" -#include "zvision/control.h" namespace Common { class String; diff --git a/engines/zvision/single_value_container.cpp b/engines/zvision/single_value_container.cpp index 0fd758a85eb4..837bd8d7fcc6 100644 --- a/engines/zvision/single_value_container.cpp +++ b/engines/zvision/single_value_container.cpp @@ -22,10 +22,11 @@ #include "common/scummsys.h" +#include "zvision/single_value_container.h" + #include "common/textconsole.h" #include "common/str.h" -#include "zvision/single_value_container.h" namespace ZVision { diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index 3c9a3c6f0ceb..fde99c02a1a9 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -22,6 +22,10 @@ #include "common/scummsys.h" +#include "zvision/string_manager.h" + +#include "zvision/truetype_font.h" + #include "common/file.h" #include "common/tokenizer.h" #include "common/debug.h" @@ -29,9 +33,6 @@ #include "graphics/fontman.h" #include "graphics/colormasks.h" -#include "zvision/string_manager.h" -#include "zvision/truetype_font.h" - namespace ZVision { diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index 74d13cd9940d..9cfed5261bc7 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -24,8 +24,6 @@ #ifndef ZVISION_STRING_MANAGER_H #define ZVISION_STRING_MANAGER_H -#include "common/types.h" - #include "zvision/detection.h" #include "zvision/truetype_font.h" diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp index 81468dbb0bfe..55dfa51dfea2 100644 --- a/engines/zvision/timer_node.cpp +++ b/engines/zvision/timer_node.cpp @@ -22,12 +22,14 @@ #include "common/scummsys.h" -#include "common/stream.h" - #include "zvision/timer_node.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "common/stream.h" + + namespace ZVision { TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index 4bc8397ff0bc..32dca7154846 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -23,8 +23,6 @@ #ifndef ZVISION_TIMER_NODE_H #define ZVISION_TIMER_NODE_H -#include "common/types.h" - #include "zvision/control.h" namespace ZVision { diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index 80d0d6bddb52..8d6aaca51e52 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -22,6 +22,11 @@ #include "common/scummsys.h" +#include "zvision/truetype_font.h" + +#include "zvision/zvision.h" +#include "zvision/render_manager.h" + #include "common/debug.h" #include "common/file.h" #include "common/system.h" @@ -30,10 +35,6 @@ #include "graphics/fonts/ttf.h" #include "graphics/surface.h" -#include "zvision/truetype_font.h" -#include "zvision/zvision.h" -#include "zvision/render_manager.h" - namespace ZVision { diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index c7475d1adbf1..4f2ff864a8fe 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -25,11 +25,10 @@ #ifndef ZVISION_TRUETYPE_FONT_H #define ZVISION_TRUETYPE_FONT_H -#include "common/types.h" - #include "graphics/font.h" #include "graphics/pixelformat.h" + namespace Graphics { struct Surface; } diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index fb4fe22ff88a..d973cb2f4cee 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -22,13 +22,15 @@ #include "common/scummsys.h" -#include "common/tokenizer.h" -#include "common/file.h" - #include "zvision/utility.h" + #include "zvision/zvision.h" #include "zvision/zork_raw.h" +#include "common/tokenizer.h" +#include "common/file.h" + + namespace ZVision { void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) { diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 14077080f52e..4aceec6e4f55 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -26,6 +26,7 @@ #include "common/array.h" + namespace Common { class String; } diff --git a/engines/zvision/vector2.h b/engines/zvision/vector2.h index 575915c87d1f..9616a43218b9 100644 --- a/engines/zvision/vector2.h +++ b/engines/zvision/vector2.h @@ -25,6 +25,9 @@ #include "common/scummsys.h" +#include "common/util.h" + + namespace ZVision { /** diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 2fe4d231ef34..cd11618e679a 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -22,14 +22,18 @@ #include "common/scummsys.h" +#include "zvision/zvision.h" + +#include "zvision/clock.h" +#include "zvision/render_manager.h" + #include "common/system.h" + #include "video/video_decoder.h" + #include "engines/util.h" -#include "graphics/surface.h" -#include "zvision/clock.h" -#include "zvision/render_manager.h" -#include "zvision/zvision.h" +#include "graphics/surface.h" namespace ZVision { diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index b0444fa5114c..24cff27fc446 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -22,13 +22,12 @@ #include "common/scummsys.h" -#include "common/hashmap.h" +#include "zvision/zfs_archive.h" + #include "common/memstream.h" #include "common/debug.h" #include "common/file.h" -#include "zvision/zfs_archive.h" - namespace ZVision { ZfsArchive::ZfsArchive(const Common::String &fileName) : _fileName(fileName) { diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/zfs_archive.h index 3bf492578c36..d7b45e4b47aa 100644 --- a/engines/zvision/zfs_archive.h +++ b/engines/zvision/zfs_archive.h @@ -25,6 +25,7 @@ #include "common/archive.h" #include "common/hashmap.h" +#include "common/hash-str.h" namespace Common { diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/zork_avi_decoder.cpp index d9b9511175ac..a614f77bb7c0 100644 --- a/engines/zvision/zork_avi_decoder.cpp +++ b/engines/zvision/zork_avi_decoder.cpp @@ -23,11 +23,14 @@ #include "common/scummsys.h" +#include "zvision/zork_avi_decoder.h" + +#include "zvision/zork_raw.h" + #include "common/stream.h" + #include "audio/audiostream.h" -#include "zvision/zork_avi_decoder.h" -#include "zvision/zork_raw.h" namespace ZVision { diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h index 1ce250882845..ec2be1bb13bb 100644 --- a/engines/zvision/zork_avi_decoder.h +++ b/engines/zvision/zork_avi_decoder.h @@ -26,6 +26,7 @@ #include "video/avi_decoder.h" + namespace ZVision { class ZorkAVIDecoder : public Video::AVIDecoder { diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 55ad2076e05b..55493da9b3f8 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -22,19 +22,22 @@ #include "common/scummsys.h" +#include "zvision/zork_raw.h" + +#include "zvision/zvision.h" +#include "zvision/detection.h" +#include "zvision/utility.h" + #include "common/file.h" #include "common/str.h" #include "common/stream.h" #include "common/memstream.h" #include "common/bufferedstream.h" #include "common/util.h" + #include "audio/audiostream.h" #include "audio/decoders/raw.h" -#include "zvision/zork_raw.h" -#include "zvision/zvision.h" -#include "zvision/detection.h" -#include "zvision/utility.h" namespace ZVision { diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 51248e341aaf..481ea79f2da9 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -23,9 +23,9 @@ #ifndef ZVISION_ZORK_RAW_H #define ZVISION_ZORK_RAW_H -#include "common/types.h" #include "audio/audiostream.h" + namespace Common { class SeekableReadStream; } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 6cdc144424e0..6d8ae6d5a72a 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -22,6 +22,17 @@ #include "common/scummsys.h" +#include "zvision/zvision.h" + +#include "zvision/console.h" +#include "zvision/script_manager.h" +#include "zvision/render_manager.h" +#include "zvision/cursor_manager.h" +#include "zvision/save_manager.h" +#include "zvision/string_manager.h" +#include "zvision/zfs_archive.h" +#include "zvision/detection.h" + #include "common/config-manager.h" #include "common/debug.h" #include "common/debug-channels.h" @@ -33,18 +44,7 @@ #include "engines/util.h" #include "audio/mixer.h" - -#include "zvision/zvision.h" -#include "zvision/console.h" -#include "zvision/script_manager.h" -#include "zvision/render_manager.h" -#include "zvision/cursor_manager.h" -#include "zvision/save_manager.h" -#include "zvision/string_manager.h" -#include "zvision/zfs_archive.h" -#include "zvision/detection.h" -#include "zvision/utility.h" namespace ZVision { diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 13bdb3c755e6..84784d9a89ed 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -24,6 +24,9 @@ #ifndef ZVISION_ZVISION_H #define ZVISION_ZVISION_H +#include "zvision/detection.h" +#include "zvision/clock.h" + #include "common/random.h" #include "common/events.h" @@ -31,9 +34,6 @@ #include "graphics/pixelformat.h" -#include "zvision/detection.h" -#include "zvision/clock.h" - #include "gui/debugger.h" From 23a1a1a70fd0481f17e49631e0884d7027d21528 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 20:08:57 -0500 Subject: [PATCH 1200/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/utility.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 4aceec6e4f55..fb571f3fe81e 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -69,10 +69,10 @@ void dumpEveryResultAction(const Common::String &destFile); template void removeDuplicateEntries(Common::Array &container) { // Length of modified array - int newLength = 1; - int j; + uint newLength = 1; + uint j; - for(int i = 1; i < container.size(); i++) { + for(uint i = 1; i < container.size(); i++) { for(j = 0; j < newLength; j++) { if (container[i] == container[j]) { break; From 9093b2c258c9f39a594265fa856af1a62a2a283a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Oct 2013 21:56:01 +0200 Subject: [PATCH 1201/1332] AVALANCHE: Use Doxygen comments in Dialogs, set private some members --- engines/avalanche/dialogs.cpp | 78 +++++++++++++++++++++++++++++------ engines/avalanche/dialogs.h | 49 +++++++++------------- 2 files changed, 86 insertions(+), 41 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index f3b26886004f..fd2e47b34d19 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -48,7 +48,11 @@ void Dialogs::init() { resetScrollDriver(); } -void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever +/** + * Determine the color of the ready light and draw it + * @remarks Originally called 'state' + */ +void Dialogs::setReadyLight(byte state) { if (_vm->_ledStatus == state) return; // Already like that! @@ -63,7 +67,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever color = kColorGreen; break; // Hit a key } - warning("STUB: Scrolls::state()"); + warning("STUB: Dialogs::setReadyLight()"); CursorMan.showMouse(false); _vm->_graphics->drawReadyLight(color); @@ -104,6 +108,10 @@ void Dialogs::say(int16 x, int16 y, Common::String z) { } } +/** + * One of the 3 "Mode" functions passed as ScrollsFunctionType parameters. + * @remarks Originally called 'normscroll' + */ void Dialogs::scrollModeNormal() { // Original code is: // egg : array[1..8] of char = ^P^L^U^G^H+'***'; @@ -124,11 +132,10 @@ void Dialogs::scrollModeNormal() { _vm->_graphics->refreshScreen(); _vm->getEvent(event); - if (_vm->shouldQuit() || - (event.type == Common::EVENT_LBUTTONUP) || - ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) - || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) - || (event.kbd.keycode == Common::KEYCODE_PLUS)))) + if ((event.type == Common::EVENT_LBUTTONUP) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || + (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || + (event.kbd.keycode == Common::KEYCODE_PLUS)))) break; } @@ -176,6 +183,11 @@ void Dialogs::scrollModeNormal() { warning("STUB: Scrolls::scrollModeNormal()"); } +/** + * One of the 3 "Mode" functions passed as ScrollsFunctionType parameters. + * The "asking" scroll. Used indirectly in diplayQuestion(). + * @remarks Originally called 'dialogue' + */ void Dialogs::scrollModeDialogue() { _vm->_graphics->loadMouse(kCurHand); @@ -232,6 +244,11 @@ bool Dialogs::theyMatch(TuneType &played) { return mistakes < 5; } +/** + * One of the 3 "Mode" functions passed as ScrollsFunctionType parameters. + * Part of the harp mini-game. + * @remarks Originally called 'music_Scroll' + */ void Dialogs::scrollModeMusic() { setReadyLight(3); _vm->_seeScroll = true; @@ -347,16 +364,29 @@ void Dialogs::resetScrollDriver() { _vm->_interrogation = 0; // Always reset after a scroll comes up. } -void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... +/** + * Rings the bell x times + * @remarks Originally called 'dingdongbell' + */ +void Dialogs::ringBell() { for (int i = 0; i < _scrollBells; i++) - _vm->errorLed(); // Ring the bell "x" times. + _vm->errorLed(); // Ring the bell "_scrollBells" times. } +/** + * This moves the mouse pointer off the scroll so that you can read it. + * @remarks Originally called 'dodgem' + */ void Dialogs::dodgem() { _dodgeCoord = _vm->getMousePos(); g_system->warpMouse(_dodgeCoord.x, _underScroll); // Move the pointer off the scroll. } +/** + * This is the opposite of Dodgem. + * It moves the mouse pointer back, IF you haven't moved it in the meantime. + * @remarks Originally called 'undodgem' + */ void Dialogs::unDodgem() { Common::Point actCoord = _vm->getMousePos(); if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _underScroll)) @@ -512,6 +542,10 @@ void Dialogs::reset() { } } +/** + * Natural state of bubbles + * @remarks Originally called 'natural' + */ void Dialogs::setBubbleStateNatural() { _vm->_talkX = 320; _vm->_talkY = 200; @@ -540,11 +574,18 @@ Common::String Dialogs::displayMoney() { return result; } +/** + * Strip trailing character in a string + * @remarks Originally called 'strip' + */ void Dialogs::stripTrailingSpaces(Common::String &str) { - while (str[str.size() - 1] == ' ') + while (str.lastChar() == ' ') str.deleteLastChar(); } +/** + * Does the word wrapping. + */ void Dialogs::solidify(byte n) { if (!_scroll[n].contains(' ')) return; // No spaces. @@ -558,6 +599,9 @@ void Dialogs::solidify(byte n) { stripTrailingSpaces(_scroll[n]); } +/** + * @remarks Originally called 'calldriver' + */ void Dialogs::callDialogDriver() { // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? warning("STUB: Scrolls::calldrivers()"); @@ -737,6 +781,10 @@ void Dialogs::callDialogDriver() { } } +/** + * Display text by calling the dialog driver + * @remarks Originally called 'display' + */ void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! _bufSize = text.size(); memcpy(_buffer, text.c_str(), _bufSize); @@ -784,6 +832,10 @@ void Dialogs::loadFont() { file.close(); } +/** + * Practically this one is a mini-game which called when you play the harp in the monastery. + * @remarks Originally called 'musical_scroll' + */ void Dialogs::displayMusicalScroll() { Common::String tmpStr = Common::String::format("To play the harp...%c%cUse these keys:%c%cQ W E R T Y U I O P [ ]%c%cOr press Enter to stop playing.%c", kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); @@ -796,8 +848,6 @@ void Dialogs::displayMusicalScroll() { reset(); } -// From Visa: - void Dialogs::unSkrimble() { for (uint16 i = 0; i < _bufSize; i++) _buffer[i] = (~(_buffer[i] - (i + 1))) % 256; @@ -1035,6 +1085,10 @@ void Dialogs::talkTo(byte whom) { } } +/** + * This makes Avalot say the response. + * @remarks Originally called 'sayit' + */ void Dialogs::sayIt(Common::String str) { Common::String x = str; x.setChar(toupper(x[0]), 0); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 94ffaf940122..d8c205ac90a7 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -41,28 +41,21 @@ typedef void (Dialogs::*DialogFunctionType)(); class Dialogs { public: - bool _aboutBox; // Is this the about box? + bool _aboutBox; // Is this the about box? - Used in scrollModeNormal(), not yet fully implemented FontType _fonts[2]; Dialogs(AvalancheEngine *vm); void init(); - void setReadyLight(byte state); // Sets "Ready" light to whatever. - void drawScroll(DialogFunctionType modeFunc); - void drawBubble(DialogFunctionType modeFunc); void reset(); - void callDialogDriver(); + void setReadyLight(byte state); void displayText(Common::String text); bool displayQuestion(Common::String question); - void setBubbleStateNatural(); // Natural state of bubbles - Common::String displayMoney(); - void displayMusicalScroll(); // Practically this one is a mini-game which called when you play the harp in the monastery. - - // From Visa: + void setBubbleStateNatural(); + void displayMusicalScroll(); void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); void talkTo(byte whom); - - void sayIt(Common::String str); // This makes Avalot say the response. + void sayIt(Common::String str); private: AvalancheEngine *_vm; @@ -72,46 +65,44 @@ class Dialogs { kFontStyleItalic }; - static const int16 kHalfIconWidth = 19; // Half the width of an icon. + static const int16 kHalfIconWidth = 19; - int16 _shadowBoxX, _shadowBoxY; - byte _currentFont; // Current font Common::String _scroll[15]; Common::Point _dodgeCoord; - byte _param; // For using arguments code - byte _useIcon; byte _maxLineNum; bool _scReturn; + bool _noError; + byte _currentFont; + byte _param; // For using arguments code + byte _useIcon; byte _scrollBells; // no. of times to ring the bell byte _buffer[2000]; uint16 _bufSize; int16 _underScroll; // Y-coord of just under the scroll text. + int16 _shadowBoxX, _shadowBoxY; - // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. + void callDialogDriver(); + void drawBubble(DialogFunctionType modeFunc); + void drawScroll(DialogFunctionType modeFunc); void scrollModeNormal(); - // The "asking" scroll. Used indirectly in diplayQuestion(). void scrollModeDialogue(); - // Part of the harp mini-game. void scrollModeMusic(); // These 2 are used only in musicalScroll(). void store(byte what, TuneType &played); bool theyMatch(TuneType &played); + void stripTrailingSpaces(Common::String &str); + void solidify(byte n); + void dodgem(); + void unDodgem(); - void stripTrailingSpaces(Common::String &str); // Original: strip. - void solidify(byte n); // Does the word wrapping. - - void dodgem(); // This moves the mouse pointer off the scroll so that you can read it. - void unDodgem(); // This is the opposite of Dodgem. It moves the mouse pointer back, IF you haven't moved it in the meantime. - + Common::String displayMoney(); void easterEgg(); void say(int16 x, int16 y, Common::String text); void resetScrollDriver(); - void ringBell(); // Original: dingdongbell + void ringBell(); void loadFont(); - // From Visa: - bool _noError; void unSkrimble(); void doTheBubble(); void speak(byte who, byte subject); From efe6236e7ba901571123e11d4a2c9d36ba0a9069 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Oct 2013 23:39:18 +0200 Subject: [PATCH 1202/1332] AVALANCHE: Make _surface private --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/background.cpp | 13 +++---------- engines/avalanche/graphics.cpp | 22 ++++++++++++++++++++-- engines/avalanche/graphics.h | 24 +++++++++++------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 4f30b824d5cf..8cc11917f799 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -198,7 +198,7 @@ void Clock::drawHand(const Common::Point &endPoint, Color color) { if (endPoint.x == 177) return; - _vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); + _vm->_graphics->drawScreenLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); } void Clock::plotHands() { diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index e72e4a4cca77..99bb446d3f65 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -294,16 +294,9 @@ void Background::load(byte number) { _sprites[i]._yl = sprite._yl; _sprites[i]._type = sprite._type; - if (natural) { - _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back. - _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; - _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, Graphics::PixelFormat::createFormatCLUT8()); - - for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { - for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) - *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(_sprites[i]._x * 8 + x, _sprites[i]._y + y); - } - } else { + if (natural) + _vm->_graphics->getNaturalPicture(_sprites[i]); + else { _sprites[i]._size = sprite._size; _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index ff998a05348c..a733dfa5f132 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -86,7 +86,11 @@ void GraphicManager::init() { _scrolls.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); } -void GraphicManager::loadDigits(Common::File &file) { // Load the scoring digits & rwlites +/** + * Load the scoring digits & rwlites + * @remarks Originally called 'load_digits' + */ +void GraphicManager::loadDigits(Common::File &file) { const byte digitsize = 134; const byte rwlitesize = 126; @@ -512,6 +516,10 @@ void GraphicManager::setAlsoLine(int x1, int y1, int x2, int y2, Color color) { _magics.drawLine(x1, y1, x2, y2, color); } +void GraphicManager::drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color) { + _surface.drawLine(x, y, x2, y2, color); +} + byte GraphicManager::getAlsoColor(int x1, int y1, int x2, int y2) { byte returnColor = 0; for (int16 i = x1; i <= x2; i++) { @@ -553,7 +561,7 @@ void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, } } -void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY) { +void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. for (uint16 y = 0; y < picture.h; y++) { for (uint16 x = 0; x < picture.w; x++) @@ -701,6 +709,16 @@ void GraphicManager::showScroll() { _surface.copyFrom(_scrolls); // TODO: Rework it using getSubArea !!!!!!! } +void GraphicManager::getNaturalPicture(SpriteType &sprite) { + sprite._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back. + sprite._size = sprite._xl * 8 * sprite._yl + 1; + sprite._picture.create(sprite._xl * 8, sprite._yl + 1, Graphics::PixelFormat::createFormatCLUT8()); + for (uint16 y = 0; y < sprite._yl + 1; y++) { + for (uint16 x = 0; x < sprite._xl * 8; x++) + *(byte *)sprite._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(sprite._x * 8 + x, sprite._y + y); + } +} + void GraphicManager::saveScreen() { _backup.copyFrom(_surface); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index b3710742cabe..8a9d26cb992e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -39,11 +39,7 @@ class AvalancheEngine; struct SpriteType; typedef byte FontType[256][16]; - typedef byte ManiType[2049]; -// manitype = array[5..2053] of byte; -// Be aware!!! - typedef byte SilType[51][11]; // 35, 4 class SpriteInfo { @@ -55,21 +51,19 @@ class SpriteInfo { uint16 _size; // The size of one picture. }; -struct MouseHotspotType { // mouse-void +struct MouseHotspotType { int16 _horizontal, _vertical; }; class GraphicManager { public: static const MouseHotspotType kMouseHotSpots[9]; - - Graphics::Surface _surface; Color _talkBackgroundColor, _talkFontColor; GraphicManager(AvalancheEngine *vm); ~GraphicManager(); void init(); - void loadDigits(Common::File &file); // Load the scoring digits & rwlites + void loadDigits(Common::File &file); void loadMouse(byte which); void fleshColors(); @@ -104,7 +98,7 @@ class GraphicManager { Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. + void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. void drawThinkPic(Common::String filename, int id); void drawToolbar(); @@ -112,6 +106,7 @@ class GraphicManager { void drawReadyLight(Color color); void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void drawIcon(int16 x, int16 y, byte which); // Draws an icon to the current scroll. + void drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color); void prepareBubble(int xc, int xw, int my, Common::Point points[3]); @@ -122,25 +117,28 @@ class GraphicManager { void setDialogColor(Color bg, Color text); void zoomOut(int16 x, int16 y); // Only used when entering the map. - void showScroll(); + void getNaturalPicture(SpriteType &sprite); + void saveScreen(); void removeBackup(); void restoreScreen(); + private: static const uint16 kBackgroundWidth = kScreenWidth; + static const byte kEgaPaletteIndex[16]; static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load(). - static const byte kEgaPaletteIndex[16]; Graphics::Surface _background; - Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also + Graphics::Surface _backup; Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!! Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead. + Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) Graphics::Surface _scrolls; - Graphics::Surface _backup; + Graphics::Surface _surface; byte _egaPalette[64][3]; AvalancheEngine *_vm; From 26626125d983d62132afb4b8649f65c11adfb565 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Oct 2013 07:14:36 +0200 Subject: [PATCH 1203/1332] AVALANCHE: Use Doxygen comments in Graphics --- engines/avalanche/background.cpp | 4 ++-- engines/avalanche/graphics.cpp | 39 +++++++++++++++++++++----------- engines/avalanche/graphics.h | 14 ++++-------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 99bb446d3f65..cb280ba730c3 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -298,7 +298,7 @@ void Background::load(byte number) { _vm->_graphics->getNaturalPicture(_sprites[i]); else { _sprites[i]._size = sprite._size; - _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); + _sprites[i]._picture = _vm->_graphics->loadPictureRaw(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); } } else _sprites[i]._x = kOnDisk; @@ -339,7 +339,7 @@ void Background::draw(int16 destX, int16 destY, byte sprId) { sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); f.skip(2); // Natural and Memorize are used in Load() - sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); + sprite._picture = _vm->_graphics->loadPictureRaw(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { destX = sprite._x * 8; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a733dfa5f132..5e17dcda3efb 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -455,8 +455,10 @@ void GraphicManager::drawDebugLines() { } } +/** + * This function mimics Pascal's getimage(). + */ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { - // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 width = file.readUint16LE() + 1; uint16 height = file.readUint16LE() + 1; @@ -480,11 +482,13 @@ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { return picture; } -Graphics::Surface GraphicManager::loadPictureRow(Common::File &file, uint16 width, uint16 height) { - // This function is our own creation, very much like the one above. The main differences are that - // we don't read the width and the height from the file, the planes are in a different order - // and we read the picture plane-by-plane. - +/** + * Reads Row-planar EGA data. + * This function is our own creation, very much like the one above. The main differences are that + * we don't read the width and the height from the file, the planes are in a different order + * and we read the picture plane-by-plane. + */ +Graphics::Surface GraphicManager::loadPictureRaw(Common::File &file, uint16 width, uint16 height) { Graphics::Surface picture; picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); @@ -580,6 +584,9 @@ void GraphicManager::drawReadyLight(Color color) { _surface.fillRect(Common::Rect(419, 195, 438, 197), color); } +/** + * This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. + */ void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File file; Common::String filename = Common::String::format("%s.avd", fn.c_str()); @@ -588,7 +595,6 @@ void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); // I know it looks very similar to the loadPicture methods, but in truth it's the combination of the two. - uint16 width = xl * 8; uint16 height = yl; @@ -614,6 +620,10 @@ void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { file.close(); } +/** + * Draws an icon to the current scroll. + * @remarks Originally called 'geticon' + */ void GraphicManager::drawIcon(int16 x, int16 y, byte which) { Common::File file; @@ -638,20 +648,19 @@ void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[ _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _talkBackgroundColor); _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _talkBackgroundColor); - // Top right corner of the bubble. + // Top the 4 rounded corners of the bubble. drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _talkBackgroundColor); - // Bottom right corner of the bubble. drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _talkBackgroundColor); - // Top left corner of the bubble. drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _talkBackgroundColor); - // Bottom left corner of the bubble. drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _talkBackgroundColor); // "Tail" of the speech bubble. drawTriangle(points, _talkBackgroundColor); } -// And set the background of the text to the desired color. +/** + * Set the background of the text to the desired color. + */ void GraphicManager::wipeChar(int x, int y, Color color) { for (int k = 0; k < 8; k++) *(byte *)_surface.getBasePtr(x + k, y) = color; @@ -679,13 +688,17 @@ void GraphicManager::refreshScreen() { } void GraphicManager::loadBackground(Common::File &file) { - _background = loadPictureRow(file, kBackgroundWidth, kBackgroundHeight); + _background = loadPictureRaw(file, kBackgroundWidth, kBackgroundHeight); } void GraphicManager::refreshBackground() { drawPicture(_surface, _background, 0, 10); } +/** + * Only used when entering the map. + * @remarks Originally called 'zoomout' + */ void GraphicManager::zoomOut(int16 x, int16 y) { //setlinestyle(dottedln, 0, 1); TODO: Implement it with a dotted line style!!! diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 8a9d26cb992e..9930e282f58b 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -95,30 +95,26 @@ class GraphicManager { // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data - Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. + Graphics::Surface loadPictureRaw(Common::File &file, uint16 width, uint16 height); void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); - void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example. - + void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); void drawThinkPic(Common::String filename, int id); void drawToolbar(); void drawCursor(byte pos); void drawReadyLight(Color color); - void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. - void drawIcon(int16 x, int16 y, byte which); // Draws an icon to the current scroll. + void drawSign(Common::String name, int16 xl, int16 yl, int16 y); + void drawIcon(int16 x, int16 y, byte which); void drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color); - void prepareBubble(int xc, int xw, int my, Common::Point points[3]); - void refreshScreen(); void loadBackground(Common::File &file); void refreshBackground(); void setBackgroundColor(Color x); void setDialogColor(Color bg, Color text); - void zoomOut(int16 x, int16 y); // Only used when entering the map. + void zoomOut(int16 x, int16 y); void showScroll(); - void getNaturalPicture(SpriteType &sprite); void saveScreen(); From 2d8fa4fdad188470a11db19e188d0283ed057f42 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Oct 2013 07:49:29 +0200 Subject: [PATCH 1204/1332] AVALANCHE: Set some variables private in Menu --- engines/avalanche/menu.cpp | 52 +++++++++++++++++++++----------------- engines/avalanche/menu.h | 41 +++++++++++++++++------------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 2a3e3d945328..146a743a93fc 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -74,12 +74,12 @@ bool HeadType::parseAltTrigger(char key) { return false; } -void MenuItem::init(Menu *dr) { - _dr = dr; +void MenuItem::init(Menu *menu) { + _menu = menu; _activeNow = false; _activeNum = 1; - _dr->_menuActive = false; + _menu->_menuActive = false; } void MenuItem::reset() { @@ -114,8 +114,8 @@ void MenuItem::displayOption(byte y, bool highlit) { else backgroundColor = kColorLightgray; - _dr->_vm->_graphics->drawMenuBlock((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10, backgroundColor); - _dr->drawMenuText(_left, 4 + (y + 1) * 10, _options[y]._trigger, text, _options[y]._valid, highlit); + _menu->_vm->_graphics->drawMenuBlock((_flx1 + 1) * 8, 3 + (y + 1) * 10, (_flx2 + 1) * 8, 13 + (y + 1) * 10, backgroundColor); + _menu->drawMenuText(_left, 4 + (y + 1) * 10, _options[y]._trigger, text, _options[y]._valid, highlit); } void MenuItem::display() { @@ -126,15 +126,15 @@ void MenuItem::display() { _flx2 = _left + _width; _fly = 15 + _optionNum * 10; _activeNow = true; - _dr->_menuActive = true; + _menu->_menuActive = true; - _dr->_vm->_graphics->drawMenuItem((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly); + _menu->_vm->_graphics->drawMenuItem((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly); displayOption(0, true); for (int y = 1; y < _optionNum; y++) displayOption(y, false); - _dr->_vm->_currentMouse = 177; + _menu->_vm->_currentMouse = 177; CursorMan.showMouse(true); // 4 = fletch } @@ -142,10 +142,12 @@ void MenuItem::display() { void MenuItem::wipe() { CursorMan.showMouse(false); - _dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false); + _menu->drawMenuText(_menu->_menuBar._menuItems[_menu->_activeMenuItem._activeNum]._xpos, 1, + _menu->_menuBar._menuItems[_menu->_activeMenuItem._activeNum]._trigger, + _menu->_menuBar._menuItems[_menu->_activeMenuItem._activeNum]._title, true, false); _activeNow = false; - _dr->_menuActive = false; + _menu->_menuActive = false; _firstlix = false; CursorMan.showMouse(true); @@ -165,6 +167,10 @@ void MenuItem::moveHighlight(int8 inc) { CursorMan.showMouse(true); } +/** + * This makes the menu highlight follow the mouse. + * @remarks Originally called 'lightup' + */ void MenuItem::lightUp(Common::Point cursorPos) { if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((_fly - 3) * 2 + 1))) return; @@ -186,7 +192,7 @@ void MenuItem::select(byte which) { if (_choiceNum > _optionNum) _choiceNum = 0; // Off the top, I suppose. - (_dr->*_dr->_menuBar._menuItems[_activeNum]._chooseFunc)(); + (_menu->*_menu->_menuBar._menuItems[_activeNum]._chooseFunc)(); } void MenuItem::parseKey(char c) { @@ -199,29 +205,29 @@ void MenuItem::parseKey(char c) { } } if (!found) - _dr->_vm->_sound->blip(); + _menu->_vm->_sound->blip(); } -void MenuBar::init(Menu *dr) { - _dr = dr; +void MenuBar::init(Menu *menu) { + _menu = menu; _menuNum = 0; } void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc) { - _menuItems[_menuNum].init(trig, altTrig, title, _menuNum, setupFunc, chooseFunc, _dr); + _menuItems[_menuNum].init(trig, altTrig, title, _menuNum, setupFunc, chooseFunc, _menu); _menuNum++; } void MenuBar::draw() { - _dr->_vm->_graphics->drawMenuBar(kMenuBackgroundColor); + _menu->_vm->_graphics->drawMenuBar(kMenuBackgroundColor); - byte savecp = _dr->_vm->_cp; - _dr->_vm->_cp = 3; + byte savecp = _menu->_vm->_cp; + _menu->_vm->_cp = 3; for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); - _dr->_vm->_cp = savecp; + _menu->_vm->_cp = savecp; } void MenuBar::parseAltTrigger(char c) { @@ -234,13 +240,13 @@ void MenuBar::parseAltTrigger(char c) { } void MenuBar::setupMenuItem(byte which) { - if (_dr->_activeMenuItem._activeNow) { - _dr->_activeMenuItem.wipe(); // Get rid of menu. - if (_dr->_activeMenuItem._activeNum == _menuItems[which]._position) + if (_menu->_activeMenuItem._activeNow) { + _menu->_activeMenuItem.wipe(); // Get rid of menu. + if (_menu->_activeMenuItem._activeNum == _menuItems[which]._position) return; // Clicked on own highlight. } _menuItems[which].highlight(); - (_dr->*_menuItems[which]._setupFunc)(); + (_menu->*_menuItems[which]._setupFunc)(); } void MenuBar::chooseMenuItem(int16 x) { diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index a71093b6ad47..ab0456ed431c 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -50,7 +50,7 @@ class HeadType { int16 _xpos, _xright; MenuFunc _setupFunc, _chooseFunc; - void init(char trig, char alTtrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr); + void init(char trig, char alTtrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *menu); void draw(); void highlight(); bool parseAltTrigger(char key); @@ -69,29 +69,33 @@ struct OptionType { class MenuItem { public: OptionType _options[12]; - byte _optionNum; uint16 _width, _left; bool _firstlix; int16 _flx1, _flx2, _fly; - byte _oldY; // used by lightUp bool _activeNow; // Is there an active option now? byte _activeNum; // And if so, which is it? byte _choiceNum; // Your choice? - byte _highlightNum; - void init(Menu *dr); + void init(Menu *menu); void reset(); void setupOption(Common::String title, char trigger, Common::String shortcut, bool valid); void display(); void wipe(); - void lightUp(Common::Point cursorPos); // This makes the menu highlight follow the mouse. + void lightUp(Common::Point cursorPos); + void select(byte which); + +private: + byte _oldY; // used by lightUp + byte _optionNum; + byte _highlightNum; + + Menu *_menu; + void displayOption(byte y, bool highlit); void moveHighlight(int8 inc); - void select(byte which); // Choose which one you want. - void parseKey(char c); -private: - Menu *_dr; + // CHECKME: Useless function? + void parseKey(char c); }; class MenuBar { @@ -99,15 +103,17 @@ class MenuBar { HeadType _menuItems[8]; byte _menuNum; - void init(Menu *dr); + void init(Menu *menu); void createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc); void draw(); - void parseAltTrigger(char c); - void setupMenuItem(byte which); void chooseMenuItem(int16 x); private: - Menu *_dr; + Menu *_menu; + + void setupMenuItem(byte which); + // CHECKME: Useless function + void parseAltTrigger(char c); }; class Menu { @@ -119,11 +125,8 @@ class Menu { MenuItem _activeMenuItem; MenuBar _menuBar; - Common::String people; - Menu(AvalancheEngine *vm); - void parseKey(char r, char re); void update(); void setup(); // Standard menu bar. bool isActive(); @@ -140,6 +143,7 @@ class Menu { // static const Color kHighlightFontColor = kColorWhite; // static const Color kDisabledColor = kColorDarkgray; + Common::String people; Common::String _verbStr; // what you can do with your object. :-) bool _menuActive; // Kludge so we don't have to keep referring to the menu. People _lastPerson; // Last person to have been selected using the People menu. @@ -168,6 +172,9 @@ class Menu { void runMenuObjects(); void runMenuPeople(); void runMenuWith(); + + // CHECKME: Useless function? + void parseKey(char r, char re); }; } // End of namespace Avalanche. From a6bdec5ca5dd92c4613b0e684f838326ec89939b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 3 Oct 2013 23:48:14 +0200 Subject: [PATCH 1205/1332] AVALANCHE: Don't refresh screen after every event in scroll mode --- engines/avalanche/dialogs.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index fd2e47b34d19..0c90d1229320 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -128,15 +128,18 @@ void Dialogs::scrollModeNormal() { _vm->_graphics->showScroll(); Common::Event event; - while (!_vm->shouldQuit()) { + bool escape = false; + while (!_vm->shouldQuit() && !escape) { _vm->_graphics->refreshScreen(); - - _vm->getEvent(event); - if ((event.type == Common::EVENT_LBUTTONUP) || - ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || - (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || - (event.kbd.keycode == Common::KEYCODE_PLUS)))) - break; + while (_vm->getEvent(event)) { + if ((event.type == Common::EVENT_LBUTTONUP) || + ((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || + (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || + (event.kbd.keycode == Common::KEYCODE_PLUS)))) { + escape = true; + break; + } + } } _vm->_graphics->restoreScreen(); From 97f26f679408fe8d9196ea36924c3e24adc11d3e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 3 Oct 2013 23:48:56 +0200 Subject: [PATCH 1206/1332] AVALANCHE: Use memcpy in refreshScreen --- engines/avalanche/graphics.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 5e17dcda3efb..23807ac45a3b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -677,10 +677,8 @@ void GraphicManager::drawChar(byte ander, int x, int y, Color color) { void GraphicManager::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { - for (uint16 x = 0; x < _screen.w; x++) { - for (int j = 0; j < 2; j++) - *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); - } + memcpy(_screen.getBasePtr(0, y * 2), _surface.getBasePtr(0, y), _screen.w); + memcpy(_screen.getBasePtr(0, y * 2 + 1), _surface.getBasePtr(0, y), _screen.w); } // Now we copy the stretched picture to the screen. g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); From c73159150d75f9bf9996722838f8d114c9a66417 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 20:13:02 -0500 Subject: [PATCH 1207/1332] ZVISION: Re-enable Truemotion plugin guard, but add a case for ZVISION --- video/codecs/truemotion1.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video/codecs/truemotion1.h b/video/codecs/truemotion1.h index 39950b3ea600..6ac09af24beb 100644 --- a/video/codecs/truemotion1.h +++ b/video/codecs/truemotion1.h @@ -22,8 +22,8 @@ // Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg -// Only compile if SCI32 is enabled or if we're building dynamic modules -//#if defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES) +// Only compile if SCI32 is enabled, ZVISION is enabled, or if we're building dynamic modules +#if defined(ENABLE_SCI32) || defined(ENABLE_ZVISION) || defined(DYNAMIC_MODULES) #ifndef VIDEO_CODECS_TRUEMOTION1_H #define VIDEO_CODECS_TRUEMOTION1_H @@ -106,4 +106,4 @@ class TrueMotion1Decoder : public Codec { } // End of namespace Video #endif // VIDEO_CODECS_TRUEMOTION1_H -//#endif // SCI32/Plugins guard +#endif // SCI32/Plugins guard From 8a69bcfe97716ae8f0098fd62231ac13717f1484 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 2 Oct 2013 14:51:03 -0500 Subject: [PATCH 1208/1332] ZVISION: Add typedefs to shorten long type names --- engines/zvision/render_manager.cpp | 4 +-- engines/zvision/render_manager.h | 4 ++- engines/zvision/script_manager.cpp | 48 +++++++++++++++--------------- engines/zvision/script_manager.h | 15 ++++++---- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index a8ceabcd7439..af8ca7fd640b 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -61,7 +61,7 @@ RenderManager::~RenderManager() { _currentBackground.free(); _backBuffer.free(); - for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { + for (AlphaEntryMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { iter->_value.data->free(); delete iter->_value.data; } @@ -121,7 +121,7 @@ void RenderManager::renderBackbufferToScreen() { void RenderManager::processAlphaEntries() { // TODO: Add dirty rectangling support. AKA only draw an entry if the _backbufferDirtyRect intersects/contains the entry Rect - for (Common::HashMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { + for (AlphaEntryMap::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) { uint32 destOffset = 0; uint32 sourceOffset = 0; uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 64d36f5c9de0..111bf6276c48 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -60,6 +60,8 @@ class RenderManager { uint16 height; }; + typedef Common::HashMap AlphaEntryMap; + private: OSystem *_system; const Graphics::PixelFormat _pixelFormat; @@ -71,7 +73,7 @@ class RenderManager { // before actually being blitted to the screen Graphics::Surface _backBuffer; // A list of Alpha Entries that need to be blitted to the backbuffer - Common::HashMap _alphaDataEntries; + AlphaEntryMap _alphaDataEntries; // A rectangle representing the portion of the working window where the pixels have been changed since last frame Common::Rect _workingWindowDirtyRect; diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index f3e14e6f5b60..b33ca4c515dd 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -45,13 +45,13 @@ ScriptManager::ScriptManager(ZVision *engine) } ScriptManager::~ScriptManager() { - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { + for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { delete (*iter); } - for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { + for (PuzzleList::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { delete (*iter); } - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { delete (*iter); } } @@ -68,7 +68,7 @@ void ScriptManager::update(uint deltaTimeMillis) { void ScriptManager::createReferenceTable() { // Iterate through each local Puzzle - for (Common::List::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); ++activePuzzleIter) { + for (PuzzleList::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); ++activePuzzleIter) { Puzzle *puzzlePtr = (*activePuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle @@ -85,7 +85,7 @@ void ScriptManager::createReferenceTable() { } // Iterate through each global Puzzle - for (Common::List::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); ++globalPuzzleIter) { + for (PuzzleList::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); ++globalPuzzleIter) { Puzzle *puzzlePtr = (*globalPuzzleIter); // Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle @@ -102,14 +102,14 @@ void ScriptManager::createReferenceTable() { } // Remove duplicate entries - for (Common::HashMap >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); ++referenceTableIter) { + for (PuzzleMap::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); ++referenceTableIter) { removeDuplicateEntries(referenceTableIter->_value); } } void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { if ((*iter)->process(deltaTimeMillis)) { delete (*iter); // Remove the node @@ -232,7 +232,7 @@ void ScriptManager::addControl(Control *control) { } Control *ScriptManager::getControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { return (*iter); } @@ -242,7 +242,7 @@ Control *ScriptManager::getControl(uint32 key) { } void ScriptManager::enableControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->enable(); break; @@ -251,7 +251,7 @@ void ScriptManager::enableControl(uint32 key) { } void ScriptManager::disableControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->disable(); break; @@ -260,7 +260,7 @@ void ScriptManager::disableControl(uint32 key) { } void ScriptManager::focusControl(uint32 key) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { uint32 controlKey = (*iter)->getKey(); if (controlKey == key) { @@ -274,20 +274,20 @@ void ScriptManager::focusControl(uint32 key) { } void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); } } void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos); } } bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { bool cursorWasChanged = false; - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos); } @@ -295,13 +295,13 @@ bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Commo } void ScriptManager::onKeyDown(Common::KeyState keyState) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onKeyDown(keyState); } } void ScriptManager::onKeyUp(Common::KeyState keyState) { - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->onKeyUp(keyState); } } @@ -316,11 +316,11 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, // Clear all the containers _referenceTable.clear(); _puzzlesToCheck.clear(); - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { + for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { delete (*iter); } _activePuzzles.clear(); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { delete (*iter); } _activeControls.clear(); @@ -345,12 +345,12 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _engine->getRenderManager()->setBackgroundPosition(offset); // Enable all the controls - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->enable(); } // Add all the local puzzles to the queue to be checked - for (Common::List::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { + for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { // Reset any Puzzles that have the flag ONCE_PER_INST if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter)->key, 0); @@ -360,7 +360,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, } // Add all the global puzzles to the queue to be checked - for (Common::List::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { + for (PuzzleList::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { // Reset any Puzzles that have the flag ONCE_PER_INST if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) { setStateValue((*iter)->key, 0); @@ -410,14 +410,14 @@ void ScriptManager::serializeControls(Common::WriteStream *stream) { // Count how many controls need to save their data // Because WriteStream isn't seekable uint32 numberOfControlsNeedingSerialization = 0; - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->needsSerialization()) { numberOfControlsNeedingSerialization++; } } stream->writeUint32LE(numberOfControlsNeedingSerialization); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { (*iter)->serialize(stream); } } @@ -427,7 +427,7 @@ void ScriptManager::deserializeControls(Common::SeekableReadStream *stream) { for (uint32 i = 0; i < numberOfControls; ++i) { uint32 key = stream->readUint32LE(); - for (Common::List::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { + for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { if ((*iter)->getKey() == key) { (*iter)->deserialize(stream); break; diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 6276095e1218..c44c836171c5 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -49,6 +49,11 @@ struct Location { uint32 offset; }; +typedef Common::HashMap > PuzzleMap; +typedef Common::List PuzzleList; +typedef Common::Queue PuzzleQueue; +typedef Common::List ControlList; + class ScriptManager { public: ScriptManager(ZVision *engine); @@ -63,15 +68,15 @@ class ScriptManager { */ Common::HashMap _globalState; /** References _globalState keys to Puzzles */ - Common::HashMap > _referenceTable; + PuzzleMap _referenceTable; /** Holds the Puzzles that should be checked this frame */ - Common::Queue _puzzlesToCheck; + PuzzleQueue _puzzlesToCheck; /** Holds the currently active puzzles */ - Common::List _activePuzzles; + PuzzleList _activePuzzles; /** Holds the global puzzles */ - Common::List_globalPuzzles; + PuzzleList _globalPuzzles; /** Holds the currently active controls */ - Common::List _activeControls; + ControlList _activeControls; Location _currentLocation; From 39a8243c696f3883f5d1609b1dc333dfae2264ed Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 2 Oct 2013 14:56:38 -0500 Subject: [PATCH 1209/1332] ZVISION: Remove Vector2 class Originally, the render table needed int32 (x, y) coords, so I created a copy of Common::Point that used int32. After some code changes, the render table reverted to int16 coords. Therefore, this class is unnessessary since Common::Point uses int16 coords. --- engines/zvision/render_table.cpp | 4 +- engines/zvision/render_table.h | 5 +- engines/zvision/vector2.h | 82 -------------------------------- 3 files changed, 4 insertions(+), 87 deletions(-) delete mode 100644 engines/zvision/vector2.h diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index f4437101dbab..b6a6a3d2bb5b 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -24,7 +24,7 @@ #include "zvision/render_table.h" -#include "zvision/vector2.h" +#include "common/rect.h" #include "graphics/colormasks.h" @@ -37,7 +37,7 @@ RenderTable::RenderTable(uint numColumns, uint numRows) _renderState(FLAT) { assert(numRows != 0 && numColumns != 0); - _internalBuffer = new Vector2[numRows * numColumns]; + _internalBuffer = new Common::Point[numRows * numColumns]; } RenderTable::~RenderTable() { diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index b188b1492f07..898091193aa7 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -23,10 +23,9 @@ #ifndef ZVISION_RENDER_TABLE_H #define ZVISION_RENDER_TABLE_H -#include "zvision/vector2.h" - #include "common/rect.h" + namespace ZVision { class RenderTable { @@ -43,7 +42,7 @@ class RenderTable { private: uint _numColumns, _numRows; - Vector2 *_internalBuffer; + Common::Point *_internalBuffer; RenderState _renderState; struct { diff --git a/engines/zvision/vector2.h b/engines/zvision/vector2.h deleted file mode 100644 index 9616a43218b9..000000000000 --- a/engines/zvision/vector2.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 ZVISION_VECTOR2_H -#define ZVISION_VECTOR2_H - -#include "common/scummsys.h" - -#include "common/util.h" - - -namespace ZVision { - -/** - * Simple class for handling both 2D position and size. - */ -class Vector2 { -public: - int16 x; ///< The horizontal part of the point - int16 y; ///< The vertical part of the point - -public: - Vector2() : x(0), y(0) {} - Vector2(int16 x1, int16 y1) : x(x1), y(y1) {} - -public: - bool operator==(const Vector2 &p) const { return x == p.x && y == p.y; } - bool operator!=(const Vector2 &p) const { return x != p.x || y != p.y; } - Vector2 operator+(const Vector2 &delta) const { return Vector2(x + delta.x, y + delta.y); } - Vector2 operator-(const Vector2 &delta) const { return Vector2(x - delta.x, y - delta.y); } - - void operator+=(const Vector2 &delta) { - x += delta.x; - y += delta.y; - } - - void operator-=(const Vector2 &delta) { - x -= delta.x; - y -= delta.y; - } - - /** - * Return the square of the distance between this point and the point p. - * - * @param p the other point - * @return the distance between this and p - */ - uint sqrDist(const Vector2 &p) const { - int diffx = ABS(p.x - x); - if (diffx >= 0x1000) - return 0xFFFFFF; - - int diffy = ABS(p.y - y); - if (diffy >= 0x1000) - return 0xFFFFFF; - - return uint(diffx * diffx + diffy * diffy); - } -}; - -} // End of namespace ZVision - -#endif From 2887e8295d707df99dc21c5e04eecc76953b4d41 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 4 Oct 2013 09:08:40 -0500 Subject: [PATCH 1210/1332] ZVISION: Fix nested template formatting --- engines/zvision/rlf_animation.cpp | 12 ++++++------ engines/zvision/string_manager.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 94e48d3609c1..8981a6983c2b 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -246,8 +246,8 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 destColor = Graphics::RGBToColor>(r, g, b); + Graphics::colorToRGB >(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = Graphics::RGBToColor >(r, g, b); WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; @@ -292,8 +292,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 destColor = Graphics::RGBToColor>(r, g, b); + Graphics::colorToRGB >(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 destColor = Graphics::RGBToColor >(r, g, b); WRITE_UINT16(dest + destOffset, destColor); sourceOffset += 2; @@ -309,8 +309,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 } byte r, g, b; - Graphics::colorToRGB>(READ_LE_UINT16(source + sourceOffset), r, g, b); - uint16 sampleColor = Graphics::RGBToColor>(r, g, b); + Graphics::colorToRGB >(READ_LE_UINT16(source + sourceOffset), r, g, b); + uint16 sampleColor = Graphics::RGBToColor >(r, g, b); sourceOffset += 2; numberOfSamples += 2; diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index fde99c02a1a9..ab42f3d3e05c 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -206,7 +206,7 @@ void StringManager::parseTag(const Common::String &tagString, uint lineNumber) { } fragment.style.align = align; - fragment.style.color = Graphics::ARGBToColor>(0, red, green, blue); + fragment.style.color = Graphics::ARGBToColor >(0, red, green, blue); _inGameText[lineNumber].fragments.push_back(fragment); _lastStyle = fragment.style; From 9a4d1683c996220f911e5b2c84f01c7e508e90f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:07:59 +0200 Subject: [PATCH 1211/1332] AVALANCHE: Remove code commented in the original but not in the engine. --- engines/avalanche/animation.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f415d9006c79..3af32959379d 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -103,16 +103,12 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { } _animCount++; - CursorMan.showMouse(true); _x = 0; _y = 0; _quick = true; _visible = false; _speedX = 3; _speedY = 1; - if (spritenum == 1) - _anim->updateSpeed(); // Just for the lights. - _homing = false; _moveX = 0; _moveY = 0; From 49960992caaa7e67ae75463de74b30932254c0f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:12:35 +0200 Subject: [PATCH 1212/1332] AVALANCHE: Fix naming convention, reduce the scope of a couple of variables --- engines/avalanche/animation.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 3af32959379d..f274fc79d67f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -434,15 +434,12 @@ byte Animation::geidaPed(byte ped) { * on the screen. */ void Animation::catacombMove(byte ped) { - int32 here; - uint16 xy_uint16; - - // XY_uint16 is cat_x+cat_y*256. Thus, every room in the + // XY_uint16 is _catacombX+_catacombY*256. Thus, every room in the // catacombs has a different number for it. - xy_uint16 = _vm->_catacombX + _vm->_catacombY * 256; + uint16 xy = _vm->_catacombX + _vm->_catacombY * 256; _geidaSpin = 0; - switch (xy_uint16) { + switch (xy) { case 1801: // Exit catacombs _vm->flipRoom(kRoomLustiesRoom, 4); _vm->_dialogs->displayText("Phew! Nice to be out of there!"); @@ -467,7 +464,7 @@ void Animation::catacombMove(byte ped) { if (!_vm->_enterCatacombsFromLustiesRoom) _vm->loadRoom(29); - here = _vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; + int32 here = _vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) @@ -596,7 +593,7 @@ void Animation::catacombMove(byte ped) { case 0x1: _vm->_background->draw(-1, -1, 21); - if ((xy_uint16 == 2051) && (_vm->_geidaFollows)) + if ((xy == 2051) && (_vm->_geidaFollows)) _vm->_magics[12]._operation = kMagicExclaim; else _vm->_magics[12]._operation = kMagicSpecial; // Right exit south. @@ -694,7 +691,7 @@ void Animation::catacombMove(byte ped) { break; } - switch (xy_uint16) { + switch (xy) { case 514: _vm->_background->draw(-1, -1, 16); break; // [2,2] : "Art Gallery" sign over door. From 9b9462bcee4031f4222ba4649f8c8434a1bd9111 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:15:24 +0200 Subject: [PATCH 1213/1332] AVALANCHE: Check | occurrence as pointed by LordHoto --- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalot.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f274fc79d67f..08dffd5b5f30 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1137,7 +1137,7 @@ void Animation::drawSprites() { * @remarks Originally called 'trippancy_link' */ void Animation::animLink() { - if (_vm->_menu->isActive() | _vm->_seeScroll) + if (_vm->_menu->isActive() || _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { if (_sprites[i]._quick && _sprites[i]._visible) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 8cc11917f799..cff944602c5a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -40,7 +40,7 @@ namespace Avalanche { // Art gallery at 2,1; notice about this at 2,2. const int32 AvalancheEngine::kCatacombMap[8][8] = { // Geida's room - // 1 2 3 | 4 5 6 7 8 + // 1 2 3 4 5 6 7 8 {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, From 19cc272763bd4094508c9ec4862403aef8626dae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:16:54 +0200 Subject: [PATCH 1214/1332] AVALANCHE: Remove s_engine --- engines/avalanche/avalanche.cpp | 3 --- engines/avalanche/avalanche.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 26d767107875..29045d70a24e 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -43,11 +43,8 @@ namespace Avalanche { -AvalancheEngine *AvalancheEngine::s_Engine = 0; - AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd), _fxHidden(false), _interrogation(0) { _system = syst; - s_Engine = this; _console = new AvalancheConsole(this); _rnd = new Common::RandomSource("avalanche"); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index d68d837c2c04..4cb78f7e2560 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -119,8 +119,6 @@ class AvalancheEngine : public Engine { Common::Error run(); private: - static AvalancheEngine *s_Engine; - AvalancheConsole *_console; Common::Platform _platform; From 650613f5cab24ad5975282255dbf4d41baef822d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:30:16 +0200 Subject: [PATCH 1215/1332] AVALANCHE: Use MKTAG for signature. This breaks prior savegames. --- engines/avalanche/avalanche.cpp | 10 +++------- engines/avalanche/detection.cpp | 16 ++++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 29045d70a24e..3d059b60e282 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -290,8 +290,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { return false; } - const char *signature = "AVAL"; - f->write(signature, 4); + f->writeUint32LE(MKTAG('A', 'V', 'A', 'L')); // Write version. We can't restore from obsolete versions. f->writeByte(kSavegameVersion); @@ -334,11 +333,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { if (!f) return false; - // Check for our signature. - Common::String signature; - for (int i = 0; i < 4; i++) - signature += f->readByte(); - if (signature != "AVAL") + uint32 signature = f->readUint32LE(); + if (signature != MKTAG('A', 'V', 'A', 'L')) return false; // Check version. We can't restore from obsolete versions. diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 8afd8e58f4b7..6630ab801fb2 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -129,10 +129,8 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { Common::InSaveFile *file = saveFileMan->openForLoading(*filename); if (file) { // Check for our signature. - Common::String signature; - for (int i = 0; i < 4; i++) - signature += file->readByte(); - if (signature != "AVAL") { + uint32 signature = file->readUint32LE(); + if (signature != MKTAG('A', 'V', 'A', 'L')) { warning("Savegame of incompatible type!"); delete file; continue; @@ -177,10 +175,8 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, if (f) { // Check for our signature. - Common::String signature; - for (int i = 0; i < 4; i++) - signature += f->readByte(); - if (signature != "AVAL") { + uint32 signature = f->readUint32LE(); + if (signature != MKTAG('A', 'V', 'A', 'L')) { warning("Savegame of incompatible type!"); delete f; return SaveStateDescriptor(); @@ -188,8 +184,8 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, // Check version. byte saveVersion = f->readByte(); - if (saveVersion != kSavegameVersion) { - warning("Savegame of incompatible version!"); + if (saveVersion > kSavegameVersion) { + warning("Savegame of a too recent version!"); delete f; return SaveStateDescriptor(); } From 493c02ae224c0ce2f2d095e380c279ff1311a558 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:33:13 +0200 Subject: [PATCH 1216/1332] AVALANCHE: Use ConfMan short name --- engines/avalanche/avalot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index cff944602c5a..03a177402bcd 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -320,7 +320,7 @@ void AvalancheEngine::setup() { _menu->init(); - int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); + int16 loadSlot = ConfMan.instance().getInt("save_slot"); if (loadSlot >= 0) { _thinks = 2; // You always have money. thinkAbout(kObjectMoney, kThing); From 89559e07a3b337a27798aedb1ef64f257fdfe649 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:40:24 +0200 Subject: [PATCH 1217/1332] AVALANCHE: Remove file variable from AvalancheEngine --- engines/avalanche/avalanche.h | 4 +--- engines/avalanche/avalot.cpp | 8 +++++--- engines/avalanche/graphics.cpp | 3 ++- engines/avalanche/graphics.h | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 4cb78f7e2560..1ef5d5014ed1 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -317,9 +317,7 @@ class AvalancheEngine : public Engine { Common::String _roomnName; // Name of actual room int8 _scoreToDisplay[3]; - Common::File file; - Common::String readAlsoStringFromFile(); - + Common::String readAlsoStringFromFile(Common::File &file); void runAvalot(); void init(); void setup(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 03a177402bcd..5b2862966027 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -302,7 +302,7 @@ void AvalancheEngine::setup() { _dialogs->reset(); dusk(); - _graphics->loadDigits(file); + _graphics->loadDigits(); _parser->_inputTextPos = 0; _parser->_quote = true; @@ -413,7 +413,7 @@ void AvalancheEngine::callVerb(VerbCode id) { * Check is it's possible to give something to Spludwick * @remarks Originally called 'nextstring' */ -Common::String AvalancheEngine::readAlsoStringFromFile() { +Common::String AvalancheEngine::readAlsoStringFromFile(Common::File &file) { Common::String str; byte length = file.readByte(); for (int i = 0; i < length; i++) @@ -448,6 +448,7 @@ void AvalancheEngine::loadAlso(byte num) { } Common::String filename; filename = Common::String::format("also%d.avd", num); + Common::File file; if (!file.open(filename)) error("AVALANCHE: File not found: %s", filename.c_str()); @@ -458,7 +459,7 @@ void AvalancheEngine::loadAlso(byte num) { for (int i = 0; i <= alsoNum; i++) { for (int j = 0; j < 2; j++) { _also[i][j] = new Common::String; - *_also[i][j] = readAlsoStringFromFile(); + *_also[i][j] = readAlsoStringFromFile(file); } tmpStr = Common::String::format("\x9D%s\x9D", _also[i][0]->c_str()); *_also[i][0] = tmpStr; @@ -541,6 +542,7 @@ void AvalancheEngine::loadRoom(byte num) { _graphics->fleshColors(); Common::String filename = Common::String::format("place%d.avd", num); + Common::File file; if (!file.open(filename)) error("AVALANCHE: File not found: %s", filename.c_str()); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 5e17dcda3efb..b3eeed505631 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -90,10 +90,11 @@ void GraphicManager::init() { * Load the scoring digits & rwlites * @remarks Originally called 'load_digits' */ -void GraphicManager::loadDigits(Common::File &file) { +void GraphicManager::loadDigits() { const byte digitsize = 134; const byte rwlitesize = 126; + Common::File file; if (!file.open("digit.avd")) error("AVALANCHE: File not found: digit.avd"); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 9930e282f58b..876bcea6db9a 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -63,7 +63,7 @@ class GraphicManager { GraphicManager(AvalancheEngine *vm); ~GraphicManager(); void init(); - void loadDigits(Common::File &file); + void loadDigits(); void loadMouse(byte which); void fleshColors(); From 300859aa43bf4f14afc005fdcebb392cf2a88000 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:52:12 +0200 Subject: [PATCH 1218/1332] AVALANCHE: Fix static array names --- engines/avalanche/avalot.cpp | 16 ++++++++-------- engines/avalanche/graphics.cpp | 4 ++-- engines/avalanche/menu.cpp | 22 +++++++++++----------- engines/avalanche/parser.cpp | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5b2862966027..ef33b4c5633a 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1545,22 +1545,22 @@ bool AvalancheEngine::decreaseMoney(uint16 amount) { } Common::String AvalancheEngine::getName(People whose) { - static const Common::String kLads[17] = { + static const Common::String lads[17] = { "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" }; - static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; + static const Common::String lasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; if (whose < kPeopleArkata) - return kLads[whose - kPeopleAvalot]; + return lads[whose - kPeopleAvalot]; else - return kLasses[whose - kPeopleArkata]; + return lasses[whose - kPeopleArkata]; } Common::String AvalancheEngine::getItem(byte which) { - static const Common::String kItems[kObjectNum] = { + static const Common::String items[kObjectNum] = { "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", @@ -1577,7 +1577,7 @@ Common::String AvalancheEngine::getItem(byte which) { case 0: case 1: case 4: - get_better_result = kItems[which - 1]; + get_better_result = items[which - 1]; break; case 3: get_better_result = "some vinegar"; @@ -1590,11 +1590,11 @@ Common::String AvalancheEngine::getItem(byte which) { else if (_onionInVinegar) get_better_result = "a pickled onion (in the vinegar)"; else - get_better_result = kItems[which - 1]; + get_better_result = items[which - 1]; break; default: if ((which < kObjectNum) && (which > 0)) - get_better_result = kItems[which - 1]; + get_better_result = items[which - 1]; else get_better_result = ""; } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b3eeed505631..92a9f0bed9c8 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -166,12 +166,12 @@ void GraphicManager::loadMouse(byte which) { } void GraphicManager::drawThinkPic(Common::String filename, int id) { - static const int16 kPicSize = 966; + static const int16 picSize = 966; Common::File file; if (!file.open(filename)) error("drawThinkPic(): File not found: %s", filename.c_str()); - file.seek(id * kPicSize + 65); + file.seek(id * picSize + 65); Graphics::Surface picture = loadPictureGraphic(file); drawPicture(_surface, picture, 205, 170); diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 146a743a93fc..14fa74c3201c 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -771,7 +771,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... } char Menu::getThingChar(byte which) { - static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar + static const char thingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar char result; switch (which) { @@ -779,26 +779,26 @@ char Menu::getThingChar(byte which) { if (_vm->_wineState == 3) result = 'V'; // Vinegar else - result = kThingsChar[which - 1]; + result = thingsChar[which - 1]; break; default: - result = kThingsChar[which - 1]; + result = thingsChar[which - 1]; } return result; } byte Menu::getNameChar(People whose) { - static const char kLadChar[] = "ASCDMTRwLfgeIyPu"; - static const char kLassChar[] = "kG\0xB1o"; + static const char ladChar[] = "ASCDMTRwLfgeIyPu"; + static const char lassChar[] = "kG\0xB1o"; if (whose < kPeopleArkata) - return kLadChar[whose - kPeopleAvalot]; + return ladChar[whose - kPeopleAvalot]; else - return kLassChar[whose - kPeopleArkata]; + return lassChar[whose - kPeopleArkata]; } Common::String Menu::getThing(byte which) { - static const Common::String kThings[kObjectNum] = { + static const Common::String things[kObjectNum] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" @@ -810,7 +810,7 @@ Common::String Menu::getThing(byte which) { switch (_vm->_wineState) { case 1: case 4: - result = kThings[which - 1]; + result = things[which - 1]; break; case 3: result = "Vinegar"; @@ -821,10 +821,10 @@ Common::String Menu::getThing(byte which) { if (_vm->_rottenOnion) result = "rotten onion"; else - result = kThings[which - 1]; + result = things[which - 1]; break; default: - result = kThings[which - 1]; + result = things[which - 1]; } return result; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 115b5662e2f9..fc6085b58177 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -527,7 +527,7 @@ void Parser::replace(Common::String oldChars, byte newChar) { } Common::String Parser::rank() { - static const RankType kRanks[9] = { + static const RankType ranks[9] = { {0, "Beginner"}, {10, "Novice"}, {20, "Improving"}, {35, "Not bad"}, {50, "Passable"}, {65, "Good"}, @@ -536,8 +536,8 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_dnascore >= kRanks[i]._score) && (_vm->_dnascore < kRanks[i + 1]._score)) { - return kRanks[i]._title; + if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score)) { + return ranks[i]._title; } } return ""; From 1cbe175a74099a4ca54503933b12c84352a98e82 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 17:55:40 +0200 Subject: [PATCH 1219/1332] AVALANCHE: Fix naming conventions in getItem() --- engines/avalanche/avalot.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ef33b4c5633a..f45341ea346f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1567,7 +1567,7 @@ Common::String AvalancheEngine::getItem(byte which) { "an onion" }; - Common::String get_better_result; + Common::String result; if (which > 150) which -= 149; @@ -1577,28 +1577,28 @@ Common::String AvalancheEngine::getItem(byte which) { case 0: case 1: case 4: - get_better_result = items[which - 1]; + result = items[which - 1]; break; case 3: - get_better_result = "some vinegar"; + result = "some vinegar"; break; } break; case kObjectOnion: if (_rottenOnion) - get_better_result = "a rotten onion"; + result = "a rotten onion"; else if (_onionInVinegar) - get_better_result = "a pickled onion (in the vinegar)"; + result = "a pickled onion (in the vinegar)"; else - get_better_result = items[which - 1]; + result = items[which - 1]; break; default: if ((which < kObjectNum) && (which > 0)) - get_better_result = items[which - 1]; + result = items[which - 1]; else - get_better_result = ""; + result = ""; } - return get_better_result; + return result; } Common::String AvalancheEngine::f5Does() { From 221faca2868f4c1dae3e23e4ca608968c8042620 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 18:00:56 +0200 Subject: [PATCH 1220/1332] AVALANCHE: Fix ifndef check in header files --- engines/avalanche/background.h | 6 +++--- engines/avalanche/closing.h | 6 +++--- engines/avalanche/menu.h | 6 +++--- engines/avalanche/pingo.h | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index f4fcd38b9bcd..be09cc4dd342 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -27,8 +27,8 @@ /* Original name: CELER The unit for updating the screen pics. */ -#ifndef AVALANCHE_CELER2_H -#define AVALANCHE_CELER2_H +#ifndef AVALANCHE_BACKGROUND_H +#define AVALANCHE_BACKGROUND_H #include "common/scummsys.h" #include "common/file.h" @@ -80,4 +80,4 @@ class Background { } // End of namespace Avalanche. -#endif // AVALANCHE_CELER2_H +#endif // AVALANCHE_BACKGROUND_H diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index b4c80a8e8954..cfda3cc11c13 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -27,8 +27,8 @@ /* CLOSING The closing screen and error handler. */ -#ifndef AVALANCHE_CLOSING2_H -#define AVALANCHE_CLOSING2_H +#ifndef AVALANCHE_CLOSING_H +#define AVALANCHE_CLOSING_H #include "common/scummsys.h" #include "common/str.h" @@ -60,4 +60,4 @@ class Closing { } // End of namespace Avalanche. -#endif // AVALANCHE_CLOSING2_H +#endif // AVALANCHE_CLOSING_H diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index ab0456ed431c..f85674735340 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -27,8 +27,8 @@ /* Original name: DROPDOWN A customized version of Oopmenu (qv). */ -#ifndef AVALANCHE_DROPDOWN2_H -#define AVALANCHE_DROPDOWN2_H +#ifndef AVALANCHE_MENU_H +#define AVALANCHE_MENU_H #include "common/scummsys.h" #include "common/str.h" @@ -179,4 +179,4 @@ class Menu { } // End of namespace Avalanche. -#endif // AVALANCHE_DROPDOWN2_H +#endif // AVALANCHE_MENU_H diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index ee4fb587e78c..296d9dea0581 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -27,8 +27,8 @@ /* PINGO Full-screen sub-parts of the game. */ -#ifndef AVALANCHE_PINGO2_H -#define AVALANCHE_PINGO2_H +#ifndef AVALANCHE_PINGO_H +#define AVALANCHE_PINGO_H #include "common/scummsys.h" #include "common/str.h" @@ -57,4 +57,4 @@ class Pingo { } // End of namespace Avalanche. -#endif // AVALANCHE_PINGO2_H +#endif // AVALANCHE_PINGO_H From 0ec40a5f80ca04842bd4b98e34a114a34821e691 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 18:02:51 +0200 Subject: [PATCH 1221/1332] AVALANCHE: Add static to 2 array definitions in closing --- engines/avalanche/closing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index e7314a05501a..5aea377abd57 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -53,12 +53,12 @@ void Closing::putIn(Common::String str, uint16 where) { } void Closing::exitGame() { - const Common::String nouns[12] = { + static const Common::String nouns[12] = { "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" }; - const Common::String verbs[12] = { + static const Common::String verbs[12] = { "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", "ignore", "stare at", "shriek at", "frighten", "quieten" }; From 72d1f587337e32ef378c15e54bde2ba52edbf419 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 18:10:17 +0200 Subject: [PATCH 1222/1332] AVALANCHE: Fix savegame naming. This breaks previous savegames --- engines/avalanche/avalanche.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3d059b60e282..7c4f7650e0bd 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -314,9 +314,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { } Common::String AvalancheEngine::getSaveFileName(const int slot) { - Common::String upperName = _targetName; - upperName.toUppercase(); - return upperName+ Common::String::format("-%02d.SAV", slot); + return Common::String::format("%s.%03d", _targetName, slot); } bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! From c53917ec64eae2bdc2e5eed52cf1f542a07cccbd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 18:12:13 +0200 Subject: [PATCH 1223/1332] AVALANCHE: Add indentation on REGISTER_PLUGIN_* lines --- engines/avalanche/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 6630ab801fb2..7fd85c5c1ad0 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -212,7 +212,7 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, } // End of namespace Avalanche #if PLUGIN_ENABLED_DYNAMIC(AVALANCHE) -REGISTER_PLUGIN_DYNAMIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); + REGISTER_PLUGIN_DYNAMIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); #else -REGISTER_PLUGIN_STATIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); + REGISTER_PLUGIN_STATIC(AVALANCHE, PLUGIN_TYPE_ENGINE, Avalanche::AvalancheMetaEngine); #endif From 304ab6da154dcc0f9815b42682a5568d49d81ef2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Oct 2013 20:50:28 +0200 Subject: [PATCH 1224/1332] AVALANCHE: Start cleaning includes - remove useless include in header files --- engines/avalanche/animation.h | 5 ----- engines/avalanche/avalot.h | 7 ------- engines/avalanche/background.h | 4 ---- engines/avalanche/closing.h | 1 - engines/avalanche/dialogs.h | 2 -- engines/avalanche/graphics.h | 4 ++-- engines/avalanche/menu.h | 1 - engines/avalanche/parser.h | 1 - engines/avalanche/pingo.h | 1 - engines/avalanche/sequence.h | 2 -- engines/avalanche/timer.h | 2 -- 11 files changed, 2 insertions(+), 28 deletions(-) diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index b975e030124b..2669c999aa36 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -30,11 +30,6 @@ #ifndef AVALANCHE_ANIMATION_H #define AVALANCHE_ANIMATION_H -#include "avalanche/graphics.h" - -#include "common/scummsys.h" -#include "common/str.h" - namespace Avalanche { class AvalancheEngine; class Animation; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 5381edd6cb34..ab78f5c385ec 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -32,13 +32,6 @@ #include "avalanche/animation.h" -#include "common/events.h" -#include "common/system.h" -#include "common/str.h" -#include "common/scummsys.h" -#include "common/file.h" -#include "graphics/surface.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index be09cc4dd342..34d7a9a2ccdf 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -30,12 +30,8 @@ #ifndef AVALANCHE_BACKGROUND_H #define AVALANCHE_BACKGROUND_H -#include "common/scummsys.h" -#include "common/file.h" #include "common/str.h" -#include "graphics/surface.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index cfda3cc11c13..25217e347ed5 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -30,7 +30,6 @@ #ifndef AVALANCHE_CLOSING_H #define AVALANCHE_CLOSING_H -#include "common/scummsys.h" #include "common/str.h" namespace Avalanche { diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index d8c205ac90a7..7263c47075bb 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -30,8 +30,6 @@ #ifndef AVALANCHE_DIALOGS_H #define AVALANCHE_DIALOGS_H -#include "common/system.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 876bcea6db9a..a6be3af2832d 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -28,11 +28,11 @@ #ifndef AVALANCHE_GRAPHICS_H #define AVALANCHE_GRAPHICS_H +#include "avalanche/enums.h" + #include "common/file.h" #include "common/rect.h" - #include "graphics/surface.h" -#include "avalanche/enums.h" namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index f85674735340..a7ec8bf2db2f 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -30,7 +30,6 @@ #ifndef AVALANCHE_MENU_H #define AVALANCHE_MENU_H -#include "common/scummsys.h" #include "common/str.h" namespace Avalanche { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 98adc3bbcd0e..0375367cc7c8 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -31,7 +31,6 @@ #include "avalanche/enums.h" #include "common/events.h" -#include "common/scummsys.h" #include "common/str.h" #include "common/serializer.h" diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index 296d9dea0581..72fdb54c2ac2 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -30,7 +30,6 @@ #ifndef AVALANCHE_PINGO_H #define AVALANCHE_PINGO_H -#include "common/scummsys.h" #include "common/str.h" namespace Avalanche { diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 94025babf4d1..d3c1b549631b 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -30,8 +30,6 @@ #ifndef AVALANCHE_SEQUENCE_H #define AVALANCHE_SEQUENCE_H -#include "common/scummsys.h" - namespace Avalanche { class AvalancheEngine; diff --git a/engines/avalanche/timer.h b/engines/avalanche/timer.h index 134a4dc94ee0..6cd894b0a5f4 100644 --- a/engines/avalanche/timer.h +++ b/engines/avalanche/timer.h @@ -30,8 +30,6 @@ #ifndef AVALANCHE_TIMER_H #define AVALANCHE_TIMER_H -#include "common/scummsys.h" - namespace Avalanche { class AvalancheEngine; From 260ba64bdaf76cc201c57284b99890fe3a9422ad Mon Sep 17 00:00:00 2001 From: RichieSams Date: Fri, 4 Oct 2013 14:13:21 -0500 Subject: [PATCH 1225/1332] ZVISION: Fix signed/unsigned mismatch --- engines/zvision/rlf_animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 8981a6983c2b..5f1d41daae7c 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -164,7 +164,7 @@ void RlfAnimation::seekToFrame(int frameNumber) { int closestFrame = _currentFrame; int distance = (int)frameNumber - _currentFrame; - for (int i = 0; i < _completeFrames.size(); ++i) { + for (uint i = 0; i < _completeFrames.size(); ++i) { int newDistance = (int)frameNumber - (int)(_completeFrames[i]); if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) { closestFrame = _completeFrames[i]; From a357dc4d0c0416dfc9a7e3aafb7f840eee5e5d6b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 01:55:41 +0200 Subject: [PATCH 1226/1332] AVALANCHE: Cleaning includes - remove useless includes in cpp files --- engines/avalanche/animation.cpp | 8 -------- engines/avalanche/avalanche.cpp | 10 ---------- engines/avalanche/avalot.cpp | 4 ---- engines/avalanche/background.cpp | 3 --- engines/avalanche/closing.cpp | 1 - engines/avalanche/detection.cpp | 1 - engines/avalanche/dialogs.cpp | 4 ---- engines/avalanche/graphics.cpp | 3 --- engines/avalanche/menu.cpp | 3 --- engines/avalanche/parser.cpp | 11 ----------- engines/avalanche/pingo.cpp | 6 ------ engines/avalanche/sequence.cpp | 5 ----- engines/avalanche/sound.cpp | 3 +-- engines/avalanche/timer.cpp | 6 ------ 14 files changed, 1 insertion(+), 67 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 08dffd5b5f30..6a7bad17f3e9 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -29,14 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/animation.h" -#include "avalanche/dialogs.h" -#include "avalanche/background.h" -#include "avalanche/sequence.h" -#include "avalanche/timer.h" - -#include "common/scummsys.h" -#include "common/textconsole.h" -#include "common/file.h" namespace Avalanche { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7c4f7650e0bd..89dca21d99a4 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -27,18 +27,8 @@ #include "avalanche/avalanche.h" -#include "common/system.h" #include "common/random.h" -#include "common/error.h" -#include "common/events.h" -#include "common/debug-channels.h" -#include "common/config-manager.h" -#include "common/textconsole.h" #include "common/savefile.h" - -#include "engines/util.h" - -#include "gui/saveload.h" #include "graphics/thumbnail.h" namespace Avalanche { diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f45341ea346f..ad71ce5ee8e6 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,11 +28,7 @@ /* AVALOT The kernel of the program. */ #include "avalanche/avalanche.h" - -#include "common/file.h" #include "common/random.h" -#include "common/str.h" -#include "common/textconsole.h" #include "common/config-manager.h" namespace Avalanche { diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index cb280ba730c3..54ab459d415b 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -29,9 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/background.h" -#include "avalanche/animation.h" - -#include "common/textconsole.h" namespace Avalanche { diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 5aea377abd57..93caa029cbd0 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -30,7 +30,6 @@ #include "avalanche/avalanche.h" #include "avalanche/closing.h" -#include "common/textconsole.h" #include "common/random.h" namespace Avalanche { diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 7fd85c5c1ad0..38700afb2892 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -31,7 +31,6 @@ #include "common/savefile.h" #include "engines/advancedDetector.h" - #include "graphics/thumbnail.h" namespace Avalanche { diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 0c90d1229320..fdc90bb5c1b3 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -29,11 +29,7 @@ #include "avalanche/avalanche.h" #include "avalanche/dialogs.h" -#include "avalanche/animation.h" -#include "avalanche/timer.h" -#include "common/textconsole.h" -#include "common/file.h" #include "common/random.h" namespace Avalanche { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index be397f520db9..12a1cb51dc86 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -28,11 +28,8 @@ #include "avalanche/avalanche.h" #include "avalanche/graphics.h" -#include "common/system.h" -#include "common/rect.h" #include "engines/util.h" #include "graphics/palette.h" -#include "math.h" namespace Avalanche { diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 14fa74c3201c..272948d6649b 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -29,9 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/menu.h" -#include "avalanche/animation.h" - -#include "common/textconsole.h" namespace Avalanche { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fc6085b58177..722755037844 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -27,17 +27,6 @@ #include "avalanche/avalanche.h" #include "avalanche/parser.h" -#include "avalanche/dialogs.h" -#include "avalanche/timer.h" -#include "avalanche/animation.h" -#include "avalanche/background.h" -#include "avalanche/pingo.h" -#include "avalanche/sequence.h" - -#include "common/textconsole.h" - -#include -#include namespace Avalanche { diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index bffceabe0772..7b45397183ce 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -28,13 +28,7 @@ /* PINGO Full-screen sub-parts of the game. */ #include "avalanche/avalanche.h" - #include "avalanche/pingo.h" -#include "avalanche/animation.h" -#include "avalanche/dialogs.h" - -#include "common/textconsole.h" -#include "common/file.h" namespace Avalanche { diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index fecbc0c3c34e..a9de50f49b6c 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -29,11 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/sequence.h" -#include "avalanche/timer.h" -#include "avalanche/background.h" -#include "avalanche/animation.h" - -#include "common/scummsys.h" namespace Avalanche { diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index dba679e17b15..2674c9ba350c 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -20,11 +20,10 @@ * */ -#include "audio/audiostream.h" - #include "avalanche/avalanche.h" #include "avalanche/sound.h" +#include "audio/audiostream.h" #include "common/system.h" #include "common/config-manager.h" diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index f34531734ecf..28cdc3b54ce4 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -29,12 +29,6 @@ #include "avalanche/avalanche.h" #include "avalanche/timer.h" -#include "avalanche/animation.h" -#include "avalanche/dialogs.h" -#include "avalanche/sequence.h" -#include "avalanche/pingo.h" - -#include "common/textconsole.h" namespace Avalanche { From eeabd8a0dd111437ad740477bdf80aa39d2d9663 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 02:16:30 +0200 Subject: [PATCH 1227/1332] AVALANCHE: Answer a couple of comments made by LordHoto --- engines/avalanche/graphics.cpp | 1 + engines/avalanche/sound.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 12a1cb51dc86..62ac1653baf1 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -684,6 +684,7 @@ void GraphicManager::refreshScreen() { } void GraphicManager::loadBackground(Common::File &file) { + _background.free(); _background = loadPictureRaw(file, kBackgroundWidth, kBackgroundHeight); } diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h index da2ece3b1481..25b6b267d34d 100644 --- a/engines/avalanche/sound.h +++ b/engines/avalanche/sound.h @@ -50,4 +50,4 @@ class SoundHandler { } // End of namespace Avalanche -#endif //AVALANCHE_SOUND_H +#endif // AVALANCHE_SOUND_H From 03ca6ef76f3d0087d7ddf855bf84fc0d327b17c2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 08:54:47 +0200 Subject: [PATCH 1228/1332] AVALANCHE: Fix bug introduced in badc727883c14d13702fc61a0a6912a3d61ce9a4 --- engines/avalanche/avalanche.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 89dca21d99a4..31fd05393c22 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -304,7 +304,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { } Common::String AvalancheEngine::getSaveFileName(const int slot) { - return Common::String::format("%s.%03d", _targetName, slot); + return Common::String::format("%s.%03d", _targetName.c_str(), slot); } bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! From d3cd7e237a017af32962bc20c4dd8f510a4b7c80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 09:04:33 +0200 Subject: [PATCH 1229/1332] AVALANCHE: Change disposeAfterUse value in Sound handler as suggested by LordHoto --- engines/avalanche/sound.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index 2674c9ba350c..b10a5db5520e 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -33,12 +33,11 @@ SoundHandler::SoundHandler(AvalancheEngine *vm) : _vm(vm) { _soundFl = true; _speakerStream = new Audio::PCSpeaker(_vm->_mixer->getOutputRate()); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, - _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, true); } SoundHandler::~SoundHandler() { _vm->_mixer->stopHandle(_speakerHandle); - delete _speakerStream; } /** From b6d6c17727755fe50bbbb02ddc126ab7c887683c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 14:37:20 +0200 Subject: [PATCH 1230/1332] AVALANCHE: Replace static strings by static char* --- engines/avalanche/avalanche.cpp | 4 ++-- engines/avalanche/avalot.cpp | 31 ++++++++++++++++--------------- engines/avalanche/closing.cpp | 14 +++++++------- engines/avalanche/menu.cpp | 10 +++++----- engines/avalanche/parser.cpp | 9 ++++----- engines/avalanche/parser.h | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 31fd05393c22..43943f263202 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -387,11 +387,11 @@ bool AvalancheEngine::loadGame(const int16 slot) { } Common::String AvalancheEngine::expandDate(int d, int m, int y) { - static const Common::String months[12] = { + static const char months[12][10] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; - Common::String month = months[m]; + Common::String month = Common::String(months[m]); Common::String day = intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ad71ce5ee8e6..f80a91550837 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1541,26 +1541,27 @@ bool AvalancheEngine::decreaseMoney(uint16 amount) { } Common::String AvalancheEngine::getName(People whose) { - static const Common::String lads[17] = { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + static const char lads[17][20] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", + "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", + "Dogfood", "A trader", "Ibythneth", "Ayles", "Port", + "Spurge", "Jacques" }; - static const Common::String lasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; + static const char lasses[4][15] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; if (whose < kPeopleArkata) - return lads[whose - kPeopleAvalot]; + return Common::String(lads[whose - kPeopleAvalot]); else - return lasses[whose - kPeopleArkata]; + return Common::String(lasses[whose - kPeopleArkata]); } Common::String AvalancheEngine::getItem(byte which) { - static const Common::String items[kObjectNum] = { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" + static const char items[kObjectNum][18] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", + "your clothes", "a habit", "an onion" }; Common::String result; @@ -1573,7 +1574,7 @@ Common::String AvalancheEngine::getItem(byte which) { case 0: case 1: case 4: - result = items[which - 1]; + result = Common::String(items[which - 1]); break; case 3: result = "some vinegar"; @@ -1586,11 +1587,11 @@ Common::String AvalancheEngine::getItem(byte which) { else if (_onionInVinegar) result = "a pickled onion (in the vinegar)"; else - result = items[which - 1]; + result = Common::String(items[which - 1]); break; default: if ((which < kObjectNum) && (which > 0)) - result = items[which - 1]; + result = Common::String(items[which - 1]); else result = ""; } diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 93caa029cbd0..00a75897a2bf 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -52,14 +52,14 @@ void Closing::putIn(Common::String str, uint16 where) { } void Closing::exitGame() { - static const Common::String nouns[12] = { - "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", - "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" + static const char nouns[12][14] = { + "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", + "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" }; - static const Common::String verbs[12] = { - "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", - "ignore", "stare at", "shriek at", "frighten", "quieten" + static const char verbs[12][12] = { + "haunt", "daunt", "tickle", "gobble", "erase", "provoke", + "surprise", "ignore", "stare at", "shriek at", "frighten", "quieten" }; _vm->_sound->stopSound(); @@ -67,7 +67,7 @@ void Closing::exitGame() { getScreen(kScreenNagScreen); byte nounId = _vm->_rnd->getRandomNumber(11); byte verbId = _vm->_rnd->getRandomNumber(11); - Common::String result = nouns[nounId] + " will " + verbs[verbId] + " you"; + Common::String result = Common::String::format("%s will %d you", nouns[nounId], verbs[verbId]); putIn(result, 1628); showScreen(); // No halt- it's already set up. } diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 272948d6649b..1f349d242449 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -795,7 +795,7 @@ byte Menu::getNameChar(People whose) { } Common::String Menu::getThing(byte which) { - static const Common::String things[kObjectNum] = { + static const char things[kObjectNum][20] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" @@ -807,7 +807,7 @@ Common::String Menu::getThing(byte which) { switch (_vm->_wineState) { case 1: case 4: - result = things[which - 1]; + result = Common::String(things[which - 1]); break; case 3: result = "Vinegar"; @@ -816,12 +816,12 @@ Common::String Menu::getThing(byte which) { break; case kObjectOnion: if (_vm->_rottenOnion) - result = "rotten onion"; + result = Common::String("rotten onion"); else - result = things[which - 1]; + result = Common::String(things[which - 1]); break; default: - result = things[which - 1]; + result = Common::String(things[which - 1]); } return result; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 722755037844..28c3b3bdd1dc 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -525,9 +525,8 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score)) { - return ranks[i]._title; - } + if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score)) + return Common::String(ranks[i]._title); } return ""; } @@ -1572,7 +1571,7 @@ void Parser::heyThanks() { * @remarks Originally called 'do_that' */ void Parser::doThat() { - static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + static const char booze[8][8] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; static const char kWhat[] = "That's not possible!"; if (_thats == Common::String(kNothing)) { @@ -2052,7 +2051,7 @@ void Parser::doThat() { _vm->incScore(3); _vm->_background->draw(-1, -1, 11); - _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + kControlRegister + '1' + kControlSpeechBubble); + _vm->_dialogs->displayText(Common::String(booze[_thing - 51]) + ", please." + kControlRegister + '1' + kControlSpeechBubble); _vm->_drinking = _thing; _vm->_background->draw(-1, -1, 9); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 0375367cc7c8..892b81e9a3f8 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -99,7 +99,7 @@ class Parser { struct RankType { uint16 _score; - Common::String _title; + char _title[20]; }; static const char *kCopyright; From 1844dcf05cdf57a42d8336ef3c6ff1ffe02a951f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 14:47:07 +0200 Subject: [PATCH 1231/1332] AVALANCHE: Remove a missed useless include --- engines/avalanche/sound.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index b10a5db5520e..c324df471390 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -24,7 +24,6 @@ #include "avalanche/sound.h" #include "audio/audiostream.h" -#include "common/system.h" #include "common/config-manager.h" namespace Avalanche { From bf41366fd7e042c1ef48ffc4ff5366fee27e756f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 15:09:00 +0200 Subject: [PATCH 1232/1332] AVALANCHE: Fix error not reported by MSVC --- engines/avalanche/closing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 00a75897a2bf..1cb2e84218da 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -67,7 +67,7 @@ void Closing::exitGame() { getScreen(kScreenNagScreen); byte nounId = _vm->_rnd->getRandomNumber(11); byte verbId = _vm->_rnd->getRandomNumber(11); - Common::String result = Common::String::format("%s will %d you", nouns[nounId], verbs[verbId]); + Common::String result = Common::String::format("%s will %s you", nouns[nounId], verbs[verbId]); putIn(result, 1628); showScreen(); // No halt- it's already set up. } From 0f42dd4511ed4cc279acb075344fb62bc25300a9 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 6 Oct 2013 00:03:49 +0200 Subject: [PATCH 1233/1332] AVALANCHE: Use floats instead of double. Use M_PI where it is possible. --- engines/avalanche/avalot.cpp | 3 ++- engines/avalanche/graphics.cpp | 13 ++++++------- engines/avalanche/parser.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f80a91550837..e6cf310d54cc 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -30,6 +30,7 @@ #include "avalanche/avalanche.h" #include "common/random.h" #include "common/config-manager.h" +#include namespace Avalanche { @@ -1360,7 +1361,7 @@ void AvalancheEngine::majorRedraw() { } uint16 AvalancheEngine::bearing(byte whichPed) { - static const double rad2deg = 180 / 3.14; // Pi + const float rad2deg = 180 / M_PI; AnimationType *avvy = &_animation->_sprites[0]; PedType *curPed = &_peds[whichPed]; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 62ac1653baf1..d442c13d513a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -199,8 +199,7 @@ void GraphicManager::fleshColors() { Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { Common::Point endPoint; - const double pi = 3.14; - const double convfac = pi / 180.0; + const float convfac = M_PI / 180.0; int32 xRadius = radius; int32 yRadius = radius * kScreenWidth / (8 * kScreenHeight); // Just don't ask why... @@ -233,20 +232,20 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 uint16 numOfPixels = (uint16)floor(sqrt(3.0) * sqrt(pow(double(xRadius), 2) + pow(double(yRadius), 2)) + 0.5); // Calculate the angle precision required. - double delta = 90.0 / numOfPixels; + float delta = 90.0 / numOfPixels; // Always just go over the first 90 degrees. Could be optimized a // bit if startAngle and endAngle lie in the same quadrant, left as an // exercise for the reader. :) - double j = 0; + float j = 0; // Calculate stop position, go 1 further than 90 because otherwise 1 pixel is sometimes not drawn. uint16 deltaEnd = 91; // Set the end point. - double tempTerm = endAngle * convfac; + float tempTerm = endAngle * convfac; endPoint.x = (int16)floor(xRadius * cos(tempTerm) + 0.5) + x; - endPoint.y = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5) + y; + endPoint.y = (int16)floor(yRadius * sin(tempTerm + M_PI) + 0.5) + y; // Calculate points. int16 xNext = xRadius; @@ -258,7 +257,7 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 tempTerm = (j + delta) * convfac; xNext = (int16)floor(xRadius * cos(tempTerm) + 0.5); - yNext = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5); + yNext = (int16)floor(yRadius * sin(tempTerm + M_PI) + 0.5); int16 xp = x + xTemp; int16 xm = x - xTemp; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 28c3b3bdd1dc..05d402617d5a 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -533,7 +533,7 @@ Common::String Parser::rank() { Common::String Parser::totalTime() { // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. - const double ticksInOneSec = (double)(65535) / 3600; + const float ticksInOneSec = (float)(65535) / 3600; uint16 h, m, s; h = (uint16)floor(_vm->_totalTime / ticksInOneSec); // No. of seconds. From 61983d027a590400acd0a5f6b6ff8250d42fb460 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 6 Oct 2013 00:24:11 +0200 Subject: [PATCH 1234/1332] AVALANCHE: Add a comment to Dialogs::stripTrailingSpaces(). --- engines/avalanche/dialogs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index fdc90bb5c1b3..e126e5ec80de 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -580,6 +580,7 @@ Common::String Dialogs::displayMoney() { void Dialogs::stripTrailingSpaces(Common::String &str) { while (str.lastChar() == ' ') str.deleteLastChar(); + // We don't use String::trim() here because we need the leading whitespaces. } /** From fed85464440fbe08e8f99edfddb018519b680a69 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 6 Oct 2013 01:20:20 +0200 Subject: [PATCH 1235/1332] AVALANCHE: Update credit files. --- AUTHORS | 4 ++++ devtools/credits.pl | 5 +++++ gui/credits.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/AUTHORS b/AUTHORS index fd5407b460c8..e561aec4fd17 100644 --- a/AUTHORS +++ b/AUTHORS @@ -61,6 +61,10 @@ ScummVM Team Travis Howell Oliver Kiehl - (retired) Ludvig Strigeus - (retired) + + AVALANCHE: + Peter Bozso + Arnaud Boutonne CGE: Arnaud Boutonne diff --git a/devtools/credits.pl b/devtools/credits.pl index 45018a563344..50efb42a55a2 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -541,6 +541,11 @@ sub add_paragraph { add_person("Oliver Kiehl", "olki", "(retired)"); add_person("Ludvig Strigeus", "ludde", "(retired)"); end_section(); + + begin_section("AVALANCHE"); + add_person("Peter Bozsó", "uruk", ""); + add_person("Arnaud Boutonné", "Strangerke", ""); + end_section(); begin_section("CGE"); add_person("Arnaud Boutonné", "Strangerke", ""); diff --git a/gui/credits.h b/gui/credits.h index 3a4d7769f6c7..6bb052377318 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -77,6 +77,11 @@ static const char *credits[] = { "C0""Ludvig Strigeus", "C2""(retired)", "", +"C1""AVALANCHE", +"A0""Peter Bozso", +"C0""Peter Bozs\363", +"C0""Arnaud Boutonn\351", +"", "C1""CGE", "A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", From 14dee780e07ec819a3ed2520e326bed2d056460f Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 6 Oct 2013 10:35:58 +0200 Subject: [PATCH 1236/1332] AVALANCHE: Get rid of FP in Parser::totalTime(). --- engines/avalanche/parser.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 05d402617d5a..5d8e50c147d9 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -532,11 +532,9 @@ Common::String Parser::rank() { } Common::String Parser::totalTime() { - // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour. - const float ticksInOneSec = (float)(65535) / 3600; uint16 h, m, s; - h = (uint16)floor(_vm->_totalTime / ticksInOneSec); // No. of seconds. + h = (uint16) _vm->_totalTime / 65535 / 3600; m = h % 3600; h /= 3600; s = m % 60; From ac231eb83870c189261b231d44eff366e354b6dd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Oct 2013 14:22:42 +0200 Subject: [PATCH 1237/1332] AVALANCHE: Rework totalTime() --- engines/avalanche/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 5d8e50c147d9..98deefae4e41 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -534,7 +534,7 @@ Common::String Parser::rank() { Common::String Parser::totalTime() { uint16 h, m, s; - h = (uint16) _vm->_totalTime / 65535 / 3600; + h = (uint16)((_vm->_totalTime * 3600) / 65535); m = h % 3600; h /= 3600; s = m % 60; From 6216430428724e8d833736d00cb807b14507bd9c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Oct 2013 14:38:52 +0200 Subject: [PATCH 1238/1332] AVALANCHE: Rework bearing() --- engines/avalanche/avalot.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e6cf310d54cc..8e70d7b2aafb 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -30,7 +30,6 @@ #include "avalanche/avalanche.h" #include "common/random.h" #include "common/config-manager.h" -#include namespace Avalanche { @@ -1361,16 +1360,18 @@ void AvalancheEngine::majorRedraw() { } uint16 AvalancheEngine::bearing(byte whichPed) { - const float rad2deg = 180 / M_PI; AnimationType *avvy = &_animation->_sprites[0]; PedType *curPed = &_peds[whichPed]; if (avvy->_x == curPed->_x) return 0; - else if (avvy->_x < curPed->_x) { - return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); + + int16 deltaX = avvy->_x - curPed->_x; + int16 deltaY = avvy->_y - curPed->_y; + if (deltaX < 0) { + return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 90); } else { - return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); + return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 270); } } From b7f7644cc64afaa5c470e663fbd9387564856e88 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 6 Oct 2013 14:47:30 +0200 Subject: [PATCH 1239/1332] AVALANCHE: Fix potential integer overflow --- engines/avalanche/parser.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 98deefae4e41..a9f9ea2be494 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -534,11 +534,10 @@ Common::String Parser::rank() { Common::String Parser::totalTime() { uint16 h, m, s; - h = (uint16)((_vm->_totalTime * 3600) / 65535); - m = h % 3600; - h /= 3600; - s = m % 60; - m /= 60; + h = (uint16)(_vm->_totalTime / 65535); + s = (uint16)(_vm->_totalTime % 65535); + m = s / 60; + s = s % 60; Common::String result = "You've been playing for "; if (h > 0) From c99061e7c568454b0dcc209a49f82f75276e5c5a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 6 Oct 2013 14:50:02 +0200 Subject: [PATCH 1240/1332] AVALANCHE: Fix time output --- engines/avalanche/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index a9f9ea2be494..fb2008dcfc57 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -543,7 +543,7 @@ Common::String Parser::totalTime() { if (h > 0) result += Common::String::format("%d hours, ", h); if ((m > 0) || (h != 0)) - result = Common::String::format("%d minutes and ", m); + result += Common::String::format("%d minutes and ", m); return result + Common::String::format("%d seconds", s); } From a246dbad26de4e90dceb29b2b0fbd438b1e6072d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 02:14:19 +0200 Subject: [PATCH 1241/1332] AVALANCHE: Fix parser bug when pressing F5 --- engines/avalanche/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fb2008dcfc57..bfce8805d166 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -415,7 +415,7 @@ void Parser::handleFunctionKey(const Common::Event &event) { _person = kPeoplePardon; _thing = kPardon; Common::String f5does = _vm->f5Does(); - VerbCode verb = (VerbCode)f5does[0]; + VerbCode verb = (VerbCode)(byte)f5does[0]; _vm->callVerb(verb); } break; From a30cc19ca84562d79fa20343c5e8f01ef3355b0b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 02:18:09 +0200 Subject: [PATCH 1242/1332] AVALANCHE: Fix two other broken verb usages --- engines/avalanche/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 1f349d242449..c799ef076181 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -578,7 +578,7 @@ void Menu::runMenuAction() { _vm->_parser->_person = kPeoplePardon; _vm->_parser->_thing = _vm->_parser->kPardon; Common::String f5Does = _vm->f5Does(); - VerbCode verb = (VerbCode)f5Does[0]; + VerbCode verb = (VerbCode)(byte)f5Does[0]; _vm->callVerb(verb); } break; @@ -659,7 +659,7 @@ void Menu::runMenuWith() { _vm->_subjectNum = 0; } } - _vm->callVerb((VerbCode)_verbStr[_activeMenuItem._choiceNum]); + _vm->callVerb((VerbCode)(byte)_verbStr[_activeMenuItem._choiceNum]); } void Menu::setup() { From 8430288fef4f831f51261b32e4ad1640006fad72 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 02:52:41 +0200 Subject: [PATCH 1243/1332] AVALANCHE: Hook some more function keys --- engines/avalanche/parser.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index bfce8805d166..e3383c778581 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -411,6 +411,26 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { + case Common::KEYCODE_F1: + _vm->callVerb(kVerbCodeHelp); + break; + case Common::KEYCODE_F2: + if (event.kbd.flags & Common::KBD_CTRL) { + clearWords(); + _vm->callVerb(kVerbCodeSave); + } else + _vm->_sound->toggleSound(); + break; + case Common::KEYCODE_F3: + if (event.kbd.flags & Common::KBD_CTRL) { + clearWords(); + _vm->callVerb(kVerbCodeLoad); + } else if (_inputText.size() < _inputTextBackup.size()) { + _inputText = _inputText + &(_inputTextBackup.c_str()[_inputText.size()]); + _inputTextPos = _inputText.size(); + plotText(); + } + break; case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; @@ -422,6 +442,14 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F7: _vm->callVerb(kVerbCodeOpen); break; + case Common::KEYCODE_F11: + clearWords(); + _vm->callVerb(kVerbCodeSave); + break; + case Common::KEYCODE_F12: + clearWords(); + _vm->callVerb(kVerbCodeLoad); + break; default: break; } From bbf8e647e90238b1c932898a0814ecbf4f257761 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Sun, 6 Oct 2013 20:56:47 -0500 Subject: [PATCH 1244/1332] ZVISION: Add an entry in AUTHORS for ZVision --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index fd5407b460c8..4a249a27d3eb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -239,6 +239,9 @@ ScummVM Team Wintermute: Einar Johan T. Somaaen + + ZVision: + Adrian Astley Backend Teams ------------- From 31b01f0d11307b82d3eeedbda9d70fe651313058 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 07:15:54 +0200 Subject: [PATCH 1245/1332] AVALANCHE: Add save/load code --- engines/avalanche/parser.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e3383c778581..6bca4765ec83 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -28,6 +28,8 @@ #include "avalanche/avalanche.h" #include "avalanche/parser.h" +#include "gui/saveload.h" + namespace Avalanche { const char *Parser::kCopyright = "1995"; @@ -1789,9 +1791,28 @@ void Parser::doThat() { swallow(); break; - case kVerbCodeLoad: + case kVerbCodeLoad: { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); + int16 savegameId = dialog->runModalWithCurrentTarget(); + delete dialog; + + if (savegameId < 0) // dialog aborted + return; + + _vm->loadGame(savegameId); + } break; - case kVerbCodeSave: + case kVerbCodeSave: { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); + int16 savegameId = dialog->runModalWithCurrentTarget(); + Common::String savegameDescription = dialog->getResultString(); + delete dialog; + + if (savegameId < 0) // dialog aborted + return; + + _vm->saveGame(savegameId, savegameDescription); + } break; // We don't handle these two because we use ScummVM's save/load system. From 77c10447c3e3d52247598e6ce6c1531f87883ec8 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 7 Oct 2013 10:04:53 +0200 Subject: [PATCH 1246/1332] AVALANCHE: Repair credits.h --- gui/credits.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/credits.h b/gui/credits.h index 6bb052377318..e375fa0cbc9f 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -79,6 +79,7 @@ static const char *credits[] = { "", "C1""AVALANCHE", "A0""Peter Bozso", +"A0""Arnaud Boutonne", "C0""Peter Bozs\363", "C0""Arnaud Boutonn\351", "", From 7b11be0a9245875fe6cd48ffd9e3f2f325d98c23 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 22:24:08 +0200 Subject: [PATCH 1247/1332] AVALANCHE: Fix savegame patterns --- engines/avalanche/detection.cpp | 6 +++--- gui/credits.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 38700afb2892..e45422192cb6 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -111,7 +111,7 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { Common::StringArray filenames; Common::String pattern = target; pattern.toUppercase(); - pattern += "-??.SAV"; + pattern += ".???"; filenames = saveFileMan->listSavefiles(pattern); sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) @@ -164,12 +164,12 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { } void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { - Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + Common::String fileName = Common::String::format("%s.%03d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); } SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); + Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); if (f) { diff --git a/gui/credits.h b/gui/credits.h index e375fa0cbc9f..74b1de8c85e9 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -79,8 +79,8 @@ static const char *credits[] = { "", "C1""AVALANCHE", "A0""Peter Bozso", -"A0""Arnaud Boutonne", "C0""Peter Bozs\363", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "", "C1""CGE", From c36adb83e2820dd6ad0f612c5a3a05a001220656 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 22:38:32 +0200 Subject: [PATCH 1248/1332] AVALANCHE: Fix savegames list --- engines/avalanche/detection.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index e45422192cb6..428e71f35aa0 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -117,15 +117,11 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) SaveStateList saveList; - char slot[3]; for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { - slot[0] = filename->c_str()[filename->size() - 6]; - slot[1] = filename->c_str()[filename->size() - 5]; - slot[2] = '\0'; - // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot - int slotNum = atoi(slot); + const Common::String &fname = *filename; + int slotNum = atoi(fname.c_str() + fname.size() - 3); if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { - Common::InSaveFile *file = saveFileMan->openForLoading(*filename); + Common::InSaveFile *file = saveFileMan->openForLoading(fname); if (file) { // Check for our signature. uint32 signature = file->readUint32LE(); From 10b4495b518b5143ba97cdcda738d678c4348b1f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Oct 2013 00:02:32 +0200 Subject: [PATCH 1249/1332] AVALANCHE: Hook some more function keys --- engines/avalanche/parser.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 6bca4765ec83..e8ef17c2e139 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -433,6 +433,12 @@ void Parser::handleFunctionKey(const Common::Event &event) { plotText(); } break; + case Common::KEYCODE_F4: + if (event.kbd.flags & Common::KBD_ALT) + _vm->callVerb(kVerbCodeQuit); + else + _vm->callVerb(kVerbCodeRestart); + break; case Common::KEYCODE_F5: { _person = kPeoplePardon; _thing = kPardon; @@ -441,8 +447,23 @@ void Parser::handleFunctionKey(const Common::Event &event) { _vm->callVerb(verb); } break; + case Common::KEYCODE_F6: + _vm->callVerb(kVerbCodePause); + break; case Common::KEYCODE_F7: - _vm->callVerb(kVerbCodeOpen); + if (event.kbd.flags & Common::KBD_CTRL) + _vm->majorRedraw(); + else + _vm->callVerb(kVerbCodeOpen); + break; + case Common::KEYCODE_F8: + _vm->callVerb(kVerbCodeLook); + break; + case Common::KEYCODE_F9: + _vm->callVerb(kVerbCodeScore); + break; + case Common::KEYCODE_F10: + _vm->callVerb(kVerbCodeQuit); break; case Common::KEYCODE_F11: clearWords(); From eebbdfbfb364b01d1e9b79141e6cccdff5d2667a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Oct 2013 06:42:52 +0200 Subject: [PATCH 1250/1332] AVALANCHE: Add code for Shift-F10 --- engines/avalanche/parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e8ef17c2e139..eb94ae585cec 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -463,7 +463,10 @@ void Parser::handleFunctionKey(const Common::Event &event) { _vm->callVerb(kVerbCodeScore); break; case Common::KEYCODE_F10: - _vm->callVerb(kVerbCodeQuit); + if (event.kbd.flags & Common::KBD_SHIFT) + _vm->callVerb(kVerbCodeInfo); + else + _vm->callVerb(kVerbCodeQuit); break; case Common::KEYCODE_F11: clearWords(); From 0bfe150dca3ede26a5fab9b95003f0a4d8eaf87f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Oct 2013 06:43:36 +0200 Subject: [PATCH 1251/1332] AVALANCHE: Fix coding conventions in Graphics --- engines/avalanche/graphics.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index d442c13d513a..bfeb72737dee 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -265,16 +265,16 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 int16 ym = y - yTemp; if ((j >= stAngle) && (j <= endAngle)) - *(byte *)_scrolls.getBasePtr(xp,yp) = color; + *(byte *)_scrolls.getBasePtr(xp, yp) = color; - if (((180-j) >= stAngle) && ((180-j) <= endAngle)) - *(byte *)_scrolls.getBasePtr(xm,yp) = color; + if (((180 - j) >= stAngle) && ((180 - j) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xm, yp) = color; - if (((j+180) >= stAngle) && ((j+180) <= endAngle)) - *(byte *)_scrolls.getBasePtr(xm,ym) = color; + if (((j + 180) >= stAngle) && ((j + 180) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xm, ym) = color; - if (((360-j) >= stAngle) && ((360-j) <= endAngle)) - *(byte *)_scrolls.getBasePtr(xp,ym) = color; + if (((360 - j) >= stAngle) && ((360 - j) <= endAngle)) + *(byte *)_scrolls.getBasePtr(xp, ym) = color; j += delta; } while (j <= deltaEnd); From cf36706b98ccc73ec50dd338a473f0672d0dff17 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Oct 2013 07:15:58 +0200 Subject: [PATCH 1252/1332] AVALANCHE: Remove empty case in verb handling, clarify output when the opcode is unhandled --- engines/avalanche/parser.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index eb94ae585cec..48000a973061 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -2258,9 +2258,6 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('Q', 12); } break; - case kVerbCodeDir: - //_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)! - break; case kVerbCodeDie: _vm->gameOver(); break; @@ -2380,7 +2377,7 @@ void Parser::doThat() { } break; default: - Common::String tmpStr = Common::String::format("%cParser bug!", kControlBell); + Common::String tmpStr = Common::String::format("%cUnhandled verb: %d", kControlBell, _verb); _vm->_dialogs->displayText(tmpStr); } } From 8e8e5af0ec3ee4760e83beff095a0bf76a80e5f6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 8 Oct 2013 09:49:28 -0500 Subject: [PATCH 1253/1332] ZVISION: Add an entry in credits.pl for ZVision --- devtools/credits.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devtools/credits.pl b/devtools/credits.pl index 45018a563344..133eba5e93bd 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -754,6 +754,10 @@ sub add_paragraph { begin_section("Wintermute"); add_person("Einar Johan T. Sømåen", "somaen", ""); end_section(); + + begin_section("ZVision"); + add_person("Adrian Astley", "RichieSams", ""); + end_section(); end_section(); From ef87ba54b446346eb528bd1115578b5a99df0b9c Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 8 Oct 2013 09:50:20 -0500 Subject: [PATCH 1254/1332] ZVISION: Add an entry in credits.pl for Marisa Chan / Zidane --- devtools/credits.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/credits.pl b/devtools/credits.pl index 133eba5e93bd..57336e2895e4 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -1158,6 +1158,7 @@ sub add_paragraph { add_person("Jimmi Thøgersen", "", "For ScummRev, and much obscure code/documentation"); add_person("", "Tristan", "For additional work on the original MT-32 emulator"); add_person("James Woodcock", "", "Soundtrack enhancements"); + add_person("Anton Yartsev", "Zidane", "For the original re-implementation of the ZVison engine"); end_persons(); add_paragraph( From b0255c9406d2e90b076e7f9c5f42049e4e0ba2d4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Oct 2013 00:39:16 +0200 Subject: [PATCH 1255/1332] AVALANCHE: Implement fadeIn and fadeOut (dusk and dawn) --- engines/avalanche/animation.cpp | 10 ++-- engines/avalanche/avalanche.cpp | 4 +- engines/avalanche/avalanche.h | 10 ++-- engines/avalanche/avalot.cpp | 93 +++++++++++++++++++++++++-------- engines/avalanche/graphics.cpp | 2 +- engines/avalanche/parser.cpp | 14 ++--- engines/avalanche/pingo.cpp | 4 +- engines/avalanche/timer.cpp | 2 +- 8 files changed, 94 insertions(+), 45 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 6a7bad17f3e9..08fe32085f95 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -769,7 +769,7 @@ void Animation::callSpecial(uint16 which) { } break; case 4: // This is the ghost room link. - _vm->dusk(); + _vm->fadeOut(); _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! @@ -837,7 +837,7 @@ void Animation::callSpecial(uint16 which) { return; } } - _vm->dusk(); + _vm->fadeOut(); _vm->_catacombY--; catacombMove(4); if (_vm->_room != kRoomCatacombs) @@ -855,7 +855,7 @@ void Animation::callSpecial(uint16 which) { dawnDelay(); break; case 11: // _vm->special 11: transfer east in catacombs. - _vm->dusk(); + _vm->fadeOut(); _vm->_catacombX++; catacombMove(1); if (_vm->_room != kRoomCatacombs) @@ -864,7 +864,7 @@ void Animation::callSpecial(uint16 which) { dawnDelay(); break; case 12: // _vm->special 12: transfer south in catacombs. - _vm->dusk(); + _vm->fadeOut(); _vm->_catacombY++; catacombMove(2); if (_vm->_room != kRoomCatacombs) @@ -873,7 +873,7 @@ void Animation::callSpecial(uint16 which) { dawnDelay(); break; case 13: // _vm->special 13: transfer west in catacombs. - _vm->dusk(); + _vm->fadeOut(); _vm->_catacombX--; catacombMove(3); if (_vm->_room != kRoomCatacombs) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 43943f263202..3e0bdb050741 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -50,6 +50,8 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _totalTime = 0; _showDebugLines = false; + + memset(_fxPal, 0, 16 * 16 * 3); } AvalancheEngine::~AvalancheEngine() { @@ -359,7 +361,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { if (_holdTheDawn) { _holdTheDawn = false; - dawn(); + fadeIn(); } _background->release(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 1ef5d5014ed1..e9d2b1e1163d 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -274,8 +274,8 @@ class AvalancheEngine : public Engine { void fxToggle(); void refreshObjectList(); void errorLed(); - void dusk(); - void dawn(); + void fadeOut(); + void fadeIn(); void drawDirection(); // Draws the little icon at the left end of the text input field. void gameOver(); uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees. @@ -306,6 +306,8 @@ class AvalancheEngine : public Engine { // Will be used in dusk() and dawn(). bool _fxHidden; + byte _fxPal[16][16][3]; + bool _spludwickAtHome; // Is Spludwick at home? bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts? bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning. @@ -328,8 +330,6 @@ class AvalancheEngine : public Engine { void findPeople(byte room); void putGeidaAt(byte whichPed, byte ped); void guideAvvy(Common::Point cursorPos); - void fadeOut(byte n); - void fadeIn(byte n); void enterRoom(Room room, byte ped); void exitRoom(byte x); void drawToolbar(); @@ -339,8 +339,6 @@ class AvalancheEngine : public Engine { void fixFlashers(); void loadAlso(byte num); void resetVariables(); - - int8 fades(int8 x); }; } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 8e70d7b2aafb..2da1aeaa2d14 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -28,8 +28,11 @@ /* AVALOT The kernel of the program. */ #include "avalanche/avalanche.h" + #include "common/random.h" +#include "common/system.h" #include "common/config-manager.h" +#include "graphics/palette.h" namespace Avalanche { @@ -297,7 +300,7 @@ void AvalancheEngine::setup() { init(); _dialogs->reset(); - dusk(); + fadeOut(); _graphics->loadDigits(); _parser->_inputTextPos = 0; @@ -308,7 +311,7 @@ void AvalancheEngine::setup() { drawToolbar(); _dialogs->setReadyLight(2); - dawn(); + fadeIn(); _parser->_cursorState = false; _parser->cursorOn(); _animation->_sprites[0]._speedX = kWalk; @@ -376,7 +379,6 @@ void AvalancheEngine::init() { #endif _letMeOut = false; - _holdTheDawn = true; _currentMouse = 177; _dropsOk = true; _mouseText = ""; @@ -837,7 +839,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomMap: // You're entering the map. - dawn(); + fadeIn(); if (ped > 0) _graphics->zoomOut(_peds[ped]._x, _peds[ped]._y); @@ -1294,25 +1296,72 @@ void AvalancheEngine::errorLed() { warning("STUB: errorled()"); } -int8 AvalancheEngine::fades(int8 x) { - warning("STUB: fades()"); - return 0; -} +/** + * Displays a fade out, full screen. + * This version is different to the one in the original, which was fading in 3 steps. + * @remarks Originally called 'dusk' + */ +void AvalancheEngine::fadeOut() { + byte pal[3], tmpPal[3]; -void AvalancheEngine::fadeOut(byte n) { - warning("STUB: fadeOut()"); -} + _graphics->setBackgroundColor(kColorBlack); + if (_fxHidden) + return; + _fxHidden = true; + + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 16; j++) { + g_system->getPaletteManager()->grabPalette((byte *)tmpPal, j, 1); + _fxPal[i][j][0] = tmpPal[0]; + _fxPal[i][j][1] = tmpPal[1]; + _fxPal[i][j][2] = tmpPal[2]; + if (tmpPal[0] >= 16) + pal[0] = tmpPal[0] - 16; + else + pal[0] = 0; -void AvalancheEngine::dusk() { - warning("STUB: dusk()"); -} + if (tmpPal[1] >= 16) + pal[1] = tmpPal[1] - 16; + else + pal[1] = 0; -void AvalancheEngine::fadeIn(byte n) { - warning("STUB: fadeIn()"); + if (tmpPal[2] >= 16) + pal[2] = tmpPal[2] - 16; + else + pal[2] = 0; + + g_system->getPaletteManager()->setPalette(pal, j, 1); + } + _system->delayMillis(10); + _graphics->refreshScreen(); + } } -void AvalancheEngine::dawn() { - warning("STUB: dawn()"); +/** + * Displays a fade in, full screen. + * This version is different to the one in the original, which was fading in 3 steps. + * @remarks Originally called 'dawn' + */ +void AvalancheEngine::fadeIn() { + if (_holdTheDawn || !_fxHidden) + return; + + _fxHidden = false; + + byte pal[3]; + for (int i = 15; i >= 0; i--) { + for (int j = 0; j < 16; j++) { + pal[0] = _fxPal[i][j][0]; + pal[1] = _fxPal[i][j][1]; + pal[2] = _fxPal[i][j][2]; + g_system->getPaletteManager()->setPalette(pal, j, 1); + } + _system->delayMillis(10); + _graphics->refreshScreen(); + } + + if ((_room == kRoomYours) && _avvyInBed && _teetotal) + _graphics->setBackgroundColor(kColorYellow); } void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits(). @@ -1344,7 +1393,7 @@ void AvalancheEngine::gameOver() { } void AvalancheEngine::minorRedraw() { - dusk(); + fadeOut(); enterRoom(_room, 0); // Ped unknown or non-existant. @@ -1352,7 +1401,7 @@ void AvalancheEngine::minorRedraw() { _scoreToDisplay[i] = -1; // impossible digits drawScore(); - dawn(); + fadeIn(); } void AvalancheEngine::majorRedraw() { @@ -1652,7 +1701,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { } exitRoom(_room); - dusk(); + fadeOut(); for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) { if (_animation->_sprites[i]._quick) @@ -1669,7 +1718,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { _animation->setDirection(_animation->_sprites[0]._facingDir); drawDirection(); - dawn(); + fadeIn(); } /** diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index bfeb72737dee..0414bf533371 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -748,7 +748,7 @@ void GraphicManager::setDialogColor(Color bg, Color text) { // Original name background() void GraphicManager::setBackgroundColor(Color x) { - warning("STUB: setBackgroundColor(%d)", x); + warning("STUB: setBackgroundColor()"); } } // End of namespace Avalanche diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 48000a973061..ca97d4d1e865 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1421,7 +1421,7 @@ void Parser::drink() { _vm->_avvyIsAwake = false; _vm->_avvyInBed = true; _vm->refreshObjectList(); - _vm->dusk(); + _vm->fadeOut(); _vm->flipRoom(kRoomYours, 1); _vm->_graphics->setBackgroundColor(kColorYellow); _vm->_animation->_sprites[0]._visible = false; @@ -2348,17 +2348,17 @@ void Parser::doThat() { _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { // Default doodah. - _vm->dusk(); - _vm->dawn(); + _vm->fadeOut(); + _vm->fadeIn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", kControlParagraph); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeRestart: if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) { - _vm->dusk(); + _vm->fadeOut(); _vm->newGame(); - _vm->dawn(); + _vm->fadeIn(); } break; case kVerbCodePardon: @@ -2383,12 +2383,12 @@ void Parser::doThat() { } void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) { + // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. switch (verb) { case kVerbCodeExam: answer = "Examine"; ansKey = 'x'; - break; // The ubiquitous one. - // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. + break; case kVerbCodeDrink: answer = "Drink"; ansKey = 'D'; diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 7b45397183ce..433924f594d0 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -70,7 +70,7 @@ void Pingo::zonk() { void Pingo::winningPic() { Common::File f; - _vm->dusk(); + _vm->fadeOut(); if (!f.open("finale.avd")) error("AVALANCHE: File not found: finale.avd"); @@ -89,7 +89,7 @@ void Pingo::winningPic() { warning("STUB: Pingo::winningPic()"); - _vm->dawn(); + _vm->fadeIn(); #if 0 do { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 28cdc3b54ce4..b4ba02824200 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -149,7 +149,7 @@ void Timer::updateTimer() { crapulusSaysSpludOut(); break; case kProcDawnDelay: - _vm->dawn(); + _vm->fadeIn(); break; case kProcBuyDrinks: buyDrinks(); From e7df8b60e15b4106a54eaff138316b6568d56517 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Oct 2013 20:46:22 -0400 Subject: [PATCH 1256/1332] TSAGE: Disable saving in R2R when actors have been copied to the background --- engines/tsage/core.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 488eacceabdd..5261081caa79 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2814,6 +2814,12 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum, void BackgroundSceneObject::copySceneToBackground() { GLOBALS._sceneManager._scene->_backSurface.copyFrom(g_globals->gfxManager().getSurface(), 0, 0); + + // WORKAROUND: Since savegames don't store the active screen data, once we copy the + // foreground objects to the background, we have to prevent the scene being saved. + // I do this the easiest way, by using the existing animationCtr global + if (g_vm->getGameID() == GType_Ringworld2) + ++R2_GLOBALS._animationCtr; } /*--------------------------------------------------------------------------*/ From 22af86340e8462ab8cca73f502684852a9166cfb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Oct 2013 22:49:14 -0400 Subject: [PATCH 1257/1332] TSAGE: Cleaner implementation of saving disable code --- engines/tsage/core.cpp | 3 +-- engines/tsage/ringworld2/ringworld2_logic.cpp | 9 ++++++--- engines/tsage/ringworld2/ringworld2_logic.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 5261081caa79..bd7610c9f96f 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2817,9 +2817,8 @@ void BackgroundSceneObject::copySceneToBackground() { // WORKAROUND: Since savegames don't store the active screen data, once we copy the // foreground objects to the background, we have to prevent the scene being saved. - // I do this the easiest way, by using the existing animationCtr global if (g_vm->getGameID() == GType_Ringworld2) - ++R2_GLOBALS._animationCtr; + ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->_preventSaving = true; } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index fc06b204cd93..bd908504adb9 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -321,9 +321,11 @@ bool Ringworld2Game::canLoadGameStateCurrently() { * Returns true if it is currently okay to save the game */ bool Ringworld2Game::canSaveGameStateCurrently() { - // Don't allow a game to be saved if a dialog is active or if an animation - // is playing - return g_globals->_gfxManagers.size() == 1 && R2_GLOBALS._animationCtr == 0; + // Don't allow a game to be saved if a dialog is active, or if an animation + // is playing, or if an active scene prevents it + return g_globals->_gfxManagers.size() == 1 && R2_GLOBALS._animationCtr == 0 && + (!R2_GLOBALS._sceneManager._scene || + !((SceneExt *)R2_GLOBALS._sceneManager._scene)->_preventSaving); } /*--------------------------------------------------------------------------*/ @@ -338,6 +340,7 @@ SceneExt::SceneExt(): Scene() { _savedPlayerEnabled = false; _savedUiEnabled = false; _savedCanWalk = false; + _preventSaving = false; // WORKAROUND: In the original, playing animations don't reset the global _animationCtr // counter as scene changes unless the playing animation explicitly finishes. For now, diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index aeac2fdd6a17..5c8af8d8842f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -85,6 +85,7 @@ class SceneExt: public Scene { bool _savedPlayerEnabled; bool _savedUiEnabled; bool _savedCanWalk; + bool _preventSaving; Visage _cursorVisage; SynchronizedList _sceneAreas; From 72e55fab7001166dfe04d000171435d6eb948e85 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Oct 2013 07:54:42 +0200 Subject: [PATCH 1258/1332] AVALANCHE: Implement Bleep(), improve one comment --- engines/avalanche/menu.cpp | 2 +- engines/avalanche/parser.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index c799ef076181..4768f3e79d15 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -333,7 +333,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo } void Menu::bleep() { - warning("STUB: Menu::bleep()"); + _vm->_sound->playNote(177, 7); } void Menu::parseKey(char r, char re) { diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index ca97d4d1e865..b9b179506bc7 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -2006,7 +2006,7 @@ void Parser::doThat() { if (_thing == kObjectBell) { _vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_bellsAreRinging) & (_vm->getFlag('B'))) - // \? are used to avoid that ??! is parsed as a trigraph + // '\?' are used to avoid that '??!' is parsed as a trigraph _vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)"); } else _vm->_dialogs->displayText(kWhat); From f76284a95eb84f1a44da4c902c1e0ef802f15866 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Oct 2013 08:01:43 +0200 Subject: [PATCH 1259/1332] AVALANCHE: Polish 'File' menu --- engines/avalanche/menu.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 4768f3e79d15..d40397f5a36f 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -553,17 +553,15 @@ void Menu::runMenuFile() { _vm->_parser->_realWords[1].clear(); _vm->callVerb(kVerbCodeLoad); break; + // Case 2 is 'Save', Case 3 is 'Save As'. Both triggers ScummVM save screen. case 2: + case 3: if (!_vm->_parser->_realWords[1].empty()) _vm->_parser->_realWords[1].clear(); _vm->callVerb(kVerbCodeSave); break; - case 3: - //_vm->_basher->filename_edit(); - warning("STUB: Dropdown::runMenuFile()"); - break; case 4: - //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! + // Command Prompt, disabled break; case 5: _vm->callVerb(kVerbCodeQuit); From d202d898da38de1b56f4784c24398ffeb3351e09 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Oct 2013 08:06:16 +0200 Subject: [PATCH 1260/1332] AVALANCHE: Remove code duplicate in runMenuWith() --- engines/avalanche/menu.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index d40397f5a36f..1f7006a42466 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -628,21 +628,15 @@ void Menu::runMenuWith() { } else { switch (_verbStr[_activeMenuItem._choiceNum]) { case 100: // Beer - _vm->_parser->_thing = 100; + case 102: // Whisky + case 103: // Cider + _vm->_parser->_thing = _verbStr[_activeMenuItem._choiceNum]; _vm->callVerb(kVerbCodeBuy); return; case 101: // Wine _vm->_parser->_thing = 50; _vm->callVerb(kVerbCodeBuy); return; - case 102: // Whisky - _vm->_parser->_thing = 102; - _vm->callVerb(kVerbCodeBuy); - return; - case 103: // Cider - _vm->_parser->_thing = 103; - _vm->callVerb(kVerbCodeBuy); - return; case 104: // Mead _vm->_parser->_thing = 107; _vm->callVerb(kVerbCodeBuy); @@ -833,6 +827,6 @@ void Menu::init() { } void Menu::resetVariables() { - _lastPerson = kPeoplePardon; // = Pardon? + _lastPerson = kPeoplePardon; } } // End of namespace Avalanche. From aba6b02b5b2bf7cb822e2d35023d2927622d007f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Oct 2013 08:10:43 +0200 Subject: [PATCH 1261/1332] AVALANCHE: Fix two blocking loops not checking shouldQuit() --- engines/avalanche/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 1f7006a42466..f722b128cce9 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -676,7 +676,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _menuBar.chooseMenuItem(cursorPos.x); do _vm->updateEvents(); - while (_vm->_holdLeftMouse); + while (_vm->_holdLeftMouse && !_vm->shouldQuit()); while (!_vm->shouldQuit()) { do { @@ -698,7 +698,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it... _activeMenuItem.lightUp(cursorPos); _vm->_graphics->refreshScreen(); - } while (!_vm->_holdLeftMouse); + } while (!_vm->_holdLeftMouse && !_vm->shouldQuit()); if (_vm->_holdLeftMouse) { if (cursorPos.y > 21) { From ccebfc78fdb1b9e330897e0119cd87b59344154a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Oct 2013 08:16:38 +0200 Subject: [PATCH 1262/1332] AVALANCHE: Remove useless check and move some comments in Sequence --- engines/avalanche/sequence.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index a9de50f49b6c..10fa7f0a0050 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -70,9 +70,12 @@ void Sequence::startTimer() { } void Sequence::startTimerImmobilized() { - _vm->_userMovesAvvy = false; // They can't move. - _vm->_animation->stopWalking(); // And they're not moving now. - startTimer(); // Apart from that, it's the same thing. + // They can't move. + _vm->_userMovesAvvy = false; + // And they're not moving now. + _vm->_animation->stopWalking(); + // Apart from that, it's the same thing. + startTimer(); } void Sequence::shoveLeft() { @@ -86,23 +89,25 @@ void Sequence::callSequencer() { switch (curSeq) { case 0: - return; // No more routines. + // No more routines. + return; break; - case kNowFlip: // Flip room. + case kNowFlip: + // Flip room. _vm->_userMovesAvvy = true; _vm->flipRoom(_flipToWhere, _flipToPed); - // CHECKME: Always true? - if (curSeq == kNowFlip) - shoveLeft(); + shoveLeft(); break; } - if (curSeq <= 176) { // Show a frame. + if (curSeq <= 176) { + // Show a frame. _vm->_background->draw(-1, -1, curSeq - 1); shoveLeft(); } - startTimer(); // Make sure this PROC gets called again. + // Make sure this PROC gets called again. + startTimer(); } void Sequence::startHallSeq(Room whither, byte ped) { @@ -164,8 +169,10 @@ void Sequence::startMusicRoomSeq2(Room whither, byte ped) { void Sequence::startGeidaLuteSeq() { init(5); - add(6); // He falls asleep... - startTimer(); // Not really closing, but we're using the same procedure. + // He falls asleep... + add(6); + // Not really closing, but we're using the same procedure. + startTimer(); } void Sequence::startMusicRoomSeq() { From 46c5bfa50889eacbf88620fbccf5c3b435565875 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Oct 2013 01:52:43 +0200 Subject: [PATCH 1263/1332] AVALANCHE: Move some variables around --- engines/avalanche/animation.cpp | 18 ++++++++- engines/avalanche/animation.h | 1 + engines/avalanche/avalanche.h | 2 - engines/avalanche/avalot.cpp | 36 ------------------ engines/avalanche/dialogs.cpp | 67 ++++++++++++++++++++++++++++++++- engines/avalanche/dialogs.h | 3 ++ engines/avalanche/parser.cpp | 60 +++++------------------------ engines/avalanche/parser.h | 2 - 8 files changed, 95 insertions(+), 94 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 08fe32085f95..e87341509a75 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -32,6 +32,20 @@ namespace Avalanche { +// Art gallery at 2,1; notice about this at 2,2. +const int32 Animation::kCatacombMap[8][8] = { + // Geida's room + // 1 2 3 4 5 6 7 8 + {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, + {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, + {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, + {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette + {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, + {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, + {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here + {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} +}; + /** * Loads & sets up the sprite. */ @@ -456,7 +470,7 @@ void Animation::catacombMove(byte ped) { if (!_vm->_enterCatacombsFromLustiesRoom) _vm->loadRoom(29); - int32 here = _vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; + int32 here = kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1]; switch (here & 0xf) { // West. case 0: // no connection (wall) @@ -842,7 +856,7 @@ void Animation::callSpecial(uint16 which) { catacombMove(4); if (_vm->_room != kRoomCatacombs) return; - switch ((_vm->kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1] & 0xf00) >> 8) { + switch ((kCatacombMap[_vm->_catacombY - 1][_vm->_catacombX - 1] & 0xf00) >> 8) { case 0x1: appearPed(0, 11); break; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 2669c999aa36..ad7064503616 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -135,6 +135,7 @@ class Animation { private: Direction _direction; // The direction Avvy is currently facing. Direction _oldDirection; + static const int32 kCatacombMap[8][8]; bool _arrowTriggered; // And has the arrow been triggered? bool _mustExclaim; byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke. diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index e9d2b1e1163d..7141d3cfa47e 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -167,9 +167,7 @@ class AvalancheEngine : public Engine { // These following static constants should be included in CFG when it's written. static const int16 kWalk = 3; static const int16 kRun = 5; - static const int32 kCatacombMap[8][8]; static const char kSpludwicksOrder[3]; - static const QuasipedType kQuasipeds[16]; static const uint16 kNotes[12]; static const TuneType kTune; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2da1aeaa2d14..f74239c164be 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -36,19 +36,6 @@ namespace Avalanche { -// Art gallery at 2,1; notice about this at 2,2. -const int32 AvalancheEngine::kCatacombMap[8][8] = { - // Geida's room - // 1 2 3 4 5 6 7 8 - {0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200}, - {0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210}, - {0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f}, - {0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette - {0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260}, - {0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f}, - {0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here - {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} -}; // vv Stairs trap. /* Explanation: $NSEW. @@ -88,29 +75,6 @@ const int32 AvalancheEngine::kCatacombMap[8][8] = { F = straight-through corridor. */ const char AvalancheEngine::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; - -// A quasiped defines how people who aren't sprites talk. For example, quasiped -// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. -const QuasipedType AvalancheEngine::kQuasipeds[16] = { -//_whichPed, _foregroundColor, _room, _backgroundColor, _who - {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). - {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). - {2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). - {2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). - {2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). - {5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) - {1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). - {1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). - {1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). - {2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). - {1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). - {1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). - {2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). - {3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19). - {4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47). - {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). -}; - const uint16 AvalancheEngine::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; const TuneType AvalancheEngine::kTune = { kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index e126e5ec80de..97c7869804d8 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -34,6 +34,28 @@ namespace Avalanche { +// A quasiped defines how people who aren't sprites talk. For example, quasiped +// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. +const QuasipedType Dialogs::kQuasipeds[16] = { + //_whichPed, _foregroundColor, _room, _backgroundColor, _who + {1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19). + {2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19). + {2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1). + {2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23). + {2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50). + {5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42) + {1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16). + {1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7). + {1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47). + {2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47). + {1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23). + {1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27). + {2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27). + {3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19). + {4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47). + {1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51). +}; + Dialogs::Dialogs(AvalancheEngine *vm) { _vm = vm; _noError = true; @@ -676,11 +698,11 @@ void Dialogs::callDialogDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - PedType *quasiPed = &_vm->_peds[_vm->kQuasipeds[_param - 10]._whichPed]; + PedType *quasiPed = &_vm->_peds[kQuasipeds[_param - 10]._whichPed]; _vm->_talkX = quasiPed->_x; _vm->_talkY = quasiPed->_y; // Position. - _vm->_graphics->setDialogColor(_vm->kQuasipeds[_param - 10]._backgroundColor, _vm->kQuasipeds[_param - 10]._textColor); + _vm->_graphics->setDialogColor(kQuasipeds[_param - 10]._backgroundColor, kQuasipeds[_param - 10]._textColor); } else { _vm->errorLed(); // Not valid. setBubbleStateNatural(); @@ -1095,4 +1117,45 @@ void Dialogs::sayIt(Common::String str) { Common::String tmpStr = Common::String::format("%c1%s.%c%c2", kControlRegister, x.c_str(), kControlSpeechBubble, kControlRegister); displayText(tmpStr); } + +Common::String Dialogs::personSpeaks() { + if ((_vm->_parser->_person == kPeoplePardon) || (_vm->_parser->_person == kPeopleNone)) { + if ((_vm->_him == kPeoplePardon) || (_vm->getRoom(_vm->_him) != _vm->_room)) + _vm->_parser->_person = _vm->_her; + else + _vm->_parser->_person = _vm->_him; + } + + if (_vm->getRoom(_vm->_parser->_person) != _vm->_room) { + return Common::String::format("%c1", kControlRegister); // Avvy himself! + } + + bool found = false; // The _person we're looking for's code is in _person. + Common::String tmpStr; + + for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _vm->_parser->_person)) { + tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); + found = true; + } + } + + if (found) + return tmpStr; + + for (int i = 0; i < 16; i++) { + if ((kQuasipeds[i]._who == _vm->_parser->_person) && (kQuasipeds[i]._room == _vm->_room)) + tmpStr += Common::String::format("%c%c", kControlRegister, 'A' + i); + } + + return tmpStr; +} + +void Dialogs::heyThanks(byte thing) { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble); + displayText(tmpStr); + _vm->_objects[thing] = false; +} + } // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 7263c47075bb..10266376443c 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -54,6 +54,8 @@ class Dialogs { void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); void talkTo(byte whom); void sayIt(Common::String str); + Common::String personSpeaks(); + void heyThanks(byte thing); private: AvalancheEngine *_vm; @@ -64,6 +66,7 @@ class Dialogs { }; static const int16 kHalfIconWidth = 19; + static const QuasipedType kQuasipeds[16]; Common::String _scroll[15]; Common::Point _dodgeCoord; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index b9b179506bc7..aa1324ede9f9 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1578,46 +1578,6 @@ void Parser::winSequence() { _vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning); } -Common::String Parser::personSpeaks() { - if ((_person == kPeoplePardon) || (_person == kPeopleNone)) { - if ((_vm->_him == kPeoplePardon) || (_vm->getRoom(_vm->_him) != _vm->_room)) - _person = _vm->_her; - else - _person = _vm->_him; - } - - if (_vm->getRoom(_person) != _vm->_room) { - return Common::String::format("%c1", kControlRegister); // Avvy himself! - } - - bool found = false; // The _person we're looking for's code is in _person. - Common::String tmpStr; - - for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { - tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); - found = true; - } - } - - if (found) - return tmpStr; - - for (int i = 0; i < 16; i++) { - if ((_vm->kQuasipeds[i]._who == _person) && (_vm->kQuasipeds[i]._room == _vm->_room)) - tmpStr += Common::String::format("%c%c", kControlRegister, 'A' + i); - } - - return tmpStr; -} - -void Parser::heyThanks() { - Common::String tmpStr = personSpeaks(); - tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - _vm->_objects[_thing - 1] = false; -} - /** * @remarks Originally called 'do_that' */ @@ -1734,17 +1694,17 @@ void Parser::doThat() { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); _vm->_objects[kObjectWine - 1] = false; } else - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); break; case kPeopleCwytalot: if ((_thing == kObjectCrossbow) || (_thing == kObjectBolt)) _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); break; case kPeopleSpludwick: if (giveToSpludwick()) - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); break; case kPeopleIbythneth: if (_thing == kObjectBadge) { @@ -1756,7 +1716,7 @@ void Parser::doThat() { _vm->_background->draw(-1, -1, 7); _vm->_background->draw(-1, -1, 8); } else - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); break; case kPeopleAyles: if (_vm->_aylesIsAwake) { @@ -1768,7 +1728,7 @@ void Parser::doThat() { _vm->refreshObjectList(); _vm->incScore(2); } else - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); } else _vm->_dialogs->displayText("But he's asleep!"); break; @@ -1785,7 +1745,7 @@ void Parser::doThat() { giveGeidaTheLute(); break; default: - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); } break; case kPeopleArkata: @@ -1797,11 +1757,11 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! break; default: - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); } break; default: - heyThanks(); + _vm->_dialogs->heyThanks(_thing - 1); } } } @@ -2365,13 +2325,13 @@ void Parser::doThat() { _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; case kVerbCodeHello: { - Common::String tmpStr = personSpeaks(); + Common::String tmpStr = _vm->_dialogs->personSpeaks(); tmpStr += Common::String::format("Hello.%c", kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } break; case kVerbCodeThanks: { - Common::String tmpStr = personSpeaks(); + Common::String tmpStr = _vm->_dialogs->personSpeaks(); tmpStr += Common::String::format("That's OK.%c", kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); } diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 892b81e9a3f8..db22be261666 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -148,8 +148,6 @@ class Parser { void giveGeidaTheLute(); void playHarp(); void winSequence(); - Common::String personSpeaks(); - void heyThanks(); void wipeText(); }; From 8ccf02dcaf7ed057d6debfd4c246626155a90a0f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 12 Oct 2013 09:16:58 +0300 Subject: [PATCH 1264/1332] LASTEXPRESS: Redo d71b48 and use variable instead of commenting it --- engines/lastexpress/game/inventory.cpp | 4 +++- engines/lastexpress/game/inventory.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp index 8edef90da314..2f1b0a8e7651 100644 --- a/engines/lastexpress/game/inventory.cpp +++ b/engines/lastexpress/game/inventory.cpp @@ -44,7 +44,7 @@ namespace LastExpress { Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0), - /*_showingHourGlass(false), */ _blinkingDirection(1), _blinkingBrightness(0), + _showingHourGlass(false), _blinkingDirection(1), _blinkingBrightness(0), _useMagnifier(false), _portraitHighlighted(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) { //_inventoryRect = Common::Rect(0, 0, 32, 32); @@ -52,6 +52,8 @@ Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem _selectedItemRect = Common::Rect(44, 0, 76, 32); init(); + + debug(9, "_showingHourGlass: %d", _showingHourGlass); } Inventory::~Inventory() { diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h index 9b82ef031df2..b1019a43c6af 100644 --- a/engines/lastexpress/game/inventory.h +++ b/engines/lastexpress/game/inventory.h @@ -140,7 +140,7 @@ class Inventory : Common::Serializable, public EventHandler { uint32 _itemsShown; - //bool _showingHourGlass; + bool _showingHourGlass; int16 _blinkingDirection; uint16 _blinkingBrightness; From 0deb94c1b8a19c790cbdda3790190e7ef25c4dc6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Oct 2013 12:36:06 +0200 Subject: [PATCH 1265/1332] AVALANCHE: Move some parser functions to Dialogs. Improve some comments --- engines/avalanche/dialogs.cpp | 32 +++++- engines/avalanche/dialogs.h | 6 +- engines/avalanche/parser.cpp | 186 ++++++++++++++++++++-------------- engines/avalanche/parser.h | 1 - 4 files changed, 146 insertions(+), 79 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 97c7869804d8..e9cc1c7f748b 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1151,11 +1151,41 @@ Common::String Dialogs::personSpeaks() { return tmpStr; } -void Dialogs::heyThanks(byte thing) { +/** + * Display a message when (uselessly) giving an object away + * @remarks Originally called 'heythanks' + */ +void Dialogs::sayThanks(byte thing) { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble); displayText(tmpStr); _vm->_objects[thing] = false; } +/** + * Display a 'Hello' message + */ +void Dialogs::sayHello() { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("Hello.%c", kControlSpeechBubble); + displayText(tmpStr); +} + +/** + * Display a 'OK' message + */ +void Dialogs::sayOK() { + Common::String tmpStr = personSpeaks(); + tmpStr += Common::String::format("That's OK.%c", kControlSpeechBubble); + displayText(tmpStr); +} + +/** + * Display a 'Silly' message + * @remarks Originally called 'silly' + */ +void Dialogs::saySilly() { + displayText("Don't be silly!"); +} + } // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 10266376443c..5d105245dd1d 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -55,8 +55,10 @@ class Dialogs { void talkTo(byte whom); void sayIt(Common::String str); Common::String personSpeaks(); - void heyThanks(byte thing); - + void sayThanks(byte thing); + void sayHello(); + void sayOK(); + void saySilly(); private: AvalancheEngine *_vm; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index aa1324ede9f9..060d31798c25 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -933,30 +933,38 @@ void Parser::examineObject() { _vm->thinkAbout(_thing, AvalancheEngine::kThing); switch (_thing) { case kObjectWine : - switch (_vm->_wineState) {// 4 is perfect wine. 0 is not holding the wine. + // 4 is perfect wine. 0 is not holding the wine. + switch (_vm->_wineState) { case 1: - _vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll + // Normal examine wine scroll + _vm->_dialogs->displayScrollChain('t', 1); break; case 2: - _vm->_dialogs->displayScrollChain('d', 6); // Bad wine + // Bad wine + _vm->_dialogs->displayScrollChain('d', 6); break; case 3: - _vm->_dialogs->displayScrollChain('d', 7); // Vinegar + // Vinegar + _vm->_dialogs->displayScrollChain('d', 7); break; } break; case kObjectOnion: if (_vm->_rottenOnion) - _vm->_dialogs->displayScrollChain('q', 21); // Yucky onion + // Yucky onion + _vm->_dialogs->displayScrollChain('q', 21); else - _vm->_dialogs->displayScrollChain('t', 18); // Normal onion + // Normal onion + _vm->_dialogs->displayScrollChain('t', 18); break; default: - _vm->_dialogs->displayScrollChain('t', _thing); // Ordinarily + // Ordinarily + _vm->_dialogs->displayScrollChain('t', _thing); } } -bool Parser::isPersonHere() { // Person equivalent of "holding". +bool Parser::isPersonHere() { + // Person equivalent of "isHolding". if ((_person == kPeoplePardon) || (_person == kPeopleNone) || (_vm->getRoom(_person) == _vm->_room)) return true; else { @@ -978,9 +986,11 @@ void Parser::exampers() { byte newPerson = _person - 149; if ((_person == kPeopleDogfood) && _vm->_wonNim) - _vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" + // "I'm Not Playing!" + _vm->_dialogs->displayScrollChain('Q', 8); else if ((_person == kPeopleDuLustie) && _vm->_lustieIsAsleep) - _vm->_dialogs->displayScrollChain('Q', 65); // He's asleep. + // He's asleep. + _vm->_dialogs->displayScrollChain('Q', 65); else _vm->_dialogs->displayScrollChain('p', newPerson); @@ -997,14 +1007,16 @@ void Parser::exampers() { * @remarks Originally called 'holding' */ bool Parser::isHolding() { - if ((51 <= _thing) && (_thing <= 99)) // Also. + // Also object + if ((51 <= _thing) && (_thing <= 99)) return true; bool holdingResult = false; if (_thing > 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory. + else if (!_vm->_objects[_thing - 1]) + // Verbs that need "_thing" to be in the inventory. _vm->_dialogs->displayText("You're not holding it, Avvy."); else holdingResult = true; @@ -1036,9 +1048,11 @@ void Parser::examine() { if ((_person == kPeoplePardon) && (_thing != kPardon)) { if (isHolding()) { // Remember: it's been slipped! Ie subtract 49. - if ((1 <= _thing) && (_thing <= 49)) // Standard object + if ((1 <= _thing) && (_thing <= 49)) + // Standard object examineObject(); - else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing + else if ((50 <= _thing) && (_thing <= 100)) { + // Also _thing openBox(true); _vm->_dialogs->displayText(*_vm->_also[_thing - 50][1]); openBox(false); @@ -1047,7 +1061,8 @@ void Parser::examine() { } else if (_person != kPardon) exampers(); else - _vm->_dialogs->displayText("It's just as it looks on the picture."); // Don't know: guess. + // Don't know: guess. + _vm->_dialogs->displayText("It's just as it looks on the picture."); } void Parser::inventory() { @@ -1078,10 +1093,14 @@ void Parser::inventory() { _vm->_dialogs->displayText(tmpStr); } -void Parser::swallow() { // Eat something. +/** + * Eat something. + */ +void Parser::swallow() { switch (_thing) { case kObjectWine: - switch (_vm->_wineState) { // 4 is perfect + // _wineState == 4 for perfect wine + switch (_vm->_wineState) { case 1: if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('D', 6); @@ -1096,8 +1115,9 @@ void Parser::swallow() { // Eat something. break; case 2: case 3: + // You can't drink it! _vm->_dialogs->displayScrollChain('d', 8); - break; // You can't drink it! + break; } break; case kObjectPotion: @@ -1134,26 +1154,30 @@ void Parser::swallow() { // Eat something. } void Parser::peopleInRoom() { - byte numPeople = 0; // Number of people in the room. - + // First compute the number of people in the room. + byte numPeople = 0; for (int i = 151; i < 179; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->getRoom((People)i) == _vm->_room) numPeople++; } - if (numPeople == 0) // If nobody's here, we can cut out straight away. + // If nobody's here, we can cut out straight away. + if (numPeople == 0) return; Common::String tmpStr; - byte actPerson = 0; // Actually listed people. + byte actPerson = 0; for (int i = 151; i < 179; i++) { if (_vm->getRoom((People)i) == _vm->_room) { actPerson++; - if (actPerson == 1) // First on the list. + if (actPerson == 1) + // Display first name on the list. tmpStr = _vm->getName((People)i); - else if (actPerson < numPeople) // The middle... + else if (actPerson < numPeople) + // Display one the names in the middle of the list tmpStr += ", " + _vm->getName((People)i); - else // The end. + else + // Display the last name of the list tmpStr += " and " + _vm->getName((People)i); } } @@ -1163,7 +1187,7 @@ void Parser::peopleInRoom() { else tmpStr += " are"; - _vm->_dialogs->displayText(tmpStr + " here."); // End and display it. + _vm->_dialogs->displayText(tmpStr + " here."); } void Parser::lookAround() { @@ -1192,13 +1216,16 @@ void Parser::lookAround() { case kRoomCatacombs: switch (_vm->_catacombY * 256 + _vm->_catacombX) { case 258 : - _vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery. + // Inside art gallery. + _vm->_dialogs->displayScrollChain('q', 80); break; case 514 : - _vm->_dialogs->displayScrollChain('q', 81); // Outside ditto. + // Outside ditto. + _vm->_dialogs->displayScrollChain('q', 81); break; case 260 : - _vm->_dialogs->displayScrollChain('q', 82); // Outside Geida's room. + // Outside Geida's room. + _vm->_dialogs->displayScrollChain('q', 82); break; } break; @@ -1230,7 +1257,8 @@ void Parser::openDoor() { } if ((!_vm->_userMovesAvvy) && (_vm->_room != kRoomLusties)) - return; // No doors can open if you can't move Avvy. + // No doors can open if you can't move Avvy. + return; for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { @@ -1266,15 +1294,12 @@ void Parser::openDoor() { _vm->_dialogs->displayText("Door? What door?"); } -void Parser::silly() { - _vm->_dialogs->displayText("Don't be silly!"); -} - void Parser::putProc() { if (!isHolding()) return; - _thing2 -= 49; // Slip the second object. + // Slip the second object. + _thing2 -= 49; char temp = _thing; _thing = _thing2; if (!isHolding()) @@ -1287,23 +1312,26 @@ void Parser::putProc() { if (_thing == kObjectOnion) { if (_vm->_rottenOnion) _vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!"); - else { // Put onion into wine? + else { + // Put onion into wine? if (_vm->_wineState != 3) { Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); - } else { // Put onion into vinegar! Yes! + } else { + // Put onion into vinegar! Yes! _vm->_onionInVinegar = true; _vm->incScore(7); _vm->_dialogs->displayScrollChain('u', 9); } } } else - silly(); + _vm->_dialogs->saySilly(); break; case 54: - if (_vm->_room == kRoomYours) { // Put something into the box. + if (_vm->_room == kRoomYours) { + // Put something into the box. if (_vm->_boxContent != kNothing) _vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first."); else { @@ -1320,28 +1348,31 @@ void Parser::putProc() { case kObjectOnion: _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; - default: // Put the object into the box... + default: + // Put the object into the box... if (_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { - openBox(true); // Open box. + // Open box. + openBox(true); _vm->_boxContent = _thing; _vm->_objects[_thing - 1] = false; _vm->refreshObjectList(); _vm->_dialogs->displayText("OK, it's in the box."); - openBox(false); // Shut box. + // Shut box. + openBox(false); } } } } else - silly(); + _vm->_dialogs->saySilly(); break; default: - silly(); + _vm->_dialogs->saySilly(); } } @@ -1361,7 +1392,8 @@ void Parser::notInOrder() { * @remarks Originally called 'go_to_cauldron' */ void Parser::goToCauldron() { - _vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs. + // Stops Geida_Procs. + _vm->_animation->_sprites[1]._callEachStepFl = false; _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); _vm->_animation->_sprites[1].walkTo(1); } @@ -1409,14 +1441,14 @@ bool Parser::giveToSpludwick() { default: return true; } - return false; } void Parser::drink() { _alcoholLevel++; if (_alcoholLevel == 5) { - _vm->_objects[kObjectKey - 1] = true; // Get the key. + // Get the key. + _vm->_objects[kObjectKey - 1] = true; _vm->_teetotal = true; _vm->_avvyIsAwake = false; _vm->_avvyInBed = true; @@ -1429,11 +1461,13 @@ void Parser::drink() { } void Parser::cardiffClimbing() { - if (_vm->_standingOnDais) { // Clamber up. + if (_vm->_standingOnDais) { + // Clamber up. _vm->_dialogs->displayText("You climb down, back onto the floor."); _vm->_standingOnDais = false; _vm->_animation->appearPed(0, 2); - } else if (_vm->_animation->inField(0)) { // Clamber down + } else if (_vm->_animation->inField(0)) { + // Clamber down _vm->_dialogs->displayText("You clamber up onto the dais."); _vm->_standingOnDais = true; _vm->_animation->appearPed(0, 1); @@ -1447,8 +1481,10 @@ void Parser::already() { void Parser::standUp() { switch (_vm->_room) { - case kRoomYours: // Avvy isn't asleep. - if (_vm->_avvyIsAwake && _vm->_avvyInBed) { // But he's in bed. + case kRoomYours: + // Avvy isn't asleep. + if (_vm->_avvyIsAwake && _vm->_avvyInBed) { + // But he's in bed. if (_vm->_teetotal) { _vm->_dialogs->displayScrollChain('d', 12); _vm->_graphics->setBackgroundColor(kColorBlack); @@ -1458,7 +1494,8 @@ void Parser::standUp() { _vm->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->setDirection(kDirLeft); - _vm->_background->draw(-1, -1, 3); // Picture of empty pillow. + // Display a picture of empty pillow in the background. + _vm->_background->draw(-1, -1, 3); _vm->incScore(1); _vm->_avvyInBed = false; _vm->_timer->loseTimer(Timer::kReasonArkataShouts); @@ -1472,11 +1509,16 @@ void Parser::standUp() { case kRoomNottsPub: if (_vm->_sittingInPub) { - _vm->_background->draw(-1, -1, 3); // Not sitting down. - _vm->_animation->_sprites[0]._visible = true; // But standing up. - _vm->_animation->appearPed(0, 3); // And walking away. - _vm->_sittingInPub = false; // Really not sitting down. - _vm->_userMovesAvvy = true; // And ambulant. + // Not sitting down. + _vm->_background->draw(-1, -1, 3); + // But standing up. + _vm->_animation->_sprites[0]._visible = true; + // And walking away. + _vm->_animation->appearPed(0, 3); + // Really not sitting down. + _vm->_sittingInPub = false; + // And ambulant. + _vm->_userMovesAvvy = true; } else already(); break; @@ -1694,17 +1736,17 @@ void Parser::doThat() { _vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); _vm->_objects[kObjectWine - 1] = false; } else - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); break; case kPeopleCwytalot: if ((_thing == kObjectCrossbow) || (_thing == kObjectBolt)) _vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!"); else - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); break; case kPeopleSpludwick: if (giveToSpludwick()) - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); break; case kPeopleIbythneth: if (_thing == kObjectBadge) { @@ -1716,7 +1758,7 @@ void Parser::doThat() { _vm->_background->draw(-1, -1, 7); _vm->_background->draw(-1, -1, 8); } else - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); break; case kPeopleAyles: if (_vm->_aylesIsAwake) { @@ -1728,7 +1770,7 @@ void Parser::doThat() { _vm->refreshObjectList(); _vm->incScore(2); } else - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); } else _vm->_dialogs->displayText("But he's asleep!"); break; @@ -1745,7 +1787,7 @@ void Parser::doThat() { giveGeidaTheLute(); break; default: - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); } break; case kPeopleArkata: @@ -1757,11 +1799,11 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! break; default: - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); } break; default: - _vm->_dialogs->heyThanks(_thing - 1); + _vm->_dialogs->sayThanks(_thing - 1); } } } @@ -2324,17 +2366,11 @@ void Parser::doThat() { case kVerbCodePardon: _vm->_dialogs->displayText("Hey, a verb would be helpful!"); break; - case kVerbCodeHello: { - Common::String tmpStr = _vm->_dialogs->personSpeaks(); - tmpStr += Common::String::format("Hello.%c", kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - } + case kVerbCodeHello: + _vm->_dialogs->sayHello(); break; - case kVerbCodeThanks: { - Common::String tmpStr = _vm->_dialogs->personSpeaks(); - tmpStr += Common::String::format("That's OK.%c", kControlSpeechBubble); - _vm->_dialogs->displayText(tmpStr); - } + case kVerbCodeThanks: + _vm->_dialogs->sayOK(); break; default: Common::String tmpStr = Common::String::format("%cUnhandled verb: %d", kControlBell, _verb); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index db22be261666..261e5ecefea5 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -136,7 +136,6 @@ class Parser { void inventory(); void swallow(); void peopleInRoom(); // This lists the other people in the room. - void silly(); void putProc(); // Called when you call kVerbCodeput. void notInOrder(); void goToCauldron(); From 1a40c8c5d23f92beabbc18dc841e3d3198be8f2c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Oct 2013 14:44:03 +0200 Subject: [PATCH 1266/1332] AVALANCHE: Move/Improve some comments in parser --- engines/avalanche/parser.cpp | 130 +++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 45 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 060d31798c25..36d03492f059 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1548,13 +1548,16 @@ void Parser::getProc(char thing) { case kRoomInsideCardiffCastle: switch (thing) { case kObjectPen: - if (_vm->_animation->inField(1)) { // Standing on the dais. + if (_vm->_animation->inField(1)) { + // Standing on the dais. if (_vm->_takenPen) _vm->_dialogs->displayText("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_background->draw(-1, -1, 3); // No pen there now. - _vm->_animation->callSpecial(3); // Zap! + // No pen there now. + _vm->_background->draw(-1, -1, 3); + // Zap! + _vm->_animation->callSpecial(3); _vm->_takenPen = true; _vm->_objects[kObjectPen - 1] = true; _vm->refreshObjectList(); @@ -1601,7 +1604,8 @@ void Parser::giveGeidaTheLute() { } _vm->_objects[kObjectLute - 1] = false; _vm->refreshObjectList(); - _vm->_dialogs->displayScrollChain('q', 64); // She plays it. + // She plays it. + _vm->_dialogs->displayScrollChain('q', 64); _vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); //_vm->_enid->backToBootstrap(4); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! @@ -1637,7 +1641,8 @@ void Parser::doThat() { return; if (_thing < 200) - _thing -= 49; // "Slip" + // "Slip" object + _thing -= 49; if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) @@ -1670,12 +1675,14 @@ void Parser::doThat() { } break; case kVerbCodeGet: - if (_thing != kPardon) { // Legitimate try to pick something up. + if (_thing != kPardon) { + // Legitimate try to pick something up. if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("You can't carry any more!"); else getProc(_thing); - } else { // Not... ditto. + } else { + // Not... ditto. if (_person != kPeoplePardon) _vm->_dialogs->displayText("You can't sweep folk off their feet!"); else @@ -1691,7 +1698,8 @@ void Parser::doThat() { break; case kVerbCodeTalk: if (_person == kPeoplePardon) { - if (_vm->_subjectNum == 99) { // They typed "say password". + if (_vm->_subjectNum == 99) { + // They typed "say password". Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } else if (((1 <= _vm->_subjectNum) && (_vm->_subjectNum <= 49)) || (_vm->_subjectNum == 253) || (_vm->_subjectNum == 249)) { @@ -1778,7 +1786,8 @@ void Parser::doThat() { switch (_thing) { case kObjectPotion: _vm->_objects[kObjectPotion - 1] = false; - _vm->_dialogs->displayScrollChain('u', 16); // She drinks it. + // She drinks it. + _vm->_dialogs->displayScrollChain('u', 16); _vm->incScore(2); _vm->_givenPotionToGeida = true; _vm->refreshObjectList(); @@ -1796,7 +1805,8 @@ void Parser::doThat() { if (_vm->_givenPotionToGeida) winSequence(); else - _vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! + // That Geida woman! + _vm->_dialogs->displayScrollChain('q', 77); break; default: _vm->_dialogs->sayThanks(_thing - 1); @@ -1807,7 +1817,8 @@ void Parser::doThat() { } } } - _vm->refreshObjectList(); // Just in case... + // Just in case... + _vm->refreshObjectList(); } break; @@ -1822,7 +1833,8 @@ void Parser::doThat() { int16 savegameId = dialog->runModalWithCurrentTarget(); delete dialog; - if (savegameId < 0) // dialog aborted + if (savegameId < 0) + // dialog aborted, nothing to load return; _vm->loadGame(savegameId); @@ -1834,14 +1846,13 @@ void Parser::doThat() { Common::String savegameDescription = dialog->getResultString(); delete dialog; - if (savegameId < 0) // dialog aborted + if (savegameId < 0) + // dialog aborted, nothing to save return; _vm->saveGame(savegameId, savegameDescription); } break; - // We don't handle these two because we use ScummVM's save/load system. - case kVerbCodePay: _vm->_dialogs->displayText("No money need change hands."); break; @@ -1851,7 +1862,7 @@ void Parser::doThat() { case kVerbCodeBreak: _vm->_dialogs->displayText("Vandalism is prohibited within this game!"); break; - case kVerbCodeQuit: // quit + case kVerbCodeQuit: if (!_polite) _vm->_dialogs->displayText("How about a `please\", Avvy?"); else { @@ -1897,7 +1908,8 @@ void Parser::doThat() { _vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!"); break; case kObjectClothes: - case kObjectHabit: { // Change this! + case kObjectHabit: { + // Change clothes! if (_wearing != kNothing) { if (_wearing == _thing) _vm->_dialogs->displayText("You're already wearing that."); @@ -1932,13 +1944,15 @@ void Parser::doThat() { break; case kVerbCodePlay: if (_thing == kPardon) { - switch (_vm->_room) { // They just typed "play"... - case kRoomArgentPub: // ...in the pub, => play Nim. + // They just typed "play"... + switch (_vm->_room) { + case kRoomArgentPub: + // ...in the pub, => play Nim. warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()"); // play_nim(); + // The following parts are copied from play_nim(). // The player automatically wins the game everytime he wins, until I implement the mini-game. - if (_vm->_wonNim) { // Already won the game. _vm->_dialogs->displayScrollChain('Q', 6); return; @@ -1953,15 +1967,20 @@ void Parser::doThat() { _playedNim++; // You won - strange! - _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! + + // You won! Give us a lute! + _vm->_dialogs->displayScrollChain('Q', 7); _vm->_objects[kObjectLute - 1] = true; _vm->refreshObjectList(); _vm->_wonNim = true; - _vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it. - _vm->incScore(7); // 7 points for winning! + // Show the settle with no lute on it. + _vm->_background->draw(-1, -1, 0); + // 7 points for winning! + _vm->incScore(7); if (_playedNim == 1) - _vm->incScore(3); // 3 points for playing your 1st game. + // 3 points for playing your 1st game. + _vm->incScore(3); // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", " \ @@ -2047,13 +2066,15 @@ void Parser::doThat() { if (_vm->_avariciusTalk > 0) _vm->_dialogs->displayScrollChain('q', 19); else { - if ((_vm->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! + if ((_vm->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { + // Avaricius appears! _vm->_dialogs->displayScrollChain('q', 17); if (_vm->getRoom(kPeopleSpludwick) == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->init(1, false, _vm->_animation); // Avaricius + // Avaricius + spr->init(1, false, _vm->_animation); _vm->_animation->appearPed(1, 3); spr->walkTo(4); spr->_callEachStepFl = true; @@ -2100,16 +2121,20 @@ void Parser::doThat() { else _vm->_dialogs->displayText(_vm->_listen); break; - case kVerbCodeBuy: // What are they trying to buy? + case kVerbCodeBuy: + // What are they trying to buy? switch (_vm->_room) { case kRoomArgentPub: - if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar. + // We're in a pub, and near the bar. + if (_vm->_animation->inField(5)) { switch (_thing) { case 51: case 53: case 54: - case 58: // Beer, whisky, cider or mead. - if (_vm->_malagauche == 177) { // Already getting us one. + case 58: + // Beer, whisky, cider or mead. + if (_vm->_malagauche == 177) { + // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } @@ -2134,10 +2159,13 @@ void Parser::doThat() { examine(); break; // We have a right one here - buy Pepsi??! case kObjectWine: - if (_vm->_objects[kObjectWine - 1]) // We've already got the wine! - _vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent! + if (_vm->_objects[kObjectWine - 1]) + // We've already got the wine! + // 1 bottle's shufishent! + _vm->_dialogs->displayScrollChain('D', 2); else { - if (_vm->_malagauche == 177) { // Already getting us one. + if (_vm->_malagauche == 177) { + // Already getting us one. _vm->_dialogs->displayScrollChain('D', 15); return; } @@ -2160,14 +2188,16 @@ void Parser::doThat() { break; } } else - _vm->_dialogs->displayScrollChain('D', 5); // Go to the bar! + // Go to the bar! + _vm->_dialogs->displayScrollChain('D', 5); break; case kRoomOutsideDucks: if (_vm->_animation->inField(5)) { if (_thing == kObjectOnion) { if (_vm->_objects[kObjectOnion - 1]) - _vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! + // Not planning to juggle with the things! + _vm->_dialogs->displayScrollChain('D', 10); else if (_vm->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { @@ -2177,11 +2207,13 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('D', 9); _vm->incScore(3); } - _vm->decreaseMoney(3); // It costs thruppence. + // It costs thruppence. + _vm->decreaseMoney(3); _vm->_objects[kObjectOnion - 1] = true; _vm->refreshObjectList(); _boughtOnion = true; - _vm->_rottenOnion = false; // It's OK when it leaves the stall! + // It's OK when it leaves the stall! + _vm->_rottenOnion = false; _vm->_onionInVinegar = false; } } else @@ -2191,10 +2223,12 @@ void Parser::doThat() { break; case kRoomNottsPub: - _vm->_dialogs->displayScrollChain('n', 15); // Can't sell to southerners. + // Can't sell to southerners. + _vm->_dialogs->displayScrollChain('n', 15); break; default: - _vm->_dialogs->displayScrollChain('D', 0); // Can't buy that. + // Can't buy that. + _vm->_dialogs->displayScrollChain('D', 0); } break; case kVerbCodeAttack: @@ -2227,7 +2261,8 @@ void Parser::doThat() { _vm->setRoom(kPeopleCwytalot, kRoomDummy); break; default: - _vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! + // Please try not to be so violent! + _vm->_dialogs->displayScrollChain('Q', 10); } } else _vm->_dialogs->displayScrollChain('Q', 10); @@ -2291,7 +2326,8 @@ void Parser::doThat() { _vm->_dialogs->displayScrollChain('U', 14); break; default: - _vm->_dialogs->displayScrollChain('U', 5); // You WHAT? + // You WHAT? + _vm->_dialogs->displayScrollChain('U', 5); } } else if ((kPeopleAvalot <= _person) && (_person < kPeopleArkata)) _vm->_dialogs->displayText("Hey, what kind of a weirdo are you??"); @@ -2300,7 +2336,8 @@ void Parser::doThat() { case kVerbCodeClimb: if (_vm->_room == kRoomInsideCardiffCastle) cardiffClimbing(); - else // In the wrong room! + else + // In the wrong room! _vm->_dialogs->displayText("Not with your head for heights, Avvy!"); break; case kVerbCodeJump: @@ -2321,7 +2358,8 @@ void Parser::doThat() { _vm->_avvyIsAwake = true; _vm->incScore(1); _vm->_avvyInBed = true; - _vm->_background->draw(-1, -1, 2); // Picture of Avvy, awake in bed. + // Picture of Avvy, awake in bed. + _vm->_background->draw(-1, -1, 2); if (_vm->_teetotal) _vm->_dialogs->displayScrollChain('d', 13); } else @@ -2346,10 +2384,12 @@ void Parser::doThat() { if (_vm->_sittingInPub) _vm->_dialogs->displayText("You're already sitting!"); else { - _vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down. + // Move Avvy to the place, and sit him down. + _vm->_animation->_sprites[0].walkTo(3); _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } - } else { // Default doodah. + } else { + // Default doodah. _vm->fadeOut(); _vm->fadeIn(); Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", kControlParagraph); From f1797a3820d5b2e6397892e580f856683d2d5f7f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Oct 2013 16:40:29 -0400 Subject: [PATCH 1267/1332] TSAGE: Fix for R2R canyon overhang reappearing after collapsed --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 10 +++++++++- engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index c99550978e9a..0932c70f04ce 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1097,7 +1097,6 @@ void Scene1100::signal() { // Really nothing break; case 13: - _leftImpacts.setup(1113, 2, 1); _trooper.postInit(); R2_GLOBALS._scrollFollower = &_trooper; @@ -1276,6 +1275,15 @@ void Scene1100::signal() { } void Scene1100::dispatch() { + // WORKAROUND: This fixes a problem with an overhang that gets blasted re-appearing + if (_animation._frame > 5 && _sceneMode == 13) { + _animation._endFrame = 9; + if (_animation._frame == 9) + // Use one of the scene's background scene objects to copy the scene to the background. + // This fixes the problem with the cliff overhang still appearing during the cutscene + _rightLandslide.copySceneToBackground(); + } + if ((g_globals->_sceneObjects->contains(&_laserShot)) && (_laserShot._visage == 1102) && (_laserShot._strip == 4) && (_laserShot._frame == 1) && (_laserShot._flags & OBJFLAG_HIDING)) { if (_paletteRefreshStatus == 1) { _paletteRefreshStatus = 2; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 956328aea9be..c0088236b4ed 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -111,7 +111,7 @@ class Scene1100 : public SceneExt { SceneActor _shotImpact4; SceneActor _shotImpact5; SceneActor _laserShot; - SceneActor _animation; + SceneActor _animation; // Used for cliff collapse and ship theft SceneActor _leftImpacts; SceneActor _runningGuy1; SceneActor _runningGuy2; From 61f59997bedc61acbe44a71491d0a0f38ff626f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Sun, 13 Oct 2013 09:15:59 +0200 Subject: [PATCH 1268/1332] TONY: Initialise _buf and _origBuf in second RMGfxBuffer constructor I think this fixes CID 1086888, but I haven't been able to find where in the game this constructor is used. --- engines/tony/gfxcore.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 410f9b8971e9..3433ad30246e 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -117,6 +117,7 @@ RMGfxBuffer::operator void *() { } RMGfxBuffer::RMGfxBuffer(int dimx, int dimy, int nBpp) { + _origBuf = _buf = NULL; create(dimx, dimy, nBpp); } From 91e70ce2a876e5d08994d7c5b045bf867b376305 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Oct 2013 19:10:23 +0200 Subject: [PATCH 1269/1332] AVALANCHE: Modifiy AnimationType initialization, add private Animation pointer --- engines/avalanche/animation.cpp | 258 ++++++++++++++++---------------- engines/avalanche/animation.h | 6 +- engines/avalanche/avalanche.cpp | 2 +- engines/avalanche/avalot.cpp | 74 ++++----- engines/avalanche/dialogs.cpp | 8 +- engines/avalanche/menu.cpp | 4 +- engines/avalanche/parser.cpp | 34 ++--- engines/avalanche/timer.cpp | 60 ++++---- 8 files changed, 227 insertions(+), 219 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index e87341509a75..f419034344ae 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -46,12 +46,14 @@ const int32 Animation::kCatacombMap[8][8] = { {0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062} }; +AnimationType::AnimationType(Animation *anim) { + _anim = anim; +} + /** * Loads & sets up the sprite. */ -void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { - _anim = anim; - +void AnimationType::init(byte spritenum, bool doCheck) { const int32 idshould = -1317732048; if (spritenum == 177) @@ -180,7 +182,7 @@ void AnimationType::appear(int16 wx, int16 wy, Direction wf) { */ bool AnimationType::checkCollision() { for (int i = 0; i < _anim->kSpriteNumbMax; i++) { - AnimationType *spr = &_anim->_sprites[i]; + AnimationType *spr = _anim->_sprites[i]; if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) return true; } @@ -381,14 +383,18 @@ void AnimationType::remove() { Animation::Animation(AvalancheEngine *vm) { _vm = vm; - _mustExclaim = false; + + for (int16 i = 0; i < kSpriteNumbMax; i++) { + _sprites[i] = new AnimationType(this); + } } Animation::~Animation() { for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick) - _sprites[i].remove(); + if (_sprites[i]->_quick) + _sprites[i]->remove(); + delete(_sprites[i]); } } @@ -399,7 +405,7 @@ Animation::~Animation() { void Animation::resetAnims() { setDirection(kDirStopped); for (int16 i = 0; i < kSpriteNumbMax; i++) - _sprites[i].reset(); + _sprites[i]->reset(); } byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { @@ -463,8 +469,8 @@ void Animation::catacombMove(byte ped) { _vm->flipRoom(kRoomLusties, 5); _vm->_dialogs->displayText("Oh no... here we go again..."); _vm->_userMovesAvvy = false; - _sprites[0]._moveY = 1; - _sprites[0]._moveX = 0; + _sprites[0]->_moveY = 1; + _sprites[0]->_moveX = 0; return; } @@ -730,11 +736,11 @@ void Animation::catacombMove(byte ped) { } if ((_vm->_geidaFollows) && (ped > 0)) { - if (!_sprites[1]._quick) // If we don't already have her... - _sprites[1].init(5, true, this); // ...Load Geida. + if (!_sprites[1]->_quick) // If we don't already have her... + _sprites[1]->init(5, true); // ...Load Geida. appearPed(1, geidaPed(ped)); - _sprites[1]._callEachStepFl = true; - _sprites[1]._eachStepProc = kProcGeida; + _sprites[1]->_callEachStepFl = true; + _sprites[1]->_eachStepProc = kProcGeida; } } @@ -766,25 +772,25 @@ void Animation::callSpecial(uint16 which) { _vm->_userMovesAvvy = true; break; case 3: // _vm->special 3: Room 71: triggers dart. - _sprites[0].bounce(); // Must include that. + _sprites[0]->bounce(); // Must include that. if (!_arrowTriggered) { _arrowTriggered = true; appearPed(1, 3); // The dart starts at ped 4, and... - _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). - _sprites[1]._facingDir = kDirUp; // Only face. + _sprites[1]->walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). + _sprites[1]->_facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ // OK! - _sprites[1]._callEachStepFl = true; - _sprites[1]._eachStepProc = kProcArrow; + _sprites[1]->_callEachStepFl = true; + _sprites[1]->_eachStepProc = kProcArrow; } break; case 4: // This is the ghost room link. _vm->fadeOut(); - _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap + _sprites[0]->turn(kDirRight); // you'll see this after we get back from bootstrap _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! break; @@ -793,28 +799,28 @@ void Animation::callSpecial(uint16 which) { // _vm->special 5: Room 42: touched tree, and get tied up. _vm->_magics[4]._operation = kMagicBounce; // Boundary effect is now working again. _vm->_dialogs->displayScrollChain('q', 35); - _sprites[0].remove(); + _sprites[0]->remove(); //tr[1].vanishifstill:=true; _vm->_background->draw(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); _vm->_tiedUp = true; _vm->_friarWillTieYouUp = false; - _sprites[1].walkTo(2); - _sprites[1]._vanishIfStill = true; - _sprites[1]._doCheck = true; // One of them must have Check_Me switched on. + _sprites[1]->walkTo(2); + _sprites[1]->_vanishIfStill = true; + _sprites[1]->_doCheck = true; // One of them must have Check_Me switched on. _vm->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; case 6: // _vm->special 6: fall down oubliette. _vm->_userMovesAvvy = false; - _sprites[0]._moveX = 3; - _sprites[0]._moveY = 0; - _sprites[0]._facingDir = kDirRight; + _sprites[0]->_moveX = 3; + _sprites[0]->_moveY = 0; + _sprites[0]->_facingDir = kDirRight; _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); break; case 7: // _vm->special 7: stop falling down oubliette. - _sprites[0]._visible = false; + _sprites[0]->_visible = false; _vm->_magics[9]._operation = kMagicNothing; stopWalking(); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); @@ -826,18 +832,18 @@ void Animation::callSpecial(uint16 which) { case 8: // _vm->special 8: leave du Lustie's room. if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) { _vm->_dialogs->displayScrollChain('q', 63); - _sprites[1].turn(kDirDown); - _sprites[1].stopWalk(); - _sprites[1]._callEachStepFl = false; // Geida + _sprites[1]->turn(kDirDown); + _sprites[1]->stopWalk(); + _sprites[1]->_callEachStepFl = false; // Geida _vm->gameOver(); } break; case 9: // _vm->special 9: lose Geida to Robin Hood... if (!_vm->_geidaFollows) return; // DOESN'T COUNT: no Geida. - _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. - _sprites[1].walkTo(3); // She walks to somewhere... - _sprites[0].remove(); // Lose Avvy. + _sprites[1]->_callEachStepFl = false; // She no longer follows Avvy around. + _sprites[1]->walkTo(3); // She walks to somewhere... + _sprites[0]->remove(); // Lose Avvy. _vm->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); break; @@ -900,35 +906,35 @@ void Animation::callSpecial(uint16 which) { void Animation::updateSpeed() { // Given that you've just changed the speed in _speedX, this adjusts _moveX. - _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; - _vm->_graphics->drawSpeedBar(_sprites[0]._speedX); + _sprites[0]->_moveX = (_sprites[0]->_moveX / 3) * _sprites[0]->_speedX; + _vm->_graphics->drawSpeedBar(_sprites[0]->_speedX); } void Animation::setMoveSpeed(byte t, Direction dir) { switch (dir) { case kDirUp: - _sprites[t].setSpeed(0, -_sprites[t]._speedY); + _sprites[t]->setSpeed(0, -_sprites[t]->_speedY); break; case kDirDown: - _sprites[t].setSpeed(0, _sprites[t]._speedY); + _sprites[t]->setSpeed(0, _sprites[t]->_speedY); break; case kDirLeft: - _sprites[t].setSpeed(-_sprites[t]._speedX, 0); + _sprites[t]->setSpeed(-_sprites[t]->_speedX, 0); break; case kDirRight: - _sprites[t].setSpeed(_sprites[t]._speedX, 0); + _sprites[t]->setSpeed(_sprites[t]->_speedX, 0); break; case kDirUpLeft: - _sprites[t].setSpeed(-_sprites[t]._speedX, -_sprites[t]._speedY); + _sprites[t]->setSpeed(-_sprites[t]->_speedX, -_sprites[t]->_speedY); break; case kDirUpRight: - _sprites[t].setSpeed(_sprites[t]._speedX, -_sprites[t]._speedY); + _sprites[t]->setSpeed(_sprites[t]->_speedX, -_sprites[t]->_speedY); break; case kDirDownLeft: - _sprites[t].setSpeed(-_sprites[t]._speedX, _sprites[t]._speedY); + _sprites[t]->setSpeed(-_sprites[t]->_speedX, _sprites[t]->_speedY); break; case kDirDownRight: - _sprites[t].setSpeed(_sprites[t]._speedX, _sprites[t]._speedY); + _sprites[t]->setSpeed(_sprites[t]->_speedX, _sprites[t]->_speedY); break; default: break; @@ -936,7 +942,7 @@ void Animation::setMoveSpeed(byte t, Direction dir) { } void Animation::appearPed(byte sprNum, byte pedNum) { - AnimationType *curSpr = &_sprites[sprNum]; + AnimationType *curSpr = _sprites[sprNum]; PedType *curPed = &_vm->_peds[pedNum]; curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); setMoveSpeed(sprNum, curPed->_direction); @@ -946,59 +952,59 @@ void Animation::appearPed(byte sprNum, byte pedNum) { * @remarks Originally called 'follow_avvy_y' */ void Animation::followAvalotY(byte tripnum) { - if (_sprites[0]._facingDir == kDirLeft) + if (_sprites[0]->_facingDir == kDirLeft) return; - if (_sprites[tripnum]._homing) - _sprites[tripnum]._homingY = _sprites[1]._y; + if (_sprites[tripnum]->_homing) + _sprites[tripnum]->_homingY = _sprites[1]->_y; else { - if (_sprites[tripnum]._y < _sprites[1]._y) - _sprites[tripnum]._y++; - else if (_sprites[tripnum]._y > _sprites[1]._y) - _sprites[tripnum]._y--; + if (_sprites[tripnum]->_y < _sprites[1]->_y) + _sprites[tripnum]->_y++; + else if (_sprites[tripnum]->_y > _sprites[1]->_y) + _sprites[tripnum]->_y--; else return; - if (_sprites[tripnum]._moveX == 0) { - _sprites[tripnum]._stepNum++; - if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) - _sprites[tripnum]._stepNum = 0; - _sprites[tripnum]._count = 0; + if (_sprites[tripnum]->_moveX == 0) { + _sprites[tripnum]->_stepNum++; + if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) + _sprites[tripnum]->_stepNum = 0; + _sprites[tripnum]->_count = 0; } } } void Animation::backAndForth(byte tripnum) { - if (!_sprites[tripnum]._homing) { - if (_sprites[tripnum]._facingDir == kDirRight) - _sprites[tripnum].walkTo(3); + if (!_sprites[tripnum]->_homing) { + if (_sprites[tripnum]->_facingDir == kDirRight) + _sprites[tripnum]->walkTo(3); else - _sprites[tripnum].walkTo(4); + _sprites[tripnum]->walkTo(4); } } void Animation::faceAvvy(byte tripnum) { - if (!_sprites[tripnum]._homing) { - if (_sprites[0]._x >= _sprites[tripnum]._x) - _sprites[tripnum]._facingDir = kDirRight; + if (!_sprites[tripnum]->_homing) { + if (_sprites[0]->_x >= _sprites[tripnum]->_x) + _sprites[tripnum]->_facingDir = kDirRight; else - _sprites[tripnum]._facingDir = kDirLeft; + _sprites[tripnum]->_facingDir = kDirLeft; } } void Animation::arrowProcs(byte tripnum) { - if (_sprites[tripnum]._homing) { + if (_sprites[tripnum]->_homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((_sprites[tripnum]._y + _sprites[tripnum]._info._yLength) >= _sprites[0]._y) // A - && (_sprites[tripnum]._x <= (_sprites[0]._x + _sprites[0]._info._xLength)) // B - && ((_sprites[tripnum]._x + _sprites[tripnum]._info._xLength) >= _sprites[0]._x)) { // C + if (((_sprites[tripnum]->_y + _sprites[tripnum]->_info._yLength) >= _sprites[0]->_y) // A + && (_sprites[tripnum]->_x <= (_sprites[0]->_x + _sprites[0]->_info._xLength)) // B + && ((_sprites[tripnum]->_x + _sprites[tripnum]->_info._xLength) >= _sprites[0]->_x)) { // C // OK, it's hit him... what now? - _sprites[1]._callEachStepFl = false; // prevent recursion. + _sprites[1]->_callEachStepFl = false; // prevent recursion. _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! - _sprites[tripnum].remove(); // Deallocate the arrow. + _sprites[tripnum]->remove(); // Deallocate the arrow. _vm->gameOver(); @@ -1006,7 +1012,7 @@ void Animation::arrowProcs(byte tripnum) { _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! - _sprites[tripnum].remove(); // Deallocate the arrow. + _sprites[tripnum]->remove(); // Deallocate the arrow. _vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_arrowInTheDoor = true; // So that we can pick it up. } @@ -1014,43 +1020,43 @@ void Animation::arrowProcs(byte tripnum) { } void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham. - int16 tox = _sprites[0]._x + 17; - int16 toy = _sprites[0]._y - 1; - if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) { - _sprites[tripnum]._callEachStepFl = false; - _sprites[tripnum]._facingDir = kDirLeft; - _sprites[tripnum].stopWalk(); + int16 tox = _sprites[0]->_x + 17; + int16 toy = _sprites[0]->_y - 1; + if ((_sprites[tripnum]->_x == tox) && (_sprites[tripnum]->_y == toy)) { + _sprites[tripnum]->_callEachStepFl = false; + _sprites[tripnum]->_facingDir = kDirLeft; + _sprites[tripnum]->stopWalk(); // ... whatever ... } else { // Still some way to go. - if (_sprites[tripnum]._x < tox) { - _sprites[tripnum]._x += 5; - if (_sprites[tripnum]._x > tox) - _sprites[tripnum]._x = tox; + if (_sprites[tripnum]->_x < tox) { + _sprites[tripnum]->_x += 5; + if (_sprites[tripnum]->_x > tox) + _sprites[tripnum]->_x = tox; } - if (_sprites[tripnum]._y < toy) - _sprites[tripnum]._y++; - _sprites[tripnum]._stepNum++; - if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) - _sprites[tripnum]._stepNum = 0; + if (_sprites[tripnum]->_y < toy) + _sprites[tripnum]->_y++; + _sprites[tripnum]->_stepNum++; + if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) + _sprites[tripnum]->_stepNum = 0; } } void Animation::takeAStep(byte &tripnum) { - if (_sprites[tripnum]._moveX == 0) { - _sprites[tripnum]._stepNum++; - if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) - _sprites[tripnum]._stepNum = 0; - _sprites[tripnum]._count = 0; + if (_sprites[tripnum]->_moveX == 0) { + _sprites[tripnum]->_stepNum++; + if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) + _sprites[tripnum]->_stepNum = 0; + _sprites[tripnum]->_count = 0; } } void Animation::spin(Direction dir, byte &tripnum) { - if (_sprites[tripnum]._facingDir == dir) + if (_sprites[tripnum]->_facingDir == dir) return; - _sprites[tripnum]._facingDir = dir; - if (_sprites[tripnum]._id == 2) + _sprites[tripnum]->_facingDir = dir; + if (_sprites[tripnum]->_id == 2) return; // Not for Spludwick _geidaSpin++; @@ -1069,35 +1075,35 @@ void Animation::geidaProcs(byte tripnum) { _geidaSpin = 0; } - if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { + if (_sprites[tripnum]->_y < (_sprites[0]->_y - 2)) { // Geida is further from the screen than Avvy. spin(kDirDown, tripnum); - _sprites[tripnum]._moveY = 1; - _sprites[tripnum]._moveX = 0; + _sprites[tripnum]->_moveY = 1; + _sprites[tripnum]->_moveX = 0; takeAStep(tripnum); return; - } else if (_sprites[tripnum]._y > (_sprites[0]._y + 2)) { + } else if (_sprites[tripnum]->_y > (_sprites[0]->_y + 2)) { // Avvy is further from the screen than Geida. spin(kDirUp, tripnum); - _sprites[tripnum]._moveY = -1; - _sprites[tripnum]._moveX = 0; + _sprites[tripnum]->_moveY = -1; + _sprites[tripnum]->_moveX = 0; takeAStep(tripnum); return; } - _sprites[tripnum]._moveY = 0; + _sprites[tripnum]->_moveY = 0; // These 12-s are not in the original, I added them to make the following method more "smooth". // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (_sprites[tripnum]._x < _sprites[0]._x - _sprites[0]._speedX * 8 - 12) { - _sprites[tripnum]._moveX = _sprites[0]._speedX; + if (_sprites[tripnum]->_x < _sprites[0]->_x - _sprites[0]->_speedX * 8 - 12) { + _sprites[tripnum]->_moveX = _sprites[0]->_speedX; spin(kDirRight, tripnum); takeAStep(tripnum); - } else if (_sprites[tripnum]._x > _sprites[0]._x + _sprites[0]._speedX * 8 + 12) { - _sprites[tripnum]._moveX = -_sprites[0]._speedX; + } else if (_sprites[tripnum]->_x > _sprites[0]->_x + _sprites[0]->_speedX * 8 + 12) { + _sprites[tripnum]->_moveX = -_sprites[0]->_speedX; spin(kDirLeft, tripnum); takeAStep(tripnum); } else - _sprites[tripnum]._moveX = 0; + _sprites[tripnum]->_moveX = 0; } /** @@ -1112,7 +1118,7 @@ void Animation::drawSprites() { order[i] = -1; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick && _sprites[i]._visible) + if (_sprites[i]->_quick && _sprites[i]->_visible) order[i] = i; } @@ -1120,7 +1126,7 @@ void Animation::drawSprites() { ok = true; for (int i = 0; i < 4; i++) { if (((order[i] != -1) && (order[i + 1] != -1)) - && (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) { + && (_sprites[order[i]]->_y > _sprites[order[i + 1]]->_y)) { // Swap them! temp = order[i]; order[i] = order[i + 1]; @@ -1134,7 +1140,7 @@ void Animation::drawSprites() { for (int i = 0; i < 5; i++) { if (order[i] > -1) - _sprites[order[i]].draw(); + _sprites[order[i]]->draw(); } } @@ -1146,15 +1152,15 @@ void Animation::animLink() { if (_vm->_menu->isActive() || _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick && _sprites[i]._visible) - _sprites[i].walk(); + if (_sprites[i]->_quick && _sprites[i]->_visible) + _sprites[i]->walk(); } drawSprites(); for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick && _sprites[i]._callEachStepFl) { - switch (_sprites[i]._eachStepProc) { + if (_sprites[i]->_quick && _sprites[i]->_callEachStepFl) { + switch (_sprites[i]->_eachStepProc) { case kProcFollowAvvyY : followAvalotY(i); break; @@ -1185,10 +1191,10 @@ void Animation::animLink() { } void Animation::stopWalking() { - _sprites[0].stopWalk(); + _sprites[0]->stopWalk(); _direction = kDirStopped; if (_vm->_alive) - _sprites[0]._stepNum = 1; + _sprites[0]->_stepNum = 1; } /** @@ -1201,7 +1207,7 @@ void Animation::hideInCupboard() { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", kControlItalic, kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { - _sprites[0]._visible = true; + _sprites[0]->_visible = true; _vm->_userMovesAvvy = true; appearPed(0, 2); // Walk out of the cupboard. _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); @@ -1210,7 +1216,7 @@ void Animation::hideInCupboard() { } } else { // Not hiding in the cupboard - _sprites[0]._visible = false; + _sprites[0]->_visible = false; _vm->_userMovesAvvy = false; Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", kControlParagraph); @@ -1225,9 +1231,9 @@ void Animation::hideInCupboard() { */ bool Animation::inField(byte which) { FieldType *curField = &_vm->_fields[which]; - int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; + int16 yy = _sprites[0]->_y + _sprites[0]->_info._yLength; - return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); + return (_sprites[0]->_x >= curField->_x1) && (_sprites[0]->_x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } /** @@ -1239,8 +1245,8 @@ bool Animation::nearDoor() { return false; } - int16 ux = _sprites[0]._x; - int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; + int16 ux = _sprites[0]->_x; + int16 uy = _sprites[0]->_y + _sprites[0]->_info._yLength; for (int i = 8; i < _vm->_fieldNum; i++) { FieldType *curField = &_vm->_fields[i]; @@ -1357,7 +1363,7 @@ void Animation::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { for (int i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]._quick) + if (_sprites[i]->_quick) spriteNum++; } } @@ -1365,20 +1371,20 @@ void Animation::synchronize(Common::Serializer &sz) { if (sz.isLoading()) { for (int i = 0; i < kSpriteNumbMax; i++) { // Deallocate sprites. - AnimationType *spr = &_sprites[i]; + AnimationType *spr = _sprites[i]; if (spr->_quick) spr->remove(); } } for (int i = 0; i < spriteNum; i++) { - AnimationType *spr = &_sprites[i]; + AnimationType *spr = _sprites[i]; sz.syncAsByte(spr->_id); sz.syncAsByte(spr->_doCheck); if (sz.isLoading()) { spr->_quick = true; - spr->init(spr->_id, spr->_doCheck, this); + spr->init(spr->_id, spr->_doCheck); } sz.syncAsByte(spr->_moveX); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index ad7064503616..ac247b8256e8 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -67,7 +67,9 @@ class AnimationType { bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; - void init(byte spritenum, bool doCheck, Animation *anim); + AnimationType(Animation *anim); + + void init(byte spritenum, bool doCheck); void reset(); void draw(); void turn(Direction whichway); @@ -107,7 +109,7 @@ class Animation { kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick. }; - AnimationType _sprites[kSpriteNumbMax]; + AnimationType *_sprites[kSpriteNumbMax]; Animation(AvalancheEngine *vm); ~Animation(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3e0bdb050741..29e9d02bb403 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -381,7 +381,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); _dialogs->displayText(tmpStr); - AnimationType *avvy = &_animation->_sprites[0]; + AnimationType *avvy = _animation->_sprites[0]; if (avvy->_quick && avvy->_visible) _animation->setMoveSpeed(0, _animation->getDirection()); // We push Avvy in the right direction is he was moving. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f74239c164be..fdc2ddda6f39 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -278,7 +278,7 @@ void AvalancheEngine::setup() { fadeIn(); _parser->_cursorState = false; _parser->cursorOn(); - _animation->_sprites[0]._speedX = kWalk; + _animation->_sprites[0]->_speedX = kWalk; _animation->updateSpeed(); _menu->init(); @@ -610,9 +610,9 @@ void AvalancheEngine::enterNewTown() { void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) { if (ped == 0) return; - AnimationType *spr1 = &_animation->_sprites[1]; + AnimationType *spr1 = _animation->_sprites[1]; - spr1->init(5, false, _animation); // load Geida + spr1->init(5, false); // load Geida _animation->appearPed(1, whichPed); spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcGeida; @@ -653,10 +653,10 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomOutsideYours: if (ped > 0) { - AnimationType *spr1 = &_animation->_sprites[1]; + AnimationType *spr1 = _animation->_sprites[1]; if (!_talkedToCrapulus) { _whereIs[kPeopleCrapulus - 150] = kRoomOutsideYours; - spr1->init(8, false, _animation); // load Crapulus + spr1->init(8, false); // load Crapulus if (_roomCount[kRoomOutsideYours] == 1) { _animation->appearPed(1, 3); // Start on the right-hand side of the screen. @@ -673,7 +673,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { _whereIs[kPeopleCrapulus - 150] = kRoomNowhere; if (_crapulusWillTell) { - spr1->init(8, false, _animation); + spr1->init(8, false); _animation->appearPed(1, 1); spr1->walkTo(3); _timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); @@ -691,9 +691,9 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomSpludwicks: if (_spludwickAtHome) { - AnimationType *spr1 = &_animation->_sprites[1]; + AnimationType *spr1 = _animation->_sprites[1]; if (ped > 0) { - spr1->init(2, false, _animation); // load Spludwick + spr1->init(2, false); // load Spludwick _animation->appearPed(1, 1); _whereIs[kPeopleSpludwick - 150] = kRoomSpludwicks; } @@ -711,8 +711,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { _magics[kColorLightred - 1]._operation = kMagicNothing; _whereIs[kPeopleCwytalot - 150] = kRoomNowhere; } else if (ped > 0) { - AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(4, false, _animation); // 4 = Cwytalot + AnimationType *spr1 = _animation->_sprites[1]; + spr1->init(4, false); // 4 = Cwytalot spr1->_callEachStepFl = true; spr1->_eachStepProc = Animation::kProcFollowAvvyY; _whereIs[kPeopleCwytalot - 150] = kRoomBrummieRoad; @@ -730,8 +730,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomArgentRoad: if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { - AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(4, false, _animation); // 4 = Cwytalot again + AnimationType *spr1 = _animation->_sprites[1]; + spr1->init(4, false); // 4 = Cwytalot again _animation->appearPed(1, 0); spr1->walkTo(1); spr1->_vanishIfStill = true; @@ -754,8 +754,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomRobins: if ((ped > 0) && (!_beenTiedUp)) { // A welcome party... or maybe not... - AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(6, false, _animation); + AnimationType *spr1 = _animation->_sprites[1]; + spr1->init(6, false); _animation->appearPed(1, 1); spr1->walkTo(2); _timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); @@ -776,10 +776,10 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomOutsideCardiffCastle: if (ped > 0) { - AnimationType *spr1 = &_animation->_sprites[1]; + AnimationType *spr1 = _animation->_sprites[1]; switch (_cardiffQuestionNum) { case 0 : // You've answered NONE of his questions. - spr1->init(9, false, _animation); + spr1->init(9, false); _animation->appearPed(1, 1); spr1->walkTo(2); _timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); @@ -788,7 +788,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { _magics[1]._operation = kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: // You've answered SOME of his questions. - spr1->init(9, false, _animation); + spr1->init(9, false); _animation->appearPed(1, 2); spr1->_facingDir = kDirRight; _timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); @@ -853,7 +853,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomLustiesRoom: _npcFacing = 1; // du Lustie. - if (_animation->_sprites[0]._id == 0) // Avvy in his normal clothes + if (_animation->_sprites[0]->_id == 0) // Avvy in his normal clothes _timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (!_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. @@ -901,8 +901,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { break; case kRoomWiseWomans: { - AnimationType *spr1 = &_animation->_sprites[1]; - spr1->init(11, false, _animation); + AnimationType *spr1 = _animation->_sprites[1]; + spr1->init(11, false); if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { _animation->appearPed(1, 1); // Start on the right-hand side of the screen. spr1->walkTo(3); // Walks up to greet you. @@ -918,7 +918,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomInsideCardiffCastle: if (ped > 0) { - _animation->_sprites[1].init(10, false, _animation); // Define the dart. + _animation->_sprites[1]->init(10, false); // Define the dart. _background->draw(-1, -1, 0); _graphics->refreshBackground(); _sequence->startCardiffSeq2(); @@ -1139,7 +1139,7 @@ void AvalancheEngine::guideAvvy(Common::Point cursorPos) { byte what; // _animation->tr[0] is Avalot.) - AnimationType *avvy = &_animation->_sprites[0]; + AnimationType *avvy = _animation->_sprites[0]; if (cursorPos.x < avvy->_x) what = 1; else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) @@ -1242,10 +1242,10 @@ void AvalancheEngine::checkClick() { callVerb(kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _animation->_sprites[0]._speedX = kWalk; + _animation->_sprites[0]->_speedX = kWalk; _animation->updateSpeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _animation->_sprites[0]._speedX = kRun; + _animation->_sprites[0]->_speedX = kRun; _animation->updateSpeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); @@ -1343,12 +1343,12 @@ void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits(). void AvalancheEngine::gameOver() { _userMovesAvvy = false; - AnimationType *avvy = &_animation->_sprites[0]; + AnimationType *avvy = _animation->_sprites[0]; int16 sx = avvy->_x; int16 sy = avvy->_y; avvy->remove(); - avvy->init(12, true, _animation); // 12 = Avalot falls + avvy->init(12, true); // 12 = Avalot falls avvy->_stepNum = 0; avvy->appear(sx, sy, kDirUp); @@ -1373,7 +1373,7 @@ void AvalancheEngine::majorRedraw() { } uint16 AvalancheEngine::bearing(byte whichPed) { - AnimationType *avvy = &_animation->_sprites[0]; + AnimationType *avvy = _animation->_sprites[0]; PedType *curPed = &_peds[whichPed]; if (avvy->_x == curPed->_x) @@ -1488,14 +1488,14 @@ void AvalancheEngine::resetVariables() { void AvalancheEngine::newGame() { for (int i = 0; i < kMaxSprites; i++) { - AnimationType *spr = &_animation->_sprites[i]; + AnimationType *spr = _animation->_sprites[i]; if (spr->_quick) spr->remove(); } // Deallocate sprite. Sorry, beta testers! - AnimationType *avvy = &_animation->_sprites[0]; - avvy->init(0, true, _animation); + AnimationType *avvy = _animation->_sprites[0]; + avvy->init(0, true); _alive = true; resetVariables(); @@ -1648,8 +1648,8 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { assert((ped > 0) && (ped < 15)); if (!_alive) { // You can't leave the room if you're dead. - _animation->_sprites[0]._moveX = 0; - _animation->_sprites[0]._moveY = 0; // Stop him from moving. + _animation->_sprites[0]->_moveX = 0; + _animation->_sprites[0]->_moveY = 0; // Stop him from moving. return; } @@ -1660,7 +1660,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { if ((_jumpStatus > 0) && (_room == kRoomInsideCardiffCastle)) { // You can't *jump* out of Cardiff Castle! - _animation->_sprites[0]._moveX = 0; + _animation->_sprites[0]->_moveX = 0; return; } @@ -1668,8 +1668,8 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { fadeOut(); for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) { - if (_animation->_sprites[i]._quick) - _animation->_sprites[i].remove(); + if (_animation->_sprites[i]->_quick) + _animation->_sprites[i]->remove(); } // Deallocate sprite if (_room == kRoomLustiesRoom) @@ -1679,7 +1679,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { _animation->appearPed(0, ped - 1); _enterCatacombsFromLustiesRoom = false; _animation->setOldDirection(_animation->getDirection()); - _animation->setDirection(_animation->_sprites[0]._facingDir); + _animation->setDirection(_animation->_sprites[0]->_facingDir); drawDirection(); fadeIn(); @@ -1721,7 +1721,7 @@ void AvalancheEngine::openDoor(Room whither, byte ped, byte magicnum) { return; } else { _animation->appearPed(0, 5); - _animation->_sprites[0]._facingDir = kDirRight; + _animation->_sprites[0]->_facingDir = kDirRight; _sequence->startLustiesSeq2(whither, ped); } break; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index e9cc1c7f748b..84dbed45e55d 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -688,7 +688,7 @@ void Dialogs::callDialogDriver() { if (_param == 0) setBubbleStateNatural(); else if ((1 <= _param) && (_param <= 9)) { - AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; + AnimationType *spr = _vm->_animation->_sprites[_param - 1]; if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. _vm->errorLed(); setBubbleStateNatural(); @@ -1074,7 +1074,7 @@ void Dialogs::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { + if (_vm->_animation->_sprites[i]->_stat._acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); noMatches = false; @@ -1099,7 +1099,7 @@ void Dialogs::talkTo(byte whom) { _vm->_talkedToCrapulus = true; _vm->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *spr = _vm->_animation->_sprites[1]; spr->_vanishIfStill = true; spr->walkTo(2); // Walks away. @@ -1134,7 +1134,7 @@ Common::String Dialogs::personSpeaks() { Common::String tmpStr; for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _vm->_parser->_person)) { + if (_vm->_animation->_sprites[i]->_quick && ((_vm->_animation->_sprites[i]->_stat._acciNum + 149) == _vm->_parser->_person)) { tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); found = true; } diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index f722b128cce9..59ac38f64447 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -431,7 +431,7 @@ void Menu::setupMenuAction() { _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->_sprites[0]._speedX == _vm->kWalk) + if (_vm->_animation->_sprites[0]->_speedX == _vm->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -595,7 +595,7 @@ void Menu::runMenuAction() { _vm->callVerb(kVerbCodeInv); break; case 5: { - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; if (avvy->_speedX == _vm->kWalk) avvy->_speedX = _vm->kRun; else diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 36d03492f059..d85e55032c1b 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -714,8 +714,8 @@ void Parser::storeInterrogation(byte interrogation) { _vm->_spareEvening.clear(); _vm->_spareEvening = _inputText; _vm->_dialogs->displayScrollChain('z', 5); // His closing statement... - _vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge - _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! + _vm->_animation->_sprites[1]->walkTo(3); // The end of the drawbridge + _vm->_animation->_sprites[1]->_vanishIfStill = true; // Then go away! _vm->_magics[1]._operation = kMagicNothing; _vm->_cardiffQuestionNum = 5; break; @@ -1265,14 +1265,14 @@ void Parser::openDoor() { MagicType *portal = &_vm->_portals[i]; switch (portal->_operation) { case kMagicExclaim: - _vm->_animation->_sprites[0].bounce(); + _vm->_animation->_sprites[0]->bounce(); _vm->_dialogs->displayScrollChain('x', portal->_data); break; case kMagicTransport: _vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F); break; case kMagicUnfinished: - _vm->_animation->_sprites[0].bounce(); + _vm->_animation->_sprites[0]->bounce(); _vm->_dialogs->displayText("Sorry. This place is not available yet!"); break; case kMagicSpecial: @@ -1393,9 +1393,9 @@ void Parser::notInOrder() { */ void Parser::goToCauldron() { // Stops Geida_Procs. - _vm->_animation->_sprites[1]._callEachStepFl = false; + _vm->_animation->_sprites[1]->_callEachStepFl = false; _vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); - _vm->_animation->_sprites[1].walkTo(1); + _vm->_animation->_sprites[1]->walkTo(1); } /** @@ -1456,7 +1456,7 @@ void Parser::drink() { _vm->fadeOut(); _vm->flipRoom(kRoomYours, 1); _vm->_graphics->setBackgroundColor(kColorYellow); - _vm->_animation->_sprites[0]._visible = false; + _vm->_animation->_sprites[0]->_visible = false; } } @@ -1490,7 +1490,7 @@ void Parser::standUp() { _vm->_graphics->setBackgroundColor(kColorBlack); _vm->_dialogs->displayScrollChain('d', 14); } - _vm->_animation->_sprites[0]._visible = true; + _vm->_animation->_sprites[0]->_visible = true; _vm->_userMovesAvvy = true; _vm->_animation->appearPed(0, 1); _vm->_animation->setDirection(kDirLeft); @@ -1512,7 +1512,7 @@ void Parser::standUp() { // Not sitting down. _vm->_background->draw(-1, -1, 3); // But standing up. - _vm->_animation->_sprites[0]._visible = true; + _vm->_animation->_sprites[0]->_visible = true; // And walking away. _vm->_animation->appearPed(0, 3); // Really not sitting down. @@ -1926,12 +1926,12 @@ void Parser::doThat() { i = 3; else i = 0; - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; + Avalanche::AnimationType *spr = _vm->_animation->_sprites[0]; if (spr->_id != i) { int16 x = spr->_x; int16 y = spr->_y; spr->remove(); - spr->init(i, true, _vm->_animation); + spr->init(i, true); spr->appear(x, y, kDirLeft); spr->_visible = false; } @@ -2072,9 +2072,9 @@ void Parser::doThat() { if (_vm->getRoom(kPeopleSpludwick) == kRoomSpludwicks) _vm->_dialogs->displayScrollChain('q', 18); else { - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; + Avalanche::AnimationType *spr = _vm->_animation->_sprites[1]; // Avaricius - spr->init(1, false, _vm->_animation); + spr->init(1, false); _vm->_animation->appearPed(1, 3); spr->walkTo(4); spr->_callEachStepFl = true; @@ -2255,9 +2255,9 @@ void Parser::doThat() { _vm->refreshObjectList(); _vm->_magics[11]._operation = kMagicNothing; _vm->incScore(7); - _vm->_animation->_sprites[1].walkTo(1); - _vm->_animation->_sprites[1]._vanishIfStill = true; - _vm->_animation->_sprites[1]._callEachStepFl = false; + _vm->_animation->_sprites[1]->walkTo(1); + _vm->_animation->_sprites[1]->_vanishIfStill = true; + _vm->_animation->_sprites[1]->_callEachStepFl = false; _vm->setRoom(kPeopleCwytalot, kRoomDummy); break; default: @@ -2385,7 +2385,7 @@ void Parser::doThat() { _vm->_dialogs->displayText("You're already sitting!"); else { // Move Avvy to the place, and sit him down. - _vm->_animation->_sprites[0].walkTo(3); + _vm->_animation->_sprites[0]->walkTo(3); _vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown); } } else { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b4ba02824200..4e90c7fe4848 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -242,7 +242,7 @@ void Timer::avariciusTalks() { } void Timer::urinate() { - _vm->_animation->_sprites[0].turn(kDirUp); + _vm->_animation->_sprites[0]->turn(kDirUp); _vm->_animation->stopWalking(); _vm->drawDirection(); addTimer(14, kProcToilet, kReasonGoToToilet); @@ -264,7 +264,7 @@ void Timer::bang2() { void Timer::stairs() { _vm->_sound->blip(); - _vm->_animation->_sprites[0].walkTo(3); + _vm->_animation->_sprites[0]->walkTo(3); _vm->_background->draw(-1, -1, 1); _vm->_brummieStairs = 2; _vm->_magics[10]._operation = kMagicSpecial; @@ -298,7 +298,7 @@ void Timer::getTiedUp() { _vm->_beenTiedUp = true; _vm->_animation->stopWalking(); - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *spr = _vm->_animation->_sprites[1]; spr->stopWalk(); spr->stopHoming(); spr->_callEachStepFl = true; @@ -307,17 +307,17 @@ void Timer::getTiedUp() { } void Timer::getTiedUp2() { - _vm->_animation->_sprites[0].walkTo(3); - _vm->_animation->_sprites[1].walkTo(4); + _vm->_animation->_sprites[0]->walkTo(3); + _vm->_animation->_sprites[1]->walkTo(4); _vm->_magics[3]._operation = kMagicNothing; // No effect when you touch the boundaries. _vm->_friarWillTieYouUp = true; } void Timer::hangAround() { - _vm->_animation->_sprites[1]._doCheck = false; + _vm->_animation->_sprites[1]->_doCheck = false; - AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->init(7, true, _vm->_animation); // Robin Hood + AnimationType *avvy = _vm->_animation->_sprites[0]; + avvy->init(7, true); // Robin Hood _vm->setRoom(kPeopleRobinHood, kRoomRobins); _vm->_animation->appearPed(0, 1); _vm->_dialogs->displayScrollChain('q', 39); @@ -327,12 +327,12 @@ void Timer::hangAround() { void Timer::hangAround2() { _vm->_dialogs->displayScrollChain('q', 40); - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *spr = _vm->_animation->_sprites[1]; spr->_vanishIfStill = false; spr->walkTo(3); _vm->setRoom(kPeopleFriarTuck, kRoomRobins); _vm->_dialogs->displayScrollChain('q', 41); - _vm->_animation->_sprites[0].remove(); + _vm->_animation->_sprites[0]->remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); @@ -347,7 +347,7 @@ void Timer::afterTheShootemup() { // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! _vm->flipRoom(_vm->_room, 1); - _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. + _vm->_animation->_sprites[0]->init(0, true); // Avalot. _vm->_animation->appearPed(0, 1); _vm->_userMovesAvvy = true; _vm->_objects[kObjectCrossbow - 1] = true; @@ -417,8 +417,8 @@ void Timer::jacquesWakesUp() { } void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. - AnimationType *spr = &_vm->_animation->_sprites[1]; - spr->init(9, false, _vm->_animation); // Here comes the Duke. + AnimationType *spr = _vm->_animation->_sprites[1]; + spr->init(9, false); // Here comes the Duke. _vm->_animation->appearPed(1, 0); // He starts at the door... spr->walkTo(2); // He walks over to you. @@ -430,7 +430,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon } void Timer::naughtyDuke2() { - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *spr = _vm->_animation->_sprites[1]; _vm->_dialogs->displayScrollChain('q', 48); // "Ha ha, it worked again!" spr->walkTo(0); // Walk to the door. spr->_vanishIfStill = true; // Then go away! @@ -444,7 +444,7 @@ void Timer::naughtyDuke3() { } void Timer::jump() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; _vm->_jumpStatus++; switch (_vm->_jumpStatus) { @@ -534,7 +534,7 @@ void Timer::greetsMonk() { void Timer::fallDownOubliette() { _vm->_magics[8]._operation = kMagicNothing; - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; avvy->_moveY++; // Increments dx/dy! avvy->_y += avvy->_moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); @@ -551,7 +551,7 @@ void Timer::meetAvaroid() { _vm->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; avvy->_facingDir = kDirLeft; avvy->_x = 151; avvy->_moveX = -3; @@ -562,7 +562,7 @@ void Timer::meetAvaroid() { } void Timer::riseUpOubliette() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; avvy->_visible = true; avvy->_moveY++; // Decrements dx/dy! avvy->_y -= avvy->_moveY; // Uuuupppp we go... @@ -573,12 +573,12 @@ void Timer::riseUpOubliette() { } void Timer::robinHoodAndGeida() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; - avvy->init(7, true, _vm->_animation); + AnimationType *avvy = _vm->_animation->_sprites[0]; + avvy->init(7, true); _vm->_animation->appearPed(0, 6); avvy->walkTo(5); - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *spr = _vm->_animation->_sprites[1]; spr->stopWalk(); spr->_facingDir = kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); @@ -588,8 +588,8 @@ void Timer::robinHoodAndGeida() { void Timer::robinHoodAndGeidaTalk() { _vm->_dialogs->displayScrollChain('q', 66); - AnimationType *avvy = &_vm->_animation->_sprites[0]; - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *avvy = _vm->_animation->_sprites[0]; + AnimationType *spr = _vm->_animation->_sprites[1]; avvy->walkTo(1); spr->walkTo(1); avvy->_vanishIfStill = true; @@ -599,11 +599,11 @@ void Timer::robinHoodAndGeidaTalk() { } void Timer::avalotReturns() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; - AnimationType *spr = &_vm->_animation->_sprites[1]; + AnimationType *avvy = _vm->_animation->_sprites[0]; + AnimationType *spr = _vm->_animation->_sprites[1]; avvy->remove(); spr->remove(); - avvy->init(0, true, _vm->_animation); + avvy->init(0, true); _vm->_animation->appearPed(0, 0); _vm->_dialogs->displayScrollChain('q', 67); _vm->_userMovesAvvy = true; @@ -615,7 +615,7 @@ void Timer::avalotReturns() { * @remarks Originally called 'avvy_sit_down' */ void Timer::avvySitDown() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { @@ -658,7 +658,7 @@ void Timer::winning() { } void Timer::avalotFalls() { - AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *avvy = _vm->_animation->_sprites[0]; if (avvy->_stepNum < 5) { avvy->_stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); @@ -673,14 +673,14 @@ void Timer::avalotFalls() { } void Timer::spludwickGoesToCauldron() { - if (_vm->_animation->_sprites[1]._homing) + if (_vm->_animation->_sprites[1]->_homing) addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludwickWalk); else addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludwickWalk); } void Timer::spludwickLeavesCauldron() { - _vm->_animation->_sprites[1]._callEachStepFl = true; // So that normal procs will continue. + _vm->_animation->_sprites[1]->_callEachStepFl = true; // So that normal procs will continue. } void Timer::giveLuteToGeida() { // Moved here from Acci. From 609846ab8aeaeef533d867f2740143d6ffbdbed4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Oct 2013 21:18:56 +0200 Subject: [PATCH 1270/1332] AVALANCHE: Reduce verbosity in Animation and AnimationType --- engines/avalanche/animation.cpp | 176 ++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 74 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index f419034344ae..4bf2c69b3e74 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -954,57 +954,68 @@ void Animation::appearPed(byte sprNum, byte pedNum) { void Animation::followAvalotY(byte tripnum) { if (_sprites[0]->_facingDir == kDirLeft) return; - if (_sprites[tripnum]->_homing) - _sprites[tripnum]->_homingY = _sprites[1]->_y; + + AnimationType *tripSpr = _sprites[tripnum]; + + if (tripSpr->_homing) + tripSpr->_homingY = _sprites[1]->_y; else { - if (_sprites[tripnum]->_y < _sprites[1]->_y) - _sprites[tripnum]->_y++; - else if (_sprites[tripnum]->_y > _sprites[1]->_y) - _sprites[tripnum]->_y--; + if (tripSpr->_y < _sprites[1]->_y) + tripSpr->_y++; + else if (tripSpr->_y > _sprites[1]->_y) + tripSpr->_y--; else return; - if (_sprites[tripnum]->_moveX == 0) { - _sprites[tripnum]->_stepNum++; - if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) - _sprites[tripnum]->_stepNum = 0; - _sprites[tripnum]->_count = 0; + + if (tripSpr->_moveX == 0) { + tripSpr->_stepNum++; + if (tripSpr->_stepNum == tripSpr->_stat._seq) + tripSpr->_stepNum = 0; + tripSpr->_count = 0; } } } void Animation::backAndForth(byte tripnum) { - if (!_sprites[tripnum]->_homing) { - if (_sprites[tripnum]->_facingDir == kDirRight) - _sprites[tripnum]->walkTo(3); + AnimationType *tripSpr = _sprites[tripnum]; + + if (!tripSpr->_homing) { + if (tripSpr->_facingDir == kDirRight) + tripSpr->walkTo(3); else - _sprites[tripnum]->walkTo(4); + tripSpr->walkTo(4); } } void Animation::faceAvvy(byte tripnum) { - if (!_sprites[tripnum]->_homing) { - if (_sprites[0]->_x >= _sprites[tripnum]->_x) - _sprites[tripnum]->_facingDir = kDirRight; + AnimationType *tripSpr = _sprites[tripnum]; + + if (!tripSpr->_homing) { + if (_sprites[0]->_x >= tripSpr->_x) + tripSpr->_facingDir = kDirRight; else - _sprites[tripnum]->_facingDir = kDirLeft; + tripSpr->_facingDir = kDirLeft; } } void Animation::arrowProcs(byte tripnum) { - if (_sprites[tripnum]->_homing) { + AnimationType *tripSpr = _sprites[tripnum]; + AnimationType *avvy = _sprites[tripnum]; + + if (tripSpr->_homing) { // Arrow is still in flight. // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((_sprites[tripnum]->_y + _sprites[tripnum]->_info._yLength) >= _sprites[0]->_y) // A - && (_sprites[tripnum]->_x <= (_sprites[0]->_x + _sprites[0]->_info._xLength)) // B - && ((_sprites[tripnum]->_x + _sprites[tripnum]->_info._xLength) >= _sprites[0]->_x)) { // C + if (((tripSpr->_y + tripSpr->_info._yLength) >= avvy->_y) // A + && (tripSpr->_x <= (avvy->_x + avvy->_info._xLength)) // B + && ((tripSpr->_x + tripSpr->_info._xLength) >= avvy->_x)) { // C // OK, it's hit him... what now? _sprites[1]->_callEachStepFl = false; // prevent recursion. _vm->_dialogs->displayScrollChain('Q', 47); // Complaint! - _sprites[tripnum]->remove(); // Deallocate the arrow. + tripSpr->remove(); // Deallocate the arrow. _vm->gameOver(); @@ -1012,51 +1023,57 @@ void Animation::arrowProcs(byte tripnum) { _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); } } else { // Arrow has hit the wall! - _sprites[tripnum]->remove(); // Deallocate the arrow. + tripSpr->remove(); // Deallocate the arrow. _vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_arrowInTheDoor = true; // So that we can pick it up. } - } void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham. - int16 tox = _sprites[0]->_x + 17; - int16 toy = _sprites[0]->_y - 1; - if ((_sprites[tripnum]->_x == tox) && (_sprites[tripnum]->_y == toy)) { - _sprites[tripnum]->_callEachStepFl = false; - _sprites[tripnum]->_facingDir = kDirLeft; - _sprites[tripnum]->stopWalk(); + AnimationType *tripSpr = _sprites[tripnum]; + AnimationType *avvy = _sprites[tripnum]; + + int16 tox = avvy->_x + 17; + int16 toy = avvy->_y - 1; + if ((tripSpr->_x == tox) && (tripSpr->_y == toy)) { + tripSpr->_callEachStepFl = false; + tripSpr->_facingDir = kDirLeft; + tripSpr->stopWalk(); // ... whatever ... } else { // Still some way to go. - if (_sprites[tripnum]->_x < tox) { - _sprites[tripnum]->_x += 5; - if (_sprites[tripnum]->_x > tox) - _sprites[tripnum]->_x = tox; + if (tripSpr->_x < tox) { + tripSpr->_x += 5; + if (tripSpr->_x > tox) + tripSpr->_x = tox; } - if (_sprites[tripnum]->_y < toy) - _sprites[tripnum]->_y++; - _sprites[tripnum]->_stepNum++; - if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) - _sprites[tripnum]->_stepNum = 0; + if (tripSpr->_y < toy) + tripSpr->_y++; + tripSpr->_stepNum++; + if (tripSpr->_stepNum == tripSpr->_stat._seq) + tripSpr->_stepNum = 0; } } void Animation::takeAStep(byte &tripnum) { - if (_sprites[tripnum]->_moveX == 0) { - _sprites[tripnum]->_stepNum++; - if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) - _sprites[tripnum]->_stepNum = 0; - _sprites[tripnum]->_count = 0; + AnimationType *tripSpr = _sprites[tripnum]; + + if (tripSpr->_moveX == 0) { + tripSpr->_stepNum++; + if (tripSpr->_stepNum == tripSpr->_stat._seq) + tripSpr->_stepNum = 0; + tripSpr->_count = 0; } } void Animation::spin(Direction dir, byte &tripnum) { - if (_sprites[tripnum]->_facingDir == dir) + AnimationType *tripSpr = _sprites[tripnum]; + + if (tripSpr->_facingDir == dir) return; - _sprites[tripnum]->_facingDir = dir; - if (_sprites[tripnum]->_id == 2) + tripSpr->_facingDir = dir; + if (tripSpr->_id == 2) return; // Not for Spludwick _geidaSpin++; @@ -1069,41 +1086,44 @@ void Animation::spin(Direction dir, byte &tripnum) { } void Animation::geidaProcs(byte tripnum) { + AnimationType *tripSpr = _sprites[tripnum]; + AnimationType *avvy = _sprites[0]; + if (_geidaTime > 0) { _geidaTime--; if (_geidaTime == 0) _geidaSpin = 0; } - if (_sprites[tripnum]->_y < (_sprites[0]->_y - 2)) { + if (tripSpr->_y < (avvy->_y - 2)) { // Geida is further from the screen than Avvy. spin(kDirDown, tripnum); - _sprites[tripnum]->_moveY = 1; - _sprites[tripnum]->_moveX = 0; + tripSpr->_moveY = 1; + tripSpr->_moveX = 0; takeAStep(tripnum); return; - } else if (_sprites[tripnum]->_y > (_sprites[0]->_y + 2)) { + } else if (tripSpr->_y > (avvy->_y + 2)) { // Avvy is further from the screen than Geida. spin(kDirUp, tripnum); - _sprites[tripnum]->_moveY = -1; - _sprites[tripnum]->_moveX = 0; + tripSpr->_moveY = -1; + tripSpr->_moveX = 0; takeAStep(tripnum); return; } - _sprites[tripnum]->_moveY = 0; + tripSpr->_moveY = 0; // These 12-s are not in the original, I added them to make the following method more "smooth". // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (_sprites[tripnum]->_x < _sprites[0]->_x - _sprites[0]->_speedX * 8 - 12) { - _sprites[tripnum]->_moveX = _sprites[0]->_speedX; + if (tripSpr->_x < avvy->_x - avvy->_speedX * 8 - 12) { + tripSpr->_moveX = avvy->_speedX; spin(kDirRight, tripnum); takeAStep(tripnum); - } else if (_sprites[tripnum]->_x > _sprites[0]->_x + _sprites[0]->_speedX * 8 + 12) { - _sprites[tripnum]->_moveX = -_sprites[0]->_speedX; + } else if (tripSpr->_x > avvy->_x + avvy->_speedX * 8 + 12) { + tripSpr->_moveX = -avvy->_speedX; spin(kDirLeft, tripnum); takeAStep(tripnum); } else - _sprites[tripnum]->_moveX = 0; + tripSpr->_moveX = 0; } /** @@ -1118,7 +1138,8 @@ void Animation::drawSprites() { order[i] = -1; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]->_quick && _sprites[i]->_visible) + AnimationType *curSpr = _sprites[i]; + if (curSpr->_quick && curSpr->_visible) order[i] = i; } @@ -1152,15 +1173,17 @@ void Animation::animLink() { if (_vm->_menu->isActive() || _vm->_seeScroll) return; for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]->_quick && _sprites[i]->_visible) - _sprites[i]->walk(); + AnimationType *curSpr = _sprites[i]; + if (curSpr->_quick && curSpr->_visible) + curSpr->walk(); } drawSprites(); for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]->_quick && _sprites[i]->_callEachStepFl) { - switch (_sprites[i]->_eachStepProc) { + AnimationType *curSpr = _sprites[i]; + if (curSpr->_quick && curSpr->_callEachStepFl) { + switch (curSpr->_eachStepProc) { case kProcFollowAvvyY : followAvalotY(i); break; @@ -1191,10 +1214,12 @@ void Animation::animLink() { } void Animation::stopWalking() { - _sprites[0]->stopWalk(); + AnimationType *avvy = _sprites[0]; + + avvy->stopWalk(); _direction = kDirStopped; if (_vm->_alive) - _sprites[0]->_stepNum = 1; + avvy->_stepNum = 1; } /** @@ -1230,23 +1255,26 @@ void Animation::hideInCupboard() { * Returns true if you're within field "which". */ bool Animation::inField(byte which) { + AnimationType *avvy = _sprites[0]; + FieldType *curField = &_vm->_fields[which]; - int16 yy = _sprites[0]->_y + _sprites[0]->_info._yLength; + int16 yy = avvy->_y + avvy->_info._yLength; - return (_sprites[0]->_x >= curField->_x1) && (_sprites[0]->_x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); + return (avvy->_x >= curField->_x1) && (avvy->_x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } /** * Returns True if you're near a door. */ bool Animation::nearDoor() { - if (_vm->_fieldNum < 8) { + if (_vm->_fieldNum < 8) // there ARE no doors here! return false; - } - int16 ux = _sprites[0]->_x; - int16 uy = _sprites[0]->_y + _sprites[0]->_info._yLength; + AnimationType *avvy = _sprites[0]; + + int16 ux = avvy->_x; + int16 uy = avvy->_y + avvy->_info._yLength; for (int i = 8; i < _vm->_fieldNum; i++) { FieldType *curField = &_vm->_fields[i]; From cb5424376399e8f79a18800446916f601e02721c Mon Sep 17 00:00:00 2001 From: urukgit Date: Mon, 14 Oct 2013 21:59:06 +0200 Subject: [PATCH 1271/1332] AVALANCHE: Remove GraphicManager::fleshColors(), move everything from it to GraphicManager::init(). --- engines/avalanche/avalot.cpp | 2 -- engines/avalanche/graphics.cpp | 9 ++++----- engines/avalanche/graphics.h | 2 -- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index fdc2ddda6f39..b1c6f96f8b4f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -501,8 +501,6 @@ void AvalancheEngine::loadAlso(byte num) { void AvalancheEngine::loadRoom(byte num) { CursorMan.showMouse(false); - _graphics->fleshColors(); - Common::String filename = Common::String::format("place%d.avd", num); Common::File file; if (!file.open(filename)) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0414bf533371..bedb7f55061b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -77,6 +77,10 @@ void GraphicManager::init() { for (int i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); + // Set the "flesh colors": + g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); + g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); + _surface.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); _magics.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); _screen.create(kScreenWidth, kScreenHeight * 2, Graphics::PixelFormat::createFormatCLUT8()); @@ -192,11 +196,6 @@ void GraphicManager::drawToolbar() { file.close(); } -void GraphicManager::fleshColors() { - g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); - g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); -} - Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { Common::Point endPoint; const float convfac = M_PI / 180.0; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index a6be3af2832d..b45d37e1862b 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -66,8 +66,6 @@ class GraphicManager { void loadDigits(); void loadMouse(byte which); - void fleshColors(); - Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(Common::Point *p, Color color); From 2c09933641cf2d8fb2a8134746a2fcbef1534121 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Oct 2013 22:41:50 +0200 Subject: [PATCH 1272/1332] AVALANCHE: Remove StatType, reduce verbosity some more --- engines/avalanche/animation.cpp | 126 ++++++++++++++++++-------------- engines/avalanche/animation.h | 12 +-- engines/avalanche/dialogs.cpp | 5 +- 3 files changed, 81 insertions(+), 62 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 4bf2c69b3e74..a1d289d094a8 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -75,32 +75,32 @@ void AnimationType::init(byte spritenum, bool doCheck) { // Replace variable named 'soa' in the original code. inf.skip(2); - if (!_stat._name.empty()) - _stat._name.clear(); + if (!_name.empty()) + _name.clear(); byte nameSize = inf.readByte(); for (int i = 0; i < nameSize; i++) - _stat._name += inf.readByte(); + _name += inf.readByte(); inf.skip(12 - nameSize); byte commentSize = inf.readByte(); for (int i = 0; i < commentSize; i++) - _stat._comment += inf.readByte(); + _comment += inf.readByte(); inf.skip(16 - commentSize); - _stat._frameNum = inf.readByte(); + _frameNum = inf.readByte(); _info._xLength = inf.readByte(); _info._yLength = inf.readByte(); - _stat._seq = inf.readByte(); + _seq = inf.readByte(); _info._size = inf.readUint16LE(); - _stat._fgBubbleCol = (Color)inf.readByte(); - _stat._bgBubbleCol = (Color)inf.readByte(); - _stat._acciNum = inf.readByte(); + _fgBubbleCol = (Color)inf.readByte(); + _bgBubbleCol = (Color)inf.readByte(); + _acciNum = inf.readByte(); _animCount = 0; // = 1; _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (int i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _frameNum; i++) { _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; _info._mani[_animCount] = new ManiType[_info._size - 6]; for (int j = 0; j <= _info._yLength; j++) @@ -147,7 +147,7 @@ void AnimationType::draw() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = _facingDir * _stat._seq + _stepNum; + byte picnum = _facingDir * _seq + _stepNum; _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } @@ -247,7 +247,7 @@ void AnimationType::walk() { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; - if (_stepNum == _stat._seq) + if (_stepNum == _seq) _stepNum = 0; _count = 0; } @@ -362,7 +362,7 @@ void AnimationType::stopWalk() { void AnimationType::chatter() { _anim->_vm->_talkX = _x + _info._xLength / 2; _anim->_vm->_talkY = _y; - _anim->_vm->_graphics->setDialogColor(_stat._bgBubbleCol, _stat._fgBubbleCol); + _anim->_vm->_graphics->setDialogColor(_bgBubbleCol, _fgBubbleCol); } void AnimationType::remove() { @@ -370,7 +370,7 @@ void AnimationType::remove() { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (int i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _frameNum; i++) { assert(_animCount > 0); _animCount--; delete[] _info._mani[_animCount]; @@ -392,9 +392,11 @@ Animation::Animation(AvalancheEngine *vm) { Animation::~Animation() { for (int16 i = 0; i < kSpriteNumbMax; i++) { - if (_sprites[i]->_quick) - _sprites[i]->remove(); - delete(_sprites[i]); + AnimationType *curSpr = _sprites[i]; + + if (curSpr->_quick) + curSpr->remove(); + delete(curSpr); } } @@ -736,11 +738,13 @@ void Animation::catacombMove(byte ped) { } if ((_vm->_geidaFollows) && (ped > 0)) { - if (!_sprites[1]->_quick) // If we don't already have her... - _sprites[1]->init(5, true); // ...Load Geida. + AnimationType *spr1 = _sprites[1]; + + if (!spr1->_quick) // If we don't already have her... + spr1->init(5, true); // ...Load Geida. appearPed(1, geidaPed(ped)); - _sprites[1]->_callEachStepFl = true; - _sprites[1]->_eachStepProc = kProcGeida; + spr1->_callEachStepFl = true; + spr1->_eachStepProc = kProcGeida; } } @@ -776,16 +780,18 @@ void Animation::callSpecial(uint16 which) { if (!_arrowTriggered) { _arrowTriggered = true; + + AnimationType *spr1 = _sprites[1]; appearPed(1, 3); // The dart starts at ped 4, and... - _sprites[1]->walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). - _sprites[1]->_facingDir = kDirUp; // Only face. + spr1->walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). + spr1->_facingDir = kDirUp; // Only face. // Should call some kind of Eachstep procedure which will deallocate // the sprite when it hits the wall, and replace it with the chunk // graphic of the arrow buried in the plaster. */ // OK! - _sprites[1]->_callEachStepFl = true; - _sprites[1]->_eachStepProc = kProcArrow; + spr1->_callEachStepFl = true; + spr1->_eachStepProc = kProcArrow; } break; case 4: // This is the ghost room link. @@ -801,23 +807,28 @@ void Animation::callSpecial(uint16 which) { _vm->_dialogs->displayScrollChain('q', 35); _sprites[0]->remove(); //tr[1].vanishifstill:=true; + + AnimationType *spr1 = _sprites[1]; _vm->_background->draw(-1, -1, 1); _vm->_dialogs->displayScrollChain('q', 36); _vm->_tiedUp = true; _vm->_friarWillTieYouUp = false; - _sprites[1]->walkTo(2); - _sprites[1]->_vanishIfStill = true; - _sprites[1]->_doCheck = true; // One of them must have Check_Me switched on. + spr1->walkTo(2); + spr1->_vanishIfStill = true; + spr1->_doCheck = true; // One of them must have Check_Me switched on. _vm->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then. _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); } break; - case 6: // _vm->special 6: fall down oubliette. + case 6: { + // _vm->special 6: fall down oubliette. + AnimationType *avvy = _sprites[0]; _vm->_userMovesAvvy = false; - _sprites[0]->_moveX = 3; - _sprites[0]->_moveY = 0; - _sprites[0]->_facingDir = kDirRight; + avvy->_moveX = 3; + avvy->_moveY = 0; + avvy->_facingDir = kDirRight; _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); + } break; case 7: // _vm->special 7: stop falling down oubliette. _sprites[0]->_visible = false; @@ -831,21 +842,25 @@ void Animation::callSpecial(uint16 which) { break; case 8: // _vm->special 8: leave du Lustie's room. if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) { + AnimationType *spr1 = _sprites[1]; _vm->_dialogs->displayScrollChain('q', 63); - _sprites[1]->turn(kDirDown); - _sprites[1]->stopWalk(); - _sprites[1]->_callEachStepFl = false; // Geida + spr1->turn(kDirDown); + spr1->stopWalk(); + spr1->_callEachStepFl = false; // Geida _vm->gameOver(); } break; - case 9: // _vm->special 9: lose Geida to Robin Hood... + case 9: { + // _vm->special 9: lose Geida to Robin Hood... if (!_vm->_geidaFollows) return; // DOESN'T COUNT: no Geida. - _sprites[1]->_callEachStepFl = false; // She no longer follows Avvy around. - _sprites[1]->walkTo(3); // She walks to somewhere... + AnimationType *spr1 = _sprites[1]; + spr1->_callEachStepFl = false; // She no longer follows Avvy around. + spr1->walkTo(3); // She walks to somewhere... _sprites[0]->remove(); // Lose Avvy. _vm->_userMovesAvvy = false; _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); + } break; case 10: // _vm->special 10: transfer north in catacombs. if ((_vm->_catacombX == 4) && (_vm->_catacombY == 1)) { @@ -905,36 +920,38 @@ void Animation::callSpecial(uint16 which) { } void Animation::updateSpeed() { + AnimationType *avvy = _sprites[0]; // Given that you've just changed the speed in _speedX, this adjusts _moveX. - _sprites[0]->_moveX = (_sprites[0]->_moveX / 3) * _sprites[0]->_speedX; - _vm->_graphics->drawSpeedBar(_sprites[0]->_speedX); + avvy->_moveX = (avvy->_moveX / 3) * avvy->_speedX; + _vm->_graphics->drawSpeedBar(avvy->_speedX); } void Animation::setMoveSpeed(byte t, Direction dir) { + AnimationType *spr = _sprites[t]; switch (dir) { case kDirUp: - _sprites[t]->setSpeed(0, -_sprites[t]->_speedY); + spr->setSpeed(0, -spr->_speedY); break; case kDirDown: - _sprites[t]->setSpeed(0, _sprites[t]->_speedY); + spr->setSpeed(0, spr->_speedY); break; case kDirLeft: - _sprites[t]->setSpeed(-_sprites[t]->_speedX, 0); + spr->setSpeed(-spr->_speedX, 0); break; case kDirRight: - _sprites[t]->setSpeed(_sprites[t]->_speedX, 0); + spr->setSpeed(spr->_speedX, 0); break; case kDirUpLeft: - _sprites[t]->setSpeed(-_sprites[t]->_speedX, -_sprites[t]->_speedY); + spr->setSpeed(-spr->_speedX, -spr->_speedY); break; case kDirUpRight: - _sprites[t]->setSpeed(_sprites[t]->_speedX, -_sprites[t]->_speedY); + spr->setSpeed(spr->_speedX, -spr->_speedY); break; case kDirDownLeft: - _sprites[t]->setSpeed(-_sprites[t]->_speedX, _sprites[t]->_speedY); + spr->setSpeed(-spr->_speedX, spr->_speedY); break; case kDirDownRight: - _sprites[t]->setSpeed(_sprites[t]->_speedX, _sprites[t]->_speedY); + spr->setSpeed(spr->_speedX, spr->_speedY); break; default: break; @@ -956,20 +973,21 @@ void Animation::followAvalotY(byte tripnum) { return; AnimationType *tripSpr = _sprites[tripnum]; + AnimationType *spr1 = _sprites[1]; if (tripSpr->_homing) - tripSpr->_homingY = _sprites[1]->_y; + tripSpr->_homingY = spr1->_y; else { - if (tripSpr->_y < _sprites[1]->_y) + if (tripSpr->_y < spr1->_y) tripSpr->_y++; - else if (tripSpr->_y > _sprites[1]->_y) + else if (tripSpr->_y > spr1->_y) tripSpr->_y--; else return; if (tripSpr->_moveX == 0) { tripSpr->_stepNum++; - if (tripSpr->_stepNum == tripSpr->_stat._seq) + if (tripSpr->_stepNum == tripSpr->_seq) tripSpr->_stepNum = 0; tripSpr->_count = 0; } @@ -1050,7 +1068,7 @@ void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham. if (tripSpr->_y < toy) tripSpr->_y++; tripSpr->_stepNum++; - if (tripSpr->_stepNum == tripSpr->_stat._seq) + if (tripSpr->_stepNum == tripSpr->_seq) tripSpr->_stepNum = 0; } } @@ -1060,7 +1078,7 @@ void Animation::takeAStep(byte &tripnum) { if (tripSpr->_moveX == 0) { tripSpr->_stepNum++; - if (tripSpr->_stepNum == tripSpr->_stat._seq) + if (tripSpr->_stepNum == tripSpr->_seq) tripSpr->_stepNum = 0; tripSpr->_count = 0; } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index ac247b8256e8..297f9110a811 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -40,19 +40,19 @@ enum Direction { kDirStopped, kDirNone = 177 }; -struct StatType { +class AnimationType { +public: + SpriteInfo _info; + + // Former Stat structure Common::String _name; // Name of character. Common::String _comment; // Comment. byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. byte _acciNum; // The number according to Acci. (1=Avvy, etc.) -}; + // -class AnimationType { -public: - SpriteInfo _info; - StatType _stat; // Vital statistics. Direction _facingDir; byte _stepNum; int16 _x, _y; // Current xy coords. diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 84dbed45e55d..8a1031bda249 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1074,7 +1074,7 @@ void Dialogs::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]->_stat._acciNum == whom) { + if (_vm->_animation->_sprites[i]->_acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); noMatches = false; @@ -1134,7 +1134,8 @@ Common::String Dialogs::personSpeaks() { Common::String tmpStr; for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]->_quick && ((_vm->_animation->_sprites[i]->_stat._acciNum + 149) == _vm->_parser->_person)) { + AnimationType *curSpr = _vm->_animation->_sprites[i]; + if (curSpr->_quick && (curSpr->_acciNum + 149 == _vm->_parser->_person)) { tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); found = true; } From 652331a3a97a7f0505692085a16083ca0e925900 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Oct 2013 23:18:34 +0200 Subject: [PATCH 1273/1332] AVALANCHE: Remove some extra parenthesis in Animation --- engines/avalanche/animation.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index a1d289d094a8..a785c9c08f7d 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -144,7 +144,7 @@ void AnimationType::reset() { * @remarks Originally called 'andexor' */ void AnimationType::draw() { - if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) + if (_vanishIfStill && (_moveX == 0) && (_moveY == 0)) return; byte picnum = _facingDir * _seq + _stepNum; @@ -212,7 +212,7 @@ void AnimationType::walk() { byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . - if ((magicColor != 255) & (!_anim->_vm->_doingSpriteRun)) { + if ((magicColor != 255) & !_anim->_vm->_doingSpriteRun) { MagicType *magic = &_anim->_vm->_magics[magicColor]; switch (magic->_operation) { case kMagicExclaim: @@ -607,7 +607,7 @@ void Animation::catacombMove(byte ped) { case 0x1: _vm->_background->draw(-1, -1, 21); - if ((xy == 2051) && (_vm->_geidaFollows)) + if ((xy == 2051) && _vm->_geidaFollows) _vm->_magics[12]._operation = kMagicExclaim; else _vm->_magics[12]._operation = kMagicSpecial; // Right exit south. @@ -737,7 +737,7 @@ void Animation::catacombMove(byte ped) { break; // [1,1] : the other two. } - if ((_vm->_geidaFollows) && (ped > 0)) { + if (_vm->_geidaFollows && (ped > 0)) { AnimationType *spr1 = _sprites[1]; if (!spr1->_quick) // If we don't already have her... @@ -841,7 +841,7 @@ void Animation::callSpecial(uint16 which) { _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); break; case 8: // _vm->special 8: leave du Lustie's room. - if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) { + if (_vm->_geidaFollows && !_vm->_lustieIsAsleep) { AnimationType *spr1 = _sprites[1]; _vm->_dialogs->displayScrollChain('q', 63); spr1->turn(kDirDown); @@ -1026,9 +1026,9 @@ void Animation::arrowProcs(byte tripnum) { // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if (((tripSpr->_y + tripSpr->_info._yLength) >= avvy->_y) // A - && (tripSpr->_x <= (avvy->_x + avvy->_info._xLength)) // B - && ((tripSpr->_x + tripSpr->_info._xLength) >= avvy->_x)) { // C + if ((tripSpr->_y + tripSpr->_info._yLength >= avvy->_y) // A + && (tripSpr->_x <= avvy->_x + avvy->_info._xLength) // B + && (tripSpr->_x + tripSpr->_info._xLength >= avvy->_x)) { // C // OK, it's hit him... what now? _sprites[1]->_callEachStepFl = false; // prevent recursion. @@ -1164,8 +1164,7 @@ void Animation::drawSprites() { do { ok = true; for (int i = 0; i < 4; i++) { - if (((order[i] != -1) && (order[i + 1] != -1)) - && (_sprites[order[i]]->_y > _sprites[order[i + 1]]->_y)) { + if ((order[i] != -1) && (order[i + 1] != -1) && (_sprites[order[i]]->_y > _sprites[order[i + 1]]->_y)) { // Swap them! temp = order[i]; order[i] = order[i + 1]; From c9aa875c8de12a9851a66433654f00c60a14ca14 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Oct 2013 00:48:49 +0300 Subject: [PATCH 1274/1332] FULLPIPE: More code for MovGraph2::method4C() --- engines/fullpipe/motion.cpp | 129 ++++++++++++++++++------------------ engines/fullpipe/motion.h | 22 ++++++ 2 files changed, 85 insertions(+), 66 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 325d366a6c0b..1e4dd966868a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -365,6 +365,29 @@ int MovGraph2::getItemIndexByGameObjectId(int objectId) { return -1; } +int MovGraph2::getItemSubIndexByStaticsId(int idx, int staticsId) { + for (int i = 0; i < 4; i++) + if (_items[idx]->_subItems[i]._staticsId1 == staticsId || _items[idx]->_subItems[i]._staticsId2 == staticsId) + return i; + + return -1; +} + +int MovGraph2::getItemSubIndexByMovementId(int idx, int movId) { + for (int i = 0; i < 4; i++) + if (_items[idx]->_subItems[i]._walk[0]._movementId == movId || _items[idx]->_subItems[i]._turn[0]._movementId == movId || + _items[idx]->_subItems[i]._turnS[0]._movementId == movId) + return i; + + return -1; +} + +int MovGraph2::getItemSubIndexByMGM(int idx, StaticANIObject *ani) { + warning("STUB: MovGraph2::getItemSubIndexByMGM()"); + + return -1; +} + bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) { item->_obj = obj; item->_objectId = obj->_id; @@ -529,16 +552,14 @@ MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int } MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int fuzzySearch, int staticsId) { - warning("STUB: MovGraph2::method4C()"); -#if 0 LinkInfo linkInfoDest; LinkInfo linkInfoSource; MovInfo1 movInfo1; PicAniInfo picAniInfo; ObList tempLinkList; + Common::Point point; int idx = getItemIndexByGameObjectId(obj->_id); - ex = idx_; if (idx < 0) return 0; @@ -551,7 +572,7 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int point.x = 0; - GameObject_getPicAniInfo(obj, &picAniInfo); + obj->getPicAniInfo(&picAniInfo); int idxsub; @@ -575,7 +596,7 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int if (subMgm) { obj->_messageQueueId = 0; - obj->changeStatics2(_items[idx]->_subItems[idxsub]->_staticsId1); + obj->changeStatics2(_items[idx]->_subItems[idxsub]._staticsId1); newx = obj->_ox; newy = obj->_oy; } else { @@ -595,76 +616,52 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int obj->setOXY(newx, newy); } - v25 = obj->_oy; - y = v25; + int y = obj->_oy; if (obj->_ox == xpos && obj->_oy == ypos) { - MessageQueue *mq = new MessageQueue(g_globalMessageQueueList->compact()); + g_fullpipe->_globalMessageQueueList->compact(); + + MessageQueue *mq = new MessageQueue(); if (staticsId && obj->_statics->_staticsId != staticsId) { - point.x = getItem1IndexByStaticsId(idx, staticsId); - if (point.x == -1) { - GameObject_setPicAniInfo(obj, &picAniInfo); + int idxwalk = getItemSubIndexByStaticsId(idx, staticsId); + if (idxwalk == -1) { + obj->setPicAniInfo(&picAniInfo); + return 0; } - ex = (int)operator new(sizeof(ExCommand)); - v71.state = 1; - if (ex) - v27 = ExCommand_ctor( - (ExCommand *)ex, - picAniInfo.objectId, - 1, - *((_DWORD *)this->items.CObArray.m_pData[offsetof(MovGraph2, movGraph)] - + 186 * idx - + 46 * idxsub - + 4 * (point.x + 8)), - 0, - 0, - 0, - 1, - 0, - 0, - 0); - else - v27 = 0; - v28 = picAniInfo.field_8; - v27->msg.field_24 = 1; - v27->msg.keyCode = v28; - v27->excFlags |= 2u; - v71.state = -1; - CPtrList::AddTail(&v62->exCommands, v27); + + ExCommand *ex = new ExCommand(picAniInfo.objectId, 1, _items[idx]->_subItems[idxsub]._walk[idxwalk]._movementId, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_24 = 1; + ex->_keyCode = picAniInfo.field_8; + ex->_excFlags |= 2; + + mq->_exCommands.push_back(ex); } else { - v29 = (ExCommand *)operator new(sizeof(ExCommand)); - point.x = (int)v29; - v71.state = 2; - if (v29) - v30 = ExCommand_ctor(v29, picAniInfo.objectId, 22, obj->statics->staticsId, 0, 0, 0, 1, 0, 0, 0); - else - v30 = 0; - v31 = v62; - v30->msg.keyCode = picAniInfo.field_8; - v32 = (int)&v31->exCommands; - v33 = v30->excFlags | 3; - v71.state = -1; - v30->excFlags = v33; - CPtrList::AddTail(&v31->exCommands, v30); - v34 = (ExCommand *)operator new(sizeof(ExCommand)); - point.x = (int)v34; - v71.state = 3; - if (v34) - v35 = ExCommand_ctor(v34, picAniInfo.objectId, 5, -1, obj->GameObject.ox, obj->GameObject.oy, 0, 1, 0, 0, 0); - else - v35 = 0; - v36 = v35->excFlags; - v35->msg.field_14 = -1; - v35->msg.keyCode = picAniInfo.field_8; - v71.state = -1; - v35->excFlags = v36 | 3; - CPtrList::AddTail(v32, v35); + ExCommand *ex = new ExCommand(picAniInfo.objectId, 22, obj->_statics->_staticsId, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = picAniInfo.field_8; + ex->_excFlags |= 3; + mq->_exCommands.push_back(ex); + + ex = new ExCommand(picAniInfo.objectId, 5, -1, obj->_ox, obj->_oy, 0, 1, 0, 0, 0); + + ex->_field_14 = -1; + ex->_keyCode = picAniInfo.field_8; + ex->_excFlags |= 3; + mq->_exCommands.push_back(ex); } - GameObject_setPicAniInfo(obj, &picAniInfo); - return v62; + + obj->setPicAniInfo(&picAniInfo); + + return mq; } + + warning("STUB: MovGraph2::method4C() %d", y); + +#if 0 + linkInfoSource.node = findNode(obj->_ox, obj->_oy, 0); if (!linkInfoSource.node) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 8754f07ba1a7..86e5d383be9f 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -293,6 +293,10 @@ class MovGraph2 : public MovGraph { virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); int getItemIndexByGameObjectId(int objectId); + int getItemSubIndexByStaticsId(int index, int staticsId); + int getItemSubIndexByMovementId(int index, int movId); + int getItemSubIndexByMGM(int idx, StaticANIObject *ani); + bool initDirections(StaticANIObject *obj, MovGraph2Item *item); }; @@ -308,6 +312,24 @@ class MctlConnectionPoint : public CObject { int _motionControllerObj; }; +struct LinkInfo { + int link; + int node; +}; + +struct MovInfo1 { + int field_0; + Common::Point pt1; + Common::Point pt2; + int distance1; + int distance2; + int subIndex; + int item1Index; + int items; + int itemsCount; + int flags; +}; + } // End of namespace Fullpipe #endif /* FULLPIPE_MOTION_H */ From 597690ae9d401844a6e842654e368710d60b2fc8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Oct 2013 00:09:08 +0200 Subject: [PATCH 1275/1332] AVALANCHE: Fix memory corruption in background (drawpicture) blitting --- engines/avalanche/graphics.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index bedb7f55061b..151879d6c718 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -563,8 +563,17 @@ void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. - for (uint16 y = 0; y < picture.h; y++) { - for (uint16 x = 0; x < picture.w; x++) + uint16 maxX = picture.w; + uint16 maxY = picture.h; + + if (destX + maxX > target.w) + maxX = target.w - destX; + + if (destY + maxY > target.h) + maxY = target.h - destY; + + for (uint16 y = 0; y < maxY; y++) { + for (uint16 x = 0; x < maxX; x++) *(byte *)target.getBasePtr(x + destX, y + destY) = *(const byte *)picture.getBasePtr(x, y); } } From 6437179de324d60343e7a4db8696dfdc513a4956 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Oct 2013 01:07:26 +0200 Subject: [PATCH 1276/1332] AVALANCHE: Get rid of SpriteInfo --- engines/avalanche/animation.cpp | 58 ++++++++++++++++----------------- engines/avalanche/animation.h | 7 +++- engines/avalanche/avalot.cpp | 4 +-- engines/avalanche/graphics.cpp | 14 ++++---- engines/avalanche/graphics.h | 12 ++----- 5 files changed, 46 insertions(+), 49 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index a785c9c08f7d..71070b2af74f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -88,24 +88,24 @@ void AnimationType::init(byte spritenum, bool doCheck) { inf.skip(16 - commentSize); _frameNum = inf.readByte(); - _info._xLength = inf.readByte(); - _info._yLength = inf.readByte(); + _xLength = inf.readByte(); + _yLength = inf.readByte(); _seq = inf.readByte(); - _info._size = inf.readUint16LE(); + _size = inf.readUint16LE(); _fgBubbleCol = (Color)inf.readByte(); _bgBubbleCol = (Color)inf.readByte(); _acciNum = inf.readByte(); _animCount = 0; // = 1; - _info._xWidth = _info._xLength / 8; - if ((_info._xLength % 8) > 0) - _info._xWidth++; + _xWidth = _xLength / 8; + if ((_xLength % 8) > 0) + _xWidth++; for (int i = 0; i < _frameNum; i++) { - _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; - _info._mani[_animCount] = new ManiType[_info._size - 6]; - for (int j = 0; j <= _info._yLength; j++) - inf.read((*_info._sil[_animCount])[j], _info._xWidth); - inf.read(*_info._mani[_animCount], _info._size - 6); + _sil[_animCount] = new SilType[11 * (_yLength + 1)]; + _mani[_animCount] = new ManiType[_size - 6]; + for (int j = 0; j <= _yLength; j++) + inf.read((*_sil[_animCount])[j], _xWidth); + inf.read(*_mani[_animCount], _size - 6); _animCount++; } @@ -149,7 +149,7 @@ void AnimationType::draw() { byte picnum = _facingDir * _seq + _stepNum; - _anim->_vm->_graphics->drawSprite(_info, picnum, _x, _y); + _anim->_vm->_graphics->drawSprite(this, picnum, _x, _y); } /** @@ -183,7 +183,7 @@ void AnimationType::appear(int16 wx, int16 wy, Direction wf) { bool AnimationType::checkCollision() { for (int i = 0; i < _anim->kSpriteNumbMax; i++) { AnimationType *spr = _anim->_sprites[i]; - if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) + if (spr->_quick && (spr->_id != _id) && (_x + _xLength > spr->_x) && (_x < spr->_x + spr->_xLength) && (spr->_y == _y)) return true; } @@ -209,7 +209,7 @@ void AnimationType::walk() { return; } - byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_cp], _y, _info._yLength) - 1; + byte magicColor = _anim->checkFeet(_x, _x + _xLength, _oldY[_anim->_vm->_cp], _y, _yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((magicColor != 255) & !_anim->_vm->_doingSpriteRun) { @@ -283,8 +283,8 @@ void AnimationType::walkTo(byte pedNum) { PedType *curPed = &_anim->_vm->_peds[pedNum]; setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); - _homingX = curPed->_x - _info._xLength / 2; - _homingY = curPed->_y - _info._yLength; + _homingX = curPed->_x - _xLength / 2; + _homingY = curPed->_y - _yLength; _homing = true; } @@ -360,21 +360,21 @@ void AnimationType::stopWalk() { * Sets up talk vars. */ void AnimationType::chatter() { - _anim->_vm->_talkX = _x + _info._xLength / 2; + _anim->_vm->_talkX = _x + _xLength / 2; _anim->_vm->_talkY = _y; _anim->_vm->_graphics->setDialogColor(_bgBubbleCol, _fgBubbleCol); } void AnimationType::remove() { _animCount--; - _info._xWidth = _info._xLength / 8; - if ((_info._xLength % 8) > 0) - _info._xWidth++; + _xWidth = _xLength / 8; + if ((_xLength % 8) > 0) + _xWidth++; for (int i = 0; i < _frameNum; i++) { assert(_animCount > 0); _animCount--; - delete[] _info._mani[_animCount]; - delete[] _info._sil[_animCount]; + delete[] _mani[_animCount]; + delete[] _sil[_animCount]; } _quick = false; @@ -961,7 +961,7 @@ void Animation::setMoveSpeed(byte t, Direction dir) { void Animation::appearPed(byte sprNum, byte pedNum) { AnimationType *curSpr = _sprites[sprNum]; PedType *curPed = &_vm->_peds[pedNum]; - curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); + curSpr->appear(curPed->_x - curSpr->_xLength / 2, curPed->_y - curSpr->_yLength, curPed->_direction); setMoveSpeed(sprNum, curPed->_direction); } @@ -1026,9 +1026,9 @@ void Animation::arrowProcs(byte tripnum) { // This is so if: a) the bottom of the arrow is below Avvy's head, // b) the left of the arrow is left of the right of Avvy's head, and // c) the right of the arrow is right of the left of Avvy's head. - if ((tripSpr->_y + tripSpr->_info._yLength >= avvy->_y) // A - && (tripSpr->_x <= avvy->_x + avvy->_info._xLength) // B - && (tripSpr->_x + tripSpr->_info._xLength >= avvy->_x)) { // C + if ((tripSpr->_y + tripSpr->_yLength >= avvy->_y) // A + && (tripSpr->_x <= avvy->_x + avvy->_xLength) // B + && (tripSpr->_x + tripSpr->_xLength >= avvy->_x)) { // C // OK, it's hit him... what now? _sprites[1]->_callEachStepFl = false; // prevent recursion. @@ -1275,7 +1275,7 @@ bool Animation::inField(byte which) { AnimationType *avvy = _sprites[0]; FieldType *curField = &_vm->_fields[which]; - int16 yy = avvy->_y + avvy->_info._yLength; + int16 yy = avvy->_y + avvy->_yLength; return (avvy->_x >= curField->_x1) && (avvy->_x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } @@ -1291,7 +1291,7 @@ bool Animation::nearDoor() { AnimationType *avvy = _sprites[0]; int16 ux = avvy->_x; - int16 uy = avvy->_y + avvy->_info._yLength; + int16 uy = avvy->_y + avvy->_yLength; for (int i = 8; i < _vm->_fieldNum; i++) { FieldType *curField = &_vm->_fields[i]; @@ -1439,7 +1439,7 @@ void Animation::synchronize(Common::Serializer &sz) { sz.syncAsByte(spr->_visible); sz.syncAsByte(spr->_homing); sz.syncAsByte(spr->_count); - sz.syncAsByte(spr->_info._xWidth); + sz.syncAsByte(spr->_xWidth); sz.syncAsByte(spr->_speedX); sz.syncAsByte(spr->_speedY); sz.syncAsByte(spr->_animCount); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 297f9110a811..5dbaa5afd7f0 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -42,7 +42,12 @@ enum Direction { class AnimationType { public: - SpriteInfo _info; + // Former SpriteInfo structure + byte _xWidth; + byte _xLength, _yLength; + ManiType *_mani[24]; + SilType *_sil[24]; + uint16 _size; // The size of one picture. // Former Stat structure Common::String _name; // Name of character. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b1c6f96f8b4f..352ac6a8523e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1140,14 +1140,14 @@ void AvalancheEngine::guideAvvy(Common::Point cursorPos) { AnimationType *avvy = _animation->_sprites[0]; if (cursorPos.x < avvy->_x) what = 1; - else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) + else if (cursorPos.x > (avvy->_x + avvy->_xLength)) what = 2; else what = 0; // On top if (cursorPos.y < avvy->_y) what += 3; - else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) + else if (cursorPos.y > (avvy->_y + avvy->_yLength)) what += 6; switch (what) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 151879d6c718..0b1659078543 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -536,11 +536,11 @@ byte GraphicManager::getScreenColor(Common::Point pos) { return *(byte *)_surface.getBasePtr(pos.x, pos.y / 2); } -void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { +void GraphicManager::drawSprite(AnimationType *sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the sprite blank. - for (int j = 0; j < sprite._yLength; j++) { - for (int i = 0; i < sprite._xLength; i++) { - if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) + for (int j = 0; j < sprite->_yLength; j++) { + for (int i = 0; i < sprite->_xLength; i++) { + if (((*sprite->_sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *(byte *)_surface.getBasePtr(x + i, y + j) = 0; } } @@ -548,10 +548,10 @@ void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (int j = 0; j < sprite._yLength; j++) { + for (int j = 0; j < sprite->_yLength; j++) { for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. - for (uint16 i = 0; i < sprite._xLength; i += 8) { - byte pixel = (*sprite._mani[picnum])[maniPos++]; + for (uint16 i = 0; i < sprite->_xLength; i += 8) { + byte pixel = (*sprite->_mani[picnum])[maniPos++]; for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index b45d37e1862b..4af6d4e8dbb6 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -36,21 +36,13 @@ namespace Avalanche { class AvalancheEngine; +class AnimationType; struct SpriteType; typedef byte FontType[256][16]; typedef byte ManiType[2049]; typedef byte SilType[51][11]; // 35, 4 -class SpriteInfo { -public: - byte _xWidth; - byte _xLength, _yLength; - ManiType *_mani[24]; - SilType *_sil[24]; - uint16 _size; // The size of one picture. -}; - struct MouseHotspotType { int16 _horizontal, _vertical; }; @@ -95,7 +87,7 @@ class GraphicManager { // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data Graphics::Surface loadPictureRaw(Common::File &file, uint16 width, uint16 height); - void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y); + void drawSprite(AnimationType *sprite, byte picnum, int16 x, int16 y); void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); void drawThinkPic(Common::String filename, int id); void drawToolbar(); From 7a97c992de67152514886f80f3cf4f2f3686d3d4 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 8 Oct 2013 10:08:09 -0500 Subject: [PATCH 1277/1332] ZVISION: Use credits.pl to update AUTHORS and credits.h --- AUTHORS | 4 +++- devtools/credits.pl | 2 +- gui/credits.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 4a249a27d3eb..24516141a4a8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -239,7 +239,7 @@ ScummVM Team Wintermute: Einar Johan T. Somaaen - + ZVision: Adrian Astley @@ -612,6 +612,8 @@ Special thanks to Jimmi Thogersen - For ScummRev, and much obscure code/documentation Tristan - For additional work on the original MT-32 emulator James Woodcock - Soundtrack enhancements + Anton Yartsev - For the original re-implementation of the ZVision + engine Tony Warriner and everyone at Revolution Software Ltd. for sharing with us the source of some of their brilliant games, allowing us to release diff --git a/devtools/credits.pl b/devtools/credits.pl index 57336e2895e4..e7828d8b18ef 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -1158,7 +1158,7 @@ sub add_paragraph { add_person("Jimmi Thøgersen", "", "For ScummRev, and much obscure code/documentation"); add_person("", "Tristan", "For additional work on the original MT-32 emulator"); add_person("James Woodcock", "", "Soundtrack enhancements"); - add_person("Anton Yartsev", "Zidane", "For the original re-implementation of the ZVison engine"); + add_person("Anton Yartsev", "Zidane", "For the original re-implementation of the ZVision engine"); end_persons(); add_paragraph( diff --git a/gui/credits.h b/gui/credits.h index 3a4d7769f6c7..b4d16808426b 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -297,6 +297,9 @@ static const char *credits[] = { "A0""Einar Johan T. Somaaen", "C0""Einar Johan T. S\370m\345en", "", +"C1""ZVision", +"C0""Adrian Astley", +"", "", "C1""Backend Teams", "C1""Android", @@ -769,6 +772,8 @@ static const char *credits[] = { "C2""For additional work on the original MT-32 emulator", "C0""James Woodcock", "C2""Soundtrack enhancements", +"C0""Anton Yartsev", +"C2""For the original re-implementation of the ZVision engine", "C0""Tony Warriner and everyone at Revolution Software Ltd. for sharing with us the source of some of their brilliant games, allowing us to release Beneath a Steel Sky as freeware... and generally being supportive above and beyond the call of duty.", "C0""", "C0""John Passfield and Steve Stamatiadis for sharing the source of their classic title, Flight of the Amazon Queen and also being incredibly supportive.", From acc7cd58a203fb0c1991c3b8b35c2f296b739f06 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 14 Oct 2013 22:58:29 -0400 Subject: [PATCH 1278/1332] TSAGE: Beginnings of R2R voice streaming --- engines/tsage/ringworld2/ringworld2_logic.cpp | 3 + .../tsage/ringworld2/ringworld2_scenes0.cpp | 2 +- engines/tsage/sound.cpp | 203 ++++++++++++++++++ engines/tsage/sound.h | 47 +++- 4 files changed, 247 insertions(+), 8 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index bd908504adb9..90df72ab328c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -596,6 +596,9 @@ void SceneExt::loadBlankScene() { void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { SceneHandler::postInit(OwnerList); + + if (!R2_GLOBALS._playStream.setFile("SND4K.RES")) + warning("Could not find SND4K.RES voice file"); } void SceneHandlerExt::process(Event &event) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index bdac160163c4..5e4b4e419173 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -836,7 +836,7 @@ void Scene125::process(Event &event) { void Scene125::dispatch() { if (_soundCount) - R2_GLOBALS._playStream.proc1(); + R2_GLOBALS._playStream.dispatch(); Scene::dispatch(); } diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index b9567cece2ac..a5480fe6b44a 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -1540,6 +1540,23 @@ void Sound::play(int soundNum) { _soundManager->addToPlayList(this); } +bool Sound::playBuffers(const byte *soundData) { + prime(-2); + _soundManager->addToPlayList(this); + + debug(1, "TODO: Sound::checkCannels"); + if (/* _soundManager.checkChannels() */ true) { + uint32 size = READ_UINT32(soundData + 4); + if (size == 0 || size > 0xffff) + error("Sound::playBuffers() called with illegal buffer length"); + + warning("TODO: Implement Sound::primeSoundData for voice playback"); + } else { + stop(); + return false; + } +} + void Sound::stop() { g_globals->_soundManager.removeFromPlayList(this); _unPrime(); @@ -2505,6 +2522,192 @@ void ASoundExt::changeSound(int soundNum) { /*--------------------------------------------------------------------------*/ +void PlayStream::ResFileData::load(Common::SeekableReadStream &stream) { + // Validate that it's the correct data file + char header[4]; + stream.read(&header[0], 4); + if (strncmp(header, "SPAM", 4)) + error("Invalid voice resource data"); + + _fileChunkSize = stream.readUint32LE(); + _field8 = stream.readUint16LE(); + _indexSize = stream.readUint16LE(); + _chunkSize = stream.readUint16LE(); + + stream.skip(20); +} + +PlayStream::PlayStream(): EventHandler() { + _index = NULL; + _chunks[0] = _chunks[1] = NULL; + _voiceNum = 0; + _currentChunkIndex = 0; + _nextChunkIndex = 0; + _endAction = NULL; + _field2F0 = _field2FA = 0; +} + +PlayStream::~PlayStream() { + remove(); +} + +bool PlayStream::setFile(const Common::String &filename) { + remove(); + + // Open the resource file for access + if (!_file.open(filename)) + return false; + + // Load header + _resData.load(_file); + + // Load the index + _index = new uint16[_resData._indexSize / 2]; + for (uint i = 0; i < (_resData._indexSize / 2); ++i) + _index[i] = _file.readUint16LE(); + + // Allocate space for loading voice chunks into + _chunks[0] = new byte[_resData._chunkSize]; + _chunks[1] = new byte[_resData._chunkSize]; + + // Initialise variables + _voiceNum = 0; + _currentChunkIndex = _nextChunkIndex = 0; + + return true; +} + +bool PlayStream::play(int voiceNum, EventHandler *endAction) { + uint32 offset = getFileOffset(_index, _resData._fileChunkSize, voiceNum); + if (offset) { + _voiceNum = 0; + _currentChunkIndex = _nextChunkIndex = 0; + if (_sound.isPlaying()) + _sound.stop(); + + _file.seek(offset); + _file.read(_chunks[0], _resData._chunkSize); + _file.read(_chunks[1], _resData._chunkSize); + + _currentChunkIndex = 0; + _nextChunkIndex = 1; + _voiceNum = voiceNum; + _endAction = endAction; + + if (!strncmp((const char *)_chunks[_currentChunkIndex], "FEED", 4)) { + // Valid sound data found + const byte *data = _chunks[_currentChunkIndex]; + + _field2F0 = _field2FA = READ_UINT16(data + 10); + + //_fnP = proc2; + _field300 = this; + _soundData = data + 16; + _streamSize = READ_LE_UINT16(data + 4) - 16; + + // Start playing the sound data + if (!_sound.playBuffers(_soundData)) { + _voiceNum = 0; + _currentChunkIndex = _nextChunkIndex = 0; + } + + return true; + } + } + + // If it reaches this point, no valid voice data found + return false; +} + +void PlayStream::stop() { + _voiceNum = 0; + _currentChunkIndex = _nextChunkIndex = 0; + _endAction = NULL; + + if (_sound.isPlaying()) + _sound.stop(); +} + +bool PlayStream::isPlaying() const { + return _voiceNum != 0; +} + +void PlayStream::remove() { + stop(); + _file.close(); + + // Free data buffers + delete[] _index; + delete[] _chunks[0]; + delete[] _chunks[1]; + _index = NULL; + _chunks[0] = _chunks[1] = NULL; + + _endAction = NULL; + _voiceNum = 0; + _currentChunkIndex = 0; + _nextChunkIndex = 0; +} + +void PlayStream::dispatch() { + if ((_voiceNum != 0) && (_currentChunkIndex == _nextChunkIndex)) { + if (READ_LE_UINT16(_chunks[_currentChunkIndex] + 6) != 0) { + uint32 bytesRead = _file.read(_chunks[_nextChunkIndex ^ 1], _resData._chunkSize); + + if (bytesRead != _resData._chunkSize) { + byte *data = _chunks[_currentChunkIndex]; + Common::fill(data, data + 128, 0); + + _voiceNum = 0; + } + + _nextChunkIndex ^= 1; + } else if (!isPlaying()) { + // If voice has finished playing, reset fields + EventHandler *endAction = _endAction; + _endAction = NULL; + _voiceNum = 0; + _currentChunkIndex = 0; + _nextChunkIndex = 0; + + if (endAction) + // Signal given end action + endAction->signal(); + } + } +} + +uint32 PlayStream::getFileOffset(const uint16 *data, int count, int voiceNum) { + assert(data); + int bitsIndex = voiceNum & 7; + int byteIndex = voiceNum >> 3; + int shiftAmount = bitsIndex * 2; + int bitMask = 3 << shiftAmount; + int v = (data[byteIndex] & bitMask) >> shiftAmount; + uint32 offset = 0; + + if (!v) + return 0; + + // Loop to figure out offsets from indexes skipped over + for (int i = 0; i < (voiceNum >> 3); ++i) { + for (int bit = 0; bit < 16; bit += 2) + offset += ((data[i] >> bit) & 3) * count; + } + + // Bit index loop + for (int i = 0; i < bitsIndex; --i) + offset += ((data[byteIndex] >> (i * 2)) & 3) * count; + + return offset; +} + +void PlayStream::stream() { + // TODO +} + +/*--------------------------------------------------------------------------*/ + SoundDriver::SoundDriver() { _driverResID = 0; _minVersion = _maxVersion = 0; diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 2f59afb49b12..9779f3c03c97 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -259,6 +259,7 @@ class SoundManager : public SaveListener { class Sound: public EventHandler { private: void _prime(int soundResID, bool dontQueue); + void _primeBuffer(const byte *soundData); void _unPrime(); public: bool _stoppedAsynchronously; @@ -315,6 +316,7 @@ class Sound: public EventHandler { void orientAfterRestore(); void play(int soundResID); + bool playBuffers(const byte *soundData); void stop(); void prime(int soundResID); void unPrime(); @@ -414,15 +416,46 @@ class ASoundExt: public ASound { virtual void signal(); }; -class PlayStream { -public: +class PlayStream: public EventHandler { + class ResFileData { + public: + int _fileChunkSize; + int _field8; + uint _indexSize; + uint _chunkSize; + + void load(Common::SeekableReadStream &stream); + }; + typedef void (PlayStream::*FunctionPtr)(); +private: + Common::File _file; + ResFileData _resData; Sound _sound; + uint16 *_index; + byte *_chunks[2]; + const byte *_soundData; + int _voiceNum; + int _currentChunkIndex; + int _nextChunkIndex; + EventHandler *_endAction; + EventHandler *_field300; + int _field2F0, _field2FA; + int _streamSize; + FunctionPtr _streamFn; + + void stream(); + static uint32 getFileOffset(const uint16 *data, int count, int voiceNum); +public: + PlayStream(); + virtual ~PlayStream(); - void setFile(const Common::String &filename) {} - bool play(int soundNum, EventHandler *endAction) { return false; } - void stop() {} - void proc1() {} - bool isPlaying() const { return false; } + bool setFile(const Common::String &filename); + bool play(int voiceNum, EventHandler *endAction); + void stop(); + bool isPlaying() const; + + virtual void remove(); + virtual void dispatch(); }; #define ADLIB_CHANNEL_COUNT 9 From 1f943c03627a98984b6199790e67515f23b35df6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Oct 2013 08:10:37 +0200 Subject: [PATCH 1279/1332] AVALANCHE: Fix crash when entering inn, add safeguards --- engines/avalanche/background.cpp | 4 +++- engines/avalanche/graphics.cpp | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 54ab459d415b..fc172871cc75 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -109,7 +109,7 @@ void Background::update() { break; default: if (_vm->_roomTime % 200 <= 178) { // Normally. - byte direction = 0; + byte direction = 1; uint16 angle = _vm->bearing(1); if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) direction = 3; @@ -315,6 +315,8 @@ void Background::release() { * @remarks Originally called 'show_one' */ void Background::draw(int16 destX, int16 destY, byte sprId) { + assert(sprId < 40); + if (_sprites[sprId]._x > kOnDisk) { if (destX < 0) { destX = _sprites[sprId]._x * 8; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0b1659078543..b3ba95fd8014 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -540,8 +540,10 @@ void GraphicManager::drawSprite(AnimationType *sprite, byte picnum, int16 x, int // First we make the pixels of the sprite blank. for (int j = 0; j < sprite->_yLength; j++) { for (int i = 0; i < sprite->_xLength; i++) { - if (((*sprite->_sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) - *(byte *)_surface.getBasePtr(x + i, y + j) = 0; + if ((x + i < _surface.w) && (y + j < _surface.h)) { + if (((*sprite->_sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) + *(byte *)_surface.getBasePtr(x + i, y + j) = 0; + } } } @@ -553,8 +555,10 @@ void GraphicManager::drawSprite(AnimationType *sprite, byte picnum, int16 x, int for (uint16 i = 0; i < sprite->_xLength; i += 8) { byte pixel = (*sprite->_mani[picnum])[maniPos++]; for (int bit = 0; bit < 8; bit++) { - byte pixelBit = (pixel >> bit) & 1; - *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); + if ((x + i + 7 < _surface.w) && (y + j < _surface.h)) { + byte pixelBit = (pixel >> bit) & 1; + *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); + } } } } From d01e502d8f3f5ffcab272538d23c48b8bacfda7b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Oct 2013 09:10:57 +0300 Subject: [PATCH 1280/1332] FULLPIPE: MovGraph2::method4C() con't --- engines/fullpipe/motion.cpp | 127 +++++++++++++++++++++--------------- engines/fullpipe/motion.h | 59 +++++++++-------- 2 files changed, 107 insertions(+), 79 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 1e4dd966868a..4e708c1459ae 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -116,13 +116,13 @@ void MctlCompound::freeItems() { warning("STUB: MctlCompound::freeItems()"); } -MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { warning("STUB: MctlCompound::method34()"); return 0; } -MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { int match1 = -1; int match2 = -1; @@ -154,7 +154,7 @@ MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, return 0; if (match1 == match2) - return _motionControllers[match1]->_motionControllerObj->method4C(subj, xpos, ypos, fuzzySearch, staticsId); + return _motionControllers[match1]->_motionControllerObj->method4C(subj, xpos, ypos, fuzzyMatch, staticsId); MctlConnectionPoint *closestP = findClosestConnectionPoint(subj->_ox, subj->_oy, match1, xpos, ypos, match2, &match2); @@ -174,7 +174,7 @@ MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, ex = new ExCommand(subj->_id, 51, 0, xpos, ypos, 0, 1, 0, 0, 0); - ex->_field_20 = fuzzySearch; + ex->_field_20 = fuzzyMatch; ex->_keyCode = subj->_okeyCode; ex->_excFlags |= 2; @@ -285,7 +285,7 @@ int MovGraph::method2C() { return 0; } -MessageQueue *MovGraph::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MovGraph::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { warning("STUB: MovGraph::method34()"); return 0; @@ -309,7 +309,7 @@ int MovGraph::method44() { return 0; } -MessageQueue *MovGraph::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MovGraph::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { warning("STUB: MovGraph::method4C()"); return 0; @@ -321,7 +321,7 @@ int MovGraph::method50() { return 0; } -double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzzySearch) { +double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch) { int n1x = link->_movGraphNode1->_x; int n1y = link->_movGraphNode1->_y; int n2x = link->_movGraphNode2->_x; @@ -336,7 +336,7 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz double res = sqrt(1.0 - dist2 * dist2) * dist1; if (dist2 <= 0.0 || distm >= link->_distance) { - if (fuzzySearch) { + if (fuzzyMatch) { if (dist2 > 0.0) { if (distm >= link->_distance) { point->x = n2x; @@ -545,18 +545,17 @@ void MovGraph2::freeItems() { warning("STUB: MovGraph2::freeItems()"); } -MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { warning("STUB: MovGraph2::method34()"); return 0; } -MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int fuzzySearch, int staticsId) { +MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) { LinkInfo linkInfoDest; LinkInfo linkInfoSource; MovInfo1 movInfo1; PicAniInfo picAniInfo; - ObList tempLinkList; Common::Point point; int idx = getItemIndexByGameObjectId(obj->_id); @@ -616,8 +615,6 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int obj->setOXY(newx, newy); } - int y = obj->_oy; - if (obj->_ox == xpos && obj->_oy == ypos) { g_fullpipe->_globalMessageQueueList->compact(); @@ -658,10 +655,6 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int return mq; } - warning("STUB: MovGraph2::method4C() %d", y); - -#if 0 - linkInfoSource.node = findNode(obj->_ox, obj->_oy, 0); if (!linkInfoSource.node) { @@ -671,7 +664,7 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int linkInfoSource.link = findLink2(obj->_ox, obj->_oy); if (!linkInfoSource.link) { - obj->setPicAniInfo(picAniInfo); + obj->setPicAniInfo(&picAniInfo); return 0; } @@ -683,55 +676,61 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int if (!linkInfoDest.node) { linkInfoDest.link = findLink1(xpos, ypos, idxsub, fuzzyMatch); if (!linkInfoDest.link) { - obj->setPicAniInfo(picAniInfo); + obj->setPicAniInfo(&picAniInfo); return 0; } } - ObList_ctor(&tempLinkList, 10); + Common::Array tempLinkList; - MovGraph2_findLinks(this, &linkInfoSource, &linkInfoDest, (int)&tempLinkList); - if (v6 < 0.0 || (linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.m_nCount) { - ObList_dtor(&tempLinkList); + if (findMinPath(&linkInfoSource, &linkInfoDest, &tempLinkList) < 0.0 || + ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size())) return 0; - } - memset(&movInfo1, 0, sizeof(movInfo1)); - v39 = y; + movInfo1.subIndex = idxsub; - v40 = point.x; - movInfo1.pt1.y = y; - movInfo1.pt1.x = point.x; + movInfo1.pt1.x = obj->_ox; + movInfo1.pt1.y = obj->_oy; + + int dx1 = obj->_ox; + int dy1 = obj->_oy; + int dx2, dy2; if (linkInfoSource.node) - v41 = linkInfoSource.node->distance; + movInfo1.distance1 = linkInfoSource.node->_distance; else - v41 = linkInfoSource.link->movGraphNode1->distance; - - movInfo1.distance1 = v41; + movInfo1.distance1 = linkInfoSource.link->_movGraphNode1->_distance; if (linkInfoDest.node) { - v42 = linkInfoDest.node->x; - movInfo1.pt2.x = linkInfoDest.node->x; - v43 = linkInfoDest.node->y; - movInfo1.pt2.y = linkInfoDest.node->y; - movInfo1.distance2 = linkInfoDest.node->distance; + dx2 = linkInfoDest.node->_x; + dy2 = linkInfoDest.node->_y; + + movInfo1.pt2.x = linkInfoDest.node->_x; + movInfo1.pt2.y = linkInfoDest.node->_y; + + movInfo1.distance2 = linkInfoDest.node->_distance; } else { movInfo1.pt2.x = xpos; movInfo1.pt2.y = ypos; - v44 = linkInfoDest.link->movGraphNode1; - v45 = v44->distance; - point.x = (ypos - v44->y) * (ypos - v44->y) + (xpos - v44->x) * (xpos - v44->x); - v46 = sqrt((double)point.x); - point.x = linkInfoDest.link->movGraphNode2->distance - v45; - movInfo1.distance2 = v45 + (unsigned __int64)(signed __int64)(v46 * (double)point / linkInfoDest.link->distance); - MovGraph_calcDistance((int)this, &movInfo1.pt2, linkInfoDest.link, 1); - v43 = movInfo1.pt2.y; - v42 = movInfo1.pt2.x; - v39 = movInfo1.pt1.y; - v40 = movInfo1.pt1.x; + + MovGraphNode *nod = linkInfoDest.link->_movGraphNode1; + double dst1 = sqrt((ypos - nod->_y) * (ypos - nod->_y) + (xpos - nod->_x) * (xpos - nod->_x)); + int dst = linkInfoDest.link->_movGraphNode2->_distance - nod->_distance; + + movInfo1.distance2 = nod->_distance + (dst1 * (double)dst / linkInfoDest.link->_distance); + + calcDistance(&movInfo1.pt2, linkInfoDest.link, 1); + + dx1 = movInfo1.pt1.x; + dy1 = movInfo1.pt1.y; + dx2 = movInfo1.pt2.x; + dy2 = movInfo1.pt2.y; } + warning("STUB: MovGraph2::method4C()"); + +#if 0 + if (staticsId) { v47 = MovGraph2_getItem1IndexByStaticsId(this, ex, staticsId); } else if (tempLinkList.m_nCount <= 1) { @@ -739,10 +738,10 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int LOBYTE(v47) = MovGraph2_sub_456690( this, (int)&tempLinkList.m_pNodeHead->data->GameObject.CObject.vmt, - v42 - v40, - v43 - v39); + dx2 - dx1, + dy2 - dy1); else - LOBYTE(v47) = MovGraph2_sub_456690(this, 0, v42 - v40, v43 - v39); + LOBYTE(v47) = MovGraph2_sub_456690(this, 0, dx2 - dx1, dy2 - dy1); } else { LOBYTE(v47) = MovGraph2_sub_456300(this, (int)&tempLinkList, tempLinkList.m_pNodeTail, 0, 0); } @@ -847,6 +846,30 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int return 0; } +MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) { + warning("STUB: MovGraphLink *MovGraph2::findNode()"); + + return 0; +} + +MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { + warning("STUB: MovGraphLink *MovGraph2::findLink1()"); + + return 0; +} + +MovGraphLink *MovGraph2::findLink2(int x, int y) { + warning("STUB: MovGraphLink *MovGraph2::findLink2()"); + + return 0; +} + +double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array *listObj) { + warning("STUB: MovGraph2::findMinPath()"); + + return 0.0; +} + MovGraphNode *MovGraph::calcOffset(int ox, int oy) { warning("STUB: MovGraph::calcOffset()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 86e5d383be9f..f55333edea21 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -52,13 +52,13 @@ class MotionController : public CObject { virtual int method28() { return 0; } virtual int method2C() { return 0; } virtual int method30() { return 0; } - virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { return 0; } + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } virtual int changeCallback() { return 0; } virtual int method3C() { return 0; } virtual int method40() { return 0; } virtual int method44() { return 0; } virtual int method48() { return -1; } - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId) { return 0; } + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } }; class MovGraphReact : public CObject { @@ -106,8 +106,8 @@ class MctlCompound : public MotionController { virtual void addObject(StaticANIObject *obj); virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); - virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); void initMovGraph2(); MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr); @@ -247,14 +247,14 @@ class MovGraph : public MotionController { virtual void freeItems(); virtual int method28(); virtual int method2C(); - virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); virtual int method3C(); virtual int method44(); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int method50(); - double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzySearch); + double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); MovGraphNode *calcOffset(int ox, int oy); }; @@ -275,6 +275,24 @@ struct MovGraph2ItemSub { MG2I _turnS[4]; }; +struct LinkInfo { + MovGraphLink *link; + MovGraphNode *node; +}; + +struct MovInfo1 { + int field_0; + Common::Point pt1; + Common::Point pt2; + int distance1; + int distance2; + int subIndex; + int item1Index; + int items; + int itemsCount; + int flags; +}; + struct MovGraph2Item { int _objectId; StaticANIObject *_obj; @@ -289,8 +307,8 @@ class MovGraph2 : public MovGraph { virtual void addObject(StaticANIObject *obj); virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); - virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzySearch, int staticsId); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); int getItemIndexByGameObjectId(int objectId); int getItemSubIndexByStaticsId(int index, int staticsId); @@ -298,6 +316,11 @@ class MovGraph2 : public MovGraph { int getItemSubIndexByMGM(int idx, StaticANIObject *ani); bool initDirections(StaticANIObject *obj, MovGraph2Item *item); + + MovGraphNode *findNode(int x, int y, int fuzzyMatch); + MovGraphLink *findLink1(int x, int y, int idx, int fuzzyMatch); + MovGraphLink *findLink2(int x, int y); + double findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array *listObj); }; class MctlConnectionPoint : public CObject { @@ -312,24 +335,6 @@ class MctlConnectionPoint : public CObject { int _motionControllerObj; }; -struct LinkInfo { - int link; - int node; -}; - -struct MovInfo1 { - int field_0; - Common::Point pt1; - Common::Point pt2; - int distance1; - int distance2; - int subIndex; - int item1Index; - int items; - int itemsCount; - int flags; -}; - } // End of namespace Fullpipe #endif /* FULLPIPE_MOTION_H */ From f24267874e73c615bedcdf7a5743537803892e2e Mon Sep 17 00:00:00 2001 From: urukgit Date: Tue, 15 Oct 2013 10:05:22 +0200 Subject: [PATCH 1281/1332] AVALANCHE: Fix iteration in Dialogs::talkTo(). --- engines/avalanche/dialogs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 8a1031bda249..364343bfd44a 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1073,7 +1073,7 @@ void Dialogs::talkTo(byte whom) { whom -= 149; bool noMatches = true; - for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]->_acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); From ffdb024c8c2b098ca67fcd8b78c5ffcfc21e1c7b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Oct 2013 20:26:43 -0400 Subject: [PATCH 1282/1332] TSAGE: Fix R2R loading of voice index --- engines/tsage/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index a5480fe6b44a..a9520a87b213 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2534,7 +2534,7 @@ void PlayStream::ResFileData::load(Common::SeekableReadStream &stream) { _indexSize = stream.readUint16LE(); _chunkSize = stream.readUint16LE(); - stream.skip(20); + stream.skip(18); } PlayStream::PlayStream(): EventHandler() { From 7696ae1ca37d3f4f733cd3f9932edf70db76b3c3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Oct 2013 22:35:26 -0400 Subject: [PATCH 1283/1332] TSAGE: Further in-progress work on adding R2R voice support --- engines/tsage/sound.cpp | 151 +++++++++++++++------------------------- engines/tsage/sound.h | 15 +--- 2 files changed, 58 insertions(+), 108 deletions(-) diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index a9520a87b213..f985650b7a88 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -22,6 +22,8 @@ #include "audio/decoders/raw.h" #include "common/config-manager.h" +#include "audio/decoders/raw.h" +#include "audio/audiostream.h" #include "tsage/core.h" #include "tsage/globals.h" #include "tsage/debugger.h" @@ -1540,23 +1542,6 @@ void Sound::play(int soundNum) { _soundManager->addToPlayList(this); } -bool Sound::playBuffers(const byte *soundData) { - prime(-2); - _soundManager->addToPlayList(this); - - debug(1, "TODO: Sound::checkCannels"); - if (/* _soundManager.checkChannels() */ true) { - uint32 size = READ_UINT32(soundData + 4); - if (size == 0 || size > 0xffff) - error("Sound::playBuffers() called with illegal buffer length"); - - warning("TODO: Implement Sound::primeSoundData for voice playback"); - } else { - stop(); - return false; - } -} - void Sound::stop() { g_globals->_soundManager.removeFromPlayList(this); _unPrime(); @@ -2530,7 +2515,7 @@ void PlayStream::ResFileData::load(Common::SeekableReadStream &stream) { error("Invalid voice resource data"); _fileChunkSize = stream.readUint32LE(); - _field8 = stream.readUint16LE(); + stream.skip(2); _indexSize = stream.readUint16LE(); _chunkSize = stream.readUint16LE(); @@ -2539,12 +2524,7 @@ void PlayStream::ResFileData::load(Common::SeekableReadStream &stream) { PlayStream::PlayStream(): EventHandler() { _index = NULL; - _chunks[0] = _chunks[1] = NULL; - _voiceNum = 0; - _currentChunkIndex = 0; - _nextChunkIndex = 0; _endAction = NULL; - _field2F0 = _field2FA = 0; } PlayStream::~PlayStream() { @@ -2566,14 +2546,6 @@ bool PlayStream::setFile(const Common::String &filename) { for (uint i = 0; i < (_resData._indexSize / 2); ++i) _index[i] = _file.readUint16LE(); - // Allocate space for loading voice chunks into - _chunks[0] = new byte[_resData._chunkSize]; - _chunks[1] = new byte[_resData._chunkSize]; - - // Initialise variables - _voiceNum = 0; - _currentChunkIndex = _nextChunkIndex = 0; - return true; } @@ -2581,38 +2553,53 @@ bool PlayStream::play(int voiceNum, EventHandler *endAction) { uint32 offset = getFileOffset(_index, _resData._fileChunkSize, voiceNum); if (offset) { _voiceNum = 0; - _currentChunkIndex = _nextChunkIndex = 0; if (_sound.isPlaying()) _sound.stop(); + // Move to the offset for the start of the voice _file.seek(offset); - _file.read(_chunks[0], _resData._chunkSize); - _file.read(_chunks[1], _resData._chunkSize); - - _currentChunkIndex = 0; - _nextChunkIndex = 1; - _voiceNum = voiceNum; - _endAction = endAction; - - if (!strncmp((const char *)_chunks[_currentChunkIndex], "FEED", 4)) { - // Valid sound data found - const byte *data = _chunks[_currentChunkIndex]; - - _field2F0 = _field2FA = READ_UINT16(data + 10); - - //_fnP = proc2; - _field300 = this; - _soundData = data + 16; - _streamSize = READ_LE_UINT16(data + 4) - 16; - - // Start playing the sound data - if (!_sound.playBuffers(_soundData)) { - _voiceNum = 0; - _currentChunkIndex = _nextChunkIndex = 0; - } - return true; + // Read in the header and validate it + char header[4]; + _file.read(&header[0], 4); + if (strncmp(header, "FEED", 4)) + error("Invalid stream data"); + + // Get basic details of first sound chunk + uint chunkSize = _file.readUint16LE() - 16; + _file.skip(4); + int rate = _file.readUint16LE(); + _file.skip(4); + + // Create the stream + Audio::QueuingAudioStream *audioStream = Audio::makeQueuingAudioStream(rate, false); + + // Load in the first chunk + byte *data = (byte *)malloc(chunkSize); + _file.read(data, chunkSize); + audioStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); + + // If necessary, load further chunks of the voice in + while (chunkSize == (_resData._chunkSize - 16)) { + // Ensure the next chunk has the 'MORE' header + _file.read(&header[0], 4); + if (strncmp(header, "MORE", 4)) + error("Invalid stream data"); + + // Get the size of the chunk + chunkSize = _file.readUint16LE() - 16; + _file.skip(10); + + // Read in the data for this next chunk and queue it + data = (byte *)malloc(chunkSize); + _file.read(data, chunkSize); + audioStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); } + + g_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, + audioStream, DisposeAfterUse::YES); + + return true; } // If it reaches this point, no valid voice data found @@ -2620,60 +2607,38 @@ bool PlayStream::play(int voiceNum, EventHandler *endAction) { } void PlayStream::stop() { + g_vm->_mixer->stopHandle(_soundHandle); + _voiceNum = 0; - _currentChunkIndex = _nextChunkIndex = 0; _endAction = NULL; - - if (_sound.isPlaying()) - _sound.stop(); } bool PlayStream::isPlaying() const { - return _voiceNum != 0; + return _voiceNum != 0 && g_vm->_mixer->isSoundHandleActive(_soundHandle); } void PlayStream::remove() { stop(); _file.close(); - // Free data buffers + // Free index delete[] _index; - delete[] _chunks[0]; - delete[] _chunks[1]; _index = NULL; - _chunks[0] = _chunks[1] = NULL; _endAction = NULL; _voiceNum = 0; - _currentChunkIndex = 0; - _nextChunkIndex = 0; } void PlayStream::dispatch() { - if ((_voiceNum != 0) && (_currentChunkIndex == _nextChunkIndex)) { - if (READ_LE_UINT16(_chunks[_currentChunkIndex] + 6) != 0) { - uint32 bytesRead = _file.read(_chunks[_nextChunkIndex ^ 1], _resData._chunkSize); - - if (bytesRead != _resData._chunkSize) { - byte *data = _chunks[_currentChunkIndex]; - Common::fill(data, data + 128, 0); - - _voiceNum = 0; - } + if (_voiceNum != 0 && !isPlaying()) { + // If voice has finished playing, reset fields + EventHandler *endAction = _endAction; + _endAction = NULL; + _voiceNum = 0; - _nextChunkIndex ^= 1; - } else if (!isPlaying()) { - // If voice has finished playing, reset fields - EventHandler *endAction = _endAction; - _endAction = NULL; - _voiceNum = 0; - _currentChunkIndex = 0; - _nextChunkIndex = 0; - - if (endAction) - // Signal given end action - endAction->signal(); - } + if (endAction) + // Signal given end action + endAction->signal(); } } @@ -2702,10 +2667,6 @@ uint32 PlayStream::getFileOffset(const uint16 *data, int count, int voiceNum) { return offset; } -void PlayStream::stream() { - // TODO -} - /*--------------------------------------------------------------------------*/ SoundDriver::SoundDriver() { diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 9779f3c03c97..83cd4753d580 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -316,7 +316,6 @@ class Sound: public EventHandler { void orientAfterRestore(); void play(int soundResID); - bool playBuffers(const byte *soundData); void stop(); void prime(int soundResID); void unPrime(); @@ -420,30 +419,20 @@ class PlayStream: public EventHandler { class ResFileData { public: int _fileChunkSize; - int _field8; uint _indexSize; uint _chunkSize; void load(Common::SeekableReadStream &stream); }; - typedef void (PlayStream::*FunctionPtr)(); private: Common::File _file; ResFileData _resData; + Audio::SoundHandle _soundHandle; Sound _sound; uint16 *_index; - byte *_chunks[2]; - const byte *_soundData; - int _voiceNum; - int _currentChunkIndex; - int _nextChunkIndex; EventHandler *_endAction; - EventHandler *_field300; - int _field2F0, _field2FA; - int _streamSize; - FunctionPtr _streamFn; + int _voiceNum; - void stream(); static uint32 getFileOffset(const uint16 *data, int count, int voiceNum); public: PlayStream(); From 769ba7f6cab51dc48f4d6aaefcb3bf8c216abaa9 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 16 Oct 2013 09:03:43 +0300 Subject: [PATCH 1284/1332] FULLPIPE: More work on MovGraph2::method4C() --- engines/fullpipe/motion.cpp | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 4e708c1459ae..8e25786591e1 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -732,7 +732,7 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int #if 0 if (staticsId) { - v47 = MovGraph2_getItem1IndexByStaticsId(this, ex, staticsId); + v47 = MovGraph2_getItem1IndexByStaticsId(ex, staticsId); } else if (tempLinkList.m_nCount <= 1) { if (tempLinkList.m_nCount == 1) LOBYTE(v47) = MovGraph2_sub_456690( @@ -776,30 +776,12 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int && picAniInfo.someDynamicPhaseIndex == v52->msg.field_14) { MessageQueue_deleteExCommandByIndex(v50, 0, 1); } else { - v54 = (ExCommand *)operator new(sizeof(ExCommand)); - v63 = v54; - LOBYTE(v71.state) = 5; - if (v54) - v55 = ExCommand_ctor( - v54, - picAniInfo.objectId, - 5, - *(_DWORD *)(point.x + offsetof(ExCommand, messageNum)), - obj->GameObject.ox, - obj->GameObject.oy, - 0, - 1, - 0, - 0, - 0); - else - v55 = 0; - v55->msg.field_14 = -1; - v55->msg.keyCode = picAniInfo.field_8; - v56 = v55->excFlags | 2; - LOBYTE(v71.state) = 4; - v55->excFlags = v56; - MessageQueue_addExCommand(v50, v55); + ExCommand *ex = new ExCommand(picAniInfo.objectId, 5, v52->_messageNum, obj->_ox, obj->_oy, 0, 1, 0, 0, 0); + ex->_field_14 = -1; + ex->_keyCode = picAniInfo.field_8; + ex->_excFlags |= 2; + v50->addExCommand(ex); + v57 = (ExCommand *)operator new(sizeof(ExCommand)); v63 = v57; LOBYTE(v71.state) = 6; From a0185d7fdc449438ce85ef00abcae297c6e89829 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 00:35:02 +0300 Subject: [PATCH 1285/1332] FULLPIPE: Implemented MovGraph2::method4C() --- engines/fullpipe/messages.cpp | 21 +++++ engines/fullpipe/messages.h | 2 + engines/fullpipe/motion.cpp | 149 +++++++++++++++------------------- engines/fullpipe/motion.h | 5 ++ 4 files changed, 92 insertions(+), 85 deletions(-) diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index b5f2cb8303b0..d58212dc29cf 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -309,6 +309,10 @@ void MessageQueue::messageQueueCallback1(int par) { debug(3, "STUB: MessageQueue::messageQueueCallback1()"); } +void MessageQueue::addExCommand(ExCommand *ex) { + _exCommands.push_front(ex); +} + ExCommand *MessageQueue::getExCommandByIndex(uint idx) { if (idx > _exCommands.size()) return 0; @@ -323,6 +327,23 @@ ExCommand *MessageQueue::getExCommandByIndex(uint idx) { return *it; } +void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) { + if (idx > _exCommands.size()) + return; + + Common::List::iterator it = _exCommands.begin(); + + while (idx) { + ++it; + idx--; + } + + _exCommands.erase(it); + + if (doFree) + delete *it; +} + void MessageQueue::sendNextCommand() { if (_exCommands.size()) { if (!(_flags & 4) && (_flags & 1)) { diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 6b7236432385..a3533e1bd2b4 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -119,7 +119,9 @@ class MessageQueue : public CObject { uint getCount() { return _exCommands.size(); } + void addExCommand(ExCommand *ex); ExCommand *getExCommandByIndex(uint idx); + void deleteExCommandByIndex(uint idx, bool doFree); void replaceKeyCode(int key1, int key2); diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 8e25786591e1..e161c4b4576b 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -535,6 +535,16 @@ void MovGraph2::addObject(StaticANIObject *obj) { } } +void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst) { + warning("STUB: MovGraph2::buildMovInfo1SubItems()"); +} + +MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { + warning("STUB: MovGraph2::buildMovInfo1MessageQueue()"); + + return 0; +} + int MovGraph2::removeObject(StaticANIObject *obj) { warning("STUB: MovGraph2::removeObject()"); @@ -727,105 +737,62 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int dy2 = movInfo1.pt2.y; } - warning("STUB: MovGraph2::method4C()"); - -#if 0 - if (staticsId) { - v47 = MovGraph2_getItem1IndexByStaticsId(ex, staticsId); - } else if (tempLinkList.m_nCount <= 1) { - if (tempLinkList.m_nCount == 1) - LOBYTE(v47) = MovGraph2_sub_456690( - this, - (int)&tempLinkList.m_pNodeHead->data->GameObject.CObject.vmt, - dx2 - dx1, - dy2 - dy1); + movInfo1.item1Index = getItemSubIndexByStaticsId(idx, staticsId); + } else if (tempLinkList.size() <= 1) { + if (tempLinkList.size() == 1) + movInfo1.item1Index = getShortSide(tempLinkList[0], dx2 - dx1, dy2 - dy1); else - LOBYTE(v47) = MovGraph2_sub_456690(this, 0, dx2 - dx1, dy2 - dy1); + movInfo1.item1Index = getShortSide(0, dx2 - dx1, dy2 - dy1); } else { - LOBYTE(v47) = MovGraph2_sub_456300(this, (int)&tempLinkList, tempLinkList.m_pNodeTail, 0, 0); + movInfo1.item1Index = findLink(&tempLinkList, tempLinkList.back(), 0, 0); } + movInfo1.flags = fuzzyMatch != 0; - movInfo1.item1Index = v47; - if (*((_DWORD *)this->items.CObArray.m_pData[offsetof(MovGraph2, movGraph)] - + 186 * movInfo1.field_0 - + 46 * movInfo1.subIndex - + 3) != (unsigned __int16)v62) { - v48 = movInfo1.flags; - LOBYTE(v48) = LOBYTE(movInfo1.flags) | 2; - movInfo1.flags = v48; - } - MovGraph2_buildMovInfo1SubItems(this, (int)&movInfo1, (int)&tempLinkList, (int)&linkInfoSource, (int)&linkInfoDest); - v49 = MovGraph2_buildMovInfo1MessageQueue(this, (int)&movInfo1); - v50 = (MessageQueue *)v49; - v62 = (MessageQueue *)v49; - CObjectFree((void *)movInfo1.items); - v51 = MovGraph2_findNode(this, movInfo1.pt2.x, movInfo1.pt2.y, fuzzyMatch); - linkInfoDest.node = v51; - if (!v51) { - linkInfoDest.link = MovGraph2_findLink1(this, movInfo1.pt2.x, movInfo1.pt2.y, movInfo1.item1Index, fuzzyMatch); - v51 = linkInfoDest.node; - } - if (fuzzyMatch || (_DWORD)linkInfoDest.link || v51) { - if (v50 && MessageQueue_getCount(v50) > 0 && picAniInfo.movementId) { - v52 = MessageQueue_getExCommandByIndex(v50, 0); - point.x = (int)v52; - if (v52 - && ((v53 = v52->msg.messageKind, v53 == 1) || v53 == 20) - && picAniInfo.movementId == LOWORD(v52->messageNum) - && picAniInfo.someDynamicPhaseIndex == v52->msg.field_14) { - MessageQueue_deleteExCommandByIndex(v50, 0, 1); + + if (_items[idx]->_subItems[idxsub]._staticsId1 != obj->_statics->_staticsId) + movInfo1.flags |= 2; + + buildMovInfo1SubItems(&movInfo1, &tempLinkList, &linkInfoSource, &linkInfoDest); + + MessageQueue *mq = buildMovInfo1MessageQueue(&movInfo1); + + linkInfoDest.node = findNode(movInfo1.pt2.x, movInfo1.pt2.y, fuzzyMatch); + + if (!linkInfoDest.node) + linkInfoDest.link = findLink1(movInfo1.pt2.x, movInfo1.pt2.y, movInfo1.item1Index, fuzzyMatch); + + if (fuzzyMatch || linkInfoDest.link || linkInfoDest.node) { + if (mq && mq->getCount() > 0 && picAniInfo.movementId) { + ExCommand *ex = mq->getExCommandByIndex(0); + + if (ex && (ex->_messageKind == 1 || ex->_messageKind == 20) + && picAniInfo.movementId == ex->_messageNum + && picAniInfo.someDynamicPhaseIndex == ex->_field_14) { + mq->deleteExCommandByIndex(0, 1); } else { - ExCommand *ex = new ExCommand(picAniInfo.objectId, 5, v52->_messageNum, obj->_ox, obj->_oy, 0, 1, 0, 0, 0); + ex = new ExCommand(picAniInfo.objectId, 5, ex->_messageNum, obj->_ox, obj->_oy, 0, 1, 0, 0, 0); ex->_field_14 = -1; ex->_keyCode = picAniInfo.field_8; ex->_excFlags |= 2; - v50->addExCommand(ex); - - v57 = (ExCommand *)operator new(sizeof(ExCommand)); - v63 = v57; - LOBYTE(v71.state) = 6; - if (v57) { - v58 = ExCommand_ctor( - v57, - picAniInfo.objectId, - 22, - *((_DWORD *)this->items.CObArray.m_pData[offsetof(MovGraph2, movGraph)] - + 186 * ex - + 46 * movInfo1.subIndex - + 3), - 0, - 0, - 0, - 1, - 0, - 0, - 0); - v50 = v62; - } - else - { - v58 = 0; - } - v58->msg.keyCode = picAniInfo.field_8; - v59 = v58->excFlags | 3; - LOBYTE(v71.state) = 4; - v58->excFlags = v59; - MessageQueue_addExCommand(v50, v58); + mq->addExCommand(ex); + + ex = new ExCommand(picAniInfo.objectId, 22, _items[idx]->_subItems[idxsub]._staticsId1, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = picAniInfo.field_8; + ex->_excFlags |= 3; + mq->addExCommand(ex); } } } else { - if (v50) - (*(void (__thiscall **)(MessageQueue *, signed int))(v50->CObject.vmt + 4))(v50, 1); - v50 = 0; + if (mq) + delete mq; + mq = 0; } - GameObject_setPicAniInfo(obj, &picAniInfo); - v71.state = -1; - ObList_dtor(&tempLinkList); - return v50; -#endif - return 0; + obj->setPicAniInfo(&picAniInfo); + + return mq; } MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) { @@ -834,6 +801,18 @@ MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) { return 0; } +int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) { + warning("STUB: MovGraph2::getShortSide()"); + + return 0; +} + +int MovGraph2::findLink(Common::Array *linkList, MovGraphLink *lnk, Common::Rect *a3, Common::Point *a4) { + warning("STUB: MovGraphLink *MovGraph2::findLink()"); + + return 0; +} + MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { warning("STUB: MovGraphLink *MovGraph2::findLink1()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index f55333edea21..9089cca52013 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -315,7 +315,12 @@ class MovGraph2 : public MovGraph { int getItemSubIndexByMovementId(int index, int movId); int getItemSubIndexByMGM(int idx, StaticANIObject *ani); + int getShortSide(MovGraphLink *lnk, int x, int y); + int findLink(Common::Array *linkList, MovGraphLink *lnk, Common::Rect *a3, Common::Point *a4); + bool initDirections(StaticANIObject *obj, MovGraph2Item *item); + void buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst); + MessageQueue *buildMovInfo1MessageQueue(MovInfo1 *movInfo); MovGraphNode *findNode(int x, int y, int fuzzyMatch); MovGraphLink *findLink1(int x, int y, int idx, int fuzzyMatch); From 1cfafc6cfd8b7de11c1bb28df082199092e5774c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 00:37:04 +0300 Subject: [PATCH 1286/1332] FULLPIPE: method4C -> doWalkTo --- engines/fullpipe/interaction.cpp | 2 +- engines/fullpipe/motion.cpp | 12 ++++++------ engines/fullpipe/motion.h | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 9fd42c15ae75..80cbce946b85 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -137,7 +137,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject obj->setPicAniInfo(&aniInfo); if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1) { - mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->method4C(subj, xpos, ypos, 1, cinter->_staticsId2); + mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->doWalkTo(subj, xpos, ypos, 1, cinter->_staticsId2); if (mq) { dur = mq->calcDuration(subj); delete mq; diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index e161c4b4576b..53b2906599f4 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -122,7 +122,7 @@ MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, return 0; } -MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { +MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { int match1 = -1; int match2 = -1; @@ -154,14 +154,14 @@ MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, return 0; if (match1 == match2) - return _motionControllers[match1]->_motionControllerObj->method4C(subj, xpos, ypos, fuzzyMatch, staticsId); + return _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, xpos, ypos, fuzzyMatch, staticsId); MctlConnectionPoint *closestP = findClosestConnectionPoint(subj->_ox, subj->_oy, match1, xpos, ypos, match2, &match2); if (!closestP) return 0; - MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->method4C(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_field_14); + MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_field_14); ExCommand *ex; @@ -309,8 +309,8 @@ int MovGraph::method44() { return 0; } -MessageQueue *MovGraph::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { - warning("STUB: MovGraph::method4C()"); +MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { + warning("STUB: MovGraph::doWalkTo()"); return 0; } @@ -561,7 +561,7 @@ MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int return 0; } -MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) { +MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) { LinkInfo linkInfoDest; LinkInfo linkInfoSource; MovInfo1 movInfo1; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 9089cca52013..eedc292561f8 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -58,7 +58,7 @@ class MotionController : public CObject { virtual int method40() { return 0; } virtual int method44() { return 0; } virtual int method48() { return -1; } - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } + virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } }; class MovGraphReact : public CObject { @@ -107,7 +107,7 @@ class MctlCompound : public MotionController { virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); void initMovGraph2(); MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr); @@ -251,7 +251,7 @@ class MovGraph : public MotionController { virtual int changeCallback(); virtual int method3C(); virtual int method44(); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int method50(); double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); @@ -308,7 +308,7 @@ class MovGraph2 : public MovGraph { virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); int getItemIndexByGameObjectId(int objectId); int getItemSubIndexByStaticsId(int index, int staticsId); From 8880077ec3899fc7bf752c5ede2434505b948157 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 00:55:34 +0300 Subject: [PATCH 1287/1332] FULLPIPE: Implement MovGraph2::findNode() --- engines/fullpipe/motion.cpp | 14 +++++++++++++- engines/fullpipe/motion.h | 6 +++--- engines/fullpipe/utils.h | 9 +++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 53b2906599f4..aced36fa79cf 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -796,7 +796,19 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int } MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) { - warning("STUB: MovGraphLink *MovGraph2::findNode()"); + for (ObList::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphNode); + + MovGraphNode *node = (MovGraphNode *)*i; + + if (fuzzyMatch) { + if (abs(node->_x - x) < 15 && abs(node->_y - y) < 15) + return node; + } else { + if (node->_x == x && node->_y == y) + return node; + } + } return 0; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index eedc292561f8..6901a7263ad2 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -147,15 +147,15 @@ class MGM : public CObject { }; class MovGraphNode : public CObject { - public: +public: int _x; int _y; int _distance; int16 _field_10; int _field_14; - public: - MovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) {} +public: + MovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) { _objtype = kObjTypeMovGraphNode; } virtual bool load(MfcArchive &file); }; diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index e593bd9f18ad..d976e09d602a 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -66,15 +66,16 @@ class MfcArchive : public Common::SeekableReadStream { enum ObjType { kObjTypeDefault, + kObjTypeMovGraph, + kObjTypeMovGraphNode, + kObjTypeMctlCompound, kObjTypeObjstateCommand, - kObjTypeStaticANIObject, kObjTypePictureObject, - kObjTypeMovGraph, - kObjTypeMctlCompound + kObjTypeStaticANIObject }; class CObject { - public: +public: ObjType _objtype; CObject() : _objtype(kObjTypeDefault) {} From 7d7c0966a2836e9447befa6c31cbd114b9f40ef5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 17 Oct 2013 01:08:42 +0300 Subject: [PATCH 1288/1332] FULLPIPE: Fix compilation with MSVC MSVC complains that this specific usage of sqrt() is ambiguous, since the arguments aren't float or double --- engines/fullpipe/motion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index aced36fa79cf..0c0db322f864 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -724,7 +724,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int movInfo1.pt2.y = ypos; MovGraphNode *nod = linkInfoDest.link->_movGraphNode1; - double dst1 = sqrt((ypos - nod->_y) * (ypos - nod->_y) + (xpos - nod->_x) * (xpos - nod->_x)); + double dst1 = sqrt((double)((ypos - nod->_y) * (ypos - nod->_y) + (xpos - nod->_x) * (xpos - nod->_x))); int dst = linkInfoDest.link->_movGraphNode2->_distance - nod->_distance; movInfo1.distance2 = nod->_distance + (dst1 * (double)dst / linkInfoDest.link->_distance); From eb7f7b9fb6c56c125a66b6496cbe712198c75395 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Oct 2013 23:01:26 -0400 Subject: [PATCH 1289/1332] TSAGE: Fixes for calling voice playback correctly when showing on-screen text --- engines/tsage/core.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index bd7610c9f96f..3332b12cf691 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1749,9 +1749,22 @@ void SceneItem::display(int resNum, int lineNum, ...) { } g_globals->_sceneText.fixPriority(255); + + // In Return to Ringworld, if in voice mode only, don't show the text + if ((g_vm->getGameID() == GType_Ringworld2) && (R2_GLOBALS._speechSubtitles & SPEECH_VOICE) + && !(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) + g_globals->_sceneText.hide(); + g_globals->_sceneObjects->draw(); } + // For Return to Ringworld, play the voice overs in sequence + if ((g_vm->getGameID() == GType_Ringworld2) && (R2_GLOBALS._speechSubtitles & SPEECH_VOICE) + && !playList.empty()) { + R2_GLOBALS._playStream.play(*playList.begin(), NULL); + playList.pop_front(); + } + // Unless the flag is set to keep the message on-screen, show it until a mouse or keypress, then remove it if (!keepOnscreen && !msg.empty()) { Event event; @@ -1761,14 +1774,23 @@ void SceneItem::display(int resNum, int lineNum, ...) { EVENT_BUTTON_DOWN | EVENT_KEYPRESS)) { GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); - } - // For Return to Ringworld, play the voice overs in sequence - if ((g_vm->getGameID() == GType_Ringworld2) && !playList.empty() && !R2_GLOBALS._playStream.isPlaying()) { - R2_GLOBALS._playStream.play(*playList.begin(), NULL); - playList.pop_front(); + if ((g_vm->getGameID() == GType_Ringworld2) && (R2_GLOBALS._speechSubtitles & SPEECH_VOICE)) { + // Allow the play stream to do processing + R2_GLOBALS._playStream.dispatch(); + if (!R2_GLOBALS._playStream.isPlaying()) { + // Check if there are further voice samples to play + if (!playList.empty()) { + R2_GLOBALS._playStream.play(*playList.begin(), NULL); + playList.pop_front(); + } + } + } } + if (g_vm->getGameID() == GType_Ringworld2) + R2_GLOBALS._playStream.stop(); + g_globals->_sceneText.remove(); } From df73f27f67eaa96e93f624ff641e20bd61f151d4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:38:29 +0300 Subject: [PATCH 1290/1332] DRASCULA: Fix potential buffer overrun. CID 1003308 --- engines/drascula/objects.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index 35dfd3162ae6..acc4bbf7ac54 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -265,8 +265,9 @@ void DrasculaEngine::updateVisible() { } if (_roomNumber == 22 && flags[27] == 1) visible[3] = 0; - if (_roomNumber == 26 && flags[21] == 0) - strcpy(objName[2], _textmisc[0]); + if (_roomNumber == 26 && flags[21] == 0) { + strlcpy(objName[2], _textmisc[0], 20); + } if (_roomNumber == 26 && flags[18] == 1) visible[2] = 0; if (_roomNumber == 26 && flags[12] == 1) From 66e683039510ce0d1b08995d902a60e0ceef4e25 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:40:17 +0300 Subject: [PATCH 1291/1332] DRASCULA: Fix potential buffer overrun. CID 1003309 --- engines/drascula/drascula.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index cde00baa327a..d7e80acf12ab 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -297,7 +297,7 @@ Common::Error DrasculaEngine::run() { memset(iconName, 0, sizeof(iconName)); for (i = 0; i < 6; i++) - strcpy(iconName[i + 1], _textverbs[i]); + strlcpy(iconName[i + 1], _textverbs[i], 13); assignPalette(defaultPalette); From bc082166596597b894b169ea82d06129c690e8bb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:43:21 +0300 Subject: [PATCH 1292/1332] DRASCULA: Fix potential buffer overrun. CID 1003310 --- engines/drascula/graphics.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index b28de669b6d4..a28ca8a1cb89 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -336,7 +336,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { // original starts printing 4 lines above textY int y = CLIP(textY - (4 * CHAR_HEIGHT), 0, 320); - strcpy(msg, message); + strlcpy(msg, message, 200); // If the message fits on screen as-is, just print it here if (textFitsCentered(msg, textX)) { @@ -363,8 +363,8 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { while (curWord != NULL) { // Check if the word and the current line fit on screen if (tmpMessageLine[0] != '\0') - strcat(tmpMessageLine, " "); - strcat(tmpMessageLine, curWord); + strlcat(tmpMessageLine, " ", 200); + strlcat(tmpMessageLine, curWord, 200); if (textFitsCentered(tmpMessageLine, textX)) { // Line fits, so add the word to the current message line strcpy(messageLine, tmpMessageLine); @@ -374,8 +374,8 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { // If it goes off screen, print_abc will adjust it x = CLIP(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255); print_abc(messageLine, x, y + curLine * CHAR_HEIGHT); - strcpy(messageLine, curWord); - strcpy(tmpMessageLine, curWord); + strlcpy(messageLine, curWord, 200); + strlcpy(tmpMessageLine, curWord, 200); curLine++; } From b0ade3a637be7a2b324a75d6d667d546975cbf82 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:45:25 +0300 Subject: [PATCH 1293/1332] DRASCULA: Fix potential buffer overrun. CID 1003311 --- engines/drascula/converse.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index 95a5f7d87f7e..2aa12e106bd6 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -168,19 +168,19 @@ void DrasculaEngine::converse(int index) { // delete stream; if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) { - strcpy(phrase3, _text[405]); + strlcpy(phrase3, _text[405], 128); strcpy(sound3, "405.als"); answer3 = 31; } if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[7] == 1) { - strcpy(phrase3, _text[273]); + strlcpy(phrase3, _text[273], 128); strcpy(sound3, "273.als"); answer3 = 14; } if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[10] == 1) { - strcpy(phrase3, _text[274]); + strlcpy(phrase3, _text[274], 128); strcpy(sound3, "274.als"); answer3 = 15; } From 985491193258b3981db6a1879291e24ef4e3ed98 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:47:16 +0300 Subject: [PATCH 1294/1332] DRASCULA: Give hint about unused return value. CID 1003863 --- engines/drascula/animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 1145c8c3ff7b..ee981c36da9a 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -1645,10 +1645,10 @@ void DrasculaEngine::animation_9_6() { int v_cd; - animate("fin.bin", 14); + (void)animate("fin.bin", 14); playMusic(13); flags[5] = 1; - animate("drf.bin", 16); + (void)animate("drf.bin", 16); fadeToBlack(0); clearRoom(); curX = -1; From 955b585bd0fc2238ffbd6dac1edf1b3c5cc21ef8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:51:30 +0300 Subject: [PATCH 1295/1332] DRASCULA: Fix uninitalized class variables. CID 1003403 --- engines/drascula/drascula.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index d7e80acf12ab..369e28c9e1f4 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -89,6 +89,33 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _talkSequences = 0; _currentSaveSlot = 0; + bjX = 0; + bjY = 0; + trackBJ = 0; + framesWithoutAction = 0; + term_int = 0; + currentChapter = 0; + _loadedDifferentChapter = 0; + musicStopped = 0; + FrameSSN = 0; + globalSpeed = 0; + LastFrame = 0; + flag_tv = 0; + _charMapSize = 0; + _itemLocationsSize = 0; + _polXSize = 0; + _verbBarXSize = 0; + _x1dMenuSize = 0; + _frameXSize = 0; + _candleXSize = 0; + _pianistXSize = 0; + _drunkXSize = 0; + _roomPreUpdatesSize = 0; + _roomUpdatesSize = 0; + _roomActionsSize = 0; + _talkSequencesSize = 0; + _numLangs = 0; + _color = 0; blinking = 0; _mouseX = 0; From 787689ff3266b60a12dd2224bb0a8bf5cfca27a3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:54:27 +0300 Subject: [PATCH 1296/1332] TESTBED: Remove logically dead code. CID 1004067 --- engines/testbed/events.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/testbed/events.cpp b/engines/testbed/events.cpp index 78de87e13321..4b9ced2a531a 100644 --- a/engines/testbed/events.cpp +++ b/engines/testbed/events.cpp @@ -83,11 +83,10 @@ struct keycodeToChar { char EventTests::keystrokeToChar() { Common::EventManager *eventMan = g_system->getEventManager(); - bool quitLoop = false; Common::Event event; // handle all keybd events - while (!quitLoop) { + while (true) { while (eventMan->pollEvent(event)) { // Quit if explicitly requested! if (Engine::shouldQuit()) { @@ -110,8 +109,6 @@ char EventTests::keystrokeToChar() { } } } - - return 0; } Common::Rect EventTests::drawFinishZone() { From 08f5445055aebaeafcaaaf422ccd632cbf9c78ba Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:56:20 +0300 Subject: [PATCH 1297/1332] TESTBED: Initialize variable. CID 1003374 --- engines/testbed/config-params.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/testbed/config-params.cpp b/engines/testbed/config-params.cpp index e89da0b07ff3..47e5dfa933bd 100644 --- a/engines/testbed/config-params.cpp +++ b/engines/testbed/config-params.cpp @@ -38,6 +38,8 @@ ConfigParams::ConfigParams() { _isInteractive = true; _isGameDataFound = true; _rerunTests = false; + + _testbedConfMan = 0; } void ConfigParams::initLogging(const char *dirname, const char *filename, bool enable) { From 208cd2cf954b9da81945621ddab8489ab4620b96 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 13:58:02 +0300 Subject: [PATCH 1298/1332] TESTBED: Fix uninitalized variable. CID 1002670 --- engines/testbed/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/testbed/config.h b/engines/testbed/config.h index d611ae4ec38d..7d479a74fd70 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -113,7 +113,7 @@ class TestbedOptionsDialog : public GUI::Dialog { class TestbedInteractionDialog : public GUI::Dialog { public: - TestbedInteractionDialog(uint x, uint y, uint w, uint h) : GUI::Dialog(x, y, w, h) {} + TestbedInteractionDialog(uint x, uint y, uint w, uint h) : GUI::Dialog(x, y, w, h), _xOffset(0), _yOffset(0) {} ~TestbedInteractionDialog() {} virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); void addButton(uint w, uint h, const Common::String name, uint32 cmd, uint xOffset = 0, uint yPadding = 8); From 54ebfe7dded15261e7cb14f3bc234d8eb4feddae Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:01:49 +0300 Subject: [PATCH 1299/1332] DRACI: Fix potential division by zero. CID 1003841 --- engines/draci/walking.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index f1ae769d806e..195b9688601b 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -556,9 +556,15 @@ bool WalkingState::alignHeroToEdge(const Common::Point &p1, const Common::Point } bool reachedEnd; if (movement == kMoveLeft || movement == kMoveRight) { + if (p2Diff.x == 0) { + error("Wrong value for horizontal movement"); + } reachedEnd = movement == kMoveLeft ? hero->x <= p2.x : hero->x >= p2.x; hero->y += hero->x * p2Diff.y / p2Diff.x - prevHero.x * p2Diff.y / p2Diff.x; } else { + if (p2Diff.y == 0) { + error("Wrong value for vertical movement"); + } reachedEnd = movement == kMoveUp ? hero->y <= p2.y : hero->y >= p2.y; hero->x += hero->y * p2Diff.x / p2Diff.y - prevHero.y * p2Diff.x / p2Diff.y; } From 74172a7449f957cc7bc29741676a32b03c5eb756 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:03:37 +0300 Subject: [PATCH 1300/1332] DRACI: Fix potential negative array index read. CID 1003548 --- engines/draci/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index c4108cc0c74c..8fb6f4b90f37 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -953,7 +953,7 @@ void Game::dialogueMenu(int dialogueID) { "hit: %d, _lines[hit]: %d, lastblock: %d, dialogueLines: %d, dialogueExit: %d", hit, _lines[hit], _lastBlock, _dialogueLinesNum, _dialogueExit); - if ((!_dialogueExit) && (hit != -1) && (_lines[hit] != -1)) { + if ((!_dialogueExit) && (hit >= 0) && (_lines[hit] != -1)) { if ((oldLines == 1) && (_dialogueLinesNum == 1) && (_lines[hit] == _lastBlock)) { break; } From ae17206ce76c66738d0ff09c4d85d689d009fb20 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:08:37 +0300 Subject: [PATCH 1301/1332] DRACI: Fix uninitalized variables. CID 1003405 --- engines/draci/game.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 8fb6f4b90f37..271eb1e02e04 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -52,6 +52,36 @@ enum { Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { uint i; + _dialogueLinesNum = 0; + _blockNum = 0; + + for (i = 0; i < kDialogueLines; i++) + _dialogueAnims[0] = 0; + + _loopStatus = kStatusOrdinary; + _loopSubstatus = kOuterLoop; + _shouldQuit = 0; + _shouldExitLoop = 0; + _isReloaded = 0; + _speechTick = 0; + _speechDuration = 0; + _objUnderCursor = 0; + _animUnderCursor = 0; + _markedAnimationIndex = 0; + _scheduledPalette = 0; + _fadePhases = 0; + _fadePhase = 0; + _fadeTick = 0; + _mouseChangeTick = 0; + _enableQuickHero = 0; + _wantQuickHero = 0; + _enableSpeedText = 0; + _titleAnim = 0; + _inventoryAnim = 0; + _walkingMapOverlay = 0; + _walkingShortestPathOverlay = 0; + _walkingObliquePathOverlay = 0; + BArchive *initArchive = _vm->_initArchive; const BAFile *file; From ae38d943ae7c032907ab96b60dbb88a04d1028d3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:11:07 +0300 Subject: [PATCH 1302/1332] DRACI: Fix uninitalized variables. CID 1003406 --- engines/draci/draci.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 6aa84778871d..06730cfba70b 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -92,6 +92,32 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc) DebugMan.addDebugChannel(kDraciWalkingDebugLevel, "walking", "Walking debug info"); _console = new DraciConsole(this); + + _screen = 0; + _mouse = 0; + _game = 0; + _script = 0; + _anims = 0; + _sound = 0; + _music = 0; + _smallFont = 0; + _bigFont = 0; + _iconsArchive = 0; + _objectsArchive = 0; + _spritesArchive = 0; + _paletteArchive = 0; + _roomsArchive = 0; + _overlaysArchive = 0; + _animationsArchive = 0; + _walkingMapsArchive = 0; + _itemsArchive = 0; + _itemImagesArchive = 0; + _initArchive = 0; + _stringsArchive = 0; + _soundsArchive = 0; + _dubbingArchive = 0; + _showWalkingMap = 0; + _pauseStartTime = 0; } bool DraciEngine::hasFeature(EngineFeature f) const { From 78dc1c70d5246bc54ba88e2804de86c4e875ce85 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:14:19 +0300 Subject: [PATCH 1303/1332] DRACI: Fix uninitialized variabled. CID 1003404 --- engines/draci/walking.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/engines/draci/walking.h b/engines/draci/walking.h index a43aeb272a4d..7e4a3184f54f 100644 --- a/engines/draci/walking.h +++ b/engines/draci/walking.h @@ -103,7 +103,17 @@ struct GPL2Program; class WalkingState { public: - explicit WalkingState(DraciEngine *vm) : _vm(vm) { stopWalking(); } + explicit WalkingState(DraciEngine *vm) : _vm(vm) { + _dir = kDirectionLast; + _startingDirection = kMoveUndefined; + _segment = 0; + _lastAnimPhase = 0; + _turningFinished = 0; + _callbackOffset = 0; + + stopWalking(); + } + ~WalkingState() {} void stopWalking(); From 2a65976092680957c7ee7b3aa39d84400b445c62 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:16:23 +0300 Subject: [PATCH 1304/1332] DRACI: Fix potential sign extention. CID 1003513 --- engines/draci/surface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 3676c6edac5d..41563980706f 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -82,7 +82,7 @@ void Surface::markClean() { void Surface::fill(uint color) { byte *ptr = (byte *)getPixels(); - memset(ptr, color, w * h); + memset(ptr, color, (uint)(w * h)); } /** From 734abb5a53f498dcac30d4a9e6c5b37a57e6eb61 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 14:18:27 +0300 Subject: [PATCH 1305/1332] DRACI: Fix potential sign extention. CID 1003514 --- engines/draci/sprite.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 965cdabf3e35..9a78904d252a 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -38,9 +38,9 @@ const Displacement kNoDisplacement = { 0, 0, 1.0, 1.0 }; * height height of the image in the buffer */ static void transformToRows(byte *img, uint16 width, uint16 height) { - byte *buf = new byte[width * height]; + byte *buf = new byte[(uint)(width * height)]; byte *tmp = buf; - memcpy(buf, img, width * height); + memcpy(buf, img, (uint)(width * height)); for (uint16 i = 0; i < width; ++i) { for (uint16 j = 0; j < height; ++j) { From ee9e6b94ae73701f1c8f416464def62d905f2f9d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 17 Oct 2013 13:40:26 +0200 Subject: [PATCH 1306/1332] DRASCULA: Fix build --- engines/drascula/converse.cpp | 6 +++--- engines/drascula/drascula.cpp | 2 +- engines/drascula/graphics.cpp | 10 +++++----- engines/drascula/objects.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index 2aa12e106bd6..b3749445ec0d 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -168,19 +168,19 @@ void DrasculaEngine::converse(int index) { // delete stream; if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) { - strlcpy(phrase3, _text[405], 128); + Common::strlcpy(phrase3, _text[405], 128); strcpy(sound3, "405.als"); answer3 = 31; } if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[7] == 1) { - strlcpy(phrase3, _text[273], 128); + Common::strlcpy(phrase3, _text[273], 128); strcpy(sound3, "273.als"); answer3 = 14; } if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[10] == 1) { - strlcpy(phrase3, _text[274], 128); + Common::strlcpy(phrase3, _text[274], 128); strcpy(sound3, "274.als"); answer3 = 15; } diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 369e28c9e1f4..d25b37d18dce 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -324,7 +324,7 @@ Common::Error DrasculaEngine::run() { memset(iconName, 0, sizeof(iconName)); for (i = 0; i < 6; i++) - strlcpy(iconName[i + 1], _textverbs[i], 13); + Common::strlcpy(iconName[i + 1], _textverbs[i], 13); assignPalette(defaultPalette); diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index a28ca8a1cb89..fe954279c343 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -336,7 +336,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { // original starts printing 4 lines above textY int y = CLIP(textY - (4 * CHAR_HEIGHT), 0, 320); - strlcpy(msg, message, 200); + Common::strlcpy(msg, message, 200); // If the message fits on screen as-is, just print it here if (textFitsCentered(msg, textX)) { @@ -363,8 +363,8 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { while (curWord != NULL) { // Check if the word and the current line fit on screen if (tmpMessageLine[0] != '\0') - strlcat(tmpMessageLine, " ", 200); - strlcat(tmpMessageLine, curWord, 200); + Common::strlcat(tmpMessageLine, " ", 200); + Common::strlcat(tmpMessageLine, curWord, 200); if (textFitsCentered(tmpMessageLine, textX)) { // Line fits, so add the word to the current message line strcpy(messageLine, tmpMessageLine); @@ -374,8 +374,8 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { // If it goes off screen, print_abc will adjust it x = CLIP(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255); print_abc(messageLine, x, y + curLine * CHAR_HEIGHT); - strlcpy(messageLine, curWord, 200); - strlcpy(tmpMessageLine, curWord, 200); + Common::strlcpy(messageLine, curWord, 200); + Common::strlcpy(tmpMessageLine, curWord, 200); curLine++; } diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index acc4bbf7ac54..519e9194331c 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -266,7 +266,7 @@ void DrasculaEngine::updateVisible() { if (_roomNumber == 22 && flags[27] == 1) visible[3] = 0; if (_roomNumber == 26 && flags[21] == 0) { - strlcpy(objName[2], _textmisc[0], 20); + Common::strlcpy(objName[2], _textmisc[0], 20); } if (_roomNumber == 26 && flags[18] == 1) visible[2] = 0; From c7ca276e101914066e972920229538747fa77298 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Oct 2013 08:46:15 -0400 Subject: [PATCH 1307/1332] TSAGE: Fix error in calculating voice file offsets --- engines/tsage/sound.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index f985650b7a88..02abc5817881 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2654,14 +2654,14 @@ uint32 PlayStream::getFileOffset(const uint16 *data, int count, int voiceNum) { if (!v) return 0; - // Loop to figure out offsets from indexes skipped over + // Loop to figure out offsets from index words skipped over for (int i = 0; i < (voiceNum >> 3); ++i) { for (int bit = 0; bit < 16; bit += 2) offset += ((data[i] >> bit) & 3) * count; } // Bit index loop - for (int i = 0; i < bitsIndex; --i) + for (int i = 0; i < bitsIndex; ++i) offset += ((data[byteIndex] >> (i * 2)) & 3) * count; return offset; From 964fd22e4aebb30f22ff6358ea7140dec28c5d9a Mon Sep 17 00:00:00 2001 From: urukgit Date: Tue, 15 Oct 2013 22:24:44 +0200 Subject: [PATCH 1308/1332] AVALANCHE: Fix crash on "With" after loading from Launcher. The faulty uninitialized variable was _lastPerson. Better to call the whole resetVariables() so hopefully nothing similar will happen from now. --- engines/avalanche/avalanche.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 29e9d02bb403..4f3868768a12 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -352,6 +352,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { t.tm_mon = f->readSint16LE(); t.tm_year = f->readSint16LE(); + resetVariables(); + Common::Serializer sz(f, NULL); synchronize(sz); delete f; From 96ae25eca9492a113d8d89f85edec8a98632b3eb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Oct 2013 23:36:03 +0200 Subject: [PATCH 1309/1332] AVALANCHE: Remove a couple of useless variables from Animation. This breaks savegames. --- engines/avalanche/animation.cpp | 17 +++++++---------- engines/avalanche/animation.h | 2 -- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 71070b2af74f..05c90266284f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -91,21 +91,22 @@ void AnimationType::init(byte spritenum, bool doCheck) { _xLength = inf.readByte(); _yLength = inf.readByte(); _seq = inf.readByte(); - _size = inf.readUint16LE(); + uint16 size = inf.readUint16LE(); + assert (size > 6); _fgBubbleCol = (Color)inf.readByte(); _bgBubbleCol = (Color)inf.readByte(); _acciNum = inf.readByte(); _animCount = 0; // = 1; - _xWidth = _xLength / 8; + byte xWidth = _xLength / 8; if ((_xLength % 8) > 0) - _xWidth++; + xWidth++; for (int i = 0; i < _frameNum; i++) { _sil[_animCount] = new SilType[11 * (_yLength + 1)]; - _mani[_animCount] = new ManiType[_size - 6]; + _mani[_animCount] = new ManiType[size - 6]; for (int j = 0; j <= _yLength; j++) - inf.read((*_sil[_animCount])[j], _xWidth); - inf.read(*_mani[_animCount], _size - 6); + inf.read((*_sil[_animCount])[j], xWidth); + inf.read(*_mani[_animCount], size - 6); _animCount++; } @@ -367,9 +368,6 @@ void AnimationType::chatter() { void AnimationType::remove() { _animCount--; - _xWidth = _xLength / 8; - if ((_xLength % 8) > 0) - _xWidth++; for (int i = 0; i < _frameNum; i++) { assert(_animCount > 0); _animCount--; @@ -1439,7 +1437,6 @@ void Animation::synchronize(Common::Serializer &sz) { sz.syncAsByte(spr->_visible); sz.syncAsByte(spr->_homing); sz.syncAsByte(spr->_count); - sz.syncAsByte(spr->_xWidth); sz.syncAsByte(spr->_speedX); sz.syncAsByte(spr->_speedY); sz.syncAsByte(spr->_animCount); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 5dbaa5afd7f0..74cf56ac857c 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -43,11 +43,9 @@ enum Direction { class AnimationType { public: // Former SpriteInfo structure - byte _xWidth; byte _xLength, _yLength; ManiType *_mani[24]; SilType *_sil[24]; - uint16 _size; // The size of one picture. // Former Stat structure Common::String _name; // Name of character. From b82a5e6a8b0c2998622392292f5ada4fc4b7e7de Mon Sep 17 00:00:00 2001 From: urukgit Date: Wed, 16 Oct 2013 00:04:07 +0200 Subject: [PATCH 1310/1332] AVALANCHE: Rework AvalancheEngine::bearing(), repair Background::update(). --- engines/avalanche/avalot.cpp | 7 ++++--- engines/avalanche/background.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 352ac6a8523e..d7d800767e42 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1379,10 +1379,11 @@ uint16 AvalancheEngine::bearing(byte whichPed) { int16 deltaX = avvy->_x - curPed->_x; int16 deltaY = avvy->_y - curPed->_y; - if (deltaX < 0) { - return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 90); + uint16 result = (uint16)(atan((float)(deltaY / deltaX)) * 180 / M_PI); + if (avvy->_x < curPed->_x) { + return result + 90; } else { - return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 270); + return result + 270; } } diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index fc172871cc75..c84c049c8f98 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -115,7 +115,7 @@ void Background::update() { direction = 3; else if ((angle >= 293) && (angle <= 357)) direction = 2; - else if ((angle >= 271) && (angle <= 292)) + else if ((angle >= 270) && (angle <= 292)) direction = 4; if (direction != _vm->_npcFacing) { // Dogfood. From ecb1bf69b9f3cfd16d35ff8bb326c192c88daa84 Mon Sep 17 00:00:00 2001 From: urukgit Date: Wed, 16 Oct 2013 00:14:46 +0200 Subject: [PATCH 1311/1332] AVALANCHE: Repair parameters for calling zoomOut(). --- engines/avalanche/avalot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index d7d800767e42..497812cb082f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -803,7 +803,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { // You're entering the map. fadeIn(); if (ped > 0) - _graphics->zoomOut(_peds[ped]._x, _peds[ped]._y); + _graphics->zoomOut(_peds[ped - 1]._x, _peds[ped - 1]._y); if ((_objects[kObjectWine - 1]) && (_wineState != 3)) { _dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! From 06f94c10854162dd0fdfade2879880ea454bd11f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Oct 2013 06:58:31 +0200 Subject: [PATCH 1312/1332] AVALANCHE: Remove 3 useless variables in Animation --- engines/avalanche/animation.cpp | 29 +++++++++-------------------- engines/avalanche/animation.h | 3 --- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 05c90266284f..d1d3fd14a31e 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -74,20 +74,12 @@ void AnimationType::init(byte spritenum, bool doCheck) { // Replace variable named 'soa' in the original code. inf.skip(2); + // Skip real name Size (1 byte) then fixed sized zone containing name (12 bytes) + inf.skip(1 + 12); + // Skip real comment size (1 byte) then fixed sized zone containing comment (16 bytes) + inf.skip(1 + 16); - if (!_name.empty()) - _name.clear(); - byte nameSize = inf.readByte(); - for (int i = 0; i < nameSize; i++) - _name += inf.readByte(); - inf.skip(12 - nameSize); - - byte commentSize = inf.readByte(); - for (int i = 0; i < commentSize; i++) - _comment += inf.readByte(); - inf.skip(16 - commentSize); - - _frameNum = inf.readByte(); + byte frameNum = inf.readByte(); _xLength = inf.readByte(); _yLength = inf.readByte(); _seq = inf.readByte(); @@ -101,7 +93,7 @@ void AnimationType::init(byte spritenum, bool doCheck) { byte xWidth = _xLength / 8; if ((_xLength % 8) > 0) xWidth++; - for (int i = 0; i < _frameNum; i++) { + for (int i = 0; i < frameNum; i++) { _sil[_animCount] = new SilType[11 * (_yLength + 1)]; _mani[_animCount] = new ManiType[size - 6]; for (int j = 0; j <= _yLength; j++) @@ -367,12 +359,9 @@ void AnimationType::chatter() { } void AnimationType::remove() { - _animCount--; - for (int i = 0; i < _frameNum; i++) { - assert(_animCount > 0); - _animCount--; - delete[] _mani[_animCount]; - delete[] _sil[_animCount]; + for (int i = _animCount - 2; i > 0; i--) { + delete[] _mani[i]; + delete[] _sil[i]; } _quick = false; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 74cf56ac857c..787f60e814fc 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -48,9 +48,6 @@ class AnimationType { SilType *_sil[24]; // Former Stat structure - Common::String _name; // Name of character. - Common::String _comment; // Comment. - byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. byte _acciNum; // The number according to Acci. (1=Avvy, etc.) From 5f180a06baa3e9e63015b2efb698770e897875df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Oct 2013 07:18:06 +0200 Subject: [PATCH 1313/1332] AVALANCHE: Rework animation init/remove some more --- engines/avalanche/animation.cpp | 22 +++++++++------------- engines/avalanche/animation.h | 4 ++-- engines/avalanche/dialogs.cpp | 4 ++-- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d1d3fd14a31e..d2c700a09f88 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -79,7 +79,7 @@ void AnimationType::init(byte spritenum, bool doCheck) { // Skip real comment size (1 byte) then fixed sized zone containing comment (16 bytes) inf.skip(1 + 16); - byte frameNum = inf.readByte(); + _frameNum = inf.readByte(); _xLength = inf.readByte(); _yLength = inf.readByte(); _seq = inf.readByte(); @@ -87,22 +87,18 @@ void AnimationType::init(byte spritenum, bool doCheck) { assert (size > 6); _fgBubbleCol = (Color)inf.readByte(); _bgBubbleCol = (Color)inf.readByte(); - _acciNum = inf.readByte(); + _characterId = inf.readByte(); - _animCount = 0; // = 1; byte xWidth = _xLength / 8; if ((_xLength % 8) > 0) xWidth++; - for (int i = 0; i < frameNum; i++) { - _sil[_animCount] = new SilType[11 * (_yLength + 1)]; - _mani[_animCount] = new ManiType[size - 6]; + for (int i = 0; i < _frameNum; i++) { + _sil[i] = new SilType[11 * (_yLength + 1)]; + _mani[i] = new ManiType[size - 6]; for (int j = 0; j <= _yLength; j++) - inf.read((*_sil[_animCount])[j], xWidth); - inf.read(*_mani[_animCount], size - 6); - - _animCount++; + inf.read((*_sil[i])[j], xWidth); + inf.read(*_mani[i], size - 6); } - _animCount++; _x = 0; _y = 0; @@ -359,7 +355,7 @@ void AnimationType::chatter() { } void AnimationType::remove() { - for (int i = _animCount - 2; i > 0; i--) { + for (int i = 0; i < _frameNum; i++) { delete[] _mani[i]; delete[] _sil[i]; } @@ -1428,7 +1424,7 @@ void Animation::synchronize(Common::Serializer &sz) { sz.syncAsByte(spr->_count); sz.syncAsByte(spr->_speedX); sz.syncAsByte(spr->_speedY); - sz.syncAsByte(spr->_animCount); + sz.syncAsByte(spr->_frameNum); sz.syncAsSint16LE(spr->_homingX); sz.syncAsSint16LE(spr->_homingY); sz.syncAsByte(spr->_callEachStepFl); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 787f60e814fc..703d35c832bb 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -48,9 +48,10 @@ class AnimationType { SilType *_sil[24]; // Former Stat structure + byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. - byte _acciNum; // The number according to Acci. (1=Avvy, etc.) + byte _characterId; // The number according to Acci. (1=Avvy, etc.) // Direction _facingDir; @@ -62,7 +63,6 @@ class AnimationType { int16 _homingX, _homingY; // Homing x & y coords. byte _count; // Counts before changing step. byte _speedX, _speedY; // x & y speed. - byte _animCount; // Total number of sprites. bool _vanishIfStill; // Do we show this sprite if it's still? bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 364343bfd44a..750dd80cc66e 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1074,7 +1074,7 @@ void Dialogs::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]->_acciNum == whom) { + if (_vm->_animation->_sprites[i]->_characterId == whom) { Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); noMatches = false; @@ -1135,7 +1135,7 @@ Common::String Dialogs::personSpeaks() { for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { AnimationType *curSpr = _vm->_animation->_sprites[i]; - if (curSpr->_quick && (curSpr->_acciNum + 149 == _vm->_parser->_person)) { + if (curSpr->_quick && (curSpr->_characterId + 149 == _vm->_parser->_person)) { tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); found = true; } From 5f0361c03a5cfd328872684d8bba51ae12f3d1c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Oct 2013 01:43:51 +0200 Subject: [PATCH 1314/1332] AVALANCHE: Move Bubble pos to Dialogs, make them private --- engines/avalanche/animation.cpp | 3 +-- engines/avalanche/avalanche.h | 1 - engines/avalanche/dialogs.cpp | 35 +++++++++++++++++++++------------ engines/avalanche/dialogs.h | 3 +++ engines/avalanche/graphics.cpp | 13 ++++++------ 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d2c700a09f88..8542c6c46e1f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -349,8 +349,7 @@ void AnimationType::stopWalk() { * Sets up talk vars. */ void AnimationType::chatter() { - _anim->_vm->_talkX = _x + _xLength / 2; - _anim->_vm->_talkY = _y; + _anim->_vm->_dialogs->setTalkPos(_x + _xLength / 2, _y); _anim->_vm->_graphics->setDialogColor(_bgBubbleCol, _fgBubbleCol); } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 7141d3cfa47e..f4d5f6a1d71f 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -240,7 +240,6 @@ class AvalancheEngine : public Engine { bool _letMeOut; byte _thinks; bool _thinkThing; - int16 _talkX, _talkY; bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; // Called .free() for them in ~Gyro(). diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 750dd80cc66e..444b157d1cf2 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -519,18 +519,18 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { int16 my = yw * 2 - 2; int16 xc = 0; - if ((_vm->_talkX - xw) < 0) - xc = -(_vm->_talkX - xw); - if ((_vm->_talkX + xw) > 639) - xc = 639 - (_vm->_talkX + xw); + if (_talkX - xw < 0) + xc = -(_talkX - xw); + if (_talkX + xw > 639) + xc = 639 - (_talkX + xw); // Compute triangle coords for the tail of the bubble - points[0].x = _vm->_talkX - 10; + points[0].x = _talkX - 10; points[0].y = yw; - points[1].x = _vm->_talkX + 10; + points[1].x = _talkX + 10; points[1].y = yw; - points[2].x = _vm->_talkX; - points[2].y = _vm->_talkY; + points[2].x = _talkX; + points[2].y = _talkY; _vm->_graphics->prepareBubble(xc, xw, my, points); @@ -538,7 +538,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used characters instead. // It's almost the same, only notable differences are '?', '!', etc. for (int i = 0; i <= _maxLineNum; i++) { - int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; + int16 x = xc + _talkX - _scroll[i].size() / 2 * 8; bool offset = _scroll[i].size() % 2; _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_graphics->_talkFontColor); } @@ -568,8 +568,8 @@ void Dialogs::reset() { * @remarks Originally called 'natural' */ void Dialogs::setBubbleStateNatural() { - _vm->_talkX = 320; - _vm->_talkY = 200; + _talkX = 320; + _talkY = 200; _vm->_graphics->setDialogColor(kColorDarkgray, kColorWhite); } @@ -699,8 +699,8 @@ void Dialogs::callDialogDriver() { // thing with QPs as triptype.chatter does with the // sprites.) PedType *quasiPed = &_vm->_peds[kQuasipeds[_param - 10]._whichPed]; - _vm->_talkX = quasiPed->_x; - _vm->_talkY = quasiPed->_y; // Position. + _talkX = quasiPed->_x; + _talkY = quasiPed->_y; // Position. _vm->_graphics->setDialogColor(kQuasipeds[_param - 10]._backgroundColor, kQuasipeds[_param - 10]._textColor); } else { @@ -803,6 +803,15 @@ void Dialogs::callDialogDriver() { } } +void Dialogs::setTalkPos(int16 x, int16 y) { + _talkX = x; + _talkY = y; +} + +int16 Dialogs::getTalkPosX() { + return _talkX; +} + /** * Display text by calling the dialog driver * @remarks Originally called 'display' diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 5d105245dd1d..aa24db6f50a5 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -49,6 +49,8 @@ class Dialogs { void setReadyLight(byte state); void displayText(Common::String text); bool displayQuestion(Common::String question); + void setTalkPos(int16 x, int16 y); + int16 getTalkPosX(); void setBubbleStateNatural(); void displayMusicalScroll(); void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); @@ -61,6 +63,7 @@ class Dialogs { void saySilly(); private: AvalancheEngine *_vm; + int16 _talkX, _talkY; enum FontStyle { kFontStyleRoman, diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b3ba95fd8014..a802a0123844 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -653,15 +653,16 @@ void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[ // Backup the screen before drawing the bubble. _scrolls.copyFrom(_surface); + int16 talkX = _vm->_dialogs->getTalkPosX(); // The body of the bubble. - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _talkBackgroundColor); - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + talkX - xw + 9, 7, talkX + xw - 8 + xc, my + 1), _talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + talkX - xw - 1, 12, talkX + xw + xc + 2, my - 4), _talkBackgroundColor); // Top the 4 rounded corners of the bubble. - drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _talkBackgroundColor); - drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _talkBackgroundColor); - drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _talkBackgroundColor); - drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _talkBackgroundColor); + drawPieSlice(xc + talkX + xw - 10, 11, 0, 90, 9, _talkBackgroundColor); + drawPieSlice(xc + talkX + xw - 10, my - 4, 270, 360, 9, _talkBackgroundColor); + drawPieSlice(xc + talkX - xw + 10, 11, 90, 180, 9, _talkBackgroundColor); + drawPieSlice(xc + talkX - xw + 10, my - 4, 180, 270, 9, _talkBackgroundColor); // "Tail" of the speech bubble. drawTriangle(points, _talkBackgroundColor); From 1c3fcf22a1b3665fc4bfb0343b6de315bbf9a324 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Oct 2013 08:17:03 +0200 Subject: [PATCH 1315/1332] AVALANCHE: Some more refactoring --- engines/avalanche/animation.cpp | 19 ++++++++++++++++++- engines/avalanche/animation.h | 22 +++++++++++----------- engines/avalanche/avalanche.h | 3 --- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/enums.h | 4 ++++ engines/avalanche/graphics.cpp | 2 +- engines/avalanche/menu.cpp | 12 +++++++----- engines/avalanche/parser.cpp | 11 ++--------- 8 files changed, 44 insertions(+), 31 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 8542c6c46e1f..ef30faa87cf7 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -104,7 +104,7 @@ void AnimationType::init(byte spritenum, bool doCheck) { _y = 0; _quick = true; _visible = false; - _speedX = 3; + _speedX = kWalk; _speedY = 1; _homing = false; _moveX = 0; @@ -1376,6 +1376,23 @@ Direction Animation::getOldDirection() { return _oldDirection; } +void Animation::setAvvyClothes(int id) { + AnimationType *spr = _sprites[0]; + if (spr->_id == id) + return; + + int16 x = spr->_x; + int16 y = spr->_y; + spr->remove(); + spr->init(id, true); + spr->appear(x, y, kDirLeft); + spr->_visible = false; +} + +int Animation::getAvvyClothes() { + return _sprites[0]->_id; +} + void Animation::resetVariables() { _geidaSpin = 0; _geidaTime = 0; diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 703d35c832bb..33f6ab02a6c4 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -42,29 +42,25 @@ enum Direction { class AnimationType { public: - // Former SpriteInfo structure + byte _id; + byte _xLength, _yLength; ManiType *_mani[24]; SilType *_sil[24]; - - // Former Stat structure byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. - Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. byte _characterId; // The number according to Acci. (1=Avvy, etc.) - // + byte _count; // Counts before changing step. Direction _facingDir; byte _stepNum; int16 _x, _y; // Current xy coords. int8 _moveX, _moveY; // Amount to move sprite by, each step. - byte _id; bool _quick, _visible, _homing, _doCheck; int16 _homingX, _homingY; // Homing x & y coords. - byte _count; // Counts before changing step. - byte _speedX, _speedY; // x & y speed. - bool _vanishIfStill; // Do we show this sprite if it's still? - bool _callEachStepFl; // Do we call the eachstep procedure? + byte _speedX, _speedY; + bool _vanishIfStill; + bool _callEachStepFl; byte _eachStepProc; AnimationType(Animation *anim); @@ -78,7 +74,6 @@ class AnimationType { void walk(); void walkTo(byte pednum); void stopHoming(); - void homeStep(); void setSpeed(int8 xx, int8 yy); void stopWalk(); void chatter(); @@ -88,9 +83,11 @@ class AnimationType { Animation *_anim; int16 _oldX[2], _oldY[2]; // Last xy coords. + Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. bool checkCollision(); int8 getSign(int16 val); + void homeStep(); }; class Animation { @@ -132,6 +129,9 @@ class Animation { Direction getDirection(); Direction getOldDirection(); + void setAvvyClothes(int id); + int getAvvyClothes(); + void resetVariables(); void synchronize(Common::Serializer &sz); private: diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index f4d5f6a1d71f..cc9a34d82b39 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -164,9 +164,6 @@ class AvalancheEngine : public Engine { static const bool kThing = true; static const bool kPerson = false; - // These following static constants should be included in CFG when it's written. - static const int16 kWalk = 3; - static const int16 kRun = 5; static const char kSpludwicksOrder[3]; static const uint16 kNotes[12]; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 497812cb082f..8ef41a2c9386 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -851,7 +851,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) { case kRoomLustiesRoom: _npcFacing = 1; // du Lustie. - if (_animation->_sprites[0]->_id == 0) // Avvy in his normal clothes + if (_animation->getAvvyClothes() == 0) // Avvy in his normal clothes _timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); else if (!_enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 155c9ac0609f..604c62de8445 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -124,6 +124,10 @@ enum ControlCharacter { static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; +static const int16 kWalk = 3; +static const int16 kRun = 5; + + } // End of namespace Avalanche #endif // AVALANCHE_ENUMS_H diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a802a0123844..25b01d65f377 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -394,7 +394,7 @@ void GraphicManager::drawMenuItem(int x1, int y1, int x2, int y2) { } void GraphicManager::drawSpeedBar(int speed) { - if (speed == _vm->kRun) { + if (speed == kRun) { _surface.drawLine(336, 199, 338, 199, kColorLightblue); _surface.drawLine(371, 199, 373, 199, kColorYellow); } else { diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 59ac38f64447..bba8e862a981 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -62,7 +62,9 @@ void HeadType::highlight() { _menu->_activeMenuItem._activeNum = _position; _menu->_menuActive = true; - _menu->_vm->_currentMouse = 177; // Force redraw of cursor. + // Force reload and redraw of cursor. + _menu->_vm->_currentMouse = 177; + } bool HeadType::parseAltTrigger(char key) { @@ -431,7 +433,7 @@ void Menu::setupMenuAction() { _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_animation->_sprites[0]->_speedX == _vm->kWalk) + if (_vm->_animation->_sprites[0]->_speedX == kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -596,10 +598,10 @@ void Menu::runMenuAction() { break; case 5: { AnimationType *avvy = _vm->_animation->_sprites[0]; - if (avvy->_speedX == _vm->kWalk) - avvy->_speedX = _vm->kRun; + if (avvy->_speedX == kWalk) + avvy->_speedX = kRun; else - avvy->_speedX = _vm->kWalk; + avvy->_speedX = kWalk; _vm->_animation->updateSpeed(); } break; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d85e55032c1b..fc176c78b010 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1926,15 +1926,8 @@ void Parser::doThat() { i = 3; else i = 0; - Avalanche::AnimationType *spr = _vm->_animation->_sprites[0]; - if (spr->_id != i) { - int16 x = spr->_x; - int16 y = spr->_y; - spr->remove(); - spr->init(i, true); - spr->appear(x, y, kDirLeft); - spr->_visible = false; - } + + _vm->_animation->setAvvyClothes(i); } break; default: From 38b842ba71aceb0e9bd1b174cb4a660eef1df16b Mon Sep 17 00:00:00 2001 From: urukgit Date: Thu, 17 Oct 2013 19:05:24 +0200 Subject: [PATCH 1316/1332] AVALANCHE: callDialogDriver, displayText, unSkrimble, doTheBubble string cleanup Unify callDialogDriver() and displayText(). Rework it, unSkrimble() and doTheBubble() to use Common::String instead of a private buffer. This fixes the bug regarding examining the money bag. --- engines/avalanche/dialogs.cpp | 73 ++++++++++++++++------------------- engines/avalanche/dialogs.h | 7 +--- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 444b157d1cf2..e5acd9cae25c 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -623,8 +623,10 @@ void Dialogs::solidify(byte n) { /** * @remarks Originally called 'calldriver' + * Display text by calling the dialog driver. It unifies the function of the original + * 'calldriver' and 'display' by using Common::String instead of a private buffer. */ -void Dialogs::callDialogDriver() { +void Dialogs::displayText(Common::String text) { // bool was_virtual; // Was the mouse cursor virtual on entry to this proc? warning("STUB: Scrolls::calldrivers()"); @@ -635,30 +637,29 @@ void Dialogs::callDialogDriver() { bool mouthnext = false; bool callSpriteRun = true; // Only call sprite_run the FIRST time. - switch (_buffer[_bufSize - 1]) { + switch (text.lastChar()) { case kControlToBuffer: - _bufSize--; + text.deleteLastChar(); break; // ^D = (D)on't include pagebreak case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box default: - _buffer[_bufSize] = kControlParagraph; - _bufSize++; + text.insertChar(kControlParagraph, text.size()); } - for (uint16 i = 0; i < _bufSize; i++) { + for (uint16 i = 0; i < text.size(); i++) { if (mouthnext) { - if (_buffer[i] == kControlRegister) + if (text[i] == kControlRegister) _param = 0; - else if (('0' <= _buffer[i]) && (_buffer[i] <= '9')) - _param = _buffer[i] - 48; - else if (('A' <= _buffer[i]) && (_buffer[i] <= 'Z')) - _param = _buffer[i] - 55; + else if (('0' <= text[i]) && (text[i] <= '9')) + _param = text[i] - 48; + else if (('A' <= text[i]) && (text[i] <= 'Z')) + _param = text[i] - 55; mouthnext = false; } else { - switch (_buffer[i]) { + switch (text[i]) { case kControlParagraph: if ((_maxLineNum == 0) && (_scroll[0].empty())) break; @@ -796,7 +797,7 @@ void Dialogs::callDialogDriver() { solidify(_maxLineNum); _maxLineNum++; } - _scroll[_maxLineNum] += _buffer[i]; + _scroll[_maxLineNum] += text[i]; break; } } @@ -812,16 +813,6 @@ int16 Dialogs::getTalkPosX() { return _talkX; } -/** - * Display text by calling the dialog driver - * @remarks Originally called 'display' - */ -void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! - _bufSize = text.size(); - memcpy(_buffer, text.c_str(), _bufSize); - callDialogDriver(); -} - bool Dialogs::displayQuestion(Common::String question) { displayText(question + kControlNewLine + kControlQuestion); @@ -879,15 +870,14 @@ void Dialogs::displayMusicalScroll() { reset(); } -void Dialogs::unSkrimble() { - for (uint16 i = 0; i < _bufSize; i++) - _buffer[i] = (~(_buffer[i] - (i + 1))) % 256; +void Dialogs::unSkrimble(Common::String &text) { + for (uint16 i = 0; i < text.size(); i++) + text.setChar((~(text[i] - (i + 1))) % 256, i); } -void Dialogs::doTheBubble() { - _buffer[_bufSize] = 2; - _bufSize++; - assert(_bufSize < 2000); +void Dialogs::doTheBubble(Common::String &text) { + text.insertChar(kControlSpeechBubble, text.size()); + assert(text.size() < 2000); } /** @@ -928,16 +918,18 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl ::error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sez_offset); - _bufSize = sezfile.readUint16LE(); + uint16 _bufSize = sezfile.readUint16LE(); assert(_bufSize < 2000); + char *_buffer = new char[_bufSize]; sezfile.read(_buffer, _bufSize); sezfile.close(); - unSkrimble(); + Common::String text(_buffer, _bufSize); + delete[] _buffer; + unSkrimble(text); if (bubbling) - doTheBubble(); - - callDialogDriver(); + doTheBubble(text); + displayText(text); } /** @@ -975,15 +967,18 @@ void Dialogs::speak(byte who, byte subject) { error("AVALANCHE: Visa: File not found: avalot.sez"); sezfile.seek(sezOffset); - _bufSize = sezfile.readUint16LE(); + uint16 _bufSize = sezfile.readUint16LE(); assert(_bufSize < 2000); + char *_buffer = new char[_bufSize]; sezfile.read(_buffer, _bufSize); sezfile.close(); + Common::String text(_buffer, _bufSize); + delete[] _buffer; - unSkrimble(); - doTheBubble(); + unSkrimble(text); + doTheBubble(text); + displayText(text); - callDialogDriver(); _noError = true; } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index aa24db6f50a5..43e6a4fec6fd 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -82,12 +82,9 @@ class Dialogs { byte _param; // For using arguments code byte _useIcon; byte _scrollBells; // no. of times to ring the bell - byte _buffer[2000]; - uint16 _bufSize; int16 _underScroll; // Y-coord of just under the scroll text. int16 _shadowBoxX, _shadowBoxY; - void callDialogDriver(); void drawBubble(DialogFunctionType modeFunc); void drawScroll(DialogFunctionType modeFunc); void scrollModeNormal(); @@ -109,8 +106,8 @@ class Dialogs { void ringBell(); void loadFont(); - void unSkrimble(); - void doTheBubble(); + void unSkrimble(Common::String &text); + void doTheBubble(Common::String &text); void speak(byte who, byte subject); }; From 2f1387bb26ffdc3bb7dd0066e7023c2818cb77dd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 22:44:30 +0300 Subject: [PATCH 1317/1332] FULLPIPE: Implement MovGraph2::findLink1() --- engines/fullpipe/motion.cpp | 35 +++++++++++++++++++++++++++++++++-- engines/fullpipe/utils.h | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 0c0db322f864..da6a82ffeb15 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -685,6 +685,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int if (!linkInfoDest.node) { linkInfoDest.link = findLink1(xpos, ypos, idxsub, fuzzyMatch); + if (!linkInfoDest.link) { obj->setPicAniInfo(&picAniInfo); @@ -826,9 +827,37 @@ int MovGraph2::findLink(Common::Array *linkList, MovGraphLink *l } MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { - warning("STUB: MovGraphLink *MovGraph2::findLink1()"); + Common::Point point; + MovGraphLink *res = 0; - return 0; + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*i; + + if (fuzzyMatch) { + point.x = x; + point.y = y; + double dst = calcDistance(&point, lnk, 0); + + if (dst >= 0.0 && dst < 2.0) + return lnk; + } else if (!(lnk->_flags & 0x20000000)) { + if (lnk->_movGraphReact->pointInRegion(x, y)) { + if (abs(lnk->_movGraphNode1->_x - lnk->_movGraphNode2->_x) <= abs(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y)) { + if (idx == 2 || idx == 3) + return lnk; + res = lnk; + } else { + if (idx == 1 || !idx) + return lnk; + res = lnk; + } + } + } + } + + return res; } MovGraphLink *MovGraph2::findLink2(int x, int y) { @@ -919,6 +948,8 @@ MovGraphLink::MovGraphLink() { _field_38 = 0; _movGraphReact = 0; _name = 0; + + _objtype = kObjTypeMovGraphLink; } bool MovGraphLink::load(MfcArchive &file) { diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index d976e09d602a..64f56ced0a3c 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -67,6 +67,7 @@ class MfcArchive : public Common::SeekableReadStream { enum ObjType { kObjTypeDefault, kObjTypeMovGraph, + kObjTypeMovGraphLink, kObjTypeMovGraphNode, kObjTypeMctlCompound, kObjTypeObjstateCommand, From 109ff80475d036ad426df9fc236de9e8108d4e00 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 23:09:26 +0300 Subject: [PATCH 1318/1332] FULLPIPE: Implement MovGraph2::findLink2() --- engines/fullpipe/motion.cpp | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index da6a82ffeb15..b49b2974517d 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -861,9 +861,45 @@ MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { } MovGraphLink *MovGraph2::findLink2(int x, int y) { - warning("STUB: MovGraphLink *MovGraph2::findLink2()"); + double mindist = 1.0e20; + MovGraphLink *res; - return 0; + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*i; + + if (!(lnk->_flags & 0x20000000)) { + double n1x = lnk->_movGraphNode1->_x; + double n1y = lnk->_movGraphNode1->_y; + double n2x = lnk->_movGraphNode2->_x; + double n2y = lnk->_movGraphNode2->_y; + double n1dx = n1x - x; + double n1dy = n1y - y; + double dst1 = sqrt(n1dy * n1dy + n1dx * n1dx); + double coeff1 = ((n1y - n2y) * n1dy + (n2x - n1x) * n1dx) / lnk->_distance / dst1; + double dst3 = coeff1 * dst1; + double dst2 = sqrt(1.0 - coeff1 * coeff1) * dst1; + + if (coeff1 * dst1 < 0.0) { + dst3 = 0.0; + dst2 = sqrt(n1dy * n1dy + n1dx * n1dx); + } + if (dst3 > lnk->_distance) { + dst3 = lnk->_distance; + dst2 = sqrt((n2x - x) * (n2x - x) + (n2y - y) * (n2y - y)); + } + if (dst3 >= 0.0 && dst3 <= lnk->_distance && dst2 < mindist) { + mindist = dst2; + res = lnk; + } + } + } + + if (mindist < 1.0e20) + return res; + else + return 0; } double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array *listObj) { From 748ba2475a2486196484246dc461d435c2564aba Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 17 Oct 2013 22:32:49 +0200 Subject: [PATCH 1319/1332] AVALANCHE: Fix broken xml entity in credits --- AUTHORS | 8 ++++---- devtools/credits.pl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index e561aec4fd17..5d043bae313a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -61,10 +61,10 @@ ScummVM Team Travis Howell Oliver Kiehl - (retired) Ludvig Strigeus - (retired) - - AVALANCHE: - Peter Bozso - Arnaud Boutonne + + AVALANCHE: + Peter Bozso + Arnaud Boutonne CGE: Arnaud Boutonne diff --git a/devtools/credits.pl b/devtools/credits.pl index 50efb42a55a2..f652773b33b1 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -543,7 +543,7 @@ sub add_paragraph { end_section(); begin_section("AVALANCHE"); - add_person("Peter Bozsó", "uruk", ""); + add_person("Peter Bozsó", "uruk", ""); add_person("Arnaud Boutonné", "Strangerke", ""); end_section(); From 6b9abcc2ec8409f37a9926a35d061096fab60018 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 17 Oct 2013 23:53:49 +0300 Subject: [PATCH 1320/1332] NEVERHOOD: Another fix for Russian version --- engines/neverhood/resourceman.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/neverhood/resourceman.cpp b/engines/neverhood/resourceman.cpp index a53bcc839387..b7d560bbb3ea 100644 --- a/engines/neverhood/resourceman.cpp +++ b/engines/neverhood/resourceman.cpp @@ -105,6 +105,8 @@ static const EntrySizeFix entrySizeFixes[] = { { 0x80283101, 13104841, 1961, 3712, 3511 }, // The first message from Willie { 0x00918480, 17676417, 581, 916, 706 }, // The first wall in the museum { 0x00800090C,16064875, 19555, 38518, 38526 }, // The first wall in the museum + { 0x058208810,46010519, 24852, 131874, 131776}, // The entry to hut with musical lock + // Fixes for the Russian "Fargus" version { 0x41137051, 758264, 29037, 49590, 49591 }, // "Options" menu header text { 0xc10b2015, 787304, 4414, 15848, 15853 }, // Text on option buttons From e8fe506a1e3d48c0e0f3e9200f874a3155d2aecc Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 17 Oct 2013 22:35:24 -0400 Subject: [PATCH 1321/1332] BUILD: Mark ZVision as requiring freetype2/16bit --- engines/configure.engines | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/configure.engines b/engines/configure.engines index be1a91922bf1..ec7d4667caac 100644 --- a/engines/configure.engines +++ b/engines/configure.engines @@ -54,4 +54,4 @@ add_engine tony "Tony Tough and the Night of Roasted Moths" yes "" "" "16bit" add_engine tsage "TsAGE" yes add_engine tucker "Bud Tucker in Double Trouble" yes add_engine wintermute "Wintermute" no "" "" "jpeg png zlib vorbis 16bit" -add_engine zvision "ZVision" no +add_engine zvision "ZVision" no "" "" "freetype2 16bit" From 396808638d538e6c02f7ea111557928e4c6bdd71 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 17 Oct 2013 23:02:22 -0400 Subject: [PATCH 1322/1332] ZVISION: Consistently use the type of the state map Should fix the AmigaOS4 build --- engines/zvision/script_manager.cpp | 4 ++-- engines/zvision/script_manager.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index b33ca4c515dd..66a54088fdaa 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -196,7 +196,7 @@ void ScriptManager::checkPuzzleCriteria() { } void ScriptManager::cleanStateTable() { - for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { + for (StateMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { // If the value is equal to zero, we can purge it since getStateValue() // will return zero if _globalState doesn't contain a key if (iter->_value == 0) { @@ -384,7 +384,7 @@ void ScriptManager::serializeStateTable(Common::WriteStream *stream) { // Write the number of state value entries stream->writeUint32LE(_globalState.size()); - for (Common::HashMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { + for (StateMap::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) { // Write out the key/value pair stream->writeUint32LE(iter->_key); stream->writeUint32LE(iter->_value); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index c44c836171c5..388d0805e01f 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -53,6 +53,7 @@ typedef Common::HashMap > PuzzleMap; typedef Common::List PuzzleList; typedef Common::Queue PuzzleQueue; typedef Common::List ControlList; +typedef Common::HashMap StateMap; class ScriptManager { public: @@ -66,7 +67,7 @@ class ScriptManager { * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a * particular state key are checked after the key is modified. */ - Common::HashMap _globalState; + StateMap _globalState; /** References _globalState keys to Puzzles */ PuzzleMap _referenceTable; /** Holds the Puzzles that should be checked this frame */ From 3c6c91a60446016af2554df2ef8eaa6d5f4140ec Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 17 Oct 2013 23:07:47 -0400 Subject: [PATCH 1323/1332] ZVISION: Make the line height be an int --- engines/zvision/truetype_font.cpp | 4 ++-- engines/zvision/truetype_font.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index 8d6aaca51e52..289b5fbbaf7c 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -94,7 +94,7 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, u Common::Array lines; _font->wordWrapText(text, maxWidth, lines); - while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) { + while (maxHeight > 0 && (int)lines.size() * _lineHeight > maxHeight) { lines.pop_back(); } if (lines.size() == 0) { @@ -107,7 +107,7 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, u int heightOffset = 0; for (Common::Array::iterator it = lines.begin(); it != lines.end(); it++) { _font->drawString(surface, *it, 0, 0 + heightOffset, maxWidth, textColor, align); - heightOffset += (int)_lineHeight; + heightOffset += _lineHeight; } return surface; diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index 4f2ff864a8fe..33f016cffd8b 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -45,7 +45,7 @@ class TruetypeFont { private: ZVision *_engine; Graphics::Font *_font; - float _lineHeight; + int _lineHeight; size_t _maxCharWidth; size_t _maxCharHeight; From 821a7430dac9087399095e89f1e828c29b52d90a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 17 Oct 2013 23:39:05 -0400 Subject: [PATCH 1324/1332] WINTERMUTE: Remove useless __inline --- engines/wintermute/video/video_theora_player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index ddeba48bbcf4..a4f1b9edd6e4 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -90,7 +90,7 @@ class VideoTheoraPlayer : public BaseClass { BaseImage *_alphaImage; Common::String _alphaFilename; bool setAlphaImage(const Common::String &filename); - __inline byte getAlphaAt(int x, int y) const; + byte getAlphaAt(int x, int y) const; void writeAlpha(); bool seekToTime(uint32 Time); From aba818d19578836aab41e0bc484dfbdfc5da3231 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 18 Oct 2013 06:13:32 -0400 Subject: [PATCH 1325/1332] ZVISION: Attempt to fix compilation on AmigaOS4 --- engines/zvision/zork_raw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 55493da9b3f8..21613d90430b 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -127,7 +127,7 @@ int RawZorkStream::readBuffer(int16 *buffer, const int numSamples) { sample = -sample; sample += _lastSample[channel].sample; - sample = CLIP(sample, -32768, 32767); + sample = CLIP(sample, -32768, 32767); buffer[bytesRead - 1] = (int16)sample; From 8390e53fc03fcbaa89c6a89a6573806f6563f102 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 15:54:59 +0300 Subject: [PATCH 1326/1332] FULLPIPE: Plug resource leak. CID 1107570 --- engines/fullpipe/motion.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b49b2974517d..f6eb9d675316 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -635,6 +635,8 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int if (idxwalk == -1) { obj->setPicAniInfo(&picAniInfo); + delete mq; + return 0; } From 834ff819df5ec4b17989dfdf325e428a46ca5d02 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 15:56:50 +0300 Subject: [PATCH 1327/1332] DRACI: Fix negative array index read. CID 1003548 --- engines/draci/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 271eb1e02e04..ff5bcefc934b 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -981,7 +981,7 @@ void Game::dialogueMenu(int dialogueID) { debugC(7, kDraciLogicDebugLevel, "hit: %d, _lines[hit]: %d, lastblock: %d, dialogueLines: %d, dialogueExit: %d", - hit, _lines[hit], _lastBlock, _dialogueLinesNum, _dialogueExit); + hit, (hit >= 0 ? _lines[hit] : -1), _lastBlock, _dialogueLinesNum, _dialogueExit); if ((!_dialogueExit) && (hit >= 0) && (_lines[hit] != -1)) { if ((oldLines == 1) && (_dialogueLinesNum == 1) && (_lines[hit] == _lastBlock)) { From 2a6a23e88a8785a7f5f8fda5dc00ab0c71ee9bdc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 15:59:22 +0300 Subject: [PATCH 1328/1332] DRACI: Initialized class variables. CID 1003405 --- engines/draci/game.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index ff5bcefc934b..a5c8aa867ff2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -81,6 +81,25 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _walkingMapOverlay = 0; _walkingShortestPathOverlay = 0; _walkingObliquePathOverlay = 0; + _currentItem = 0; + _itemUnderCursor = 0; + _previousItemPosition = 0; + + for (i = 0; i < kInventorySlots; i++) + _inventory[i] = 0; + + _newRoom = 0; + _newGate = 0; + _previousRoom = 0; + _pushedNewRoom = 0; + _pushedNewGate = 0; + _currentDialogue = 0; + _dialogueArchive = 0; + _dialogueBlocks = 0; + _dialogueBegin = 0; + _dialogueExit = 0; + _currentBlock = 0; + _lastBlock = 0; BArchive *initArchive = _vm->_initArchive; const BAFile *file; From 6ff57db90f5ec7e9b437da161328dee74cbe9dae Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 16:01:10 +0300 Subject: [PATCH 1329/1332] DRASCULA: Initialize class variables. CID 1003403 --- engines/drascula/drascula.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index d25b37d18dce..9699dda02192 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -115,6 +115,32 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _roomActionsSize = 0; _talkSequencesSize = 0; _numLangs = 0; + feetHeight = 0; + floorX1 = 0; + floorY1 = 0; + floorX2 = 0; + floorY2 = 0; + lowerLimit = 0; + upperLimit = 0; + trackFinal = 0; + walkToObject = 0; + objExit = 0; + _startTime = 0; + hasAnswer = 0; + savedTime = 0; + breakOut = 0; + vonBraunX = 0; + trackVonBraun = 0; + vonBraunHasMoved = 0; + newHeight = 0; + newWidth = 0; + color_solo = 0; + igorX = 0; + igorY = 0; + trackIgor = 0; + drasculaX = 0; + drasculaY = 0; + trackDrascula = 0; _color = 0; blinking = 0; From fee20ebe31ca687e6198d51a858f8b6bd9fc190a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 16:04:48 +0300 Subject: [PATCH 1330/1332] DREAMWEB: Initialize few more class variables. CID 1003402 --- engines/dreamweb/dreamweb.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 08838a784ad1..6c6f5296f463 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -225,6 +225,13 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam _linePointer = 0; _lineDirection = 0; _lineLength = 0; + + _subtitles = 0; + _foreignRelease = 0; + _wonGame = 0; + _hasSpeech = 0; + _roomsSample = 0; + _copyProtection = 0; } DreamWebEngine::~DreamWebEngine() { From 7ef9798fd402acb0d6e231dfda6282cc286fab5d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 18 Oct 2013 16:11:54 +0300 Subject: [PATCH 1331/1332] TOUCHE: Initialize uninit variables. CID 1002423 --- engines/touche/touche.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 5c133ccbc62f..89cc1ad5afa3 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -51,6 +51,28 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) _saveLoadCurrentSlot = 0; _hideInventoryTexts = false; + _numOpcodes = 0; + _compressedSpeechData = 0; + _textData = 0; + _backdropBuffer = 0; + _menuKitData = 0; + _convKitData = 0; + + for (int i = 0; i < NUM_SEQUENCES; i++) + _sequenceDataTable[i] = 0; + + _programData = 0; + _programDataSize = 0; + _mouseData = 0; + _iconData = 0; + _currentBitmapWidth = 0; + _currentBitmapHeight = 0; + _currentImageWidth = 0; + _currentImageHeight = 0; + _roomWidth = 0; + _programTextDataPtr = 0; + _offscreenBuffer = 0; + _screenRect = Common::Rect(kScreenWidth, kScreenHeight); _roomAreaRect = Common::Rect(kScreenWidth, kRoomHeight); From a9aaca460875c6d7a244e3f36a1cad62ec09411d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 19 Oct 2013 00:44:10 +0300 Subject: [PATCH 1332/1332] FULLPIPE: Implement MovGraph2::findMinPath() --- engines/fullpipe/motion.cpp | 75 +++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index f6eb9d675316..f9158397c235 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -696,9 +696,11 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int } Common::Array tempLinkList; + double minPath = findMinPath(&linkInfoSource, &linkInfoDest, &tempLinkList); - if (findMinPath(&linkInfoSource, &linkInfoDest, &tempLinkList) < 0.0 || - ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size())) + debug(0, "MovGraph2::doWalkTo(): path: %lf parts: %d", minPath, tempLinkList.size()); + + if (minPath < 0.0 || ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size())) return 0; movInfo1.subIndex = idxsub; @@ -905,9 +907,74 @@ MovGraphLink *MovGraph2::findLink2(int x, int y) { } double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array *listObj) { - warning("STUB: MovGraph2::findMinPath()"); + LinkInfo linkInfoWorkSource; + + if (linkInfoSource->link != linkInfoDest->link || linkInfoSource->node != linkInfoDest->node) { + double minDistance = -1.0; + + if (linkInfoSource->node) { + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + MovGraphLink *lnk = (MovGraphLink *)*i; + + if ((lnk->_movGraphNode1 == linkInfoSource->node || lnk->_movGraphNode2 == linkInfoSource->node) && !(lnk->_flags & 0xA0000000)) { + linkInfoWorkSource.node = 0; + linkInfoWorkSource.link = lnk; + + Common::Array tmpList; + + lnk->_flags |= 0x80000000; + + double newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList); + + if (newDistance >= 0.0 && (minDistance < 0.0 || newDistance + lnk->_distance < minDistance)) { + listObj->clear(); + listObj->push_back(tmpList); + + minDistance = newDistance + lnk->_distance; + } + + lnk->_flags &= 0x7FFFFFFF; + } + } + } else if (linkInfoSource->link) { + linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode1; + linkInfoWorkSource.link = 0; + + Common::Array tmpList; - return 0.0; + double newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList); + + if (newDistance >= 0.0) { + listObj->clear(); + + listObj->push_back(linkInfoSource->link); + listObj->push_back(tmpList); + + minDistance = newDistance; + } + + linkInfoWorkSource.link = 0; + linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode2; + + tmpList.clear(); + + newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList); + + if (newDistance >= 0 && (minDistance < 0.0 || newDistance < minDistance)) { + listObj->push_back(linkInfoSource->link); + listObj->push_back(tmpList); + + minDistance = newDistance; + } + } + + return minDistance; + } else { + if (linkInfoSource->link) + listObj->push_back(linkInfoSource->link); + + return 0.0; + } } MovGraphNode *MovGraph::calcOffset(int ox, int oy) {